[SCM] blender/upstream: Imported Upstream version 2.65

mfv-guest at users.alioth.debian.org mfv-guest at users.alioth.debian.org
Thu Jan 10 15:31:19 UTC 2013


The following commit has been merged in the upstream branch:
commit 6bea31749a14dbe76770305e3feb935603b0e14e
Author: Matteo F. Vescovi <mfv.debian at gmail.com>
Date:   Thu Dec 20 15:35:26 2012 +0100

    Imported Upstream version 2.65

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ec75e9..3e1c8fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,7 +127,7 @@ option(WITH_PYTHON_MODULE "Enable building as a python module which runs without
 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
 option(WITH_IK_SOLVER     "Enable Legacy IK solver (only disable for development)" ON)
-option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
+option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" ON)
 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
 option(WITH_PLAYER        "Build Player" OFF)
@@ -186,13 +186,12 @@ unset(PLATFORM_DEFAULT)
 
 
 # Modifiers
-option(WITH_MOD_FLUID        	"Enable Elbeem Modifier (Fluid Simulation)" ON)
-option(WITH_MOD_SMOKE        	"Enable Smoke Modifier (Smoke Simulation)" ON)
-option(WITH_MOD_DECIMATE       	"Enable Decimate Modifier" ON)
-option(WITH_MOD_BOOLEAN        	"Enable Boolean Modifier" ON)
-option(WITH_MOD_REMESH        	"Enable Remesh Modifier" ON)
-option(WITH_MOD_CLOTH_ELTOPO   	"Enable Experimental cloth solver" OFF)
-mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
+option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
+option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
+option(WITH_MOD_BOOLEAN         "Enable Boolean Modifier" ON)
+option(WITH_MOD_REMESH          "Enable Remesh Modifier" ON)
+# option(WITH_MOD_CLOTH_ELTOPO    "Enable Experimental cloth solver" OFF)  # this is now only available in a branch
+# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
 
 # Image format support
@@ -235,17 +234,13 @@ option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)"
 option(WITH_RAYOPTIMIZATION	"Enable use of SIMD (SSE) optimizations for the raytracer" ON)
 if(UNIX AND NOT APPLE)
 	option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
+	option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
 mark_as_advanced(PYTHON_NUMPY_PATH)
 
-if(MINGW)
-	option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
-	mark_as_advanced(WITH_MINGW64)
-endif()
-
 # Cycles
 option(WITH_CYCLES					"Enable cycles Render Engine" ON)
 option(WITH_CYCLES_TEST				"Build cycles test application" OFF)
@@ -271,6 +266,9 @@ mark_as_advanced(WITH_ASSERT_ABORT)
 
 
 if(APPLE)
+	cmake_minimum_required(VERSION 2.8.8)
+	cmake_policy(VERSION 2.8.8)
+
 	if(NOT CMAKE_OSX_ARCHITECTURES)
 		set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
 		"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
@@ -290,18 +288,14 @@ if(APPLE)
 		set(OSX_SYSTEM unsupported)
 	endif()
 	message(STATUS "Detected system-version: " ${OSX_SYSTEM})
-	
-	if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
-			set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our minimum target, if you have higher sdk, weak linking happens
-	endif()
 
 	if(${CMAKE_GENERATOR} MATCHES "Xcode")
 	
-		##### workaround for actual official cmake incompatibility with xcode 4.3 #####	
+		##### cmake incompatibility with xcode  4.3 and higher #####
 		if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
-			message("Official cmake does not yet support Xcode 4.3, get a patched version here: http://www.jensverwiebe.de/Blender/CMake%202.8-7patched.zip")
+			message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
 		endif()
-		### end workaround for actual official cmake incompatibility with xcode 4.3 ###	
+		### end cmake incompatibility with xcode 4.3 and higher ###
 		
 		if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
 			# Xcode 4 defaults to the Apple LLVM Compiler.
@@ -316,7 +310,28 @@ if(APPLE)
 	endif()
 	
 	message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
+
+	if(${XCODE_VERSION} VERSION_LESS 4.3)
+		set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)  # use guaranteed existing sdk
+	else()
+		# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
+		# absolute pathes are more foolproof here !
+		set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
+		set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
+		set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
+	endif()
 	
+	if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+			set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our min. target, if you use higher sdk, weak linking happens
+	endif()
+	
+	if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
+		# force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
+		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+		add_definitions ("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+	endif()
+
 	option(WITH_COCOA	  "Use Cocoa framework instead of deprecated Carbon" ON)
 	option(USE_QTKIT	  "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
 	option(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
@@ -337,12 +352,20 @@ if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 	message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
 endif()
 
-if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK OR WITH_GAMEENGINE))
-	message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG/WITH_GAMEENGINE require WITH_AUDASPACE")
+if(NOT WITH_AUDASPACE)
+	if(WITH_OPENAL)
+		message(FATAL_ERROR "WITH_OPENAL requires WITH_AUDASPACE")
+	endif()
+	if(WITH_JACK)
+		message(FATAL_ERROR "WITH_JACK requires WITH_AUDASPACE")
+	endif()
+	if(WITH_GAMEENGINE)
+		message(FATAL_ERROR "WITH_GAMEENGINE requires WITH_AUDASPACE")
+	endif()
 endif()
 
 if(NOT WITH_SDL AND WITH_GHOST_SDL)
-	message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL to be ON")
+	message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL")
 endif()
 
 if(WITH_IMAGE_REDCODE AND ((NOT WITH_IMAGE_OPENJPEG) OR (NOT WITH_CODEC_FFMPEG)))
@@ -359,10 +382,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
 endif()
 
 
-if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
-	message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
-endif()
-
 # may as well build python module without a UI
 if(WITH_PYTHON_MODULE)
 	set(WITH_HEADLESS ON)
@@ -373,8 +392,8 @@ if(WITH_CYCLES)
 	set(WITH_OPENIMAGEIO ON)
 endif()
 
-# auto enable boost for cycles and booleans
-if(WITH_CYCLES OR WITH_MOD_BOOLEAN)
+# auto enable boost for cycles, booleans, audaspace or i18n
+if(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
 	set(WITH_BOOST ON)
 endif()
 
@@ -462,14 +481,14 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
 # On Unix:
 #   cmake ../blender \
-#         -D PYTHON_VERSION=3.2 \
-#         -D PYTHON_INCLUDE_DIR=/opt/py32/include/python3.2d \
-#         -D PYTHON_LIBRARY=/opt/py32/lib/libpython3.2d.so
+#         -D PYTHON_VERSION=3.3 \
+#         -D PYTHON_INCLUDE_DIR=/opt/py33/include/python3.3d \
+#         -D PYTHON_LIBRARY=/opt/py33/lib/libpython3.3d.so
 #
 # On Macs:
 #   cmake ../blender \
-#         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2 \
-#         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config \
+#         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3 \
+#         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config \
 #         -G Xcode
 #
 # When changing any of this remember to update the notes in doc/build_systems/cmake.txt
@@ -478,50 +497,52 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
 #Platform specifics
 
 if(UNIX AND NOT APPLE)
-
-	# set lib directory if it exists
-	if(CMAKE_SYSTEM_NAME MATCHES "Linux")
-		if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux64)
-		else()
-			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux)
+	macro(find_package_wrapper)
+		STRING(TOUPPER ${ARGV0} _NAME_UPPER)
+		if(${WITH_STATIC_LIBS})
+			set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
+			set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
 		endif()
-
-		if(NOT EXISTS ${LIBDIR})
-			unset(LIBDIR)
+		find_package(${ARGV})
+		if(${WITH_STATIC_LIBS})
+			set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
+			unset(_cmake_find_library_suffixes_back)
 		endif()
-	endif()
+	endmacro()
 
-	find_package(JPEG REQUIRED)
-	find_package(PNG REQUIRED)
-	find_package(ZLIB REQUIRED)
-	find_package(Freetype REQUIRED)
+	find_package_wrapper(JPEG REQUIRED)
+	find_package_wrapper(PNG REQUIRED)
+	find_package_wrapper(ZLIB REQUIRED)
+	find_package_wrapper(Freetype REQUIRED)
 
 	if(WITH_PYTHON)
-		# No way to set py32. remove for now.
+		# No way to set py33. remove for now.
 		# find_package(PythonLibs)
 
 		# Use our own instead, since wothout py is such a rare case,
 		# require this package
+		# XXX Linking errors with debian static python :/
+#		find_package_wrapper(PythonLibsUnix REQUIRED)
 		find_package(PythonLibsUnix REQUIRED)
 	endif()
 
-
 	if(WITH_IMAGE_OPENEXR)
-		find_package(OpenEXR)  # our own module
+		find_package_wrapper(OpenEXR)  # our own module
 		if(NOT OPENEXR_FOUND)
 			set(WITH_IMAGE_OPENEXR OFF)
 		endif()
 	endif()
 
 	if(WITH_IMAGE_OPENJPEG)
-		find_package(OpenJPEG)
+		find_package_wrapper(OpenJPEG)
 		if(NOT OPENJPEG_FOUND)
 			set(WITH_IMAGE_OPENJPEG OFF)
 		endif()
 	endif()
 
 	if(WITH_IMAGE_TIFF)
+		# XXX Linking errors with debian static tiff :/
+#		find_package_wrapper(TIFF)
 		find_package(TIFF)
 		if(NOT TIFF_FOUND)
 			set(WITH_IMAGE_TIFF OFF)
@@ -530,14 +551,14 @@ if(UNIX AND NOT APPLE)
 
 	# Audio IO
 	if(WITH_OPENAL)
-		find_package(OpenAL)
+		find_package_wrapper(OpenAL)
 		if(NOT OPENAL_FOUND)
 			set(WITH_OPENAL OFF)
 		endif()
 	endif()
 
 	if(WITH_SDL)
-		find_package(SDL)
+		find_package_wrapper(SDL)
 		mark_as_advanced(
 			SDLMAIN_LIBRARY
 			SDL_INCLUDE_DIR
@@ -551,7 +572,7 @@ if(UNIX AND NOT APPLE)
 	endif()
 
 	if(WITH_JACK)
-		find_package(Jack)
+		find_package_wrapper(Jack)
 		if(NOT JACK_FOUND)
 			set(WITH_JACK OFF)
 		endif()
@@ -559,22 +580,15 @@ if(UNIX AND NOT APPLE)
 
 	# Codecs
 	if(WITH_CODEC_SNDFILE)
-		find_package(SndFile)
+		find_package_wrapper(SndFile)
 		if(NOT SNDFILE_FOUND)
 			set(WITH_CODEC_SNDFILE OFF)
 		endif()
 	endif()
 
 	if(WITH_CODEC_FFMPEG)
-		# use lib dir if available and nothing else specified
-		if(LIBDIR AND NOT FFMPEG)
-			set(FFMPEG ${LIBDIR}/ffmpeg CACHE PATH "FFMPEG Directory")
-			# XXX, some distros might need 'theoraenc theoradec' too
-			set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale dirac_encoder mp3lame ogg orc-0.4 schroedinger-1.0 theora vorbis vorbisenc vpx x264 xvidcore faad asound CACHE STRING "FFMPEG Libraries")
-		else()
-			set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
-			set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
-		endif()
+		set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
+		set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
 
 		mark_as_advanced(FFMPEG)
 
@@ -590,54 +604,32 @@ if(UNIX AND NOT APPLE)
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
 	endif()
 
-	if(WITH_INTERNATIONAL)
-		find_library(INTL_LIBRARY
-			NAMES intl
-			PATHS
-			/sw/lib
-		)
-
-		find_library(ICONV_LIBRARY
-			NAMES iconv
-			PATHS
-			/sw/lib
-		)
-		mark_as_advanced(
-			ICONV_LIBRARY
-			INTL_LIBRARY
-		)
-
-		if(INTL_LIBRARY AND ICONV_LIBRARY)
-			set(GETTEXT_LIBRARIES ${INTL_LIBRARY} ${ICONV_LIBRARY})
-		endif()
-	endif()
-
 	if(WITH_FFTW3)
-		find_package(Fftw3)
+		find_package_wrapper(Fftw3)
 		if(NOT FFTW3_FOUND)
 			set(WITH_FFTW3 OFF)
 		endif()
 	endif()
 
 	if(WITH_OPENCOLLADA)
-		find_package(OpenCOLLADA)
+		find_package_wrapper(OpenCOLLADA)
 		if(OPENCOLLADA_FOUND)
-			find_package(XML2)
-			find_package(PCRE)
+			find_package_wrapper(XML2)
+			find_package_wrapper(PCRE)
 		else()
 			set(WITH_OPENCOLLADA OFF)
 		endif()
 	endif()
 
 	if(WITH_MEM_JEMALLOC)
-		find_package(JeMalloc)
+		find_package_wrapper(JeMalloc)
 		if(NOT JEMALLOC_FOUND)
 			set(WITH_MEM_JEMALLOC OFF)
 		endif()
 	endif()
 
 	if (WITH_INPUT_NDOF)
-		find_package(Spacenav)
+		find_package_wrapper(Spacenav)
 		if(NOT SPACENAV_FOUND)
 			set(WITH_INPUT_NDOF OFF)
 		endif()
@@ -652,17 +644,22 @@ if(UNIX AND NOT APPLE)
 	if(WITH_BOOST)
 		# uses in build instructions to override include and library variables
 		if(NOT BOOST_CUSTOM)
-			# use lib dir if available and nothing else specified
-			if(LIBDIR AND NOT BOOST_ROOT)
-				set(BOOST_ROOT ${LIBDIR}/boost)
+			# XXX No more lib dir, is this multithread stuff still needed?
+			if(${WITH_STATIC_LIBS})
+				set(Boost_USE_STATIC_LIBS ON)
+			endif()
+			if(NOT BOOST_ROOT)
 				set(Boost_USE_MULTITHREADED OFF)
 			else()
 				set(Boost_USE_MULTITHREADED ON)
 			endif()
-			if(WITH_CYCLES_OSL)
-				find_package(Boost 1.34 COMPONENTS filesystem python3 regex system thread) # osl_nodes uses boost_python
-			else()
-				find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
+			set(__boost_packages filesystem regex system thread date_time)
+			if (WITH_INTERNATIONAL)
+				list(APPEND __boost_packages locale)
+			endif()
+			find_package(Boost 1.34 COMPONENTS ${__boost_packages})
+			if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+				find_package(IcuLinux)
 			endif()
 			mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
 		endif()
@@ -674,12 +671,7 @@ if(UNIX AND NOT APPLE)
 	endif()
 
 	if(WITH_OPENIMAGEIO)
-		# use lib dir if available and nothing else specified
-		if(LIBDIR AND NOT OPENIMAGEIO_ROOT_DIR)
-			set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/oiio)
-		endif()
-
-		find_package(OpenImageIO)
+		find_package_wrapper(OpenImageIO)
 
 		set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
 		set(OPENIMAGEIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
@@ -699,12 +691,7 @@ if(UNIX AND NOT APPLE)
 	endif()
 
 	if(WITH_OPENCOLORIO)
-		# use lib dir if available and nothing else specified
-		if(LIBDIR AND NOT OPENCOLORIO_ROOT_DIR)
-			set(OPENCOLORIO_ROOT_DIR ${LIBDIR}/ocio)
-		endif()
-
-		find_package(OpenColorIO)
+		find_package_wrapper(OpenColorIO)
 
 		set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
 		set(OPENCOLORIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
@@ -716,14 +703,23 @@ if(UNIX AND NOT APPLE)
 		endif()
 	endif()
 
+	# XXX Maybe most of this section should go into an llvm module?
 	if(WITH_LLVM)
-		set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH	"Path to the LLVM installation")
-		set(LLVM_VERSION "3.0" CACHE STRING	"Version of LLVM to use" "")
+		# Set llvm version if not specified
+		if(NOT LLVM_VERSION)
+			set(LLVM_VERSION "3.0")
+		endif()
 		set(LLVM_STATIC YES)
 		if(LLVM_DIRECTORY)
-			set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
+			FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+			if(NOT LLVM_CONFIG)
+				FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+			endif()
 		else()
-			set(LLVM_CONFIG llvm-config)
+			FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION})
+			if(NOT LLVM_CONFIG)
+				FIND_PROGRAM(LLVM_CONFIG llvm-config)
+			endif()
 		endif()
 		execute_process(COMMAND ${LLVM_CONFIG} --version
 		                OUTPUT_VARIABLE LLVM_VERSION
@@ -734,23 +730,16 @@ if(UNIX AND NOT APPLE)
 		execute_process(COMMAND ${LLVM_CONFIG} --libdir
 		                OUTPUT_VARIABLE LLVM_LIB_DIR
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
-		execute_process(COMMAND ${LLVM_CONFIG} --includedir
-		                OUTPUT_VARIABLE LLVM_INCLUDES
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		find_library(LLVM_LIBRARY
-		             NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
+		             NAMES LLVMAnalysis # first of a whole bunch of libs to get
 		             PATHS ${LLVM_LIB_DIR})
 		message(STATUS "LLVM version  = ${LLVM_VERSION}")
 		message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
-		message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
 		message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
+		set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
+		set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
 
-		if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
-			# ensure include directory is added (in case of non-standard locations
-			include_directories(BEFORE "${LLVM_INCLUDES}")
-			string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
-			message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
-			add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
+		if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
 			if(LLVM_STATIC)
 				# if static LLVM libraries were requested, use llvm-config to generate
 				# the list of what libraries we need, and substitute that in the right
@@ -760,10 +749,12 @@ if(UNIX AND NOT APPLE)
 				                OUTPUT_STRIP_TRAILING_WHITESPACE)
 				string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
 			endif()
-			message(STATUS "LLVM library  = ${LLVM_LIBRARY}")
 		else()
 			message(FATAL_ERROR "LLVM not found.")
 		endif()
+
+		# Fix for conflict with Mesa llvmpipe
+		set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
 	endif()
 
 	if(WITH_CYCLES_OSL)
@@ -788,8 +779,6 @@ if(UNIX AND NOT APPLE)
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
@@ -828,7 +817,7 @@ if(UNIX AND NOT APPLE)
 		endif()
 	endif()
 
-	set(PLATFORM_LINKFLAGS "-pthread")
+	set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -pthread")
 
 	# lfs on glibc, all compilers should use
 	add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
@@ -840,7 +829,7 @@ if(UNIX AND NOT APPLE)
 	elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 		set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
 	# Solaris CC
-	elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") 
+	elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
 		set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
 		
 	# Intel C++ Compiler
@@ -873,10 +862,18 @@ elseif(WIN32)
 
 	if(CMAKE_COMPILER_IS_GNUCC)
 		set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
-
-		# Setup 64bit and 64bit windows systems		
+		INCLUDE (CheckCSourceCompiles) 
+		# Setup 64bit and 64bit windows systems
+		CHECK_C_SOURCE_COMPILES("
+			#ifndef __MINGW64__
+			#error
+			#endif
+			main(){}
+			" 
+			WITH_MINGW64)
+		
 		if(WITH_MINGW64)
-			message("Set 64 bit compiler for MinGW.")
+			message("Compiling for 64 bit with MinGW-w64.")
 			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
 		endif()
 	else()
@@ -891,13 +888,6 @@ elseif(WIN32)
 		
 	add_definitions(-DWIN32)
 
-	if(WITH_INTERNATIONAL)
-		set(ICONV ${LIBDIR}/iconv)
-		set(ICONV_INCLUDE_DIRS ${ICONV}/include)
-		set(ICONV_LIBRARIES iconv)
-		set(ICONV_LIBPATH ${ICONV}/lib)
-	endif()
-
 	set(JPEG "${LIBDIR}/jpeg")
 	set(JPEG_INCLUDE_DIR "${JPEG}/include")
 	set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
@@ -939,30 +929,22 @@ elseif(WIN32)
 	if(WITH_CYCLES_OSL)
 		set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
 	
-		message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
-	
 		find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
 		find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
 		find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
-		# WARNING! depends on correct order of OSL libs linking
 		list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
 		find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
 		find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
 	
 		if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
 			set(OSL_FOUND TRUE)
-			message(STATUS "OSL includes = ${OSL_INCLUDES}")
-			message(STATUS "OSL library = ${OSL_LIBRARIES}")
-			message(STATUS "OSL compiler = ${OSL_COMPILER}")
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	if(MSVC)
-		set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
+		set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
 
 		add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
 
@@ -992,17 +974,10 @@ elseif(WIN32)
 		set(CXX_WARNINGS "${_WARNINGS}")
 		unset(_WARNINGS)
 
-		if(WITH_INTERNATIONAL)
-			set(GETTEXT ${LIBDIR}/gettext)
-			set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
-			set(GETTEXT_LIBPATH ${GETTEXT}/lib)
-			set(GETTEXT_LIBRARIES gnu_gettext)
-		endif()
-		
 		if(WITH_MOD_CLOTH_ELTOPO)
 			set(LAPACK ${LIBDIR}/lapack)
 			# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
-			set(LAPACK_LIBPATH ${LAPACK}/lib)	
+			set(LAPACK_LIBPATH ${LAPACK}/lib)
 			set(LAPACK_LIBRARIES
 				${LIBDIR}/lapack/lib/libf2c.lib
 				${LIBDIR}/lapack/lib/clapack_nowrap.lib
@@ -1090,6 +1065,7 @@ elseif(WIN32)
 		if(WITH_IMAGE_OPENEXR)
 			set_lib_path(OPENEXR "openexr")
 			set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
+			set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
 			set(OPENEXR_LIBPATH ${OPENEXR}/lib)
 			set(OPENEXR_LIBRARIES
 				${OPENEXR_LIBPATH}/Iex.lib
@@ -1098,12 +1074,6 @@ elseif(WIN32)
 				${OPENEXR_LIBPATH}/Imath.lib
 				${OPENEXR_LIBPATH}/IlmThread.lib
 			)
-			set(OPENEXR_INCLUDE_DIRS
-				${OPENEXR_INCLUDE_DIR}
-				${OPENEXR_INCLUDE_DIR}/IlmImf
-				${OPENEXR_INCLUDE_DIR}/Iex
-				${OPENEXR_INCLUDE_DIR}/Imath
-			)
 		endif()
 
 		if(WITH_IMAGE_TIFF)
@@ -1121,9 +1091,17 @@ elseif(WIN32)
 
 		if(WITH_PYTHON)
 			# normally cached but not since we include them with blender
-			set(PYTHON_VERSION 3.2) # CACHE STRING)
+			if(MSVC10)
+				set(PYTHON_VERSION 3.2) # CACHE STRING)
+			else()
+				set(PYTHON_VERSION 3.3) # CACHE STRING)
+			endif()
+
 			set_lib_path(PYTHON "python")
-			set(PYTHON_LIBRARY ${PYTHON}/lib/python32.lib) #CACHE FILEPATH
+			STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
+			set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
+			unset(_PYTHON_VERSION_NO_DOTS)
+
 			#Shared includes for both vc2008 and vc2010
 			set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
 
@@ -1142,7 +1120,7 @@ elseif(WIN32)
 			else()
 				set(BOOST_LIBPATH ${BOOST}/lib)
 				set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
-				set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")					
+				set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
 			endif()
 			set(BOOST_LIBRARIES
 				optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
@@ -1151,23 +1129,28 @@ elseif(WIN32)
 				debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
 				debug libboost_regex-${BOOST_DEBUG_POSTFIX}
 				debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
-				if(WITH_CYCLES_OSL)
-					set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
-						optimized libboost_python3-${BOOST_POSTFIX}
-						debug libboost_python3-${BOOST_DEBUG_POSTFIX})
-				endif(WITH_CYCLES_OSL)
-				
+			if(WITH_INTERNATIONAL)
+				set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
+					optimized libboost_locale-${BOOST_POSTFIX}
+					debug libboost_locale-${BOOST_DEBUG_POSTFIX})
+			endif(WITH_INTERNATIONAL)
 			set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
 		endif()
 			
 		if(WITH_OPENIMAGEIO)
 			set(OPENIMAGEIO ${LIBDIR}/openimageio)
 			set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
-			set(OPENIMAGEIO_LIBRARIES OpenImageIO)
+			set(OPENIMAGEIO_LIBRARIES optimized OpenImageIO debug OpenImageIO_d)
 			set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
-			set(OPENIMAGEIO_DEFINITIONS)
+			set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
 		endif()
 
+		if(WITH_LLVM)
+			set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH	"Path to the LLVM installation")
+			file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
+			set(LLVM_STATIC YES)
+		endif()
+	
 		if(WITH_OPENCOLORIO)
 			set(OPENCOLORIO ${LIBDIR}/opencolorio)
 			set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1176,6 +1159,7 @@ elseif(WIN32)
 			set(OPENCOLORIO_DEFINITIONS)
 		endif()
 
+
 		set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
 
 		# MSVC only, Mingw doesnt need
@@ -1191,7 +1175,7 @@ elseif(WIN32)
 		blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
 
 	elseif(CMAKE_COMPILER_IS_GNUCC)
-	# keep GCC specific stuff here		
+	# keep GCC specific stuff here
 		set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
 		set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
@@ -1210,16 +1194,8 @@ elseif(WIN32)
 
 		add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
 
-
 		add_definitions(-DFREE_WINDOWS)
 
-		if(WITH_INTERNATIONAL)
-			set(GETTEXT ${LIBDIR}/gettext)
-			set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
-			set(GETTEXT_LIBPATH ${GETTEXT}/lib)
-			set(GETTEXT_LIBRARIES intl)
-		endif()
-		
 		set(PNG "${LIBDIR}/png")
 		set(PNG_INCLUDE_DIR "${PNG}/include")
 		set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
@@ -1239,7 +1215,7 @@ elseif(WIN32)
 		#comes with own pthread library
 		if(NOT WITH_MINGW64)
 			set(PTHREADS ${LIBDIR}/pthreads)
-			set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
+			#set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
 			set(PTHREADS_LIBPATH ${PTHREADS}/lib)
 			set(PTHREADS_LIBRARIES pthreadGC2)
 		endif()
@@ -1287,6 +1263,7 @@ elseif(WIN32)
 
 		if(WITH_IMAGE_OPENEXR)
 			set(OPENEXR ${LIBDIR}/openexr)
+			set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
 			set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
 			set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
 			set(OPENEXR_LIBPATH ${OPENEXR}/lib)
@@ -1311,9 +1288,9 @@ elseif(WIN32)
 
 		if(WITH_PYTHON)
 			# normally cached but not since we include them with blender
-			set(PYTHON_VERSION 3.2) #  CACHE STRING)
+			set(PYTHON_VERSION 3.3) #  CACHE STRING)
 			set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
-			set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib")  # CACHE FILEPATH)
+			set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python33mw.lib")  # CACHE FILEPATH)
 
 			# uncached vars
 			set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
@@ -1329,7 +1306,7 @@ elseif(WIN32)
 			else()
 				set(BOOST_POSTFIX "mgw46-mt-s-1_49")
 				set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_49")
-			endif()		
+			endif()
 			set(BOOST_LIBRARIES
 				optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
 				boost_regex-${BOOST_POSTFIX}
@@ -1337,12 +1314,11 @@ elseif(WIN32)
 				debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
 				boost_regex-${BOOST_DEBUG_POSTFIX}
 				boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
-				if(WITH_CYCLES_OSL)
-					set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
-						optimized libboost_python3-${BOOST_POSTFIX}
-						debug libboost_python3-${BOOST_DEBUG_POSTFIX}) 
-				endif(WITH_CYCLES_OSL)
-					
+			if(WITH_INTERNATIONAL)
+				set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
+					optimized boost_locale-${BOOST_POSTFIX}
+					debug boost_locale-${BOOST_DEBUG_POSTFIX}) 
+			endif()
 			set(BOOST_LIBPATH ${BOOST}/lib)
 			set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
 		endif()
@@ -1355,6 +1331,34 @@ elseif(WIN32)
 			set(OPENIMAGEIO_DEFINITIONS)
 		endif()
 		
+		if(WITH_LLVM)
+			set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH	"Path to the LLVM installation")
+			set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
+			#Explicitly set llvm lib order.
+			#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
+			set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
+				LLVMAsmParser LLVMAsmPrinter
+				LLVMBitReader LLVMBitWriter
+				LLVMDebugInfo LLVMExecutionEngine
+				LLVMInstCombine LLVMInstrumentation
+				LLVMInterpreter LLVMJIT
+				LLVMLinker LLVMMC
+				LLVMMCDisassembler LLVMMCJIT
+				LLVMMCParser LLVMObject
+				LLVMRuntimeDyld 
+				LLVMSupport
+				LLVMTableGen LLVMTarget
+				LLVMTransformUtils LLVMVectorize
+				LLVMX86AsmParser LLVMX86AsmPrinter
+				LLVMX86CodeGen LLVMX86Desc
+				LLVMX86Disassembler LLVMX86Info
+				LLVMX86Utils LLVMipa
+				LLVMipo LLVMCore)
+				#imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
+				set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
+			set(LLVM_STATIC YES)
+		endif()
+		
 		if(WITH_OPENCOLORIO)
 			set(OPENCOLORIO ${LIBDIR}/opencolorio)
 			set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1377,16 +1381,6 @@ elseif(APPLE)
 		set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
 	endif()
 
-	if(${XCODE_VERSION} VERSION_LESS 4.3)
-		set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)  # use guaranteed existing sdk
-	else()
-		# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
-		# absolute pathes are more foolproof here !
-		set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
-		set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
-		set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
-	endif()	
-	
 	if(WITH_LIBS10.5)
 		set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
 	else()
@@ -1409,10 +1403,13 @@ elseif(APPLE)
 	endif()
 
 	if(WITH_JACK)
-		set(JACK /usr)
-		set(JACK_INCLUDE_DIRS ${JACK}/include/jack)
-		set(JACK_LIBRARIES jack)
-		set(JACK_LIBPATH ${JACK}/lib)
+		find_library(JACK_FRAMEWORK
+			NAMES jackmp
+		)
+		set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
+		if(NOT JACK_FRAMEWORK)
+			set(WITH_JACK OFF)
+		endif()
 	endif()
 
 	if(WITH_CODEC_SNDFILE)
@@ -1424,13 +1421,13 @@ elseif(APPLE)
 
 	if(WITH_PYTHON)
 		if(NOT WITH_PYTHON_MODULE)
-			# we use precompiled libraries for py 3.2 and up by default
+			# we use precompiled libraries for py 3.3 and up by default
 
 			# normally cached but not since we include them with blender
-			set(PYTHON_VERSION 3.2)
-			set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
+			set(PYTHON_VERSION 3.3)
+			set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
 			# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
-			set(PYTHON_LIBRARY python${PYTHON_VERSION})
+			set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
 			set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
 			# set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
 		else()
@@ -1450,13 +1447,6 @@ elseif(APPLE)
 		set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
 	endif()
 
-	if(WITH_INTERNATIONAL)
-		set(GETTEXT ${LIBDIR}/gettext)
-		set(GETTEXT_INCLUDE_DIRS "${GETTEXT}/include")
-		set(GETTEXT_LIBRARIES intl iconv)
-		set(GETTEXT_LIBPATH ${GETTEXT}/lib)
-	endif()
-
 	if(WITH_FFTW3)
 		set(FFTW3 ${LIBDIR}/fftw3)
 		set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
@@ -1523,10 +1513,10 @@ elseif(APPLE)
 		if(WITH_INPUT_NDOF)
 			# This thread it *should* work and check the framework - campbell
 			# http://www.cmake.org/pipermail/cmake/2005-December/007740.html
-			find_library(3D_CONNEXION_CLIENT_LIBRARY
+			find_library(3DCONNEXION_CLIENT_FRAMEWORK
 				NAMES 3DconnexionClient
 			)
-			if(NOT 3D_CONNEXION_CLIENT_LIBRARY)
+			if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
 				set(WITH_INPUT_NDOF OFF)
 			endif()
 
@@ -1535,6 +1525,10 @@ elseif(APPLE)
 			endif()
 		endif()
 
+	if(WITH_JACK)
+		set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework jackmp")
+	endif()
+
 	else()
 		set(PLATFORM_CFLAGS "-pipe -funsigned-char")
 		set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
@@ -1597,11 +1591,11 @@ elseif(APPLE)
 	if(WITH_BOOST)
 		set(BOOST ${LIBDIR}/boost)
 		set(BOOST_INCLUDE_DIR ${BOOST}/include)
-		if(WITH_CYCLES_OSL)
-			set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_python3-mt boost_regex-mt boost_system-mt boost_thread-mt)
-		else(WITH_CYCLES_OSL)
-			set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
-		endif(WITH_CYCLES_OSL)
+		set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt)
+		if (WITH_INTERNATIONAL)
+			list(APPEND BOOST_LIBRARIES boost_locale-mt)
+			set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale needs it !
+		endif()
 		set(BOOST_LIBPATH ${BOOST}/lib)
 		set(BOOST_DEFINITIONS)
 	endif()
@@ -1609,7 +1603,7 @@ elseif(APPLE)
 	if(WITH_OPENIMAGEIO)
 		set(OPENIMAGEIO ${LIBDIR}/openimageio)
 		set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
-		set(OPENIMAGEIO_LIBRARIES -force_load ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
+		set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
 		set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
 		set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
 	endif()
@@ -1624,9 +1618,9 @@ elseif(APPLE)
 
 	if(WITH_LLVM)
 		set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH	"Path to the LLVM installation")
-		set(LLVM_VERSION "3.1" CACHE STRING	"Version of LLVM to use" "")
+		set(LLVM_VERSION "3.1" CACHE STRING	"Version of LLVM to use")
 		set(LLVM_STATIC YES)
-		if(LLVM_DIRECTORY)
+		if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
 			set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
 		else()
 			set(LLVM_CONFIG llvm-config)
@@ -1640,23 +1634,11 @@ elseif(APPLE)
 		execute_process(COMMAND ${LLVM_CONFIG} --libdir
 		                OUTPUT_VARIABLE LLVM_LIB_DIR
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
-		execute_process(COMMAND ${LLVM_CONFIG} --includedir
-		                OUTPUT_VARIABLE LLVM_INCLUDES
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		find_library(LLVM_LIBRARY
-		             NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
+		             NAMES LLVMAnalysis # first of a whole bunch of libs to get
 		             PATHS ${LLVM_LIB_DIR})
-		message(STATUS "LLVM version  = ${LLVM_VERSION}")
-		message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
-		message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
-		message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
 
-		if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
-			# ensure include directory is added (in case of non-standard locations
-			include_directories(BEFORE "${LLVM_INCLUDES}")
-			string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
-			message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
-			add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
+		if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
 			if(LLVM_STATIC)
 				# if static LLVM libraries were requested, use llvm-config to generate
 				# the list of what libraries we need, and substitute that in the right
@@ -1666,7 +1648,6 @@ elseif(APPLE)
 				                OUTPUT_STRIP_TRAILING_WHITESPACE)
 				string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
 			endif()
-			message(STATUS "LLVM library  = ${LLVM_LIBRARY}")
 		else()
 			message(FATAL_ERROR "LLVM not found.")
 		endif()
@@ -1675,8 +1656,6 @@ elseif(APPLE)
 	if(WITH_CYCLES_OSL)
 		set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
 	
-		message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
-	
 		find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
 		find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
 		find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
@@ -1687,14 +1666,9 @@ elseif(APPLE)
 	
 		if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
 			set(OSL_FOUND TRUE)
-			message(STATUS "OSL includes = ${OSL_INCLUDES}")
-			message(STATUS "OSL library = ${OSL_LIBRARIES}")
-			message(STATUS "OSL compiler = ${OSL_COMPILER}")
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	set(EXETYPE MACOSX_BUNDLE)
@@ -1723,6 +1697,10 @@ if(APPLE OR WIN32)
 	endif()
 endif()
 
+if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
+	message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
+endif()
+
 if(WITH_CYCLES)
 	if(NOT WITH_OPENIMAGEIO)
 		message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES")
@@ -1738,6 +1716,11 @@ if(WITH_CYCLES)
 	endif()
 endif()
 
+if(WITH_INTERNATIONAL)
+	if(NOT WITH_BOOST)
+		message(FATAL_ERROR "Internationalization reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
+	endif()
+endif()
 
 # See TEST_SSE_SUPPORT() for how this is defined.
 
@@ -1881,12 +1864,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
-	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)  # C only
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
+	# gcc 4.2 gives annoying warnings on every file with this
+	if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
+		ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
+	endif()
+
 	# disable because it gives warnings for printf() & friends.
 	# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
 
@@ -1898,11 +1885,15 @@ if(CMAKE_COMPILER_IS_GNUCC)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
-	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
+	# gcc 4.2 gives annoying warnings on every file with this
+	if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
+		ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
+	endif()
+
 	# causes too many warnings
 	if(NOT APPLE)
 		ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
@@ -1972,12 +1963,13 @@ if(WITH_PYTHON)
 
 	if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
 		# set but invalid
-		if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "")
-			if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
-				message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
-				                "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
-				set(WITH_PYTHON_INSTALL_NUMPY OFF)
-			endif()
+        # -- disabled until we make numpy bundled with blender - campbell
+		if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
+#			if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
+#				message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
+#				                "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
+#				set(WITH_PYTHON_INSTALL_NUMPY OFF)
+#			endif()
 		# not set, so initialize
 		else()
 			string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
@@ -2015,9 +2007,10 @@ if(WITH_PYTHON)
 	endif()
 endif()
 
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
+# Include warnings first, so its possible to disable them with user defined flags
+# eg: -Wno-uninitialized
+set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
+set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}")
 
 #-------------------------------------------------------------------------------
 # Global Defines
@@ -2141,7 +2134,6 @@ if(FIRST_RUN)
 	info_cfg_text("Modifiers:")
 	info_cfg_option(WITH_MOD_BOOLEAN)
 	info_cfg_option(WITH_MOD_REMESH)
-	info_cfg_option(WITH_MOD_DECIMATE)
 	info_cfg_option(WITH_MOD_FLUID)
 	info_cfg_option(WITH_MOD_OCEANSIM)
 
diff --git a/GNUmakefile b/GNUmakefile
index 90d76df..c1b67c8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -163,20 +163,28 @@ help:
 	@echo "  * package_archive - build an archive package"
 	@echo ""
 	@echo "Testing Targets (not associated with building blender)"
-	@echo "  * test            - run ctest, currently tests import/export, operator execution and that python modules load"
-	@echo "  * test_cmake      - runs our own cmake file checker which detects errors in the cmake file list definitions"
-	@echo "  * test_pep8       - checks all python script are pep8 which are tagged to use the stricter formatting"
-	@echo "  * test_deprecated - checks for deprecation tags in our code which may need to be removed"
-	@echo "  * test_style      - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
+	@echo "  * test               - run ctest, currently tests import/export, operator execution and that python modules load"
+	@echo "  * test_cmake         - runs our own cmake file checker which detects errors in the cmake file list definitions"
+	@echo "  * test_pep8          - checks all python script are pep8 which are tagged to use the stricter formatting"
+	@echo "  * test_deprecated    - checks for deprecation tags in our code which may need to be removed"
+	@echo "  * test_style_c       - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
+	@echo "  * test_style_c_qtc   - same as test_style but outputs QtCreator tasks format"
+	@echo "  * test_style_osl     - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
+	@echo "  * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
 	@echo ""
 	@echo "Static Source Code Checking (not associated with building blender)"
-	@echo "  * check_cppcheck    - run blender source through cppcheck (C & C++)"
-	@echo "  * check_clang_array - run blender source through clang array checking script (C & C++)"
-	@echo "  * check_splint      - run blenders source through splint (C only)"
-	@echo "  * check_sparse      - run blenders source through sparse (C only)"
-	@echo "  * check_smatch      - run blenders source through smatch (C only)"
-	@echo "  * check_spelling_c  - check for spelling errors (C/C++ only)"
-	@echo "  * check_spelling_py - check for spelling errors (Python only)"
+	@echo "  * check_cppcheck       - run blender source through cppcheck (C & C++)"
+	@echo "  * check_clang_array    - run blender source through clang array checking script (C & C++)"
+	@echo "  * check_splint         - run blenders source through splint (C only)"
+	@echo "  * check_sparse         - run blenders source through sparse (C only)"
+	@echo "  * check_smatch         - run blenders source through smatch (C only)"
+	@echo "  * check_spelling_c     - check for spelling errors (OSL only)"
+	@echo "  * check_spelling_c_qtc - same as check_spelling_c but outputs QtCreator tasks format"
+	@echo "  * check_spelling_osl   - check for spelling errors (C/C++ only)"
+	@echo "  * check_spelling_py    - check for spelling errors (Python only)"
+	@echo ""
+	@echo "Utilities (not associated with building blender)"
+	@echo "  * tbz      - create a compressed svn export 'blender_archive.tar.bz2'"
 	@echo ""
 	@echo "Documentation Targets (not associated with building blender)"
 	@echo "  * doc_py   - generate sphinx python api docs"
@@ -207,31 +215,51 @@ test:
 
 # run pep8 check check on scripts we distribute.
 test_pep8:
-	python3.2 source/tests/pep8.py > test_pep8.log 2>&1
+	python3 source/tests/pep8.py > test_pep8.log 2>&1
 	@echo "written: test_pep8.log"
 
 # run some checks on our cmakefiles.
 test_cmake:
-	python3.2 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
+	python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
 	@echo "written: test_cmake_consistency.log"
 
 # run deprecation tests, see if we have anything to remove.
 test_deprecated:
-	python3.2 source/tests/check_deprecated.py
+	python3 source/tests/check_deprecated.py
+
+test_style_c:
+	# run our own checks on C/C++ style
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check
+
+test_style_c_qtc:
+	# run our own checks on C/C++ style
+	USE_QTC_TASK=1 \
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check > \
+	test_style.tasks
+	@echo "written: test_style.tasks"
+
+
+test_style_osl:
+	# run our own checks on C/C++ style
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
 
-test_style:
+
+test_style_osl_qtc:
 	# run our own checks on C/C++ style
-	PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check
+	USE_QTC_TASK=1 \
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders > \
+	test_style.tasks
+	@echo "written: test_style.tasks"
 
 # -----------------------------------------------------------------------------
 # Project Files
 #
 
 project_qtcreator:
-	python3.2 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
+	python3 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
 
 project_netbeans:
-	python3.2 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
+	python3 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
 
 project_eclipse:
 	cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR)
@@ -243,29 +271,55 @@ project_eclipse:
 
 check_cppcheck:
 	$(CMAKE_CONFIG)
-	cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
+	cd $(BUILD_DIR) ; \
+	python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
 
 check_clang_array:
 	$(CMAKE_CONFIG)
-	cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
+	cd $(BUILD_DIR) ; \
+	python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
 
 check_splint:
 	$(CMAKE_CONFIG)
-	cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
+	cd $(BUILD_DIR) ; \
+	python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
 
 check_sparse:
 	$(CMAKE_CONFIG)
-	cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
+	cd $(BUILD_DIR) ; \
+	python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
 
 check_smatch:
 	$(CMAKE_CONFIG)
-	cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
+	cd $(BUILD_DIR) ; \
+	python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
 
 check_spelling_py:
-	cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
+	cd $(BUILD_DIR) ; \
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
 
 check_spelling_c:
-	cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
+	cd $(BUILD_DIR) ; \
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
+
+check_spelling_c_qtc:
+	cd $(BUILD_DIR) ; USE_QTC_TASK=1 \
+	PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source > \
+	$(BLENDER_DIR)/check_spelling_c.tasks
+
+check_spelling_osl:
+	cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
+
+# -----------------------------------------------------------------------------
+# Utilities
+#
+
+tbz:
+	svn export . blender_archive
+	tar cjf blender_archive.tar.bz2 blender_archive/
+	rm -rf blender_archive/
+	@echo "blender_archive.tar.bz2 written"
+
 
 # -----------------------------------------------------------------------------
 # Documentation
@@ -286,7 +340,7 @@ doc_dna:
 	@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
 
 doc_man:
-	python3.2 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender
+	python3 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender
 
 
 clean:
diff --git a/SConstruct b/SConstruct
index 7b92a0c..c2bae04 100644
--- a/SConstruct
+++ b/SConstruct
@@ -264,7 +264,6 @@ if 'blenderlite' in B.targets:
     target_env_defs['WITH_BF_FLUID'] = False
     target_env_defs['WITH_BF_OCEANSIM'] = False
     target_env_defs['WITH_BF_SMOKE'] = False
-    target_env_defs['WITH_BF_DECIMATE'] = False
     target_env_defs['WITH_BF_BOOLEAN'] = False
     target_env_defs['WITH_BF_REMESH'] = False
     target_env_defs['WITH_BF_PYTHON'] = False
@@ -307,6 +306,15 @@ if env['OURPLATFORM']=='darwin':
         else:
             env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
 
+    if env['WITH_BF_CYCLES_OSL'] == 1:	
+        OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
+        # we need 2 variants of passing the oslexec with the force_load option, string and list type atm
+        env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery'])
+        env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker',OSX_OSL_LIBPATH +'/liboslexec.a'])
+
+    # Trying to get rid of eventually clashes, we export some explicite as local symbols		
+    env.Append(LINKFLAGS=['-Xlinker','-unexported_symbols_list','-Xlinker','./source/creator/osx_locals.map'])
+
 if env['WITH_BF_OPENMP'] == 1:
         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
                 env['CCFLAGS'].append('/openmp')
@@ -423,16 +431,22 @@ if not quickie and do_clean:
 # with _any_ library but since we used a fixed python version this tends to
 # be most problematic.
 if env['WITH_BF_PYTHON']:
-    py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h")
-
-    if not os.path.exists(py_h):
-        print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n"
+    found_python_h = found_pyconfig_h = False
+    for bf_python_inc in env.subst('${BF_PYTHON_INC}').split():
+        py_h = os.path.join(Dir(bf_python_inc).abspath, "Python.h")
+        if os.path.exists(py_h):
+            found_python_h = True
+        py_h = os.path.join(Dir(bf_python_inc).abspath, "pyconfig.h")
+        if os.path.exists(py_h):
+            found_pyconfig_h = True
+
+    if not (found_python_h and found_pyconfig_h):
+        print("\nMissing: Python.h and/or pyconfig.h in\"" + env.subst('${BF_PYTHON_INC}') + "\",\n"
               "  Set 'BF_PYTHON_INC' to point "
-              "to a valid python include path.\n  Containing "
-              "Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
+              "to valid python include path(s).\n Containing "
+              "Python.h and pyconfig.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
 
         Exit()
-    del py_h
 
 
 if not os.path.isdir ( B.root_build_dir):
@@ -572,11 +586,11 @@ B.init_lib_dict()
 
 Export('env')
 
-BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
+VariantDir(B.root_build_dir+'/source', 'source', duplicate=0)
 SConscript(B.root_build_dir+'/source/SConscript')
-BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
+VariantDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
 SConscript(B.root_build_dir+'/intern/SConscript')
-BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
+VariantDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
 SConscript(B.root_build_dir+'/extern/SConscript')
 
 # now that we have read all SConscripts, we know what
@@ -686,6 +700,8 @@ if env['OURPLATFORM']!='darwin':
             source.remove('kernel.cpp')
             source.remove('CMakeLists.txt')
             source.remove('svm')
+            source.remove('closure')
+            source.remove('shaders')
             source.remove('osl')
             source=['intern/cycles/kernel/'+s for s in source]
             source.append('intern/cycles/util/util_color.h')
@@ -701,6 +717,14 @@ if env['OURPLATFORM']!='darwin':
             if '__pycache__' in source: source.remove('__pycache__')
             source=['intern/cycles/kernel/svm/'+s for s in source]
             scriptinstall.append(env.Install(dir=dir,source=source))
+            # closure
+            dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'closure')
+            source=os.listdir('intern/cycles/kernel/closure')
+            if '.svn' in source: source.remove('.svn')
+            if '_svn' in source: source.remove('_svn')
+            if '__pycache__' in source: source.remove('__pycache__')
+            source=['intern/cycles/kernel/closure/'+s for s in source]
+            scriptinstall.append(env.Install(dir=dir,source=source))
 
             # licenses
             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
@@ -720,6 +744,22 @@ if env['OURPLATFORM']!='darwin':
                     cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
                     scriptinstall.append(env.Install(dir=dir,source=cubin_file))
 
+            # osl shaders
+            if env['WITH_BF_CYCLES_OSL']:
+                dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'shader')
+
+                osl_source_dir = Dir('./intern/cycles/kernel/shaders').srcnode().path
+                oso_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel/shaders')
+
+                headers='node_color.h node_fresnel.h node_texture.h oslutil.h stdosl.h'.split()
+                source=['intern/cycles/kernel/shaders/'+s for s in headers]
+                scriptinstall.append(env.Install(dir=dir,source=source))
+
+                for f in os.listdir(osl_source_dir):
+                    if f.endswith('.osl'):
+                        oso_file = os.path.join(oso_build_dir, f.replace('.osl', '.oso'))
+                        scriptinstall.append(env.Install(dir=dir,source=oso_file))
+
     if env['WITH_BF_OCIO']:
         colormanagement = os.path.join('release', 'datafiles', 'colormanagement')
 
@@ -820,10 +860,6 @@ else:
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
     dllsources = []
 
-    if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
-        # For MinGW and linuxcross static linking will be used
-        dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
-
     dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
     # Used when linking to libtiff was dynamic
     # keep it here until compilation on all platform would be ok
@@ -869,9 +905,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
         dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
     dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
 
-    if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
-        dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
-
     if env['WITH_BF_OCIO']:
         if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
             dllsources.append('${LCGDIR}/opencolorio/bin/OpenColorIO.dll')
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
new file mode 100755
index 0000000..072e999
--- /dev/null
+++ b/build_files/build_environment/install_deps.sh
@@ -0,0 +1,1875 @@
+#!/bin/bash
+
+# Parse command line!
+ARGS=$( \
+getopt \
+-o s:i:t:h \
+--long source:,install:,threads:,help,with-all,with-osl,all-static,force-all,force-python,\
+force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg,\
+skip-python,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg \
+-- "$@" \
+)
+
+DISTRO=""
+SRC="$HOME/src/blender-deps"
+INST="/opt/lib"
+CWD=$PWD
+
+# Do not install some optional, potentially conflicting libs by default...
+WITH_ALL=false
+
+# Do not yet enable osl, use --with-osl (or --with-all) option to try it.
+WITH_OSL=false
+
+# Try to link everything statically. Use this to produce portable versions of blender.
+ALL_STATIC=false
+
+THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
+if [ -z "$THREADS" ]; then
+  THREADS=1
+fi
+
+COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
+Built libs of dependencies needed to be compiled will be installed into '\$INST'.
+Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
+or use --source/--install options, if you want to use other paths!
+
+Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
+Full install: \$WITH_ALL (use --with-all option to enable it).
+Building OSL: \$WITH_OSL (use --with-osl option to enable it).
+All static linking: \$ALL_STATIC (use --all-static option to enable it).
+
+Use --help to show all available options!\""
+
+ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
+    -h, --help
+        Show this message and exit.
+
+    -s <path>, --source=<path>
+        Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
+
+    -i <path>, --install=<path>
+        Use a specific path where to install built libraries (defaults to '\$INST').
+
+    -t n, --threads=n
+        Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
+
+    --with-all
+        By default, a number of optional and not-so-often needed libraries are not installed.
+        This option will try to install them, at the cost of potential conflicts (depending on
+        how your package system is set…).
+        Note this option also implies all other (more specific) --with-foo options below.
+
+    --with-osl
+        Try to install or build the OpenShadingLanguage libraries (and their dependencies).
+        Still experimental!
+
+    --all-static
+        Build libraries as statically as possible, to create static builds of Blender.
+
+    --force-all
+        Force the rebuild of all built libraries.
+
+    --force-python
+        Force the rebuild of Python.
+
+    --force-boost
+        Force the rebuild of Boost.
+
+    --force-ocio
+        Force the rebuild of OpenColorIO.
+
+    --force-oiio
+        Force the rebuild of OpenImageIO.
+
+    --force-llvm
+        Force the rebuild of LLVM.
+
+    --force-osl
+        Force the rebuild of OpenShadingLanguage.
+
+    --force-ffmpeg
+        Force the rebuild of FFMpeg.
+
+    Note about the --force-foo options:
+        * They obviously only have an effect if those libraries are built by this script
+          (i.e. if there is no available and satisfactory package)!
+        * If the “force-rebuilt” library is a dependency of others, it will force the rebuild
+          of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
+        * Do not forget --with-osl if you built it and still want it!
+
+    --skip-python
+        Unconditionally skip Python installation/building.
+
+    --skip-boost
+        Unconditionally skip Boost installation/building.
+
+    --skip-ocio
+        Unconditionally skip OpenColorIO installation/building.
+
+    --skip-oiio
+        Unconditionally skip OpenImageIO installation/building.
+
+    --skip-llvm
+        Unconditionally skip LLVM installation/building.
+
+    --skip-osl
+        Unconditionally skip OpenShadingLanguage installation/building.
+
+    --skip-ffmpeg
+        Unconditionally skip FFMpeg installation/building.\""
+
+PYTHON_VERSION="3.3.0"
+PYTHON_VERSION_MIN="3.3"
+PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
+PYTHON_FORCE_REBUILD=false
+PYTHON_SKIP=false
+
+BOOST_VERSION="1.51.0"
+_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
+BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
+BOOST_VERSION_MIN="1.49"
+BOOST_FORCE_REBUILD=false
+BOOST_SKIP=false
+
+OCIO_VERSION="1.0.7"
+OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
+OCIO_VERSION_MIN="1.0"
+OCIO_FORCE_REBUILD=false
+OCIO_SKIP=false
+
+OIIO_VERSION="1.1.1"
+OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
+OIIO_VERSION_MIN="1.1"
+OIIO_FORCE_REBUILD=false
+OIIO_SKIP=false
+
+LLVM_VERSION="3.1"
+LLVM_VERSION_MIN="3.0"
+LLVM_VERSION_FOUND=""
+LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
+LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
+LLVM_FORCE_REBUILD=false
+LLVM_SKIP=false
+
+# OSL needs to be compiled for now!
+OSL_VERSION="1.2.0"
+OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz"
+OSL_FORCE_REBUILD=false
+OSL_SKIP=false
+
+FFMPEG_VERSION="1.0"
+FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
+FFMPEG_VERSION_MIN="0.7.6"
+FFMPEG_FORCE_REBUILD=false
+FFMPEG_SKIP=false
+_ffmpeg_list_sep=";"
+
+# FFMPEG optional libs.
+VORBIS_USE=false
+VORBIS_DEV=""
+SCHRO_USE=false
+SCRHO_DEV=""
+THEORA_USE=false
+THEORA_DEV=""
+XVID_USE=false
+XVID_DEV=""
+X264_USE=false
+X264_DEV=""
+X264_VERSION_MIN=0.118
+VPX_USE=false
+VPX_VERSION_MIN=0.9.7
+VPX_DEV=""
+MP3LAME_USE=false
+MP3LAME_DEV=""
+OPENJPEG_USE=false
+OPENJPEG_DEV=""
+
+# Switch to english language, else some things (like check_package_DEB()) won't work!
+LANG_BACK=$LANG
+LANG=""
+export LANG
+
+
+_echo() {
+  if [ "X$1" = "X-n" ]; then
+     shift; printf "%s" "$@"
+  else
+     printf "%s\n" "$@"
+  fi
+}
+
+ERROR() {
+  _echo "$@"
+}
+
+INFO() {
+  _echo "$@"
+}
+
+# Finish parsing the commandline args.
+eval set -- "$ARGS"
+while true; do
+  case $1 in
+    -s|--source)
+      SRC="$2"; shift; shift; continue
+    ;;
+    -i|--install)
+      INST="$2"; shift; shift; continue
+    ;;
+    -t|--threads)
+      THREADS="$2"; shift; shift; continue
+    ;;
+    -h|--help)
+      INFO ""
+      INFO "USAGE:"
+      INFO ""
+      INFO "`eval _echo "$COMMON_INFO"`"
+      INFO ""
+      INFO "`eval _echo "$ARGUMENTS_INFO"`"
+      INFO ""
+      exit 0
+    ;;
+    --with-all)
+      WITH_ALL=true; shift; continue
+    ;;
+    --with-osl)
+      WITH_OSL=true; shift; continue
+    ;;
+    --all-static)
+      ALL_STATIC=true; shift; continue
+    ;;
+    --force-all)
+      PYTHON_FORCE_REBUILD=true
+      BOOST_FORCE_REBUILD=true
+      OCIO_FORCE_REBUILD=true
+      OIIO_FORCE_REBUILD=true
+      LLVM_FORCE_REBUILD=true
+      OSL_FORCE_REBUILD=true
+      FFMPEG_FORCE_REBUILD=true
+      shift; continue
+    ;;
+    --force-python)
+      PYTHON_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-boost)
+      BOOST_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-ocio)
+      OCIO_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-oiio)
+      OIIO_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-llvm)
+      LLVM_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-osl)
+      OSL_FORCE_REBUILD=true; shift; continue
+    ;;
+    --force-ffmpeg)
+      FFMPEG_FORCE_REBUILD=true; shift; continue
+    ;;
+    --skip-python)
+      PYTHON_SKIP=true; shift; continue
+    ;;
+    --skip-boost)
+      BOOST_SKIP=true; shift; continue
+    ;;
+    --skip-ocio)
+      OCIO_SKIP=true; shift; continue
+    ;;
+    --skip-oiio)
+      OIIO_SKIP=true; shift; continue
+    ;;
+    --skip-llvm)
+      LLVM_SKIP=true; shift; continue
+    ;;
+    --skip-osl)
+      OSL_SKIP=true; shift; continue
+    ;;
+    --skip-ffmpeg)
+      FFMPEG_SKIP=true; shift; continue
+    ;;
+    --)
+      # no more arguments to parse
+      break
+    ;;
+    *)
+      INFO ""
+      INFO "Wrong parameter! Usage:"
+      INFO ""
+      INFO "`eval _echo "$COMMON_INFO"`"
+      INFO ""
+      exit 1
+    ;;
+  esac
+done
+
+if $WITH_ALL; then
+  WITH_OSL=true
+fi
+
+# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
+# $1 and $2 should be version numbers made of numbers only.
+version_eq() {
+  backIFS=$IFS
+  IFS='.'
+
+  # Split both version numbers into their numeric elements.
+  arr1=( $1 )
+  arr2=( $2 )
+
+  ret=1
+
+  count1=${#arr1[@]}
+  count2=${#arr2[@]}
+  if [ $count2 -ge $count1 ]; then
+    _t=$count1
+    count1=$count2
+    count2=$_t
+    arr1=( $2 )
+    arr2=( $1 )
+  fi
+
+  ret=0
+  for (( i=0; $i < $count2; i++ ))
+  do
+    if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
+      ret=1
+      break
+    fi
+  done
+
+  for (( i=$count2; $i < $count1; i++ ))
+  do
+    if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
+      ret=1
+      break
+    fi
+  done
+
+  IFS=$backIFS
+  return $ret
+}
+
+# Return 0 if $1 >= $2, else 1.
+# $1 and $2 should be version numbers made of numbers only.
+version_ge() {
+  version_eq $1 $2
+  if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
+    return 1
+  else
+    return 0
+  fi
+}
+
+# Return 0 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5), else 1.
+# $1 and $2 should be version numbers made of numbers only.
+# $1 should be at least as long as $2!
+version_match() {
+  backIFS=$IFS
+  IFS='.'
+
+  # Split both version numbers into their numeric elements.
+  arr1=( $1 )
+  arr2=( $2 )
+
+  ret=1
+
+  count1=${#arr1[@]}
+  count2=${#arr2[@]}
+  if [ $count1 -ge $count2 ]; then
+    ret=0
+    for (( i=0; $i < $count2; i++ ))
+    do
+      if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
+        ret=1
+        break
+      fi
+    done
+  fi
+
+  IFS=$backIFS
+  return $ret
+}
+
+detect_distro() {
+  if [ -f /etc/debian_version ]; then
+    DISTRO="DEB"
+  elif [ -f /etc/redhat-release ]; then
+    DISTRO="RPM"
+  elif [ -f /etc/SuSE-release ]; then
+    DISTRO="SUSE"
+  fi
+}
+
+prepare_opt() {
+  INFO "Ensuring $INST exists and is writable by us"
+  if [ ! -d  $INST ]; then
+    sudo mkdir -p $INST
+  fi
+
+  if [ ! -w $INST ]; then
+    sudo chown $USER $INST
+    sudo chmod 775 $INST
+  fi
+}
+
+# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
+magic_compile_check() {
+  if [ -f $INST/.$1-magiccheck-$2 ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+magic_compile_set() {
+  rm -f $INST/.$1-magiccheck-*
+  touch $INST/.$1-magiccheck-$2
+}
+
+compile_Python() {
+  # To be changed each time we make edits that would modify the compiled result!
+  py_magic=0
+
+  _src=$SRC/Python-$PYTHON_VERSION
+  _inst=$INST/python-$PYTHON_VERSION
+
+  # Clean install if needed!
+  magic_compile_check python-$PYTHON_VERSION $py_magic
+  if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building Python-$PYTHON_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      wget -c $PYTHON_SOURCE -O $_src.tar.bz2
+
+      INFO "Unpacking Python-$PYTHON_VERSION"
+      tar -C $SRC -xf $_src.tar.bz2
+    fi
+
+    cd $_src
+
+    ./configure --prefix=$_inst --enable-ipv6 \
+        --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
+        --with-computed-gotos --with-pymalloc
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/python-3.3
+      ln -s python-$PYTHON_VERSION $INST/python-3.3
+    else
+      ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set python-$PYTHON_VERSION $py_magic
+
+    cd $CWD
+    INFO "Done compiling Python-$PYTHON_VERSION!"
+  else
+    INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-python option."
+  fi
+}
+
+compile_Boost() {
+  # To be changed each time we make edits that would modify the compiled result!
+  boost_magic=7
+
+  _src=$SRC/boost-$BOOST_VERSION
+  _inst=$INST/boost-$BOOST_VERSION
+
+  # Clean install if needed!
+  magic_compile_check boost-$BOOST_VERSION $boost_magic
+  if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building Boost-$BOOST_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      INFO "Downloading Boost-$BOOST_VERSION"
+      mkdir -p $SRC
+      wget -c $BOOST_SOURCE -O $_src.tar.bz2
+      tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
+    fi
+
+    cd $_src
+    if [ ! -f $_src/b2 ]; then
+      ./bootstrap.sh
+    fi
+    ./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
+         --prefix=$_inst --disable-icu boost.locale.icu=off install
+    ./b2 --clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/boost
+      ln -s boost-$BOOST_VERSION $INST/boost
+    else
+      ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set boost-$BOOST_VERSION $boost_magic
+
+    # Rebuild dependecies as well!
+    OIIO_FORCE_REBUILD=true
+    OSL_FORCE_REBUILD=true
+
+    cd $CWD
+    INFO "Done compiling Boost-$BOOST_VERSION!"
+  else
+    INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-boost option."
+  fi
+}
+
+compile_OCIO() {
+  # To be changed each time we make edits that would modify the compiled result!
+  ocio_magic=1
+
+  _src=$SRC/OpenColorIO-$OCIO_VERSION
+  _inst=$INST/ocio-$OCIO_VERSION
+
+  # Clean install if needed!
+  magic_compile_check ocio-$OCIO_VERSION $ocio_magic
+  if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenColorIO-$OCIO_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      INFO "Downloading OpenColorIO-$OCIO_VERSION"
+      mkdir -p $SRC
+      wget -c $OCIO_SOURCE -O $_src.tar.gz
+
+      INFO "Unpacking OpenColorIO-$OCIO_VERSION"
+      tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
+          -xf $_src.tar.gz
+    fi
+
+    cd $_src
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi    
+    mkdir build
+    cd build
+
+    if file /bin/cp | grep -q '32-bit'; then
+      cflags="-fPIC -m32 -march=i686"
+    else
+      cflags="-fPIC"
+    fi
+
+    cmake -D CMAKE_BUILD_TYPE=Release \
+          -D CMAKE_PREFIX_PATH=$_inst \
+          -D CMAKE_INSTALL_PREFIX=$_inst \
+          -D CMAKE_CXX_FLAGS="$cflags" \
+          -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
+          -D OCIO_BUILD_APPS=OFF \
+          -D OCIO_BUILD_PYGLUE=OFF \
+          ..
+
+    make -j$THREADS && make install
+
+    # Force linking against static libs
+    rm -f $_inst/lib/*.so*
+
+    # Additional depencencies
+    cp ext/dist/lib/libtinyxml.a $_inst/lib
+    cp ext/dist/lib/libyaml-cpp.a $_inst/lib
+
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/ocio
+      ln -s ocio-$OCIO_VERSION $INST/ocio
+    else
+      ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set ocio-$OCIO_VERSION $ocio_magic
+
+    cd $CWD
+    INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
+  else
+    INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-ocio option."
+  fi
+}
+
+compile_OIIO() {
+  # To be changed each time we make edits that would modify the compiled result!
+  oiio_magic=6
+
+  _src=$SRC/OpenImageIO-$OIIO_VERSION
+  _inst=$INST/oiio-$OIIO_VERSION
+
+  # Clean install if needed!
+  magic_compile_check oiio-$OIIO_VERSION $oiio_magic
+  if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenImageIO-$OIIO_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      wget -c $OIIO_SOURCE -O "$_src.tar.gz"
+
+      INFO "Unpacking OpenImageIO-$OIIO_VERSION"
+      tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
+          -xf $_src.tar.gz
+
+      cd $_src
+
+      # XXX Ugly patching hack!
+      cat << EOF | patch -p1
+diff --git a/src/libutil/SHA1.cpp b/src/libutil/SHA1.cpp
+index b9e6c8b..c761185 100644
+--- a/src/libutil/SHA1.cpp
++++ b/src/libutil/SHA1.cpp
+@@ -8,9 +8,9 @@
+ 
+ // If compiling with MFC, you might want to add #include "StdAfx.h"
+ 
++#include "SHA1.h"
+ #include "hash.h"
+ #include "dassert.h"
+-#include "SHA1.h"
+ 
+ #ifdef SHA1_UTILITY_FUNCTIONS
+ #define SHA1_MAX_FILE_BUFFER 8000
+EOF
+
+      cd $CWD
+
+    fi
+
+    cd $_src
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi    
+    mkdir build
+    cd build
+
+    cmake_d="-D CMAKE_BUILD_TYPE=Release"
+    cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
+    cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+    cmake_d="$cmake_d -D BUILDSTATIC=ON"
+
+    # linking statically could give issues on Debian/Ubuntu (and probably other distros
+    # which doesn't like static linking) when linking shared oiio library due to missing
+    # text symbols (static libs should be compiled with -fPIC)
+    # cmake_d="$cmake_d -D LINKSTATIC=ON"
+
+    if [ -d $INST/boost ]; then
+      cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
+      if $ALL_STATIC; then
+        cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
+      fi
+    fi
+
+    # Looks like we do not need ocio in oiio for now...
+#    if [ -d $INST/ocio ]; then
+#      cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
+#    fi
+
+    if file /bin/cp | grep -q '32-bit'; then
+      cflags="-fPIC -m32 -march=i686"
+    else
+      cflags="-fPIC"
+    fi
+
+    cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../src
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/oiio
+      ln -s oiio-$OIIO_VERSION $INST/oiio
+    else
+      ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set oiio-$OIIO_VERSION $oiio_magic
+
+    # Rebuild dependecies as well!
+    OSL_FORCE_REBUILD=true
+
+    cd $CWD
+    INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
+  else
+    INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-oiio option."
+  fi
+}
+
+compile_LLVM() {
+  # To be changed each time we make edits that would modify the compiled result!
+  llvm_magic=1
+
+  _src=$SRC/LLVM-$LLVM_VERSION
+  _inst=$INST/llvm-$LLVM_VERSION
+  _src_clang=$SRC/CLANG-$LLVM_VERSION
+
+  # Clean install if needed!
+  magic_compile_check llvm-$LLVM_VERSION $llvm_magic
+  if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+    rm -rf $_inst_clang
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
+
+    prepare_opt
+
+    if [ ! -d $_src -o true ]; then
+      mkdir -p $SRC
+      wget -c $LLVM_SOURCE -O "$_src.tar.gz"
+      wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
+
+      INFO "Unpacking LLVM-$LLVM_VERSION"
+      tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
+          -xf $_src.tar.gz
+      INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
+      tar -C $_src/tools \
+          --transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
+          -xf $_src_clang.tar.gz
+
+      cd $_src
+
+      # XXX Ugly patching hack!
+      cat << EOF | patch -p1
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,7 +13,7 @@
+ set(LLVM_VERSION_MAJOR 3)
+ set(LLVM_VERSION_MINOR 1)
+ 
+-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
++set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
+ 
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ 
+EOF
+
+      cd $CWD
+
+    fi
+
+    cd $_src
+
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi    
+    mkdir build
+    cd build
+
+    cmake_d="-D CMAKE_BUILD_TYPE=Release"
+    cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+    cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
+
+    if [ -d $_FFI_INCLUDE_DIR ]; then
+      cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
+    fi
+
+    cmake $cmake_d ..
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/llvm
+      ln -s llvm-$LLVM_VERSION $INST/llvm
+    else
+      ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set llvm-$LLVM_VERSION $llvm_magic
+
+    # Rebuild dependecies as well!
+    OSL_FORCE_REBUILD=true
+
+    cd $CWD
+    INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
+  else
+    INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-llvm option."
+  fi
+}
+
+compile_OSL() {
+  # To be changed each time we make edits that would modify the compiled result!
+  osl_magic=7
+
+  _src=$SRC/OpenShadingLanguage-$OSL_VERSION
+  _inst=$INST/osl-$OSL_VERSION
+
+  # Clean install if needed!
+  magic_compile_check osl-$OSL_VERSION $osl_magic
+  if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenShadingLanguage-$OSL_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+
+      # XXX Using git on my own repo for now, looks like archives are not updated immediately... :/
+#      wget -c $OSL_SOURCE -O "$_src.tar.gz"
+
+#      INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
+#      tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
+#          -xf $_src.tar.gz
+      git clone https://github.com/mont29/OpenShadingLanguage.git $_src
+      cd $_src
+      git checkout blender-fixes
+      cd $CWD
+    fi
+
+    cd $_src
+    # XXX For now, always update from latest repo...
+    git pull origin
+
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi    
+    mkdir build
+    cd build
+
+    cmake_d="-D CMAKE_BUILD_TYPE=Release"
+    cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+    cmake_d="$cmake_d -D BUILDSTATIC=ON"
+    cmake_d="$cmake_d -D BUILD_TESTING=OFF"
+
+    if [ -d $INST/boost ]; then
+      cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
+      if $ALL_STATIC; then
+        cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"        
+      fi
+    fi
+
+    if [ -d $INST/oiio ]; then
+      cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
+    fi
+
+    if [ ! -z $LLVM_VERSION_FOUND ]; then
+      cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
+      if [ -d $INST/llvm ]; then
+        cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
+        cmake_d="$cmake_d -D LLVM_STATIC=ON"
+      fi
+    fi
+
+    cmake $cmake_d ../src
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/osl
+      ln -s osl-$OSL_VERSION $INST/osl
+    else
+      ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set osl-$OSL_VERSION $osl_magic
+
+    cd $CWD
+    INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
+  else
+    INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-osl option."
+  fi
+}
+
+compile_FFmpeg() {
+  # To be changed each time we make edits that would modify the compiled result!
+  ffmpeg_magic=3
+
+  _src=$SRC/ffmpeg-$FFMPEG_VERSION
+  _inst=$INST/ffmpeg-$FFMPEG_VERSION
+
+  # Clean install if needed!
+  magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
+  if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building ffmpeg-$FFMPEG_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      INFO "Downloading ffmpeg-$FFMPEG_VERSION"
+      mkdir -p $SRC
+      wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
+
+      INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
+      tar -C $SRC -xf $_src.tar.bz2
+    fi
+
+    cd $_src
+
+    extra=""
+
+    if $VORBIS_USE; then
+      extra="$extra --enable-libvorbis"
+    fi
+
+    if $THEORA_USE; then
+      extra="$extra --enable-libtheora"
+    fi
+
+    # XXX At least under Debian, static schro gives problem at blender linking time... :/
+    if $SCHRO_USE && ! $ALL_STATIC; then
+      extra="$extra --enable-libschroedinger"
+    fi
+
+    if $XVID_USE; then
+      extra="$extra --enable-libxvid"
+    fi
+
+    if $X264_USE; then
+      extra="$extra --enable-libx264"
+    fi
+
+    if $VPX_USE; then
+      extra="$extra --enable-libvpx"
+    fi
+
+    if $MP3LAME_USE; then
+      extra="$extra --enable-libmp3lame"
+    fi
+
+    if $OPENJPEG_USE; then
+      extra="$extra --enable-libopenjpeg"
+    fi
+
+    ./configure --cc="gcc -Wl,--as-needed" \
+        --extra-ldflags="-pthread -static-libgcc" \
+        --prefix=$_inst --enable-static \
+        --disable-ffplay --disable-ffserver --disable-doc \
+        --enable-gray \
+        --enable-avfilter --disable-vdpau \
+        --disable-bzlib --disable-libgsm --disable-libspeex \
+        --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
+        --disable-vaapi  --disable-libfaac --disable-nonfree --enable-gpl \
+        --disable-postproc --disable-x11grab  --disable-librtmp  --disable-libopencore-amrnb \
+        --disable-libopencore-amrwb --disable-libdc1394 --disable-version3  --disable-outdev=sdl \
+        --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
+        --disable-indev=lavfi $extra
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/ffmpeg
+      ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
+    else
+      ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
+
+    cd $CWD
+    INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
+  else
+    INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
+  fi
+}
+
+get_package_version_DEB() {
+    dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
+}
+
+check_package_DEB() {
+  r=`apt-cache policy $1 | grep -c 'Candidate:'`
+
+  if [ $r -ge 1 ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+check_package_version_match_DEB() {
+  v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_match $v $2
+  return $?
+}
+
+check_package_version_ge_DEB() {
+  v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge $v $2
+  return $?
+}
+
+install_packages_DEB() {
+  sudo apt-get install -y $@
+  if [ $? -ge 1 ]; then
+    ERROR "apt-get failed to install requested packages, exiting."
+    exit 1
+  fi
+}
+
+install_DEB() {
+  INFO ""
+  INFO "Installing dependencies for DEB-based distribution"
+  INFO ""
+  INFO "`eval _echo "$COMMON_INFO"`"
+  INFO ""
+
+  if [ ! -z "`cat /etc/debian_version | grep ^6`"  ]; then
+    if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`"  ]; then
+      INFO "Looks like you're using Debian Squeeze which does have broken CMake"
+      INFO "It is highly recommended to install cmake from backports, otherwise"
+      INFO "compilation of some libraries could fail"
+      INFO ""
+      INFO "You could install newer CMake from debian-backports repository"
+      INFO "Add this this line to your /etc/apt/sources.lixt:"
+      INFO ""
+      INFO "deb http://backports.debian.org/debian-backports squeeze-backports main"
+      INFO ""
+      INFO "and then run:"
+      INFO ""
+      INFO "sudo apt-get update && sudo apt-get install cmake=2.8.7-4~bpo60+1 sudo apt-get install cmake=2.8.7-4~bpo60+1"
+      INFO ""
+      INFO "(you could also add this reporisotry using GUI like synaptic)"
+      INFO ""
+      INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
+
+      read
+      INFO ""
+    fi
+  fi
+
+  sudo apt-get update
+# XXX Why in hell? Let's let this stuff to the user's responsability!!!
+#  sudo apt-get -y upgrade
+
+  # These libs should always be available in debian/ubuntu official repository...
+  OPENJPEG_DEV="libopenjpeg-dev"
+  SCHRO_DEV="libschroedinger-dev"
+  VORBIS_DEV="libvorbis-dev"
+  THEORA_DEV="libtheora-dev"
+
+  _packages="gawk cmake scons build-essential libjpeg-dev libpng-dev libtiff-dev \
+             libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
+             libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
+             libopenexr-dev libopenal-dev libglew-dev yasm $THEORA_DEV \
+             $VORBIS_DEV libsdl1.2-dev libfftw3-dev python-dev patch bzip2"
+  OPENJPEG_USE=true
+  VORBIS_USE=true
+  THEORA_USE=true
+
+  if $WITH_ALL; then
+    _packages="$_packages $SCHRO_DEV libjack0 libjack-dev"
+    SCHRO_USE=true
+  fi
+
+  INFO ""
+  install_packages_DEB $_packages
+
+  INFO ""
+  X264_DEV="libx264-dev"
+  check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
+  if [ $? -eq 0 ]; then
+    install_packages_DEB $X264_DEV
+    X264_USE=true
+  fi
+
+  if $WITH_ALL; then
+    INFO ""
+    # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
+    XVID_DEV="libxvidcore-dev"
+    check_package_DEB $XVID_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_DEB $XVID_DEV
+      XVID_USE=true
+    else
+      XVID_DEV="libxvidcore4-dev"
+      check_package_DEB $XVID_DEV
+      if [ $? -eq 0 ]; then
+        install_packages_DEB $XVID_DEV
+        XVID_USE=true
+      fi
+    fi
+
+    INFO ""
+    MP3LAME_DEV="libmp3lame-dev"
+    check_package_DEB $MP3LAME_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_DEB $MP3LAME_DEV
+      MP3LAME_USE=true
+    fi
+
+    INFO ""
+    VPX_DEV="libvpx-dev"
+    check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_DEB $VPX_DEV
+      VPX_USE=true
+    fi
+
+    INFO ""
+    check_package_DEB libspnav-dev
+    if [ $? -eq 0 ]; then
+      install_packages_DEB libspnav-dev
+    fi
+  fi
+
+  INFO ""
+  if $PYTHON_SKIP; then
+    INFO "WARNING! Skipping Python installation, as requested..."
+  else
+    check_package_DEB python3.3-dev
+    if [ $? -eq 0 ]; then
+      install_packages_DEB python3.3-dev
+    else
+      compile_Python
+    fi
+  fi
+
+  INFO ""
+  if $BOOST_SKIP; then
+    INFO "WARNING! Skipping Boost installation, as requested..."
+  else
+    check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_DEB libboost-dev
+
+      boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
+
+      check_package_DEB libboost-locale$boost_version-dev
+      if [ $? -eq 0 ]; then
+        install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
+                             libboost-regex$boost_version-dev libboost-system$boost_version-dev \
+                             libboost-thread$boost_version-dev
+      else
+        compile_Boost
+      fi
+    else
+      compile_Boost
+    fi
+  fi
+
+  INFO ""
+  if $OCIO_SKIP; then
+    INFO "WARNING! Skipping OpenColorIO installation, as requested..."
+  else
+    check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_DEB libopencolorio-dev
+    else
+      compile_OCIO
+    fi
+  fi
+
+  INFO ""
+  if $OIIO_SKIP; then
+    INFO "WARNING! Skipping OpenImageIO installation, as requested..."
+  else
+    check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_DEB libopenimageio-dev
+    else
+      compile_OIIO
+    fi
+  fi
+
+  if $WITH_OSL; then
+    have_llvm=false
+
+    if $LLVM_SKIP; then
+      INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    else
+      INFO ""
+      check_package_DEB llvm-$LLVM_VERSION-dev
+      if [ $? -eq 0 ]; then
+        install_packages_DEB llvm-$LLVM_VERSION-dev
+        have_llvm=true
+        LLVM_VERSION_FOUND=$LLVM_VERSION
+      else
+        check_package_DEB llvm-$LLVM_VERSION_MIN-dev
+        if [ $? -eq 0 ]; then
+          install_packages_DEB llvm-$LLVM_VERSION_MIN-dev
+          have_llvm=true
+          LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
+        else
+          install_packages_DEB libffi-dev
+          INFO ""
+          compile_LLVM
+          have_llvm=true
+          LLVM_VERSION_FOUND=$LLVM_VERSION
+        fi
+      fi
+    fi
+
+    if $OSL_SKIP; then
+      INFO ""
+      INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
+    else
+      if $have_llvm; then
+        INFO ""
+        install_packages_DEB clang flex bison libtbb-dev git
+        # No package currently!
+        INFO ""
+        compile_OSL
+      fi
+    fi
+  fi
+
+
+  INFO ""
+  if $FFMPEG_SKIP; then
+    INFO "WARNING! Skipping FFMpeg installation, as requested..."
+  else
+#    XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
+#        So for now, always build our own ffmpeg.
+#    check_package_DEB ffmpeg
+#    if [ $? -eq 0 ]; then
+#      install_packages_DEB ffmpeg
+#      ffmpeg_version=`get_package_version_DEB ffmpeg`
+#      INFO "ffmpeg version: $ffmpeg_version"
+#      if [ ! -z "$ffmpeg_version" ]; then
+#        if  dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
+#          install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
+#        else
+#          compile_FFmpeg
+#        fi
+#      fi
+#    fi
+    compile_FFmpeg
+  fi
+}
+
+get_package_version_RPM() {
+  yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
+}
+
+check_package_RPM() {
+  r=`yum info $1 | grep -c 'Summary'`
+
+  if [ $r -ge 1 ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+check_package_version_match_RPM() {
+  v=`get_package_version_RPM $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_match $v $2
+  return $?
+}
+
+check_package_version_ge_RPM() {
+  v=`get_package_version_RPM $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge $v $2
+  return $?
+}
+
+install_packages_RPM() {
+  sudo yum install -y $@
+  if [ $? -ge 1 ]; then
+    ERROR "yum failed to install requested packages, exiting."
+    exit 1
+  fi
+}
+
+install_RPM() {
+  INFO ""
+  INFO "Installing dependencies for RPM-based distribution"
+  INFO ""
+  INFO "`eval _echo "$COMMON_INFO"`"
+  INFO ""
+
+  sudo yum -y update
+
+  # These libs should always be available in debian/ubuntu official repository...
+  OPENJPEG_DEV="openjpeg-devel"
+  SCHRO_DEV="schroedinger-devel"
+  VORBIS_DEV="libvorbis-devel"
+  THEORA_DEV="libtheora-devel"
+
+  _packages="gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel freetype-devel \
+             libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \
+             readline-devel $OPENJPEG_DEV openexr-devel openal-soft-devel \
+             glew-devel yasm $THEORA_DEV $VORBIS_DEV SDL-devel fftw-devel \
+             lame-libs libjpeg-devel patch python-devel"
+  OPENJPEG_USE=true
+  VORBIS_USE=true
+  THEORA_USE=true
+
+  if $WITH_ALL; then
+    _packages="$_packages $SCHRO_DEV jack-audio-connection-kit-devel libspnav-devel"
+    SCHRO_USE=true
+  fi
+
+  INFO ""
+  install_packages_RPM $_packages
+
+  INFO ""
+  X264_DEV="x264-devel"
+  check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
+  if [ $? -eq 0 ]; then
+    install_packages_RPM $X264_DEV
+    X264_USE=true
+  fi
+
+  if $WITH_ALL; then
+    INFO ""
+    XVID_DEV="xvidcore-devel"
+    check_package_RPM $XVID_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_RPM $XVID_DEV
+      XVID_USE=true
+    fi
+
+    INFO ""
+    VPX_DEV="libvpx-devel"
+    check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_RPM $VPX_DEV
+      VPX_USE=true
+    fi
+
+    INFO ""
+    MP3LAME_DEV="lame-devel"
+    check_package_RPM $MP3LAME_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_RPM $MP3LAME_DEV
+      MP3LAME_USE=true
+    fi
+  fi
+
+  INFO ""
+  if $PYTHON_SKIP; then
+    INFO "WARNING! Skipping Python installation, as requested..."
+  else
+    check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_RPM python3-devel
+    else
+      compile_Python
+    fi
+  fi
+
+  INFO ""
+  if $BOOST_SKIP; then
+    INFO "WARNING! Skipping Boost installation, as requested..."
+  else
+    check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_RPM boost-devel
+    else
+      compile_Boost
+    fi
+  fi
+
+  INFO ""
+  if $OCIO_SKIP; then
+    INFO "WARNING! Skipping OpenColorIO installation, as requested..."
+  else
+    check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_RPM OpenColorIO-devel
+    else
+      compile_OCIO
+    fi
+  fi
+
+  INFO ""
+  if $OIIO_SKIP; then
+    INFO "WARNING! Skipping OpenImageIO installation, as requested..."
+  else
+    check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_RPM OpenImageIO-devel
+    else
+      compile_OIIO
+    fi
+  fi
+
+  if $WITH_OSL; then
+    have_llvm=false
+
+    INFO ""
+    if $LLVM_SKIP; then
+      INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    else
+      check_package_RPM llvm-$LLVM_VERSION-devel
+      if [ $? -eq 0 ]; then
+        install_packages_RPM llvm-$LLVM_VERSION-devel
+        have_llvm=true
+        LLVM_VERSION_FOUND=$LLVM_VERSION
+      else
+#        check_package_RPM llvm-$LLVM_VERSION_MIN-devel
+#        if [ $? -eq 0 ]; then
+#          install_packages_RPM llvm-$LLVM_VERSION_MIN-devel
+#          have_llvm=true
+#          LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
+#        else
+#          check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN
+#          if [ $? -eq 0 ]; then
+#            install_packages_RPM llvm-devel
+#            have_llvm=true
+#            LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel`
+#          fi
+#        fi
+      install_packages_RPM libffi-devel
+      # XXX Stupid fedora puts ffi header into a darn stupid dir!
+      _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
+      INFO ""
+      compile_LLVM
+      have_llvm=true
+      LLVM_VERSION_FOUND=$LLVM_VERSION
+      fi
+    fi
+
+    if $OSL_SKIP; then
+      INFO ""
+      INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
+    else
+      if $have_llvm; then
+        INFO ""
+        install_packages_RPM flex bison clang tbb-devel git
+        # No package currently!
+        INFO ""
+        compile_OSL
+      fi
+    fi
+  fi
+
+  INFO ""
+  if $FFMPEG_SKIP; then
+    INFO "WARNING! Skipping FFMpeg installation, as requested..."
+  else
+    # Always for now, not sure which packages should be installed
+    compile_FFmpeg
+  fi
+}
+
+get_package_version_SUSE() {
+  zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
+}
+
+check_package_SUSE() {
+  r=`zypper info $1 | grep -c 'Summary'`
+
+  if [ $r -ge 1 ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+check_package_version_match_SUSE() {
+  v=`get_package_version_SUSE $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_match $v $2
+  return $?
+}
+
+check_package_version_ge_SUSE() {
+  v=`get_package_version_SUSE $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge $v $2
+  return $?
+}
+
+install_packages_SUSE() {
+  sudo zypper --non-interactive install --auto-agree-with-licenses $@
+  if [ $? -ge 1 ]; then
+    ERROR "zypper failed to install requested packages, exiting."
+    exit 1
+  fi
+}
+
+
+install_SUSE() {
+  INFO ""
+  INFO "Installing dependencies for SuSE-based distribution"
+  INFO ""
+  INFO "`eval _echo "$COMMON_INFO"`"
+  INFO ""
+
+  sudo zypper --non-interactive update --auto-agree-with-licenses
+
+  # These libs should always be available in debian/ubuntu official repository...
+  OPENJPEG_DEV="openjpeg-devel"
+  SCHRO_DEV="schroedinger-devel"
+  VORBIS_DEV="libvorbis-devel"
+  THEORA_DEV="libtheora-devel"
+
+  _packages="gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel freetype-devel \
+             libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \
+             readline-devel $OPENJPEG_DEV libopenexr-devel openal-soft-devel \
+             glew-devel yasm $THEORA_DEV $VORBIS_DEV libSDL-devel fftw3-devel \
+             libjpeg62-devel patch python-devel"
+  OPENJPEG_USE=true
+  VORBIS_USE=true
+  THEORA_USE=true
+
+  if $WITH_ALL; then
+    _packages="$_packages $SCHRO_DEV libjack-devel libspnav-devel"
+    SCHRO_USE=true
+  fi
+
+  INFO ""
+  install_packages_SUSE $_packages
+
+  OPENJPEG_USE=true
+  SCHRO_USE=true
+  VORBIS_USE=true
+  THEORA_USE=true
+
+  INFO ""
+  X264_DEV="x264-devel"
+  check_package_version_ge_SUSE $X264_DEV $X264_VERSION_MIN
+  if [ $? -eq 0 ]; then
+    install_packages_SUSE $X264_DEV
+    X264_USE=true
+  fi
+
+  if $WITH_ALL; then
+    INFO ""
+    XVID_DEV="xvidcore-devel"
+    check_package_SUSE $XVID_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_SUSE $XVID_DEV
+      XVID_USE=true
+    fi
+
+    INFO ""
+    VPX_DEV="libvpx-devel"
+    check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_SUSE $VPX_DEV
+      VPX_USE=true
+    fi
+
+    INFO ""
+    # No mp3 in suse, it seems.
+    MP3LAME_DEV="lame-devel"
+    check_package_SUSE $MP3LAME_DEV
+    if [ $? -eq 0 ]; then
+      install_packages_SUSE $MP3LAME_DEV
+      MP3LAME_USE=true
+    fi
+  fi
+
+  INFO ""
+  if $PYTHON_SKIP; then
+    INFO "WARNING! Skipping Python installation, as requested..."
+  else
+    check_package_version_match_SUSE python3-devel 3.3.
+    if [ $? -eq 0 ]; then
+      install_packages_SUSE python3-devel
+    else
+      compile_Python
+    fi
+  fi
+
+  INFO ""
+  if $BOOST_SKIP; then
+    INFO "WARNING! Skipping Boost installation, as requested..."
+  else
+    # No boost_locale currently available, so let's build own boost.
+    compile_Boost
+  fi
+
+  INFO ""
+  if $OCIO_SKIP; then
+    INFO "WARNING! Skipping OpenColorIO installation, as requested..."
+  else
+    # No ocio currently available, so let's build own boost.
+    compile_OCIO
+  fi
+
+  INFO ""
+  if $OIIO_SKIP; then
+    INFO "WARNING! Skipping OpenImageIO installation, as requested..."
+  else
+    # No oiio currently available, so let's build own boost.
+    compile_OIIO
+  fi
+
+  if $WITH_OSL; then
+    have_llvm=false
+
+    INFO ""
+    if $LLVM_SKIP; then
+      INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    else
+      # Suse llvm package *_$SUCKS$_* (tm) !!!
+#      check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN
+#      if [ $? -eq 0 ]; then
+#        install_packages_SUSE llvm-devel
+#        have_llvm=true
+#        LLVM_VERSION_FOUND=`get_package_version_SUSE llvm-devel`
+#      fi
+
+      install_packages_SUSE libffi47-devel
+      INFO ""
+      compile_LLVM
+      have_llvm=true
+      LLVM_VERSION_FOUND=$LLVM_VERSION
+    fi
+
+    if $OSL_SKIP; then
+      INFO ""
+      INFO "WARNING! Skipping OpenShaderLanguage installation, as requested..."
+    else
+      if $have_llvm; then
+        INFO ""
+        # XXX No tbb lib!
+        install_packages_SUSE flex bison git
+        # No package currently!
+        INFO ""
+        compile_OSL
+      fi
+    fi
+  fi
+
+  INFO ""
+  if $FFMPEG_SKIP; then
+    INFO "WARNING! Skipping FFMpeg installation, as requested..."
+  else
+    # No ffmpeg currently available, so let's build own boost.
+    compile_FFmpeg
+  fi
+}
+
+print_info_ffmpeglink_DEB() {
+  if $ALL_STATIC; then
+    dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+  else
+    dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+  fi
+}
+
+print_info_ffmpeglink_RPM() {
+  if $ALL_STATIC; then
+    rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+  else
+    rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+  fi
+}
+
+print_info_ffmpeglink_SUSE() {
+  if $ALL_STATIC; then
+    rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+  else
+    rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+  fi
+}
+
+print_info_ffmpeglink() {
+  # This func must only print a ';'-separated list of libs...
+  if [ -z "$DISTRO" ]; then
+    ERROR "Failed to detect distribution type"
+    exit 1
+  fi
+
+  # Create list of packages from which to get libs names...
+  _packages=""
+
+  if $THEORA_USE; then
+    _packages="$_packages $THEORA_DEV"
+  fi
+
+  if $VORBIS_USE; then
+    _packages="$_packages $VORBIS_DEV"
+  fi
+
+  if $XVID_USE; then
+    _packages="$_packages $XVID_DEV"
+  fi
+
+  if $VPX_USE; then
+    _packages="$_packages $VPX_DEV"
+  fi
+
+  if $MP3LAME_USE; then
+    _packages="$_packages $MP3LAME_DEV"
+  fi
+
+  if $X264_USE; then
+    _packages="$_packages $X264_DEV"
+  fi
+
+  if $OPENJPEG_USE; then
+    _packages="$_packages $OPENJPEG_DEV"
+  fi
+
+  # XXX At least under Debian, static schro gives problem at blender linking time... :/
+  if $SCHRO_USE && ! $ALL_STATIC; then
+    _packages="$_packages $SCHRO_DEV"
+  fi
+
+  if [ "$DISTRO" = "DEB" ]; then
+    print_info_ffmpeglink_DEB
+  elif [ "$DISTRO" = "RPM" ]; then
+    print_info_ffmpeglink_RPM
+  elif [ "$DISTRO" = "SUSE" ]; then
+    print_info_ffmpeglink_SUSE
+  # XXX TODO!
+  else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
+  fi
+}
+
+print_info() {
+  INFO ""
+  INFO "If you're using CMake add this to your configuration flags:"
+
+  if $ALL_STATIC; then
+    INFO "  -D WITH_STATIC_LIBS=ON"
+  fi
+
+  if [ -d $INST/boost ]; then
+    INFO "  -D BOOST_ROOT=$INST/boost"
+    INFO "  -D Boost_NO_SYSTEM_PATHS=ON"
+  elif $ALL_STATIC; then
+    INFO "  -D Boost_USE_ICU=ON"
+  fi
+
+  if [ -d $INST/osl -a $WITH_OSL == true ]; then
+    INFO "  -D CYCLES_OSL=$INST/osl"
+    INFO "  -D WITH_CYCLES_OSL=ON"
+    INFO "  -D LLVM_VERSION=$LLVM_VERSION_FOUND"
+    if [ -d $INST/llvm ]; then
+      INFO "  -D LLVM_DIRECTORY=$INST/llvm"
+      INFO "  -D LLVM_STATIC=ON"
+    fi
+  fi
+
+  if [ -d $INST/ffmpeg ]; then
+    INFO "  -D WITH_CODEC_FFMPEG=ON"
+    INFO "  -D FFMPEG=$INST/ffmpeg"
+    INFO "  -D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
+  fi
+
+  INFO ""
+  INFO "If you're using SCons add this to your user-config:"
+
+  if [ -d $INST/python-3.3 ]; then
+    INFO "BF_PYTHON = '$INST/python-3.3'"
+    INFO "BF_PYTHON_ABI_FLAGS = 'm'"
+  fi
+
+  if [ -d $INST/ocio ]; then
+    INFO "BF_OCIO = '$INST/ocio'"
+  fi
+
+  if [ -d $INST/oiio ]; then
+    INFO "BF_OIIO = '$INST/oiio'"
+  fi
+
+  if [ -d $INST/boost ]; then
+    INFO "BF_BOOST = '$INST/boost'"
+  fi
+
+  if [ -d $INST/ffmpeg ]; then
+    INFO "BF_FFMPEG = '$INST/ffmpeg'"
+    _ffmpeg_list_sep=" "
+    INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
+  fi
+
+  INFO ""
+  INFO ""
+  INFO "WARNING: If this script had to build boost into $INST, and you are dynamically linking "
+  INFO "         blender against it, you will have to run those commands as root user:"
+  INFO ""
+  INFO "    echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
+  INFO "    ldconfig"
+  INFO ""
+}
+
+# Detect distributive type used on this machine
+detect_distro
+
+if [ -z "$DISTRO" ]; then
+  ERROR "Failed to detect distribution type"
+  exit 1
+elif [ "$DISTRO" = "DEB" ]; then
+  install_DEB
+elif [ "$DISTRO" = "RPM" ]; then
+  install_RPM
+elif [ "$DISTRO" = "SUSE" ]; then
+  install_SUSE
+fi
+
+print_info
+
+# Switch back to user language.
+LANG=LANG_BACK
+export LANG
diff --git a/build_files/build_environment/prepare_release_env.sh b/build_files/build_environment/prepare_release_env.sh
new file mode 100755
index 0000000..9889fea
--- /dev/null
+++ b/build_files/build_environment/prepare_release_env.sh
@@ -0,0 +1,1555 @@
+#!/bin/sh
+
+#
+# This script will prepare build environment with the same settings as release environment
+#
+# It will install two chroot environments:
+#   - /home/buildbot_squeeze_i686
+#   - /home/buildbot_squeeze_x86_64
+# which are used for 32bit and 64bit
+#
+# This sctipt will also create folder /home/sources where all dependent libraries sources are
+# downloading and compiling.
+#
+# Release builder scripts are stored in /home/sources/release-builder
+# See build_all.sh script for usage details
+#
+# This script was tested on debian squeeze and wheezy, should work on ubuntu as well
+# It wouldn't work on other distros
+#
+# TODO:
+# - It's still required manual copying of build configuration files to /home/sources/release-builder/config
+# - OSL is not set up yet
+#
+
+set -e
+
+NO_COLOR='\033[0m'
+EWHITE='\033[1;37m'
+ERED='\033[1;31m'
+
+CONFIRM="--i-really-do-know-what-im-doing"
+
+ERROR() {
+  echo ${ERED}${@}${NO_COLOR}
+}
+
+INFO() {
+  echo ${EWHITE}${@}${NO_COLOR}
+}
+
+if [ $# != 1 ]; then
+  ERROR "Usage: $0 $CONFIRM"
+  exit 1
+fi
+
+if [ "$1" != "$CONFIRM" ]; then
+  ERROR "Usage: $0 $CONFIRM"
+  exit 1
+fi
+
+DEBIAN_BRANCH="squeeze"
+DEBIAN_MIRROR="http://ftp.de.debian.org/debian"
+USER_ID=1000
+
+# For now it's always /home, so we can setup schroot to map /sources to the same
+# path at both host and chroot systems (which is currently needed for release building script)
+ENV_PATH="/home"
+
+AMD64_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_x86_64"
+I686_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_i686"
+SOURCES_PATH="$ENV_PATH/sources"
+
+THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
+
+# Force vpx be installed from the backports
+VPX_V="1.0.0-2~bpo60+1"
+
+BINUTILS_V="2.22"
+BINUTILS_FV="2.22-7.1"
+
+GCC_V="4.7_4.7.1"
+GCC_FV="4.7_4.7.1-7"
+
+OPENAL_V="1.14"
+
+DPKG_V="1.16.8"
+
+DEBHELPER_V="9"
+DEBHELPER_FV="9.20120909"
+
+JEMALLOC_V="3.1.0"
+SPNAV_V="0.2.2"
+FFMPEG_V="1.0"
+BOOST_V="1_51_0"
+PYTHON_V="3.3.0"
+PYTHIN_V_SHORT="3.3"
+OIIO_V="1.0.9"
+OCIO_V="1.0.7"
+MESA_V="8.0.5"
+
+OPENSSL_V="0.9.8o"
+OPENSSL_FV="0.9.8o-4squeeze13"
+
+CUDA_V="4.2.9"
+CUDA_DISTR="ubuntu10.04"
+CUDA_32="cudatoolkit_${CUDA_V}_linux_32_${CUDA_DISTR}.run"
+CUDA_64="cudatoolkit_${CUDA_V}_linux_64_${CUDA_DISTR}.run"
+
+INSTALL_RELEASE_BUILDER() {
+  SOURCES_PATH=$1
+
+  RB=$SOURCES_PATH/release-builder
+  if [ ! -d $RB ]; then
+    INFO "Installing release building scripts"
+
+    mkdir -p $RB
+
+    cat << EOF > $RB/Readme.txt
+This directory contains scrips needed for automated release archive preparation
+
+config/: storage of scons configs for different platforms
+
+build_all.sh: script asks version to add to archive name and revision to compile,
+              when script finished, there'll be 32 and 64 bit archives in current directory
+              better to run this script from this directory
+
+do_build_all.sh: uses environment variables set by build_all.sh script (or other scripts)
+                 and launches compilation inside chroot environments
+
+chroot_compile.py: runs compilation process with giver parameters in chroots
+compile.py: script runs inside chroot environment and prepares archive
+
+blender-buildenv.tar.bz2: archive, received from Ken Hughes when i've been preparing
+                          new environment to make it as close to old one as it's possible
+
+Hope all this would help you.
+
+-Sergey-
+EOF
+  
+    cat << EOF > $RB/build_all.sh
+#!/bin/sh
+
+echo -n "version: "
+read version
+echo -n "svn revision (blank to latest, 0 to keep unchanged): "
+read revision
+
+export version
+export revision
+
+d=\`dirname \${0}\`
+\${d}/do_build_all.sh
+EOF
+    chmod +x $RB/build_all.sh
+
+    cat << EOF > $RB/build_all-test.sh
+#!/bin/sh
+
+d=\`dirname \${0}\`
+\${d}/do_build_all.sh
+EOF
+    chmod +x $RB/build_all-test.sh
+
+    cat << EOF > $RB/chroot-compile.py
+#!/usr/bin/env python
+
+import sys
+import os
+import platform
+
+from optparse import OptionParser
+
+# This could be passed through options, but does we actually need this?
+bl_source = '/home/sources/blender'
+build_dir = '/home/sources/blender-build/'
+install_dir = '/home/sources/blender-install/'
+with_player = True
+
+# Default config
+curr_arch = platform.architecture()[0]
+def_arch = 'x86_64' if curr_arch == '64bit' else 'i686'
+builder_dir = os.path.dirname(os.path.realpath(__file__))
+
+# XXX: bad thing!
+# builder_dir = builder_dir.replace("sources-new", "sources")
+
+def_cores = 1
+if hasattr(os, 'sysconf'):
+    if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
+        def_cores = os.sysconf('SC_NPROCESSORS_ONLN')
+
+# Per-architecture chroot name
+chroots = { 'i686': 'buildbot_squeeze_i686',
+            'x86_64': 'buildbot_squeeze_x86_64'}
+
+# Parse command line
+op = OptionParser()
+op.add_option('--tag', default = None)
+op.add_option('--branch', default = None)
+op.add_option('--arch', default = def_arch)
+op.add_option('--cores', default = def_cores)
+op.add_option('--bl-version', default = 'UNDEFINED')
+op.add_option('--no-clean', default = False)
+(opts, args) = op.parse_args()
+
+if opts.arch not in chroots:
+    print('Error: No configured machine gound to build ' + 
+          '{0} version' . format(opts.arch))
+    sys.exit(1)
+
+chroot = chroots[opts.arch]
+
+if opts.tag:
+    bl_source = '/home/sources/blender-tags/' + opts.tag
+elif opts.branch:
+    bl_source = '/home/sources/blender-branches/' + opts.branch
+
+if not os.path.isdir(bl_source):
+    print('Uname to find directory with sources: ' + bl_source)
+    sys.exit(1)
+
+print('Building {0} version, machine is {1}' . format(opts.bl_version, opts.arch))
+
+# Assume builder directory is binded to the same location in
+# chroot environments
+compiler = os.path.join(builder_dir, 'compile.py')
+
+cmd = 'schroot -c %s -d /home/sources/release-builder --' % (chroot)
+cmd += ' python %s' % (compiler)
+cmd += ' --bl-version=%s' % (opts.bl_version)
+cmd += ' --bl-source=%s' % (bl_source)
+cmd += ' --arch=%s' % (opts.arch)
+cmd += ' --build-dir=%s' % (build_dir)
+cmd += ' --install-dir=%s' % (install_dir)
+
+if opts.no_clean:
+    cmd += ' --no-clean=1'
+
+if with_player:
+    cmd += ' --with-player=1'
+
+#if opts.branch:
+#    cmd += ' --use-new-ffmpeg=1'
+
+result = os.system(cmd)
+if result != 0:
+    print('compiler script exited with errcode: %s' % (result))
+    sys.exit(1)
+EOF
+    chmod +x $RB/chroot-compile.py
+
+    cat << EOF > $RB/compile.py
+#!/usr/bin/env python
+
+import platform
+import sys
+import os
+import shutil
+
+from optparse import OptionParser
+
+# Default config
+curr_arch = platform.architecture()[0]
+def_arch = 'x86_64' if curr_arch == '64bit' else 'i686'
+builder_dir = os.path.dirname(os.path.realpath(__file__))
+
+def_cores = 1
+if hasattr(os, 'sysconf'):
+    if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
+        def_cores = os.sysconf('SC_NPROCESSORS_ONLN')
+
+# Parse command line
+op = OptionParser()
+op.add_option('--arch', default = def_arch)
+op.add_option('--cores', default = def_cores)
+op.add_option('--no-clean', default = False)
+op.add_option('--bl-version', default = 'UNKNOWN')
+op.add_option('--bl-source', default = '')
+op.add_option('--config-dir', default = '')
+op.add_option('--build-dir', default = '')
+op.add_option('--install-dir', default = '')
+op.add_option('--with-player', default = False)
+#op.add_option('--use-new-ffmpeg', default = False)
+(opts, args) = op.parse_args()
+
+if opts.config_dir == '':
+    opts.config_dir = os.path.join(builder_dir, 'config')
+
+# Initial directory checking (could be problems with permissions)
+if not os.path.isdir(opts.bl_source):
+    print('Blender\'s source tree not found: %s' % (opts.bl_source))
+    sys.exit(1)
+
+if not os.path.isdir(opts.config_dir):
+    print('Directory with configuration files not found: %s' % (opts.config_dir))
+    sys.exit(1)
+
+if not os.path.isdir(os.path.dirname(opts.build_dir)):
+    print('Build directory can\'t be reached: %s' % (opts.build_dir))
+    sys.exit(1)
+
+if not os.path.isdir(os.path.dirname(opts.install_dir)):
+    print('Install directory can\'t be reached: %s' % (opts.install_dir))
+    sys.exit(1)
+
+# Detect glibc version
+libc = [name for name in os.listdir('/lib') if 'libc.so.' in name]
+if len(libc) == 0:
+    print('Could not find "/lib/libc.so.*": cannot determine glibc version')
+    sys.exit(-1)
+
+if len(libc) > 1:
+    print('warning: found more than one "/lib/libc.so.*": '+
+          'using %s' % (libc[0]))
+
+glibc = 'glibc' + os.readlink('/lib/' + libc[0])[5:][:-3].replace('.', '')
+glibc = glibc[:8]
+
+# Full name for archive
+full_name = 'blender-%s-linux-%s-%s' % (opts.bl_version, glibc, opts.arch)
+build_dir = os.path.join(opts.build_dir, full_name)
+install_dir = os.path.join(opts.install_dir, full_name)
+scons = os.path.join(opts.bl_source, 'scons', 'scons.py')
+scons_cmd = 'python %s -C %s' % (scons, opts.bl_source)
+config = os.path.join(opts.config_dir, 'user-config-' + glibc + '-' + opts.arch + '.py')
+
+if not os.path.isfile(config):
+    print('Configuration file not found: %s' % (config))
+    sys.exit(1)
+
+# Clean build directory
+if not opts.no_clean:
+    print('Cleaning up build directory...')
+    os.system('%s BF_BUILDDIR=%s clean ' % (scons_cmd, build_dir))
+
+# Clean install directory
+if os.path.isdir(install_dir):
+    shutil.rmtree(install_dir)
+
+flags = ""
+
+# Switch to newer libraries if needed
+#if opts.use_new_ffmpeg:
+#    print("Using new ffmpeg-0.8.1")
+#    flags += " BF_FFMPEG='/home/sources/staticlibs/ffmpeg-0.8'"
+
+# Build blenderplayer first
+# (to be sure all stuff needed for blender would copied automatically)
+if opts.with_player:
+    player_config = os.path.join(opts.config_dir,
+        'user-config-player-' + glibc + '-' + opts.arch + '.py')
+
+    if not os.path.isfile(player_config):
+        print('Player configuration file not found: %s' % (player_config))
+        sys.exit(1)
+
+    cmd  = '%s -j %d blenderplayer ' % (scons_cmd, opts.cores + 1)
+    cmd += ' BF_BUILDDIR=%s' % (build_dir + '-player')
+    cmd += ' BF_INSTALLDIR=%s' % (install_dir)
+    cmd += ' BF_CONFIG=%s' % (player_config)
+    cmd += flags
+
+    result = os.system(cmd)
+    if result != 0:
+        print('Compilation failed, exit code is %d' % (result))
+        sys.exit(-1)
+
+# Build blender itself
+cmd  = '%s -j %d  blender ' % (scons_cmd, opts.cores + 1)
+cmd += ' BF_BUILDDIR=%s' % (build_dir)
+cmd += ' BF_INSTALLDIR=%s' % (install_dir)
+cmd += ' BF_CONFIG=%s' % (config)
+cmd += flags
+
+result = os.system(cmd)
+if result != 0:
+    print('Compilation failed, exit code is %d' % (result))
+    sys.exit(-1)
+
+blender = os.path.join(install_dir, 'blender')
+blenderplayer = blender + 'player'
+
+if not os.path.exists(blender):
+    print('scons completed successfully but blender executable missing')
+    sys.exit(1)
+
+if opts.with_player and not os.path.exists(blenderplayer):
+    print('scons completed successfully but blenderplayer executable missing')
+    sys.exit(1)
+
+# compile python modules
+#result = os.system('%s --background --python %s/source/tools/compile_scripts.py' % (blender, opts.bl_source))
+#if result != 0:
+#    print('Python modules compilation failed, exit code is %d' % (result))
+#    sys.exit(-1)
+
+print('build successful')
+
+os.system('strip -s %s %s' % (blender, blenderplayer))
+
+# Copy all texts needed for release
+release_texts = os.path.join(opts.bl_source, 'release', 'text', '*')
+release_txt = os.path.join(install_dir, 'release_%s.txt' % (opts.bl_version))
+
+os.system('cp -r %s %s' % (release_texts, install_dir))
+
+if os.path.exists(release_txt):
+    print 'RELEASE TEXT FOUND'
+else:
+    print 'WARNING! RELEASE TEXT NOT FOUND!'
+
+# TODO: copy plugins data when ready
+
+# Add software gl libraries and scripts
+mesa_arch = None
+
+if opts.arch == 'x86_64':
+    mesa_arch = 'mesalibs64.tar.bz2'
+elif opts.arch == 'i686':
+    mesa_arch = 'mesalibs32.tar.bz2'
+
+if mesa_arch is not None:
+    mesalibs = os.path.join(builder_dir, 'extra', mesa_arch)
+    software_gl = os.path.join(builder_dir, 'extra', 'blender-softwaregl')
+
+    os.system('tar -xpf %s -C %s' % (mesalibs, install_dir))
+    os.system('cp %s %s' % (software_gl, install_dir))
+    os.system('chmod 755 %s' % (os.path.join(install_dir, 'blender-softwaregl')))
+
+# Pack release archive
+print("Building Dynamic Tarball")
+os.system('tar -C %s -cjf %s.tar.bz2 %s ' % (opts.install_dir,
+                                             full_name, full_name))
+
+print('Done.')
+EOF
+    chmod +x $RB/compile.py
+
+    cat << EOF > $RB/do_build_al.sh
+#!/bin/sh
+
+SOURCES="/home/sources"
+
+#opts="--cores=1 "
+opts=""
+
+if [ "x\${tag}" != "x" ]; then
+  echo "Getting tagged source tree..."
+  d="\${SOURCES}/blender-tags/\${tag}"
+  opts="\${opts} --tag=\${tag}"
+  if [ ! -d \${d} ]; then
+    svn co https://svn.blender.org/svnroot/bf-blender/tags/\${tag}/blender/@\${revision}  \${d}
+  else
+    svn up -r \${revision} \${d}
+  fi
+elif [ "x\${branch}" != "x" ]; then
+  echo "Getting branched source tree..."
+  d="\${SOURCES}/blender-branches/\${branch}"
+  opts="\${opts} --branch=\${branch}"
+  if [ ! -d \${d} ]; then
+    if [ "x\${revision}" != "x" ]; then
+      svn co https://svn.blender.org/svnroot/bf-blender/branches/\${branch}/@\${revision}  \${d}
+    else
+      svn co https://svn.blender.org/svnroot/bf-blender/branches/\${branch}/  \${d}
+    fi
+  else
+    if [ "x\${revision}" != "x" ]; then
+      svn up -r \${revision} \${d}
+    else
+      svn up \${d}
+    fi
+  fi
+else
+  if [ "x\${revision}" != "x" ]; then
+    if [ "x\${revision}" != "x0" ]; then
+      svn up -r \${revision} \${SOURCES}/blender
+    else
+      svn up \${SOURCES}/blender
+    fi
+  fi
+fi
+
+if [ "x\${tag}" != "x" ]; then
+  b="\${SOURCES}/blender-tags/\${tag}"
+elif [ "x\${branch}" != "x" ]; then
+  b="\${SOURCES}/blender-branches/\${branch}"
+else
+  b="\${SOURCES}/blender"
+fi
+
+if [ "x\${addons_revision}" != "x" ]; then
+  d="\${b}/release/scripts/addons"
+
+  if [ "x\${addons_revision}" != "x0" ]; then
+    svn up -r \${addons_revision} \${d}
+  else
+    svn up \${d}
+  fi
+fi
+
+if [ "x\${locale_revision}" != "x" ]; then
+  d="\${b}/release/datafiles/locale"
+
+  if [ "x\${locale_revision}" != "x0" ]; then
+    svn up -r \${locale_revision} \${d}
+  else
+    svn up \${d}
+  fi
+fi
+
+if [ -z "\$version" ]; then
+  version=r\`/usr/bin/svnversion \$SOURCES/blender\`
+fi
+
+cd extra
+./update-libs.sh
+cd ..
+
+python chroot-compile.py \${opts} --arch=x86_64 --bl-version \${version}  # --no-clean=1
+python chroot-compile.py \${opts} --arch=i686 --bl-version \${version}  # --no-clean=1
+EOF
+    chmod +x $RB/do_build_al.sh
+
+    mkdir -p $RB/extra
+
+    cat << EOF > $RB/extra/blender-softwaregl
+#!/bin/sh
+
+BF_DIST_BIN=\`dirname "\$0"\`
+BF_PROGRAM="blender" # BF_PROGRAM=\`basename "\$0"\`-bin
+exitcode=0
+
+LD_LIBRARY_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARY_PATH}
+
+if [ -n "\$LD_LIBRARYN32_PATH" ]; then
+    LD_LIBRARYN32_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARYN32_PATH}
+fi
+if [ -n "\$LD_LIBRARYN64_PATH" ]; then
+    LD_LIBRARYN64_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARYN64_PATH}
+fi
+if [ -n "\$LD_LIBRARY_PATH_64" ]; then
+    LD_LIBRARY_PATH_64=\${BF_DIST_BIN}/lib:\${LD_LIBRARY_PATH_64}
+fi
+
+# Workaround for half-transparent windows when compiz is enabled
+XLIB_SKIP_ARGB_VISUALS=1
+
+export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD XLIB_SKIP_ARGB_VISUALS
+
+"\$BF_DIST_BIN/\$BF_PROGRAM" \${1+"\$@"}
+exitcode=\$?
+exit \$exitcode
+EOF
+    chmod +x $RB/extra/blender-softwaregl
+
+    cat << EOF > $RB/extra/do_update-libs.sh
+#!/bin/sh
+
+BITS=\$1
+V="\`readlink /opt/lib/mesa | sed -r 's/mesa-//'\`"
+TMP=\`mktemp -d\`
+N="mesalibs\$1-\$V"
+
+if [ ! -f \$N.tar.bz2 ]; then
+  mkdir -p \$TMP/lib
+  cp -P /opt/lib/mesa/lib/libGL* \$TMP/lib
+  strip -s \$TMP/lib/*
+  tar -C \$TMP -cf \$N.tar lib
+  bzip2 \$N.tar
+
+  rm -f mesalibs\$BITS.tar,bz2
+  ln -s \$N.tar.bz2 mesalibs\$BITS.tar.bz2
+fi
+
+rm -rf \$TMP
+EOF
+    chmod +x $RB/extra/do_update-libs.sh
+
+    cat << EOF > $RB/extra/update-libs.sh
+#!/bin/sh
+
+P="/home/sources/release-builder/extra"
+CHROOT_PREFIX="buildbot_squeeze_"
+CHROOT32="\${CHROOT_PREFIX}i686"
+CHROOT64="\${CHROOT_PREFIX}x86_64"
+RUN32="schroot -c \$CHROOT32 -d \$P"
+RUN64="schroot -c \$CHROOT64 -d \$P"
+
+\$RUN64 ./do_update-libs.sh 64
+\$RUN32 ./do_update-libs.sh 32
+EOF
+    chmod +x $RB/extra/update-libs.sh
+
+    mkdir -p $RB/config
+    cp $SOURCES_PATH/blender/build_files/buildbot/config/* $RB/config
+
+  fi
+}
+
+INSTALL_SOURCES() {
+  SOURCES_PATH=$1
+
+  if [ ! -d "$SOURCES_PATH" ]; then
+    INFO "Creating sources directory"
+    mkdir -p "$SOURCES_PATH"
+  fi
+
+  if [ ! -d "$SOURCES_PATH/backport/binutils" ]; then
+    INFO "Downloading binutils"
+    mkdir -p "$SOURCES_PATH/backport/binutils"
+    wget -c $DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_FV.diff.gz \
+            $DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_FV.dsc \
+            $DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_V.orig.tar.gz \
+        -P "$SOURCES_PATH/backport/binutils"
+  fi
+
+  if [ ! -d "$SOURCES_PATH/backport/gcc-4.7" ]; then
+    INFO "Downloading gcc-4.7"
+    mkdir -p "$SOURCES_PATH/backport/gcc-4.7"
+    wget -c $DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_FV.diff.gz \
+            $DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_FV.dsc \
+            $DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_V.orig.tar.gz \
+        -P "$SOURCES_PATH/backport/gcc-4.7"
+  fi
+
+  if [ ! -d "$SOURCES_PATH/backport/openssl" ]; then
+    INFO "Downloading openssl"
+    mkdir -p "$SOURCES_PATH/backport/openssl"
+    wget -c $DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.debian.tar.gz \
+            $DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.dsc \
+            $DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_V.orig.tar.gz \
+        -P "$SOURCES_PATH/backport/openssl"
+  fi
+
+  # JeMalloc
+  J="$SOURCES_PATH/packages/jemalloc-$JEMALLOC_V"
+  if [ ! -d "$J" ]; then
+    INFO "Downloading jemalloc-$JEMALLOC_V"
+    wget -c http://www.canonware.com/download/jemalloc/jemalloc-$JEMALLOC_V.tar.bz2 -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$J.tar.bz2"
+    cat << EOF > "$J/0config.sh"
+#!/bin/sh
+
+./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" --prefix=/opt/lib/jemalloc-$JEMALLOC_V
+EOF
+    chmod +x "$J/0config.sh"
+  fi
+
+  # Spnav
+  S="$SOURCES_PATH/packages/libspnav-$SPNAV_V"
+  if [ ! -d "$S" ]; then
+    wget -c http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%200.2.2/libspnav-$SPNAV_V.tar.gz \
+        -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$S.tar.gz"
+    cat << EOF > "$S/0config.sh"
+#!/bin/sh
+
+./configure --prefix=/opt/lib/libspnav-$SPNAV_V
+EOF
+    chmod +x "$S/0config.sh"
+  fi
+
+  # FFmpeg
+  F="$SOURCES_PATH/packages/ffmpeg-$FFMPEG_V"
+  if [ ! -d "$F" ]; then
+    INFO "Downloading FFmpeg-$FFMPEG_V"
+    wget -c http://ffmpeg.org/releases/ffmpeg-$FFMPEG_V.tar.bz2 -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$F.tar.bz2"
+    cat << EOF > "$F/0config.sh"
+#!/bin/sh
+
+./configure \\
+    --cc="/usr/bin/gcc-4.7 -Wl,--as-needed" \\
+    --extra-ldflags="-pthread -static-libgcc" \\
+    --prefix=/opt/lib/ffmpeg-$FFMPEG_V \\
+    --enable-static \\
+    --enable-avfilter \\
+    --disable-vdpau \\
+    --disable-bzlib \\
+    --disable-libgsm \\
+    --enable-libschroedinger \\
+    --disable-libspeex \\
+    --enable-libtheora \\
+    --enable-libvorbis \\
+    --enable-pthreads \\
+    --enable-zlib \\
+    --enable-libvpx \\
+    --enable-stripping \\
+    --enable-runtime-cpudetect  \\
+    --disable-vaapi \\
+    --enable-libopenjpeg \\
+    --disable-libfaac \\
+    --disable-nonfree \\
+    --enable-gpl \\
+    --disable-postproc \\
+    --disable-x11grab \\
+    --enable-libmp3lame \\
+    --disable-librtmp \\
+    --enable-libx264 \\
+    --enable-libxvid \\
+    --disable-libopencore-amrnb \\
+    --disable-libopencore-amrwb \\
+    --disable-libdc1394 \\
+    --disable-version3 \\
+    --disable-outdev=sdl \\
+    --disable-outdev=alsa \\
+    --disable-indev=sdl \\
+    --disable-indev=alsa \\
+    --disable-indev=jack \\
+    --disable-indev=lavfi
+
+#    --enable-debug
+#    --disable-optimizations
+#    --disable-ffplay
+EOF
+    chmod +x "$F/0config.sh"
+  fi
+
+  # Boost
+  B="$SOURCES_PATH/packages/boost_$BOOST_V"
+  if [ ! -d "$B" ]; then
+    INFO "Downloading Boost-$BOOST_V"
+    b_d=`echo "$BOOST_V" | sed -r 's/_/./g'`
+    wget -c http://sourceforge.net/projects/boost/files/boost/$b_d/boost_$BOOST_V.tar.bz2/download -O "$B.tar.bz2"
+    tar -C "$SOURCES_PATH/packages" -xf "$B.tar.bz2"
+  fi
+
+  # Python
+  P="$SOURCES_PATH/packages/Python-$PYTHON_V"
+  if [ ! -d "$P" ]; then
+    INFO "Downloading Python-$PYTHON_V"
+    wget -c http://python.org/ftp/python/$PYTHON_V/Python-$PYTHON_V.tar.bz2 -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$P.tar.bz2"
+    cat << EOF > "$P/0config.sh"
+#!/bin/sh
+
+# NOTE: this sounds strange, but make sure /dev/shm/ is writable by your user,
+#        otherwise syncronization primitives wouldn't be included into python
+if [[ "\`stat -c '%a' /dev/shm/\`" != "777" ]]; then
+  echo "Error checking syncronization primitives"
+  exit 1
+fi
+
+./configure --prefix=/opt/lib/python-$PYTHON_V \\
+  --enable-ipv6 \\
+  --enable-loadable-sqlite-extensions \\
+  --with-dbmliborder=bdb \\
+  --with-wide-unicode \\
+  --with-computed-gotos \\
+  --with-pymalloc
+EOF
+    chmod +x "$P/0config.sh"
+  fi
+
+  # OpenImageIO
+  O="$SOURCES_PATH/packages/OpenImageIO-$OIIO_V"
+  if [ ! -d "$O" ]; then
+    INFO "Downloading OpenImageIO-$OIIO_V"
+    wget -c https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_V -O "$O.tar.gz"
+    tar -C "$SOURCES_PATH/packages" -xf "$O.tar.gz"
+    mv $SOURCES_PATH/packages/OpenImageIO-oiio* $O
+    mkdir $O/build
+    cat << EOF > "$O/build/prepare.sh"
+#!/bin/sh
+
+if file /bin/cp | grep -q '32-bit'; then
+  cflags="-fPIC -m32 -march=i686"
+else
+  cflags="-fPIC"
+fi
+
+cmake \\
+    -D CMAKE_BUILD_TYPE=Release \\
+    -D CMAKE_PREFIX_PATH=/opt/lib/oiio-$OIIO_V \\
+    -D CMAKE_INSTALL_PREFIX=/opt/lib/oiio-$OIIO_V \\
+    -D BUILDSTATIC=ON \\
+    -D USE_JASPER=OFF \\
+    -D CMAKE_CXX_FLAGS:STRING="\${cflags}" \\
+    -D CMAKE_C_FLAGS:STRING="\${cflags}" \\
+    -D CMAKE_EXE_LINKER_FLAGS='-lgcc_s -lgcc' \\
+    -D BOOST_ROOT=/opt/lib/boost \\
+    ../src
+EOF
+    chmod +x "$O/build/prepare.sh"
+  fi
+
+  # OpenColorIO
+  O="$SOURCES_PATH/packages/OpenColorIO-$OCIO_V"
+  if [ ! -d "$O" ]; then
+    INFO "Downloading OpenColorIO-$OCIO_V"
+    wget -c http://github.com/imageworks/OpenColorIO/tarball/v$OCIO_V -O "$O.tar.gz"
+    tar -C "$SOURCES_PATH/packages" -xf "$O.tar.gz"
+    mv $SOURCES_PATH/packages/imageworks-OpenColorIO* $O
+    mkdir $O/build
+    cat << EOF > "$O/build/prepare.sh"
+#!/bin/sh
+
+if file /bin/cp | grep -q '32-bit'; then
+  cflags="-fPIC -m32 -march=i686"
+else
+  cflags="-fPIC"
+fi
+
+cmake \\
+  -D CMAKE_BUILD_TYPE=Release \\
+  -D CMAKE_PREFIX_PATH=/opt/lib/ocio-1.0.7 \\
+  -D CMAKE_INSTALL_PREFIX=/opt/lib/ocio-1.0.7 \\
+  -D BUILDSTATIC=ON \\
+  -D CMAKE_CXX_FLAGS:STRING="\${cflags}" \\
+  -D CMAKE_C_FLAGS:STRING="\${cflags}" \\
+  -D CMAKE_EXE_LINKER_FLAGS='-lgcc_s -lgcc' \\
+  ..
+EOF
+
+    chmod +x "$O/build/prepare.sh"
+  fi
+
+  # Mesa
+  M="$SOURCES_PATH/packages/Mesa-$MESA_V"
+  if [ ! -d "$M" ]; then
+    INFO "Downloading Mesa-$MESA_V"
+    wget -c ftp://ftp.freedesktop.org/pub/mesa/$MESA_V/MesaLib-$MESA_V.tar.bz2 -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$SOURCES_PATH/packages/MesaLib-$MESA_V.tar.bz2"
+    cat << EOF > "$M/0config.sh"
+#!/bin/sh
+
+OPTS="--with-driver=xlib \\
+  --disable-driglx-direct \\
+  --disable-egl \\
+  --enable-gallium-gbm=no \\
+  --enable-gallium-egl=no \\
+  --enable-gallium-llvm=no \\
+  --with-gallium-drivers=swrast \\
+  --with-dri-drivers=swrast \\
+  --prefix=/opt/lib/mesa-$MESA_V"
+
+if file /bin/cp | grep -q '32-bit'; then
+  ./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" \${OPTS} --enable-32-bit #--build=i486-linux-gnu
+else
+  ./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" \${OPTS}
+fi
+
+EOF
+    chmod +x "$M/0config.sh"
+  fi
+
+  # OpenAL
+  O="$SOURCES_PATH/packages/openal-soft-$OPENAL_V"
+  if [ ! -d "$O" ]; then
+    INFO "Downloading OpenAL-$OPENAL_V"
+    wget -c http://kcat.strangesoft.net/openal-releases/openal-soft-$OPENAL_V.tar.bz2 -P "$SOURCES_PATH/packages"
+    tar -C "$SOURCES_PATH/packages" -xf "$SOURCES_PATH/packages/openal-soft-$OPENAL_V.tar.bz2"
+    cat << EOF > "$O/build-openal.sh"
+#!/bin/sh
+
+DEB_CMAKE_OPTIONS="-DCMAKE_VERBOSE_MAKEFILE=ON \\
+    -DCMAKE_INSTALL_PREFIX=/opt/lib/openal-$OPENAL_V \\
+    -DCMAKE_BUILD_TYPE:String=Release \\
+    -DALSOFT_CONFIG=ON \\
+    -DLIBTYPE=STATIC .. "
+
+BUILD_TREE=./build-tree
+
+rm -rf "\${BUILD_TREE}"
+mkdir -p "\${BUILD_TREE}"
+cd "\${BUILD_TREE}"
+
+sh -c "cmake \`echo \$DEB_CMAKE_OPTIONS\`"
+make -j$THREADS
+make install
+EOF
+    chmod +x "$O/build-openal.sh"
+  fi
+
+  # OpenCollada
+  O="$SOURCES_PATH/packages/opencollada"
+  if [ ! -d "$O" ]; then
+    INFO "Checking out OpenCollada sources"
+    svn co http://opencollada.googlecode.com/svn/trunk $O
+
+    cat << EOF > "$O/build_all.sh"
+#!/bin/sh
+
+scons RELEASE=0 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS} --clean
+scons RELEASE=1 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS} --clean
+
+scons RELEASE=0 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS}
+scons RELEASE=1 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS}
+EOF
+
+    cat << EOF > "$O/prepare_lib-libxml.sh"
+#!/bin/bash
+
+src="./COLLADAStreamWriter/include
+./COLLADABaseUtils/include
+./COLLADABaseUtils/include/Math
+./COLLADAFramework/include
+./GeneratedSaxParser/include
+./COLLADASaxFrameworkLoader/include
+./COLLADASaxFrameworkLoader/include/generated14
+./COLLADASaxFrameworkLoader/include/generated15"
+
+if [ -z \$1 ]; then
+  arch="x86_64"
+else
+  arch=\$1
+fi
+
+libs="./GeneratedSaxParser/lib/posix/\${arch}/releaselibxml/libGeneratedSaxParser.a
+./Externals/MathMLSolver/lib/posix/\${arch}/release/libMathMLSolver.a
+./COLLADABaseUtils/lib/posix/\${arch}/release/libOpenCOLLADABaseUtils.a
+./COLLADAFramework/lib/posix/\${arch}/release/libOpenCOLLADAFramework.a
+./COLLADASaxFrameworkLoader/lib/posix/\${arch}/releaselibxmlNovalidation/libOpenCOLLADASaxFrameworkLoader.a
+./COLLADAStreamWriter/lib/posix/\${arch}/release/libOpenCOLLADAStreamWriter.a
+./Externals/UTF/lib/posix/\${arch}/release/libUTF.a
+./common/libBuffer/lib/posix/\${arch}/release/libbuffer.a
+./common/libftoa/lib/posix/\${arch}/release/libftoa.a"
+
+#./Externals/pcre/lib/posix/\${arch}/release/libpcre.a
+#./Externals/LibXML/lib/posix/\${arch}/release/libxml.a
+
+debug_libs="./GeneratedSaxParser/lib/posix/\${arch}/debuglibxml/libGeneratedSaxParser.a
+./Externals/MathMLSolver/lib/posix/\${arch}/debug/libMathMLSolver.a
+./COLLADABaseUtils/lib/posix/\${arch}/debug/libOpenCOLLADABaseUtils.a
+./COLLADAFramework/lib/posix/\${arch}/debug/libOpenCOLLADAFramework.a
+./COLLADASaxFrameworkLoader/lib/posix/\${arch}/debuglibxmlNovalidation/libOpenCOLLADASaxFrameworkLoader.a
+./COLLADAStreamWriter/lib/posix/\${arch}/debug/libOpenCOLLADAStreamWriter.a
+./Externals/UTF/lib/posix/\${arch}/debug/libUTF.a
+./common/libBuffer/lib/posix/\${arch}/debug/libbuffer.a
+./common/libftoa/lib/posix/\${arch}/debug/libftoa.a"
+
+#./Externals/pcre/lib/posix/\${arch}/debug/libpcre.a
+#./Externals/LibXML/lib/posix/\${arch}/debug/libxml.a
+
+d="opencollada-libxml"
+rm -rf \${d}
+mkdir -p \${d}/include
+
+for i in \${src}; do
+  mkdir -p \${d}/include/\${i}
+  cp \${i}/*.h \${d}/include/\${i}
+done
+
+mkdir \${d}/lib
+for i in \${libs}; do
+  echo "" > /dev/null
+  cp \${i} \${d}/lib
+done
+
+for i in \${debug_libs}; do
+  f=\`basename \${i}\`
+  o=\${f/\\.a/_d.a}
+  cp \${i} \${d}/lib/\${o}
+done
+
+rm -rf /opt/lib/opencollada
+mv \${d} /opt/lib/opencollada
+chown -R root:staff /opt/lib/opencollada
+EOF
+
+    chmod +x "$O/build_all.sh"
+    chmod +x "$O/prepare_lib-libxml.sh"
+  fi
+
+  # Blender
+  B="$SOURCES_PATH/blender"
+  if [ ! -d "$B" ]; then
+    INFO "Checking out Blender sources"
+    svn co https://svn.blender.org/svnroot/bf-blender/trunk/blender $B
+  fi
+
+  # CUDA Toolkit
+  C=$SOURCES_PATH/cudatoolkit
+  if [ ! -f "$C/$CUDA_32" ]; then
+    INFO "Downloading CUDA 32bit toolkit"
+    mkdir -p $C
+    wget -c http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/$CUDA_32 -P $C
+  fi
+
+  if [ ! -f "$C/$CUDA_64" ]; then
+    INFO "Downloading CUDA 64bit toolkit"
+    mkdir -p $C
+    wget -c http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/$CUDA_64 -P $C
+  fi
+
+  if [ ! -f $SOURCES_PATH/Readme.txt ]; then
+
+    cat << EOF > $SOURCES_PATH/Readme.txt
+This directory contains different things needed for Blender builds
+
+blender/: directory with blender's svnsnapshot
+
+blender-build/, blender-install/: build and install directories for
+                                  automated release creation
+
+buildbot-i686-slave/,
+buildbot-x86_64-slave/: buildbot slave environments for automated builds
+                        (maybe it'll be better to move them to /home?)
+
+staticlibs/: set of static libs. Mostly needed to make static linking prioretized
+             under dynamic linking
+
+release-builder/: all stuff needed for release archives preparation
+
+Hope all this would help you.
+
+-Sergey-
+EOF
+  fi
+
+  INSTALL_RELEASE_BUILDER $SOURCES_PATH
+}
+
+DO_BACKPORT() {
+  CHROOT_ARCH=$1
+  CHROOT_PATH=$2
+
+  RUN="chroot $CHROOT_PATH"
+  P="/home/sources/backport"
+
+  # Backport fresh binutils
+  if [ `$RUN dpkg-query -W -f='${Version}\n' binutils | grep -c $BINUTILS_V` -eq "0" ]; then
+    INFO "Backporting binutils"
+    B="$P/binutils/binutils-$BINUTILS_V"
+    pkg="$P/binutils/binutils_${BINUTILS_FV}_amd64.deb"
+
+    if [ ! -d "$CHROOT_PATH/$B" ]; then
+      INFO "Unpacking binutils"
+      $RUN dpkg-source -x "$P/binutils/binutils_$BINUTILS_FV.dsc" "$B"
+    fi
+
+    if [ "$CHROOT_ARCH" = "i386" ]; then
+      pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
+    fi
+
+    if [ ! -f "$CHROOT_PATH/$pkg" ]; then
+      INFO "Compiling binutils"
+      sed -ie 's/with_check := yes/with_check := no/' "$CHROOT_PATH/$B/debian/rules"
+      $RUN sh -c "cd '$B' && dpkg-buildpackage -rfakeroot -j$THREADS"
+    fi
+
+    INFO "Installing binutils"
+    $RUN dpkg -i "$pkg"
+
+    INFO "Cleaning binutils"
+    $RUN sh -c "cd '$B' && fakeroot debian/rules clean"
+  fi
+
+  # Install fresh gcc
+  if [ `$RUN dpkg-query -W -f='${Status}\n' gcc-4.7 2> /dev/null | grep -c installed` -eq "0" ]; then
+    INFO "Backporting gcc-4.7"
+    G="$P/gcc-4.7/gcc-$GCC_V"
+
+    pkg="cpp-4.7_4.7.1-7_amd64.deb  gcc-4.7-base_4.7.1-7_amd64.deb \
+          libstdc++6-4.7-dev_4.7.1-7_amd64.deb libstdc++6_4.7.1-7_amd64.deb libgcc1_4.7.1-7_amd64.deb \
+          libgomp1_4.7.1-7_amd64.deb libitm1_4.7.1-7_amd64.deb libquadmath0_4.7.1-7_amd64.deb \
+          gcc-4.7_4.7.1-7_amd64.deb g++-4.7_4.7.1-7_amd64.deb"
+
+    if [ ! -d "$CHROOT_PATH/$G" ]; then
+      INFO "Unpacking gcc-4.7"
+      $RUN dpkg-source -x "$P/gcc-4.7/gcc-$GCC_FV.dsc" "$G"
+    fi
+
+    if [ "$CHROOT_ARCH" = "i386" ]; then
+      pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
+    fi
+
+    ok=true
+    for x in `echo "$pkg"`; do
+      if [ ! -f "$CHROOT_PATH/$P/gcc-4.7/$x" ]; then
+        ok=false
+        break;
+      fi
+    done
+
+    if ! $ok; then
+      INFO "Compiling gcc-4.7"
+      sed -ie 's/#with_check := disabled by hand/with_check := disabled by hand/' "$CHROOT_PATH/$G/debian/rules.defs"
+      sed -ie 's/dpkg-dev (>= 1.16.0~ubuntu4)/dpkg-dev (>= 1.15.8)/' "$CHROOT_PATH/$G/debian/control"
+      sed -ie 's/doxygen (>= 1.7.2)/doxygen (>= 1.7.1)/' "$CHROOT_PATH/$G/debian/control"
+      sed -ie 's/libmpfr-dev (>= 3.0.0-9~)/libmpfr-dev (>= 3.0.0)/' "$CHROOT_PATH/$G/debian/control"
+      sed -ie 's/libc6-dev (>= 2.13-5)/libc6-dev (>= 2.11.3)/' "$CHROOT_PATH/$G/debian/control"
+      sed -ie 's/libgmp-dev (>= 2:5.0.1~)/libgmp3-dev (>= 2:4.3.2)/' "$CHROOT_PATH/$G/debian/control"
+      $RUN sh -c "cd '$G' && dpkg-buildpackage -rfakeroot"
+    fi
+
+    inst=""
+    for x in `echo "$pkg"`; do
+      inst="$inst $P/gcc-4.7/$x"
+    done
+
+    INFO "Installing gcc-4.7"
+    $RUN dpkg -i $inst
+
+    INFO "Cleaning gcc-4.7"
+    $RUN sh -c "cd '$G' && fakeroot debian/rules clean"
+  fi
+
+  # Backport OpenSSL
+  if [ ! -f $CHROOT_PATH/usr/lib/libssl_pic.a ]; then
+    INFO "Backporting OpenSSL"
+    O="$P/openssl/openssl-$OPENSSL_V"
+
+    pkg="libssl-dev_0.9.8o-4squeeze13_amd64.deb libssl0.9.8_0.9.8o-4squeeze13_amd64.deb  openssl_0.9.8o-4squeeze13_amd64.deb"
+
+    if [ ! -d "$CHROOT_PATH/$O" ]; then
+      INFO "Unpacking OpenSSL"
+      $RUN dpkg-source -x "$P/openssl/openssl_$OPENSSL_FV.dsc" "$O"
+    fi
+
+    if [ "$CHROOT_ARCH" = "i386" ]; then
+      pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
+    fi
+
+    ok=true
+    for x in `echo "$pkg"`; do
+      if [ ! -f "$CHROOT_PATH/$P/openssl/$x" ]; then
+        ok=false
+        break;
+      fi
+    done
+
+    if ! $ok; then
+      INFO "Compiling OpenSSL"
+      sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/	mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/' "$CHROOT_PATH/$O/debian/rules"
+      sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/	mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/' "$CHROOT_PATH/$O/debian/rules"
+      cat << EOF > $CHROOT_PATH/$O/debian/libssl-dev.files
+usr/lib/libssl.so
+usr/lib/libcrypto.so
+usr/lib/libssl.a
+usr/lib/libcrypto.a
+usr/lib/libssl_pic.a
+usr/lib/libcrypto_pic.a
+usr/lib/pkgconfig
+usr/include
+usr/share/man/man3
+EOF
+      $RUN sh -c "cd '$O' && dpkg-buildpackage -rfakeroot -j$THREADS"
+    fi
+
+    inst=""
+    for x in `echo "$pkg"`; do
+      inst="$inst $P/openssl/$x"
+    done
+
+    INFO "Installing OpenSSL"
+    $RUN dpkg -i $inst
+
+    echo "openssl hold" | $RUN dpkg --set-selections
+    echo "libssl-dev hold" | $RUN dpkg --set-selections
+    echo "libssl0.9.8 hold" | $RUN dpkg --set-selections
+
+    INFO "Cleaning OpenSSL"
+    $RUN sh -c "cd '$O' && fakeroot debian/rules clean"
+  fi
+}
+
+DO_COMPILE() {
+  CHROOT_ARCH=$1
+  CHROOT_PATH=$2
+
+  RUN="chroot $CHROOT_PATH"
+  P="/home/sources/packages"
+  L="$CHROOT_PATH/opt/lib"
+
+  # JeMalloc
+  if [ ! -d "$L/jemalloc-$JEMALLOC_V" ]; then
+    INFO "Copmiling jemalloc-$JEMALLOC_V"
+    $RUN sh -c "cd '$P/jemalloc-$JEMALLOC_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/jemalloc"
+    ln -s "jemalloc-$JEMALLOC_V" "$L/jemalloc"
+  fi
+
+  # libspnav
+  if [ ! -d "$L/libspnav-$SPNAV_V" ]; then
+    INFO "Copmiling libspnav-$SPNAV_V"
+    mkdir -p "$L/libspnav-$SPNAV_V/lib"
+    mkdir -p "$L/libspnav-$SPNAV_V/include"
+    $RUN sh -c "cd '$P/libspnav-$SPNAV_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/libspnav"
+    ln -s "libspnav-$SPNAV_V" "$L/libspnav"
+  fi
+
+  # FFmpeg
+  if [ ! -d "$L/ffmpeg-$FFMPEG_V" ]; then
+    INFO "Copmiling ffmpeg-$FFMPEG_V"
+    $RUN sh -c "cd '$P/ffmpeg-$FFMPEG_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/ffmpeg"
+    ln -s "ffmpeg-$FFMPEG_V" "$L/ffmpeg"
+  fi
+
+  # Boost
+  V=`echo $BOOST_V | sed -r 's/_/./g'`
+  if [ ! -d "$L/boost-$V" ]; then
+    INFO "Copmiling boost-$V"
+    $RUN sh -c "cd '$P/boost_$BOOST_V' && ./bootstrap.sh && ./b2 --clean && ./b2 install --prefix='/opt/lib/boost-$V' && ./b2 --clean"
+
+    rm -f "$L/boost"
+    ln -s "boost-$V" "$L/boost"
+  fi
+
+  # OCIO
+  if [ ! -d "$L/ocio-$OCIO_V" ]; then
+    INFO "Copmiling ocio-$OCIO_V"
+    $RUN sh -c "cd '$P/OpenColorIO-$OCIO_V/build' && ./prepare.sh && make clean && make -j$THREADS && make install && make clean"
+
+    # Force linking against sttaic libs
+    rm -f $L/ocio-$OCIO_V/lib/*.so*
+
+    # Additional depencencies
+    cp $CHROOT_PATH/$P/OpenColorIO-$OCIO_V/build/ext/dist/lib/libtinyxml.a $L/ocio-$OCIO_V/lib
+    cp $CHROOT_PATH/$P/OpenColorIO-$OCIO_V/build/ext/dist/lib/libyaml-cpp.a $L/ocio-$OCIO_V/lib
+
+    rm -f "$L/ocio"
+    ln -s "ocio-$OCIO_V" "$L/ocio"
+  fi
+
+  # OIIO
+  if [ ! -d "$L/oiio-$OIIO_V" ]; then
+    INFO "Copmiling oiio-$OIIO_V"
+    $RUN sh -c "cd '$P/OpenImageIO-$OIIO_V/build' && ./prepare.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/oiio"
+    ln -s "oiio-$OIIO_V" "$L/oiio"
+  fi
+
+  # Python
+  if [ ! -d "$L/python-$PYTHON_V" ]; then
+    INFO "Copmiling Python-$PYTHON_V"
+
+    cat << EOF > $CHROOT_PATH/$P/Python-$PYTHON_V/Modules/Setup.local
+_md5 md5module.c
+
+_sha1 sha1module.c
+_sha256 sha256module.c
+_sha512 sha512module.c
+EOF
+
+    sed -ie "s/libraries = \['ssl', 'crypto'\]/libraries = ['ssl_pic', 'crypto_pic', 'z']/" "$P/Python-$PYTHON_V/setup.py"
+
+    $RUN sh -c "cd '$P/Python-$PYTHON_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/python-$PYTHIN_V_SHORT"
+    ln -s "python-$PYTHON_V" "$L/python-$PYTHIN_V_SHORT"
+  fi
+
+  # Mesa
+  if [ ! -d "$L/mesa-$MESA_V" ]; then
+    INFO "Copmiling Mesa-$MESA_V"
+
+    $RUN sh -c "cd '$P/Mesa-$MESA_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
+
+    rm -f "$L/mesa"
+    ln -s "mesa-$MESA_V" "$L/mesa"
+  fi
+
+  # OpenAL
+  if [ ! -d "$L/openal-$OPENAL_V" ]; then
+    INFO "Copmiling openal-$OPENAL_V"
+
+    $RUN sh -c "cd '$P/openal-soft-$OPENAL_V' && ./build-openal.sh"
+
+    rm -f "$L/openal"
+    ln -s "openal-$OPENAL_V" "$L/openal"
+  fi
+
+  # OpenCollada
+  if [ ! -d "$L/opencollada" ]; then
+    INFO "Copmiling opencollada"
+
+    cat << EOF > "$CHROOT_PATH/$P/opencollada/collada.patch"
+Index: common/libBuffer/include/CommonBuffer.h
+===================================================================
+--- common/libBuffer/include/CommonBuffer.h	(revision 876)
++++ common/libBuffer/include/CommonBuffer.h	(working copy)
+@@ -12,6 +12,7 @@
+ #define __COMMON_BUFFER_H__
+ 
+ #include "CommonIBufferFlusher.h"
++#include "COLLADABUPlatform.h"
+ 
+ namespace Common
+ {
+Index: common/libBuffer/src/CommonLogFileBufferFlusher.cpp
+===================================================================
+--- common/libBuffer/src/CommonLogFileBufferFlusher.cpp	(revision 876)
++++ common/libBuffer/src/CommonLogFileBufferFlusher.cpp	(working copy)
+@@ -10,6 +10,34 @@
+ 
+ #include "CommonLogFileBufferFlusher.h"
+ 
++#include <stdio.h>
++#include <errno.h>
++
++#ifndef _WIN32
++FILE *_wfopen(const wchar_t *path, const char *mode)
++{
++	const wchar_t *src = path;
++	char *path_mbs;
++	int n;
++	FILE *file;
++
++	n = (int)wcsrtombs(NULL, &src, 0, NULL);
++
++	if (n < 0)
++		return NULL;
++
++	path_mbs = (char *)malloc(n + 1);
++	wcsrtombs(path_mbs, &path, n, NULL);
++	path_mbs[n] = 0;
++
++	file = fopen(path_mbs, mode);
++
++	free(path_mbs);
++
++	return file;
++}
++#endif
++
+ namespace Common
+ {
+ 	//--------------------------------------------------------------------
+@@ -35,7 +63,7 @@
+ #ifdef _WIN32
+ 		mError = (int)_wfopen_s( &stream, fileName, L"wb" );
+ #else
+-		stream = _wfopen( fileName, L"wb" );
++		stream = _wfopen( fileName, "wb" );
+ 		mError = stream ? 0 : errno;
+ #endif
+ 		if ( !mError )
+@@ -65,7 +93,7 @@
+ #else
+ 		if ( mUseWideFileName )
+ 		{
+-			stream = _wfopen( mWideFileName.c_str(), L"a" );
++			stream = _wfopen( mWideFileName.c_str(), "a" );
+ 		}
+ 		else
+ 		{
+Index: common/libBuffer/SConscript
+===================================================================
+--- common/libBuffer/SConscript	(revision 876)
++++ common/libBuffer/SConscript	(working copy)
+@@ -11,7 +11,7 @@
+ targetPath = outputDir + libName
+ 
+ 
+-incDirs = ['include/', '../libftoa/include']
++incDirs = ['include/', '../libftoa/include', '../../COLLADABaseUtils/include/', '../../Externals/UTF/include']
+ 
+ 
+ src = []
+EOF
+
+    # We're building in a chroot, architecture of host system would be used by scons
+    collada_arch="x86_64"
+
+    $RUN sh -c "cd '$P/opencollada' && svn revert . -R && cat collada.patch | patch -p0 && ./build_all.sh && ./prepare_lib-libxml.sh  $collada_arch"
+  fi
+}
+
+ADD_REPO() {
+  CHROOT_PATH=$1
+  DESC=$2
+  REPO=$3
+  C="$CHROOT_PATH/etc/apt/sources.list"
+  RUN="chroot $CHROOT_PATH"
+
+  if [ `cat "$C" | grep -c "$REPO"` -eq "0" ]; then
+    INFO "Adding repo $DESC"
+    echo "" >> $C
+    echo "deb $REPO" >> $C
+    echo "deb-src $REPO" >> $C
+
+    INFO "Updating packages list"
+    $RUN apt-get update
+  fi
+}
+
+INSTALL_CHROOT() {
+  CHROOT_ARCH=$1
+  CHROOT_PATH=$2
+
+  RUN="chroot $CHROOT_PATH"
+
+  # Install fresh debian to a chroot
+  if [ ! -d "$CHROOT_PATH" ]; then
+
+    INFO "Installing Debian ${DEBIAN_BRANCH} to ${CHROOT_PATH}"
+    debootstrap --arch "${CHROOT_ARCH}" "${DEBIAN_BRANCH}" "${CHROOT_PATH}" "${DEBIAN_MIRROR}"
+  fi
+
+  # Configure users and groups
+
+  if [ `cat ${CHROOT_PATH}/etc/group | grep -c developers` -eq "0" ]; then
+    INFO "Creating gorup 'developers'"
+    $RUN groupadd -g 7001 developers
+  fi
+
+  if [ `mount | grep -c "$CHROOT_PATH/dev"` -eq "0" ]; then
+    INFO "Mounting devices from host system to chroot"
+
+    mount -t proc none $CHROOT_PATH/proc
+    mount -t auto -o bind /dev $CHROOT_PATH/dev
+    mount -t devpts -o mode=0620 none $CHROOT_PATH/dev/pts
+  fi
+
+  # Configure apt and install packages
+
+  if [ ! -f ${CHROOT_PATH}/etc/apt/apt.conf ]; then
+    INFO "Setting up apt to not use recommended packages (saves disk space)"
+
+    cat << EOF > "${CHROOT_PATH}/etc/apt/apt.conf"
+APT {
+  Default-Release "${DEBIAN_BRANCH}";
+  Install-Recommends "0";
+};
+EOF
+  fi
+
+  ADD_REPO $CHROOT_PATH "mirror.yandex.ru" "http://mirror.yandex.ru/debian-multimedia/ squeeze main non-free"
+  ADD_REPO $CHROOT_PATH "backports.debian.org" "http://backports.debian.org/debian-backports squeeze-backports main non-free"
+
+  $RUN apt-get upgrade
+
+  $RUN apt-get install -y --force-yes deb-multimedia-keyring libx264-dev libxvidcore4-dev libmp3lame-dev
+
+  if [ `$RUN dpkg-query -W -f='${Status}\n' locales | grep -c not-installed` -eq "1" ]; then
+    INFO "Configuring locales"
+    $RUN apt-get install -y locales
+    $RUN localedef -i en_US -f UTF-8 en_US.UTF-8
+  fi
+
+  INFO "Installing packages from repository"
+
+  $RUN apt-get install -y mc gcc g++ cmake python dpkg-dev build-essential autoconf bison \
+      flex gettext texinfo dejagnu quilt file lsb-release zlib1g-dev fakeroot debhelper \
+      g++-multilib  libtool autoconf2.64 automake  gawk lzma patchutils gperf sharutils \
+      libcloog-ppl-dev libmpc-dev libmpfr-dev libgmp3-dev autogen realpath chrpath doxygen \
+      graphviz gsfonts-x11 texlive-latex-base libelfg0-dev libx11-dev yasm libopenjpeg-dev \
+      libschroedinger-dev libtheora-dev libvorbis-dev libvpx-dev=$VPX_V \
+      libopenexr-dev libpng-dev libjpeg-dev libtiff-dev python-dev libbz2-dev libreadline-dev \
+      libsqlite3-dev liblzma-dev libncurses5-dev xutils-dev libxext-dev python-libxml2 \
+      libglu1-mesa-dev libfftw3-dev libfreetype6-dev libsdl1.2-dev libopenal-dev libjack-dev \
+      libxi-dev portaudio19-dev po4a subversion scons libpcre3-dev libexpat1-dev sudo \
+      expect bc
+
+  if [ $CHROOT_ARCH = "amd64" ]; then
+    $RUN apt-get install -y libc6-dev-i386 lib32gcc1
+  fi
+
+  # Configure sources directory
+  if [ ! -d "$CHROOT_PATH/home/sources" ]; then
+    INFO "Creating sources directory"
+    $RUN mkdir "/home/sources"
+    $RUN chmod 775 /home/sources
+    $RUN chown root:developers /home/sources
+  fi
+
+  # Bind directory from host system
+  if [ ! -d "$CHROOT_PATH/home/sources/backport" ]; then
+    INFO "Binding sources directory from host system to chroot"
+    mount -o bind "$SOURCES_PATH" "$CHROOT_PATH/home/sources"
+  fi
+
+  if [ "`$RUN getent passwd $USER_ID`" = "" ]; then
+    INFO "Adding default user to chroot"
+    login=`getent passwd $USER_ID | cut -d : -f 1`
+    $RUN useradd -d "/home/$login" -G developers,sudo -m -u $USER_ID "$login"
+  fi
+
+  # Backport packages
+  DO_BACKPORT "$CHROOT_ARCH" "$CHROOT_PATH"
+
+  # Set default compiler to gcc-4.7
+  if [ `readlink "$CHROOT_PATH/usr/bin/gcc"` != "gcc-4.7" ]; then
+    INFO "Setting gcc-4.7 as default compiler"
+    rm -f $CHROOT_PATH/usr/bin/gcc
+    rm -f $CHROOT_PATH/usr/bin/g++
+    ln -s gcc-4.7 $CHROOT_PATH/usr/bin/gcc
+    ln -s g++-4.7 $CHROOT_PATH/usr/bin/g++
+  fi
+
+  # Compile packages
+  DO_COMPILE "$CHROOT_ARCH" "$CHROOT_PATH"
+
+  # Install CUDA toolkit
+  if [ ! -d "$CHROOT_PATH/usr/local/cuda-$CUDA_V" ]; then
+        INFO "Installing CUDA toolkit"
+
+        if [ "$CHROOT_ARCH" = "amd64" ]; then
+          C="cudatoolkit_${CUDA_V}_linux_64_${CUDA_DISTR}.run"
+        else
+          C="cudatoolkit_${CUDA_V}_linux_32_${CUDA_DISTR}.run"
+        fi
+
+        rm -f $CHROOT_PATH/usr/local/cuda
+
+        chmod +x $CHROOT_PATH//home/sources/cudatoolkit/$C
+
+        $RUN /usr/bin/expect <<EOF
+        spawn /home/sources/cudatoolkit/$C
+        expect "Enter install path"
+        send "\n"
+        expect "Installation Complete"
+EOF
+
+    mv $CHROOT_PATH/usr/local/cuda $CHROOT_PATH/usr/local/cuda-$CUDA_V
+    ln -s cuda-$CUDA_V $CHROOT_PATH/usr/local/cuda
+    sudo ln -s /usr/bin/gcc-4.4 $CHROOT_PATH/usr/local/cuda/bin/gcc
+  fi
+
+  # Change permissions
+  INFO "Changing permissions on sources"
+  login=`$RUN getent passwd $USER_ID | cut -d : -f 1`
+  for x in /home/sources /opt/lib; do
+    $RUN chmod g+w -R $x
+    $RUN chown "$login:developers" -R $x
+  done
+}
+
+if ! which debootstrap > /dev/null 2>&1; then
+  ERROR "debootstrap command not found, can not create chroot environment"
+  ERROR "Use apt-get install debootstrap to install debootstrap"
+  exit 1
+fi
+
+if [ -z "$ENV_PATH" ]; then
+  ERROR "Incorrect environment directory is set"
+  exit 1
+fi
+
+INSTALL_SOURCES "$SOURCES_PATH"
+INSTALL_CHROOT amd64 "$AMD64_PATH"
+INSTALL_CHROOT i386 "$I686_PATH"
+
+INFO "Configurtion of build environment is completed!"
+echo "Add this lines to your /etc/fstab:"
+echo
+
+for x in $I686_PATH $AMD64_PATH; do
+  echo "none           $x/proc         proc      auto              0    0"
+  echo "/dev           $x/dev          auto      bind,auto         0    0"
+  echo "none           $x/dev/pts      devpts    mode=0620,auto    0    0"
+  echo "/home/sources  $x/home/sources auto      bind,auto         0    0"
+  echo
+done
+
+echo "Add this lines to your /etc/schroot/schroot.conf:"
+echo
+login=`getent passwd $USER_ID | cut -d : -f 1`
+
+for x in $I686_PATH $AMD64_PATH; do
+  echo [`basename $x`]
+  echo "description=Linux buildbot environment"
+  echo "directory=$x"
+  echo "users=$login"
+  echo "root-groups=root"
+  echo
+done
diff --git a/build_files/buildbot/config/user-config-glibc211-i686.py b/build_files/buildbot/config/user-config-glibc211-i686.py
new file mode 100644
index 0000000..e665657
--- /dev/null
+++ b/build_files/buildbot/config/user-config-glibc211-i686.py
@@ -0,0 +1,164 @@
+BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
+BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/lib/python-3.3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = True
+WITH_BF_STATICOPENCOLLADA=True
+BF_OPENCOLLADA = '/opt/lib/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB_STATIC = '${BF_OPENCOLLADA}/lib/libOpenCOLLADAStreamWriter.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADASaxFrameworkLoader.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADAFramework.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADABaseUtils.a ' + \
+    '${BF_OPENCOLLADA}/lib/libGeneratedSaxParser.a '  + \
+    '${BF_OPENCOLLADA}/lib/libUTF.a ${BF_OPENCOLLADA}/lib/libMathMLSolver.a ' + \
+    '${BF_OPENCOLLADA}/lib/libbuffer.a ${BF_OPENCOLLADA}/lib/libftoa.a ' + \
+    '/usr/lib/libxml2.a /usr/lib/libexpat.a /usr/lib/libpcre.a'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib64'
+BF_PCRE_LIB = ''
+BF_EXPAT_LIB = ''
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/opt/lib/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavfilter.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
+    '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
+    '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
+    '/usr/lib/liborc-0.4.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.7.1/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL = '/opt/lib/openal'
+BF_OPENAL_LIB_STATIC = '/opt/lib/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+
+WITH_BF_FREETYPE_STATIC = False
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+WITH_BF_STATICJPEG = True
+BF_JPEG_LIB_STATIC= '${BF_JPEG}/lib/libjpeg.a'
+
+WITH_BF_PNG = True
+WITH_BF_STATICPNG = True
+BF_PNG_LIB_STATIC = '${BF_PNG}/lib/libpng.a'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = True
+
+WITH_BF_OPENMP = True
+WITH_BF_STATICOPENMP = True
+BF_OPENMP_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.7/libgomp.a'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Blender player (would be enabled in it's own config)
+WITH_BF_PLAYER = False
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/opt/lib/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/opt/lib/libspnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
+
+# FFT
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+
+# JACK
+WITH_BF_JACK = True
+WITH_BF_STATICJACK = True
+BF_JACK_LIB_STATIC = '${BF_ZLIB}/lib/libjack.a'
+
+# Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = True
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+
+WITH_BF_OIIO = True
+WITH_BF_STATICOIIO = True
+BF_OIIO = '/opt/lib/oiio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = False
+BF_OSL = '/opt/lib/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+# note oslexec would passed via program linkflags, which is needed to
+# make llvm happy with osl_allocate_closure_component
+BF_OSL_LIB = 'oslcomp oslexec oslquery'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+WITH_BF_STATICLLVM = False
+BF_LLVM = '/opt/lib/llvm-3.1'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/lib/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/lib/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
+    '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
+    ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# Ocean Simulation
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-lrt']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc211-x86_64.py b/build_files/buildbot/config/user-config-glibc211-x86_64.py
new file mode 100644
index 0000000..420d9ed
--- /dev/null
+++ b/build_files/buildbot/config/user-config-glibc211-x86_64.py
@@ -0,0 +1,164 @@
+BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64'
+BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/lib/python-3.3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = True
+WITH_BF_STATICOPENCOLLADA=True
+BF_OPENCOLLADA = '/opt/lib/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB_STATIC = '${BF_OPENCOLLADA}/lib/libOpenCOLLADAStreamWriter.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADASaxFrameworkLoader.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADAFramework.a ' + \
+    '${BF_OPENCOLLADA}/lib/libOpenCOLLADABaseUtils.a ' + \
+    '${BF_OPENCOLLADA}/lib/libGeneratedSaxParser.a '  + \
+    '${BF_OPENCOLLADA}/lib/libUTF.a ${BF_OPENCOLLADA}/lib/libMathMLSolver.a ' + \
+    '${BF_OPENCOLLADA}/lib/libbuffer.a ${BF_OPENCOLLADA}/lib/libftoa.a ' + \
+    '/usr/lib/libxml2.a /usr/lib/libexpat.a /usr/lib/libpcre.a'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib64'
+BF_PCRE_LIB = ''
+BF_EXPAT_LIB = ''
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/opt/lib/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavfilter.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
+    '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
+    '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
+    '/usr/lib/liborc-0.4.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.7.1/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL = '/opt/lib/openal'
+BF_OPENAL_LIB_STATIC = '/opt/lib/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+
+WITH_BF_FREETYPE_STATIC = False
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+WITH_BF_STATICJPEG = True
+BF_JPEG_LIB_STATIC= '${BF_JPEG}/lib/libjpeg.a'
+
+WITH_BF_PNG = True
+WITH_BF_STATICPNG = True
+BF_PNG_LIB_STATIC = '${BF_PNG}/lib/libpng.a'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = True
+
+WITH_BF_OPENMP = True
+WITH_BF_STATICOPENMP = True
+BF_OPENMP_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.a'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Blender player (would be enabled in it's own config)
+WITH_BF_PLAYER = False
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/opt/lib/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/opt/lib/libspnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
+
+# FFT
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+
+# JACK
+WITH_BF_JACK = True
+WITH_BF_STATICJACK = True
+BF_JACK_LIB_STATIC = '${BF_ZLIB}/lib/libjack.a'
+
+# Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = True
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+
+WITH_BF_OIIO = True
+WITH_BF_STATICOIIO = True
+BF_OIIO = '/opt/lib/oiio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = False
+BF_OSL = '/opt/lib/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+# note oslexec would passed via program linkflags, which is needed to
+# make llvm happy with osl_allocate_closure_component
+BF_OSL_LIB = 'oslcomp oslexec oslquery'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+WITH_BF_STATICLLVM = False
+BF_LLVM = '/opt/lib/llvm-3.1'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/lib/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/lib/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
+    '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
+    ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# Ocean Simulation
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-lrt']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc27-i686.py b/build_files/buildbot/config/user-config-glibc27-i686.py
new file mode 100644
index 0000000..b36196f
--- /dev/null
+++ b/build_files/buildbot/config/user-config-glibc27-i686.py
@@ -0,0 +1,149 @@
+BF_BUILDDIR = '../blender-build/linux-glibc27-i686'
+BF_INSTALLDIR = '../blender-install/linux-glibc27-i686'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/python3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = True
+BF_OPENCOLLADA = '/opt/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver buffer ftoa libxml2-static libexpat-static libpcre-static'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib32'
+BF_PCRE_LIB = ''
+BF_EXPAT_LIB = ''
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libfaad.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.3.4/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+BF_FREETYPE_LIB_STATIC = True
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+BF_JPEG_LIB = 'libjpeg'
+BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib32'
+
+WITH_BF_PNG = True
+BF_PNG_LIB = 'libpng'
+BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = True
+
+WITH_BF_OPENMP = True
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Blender player (would be enabled in it's own config)
+WITH_BF_PLAYER = False
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/home/sources/staticlibs/spnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib32'
+
+# FFT
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+
+# JACK
+WITH_BF_JACK = True
+
+# Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = True
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+
+WITH_BF_OIIO = True
+WITH_BF_STATICOIIO = True
+BF_OIIO = '/opt/oiio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = False
+BF_OSL = '/opt/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+# note oslexec would passed via program linkflags, which is needed to
+# make llvm happy with osl_allocate_closure_component
+BF_OSL_LIB = 'oslcomp oslexec oslquery'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+WITH_BF_STATICLLVM = False
+BF_LLVM = '/opt/llvm-3.1'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# Ocean Simulation
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-DNDEBUG', '-O2']  # C & C++
+PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc27-x86_64.py b/build_files/buildbot/config/user-config-glibc27-x86_64.py
new file mode 100644
index 0000000..7359e15
--- /dev/null
+++ b/build_files/buildbot/config/user-config-glibc27-x86_64.py
@@ -0,0 +1,149 @@
+BF_BUILDDIR = '../blender-build/linux-glibc27-x86_64'
+BF_INSTALLDIR = '../blender-install/linux-glibc27-x86_64'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/python3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = True
+BF_OPENCOLLADA = '/opt/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver buffer ftoa libxml2-static libexpat-static libpcre-static'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib64'
+BF_PCRE_LIB = ''
+BF_EXPAT_LIB = ''
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libfaad.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.3.4/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+BF_FREETYPE_LIB_STATIC = True
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+BF_JPEG_LIB = 'libjpeg'
+BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64'
+
+WITH_BF_PNG = True
+BF_PNG_LIB = 'libpng'
+BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = True
+
+WITH_BF_OPENMP = True
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Blender player (would be enabled in it's own config)
+WITH_BF_PLAYER = False
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/home/sources/staticlibs/spnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib64'
+
+# FFT
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+
+# JACK
+WITH_BF_JACK = True
+
+# Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = True
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+
+WITH_BF_OIIO = True
+WITH_BF_STATICOIIO = True
+BF_OIIO = '/opt/oiio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = False
+BF_OSL = '/opt/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+# note oslexec would passed via program linkflags, which is needed to
+# make llvm happy with osl_allocate_closure_component
+BF_OSL_LIB = 'oslcomp oslexec oslquery'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+WITH_BF_STATICLLVM = False
+BF_LLVM = '/opt/llvm-3.1'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# Ocean Simulation
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py
deleted file mode 100644
index 9d27fbe..0000000
--- a/build_files/buildbot/config/user-config-i686.py
+++ /dev/null
@@ -1,130 +0,0 @@
-BF_BUILDDIR = '../blender-build/linux-glibc27-i686'
-BF_INSTALLDIR = '../blender-install/linux-glibc27-i686'
-BF_NUMJOBS = 2
-
-# Python configuration
-BF_PYTHON_VERSION = '3.2'
-BF_PYTHON_ABI_FLAGS = 'mu'
-BF_PYTHON = '/opt/python3'
-
-WITH_BF_STATICPYTHON = True
-
-# OpenCollada configuration
-WITH_BF_COLLADA = True
-BF_OPENCOLLADA = '/opt/opencollada'
-BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
-BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver buffer ftoa libxml2-static libexpat-static libpcre-static'
-BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib32'
-BF_PCRE_LIB = ''
-BF_EXPAT_LIB = ''
-
-# FFMPEG configuration
-WITH_BF_FFMPEG = True
-WITH_BF_STATICFFMPEG = True
-
-BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
-BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libfaad.a'
-
-# Don't depend on system's libstdc++
-WITH_BF_STATICCXX = True
-BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.3.4/libstdc++.a'
-
-WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = True
-BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
-
-WITH_BF_GETTEXT_STATIC = True
-BF_FREETYPE_LIB_STATIC = True
-
-WITH_BF_OPENEXR = True
-WITH_BF_STATICOPENEXR = True
-
-WITH_BF_TIFF = True
-WITH_BF_STATICTIFF = True
-BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
-
-WITH_BF_JPEG = True
-BF_JPEG_LIB = 'libjpeg'
-BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib32'
-
-WITH_BF_PNG = True
-BF_PNG_LIB = 'libpng'
-BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
-
-WITH_BF_STATICLIBSAMPLERATE = True
-
-WITH_BF_ZLIB = True
-WITH_BF_STATICZLIB = True
-BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
-
-WITH_BF_SDL = True
-WITH_BF_OGG = True
-
-WITH_BF_OPENMP = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_BULLET = True
-
-# Blender player (would be enabled in it's own config)
-WITH_BF_PLAYER = False
-
-# Use jemalloc memory manager
-WITH_BF_JEMALLOC = True
-WITH_BF_STATICJEMALLOC = True
-BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
-BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
-
-# Use 3d mouse library
-WITH_BF_3DMOUSE = True
-WITH_BF_STATIC3DMOUSE = True
-BF_3DMOUSE = '/home/sources/staticlibs/spnav'
-BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib32'
-
-# FFT
-WITH_BF_FFTW3 = True
-WITH_BF_STATICFFTW3 = True
-
-# JACK
-WITH_BF_JACK = True
-
-# Cycles
-WITH_BF_CYCLES = True
-WITH_BF_CYCLES_CUDA_BINARIES = True
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
-
-WITH_BF_OIIO = True
-WITH_BF_STATICOIIO = True
-BF_OIIO = '/opt/oiio'
-BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
-BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
-
-# Color management
-WITH_BF_OCIO = True
-WITH_BF_STATICOCIO = True
-BF_OCIO = '/opt/ocio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-WITH_BF_BOOST = True
-WITH_BF_STATICBOOST = True
-BF_BOOST = '/opt/boost'
-BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
-BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
-
-# Ocean Simulation
-WITH_BF_OCEANSIM = True
-
-# Compilation and optimization
-BF_DEBUG = False
-REL_CCFLAGS = ['-O2']  # C & C++
-PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
diff --git a/build_files/buildbot/config/user-config-player-glibc211-i686.py b/build_files/buildbot/config/user-config-player-glibc211-i686.py
new file mode 100644
index 0000000..96f2012
--- /dev/null
+++ b/build_files/buildbot/config/user-config-player-glibc211-i686.py
@@ -0,0 +1,121 @@
+BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
+BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/lib/python-3.3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = False
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/opt/lib/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavfilter.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
+    '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
+    '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
+    '/usr/lib/liborc-0.4.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.7.1/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL = '/opt/lib/openal'
+BF_OPENAL_LIB_STATIC = '/opt/lib/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+
+WITH_BF_FREETYPE_STATIC = False
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+WITH_BF_STATICJPEG = True
+BF_JPEG_LIB_STATIC= '${BF_JPEG}/lib/libjpeg.a'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_PNG = True
+WITH_BF_STATICPNG = True
+BF_PNG_LIB_STATIC = '${BF_PNG}/lib/libpng.a'
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = False
+
+WITH_BF_OPENMP = True
+WITH_BF_STATICOPENMP = True
+BF_OPENMP_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.7/libgomp.a'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Do not build blender when building blenderplayer
+WITH_BF_NOBLENDER = True
+WITH_BF_PLAYER = True
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/opt/lib/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/opt/lib/libspnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/lib/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/lib/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
+    '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
+    ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# JACK
+WITH_BF_JACK = True
+WITH_BF_STATICJACK = True
+BF_JACK_LIB_STATIC = '${BF_ZLIB}/lib/libjack.a'
+
+# Motion Tracking
+WITH_BF_LIBMV = False
+
+# Ocean Simulation
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-lrt']
diff --git a/build_files/buildbot/config/user-config-player-glibc211-x86_64.py b/build_files/buildbot/config/user-config-player-glibc211-x86_64.py
new file mode 100644
index 0000000..75979d0
--- /dev/null
+++ b/build_files/buildbot/config/user-config-player-glibc211-x86_64.py
@@ -0,0 +1,121 @@
+BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64'
+BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/lib/python-3.3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = False
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/opt/lib/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavfilter.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
+    '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
+    '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
+    '/usr/lib/liborc-0.4.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.7.1/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL = '/opt/lib/openal'
+BF_OPENAL_LIB_STATIC = '/opt/lib/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+
+WITH_BF_FREETYPE_STATIC = False
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = True
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+WITH_BF_STATICJPEG = True
+BF_JPEG_LIB_STATIC= '${BF_JPEG}/lib/libjpeg.a'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_PNG = True
+WITH_BF_STATICPNG = True
+BF_PNG_LIB_STATIC = '${BF_PNG}/lib/libpng.a'
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = False
+
+WITH_BF_OPENMP = True
+WITH_BF_STATICOPENMP = True
+BF_OPENMP_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.a'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Do not build blender when building blenderplayer
+WITH_BF_NOBLENDER = True
+WITH_BF_PLAYER = True
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/opt/lib/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/opt/lib/libspnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/lib/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/lib/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
+    '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
+    ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# JACK
+WITH_BF_JACK = True
+WITH_BF_STATICJACK = True
+BF_JACK_LIB_STATIC = '${BF_ZLIB}/lib/libjack.a'
+
+# Motion Tracking
+WITH_BF_LIBMV = False
+
+# Ocean Simulation
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-lrt']
diff --git a/build_files/buildbot/config/user-config-player-glibc27-i686.py b/build_files/buildbot/config/user-config-player-glibc27-i686.py
new file mode 100644
index 0000000..82b105c
--- /dev/null
+++ b/build_files/buildbot/config/user-config-player-glibc27-i686.py
@@ -0,0 +1,114 @@
+BF_BUILDDIR = '../blender-build/linux-glibc27-i686'
+BF_INSTALLDIR = '../blender-install/linux-glibc27-i686'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/python3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = False
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libfaad.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.3.4/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+BF_FREETYPE_LIB_STATIC = True
+
+WITH_BF_OPENEXR = False
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = False
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+BF_JPEG_LIB = 'libjpeg'
+BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib32'
+
+WITH_BF_PNG = True
+BF_PNG_LIB = 'libpng'
+BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = False
+
+WITH_BF_OPENMP = True
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Do not build blender when building blenderplayer
+WITH_BF_NOBLENDER = True
+WITH_BF_PLAYER = True
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/home/sources/staticlibs/spnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib32'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# JACK
+WITH_BF_JACK = True
+
+# Motion Tracking
+WITH_BF_LIBMV = False
+
+# Ocean Simulation
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2']  # C & C++
+PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
diff --git a/build_files/buildbot/config/user-config-player-glibc27-x86_64.py b/build_files/buildbot/config/user-config-player-glibc27-x86_64.py
new file mode 100644
index 0000000..1e6aa4a
--- /dev/null
+++ b/build_files/buildbot/config/user-config-player-glibc27-x86_64.py
@@ -0,0 +1,114 @@
+BF_BUILDDIR = '../blender-build/linux-glibc27-x86_64'
+BF_INSTALLDIR = '../blender-install/linux-glibc27-x86_64'
+BF_NUMJOBS = 2
+
+# Python configuration
+BF_PYTHON_VERSION = '3.3'
+BF_PYTHON_ABI_FLAGS = 'm'
+BF_PYTHON = '/opt/python3'
+
+WITH_BF_STATICPYTHON = True
+
+# OpenCollada configuration
+WITH_BF_COLLADA = False
+
+# FFMPEG configuration
+WITH_BF_FFMPEG = True
+WITH_BF_STATICFFMPEG = True
+
+BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
+BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libfaad.a'
+
+# Don't depend on system's libstdc++
+WITH_BF_STATICCXX = True
+BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.3.4/libstdc++.a'
+
+WITH_BF_OPENAL = True
+WITH_BF_STATICOPENAL = True
+BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
+
+WITH_BF_GETTEXT_STATIC = True
+BF_FREETYPE_LIB_STATIC = True
+
+WITH_BF_OPENEXR = False
+WITH_BF_STATICOPENEXR = True
+
+WITH_BF_TIFF = False
+WITH_BF_STATICTIFF = True
+BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
+
+WITH_BF_JPEG = True
+BF_JPEG_LIB = 'libjpeg'
+BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64'
+
+WITH_BF_STATICLIBSAMPLERATE = True
+
+WITH_BF_PNG = True
+BF_PNG_LIB = 'libpng'
+BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
+
+WITH_BF_ZLIB = True
+WITH_BF_STATICZLIB = True
+BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
+
+WITH_BF_SDL = True
+WITH_BF_OGG = False
+
+WITH_BF_OPENMP = True
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_BULLET = True
+
+# Do not build blender when building blenderplayer
+WITH_BF_NOBLENDER = True
+WITH_BF_PLAYER = True
+
+# Use jemalloc memory manager
+WITH_BF_JEMALLOC = True
+WITH_BF_STATICJEMALLOC = True
+BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
+BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
+
+# Use 3d mouse library
+WITH_BF_3DMOUSE = True
+WITH_BF_STATIC3DMOUSE = True
+BF_3DMOUSE = '/home/sources/staticlibs/spnav'
+BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib64'
+
+# Color management
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = True
+BF_OCIO = '/opt/ocio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
+WITH_BF_BOOST = True
+WITH_BF_STATICBOOST = True
+BF_BOOST = '/opt/boost'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
+
+# JACK
+WITH_BF_JACK = True
+
+# Motion Tracking
+WITH_BF_LIBMV = False
+
+# Ocean Simulation
+WITH_BF_FFTW3 = True
+WITH_BF_STATICFFTW3 = True
+WITH_BF_OCEANSIM = True
+
+# Compilation and optimization
+BF_DEBUG = False
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2']  # C & C++
+PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py
deleted file mode 100644
index e23fc70..0000000
--- a/build_files/buildbot/config/user-config-player-i686.py
+++ /dev/null
@@ -1,107 +0,0 @@
-BF_BUILDDIR = '../blender-build/linux-glibc27-i686'
-BF_INSTALLDIR = '../blender-install/linux-glibc27-i686'
-BF_NUMJOBS = 2
-
-# Python configuration
-BF_PYTHON_VERSION = '3.2'
-BF_PYTHON_ABI_FLAGS = 'mu'
-BF_PYTHON = '/opt/python3'
-
-WITH_BF_STATICPYTHON = True
-
-# OpenCollada configuration
-WITH_BF_COLLADA = False
-
-# FFMPEG configuration
-WITH_BF_FFMPEG = True
-WITH_BF_STATICFFMPEG = True
-
-BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
-BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libfaad.a'
-
-# Don't depend on system's libstdc++
-WITH_BF_STATICCXX = True
-BF_CXX_LIB_STATIC = '/usr/lib/gcc/i486-linux-gnu/4.3.4/libstdc++.a'
-
-WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = True
-BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
-
-WITH_BF_GETTEXT_STATIC = True
-BF_FREETYPE_LIB_STATIC = True
-
-WITH_BF_OPENEXR = False
-WITH_BF_STATICOPENEXR = True
-
-WITH_BF_TIFF = False
-WITH_BF_STATICTIFF = True
-BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
-
-WITH_BF_JPEG = True
-BF_JPEG_LIB = 'libjpeg'
-BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib32'
-
-WITH_BF_PNG = True
-BF_PNG_LIB = 'libpng'
-BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
-
-WITH_BF_STATICLIBSAMPLERATE = True
-
-WITH_BF_ZLIB = True
-WITH_BF_STATICZLIB = True
-BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
-
-WITH_BF_SDL = True
-WITH_BF_OGG = False
-
-WITH_BF_OPENMP = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_BULLET = True
-
-# Do not build blender when building blenderplayer
-WITH_BF_NOBLENDER = True
-WITH_BF_PLAYER = True
-
-# Use jemalloc memory manager
-WITH_BF_JEMALLOC = True
-WITH_BF_STATICJEMALLOC = True
-BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
-BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
-
-# Use 3d mouse library
-WITH_BF_3DMOUSE = True
-WITH_BF_STATIC3DMOUSE = True
-BF_3DMOUSE = '/home/sources/staticlibs/spnav'
-BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib32'
-
-# Color management
-WITH_BF_OCIO = True
-WITH_BF_STATICOCIO = True
-BF_OCIO = '/opt/ocio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-# JACK
-WITH_BF_JACK = True
-
-# Motion Tracking
-WITH_BF_LIBMV = False
-
-# Ocean Simulation
-WITH_BF_FFTW3 = True
-WITH_BF_STATICFFTW3 = True
-WITH_BF_OCEANSIM = True
-
-# Compilation and optimization
-BF_DEBUG = False
-REL_CCFLAGS = ['-O2']  # C & C++
-PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py
deleted file mode 100644
index 3c09603..0000000
--- a/build_files/buildbot/config/user-config-player-x86_64.py
+++ /dev/null
@@ -1,107 +0,0 @@
-BF_BUILDDIR = '../blender-build/linux-glibc27-x86_64'
-BF_INSTALLDIR = '../blender-install/linux-glibc27-x86_64'
-BF_NUMJOBS = 2
-
-# Python configuration
-BF_PYTHON_VERSION = '3.2'
-BF_PYTHON_ABI_FLAGS = 'mu'
-BF_PYTHON = '/opt/python3'
-
-WITH_BF_STATICPYTHON = True
-
-# OpenCollada configuration
-WITH_BF_COLLADA = False
-
-# FFMPEG configuration
-WITH_BF_FFMPEG = True
-WITH_BF_STATICFFMPEG = True
-
-BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
-BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libfaad.a'
-
-# Don't depend on system's libstdc++
-WITH_BF_STATICCXX = True
-BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.3.4/libstdc++.a'
-
-WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = True
-BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
-
-WITH_BF_GETTEXT_STATIC = True
-BF_FREETYPE_LIB_STATIC = True
-
-WITH_BF_OPENEXR = False
-WITH_BF_STATICOPENEXR = True
-
-WITH_BF_TIFF = False
-WITH_BF_STATICTIFF = True
-BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
-
-WITH_BF_JPEG = True
-BF_JPEG_LIB = 'libjpeg'
-BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64'
-
-WITH_BF_STATICLIBSAMPLERATE = True
-
-WITH_BF_PNG = True
-BF_PNG_LIB = 'libpng'
-BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
-
-WITH_BF_ZLIB = True
-WITH_BF_STATICZLIB = True
-BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
-
-WITH_BF_SDL = True
-WITH_BF_OGG = False
-
-WITH_BF_OPENMP = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_BULLET = True
-
-# Do not build blender when building blenderplayer
-WITH_BF_NOBLENDER = True
-WITH_BF_PLAYER = True
-
-# Use jemalloc memory manager
-WITH_BF_JEMALLOC = True
-WITH_BF_STATICJEMALLOC = True
-BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
-BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
-
-# Use 3d mouse library
-WITH_BF_3DMOUSE = True
-WITH_BF_STATIC3DMOUSE = True
-BF_3DMOUSE = '/home/sources/staticlibs/spnav'
-BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib64'
-
-# Color management
-WITH_BF_OCIO = True
-WITH_BF_STATICOCIO = True
-BF_OCIO = '/opt/ocio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-# JACK
-WITH_BF_JACK = True
-
-# Motion Tracking
-WITH_BF_LIBMV = False
-
-# Ocean Simulation
-WITH_BF_FFTW3 = True
-WITH_BF_STATICFFTW3 = True
-WITH_BF_OCEANSIM = True
-
-# Compilation and optimization
-BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
-PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py
deleted file mode 100644
index 070e62b..0000000
--- a/build_files/buildbot/config/user-config-x86_64.py
+++ /dev/null
@@ -1,130 +0,0 @@
-BF_BUILDDIR = '../blender-build/linux-glibc27-x86_64'
-BF_INSTALLDIR = '../blender-install/linux-glibc27-x86_64'
-BF_NUMJOBS = 2
-
-# Python configuration
-BF_PYTHON_VERSION = '3.2'
-BF_PYTHON_ABI_FLAGS = 'mu'
-BF_PYTHON = '/opt/python3'
-
-WITH_BF_STATICPYTHON = True
-
-# OpenCollada configuration
-WITH_BF_COLLADA = True
-BF_OPENCOLLADA = '/opt/opencollada'
-BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
-BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver buffer ftoa libxml2-static libexpat-static libpcre-static'
-BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib /home/sources/staticlibs/lib64'
-BF_PCRE_LIB = ''
-BF_EXPAT_LIB = ''
-
-# FFMPEG configuration
-WITH_BF_FFMPEG = True
-WITH_BF_STATICFFMPEG = True
-
-BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
-BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libfaad.a'
-
-# Don't depend on system's libstdc++
-WITH_BF_STATICCXX = True
-BF_CXX_LIB_STATIC = '/usr/lib/gcc/x86_64-linux-gnu/4.3.4/libstdc++.a'
-
-WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = True
-BF_OPENAL_LIB_STATIC = '/opt/openal/lib/libopenal.a'
-
-WITH_BF_GETTEXT_STATIC = True
-BF_FREETYPE_LIB_STATIC = True
-
-WITH_BF_OPENEXR = True
-WITH_BF_STATICOPENEXR = True
-
-WITH_BF_TIFF = True
-WITH_BF_STATICTIFF = True
-BF_TIFF_LIB_STATIC = '${BF_TIFF}/lib/libtiff.a'
-
-WITH_BF_JPEG = True
-BF_JPEG_LIB = 'libjpeg'
-BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64'
-
-WITH_BF_PNG = True
-BF_PNG_LIB = 'libpng'
-BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
-
-WITH_BF_STATICLIBSAMPLERATE = True
-
-WITH_BF_ZLIB = True
-WITH_BF_STATICZLIB = True
-BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
-
-WITH_BF_SDL = True
-WITH_BF_OGG = True
-
-WITH_BF_OPENMP = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_BULLET = True
-
-# Blender player (would be enabled in it's own config)
-WITH_BF_PLAYER = False
-
-# Use jemalloc memory manager
-WITH_BF_JEMALLOC = True
-WITH_BF_STATICJEMALLOC = True
-BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
-BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
-
-# Use 3d mouse library
-WITH_BF_3DMOUSE = True
-WITH_BF_STATIC3DMOUSE = True
-BF_3DMOUSE = '/home/sources/staticlibs/spnav'
-BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib64'
-
-# FFT
-WITH_BF_FFTW3 = True
-WITH_BF_STATICFFTW3 = True
-
-# JACK
-WITH_BF_JACK = True
-
-# Cycles
-WITH_BF_CYCLES = True
-WITH_BF_CYCLES_CUDA_BINARIES = True
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
-
-WITH_BF_OIIO = True
-WITH_BF_STATICOIIO = True
-BF_OIIO = '/opt/oiio'
-BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
-BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
-
-# Color management
-WITH_BF_OCIO = True
-WITH_BF_STATICOCIO = True
-BF_OCIO = '/opt/ocio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-WITH_BF_BOOST = True
-WITH_BF_STATICBOOST = True
-BF_BOOST = '/opt/boost'
-BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
-BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
-
-# Ocean Simulation
-WITH_BF_OCEANSIM = True
-
-# Compilation and optimization
-BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
-PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg
index 1bd4730..90f0c80 100644
--- a/build_files/buildbot/master.cfg
+++ b/build_files/buildbot/master.cfg
@@ -28,8 +28,8 @@ c['slavePortnum'] = 9989
 from buildbot.changes.svnpoller import SVNPoller
 
 c['change_source'] = SVNPoller(
-    'https://svn.blender.org/svnroot/bf-blender/trunk/',
-    pollinterval=1200)
+       'https://svn.blender.org/svnroot/bf-blender/trunk/',
+       pollinterval=1200)
 
 # BUILDERS
 #
@@ -53,7 +53,7 @@ c['builders'] = []
 buildernames = []
 
 
-def add_builder(c, name, libdir, factory, branch=''):
+def add_builder(c, name, libdir, factory, branch='', rsync=False):
     slavenames = []
 
     for slave in master_private.slaves:
@@ -61,7 +61,7 @@ def add_builder(c, name, libdir, factory, branch=''):
             slavenames.append(slave['name'])
 
     if len(slavenames) > 0:
-        f = factory(name, libdir, branch)
+        f = factory(name, libdir, branch, rsync)
         c['builders'].append(BuilderConfig(name=name, slavenames=slavenames, factory=f, category='blender'))
         buildernames.append(name)
 
@@ -74,18 +74,21 @@ def svn_step(branch=''):
     else:
         return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender')
 
+def lib_svn_step(dir):
+    return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
 
-def lib_svn_step(libdir):
-    return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + libdir, mode='update', defaultBranch='trunk', workdir='lib/' + libdir)
+def rsync_step(id, branch, rsync_script):
+    return ShellCommand(name='rsync', command=['python', rsync_script, id, branch], description='uploading', descriptionDone='uploaded', workdir='install')
 
 # generic builder
 
 
-def generic_builder(idname, libdir='', branch=''):
-    filename = 'buildbot_upload_' + idname + '.zip'
+def generic_builder(id, libdir='', branch='', rsync=False):
+    filename = 'uploaded/buildbot_upload_' + id + '.zip'
     compile_script = '../blender/build_files/buildbot/slave_compile.py'
     test_script = '../blender/build_files/buildbot/slave_test.py'
     pack_script = '../blender/build_files/buildbot/slave_pack.py'
+    rsync_script = '../blender/build_files/buildbot/slave_rsync.py'
     unpack_script = 'master_unpack.py'
 
     f = BuildFactory()
@@ -93,10 +96,12 @@ def generic_builder(idname, libdir='', branch=''):
     if libdir != '':
         f.addStep(lib_svn_step(libdir))
 
-    f.addStep(Compile(command=['python', compile_script, idname]))
-    f.addStep(Test(command=['python', test_script, idname]))
-    f.addStep(ShellCommand(name='package', command=['python', pack_script, idname, branch], description='packaging', descriptionDone='packaged'))
-    if 'cmake' in idname:
+    f.addStep(Compile(command=['python', compile_script, id], timeout=3600))
+    f.addStep(Test(command=['python', test_script, id]))
+    f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged'))
+    if rsync:
+        f.addStep(rsync_step(id, branch, rsync_script))
+    elif id.find('cmake') != -1:
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
     else:
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
@@ -105,20 +110,23 @@ def generic_builder(idname, libdir='', branch=''):
 
 # builders
 
-add_builder(c, 'mac_x86_64_scons', 'darwin-9.x.universal', generic_builder)
-add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad')
+add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder, '', True)
+add_builder(c, 'mac_x86_64_10_5_scons', '', generic_builder, '', True)
+#add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad')
 add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder)
 add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder)
 #add_builder(c, 'linux_x86_64_cmake', '', generic_builder)
-add_builder(c, 'linux_i386_scons', '', generic_builder)
-add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad')
-add_builder(c, 'linux_x86_64_scons', '', generic_builder)
-add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad')
+add_builder(c, 'linux_glibc27_i386_scons', '', generic_builder)
+add_builder(c, 'linux_glibc211_i386_scons', '', generic_builder)
+#add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad')
+add_builder(c, 'linux_glibc27_x86_64_scons', '', generic_builder)
+add_builder(c, 'linux_glibc211_x86_64_scons', '', generic_builder)
+#add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad')
 add_builder(c, 'win32_scons', 'windows', generic_builder)
-add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
+#add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
 add_builder(c, 'win64_scons', 'win64', generic_builder)
-add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder)
 add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder)
+add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder)
 #add_builder(c, 'freebsd_i386_cmake', '', generic_builder)
 #add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder)
 
@@ -137,11 +145,19 @@ c['schedulers'] = []
 #                        builderNames=buildernames,
 #                        periodicBuildTimer=24*60*60))
 
-c['schedulers'].append(timed.Nightly(
-    name='nightly',
-    builderNames=buildernames,
-    hour=3,
-    minute=0))
+schedule_cycle = 4
+
+for i in range(0, schedule_cycle):
+    names = []
+    for j in range(0, len(buildernames)):
+        if j % schedule_cycle == i:
+            names += [buildernames[j]]
+
+    print(names)
+    c['schedulers'].append(timed.Nightly(name='nightly' + str(i),
+        builderNames=names,
+        hour=3+i,
+        minute=0))
 
 # STATUS TARGETS
 #
@@ -161,7 +177,7 @@ authz_cfg = authz.Authz(
     forceBuild=True,  # use this to test your slave once it is set up
     forceAllBuilds=False,
     pingBuilder=False,
-    stopBuild=False,
+    stopBuild=True,
     stopAllBuilds=False,
     cancelPendingBuild=True,
 )
diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index eafdf08..bedada9 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -75,12 +75,18 @@ else:
         config_dir = os.path.join(buildbot_dir, 'config')
 
         configs = []
-        if builder.endswith('linux_x86_64_scons'):
-            configs = ['user-config-player-x86_64.py',
-                       'user-config-x86_64.py']
-        elif builder.endswith('linux_i386_scons'):
-            configs = ['user-config-player-i686.py',
-                       'user-config-i686.py']
+        if builder.endswith('linux_glibc27_x86_64_scons'):
+            configs = ['user-config-player-glibc27-x86_64.py',
+                       'user-config-glibc27-x86_64.py']
+        elif builder.endswith('linux_glibc27_i386_scons'):
+            configs = ['user-config-player-glibc27-i686.py',
+                       'user-config-glibc27-i686.py']
+        if builder.endswith('linux_glibc211_x86_64_scons'):
+            configs = ['user-config-player-glibc211-x86_64.py',
+                       'user-config-glibc211-x86_64.py']
+        elif builder.endswith('linux_glibc211_i386_scons'):
+            configs = ['user-config-player-glibc211-i686.py',
+                       'user-config-glibc211-i686.py']
 
         for config in configs:
             config_fpath = os.path.join(config_dir, config)
diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py
index eafb25a..b7775ef 100644
--- a/build_files/buildbot/slave_pack.py
+++ b/build_files/buildbot/slave_pack.py
@@ -57,11 +57,17 @@ if builder.find('scons') != -1:
         config = None
         bits = None
 
-        if builder.endswith('linux_x86_64_scons'):
-            config = 'user-config-x86_64.py'
+        if builder.endswith('linux_glibc27_x86_64_scons'):
+            config = 'user-config-glibc27-x86_64.py'
             bits = 64
-        elif builder.endswith('linux_i386_scons'):
-            config = 'user-config-i686.py'
+        elif builder.endswith('linux_glibc27_i386_scons'):
+            config = 'user-config-glibc27-i686.py'
+            bits = 32
+        if builder.endswith('linux_glibc211_x86_64_scons'):
+            config = 'user-config-glibc211-x86_64.py'
+            bits = 64
+        elif builder.endswith('linux_glibc211_i386_scons'):
+            config = 'user-config-glibc211-i686.py'
             bits = 32
 
         if config is not None:
diff --git a/build_files/buildbot/slave_rsync.py b/build_files/buildbot/slave_rsync.py
new file mode 100644
index 0000000..aea1b65
--- /dev/null
+++ b/build_files/buildbot/slave_rsync.py
@@ -0,0 +1,45 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# Runs on buildbot slave, rsync zip directly to buildbot server rather
+# than using upload which is much slower
+
+import os
+import sys
+
+# get builder name
+if len(sys.argv) < 2:
+    sys.stderr.write("Not enough arguments, expecting builder name\n")
+    sys.exit(1)
+
+builder = sys.argv[1]
+
+# rsync, this assumes ssh keys are setup so no password is needed
+local_zip = "buildbot_upload.zip"
+remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/"
+remote_zip = remote_folder + "buildbot_upload_" + builder + ".zip"
+command = "rsync -avz %s %s" % (local_zip, remote_zip)
+
+print(command)
+
+ret = os.system(command)
+sys.exit(ret)
+
+
diff --git a/build_files/cmake/Modules/FindIcuLinux.cmake b/build_files/cmake/Modules/FindIcuLinux.cmake
new file mode 100644
index 0000000..e0e5873
--- /dev/null
+++ b/build_files/cmake/Modules/FindIcuLinux.cmake
@@ -0,0 +1,146 @@
+# - Find static icu libraries
+# Find the native static icu libraries (needed for static boost_locale :/ ).
+# This module defines
+#  ICU_LIBRARIES, libraries to link against to use icu.
+#  ICU_ROOT_DIR, The base directory to search for icu.
+#                    This can also be an environment variable.
+#  ICU_FOUND, If false, do not try to use icu.
+#
+# also defined, but not for general use are
+#  ICU_LIBRARY_xxx, where to find the icu libraries.
+
+#=============================================================================
+# Copyright 2012 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If ICU_ROOT_DIR was defined in the environment, use it.
+IF(NOT ICU_ROOT_DIR AND NOT $ENV{ICU_ROOT_DIR} STREQUAL "")
+  SET(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
+ENDIF()
+
+if(Boost_USE_STATIC_LIBS)
+  set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+  set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+endif()
+
+SET(_icu_SEARCH_DIRS
+  ${ICU_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+)
+
+# We don't need includes, only libs to link against...
+#FIND_PATH(ICU_INCLUDE_DIR
+#  NAMES
+#    utf.h
+#  HINTS
+#    ${_icu_SEARCH_DIRS}
+#  PATH_SUFFIXES
+#    include/unicode
+#)
+
+FIND_LIBRARY(ICU_LIBRARY_DATA
+  NAMES
+    icudata
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_I18N
+  NAMES
+    icui18n
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_IO
+  NAMES
+    icuio
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_LE
+  NAMES
+    icule
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_LX
+  NAMES
+    iculx
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_TU
+  NAMES
+    icutu
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_UC
+  NAMES
+    icuuc
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+# Restore the original find library ordering
+if(Boost_USE_STATIC_LIBS)
+  set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
+    ICU_LIBRARY_DATA
+    ICU_LIBRARY_I18N
+    ICU_LIBRARY_IO
+    ICU_LIBRARY_LE
+    ICU_LIBRARY_LX
+    ICU_LIBRARY_TU
+    ICU_LIBRARY_UC
+)
+
+IF(ICU_FOUND)
+  SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
+  SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
+ENDIF(ICU_FOUND)
+
+MARK_AS_ADVANCED(
+  ICU_INCLUDE_DIR
+  ICU_LIBRARY_DATA
+  ICU_LIBRARY_I18N
+  ICU_LIBRARY_IO
+  ICU_LIBRARY_LE
+  ICU_LIBRARY_LX
+  ICU_LIBRARY_TU
+  ICU_LIBRARY_UC
+)
diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake
index 79bc012..e152f0f 100644
--- a/build_files/cmake/Modules/FindOpenColorIO.cmake
+++ b/build_files/cmake/Modules/FindOpenColorIO.cmake
@@ -39,6 +39,7 @@ SET(_opencolorio_SEARCH_DIRS
   /sw # Fink
   /opt/local # DarwinPorts
   /opt/csw # Blastwave
+  /opt/lib/ocio
 )
 
 FIND_PATH(OPENCOLORIO_INCLUDE_DIR
diff --git a/build_files/cmake/Modules/FindOpenImageIO.cmake b/build_files/cmake/Modules/FindOpenImageIO.cmake
index 7512b93..9b8c8b0 100644
--- a/build_files/cmake/Modules/FindOpenImageIO.cmake
+++ b/build_files/cmake/Modules/FindOpenImageIO.cmake
@@ -33,6 +33,7 @@ SET(_openimageio_SEARCH_DIRS
   /sw # Fink
   /opt/local # DarwinPorts
   /opt/csw # Blastwave
+  /opt/lib/oiio
 )
 
 FIND_PATH(OPENIMAGEIO_INCLUDE_DIR
diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
index 448e587..1dffd54 100644
--- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake
+++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
@@ -9,6 +9,7 @@
 # This module defines
 #  PYTHON_VERSION
 #  PYTHON_INCLUDE_DIRS
+#  PYTHON_INCLUDE_CONFIG_DIRS
 #  PYTHON_LIBRARIES
 #  PYTHON_LIBPATH, Used for installation
 #  PYTHON_LINKFLAGS
@@ -34,7 +35,7 @@ IF(NOT PYTHON_ROOT_DIR AND NOT $ENV{PYTHON_ROOT_DIR} STREQUAL "")
   SET(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR})
 ENDIF()
 
-SET(PYTHON_VERSION 3.2 CACHE STRING "Python Version (major and minor only)")
+SET(PYTHON_VERSION 3.3 CACHE STRING "Python Version (major and minor only)")
 MARK_AS_ADVANCED(PYTHON_VERSION)
 
 
@@ -46,17 +47,25 @@ MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
 
 # if the user passes these defines as args, we dont want to overwrite
 SET(_IS_INC_DEF OFF)
+SET(_IS_INC_CONF_DEF OFF)
 SET(_IS_LIB_DEF OFF)
+SET(_IS_LIB_PATH_DEF OFF)
 IF(DEFINED PYTHON_INCLUDE_DIR)
   SET(_IS_INC_DEF ON)
 ENDIF()
+IF(DEFINED PYTHON_INCLUDE_CONFIG_DIR)
+  SET(_IS_INC_CONF_DEF ON)
+ENDIF()
 IF(DEFINED PYTHON_LIBRARY)
   SET(_IS_LIB_DEF ON)
 ENDIF()
+IF(DEFINED PYTHON_LIBPATH)
+  SET(_IS_LIB_PATH_DEF ON)
+ENDIF()
 
 
 # only search for the dirs if we havn't already
-IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
+IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
 
   SET(_python_ABI_FLAGS
     "m;mu;u; "    # release
@@ -69,6 +78,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
     ${PYTHON_ROOT_DIR}
     "$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
     "/opt/py${_PYTHON_VERSION_NO_DOTS}"
+    "/opt/lib/python-${PYTHON_VERSION}"
   )
 
   FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
@@ -85,7 +95,25 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
           ${_python_SEARCH_DIRS}
         PATH_SUFFIXES
           include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+          include/${CMAKE_LIBRARY_ARCHITECTURE}/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+      )
+    ENDIF()
+
+    IF(NOT DEFINED PYTHON_INCLUDE_CONFIG_DIR)
+      FIND_PATH(PYTHON_INCLUDE_CONFIG_DIR
+        NAMES
+          pyconfig.h
+        HINTS
+          ${_python_SEARCH_DIRS}
+        PATH_SUFFIXES
+          include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+          include/${CMAKE_LIBRARY_ARCHITECTURE}/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
       )
+      IF((NOT PYTHON_INCLUDE_CONFIG_DIR) AND PYTHON_INCLUDE_DIR)
+        # Fallback...
+        UNSET(PYTHON_INCLUDE_CONFIG_DIR CACHE)
+        SET(PYTHON_INCLUDE_CONFIG_DIR ${PYTHON_INCLUDE_DIR} CACHE PATH "")
+      ENDIF()
     ENDIF()
 
     IF(NOT DEFINED PYTHON_LIBRARY)
@@ -99,16 +127,38 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
       )
     ENDIF()
 
-    IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
+    IF(NOT DEFINED PYTHON_LIBPATH)
+      FIND_PATH(PYTHON_LIBPATH
+        NAMES
+          "python${PYTHON_VERSION}/abc.py" # This is a bit hackish! :/
+        HINTS
+          ${_python_SEARCH_DIRS}
+        PATH_SUFFIXES
+          lib64 lib
+      )
+      IF((NOT PYTHON_LIBPATH) AND PYTHON_LIBRARY)
+        # Fallback...
+        UNSET(PYTHON_LIBPATH CACHE)
+        GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
+      ENDIF()
+    ENDIF()
+
+    IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
       break()
     ELSE()
       # ensure we dont find values from 2 different ABI versions
       IF(NOT _IS_INC_DEF)
         UNSET(PYTHON_INCLUDE_DIR CACHE)
       ENDIF()
+      IF(NOT _IS_INC_CONF_DEF)
+        UNSET(PYTHON_INCLUDE_CONFIG_DIR CACHE)
+      ENDIF()
       IF(NOT _IS_LIB_DEF)
         UNSET(PYTHON_LIBRARY CACHE)
       ENDIF()
+      IF(NOT _IS_LIB_PATH_DEF)
+        UNSET(PYTHON_LIBPATH CACHE)
+      ENDIF()
     ENDIF()
   ENDFOREACH()
 
@@ -120,22 +170,24 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
 ENDIF()
 
 UNSET(_IS_INC_DEF)
+UNSET(_IS_INC_CONF_DEF)
 UNSET(_IS_LIB_DEF)
+UNSET(_IS_LIB_PATH_DEF)
 
 # handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF 
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix  DEFAULT_MSG
-    PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
-
+    PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
 
 IF(PYTHONLIBSUNIX_FOUND)
   # Assign cache items
-  SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
+  SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
   SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
 
   # we need this for installation
-  GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
+  # XXX No more valid with debian-like py3.3 packages...
+#  GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
 
   # not used
   # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
@@ -143,5 +195,6 @@ ENDIF()
 
 MARK_AS_ADVANCED(
   PYTHON_INCLUDE_DIR
+  PYTHON_INCLUDE_CONFIG_DIR
   PYTHON_LIBRARY
 )
diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py
index 072bbb1..b13b0dd 100755
--- a/build_files/cmake/cmake_consistency_check.py
+++ b/build_files/cmake/cmake_consistency_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -222,8 +222,8 @@ def cmake_get_src(f):
             '''
 
             # reset
-            sources_h[:] = []
-            sources_c[:] = []
+            del sources_h[:]
+            del sources_c[:]
 
     filen.close()
 
diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py
index a6215b4..6b82e22 100644
--- a/build_files/cmake/cmake_consistency_check_config.py
+++ b/build_files/cmake/cmake_consistency_check_config.py
@@ -2,11 +2,9 @@ import os
 
 IGNORE = (
     "/test/",
-    "/decimate_glut_test/",
     "/BSP_GhostTest/",
     "/release/",
     "/xembed/",
-    "/decimation/intern/future/",
     "/TerraplayNetwork/",
     "/ik_glut_test/",
 
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py
index 8f3835c..2f36cad 100755
--- a/build_files/cmake/cmake_netbeans_project.py
+++ b/build_files/cmake/cmake_netbeans_project.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py
index 83ea761..86201da 100755
--- a/build_files/cmake/cmake_qtcreator_project.py
+++ b/build_files/cmake/cmake_qtcreator_project.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/build_files/cmake/cmake_static_check_clang_array.py b/build_files/cmake/cmake_static_check_clang_array.py
index 9414071..7f45cc6 100644
--- a/build_files/cmake/cmake_static_check_clang_array.py
+++ b/build_files/cmake/cmake_static_check_clang_array.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -27,6 +27,8 @@ import subprocess
 import sys
 import os
 
+USE_QUIET = (os.environ.get("QUIET", None) is not None)
+
 CHECKER_IGNORE_PREFIX = [
     "extern",
     "intern/moto",
@@ -59,11 +61,12 @@ def main():
     process_functions = []
 
     def my_process(i, c, cmd):
-        percent = 100.0 * (i / (len(check_commands) - 1))
-        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+        if not USE_QUIET:
+            percent = 100.0 * (i / (len(check_commands) - 1))
+            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
-        sys.stdout.flush()
-        sys.stdout.write("%s " % percent_str)
+            sys.stdout.flush()
+            sys.stdout.write("%s " % percent_str)
 
         return subprocess.Popen(cmd)
 
diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py
index c458e8e..d79145f 100644
--- a/build_files/cmake/cmake_static_check_cppcheck.py
+++ b/build_files/cmake/cmake_static_check_cppcheck.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -27,6 +27,8 @@ import subprocess
 import sys
 import os
 
+USE_QUIET = (os.environ.get("QUIET", None) is not None)
+
 CHECKER_IGNORE_PREFIX = [
     "extern",
     "intern/moto",
@@ -44,6 +46,9 @@ CHECKER_ARGS = [
     #  "--enable=all",  # if you want sixty hundred pedantic suggestions
     ]
 
+if USE_QUIET:
+    CHECKER_ARGS.append("--quiet")
+
 
 def main():
     source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
@@ -62,11 +67,12 @@ def main():
     process_functions = []
 
     def my_process(i, c, cmd):
-        percent = 100.0 * (i / (len(check_commands) - 1))
-        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+        if not USE_QUIET:
+            percent = 100.0 * (i / (len(check_commands) - 1))
+            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
-        sys.stdout.flush()
-        sys.stdout.write("%s " % percent_str)
+            sys.stdout.flush()
+            sys.stdout.write("%s " % percent_str)
 
         return subprocess.Popen(cmd)
 
@@ -75,6 +81,8 @@ def main():
 
     project_source_info.queue_processes(process_functions)
 
+    print("Finished!")
+
 
 if __name__ == "__main__":
     main()
diff --git a/build_files/cmake/cmake_static_check_smatch.py b/build_files/cmake/cmake_static_check_smatch.py
index 5681d2a..7535f1c 100644
--- a/build_files/cmake/cmake_static_check_smatch.py
+++ b/build_files/cmake/cmake_static_check_smatch.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -37,7 +37,9 @@ CHECKER_ARGS = [
 import project_source_info
 import subprocess
 import sys
+import os
 
+USE_QUIET = (os.environ.get("QUIET", None) is not None)
 
 def main():
     source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
@@ -55,11 +57,12 @@ def main():
         check_commands.append((c, cmd))
 
     def my_process(i, c, cmd):
-        percent = 100.0 * (i / (len(check_commands) - 1))
-        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+        if not USE_QUIET:
+            percent = 100.0 * (i / (len(check_commands) - 1))
+            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
-        sys.stdout.flush()
-        sys.stdout.write("%s %s\n" % (percent_str, c))
+            sys.stdout.flush()
+            sys.stdout.write("%s %s\n" % (percent_str, c))
 
         return subprocess.Popen(cmd)
 
diff --git a/build_files/cmake/cmake_static_check_sparse.py b/build_files/cmake/cmake_static_check_sparse.py
index 4f4eb83..06bef1a 100644
--- a/build_files/cmake/cmake_static_check_sparse.py
+++ b/build_files/cmake/cmake_static_check_sparse.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -35,6 +35,9 @@ CHECKER_ARGS = [
 import project_source_info
 import subprocess
 import sys
+import os
+
+USE_QUIET = (os.environ.get("QUIET", None) is not None)
 
 
 def main():
@@ -53,11 +56,12 @@ def main():
         check_commands.append((c, cmd))
 
     def my_process(i, c, cmd):
-        percent = 100.0 * (i / (len(check_commands) - 1))
-        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+        if not USE_QUIET:
+            percent = 100.0 * (i / (len(check_commands) - 1))
+            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
-        sys.stdout.flush()
-        sys.stdout.write("%s %s\n" % (percent_str, c))
+            sys.stdout.flush()
+            sys.stdout.write("%s %s\n" % (percent_str, c))
 
         return subprocess.Popen(cmd)
 
diff --git a/build_files/cmake/cmake_static_check_splint.py b/build_files/cmake/cmake_static_check_splint.py
index 7be28c0..5b12075 100644
--- a/build_files/cmake/cmake_static_check_splint.py
+++ b/build_files/cmake/cmake_static_check_splint.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -68,6 +68,9 @@ CHECKER_ARGS = [
 import project_source_info
 import subprocess
 import sys
+import os
+
+USE_QUIET = (os.environ.get("QUIET", None) is not None)
 
 
 def main():
@@ -85,11 +88,12 @@ def main():
         check_commands.append((c, cmd))
 
     def my_process(i, c, cmd):
-        percent = 100.0 * (i / (len(check_commands) - 1))
-        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+        if not USE_QUIET:
+            percent = 100.0 * (i / (len(check_commands) - 1))
+            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
-        sys.stdout.write("%s %s\n" % (percent_str, c))
-        sys.stdout.flush()
+            sys.stdout.write("%s %s\n" % (percent_str, c))
+            sys.stdout.flush()
 
         return subprocess.Popen(cmd)
 
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index de3cfd1..e74d1ad 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -35,7 +35,6 @@ set(WITH_JACK                OFF CACHE FORCE BOOL)
 set(WITH_LZMA                OFF CACHE FORCE BOOL)
 set(WITH_LZO                 OFF CACHE FORCE BOOL)
 set(WITH_MOD_BOOLEAN         OFF CACHE FORCE BOOL)
-set(WITH_MOD_DECIMATE        OFF CACHE FORCE BOOL)
 set(WITH_MOD_FLUID           OFF CACHE FORCE BOOL)
 set(WITH_MOD_REMESH          OFF CACHE FORCE BOOL)
 set(WITH_MOD_SMOKE           OFF CACHE FORCE BOOL)
diff --git a/build_files/cmake/example_scripts/make_quicky.py b/build_files/cmake/example_scripts/make_quicky.py
index 9b853fc..76d4df3 100755
--- a/build_files/cmake/example_scripts/make_quicky.py
+++ b/build_files/cmake/example_scripts/make_quicky.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ##### BEGIN GPL LICENSE BLOCK #####
 #
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 750903b..efa258a 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -196,10 +196,6 @@ macro(SETUP_LIBDIRS)
 	if(WITH_PYTHON)  #  AND NOT WITH_PYTHON_MODULE  # WIN32 needs
 		link_directories(${PYTHON_LIBPATH})
 	endif()
-	if(WITH_INTERNATIONAL)
-		link_directories(${ICONV_LIBPATH})
-		link_directories(${GETTEXT_LIBPATH})
-	endif()
 	if(WITH_SDL)
 		link_directories(${SDL_LIBPATH})
 	endif()
@@ -287,14 +283,6 @@ macro(setup_liblinks
 		target_link_libraries(${target} ${GLEW_LIBRARY})
 	endif()
 
-	if(WITH_INTERNATIONAL)
-		target_link_libraries(${target} ${GETTEXT_LIBRARIES})
-
-		if(WIN32 AND NOT UNIX)
-			target_link_libraries(${target} ${ICONV_LIBRARIES})
-		endif()
-	endif()
-
 	if(WITH_OPENAL)
 		target_link_libraries(${target} ${OPENAL_LIBRARY})
 	endif()
@@ -324,6 +312,9 @@ macro(setup_liblinks
 	endif()
 	if(WITH_BOOST)
 		target_link_libraries(${target} ${BOOST_LIBRARIES})
+		if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+			target_link_libraries(${target} ${ICU_LIBRARIES})
+		endif()
 	endif()
 	target_link_libraries(${target} ${JPEG_LIBRARIES})
 	if(WITH_IMAGE_OPENEXR)
@@ -525,7 +516,7 @@ macro(remove_strict_flags_file
 			# TODO
 		endif()
 
-	endforeach()	
+	endforeach()
 
 	unset(_SOURCE)
 
@@ -712,7 +703,11 @@ macro(delayed_install
 	destination)
 
 	foreach(f ${files})
-		set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
+		if(IS_ABSOLUTE ${f})
+			set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${f})
+		else()
+			set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
+		endif()
 		set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
 	endforeach()
 endmacro()
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index a80ae62..34f378a 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -112,7 +112,7 @@ def is_glsl(filename):
 
 def is_c(filename):
     ext = splitext(filename)[1]
-    return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl"))
+    return (ext in {".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl", ".osl"})
 
 
 def is_c_any(filename):
@@ -133,12 +133,20 @@ def cmake_advanced_info():
     """ Extracr includes and defines from cmake.
     """
 
+    make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
+    make_exe_basename = os.path.basename(make_exe)
+
     def create_eclipse_project():
         print("CMAKE_DIR %r" % CMAKE_DIR)
         if sys.platform == "win32":
             cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
         else:
-            cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
+            if make_exe_basename.startswith("make"):
+                cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
+            elif make_exe_basename.startswith("ninja"):
+                cmd = 'cmake "%s" -G"Eclipse CDT4 - Ninja"' % CMAKE_DIR
+            else:
+                raise Exception("Unknown make program %r" % make_exe)
 
         os.system(cmd)
 
diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py
index 17a9327..10bc36b 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -48,7 +48,7 @@ def is_c_header(filename):
 
 def is_c(filename):
     ext = os.path.splitext(filename)[1]
-    return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl"))
+    return (ext in {".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl", ".osl"})
 
 
 def is_c_any(filename):
@@ -82,10 +82,20 @@ def makefile_log():
     import subprocess
     import time
 
-    print("running make with --dry-run ...")
-    process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
-                                stdout=subprocess.PIPE,
-                               )
+    # support both make and ninja
+    make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
+    make_exe_basename = os.path.basename(make_exe)
+
+    if make_exe_basename.startswith("make"):
+        print("running 'make' with --dry-run ...")
+        process = subprocess.Popen([make_exe, "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
+                                    stdout=subprocess.PIPE,
+                                   )
+    elif make_exe_basename.startswith("ninja"):
+        print("running 'ninja' with -t commands ...")
+        process = subprocess.Popen([make_exe, "-t", "commands"],
+                                    stdout=subprocess.PIPE,
+                                   )
 
     while process.poll():
         time.sleep(1)
@@ -145,6 +155,12 @@ def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
 
             source.append((c, inc_dirs, defs))
 
+        # make relative includes absolute
+        # not totally essential but useful
+        for i, f in enumerate(inc_dirs):
+            if not os.path.isabs(f):
+                inc_dirs[i] = os.path.abspath(os.path.join(CMAKE_DIR, f))
+
         # safety check that our includes are ok
         for f in inc_dirs:
             if not os.path.exists(f):
diff --git a/build_files/scons/config/Modules/FindPython.py b/build_files/scons/config/Modules/FindPython.py
index 969d9db..c93a103 100644
--- a/build_files/scons/config/Modules/FindPython.py
+++ b/build_files/scons/config/Modules/FindPython.py
@@ -5,7 +5,7 @@ def FindPython():
 
     python = "/usr"
     abi_flags = "m"  # Most common for linux distros
-    version = "3.2"
+    version = "3.3"
 
     # Determine ABI flags used on this system
     include = os.path.join(python, "include")
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index afab413..252a1b1 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -118,16 +118,16 @@ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
 #bz2 is a standard osx dynlib
 
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_OSX_STATICPYTHON = True
 
 if WITH_OSX_STATICPYTHON:
-    # python 3.2 uses precompiled libraries in bf svn /lib by default
+    # python 3.3 uses precompiled libraries in bf svn /lib by default
 
     BF_PYTHON = LIBDIR + '/python'
-    BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+    BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
     # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
-    BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+    BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
     BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
     # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
 else:
@@ -223,11 +223,6 @@ BF_ZLIB_LIB = 'z'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'intl'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = True
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
@@ -281,23 +276,42 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
 # Cycles
 WITH_BF_CYCLES = True
 
+#OSL
+
+WITH_BF_CYCLES_OSL = True
+BF_OSL = LIBDIR + '/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+# note oslexec would passed via program linkflags, which is needed to
+# make llvm happy with osl_allocate_closure_component
+#BF_OSL_LIB = 'oslcomp oslquery'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+BF_LLVM = LIBDIR + '/llvm'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
 WITH_BF_OIIO = True
 BF_OIIO = LIBDIR + '/openimageio'
-BF_OIIO_INC = BF_OIIO + '/include'
+BF_OIIO_INC = '${BF_OIIO}/include'
 BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
 
 WITH_BF_OCIO = True
 BF_OCIO = LIBDIR + '/opencolorio'
-BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_INC = '${BF_OCIO}/include'
 BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
-BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
 
 WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
-BF_BOOST_INC = BF_BOOST + '/include'
-BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib'
+BF_BOOST_INC = '${BF_BOOST}/include'
+BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt'
+BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 WITH_BF_CYCLES_CUDA_BINARIES = False
 BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py
index 412b08d..02c9093 100644
--- a/build_files/scons/config/freebsd7-config.py
+++ b/build_files/scons/config/freebsd7-config.py
@@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
 BF_PYTHON_ABI_FLAGS = ''
 BF_PYTHON = '/usr/local'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
 BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = '/usr/local'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gettextlib'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = False
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py
index ece86f7..5d3308c 100644
--- a/build_files/scons/config/freebsd8-config.py
+++ b/build_files/scons/config/freebsd8-config.py
@@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
 BF_PYTHON_ABI_FLAGS = ''
 BF_PYTHON = '/usr/local'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
 BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = '/usr/local'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gettextlib'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = False
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py
index a31c6da..98c2c8f 100644
--- a/build_files/scons/config/freebsd9-config.py
+++ b/build_files/scons/config/freebsd9-config.py
@@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
 BF_PYTHON_ABI_FLAGS = ''
 BF_PYTHON = '/usr/local'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
 BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = '/usr/local'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gettextlib'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = False
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index 45f6602..038a9bc 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -89,13 +89,6 @@ BF_ZLIB_LIB = 'z'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = '/usr'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gettextlib'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-#WITH_BF_GETTEXT_STATIC = True
-#BF_GETTEXT_LIB_STATIC = '${BF_GETTEXT}/lib/libgettextlib.a'
-
 WITH_BF_GAMEENGINE = True
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
@@ -211,9 +204,9 @@ BF_OIIO = LIBDIR + '/oiio'
 if not os.path.exists(LCGDIR + '/oiio'):
     WITH_BF_OIIO = False
     BF_OIIO = '/usr'
-BF_OIIO_INC = BF_OIIO + '/include'
+BF_OIIO_INC = '${BF_OIIO}/include'
 BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
 
 WITH_BF_OCIO = True
 WITH_BF_STATICOCIO = False
@@ -221,9 +214,9 @@ BF_OCIO = LIBDIR + '/ocio'
 if not os.path.exists(LCGDIR + '/ocio'):
     WITH_BF_OCIO = False
     BF_OCIO = '/usr'
-BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_INC = '${BF_OCIO}/include'
 BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
-BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
 
 WITH_BF_BOOST = True
 WITH_BF_STATICBOOST = False
@@ -231,9 +224,10 @@ BF_BOOST = LIBDIR + '/boost'
 if not os.path.exists(LCGDIR + '/boost'):
     WITH_BF_BOOST = False
     BF_BOOST = '/usr'
-BF_BOOST_INC = BF_BOOST + '/include'
+BF_BOOST_INC = '${BF_BOOST}/include'
 BF_BOOST_LIB = 'boost_date_time boost_filesystem boost_regex boost_system boost_thread'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib'
+BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
 
@@ -304,3 +298,7 @@ BF_INSTALLDIR='../install/linux'
 #Link against pthread
 PLATFORM_LINKFLAGS = ['-pthread']
 
+#Fix for LLVM conflict with Mesa llvmpipe
+if WITH_BF_LLVM:
+    PLATFORM_LINKFLAGS += ['-Wl,--version-script=source/creator/blender.map']
+
diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py
index 6866241..54faf59 100644
--- a/build_files/scons/config/linuxcross-config.py
+++ b/build_files/scons/config/linuxcross-config.py
@@ -2,7 +2,7 @@ LCGDIR = '#../lib/windows'
 LIBDIR = '${LCGDIR}'
 
 BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
@@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gcc/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'intl'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = True
 WITH_BF_PLAYER = False
 WITH_BF_OCEANSIM = True
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index 0a72d87..3914216 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -2,12 +2,12 @@ LCGDIR = '#../lib/mingw32'
 LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
-BF_PYTHON_DLL = 'python32'
+BF_PYTHON_DLL = 'python33'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
 
@@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'intl'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_OPENJPEG = True
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
@@ -155,21 +150,22 @@ WITH_BF_CYCLES = True
 
 WITH_BF_OIIO = True
 BF_OIIO = LIBDIR + '/openimageio'
-BF_OIIO_INC = BF_OIIO + '/include'
+BF_OIIO_INC = '${BF_OIIO}/include'
 BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
 
 WITH_BF_OCIO = True
 BF_OCIO = LIBDIR + '/opencolorio'
-BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_INC = '${BF_OCIO}/include'
 BF_OCIO_LIB = 'OpenColorIO'
-BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
 
 WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
-BF_BOOST_INC = BF_BOOST + '/include'
+BF_BOOST_INC = '${BF_BOOST}/include'
 BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49 boost_regex-mgw46-mt-s-1_49 boost_system-mgw46-mt-s-1_49 boost_thread-mgw46-mt-s-1_49'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib'
+BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index b77ff8e..21488e7 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -9,10 +9,10 @@ BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib sw
 BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
 
 BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
-BF_PYTHON_LIB = 'python32'
+BF_PYTHON_LIB = 'python33'
 BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 
@@ -54,7 +54,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 WITH_BF_OPENEXR = True
 WITH_BF_STATICOPENEXR = False
 BF_OPENEXR = LIBDIR + '/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
 BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@@ -87,11 +87,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gnu_gettext'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = True
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
@@ -155,22 +150,40 @@ WITH_BF_OPENMP = True
 #Cycles
 WITH_BF_CYCLES = True 
 
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = True
+BF_OSL = '${LIBDIR}/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+BF_LLVM = LIBDIR + '/llvm'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
 WITH_BF_OIIO = True
 BF_OIIO = '${LIBDIR}/openimageio'
 BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB = 'OpenImageIO'
 BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
+WITH_BF_STATICOIIO = True
 
 WITH_BF_OCIO = True
 BF_OCIO = '${LIBDIR}/opencolorio'
 BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO'
 BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
+WITH_BF_STATICOCIO = True
 
 WITH_BF_BOOST = True
 BF_BOOST = '${LIBDIR}/boost'
 BF_BOOST_INC = '${BF_BOOST}/include'
 BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49'
+BF_BOOST_LIB_INTERNATIONAL = 'libboost_locale-vc90-mt-s-1_49'
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
@@ -208,7 +221,7 @@ C_WARN = []
 CC_WARN = []
 CXX_WARN = []
 
-LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 838822b..d00e7a3 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -2,12 +2,12 @@ LCGDIR = '#../lib/mingw64'
 LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
-BF_PYTHON_DLL = 'python32'
+BF_PYTHON_DLL = 'python33'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 
 WITH_BF_OPENAL = True
@@ -80,11 +80,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'intl'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_OPENJPEG = True
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
@@ -118,7 +113,7 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
 WITH_BF_QUICKTIME = False
 
-WITH_BF_ICONV = True
+WITH_BF_ICONV = False
 BF_ICONV = LIBDIR + "/iconv"
 BF_ICONV_INC = '${BF_ICONV}/include'
 BF_ICONV_LIB = 'iconv'
@@ -167,9 +162,10 @@ BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
 
 WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
-BF_BOOST_INC = BF_BOOST + '/include'
+BF_BOOST_INC = '${BF_BOOST}/include'
 BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49 boost_filesystem-mgw47-mt-s-1_49 boost_filesystem-mgw47-mt-sd-1_49 boost_regex-mgw47-mt-s-1_49 boost_regex-mgw47-mt-sd-1_49 boost_system-mgw47-mt-s-1_49 boost_system-mgw47-mt-sd-1_49 boost_thread-mgw47-mt-s-1_49 boost_thread-mgw47-mt-sd-1_49'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib'
+BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
+BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 4b71946..c0ea797 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -9,10 +9,10 @@ BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib sw
 BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
 
 BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_VERSION = '3.2'
+BF_PYTHON_VERSION = '3.3'
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
-BF_PYTHON_LIB = 'python32'
+BF_PYTHON_LIB = 'python33'
 BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 
@@ -50,7 +50,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 WITH_BF_OPENEXR = True
 WITH_BF_STATICOPENEXR = False
 BF_OPENEXR = LIBDIR + '/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
 BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gettext'
-BF_GETTEXT_INC = '${BF_GETTEXT}/include'
-BF_GETTEXT_LIB = 'gnu_gettext'
-BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
-
 WITH_BF_GAMEENGINE = True
 WITH_BF_PLAYER = True
 WITH_BF_OCEANSIM = True
@@ -151,24 +146,40 @@ WITH_BF_OPENMP = True
 #Cycles
 WITH_BF_CYCLES = True
 
+WITH_BF_CYCLES_OSL = True
+WITH_BF_STATICOSL = True
+BF_OSL = '${LIBDIR}/osl'
+BF_OSL_INC = '${BF_OSL}/include'
+BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
+BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
+
+WITH_BF_LLVM = True
+BF_LLVM = LIBDIR + '/llvm'
+BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
+    'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
+    'LLVMTarget LLVMMC LLVMCore LLVMSupport'
+BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
+
 WITH_BF_OIIO = True
 BF_OIIO = '${LIBDIR}/openimageio'
 BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
 BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
+WITH_BF_STATICOIIO = True
 
 WITH_BF_OCIO = True
 BF_OCIO = '${LIBDIR}/opencolorio'
 BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
 BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
+WITH_BF_STATICOCIO = True
 
 WITH_BF_BOOST = True
 BF_BOOST = '${LIBDIR}/boost'
 BF_BOOST_INC = '${BF_BOOST}/include'
 BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49'
+BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc90-mt-s-1_49'
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
@@ -207,7 +218,7 @@ C_WARN = []
 CC_WARN = []
 CXX_WARN = []
 
-LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 1e114a4..94a9f1d 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -136,6 +136,11 @@ def setup_staticlibs(lenv):
         lenv['BF_ICONV_LIBPATH']
         ])
 
+    if lenv['WITH_BF_STATICJPEG']:
+        statlibs += Split(lenv['BF_JPEG_LIB_STATIC'])
+    if lenv['WITH_BF_STATICPNG']:
+        statlibs += Split(lenv['BF_PNG_LIB_STATIC'])
+
     libincs += Split(lenv['BF_FREETYPE_LIBPATH'])
     if lenv['WITH_BF_PYTHON']:
         libincs += Split(lenv['BF_PYTHON_LIBPATH'])
@@ -143,6 +148,8 @@ def setup_staticlibs(lenv):
         libincs += Split(lenv['BF_SDL_LIBPATH'])
     if lenv['WITH_BF_JACK']:
         libincs += Split(lenv['BF_JACK_LIBPATH'])
+        if lenv['WITH_BF_STATICJACK']:
+            statlibs += Split(lenv['BF_JACK_LIB_STATIC'])
     if lenv['WITH_BF_SNDFILE']:
         libincs += Split(lenv['BF_SNDFILE_LIBPATH'])
     if lenv['WITH_BF_OPENEXR']:
@@ -159,16 +166,15 @@ def setup_staticlibs(lenv):
         libincs += Split(lenv['BF_FFTW3_LIBPATH'])
         if lenv['WITH_BF_STATICFFTW3']:
             statlibs += Split(lenv['BF_FFTW3_LIB_STATIC'])
+    '''
     if lenv['WITH_BF_ELTOPO']:
         libincs += Split(lenv['BF_LAPACK_LIBPATH'])
         if lenv['WITH_BF_STATICLAPACK']:
-		    statlibs += Split(lenv['BF_LAPACK_LIB_STATIC'])        
+            statlibs += Split(lenv['BF_LAPACK_LIB_STATIC'])
+    '''
     if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']:
         statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC'])
     if lenv['WITH_BF_INTERNATIONAL']:
-        libincs += Split(lenv['BF_GETTEXT_LIBPATH'])
-        if lenv['WITH_BF_GETTEXT_STATIC']:
-            statlibs += Split(lenv['BF_GETTEXT_LIB_STATIC'])
         if lenv['WITH_BF_FREETYPE_STATIC']:
             statlibs += Split(lenv['BF_FREETYPE_LIB_STATIC'])
     if lenv['WITH_BF_OPENAL']:
@@ -194,10 +200,14 @@ def setup_staticlibs(lenv):
         if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
             libincs += Split(lenv['BF_PCRE_LIBPATH'])
             libincs += Split(lenv['BF_EXPAT_LIBPATH'])
+        if lenv['WITH_BF_STATICOPENCOLLADA']:
+            statlibs += Split(lenv['BF_OPENCOLLADA_LIB_STATIC'])
 
     if lenv['WITH_BF_OPENMP']:
         if lenv['OURPLATFORM'] == 'linuxcross':
             libincs += Split(lenv['BF_OPENMP_LIBPATH'])
+        if lenv['WITH_BF_STATICOPENMP']:
+            statlibs += Split(lenv['BF_OPENMP_LIB_STATIC'])
             
     if lenv['WITH_BF_OIIO']:
         libincs += Split(lenv['BF_OIIO_LIBPATH'])
@@ -214,6 +224,16 @@ def setup_staticlibs(lenv):
         if lenv['WITH_BF_STATICBOOST']:
             statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
 
+    if lenv['WITH_BF_CYCLES_OSL']:
+        libincs += Split(lenv['BF_OSL_LIBPATH'])
+        if lenv['WITH_BF_STATICOSL']:
+            statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
+
+    if lenv['WITH_BF_LLVM']:
+        libincs += Split(lenv['BF_LLVM_LIBPATH'])
+        if lenv['WITH_BF_STATICLLVM']:
+            statlibs += Split(lenv['BF_LLVM_LIB_STATIC'])
+
     # setting this last so any overriding of manually libs could be handled
     if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
         libincs.append('/usr/lib')
@@ -241,12 +261,10 @@ def setup_syslibs(lenv):
             syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
         else:
             syslibs.append(lenv['BF_PYTHON_LIB'])
-    if lenv['WITH_BF_INTERNATIONAL'] and not lenv['WITH_BF_GETTEXT_STATIC']:
-        syslibs += Split(lenv['BF_GETTEXT_LIB'])
     if lenv['WITH_BF_OPENAL']:
         if not lenv['WITH_BF_STATICOPENAL']:
             syslibs += Split(lenv['BF_OPENAL_LIB'])
-    if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc':
+    if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc' and not lenv['WITH_BF_STATICOPENMP']:
         if lenv['CC'] == 'cl.exe':
             syslibs += ['vcomp']
         else:
@@ -271,21 +289,23 @@ def setup_syslibs(lenv):
         syslibs += Split(lenv['BF_FFMPEG_LIB'])
         if lenv['WITH_BF_OGG']:
             syslibs += Split(lenv['BF_OGG_LIB'])
-    if lenv['WITH_BF_JACK']:
+    if lenv['WITH_BF_JACK'] and not lenv['WITH_BF_STATICJACK']:
         syslibs += Split(lenv['BF_JACK_LIB'])
     if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']:
         syslibs += Split(lenv['BF_SNDFILE_LIB'])
     if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
         syslibs += Split(lenv['BF_FFTW3_LIB'])
+    '''
     if lenv['WITH_BF_ELTOPO']:
         syslibs += Split(lenv['BF_LAPACK_LIB'])
+    '''
     if lenv['WITH_BF_SDL']:
         syslibs += Split(lenv['BF_SDL_LIB'])
     if not lenv['WITH_BF_STATICOPENGL']:
         syslibs += Split(lenv['BF_OPENGL_LIB'])
     if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'):
         syslibs += Split(lenv['BF_PTHREADS_LIB'])
-    if lenv['WITH_BF_COLLADA']:
+    if lenv['WITH_BF_COLLADA'] and not lenv['WITH_BF_STATICOPENCOLLADA']:
         syslibs.append(lenv['BF_PCRE_LIB'])
         if lenv['BF_DEBUG'] and (lenv['OURPLATFORM'] != 'linux'):
             syslibs += [colladalib+'_d' for colladalib in Split(lenv['BF_OPENCOLLADA_LIB'])]
@@ -304,9 +324,21 @@ def setup_syslibs(lenv):
                 
     if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']:
         syslibs += Split(lenv['BF_BOOST_LIB'])
+        
+        if lenv['WITH_BF_INTERNATIONAL']:
+            syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL'])
 
-    syslibs += Split(lenv['BF_JPEG_LIB'])
-    syslibs += Split(lenv['BF_PNG_LIB'])
+    if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
+        syslibs += Split(lenv['BF_OSL_LIB'])
+
+    if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']:
+        syslibs += Split(lenv['BF_LLVM_LIB'])
+
+    if not lenv['WITH_BF_STATICJPEG']:
+        syslibs += Split(lenv['BF_JPEG_LIB'])
+
+    if not lenv['WITH_BF_STATICPNG']:
+        syslibs += Split(lenv['BF_PNG_LIB'])
 
     syslibs += lenv['LLIBS']
 
@@ -568,8 +600,8 @@ def AppIt(target=None, source=None, env=None):
     bldroot = env.Dir('.').abspath
     binary = env['BINARYKIND']
      
-    sourcedir = bldroot + '/source/darwin/%s.app'%binary
-    sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
+    sourcedir = bldroot + '/release/darwin/%s.app' % binary
+    sourceinfo = bldroot + "/release/darwin/%s.app/Contents/Info.plist"%binary
     targetinfo = installdir +'/' + "%s.app/Contents/Info.plist"%binary
     cmd = installdir + '/' +'%s.app'%binary
     
@@ -619,11 +651,19 @@ def AppIt(target=None, source=None, env=None):
             commands.getoutput(cmd)
             cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
             commands.getoutput(cmd)
-            cmd = 'cp -R %s/kernel/svm %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, cinstalldir)
+            cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, cinstalldir)
             commands.getoutput(cmd)
             cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
             commands.getoutput(cmd)
 
+            if env['WITH_BF_CYCLES_OSL']:
+                cmd = 'mkdir %s/shader' % (cinstalldir)
+                commands.getoutput(cmd)
+                cmd = 'cp -R %s/kernel/shaders/*.h %s/shader' % (croot, cinstalldir)
+                commands.getoutput(cmd)
+                cmd = 'cp -R %s/../intern/cycles/kernel/shaders/*.oso %s/shader' % (builddir, cinstalldir)
+                commands.getoutput(cmd)
+
     if env['WITH_OSX_STATICPYTHON']:
         cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
         commands.getoutput(cmd)
@@ -650,7 +690,7 @@ def AppIt(target=None, source=None, env=None):
         commands.getoutput(cmd)
         cmd = 'rm -rf  %s/set_simulation_threads.app'%(installdir) # first clear omp_num_threads applescript
         commands.getoutput(cmd)
-        cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript
+        cmd = 'cp -R %s/release/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript
         commands.getoutput(cmd)
 
 # extract copy system python, be sure to update other build systems
@@ -778,6 +818,20 @@ class BlenderEnvironment(SConsEnvironment):
 
     def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None, cc_compilerchange=None, cxx_compilerchange=None):
         global vcp
+        
+        # sanity check
+        # run once in a while to check we dont have duplicates
+        if 0:
+            for name, dirs in (("source", sources), ("include", includes)):
+                files_clean = [os.path.normpath(f) for f in dirs]
+                files_clean_set = set(files_clean)
+                if len(files_clean) != len(files_clean_set):
+                    for f in sorted(files_clean_set):
+                        if f != '.' and files_clean.count(f) > 1:
+                            raise Exception("Found duplicate %s %r" % (name, f))
+            del name, dirs, files_clean, files_clean_set, f
+        # end sanity check
+
         if not self or not libname or not sources:
             print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC
             self.Exit()
@@ -857,6 +911,7 @@ class BlenderEnvironment(SConsEnvironment):
         print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
         lenv = self.Clone()
         lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
+        lenv.Append(LINKFLAGS = lenv['BF_PROGRAM_LINKFLAGS'])
         if lenv['OURPLATFORM'] in ('win32-mingw', 'win64-mingw', 'linuxcross', 'cygwin', 'linux'):
             lenv.Replace(LINK = '$CXX')
         if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 6d7a25a..19f4ac9 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -99,7 +99,7 @@ def validate_arguments(args, bc):
             'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', 
             'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
             'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
-            'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH',
+            'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_STATICJACK', 'BF_JACK_LIB_STATIC',
             'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', 'WITH_BF_STATICSNDFILE', 'BF_SNDFILE_LIB_STATIC',
             'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
             'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
@@ -109,24 +109,25 @@ def validate_arguments(args, bc):
             'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
             'WITH_BF_FRAMESERVER',
             'WITH_BF_COMPOSITOR', 'WITH_BF_COMPOSITOR_LEGACY',
-            'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
+            'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH', 'WITH_BF_STATICJPEG', 'BF_JPEG_LIB_STATIC',
             'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
             'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
-            'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
+            'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH', 'WITH_BF_STATICPNG', 'BF_PNG_LIB_STATIC',
             'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH', 'WITH_BF_STATICTIFF', 'BF_TIFF_LIB_STATIC',
             'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH', 'WITH_BF_STATICZLIB', 'BF_ZLIB_LIB_STATIC',
             'WITH_BF_INTERNATIONAL',
-            'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'WITH_BF_GETTEXT_STATIC', 'BF_GETTEXT_LIB_STATIC', 'BF_GETTEXT_LIBPATH',
             'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
             'WITH_BF_GAMEENGINE',
             'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
-            'WITH_BF_ELTOPO', 'BF_LAPACK', 'BF_LAPACK_LIB', 'BF_LAPACK_LIBPATH', 'BF_LAPACK_LIB_STATIC',
+            # 'WITH_BF_ELTOPO',  # now only available in a branch
+            'BF_LAPACK', 'BF_LAPACK_LIB', 'BF_LAPACK_LIBPATH', 'BF_LAPACK_LIB_STATIC',
             'BF_WINTAB', 'BF_WINTAB_INC',
             'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC',
             'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
             'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC',
             'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
             'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH',
+            'WITH_BF_STATICOPENCOLLADA', 'BF_OPENCOLLADA_LIB_STATIC',
             'WITH_BF_PLAYER',
             'WITH_BF_NOBLENDER',
             'WITH_BF_BINRELOC',
@@ -137,7 +138,7 @@ def validate_arguments(args, bc):
             'WITHOUT_BF_INSTALL',
             'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK', 'WITH_BF_PYTHON_INSTALL_NUMPY'
             'WITHOUT_BF_OVERWRITE_INSTALL',
-            'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
+            'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH', 'WITH_BF_STATICOPENMP', 'BF_OPENMP_STATIC_STATIC',
             'WITH_GHOST_COCOA',
             'WITH_GHOST_SDL',
             'WITH_GHOST_XDND',
@@ -152,7 +153,6 @@ def validate_arguments(args, bc):
             'WITH_BF_RAYOPTIMIZATION',
             'BF_RAYOPTIMIZATION_SSE_FLAGS',
             'WITH_BF_FLUID',
-            'WITH_BF_DECIMATE',
             'WITH_BF_BOOLEAN',
             'WITH_BF_REMESH',
             'WITH_BF_OCEANSIM',
@@ -164,8 +164,10 @@ def validate_arguments(args, bc):
             'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
             'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
             'WITH_BF_OCIO', 'WITH_BF_STATICOCIO', 'BF_OCIO', 'BF_OCIO_INC', 'BF_OCIO_LIB', 'BF_OCIO_LIB_STATIC', 'BF_OCIO_LIBPATH',
-            'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
-            'WITH_BF_LIBMV'
+            'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
+            'WITH_BF_LIBMV',
+            'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
+            'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS'
             ]
     
     # Have options here that scons expects to be lists
@@ -179,7 +181,7 @@ def validate_arguments(args, bc):
             'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
             'C_WARN', 'CC_WARN', 'CXX_WARN',
             'LLIBS', 'PLATFORM_LINKFLAGS','MACOSX_ARCHITECTURE', 'MACOSX_SDK_CHECK', 'XCODE_CUR_VER',
-            'BF_CYCLES_CUDA_BINARIES_ARCH',
+            'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET'
     ]
     
     
@@ -265,7 +267,6 @@ def read_opts(env, cfg, args):
         ('BF_PYTHON_ABI_FLAGS', 'Python ABI flags (suffix in library version: m, mu, etc)', ''),
 
         (BoolVariable('WITH_BF_FLUID', 'Build with Fluid simulation (Elbeem)', True)),
-        (BoolVariable('WITH_BF_DECIMATE', 'Build with decimate modifier', True)),
         (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)),
         (BoolVariable('WITH_BF_REMESH', 'Build with remesh modifier', True)),
         (BoolVariable('WITH_BF_OCEANSIM', 'Build with ocean simulation', False)),
@@ -286,10 +287,12 @@ def read_opts(env, cfg, args):
         ('BF_SDL_LIBPATH', 'SDL library path', ''),
 
         (BoolVariable('WITH_BF_JACK', 'Enable jack support if true', True)),
+        (BoolVariable('WITH_BF_STATICJACK', 'Staticly link to jack', False)),
         ('BF_JACK', 'jack base path', ''),
         ('BF_JACK_INC', 'jack include path', ''),
         ('BF_JACK_LIB', 'jack library', ''),
         ('BF_JACK_LIBPATH', 'jack library path', ''),
+        ('BF_JACK_LIB_STATIC', 'jack static library', ''),
 
         (BoolVariable('WITH_BF_SNDFILE', 'Enable sndfile support if true', True)),
         ('BF_SNDFILE', 'sndfile base path', ''),
@@ -337,10 +340,12 @@ def read_opts(env, cfg, args):
         ('BF_OGG_LIB', 'OGG library', ''),
 
         (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
+        (BoolVariable('WITH_BF_STATICJPEG', 'Staticly link to JPEG', False)),
         ('BF_JPEG', 'JPEG base path', ''),
         ('BF_JPEG_INC', 'JPEG include path', ''),
         ('BF_JPEG_LIB', 'JPEG library', ''),
         ('BF_JPEG_LIBPATH', 'JPEG library path', ''),
+        ('BF_JPEG_LIB_STATIC', 'JPEG static library', ''),
 
         (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
         ('BF_OPENJPEG', 'OPENJPEG base path', ''),
@@ -355,10 +360,12 @@ def read_opts(env, cfg, args):
         ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
 
         (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
+        (BoolVariable('WITH_BF_STATICPNG', 'Staticly link to PNG', False)),
         ('BF_PNG', 'PNG base path', ''),
         ('BF_PNG_INC', 'PNG include path', ''),
         ('BF_PNG_LIB', 'PNG library', ''),
         ('BF_PNG_LIBPATH', 'PNG library path', ''),
+        ('BF_PNG_LIB_STATIC', 'PNG static library', ''),
 
         (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)),
         (BoolVariable('WITH_BF_STATICTIFF', 'Staticly link to TIFF', False)),
@@ -376,15 +383,8 @@ def read_opts(env, cfg, args):
         ('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
         ('BF_ZLIB_LIB_STATIC', 'ZLib static library', ''),
 
-        (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext if true', True)),
+        (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Boost::locale if true', True)),
 
-        ('BF_GETTEXT', 'gettext base path', ''),
-        ('BF_GETTEXT_INC', 'gettext include path', ''),
-        ('BF_GETTEXT_LIB', 'gettext library', ''),
-        (BoolVariable('WITH_BF_GETTEXT_STATIC', 'Use static gettext library if true', False)),
-        ('BF_GETTEXT_LIB_STATIC', 'static gettext library', ''),
-        ('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
-        
         (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
         ('BF_ICONV', 'iconv base path', ''),
         ('BF_ICONV_INC', 'iconv include path', ''),
@@ -394,8 +394,7 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)),
 
         (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
-        
-        (BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)),
+        # (BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)),  # this is now only available in a branch
         ('BF_LAPACK', 'LAPACK base path', ''),
         ('BF_LAPACK_LIB', 'LAPACK library', ''),
         ('BF_LAPACK_LIB_STATIC', 'LAPACK library', ''),
@@ -420,12 +419,14 @@ def read_opts(env, cfg, args):
         ('BF_FREETYPE_LIB_STATIC', 'Static Freetype library', ''),
 
         (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
+        (BoolVariable('WITH_BF_STATICOPENMP', 'Staticly link to OpenMP', False)),
         ('BF_OPENMP', 'Base path to OpenMP (used when cross-compiling with older versions of WinGW)', ''),
         ('BF_OPENMP_INC', 'Path to OpenMP includes (used when cross-compiling with older versions of WinGW)', ''),
         ('BF_OPENMP_LIBPATH', 'Path to OpenMP libraries (used when cross-compiling with older versions of WinGW)', ''),
         (BoolVariable('WITH_GHOST_COCOA', 'Use Cocoa-framework if true', False)),
         (BoolVariable('WITH_GHOST_SDL', 'Enable building blender against SDL for windowing rather then the native APIs', False)),
         (BoolVariable('USE_QTKIT', 'Use QTKIT if true', False)),
+        ('BF_OPENMP_LIB_STATIC', 'OpenMP static library', ''),
 
         (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
         ('BF_QUICKTIME', 'QuickTime base path', ''),
@@ -450,6 +451,7 @@ def read_opts(env, cfg, args):
         ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
 
         (BoolVariable('WITH_BF_COLLADA', 'Build COLLADA import/export module if true', False)),
+        (BoolVariable('WITH_BF_STATICOPENCOLLADA', 'Staticly link to OpenCollada', False)),
         ('BF_COLLADA', 'COLLADA base path', ''),
         ('BF_COLLADA_INC', 'COLLADA include path', ''),
         ('BF_COLLADA_LIB', 'COLLADA library', ''),
@@ -463,6 +465,7 @@ def read_opts(env, cfg, args):
         ('BF_EXPAT', 'Expat base path', ''),
         ('BF_EXPAT_LIB', 'Expat library', ''),
         ('BF_EXPAT_LIBPATH', 'Expat library path', ''),
+        ('BF_OPENCOLLADA_LIB_STATIC', 'OpenCollada static library', ''),
         
         (BoolVariable('WITH_BF_JEMALLOC', 'Use jemalloc if true', False)),
         (BoolVariable('WITH_BF_STATICJEMALLOC', 'Staticly link to jemalloc', False)),
@@ -499,8 +502,9 @@ def read_opts(env, cfg, args):
         ('LLIBS', 'Platform libs', []),
         ('PLATFORM_LINKFLAGS', 'Platform linkflags', []),
         ('MACOSX_ARCHITECTURE', 'python_arch.zip select', ''),
-        ('MACOSX_SDK_CHECK', 'detect available OSX sdk`s', ''),
-        ('XCODE_CUR_VER', 'detect XCode version', ''),
+        ('MACOSX_SDK_CHECK', 'Detect available OS X SDK`s', ''),
+        ('XCODE_CUR_VER', 'Detect XCode version', ''),
+        ('MACOSX_DEPLOYMENT_TARGET', 'Detect OS X target version', ''),
 
         (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
         ('BF_PROFILE_CFLAGS', 'C only profiling flags', []),
@@ -541,7 +545,9 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_LIBMV', 'Enable libmv structure from motion library', True)),
         
         (BoolVariable('WITH_BF_COMPOSITOR', 'Enable the tile based nodal compositor', True)),
+    ) # end of opts.AddOptions()
 
+    localopts.AddVariables(
         ('BF_X264_CONFIG', 'configuration flags for x264', ''),
         ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
 #        (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
@@ -559,9 +565,7 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)),
 
         ('BUILDBOT_BRANCH', 'Buildbot branch name', ''),
-    ) # end of opts.AddOptions()
 
-    localopts.AddVariables(
         (BoolVariable('WITH_BF_CYCLES', 'Build with the Cycles engine', True)),
         (BoolVariable('WITH_BF_CYCLES_CUDA_BINARIES', 'Build with precompiled CUDA binaries', False)),
         (BoolVariable('WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'Build several render kernels at once (using BF_NUMJOBS)', False)),
@@ -589,11 +593,30 @@ def read_opts(env, cfg, args):
         ('BF_BOOST', 'Boost root path', ''),
         ('BF_BOOST_INC', 'Boost include path', ''),
         ('BF_BOOST_LIB', 'Boost library', ''),
+        ('BF_BOOST_LIB_INTERNATIONAL', 'Boost library', ''),
         ('BF_BOOST_LIBPATH', 'Boost library path', ''),
         ('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
 
         (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)),
-        (BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False))
+        (BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False)),
+
+        (BoolVariable('WITH_BF_CYCLES_OSL', 'Build with OSL sypport in Cycles', False)),
+        (BoolVariable('WITH_BF_STATICOSL', 'Staticly link to OSL', False)),
+        ('BF_OSL', 'OSL root path', ''),
+        ('BF_OSL_INC', 'OSL include path', ''),
+        ('BF_OSL_LIB', 'OSL library', ''),
+        ('BF_OSL_LIBPATH', 'OSL library path', ''),
+        ('BF_OSL_LIB_STATIC', 'OSL static library', ''),
+        ('BF_OSL_COMPILER', 'OSL compiler', ''),
+
+        (BoolVariable('WITH_BF_LLVM', 'Build with LLVM sypport (required for OSL)', False)),
+        (BoolVariable('WITH_BF_STATICLLVM', 'Staticly link to LLVM', False)),
+        ('BF_LLVM', 'LLVM root path', ''),
+        ('BF_LLVM_LIB', 'LLVM library', ''),
+        ('BF_LLVM_LIBPATH', 'LLVM library path', ''),
+        ('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
+
+        ('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', '')
     ) # end of opts.AddOptions()
 
     return localopts
@@ -653,13 +676,18 @@ def buildslave(target=None, source=None, env=None):
     if platform == 'linux':
         import platform
 
+        if env['BF_INSTALLDIR'].find('glibc27') != -1:
+            glibc="glibc27"
+        elif env['BF_INSTALLDIR'].find('glibc211') != -1:
+            glibc="glibc211"
+
         bitness = platform.architecture()[0]
         if bitness == '64bit':
-            platform = 'linux-glibc27-x86_64'
+            platform = 'linux-' + glibc + '-x86_64'
         elif bitness == '32bit':
-            platform = 'linux-glibc27-i686'
+            platform = 'linux-' + glibc + '-i686'
     if platform == 'darwin':
-        platform = 'OSX-' + env['MACOSX_ARCHITECTURE']
+        platform = 'OSX-' + env['MACOSX_DEPLOYMENT_TARGET'] + '-' + env['MACOSX_ARCHITECTURE']
 
     branch = env['BUILDBOT_BRANCH']
 
diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py
index b7b89c8..837b67c 100755
--- a/doc/blender_file_format/BlendFileDnaExporter_25.py
+++ b/doc/blender_file_format/BlendFileDnaExporter_25.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/doc/blender_file_format/BlendFileReader.py b/doc/blender_file_format/BlendFileReader.py
index b7091ad..a4d2f49 100644
--- a/doc/blender_file_format/BlendFileReader.py
+++ b/doc/blender_file_format/BlendFileReader.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1
index e7164fc..2addb60 100644
--- a/doc/manpage/blender.1
+++ b/doc/manpage/blender.1
@@ -1,4 +1,4 @@
-.TH "BLENDER" "1" "October 04, 2012" "Blender Blender 2\&.64 (sub 0)"
+.TH "BLENDER" "1" "December 04, 2012" "Blender Blender 2\&.65"
 
 .SH NAME
 blender \- a 3D modelling and rendering package
@@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
 http://www.blender.org
 .SH OPTIONS
 
-Blender 2.64 (sub 0)
+Blender 2.65
 Usage: blender [args ...] [file] [args ...]
 .br
 .SS "Render Options:"
@@ -145,6 +145,10 @@ Playback <file(s)>, only operates this way when not running in background.
 .br
     \-j <frame> Set frame step to <frame>
 .br
+    \-s <frame> Play from <frame>
+.br
+    \-e <frame> Play until <frame>
+.br
 
 .IP
 
@@ -345,6 +349,12 @@ Enable debug messages for the event system
 .br
 
 .TP
+.B \-\-debug\-handlers
+.br
+Enable debug messages for event handling
+.br
+
+.TP
 .B \-\-debug\-wm
 .br
 Enable debug messages for the window manager
diff --git a/doc/python_api/examples/bmesh.ops.1.py b/doc/python_api/examples/bmesh.ops.1.py
new file mode 100644
index 0000000..abce087
--- /dev/null
+++ b/doc/python_api/examples/bmesh.ops.1.py
@@ -0,0 +1,108 @@
+# This script uses bmesh operators to make 2 links of a chain.
+
+import bpy
+import bmesh
+import math
+import mathutils
+
+# Make a new BMesh
+bm = bmesh.new()
+
+# Add a circle XXX, should return all geometry created, not just verts.
+bmesh.ops.create_circle(
+        bm,
+        cap_ends=False,
+        diameter=0.2,
+        segments=8)
+
+
+# Spin and deal with geometry on side 'a'
+edges_start_a = bm.edges[:]
+geom_start_a = bm.verts[:] + edges_start_a
+ret = bmesh.ops.spin(
+        bm,
+        geom=geom_start_a,
+        angle=math.radians(180.0),
+        steps=8,
+        axis=(1.0, 0.0, 0.0),
+        cent=(0.0, 1.0, 0.0))
+edges_end_a = [ele for ele in ret["geom_last"]
+               if isinstance(ele, bmesh.types.BMEdge)]
+del ret
+
+
+# Extrude and create geometry on side 'b'
+ret = bmesh.ops.extrude_edge_only(
+        bm,
+        edges=edges_start_a)
+geom_extrude_mid = ret["geom"]
+del ret
+
+
+# Collect the edges to spin XXX, 'extrude_edge_only' could return this.
+verts_extrude_b = [ele for ele in geom_extrude_mid
+                   if isinstance(ele, bmesh.types.BMVert)]
+edges_extrude_b = [ele for ele in geom_extrude_mid
+                   if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
+bmesh.ops.translate(
+        bm,
+        verts=verts_extrude_b,
+        vec=(0.0, 0.0, 1.0))
+
+
+# Create the circle on side 'b'
+ret = bmesh.ops.spin(
+        bm,
+        geom=verts_extrude_b + edges_extrude_b,
+        angle=-math.radians(180.0),
+        steps=8,
+        axis=(1.0, 0.0, 0.0),
+        cent=(0.0, 1.0, 1.0))
+edges_end_b = [ele for ele in ret["geom_last"]
+               if isinstance(ele, bmesh.types.BMEdge)]
+del ret
+
+
+# Bridge the resulting edge loops of both spins 'a & b'
+bmesh.ops.bridge_loops(
+        bm,
+        edges=edges_end_a + edges_end_b)
+
+
+# Now we have made a links of the chain, make a copy and rotate it
+# (so this looks something like a chain)
+
+ret = bmesh.ops.duplicate(
+        bm,
+        geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
+geom_dupe = ret["geom"]
+verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
+del ret
+
+# position the new link
+bmesh.ops.translate(
+        bm,
+        verts=verts_dupe,
+        vec=(0.0, 0.0, 2.0))
+bmesh.ops.rotate(
+        bm,
+        verts=verts_dupe,
+        cent=(0.0, 1.0, 0.0),
+        matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
+
+# Done with creating the mesh, simply link it into the scene so we can see it
+
+# Finish up, write the bmesh into a new mesh
+me = bpy.data.meshes.new("Mesh")
+bm.to_mesh(me)
+bm.free()
+
+
+# Add the mesh to the scene
+scene = bpy.context.scene
+obj = bpy.data.objects.new("Object", me)
+scene.objects.link(obj)
+
+# Select and make active
+scene.objects.active = obj
+obj.select = True
diff --git a/doc/python_api/examples/bpy.types.Operator.4.py b/doc/python_api/examples/bpy.types.Operator.4.py
index 861496c..885ed85 100644
--- a/doc/python_api/examples/bpy.types.Operator.4.py
+++ b/doc/python_api/examples/bpy.types.Operator.4.py
@@ -26,8 +26,8 @@ class CustomDrawOperator(bpy.types.Operator):
         return {'FINISHED'}
 
     def invoke(self, context, event):
-        context.window_manager.fileselect_add(self)
-        return {'RUNNING_MODAL'}
+        wm = context.window_manager
+        return wm.invoke_props_dialog(self)
 
     def draw(self, context):
         layout = self.layout
diff --git a/doc/python_api/examples/bpy.types.Operator.5.py b/doc/python_api/examples/bpy.types.Operator.5.py
index e123768..4a0abcb 100644
--- a/doc/python_api/examples/bpy.types.Operator.5.py
+++ b/doc/python_api/examples/bpy.types.Operator.5.py
@@ -40,15 +40,17 @@ class ModalOperator(bpy.types.Operator):
         elif event.type == 'LEFTMOUSE':  # Confirm
             return {'FINISHED'}
         elif event.type in ('RIGHTMOUSE', 'ESC'):  # Cancel
+            context.object.location.x = self.init_loc_x
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
 
     def invoke(self, context, event):
+        self.init_loc_x = context.object.location.x
         self.value = event.mouse_x
         self.execute(context)
 
-        print(context.window_manager.modal_handler_add(self))
+        context.window_manager.modal_handler_add(self)
         return {'RUNNING_MODAL'}
 
 
diff --git a/doc/python_api/rst/bge.constraints.rst b/doc/python_api/rst/bge.constraints.rst
index 83f2a6b..7757e11 100644
--- a/doc/python_api/rst/bge.constraints.rst
+++ b/doc/python_api/rst/bge.constraints.rst
@@ -78,6 +78,14 @@ Physics Constraints (bge.constraints)
 
    :return: a vehicle constraint object.
    :rtype: :class:`bge.types.KX_VehicleWrapper`
+   
+.. function:: getCharacter(gameobj)
+
+   :arg gameobj: The game object with the character physics.
+   :type gameobj: :class:`bge.types.KX_GameObject`
+
+   :return: character wrapper
+   :rtype: :class:`bge.types.KX_CharacterWrapper`
 
 .. function:: removeConstraint(constraintId)
 
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index 260a86f..7d20aa3 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -254,13 +254,6 @@ General functions
    
    :rtype: list [float], len(getSpectrum()) == 512
 
-.. function:: stopDSP()
-
-   Stops the sound driver using DSP effects.
-   
-   Only the fmod sound driver supports this.
-   DSP can be computationally expensive.
-
 .. function:: getMaxLogicFrame()
 
    Gets the maximum number of logic frames per render frame.
@@ -331,6 +324,24 @@ General functions
 
    .. warning: Not implimented yet
 
+.. function:: getExitKey()
+
+   Gets the key used to exit the game engine
+
+   :return: The key (defaults to :mod:`bge.events.ESCKEY`)
+   :rtype: int
+
+.. function:: setExitKey(key)
+
+   Sets the key used to exit the game engine
+
+   :arg key: A key constant from :mod:`bge.events`
+   :type key: int
+
+.. function:: NextFrame()
+
+   Render next frame (if Python has control)
+
 *****************
 Utility functions
 *****************
@@ -373,6 +384,10 @@ Utility functions
 .. function:: PrintGLInfo()
 
    Prints GL Extension Info into the console
+
+.. function:: PrintMemInfo()
+
+   Prints engine statistics into the console
    
 *********
 Constants
@@ -401,6 +416,45 @@ Sensor Status
 .. data:: KX_SENSOR_ACTIVE
 .. data:: KX_SENSOR_JUST_DEACTIVATED
 
+---------------
+Armature Sensor
+---------------
+
+.. _armaturesensor-type:
+
+See :class:`bge.types.KX_ArmatureSensor.type`
+
+.. data:: KX_ARMSENSOR_STATE_CHANGED
+
+  Detect that the constraint is changing state (active/inactive)
+
+  :value: 0
+  
+.. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
+
+  Detect that the constraint linear error is above a threshold
+  
+  :value: 1
+  
+.. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
+
+  Detect that the constraint linear error is below a threshold
+
+  :value: 2
+  
+.. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
+
+  Detect that the constraint rotation error is above a threshold
+  
+  :value: 3
+  
+.. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
+
+  Detect that the constraint rotation error is below a threshold
+  
+  :value: 4
+  
+
 .. _logic-property-sensor:
 
 ---------------
@@ -483,6 +537,52 @@ See :class:`bge.types.BL_ActionActuator`
 .. data:: KX_ACTIONACT_LOOPEND
 .. data:: KX_ACTIONACT_PROPERTY
 
+-----------------
+Armature Actuator
+-----------------
+
+ .. _armatureactuator-constants-type:
+   
+See :class:`bge.types.BL_ArmatureActuator.type`
+
+.. data:: KX_ACT_ARMATURE_RUN
+
+  Just make sure the armature will be updated on the next graphic frame.
+  This is the only persistent mode of the actuator:
+  it executes automatically once per frame until stopped by a controller
+  
+  :value: 0
+
+.. data:: KX_ACT_ARMATURE_ENABLE
+
+  Enable the constraint.
+
+  :value: 1
+
+.. data:: KX_ACT_ARMATURE_DISABLE
+
+  Disable the constraint (runtime constraint values are not updated).
+
+  :value: 2
+
+.. data:: KX_ACT_ARMATURE_SETTARGET
+
+  Change target and subtarget of constraint.
+  
+  :value: 3
+
+.. data:: KX_ACT_ARMATURE_SETWEIGHT
+
+  Change weight of constraint (IK only).
+
+  :value: 4
+
+.. data:: KX_ACT_ARMATURE_SETINFLUENCE
+
+  Change influence of constraint.
+
+  :value: 5
+
 -------------------
 Constraint Actuator
 -------------------
@@ -493,31 +593,31 @@ See :class:`bge.types.KX_ConstraintActuator.option`
 
 * Applicable to Distance constraint:
 
-  .. data:: KX_ACT_CONSTRAINT_NORMAL
+.. data:: KX_CONSTRAINTACT_NORMAL
 
      Activate alignment to surface
    
-  .. data:: KX_ACT_CONSTRAINT_DISTANCE
+.. data:: KX_CONSTRAINTACT_DISTANCE
 
      Activate distance control
 
-  .. data:: KX_ACT_CONSTRAINT_LOCAL
+.. data:: KX_CONSTRAINTACT_LOCAL
 
      Direction of the ray is along the local axis
 
 * Applicable to Force field constraint:
 
-  .. data:: KX_ACT_CONSTRAINT_DOROTFH
+.. data:: KX_CONSTRAINTACT_DOROTFH
 
      Force field act on rotation as well
 
 * Applicable to both:
 
-  .. data:: KX_ACT_CONSTRAINT_MATERIAL
+.. data:: KX_CONSTRAINTACT_MATERIAL
 
      Detect material rather than property
    
-  .. data:: KX_ACT_CONSTRAINT_PERMANENT
+.. data:: KX_CONSTRAINTACT_PERMANENT
 
      No deactivation if ray does not hit target
 
@@ -585,27 +685,27 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
 
    Set orientation of Z axis
    
-.. data:: KX_ACT_CONSTRAINT_FHNX
+.. data:: KX_CONSTRAINTACT_FHNX
 
    Set force field along negative X axis
    
-.. data:: KX_ACT_CONSTRAINT_FHNY
+.. data:: KX_CONSTRAINTACT_FHNY
 
    Set force field along negative Y axis
    
-.. data:: KX_ACT_CONSTRAINT_FHNZ
+.. data:: KX_CONSTRAINTACT_FHNZ
 
    Set force field along negative Z axis
    
-.. data:: KX_ACT_CONSTRAINT_FHPX
+.. data:: KX_CONSTRAINTACT_FHPX
 
    Set force field along positive X axis
 
-.. data:: KX_ACT_CONSTRAINT_FHPY
+.. data:: KX_CONSTRAINTACT_FHPY
 
    Set force field along positive Y axis
    
-.. data:: KX_ACT_CONSTRAINT_FHPZ
+.. data:: KX_CONSTRAINTACT_FHPZ
 
    Set force field along positive Z axis
 
@@ -708,101 +808,31 @@ See :class:`bge.types.KX_SoundActuator`
 .. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
 
    :value: 6
-   
-
-=======
-Various
-=======
-
-.. _input-status:
-
-------------
-Input Status
-------------
 
-See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
+-----------------
+Steering Actuator
+-----------------
 
-.. data:: KX_INPUT_NONE
-.. data:: KX_INPUT_JUST_ACTIVATED
-.. data:: KX_INPUT_ACTIVE
-.. data:: KX_INPUT_JUST_RELEASED
+.. _logic-steering-actuator:
 
--------------
-Mouse Buttons
--------------
-
-See :class:`bge.types.SCA_MouseSensor`
-
-.. data:: KX_MOUSE_BUT_LEFT
-.. data:: KX_MOUSE_BUT_MIDDLE
-.. data:: KX_MOUSE_BUT_RIGHT
-
-------
-States
-------
-
-See :class:`bge.types.KX_StateActuator`
-
-.. data:: KX_STATE1
-.. data:: KX_STATE2
-.. data:: KX_STATE3
-.. data:: KX_STATE4
-.. data:: KX_STATE5
-.. data:: KX_STATE6
-.. data:: KX_STATE7
-.. data:: KX_STATE8
-.. data:: KX_STATE9
-.. data:: KX_STATE10
-.. data:: KX_STATE11
-.. data:: KX_STATE12
-.. data:: KX_STATE13
-.. data:: KX_STATE14
-.. data:: KX_STATE15
-.. data:: KX_STATE16
-.. data:: KX_STATE17
-.. data:: KX_STATE18
-.. data:: KX_STATE19
-.. data:: KX_STATE20
-.. data:: KX_STATE21
-.. data:: KX_STATE22
-.. data:: KX_STATE23
-.. data:: KX_STATE24
-.. data:: KX_STATE25
-.. data:: KX_STATE26
-.. data:: KX_STATE27
-.. data:: KX_STATE28
-.. data:: KX_STATE29
-.. data:: KX_STATE30
+See :class:`bge.types.KX_SteeringActuator.behavior`
 
-.. _state-actuator-operation:
+.. data:: KX_STEERING_SEEK
 
-See :class:`bge.types.KX_StateActuator.operation`
+   :value: 1
 
-.. data:: KX_STATE_OP_CLR
+.. data:: KX_STEERING_FLEE
 
-   Substract bits to state mask
-   
-   :value: 0
+   :value: 2
 
-.. data:: KX_STATE_OP_CPY
+.. data:: KX_STEERING_PATHFOLLOWING
 
-   Copy state mask
-   
-   :value: 1
-   
-.. data:: KX_STATE_OP_NEG
+   :value: 3
 
-   Invert bits to state mask
-   
-   :value: 2
-   
-.. data:: KX_STATE_OP_SET
 
-   Add bits to state mask
-   
-   :value: 3
-   
-.. _Two-D-FilterActuator-mode:
+=======
+Various
+=======
 
 ---------
 2D Filter
@@ -877,6 +907,227 @@ See :class:`bge.types.KX_StateActuator.operation`
 .. data:: RAS_2DFILTER_SOBEL
 
    :value: 7
+
+----------------
+Armature Channel
+----------------
+.. _armaturechannel-constants-rotation-mode:
+
+See :class:`bge.types.BL_ArmatureChannel.rotation_mode`
+
+.. note:
+  euler mode are named as in Blender UI but the actual axis order is reversed
+
+.. data:: ROT_MODE_QUAT
+
+  Use quaternion in rotation attribute to update bone rotation.
+
+  :value: 0
+
+.. data:: ROT_MODE_XYZ
+
+  Use euler_rotation and apply angles on bone's Z, Y, X axis successively.
+
+  :value: 1
+
+.. data:: ROT_MODE_XZY
+
+  Use euler_rotation and apply angles on bone's Y, Z, X axis successively.
+
+  :value: 2
+
+.. data:: ROT_MODE_YXZ
+
+  Use euler_rotation and apply angles on bone's Z, X, Y axis successively.
+
+  :value: 3
+
+.. data:: ROT_MODE_YZX
+
+  Use euler_rotation and apply angles on bone's X, Z, Y axis successively.
+
+  :value: 4
+
+.. data:: ROT_MODE_ZXY
+
+  Use euler_rotation and apply angles on bone's Y, X, Z axis successively.
+
+  :value: 5
+
+.. data:: ROT_MODE_ZYX
+
+  Use euler_rotation and apply angles on bone's X, Y, Z axis successively.
+
+  :value: 6
+
+
+-------------------
+Armature Constraint
+-------------------
+.. _armatureconstraint-constants-type:
+
+See :class:`bge.types.BL_ArmatureConstraint.type`
+
+.. data:: CONSTRAINT_TYPE_TRACKTO
+.. data:: CONSTRAINT_TYPE_KINEMATIC
+.. data:: CONSTRAINT_TYPE_ROTLIKE
+.. data:: CONSTRAINT_TYPE_LOCLIKE
+.. data:: CONSTRAINT_TYPE_MINMAX
+.. data:: CONSTRAINT_TYPE_SIZELIKE
+.. data:: CONSTRAINT_TYPE_LOCKTRACK
+.. data:: CONSTRAINT_TYPE_STRETCHTO
+.. data:: CONSTRAINT_TYPE_CLAMPTO
+.. data:: CONSTRAINT_TYPE_TRANSFORM
+.. data:: CONSTRAINT_TYPE_DISTLIMIT
+
+.. _armatureconstraint-constants-ik-type:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_type`
+  
+.. data:: CONSTRAINT_IK_COPYPOSE
+
+   constraint is trying to match the position and eventually the rotation of the target.
+
+   :value: 0
+
+.. data:: CONSTRAINT_IK_DISTANCE
+
+   Constraint is maintaining a certain distance to target subject to ik_mode
+
+   :value: 1
+
+.. _armatureconstraint-constants-ik-flag:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_flag`
+
+.. data:: CONSTRAINT_IK_FLAG_TIP
+
+   Set when the constraint operates on the head of the bone and not the tail
+
+   :value: 1
+
+.. data:: CONSTRAINT_IK_FLAG_ROT
+
+   Set when the constraint tries to match the orientation of the target
+
+   :value: 2
+
+.. data:: CONSTRAINT_IK_FLAG_STRETCH
+
+   Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
+
+   :value: 16
+   
+.. data:: CONSTRAINT_IK_FLAG_POS
+
+   Set when the constraint tries to match the position of the target.
+
+   :value: 32
+
+.. _armatureconstraint-constants-ik-mode:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_mode`
+
+.. data:: CONSTRAINT_IK_MODE_INSIDE
+
+   The constraint tries to keep the bone within ik_dist of target
+
+   :value: 0
+
+.. data:: CONSTRAINT_IK_MODE_OUTSIDE
+
+   The constraint tries to keep the bone outside ik_dist of the target
+
+   :value: 1
+   
+.. data:: CONSTRAINT_IK_MODE_ONSURFACE
+
+   The constraint tries to keep the bone exactly at ik_dist of the target.
+
+   :value: 2
+
+.. _input-status:
+
+----------------
+Blender Material
+----------------
+
+.. data:: BL_DST_ALPHA
+.. data:: BL_DST_COLOR
+.. data:: BL_ONE
+.. data:: BL_ONE_MINUS_DST_ALPHA
+.. data:: BL_ONE_MINUS_DST_COLOR
+.. data:: BL_ONE_MINUS_SRC_ALPHA
+.. data:: BL_ONE_MINUS_SRC_COLOR
+.. data:: BL_SRC_ALPHA
+.. data:: BL_SRC_ALPHA_SATURATE
+.. data:: BL_SRC_COLOR
+.. data:: BL_ZERO
+
+------------
+Input Status
+------------
+
+See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
+
+.. data:: KX_INPUT_NONE
+.. data:: KX_INPUT_JUST_ACTIVATED
+.. data:: KX_INPUT_ACTIVE
+.. data:: KX_INPUT_JUST_RELEASED
+
+-------------
+KX_GameObject
+-------------
+.. _gameobject-playaction-mode:
+
+See :class:`bge.types.KX_GameObject.playAction`
+
+.. data:: KX_ACTION_MODE_PLAY
+
+   Play the action once.
+   
+   :value: 0
+
+.. data:: KX_ACTION_MODE_LOOP
+
+   Loop the action (repeat it).
+   
+   :value: 1
+
+.. data:: KX_ACTION_MODE_PING_PONG
+
+   Play the action one direct then back the other way when it has completed.
+   
+   :value: 2
+
+
+-------------
+Mouse Buttons
+-------------
+
+See :class:`bge.types.SCA_MouseSensor`
+
+.. data:: KX_MOUSE_BUT_LEFT
+.. data:: KX_MOUSE_BUT_MIDDLE
+.. data:: KX_MOUSE_BUT_RIGHT
+
+--------------------------
+Navigation Mesh Draw Modes
+--------------------------
+
+.. _navmesh-draw-mode:
+
+.. data:: RM_WALLS
+
+   Draw only the walls.
+
+.. data:: RM_POLYS
+
+   Draw only polygons.
+ 
+.. data:: RM_TRIS
+
+   Draw triangle mesh.
    
 ------
 Shader
@@ -904,18 +1155,69 @@ Shader
 
 .. data:: SHD_TANGENT
 
-----------------
-Blender Material
-----------------
+------
+States
+------
 
-.. data:: BL_DST_ALPHA
-.. data:: BL_DST_COLOR
-.. data:: BL_ONE
-.. data:: BL_ONE_MINUS_DST_ALPHA
-.. data:: BL_ONE_MINUS_DST_COLOR
-.. data:: BL_ONE_MINUS_SRC_ALPHA
-.. data:: BL_ONE_MINUS_SRC_COLOR
-.. data:: BL_SRC_ALPHA
-.. data:: BL_SRC_ALPHA_SATURATE
-.. data:: BL_SRC_COLOR
-.. data:: BL_ZERO
+See :class:`bge.types.KX_StateActuator`
+
+.. data:: KX_STATE1
+.. data:: KX_STATE2
+.. data:: KX_STATE3
+.. data:: KX_STATE4
+.. data:: KX_STATE5
+.. data:: KX_STATE6
+.. data:: KX_STATE7
+.. data:: KX_STATE8
+.. data:: KX_STATE9
+.. data:: KX_STATE10
+.. data:: KX_STATE11
+.. data:: KX_STATE12
+.. data:: KX_STATE13
+.. data:: KX_STATE14
+.. data:: KX_STATE15
+.. data:: KX_STATE16
+.. data:: KX_STATE17
+.. data:: KX_STATE18
+.. data:: KX_STATE19
+.. data:: KX_STATE20
+.. data:: KX_STATE21
+.. data:: KX_STATE22
+.. data:: KX_STATE23
+.. data:: KX_STATE24
+.. data:: KX_STATE25
+.. data:: KX_STATE26
+.. data:: KX_STATE27
+.. data:: KX_STATE28
+.. data:: KX_STATE29
+.. data:: KX_STATE30
+
+.. _state-actuator-operation:
+
+See :class:`bge.types.KX_StateActuator.operation`
+
+.. data:: KX_STATE_OP_CLR
+
+   Substract bits to state mask
+
+   :value: 0
+
+.. data:: KX_STATE_OP_CPY
+
+   Copy state mask
+
+   :value: 1
+   
+.. data:: KX_STATE_OP_NEG
+
+   Invert bits to state mask
+
+   :value: 2
+
+.. data:: KX_STATE_OP_SET
+
+   Add bits to state mask
+
+   :value: 3
+
+.. _Two-D-FilterActuator-mode:
diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst
index 07d83f6..0c9e9da 100644
--- a/doc/python_api/rst/bge.texture.rst
+++ b/doc/python_api/rst/bge.texture.rst
@@ -351,6 +351,15 @@ When the texture object is deleted, the new texture is deleted and the old textu
 
       use whole viewport to render
 
+   .. attribute:: depth
+
+      use depth component of render as array of float -  not suitable for texture source,
+      should only be used with bge.texture.imageToArray(mode='F')
+
+   .. attribute:: zbuff
+
+      use depth component of render as grey scale color -  suitable for texture source
+
 .. class:: ImageViewport()
 
    Image source from viewport
@@ -399,6 +408,15 @@ When the texture object is deleted, the new texture is deleted and the old textu
 
       use whole viewport to capture
 
+   .. attribute:: depth
+
+      use depth component of viewport as array of float -  not suitable for texture source,
+      should only be used with bge.texture.imageToArray(mode='F')
+
+   .. attribute:: zbuff
+
+      use depth component of viewport as grey scale color -  suitable for texture source
+
 .. class:: Texture(gameObj)
 
    Texture objects
@@ -518,13 +536,16 @@ When the texture object is deleted, the new texture is deleted and the old textu
       0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel.
       Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order.
       "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255.
+      A special mode "F" allows to return the image as an array of float. This mode should only be used to retrieve
+      the depth buffer of the ImageViewport and ImageRender object.
       The default mode is "RGBA".
+          
 
    :type mode: string
    :rtype: :class:`~bgl.buffer`
    :return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height),
       line by line starting from the bottom of the image. The pixel size and format is determined by the mode
-      parameter.
+      parameter. For mode 'F', the array is a one dimensional array of float of size (width*height).
 
 .. function:: materialID(object,name)
 
diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst
index a173137..8cf9ccb 100644
--- a/doc/python_api/rst/bge.types.rst
+++ b/doc/python_api/rst/bge.types.rst
@@ -205,6 +205,18 @@ Types
       
       :type: boolean
 
+   .. attribute:: pos_ticks
+
+      The number of ticks since the last positive pulse (read-only).
+      
+      :type: int
+
+   .. attribute:: neg_ticks
+
+      The number of ticks since the last negative pulse (read-only).
+      
+      :type: int
+
    .. attribute:: status
 
       The status of the sensor (read-only): can be one of :ref:`these constants<sensor-status>`.
@@ -621,6 +633,71 @@ Types
 
       :type: string
 
+
+.. class:: KX_SteeringActuator(SCA_IActuator)
+
+   Steering Actuator for navigation.
+
+   .. attribute:: behavior
+
+      The steering behavior to use.
+
+      :type: one of :ref:`these constants <logic-steering-actuator>`
+
+   .. attribute:: velocity
+
+      Velocity magnitude
+
+      :type: float
+
+   .. attribute:: acceleration
+
+      Max acceleration
+
+      :type: float
+
+   .. attribute:: turnspeed
+
+      Max turn speed
+
+      :type: float
+
+   .. attribute:: distance
+
+      Relax distance
+
+      :type: float
+
+   .. attribute:: target
+
+      Target object
+
+      :type: :class:`KX_GameObject`
+
+   .. attribute:: navmesh
+
+      Navigation mesh
+
+      :type: :class:`KX_GameObject`
+
+   .. attribute:: selfterminated
+
+      Terminate when target is reached
+
+      :type: boolean
+
+   .. attribute:: enableVisualization
+
+      Enable debug visualization
+
+      :type: boolean
+
+   .. attribute:: pathUpdatePeriod
+
+      Path update period
+
+      :type: int
+
 .. class:: CListValue(CPropValue)
 
    This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
@@ -682,10 +759,32 @@ Types
 
          The id is derived from a memory location and will be different each time the game engine starts.
 
+      .. warning::
+
+         The id can't be stored as an integer in game object properties, as those only have a limited range that the id may not be contained in. Instead an id can be stored as a string game property and converted back to an integer for use in from_id lookups.
+
 .. class:: KX_BlenderMaterial(PyObjectPlus)
 
    KX_BlenderMaterial
 
+   .. attribute:: shader
+
+      The materials shader.
+
+      :type: :class:`BL_Shader`
+
+   .. attribute:: blending
+
+      Ints used for pixel blending, (src, dst), matching the setBlending method.
+
+      :type: (integer, integer)
+
+   .. attribute:: material_index
+
+      The material's index.
+
+      :type: integer
+
    .. method:: getShader()
 
       Returns the material's shader.
@@ -743,7 +842,13 @@ Types
       strength of of the camera following movement.
 
       :type: float
-   
+
+   .. attribute:: axis
+
+      The camera axis (0, 1, 2) for positive ``XYZ``, (3, 4, 5) for negative ``XYZ``.
+
+      :type: int
+
    .. attribute:: min
 
       minimum distance to the target object maintained by the actuator.
@@ -762,12 +867,6 @@ Types
 
       :type: float
 
-   .. attribute:: useXY
-
-      axis this actuator is tracking, True=X, False=Y.
-
-      :type: boolean
-
    .. attribute:: object
 
       the object this actuator tracks.
@@ -988,14 +1087,14 @@ Types
       The object's parent object. (read-only).
 
       :type: :class:`KX_GameObject` or None
-	  
-   .. attribute:: group_children
+
+   .. attribute:: groupMembers
 
       Returns the list of group members if the object is a group object, otherwise None is returned.
 
       :type: :class:`CListValue` of :class:`KX_GameObject` or None
 
-   .. attribute:: group_parent
+   .. attribute:: groupObject
 
       Returns the group object that the object belongs to or None if the object is not part of a group.
 
@@ -1100,30 +1199,30 @@ Types
       The object's world space transform matrix. 4x4 Matrix.
 
       :type: :class:`mathutils.Matrix`
-	  
+
    .. attribute:: localLinearVelocity
       
-	  The object's local linear velocity. [x, y, z]
-	  
-	  :type: :class:`mathutils.Vector`
-	  
+      The object's local linear velocity. [x, y, z]
+
+      :type: :class:`mathutils.Vector`
+
    .. attribute:: worldLinearVelocity
    
       The object's world linear velocity. [x, y, z]
-	  
-	  :type: :class:`mathutils.Vector`
-	  
+
+      :type: :class:`mathutils.Vector`
+
    .. attribute:: localAngularVelocity
    
       The object's local angular velocity. [x, y, z]
-	  
-	  :type: :class:`mathutils.Vector`
-	  
+
+      :type: :class:`mathutils.Vector`
+
    .. attribute:: worldAngularVelocity
    
       The object's world angular velocity. [x, y, z]
-	  
-	  :type: :class:`mathutils.Vector`
+
+      :type: :class:`mathutils.Vector`
 
    .. attribute:: timeOffset
 
@@ -1211,6 +1310,13 @@ Types
 
       :type: :class:`CListValue` of :class:`KX_GameObject`'s
 
+   .. attribute:: life
+
+      The number of seconds until the object ends, assumes 50fps.
+      (when added with an add object actuator), (read-only).
+
+      :type: float
+
    .. method:: endObject()
 
       Delete this object, can be used in place of the EndObject Actuator.
@@ -1653,7 +1759,7 @@ Types
       :arg blendin: the amount of blending between this animation and the previous one on this layer
       :type blendin: float
       :arg play_mode: the play mode
-      :type play_mode: KX_ACTION_MODE_PLAY, KX_ACTION_MODE_LOOP, or KX_ACTION_MODE_PING_PONG
+      :type play_mode: one of :ref:`these constants <gameobject-playaction-mode>`
       :arg layer_weight: how much of the previous layer to use for blending (0 = add)
       :type layer_weight: float
       :arg ipo_flags: flags for the old IPO behaviors (force, etc)
@@ -1810,10 +1916,6 @@ Types
 
       :type: list [r, g, b]
 
-   .. attribute:: colour
-
-      Synonym for color.
-
    .. attribute:: lin_attenuation
 
       The linear component of this light's attenuation. (SPOT and NORMAL lights only).
@@ -1898,11 +2000,6 @@ Types
 
       :type: integer
 
-   .. method:: getNumMaterials()
-
-      :return: number of materials associated with this object
-      :rtype: integer
-
    .. method:: getMaterialName(matid)
 
       Gets the name of the specified material.
@@ -1943,11 +2040,6 @@ Types
       :return: a vertex object.
       :rtype: :class:`KX_VertexProxy`
 
-   .. method:: getNumPolygons()
-
-      :return: The number of polygon in the mesh.
-      :rtype: integer
-
    .. method:: getPolygon(index)
 
       Gets the specified polygon from the mesh.
@@ -1957,6 +2049,28 @@ Types
       :return: a polygon object.
       :rtype: :class:`PolyProxy`
 
+   .. method:: transform(matid, matrix)
+
+      Transforms the vertices of a mesh.
+
+      :arg matid: material index, -1 transforms all.
+      :type matid: integer
+      :arg matrix: transformation matrix.
+      :type matrix: 4x4 matrix [[float]]
+
+   .. method:: transformUV(matid, matrix, uv_index=-1, uv_index_from=-1)
+
+      Transforms the vertices UV's of a mesh.
+
+      :arg matid: material index, -1 transforms all.
+      :type matid: integer
+      :arg matrix: transformation matrix.
+      :type matrix: 4x4 matrix [[float]]
+      :arg uv_index: optional uv index, -1 for all, otherwise 0 or 1.
+      :type uv_index: integer
+      :arg uv_index_from: optional uv index to copy from, -1 to transform the current uv.
+      :type uv_index_from: integer
+
 .. class:: SCA_MouseSensor(SCA_ISensor)
 
    Mouse Sensor logic brick.
@@ -2156,6 +2270,52 @@ Types
 
       :type: list of strings
 
+
+.. class:: KX_FontObject(KX_GameObject)
+
+   TODO.
+
+
+.. class:: KX_NavMeshObject(KX_GameObject)
+
+   Python interface for using and controlling navigation meshes. 
+
+   .. method:: findPath(start, goal)
+
+      Finds the path from start to goal points.
+
+      :arg start: the start point
+      :arg start: 3D Vector
+      :arg goal: the goal point
+      :arg start: 3D Vector
+      :return: a path as a list of points
+      :rtype: list of points
+
+   .. method:: raycast(start, goal)
+
+      Raycast from start to goal points.
+
+      :arg start: the start point
+      :arg start: 3D Vector
+      :arg goal: the goal point
+      :arg start: 3D Vector
+      :return: the hit factor
+      :rtype: float
+
+   .. method:: draw(mode)
+
+      Draws a debug mesh for the navigation mesh.
+
+      :arg mode: the drawing mode (one of :ref:`these constants <navmesh-draw-mode>`)
+      :arg mode: integer
+      :return: None
+
+   .. method:: rebuild()
+
+      Rebuild the navigation mesh.
+
+      :return: None
+
 .. class:: KX_ObjectActuator(SCA_IActuator)
 
    The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, 
@@ -2309,49 +2469,6 @@ Types
 
       :type: boolean
 
-.. class:: KX_PhysicsObjectWrapper(PyObjectPlus)
-
-   KX_PhysicsObjectWrapper
-
-   .. method:: setActive(active)
-
-      Set the object to be active.
-
-      :arg active: set to True to be active
-      :type active: boolean
-
-   .. method:: setAngularVelocity(x, y, z, local)
-
-      Set the angular velocity of the object.
-
-      :arg x: angular velocity for the x-axis
-      :type x: float
-
-      :arg y: angular velocity for the y-axis
-      :type y: float
-
-      :arg z: angular velocity for the z-axis
-      :type z: float
-
-      :arg local: set to True for local axis
-      :type local: boolean
-
-   .. method:: setLinearVelocity(x, y, z, local)
-
-      Set the linear velocity of the object.
-
-      :arg x: linear velocity for the x-axis
-      :type x: float
-
-      :arg y: linear velocity for the y-axis
-      :type y: float
-
-      :arg z: linear velocity for the z-axis
-      :type z: float
-
-      :arg local: set to True for local axis
-      :type local: boolean
-
 .. class:: KX_PolyProxy(SCA_IObject)
 
    A polygon holds the index of the vertex forming the poylgon.
@@ -2360,7 +2477,7 @@ Types
    The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
    to change the vertex settings.
 
-   .. attribute:: matname
+   .. attribute:: material_name
 
       The name of polygon material, empty if no material.
 
@@ -2372,13 +2489,13 @@ Types
 
       :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
 
-   .. attribute:: texture
+   .. attribute:: texture_name
 
       The texture name of the polygon.
 
       :type: string
 
-   .. attribute:: matid
+   .. attribute:: material_id
 
       The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
 
@@ -2609,18 +2726,6 @@ Types
 
       :type: boolean
 
-   .. attribute:: lightlayer
-
-      Light layers this material affects.
-
-      :type: bitfield.
-
-   .. attribute:: triangle
-
-      Mesh data with this material is triangles. It's probably not safe to change this.
-
-      :type: boolean
-
    .. attribute:: diffuse
 
       The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
@@ -2886,8 +2991,8 @@ Types
    .. method:: instantAddObject()
 
       adds the object without needing to calling SCA_PythonController.activate()
-	  
-	  .. note:: Use objectLastCreated to get the newly created object.
+
+      .. note:: Use objectLastCreated to get the newly created object.
 
 .. class:: KX_SCA_DynamicActuator(SCA_IActuator)
 
@@ -3113,6 +3218,12 @@ Types
 
       :type: list
 
+   .. attribute:: gravity
+
+      The scene gravity using the world x, y and z axis.
+
+      :type: list [fx, fy, fz]
+
    .. method:: addObject(object, other, time=0)
 
       Adds an object to the scene like the Add Object Actuator would.
@@ -3154,6 +3265,10 @@ Types
       Return the value matching key, or the default value if its not found.
       :return: The key value or a default.
 
+   .. method:: drawObstacleSimulation()
+
+      Draw debug visualization of obstacle simulation.
+
 .. class:: KX_SceneActuator(SCA_IActuator)
 
    Scene Actuator logic brick.
@@ -3200,17 +3315,17 @@ Types
 
    Sound Actuator.
 
-   The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least.
+   The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not require the actuator to be activated - they act instantly provided that the actuator has been activated once at least.
 
-   .. attribute:: fileName
+   .. attribute:: volume
 
-      The filename of the sound this actuator plays.
+      The volume (gain) of the sound.
 
-      :type: string
+      :type: float
 
-   .. attribute:: volume
+   .. attribute:: time
 
-      The volume (gain) of the sound.
+      The current position in the audio stream (in seconds).
 
       :type: float
 
@@ -3220,41 +3335,89 @@ Types
 
       :type: float
 
-   .. attribute:: rollOffFactor
+   .. attribute:: mode
+
+      The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
+
+      :type: integer
+
+   .. attribute:: sound
+
+      The sound the actuator should play.
+
+      :type: Audaspace factory
+
+   .. attribute:: is3D
 
-      The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
+      Whether or not the actuator should be using 3D sound. (read-only)
+
+      :type: boolean
+
+   .. attribute:: volume_maximum
+
+      The maximum gain of the sound, no matter how near it is.
 
       :type: float
 
-   .. attribute:: looping
+   .. attribute:: volume_minimum
 
-      The loop mode of the actuator.
+      The minimum gain of the sound, no matter how far it is away.
 
-      :type: integer
+      :type: float
 
-   .. attribute:: position
+   .. attribute:: distance_reference
 
-      The position of the sound as a list: [x, y, z].
+      The distance where the sound has a gain of 1.0.
 
-      :type: float array
+      :type: float
 
-   .. attribute:: velocity
+   .. attribute:: distance_maximum
 
-      The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
+      The maximum distance at which you can hear the sound.
 
-      :type: float array
+      :type: float
 
-   .. attribute:: orientation
+   .. attribute:: attenuation
 
-      The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float].
+      The influence factor on volume depending on distance.
 
-      :type: 3x3 matrix [[float]]
+      :type: float
 
-   .. attribute:: mode
+   .. attribute:: cone_angle_inner
 
-      The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
+      The angle of the inner cone.
 
-      :type: integer
+      :type: float
+
+   .. attribute:: cone_angle_outer
+
+      The angle of the outer cone.
+
+      :type: float
+
+   .. attribute:: cone_volume_outer
+
+      The gain outside the outer cone (the gain in the outer cone will be interpolated between this value and the normal gain in the inner cone).
+
+      :type: float
+
+   .. method:: startSound()
+
+      Starts the sound.
+
+      :return: None
+
+   .. method:: pauseSound()
+
+      Pauses the sound.
+
+      :return: None
+
+   .. method:: stopSound()
+
+      Stops the sound.
+
+      :return: None
 
 .. class:: KX_StateActuator(SCA_IActuator)
 
@@ -3464,6 +3627,26 @@ Types
       :arg wheelIndex: the wheel index
       :type wheelIndex: integer
 
+.. class:: KX_CharacterWrapper(PyObjectPlus)
+
+   A wrapper to expose character physics options.
+
+   .. attribute:: onGround
+
+      Whether or not the character is on the ground. (read-only)
+
+      :type: boolean
+
+   .. attribute:: gravity
+
+      The gravity value used for the character.
+
+      :type: float
+
+   .. method:: jump()
+
+      The character jumps based on it's jump speed.
+
 .. class:: KX_VertexProxy(SCA_IObject)
 
    A vertex holds position, UV, color and normal information.
@@ -3498,10 +3681,6 @@ Types
 
       Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
 
-   .. attribute:: colour
-
-      Synonym for color.
-
    .. attribute:: x
 
       The x coordinate of the vertex.
@@ -4222,24 +4401,6 @@ Types
 
       :type: integer
 
-   .. method:: setSeed(seed)
-
-      Sets the seed of the random number generator.
-
-      If the seed is 0, the generator will produce the same value on every call.
-
-      :type seed: integer
-
-   .. method:: getSeed()
-
-      :return: The initial seed of the generator.  Equal seeds produce equal random series.
-      :rtype: integer
-
-   .. method:: getLastDraw()
-
-      :return: The last random number generated.
-      :rtype: integer
-
 .. class:: SCA_XNORController(SCA_IController)
 
    An XNOR controller activates when all linked sensors are the same (activated or inative).
@@ -4307,7 +4468,7 @@ Types
    .. attribute:: projection_matrix
 
       This camera's 4x4 projection matrix.
-	  
+
       .. note::
       
          This is the identity matrix prior to rendering the first frame (any Python done on frame 1). 
@@ -4560,48 +4721,6 @@ Types
 
    Armature Actuators change constraint condition on armatures.
 
-   .. _armatureactuator-constants-type:
-   
-   Constants related to :data:`~bge.types.BL_ArmatureActuator.type`
-   
-   .. data:: KX_ACT_ARMATURE_RUN
-
-      Just make sure the armature will be updated on the next graphic frame.
-      This is the only persistent mode of the actuator:
-      it executes automatically once per frame until stopped by a controller
-      
-      :value: 0
-
-   .. data:: KX_ACT_ARMATURE_ENABLE
-
-      Enable the constraint.
-            
-      :value: 1
-
-   .. data:: KX_ACT_ARMATURE_DISABLE
-
-      Disable the constraint (runtime constraint values are not updated).
-            
-      :value: 2
-
-   .. data:: KX_ACT_ARMATURE_SETTARGET
-
-      Change target and subtarget of constraint.
-      
-      :value: 3
-
-   .. data:: KX_ACT_ARMATURE_SETWEIGHT
-
-      Change weight of constraint (IK only).
-
-      :value: 4
-
-   .. data:: KX_ACT_ARMATURE_SETINFLUENCE
-
-      Change influence of constraint.
-
-      :value: 5
-
    .. attribute:: type
 
       The type of action that the actuator executes when it is active.
@@ -4656,40 +4775,6 @@ Types
 
    Armature sensor detect conditions on armatures.
 
-   .. _armaturesensor-type:
-
-   Constants related to :data:`type`
-
-   .. data:: KX_ARMSENSOR_STATE_CHANGED
-   
-      Detect that the constraint is changing state (active/inactive)
-
-      :value: 0
-      
-   .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
-   
-      Detect that the constraint linear error is above a threshold
-      
-      :value: 1
-      
-   .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
-   
-      Detect that the constraint linear error is below a threshold
-
-      :value: 2
-      
-   .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
-   
-      Detect that the constraint rotation error is above a threshold
-      
-      :value: 3
-      
-   .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
-   
-      Detect that the constraint rotation error is below a threshold
-      
-      :value: 4
-      
    .. attribute:: type
 
       The type of measurement that the sensor make when it is active.
@@ -4724,87 +4809,6 @@ Types
    
       Not all armature constraints are supported in the GE.
 
-   .. _armatureconstraint-constants-type:
-
-   Constants related to :data:`type`
-
-   .. data:: CONSTRAINT_TYPE_TRACKTO
-   .. data:: CONSTRAINT_TYPE_KINEMATIC
-   .. data:: CONSTRAINT_TYPE_ROTLIKE
-   .. data:: CONSTRAINT_TYPE_LOCLIKE
-   .. data:: CONSTRAINT_TYPE_MINMAX
-   .. data:: CONSTRAINT_TYPE_SIZELIKE
-   .. data:: CONSTRAINT_TYPE_LOCKTRACK
-   .. data:: CONSTRAINT_TYPE_STRETCHTO
-   .. data:: CONSTRAINT_TYPE_CLAMPTO
-   .. data:: CONSTRAINT_TYPE_TRANSFORM
-   .. data:: CONSTRAINT_TYPE_DISTLIMIT
-
-   .. _armatureconstraint-constants-ik-type:
-
-   Constants related to :data:`ik_type`
-      
-   .. data:: CONSTRAINT_IK_COPYPOSE
-      
-      constraint is trying to match the position and eventually the rotation of the target.
-      
-      :value: 0
-   
-   .. data:: CONSTRAINT_IK_DISTANCE
-      
-      Constraint is maintaining a certain distance to target subject to ik_mode
-      
-      :value: 1
-
-   .. _armatureconstraint-constants-ik-flag:
-
-   Constants related to :data:`ik_flag`
-
-   .. data:: CONSTRAINT_IK_FLAG_TIP
-      
-      Set when the constraint operates on the head of the bone and not the tail
-      
-      :value: 1
-      
-   .. data:: CONSTRAINT_IK_FLAG_ROT
-      
-      Set when the constraint tries to match the orientation of the target
-      
-      :value: 2
-      
-   .. data:: CONSTRAINT_IK_FLAG_STRETCH
-      
-      Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
-      
-      :value: 16
-      
-   .. data:: CONSTRAINT_IK_FLAG_POS
-      
-      Set when the constraint tries to match the position of the target.
-      
-      :value: 32
-      
-   .. _armatureconstraint-constants-ik-mode:
-
-   Constants related to :data:`ik_mode`
-   
-   .. data:: CONSTRAINT_IK_MODE_INSIDE
-      
-      The constraint tries to keep the bone within ik_dist of target
-      
-      :value: 0
-      
-   .. data:: CONSTRAINT_IK_MODE_OUTSIDE
-      
-      The constraint tries to keep the bone outside ik_dist of the target
-      
-      :value: 1
-      
-   .. data:: CONSTRAINT_IK_MODE_ONSURFACE
-      
-      The constraint tries to keep the bone exactly at ik_dist of the target.
-      
-      :value: 2
       
    .. attribute:: type
 
@@ -4923,16 +4927,6 @@ Types
    Proxy to armature pose channel. Allows to read and set armature pose.
    The attributes are identical to RNA attributes, but mostly in read-only mode.
 
-   See :data:`rotation_mode`
-
-   .. data:: PCHAN_ROT_QUAT
-   .. data:: PCHAN_ROT_XYZ
-   .. data:: PCHAN_ROT_XZY
-   .. data:: PCHAN_ROT_YXZ
-   .. data:: PCHAN_ROT_YZX
-   .. data:: PCHAN_ROT_ZXY
-   .. data:: PCHAN_ROT_ZYX
-
    .. attribute:: name
 
       channel name (=bone name), read-only.
@@ -5066,17 +5060,7 @@ Types
 
       Method of updating the bone rotation, read-write.
 
-      :type: integer
-
-      Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed).
-
-      * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
-      * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
-      * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
-      * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
-      * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
-      * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
-      * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
+      :type: integer (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
 
    .. attribute:: channel_matrix
 
diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst
index 9f7817c..fc4524b 100644
--- a/doc/python_api/rst/bgl.rst
+++ b/doc/python_api/rst/bgl.rst
@@ -689,7 +689,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
 
    Return the specified pixel map
 
-   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPixelMap.xml>`_
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPixelMap.xml>`_
 
    :type map:  Enumerated constant
    :arg map: Specifies the name of the pixel map to return.
@@ -701,7 +701,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
 
    Return the polygon stipple pattern
 
-   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPolygonStipple.xml>`_
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPolygonStipple.xml>`_
 
    :type mask: :class:`bgl.Buffer` object I{type GL_BYTE}
    :arg mask: Returns the stipple pattern. The initial value is all 1's.
@@ -824,13 +824,25 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
 
    Set the current color index
 
-   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIndex.xml>`_
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndex.xml>`_
 
    :type c: :class:`bgl.Buffer` object. Depends on function prototype.
    :arg c: Specifies a pointer to a one element array that contains the new value for
       the current color index.
 
 
+.. function:: glIndexMask(mask):
+
+   Control the writing of individual bits in the color index buffers
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndexMask.xml>`_
+
+   :type mask: int
+   :arg mask: Specifies a bit mask to enable and disable the writing of individual bits
+      in the color index buffers.
+      Initially, the mask is all 1's.
+
+
 .. function:: glInitNames():
 
    Initialize the name stack
@@ -1510,7 +1522,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
    :arg mode: Specifies a symbolic value representing a shading technique.
 
 
-.. function:: glStencilFuc(func, ref, mask):
+.. function:: glStencilFunc(func, ref, mask):
 
    Set function and reference value for stencil testing
 
@@ -1835,7 +1847,238 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
    :arg objx, objy, objz: Return the computed object coordinates.
 
 
-class Buffer:
+.. function:: glUseProgram(program):
+
+   Installs a program object as part of current rendering state
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
+
+
+.. function:: glValidateProgram(program):
+
+   Validates a program object
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies the handle of the program object to be validated.
+
+
+.. function:: glLinkProgram(program):
+
+   Links a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glLinkProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies the handle of the program object to be linked.
+
+
+.. function:: glActiveTexture(texture):
+
+   Select active texture unit.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml>`_
+
+   :type texture: int
+   :arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
+
+
+.. function:: glAttachShader(program, shader):
+
+   Attaches a shader object to a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glAttachShader.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object to which a shader object will be attached.
+   :type shader: int
+   :arg shader: Specifies the shader object that is to be attached.
+
+
+.. function:: glCompileShader(shader):
+
+   Compiles a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies the shader object to be compiled.
+
+
+.. function:: glCreateProgram():
+
+   Creates a program object
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml>`_
+
+   :rtype: int
+   :return: The new program or zero if an error occurs.
+
+
+.. function:: glCreateShader(shaderType):
+
+   Creates a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml>`_
+
+   :type shaderType: Specifies the type of shader to be created.
+      Must be one of ``GL_VERTEX_SHADER``,
+      ``GL_TESS_CONTROL_SHADER``,
+      ``GL_TESS_EVALUATION_SHADER``,
+      ``GL_GEOMETRY_SHADER``,
+      or ``GL_FRAGMENT_SHADER``.
+   :arg shaderType:
+   :rtype: int
+   :return: 0 if an error occurs.
+
+
+.. function:: glDeleteProgram(program):
+
+   Deletes a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object to be deleted.
+
+
+.. function:: glDeleteShader(shader):
+
+   Deletes a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies the shader object to be deleted.
+
+
+.. function:: glDetachShader(program, shader):
+
+   Detaches a shader object from a program object to which it is attached.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object from which to detach the shader object.
+   :type shader: int
+   :arg shader: pecifies the program object from which to detach the shader object.
+
+
+.. function:: glGetAttachedShaders(program, maxCount, count, shaders):
+
+   Returns the handles of the shader objects attached to a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetAttachedShaders.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object to be queried.
+   :type maxCount: int
+   :arg maxCount: Specifies the size of the array for storing the returned object names.
+   :type count: :class:`bgl.Buffer` int buffer.
+   :arg count: Returns the number of names actually returned in objects.
+   :type shaders: :class:`bgl.Buffer` int buffer.
+   :arg shaders: Specifies an array that is used to return the names of attached shader objects.
+
+
+.. function:: glGetProgramInfoLog(program, maxLength, length, infoLog):
+
+   Returns the information log for a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object whose information log is to be queried.
+   :type maxLength: int
+   :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+   :type length: :class:`bgl.Buffer` int buffer.
+   :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+   :type infoLog: :class:`bgl.Buffer` char buffer.
+   :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetShaderInfoLog(program, maxLength, length, infoLog):
+
+   Returns the information log for a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies the shader object whose information log is to be queried.
+   :type maxLength: int
+   :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+   :type length: :class:`bgl.Buffer` int buffer.
+   :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+   :type infoLog: :class:`bgl.Buffer` char buffer.
+   :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetProgramiv(program, pname, params):
+
+   Returns a parameter from a program object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies the program object to be queried.
+   :type pname: int
+   :arg pname: Specifies the object parameter.
+   :type params: :class:`bgl.Buffer` int buffer.
+   :arg params: Returns the requested object parameter.
+
+
+.. function:: glIsShader(shader):
+
+   Determines if a name corresponds to a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsShader.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies a potential shader object.
+
+
+.. function:: glIsProgram(program):
+
+   Determines if a name corresponds to a program object
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsProgram.xml>`_
+
+   :type program: int
+   :arg program: Specifies a potential program object.
+
+
+.. function:: glGetShaderSource(shader, bufSize, length, source):
+
+   Returns the source code string from a shader object
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderSource.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies the shader object to be queried.
+   :type bufSize: int
+   :arg bufSize: Specifies the size of the character buffer for storing the returned source code string.
+   :type length: :class:`bgl.Buffer` int buffer.
+   :arg length: Returns the length of the string returned in source (excluding the null terminator).
+   :type source: :class:`bgl.Buffer` char.
+   :arg source: Specifies an array of characters that is used to return the source code string.
+   
+
+.. function:: glShaderSource(shader, shader_string):
+
+   Replaces the source code in a shader object.
+
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glShaderSource.xml>`_
+
+   :type shader: int
+   :arg shader: Specifies the handle of the shader object whose source code is to be replaced.
+   :type shader_string: string
+   :arg shader_string: The shader string.
+
+
+.. class:: Buffer
 
    The Buffer object is simply a block of memory that is delineated and initialized by the
    user. Many OpenGL functions return data to a C-style pointer, however, because this
diff --git a/doc/python_api/rst/gpu.rst b/doc/python_api/rst/gpu.rst
index 68dc30b..a225829 100644
--- a/doc/python_api/rst/gpu.rst
+++ b/doc/python_api/rst/gpu.rst
@@ -262,10 +262,16 @@ The calculation of some of the uniforms is based on matrices available in the sc
 
 .. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
 
+   The uniform is an float representing the bumpmap scaling.
+
+   :value: 14
+
+.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
+
    The uniform is an integer representing a shadow buffer corresponding to a lamp
    casting shadow.
 
-   :value: 14
+   :value: 15
 
 
 GLSL attribute type
diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst
index a55bf71..ef4a1c2 100644
--- a/doc/python_api/rst/include__bmesh.rst
+++ b/doc/python_api/rst/include__bmesh.rst
@@ -4,6 +4,13 @@
    ./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
 
 
+Submodules:
+
+* :mod:`bmesh.ops`
+* :mod:`bmesh.types`
+* :mod:`bmesh.utils`
+
+
 Intro
 -----
 
@@ -35,7 +42,6 @@ For an overview of BMesh data types and how they reference each other see:
    TODO items are...
 
    * add access to BMesh **walkers**
-   * add api for calling BMesh operators (unrelated to bpy.ops)
    * add custom-data manipulation functions add/remove/rename.
 
 Example Script
diff --git a/doc/python_api/rst/info_api_reference.rst b/doc/python_api/rst/info_api_reference.rst
new file mode 100644
index 0000000..ddee46d
--- /dev/null
+++ b/doc/python_api/rst/info_api_reference.rst
@@ -0,0 +1,305 @@
+
+*******************
+Reference API Usage
+*******************
+
+Blender has many interlinking data types which have an auto-generated reference api which often has the information
+you need to write a script, but can be difficult to use.
+
+This document is designed to help you understand how to use the reference api.
+
+
+Reference API Scope
+===================
+
+The reference API covers :mod:`bpy.types`, which stores types accessed via :mod:`bpy.context` - *The user context*
+or :mod:`bpy.data` - *Blend file data*.
+
+Other modules such as :mod:`bge`, :mod:`bmesh` and :mod:`aud` are not using Blenders data API
+so this document doesn't apply to those modules.
+
+
+Data Access
+===========
+
+The most common case for using the reference API is to find out how to access data in the blend file.
+
+Before going any further its best to be aware of ID Data-Blocks in Blender since you will often find properties
+relative to them.
+
+
+ID Data
+-------
+
+ID Data-Blocks are used in Blender as top-level data containers.
+
+From the user interface this isn't so obvious, but when developing you need to know about ID Data-Blocks.
+
+ID data types include Scene, Group, Object, Mesh, Screen, World, Armature, Image and Texture.
+for a full list see the sub-classes of :class:`bpy.types.ID`
+
+Here are some characteristics ID Data-Blocks share.
+
+- ID's are blend file data, so loading a new blend file reloads an entire new set of Data-Blocks.
+- ID's can be accessed in Python from ``bpy.data.*``
+- Each data-block has a unique ``.name`` attribute, displayed in the interface.
+- Animation data is stored in ID's ``.animation_data``.
+- ID's are the only data types that can be linked between blend files.
+- ID's can be added/copied and removed via Python.
+- ID's have their own garbage-collection system which frees unused ID's when saving.
+- When a data-block has a reference to some external data, this is typically an ID Data-Block.
+
+
+Simple Data Access
+------------------
+
+Lets start with a simple case, say you wan't a python script to adjust the objects location.
+
+Start by finding this setting in the interface ``Properties Window -> Object -> Transform -> Location``
+
+From the button you can right click and select **Online Python Reference**, this will link you to:
+:class:`bpy.types.Object.location`
+
+Being an API reference, this link often gives little more information then the tool-tip, though some of the pages
+include examples (normally at the top of the page).
+
+At this point you may say *Now what?* - you know that you have to use ``.location`` and that its an array of 3 floats
+but you're still left wondering how to access this in a script.
+
+So the next step is to find out where to access objects, go down to the bottom of the page to the **References**
+section, for objects there are many references, but one of the most common places to access objects is via the context.
+
+It's easy to be overwhelmed at this point since there ``Object`` get referenced in so many places - modifiers,
+functions, textures and constraints.
+
+But if you want to access any data the user has selected
+you typically only need to check the :mod:`bpy.context` references.
+
+Even then, in this case there are quite a few though if you read over these - most are mode specific.
+If you happen to be writing a tool that only runs in weight paint mode, then using ``weight_paint_object``
+would be appropriate.
+However to access an item the user last selected, look for the ``active`` members,
+Having access to a single active member the user selects is a convention in Blender: eg. ``active_bone``,
+``active_pose_bone``, ``active_node`` ... and in this case we can use - ``active_object``.
+
+
+So now we have enough information to find the location of the active object.
+
+.. code-block:: python
+
+   bpy.context.active_object.location
+
+You can type this into the python console to see the result.
+
+The other common place to access objects in the reference is :class:`bpy.types.BlendData.objects`.
+
+.. note::
+
+   This is **not** listed as :mod:`bpy.data.objects`,
+   this is because :mod:`bpy.data` is an instance of the :class:`bpy.types.BlendData` class,
+   so the documentation points there.
+
+
+With :mod:`bpy.data.objects`, this is a collection of objects so you need to access one of its members.
+
+.. code-block:: python
+
+   bpy.data.objects["Cube"].location
+
+
+Nested Properties
+-----------------
+
+The previous example is quite straightforward because ``location`` is a property of ``Object`` which can be accessed
+from the context directly.
+
+Here are some more complex examples:
+
+.. code-block:: python
+
+   # access a render layers samples
+   bpy.context.scene.render.layers["RenderLayer"].samples
+
+   # access to the current weight paint brush size
+   bpy.context.tool_settings.weight_paint.brush.size  
+
+   # check if the window is fullscreen
+   bpy.context.window.screen.show_fullscreen
+
+
+As you can see there are times when you want to access data which is nested
+in a way that causes you to go through a few indirections.
+
+The properties are arranged to match how data is stored internally (in blenders C code) which is often logical but
+not always quite what you would expect from using Blender.
+
+So this takes some time to learn, it helps you understand how data fits together in Blender which is important
+to know when writing scripts.
+
+
+When starting out scripting you will often run into the problem where you're not sure how to access the data you want.
+
+There are a few ways to do this.
+
+- Use the Python console's auto-complete to inspect properties. *This can be hit-and-miss but has the advantage
+  that you can easily see the values of properties and assign them to interactively see the results.*
+
+- Copy the Data-Path from the user interface. *Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
+
+- Using the documentation to follow references. *Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
+
+
+.. _info_data_path_copy
+
+Copy Data Path
+--------------
+
+Blender can compute the Python string to a property which is shown in the tool-tip, on the line below ``Python: ...``,
+This saves having to use the API reference to click back up the references to find where data is accessed from.
+
+There is a user-interface feature to copy the data-path which gives the path from an :class:`bpy.types.ID` data-block,
+to its property.
+
+To see how this works we'll get the path to the Subdivision-Surface modifiers subdivision setting.
+
+Start with the default scene and select the **Modifiers** tab, then add a **Subdivision-Surface** modifier to the cube.
+
+Now hover your mouse over the button labeled **View**, The tool-tip includes :class:`bpy.types.SubsurfModifier.levels`
+but we want the path from the object to this property.
+
+Note that the text copied won't include the ``bpy.data.collection["name"].`` component since its assumed that
+you won't be doing collection look-ups on every access and typically you'll want to use the context rather
+then access each :class:`bpy.types.ID` instance by name.
+
+
+Type in the ID path into a Python console :mod:`bpy.context.active_object`. Include the trailing dot and don't hit "enter", yet. 
+
+Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
+
+So now you should have the answer:
+
+.. code-block:: python
+
+   bpy.context.active_object.modifiers["Subsurf"].levels
+
+Hit "enter" and you'll get the current value of 1. Now try changing the value to 2:
+
+.. code-block:: python
+
+  bpy.context.active_object.modifiers["Subsurf"].levels = 2
+
+You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
+
+
+.. _info_data_path_indirect
+
+Indirect Data Access
+--------------------
+
+For this example we'll go over something more involved, showing the steps to access the active sculpt brushes texture.
+
+Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
+
+- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
+
+- From the toolbar expand the **Texture** panel and add a new texture.
+
+  *Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
+
+- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
+
+  - In the properties button select the Texture context.
+
+  - Select the Brush icon to show the brush texture.
+
+  - Expand the **Colors** panel to locate the **Contrast** button.
+
+- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast``
+
+- Now we can see that ``contrast`` is a property of texture, so next we'll check on how to access the texture from the brush.
+
+- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
+  some guess work to find the right one, but in this case its obviously ``Brush.texture``.
+
+  *Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
+  *but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
+
+- So the next step is to check on where brushes are accessed from via the **References**.
+  In this case there is simply ``bpy.context.brush`` which is all we need.
+  
+
+Now you can use the Python console to form the nested properties needed to access brush textures contrast,
+logically we now know.
+
+*Context -> Brush -> Texture -> Contrast*
+
+Since the attribute for each is given along the way we can compose the data path in the python console:
+
+.. code-block:: python
+
+   bpy.context.brush.texture.contrast
+
+
+There can be multiple ways to access the same data, which you choose often depends on the task.
+
+An alternate path to access the same setting is...
+
+.. code-block:: python
+
+   bpy.context.sculpt.brush.texture.contrast
+
+Or access the brush directly...
+
+.. code-block:: python
+
+   bpy.data.brushes["BrushName"].texture.contrast
+
+
+If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects
+the tool to operate on what they have selected.
+
+For automation you are more likely to use :mod:`bpy.data` since you want to be able to access specific data and manipulate
+it, no matter what the user currently has the view set at.
+
+
+Operators
+=========
+
+Most key-strokes and buttons in Blender call an operator which is also exposed to python via :mod:`bpy.ops`,
+
+To see the Python equivalent hover your mouse over the button and see the tool-tip,
+eg ``Python: bpy.ops.render.render()``,
+If there is no tool-tip or the ``Python:`` line is missing then this button is not using an operator and
+can't be accessed from Python.
+
+
+If you want to use this in a script you can press :kbd:`Control-C` while your mouse is over the button to copy it to the
+clipboard.
+
+You can also right click on the button and view the **Online Python Reference**, this mainly shows arguments and
+their defaults however operators written in Python show their file and line number which may be useful if you
+are interested to check on the source code.
+
+.. note::
+
+   Not all operators can be called usefully from Python, for more on this see :ref:`using operators <using_operators>`.
+
+
+Info View
+---------
+
+Blender records operators you run and displays them in the **Info** space.
+This is located above the file-menu which can be dragged down to display its contents.
+
+Select the **Script** screen that comes default with Blender to see its output.
+You can perform some actions and see them show up - delete a vertex for example.
+
+Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
+
+.. note::
+
+   Not all operators get registered for display,
+   zooming the view for example isn't so useful to repeat so its excluded from the output.
+
+   To display *every* operator that runs see :ref:`Show All Operators <info_show_all_operators>`
+
diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst
index 1d56121..34145c2 100644
--- a/doc/python_api/rst/info_gotcha.rst
+++ b/doc/python_api/rst/info_gotcha.rst
@@ -5,6 +5,8 @@ Gotchas
 This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability.
 
 
+.. _using_operators:
+
 Using Operators
 ===============
 
@@ -118,18 +120,19 @@ If you insist - yes its possible, but scripts that use this hack wont be conside
    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
 
 
-I can't edit the mesh in edit-mode!
-===================================
+Modes and Mesh Access
+=====================
 
-Blender's EditMesh is an internal data structure (not saved and not exposed to python), this gives the main annoyance that you need to exit edit-mode to edit the mesh from python.
+When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode. This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
 
-The reason we have not made much attempt to fix this yet is because we
-will likely move to BMesh mesh API eventually, so any work on the API now will be wasted effort.
+A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`) but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
 
-With the BMesh API we may expose mesh data to python so we can
-write useful tools in python which are also fast to execute while in edit-mode.
+In this situation you can...
 
-For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
+* Exit edit-mode before running the tool.
+* Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
+* Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
+* Report the context as incorrect and only allow the script to run outside edit-mode.
 
 
 .. _info_gotcha_mesh_faces:
@@ -311,7 +314,7 @@ Naming Limitations
 
 A common mistake is to assume newly created data is given the requested name.
 
-This can cause bugs when you add some data (normally imported) and then reference it later by name.
+This can cause bugs when you add some data (normally imported) then reference it later by name.
 
 .. code-block:: python
 
@@ -493,7 +496,7 @@ Heres an example of threading supported by Blender:
        t.join()
 
 
-This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs (Unsupported).
+This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs **(Unsupported)**.
 
 .. code-block:: python
 
@@ -516,7 +519,7 @@ So far, no work has gone into making Blender's python integration thread safe, s
 
 .. note::
 
-   Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with blender and make use of multiple CPU's too.
+   Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
 
 
 Help! My script crashes Blender
@@ -536,11 +539,18 @@ Here are some general hints to avoid running into these problems.
 
 * Crashes may not happen every time, they may happen more on some configurations/operating-systems.
 
+.. note::
+
+   To find the line of your script that crashes you can use the ``faulthandler`` module.
+   See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
+
+   While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash.
+
 
 Undo/Redo
 ---------
 
-Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh etc).
+Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Lamp... etc).
 
 This example shows how you can tell undo changes the memory locations.
 
@@ -557,6 +567,21 @@ This example shows how you can tell undo changes the memory locations.
 As suggested above, simply not holding references to data when Blender is used interactively by the user is the only way to ensure the script doesn't become unstable.
 
 
+Undo & Library Data
+^^^^^^^^^^^^^^^^^^^
+
+One of the advantages with Blenders library linking system that undo can skip checking changes in library data since it is assumed to be static.
+
+Tools in Blender are not allowed to modify library data.
+
+Python however does not enforce this restriction.
+
+This can be useful in some cases, using a script to adjust material values for example.
+But its also possible to use a script to make library data point to newly created local data, which is not supported since a call to undo will remove the local data but leave the library referencing it and likely crash.
+
+So it's best to consider modifying library data an advanced usage of the API and only to use it when you know what you're doing.
+
+
 Edit Mode / Memory Access
 -------------------------
 
@@ -616,15 +641,36 @@ Removing Data
 
 **Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
 
-This is a problem in the API at the moment that we should eventually solve.
+The ``remove()`` api calls will invalidate the data they free to prevent common mistakes.
+
+The following example shows how this precortion works.
+
+.. code-block:: python
+
+   mesh = bpy.data.meshes.new(name="MyMesh")
+   # normally the script would use the mesh here...
+   bpy.data.meshes.remove(mesh)
+   print(mesh.name)  # <- give an exception rather then crashing:
+
+   # ReferenceError: StructRNA of type Mesh has been removed
+
+
+But take care because this is limited to scripts accessing the variable which is removed, the next example will still crash.
+
+.. code-block:: python
+
+   mesh = bpy.data.meshes.new(name="MyMesh")
+   vertices = mesh.vertices
+   bpy.data.meshes.remove(mesh)
+   print(vertices)  # <- this may crash
 
 
 sys.exit
 ========
 
-Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately.
+Some python modules will call ``sys.exit()`` themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since ``sys.exit()`` will quit blender immediately.
 
 For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
 
-An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice.
+An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit`` with your own function but manipulating python in this way is bad practice.
 
diff --git a/doc/python_api/rst/info_overview.rst b/doc/python_api/rst/info_overview.rst
index 30c4521..b2d524b 100644
--- a/doc/python_api/rst/info_overview.rst
+++ b/doc/python_api/rst/info_overview.rst
@@ -1,3 +1,5 @@
+.. _info_overview:
+
 *******************
 Python API Overview
 *******************
@@ -71,7 +73,7 @@ The only difference between addons and built-in python modules is that addons mu
 
 The user preferences addon listing uses **bl_info** to display information about each addon.
 
-`See Addons <http://wiki.blender.org/index.php/Dev:2.6/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
+`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
 
 
 Integration through Classes
diff --git a/doc/python_api/rst/info_quickstart.rst b/doc/python_api/rst/info_quickstart.rst
index 19ec805..e1264ae 100644
--- a/doc/python_api/rst/info_quickstart.rst
+++ b/doc/python_api/rst/info_quickstart.rst
@@ -1,9 +1,11 @@
+.. _info_quickstart:
+
 ***********************
 Quickstart Introduction
 ***********************
 
-Intro
-=====
+Preface
+=======
 
 This API is generally stable but some areas are still being added and improved.
 
@@ -58,6 +60,22 @@ A quick list of helpful things to know before starting:
 * To examine further scripts distributed with Blender, see ``~/.blender/scripts/startup/bl_ui`` for the user interface and ``~/.blender/scripts/startup/bl_op`` for operators.
 
 
+Running Scripts
+---------------
+
+The two most common ways to execute python scripts are using the built-in text editor or entering commands in the python console.
+
+Both the **Text Editor** and **Python Console** are space types you can select from the view header.
+
+Rather then manually configuring your spaces for Python development, you may prefer to use the **Scripting** screen, included default with Blender, accessible from the top headers screen selector.
+
+From the text editor you can open ``.py`` files or paste then from the clipboard, then test using **Run Script**.
+
+The Python Console is typically used for typing in snippets and for testing to get immediate feedback, but can also have entire scripts pasted into it.
+
+Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
+
+
 Key Concepts
 ============
 
diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst
index 521031f..75e8ef6 100644
--- a/doc/python_api/rst/info_tips_and_tricks.rst
+++ b/doc/python_api/rst/info_tips_and_tricks.rst
@@ -44,15 +44,17 @@ if this can't be generated, only the property name is copied.
 
 .. note::
 
-   This uses the same method for creating the animation path used by :class:`FCurve.data_path` and :class:`DriverTarget.data_path` drivers.
+   This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers.
 
 
+.. _info_show_all_operators
+
 Show All Operators
 ==================
 
 While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
 
-However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug`` argument when starting blender or by setting :mod:`bpy.app.debug` to True while blender is running.
+However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running.
 
 
 Use an External Editor
@@ -218,6 +220,14 @@ The next example is an equivalent single line version of the script above which
 ``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
 
 
+If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
+
+.. code-block:: python
+
+   import IPython
+   IPython.embed()
+
+
 Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
 
 .. note::
diff --git a/doc/python_api/rst/info_tutorial_addon.rst b/doc/python_api/rst/info_tutorial_addon.rst
new file mode 100644
index 0000000..2a10104
--- /dev/null
+++ b/doc/python_api/rst/info_tutorial_addon.rst
@@ -0,0 +1,645 @@
+
+Addon Tutorial
+##############
+
+************
+Introduction
+************
+
+
+Intended Audience
+=================
+
+This tutorial is designed to help technical artists or developers learn to extend Blender.
+An understanding of the basics of Python is expected for those working through this tutorial.
+
+
+Prerequisites
+-------------
+
+Before going through the tutorial you should...
+
+* Familiarity with the basics of working in Blender.
+
+* Know how to run a script in Blender's text editor (as documented in the quick-start)
+
+* Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set).
+
+* Be familiar with the concept of Python modules.
+
+* Basic understanding of classes (object orientation) in Python.
+
+
+Suggested reading before starting this tutorial.
+
+* `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
+* :ref:`Blender API Quickstart <info_quickstart>`
+  to help become familiar with Blender/Python basics.
+
+
+To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal,
+see :ref:`Use The Terminal <use_the_terminal>`.
+
+Documentation Links
+===================
+
+While going through the tutorial you may want to look into our reference documentation.
+
+* :ref:`Blender API Overview <info_overview>`. -
+  *This document is rather detailed but helpful if you want to know more on a topic.*
+
+* :mod:`bpy.context` api reference. -
+  *Handy to have a list of available items your script may operate on.*
+
+* :class:`bpy.types.Operator`. -
+  *The following addons define operators, these docs give details and more examples of operators.*
+
+
+******
+Addons
+******
+
+
+What is an Addon?
+=================
+
+An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful
+information.
+
+To give an example, here is the simplest possible addon.
+
+
+.. code-block:: python
+
+   bl_info = {"name": "My Test Addon", "category": "Object"}
+   def register():
+       print("Hello World")
+   def unregister():
+       print("Goodbye World")
+
+
+* ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
+  user preferences addon list.
+* ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
+  activating the addon.
+* ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
+
+
+
+Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
+
+This is a contrived example of an addon that serves to illustrate the point
+that the base requirements of an addon are simple.
+
+An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
+when executed from the text editor or even the interactive console - there is nothing inherently different about an
+addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
+script to access.
+
+So an addon is just a way to encapsulate a Python module in a way a user can easily utilize.
+
+.. note::
+
+   Running this script within the text editor won't print anything,
+   to see the output it must be installed through the user preferences.
+   Messages will be printed when enabling and disabling.
+
+
+Your First Addon
+================
+
+The simplest possible addon above was useful as an example but not much else.
+This next addon is simple but shows how to integrate a script into Blender using an ``Operator``
+which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts.
+
+For the first example we'll make a script that simply moves all objects in a scene.
+
+
+Write The Script
+----------------
+
+Add the following script to the text editor in Blender.
+
+.. code-block:: python
+
+   import bpy
+
+   scene = bpy.context.scene
+   for obj in scene.objects:
+       obj.location.x += 1.0
+
+
+.. image:: run_script.png
+   :width: 924px
+   :align: center
+   :height: 574px
+   :alt: Run Script button
+
+Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit.
+Next we'll make this script into an addon.
+
+
+Write the Addon (Simple)
+------------------------
+
+This addon takes the body of the script above, and adds them to an operator's ``execute()`` function.
+
+
+.. code-block:: python
+
+   bl_info = {
+       "name": "Move X Axis",
+       "category": "Object",
+   }
+
+   import bpy
+
+
+   class ObjectMoveX(bpy.types.Operator):
+       """My Object Moving Script"""      # blender will use this as a tooltip for menu items and buttons.
+       bl_idname = "object.move_x"        # unique identifier for buttons and menu items to reference.
+       bl_label = "Move X by One"         # display name in the interface.
+       bl_options = {'REGISTER', 'UNDO'}  # enable undo for the operator.
+
+       def execute(self, context):        # execute() is called by blender when running the operator.
+
+           # The original script
+           scene = context.scene
+           for obj in scene.objects:
+               obj.location.x += 1.0
+
+           return {'FINISHED'}            # this lets blender know the operator finished successfully.
+
+   def register():
+       bpy.utils.register_class(ObjectMoveX)
+
+
+   def unregister():
+       bpy.utils.unregister_class(ObjectMoveX)
+
+
+   # This allows you to run the script directly from blenders text editor
+   # to test the addon without having to install it.
+   if __name__ == "__main__":
+       register()
+
+
+.. note:: ``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
+
+.. note:: Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``.
+          In most cases these will be the same however in some cases operators will be passed a custom context
+          so script authors should prefer the ``context`` argument passed to operators.
+   
+
+To test the script you can copy and paste this into Blender text editor and run it, this will execute the script
+directly and call register immediately.
+
+However running the script wont move any objects, for this you need to execute the newly registered operator.
+
+.. image:: spacebar.png
+   :width: 924px
+   :align: center
+   :height: 574px
+   :alt: Spacebar
+
+Do this by pressing ``SpaceBar`` to bring up the operator search dialog and type in "Move X by One" (the ``bl_label``),
+then press ``Enter``.
+
+
+
+The objects should move as before.
+
+*Keep this addon open in Blender for the next step - Installing.*
+
+Install The Addon
+-----------------
+
+Once you have your addon within in Blender's text editor, you will want to be able to install it so it can be enabled in
+the user preferences to load on startup.
+
+Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
+
+To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming
+restrictions that apply to Python modules and end with a ``.py`` extension.
+
+Once the file is on disk, you can install it as you would for an addon downloaded online.
+
+Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file. 
+
+Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart,
+press **Save as Default**.
+
+.. note::
+
+   The destination of the addon depends on your Blender configuration.
+   When installing an addon the source and destination path are printed in the console.
+   You can also find addon path locations by running this in the Python console.
+
+   .. code-block:: python
+
+      import addon_utils
+      print(addon_utils.paths())
+
+   More is written on this topic here:
+   `Directory Layout <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
+
+
+Your Second Addon
+=================
+
+For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a
+similar way to what you may have seen with the array modifier.
+
+
+Write The Script
+----------------
+
+As before, first we will start with a script, develop it, then convert into an addon.
+
+.. code-block:: python
+
+   import bpy
+   from bpy import context
+
+   # Get the current scene
+   scene = context.scene
+
+   # Get the 3D cursor
+   cursor = scene.cursor_location
+
+   # Get the active object (assume we have one)
+   obj = scene.objects.active
+
+   # Now make a copy of the object
+   obj_new = obj.copy()
+
+   # The object won't automatically get into a new scene
+   scene.objects.link(obj_new)
+
+   # Now we can place the object
+   obj_new.location = cursor
+
+
+Now try copy this script into Blender and run it on the default cube.
+Make sure you click to move the 3D cursor before running as the duplicate will appear at the cursor's location.
+
+
+... go off and test ...
+
+
+After running, notice that when you go into edit-mode to change the cube - all of the copies change,
+in Blender this is known as *Linked-Duplicates*.
+
+
+Next, we're going to do this in a loop, to make an array of objects between the active object and the cursor.
+
+
+.. code-block:: python
+
+   import bpy
+   from bpy import context
+
+   scene = context.scene
+   cursor = scene.cursor_location
+   obj = scene.objects.active
+
+   # Use a fixed value for now, eventually make this user adjustable
+   total = 10
+
+   # Add 'total' objects into the scene
+   for i in range(total):
+       obj_new = obj.copy()
+       scene.objects.link(obj_new)
+
+       # Now place the object in between the cursor
+       # and the active object based on 'i'
+       factor = i / total
+       obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
+
+
+Try run this script with with the active object and the cursor spaced apart to see the result.
+
+With this script you'll notice we're doing some math with the object location and cursor, this works because both are
+3D :class:`mathutils.Vector` instances, a convenient class provided by the :mod:`mathutils` module and
+allows vectors to be multiplied by numbers and matrices.
+
+If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions
+such as getting the angle between vectors, cross product, dot products
+as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and
+ray-triangle intersection.
+
+For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and
+can help you with more advanced functionality later on.
+
+
+Write the Addon
+---------------
+
+The first step is to convert the script as-is into an addon.
+
+
+.. code-block:: python
+
+   bl_info = {
+       "name": "Cursor Array",
+       "category": "Object",
+   }
+
+   import bpy
+
+
+   class ObjectCursorArray(bpy.types.Operator):
+       """Object Cursor Array"""
+       bl_idname = "object.cursor_array"
+       bl_label = "Cursor Array"
+       bl_options = {'REGISTER', 'UNDO'}
+
+       def execute(self, context):
+           scene = context.scene
+           cursor = scene.cursor_location
+           obj = scene.objects.active
+
+           total = 10
+
+           for i in range(total):
+               obj_new = obj.copy()
+               scene.objects.link(obj_new)
+
+               factor = i / total
+               obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
+
+           return {'FINISHED'}
+
+   def register():
+       bpy.utils.register_class(ObjectCursorArray)
+
+
+   def unregister():
+       bpy.utils.unregister_class(ObjectCursorArray)
+
+
+   if __name__ == "__main__":
+       register()
+
+
+Everything here has been covered in the previous steps, you may want to try run the addon still
+and consider what could be done to make it more useful.
+
+
+... go off and test ...
+
+
+The two of the most obvious missing things are - having the total fixed at 10, and having to access the operator from
+space-bar is not very convenient.
+
+Both these additions are explained next, with the final script afterwards.
+
+
+Operator Property
+^^^^^^^^^^^^^^^^^
+
+There are a variety of property types that are used for tool settings, common property types include:
+int, float, vector, color, boolean and string.
+
+These properties are handled differently to typical Python class attributes
+because Blender needs to be display them in the interface,
+store their settings in key-maps and keep settings for re-use.
+
+While this is handled in a fairly Pythonic way, be mindful that you are in fact defining tool settings that
+are loaded into Blender and accessed by other parts of Blender, outside of Python.
+
+
+To get rid of the literal 10 for `total`, we'll us an operator property.
+Operator properties are defined via bpy.props module, this is added to the class body.
+
+.. code-block:: python
+
+   # moved assignment from execute() to the body of the class...
+   total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
+
+   # and this is accessed on the class
+   # instance within the execute() function as...
+   self.total
+
+
+These properties from :mod:`bpy.props` are handled specially by Blender when the class is registered
+so they display as buttons in the user interface.
+There are many arguments you can pass to properties to set limits, change the default and display a tooltip.
+
+.. seealso:: :mod:`bpy.props.IntProperty`
+
+This document doesn't go into details about using other property types,
+however the link above includes examples of more advanced property usage.
+
+
+Menu Item
+^^^^^^^^^
+
+Addons can add to the user interface of existing panels, headers and menus defined in Python.
+
+For this example we'll add to an existing menu.
+
+.. image:: menu_id.png
+   :width: 334px
+   :align: center
+   :height: 128px
+   :alt: Menu Identifier
+
+To find the identifier of a menu you can hover your mouse over the menu item and the identifier is displayed.
+
+The method used for adding a menu item is to append a draw function into an existing class.
+
+
+.. code-block:: python
+
+   def menu_func(self, context):
+       self.layout.operator(ObjectCursorArray.bl_idname)
+
+   def register():
+       bpy.types.VIEW3D_MT_object.append(menu_func)
+
+
+For docs on extending menus see: :doc:`bpy.types.Menu`.
+
+
+Keymap
+^^^^^^
+
+In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps.
+
+In the example below, a new object-mode :class:`bpy.types.KeyMap` is added,
+then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator,
+using :kbd:`Ctrl-Shift-Space` as the key shortcut to activate it.
+
+
+.. code-block:: python
+
+   # store keymaps here to access after registration
+   addon_keymaps = []
+
+   def register():
+
+       # handle the keymap
+       wm = bpy.context.window_manager
+       km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
+
+       kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
+       kmi.properties.total = 4
+
+       addon_keymaps.append(km)
+
+
+   def unregister():
+
+       # handle the keymap
+       wm = bpy.context.window_manager
+       for km in addon_keymaps:
+           wm.keyconfigs.addon.keymaps.remove(km)
+       # clear the list
+       addon_keymaps.clear()
+
+
+Notice how the key-map item can have a different ``total`` setting then the default set by the operator,
+this allows you to have multiple keys accessing the same operator with different settings.
+
+
+.. note::
+
+   While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't
+   overwrite each others keymaps, At least take care when assigning keys that they don't
+   conflict with important functionality within Blender.
+
+For API documentation on the functions listed above, see:
+:class:`bpy.types.KeyMaps.new`,
+:class:`bpy.types.KeyMap`,
+:class:`bpy.types.KeyMapItems.new`,
+:class:`bpy.types.KeyMapItem`.
+
+
+Bringing it all together
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. code-block:: python
+
+   bl_info = {
+       "name": "Cursor Array",
+       "category": "Object",
+   }
+
+   import bpy
+
+
+   class ObjectCursorArray(bpy.types.Operator):
+       """Object Cursor Array"""
+       bl_idname = "object.cursor_array"
+       bl_label = "Cursor Array"
+       bl_options = {'REGISTER', 'UNDO'}
+
+       total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
+
+       def execute(self, context):
+           scene = context.scene
+           cursor = scene.cursor_location
+           obj = scene.objects.active
+
+           for i in range(self.total):
+               obj_new = obj.copy()
+               scene.objects.link(obj_new)
+
+               factor = i / self.total
+               obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
+
+           return {'FINISHED'}
+
+
+   def menu_func(self, context):
+       self.layout.operator(ObjectCursorArray.bl_idname)
+
+   # store keymaps here to access after registration
+   addon_keymaps = []
+
+
+   def register():
+       bpy.utils.register_class(ObjectCursorArray)
+       bpy.types.VIEW3D_MT_object.append(menu_func)
+
+       # handle the keymap
+       wm = bpy.context.window_manager
+       km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
+       kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
+       kmi.properties.total = 4
+       addon_keymaps.append(km)
+
+   def unregister():
+       bpy.utils.unregister_class(ObjectCursorArray)
+       bpy.types.VIEW3D_MT_object.remove(menu_func)
+
+       # handle the keymap
+       wm = bpy.context.window_manager
+       for km in addon_keymaps:
+           wm.keyconfigs.addon.keymaps.remove(km)
+       # clear the list
+       del addon_keymaps[:]
+
+
+   if __name__ == "__main__":
+       register()
+
+.. image:: in_menu.png
+   :width: 591px
+   :align: center
+   :height: 649px
+   :alt: In the menu
+
+Run the script (or save it and add it through the Preferences like before) and it will appear in the menu.
+
+.. image:: op_prop.png
+   :width: 669px
+   :align: center
+   :height: 644px
+   :alt: Operator Property
+
+After selecting it from the menu, you can choose how many instance of the cube you want created.
+
+
+.. note::
+
+   Directly executing the script multiple times will add the menu each time too.
+   While not useful behavior, theres nothing to worry about since addons won't register them selves multiple
+   times when enabled through the user preferences.
+
+
+Conclusions
+===========
+
+Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
+for others to use.
+
+While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without
+having to dive into Blender's C/C++ code.
+
+The example given in the tutorial is limited, but shows the Blender API used for common tasks that you can expand on
+to write your own tools.
+
+
+Further Reading
+---------------
+
+Blender comes commented templates which are accessible from the text editor header, if you have specific areas
+you want to see example code for, this is a good place to start.
+
+
+Here are some sites you might like to check on after completing this tutorial.
+
+* :ref:`Blender/Python API Overview <info_overview>` -
+  *For more background details on Blender/Python integration.*
+
+* `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
+  *Great info for those who are still learning Python.*
+
+* `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
+  *Blender Development, general information and helpful links.*
+
+* `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
+  *forum where people ask Python development questions*
+
diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py
new file mode 100644
index 0000000..c1b6643
--- /dev/null
+++ b/doc/python_api/rst_from_bmesh_opdefines.py
@@ -0,0 +1,380 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# This is a quite stupid script which extracts bmesh api docs from
+# 'bmesh_opdefines.c' in order to avoid having to add a lot of introspection
+# data access into the api.
+#
+# The script is stupid becase it makes assumptions about formatting...
+# that each arg has its own line, that comments above or directly after will be __doc__ etc...
+#
+# We may want to replace this script with something else one day but for now its good enough.
+# if it needs large updates it may be better to rewrite using a real parser or
+# add introspection into bmesh.ops.
+# - campbell
+
+import os
+
+CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
+SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(CURRENT_DIR, "..", ".."))))
+FILE_OP_DEFINES_C = os.path.join(SOURCE_DIR, "source", "blender", "bmesh", "intern", "bmesh_opdefines.c")
+OUT_RST = os.path.join(CURRENT_DIR, "rst", "bmesh.ops.rst")
+
+HEADER = r"""
+BMesh Operators (bmesh.ops)
+===========================
+
+.. module:: bmesh.ops
+
+This module gives access to low level bmesh operations.
+
+Most operators take input and return output, they can be chained together
+to perform useful operations.
+
+.. note::
+
+   This API us new in 2.65 and not yet well tested.
+
+
+Operator Example
+++++++++++++++++
+This script shows how operators can be used to model a link of a chain.
+
+.. literalinclude:: ../examples/bmesh.ops.1.py
+"""
+
+
+def main():
+    fsrc = open(FILE_OP_DEFINES_C, 'r', encoding="utf-8")
+
+    blocks = []
+    
+    is_block = False
+    is_comment = False  # /* global comments only */
+    
+    comment_ctx = None
+    block_ctx = None
+
+    for l in fsrc:
+        l = l[:-1]
+        # weak but ok
+        if ("BMOpDefine" in l and l.split()[1] == "BMOpDefine") and not "bmo_opdefines[]" in l:
+            is_block = True
+            block_ctx = []
+            blocks.append((comment_ctx, block_ctx))
+        elif l.strip().startswith("/*"):
+            is_comment = True
+            comment_ctx = []
+        
+        if is_block:
+            if l.strip().startswith("//"):
+                pass
+            else:
+                # remove c++ comment if we have one
+                cpp_comment = l.find("//")
+                if cpp_comment != -1:
+                    l = l[:cpp_comment]
+
+                block_ctx.append(l)
+            
+            if l.strip() == "};":
+                is_block = False
+                comment_ctx = None
+        
+        if is_comment:
+            c_comment_start = l.find("/*")
+            if c_comment_start != -1:
+                l = l[c_comment_start + 2:]
+
+            c_comment_end = l.find("*/")
+            if c_comment_end != -1:
+                l = l[:c_comment_end]
+
+                is_comment = False
+            comment_ctx.append(l)
+
+    fsrc.close()
+    del fsrc
+
+
+   # namespace hack
+    vars = (
+        "BMO_OP_SLOT_ELEMENT_BUF",
+        "BMO_OP_SLOT_BOOL",
+        "BMO_OP_SLOT_FLT",
+        "BMO_OP_SLOT_INT",
+        "BMO_OP_SLOT_MAT",
+        "BMO_OP_SLOT_VEC",
+        "BMO_OP_SLOT_PTR",
+        "BMO_OP_SLOT_MAPPING",
+        
+        "BMO_OP_SLOT_SUBTYPE_MAP_ELEM",
+        "BMO_OP_SLOT_SUBTYPE_MAP_BOOL",
+        "BMO_OP_SLOT_SUBTYPE_MAP_INT",
+        "BMO_OP_SLOT_SUBTYPE_MAP_FLT",
+        "BMO_OP_SLOT_SUBTYPE_MAP_EMPTY",
+        "BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL",
+
+        "BMO_OP_SLOT_SUBTYPE_PTR_SCENE",
+        "BMO_OP_SLOT_SUBTYPE_PTR_OBJECT",
+        "BMO_OP_SLOT_SUBTYPE_PTR_MESH",
+        "BMO_OP_SLOT_SUBTYPE_PTR_BMESH",
+
+        "BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE",
+
+        "BM_VERT",
+        "BM_EDGE",
+        "BM_FACE",
+
+        "BMO_OP_FLAG_UNTAN_MULTIRES",
+    )
+    vars_dict = {}
+    for i, v in enumerate(vars):
+        vars_dict[v] = (1 << i)
+    globals().update(vars_dict)
+    # reverse lookup
+    vars_dict_reverse = {v: k for k, v in vars_dict.items()}
+    # end namespace hack
+
+    blocks_py = []
+    for comment, b in blocks:
+        # magic, translate into python
+        b[0] = b[0].replace("static BMOpDefine ", "")
+        
+        for i, l in enumerate(b):
+            l = l.strip()
+            l = l.replace("{", "(")
+            l = l.replace("}", ")")
+            
+            if l.startswith("/*"):
+                l = l.replace("/*", "'''own <")
+            else:
+                l = l.replace("/*", "'''inline <")
+            l = l.replace("*/", ">''',")
+            
+            # exec func. eg: bmo_rotate_edges_exec,
+            if l.startswith("bmo_") and l.endswith("_exec,"):
+                l = "None,"
+            b[i] = l
+            
+        #for l in b:
+        #    print(l)
+
+        text = "\n".join(b)
+        global_namespace = {
+            "__file__": "generated",
+            "__name__": "__main__",
+        }
+        
+        global_namespace.update(vars_dict)
+
+        text_a, text_b = text.split("=", 1)
+        text = "result = " + text_b
+        exec(compile(text, "generated", 'exec'), global_namespace)
+        # print(global_namespace["result"])
+        blocks_py.append((comment, global_namespace["result"]))
+
+
+    # ---------------------
+    # Now convert into rst.
+    fout = open(OUT_RST, 'w', encoding="utf-8")
+    fw = fout.write
+    fw(HEADER)
+    for comment, b in blocks_py:
+        args_in = None
+        args_out = None
+        for member in b[1:]:
+            if type(member) == tuple:
+                if args_in is None:
+                    args_in = member
+                elif args_out is None:
+                    args_out = member
+                    break
+
+        args_in_index = []
+        args_out_index = []
+
+        if args_in is not None:
+            args_in_index[:] = [i for (i, a) in enumerate(args_in) if type(a) == tuple]
+        if args_out is not None:
+            args_out_index[:] = [i for (i, a) in enumerate(args_out) if type(a) == tuple]
+
+        fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", ".join([args_in[i][0] for i in args_in_index])))
+        
+        # -- wash the comment
+        comment_washed = []
+        for i, l in enumerate(comment):
+            assert((l.strip() == "") or
+                   (l in {"/*", " *"}) or
+                   (l.startswith(("/* ", " * "))))
+
+            l = l[3:]
+            if i == 0 and not l.strip():
+                continue
+            if l.strip():
+                l = "   " + l
+            comment_washed.append(l)
+
+        fw("\n".join(comment_washed))
+        fw("\n")
+        # -- done
+
+
+        # get the args
+        def get_args_wash(args, args_index, is_ret):
+            args_wash = []
+            for i in args_index:
+                arg = args[i]
+                if len(arg) == 3:
+                    name, tp, tp_sub = arg
+                elif len(arg) == 2:
+                    name, tp = arg
+                    tp_sub = None
+                else:
+                    print(arg)
+                    assert(0)
+
+                tp_str = ""
+
+                comment_prev = ""
+                comment_next = ""
+                if i != 0:
+                    comment_prev = args[i + 1]
+                    if type(comment_prev) == str and comment_prev.startswith("our <"):
+                        comment_prev = comment_next[5:-1]  # strip inline <...>
+                    else:
+                        comment_prev = ""
+
+                if i + 1 < len(args):
+                    comment_next = args[i + 1]
+                    if type(comment_next) == str and comment_next.startswith("inline <"):
+                        comment_next = comment_next[8:-1]  # strip inline <...>
+                    else:
+                        comment_next = ""
+                        
+                comment = ""
+                if comment_prev:
+                    comment += comment_prev.strip()
+                if comment_next:
+                    comment += ("\n" if comment_prev else "") + comment_next.strip()
+
+                if tp == BMO_OP_SLOT_FLT:
+                    tp_str = "float"
+                elif tp == BMO_OP_SLOT_INT:
+                    tp_str = "int"
+                elif tp == BMO_OP_SLOT_BOOL:
+                    tp_str = "bool"
+                elif tp == BMO_OP_SLOT_MAT:
+                    tp_str = ":class:`mathutils.Matrix`"
+                elif tp == BMO_OP_SLOT_VEC:
+                    tp_str = ":class:`mathutils.Vector`"
+                    if not is_ret:
+                        tp_str += " or any sequence of 3 floats"
+                elif tp == BMO_OP_SLOT_PTR:
+                    tp_str = "dict"
+                    assert(tp_sub is not None)
+                    if tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_BMESH:
+                        tp_str = ":class:`bmesh.types.BMesh`"
+                    elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_SCENE:
+                        tp_str = ":class:`bpy.types.Scene`"
+                    elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_OBJECT:
+                        tp_str = ":class:`bpy.types.Object`"
+                    elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_MESH:
+                        tp_str = ":class:`bpy.types.Mesh`"
+                    else:
+                        print("Cant find", vars_dict_reverse[tp_sub])
+                        assert(0)
+
+                elif tp == BMO_OP_SLOT_ELEMENT_BUF:
+                    assert(tp_sub is not None)
+                    
+                    ls = []
+                    if tp_sub & BM_VERT: ls.append(":class:`bmesh.types.BMVert`")
+                    if tp_sub & BM_EDGE: ls.append(":class:`bmesh.types.BMEdge`")
+                    if tp_sub & BM_FACE: ls.append(":class:`bmesh.types.BMFace`")
+                    assert(ls)  # must be at least one
+
+                    if tp_sub & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE:
+                        tp_str = "/".join(ls)
+                    else:
+                        tp_str = ("list of (%s)" % ", ".join(ls))
+                        
+                    del ls
+                elif tp == BMO_OP_SLOT_MAPPING:
+                    if tp_sub & BMO_OP_SLOT_SUBTYPE_MAP_EMPTY:
+                        tp_str = "set of vert/edge/face type"
+                    else:
+                        tp_str = "dict mapping vert/edge/face types to "
+                        if tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_BOOL:
+                            tp_str += "bool"
+                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INT:
+                            tp_str += "int"
+                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_FLT:
+                            tp_str += "float"
+                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
+                            tp_str += ":class:`bmesh.types.BMVert`/:class:`bmesh.types.BMEdge`/:class:`bmesh.types.BMFace`"
+                        elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
+                            tp_str += "unknown internal data, not compatible with python"
+                        else:
+                            print("Cant find", vars_dict_reverse[tp_sub])
+                            assert(0)
+                else:
+                    print("Cant find", vars_dict_reverse[tp])
+                    assert(0)
+
+                args_wash.append((name, tp_str, comment))
+            return args_wash
+        # end get_args_wash
+
+        # all ops get this arg
+        fw("   :arg bm: The bmesh to operate on.\n")
+        fw("   :type bm: :class:`bmesh.types.BMesh`\n")
+
+        args_in_wash = get_args_wash(args_in, args_in_index, False)
+        args_out_wash = get_args_wash(args_out, args_out_index, True)
+
+        for (name, tp, comment) in args_in_wash:
+            if comment == "":
+                comment = "Undocumented."
+
+            fw("   :arg %s: %s\n" % (name, comment))
+            fw("   :type %s: %s\n" % (name, tp))
+        
+        if args_out_wash:
+            fw("   :return:\n\n")
+            
+            for (name, tp, comment) in args_out_wash:
+                assert(name.endswith(".out"))
+                name = name[:-4]
+                fw("      - ``%s``: %s\n\n" % (name, comment))
+                fw("        **type** %s\n" % tp)
+            
+            fw("\n")
+            fw("   :rtype: dict with string keys\n")
+
+        fw("\n\n")
+        
+    fout.close()
+    del fout
+    print(OUT_RST)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 0e6ef76..441a6c0 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -35,7 +35,7 @@ API dump in RST files
     ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
 
   For quick builds:
-    ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial
+    ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
 
 
 Sphinx: HTML generation
@@ -245,6 +245,7 @@ else:
         "bgl",
         "blf",
         "bmesh",
+        "bmesh.ops",
         "bmesh.types",
         "bmesh.utils",
         "bpy.app",
@@ -297,7 +298,7 @@ try:
     __import__("aud")
 except ImportError:
     BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
-    EXCLUDE_MODULES = EXCLUDE_MODULES + ("aud", )
+    EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
 
 # examples
 EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
@@ -315,6 +316,8 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
 INFO_DOCS = (
     ("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
     ("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
+    ("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"),
+    ("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"),
     ("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
     ("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"),
     ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
@@ -910,6 +913,72 @@ def pymodule2sphinx(basepath, module_name, module, title):
 
     file.close()
 
+# Changes in blender will force errors here
+context_type_map = {
+    "active_base": ("ObjectBase", False),
+    "active_bone": ("EditBone", False),
+    "active_object": ("Object", False),
+    "active_operator": ("Operator", False),
+    "active_pose_bone": ("PoseBone", False),
+    "active_node": ("Node", False),
+    "armature": ("Armature", False),
+    "bone": ("Bone", False),
+    "brush": ("Brush", False),
+    "camera": ("Camera", False),
+    "cloth": ("ClothModifier", False),
+    "collision": ("CollisionModifier", False),
+    "curve": ("Curve", False),
+    "dynamic_paint": ("DynamicPaintModifier", False),
+    "edit_bone": ("EditBone", False),
+    "edit_image": ("Image", False),
+    "edit_mask": ("Mask", False),
+    "edit_movieclip": ("MovieClip", False),
+    "edit_object": ("Object", False),
+    "edit_text": ("Text", False),
+    "editable_bones": ("EditBone", True),
+    "fluid": ("FluidSimulationModifier", False),
+    "image_paint_object": ("Object", False),
+    "lamp": ("Lamp", False),
+    "lattice": ("Lattice", False),
+    "material": ("Material", False),
+    "material_slot": ("MaterialSlot", False),
+    "mesh": ("Mesh", False),
+    "meta_ball": ("MetaBall", False),
+    "object": ("Object", False),
+    "particle_edit_object": ("Object", False),
+    "particle_settings": ("ParticleSettings", False),
+    "particle_system": ("ParticleSystem", False),
+    "particle_system_editable": ("ParticleSystem", False),
+    "pose_bone": ("PoseBone", False),
+    "scene": ("Scene", False),
+    "sculpt_object": ("Object", False),
+    "selectable_bases": ("ObjectBase", True),
+    "selectable_objects": ("Object", True),
+    "selected_bases": ("ObjectBase", True),
+    "selected_bones": ("EditBone", True),
+    "selected_editable_bases": ("ObjectBase", True),
+    "selected_editable_bones": ("EditBone", True),
+    "selected_editable_objects": ("Object", True),
+    "selected_editable_sequences": ("Sequence", True),
+    "selected_nodes": ("Node", True),
+    "selected_objects": ("Object", True),
+    "selected_pose_bones": ("PoseBone", True),
+    "selected_sequences": ("Sequence", True),
+    "sequences": ("Sequence", True),
+    "smoke": ("SmokeModifier", False),
+    "soft_body": ("SoftBodyModifier", False),
+    "speaker": ("Speaker", False),
+    "texture": ("Texture", False),
+    "texture_slot": ("MaterialTextureSlot", False),
+    "texture_user": ("ID", False),
+    "vertex_paint_object": ("Object", False),
+    "visible_bases": ("ObjectBase", True),
+    "visible_bones": ("EditBone", True),
+    "visible_objects": ("Object", True),
+    "visible_pose_bones": ("PoseBone", True),
+    "weight_paint_object": ("Object", False),
+    "world": ("World", False),
+}
 
 def pycontext2sphinx(basepath):
     # Only use once. very irregular
@@ -938,72 +1007,6 @@ def pycontext2sphinx(basepath):
         "sequencer_context_dir",
     )
 
-    # Changes in blender will force errors here
-    type_map = {
-        "active_base": ("ObjectBase", False),
-        "active_bone": ("Bone", False),
-        "active_object": ("Object", False),
-        "active_operator": ("Operator", False),
-        "active_pose_bone": ("PoseBone", False),
-        "active_node": ("Node", False),
-        "armature": ("Armature", False),
-        "bone": ("Bone", False),
-        "brush": ("Brush", False),
-        "camera": ("Camera", False),
-        "cloth": ("ClothModifier", False),
-        "collision": ("CollisionModifier", False),
-        "curve": ("Curve", False),
-        "dynamic_paint": ("DynamicPaintModifier", False),
-        "edit_bone": ("EditBone", False),
-        "edit_image": ("Image", False),
-        "edit_mask": ("Mask", False),
-        "edit_movieclip": ("MovieClip", False),
-        "edit_object": ("Object", False),
-        "edit_text": ("Text", False),
-        "editable_bones": ("EditBone", True),
-        "fluid": ("FluidSimulationModifier", False),
-        "image_paint_object": ("Object", False),
-        "lamp": ("Lamp", False),
-        "lattice": ("Lattice", False),
-        "material": ("Material", False),
-        "material_slot": ("MaterialSlot", False),
-        "mesh": ("Mesh", False),
-        "meta_ball": ("MetaBall", False),
-        "object": ("Object", False),
-        "particle_edit_object": ("Object", False),
-        "particle_settings": ("ParticleSettings", False),
-        "particle_system": ("ParticleSystem", False),
-        "particle_system_editable": ("ParticleSystem", False),
-        "pose_bone": ("PoseBone", False),
-        "scene": ("Scene", False),
-        "sculpt_object": ("Object", False),
-        "selectable_bases": ("ObjectBase", True),
-        "selectable_objects": ("Object", True),
-        "selected_bases": ("ObjectBase", True),
-        "selected_bones": ("Bone", True),
-        "selected_editable_bases": ("ObjectBase", True),
-        "selected_editable_bones": ("Bone", True),
-        "selected_editable_objects": ("Object", True),
-        "selected_editable_sequences": ("Sequence", True),
-        "selected_nodes": ("Node", True),
-        "selected_objects": ("Object", True),
-        "selected_pose_bones": ("PoseBone", True),
-        "selected_sequences": ("Sequence", True),
-        "sequences": ("Sequence", True),
-        "smoke": ("SmokeModifier", False),
-        "soft_body": ("SoftBodyModifier", False),
-        "speaker": ("Speaker", False),
-        "texture": ("Texture", False),
-        "texture_slot": ("MaterialTextureSlot", False),
-        "texture_user": ("ID", False),
-        "vertex_paint_object": ("Object", False),
-        "visible_bases": ("ObjectBase", True),
-        "visible_bones": ("Object", True),
-        "visible_objects": ("Object", True),
-        "visible_pose_bones": ("PoseBone", True),
-        "weight_paint_object": ("Object", False),
-        "world": ("World", False),
-    }
 
     unique = set()
     blend_cdll = ctypes.CDLL("")
@@ -1018,7 +1021,7 @@ def pycontext2sphinx(basepath):
         while char_array[i] is not None:
             member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
             fw(".. data:: %s\n\n" % member)
-            member_type, is_seq = type_map[member]
+            member_type, is_seq = context_type_map[member]
             fw("   :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
             unique.add(member)
             i += 1
@@ -1026,8 +1029,8 @@ def pycontext2sphinx(basepath):
     # generate typemap...
     # for member in sorted(unique):
     #     print('        "%s": ("", False),' % member)
-    if len(type_map) > len(unique):
-        raise Exception("Some types are not used: %s" % str([member for member in type_map if member not in unique]))
+    if len(context_type_map) > len(unique):
+        raise Exception("Some types are not used: %s" % str([member for member in context_type_map if member not in unique]))
     else:
         pass  # will have raised an error above
 
@@ -1251,7 +1254,7 @@ def pyrna2sphinx(basepath):
             bases = list(reversed(struct.get_bases()))
 
             # props
-            lines[:] = []
+            del lines[:]
 
             if _BPY_STRUCT_FAKE:
                 descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
@@ -1282,7 +1285,7 @@ def pyrna2sphinx(basepath):
                 fw("\n")
 
             # funcs
-            lines[:] = []
+            del lines[:]
 
             if _BPY_STRUCT_FAKE:
                 for key, descr in descr_items:
@@ -1305,7 +1308,7 @@ def pyrna2sphinx(basepath):
                     fw(line)
                 fw("\n")
 
-            lines[:] = []
+            del lines[:]
 
         if struct.references:
             # use this otherwise it gets in the index for a normal heading.
@@ -1314,6 +1317,13 @@ def pyrna2sphinx(basepath):
             fw(".. hlist::\n")
             fw("   :columns: 2\n\n")
 
+            # context does its own thing
+            # "active_base": ("ObjectBase", False),
+            for ref_attr, (ref_type, ref_is_seq) in sorted(context_type_map.items()):
+                if ref_type == struct_id:
+                    fw("   * :mod:`bpy.context.%s`\n" % ref_attr)
+            del ref_attr, ref_type, ref_is_seq
+
             for ref in struct.references:
                 ref_split = ref.split(".")
                 if len(ref_split) > 2:
@@ -1465,6 +1475,11 @@ def write_sphinx_conf_py(basepath):
     file.close()
 
 
+def execfile(filepath):
+    global_namespace = {"__file__": filepath, "__name__": "__main__"}
+    exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace)
+
+
 def write_rst_contents(basepath):
     '''
     Write the rst file of the main page, needed for sphinx (index.html)
@@ -1525,14 +1540,18 @@ def write_rst_contents(basepath):
         "mathutils", "mathutils.geometry", "mathutils.noise",
         # misc
         "bgl", "blf", "gpu", "aud", "bpy_extras",
-        # bmesh
-        "bmesh", "bmesh.types", "bmesh.utils",
+        # bmesh, submodules are in own page
+        "bmesh",
         )
 
     for mod in standalone_modules:
         if mod not in EXCLUDE_MODULES:
             fw("   %s\n\n" % mod)
 
+    # special case, this 'bmesh.ops.rst' is extracted from C source
+    if "bmesh.ops" not in EXCLUDE_MODULES:
+        execfile(os.path.join(SCRIPT_DIR, "rst_from_bmesh_opdefines.py"))
+
     # game engine
     if "bge" not in EXCLUDE_MODULES:
         fw(title_string("Game Engine Modules", "=", double=True))
@@ -1694,6 +1713,8 @@ def copy_handwritten_rsts(basepath):
         "bgl",  # "Blender OpenGl wrapper"
         "gpu",  # "GPU Shader Module"
 
+        "bmesh.ops",  # generated by rst_from_bmesh_opdefines.py
+
         # includes...
         "include__bmesh",
     ]
@@ -1705,6 +1726,11 @@ def copy_handwritten_rsts(basepath):
     # changelog
     shutil.copy2(os.path.join(RST_DIR, "change_log.rst"), basepath)
 
+    # copy images, could be smarter but just glob for now.
+    for f in os.listdir(RST_DIR):
+        if f.endswith(".png"):
+            shutil.copy2(os.path.join(RST_DIR, f), basepath)
+
 
 def rna2sphinx(basepath):
 
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 151df49..2640c52 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -32,9 +32,10 @@ if(WITH_BULLET)
 	add_subdirectory(bullet2)
 endif()
 
-if(WITH_MOD_CLOTH_ELTOPO)
-	add_subdirectory(eltopo)
-endif()
+# now only available in a branch
+#if(WITH_MOD_CLOTH_ELTOPO)
+#	add_subdirectory(eltopo)
+#endif()
 
 if(WITH_BINRELOC)
 	add_subdirectory(binreloc)
diff --git a/extern/Eigen3/Eigen/Cholesky b/extern/Eigen3/Eigen/Cholesky
index 53f7bf9..f727f5d 100644
--- a/extern/Eigen3/Eigen/Cholesky
+++ b/extern/Eigen3/Eigen/Cholesky
@@ -5,8 +5,6 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
 /** \defgroup Cholesky_Module Cholesky module
   *
   *
@@ -24,8 +22,9 @@ namespace Eigen {
 #include "src/misc/Solve.h"
 #include "src/Cholesky/LLT.h"
 #include "src/Cholesky/LDLT.h"
-
-} // namespace Eigen
+#ifdef EIGEN_USE_LAPACKE
+#include "src/Cholesky/LLT_MKL.h"
+#endif
 
 #include "src/Core/util/ReenableStupidWarnings.h"
 
diff --git a/extern/Eigen3/Eigen/CholmodSupport b/extern/Eigen3/Eigen/CholmodSupport
new file mode 100644
index 0000000..745b884
--- /dev/null
+++ b/extern/Eigen3/Eigen/CholmodSupport
@@ -0,0 +1,45 @@
+#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
+#define EIGEN_CHOLMODSUPPORT_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+extern "C" {
+  #include <cholmod.h>
+}
+
+/** \ingroup Support_modules
+  * \defgroup CholmodSupport_Module CholmodSupport module
+  *
+  * This module provides an interface to the Cholmod library which is part of the <a href="http://www.cise.ufl.edu/research/sparse/SuiteSparse/">suitesparse</a> package.
+  * It provides the two following main factorization classes:
+  * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
+  * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
+  *
+  * For the sake of completeness, this module also propose the two following classes:
+  * - class CholmodSimplicialLLT
+  * - class CholmodSimplicialLDLT
+  * Note that these classes does not bring any particular advantage compared to the built-in
+  * SimplicialLLT and SimplicialLDLT factorization classes.
+  *
+  * \code
+  * #include <Eigen/CholmodSupport>
+  * \endcode
+  *
+  * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies.
+  * The dependencies depend on how cholmod has been compiled.
+  * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
+  *
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/CholmodSupport/CholmodSupport.h"
+
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_CHOLMODSUPPORT_MODULE_H
+
diff --git a/extern/Eigen3/Eigen/Core b/extern/Eigen3/Eigen/Core
index a5025e3..d480170 100644
--- a/extern/Eigen3/Eigen/Core
+++ b/extern/Eigen3/Eigen/Core
@@ -4,24 +4,9 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2007-2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CORE_H
 #define EIGEN_CORE_H
@@ -34,6 +19,12 @@
 // defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization.
 #include "src/Core/util/Macros.h"
 
+#include <complex>
+
+// this include file manages BLAS and MKL related macros
+// and inclusion of their respective header files
+#include "src/Core/util/MKL_support.h"
+
 // if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into
 // account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks
 #if !EIGEN_ALIGN
@@ -136,7 +127,7 @@
 #endif
 
 // MSVC for windows mobile does not have the errno.h file
-#if !(defined(_MSC_VER) && defined(_WIN32_WCE))
+#if !(defined(_MSC_VER) && defined(_WIN32_WCE)) && !defined(__ARMCC_VERSION)
 #define EIGEN_HAS_ERRNO
 #endif
 
@@ -146,7 +137,6 @@
 #include <cstddef>
 #include <cstdlib>
 #include <cmath>
-#include <complex>
 #include <cassert>
 #include <functional>
 #include <iosfwd>
@@ -175,9 +165,6 @@
   #include <new>
 #endif
 
-// defined in bits/termios.h
-#undef B0
-
 /** \brief Namespace containing all symbols from the %Eigen library. */
 namespace Eigen {
 
@@ -201,6 +188,8 @@ inline static const char *SimdInstructionSetsInUse(void) {
 #endif
 }
 
+} // end namespace Eigen
+
 #define STAGE10_FULL_EIGEN2_API             10
 #define STAGE20_RESOLVE_API_CONFLICTS       20
 #define STAGE30_FULL_EIGEN3_API             30
@@ -247,6 +236,10 @@ using std::ptrdiff_t;
   * \endcode
   */
 
+/** \defgroup Support_modules Support modules [category]
+  * Category of modules which add support for external libraries.
+  */
+
 #include "src/Core/util/Constants.h"
 #include "src/Core/util/ForwardDeclarations.h"
 #include "src/Core/util/Meta.h"
@@ -318,15 +311,15 @@ using std::ptrdiff_t;
 #include "src/Core/CommaInitializer.h"
 #include "src/Core/Flagged.h"
 #include "src/Core/ProductBase.h"
-#include "src/Core/Product.h"
+#include "src/Core/GeneralProduct.h"
 #include "src/Core/TriangularMatrix.h"
 #include "src/Core/SelfAdjointView.h"
-#include "src/Core/SolveTriangular.h"
+#include "src/Core/products/GeneralBlockPanelKernel.h"
 #include "src/Core/products/Parallelizer.h"
 #include "src/Core/products/CoeffBasedProduct.h"
-#include "src/Core/products/GeneralBlockPanelKernel.h"
 #include "src/Core/products/GeneralMatrixVector.h"
 #include "src/Core/products/GeneralMatrixMatrix.h"
+#include "src/Core/SolveTriangular.h"
 #include "src/Core/products/GeneralMatrixMatrixTriangular.h"
 #include "src/Core/products/SelfadjointMatrixVector.h"
 #include "src/Core/products/SelfadjointMatrixMatrix.h"
@@ -347,7 +340,20 @@ using std::ptrdiff_t;
 #include "src/Core/ArrayBase.h"
 #include "src/Core/ArrayWrapper.h"
 
-} // namespace Eigen
+#ifdef EIGEN_USE_BLAS
+#include "src/Core/products/GeneralMatrixMatrix_MKL.h"
+#include "src/Core/products/GeneralMatrixVector_MKL.h"
+#include "src/Core/products/GeneralMatrixMatrixTriangular_MKL.h"
+#include "src/Core/products/SelfadjointMatrixMatrix_MKL.h"
+#include "src/Core/products/SelfadjointMatrixVector_MKL.h"
+#include "src/Core/products/TriangularMatrixMatrix_MKL.h"
+#include "src/Core/products/TriangularMatrixVector_MKL.h"
+#include "src/Core/products/TriangularSolverMatrix_MKL.h"
+#endif // EIGEN_USE_BLAS
+
+#ifdef EIGEN_USE_MKL_VML
+#include "src/Core/Assign_MKL.h"
+#endif
 
 #include "src/Core/GlobalFunctions.h"
 
diff --git a/extern/Eigen3/Eigen/Eigen2Support b/extern/Eigen3/Eigen/Eigen2Support
index d96592a..36156d2 100644
--- a/extern/Eigen3/Eigen/Eigen2Support
+++ b/extern/Eigen3/Eigen/Eigen2Support
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2SUPPORT_H
 #define EIGEN2SUPPORT_H
@@ -31,9 +16,8 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
-/** \defgroup Eigen2Support_Module Eigen2 support module
+/** \ingroup Support_modules
+  * \defgroup Eigen2Support_Module Eigen2 support module
   * This module provides a couple of deprecated functions improving the compatibility with Eigen2.
   *
   * To use it, define EIGEN2_SUPPORT before including any Eigen header
@@ -56,13 +40,29 @@ namespace Eigen {
 #include "src/Eigen2Support/MathFunctions.h"
 
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 // Eigen2 used to include iostream
 #include<iostream>
 
+#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
+using Eigen::Matrix##SizeSuffix##TypeSuffix; \
+using Eigen::Vector##SizeSuffix##TypeSuffix; \
+using Eigen::RowVector##SizeSuffix##TypeSuffix;
+
+#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \
+
+#define EIGEN_USING_MATRIX_TYPEDEFS \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \
+EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd)
+
 #define USING_PART_OF_NAMESPACE_EIGEN \
 EIGEN_USING_MATRIX_TYPEDEFS \
 using Eigen::Matrix; \
diff --git a/extern/Eigen3/Eigen/Eigenvalues b/extern/Eigen3/Eigen/Eigenvalues
index 250c0f4..af99ccd 100644
--- a/extern/Eigen3/Eigen/Eigenvalues
+++ b/extern/Eigen3/Eigen/Eigenvalues
@@ -9,8 +9,7 @@
 #include "Jacobi"
 #include "Householder"
 #include "LU"
-
-namespace Eigen {
+#include "Geometry"
 
 /** \defgroup Eigenvalues_Module Eigenvalues module
   *
@@ -35,8 +34,11 @@ namespace Eigen {
 #include "src/Eigenvalues/ComplexSchur.h"
 #include "src/Eigenvalues/ComplexEigenSolver.h"
 #include "src/Eigenvalues/MatrixBaseEigenvalues.h"
-
-} // namespace Eigen
+#ifdef EIGEN_USE_LAPACKE
+#include "src/Eigenvalues/RealSchur_MKL.h"
+#include "src/Eigenvalues/ComplexSchur_MKL.h"
+#include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h"
+#endif
 
 #include "src/Core/util/ReenableStupidWarnings.h"
 
diff --git a/extern/Eigen3/Eigen/Geometry b/extern/Eigen3/Eigen/Geometry
index 78277c0..efd9d45 100644
--- a/extern/Eigen3/Eigen/Geometry
+++ b/extern/Eigen3/Eigen/Geometry
@@ -13,8 +13,6 @@
 #define M_PI 3.14159265358979323846
 #endif
 
-namespace Eigen {
-
 /** \defgroup Geometry_Module Geometry module
   *
   *
@@ -58,8 +56,6 @@ namespace Eigen {
 #include "src/Eigen2Support/Geometry/All.h"
 #endif
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_GEOMETRY_MODULE_H
diff --git a/extern/Eigen3/Eigen/Householder b/extern/Eigen3/Eigen/Householder
index 6b86cf6..6e348db 100644
--- a/extern/Eigen3/Eigen/Householder
+++ b/extern/Eigen3/Eigen/Householder
@@ -5,8 +5,6 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
 /** \defgroup Householder_Module Householder module
   * This module provides Householder transformations.
   *
@@ -19,8 +17,6 @@ namespace Eigen {
 #include "src/Householder/HouseholderSequence.h"
 #include "src/Householder/BlockHouseholder.h"
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_HOUSEHOLDER_MODULE_H
diff --git a/extern/Eigen3/Eigen/IterativeLinearSolvers b/extern/Eigen3/Eigen/IterativeLinearSolvers
new file mode 100644
index 0000000..315c2dd
--- /dev/null
+++ b/extern/Eigen3/Eigen/IterativeLinearSolvers
@@ -0,0 +1,40 @@
+#ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
+#define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
+
+#include "SparseCore"
+#include "OrderingMethods"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+/** \ingroup Sparse_modules
+  * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module
+  *
+  * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse.
+  * Those solvers are accessible via the following classes:
+  *  - ConjugateGradient for selfadjoint (hermitian) matrices,
+  *  - BiCGSTAB for general square matrices.
+  *
+  * These iterative solvers are associated with some preconditioners:
+  *  - IdentityPreconditioner - not really useful
+  *  - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices.
+  *  - IncompleteILUT - incomplete LU factorization with dual thresholding
+  *
+  * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport.
+  *
+  * \code
+  * #include <Eigen/IterativeLinearSolvers>
+  * \endcode
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/IterativeLinearSolvers/IterativeSolverBase.h"
+#include "src/IterativeLinearSolvers/BasicPreconditioners.h"
+#include "src/IterativeLinearSolvers/ConjugateGradient.h"
+#include "src/IterativeLinearSolvers/BiCGSTAB.h"
+#include "src/IterativeLinearSolvers/IncompleteLUT.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
diff --git a/extern/Eigen3/Eigen/Jacobi b/extern/Eigen3/Eigen/Jacobi
index afa6768..ba8a4dc 100644
--- a/extern/Eigen3/Eigen/Jacobi
+++ b/extern/Eigen3/Eigen/Jacobi
@@ -5,8 +5,6 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
 /** \defgroup Jacobi_Module Jacobi module
   * This module provides Jacobi and Givens rotations.
   *
@@ -21,8 +19,6 @@ namespace Eigen {
 
 #include "src/Jacobi/Jacobi.h"
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_JACOBI_MODULE_H
diff --git a/extern/Eigen3/Eigen/LU b/extern/Eigen3/Eigen/LU
index 226f88c..db57955 100644
--- a/extern/Eigen3/Eigen/LU
+++ b/extern/Eigen3/Eigen/LU
@@ -5,8 +5,6 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
 /** \defgroup LU_Module LU module
   * This module includes %LU decomposition and related notions such as matrix inversion and determinant.
   * This module defines the following MatrixBase methods:
@@ -23,6 +21,9 @@ namespace Eigen {
 #include "src/misc/Image.h"
 #include "src/LU/FullPivLU.h"
 #include "src/LU/PartialPivLU.h"
+#ifdef EIGEN_USE_LAPACKE
+#include "src/LU/PartialPivLU_MKL.h"
+#endif
 #include "src/LU/Determinant.h"
 #include "src/LU/Inverse.h"
 
@@ -34,8 +35,6 @@ namespace Eigen {
   #include "src/Eigen2Support/LU.h"
 #endif
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_LU_MODULE_H
diff --git a/extern/Eigen3/Eigen/LeastSquares b/extern/Eigen3/Eigen/LeastSquares
index 93a6302..35137c2 100644
--- a/extern/Eigen3/Eigen/LeastSquares
+++ b/extern/Eigen3/Eigen/LeastSquares
@@ -15,8 +15,6 @@
 #include "Eigenvalues"
 #include "Geometry"
 
-namespace Eigen {
-
 /** \defgroup LeastSquares_Module LeastSquares module
   * This module provides linear regression and related features.
   *
@@ -27,8 +25,6 @@ namespace Eigen {
 
 #include "src/Eigen2Support/LeastSquares.h"
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN2_SUPPORT
diff --git a/extern/Eigen3/Eigen/OrderingMethods b/extern/Eigen3/Eigen/OrderingMethods
new file mode 100644
index 0000000..1e2d874
--- /dev/null
+++ b/extern/Eigen3/Eigen/OrderingMethods
@@ -0,0 +1,23 @@
+#ifndef EIGEN_ORDERINGMETHODS_MODULE_H
+#define EIGEN_ORDERINGMETHODS_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+/** \ingroup Sparse_modules
+  * \defgroup OrderingMethods_Module OrderingMethods module
+  *
+  * This module is currently for internal use only.
+  *
+  *
+  * \code
+  * #include <Eigen/OrderingMethods>
+  * \endcode
+  */
+
+#include "src/OrderingMethods/Amd.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_ORDERINGMETHODS_MODULE_H
diff --git a/extern/Eigen3/Eigen/PaStiXSupport b/extern/Eigen3/Eigen/PaStiXSupport
new file mode 100644
index 0000000..7c616ee
--- /dev/null
+++ b/extern/Eigen3/Eigen/PaStiXSupport
@@ -0,0 +1,46 @@
+#ifndef EIGEN_PASTIXSUPPORT_MODULE_H
+#define EIGEN_PASTIXSUPPORT_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+#include <complex.h>
+extern "C" {
+#include <pastix_nompi.h>
+#include <pastix.h>
+}
+
+#ifdef complex
+#undef complex
+#endif
+
+/** \ingroup Support_modules
+  * \defgroup PaStiXSupport_Module PaStiXSupport module
+  * 
+  * This module provides an interface to the <a href="http://pastix.gforge.inria.fr/">PaSTiX</a> library.
+  * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver.
+  * It provides the two following main factorization classes:
+  * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization.
+  * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization.
+  * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern).
+  * 
+  * \code
+  * #include <Eigen/PaStiXSupport>
+  * \endcode
+  *
+  * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies.
+  * The dependencies depend on how PaSTiX has been compiled.
+  * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task.
+  *
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/PaStiXSupport/PaStiXSupport.h"
+
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_PASTIXSUPPORT_MODULE_H
diff --git a/extern/Eigen3/Eigen/PardisoSupport b/extern/Eigen3/Eigen/PardisoSupport
new file mode 100644
index 0000000..99330ce
--- /dev/null
+++ b/extern/Eigen3/Eigen/PardisoSupport
@@ -0,0 +1,30 @@
+#ifndef EIGEN_PARDISOSUPPORT_MODULE_H
+#define EIGEN_PARDISOSUPPORT_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+#include <mkl_pardiso.h>
+
+#include <unsupported/Eigen/SparseExtra>
+
+/** \ingroup Support_modules
+  * \defgroup PardisoSupport_Module PardisoSupport module
+  *
+  * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers.
+  *
+  * \code
+  * #include <Eigen/PardisoSupport>
+  * \endcode
+  *
+  * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies.
+  * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration.
+  * 
+  */
+
+#include "src/PardisoSupport/PardisoSupport.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_PARDISOSUPPORT_MODULE_H
diff --git a/extern/Eigen3/Eigen/QR b/extern/Eigen3/Eigen/QR
index 97c1788..ac5b026 100644
--- a/extern/Eigen3/Eigen/QR
+++ b/extern/Eigen3/Eigen/QR
@@ -9,8 +9,6 @@
 #include "Jacobi"
 #include "Householder"
 
-namespace Eigen {
-
 /** \defgroup QR_Module QR module
   *
   *
@@ -28,13 +26,15 @@ namespace Eigen {
 #include "src/QR/HouseholderQR.h"
 #include "src/QR/FullPivHouseholderQR.h"
 #include "src/QR/ColPivHouseholderQR.h"
+#ifdef EIGEN_USE_LAPACKE
+#include "src/QR/HouseholderQR_MKL.h"
+#include "src/QR/ColPivHouseholderQR_MKL.h"
+#endif
 
 #ifdef EIGEN2_SUPPORT
 #include "src/Eigen2Support/QR.h"
 #endif
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #ifdef EIGEN2_SUPPORT
diff --git a/extern/Eigen3/Eigen/SVD b/extern/Eigen3/Eigen/SVD
index 7c987a9..fd31001 100644
--- a/extern/Eigen3/Eigen/SVD
+++ b/extern/Eigen3/Eigen/SVD
@@ -7,8 +7,6 @@
 
 #include "src/Core/util/DisableStupidWarnings.h"
 
-namespace Eigen {
-
 /** \defgroup SVD_Module SVD module
   *
   *
@@ -24,14 +22,15 @@ namespace Eigen {
 
 #include "src/misc/Solve.h"
 #include "src/SVD/JacobiSVD.h"
+#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
+#include "src/SVD/JacobiSVD_MKL.h"
+#endif
 #include "src/SVD/UpperBidiagonalization.h"
 
 #ifdef EIGEN2_SUPPORT
 #include "src/Eigen2Support/SVD.h"
 #endif
 
-} // namespace Eigen
-
 #include "src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_SVD_MODULE_H
diff --git a/extern/Eigen3/Eigen/Sparse b/extern/Eigen3/Eigen/Sparse
index 7425b3a..2d17571 100644
--- a/extern/Eigen3/Eigen/Sparse
+++ b/extern/Eigen3/Eigen/Sparse
@@ -1,69 +1,23 @@
 #ifndef EIGEN_SPARSE_MODULE_H
 #define EIGEN_SPARSE_MODULE_H
 
-#include "Core"
-
-#include "src/Core/util/DisableStupidWarnings.h"
-
-#include <vector>
-#include <map>
-#include <cstdlib>
-#include <cstring>
-#include <algorithm>
-
-#ifdef EIGEN2_SUPPORT
-#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
-#endif
-
-#ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
-#error The sparse module API is not stable yet. To use it anyway, please define the EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET preprocessor token.
-#endif
-
-namespace Eigen {
-
-/** \defgroup Sparse_Module Sparse module
+/** \defgroup Sparse_modules Sparse modules
   *
-  *
-  *
-  * See the \ref TutorialSparse "Sparse tutorial"
+  * Meta-module including all related modules:
+  * - SparseCore
+  * - OrderingMethods
+  * - SparseCholesky
+  * - IterativeLinearSolvers
   *
   * \code
   * #include <Eigen/Sparse>
   * \endcode
   */
 
-/** The type used to identify a general sparse storage. */
-struct Sparse {};
-
-#include "src/Sparse/SparseUtil.h"
-#include "src/Sparse/SparseMatrixBase.h"
-#include "src/Sparse/CompressedStorage.h"
-#include "src/Sparse/AmbiVector.h"
-#include "src/Sparse/SparseMatrix.h"
-#include "src/Sparse/DynamicSparseMatrix.h"
-#include "src/Sparse/MappedSparseMatrix.h"
-#include "src/Sparse/SparseVector.h"
-#include "src/Sparse/CoreIterators.h"
-#include "src/Sparse/SparseBlock.h"
-#include "src/Sparse/SparseTranspose.h"
-#include "src/Sparse/SparseCwiseUnaryOp.h"
-#include "src/Sparse/SparseCwiseBinaryOp.h"
-#include "src/Sparse/SparseDot.h"
-#include "src/Sparse/SparseAssign.h"
-#include "src/Sparse/SparseRedux.h"
-#include "src/Sparse/SparseFuzzy.h"
-#include "src/Sparse/SparseProduct.h"
-#include "src/Sparse/SparseSparseProduct.h"
-#include "src/Sparse/SparseDenseProduct.h"
-#include "src/Sparse/SparseDiagonalProduct.h"
-#include "src/Sparse/SparseTriangularView.h"
-#include "src/Sparse/SparseSelfAdjointView.h"
-#include "src/Sparse/TriangularSolver.h"
-#include "src/Sparse/SparseView.h"
-
-} // namespace Eigen
-
-#include "src/Core/util/ReenableStupidWarnings.h"
+#include "SparseCore"
+#include "OrderingMethods"
+#include "SparseCholesky"
+#include "IterativeLinearSolvers"
 
 #endif // EIGEN_SPARSE_MODULE_H
 
diff --git a/extern/Eigen3/Eigen/SparseCholesky b/extern/Eigen3/Eigen/SparseCholesky
new file mode 100644
index 0000000..5f82742
--- /dev/null
+++ b/extern/Eigen3/Eigen/SparseCholesky
@@ -0,0 +1,30 @@
+#ifndef EIGEN_SPARSECHOLESKY_MODULE_H
+#define EIGEN_SPARSECHOLESKY_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+/** \ingroup Sparse_modules
+  * \defgroup SparseCholesky_Module SparseCholesky module
+  *
+  * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices.
+  * Those decompositions are accessible via the following classes:
+  *  - SimplicialLLt,
+  *  - SimplicialLDLt
+  *
+  * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module.
+  *
+  * \code
+  * #include <Eigen/SparseCholesky>
+  * \endcode
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/SparseCholesky/SimplicialCholesky.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_SPARSECHOLESKY_MODULE_H
diff --git a/extern/Eigen3/Eigen/SparseCore b/extern/Eigen3/Eigen/SparseCore
new file mode 100644
index 0000000..41d28c9
--- /dev/null
+++ b/extern/Eigen3/Eigen/SparseCore
@@ -0,0 +1,66 @@
+#ifndef EIGEN_SPARSECORE_MODULE_H
+#define EIGEN_SPARSECORE_MODULE_H
+
+#include "Core"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+#include <vector>
+#include <map>
+#include <cstdlib>
+#include <cstring>
+#include <algorithm>
+
+/** \ingroup Sparse_modules
+  * \defgroup SparseCore_Module SparseCore module
+  *
+  * This module provides a sparse matrix representation, and basic associatd matrix manipulations
+  * and operations.
+  *
+  * See the \ref TutorialSparse "Sparse tutorial"
+  *
+  * \code
+  * #include <Eigen/SparseCore>
+  * \endcode
+  *
+  * This module depends on: Core.
+  */
+
+namespace Eigen {
+
+/** The type used to identify a general sparse storage. */
+struct Sparse {};
+
+}
+
+#include "src/SparseCore/SparseUtil.h"
+#include "src/SparseCore/SparseMatrixBase.h"
+#include "src/SparseCore/CompressedStorage.h"
+#include "src/SparseCore/AmbiVector.h"
+#include "src/SparseCore/SparseMatrix.h"
+#include "src/SparseCore/MappedSparseMatrix.h"
+#include "src/SparseCore/SparseVector.h"
+#include "src/SparseCore/CoreIterators.h"
+#include "src/SparseCore/SparseBlock.h"
+#include "src/SparseCore/SparseTranspose.h"
+#include "src/SparseCore/SparseCwiseUnaryOp.h"
+#include "src/SparseCore/SparseCwiseBinaryOp.h"
+#include "src/SparseCore/SparseDot.h"
+#include "src/SparseCore/SparsePermutation.h"
+#include "src/SparseCore/SparseAssign.h"
+#include "src/SparseCore/SparseRedux.h"
+#include "src/SparseCore/SparseFuzzy.h"
+#include "src/SparseCore/ConservativeSparseSparseProduct.h"
+#include "src/SparseCore/SparseSparseProductWithPruning.h"
+#include "src/SparseCore/SparseProduct.h"
+#include "src/SparseCore/SparseDenseProduct.h"
+#include "src/SparseCore/SparseDiagonalProduct.h"
+#include "src/SparseCore/SparseTriangularView.h"
+#include "src/SparseCore/SparseSelfAdjointView.h"
+#include "src/SparseCore/TriangularSolver.h"
+#include "src/SparseCore/SparseView.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_SPARSECORE_MODULE_H
+
diff --git a/extern/Eigen3/Eigen/StdDeque b/extern/Eigen3/Eigen/StdDeque
index a4f9623..f272347 100644
--- a/extern/Eigen3/Eigen/StdDeque
+++ b/extern/Eigen3/Eigen/StdDeque
@@ -4,24 +4,9 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDDEQUE_MODULE_H
 #define EIGEN_STDDEQUE_MODULE_H
diff --git a/extern/Eigen3/Eigen/StdList b/extern/Eigen3/Eigen/StdList
index d914ded..225c1e1 100644
--- a/extern/Eigen3/Eigen/StdList
+++ b/extern/Eigen3/Eigen/StdList
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDLIST_MODULE_H
 #define EIGEN_STDLIST_MODULE_H
diff --git a/extern/Eigen3/Eigen/StdVector b/extern/Eigen3/Eigen/StdVector
index 3d8995e..6b22627 100644
--- a/extern/Eigen3/Eigen/StdVector
+++ b/extern/Eigen3/Eigen/StdVector
@@ -4,24 +4,9 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDVECTOR_MODULE_H
 #define EIGEN_STDVECTOR_MODULE_H
diff --git a/extern/Eigen3/Eigen/SuperLUSupport b/extern/Eigen3/Eigen/SuperLUSupport
new file mode 100644
index 0000000..575e14f
--- /dev/null
+++ b/extern/Eigen3/Eigen/SuperLUSupport
@@ -0,0 +1,59 @@
+#ifndef EIGEN_SUPERLUSUPPORT_MODULE_H
+#define EIGEN_SUPERLUSUPPORT_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+#ifdef EMPTY
+#define EIGEN_EMPTY_WAS_ALREADY_DEFINED
+#endif
+
+typedef int int_t;
+#include <slu_Cnames.h>
+#include <supermatrix.h>
+#include <slu_util.h>
+
+// slu_util.h defines a preprocessor token named EMPTY which is really polluting,
+// so we remove it in favor of a SUPERLU_EMPTY token.
+// If EMPTY was already defined then we don't undef it.
+
+#if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED)
+# undef EIGEN_EMPTY_WAS_ALREADY_DEFINED
+#elif defined(EMPTY)
+# undef EMPTY
+#endif
+
+#define SUPERLU_EMPTY (-1)
+
+namespace Eigen { struct SluMatrix; }
+
+/** \ingroup Support_modules
+  * \defgroup SuperLUSupport_Module SuperLUSupport module
+  *
+  * This module provides an interface to the <a href="http://crd-legacy.lbl.gov/~xiaoye/SuperLU/">SuperLU</a> library.
+  * It provides the following factorization class:
+  * - class SuperLU: a supernodal sequential LU factorization.
+  * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods).
+  *
+  * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting.
+  *
+  * \code
+  * #include <Eigen/SuperLUSupport>
+  * \endcode
+  *
+  * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies.
+  * The dependencies depend on how superlu has been compiled.
+  * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task.
+  *
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/SuperLUSupport/SuperLUSupport.h"
+
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_SUPERLUSUPPORT_MODULE_H
diff --git a/extern/Eigen3/Eigen/UmfPackSupport b/extern/Eigen3/Eigen/UmfPackSupport
new file mode 100644
index 0000000..984f64a
--- /dev/null
+++ b/extern/Eigen3/Eigen/UmfPackSupport
@@ -0,0 +1,36 @@
+#ifndef EIGEN_UMFPACKSUPPORT_MODULE_H
+#define EIGEN_UMFPACKSUPPORT_MODULE_H
+
+#include "SparseCore"
+
+#include "src/Core/util/DisableStupidWarnings.h"
+
+extern "C" {
+#include <umfpack.h>
+}
+
+/** \ingroup Support_modules
+  * \defgroup UmfPackSupport_Module UmfPackSupport module
+  *
+  * This module provides an interface to the UmfPack library which is part of the <a href="http://www.cise.ufl.edu/research/sparse/SuiteSparse/">suitesparse</a> package.
+  * It provides the following factorization class:
+  * - class UmfPackLU: a multifrontal sequential LU factorization.
+  *
+  * \code
+  * #include <Eigen/UmfPackSupport>
+  * \endcode
+  *
+  * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies.
+  * The dependencies depend on how umfpack has been compiled.
+  * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task.
+  *
+  */
+
+#include "src/misc/Solve.h"
+#include "src/misc/SparseSolve.h"
+
+#include "src/UmfPackSupport/UmfPackSupport.h"
+
+#include "src/Core/util/ReenableStupidWarnings.h"
+
+#endif // EIGEN_UMFPACKSUPPORT_MODULE_H
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LDLT.h b/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
index a19e947..68e54b1 100644
--- a/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
+++ b/extern/Eigen3/Eigen/src/Cholesky/LDLT.h
@@ -1,43 +1,33 @@
 // This file is part of Eigen, a lightweight C++ template library
 // for linear algebra.
 //
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Keir Mierle <mierle at gmail.com>
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
+// Copyright (C) 2011 Timothy E. Holy <tim.holy at gmail.com >
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_LDLT_H
 #define EIGEN_LDLT_H
 
+namespace Eigen { 
+
 namespace internal {
 template<typename MatrixType, int UpLo> struct LDLT_Traits;
 }
 
-/** \ingroup cholesky_Module
+/** \ingroup Cholesky_Module
   *
   * \class LDLT
   *
   * \brief Robust Cholesky decomposition of a matrix with pivoting
   *
   * \param MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition
+  * \param UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper.
+  *             The other triangular part won't be read.
   *
   * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite
   * matrix \f$ A \f$ such that \f$ A =  P^TLDL^*P \f$, where P is a permutation matrix, L
@@ -48,14 +38,10 @@ template<typename MatrixType, int UpLo> struct LDLT_Traits;
   * on D also stabilizes the computation.
   *
   * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky
-	* decomposition to determine whether a system of equations has a solution.
+  * decomposition to determine whether a system of equations has a solution.
   *
   * \sa MatrixBase::ldlt(), class LLT
   */
- /* THIS PART OF THE DOX IS CURRENTLY DISABLED BECAUSE INACCURATE BECAUSE OF BUG IN THE DECOMPOSITION CODE
-  * Note that during the decomposition, only the upper triangular part of A is considered. Therefore,
-  * the strict lower part does not have to store correct values.
-  */
 template<typename _MatrixType, int _UpLo> class LDLT
 {
   public:
@@ -98,6 +84,11 @@ template<typename _MatrixType, int _UpLo> class LDLT
         m_isInitialized(false)
     {}
 
+    /** \brief Constructor with decomposition
+      *
+      * This calculates the decomposition for the input \a matrix.
+      * \sa LDLT(Index size)
+      */
     LDLT(const MatrixType& matrix)
       : m_matrix(matrix.rows(), matrix.cols()),
         m_transpositions(matrix.rows()),
@@ -107,6 +98,14 @@ template<typename _MatrixType, int _UpLo> class LDLT
       compute(matrix);
     }
 
+    /** Clear any existing decomposition
+     * \sa rankUpdate(w,sigma)
+     */
+    void setZero()
+    {
+      m_isInitialized = false;
+    }
+
     /** \returns a view of the upper triangular matrix U */
     inline typename Traits::MatrixU matrixU() const
     {
@@ -130,14 +129,14 @@ template<typename _MatrixType, int _UpLo> class LDLT
     }
 
     /** \returns the coefficients of the diagonal matrix D */
-    inline Diagonal<const MatrixType> vectorD(void) const
+    inline Diagonal<const MatrixType> vectorD() const
     {
       eigen_assert(m_isInitialized && "LDLT is not initialized.");
       return m_matrix.diagonal();
     }
 
     /** \returns true if the matrix is positive (semidefinite) */
-    inline bool isPositive(void) const
+    inline bool isPositive() const
     {
       eigen_assert(m_isInitialized && "LDLT is not initialized.");
       return m_sign == 1;
@@ -196,6 +195,9 @@ template<typename _MatrixType, int _UpLo> class LDLT
 
     LDLT& compute(const MatrixType& matrix);
 
+    template <typename Derived>
+    LDLT& rankUpdate(const MatrixBase<Derived>& w,RealScalar alpha=1);
+
     /** \returns the internal LDLT decomposition matrix
       *
       * TODO: document the storage layout
@@ -211,6 +213,17 @@ template<typename _MatrixType, int _UpLo> class LDLT
     inline Index rows() const { return m_matrix.rows(); }
     inline Index cols() const { return m_matrix.cols(); }
 
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "LDLT is not initialized.");
+      return Success;
+    }
+
   protected:
 
     /** \internal
@@ -249,7 +262,7 @@ template<> struct ldlt_inplace<Lower>
       return true;
     }
 
-    RealScalar cutoff = 0, biggest_in_corner;
+    RealScalar cutoff(0), biggest_in_corner;
 
     for (Index k = 0; k < size; ++k)
     {
@@ -317,6 +330,61 @@ template<> struct ldlt_inplace<Lower>
 
     return true;
   }
+
+  // Reference for the algorithm: Davis and Hager, "Multiple Rank
+  // Modifications of a Sparse Cholesky Factorization" (Algorithm 1)
+  // Trivial rearrangements of their computations (Timothy E. Holy)
+  // allow their algorithm to work for rank-1 updates even if the
+  // original matrix is not of full rank.
+  // Here only rank-1 updates are implemented, to reduce the
+  // requirement for intermediate storage and improve accuracy
+  template<typename MatrixType, typename WDerived>
+  static bool updateInPlace(MatrixType& mat, MatrixBase<WDerived>& w, typename MatrixType::RealScalar sigma=1)
+  {
+    using internal::isfinite;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+
+    const Index size = mat.rows();
+    eigen_assert(mat.cols() == size && w.size()==size);
+
+    RealScalar alpha = 1;
+
+    // Apply the update
+    for (Index j = 0; j < size; j++)
+    {
+      // Check for termination due to an original decomposition of low-rank
+      if (!(isfinite)(alpha))
+        break;
+
+      // Update the diagonal terms
+      RealScalar dj = real(mat.coeff(j,j));
+      Scalar wj = w.coeff(j);
+      RealScalar swj2 = sigma*abs2(wj);
+      RealScalar gamma = dj*alpha + swj2;
+
+      mat.coeffRef(j,j) += swj2/alpha;
+      alpha += swj2/dj;
+
+
+      // Update the terms of L
+      Index rs = size-j-1;
+      w.tail(rs) -= wj * mat.col(j).tail(rs);
+      if(gamma != 0)
+        mat.col(j).tail(rs) += (sigma*conj(wj)/gamma)*w.tail(rs);
+    }
+    return true;
+  }
+
+  template<typename MatrixType, typename TranspositionType, typename Workspace, typename WType>
+  static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, typename MatrixType::RealScalar sigma=1)
+  {
+    // Apply the permutation to the input w
+    tmp = transpositions * w;
+
+    return ldlt_inplace<Lower>::updateInPlace(mat,tmp,sigma);
+  }
 };
 
 template<> struct ldlt_inplace<Upper>
@@ -327,22 +395,29 @@ template<> struct ldlt_inplace<Upper>
     Transpose<MatrixType> matt(mat);
     return ldlt_inplace<Lower>::unblocked(matt, transpositions, temp, sign);
   }
+
+  template<typename MatrixType, typename TranspositionType, typename Workspace, typename WType>
+  static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, typename MatrixType::RealScalar sigma=1)
+  {
+    Transpose<MatrixType> matt(mat);
+    return ldlt_inplace<Lower>::update(matt, transpositions, tmp, w.conjugate(), sigma);
+  }
 };
 
 template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
 {
   typedef const TriangularView<const MatrixType, UnitLower> MatrixL;
   typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
-  inline static MatrixL getL(const MatrixType& m) { return m; }
-  inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
+  static inline MatrixL getL(const MatrixType& m) { return m; }
+  static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
 };
 
 template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
 {
   typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
   typedef const TriangularView<const MatrixType, UnitUpper> MatrixU;
-  inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
-  inline static MatrixU getU(const MatrixType& m) { return m; }
+  static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
+  static inline MatrixU getU(const MatrixType& m) { return m; }
 };
 
 } // end namespace internal
@@ -367,6 +442,37 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
   return *this;
 }
 
+/** Update the LDLT decomposition:  given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T.
+ * \param w a vector to be incorporated into the decomposition.
+ * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1.
+ * \sa setZero()
+  */
+template<typename MatrixType, int _UpLo>
+template<typename Derived>
+LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w,typename NumTraits<typename MatrixType::Scalar>::Real sigma)
+{
+  const Index size = w.rows();
+  if (m_isInitialized)
+  {
+    eigen_assert(m_matrix.rows()==size);
+  }
+  else
+  {    
+    m_matrix.resize(size,size);
+    m_matrix.setZero();
+    m_transpositions.resize(size);
+    for (Index i = 0; i < size; i++)
+      m_transpositions.coeffRef(i) = i;
+    m_temporary.resize(size);
+    m_sign = sigma>=0 ? 1 : -1;
+    m_isInitialized = true;
+  }
+
+  internal::ldlt_inplace<UpLo>::update(m_matrix, m_transpositions, m_temporary, w, sigma);
+
+  return *this;
+}
+
 namespace internal {
 template<typename _MatrixType, int _UpLo, typename Rhs>
 struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
@@ -481,4 +587,6 @@ MatrixBase<Derived>::ldlt() const
   return LDLT<PlainObject>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_LDLT_H
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LLT.h b/extern/Eigen3/Eigen/src/Cholesky/LLT.h
index 3bb76b5..41d14e5 100644
--- a/extern/Eigen3/Eigen/src/Cholesky/LLT.h
+++ b/extern/Eigen3/Eigen/src/Cholesky/LLT.h
@@ -3,39 +3,28 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_LLT_H
 #define EIGEN_LLT_H
 
+namespace Eigen { 
+
 namespace internal{
 template<typename MatrixType, int UpLo> struct LLT_Traits;
 }
 
-/** \ingroup cholesky_Module
+/** \ingroup Cholesky_Module
   *
   * \class LLT
   *
   * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features
   *
   * \param MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition
+  * \param UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper.
+  *             The other triangular part won't be read.
   *
   * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite
   * matrix A such that A = LL^* = U^*U, where L is lower triangular.
@@ -49,6 +38,9 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
   * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations
   * has a solution.
   *
+  * Example: \include LLT_example.cpp
+  * Output: \verbinclude LLT_example.out
+  *    
   * \sa MatrixBase::llt(), class LDLT
   */
  /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH)
@@ -178,6 +170,9 @@ template<typename _MatrixType, int _UpLo> class LLT
     inline Index rows() const { return m_matrix.rows(); }
     inline Index cols() const { return m_matrix.cols(); }
 
+    template<typename VectorType>
+    LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);
+
   protected:
     /** \internal
       * Used to compute and store L
@@ -190,16 +185,85 @@ template<typename _MatrixType, int _UpLo> class LLT
 
 namespace internal {
 
-template<int UpLo> struct llt_inplace;
+template<typename Scalar, int UpLo> struct llt_inplace;
+
+template<typename MatrixType, typename VectorType>
+static typename MatrixType::Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma)
+{
+  typedef typename MatrixType::Scalar Scalar;
+  typedef typename MatrixType::RealScalar RealScalar;
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::ColXpr ColXpr;
+  typedef typename internal::remove_all<ColXpr>::type ColXprCleaned;
+  typedef typename ColXprCleaned::SegmentReturnType ColXprSegment;
+  typedef Matrix<Scalar,Dynamic,1> TempVectorType;
+  typedef typename TempVectorType::SegmentReturnType TempVecSegment;
+
+  int n = mat.cols();
+  eigen_assert(mat.rows()==n && vec.size()==n);
+
+  TempVectorType temp;
+
+  if(sigma>0)
+  {
+    // This version is based on Givens rotations.
+    // It is faster than the other one below, but only works for updates,
+    // i.e., for sigma > 0
+    temp = sqrt(sigma) * vec;
+
+    for(int i=0; i<n; ++i)
+    {
+      JacobiRotation<Scalar> g;
+      g.makeGivens(mat(i,i), -temp(i), &mat(i,i));
+
+      int rs = n-i-1;
+      if(rs>0)
+      {
+        ColXprSegment x(mat.col(i).tail(rs));
+        TempVecSegment y(temp.tail(rs));
+        apply_rotation_in_the_plane(x, y, g);
+      }
+    }
+  }
+  else
+  {
+    temp = vec;
+    RealScalar beta = 1;
+    for(int j=0; j<n; ++j)
+    {
+      RealScalar Ljj = real(mat.coeff(j,j));
+      RealScalar dj = abs2(Ljj);
+      Scalar wj = temp.coeff(j);
+      RealScalar swj2 = sigma*abs2(wj);
+      RealScalar gamma = dj*beta + swj2;
+
+      RealScalar x = dj + swj2/beta;
+      if (x<=RealScalar(0))
+        return j;
+      RealScalar nLjj = sqrt(x);
+      mat.coeffRef(j,j) = nLjj;
+      beta += swj2/dj;
+
+      // Update the terms of L
+      Index rs = n-j-1;
+      if(rs)
+      {
+        temp.tail(rs) -= (wj/Ljj) * mat.col(j).tail(rs);
+        if(gamma != 0)
+          mat.col(j).tail(rs) = (nLjj/Ljj) * mat.col(j).tail(rs) + (nLjj * sigma*conj(wj)/gamma)*temp.tail(rs);
+      }
+    }
+  }
+  return -1;
+}
 
-template<> struct llt_inplace<Lower>
+template<typename Scalar> struct llt_inplace<Scalar, Lower>
 {
+  typedef typename NumTraits<Scalar>::Real RealScalar;
   template<typename MatrixType>
   static typename MatrixType::Index unblocked(MatrixType& mat)
   {
     typedef typename MatrixType::Index Index;
-    typedef typename MatrixType::Scalar Scalar;
-    typedef typename MatrixType::RealScalar RealScalar;
     
     eigen_assert(mat.rows()==mat.cols());
     const Index size = mat.rows();
@@ -254,21 +318,35 @@ template<> struct llt_inplace<Lower>
     }
     return -1;
   }
-};
 
-template<> struct llt_inplace<Upper>
+  template<typename MatrixType, typename VectorType>
+  static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma)
+  {
+    return Eigen::internal::llt_rank_update_lower(mat, vec, sigma);
+  }
+};
+  
+template<typename Scalar> struct llt_inplace<Scalar, Upper>
 {
+  typedef typename NumTraits<Scalar>::Real RealScalar;
+
   template<typename MatrixType>
   static EIGEN_STRONG_INLINE typename MatrixType::Index unblocked(MatrixType& mat)
   {
     Transpose<MatrixType> matt(mat);
-    return llt_inplace<Lower>::unblocked(matt);
+    return llt_inplace<Scalar, Lower>::unblocked(matt);
   }
   template<typename MatrixType>
   static EIGEN_STRONG_INLINE typename MatrixType::Index blocked(MatrixType& mat)
   {
     Transpose<MatrixType> matt(mat);
-    return llt_inplace<Lower>::blocked(matt);
+    return llt_inplace<Scalar, Lower>::blocked(matt);
+  }
+  template<typename MatrixType, typename VectorType>
+  static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma)
+  {
+    Transpose<MatrixType> matt(mat);
+    return llt_inplace<Scalar, Lower>::rankUpdate(matt, vec.conjugate(), sigma);
   }
 };
 
@@ -276,33 +354,35 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
 {
   typedef const TriangularView<const MatrixType, Lower> MatrixL;
   typedef const TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
-  inline static MatrixL getL(const MatrixType& m) { return m; }
-  inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
+  static inline MatrixL getL(const MatrixType& m) { return m; }
+  static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
   static bool inplace_decomposition(MatrixType& m)
-  { return llt_inplace<Lower>::blocked(m)==-1; }
+  { return llt_inplace<typename MatrixType::Scalar, Lower>::blocked(m)==-1; }
 };
 
 template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
 {
   typedef const TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
   typedef const TriangularView<const MatrixType, Upper> MatrixU;
-  inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
-  inline static MatrixU getU(const MatrixType& m) { return m; }
+  static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
+  static inline MatrixU getU(const MatrixType& m) { return m; }
   static bool inplace_decomposition(MatrixType& m)
-  { return llt_inplace<Upper>::blocked(m)==-1; }
+  { return llt_inplace<typename MatrixType::Scalar, Upper>::blocked(m)==-1; }
 };
 
 } // end namespace internal
 
 /** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix
   *
-  *
   * \returns a reference to *this
+  *
+  * Example: \include TutorialLinAlgComputeTwice.cpp
+  * Output: \verbinclude TutorialLinAlgComputeTwice.out
   */
 template<typename MatrixType, int _UpLo>
 LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
 {
-  assert(a.rows()==a.cols());
+  eigen_assert(a.rows()==a.cols());
   const Index size = a.rows();
   m_matrix.resize(size, size);
   m_matrix = a;
@@ -314,6 +394,26 @@ LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
   return *this;
 }
 
+/** Performs a rank one update (or dowdate) of the current decomposition.
+  * If A = LL^* before the rank one update,
+  * then after it we have LL^* = A + sigma * v v^* where \a v must be a vector
+  * of same dimension.
+  */
+template<typename _MatrixType, int _UpLo>
+template<typename VectorType>
+LLT<_MatrixType,_UpLo> LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, const RealScalar& sigma)
+{
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType);
+  eigen_assert(v.size()==m_matrix.cols());
+  eigen_assert(m_isInitialized);
+  if(internal::llt_inplace<typename MatrixType::Scalar, UpLo>::rankUpdate(m_matrix,v,sigma)>=0)
+    m_info = NumericalIssue;
+  else
+    m_info = Success;
+
+  return *this;
+}
+    
 namespace internal {
 template<typename _MatrixType, int UpLo, typename Rhs>
 struct solve_retval<LLT<_MatrixType, UpLo>, Rhs>
@@ -383,4 +483,6 @@ SelfAdjointView<MatrixType, UpLo>::llt() const
   return LLT<PlainObject,UpLo>(m_matrix);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_LLT_H
diff --git a/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h b/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
new file mode 100644
index 0000000..64daa44
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
@@ -0,0 +1,102 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *     LLt decomposition based on LAPACKE_?potrf function.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_LLT_MKL_H
+#define EIGEN_LLT_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+#include <iostream>
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename Scalar> struct mkl_llt;
+
+#define EIGEN_MKL_LLT(EIGTYPE, MKLTYPE, MKLPREFIX) \
+template<> struct mkl_llt<EIGTYPE> \
+{ \
+  template<typename MatrixType> \
+  static inline typename MatrixType::Index potrf(MatrixType& m, char uplo) \
+  { \
+    lapack_int matrix_order; \
+    lapack_int size, lda, info, StorageOrder; \
+    EIGTYPE* a; \
+    eigen_assert(m.rows()==m.cols()); \
+    /* Set up parameters for ?potrf */ \
+    size = m.rows(); \
+    StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \
+    matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
+    a = &(m.coeffRef(0,0)); \
+    lda = m.outerStride(); \
+\
+    info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
+    info = (info==0) ? Success : NumericalIssue; \
+    return info; \
+  } \
+}; \
+template<> struct llt_inplace<EIGTYPE, Lower> \
+{ \
+  template<typename MatrixType> \
+  static typename MatrixType::Index blocked(MatrixType& m) \
+  { \
+    return mkl_llt<EIGTYPE>::potrf(m, 'L'); \
+  } \
+  template<typename MatrixType, typename VectorType> \
+  static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
+  { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \
+}; \
+template<> struct llt_inplace<EIGTYPE, Upper> \
+{ \
+  template<typename MatrixType> \
+  static typename MatrixType::Index blocked(MatrixType& m) \
+  { \
+    return mkl_llt<EIGTYPE>::potrf(m, 'U'); \
+  } \
+  template<typename MatrixType, typename VectorType> \
+  static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
+  { \
+    Transpose<MatrixType> matt(mat); \
+    return llt_inplace<EIGTYPE, Lower>::rankUpdate(matt, vec.conjugate(), sigma); \
+  } \
+};
+
+EIGEN_MKL_LLT(double, double, d)
+EIGEN_MKL_LLT(float, float, s)
+EIGEN_MKL_LLT(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_LLT(scomplex, MKL_Complex8, c)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_LLT_MKL_H
diff --git a/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h b/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
new file mode 100644
index 0000000..37f1421
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
@@ -0,0 +1,579 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_CHOLMODSUPPORT_H
+#define EIGEN_CHOLMODSUPPORT_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename Scalar, typename CholmodType>
+void cholmod_configure_matrix(CholmodType& mat)
+{
+  if (internal::is_same<Scalar,float>::value)
+  {
+    mat.xtype = CHOLMOD_REAL;
+    mat.dtype = CHOLMOD_SINGLE;
+  }
+  else if (internal::is_same<Scalar,double>::value)
+  {
+    mat.xtype = CHOLMOD_REAL;
+    mat.dtype = CHOLMOD_DOUBLE;
+  }
+  else if (internal::is_same<Scalar,std::complex<float> >::value)
+  {
+    mat.xtype = CHOLMOD_COMPLEX;
+    mat.dtype = CHOLMOD_SINGLE;
+  }
+  else if (internal::is_same<Scalar,std::complex<double> >::value)
+  {
+    mat.xtype = CHOLMOD_COMPLEX;
+    mat.dtype = CHOLMOD_DOUBLE;
+  }
+  else
+  {
+    eigen_assert(false && "Scalar type not supported by CHOLMOD");
+  }
+}
+
+} // namespace internal
+
+/** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object.
+  * Note that the data are shared.
+  */
+template<typename _Scalar, int _Options, typename _Index>
+cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat)
+{
+  typedef SparseMatrix<_Scalar,_Options,_Index> MatrixType;
+  cholmod_sparse res;
+  res.nzmax   = mat.nonZeros();
+  res.nrow    = mat.rows();;
+  res.ncol    = mat.cols();
+  res.p       = mat.outerIndexPtr();
+  res.i       = mat.innerIndexPtr();
+  res.x       = mat.valuePtr();
+  res.sorted  = 1;
+  if(mat.isCompressed())
+  {
+    res.packed  = 1;
+  }
+  else
+  {
+    res.packed  = 0;
+    res.nz = mat.innerNonZeroPtr();
+  }
+
+  res.dtype   = 0;
+  res.stype   = -1;
+  
+  if (internal::is_same<_Index,int>::value)
+  {
+    res.itype = CHOLMOD_INT;
+  }
+  else
+  {
+    eigen_assert(false && "Index type different than int is not supported yet");
+  }
+
+  // setup res.xtype
+  internal::cholmod_configure_matrix<_Scalar>(res);
+  
+  res.stype = 0;
+  
+  return res;
+}
+
+template<typename _Scalar, int _Options, typename _Index>
+const cholmod_sparse viewAsCholmod(const SparseMatrix<_Scalar,_Options,_Index>& mat)
+{
+  cholmod_sparse res = viewAsCholmod(mat.const_cast_derived());
+  return res;
+}
+
+/** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix.
+  * The data are not copied but shared. */
+template<typename _Scalar, int _Options, typename _Index, unsigned int UpLo>
+cholmod_sparse viewAsCholmod(const SparseSelfAdjointView<SparseMatrix<_Scalar,_Options,_Index>, UpLo>& mat)
+{
+  cholmod_sparse res = viewAsCholmod(mat.matrix().const_cast_derived());
+  
+  if(UpLo==Upper) res.stype =  1;
+  if(UpLo==Lower) res.stype = -1;
+
+  return res;
+}
+
+/** Returns a view of the Eigen \b dense matrix \a mat as Cholmod dense matrix.
+  * The data are not copied but shared. */
+template<typename Derived>
+cholmod_dense viewAsCholmod(MatrixBase<Derived>& mat)
+{
+  EIGEN_STATIC_ASSERT((internal::traits<Derived>::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  typedef typename Derived::Scalar Scalar;
+
+  cholmod_dense res;
+  res.nrow   = mat.rows();
+  res.ncol   = mat.cols();
+  res.nzmax  = res.nrow * res.ncol;
+  res.d      = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived().outerStride();
+  res.x      = mat.derived().data();
+  res.z      = 0;
+
+  internal::cholmod_configure_matrix<Scalar>(res);
+
+  return res;
+}
+
+/** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix.
+  * The data are not copied but shared. */
+template<typename Scalar, int Flags, typename Index>
+MappedSparseMatrix<Scalar,Flags,Index> viewAsEigen(cholmod_sparse& cm)
+{
+  return MappedSparseMatrix<Scalar,Flags,Index>
+         (cm.nrow, cm.ncol, reinterpret_cast<Index*>(cm.p)[cm.ncol],
+          reinterpret_cast<Index*>(cm.p), reinterpret_cast<Index*>(cm.i),reinterpret_cast<Scalar*>(cm.x) );
+}
+
+enum CholmodMode {
+  CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt
+};
+
+
+/** \ingroup CholmodSupport_Module
+  * \class CholmodBase
+  * \brief The base class for the direct Cholesky factorization of Cholmod
+  * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT
+  */
+template<typename _MatrixType, int _UpLo, typename Derived>
+class CholmodBase : internal::noncopyable
+{
+  public:
+    typedef _MatrixType MatrixType;
+    enum { UpLo = _UpLo };
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef MatrixType CholMatrixType;
+    typedef typename MatrixType::Index Index;
+
+  public:
+
+    CholmodBase()
+      : m_cholmodFactor(0), m_info(Success), m_isInitialized(false)
+    {
+      cholmod_start(&m_cholmod);
+    }
+
+    CholmodBase(const MatrixType& matrix)
+      : m_cholmodFactor(0), m_info(Success), m_isInitialized(false)
+    {
+      cholmod_start(&m_cholmod);
+      compute(matrix);
+    }
+
+    ~CholmodBase()
+    {
+      if(m_cholmodFactor)
+        cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+      cholmod_finish(&m_cholmod);
+    }
+    
+    inline Index cols() const { return m_cholmodFactor->n; }
+    inline Index rows() const { return m_cholmodFactor->n; }
+    
+    Derived& derived() { return *static_cast<Derived*>(this); }
+    const Derived& derived() const { return *static_cast<const Derived*>(this); }
+    
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    Derived& compute(const MatrixType& matrix)
+    {
+      analyzePattern(matrix);
+      factorize(matrix);
+      return derived();
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<CholmodBase, Rhs>
+    solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "LLT is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<CholmodBase, Rhs>(*this, b.derived());
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::sparse_solve_retval<CholmodBase, Rhs>
+    solve(const SparseMatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "LLT is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::sparse_solve_retval<CholmodBase, Rhs>(*this, b.derived());
+    }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      * 
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      if(m_cholmodFactor)
+      {
+        cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+        m_cholmodFactor = 0;
+      }
+      cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());
+      m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
+      
+      this->m_isInitialized = true;
+      this->m_info = Success;
+      m_analysisIsOk = true;
+      m_factorizationIsOk = false;
+    }
+    
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& matrix)
+    {
+      eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+      cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());
+      cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
+      
+      this->m_info = Success;
+      m_factorizationIsOk = true;
+    }
+    
+    /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations.
+     *  See the Cholmod user guide for details. */
+    cholmod_common& cholmod() { return m_cholmod; }
+    
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** \internal */
+    template<typename Rhs,typename Dest>
+    void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
+    {
+      eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      const Index size = m_cholmodFactor->n;
+      eigen_assert(size==b.rows());
+
+      // note: cd stands for Cholmod Dense
+      cholmod_dense b_cd = viewAsCholmod(b.const_cast_derived());
+      cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod);
+      if(!x_cd)
+      {
+        this->m_info = NumericalIssue;
+      }
+      // TODO optimize this copy by swapping when possible (be carreful with alignment, etc.)
+      dest = Matrix<Scalar,Dest::RowsAtCompileTime,Dest::ColsAtCompileTime>::Map(reinterpret_cast<Scalar*>(x_cd->x),b.rows(),b.cols());
+      cholmod_free_dense(&x_cd, &m_cholmod);
+    }
+    
+    /** \internal */
+    template<typename RhsScalar, int RhsOptions, typename RhsIndex, typename DestScalar, int DestOptions, typename DestIndex>
+    void _solve(const SparseMatrix<RhsScalar,RhsOptions,RhsIndex> &b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
+    {
+      eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      const Index size = m_cholmodFactor->n;
+      eigen_assert(size==b.rows());
+
+      // note: cs stands for Cholmod Sparse
+      cholmod_sparse b_cs = viewAsCholmod(b);
+      cholmod_sparse* x_cs = cholmod_spsolve(CHOLMOD_A, m_cholmodFactor, &b_cs, &m_cholmod);
+      if(!x_cs)
+      {
+        this->m_info = NumericalIssue;
+      }
+      // TODO optimize this copy by swapping when possible (be carreful with alignment, etc.)
+      dest = viewAsEigen<DestScalar,DestOptions,DestIndex>(*x_cs);
+      cholmod_free_sparse(&x_cs, &m_cholmod);
+    }
+    #endif // EIGEN_PARSED_BY_DOXYGEN
+    
+    template<typename Stream>
+    void dumpMemory(Stream& s)
+    {}
+    
+  protected:
+    mutable cholmod_common m_cholmod;
+    cholmod_factor* m_cholmodFactor;
+    mutable ComputationInfo m_info;
+    bool m_isInitialized;
+    int m_factorizationIsOk;
+    int m_analysisIsOk;
+};
+
+/** \ingroup CholmodSupport_Module
+  * \class CholmodSimplicialLLT
+  * \brief A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization
+  * using the Cholmod library.
+  * This simplicial variant is equivalent to Eigen's built-in SimplicialLLT class. Thefore, it has little practical interest.
+  * The sparse matrix A must be selfajoint and positive definite. The vectors or matrices
+  * X and B can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed.
+  *
+  * \sa \ref TutorialSparseDirectSolvers, class CholmodSupernodalLLT, class SimplicialLLT
+  */
+template<typename _MatrixType, int _UpLo = Lower>
+class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT<_MatrixType, _UpLo> >
+{
+    typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT> Base;
+    using Base::m_cholmod;
+    
+  public:
+    
+    typedef _MatrixType MatrixType;
+    
+    CholmodSimplicialLLT() : Base() { init(); }
+
+    CholmodSimplicialLLT(const MatrixType& matrix) : Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~CholmodSimplicialLLT() {}
+  protected:
+    void init()
+    {
+      m_cholmod.final_asis = 0;
+      m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+      m_cholmod.final_ll = 1;
+    }
+};
+
+
+/** \ingroup CholmodSupport_Module
+  * \class CholmodSimplicialLDLT
+  * \brief A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization
+  * using the Cholmod library.
+  * This simplicial variant is equivalent to Eigen's built-in SimplicialLDLT class. Thefore, it has little practical interest.
+  * The sparse matrix A must be selfajoint and positive definite. The vectors or matrices
+  * X and B can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed.
+  *
+  * \sa \ref TutorialSparseDirectSolvers, class CholmodSupernodalLLT, class SimplicialLDLT
+  */
+template<typename _MatrixType, int _UpLo = Lower>
+class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT<_MatrixType, _UpLo> >
+{
+    typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT> Base;
+    using Base::m_cholmod;
+    
+  public:
+    
+    typedef _MatrixType MatrixType;
+    
+    CholmodSimplicialLDLT() : Base() { init(); }
+
+    CholmodSimplicialLDLT(const MatrixType& matrix) : Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~CholmodSimplicialLDLT() {}
+  protected:
+    void init()
+    {
+      m_cholmod.final_asis = 1;
+      m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+    }
+};
+
+/** \ingroup CholmodSupport_Module
+  * \class CholmodSupernodalLLT
+  * \brief A supernodal Cholesky (LLT) factorization and solver based on Cholmod
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a supernodal LL^T Cholesky factorization
+  * using the Cholmod library.
+  * This supernodal variant performs best on dense enough problems, e.g., 3D FEM, or very high order 2D FEM.
+  * The sparse matrix A must be selfajoint and positive definite. The vectors or matrices
+  * X and B can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed.
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType, int _UpLo = Lower>
+class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT<_MatrixType, _UpLo> >
+{
+    typedef CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT> Base;
+    using Base::m_cholmod;
+    
+  public:
+    
+    typedef _MatrixType MatrixType;
+    
+    CholmodSupernodalLLT() : Base() { init(); }
+
+    CholmodSupernodalLLT(const MatrixType& matrix) : Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~CholmodSupernodalLLT() {}
+  protected:
+    void init()
+    {
+      m_cholmod.final_asis = 1;
+      m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
+    }
+};
+
+/** \ingroup CholmodSupport_Module
+  * \class CholmodDecomposition
+  * \brief A general Cholesky factorization and solver based on Cholmod
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization
+  * using the Cholmod library. The sparse matrix A must be selfajoint and positive definite. The vectors or matrices
+  * X and B can be either dense or sparse.
+  *
+  * This variant permits to change the underlying Cholesky method at runtime.
+  * On the other hand, it does not provide access to the result of the factorization.
+  * The default is to let Cholmod automatically choose between a simplicial and supernodal factorization.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed.
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType, int _UpLo = Lower>
+class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecomposition<_MatrixType, _UpLo> >
+{
+    typedef CholmodBase<_MatrixType, _UpLo, CholmodDecomposition> Base;
+    using Base::m_cholmod;
+    
+  public:
+    
+    typedef _MatrixType MatrixType;
+    
+    CholmodDecomposition() : Base() { init(); }
+
+    CholmodDecomposition(const MatrixType& matrix) : Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~CholmodDecomposition() {}
+    
+    void setMode(CholmodMode mode)
+    {
+      switch(mode)
+      {
+        case CholmodAuto:
+          m_cholmod.final_asis = 1;
+          m_cholmod.supernodal = CHOLMOD_AUTO;
+          break;
+        case CholmodSimplicialLLt:
+          m_cholmod.final_asis = 0;
+          m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+          m_cholmod.final_ll = 1;
+          break;
+        case CholmodSupernodalLLt:
+          m_cholmod.final_asis = 1;
+          m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
+          break;
+        case CholmodLDLt:
+          m_cholmod.final_asis = 1;
+          m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+          break;
+        default:
+          break;
+      }
+    }
+  protected:
+    void init()
+    {
+      m_cholmod.final_asis = 1;
+      m_cholmod.supernodal = CHOLMOD_AUTO;
+    }
+};
+
+namespace internal {
+  
+template<typename _MatrixType, int _UpLo, typename Derived, typename Rhs>
+struct solve_retval<CholmodBase<_MatrixType,_UpLo,Derived>, Rhs>
+  : solve_retval_base<CholmodBase<_MatrixType,_UpLo,Derived>, Rhs>
+{
+  typedef CholmodBase<_MatrixType,_UpLo,Derived> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+template<typename _MatrixType, int _UpLo, typename Derived, typename Rhs>
+struct sparse_solve_retval<CholmodBase<_MatrixType,_UpLo,Derived>, Rhs>
+  : sparse_solve_retval_base<CholmodBase<_MatrixType,_UpLo,Derived>, Rhs>
+{
+  typedef CholmodBase<_MatrixType,_UpLo,Derived> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_CHOLMODSUPPORT_H
diff --git a/extern/Eigen3/Eigen/src/Core/Array.h b/extern/Eigen3/Eigen/src/Core/Array.h
index a11fb1b..aaa3899 100644
--- a/extern/Eigen3/Eigen/src/Core/Array.h
+++ b/extern/Eigen3/Eigen/src/Core/Array.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ARRAY_H
 #define EIGEN_ARRAY_H
 
+namespace Eigen {
+
 /** \class Array 
   * \ingroup Core_Module
   *
@@ -316,5 +303,6 @@ EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \
 EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \
 EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd)
 
+} // end namespace Eigen
 
 #endif // EIGEN_ARRAY_H
diff --git a/extern/Eigen3/Eigen/src/Core/ArrayBase.h b/extern/Eigen3/Eigen/src/Core/ArrayBase.h
index 9399ac3..004b117 100644
--- a/extern/Eigen3/Eigen/src/Core/ArrayBase.h
+++ b/extern/Eigen3/Eigen/src/Core/ArrayBase.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ARRAYBASE_H
 #define EIGEN_ARRAYBASE_H
 
+namespace Eigen { 
+
 template<typename ExpressionType> class MatrixWrapper;
 
 /** \class ArrayBase
@@ -159,7 +146,7 @@ template<typename Derived> class ArrayBase
     /** \returns an \link MatrixBase Matrix \endlink expression of this array
       * \sa MatrixBase::array() */
     MatrixWrapper<Derived> matrix() { return derived(); }
-    const MatrixWrapper<Derived> matrix() const { return derived(); }
+    const MatrixWrapper<const Derived> matrix() const { return derived(); }
 
 //     template<typename Dest>
 //     inline void evalTo(Dest& dst) const { dst = matrix(); }
@@ -174,10 +161,10 @@ template<typename Derived> class ArrayBase
   protected:
     // mixing arrays and matrices is not legal
     template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& )
-    {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
+    {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
     // mixing arrays and matrices is not legal
     template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& )
-    {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
+    {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
 };
 
 /** replaces \c *this by \c *this - \a other.
@@ -236,4 +223,6 @@ ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ARRAYBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/ArrayWrapper.h b/extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
index 07f082e..87af7fd 100644
--- a/extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
+++ b/extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ARRAYWRAPPER_H
 #define EIGEN_ARRAYWRAPPER_H
 
+namespace Eigen { 
+
 /** \class ArrayWrapper
   * \ingroup Core_Module
   *
@@ -61,7 +48,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
 
     typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
 
-    inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
+    inline ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
 
     inline Index rows() const { return m_expression.rows(); }
     inline Index cols() const { return m_expression.cols(); }
@@ -71,7 +58,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
     inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
     inline const Scalar* data() const { return m_expression.data(); }
 
-    inline const CoeffReturnType coeff(Index row, Index col) const
+    inline CoeffReturnType coeff(Index row, Index col) const
     {
       return m_expression.coeff(row, col);
     }
@@ -86,7 +73,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
       return m_expression.const_cast_derived().coeffRef(row, col);
     }
 
-    inline const CoeffReturnType coeff(Index index) const
+    inline CoeffReturnType coeff(Index index) const
     {
       return m_expression.coeff(index);
     }
@@ -128,8 +115,14 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
     template<typename Dest>
     inline void evalTo(Dest& dst) const { dst = m_expression; }
 
+    const typename internal::remove_all<NestedExpressionType>::type& 
+    nestedExpression() const 
+    {
+      return m_expression;
+    }
+
   protected:
-    const NestedExpressionType m_expression;
+    NestedExpressionType m_expression;
 };
 
 /** \class MatrixWrapper
@@ -168,7 +161,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
 
     typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
 
-    inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
+    inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
 
     inline Index rows() const { return m_expression.rows(); }
     inline Index cols() const { return m_expression.cols(); }
@@ -178,7 +171,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
     inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
     inline const Scalar* data() const { return m_expression.data(); }
 
-    inline const CoeffReturnType coeff(Index row, Index col) const
+    inline CoeffReturnType coeff(Index row, Index col) const
     {
       return m_expression.coeff(row, col);
     }
@@ -193,7 +186,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
       return m_expression.derived().coeffRef(row, col);
     }
 
-    inline const CoeffReturnType coeff(Index index) const
+    inline CoeffReturnType coeff(Index index) const
     {
       return m_expression.coeff(index);
     }
@@ -232,8 +225,16 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
       m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
     }
 
+    const typename internal::remove_all<NestedExpressionType>::type& 
+    nestedExpression() const 
+    {
+      return m_expression;
+    }
+
   protected:
-    const NestedExpressionType m_expression;
+    NestedExpressionType m_expression;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_ARRAYWRAPPER_H
diff --git a/extern/Eigen3/Eigen/src/Core/Assign.h b/extern/Eigen3/Eigen/src/Core/Assign.h
index 3a17152..cd29a88 100644
--- a/extern/Eigen3/Eigen/src/Core/Assign.h
+++ b/extern/Eigen3/Eigen/src/Core/Assign.h
@@ -5,28 +5,15 @@
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ASSIGN_H
 #define EIGEN_ASSIGN_H
 
+namespace Eigen {
+
 namespace internal {
 
 /***************************************************************************
@@ -152,7 +139,7 @@ struct assign_DefaultTraversal_CompleteUnrolling
     inner = Index % Derived1::InnerSizeAtCompileTime
   };
 
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     dst.copyCoeffByOuterInner(outer, inner, src);
     assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
@@ -162,13 +149,13 @@ struct assign_DefaultTraversal_CompleteUnrolling
 template<typename Derived1, typename Derived2, int Stop>
 struct assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
+  static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
 };
 
 template<typename Derived1, typename Derived2, int Index, int Stop>
 struct assign_DefaultTraversal_InnerUnrolling
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer)
   {
     dst.copyCoeffByOuterInner(outer, Index, src);
     assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src, outer);
@@ -178,7 +165,7 @@ struct assign_DefaultTraversal_InnerUnrolling
 template<typename Derived1, typename Derived2, int Stop>
 struct assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {}
+  static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, int) {}
 };
 
 /***********************
@@ -188,7 +175,7 @@ struct assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
 template<typename Derived1, typename Derived2, int Index, int Stop>
 struct assign_LinearTraversal_CompleteUnrolling
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     dst.copyCoeff(Index, src);
     assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
@@ -198,7 +185,7 @@ struct assign_LinearTraversal_CompleteUnrolling
 template<typename Derived1, typename Derived2, int Stop>
 struct assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
+  static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
 };
 
 /**************************
@@ -214,7 +201,7 @@ struct assign_innervec_CompleteUnrolling
     JointAlignment = assign_traits<Derived1,Derived2>::JointAlignment
   };
 
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     dst.template copyPacketByOuterInner<Derived2, Aligned, JointAlignment>(outer, inner, src);
     assign_innervec_CompleteUnrolling<Derived1, Derived2,
@@ -225,13 +212,13 @@ struct assign_innervec_CompleteUnrolling
 template<typename Derived1, typename Derived2, int Stop>
 struct assign_innervec_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
+  static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
 };
 
 template<typename Derived1, typename Derived2, int Index, int Stop>
 struct assign_innervec_InnerUnrolling
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer)
   {
     dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, Index, src);
     assign_innervec_InnerUnrolling<Derived1, Derived2,
@@ -242,7 +229,7 @@ struct assign_innervec_InnerUnrolling
 template<typename Derived1, typename Derived2, int Stop>
 struct assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {}
+  static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, int) {}
 };
 
 /***************************************************************************
@@ -251,24 +238,25 @@ struct assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
 
 template<typename Derived1, typename Derived2,
          int Traversal = assign_traits<Derived1, Derived2>::Traversal,
-         int Unrolling = assign_traits<Derived1, Derived2>::Unrolling>
+         int Unrolling = assign_traits<Derived1, Derived2>::Unrolling,
+         int Version = Specialized>
 struct assign_impl;
 
 /************************
 *** Default traversal ***
 ************************/
 
-template<typename Derived1, typename Derived2, int Unrolling>
-struct assign_impl<Derived1, Derived2, InvalidTraversal, Unrolling>
+template<typename Derived1, typename Derived2, int Unrolling, int Version>
+struct assign_impl<Derived1, Derived2, InvalidTraversal, Unrolling, Version>
 {
-  inline static void run(Derived1 &, const Derived2 &) { }
+  static inline void run(Derived1 &, const Derived2 &) { }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     const Index innerSize = dst.innerSize();
     const Index outerSize = dst.outerSize();
@@ -278,21 +266,21 @@ struct assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling>
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, DefaultTraversal, CompleteUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, CompleteUnrolling, Version>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
       ::run(dst, src);
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     const Index outerSize = dst.outerSize();
     for(Index outer = 0; outer < outerSize; ++outer)
@@ -305,11 +293,11 @@ struct assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling>
 *** Linear traversal ***
 ***********************/
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     const Index size = dst.size();
     for(Index i = 0; i < size; ++i)
@@ -317,10 +305,10 @@ struct assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling>
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling, Version>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
       ::run(dst, src);
@@ -331,11 +319,11 @@ struct assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling>
 *** Inner vectorization ***
 **************************/
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     const Index innerSize = dst.innerSize();
     const Index outerSize = dst.outerSize();
@@ -346,21 +334,21 @@ struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling>
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, CompleteUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, CompleteUnrolling, Version>
 {
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
       ::run(dst, src);
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     const Index outerSize = dst.outerSize();
     for(Index outer = 0; outer < outerSize; ++outer)
@@ -398,11 +386,11 @@ struct unaligned_assign_impl<false>
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     const Index size = dst.size();
     typedef packet_traits<typename Derived1::Scalar> PacketTraits;
@@ -412,7 +400,7 @@ struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling>
       srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
     };
     const Index alignedStart = assign_traits<Derived1,Derived2>::DstIsAligned ? 0
-                             : first_aligned(&dst.coeffRef(0), size);
+                             : internal::first_aligned(&dst.coeffRef(0), size);
     const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
 
     unaligned_assign_impl<assign_traits<Derived1,Derived2>::DstIsAligned!=0>::run(src,dst,0,alignedStart);
@@ -426,11 +414,11 @@ struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling>
   }
 };
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
+  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
   {
     enum { size = Derived1::SizeAtCompileTime,
            packetSize = packet_traits<typename Derived1::Scalar>::size,
@@ -445,11 +433,11 @@ struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnroll
 *** Slice vectorization ***
 ***************************/
 
-template<typename Derived1, typename Derived2>
-struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
+template<typename Derived1, typename Derived2, int Version>
+struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling, Version>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     typedef packet_traits<typename Derived1::Scalar> PacketTraits;
     enum {
@@ -463,7 +451,7 @@ struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
     const Index outerSize = dst.outerSize();
     const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0;
     Index alignedStart = ((!alignable) || assign_traits<Derived1,Derived2>::DstIsAligned) ? 0
-                       : first_aligned(&dst.coeffRef(0,0), innerSize);
+                       : internal::first_aligned(&dst.coeffRef(0,0), innerSize);
 
     for(Index outer = 0; outer < outerSize; ++outer)
     {
@@ -531,19 +519,19 @@ struct assign_selector;
 
 template<typename Derived, typename OtherDerived>
 struct assign_selector<Derived,OtherDerived,false,false> {
-  EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
+  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
 };
 template<typename Derived, typename OtherDerived>
 struct assign_selector<Derived,OtherDerived,true,false> {
-  EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); }
+  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); }
 };
 template<typename Derived, typename OtherDerived>
 struct assign_selector<Derived,OtherDerived,false,true> {
-  EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); }
+  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); }
 };
 template<typename Derived, typename OtherDerived>
 struct assign_selector<Derived,OtherDerived,true,true> {
-  EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); }
+  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); }
 };
 
 } // end namespace internal
@@ -590,4 +578,6 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ASSIGN_H
diff --git a/extern/Eigen3/Eigen/src/Core/Assign_MKL.h b/extern/Eigen3/Eigen/src/Core/Assign_MKL.h
new file mode 100644
index 0000000..428c636
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/Assign_MKL.h
@@ -0,0 +1,224 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   MKL VML support for coefficient-wise unary Eigen expressions like a=b.sin()
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_ASSIGN_VML_H
+#define EIGEN_ASSIGN_VML_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename Op> struct vml_call
+{ enum { IsSupported = 0 }; };
+
+template<typename Dst, typename Src, typename UnaryOp>
+class vml_assign_traits
+{
+  private:
+    enum {
+      DstHasDirectAccess = Dst::Flags & DirectAccessBit,
+      SrcHasDirectAccess = Src::Flags & DirectAccessBit,
+
+      StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)),
+      InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime)
+                : int(Dst::Flags)&RowMajorBit ? int(Dst::ColsAtCompileTime)
+                : int(Dst::RowsAtCompileTime),
+      InnerMaxSize  = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime)
+                    : int(Dst::Flags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime)
+                    : int(Dst::MaxRowsAtCompileTime),
+      MaxSizeAtCompileTime = Dst::SizeAtCompileTime,
+
+      MightEnableVml =  vml_call<UnaryOp>::IsSupported && StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess
+                     && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1,
+      MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit),
+      VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize,
+      LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD,
+      MayEnableVml = MightEnableVml && LargeEnough,
+      MayLinearize = MayEnableVml && MightLinearize
+    };
+  public:
+    enum {
+      Traversal = MayLinearize ? LinearVectorizedTraversal
+                : MayEnableVml ? InnerVectorizedTraversal
+                : DefaultTraversal
+    };
+};
+
+template<typename Derived1, typename Derived2, typename UnaryOp, int Traversal, int Unrolling,
+         int VmlTraversal = vml_assign_traits<Derived1, Derived2, UnaryOp>::Traversal >
+struct vml_assign_impl
+  : assign_impl<Derived1, Eigen::CwiseUnaryOp<UnaryOp, Derived2>,Traversal,Unrolling,BuiltIn>
+{
+};
+
+template<typename Derived1, typename Derived2, typename UnaryOp, int Traversal, int Unrolling>
+struct vml_assign_impl<Derived1, Derived2, UnaryOp, Traversal, Unrolling, InnerVectorizedTraversal>
+{
+  typedef typename Derived1::Scalar Scalar;
+  typedef typename Derived1::Index Index;
+  static inline void run(Derived1& dst, const CwiseUnaryOp<UnaryOp, Derived2>& src)
+  {
+    // in case we want to (or have to) skip VML at runtime we can call:
+    // assign_impl<Derived1,Eigen::CwiseUnaryOp<UnaryOp, Derived2>,Traversal,Unrolling,BuiltIn>::run(dst,src);
+    const Index innerSize = dst.innerSize();
+    const Index outerSize = dst.outerSize();
+    for(Index outer = 0; outer < outerSize; ++outer) {
+      const Scalar *src_ptr = src.IsRowMajor ?  &(src.nestedExpression().coeffRef(outer,0)) :
+                                                &(src.nestedExpression().coeffRef(0, outer));
+      Scalar *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer));
+      vml_call<UnaryOp>::run(src.functor(), innerSize, src_ptr, dst_ptr );
+    }
+  }
+};
+
+template<typename Derived1, typename Derived2, typename UnaryOp, int Traversal, int Unrolling>
+struct vml_assign_impl<Derived1, Derived2, UnaryOp, Traversal, Unrolling, LinearVectorizedTraversal>
+{
+  static inline void run(Derived1& dst, const CwiseUnaryOp<UnaryOp, Derived2>& src)
+  {
+    // in case we want to (or have to) skip VML at runtime we can call:
+    // assign_impl<Derived1,Eigen::CwiseUnaryOp<UnaryOp, Derived2>,Traversal,Unrolling,BuiltIn>::run(dst,src);
+    vml_call<UnaryOp>::run(src.functor(), dst.size(), src.nestedExpression().data(), dst.data() );
+  }
+};
+
+// Macroses
+
+#define EIGEN_MKL_VML_SPECIALIZE_ASSIGN(TRAVERSAL,UNROLLING) \
+  template<typename Derived1, typename Derived2, typename UnaryOp> \
+  struct assign_impl<Derived1, Eigen::CwiseUnaryOp<UnaryOp, Derived2>, TRAVERSAL, UNROLLING, Specialized>  {  \
+    static inline void run(Derived1 &dst, const Eigen::CwiseUnaryOp<UnaryOp, Derived2> &src) { \
+      vml_assign_impl<Derived1,Derived2,UnaryOp,TRAVERSAL,UNROLLING>::run(dst, src); \
+    } \
+  };
+
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,NoUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,CompleteUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,InnerUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearTraversal,NoUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearTraversal,CompleteUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,NoUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,CompleteUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,InnerUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearVectorizedTraversal,CompleteUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearVectorizedTraversal,NoUnrolling)
+EIGEN_MKL_VML_SPECIALIZE_ASSIGN(SliceVectorizedTraversal,NoUnrolling)
+
+
+#if !defined (EIGEN_FAST_MATH) || (EIGEN_FAST_MATH != 1)
+#define  EIGEN_MKL_VML_MODE VML_HA
+#else
+#define  EIGEN_MKL_VML_MODE VML_LA
+#endif
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE)     \
+  template<> struct vml_call< scalar_##EIGENOP##_op<EIGENTYPE> > {               \
+    enum { IsSupported = 1 };                                                    \
+    static inline void run( const scalar_##EIGENOP##_op<EIGENTYPE>& /*func*/,        \
+                            int size, const EIGENTYPE* src, EIGENTYPE* dst) {    \
+      VMLOP(size, (const VMLTYPE*)src, (VMLTYPE*)dst);                           \
+    }                                                                            \
+  };
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE)  \
+  template<> struct vml_call< scalar_##EIGENOP##_op<EIGENTYPE> > {               \
+    enum { IsSupported = 1 };                                                    \
+    static inline void run( const scalar_##EIGENOP##_op<EIGENTYPE>& /*func*/,        \
+                            int size, const EIGENTYPE* src, EIGENTYPE* dst) {    \
+      MKL_INT64 vmlMode = EIGEN_MKL_VML_MODE;                                    \
+      VMLOP(size, (const VMLTYPE*)src, (VMLTYPE*)dst, vmlMode);                  \
+    }                                                                            \
+  };
+
+#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE)       \
+  template<> struct vml_call< scalar_##EIGENOP##_op<EIGENTYPE> > {               \
+    enum { IsSupported = 1 };                                                    \
+    static inline void run( const scalar_##EIGENOP##_op<EIGENTYPE>& func,        \
+                          int size, const EIGENTYPE* src, EIGENTYPE* dst) {      \
+      EIGENTYPE exponent = func.m_exponent;                                      \
+      MKL_INT64 vmlMode = EIGEN_MKL_VML_MODE;                                    \
+      VMLOP(&size, (const VMLTYPE*)src, (const VMLTYPE*)&exponent,               \
+                        (VMLTYPE*)dst, &vmlMode);                                \
+    }                                                                            \
+  };
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP)                   \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vs##VMLOP, float, float)             \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vd##VMLOP, double, double)
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX(EIGENOP, VMLOP)                \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vc##VMLOP, scomplex, MKL_Complex8)   \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vz##VMLOP, dcomplex, MKL_Complex16)
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP)                        \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP)                         \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX(EIGENOP, VMLOP)
+
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL_LA(EIGENOP, VMLOP)                \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vms##VMLOP, float, float)         \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmd##VMLOP, double, double)
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX_LA(EIGENOP, VMLOP)             \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmc##VMLOP, scomplex, MKL_Complex8)  \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmz##VMLOP, dcomplex, MKL_Complex16)
+
+#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(EIGENOP, VMLOP)                     \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL_LA(EIGENOP, VMLOP)                      \
+  EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX_LA(EIGENOP, VMLOP)
+
+
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(sin,  Sin)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(asin, Asin)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(cos,  Cos)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(acos, Acos)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(tan,  Tan)
+//EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs,  Abs)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(exp,  Exp)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(log,  Ln)
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(sqrt, Sqrt)
+
+EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr)
+
+// The vm*powx functions are not avaibale in the windows version of MKL.
+#ifdef _WIN32
+EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmspowx_, float, float)
+EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdpowx_, double, double)
+EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcpowx_, scomplex, MKL_Complex8)
+EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzpowx_, dcomplex, MKL_Complex16)
+#endif
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_ASSIGN_VML_H
diff --git a/extern/Eigen3/Eigen/src/Core/BandMatrix.h b/extern/Eigen3/Eigen/src/Core/BandMatrix.h
index 2570d7b..ffd7fe8 100644
--- a/extern/Eigen3/Eigen/src/Core/BandMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/BandMatrix.h
@@ -3,30 +3,16 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BANDMATRIX_H
 #define EIGEN_BANDMATRIX_H
 
-namespace internal {
+namespace Eigen { 
 
+namespace internal {
 
 template<typename Derived>
 class BandMatrixBase : public EigenBase<Derived>
@@ -343,4 +329,6 @@ class TridiagonalMatrix : public BandMatrix<Scalar,Size,Size,Options&SelfAdjoint
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_BANDMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/Block.h b/extern/Eigen3/Eigen/src/Core/Block.h
index d470bc1..5f29cb3 100644
--- a/extern/Eigen3/Eigen/src/Core/Block.h
+++ b/extern/Eigen3/Eigen/src/Core/Block.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BLOCK_H
 #define EIGEN_BLOCK_H
 
+namespace Eigen { 
+
 /** \class Block
   * \ingroup Core_Module
   *
@@ -242,6 +229,21 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
     inline Index outerStride() const;
     #endif
 
+    const typename internal::remove_all<typename XprType::Nested>::type& nestedExpression() const 
+    { 
+      return m_xpr; 
+    }
+      
+    Index startRow() const 
+    { 
+      return m_startRow.value(); 
+    }
+      
+    Index startCol() const 
+    { 
+      return m_startCol.value(); 
+    }
+
   protected:
 
     const typename XprType::Nested m_xpr;
@@ -304,6 +306,11 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
       init();
     }
 
+    const typename internal::remove_all<typename XprType::Nested>::type& nestedExpression() const 
+    { 
+      return m_xpr; 
+    }
+      
     /** \sa MapBase::innerStride() */
     inline Index innerStride() const
     {
@@ -341,9 +348,10 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
                     : m_xpr.innerStride();
     }
 
-    const typename XprType::Nested m_xpr;
+    typename XprType::Nested m_xpr;
     Index m_outerStride;
 };
 
+} // end namespace Eigen
 
 #endif // EIGEN_BLOCK_H
diff --git a/extern/Eigen3/Eigen/src/Core/BooleanRedux.h b/extern/Eigen3/Eigen/src/Core/BooleanRedux.h
index 5c3444a..57efd8e 100644
--- a/extern/Eigen3/Eigen/src/Core/BooleanRedux.h
+++ b/extern/Eigen3/Eigen/src/Core/BooleanRedux.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ALLANDANY_H
 #define EIGEN_ALLANDANY_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Derived, int UnrollCount>
@@ -35,7 +22,7 @@ struct all_unroller
     row = (UnrollCount-1) % Derived::RowsAtCompileTime
   };
 
-  inline static bool run(const Derived &mat)
+  static inline bool run(const Derived &mat)
   {
     return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
   }
@@ -44,13 +31,13 @@ struct all_unroller
 template<typename Derived>
 struct all_unroller<Derived, 1>
 {
-  inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
+  static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
 };
 
 template<typename Derived>
 struct all_unroller<Derived, Dynamic>
 {
-  inline static bool run(const Derived &) { return false; }
+  static inline bool run(const Derived &) { return false; }
 };
 
 template<typename Derived, int UnrollCount>
@@ -61,7 +48,7 @@ struct any_unroller
     row = (UnrollCount-1) % Derived::RowsAtCompileTime
   };
 
-  inline static bool run(const Derived &mat)
+  static inline bool run(const Derived &mat)
   {
     return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
   }
@@ -70,13 +57,13 @@ struct any_unroller
 template<typename Derived>
 struct any_unroller<Derived, 1>
 {
-  inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
+  static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
 };
 
 template<typename Derived>
 struct any_unroller<Derived, Dynamic>
 {
-  inline static bool run(const Derived &) { return false; }
+  static inline bool run(const Derived &) { return false; }
 };
 
 } // end namespace internal
@@ -146,4 +133,6 @@ inline typename DenseBase<Derived>::Index DenseBase<Derived>::count() const
   return derived().template cast<bool>().template cast<Index>().sum();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ALLANDANY_H
diff --git a/extern/Eigen3/Eigen/src/Core/CommaInitializer.h b/extern/Eigen3/Eigen/src/Core/CommaInitializer.h
index 92422bf..4adce64 100644
--- a/extern/Eigen3/Eigen/src/Core/CommaInitializer.h
+++ b/extern/Eigen3/Eigen/src/Core/CommaInitializer.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMMAINITIALIZER_H
 #define EIGEN_COMMAINITIALIZER_H
 
+namespace Eigen { 
+
 /** \class CommaInitializer
   * \ingroup Core_Module
   *
@@ -147,4 +134,6 @@ DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other)
   return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMMAINITIALIZER_H
diff --git a/extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h b/extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
index 7386b2e..1b93af3 100644
--- a/extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
+++ b/extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CWISE_BINARY_OP_H
 #define EIGEN_CWISE_BINARY_OP_H
 
+namespace Eigen {
+
 /** \class CwiseBinaryOp
   * \ingroup Core_Module
   *
@@ -167,8 +154,8 @@ class CwiseBinaryOp : internal::no_assignment_operator,
     const BinaryOp& functor() const { return m_functor; }
 
   protected:
-    const LhsNested m_lhs;
-    const RhsNested m_rhs;
+    LhsNested m_lhs;
+    RhsNested m_rhs;
     const BinaryOp m_functor;
 };
 
@@ -237,4 +224,6 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_CWISE_BINARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h b/extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h
index c616e7a..2635a62 100644
--- a/extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h
+++ b/extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CWISE_NULLARY_OP_H
 #define EIGEN_CWISE_NULLARY_OP_H
 
+namespace Eigen {
+
 /** \class CwiseNullaryOp
   * \ingroup Core_Module
   *
@@ -101,6 +88,9 @@ class CwiseNullaryOp : internal::no_assignment_operator,
       return m_functor.packetOp(index);
     }
 
+    /** \returns the functor representing the nullary operation */
+    const NullaryOp& functor() const { return m_functor; }
+
   protected:
     const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
     const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
@@ -238,6 +228,8 @@ DenseBase<Derived>::Constant(const Scalar& value)
   * assumed to be a(0), a(1), ..., a(size). This assumption allows for better vectorization
   * and yields faster code than the random access version.
   *
+  * When size is set to 1, a vector of length 1 containing 'high' is returned.
+  *
   * \only_for_vectors
   *
   * Example: \include DenseBase_LinSpaced_seq.cpp
@@ -270,6 +262,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig
   * \brief Sets a linearly space vector.
   *
   * The function generates 'size' equally spaced values in the closed interval [low,high].
+  * When size is set to 1, a vector of length 1 containing 'high' is returned.
   *
   * \only_for_vectors
   *
@@ -381,6 +374,7 @@ PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& valu
   * \brief Sets a linearly space vector.
   *
   * The function generates 'size' equally spaced values in the closed interval [low,high].
+  * When size is set to 1, a vector of length 1 containing 'high' is returned.
   *
   * \only_for_vectors
   *
@@ -396,6 +390,23 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index size, const
   return derived() = Derived::NullaryExpr(size, internal::linspaced_op<Scalar,false>(low,high,size));
 }
 
+/**
+  * \brief Sets a linearly space vector.
+  *
+  * The function fill *this with equally spaced values in the closed interval [low,high].
+  * When size is set to 1, a vector of length 1 containing 'high' is returned.
+  *
+  * \only_for_vectors
+  *
+  * \sa setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
+  */
+template<typename Derived>
+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
+{
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
+  return setLinSpaced(size(), low, high);
+}
+
 // zero:
 
 /** \returns an expression of a zero matrix.
@@ -848,4 +859,6 @@ template<typename Derived>
 EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
 { return Derived::Unit(3); }
 
+} // end namespace Eigen
+
 #endif // EIGEN_CWISE_NULLARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h b/extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
index 958571d..063355a 100644
--- a/extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
+++ b/extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CWISE_UNARY_OP_H
 #define EIGEN_CWISE_UNARY_OP_H
 
+namespace Eigen { 
+
 /** \class CwiseUnaryOp
   * \ingroup Core_Module
   *
@@ -95,7 +82,7 @@ class CwiseUnaryOp : internal::no_assignment_operator,
     nestedExpression() { return m_xpr.const_cast_derived(); }
 
   protected:
-    const typename XprType::Nested m_xpr;
+    typename XprType::Nested m_xpr;
     const UnaryOp m_functor;
 };
 
@@ -134,4 +121,6 @@ class CwiseUnaryOpImpl<UnaryOp,XprType,Dense>
     }
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_CWISE_UNARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/Core/CwiseUnaryView.h b/extern/Eigen3/Eigen/src/Core/CwiseUnaryView.h
index d24ef03..66f73a9 100644
--- a/extern/Eigen3/Eigen/src/Core/CwiseUnaryView.h
+++ b/extern/Eigen3/Eigen/src/Core/CwiseUnaryView.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CWISE_UNARY_VIEW_H
 #define EIGEN_CWISE_UNARY_VIEW_H
 
+namespace Eigen {
+
 /** \class CwiseUnaryView
   * \ingroup Core_Module
   *
@@ -97,7 +84,7 @@ class CwiseUnaryView : internal::no_assignment_operator,
 
   protected:
     // FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC
-    const typename internal::nested<MatrixType>::type m_matrix;
+    typename internal::nested<MatrixType>::type m_matrix;
     ViewOp m_functor;
 };
 
@@ -143,6 +130,6 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
     }
 };
 
-
+} // end namespace Eigen
 
 #endif // EIGEN_CWISE_UNARY_VIEW_H
diff --git a/extern/Eigen3/Eigen/src/Core/DenseBase.h b/extern/Eigen3/Eigen/src/Core/DenseBase.h
index 920904f..1cc0314 100644
--- a/extern/Eigen3/Eigen/src/Core/DenseBase.h
+++ b/extern/Eigen3/Eigen/src/Core/DenseBase.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DENSEBASE_H
 #define EIGEN_DENSEBASE_H
 
+namespace Eigen {
+
 /** \class DenseBase
   * \ingroup Core_Module
   *
@@ -376,12 +363,13 @@ template<typename Derived> class DenseBase
     inline Derived& operator*=(const Scalar& other);
     inline Derived& operator/=(const Scalar& other);
 
+    typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
     /** \returns the matrix or vector obtained by evaluating this expression.
       *
       * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
       * a const reference, in order to avoid a useless copy.
       */
-    EIGEN_STRONG_INLINE const typename internal::eval<Derived>::type eval() const
+    EIGEN_STRONG_INLINE EvalReturnType eval() const
     {
       // Even though MSVC does not honor strong inlining when the return type
       // is a dynamic matrix, we desperately need strong inlining for fixed
@@ -540,4 +528,6 @@ template<typename Derived> class DenseBase
     template<typename OtherDerived> explicit DenseBase(const DenseBase<OtherDerived>&);
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_DENSEBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h b/extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h
index e45238f..72704c2 100644
--- a/extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h
+++ b/extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DENSECOEFFSBASE_H
 #define EIGEN_DENSECOEFFSBASE_H
 
+namespace Eigen {
+
 namespace internal {
 template<typename T> struct add_const_on_value_type_if_arithmetic
 {
@@ -710,16 +697,16 @@ namespace internal {
 template<typename Derived, bool JustReturnZero>
 struct first_aligned_impl
 {
-  inline static typename Derived::Index run(const Derived&)
+  static inline typename Derived::Index run(const Derived&)
   { return 0; }
 };
 
 template<typename Derived>
 struct first_aligned_impl<Derived, false>
 {
-  inline static typename Derived::Index run(const Derived& m)
+  static inline typename Derived::Index run(const Derived& m)
   {
-    return first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size());
+    return internal::first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size());
   }
 };
 
@@ -729,7 +716,7 @@ struct first_aligned_impl<Derived, false>
   * documentation.
   */
 template<typename Derived>
-inline static typename Derived::Index first_aligned(const Derived& m)
+static inline typename Derived::Index first_aligned(const Derived& m)
 {
   return first_aligned_impl
           <Derived, (Derived::Flags & AlignedBit) || !(Derived::Flags & DirectAccessBit)>
@@ -762,4 +749,6 @@ struct outer_stride_at_compile_time<Derived, false>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_DENSECOEFFSBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/DenseStorage.h b/extern/Eigen3/Eigen/src/Core/DenseStorage.h
index 813053b..1fc2daf 100644
--- a/extern/Eigen3/Eigen/src/Core/DenseStorage.h
+++ b/extern/Eigen3/Eigen/src/Core/DenseStorage.h
@@ -5,24 +5,9 @@
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2010 Hauke Heibel <hauke.heibel at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MATRIXSTORAGE_H
 #define EIGEN_MATRIXSTORAGE_H
@@ -33,6 +18,8 @@
   #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
 #endif
 
+namespace Eigen {
+
 namespace internal {
 
 struct constructor_without_unaligned_array_assert {};
@@ -104,8 +91,8 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
       : m_data(internal::constructor_without_unaligned_array_assert()) {}
     inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
     inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
-    inline static DenseIndex rows(void) {return _Rows;}
-    inline static DenseIndex cols(void) {return _Cols;}
+    static inline DenseIndex rows(void) {return _Rows;}
+    static inline DenseIndex cols(void) {return _Cols;}
     inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
     inline void resize(DenseIndex,DenseIndex,DenseIndex) {}
     inline const T *data() const { return m_data.array; }
@@ -120,14 +107,24 @@ template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0
     inline DenseStorage(internal::constructor_without_unaligned_array_assert) {}
     inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
     inline void swap(DenseStorage& ) {}
-    inline static DenseIndex rows(void) {return _Rows;}
-    inline static DenseIndex cols(void) {return _Cols;}
+    static inline DenseIndex rows(void) {return _Rows;}
+    static inline DenseIndex cols(void) {return _Cols;}
     inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
     inline void resize(DenseIndex,DenseIndex,DenseIndex) {}
     inline const T *data() const { return 0; }
     inline T *data() { return 0; }
 };
 
+// more specializations for null matrices; these are necessary to resolve ambiguities
+template<typename T, int _Options> class DenseStorage<T, 0, Dynamic, Dynamic, _Options>
+: public DenseStorage<T, 0, 0, 0, _Options> { };
+
+template<typename T, int _Rows, int _Options> class DenseStorage<T, 0, _Rows, Dynamic, _Options>
+: public DenseStorage<T, 0, 0, 0, _Options> { };
+
+template<typename T, int _Cols, int _Options> class DenseStorage<T, 0, Dynamic, _Cols, _Options>
+: public DenseStorage<T, 0, 0, 0, _Options> { };
+
 // dynamic-size matrix with fixed-size storage
 template<typename T, int Size, int _Options> class DenseStorage<T, Size, Dynamic, Dynamic, _Options>
 {
@@ -241,7 +238,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
     { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
     inline ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
     inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
-    inline static DenseIndex rows(void) {return _Rows;}
+    static inline DenseIndex rows(void) {return _Rows;}
     inline DenseIndex cols(void) const {return m_cols;}
     inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex cols)
     {
@@ -278,7 +275,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
     inline ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
     inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
     inline DenseIndex rows(void) const {return m_rows;}
-    inline static DenseIndex cols(void) {return _Cols;}
+    static inline DenseIndex cols(void) {return _Cols;}
     inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex)
     {
       m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
@@ -301,4 +298,6 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
     inline T *data() { return m_data; }
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/Diagonal.h b/extern/Eigen3/Eigen/src/Core/Diagonal.h
index 61d3b06..1626196 100644
--- a/extern/Eigen3/Eigen/src/Core/Diagonal.h
+++ b/extern/Eigen3/Eigen/src/Core/Diagonal.h
@@ -2,29 +2,17 @@
 // for linear algebra.
 //
 // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DIAGONAL_H
 #define EIGEN_DIAGONAL_H
 
+namespace Eigen { 
+
 /** \class Diagonal
   * \ingroup Core_Module
   *
@@ -53,16 +41,15 @@ struct traits<Diagonal<MatrixType,DiagIndex> >
   typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
   typedef typename MatrixType::StorageKind StorageKind;
   enum {
-    AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic
-    // FIXME these computations are broken in the case where the matrix is rectangular and DiagIndex!=0
     RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic
-                      : (EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime,
-                                        MatrixType::ColsAtCompileTime) - AbsDiagIndex),
+    : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
+                            MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
     ColsAtCompileTime = 1,
     MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic
                          : DiagIndex == Dynamic ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime,
-                                                                    MatrixType::MaxColsAtCompileTime)
-                         : (EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex),
+                                                                              MatrixType::MaxColsAtCompileTime)
+                         : (EIGEN_PLAIN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
+                                                 MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
     MaxColsAtCompileTime = 1,
     MaskLvalueBit = is_lvalue<MatrixType>::value ? LvalueBit : 0,
     Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit,
@@ -101,6 +88,15 @@ template<typename MatrixType, int DiagIndex> class Diagonal
       return 0;
     }
 
+    typedef typename internal::conditional<
+                       internal::is_lvalue<MatrixType>::value,
+                       Scalar,
+                       const Scalar
+                     >::type ScalarWithConstIfNotLvalue;
+
+    inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); }
+    inline const Scalar* data() const { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); }
+
     inline Scalar& coeffRef(Index row, Index)
     {
       EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
@@ -133,8 +129,19 @@ template<typename MatrixType, int DiagIndex> class Diagonal
       return m_matrix.coeff(index+rowOffset(), index+colOffset());
     }
 
+    const typename internal::remove_all<typename MatrixType::Nested>::type& 
+    nestedExpression() const 
+    {
+      return m_matrix;
+    }
+
+    int index() const
+    {
+      return m_index.value();
+    }
+
   protected:
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
     const internal::variable_if_dynamic<Index, DiagIndex> m_index;
 
   private:
@@ -224,4 +231,6 @@ MatrixBase<Derived>::diagonal() const
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_DIAGONAL_H
diff --git a/extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h b/extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h
index f41a74b..88190da 100644
--- a/extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DIAGONALMATRIX_H
 #define EIGEN_DIAGONALMATRIX_H
 
+namespace Eigen { 
+
 #ifndef EIGEN_PARSED_BY_DOXYGEN
 template<typename Derived>
 class DiagonalBase : public EigenBase<Derived>
@@ -72,7 +59,7 @@ class DiagonalBase : public EigenBase<Derived>
     const DiagonalProduct<MatrixDerived, Derived, OnTheLeft>
     operator*(const MatrixBase<MatrixDerived> &matrix) const;
 
-    inline const DiagonalWrapper<CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> >
+    inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> >
     inverse() const
     {
       return diagonal().cwiseInverse();
@@ -251,13 +238,13 @@ class DiagonalWrapper
     #endif
 
     /** Constructor from expression of diagonal coefficients to wrap. */
-    inline DiagonalWrapper(const DiagonalVectorType& diagonal) : m_diagonal(diagonal) {}
+    inline DiagonalWrapper(DiagonalVectorType& diagonal) : m_diagonal(diagonal) {}
 
     /** \returns a const reference to the wrapped expression of diagonal coefficients. */
     const DiagonalVectorType& diagonal() const { return m_diagonal; }
 
   protected:
-    const typename DiagonalVectorType::Nested m_diagonal;
+    typename DiagonalVectorType::Nested m_diagonal;
 };
 
 /** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients
@@ -303,4 +290,6 @@ bool MatrixBase<Derived>::isDiagonal(RealScalar prec) const
   return true;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_DIAGONALMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/DiagonalProduct.h b/extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
index de0c6ed..598c6b3 100644
--- a/extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
+++ b/extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DIAGONALPRODUCT_H
 #define EIGEN_DIAGONALPRODUCT_H
 
+namespace Eigen { 
+
 namespace internal {
 template<typename MatrixType, typename DiagonalType, int ProductOrder>
 struct traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
@@ -107,8 +94,8 @@ class DiagonalProduct : internal::no_assignment_operator,
                      m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
     }
 
-    const typename MatrixType::Nested m_matrix;
-    const typename DiagonalType::Nested m_diagonal;
+    typename MatrixType::Nested m_matrix;
+    typename DiagonalType::Nested m_diagonal;
 };
 
 /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal.
@@ -131,5 +118,6 @@ DiagonalBase<DiagonalDerived>::operator*(const MatrixBase<MatrixDerived> &matrix
   return DiagonalProduct<MatrixDerived, DiagonalDerived, OnTheLeft>(matrix.derived(), derived());
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_DIAGONALPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Core/Dot.h b/extern/Eigen3/Eigen/src/Core/Dot.h
index 42da784..ae9274e 100644
--- a/extern/Eigen3/Eigen/src/Core/Dot.h
+++ b/extern/Eigen3/Eigen/src/Core/Dot.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2008, 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DOT_H
 #define EIGEN_DOT_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot
@@ -176,7 +163,7 @@ template<typename Derived, int p>
 struct lpNorm_selector
 {
   typedef typename NumTraits<typename traits<Derived>::Scalar>::Real RealScalar;
-  inline static RealScalar run(const MatrixBase<Derived>& m)
+  static inline RealScalar run(const MatrixBase<Derived>& m)
   {
     return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p);
   }
@@ -185,7 +172,7 @@ struct lpNorm_selector
 template<typename Derived>
 struct lpNorm_selector<Derived, 1>
 {
-  inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+  static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
   {
     return m.cwiseAbs().sum();
   }
@@ -194,7 +181,7 @@ struct lpNorm_selector<Derived, 1>
 template<typename Derived>
 struct lpNorm_selector<Derived, 2>
 {
-  inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+  static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
   {
     return m.norm();
   }
@@ -203,7 +190,7 @@ struct lpNorm_selector<Derived, 2>
 template<typename Derived>
 struct lpNorm_selector<Derived, Infinity>
 {
-  inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+  static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
   {
     return m.cwiseAbs().maxCoeff();
   }
@@ -269,4 +256,6 @@ bool MatrixBase<Derived>::isUnitary(RealScalar prec) const
   return true;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_DOT_H
diff --git a/extern/Eigen3/Eigen/src/Core/EigenBase.h b/extern/Eigen3/Eigen/src/Core/EigenBase.h
index 0472539..0bbd28b 100644
--- a/extern/Eigen3/Eigen/src/Core/EigenBase.h
+++ b/extern/Eigen3/Eigen/src/Core/EigenBase.h
@@ -4,28 +4,14 @@
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_EIGENBASE_H
 #define EIGEN_EIGENBASE_H
 
+namespace Eigen {
 
 /** Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T).
   *
@@ -169,4 +155,6 @@ inline void MatrixBase<Derived>::applyOnTheLeft(const EigenBase<OtherDerived> &o
   other.derived().applyThisOnTheLeft(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_EIGENBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Flagged.h b/extern/Eigen3/Eigen/src/Core/Flagged.h
index 458213a..1f2955f 100644
--- a/extern/Eigen3/Eigen/src/Core/Flagged.h
+++ b/extern/Eigen3/Eigen/src/Core/Flagged.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FLAGGED_H
 #define EIGEN_FLAGGED_H
 
+namespace Eigen { 
+
 /** \class Flagged
   * \ingroup Core_Module
   *
@@ -148,4 +135,6 @@ DenseBase<Derived>::flagged() const
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_FLAGGED_H
diff --git a/extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h b/extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h
index 11c1f8f..807c7a2 100644
--- a/extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h
+++ b/extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FORCEALIGNEDACCESS_H
 #define EIGEN_FORCEALIGNEDACCESS_H
 
+namespace Eigen {
+
 /** \class ForceAlignedAccess
   * \ingroup Core_Module
   *
@@ -154,4 +141,6 @@ MatrixBase<Derived>::forceAlignedAccessIf()
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_FORCEALIGNEDACCESS_H
diff --git a/extern/Eigen3/Eigen/src/Core/Functors.h b/extern/Eigen3/Eigen/src/Core/Functors.h
index 54636e0..278c46c 100644
--- a/extern/Eigen3/Eigen/src/Core/Functors.h
+++ b/extern/Eigen3/Eigen/src/Core/Functors.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FUNCTORS_H
 #define EIGEN_FUNCTORS_H
 
+namespace Eigen {
+
 namespace internal {
 
 // associative functors:
@@ -178,6 +165,18 @@ struct functor_traits<scalar_hypot_op<Scalar> > {
   enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess=0 };
 };
 
+/** \internal
+  * \brief Template functor to compute the pow of two scalars
+  */
+template<typename Scalar, typename OtherScalar> struct scalar_binary_pow_op {
+  EIGEN_EMPTY_STRUCT_CTOR(scalar_binary_pow_op)
+  inline Scalar operator() (const Scalar& a, const OtherScalar& b) const { return internal::pow(a, b); }
+};
+template<typename Scalar, typename OtherScalar>
+struct functor_traits<scalar_binary_pow_op<Scalar,OtherScalar> > {
+  enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false };
+};
+
 // other binary functors:
 
 /** \internal
@@ -220,6 +219,38 @@ struct functor_traits<scalar_quotient_op<Scalar> > {
   };
 };
 
+/** \internal
+  * \brief Template functor to compute the and of two booleans
+  *
+  * \sa class CwiseBinaryOp, ArrayBase::operator&&
+  */
+struct scalar_boolean_and_op {
+  EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_and_op)
+  EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a && b; }
+};
+template<> struct functor_traits<scalar_boolean_and_op> {
+  enum {
+    Cost = NumTraits<bool>::AddCost,
+    PacketAccess = false
+  };
+};
+
+/** \internal
+  * \brief Template functor to compute the or of two booleans
+  *
+  * \sa class CwiseBinaryOp, ArrayBase::operator||
+  */
+struct scalar_boolean_or_op {
+  EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_or_op)
+  EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a || b; }
+};
+template<> struct functor_traits<scalar_boolean_or_op> {
+  enum {
+    Cost = NumTraits<bool>::AddCost,
+    PacketAccess = false
+  };
+};
+
 // unary functors:
 
 /** \internal
@@ -249,7 +280,7 @@ struct functor_traits<scalar_opposite_op<Scalar> >
 template<typename Scalar> struct scalar_abs_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs(a); }
+  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs(a); }
   template<typename Packet>
   EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
   { return internal::pabs(a); }
@@ -271,7 +302,7 @@ struct functor_traits<scalar_abs_op<Scalar> >
 template<typename Scalar> struct scalar_abs2_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs2(a); }
+  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs2(a); }
   template<typename Packet>
   EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
   { return internal::pmul(a,a); }
@@ -287,7 +318,7 @@ struct functor_traits<scalar_abs2_op<Scalar> >
   */
 template<typename Scalar> struct scalar_conjugate_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op)
-  EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return conj(a); }
+  EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return internal::conj(a); }
   template<typename Packet>
   EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); }
 };
@@ -324,7 +355,7 @@ template<typename Scalar>
 struct scalar_real_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return real(a); }
+  EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::real(a); }
 };
 template<typename Scalar>
 struct functor_traits<scalar_real_op<Scalar> >
@@ -339,7 +370,7 @@ template<typename Scalar>
 struct scalar_imag_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return imag(a); }
+  EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::imag(a); }
 };
 template<typename Scalar>
 struct functor_traits<scalar_imag_op<Scalar> >
@@ -354,7 +385,7 @@ template<typename Scalar>
 struct scalar_real_ref_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return real_ref(*const_cast<Scalar*>(&a)); }
+  EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::real_ref(*const_cast<Scalar*>(&a)); }
 };
 template<typename Scalar>
 struct functor_traits<scalar_real_ref_op<Scalar> >
@@ -369,7 +400,7 @@ template<typename Scalar>
 struct scalar_imag_ref_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return imag_ref(*const_cast<Scalar*>(&a)); }
+  EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::imag_ref(*const_cast<Scalar*>(&a)); }
 };
 template<typename Scalar>
 struct functor_traits<scalar_imag_ref_op<Scalar> >
@@ -383,7 +414,7 @@ struct functor_traits<scalar_imag_ref_op<Scalar> >
   */
 template<typename Scalar> struct scalar_exp_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op)
-  inline const Scalar operator() (const Scalar& a) const { return exp(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::exp(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::pexp(a); }
 };
@@ -399,7 +430,7 @@ struct functor_traits<scalar_exp_op<Scalar> >
   */
 template<typename Scalar> struct scalar_log_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op)
-  inline const Scalar operator() (const Scalar& a) const { return log(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::log(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::plog(a); }
 };
@@ -584,7 +615,7 @@ template <typename Scalar, bool RandomAccess> struct functor_traits< linspaced_o
 template <typename Scalar, bool RandomAccess> struct linspaced_op
 {
   typedef typename packet_traits<Scalar>::type Packet;
-  linspaced_op(Scalar low, Scalar high, int num_steps) : impl(low, (high-low)/(num_steps-1)) {}
+  linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {}
 
   template<typename Index>
   EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }
@@ -657,7 +688,7 @@ struct functor_traits<scalar_add_op<Scalar> >
   */
 template<typename Scalar> struct scalar_sqrt_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op)
-  inline const Scalar operator() (const Scalar& a) const { return sqrt(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::sqrt(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); }
 };
@@ -675,7 +706,7 @@ struct functor_traits<scalar_sqrt_op<Scalar> >
   */
 template<typename Scalar> struct scalar_cos_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op)
-  inline Scalar operator() (const Scalar& a) const { return cos(a); }
+  inline Scalar operator() (const Scalar& a) const { return internal::cos(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::pcos(a); }
 };
@@ -694,7 +725,7 @@ struct functor_traits<scalar_cos_op<Scalar> >
   */
 template<typename Scalar> struct scalar_sin_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op)
-  inline const Scalar operator() (const Scalar& a) const { return sin(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::sin(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::psin(a); }
 };
@@ -714,7 +745,7 @@ struct functor_traits<scalar_sin_op<Scalar> >
   */
 template<typename Scalar> struct scalar_tan_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op)
-  inline const Scalar operator() (const Scalar& a) const { return tan(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::tan(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::ptan(a); }
 };
@@ -733,7 +764,7 @@ struct functor_traits<scalar_tan_op<Scalar> >
   */
 template<typename Scalar> struct scalar_acos_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op)
-  inline const Scalar operator() (const Scalar& a) const { return acos(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::acos(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::pacos(a); }
 };
@@ -752,7 +783,7 @@ struct functor_traits<scalar_acos_op<Scalar> >
   */
 template<typename Scalar> struct scalar_asin_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op)
-  inline const Scalar operator() (const Scalar& a) const { return asin(a); }
+  inline const Scalar operator() (const Scalar& a) const { return internal::asin(a); }
   typedef typename packet_traits<Scalar>::type Packet;
   inline Packet packetOp(const Packet& a) const { return internal::pasin(a); }
 };
@@ -782,6 +813,20 @@ struct functor_traits<scalar_pow_op<Scalar> >
 { enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false }; };
 
 /** \internal
+  * \brief Template functor to compute the quotient between a scalar and array entries.
+  * \sa class CwiseUnaryOp, Cwise::inverse()
+  */
+template<typename Scalar>
+struct scalar_inverse_mult_op {
+  scalar_inverse_mult_op(const Scalar& other) : m_other(other) {}
+  inline Scalar operator() (const Scalar& a) const { return m_other / a; }
+  template<typename Packet>
+  inline const Packet packetOp(const Packet& a) const
+  { return internal::pdiv(pset1<Packet>(m_other),a); }
+  Scalar m_other;
+};
+
+/** \internal
   * \brief Template functor to compute the inverse of a scalar
   * \sa class CwiseUnaryOp, Cwise::inverse()
   */
@@ -939,4 +984,6 @@ struct functor_traits<std::binary_compose<T0,T1,T2> >
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_FUNCTORS_H
diff --git a/extern/Eigen3/Eigen/src/Core/Fuzzy.h b/extern/Eigen3/Eigen/src/Core/Fuzzy.h
index d266eed..d74edcf 100644
--- a/extern/Eigen3/Eigen/src/Core/Fuzzy.h
+++ b/extern/Eigen3/Eigen/src/Core/Fuzzy.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FUZZY_H
 #define EIGEN_FUZZY_H
 
+namespace Eigen { 
+
 namespace internal
 {
 
@@ -35,8 +22,8 @@ struct isApprox_selector
   static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec)
   {
     using std::min;
-    const typename internal::nested<Derived,2>::type nested(x);
-    const typename internal::nested<OtherDerived,2>::type otherNested(y);
+    typename internal::nested<Derived,2>::type nested(x);
+    typename internal::nested<OtherDerived,2>::type otherNested(y);
     return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
   }
 };
@@ -158,4 +145,6 @@ bool DenseBase<Derived>::isMuchSmallerThan(
   return internal::isMuchSmallerThan_object_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_FUZZY_H
diff --git a/extern/Eigen3/Eigen/src/Core/GeneralProduct.h b/extern/Eigen3/Eigen/src/Core/GeneralProduct.h
new file mode 100644
index 0000000..bfc2a67
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/GeneralProduct.h
@@ -0,0 +1,613 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_GENERAL_PRODUCT_H
+#define EIGEN_GENERAL_PRODUCT_H
+
+namespace Eigen { 
+
+/** \class GeneralProduct
+  * \ingroup Core_Module
+  *
+  * \brief Expression of the product of two general matrices or vectors
+  *
+  * \param LhsNested the type used to store the left-hand side
+  * \param RhsNested the type used to store the right-hand side
+  * \param ProductMode the type of the product
+  *
+  * This class represents an expression of the product of two general matrices.
+  * We call a general matrix, a dense matrix with full storage. For instance,
+  * This excludes triangular, selfadjoint, and sparse matrices.
+  * It is the return type of the operator* between general matrices. Its template
+  * arguments are determined automatically by ProductReturnType. Therefore,
+  * GeneralProduct should never be used direclty. To determine the result type of a
+  * function which involves a matrix product, use ProductReturnType::Type.
+  *
+  * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
+  */
+template<typename Lhs, typename Rhs, int ProductType = internal::product_type<Lhs,Rhs>::value>
+class GeneralProduct;
+
+enum {
+  Large = 2,
+  Small = 3
+};
+
+namespace internal {
+
+template<int Rows, int Cols, int Depth> struct product_type_selector;
+
+template<int Size, int MaxSize> struct product_size_category
+{
+  enum { is_large = MaxSize == Dynamic ||
+                    Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD,
+         value = is_large  ? Large
+               : Size == 1 ? 1
+                           : Small
+  };
+};
+
+template<typename Lhs, typename Rhs> struct product_type
+{
+  typedef typename remove_all<Lhs>::type _Lhs;
+  typedef typename remove_all<Rhs>::type _Rhs;
+  enum {
+    MaxRows  = _Lhs::MaxRowsAtCompileTime,
+    Rows  = _Lhs::RowsAtCompileTime,
+    MaxCols  = _Rhs::MaxColsAtCompileTime,
+    Cols  = _Rhs::ColsAtCompileTime,
+    MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime,
+                                           _Rhs::MaxRowsAtCompileTime),
+    Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime,
+                                        _Rhs::RowsAtCompileTime),
+    LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
+  };
+
+  // the splitting into different lines of code here, introducing the _select enums and the typedef below,
+  // is to work around an internal compiler error with gcc 4.1 and 4.2.
+private:
+  enum {
+    rows_select = product_size_category<Rows,MaxRows>::value,
+    cols_select = product_size_category<Cols,MaxCols>::value,
+    depth_select = product_size_category<Depth,MaxDepth>::value
+  };
+  typedef product_type_selector<rows_select, cols_select, depth_select> selector;
+
+public:
+  enum {
+    value = selector::ret
+  };
+#ifdef EIGEN_DEBUG_PRODUCT
+  static void debug()
+  {
+      EIGEN_DEBUG_VAR(Rows);
+      EIGEN_DEBUG_VAR(Cols);
+      EIGEN_DEBUG_VAR(Depth);
+      EIGEN_DEBUG_VAR(rows_select);
+      EIGEN_DEBUG_VAR(cols_select);
+      EIGEN_DEBUG_VAR(depth_select);
+      EIGEN_DEBUG_VAR(value);
+  }
+#endif
+};
+
+
+/* The following allows to select the kind of product at compile time
+ * based on the three dimensions of the product.
+ * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
+// FIXME I'm not sure the current mapping is the ideal one.
+template<int M, int N>  struct product_type_selector<M,N,1>              { enum { ret = OuterProduct }; };
+template<int Depth>     struct product_type_selector<1,    1,    Depth>  { enum { ret = InnerProduct }; };
+template<>              struct product_type_selector<1,    1,    1>      { enum { ret = InnerProduct }; };
+template<>              struct product_type_selector<Small,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<1,    Small,Small>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<Small,Small,Small>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<Small, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
+template<>              struct product_type_selector<Small, Large, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
+template<>              struct product_type_selector<Large, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
+template<>              struct product_type_selector<1,    Large,Small>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<1,    Large,Large>  { enum { ret = GemvProduct }; };
+template<>              struct product_type_selector<1,    Small,Large>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<Large,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<Large,1,    Large>  { enum { ret = GemvProduct }; };
+template<>              struct product_type_selector<Small,1,    Large>  { enum { ret = CoeffBasedProductMode }; };
+template<>              struct product_type_selector<Small,Small,Large>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Large,Small,Large>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Small,Large,Large>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Large,Large,Large>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Large,Small,Small>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Small,Large,Small>  { enum { ret = GemmProduct }; };
+template<>              struct product_type_selector<Large,Large,Small>  { enum { ret = GemmProduct }; };
+
+} // end namespace internal
+
+/** \class ProductReturnType
+  * \ingroup Core_Module
+  *
+  * \brief Helper class to get the correct and optimized returned type of operator*
+  *
+  * \param Lhs the type of the left-hand side
+  * \param Rhs the type of the right-hand side
+  * \param ProductMode the type of the product (determined automatically by internal::product_mode)
+  *
+  * This class defines the typename Type representing the optimized product expression
+  * between two matrix expressions. In practice, using ProductReturnType<Lhs,Rhs>::Type
+  * is the recommended way to define the result type of a function returning an expression
+  * which involve a matrix product. The class Product should never be
+  * used directly.
+  *
+  * \sa class Product, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
+  */
+template<typename Lhs, typename Rhs, int ProductType>
+struct ProductReturnType
+{
+  // TODO use the nested type to reduce instanciations ????
+//   typedef typename internal::nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
+//   typedef typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
+
+  typedef GeneralProduct<Lhs/*Nested*/, Rhs/*Nested*/, ProductType> Type;
+};
+
+template<typename Lhs, typename Rhs>
+struct ProductReturnType<Lhs,Rhs,CoeffBasedProductMode>
+{
+  typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
+  typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
+  typedef CoeffBasedProduct<LhsNested, RhsNested, EvalBeforeAssigningBit | EvalBeforeNestingBit> Type;
+};
+
+template<typename Lhs, typename Rhs>
+struct ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
+{
+  typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
+  typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
+  typedef CoeffBasedProduct<LhsNested, RhsNested, NestByRefBit> Type;
+};
+
+// this is a workaround for sun CC
+template<typename Lhs, typename Rhs>
+struct LazyProductReturnType : public ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
+{};
+
+/***********************************************************************
+*  Implementation of Inner Vector Vector Product
+***********************************************************************/
+
+// FIXME : maybe the "inner product" could return a Scalar
+// instead of a 1x1 matrix ??
+// Pro: more natural for the user
+// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix
+// product ends up to a row-vector times col-vector product... To tackle this use
+// case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
+
+namespace internal {
+
+template<typename Lhs, typename Rhs>
+struct traits<GeneralProduct<Lhs,Rhs,InnerProduct> >
+ : traits<Matrix<typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> >
+{};
+
+}
+
+template<typename Lhs, typename Rhs>
+class GeneralProduct<Lhs, Rhs, InnerProduct>
+  : internal::no_assignment_operator,
+    public Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1>
+{
+    typedef Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base;
+  public:
+    GeneralProduct(const Lhs& lhs, const Rhs& rhs)
+    {
+      EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
+        YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+
+      Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
+    }
+
+    /** Convertion to scalar */
+    operator const typename Base::Scalar() const {
+      return Base::coeff(0,0);
+    }
+};
+
+/***********************************************************************
+*  Implementation of Outer Vector Vector Product
+***********************************************************************/
+
+namespace internal {
+template<int StorageOrder> struct outer_product_selector;
+
+template<typename Lhs, typename Rhs>
+struct traits<GeneralProduct<Lhs,Rhs,OuterProduct> >
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs> >
+{};
+
+}
+
+template<typename Lhs, typename Rhs>
+class GeneralProduct<Lhs, Rhs, OuterProduct>
+  : public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
+
+    GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {
+      EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
+        YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+    }
+
+    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
+    {
+      internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
+    }
+};
+
+namespace internal {
+
+template<> struct outer_product_selector<ColMajor> {
+  template<typename ProductType, typename Dest>
+  static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
+    typedef typename Dest::Index Index;
+    // FIXME make sure lhs is sequentially stored
+    // FIXME not very good if rhs is real and lhs complex while alpha is real too
+    const Index cols = dest.cols();
+    for (Index j=0; j<cols; ++j)
+      dest.col(j) += (alpha * prod.rhs().coeff(j)) * prod.lhs();
+  }
+};
+
+template<> struct outer_product_selector<RowMajor> {
+  template<typename ProductType, typename Dest>
+  static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
+    typedef typename Dest::Index Index;
+    // FIXME make sure rhs is sequentially stored
+    // FIXME not very good if lhs is real and rhs complex while alpha is real too
+    const Index rows = dest.rows();
+    for (Index i=0; i<rows; ++i)
+      dest.row(i) += (alpha * prod.lhs().coeff(i)) * prod.rhs();
+  }
+};
+
+} // end namespace internal
+
+/***********************************************************************
+*  Implementation of General Matrix Vector Product
+***********************************************************************/
+
+/*  According to the shape/flags of the matrix we have to distinghish 3 different cases:
+ *   1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine
+ *   2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine
+ *   3 - all other cases are handled using a simple loop along the outer-storage direction.
+ *  Therefore we need a lower level meta selector.
+ *  Furthermore, if the matrix is the rhs, then the product has to be transposed.
+ */
+namespace internal {
+
+template<typename Lhs, typename Rhs>
+struct traits<GeneralProduct<Lhs,Rhs,GemvProduct> >
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs> >
+{};
+
+template<int Side, int StorageOrder, bool BlasCompatible>
+struct gemv_selector;
+
+} // end namespace internal
+
+template<typename Lhs, typename Rhs>
+class GeneralProduct<Lhs, Rhs, GemvProduct>
+  : public ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
+
+    typedef typename Lhs::Scalar LhsScalar;
+    typedef typename Rhs::Scalar RhsScalar;
+
+    GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {
+//       EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value),
+//         YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+    }
+
+    enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
+    typedef typename internal::conditional<int(Side)==OnTheRight,_LhsNested,_RhsNested>::type MatrixType;
+
+    template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
+    {
+      eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols());
+      internal::gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
+                       bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha);
+    }
+};
+
+namespace internal {
+
+// The vector is on the left => transposition
+template<int StorageOrder, bool BlasCompatible>
+struct gemv_selector<OnTheLeft,StorageOrder,BlasCompatible>
+{
+  template<typename ProductType, typename Dest>
+  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
+  {
+    Transpose<Dest> destT(dest);
+    enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor };
+    gemv_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
+      ::run(GeneralProduct<Transpose<const typename ProductType::_RhsNested>,Transpose<const typename ProductType::_LhsNested>, GemvProduct>
+        (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha);
+  }
+};
+
+template<typename Scalar,int Size,int MaxSize,bool Cond> struct gemv_static_vector_if;
+
+template<typename Scalar,int Size,int MaxSize>
+struct gemv_static_vector_if<Scalar,Size,MaxSize,false>
+{
+  EIGEN_STRONG_INLINE  Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; }
+};
+
+template<typename Scalar,int Size>
+struct gemv_static_vector_if<Scalar,Size,Dynamic,true>
+{
+  EIGEN_STRONG_INLINE Scalar* data() { return 0; }
+};
+
+template<typename Scalar,int Size,int MaxSize>
+struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
+{
+  #if EIGEN_ALIGN_STATICALLY
+  internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;
+  EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
+  #else
+  // Some architectures cannot align on the stack,
+  // => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
+  enum {
+    ForceAlignment  = internal::packet_traits<Scalar>::Vectorizable,
+    PacketSize      = internal::packet_traits<Scalar>::size
+  };
+  internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;
+  EIGEN_STRONG_INLINE Scalar* data() {
+    return ForceAlignment
+            ? reinterpret_cast<Scalar*>((reinterpret_cast<size_t>(m_data.array) & ~(size_t(15))) + 16)
+            : m_data.array;
+  }
+  #endif
+};
+
+template<> struct gemv_selector<OnTheRight,ColMajor,true>
+{
+  template<typename ProductType, typename Dest>
+  static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
+  {
+    typedef typename ProductType::Index Index;
+    typedef typename ProductType::LhsScalar   LhsScalar;
+    typedef typename ProductType::RhsScalar   RhsScalar;
+    typedef typename ProductType::Scalar      ResScalar;
+    typedef typename ProductType::RealScalar  RealScalar;
+    typedef typename ProductType::ActualLhsType ActualLhsType;
+    typedef typename ProductType::ActualRhsType ActualRhsType;
+    typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
+    typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
+    typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
+
+    ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs());
+    ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs());
+
+    ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
+                                  * RhsBlasTraits::extractScalarFactor(prod.rhs());
+
+    enum {
+      // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
+      // on, the other hand it is good for the cache to pack the vector anyways...
+      EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
+      ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
+      MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal
+    };
+
+    gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
+
+    bool alphaIsCompatible = (!ComplexByReal) || (imag(actualAlpha)==RealScalar(0));
+    bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
+    
+    RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
+
+    ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
+                                                  evalToDest ? dest.data() : static_dest.data());
+    
+    if(!evalToDest)
+    {
+      #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
+      int size = dest.size();
+      EIGEN_DENSE_STORAGE_CTOR_PLUGIN
+      #endif
+      if(!alphaIsCompatible)
+      {
+        MappedDest(actualDestPtr, dest.size()).setZero();
+        compatibleAlpha = RhsScalar(1);
+      }
+      else
+        MappedDest(actualDestPtr, dest.size()) = dest;
+    }
+
+    general_matrix_vector_product
+      <Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
+        actualLhs.rows(), actualLhs.cols(),
+        actualLhs.data(), actualLhs.outerStride(),
+        actualRhs.data(), actualRhs.innerStride(),
+        actualDestPtr, 1,
+        compatibleAlpha);
+
+    if (!evalToDest)
+    {
+      if(!alphaIsCompatible)
+        dest += actualAlpha * MappedDest(actualDestPtr, dest.size());
+      else
+        dest = MappedDest(actualDestPtr, dest.size());
+    }
+  }
+};
+
+template<> struct gemv_selector<OnTheRight,RowMajor,true>
+{
+  template<typename ProductType, typename Dest>
+  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
+  {
+    typedef typename ProductType::LhsScalar LhsScalar;
+    typedef typename ProductType::RhsScalar RhsScalar;
+    typedef typename ProductType::Scalar    ResScalar;
+    typedef typename ProductType::Index Index;
+    typedef typename ProductType::ActualLhsType ActualLhsType;
+    typedef typename ProductType::ActualRhsType ActualRhsType;
+    typedef typename ProductType::_ActualRhsType _ActualRhsType;
+    typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
+    typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
+
+    typename add_const<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
+    typename add_const<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
+
+    ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
+                                  * RhsBlasTraits::extractScalarFactor(prod.rhs());
+
+    enum {
+      // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
+      // on, the other hand it is good for the cache to pack the vector anyways...
+      DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1
+    };
+
+    gemv_static_vector_if<RhsScalar,_ActualRhsType::SizeAtCompileTime,_ActualRhsType::MaxSizeAtCompileTime,!DirectlyUseRhs> static_rhs;
+
+    ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(),
+        DirectlyUseRhs ? const_cast<RhsScalar*>(actualRhs.data()) : static_rhs.data());
+
+    if(!DirectlyUseRhs)
+    {
+      #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
+      int size = actualRhs.size();
+      EIGEN_DENSE_STORAGE_CTOR_PLUGIN
+      #endif
+      Map<typename _ActualRhsType::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
+    }
+
+    general_matrix_vector_product
+      <Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
+        actualLhs.rows(), actualLhs.cols(),
+        actualLhs.data(), actualLhs.outerStride(),
+        actualRhsPtr, 1,
+        dest.data(), dest.innerStride(),
+        actualAlpha);
+  }
+};
+
+template<> struct gemv_selector<OnTheRight,ColMajor,false>
+{
+  template<typename ProductType, typename Dest>
+  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
+  {
+    typedef typename Dest::Index Index;
+    // TODO makes sure dest is sequentially stored in memory, otherwise use a temp
+    const Index size = prod.rhs().rows();
+    for(Index k=0; k<size; ++k)
+      dest += (alpha*prod.rhs().coeff(k)) * prod.lhs().col(k);
+  }
+};
+
+template<> struct gemv_selector<OnTheRight,RowMajor,false>
+{
+  template<typename ProductType, typename Dest>
+  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
+  {
+    typedef typename Dest::Index Index;
+    // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp
+    const Index rows = prod.rows();
+    for(Index i=0; i<rows; ++i)
+      dest.coeffRef(i) += alpha * (prod.lhs().row(i).cwiseProduct(prod.rhs().transpose())).sum();
+  }
+};
+
+} // end namespace internal
+
+/***************************************************************************
+* Implementation of matrix base methods
+***************************************************************************/
+
+/** \returns the matrix product of \c *this and \a other.
+  *
+  * \note If instead of the matrix product you want the coefficient-wise product, see Cwise::operator*().
+  *
+  * \sa lazyProduct(), operator*=(const MatrixBase&), Cwise::operator*()
+  */
+template<typename Derived>
+template<typename OtherDerived>
+inline const typename ProductReturnType<Derived, OtherDerived>::Type
+MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
+{
+  // A note regarding the function declaration: In MSVC, this function will sometimes
+  // not be inlined since DenseStorage is an unwindable object for dynamic
+  // matrices and product types are holding a member to store the result.
+  // Thus it does not help tagging this function with EIGEN_STRONG_INLINE.
+  enum {
+    ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
+                   || OtherDerived::RowsAtCompileTime==Dynamic
+                   || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
+    AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
+    SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
+  };
+  // note to the lost user:
+  //    * for a dot product use: v1.dot(v2)
+  //    * for a coeff-wise product use: v1.cwiseProduct(v2)
+  EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
+    INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
+  EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
+    INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
+  EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
+#ifdef EIGEN_DEBUG_PRODUCT
+  internal::product_type<Derived,OtherDerived>::debug();
+#endif
+  return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
+}
+
+/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation.
+  *
+  * The returned product will behave like any other expressions: the coefficients of the product will be
+  * computed once at a time as requested. This might be useful in some extremely rare cases when only
+  * a small and no coherent fraction of the result's coefficients have to be computed.
+  *
+  * \warning This version of the matrix product can be much much slower. So use it only if you know
+  * what you are doing and that you measured a true speed improvement.
+  *
+  * \sa operator*(const MatrixBase&)
+  */
+template<typename Derived>
+template<typename OtherDerived>
+const typename LazyProductReturnType<Derived,OtherDerived>::Type
+MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
+{
+  enum {
+    ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
+                   || OtherDerived::RowsAtCompileTime==Dynamic
+                   || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
+    AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
+    SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
+  };
+  // note to the lost user:
+  //    * for a dot product use: v1.dot(v2)
+  //    * for a coeff-wise product use: v1.cwiseProduct(v2)
+  EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
+    INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
+  EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
+    INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
+  EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
+
+  return typename LazyProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Core/GenericPacketMath.h b/extern/Eigen3/Eigen/src/Core/GenericPacketMath.h
index 8ed8353..858fb24 100644
--- a/extern/Eigen3/Eigen/src/Core/GenericPacketMath.h
+++ b/extern/Eigen3/Eigen/src/Core/GenericPacketMath.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERIC_PACKET_MATH_H
 #define EIGEN_GENERIC_PACKET_MATH_H
 
+namespace Eigen {
+
 namespace internal {
 
 /** \internal
@@ -312,7 +299,7 @@ template<int Offset,typename PacketType>
 struct palign_impl
 {
   // by default data are aligned, so there is nothing to be done :)
-  inline static void run(PacketType&, const PacketType&) {}
+  static inline void run(PacketType&, const PacketType&) {}
 };
 
 /** \internal update \a first using the concatenation of the \a Offset last elements
@@ -335,5 +322,7 @@ template<> inline std::complex<double> pmul(const std::complex<double>& a, const
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERIC_PACKET_MATH_H
 
diff --git a/extern/Eigen3/Eigen/src/Core/GlobalFunctions.h b/extern/Eigen3/Eigen/src/Core/GlobalFunctions.h
index 144145a..e63726c 100644
--- a/extern/Eigen3/Eigen/src/Core/GlobalFunctions.h
+++ b/extern/Eigen3/Eigen/src/Core/GlobalFunctions.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GLOBAL_FUNCTIONS_H
 #define EIGEN_GLOBAL_FUNCTIONS_H
@@ -66,13 +51,36 @@ namespace std
 
   template<typename Derived>
   inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>
-  pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) { \
-    return x.derived().pow(exponent); \
+  pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) {
+    return x.derived().pow(exponent);
+  }
+
+  template<typename Derived>
+  inline const Eigen::CwiseBinaryOp<Eigen::internal::scalar_binary_pow_op<typename Derived::Scalar, typename Derived::Scalar>, const Derived, const Derived>
+  pow(const Eigen::ArrayBase<Derived>& x, const Eigen::ArrayBase<Derived>& exponents) 
+  {
+    return Eigen::CwiseBinaryOp<Eigen::internal::scalar_binary_pow_op<typename Derived::Scalar, typename Derived::Scalar>, const Derived, const Derived>(
+      x.derived(),
+      exponents.derived()
+    );
   }
 }
 
 namespace Eigen
 {
+  /**
+  * \brief Component-wise division of a scalar by array elements.
+  **/
+  template <typename Derived>
+  inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>
+    operator/(typename Derived::Scalar s, const Eigen::ArrayBase<Derived>& a)
+  {
+    return Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>(
+      a.derived(),
+      Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>(s)  
+    );
+  }
+
   namespace internal
   {
     EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op)
diff --git a/extern/Eigen3/Eigen/src/Core/IO.h b/extern/Eigen3/Eigen/src/Core/IO.h
index f3cfcdb..cc8e18a 100644
--- a/extern/Eigen3/Eigen/src/Core/IO.h
+++ b/extern/Eigen3/Eigen/src/Core/IO.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_IO_H
 #define EIGEN_IO_H
 
+namespace Eigen { 
+
 enum { DontAlignCols = 1 };
 enum { StreamPrecision = -1,
        FullPrecision = -2 };
@@ -171,7 +158,7 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
     return s;
   }
   
-  const typename Derived::Nested m = _m;
+  typename Derived::Nested m = _m;
   typedef typename Derived::Scalar Scalar;
   typedef typename Derived::Index Index;
 
@@ -257,4 +244,6 @@ std::ostream & operator <<
   return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_IO_H
diff --git a/extern/Eigen3/Eigen/src/Core/Map.h b/extern/Eigen3/Eigen/src/Core/Map.h
index 2bf80b3..15a1922 100644
--- a/extern/Eigen3/Eigen/src/Core/Map.h
+++ b/extern/Eigen3/Eigen/src/Core/Map.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MAP_H
 #define EIGEN_MAP_H
 
+namespace Eigen { 
+
 /** \class Map
   * \ingroup Core_Module
   *
@@ -200,4 +187,6 @@ inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
   this->_set_noalias(Eigen::Map<const Matrix>(data));
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MAP_H
diff --git a/extern/Eigen3/Eigen/src/Core/MapBase.h b/extern/Eigen3/Eigen/src/Core/MapBase.h
index 9426e2d..a388d61 100644
--- a/extern/Eigen3/Eigen/src/Core/MapBase.h
+++ b/extern/Eigen3/Eigen/src/Core/MapBase.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MAPBASE_H
 #define EIGEN_MAPBASE_H
@@ -30,6 +15,7 @@
       EIGEN_STATIC_ASSERT((int(internal::traits<Derived>::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \
                           YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT)
 
+namespace Eigen { 
 
 /** \class MapBase
   * \ingroup Core_Module
@@ -251,5 +237,6 @@ template<typename Derived> class MapBase<Derived, WriteAccessors>
     using Base::Base::operator=;
 };
 
+} // end namespace Eigen
 
 #endif // EIGEN_MAPBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/MathFunctions.h b/extern/Eigen3/Eigen/src/Core/MathFunctions.h
index 2b454db..05e913f 100644
--- a/extern/Eigen3/Eigen/src/Core/MathFunctions.h
+++ b/extern/Eigen3/Eigen/src/Core/MathFunctions.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MATHFUNCTIONS_H
 #define EIGEN_MATHFUNCTIONS_H
 
+namespace Eigen {
+
 namespace internal {
 
 /** \internal \struct global_math_functions_filtering_base
@@ -309,8 +296,7 @@ struct abs2_impl<std::complex<RealScalar> >
 {
   static inline RealScalar run(const std::complex<RealScalar>& x)
   {
-    using std::norm;
-    return norm(x);
+    return real(x)*real(x) + imag(x)*imag(x);
   }
 };
 
@@ -553,7 +539,7 @@ struct pow_default_impl<Scalar, true>
 {
   static inline Scalar run(Scalar x, Scalar y)
   {
-    Scalar res = 1;
+    Scalar res(1);
     eigen_assert(!NumTraits<Scalar>::IsSigned || y >= 0);
     if(y & 1) res *= x;
     y >>= 1;
@@ -838,6 +824,19 @@ template<> struct scalar_fuzzy_impl<bool>
   
 };
 
+/****************************************************************************
+* Special functions                                                          *
+****************************************************************************/
+
+// std::isfinite is non standard, so let's define our own version,
+// even though it is not very efficient.
+template<typename T> bool (isfinite)(const T& x)
+{
+  return x<NumTraits<T>::highest() && x>NumTraits<T>::lowest();
+}
+
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATHFUNCTIONS_H
diff --git a/extern/Eigen3/Eigen/src/Core/Matrix.h b/extern/Eigen3/Eigen/src/Core/Matrix.h
index 982c925..99160b5 100644
--- a/extern/Eigen3/Eigen/src/Core/Matrix.h
+++ b/extern/Eigen3/Eigen/src/Core/Matrix.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MATRIX_H
 #define EIGEN_MATRIX_H
 
+namespace Eigen {
+
 /** \class Matrix
   * \ingroup Core_Module
   *
@@ -411,25 +398,8 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
 
 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
 #undef EIGEN_MAKE_TYPEDEFS
+#undef EIGEN_MAKE_FIXED_TYPEDEFS
 
-#undef EIGEN_MAKE_TYPEDEFS_LARGE
-
-#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
-using Eigen::Matrix##SizeSuffix##TypeSuffix; \
-using Eigen::Vector##SizeSuffix##TypeSuffix; \
-using Eigen::RowVector##SizeSuffix##TypeSuffix;
-
-#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \
-
-#define EIGEN_USING_MATRIX_TYPEDEFS \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \
-EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd)
+} // end namespace Eigen
 
 #endif // EIGEN_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/MatrixBase.h b/extern/Eigen3/Eigen/src/Core/MatrixBase.h
index 62877bc..c1e0ed1 100644
--- a/extern/Eigen3/Eigen/src/Core/MatrixBase.h
+++ b/extern/Eigen3/Eigen/src/Core/MatrixBase.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MATRIXBASE_H
 #define EIGEN_MATRIXBASE_H
 
+namespace Eigen {
+
 /** \class MatrixBase
   * \ingroup Core_Module
   *
@@ -250,8 +237,7 @@ template<typename Derived> class MatrixBase
     
     // huuuge hack. make Eigen2's matrix.part<Diagonal>() work in eigen3. Problem: Diagonal is now a class template instead
     // of an integer constant. Solution: overload the part() method template wrt template parameters list.
-    // Note: replacing next line by "template<template<typename T, int n> class U>" produces a mysterious error C2082 in MSVC.
-    template<template<typename, int> class U>
+    template<template<typename T, int n> class U>
     const DiagonalWrapper<ConstDiagonalReturnType> part() const
     { return diagonal().asDiagonal(); }
     #endif // EIGEN2_SUPPORT
@@ -331,7 +317,7 @@ template<typename Derived> class MatrixBase
     /** \returns an \link ArrayBase Array \endlink expression of this matrix
       * \sa ArrayBase::matrix() */
     ArrayWrapper<Derived> array() { return derived(); }
-    const ArrayWrapper<Derived> array() const { return derived(); }
+    const ArrayWrapper<const Derived> array() const { return derived(); }
 
 /////////// LU module ///////////
 
@@ -466,6 +452,8 @@ template<typename Derived> class MatrixBase
     const MatrixFunctionReturnValue<Derived> sinh() const;
     const MatrixFunctionReturnValue<Derived> cos() const;
     const MatrixFunctionReturnValue<Derived> sin() const;
+    const MatrixSquareRootReturnValue<Derived> sqrt() const;
+    const MatrixLogarithmReturnValue<Derived> log() const;
 
 #ifdef EIGEN2_SUPPORT
     template<typename ProductDerived, typename Lhs, typename Rhs>
@@ -512,10 +500,12 @@ template<typename Derived> class MatrixBase
   protected:
     // mixing arrays and matrices is not legal
     template<typename OtherDerived> Derived& operator+=(const ArrayBase<OtherDerived>& )
-    {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
+    {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
     // mixing arrays and matrices is not legal
     template<typename OtherDerived> Derived& operator-=(const ArrayBase<OtherDerived>& )
-    {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
+    {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIXBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/NestByValue.h b/extern/Eigen3/Eigen/src/Core/NestByValue.h
index a6104d2..a893b17 100644
--- a/extern/Eigen3/Eigen/src/Core/NestByValue.h
+++ b/extern/Eigen3/Eigen/src/Core/NestByValue.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_NESTBYVALUE_H
 #define EIGEN_NESTBYVALUE_H
 
+namespace Eigen {
+
 /** \class NestByValue
   * \ingroup Core_Module
   *
@@ -119,4 +106,6 @@ DenseBase<Derived>::nestByValue() const
   return NestByValue<Derived>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_NESTBYVALUE_H
diff --git a/extern/Eigen3/Eigen/src/Core/NoAlias.h b/extern/Eigen3/Eigen/src/Core/NoAlias.h
index da64aff..ecb3fa2 100644
--- a/extern/Eigen3/Eigen/src/Core/NoAlias.h
+++ b/extern/Eigen3/Eigen/src/Core/NoAlias.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_NOALIAS_H
 #define EIGEN_NOALIAS_H
 
+namespace Eigen {
+
 /** \class NoAlias
   * \ingroup Core_Module
   *
@@ -133,4 +120,6 @@ NoAlias<Derived,MatrixBase> MatrixBase<Derived>::noalias()
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_NOALIAS_H
diff --git a/extern/Eigen3/Eigen/src/Core/NumTraits.h b/extern/Eigen3/Eigen/src/Core/NumTraits.h
index 73ef05d..c94ef02 100644
--- a/extern/Eigen3/Eigen/src/Core/NumTraits.h
+++ b/extern/Eigen3/Eigen/src/Core/NumTraits.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_NUMTRAITS_H
 #define EIGEN_NUMTRAITS_H
 
+namespace Eigen {
+
 /** \class NumTraits
   * \ingroup Core_Module
   *
@@ -81,14 +68,14 @@ template<typename T> struct GenericNumTraits
                    >::type NonInteger;
   typedef T Nested;
 
-  inline static Real epsilon() { return std::numeric_limits<T>::epsilon(); }
-  inline static Real dummy_precision()
+  static inline Real epsilon() { return std::numeric_limits<T>::epsilon(); }
+  static inline Real dummy_precision()
   {
     // make sure to override this for floating-point types
     return Real(0);
   }
-  inline static T highest() { return (std::numeric_limits<T>::max)(); }
-  inline static T lowest()  { return IsInteger ? (std::numeric_limits<T>::min)() : (-(std::numeric_limits<T>::max)()); }
+  static inline T highest() { return (std::numeric_limits<T>::max)(); }
+  static inline T lowest()  { return IsInteger ? (std::numeric_limits<T>::min)() : (-(std::numeric_limits<T>::max)()); }
   
 #ifdef EIGEN2_SUPPORT
   enum {
@@ -104,12 +91,12 @@ template<typename T> struct NumTraits : GenericNumTraits<T>
 template<> struct NumTraits<float>
   : GenericNumTraits<float>
 {
-  inline static float dummy_precision() { return 1e-5f; }
+  static inline float dummy_precision() { return 1e-5f; }
 };
 
 template<> struct NumTraits<double> : GenericNumTraits<double>
 {
-  inline static double dummy_precision() { return 1e-12; }
+  static inline double dummy_precision() { return 1e-12; }
 };
 
 template<> struct NumTraits<long double>
@@ -130,8 +117,8 @@ template<typename _Real> struct NumTraits<std::complex<_Real> >
     MulCost = 4 * NumTraits<Real>::MulCost + 2 * NumTraits<Real>::AddCost
   };
 
-  inline static Real epsilon() { return NumTraits<Real>::epsilon(); }
-  inline static Real dummy_precision() { return NumTraits<Real>::dummy_precision(); }
+  static inline Real epsilon() { return NumTraits<Real>::epsilon(); }
+  static inline Real dummy_precision() { return NumTraits<Real>::dummy_precision(); }
 };
 
 template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
@@ -155,6 +142,6 @@ struct NumTraits<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
   };
 };
 
-
+} // end namespace Eigen
 
 #endif // EIGEN_NUMTRAITS_H
diff --git a/extern/Eigen3/Eigen/src/Core/PermutationMatrix.h b/extern/Eigen3/Eigen/src/Core/PermutationMatrix.h
index a064e05..bc29f81 100644
--- a/extern/Eigen3/Eigen/src/Core/PermutationMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/PermutationMatrix.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PERMUTATIONMATRIX_H
 #define EIGEN_PERMUTATIONMATRIX_H
 
+namespace Eigen { 
+
 template<int RowCol,typename IndicesType,typename MatrixType, typename StorageKind> class PermutedImpl;
 
 /** \class PermutationBase
@@ -56,6 +43,8 @@ namespace internal {
 
 template<typename PermutationType, typename MatrixType, int Side, bool Transposed=false>
 struct permut_matrix_product_retval;
+template<typename PermutationType, typename MatrixType, int Side, bool Transposed=false>
+struct permut_sparsematrix_product_retval;
 enum PermPermProduct_t {PermPermProduct};
 
 } // end namespace internal
@@ -511,7 +500,7 @@ class PermutationWrapper : public PermutationBase<PermutationWrapper<_IndicesTyp
 
   protected:
 
-    const typename IndicesType::Nested m_indices;
+    typename IndicesType::Nested m_indices;
 };
 
 /** \returns the matrix with the permutation applied to the columns.
@@ -608,7 +597,7 @@ struct permut_matrix_product_retval
 
   protected:
     const PermutationType& m_permutation;
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 /* Template partial specialization for transposed/inverse permutations */
@@ -693,4 +682,6 @@ const PermutationWrapper<const Derived> MatrixBase<Derived>::asPermutation() con
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_PERMUTATIONMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/PlainObjectBase.h b/extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
index 612254e..71c7430 100644
--- a/extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
+++ b/extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DENSESTORAGEBASE_H
 #define EIGEN_DENSESTORAGEBASE_H
@@ -32,6 +17,8 @@
 # define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
 #endif
 
+namespace Eigen {
+
 namespace internal {
 
 template<typename Index>
@@ -47,13 +34,13 @@ EIGEN_ALWAYS_INLINE void check_rows_cols_for_overflow(Index rows, Index cols)
     throw_std_bad_alloc();
 }
 
-template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct conservative_resize_like_impl;
+template <typename Derived, typename OtherDerived = Derived, bool IsVector = bool(Derived::IsVectorAtCompileTime)> struct conservative_resize_like_impl;
 
 template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct matrix_swap_impl;
 
 } // end namespace internal
 
-/**
+/** \class PlainObjectBase
   * \brief %Dense storage base class for matrices and arrays.
   *
   * This class can be extended with the help of the plugin mechanism described on the page
@@ -61,8 +48,29 @@ template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct m
   *
   * \sa \ref TopicClassHierarchy
   */
+#ifdef EIGEN_PARSED_BY_DOXYGEN
+namespace internal {
+
+// this is a warkaround to doxygen not being able to understand the inheritence logic
+// when it is hidden by the dense_xpr_base helper struct.
+template<typename Derived> struct dense_xpr_base_dispatcher_for_doxygen;// : public MatrixBase<Derived> {};
+/** This class is just a workaround for Doxygen and it does not not actually exist. */
+template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
+struct dense_xpr_base_dispatcher_for_doxygen<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+    : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > {};
+/** This class is just a workaround for Doxygen and it does not not actually exist. */
+template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
+struct dense_xpr_base_dispatcher_for_doxygen<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+    : public ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > {};
+
+} // namespace internal
+
+template<typename Derived>
+class PlainObjectBase : public internal::dense_xpr_base_dispatcher_for_doxygen<Derived>
+#else
 template<typename Derived>
 class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
+#endif
 {
   public:
     enum { Options = internal::traits<Derived>::Options };
@@ -443,68 +451,68 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
       * \see class Map
       */
     //@{
-    inline static ConstMapType Map(const Scalar* data)
+    static inline ConstMapType Map(const Scalar* data)
     { return ConstMapType(data); }
-    inline static MapType Map(Scalar* data)
+    static inline MapType Map(Scalar* data)
     { return MapType(data); }
-    inline static ConstMapType Map(const Scalar* data, Index size)
+    static inline ConstMapType Map(const Scalar* data, Index size)
     { return ConstMapType(data, size); }
-    inline static MapType Map(Scalar* data, Index size)
+    static inline MapType Map(Scalar* data, Index size)
     { return MapType(data, size); }
-    inline static ConstMapType Map(const Scalar* data, Index rows, Index cols)
+    static inline ConstMapType Map(const Scalar* data, Index rows, Index cols)
     { return ConstMapType(data, rows, cols); }
-    inline static MapType Map(Scalar* data, Index rows, Index cols)
+    static inline MapType Map(Scalar* data, Index rows, Index cols)
     { return MapType(data, rows, cols); }
 
-    inline static ConstAlignedMapType MapAligned(const Scalar* data)
+    static inline ConstAlignedMapType MapAligned(const Scalar* data)
     { return ConstAlignedMapType(data); }
-    inline static AlignedMapType MapAligned(Scalar* data)
+    static inline AlignedMapType MapAligned(Scalar* data)
     { return AlignedMapType(data); }
-    inline static ConstAlignedMapType MapAligned(const Scalar* data, Index size)
+    static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size)
     { return ConstAlignedMapType(data, size); }
-    inline static AlignedMapType MapAligned(Scalar* data, Index size)
+    static inline AlignedMapType MapAligned(Scalar* data, Index size)
     { return AlignedMapType(data, size); }
-    inline static ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols)
+    static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols)
     { return ConstAlignedMapType(data, rows, cols); }
-    inline static AlignedMapType MapAligned(Scalar* data, Index rows, Index cols)
+    static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols)
     { return AlignedMapType(data, rows, cols); }
 
     template<int Outer, int Inner>
-    inline static typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, const Stride<Outer, Inner>& stride)
     { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, const Stride<Outer, Inner>& stride)
+    static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, const Stride<Outer, Inner>& stride)
     { return typename StridedMapType<Stride<Outer, Inner> >::type(data, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
     { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, size, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
+    static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
     { return typename StridedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
     { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
+    static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
     { return typename StridedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
 
     template<int Outer, int Inner>
-    inline static typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, const Stride<Outer, Inner>& stride)
     { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, const Stride<Outer, Inner>& stride)
+    static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, const Stride<Outer, Inner>& stride)
     { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
     { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
+    static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
     { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
+    static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
     { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
     template<int Outer, int Inner>
-    inline static typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
+    static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
     { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
     //@}
 
@@ -594,6 +602,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
     template<typename T0, typename T1>
     EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
     {
+      EIGEN_STATIC_ASSERT(bool(NumTraits<T0>::IsInteger) &&
+                          bool(NumTraits<T1>::IsInteger),
+                          FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
       eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
              && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
       internal::check_rows_cols_for_overflow(rows, cols);      
@@ -623,7 +634,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
 
   public:
 #ifndef EIGEN_PARSED_BY_DOXYGEN
-    EIGEN_STRONG_INLINE static void _check_template_params()
+    static EIGEN_STRONG_INLINE void _check_template_params()
     {
       EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
                         && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
@@ -751,4 +762,6 @@ struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_DENSESTORAGEBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Product.h b/extern/Eigen3/Eigen/src/Core/Product.h
index e2035b2..30aa894 100644
--- a/extern/Eigen3/Eigen/src/Core/Product.h
+++ b/extern/Eigen3/Eigen/src/Core/Product.h
@@ -1,625 +1,98 @@
 // This file is part of Eigen, a lightweight C++ template library
 // for linear algebra.
 //
-// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PRODUCT_H
 #define EIGEN_PRODUCT_H
 
-/** \class GeneralProduct
+template<typename Lhs, typename Rhs> class Product;
+template<typename Lhs, typename Rhs, typename StorageKind> class ProductImpl;
+
+/** \class Product
   * \ingroup Core_Module
   *
-  * \brief Expression of the product of two general matrices or vectors
+  * \brief Expression of the product of two arbitrary matrices or vectors
   *
-  * \param LhsNested the type used to store the left-hand side
-  * \param RhsNested the type used to store the right-hand side
-  * \param ProductMode the type of the product
+  * \param Lhs the type of the left-hand side expression
+  * \param Rhs the type of the right-hand side expression
   *
-  * This class represents an expression of the product of two general matrices.
-  * We call a general matrix, a dense matrix with full storage. For instance,
-  * This excludes triangular, selfadjoint, and sparse matrices.
-  * It is the return type of the operator* between general matrices. Its template
-  * arguments are determined automatically by ProductReturnType. Therefore,
-  * GeneralProduct should never be used direclty. To determine the result type of a
-  * function which involves a matrix product, use ProductReturnType::Type.
+  * This class represents an expression of the product of two arbitrary matrices.
   *
-  * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
   */
-template<typename Lhs, typename Rhs, int ProductType = internal::product_type<Lhs,Rhs>::value>
-class GeneralProduct;
-
-enum {
-  Large = 2,
-  Small = 3
-};
 
 namespace internal {
-
-template<int Rows, int Cols, int Depth> struct product_type_selector;
-
-template<int Size, int MaxSize> struct product_size_category
-{
-  enum { is_large = MaxSize == Dynamic ||
-                    Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD,
-         value = is_large  ? Large
-               : Size == 1 ? 1
-                           : Small
-  };
-};
-
-template<typename Lhs, typename Rhs> struct product_type
-{
-  typedef typename remove_all<Lhs>::type _Lhs;
-  typedef typename remove_all<Rhs>::type _Rhs;
-  enum {
-    MaxRows  = _Lhs::MaxRowsAtCompileTime,
-    Rows  = _Lhs::RowsAtCompileTime,
-    MaxCols  = _Rhs::MaxColsAtCompileTime,
-    Cols  = _Rhs::ColsAtCompileTime,
-    MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime,
-                                           _Rhs::MaxRowsAtCompileTime),
-    Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime,
-                                        _Rhs::RowsAtCompileTime),
-    LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
-  };
-
-  // the splitting into different lines of code here, introducing the _select enums and the typedef below,
-  // is to work around an internal compiler error with gcc 4.1 and 4.2.
-private:
-  enum {
-    rows_select = product_size_category<Rows,MaxRows>::value,
-    cols_select = product_size_category<Cols,MaxCols>::value,
-    depth_select = product_size_category<Depth,MaxDepth>::value
-  };
-  typedef product_type_selector<rows_select, cols_select, depth_select> selector;
-
-public:
+template<typename Lhs, typename Rhs>
+struct traits<Product<Lhs, Rhs> >
+{
+  typedef MatrixXpr XprKind;
+  typedef typename remove_all<Lhs>::type LhsCleaned;
+  typedef typename remove_all<Rhs>::type RhsCleaned;
+  typedef typename scalar_product_traits<typename traits<LhsCleaned>::Scalar, typename traits<RhsCleaned>::Scalar>::ReturnType Scalar;
+  typedef typename promote_storage_type<typename traits<LhsCleaned>::StorageKind,
+                                        typename traits<RhsCleaned>::StorageKind>::ret StorageKind;
+  typedef typename promote_index_type<typename traits<LhsCleaned>::Index,
+                                      typename traits<RhsCleaned>::Index>::type Index;
   enum {
-    value = selector::ret
+    RowsAtCompileTime = LhsCleaned::RowsAtCompileTime,
+    ColsAtCompileTime = RhsCleaned::ColsAtCompileTime,
+    MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime,
+    Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0), // TODO should be no storage order
+    CoeffReadCost = 0 // TODO CoeffReadCost should not be part of the expression traits
   };
-#ifdef EIGEN_DEBUG_PRODUCT
-  static void debug()
-  {
-      EIGEN_DEBUG_VAR(Rows);
-      EIGEN_DEBUG_VAR(Cols);
-      EIGEN_DEBUG_VAR(Depth);
-      EIGEN_DEBUG_VAR(rows_select);
-      EIGEN_DEBUG_VAR(cols_select);
-      EIGEN_DEBUG_VAR(depth_select);
-      EIGEN_DEBUG_VAR(value);
-  }
-#endif
 };
-
-
-/* The following allows to select the kind of product at compile time
- * based on the three dimensions of the product.
- * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
-// FIXME I'm not sure the current mapping is the ideal one.
-template<int M, int N>  struct product_type_selector<M,N,1>              { enum { ret = OuterProduct }; };
-template<int Depth>     struct product_type_selector<1,    1,    Depth>  { enum { ret = InnerProduct }; };
-template<>              struct product_type_selector<1,    1,    1>      { enum { ret = InnerProduct }; };
-template<>              struct product_type_selector<Small,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<1,    Small,Small>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<Small,Small,Small>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<Small, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
-template<>              struct product_type_selector<Small, Large, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
-template<>              struct product_type_selector<Large, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
-template<>              struct product_type_selector<1,    Large,Small>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<1,    Large,Large>  { enum { ret = GemvProduct }; };
-template<>              struct product_type_selector<1,    Small,Large>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<Large,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<Large,1,    Large>  { enum { ret = GemvProduct }; };
-template<>              struct product_type_selector<Small,1,    Large>  { enum { ret = CoeffBasedProductMode }; };
-template<>              struct product_type_selector<Small,Small,Large>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Large,Small,Large>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Small,Large,Large>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Large,Large,Large>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Large,Small,Small>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Small,Large,Small>  { enum { ret = GemmProduct }; };
-template<>              struct product_type_selector<Large,Large,Small>  { enum { ret = GemmProduct }; };
-
 } // end namespace internal
 
-/** \class ProductReturnType
-  * \ingroup Core_Module
-  *
-  * \brief Helper class to get the correct and optimized returned type of operator*
-  *
-  * \param Lhs the type of the left-hand side
-  * \param Rhs the type of the right-hand side
-  * \param ProductMode the type of the product (determined automatically by internal::product_mode)
-  *
-  * This class defines the typename Type representing the optimized product expression
-  * between two matrix expressions. In practice, using ProductReturnType<Lhs,Rhs>::Type
-  * is the recommended way to define the result type of a function returning an expression
-  * which involve a matrix product. The class Product should never be
-  * used directly.
-  *
-  * \sa class Product, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
-  */
-template<typename Lhs, typename Rhs, int ProductType>
-struct ProductReturnType
-{
-  // TODO use the nested type to reduce instanciations ????
-//   typedef typename internal::nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
-//   typedef typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
-
-  typedef GeneralProduct<Lhs/*Nested*/, Rhs/*Nested*/, ProductType> Type;
-};
-
-template<typename Lhs, typename Rhs>
-struct ProductReturnType<Lhs,Rhs,CoeffBasedProductMode>
-{
-  typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
-  typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
-  typedef CoeffBasedProduct<LhsNested, RhsNested, EvalBeforeAssigningBit | EvalBeforeNestingBit> Type;
-};
-
-template<typename Lhs, typename Rhs>
-struct ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
-{
-  typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
-  typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
-  typedef CoeffBasedProduct<LhsNested, RhsNested, NestByRefBit> Type;
-};
-
-// this is a workaround for sun CC
-template<typename Lhs, typename Rhs>
-struct LazyProductReturnType : public ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
-{};
-
-/***********************************************************************
-*  Implementation of Inner Vector Vector Product
-***********************************************************************/
-
-// FIXME : maybe the "inner product" could return a Scalar
-// instead of a 1x1 matrix ??
-// Pro: more natural for the user
-// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix
-// product ends up to a row-vector times col-vector product... To tackle this use
-// case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
-
-namespace internal {
-
-template<typename Lhs, typename Rhs>
-struct traits<GeneralProduct<Lhs,Rhs,InnerProduct> >
- : traits<Matrix<typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> >
-{};
-
-}
-
-template<typename Lhs, typename Rhs>
-class GeneralProduct<Lhs, Rhs, InnerProduct>
-  : internal::no_assignment_operator,
-    public Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1>
-{
-    typedef Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base;
-  public:
-    GeneralProduct(const Lhs& lhs, const Rhs& rhs)
-    {
-      EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
-        YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-
-      Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
-    }
-
-    /** Convertion to scalar */
-    operator const typename Base::Scalar() const {
-      return Base::coeff(0,0);
-    }
-};
-
-/***********************************************************************
-*  Implementation of Outer Vector Vector Product
-***********************************************************************/
-
-namespace internal {
-template<int StorageOrder> struct outer_product_selector;
-
-template<typename Lhs, typename Rhs>
-struct traits<GeneralProduct<Lhs,Rhs,OuterProduct> >
- : traits<ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs> >
-{};
-
-}
 
 template<typename Lhs, typename Rhs>
-class GeneralProduct<Lhs, Rhs, OuterProduct>
-  : public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
+class Product : public ProductImpl<Lhs,Rhs,typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
+                                                                            typename internal::traits<Rhs>::StorageKind>::ret>
 {
   public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
-
-    GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    
+    typedef typename ProductImpl<
+        Lhs, Rhs,
+        typename internal::promote_storage_type<typename Lhs::StorageKind,
+                                                typename Rhs::StorageKind>::ret>::Base Base;
+    EIGEN_GENERIC_PUBLIC_INTERFACE(Product)
+
+    typedef typename Lhs::Nested LhsNested;
+    typedef typename Rhs::Nested RhsNested;
+    typedef typename internal::remove_all<LhsNested>::type LhsNestedCleaned;
+    typedef typename internal::remove_all<RhsNested>::type RhsNestedCleaned;
+
+    Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs)
     {
-      EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
-        YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+      eigen_assert(lhs.cols() == rhs.rows()
+        && "invalid matrix product"
+        && "if you wanted a coeff-wise or a dot product use the respective explicit functions");
     }
 
-    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
-    {
-      internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
-    }
-};
+    inline Index rows() const { return m_lhs.rows(); }
+    inline Index cols() const { return m_rhs.cols(); }
 
-namespace internal {
+    const LhsNestedCleaned& lhs() const { return m_lhs; }
+    const RhsNestedCleaned& rhs() const { return m_rhs; }
 
-template<> struct outer_product_selector<ColMajor> {
-  template<typename ProductType, typename Dest>
-  static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
-    typedef typename Dest::Index Index;
-    // FIXME make sure lhs is sequentially stored
-    // FIXME not very good if rhs is real and lhs complex while alpha is real too
-    const Index cols = dest.cols();
-    for (Index j=0; j<cols; ++j)
-      dest.col(j) += (alpha * prod.rhs().coeff(j)) * prod.lhs();
-  }
-};
+  protected:
 
-template<> struct outer_product_selector<RowMajor> {
-  template<typename ProductType, typename Dest>
-  static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
-    typedef typename Dest::Index Index;
-    // FIXME make sure rhs is sequentially stored
-    // FIXME not very good if lhs is real and rhs complex while alpha is real too
-    const Index rows = dest.rows();
-    for (Index i=0; i<rows; ++i)
-      dest.row(i) += (alpha * prod.lhs().coeff(i)) * prod.rhs();
-  }
+    const LhsNested m_lhs;
+    const RhsNested m_rhs;
 };
 
-} // end namespace internal
-
-/***********************************************************************
-*  Implementation of General Matrix Vector Product
-***********************************************************************/
-
-/*  According to the shape/flags of the matrix we have to distinghish 3 different cases:
- *   1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine
- *   2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine
- *   3 - all other cases are handled using a simple loop along the outer-storage direction.
- *  Therefore we need a lower level meta selector.
- *  Furthermore, if the matrix is the rhs, then the product has to be transposed.
- */
-namespace internal {
-
-template<typename Lhs, typename Rhs>
-struct traits<GeneralProduct<Lhs,Rhs,GemvProduct> >
- : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs> >
-{};
-
-template<int Side, int StorageOrder, bool BlasCompatible>
-struct gemv_selector;
-
-} // end namespace internal
-
 template<typename Lhs, typename Rhs>
-class GeneralProduct<Lhs, Rhs, GemvProduct>
-  : public ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs>
+class ProductImpl<Lhs,Rhs,Dense> : public internal::dense_xpr_base<Product<Lhs,Rhs> >::type
 {
+    typedef Product<Lhs, Rhs> Derived;
   public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
-
-    typedef typename Lhs::Scalar LhsScalar;
-    typedef typename Rhs::Scalar RhsScalar;
-
-    GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
-    {
-//       EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value),
-//         YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-    }
-
-    enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
-    typedef typename internal::conditional<int(Side)==OnTheRight,_LhsNested,_RhsNested>::type MatrixType;
-
-    template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
-    {
-      eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols());
-      internal::gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
-                       bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha);
-    }
-};
-
-namespace internal {
-
-// The vector is on the left => transposition
-template<int StorageOrder, bool BlasCompatible>
-struct gemv_selector<OnTheLeft,StorageOrder,BlasCompatible>
-{
-  template<typename ProductType, typename Dest>
-  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
-  {
-    Transpose<Dest> destT(dest);
-    enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor };
-    gemv_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
-      ::run(GeneralProduct<Transpose<const typename ProductType::_RhsNested>,Transpose<const typename ProductType::_LhsNested>, GemvProduct>
-        (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha);
-  }
-};
-
-template<typename Scalar,int Size,int MaxSize,bool Cond> struct gemv_static_vector_if;
-
-template<typename Scalar,int Size,int MaxSize>
-struct gemv_static_vector_if<Scalar,Size,MaxSize,false>
-{
-  EIGEN_STRONG_INLINE  Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; }
-};
-
-template<typename Scalar,int Size>
-struct gemv_static_vector_if<Scalar,Size,Dynamic,true>
-{
-  EIGEN_STRONG_INLINE Scalar* data() { return 0; }
-};
-
-template<typename Scalar,int Size,int MaxSize>
-struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
-{
-  #if EIGEN_ALIGN_STATICALLY
-  internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;
-  EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
-  #else
-  // Some architectures cannot align on the stack,
-  // => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
-  enum {
-    ForceAlignment  = internal::packet_traits<Scalar>::Vectorizable,
-    PacketSize      = internal::packet_traits<Scalar>::size
-  };
-  internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;
-  EIGEN_STRONG_INLINE Scalar* data() {
-    return ForceAlignment
-            ? reinterpret_cast<Scalar*>((reinterpret_cast<size_t>(m_data.array) & ~(size_t(15))) + 16)
-            : m_data.array;
-  }
-  #endif
-};
-
-template<> struct gemv_selector<OnTheRight,ColMajor,true>
-{
-  template<typename ProductType, typename Dest>
-  static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
-  {
-    typedef typename ProductType::Index Index;
-    typedef typename ProductType::LhsScalar   LhsScalar;
-    typedef typename ProductType::RhsScalar   RhsScalar;
-    typedef typename ProductType::Scalar      ResScalar;
-    typedef typename ProductType::RealScalar  RealScalar;
-    typedef typename ProductType::ActualLhsType ActualLhsType;
-    typedef typename ProductType::ActualRhsType ActualRhsType;
-    typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
-    typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
-    typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
-
-    const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs());
-    const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs());
-
-    ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
-                                  * RhsBlasTraits::extractScalarFactor(prod.rhs());
-
-    enum {
-      // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
-      // on, the other hand it is good for the cache to pack the vector anyways...
-      EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
-      ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
-      MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal
-    };
-
-    gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
-
-    // this is written like this (i.e., with a ?:) to workaround an ICE with ICC 12
-    bool alphaIsCompatible = (!ComplexByReal) ? true : (imag(actualAlpha)==RealScalar(0));
-    bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
-    
-    RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
-
-    ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
-                                                  evalToDest ? dest.data() : static_dest.data());
-    
-    if(!evalToDest)
-    {
-      #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
-      int size = dest.size();
-      EIGEN_DENSE_STORAGE_CTOR_PLUGIN
-      #endif
-      if(!alphaIsCompatible)
-      {
-        MappedDest(actualDestPtr, dest.size()).setZero();
-        compatibleAlpha = RhsScalar(1);
-      }
-      else
-        MappedDest(actualDestPtr, dest.size()) = dest;
-    }
 
-    general_matrix_vector_product
-      <Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
-        actualLhs.rows(), actualLhs.cols(),
-        &actualLhs.coeffRef(0,0), actualLhs.outerStride(),
-        actualRhs.data(), actualRhs.innerStride(),
-        actualDestPtr, 1,
-        compatibleAlpha);
-
-    if (!evalToDest)
-    {
-      if(!alphaIsCompatible)
-        dest += actualAlpha * MappedDest(actualDestPtr, dest.size());
-      else
-        dest = MappedDest(actualDestPtr, dest.size());
-    }
-  }
-};
-
-template<> struct gemv_selector<OnTheRight,RowMajor,true>
-{
-  template<typename ProductType, typename Dest>
-  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
-  {
-    typedef typename ProductType::LhsScalar LhsScalar;
-    typedef typename ProductType::RhsScalar RhsScalar;
-    typedef typename ProductType::Scalar    ResScalar;
-    typedef typename ProductType::Index Index;
-    typedef typename ProductType::ActualLhsType ActualLhsType;
-    typedef typename ProductType::ActualRhsType ActualRhsType;
-    typedef typename ProductType::_ActualRhsType _ActualRhsType;
-    typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
-    typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
-
-    typename add_const<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
-    typename add_const<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
-
-    ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
-                                  * RhsBlasTraits::extractScalarFactor(prod.rhs());
-
-    enum {
-      // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
-      // on, the other hand it is good for the cache to pack the vector anyways...
-      DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1
-    };
-
-    gemv_static_vector_if<RhsScalar,_ActualRhsType::SizeAtCompileTime,_ActualRhsType::MaxSizeAtCompileTime,!DirectlyUseRhs> static_rhs;
-
-    ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(),
-        DirectlyUseRhs ? const_cast<RhsScalar*>(actualRhs.data()) : static_rhs.data());
-
-    if(!DirectlyUseRhs)
-    {
-      #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
-      int size = actualRhs.size();
-      EIGEN_DENSE_STORAGE_CTOR_PLUGIN
-      #endif
-      Map<typename _ActualRhsType::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
-    }
-
-    general_matrix_vector_product
-      <Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
-        actualLhs.rows(), actualLhs.cols(),
-        &actualLhs.coeffRef(0,0), actualLhs.outerStride(),
-        actualRhsPtr, 1,
-        &dest.coeffRef(0,0), dest.innerStride(),
-        actualAlpha);
-  }
-};
-
-template<> struct gemv_selector<OnTheRight,ColMajor,false>
-{
-  template<typename ProductType, typename Dest>
-  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
-  {
-    typedef typename Dest::Index Index;
-    // TODO makes sure dest is sequentially stored in memory, otherwise use a temp
-    const Index size = prod.rhs().rows();
-    for(Index k=0; k<size; ++k)
-      dest += (alpha*prod.rhs().coeff(k)) * prod.lhs().col(k);
-  }
-};
-
-template<> struct gemv_selector<OnTheRight,RowMajor,false>
-{
-  template<typename ProductType, typename Dest>
-  static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
-  {
-    typedef typename Dest::Index Index;
-    // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp
-    const Index rows = prod.rows();
-    for(Index i=0; i<rows; ++i)
-      dest.coeffRef(i) += alpha * (prod.lhs().row(i).cwiseProduct(prod.rhs().transpose())).sum();
-  }
+    typedef typename internal::dense_xpr_base<Product<Lhs, Rhs> >::type Base;
+    EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
 };
 
-} // end namespace internal
-
-/***************************************************************************
-* Implementation of matrix base methods
-***************************************************************************/
-
-/** \returns the matrix product of \c *this and \a other.
-  *
-  * \note If instead of the matrix product you want the coefficient-wise product, see Cwise::operator*().
-  *
-  * \sa lazyProduct(), operator*=(const MatrixBase&), Cwise::operator*()
-  */
-template<typename Derived>
-template<typename OtherDerived>
-inline const typename ProductReturnType<Derived,OtherDerived>::Type
-MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
-{
-  // A note regarding the function declaration: In MSVC, this function will sometimes
-  // not be inlined since DenseStorage is an unwindable object for dynamic
-  // matrices and product types are holding a member to store the result.
-  // Thus it does not help tagging this function with EIGEN_STRONG_INLINE.
-  enum {
-    ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
-                   || OtherDerived::RowsAtCompileTime==Dynamic
-                   || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
-    AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
-    SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
-  };
-  // note to the lost user:
-  //    * for a dot product use: v1.dot(v2)
-  //    * for a coeff-wise product use: v1.cwiseProduct(v2)
-  EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
-    INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
-  EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
-    INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
-  EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
-#ifdef EIGEN_DEBUG_PRODUCT
-  internal::product_type<Derived,OtherDerived>::debug();
-#endif
-  return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
-}
-
-/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation.
-  *
-  * The returned product will behave like any other expressions: the coefficients of the product will be
-  * computed once at a time as requested. This might be useful in some extremely rare cases when only
-  * a small and no coherent fraction of the result's coefficients have to be computed.
-  *
-  * \warning This version of the matrix product can be much much slower. So use it only if you know
-  * what you are doing and that you measured a true speed improvement.
-  *
-  * \sa operator*(const MatrixBase&)
-  */
-template<typename Derived>
-template<typename OtherDerived>
-const typename LazyProductReturnType<Derived,OtherDerived>::Type
-MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
-{
-  enum {
-    ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
-                   || OtherDerived::RowsAtCompileTime==Dynamic
-                   || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
-    AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
-    SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
-  };
-  // note to the lost user:
-  //    * for a dot product use: v1.dot(v2)
-  //    * for a coeff-wise product use: v1.cwiseProduct(v2)
-  EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
-    INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
-  EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
-    INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
-  EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
-
-  return typename LazyProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
-}
-
 #endif // EIGEN_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Core/ProductBase.h b/extern/Eigen3/Eigen/src/Core/ProductBase.h
index 9197588..ec12e5c 100644
--- a/extern/Eigen3/Eigen/src/Core/ProductBase.h
+++ b/extern/Eigen3/Eigen/src/Core/ProductBase.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PRODUCTBASE_H
 #define EIGEN_PRODUCTBASE_H
 
+namespace Eigen { 
+
 /** \class ProductBase
   * \ingroup Core_Module
   *
@@ -115,10 +102,10 @@ class ProductBase : public MatrixBase<Derived>
     inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); }
 
     template<typename Dest>
-    inline void addTo(Dest& dst) const { scaleAndAddTo(dst,1); }
+    inline void addTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(1)); }
 
     template<typename Dest>
-    inline void subTo(Dest& dst) const { scaleAndAddTo(dst,-1); }
+    inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); }
 
     template<typename Dest>
     inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); }
@@ -181,8 +168,8 @@ class ProductBase : public MatrixBase<Derived>
 
   protected:
 
-    const LhsNested m_lhs;
-    const RhsNested m_rhs;
+    LhsNested m_lhs;
+    RhsNested m_rhs;
 
     mutable PlainObject m_result;
 };
@@ -286,5 +273,6 @@ Derived& MatrixBase<Derived>::lazyAssign(const ProductBase<ProductDerived, Lhs,R
   return derived();
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_PRODUCTBASE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Random.h b/extern/Eigen3/Eigen/src/Core/Random.h
index b7d9010..a9f7f43 100644
--- a/extern/Eigen3/Eigen/src/Core/Random.h
+++ b/extern/Eigen3/Eigen/src/Core/Random.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_RANDOM_H
 #define EIGEN_RANDOM_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Scalar> struct scalar_random_op {
@@ -160,4 +147,6 @@ PlainObjectBase<Derived>::setRandom(Index rows, Index cols)
   return setRandom();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_RANDOM_H
diff --git a/extern/Eigen3/Eigen/src/Core/Redux.h b/extern/Eigen3/Eigen/src/Core/Redux.h
index f9f5a95..b7ce7c6 100644
--- a/extern/Eigen3/Eigen/src/Core/Redux.h
+++ b/extern/Eigen3/Eigen/src/Core/Redux.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_REDUX_H
 #define EIGEN_REDUX_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // TODO
@@ -95,7 +82,7 @@ struct redux_novec_unroller
 
   typedef typename Derived::Scalar Scalar;
 
-  EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func& func)
+  static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func)
   {
     return func(redux_novec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
                 redux_novec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func));
@@ -112,7 +99,7 @@ struct redux_novec_unroller<Func, Derived, Start, 1>
 
   typedef typename Derived::Scalar Scalar;
 
-  EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func&)
+  static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func&)
   {
     return mat.coeffByOuterInner(outer, inner);
   }
@@ -125,7 +112,7 @@ template<typename Func, typename Derived, int Start>
 struct redux_novec_unroller<Func, Derived, Start, 0>
 {
   typedef typename Derived::Scalar Scalar;
-  EIGEN_STRONG_INLINE static Scalar run(const Derived&, const Func&) { return Scalar(); }
+  static EIGEN_STRONG_INLINE Scalar run(const Derived&, const Func&) { return Scalar(); }
 };
 
 /*** vectorization ***/
@@ -141,7 +128,7 @@ struct redux_vec_unroller
   typedef typename Derived::Scalar Scalar;
   typedef typename packet_traits<Scalar>::type PacketScalar;
 
-  EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func& func)
+  static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func& func)
   {
     return func.packetOp(
             redux_vec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
@@ -162,7 +149,7 @@ struct redux_vec_unroller<Func, Derived, Start, 1>
   typedef typename Derived::Scalar Scalar;
   typedef typename packet_traits<Scalar>::type PacketScalar;
 
-  EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func&)
+  static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func&)
   {
     return mat.template packetByOuterInner<alignment>(outer, inner);
   }
@@ -214,20 +201,33 @@ struct redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
     const Index size = mat.size();
     eigen_assert(size && "you are using an empty matrix");
     const Index packetSize = packet_traits<Scalar>::size;
-    const Index alignedStart = first_aligned(mat);
+    const Index alignedStart = internal::first_aligned(mat);
     enum {
       alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit)
                 ? Aligned : Unaligned
     };
-    const Index alignedSize = ((size-alignedStart)/packetSize)*packetSize;
-    const Index alignedEnd = alignedStart + alignedSize;
+    const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize);
+    const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize);
+    const Index alignedEnd2 = alignedStart + alignedSize2;
+    const Index alignedEnd  = alignedStart + alignedSize;
     Scalar res;
     if(alignedSize)
     {
-      PacketScalar packet_res = mat.template packet<alignment>(alignedStart);
-      for(Index index = alignedStart + packetSize; index < alignedEnd; index += packetSize)
-        packet_res = func.packetOp(packet_res, mat.template packet<alignment>(index));
-      res = func.predux(packet_res);
+      PacketScalar packet_res0 = mat.template packet<alignment>(alignedStart);
+      if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop
+      {
+        PacketScalar packet_res1 = mat.template packet<alignment>(alignedStart+packetSize);
+        for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize)
+        {
+          packet_res0 = func.packetOp(packet_res0, mat.template packet<alignment>(index));
+          packet_res1 = func.packetOp(packet_res1, mat.template packet<alignment>(index+packetSize));
+        }
+
+        packet_res0 = func.packetOp(packet_res0,packet_res1);
+        if(alignedEnd>alignedEnd2)
+          packet_res0 = func.packetOp(packet_res0, mat.template packet<alignment>(alignedEnd2));
+      }
+      res = func.predux(packet_res0);
 
       for(Index index = 0; index < alignedStart; ++index)
         res = func(res,mat.coeff(index));
@@ -296,7 +296,7 @@ struct redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling>
     Size = Derived::SizeAtCompileTime,
     VectorizedSize = (Size / PacketSize) * PacketSize
   };
-  EIGEN_STRONG_INLINE static Scalar run(const Derived& mat, const Func& func)
+  static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func)
   {
     eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
     Scalar res = func.predux(redux_vec_unroller<Func, Derived, 0, Size / PacketSize>::run(mat,func));
@@ -401,4 +401,6 @@ MatrixBase<Derived>::trace() const
   return derived().diagonal().sum();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_REDUX_H
diff --git a/extern/Eigen3/Eigen/src/Core/Replicate.h b/extern/Eigen3/Eigen/src/Core/Replicate.h
index 4c171f8..b61fdc2 100644
--- a/extern/Eigen3/Eigen/src/Core/Replicate.h
+++ b/extern/Eigen3/Eigen/src/Core/Replicate.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_REPLICATE_H
 #define EIGEN_REPLICATE_H
 
+namespace Eigen { 
+
 /**
   * \class Replicate
   * \ingroup Core_Module
@@ -92,7 +79,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
     }
 
     template<typename OriginalMatrixType>
-    inline Replicate(const OriginalMatrixType& matrix, int rowFactor, int colFactor)
+    inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
       : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
     {
       EIGEN_STATIC_ASSERT((internal::is_same<typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
@@ -127,9 +114,13 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
       return m_matrix.template packet<LoadMode>(actual_row, actual_col);
     }
 
+    const _MatrixTypeNested& nestedExpression() const
+    { 
+      return m_matrix; 
+    }
 
   protected:
-    const MatrixTypeNested m_matrix;
+    MatrixTypeNested m_matrix;
     const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
     const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
 };
@@ -181,4 +172,6 @@ VectorwiseOp<ExpressionType,Direction>::replicate(Index factor) const
           (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_REPLICATE_H
diff --git a/extern/Eigen3/Eigen/src/Core/ReturnByValue.h b/extern/Eigen3/Eigen/src/Core/ReturnByValue.h
index 24c5a4e..613912f 100644
--- a/extern/Eigen3/Eigen/src/Core/ReturnByValue.h
+++ b/extern/Eigen3/Eigen/src/Core/ReturnByValue.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_RETURNBYVALUE_H
 #define EIGEN_RETURNBYVALUE_H
 
+namespace Eigen {
+
 /** \class ReturnByValue
   * \ingroup Core_Module
   *
@@ -96,4 +83,6 @@ Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_RETURNBYVALUE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Reverse.h b/extern/Eigen3/Eigen/src/Core/Reverse.h
index 600744a..e30ae3d 100644
--- a/extern/Eigen3/Eigen/src/Core/Reverse.h
+++ b/extern/Eigen3/Eigen/src/Core/Reverse.h
@@ -5,28 +5,15 @@
 // Copyright (C) 2009 Ricard Marxer <email at ricardmarxer.com>
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_REVERSE_H
 #define EIGEN_REVERSE_H
 
+namespace Eigen { 
+
 /** \class Reverse
   * \ingroup Core_Module
   *
@@ -183,8 +170,14 @@ template<typename MatrixType, int Direction> class Reverse
       m_matrix.const_cast_derived().template writePacket<LoadMode>(m_matrix.size() - index - PacketSize, internal::preverse(x));
     }
 
+    const typename internal::remove_all<typename MatrixType::Nested>::type& 
+    nestedExpression() const 
+    {
+      return m_matrix;
+    }
+
   protected:
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 /** \returns an expression of the reverse of *this.
@@ -226,5 +219,6 @@ inline void DenseBase<Derived>::reverseInPlace()
   derived() = derived().reverse().eval();
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_REVERSE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Select.h b/extern/Eigen3/Eigen/src/Core/Select.h
index d0cd66a..2bf6e91 100644
--- a/extern/Eigen3/Eigen/src/Core/Select.h
+++ b/extern/Eigen3/Eigen/src/Core/Select.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELECT_H
 #define EIGEN_SELECT_H
 
+namespace Eigen { 
+
 /** \class Select
   * \ingroup Core_Module
   *
@@ -101,10 +88,25 @@ class Select : internal::no_assignment_operator,
         return m_else.coeff(i);
     }
 
+    const ConditionMatrixType& conditionMatrix() const
+    {
+      return m_condition;
+    }
+
+    const ThenMatrixType& thenMatrix() const
+    {
+      return m_then;
+    }
+
+    const ElseMatrixType& elseMatrix() const
+    {
+      return m_else;
+    }
+
   protected:
-    const typename ConditionMatrixType::Nested m_condition;
-    const typename ThenMatrixType::Nested m_then;
-    const typename ElseMatrixType::Nested m_else;
+    typename ConditionMatrixType::Nested m_condition;
+    typename ThenMatrixType::Nested m_then;
+    typename ElseMatrixType::Nested m_else;
 };
 
 
@@ -155,4 +157,6 @@ DenseBase<Derived>::select(typename ElseDerived::Scalar thenScalar,
     derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELECT_H
diff --git a/extern/Eigen3/Eigen/src/Core/SelfAdjointView.h b/extern/Eigen3/Eigen/src/Core/SelfAdjointView.h
index 4bb6875..82cc4da 100644
--- a/extern/Eigen3/Eigen/src/Core/SelfAdjointView.h
+++ b/extern/Eigen3/Eigen/src/Core/SelfAdjointView.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINTMATRIX_H
 #define EIGEN_SELFADJOINTMATRIX_H
 
+namespace Eigen { 
+
 /** \class SelfAdjointView
   * \ingroup Core_Module
   *
@@ -82,7 +69,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
     };
     typedef typename MatrixType::PlainObject PlainObject;
 
-    inline SelfAdjointView(const MatrixType& matrix) : m_matrix(matrix)
+    inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
     {}
 
     inline Index rows() const { return m_matrix.rows(); }
@@ -199,7 +186,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
     #endif
 
   protected:
-    const MatrixTypeNested m_matrix;
+    MatrixTypeNested m_matrix;
 };
 
 
@@ -222,7 +209,7 @@ struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), U
     row = (UnrollCount-1) % Derived1::RowsAtCompileTime
   };
 
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), UnrollCount-1, ClearOpposite>::run(dst, src);
 
@@ -236,7 +223,7 @@ struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), U
 template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, 0, ClearOpposite>
 {
-  inline static void run(Derived1 &, const Derived2 &) {}
+  static inline void run(Derived1 &, const Derived2 &) {}
 };
 
 template<typename Derived1, typename Derived2, int UnrollCount, bool ClearOpposite>
@@ -247,7 +234,7 @@ struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), U
     row = (UnrollCount-1) % Derived1::RowsAtCompileTime
   };
 
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), UnrollCount-1, ClearOpposite>::run(dst, src);
 
@@ -261,14 +248,14 @@ struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), U
 template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, 0, ClearOpposite>
 {
-  inline static void run(Derived1 &, const Derived2 &) {}
+  static inline void run(Derived1 &, const Derived2 &) {}
 };
 
 template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -285,7 +272,7 @@ struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, Dyn
 template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, Dynamic, ClearOpposite>
 {
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
   typedef typename Derived1::Index Index;
     for(Index i = 0; i < dst.rows(); ++i)
@@ -322,4 +309,6 @@ MatrixBase<Derived>::selfadjointView()
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFADJOINTMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h b/extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
index 4e9ca88..0caf2ba 100644
--- a/extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
+++ b/extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFCWISEBINARYOP_H
 #define EIGEN_SELFCWISEBINARYOP_H
 
+namespace Eigen { 
+
 /** \class SelfCwiseBinaryOp
   * \ingroup Core_Module
   *
@@ -163,6 +150,16 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
       return Base::operator=(rhs);
     }
 
+    Lhs& expression() const 
+    { 
+      return m_matrix;
+    }
+
+    const BinaryOp& functor() const 
+    { 
+      return m_functor;
+    }
+
   protected:
     Lhs& m_matrix;
     const BinaryOp& m_functor;
@@ -192,4 +189,6 @@ inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFCWISEBINARYOP_H
diff --git a/extern/Eigen3/Eigen/src/Core/SolveTriangular.h b/extern/Eigen3/Eigen/src/Core/SolveTriangular.h
index a23014a..ef17f28 100644
--- a/extern/Eigen3/Eigen/src/Core/SolveTriangular.h
+++ b/extern/Eigen3/Eigen/src/Core/SolveTriangular.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SOLVETRIANGULAR_H
 #define EIGEN_SOLVETRIANGULAR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // Forward declarations:
@@ -98,12 +85,22 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
   typedef typename Rhs::Index Index;
   typedef blas_traits<Lhs> LhsProductTraits;
   typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
+
   static void run(const Lhs& lhs, Rhs& rhs)
   {
-    const ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
+    typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsProductTraits::extract(lhs);
+
+    const Index size = lhs.rows();
+    const Index othersize = Side==OnTheLeft? rhs.cols() : rhs.rows();
+
+    typedef internal::gemm_blocking_space<(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor,Scalar,Scalar,
+              Rhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxRowsAtCompileTime,4> BlockingType;
+
+    BlockingType blocking(rhs.rows(), rhs.cols(), size);
+
     triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
                                (Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor>
-      ::run(lhs.rows(), Side==OnTheLeft? rhs.cols() : rhs.rows(), &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride());
+      ::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
   }
 };
 
@@ -177,10 +174,8 @@ template<int Side, typename OtherDerived>
 void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
 {
   OtherDerived& other = _other.const_cast_derived();
-  eigen_assert(cols() == rows());
-  eigen_assert( (Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols()) );
-  eigen_assert(!(Mode & ZeroDiag));
-  eigen_assert((Mode & (Upper|Lower)) != 0);
+  eigen_assert( cols() == rows() && ((Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols())) );
+  eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
 
   enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit  && OtherDerived::IsVectorAtCompileTime };
   typedef typename internal::conditional<copy,
@@ -255,9 +250,11 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv
 
   protected:
     const TriangularType& m_triangularMatrix;
-    const typename Rhs::Nested m_rhs;
+    typename Rhs::Nested m_rhs;
 };
 
 } // namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_SOLVETRIANGULAR_H
diff --git a/extern/Eigen3/Eigen/src/Core/StableNorm.h b/extern/Eigen3/Eigen/src/Core/StableNorm.h
index f667272..d8bf7db 100644
--- a/extern/Eigen3/Eigen/src/Core/StableNorm.h
+++ b/extern/Eigen3/Eigen/src/Core/StableNorm.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STABLENORM_H
 #define EIGEN_STABLENORM_H
 
+namespace Eigen { 
+
 namespace internal {
 template<typename ExpressionType, typename Scalar>
 inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
@@ -58,9 +45,9 @@ MatrixBase<Derived>::stableNorm() const
 {
   using std::min;
   const Index blockSize = 4096;
-  RealScalar scale = 0;
-  RealScalar invScale = 1;
-  RealScalar ssq = 0; // sum of square
+  RealScalar scale(0);
+  RealScalar invScale(1);
+  RealScalar ssq(0); // sum of square
   enum {
     Alignment = (int(Flags)&DirectAccessBit) || (int(Flags)&AlignedBit) ? 1 : 0
   };
@@ -187,4 +174,6 @@ MatrixBase<Derived>::hypotNorm() const
   return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_STABLENORM_H
diff --git a/extern/Eigen3/Eigen/src/Core/Stride.h b/extern/Eigen3/Eigen/src/Core/Stride.h
index 0430f11..1e3f5fe 100644
--- a/extern/Eigen3/Eigen/src/Core/Stride.h
+++ b/extern/Eigen3/Eigen/src/Core/Stride.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STRIDE_H
 #define EIGEN_STRIDE_H
 
+namespace Eigen { 
+
 /** \class Stride
   * \ingroup Core_Module
   *
@@ -116,4 +103,6 @@ class OuterStride : public Stride<Value, 0>
     OuterStride(Index v) : Base(v,0) {}
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_STRIDE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Swap.h b/extern/Eigen3/Eigen/src/Core/Swap.h
index 5fb0328..fd73cf3 100644
--- a/extern/Eigen3/Eigen/src/Core/Swap.h
+++ b/extern/Eigen3/Eigen/src/Core/Swap.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SWAP_H
 #define EIGEN_SWAP_H
 
+namespace Eigen { 
+
 /** \class SwapWrapper
   * \ingroup Core_Module
   *
@@ -52,6 +39,15 @@ template<typename ExpressionType> class SwapWrapper
     inline Index cols() const { return m_expression.cols(); }
     inline Index outerStride() const { return m_expression.outerStride(); }
     inline Index innerStride() const { return m_expression.innerStride(); }
+    
+    typedef typename internal::conditional<
+                       internal::is_lvalue<ExpressionType>::value,
+                       Scalar,
+                       const Scalar
+                     >::type ScalarWithConstIfNotLvalue;
+                     
+    inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
+    inline const Scalar* data() const { return m_expression.data(); }
 
     inline Scalar& coeffRef(Index row, Index col)
     {
@@ -119,8 +115,12 @@ template<typename ExpressionType> class SwapWrapper
       _other.template writePacket<LoadMode>(index, tmp);
     }
 
+    ExpressionType& expression() const { return m_expression; }
+
   protected:
     ExpressionType& m_expression;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_SWAP_H
diff --git a/extern/Eigen3/Eigen/src/Core/Transpose.h b/extern/Eigen3/Eigen/src/Core/Transpose.h
index 3f7c7df..045a1cc 100644
--- a/extern/Eigen3/Eigen/src/Core/Transpose.h
+++ b/extern/Eigen3/Eigen/src/Core/Transpose.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRANSPOSE_H
 #define EIGEN_TRANSPOSE_H
 
+namespace Eigen { 
+
 /** \class Transpose
   * \ingroup Core_Module
   *
@@ -91,7 +78,7 @@ template<typename MatrixType> class Transpose
     nestedExpression() { return m_matrix.const_cast_derived(); }
 
   protected:
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 namespace internal {
@@ -152,12 +139,12 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
       return derived().nestedExpression().coeffRef(index);
     }
 
-    inline const CoeffReturnType coeff(Index row, Index col) const
+    inline CoeffReturnType coeff(Index row, Index col) const
     {
       return derived().nestedExpression().coeff(col, row);
     }
 
-    inline const CoeffReturnType coeff(Index index) const
+    inline CoeffReturnType coeff(Index index) const
     {
       return derived().nestedExpression().coeff(index);
     }
@@ -422,4 +409,6 @@ void DenseBase<Derived>::checkTransposeAliasing(const OtherDerived& other) const
 }
 #endif
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRANSPOSE_H
diff --git a/extern/Eigen3/Eigen/src/Core/Transpositions.h b/extern/Eigen3/Eigen/src/Core/Transpositions.h
index 88fdfb2..2cd268a 100644
--- a/extern/Eigen3/Eigen/src/Core/Transpositions.h
+++ b/extern/Eigen3/Eigen/src/Core/Transpositions.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRANSPOSITIONS_H
 #define EIGEN_TRANSPOSITIONS_H
 
+namespace Eigen { 
+
 /** \class Transpositions
   * \ingroup Core_Module
   *
@@ -404,7 +391,7 @@ struct transposition_matrix_product_retval
 
   protected:
     const TranspositionType& m_transpositions;
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 } // end namespace internal
@@ -444,4 +431,6 @@ class Transpose<TranspositionsBase<TranspositionsDerived> >
     const TranspositionType& m_transpositions;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRANSPOSITIONS_H
diff --git a/extern/Eigen3/Eigen/src/Core/TriangularMatrix.h b/extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
index 033e810..de95400 100644
--- a/extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULARMATRIX_H
 #define EIGEN_TRIANGULARMATRIX_H
 
+namespace Eigen { 
+
 namespace internal {
   
 template<int Side, typename TriangularType, typename Rhs> struct triangular_solve_retval;
@@ -273,11 +260,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
     inline const TriangularView<MatrixConjugateReturnType,Mode> conjugate() const
     { return m_matrix.conjugate(); }
 
-    /** \sa MatrixBase::adjoint() */
-    inline TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint()
-    { return m_matrix.adjoint(); }
     /** \sa MatrixBase::adjoint() const */
-    inline const TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint() const
+    inline const TriangularView<const typename MatrixType::AdjointReturnType,TransposeMode> adjoint() const
     { return m_matrix.adjoint(); }
 
     /** \sa MatrixBase::transpose() */
@@ -288,11 +272,13 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
     }
     /** \sa MatrixBase::transpose() const */
     inline const TriangularView<Transpose<MatrixType>,TransposeMode> transpose() const
-    { return m_matrix.transpose(); }
+    {
+      return m_matrix.transpose();
+    }
 
     /** Efficient triangular matrix times vector/matrix product */
     template<typename OtherDerived>
-    TriangularProduct<Mode,true,MatrixType,false,OtherDerived,OtherDerived::IsVectorAtCompileTime>
+    TriangularProduct<Mode,true,MatrixType,false,OtherDerived, OtherDerived::IsVectorAtCompileTime>
     operator*(const MatrixBase<OtherDerived>& rhs) const
     {
       return TriangularProduct
@@ -375,7 +361,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
     template<typename OtherDerived>
     void swap(MatrixBase<OtherDerived> const & other)
     {
-      TriangularView<SwapWrapper<MatrixType>,Mode>(const_cast<MatrixType&>(m_matrix)).lazyAssign(other.derived());
+      SwapWrapper<MatrixType> swaper(const_cast<MatrixType&>(m_matrix));
+      TriangularView<SwapWrapper<MatrixType>,Mode>(swaper).lazyAssign(other.derived());
     }
 
     Scalar determinant() const
@@ -433,7 +420,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
     template<typename ProductDerived, typename Lhs, typename Rhs>
     EIGEN_STRONG_INLINE TriangularView& assignProduct(const ProductBase<ProductDerived, Lhs,Rhs>& prod, const Scalar& alpha);
 
-    const MatrixTypeNested m_matrix;
+    MatrixTypeNested m_matrix;
 };
 
 /***************************************************************************
@@ -452,7 +439,7 @@ struct triangular_assignment_selector
   
   typedef typename Derived1::Scalar Scalar;
 
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     triangular_assignment_selector<Derived1, Derived2, Mode, UnrollCount-1, ClearOpposite>::run(dst, src);
 
@@ -480,7 +467,7 @@ struct triangular_assignment_selector
 template<typename Derived1, typename Derived2, unsigned int Mode, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, Mode, 0, ClearOpposite>
 {
-  inline static void run(Derived1 &, const Derived2 &) {}
+  static inline void run(Derived1 &, const Derived2 &) {}
 };
 
 template<typename Derived1, typename Derived2, bool ClearOpposite>
@@ -488,7 +475,7 @@ struct triangular_assignment_selector<Derived1, Derived2, Upper, Dynamic, ClearO
 {
   typedef typename Derived1::Index Index;
   typedef typename Derived1::Scalar Scalar;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -506,7 +493,7 @@ template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, Lower, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -524,7 +511,7 @@ template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, StrictlyUpper, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -542,7 +529,7 @@ template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, StrictlyLower, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -560,7 +547,7 @@ template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, UnitUpper, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -580,7 +567,7 @@ template<typename Derived1, typename Derived2, bool ClearOpposite>
 struct triangular_assignment_selector<Derived1, Derived2, UnitLower, Dynamic, ClearOpposite>
 {
   typedef typename Derived1::Index Index;
-  inline static void run(Derived1 &dst, const Derived2 &src)
+  static inline void run(Derived1 &dst, const Derived2 &src)
   {
     for(Index j = 0; j < dst.cols(); ++j)
     {
@@ -835,4 +822,6 @@ bool MatrixBase<Derived>::isLowerTriangular(RealScalar prec) const
   return true;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRIANGULARMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/VectorBlock.h b/extern/Eigen3/Eigen/src/Core/VectorBlock.h
index 858e4c7..6f4effc 100644
--- a/extern/Eigen3/Eigen/src/Core/VectorBlock.h
+++ b/extern/Eigen3/Eigen/src/Core/VectorBlock.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_VECTORBLOCK_H
 #define EIGEN_VECTORBLOCK_H
 
+namespace Eigen { 
+
 /** \class VectorBlock
   * \ingroup Core_Module
   *
@@ -292,5 +279,6 @@ DenseBase<Derived>::tail() const
   return typename ConstFixedSegmentReturnType<Size>::Type(derived(), size() - Size);
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_VECTORBLOCK_H
diff --git a/extern/Eigen3/Eigen/src/Core/VectorwiseOp.h b/extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
index 20f6881..862c0f3 100644
--- a/extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
+++ b/extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PARTIAL_REDUX_H
 #define EIGEN_PARTIAL_REDUX_H
 
+namespace Eigen { 
+
 /** \class PartialReduxExpr
   * \ingroup Core_Module
   *
@@ -110,7 +97,7 @@ class PartialReduxExpr : internal::no_assignment_operator,
     }
 
   protected:
-    const MatrixTypeNested m_matrix;
+    MatrixTypeNested m_matrix;
     const MemberOp m_functor;
 };
 
@@ -237,7 +224,10 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
     typename ExtendedType<OtherDerived>::Type
     extendedTo(const DenseBase<OtherDerived>& other) const
     {
-      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived);
+      EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(Direction==Vertical, OtherDerived::MaxColsAtCompileTime==1),
+                          YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
+      EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(Direction==Horizontal, OtherDerived::MaxRowsAtCompileTime==1),
+                          YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
       return typename ExtendedType<OtherDerived>::Type
                       (other.derived(),
                        Direction==Vertical   ? 1 : m_matrix.rows(),
@@ -418,10 +408,9 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
     ExpressionType& operator=(const DenseBase<OtherDerived>& other)
     {
       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
       //eigen_assert((m_matrix.isNull()) == (other.isNull())); FIXME
-      for(Index j=0; j<subVectors(); ++j)
-        subVector(j) = other;
-      return const_cast<ExpressionType&>(m_matrix);
+      return const_cast<ExpressionType&>(m_matrix = extendedTo(other.derived()));
     }
 
     /** Adds the vector \a other to each subvector of \c *this */
@@ -429,9 +418,8 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
     ExpressionType& operator+=(const DenseBase<OtherDerived>& other)
     {
       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-      for(Index j=0; j<subVectors(); ++j)
-        subVector(j) += other.derived();
-      return const_cast<ExpressionType&>(m_matrix);
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      return const_cast<ExpressionType&>(m_matrix += extendedTo(other.derived()));
     }
 
     /** Substracts the vector \a other to each subvector of \c *this */
@@ -439,8 +427,29 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
     ExpressionType& operator-=(const DenseBase<OtherDerived>& other)
     {
       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-      for(Index j=0; j<subVectors(); ++j)
-        subVector(j) -= other.derived();
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      return const_cast<ExpressionType&>(m_matrix -= extendedTo(other.derived()));
+    }
+
+    /** Multiples each subvector of \c *this by the vector \a other */
+    template<typename OtherDerived>
+    ExpressionType& operator*=(const DenseBase<OtherDerived>& other)
+    {
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      m_matrix *= extendedTo(other.derived());
+      return const_cast<ExpressionType&>(m_matrix);
+    }
+
+    /** Divides each subvector of \c *this by the vector \a other */
+    template<typename OtherDerived>
+    ExpressionType& operator/=(const DenseBase<OtherDerived>& other)
+    {
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      m_matrix /= extendedTo(other.derived());
       return const_cast<ExpressionType&>(m_matrix);
     }
 
@@ -451,7 +460,8 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
                   const typename ExtendedType<OtherDerived>::Type>
     operator+(const DenseBase<OtherDerived>& other) const
     {
-      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived);
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
       return m_matrix + extendedTo(other.derived());
     }
 
@@ -462,10 +472,39 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
                   const typename ExtendedType<OtherDerived>::Type>
     operator-(const DenseBase<OtherDerived>& other) const
     {
-      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived);
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
       return m_matrix - extendedTo(other.derived());
     }
 
+    /** Returns the expression where each subvector is the product of the vector \a other
+      * by the corresponding subvector of \c *this */
+    template<typename OtherDerived> EIGEN_STRONG_INLINE
+    CwiseBinaryOp<internal::scalar_product_op<Scalar>,
+                  const ExpressionTypeNestedCleaned,
+                  const typename ExtendedType<OtherDerived>::Type>
+    operator*(const DenseBase<OtherDerived>& other) const
+    {
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      return m_matrix * extendedTo(other.derived());
+    }
+
+    /** Returns the expression where each subvector is the quotient of the corresponding
+      * subvector of \c *this by the vector \a other */
+    template<typename OtherDerived>
+    CwiseBinaryOp<internal::scalar_quotient_op<Scalar>,
+                  const ExpressionTypeNestedCleaned,
+                  const typename ExtendedType<OtherDerived>::Type>
+    operator/(const DenseBase<OtherDerived>& other) const
+    {
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+      EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
+      EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
+      return m_matrix / extendedTo(other.derived());
+    }
+
 /////////// Geometry module ///////////
 
     #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
@@ -509,7 +548,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
   * Example: \include MatrixBase_colwise.cpp
   * Output: \verbinclude MatrixBase_colwise.out
   *
-  * \sa rowwise(), class VectorwiseOp
+  * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
   */
 template<typename Derived>
 inline const typename DenseBase<Derived>::ConstColwiseReturnType
@@ -520,7 +559,7 @@ DenseBase<Derived>::colwise() const
 
 /** \returns a writable VectorwiseOp wrapper of *this providing additional partial reduction operations
   *
-  * \sa rowwise(), class VectorwiseOp
+  * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
   */
 template<typename Derived>
 inline typename DenseBase<Derived>::ColwiseReturnType
@@ -534,7 +573,7 @@ DenseBase<Derived>::colwise()
   * Example: \include MatrixBase_rowwise.cpp
   * Output: \verbinclude MatrixBase_rowwise.out
   *
-  * \sa colwise(), class VectorwiseOp
+  * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
   */
 template<typename Derived>
 inline const typename DenseBase<Derived>::ConstRowwiseReturnType
@@ -545,7 +584,7 @@ DenseBase<Derived>::rowwise() const
 
 /** \returns a writable VectorwiseOp wrapper of *this providing additional partial reduction operations
   *
-  * \sa colwise(), class VectorwiseOp
+  * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
   */
 template<typename Derived>
 inline typename DenseBase<Derived>::RowwiseReturnType
@@ -554,4 +593,6 @@ DenseBase<Derived>::rowwise()
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_PARTIAL_REDUX_H
diff --git a/extern/Eigen3/Eigen/src/Core/Visitor.h b/extern/Eigen3/Eigen/src/Core/Visitor.h
index 378ebcb..916bfd0 100644
--- a/extern/Eigen3/Eigen/src/Core/Visitor.h
+++ b/extern/Eigen3/Eigen/src/Core/Visitor.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_VISITOR_H
 #define EIGEN_VISITOR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Visitor, typename Derived, int UnrollCount>
@@ -35,7 +22,7 @@ struct visitor_impl
     row = (UnrollCount-1) % Derived::RowsAtCompileTime
   };
 
-  inline static void run(const Derived &mat, Visitor& visitor)
+  static inline void run(const Derived &mat, Visitor& visitor)
   {
     visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
     visitor(mat.coeff(row, col), row, col);
@@ -45,7 +32,7 @@ struct visitor_impl
 template<typename Visitor, typename Derived>
 struct visitor_impl<Visitor, Derived, 1>
 {
-  inline static void run(const Derived &mat, Visitor& visitor)
+  static inline void run(const Derived &mat, Visitor& visitor)
   {
     return visitor.init(mat.coeff(0, 0), 0, 0);
   }
@@ -55,7 +42,7 @@ template<typename Visitor, typename Derived>
 struct visitor_impl<Visitor, Derived, Dynamic>
 {
   typedef typename Derived::Index Index;
-  inline static void run(const Derived& mat, Visitor& visitor)
+  static inline void run(const Derived& mat, Visitor& visitor)
   {
     visitor.init(mat.coeff(0,0), 0, 0);
     for(Index i = 1; i < mat.rows(); ++i)
@@ -245,4 +232,6 @@ DenseBase<Derived>::maxCoeff(IndexType* index) const
   return maxVisitor.res;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_VISITOR_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h b/extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
index f8adf1b..68d9a2b 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMPLEX_ALTIVEC_H
 #define EIGEN_COMPLEX_ALTIVEC_H
 
+namespace Eigen {
+
 namespace internal {
 
 static Packet4ui  p4ui_CONJ_XOR = vec_mergeh((Packet4ui)p4i_ZERO, (Packet4ui)p4f_ZERO_);//{ 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
@@ -168,7 +155,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const P
 template<int Offset>
 struct palign_impl<Offset,Packet2cf>
 {
-  EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
+  static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second)
   {
     if (Offset==1)
     {
@@ -225,4 +212,6 @@ template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& x
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPLEX_ALTIVEC_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h b/extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
index dc34ebb..75de193 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Konstantinos Margaritis <markos at codex.gr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PACKET_MATH_ALTIVEC_H
 #define EIGEN_PACKET_MATH_ALTIVEC_H
 
+namespace Eigen {
+
 namespace internal {
 
 #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
@@ -487,7 +474,7 @@ template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
 template<int Offset>
 struct palign_impl<Offset,Packet4f>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
+  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)
   {
     if (Offset!=0)
       first = vec_sld(first, second, Offset*4);
@@ -497,7 +484,7 @@ struct palign_impl<Offset,Packet4f>
 template<int Offset>
 struct palign_impl<Offset,Packet4i>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
+  static EIGEN_STRONG_INLINE void run(Packet4i& first, const Packet4i& second)
   {
     if (Offset!=0)
       first = vec_sld(first, second, Offset*4);
@@ -506,4 +493,6 @@ struct palign_impl<Offset,Packet4i>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_PACKET_MATH_ALTIVEC_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h b/extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
index 957adc8..097373c 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 /* All the parameters defined in this file can be specialized in the
diff --git a/extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h b/extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
index 2128871..795b4be 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMPLEX_NEON_H
 #define EIGEN_COMPLEX_NEON_H
 
+namespace Eigen {
+
 namespace internal {
 
 static uint32x4_t p4ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET4(0x00000000, 0x80000000, 0x00000000, 0x80000000);
@@ -267,4 +254,6 @@ template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, con
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPLEX_NEON_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h b/extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
index 6c7cd15..a20250f 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
@@ -5,28 +5,15 @@
 // Copyright (C) 2010 Konstantinos Margaritis <markos at codex.gr>
 // Heavily based on Gael's SSE version.
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PACKET_MATH_NEON_H
 #define EIGEN_PACKET_MATH_NEON_H
 
+namespace Eigen {
+
 namespace internal {
 
 #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
@@ -158,7 +145,8 @@ template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, co
 }
 
 // for some weird raisons, it has to be overloaded for packet of integers
-template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd(pmul(a,b), c); }
+template<> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vmlaq_f32(c,a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return vmlaq_s32(c,a,b); }
 
 template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return vminq_f32(a,b); }
 template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vminq_s32(a,b); }
@@ -431,4 +419,6 @@ PALIGN_NEON(3,Packet4i,vextq_s32)
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_PACKET_MATH_NEON_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h b/extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h
index c352bb3..12df987 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMPLEX_SSE_H
 #define EIGEN_COMPLEX_SSE_H
 
+namespace Eigen {
+
 namespace internal {
 
 //---------- float ----------
@@ -102,7 +89,7 @@ template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<flo
   Packet2cf res;
   #if EIGEN_GNUC_AT_MOST(4,2)
   // workaround annoying "may be used uninitialized in this function" warning with gcc 4.2
-  res.v = _mm_loadl_pi(_mm_set1_ps(0.0f), (const __m64*)&from);
+  res.v = _mm_loadl_pi(_mm_set1_ps(0.0f), reinterpret_cast<const __m64*>(&from));
   #else
   res.v = _mm_loadl_pi(res.v, (const __m64*)&from);
   #endif
@@ -151,7 +138,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const P
 template<int Offset>
 struct palign_impl<Offset,Packet2cf>
 {
-  EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
+  static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second)
   {
     if (Offset==1)
     {
@@ -350,7 +337,7 @@ template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const
 template<int Offset>
 struct palign_impl<Offset,Packet1cd>
 {
-  EIGEN_STRONG_INLINE static void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)
+  static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)
   {
     // FIXME is it sure we never have to align a Packet1cd?
     // Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary...
@@ -444,4 +431,6 @@ EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x)
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPLEX_SSE_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h b/extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
index 9d56d82..3f41a4e 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2007 Julien Pommier
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 /* The sin, cos, exp, and log functions of this file come from
  * Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/
@@ -30,6 +15,8 @@
 #ifndef EIGEN_MATH_FUNCTIONS_SSE_H
 #define EIGEN_MATH_FUNCTIONS_SSE_H
 
+namespace Eigen {
+
 namespace internal {
 
 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
@@ -121,7 +108,7 @@ Packet4f pexp<Packet4f>(const Packet4f& _x)
   _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
 
 
-  _EIGEN_DECLARE_CONST_Packet4f(exp_hi, 88.3762626647949f);
+  _EIGEN_DECLARE_CONST_Packet4f(exp_hi,  88.3762626647950f);
   _EIGEN_DECLARE_CONST_Packet4f(exp_lo, -88.3762626647949f);
 
   _EIGEN_DECLARE_CONST_Packet4f(cephes_LOG2EF, 1.44269504088896341f);
@@ -168,7 +155,7 @@ Packet4f pexp<Packet4f>(const Packet4f& _x)
   y = pmadd(y, z, x);
   y = padd(y, p4f_1);
 
-  /* build 2^n */
+  // build 2^n
   emm0 = _mm_cvttps_epi32(fx);
   emm0 = _mm_add_epi32(emm0, p4i_0x7f);
   emm0 = _mm_slli_epi32(emm0, 23);
@@ -392,4 +379,6 @@ Packet4f psqrt<Packet4f>(const Packet4f& _x)
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATH_FUNCTIONS_SSE_H
diff --git a/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h b/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
index 908e273..10d9182 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PACKET_MATH_SSE_H
 #define EIGEN_PACKET_MATH_SSE_H
 
+namespace Eigen {
+
 namespace internal {
 
 #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
@@ -110,9 +97,18 @@ template<> struct unpacket_traits<Packet4f> { typedef float  type; enum {size=4}
 template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2}; };
 template<> struct unpacket_traits<Packet4i> { typedef int    type; enum {size=4}; };
 
+#if defined(_MSC_VER) && (_MSC_VER==1500)
+// Workaround MSVC 9 internal compiler error.
+// TODO: It has been detected with win64 builds (amd64), so let's check whether it also happens in 32bits+SSE mode
+// TODO: let's check whether there does not exist a better fix, like adding a pset0() function. (it crashed on pset1(0)).
+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float&  from) { return _mm_set_ps(from,from,from,from); }
+template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set_pd(from,from); }
+template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int&    from) { return _mm_set_epi32(from,from,from,from); }
+#else
 template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float&  from) { return _mm_set1_ps(from); }
 template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
 template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int&    from) { return _mm_set1_epi32(from); }
+#endif
 
 template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a) { return _mm_add_ps(pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); }
 template<> EIGEN_STRONG_INLINE Packet2d plset<double>(const double& a) { return _mm_add_pd(pset1<Packet2d>(a),_mm_set_pd(1,0)); }
@@ -282,7 +278,7 @@ template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
 
 template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float*   from)
 {
-  return vec4f_swizzle1(_mm_castpd_ps(_mm_load_sd((const double*)from)), 0, 0, 1, 1);
+  return vec4f_swizzle1(_mm_castpd_ps(_mm_load_sd(reinterpret_cast<const double*>(from))), 0, 0, 1, 1);
 }
 template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double*  from)
 { return pset1<Packet2d>(from[0]); }
@@ -302,8 +298,8 @@ template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d&
   _mm_storel_pd((to), from);
   _mm_storeh_pd((to+1), from);
 }
-template<> EIGEN_STRONG_INLINE void pstoreu<float>(float*  to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castps_pd(from)); }
-template<> EIGEN_STRONG_INLINE void pstoreu<int>(int*      to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castsi128_pd(from)); }
+template<> EIGEN_STRONG_INLINE void pstoreu<float>(float*  to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), _mm_castps_pd(from)); }
+template<> EIGEN_STRONG_INLINE void pstoreu<int>(int*      to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), _mm_castsi128_pd(from)); }
 
 // some compilers might be tempted to perform multiple moves instead of using a vector path.
 template<> EIGEN_STRONG_INLINE void pstore1<Packet4f>(float* to, const float& a)
@@ -541,7 +537,7 @@ template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
 template<int Offset>
 struct palign_impl<Offset,Packet4f>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
+  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)
   {
     if (Offset!=0)
       first = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(second), _mm_castps_si128(first), Offset*4));
@@ -551,7 +547,7 @@ struct palign_impl<Offset,Packet4f>
 template<int Offset>
 struct palign_impl<Offset,Packet4i>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
+  static EIGEN_STRONG_INLINE void run(Packet4i& first, const Packet4i& second)
   {
     if (Offset!=0)
       first = _mm_alignr_epi8(second,first, Offset*4);
@@ -561,7 +557,7 @@ struct palign_impl<Offset,Packet4i>
 template<int Offset>
 struct palign_impl<Offset,Packet2d>
 {
-  EIGEN_STRONG_INLINE static void run(Packet2d& first, const Packet2d& second)
+  static EIGEN_STRONG_INLINE void run(Packet2d& first, const Packet2d& second)
   {
     if (Offset==1)
       first = _mm_castsi128_pd(_mm_alignr_epi8(_mm_castpd_si128(second), _mm_castpd_si128(first), 8));
@@ -572,7 +568,7 @@ struct palign_impl<Offset,Packet2d>
 template<int Offset>
 struct palign_impl<Offset,Packet4f>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
+  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)
   {
     if (Offset==1)
     {
@@ -595,7 +591,7 @@ struct palign_impl<Offset,Packet4f>
 template<int Offset>
 struct palign_impl<Offset,Packet4i>
 {
-  EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
+  static EIGEN_STRONG_INLINE void run(Packet4i& first, const Packet4i& second)
   {
     if (Offset==1)
     {
@@ -618,7 +614,7 @@ struct palign_impl<Offset,Packet4i>
 template<int Offset>
 struct palign_impl<Offset,Packet2d>
 {
-  EIGEN_STRONG_INLINE static void run(Packet2d& first, const Packet2d& second)
+  static EIGEN_STRONG_INLINE void run(Packet2d& first, const Packet2d& second)
   {
     if (Offset==1)
     {
@@ -631,4 +627,6 @@ struct palign_impl<Offset,Packet2d>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_PACKET_MATH_SSE_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h b/extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h
index dc20f7e..403d25f 100644
--- a/extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h
+++ b/extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COEFFBASED_PRODUCT_H
 #define EIGEN_COEFFBASED_PRODUCT_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /*********************************************************************************
@@ -224,8 +211,8 @@ class CoeffBasedProduct
     { return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); }
 
   protected:
-    const LhsNested m_lhs;
-    const RhsNested m_rhs;
+    typename internal::add_const_on_value_type<LhsNested>::type m_lhs;
+    typename internal::add_const_on_value_type<RhsNested>::type m_rhs;
 
     mutable PlainObject m_result;
 };
@@ -252,7 +239,7 @@ template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
 struct product_coeff_impl<DefaultTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
   {
     product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
     res += lhs.coeff(row, UnrollingIndex) * rhs.coeff(UnrollingIndex, col);
@@ -263,7 +250,7 @@ template<typename Lhs, typename Rhs, typename RetScalar>
 struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
   {
     res = lhs.coeff(row, 0) * rhs.coeff(0, col);
   }
@@ -273,7 +260,7 @@ template<typename Lhs, typename Rhs, typename RetScalar>
 struct product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
   {
     eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
     res = lhs.coeff(row, 0) * rhs.coeff(0, col);
@@ -291,7 +278,7 @@ struct product_coeff_vectorized_unroller
 {
   typedef typename Lhs::Index Index;
   enum { PacketSize = packet_traits<typename Lhs::Scalar>::size };
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
   {
     product_coeff_vectorized_unroller<UnrollingIndex-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
     pres = padd(pres, pmul( lhs.template packet<Aligned>(row, UnrollingIndex) , rhs.template packet<Aligned>(UnrollingIndex, col) ));
@@ -302,7 +289,7 @@ template<typename Lhs, typename Rhs, typename Packet>
 struct product_coeff_vectorized_unroller<0, Lhs, Rhs, Packet>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
   {
     pres = pmul(lhs.template packet<Aligned>(row, 0) , rhs.template packet<Aligned>(0, col));
   }
@@ -314,7 +301,7 @@ struct product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, Re
   typedef typename Lhs::PacketScalar Packet;
   typedef typename Lhs::Index Index;
   enum { PacketSize = packet_traits<typename Lhs::Scalar>::size };
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
   {
     Packet pres;
     product_coeff_vectorized_unroller<UnrollingIndex+1-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
@@ -327,7 +314,7 @@ template<typename Lhs, typename Rhs, int LhsRows = Lhs::RowsAtCompileTime, int R
 struct product_coeff_vectorized_dyn_selector
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
   {
     res = lhs.row(row).transpose().cwiseProduct(rhs.col(col)).sum();
   }
@@ -339,7 +326,7 @@ template<typename Lhs, typename Rhs, int RhsCols>
 struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,RhsCols>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index /*row*/, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
+  static EIGEN_STRONG_INLINE void run(Index /*row*/, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
   {
     res = lhs.transpose().cwiseProduct(rhs.col(col)).sum();
   }
@@ -349,7 +336,7 @@ template<typename Lhs, typename Rhs, int LhsRows>
 struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,LhsRows,1>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
   {
     res = lhs.row(row).transpose().cwiseProduct(rhs).sum();
   }
@@ -359,7 +346,7 @@ template<typename Lhs, typename Rhs>
 struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,1>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index /*row*/, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
+  static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
   {
     res = lhs.transpose().cwiseProduct(rhs).sum();
   }
@@ -369,7 +356,7 @@ template<typename Lhs, typename Rhs, typename RetScalar>
 struct product_coeff_impl<InnerVectorizedTraversal, Dynamic, Lhs, Rhs, RetScalar>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
   {
     product_coeff_vectorized_dyn_selector<Lhs,Rhs>::run(row, col, lhs, rhs, res);
   }
@@ -383,7 +370,7 @@ template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int Lo
 struct product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
   {
     product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
     res =  pmadd(pset1<Packet>(lhs.coeff(row, UnrollingIndex)), rhs.template packet<LoadMode>(UnrollingIndex, col), res);
@@ -394,7 +381,7 @@ template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int Lo
 struct product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
   {
     product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
     res =  pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex), pset1<Packet>(rhs.coeff(UnrollingIndex, col)), res);
@@ -405,7 +392,7 @@ template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
 struct product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
   {
     res = pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
   }
@@ -415,7 +402,7 @@ template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
 struct product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
   {
     res = pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
   }
@@ -425,7 +412,7 @@ template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
 struct product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
   {
     eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
     res = pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
@@ -438,7 +425,7 @@ template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
 struct product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
 {
   typedef typename Lhs::Index Index;
-  EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
+  static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
   {
     eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
     res = pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
@@ -449,4 +436,6 @@ struct product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_COEFFBASED_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h
index cd1c37c..5eb03c9 100644
--- a/extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -3,34 +3,23 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERAL_BLOCK_PANEL_H
 #define EIGEN_GENERAL_BLOCK_PANEL_H
 
+namespace Eigen { 
+  
 namespace internal {
 
 template<typename _LhsScalar, typename _RhsScalar, bool _ConjLhs=false, bool _ConjRhs=false>
 class gebp_traits;
 
-inline std::ptrdiff_t manage_caching_sizes_second_if_negative(std::ptrdiff_t a, std::ptrdiff_t b)
+
+/** \internal \returns b if a<=0, and returns a otherwise. */
+inline std::ptrdiff_t manage_caching_sizes_helper(std::ptrdiff_t a, std::ptrdiff_t b)
 {
   return a<=0 ? b : a;
 }
@@ -38,9 +27,14 @@ inline std::ptrdiff_t manage_caching_sizes_second_if_negative(std::ptrdiff_t a,
 /** \internal */
 inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1=0, std::ptrdiff_t* l2=0)
 {
-  static std::ptrdiff_t m_l1CacheSize = manage_caching_sizes_second_if_negative(queryL1CacheSize(),8 * 1024);
-  static std::ptrdiff_t m_l2CacheSize = manage_caching_sizes_second_if_negative(queryTopLevelCacheSize(),1*1024*1024);
-
+  static std::ptrdiff_t m_l1CacheSize = 0;
+  static std::ptrdiff_t m_l2CacheSize = 0;
+  if(m_l2CacheSize==0)
+  {
+    m_l1CacheSize = manage_caching_sizes_helper(queryL1CacheSize(),8 * 1024);
+    m_l2CacheSize = manage_caching_sizes_helper(queryTopLevelCacheSize(),1*1024*1024);
+  }
+  
   if(action==SetAction)
   {
     // set the cpu cache size and cache all block sizes from a global cache size in byte
@@ -533,7 +527,7 @@ struct gebp_kernel
     ResPacketSize = Traits::ResPacketSize
   };
 
-  EIGEN_FLATTEN_ATTRIB
+  EIGEN_DONT_INLINE EIGEN_FLATTEN_ATTRIB
   void operator()(ResScalar* res, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index rows, Index depth, Index cols, ResScalar alpha,
                   Index strideA=-1, Index strideB=-1, Index offsetA=0, Index offsetB=0, RhsScalar* unpackedB = 0)
   {
@@ -595,64 +589,64 @@ struct gebp_kernel
           if(nr==2)
           {
             LhsPacket A0, A1;
-            RhsPacket B0;
+            RhsPacket B_0;
             RhsPacket T0;
             
 EIGEN_ASM_COMMENT("mybegin2");
             traits.loadLhs(&blA[0*LhsProgress], A0);
             traits.loadLhs(&blA[1*LhsProgress], A1);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[1*RhsProgress], B0);
-            traits.madd(A0,B0,C1,T0);
-            traits.madd(A1,B0,C5,B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[1*RhsProgress], B_0);
+            traits.madd(A0,B_0,C1,T0);
+            traits.madd(A1,B_0,C5,B_0);
 
             traits.loadLhs(&blA[2*LhsProgress], A0);
             traits.loadLhs(&blA[3*LhsProgress], A1);
-            traits.loadRhs(&blB[2*RhsProgress], B0);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[3*RhsProgress], B0);
-            traits.madd(A0,B0,C1,T0);
-            traits.madd(A1,B0,C5,B0);
+            traits.loadRhs(&blB[2*RhsProgress], B_0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[3*RhsProgress], B_0);
+            traits.madd(A0,B_0,C1,T0);
+            traits.madd(A1,B_0,C5,B_0);
 
             traits.loadLhs(&blA[4*LhsProgress], A0);
             traits.loadLhs(&blA[5*LhsProgress], A1);
-            traits.loadRhs(&blB[4*RhsProgress], B0);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[5*RhsProgress], B0);
-            traits.madd(A0,B0,C1,T0);
-            traits.madd(A1,B0,C5,B0);
+            traits.loadRhs(&blB[4*RhsProgress], B_0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[5*RhsProgress], B_0);
+            traits.madd(A0,B_0,C1,T0);
+            traits.madd(A1,B_0,C5,B_0);
 
             traits.loadLhs(&blA[6*LhsProgress], A0);
             traits.loadLhs(&blA[7*LhsProgress], A1);
-            traits.loadRhs(&blB[6*RhsProgress], B0);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[7*RhsProgress], B0);
-            traits.madd(A0,B0,C1,T0);
-            traits.madd(A1,B0,C5,B0);
+            traits.loadRhs(&blB[6*RhsProgress], B_0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[7*RhsProgress], B_0);
+            traits.madd(A0,B_0,C1,T0);
+            traits.madd(A1,B_0,C5,B_0);
 EIGEN_ASM_COMMENT("myend");
           }
           else
           {
 EIGEN_ASM_COMMENT("mybegin4");
             LhsPacket A0, A1;
-            RhsPacket B0, B1, B2, B3;
+            RhsPacket B_0, B1, B2, B3;
             RhsPacket T0;
             
             traits.loadLhs(&blA[0*LhsProgress], A0);
             traits.loadLhs(&blA[1*LhsProgress], A1);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
 
-            traits.madd(A0,B0,C0,T0);
+            traits.madd(A0,B_0,C0,T0);
             traits.loadRhs(&blB[2*RhsProgress], B2);
-            traits.madd(A1,B0,C4,B0);
+            traits.madd(A1,B_0,C4,B_0);
             traits.loadRhs(&blB[3*RhsProgress], B3);
-            traits.loadRhs(&blB[4*RhsProgress], B0);
+            traits.loadRhs(&blB[4*RhsProgress], B_0);
             traits.madd(A0,B1,C1,T0);
             traits.madd(A1,B1,C5,B1);
             traits.loadRhs(&blB[5*RhsProgress], B1);
@@ -664,9 +658,9 @@ EIGEN_ASM_COMMENT("mybegin4");
             traits.madd(A1,B3,C7,B3);
             traits.loadLhs(&blA[3*LhsProgress], A1);
             traits.loadRhs(&blB[7*RhsProgress], B3);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[8*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[8*RhsProgress], B_0);
             traits.madd(A0,B1,C1,T0);
             traits.madd(A1,B1,C5,B1);
             traits.loadRhs(&blB[9*RhsProgress], B1);
@@ -679,9 +673,9 @@ EIGEN_ASM_COMMENT("mybegin4");
             traits.loadLhs(&blA[5*LhsProgress], A1);
             traits.loadRhs(&blB[11*RhsProgress], B3);
 
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[12*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[12*RhsProgress], B_0);
             traits.madd(A0,B1,C1,T0);
             traits.madd(A1,B1,C5,B1);
             traits.loadRhs(&blB[13*RhsProgress], B1);
@@ -693,8 +687,8 @@ EIGEN_ASM_COMMENT("mybegin4");
             traits.madd(A1,B3,C7,B3);
             traits.loadLhs(&blA[7*LhsProgress], A1);
             traits.loadRhs(&blB[15*RhsProgress], B3);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
             traits.madd(A0,B1,C1,T0);
             traits.madd(A1,B1,C5,B1);
             traits.madd(A0,B2,C2,T0);
@@ -712,32 +706,32 @@ EIGEN_ASM_COMMENT("mybegin4");
           if(nr==2)
           {
             LhsPacket A0, A1;
-            RhsPacket B0;
+            RhsPacket B_0;
             RhsPacket T0;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
             traits.loadLhs(&blA[1*LhsProgress], A1);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
-            traits.madd(A0,B0,C0,T0);
-            traits.madd(A1,B0,C4,B0);
-            traits.loadRhs(&blB[1*RhsProgress], B0);
-            traits.madd(A0,B0,C1,T0);
-            traits.madd(A1,B0,C5,B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
+            traits.madd(A0,B_0,C0,T0);
+            traits.madd(A1,B_0,C4,B_0);
+            traits.loadRhs(&blB[1*RhsProgress], B_0);
+            traits.madd(A0,B_0,C1,T0);
+            traits.madd(A1,B_0,C5,B_0);
           }
           else
           {
             LhsPacket A0, A1;
-            RhsPacket B0, B1, B2, B3;
+            RhsPacket B_0, B1, B2, B3;
             RhsPacket T0;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
             traits.loadLhs(&blA[1*LhsProgress], A1);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
 
-            traits.madd(A0,B0,C0,T0);
+            traits.madd(A0,B_0,C0,T0);
             traits.loadRhs(&blB[2*RhsProgress], B2);
-            traits.madd(A1,B0,C4,B0);
+            traits.madd(A1,B_0,C4,B_0);
             traits.loadRhs(&blB[3*RhsProgress], B3);
             traits.madd(A0,B1,C1,T0);
             traits.madd(A1,B1,C5,B1);
@@ -824,42 +818,42 @@ EIGEN_ASM_COMMENT("mybegin4");
           if(nr==2)
           {
             LhsPacket A0;
-            RhsPacket B0, B1;
+            RhsPacket B_0, B1;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
-            traits.madd(A0,B0,C0,B0);
-            traits.loadRhs(&blB[2*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,B_0);
+            traits.loadRhs(&blB[2*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadLhs(&blA[1*LhsProgress], A0);
             traits.loadRhs(&blB[3*RhsProgress], B1);
-            traits.madd(A0,B0,C0,B0);
-            traits.loadRhs(&blB[4*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,B_0);
+            traits.loadRhs(&blB[4*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadLhs(&blA[2*LhsProgress], A0);
             traits.loadRhs(&blB[5*RhsProgress], B1);
-            traits.madd(A0,B0,C0,B0);
-            traits.loadRhs(&blB[6*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,B_0);
+            traits.loadRhs(&blB[6*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadLhs(&blA[3*LhsProgress], A0);
             traits.loadRhs(&blB[7*RhsProgress], B1);
-            traits.madd(A0,B0,C0,B0);
+            traits.madd(A0,B_0,C0,B_0);
             traits.madd(A0,B1,C1,B1);
           }
           else
           {
             LhsPacket A0;
-            RhsPacket B0, B1, B2, B3;
+            RhsPacket B_0, B1, B2, B3;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
 
-            traits.madd(A0,B0,C0,B0);
+            traits.madd(A0,B_0,C0,B_0);
             traits.loadRhs(&blB[2*RhsProgress], B2);
             traits.loadRhs(&blB[3*RhsProgress], B3);
-            traits.loadRhs(&blB[4*RhsProgress], B0);
+            traits.loadRhs(&blB[4*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadRhs(&blB[5*RhsProgress], B1);
             traits.madd(A0,B2,C2,B2);
@@ -867,8 +861,8 @@ EIGEN_ASM_COMMENT("mybegin4");
             traits.madd(A0,B3,C3,B3);
             traits.loadLhs(&blA[1*LhsProgress], A0);
             traits.loadRhs(&blB[7*RhsProgress], B3);
-            traits.madd(A0,B0,C0,B0);
-            traits.loadRhs(&blB[8*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,B_0);
+            traits.loadRhs(&blB[8*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadRhs(&blB[9*RhsProgress], B1);
             traits.madd(A0,B2,C2,B2);
@@ -877,8 +871,8 @@ EIGEN_ASM_COMMENT("mybegin4");
             traits.loadLhs(&blA[2*LhsProgress], A0);
             traits.loadRhs(&blB[11*RhsProgress], B3);
 
-            traits.madd(A0,B0,C0,B0);
-            traits.loadRhs(&blB[12*RhsProgress], B0);
+            traits.madd(A0,B_0,C0,B_0);
+            traits.loadRhs(&blB[12*RhsProgress], B_0);
             traits.madd(A0,B1,C1,B1);
             traits.loadRhs(&blB[13*RhsProgress], B1);
             traits.madd(A0,B2,C2,B2);
@@ -887,7 +881,7 @@ EIGEN_ASM_COMMENT("mybegin4");
 
             traits.loadLhs(&blA[3*LhsProgress], A0);
             traits.loadRhs(&blB[15*RhsProgress], B3);
-            traits.madd(A0,B0,C0,B0);
+            traits.madd(A0,B_0,C0,B_0);
             traits.madd(A0,B1,C1,B1);
             traits.madd(A0,B2,C2,B2);
             traits.madd(A0,B3,C3,B3);
@@ -902,26 +896,26 @@ EIGEN_ASM_COMMENT("mybegin4");
           if(nr==2)
           {
             LhsPacket A0;
-            RhsPacket B0, B1;
+            RhsPacket B_0, B1;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
-            traits.madd(A0,B0,C0,B0);
+            traits.madd(A0,B_0,C0,B_0);
             traits.madd(A0,B1,C1,B1);
           }
           else
           {
             LhsPacket A0;
-            RhsPacket B0, B1, B2, B3;
+            RhsPacket B_0, B1, B2, B3;
 
             traits.loadLhs(&blA[0*LhsProgress], A0);
-            traits.loadRhs(&blB[0*RhsProgress], B0);
+            traits.loadRhs(&blB[0*RhsProgress], B_0);
             traits.loadRhs(&blB[1*RhsProgress], B1);
             traits.loadRhs(&blB[2*RhsProgress], B2);
             traits.loadRhs(&blB[3*RhsProgress], B3);
 
-            traits.madd(A0,B0,C0,B0);
+            traits.madd(A0,B_0,C0,B_0);
             traits.madd(A0,B1,C1,B1);
             traits.madd(A0,B2,C2,B2);
             traits.madd(A0,B3,C3,B3);
@@ -968,26 +962,26 @@ EIGEN_ASM_COMMENT("mybegin4");
           if(nr==2)
           {
             LhsScalar A0;
-            RhsScalar B0, B1;
+            RhsScalar B_0, B1;
 
             A0 = blA[k];
-            B0 = blB[0];
+            B_0 = blB[0];
             B1 = blB[1];
-            MADD(cj,A0,B0,C0,B0);
+            MADD(cj,A0,B_0,C0,B_0);
             MADD(cj,A0,B1,C1,B1);
           }
           else
           {
             LhsScalar A0;
-            RhsScalar B0, B1, B2, B3;
+            RhsScalar B_0, B1, B2, B3;
 
             A0 = blA[k];
-            B0 = blB[0];
+            B_0 = blB[0];
             B1 = blB[1];
             B2 = blB[2];
             B3 = blB[3];
 
-            MADD(cj,A0,B0,C0,B0);
+            MADD(cj,A0,B_0,C0,B_0);
             MADD(cj,A0,B1,C1,B1);
             MADD(cj,A0,B2,C2,B2);
             MADD(cj,A0,B3,C3,B3);
@@ -1024,14 +1018,14 @@ EIGEN_ASM_COMMENT("mybegin4");
         for(Index k=0; k<depth; k++)
         {
           LhsPacket A0, A1;
-          RhsPacket B0;
+          RhsPacket B_0;
           RhsPacket T0;
 
           traits.loadLhs(&blA[0*LhsProgress], A0);
           traits.loadLhs(&blA[1*LhsProgress], A1);
-          traits.loadRhs(&blB[0*RhsProgress], B0);
-          traits.madd(A0,B0,C0,T0);
-          traits.madd(A1,B0,C4,B0);
+          traits.loadRhs(&blB[0*RhsProgress], B_0);
+          traits.madd(A0,B_0,C0,T0);
+          traits.madd(A1,B_0,C4,B_0);
 
           blB += RhsProgress;
           blA += 2*LhsProgress;
@@ -1063,10 +1057,10 @@ EIGEN_ASM_COMMENT("mybegin4");
         for(Index k=0; k<depth; k++)
         {
           LhsPacket A0;
-          RhsPacket B0;
+          RhsPacket B_0;
           traits.loadLhs(blA, A0);
-          traits.loadRhs(blB, B0);
-          traits.madd(A0, B0, C0, B0);
+          traits.loadRhs(blB, B_0);
+          traits.madd(A0, B_0, C0, B_0);
           blB += RhsProgress;
           blA += LhsProgress;
         }
@@ -1088,8 +1082,8 @@ EIGEN_ASM_COMMENT("mybegin4");
         for(Index k=0; k<depth; k++)
         {
           LhsScalar A0 = blA[k];
-          RhsScalar B0 = blB[k];
-          MADD(cj, A0, B0, C0, B0);
+          RhsScalar B_0 = blB[k];
+          MADD(cj, A0, B_0, C0, B_0);
         }
         res[(j2+0)*resStride + i] += alpha*C0;
       }
@@ -1100,7 +1094,7 @@ EIGEN_ASM_COMMENT("mybegin4");
 #undef CJMADD
 
 // pack a block of the lhs
-// The travesal is as follow (mr==4):
+// The traversal is as follow (mr==4):
 //   0  4  8 12 ...
 //   1  5  9 13 ...
 //   2  6 10 14 ...
@@ -1116,11 +1110,15 @@ EIGEN_ASM_COMMENT("mybegin4");
 template<typename Scalar, typename Index, int Pack1, int Pack2, int StorageOrder, bool Conjugate, bool PanelMode>
 struct gemm_pack_lhs
 {
-  void operator()(Scalar* blockA, const Scalar* EIGEN_RESTRICT _lhs, Index lhsStride, Index depth, Index rows,
+  EIGEN_DONT_INLINE void operator()(Scalar* blockA, const Scalar* EIGEN_RESTRICT _lhs, Index lhsStride, Index depth, Index rows,
                   Index stride=0, Index offset=0)
   {
-//     enum { PacketSize = packet_traits<Scalar>::size };
+    typedef typename packet_traits<Scalar>::type Packet;
+    enum { PacketSize = packet_traits<Scalar>::size };
+
+    EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK LHS");
     eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
+    eigen_assert( (StorageOrder==RowMajor) || ((Pack1%PacketSize)==0 && Pack1<=4*PacketSize) );
     conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
     const_blas_data_mapper<Scalar, Index, StorageOrder> lhs(_lhs,lhsStride);
     Index count = 0;
@@ -1128,9 +1126,44 @@ struct gemm_pack_lhs
     for(Index i=0; i<peeled_mc; i+=Pack1)
     {
       if(PanelMode) count += Pack1 * offset;
-      for(Index k=0; k<depth; k++)
-        for(Index w=0; w<Pack1; w++)
-          blockA[count++] = cj(lhs(i+w, k));
+
+      if(StorageOrder==ColMajor)
+      {
+        for(Index k=0; k<depth; k++)
+        {
+          Packet A, B, C, D;
+          if(Pack1>=1*PacketSize) A = ploadu<Packet>(&lhs(i+0*PacketSize, k));
+          if(Pack1>=2*PacketSize) B = ploadu<Packet>(&lhs(i+1*PacketSize, k));
+          if(Pack1>=3*PacketSize) C = ploadu<Packet>(&lhs(i+2*PacketSize, k));
+          if(Pack1>=4*PacketSize) D = ploadu<Packet>(&lhs(i+3*PacketSize, k));
+          if(Pack1>=1*PacketSize) { pstore(blockA+count, cj.pconj(A)); count+=PacketSize; }
+          if(Pack1>=2*PacketSize) { pstore(blockA+count, cj.pconj(B)); count+=PacketSize; }
+          if(Pack1>=3*PacketSize) { pstore(blockA+count, cj.pconj(C)); count+=PacketSize; }
+          if(Pack1>=4*PacketSize) { pstore(blockA+count, cj.pconj(D)); count+=PacketSize; }
+        }
+      }
+      else
+      {
+        for(Index k=0; k<depth; k++)
+        {
+          // TODO add a vectorized transpose here
+          Index w=0;
+          for(; w<Pack1-3; w+=4)
+          {
+            Scalar a(cj(lhs(i+w+0, k))),
+                   b(cj(lhs(i+w+1, k))),
+                   c(cj(lhs(i+w+2, k))),
+                   d(cj(lhs(i+w+3, k)));
+            blockA[count++] = a;
+            blockA[count++] = b;
+            blockA[count++] = c;
+            blockA[count++] = d;
+          }
+          if(Pack1%4)
+            for(;w<Pack1;++w)
+              blockA[count++] = cj(lhs(i+w, k));
+        }
+      }
       if(PanelMode) count += Pack1 * (stride-offset-depth);
     }
     if(rows-peeled_mc>=Pack2)
@@ -1164,9 +1197,10 @@ struct gemm_pack_rhs<Scalar, Index, nr, ColMajor, Conjugate, PanelMode>
 {
   typedef typename packet_traits<Scalar>::type Packet;
   enum { PacketSize = packet_traits<Scalar>::size };
-  void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
+  EIGEN_DONT_INLINE void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
                   Index stride=0, Index offset=0)
   {
+    EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK RHS COLMAJOR");
     eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
     conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
     Index packet_cols = (cols/nr) * nr;
@@ -1211,9 +1245,10 @@ template<typename Scalar, typename Index, int nr, bool Conjugate, bool PanelMode
 struct gemm_pack_rhs<Scalar, Index, nr, RowMajor, Conjugate, PanelMode>
 {
   enum { PacketSize = packet_traits<Scalar>::size };
-  void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
+  EIGEN_DONT_INLINE void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
                   Index stride=0, Index offset=0)
   {
+    EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK RHS ROWMAJOR");
     eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
     conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
     Index packet_cols = (cols/nr) * nr;
@@ -1279,4 +1314,6 @@ inline void setCpuCacheSizes(std::ptrdiff_t l1, std::ptrdiff_t l2)
   internal::manage_caching_sizes(SetAction, &l1, &l2);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERAL_BLOCK_PANEL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h
index ae94a27..73a465e 100644
--- a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERAL_MATRIX_MATRIX_H
 #define EIGEN_GENERAL_MATRIX_MATRIX_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename _LhsScalar, typename _RhsScalar> class level3_blocking;
@@ -77,7 +64,7 @@ static void run(Index rows, Index cols, Index depth,
 
   typedef gebp_traits<LhsScalar,RhsScalar> Traits;
 
-  Index kc = blocking.kc();                 // cache block size along the K direction
+  Index kc = blocking.kc();                   // cache block size along the K direction
   Index mc = (std::min)(rows,blocking.mc());  // cache block size along the M direction
   //Index nc = blocking.nc(); // cache block size along the N direction
 
@@ -247,7 +234,7 @@ struct gemm_functor
     BlockingType& m_blocking;
 };
 
-template<int StorageOrder, typename LhsScalar, typename RhsScalar, int MaxRows, int MaxCols, int MaxDepth,
+template<int StorageOrder, typename LhsScalar, typename RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor=1,
 bool FiniteAtCompileTime = MaxRows!=Dynamic && MaxCols!=Dynamic && MaxDepth != Dynamic> class gemm_blocking_space;
 
 template<typename _LhsScalar, typename _RhsScalar>
@@ -280,8 +267,8 @@ class level3_blocking
     inline RhsScalar* blockW() { return m_blockW; }
 };
 
-template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth>
-class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, true>
+template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor>
+class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, KcFactor, true>
   : public level3_blocking<
       typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
       typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
@@ -322,8 +309,8 @@ class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, M
     inline void allocateAll() {}
 };
 
-template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth>
-class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, false>
+template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor>
+class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, KcFactor, false>
   : public level3_blocking<
       typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
       typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
@@ -347,7 +334,7 @@ class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, M
       this->m_nc = Transpose ? rows : cols;
       this->m_kc = depth;
 
-      computeProductBlockingSizes<LhsScalar,RhsScalar>(this->m_kc, this->m_mc, this->m_nc);
+      computeProductBlockingSizes<LhsScalar,RhsScalar,KcFactor>(this->m_kc, this->m_mc, this->m_nc);
       m_sizeA = this->m_mc * this->m_kc;
       m_sizeB = this->m_kc * this->m_nc;
       m_sizeW = this->m_kc*Traits::WorkSpaceFactor;
@@ -412,8 +399,8 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
     {
       eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
 
-      const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
-      const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
+      typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
+      typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
 
       Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
                                  * RhsBlasTraits::extractScalarFactor(m_rhs);
@@ -436,4 +423,6 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
     }
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERAL_MATRIX_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
index 5043b64..432d3a9 100644
--- a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
 #define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /**********************************************************************
@@ -42,14 +29,14 @@ struct tribb_kernel;
 template <typename Index,
           typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
           typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs,
-                              int ResStorageOrder, int  UpLo>
+                              int ResStorageOrder, int  UpLo, int Version = Specialized>
 struct general_matrix_matrix_triangular_product;
 
 // as usual if the result is row major => we transpose the product
 template <typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
-                          typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int  UpLo>
-struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor,UpLo>
-{  
+                          typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int  UpLo, int Version>
+struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor,UpLo,Version>
+{
   typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
   static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* lhs, Index lhsStride,
                                       const RhsScalar* rhs, Index rhsStride, ResScalar* res, Index resStride, ResScalar alpha)
@@ -63,8 +50,8 @@ struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,
 };
 
 template <typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
-                          typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int  UpLo>
-struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor,UpLo>
+                          typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int  UpLo, int Version>
+struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor,UpLo,Version>
 {
   typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
   static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* _lhs, Index lhsStride,
@@ -201,13 +188,13 @@ TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::assignProduct(
   typedef internal::blas_traits<Lhs> LhsBlasTraits;
   typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
   typedef typename internal::remove_all<ActualLhs>::type _ActualLhs;
-  const ActualLhs actualLhs = LhsBlasTraits::extract(prod.lhs());
+  typename internal::add_const_on_value_type<ActualLhs>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
   
   typedef typename internal::remove_all<typename ProductDerived::RhsNested>::type Rhs;
   typedef internal::blas_traits<Rhs> RhsBlasTraits;
   typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
   typedef typename internal::remove_all<ActualRhs>::type _ActualRhs;
-  const ActualRhs actualRhs = RhsBlasTraits::extract(prod.rhs());
+  typename internal::add_const_on_value_type<ActualRhs>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
 
   typename ProductDerived::Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());
 
@@ -222,4 +209,6 @@ TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::assignProduct(
   return *this;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h
new file mode 100644
index 0000000..3deed06
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h
@@ -0,0 +1,146 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Level 3 BLAS SYRK/HERK implementation.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_MKL_H
+#define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template <typename Index, typename Scalar, int AStorageOrder, bool ConjugateA, int ResStorageOrder, int  UpLo>
+struct general_matrix_matrix_rankupdate :
+       general_matrix_matrix_triangular_product<
+         Index,Scalar,AStorageOrder,ConjugateA,Scalar,AStorageOrder,ConjugateA,ResStorageOrder,UpLo,BuiltIn> {};
+
+
+// try to go to BLAS specialization
+#define EIGEN_MKL_RANKUPDATE_SPECIALIZE(Scalar) \
+template <typename Index, int LhsStorageOrder, bool ConjugateLhs, \
+                          int RhsStorageOrder, bool ConjugateRhs, int  UpLo> \
+struct general_matrix_matrix_triangular_product<Index,Scalar,LhsStorageOrder,ConjugateLhs, \
+               Scalar,RhsStorageOrder,ConjugateRhs,ColMajor,UpLo,Specialized> { \
+  static EIGEN_STRONG_INLINE void run(Index size, Index depth,const Scalar* lhs, Index lhsStride, \
+                          const Scalar* rhs, Index rhsStride, Scalar* res, Index resStride, Scalar alpha) \
+  { \
+    if (lhs==rhs) { \
+      general_matrix_matrix_rankupdate<Index,Scalar,LhsStorageOrder,ConjugateLhs,ColMajor,UpLo> \
+      ::run(size,depth,lhs,lhsStride,rhs,rhsStride,res,resStride,alpha); \
+    } else { \
+      general_matrix_matrix_triangular_product<Index, \
+        Scalar, LhsStorageOrder, ConjugateLhs, \
+        Scalar, RhsStorageOrder, ConjugateRhs, \
+        ColMajor, UpLo, BuiltIn> \
+      ::run(size,depth,lhs,lhsStride,rhs,rhsStride,res,resStride,alpha); \
+    } \
+  } \
+};
+
+EIGEN_MKL_RANKUPDATE_SPECIALIZE(double)
+//EIGEN_MKL_RANKUPDATE_SPECIALIZE(dcomplex)
+EIGEN_MKL_RANKUPDATE_SPECIALIZE(float)
+//EIGEN_MKL_RANKUPDATE_SPECIALIZE(scomplex)
+
+// SYRK for float/double
+#define EIGEN_MKL_RANKUPDATE_R(EIGTYPE, MKLTYPE, MKLFUNC) \
+template <typename Index, int AStorageOrder, bool ConjugateA, int  UpLo> \
+struct general_matrix_matrix_rankupdate<Index,EIGTYPE,AStorageOrder,ConjugateA,ColMajor,UpLo> { \
+  enum { \
+    IsLower = (UpLo&Lower) == Lower, \
+    LowUp = IsLower ? Lower : Upper, \
+    conjA = ((AStorageOrder==ColMajor) && ConjugateA) ? 1 : 0 \
+  }; \
+  static EIGEN_STRONG_INLINE void run(Index size, Index depth,const EIGTYPE* lhs, Index lhsStride, \
+                          const EIGTYPE* rhs, Index rhsStride, EIGTYPE* res, Index resStride, EIGTYPE alpha) \
+  { \
+  /* typedef Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> MatrixRhs;*/ \
+\
+   MKL_INT lda=lhsStride, ldc=resStride, n=size, k=depth; \
+   char uplo=(IsLower) ? 'L' : 'U', trans=(AStorageOrder==RowMajor) ? 'T':'N'; \
+   MKLTYPE alpha_, beta_; \
+\
+/* Set alpha_ & beta_ */ \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(beta_, EIGTYPE(1)); \
+   MKLFUNC(&uplo, &trans, &n, &k, &alpha_, lhs, &lda, &beta_, res, &ldc); \
+  } \
+};
+
+// HERK for complex data
+#define EIGEN_MKL_RANKUPDATE_C(EIGTYPE, MKLTYPE, RTYPE, MKLFUNC) \
+template <typename Index, int AStorageOrder, bool ConjugateA, int  UpLo> \
+struct general_matrix_matrix_rankupdate<Index,EIGTYPE,AStorageOrder,ConjugateA,ColMajor,UpLo> { \
+  enum { \
+    IsLower = (UpLo&Lower) == Lower, \
+    LowUp = IsLower ? Lower : Upper, \
+    conjA = (((AStorageOrder==ColMajor) && ConjugateA) || ((AStorageOrder==RowMajor) && !ConjugateA)) ? 1 : 0 \
+  }; \
+  static EIGEN_STRONG_INLINE void run(Index size, Index depth,const EIGTYPE* lhs, Index lhsStride, \
+                          const EIGTYPE* rhs, Index rhsStride, EIGTYPE* res, Index resStride, EIGTYPE alpha) \
+  { \
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, AStorageOrder> MatrixType; \
+\
+   MKL_INT lda=lhsStride, ldc=resStride, n=size, k=depth; \
+   char uplo=(IsLower) ? 'L' : 'U', trans=(AStorageOrder==RowMajor) ? 'C':'N'; \
+   RTYPE alpha_, beta_; \
+   const EIGTYPE* a_ptr; \
+\
+/* Set alpha_ & beta_ */ \
+/*   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); */\
+/*   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(beta_, EIGTYPE(1));*/ \
+   alpha_ = alpha.real(); \
+   beta_ = 1.0; \
+/* Copy with conjugation in some cases*/ \
+   MatrixType a; \
+   if (conjA) { \
+     Map<const MatrixType, 0, OuterStride<> > mapA(lhs,n,k,OuterStride<>(lhsStride)); \
+     a = mapA.conjugate(); \
+     lda = a.outerStride(); \
+     a_ptr = a.data(); \
+   } else a_ptr=lhs; \
+   MKLFUNC(&uplo, &trans, &n, &k, &alpha_, (MKLTYPE*)a_ptr, &lda, &beta_, (MKLTYPE*)res, &ldc); \
+  } \
+};
+
+
+EIGEN_MKL_RANKUPDATE_R(double, double, dsyrk)
+EIGEN_MKL_RANKUPDATE_R(float,  float,  ssyrk)
+
+//EIGEN_MKL_RANKUPDATE_C(dcomplex, MKL_Complex16, double, zherk)
+//EIGEN_MKL_RANKUPDATE_C(scomplex, MKL_Complex8,  double, cherk)
+
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h
new file mode 100644
index 0000000..060af32
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h
@@ -0,0 +1,118 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   General matrix-matrix product functionality based on ?GEMM.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_GENERAL_MATRIX_MATRIX_MKL_H
+#define EIGEN_GENERAL_MATRIX_MATRIX_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/**********************************************************************
+* This file implements general matrix-matrix multiplication using BLAS
+* gemm function via partial specialization of
+* general_matrix_matrix_product::run(..) method for float, double,
+* std::complex<float> and std::complex<double> types
+**********************************************************************/
+
+// gemm specialization
+
+#define GEMM_SPECIALIZATION(EIGTYPE, EIGPREFIX, MKLTYPE, MKLPREFIX) \
+template< \
+  typename Index, \
+  int LhsStorageOrder, bool ConjugateLhs, \
+  int RhsStorageOrder, bool ConjugateRhs> \
+struct general_matrix_matrix_product<Index,EIGTYPE,LhsStorageOrder,ConjugateLhs,EIGTYPE,RhsStorageOrder,ConjugateRhs,ColMajor> \
+{ \
+static void run(Index rows, Index cols, Index depth, \
+  const EIGTYPE* _lhs, Index lhsStride, \
+  const EIGTYPE* _rhs, Index rhsStride, \
+  EIGTYPE* res, Index resStride, \
+  EIGTYPE alpha, \
+  level3_blocking<EIGTYPE, EIGTYPE>& /*blocking*/, \
+  GemmParallelInfo<Index>* /*info = 0*/) \
+{ \
+  using std::conj; \
+\
+  char transa, transb; \
+  MKL_INT m, n, k, lda, ldb, ldc; \
+  const EIGTYPE *a, *b; \
+  MKLTYPE alpha_, beta_; \
+  MatrixX##EIGPREFIX a_tmp, b_tmp; \
+  EIGTYPE myone(1);\
+\
+/* Set transpose options */ \
+  transa = (LhsStorageOrder==RowMajor) ? ((ConjugateLhs) ? 'C' : 'T') : 'N'; \
+  transb = (RhsStorageOrder==RowMajor) ? ((ConjugateRhs) ? 'C' : 'T') : 'N'; \
+\
+/* Set m, n, k */ \
+  m = (MKL_INT)rows;  \
+  n = (MKL_INT)cols;  \
+  k = (MKL_INT)depth; \
+\
+/* Set alpha_ & beta_ */ \
+  assign_scalar_eig2mkl(alpha_, alpha); \
+  assign_scalar_eig2mkl(beta_, myone); \
+\
+/* Set lda, ldb, ldc */ \
+  lda = (MKL_INT)lhsStride; \
+  ldb = (MKL_INT)rhsStride; \
+  ldc = (MKL_INT)resStride; \
+\
+/* Set a, b, c */ \
+  if ((LhsStorageOrder==ColMajor) && (ConjugateLhs)) { \
+    Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,m,k,OuterStride<>(lhsStride)); \
+    a_tmp = lhs.conjugate(); \
+    a = a_tmp.data(); \
+    lda = a_tmp.outerStride(); \
+  } else a = _lhs; \
+\
+  if ((RhsStorageOrder==ColMajor) && (ConjugateRhs)) { \
+    Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,k,n,OuterStride<>(rhsStride)); \
+    b_tmp = rhs.conjugate(); \
+    b = b_tmp.data(); \
+    ldb = b_tmp.outerStride(); \
+  } else b = _rhs; \
+\
+  MKLPREFIX##gemm(&transa, &transb, &m, &n, &k, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \
+}};
+
+GEMM_SPECIALIZATION(double,   d,  double,        d)
+GEMM_SPECIALIZATION(float,    f,  float,         s)
+GEMM_SPECIALIZATION(dcomplex, cd, MKL_Complex16, z)
+GEMM_SPECIALIZATION(scomplex, cf, MKL_Complex8,  c)
+
+} // end namespase internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_GENERAL_MATRIX_MATRIX_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h
index e0e2cbf..ba1f739 100644
--- a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERAL_MATRIX_VECTOR_H
 #define EIGEN_GENERAL_MATRIX_VECTOR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /* Optimized col-major matrix * vector product:
@@ -40,8 +27,8 @@ namespace internal {
  *  |cplx |real |cplx | invalid, the caller has to do tmp: = A * B; C += alpha*tmp
  *  |cplx |real |real | optimal case, vectorization possible via real-cplx mul
  */
-template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
-struct general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
+template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs, int Version>
+struct general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjugateLhs,RhsScalar,ConjugateRhs,Version>
 {
 typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
 
@@ -99,7 +86,7 @@ EIGEN_DONT_INLINE static void run(
   
   // How many coeffs of the result do we have to skip to be aligned.
   // Here we assume data are at least aligned on the base scalar type.
-  Index alignedStart = first_aligned(res,size);
+  Index alignedStart = internal::first_aligned(res,size);
   Index alignedSize = ResPacketSize>1 ? alignedStart + ((size-alignedStart) & ~ResPacketAlignedMask) : 0;
   const Index peeledSize  = peels>1 ? alignedStart + ((alignedSize-alignedStart) & ~PeelAlignedMask) : alignedStart;
 
@@ -109,7 +96,7 @@ EIGEN_DONT_INLINE static void run(
                        : FirstAligned;
 
   // we cannot assume the first element is aligned because of sub-matrices
-  const Index lhsAlignmentOffset = first_aligned(lhs,size);
+  const Index lhsAlignmentOffset = internal::first_aligned(lhs,size);
 
   // find how many columns do we have to skip to be aligned with the result (if possible)
   Index skipColumns = 0;
@@ -296,8 +283,8 @@ EIGEN_DONT_INLINE static void run(
  *  - alpha is always a complex (or converted to a complex)
  *  - no vectorization
  */
-template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
-struct general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
+template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs, int Version>
+struct general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjugateLhs,RhsScalar,ConjugateRhs,Version>
 {
 typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
 
@@ -351,7 +338,7 @@ EIGEN_DONT_INLINE static void run(
   // How many coeffs of the result do we have to skip to be aligned.
   // Here we assume data are at least aligned on the base scalar type
   // if that's not the case then vectorization is discarded, see below.
-  Index alignedStart = first_aligned(rhs, depth);
+  Index alignedStart = internal::first_aligned(rhs, depth);
   Index alignedSize = RhsPacketSize>1 ? alignedStart + ((depth-alignedStart) & ~RhsPacketAlignedMask) : 0;
   const Index peeledSize  = peels>1 ? alignedStart + ((alignedSize-alignedStart) & ~PeelAlignedMask) : alignedStart;
 
@@ -361,7 +348,7 @@ EIGEN_DONT_INLINE static void run(
                          : FirstAligned;
 
   // we cannot assume the first element is aligned because of sub-matrices
-  const Index lhsAlignmentOffset = first_aligned(lhs,depth);
+  const Index lhsAlignmentOffset = internal::first_aligned(lhs,depth);
 
   // find how many rows do we have to skip to be aligned with rhs (if possible)
   Index skipRows = 0;
@@ -556,4 +543,6 @@ EIGEN_DONT_INLINE static void run(
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERAL_MATRIX_VECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h
new file mode 100644
index 0000000..e9de6af
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h
@@ -0,0 +1,131 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   General matrix-vector product functionality based on ?GEMV.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_GENERAL_MATRIX_VECTOR_MKL_H
+#define EIGEN_GENERAL_MATRIX_VECTOR_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/**********************************************************************
+* This file implements general matrix-vector multiplication using BLAS
+* gemv function via partial specialization of
+* general_matrix_vector_product::run(..) method for float, double,
+* std::complex<float> and std::complex<double> types
+**********************************************************************/
+
+// gemv specialization
+
+template<typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
+struct general_matrix_vector_product_gemv :
+  general_matrix_vector_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,ConjugateRhs,BuiltIn> {};
+
+#define EIGEN_MKL_GEMV_SPECIALIZE(Scalar) \
+template<typename Index, bool ConjugateLhs, bool ConjugateRhs> \
+struct general_matrix_vector_product<Index,Scalar,ColMajor,ConjugateLhs,Scalar,ConjugateRhs,Specialized> { \
+static EIGEN_DONT_INLINE void run( \
+  Index rows, Index cols, \
+  const Scalar* lhs, Index lhsStride, \
+  const Scalar* rhs, Index rhsIncr, \
+  Scalar* res, Index resIncr, Scalar alpha) \
+{ \
+  if (ConjugateLhs) { \
+    general_matrix_vector_product<Index,Scalar,ColMajor,ConjugateLhs,Scalar,ConjugateRhs,BuiltIn>::run( \
+      rows, cols, lhs, lhsStride, rhs, rhsIncr, res, resIncr, alpha); \
+  } else { \
+    general_matrix_vector_product_gemv<Index,Scalar,ColMajor,ConjugateLhs,Scalar,ConjugateRhs>::run( \
+      rows, cols, lhs, lhsStride, rhs, rhsIncr, res, resIncr, alpha); \
+  } \
+} \
+}; \
+template<typename Index, bool ConjugateLhs, bool ConjugateRhs> \
+struct general_matrix_vector_product<Index,Scalar,RowMajor,ConjugateLhs,Scalar,ConjugateRhs,Specialized> { \
+static EIGEN_DONT_INLINE void run( \
+  Index rows, Index cols, \
+  const Scalar* lhs, Index lhsStride, \
+  const Scalar* rhs, Index rhsIncr, \
+  Scalar* res, Index resIncr, Scalar alpha) \
+{ \
+    general_matrix_vector_product_gemv<Index,Scalar,RowMajor,ConjugateLhs,Scalar,ConjugateRhs>::run( \
+      rows, cols, lhs, lhsStride, rhs, rhsIncr, res, resIncr, alpha); \
+} \
+}; \
+
+EIGEN_MKL_GEMV_SPECIALIZE(double)
+EIGEN_MKL_GEMV_SPECIALIZE(float)
+EIGEN_MKL_GEMV_SPECIALIZE(dcomplex)
+EIGEN_MKL_GEMV_SPECIALIZE(scomplex)
+
+#define EIGEN_MKL_GEMV_SPECIALIZATION(EIGTYPE,MKLTYPE,MKLPREFIX) \
+template<typename Index, int LhsStorageOrder, bool ConjugateLhs, bool ConjugateRhs> \
+struct general_matrix_vector_product_gemv<Index,EIGTYPE,LhsStorageOrder,ConjugateLhs,EIGTYPE,ConjugateRhs> \
+{ \
+typedef Matrix<EIGTYPE,Dynamic,1,ColMajor> GEMVVector;\
+\
+static EIGEN_DONT_INLINE void run( \
+  Index rows, Index cols, \
+  const EIGTYPE* lhs, Index lhsStride, \
+  const EIGTYPE* rhs, Index rhsIncr, \
+  EIGTYPE* res, Index resIncr, EIGTYPE alpha) \
+{ \
+  MKL_INT m=rows, n=cols, lda=lhsStride, incx=rhsIncr, incy=resIncr; \
+  MKLTYPE alpha_, beta_; \
+  const EIGTYPE *x_ptr, myone(1); \
+  char trans=(LhsStorageOrder==ColMajor) ? 'N' : (ConjugateLhs) ? 'C' : 'T'; \
+  if (LhsStorageOrder==RowMajor) { \
+    m=cols; \
+    n=rows; \
+  }\
+  assign_scalar_eig2mkl(alpha_, alpha); \
+  assign_scalar_eig2mkl(beta_, myone); \
+  GEMVVector x_tmp; \
+  if (ConjugateRhs) { \
+    Map<const GEMVVector, 0, InnerStride<> > map_x(rhs,cols,1,InnerStride<>(incx)); \
+    x_tmp=map_x.conjugate(); \
+    x_ptr=x_tmp.data(); \
+    incx=1; \
+  } else x_ptr=rhs; \
+  MKLPREFIX##gemv(&trans, &m, &n, &alpha_, (const MKLTYPE*)lhs, &lda, (const MKLTYPE*)x_ptr, &incx, &beta_, (MKLTYPE*)res, &incy); \
+}\
+};
+
+EIGEN_MKL_GEMV_SPECIALIZATION(double,   double,        d)
+EIGEN_MKL_GEMV_SPECIALIZATION(float,    float,         s)
+EIGEN_MKL_GEMV_SPECIALIZATION(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_GEMV_SPECIALIZATION(scomplex, MKL_Complex8,  c)
+
+} // end namespase internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_GENERAL_MATRIX_VECTOR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/Parallelizer.h b/extern/Eigen3/Eigen/src/Core/products/Parallelizer.h
index ecdedc3..5c3e9b7 100644
--- a/extern/Eigen3/Eigen/src/Core/products/Parallelizer.h
+++ b/extern/Eigen3/Eigen/src/Core/products/Parallelizer.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PARALLELIZER_H
 #define EIGEN_PARALLELIZER_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \internal */
@@ -55,12 +42,23 @@ inline void manage_multi_threading(Action action, int* v)
   }
 }
 
+}
+
+/** Must be call first when calling Eigen from multiple threads */
+inline void initParallel()
+{
+  int nbt;
+  internal::manage_multi_threading(GetAction, &nbt);
+  std::ptrdiff_t l1, l2;
+  internal::manage_caching_sizes(GetAction, &l1, &l2);
+}
+
 /** \returns the max number of threads reserved for Eigen
   * \sa setNbThreads */
 inline int nbThreads()
 {
   int ret;
-  manage_multi_threading(GetAction, &ret);
+  internal::manage_multi_threading(GetAction, &ret);
   return ret;
 }
 
@@ -68,9 +66,11 @@ inline int nbThreads()
   * \sa nbThreads */
 inline void setNbThreads(int v)
 {
-  manage_multi_threading(SetAction, &v);
+  internal::manage_multi_threading(SetAction, &v);
 }
 
+namespace internal {
+
 template<typename Index> struct GemmParallelInfo
 {
   GemmParallelInfo() : sync(-1), users(0), rhs_start(0), rhs_length(0) {}
@@ -85,7 +85,9 @@ template<typename Index> struct GemmParallelInfo
 template<bool Condition, typename Functor, typename Index>
 void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpose)
 {
-#ifndef EIGEN_HAS_OPENMP
+  // TODO when EIGEN_USE_BLAS is defined,
+  // we should still enable OMP for other scalar types
+#if !(defined (EIGEN_HAS_OPENMP)) || defined (EIGEN_USE_BLAS)
   // FIXME the transpose variable is only needed to properly split
   // the matrix product when multithreading is enabled. This is a temporary
   // fix to support row-major destination matrices. This whole
@@ -117,6 +119,7 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpos
   if(threads==1)
     return func(0,rows, 0,cols);
 
+  Eigen::initParallel();
   func.initParallelSession();
 
   if(transpose)
@@ -151,4 +154,6 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpos
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_PARALLELIZER_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
index ccd757c..4820963 100644
--- a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINT_MATRIX_MATRIX_H
 #define EIGEN_SELFADJOINT_MATRIX_MATRIX_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // pack a selfadjoint block diagonal for use with the gebp_kernel
@@ -400,8 +387,8 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
   {
     eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
 
-    const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
-    const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
+    typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
+    typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
 
     Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
                                * RhsBlasTraits::extractScalarFactor(m_rhs);
@@ -424,4 +411,6 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
   }
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFADJOINT_MATRIX_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h
new file mode 100644
index 0000000..4e5c412
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h
@@ -0,0 +1,295 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Self adjoint matrix * matrix product functionality based on ?SYMM/?HEMM.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H
+#define EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+
+/* Optimized selfadjoint matrix * matrix (?SYMM/?HEMM) product */
+
+#define EIGEN_MKL_SYMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,true,ConjugateLhs,RhsStorageOrder,false,ConjugateRhs,ColMajor> \
+{\
+\
+  static EIGEN_DONT_INLINE void run( \
+    Index rows, Index cols, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+    char side='L', uplo='L'; \
+    MKL_INT m, n, lda, ldb, ldc; \
+    const EIGTYPE *a, *b; \
+    MKLTYPE alpha_, beta_; \
+    MatrixX##EIGPREFIX b_tmp; \
+    EIGTYPE myone(1);\
+\
+/* Set transpose options */ \
+/* Set m, n, k */ \
+    m = (MKL_INT)rows;  \
+    n = (MKL_INT)cols;  \
+\
+/* Set alpha_ & beta_ */ \
+    assign_scalar_eig2mkl(alpha_, alpha); \
+    assign_scalar_eig2mkl(beta_, myone); \
+\
+/* Set lda, ldb, ldc */ \
+    lda = (MKL_INT)lhsStride; \
+    ldb = (MKL_INT)rhsStride; \
+    ldc = (MKL_INT)resStride; \
+\
+/* Set a, b, c */ \
+    if (LhsStorageOrder==RowMajor) uplo='U'; \
+    a = _lhs; \
+\
+    if (RhsStorageOrder==RowMajor) { \
+      Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
+      b_tmp = rhs.adjoint(); \
+      b = b_tmp.data(); \
+      ldb = b_tmp.outerStride(); \
+    } else b = _rhs; \
+\
+    MKLPREFIX##symm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \
+\
+  } \
+};
+
+
+#define EIGEN_MKL_HEMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,true,ConjugateLhs,RhsStorageOrder,false,ConjugateRhs,ColMajor> \
+{\
+  static EIGEN_DONT_INLINE void run( \
+    Index rows, Index cols, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+    char side='L', uplo='L'; \
+    MKL_INT m, n, lda, ldb, ldc; \
+    const EIGTYPE *a, *b; \
+    MKLTYPE alpha_, beta_; \
+    MatrixX##EIGPREFIX b_tmp; \
+    Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder> a_tmp; \
+    EIGTYPE myone(1); \
+\
+/* Set transpose options */ \
+/* Set m, n, k */ \
+    m = (MKL_INT)rows; \
+    n = (MKL_INT)cols; \
+\
+/* Set alpha_ & beta_ */ \
+    assign_scalar_eig2mkl(alpha_, alpha); \
+    assign_scalar_eig2mkl(beta_, myone); \
+\
+/* Set lda, ldb, ldc */ \
+    lda = (MKL_INT)lhsStride; \
+    ldb = (MKL_INT)rhsStride; \
+    ldc = (MKL_INT)resStride; \
+\
+/* Set a, b, c */ \
+    if (((LhsStorageOrder==ColMajor) && ConjugateLhs) || ((LhsStorageOrder==RowMajor) && (!ConjugateLhs))) { \
+      Map<const Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder>, 0, OuterStride<> > lhs(_lhs,m,m,OuterStride<>(lhsStride)); \
+      a_tmp = lhs.conjugate(); \
+      a = a_tmp.data(); \
+      lda = a_tmp.outerStride(); \
+    } else a = _lhs; \
+    if (LhsStorageOrder==RowMajor) uplo='U'; \
+\
+    if (RhsStorageOrder==ColMajor && (!ConjugateRhs)) { \
+       b = _rhs; } \
+    else { \
+      if (RhsStorageOrder==ColMajor && ConjugateRhs) { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,m,n,OuterStride<>(rhsStride)); \
+        b_tmp = rhs.conjugate(); \
+      } else \
+      if (ConjugateRhs) { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
+        b_tmp = rhs.adjoint(); \
+      } else { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
+        b_tmp = rhs.transpose(); \
+      } \
+      b = b_tmp.data(); \
+      ldb = b_tmp.outerStride(); \
+    } \
+\
+    MKLPREFIX##hemm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \
+\
+  } \
+};
+
+EIGEN_MKL_SYMM_L(double, double, d, d)
+EIGEN_MKL_SYMM_L(float, float, f, s)
+EIGEN_MKL_HEMM_L(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_HEMM_L(scomplex, MKL_Complex8, cf, c)
+
+
+/* Optimized matrix * selfadjoint matrix (?SYMM/?HEMM) product */
+
+#define EIGEN_MKL_SYMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \
+{\
+\
+  static EIGEN_DONT_INLINE void run( \
+    Index rows, Index cols, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+    char side='R', uplo='L'; \
+    MKL_INT m, n, lda, ldb, ldc; \
+    const EIGTYPE *a, *b; \
+    MKLTYPE alpha_, beta_; \
+    MatrixX##EIGPREFIX b_tmp; \
+    EIGTYPE myone(1);\
+\
+/* Set m, n, k */ \
+    m = (MKL_INT)rows;  \
+    n = (MKL_INT)cols;  \
+\
+/* Set alpha_ & beta_ */ \
+    assign_scalar_eig2mkl(alpha_, alpha); \
+    assign_scalar_eig2mkl(beta_, myone); \
+\
+/* Set lda, ldb, ldc */ \
+    lda = (MKL_INT)rhsStride; \
+    ldb = (MKL_INT)lhsStride; \
+    ldc = (MKL_INT)resStride; \
+\
+/* Set a, b, c */ \
+    if (RhsStorageOrder==RowMajor) uplo='U'; \
+    a = _rhs; \
+\
+    if (LhsStorageOrder==RowMajor) { \
+      Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(rhsStride)); \
+      b_tmp = lhs.adjoint(); \
+      b = b_tmp.data(); \
+      ldb = b_tmp.outerStride(); \
+    } else b = _lhs; \
+\
+    MKLPREFIX##symm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \
+\
+  } \
+};
+
+
+#define EIGEN_MKL_HEMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \
+{\
+  static EIGEN_DONT_INLINE void run( \
+    Index rows, Index cols, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+    char side='R', uplo='L'; \
+    MKL_INT m, n, lda, ldb, ldc; \
+    const EIGTYPE *a, *b; \
+    MKLTYPE alpha_, beta_; \
+    MatrixX##EIGPREFIX b_tmp; \
+    Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> a_tmp; \
+    EIGTYPE myone(1); \
+\
+/* Set m, n, k */ \
+    m = (MKL_INT)rows; \
+    n = (MKL_INT)cols; \
+\
+/* Set alpha_ & beta_ */ \
+    assign_scalar_eig2mkl(alpha_, alpha); \
+    assign_scalar_eig2mkl(beta_, myone); \
+\
+/* Set lda, ldb, ldc */ \
+    lda = (MKL_INT)rhsStride; \
+    ldb = (MKL_INT)lhsStride; \
+    ldc = (MKL_INT)resStride; \
+\
+/* Set a, b, c */ \
+    if (((RhsStorageOrder==ColMajor) && ConjugateRhs) || ((RhsStorageOrder==RowMajor) && (!ConjugateRhs))) { \
+      Map<const Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder>, 0, OuterStride<> > rhs(_rhs,n,n,OuterStride<>(rhsStride)); \
+      a_tmp = rhs.conjugate(); \
+      a = a_tmp.data(); \
+      lda = a_tmp.outerStride(); \
+    } else a = _rhs; \
+    if (RhsStorageOrder==RowMajor) uplo='U'; \
+\
+    if (LhsStorageOrder==ColMajor && (!ConjugateLhs)) { \
+       b = _lhs; } \
+    else { \
+      if (LhsStorageOrder==ColMajor && ConjugateLhs) { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,m,n,OuterStride<>(lhsStride)); \
+        b_tmp = lhs.conjugate(); \
+      } else \
+      if (ConjugateLhs) { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \
+        b_tmp = lhs.adjoint(); \
+      } else { \
+        Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \
+        b_tmp = lhs.transpose(); \
+      } \
+      b = b_tmp.data(); \
+      ldb = b_tmp.outerStride(); \
+    } \
+\
+    MKLPREFIX##hemm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \
+  } \
+};
+
+EIGEN_MKL_SYMM_R(double, double, d, d)
+EIGEN_MKL_SYMM_R(float, float, f, s)
+EIGEN_MKL_HEMM_R(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_HEMM_R(scomplex, MKL_Complex8, cf, c)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h
index d6121fc..c3145c6 100644
--- a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_H
 #define EIGEN_SELFADJOINT_MATRIX_VECTOR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /* Optimized selfadjoint matrix * vector product:
@@ -32,8 +19,15 @@ namespace internal {
  * the number of load/stores of the result by a factor 2 and to reduce
  * the instruction dependency.
  */
-template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs>
-static EIGEN_DONT_INLINE void product_selfadjoint_vector(
+
+template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs, int Version=Specialized>
+struct selfadjoint_matrix_vector_product;
+
+template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs, int Version>
+struct selfadjoint_matrix_vector_product
+
+{
+static EIGEN_DONT_INLINE void run(
   Index size,
   const Scalar*  lhs, Index lhsStride,
   const Scalar* _rhs, Index rhsIncr,
@@ -85,14 +79,14 @@ static EIGEN_DONT_INLINE void product_selfadjoint_vector(
     Scalar t1 = cjAlpha * rhs[j+1];
     Packet ptmp1 = pset1<Packet>(t1);
 
-    Scalar t2 = 0;
+    Scalar t2(0);
     Packet ptmp2 = pset1<Packet>(t2);
-    Scalar t3 = 0;
+    Scalar t3(0);
     Packet ptmp3 = pset1<Packet>(t3);
 
     size_t starti = FirstTriangular ? 0 : j+2;
     size_t endi   = FirstTriangular ? j : size;
-    size_t alignedStart = (starti) + first_aligned(&res[starti], endi-starti);
+    size_t alignedStart = (starti) + internal::first_aligned(&res[starti], endi-starti);
     size_t alignedEnd = alignedStart + ((endi-alignedStart)/(PacketSize))*(PacketSize);
 
     // TODO make sure this product is a real * complex and that the rhs is properly conjugated if needed
@@ -148,7 +142,7 @@ static EIGEN_DONT_INLINE void product_selfadjoint_vector(
     register const Scalar* EIGEN_RESTRICT A0 = lhs + j*lhsStride;
 
     Scalar t1 = cjAlpha * rhs[j];
-    Scalar t2 = 0;
+    Scalar t2(0);
     // TODO make sure this product is a real * complex and that the rhs is properly conjugated if needed
     res[j] += cjd.pmul(internal::real(A0[j]), t1);
     for (Index i=FirstTriangular ? 0 : j+1; i<(FirstTriangular ? j : size); i++)
@@ -159,6 +153,7 @@ static EIGEN_DONT_INLINE void product_selfadjoint_vector(
     res[j] += alpha * t2;
   }
 }
+};
 
 } // end namespace internal 
 
@@ -193,8 +188,8 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
     
     eigen_assert(dest.rows()==m_lhs.rows() && dest.cols()==m_rhs.cols());
 
-    const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
-    const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
+    typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
+    typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
 
     Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
                                * RhsBlasTraits::extractScalarFactor(m_rhs);
@@ -232,7 +227,7 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
     }
       
       
-    internal::product_selfadjoint_vector<Scalar, Index, (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, int(LhsUpLo), bool(LhsBlasTraits::NeedToConjugate), bool(RhsBlasTraits::NeedToConjugate)>
+    internal::selfadjoint_matrix_vector_product<Scalar, Index, (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, int(LhsUpLo), bool(LhsBlasTraits::NeedToConjugate), bool(RhsBlasTraits::NeedToConjugate)>::run
       (
         lhs.rows(),                             // size
         &lhs.coeffRef(0,0),  lhs.outerStride(), // lhs info
@@ -274,5 +269,6 @@ struct SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>
   }
 };
 
+} // end namespace Eigen
 
 #endif // EIGEN_SELFADJOINT_MATRIX_VECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h
new file mode 100644
index 0000000..f88d483
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h
@@ -0,0 +1,114 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Selfadjoint matrix-vector product functionality based on ?SYMV/HEMV.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_MKL_H
+#define EIGEN_SELFADJOINT_MATRIX_VECTOR_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/**********************************************************************
+* This file implements selfadjoint matrix-vector multiplication using BLAS
+**********************************************************************/
+
+// symv/hemv specialization
+
+template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs>
+struct selfadjoint_matrix_vector_product_symv :
+  selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,BuiltIn> {};
+
+#define EIGEN_MKL_SYMV_SPECIALIZE(Scalar) \
+template<typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs> \
+struct selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Specialized> { \
+static EIGEN_DONT_INLINE void run( \
+  Index size, const Scalar*  lhs, Index lhsStride, \
+  const Scalar* _rhs, Index rhsIncr, Scalar* res, Scalar alpha) { \
+    enum {\
+      IsColMajor = StorageOrder==ColMajor \
+    }; \
+    if (IsColMajor == ConjugateLhs) {\
+      selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,BuiltIn>::run( \
+        size, lhs, lhsStride, _rhs, rhsIncr, res, alpha);  \
+    } else {\
+      selfadjoint_matrix_vector_product_symv<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs>::run( \
+        size, lhs, lhsStride, _rhs, rhsIncr, res, alpha);  \
+    }\
+  } \
+}; \
+
+EIGEN_MKL_SYMV_SPECIALIZE(double)
+EIGEN_MKL_SYMV_SPECIALIZE(float)
+EIGEN_MKL_SYMV_SPECIALIZE(dcomplex)
+EIGEN_MKL_SYMV_SPECIALIZE(scomplex)
+
+#define EIGEN_MKL_SYMV_SPECIALIZATION(EIGTYPE,MKLTYPE,MKLFUNC) \
+template<typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs> \
+struct selfadjoint_matrix_vector_product_symv<EIGTYPE,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs> \
+{ \
+typedef Matrix<EIGTYPE,Dynamic,1,ColMajor> SYMVVector;\
+\
+static EIGEN_DONT_INLINE void run( \
+Index size, const EIGTYPE*  lhs, Index lhsStride, \
+const EIGTYPE* _rhs, Index rhsIncr, EIGTYPE* res, EIGTYPE alpha) \
+{ \
+  enum {\
+    IsRowMajor = StorageOrder==RowMajor ? 1 : 0, \
+    IsLower = UpLo == Lower ? 1 : 0 \
+  }; \
+  MKL_INT n=size, lda=lhsStride, incx=rhsIncr, incy=1; \
+  MKLTYPE alpha_, beta_; \
+  const EIGTYPE *x_ptr, myone(1); \
+  char uplo=(IsRowMajor) ? (IsLower ? 'U' : 'L') : (IsLower ? 'L' : 'U'); \
+  assign_scalar_eig2mkl(alpha_, alpha); \
+  assign_scalar_eig2mkl(beta_, myone); \
+  SYMVVector x_tmp; \
+  if (ConjugateRhs) { \
+    Map<const SYMVVector, 0, InnerStride<> > map_x(_rhs,size,1,InnerStride<>(incx)); \
+    x_tmp=map_x.conjugate(); \
+    x_ptr=x_tmp.data(); \
+    incx=1; \
+  } else x_ptr=_rhs; \
+  MKLFUNC(&uplo, &n, &alpha_, (const MKLTYPE*)lhs, &lda, (const MKLTYPE*)x_ptr, &incx, &beta_, (MKLTYPE*)res, &incy); \
+}\
+};
+
+EIGEN_MKL_SYMV_SPECIALIZATION(double,   double,        dsymv)
+EIGEN_MKL_SYMV_SPECIALIZATION(float,    float,         ssymv)
+EIGEN_MKL_SYMV_SPECIALIZATION(dcomplex, MKL_Complex16, zhemv)
+EIGEN_MKL_SYMV_SPECIALIZATION(scomplex, MKL_Complex8,  chemv)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SELFADJOINT_MATRIX_VECTOR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h
index 3a4523f..6a55f3d 100644
--- a/extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINT_PRODUCT_H
 #define EIGEN_SELFADJOINT_PRODUCT_H
@@ -31,6 +16,8 @@
 * It corresponds to the level 3 SYRK and level 2 SYR Blas routines.
 **********************************************************************/
 
+namespace Eigen { 
+
 template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
 struct selfadjoint_rank1_update;
 
@@ -72,7 +59,7 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,true>
     typedef internal::blas_traits<OtherType> OtherBlasTraits;
     typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType;
     typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType;
-    const ActualOtherType actualOther = OtherBlasTraits::extract(other.derived());
+    typename internal::add_const_on_value_type<ActualOtherType>::type actualOther = OtherBlasTraits::extract(other.derived());
 
     Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived());
 
@@ -105,12 +92,12 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
     typedef internal::blas_traits<OtherType> OtherBlasTraits;
     typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType;
     typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType;
-    const ActualOtherType actualOther = OtherBlasTraits::extract(other.derived());
+    typename internal::add_const_on_value_type<ActualOtherType>::type actualOther = OtherBlasTraits::extract(other.derived());
 
     Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived());
 
     enum { IsRowMajor = (internal::traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
-    
+
     internal::general_matrix_matrix_triangular_product<Index,
       Scalar, _ActualOtherType::Flags&RowMajorBit ? RowMajor : ColMajor,   OtherBlasTraits::NeedToConjugate  && NumTraits<Scalar>::IsComplex,
       Scalar, _ActualOtherType::Flags&RowMajorBit ? ColMajor : RowMajor, (!OtherBlasTraits::NeedToConjugate) && NumTraits<Scalar>::IsComplex,
@@ -133,4 +120,6 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
   return *this;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFADJOINT_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h b/extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
index 9f8b843..57a98cc 100644
--- a/extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
+++ b/extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINTRANK2UPTADE_H
 #define EIGEN_SELFADJOINTRANK2UPTADE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
@@ -76,12 +63,12 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
   typedef internal::blas_traits<DerivedU> UBlasTraits;
   typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
   typedef typename internal::remove_all<ActualUType>::type _ActualUType;
-  const ActualUType actualU = UBlasTraits::extract(u.derived());
+  typename internal::add_const_on_value_type<ActualUType>::type actualU = UBlasTraits::extract(u.derived());
 
   typedef internal::blas_traits<DerivedV> VBlasTraits;
   typedef typename VBlasTraits::DirectLinearAccessType ActualVType;
   typedef typename internal::remove_all<ActualVType>::type _ActualVType;
-  const ActualVType actualV = VBlasTraits::extract(v.derived());
+  typename internal::add_const_on_value_type<ActualVType>::type actualV = VBlasTraits::extract(v.derived());
 
   // If MatrixType is row major, then we use the routine for lower triangular in the upper triangular case and
   // vice versa, and take the complex conjugate of all coefficients and vector entries.
@@ -101,4 +88,6 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
   return *this;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFADJOINTRANK2UPTADE_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h
index 0c48d2e..92cba66 100644
--- a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULAR_MATRIX_MATRIX_H
 #define EIGEN_TRIANGULAR_MATRIX_MATRIX_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // template<typename Scalar, int mr, int StorageOrder, bool Conjugate, int Mode>
@@ -58,23 +45,23 @@ template <typename Scalar, typename Index,
           int Mode, bool LhsIsTriangular,
           int LhsStorageOrder, bool ConjugateLhs,
           int RhsStorageOrder, bool ConjugateRhs,
-          int ResStorageOrder>
+          int ResStorageOrder, int Version = Specialized>
 struct product_triangular_matrix_matrix;
 
 template <typename Scalar, typename Index,
           int Mode, bool LhsIsTriangular,
           int LhsStorageOrder, bool ConjugateLhs,
-          int RhsStorageOrder, bool ConjugateRhs>
+          int RhsStorageOrder, bool ConjugateRhs, int Version>
 struct product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
                                            LhsStorageOrder,ConjugateLhs,
-                                           RhsStorageOrder,ConjugateRhs,RowMajor>
+                                           RhsStorageOrder,ConjugateRhs,RowMajor,Version>
 {
   static EIGEN_STRONG_INLINE void run(
     Index rows, Index cols, Index depth,
     const Scalar* lhs, Index lhsStride,
     const Scalar* rhs, Index rhsStride,
     Scalar* res,       Index resStride,
-    Scalar alpha)
+    Scalar alpha, level3_blocking<Scalar,Scalar>& blocking)
   {
     product_triangular_matrix_matrix<Scalar, Index,
       (Mode&(UnitDiag|ZeroDiag)) | ((Mode&Upper) ? Lower : Upper),
@@ -84,22 +71,22 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
       LhsStorageOrder==RowMajor ? ColMajor : RowMajor,
       ConjugateLhs,
       ColMajor>
-      ::run(cols, rows, depth, rhs, rhsStride, lhs, lhsStride, res, resStride, alpha);
+      ::run(cols, rows, depth, rhs, rhsStride, lhs, lhsStride, res, resStride, alpha, blocking);
   }
 };
 
 // implements col-major += alpha * op(triangular) * op(general)
 template <typename Scalar, typename Index, int Mode,
           int LhsStorageOrder, bool ConjugateLhs,
-          int RhsStorageOrder, bool ConjugateRhs>
+          int RhsStorageOrder, bool ConjugateRhs, int Version>
 struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
                                            LhsStorageOrder,ConjugateLhs,
-                                           RhsStorageOrder,ConjugateRhs,ColMajor>
+                                           RhsStorageOrder,ConjugateRhs,ColMajor,Version>
 {
   
   typedef gebp_traits<Scalar,Scalar> Traits;
   enum {
-    SmallPanelWidth   = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
+    SmallPanelWidth   = 2 * EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
     IsLower = (Mode&Lower) == Lower,
     SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1
   };
@@ -109,7 +96,7 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
     const Scalar* _lhs, Index lhsStride,
     const Scalar* _rhs, Index rhsStride,
     Scalar* res,        Index resStride,
-    Scalar alpha)
+    Scalar alpha, level3_blocking<Scalar,Scalar>& blocking)
   {
     // strip zeros
     Index diagSize  = (std::min)(_rows,_depth);
@@ -120,15 +107,16 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
     const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
     const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
 
-    Index kc = depth; // cache block size along the K direction
-    Index mc = rows;  // cache block size along the M direction
-    Index nc = cols;  // cache block size along the N direction
-    computeProductBlockingSizes<Scalar,Scalar,4>(kc, mc, nc);
+    Index kc = blocking.kc();                   // cache block size along the K direction
+    Index mc = (std::min)(rows,blocking.mc());  // cache block size along the M direction
+
+    std::size_t sizeA = kc*mc;
+    std::size_t sizeB = kc*cols;
     std::size_t sizeW = kc*Traits::WorkSpaceFactor;
-    std::size_t sizeB = sizeW + kc*cols;
-    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0);
-    ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0);    
-    Scalar* blockB = allocatedBlockB + sizeW;
+
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, sizeA, blocking.blockA());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockB, sizeB, blocking.blockB());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockW, sizeW, blocking.blockW());
 
     Matrix<Scalar,SmallPanelWidth,SmallPanelWidth,LhsStorageOrder> triangularBuffer;
     triangularBuffer.setZero();
@@ -186,7 +174,7 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
           pack_lhs(blockA, triangularBuffer.data(), triangularBuffer.outerStride(), actualPanelWidth, actualPanelWidth);
 
           gebp_kernel(res+startBlock, resStride, blockA, blockB, actualPanelWidth, actualPanelWidth, cols, alpha,
-                      actualPanelWidth, actual_kc, 0, blockBOffset);
+                      actualPanelWidth, actual_kc, 0, blockBOffset, blockW);
 
           // GEBP with remaining micro panel
           if (lengthTarget>0)
@@ -196,7 +184,7 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
             pack_lhs(blockA, &lhs(startTarget,startBlock), lhsStride, actualPanelWidth, lengthTarget);
 
             gebp_kernel(res+startTarget, resStride, blockA, blockB, lengthTarget, actualPanelWidth, cols, alpha,
-                        actualPanelWidth, actual_kc, 0, blockBOffset);
+                        actualPanelWidth, actual_kc, 0, blockBOffset, blockW);
           }
         }
       }
@@ -210,7 +198,7 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
           gemm_pack_lhs<Scalar, Index, Traits::mr,Traits::LhsProgress, LhsStorageOrder,false>()
             (blockA, &lhs(i2, actual_k2), lhsStride, actual_kc, actual_mc);
 
-          gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha);
+          gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha, -1, -1, 0, 0, blockW);
         }
       }
     }
@@ -220,10 +208,10 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
 // implements col-major += alpha * op(general) * op(triangular)
 template <typename Scalar, typename Index, int Mode,
           int LhsStorageOrder, bool ConjugateLhs,
-          int RhsStorageOrder, bool ConjugateRhs>
+          int RhsStorageOrder, bool ConjugateRhs, int Version>
 struct product_triangular_matrix_matrix<Scalar,Index,Mode,false,
                                            LhsStorageOrder,ConjugateLhs,
-                                           RhsStorageOrder,ConjugateRhs,ColMajor>
+                                           RhsStorageOrder,ConjugateRhs,ColMajor,Version>
 {
   typedef gebp_traits<Scalar,Scalar> Traits;
   enum {
@@ -237,7 +225,7 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,false,
     const Scalar* _lhs, Index lhsStride,
     const Scalar* _rhs, Index rhsStride,
     Scalar* res,        Index resStride,
-    Scalar alpha)
+    Scalar alpha, level3_blocking<Scalar,Scalar>& blocking)
   {
     // strip zeros
     Index diagSize  = (std::min)(_cols,_depth);
@@ -248,16 +236,16 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,false,
     const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
     const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
 
-    Index kc = depth; // cache block size along the K direction
-    Index mc = rows;  // cache block size along the M direction
-    Index nc = cols;  // cache block size along the N direction
-    computeProductBlockingSizes<Scalar,Scalar,4>(kc, mc, nc);
+    Index kc = blocking.kc();                   // cache block size along the K direction
+    Index mc = (std::min)(rows,blocking.mc());  // cache block size along the M direction
 
+    std::size_t sizeA = kc*mc;
+    std::size_t sizeB = kc*cols;
     std::size_t sizeW = kc*Traits::WorkSpaceFactor;
-    std::size_t sizeB = sizeW + kc*cols;
-    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0);
-    ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0);
-    Scalar* blockB = allocatedBlockB + sizeW;
+
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, sizeA, blocking.blockA());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockB, sizeB, blocking.blockB());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockW, sizeW, blocking.blockW());
 
     Matrix<Scalar,SmallPanelWidth,SmallPanelWidth,RhsStorageOrder> triangularBuffer;
     triangularBuffer.setZero();
@@ -345,13 +333,13 @@ struct product_triangular_matrix_matrix<Scalar,Index,Mode,false,
                         alpha,
                         actual_kc, actual_kc,  // strides
                         blockOffset, blockOffset,// offsets
-                        allocatedBlockB); // workspace
+                        blockW); // workspace
           }
         }
         gebp_kernel(res+i2+(IsLower ? 0 : k2)*resStride, resStride,
                     blockA, geb, actual_mc, actual_kc, rs,
                     alpha,
-                    -1, -1, 0, 0, allocatedBlockB);
+                    -1, -1, 0, 0, blockW);
       }
     }
   }
@@ -378,26 +366,38 @@ struct TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>
 
   template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
   {
-    const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
-    const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
+    typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
+    typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
 
     Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
                                * RhsBlasTraits::extractScalarFactor(m_rhs);
 
+    typedef internal::gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,Scalar,Scalar,
+              Lhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxColsAtCompileTime,4> BlockingType;
+
+    enum { IsLower = (Mode&Lower) == Lower };
+    Index stripedRows  = ((!LhsIsTriangular) || (IsLower))  ? lhs.rows() : (std::min)(lhs.rows(),lhs.cols());
+    Index stripedCols  = ((LhsIsTriangular)  || (!IsLower)) ? rhs.cols() : (std::min)(rhs.cols(),rhs.rows());
+    Index stripedDepth = LhsIsTriangular ? ((!IsLower) ? lhs.cols() : (std::min)(lhs.cols(),lhs.rows()))
+                                         : ((IsLower)  ? rhs.rows() : (std::min)(rhs.rows(),rhs.cols()));
+
+    BlockingType blocking(stripedRows, stripedCols, stripedDepth);
+
     internal::product_triangular_matrix_matrix<Scalar, Index,
       Mode, LhsIsTriangular,
       (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, LhsBlasTraits::NeedToConjugate,
       (internal::traits<_ActualRhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, RhsBlasTraits::NeedToConjugate,
       (internal::traits<Dest          >::Flags&RowMajorBit) ? RowMajor : ColMajor>
       ::run(
-        lhs.rows(), rhs.cols(), lhs.cols(),// LhsIsTriangular ? rhs.cols() : lhs.rows(),           // sizes
+        stripedRows, stripedCols, stripedDepth,   // sizes
         &lhs.coeffRef(0,0),    lhs.outerStride(), // lhs info
         &rhs.coeffRef(0,0),    rhs.outerStride(), // rhs info
-        &dst.coeffRef(0,0), dst.outerStride(), // result info
-        actualAlpha                            // alpha
+        &dst.coeffRef(0,0), dst.outerStride(),    // result info
+        actualAlpha, blocking
       );
   }
 };
 
+} // end namespace Eigen
 
 #endif // EIGEN_TRIANGULAR_MATRIX_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
new file mode 100644
index 0000000..8173da5
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
@@ -0,0 +1,309 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Triangular matrix * matrix product functionality based on ?TRMM.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_TRIANGULAR_MATRIX_MATRIX_MKL_H
+#define EIGEN_TRIANGULAR_MATRIX_MATRIX_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+
+template <typename Scalar, typename Index,
+          int Mode, bool LhsIsTriangular,
+          int LhsStorageOrder, bool ConjugateLhs,
+          int RhsStorageOrder, bool ConjugateRhs,
+          int ResStorageOrder>
+struct product_triangular_matrix_matrix_trmm :
+       product_triangular_matrix_matrix<Scalar,Index,Mode,
+          LhsIsTriangular,LhsStorageOrder,ConjugateLhs,
+          RhsStorageOrder, ConjugateRhs, ResStorageOrder, BuiltIn> {};
+
+
+// try to go to BLAS specialization
+#define EIGEN_MKL_TRMM_SPECIALIZE(Scalar, LhsIsTriangular) \
+template <typename Index, int Mode, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_triangular_matrix_matrix<Scalar,Index, Mode, LhsIsTriangular, \
+           LhsStorageOrder,ConjugateLhs, RhsStorageOrder,ConjugateRhs,ColMajor,Specialized> { \
+  static inline void run(Index _rows, Index _cols, Index _depth, const Scalar* _lhs, Index lhsStride,\
+    const Scalar* _rhs, Index rhsStride, Scalar* res, Index resStride, Scalar alpha) { \
+      product_triangular_matrix_matrix_trmm<Scalar,Index,Mode, \
+        LhsIsTriangular,LhsStorageOrder,ConjugateLhs, \
+        RhsStorageOrder, ConjugateRhs, ColMajor>::run( \
+        _rows, _cols, _depth, _lhs, lhsStride, _rhs, rhsStride, res, resStride, alpha); \
+  } \
+};
+
+EIGEN_MKL_TRMM_SPECIALIZE(double, true)
+EIGEN_MKL_TRMM_SPECIALIZE(double, false)
+EIGEN_MKL_TRMM_SPECIALIZE(dcomplex, true)
+EIGEN_MKL_TRMM_SPECIALIZE(dcomplex, false)
+EIGEN_MKL_TRMM_SPECIALIZE(float, true)
+EIGEN_MKL_TRMM_SPECIALIZE(float, false)
+EIGEN_MKL_TRMM_SPECIALIZE(scomplex, true)
+EIGEN_MKL_TRMM_SPECIALIZE(scomplex, false)
+
+// implements col-major += alpha * op(triangular) * op(general)
+#define EIGEN_MKL_TRMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, int Mode, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_triangular_matrix_matrix_trmm<EIGTYPE,Index,Mode,true, \
+         LhsStorageOrder,ConjugateLhs,RhsStorageOrder,ConjugateRhs,ColMajor> \
+{ \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    LowUp = IsLower ? Lower : Upper, \
+    conjA = ((LhsStorageOrder==ColMajor) && ConjugateLhs) ? 1 : 0 \
+  }; \
+\
+  static EIGEN_DONT_INLINE void run( \
+    Index _rows, Index _cols, Index _depth, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+   Index diagSize  = (std::min)(_rows,_depth); \
+   Index rows      = IsLower ? _rows : diagSize; \
+   Index depth     = IsLower ? diagSize : _depth; \
+   Index cols      = _cols; \
+\
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder> MatrixLhs; \
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> MatrixRhs; \
+\
+/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
+   if (rows != depth) { \
+\
+     int nthr = mkl_domain_get_max_threads(MKL_BLAS); \
+\
+     if (((nthr==1) && (((std::max)(rows,depth)-diagSize)/(double)diagSize < 0.5))) { \
+     /* Most likely no benefit to call TRMM or GEMM from MKL*/ \
+       product_triangular_matrix_matrix<EIGTYPE,Index,Mode,true, \
+       LhsStorageOrder,ConjugateLhs, RhsStorageOrder, ConjugateRhs, ColMajor, BuiltIn>::run( \
+           _rows, _cols, _depth, _lhs, lhsStride, _rhs, rhsStride, res, resStride, alpha); \
+     /*std::cout << "TRMM_L: A is not square! Go to Eigen TRMM implementation!\n";*/ \
+     } else { \
+     /* Make sense to call GEMM */ \
+       Map<const MatrixLhs, 0, OuterStride<> > lhsMap(_lhs,rows,depth,OuterStride<>(lhsStride)); \
+       MatrixLhs aa_tmp=lhsMap.template triangularView<Mode>(); \
+       MKL_INT aStride = aa_tmp.outerStride(); \
+       gemm_blocking_space<ColMajor,EIGTYPE,EIGTYPE,Dynamic,Dynamic,Dynamic> blocking(_rows,_cols,_depth); \
+       general_matrix_matrix_product<Index,EIGTYPE,LhsStorageOrder,ConjugateLhs,EIGTYPE,RhsStorageOrder,ConjugateRhs,ColMajor>::run( \
+       rows, cols, depth, aa_tmp.data(), aStride, _rhs, rhsStride, res, resStride, alpha, blocking, 0); \
+\
+     /*std::cout << "TRMM_L: A is not square! Go to MKL GEMM implementation! " << nthr<<" \n";*/ \
+     } \
+     return; \
+   } \
+   char side = 'L', transa, uplo, diag = 'N'; \
+   EIGTYPE *b; \
+   const EIGTYPE *a; \
+   MKL_INT m, n, lda, ldb; \
+   MKLTYPE alpha_; \
+\
+/* Set alpha_*/ \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); \
+\
+/* Set m, n */ \
+   m = (MKL_INT)diagSize; \
+   n = (MKL_INT)cols; \
+\
+/* Set trans */ \
+   transa = (LhsStorageOrder==RowMajor) ? ((ConjugateLhs) ? 'C' : 'T') : 'N'; \
+\
+/* Set b, ldb */ \
+   Map<const MatrixRhs, 0, OuterStride<> > rhs(_rhs,depth,cols,OuterStride<>(rhsStride)); \
+   MatrixX##EIGPREFIX b_tmp; \
+\
+   if (ConjugateRhs) b_tmp = rhs.conjugate(); else b_tmp = rhs; \
+   b = b_tmp.data(); \
+   ldb = b_tmp.outerStride(); \
+\
+/* Set uplo */ \
+   uplo = IsLower ? 'L' : 'U'; \
+   if (LhsStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
+/* Set a, lda */ \
+   Map<const MatrixLhs, 0, OuterStride<> > lhs(_lhs,rows,depth,OuterStride<>(lhsStride)); \
+   MatrixLhs a_tmp; \
+\
+   if ((conjA!=0) || (SetDiag==0)) { \
+     if (conjA) a_tmp = lhs.conjugate(); else a_tmp = lhs; \
+     if (IsZeroDiag) \
+       a_tmp.diagonal().setZero(); \
+     else if (IsUnitDiag) \
+       a_tmp.diagonal().setOnes();\
+     a = a_tmp.data(); \
+     lda = a_tmp.outerStride(); \
+   } else { \
+     a = _lhs; \
+     lda = lhsStride; \
+   } \
+   /*std::cout << "TRMM_L: A is square! Go to MKL TRMM implementation! \n";*/ \
+/* call ?trmm*/ \
+   MKLPREFIX##trmm(&side, &uplo, &transa, &diag, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (MKLTYPE*)b, &ldb); \
+\
+/* Add op(a_triangular)*b into res*/ \
+   Map<MatrixX##EIGPREFIX, 0, OuterStride<> > res_tmp(res,rows,cols,OuterStride<>(resStride)); \
+   res_tmp=res_tmp+b_tmp; \
+  } \
+};
+
+EIGEN_MKL_TRMM_L(double, double, d, d)
+EIGEN_MKL_TRMM_L(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_TRMM_L(float, float, f, s)
+EIGEN_MKL_TRMM_L(scomplex, MKL_Complex8, cf, c)
+
+// implements col-major += alpha * op(general) * op(triangular)
+#define EIGEN_MKL_TRMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template <typename Index, int Mode, \
+          int LhsStorageOrder, bool ConjugateLhs, \
+          int RhsStorageOrder, bool ConjugateRhs> \
+struct product_triangular_matrix_matrix_trmm<EIGTYPE,Index,Mode,false, \
+         LhsStorageOrder,ConjugateLhs,RhsStorageOrder,ConjugateRhs,ColMajor> \
+{ \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    LowUp = IsLower ? Lower : Upper, \
+    conjA = ((RhsStorageOrder==ColMajor) && ConjugateRhs) ? 1 : 0 \
+  }; \
+\
+  static EIGEN_DONT_INLINE void run( \
+    Index _rows, Index _cols, Index _depth, \
+    const EIGTYPE* _lhs, Index lhsStride, \
+    const EIGTYPE* _rhs, Index rhsStride, \
+    EIGTYPE* res,        Index resStride, \
+    EIGTYPE alpha) \
+  { \
+   Index diagSize  = (std::min)(_cols,_depth); \
+   Index rows      = _rows; \
+   Index depth     = IsLower ? _depth : diagSize; \
+   Index cols      = IsLower ? diagSize : _cols; \
+\
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder> MatrixLhs; \
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> MatrixRhs; \
+\
+/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
+   if (cols != depth) { \
+\
+     int nthr = mkl_domain_get_max_threads(MKL_BLAS); \
+\
+     if ((nthr==1) && (((std::max)(cols,depth)-diagSize)/(double)diagSize < 0.5)) { \
+     /* Most likely no benefit to call TRMM or GEMM from MKL*/ \
+       product_triangular_matrix_matrix<EIGTYPE,Index,Mode,false, \
+       LhsStorageOrder,ConjugateLhs, RhsStorageOrder, ConjugateRhs, ColMajor, BuiltIn>::run( \
+           _rows, _cols, _depth, _lhs, lhsStride, _rhs, rhsStride, res, resStride, alpha); \
+       /*std::cout << "TRMM_R: A is not square! Go to Eigen TRMM implementation!\n";*/ \
+     } else { \
+     /* Make sense to call GEMM */ \
+       Map<const MatrixRhs, 0, OuterStride<> > rhsMap(_rhs,depth,cols, OuterStride<>(rhsStride)); \
+       MatrixRhs aa_tmp=rhsMap.template triangularView<Mode>(); \
+       MKL_INT aStride = aa_tmp.outerStride(); \
+       gemm_blocking_space<ColMajor,EIGTYPE,EIGTYPE,Dynamic,Dynamic,Dynamic> blocking(_rows,_cols,_depth); \
+       general_matrix_matrix_product<Index,EIGTYPE,LhsStorageOrder,ConjugateLhs,EIGTYPE,RhsStorageOrder,ConjugateRhs,ColMajor>::run( \
+       rows, cols, depth, _lhs, lhsStride, aa_tmp.data(), aStride, res, resStride, alpha, blocking, 0); \
+\
+     /*std::cout << "TRMM_R: A is not square! Go to MKL GEMM implementation! " << nthr<<" \n";*/ \
+     } \
+     return; \
+   } \
+   char side = 'R', transa, uplo, diag = 'N'; \
+   EIGTYPE *b; \
+   const EIGTYPE *a; \
+   MKL_INT m, n, lda, ldb; \
+   MKLTYPE alpha_; \
+\
+/* Set alpha_*/ \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); \
+\
+/* Set m, n */ \
+   m = (MKL_INT)rows; \
+   n = (MKL_INT)diagSize; \
+\
+/* Set trans */ \
+   transa = (RhsStorageOrder==RowMajor) ? ((ConjugateRhs) ? 'C' : 'T') : 'N'; \
+\
+/* Set b, ldb */ \
+   Map<const MatrixLhs, 0, OuterStride<> > lhs(_lhs,rows,depth,OuterStride<>(lhsStride)); \
+   MatrixX##EIGPREFIX b_tmp; \
+\
+   if (ConjugateLhs) b_tmp = lhs.conjugate(); else b_tmp = lhs; \
+   b = b_tmp.data(); \
+   ldb = b_tmp.outerStride(); \
+\
+/* Set uplo */ \
+   uplo = IsLower ? 'L' : 'U'; \
+   if (RhsStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
+/* Set a, lda */ \
+   Map<const MatrixRhs, 0, OuterStride<> > rhs(_rhs,depth,cols, OuterStride<>(rhsStride)); \
+   MatrixRhs a_tmp; \
+\
+   if ((conjA!=0) || (SetDiag==0)) { \
+     if (conjA) a_tmp = rhs.conjugate(); else a_tmp = rhs; \
+     if (IsZeroDiag) \
+       a_tmp.diagonal().setZero(); \
+     else if (IsUnitDiag) \
+       a_tmp.diagonal().setOnes();\
+     a = a_tmp.data(); \
+     lda = a_tmp.outerStride(); \
+   } else { \
+     a = _rhs; \
+     lda = rhsStride; \
+   } \
+   /*std::cout << "TRMM_R: A is square! Go to MKL TRMM implementation! \n";*/ \
+/* call ?trmm*/ \
+   MKLPREFIX##trmm(&side, &uplo, &transa, &diag, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (MKLTYPE*)b, &ldb); \
+\
+/* Add op(a_triangular)*b into res*/ \
+   Map<MatrixX##EIGPREFIX, 0, OuterStride<> > res_tmp(res,rows,cols,OuterStride<>(resStride)); \
+   res_tmp=res_tmp+b_tmp; \
+  } \
+};
+
+EIGEN_MKL_TRMM_R(double, double, d, d)
+EIGEN_MKL_TRMM_R(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_TRMM_R(float, float, f, s)
+EIGEN_MKL_TRMM_R(scomplex, MKL_Complex8, cf, c)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_TRIANGULAR_MATRIX_MATRIX_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h
index 71b4a52..b1c10c2 100644
--- a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h
@@ -3,45 +3,36 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULARMATRIXVECTOR_H
 #define EIGEN_TRIANGULARMATRIXVECTOR_H
 
+namespace Eigen { 
+
 namespace internal {
 
-template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder>
-struct product_triangular_matrix_vector;
+template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder, int Version=Specialized>
+struct triangular_matrix_vector_product;
 
-template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
-struct product_triangular_matrix_vector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor>
+template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int Version>
+struct triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor,Version>
 {
   typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
   enum {
     IsLower = ((Mode&Lower)==Lower),
-    HasUnitDiag = (Mode & UnitDiag)==UnitDiag
+    HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
+    HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
   };
-  static EIGEN_DONT_INLINE  void run(Index rows, Index cols, const LhsScalar* _lhs, Index lhsStride,
+  static EIGEN_DONT_INLINE  void run(Index _rows, Index _cols, const LhsScalar* _lhs, Index lhsStride,
                                      const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, ResScalar alpha)
   {
     static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
+    Index size = (std::min)(_rows,_cols);
+    Index rows = IsLower ? _rows : (std::min)(_rows,_cols);
+    Index cols = IsLower ? (std::min)(_rows,_cols) : _cols;
 
     typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;
     const LhsMap lhs(_lhs,rows,cols,OuterStride<>(lhsStride));
@@ -54,45 +45,57 @@ struct product_triangular_matrix_vector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,C
     typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;
     ResMap res(_res,rows);
 
-    for (Index pi=0; pi<cols; pi+=PanelWidth)
+    for (Index pi=0; pi<size; pi+=PanelWidth)
     {
-      Index actualPanelWidth = (std::min)(PanelWidth, cols-pi);
+      Index actualPanelWidth = (std::min)(PanelWidth, size-pi);
       for (Index k=0; k<actualPanelWidth; ++k)
       {
         Index i = pi + k;
-        Index s = IsLower ? (HasUnitDiag ? i+1 : i ) : pi;
+        Index s = IsLower ? ((HasUnitDiag||HasZeroDiag) ? i+1 : i ) : pi;
         Index r = IsLower ? actualPanelWidth-k : k+1;
-        if ((!HasUnitDiag) || (--r)>0)
+        if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
           res.segment(s,r) += (alpha * cjRhs.coeff(i)) * cjLhs.col(i).segment(s,r);
         if (HasUnitDiag)
           res.coeffRef(i) += alpha * cjRhs.coeff(i);
       }
-      Index r = IsLower ? cols - pi - actualPanelWidth : pi;
+      Index r = IsLower ? rows - pi - actualPanelWidth : pi;
       if (r>0)
       {
         Index s = IsLower ? pi+actualPanelWidth : 0;
-        general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjLhs,RhsScalar,ConjRhs>::run(
+        general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjLhs,RhsScalar,ConjRhs,BuiltIn>::run(
             r, actualPanelWidth,
             &lhs.coeffRef(s,pi), lhsStride,
             &rhs.coeffRef(pi), rhsIncr,
             &res.coeffRef(s), resIncr, alpha);
       }
     }
+    if((!IsLower) && cols>size)
+    {
+      general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjLhs,RhsScalar,ConjRhs>::run(
+          rows, cols-size,
+          &lhs.coeffRef(0,size), lhsStride,
+          &rhs.coeffRef(size), rhsIncr,
+          _res, resIncr, alpha);
+    }
   }
 };
 
-template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
-struct product_triangular_matrix_vector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor>
+template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs,int Version>
+struct triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor,Version>
 {
   typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
   enum {
     IsLower = ((Mode&Lower)==Lower),
-    HasUnitDiag = (Mode & UnitDiag)==UnitDiag
+    HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
+    HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
   };
-  static void run(Index rows, Index cols, const LhsScalar* _lhs, Index lhsStride,
+  static void run(Index _rows, Index _cols, const LhsScalar* _lhs, Index lhsStride,
                   const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, ResScalar alpha)
   {
     static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
+    Index diagSize = (std::min)(_rows,_cols);
+    Index rows = IsLower ? _rows : diagSize;
+    Index cols = IsLower ? diagSize : _cols;
 
     typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,RowMajor>, 0, OuterStride<> > LhsMap;
     const LhsMap lhs(_lhs,rows,cols,OuterStride<>(lhsStride));
@@ -105,15 +108,15 @@ struct product_triangular_matrix_vector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,C
     typedef Map<Matrix<ResScalar,Dynamic,1>, 0, InnerStride<> > ResMap;
     ResMap res(_res,rows,InnerStride<>(resIncr));
     
-    for (Index pi=0; pi<cols; pi+=PanelWidth)
+    for (Index pi=0; pi<diagSize; pi+=PanelWidth)
     {
-      Index actualPanelWidth = (std::min)(PanelWidth, cols-pi);
+      Index actualPanelWidth = (std::min)(PanelWidth, diagSize-pi);
       for (Index k=0; k<actualPanelWidth; ++k)
       {
         Index i = pi + k;
-        Index s = IsLower ? pi  : (HasUnitDiag ? i+1 : i);
+        Index s = IsLower ? pi  : ((HasUnitDiag||HasZeroDiag) ? i+1 : i);
         Index r = IsLower ? k+1 : actualPanelWidth-k;
-        if ((!HasUnitDiag) || (--r)>0)
+        if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
           res.coeffRef(i) += alpha * (cjLhs.row(i).segment(s,r).cwiseProduct(cjRhs.segment(s,r).transpose())).sum();
         if (HasUnitDiag)
           res.coeffRef(i) += alpha * cjRhs.coeff(i);
@@ -122,13 +125,21 @@ struct product_triangular_matrix_vector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,C
       if (r>0)
       {
         Index s = IsLower ? 0 : pi + actualPanelWidth;
-        general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjLhs,RhsScalar,ConjRhs>::run(
+        general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjLhs,RhsScalar,ConjRhs,BuiltIn>::run(
             actualPanelWidth, r,
             &lhs.coeffRef(pi,s), lhsStride,
             &rhs.coeffRef(s), rhsIncr,
             &res.coeffRef(pi), resIncr, alpha);
       }
     }
+    if(IsLower && rows>diagSize)
+    {
+      general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjLhs,RhsScalar,ConjRhs>::run(
+            rows-diagSize, cols,
+            &lhs.coeffRef(diagSize,0), lhsStride,
+            &rhs.coeffRef(0), rhsIncr,
+            &res.coeffRef(diagSize), resIncr, alpha);
+    }
   }
 };
 
@@ -180,7 +191,7 @@ struct TriangularProduct<Mode,false,Lhs,true,Rhs,false>
   {
     eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
 
-    typedef TriangularProduct<(Mode & UnitDiag) | ((Mode & Lower) ? Upper : Lower),true,Transpose<const Rhs>,false,Transpose<const Lhs>,true> TriangularProductTranspose;
+    typedef TriangularProduct<(Mode & (UnitDiag|ZeroDiag)) | ((Mode & Lower) ? Upper : Lower),true,Transpose<const Rhs>,false,Transpose<const Lhs>,true> TriangularProductTranspose;
     Transpose<Dest> dstT(dst);
     internal::trmv_selector<(int(internal::traits<Rhs>::Flags)&RowMajorBit) ? ColMajor : RowMajor>::run(
       TriangularProductTranspose(m_rhs.transpose(),m_lhs.transpose()), dstT, alpha);
@@ -208,8 +219,8 @@ template<> struct trmv_selector<ColMajor>
     typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
     typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
 
-    const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs());
-    const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs());
+    typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
+    typename internal::add_const_on_value_type<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
 
     ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
                                   * RhsBlasTraits::extractScalarFactor(prod.rhs());
@@ -247,7 +258,7 @@ template<> struct trmv_selector<ColMajor>
         MappedDest(actualDestPtr, dest.size()) = dest;
     }
     
-    internal::product_triangular_matrix_vector
+    internal::triangular_matrix_vector_product
       <Index,Mode,
        LhsScalar, LhsBlasTraits::NeedToConjugate,
        RhsScalar, RhsBlasTraits::NeedToConjugate,
@@ -307,7 +318,7 @@ template<> struct trmv_selector<RowMajor>
       Map<typename _ActualRhsType::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
     }
     
-    internal::product_triangular_matrix_vector
+    internal::triangular_matrix_vector_product
       <Index,Mode,
        LhsScalar, LhsBlasTraits::NeedToConjugate,
        RhsScalar, RhsBlasTraits::NeedToConjugate,
@@ -322,4 +333,6 @@ template<> struct trmv_selector<RowMajor>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRIANGULARMATRIXVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h
new file mode 100644
index 0000000..3589b8c
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h
@@ -0,0 +1,247 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Triangular matrix-vector product functionality based on ?TRMV.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_TRIANGULAR_MATRIX_VECTOR_MKL_H
+#define EIGEN_TRIANGULAR_MATRIX_VECTOR_MKL_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/**********************************************************************
+* This file implements triangular matrix-vector multiplication using BLAS
+**********************************************************************/
+
+// trmv/hemv specialization
+
+template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder>
+struct triangular_matrix_vector_product_trmv :
+  triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,StorageOrder,BuiltIn> {};
+
+#define EIGEN_MKL_TRMV_SPECIALIZE(Scalar) \
+template<typename Index, int Mode, bool ConjLhs, bool ConjRhs> \
+struct triangular_matrix_vector_product<Index,Mode,Scalar,ConjLhs,Scalar,ConjRhs,ColMajor,Specialized> { \
+ static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const Scalar* _lhs, Index lhsStride, \
+                                     const Scalar* _rhs, Index rhsIncr, Scalar* _res, Index resIncr, Scalar alpha) { \
+      triangular_matrix_vector_product_trmv<Index,Mode,Scalar,ConjLhs,Scalar,ConjRhs,ColMajor>::run( \
+        _rows, _cols, _lhs, lhsStride, _rhs, rhsIncr, _res, resIncr, alpha); \
+  } \
+}; \
+template<typename Index, int Mode, bool ConjLhs, bool ConjRhs> \
+struct triangular_matrix_vector_product<Index,Mode,Scalar,ConjLhs,Scalar,ConjRhs,RowMajor,Specialized> { \
+ static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const Scalar* _lhs, Index lhsStride, \
+                                     const Scalar* _rhs, Index rhsIncr, Scalar* _res, Index resIncr, Scalar alpha) { \
+      triangular_matrix_vector_product_trmv<Index,Mode,Scalar,ConjLhs,Scalar,ConjRhs,RowMajor>::run( \
+        _rows, _cols, _lhs, lhsStride, _rhs, rhsIncr, _res, resIncr, alpha); \
+  } \
+};
+
+EIGEN_MKL_TRMV_SPECIALIZE(double)
+EIGEN_MKL_TRMV_SPECIALIZE(float)
+EIGEN_MKL_TRMV_SPECIALIZE(dcomplex)
+EIGEN_MKL_TRMV_SPECIALIZE(scomplex)
+
+// implements col-major: res += alpha * op(triangular) * vector
+#define EIGEN_MKL_TRMV_CM(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template<typename Index, int Mode, bool ConjLhs, bool ConjRhs> \
+struct triangular_matrix_vector_product_trmv<Index,Mode,EIGTYPE,ConjLhs,EIGTYPE,ConjRhs,ColMajor> { \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    LowUp = IsLower ? Lower : Upper \
+  }; \
+ static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const EIGTYPE* _lhs, Index lhsStride, \
+                             const EIGTYPE* _rhs, Index rhsIncr, EIGTYPE* _res, Index resIncr, EIGTYPE alpha, level3_blocking<EIGTYPE,EIGTYPE>& blocking) \
+ { \
+   if (ConjLhs || IsZeroDiag) { \
+     triangular_matrix_vector_product<Index,Mode,EIGTYPE,ConjLhs,EIGTYPE,ConjRhs,ColMajor,BuiltIn>::run( \
+       _rows, _cols, _lhs, lhsStride, _rhs, rhsIncr, _res, resIncr, alpha, blocking); \
+     return; \
+   }\
+   Index size = (std::min)(_rows,_cols); \
+   Index rows = IsLower ? _rows : size; \
+   Index cols = IsLower ? size : _cols; \
+\
+   typedef VectorX##EIGPREFIX VectorRhs; \
+   EIGTYPE *x, *y;\
+\
+/* Set x*/ \
+   Map<const VectorRhs, 0, InnerStride<> > rhs(_rhs,cols,InnerStride<>(rhsIncr)); \
+   VectorRhs x_tmp; \
+   if (ConjRhs) x_tmp = rhs.conjugate(); else x_tmp = rhs; \
+   x = x_tmp.data(); \
+\
+/* Square part handling */\
+\
+   char trans, uplo, diag; \
+   MKL_INT m, n, lda, incx, incy; \
+   EIGTYPE const *a; \
+   MKLTYPE alpha_, beta_; \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(beta_, EIGTYPE(1)); \
+\
+/* Set m, n */ \
+   n = (MKL_INT)size; \
+   lda = lhsStride; \
+   incx = 1; \
+   incy = resIncr; \
+\
+/* Set uplo, trans and diag*/ \
+   trans = 'N'; \
+   uplo = IsLower ? 'L' : 'U'; \
+   diag = IsUnitDiag ? 'U' : 'N'; \
+\
+/* call ?TRMV*/ \
+   MKLPREFIX##trmv(&uplo, &trans, &diag, &n, (const MKLTYPE*)_lhs, &lda, (MKLTYPE*)x, &incx); \
+\
+/* Add op(a_tr)rhs into res*/ \
+   MKLPREFIX##axpy(&n, &alpha_,(const MKLTYPE*)x, &incx, (MKLTYPE*)_res, &incy); \
+/* Non-square case - doesn't fit to MKL ?TRMV. Fall to default triangular product*/ \
+   if (size<(std::max)(rows,cols)) { \
+     typedef Matrix<EIGTYPE, Dynamic, Dynamic> MatrixLhs; \
+     if (ConjRhs) x_tmp = rhs.conjugate(); else x_tmp = rhs; \
+     x = x_tmp.data(); \
+     if (size<rows) { \
+       y = _res + size*resIncr; \
+       a = _lhs + size; \
+       m = rows-size; \
+       n = size; \
+     } \
+     else { \
+       x += size; \
+       y = _res; \
+       a = _lhs + size*lda; \
+       m = size; \
+       n = cols-size; \
+     } \
+     MKLPREFIX##gemv(&trans, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)x, &incx, &beta_, (MKLTYPE*)y, &incy); \
+   } \
+  } \
+};
+
+EIGEN_MKL_TRMV_CM(double, double, d, d)
+EIGEN_MKL_TRMV_CM(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_TRMV_CM(float, float, f, s)
+EIGEN_MKL_TRMV_CM(scomplex, MKL_Complex8, cf, c)
+
+// implements row-major: res += alpha * op(triangular) * vector
+#define EIGEN_MKL_TRMV_RM(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \
+template<typename Index, int Mode, bool ConjLhs, bool ConjRhs> \
+struct triangular_matrix_vector_product_trmv<Index,Mode,EIGTYPE,ConjLhs,EIGTYPE,ConjRhs,RowMajor> { \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    LowUp = IsLower ? Lower : Upper \
+  }; \
+ static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const EIGTYPE* _lhs, Index lhsStride, \
+                             const EIGTYPE* _rhs, Index rhsIncr, EIGTYPE* _res, Index resIncr, EIGTYPE alpha, level3_blocking<EIGTYPE,EIGTYPE>& blocking) \
+ { \
+   if (IsZeroDiag) { \
+     triangular_matrix_vector_product<Index,Mode,EIGTYPE,ConjLhs,EIGTYPE,ConjRhs,RowMajor,BuiltIn>::run( \
+       _rows, _cols, _lhs, lhsStride, _rhs, rhsIncr, _res, resIncr, alpha, blocking); \
+     return; \
+   }\
+   Index size = (std::min)(_rows,_cols); \
+   Index rows = IsLower ? _rows : size; \
+   Index cols = IsLower ? size : _cols; \
+\
+   typedef VectorX##EIGPREFIX VectorRhs; \
+   EIGTYPE *x, *y;\
+\
+/* Set x*/ \
+   Map<const VectorRhs, 0, InnerStride<> > rhs(_rhs,cols,InnerStride<>(rhsIncr)); \
+   VectorRhs x_tmp; \
+   if (ConjRhs) x_tmp = rhs.conjugate(); else x_tmp = rhs; \
+   x = x_tmp.data(); \
+\
+/* Square part handling */\
+\
+   char trans, uplo, diag; \
+   MKL_INT m, n, lda, incx, incy; \
+   EIGTYPE const *a; \
+   MKLTYPE alpha_, beta_; \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(alpha_, alpha); \
+   assign_scalar_eig2mkl<MKLTYPE, EIGTYPE>(beta_, EIGTYPE(1)); \
+\
+/* Set m, n */ \
+   n = (MKL_INT)size; \
+   lda = lhsStride; \
+   incx = 1; \
+   incy = resIncr; \
+\
+/* Set uplo, trans and diag*/ \
+   trans = ConjLhs ? 'C' : 'T'; \
+   uplo = IsLower ? 'U' : 'L'; \
+   diag = IsUnitDiag ? 'U' : 'N'; \
+\
+/* call ?TRMV*/ \
+   MKLPREFIX##trmv(&uplo, &trans, &diag, &n, (const MKLTYPE*)_lhs, &lda, (MKLTYPE*)x, &incx); \
+\
+/* Add op(a_tr)rhs into res*/ \
+   MKLPREFIX##axpy(&n, &alpha_,(const MKLTYPE*)x, &incx, (MKLTYPE*)_res, &incy); \
+/* Non-square case - doesn't fit to MKL ?TRMV. Fall to default triangular product*/ \
+   if (size<(std::max)(rows,cols)) { \
+     typedef Matrix<EIGTYPE, Dynamic, Dynamic> MatrixLhs; \
+     if (ConjRhs) x_tmp = rhs.conjugate(); else x_tmp = rhs; \
+     x = x_tmp.data(); \
+     if (size<rows) { \
+       y = _res + size*resIncr; \
+       a = _lhs + size*lda; \
+       m = rows-size; \
+       n = size; \
+     } \
+     else { \
+       x += size; \
+       y = _res; \
+       a = _lhs + size; \
+       m = size; \
+       n = cols-size; \
+     } \
+     MKLPREFIX##gemv(&trans, &n, &m, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)x, &incx, &beta_, (MKLTYPE*)y, &incy); \
+   } \
+  } \
+};
+
+EIGEN_MKL_TRMV_RM(double, double, d, d)
+EIGEN_MKL_TRMV_RM(dcomplex, MKL_Complex16, cd, z)
+EIGEN_MKL_TRMV_RM(float, float, f, s)
+EIGEN_MKL_TRMV_RM(scomplex, MKL_Complex8, cf, c)
+
+} // end namespase internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_TRIANGULAR_MATRIX_VECTOR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h
index 4dced6b..a49ea31 100644
--- a/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_H
 #define EIGEN_TRIANGULAR_SOLVER_MATRIX_H
 
+namespace Eigen { 
+
 namespace internal {
 
 // if the rhs is row major, let's transpose the product
@@ -34,14 +21,15 @@ struct triangular_solve_matrix<Scalar,Index,Side,Mode,Conjugate,TriStorageOrder,
   static EIGEN_DONT_INLINE void run(
     Index size, Index cols,
     const Scalar*  tri, Index triStride,
-    Scalar* _other, Index otherStride)
+    Scalar* _other, Index otherStride,
+    level3_blocking<Scalar,Scalar>& blocking)
   {
     triangular_solve_matrix<
       Scalar, Index, Side==OnTheLeft?OnTheRight:OnTheLeft,
       (Mode&UnitDiag) | ((Mode&Upper) ? Lower : Upper),
       NumTraits<Scalar>::IsComplex && Conjugate,
       TriStorageOrder==RowMajor ? ColMajor : RowMajor, ColMajor>
-      ::run(size, cols, tri, triStride, _other, otherStride);
+      ::run(size, cols, tri, triStride, _other, otherStride, blocking);
   }
 };
 
@@ -53,7 +41,8 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
   static EIGEN_DONT_INLINE void run(
     Index size, Index otherSize,
     const Scalar* _tri, Index triStride,
-    Scalar* _other, Index otherStride)
+    Scalar* _other, Index otherStride,
+    level3_blocking<Scalar,Scalar>& blocking)
   {
     Index cols = otherSize;
     const_blas_data_mapper<Scalar, Index, TriStorageOrder> tri(_tri,triStride);
@@ -65,22 +54,29 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
       IsLower = (Mode&Lower) == Lower
     };
 
-    Index kc = size; // cache block size along the K direction
-    Index mc = size;  // cache block size along the M direction
-    Index nc = cols;  // cache block size along the N direction
-    computeProductBlockingSizes<Scalar,Scalar,4>(kc, mc, nc);
+    Index kc = blocking.kc();                   // cache block size along the K direction
+    Index mc = (std::min)(size,blocking.mc());  // cache block size along the M direction
 
+    std::size_t sizeA = kc*mc;
+    std::size_t sizeB = kc*cols;
     std::size_t sizeW = kc*Traits::WorkSpaceFactor;
-    std::size_t sizeB = sizeW + kc*cols;
-    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0);
-    ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0);
-    Scalar* blockB = allocatedBlockB + sizeW;
+
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, sizeA, blocking.blockA());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockB, sizeB, blocking.blockB());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockW, sizeW, blocking.blockW());
 
     conj_if<Conjugate> conj;
     gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, Conjugate, false> gebp_kernel;
     gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, TriStorageOrder> pack_lhs;
     gemm_pack_rhs<Scalar, Index, Traits::nr, ColMajor, false, true> pack_rhs;
 
+    // the goal here is to subdivise the Rhs panels such that we keep some cache
+    // coherence when accessing the rhs elements
+    std::ptrdiff_t l1, l2;
+    manage_caching_sizes(GetAction, &l1, &l2);
+    Index subcols = cols>0 ? l2/(4 * sizeof(Scalar) * otherStride) : 0;
+    subcols = std::max<Index>((subcols/Traits::nr)*Traits::nr, Traits::nr);
+
     for(Index k2=IsLower ? 0 : size;
         IsLower ? k2<size : k2>0;
         IsLower ? k2+=kc : k2-=kc)
@@ -92,16 +88,18 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
       // A11 (the triangular part) and A21 the remaining rectangular part.
       // Then the high level algorithm is:
       //  - B = R1                    => general block copy (done during the next step)
-      //  - R1 = L1^-1 B              => tricky part
+      //  - R1 = A11^-1 B             => tricky part
       //  - update B from the new R1  => actually this has to be performed continuously during the above step
-      //  - R2 = L2 * B               => GEPP
+      //  - R2 -= A21 * B             => GEPP
 
-      // The tricky part: compute R1 = L1^-1 B while updating B from R1
-      // The idea is to split L1 into multiple small vertical panels.
-      // Each panel can be split into a small triangular part A1 which is processed without optimization,
-      // and the remaining small part A2 which is processed using gebp with appropriate block strides
+      // The tricky part: compute R1 = A11^-1 B while updating B from R1
+      // The idea is to split A11 into multiple small vertical panels.
+      // Each panel can be split into a small triangular part T1k which is processed without optimization,
+      // and the remaining small part T2k which is processed using gebp with appropriate block strides
+      for(Index j2=0; j2<cols; j2+=subcols)
       {
-        // for each small vertical panels of lhs
+        Index actual_cols = (std::min)(cols-j2,subcols);
+        // for each small vertical panels [T1k^T, T2k^T]^T of lhs
         for (Index k1=0; k1<actual_kc; k1+=SmallPanelWidth)
         {
           Index actualPanelWidth = std::min<Index>(actual_kc-k1, SmallPanelWidth);
@@ -114,11 +112,11 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
             Index rs = actualPanelWidth - k - 1; // remaining size
 
             Scalar a = (Mode & UnitDiag) ? Scalar(1) : Scalar(1)/conj(tri(i,i));
-            for (Index j=0; j<cols; ++j)
+            for (Index j=j2; j<j2+actual_cols; ++j)
             {
               if (TriStorageOrder==RowMajor)
               {
-                Scalar b = 0;
+                Scalar b(0);
                 const Scalar* l = &tri(i,s);
                 Scalar* r = &other(s,j);
                 for (Index i3=0; i3<k; ++i3)
@@ -143,7 +141,7 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
           Index blockBOffset = IsLower ? k1 : lengthTarget;
 
           // update the respective rows of B from other
-          pack_rhs(blockB, _other+startBlock, otherStride, actualPanelWidth, cols, actual_kc, blockBOffset);
+          pack_rhs(blockB+actual_kc*j2, &other(startBlock,j2), otherStride, actualPanelWidth, actual_cols, actual_kc, blockBOffset);
 
           // GEBP
           if (lengthTarget>0)
@@ -152,13 +150,13 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
 
             pack_lhs(blockA, &tri(startTarget,startBlock), triStride, actualPanelWidth, lengthTarget);
 
-            gebp_kernel(_other+startTarget, otherStride, blockA, blockB, lengthTarget, actualPanelWidth, cols, Scalar(-1),
-                        actualPanelWidth, actual_kc, 0, blockBOffset);
+            gebp_kernel(&other(startTarget,j2), otherStride, blockA, blockB+actual_kc*j2, lengthTarget, actualPanelWidth, actual_cols, Scalar(-1),
+                        actualPanelWidth, actual_kc, 0, blockBOffset, blockW);
           }
         }
       }
-
-      // R2 = A2 * B => GEPP
+      
+      // R2 -= A21 * B => GEPP
       {
         Index start = IsLower ? k2+kc : 0;
         Index end   = IsLower ? size : k2-kc;
@@ -169,7 +167,7 @@ struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageO
           {
             pack_lhs(blockA, &tri(i2, IsLower ? k2 : k2-kc), triStride, actual_kc, actual_mc);
 
-            gebp_kernel(_other+i2, otherStride, blockA, blockB, actual_mc, actual_kc, cols, Scalar(-1));
+            gebp_kernel(_other+i2, otherStride, blockA, blockB, actual_mc, actual_kc, cols, Scalar(-1), -1, -1, 0, 0, blockW);
           }
         }
       }
@@ -185,7 +183,8 @@ struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorage
   static EIGEN_DONT_INLINE void run(
     Index size, Index otherSize,
     const Scalar* _tri, Index triStride,
-    Scalar* _other, Index otherStride)
+    Scalar* _other, Index otherStride,
+    level3_blocking<Scalar,Scalar>& blocking)
   {
     Index rows = otherSize;
     const_blas_data_mapper<Scalar, Index, TriStorageOrder> rhs(_tri,triStride);
@@ -198,19 +197,16 @@ struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorage
       IsLower = (Mode&Lower) == Lower
     };
 
-//     Index kc = std::min<Index>(Traits::Max_kc/4,size); // cache block size along the K direction
-//     Index mc = std::min<Index>(Traits::Max_mc,size);   // cache block size along the M direction
-    // check that !!!!
-    Index kc = size; // cache block size along the K direction
-    Index mc = size;  // cache block size along the M direction
-    Index nc = rows;  // cache block size along the N direction
-    computeProductBlockingSizes<Scalar,Scalar,4>(kc, mc, nc);
+    Index kc = blocking.kc();                   // cache block size along the K direction
+    Index mc = (std::min)(rows,blocking.mc());  // cache block size along the M direction
 
+    std::size_t sizeA = kc*mc;
+    std::size_t sizeB = kc*size;
     std::size_t sizeW = kc*Traits::WorkSpaceFactor;
-    std::size_t sizeB = sizeW + kc*size;
-    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0);
-    ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0);
-    Scalar* blockB = allocatedBlockB + sizeW;
+
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockA, sizeA, blocking.blockA());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockB, sizeB, blocking.blockB());
+    ei_declare_aligned_stack_constructed_variable(Scalar, blockW, sizeW, blocking.blockW());
 
     conj_if<Conjugate> conj;
     gebp_kernel<Scalar,Scalar, Index, Traits::mr, Traits::nr, false, Conjugate> gebp_kernel;
@@ -277,7 +273,7 @@ struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorage
                           Scalar(-1),
                           actual_kc, actual_kc, // strides
                           panelOffset, panelOffset, // offsets
-                          allocatedBlockB);  // workspace
+                          blockW);  // workspace
             }
 
             // unblocked triangular solve
@@ -308,7 +304,7 @@ struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorage
         if (rs>0)
           gebp_kernel(_other+i2+startPanel*otherStride, otherStride, blockA, geb,
                       actual_mc, actual_kc, rs, Scalar(-1),
-                      -1, -1, 0, 0, allocatedBlockB);
+                      -1, -1, 0, 0, blockW);
       }
     }
   }
@@ -316,4 +312,6 @@ struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorage
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRIANGULAR_SOLVER_MATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h
new file mode 100644
index 0000000..a4f508b
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h
@@ -0,0 +1,155 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Triangular matrix * matrix product functionality based on ?TRMM.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H
+#define EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H
+
+namespace Eigen {
+
+namespace internal {
+
+// implements LeftSide op(triangular)^-1 * general
+#define EIGEN_MKL_TRSM_L(EIGTYPE, MKLTYPE, MKLPREFIX) \
+template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
+struct triangular_solve_matrix<EIGTYPE,Index,OnTheLeft,Mode,Conjugate,TriStorageOrder,ColMajor> \
+{ \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
+  }; \
+  static EIGEN_DONT_INLINE void run( \
+      Index size, Index otherSize, \
+      const EIGTYPE* _tri, Index triStride, \
+      EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& /*blocking*/) \
+  { \
+   MKL_INT m = size, n = otherSize, lda, ldb; \
+   char side = 'L', uplo, diag='N', transa; \
+   /* Set alpha_ */ \
+   MKLTYPE alpha; \
+   EIGTYPE myone(1); \
+   assign_scalar_eig2mkl(alpha, myone); \
+   ldb = otherStride;\
+\
+   const EIGTYPE *a; \
+/* Set trans */ \
+   transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
+/* Set uplo */ \
+   uplo = IsLower ? 'L' : 'U'; \
+   if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
+/* Set a, lda */ \
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
+   Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
+   MatrixTri a_tmp; \
+\
+   if (conjA) { \
+     a_tmp = tri.conjugate(); \
+     a = a_tmp.data(); \
+     lda = a_tmp.outerStride(); \
+   } else { \
+     a = _tri; \
+     lda = triStride; \
+   } \
+   if (IsUnitDiag) diag='U'; \
+/* call ?trsm*/ \
+   MKLPREFIX##trsm(&side, &uplo, &transa, &diag, &m, &n, &alpha, (const MKLTYPE*)a, &lda, (MKLTYPE*)_other, &ldb); \
+ } \
+};
+
+EIGEN_MKL_TRSM_L(double, double, d)
+EIGEN_MKL_TRSM_L(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_TRSM_L(float, float, s)
+EIGEN_MKL_TRSM_L(scomplex, MKL_Complex8, c)
+
+
+// implements RightSide general * op(triangular)^-1
+#define EIGEN_MKL_TRSM_R(EIGTYPE, MKLTYPE, MKLPREFIX) \
+template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
+struct triangular_solve_matrix<EIGTYPE,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor> \
+{ \
+  enum { \
+    IsLower = (Mode&Lower) == Lower, \
+    IsUnitDiag  = (Mode&UnitDiag) ? 1 : 0, \
+    IsZeroDiag  = (Mode&ZeroDiag) ? 1 : 0, \
+    conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
+  }; \
+  static EIGEN_DONT_INLINE void run( \
+      Index size, Index otherSize, \
+      const EIGTYPE* _tri, Index triStride, \
+      EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& /*blocking*/) \
+  { \
+   MKL_INT m = otherSize, n = size, lda, ldb; \
+   char side = 'R', uplo, diag='N', transa; \
+   /* Set alpha_ */ \
+   MKLTYPE alpha; \
+   EIGTYPE myone(1); \
+   assign_scalar_eig2mkl(alpha, myone); \
+   ldb = otherStride;\
+\
+   const EIGTYPE *a; \
+/* Set trans */ \
+   transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
+/* Set uplo */ \
+   uplo = IsLower ? 'L' : 'U'; \
+   if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
+/* Set a, lda */ \
+   typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
+   Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
+   MatrixTri a_tmp; \
+\
+   if (conjA) { \
+     a_tmp = tri.conjugate(); \
+     a = a_tmp.data(); \
+     lda = a_tmp.outerStride(); \
+   } else { \
+     a = _tri; \
+     lda = triStride; \
+   } \
+   if (IsUnitDiag) diag='U'; \
+/* call ?trsm*/ \
+   MKLPREFIX##trsm(&side, &uplo, &transa, &diag, &m, &n, &alpha, (const MKLTYPE*)a, &lda, (MKLTYPE*)_other, &ldb); \
+   /*std::cout << "TRMS_L specialization!\n";*/ \
+ } \
+};
+
+EIGEN_MKL_TRSM_R(double, double, d)
+EIGEN_MKL_TRSM_R(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_TRSM_R(float, float, s)
+EIGEN_MKL_TRSM_R(scomplex, MKL_Complex8, c)
+
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Core/products/TriangularSolverVector.h b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverVector.h
index 639d4a5..ce4d100 100644
--- a/extern/Eigen3/Eigen/src/Core/products/TriangularSolverVector.h
+++ b/extern/Eigen3/Eigen/src/Core/products/TriangularSolverVector.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULAR_SOLVER_VECTOR_H
 #define EIGEN_TRIANGULAR_SOLVER_VECTOR_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate, int StorageOrder>
@@ -147,4 +134,6 @@ struct triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Con
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRIANGULAR_SOLVER_VECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/BlasUtil.h b/extern/Eigen3/Eigen/src/Core/util/BlasUtil.h
index f1d93d2..9149665 100644
--- a/extern/Eigen3/Eigen/src/Core/util/BlasUtil.h
+++ b/extern/Eigen3/Eigen/src/Core/util/BlasUtil.h
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BLASUTIL_H
 #define EIGEN_BLASUTIL_H
@@ -28,6 +13,8 @@
 // This file contains many lightweight helper classes used to
 // implement and control fast level 2 and level 3 BLAS-like routines.
 
+namespace Eigen {
+
 namespace internal {
 
 // forward declarations
@@ -47,7 +34,7 @@ template<
   int ResStorageOrder>
 struct general_matrix_matrix_product;
 
-template<typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
+template<typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs, int Version=Specialized>
 struct general_matrix_vector_product;
 
 
@@ -56,11 +43,15 @@ template<bool Conjugate> struct conj_if;
 template<> struct conj_if<true> {
   template<typename T>
   inline T operator()(const T& x) { return conj(x); }
+  template<typename T>
+  inline T pconj(const T& x) { return internal::pconj(x); }
 };
 
 template<> struct conj_if<false> {
   template<typename T>
   inline const T& operator()(const T& x) { return x; }
+  template<typename T>
+  inline const T& pconj(const T& x) { return x; }
 };
 
 template<typename Scalar> struct conj_helper<Scalar,Scalar,false,false>
@@ -118,11 +109,11 @@ template<typename RealScalar,bool Conj> struct conj_helper<RealScalar, std::comp
 };
 
 template<typename From,typename To> struct get_factor {
-  EIGEN_STRONG_INLINE static To run(const From& x) { return x; }
+  static EIGEN_STRONG_INLINE To run(const From& x) { return x; }
 };
 
 template<typename Scalar> struct get_factor<Scalar,typename NumTraits<Scalar>::Real> {
-  EIGEN_STRONG_INLINE static typename NumTraits<Scalar>::Real run(const Scalar& x) { return real(x); }
+  static EIGEN_STRONG_INLINE typename NumTraits<Scalar>::Real run(const Scalar& x) { return real(x); }
 };
 
 // Lightweight helper class to access matrix coefficients.
@@ -175,7 +166,7 @@ template<typename XprType> struct blas_traits
     ExtractType,
     typename _ExtractType::PlainObject
     >::type DirectLinearAccessType;
-  static inline const ExtractType extract(const XprType& x) { return x; }
+  static inline ExtractType extract(const XprType& x) { return x; }
   static inline const Scalar extractScalarFactor(const XprType&) { return Scalar(1); }
 };
 
@@ -192,7 +183,7 @@ struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> >
     IsComplex = NumTraits<Scalar>::IsComplex,
     NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
   };
-  static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
+  static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
   static inline Scalar extractScalarFactor(const XprType& x) { return conj(Base::extractScalarFactor(x.nestedExpression())); }
 };
 
@@ -204,7 +195,7 @@ struct blas_traits<CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> >
   typedef blas_traits<NestedXpr> Base;
   typedef CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> XprType;
   typedef typename Base::ExtractType ExtractType;
-  static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
+  static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
   static inline Scalar extractScalarFactor(const XprType& x)
   { return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); }
 };
@@ -217,7 +208,7 @@ struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> >
   typedef blas_traits<NestedXpr> Base;
   typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType;
   typedef typename Base::ExtractType ExtractType;
-  static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
+  static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
   static inline Scalar extractScalarFactor(const XprType& x)
   { return - Base::extractScalarFactor(x.nestedExpression()); }
 };
@@ -239,7 +230,7 @@ struct blas_traits<Transpose<NestedXpr> >
   enum {
     IsTransposed = Base::IsTransposed ? 0 : 1
   };
-  static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
+  static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
   static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
 };
 
@@ -252,7 +243,7 @@ template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectA
 struct extract_data_selector {
   static const typename T::Scalar* run(const T& m)
   {
-    return const_cast<typename T::Scalar*>(&blas_traits<T>::extract(m).coeffRef(0,0)); // FIXME this should be .data()
+    return blas_traits<T>::extract(m).data();
   }
 };
 
@@ -268,4 +259,6 @@ template<typename T> const typename T::Scalar* extract_data(const T& m)
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_BLASUTIL_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/Constants.h b/extern/Eigen3/Eigen/src/Core/util/Constants.h
index c3dd3a0..3fd45e8 100644
--- a/extern/Eigen3/Eigen/src/Core/util/Constants.h
+++ b/extern/Eigen3/Eigen/src/Core/util/Constants.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CONSTANTS_H
 #define EIGEN_CONSTANTS_H
 
+namespace Eigen {
+
 /** This value means that a quantity is not known at compile-time, and that instead the value is
   * stored in some runtime variable.
   *
@@ -188,7 +175,9 @@ enum {
   /** View matrix as an upper triangular matrix with zeros on the diagonal. */
   StrictlyUpper=ZeroDiag|Upper,
   /** Used in BandMatrix and SelfAdjointView to indicate that the matrix is self-adjoint. */
-  SelfAdjoint=0x10
+  SelfAdjoint=0x10,
+  /** Used to support symmetric, non-selfadjoint, complex matrices. */
+  Symmetric=0x20
 };
 
 /** \ingroup enums
@@ -200,8 +189,6 @@ enum {
   Aligned=1 
 };
 
-enum { ConditionalJumpCost = 5 };
-
 /** \ingroup enums
  * Enum used by DenseBase::corner() in Eigen2 compatibility mode. */
 // FIXME after the corner() API change, this was not needed anymore, except by AlignedBox
@@ -223,8 +210,6 @@ enum DirectionType {
   BothDirections 
 };
 
-enum ProductEvaluationMode { NormalProduct, CacheFriendlyProduct };
-
 /** \internal \ingroup enums
   * Enum to specify how to traverse the entries of a matrix. */
 enum {
@@ -257,6 +242,13 @@ enum {
   CompleteUnrolling
 };
 
+/** \internal \ingroup enums
+  * Enum to specify whether to use the default (built-in) implementation or the specialization. */
+enum {
+  Specialized,
+  BuiltIn
+};
+
 /** \ingroup enums
   * Enum containing possible values for the \p _Options template parameter of
   * Matrix, Array and BandMatrix. */
@@ -280,26 +272,21 @@ enum {
   OnTheRight = 2  
 };
 
-/* the following could as well be written:
- *   enum NoChange_t { NoChange };
- * but it feels dangerous to disambiguate overloaded functions on enum/integer types.
- * If on some platform it is really impossible to get rid of "unused variable" warnings, then
- * we can always come back to that solution.
+/* the following used to be written as:
+ *
+ *   struct NoChange_t {};
+ *   namespace {
+ *     EIGEN_UNUSED NoChange_t NoChange;
+ *   }
+ *
+ * on the ground that it feels dangerous to disambiguate overloaded functions on enum/integer types.  
+ * However, this leads to "variable declared but never referenced" warnings on Intel Composer XE,
+ * and we do not know how to get rid of them (bug 450).
  */
-struct NoChange_t {};
-namespace {
-  EIGEN_UNUSED NoChange_t NoChange;
-}
-
-struct Sequential_t {};
-namespace {
-  EIGEN_UNUSED Sequential_t Sequential;
-}
 
-struct Default_t {};
-namespace {
-  EIGEN_UNUSED Default_t Default;
-}
+enum NoChange_t   { NoChange };
+enum Sequential_t { Sequential };
+enum Default_t    { Default };
 
 /** \internal \ingroup enums
   * Used in AmbiVector. */
@@ -375,7 +362,7 @@ enum QRPreconditioners {
 #error The preprocessor symbol 'Success' is defined, possibly by the X11 header file X.h
 #endif
 
-/** \ingroups enums
+/** \ingroup enums
   * Enum for reporting the status of a computation. */
 enum ComputationInfo {
   /** Computation was successful. */
@@ -383,7 +370,10 @@ enum ComputationInfo {
   /** The provided data did not satisfy the prerequisites. */
   NumericalIssue = 1, 
   /** Iterative procedure did not converge. */
-  NoConvergence = 2
+  NoConvergence = 2,
+  /** The inputs are invalid, or the algorithm has been improperly called.
+    * When assertions are enabled, such errors trigger an assert. */
+  InvalidInput = 3
 };
 
 /** \ingroup enums
@@ -436,4 +426,6 @@ struct MatrixXpr {};
 /** The type used to identify an array expression */
 struct ArrayXpr {};
 
+} // end namespace Eigen
+
 #endif // EIGEN_CONSTANTS_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h b/extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h
index 0073052..6a0bf06 100644
--- a/extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h
+++ b/extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h
@@ -21,15 +21,13 @@
 #elif defined __INTEL_COMPILER
   // 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
   //        ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body
-  // 2536 - type qualifiers are meaningless here
-  //        ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent
   //        typedef that may be a reference type.
   // 279  - controlling expression is constant
   //        ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
   #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
     #pragma warning push
   #endif
-  #pragma warning disable 2196 2536 279
+  #pragma warning disable 2196 279
 #elif defined __clang__
   // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
   //     this is really a stupid warning as it warns on compile-time expressions involving enums
diff --git a/extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h b/extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
index 7fbccf9..bcdfe39 100644
--- a/extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
@@ -4,28 +4,14 @@
 // Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FORWARDDECLARATIONS_H
 #define EIGEN_FORWARDDECLARATIONS_H
 
+namespace Eigen {
 namespace internal {
 
 template<typename T> struct traits;
@@ -133,6 +119,7 @@ template<typename ExpressionType> class WithFormat;
 template<typename MatrixType> struct CommaInitializer;
 template<typename Derived> class ReturnByValue;
 template<typename ExpressionType> class ArrayWrapper;
+template<typename ExpressionType> class MatrixWrapper;
 
 namespace internal {
 template<typename DecompositionType, typename Rhs> struct solve_retval_base;
@@ -282,6 +269,8 @@ template<typename MatrixType,int Direction> class Homogeneous;
 // MatrixFunctions module
 template<typename Derived> struct MatrixExponentialReturnValue;
 template<typename Derived> class MatrixFunctionReturnValue;
+template<typename Derived> class MatrixSquareRootReturnValue;
+template<typename Derived> class MatrixLogarithmReturnValue;
 
 namespace internal {
 template <typename Scalar>
@@ -304,4 +293,6 @@ template<typename MatrixType, unsigned int Mode> struct eigen2_part_return_type;
 }
 #endif
 
+} // end namespace Eigen
+
 #endif // EIGEN_FORWARDDECLARATIONS_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/MKL_support.h b/extern/Eigen3/Eigen/src/Core/util/MKL_support.h
new file mode 100644
index 0000000..1e6e355
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/util/MKL_support.h
@@ -0,0 +1,109 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *   Include file with common MKL declarations
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_MKL_SUPPORT_H
+#define EIGEN_MKL_SUPPORT_H
+
+#ifdef EIGEN_USE_MKL_ALL
+  #ifndef EIGEN_USE_BLAS
+    #define EIGEN_USE_BLAS
+  #endif
+  #ifndef EIGEN_USE_LAPACKE
+    #define EIGEN_USE_LAPACKE
+  #endif
+  #ifndef EIGEN_USE_MKL_VML
+    #define EIGEN_USE_MKL_VML
+  #endif
+#endif
+
+#ifdef EIGEN_USE_LAPACKE_STRICT
+  #define EIGEN_USE_LAPACKE
+#endif
+
+#if defined(EIGEN_USE_BLAS) || defined(EIGEN_USE_LAPACKE) || defined(EIGEN_USE_MKL_VML)
+  #define EIGEN_USE_MKL
+#endif
+
+#if defined EIGEN_USE_MKL
+
+#include <mkl.h>
+#include <mkl_lapacke.h>
+#define EIGEN_MKL_VML_THRESHOLD 128
+
+namespace Eigen {
+
+typedef std::complex<double> dcomplex;
+typedef std::complex<float>  scomplex;
+
+namespace internal {
+
+template<typename MKLType, typename EigenType>
+static inline void assign_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
+  mklScalar=eigenScalar;
+}
+
+template<typename MKLType, typename EigenType>
+static inline void assign_conj_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
+  mklScalar=eigenScalar;
+}
+
+template <>
+inline void assign_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
+  mklScalar.real=eigenScalar.real();
+  mklScalar.imag=eigenScalar.imag();
+}
+
+template <>
+inline void assign_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
+  mklScalar.real=eigenScalar.real();
+  mklScalar.imag=eigenScalar.imag();
+}
+
+template <>
+inline void assign_conj_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
+  mklScalar.real=eigenScalar.real();
+  mklScalar.imag=-eigenScalar.imag();
+}
+
+template <>
+inline void assign_conj_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
+  mklScalar.real=eigenScalar.real();
+  mklScalar.imag=-eigenScalar.imag();
+}
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif
+
+#endif // EIGEN_MKL_SUPPORT_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/Macros.h b/extern/Eigen3/Eigen/src/Core/util/Macros.h
index b7c2b79..d973a68 100644
--- a/extern/Eigen3/Eigen/src/Core/util/Macros.h
+++ b/extern/Eigen3/Eigen/src/Core/util/Macros.h
@@ -1,35 +1,19 @@
-
 // This file is part of Eigen, a lightweight C++ template library
 // for linear algebra.
 //
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MACROS_H
 #define EIGEN_MACROS_H
 
 #define EIGEN_WORLD_VERSION 3
-#define EIGEN_MAJOR_VERSION 0
-#define EIGEN_MINOR_VERSION 5
+#define EIGEN_MAJOR_VERSION 1
+#define EIGEN_MINOR_VERSION 1
 
 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
                                       (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
@@ -235,12 +219,16 @@
 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
 #endif
 
-#if (defined __GNUC__)
-#define EIGEN_DEPRECATED __attribute__((deprecated))
-#elif (defined _MSC_VER)
-#define EIGEN_DEPRECATED __declspec(deprecated)
+#ifndef EIGEN_NO_DEPRECATED_WARNING
+  #if (defined __GNUC__)
+    #define EIGEN_DEPRECATED __attribute__((deprecated))
+  #elif (defined _MSC_VER)
+    #define EIGEN_DEPRECATED __declspec(deprecated)
+  #else
+    #define EIGEN_DEPRECATED
+  #endif
 #else
-#define EIGEN_DEPRECATED
+  #define EIGEN_DEPRECATED
 #endif
 
 #if (defined __GNUC__)
@@ -252,7 +240,7 @@
 // Suppresses 'unused variable' warnings.
 #define EIGEN_UNUSED_VARIABLE(var) (void)var;
 
-#if (defined __GNUC__)
+#if !defined(EIGEN_ASM_COMMENT) && (defined __GNUC__)
 #define EIGEN_ASM_COMMENT(X)  asm("#" X)
 #else
 #define EIGEN_ASM_COMMENT(X)
@@ -265,7 +253,7 @@
  * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
  * vectorized and non-vectorized code.
  */
-#if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
+#if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__) || (defined __ARMCC_VERSION)
   #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
 #elif (defined _MSC_VER)
   #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
diff --git a/extern/Eigen3/Eigen/src/Core/util/Memory.h b/extern/Eigen3/Eigen/src/Core/util/Memory.h
index 023716d..6e06ace 100644
--- a/extern/Eigen3/Eigen/src/Core/util/Memory.h
+++ b/extern/Eigen3/Eigen/src/Core/util/Memory.h
@@ -7,24 +7,9 @@
 // Copyright (C) 2010 Hauke Heibel <hauke.heibel at gmail.com>
 // Copyright (C) 2010 Thomas Capricelli <orzel at freehackers.org>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 /*****************************************************************************
@@ -80,6 +65,8 @@
   #define EIGEN_HAS_MM_MALLOC 0
 #endif
 
+namespace Eigen {
+
 namespace internal {
 
 inline void throw_std_bad_alloc()
@@ -457,7 +444,7 @@ template<typename T, bool Align> inline void conditional_aligned_delete_auto(T *
   * There is also the variant first_aligned(const MatrixBase&) defined in DenseCoeffsBase.h.
   */
 template<typename Scalar, typename Index>
-inline static Index first_aligned(const Scalar* array, Index size)
+static inline Index first_aligned(const Scalar* array, Index size)
 {
   typedef typename packet_traits<Scalar>::type Packet;
   enum { PacketSize = packet_traits<Scalar>::size,
@@ -483,7 +470,26 @@ inline static Index first_aligned(const Scalar* array, Index size)
   }
 }
 
-} // end namespace internal
+
+// std::copy is much slower than memcpy, so let's introduce a smart_copy which
+// use memcpy on trivial types, i.e., on types that does not require an initialization ctor.
+template<typename T, bool UseMemcpy> struct smart_copy_helper;
+
+template<typename T> void smart_copy(const T* start, const T* end, T* target)
+{
+  smart_copy_helper<T,!NumTraits<T>::RequireInitialization>::run(start, end, target);
+}
+
+template<typename T> struct smart_copy_helper<T,true> {
+  static inline void run(const T* start, const T* end, T* target)
+  { memcpy(target, start, std::ptrdiff_t(end)-std::ptrdiff_t(start)); }
+};
+
+template<typename T> struct smart_copy_helper<T,false> {
+  static inline void run(const T* start, const T* end, T* target)
+  { std::copy(start, end, target); }
+};
+
 
 /*****************************************************************************
 *** Implementation of runtime stack allocation (falling back to malloc)    ***
@@ -499,8 +505,6 @@ inline static Index first_aligned(const Scalar* array, Index size)
   #endif
 #endif
 
-namespace internal {
-
 // This helper class construct the allocated memory, and takes care of destructing and freeing the handled data
 // at destruction time. In practice this helper class is mainly useful to avoid memory leak in case of exceptions.
 template<typename T> class aligned_stack_memory_handler
@@ -531,14 +535,14 @@ template<typename T> class aligned_stack_memory_handler
     bool m_deallocate;
 };
 
-}
+} // end namespace internal
 
 /** \internal
   * Declares, allocates and construct an aligned buffer named NAME of SIZE elements of type TYPE on the stack
   * if SIZE is smaller than EIGEN_STACK_ALLOCATION_LIMIT, and if stack allocation is supported by the platform
   * (currently, this is Linux and Visual Studio only). Otherwise the memory is allocated on the heap.
   * The allocated buffer is automatically deleted when exiting the scope of this declaration.
-  * If BUFFER is non nul, then the declared variable is simply an alias for BUFFER, and no allocation/deletion occurs.
+  * If BUFFER is non null, then the declared variable is simply an alias for BUFFER, and no allocation/deletion occurs.
   * Here is an example:
   * \code
   * {
@@ -619,7 +623,7 @@ template<typename T> class aligned_stack_memory_handler
 
 #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(true)
 #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar,Size) \
-  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(((Size)!=Eigen::Dynamic) && ((sizeof(Scalar)*(Size))%16==0))
+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(bool(((Size)!=Eigen::Dynamic) && ((sizeof(Scalar)*(Size))%16==0)))
 
 /****************************************************************************/
 
@@ -667,24 +671,24 @@ public:
         return &value;
     }
 
-    aligned_allocator() throw()
+    aligned_allocator()
     {
     }
 
-    aligned_allocator( const aligned_allocator& ) throw()
+    aligned_allocator( const aligned_allocator& )
     {
     }
 
     template<class U>
-    aligned_allocator( const aligned_allocator<U>& ) throw()
+    aligned_allocator( const aligned_allocator<U>& )
     {
     }
 
-    ~aligned_allocator() throw()
+    ~aligned_allocator()
     {
     }
 
-    size_type max_size() const throw()
+    size_type max_size() const
     {
         return (std::numeric_limits<size_type>::max)();
     }
@@ -701,6 +705,15 @@ public:
         ::new( p ) T( value );
     }
 
+    // Support for c++11
+#if (__cplusplus >= 201103L)
+    template<typename... Args>
+    void  construct(pointer p, Args&&... args)
+    {
+      ::new(p) T(std::forward<Args>(args)...);
+    }
+#endif
+
     void destroy( pointer p )
     {
         p->~T();
@@ -720,19 +733,21 @@ public:
 
 //---------- Cache sizes ----------
 
-#if defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
-#  if defined(__PIC__) && defined(__i386__)
-     // Case for x86 with PIC
-#    define EIGEN_CPUID(abcd,func,id) \
-       __asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id));
-#  else
-     // Case for x86_64 or x86 w/o PIC
-#    define EIGEN_CPUID(abcd,func,id) \
-       __asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id) );
-#  endif
-#elif defined(_MSC_VER)
-#  if (_MSC_VER > 1500)
-#    define EIGEN_CPUID(abcd,func,id) __cpuidex((int*)abcd,func,id)
+#if !defined(EIGEN_NO_CPUID)
+#  if defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
+#    if defined(__PIC__) && defined(__i386__)
+       // Case for x86 with PIC
+#      define EIGEN_CPUID(abcd,func,id) \
+         __asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id));
+#    else
+       // Case for x86_64 or x86 w/o PIC
+#      define EIGEN_CPUID(abcd,func,id) \
+         __asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id) );
+#    endif
+#  elif defined(_MSC_VER)
+#    if (_MSC_VER > 1500)
+#      define EIGEN_CPUID(abcd,func,id) __cpuidex((int*)abcd,func,id)
+#    endif
 #  endif
 #endif
 
@@ -742,7 +757,7 @@ namespace internal {
 
 inline bool cpuid_is_vendor(int abcd[4], const char* vendor)
 {
-  return abcd[1]==((int*)(vendor))[0] && abcd[3]==((int*)(vendor))[1] && abcd[2]==((int*)(vendor))[2];
+  return abcd[1]==(reinterpret_cast<const int*>(vendor))[0] && abcd[3]==(reinterpret_cast<const int*>(vendor))[1] && abcd[2]==(reinterpret_cast<const int*>(vendor))[2];
 }
 
 inline void queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
@@ -932,4 +947,6 @@ inline int queryTopLevelCacheSize()
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_MEMORY_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/Meta.h b/extern/Eigen3/Eigen/src/Core/util/Meta.h
index 4518261..a5f3116 100644
--- a/extern/Eigen3/Eigen/src/Core/util/Meta.h
+++ b/extern/Eigen3/Eigen/src/Core/util/Meta.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_META_H
 #define EIGEN_META_H
 
+namespace Eigen {
+
 namespace internal {
 
 /** \internal
@@ -80,8 +67,6 @@ template<> struct is_arithmetic<signed int>    { enum { value = true }; };
 template<> struct is_arithmetic<unsigned int>  { enum { value = true }; };
 template<> struct is_arithmetic<signed long>   { enum { value = true }; };
 template<> struct is_arithmetic<unsigned long> { enum { value = true }; };
-template<> struct is_arithmetic<signed long long>   { enum { value = true }; };
-template<> struct is_arithmetic<unsigned long long> { enum { value = true }; };
 
 template <typename T> struct add_const { typedef const T type; };
 template <typename T> struct add_const<T&> { typedef T& type; };
@@ -103,6 +88,21 @@ template<bool Condition, typename T> struct enable_if;
 template<typename T> struct enable_if<true,T>
 { typedef T type; };
 
+
+
+/** \internal
+  * A base class do disable default copy ctor and copy assignement operator.
+  */
+class noncopyable
+{
+  noncopyable(const noncopyable&);
+  const noncopyable& operator=(const noncopyable&);
+protected:
+  noncopyable() {}
+  ~noncopyable() {}
+};
+
+
 /** \internal
   * Convenient struct to get the result type of a unary or binary functor.
   *
@@ -226,4 +226,6 @@ template<typename T, int S> struct is_diagonal<DiagonalMatrix<T,S> >
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_META_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/NonMPL2.h b/extern/Eigen3/Eigen/src/Core/util/NonMPL2.h
new file mode 100644
index 0000000..1af67cf
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Core/util/NonMPL2.h
@@ -0,0 +1,3 @@
+#ifdef EIGEN_MPL2_ONLY
+#error Including non-MPL2 code in EIGEN_MPL2_ONLY mode
+#endif
diff --git a/extern/Eigen3/Eigen/src/Core/util/StaticAssert.h b/extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
index 99c7c99..b46a75b 100644
--- a/extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
+++ b/extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STATIC_ASSERT_H
 #define EIGEN_STATIC_ASSERT_H
@@ -48,6 +33,8 @@
 
   #else // not CXX0X
 
+    namespace Eigen {
+
     namespace internal {
 
     template<bool condition>
@@ -70,6 +57,7 @@
         YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR,
         UNALIGNED_LOAD_AND_STORE_OPERATIONS_UNIMPLEMENTED_ON_ALTIVEC,
         THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES,
+        FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED,
         NUMERIC_TYPE_MUST_BE_REAL,
         COEFFICIENT_WRITE_ACCESS_TO_SELFADJOINT_NOT_SUPPORTED,
         WRITING_TO_TRIANGULAR_PART_WITH_UNIT_DIAGONAL_IS_NOT_SUPPORTED,
@@ -95,12 +83,20 @@
         YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION,
         THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY,
         YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT,
-        THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS
+        THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS,
+        THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL,
+        THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES,
+        YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED,
+        YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED,
+        THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE,
+        THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH
       };
     };
 
     } // end namespace internal
 
+    } // end namespace Eigen
+
     // Specialized implementation for MSVC to avoid "conditional
     // expression is constant" warnings.  This implementation doesn't
     // appear to work under GCC, hence the multiple implementations.
@@ -195,4 +191,15 @@
       EIGEN_STATIC_ASSERT(internal::is_lvalue<Derived>::value, \
                           THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY)
 
+#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \
+      EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value), \
+                          THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES)
+
+#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \
+      EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Derived1>::XprKind, \
+                                             typename internal::traits<Derived2>::XprKind \
+                                            >::value), \
+                          YOU_CANNOT_MIX_ARRAYS_AND_MATRICES)
+
+
 #endif // EIGEN_STATIC_ASSERT_H
diff --git a/extern/Eigen3/Eigen/src/Core/util/XprHelper.h b/extern/Eigen3/Eigen/src/Core/util/XprHelper.h
index c2078f1..2a65c7c 100644
--- a/extern/Eigen3/Eigen/src/Core/util/XprHelper.h
+++ b/extern/Eigen3/Eigen/src/Core/util/XprHelper.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_XPRHELPER_H
 #define EIGEN_XPRHELPER_H
@@ -37,6 +22,8 @@
   #define EIGEN_EMPTY_STRUCT_CTOR(X)
 #endif
 
+namespace Eigen {
+
 typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
 
 namespace internal {
@@ -260,30 +247,27 @@ template<typename T> struct plain_matrix_type_row_major
 // we should be able to get rid of this one too
 template<typename T> struct must_nest_by_value { enum { ret = false }; };
 
-template<class T>
-struct is_reference
-{
-  enum { ret = false };
-};
-
-template<class T>
-struct is_reference<T&>
-{
-  enum { ret = true };
-};
-
-/**
-* \internal The reference selector for template expressions. The idea is that we don't
-* need to use references for expressions since they are light weight proxy
-* objects which should generate no copying overhead.
-**/
+/** \internal The reference selector for template expressions. The idea is that we don't
+  * need to use references for expressions since they are light weight proxy
+  * objects which should generate no copying overhead. */
 template <typename T>
 struct ref_selector
 {
   typedef typename conditional<
     bool(traits<T>::Flags & NestByRefBit),
     T const&,
-    T
+    const T
+  >::type type;
+};
+
+/** \internal Adds the const qualifier on the value-type of T2 if and only if T1 is a const type */
+template<typename T1, typename T2>
+struct transfer_constness
+{
+  typedef typename conditional<
+    bool(internal::is_const<T1>::value),
+    typename internal::add_const_on_value_type<T2>::type,
+    T2
   >::type type;
 };
 
@@ -297,6 +281,8 @@ struct ref_selector
   * \param T the type of the expression being nested
   * \param n the number of coefficient accesses in the nested expression for each coefficient access in the bigger expression.
   *
+  * Note that if no evaluation occur, then the constness of T is preserved.
+  *
   * Example. Suppose that a, b, and c are of type Matrix3d. The user forms the expression a*(b+c).
   * b+c is an expression "sum of matrices", which we will denote by S. In order to determine how to nest it,
   * the Product expression uses: nested<S, 3>::ret, which turns out to be Matrix3d because the internal logic of
@@ -456,4 +442,6 @@ struct is_lvalue
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_XPRHELPER_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Block.h b/extern/Eigen3/Eigen/src/Eigen2Support/Block.h
index bc28051..604456f 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Block.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Block.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BLOCK2_H
 #define EIGEN_BLOCK2_H
 
+namespace Eigen { 
+
 /** \returns a dynamic-size expression of a corner of *this.
   *
   * \param type the type of corner. Can be \a Eigen::TopLeft, \a Eigen::TopRight,
@@ -134,4 +121,6 @@ DenseBase<Derived>::corner(CornerType type) const
   }
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_BLOCK2_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h b/extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
index 2dc83b6..d95009b 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_CWISE_H
 #define EIGEN_CWISE_H
 
+namespace Eigen { 
+
 /** \internal
   * convenient macro to defined the return type of a cwise binary operation */
 #define EIGEN_CWISE_BINOP_RETURN_TYPE(OP) \
@@ -200,4 +187,6 @@ inline Cwise<Derived> MatrixBase<Derived>::cwise()
   return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_CWISE_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h b/extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
index 9c28559..482f306 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ARRAY_CWISE_OPERATORS_H
 #define EIGEN_ARRAY_CWISE_OPERATORS_H
 
+namespace Eigen { 
+
 /***************************************************************************
 * The following functions were defined in Core
 ***************************************************************************/
@@ -306,4 +293,6 @@ inline ExpressionType& Cwise<ExpressionType>::operator-=(const Scalar& scalar)
   return m_matrix.const_cast_derived() = *this - scalar;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ARRAY_CWISE_OPERATORS_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h
index 78df29d..5c928e8 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h
@@ -3,27 +3,14 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   * \nonstableyet
   *
@@ -63,7 +50,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
   ~AlignedBox() {}
 
   /** \returns the dimension in which the box holds */
-  inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : int(AmbientDimAtCompileTime); }
+  inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : AmbientDimAtCompileTime; }
 
   /** \returns true if the box is null, i.e, empty. */
   inline bool isNull() const { return (m_min.cwise() > m_max).any(); }
@@ -157,14 +144,16 @@ protected:
 template<typename Scalar,int AmbiantDim>
 inline Scalar AlignedBox<Scalar,AmbiantDim>::squaredExteriorDistance(const VectorType& p) const
 {
-  Scalar dist2 = 0.;
+  Scalar dist2(0);
   Scalar aux;
   for (int k=0; k<dim(); ++k)
   {
-    if ((aux = (p[k]-m_min[k]))<0.)
+    if ((aux = (p[k]-m_min[k]))<Scalar(0))
       dist2 += aux*aux;
-    else if ( (aux = (m_max[k]-p[k]))<0. )
+    else if ( (aux = (m_max[k]-p[k]))<Scalar(0))
       dist2 += aux*aux;
   }
   return dist2;
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h
index 9d8244b..e0b00fc 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h
@@ -112,4 +112,4 @@
 #undef Hyperplane
 #undef ParametrizedLine
 
-#endif // EIGEN2_GEOMETRY_MODULE_H
\ No newline at end of file
+#endif // EIGEN2_GEOMETRY_MODULE_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h
index f7b2d51..20f1fce 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h
@@ -3,27 +3,13 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 /** \geometry_module \ingroup Geometry_Module
   *
@@ -224,3 +210,5 @@ AngleAxis<Scalar>::toRotationMatrix(void) const
 
   return res;
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
index 81c4f55..19cc1bf 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
@@ -4,27 +4,14 @@
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Hyperplane
@@ -263,3 +250,5 @@ protected:
 
   Coefficients m_coeffs;
 };
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
index 411c4b5..6e4a168 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
@@ -4,27 +4,13 @@
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 /** \geometry_module \ingroup Geometry_Module
   *
@@ -151,3 +137,5 @@ inline _Scalar ParametrizedLine<_Scalar, _AmbientDim>::intersection(const Hyperp
   return -(hyperplane.offset()+origin().eigen2_dot(hyperplane.normal()))
           /(direction().eigen2_dot(hyperplane.normal()));
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h
index a75fa42..ec87da0 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h
@@ -3,27 +3,14 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
+
 template<typename Other,
          int OtherRows=Other::RowsAtCompileTime,
          int OtherCols=Other::ColsAtCompileTime>
@@ -143,7 +130,7 @@ public:
   /** \returns a quaternion representing an identity rotation
     * \sa MatrixBase::Identity()
     */
-  inline static Quaternion Identity() { return Quaternion(1, 0, 0, 0); }
+  static inline Quaternion Identity() { return Quaternion(1, 0, 0, 0); }
 
   /** \sa Quaternion::Identity(), MatrixBase::setIdentity()
     */
@@ -314,9 +301,9 @@ Quaternion<Scalar>::toRotationMatrix(void) const
   // it has to be inlined, and so the return by value is not an issue
   Matrix3 res;
 
-  const Scalar tx  = 2*this->x();
-  const Scalar ty  = 2*this->y();
-  const Scalar tz  = 2*this->z();
+  const Scalar tx  = Scalar(2)*this->x();
+  const Scalar ty  = Scalar(2)*this->y();
+  const Scalar tz  = Scalar(2)*this->z();
   const Scalar twx = tx*this->w();
   const Scalar twy = ty*this->w();
   const Scalar twz = tz*this->w();
@@ -327,15 +314,15 @@ Quaternion<Scalar>::toRotationMatrix(void) const
   const Scalar tyz = tz*this->y();
   const Scalar tzz = tz*this->z();
 
-  res.coeffRef(0,0) = 1-(tyy+tzz);
+  res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
   res.coeffRef(0,1) = txy-twz;
   res.coeffRef(0,2) = txz+twy;
   res.coeffRef(1,0) = txy+twz;
-  res.coeffRef(1,1) = 1-(txx+tzz);
+  res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
   res.coeffRef(1,2) = tyz-twx;
   res.coeffRef(2,0) = txz-twy;
   res.coeffRef(2,1) = tyz+twx;
-  res.coeffRef(2,2) = 1-(txx+tyy);
+  res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
 
   return res;
 }
@@ -460,7 +447,7 @@ template<typename Other>
 struct ei_quaternion_assign_impl<Other,3,3>
 {
   typedef typename Other::Scalar Scalar;
-  inline static void run(Quaternion<Scalar>& q, const Other& mat)
+  static inline void run(Quaternion<Scalar>& q, const Other& mat)
   {
     // This algorithm comes from  "Quaternion Calculus and Fast Animation",
     // Ken Shoemake, 1987 SIGGRAPH course notes
@@ -499,8 +486,10 @@ template<typename Other>
 struct ei_quaternion_assign_impl<Other,4,1>
 {
   typedef typename Other::Scalar Scalar;
-  inline static void run(Quaternion<Scalar>& q, const Other& vec)
+  static inline void run(Quaternion<Scalar>& q, const Other& vec)
   {
     q.coeffs() = vec;
   }
 };
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h
index ee7c80e..3e02b7a 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h
@@ -3,27 +3,13 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 /** \geometry_module \ingroup Geometry_Module
   *
@@ -155,3 +141,5 @@ Rotation2D<Scalar>::toRotationMatrix(void) const
   Scalar cosA = ei_cos(m_angle);
   return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h
index 2f494f1..78ad73b 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h
@@ -3,27 +3,14 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
+
 // this file aims to contains the various representations of rotation/orientation
 // in 2D and 3D space excepted Matrix and Quaternion.
 
@@ -113,22 +100,24 @@ Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
   * \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis
   */
 template<typename Scalar, int Dim>
-inline static Matrix<Scalar,2,2> ei_toRotationMatrix(const Scalar& s)
+static inline Matrix<Scalar,2,2> ei_toRotationMatrix(const Scalar& s)
 {
   EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
   return Rotation2D<Scalar>(s).toRotationMatrix();
 }
 
 template<typename Scalar, int Dim, typename OtherDerived>
-inline static Matrix<Scalar,Dim,Dim> ei_toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
+static inline Matrix<Scalar,Dim,Dim> ei_toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
 {
   return r.toRotationMatrix();
 }
 
 template<typename Scalar, int Dim, typename OtherDerived>
-inline static const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBase<OtherDerived>& mat)
+static inline const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBase<OtherDerived>& mat)
 {
   EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
     YOU_MADE_A_PROGRAMMING_MISTAKE)
   return mat;
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h
index 108e6d7..a07c1c7 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h
@@ -3,27 +3,13 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 /** \geometry_module \ingroup Geometry_Module
   *
@@ -177,3 +163,5 @@ Scaling<Scalar,Dim>::operator* (const TransformType& t) const
   res.prescale(m_coeffs);
   return res;
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h
index 88956c8..dceb802 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h
@@ -4,27 +4,13 @@
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 // Note that we have to pass Dim and HDim because it is not allowed to use a template
 // parameter to define a template specialization. To be more precise, in the following
@@ -796,3 +782,5 @@ struct ei_transform_product_impl<Other,Dim,HDim, Dim,1>
   { return ((tr.linear() * other) + tr.translation())
           * (Scalar(1) / ( (tr.matrix().template block<1,Dim>(Dim,0) * other).coeff(0) + tr.matrix().coeff(Dim,Dim))); }
 };
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h
index e651e31..0fb9a9f 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h
@@ -3,27 +3,13 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
 
+namespace Eigen { 
 
 /** \geometry_module \ingroup Geometry_Module
   *
@@ -194,3 +180,5 @@ Translation<Scalar,Dim>::operator* (const TransformType& t) const
   res.pretranslate(m_coeffs);
   return res;
 }
+
+} // end namespace Eigen
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/LU.h b/extern/Eigen3/Eigen/src/Eigen2Support/LU.h
index c23c11b..49f19ad 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/LU.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/LU.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_LU_H
 #define EIGEN2_LU_H
 
+namespace Eigen { 
+
 template<typename MatrixType>
 class LU : public FullPivLU<MatrixType>
 {
@@ -57,7 +44,6 @@ class LU : public FullPivLU<MatrixType>
     > ImageResultType;
 
     typedef FullPivLU<MatrixType> Base;
-    LU() : Base() {}
 
     template<typename T>
     explicit LU(const T& t) : Base(t), m_originalMatrix(t) {}
@@ -129,5 +115,6 @@ MatrixBase<Derived>::eigen2_lu() const
 }
 #endif
 
+} // end namespace Eigen
 
 #endif // EIGEN2_LU_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h b/extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
index c4288ed..593fc78 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_LAZY_H
 #define EIGEN_LAZY_H
 
+namespace Eigen { 
+
 /** \deprecated it is only used by lazy() which is deprecated
   *
   * \returns an expression of *this with added flags
@@ -79,4 +66,6 @@ Derived& MatrixBase<Derived>::operator-=(const Flagged<ProductBase<ProductDerive
   other._expression().derived().subTo(derived()); return derived();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_LAZY_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h b/extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
index 4b62ffa..7aff428 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_LEASTSQUARES_H
 #define EIGEN2_LEASTSQUARES_H
 
+namespace Eigen { 
+
 /** \ingroup LeastSquares_Module
   *
   * \leastsquares_module
@@ -178,5 +165,6 @@ void fitHyperplane(int numPoints,
   result->offset() = - (result->normal().cwise()* mean).sum();
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN2_LEASTSQUARES_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Macros.h b/extern/Eigen3/Eigen/src/Eigen2Support/Macros.h
index 77e85a4..351c32a 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Macros.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Macros.h
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_MACROS_H
 #define EIGEN2_MACROS_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h b/extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h
index caa44e6..3a8a9ca 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_MATH_FUNCTIONS_H
 #define EIGEN2_MATH_FUNCTIONS_H
 
+namespace Eigen { 
+
 template<typename T> inline typename NumTraits<T>::Real ei_real(const T& x) { return internal::real(x); }
 template<typename T> inline typename NumTraits<T>::Real ei_imag(const T& x) { return internal::imag(x); }
 template<typename T> inline T ei_conj(const T& x) { return internal::conj(x); }
@@ -65,4 +52,6 @@ inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y,
   return internal::isApproxOrLessThan(x, y, precision);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN2_MATH_FUNCTIONS_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Memory.h b/extern/Eigen3/Eigen/src/Eigen2Support/Memory.h
index 0283475..f86372b 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Memory.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Memory.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_MEMORY_H
 #define EIGEN2_MEMORY_H
 
+namespace Eigen { 
+
 inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); }
 inline void  ei_aligned_free(void *ptr) { internal::aligned_free(ptr); }
 inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); }
@@ -53,6 +40,6 @@ template<typename T> inline void ei_aligned_delete(T *ptr, size_t size)
   return internal::aligned_delete(ptr, size);
 }
 
-
+} // end namespace Eigen
 
 #endif // EIGEN2_MACROS_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Meta.h b/extern/Eigen3/Eigen/src/Eigen2Support/Meta.h
index 6e500b7..fa37cfc 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Meta.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Meta.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_META_H
 #define EIGEN2_META_H
 
+namespace Eigen { 
+
 template<typename T>
 struct ei_traits : internal::traits<T>
 {};
@@ -83,4 +70,6 @@ class ei_meta_sqrt
 template<int Y, int InfX, int SupX>
 class ei_meta_sqrt<Y, InfX, SupX, true> { public:  enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
 
+} // end namespace Eigen
+
 #endif // EIGEN2_META_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/Minor.h b/extern/Eigen3/Eigen/src/Eigen2Support/Minor.h
index eda91cc..4cded57 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/Minor.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/Minor.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MINOR_H
 #define EIGEN_MINOR_H
 
+namespace Eigen { 
+
 /**
   * \class Minor
   *
@@ -125,4 +112,6 @@ MatrixBase<Derived>::minor(Index row, Index col) const
   return Minor<Derived>(derived(), row, col);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MINOR_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/QR.h b/extern/Eigen3/Eigen/src/Eigen2Support/QR.h
index 64f5d5c..2042c98 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/QR.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/QR.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_QR_H
 #define EIGEN2_QR_H
 
+namespace Eigen { 
+
 template<typename MatrixType>
 class QR : public HouseholderQR<MatrixType>
 {
@@ -75,5 +62,6 @@ MatrixBase<Derived>::qr() const
   return QR<PlainObject>(eval());
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN2_QR_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/SVD.h b/extern/Eigen3/Eigen/src/Eigen2Support/SVD.h
index 16b4b48..3d2eeb4 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/SVD.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/SVD.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael at free.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_SVD_H
 #define EIGEN2_SVD_H
 
+namespace Eigen {
+
 /** \ingroup SVD_Module
   * \nonstableyet
   *
@@ -390,7 +377,7 @@ void SVD<MatrixType>::compute(const MatrixType& matrix)
         Scalar ek = e[k]/scale;
         Scalar b = ((spm1 + sp)*(spm1 - sp) + epm1*epm1)/Scalar(2);
         Scalar c = (sp*epm1)*(sp*epm1);
-        Scalar shift = 0.0;
+        Scalar shift(0);
         if ((b != 0.0) || (c != 0.0))
         {
           shift = ei_sqrt(b*b + c);
@@ -646,4 +633,6 @@ MatrixBase<Derived>::svd() const
   return SVD<PlainObject>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN2_SVD_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h b/extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h
index e94e47a..ebbeb3b 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIANGULAR_SOLVER2_H
 #define EIGEN_TRIANGULAR_SOLVER2_H
 
+namespace Eigen { 
+
 const unsigned int UnitDiagBit = UnitDiag;
 const unsigned int SelfAdjointBit = SelfAdjoint;
 const unsigned int UpperTriangularBit = Upper;
@@ -49,5 +36,7 @@ void Flagged<ExpressionType,Added,Removed>::solveTriangularInPlace(const MatrixB
 {
   m_matrix.template triangularView<Added>().solveInPlace(other.derived());
 }
+
+} // end namespace Eigen
     
 #endif // EIGEN_TRIANGULAR_SOLVER2_H
diff --git a/extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h b/extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h
index 010031d..71a8080 100644
--- a/extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h
+++ b/extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN2_VECTORBLOCK_H
 #define EIGEN2_VECTORBLOCK_H
 
+namespace Eigen { 
+
 /** \deprecated use DenseMase::head(Index) */
 template<typename Derived>
 inline VectorBlock<Derived>
@@ -102,4 +89,6 @@ MatrixBase<Derived>::end() const
   return VectorBlock<const Derived, Size>(derived(), size() - Size);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN2_VECTORBLOCK_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
index 57e0022..c4b8a30 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
@@ -5,31 +5,17 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMPLEX_EIGEN_SOLVER_H
 #define EIGEN_COMPLEX_EIGEN_SOLVER_H
 
-#include "./EigenvaluesCommon.h"
 #include "./ComplexSchur.h"
 
+namespace Eigen { 
+
 /** \eigenvalues_module \ingroup Eigenvalues_Module
   *
   *
@@ -328,5 +314,6 @@ void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors)
   }
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_COMPLEX_EIGEN_SOLVER_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h
index ec93af2..16a9a03 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h
@@ -5,31 +5,17 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COMPLEX_SCHUR_H
 #define EIGEN_COMPLEX_SCHUR_H
 
-#include "./EigenvaluesCommon.h"
 #include "./HessenbergDecomposition.h"
 
+namespace Eigen { 
+
 namespace internal {
 template<typename MatrixType, bool IsComplex> struct complex_schur_reduce_to_hessenberg;
 }
@@ -227,46 +213,6 @@ template<typename _MatrixType> class ComplexSchur
     friend struct internal::complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>;
 };
 
-namespace internal {
-
-/** Computes the principal value of the square root of the complex \a z. */
-template<typename RealScalar>
-std::complex<RealScalar> sqrt(const std::complex<RealScalar> &z)
-{
-  RealScalar t, tre, tim;
-
-  t = abs(z);
-
-  if (abs(real(z)) <= abs(imag(z)))
-  {
-    // No cancellation in these formulas
-    tre = sqrt(RealScalar(0.5)*(t + real(z)));
-    tim = sqrt(RealScalar(0.5)*(t - real(z)));
-  }
-  else
-  {
-    // Stable computation of the above formulas
-    if (z.real() > RealScalar(0))
-    {
-      tre = t + z.real();
-      tim = abs(imag(z))*sqrt(RealScalar(0.5)/tre);
-      tre = sqrt(RealScalar(0.5)*tre);
-    }
-    else
-    {
-      tim = t - z.real();
-      tre = abs(imag(z))*sqrt(RealScalar(0.5)/tim);
-      tim = sqrt(RealScalar(0.5)*tim);
-    }
-  }
-  if(z.imag() < RealScalar(0))
-    tim = -tim;
-
-  return (std::complex<RealScalar>(tre,tim));
-}
-} // end namespace internal
-
-
 /** If m_matT(i+1,i) is neglegible in floating point arithmetic
   * compared to m_matT(i,i) and m_matT(j,j), then set it to zero and
   * return true, else return false. */
@@ -302,7 +248,7 @@ typename ComplexSchur<MatrixType>::ComplexScalar ComplexSchur<MatrixType>::compu
 
   ComplexScalar b = t.coeff(0,1) * t.coeff(1,0);
   ComplexScalar c = t.coeff(0,0) - t.coeff(1,1);
-  ComplexScalar disc = internal::sqrt(c*c + RealScalar(4)*b);
+  ComplexScalar disc = sqrt(c*c + RealScalar(4)*b);
   ComplexScalar det = t.coeff(0,0) * t.coeff(1,1) - b;
   ComplexScalar trace = t.coeff(0,0) + t.coeff(1,1);
   ComplexScalar eival1 = (trace + disc) / RealScalar(2);
@@ -406,7 +352,7 @@ void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
 
     // if we spent too many iterations on the current element, we give up
     iter++;
-    if(iter > m_maxIterations) break;
+    if(iter > m_maxIterations * m_matT.cols()) break;
 
     // find il, the top row of the active submatrix
     il = iu-1;
@@ -436,7 +382,7 @@ void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
     }
   }
 
-  if(iter <= m_maxIterations) 
+  if(iter <= m_maxIterations * m_matT.cols()) 
     m_info = Success;
   else
     m_info = NoConvergence;
@@ -445,4 +391,6 @@ void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
   m_matUisUptodate = computeU;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPLEX_SCHUR_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h
new file mode 100644
index 0000000..aa18e69
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Complex Schur needed to complex unsymmetrical eigenvalues/eigenvectors.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_COMPLEX_SCHUR_MKL_H
+#define EIGEN_COMPLEX_SCHUR_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_SCHUR_COMPLEX(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \
+template<> inline\
+ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
+ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, bool computeU) \
+{ \
+  typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \
+  typedef MatrixType::Scalar Scalar; \
+  typedef MatrixType::RealScalar RealScalar; \
+  typedef std::complex<RealScalar> ComplexScalar; \
+\
+  assert(matrix.cols() == matrix.rows()); \
+\
+  m_matUisUptodate = false; \
+  if(matrix.cols() == 1) \
+  { \
+    m_matT = matrix.cast<ComplexScalar>(); \
+    if(computeU)  m_matU = ComplexMatrixType::Identity(1,1); \
+      m_info = Success; \
+      m_isInitialized = true; \
+      m_matUisUptodate = computeU; \
+      return *this; \
+  } \
+  lapack_int n = matrix.cols(), sdim, info; \
+  lapack_int lda = matrix.outerStride(); \
+  lapack_int matrix_order = MKLCOLROW; \
+  char jobvs, sort='N'; \
+  LAPACK_##MKLPREFIX_U##_SELECT1 select = 0; \
+  jobvs = (computeU) ? 'V' : 'N'; \
+  m_matU.resize(n, n); \
+  lapack_int ldvs  = m_matU.outerStride(); \
+  m_matT = matrix; \
+  Matrix<EIGTYPE, Dynamic, Dynamic> w; \
+  w.resize(n, 1);\
+  info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)w.data(), (MKLTYPE*)m_matU.data(), ldvs ); \
+  if(info == 0) \
+    m_info = Success; \
+  else \
+    m_info = NoConvergence; \
+\
+  m_isInitialized = true; \
+  m_matUisUptodate = computeU; \
+  return *this; \
+\
+}
+
+EIGEN_MKL_SCHUR_COMPLEX(dcomplex, MKL_Complex16, z, Z, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SCHUR_COMPLEX(scomplex, MKL_Complex8,  c, C, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SCHUR_COMPLEX(dcomplex, MKL_Complex16, z, Z, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_SCHUR_COMPLEX(scomplex, MKL_Complex8,  c, C, RowMajor, LAPACK_ROW_MAJOR)
+
+} // end namespace Eigen
+
+#endif // EIGEN_COMPLEX_SCHUR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h b/extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
index f57353c..c16ff2b 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
@@ -4,31 +4,17 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_EIGENSOLVER_H
 #define EIGEN_EIGENSOLVER_H
 
-#include "./EigenvaluesCommon.h"
 #include "./RealSchur.h"
 
+namespace Eigen { 
+
 /** \eigenvalues_module \ingroup Eigenvalues_Module
   *
   *
@@ -432,7 +418,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
   const Scalar eps = NumTraits<Scalar>::epsilon();
 
   // inefficient! this is already computed in RealSchur
-  Scalar norm = 0.0;
+  Scalar norm(0);
   for (Index j = 0; j < size; ++j)
   {
     norm += m_matT.row(j).segment((std::max)(j-1,Index(0)), size-(std::max)(j-1,Index(0))).cwiseAbs().sum();
@@ -452,7 +438,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
     // Scalar vector
     if (q == Scalar(0))
     {
-      Scalar lastr=0, lastw=0;
+      Scalar lastr(0), lastw(0);
       Index l = n;
 
       m_matT.coeffRef(n,n) = 1.0;
@@ -498,7 +484,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
     }
     else if (q < Scalar(0) && n > 0) // Complex vector
     {
-      Scalar lastra=0, lastsa=0, lastw=0;
+      Scalar lastra(0), lastsa(0), lastw(0);
       Index l = n-1;
 
       // Last vector component imaginary so matrix is triangular
@@ -588,4 +574,6 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
   }
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_EIGENSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/EigenvaluesCommon.h b/extern/Eigen3/Eigen/src/Eigenvalues/EigenvaluesCommon.h
deleted file mode 100644
index 749bea7..0000000
--- a/extern/Eigen3/Eigen/src/Eigenvalues/EigenvaluesCommon.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_EIGENVALUES_COMMON_H
-#define EIGEN_EIGENVALUES_COMMON_H
-
-
-
-#endif // EIGEN_EIGENVALUES_COMMON_H
-
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
index 980af14..07bf1ea 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
@@ -4,31 +4,17 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H
 #define EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H
 
-#include "./EigenvaluesCommon.h"
 #include "./Tridiagonalization.h"
 
+namespace Eigen { 
+
 /** \eigenvalues_module \ingroup Eigenvalues_Module
   *
   *
@@ -236,4 +222,6 @@ compute(const MatrixType& matA, const MatrixType& matB, int options)
   return *this;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h b/extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h
index c17f155..b8378b0 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_HESSENBERGDECOMPOSITION_H
 #define EIGEN_HESSENBERGDECOMPOSITION_H
 
+namespace Eigen { 
+
 namespace internal {
   
 template<typename MatrixType> struct HessenbergDecompositionMatrixHReturnType;
@@ -379,6 +366,8 @@ template<typename MatrixType> struct HessenbergDecompositionMatrixHReturnType
     const HessenbergDecomposition<MatrixType>& m_hess;
 };
 
-}
+} // end namespace internal
+
+} // end namespace Eigen
 
 #endif // EIGEN_HESSENBERGDECOMPOSITION_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h b/extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
index 5591519..6af481c 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MATRIXBASEEIGENVALUES_H
 #define EIGEN_MATRIXBASEEIGENVALUES_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Derived, bool IsComplex>
@@ -167,4 +154,6 @@ SelfAdjointView<MatrixType, UpLo>::operatorNorm() const
   return eigenvalues().cwiseAbs().maxCoeff();
 }
 
+} // end namespace Eigen
+
 #endif
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h b/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
index cc9af11..781692e 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
@@ -4,31 +4,17 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_REAL_SCHUR_H
 #define EIGEN_REAL_SCHUR_H
 
-#include "./EigenvaluesCommon.h"
 #include "./HessenbergDecomposition.h"
 
+namespace Eigen { 
+
 /** \eigenvalues_module \ingroup Eigenvalues_Module
   *
   *
@@ -235,42 +221,44 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const MatrixType& matrix,
   // Rows iu+1,...,end are already brought in triangular form.
   Index iu = m_matT.cols() - 1;
   Index iter = 0; // iteration count
-  Scalar exshift = 0.0; // sum of exceptional shifts
+  Scalar exshift(0); // sum of exceptional shifts
   Scalar norm = computeNormOfT();
 
-  while (iu >= 0)
+  if(norm!=0)
   {
-    Index il = findSmallSubdiagEntry(iu, norm);
-
-    // Check for convergence
-    if (il == iu) // One root found
-    {
-      m_matT.coeffRef(iu,iu) = m_matT.coeff(iu,iu) + exshift;
-      if (iu > 0) 
-        m_matT.coeffRef(iu, iu-1) = Scalar(0);
-      iu--;
-      iter = 0;
-    }
-    else if (il == iu-1) // Two roots found
-    {
-      splitOffTwoRows(iu, computeU, exshift);
-      iu -= 2;
-      iter = 0;
-    }
-    else // No convergence yet
+    while (iu >= 0)
     {
-      // The firstHouseholderVector vector has to be initialized to something to get rid of a silly GCC warning (-O1 -Wall -DNDEBUG )
-      Vector3s firstHouseholderVector(0,0,0), shiftInfo;
-      computeShift(iu, iter, exshift, shiftInfo);
-      iter = iter + 1; 
-      if (iter > m_maxIterations) break;
-      Index im;
-      initFrancisQRStep(il, iu, shiftInfo, im, firstHouseholderVector);
-      performFrancisQRStep(il, im, iu, computeU, firstHouseholderVector, workspace);
+      Index il = findSmallSubdiagEntry(iu, norm);
+
+      // Check for convergence
+      if (il == iu) // One root found
+      {
+        m_matT.coeffRef(iu,iu) = m_matT.coeff(iu,iu) + exshift;
+        if (iu > 0)
+          m_matT.coeffRef(iu, iu-1) = Scalar(0);
+        iu--;
+        iter = 0;
+      }
+      else if (il == iu-1) // Two roots found
+      {
+        splitOffTwoRows(iu, computeU, exshift);
+        iu -= 2;
+        iter = 0;
+      }
+      else // No convergence yet
+      {
+        // The firstHouseholderVector vector has to be initialized to something to get rid of a silly GCC warning (-O1 -Wall -DNDEBUG )
+        Vector3s firstHouseholderVector(0,0,0), shiftInfo;
+        computeShift(iu, iter, exshift, shiftInfo);
+        iter = iter + 1;
+        if (iter > m_maxIterations * m_matT.cols()) break;
+        Index im;
+        initFrancisQRStep(il, iu, shiftInfo, im, firstHouseholderVector);
+        performFrancisQRStep(il, im, iu, computeU, firstHouseholderVector, workspace);
+      }
     }
-  } 
-
-  if(iter <= m_maxIterations) 
+  }
+  if(iter <= m_maxIterations * m_matT.cols()) 
     m_info = Success;
   else
     m_info = NoConvergence;
@@ -288,7 +276,7 @@ inline typename MatrixType::Scalar RealSchur<MatrixType>::computeNormOfT()
   // FIXME to be efficient the following would requires a triangular reduxion code
   // Scalar norm = m_matT.upper().cwiseAbs().sum() 
   //               + m_matT.bottomLeftCorner(size-1,size-1).diagonal().cwiseAbs().sum();
-  Scalar norm = 0.0;
+  Scalar norm(0);
   for (Index j = 0; j < size; ++j)
     norm += m_matT.row(j).segment((std::max)(j-1,Index(0)), size-(std::max)(j-1,Index(0))).cwiseAbs().sum();
   return norm;
@@ -471,4 +459,6 @@ inline void RealSchur<MatrixType>::performFrancisQRStep(Index il, Index im, Inde
   }
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_REAL_SCHUR_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h b/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h
new file mode 100644
index 0000000..960ec3c
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Real Schur needed to real unsymmetrical eigenvalues/eigenvectors.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_REAL_SCHUR_MKL_H
+#define EIGEN_REAL_SCHUR_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_SCHUR_REAL(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \
+template<> inline \
+RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
+RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, bool computeU) \
+{ \
+  typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \
+  typedef MatrixType::Scalar Scalar; \
+  typedef MatrixType::RealScalar RealScalar; \
+\
+  assert(matrix.cols() == matrix.rows()); \
+\
+  lapack_int n = matrix.cols(), sdim, info; \
+  lapack_int lda = matrix.outerStride(); \
+  lapack_int matrix_order = MKLCOLROW; \
+  char jobvs, sort='N'; \
+  LAPACK_##MKLPREFIX_U##_SELECT2 select = 0; \
+  jobvs = (computeU) ? 'V' : 'N'; \
+  m_matU.resize(n, n); \
+  lapack_int ldvs  = m_matU.outerStride(); \
+  m_matT = matrix; \
+  Matrix<EIGTYPE, Dynamic, Dynamic> wr, wi; \
+  wr.resize(n, 1); wi.resize(n, 1); \
+  info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)wr.data(), (MKLTYPE*)wi.data(), (MKLTYPE*)m_matU.data(), ldvs ); \
+  if(info == 0) \
+    m_info = Success; \
+  else \
+    m_info = NoConvergence; \
+\
+  m_isInitialized = true; \
+  m_matUisUptodate = computeU; \
+  return *this; \
+\
+}
+
+EIGEN_MKL_SCHUR_REAL(double,   double, d, D, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SCHUR_REAL(float,    float,  s, S, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SCHUR_REAL(double,   double, d, D, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_SCHUR_REAL(float,    float,  s, S, RowMajor, LAPACK_ROW_MAJOR)
+
+} // end namespace Eigen
+
+#endif // EIGEN_REAL_SCHUR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h b/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
index ad107c6..acc5576 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
@@ -4,34 +4,24 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SELFADJOINTEIGENSOLVER_H
 #define EIGEN_SELFADJOINTEIGENSOLVER_H
 
-#include "./EigenvaluesCommon.h"
 #include "./Tridiagonalization.h"
 
+namespace Eigen { 
+
 template<typename _MatrixType>
 class GeneralizedSelfAdjointEigenSolver;
 
+namespace internal {
+template<typename SolverType,int Size,bool IsComplex> struct direct_selfadjoint_eigenvalues;
+}
+
 /** \eigenvalues_module \ingroup Eigenvalues_Module
   *
   *
@@ -86,7 +76,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
       Options = MatrixType::Options,
       MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
     };
-
+    
     /** \brief Scalar type for matrices of type \p _MatrixType. */
     typedef typename MatrixType::Scalar Scalar;
     typedef typename MatrixType::Index Index;
@@ -98,6 +88,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
       * complex.
       */
     typedef typename NumTraits<Scalar>::Real RealScalar;
+    
+    friend struct internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver,Size,NumTraits<Scalar>::IsComplex>;
 
     /** \brief Type for vector of eigenvalues as returned by eigenvalues().
       *
@@ -198,6 +190,22 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
       * \sa SelfAdjointEigenSolver(const MatrixType&, int)
       */
     SelfAdjointEigenSolver& compute(const MatrixType& matrix, int options = ComputeEigenvectors);
+    
+    /** \brief Computes eigendecomposition of given matrix using a direct algorithm
+      *
+      * This is a variant of compute(const MatrixType&, int options) which
+      * directly solves the underlying polynomial equation.
+      * 
+      * Currently only 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d).
+      * 
+      * This method is usually significantly faster than the QR algorithm
+      * but it might also be less accurate. It is also worth noting that
+      * for 3x3 matrices it involves trigonometric operations which are
+      * not necessarily available for all scalar types.
+      *
+      * \sa compute(const MatrixType&, int options)
+      */
+    SelfAdjointEigenSolver& computeDirect(const MatrixType& matrix, int options = ComputeEigenvectors);
 
     /** \brief Returns the eigenvectors of given matrix.
       *
@@ -401,7 +409,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
 
   // map the matrix coefficients to [-1:1] to avoid over- and underflow.
   RealScalar scale = matrix.cwiseAbs().maxCoeff();
-  if(scale==Scalar(0)) scale = 1;
+  if(scale==RealScalar(0)) scale = RealScalar(1);
   mat = matrix / scale;
   m_subdiag.resize(n-1);
   internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
@@ -466,19 +474,277 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
   return *this;
 }
 
+
+namespace internal {
+  
+template<typename SolverType,int Size,bool IsComplex> struct direct_selfadjoint_eigenvalues
+{
+  static inline void run(SolverType& eig, const typename SolverType::MatrixType& A, int options)
+  { eig.compute(A,options); }
+};
+
+template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3,false>
+{
+  typedef typename SolverType::MatrixType MatrixType;
+  typedef typename SolverType::RealVectorType VectorType;
+  typedef typename SolverType::Scalar Scalar;
+  
+  static inline void computeRoots(const MatrixType& m, VectorType& roots)
+  {
+    using std::sqrt;
+    using std::atan2;
+    using std::cos;
+    using std::sin;
+    const Scalar s_inv3 = Scalar(1.0)/Scalar(3.0);
+    const Scalar s_sqrt3 = sqrt(Scalar(3.0));
+
+    // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0.  The
+    // eigenvalues are the roots to this equation, all guaranteed to be
+    // real-valued, because the matrix is symmetric.
+    Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(1,0)*m(2,0)*m(2,1) - m(0,0)*m(2,1)*m(2,1) - m(1,1)*m(2,0)*m(2,0) - m(2,2)*m(1,0)*m(1,0);
+    Scalar c1 = m(0,0)*m(1,1) - m(1,0)*m(1,0) + m(0,0)*m(2,2) - m(2,0)*m(2,0) + m(1,1)*m(2,2) - m(2,1)*m(2,1);
+    Scalar c2 = m(0,0) + m(1,1) + m(2,2);
+
+    // Construct the parameters used in classifying the roots of the equation
+    // and in solving the equation for the roots in closed form.
+    Scalar c2_over_3 = c2*s_inv3;
+    Scalar a_over_3 = (c1 - c2*c2_over_3)*s_inv3;
+    if (a_over_3 > Scalar(0))
+      a_over_3 = Scalar(0);
+
+    Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1));
+
+    Scalar q = half_b*half_b + a_over_3*a_over_3*a_over_3;
+    if (q > Scalar(0))
+      q = Scalar(0);
+
+    // Compute the eigenvalues by solving for the roots of the polynomial.
+    Scalar rho = sqrt(-a_over_3);
+    Scalar theta = atan2(sqrt(-q),half_b)*s_inv3;
+    Scalar cos_theta = cos(theta);
+    Scalar sin_theta = sin(theta);
+    roots(0) = c2_over_3 + Scalar(2)*rho*cos_theta;
+    roots(1) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta);
+    roots(2) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta);
+
+    // Sort in increasing order.
+    if (roots(0) >= roots(1))
+      std::swap(roots(0),roots(1));
+    if (roots(1) >= roots(2))
+    {
+      std::swap(roots(1),roots(2));
+      if (roots(0) >= roots(1))
+        std::swap(roots(0),roots(1));
+    }
+  }
+  
+  static inline void run(SolverType& solver, const MatrixType& mat, int options)
+  {
+    using std::sqrt;
+    eigen_assert(mat.cols() == 3 && mat.cols() == mat.rows());
+    eigen_assert((options&~(EigVecMask|GenEigMask))==0
+            && (options&EigVecMask)!=EigVecMask
+            && "invalid option parameter");
+    bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
+    
+    MatrixType& eivecs = solver.m_eivec;
+    VectorType& eivals = solver.m_eivalues;
+  
+    // map the matrix coefficients to [-1:1] to avoid over- and underflow.
+    Scalar scale = mat.cwiseAbs().maxCoeff();
+    MatrixType scaledMat = mat / scale;
+
+    // compute the eigenvalues
+    computeRoots(scaledMat,eivals);
+
+    // compute the eigen vectors
+    if(computeEigenvectors)
+    {
+      Scalar safeNorm2 = Eigen::NumTraits<Scalar>::epsilon();
+      safeNorm2 *= safeNorm2;
+      if((eivals(2)-eivals(0))<=Eigen::NumTraits<Scalar>::epsilon())
+      {
+        eivecs.setIdentity();
+      }
+      else
+      {
+        scaledMat = scaledMat.template selfadjointView<Lower>();
+        MatrixType tmp;
+        tmp = scaledMat;
+
+        Scalar d0 = eivals(2) - eivals(1);
+        Scalar d1 = eivals(1) - eivals(0);
+        int k =  d0 > d1 ? 2 : 0;
+        d0 = d0 > d1 ? d1 : d0;
+
+        tmp.diagonal().array () -= eivals(k);
+        VectorType cross;
+        Scalar n;
+        n = (cross = tmp.row(0).cross(tmp.row(1))).squaredNorm();
+
+        if(n>safeNorm2)
+          eivecs.col(k) = cross / sqrt(n);
+        else
+        {
+          n = (cross = tmp.row(0).cross(tmp.row(2))).squaredNorm();
+
+          if(n>safeNorm2)
+            eivecs.col(k) = cross / sqrt(n);
+          else
+          {
+            n = (cross = tmp.row(1).cross(tmp.row(2))).squaredNorm();
+
+            if(n>safeNorm2)
+              eivecs.col(k) = cross / sqrt(n);
+            else
+            {
+              // the input matrix and/or the eigenvaues probably contains some inf/NaN,
+              // => exit
+              // scale back to the original size.
+              eivals *= scale;
+
+              solver.m_info = NumericalIssue;
+              solver.m_isInitialized = true;
+              solver.m_eigenvectorsOk = computeEigenvectors;
+              return;
+            }
+          }
+        }
+
+        tmp = scaledMat;
+        tmp.diagonal().array() -= eivals(1);
+
+        if(d0<=Eigen::NumTraits<Scalar>::epsilon())
+          eivecs.col(1) = eivecs.col(k).unitOrthogonal();
+        else
+        {
+          n = (cross = eivecs.col(k).cross(tmp.row(0).normalized())).squaredNorm();
+          if(n>safeNorm2)
+            eivecs.col(1) = cross / sqrt(n);
+          else
+          {
+            n = (cross = eivecs.col(k).cross(tmp.row(1))).squaredNorm();
+            if(n>safeNorm2)
+              eivecs.col(1) = cross / sqrt(n);
+            else
+            {
+              n = (cross = eivecs.col(k).cross(tmp.row(2))).squaredNorm();
+              if(n>safeNorm2)
+                eivecs.col(1) = cross / sqrt(n);
+              else
+              {
+                // we should never reach this point,
+                // if so the last two eigenvalues are likely to ve very closed to each other
+                eivecs.col(1) = eivecs.col(k).unitOrthogonal();
+              }
+            }
+          }
+
+          // make sure that eivecs[1] is orthogonal to eivecs[2]
+          Scalar d = eivecs.col(1).dot(eivecs.col(k));
+          eivecs.col(1) = (eivecs.col(1) - d * eivecs.col(k)).normalized();
+        }
+
+        eivecs.col(k==2 ? 0 : 2) = eivecs.col(k).cross(eivecs.col(1)).normalized();
+      }
+    }
+    // Rescale back to the original size.
+    eivals *= scale;
+    
+    solver.m_info = Success;
+    solver.m_isInitialized = true;
+    solver.m_eigenvectorsOk = computeEigenvectors;
+  }
+};
+
+// 2x2 direct eigenvalues decomposition, code from Hauke Heibel
+template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,2,false>
+{
+  typedef typename SolverType::MatrixType MatrixType;
+  typedef typename SolverType::RealVectorType VectorType;
+  typedef typename SolverType::Scalar Scalar;
+  
+  static inline void computeRoots(const MatrixType& m, VectorType& roots)
+  {
+    using std::sqrt;
+    const Scalar t0 = Scalar(0.5) * sqrt( abs2(m(0,0)-m(1,1)) + Scalar(4)*m(1,0)*m(1,0));
+    const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1));
+    roots(0) = t1 - t0;
+    roots(1) = t1 + t0;
+  }
+  
+  static inline void run(SolverType& solver, const MatrixType& mat, int options)
+  {
+    eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
+    eigen_assert((options&~(EigVecMask|GenEigMask))==0
+            && (options&EigVecMask)!=EigVecMask
+            && "invalid option parameter");
+    bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
+    
+    MatrixType& eivecs = solver.m_eivec;
+    VectorType& eivals = solver.m_eivalues;
+  
+    // map the matrix coefficients to [-1:1] to avoid over- and underflow.
+    Scalar scale = mat.cwiseAbs().maxCoeff();
+    scale = (std::max)(scale,Scalar(1));
+    MatrixType scaledMat = mat / scale;
+    
+    // Compute the eigenvalues
+    computeRoots(scaledMat,eivals);
+    
+    // compute the eigen vectors
+    if(computeEigenvectors)
+    {
+      scaledMat.diagonal().array () -= eivals(1);
+      Scalar a2 = abs2(scaledMat(0,0));
+      Scalar c2 = abs2(scaledMat(1,1));
+      Scalar b2 = abs2(scaledMat(1,0));
+      if(a2>c2)
+      {
+        eivecs.col(1) << -scaledMat(1,0), scaledMat(0,0);
+        eivecs.col(1) /= sqrt(a2+b2);
+      }
+      else
+      {
+        eivecs.col(1) << -scaledMat(1,1), scaledMat(1,0);
+        eivecs.col(1) /= sqrt(c2+b2);
+      }
+
+      eivecs.col(0) << eivecs.col(1).unitOrthogonal();
+    }
+    
+    // Rescale back to the original size.
+    eivals *= scale;
+    
+    solver.m_info = Success;
+    solver.m_isInitialized = true;
+    solver.m_eigenvectorsOk = computeEigenvectors;
+  }
+};
+
+}
+
+template<typename MatrixType>
+SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
+::computeDirect(const MatrixType& matrix, int options)
+{
+  internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver,Size,NumTraits<Scalar>::IsComplex>::run(*this,matrix,options);
+  return *this;
+}
+
 namespace internal {
 template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
 static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
 {
-  // NOTE this version avoids over & underflow, however since the matrix is prescaled, overflow cannot occur,
-  // and underflows should be meaningless anyway. So I don't any reason to enable this version, but I keep
-  // it here for reference:
-//   RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
-//   RealScalar e = subdiag[end-1];
-//   RealScalar mu = diag[end] - (e / (td + (td>0 ? 1 : -1))) * (e / hypot(td,e));
   RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
-  RealScalar e2 = abs2(subdiag[end-1]);
-  RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
+  RealScalar e = subdiag[end-1];
+  // Note that thanks to scaling, e^2 or td^2 cannot overflow, however they can still
+  // underflow thus leading to inf/NaN values when using the following commented code:
+//   RealScalar e2 = abs2(subdiag[end-1]);
+//   RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
+  // This explain the following, somewhat more complicated, version:
+  RealScalar mu = diag[end] - (e / (td + (td>0 ? 1 : -1))) * (e / hypot(td,e));
+  
   RealScalar x = diag[start] - mu;
   RealScalar z = subdiag[start];
   for (Index k = start; k < end; ++k)
@@ -515,6 +781,9 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
     }
   }
 }
+
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_SELFADJOINTEIGENSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h b/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h
new file mode 100644
index 0000000..9380956
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Self-adjoint eigenvalues/eigenvectors.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_SAEIGENSOLVER_MKL_H
+#define EIGEN_SAEIGENSOLVER_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_EIG_SELFADJ(EIGTYPE, MKLTYPE, MKLRTYPE, MKLNAME, EIGCOLROW, MKLCOLROW ) \
+template<> inline\
+SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
+SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, int options) \
+{ \
+  eigen_assert(matrix.cols() == matrix.rows()); \
+  eigen_assert((options&~(EigVecMask|GenEigMask))==0 \
+          && (options&EigVecMask)!=EigVecMask \
+          && "invalid option parameter"); \
+  bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \
+  lapack_int n = matrix.cols(), lda, matrix_order, info; \
+  m_eivalues.resize(n,1); \
+  m_subdiag.resize(n-1); \
+  m_eivec = matrix; \
+\
+  if(n==1) \
+  { \
+    m_eivalues.coeffRef(0,0) = internal::real(matrix.coeff(0,0)); \
+    if(computeEigenvectors) m_eivec.setOnes(n,n); \
+    m_info = Success; \
+    m_isInitialized = true; \
+    m_eigenvectorsOk = computeEigenvectors; \
+    return *this; \
+  } \
+\
+  lda = matrix.outerStride(); \
+  matrix_order=MKLCOLROW; \
+  char jobz, uplo='L'/*, range='A'*/; \
+  jobz = computeEigenvectors ? 'V' : 'N'; \
+\
+  info = LAPACKE_##MKLNAME( matrix_order, jobz, uplo, n, (MKLTYPE*)m_eivec.data(), lda, (MKLRTYPE*)m_eivalues.data() ); \
+  m_info = (info==0) ? Success : NoConvergence; \
+  m_isInitialized = true; \
+  m_eigenvectorsOk = computeEigenvectors; \
+  return *this; \
+}
+
+
+EIGEN_MKL_EIG_SELFADJ(double,   double,        double, dsyev, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(float,    float,         float,  ssyev, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(dcomplex, MKL_Complex16, double, zheev, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(scomplex, MKL_Complex8,  float,  cheev, ColMajor, LAPACK_COL_MAJOR)
+
+EIGEN_MKL_EIG_SELFADJ(double,   double,        double, dsyev, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(float,    float,         float,  ssyev, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(dcomplex, MKL_Complex16, double, zheev, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_EIG_SELFADJ(scomplex, MKL_Complex8,  float,  cheev, RowMajor, LAPACK_ROW_MAJOR)
+
+} // end namespace Eigen
+
+#endif // EIGEN_SAEIGENSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h b/extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
index ae4cdce..c34b7b3 100644
--- a/extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
+++ b/extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Jitse Niesen <jitse at maths.leeds.ac.uk>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRIDIAGONALIZATION_H
 #define EIGEN_TRIDIAGONALIZATION_H
 
+namespace Eigen { 
+
 namespace internal {
   
 template<typename MatrixType> struct TridiagonalizationMatrixTReturnType;
@@ -97,13 +84,13 @@ template<typename _MatrixType> class Tridiagonalization
     typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType;
 
     typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
-              const typename Diagonal<const MatrixType>::RealReturnType,
+              typename internal::add_const_on_value_type<typename Diagonal<const MatrixType>::RealReturnType>::type,
               const Diagonal<const MatrixType>
             >::type DiagonalReturnType;
 
     typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
-              const typename Diagonal<
-                Block<const MatrixType,SizeMinusOne,SizeMinusOne> >::RealReturnType,
+              typename internal::add_const_on_value_type<typename Diagonal<
+                Block<const MatrixType,SizeMinusOne,SizeMinusOne> >::RealReturnType>::type,
               const Diagonal<
                 Block<const MatrixType,SizeMinusOne,SizeMinusOne> >
             >::type SubDiagonalReturnType;
@@ -560,9 +547,11 @@ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
     Index cols() const { return m_matrix.cols(); }
 
   protected:
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRIDIAGONALIZATION_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/AlignedBox.h b/extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
index b51deb3..5830fcd 100644
--- a/extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
+++ b/extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ALIGNEDBOX_H
 #define EIGEN_ALIGNEDBOX_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   *
@@ -190,7 +177,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
   template<typename Derived>
   inline bool contains(const MatrixBase<Derived>& a_p) const
   {
-    const typename internal::nested<Derived,2>::type p(a_p.derived());
+    typename internal::nested<Derived,2>::type p(a_p.derived());
     return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all();
   }
 
@@ -202,7 +189,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
   template<typename Derived>
   inline AlignedBox& extend(const MatrixBase<Derived>& a_p)
   {
-    const typename internal::nested<Derived,2>::type p(a_p.derived());
+    typename internal::nested<Derived,2>::type p(a_p.derived());
     m_min = m_min.cwiseMin(p);
     m_max = m_max.cwiseMax(p);
     return *this;
@@ -310,7 +297,7 @@ template<typename Derived>
 inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const MatrixBase<Derived>& a_p) const
 {
   const typename internal::nested<Derived,2*AmbientDim>::type p(a_p.derived());
-  Scalar dist2 = 0.;
+  Scalar dist2(0);
   Scalar aux;
   for (Index k=0; k<dim(); ++k)
   {
@@ -331,7 +318,7 @@ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const Matri
 template<typename Scalar,int AmbientDim>
 inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const AlignedBox& b) const
 {
-  Scalar dist2 = 0.;
+  Scalar dist2(0);
   Scalar aux;
   for (Index k=0; k<dim(); ++k)
   {
@@ -349,4 +336,40 @@ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const Align
   return dist2;
 }
 
+/** \defgroup alignedboxtypedefs Global aligned box typedefs
+  *
+  * \ingroup Geometry_Module
+  *
+  * Eigen defines several typedef shortcuts for most common aligned box types.
+  *
+  * The general patterns are the following:
+  *
+  * \c AlignedBoxSizeType where \c Size can be \c 1, \c 2,\c 3,\c 4 for fixed size boxes or \c X for dynamic size,
+  * and where \c Type can be \c i for integer, \c f for float, \c d for double.
+  *
+  * For example, \c AlignedBox3d is a fixed-size 3x3 aligned box type of doubles, and \c AlignedBoxXf is a dynamic-size aligned box of floats.
+  *
+  * \sa class AlignedBox
+  */
+
+#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix)    \
+/** \ingroup alignedboxtypedefs */                                 \
+typedef AlignedBox<Type, Size>   AlignedBox##SizeSuffix##TypeSuffix;
+
+#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
+EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 1, 1) \
+EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
+EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
+EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
+EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X)
+
+EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int,                  i)
+EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float,                f)
+EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double,               d)
+
+#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
+#undef EIGEN_MAKE_TYPEDEFS
+
+} // end namespace Eigen
+
 #endif // EIGEN_ALIGNEDBOX_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/AngleAxis.h b/extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
index 0ec4624..67197ac 100644
--- a/extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
+++ b/extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ANGLEAXIS_H
 #define EIGEN_ANGLEAXIS_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class AngleAxis
@@ -144,7 +131,7 @@ public:
     m_angle = Scalar(other.angle());
   }
 
-  inline static const AngleAxis Identity() { return AngleAxis(0, Vector3::UnitX()); }
+  static inline const AngleAxis Identity() { return AngleAxis(0, Vector3::UnitX()); }
 
   /** \returns \c true if \c *this is approximately equal to \a other, within the precision
     * determined by \a prec.
@@ -238,4 +225,6 @@ AngleAxis<Scalar>::toRotationMatrix(void) const
   return res;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ANGLEAXIS_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/EulerAngles.h b/extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
index d246a6e..e424d24 100644
--- a/extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
+++ b/extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_EULERANGLES_H
 #define EIGEN_EULERANGLES_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   *
@@ -92,5 +79,6 @@ MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
   return res;
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_EULERANGLES_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Homogeneous.h b/extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
index 2bc4f7e..df03feb 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_HOMOGENEOUS_H
 #define EIGEN_HOMOGENEOUS_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Homogeneous
@@ -121,7 +108,7 @@ template<typename MatrixType,int _Direction> class Homogeneous
     }
 
   protected:
-    const typename MatrixType::Nested m_matrix;
+    typename MatrixType::Nested m_matrix;
 };
 
 /** \geometry_module
@@ -216,8 +203,8 @@ template<typename Scalar, int Dim, int Mode,int Options>
 struct take_matrix_for_product<Transform<Scalar, Dim, Mode, Options> >
 {
   typedef Transform<Scalar, Dim, Mode, Options> TransformType;
-  typedef typename TransformType::ConstAffinePart type;
-  static const type run (const TransformType& x) { return x.affine(); }
+  typedef typename internal::add_const<typename TransformType::ConstAffinePart>::type type;
+  static type run (const TransformType& x) { return x.affine(); }
 };
 
 template<typename Scalar, int Dim, int Options>
@@ -270,8 +257,8 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
             .template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols());
   }
 
-  const typename LhsMatrixTypeCleaned::Nested m_lhs;
-  const typename MatrixType::Nested m_rhs;
+  typename LhsMatrixTypeCleaned::Nested m_lhs;
+  typename MatrixType::Nested m_rhs;
 };
 
 template<typename MatrixType,typename Rhs>
@@ -309,10 +296,12 @@ struct homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
             .template replicate<MatrixType::RowsAtCompileTime>(m_lhs.rows());
   }
 
-  const typename MatrixType::Nested m_lhs;
-  const typename Rhs::Nested m_rhs;
+  typename MatrixType::Nested m_lhs;
+  typename Rhs::Nested m_rhs;
 };
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_HOMOGENEOUS_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Hyperplane.h b/extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
index d85d3e5..1b7c7c7 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_HYPERPLANE_H
 #define EIGEN_HYPERPLANE_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Hyperplane
@@ -277,4 +264,6 @@ protected:
   Coefficients m_coeffs;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_HYPERPLANE_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h b/extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h
index 52b4698..11ad582 100644
--- a/extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h
+++ b/extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ORTHOMETHODS_H
 #define EIGEN_ORTHOMETHODS_H
 
+namespace Eigen { 
+
 /** \geometry_module
   *
   * \returns the cross product of \c *this and \a other
@@ -43,8 +30,8 @@ MatrixBase<Derived>::cross(const MatrixBase<OtherDerived>& other) const
 
   // Note that there is no need for an expression here since the compiler
   // optimize such a small temporary very well (even within a complex expression)
-  const typename internal::nested<Derived,2>::type lhs(derived());
-  const typename internal::nested<OtherDerived,2>::type rhs(other.derived());
+  typename internal::nested<Derived,2>::type lhs(derived());
+  typename internal::nested<OtherDerived,2>::type rhs(other.derived());
   return typename cross_product_return_type<OtherDerived>::type(
     internal::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
     internal::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),
@@ -56,9 +43,9 @@ namespace internal {
 
 template< int Arch,typename VectorLhs,typename VectorRhs,
           typename Scalar = typename VectorLhs::Scalar,
-          bool Vectorizable = (VectorLhs::Flags&VectorRhs::Flags)&PacketAccessBit>
+          bool Vectorizable = bool((VectorLhs::Flags&VectorRhs::Flags)&PacketAccessBit)>
 struct cross3_impl {
-  inline static typename internal::plain_matrix_type<VectorLhs>::type
+  static inline typename internal::plain_matrix_type<VectorLhs>::type
   run(const VectorLhs& lhs, const VectorRhs& rhs)
   {
     return typename internal::plain_matrix_type<VectorLhs>::type(
@@ -145,7 +132,7 @@ struct unitOrthogonal_selector
   typedef typename NumTraits<Scalar>::Real RealScalar;
   typedef typename Derived::Index Index;
   typedef Matrix<Scalar,2,1> Vector2;
-  inline static VectorType run(const Derived& src)
+  static inline VectorType run(const Derived& src)
   {
     VectorType perp = VectorType::Zero(src.size());
     Index maxi = 0;
@@ -167,7 +154,7 @@ struct unitOrthogonal_selector<Derived,3>
   typedef typename plain_matrix_type<Derived>::type VectorType;
   typedef typename traits<Derived>::Scalar Scalar;
   typedef typename NumTraits<Scalar>::Real RealScalar;
-  inline static VectorType run(const Derived& src)
+  static inline VectorType run(const Derived& src)
   {
     VectorType perp;
     /* Let us compute the crossed product of *this with a vector
@@ -205,7 +192,7 @@ template<typename Derived>
 struct unitOrthogonal_selector<Derived,2>
 {
   typedef typename plain_matrix_type<Derived>::type VectorType;
-  inline static VectorType run(const Derived& src)
+  static inline VectorType run(const Derived& src)
   { return VectorType(-conj(src.y()), conj(src.x())).normalized(); }
 };
 
@@ -226,4 +213,6 @@ MatrixBase<Derived>::unitOrthogonal() const
   return internal::unitOrthogonal_selector<Derived>::run(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ORTHOMETHODS_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h b/extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h
index b90f9c0..719a904 100644
--- a/extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h
+++ b/extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PARAMETRIZEDLINE_H
 #define EIGEN_PARAMETRIZEDLINE_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class ParametrizedLine
@@ -106,8 +93,16 @@ public:
   VectorType projection(const VectorType& p) const
   { return origin() + direction().dot(p-origin()) * direction(); }
 
+  VectorType pointAt( Scalar t ) const;
+  
+  template <int OtherOptions>
+  Scalar intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
+ 
   template <int OtherOptions>
   Scalar intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
+  
+  template <int OtherOptions>
+  VectorType intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
 
   /** \returns \c *this with scalar type casted to \a NewScalarType
     *
@@ -155,14 +150,46 @@ inline ParametrizedLine<_Scalar, _AmbientDim,_Options>::ParametrizedLine(const H
   origin() = -hyperplane.normal()*hyperplane.offset();
 }
 
-/** \returns the parameter value of the intersection between \c *this and the given hyperplane
+/** \returns the point at \a t along this line
+  */
+template <typename _Scalar, int _AmbientDim, int _Options>
+inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType
+ParametrizedLine<_Scalar, _AmbientDim,_Options>::pointAt( _Scalar t ) const
+{
+  return origin() + (direction()*t); 
+}
+
+/** \returns the parameter value of the intersection between \c *this and the given \a hyperplane
   */
 template <typename _Scalar, int _AmbientDim, int _Options>
 template <int OtherOptions>
-inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
+inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
 {
   return -(hyperplane.offset()+hyperplane.normal().dot(origin()))
           / hyperplane.normal().dot(direction());
 }
 
+
+/** \deprecated use intersectionParameter()
+  * \returns the parameter value of the intersection between \c *this and the given \a hyperplane
+  */
+template <typename _Scalar, int _AmbientDim, int _Options>
+template <int OtherOptions>
+inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
+{
+  return intersectionParameter(hyperplane);
+}
+
+/** \returns the point of the intersection between \c *this and the given hyperplane
+  */
+template <typename _Scalar, int _AmbientDim, int _Options>
+template <int OtherOptions>
+inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType
+ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
+{
+  return pointAt(intersectionParameter(hyperplane));
+}
+
+} // end namespace Eigen
+
 #endif // EIGEN_PARAMETRIZEDLINE_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Quaternion.h b/extern/Eigen3/Eigen/src/Geometry/Quaternion.h
index 9180db6..8792e2d 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Quaternion.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Quaternion.h
@@ -4,27 +4,14 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Mathieu Gautier <mathieu.gautier at cea.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_QUATERNION_H
 #define EIGEN_QUATERNION_H
+namespace Eigen { 
+
 
 /***************************************************************************
 * Definition of QuaternionBase<Derived>
@@ -38,6 +25,12 @@ template<typename Other,
 struct quaternionbase_assign_impl;
 }
 
+/** \geometry_module \ingroup Geometry_Module
+  * \class QuaternionBase
+  * \brief Base class for quaternion expressions
+  * \tparam Derived derived type (CRTP)
+  * \sa class Quaternion
+  */
 template<class Derived>
 class QuaternionBase : public RotationBase<Derived, 3>
 {
@@ -109,7 +102,7 @@ public:
   /** \returns a quaternion representing an identity rotation
     * \sa MatrixBase::Identity()
     */
-  inline static Quaternion<Scalar> Identity() { return Quaternion<Scalar>(1, 0, 0, 0); }
+  static inline Quaternion<Scalar> Identity() { return Quaternion<Scalar>(1, 0, 0, 0); }
 
   /** \sa QuaternionBase::Identity(), MatrixBase::setIdentity()
     */
@@ -278,6 +271,9 @@ public:
   explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other)
   { m_coeffs = other.coeffs().template cast<Scalar>(); }
 
+  template<typename Derived1, typename Derived2>
+  static Quaternion FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
+
   inline Coefficients& coeffs() { return m_coeffs;}
   inline const Coefficients& coeffs() const { return m_coeffs;}
 
@@ -287,7 +283,7 @@ protected:
   Coefficients m_coeffs;
   
 #ifndef EIGEN_PARSED_BY_DOXYGEN
-    EIGEN_STRONG_INLINE static void _check_template_params()
+    static EIGEN_STRONG_INLINE void _check_template_params()
     {
       EIGEN_STATIC_ASSERT( (_Options & DontAlign) == _Options,
         INVALID_MATRIX_TEMPLATE_PARAMETERS)
@@ -434,7 +430,7 @@ typedef Map<Quaternion<double>, Aligned>  QuaternionMapAlignedd;
 namespace internal {
 template<int Arch, class Derived1, class Derived2, typename Scalar, int _Options> struct quat_product
 {
-  EIGEN_STRONG_INLINE static Quaternion<Scalar> run(const QuaternionBase<Derived1>& a, const QuaternionBase<Derived2>& b){
+  static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived1>& a, const QuaternionBase<Derived2>& b){
     return Quaternion<Scalar>
     (
       a.w() * b.w() - a.x() * b.x() - a.y() * b.y() - a.z() * b.z(),
@@ -544,9 +540,9 @@ QuaternionBase<Derived>::toRotationMatrix(void) const
   // it has to be inlined, and so the return by value is not an issue
   Matrix3 res;
 
-  const Scalar tx  = 2*this->x();
-  const Scalar ty  = 2*this->y();
-  const Scalar tz  = 2*this->z();
+  const Scalar tx  = Scalar(2)*this->x();
+  const Scalar ty  = Scalar(2)*this->y();
+  const Scalar tz  = Scalar(2)*this->z();
   const Scalar twx = tx*this->w();
   const Scalar twy = ty*this->w();
   const Scalar twz = tz*this->w();
@@ -557,15 +553,15 @@ QuaternionBase<Derived>::toRotationMatrix(void) const
   const Scalar tyz = tz*this->y();
   const Scalar tzz = tz*this->z();
 
-  res.coeffRef(0,0) = 1-(tyy+tzz);
+  res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
   res.coeffRef(0,1) = txy-twz;
   res.coeffRef(0,2) = txz+twy;
   res.coeffRef(1,0) = txy+twz;
-  res.coeffRef(1,1) = 1-(txx+tzz);
+  res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
   res.coeffRef(1,2) = tyz-twx;
   res.coeffRef(2,0) = txz-twy;
   res.coeffRef(2,1) = tyz+twx;
-  res.coeffRef(2,2) = 1-(txx+tyy);
+  res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
 
   return res;
 }
@@ -618,6 +614,27 @@ inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Deri
   return derived();
 }
 
+
+/** Returns a quaternion representing a rotation between
+  * the two arbitrary vectors \a a and \a b. In other words, the built
+  * rotation represent a rotation sending the line of direction \a a
+  * to the line of direction \a b, both lines passing through the origin.
+  *
+  * \returns resulting quaternion
+  *
+  * Note that the two input vectors do \b not have to be normalized, and
+  * do not need to have the same norm.
+  */
+template<typename Scalar, int Options>
+template<typename Derived1, typename Derived2>
+Quaternion<Scalar,Options> Quaternion<Scalar,Options>::FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b)
+{
+    Quaternion quat;
+    quat.setFromTwoVectors(a, b);
+    return quat;
+}
+
+
 /** \returns the multiplicative inverse of \c *this
   * Note that in most cases, i.e., if you simply want the opposite rotation,
   * and/or the quaternion is normalized, then it is enough to use the conjugate.
@@ -709,7 +726,7 @@ struct quaternionbase_assign_impl<Other,3,3>
 {
   typedef typename Other::Scalar Scalar;
   typedef DenseIndex Index;
-  template<class Derived> inline static void run(QuaternionBase<Derived>& q, const Other& mat)
+  template<class Derived> static inline void run(QuaternionBase<Derived>& q, const Other& mat)
   {
     // This algorithm comes from  "Quaternion Calculus and Fast Animation",
     // Ken Shoemake, 1987 SIGGRAPH course notes
@@ -748,7 +765,7 @@ template<typename Other>
 struct quaternionbase_assign_impl<Other,4,1>
 {
   typedef typename Other::Scalar Scalar;
-  template<class Derived> inline static void run(QuaternionBase<Derived>& q, const Other& vec)
+  template<class Derived> static inline void run(QuaternionBase<Derived>& q, const Other& vec)
   {
     q.coeffs() = vec;
   }
@@ -756,4 +773,6 @@ struct quaternionbase_assign_impl<Other,4,1>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_QUATERNION_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Rotation2D.h b/extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
index cf36da1..868e2ef 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ROTATION2D_H
 #define EIGEN_ROTATION2D_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Rotation2D
@@ -121,7 +108,7 @@ public:
     m_angle = Scalar(other.angle());
   }
 
-  inline static Rotation2D Identity() { return Rotation2D(0); }
+  static inline Rotation2D Identity() { return Rotation2D(0); }
 
   /** \returns \c true if \c *this is approximately equal to \a other, within the precision
     * determined by \a prec.
@@ -162,4 +149,6 @@ Rotation2D<Scalar>::toRotationMatrix(void) const
   return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_ROTATION2D_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/RotationBase.h b/extern/Eigen3/Eigen/src/Geometry/RotationBase.h
index 1abf06b..b88661d 100644
--- a/extern/Eigen3/Eigen/src/Geometry/RotationBase.h
+++ b/extern/Eigen3/Eigen/src/Geometry/RotationBase.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_ROTATIONBASE_H
 #define EIGEN_ROTATIONBASE_H
 
+namespace Eigen { 
+
 // forward declaration
 namespace internal {
 template<typename RotationDerived, typename MatrixType, bool IsVector=MatrixType::IsVectorAtCompileTime>
@@ -115,7 +102,7 @@ struct rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
 {
   enum { Dim = RotationDerived::Dim };
   typedef Matrix<typename RotationDerived::Scalar,Dim,Dim> ReturnType;
-  inline static ReturnType run(const RotationDerived& r, const MatrixType& m)
+  static inline ReturnType run(const RotationDerived& r, const MatrixType& m)
   { return r.toRotationMatrix() * m; }
 };
 
@@ -123,7 +110,7 @@ template<typename RotationDerived, typename Scalar, int Dim, int MaxDim>
 struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
 {
   typedef Transform<Scalar,Dim,Affine> ReturnType;
-  inline static ReturnType run(const RotationDerived& r, const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
+  static inline ReturnType run(const RotationDerived& r, const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
   {
     ReturnType res(r);
     res.linear() *= m;
@@ -136,7 +123,7 @@ struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,tr
 {
   enum { Dim = RotationDerived::Dim };
   typedef Matrix<typename RotationDerived::Scalar,Dim,1> ReturnType;
-  EIGEN_STRONG_INLINE static ReturnType run(const RotationDerived& r, const OtherVectorType& v)
+  static EIGEN_STRONG_INLINE ReturnType run(const RotationDerived& r, const OtherVectorType& v)
   {
     return r._transformVector(v);
   }
@@ -192,20 +179,20 @@ namespace internal {
   * \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis
   */
 template<typename Scalar, int Dim>
-inline static Matrix<Scalar,2,2> toRotationMatrix(const Scalar& s)
+static inline Matrix<Scalar,2,2> toRotationMatrix(const Scalar& s)
 {
   EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
   return Rotation2D<Scalar>(s).toRotationMatrix();
 }
 
 template<typename Scalar, int Dim, typename OtherDerived>
-inline static Matrix<Scalar,Dim,Dim> toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
+static inline Matrix<Scalar,Dim,Dim> toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
 {
   return r.toRotationMatrix();
 }
 
 template<typename Scalar, int Dim, typename OtherDerived>
-inline static const MatrixBase<OtherDerived>& toRotationMatrix(const MatrixBase<OtherDerived>& mat)
+static inline const MatrixBase<OtherDerived>& toRotationMatrix(const MatrixBase<OtherDerived>& mat)
 {
   EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
     YOU_MADE_A_PROGRAMMING_MISTAKE)
@@ -214,4 +201,6 @@ inline static const MatrixBase<OtherDerived>& toRotationMatrix(const MatrixBase<
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_ROTATIONBASE_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Scaling.h b/extern/Eigen3/Eigen/src/Geometry/Scaling.h
index c911d13..8edcac3 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Scaling.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Scaling.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_SCALING_H
 #define EIGEN_SCALING_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Scaling
@@ -73,7 +60,12 @@ public:
 
   /** Concatenates a uniform scaling and an affine transformation */
   template<int Dim, int Mode, int Options>
-  inline Transform<Scalar,Dim,Mode> operator* (const Transform<Scalar,Dim, Mode, Options>& t) const;
+  inline Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Mode)> operator* (const Transform<Scalar,Dim, Mode, Options>& t) const
+  {
+   Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Mode)> res = t;
+   res.prescale(factor());
+   return res;
+}
 
   /** Concatenates a uniform scaling and a linear transformation matrix */
   // TODO returns an expression
@@ -169,14 +161,6 @@ UniformScaling<Scalar>::operator* (const Translation<Scalar,Dim>& t) const
   return res;
 }
 
-template<typename Scalar>
-template<int Dim,int Mode,int Options>
-inline Transform<Scalar,Dim,Mode>
-UniformScaling<Scalar>::operator* (const Transform<Scalar,Dim, Mode, Options>& t) const
-{
-  Transform<Scalar,Dim,Mode> res = t;
-  res.prescale(factor());
-  return res;
-}
+} // end namespace Eigen
 
 #endif // EIGEN_SCALING_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Transform.h b/extern/Eigen3/Eigen/src/Geometry/Transform.h
index a694673..4c1ef8e 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Transform.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Transform.h
@@ -5,28 +5,15 @@
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2010 Hauke Heibel <hauke.heibel at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRANSFORM_H
 #define EIGEN_TRANSFORM_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Transform>
@@ -37,7 +24,7 @@ struct transform_traits
     Dim = Transform::Dim,
     HDim = Transform::HDim,
     Mode = Transform::Mode,
-    IsProjective = (Mode==Projective)
+    IsProjective = (int(Mode)==int(Projective))
   };
 };
 
@@ -207,9 +194,9 @@ public:
   /** type of the matrix used to represent the linear part of the transformation */
   typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
   /** type of read/write reference to the linear part of the transformation */
-  typedef Block<MatrixType,Dim,Dim> LinearPart;
+  typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact)> LinearPart;
   /** type of read reference to the linear part of the transformation */
-  typedef const Block<ConstMatrixType,Dim,Dim> ConstLinearPart;
+  typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact)> ConstLinearPart;
   /** type of read/write reference to the affine part of the transformation */
   typedef typename internal::conditional<int(Mode)==int(AffineCompact),
                               MatrixType&,
@@ -221,9 +208,9 @@ public:
   /** type of a vector */
   typedef Matrix<Scalar,Dim,1> VectorType;
   /** type of a read/write reference to the translation part of the rotation */
-  typedef Block<MatrixType,Dim,1> TranslationPart;
+  typedef Block<MatrixType,Dim,1,int(Mode)==(AffineCompact)> TranslationPart;
   /** type of a read reference to the translation part of the rotation */
-  typedef const Block<ConstMatrixType,Dim,1> ConstTranslationPart;
+  typedef const Block<ConstMatrixType,Dim,1,int(Mode)==(AffineCompact)> ConstTranslationPart;
   /** corresponding translation type */
   typedef Translation<Scalar,Dim> TranslationType;
   
@@ -279,6 +266,9 @@ public:
   template<typename OtherDerived>
   inline explicit Transform(const EigenBase<OtherDerived>& other)
   {
+    EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
+      YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
+
     check_template_params();
     internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
   }
@@ -287,6 +277,9 @@ public:
   template<typename OtherDerived>
   inline Transform& operator=(const EigenBase<OtherDerived>& other)
   {
+    EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
+      YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
+
     internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
     return *this;
   }
@@ -376,9 +369,9 @@ public:
   inline MatrixType& matrix() { return m_matrix; }
 
   /** \returns a read-only expression of the linear part of the transformation */
-  inline ConstLinearPart linear() const { return m_matrix.template block<Dim,Dim>(0,0); }
+  inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
   /** \returns a writable expression of the linear part of the transformation */
-  inline LinearPart linear() { return m_matrix.template block<Dim,Dim>(0,0); }
+  inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
 
   /** \returns a read-only expression of the Dim x HDim affine part of the transformation */
   inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
@@ -386,9 +379,9 @@ public:
   inline AffinePart affine() { return take_affine_part::run(m_matrix); }
 
   /** \returns a read-only expression of the translation vector of the transformation */
-  inline ConstTranslationPart translation() const { return m_matrix.template block<Dim,1>(0,Dim); }
+  inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
   /** \returns a writable expression of the translation vector of the transformation */
-  inline TranslationPart translation() { return m_matrix.template block<Dim,1>(0,Dim); }
+  inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
 
   /** \returns an expression of the product between the transform \c *this and a matrix expression \a other
     *
@@ -460,15 +453,40 @@ public:
   {
     return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
   }
-
+  
+  #ifdef __INTEL_COMPILER
+private:
+  // this intermediate structure permits to workaround a bug in ICC 11:
+  //   error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
+  //             (const Eigen::Transform<double, 3, 2, 0> &) const"
+  //  (the meaning of a name may have changed since the template declaration -- the type of the template is:
+  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
+  //     Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
+  // 
+  template<int OtherMode,int OtherOptions> struct icc_11_workaround
+  {
+    typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
+    typedef typename ProductType::ResultType ResultType;
+  };
+  
+public:
+  /** Concatenates two different transformations */
+  template<int OtherMode,int OtherOptions>
+  inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
+    operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
+  {
+    typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
+    return ProductType::run(*this,other);
+  }
+  #else
   /** Concatenates two different transformations */
   template<int OtherMode,int OtherOptions>
-  inline const typename internal::transform_transform_product_impl<
-    Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
+  inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
     operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
   {
     return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
   }
+  #endif
 
   /** \sa MatrixBase::setIdentity() */
   void setIdentity() { m_matrix.setIdentity(); }
@@ -512,7 +530,12 @@ public:
 
   inline Transform& operator=(const UniformScaling<Scalar>& t);
   inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
-  inline Transform operator*(const UniformScaling<Scalar>& s) const;
+  inline Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Isometry)> operator*(const UniformScaling<Scalar>& s) const
+  {
+    Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Isometry),Options> res = *this;
+    res.scale(s.factor());
+    return res;
+  }
 
   inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linear() *= s; return *this; }
 
@@ -571,7 +594,7 @@ public:
     if(int(Mode)!=int(AffineCompact))
     {
       matrix().template block<1,Dim>(Dim,0).setZero();
-      matrix().coeffRef(Dim,Dim) = 1;
+      matrix().coeffRef(Dim,Dim) = Scalar(1);
     }
   }
 
@@ -608,7 +631,7 @@ public:
   
 protected:
   #ifndef EIGEN_PARSED_BY_DOXYGEN
-    EIGEN_STRONG_INLINE static void check_template_params()
+    static EIGEN_STRONG_INLINE void check_template_params()
     {
       EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
     }
@@ -941,14 +964,6 @@ inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::o
 }
 
 template<typename Scalar, int Dim, int Mode, int Options>
-inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const UniformScaling<Scalar>& s) const
-{
-  Transform res = *this;
-  res.scale(s.factor());
-  return res;
-}
-
-template<typename Scalar, int Dim, int Mode, int Options>
 template<typename Derived>
 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
 {
@@ -1219,7 +1234,7 @@ struct transform_right_product_impl< TransformType, MatrixType, 0 >
 {
   typedef typename MatrixType::PlainObject ResultType;
 
-  EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
+  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
   {
     return T.matrix() * other;
   }
@@ -1237,11 +1252,11 @@ struct transform_right_product_impl< TransformType, MatrixType, 1 >
 
   typedef typename MatrixType::PlainObject ResultType;
 
-  EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
+  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
   {
     EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
 
-    typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
+    typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
 
     ResultType res(other.rows(),other.cols());
     TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
@@ -1263,15 +1278,13 @@ struct transform_right_product_impl< TransformType, MatrixType, 2 >
 
   typedef typename MatrixType::PlainObject ResultType;
 
-  EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
+  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
   {
     EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
 
-    typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
-
-    ResultType res(other.rows(),other.cols());
-    TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.linear() * other;
-    TopLeftLhs(res, 0, 0, Dim, other.cols()).colwise() += T.translation();
+    typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
+    ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
+    TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
 
     return res;
   }
@@ -1422,4 +1435,6 @@ struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptio
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRANSFORM_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Translation.h b/extern/Eigen3/Eigen/src/Geometry/Translation.h
index d8fe50f..7fda179 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Translation.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Translation.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_TRANSLATION_H
 #define EIGEN_TRANSLATION_H
 
+namespace Eigen { 
+
 /** \geometry_module \ingroup Geometry_Module
   *
   * \class Translation
@@ -54,6 +41,8 @@ public:
   typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
   /** corresponding affine transformation type */
   typedef Transform<Scalar,Dim,Affine> AffineTransformType;
+  /** corresponding isometric transformation type */
+  typedef Transform<Scalar,Dim,Isometry> IsometryTransformType;
 
 protected:
 
@@ -114,8 +103,8 @@ public:
 
   /** Concatenates a translation and a rotation */
   template<typename Derived>
-  inline AffineTransformType operator*(const RotationBase<Derived,Dim>& r) const
-  { return *this * r.toRotationMatrix(); }
+  inline IsometryTransformType operator*(const RotationBase<Derived,Dim>& r) const
+  { return *this * IsometryTransformType(r); }
 
   /** \returns the concatenation of a linear transformation \a l with the translation \a t */
   // its a nightmare to define a templated friend function outside its declaration
@@ -212,4 +201,6 @@ Translation<Scalar,Dim>::operator* (const EigenBase<OtherDerived>& linear) const
   return res;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_TRANSLATION_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/Umeyama.h b/extern/Eigen3/Eigen/src/Geometry/Umeyama.h
index b50f461..ac0939c 100644
--- a/extern/Eigen3/Eigen/src/Geometry/Umeyama.h
+++ b/extern/Eigen3/Eigen/src/Geometry/Umeyama.h
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_UMEYAMA_H
 #define EIGEN_UMEYAMA_H
@@ -31,6 +16,8 @@
 // * Eigen/SVD
 // * Eigen/Array
 
+namespace Eigen { 
+
 #ifndef EIGEN_PARSED_BY_DOXYGEN
 
 // These helpers are required since it allows to use mixed types as parameters
@@ -180,4 +167,6 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
   return Rt;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_UMEYAMA_H
diff --git a/extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h b/extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h
index 2af3267..3d8284f 100644
--- a/extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h
+++ b/extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h
@@ -4,34 +4,21 @@
 // Copyright (C) 2009 Rohit Garg <rpg.314 at gmail.com>
 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_GEOMETRY_SSE_H
 #define EIGEN_GEOMETRY_SSE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<class Derived, class OtherDerived>
 struct quat_product<Architecture::SSE, Derived, OtherDerived, float, Aligned>
 {
-  inline static Quaternion<float> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
+  static inline Quaternion<float> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
   {
     const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0,0,0,0x80000000));
     Quaternion<float> res;
@@ -53,7 +40,7 @@ struct quat_product<Architecture::SSE, Derived, OtherDerived, float, Aligned>
 template<typename VectorLhs,typename VectorRhs>
 struct cross3_impl<Architecture::SSE,VectorLhs,VectorRhs,float,true>
 {
-  inline static typename plain_matrix_type<VectorLhs>::type
+  static inline typename plain_matrix_type<VectorLhs>::type
   run(const VectorLhs& lhs, const VectorRhs& rhs)
   {
     __m128 a = lhs.template packet<VectorLhs::Flags&AlignedBit ? Aligned : Unaligned>(0);
@@ -72,7 +59,7 @@ struct cross3_impl<Architecture::SSE,VectorLhs,VectorRhs,float,true>
 template<class Derived, class OtherDerived>
 struct quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned>
 {
-  inline static Quaternion<double> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
+  static inline Quaternion<double> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
   {
   const Packet2d mask = _mm_castsi128_pd(_mm_set_epi32(0x0,0x0,0x80000000,0x0));
 
@@ -123,4 +110,6 @@ struct quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned>
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_GEOMETRY_SSE_H
diff --git a/extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h b/extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
index 23ce1bf..1991c65 100644
--- a/extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
+++ b/extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
@@ -4,30 +4,17 @@
 // Copyright (C) 2010 Vincent Lejeune
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BLOCK_HOUSEHOLDER_H
 #define EIGEN_BLOCK_HOUSEHOLDER_H
 
 // This file contains some helper function to deal with block householder reflectors
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \internal */
@@ -64,7 +51,7 @@ void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vec
   Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize> T(nbVecs,nbVecs);
   make_block_householder_triangular_factor(T, vectors, hCoeffs);
 
-  const TriangularView<VectorsType, UnitLower>& V(vectors);
+  const TriangularView<const VectorsType, UnitLower>& V(vectors);
 
   // A -= V T V^* A
   Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,0,
@@ -76,4 +63,6 @@ void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vec
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_BLOCK_HOUSEHOLDER_H
diff --git a/extern/Eigen3/Eigen/src/Householder/Householder.h b/extern/Eigen3/Eigen/src/Householder/Householder.h
index 74139c0..3f64b7d 100644
--- a/extern/Eigen3/Eigen/src/Householder/Householder.h
+++ b/extern/Eigen3/Eigen/src/Householder/Householder.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_HOUSEHOLDER_H
 #define EIGEN_HOUSEHOLDER_H
 
+namespace Eigen { 
+
 namespace internal {
 template<int n> struct decrement_size
 {
@@ -35,6 +22,22 @@ template<int n> struct decrement_size
 };
 }
 
+/** Computes the elementary reflector H such that:
+  * \f$ H *this = [ beta 0 ... 0]^T \f$
+  * where the transformation H is:
+  * \f$ H = I - tau v v^*\f$
+  * and the vector v is:
+  * \f$ v^T = [1 essential^T] \f$
+  *
+  * The essential part of the vector \c v is stored in *this.
+  * 
+  * On output:
+  * \param tau the scaling factor of the Householder transformation
+  * \param beta the result of H * \c *this
+  *
+  * \sa MatrixBase::makeHouseholder(), MatrixBase::applyHouseholderOnTheLeft(),
+  *     MatrixBase::applyHouseholderOnTheRight()
+  */
 template<typename Derived>
 void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
 {
@@ -51,7 +54,7 @@ void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
   *
   * On output:
   * \param essential the essential part of the vector \c v
-  * \param tau the scaling factor of the householder transformation
+  * \param tau the scaling factor of the Householder transformation
   * \param beta the result of H * \c *this
   *
   * \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(),
@@ -86,6 +89,21 @@ void MatrixBase<Derived>::makeHouseholder(
   }
 }
 
+/** Apply the elementary reflector H given by
+  * \f$ H = I - tau v v^*\f$
+  * with
+  * \f$ v^T = [1 essential^T] \f$
+  * from the left to a vector or matrix.
+  *
+  * On input:
+  * \param essential the essential part of the vector \c v
+  * \param tau the scaling factor of the Householder transformation
+  * \param workspace a pointer to working space with at least
+  *                  this->cols() * essential.size() entries
+  *
+  * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(), 
+  *     MatrixBase::applyHouseholderOnTheRight()
+  */
 template<typename Derived>
 template<typename EssentialPart>
 void MatrixBase<Derived>::applyHouseholderOnTheLeft(
@@ -108,6 +126,21 @@ void MatrixBase<Derived>::applyHouseholderOnTheLeft(
   }
 }
 
+/** Apply the elementary reflector H given by
+  * \f$ H = I - tau v v^*\f$
+  * with
+  * \f$ v^T = [1 essential^T] \f$
+  * from the right to a vector or matrix.
+  *
+  * On input:
+  * \param essential the essential part of the vector \c v
+  * \param tau the scaling factor of the Householder transformation
+  * \param workspace a pointer to working space with at least
+  *                  this->cols() * essential.size() entries
+  *
+  * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(), 
+  *     MatrixBase::applyHouseholderOnTheLeft()
+  */
 template<typename Derived>
 template<typename EssentialPart>
 void MatrixBase<Derived>::applyHouseholderOnTheRight(
@@ -130,4 +163,6 @@ void MatrixBase<Derived>::applyHouseholderOnTheRight(
   }
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_HOUSEHOLDER_H
diff --git a/extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h b/extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h
index 717f29c..1e71e16 100644
--- a/extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h
+++ b/extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_HOUSEHOLDER_SEQUENCE_H
 #define EIGEN_HOUSEHOLDER_SEQUENCE_H
 
+namespace Eigen { 
+
 /** \ingroup Householder_Module
   * \householder_module
   * \class HouseholderSequence
@@ -237,13 +224,20 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
     ConjugateReturnType inverse() const { return adjoint(); }
 
     /** \internal */
-    template<typename DestType> void evalTo(DestType& dst) const
+    template<typename DestType> inline void evalTo(DestType& dst) const
     {
-      Index vecs = m_length;
-      // FIXME find a way to pass this temporary if the user wants to
       Matrix<Scalar, DestType::RowsAtCompileTime, 1,
-             AutoAlign|ColMajor, DestType::MaxRowsAtCompileTime, 1> temp(rows());
-      if(    internal::is_same<typename internal::remove_all<VectorsType>::type,DestType>::value
+             AutoAlign|ColMajor, DestType::MaxRowsAtCompileTime, 1> workspace(rows());
+      evalTo(dst, workspace);
+    }
+
+    /** \internal */
+    template<typename Dest, typename Workspace>
+    void evalTo(Dest& dst, Workspace& workspace) const
+    {
+      workspace.resize(rows());
+      Index vecs = m_length;
+      if(    internal::is_same<typename internal::remove_all<VectorsType>::type,Dest>::value
           && internal::extract_data(dst) == internal::extract_data(m_vectors))
       {
         // in-place
@@ -254,10 +248,10 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
           Index cornerSize = rows() - k - m_shift;
           if(m_trans)
             dst.bottomRightCorner(cornerSize, cornerSize)
-            .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0));
+               .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
           else
             dst.bottomRightCorner(cornerSize, cornerSize)
-              .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0));
+               .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data());
 
           // clear the off diagonal vector
           dst.col(k).tail(rows()-k-1).setZero();
@@ -274,10 +268,10 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
           Index cornerSize = rows() - k - m_shift;
           if(m_trans)
             dst.bottomRightCorner(cornerSize, cornerSize)
-            .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0));
+               .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
           else
             dst.bottomRightCorner(cornerSize, cornerSize)
-              .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0));
+               .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
         }
       }
     }
@@ -285,24 +279,40 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
     /** \internal */
     template<typename Dest> inline void applyThisOnTheRight(Dest& dst) const
     {
-      Matrix<Scalar,1,Dest::RowsAtCompileTime> temp(dst.rows());
+      Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor,1,Dest::MaxRowsAtCompileTime> workspace(dst.rows());
+      applyThisOnTheRight(dst, workspace);
+    }
+
+    /** \internal */
+    template<typename Dest, typename Workspace>
+    inline void applyThisOnTheRight(Dest& dst, Workspace& workspace) const
+    {
+      workspace.resize(dst.rows());
       for(Index k = 0; k < m_length; ++k)
       {
         Index actual_k = m_trans ? m_length-k-1 : k;
         dst.rightCols(rows()-m_shift-actual_k)
-           .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0));
+           .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
       }
     }
 
     /** \internal */
     template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const
     {
-      Matrix<Scalar,1,Dest::ColsAtCompileTime> temp(dst.cols());
+      Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> workspace(dst.cols());
+      applyThisOnTheLeft(dst, workspace);
+    }
+
+    /** \internal */
+    template<typename Dest, typename Workspace>
+    inline void applyThisOnTheLeft(Dest& dst, Workspace& workspace) const
+    {
+      workspace.resize(dst.cols());
       for(Index k = 0; k < m_length; ++k)
       {
         Index actual_k = m_trans ? k : m_length-k-1;
         dst.bottomRows(rows()-m_shift-actual_k)
-           .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0));
+           .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
       }
     }
 
@@ -426,4 +436,6 @@ HouseholderSequence<VectorsType,CoeffsType,OnTheRight> rightHouseholderSequence(
   return HouseholderSequence<VectorsType,CoeffsType,OnTheRight>(v, h);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_HOUSEHOLDER_SEQUENCE_H
diff --git a/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
new file mode 100644
index 0000000..73ca9bf
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
@@ -0,0 +1,149 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_BASIC_PRECONDITIONERS_H
+#define EIGEN_BASIC_PRECONDITIONERS_H
+
+namespace Eigen { 
+
+/** \ingroup IterativeLinearSolvers_Module
+  * \brief A preconditioner based on the digonal entries
+  *
+  * This class allows to approximately solve for A.x = b problems assuming A is a diagonal matrix.
+  * In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for:
+  * \code
+  * A.diagonal().asDiagonal() . x = b
+  * \endcode
+  *
+  * \tparam _Scalar the type of the scalar.
+  *
+  * This preconditioner is suitable for both selfadjoint and general problems.
+  * The diagonal entries are pre-inverted and stored into a dense vector.
+  *
+  * \note A variant that has yet to be implemented would attempt to preserve the norm of each column.
+  *
+  */
+template <typename _Scalar>
+class DiagonalPreconditioner
+{
+    typedef _Scalar Scalar;
+    typedef Matrix<Scalar,Dynamic,1> Vector;
+    typedef typename Vector::Index Index;
+
+  public:
+    // this typedef is only to export the scalar type and compile-time dimensions to solve_retval
+    typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
+
+    DiagonalPreconditioner() : m_isInitialized(false) {}
+
+    template<typename MatType>
+    DiagonalPreconditioner(const MatType& mat) : m_invdiag(mat.cols())
+    {
+      compute(mat);
+    }
+
+    Index rows() const { return m_invdiag.size(); }
+    Index cols() const { return m_invdiag.size(); }
+    
+    template<typename MatType>
+    DiagonalPreconditioner& analyzePattern(const MatType& )
+    {
+      return *this;
+    }
+    
+    template<typename MatType>
+    DiagonalPreconditioner& factorize(const MatType& mat)
+    {
+      m_invdiag.resize(mat.cols());
+      for(int j=0; j<mat.outerSize(); ++j)
+      {
+        typename MatType::InnerIterator it(mat,j);
+        while(it && it.index()!=j) ++it;
+        if(it && it.index()==j)
+          m_invdiag(j) = Scalar(1)/it.value();
+        else
+          m_invdiag(j) = 0;
+      }
+      m_isInitialized = true;
+      return *this;
+    }
+    
+    template<typename MatType>
+    DiagonalPreconditioner& compute(const MatType& mat)
+    {
+      return factorize(mat);
+    }
+
+    template<typename Rhs, typename Dest>
+    void _solve(const Rhs& b, Dest& x) const
+    {
+      x = m_invdiag.array() * b.array() ;
+    }
+
+    template<typename Rhs> inline const internal::solve_retval<DiagonalPreconditioner, Rhs>
+    solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "DiagonalPreconditioner is not initialized.");
+      eigen_assert(m_invdiag.size()==b.rows()
+                && "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<DiagonalPreconditioner, Rhs>(*this, b.derived());
+    }
+
+  protected:
+    Vector m_invdiag;
+    bool m_isInitialized;
+};
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+struct solve_retval<DiagonalPreconditioner<_MatrixType>, Rhs>
+  : solve_retval_base<DiagonalPreconditioner<_MatrixType>, Rhs>
+{
+  typedef DiagonalPreconditioner<_MatrixType> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+}
+
+/** \ingroup IterativeLinearSolvers_Module
+  * \brief A naive preconditioner which approximates any matrix as the identity matrix
+  *
+  * \sa class DiagonalPreconditioner
+  */
+class IdentityPreconditioner
+{
+  public:
+
+    IdentityPreconditioner() {}
+
+    template<typename MatrixType>
+    IdentityPreconditioner(const MatrixType& ) {}
+    
+    template<typename MatrixType>
+    IdentityPreconditioner& analyzePattern(const MatrixType& ) { return *this; }
+    
+    template<typename MatrixType>
+    IdentityPreconditioner& factorize(const MatrixType& ) { return *this; }
+
+    template<typename MatrixType>
+    IdentityPreconditioner& compute(const MatrixType& ) { return *this; }
+    
+    template<typename Rhs>
+    inline const Rhs& solve(const Rhs& b) const { return b; }
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_BASIC_PRECONDITIONERS_H
diff --git a/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h
new file mode 100644
index 0000000..126341b
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h
@@ -0,0 +1,254 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_BICGSTAB_H
+#define EIGEN_BICGSTAB_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal Low-level bi conjugate gradient stabilized algorithm
+  * \param mat The matrix A
+  * \param rhs The right hand side vector b
+  * \param x On input and initial solution, on output the computed solution.
+  * \param precond A preconditioner being able to efficiently solve for an
+  *                approximation of Ax=b (regardless of b)
+  * \param iters On input the max number of iteration, on output the number of performed iterations.
+  * \param tol_error On input the tolerance error, on output an estimation of the relative error.
+  * \return false in the case of numerical issue, for example a break down of BiCGSTAB. 
+  */
+template<typename MatrixType, typename Rhs, typename Dest, typename Preconditioner>
+bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x,
+              const Preconditioner& precond, int& iters,
+              typename Dest::RealScalar& tol_error)
+{
+  using std::sqrt;
+  using std::abs;
+  typedef typename Dest::RealScalar RealScalar;
+  typedef typename Dest::Scalar Scalar;
+  typedef Matrix<Scalar,Dynamic,1> VectorType;
+  RealScalar tol = tol_error;
+  int maxIters = iters;
+
+  int n = mat.cols();
+  VectorType r  = rhs - mat * x;
+  VectorType r0 = r;
+  
+  RealScalar r0_sqnorm = r0.squaredNorm();
+  Scalar rho    = 1;
+  Scalar alpha  = 1;
+  Scalar w      = 1;
+  
+  VectorType v = VectorType::Zero(n), p = VectorType::Zero(n);
+  VectorType y(n),  z(n);
+  VectorType kt(n), ks(n);
+
+  VectorType s(n), t(n);
+
+  RealScalar tol2 = tol*tol;
+  int i = 0;
+
+  while ( r.squaredNorm()/r0_sqnorm > tol2 && i<maxIters )
+  {
+    Scalar rho_old = rho;
+
+    rho = r0.dot(r);
+    if (rho == Scalar(0)) return false; /* New search directions cannot be found */
+    Scalar beta = (rho/rho_old) * (alpha / w);
+    p = r + beta * (p - w * v);
+    
+    y = precond.solve(p);
+    
+    v.noalias() = mat * y;
+
+    alpha = rho / r0.dot(v);
+    s = r - alpha * v;
+
+    z = precond.solve(s);
+    t.noalias() = mat * z;
+
+    w = t.dot(s) / t.squaredNorm();
+    x += alpha * y + w * z;
+    r = s - w * t;
+    ++i;
+  }
+  tol_error = sqrt(r.squaredNorm()/r0_sqnorm);
+  iters = i;
+  return true; 
+}
+
+}
+
+template< typename _MatrixType,
+          typename _Preconditioner = DiagonalPreconditioner<typename _MatrixType::Scalar> >
+class BiCGSTAB;
+
+namespace internal {
+
+template< typename _MatrixType, typename _Preconditioner>
+struct traits<BiCGSTAB<_MatrixType,_Preconditioner> >
+{
+  typedef _MatrixType MatrixType;
+  typedef _Preconditioner Preconditioner;
+};
+
+}
+
+/** \ingroup IterativeLinearSolvers_Module
+  * \brief A bi conjugate gradient stabilized solver for sparse square problems
+  *
+  * This class allows to solve for A.x = b sparse linear problems using a bi conjugate gradient
+  * stabilized algorithm. The vectors x and b can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, can be a dense or a sparse matrix.
+  * \tparam _Preconditioner the type of the preconditioner. Default is DiagonalPreconditioner
+  *
+  * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations()
+  * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations
+  * and NumTraits<Scalar>::epsilon() for the tolerance.
+  * 
+  * This class can be used as the direct solver classes. Here is a typical usage example:
+  * \code
+  * int n = 10000;
+  * VectorXd x(n), b(n);
+  * SparseMatrix<double> A(n,n);
+  * // fill A and b
+  * BiCGSTAB<SparseMatrix<double> > solver;
+  * solver(A);
+  * x = solver.solve(b);
+  * std::cout << "#iterations:     " << solver.iterations() << std::endl;
+  * std::cout << "estimated error: " << solver.error()      << std::endl;
+  * // update b, and solve again
+  * x = solver.solve(b);
+  * \endcode
+  * 
+  * By default the iterations start with x=0 as an initial guess of the solution.
+  * One can control the start using the solveWithGuess() method. Here is a step by
+  * step execution example starting with a random guess and printing the evolution
+  * of the estimated error:
+  * * \code
+  * x = VectorXd::Random(n);
+  * solver.setMaxIterations(1);
+  * int i = 0;
+  * do {
+  *   x = solver.solveWithGuess(b,x);
+  *   std::cout << i << " : " << solver.error() << std::endl;
+  *   ++i;
+  * } while (solver.info()!=Success && i<100);
+  * \endcode
+  * Note that such a step by step excution is slightly slower.
+  * 
+  * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
+  */
+template< typename _MatrixType, typename _Preconditioner>
+class BiCGSTAB : public IterativeSolverBase<BiCGSTAB<_MatrixType,_Preconditioner> >
+{
+  typedef IterativeSolverBase<BiCGSTAB> Base;
+  using Base::mp_matrix;
+  using Base::m_error;
+  using Base::m_iterations;
+  using Base::m_info;
+  using Base::m_isInitialized;
+public:
+  typedef _MatrixType MatrixType;
+  typedef typename MatrixType::Scalar Scalar;
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::RealScalar RealScalar;
+  typedef _Preconditioner Preconditioner;
+
+public:
+
+  /** Default constructor. */
+  BiCGSTAB() : Base() {}
+
+  /** Initialize the solver with matrix \a A for further \c Ax=b solving.
+    * 
+    * This constructor is a shortcut for the default constructor followed
+    * by a call to compute().
+    * 
+    * \warning this class stores a reference to the matrix A as well as some
+    * precomputed values that depend on it. Therefore, if \a A is changed
+    * this class becomes invalid. Call compute() to update it with the new
+    * matrix A, or modify a copy of A.
+    */
+  BiCGSTAB(const MatrixType& A) : Base(A) {}
+
+  ~BiCGSTAB() {}
+  
+  /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A
+    * \a x0 as an initial solution.
+    *
+    * \sa compute()
+    */
+  template<typename Rhs,typename Guess>
+  inline const internal::solve_retval_with_guess<BiCGSTAB, Rhs, Guess>
+  solveWithGuess(const MatrixBase<Rhs>& b, const Guess& x0) const
+  {
+    eigen_assert(m_isInitialized && "BiCGSTAB is not initialized.");
+    eigen_assert(Base::rows()==b.rows()
+              && "BiCGSTAB::solve(): invalid number of rows of the right hand side matrix b");
+    return internal::solve_retval_with_guess
+            <BiCGSTAB, Rhs, Guess>(*this, b.derived(), x0);
+  }
+  
+  /** \internal */
+  template<typename Rhs,typename Dest>
+  void _solveWithGuess(const Rhs& b, Dest& x) const
+  {    
+    bool failed = false;
+    for(int j=0; j<b.cols(); ++j)
+    {
+      m_iterations = Base::maxIterations();
+      m_error = Base::m_tolerance;
+      
+      typename Dest::ColXpr xj(x,j);
+      if(!internal::bicgstab(*mp_matrix, b.col(j), xj, Base::m_preconditioner, m_iterations, m_error))
+        failed = true;
+    }
+    m_info = failed ? NumericalIssue
+           : m_error <= Base::m_tolerance ? Success
+           : NoConvergence;
+    m_isInitialized = true;
+  }
+
+  /** \internal */
+  template<typename Rhs,typename Dest>
+  void _solve(const Rhs& b, Dest& x) const
+  {
+    x.setZero();
+    _solveWithGuess(b,x);
+  }
+
+protected:
+
+};
+
+
+namespace internal {
+
+  template<typename _MatrixType, typename _Preconditioner, typename Rhs>
+struct solve_retval<BiCGSTAB<_MatrixType, _Preconditioner>, Rhs>
+  : solve_retval_base<BiCGSTAB<_MatrixType, _Preconditioner>, Rhs>
+{
+  typedef BiCGSTAB<_MatrixType, _Preconditioner> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_BICGSTAB_H
diff --git a/extern/Eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
new file mode 100644
index 0000000..f64f253
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
@@ -0,0 +1,251 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_CONJUGATE_GRADIENT_H
+#define EIGEN_CONJUGATE_GRADIENT_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal Low-level conjugate gradient algorithm
+  * \param mat The matrix A
+  * \param rhs The right hand side vector b
+  * \param x On input and initial solution, on output the computed solution.
+  * \param precond A preconditioner being able to efficiently solve for an
+  *                approximation of Ax=b (regardless of b)
+  * \param iters On input the max number of iteration, on output the number of performed iterations.
+  * \param tol_error On input the tolerance error, on output an estimation of the relative error.
+  */
+template<typename MatrixType, typename Rhs, typename Dest, typename Preconditioner>
+EIGEN_DONT_INLINE
+void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x,
+                        const Preconditioner& precond, int& iters,
+                        typename Dest::RealScalar& tol_error)
+{
+  using std::sqrt;
+  using std::abs;
+  typedef typename Dest::RealScalar RealScalar;
+  typedef typename Dest::Scalar Scalar;
+  typedef Matrix<Scalar,Dynamic,1> VectorType;
+  
+  RealScalar tol = tol_error;
+  int maxIters = iters;
+  
+  int n = mat.cols();
+
+  VectorType residual = rhs - mat * x; //initial residual
+  VectorType p(n);
+
+  p = precond.solve(residual);      //initial search direction
+
+  VectorType z(n), tmp(n);
+  RealScalar absNew = internal::real(residual.dot(p));  // the square of the absolute value of r scaled by invM
+  RealScalar rhsNorm2 = rhs.squaredNorm();
+  RealScalar residualNorm2 = 0;
+  RealScalar threshold = tol*tol*rhsNorm2;
+  int i = 0;
+  while(i < maxIters)
+  {
+    tmp.noalias() = mat * p;              // the bottleneck of the algorithm
+
+    Scalar alpha = absNew / p.dot(tmp);   // the amount we travel on dir
+    x += alpha * p;                       // update solution
+    residual -= alpha * tmp;              // update residue
+    
+    residualNorm2 = residual.squaredNorm();
+    if(residualNorm2 < threshold)
+      break;
+    
+    z = precond.solve(residual);          // approximately solve for "A z = residual"
+
+    RealScalar absOld = absNew;
+    absNew = internal::real(residual.dot(z));     // update the absolute value of r
+    RealScalar beta = absNew / absOld;            // calculate the Gram-Schmidt value used to create the new search direction
+    p = z + beta * p;                             // update search direction
+    i++;
+  }
+  tol_error = sqrt(residualNorm2 / rhsNorm2);
+  iters = i;
+}
+
+}
+
+template< typename _MatrixType, int _UpLo=Lower,
+          typename _Preconditioner = DiagonalPreconditioner<typename _MatrixType::Scalar> >
+class ConjugateGradient;
+
+namespace internal {
+
+template< typename _MatrixType, int _UpLo, typename _Preconditioner>
+struct traits<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >
+{
+  typedef _MatrixType MatrixType;
+  typedef _Preconditioner Preconditioner;
+};
+
+}
+
+/** \ingroup IterativeLinearSolvers_Module
+  * \brief A conjugate gradient solver for sparse self-adjoint problems
+  *
+  * This class allows to solve for A.x = b sparse linear problems using a conjugate gradient algorithm.
+  * The sparse matrix A must be selfadjoint. The vectors x and b can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, can be a dense or a sparse matrix.
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  * \tparam _Preconditioner the type of the preconditioner. Default is DiagonalPreconditioner
+  *
+  * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations()
+  * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations
+  * and NumTraits<Scalar>::epsilon() for the tolerance.
+  * 
+  * This class can be used as the direct solver classes. Here is a typical usage example:
+  * \code
+  * int n = 10000;
+  * VectorXd x(n), b(n);
+  * SparseMatrix<double> A(n,n);
+  * // fill A and b
+  * ConjugateGradient<SparseMatrix<double> > cg;
+  * cg.compute(A);
+  * x = cg.solve(b);
+  * std::cout << "#iterations:     " << cg.iterations() << std::endl;
+  * std::cout << "estimated error: " << cg.error()      << std::endl;
+  * // update b, and solve again
+  * x = cg.solve(b);
+  * \endcode
+  * 
+  * By default the iterations start with x=0 as an initial guess of the solution.
+  * One can control the start using the solveWithGuess() method. Here is a step by
+  * step execution example starting with a random guess and printing the evolution
+  * of the estimated error:
+  * * \code
+  * x = VectorXd::Random(n);
+  * cg.setMaxIterations(1);
+  * int i = 0;
+  * do {
+  *   x = cg.solveWithGuess(b,x);
+  *   std::cout << i << " : " << cg.error() << std::endl;
+  *   ++i;
+  * } while (cg.info()!=Success && i<100);
+  * \endcode
+  * Note that such a step by step excution is slightly slower.
+  * 
+  * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
+  */
+template< typename _MatrixType, int _UpLo, typename _Preconditioner>
+class ConjugateGradient : public IterativeSolverBase<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >
+{
+  typedef IterativeSolverBase<ConjugateGradient> Base;
+  using Base::mp_matrix;
+  using Base::m_error;
+  using Base::m_iterations;
+  using Base::m_info;
+  using Base::m_isInitialized;
+public:
+  typedef _MatrixType MatrixType;
+  typedef typename MatrixType::Scalar Scalar;
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::RealScalar RealScalar;
+  typedef _Preconditioner Preconditioner;
+
+  enum {
+    UpLo = _UpLo
+  };
+
+public:
+
+  /** Default constructor. */
+  ConjugateGradient() : Base() {}
+
+  /** Initialize the solver with matrix \a A for further \c Ax=b solving.
+    * 
+    * This constructor is a shortcut for the default constructor followed
+    * by a call to compute().
+    * 
+    * \warning this class stores a reference to the matrix A as well as some
+    * precomputed values that depend on it. Therefore, if \a A is changed
+    * this class becomes invalid. Call compute() to update it with the new
+    * matrix A, or modify a copy of A.
+    */
+  ConjugateGradient(const MatrixType& A) : Base(A) {}
+
+  ~ConjugateGradient() {}
+  
+  /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A
+    * \a x0 as an initial solution.
+    *
+    * \sa compute()
+    */
+  template<typename Rhs,typename Guess>
+  inline const internal::solve_retval_with_guess<ConjugateGradient, Rhs, Guess>
+  solveWithGuess(const MatrixBase<Rhs>& b, const Guess& x0) const
+  {
+    eigen_assert(m_isInitialized && "ConjugateGradient is not initialized.");
+    eigen_assert(Base::rows()==b.rows()
+              && "ConjugateGradient::solve(): invalid number of rows of the right hand side matrix b");
+    return internal::solve_retval_with_guess
+            <ConjugateGradient, Rhs, Guess>(*this, b.derived(), x0);
+  }
+
+  /** \internal */
+  template<typename Rhs,typename Dest>
+  void _solveWithGuess(const Rhs& b, Dest& x) const
+  {
+    m_iterations = Base::maxIterations();
+    m_error = Base::m_tolerance;
+
+    for(int j=0; j<b.cols(); ++j)
+    {
+      m_iterations = Base::maxIterations();
+      m_error = Base::m_tolerance;
+
+      typename Dest::ColXpr xj(x,j);
+      internal::conjugate_gradient(mp_matrix->template selfadjointView<UpLo>(), b.col(j), xj,
+                                   Base::m_preconditioner, m_iterations, m_error);
+    }
+
+    m_isInitialized = true;
+    m_info = m_error <= Base::m_tolerance ? Success : NoConvergence;
+  }
+  
+  /** \internal */
+  template<typename Rhs,typename Dest>
+  void _solve(const Rhs& b, Dest& x) const
+  {
+    x.setOnes();
+    _solveWithGuess(b,x);
+  }
+
+protected:
+
+};
+
+
+namespace internal {
+
+template<typename _MatrixType, int _UpLo, typename _Preconditioner, typename Rhs>
+struct solve_retval<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner>, Rhs>
+  : solve_retval_base<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner>, Rhs>
+{
+  typedef ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_CONJUGATE_GRADIENT_H
diff --git a/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
new file mode 100644
index 0000000..224304f
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
@@ -0,0 +1,466 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_INCOMPLETE_LUT_H
+#define EIGEN_INCOMPLETE_LUT_H
+
+namespace Eigen { 
+
+/**
+ * \brief Incomplete LU factorization with dual-threshold strategy
+ * During the numerical factorization, two dropping rules are used :
+ *  1) any element whose magnitude is less than some tolerance is dropped.
+ *    This tolerance is obtained by multiplying the input tolerance @p droptol 
+ *    by the average magnitude of all the original elements in the current row.
+ *  2) After the elimination of the row, only the @p fill largest elements in 
+ *    the L part and the @p fill largest elements in the U part are kept 
+ *    (in addition to the diagonal element ). Note that @p fill is computed from 
+ *    the input parameter @p fillfactor which is used the ratio to control the fill_in 
+ *    relatively to the initial number of nonzero elements.
+ * 
+ * The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements)
+ * and when @p fill=n/2 with @p droptol being different to zero. 
+ * 
+ * References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization, 
+ *              Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994.
+ * 
+ * NOTE : The following implementation is derived from the ILUT implementation
+ * in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota 
+ *  released under the terms of the GNU LGPL: 
+ *    http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README
+ * However, Yousef Saad gave us permission to relicense his ILUT code to MPL2.
+ * See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012:
+ *   http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2012/07/msg00064.html
+ * alternatively, on GMANE:
+ *   http://comments.gmane.org/gmane.comp.lib.eigen/3302
+ */
+template <typename _Scalar>
+class IncompleteLUT : internal::noncopyable
+{
+    typedef _Scalar Scalar;
+    typedef typename NumTraits<Scalar>::Real RealScalar;
+    typedef Matrix<Scalar,Dynamic,1> Vector;
+    typedef SparseMatrix<Scalar,RowMajor> FactorType;
+    typedef SparseMatrix<Scalar,ColMajor> PermutType;
+    typedef typename FactorType::Index Index;
+
+  public:
+    typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
+    
+    IncompleteLUT()
+      : m_droptol(NumTraits<Scalar>::dummy_precision()), m_fillfactor(10),
+        m_analysisIsOk(false), m_factorizationIsOk(false), m_isInitialized(false)
+    {}
+    
+    template<typename MatrixType>
+    IncompleteLUT(const MatrixType& mat, RealScalar droptol=NumTraits<Scalar>::dummy_precision(), int fillfactor = 10)
+      : m_droptol(droptol),m_fillfactor(fillfactor),
+        m_analysisIsOk(false),m_factorizationIsOk(false),m_isInitialized(false)
+    {
+      eigen_assert(fillfactor != 0);
+      compute(mat); 
+    }
+    
+    Index rows() const { return m_lu.rows(); }
+    
+    Index cols() const { return m_lu.cols(); }
+
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "IncompleteLUT is not initialized.");
+      return m_info;
+    }
+    
+    template<typename MatrixType>
+    void analyzePattern(const MatrixType& amat);
+    
+    template<typename MatrixType>
+    void factorize(const MatrixType& amat);
+    
+    /**
+      * Compute an incomplete LU factorization with dual threshold on the matrix mat
+      * No pivoting is done in this version
+      * 
+      **/
+    template<typename MatrixType>
+    IncompleteLUT<Scalar>& compute(const MatrixType& amat)
+    {
+      analyzePattern(amat); 
+      factorize(amat);
+      eigen_assert(m_factorizationIsOk == true); 
+      m_isInitialized = true;
+      return *this;
+    }
+
+    void setDroptol(RealScalar droptol); 
+    void setFillfactor(int fillfactor); 
+    
+    template<typename Rhs, typename Dest>
+    void _solve(const Rhs& b, Dest& x) const
+    {
+      x = m_Pinv * b;  
+      x = m_lu.template triangularView<UnitLower>().solve(x);
+      x = m_lu.template triangularView<Upper>().solve(x);
+      x = m_P * x; 
+    }
+
+    template<typename Rhs> inline const internal::solve_retval<IncompleteLUT, Rhs>
+     solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "IncompleteLUT is not initialized.");
+      eigen_assert(cols()==b.rows()
+                && "IncompleteLUT::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<IncompleteLUT, Rhs>(*this, b.derived());
+    }
+
+protected:
+
+    template <typename VectorV, typename VectorI>
+    int QuickSplit(VectorV &row, VectorI &ind, int ncut);
+
+
+    /** keeps off-diagonal entries; drops diagonal entries */
+    struct keep_diag {
+      inline bool operator() (const Index& row, const Index& col, const Scalar&) const
+      {
+        return row!=col;
+      }
+    };
+
+protected:
+
+    FactorType m_lu;
+    RealScalar m_droptol;
+    int m_fillfactor;
+    bool m_analysisIsOk;
+    bool m_factorizationIsOk;
+    bool m_isInitialized;
+    ComputationInfo m_info;
+    PermutationMatrix<Dynamic,Dynamic,Index> m_P;     // Fill-reducing permutation
+    PermutationMatrix<Dynamic,Dynamic,Index> m_Pinv;  // Inverse permutation
+};
+
+/**
+ * Set control parameter droptol
+ *  \param droptol   Drop any element whose magnitude is less than this tolerance 
+ **/ 
+template<typename Scalar>
+void IncompleteLUT<Scalar>::setDroptol(RealScalar droptol)
+{
+  this->m_droptol = droptol;   
+}
+
+/**
+ * Set control parameter fillfactor
+ * \param fillfactor  This is used to compute the  number @p fill_in of largest elements to keep on each row. 
+ **/ 
+template<typename Scalar>
+void IncompleteLUT<Scalar>::setFillfactor(int fillfactor)
+{
+  this->m_fillfactor = fillfactor;   
+}
+
+
+/**
+ * Compute a quick-sort split of a vector 
+ * On output, the vector row is permuted such that its elements satisfy
+ * abs(row(i)) >= abs(row(ncut)) if i<ncut
+ * abs(row(i)) <= abs(row(ncut)) if i>ncut 
+ * \param row The vector of values
+ * \param ind The array of index for the elements in @p row
+ * \param ncut  The number of largest elements to keep
+ **/ 
+template <typename Scalar>
+template <typename VectorV, typename VectorI>
+int IncompleteLUT<Scalar>::QuickSplit(VectorV &row, VectorI &ind, int ncut)
+{
+  using std::swap;
+  int mid;
+  int n = row.size(); /* length of the vector */
+  int first, last ; 
+  
+  ncut--; /* to fit the zero-based indices */
+  first = 0; 
+  last = n-1; 
+  if (ncut < first || ncut > last ) return 0;
+  
+  do {
+    mid = first; 
+    RealScalar abskey = std::abs(row(mid)); 
+    for (int j = first + 1; j <= last; j++) {
+      if ( std::abs(row(j)) > abskey) {
+        ++mid;
+        swap(row(mid), row(j));
+        swap(ind(mid), ind(j));
+      }
+    }
+    /* Interchange for the pivot element */
+    swap(row(mid), row(first));
+    swap(ind(mid), ind(first));
+    
+    if (mid > ncut) last = mid - 1;
+    else if (mid < ncut ) first = mid + 1; 
+  } while (mid != ncut );
+  
+  return 0; /* mid is equal to ncut */ 
+}
+
+template <typename Scalar>
+template<typename _MatrixType>
+void IncompleteLUT<Scalar>::analyzePattern(const _MatrixType& amat)
+{
+  // Compute the Fill-reducing permutation
+  SparseMatrix<Scalar,ColMajor, Index> mat1 = amat;
+  SparseMatrix<Scalar,ColMajor, Index> mat2 = amat.transpose();
+  // Symmetrize the pattern
+  // FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice.
+  //       on the other hand for a really non-symmetric pattern, mat2*mat1 should be prefered...
+  SparseMatrix<Scalar,ColMajor, Index> AtA = mat2 + mat1;
+  AtA.prune(keep_diag());
+  internal::minimum_degree_ordering<Scalar, Index>(AtA, m_P);  // Then compute the AMD ordering...
+
+  m_Pinv  = m_P.inverse(); // ... and the inverse permutation
+
+  m_analysisIsOk = true;
+}
+
+template <typename Scalar>
+template<typename _MatrixType>
+void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat)
+{
+  using std::sqrt;
+  using std::swap;
+  using std::abs;
+
+  eigen_assert((amat.rows() == amat.cols()) && "The factorization should be done on a square matrix");
+  int n = amat.cols();  // Size of the matrix
+  m_lu.resize(n,n);
+  // Declare Working vectors and variables
+  Vector u(n) ;     // real values of the row -- maximum size is n --
+  VectorXi ju(n);   // column position of the values in u -- maximum size  is n
+  VectorXi jr(n);   // Indicate the position of the nonzero elements in the vector u -- A zero location is indicated by -1
+
+  // Apply the fill-reducing permutation
+  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+  SparseMatrix<Scalar,RowMajor, Index> mat;
+  mat = amat.twistedBy(m_Pinv);
+
+  // Initialization
+  jr.fill(-1);
+  ju.fill(0);
+  u.fill(0);
+
+  // number of largest elements to keep in each row:
+  int fill_in =   static_cast<int> (amat.nonZeros()*m_fillfactor)/n+1;
+  if (fill_in > n) fill_in = n;
+
+  // number of largest nonzero elements to keep in the L and the U part of the current row:
+  int nnzL = fill_in/2;
+  int nnzU = nnzL;
+  m_lu.reserve(n * (nnzL + nnzU + 1));
+
+  // global loop over the rows of the sparse matrix
+  for (int ii = 0; ii < n; ii++)
+  {
+    // 1 - copy the lower and the upper part of the row i of mat in the working vector u
+
+    int sizeu = 1; // number of nonzero elements in the upper part of the current row
+    int sizel = 0; // number of nonzero elements in the lower part of the current row
+    ju(ii)    = ii;
+    u(ii)     = 0;
+    jr(ii)    = ii;
+    RealScalar rownorm = 0;
+
+    typename FactorType::InnerIterator j_it(mat, ii); // Iterate through the current row ii
+    for (; j_it; ++j_it)
+    {
+      int k = j_it.index();
+      if (k < ii)
+      {
+        // copy the lower part
+        ju(sizel) = k;
+        u(sizel) = j_it.value();
+        jr(k) = sizel;
+        ++sizel;
+      }
+      else if (k == ii)
+      {
+        u(ii) = j_it.value();
+      }
+      else
+      {
+        // copy the upper part
+        int jpos = ii + sizeu;
+        ju(jpos) = k;
+        u(jpos) = j_it.value();
+        jr(k) = jpos;
+        ++sizeu;
+      }
+      rownorm += internal::abs2(j_it.value());
+    }
+
+    // 2 - detect possible zero row
+    if(rownorm==0)
+    {
+      m_info = NumericalIssue;
+      return;
+    }
+    // Take the 2-norm of the current row as a relative tolerance
+    rownorm = sqrt(rownorm);
+
+    // 3 - eliminate the previous nonzero rows
+    int jj = 0;
+    int len = 0;
+    while (jj < sizel)
+    {
+      // In order to eliminate in the correct order,
+      // we must select first the smallest column index among  ju(jj:sizel)
+      int k;
+      int minrow = ju.segment(jj,sizel-jj).minCoeff(&k); // k is relative to the segment
+      k += jj;
+      if (minrow != ju(jj))
+      {
+        // swap the two locations
+        int j = ju(jj);
+        swap(ju(jj), ju(k));
+        jr(minrow) = jj;   jr(j) = k;
+        swap(u(jj), u(k));
+      }
+      // Reset this location
+      jr(minrow) = -1;
+
+      // Start elimination
+      typename FactorType::InnerIterator ki_it(m_lu, minrow);
+      while (ki_it && ki_it.index() < minrow) ++ki_it;
+      eigen_internal_assert(ki_it && ki_it.col()==minrow);
+      Scalar fact = u(jj) / ki_it.value();
+
+      // drop too small elements
+      if(abs(fact) <= m_droptol)
+      {
+        jj++;
+        continue;
+      }
+
+      // linear combination of the current row ii and the row minrow
+      ++ki_it;
+      for (; ki_it; ++ki_it)
+      {
+        Scalar prod = fact * ki_it.value();
+        int j       = ki_it.index();
+        int jpos    = jr(j);
+        if (jpos == -1) // fill-in element
+        {
+          int newpos;
+          if (j >= ii) // dealing with the upper part
+          {
+            newpos = ii + sizeu;
+            sizeu++;
+            eigen_internal_assert(sizeu<=n);
+          }
+          else // dealing with the lower part
+          {
+            newpos = sizel;
+            sizel++;
+            eigen_internal_assert(sizel<=ii);
+          }
+          ju(newpos) = j;
+          u(newpos) = -prod;
+          jr(j) = newpos;
+        }
+        else
+          u(jpos) -= prod;
+      }
+      // store the pivot element
+      u(len) = fact;
+      ju(len) = minrow;
+      ++len;
+
+      jj++;
+    } // end of the elimination on the row ii
+
+    // reset the upper part of the pointer jr to zero
+    for(int k = 0; k <sizeu; k++) jr(ju(ii+k)) = -1;
+
+    // 4 - partially sort and insert the elements in the m_lu matrix
+
+    // sort the L-part of the row
+    sizel = len;
+    len = (std::min)(sizel, nnzL);
+    typename Vector::SegmentReturnType ul(u.segment(0, sizel));
+    typename VectorXi::SegmentReturnType jul(ju.segment(0, sizel));
+    QuickSplit(ul, jul, len);
+
+    // store the largest m_fill elements of the L part
+    m_lu.startVec(ii);
+    for(int k = 0; k < len; k++)
+      m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
+
+    // store the diagonal element
+    // apply a shifting rule to avoid zero pivots (we are doing an incomplete factorization)
+    if (u(ii) == Scalar(0))
+      u(ii) = sqrt(m_droptol) * rownorm;
+    m_lu.insertBackByOuterInnerUnordered(ii, ii) = u(ii);
+
+    // sort the U-part of the row
+    // apply the dropping rule first
+    len = 0;
+    for(int k = 1; k < sizeu; k++)
+    {
+      if(abs(u(ii+k)) > m_droptol * rownorm )
+      {
+        ++len;
+        u(ii + len)  = u(ii + k);
+        ju(ii + len) = ju(ii + k);
+      }
+    }
+    sizeu = len + 1; // +1 to take into account the diagonal element
+    len = (std::min)(sizeu, nnzU);
+    typename Vector::SegmentReturnType uu(u.segment(ii+1, sizeu-1));
+    typename VectorXi::SegmentReturnType juu(ju.segment(ii+1, sizeu-1));
+    QuickSplit(uu, juu, len);
+
+    // store the largest elements of the U part
+    for(int k = ii + 1; k < ii + len; k++)
+      m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
+  }
+
+  m_lu.finalize();
+  m_lu.makeCompressed();
+
+  m_factorizationIsOk = true;
+  m_info = Success;
+}
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+struct solve_retval<IncompleteLUT<_MatrixType>, Rhs>
+  : solve_retval_base<IncompleteLUT<_MatrixType>, Rhs>
+{
+  typedef IncompleteLUT<_MatrixType> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_INCOMPLETE_LUT_H
+
diff --git a/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
new file mode 100644
index 0000000..11706ce
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
@@ -0,0 +1,254 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_ITERATIVE_SOLVER_BASE_H
+#define EIGEN_ITERATIVE_SOLVER_BASE_H
+
+namespace Eigen { 
+
+/** \ingroup IterativeLinearSolvers_Module
+  * \brief Base class for linear iterative solvers
+  *
+  * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
+  */
+template< typename Derived>
+class IterativeSolverBase : internal::noncopyable
+{
+public:
+  typedef typename internal::traits<Derived>::MatrixType MatrixType;
+  typedef typename internal::traits<Derived>::Preconditioner Preconditioner;
+  typedef typename MatrixType::Scalar Scalar;
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::RealScalar RealScalar;
+
+public:
+
+  Derived& derived() { return *static_cast<Derived*>(this); }
+  const Derived& derived() const { return *static_cast<const Derived*>(this); }
+
+  /** Default constructor. */
+  IterativeSolverBase()
+    : mp_matrix(0)
+  {
+    init();
+  }
+
+  /** Initialize the solver with matrix \a A for further \c Ax=b solving.
+    * 
+    * This constructor is a shortcut for the default constructor followed
+    * by a call to compute().
+    * 
+    * \warning this class stores a reference to the matrix A as well as some
+    * precomputed values that depend on it. Therefore, if \a A is changed
+    * this class becomes invalid. Call compute() to update it with the new
+    * matrix A, or modify a copy of A.
+    */
+  IterativeSolverBase(const MatrixType& A)
+  {
+    init();
+    compute(A);
+  }
+
+  ~IterativeSolverBase() {}
+  
+  /** Initializes the iterative solver for the sparcity pattern of the matrix \a A for further solving \c Ax=b problems.
+    *
+    * Currently, this function mostly call analyzePattern on the preconditioner. In the future
+    * we might, for instance, implement column reodering for faster matrix vector products.
+    */
+  Derived& analyzePattern(const MatrixType& A)
+  {
+    m_preconditioner.analyzePattern(A);
+    m_isInitialized = true;
+    m_analysisIsOk = true;
+    m_info = Success;
+    return derived();
+  }
+  
+  /** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems.
+    *
+    * Currently, this function mostly call factorize on the preconditioner.
+    *
+    * \warning this class stores a reference to the matrix A as well as some
+    * precomputed values that depend on it. Therefore, if \a A is changed
+    * this class becomes invalid. Call compute() to update it with the new
+    * matrix A, or modify a copy of A.
+    */
+  Derived& factorize(const MatrixType& A)
+  {
+    eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); 
+    mp_matrix = &A;
+    m_preconditioner.factorize(A);
+    m_factorizationIsOk = true;
+    m_info = Success;
+    return derived();
+  }
+
+  /** Initializes the iterative solver with the matrix \a A for further solving \c Ax=b problems.
+    *
+    * Currently, this function mostly initialized/compute the preconditioner. In the future
+    * we might, for instance, implement column reodering for faster matrix vector products.
+    *
+    * \warning this class stores a reference to the matrix A as well as some
+    * precomputed values that depend on it. Therefore, if \a A is changed
+    * this class becomes invalid. Call compute() to update it with the new
+    * matrix A, or modify a copy of A.
+    */
+  Derived& compute(const MatrixType& A)
+  {
+    mp_matrix = &A;
+    m_preconditioner.compute(A);
+    m_isInitialized = true;
+    m_analysisIsOk = true;
+    m_factorizationIsOk = true;
+    m_info = Success;
+    return derived();
+  }
+
+  /** \internal */
+  Index rows() const { return mp_matrix ? mp_matrix->rows() : 0; }
+  /** \internal */
+  Index cols() const { return mp_matrix ? mp_matrix->cols() : 0; }
+
+  /** \returns the tolerance threshold used by the stopping criteria */
+  RealScalar tolerance() const { return m_tolerance; }
+  
+  /** Sets the tolerance threshold used by the stopping criteria */
+  Derived& setTolerance(RealScalar tolerance)
+  {
+    m_tolerance = tolerance;
+    return derived();
+  }
+
+  /** \returns a read-write reference to the preconditioner for custom configuration. */
+  Preconditioner& preconditioner() { return m_preconditioner; }
+  
+  /** \returns a read-only reference to the preconditioner. */
+  const Preconditioner& preconditioner() const { return m_preconditioner; }
+
+  /** \returns the max number of iterations */
+  int maxIterations() const
+  {
+    return (mp_matrix && m_maxIterations<0) ? mp_matrix->cols() : m_maxIterations;
+  }
+  
+  /** Sets the max number of iterations */
+  Derived& setMaxIterations(int maxIters)
+  {
+    m_maxIterations = maxIters;
+    return derived();
+  }
+
+  /** \returns the number of iterations performed during the last solve */
+  int iterations() const
+  {
+    eigen_assert(m_isInitialized && "ConjugateGradient is not initialized.");
+    return m_iterations;
+  }
+
+  /** \returns the tolerance error reached during the last solve */
+  RealScalar error() const
+  {
+    eigen_assert(m_isInitialized && "ConjugateGradient is not initialized.");
+    return m_error;
+  }
+
+  /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+    *
+    * \sa compute()
+    */
+  template<typename Rhs> inline const internal::solve_retval<Derived, Rhs>
+  solve(const MatrixBase<Rhs>& b) const
+  {
+    eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
+    eigen_assert(rows()==b.rows()
+              && "IterativeSolverBase::solve(): invalid number of rows of the right hand side matrix b");
+    return internal::solve_retval<Derived, Rhs>(derived(), b.derived());
+  }
+  
+  /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+    *
+    * \sa compute()
+    */
+  template<typename Rhs>
+  inline const internal::sparse_solve_retval<IterativeSolverBase, Rhs>
+  solve(const SparseMatrixBase<Rhs>& b) const
+  {
+    eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
+    eigen_assert(rows()==b.rows()
+              && "IterativeSolverBase::solve(): invalid number of rows of the right hand side matrix b");
+    return internal::sparse_solve_retval<IterativeSolverBase, Rhs>(*this, b.derived());
+  }
+
+  /** \returns Success if the iterations converged, and NoConvergence otherwise. */
+  ComputationInfo info() const
+  {
+    eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
+    return m_info;
+  }
+  
+  /** \internal */
+  template<typename Rhs, typename DestScalar, int DestOptions, typename DestIndex>
+  void _solve_sparse(const Rhs& b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
+  {
+    eigen_assert(rows()==b.rows());
+    
+    int rhsCols = b.cols();
+    int size = b.rows();
+    Eigen::Matrix<DestScalar,Dynamic,1> tb(size);
+    Eigen::Matrix<DestScalar,Dynamic,1> tx(size);
+    for(int k=0; k<rhsCols; ++k)
+    {
+      tb = b.col(k);
+      tx = derived().solve(tb);
+      dest.col(k) = tx.sparseView(0);
+    }
+  }
+
+protected:
+  void init()
+  {
+    m_isInitialized = false;
+    m_analysisIsOk = false;
+    m_factorizationIsOk = false;
+    m_maxIterations = -1;
+    m_tolerance = NumTraits<Scalar>::epsilon();
+  }
+  const MatrixType* mp_matrix;
+  Preconditioner m_preconditioner;
+
+  int m_maxIterations;
+  RealScalar m_tolerance;
+  
+  mutable RealScalar m_error;
+  mutable int m_iterations;
+  mutable ComputationInfo m_info;
+  mutable bool m_isInitialized, m_analysisIsOk, m_factorizationIsOk;
+};
+
+namespace internal {
+ 
+template<typename Derived, typename Rhs>
+struct sparse_solve_retval<IterativeSolverBase<Derived>, Rhs>
+  : sparse_solve_retval_base<IterativeSolverBase<Derived>, Rhs>
+{
+  typedef IterativeSolverBase<Derived> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve_sparse(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_ITERATIVE_SOLVER_BASE_H
diff --git a/extern/Eigen3/Eigen/src/Jacobi/Jacobi.h b/extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
index 98dea68..a9c17dc 100644
--- a/extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
+++ b/extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_JACOBI_H
 #define EIGEN_JACOBI_H
 
+namespace Eigen { 
+
 /** \ingroup Jacobi_Module
   * \jacobi_module
   * \class JacobiRotation
@@ -326,7 +313,7 @@ void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y,
     // both vectors are sequentially stored in memory => vectorization
     enum { Peeling = 2 };
 
-    Index alignedStart = first_aligned(y, size);
+    Index alignedStart = internal::first_aligned(y, size);
     Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize;
 
     const Packet pc = pset1<Packet>(j.c());
@@ -344,7 +331,7 @@ void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y,
     Scalar* EIGEN_RESTRICT px = x + alignedStart;
     Scalar* EIGEN_RESTRICT py = y + alignedStart;
 
-    if(first_aligned(x, size)==alignedStart)
+    if(internal::first_aligned(x, size)==alignedStart)
     {
       for(Index i=alignedStart; i<alignedEnd; i+=PacketSize)
       {
@@ -425,6 +412,9 @@ void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y,
     }
   }
 }
-}
+
+} // end namespace internal
+
+} // end namespace Eigen
 
 #endif // EIGEN_JACOBI_H
diff --git a/extern/Eigen3/Eigen/src/LU/Determinant.h b/extern/Eigen3/Eigen/src/LU/Determinant.h
index b4fe36e..d862c5d 100644
--- a/extern/Eigen3/Eigen/src/LU/Determinant.h
+++ b/extern/Eigen3/Eigen/src/LU/Determinant.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_DETERMINANT_H
 #define EIGEN_DETERMINANT_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Derived>
@@ -109,4 +96,6 @@ inline typename internal::traits<Derived>::Scalar MatrixBase<Derived>::determina
   return internal::determinant_impl<typename internal::remove_all<Nested>::type>::run(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_DETERMINANT_H
diff --git a/extern/Eigen3/Eigen/src/LU/FullPivLU.h b/extern/Eigen3/Eigen/src/LU/FullPivLU.h
index 46ae7d6..e23f96c 100644
--- a/extern/Eigen3/Eigen/src/LU/FullPivLU.h
+++ b/extern/Eigen3/Eigen/src/LU/FullPivLU.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_LU_H
 #define EIGEN_LU_H
 
+namespace Eigen { 
+
 /** \ingroup LU_Module
   *
   * \class FullPivLU
@@ -282,6 +269,7 @@ template<typename _MatrixType> class FullPivLU
     FullPivLU& setThreshold(Default_t)
     {
       m_usePrescribedThreshold = false;
+      return *this;
     }
 
     /** Returns the threshold that will be used by certain methods such as rank().
@@ -743,4 +731,6 @@ MatrixBase<Derived>::fullPivLu() const
   return FullPivLU<PlainObject>(eval());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_LU_H
diff --git a/extern/Eigen3/Eigen/src/LU/Inverse.h b/extern/Eigen3/Eigen/src/LU/Inverse.h
index 2d3e6d1..39b8cdb 100644
--- a/extern/Eigen3/Eigen/src/LU/Inverse.h
+++ b/extern/Eigen3/Eigen/src/LU/Inverse.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2008-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_INVERSE_H
 #define EIGEN_INVERSE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /**********************************
@@ -286,7 +273,7 @@ struct inverse_impl : public ReturnByValue<inverse_impl<MatrixType> >
   typedef typename MatrixType::Index Index;
   typedef typename internal::eval<MatrixType>::type MatrixTypeNested;
   typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
-  const MatrixTypeNested m_matrix;
+  MatrixTypeNested m_matrix;
 
   inverse_impl(const MatrixType& matrix)
     : m_matrix(matrix)
@@ -404,4 +391,6 @@ inline void MatrixBase<Derived>::computeInverseWithCheck(
   computeInverseAndDetWithCheck(inverse,determinant,invertible,absDeterminantThreshold);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_INVERSE_H
diff --git a/extern/Eigen3/Eigen/src/LU/PartialPivLU.h b/extern/Eigen3/Eigen/src/LU/PartialPivLU.h
index 09394b0..c9ff9dd 100644
--- a/extern/Eigen3/Eigen/src/LU/PartialPivLU.h
+++ b/extern/Eigen3/Eigen/src/LU/PartialPivLU.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_PARTIALLU_H
 #define EIGEN_PARTIALLU_H
 
+namespace Eigen { 
+
 /** \ingroup LU_Module
   *
   * \class PartialPivLU
@@ -506,4 +493,6 @@ MatrixBase<Derived>::lu() const
 }
 #endif
 
+} // end namespace Eigen
+
 #endif // EIGEN_PARTIALLU_H
diff --git a/extern/Eigen3/Eigen/src/LU/PartialPivLU_MKL.h b/extern/Eigen3/Eigen/src/LU/PartialPivLU_MKL.h
new file mode 100644
index 0000000..9035953
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/LU/PartialPivLU_MKL.h
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *     LU decomposition with partial pivoting based on LAPACKE_?getrf function.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_PARTIALLU_LAPACK_H
+#define EIGEN_PARTIALLU_LAPACK_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_LU_PARTPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \
+template<int StorageOrder> \
+struct partial_lu_impl<EIGTYPE, StorageOrder, lapack_int> \
+{ \
+  /* \internal performs the LU decomposition in-place of the matrix represented */ \
+  static lapack_int blocked_lu(lapack_int rows, lapack_int cols, EIGTYPE* lu_data, lapack_int luStride, lapack_int* row_transpositions, lapack_int& nb_transpositions, lapack_int maxBlockSize=256) \
+  { \
+    EIGEN_UNUSED_VARIABLE(maxBlockSize);\
+    lapack_int matrix_order, first_zero_pivot; \
+    lapack_int m, n, lda, *ipiv, info; \
+    EIGTYPE* a; \
+/* Set up parameters for ?getrf */ \
+    matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
+    lda = luStride; \
+    a = lu_data; \
+    ipiv = row_transpositions; \
+    m = rows; \
+    n = cols; \
+    nb_transpositions = 0; \
+\
+    info = LAPACKE_##MKLPREFIX##getrf( matrix_order, m, n, (MKLTYPE*)a, lda, ipiv ); \
+\
+    for(int i=0;i<m;i++) { ipiv[i]--; if (ipiv[i]!=i) nb_transpositions++; } \
+\
+    eigen_assert(info >= 0); \
+/* something should be done with nb_transpositions */ \
+\
+    first_zero_pivot = info; \
+    return first_zero_pivot; \
+  } \
+};
+
+EIGEN_MKL_LU_PARTPIV(double, double, d)
+EIGEN_MKL_LU_PARTPIV(float, float, s)
+EIGEN_MKL_LU_PARTPIV(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_LU_PARTPIV(scomplex, MKL_Complex8, c)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_PARTIALLU_LAPACK_H
diff --git a/extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h b/extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h
index 4c6153f..60b7a23 100644
--- a/extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h
+++ b/extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h
@@ -5,24 +5,9 @@
 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // The SSE code for the 4x4 float and double matrix inverse in this file
 // comes from the following Intel's library:
@@ -42,6 +27,8 @@
 #ifndef EIGEN_INVERSE_SSE_H
 #define EIGEN_INVERSE_SSE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename MatrixType, typename ResultType>
@@ -335,6 +322,8 @@ struct compute_inverse_size4<Architecture::SSE, double, MatrixType, ResultType>
   }
 };
 
-}
+} // end namespace internal
+
+} // end namespace Eigen
 
 #endif // EIGEN_INVERSE_SSE_H
diff --git a/extern/Eigen3/Eigen/src/OrderingMethods/Amd.h b/extern/Eigen3/Eigen/src/OrderingMethods/Amd.h
new file mode 100644
index 0000000..ce04852
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/OrderingMethods/Amd.h
@@ -0,0 +1,439 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/*
+
+NOTE: this routine has been adapted from the CSparse library:
+
+Copyright (c) 2006, Timothy A. Davis.
+http://www.cise.ufl.edu/research/sparse/CSparse
+
+CSparse is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+CSparse is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this Module; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+*/
+
+#include "../Core/util/NonMPL2.h"
+
+#ifndef EIGEN_SPARSE_AMD_H
+#define EIGEN_SPARSE_AMD_H
+
+namespace Eigen { 
+
+namespace internal {
+  
+template<typename T> inline T amd_flip(const T& i) { return -i-2; }
+template<typename T> inline T amd_unflip(const T& i) { return i<0 ? amd_flip(i) : i; }
+template<typename T0, typename T1> inline bool amd_marked(const T0* w, const T1& j) { return w[j]<0; }
+template<typename T0, typename T1> inline void amd_mark(const T0* w, const T1& j) { return w[j] = amd_flip(w[j]); }
+
+/* clear w */
+template<typename Index>
+static int cs_wclear (Index mark, Index lemax, Index *w, Index n)
+{
+  Index k;
+  if(mark < 2 || (mark + lemax < 0))
+  {
+    for(k = 0; k < n; k++)
+      if(w[k] != 0)
+        w[k] = 1;
+    mark = 2;
+  }
+  return (mark);     /* at this point, w[0..n-1] < mark holds */
+}
+
+/* depth-first search and postorder of a tree rooted at node j */
+template<typename Index>
+Index cs_tdfs(Index j, Index k, Index *head, const Index *next, Index *post, Index *stack)
+{
+  int i, p, top = 0;
+  if(!head || !next || !post || !stack) return (-1);    /* check inputs */
+  stack[0] = j;                 /* place j on the stack */
+  while (top >= 0)                /* while (stack is not empty) */
+  {
+    p = stack[top];           /* p = top of stack */
+    i = head[p];              /* i = youngest child of p */
+    if(i == -1)
+    {
+      top--;                 /* p has no unordered children left */
+      post[k++] = p;        /* node p is the kth postordered node */
+    }
+    else
+    {
+      head[p] = next[i];   /* remove i from children of p */
+      stack[++top] = i;     /* start dfs on child node i */
+    }
+  }
+  return k;
+}
+
+
+/** \internal
+  * Approximate minimum degree ordering algorithm.
+  * \returns the permutation P reducing the fill-in of the input matrix \a C
+  * The input matrix \a C must be a selfadjoint compressed column major SparseMatrix object. Both the upper and lower parts have to be stored, but the diagonal entries are optional.
+  * On exit the values of C are destroyed */
+template<typename Scalar, typename Index>
+void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, PermutationMatrix<Dynamic,Dynamic,Index>& perm)
+{
+  using std::sqrt;
+  typedef SparseMatrix<Scalar,ColMajor,Index> CCS;
+  
+  int d, dk, dext, lemax = 0, e, elenk, eln, i, j, k, k1,
+      k2, k3, jlast, ln, dense, nzmax, mindeg = 0, nvi, nvj, nvk, mark, wnvi,
+      ok, nel = 0, p, p1, p2, p3, p4, pj, pk, pk1, pk2, pn, q, t;
+  unsigned int h;
+  
+  Index n = C.cols();
+  dense = std::max<Index> (16, Index(10 * sqrt(double(n))));   /* find dense threshold */
+  dense = std::min<Index> (n-2, dense);
+  
+  Index cnz = C.nonZeros();
+  perm.resize(n+1);
+  t = cnz + cnz/5 + 2*n;                 /* add elbow room to C */
+  C.resizeNonZeros(t);
+  
+  Index* W       = new Index[8*(n+1)]; /* get workspace */
+  Index* len     = W;
+  Index* nv      = W +   (n+1);
+  Index* next    = W + 2*(n+1);
+  Index* head    = W + 3*(n+1);
+  Index* elen    = W + 4*(n+1);
+  Index* degree  = W + 5*(n+1);
+  Index* w       = W + 6*(n+1);
+  Index* hhead   = W + 7*(n+1);
+  Index* last    = perm.indices().data();                              /* use P as workspace for last */
+  
+  /* --- Initialize quotient graph ---------------------------------------- */
+  Index* Cp = C.outerIndexPtr();
+  Index* Ci = C.innerIndexPtr();
+  for(k = 0; k < n; k++)
+    len[k] = Cp[k+1] - Cp[k];
+  len[n] = 0;
+  nzmax = t;
+  
+  for(i = 0; i <= n; i++)
+  {
+    head[i]   = -1;                     // degree list i is empty
+    last[i]   = -1;
+    next[i]   = -1;
+    hhead[i]  = -1;                     // hash list i is empty 
+    nv[i]     = 1;                      // node i is just one node
+    w[i]      = 1;                      // node i is alive
+    elen[i]   = 0;                      // Ek of node i is empty
+    degree[i] = len[i];                 // degree of node i
+  }
+  mark = internal::cs_wclear<Index>(0, 0, w, n);         /* clear w */
+  elen[n] = -2;                         /* n is a dead element */
+  Cp[n] = -1;                           /* n is a root of assembly tree */
+  w[n] = 0;                             /* n is a dead element */
+  
+  /* --- Initialize degree lists ------------------------------------------ */
+  for(i = 0; i < n; i++)
+  {
+    d = degree[i];
+    if(d == 0)                         /* node i is empty */
+    {
+      elen[i] = -2;                 /* element i is dead */
+      nel++;
+      Cp[i] = -1;                   /* i is a root of assembly tree */
+      w[i] = 0;
+    }
+    else if(d > dense)                 /* node i is dense */
+    {
+      nv[i] = 0;                    /* absorb i into element n */
+      elen[i] = -1;                 /* node i is dead */
+      nel++;
+      Cp[i] = amd_flip (n);
+      nv[n]++;
+    }
+    else
+    {
+      if(head[d] != -1) last[head[d]] = i;
+      next[i] = head[d];           /* put node i in degree list d */
+      head[d] = i;
+    }
+  }
+  
+  while (nel < n)                         /* while (selecting pivots) do */
+  {
+    /* --- Select node of minimum approximate degree -------------------- */
+    for(k = -1; mindeg < n && (k = head[mindeg]) == -1; mindeg++) {}
+    if(next[k] != -1) last[next[k]] = -1;
+    head[mindeg] = next[k];          /* remove k from degree list */
+    elenk = elen[k];                  /* elenk = |Ek| */
+    nvk = nv[k];                      /* # of nodes k represents */
+    nel += nvk;                        /* nv[k] nodes of A eliminated */
+    
+    /* --- Garbage collection ------------------------------------------- */
+    if(elenk > 0 && cnz + mindeg >= nzmax)
+    {
+      for(j = 0; j < n; j++)
+      {
+        if((p = Cp[j]) >= 0)      /* j is a live node or element */
+        {
+          Cp[j] = Ci[p];          /* save first entry of object */
+          Ci[p] = amd_flip (j);    /* first entry is now amd_flip(j) */
+        }
+      }
+      for(q = 0, p = 0; p < cnz; ) /* scan all of memory */
+      {
+        if((j = amd_flip (Ci[p++])) >= 0)  /* found object j */
+        {
+          Ci[q] = Cp[j];       /* restore first entry of object */
+          Cp[j] = q++;          /* new pointer to object j */
+          for(k3 = 0; k3 < len[j]-1; k3++) Ci[q++] = Ci[p++];
+        }
+      }
+      cnz = q;                       /* Ci[cnz...nzmax-1] now free */
+    }
+    
+    /* --- Construct new element ---------------------------------------- */
+    dk = 0;
+    nv[k] = -nvk;                     /* flag k as in Lk */
+    p = Cp[k];
+    pk1 = (elenk == 0) ? p : cnz;      /* do in place if elen[k] == 0 */
+    pk2 = pk1;
+    for(k1 = 1; k1 <= elenk + 1; k1++)
+    {
+      if(k1 > elenk)
+      {
+        e = k;                     /* search the nodes in k */
+        pj = p;                    /* list of nodes starts at Ci[pj]*/
+        ln = len[k] - elenk;      /* length of list of nodes in k */
+      }
+      else
+      {
+        e = Ci[p++];              /* search the nodes in e */
+        pj = Cp[e];
+        ln = len[e];              /* length of list of nodes in e */
+      }
+      for(k2 = 1; k2 <= ln; k2++)
+      {
+        i = Ci[pj++];
+        if((nvi = nv[i]) <= 0) continue; /* node i dead, or seen */
+        dk += nvi;                 /* degree[Lk] += size of node i */
+        nv[i] = -nvi;             /* negate nv[i] to denote i in Lk*/
+        Ci[pk2++] = i;            /* place i in Lk */
+        if(next[i] != -1) last[next[i]] = last[i];
+        if(last[i] != -1)         /* remove i from degree list */
+        {
+          next[last[i]] = next[i];
+        }
+        else
+        {
+          head[degree[i]] = next[i];
+        }
+      }
+      if(e != k)
+      {
+        Cp[e] = amd_flip (k);      /* absorb e into k */
+        w[e] = 0;                 /* e is now a dead element */
+      }
+    }
+    if(elenk != 0) cnz = pk2;         /* Ci[cnz...nzmax] is free */
+    degree[k] = dk;                   /* external degree of k - |Lk\i| */
+    Cp[k] = pk1;                      /* element k is in Ci[pk1..pk2-1] */
+    len[k] = pk2 - pk1;
+    elen[k] = -2;                     /* k is now an element */
+    
+    /* --- Find set differences ----------------------------------------- */
+    mark = internal::cs_wclear<Index>(mark, lemax, w, n);  /* clear w if necessary */
+    for(pk = pk1; pk < pk2; pk++)    /* scan 1: find |Le\Lk| */
+    {
+      i = Ci[pk];
+      if((eln = elen[i]) <= 0) continue;/* skip if elen[i] empty */
+      nvi = -nv[i];                      /* nv[i] was negated */
+      wnvi = mark - nvi;
+      for(p = Cp[i]; p <= Cp[i] + eln - 1; p++)  /* scan Ei */
+      {
+        e = Ci[p];
+        if(w[e] >= mark)
+        {
+          w[e] -= nvi;          /* decrement |Le\Lk| */
+        }
+        else if(w[e] != 0)        /* ensure e is a live element */
+        {
+          w[e] = degree[e] + wnvi; /* 1st time e seen in scan 1 */
+        }
+      }
+    }
+    
+    /* --- Degree update ------------------------------------------------ */
+    for(pk = pk1; pk < pk2; pk++)    /* scan2: degree update */
+    {
+      i = Ci[pk];                   /* consider node i in Lk */
+      p1 = Cp[i];
+      p2 = p1 + elen[i] - 1;
+      pn = p1;
+      for(h = 0, d = 0, p = p1; p <= p2; p++)    /* scan Ei */
+      {
+        e = Ci[p];
+        if(w[e] != 0)             /* e is an unabsorbed element */
+        {
+          dext = w[e] - mark;   /* dext = |Le\Lk| */
+          if(dext > 0)
+          {
+            d += dext;         /* sum up the set differences */
+            Ci[pn++] = e;     /* keep e in Ei */
+            h += e;            /* compute the hash of node i */
+          }
+          else
+          {
+            Cp[e] = amd_flip (k);  /* aggressive absorb. e->k */
+            w[e] = 0;             /* e is a dead element */
+          }
+        }
+      }
+      elen[i] = pn - p1 + 1;        /* elen[i] = |Ei| */
+      p3 = pn;
+      p4 = p1 + len[i];
+      for(p = p2 + 1; p < p4; p++) /* prune edges in Ai */
+      {
+        j = Ci[p];
+        if((nvj = nv[j]) <= 0) continue; /* node j dead or in Lk */
+        d += nvj;                  /* degree(i) += |j| */
+        Ci[pn++] = j;             /* place j in node list of i */
+        h += j;                    /* compute hash for node i */
+      }
+      if(d == 0)                     /* check for mass elimination */
+      {
+        Cp[i] = amd_flip (k);      /* absorb i into k */
+        nvi = -nv[i];
+        dk -= nvi;                 /* |Lk| -= |i| */
+        nvk += nvi;                /* |k| += nv[i] */
+        nel += nvi;
+        nv[i] = 0;
+        elen[i] = -1;             /* node i is dead */
+      }
+      else
+      {
+        degree[i] = std::min<Index> (degree[i], d);   /* update degree(i) */
+        Ci[pn] = Ci[p3];         /* move first node to end */
+        Ci[p3] = Ci[p1];         /* move 1st el. to end of Ei */
+        Ci[p1] = k;               /* add k as 1st element in of Ei */
+        len[i] = pn - p1 + 1;     /* new len of adj. list of node i */
+        h %= n;                    /* finalize hash of i */
+        next[i] = hhead[h];      /* place i in hash bucket */
+        hhead[h] = i;
+        last[i] = h;              /* save hash of i in last[i] */
+      }
+    }                                   /* scan2 is done */
+    degree[k] = dk;                   /* finalize |Lk| */
+    lemax = std::max<Index>(lemax, dk);
+    mark = internal::cs_wclear<Index>(mark+lemax, lemax, w, n);    /* clear w */
+    
+    /* --- Supernode detection ------------------------------------------ */
+    for(pk = pk1; pk < pk2; pk++)
+    {
+      i = Ci[pk];
+      if(nv[i] >= 0) continue;         /* skip if i is dead */
+      h = last[i];                      /* scan hash bucket of node i */
+      i = hhead[h];
+      hhead[h] = -1;                    /* hash bucket will be empty */
+      for(; i != -1 && next[i] != -1; i = next[i], mark++)
+      {
+        ln = len[i];
+        eln = elen[i];
+        for(p = Cp[i]+1; p <= Cp[i] + ln-1; p++) w[Ci[p]] = mark;
+        jlast = i;
+        for(j = next[i]; j != -1; ) /* compare i with all j */
+        {
+          ok = (len[j] == ln) && (elen[j] == eln);
+          for(p = Cp[j] + 1; ok && p <= Cp[j] + ln - 1; p++)
+          {
+            if(w[Ci[p]] != mark) ok = 0;    /* compare i and j*/
+          }
+          if(ok)                     /* i and j are identical */
+          {
+            Cp[j] = amd_flip (i);  /* absorb j into i */
+            nv[i] += nv[j];
+            nv[j] = 0;
+            elen[j] = -1;         /* node j is dead */
+            j = next[j];          /* delete j from hash bucket */
+            next[jlast] = j;
+          }
+          else
+          {
+            jlast = j;             /* j and i are different */
+            j = next[j];
+          }
+        }
+      }
+    }
+    
+    /* --- Finalize new element------------------------------------------ */
+    for(p = pk1, pk = pk1; pk < pk2; pk++)   /* finalize Lk */
+    {
+      i = Ci[pk];
+      if((nvi = -nv[i]) <= 0) continue;/* skip if i is dead */
+      nv[i] = nvi;                      /* restore nv[i] */
+      d = degree[i] + dk - nvi;         /* compute external degree(i) */
+      d = std::min<Index> (d, n - nel - nvi);
+      if(head[d] != -1) last[head[d]] = i;
+      next[i] = head[d];               /* put i back in degree list */
+      last[i] = -1;
+      head[d] = i;
+      mindeg = std::min<Index> (mindeg, d);       /* find new minimum degree */
+      degree[i] = d;
+      Ci[p++] = i;                      /* place i in Lk */
+    }
+    nv[k] = nvk;                      /* # nodes absorbed into k */
+    if((len[k] = p-pk1) == 0)         /* length of adj list of element k*/
+    {
+      Cp[k] = -1;                   /* k is a root of the tree */
+      w[k] = 0;                     /* k is now a dead element */
+    }
+    if(elenk != 0) cnz = p;           /* free unused space in Lk */
+  }
+  
+  /* --- Postordering ----------------------------------------------------- */
+  for(i = 0; i < n; i++) Cp[i] = amd_flip (Cp[i]);/* fix assembly tree */
+  for(j = 0; j <= n; j++) head[j] = -1;
+  for(j = n; j >= 0; j--)              /* place unordered nodes in lists */
+  {
+    if(nv[j] > 0) continue;          /* skip if j is an element */
+    next[j] = head[Cp[j]];          /* place j in list of its parent */
+    head[Cp[j]] = j;
+  }
+  for(e = n; e >= 0; e--)              /* place elements in lists */
+  {
+    if(nv[e] <= 0) continue;         /* skip unless e is an element */
+    if(Cp[e] != -1)
+    {
+      next[e] = head[Cp[e]];      /* place e in list of its parent */
+      head[Cp[e]] = e;
+    }
+  }
+  for(k = 0, i = 0; i <= n; i++)       /* postorder the assembly tree */
+  {
+    if(Cp[i] == -1) k = internal::cs_tdfs<Index>(i, k, head, next, perm.indices().data(), w);
+  }
+  
+  perm.indices().conservativeResize(n);
+
+  delete[] W;
+}
+
+} // namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_AMD_H
diff --git a/extern/Eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h b/extern/Eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h
new file mode 100644
index 0000000..82e137c
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h
@@ -0,0 +1,742 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_PASTIXSUPPORT_H
+#define EIGEN_PASTIXSUPPORT_H
+
+namespace Eigen { 
+
+/** \ingroup PaStiXSupport_Module
+  * \brief Interface to the PaStix solver
+  * 
+  * This class is used to solve the linear systems A.X = B via the PaStix library. 
+  * The matrix can be either real or complex, symmetric or not.
+  *
+  * \sa TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType, bool IsStrSym = false> class PastixLU;
+template<typename _MatrixType, int Options> class PastixLLT;
+template<typename _MatrixType, int Options> class PastixLDLT;
+
+namespace internal
+{
+    
+  template<class Pastix> struct pastix_traits;
+
+  template<typename _MatrixType>
+  struct pastix_traits< PastixLU<_MatrixType> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;
+  };
+
+  template<typename _MatrixType, int Options>
+  struct pastix_traits< PastixLLT<_MatrixType,Options> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;
+  };
+
+  template<typename _MatrixType, int Options>
+  struct pastix_traits< PastixLDLT<_MatrixType,Options> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;
+  };
+  
+  void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, float *vals, int *perm, int * invp, float *x, int nbrhs, int *iparm, double *dparm)
+  {
+    if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; }
+    if (nbrhs == 0) {x = NULL; nbrhs=1;}
+    s_pastix(pastix_data, pastix_comm, n, ptr, idx, vals, perm, invp, x, nbrhs, iparm, dparm); 
+  }
+  
+  void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, double *vals, int *perm, int * invp, double *x, int nbrhs, int *iparm, double *dparm)
+  {
+    if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; }
+    if (nbrhs == 0) {x = NULL; nbrhs=1;}
+    d_pastix(pastix_data, pastix_comm, n, ptr, idx, vals, perm, invp, x, nbrhs, iparm, dparm); 
+  }
+  
+  void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, std::complex<float> *vals, int *perm, int * invp, std::complex<float> *x, int nbrhs, int *iparm, double *dparm)
+  {
+    if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; }
+    if (nbrhs == 0) {x = NULL; nbrhs=1;}
+    c_pastix(pastix_data, pastix_comm, n, ptr, idx, reinterpret_cast<COMPLEX*>(vals), perm, invp, reinterpret_cast<COMPLEX*>(x), nbrhs, iparm, dparm); 
+  }
+  
+  void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, std::complex<double> *vals, int *perm, int * invp, std::complex<double> *x, int nbrhs, int *iparm, double *dparm)
+  {
+    if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; }
+    if (nbrhs == 0) {x = NULL; nbrhs=1;}
+    z_pastix(pastix_data, pastix_comm, n, ptr, idx, reinterpret_cast<DCOMPLEX*>(vals), perm, invp, reinterpret_cast<DCOMPLEX*>(x), nbrhs, iparm, dparm); 
+  }
+
+  // Convert the matrix  to Fortran-style Numbering
+  template <typename MatrixType>
+  void c_to_fortran_numbering (MatrixType& mat)
+  {
+    if ( !(mat.outerIndexPtr()[0]) ) 
+    { 
+      int i;
+      for(i = 0; i <= mat.rows(); ++i)
+        ++mat.outerIndexPtr()[i];
+      for(i = 0; i < mat.nonZeros(); ++i)
+        ++mat.innerIndexPtr()[i];
+    }
+  }
+  
+  // Convert to C-style Numbering
+  template <typename MatrixType>
+  void fortran_to_c_numbering (MatrixType& mat)
+  {
+    // Check the Numbering
+    if ( mat.outerIndexPtr()[0] == 1 ) 
+    { // Convert to C-style numbering
+      int i;
+      for(i = 0; i <= mat.rows(); ++i)
+        --mat.outerIndexPtr()[i];
+      for(i = 0; i < mat.nonZeros(); ++i)
+        --mat.innerIndexPtr()[i];
+    }
+  }
+}
+
+// This is the base class to interface with PaStiX functions. 
+// Users should not used this class directly. 
+template <class Derived>
+class PastixBase : internal::noncopyable
+{
+  public:
+    typedef typename internal::pastix_traits<Derived>::MatrixType _MatrixType;
+    typedef _MatrixType MatrixType;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef Matrix<Scalar,Dynamic,1> Vector;
+    typedef SparseMatrix<Scalar, ColMajor> ColSpMatrix;
+    
+  public:
+    
+    PastixBase() : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_isInitialized(false), m_pastixdata(0), m_size(0)
+    {
+      init();
+    }
+    
+    ~PastixBase() 
+    {
+      clean();
+    }
+
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<PastixBase, Rhs>
+    solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "Pastix solver is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "PastixBase::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<PastixBase, Rhs>(*this, b.derived());
+    }
+    
+    template<typename Rhs,typename Dest>
+    bool _solve (const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const;
+    
+    /** \internal */
+    template<typename Rhs, typename DestScalar, int DestOptions, typename DestIndex>
+    void _solve_sparse(const Rhs& b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
+    {
+      eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      eigen_assert(rows()==b.rows());
+      
+      // we process the sparse rhs per block of NbColsAtOnce columns temporarily stored into a dense matrix.
+      static const int NbColsAtOnce = 1;
+      int rhsCols = b.cols();
+      int size = b.rows();
+      Eigen::Matrix<DestScalar,Dynamic,Dynamic> tmp(size,rhsCols);
+      for(int k=0; k<rhsCols; k+=NbColsAtOnce)
+      {
+        int actualCols = std::min<int>(rhsCols-k, NbColsAtOnce);
+        tmp.leftCols(actualCols) = b.middleCols(k,actualCols);
+        tmp.leftCols(actualCols) = derived().solve(tmp.leftCols(actualCols));
+        dest.middleCols(k,actualCols) = tmp.leftCols(actualCols).sparseView();
+      }
+    }
+    
+    Derived& derived()
+    {
+      return *static_cast<Derived*>(this);
+    }
+    const Derived& derived() const
+    {
+      return *static_cast<const Derived*>(this);
+    }
+
+    /** Returns a reference to the integer vector IPARM of PaStiX parameters
+      * to modify the default parameters. 
+      * The statistics related to the different phases of factorization and solve are saved here as well
+      * \sa analyzePattern() factorize()
+      */
+    Array<Index,IPARM_SIZE,1>& iparm()
+    {
+      return m_iparm; 
+    }
+    
+    /** Return a reference to a particular index parameter of the IPARM vector 
+     * \sa iparm()
+     */
+    
+    int& iparm(int idxparam)
+    {
+      return m_iparm(idxparam);
+    }
+    
+     /** Returns a reference to the double vector DPARM of PaStiX parameters 
+      * The statistics related to the different phases of factorization and solve are saved here as well
+      * \sa analyzePattern() factorize()
+      */
+    Array<RealScalar,IPARM_SIZE,1>& dparm()
+    {
+      return m_dparm; 
+    }
+    
+    
+    /** Return a reference to a particular index parameter of the DPARM vector 
+     * \sa dparm()
+     */
+    double& dparm(int idxparam)
+    {
+      return m_dparm(idxparam);
+    }
+    
+    inline Index cols() const { return m_size; }
+    inline Index rows() const { return m_size; }
+    
+     /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the PaStiX reports a problem
+      *          \c InvalidInput if the input matrix is invalid
+      *
+      * \sa iparm()          
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::sparse_solve_retval<PastixBase, Rhs>
+    solve(const SparseMatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "Pastix LU, LLT or LDLT is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "PastixBase::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::sparse_solve_retval<PastixBase, Rhs>(*this, b.derived());
+    }
+    
+  protected:
+
+    // Initialize the Pastix data structure, check the matrix
+    void init(); 
+    
+    // Compute the ordering and the symbolic factorization
+    void analyzePattern(ColSpMatrix& mat);
+    
+    // Compute the numerical factorization
+    void factorize(ColSpMatrix& mat);
+    
+    // Free all the data allocated by Pastix
+    void clean()
+    {
+      eigen_assert(m_initisOk && "The Pastix structure should be allocated first"); 
+      m_iparm(IPARM_START_TASK) = API_TASK_CLEAN;
+      m_iparm(IPARM_END_TASK) = API_TASK_CLEAN;
+      internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
+                             m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
+    }
+    
+    void compute(ColSpMatrix& mat);
+    
+    int m_initisOk; 
+    int m_analysisIsOk;
+    int m_factorizationIsOk;
+    bool m_isInitialized;
+    mutable ComputationInfo m_info; 
+    mutable pastix_data_t *m_pastixdata; // Data structure for pastix
+    mutable int m_comm; // The MPI communicator identifier
+    mutable Matrix<int,IPARM_SIZE,1> m_iparm; // integer vector for the input parameters
+    mutable Matrix<double,DPARM_SIZE,1> m_dparm; // Scalar vector for the input parameters
+    mutable Matrix<Index,Dynamic,1> m_perm;  // Permutation vector
+    mutable Matrix<Index,Dynamic,1> m_invp;  // Inverse permutation vector
+    mutable int m_size; // Size of the matrix 
+}; 
+
+ /** Initialize the PaStiX data structure. 
+   *A first call to this function fills iparm and dparm with the default PaStiX parameters
+   * \sa iparm() dparm()
+   */
+template <class Derived>
+void PastixBase<Derived>::init()
+{
+  m_size = 0; 
+  m_iparm.setZero(IPARM_SIZE);
+  m_dparm.setZero(DPARM_SIZE);
+  
+  m_iparm(IPARM_MODIFY_PARAMETER) = API_NO;
+  pastix(&m_pastixdata, MPI_COMM_WORLD,
+         0, 0, 0, 0,
+         0, 0, 0, 1, m_iparm.data(), m_dparm.data());
+  
+  m_iparm[IPARM_MATRIX_VERIFICATION] = API_NO;
+  m_iparm[IPARM_VERBOSE]             = 2;
+  m_iparm[IPARM_ORDERING]            = API_ORDER_SCOTCH;
+  m_iparm[IPARM_INCOMPLETE]          = API_NO;
+  m_iparm[IPARM_OOC_LIMIT]           = 2000;
+  m_iparm[IPARM_RHS_MAKING]          = API_RHS_B;
+  m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
+  
+  m_iparm(IPARM_START_TASK) = API_TASK_INIT;
+  m_iparm(IPARM_END_TASK) = API_TASK_INIT;
+  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
+                         0, 0, 0, 0, m_iparm.data(), m_dparm.data());
+  
+  // Check the returned error
+  if(m_iparm(IPARM_ERROR_NUMBER)) {
+    m_info = InvalidInput;
+    m_initisOk = false;
+  }
+  else { 
+    m_info = Success;
+    m_initisOk = true;
+  }
+}
+
+template <class Derived>
+void PastixBase<Derived>::compute(ColSpMatrix& mat)
+{
+  eigen_assert(mat.rows() == mat.cols() && "The input matrix should be squared");
+  
+  analyzePattern(mat);  
+  factorize(mat);
+  
+  m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
+  m_isInitialized = m_factorizationIsOk;
+}
+
+
+template <class Derived>
+void PastixBase<Derived>::analyzePattern(ColSpMatrix& mat)
+{                         
+  eigen_assert(m_initisOk && "The initialization of PaSTiX failed");
+  
+  // clean previous calls
+  if(m_size>0)
+    clean();
+  
+  m_size = mat.rows();
+  m_perm.resize(m_size);
+  m_invp.resize(m_size);
+  
+  m_iparm(IPARM_START_TASK) = API_TASK_ORDERING;
+  m_iparm(IPARM_END_TASK) = API_TASK_ANALYSE;
+  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
+               mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
+  
+  // Check the returned error
+  if(m_iparm(IPARM_ERROR_NUMBER))
+  {
+    m_info = NumericalIssue;
+    m_analysisIsOk = false;
+  }
+  else
+  { 
+    m_info = Success;
+    m_analysisIsOk = true;
+  }
+}
+
+template <class Derived>
+void PastixBase<Derived>::factorize(ColSpMatrix& mat)
+{
+//   if(&m_cpyMat != &mat) m_cpyMat = mat;
+  eigen_assert(m_analysisIsOk && "The analysis phase should be called before the factorization phase");
+  m_iparm(IPARM_START_TASK) = API_TASK_NUMFACT;
+  m_iparm(IPARM_END_TASK) = API_TASK_NUMFACT;
+  m_size = mat.rows();
+  
+  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
+               mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
+  
+  // Check the returned error
+  if(m_iparm(IPARM_ERROR_NUMBER))
+  {
+    m_info = NumericalIssue;
+    m_factorizationIsOk = false;
+    m_isInitialized = false;
+  }
+  else
+  {
+    m_info = Success;
+    m_factorizationIsOk = true;
+    m_isInitialized = true;
+  }
+}
+
+/* Solve the system */
+template<typename Base>
+template<typename Rhs,typename Dest>
+bool PastixBase<Base>::_solve (const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const
+{
+  eigen_assert(m_isInitialized && "The matrix should be factorized first");
+  EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
+                     THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  int rhs = 1;
+  
+  x = b; /* on return, x is overwritten by the computed solution */
+  
+  for (int i = 0; i < b.cols(); i++){
+    m_iparm[IPARM_START_TASK]          = API_TASK_SOLVE;
+    m_iparm[IPARM_END_TASK]            = API_TASK_REFINE;
+  
+    internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, x.rows(), 0, 0, 0,
+                           m_perm.data(), m_invp.data(), &x(0, i), rhs, m_iparm.data(), m_dparm.data());
+  }
+  
+  // Check the returned error
+  m_info = m_iparm(IPARM_ERROR_NUMBER)==0 ? Success : NumericalIssue;
+  
+  return m_iparm(IPARM_ERROR_NUMBER)==0;
+}
+
+/** \ingroup PaStiXSupport_Module
+  * \class PastixLU
+  * \brief Sparse direct LU solver based on PaStiX library
+  * 
+  * This class is used to solve the linear systems A.X = B with a supernodal LU 
+  * factorization in the PaStiX library. The matrix A should be squared and nonsingular
+  * PaStiX requires that the matrix A has a symmetric structural pattern. 
+  * This interface can symmetrize the input matrix otherwise. 
+  * The vectors or matrices X and B can be either dense or sparse.
+  * 
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam IsStrSym Indicates if the input matrix has a symmetric pattern, default is false
+  * NOTE : Note that if the analysis and factorization phase are called separately, 
+  * the input matrix will be symmetrized at each call, hence it is advised to 
+  * symmetrize the matrix in a end-user program and set \p IsStrSym to true
+  * 
+  * \sa \ref TutorialSparseDirectSolvers
+  * 
+  */
+template<typename _MatrixType, bool IsStrSym>
+class PastixLU : public PastixBase< PastixLU<_MatrixType> >
+{
+  public:
+    typedef _MatrixType MatrixType;
+    typedef PastixBase<PastixLU<MatrixType> > Base;
+    typedef typename Base::ColSpMatrix ColSpMatrix;
+    typedef typename MatrixType::Index Index;
+    
+  public:
+    PastixLU() : Base()
+    {
+      init();
+    }
+    
+    PastixLU(const MatrixType& matrix):Base()
+    {
+      init();
+      compute(matrix);
+    }
+    /** Compute the LU supernodal factorization of \p matrix. 
+      * iparm and dparm can be used to tune the PaStiX parameters. 
+      * see the PaStiX user's manual
+      * \sa analyzePattern() factorize()
+      */
+    void compute (const MatrixType& matrix)
+    {
+      m_structureIsUptodate = false;
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::compute(temp);
+    }
+    /** Compute the LU symbolic factorization of \p matrix using its sparsity pattern. 
+      * Several ordering methods can be used at this step. See the PaStiX user's manual. 
+      * The result of this operation can be used with successive matrices having the same pattern as \p matrix
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      m_structureIsUptodate = false;
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::analyzePattern(temp);
+    }
+
+    /** Compute the LU supernodal factorization of \p matrix
+      * WARNING The matrix \p matrix should have the same structural pattern 
+      * as the same used in the analysis phase.
+      * \sa analyzePattern()
+      */ 
+    void factorize(const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::factorize(temp);
+    }
+  protected:
+    
+    void init()
+    {
+      m_structureIsUptodate = false;
+      m_iparm(IPARM_SYM) = API_SYM_NO;
+      m_iparm(IPARM_FACTORIZATION) = API_FACT_LU;
+    }
+    
+    void grabMatrix(const MatrixType& matrix, ColSpMatrix& out)
+    {
+      if(IsStrSym)
+        out = matrix;
+      else
+      {
+        if(!m_structureIsUptodate)
+        {
+          // update the transposed structure
+          m_transposedStructure = matrix.transpose();
+          
+          // Set the elements of the matrix to zero 
+          for (Index j=0; j<m_transposedStructure.outerSize(); ++j) 
+            for(typename ColSpMatrix::InnerIterator it(m_transposedStructure, j); it; ++it)
+              it.valueRef() = 0.0;
+
+          m_structureIsUptodate = true;
+        }
+        
+        out = m_transposedStructure + matrix;
+      }
+      internal::c_to_fortran_numbering(out);
+    }
+    
+    using Base::m_iparm;
+    using Base::m_dparm;
+    
+    ColSpMatrix m_transposedStructure;
+    bool m_structureIsUptodate;
+};
+
+/** \ingroup PaStiXSupport_Module
+  * \class PastixLLT
+  * \brief A sparse direct supernodal Cholesky (LLT) factorization and solver based on the PaStiX library
+  * 
+  * This class is used to solve the linear systems A.X = B via a LL^T supernodal Cholesky factorization
+  * available in the PaStiX library. The matrix A should be symmetric and positive definite
+  * WARNING Selfadjoint complex matrices are not supported in the current version of PaStiX
+  * The vectors or matrices X and B can be either dense or sparse
+  * 
+  * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam UpLo The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX
+  * 
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType, int _UpLo>
+class PastixLLT : public PastixBase< PastixLLT<_MatrixType, _UpLo> >
+{
+  public:
+    typedef _MatrixType MatrixType;
+    typedef PastixBase<PastixLLT<MatrixType, _UpLo> > Base;
+    typedef typename Base::ColSpMatrix ColSpMatrix;
+    
+  public:
+    enum { UpLo = _UpLo };
+    PastixLLT() : Base()
+    {
+      init();
+    }
+    
+    PastixLLT(const MatrixType& matrix):Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    /** Compute the L factor of the LL^T supernodal factorization of \p matrix 
+      * \sa analyzePattern() factorize()
+      */
+    void compute (const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::compute(temp);
+    }
+
+     /** Compute the LL^T symbolic factorization of \p matrix using its sparsity pattern
+      * The result of this operation can be used with successive matrices having the same pattern as \p matrix
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::analyzePattern(temp);
+    }
+      /** Compute the LL^T supernodal numerical factorization of \p matrix 
+        * \sa analyzePattern()
+        */
+    void factorize(const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::factorize(temp);
+    }
+  protected:
+    using Base::m_iparm;
+    
+    void init()
+    {
+      m_iparm(IPARM_SYM) = API_SYM_YES;
+      m_iparm(IPARM_FACTORIZATION) = API_FACT_LLT;
+    }
+    
+    void grabMatrix(const MatrixType& matrix, ColSpMatrix& out)
+    {
+      // Pastix supports only lower, column-major matrices 
+      out.template selfadjointView<Lower>() = matrix.template selfadjointView<UpLo>();
+      internal::c_to_fortran_numbering(out);
+    }
+};
+
+/** \ingroup PaStiXSupport_Module
+  * \class PastixLDLT
+  * \brief A sparse direct supernodal Cholesky (LLT) factorization and solver based on the PaStiX library
+  * 
+  * This class is used to solve the linear systems A.X = B via a LDL^T supernodal Cholesky factorization
+  * available in the PaStiX library. The matrix A should be symmetric and positive definite
+  * WARNING Selfadjoint complex matrices are not supported in the current version of PaStiX
+  * The vectors or matrices X and B can be either dense or sparse
+  * 
+  * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam UpLo The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX
+  * 
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType, int _UpLo>
+class PastixLDLT : public PastixBase< PastixLDLT<_MatrixType, _UpLo> >
+{
+  public:
+    typedef _MatrixType MatrixType;
+    typedef PastixBase<PastixLDLT<MatrixType, _UpLo> > Base; 
+    typedef typename Base::ColSpMatrix ColSpMatrix;
+    
+  public:
+    enum { UpLo = _UpLo };
+    PastixLDLT():Base()
+    {
+      init();
+    }
+    
+    PastixLDLT(const MatrixType& matrix):Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    /** Compute the L and D factors of the LDL^T factorization of \p matrix 
+      * \sa analyzePattern() factorize()
+      */
+    void compute (const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::compute(temp);
+    }
+
+    /** Compute the LDL^T symbolic factorization of \p matrix using its sparsity pattern
+      * The result of this operation can be used with successive matrices having the same pattern as \p matrix
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    { 
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::analyzePattern(temp);
+    }
+    /** Compute the LDL^T supernodal numerical factorization of \p matrix 
+      * 
+      */
+    void factorize(const MatrixType& matrix)
+    {
+      ColSpMatrix temp;
+      grabMatrix(matrix, temp);
+      Base::factorize(temp);
+    }
+
+  protected:
+    using Base::m_iparm;
+    
+    void init()
+    {
+      m_iparm(IPARM_SYM) = API_SYM_YES;
+      m_iparm(IPARM_FACTORIZATION) = API_FACT_LDLT;
+    }
+    
+    void grabMatrix(const MatrixType& matrix, ColSpMatrix& out)
+    {
+      // Pastix supports only lower, column-major matrices 
+      out.template selfadjointView<Lower>() = matrix.template selfadjointView<UpLo>();
+      internal::c_to_fortran_numbering(out);
+    }
+};
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+struct solve_retval<PastixBase<_MatrixType>, Rhs>
+  : solve_retval_base<PastixBase<_MatrixType>, Rhs>
+{
+  typedef PastixBase<_MatrixType> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+template<typename _MatrixType, typename Rhs>
+struct sparse_solve_retval<PastixBase<_MatrixType>, Rhs>
+  : sparse_solve_retval_base<PastixBase<_MatrixType>, Rhs>
+{
+  typedef PastixBase<_MatrixType> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve_sparse(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif
diff --git a/extern/Eigen3/Eigen/src/PardisoSupport/PardisoSupport.h b/extern/Eigen3/Eigen/src/PardisoSupport/PardisoSupport.h
new file mode 100644
index 0000000..e6defc8
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/PardisoSupport/PardisoSupport.h
@@ -0,0 +1,614 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL PARDISO
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_PARDISOSUPPORT_H
+#define EIGEN_PARDISOSUPPORT_H
+
+namespace Eigen { 
+
+template<typename _MatrixType> class PardisoLU;
+template<typename _MatrixType, int Options=Upper> class PardisoLLT;
+template<typename _MatrixType, int Options=Upper> class PardisoLDLT;
+
+namespace internal
+{
+  template<typename Index>
+  struct pardiso_run_selector
+  {
+    static Index run( _MKL_DSS_HANDLE_t pt, Index maxfct, Index mnum, Index type, Index phase, Index n, void *a,
+                      Index *ia, Index *ja, Index *perm, Index nrhs, Index *iparm, Index msglvl, void *b, void *x)
+    {
+      Index error = 0;
+      ::pardiso(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error);
+      return error;
+    }
+  };
+  template<>
+  struct pardiso_run_selector<long long int>
+  {
+    typedef long long int Index;
+    static Index run( _MKL_DSS_HANDLE_t pt, Index maxfct, Index mnum, Index type, Index phase, Index n, void *a,
+                      Index *ia, Index *ja, Index *perm, Index nrhs, Index *iparm, Index msglvl, void *b, void *x)
+    {
+      Index error = 0;
+      ::pardiso_64(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error);
+      return error;
+    }
+  };
+
+  template<class Pardiso> struct pardiso_traits;
+
+  template<typename _MatrixType>
+  struct pardiso_traits< PardisoLU<_MatrixType> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;
+  };
+
+  template<typename _MatrixType, int Options>
+  struct pardiso_traits< PardisoLLT<_MatrixType, Options> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;
+  };
+
+  template<typename _MatrixType, int Options>
+  struct pardiso_traits< PardisoLDLT<_MatrixType, Options> >
+  {
+    typedef _MatrixType MatrixType;
+    typedef typename _MatrixType::Scalar Scalar;
+    typedef typename _MatrixType::RealScalar RealScalar;
+    typedef typename _MatrixType::Index Index;    
+  };
+
+}
+
+template<class Derived>
+class PardisoImpl
+{
+    typedef internal::pardiso_traits<Derived> Traits;
+  public:
+    typedef typename Traits::MatrixType MatrixType;
+    typedef typename Traits::Scalar Scalar;
+    typedef typename Traits::RealScalar RealScalar;
+    typedef typename Traits::Index Index;
+    typedef SparseMatrix<Scalar,RowMajor,Index> SparseMatrixType;
+    typedef Matrix<Scalar,Dynamic,1> VectorType;
+    typedef Matrix<Index, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
+    typedef Matrix<Index, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
+    enum {
+      ScalarIsComplex = NumTraits<Scalar>::IsComplex
+    };
+
+    PardisoImpl()
+    {
+      eigen_assert((sizeof(Index) >= sizeof(_INTEGER_t) && sizeof(Index) <= 8) && "Non-supported index type");
+      m_iparm.setZero();
+      m_msglvl = 0; // No output
+      m_initialized = false;
+    }
+
+    ~PardisoImpl()
+    {
+      pardisoRelease();
+    }
+
+    inline Index cols() const { return m_size; }
+    inline Index rows() const { return m_size; }
+  
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_initialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+
+    /** \warning for advanced usage only.
+      * \returns a reference to the parameter array controlling PARDISO.
+      * See the PARDISO manual to know how to use it. */
+    Array<Index,64,1>& pardisoParameterArray()
+    {
+      return m_iparm;
+    }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      * 
+      * \sa factorize()
+      */
+    Derived& analyzePattern(const MatrixType& matrix);
+    
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    Derived& factorize(const MatrixType& matrix);
+
+    Derived& compute(const MatrixType& matrix);
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<PardisoImpl, Rhs>
+    solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_initialized && "Pardiso solver is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "PardisoImpl::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<PardisoImpl, Rhs>(*this, b.derived());
+    }
+
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::sparse_solve_retval<PardisoImpl, Rhs>
+    solve(const SparseMatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_initialized && "Pardiso solver is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "PardisoImpl::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::sparse_solve_retval<PardisoImpl, Rhs>(*this, b.derived());
+    }
+
+    Derived& derived()
+    {
+      return *static_cast<Derived*>(this);
+    }
+    const Derived& derived() const
+    {
+      return *static_cast<const Derived*>(this);
+    }
+
+    template<typename BDerived, typename XDerived>
+    bool _solve(const MatrixBase<BDerived> &b, MatrixBase<XDerived>& x) const;
+
+    /** \internal */
+    template<typename Rhs, typename DestScalar, int DestOptions, typename DestIndex>
+    void _solve_sparse(const Rhs& b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
+    {
+      eigen_assert(m_size==b.rows());
+
+      // we process the sparse rhs per block of NbColsAtOnce columns temporarily stored into a dense matrix.
+      static const int NbColsAtOnce = 4;
+      int rhsCols = b.cols();
+      int size = b.rows();
+      // Pardiso cannot solve in-place,
+      // so we need two temporaries
+      Eigen::Matrix<DestScalar,Dynamic,Dynamic,ColMajor> tmp_rhs(size,rhsCols);
+      Eigen::Matrix<DestScalar,Dynamic,Dynamic,ColMajor> tmp_res(size,rhsCols);
+      for(int k=0; k<rhsCols; k+=NbColsAtOnce)
+      {
+        int actualCols = std::min<int>(rhsCols-k, NbColsAtOnce);
+        tmp_rhs.leftCols(actualCols) = b.middleCols(k,actualCols);
+        tmp_res.leftCols(actualCols) = derived().solve(tmp_rhs.leftCols(actualCols));
+        dest.middleCols(k,actualCols) = tmp_res.leftCols(actualCols).sparseView();
+      }
+    }
+
+  protected:
+    void pardisoRelease()
+    {
+      if(m_initialized) // Factorization ran at least once
+      {
+        internal::pardiso_run_selector<Index>::run(m_pt, 1, 1, m_type, -1, m_size, 0, 0, 0, m_perm.data(), 0,
+                                                   m_iparm.data(), m_msglvl, 0, 0);
+      }
+    }
+
+    void pardisoInit(int type)
+    {
+      m_type = type;
+      bool symmetric = abs(m_type) < 10;
+      m_iparm[0] = 1;   // No solver default
+      m_iparm[1] = 3;   // use Metis for the ordering
+      m_iparm[2] = 1;   // Numbers of processors, value of OMP_NUM_THREADS
+      m_iparm[3] = 0;   // No iterative-direct algorithm
+      m_iparm[4] = 0;   // No user fill-in reducing permutation
+      m_iparm[5] = 0;   // Write solution into x
+      m_iparm[6] = 0;   // Not in use
+      m_iparm[7] = 2;   // Max numbers of iterative refinement steps
+      m_iparm[8] = 0;   // Not in use
+      m_iparm[9] = 13;  // Perturb the pivot elements with 1E-13
+      m_iparm[10] = symmetric ? 0 : 1; // Use nonsymmetric permutation and scaling MPS
+      m_iparm[11] = 0;  // Not in use
+      m_iparm[12] = symmetric ? 0 : 1;  // Maximum weighted matching algorithm is switched-off (default for symmetric).
+                                        // Try m_iparm[12] = 1 in case of inappropriate accuracy
+      m_iparm[13] = 0;  // Output: Number of perturbed pivots
+      m_iparm[14] = 0;  // Not in use
+      m_iparm[15] = 0;  // Not in use
+      m_iparm[16] = 0;  // Not in use
+      m_iparm[17] = -1; // Output: Number of nonzeros in the factor LU
+      m_iparm[18] = -1; // Output: Mflops for LU factorization
+      m_iparm[19] = 0;  // Output: Numbers of CG Iterations
+      
+      m_iparm[20] = 0;  // 1x1 pivoting
+      m_iparm[26] = 0;  // No matrix checker
+      m_iparm[27] = (sizeof(RealScalar) == 4) ? 1 : 0;
+      m_iparm[34] = 1;  // C indexing
+      m_iparm[59] = 1;  // Automatic switch between In-Core and Out-of-Core modes
+    }
+
+  protected:
+    // cached data to reduce reallocation, etc.
+    
+    void manageErrorCode(Index error)
+    {
+      switch(error)
+      {
+        case 0:
+          m_info = Success;
+          break;
+        case -4:
+        case -7:
+          m_info = NumericalIssue;
+          break;
+        default:
+          m_info = InvalidInput;
+      }
+    }
+
+    mutable SparseMatrixType m_matrix;
+    ComputationInfo m_info;
+    bool m_initialized, m_analysisIsOk, m_factorizationIsOk;
+    Index m_type, m_msglvl;
+    mutable void *m_pt[64];
+    mutable Array<Index,64,1> m_iparm;
+    mutable IntColVectorType m_perm;
+    Index m_size;
+    
+  private:
+    PardisoImpl(PardisoImpl &) {}
+};
+
+template<class Derived>
+Derived& PardisoImpl<Derived>::compute(const MatrixType& a)
+{
+  m_size = a.rows();
+  eigen_assert(a.rows() == a.cols());
+
+  pardisoRelease();
+  memset(m_pt, 0, sizeof(m_pt));
+  m_perm.setZero(m_size);
+  derived().getMatrix(a);
+  
+  Index error;
+  error = internal::pardiso_run_selector<Index>::run(m_pt, 1, 1, m_type, 12, m_size,
+                                                     m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
+                                                     m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
+
+  manageErrorCode(error);
+  m_analysisIsOk = true;
+  m_factorizationIsOk = true;
+  m_initialized = true;
+  return derived();
+}
+
+template<class Derived>
+Derived& PardisoImpl<Derived>::analyzePattern(const MatrixType& a)
+{
+  m_size = a.rows();
+  eigen_assert(m_size == a.cols());
+
+  pardisoRelease();
+  memset(m_pt, 0, sizeof(m_pt));
+  m_perm.setZero(m_size);
+  derived().getMatrix(a);
+  
+  Index error;
+  error = internal::pardiso_run_selector<Index>::run(m_pt, 1, 1, m_type, 11, m_size,
+                                                     m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
+                                                     m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
+  
+  manageErrorCode(error);
+  m_analysisIsOk = true;
+  m_factorizationIsOk = false;
+  m_initialized = true;
+  return derived();
+}
+
+template<class Derived>
+Derived& PardisoImpl<Derived>::factorize(const MatrixType& a)
+{
+  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+  eigen_assert(m_size == a.rows() && m_size == a.cols());
+  
+  derived().getMatrix(a);
+
+  Index error;  
+  error = internal::pardiso_run_selector<Index>::run(m_pt, 1, 1, m_type, 22, m_size,
+                                                     m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
+                                                     m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
+  
+  manageErrorCode(error);
+  m_factorizationIsOk = true;
+  return derived();
+}
+
+template<class Base>
+template<typename BDerived,typename XDerived>
+bool PardisoImpl<Base>::_solve(const MatrixBase<BDerived> &b, MatrixBase<XDerived>& x) const
+{
+  if(m_iparm[0] == 0) // Factorization was not computed
+    return false;
+
+  //Index n = m_matrix.rows();
+  Index nrhs = Index(b.cols());
+  eigen_assert(m_size==b.rows());
+  eigen_assert(((MatrixBase<BDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major right hand sides are not supported");
+  eigen_assert(((MatrixBase<XDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major matrices of unknowns are not supported");
+  eigen_assert(((nrhs == 1) || b.outerStride() == b.rows()));
+
+
+//  switch (transposed) {
+//    case SvNoTrans    : m_iparm[11] = 0 ; break;
+//    case SvTranspose  : m_iparm[11] = 2 ; break;
+//    case SvAdjoint    : m_iparm[11] = 1 ; break;
+//    default:
+//      //std::cerr << "Eigen: transposition  option \"" << transposed << "\" not supported by the PARDISO backend\n";
+//      m_iparm[11] = 0;
+//  }
+
+  Scalar* rhs_ptr = const_cast<Scalar*>(b.derived().data());
+  Matrix<Scalar,Dynamic,Dynamic,ColMajor> tmp;
+  
+  // Pardiso cannot solve in-place
+  if(rhs_ptr == x.derived().data())
+  {
+    tmp = b;
+    rhs_ptr = tmp.data();
+  }
+  
+  Index error;
+  error = internal::pardiso_run_selector<Index>::run(m_pt, 1, 1, m_type, 33, m_size,
+                                                     m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
+                                                     m_perm.data(), nrhs, m_iparm.data(), m_msglvl,
+                                                     rhs_ptr, x.derived().data());
+
+  return error==0;
+}
+
+
+/** \ingroup PardisoSupport_Module
+  * \class PardisoLU
+  * \brief A sparse direct LU factorization and solver based on the PARDISO library
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization
+  * using the Intel MKL PARDISO library. The sparse matrix A must be squared and invertible.
+  * The vectors or matrices X and B can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename MatrixType>
+class PardisoLU : public PardisoImpl< PardisoLU<MatrixType> >
+{
+  protected:
+    typedef PardisoImpl< PardisoLU<MatrixType> > Base;
+    typedef typename Base::Scalar Scalar;
+    typedef typename Base::RealScalar RealScalar;
+    using Base::pardisoInit;
+    using Base::m_matrix;
+    friend class PardisoImpl< PardisoLU<MatrixType> >;
+
+  public:
+
+    using Base::compute;
+    using Base::solve;
+
+    PardisoLU()
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? 13 : 11);
+    }
+
+    PardisoLU(const MatrixType& matrix)
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? 13 : 11);
+      compute(matrix);
+    }
+  protected:
+    void getMatrix(const MatrixType& matrix)
+    {
+      m_matrix = matrix;
+    }
+    
+  private:
+    PardisoLU(PardisoLU& ) {}
+};
+
+/** \ingroup PardisoSupport_Module
+  * \class PardisoLLT
+  * \brief A sparse direct Cholesky (LLT) factorization and solver based on the PARDISO library
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a LL^T Cholesky factorization
+  * using the Intel MKL PARDISO library. The sparse matrix A must be selfajoint and positive definite.
+  * The vectors or matrices X and B can be either dense or sparse.
+  *
+  * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam UpLo can be any bitwise combination of Upper, Lower. The default is Upper, meaning only the upper triangular part has to be used.
+  *         Upper|Lower can be used to tell both triangular parts can be used as input.
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename MatrixType, int _UpLo>
+class PardisoLLT : public PardisoImpl< PardisoLLT<MatrixType,_UpLo> >
+{
+  protected:
+    typedef PardisoImpl< PardisoLLT<MatrixType,_UpLo> > Base;
+    typedef typename Base::Scalar Scalar;
+    typedef typename Base::Index Index;
+    typedef typename Base::RealScalar RealScalar;
+    using Base::pardisoInit;
+    using Base::m_matrix;
+    friend class PardisoImpl< PardisoLLT<MatrixType,_UpLo> >;
+
+  public:
+
+    enum { UpLo = _UpLo };
+    using Base::compute;
+    using Base::solve;
+
+    PardisoLLT()
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? 4 : 2);
+    }
+
+    PardisoLLT(const MatrixType& matrix)
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? 4 : 2);
+      compute(matrix);
+    }
+    
+  protected:
+    
+    void getMatrix(const MatrixType& matrix)
+    {
+      // PARDISO supports only upper, row-major matrices
+      PermutationMatrix<Dynamic,Dynamic,Index> p_null;
+      m_matrix.resize(matrix.rows(), matrix.cols());
+      m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().twistedBy(p_null);
+    }
+    
+  private:
+    PardisoLLT(PardisoLLT& ) {}
+};
+
+/** \ingroup PardisoSupport_Module
+  * \class PardisoLDLT
+  * \brief A sparse direct Cholesky (LDLT) factorization and solver based on the PARDISO library
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a LDL^T Cholesky factorization
+  * using the Intel MKL PARDISO library. The sparse matrix A is assumed to be selfajoint and positive definite.
+  * For complex matrices, A can also be symmetric only, see the \a Options template parameter.
+  * The vectors or matrices X and B can be either dense or sparse.
+  *
+  * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam Options can be any bitwise combination of Upper, Lower, and Symmetric. The default is Upper, meaning only the upper triangular part has to be used.
+  *         Symmetric can be used for symmetric, non-selfadjoint complex matrices, the default being to assume a selfadjoint matrix.
+  *         Upper|Lower can be used to tell both triangular parts can be used as input.
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename MatrixType, int Options>
+class PardisoLDLT : public PardisoImpl< PardisoLDLT<MatrixType,Options> >
+{
+  protected:
+    typedef PardisoImpl< PardisoLDLT<MatrixType,Options> > Base;
+    typedef typename Base::Scalar Scalar;
+    typedef typename Base::Index Index;
+    typedef typename Base::RealScalar RealScalar;
+    using Base::pardisoInit;
+    using Base::m_matrix;
+    friend class PardisoImpl< PardisoLDLT<MatrixType,Options> >;
+
+  public:
+
+    using Base::compute;
+    using Base::solve;
+    enum { UpLo = Options&(Upper|Lower) };
+
+    PardisoLDLT()
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? ( bool(Options&Symmetric) ? 6 : -4 ) : -2);
+    }
+
+    PardisoLDLT(const MatrixType& matrix)
+      : Base()
+    {
+      pardisoInit(Base::ScalarIsComplex ? ( bool(Options&Symmetric) ? 6 : -4 ) : -2);
+      compute(matrix);
+    }
+    
+    void getMatrix(const MatrixType& matrix)
+    {
+      // PARDISO supports only upper, row-major matrices
+      PermutationMatrix<Dynamic,Dynamic,Index> p_null;
+      m_matrix.resize(matrix.rows(), matrix.cols());
+      m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().twistedBy(p_null);
+    }
+    
+  private:
+    PardisoLDLT(PardisoLDLT& ) {}
+};
+
+namespace internal {
+  
+template<typename _Derived, typename Rhs>
+struct solve_retval<PardisoImpl<_Derived>, Rhs>
+  : solve_retval_base<PardisoImpl<_Derived>, Rhs>
+{
+  typedef PardisoImpl<_Derived> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+template<typename Derived, typename Rhs>
+struct sparse_solve_retval<PardisoImpl<Derived>, Rhs>
+  : sparse_solve_retval_base<PardisoImpl<Derived>, Rhs>
+{
+  typedef PardisoImpl<Derived> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve_sparse(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_PARDISOSUPPORT_H
diff --git a/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h b/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
index f04c603..2daa23c 100644
--- a/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
+++ b/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
@@ -4,28 +4,15 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_H
 #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_H
 
+namespace Eigen { 
+
 /** \ingroup QR_Module
   *
   * \class ColPivHouseholderQR
@@ -528,5 +515,6 @@ MatrixBase<Derived>::colPivHouseholderQr() const
   return ColPivHouseholderQR<PlainObject>(eval());
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_COLPIVOTINGHOUSEHOLDERQR_H
diff --git a/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h b/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h
new file mode 100644
index 0000000..745ecf8
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h
@@ -0,0 +1,98 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Householder QR decomposition of a matrix with column pivoting based on
+ *    LAPACKE_?geqp3 function.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
+#define EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_QR_COLPIV(EIGTYPE, MKLTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
+template<> inline\
+ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \
+ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >::compute( \
+              const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix) \
+\
+{ \
+  typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
+  typedef MatrixType::Scalar Scalar; \
+  typedef MatrixType::RealScalar RealScalar; \
+  Index rows = matrix.rows();\
+  Index cols = matrix.cols();\
+  Index size = matrix.diagonalSize();\
+\
+  m_qr = matrix;\
+  m_hCoeffs.resize(size);\
+\
+  m_colsTranspositions.resize(cols);\
+  /*Index number_of_transpositions = 0;*/ \
+\
+  m_nonzero_pivots = 0; \
+  m_maxpivot = RealScalar(0);\
+  m_colsPermutation.resize(cols); \
+  m_colsPermutation.indices().setZero(); \
+\
+  lapack_int lda = m_qr.outerStride(), i; \
+  lapack_int matrix_order = MKLCOLROW; \
+  LAPACKE_##MKLPREFIX##geqp3( matrix_order, rows, cols, (MKLTYPE*)m_qr.data(), lda, (lapack_int*)m_colsPermutation.indices().data(), (MKLTYPE*)m_hCoeffs.data()); \
+  m_isInitialized = true; \
+  m_maxpivot=m_qr.diagonal().cwiseAbs().maxCoeff(); \
+  m_hCoeffs.adjointInPlace(); \
+  RealScalar premultiplied_threshold = internal::abs(m_maxpivot) * threshold(); \
+  lapack_int *perm = m_colsPermutation.indices().data(); \
+  for(i=0;i<size;i++) { \
+    m_nonzero_pivots += (internal::abs(m_qr.coeff(i,i)) > premultiplied_threshold);\
+  } \
+  for(i=0;i<cols;i++) perm[i]--;\
+\
+  /*m_det_pq = (number_of_transpositions%2) ? -1 : 1;  // TODO: It's not needed now; fix upon availability in Eigen */ \
+\
+  return *this; \
+}
+
+EIGEN_MKL_QR_COLPIV(double,   double,        d, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_QR_COLPIV(float,    float,         s, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_QR_COLPIV(dcomplex, MKL_Complex16, z, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_QR_COLPIV(scomplex, MKL_Complex8,  c, ColMajor, LAPACK_COL_MAJOR)
+
+EIGEN_MKL_QR_COLPIV(double,   double,        d, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_QR_COLPIV(float,    float,         s, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_QR_COLPIV(dcomplex, MKL_Complex16, z, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_QR_COLPIV(scomplex, MKL_Complex8,  c, RowMajor, LAPACK_ROW_MAJOR)
+
+} // end namespace Eigen
+
+#endif // EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h b/extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
index dde3013..37898e7 100644
--- a/extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
+++ b/extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
@@ -4,28 +4,27 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
 #define EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
 
+namespace Eigen { 
+
+namespace internal {
+
+template<typename MatrixType> struct FullPivHouseholderQRMatrixQReturnType;
+
+template<typename MatrixType>
+struct traits<FullPivHouseholderQRMatrixQReturnType<MatrixType> >
+{
+  typedef typename MatrixType::PlainObject ReturnType;
+};
+
+}
+
 /** \ingroup QR_Module
   *
   * \class FullPivHouseholderQR
@@ -62,7 +61,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
     typedef typename MatrixType::Scalar Scalar;
     typedef typename MatrixType::RealScalar RealScalar;
     typedef typename MatrixType::Index Index;
-    typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, Options, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
+    typedef internal::FullPivHouseholderQRMatrixQReturnType<MatrixType> MatrixQReturnType;
     typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType;
     typedef Matrix<Index, 1, ColsAtCompileTime, RowMajor, 1, MaxColsAtCompileTime> IntRowVectorType;
     typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationType;
@@ -139,7 +138,9 @@ template<typename _MatrixType> class FullPivHouseholderQR
       return internal::solve_retval<FullPivHouseholderQR, Rhs>(*this, b.derived());
     }
 
-    MatrixQType matrixQ(void) const;
+    /** \returns Expression object representing the matrix Q
+      */
+    MatrixQReturnType matrixQ(void) const;
 
     /** \returns a reference to the matrix where the Householder QR decomposition is stored
       */
@@ -508,28 +509,73 @@ struct solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
   }
 };
 
+/** \ingroup QR_Module
+  *
+  * \brief Expression type for return value of FullPivHouseholderQR::matrixQ()
+  *
+  * \tparam MatrixType type of underlying dense matrix
+  */
+template<typename MatrixType> struct FullPivHouseholderQRMatrixQReturnType
+  : public ReturnByValue<FullPivHouseholderQRMatrixQReturnType<MatrixType> >
+{
+public:
+  typedef typename MatrixType::Index Index;
+  typedef typename internal::plain_col_type<MatrixType, Index>::type IntColVectorType;
+  typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType;
+  typedef Matrix<typename MatrixType::Scalar, 1, MatrixType::RowsAtCompileTime, RowMajor, 1,
+                 MatrixType::MaxRowsAtCompileTime> WorkVectorType;
+
+  FullPivHouseholderQRMatrixQReturnType(const MatrixType&       qr,
+                                        const HCoeffsType&      hCoeffs,
+                                        const IntColVectorType& rowsTranspositions)
+    : m_qr(qr),
+      m_hCoeffs(hCoeffs),
+      m_rowsTranspositions(rowsTranspositions)
+      {}
+
+  template <typename ResultType>
+  void evalTo(ResultType& result) const
+  {
+    const Index rows = m_qr.rows();
+    WorkVectorType workspace(rows);
+    evalTo(result, workspace);
+  }
+
+  template <typename ResultType>
+  void evalTo(ResultType& result, WorkVectorType& workspace) const
+  {
+    // compute the product H'_0 H'_1 ... H'_n-1,
+    // where H_k is the k-th Householder transformation I - h_k v_k v_k'
+    // and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...]
+    const Index rows = m_qr.rows();
+    const Index cols = m_qr.cols();
+    const Index size = (std::min)(rows, cols);
+    workspace.resize(rows);
+    result.setIdentity(rows, rows);
+    for (Index k = size-1; k >= 0; k--)
+    {
+      result.block(k, k, rows-k, rows-k)
+            .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), internal::conj(m_hCoeffs.coeff(k)), &workspace.coeffRef(k));
+      result.row(k).swap(result.row(m_rowsTranspositions.coeff(k)));
+    }
+  }
+
+    Index rows() const { return m_qr.rows(); }
+    Index cols() const { return m_qr.rows(); }
+
+protected:
+  typename MatrixType::Nested m_qr;
+  typename HCoeffsType::Nested m_hCoeffs;
+  typename IntColVectorType::Nested m_rowsTranspositions;
+};
+
 } // end namespace internal
 
-/** \returns the matrix Q */
 template<typename MatrixType>
-typename FullPivHouseholderQR<MatrixType>::MatrixQType FullPivHouseholderQR<MatrixType>::matrixQ() const
+inline typename FullPivHouseholderQR<MatrixType>::MatrixQReturnType FullPivHouseholderQR<MatrixType>::matrixQ() const
 {
   eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
-  // compute the product H'_0 H'_1 ... H'_n-1,
-  // where H_k is the k-th Householder transformation I - h_k v_k v_k'
-  // and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...]
-  Index rows = m_qr.rows();
-  Index cols = m_qr.cols();
-  Index size = (std::min)(rows,cols);
-  MatrixQType res = MatrixQType::Identity(rows, rows);
-  Matrix<Scalar,1,MatrixType::RowsAtCompileTime> temp(rows);
-  for (Index k = size-1; k >= 0; k--)
-  {
-    res.block(k, k, rows-k, rows-k)
-       .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), internal::conj(m_hCoeffs.coeff(k)), &temp.coeffRef(k));
-    res.row(k).swap(res.row(m_rows_transpositions.coeff(k)));
-  }
-  return res;
+  return MatrixQReturnType(m_qr, m_hCoeffs, m_rows_transpositions);
 }
 
 /** \return the full-pivoting Householder QR decomposition of \c *this.
@@ -543,4 +589,6 @@ MatrixBase<Derived>::fullPivHouseholderQr() const
   return FullPivHouseholderQR<PlainObject>(eval());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
diff --git a/extern/Eigen3/Eigen/src/QR/HouseholderQR.h b/extern/Eigen3/Eigen/src/QR/HouseholderQR.h
index 9ee96de..5bcb32c 100644
--- a/extern/Eigen3/Eigen/src/QR/HouseholderQR.h
+++ b/extern/Eigen3/Eigen/src/QR/HouseholderQR.h
@@ -5,28 +5,15 @@
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 // Copyright (C) 2010 Vincent Lejeune
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_QR_H
 #define EIGEN_QR_H
 
+namespace Eigen { 
+
 /** \ingroup QR_Module
   *
   *
@@ -351,5 +338,6 @@ MatrixBase<Derived>::householderQr() const
   return HouseholderQR<PlainObject>(eval());
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_QR_H
diff --git a/extern/Eigen3/Eigen/src/QR/HouseholderQR_MKL.h b/extern/Eigen3/Eigen/src/QR/HouseholderQR_MKL.h
new file mode 100644
index 0000000..5313de6
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/QR/HouseholderQR_MKL.h
@@ -0,0 +1,69 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Householder QR decomposition of a matrix w/o pivoting based on
+ *    LAPACKE_?geqrf function.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_QR_MKL_H
+#define EIGEN_QR_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \
+template<typename MatrixQR, typename HCoeffs> \
+void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \
+                                       typename MatrixQR::Index maxBlockSize=32, \
+                                       EIGTYPE* tempData = 0) \
+{ \
+  lapack_int m = mat.rows(); \
+  lapack_int n = mat.cols(); \
+  lapack_int lda = mat.outerStride(); \
+  lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
+  LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \
+  hCoeffs.adjointInPlace(); \
+\
+}
+
+EIGEN_MKL_QR_NOPIV(double, double, d)
+EIGEN_MKL_QR_NOPIV(float, float, s)
+EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z)
+EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c)
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_QR_MKL_H
diff --git a/extern/Eigen3/Eigen/src/SVD/JacobiSVD.h b/extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
index 3c42309..a7dbf07 100644
--- a/extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
+++ b/extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_JACOBISVD_H
 #define EIGEN_JACOBISVD_H
 
+namespace Eigen { 
+
 namespace internal {
 // forward declaration (needed by ICC)
 // the empty body is required by MSVC
@@ -61,9 +48,12 @@ template<typename MatrixType, int QRPreconditioner, int Case,
 > struct qr_preconditioner_impl {};
 
 template<typename MatrixType, int QRPreconditioner, int Case>
-struct qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
+class qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
 {
-  static bool run(JacobiSVD<MatrixType, QRPreconditioner>&, const MatrixType&)
+public:
+  typedef typename MatrixType::Index Index;
+  void allocate(const JacobiSVD<MatrixType, QRPreconditioner>&) {}
+  bool run(JacobiSVD<MatrixType, QRPreconditioner>&, const MatrixType&)
   {
     return false;
   }
@@ -72,134 +62,279 @@ struct qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
 /*** preconditioner using FullPivHouseholderQR ***/
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+class qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
 {
-  static bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  enum
+  {
+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+    MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime
+  };
+  typedef Matrix<Scalar, 1, RowsAtCompileTime, RowMajor, 1, MaxRowsAtCompileTime> WorkspaceType;
+
+  void allocate(const JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd)
+  {
+    if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols())
+    {
+      m_qr = FullPivHouseholderQR<MatrixType>(svd.rows(), svd.cols());
+    }
+    if (svd.m_computeFullU) m_workspace.resize(svd.rows());
+  }
+
+  bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.rows() > matrix.cols())
     {
-      FullPivHouseholderQR<MatrixType> qr(matrix);
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
-      if(svd.m_computeFullU) svd.m_matrixU = qr.matrixQ();
-      if(svd.computeV()) svd.m_matrixV = qr.colsPermutation();
+      m_qr.compute(matrix);
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
+      if(svd.m_computeFullU) m_qr.matrixQ().evalTo(svd.m_matrixU, m_workspace);
+      if(svd.computeV()) svd.m_matrixV = m_qr.colsPermutation();
       return true;
     }
     return false;
   }
+private:
+  FullPivHouseholderQR<MatrixType> m_qr;
+  WorkspaceType m_workspace;
 };
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+class qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
 {
-  static bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  enum
+  {
+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+    ColsAtCompileTime = MatrixType::ColsAtCompileTime,
+    MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
+    Options = MatrixType::Options
+  };
+  typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
+          TransposeTypeWithSameStorageOrder;
+
+  void allocate(const JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd)
+  {
+    if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols())
+    {
+      m_qr = FullPivHouseholderQR<TransposeTypeWithSameStorageOrder>(svd.cols(), svd.rows());
+    }
+    m_adjoint.resize(svd.cols(), svd.rows());
+    if (svd.m_computeFullV) m_workspace.resize(svd.cols());
+  }
+
+  bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.cols() > matrix.rows())
     {
-      typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime,
-                     MatrixType::Options, MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime>
-              TransposeTypeWithSameStorageOrder;
-      FullPivHouseholderQR<TransposeTypeWithSameStorageOrder> qr(matrix.adjoint());
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
-      if(svd.m_computeFullV) svd.m_matrixV = qr.matrixQ();
-      if(svd.computeU()) svd.m_matrixU = qr.colsPermutation();
+      m_adjoint = matrix.adjoint();
+      m_qr.compute(m_adjoint);
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
+      if(svd.m_computeFullV) m_qr.matrixQ().evalTo(svd.m_matrixV, m_workspace);
+      if(svd.computeU()) svd.m_matrixU = m_qr.colsPermutation();
       return true;
     }
     else return false;
   }
+private:
+  FullPivHouseholderQR<TransposeTypeWithSameStorageOrder> m_qr;
+  TransposeTypeWithSameStorageOrder m_adjoint;
+  typename internal::plain_row_type<MatrixType>::type m_workspace;
 };
 
 /*** preconditioner using ColPivHouseholderQR ***/
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+class qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
 {
-  static bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+
+  void allocate(const JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd)
+  {
+    if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols())
+    {
+      m_qr = ColPivHouseholderQR<MatrixType>(svd.rows(), svd.cols());
+    }
+    if (svd.m_computeFullU) m_workspace.resize(svd.rows());
+    else if (svd.m_computeThinU) m_workspace.resize(svd.cols());
+  }
+
+  bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.rows() > matrix.cols())
     {
-      ColPivHouseholderQR<MatrixType> qr(matrix);
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
-      if(svd.m_computeFullU) svd.m_matrixU = qr.householderQ();
-      else if(svd.m_computeThinU) {
+      m_qr.compute(matrix);
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
+      if(svd.m_computeFullU) m_qr.householderQ().evalTo(svd.m_matrixU, m_workspace);
+      else if(svd.m_computeThinU)
+      {
         svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
-        qr.householderQ().applyThisOnTheLeft(svd.m_matrixU);
+        m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixU, m_workspace);
       }
-      if(svd.computeV()) svd.m_matrixV = qr.colsPermutation();
+      if(svd.computeV()) svd.m_matrixV = m_qr.colsPermutation();
       return true;
     }
     return false;
   }
+
+private:
+  ColPivHouseholderQR<MatrixType> m_qr;
+  typename internal::plain_col_type<MatrixType>::type m_workspace;
 };
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+class qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
 {
-  static bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  enum
+  {
+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+    ColsAtCompileTime = MatrixType::ColsAtCompileTime,
+    MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
+    Options = MatrixType::Options
+  };
+
+  typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
+          TransposeTypeWithSameStorageOrder;
+
+  void allocate(const JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd)
+  {
+    if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols())
+    {
+      m_qr = ColPivHouseholderQR<TransposeTypeWithSameStorageOrder>(svd.cols(), svd.rows());
+    }
+    if (svd.m_computeFullV) m_workspace.resize(svd.cols());
+    else if (svd.m_computeThinV) m_workspace.resize(svd.rows());
+    m_adjoint.resize(svd.cols(), svd.rows());
+  }
+
+  bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.cols() > matrix.rows())
     {
-      typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime,
-                     MatrixType::Options, MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime>
-              TransposeTypeWithSameStorageOrder;
-      ColPivHouseholderQR<TransposeTypeWithSameStorageOrder> qr(matrix.adjoint());
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
-      if(svd.m_computeFullV) svd.m_matrixV = qr.householderQ();
-      else if(svd.m_computeThinV) {
+      m_adjoint = matrix.adjoint();
+      m_qr.compute(m_adjoint);
+
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
+      if(svd.m_computeFullV) m_qr.householderQ().evalTo(svd.m_matrixV, m_workspace);
+      else if(svd.m_computeThinV)
+      {
         svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
-        qr.householderQ().applyThisOnTheLeft(svd.m_matrixV);
+        m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixV, m_workspace);
       }
-      if(svd.computeU()) svd.m_matrixU = qr.colsPermutation();
+      if(svd.computeU()) svd.m_matrixU = m_qr.colsPermutation();
       return true;
     }
     else return false;
   }
+
+private:
+  ColPivHouseholderQR<TransposeTypeWithSameStorageOrder> m_qr;
+  TransposeTypeWithSameStorageOrder m_adjoint;
+  typename internal::plain_row_type<MatrixType>::type m_workspace;
 };
 
 /*** preconditioner using HouseholderQR ***/
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+class qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
 {
-  static bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+
+  void allocate(const JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd)
+  {
+    if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols())
+    {
+      m_qr = HouseholderQR<MatrixType>(svd.rows(), svd.cols());
+    }
+    if (svd.m_computeFullU) m_workspace.resize(svd.rows());
+    else if (svd.m_computeThinU) m_workspace.resize(svd.cols());
+  }
+
+  bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.rows() > matrix.cols())
     {
-      HouseholderQR<MatrixType> qr(matrix);
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
-      if(svd.m_computeFullU) svd.m_matrixU = qr.householderQ();
-      else if(svd.m_computeThinU) {
+      m_qr.compute(matrix);
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
+      if(svd.m_computeFullU) m_qr.householderQ().evalTo(svd.m_matrixU, m_workspace);
+      else if(svd.m_computeThinU)
+      {
         svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
-        qr.householderQ().applyThisOnTheLeft(svd.m_matrixU);
+        m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixU, m_workspace);
       }
       if(svd.computeV()) svd.m_matrixV.setIdentity(matrix.cols(), matrix.cols());
       return true;
     }
     return false;
   }
+private:
+  HouseholderQR<MatrixType> m_qr;
+  typename internal::plain_col_type<MatrixType>::type m_workspace;
 };
 
 template<typename MatrixType>
-struct qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+class qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
 {
-  static bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
+public:
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  enum
+  {
+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+    ColsAtCompileTime = MatrixType::ColsAtCompileTime,
+    MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
+    Options = MatrixType::Options
+  };
+
+  typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
+          TransposeTypeWithSameStorageOrder;
+
+  void allocate(const JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd)
+  {
+    if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols())
+    {
+      m_qr = HouseholderQR<TransposeTypeWithSameStorageOrder>(svd.cols(), svd.rows());
+    }
+    if (svd.m_computeFullV) m_workspace.resize(svd.cols());
+    else if (svd.m_computeThinV) m_workspace.resize(svd.rows());
+    m_adjoint.resize(svd.cols(), svd.rows());
+  }
+
+  bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
   {
     if(matrix.cols() > matrix.rows())
     {
-      typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime,
-                     MatrixType::Options, MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime>
-              TransposeTypeWithSameStorageOrder;
-      HouseholderQR<TransposeTypeWithSameStorageOrder> qr(matrix.adjoint());
-      svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
-      if(svd.m_computeFullV) svd.m_matrixV = qr.householderQ();
-      else if(svd.m_computeThinV) {
+      m_adjoint = matrix.adjoint();
+      m_qr.compute(m_adjoint);
+
+      svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
+      if(svd.m_computeFullV) m_qr.householderQ().evalTo(svd.m_matrixV, m_workspace);
+      else if(svd.m_computeThinV)
+      {
         svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
-        qr.householderQ().applyThisOnTheLeft(svd.m_matrixV);
+        m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixV, m_workspace);
       }
       if(svd.computeU()) svd.m_matrixU.setIdentity(matrix.rows(), matrix.rows());
       return true;
     }
     else return false;
   }
+
+private:
+  HouseholderQR<TransposeTypeWithSameStorageOrder> m_qr;
+  TransposeTypeWithSameStorageOrder m_adjoint;
+  typename internal::plain_row_type<MatrixType>::type m_workspace;
 };
 
 /*** 2x2 SVD implementation
@@ -316,7 +451,7 @@ void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
   * Here's an example demonstrating basic usage:
   * \include JacobiSVD_basic.cpp
   * Output: \verbinclude JacobiSVD_basic.out
-  * 
+  *
   * This JacobiSVD class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than
   * bidiagonalizing SVD algorithms for large square matrices; however its complexity is still \f$ O(n^2p) \f$ where \a n is the smaller dimension and
   * \a p is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms.
@@ -324,7 +459,7 @@ void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
   *
   * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
   * terminate in finite (and reasonable) time.
-  * 
+  *
   * The possible values for QRPreconditioner are:
   * \li ColPivHouseholderQRPreconditioner is the default. In practice it's very safe. It uses column-pivoting QR.
   * \li FullPivHouseholderQRPreconditioner, is the safest and slowest. It uses full-pivoting QR.
@@ -494,7 +629,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
       * \param b the right-hand-side of the equation to solve.
       *
       * \note Solving requires both U and V to be computed. Thin U and V are enough, there is no need for full U or V.
-      * 
+      *
       * \note SVD solving is implicitly least-squares. Thus, this method serves both purposes of exact solving and least-squares solving.
       * In other words, the returned solution is guaranteed to minimize the Euclidean norm \f$ \Vert A x - b \Vert \f$.
       */
@@ -535,6 +670,9 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
     friend struct internal::svd_precondition_2x2_block_to_be_real;
     template<typename __MatrixType, int _QRPreconditioner, int _Case, bool _DoAnything>
     friend struct internal::qr_preconditioner_impl;
+
+    internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows> m_qr_precond_morecols;
+    internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols> m_qr_precond_morerows;
 };
 
 template<typename MatrixType, int QRPreconditioner>
@@ -578,6 +716,9 @@ void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, u
                           : m_computeThinV ? m_diagSize
                           : 0);
   m_workMatrix.resize(m_diagSize, m_diagSize);
+  
+  if(m_cols>m_rows) m_qr_precond_morecols.allocate(*this);
+  if(m_rows>m_cols) m_qr_precond_morerows.allocate(*this);
 }
 
 template<typename MatrixType, int QRPreconditioner>
@@ -595,8 +736,7 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
 
   /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
 
-  if(!internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows>::run(*this, matrix)
-  && !internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols>::run(*this, matrix))
+  if(!m_qr_precond_morecols.run(*this, matrix) && !m_qr_precond_morerows.run(*this, matrix))
   {
     m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize);
     if(m_computeFullU) m_matrixU.setIdentity(m_rows,m_rows);
@@ -722,6 +862,6 @@ MatrixBase<Derived>::jacobiSvd(unsigned int computationOptions) const
   return JacobiSVD<PlainObject>(*this, computationOptions);
 }
 
-
+} // end namespace Eigen
 
 #endif // EIGEN_JACOBISVD_H
diff --git a/extern/Eigen3/Eigen/src/SVD/JacobiSVD_MKL.h b/extern/Eigen3/Eigen/src/SVD/JacobiSVD_MKL.h
new file mode 100644
index 0000000..4d479f6
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SVD/JacobiSVD_MKL.h
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ********************************************************************************
+ *   Content : Eigen bindings to Intel(R) MKL
+ *    Singular Value Decomposition - SVD.
+ ********************************************************************************
+*/
+
+#ifndef EIGEN_JACOBISVD_MKL_H
+#define EIGEN_JACOBISVD_MKL_H
+
+#include "Eigen/src/Core/util/MKL_support.h"
+
+namespace Eigen { 
+
+/** \internal Specialization for the data types supported by MKL */
+
+#define EIGEN_MKL_SVD(EIGTYPE, MKLTYPE, MKLRTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
+template<> inline\
+JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>& \
+JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) \
+{ \
+  typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
+  typedef MatrixType::Scalar Scalar; \
+  typedef MatrixType::RealScalar RealScalar; \
+  allocate(matrix.rows(), matrix.cols(), computationOptions); \
+\
+  /*const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();*/ \
+  m_nonzeroSingularValues = m_diagSize; \
+\
+  lapack_int lda = matrix.outerStride(), ldu, ldvt; \
+  lapack_int matrix_order = MKLCOLROW; \
+  char jobu, jobvt; \
+  MKLTYPE *u, *vt, dummy; \
+  jobu  = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \
+  jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \
+  if (computeU()) { \
+    ldu  = m_matrixU.outerStride(); \
+    u    = (MKLTYPE*)m_matrixU.data(); \
+  } else { ldu=1; u=&dummy; }\
+  MatrixType localV; \
+  ldvt = (m_computeFullV) ? m_cols : (m_computeThinV) ? m_diagSize : 1; \
+  if (computeV()) { \
+    localV.resize(ldvt, m_cols); \
+    vt   = (MKLTYPE*)localV.data(); \
+  } else { ldvt=1; vt=&dummy; }\
+  Matrix<MKLRTYPE, Dynamic, Dynamic> superb; superb.resize(m_diagSize, 1); \
+  MatrixType m_temp; m_temp = matrix; \
+  LAPACKE_##MKLPREFIX##gesvd( matrix_order, jobu, jobvt, m_rows, m_cols, (MKLTYPE*)m_temp.data(), lda, (MKLRTYPE*)m_singularValues.data(), u, ldu, vt, ldvt, superb.data()); \
+  if (computeV()) m_matrixV = localV.adjoint(); \
+ /* for(int i=0;i<m_diagSize;i++) if (m_singularValues.coeffRef(i) < precision) { m_nonzeroSingularValues--; m_singularValues.coeffRef(i)=RealScalar(0);}*/ \
+  m_isInitialized = true; \
+  return *this; \
+}
+
+EIGEN_MKL_SVD(double,   double,        double, d, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SVD(float,    float,         float , s, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SVD(dcomplex, MKL_Complex16, double, z, ColMajor, LAPACK_COL_MAJOR)
+EIGEN_MKL_SVD(scomplex, MKL_Complex8,  float , c, ColMajor, LAPACK_COL_MAJOR)
+
+EIGEN_MKL_SVD(double,   double,        double, d, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_SVD(float,    float,         float , s, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_SVD(dcomplex, MKL_Complex16, double, z, RowMajor, LAPACK_ROW_MAJOR)
+EIGEN_MKL_SVD(scomplex, MKL_Complex8,  float , c, RowMajor, LAPACK_ROW_MAJOR)
+
+} // end namespace Eigen
+
+#endif // EIGEN_JACOBISVD_MKL_H
diff --git a/extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h b/extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h
index 2de197d..213b310 100644
--- a/extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h
+++ b/extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BIDIAGONALIZATION_H
 #define EIGEN_BIDIAGONALIZATION_H
 
+namespace Eigen { 
+
 namespace internal {
 // UpperBidiagonalization will probably be replaced by a Bidiagonalization class, don't want to make it stable API.
 // At the same time, it's useful to keep for now as it's about the only thing that is testing the BandMatrix class.
@@ -156,4 +143,6 @@ MatrixBase<Derived>::bidiagonalization() const
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_BIDIAGONALIZATION_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/AmbiVector.h b/extern/Eigen3/Eigen/src/Sparse/AmbiVector.h
deleted file mode 100644
index 2ea8ba3..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/AmbiVector.h
+++ /dev/null
@@ -1,379 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_AMBIVECTOR_H
-#define EIGEN_AMBIVECTOR_H
-
-/** \internal
-  * Hybrid sparse/dense vector class designed for intensive read-write operations.
-  *
-  * See BasicSparseLLT and SparseProduct for usage examples.
-  */
-template<typename _Scalar, typename _Index>
-class AmbiVector
-{
-  public:
-    typedef _Scalar Scalar;
-    typedef _Index Index;
-    typedef typename NumTraits<Scalar>::Real RealScalar;
-
-    AmbiVector(Index size)
-      : m_buffer(0), m_zero(0), m_size(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1)
-    {
-      resize(size);
-    }
-
-    void init(double estimatedDensity);
-    void init(int mode);
-
-    Index nonZeros() const;
-
-    /** Specifies a sub-vector to work on */
-    void setBounds(Index start, Index end) { m_start = start; m_end = end; }
-
-    void setZero();
-
-    void restart();
-    Scalar& coeffRef(Index i);
-    Scalar& coeff(Index i);
-
-    class Iterator;
-
-    ~AmbiVector() { delete[] m_buffer; }
-
-    void resize(Index size)
-    {
-      if (m_allocatedSize < size)
-        reallocate(size);
-      m_size = size;
-    }
-
-    Index size() const { return m_size; }
-
-  protected:
-
-    void reallocate(Index size)
-    {
-      // if the size of the matrix is not too large, let's allocate a bit more than needed such
-      // that we can handle dense vector even in sparse mode.
-      delete[] m_buffer;
-      if (size<1000)
-      {
-        Index allocSize = (size * sizeof(ListEl))/sizeof(Scalar);
-        m_allocatedElements = (allocSize*sizeof(Scalar))/sizeof(ListEl);
-        m_buffer = new Scalar[allocSize];
-      }
-      else
-      {
-        m_allocatedElements = (size*sizeof(Scalar))/sizeof(ListEl);
-        m_buffer = new Scalar[size];
-      }
-      m_size = size;
-      m_start = 0;
-      m_end = m_size;
-    }
-
-    void reallocateSparse()
-    {
-      Index copyElements = m_allocatedElements;
-      m_allocatedElements = (std::min)(Index(m_allocatedElements*1.5),m_size);
-      Index allocSize = m_allocatedElements * sizeof(ListEl);
-      allocSize = allocSize/sizeof(Scalar) + (allocSize%sizeof(Scalar)>0?1:0);
-      Scalar* newBuffer = new Scalar[allocSize];
-      memcpy(newBuffer,  m_buffer,  copyElements * sizeof(ListEl));
-      delete[] m_buffer;
-      m_buffer = newBuffer;
-    }
-
-  protected:
-    // element type of the linked list
-    struct ListEl
-    {
-      Index next;
-      Index index;
-      Scalar value;
-    };
-
-    // used to store data in both mode
-    Scalar* m_buffer;
-    Scalar m_zero;
-    Index m_size;
-    Index m_start;
-    Index m_end;
-    Index m_allocatedSize;
-    Index m_allocatedElements;
-    Index m_mode;
-
-    // linked list mode
-    Index m_llStart;
-    Index m_llCurrent;
-    Index m_llSize;
-};
-
-/** \returns the number of non zeros in the current sub vector */
-template<typename _Scalar,typename _Index>
-_Index AmbiVector<_Scalar,_Index>::nonZeros() const
-{
-  if (m_mode==IsSparse)
-    return m_llSize;
-  else
-    return m_end - m_start;
-}
-
-template<typename _Scalar,typename _Index>
-void AmbiVector<_Scalar,_Index>::init(double estimatedDensity)
-{
-  if (estimatedDensity>0.1)
-    init(IsDense);
-  else
-    init(IsSparse);
-}
-
-template<typename _Scalar,typename _Index>
-void AmbiVector<_Scalar,_Index>::init(int mode)
-{
-  m_mode = mode;
-  if (m_mode==IsSparse)
-  {
-    m_llSize = 0;
-    m_llStart = -1;
-  }
-}
-
-/** Must be called whenever we might perform a write access
-  * with an index smaller than the previous one.
-  *
-  * Don't worry, this function is extremely cheap.
-  */
-template<typename _Scalar,typename _Index>
-void AmbiVector<_Scalar,_Index>::restart()
-{
-  m_llCurrent = m_llStart;
-}
-
-/** Set all coefficients of current subvector to zero */
-template<typename _Scalar,typename _Index>
-void AmbiVector<_Scalar,_Index>::setZero()
-{
-  if (m_mode==IsDense)
-  {
-    for (Index i=m_start; i<m_end; ++i)
-      m_buffer[i] = Scalar(0);
-  }
-  else
-  {
-    eigen_assert(m_mode==IsSparse);
-    m_llSize = 0;
-    m_llStart = -1;
-  }
-}
-
-template<typename _Scalar,typename _Index>
-_Scalar& AmbiVector<_Scalar,_Index>::coeffRef(_Index i)
-{
-  if (m_mode==IsDense)
-    return m_buffer[i];
-  else
-  {
-    ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
-    // TODO factorize the following code to reduce code generation
-    eigen_assert(m_mode==IsSparse);
-    if (m_llSize==0)
-    {
-      // this is the first element
-      m_llStart = 0;
-      m_llCurrent = 0;
-      ++m_llSize;
-      llElements[0].value = Scalar(0);
-      llElements[0].index = i;
-      llElements[0].next = -1;
-      return llElements[0].value;
-    }
-    else if (i<llElements[m_llStart].index)
-    {
-      // this is going to be the new first element of the list
-      ListEl& el = llElements[m_llSize];
-      el.value = Scalar(0);
-      el.index = i;
-      el.next = m_llStart;
-      m_llStart = m_llSize;
-      ++m_llSize;
-      m_llCurrent = m_llStart;
-      return el.value;
-    }
-    else
-    {
-      Index nextel = llElements[m_llCurrent].next;
-      eigen_assert(i>=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index");
-      while (nextel >= 0 && llElements[nextel].index<=i)
-      {
-        m_llCurrent = nextel;
-        nextel = llElements[nextel].next;
-      }
-
-      if (llElements[m_llCurrent].index==i)
-      {
-        // the coefficient already exists and we found it !
-        return llElements[m_llCurrent].value;
-      }
-      else
-      {
-        if (m_llSize>=m_allocatedElements)
-        {
-          reallocateSparse();
-          llElements = reinterpret_cast<ListEl*>(m_buffer);
-        }
-        eigen_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
-        // let's insert a new coefficient
-        ListEl& el = llElements[m_llSize];
-        el.value = Scalar(0);
-        el.index = i;
-        el.next = llElements[m_llCurrent].next;
-        llElements[m_llCurrent].next = m_llSize;
-        ++m_llSize;
-        return el.value;
-      }
-    }
-  }
-}
-
-template<typename _Scalar,typename _Index>
-_Scalar& AmbiVector<_Scalar,_Index>::coeff(_Index i)
-{
-  if (m_mode==IsDense)
-    return m_buffer[i];
-  else
-  {
-    ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
-    eigen_assert(m_mode==IsSparse);
-    if ((m_llSize==0) || (i<llElements[m_llStart].index))
-    {
-      return m_zero;
-    }
-    else
-    {
-      Index elid = m_llStart;
-      while (elid >= 0 && llElements[elid].index<i)
-        elid = llElements[elid].next;
-
-      if (llElements[elid].index==i)
-        return llElements[m_llCurrent].value;
-      else
-        return m_zero;
-    }
-  }
-}
-
-/** Iterator over the nonzero coefficients */
-template<typename _Scalar,typename _Index>
-class AmbiVector<_Scalar,_Index>::Iterator
-{
-  public:
-    typedef _Scalar Scalar;
-    typedef typename NumTraits<Scalar>::Real RealScalar;
-
-    /** Default constructor
-      * \param vec the vector on which we iterate
-      * \param epsilon the minimal value used to prune zero coefficients.
-      * In practice, all coefficients having a magnitude smaller than \a epsilon
-      * are skipped.
-      */
-    Iterator(const AmbiVector& vec, RealScalar epsilon = RealScalar(0.1)*NumTraits<RealScalar>::dummy_precision())
-      : m_vector(vec)
-    {
-      m_epsilon = epsilon;
-      m_isDense = m_vector.m_mode==IsDense;
-      if (m_isDense)
-      {
-        m_currentEl = 0;   // this is to avoid a compilation warning
-        m_cachedValue = 0; // this is to avoid a compilation warning
-        m_cachedIndex = m_vector.m_start-1;
-        ++(*this);
-      }
-      else
-      {
-        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
-        m_currentEl = m_vector.m_llStart;
-        while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<m_epsilon)
-          m_currentEl = llElements[m_currentEl].next;
-        if (m_currentEl<0)
-        {
-          m_cachedValue = 0; // this is to avoid a compilation warning
-          m_cachedIndex = -1;
-        }
-        else
-        {
-          m_cachedIndex = llElements[m_currentEl].index;
-          m_cachedValue = llElements[m_currentEl].value;
-        }
-      }
-    }
-
-    Index index() const { return m_cachedIndex; }
-    Scalar value() const { return m_cachedValue; }
-
-    operator bool() const { return m_cachedIndex>=0; }
-
-    Iterator& operator++()
-    {
-      if (m_isDense)
-      {
-        do {
-          ++m_cachedIndex;
-        } while (m_cachedIndex<m_vector.m_end && internal::abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
-        if (m_cachedIndex<m_vector.m_end)
-          m_cachedValue = m_vector.m_buffer[m_cachedIndex];
-        else
-          m_cachedIndex=-1;
-      }
-      else
-      {
-        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
-        do {
-          m_currentEl = llElements[m_currentEl].next;
-        } while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<m_epsilon);
-        if (m_currentEl<0)
-        {
-          m_cachedIndex = -1;
-        }
-        else
-        {
-          m_cachedIndex = llElements[m_currentEl].index;
-          m_cachedValue = llElements[m_currentEl].value;
-        }
-      }
-      return *this;
-    }
-
-  protected:
-    const AmbiVector& m_vector; // the target vector
-    Index m_currentEl;            // the current element in sparse/linked-list mode
-    RealScalar m_epsilon;       // epsilon used to prune zero coefficients
-    Index m_cachedIndex;          // current coordinate
-    Scalar m_cachedValue;       // current value
-    bool m_isDense;             // mode of the vector
-};
-
-
-#endif // EIGEN_AMBIVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/CompressedStorage.h b/extern/Eigen3/Eigen/src/Sparse/CompressedStorage.h
deleted file mode 100644
index b3bde27..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/CompressedStorage.h
+++ /dev/null
@@ -1,239 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_COMPRESSED_STORAGE_H
-#define EIGEN_COMPRESSED_STORAGE_H
-
-/** Stores a sparse set of values as a list of values and a list of indices.
-  *
-  */
-template<typename _Scalar,typename _Index>
-class CompressedStorage
-{
-  public:
-
-    typedef _Scalar Scalar;
-    typedef _Index Index;
-
-  protected:
-
-    typedef typename NumTraits<Scalar>::Real RealScalar;
-
-  public:
-
-    CompressedStorage()
-      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
-    {}
-
-    CompressedStorage(size_t size)
-      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
-    {
-      resize(size);
-    }
-
-    CompressedStorage(const CompressedStorage& other)
-      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
-    {
-      *this = other;
-    }
-
-    CompressedStorage& operator=(const CompressedStorage& other)
-    {
-      resize(other.size());
-      memcpy(m_values, other.m_values, m_size * sizeof(Scalar));
-      memcpy(m_indices, other.m_indices, m_size * sizeof(Index));
-      return *this;
-    }
-
-    void swap(CompressedStorage& other)
-    {
-      std::swap(m_values, other.m_values);
-      std::swap(m_indices, other.m_indices);
-      std::swap(m_size, other.m_size);
-      std::swap(m_allocatedSize, other.m_allocatedSize);
-    }
-
-    ~CompressedStorage()
-    {
-      delete[] m_values;
-      delete[] m_indices;
-    }
-
-    void reserve(size_t size)
-    {
-      size_t newAllocatedSize = m_size + size;
-      if (newAllocatedSize > m_allocatedSize)
-        reallocate(newAllocatedSize);
-    }
-
-    void squeeze()
-    {
-      if (m_allocatedSize>m_size)
-        reallocate(m_size);
-    }
-
-    void resize(size_t size, float reserveSizeFactor = 0)
-    {
-      if (m_allocatedSize<size)
-        reallocate(size + size_t(reserveSizeFactor*size));
-      m_size = size;
-    }
-
-    void append(const Scalar& v, Index i)
-    {
-      Index id = static_cast<Index>(m_size);
-      resize(m_size+1, 1);
-      m_values[id] = v;
-      m_indices[id] = i;
-    }
-
-    inline size_t size() const { return m_size; }
-    inline size_t allocatedSize() const { return m_allocatedSize; }
-    inline void clear() { m_size = 0; }
-
-    inline Scalar& value(size_t i) { return m_values[i]; }
-    inline const Scalar& value(size_t i) const { return m_values[i]; }
-
-    inline Index& index(size_t i) { return m_indices[i]; }
-    inline const Index& index(size_t i) const { return m_indices[i]; }
-
-    static CompressedStorage Map(Index* indices, Scalar* values, size_t size)
-    {
-      CompressedStorage res;
-      res.m_indices = indices;
-      res.m_values = values;
-      res.m_allocatedSize = res.m_size = size;
-      return res;
-    }
-
-    /** \returns the largest \c k such that for all \c j in [0,k) index[\c j]\<\a key */
-    inline Index searchLowerIndex(Index key) const
-    {
-      return searchLowerIndex(0, m_size, key);
-    }
-
-    /** \returns the largest \c k in [start,end) such that for all \c j in [start,k) index[\c j]\<\a key */
-    inline Index searchLowerIndex(size_t start, size_t end, Index key) const
-    {
-      while(end>start)
-      {
-        size_t mid = (end+start)>>1;
-        if (m_indices[mid]<key)
-          start = mid+1;
-        else
-          end = mid;
-      }
-      return static_cast<Index>(start);
-    }
-
-    /** \returns the stored value at index \a key
-      * If the value does not exist, then the value \a defaultValue is returned without any insertion. */
-    inline Scalar at(Index key, Scalar defaultValue = Scalar(0)) const
-    {
-      if (m_size==0)
-        return defaultValue;
-      else if (key==m_indices[m_size-1])
-        return m_values[m_size-1];
-      // ^^  optimization: let's first check if it is the last coefficient
-      // (very common in high level algorithms)
-      const size_t id = searchLowerIndex(0,m_size-1,key);
-      return ((id<m_size) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
-    }
-
-    /** Like at(), but the search is performed in the range [start,end) */
-    inline Scalar atInRange(size_t start, size_t end, Index key, Scalar defaultValue = Scalar(0)) const
-    {
-      if (start>=end)
-        return Scalar(0);
-      else if (end>start && key==m_indices[end-1])
-        return m_values[end-1];
-      // ^^  optimization: let's first check if it is the last coefficient
-      // (very common in high level algorithms)
-      const size_t id = searchLowerIndex(start,end-1,key);
-      return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
-    }
-
-    /** \returns a reference to the value at index \a key
-      * If the value does not exist, then the value \a defaultValue is inserted
-      * such that the keys are sorted. */
-    inline Scalar& atWithInsertion(Index key, Scalar defaultValue = Scalar(0))
-    {
-      size_t id = searchLowerIndex(0,m_size,key);
-      if (id>=m_size || m_indices[id]!=key)
-      {
-        resize(m_size+1,1);
-        for (size_t j=m_size-1; j>id; --j)
-        {
-          m_indices[j] = m_indices[j-1];
-          m_values[j] = m_values[j-1];
-        }
-        m_indices[id] = key;
-        m_values[id] = defaultValue;
-      }
-      return m_values[id];
-    }
-
-    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
-    {
-      size_t k = 0;
-      size_t n = size();
-      for (size_t i=0; i<n; ++i)
-      {
-        if (!internal::isMuchSmallerThan(value(i), reference, epsilon))
-        {
-          value(k) = value(i);
-          index(k) = index(i);
-          ++k;
-        }
-      }
-      resize(k,0);
-    }
-
-  protected:
-
-    inline void reallocate(size_t size)
-    {
-      Scalar* newValues  = new Scalar[size];
-      Index* newIndices = new Index[size];
-      size_t copySize = (std::min)(size, m_size);
-      // copy
-      memcpy(newValues,  m_values,  copySize * sizeof(Scalar));
-      memcpy(newIndices, m_indices, copySize * sizeof(Index));
-      // delete old stuff
-      delete[] m_values;
-      delete[] m_indices;
-      m_values = newValues;
-      m_indices = newIndices;
-      m_allocatedSize = size;
-    }
-
-  protected:
-    Scalar* m_values;
-    Index* m_indices;
-    size_t m_size;
-    size_t m_allocatedSize;
-
-};
-
-#endif // EIGEN_COMPRESSED_STORAGE_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/CoreIterators.h b/extern/Eigen3/Eigen/src/Sparse/CoreIterators.h
deleted file mode 100644
index b4beaee..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/CoreIterators.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_COREITERATORS_H
-#define EIGEN_COREITERATORS_H
-
-/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core
- */
-
-/** \class InnerIterator
-  * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression
-  *
-  * todo
-  */
-
-// generic version for dense matrix and expressions
-template<typename Derived> class DenseBase<Derived>::InnerIterator
-{
-  protected:
-    typedef typename Derived::Scalar Scalar;
-    typedef typename Derived::Index Index;
-
-    enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
-  public:
-    EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
-      : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
-    {}
-
-    EIGEN_STRONG_INLINE Scalar value() const
-    {
-      return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
-                          : m_expression.coeff(m_inner, m_outer);
-    }
-
-    EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_inner; }
-    inline Index row() const { return IsRowMajor ? m_outer : index(); }
-    inline Index col() const { return IsRowMajor ? index() : m_outer; }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
-
-  protected:
-    const Derived& m_expression;
-    Index m_inner;
-    const Index m_outer;
-    const Index m_end;
-};
-
-#endif // EIGEN_COREITERATORS_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/DynamicSparseMatrix.h b/extern/Eigen3/Eigen/src/Sparse/DynamicSparseMatrix.h
deleted file mode 100644
index 93e75f4..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/DynamicSparseMatrix.h
+++ /dev/null
@@ -1,346 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_DYNAMIC_SPARSEMATRIX_H
-#define EIGEN_DYNAMIC_SPARSEMATRIX_H
-
-/** \class DynamicSparseMatrix
-  *
-  * \brief A sparse matrix class designed for matrix assembly purpose
-  *
-  * \param _Scalar the scalar type, i.e. the type of the coefficients
-  *
-  * Unlike SparseMatrix, this class provides a much higher degree of flexibility. In particular, it allows
-  * random read/write accesses in log(rho*outer_size) where \c rho is the probability that a coefficient is
-  * nonzero and outer_size is the number of columns if the matrix is column-major and the number of rows
-  * otherwise.
-  *
-  * Internally, the data are stored as a std::vector of compressed vector. The performances of random writes might
-  * decrease as the number of nonzeros per inner-vector increase. In practice, we observed very good performance
-  * till about 100 nonzeros/vector, and the performance remains relatively good till 500 nonzeros/vectors.
-  *
-  * \see SparseMatrix
-  */
-
-namespace internal {
-template<typename _Scalar, int _Options, typename _Index>
-struct traits<DynamicSparseMatrix<_Scalar, _Options, _Index> >
-{
-  typedef _Scalar Scalar;
-  typedef _Index Index;
-  typedef Sparse StorageKind;
-  typedef MatrixXpr XprKind;
-  enum {
-    RowsAtCompileTime = Dynamic,
-    ColsAtCompileTime = Dynamic,
-    MaxRowsAtCompileTime = Dynamic,
-    MaxColsAtCompileTime = Dynamic,
-    Flags = _Options | NestByRefBit | LvalueBit,
-    CoeffReadCost = NumTraits<Scalar>::ReadCost,
-    SupportedAccessPatterns = OuterRandomAccessPattern
-  };
-};
-}
-
-template<typename _Scalar, int _Options, typename _Index>
-class DynamicSparseMatrix
-  : public SparseMatrixBase<DynamicSparseMatrix<_Scalar, _Options, _Index> >
-{
-  public:
-    EIGEN_SPARSE_PUBLIC_INTERFACE(DynamicSparseMatrix)
-    // FIXME: why are these operator already alvailable ???
-    // EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(DynamicSparseMatrix, +=)
-    // EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(DynamicSparseMatrix, -=)
-    typedef MappedSparseMatrix<Scalar,Flags> Map;
-    using Base::IsRowMajor;
-    using Base::operator=;
-    enum {
-      Options = _Options
-    };
-
-  protected:
-
-    typedef DynamicSparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix;
-
-    Index m_innerSize;
-    std::vector<CompressedStorage<Scalar,Index> > m_data;
-
-  public:
-
-    inline Index rows() const { return IsRowMajor ? outerSize() : m_innerSize; }
-    inline Index cols() const { return IsRowMajor ? m_innerSize : outerSize(); }
-    inline Index innerSize() const { return m_innerSize; }
-    inline Index outerSize() const { return static_cast<Index>(m_data.size()); }
-    inline Index innerNonZeros(Index j) const { return m_data[j].size(); }
-
-    std::vector<CompressedStorage<Scalar,Index> >& _data() { return m_data; }
-    const std::vector<CompressedStorage<Scalar,Index> >& _data() const { return m_data; }
-
-    /** \returns the coefficient value at given position \a row, \a col
-      * This operation involes a log(rho*outer_size) binary search.
-      */
-    inline Scalar coeff(Index row, Index col) const
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-      return m_data[outer].at(inner);
-    }
-
-    /** \returns a reference to the coefficient value at given position \a row, \a col
-      * This operation involes a log(rho*outer_size) binary search. If the coefficient does not
-      * exist yet, then a sorted insertion into a sequential buffer is performed.
-      */
-    inline Scalar& coeffRef(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-      return m_data[outer].atWithInsertion(inner);
-    }
-
-    class InnerIterator;
-
-    void setZero()
-    {
-      for (Index j=0; j<outerSize(); ++j)
-        m_data[j].clear();
-    }
-
-    /** \returns the number of non zero coefficients */
-    Index nonZeros() const
-    {
-      Index res = 0;
-      for (Index j=0; j<outerSize(); ++j)
-        res += static_cast<Index>(m_data[j].size());
-      return res;
-    }
-
-
-
-    void reserve(Index reserveSize = 1000)
-    {
-      if (outerSize()>0)
-      {
-        Index reserveSizePerVector = (std::max)(reserveSize/outerSize(),Index(4));
-        for (Index j=0; j<outerSize(); ++j)
-        {
-          m_data[j].reserve(reserveSizePerVector);
-        }
-      }
-    }
-
-    /** Does nothing: provided for compatibility with SparseMatrix */
-    inline void startVec(Index /*outer*/) {}
-
-    /** \returns a reference to the non zero coefficient at position \a row, \a col assuming that:
-      * - the nonzero does not already exist
-      * - the new coefficient is the last one of the given inner vector.
-      *
-      * \sa insert, insertBackByOuterInner */
-    inline Scalar& insertBack(Index row, Index col)
-    {
-      return insertBackByOuterInner(IsRowMajor?row:col, IsRowMajor?col:row);
-    }
-
-    /** \sa insertBack */
-    inline Scalar& insertBackByOuterInner(Index outer, Index inner)
-    {
-      eigen_assert(outer<Index(m_data.size()) && inner<m_innerSize && "out of range");
-      eigen_assert(((m_data[outer].size()==0) || (m_data[outer].index(m_data[outer].size()-1)<inner))
-                && "wrong sorted insertion");
-      m_data[outer].append(0, inner);
-      return m_data[outer].value(m_data[outer].size()-1);
-    }
-
-    inline Scalar& insert(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      Index startId = 0;
-      Index id = static_cast<Index>(m_data[outer].size()) - 1;
-      m_data[outer].resize(id+2,1);
-
-      while ( (id >= startId) && (m_data[outer].index(id) > inner) )
-      {
-        m_data[outer].index(id+1) = m_data[outer].index(id);
-        m_data[outer].value(id+1) = m_data[outer].value(id);
-        --id;
-      }
-      m_data[outer].index(id+1) = inner;
-      m_data[outer].value(id+1) = 0;
-      return m_data[outer].value(id+1);
-    }
-
-    /** Does nothing: provided for compatibility with SparseMatrix */
-    inline void finalize() {}
-
-    /** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */
-    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
-    {
-      for (Index j=0; j<outerSize(); ++j)
-        m_data[j].prune(reference,epsilon);
-    }
-
-    /** Resize the matrix without preserving the data (the matrix is set to zero)
-      */
-    void resize(Index rows, Index cols)
-    {
-      const Index outerSize = IsRowMajor ? rows : cols;
-      m_innerSize = IsRowMajor ? cols : rows;
-      setZero();
-      if (Index(m_data.size()) != outerSize)
-      {
-        m_data.resize(outerSize);
-      }
-    }
-
-    void resizeAndKeepData(Index rows, Index cols)
-    {
-      const Index outerSize = IsRowMajor ? rows : cols;
-      const Index innerSize = IsRowMajor ? cols : rows;
-      if (m_innerSize>innerSize)
-      {
-        // remove all coefficients with innerCoord>=innerSize
-        // TODO
-        //std::cerr << "not implemented yet\n";
-        exit(2);
-      }
-      if (m_data.size() != outerSize)
-      {
-        m_data.resize(outerSize);
-      }
-    }
-
-    inline DynamicSparseMatrix()
-      : m_innerSize(0), m_data(0)
-    {
-      eigen_assert(innerSize()==0 && outerSize()==0);
-    }
-
-    inline DynamicSparseMatrix(Index rows, Index cols)
-      : m_innerSize(0)
-    {
-      resize(rows, cols);
-    }
-
-    template<typename OtherDerived>
-    explicit inline DynamicSparseMatrix(const SparseMatrixBase<OtherDerived>& other)
-      : m_innerSize(0)
-    {
-    Base::operator=(other.derived());
-    }
-
-    inline DynamicSparseMatrix(const DynamicSparseMatrix& other)
-      : Base(), m_innerSize(0)
-    {
-      *this = other.derived();
-    }
-
-    inline void swap(DynamicSparseMatrix& other)
-    {
-      //EIGEN_DBG_SPARSE(std::cout << "SparseMatrix:: swap\n");
-      std::swap(m_innerSize, other.m_innerSize);
-      //std::swap(m_outerSize, other.m_outerSize);
-      m_data.swap(other.m_data);
-    }
-
-    inline DynamicSparseMatrix& operator=(const DynamicSparseMatrix& other)
-    {
-      if (other.isRValue())
-      {
-        swap(other.const_cast_derived());
-      }
-      else
-      {
-        resize(other.rows(), other.cols());
-        m_data = other.m_data;
-      }
-      return *this;
-    }
-
-    /** Destructor */
-    inline ~DynamicSparseMatrix() {}
-
-  public:
-
-    /** \deprecated
-      * Set the matrix to zero and reserve the memory for \a reserveSize nonzero coefficients. */
-    EIGEN_DEPRECATED void startFill(Index reserveSize = 1000)
-    {
-      setZero();
-      reserve(reserveSize);
-    }
-
-    /** \deprecated use insert()
-      * inserts a nonzero coefficient at given coordinates \a row, \a col and returns its reference assuming that:
-      *  1 - the coefficient does not exist yet
-      *  2 - this the coefficient with greater inner coordinate for the given outer coordinate.
-      * In other words, assuming \c *this is column-major, then there must not exists any nonzero coefficient of coordinates
-      * \c i \c x \a col such that \c i >= \a row. Otherwise the matrix is invalid.
-      *
-      * \see fillrand(), coeffRef()
-      */
-    EIGEN_DEPRECATED Scalar& fill(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-      return insertBack(outer,inner);
-    }
-
-    /** \deprecated use insert()
-      * Like fill() but with random inner coordinates.
-      * Compared to the generic coeffRef(), the unique limitation is that we assume
-      * the coefficient does not exist yet.
-      */
-    EIGEN_DEPRECATED Scalar& fillrand(Index row, Index col)
-    {
-      return insert(row,col);
-    }
-
-    /** \deprecated use finalize()
-      * Does nothing. Provided for compatibility with SparseMatrix. */
-    EIGEN_DEPRECATED void endFill() {}
-    
-#   ifdef EIGEN_DYNAMICSPARSEMATRIX_PLUGIN
-#     include EIGEN_DYNAMICSPARSEMATRIX_PLUGIN
-#   endif
-};
-
-template<typename Scalar, int _Options, typename _Index>
-class DynamicSparseMatrix<Scalar,_Options,_Index>::InnerIterator : public SparseVector<Scalar,_Options>::InnerIterator
-{
-    typedef typename SparseVector<Scalar,_Options>::InnerIterator Base;
-  public:
-    InnerIterator(const DynamicSparseMatrix& mat, Index outer)
-      : Base(mat.m_data[outer]), m_outer(outer)
-    {}
-
-    inline Index row() const { return IsRowMajor ? m_outer : Base::index(); }
-    inline Index col() const { return IsRowMajor ? Base::index() : m_outer; }
-
-  protected:
-    const Index m_outer;
-};
-
-#endif // EIGEN_DYNAMIC_SPARSEMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/MappedSparseMatrix.h b/extern/Eigen3/Eigen/src/Sparse/MappedSparseMatrix.h
deleted file mode 100644
index 31a431f..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/MappedSparseMatrix.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_MAPPED_SPARSEMATRIX_H
-#define EIGEN_MAPPED_SPARSEMATRIX_H
-
-/** \class MappedSparseMatrix
-  *
-  * \brief Sparse matrix
-  *
-  * \param _Scalar the scalar type, i.e. the type of the coefficients
-  *
-  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
-  *
-  */
-namespace internal {
-template<typename _Scalar, int _Flags, typename _Index>
-struct traits<MappedSparseMatrix<_Scalar, _Flags, _Index> > : traits<SparseMatrix<_Scalar, _Flags, _Index> >
-{};
-}
-
-template<typename _Scalar, int _Flags, typename _Index>
-class MappedSparseMatrix
-  : public SparseMatrixBase<MappedSparseMatrix<_Scalar, _Flags, _Index> >
-{
-  public:
-    EIGEN_SPARSE_PUBLIC_INTERFACE(MappedSparseMatrix)
-
-  protected:
-    enum { IsRowMajor = Base::IsRowMajor };
-
-    Index   m_outerSize;
-    Index   m_innerSize;
-    Index   m_nnz;
-    Index*  m_outerIndex;
-    Index*  m_innerIndices;
-    Scalar* m_values;
-
-  public:
-
-    inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
-    inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
-    inline Index innerSize() const { return m_innerSize; }
-    inline Index outerSize() const { return m_outerSize; }
-    inline Index innerNonZeros(Index j) const { return m_outerIndex[j+1]-m_outerIndex[j]; }
-
-    //----------------------------------------
-    // direct access interface
-    inline const Scalar* _valuePtr() const { return m_values; }
-    inline Scalar* _valuePtr() { return m_values; }
-
-    inline const Index* _innerIndexPtr() const { return m_innerIndices; }
-    inline Index* _innerIndexPtr() { return m_innerIndices; }
-
-    inline const Index* _outerIndexPtr() const { return m_outerIndex; }
-    inline Index* _outerIndexPtr() { return m_outerIndex; }
-    //----------------------------------------
-
-    inline Scalar coeff(Index row, Index col) const
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      Index start = m_outerIndex[outer];
-      Index end = m_outerIndex[outer+1];
-      if (start==end)
-        return Scalar(0);
-      else if (end>0 && inner==m_innerIndices[end-1])
-        return m_values[end-1];
-      // ^^  optimization: let's first check if it is the last coefficient
-      // (very common in high level algorithms)
-
-      const Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner);
-      const Index id = r-&m_innerIndices[0];
-      return ((*r==inner) && (id<end)) ? m_values[id] : Scalar(0);
-    }
-
-    inline Scalar& coeffRef(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      Index start = m_outerIndex[outer];
-      Index end = m_outerIndex[outer+1];
-      eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
-      eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
-      Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end],inner);
-      const Index id = r-&m_innerIndices[0];
-      eigen_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
-      return m_values[id];
-    }
-
-    class InnerIterator;
-
-    /** \returns the number of non zero coefficients */
-    inline Index nonZeros() const  { return m_nnz; }
-
-    inline MappedSparseMatrix(Index rows, Index cols, Index nnz, Index* outerIndexPtr, Index* innerIndexPtr, Scalar* valuePtr)
-      : m_outerSize(IsRowMajor?rows:cols), m_innerSize(IsRowMajor?cols:rows), m_nnz(nnz), m_outerIndex(outerIndexPtr),
-        m_innerIndices(innerIndexPtr), m_values(valuePtr)
-    {}
-
-    /** Empty destructor */
-    inline ~MappedSparseMatrix() {}
-};
-
-template<typename Scalar, int _Flags, typename _Index>
-class MappedSparseMatrix<Scalar,_Flags,_Index>::InnerIterator
-{
-  public:
-    InnerIterator(const MappedSparseMatrix& mat, Index outer)
-      : m_matrix(mat),
-        m_outer(outer),
-        m_id(mat._outerIndexPtr()[outer]),
-        m_start(m_id),
-        m_end(mat._outerIndexPtr()[outer+1])
-    {}
-
-    template<unsigned int Added, unsigned int Removed>
-    InnerIterator(const Flagged<MappedSparseMatrix,Added,Removed>& mat, Index outer)
-      : m_matrix(mat._expression()), m_id(m_matrix._outerIndexPtr()[outer]),
-        m_start(m_id), m_end(m_matrix._outerIndexPtr()[outer+1])
-    {}
-
-    inline InnerIterator& operator++() { m_id++; return *this; }
-
-    inline Scalar value() const { return m_matrix._valuePtr()[m_id]; }
-    inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix._valuePtr()[m_id]); }
-
-    inline Index index() const { return m_matrix._innerIndexPtr()[m_id]; }
-    inline Index row() const { return IsRowMajor ? m_outer : index(); }
-    inline Index col() const { return IsRowMajor ? index() : m_outer; }
-
-    inline operator bool() const { return (m_id < m_end) && (m_id>=m_start); }
-
-  protected:
-    const MappedSparseMatrix& m_matrix;
-    const Index m_outer;
-    Index m_id;
-    const Index m_start;
-    const Index m_end;
-};
-
-#endif // EIGEN_MAPPED_SPARSEMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseBlock.h b/extern/Eigen3/Eigen/src/Sparse/SparseBlock.h
deleted file mode 100644
index 8079c99..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseBlock.h
+++ /dev/null
@@ -1,465 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_BLOCK_H
-#define EIGEN_SPARSE_BLOCK_H
-
-namespace internal {
-template<typename MatrixType, int Size>
-struct traits<SparseInnerVectorSet<MatrixType, Size> >
-{
-  typedef typename traits<MatrixType>::Scalar Scalar;
-  typedef typename traits<MatrixType>::Index Index;
-  typedef typename traits<MatrixType>::StorageKind StorageKind;
-  typedef MatrixXpr XprKind;
-  enum {
-    IsRowMajor = (int(MatrixType::Flags)&RowMajorBit)==RowMajorBit,
-    Flags = MatrixType::Flags,
-    RowsAtCompileTime = IsRowMajor ? Size : MatrixType::RowsAtCompileTime,
-    ColsAtCompileTime = IsRowMajor ? MatrixType::ColsAtCompileTime : Size,
-    MaxRowsAtCompileTime = RowsAtCompileTime,
-    MaxColsAtCompileTime = ColsAtCompileTime,
-    CoeffReadCost = MatrixType::CoeffReadCost
-  };
-};
-} // end namespace internal
-
-template<typename MatrixType, int Size>
-class SparseInnerVectorSet : internal::no_assignment_operator,
-  public SparseMatrixBase<SparseInnerVectorSet<MatrixType, Size> >
-{
-  public:
-
-    enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
-
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
-    class InnerIterator: public MatrixType::InnerIterator
-    {
-      public:
-        inline InnerIterator(const SparseInnerVectorSet& xpr, Index outer)
-          : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
-        {}
-        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
-        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
-      protected:
-        Index m_outer;
-    };
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
-      : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
-    {
-      eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
-    }
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
-      : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
-    {
-      eigen_assert(Size!=Dynamic);
-      eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
-    }
-
-//     template<typename OtherDerived>
-//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-//     {
-//       return *this;
-//     }
-
-//     template<typename Sparse>
-//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-//     {
-//       return *this;
-//     }
-
-    EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
-
-  protected:
-
-    const typename MatrixType::Nested m_matrix;
-    Index m_outerStart;
-    const internal::variable_if_dynamic<Index, Size> m_outerSize;
-};
-
-/***************************************************************************
-* specialisation for DynamicSparseMatrix
-***************************************************************************/
-
-template<typename _Scalar, int _Options, int Size>
-class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
-  : public SparseMatrixBase<SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size> >
-{
-    typedef DynamicSparseMatrix<_Scalar, _Options> MatrixType;
-  public:
-
-    enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
-
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
-    class InnerIterator: public MatrixType::InnerIterator
-    {
-      public:
-        inline InnerIterator(const SparseInnerVectorSet& xpr, Index outer)
-          : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
-        {}
-        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
-        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
-      protected:
-        Index m_outer;
-    };
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
-      : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
-    {
-      eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
-    }
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
-      : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
-    {
-      eigen_assert(Size!=Dynamic);
-      eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
-    }
-
-    template<typename OtherDerived>
-    inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-    {
-      if (IsRowMajor != ((OtherDerived::Flags&RowMajorBit)==RowMajorBit))
-      {
-        // need to transpose => perform a block evaluation followed by a big swap
-        DynamicSparseMatrix<Scalar,IsRowMajor?RowMajorBit:0> aux(other);
-        *this = aux.markAsRValue();
-      }
-      else
-      {
-        // evaluate/copy vector per vector
-        for (Index j=0; j<m_outerSize.value(); ++j)
-        {
-          SparseVector<Scalar,IsRowMajor ? RowMajorBit : 0> aux(other.innerVector(j));
-          m_matrix.const_cast_derived()._data()[m_outerStart+j].swap(aux._data());
-        }
-      }
-      return *this;
-    }
-
-    inline SparseInnerVectorSet& operator=(const SparseInnerVectorSet& other)
-    {
-      return operator=<SparseInnerVectorSet>(other);
-    }
-
-    Index nonZeros() const
-    {
-      Index count = 0;
-      for (Index j=0; j<m_outerSize.value(); ++j)
-        count += m_matrix._data()[m_outerStart+j].size();
-      return count;
-    }
-
-    const Scalar& lastCoeff() const
-    {
-      EIGEN_STATIC_ASSERT_VECTOR_ONLY(SparseInnerVectorSet);
-      eigen_assert(m_matrix.data()[m_outerStart].size()>0);
-      return m_matrix.data()[m_outerStart].vale(m_matrix.data()[m_outerStart].size()-1);
-    }
-
-//     template<typename Sparse>
-//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-//     {
-//       return *this;
-//     }
-
-    EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
-
-  protected:
-
-    const typename MatrixType::Nested m_matrix;
-    Index m_outerStart;
-    const internal::variable_if_dynamic<Index, Size> m_outerSize;
-
-};
-
-
-/***************************************************************************
-* specialisation for SparseMatrix
-***************************************************************************/
-
-template<typename _Scalar, int _Options, typename _Index, int Size>
-class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
-  : public SparseMatrixBase<SparseInnerVectorSet<SparseMatrix<_Scalar, _Options>, Size> >
-{
-    typedef SparseMatrix<_Scalar, _Options> MatrixType;
-  public:
-
-    enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
-
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
-    class InnerIterator: public MatrixType::InnerIterator
-    {
-      public:
-        inline InnerIterator(const SparseInnerVectorSet& xpr, Index outer)
-          : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
-        {}
-        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
-        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
-      protected:
-        Index m_outer;
-    };
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
-      : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
-    {
-      eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
-    }
-
-    inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
-      : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
-    {
-      eigen_assert(Size==1);
-      eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
-    }
-
-    template<typename OtherDerived>
-    inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-    {
-      typedef typename internal::remove_all<typename MatrixType::Nested>::type _NestedMatrixType;
-      _NestedMatrixType& matrix = const_cast<_NestedMatrixType&>(m_matrix);;
-      // This assignement is slow if this vector set not empty
-      // and/or it is not at the end of the nonzeros of the underlying matrix.
-
-      // 1 - eval to a temporary to avoid transposition and/or aliasing issues
-      SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, Index> tmp(other);
-
-      // 2 - let's check whether there is enough allocated memory
-      Index nnz = tmp.nonZeros();
-      Index nnz_previous = nonZeros();
-      Index free_size = matrix.data().allocatedSize() - nnz_previous;
-      std::size_t nnz_head = m_outerStart==0 ? 0 : matrix._outerIndexPtr()[m_outerStart];
-      std::size_t tail = m_matrix._outerIndexPtr()[m_outerStart+m_outerSize.value()];
-      std::size_t nnz_tail = matrix.nonZeros() - tail;
-
-      if(nnz>free_size)
-      {
-        // realloc manually to reduce copies
-        typename MatrixType::Storage newdata(m_matrix.nonZeros() - nnz_previous + nnz);
-
-        std::memcpy(&newdata.value(0), &m_matrix.data().value(0), nnz_head*sizeof(Scalar));
-        std::memcpy(&newdata.index(0), &m_matrix.data().index(0), nnz_head*sizeof(Index));
-
-        std::memcpy(&newdata.value(nnz_head), &tmp.data().value(0), nnz*sizeof(Scalar));
-        std::memcpy(&newdata.index(nnz_head), &tmp.data().index(0), nnz*sizeof(Index));
-
-        std::memcpy(&newdata.value(nnz_head+nnz), &matrix.data().value(tail), nnz_tail*sizeof(Scalar));
-        std::memcpy(&newdata.index(nnz_head+nnz), &matrix.data().index(tail), nnz_tail*sizeof(Index));
-
-        matrix.data().swap(newdata);
-      }
-      else
-      {
-        // no need to realloc, simply copy the tail at its respective position and insert tmp
-        matrix.data().resize(nnz_head + nnz + nnz_tail);
-
-        if(nnz<nnz_previous)
-        {
-          std::memcpy(&matrix.data().value(nnz_head+nnz), &matrix.data().value(tail), nnz_tail*sizeof(Scalar));
-          std::memcpy(&matrix.data().index(nnz_head+nnz), &matrix.data().index(tail), nnz_tail*sizeof(Index));
-        }
-        else
-        {
-          for(Index i=nnz_tail-1; i>=0; --i)
-          {
-            matrix.data().value(nnz_head+nnz+i) = matrix.data().value(tail+i);
-            matrix.data().index(nnz_head+nnz+i) = matrix.data().index(tail+i);
-          }
-        }
-
-        std::memcpy(&matrix.data().value(nnz_head), &tmp.data().value(0), nnz*sizeof(Scalar));
-        std::memcpy(&matrix.data().index(nnz_head), &tmp.data().index(0), nnz*sizeof(Index));
-      }
-
-      // update outer index pointers
-      Index p = nnz_head;
-      for(Index k=1; k<m_outerSize.value(); ++k)
-      {
-        matrix._outerIndexPtr()[m_outerStart+k] = p;
-        p += tmp.innerVector(k).nonZeros();
-      }
-      std::ptrdiff_t offset = nnz - nnz_previous;
-      for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
-      {
-        matrix._outerIndexPtr()[k] += offset;
-      }
-
-      return *this;
-    }
-
-    inline SparseInnerVectorSet& operator=(const SparseInnerVectorSet& other)
-    {
-      return operator=<SparseInnerVectorSet>(other);
-    }
-
-    inline const Scalar* _valuePtr() const
-    { return m_matrix._valuePtr() + m_matrix._outerIndexPtr()[m_outerStart]; }
-    inline Scalar* _valuePtr()
-    { return m_matrix.const_cast_derived()._valuePtr() + m_matrix._outerIndexPtr()[m_outerStart]; }
-
-    inline const Index* _innerIndexPtr() const
-    { return m_matrix._innerIndexPtr() + m_matrix._outerIndexPtr()[m_outerStart]; }
-    inline Index* _innerIndexPtr()
-    { return m_matrix.const_cast_derived()._innerIndexPtr() + m_matrix._outerIndexPtr()[m_outerStart]; }
-
-    inline const Index* _outerIndexPtr() const
-    { return m_matrix._outerIndexPtr() + m_outerStart; }
-    inline Index* _outerIndexPtr()
-    { return m_matrix.const_cast_derived()._outerIndexPtr() + m_outerStart; }
-
-    Index nonZeros() const
-    {
-      return  std::size_t(m_matrix._outerIndexPtr()[m_outerStart+m_outerSize.value()])
-            - std::size_t(m_matrix._outerIndexPtr()[m_outerStart]);
-    }
-
-    const Scalar& lastCoeff() const
-    {
-      EIGEN_STATIC_ASSERT_VECTOR_ONLY(SparseInnerVectorSet);
-      eigen_assert(nonZeros()>0);
-      return m_matrix._valuePtr()[m_matrix._outerIndexPtr()[m_outerStart+1]-1];
-    }
-
-//     template<typename Sparse>
-//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
-//     {
-//       return *this;
-//     }
-
-    EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
-
-  protected:
-
-    const typename MatrixType::Nested m_matrix;
-    Index m_outerStart;
-    const internal::variable_if_dynamic<Index, Size> m_outerSize;
-
-};
-
-//----------
-
-/** \returns the i-th row of the matrix \c *this. For row-major matrix only. */
-template<typename Derived>
-SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::row(Index i)
-{
-  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
-  return innerVector(i);
-}
-
-/** \returns the i-th row of the matrix \c *this. For row-major matrix only.
-  * (read-only version) */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::row(Index i) const
-{
-  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
-  return innerVector(i);
-}
-
-/** \returns the i-th column of the matrix \c *this. For column-major matrix only. */
-template<typename Derived>
-SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::col(Index i)
-{
-  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
-  return innerVector(i);
-}
-
-/** \returns the i-th column of the matrix \c *this. For column-major matrix only.
-  * (read-only version) */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::col(Index i) const
-{
-  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
-  return innerVector(i);
-}
-
-/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
-  * is col-major (resp. row-major).
-  */
-template<typename Derived>
-SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::innerVector(Index outer)
-{ return SparseInnerVectorSet<Derived,1>(derived(), outer); }
-
-/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
-  * is col-major (resp. row-major). Read-only.
-  */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::innerVector(Index outer) const
-{ return SparseInnerVectorSet<Derived,1>(derived(), outer); }
-
-//----------
-
-/** \returns the i-th row of the matrix \c *this. For row-major matrix only. */
-template<typename Derived>
-SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::subrows(Index start, Index size)
-{
-  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
-  return innerVectors(start, size);
-}
-
-/** \returns the i-th row of the matrix \c *this. For row-major matrix only.
-  * (read-only version) */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::subrows(Index start, Index size) const
-{
-  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
-  return innerVectors(start, size);
-}
-
-/** \returns the i-th column of the matrix \c *this. For column-major matrix only. */
-template<typename Derived>
-SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::subcols(Index start, Index size)
-{
-  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
-  return innerVectors(start, size);
-}
-
-/** \returns the i-th column of the matrix \c *this. For column-major matrix only.
-  * (read-only version) */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::subcols(Index start, Index size) const
-{
-  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
-  return innerVectors(start, size);
-}
-
-/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
-  * is col-major (resp. row-major).
-  */
-template<typename Derived>
-SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
-{ return SparseInnerVectorSet<Derived,Dynamic>(derived(), outerStart, outerSize); }
-
-/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
-  * is col-major (resp. row-major). Read-only.
-  */
-template<typename Derived>
-const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
-{ return SparseInnerVectorSet<Derived,Dynamic>(derived(), outerStart, outerSize); }
-
-#endif // EIGEN_SPARSE_BLOCK_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseCwiseBinaryOp.h b/extern/Eigen3/Eigen/src/Sparse/SparseCwiseBinaryOp.h
deleted file mode 100644
index cde5bbc..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseCwiseBinaryOp.h
+++ /dev/null
@@ -1,375 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H
-#define EIGEN_SPARSE_CWISE_BINARY_OP_H
-
-// Here we have to handle 3 cases:
-//  1 - sparse op dense
-//  2 - dense op sparse
-//  3 - sparse op sparse
-// We also need to implement a 4th iterator for:
-//  4 - dense op dense
-// Finally, we also need to distinguish between the product and other operations :
-//                configuration      returned mode
-//  1 - sparse op dense    product      sparse
-//                         generic      dense
-//  2 - dense op sparse    product      sparse
-//                         generic      dense
-//  3 - sparse op sparse   product      sparse
-//                         generic      sparse
-//  4 - dense op dense     product      dense
-//                         generic      dense
-
-namespace internal {
-
-template<> struct promote_storage_type<Dense,Sparse>
-{ typedef Sparse ret; };
-
-template<> struct promote_storage_type<Sparse,Dense>
-{ typedef Sparse ret; };
-
-template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
-  typename _LhsStorageMode = typename traits<Lhs>::StorageKind,
-  typename _RhsStorageMode = typename traits<Rhs>::StorageKind>
-class sparse_cwise_binary_op_inner_iterator_selector;
-
-} // end namespace internal
-
-template<typename BinaryOp, typename Lhs, typename Rhs>
-class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
-  : public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
-{
-  public:
-    class InnerIterator;
-    typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
-    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
-};
-
-template<typename BinaryOp, typename Lhs, typename Rhs>
-class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
-  : public internal::sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator>
-{
-  public:
-    typedef typename Lhs::Index Index;
-    typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
-      BinaryOp,Lhs,Rhs, InnerIterator> Base;
-
-    EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, Index outer)
-      : Base(binOp.derived(),outer)
-    {}
-};
-
-/***************************************************************************
-* Implementation of inner-iterators
-***************************************************************************/
-
-// template<typename T> struct internal::func_is_conjunction { enum { ret = false }; };
-// template<typename T> struct internal::func_is_conjunction<internal::scalar_product_op<T> > { enum { ret = true }; };
-
-// TODO generalize the internal::scalar_product_op specialization to all conjunctions if any !
-
-namespace internal {
-
-// sparse - sparse  (generic)
-template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived>
-class sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, Sparse, Sparse>
-{
-    typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr;
-    typedef typename traits<CwiseBinaryXpr>::Scalar Scalar;
-    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
-    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
-    typedef typename _LhsNested::InnerIterator LhsIterator;
-    typedef typename _RhsNested::InnerIterator RhsIterator;
-    typedef typename Lhs::Index Index;
-
-  public:
-
-    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
-      : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
-    {
-      this->operator++();
-    }
-
-    EIGEN_STRONG_INLINE Derived& operator++()
-    {
-      if (m_lhsIter && m_rhsIter && (m_lhsIter.index() == m_rhsIter.index()))
-      {
-        m_id = m_lhsIter.index();
-        m_value = m_functor(m_lhsIter.value(), m_rhsIter.value());
-        ++m_lhsIter;
-        ++m_rhsIter;
-      }
-      else if (m_lhsIter && (!m_rhsIter || (m_lhsIter.index() < m_rhsIter.index())))
-      {
-        m_id = m_lhsIter.index();
-        m_value = m_functor(m_lhsIter.value(), Scalar(0));
-        ++m_lhsIter;
-      }
-      else if (m_rhsIter && (!m_lhsIter || (m_lhsIter.index() > m_rhsIter.index())))
-      {
-        m_id = m_rhsIter.index();
-        m_value = m_functor(Scalar(0), m_rhsIter.value());
-        ++m_rhsIter;
-      }
-      else
-      {
-        m_value = 0; // this is to avoid a compilation warning
-        m_id = -1;
-      }
-      return *static_cast<Derived*>(this);
-    }
-
-    EIGEN_STRONG_INLINE Scalar value() const { return m_value; }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_id; }
-    EIGEN_STRONG_INLINE Index row() const { return Lhs::IsRowMajor ? m_lhsIter.row() : index(); }
-    EIGEN_STRONG_INLINE Index col() const { return Lhs::IsRowMajor ? index() : m_lhsIter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_id>=0; }
-
-  protected:
-    LhsIterator m_lhsIter;
-    RhsIterator m_rhsIter;
-    const BinaryOp& m_functor;
-    Scalar m_value;
-    Index m_id;
-};
-
-// sparse - sparse  (product)
-template<typename T, typename Lhs, typename Rhs, typename Derived>
-class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Sparse>
-{
-    typedef scalar_product_op<T> BinaryFunc;
-    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
-    typedef typename CwiseBinaryXpr::Scalar Scalar;
-    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
-    typedef typename _LhsNested::InnerIterator LhsIterator;
-    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
-    typedef typename _RhsNested::InnerIterator RhsIterator;
-    typedef typename Lhs::Index Index;
-  public:
-
-    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
-      : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
-    {
-      while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
-      {
-        if (m_lhsIter.index() < m_rhsIter.index())
-          ++m_lhsIter;
-        else
-          ++m_rhsIter;
-      }
-    }
-
-    EIGEN_STRONG_INLINE Derived& operator++()
-    {
-      ++m_lhsIter;
-      ++m_rhsIter;
-      while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
-      {
-        if (m_lhsIter.index() < m_rhsIter.index())
-          ++m_lhsIter;
-        else
-          ++m_rhsIter;
-      }
-      return *static_cast<Derived*>(this);
-    }
-
-    EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsIter.value(), m_rhsIter.value()); }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); }
-    EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); }
-    EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return (m_lhsIter && m_rhsIter); }
-
-  protected:
-    LhsIterator m_lhsIter;
-    RhsIterator m_rhsIter;
-    const BinaryFunc& m_functor;
-};
-
-// sparse - dense  (product)
-template<typename T, typename Lhs, typename Rhs, typename Derived>
-class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Dense>
-{
-    typedef scalar_product_op<T> BinaryFunc;
-    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
-    typedef typename CwiseBinaryXpr::Scalar Scalar;
-    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
-    typedef typename traits<CwiseBinaryXpr>::RhsNested RhsNested;
-    typedef typename _LhsNested::InnerIterator LhsIterator;
-    typedef typename Lhs::Index Index;
-    enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit };
-  public:
-
-    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
-      : m_rhs(xpr.rhs()), m_lhsIter(xpr.lhs(),outer), m_functor(xpr.functor()), m_outer(outer)
-    {}
-
-    EIGEN_STRONG_INLINE Derived& operator++()
-    {
-      ++m_lhsIter;
-      return *static_cast<Derived*>(this);
-    }
-
-    EIGEN_STRONG_INLINE Scalar value() const
-    { return m_functor(m_lhsIter.value(),
-                       m_rhs.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); }
-    EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); }
-    EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; }
-
-  protected:
-    const RhsNested m_rhs;
-    LhsIterator m_lhsIter;
-    const BinaryFunc m_functor;
-    const Index m_outer;
-};
-
-// sparse - dense  (product)
-template<typename T, typename Lhs, typename Rhs, typename Derived>
-class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Dense, Sparse>
-{
-    typedef scalar_product_op<T> BinaryFunc;
-    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
-    typedef typename CwiseBinaryXpr::Scalar Scalar;
-    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
-    typedef typename _RhsNested::InnerIterator RhsIterator;
-    typedef typename Lhs::Index Index;
-
-    enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit };
-  public:
-
-    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
-      : m_xpr(xpr), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()), m_outer(outer)
-    {}
-
-    EIGEN_STRONG_INLINE Derived& operator++()
-    {
-      ++m_rhsIter;
-      return *static_cast<Derived*>(this);
-    }
-
-    EIGEN_STRONG_INLINE Scalar value() const
-    { return m_functor(m_xpr.lhs().coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_rhsIter.index(); }
-    EIGEN_STRONG_INLINE Index row() const { return m_rhsIter.row(); }
-    EIGEN_STRONG_INLINE Index col() const { return m_rhsIter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_rhsIter; }
-
-  protected:
-    const CwiseBinaryXpr& m_xpr;
-    RhsIterator m_rhsIter;
-    const BinaryFunc& m_functor;
-    const Index m_outer;
-};
-
-} // end namespace internal
-
-/***************************************************************************
-* Implementation of SparseMatrixBase and SparseCwise functions/operators
-***************************************************************************/
-
-// template<typename Derived>
-// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_difference_op<typename internal::traits<Derived>::Scalar>,
-//                                  Derived, OtherDerived>
-// SparseMatrixBase<Derived>::operator-(const SparseMatrixBase<OtherDerived> &other) const
-// {
-//   return CwiseBinaryOp<internal::scalar_difference_op<Scalar>,
-//                        Derived, OtherDerived>(derived(), other.derived());
-// }
-
-template<typename Derived>
-template<typename OtherDerived>
-EIGEN_STRONG_INLINE Derived &
-SparseMatrixBase<Derived>::operator-=(const SparseMatrixBase<OtherDerived> &other)
-{
-  return *this = derived() - other.derived();
-}
-
-// template<typename Derived>
-// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
-// SparseMatrixBase<Derived>::operator+(const SparseMatrixBase<OtherDerived> &other) const
-// {
-//   return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
-// }
-
-template<typename Derived>
-template<typename OtherDerived>
-EIGEN_STRONG_INLINE Derived &
-SparseMatrixBase<Derived>::operator+=(const SparseMatrixBase<OtherDerived>& other)
-{
-  return *this = derived() + other.derived();
-}
-
-// template<typename ExpressionType>
-// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
-// SparseCwise<ExpressionType>::operator*(const SparseMatrixBase<OtherDerived> &other) const
-// {
-//   return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
-// }
-
-template<typename Derived>
-template<typename OtherDerived>
-EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
-SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
-{
-  return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(derived(), other.derived());
-}
-
-// template<typename ExpressionType>
-// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
-// SparseCwise<ExpressionType>::operator/(const SparseMatrixBase<OtherDerived> &other) const
-// {
-//   return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
-// }
-//
-// template<typename ExpressionType>
-// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
-// SparseCwise<ExpressionType>::operator/(const MatrixBase<OtherDerived> &other) const
-// {
-//   return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
-// }
-
-// template<typename ExpressionType>
-// template<typename OtherDerived>
-// inline ExpressionType& SparseCwise<ExpressionType>::operator*=(const SparseMatrixBase<OtherDerived> &other)
-// {
-//   return m_matrix.const_cast_derived() = _expression() * other.derived();
-// }
-
-
-#endif // EIGEN_SPARSE_CWISE_BINARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseCwiseUnaryOp.h b/extern/Eigen3/Eigen/src/Sparse/SparseCwiseUnaryOp.h
deleted file mode 100644
index aa06883..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseCwiseUnaryOp.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_CWISE_UNARY_OP_H
-#define EIGEN_SPARSE_CWISE_UNARY_OP_H
-
-// template<typename UnaryOp, typename MatrixType>
-// struct internal::traits<SparseCwiseUnaryOp<UnaryOp, MatrixType> > : internal::traits<MatrixType>
-// {
-//   typedef typename internal::result_of<
-//                      UnaryOp(typename MatrixType::Scalar)
-//                    >::type Scalar;
-//   typedef typename MatrixType::Nested MatrixTypeNested;
-//   typedef typename internal::remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
-//   enum {
-//     CoeffReadCost = _MatrixTypeNested::CoeffReadCost + internal::functor_traits<UnaryOp>::Cost
-//   };
-// };
-
-template<typename UnaryOp, typename MatrixType>
-class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>
-  : public SparseMatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
-{
-  public:
-
-    class InnerIterator;
-//     typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
-
-    typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
-    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
-};
-
-template<typename UnaryOp, typename MatrixType>
-class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
-{
-    typedef typename CwiseUnaryOpImpl::Scalar Scalar;
-    typedef typename internal::traits<Derived>::_XprTypeNested _MatrixTypeNested;
-    typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
-    typedef typename MatrixType::Index Index;
-  public:
-
-    EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryOpImpl& unaryOp, Index outer)
-      : m_iter(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
-    {}
-
-    EIGEN_STRONG_INLINE InnerIterator& operator++()
-    { ++m_iter; return *this; }
-
-    EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_iter.value()); }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); }
-    EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); }
-    EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_iter; }
-
-  protected:
-    MatrixTypeIterator m_iter;
-    const UnaryOp m_functor;
-};
-
-template<typename ViewOp, typename MatrixType>
-class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>
-  : public SparseMatrixBase<CwiseUnaryView<ViewOp, MatrixType> >
-{
-  public:
-
-    class InnerIterator;
-//     typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
-
-    typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
-    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
-};
-
-template<typename ViewOp, typename MatrixType>
-class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
-{
-    typedef typename CwiseUnaryViewImpl::Scalar Scalar;
-    typedef typename internal::traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
-    typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
-    typedef typename MatrixType::Index Index;
-  public:
-
-    EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryViewImpl& unaryView, Index outer)
-      : m_iter(unaryView.derived().nestedExpression(),outer), m_functor(unaryView.derived().functor())
-    {}
-
-    EIGEN_STRONG_INLINE InnerIterator& operator++()
-    { ++m_iter; return *this; }
-
-    EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_iter.value()); }
-    EIGEN_STRONG_INLINE Scalar& valueRef() { return m_functor(m_iter.valueRef()); }
-
-    EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); }
-    EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); }
-    EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const { return m_iter; }
-
-  protected:
-    MatrixTypeIterator m_iter;
-    const ViewOp m_functor;
-};
-
-template<typename Derived>
-EIGEN_STRONG_INLINE Derived&
-SparseMatrixBase<Derived>::operator*=(const Scalar& other)
-{
-  for (Index j=0; j<outerSize(); ++j)
-    for (typename Derived::InnerIterator i(derived(),j); i; ++i)
-      i.valueRef() *= other;
-  return derived();
-}
-
-template<typename Derived>
-EIGEN_STRONG_INLINE Derived&
-SparseMatrixBase<Derived>::operator/=(const Scalar& other)
-{
-  for (Index j=0; j<outerSize(); ++j)
-    for (typename Derived::InnerIterator i(derived(),j); i; ++i)
-      i.valueRef() /= other;
-  return derived();
-}
-
-#endif // EIGEN_SPARSE_CWISE_UNARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseDenseProduct.h b/extern/Eigen3/Eigen/src/Sparse/SparseDenseProduct.h
deleted file mode 100644
index 0f77aa5..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseDenseProduct.h
+++ /dev/null
@@ -1,231 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEDENSEPRODUCT_H
-#define EIGEN_SPARSEDENSEPRODUCT_H
-
-template<typename Lhs, typename Rhs, int InnerSize> struct SparseDenseProductReturnType
-{
-  typedef SparseTimeDenseProduct<Lhs,Rhs> Type;
-};
-
-template<typename Lhs, typename Rhs> struct SparseDenseProductReturnType<Lhs,Rhs,1>
-{
-  typedef SparseDenseOuterProduct<Lhs,Rhs,false> Type;
-};
-
-template<typename Lhs, typename Rhs, int InnerSize> struct DenseSparseProductReturnType
-{
-  typedef DenseTimeSparseProduct<Lhs,Rhs> Type;
-};
-
-template<typename Lhs, typename Rhs> struct DenseSparseProductReturnType<Lhs,Rhs,1>
-{
-  typedef SparseDenseOuterProduct<Rhs,Lhs,true> Type;
-};
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, bool Tr>
-struct traits<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
-{
-  typedef Sparse StorageKind;
-  typedef typename scalar_product_traits<typename traits<Lhs>::Scalar,
-                                            typename traits<Rhs>::Scalar>::ReturnType Scalar;
-  typedef typename Lhs::Index Index;
-  typedef typename Lhs::Nested LhsNested;
-  typedef typename Rhs::Nested RhsNested;
-  typedef typename remove_all<LhsNested>::type _LhsNested;
-  typedef typename remove_all<RhsNested>::type _RhsNested;
-
-  enum {
-    LhsCoeffReadCost = traits<_LhsNested>::CoeffReadCost,
-    RhsCoeffReadCost = traits<_RhsNested>::CoeffReadCost,
-
-    RowsAtCompileTime    = Tr ? int(traits<Rhs>::RowsAtCompileTime)     : int(traits<Lhs>::RowsAtCompileTime),
-    ColsAtCompileTime    = Tr ? int(traits<Lhs>::ColsAtCompileTime)     : int(traits<Rhs>::ColsAtCompileTime),
-    MaxRowsAtCompileTime = Tr ? int(traits<Rhs>::MaxRowsAtCompileTime)  : int(traits<Lhs>::MaxRowsAtCompileTime),
-    MaxColsAtCompileTime = Tr ? int(traits<Lhs>::MaxColsAtCompileTime)  : int(traits<Rhs>::MaxColsAtCompileTime),
-
-    Flags = Tr ? RowMajorBit : 0,
-
-    CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + NumTraits<Scalar>::MulCost
-  };
-};
-
-} // end namespace internal
-
-template<typename Lhs, typename Rhs, bool Tr>
-class SparseDenseOuterProduct
- : public SparseMatrixBase<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
-{
-  public:
-
-    typedef SparseMatrixBase<SparseDenseOuterProduct> Base;
-    EIGEN_DENSE_PUBLIC_INTERFACE(SparseDenseOuterProduct)
-    typedef internal::traits<SparseDenseOuterProduct> Traits;
-
-  private:
-
-    typedef typename Traits::LhsNested LhsNested;
-    typedef typename Traits::RhsNested RhsNested;
-    typedef typename Traits::_LhsNested _LhsNested;
-    typedef typename Traits::_RhsNested _RhsNested;
-
-  public:
-
-    class InnerIterator;
-
-    EIGEN_STRONG_INLINE SparseDenseOuterProduct(const Lhs& lhs, const Rhs& rhs)
-      : m_lhs(lhs), m_rhs(rhs)
-    {
-      EIGEN_STATIC_ASSERT(!Tr,YOU_MADE_A_PROGRAMMING_MISTAKE);
-    }
-
-    EIGEN_STRONG_INLINE SparseDenseOuterProduct(const Rhs& rhs, const Lhs& lhs)
-      : m_lhs(lhs), m_rhs(rhs)
-    {
-      EIGEN_STATIC_ASSERT(Tr,YOU_MADE_A_PROGRAMMING_MISTAKE);
-    }
-
-    EIGEN_STRONG_INLINE Index rows() const { return Tr ? m_rhs.rows() : m_lhs.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return Tr ? m_lhs.cols() : m_rhs.cols(); }
-
-    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
-    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
-
-  protected:
-    LhsNested m_lhs;
-    RhsNested m_rhs;
-};
-
-template<typename Lhs, typename Rhs, bool Transpose>
-class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNested::InnerIterator
-{
-    typedef typename _LhsNested::InnerIterator Base;
-  public:
-    EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
-      : Base(prod.lhs(), 0), m_outer(outer), m_factor(prod.rhs().coeff(outer))
-    {
-    }
-
-    inline Index outer() const { return m_outer; }
-    inline Index row() const { return Transpose ? Base::row() : m_outer; }
-    inline Index col() const { return Transpose ? m_outer : Base::row(); }
-
-    inline Scalar value() const { return Base::value() * m_factor; }
-
-  protected:
-    int m_outer;
-    Scalar m_factor;
-};
-
-namespace internal {
-template<typename Lhs, typename Rhs>
-struct traits<SparseTimeDenseProduct<Lhs,Rhs> >
- : traits<ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs> >
-{
-  typedef Dense StorageKind;
-  typedef MatrixXpr XprKind;
-};
-} // end namespace internal
-
-template<typename Lhs, typename Rhs>
-class SparseTimeDenseProduct
-  : public ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs>
-{
-  public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(SparseTimeDenseProduct)
-
-    SparseTimeDenseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
-    {}
-
-    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
-    {
-      typedef typename internal::remove_all<Lhs>::type _Lhs;
-      typedef typename internal::remove_all<Rhs>::type _Rhs;
-      typedef typename _Lhs::InnerIterator LhsInnerIterator;
-      enum { LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit };
-      for(Index j=0; j<m_lhs.outerSize(); ++j)
-      {
-        typename Rhs::Scalar rhs_j = alpha * m_rhs.coeff(LhsIsRowMajor ? 0 : j,0);
-        typename Dest::RowXpr dest_j(dest.row(LhsIsRowMajor ? j : 0));
-        for(LhsInnerIterator it(m_lhs,j); it ;++it)
-        {
-          if(LhsIsRowMajor)                   dest_j += (alpha*it.value()) * m_rhs.row(it.index());
-          else if(Rhs::ColsAtCompileTime==1)  dest.coeffRef(it.index()) += it.value() * rhs_j;
-          else                                dest.row(it.index()) += (alpha*it.value()) * m_rhs.row(j);
-        }
-      }
-    }
-
-  private:
-    SparseTimeDenseProduct& operator=(const SparseTimeDenseProduct&);
-};
-
-
-// dense = dense * sparse
-namespace internal {
-template<typename Lhs, typename Rhs>
-struct traits<DenseTimeSparseProduct<Lhs,Rhs> >
- : traits<ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs> >
-{
-  typedef Dense StorageKind;
-};
-} // end namespace internal
-
-template<typename Lhs, typename Rhs>
-class DenseTimeSparseProduct
-  : public ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs>
-{
-  public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(DenseTimeSparseProduct)
-
-    DenseTimeSparseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
-    {}
-
-    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
-    {
-      typedef typename internal::remove_all<Rhs>::type _Rhs;
-      typedef typename _Rhs::InnerIterator RhsInnerIterator;
-      enum { RhsIsRowMajor = (_Rhs::Flags&RowMajorBit)==RowMajorBit };
-      for(Index j=0; j<m_rhs.outerSize(); ++j)
-        for(RhsInnerIterator i(m_rhs,j); i; ++i)
-          dest.col(RhsIsRowMajor ? i.index() : j) += (alpha*i.value()) * m_lhs.col(RhsIsRowMajor ? j : i.index());
-    }
-
-  private:
-    DenseTimeSparseProduct& operator=(const DenseTimeSparseProduct&);
-};
-
-// sparse * dense
-template<typename Derived>
-template<typename OtherDerived>
-inline const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
-SparseMatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
-{
-  return typename SparseDenseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
-}
-
-#endif // EIGEN_SPARSEDENSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseDiagonalProduct.h b/extern/Eigen3/Eigen/src/Sparse/SparseDiagonalProduct.h
deleted file mode 100644
index fb9a29c..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseDiagonalProduct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_DIAGONAL_PRODUCT_H
-#define EIGEN_SPARSE_DIAGONAL_PRODUCT_H
-
-// The product of a diagonal matrix with a sparse matrix can be easily
-// implemented using expression template.
-// We have two consider very different cases:
-// 1 - diag * row-major sparse
-//     => each inner vector <=> scalar * sparse vector product
-//     => so we can reuse CwiseUnaryOp::InnerIterator
-// 2 - diag * col-major sparse
-//     => each inner vector <=> densevector * sparse vector cwise product
-//     => again, we can reuse specialization of CwiseBinaryOp::InnerIterator
-//        for that particular case
-// The two other cases are symmetric.
-
-namespace internal {
-
-template<typename Lhs, typename Rhs>
-struct traits<SparseDiagonalProduct<Lhs, Rhs> >
-{
-  typedef typename remove_all<Lhs>::type _Lhs;
-  typedef typename remove_all<Rhs>::type _Rhs;
-  typedef typename _Lhs::Scalar Scalar;
-  typedef typename promote_index_type<typename traits<Lhs>::Index,
-                                         typename traits<Rhs>::Index>::type Index;
-  typedef Sparse StorageKind;
-  typedef MatrixXpr XprKind;
-  enum {
-    RowsAtCompileTime = _Lhs::RowsAtCompileTime,
-    ColsAtCompileTime = _Rhs::ColsAtCompileTime,
-
-    MaxRowsAtCompileTime = _Lhs::MaxRowsAtCompileTime,
-    MaxColsAtCompileTime = _Rhs::MaxColsAtCompileTime,
-
-    SparseFlags = is_diagonal<_Lhs>::ret ? int(_Rhs::Flags) : int(_Lhs::Flags),
-    Flags = (SparseFlags&RowMajorBit),
-    CoeffReadCost = Dynamic
-  };
-};
-
-enum {SDP_IsDiagonal, SDP_IsSparseRowMajor, SDP_IsSparseColMajor};
-template<typename Lhs, typename Rhs, typename SparseDiagonalProductType, int RhsMode, int LhsMode>
-class sparse_diagonal_product_inner_iterator_selector;
-
-} // end namespace internal
-
-template<typename Lhs, typename Rhs>
-class SparseDiagonalProduct
-  : public SparseMatrixBase<SparseDiagonalProduct<Lhs,Rhs> >,
-    internal::no_assignment_operator
-{
-    typedef typename Lhs::Nested LhsNested;
-    typedef typename Rhs::Nested RhsNested;
-
-    typedef typename internal::remove_all<LhsNested>::type _LhsNested;
-    typedef typename internal::remove_all<RhsNested>::type _RhsNested;
-
-    enum {
-      LhsMode = internal::is_diagonal<_LhsNested>::ret ? internal::SDP_IsDiagonal
-              : (_LhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor,
-      RhsMode = internal::is_diagonal<_RhsNested>::ret ? internal::SDP_IsDiagonal
-              : (_RhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor
-    };
-
-  public:
-
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseDiagonalProduct)
-
-    typedef internal::sparse_diagonal_product_inner_iterator_selector
-                <_LhsNested,_RhsNested,SparseDiagonalProduct,LhsMode,RhsMode> InnerIterator;
-
-    EIGEN_STRONG_INLINE SparseDiagonalProduct(const Lhs& lhs, const Rhs& rhs)
-      : m_lhs(lhs), m_rhs(rhs)
-    {
-      eigen_assert(lhs.cols() == rhs.rows() && "invalid sparse matrix * diagonal matrix product");
-    }
-
-    EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
-
-    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
-    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
-
-  protected:
-    LhsNested m_lhs;
-    RhsNested m_rhs;
-};
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class sparse_diagonal_product_inner_iterator_selector
-<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
-  : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator
-{
-    typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator Base;
-    typedef typename Lhs::Index Index;
-  public:
-    inline sparse_diagonal_product_inner_iterator_selector(
-              const SparseDiagonalProductType& expr, Index outer)
-      : Base(expr.rhs()*(expr.lhs().diagonal().coeff(outer)), outer)
-    {}
-};
-
-template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class sparse_diagonal_product_inner_iterator_selector
-<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseColMajor>
-  : public CwiseBinaryOp<
-      scalar_product_op<typename Lhs::Scalar>,
-      SparseInnerVectorSet<Rhs,1>,
-      typename Lhs::DiagonalVectorType>::InnerIterator
-{
-    typedef typename CwiseBinaryOp<
-      scalar_product_op<typename Lhs::Scalar>,
-      SparseInnerVectorSet<Rhs,1>,
-      typename Lhs::DiagonalVectorType>::InnerIterator Base;
-    typedef typename Lhs::Index Index;
-  public:
-    inline sparse_diagonal_product_inner_iterator_selector(
-              const SparseDiagonalProductType& expr, Index outer)
-      : Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0)
-    {}
-};
-
-template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class sparse_diagonal_product_inner_iterator_selector
-<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
-  : public CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator
-{
-    typedef typename CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator Base;
-    typedef typename Lhs::Index Index;
-  public:
-    inline sparse_diagonal_product_inner_iterator_selector(
-              const SparseDiagonalProductType& expr, Index outer)
-      : Base(expr.lhs()*expr.rhs().diagonal().coeff(outer), outer)
-    {}
-};
-
-template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class sparse_diagonal_product_inner_iterator_selector
-<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseRowMajor,SDP_IsDiagonal>
-  : public CwiseBinaryOp<
-      scalar_product_op<typename Rhs::Scalar>,
-      SparseInnerVectorSet<Lhs,1>,
-      Transpose<const typename Rhs::DiagonalVectorType> >::InnerIterator
-{
-    typedef typename CwiseBinaryOp<
-      scalar_product_op<typename Rhs::Scalar>,
-      SparseInnerVectorSet<Lhs,1>,
-      Transpose<const typename Rhs::DiagonalVectorType> >::InnerIterator Base;
-    typedef typename Lhs::Index Index;
-  public:
-    inline sparse_diagonal_product_inner_iterator_selector(
-              const SparseDiagonalProductType& expr, Index outer)
-      : Base(expr.lhs().innerVector(outer) .cwiseProduct(expr.rhs().diagonal().transpose()), 0)
-    {}
-};
-
-} // end namespace internal
-
-// SparseMatrixBase functions
-
-template<typename Derived>
-template<typename OtherDerived>
-const SparseDiagonalProduct<Derived,OtherDerived>
-SparseMatrixBase<Derived>::operator*(const DiagonalBase<OtherDerived> &other) const
-{
-  return SparseDiagonalProduct<Derived,OtherDerived>(this->derived(), other.derived());
-}
-
-#endif // EIGEN_SPARSE_DIAGONAL_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseDot.h b/extern/Eigen3/Eigen/src/Sparse/SparseDot.h
deleted file mode 100644
index 1f10f71..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseDot.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_DOT_H
-#define EIGEN_SPARSE_DOT_H
-
-template<typename Derived>
-template<typename OtherDerived>
-typename internal::traits<Derived>::Scalar
-SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
-{
-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-  EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
-  EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
-    YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-
-  eigen_assert(size() == other.size());
-  eigen_assert(other.size()>0 && "you are using a non initialized vector");
-
-  typename Derived::InnerIterator i(derived(),0);
-  Scalar res = 0;
-  while (i)
-  {
-    res += internal::conj(i.value()) * other.coeff(i.index());
-    ++i;
-  }
-  return res;
-}
-
-template<typename Derived>
-template<typename OtherDerived>
-typename internal::traits<Derived>::Scalar
-SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) const
-{
-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-  EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
-  EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
-    YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-
-  eigen_assert(size() == other.size());
-
-  typename Derived::InnerIterator i(derived(),0);
-  typename OtherDerived::InnerIterator j(other.derived(),0);
-  Scalar res = 0;
-  while (i && j)
-  {
-    if (i.index()==j.index())
-    {
-      res += internal::conj(i.value()) * j.value();
-      ++i; ++j;
-    }
-    else if (i.index()<j.index())
-      ++i;
-    else
-      ++j;
-  }
-  return res;
-}
-
-template<typename Derived>
-inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
-SparseMatrixBase<Derived>::squaredNorm() const
-{
-  return internal::real((*this).cwiseAbs2().sum());
-}
-
-template<typename Derived>
-inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
-SparseMatrixBase<Derived>::norm() const
-{
-  return internal::sqrt(squaredNorm());
-}
-
-#endif // EIGEN_SPARSE_DOT_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseFuzzy.h b/extern/Eigen3/Eigen/src/Sparse/SparseFuzzy.h
deleted file mode 100644
index f00b3d6..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseFuzzy.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_FUZZY_H
-#define EIGEN_SPARSE_FUZZY_H
-
-// template<typename Derived>
-// template<typename OtherDerived>
-// bool SparseMatrixBase<Derived>::isApprox(
-//   const OtherDerived& other,
-//   typename NumTraits<Scalar>::Real prec
-// ) const
-// {
-//   const typename internal::nested<Derived,2>::type nested(derived());
-//   const typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
-//   return    (nested - otherNested).cwise().abs2().sum()
-//          <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum());
-// }
-
-#endif // EIGEN_SPARSE_FUZZY_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseMatrix.h b/extern/Eigen3/Eigen/src/Sparse/SparseMatrix.h
deleted file mode 100644
index 0e175ec..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseMatrix.h
+++ /dev/null
@@ -1,651 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEMATRIX_H
-#define EIGEN_SPARSEMATRIX_H
-
-/** \ingroup Sparse_Module
-  *
-  * \class SparseMatrix
-  *
-  * \brief The main sparse matrix class
-  *
-  * This class implements a sparse matrix using the very common compressed row/column storage
-  * scheme.
-  *
-  * \tparam _Scalar the scalar type, i.e. the type of the coefficients
-  * \tparam _Options Union of bit flags controlling the storage scheme. Currently the only possibility
-  *                 is RowMajor. The default is 0 which means column-major.
-  * \tparam _Index the type of the indices. Default is \c int.
-  *
-  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
-  *
-  * This class can be extended with the help of the plugin mechanism described on the page
-  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIX_PLUGIN.
-  */
-
-namespace internal {
-template<typename _Scalar, int _Options, typename _Index>
-struct traits<SparseMatrix<_Scalar, _Options, _Index> >
-{
-  typedef _Scalar Scalar;
-  typedef _Index Index;
-  typedef Sparse StorageKind;
-  typedef MatrixXpr XprKind;
-  enum {
-    RowsAtCompileTime = Dynamic,
-    ColsAtCompileTime = Dynamic,
-    MaxRowsAtCompileTime = Dynamic,
-    MaxColsAtCompileTime = Dynamic,
-    Flags = _Options | NestByRefBit | LvalueBit,
-    CoeffReadCost = NumTraits<Scalar>::ReadCost,
-    SupportedAccessPatterns = InnerRandomAccessPattern
-  };
-};
-
-} // end namespace internal
-
-template<typename _Scalar, int _Options, typename _Index>
-class SparseMatrix
-  : public SparseMatrixBase<SparseMatrix<_Scalar, _Options, _Index> >
-{
-  public:
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
-//     using Base::operator=;
-    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseMatrix, +=)
-    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseMatrix, -=)
-    // FIXME: why are these operator already alvailable ???
-    // EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(SparseMatrix, *=)
-    // EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(SparseMatrix, /=)
-
-    typedef MappedSparseMatrix<Scalar,Flags> Map;
-    using Base::IsRowMajor;
-    typedef CompressedStorage<Scalar,Index> Storage;
-    enum {
-      Options = _Options
-    };
-
-  protected:
-
-    typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix;
-
-    Index m_outerSize;
-    Index m_innerSize;
-    Index* m_outerIndex;
-    CompressedStorage<Scalar,Index> m_data;
-
-  public:
-
-    inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
-    inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
-
-    inline Index innerSize() const { return m_innerSize; }
-    inline Index outerSize() const { return m_outerSize; }
-    inline Index innerNonZeros(Index j) const { return m_outerIndex[j+1]-m_outerIndex[j]; }
-
-    inline const Scalar* _valuePtr() const { return &m_data.value(0); }
-    inline Scalar* _valuePtr() { return &m_data.value(0); }
-
-    inline const Index* _innerIndexPtr() const { return &m_data.index(0); }
-    inline Index* _innerIndexPtr() { return &m_data.index(0); }
-
-    inline const Index* _outerIndexPtr() const { return m_outerIndex; }
-    inline Index* _outerIndexPtr() { return m_outerIndex; }
-
-    inline Storage& data() { return m_data; }
-    inline const Storage& data() const { return m_data; }
-
-    inline Scalar coeff(Index row, Index col) const
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-      return m_data.atInRange(m_outerIndex[outer], m_outerIndex[outer+1], inner);
-    }
-
-    inline Scalar& coeffRef(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      Index start = m_outerIndex[outer];
-      Index end = m_outerIndex[outer+1];
-      eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
-      eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
-      const Index p = m_data.searchLowerIndex(start,end-1,inner);
-      eigen_assert((p<end) && (m_data.index(p)==inner) && "coeffRef cannot be called on a zero coefficient");
-      return m_data.value(p);
-    }
-
-  public:
-
-    class InnerIterator;
-
-    /** Removes all non zeros */
-    inline void setZero()
-    {
-      m_data.clear();
-      memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(Index));
-    }
-
-    /** \returns the number of non zero coefficients */
-    inline Index nonZeros() const  { return static_cast<Index>(m_data.size()); }
-
-    /** Preallocates \a reserveSize non zeros */
-    inline void reserve(Index reserveSize)
-    {
-      m_data.reserve(reserveSize);
-    }
-
-    //--- low level purely coherent filling ---
-
-    /** \returns a reference to the non zero coefficient at position \a row, \a col assuming that:
-      * - the nonzero does not already exist
-      * - the new coefficient is the last one according to the storage order
-      *
-      * Before filling a given inner vector you must call the statVec(Index) function.
-      *
-      * After an insertion session, you should call the finalize() function.
-      *
-      * \sa insert, insertBackByOuterInner, startVec */
-    inline Scalar& insertBack(Index row, Index col)
-    {
-      return insertBackByOuterInner(IsRowMajor?row:col, IsRowMajor?col:row);
-    }
-
-    /** \sa insertBack, startVec */
-    inline Scalar& insertBackByOuterInner(Index outer, Index inner)
-    {
-      eigen_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
-      eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
-      Index p = m_outerIndex[outer+1];
-      ++m_outerIndex[outer+1];
-      m_data.append(0, inner);
-      return m_data.value(p);
-    }
-
-    /** \warning use it only if you know what you are doing */
-    inline Scalar& insertBackByOuterInnerUnordered(Index outer, Index inner)
-    {
-      Index p = m_outerIndex[outer+1];
-      ++m_outerIndex[outer+1];
-      m_data.append(0, inner);
-      return m_data.value(p);
-    }
-
-    /** \sa insertBack, insertBackByOuterInner */
-    inline void startVec(Index outer)
-    {
-      eigen_assert(m_outerIndex[outer]==int(m_data.size()) && "You must call startVec for each inner vector sequentially");
-      eigen_assert(m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially");
-      m_outerIndex[outer+1] = m_outerIndex[outer];
-    }
-
-    //---
-
-    /** \returns a reference to a novel non zero coefficient with coordinates \a row x \a col.
-      * The non zero coefficient must \b not already exist.
-      *
-      * \warning This function can be extremely slow if the non zero coefficients
-      * are not inserted in a coherent order.
-      *
-      * After an insertion session, you should call the finalize() function.
-      */
-    EIGEN_DONT_INLINE Scalar& insert(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      Index previousOuter = outer;
-      if (m_outerIndex[outer+1]==0)
-      {
-        // we start a new inner vector
-        while (previousOuter>=0 && m_outerIndex[previousOuter]==0)
-        {
-          m_outerIndex[previousOuter] = static_cast<Index>(m_data.size());
-          --previousOuter;
-        }
-        m_outerIndex[outer+1] = m_outerIndex[outer];
-      }
-
-      // here we have to handle the tricky case where the outerIndex array
-      // starts with: [ 0 0 0 0 0 1 ...] and we are inserting in, e.g.,
-      // the 2nd inner vector...
-      bool isLastVec = (!(previousOuter==-1 && m_data.size()!=0))
-                    && (size_t(m_outerIndex[outer+1]) == m_data.size());
-
-      size_t startId = m_outerIndex[outer];
-      // FIXME let's make sure sizeof(long int) == sizeof(size_t)
-      size_t p = m_outerIndex[outer+1];
-      ++m_outerIndex[outer+1];
-
-      float reallocRatio = 1;
-      if (m_data.allocatedSize()<=m_data.size())
-      {
-        // if there is no preallocated memory, let's reserve a minimum of 32 elements
-        if (m_data.size()==0)
-        {
-          m_data.reserve(32);
-        }
-        else
-        {
-          // we need to reallocate the data, to reduce multiple reallocations
-          // we use a smart resize algorithm based on the current filling ratio
-          // in addition, we use float to avoid integers overflows
-          float nnzEstimate = float(m_outerIndex[outer])*float(m_outerSize)/float(outer+1);
-          reallocRatio = (nnzEstimate-float(m_data.size()))/float(m_data.size());
-          // furthermore we bound the realloc ratio to:
-          //   1) reduce multiple minor realloc when the matrix is almost filled
-          //   2) avoid to allocate too much memory when the matrix is almost empty
-          reallocRatio = (std::min)((std::max)(reallocRatio,1.5f),8.f);
-        }
-      }
-      m_data.resize(m_data.size()+1,reallocRatio);
-
-      if (!isLastVec)
-      {
-        if (previousOuter==-1)
-        {
-          // oops wrong guess.
-          // let's correct the outer offsets
-          for (Index k=0; k<=(outer+1); ++k)
-            m_outerIndex[k] = 0;
-          Index k=outer+1;
-          while(m_outerIndex[k]==0)
-            m_outerIndex[k++] = 1;
-          while (k<=m_outerSize && m_outerIndex[k]!=0)
-            m_outerIndex[k++]++;
-          p = 0;
-          --k;
-          k = m_outerIndex[k]-1;
-          while (k>0)
-          {
-            m_data.index(k) = m_data.index(k-1);
-            m_data.value(k) = m_data.value(k-1);
-            k--;
-          }
-        }
-        else
-        {
-          // we are not inserting into the last inner vec
-          // update outer indices:
-          Index j = outer+2;
-          while (j<=m_outerSize && m_outerIndex[j]!=0)
-            m_outerIndex[j++]++;
-          --j;
-          // shift data of last vecs:
-          Index k = m_outerIndex[j]-1;
-          while (k>=Index(p))
-          {
-            m_data.index(k) = m_data.index(k-1);
-            m_data.value(k) = m_data.value(k-1);
-            k--;
-          }
-        }
-      }
-
-      while ( (p > startId) && (m_data.index(p-1) > inner) )
-      {
-        m_data.index(p) = m_data.index(p-1);
-        m_data.value(p) = m_data.value(p-1);
-        --p;
-      }
-
-      m_data.index(p) = inner;
-      return (m_data.value(p) = 0);
-    }
-
-
-
-
-    /** Must be called after inserting a set of non zero entries.
-      */
-    inline void finalize()
-    {
-      Index size = static_cast<Index>(m_data.size());
-      Index i = m_outerSize;
-      // find the last filled column
-      while (i>=0 && m_outerIndex[i]==0)
-        --i;
-      ++i;
-      while (i<=m_outerSize)
-      {
-        m_outerIndex[i] = size;
-        ++i;
-      }
-    }
-
-    /** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */
-    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
-    {
-      prune(default_prunning_func(reference,epsilon));
-    }
-    
-    /** Suppress all nonzeros which do not satisfy the predicate \a keep.
-      * The functor type \a KeepFunc must implement the following function:
-      * \code
-      * bool operator() (const Index& row, const Index& col, const Scalar& value) const;
-      * \endcode
-      * \sa prune(Scalar,RealScalar)
-      */
-    template<typename KeepFunc>
-    void prune(const KeepFunc& keep = KeepFunc())
-    {
-      Index k = 0;
-      for(Index j=0; j<m_outerSize; ++j)
-      {
-        Index previousStart = m_outerIndex[j];
-        m_outerIndex[j] = k;
-        Index end = m_outerIndex[j+1];
-        for(Index i=previousStart; i<end; ++i)
-        {
-          if(keep(IsRowMajor?j:m_data.index(i), IsRowMajor?m_data.index(i):j, m_data.value(i)))
-          {
-            m_data.value(k) = m_data.value(i);
-            m_data.index(k) = m_data.index(i);
-            ++k;
-          }
-        }
-      }
-      m_outerIndex[m_outerSize] = k;
-      m_data.resize(k,0);
-    }
-
-    /** Resizes the matrix to a \a rows x \a cols matrix and initializes it to zero
-      * \sa resizeNonZeros(Index), reserve(), setZero()
-      */
-    void resize(Index rows, Index cols)
-    {
-      const Index outerSize = IsRowMajor ? rows : cols;
-      m_innerSize = IsRowMajor ? cols : rows;
-      m_data.clear();
-      if (m_outerSize != outerSize || m_outerSize==0)
-      {
-        delete[] m_outerIndex;
-        m_outerIndex = new Index [outerSize+1];
-        m_outerSize = outerSize;
-      }
-      memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(Index));
-    }
-
-    /** Low level API
-      * Resize the nonzero vector to \a size */
-    void resizeNonZeros(Index size)
-    {
-      m_data.resize(size);
-    }
-
-    /** Default constructor yielding an empty \c 0 \c x \c 0 matrix */
-    inline SparseMatrix()
-      : m_outerSize(-1), m_innerSize(0), m_outerIndex(0)
-    {
-      resize(0, 0);
-    }
-
-    /** Constructs a \a rows \c x \a cols empty matrix */
-    inline SparseMatrix(Index rows, Index cols)
-      : m_outerSize(0), m_innerSize(0), m_outerIndex(0)
-    {
-      resize(rows, cols);
-    }
-
-    /** Constructs a sparse matrix from the sparse expression \a other */
-    template<typename OtherDerived>
-    inline SparseMatrix(const SparseMatrixBase<OtherDerived>& other)
-      : m_outerSize(0), m_innerSize(0), m_outerIndex(0)
-    {
-      *this = other.derived();
-    }
-
-    /** Copy constructor */
-    inline SparseMatrix(const SparseMatrix& other)
-      : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0)
-    {
-      *this = other.derived();
-    }
-
-    /** Swap the content of two sparse matrices of same type (optimization) */
-    inline void swap(SparseMatrix& other)
-    {
-      //EIGEN_DBG_SPARSE(std::cout << "SparseMatrix:: swap\n");
-      std::swap(m_outerIndex, other.m_outerIndex);
-      std::swap(m_innerSize, other.m_innerSize);
-      std::swap(m_outerSize, other.m_outerSize);
-      m_data.swap(other.m_data);
-    }
-
-    inline SparseMatrix& operator=(const SparseMatrix& other)
-    {
-//       std::cout << "SparseMatrix& operator=(const SparseMatrix& other)\n";
-      if (other.isRValue())
-      {
-        swap(other.const_cast_derived());
-      }
-      else
-      {
-        resize(other.rows(), other.cols());
-        memcpy(m_outerIndex, other.m_outerIndex, (m_outerSize+1)*sizeof(Index));
-        m_data = other.m_data;
-      }
-      return *this;
-    }
-
-    #ifndef EIGEN_PARSED_BY_DOXYGEN
-    template<typename Lhs, typename Rhs>
-    inline SparseMatrix& operator=(const SparseSparseProduct<Lhs,Rhs>& product)
-    { return Base::operator=(product); }
-    
-    template<typename OtherDerived>
-    inline SparseMatrix& operator=(const ReturnByValue<OtherDerived>& other)
-    { return Base::operator=(other); }
-    
-    template<typename OtherDerived>
-    inline SparseMatrix& operator=(const EigenBase<OtherDerived>& other)
-    { return Base::operator=(other); }
-    #endif
-
-    template<typename OtherDerived>
-    EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase<OtherDerived>& other)
-    {
-      const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
-      if (needToTranspose)
-      {
-        // two passes algorithm:
-        //  1 - compute the number of coeffs per dest inner vector
-        //  2 - do the actual copy/eval
-        // Since each coeff of the rhs has to be evaluated twice, let's evaluate it if needed
-        typedef typename internal::nested<OtherDerived,2>::type OtherCopy;
-        typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
-        OtherCopy otherCopy(other.derived());
-
-        resize(other.rows(), other.cols());
-        Eigen::Map<Matrix<Index, Dynamic, 1> > (m_outerIndex,outerSize()).setZero();
-        // pass 1
-        // FIXME the above copy could be merged with that pass
-        for (Index j=0; j<otherCopy.outerSize(); ++j)
-          for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
-            ++m_outerIndex[it.index()];
-
-        // prefix sum
-        Index count = 0;
-        VectorXi positions(outerSize());
-        for (Index j=0; j<outerSize(); ++j)
-        {
-          Index tmp = m_outerIndex[j];
-          m_outerIndex[j] = count;
-          positions[j] = count;
-          count += tmp;
-        }
-        m_outerIndex[outerSize()] = count;
-        // alloc
-        m_data.resize(count);
-        // pass 2
-        for (Index j=0; j<otherCopy.outerSize(); ++j)
-        {
-          for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
-          {
-            Index pos = positions[it.index()]++;
-            m_data.index(pos) = j;
-            m_data.value(pos) = it.value();
-          }
-        }
-        return *this;
-      }
-      else
-      {
-        // there is no special optimization
-        return SparseMatrixBase<SparseMatrix>::operator=(other.derived());
-      }
-    }
-
-    friend std::ostream & operator << (std::ostream & s, const SparseMatrix& m)
-    {
-      EIGEN_DBG_SPARSE(
-        s << "Nonzero entries:\n";
-        for (Index i=0; i<m.nonZeros(); ++i)
-        {
-          s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
-        }
-        s << std::endl;
-        s << std::endl;
-        s << "Column pointers:\n";
-        for (Index i=0; i<m.outerSize(); ++i)
-        {
-          s << m.m_outerIndex[i] << " ";
-        }
-        s << " $" << std::endl;
-        s << std::endl;
-      );
-      s << static_cast<const SparseMatrixBase<SparseMatrix>&>(m);
-      return s;
-    }
-
-    /** Destructor */
-    inline ~SparseMatrix()
-    {
-      delete[] m_outerIndex;
-    }
-
-    /** Overloaded for performance */
-    Scalar sum() const;
-
-  public:
-
-    /** \deprecated use setZero() and reserve()
-      * Initializes the filling process of \c *this.
-      * \param reserveSize approximate number of nonzeros
-      * Note that the matrix \c *this is zero-ed.
-      */
-    EIGEN_DEPRECATED void startFill(Index reserveSize = 1000)
-    {
-      setZero();
-      m_data.reserve(reserveSize);
-    }
-
-    /** \deprecated use insert()
-      * Like fill() but with random inner coordinates.
-      */
-    EIGEN_DEPRECATED Scalar& fillrand(Index row, Index col)
-    {
-      return insert(row,col);
-    }
-
-    /** \deprecated use insert()
-      */
-    EIGEN_DEPRECATED Scalar& fill(Index row, Index col)
-    {
-      const Index outer = IsRowMajor ? row : col;
-      const Index inner = IsRowMajor ? col : row;
-
-      if (m_outerIndex[outer+1]==0)
-      {
-        // we start a new inner vector
-        Index i = outer;
-        while (i>=0 && m_outerIndex[i]==0)
-        {
-          m_outerIndex[i] = m_data.size();
-          --i;
-        }
-        m_outerIndex[outer+1] = m_outerIndex[outer];
-      }
-      else
-      {
-        eigen_assert(m_data.index(m_data.size()-1)<inner && "wrong sorted insertion");
-      }
-//       std::cerr << size_t(m_outerIndex[outer+1]) << " == " << m_data.size() << "\n";
-      assert(size_t(m_outerIndex[outer+1]) == m_data.size());
-      Index p = m_outerIndex[outer+1];
-      ++m_outerIndex[outer+1];
-
-      m_data.append(0, inner);
-      return m_data.value(p);
-    }
-
-    /** \deprecated use finalize */
-    EIGEN_DEPRECATED void endFill() { finalize(); }
-    
-#   ifdef EIGEN_SPARSEMATRIX_PLUGIN
-#     include EIGEN_SPARSEMATRIX_PLUGIN
-#   endif
-
-private:
-  struct default_prunning_func {
-    default_prunning_func(Scalar ref, RealScalar eps) : reference(ref), epsilon(eps) {}
-    inline bool operator() (const Index&, const Index&, const Scalar& value) const
-    {
-      return !internal::isMuchSmallerThan(value, reference, epsilon);
-    }
-    Scalar reference;
-    RealScalar epsilon;
-  };
-};
-
-template<typename Scalar, int _Options, typename _Index>
-class SparseMatrix<Scalar,_Options,_Index>::InnerIterator
-{
-  public:
-    InnerIterator(const SparseMatrix& mat, Index outer)
-      : m_values(mat._valuePtr()), m_indices(mat._innerIndexPtr()), m_outer(outer), m_id(mat.m_outerIndex[outer]), m_end(mat.m_outerIndex[outer+1])
-    {}
-
-    inline InnerIterator& operator++() { m_id++; return *this; }
-
-    inline const Scalar& value() const { return m_values[m_id]; }
-    inline Scalar& valueRef() { return const_cast<Scalar&>(m_values[m_id]); }
-
-    inline Index index() const { return m_indices[m_id]; }
-    inline Index outer() const { return m_outer; }
-    inline Index row() const { return IsRowMajor ? m_outer : index(); }
-    inline Index col() const { return IsRowMajor ? index() : m_outer; }
-
-    inline operator bool() const { return (m_id < m_end); }
-
-  protected:
-    const Scalar* m_values;
-    const Index* m_indices;
-    const Index m_outer;
-    Index m_id;
-    const Index m_end;
-};
-
-#endif // EIGEN_SPARSEMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseMatrixBase.h b/extern/Eigen3/Eigen/src/Sparse/SparseMatrixBase.h
deleted file mode 100644
index c01981b..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseMatrixBase.h
+++ /dev/null
@@ -1,706 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEMATRIXBASE_H
-#define EIGEN_SPARSEMATRIXBASE_H
-
-/** \ingroup Sparse_Module
-  *
-  * \class SparseMatrixBase
-  *
-  * \brief Base class of any sparse matrices or sparse expressions
-  *
-  * \tparam Derived
-  *
-  * This class can be extended with the help of the plugin mechanism described on the page
-  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIXBASE_PLUGIN.
-  */
-template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
-{
-  public:
-
-    typedef typename internal::traits<Derived>::Scalar Scalar;
-    typedef typename internal::packet_traits<Scalar>::type PacketScalar;
-    typedef typename internal::traits<Derived>::StorageKind StorageKind;
-    typedef typename internal::traits<Derived>::Index Index;
-
-    typedef SparseMatrixBase StorageBaseType;
-    typedef EigenBase<Derived> Base;
-    
-    template<typename OtherDerived>
-    Derived& operator=(const EigenBase<OtherDerived> &other)
-    {
-      other.derived().evalTo(derived());
-      return derived();
-    }
-    
-//     using Base::operator=;
-
-    enum {
-
-      RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
-        /**< The number of rows at compile-time. This is just a copy of the value provided
-          * by the \a Derived type. If a value is not known at compile-time,
-          * it is set to the \a Dynamic constant.
-          * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
-
-      ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
-        /**< The number of columns at compile-time. This is just a copy of the value provided
-          * by the \a Derived type. If a value is not known at compile-time,
-          * it is set to the \a Dynamic constant.
-          * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
-
-
-      SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
-                                                   internal::traits<Derived>::ColsAtCompileTime>::ret),
-        /**< This is equal to the number of coefficients, i.e. the number of
-          * rows times the number of columns, or to \a Dynamic if this is not
-          * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
-
-      MaxRowsAtCompileTime = RowsAtCompileTime,
-      MaxColsAtCompileTime = ColsAtCompileTime,
-
-      MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
-                                                      MaxColsAtCompileTime>::ret),
-
-      IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
-        /**< This is set to true if either the number of rows or the number of
-          * columns is known at compile-time to be equal to 1. Indeed, in that case,
-          * we are dealing with a column-vector (if there is only one column) or with
-          * a row-vector (if there is only one row). */
-
-      Flags = internal::traits<Derived>::Flags,
-        /**< This stores expression \ref flags flags which may or may not be inherited by new expressions
-          * constructed from this one. See the \ref flags "list of flags".
-          */
-
-      CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
-        /**< This is a rough measure of how expensive it is to read one coefficient from
-          * this expression.
-          */
-
-      IsRowMajor = Flags&RowMajorBit ? 1 : 0,
-
-      #ifndef EIGEN_PARSED_BY_DOXYGEN
-      _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC
-      #endif
-    };
-
-    /* \internal the return type of MatrixBase::conjugate() */
-//     typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
-//                         const SparseCwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Derived>,
-//                         const Derived&
-//                      >::type ConjugateReturnType;
-    /* \internal the return type of MatrixBase::real() */
-//     typedef SparseCwiseUnaryOp<internal::scalar_real_op<Scalar>, Derived> RealReturnType;
-    /* \internal the return type of MatrixBase::imag() */
-//     typedef SparseCwiseUnaryOp<internal::scalar_imag_op<Scalar>, Derived> ImagReturnType;
-    /** \internal the return type of MatrixBase::adjoint() */
-    typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
-                        CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Eigen::Transpose<const Derived> >,
-                        Transpose<const Derived>
-                     >::type AdjointReturnType;
-
-
-    typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor> PlainObject;
-
-#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
-#   include "../plugins/CommonCwiseUnaryOps.h"
-#   include "../plugins/CommonCwiseBinaryOps.h"
-#   include "../plugins/MatrixCwiseUnaryOps.h"
-#   include "../plugins/MatrixCwiseBinaryOps.h"
-#   ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN
-#     include EIGEN_SPARSEMATRIXBASE_PLUGIN
-#   endif
-#   undef EIGEN_CURRENT_STORAGE_BASE_CLASS
-#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
-
-#ifndef EIGEN_PARSED_BY_DOXYGEN
-    /** This is the "real scalar" type; if the \a Scalar type is already real numbers
-      * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If
-      * \a Scalar is \a std::complex<T> then RealScalar is \a T.
-      *
-      * \sa class NumTraits
-      */
-    typedef typename NumTraits<Scalar>::Real RealScalar;
-
-    /** \internal the return type of coeff()
-      */
-    typedef typename internal::conditional<_HasDirectAccess, const Scalar&, Scalar>::type CoeffReturnType;
-
-    /** \internal Represents a matrix with all coefficients equal to one another*/
-    typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
-
-    /** type of the equivalent square matrix */
-    typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime),
-                          EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
-
-    inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
-    inline Derived& derived() { return *static_cast<Derived*>(this); }
-    inline Derived& const_cast_derived() const
-    { return *static_cast<Derived*>(const_cast<SparseMatrixBase*>(this)); }
-#endif // not EIGEN_PARSED_BY_DOXYGEN
-
-    /** \returns the number of rows. \sa cols(), RowsAtCompileTime */
-    inline Index rows() const { return derived().rows(); }
-    /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/
-    inline Index cols() const { return derived().cols(); }
-    /** \returns the number of coefficients, which is \a rows()*cols().
-      * \sa rows(), cols(), SizeAtCompileTime. */
-    inline Index size() const { return rows() * cols(); }
-    /** \returns the number of nonzero coefficients which is in practice the number
-      * of stored coefficients. */
-    inline Index nonZeros() const { return derived().nonZeros(); }
-    /** \returns true if either the number of rows or the number of columns is equal to 1.
-      * In other words, this function returns
-      * \code rows()==1 || cols()==1 \endcode
-      * \sa rows(), cols(), IsVectorAtCompileTime. */
-    inline bool isVector() const { return rows()==1 || cols()==1; }
-    /** \returns the size of the storage major dimension,
-      * i.e., the number of columns for a columns major matrix, and the number of rows otherwise */
-    Index outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); }
-    /** \returns the size of the inner dimension according to the storage order,
-      * i.e., the number of rows for a columns major matrix, and the number of cols otherwise */
-    Index innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); }
-
-    bool isRValue() const { return m_isRValue; }
-    Derived& markAsRValue() { m_isRValue = true; return derived(); }
-
-    SparseMatrixBase() : m_isRValue(false) { /* TODO check flags */ }
-    
-    inline Derived& operator=(const Derived& other)
-    {
-//       std::cout << "Derived& operator=(const Derived& other)\n";
-//       if (other.isRValue())
-//         derived().swap(other.const_cast_derived());
-//       else
-        this->operator=<Derived>(other);
-      return derived();
-    }
-    
-    template<typename OtherDerived>
-    Derived& operator=(const ReturnByValue<OtherDerived>& other)
-    {
-      other.evalTo(derived());
-      return derived();
-    }
-
-
-    template<typename OtherDerived>
-    inline void assignGeneric(const OtherDerived& other)
-    {
-//       std::cout << "Derived& operator=(const MatrixBase<OtherDerived>& other)\n";
-      //const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
-      eigen_assert(( ((internal::traits<Derived>::SupportedAccessPatterns&OuterRandomAccessPattern)==OuterRandomAccessPattern) ||
-                  (!((Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit)))) &&
-                  "the transpose operation is supposed to be handled in SparseMatrix::operator=");
-
-      enum { Flip = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit) };
-
-      const Index outerSize = other.outerSize();
-      //typedef typename internal::conditional<transpose, LinkedVectorMatrix<Scalar,Flags&RowMajorBit>, Derived>::type TempType;
-      // thanks to shallow copies, we always eval to a tempary
-      Derived temp(other.rows(), other.cols());
-
-      temp.reserve((std::max)(this->rows(),this->cols())*2);
-      for (Index j=0; j<outerSize; ++j)
-      {
-        temp.startVec(j);
-        for (typename OtherDerived::InnerIterator it(other.derived(), j); it; ++it)
-        {
-          Scalar v = it.value();
-          if (v!=Scalar(0))
-            temp.insertBackByOuterInner(Flip?it.index():j,Flip?j:it.index()) = v;
-        }
-      }
-      temp.finalize();
-
-      derived() = temp.markAsRValue();
-    }
-
-
-    template<typename OtherDerived>
-    inline Derived& operator=(const SparseMatrixBase<OtherDerived>& other)
-    {
-//       std::cout << typeid(OtherDerived).name() << "\n";
-//       std::cout << Flags << " " << OtherDerived::Flags << "\n";
-      const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
-//       std::cout << "eval transpose = " << transpose << "\n";
-      const Index outerSize = (int(OtherDerived::Flags) & RowMajorBit) ? other.rows() : other.cols();
-      if ((!transpose) && other.isRValue())
-      {
-        // eval without temporary
-        derived().resize(other.rows(), other.cols());
-        derived().setZero();
-        derived().reserve((std::max)(this->rows(),this->cols())*2);
-        for (Index j=0; j<outerSize; ++j)
-        {
-          derived().startVec(j);
-          for (typename OtherDerived::InnerIterator it(other.derived(), j); it; ++it)
-          {
-            Scalar v = it.value();
-            if (v!=Scalar(0))
-              derived().insertBackByOuterInner(j,it.index()) = v;
-          }
-        }
-        derived().finalize();
-      }
-      else
-      {
-        assignGeneric(other.derived());
-      }
-      return derived();
-    }
-
-    template<typename Lhs, typename Rhs>
-    inline Derived& operator=(const SparseSparseProduct<Lhs,Rhs>& product);
-
-    template<typename Lhs, typename Rhs>
-    inline void _experimentalNewProduct(const Lhs& lhs, const Rhs& rhs);
-
-    friend std::ostream & operator << (std::ostream & s, const SparseMatrixBase& m)
-    {
-      if (Flags&RowMajorBit)
-      {
-        for (Index row=0; row<m.outerSize(); ++row)
-        {
-          Index col = 0;
-          for (typename Derived::InnerIterator it(m.derived(), row); it; ++it)
-          {
-            for ( ; col<it.index(); ++col)
-              s << "0 ";
-            s << it.value() << " ";
-            ++col;
-          }
-          for ( ; col<m.cols(); ++col)
-            s << "0 ";
-          s << std::endl;
-        }
-      }
-      else
-      {
-        if (m.cols() == 1) {
-          Index row = 0;
-          for (typename Derived::InnerIterator it(m.derived(), 0); it; ++it)
-          {
-            for ( ; row<it.index(); ++row)
-              s << "0" << std::endl;
-            s << it.value() << std::endl;
-            ++row;
-          }
-          for ( ; row<m.rows(); ++row)
-            s << "0" << std::endl;
-        }
-        else
-        {
-          SparseMatrix<Scalar, RowMajorBit> trans = m.derived();
-          s << trans;
-        }
-      }
-      return s;
-    }
-
-//     const SparseCwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>,Derived> operator-() const;
-
-//     template<typename OtherDerived>
-//     const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
-//     operator+(const SparseMatrixBase<OtherDerived> &other) const;
-
-//     template<typename OtherDerived>
-//     const CwiseBinaryOp<internal::scalar_difference_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
-//     operator-(const SparseMatrixBase<OtherDerived> &other) const;
-
-    template<typename OtherDerived>
-    Derived& operator+=(const SparseMatrixBase<OtherDerived>& other);
-    template<typename OtherDerived>
-    Derived& operator-=(const SparseMatrixBase<OtherDerived>& other);
-
-//     template<typename Lhs,typename Rhs>
-//     Derived& operator+=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other);
-
-    Derived& operator*=(const Scalar& other);
-    Derived& operator/=(const Scalar& other);
-
-    #define EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE \
-      CwiseBinaryOp< \
-        internal::scalar_product_op< \
-          typename internal::scalar_product_traits< \
-            typename internal::traits<Derived>::Scalar, \
-            typename internal::traits<OtherDerived>::Scalar \
-          >::ReturnType \
-        >, \
-        Derived, \
-        OtherDerived \
-      >
-
-    template<typename OtherDerived>
-    EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
-    cwiseProduct(const MatrixBase<OtherDerived> &other) const;
-
-//     const SparseCwiseUnaryOp<internal::scalar_multiple_op<typename internal::traits<Derived>::Scalar>, Derived>
-//     operator*(const Scalar& scalar) const;
-//     const SparseCwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, Derived>
-//     operator/(const Scalar& scalar) const;
-
-//     inline friend const SparseCwiseUnaryOp<internal::scalar_multiple_op<typename internal::traits<Derived>::Scalar>, Derived>
-//     operator*(const Scalar& scalar, const SparseMatrixBase& matrix)
-//     { return matrix*scalar; }
-
-
-    // sparse * sparse
-    template<typename OtherDerived>
-    const typename SparseSparseProductReturnType<Derived,OtherDerived>::Type
-    operator*(const SparseMatrixBase<OtherDerived> &other) const;
-
-    // sparse * diagonal
-    template<typename OtherDerived>
-    const SparseDiagonalProduct<Derived,OtherDerived>
-    operator*(const DiagonalBase<OtherDerived> &other) const;
-
-    // diagonal * sparse
-    template<typename OtherDerived> friend
-    const SparseDiagonalProduct<OtherDerived,Derived>
-    operator*(const DiagonalBase<OtherDerived> &lhs, const SparseMatrixBase& rhs)
-    { return SparseDiagonalProduct<OtherDerived,Derived>(lhs.derived(), rhs.derived()); }
-
-    /** dense * sparse (return a dense object unless it is an outer product) */
-    template<typename OtherDerived> friend
-    const typename DenseSparseProductReturnType<OtherDerived,Derived>::Type
-    operator*(const MatrixBase<OtherDerived>& lhs, const Derived& rhs)
-    { return typename DenseSparseProductReturnType<OtherDerived,Derived>::Type(lhs.derived(),rhs); }
-
-    /** sparse * dense (returns a dense object unless it is an outer product) */
-    template<typename OtherDerived>
-    const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
-    operator*(const MatrixBase<OtherDerived> &other) const;
-
-    template<typename OtherDerived>
-    Derived& operator*=(const SparseMatrixBase<OtherDerived>& other);
-
-    #ifdef EIGEN2_SUPPORT
-    // deprecated
-    template<typename OtherDerived>
-    typename internal::plain_matrix_type_column_major<OtherDerived>::type
-    solveTriangular(const MatrixBase<OtherDerived>& other) const;
-
-    // deprecated
-    template<typename OtherDerived>
-    void solveTriangularInPlace(MatrixBase<OtherDerived>& other) const;
-//     template<typename OtherDerived>
-//     void solveTriangularInPlace(SparseMatrixBase<OtherDerived>& other) const;
-    #endif // EIGEN2_SUPPORT
-
-    template<int Mode>
-    inline const SparseTriangularView<Derived, Mode> triangularView() const;
-
-    template<unsigned int UpLo> inline const SparseSelfAdjointView<Derived, UpLo> selfadjointView() const;
-    template<unsigned int UpLo> inline SparseSelfAdjointView<Derived, UpLo> selfadjointView();
-
-    template<typename OtherDerived> Scalar dot(const MatrixBase<OtherDerived>& other) const;
-    template<typename OtherDerived> Scalar dot(const SparseMatrixBase<OtherDerived>& other) const;
-    RealScalar squaredNorm() const;
-    RealScalar norm()  const;
-//     const PlainObject normalized() const;
-//     void normalize();
-
-    Transpose<Derived> transpose() { return derived(); }
-    const Transpose<const Derived> transpose() const { return derived(); }
-    // void transposeInPlace();
-    const AdjointReturnType adjoint() const { return transpose(); }
-
-    // sub-vector
-    SparseInnerVectorSet<Derived,1> row(Index i);
-    const SparseInnerVectorSet<Derived,1> row(Index i) const;
-    SparseInnerVectorSet<Derived,1> col(Index j);
-    const SparseInnerVectorSet<Derived,1> col(Index j) const;
-    SparseInnerVectorSet<Derived,1> innerVector(Index outer);
-    const SparseInnerVectorSet<Derived,1> innerVector(Index outer) const;
-
-    // set of sub-vectors
-    SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size);
-    const SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size) const;
-    SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size);
-    const SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size) const;
-    SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize);
-    const SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize) const;
-
-//     typename BlockReturnType<Derived>::Type block(int startRow, int startCol, int blockRows, int blockCols);
-//     const typename BlockReturnType<Derived>::Type
-//     block(int startRow, int startCol, int blockRows, int blockCols) const;
-//
-//     typename BlockReturnType<Derived>::SubVectorType segment(int start, int size);
-//     const typename BlockReturnType<Derived>::SubVectorType segment(int start, int size) const;
-//
-//     typename BlockReturnType<Derived,Dynamic>::SubVectorType start(int size);
-//     const typename BlockReturnType<Derived,Dynamic>::SubVectorType start(int size) const;
-//
-//     typename BlockReturnType<Derived,Dynamic>::SubVectorType end(int size);
-//     const typename BlockReturnType<Derived,Dynamic>::SubVectorType end(int size) const;
-//
-//     template<int BlockRows, int BlockCols>
-//     typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol);
-//     template<int BlockRows, int BlockCols>
-//     const typename BlockReturnType<Derived, BlockRows, BlockCols>::Type block(int startRow, int startCol) const;
-
-//     template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType start(void);
-//     template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType start() const;
-
-//     template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType end();
-//     template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType end() const;
-
-//     template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType segment(int start);
-//     template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType segment(int start) const;
-
-//     Diagonal<Derived> diagonal();
-//     const Diagonal<Derived> diagonal() const;
-
-//     template<unsigned int Mode> Part<Derived, Mode> part();
-//     template<unsigned int Mode> const Part<Derived, Mode> part() const;
-
-
-//     static const ConstantReturnType Constant(int rows, int cols, const Scalar& value);
-//     static const ConstantReturnType Constant(int size, const Scalar& value);
-//     static const ConstantReturnType Constant(const Scalar& value);
-
-//     template<typename CustomNullaryOp>
-//     static const CwiseNullaryOp<CustomNullaryOp, Derived> NullaryExpr(int rows, int cols, const CustomNullaryOp& func);
-//     template<typename CustomNullaryOp>
-//     static const CwiseNullaryOp<CustomNullaryOp, Derived> NullaryExpr(int size, const CustomNullaryOp& func);
-//     template<typename CustomNullaryOp>
-//     static const CwiseNullaryOp<CustomNullaryOp, Derived> NullaryExpr(const CustomNullaryOp& func);
-
-//     static const ConstantReturnType Zero(int rows, int cols);
-//     static const ConstantReturnType Zero(int size);
-//     static const ConstantReturnType Zero();
-//     static const ConstantReturnType Ones(int rows, int cols);
-//     static const ConstantReturnType Ones(int size);
-//     static const ConstantReturnType Ones();
-//     static const IdentityReturnType Identity();
-//     static const IdentityReturnType Identity(int rows, int cols);
-//     static const BasisReturnType Unit(int size, int i);
-//     static const BasisReturnType Unit(int i);
-//     static const BasisReturnType UnitX();
-//     static const BasisReturnType UnitY();
-//     static const BasisReturnType UnitZ();
-//     static const BasisReturnType UnitW();
-
-//     const DiagonalMatrix<Derived> asDiagonal() const;
-
-//     Derived& setConstant(const Scalar& value);
-//     Derived& setZero();
-//     Derived& setOnes();
-//     Derived& setRandom();
-//     Derived& setIdentity();
-
-      /** \internal use operator= */
-      template<typename DenseDerived>
-      void evalTo(MatrixBase<DenseDerived>& dst) const
-      {
-        dst.setZero();
-        for (Index j=0; j<outerSize(); ++j)
-          for (typename Derived::InnerIterator i(derived(),j); i; ++i)
-            dst.coeffRef(i.row(),i.col()) = i.value();
-      }
-
-      Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> toDense() const
-      {
-        return derived();
-      }
-
-    template<typename OtherDerived>
-    bool isApprox(const SparseMatrixBase<OtherDerived>& other,
-                  RealScalar prec = NumTraits<Scalar>::dummy_precision()) const
-    { return toDense().isApprox(other.toDense(),prec); }
-
-    template<typename OtherDerived>
-    bool isApprox(const MatrixBase<OtherDerived>& other,
-                  RealScalar prec = NumTraits<Scalar>::dummy_precision()) const
-    { return toDense().isApprox(other,prec); }
-//     bool isMuchSmallerThan(const RealScalar& other,
-//                            RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     template<typename OtherDerived>
-//     bool isMuchSmallerThan(const MatrixBase<OtherDerived>& other,
-//                            RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-
-//     bool isApproxToConstant(const Scalar& value, RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isZero(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isOnes(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isIdentity(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isDiagonal(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-
-//     bool isUpper(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isLower(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-
-//     template<typename OtherDerived>
-//     bool isOrthogonal(const MatrixBase<OtherDerived>& other,
-//                       RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-//     bool isUnitary(RealScalar prec = NumTraits<Scalar>::dummy_precision()) const;
-
-//     template<typename OtherDerived>
-//     inline bool operator==(const MatrixBase<OtherDerived>& other) const
-//     { return (cwise() == other).all(); }
-
-//     template<typename OtherDerived>
-//     inline bool operator!=(const MatrixBase<OtherDerived>& other) const
-//     { return (cwise() != other).any(); }
-
-
-//     template<typename NewType>
-//     const SparseCwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, Derived> cast() const;
-
-    /** \returns the matrix or vector obtained by evaluating this expression.
-      *
-      * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
-      * a const reference, in order to avoid a useless copy.
-      */
-    inline const typename internal::eval<Derived>::type eval() const
-    { return typename internal::eval<Derived>::type(derived()); }
-
-//     template<typename OtherDerived>
-//     void swap(MatrixBase<OtherDerived> const & other);
-
-//     template<unsigned int Added>
-//     const SparseFlagged<Derived, Added, 0> marked() const;
-//     const Flagged<Derived, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit> lazy() const;
-
-    /** \returns number of elements to skip to pass from one row (resp. column) to another
-      * for a row-major (resp. column-major) matrix.
-      * Combined with coeffRef() and the \ref flags flags, it allows a direct access to the data
-      * of the underlying matrix.
-      */
-//     inline int stride(void) const { return derived().stride(); }
-
-// FIXME
-//     ConjugateReturnType conjugate() const;
-//     const RealReturnType real() const;
-//     const ImagReturnType imag() const;
-
-//     template<typename CustomUnaryOp>
-//     const SparseCwiseUnaryOp<CustomUnaryOp, Derived> unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const;
-
-//     template<typename CustomBinaryOp, typename OtherDerived>
-//     const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>
-//     binaryExpr(const MatrixBase<OtherDerived> &other, const CustomBinaryOp& func = CustomBinaryOp()) const;
-
-
-    Scalar sum() const;
-//     Scalar trace() const;
-
-//     typename internal::traits<Derived>::Scalar minCoeff() const;
-//     typename internal::traits<Derived>::Scalar maxCoeff() const;
-
-//     typename internal::traits<Derived>::Scalar minCoeff(int* row, int* col = 0) const;
-//     typename internal::traits<Derived>::Scalar maxCoeff(int* row, int* col = 0) const;
-
-//     template<typename BinaryOp>
-//     typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
-//     redux(const BinaryOp& func) const;
-
-//     template<typename Visitor>
-//     void visit(Visitor& func) const;
-
-
-//     const SparseCwise<Derived> cwise() const;
-//     SparseCwise<Derived> cwise();
-
-//     inline const WithFormat<Derived> format(const IOFormat& fmt) const;
-
-/////////// Array module ///////////
-    /*
-    bool all(void) const;
-    bool any(void) const;
-
-    const VectorwiseOp<Derived,Horizontal> rowwise() const;
-    const VectorwiseOp<Derived,Vertical> colwise() const;
-
-    static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(int rows, int cols);
-    static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(int size);
-    static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random();
-
-    template<typename ThenDerived,typename ElseDerived>
-    const Select<Derived,ThenDerived,ElseDerived>
-    select(const MatrixBase<ThenDerived>& thenMatrix,
-           const MatrixBase<ElseDerived>& elseMatrix) const;
-
-    template<typename ThenDerived>
-    inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
-    select(const MatrixBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
-
-    template<typename ElseDerived>
-    inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
-    select(typename ElseDerived::Scalar thenScalar, const MatrixBase<ElseDerived>& elseMatrix) const;
-
-    template<int p> RealScalar lpNorm() const;
-    */
-
-
-//     template<typename OtherDerived>
-//     Scalar dot(const MatrixBase<OtherDerived>& other) const
-//     {
-//       EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
-//       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-//       EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
-//         YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-//
-//       eigen_assert(derived().size() == other.size());
-//       // short version, but the assembly looks more complicated because
-//       // of the CwiseBinaryOp iterator complexity
-//       // return res = (derived().cwise() * other.derived().conjugate()).sum();
-//
-//       // optimized, generic version
-//       typename Derived::InnerIterator i(derived(),0);
-//       typename OtherDerived::InnerIterator j(other.derived(),0);
-//       Scalar res = 0;
-//       while (i && j)
-//       {
-//         if (i.index()==j.index())
-//         {
-// //           std::cerr << i.value() << " * " << j.value() << "\n";
-//           res += i.value() * internal::conj(j.value());
-//           ++i; ++j;
-//         }
-//         else if (i.index()<j.index())
-//           ++i;
-//         else
-//           ++j;
-//       }
-//       return res;
-//     }
-//
-//     Scalar sum() const
-//     {
-//       Scalar res = 0;
-//       for (typename Derived::InnerIterator iter(*this,0); iter; ++iter)
-//       {
-//         res += iter.value();
-//       }
-//       return res;
-//     }
-
-  protected:
-
-    bool m_isRValue;
-};
-
-#endif // EIGEN_SPARSEMATRIXBASE_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseProduct.h b/extern/Eigen3/Eigen/src/Sparse/SparseProduct.h
deleted file mode 100644
index 1c1f547..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseProduct.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEPRODUCT_H
-#define EIGEN_SPARSEPRODUCT_H
-
-template<typename Lhs, typename Rhs>
-struct SparseSparseProductReturnType
-{
-  typedef typename internal::traits<Lhs>::Scalar Scalar;
-  enum {
-    LhsRowMajor = internal::traits<Lhs>::Flags & RowMajorBit,
-    RhsRowMajor = internal::traits<Rhs>::Flags & RowMajorBit,
-    TransposeRhs = (!LhsRowMajor) && RhsRowMajor,
-    TransposeLhs = LhsRowMajor && (!RhsRowMajor)
-  };
-
-  typedef typename internal::conditional<TransposeLhs,
-    SparseMatrix<Scalar,0>,
-    const typename internal::nested<Lhs,Rhs::RowsAtCompileTime>::type>::type LhsNested;
-
-  typedef typename internal::conditional<TransposeRhs,
-    SparseMatrix<Scalar,0>,
-    const typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type>::type RhsNested;
-
-  typedef SparseSparseProduct<LhsNested, RhsNested> Type;
-};
-
-namespace internal {
-template<typename LhsNested, typename RhsNested>
-struct traits<SparseSparseProduct<LhsNested, RhsNested> >
-{
-  typedef MatrixXpr XprKind;
-  // clean the nested types:
-  typedef typename remove_all<LhsNested>::type _LhsNested;
-  typedef typename remove_all<RhsNested>::type _RhsNested;
-  typedef typename _LhsNested::Scalar Scalar;
-  typedef typename promote_index_type<typename traits<_LhsNested>::Index,
-                                         typename traits<_RhsNested>::Index>::type Index;
-
-  enum {
-    LhsCoeffReadCost = _LhsNested::CoeffReadCost,
-    RhsCoeffReadCost = _RhsNested::CoeffReadCost,
-    LhsFlags = _LhsNested::Flags,
-    RhsFlags = _RhsNested::Flags,
-
-    RowsAtCompileTime    = _LhsNested::RowsAtCompileTime,
-    ColsAtCompileTime    = _RhsNested::ColsAtCompileTime,
-    MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
-    MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
-
-    InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
-
-    EvalToRowMajor = (RhsFlags & LhsFlags & RowMajorBit),
-
-    RemovedBits = ~(EvalToRowMajor ? 0 : RowMajorBit),
-
-    Flags = (int(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
-          | EvalBeforeAssigningBit
-          | EvalBeforeNestingBit,
-
-    CoeffReadCost = Dynamic
-  };
-
-  typedef Sparse StorageKind;
-};
-
-} // end namespace internal
-
-template<typename LhsNested, typename RhsNested>
-class SparseSparseProduct : internal::no_assignment_operator,
-  public SparseMatrixBase<SparseSparseProduct<LhsNested, RhsNested> >
-{
-  public:
-
-    typedef SparseMatrixBase<SparseSparseProduct> Base;
-    EIGEN_DENSE_PUBLIC_INTERFACE(SparseSparseProduct)
-
-  private:
-
-    typedef typename internal::traits<SparseSparseProduct>::_LhsNested _LhsNested;
-    typedef typename internal::traits<SparseSparseProduct>::_RhsNested _RhsNested;
-
-  public:
-
-    template<typename Lhs, typename Rhs>
-    EIGEN_STRONG_INLINE SparseSparseProduct(const Lhs& lhs, const Rhs& rhs)
-      : m_lhs(lhs), m_rhs(rhs)
-    {
-      eigen_assert(lhs.cols() == rhs.rows());
-
-      enum {
-        ProductIsValid = _LhsNested::ColsAtCompileTime==Dynamic
-                      || _RhsNested::RowsAtCompileTime==Dynamic
-                      || int(_LhsNested::ColsAtCompileTime)==int(_RhsNested::RowsAtCompileTime),
-        AreVectors = _LhsNested::IsVectorAtCompileTime && _RhsNested::IsVectorAtCompileTime,
-        SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(_LhsNested,_RhsNested)
-      };
-      // note to the lost user:
-      //    * for a dot product use: v1.dot(v2)
-      //    * for a coeff-wise product use: v1.cwise()*v2
-      EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
-        INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
-      EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
-        INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
-      EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
-    }
-
-    EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
-    EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
-
-    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
-    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
-
-  protected:
-    LhsNested m_lhs;
-    RhsNested m_rhs;
-};
-
-#endif // EIGEN_SPARSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseRedux.h b/extern/Eigen3/Eigen/src/Sparse/SparseRedux.h
deleted file mode 100644
index afc49de..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseRedux.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEREDUX_H
-#define EIGEN_SPARSEREDUX_H
-
-template<typename Derived>
-typename internal::traits<Derived>::Scalar
-SparseMatrixBase<Derived>::sum() const
-{
-  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
-  Scalar res = 0;
-  for (Index j=0; j<outerSize(); ++j)
-    for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
-      res += iter.value();
-  return res;
-}
-
-template<typename _Scalar, int _Options, typename _Index>
-typename internal::traits<SparseMatrix<_Scalar,_Options,_Index> >::Scalar
-SparseMatrix<_Scalar,_Options,_Index>::sum() const
-{
-  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
-  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
-}
-
-template<typename _Scalar, int _Options, typename _Index>
-typename internal::traits<SparseVector<_Scalar,_Options, _Index> >::Scalar
-SparseVector<_Scalar,_Options,_Index>::sum() const
-{
-  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
-  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
-}
-
-#endif // EIGEN_SPARSEREDUX_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseSelfAdjointView.h b/extern/Eigen3/Eigen/src/Sparse/SparseSelfAdjointView.h
deleted file mode 100644
index d82044c..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseSelfAdjointView.h
+++ /dev/null
@@ -1,454 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_SELFADJOINTVIEW_H
-#define EIGEN_SPARSE_SELFADJOINTVIEW_H
-
-/** \class SparseSelfAdjointView
-  *
-  *
-  * \brief Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
-  *
-  * \param MatrixType the type of the dense matrix storing the coefficients
-  * \param UpLo can be either \c #Lower or \c #Upper
-  *
-  * This class is an expression of a sefladjoint matrix from a triangular part of a matrix
-  * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView()
-  * and most of the time this is the only way that it is used.
-  *
-  * \sa SparseMatrixBase::selfadjointView()
-  */
-template<typename Lhs, typename Rhs, int UpLo>
-class SparseSelfAdjointTimeDenseProduct;
-
-template<typename Lhs, typename Rhs, int UpLo>
-class DenseTimeSparseSelfAdjointProduct;
-
-template<typename MatrixType,int UpLo>
-class SparseSymmetricPermutationProduct;
-
-namespace internal {
-  
-template<typename MatrixType, unsigned int UpLo>
-struct traits<SparseSelfAdjointView<MatrixType,UpLo> > : traits<MatrixType> {
-};
-
-template<int SrcUpLo,int DstUpLo,typename MatrixType,int DestOrder>
-void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm = 0);
-
-template<int UpLo,typename MatrixType,int DestOrder>
-void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm = 0);
-
-}
-
-template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView
-  : public EigenBase<SparseSelfAdjointView<MatrixType,UpLo> >
-{
-  public:
-
-    typedef typename MatrixType::Scalar Scalar;
-    typedef typename MatrixType::Index Index;
-    typedef Matrix<Index,Dynamic,1> VectorI;
-    typedef typename MatrixType::Nested MatrixTypeNested;
-    typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
-
-    inline SparseSelfAdjointView(const MatrixType& matrix) : m_matrix(matrix)
-    {
-      eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
-    }
-
-    inline Index rows() const { return m_matrix.rows(); }
-    inline Index cols() const { return m_matrix.cols(); }
-
-    /** \internal \returns a reference to the nested matrix */
-    const _MatrixTypeNested& matrix() const { return m_matrix; }
-    _MatrixTypeNested& matrix() { return m_matrix.const_cast_derived(); }
-
-    /** Efficient sparse self-adjoint matrix times dense vector/matrix product */
-    template<typename OtherDerived>
-    SparseSelfAdjointTimeDenseProduct<MatrixType,OtherDerived,UpLo>
-    operator*(const MatrixBase<OtherDerived>& rhs) const
-    {
-      return SparseSelfAdjointTimeDenseProduct<MatrixType,OtherDerived,UpLo>(m_matrix, rhs.derived());
-    }
-
-    /** Efficient dense vector/matrix times sparse self-adjoint matrix product */
-    template<typename OtherDerived> friend
-    DenseTimeSparseSelfAdjointProduct<OtherDerived,MatrixType,UpLo>
-    operator*(const MatrixBase<OtherDerived>& lhs, const SparseSelfAdjointView& rhs)
-    {
-      return DenseTimeSparseSelfAdjointProduct<OtherDerived,_MatrixTypeNested,UpLo>(lhs.derived(), rhs.m_matrix);
-    }
-
-    /** Perform a symmetric rank K update of the selfadjoint matrix \c *this:
-      * \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix.
-      *
-      * \returns a reference to \c *this
-      *
-      * Note that it is faster to set alpha=0 than initializing the matrix to zero
-      * and then keep the default value alpha=1.
-      *
-      * To perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply
-      * call this function with u.adjoint().
-      */
-    template<typename DerivedU>
-    SparseSelfAdjointView& rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
-    
-    /** \internal triggered by sparse_matrix = SparseSelfadjointView; */
-    template<typename DestScalar> void evalTo(SparseMatrix<DestScalar>& _dest) const
-    {
-      internal::permute_symm_to_fullsymm<UpLo>(m_matrix, _dest);
-    }
-    
-    template<typename DestScalar> void evalTo(DynamicSparseMatrix<DestScalar>& _dest) const
-    {
-      // TODO directly evaluate into _dest;
-      SparseMatrix<DestScalar> tmp(_dest.rows(),_dest.cols());
-      internal::permute_symm_to_fullsymm<UpLo>(m_matrix, tmp);
-      _dest = tmp;
-    }
-    
-    /** \returns an expression of P^-1 H P */
-    SparseSymmetricPermutationProduct<_MatrixTypeNested,UpLo> twistedBy(const PermutationMatrix<Dynamic>& perm) const
-    {
-      return SparseSymmetricPermutationProduct<_MatrixTypeNested,UpLo>(m_matrix, perm);
-    }
-    
-    template<typename SrcMatrixType,int SrcUpLo>
-    SparseSelfAdjointView& operator=(const SparseSymmetricPermutationProduct<SrcMatrixType,SrcUpLo>& permutedMatrix)
-    {
-      permutedMatrix.evalTo(*this);
-      return *this;
-    }
-    
-
-    // const SparseLLT<PlainObject, UpLo> llt() const;
-    // const SparseLDLT<PlainObject, UpLo> ldlt() const;
-
-  protected:
-
-    const typename MatrixType::Nested m_matrix;
-    mutable VectorI m_countPerRow;
-    mutable VectorI m_countPerCol;
-};
-
-/***************************************************************************
-* Implementation of SparseMatrixBase methods
-***************************************************************************/
-
-template<typename Derived>
-template<unsigned int UpLo>
-const SparseSelfAdjointView<Derived, UpLo> SparseMatrixBase<Derived>::selfadjointView() const
-{
-  return derived();
-}
-
-template<typename Derived>
-template<unsigned int UpLo>
-SparseSelfAdjointView<Derived, UpLo> SparseMatrixBase<Derived>::selfadjointView()
-{
-  return derived();
-}
-
-/***************************************************************************
-* Implementation of SparseSelfAdjointView methods
-***************************************************************************/
-
-template<typename MatrixType, unsigned int UpLo>
-template<typename DerivedU>
-SparseSelfAdjointView<MatrixType,UpLo>&
-SparseSelfAdjointView<MatrixType,UpLo>::rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha)
-{
-  SparseMatrix<Scalar,MatrixType::Flags&RowMajorBit?RowMajor:ColMajor> tmp = u * u.adjoint();
-  if(alpha==Scalar(0))
-    m_matrix.const_cast_derived() = tmp.template triangularView<UpLo>();
-  else
-    m_matrix.const_cast_derived() += alpha * tmp.template triangularView<UpLo>();
-
-  return *this;
-}
-
-/***************************************************************************
-* Implementation of sparse self-adjoint time dense matrix
-***************************************************************************/
-
-namespace internal {
-template<typename Lhs, typename Rhs, int UpLo>
-struct traits<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo> >
- : traits<ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
-{
-  typedef Dense StorageKind;
-};
-}
-
-template<typename Lhs, typename Rhs, int UpLo>
-class SparseSelfAdjointTimeDenseProduct
-  : public ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs>
-{
-  public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(SparseSelfAdjointTimeDenseProduct)
-
-    SparseSelfAdjointTimeDenseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
-    {}
-
-    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
-    {
-      // TODO use alpha
-      eigen_assert(alpha==Scalar(1) && "alpha != 1 is not implemented yet, sorry");
-      typedef typename internal::remove_all<Lhs>::type _Lhs;
-      typedef typename internal::remove_all<Rhs>::type _Rhs;
-      typedef typename _Lhs::InnerIterator LhsInnerIterator;
-      enum {
-        LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit,
-        ProcessFirstHalf =
-                 ((UpLo&(Upper|Lower))==(Upper|Lower))
-              || ( (UpLo&Upper) && !LhsIsRowMajor)
-              || ( (UpLo&Lower) && LhsIsRowMajor),
-        ProcessSecondHalf = !ProcessFirstHalf
-      };
-      for (Index j=0; j<m_lhs.outerSize(); ++j)
-      {
-        LhsInnerIterator i(m_lhs,j);
-        if (ProcessSecondHalf && i && (i.index()==j))
-        {
-          dest.row(j) += i.value() * m_rhs.row(j);
-          ++i;
-        }
-        Block<Dest,1,Dest::ColsAtCompileTime> dest_j(dest.row(LhsIsRowMajor ? j : 0));
-        for(; (ProcessFirstHalf ? i && i.index() < j : i) ; ++i)
-        {
-          Index a = LhsIsRowMajor ? j : i.index();
-          Index b = LhsIsRowMajor ? i.index() : j;
-          typename Lhs::Scalar v = i.value();
-          dest.row(a) += (v) * m_rhs.row(b);
-          dest.row(b) += internal::conj(v) * m_rhs.row(a);
-        }
-        if (ProcessFirstHalf && i && (i.index()==j))
-          dest.row(j) += i.value() * m_rhs.row(j);
-      }
-    }
-
-  private:
-    SparseSelfAdjointTimeDenseProduct& operator=(const SparseSelfAdjointTimeDenseProduct&);
-};
-
-namespace internal {
-template<typename Lhs, typename Rhs, int UpLo>
-struct traits<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo> >
- : traits<ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
-{};
-}
-
-template<typename Lhs, typename Rhs, int UpLo>
-class DenseTimeSparseSelfAdjointProduct
-  : public ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs>
-{
-  public:
-    EIGEN_PRODUCT_PUBLIC_INTERFACE(DenseTimeSparseSelfAdjointProduct)
-
-    DenseTimeSparseSelfAdjointProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
-    {}
-
-    template<typename Dest> void scaleAndAddTo(Dest& /*dest*/, Scalar /*alpha*/) const
-    {
-      // TODO
-    }
-
-  private:
-    DenseTimeSparseSelfAdjointProduct& operator=(const DenseTimeSparseSelfAdjointProduct&);
-};
-
-/***************************************************************************
-* Implementation of symmetric copies and permutations
-***************************************************************************/
-namespace internal {
-  
-template<typename MatrixType, int UpLo>
-struct traits<SparseSymmetricPermutationProduct<MatrixType,UpLo> > : traits<MatrixType> {
-};
-
-template<int UpLo,typename MatrixType,int DestOrder>
-void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm)
-{
-  typedef typename MatrixType::Index Index;
-  typedef typename MatrixType::Scalar Scalar;
-  typedef SparseMatrix<Scalar,DestOrder,Index> Dest;
-  typedef Matrix<Index,Dynamic,1> VectorI;
-  
-  Dest& dest(_dest.derived());
-  enum {
-    StorageOrderMatch = int(Dest::IsRowMajor) == int(MatrixType::IsRowMajor)
-  };
-  eigen_assert(perm==0);
-  Index size = mat.rows();
-  VectorI count;
-  count.resize(size);
-  count.setZero();
-  dest.resize(size,size);
-  for(Index j = 0; j<size; ++j)
-  {
-    Index jp = perm ? perm[j] : j;
-    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
-    {
-      Index i = it.index();
-      Index ip = perm ? perm[i] : i;
-      if(i==j)
-        count[ip]++;
-      else if((UpLo==Lower && i>j) || (UpLo==Upper && i<j))
-      {
-        count[ip]++;
-        count[jp]++;
-      }
-    }
-  }
-  Index nnz = count.sum();
-  
-  // reserve space
-  dest.reserve(nnz);
-  dest._outerIndexPtr()[0] = 0;
-  for(Index j=0; j<size; ++j)
-    dest._outerIndexPtr()[j+1] = dest._outerIndexPtr()[j] + count[j];
-  for(Index j=0; j<size; ++j)
-    count[j] = dest._outerIndexPtr()[j];
-  
-  // copy data
-  for(Index j = 0; j<size; ++j)
-  {
-    Index jp = perm ? perm[j] : j;
-    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
-    {
-      Index i = it.index();
-      Index ip = perm ? perm[i] : i;
-      if(i==j)
-      {
-        int k = count[ip]++;
-        dest._innerIndexPtr()[k] = ip;
-        dest._valuePtr()[k] = it.value();
-      }
-      else if((UpLo==Lower && i>j) || (UpLo==Upper && i<j))
-      {
-        int k = count[jp]++;
-        dest._innerIndexPtr()[k] = ip;
-        dest._valuePtr()[k] = it.value();
-        k = count[ip]++;
-        dest._innerIndexPtr()[k] = jp;
-        dest._valuePtr()[k] = internal::conj(it.value());
-      }
-    }
-  }
-}
-
-template<int SrcUpLo,int DstUpLo,typename MatrixType,int DestOrder>
-void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm)
-{
-  typedef typename MatrixType::Index Index;
-  typedef typename MatrixType::Scalar Scalar;
-  typedef SparseMatrix<Scalar,DestOrder,Index> Dest;
-  Dest& dest(_dest.derived());
-  typedef Matrix<Index,Dynamic,1> VectorI;
-  //internal::conj_if<SrcUpLo!=DstUpLo> cj;
-  
-  Index size = mat.rows();
-  VectorI count(size);
-  count.setZero();
-  dest.resize(size,size);
-  for(Index j = 0; j<size; ++j)
-  {
-    Index jp = perm ? perm[j] : j;
-    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
-    {
-      Index i = it.index();
-      if((SrcUpLo==Lower && i<j) || (SrcUpLo==Upper && i>j))
-        continue;
-                  
-      Index ip = perm ? perm[i] : i;
-      count[DstUpLo==Lower ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
-    }
-  }
-  dest._outerIndexPtr()[0] = 0;
-  for(Index j=0; j<size; ++j)
-    dest._outerIndexPtr()[j+1] = dest._outerIndexPtr()[j] + count[j];
-  dest.resizeNonZeros(dest._outerIndexPtr()[size]);
-  for(Index j=0; j<size; ++j)
-    count[j] = dest._outerIndexPtr()[j];
-  
-  for(Index j = 0; j<size; ++j)
-  {
-    Index jp = perm ? perm[j] : j;
-    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
-    {
-      Index i = it.index();
-      if((SrcUpLo==Lower && i<j) || (SrcUpLo==Upper && i>j))
-        continue;
-                  
-      Index ip = perm? perm[i] : i;
-      Index k = count[DstUpLo==Lower ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
-      dest._innerIndexPtr()[k] = DstUpLo==Lower ? (std::max)(ip,jp) : (std::min)(ip,jp);
-      
-      if((DstUpLo==Lower && ip<jp) || (DstUpLo==Upper && ip>jp))
-        dest._valuePtr()[k] = conj(it.value());
-      else
-        dest._valuePtr()[k] = it.value();
-    }
-  }
-}
-
-}
-
-template<typename MatrixType,int UpLo>
-class SparseSymmetricPermutationProduct
-  : public EigenBase<SparseSymmetricPermutationProduct<MatrixType,UpLo> >
-{
-    typedef PermutationMatrix<Dynamic> Perm;
-  public:
-    typedef typename MatrixType::Scalar Scalar;
-    typedef typename MatrixType::Index Index;
-    typedef Matrix<Index,Dynamic,1> VectorI;
-    typedef typename MatrixType::Nested MatrixTypeNested;
-    typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
-    
-    SparseSymmetricPermutationProduct(const MatrixType& mat, const Perm& perm)
-      : m_matrix(mat), m_perm(perm)
-    {}
-    
-    inline Index rows() const { return m_matrix.rows(); }
-    inline Index cols() const { return m_matrix.cols(); }
-    
-    template<typename DestScalar> void evalTo(SparseMatrix<DestScalar>& _dest) const
-    {
-      internal::permute_symm_to_fullsymm<UpLo>(m_matrix,_dest,m_perm.indices().data());
-    }
-    
-    template<typename DestType,unsigned int DestUpLo> void evalTo(SparseSelfAdjointView<DestType,DestUpLo>& dest) const
-    {
-      internal::permute_symm_to_symm<UpLo,DestUpLo>(m_matrix,dest.matrix(),m_perm.indices().data());
-    }
-    
-  protected:
-    const MatrixTypeNested m_matrix;
-    const Perm& m_perm;
-
-};
-
-#endif // EIGEN_SPARSE_SELFADJOINTVIEW_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseSparseProduct.h b/extern/Eigen3/Eigen/src/Sparse/SparseSparseProduct.h
deleted file mode 100644
index 19abcd1..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseSparseProduct.h
+++ /dev/null
@@ -1,401 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSESPARSEPRODUCT_H
-#define EIGEN_SPARSESPARSEPRODUCT_H
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, typename ResultType>
-static void sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-{
-  typedef typename remove_all<Lhs>::type::Scalar Scalar;
-  typedef typename remove_all<Lhs>::type::Index Index;
-
-  // make sure to call innerSize/outerSize since we fake the storage order.
-  Index rows = lhs.innerSize();
-  Index cols = rhs.outerSize();
-  eigen_assert(lhs.outerSize() == rhs.innerSize());
-
-  std::vector<bool> mask(rows,false);
-  Matrix<Scalar,Dynamic,1> values(rows);
-  Matrix<Index,Dynamic,1>    indices(rows);
-
-  // estimate the number of non zero entries
-  float ratioLhs = float(lhs.nonZeros())/(float(lhs.rows())*float(lhs.cols()));
-  float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
-  float ratioRes = (std::min)(ratioLhs * avgNnzPerRhsColumn, 1.f);
-
-//  int t200 = rows/(log2(200)*1.39);
-//  int t = (rows*100)/139;
-
-  res.resize(rows, cols);
-  res.reserve(Index(ratioRes*rows*cols));
-  // we compute each column of the result, one after the other
-  for (Index j=0; j<cols; ++j)
-  {
-
-    res.startVec(j);
-    Index nnz = 0;
-    for (typename Rhs::InnerIterator rhsIt(rhs, j); rhsIt; ++rhsIt)
-    {
-      Scalar y = rhsIt.value();
-      Index k = rhsIt.index();
-      for (typename Lhs::InnerIterator lhsIt(lhs, k); lhsIt; ++lhsIt)
-      {
-        Index i = lhsIt.index();
-        Scalar x = lhsIt.value();
-        if(!mask[i])
-        {
-          mask[i] = true;
-//           values[i] = x * y;
-//           indices[nnz] = i;
-          ++nnz;
-        }
-        else
-          values[i] += x * y;
-      }
-    }
-    // FIXME reserve nnz non zeros
-    // FIXME implement fast sort algorithms for very small nnz
-    // if the result is sparse enough => use a quick sort
-    // otherwise => loop through the entire vector
-    // In order to avoid to perform an expensive log2 when the
-    // result is clearly very sparse we use a linear bound up to 200.
-//     if((nnz<200 && nnz<t200) || nnz * log2(nnz) < t)
-//     {
-//       if(nnz>1) std::sort(indices.data(),indices.data()+nnz);
-//       for(int k=0; k<nnz; ++k)
-//       {
-//         int i = indices[k];
-//         res.insertBackNoCheck(j,i) = values[i];
-//         mask[i] = false;
-//       }
-//     }
-//     else
-//     {
-//       // dense path
-//       for(int i=0; i<rows; ++i)
-//       {
-//         if(mask[i])
-//         {
-//           mask[i] = false;
-//           res.insertBackNoCheck(j,i) = values[i];
-//         }
-//       }
-//     }
-
-  }
-  res.finalize();
-}
-
-// perform a pseudo in-place sparse * sparse product assuming all matrices are col major
-template<typename Lhs, typename Rhs, typename ResultType>
-static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-{
-//   return sparse_product_impl2(lhs,rhs,res);
-
-  typedef typename remove_all<Lhs>::type::Scalar Scalar;
-  typedef typename remove_all<Lhs>::type::Index Index;
-
-  // make sure to call innerSize/outerSize since we fake the storage order.
-  Index rows = lhs.innerSize();
-  Index cols = rhs.outerSize();
-  //int size = lhs.outerSize();
-  eigen_assert(lhs.outerSize() == rhs.innerSize());
-
-  // allocate a temporary buffer
-  AmbiVector<Scalar,Index> tempVector(rows);
-
-  // estimate the number of non zero entries
-  float ratioLhs = float(lhs.nonZeros())/(float(lhs.rows())*float(lhs.cols()));
-  float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
-  float ratioRes = (std::min)(ratioLhs * avgNnzPerRhsColumn, 1.f);
-
-  // mimics a resizeByInnerOuter:
-  if(ResultType::IsRowMajor)
-    res.resize(cols, rows);
-  else
-    res.resize(rows, cols);
-
-  res.reserve(Index(ratioRes*rows*cols));
-  for (Index j=0; j<cols; ++j)
-  {
-    // let's do a more accurate determination of the nnz ratio for the current column j of res
-    //float ratioColRes = (std::min)(ratioLhs * rhs.innerNonZeros(j), 1.f);
-    // FIXME find a nice way to get the number of nonzeros of a sub matrix (here an inner vector)
-    float ratioColRes = ratioRes;
-    tempVector.init(ratioColRes);
-    tempVector.setZero();
-    for (typename Rhs::InnerIterator rhsIt(rhs, j); rhsIt; ++rhsIt)
-    {
-      // FIXME should be written like this: tmp += rhsIt.value() * lhs.col(rhsIt.index())
-      tempVector.restart();
-      Scalar x = rhsIt.value();
-      for (typename Lhs::InnerIterator lhsIt(lhs, rhsIt.index()); lhsIt; ++lhsIt)
-      {
-        tempVector.coeffRef(lhsIt.index()) += lhsIt.value() * x;
-      }
-    }
-    res.startVec(j);
-    for (typename AmbiVector<Scalar,Index>::Iterator it(tempVector); it; ++it)
-      res.insertBackByOuterInner(j,it.index()) = it.value();
-  }
-  res.finalize();
-}
-
-template<typename Lhs, typename Rhs, typename ResultType,
-  int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
-  int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
-  int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
-struct sparse_product_selector;
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
-{
-  typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
-
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-//     std::cerr << __LINE__ << "\n";
-    typename remove_all<ResultType>::type _res(res.rows(), res.cols());
-    sparse_product_impl<Lhs,Rhs,ResultType>(lhs, rhs, _res);
-    res.swap(_res);
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-//     std::cerr << __LINE__ << "\n";
-    // we need a col-major matrix to hold the result
-    typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
-    SparseTemporaryType _res(res.rows(), res.cols());
-    sparse_product_impl<Lhs,Rhs,SparseTemporaryType>(lhs, rhs, _res);
-    res = _res;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-//     std::cerr << __LINE__ << "\n";
-    // let's transpose the product to get a column x column product
-    typename remove_all<ResultType>::type _res(res.rows(), res.cols());
-    sparse_product_impl<Rhs,Lhs,ResultType>(rhs, lhs, _res);
-    res.swap(_res);
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-//     std::cerr << "here...\n";
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-    ColMajorMatrix colLhs(lhs);
-    ColMajorMatrix colRhs(rhs);
-//     std::cerr << "more...\n";
-    sparse_product_impl<ColMajorMatrix,ColMajorMatrix,ResultType>(colLhs, colRhs, res);
-//     std::cerr << "OK.\n";
-
-    // let's transpose the product to get a column x column product
-
-//     typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
-//     SparseTemporaryType _res(res.cols(), res.rows());
-//     sparse_product_impl<Rhs,Lhs,SparseTemporaryType>(rhs, lhs, _res);
-//     res = _res.transpose();
-  }
-};
-
-// NOTE the 2 others cases (col row *) must never occur since they are caught
-// by ProductReturnType which transforms it to (col col *) by evaluating rhs.
-
-} // end namespace internal
-
-// sparse = sparse * sparse
-template<typename Derived>
-template<typename Lhs, typename Rhs>
-inline Derived& SparseMatrixBase<Derived>::operator=(const SparseSparseProduct<Lhs,Rhs>& product)
-{
-//   std::cerr << "there..." << typeid(Lhs).name() << "  " << typeid(Lhs).name() << " " << (Derived::Flags&&RowMajorBit) << "\n";
-  internal::sparse_product_selector<
-    typename internal::remove_all<Lhs>::type,
-    typename internal::remove_all<Rhs>::type,
-    Derived>::run(product.lhs(),product.rhs(),derived());
-  return derived();
-}
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, typename ResultType,
-  int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
-  int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
-  int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
-struct sparse_product_selector2;
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
-{
-  typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
-
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    sparse_product_impl2<Lhs,Rhs,ResultType>(lhs, rhs, res);
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,ColMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-      // prevent warnings until the code is fixed
-      EIGEN_UNUSED_VARIABLE(lhs);
-      EIGEN_UNUSED_VARIABLE(rhs);
-      EIGEN_UNUSED_VARIABLE(res);
-
-//     typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
-//     RowMajorMatrix rhsRow = rhs;
-//     RowMajorMatrix resRow(res.rows(), res.cols());
-//     sparse_product_impl2<RowMajorMatrix,Lhs,RowMajorMatrix>(rhsRow, lhs, resRow);
-//     res = resRow;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,ColMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
-    RowMajorMatrix lhsRow = lhs;
-    RowMajorMatrix resRow(res.rows(), res.cols());
-    sparse_product_impl2<Rhs,RowMajorMatrix,RowMajorMatrix>(rhs, lhsRow, resRow);
-    res = resRow;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
-    RowMajorMatrix resRow(res.rows(), res.cols());
-    sparse_product_impl2<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
-    res = resRow;
-  }
-};
-
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
-{
-  typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
-
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-    ColMajorMatrix resCol(res.rows(), res.cols());
-    sparse_product_impl2<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
-    res = resCol;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,RowMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-    ColMajorMatrix lhsCol = lhs;
-    ColMajorMatrix resCol(res.rows(), res.cols());
-    sparse_product_impl2<ColMajorMatrix,Rhs,ColMajorMatrix>(lhsCol, rhs, resCol);
-    res = resCol;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,RowMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-    ColMajorMatrix rhsCol = rhs;
-    ColMajorMatrix resCol(res.rows(), res.cols());
-    sparse_product_impl2<Lhs,ColMajorMatrix,ColMajorMatrix>(lhs, rhsCol, resCol);
-    res = resCol;
-  }
-};
-
-template<typename Lhs, typename Rhs, typename ResultType>
-struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
-{
-  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
-  {
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-//     ColMajorMatrix lhsTr(lhs);
-//     ColMajorMatrix rhsTr(rhs);
-//     ColMajorMatrix aux(res.rows(), res.cols());
-//     sparse_product_impl2<Rhs,Lhs,ColMajorMatrix>(rhs, lhs, aux);
-// //     ColMajorMatrix aux2 = aux.transpose();
-//     res = aux;
-    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
-    ColMajorMatrix lhsCol(lhs);
-    ColMajorMatrix rhsCol(rhs);
-    ColMajorMatrix resCol(res.rows(), res.cols());
-    sparse_product_impl2<ColMajorMatrix,ColMajorMatrix,ColMajorMatrix>(lhsCol, rhsCol, resCol);
-    res = resCol;
-  }
-};
-
-} // end namespace internal
-
-template<typename Derived>
-template<typename Lhs, typename Rhs>
-inline void SparseMatrixBase<Derived>::_experimentalNewProduct(const Lhs& lhs, const Rhs& rhs)
-{
-  //derived().resize(lhs.rows(), rhs.cols());
-  internal::sparse_product_selector2<
-    typename internal::remove_all<Lhs>::type,
-    typename internal::remove_all<Rhs>::type,
-    Derived>::run(lhs,rhs,derived());
-}
-
-// sparse * sparse
-template<typename Derived>
-template<typename OtherDerived>
-inline const typename SparseSparseProductReturnType<Derived,OtherDerived>::Type
-SparseMatrixBase<Derived>::operator*(const SparseMatrixBase<OtherDerived> &other) const
-{
-  return typename SparseSparseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
-}
-
-#endif // EIGEN_SPARSESPARSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseTranspose.h b/extern/Eigen3/Eigen/src/Sparse/SparseTranspose.h
deleted file mode 100644
index 2aea2fa..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseTranspose.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSETRANSPOSE_H
-#define EIGEN_SPARSETRANSPOSE_H
-
-template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
-  : public SparseMatrixBase<Transpose<MatrixType> >
-{
-    typedef typename internal::remove_all<typename MatrixType::Nested>::type _MatrixTypeNested;
-  public:
-
-    EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
-
-    class InnerIterator;
-    class ReverseInnerIterator;
-
-    inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
-};
-
-template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerIterator
-  : public _MatrixTypeNested::InnerIterator
-{
-    typedef typename _MatrixTypeNested::InnerIterator Base;
-  public:
-
-    EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, Index outer)
-      : Base(trans.derived().nestedExpression(), outer)
-    {}
-    inline Index row() const { return Base::col(); }
-    inline Index col() const { return Base::row(); }
-};
-
-template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
-  : public _MatrixTypeNested::ReverseInnerIterator
-{
-    typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
-  public:
-
-    EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, Index outer)
-      : Base(xpr.derived().nestedExpression(), outer)
-    {}
-    inline Index row() const { return Base::col(); }
-    inline Index col() const { return Base::row(); }
-};
-
-#endif // EIGEN_SPARSETRANSPOSE_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseTriangularView.h b/extern/Eigen3/Eigen/src/Sparse/SparseTriangularView.h
deleted file mode 100644
index 319eaf0..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseTriangularView.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSE_TRIANGULARVIEW_H
-#define EIGEN_SPARSE_TRIANGULARVIEW_H
-
-namespace internal {
-  
-template<typename MatrixType, int Mode>
-struct traits<SparseTriangularView<MatrixType,Mode> >
-: public traits<MatrixType>
-{};
-
-} // namespace internal
-
-template<typename MatrixType, int Mode> class SparseTriangularView
-  : public SparseMatrixBase<SparseTriangularView<MatrixType,Mode> >
-{
-    enum { SkipFirst = (Mode==Lower && !(MatrixType::Flags&RowMajorBit))
-                    || (Mode==Upper &&  (MatrixType::Flags&RowMajorBit)) };
-  public:
-    
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseTriangularView)
-
-    class InnerIterator;
-
-    inline Index rows() const { return m_matrix.rows(); }
-    inline Index cols() const { return m_matrix.cols(); }
-
-    typedef typename internal::conditional<internal::must_nest_by_value<MatrixType>::ret,
-        MatrixType, const MatrixType&>::type MatrixTypeNested;
-
-    inline SparseTriangularView(const MatrixType& matrix) : m_matrix(matrix) {}
-
-    /** \internal */
-    inline const MatrixType& nestedExpression() const { return m_matrix; }
-
-    template<typename OtherDerived>
-    typename internal::plain_matrix_type_column_major<OtherDerived>::type
-    solve(const MatrixBase<OtherDerived>& other) const;
-
-    template<typename OtherDerived> void solveInPlace(MatrixBase<OtherDerived>& other) const;
-    template<typename OtherDerived> void solveInPlace(SparseMatrixBase<OtherDerived>& other) const;
-
-  protected:
-    MatrixTypeNested m_matrix;
-};
-
-template<typename MatrixType, int Mode>
-class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixType::InnerIterator
-{
-    typedef typename MatrixType::InnerIterator Base;
-  public:
-
-    EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer)
-      : Base(view.nestedExpression(), outer)
-    {
-      if(SkipFirst)
-        while((*this) && this->index()<outer)
-          ++(*this);
-    }
-    inline Index row() const { return Base::row(); }
-    inline Index col() const { return Base::col(); }
-
-    EIGEN_STRONG_INLINE operator bool() const
-    {
-      return SkipFirst ? Base::operator bool() : (Base::operator bool() && this->index() <= this->outer());
-    }
-};
-
-template<typename Derived>
-template<int Mode>
-inline const SparseTriangularView<Derived, Mode>
-SparseMatrixBase<Derived>::triangularView() const
-{
-  return derived();
-}
-
-#endif // EIGEN_SPARSE_TRIANGULARVIEW_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseUtil.h b/extern/Eigen3/Eigen/src/Sparse/SparseUtil.h
deleted file mode 100644
index db9ae98..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseUtil.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEUTIL_H
-#define EIGEN_SPARSEUTIL_H
-
-#ifdef NDEBUG
-#define EIGEN_DBG_SPARSE(X)
-#else
-#define EIGEN_DBG_SPARSE(X) X
-#endif
-
-#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
-template<typename OtherDerived> \
-EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase<OtherDerived>& other) \
-{ \
-  return Base::operator Op(other.derived()); \
-} \
-EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \
-{ \
-  return Base::operator Op(other); \
-}
-
-#define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
-template<typename Other> \
-EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
-{ \
-  return Base::operator Op(scalar); \
-}
-
-#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
-EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
-EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
-EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
-EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
-EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
-
-#define _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, BaseClass) \
-  typedef BaseClass Base; \
-  typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
-  typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
-  typedef typename Eigen::internal::nested<Derived>::type Nested; \
-  typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
-  typedef typename Eigen::internal::traits<Derived>::Index Index; \
-  enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
-        ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
-        Flags = Eigen::internal::traits<Derived>::Flags, \
-        CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
-        SizeAtCompileTime = Base::SizeAtCompileTime, \
-        IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
-  using Base::derived; \
-  using Base::const_cast_derived;
-
-#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
-  _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, Eigen::SparseMatrixBase<Derived>)
-
-const int CoherentAccessPattern     = 0x1;
-const int InnerRandomAccessPattern  = 0x2 | CoherentAccessPattern;
-const int OuterRandomAccessPattern  = 0x4 | CoherentAccessPattern;
-const int RandomAccessPattern       = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
-
-template<typename Derived> class SparseMatrixBase;
-template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseMatrix;
-template<typename _Scalar, int _Flags = 0, typename _Index = int>  class DynamicSparseMatrix;
-template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseVector;
-template<typename _Scalar, int _Flags = 0, typename _Index = int>  class MappedSparseMatrix;
-
-template<typename MatrixType, int Size>           class SparseInnerVectorSet;
-template<typename MatrixType, int Mode>           class SparseTriangularView;
-template<typename MatrixType, unsigned int UpLo>  class SparseSelfAdjointView;
-template<typename Lhs, typename Rhs>              class SparseDiagonalProduct;
-template<typename MatrixType> class SparseView;
-
-template<typename Lhs, typename Rhs>        class SparseSparseProduct;
-template<typename Lhs, typename Rhs>        class SparseTimeDenseProduct;
-template<typename Lhs, typename Rhs>        class DenseTimeSparseProduct;
-template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
-
-template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
-template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
-template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
-
-namespace internal {
-
-template<typename T> struct eval<T,Sparse>
-{
-    typedef typename traits<T>::Scalar _Scalar;
-    enum {
-          _Flags = traits<T>::Flags
-    };
-
-  public:
-    typedef SparseMatrix<_Scalar, _Flags> type;
-};
-
-template<typename T> struct plain_matrix_type<T,Sparse>
-{
-  typedef typename traits<T>::Scalar _Scalar;
-    enum {
-          _Flags = traits<T>::Flags
-    };
-
-  public:
-    typedef SparseMatrix<_Scalar, _Flags> type;
-};
-
-} // end namespace internal
-
-#endif // EIGEN_SPARSEUTIL_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseVector.h b/extern/Eigen3/Eigen/src/Sparse/SparseVector.h
deleted file mode 100644
index ce4bb51..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseVector.h
+++ /dev/null
@@ -1,431 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEVECTOR_H
-#define EIGEN_SPARSEVECTOR_H
-
-/** \class SparseVector
-  *
-  * \brief a sparse vector class
-  *
-  * \tparam _Scalar the scalar type, i.e. the type of the coefficients
-  *
-  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
-  *
-  * This class can be extended with the help of the plugin mechanism described on the page
-  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEVECTOR_PLUGIN.
-  */
-
-namespace internal {
-template<typename _Scalar, int _Options, typename _Index>
-struct traits<SparseVector<_Scalar, _Options, _Index> >
-{
-  typedef _Scalar Scalar;
-  typedef _Index Index;
-  typedef Sparse StorageKind;
-  typedef MatrixXpr XprKind;
-  enum {
-    IsColVector = _Options & RowMajorBit ? 0 : 1,
-
-    RowsAtCompileTime = IsColVector ? Dynamic : 1,
-    ColsAtCompileTime = IsColVector ? 1 : Dynamic,
-    MaxRowsAtCompileTime = RowsAtCompileTime,
-    MaxColsAtCompileTime = ColsAtCompileTime,
-    Flags = _Options | NestByRefBit | LvalueBit,
-    CoeffReadCost = NumTraits<Scalar>::ReadCost,
-    SupportedAccessPatterns = InnerRandomAccessPattern
-  };
-};
-}
-
-template<typename _Scalar, int _Options, typename _Index>
-class SparseVector
-  : public SparseMatrixBase<SparseVector<_Scalar, _Options, _Index> >
-{
-  public:
-    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseVector)
-    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, +=)
-    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, -=)
-//     EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, =)
-
-  protected:
-  public:
-
-    typedef SparseMatrixBase<SparseVector> SparseBase;
-    enum { IsColVector = internal::traits<SparseVector>::IsColVector };
-    
-    enum {
-      Options = _Options
-    };
-
-    CompressedStorage<Scalar,Index> m_data;
-    Index m_size;
-
-    CompressedStorage<Scalar,Index>& _data() { return m_data; }
-    CompressedStorage<Scalar,Index>& _data() const { return m_data; }
-
-  public:
-
-    EIGEN_STRONG_INLINE Index rows() const { return IsColVector ? m_size : 1; }
-    EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; }
-    EIGEN_STRONG_INLINE Index innerSize() const { return m_size; }
-    EIGEN_STRONG_INLINE Index outerSize() const { return 1; }
-    EIGEN_STRONG_INLINE Index innerNonZeros(Index j) const { eigen_assert(j==0); return m_size; }
-
-    EIGEN_STRONG_INLINE const Scalar* _valuePtr() const { return &m_data.value(0); }
-    EIGEN_STRONG_INLINE Scalar* _valuePtr() { return &m_data.value(0); }
-
-    EIGEN_STRONG_INLINE const Index* _innerIndexPtr() const { return &m_data.index(0); }
-    EIGEN_STRONG_INLINE Index* _innerIndexPtr() { return &m_data.index(0); }
-
-    inline Scalar coeff(Index row, Index col) const
-    {
-      eigen_assert((IsColVector ? col : row)==0);
-      return coeff(IsColVector ? row : col);
-    }
-    inline Scalar coeff(Index i) const { return m_data.at(i); }
-
-    inline Scalar& coeffRef(Index row, Index col)
-    {
-      eigen_assert((IsColVector ? col : row)==0);
-      return coeff(IsColVector ? row : col);
-    }
-
-    /** \returns a reference to the coefficient value at given index \a i
-      * This operation involes a log(rho*size) binary search. If the coefficient does not
-      * exist yet, then a sorted insertion into a sequential buffer is performed.
-      *
-      * This insertion might be very costly if the number of nonzeros above \a i is large.
-      */
-    inline Scalar& coeffRef(Index i)
-    {
-      return m_data.atWithInsertion(i);
-    }
-
-  public:
-
-    class InnerIterator;
-
-    inline void setZero() { m_data.clear(); }
-
-    /** \returns the number of non zero coefficients */
-    inline Index nonZeros() const  { return static_cast<Index>(m_data.size()); }
-
-    inline void startVec(Index outer)
-    {
-      eigen_assert(outer==0);
-    }
-
-    inline Scalar& insertBackByOuterInner(Index outer, Index inner)
-    {
-      eigen_assert(outer==0);
-      return insertBack(inner);
-    }
-    inline Scalar& insertBack(Index i)
-    {
-      m_data.append(0, i);
-      return m_data.value(m_data.size()-1);
-    }
-
-    inline Scalar& insert(Index row, Index col)
-    {
-      Index inner = IsColVector ? row : col;
-      Index outer = IsColVector ? col : row;
-      eigen_assert(outer==0);
-      return insert(inner);
-    }
-    Scalar& insert(Index i)
-    {
-      Index startId = 0;
-      Index p = m_data.size() - 1;
-      // TODO smart realloc
-      m_data.resize(p+2,1);
-
-      while ( (p >= startId) && (m_data.index(p) > i) )
-      {
-        m_data.index(p+1) = m_data.index(p);
-        m_data.value(p+1) = m_data.value(p);
-        --p;
-      }
-      m_data.index(p+1) = i;
-      m_data.value(p+1) = 0;
-      return m_data.value(p+1);
-    }
-
-    /**
-      */
-    inline void reserve(Index reserveSize) { m_data.reserve(reserveSize); }
-
-
-    inline void finalize() {}
-
-    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
-    {
-      m_data.prune(reference,epsilon);
-    }
-
-    void resize(Index rows, Index cols)
-    {
-      eigen_assert(rows==1 || cols==1);
-      resize(IsColVector ? rows : cols);
-    }
-
-    void resize(Index newSize)
-    {
-      m_size = newSize;
-      m_data.clear();
-    }
-
-    void resizeNonZeros(Index size) { m_data.resize(size); }
-
-    inline SparseVector() : m_size(0) { resize(0); }
-
-    inline SparseVector(Index size) : m_size(0) { resize(size); }
-
-    inline SparseVector(Index rows, Index cols) : m_size(0) { resize(rows,cols); }
-
-    template<typename OtherDerived>
-    inline SparseVector(const MatrixBase<OtherDerived>& other)
-      : m_size(0)
-    {
-      *this = other.derived();
-    }
-
-    template<typename OtherDerived>
-    inline SparseVector(const SparseMatrixBase<OtherDerived>& other)
-      : m_size(0)
-    {
-      *this = other.derived();
-    }
-
-    inline SparseVector(const SparseVector& other)
-      : m_size(0)
-    {
-      *this = other.derived();
-    }
-
-    inline void swap(SparseVector& other)
-    {
-      std::swap(m_size, other.m_size);
-      m_data.swap(other.m_data);
-    }
-
-    inline SparseVector& operator=(const SparseVector& other)
-    {
-      if (other.isRValue())
-      {
-        swap(other.const_cast_derived());
-      }
-      else
-      {
-        resize(other.size());
-        m_data = other.m_data;
-      }
-      return *this;
-    }
-
-    template<typename OtherDerived>
-    inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other)
-    {
-      if (int(RowsAtCompileTime)!=int(OtherDerived::RowsAtCompileTime))
-        return Base::operator=(other.transpose());
-      else
-        return Base::operator=(other);
-    }
-
-    #ifndef EIGEN_PARSED_BY_DOXYGEN
-    template<typename Lhs, typename Rhs>
-    inline SparseVector& operator=(const SparseSparseProduct<Lhs,Rhs>& product)
-    {
-      return Base::operator=(product);
-    }
-    #endif
-
-//       const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
-//       if (needToTranspose)
-//       {
-//         // two passes algorithm:
-//         //  1 - compute the number of coeffs per dest inner vector
-//         //  2 - do the actual copy/eval
-//         // Since each coeff of the rhs has to be evaluated twice, let's evauluate it if needed
-//         typedef typename internal::nested<OtherDerived,2>::type OtherCopy;
-//         OtherCopy otherCopy(other.derived());
-//         typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
-//
-//         resize(other.rows(), other.cols());
-//         Eigen::Map<VectorXi>(m_outerIndex,outerSize()).setZero();
-//         // pass 1
-//         // FIXME the above copy could be merged with that pass
-//         for (int j=0; j<otherCopy.outerSize(); ++j)
-//           for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
-//             ++m_outerIndex[it.index()];
-//
-//         // prefix sum
-//         int count = 0;
-//         VectorXi positions(outerSize());
-//         for (int j=0; j<outerSize(); ++j)
-//         {
-//           int tmp = m_outerIndex[j];
-//           m_outerIndex[j] = count;
-//           positions[j] = count;
-//           count += tmp;
-//         }
-//         m_outerIndex[outerSize()] = count;
-//         // alloc
-//         m_data.resize(count);
-//         // pass 2
-//         for (int j=0; j<otherCopy.outerSize(); ++j)
-//           for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
-//           {
-//             int pos = positions[it.index()]++;
-//             m_data.index(pos) = j;
-//             m_data.value(pos) = it.value();
-//           }
-//
-//         return *this;
-//       }
-//       else
-//       {
-//         // there is no special optimization
-//         return SparseMatrixBase<SparseMatrix>::operator=(other.derived());
-//       }
-//     }
-
-    friend std::ostream & operator << (std::ostream & s, const SparseVector& m)
-    {
-      for (Index i=0; i<m.nonZeros(); ++i)
-        s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
-      s << std::endl;
-      return s;
-    }
-
-    // this specialized version does not seems to be faster
-//     Scalar dot(const SparseVector& other) const
-//     {
-//       int i=0, j=0;
-//       Scalar res = 0;
-//       asm("#begindot");
-//       while (i<nonZeros() && j<other.nonZeros())
-//       {
-//         if (m_data.index(i)==other.m_data.index(j))
-//         {
-//           res += m_data.value(i) * internal::conj(other.m_data.value(j));
-//           ++i; ++j;
-//         }
-//         else if (m_data.index(i)<other.m_data.index(j))
-//           ++i;
-//         else
-//           ++j;
-//       }
-//       asm("#enddot");
-//       return res;
-//     }
-
-    /** Destructor */
-    inline ~SparseVector() {}
-
-    /** Overloaded for performance */
-    Scalar sum() const;
-
-  public:
-
-    /** \deprecated use setZero() and reserve() */
-    EIGEN_DEPRECATED void startFill(Index reserve)
-    {
-      setZero();
-      m_data.reserve(reserve);
-    }
-
-    /** \deprecated use insertBack(Index,Index) */
-    EIGEN_DEPRECATED Scalar& fill(Index r, Index c)
-    {
-      eigen_assert(r==0 || c==0);
-      return fill(IsColVector ? r : c);
-    }
-
-    /** \deprecated use insertBack(Index) */
-    EIGEN_DEPRECATED Scalar& fill(Index i)
-    {
-      m_data.append(0, i);
-      return m_data.value(m_data.size()-1);
-    }
-
-    /** \deprecated use insert(Index,Index) */
-    EIGEN_DEPRECATED Scalar& fillrand(Index r, Index c)
-    {
-      eigen_assert(r==0 || c==0);
-      return fillrand(IsColVector ? r : c);
-    }
-
-    /** \deprecated use insert(Index) */
-    EIGEN_DEPRECATED Scalar& fillrand(Index i)
-    {
-      return insert(i);
-    }
-
-    /** \deprecated use finalize() */
-    EIGEN_DEPRECATED void endFill() {}
-    
-#   ifdef EIGEN_SPARSEVECTOR_PLUGIN
-#     include EIGEN_SPARSEVECTOR_PLUGIN
-#   endif
-};
-
-template<typename Scalar, int _Options, typename _Index>
-class SparseVector<Scalar,_Options,_Index>::InnerIterator
-{
-  public:
-    InnerIterator(const SparseVector& vec, Index outer=0)
-      : m_data(vec.m_data), m_id(0), m_end(static_cast<Index>(m_data.size()))
-    {
-      eigen_assert(outer==0);
-    }
-
-    InnerIterator(const CompressedStorage<Scalar,Index>& data)
-      : m_data(data), m_id(0), m_end(static_cast<Index>(m_data.size()))
-    {}
-
-    template<unsigned int Added, unsigned int Removed>
-    InnerIterator(const Flagged<SparseVector,Added,Removed>& vec, Index )
-      : m_data(vec._expression().m_data), m_id(0), m_end(m_data.size())
-    {}
-
-    inline InnerIterator& operator++() { m_id++; return *this; }
-
-    inline Scalar value() const { return m_data.value(m_id); }
-    inline Scalar& valueRef() { return const_cast<Scalar&>(m_data.value(m_id)); }
-
-    inline Index index() const { return m_data.index(m_id); }
-    inline Index row() const { return IsColVector ? index() : 0; }
-    inline Index col() const { return IsColVector ? 0 : index(); }
-
-    inline operator bool() const { return (m_id < m_end); }
-
-  protected:
-    const CompressedStorage<Scalar,Index>& m_data;
-    Index m_id;
-    const Index m_end;
-};
-
-#endif // EIGEN_SPARSEVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseView.h b/extern/Eigen3/Eigen/src/Sparse/SparseView.h
deleted file mode 100644
index 2430656..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/SparseView.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
-// Copyright (C) 2010 Daniel Lowengrub <lowdanie at gmail.com>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSEVIEW_H
-#define EIGEN_SPARSEVIEW_H
-
-namespace internal {
-
-template<typename MatrixType>
-struct traits<SparseView<MatrixType> > : traits<MatrixType>
-{
-  typedef int Index;
-  typedef Sparse StorageKind;
-  enum {
-    Flags = int(traits<MatrixType>::Flags) & (RowMajorBit)
-  };
-};
-
-} // end namespace internal
-
-template<typename MatrixType>
-class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
-{
-  typedef typename MatrixType::Nested MatrixTypeNested;
-  typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
-public:
-  EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
-
-  SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0),
-             typename NumTraits<Scalar>::Real m_epsilon = NumTraits<Scalar>::dummy_precision()) : 
-    m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {}
-
-  class InnerIterator;
-
-  inline Index rows() const { return m_matrix.rows(); }
-  inline Index cols() const { return m_matrix.cols(); }
-
-  inline Index innerSize() const { return m_matrix.innerSize(); }
-  inline Index outerSize() const { return m_matrix.outerSize(); }
-
-protected:
-  const MatrixTypeNested m_matrix;
-  Scalar m_reference;
-  typename NumTraits<Scalar>::Real m_epsilon;
-};
-
-template<typename MatrixType>
-class SparseView<MatrixType>::InnerIterator : public _MatrixTypeNested::InnerIterator
-{
-public:
-  typedef typename _MatrixTypeNested::InnerIterator IterBase;
-  InnerIterator(const SparseView& view, Index outer) :
-  IterBase(view.m_matrix, outer), m_view(view)
-  {
-    incrementToNonZero();
-  }
-
-  EIGEN_STRONG_INLINE InnerIterator& operator++()
-  {
-    IterBase::operator++();
-    incrementToNonZero();
-    return *this;
-  }
-
-  using IterBase::value;
-
-protected:
-  const SparseView& m_view;
-
-private:
-  void incrementToNonZero()
-  {
-    while(internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon) && (bool(*this)))
-      {
-        IterBase::operator++();
-      }
-  }
-};
-
-template<typename Derived>
-const SparseView<Derived> MatrixBase<Derived>::sparseView(const Scalar& m_reference,
-                                                          typename NumTraits<Scalar>::Real m_epsilon) const
-{
-  return SparseView<Derived>(derived(), m_reference, m_epsilon);
-}
-
-#endif
diff --git a/extern/Eigen3/Eigen/src/Sparse/TriangularSolver.h b/extern/Eigen3/Eigen/src/Sparse/TriangularSolver.h
deleted file mode 100644
index 62bb8bb..0000000
--- a/extern/Eigen3/Eigen/src/Sparse/TriangularSolver.h
+++ /dev/null
@@ -1,339 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SPARSETRIANGULARSOLVER_H
-#define EIGEN_SPARSETRIANGULARSOLVER_H
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, int Mode,
-  int UpLo = (Mode & Lower)
-           ? Lower
-           : (Mode & Upper)
-           ? Upper
-           : -1,
-  int StorageOrder = int(traits<Lhs>::Flags) & RowMajorBit>
-struct sparse_solve_triangular_selector;
-
-// forward substitution, row-major
-template<typename Lhs, typename Rhs, int Mode>
-struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
-{
-  typedef typename Rhs::Scalar Scalar;
-  static void run(const Lhs& lhs, Rhs& other)
-  {
-    for(int col=0 ; col<other.cols() ; ++col)
-    {
-      for(int i=0; i<lhs.rows(); ++i)
-      {
-        Scalar tmp = other.coeff(i,col);
-        Scalar lastVal = 0;
-        int lastIndex = 0;
-        for(typename Lhs::InnerIterator it(lhs, i); it; ++it)
-        {
-          lastVal = it.value();
-          lastIndex = it.index();
-          if(lastIndex==i)
-            break;
-          tmp -= lastVal * other.coeff(lastIndex,col);
-        }
-        if (Mode & UnitDiag)
-          other.coeffRef(i,col) = tmp;
-        else
-        {
-          eigen_assert(lastIndex==i);
-          other.coeffRef(i,col) = tmp/lastVal;
-        }
-      }
-    }
-  }
-};
-
-// backward substitution, row-major
-template<typename Lhs, typename Rhs, int Mode>
-struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
-{
-  typedef typename Rhs::Scalar Scalar;
-  static void run(const Lhs& lhs, Rhs& other)
-  {
-    for(int col=0 ; col<other.cols() ; ++col)
-    {
-      for(int i=lhs.rows()-1 ; i>=0 ; --i)
-      {
-        Scalar tmp = other.coeff(i,col);
-        typename Lhs::InnerIterator it(lhs, i);
-        if (it && it.index() == i)
-          ++it;
-        for(; it; ++it)
-        {
-          tmp -= it.value() * other.coeff(it.index(),col);
-        }
-
-        if (Mode & UnitDiag)
-          other.coeffRef(i,col) = tmp;
-        else
-        {
-          typename Lhs::InnerIterator it(lhs, i);
-          eigen_assert(it && it.index() == i);
-          other.coeffRef(i,col) = tmp/it.value();
-        }
-      }
-    }
-  }
-};
-
-// forward substitution, col-major
-template<typename Lhs, typename Rhs, int Mode>
-struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
-{
-  typedef typename Rhs::Scalar Scalar;
-  static void run(const Lhs& lhs, Rhs& other)
-  {
-    for(int col=0 ; col<other.cols() ; ++col)
-    {
-      for(int i=0; i<lhs.cols(); ++i)
-      {
-        Scalar& tmp = other.coeffRef(i,col);
-        if (tmp!=Scalar(0)) // optimization when other is actually sparse
-        {
-          typename Lhs::InnerIterator it(lhs, i);
-          if(!(Mode & UnitDiag))
-          {
-            eigen_assert(it.index()==i);
-            tmp /= it.value();
-          }
-          if (it && it.index()==i)
-            ++it;
-          for(; it; ++it)
-            other.coeffRef(it.index(), col) -= tmp * it.value();
-        }
-      }
-    }
-  }
-};
-
-// backward substitution, col-major
-template<typename Lhs, typename Rhs, int Mode>
-struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor>
-{
-  typedef typename Rhs::Scalar Scalar;
-  static void run(const Lhs& lhs, Rhs& other)
-  {
-    for(int col=0 ; col<other.cols() ; ++col)
-    {
-      for(int i=lhs.cols()-1; i>=0; --i)
-      {
-        Scalar& tmp = other.coeffRef(i,col);
-        if (tmp!=Scalar(0)) // optimization when other is actually sparse
-        {
-          if(!(Mode & UnitDiag))
-          {
-            // FIXME lhs.coeff(i,i) might not be always efficient while it must simply be the
-            // last element of the column !
-            other.coeffRef(i,col) /= lhs.innerVector(i).lastCoeff();
-          }
-          typename Lhs::InnerIterator it(lhs, i);
-          for(; it && it.index()<i; ++it)
-            other.coeffRef(it.index(), col) -= tmp * it.value();
-        }
-      }
-    }
-  }
-};
-
-} // end namespace internal
-
-template<typename ExpressionType,int Mode>
-template<typename OtherDerived>
-void SparseTriangularView<ExpressionType,Mode>::solveInPlace(MatrixBase<OtherDerived>& other) const
-{
-  eigen_assert(m_matrix.cols() == m_matrix.rows());
-  eigen_assert(m_matrix.cols() == other.rows());
-  eigen_assert(!(Mode & ZeroDiag));
-  eigen_assert((Mode & (Upper|Lower)) != 0);
-
-  enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
-
-  typedef typename internal::conditional<copy,
-    typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
-  OtherCopy otherCopy(other.derived());
-
-  internal::sparse_solve_triangular_selector<ExpressionType, typename internal::remove_reference<OtherCopy>::type, Mode>::run(m_matrix, otherCopy);
-
-  if (copy)
-    other = otherCopy;
-}
-
-template<typename ExpressionType,int Mode>
-template<typename OtherDerived>
-typename internal::plain_matrix_type_column_major<OtherDerived>::type
-SparseTriangularView<ExpressionType,Mode>::solve(const MatrixBase<OtherDerived>& other) const
-{
-  typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
-  solveInPlace(res);
-  return res;
-}
-
-// pure sparse path
-
-namespace internal {
-
-template<typename Lhs, typename Rhs, int Mode,
-  int UpLo = (Mode & Lower)
-           ? Lower
-           : (Mode & Upper)
-           ? Upper
-           : -1,
-  int StorageOrder = int(Lhs::Flags) & (RowMajorBit)>
-struct sparse_solve_triangular_sparse_selector;
-
-// forward substitution, col-major
-template<typename Lhs, typename Rhs, int Mode, int UpLo>
-struct sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
-{
-  typedef typename Rhs::Scalar Scalar;
-  typedef typename promote_index_type<typename traits<Lhs>::Index,
-                                         typename traits<Rhs>::Index>::type Index;
-  static void run(const Lhs& lhs, Rhs& other)
-  {
-    const bool IsLower = (UpLo==Lower);
-    AmbiVector<Scalar,Index> tempVector(other.rows()*2);
-    tempVector.setBounds(0,other.rows());
-
-    Rhs res(other.rows(), other.cols());
-    res.reserve(other.nonZeros());
-
-    for(int col=0 ; col<other.cols() ; ++col)
-    {
-      // FIXME estimate number of non zeros
-      tempVector.init(.99/*float(other.col(col).nonZeros())/float(other.rows())*/);
-      tempVector.setZero();
-      tempVector.restart();
-      for (typename Rhs::InnerIterator rhsIt(other, col); rhsIt; ++rhsIt)
-      {
-        tempVector.coeffRef(rhsIt.index()) = rhsIt.value();
-      }
-
-      for(int i=IsLower?0:lhs.cols()-1;
-          IsLower?i<lhs.cols():i>=0;
-          i+=IsLower?1:-1)
-      {
-        tempVector.restart();
-        Scalar& ci = tempVector.coeffRef(i);
-        if (ci!=Scalar(0))
-        {
-          // find
-          typename Lhs::InnerIterator it(lhs, i);
-          if(!(Mode & UnitDiag))
-          {
-            if (IsLower)
-            {
-              eigen_assert(it.index()==i);
-              ci /= it.value();
-            }
-            else
-              ci /= lhs.coeff(i,i);
-          }
-          tempVector.restart();
-          if (IsLower)
-          {
-            if (it.index()==i)
-              ++it;
-            for(; it; ++it)
-              tempVector.coeffRef(it.index()) -= ci * it.value();
-          }
-          else
-          {
-            for(; it && it.index()<i; ++it)
-              tempVector.coeffRef(it.index()) -= ci * it.value();
-          }
-        }
-      }
-
-
-      int count = 0;
-      // FIXME compute a reference value to filter zeros
-      for (typename AmbiVector<Scalar,Index>::Iterator it(tempVector/*,1e-12*/); it; ++it)
-      {
-        ++ count;
-//         std::cerr << "fill " << it.index() << ", " << col << "\n";
-//         std::cout << it.value() << "  ";
-        // FIXME use insertBack
-        res.insert(it.index(), col) = it.value();
-      }
-//       std::cout << "tempVector.nonZeros() == " << int(count) << " / " << (other.rows()) << "\n";
-    }
-    res.finalize();
-    other = res.markAsRValue();
-  }
-};
-
-} // end namespace internal
-
-template<typename ExpressionType,int Mode>
-template<typename OtherDerived>
-void SparseTriangularView<ExpressionType,Mode>::solveInPlace(SparseMatrixBase<OtherDerived>& other) const
-{
-  eigen_assert(m_matrix.cols() == m_matrix.rows());
-  eigen_assert(m_matrix.cols() == other.rows());
-  eigen_assert(!(Mode & ZeroDiag));
-  eigen_assert((Mode & (Upper|Lower)) != 0);
-
-//   enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
-
-//   typedef typename internal::conditional<copy,
-//     typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
-//   OtherCopy otherCopy(other.derived());
-
-  internal::sparse_solve_triangular_sparse_selector<ExpressionType, OtherDerived, Mode>::run(m_matrix, other.derived());
-
-//   if (copy)
-//     other = otherCopy;
-}
-
-#ifdef EIGEN2_SUPPORT
-
-// deprecated stuff:
-
-/** \deprecated */
-template<typename Derived>
-template<typename OtherDerived>
-void SparseMatrixBase<Derived>::solveTriangularInPlace(MatrixBase<OtherDerived>& other) const
-{
-  this->template triangular<Flags&(Upper|Lower)>().solveInPlace(other);
-}
-
-/** \deprecated */
-template<typename Derived>
-template<typename OtherDerived>
-typename internal::plain_matrix_type_column_major<OtherDerived>::type
-SparseMatrixBase<Derived>::solveTriangular(const MatrixBase<OtherDerived>& other) const
-{
-  typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
-  derived().solveTriangularInPlace(res);
-  return res;
-}
-#endif // EIGEN2_SUPPORT
-
-#endif // EIGEN_SPARSETRIANGULARSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h b/extern/Eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h
new file mode 100644
index 0000000..9bf38ab
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h
@@ -0,0 +1,873 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/*
+
+NOTE: the _symbolic, and _numeric functions has been adapted from
+      the LDL library:
+
+LDL Copyright (c) 2005 by Timothy A. Davis.  All Rights Reserved.
+
+LDL License:
+
+    Your use or distribution of LDL or any modified version of
+    LDL implies that you agree to this License.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+    USA
+
+    Permission is hereby granted to use or copy this program under the
+    terms of the GNU LGPL, provided that the Copyright, this License,
+    and the Availability of the original version is retained on all copies.
+    User documentation of any code that uses this code or any modified
+    version of this code must cite the Copyright, this License, the
+    Availability note, and "Used by permission." Permission to modify
+    the code and to distribute modified code is granted, provided the
+    Copyright, this License, and the Availability note are retained,
+    and a notice that the code was modified is included.
+ */
+
+#include "../Core/util/NonMPL2.h"
+
+#ifndef EIGEN_SIMPLICIAL_CHOLESKY_H
+#define EIGEN_SIMPLICIAL_CHOLESKY_H
+
+namespace Eigen { 
+
+enum SimplicialCholeskyMode {
+  SimplicialCholeskyLLT,
+  SimplicialCholeskyLDLT
+};
+
+/** \ingroup SparseCholesky_Module
+  * \brief A direct sparse Cholesky factorizations
+  *
+  * These classes provide LL^T and LDL^T Cholesky factorizations of sparse matrices that are
+  * selfadjoint and positive definite. The factorization allows for solving A.X = B where
+  * X and B can be either dense or sparse.
+  * 
+  * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
+  * such that the factorized matrix is P A P^-1.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  */
+template<typename Derived>
+class SimplicialCholeskyBase : internal::noncopyable
+{
+  public:
+    typedef typename internal::traits<Derived>::MatrixType MatrixType;
+    enum { UpLo = internal::traits<Derived>::UpLo };
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
+    typedef Matrix<Scalar,Dynamic,1> VectorType;
+
+  public:
+
+    /** Default constructor */
+    SimplicialCholeskyBase()
+      : m_info(Success), m_isInitialized(false), m_shiftOffset(0), m_shiftScale(1)
+    {}
+
+    SimplicialCholeskyBase(const MatrixType& matrix)
+      : m_info(Success), m_isInitialized(false), m_shiftOffset(0), m_shiftScale(1)
+    {
+      derived().compute(matrix);
+    }
+
+    ~SimplicialCholeskyBase()
+    {
+    }
+
+    Derived& derived() { return *static_cast<Derived*>(this); }
+    const Derived& derived() const { return *static_cast<const Derived*>(this); }
+    
+    inline Index cols() const { return m_matrix.cols(); }
+    inline Index rows() const { return m_matrix.rows(); }
+    
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<SimplicialCholeskyBase, Rhs>
+    solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "SimplicialCholeskyBase::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<SimplicialCholeskyBase, Rhs>(*this, b.derived());
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::sparse_solve_retval<SimplicialCholeskyBase, Rhs>
+    solve(const SparseMatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "SimplicialCholesky::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::sparse_solve_retval<SimplicialCholeskyBase, Rhs>(*this, b.derived());
+    }
+    
+    /** \returns the permutation P
+      * \sa permutationPinv() */
+    const PermutationMatrix<Dynamic,Dynamic,Index>& permutationP() const
+    { return m_P; }
+    
+    /** \returns the inverse P^-1 of the permutation P
+      * \sa permutationP() */
+    const PermutationMatrix<Dynamic,Dynamic,Index>& permutationPinv() const
+    { return m_Pinv; }
+
+    /** Sets the shift parameters that will be used to adjust the diagonal coefficients during the numerical factorization.
+      *
+      * During the numerical factorization, the diagonal coefficients are transformed by the following linear model:\n
+      * \c d_ii = \a offset + \a scale * \c d_ii
+      *
+      * The default is the identity transformation with \a offset=0, and \a scale=1.
+      *
+      * \returns a reference to \c *this.
+      */
+    Derived& setShift(const RealScalar& offset, const RealScalar& scale = 1)
+    {
+      m_shiftOffset = offset;
+      m_shiftScale = scale;
+      return derived();
+    }
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** \internal */
+    template<typename Stream>
+    void dumpMemory(Stream& s)
+    {
+      int total = 0;
+      s << "  L:        " << ((total+=(m_matrix.cols()+1) * sizeof(int) + m_matrix.nonZeros()*(sizeof(int)+sizeof(Scalar))) >> 20) << "Mb" << "\n";
+      s << "  diag:     " << ((total+=m_diag.size() * sizeof(Scalar)) >> 20) << "Mb" << "\n";
+      s << "  tree:     " << ((total+=m_parent.size() * sizeof(int)) >> 20) << "Mb" << "\n";
+      s << "  nonzeros: " << ((total+=m_nonZerosPerCol.size() * sizeof(int)) >> 20) << "Mb" << "\n";
+      s << "  perm:     " << ((total+=m_P.size() * sizeof(int)) >> 20) << "Mb" << "\n";
+      s << "  perm^-1:  " << ((total+=m_Pinv.size() * sizeof(int)) >> 20) << "Mb" << "\n";
+      s << "  TOTAL:    " << (total>> 20) << "Mb" << "\n";
+    }
+
+    /** \internal */
+    template<typename Rhs,typename Dest>
+    void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
+    {
+      eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      eigen_assert(m_matrix.rows()==b.rows());
+
+      if(m_info!=Success)
+        return;
+
+      if(m_P.size()>0)
+        dest = m_P * b;
+      else
+        dest = b;
+
+      if(m_matrix.nonZeros()>0) // otherwise L==I
+        derived().matrixL().solveInPlace(dest);
+
+      if(m_diag.size()>0)
+        dest = m_diag.asDiagonal().inverse() * dest;
+
+      if (m_matrix.nonZeros()>0) // otherwise U==I
+        derived().matrixU().solveInPlace(dest);
+
+      if(m_P.size()>0)
+        dest = m_Pinv * dest;
+    }
+
+    /** \internal */
+    template<typename Rhs, typename DestScalar, int DestOptions, typename DestIndex>
+    void _solve_sparse(const Rhs& b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
+    {
+      eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      eigen_assert(m_matrix.rows()==b.rows());
+      
+      // we process the sparse rhs per block of NbColsAtOnce columns temporarily stored into a dense matrix.
+      static const int NbColsAtOnce = 4;
+      int rhsCols = b.cols();
+      int size = b.rows();
+      Eigen::Matrix<DestScalar,Dynamic,Dynamic> tmp(size,rhsCols);
+      for(int k=0; k<rhsCols; k+=NbColsAtOnce)
+      {
+        int actualCols = std::min<int>(rhsCols-k, NbColsAtOnce);
+        tmp.leftCols(actualCols) = b.middleCols(k,actualCols);
+        tmp.leftCols(actualCols) = derived().solve(tmp.leftCols(actualCols));
+        dest.middleCols(k,actualCols) = tmp.leftCols(actualCols).sparseView();
+      }
+    }
+
+#endif // EIGEN_PARSED_BY_DOXYGEN
+
+  protected:
+    
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    template<bool DoLDLT>
+    void compute(const MatrixType& matrix)
+    {
+      eigen_assert(matrix.rows()==matrix.cols());
+      Index size = matrix.cols();
+      CholMatrixType ap(size,size);
+      ordering(matrix, ap);
+      analyzePattern_preordered(ap, DoLDLT);
+      factorize_preordered<DoLDLT>(ap);
+    }
+    
+    template<bool DoLDLT>
+    void factorize(const MatrixType& a)
+    {
+      eigen_assert(a.rows()==a.cols());
+      int size = a.cols();
+      CholMatrixType ap(size,size);
+      ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
+      factorize_preordered<DoLDLT>(ap);
+    }
+
+    template<bool DoLDLT>
+    void factorize_preordered(const CholMatrixType& a);
+
+    void analyzePattern(const MatrixType& a, bool doLDLT)
+    {
+      eigen_assert(a.rows()==a.cols());
+      int size = a.cols();
+      CholMatrixType ap(size,size);
+      ordering(a, ap);
+      analyzePattern_preordered(ap,doLDLT);
+    }
+    void analyzePattern_preordered(const CholMatrixType& a, bool doLDLT);
+    
+    void ordering(const MatrixType& a, CholMatrixType& ap);
+
+    /** keeps off-diagonal entries; drops diagonal entries */
+    struct keep_diag {
+      inline bool operator() (const Index& row, const Index& col, const Scalar&) const
+      {
+        return row!=col;
+      }
+    };
+
+    mutable ComputationInfo m_info;
+    bool m_isInitialized;
+    bool m_factorizationIsOk;
+    bool m_analysisIsOk;
+    
+    CholMatrixType m_matrix;
+    VectorType m_diag;                                // the diagonal coefficients (LDLT mode)
+    VectorXi m_parent;                                // elimination tree
+    VectorXi m_nonZerosPerCol;
+    PermutationMatrix<Dynamic,Dynamic,Index> m_P;     // the permutation
+    PermutationMatrix<Dynamic,Dynamic,Index> m_Pinv;  // the inverse permutation
+
+    RealScalar m_shiftOffset;
+    RealScalar m_shiftScale;
+};
+
+template<typename _MatrixType, int _UpLo = Lower> class SimplicialLLT;
+template<typename _MatrixType, int _UpLo = Lower> class SimplicialLDLT;
+template<typename _MatrixType, int _UpLo = Lower> class SimplicialCholesky;
+
+namespace internal {
+
+template<typename _MatrixType, int _UpLo> struct traits<SimplicialLLT<_MatrixType,_UpLo> >
+{
+  typedef _MatrixType MatrixType;
+  enum { UpLo = _UpLo };
+  typedef typename MatrixType::Scalar                         Scalar;
+  typedef typename MatrixType::Index                          Index;
+  typedef SparseMatrix<Scalar, ColMajor, Index>               CholMatrixType;
+  typedef SparseTriangularView<CholMatrixType, Eigen::Lower>  MatrixL;
+  typedef SparseTriangularView<typename CholMatrixType::AdjointReturnType, Eigen::Upper>   MatrixU;
+  static inline MatrixL getL(const MatrixType& m) { return m; }
+  static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
+};
+
+template<typename _MatrixType,int _UpLo> struct traits<SimplicialLDLT<_MatrixType,_UpLo> >
+{
+  typedef _MatrixType MatrixType;
+  enum { UpLo = _UpLo };
+  typedef typename MatrixType::Scalar                             Scalar;
+  typedef typename MatrixType::Index                              Index;
+  typedef SparseMatrix<Scalar, ColMajor, Index>                   CholMatrixType;
+  typedef SparseTriangularView<CholMatrixType, Eigen::UnitLower>  MatrixL;
+  typedef SparseTriangularView<typename CholMatrixType::AdjointReturnType, Eigen::UnitUpper> MatrixU;
+  static inline MatrixL getL(const MatrixType& m) { return m; }
+  static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
+};
+
+template<typename _MatrixType, int _UpLo> struct traits<SimplicialCholesky<_MatrixType,_UpLo> >
+{
+  typedef _MatrixType MatrixType;
+  enum { UpLo = _UpLo };
+};
+
+}
+
+/** \ingroup SparseCholesky_Module
+  * \class SimplicialLLT
+  * \brief A direct sparse LLT Cholesky factorizations
+  *
+  * This class provides a LL^T Cholesky factorizations of sparse matrices that are
+  * selfadjoint and positive definite. The factorization allows for solving A.X = B where
+  * X and B can be either dense or sparse.
+  * 
+  * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
+  * such that the factorized matrix is P A P^-1.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * \sa class SimplicialLDLT
+  */
+template<typename _MatrixType, int _UpLo>
+    class SimplicialLLT : public SimplicialCholeskyBase<SimplicialLLT<_MatrixType,_UpLo> >
+{
+public:
+    typedef _MatrixType MatrixType;
+    enum { UpLo = _UpLo };
+    typedef SimplicialCholeskyBase<SimplicialLLT> Base;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
+    typedef Matrix<Scalar,Dynamic,1> VectorType;
+    typedef internal::traits<SimplicialLLT> Traits;
+    typedef typename Traits::MatrixL  MatrixL;
+    typedef typename Traits::MatrixU  MatrixU;
+public:
+    /** Default constructor */
+    SimplicialLLT() : Base() {}
+    /** Constructs and performs the LLT factorization of \a matrix */
+    SimplicialLLT(const MatrixType& matrix)
+        : Base(matrix) {}
+
+    /** \returns an expression of the factor L */
+    inline const MatrixL matrixL() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized");
+        return Traits::getL(Base::m_matrix);
+    }
+
+    /** \returns an expression of the factor U (= L^*) */
+    inline const MatrixU matrixU() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized");
+        return Traits::getU(Base::m_matrix);
+    }
+    
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    SimplicialLLT& compute(const MatrixType& matrix)
+    {
+      Base::template compute<false>(matrix);
+      return *this;
+    }
+
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      *
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& a)
+    {
+      Base::analyzePattern(a, false);
+    }
+
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& a)
+    {
+      Base::template factorize<false>(a);
+    }
+
+    /** \returns the determinant of the underlying matrix from the current factorization */
+    Scalar determinant() const
+    {
+      Scalar detL = Base::m_matrix.diagonal().prod();
+      return internal::abs2(detL);
+    }
+};
+
+/** \ingroup SparseCholesky_Module
+  * \class SimplicialLDLT
+  * \brief A direct sparse LDLT Cholesky factorizations without square root.
+  *
+  * This class provides a LDL^T Cholesky factorizations without square root of sparse matrices that are
+  * selfadjoint and positive definite. The factorization allows for solving A.X = B where
+  * X and B can be either dense or sparse.
+  * 
+  * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
+  * such that the factorized matrix is P A P^-1.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+  *               or Upper. Default is Lower.
+  *
+  * \sa class SimplicialLLT
+  */
+template<typename _MatrixType, int _UpLo>
+    class SimplicialLDLT : public SimplicialCholeskyBase<SimplicialLDLT<_MatrixType,_UpLo> >
+{
+public:
+    typedef _MatrixType MatrixType;
+    enum { UpLo = _UpLo };
+    typedef SimplicialCholeskyBase<SimplicialLDLT> Base;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
+    typedef Matrix<Scalar,Dynamic,1> VectorType;
+    typedef internal::traits<SimplicialLDLT> Traits;
+    typedef typename Traits::MatrixL  MatrixL;
+    typedef typename Traits::MatrixU  MatrixU;
+public:
+    /** Default constructor */
+    SimplicialLDLT() : Base() {}
+
+    /** Constructs and performs the LLT factorization of \a matrix */
+    SimplicialLDLT(const MatrixType& matrix)
+        : Base(matrix) {}
+
+    /** \returns a vector expression of the diagonal D */
+    inline const VectorType vectorD() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
+        return Base::m_diag;
+    }
+    /** \returns an expression of the factor L */
+    inline const MatrixL matrixL() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
+        return Traits::getL(Base::m_matrix);
+    }
+
+    /** \returns an expression of the factor U (= L^*) */
+    inline const MatrixU matrixU() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
+        return Traits::getU(Base::m_matrix);
+    }
+
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    SimplicialLDLT& compute(const MatrixType& matrix)
+    {
+      Base::template compute<true>(matrix);
+      return *this;
+    }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      *
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& a)
+    {
+      Base::analyzePattern(a, true);
+    }
+
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& a)
+    {
+      Base::template factorize<true>(a);
+    }
+
+    /** \returns the determinant of the underlying matrix from the current factorization */
+    Scalar determinant() const
+    {
+      return Base::m_diag.prod();
+    }
+};
+
+/** \deprecated use SimplicialLDLT or class SimplicialLLT
+  * \ingroup SparseCholesky_Module
+  * \class SimplicialCholesky
+  *
+  * \sa class SimplicialLDLT, class SimplicialLLT
+  */
+template<typename _MatrixType, int _UpLo>
+    class SimplicialCholesky : public SimplicialCholeskyBase<SimplicialCholesky<_MatrixType,_UpLo> >
+{
+public:
+    typedef _MatrixType MatrixType;
+    enum { UpLo = _UpLo };
+    typedef SimplicialCholeskyBase<SimplicialCholesky> Base;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
+    typedef Matrix<Scalar,Dynamic,1> VectorType;
+    typedef internal::traits<SimplicialCholesky> Traits;
+    typedef internal::traits<SimplicialLDLT<MatrixType,UpLo> > LDLTTraits;
+    typedef internal::traits<SimplicialLLT<MatrixType,UpLo>  > LLTTraits;
+  public:
+    SimplicialCholesky() : Base(), m_LDLT(true) {}
+
+    SimplicialCholesky(const MatrixType& matrix)
+      : Base(), m_LDLT(true)
+    {
+      compute(matrix);
+    }
+
+    SimplicialCholesky& setMode(SimplicialCholeskyMode mode)
+    {
+      switch(mode)
+      {
+      case SimplicialCholeskyLLT:
+        m_LDLT = false;
+        break;
+      case SimplicialCholeskyLDLT:
+        m_LDLT = true;
+        break;
+      default:
+        break;
+      }
+
+      return *this;
+    }
+
+    inline const VectorType vectorD() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized");
+        return Base::m_diag;
+    }
+    inline const CholMatrixType rawMatrix() const {
+        eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized");
+        return Base::m_matrix;
+    }
+    
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    SimplicialCholesky& compute(const MatrixType& matrix)
+    {
+      if(m_LDLT)
+        Base::template compute<true>(matrix);
+      else
+        Base::template compute<false>(matrix);
+      return *this;
+    }
+
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      *
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& a)
+    {
+      Base::analyzePattern(a, m_LDLT);
+    }
+
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& a)
+    {
+      if(m_LDLT)
+        Base::template factorize<true>(a);
+      else
+        Base::template factorize<false>(a);
+    }
+
+    /** \internal */
+    template<typename Rhs,typename Dest>
+    void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
+    {
+      eigen_assert(Base::m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
+      eigen_assert(Base::m_matrix.rows()==b.rows());
+
+      if(Base::m_info!=Success)
+        return;
+
+      if(Base::m_P.size()>0)
+        dest = Base::m_P * b;
+      else
+        dest = b;
+
+      if(Base::m_matrix.nonZeros()>0) // otherwise L==I
+      {
+        if(m_LDLT)
+          LDLTTraits::getL(Base::m_matrix).solveInPlace(dest);
+        else
+          LLTTraits::getL(Base::m_matrix).solveInPlace(dest);
+      }
+
+      if(Base::m_diag.size()>0)
+        dest = Base::m_diag.asDiagonal().inverse() * dest;
+
+      if (Base::m_matrix.nonZeros()>0) // otherwise I==I
+      {
+        if(m_LDLT)
+          LDLTTraits::getU(Base::m_matrix).solveInPlace(dest);
+        else
+          LLTTraits::getU(Base::m_matrix).solveInPlace(dest);
+      }
+
+      if(Base::m_P.size()>0)
+        dest = Base::m_Pinv * dest;
+    }
+    
+    Scalar determinant() const
+    {
+      if(m_LDLT)
+      {
+        return Base::m_diag.prod();
+      }
+      else
+      {
+        Scalar detL = Diagonal<const CholMatrixType>(Base::m_matrix).prod();
+        return internal::abs2(detL);
+      }
+    }
+    
+  protected:
+    bool m_LDLT;
+};
+
+template<typename Derived>
+void SimplicialCholeskyBase<Derived>::ordering(const MatrixType& a, CholMatrixType& ap)
+{
+  eigen_assert(a.rows()==a.cols());
+  const Index size = a.rows();
+  // TODO allows to configure the permutation
+  // Note that amd compute the inverse permutation
+  {
+    CholMatrixType C;
+    C = a.template selfadjointView<UpLo>();
+    // remove diagonal entries:
+    // seems not to be needed
+    // C.prune(keep_diag());
+    internal::minimum_degree_ordering(C, m_Pinv);
+  }
+
+  if(m_Pinv.size()>0)
+    m_P = m_Pinv.inverse();
+  else
+    m_P.resize(0);
+
+  ap.resize(size,size);
+  ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
+}
+
+template<typename Derived>
+void SimplicialCholeskyBase<Derived>::analyzePattern_preordered(const CholMatrixType& ap, bool doLDLT)
+{
+  const Index size = ap.rows();
+  m_matrix.resize(size, size);
+  m_parent.resize(size);
+  m_nonZerosPerCol.resize(size);
+  
+  ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0);
+
+  for(Index k = 0; k < size; ++k)
+  {
+    /* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */
+    m_parent[k] = -1;             /* parent of k is not yet known */
+    tags[k] = k;                  /* mark node k as visited */
+    m_nonZerosPerCol[k] = 0;      /* count of nonzeros in column k of L */
+    for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
+    {
+      Index i = it.index();
+      if(i < k)
+      {
+        /* follow path from i to root of etree, stop at flagged node */
+        for(; tags[i] != k; i = m_parent[i])
+        {
+          /* find parent of i if not yet determined */
+          if (m_parent[i] == -1)
+            m_parent[i] = k;
+          m_nonZerosPerCol[i]++;        /* L (k,i) is nonzero */
+          tags[i] = k;                  /* mark i as visited */
+        }
+      }
+    }
+  }
+  
+  /* construct Lp index array from m_nonZerosPerCol column counts */
+  Index* Lp = m_matrix.outerIndexPtr();
+  Lp[0] = 0;
+  for(Index k = 0; k < size; ++k)
+    Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1);
+
+  m_matrix.resizeNonZeros(Lp[size]);
+  
+  m_isInitialized     = true;
+  m_info              = Success;
+  m_analysisIsOk      = true;
+  m_factorizationIsOk = false;
+}
+
+
+template<typename Derived>
+template<bool DoLDLT>
+void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& ap)
+{
+  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+  eigen_assert(ap.rows()==ap.cols());
+  const Index size = ap.rows();
+  eigen_assert(m_parent.size()==size);
+  eigen_assert(m_nonZerosPerCol.size()==size);
+
+  const Index* Lp = m_matrix.outerIndexPtr();
+  Index* Li = m_matrix.innerIndexPtr();
+  Scalar* Lx = m_matrix.valuePtr();
+
+  ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0);
+  ei_declare_aligned_stack_constructed_variable(Index,  pattern, size, 0);
+  ei_declare_aligned_stack_constructed_variable(Index,  tags, size, 0);
+  
+  bool ok = true;
+  m_diag.resize(DoLDLT ? size : 0);
+  
+  for(Index k = 0; k < size; ++k)
+  {
+    // compute nonzero pattern of kth row of L, in topological order
+    y[k] = 0.0;                     // Y(0:k) is now all zero
+    Index top = size;               // stack for pattern is empty
+    tags[k] = k;                    // mark node k as visited
+    m_nonZerosPerCol[k] = 0;        // count of nonzeros in column k of L
+    for(typename MatrixType::InnerIterator it(ap,k); it; ++it)
+    {
+      Index i = it.index();
+      if(i <= k)
+      {
+        y[i] += internal::conj(it.value());            /* scatter A(i,k) into Y (sum duplicates) */
+        Index len;
+        for(len = 0; tags[i] != k; i = m_parent[i])
+        {
+          pattern[len++] = i;     /* L(k,i) is nonzero */
+          tags[i] = k;            /* mark i as visited */
+        }
+        while(len > 0)
+          pattern[--top] = pattern[--len];
+      }
+    }
+
+    /* compute numerical values kth row of L (a sparse triangular solve) */
+
+    RealScalar d = internal::real(y[k]) * m_shiftScale + m_shiftOffset;    // get D(k,k), apply the shift function, and clear Y(k)
+    y[k] = 0.0;
+    for(; top < size; ++top)
+    {
+      Index i = pattern[top];       /* pattern[top:n-1] is pattern of L(:,k) */
+      Scalar yi = y[i];             /* get and clear Y(i) */
+      y[i] = 0.0;
+      
+      /* the nonzero entry L(k,i) */
+      Scalar l_ki;
+      if(DoLDLT)
+        l_ki = yi / m_diag[i];       
+      else
+        yi = l_ki = yi / Lx[Lp[i]];
+      
+      Index p2 = Lp[i] + m_nonZerosPerCol[i];
+      Index p;
+      for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p)
+        y[Li[p]] -= internal::conj(Lx[p]) * yi;
+      d -= internal::real(l_ki * internal::conj(yi));
+      Li[p] = k;                          /* store L(k,i) in column form of L */
+      Lx[p] = l_ki;
+      ++m_nonZerosPerCol[i];              /* increment count of nonzeros in col i */
+    }
+    if(DoLDLT)
+    {
+      m_diag[k] = d;
+      if(d == RealScalar(0))
+      {
+        ok = false;                         /* failure, D(k,k) is zero */
+        break;
+      }
+    }
+    else
+    {
+      Index p = Lp[k] + m_nonZerosPerCol[k]++;
+      Li[p] = k ;                /* store L(k,k) = sqrt (d) in column k */
+      if(d <= RealScalar(0)) {
+        ok = false;              /* failure, matrix is not positive definite */
+        break;
+      }
+      Lx[p] = internal::sqrt(d) ;
+    }
+  }
+
+  m_info = ok ? Success : NumericalIssue;
+  m_factorizationIsOk = true;
+}
+
+namespace internal {
+  
+template<typename Derived, typename Rhs>
+struct solve_retval<SimplicialCholeskyBase<Derived>, Rhs>
+  : solve_retval_base<SimplicialCholeskyBase<Derived>, Rhs>
+{
+  typedef SimplicialCholeskyBase<Derived> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve(rhs(),dst);
+  }
+};
+
+template<typename Derived, typename Rhs>
+struct sparse_solve_retval<SimplicialCholeskyBase<Derived>, Rhs>
+  : sparse_solve_retval_base<SimplicialCholeskyBase<Derived>, Rhs>
+{
+  typedef SimplicialCholeskyBase<Derived> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve_sparse(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SIMPLICIAL_CHOLESKY_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/AmbiVector.h b/extern/Eigen3/Eigen/src/SparseCore/AmbiVector.h
new file mode 100644
index 0000000..6cfaadb
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/AmbiVector.h
@@ -0,0 +1,371 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_AMBIVECTOR_H
+#define EIGEN_AMBIVECTOR_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal
+  * Hybrid sparse/dense vector class designed for intensive read-write operations.
+  *
+  * See BasicSparseLLT and SparseProduct for usage examples.
+  */
+template<typename _Scalar, typename _Index>
+class AmbiVector
+{
+  public:
+    typedef _Scalar Scalar;
+    typedef _Index Index;
+    typedef typename NumTraits<Scalar>::Real RealScalar;
+
+    AmbiVector(Index size)
+      : m_buffer(0), m_zero(0), m_size(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1)
+    {
+      resize(size);
+    }
+
+    void init(double estimatedDensity);
+    void init(int mode);
+
+    Index nonZeros() const;
+
+    /** Specifies a sub-vector to work on */
+    void setBounds(Index start, Index end) { m_start = start; m_end = end; }
+
+    void setZero();
+
+    void restart();
+    Scalar& coeffRef(Index i);
+    Scalar& coeff(Index i);
+
+    class Iterator;
+
+    ~AmbiVector() { delete[] m_buffer; }
+
+    void resize(Index size)
+    {
+      if (m_allocatedSize < size)
+        reallocate(size);
+      m_size = size;
+    }
+
+    Index size() const { return m_size; }
+
+  protected:
+
+    void reallocate(Index size)
+    {
+      // if the size of the matrix is not too large, let's allocate a bit more than needed such
+      // that we can handle dense vector even in sparse mode.
+      delete[] m_buffer;
+      if (size<1000)
+      {
+        Index allocSize = (size * sizeof(ListEl))/sizeof(Scalar);
+        m_allocatedElements = (allocSize*sizeof(Scalar))/sizeof(ListEl);
+        m_buffer = new Scalar[allocSize];
+      }
+      else
+      {
+        m_allocatedElements = (size*sizeof(Scalar))/sizeof(ListEl);
+        m_buffer = new Scalar[size];
+      }
+      m_size = size;
+      m_start = 0;
+      m_end = m_size;
+    }
+
+    void reallocateSparse()
+    {
+      Index copyElements = m_allocatedElements;
+      m_allocatedElements = (std::min)(Index(m_allocatedElements*1.5),m_size);
+      Index allocSize = m_allocatedElements * sizeof(ListEl);
+      allocSize = allocSize/sizeof(Scalar) + (allocSize%sizeof(Scalar)>0?1:0);
+      Scalar* newBuffer = new Scalar[allocSize];
+      memcpy(newBuffer,  m_buffer,  copyElements * sizeof(ListEl));
+      delete[] m_buffer;
+      m_buffer = newBuffer;
+    }
+
+  protected:
+    // element type of the linked list
+    struct ListEl
+    {
+      Index next;
+      Index index;
+      Scalar value;
+    };
+
+    // used to store data in both mode
+    Scalar* m_buffer;
+    Scalar m_zero;
+    Index m_size;
+    Index m_start;
+    Index m_end;
+    Index m_allocatedSize;
+    Index m_allocatedElements;
+    Index m_mode;
+
+    // linked list mode
+    Index m_llStart;
+    Index m_llCurrent;
+    Index m_llSize;
+};
+
+/** \returns the number of non zeros in the current sub vector */
+template<typename _Scalar,typename _Index>
+_Index AmbiVector<_Scalar,_Index>::nonZeros() const
+{
+  if (m_mode==IsSparse)
+    return m_llSize;
+  else
+    return m_end - m_start;
+}
+
+template<typename _Scalar,typename _Index>
+void AmbiVector<_Scalar,_Index>::init(double estimatedDensity)
+{
+  if (estimatedDensity>0.1)
+    init(IsDense);
+  else
+    init(IsSparse);
+}
+
+template<typename _Scalar,typename _Index>
+void AmbiVector<_Scalar,_Index>::init(int mode)
+{
+  m_mode = mode;
+  if (m_mode==IsSparse)
+  {
+    m_llSize = 0;
+    m_llStart = -1;
+  }
+}
+
+/** Must be called whenever we might perform a write access
+  * with an index smaller than the previous one.
+  *
+  * Don't worry, this function is extremely cheap.
+  */
+template<typename _Scalar,typename _Index>
+void AmbiVector<_Scalar,_Index>::restart()
+{
+  m_llCurrent = m_llStart;
+}
+
+/** Set all coefficients of current subvector to zero */
+template<typename _Scalar,typename _Index>
+void AmbiVector<_Scalar,_Index>::setZero()
+{
+  if (m_mode==IsDense)
+  {
+    for (Index i=m_start; i<m_end; ++i)
+      m_buffer[i] = Scalar(0);
+  }
+  else
+  {
+    eigen_assert(m_mode==IsSparse);
+    m_llSize = 0;
+    m_llStart = -1;
+  }
+}
+
+template<typename _Scalar,typename _Index>
+_Scalar& AmbiVector<_Scalar,_Index>::coeffRef(_Index i)
+{
+  if (m_mode==IsDense)
+    return m_buffer[i];
+  else
+  {
+    ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
+    // TODO factorize the following code to reduce code generation
+    eigen_assert(m_mode==IsSparse);
+    if (m_llSize==0)
+    {
+      // this is the first element
+      m_llStart = 0;
+      m_llCurrent = 0;
+      ++m_llSize;
+      llElements[0].value = Scalar(0);
+      llElements[0].index = i;
+      llElements[0].next = -1;
+      return llElements[0].value;
+    }
+    else if (i<llElements[m_llStart].index)
+    {
+      // this is going to be the new first element of the list
+      ListEl& el = llElements[m_llSize];
+      el.value = Scalar(0);
+      el.index = i;
+      el.next = m_llStart;
+      m_llStart = m_llSize;
+      ++m_llSize;
+      m_llCurrent = m_llStart;
+      return el.value;
+    }
+    else
+    {
+      Index nextel = llElements[m_llCurrent].next;
+      eigen_assert(i>=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index");
+      while (nextel >= 0 && llElements[nextel].index<=i)
+      {
+        m_llCurrent = nextel;
+        nextel = llElements[nextel].next;
+      }
+
+      if (llElements[m_llCurrent].index==i)
+      {
+        // the coefficient already exists and we found it !
+        return llElements[m_llCurrent].value;
+      }
+      else
+      {
+        if (m_llSize>=m_allocatedElements)
+        {
+          reallocateSparse();
+          llElements = reinterpret_cast<ListEl*>(m_buffer);
+        }
+        eigen_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
+        // let's insert a new coefficient
+        ListEl& el = llElements[m_llSize];
+        el.value = Scalar(0);
+        el.index = i;
+        el.next = llElements[m_llCurrent].next;
+        llElements[m_llCurrent].next = m_llSize;
+        ++m_llSize;
+        return el.value;
+      }
+    }
+  }
+}
+
+template<typename _Scalar,typename _Index>
+_Scalar& AmbiVector<_Scalar,_Index>::coeff(_Index i)
+{
+  if (m_mode==IsDense)
+    return m_buffer[i];
+  else
+  {
+    ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
+    eigen_assert(m_mode==IsSparse);
+    if ((m_llSize==0) || (i<llElements[m_llStart].index))
+    {
+      return m_zero;
+    }
+    else
+    {
+      Index elid = m_llStart;
+      while (elid >= 0 && llElements[elid].index<i)
+        elid = llElements[elid].next;
+
+      if (llElements[elid].index==i)
+        return llElements[m_llCurrent].value;
+      else
+        return m_zero;
+    }
+  }
+}
+
+/** Iterator over the nonzero coefficients */
+template<typename _Scalar,typename _Index>
+class AmbiVector<_Scalar,_Index>::Iterator
+{
+  public:
+    typedef _Scalar Scalar;
+    typedef typename NumTraits<Scalar>::Real RealScalar;
+
+    /** Default constructor
+      * \param vec the vector on which we iterate
+      * \param epsilon the minimal value used to prune zero coefficients.
+      * In practice, all coefficients having a magnitude smaller than \a epsilon
+      * are skipped.
+      */
+    Iterator(const AmbiVector& vec, RealScalar epsilon = 0)
+      : m_vector(vec)
+    {
+      m_epsilon = epsilon;
+      m_isDense = m_vector.m_mode==IsDense;
+      if (m_isDense)
+      {
+        m_currentEl = 0;   // this is to avoid a compilation warning
+        m_cachedValue = 0; // this is to avoid a compilation warning
+        m_cachedIndex = m_vector.m_start-1;
+        ++(*this);
+      }
+      else
+      {
+        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
+        m_currentEl = m_vector.m_llStart;
+        while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<=m_epsilon)
+          m_currentEl = llElements[m_currentEl].next;
+        if (m_currentEl<0)
+        {
+          m_cachedValue = 0; // this is to avoid a compilation warning
+          m_cachedIndex = -1;
+        }
+        else
+        {
+          m_cachedIndex = llElements[m_currentEl].index;
+          m_cachedValue = llElements[m_currentEl].value;
+        }
+      }
+    }
+
+    Index index() const { return m_cachedIndex; }
+    Scalar value() const { return m_cachedValue; }
+
+    operator bool() const { return m_cachedIndex>=0; }
+
+    Iterator& operator++()
+    {
+      if (m_isDense)
+      {
+        do {
+          ++m_cachedIndex;
+        } while (m_cachedIndex<m_vector.m_end && internal::abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
+        if (m_cachedIndex<m_vector.m_end)
+          m_cachedValue = m_vector.m_buffer[m_cachedIndex];
+        else
+          m_cachedIndex=-1;
+      }
+      else
+      {
+        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
+        do {
+          m_currentEl = llElements[m_currentEl].next;
+        } while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<m_epsilon);
+        if (m_currentEl<0)
+        {
+          m_cachedIndex = -1;
+        }
+        else
+        {
+          m_cachedIndex = llElements[m_currentEl].index;
+          m_cachedValue = llElements[m_currentEl].value;
+        }
+      }
+      return *this;
+    }
+
+  protected:
+    const AmbiVector& m_vector; // the target vector
+    Index m_currentEl;            // the current element in sparse/linked-list mode
+    RealScalar m_epsilon;       // epsilon used to prune zero coefficients
+    Index m_cachedIndex;          // current coordinate
+    Scalar m_cachedValue;       // current value
+    bool m_isDense;             // mode of the vector
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_AMBIVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/CompressedStorage.h b/extern/Eigen3/Eigen/src/SparseCore/CompressedStorage.h
new file mode 100644
index 0000000..85a998a
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/CompressedStorage.h
@@ -0,0 +1,233 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_COMPRESSED_STORAGE_H
+#define EIGEN_COMPRESSED_STORAGE_H
+
+namespace Eigen { 
+
+namespace internal {
+
+/** \internal
+  * Stores a sparse set of values as a list of values and a list of indices.
+  *
+  */
+template<typename _Scalar,typename _Index>
+class CompressedStorage
+{
+  public:
+
+    typedef _Scalar Scalar;
+    typedef _Index Index;
+
+  protected:
+
+    typedef typename NumTraits<Scalar>::Real RealScalar;
+
+  public:
+
+    CompressedStorage()
+      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
+    {}
+
+    CompressedStorage(size_t size)
+      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
+    {
+      resize(size);
+    }
+
+    CompressedStorage(const CompressedStorage& other)
+      : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
+    {
+      *this = other;
+    }
+
+    CompressedStorage& operator=(const CompressedStorage& other)
+    {
+      resize(other.size());
+      memcpy(m_values, other.m_values, m_size * sizeof(Scalar));
+      memcpy(m_indices, other.m_indices, m_size * sizeof(Index));
+      return *this;
+    }
+
+    void swap(CompressedStorage& other)
+    {
+      std::swap(m_values, other.m_values);
+      std::swap(m_indices, other.m_indices);
+      std::swap(m_size, other.m_size);
+      std::swap(m_allocatedSize, other.m_allocatedSize);
+    }
+
+    ~CompressedStorage()
+    {
+      delete[] m_values;
+      delete[] m_indices;
+    }
+
+    void reserve(size_t size)
+    {
+      size_t newAllocatedSize = m_size + size;
+      if (newAllocatedSize > m_allocatedSize)
+        reallocate(newAllocatedSize);
+    }
+
+    void squeeze()
+    {
+      if (m_allocatedSize>m_size)
+        reallocate(m_size);
+    }
+
+    void resize(size_t size, float reserveSizeFactor = 0)
+    {
+      if (m_allocatedSize<size)
+        reallocate(size + size_t(reserveSizeFactor*size));
+      m_size = size;
+    }
+
+    void append(const Scalar& v, Index i)
+    {
+      Index id = static_cast<Index>(m_size);
+      resize(m_size+1, 1);
+      m_values[id] = v;
+      m_indices[id] = i;
+    }
+
+    inline size_t size() const { return m_size; }
+    inline size_t allocatedSize() const { return m_allocatedSize; }
+    inline void clear() { m_size = 0; }
+
+    inline Scalar& value(size_t i) { return m_values[i]; }
+    inline const Scalar& value(size_t i) const { return m_values[i]; }
+
+    inline Index& index(size_t i) { return m_indices[i]; }
+    inline const Index& index(size_t i) const { return m_indices[i]; }
+
+    static CompressedStorage Map(Index* indices, Scalar* values, size_t size)
+    {
+      CompressedStorage res;
+      res.m_indices = indices;
+      res.m_values = values;
+      res.m_allocatedSize = res.m_size = size;
+      return res;
+    }
+
+    /** \returns the largest \c k such that for all \c j in [0,k) index[\c j]\<\a key */
+    inline Index searchLowerIndex(Index key) const
+    {
+      return searchLowerIndex(0, m_size, key);
+    }
+
+    /** \returns the largest \c k in [start,end) such that for all \c j in [start,k) index[\c j]\<\a key */
+    inline Index searchLowerIndex(size_t start, size_t end, Index key) const
+    {
+      while(end>start)
+      {
+        size_t mid = (end+start)>>1;
+        if (m_indices[mid]<key)
+          start = mid+1;
+        else
+          end = mid;
+      }
+      return static_cast<Index>(start);
+    }
+
+    /** \returns the stored value at index \a key
+      * If the value does not exist, then the value \a defaultValue is returned without any insertion. */
+    inline Scalar at(Index key, Scalar defaultValue = Scalar(0)) const
+    {
+      if (m_size==0)
+        return defaultValue;
+      else if (key==m_indices[m_size-1])
+        return m_values[m_size-1];
+      // ^^  optimization: let's first check if it is the last coefficient
+      // (very common in high level algorithms)
+      const size_t id = searchLowerIndex(0,m_size-1,key);
+      return ((id<m_size) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
+    }
+
+    /** Like at(), but the search is performed in the range [start,end) */
+    inline Scalar atInRange(size_t start, size_t end, Index key, Scalar defaultValue = Scalar(0)) const
+    {
+      if (start>=end)
+        return Scalar(0);
+      else if (end>start && key==m_indices[end-1])
+        return m_values[end-1];
+      // ^^  optimization: let's first check if it is the last coefficient
+      // (very common in high level algorithms)
+      const size_t id = searchLowerIndex(start,end-1,key);
+      return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
+    }
+
+    /** \returns a reference to the value at index \a key
+      * If the value does not exist, then the value \a defaultValue is inserted
+      * such that the keys are sorted. */
+    inline Scalar& atWithInsertion(Index key, Scalar defaultValue = Scalar(0))
+    {
+      size_t id = searchLowerIndex(0,m_size,key);
+      if (id>=m_size || m_indices[id]!=key)
+      {
+        resize(m_size+1,1);
+        for (size_t j=m_size-1; j>id; --j)
+        {
+          m_indices[j] = m_indices[j-1];
+          m_values[j] = m_values[j-1];
+        }
+        m_indices[id] = key;
+        m_values[id] = defaultValue;
+      }
+      return m_values[id];
+    }
+
+    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
+    {
+      size_t k = 0;
+      size_t n = size();
+      for (size_t i=0; i<n; ++i)
+      {
+        if (!internal::isMuchSmallerThan(value(i), reference, epsilon))
+        {
+          value(k) = value(i);
+          index(k) = index(i);
+          ++k;
+        }
+      }
+      resize(k,0);
+    }
+
+  protected:
+
+    inline void reallocate(size_t size)
+    {
+      Scalar* newValues  = new Scalar[size];
+      Index* newIndices = new Index[size];
+      size_t copySize = (std::min)(size, m_size);
+      // copy
+      internal::smart_copy(m_values, m_values+copySize, newValues);
+      internal::smart_copy(m_indices, m_indices+copySize, newIndices);
+      // delete old stuff
+      delete[] m_values;
+      delete[] m_indices;
+      m_values = newValues;
+      m_indices = newIndices;
+      m_allocatedSize = size;
+    }
+
+  protected:
+    Scalar* m_values;
+    Index* m_indices;
+    size_t m_size;
+    size_t m_allocatedSize;
+
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_COMPRESSED_STORAGE_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h b/extern/Eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h
new file mode 100644
index 0000000..16b5e1d
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h
@@ -0,0 +1,245 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
+#define EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, typename ResultType>
+static void conservative_sparse_sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+{
+  typedef typename remove_all<Lhs>::type::Scalar Scalar;
+  typedef typename remove_all<Lhs>::type::Index Index;
+
+  // make sure to call innerSize/outerSize since we fake the storage order.
+  Index rows = lhs.innerSize();
+  Index cols = rhs.outerSize();
+  eigen_assert(lhs.outerSize() == rhs.innerSize());
+
+  std::vector<bool> mask(rows,false);
+  Matrix<Scalar,Dynamic,1> values(rows);
+  Matrix<Index,Dynamic,1>  indices(rows);
+
+  // estimate the number of non zero entries
+  // given a rhs column containing Y non zeros, we assume that the respective Y columns
+  // of the lhs differs in average of one non zeros, thus the number of non zeros for
+  // the product of a rhs column with the lhs is X+Y where X is the average number of non zero
+  // per column of the lhs.
+  // Therefore, we have nnz(lhs*rhs) = nnz(lhs) + nnz(rhs)
+  Index estimated_nnz_prod = lhs.nonZeros() + rhs.nonZeros();
+
+  res.setZero();
+  res.reserve(Index(estimated_nnz_prod));
+  // we compute each column of the result, one after the other
+  for (Index j=0; j<cols; ++j)
+  {
+
+    res.startVec(j);
+    Index nnz = 0;
+    for (typename Rhs::InnerIterator rhsIt(rhs, j); rhsIt; ++rhsIt)
+    {
+      Scalar y = rhsIt.value();
+      Index k = rhsIt.index();
+      for (typename Lhs::InnerIterator lhsIt(lhs, k); lhsIt; ++lhsIt)
+      {
+        Index i = lhsIt.index();
+        Scalar x = lhsIt.value();
+        if(!mask[i])
+        {
+          mask[i] = true;
+          values[i] = x * y;
+          indices[nnz] = i;
+          ++nnz;
+        }
+        else
+          values[i] += x * y;
+      }
+    }
+
+    // unordered insertion
+    for(int k=0; k<nnz; ++k)
+    {
+      int i = indices[k];
+      res.insertBackByOuterInnerUnordered(j,i) = values[i];
+      mask[i] = false;
+    }
+
+#if 0
+    // alternative ordered insertion code:
+
+    int t200 = rows/(log2(200)*1.39);
+    int t = (rows*100)/139;
+
+    // FIXME reserve nnz non zeros
+    // FIXME implement fast sort algorithms for very small nnz
+    // if the result is sparse enough => use a quick sort
+    // otherwise => loop through the entire vector
+    // In order to avoid to perform an expensive log2 when the
+    // result is clearly very sparse we use a linear bound up to 200.
+    //if((nnz<200 && nnz<t200) || nnz * log2(nnz) < t)
+    //res.startVec(j);
+    if(true)
+    {
+      if(nnz>1) std::sort(indices.data(),indices.data()+nnz);
+      for(int k=0; k<nnz; ++k)
+      {
+        int i = indices[k];
+        res.insertBackByOuterInner(j,i) = values[i];
+        mask[i] = false;
+      }
+    }
+    else
+    {
+      // dense path
+      for(int i=0; i<rows; ++i)
+      {
+        if(mask[i])
+        {
+          mask[i] = false;
+          res.insertBackByOuterInner(j,i) = values[i];
+        }
+      }
+    }
+#endif
+
+  }
+  res.finalize();
+}
+
+
+} // end namespace internal
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, typename ResultType,
+  int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
+  int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
+  int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
+struct conservative_sparse_sparse_product_selector;
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
+{
+  typedef typename remove_all<Lhs>::type LhsCleaned;
+  typedef typename LhsCleaned::Scalar Scalar;
+
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    ColMajorMatrix resCol(lhs.rows(),rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
+    // sort the non zeros:
+    RowMajorMatrix resRow(resCol);
+    res = resRow;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,ColMajor,ColMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+     typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
+     RowMajorMatrix rhsRow = rhs;
+     RowMajorMatrix resRow(lhs.rows(), rhs.cols());
+     internal::conservative_sparse_sparse_product_impl<RowMajorMatrix,Lhs,RowMajorMatrix>(rhsRow, lhs, resRow);
+     res = resRow;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,RowMajor,ColMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
+    RowMajorMatrix lhsRow = lhs;
+    RowMajorMatrix resRow(lhs.rows(), rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Rhs,RowMajorMatrix,RowMajorMatrix>(rhs, lhsRow, resRow);
+    res = resRow;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
+    RowMajorMatrix resRow(lhs.rows(), rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
+    res = resRow;
+  }
+};
+
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
+{
+  typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
+
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    ColMajorMatrix resCol(lhs.rows(), rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
+    res = resCol;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,ColMajor,RowMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    ColMajorMatrix lhsCol = lhs;
+    ColMajorMatrix resCol(lhs.rows(), rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<ColMajorMatrix,Rhs,ColMajorMatrix>(lhsCol, rhs, resCol);
+    res = resCol;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,RowMajor,RowMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    ColMajorMatrix rhsCol = rhs;
+    ColMajorMatrix resCol(lhs.rows(), rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Lhs,ColMajorMatrix,ColMajorMatrix>(lhs, rhsCol, resCol);
+    res = resCol;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct conservative_sparse_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
+{
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    RowMajorMatrix resRow(lhs.rows(),rhs.cols());
+    internal::conservative_sparse_sparse_product_impl<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
+    // sort the non zeros:
+    ColMajorMatrix resCol(resRow);
+    res = resCol;
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/CoreIterators.h b/extern/Eigen3/Eigen/src/SparseCore/CoreIterators.h
new file mode 100644
index 0000000..6da4683
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/CoreIterators.h
@@ -0,0 +1,61 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_COREITERATORS_H
+#define EIGEN_COREITERATORS_H
+
+namespace Eigen { 
+
+/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core
+ */
+
+/** \ingroup SparseCore_Module
+  * \class InnerIterator
+  * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression
+  *
+  * todo
+  */
+
+// generic version for dense matrix and expressions
+template<typename Derived> class DenseBase<Derived>::InnerIterator
+{
+  protected:
+    typedef typename Derived::Scalar Scalar;
+    typedef typename Derived::Index Index;
+
+    enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
+  public:
+    EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
+      : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
+    {}
+
+    EIGEN_STRONG_INLINE Scalar value() const
+    {
+      return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
+                          : m_expression.coeff(m_inner, m_outer);
+    }
+
+    EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
+
+    EIGEN_STRONG_INLINE Index index() const { return m_inner; }
+    inline Index row() const { return IsRowMajor ? m_outer : index(); }
+    inline Index col() const { return IsRowMajor ? index() : m_outer; }
+
+    EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
+
+  protected:
+    const Derived& m_expression;
+    Index m_inner;
+    const Index m_outer;
+    const Index m_end;
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_COREITERATORS_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h b/extern/Eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h
new file mode 100644
index 0000000..93cd483
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h
@@ -0,0 +1,179 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_MAPPED_SPARSEMATRIX_H
+#define EIGEN_MAPPED_SPARSEMATRIX_H
+
+namespace Eigen { 
+
+/** \class MappedSparseMatrix
+  *
+  * \brief Sparse matrix
+  *
+  * \param _Scalar the scalar type, i.e. the type of the coefficients
+  *
+  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
+  *
+  */
+namespace internal {
+template<typename _Scalar, int _Flags, typename _Index>
+struct traits<MappedSparseMatrix<_Scalar, _Flags, _Index> > : traits<SparseMatrix<_Scalar, _Flags, _Index> >
+{};
+}
+
+template<typename _Scalar, int _Flags, typename _Index>
+class MappedSparseMatrix
+  : public SparseMatrixBase<MappedSparseMatrix<_Scalar, _Flags, _Index> >
+{
+  public:
+    EIGEN_SPARSE_PUBLIC_INTERFACE(MappedSparseMatrix)
+    enum { IsRowMajor = Base::IsRowMajor };
+
+  protected:
+
+    Index   m_outerSize;
+    Index   m_innerSize;
+    Index   m_nnz;
+    Index*  m_outerIndex;
+    Index*  m_innerIndices;
+    Scalar* m_values;
+
+  public:
+
+    inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
+    inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
+    inline Index innerSize() const { return m_innerSize; }
+    inline Index outerSize() const { return m_outerSize; }
+
+    //----------------------------------------
+    // direct access interface
+    inline const Scalar* valuePtr() const { return m_values; }
+    inline Scalar* valuePtr() { return m_values; }
+
+    inline const Index* innerIndexPtr() const { return m_innerIndices; }
+    inline Index* innerIndexPtr() { return m_innerIndices; }
+
+    inline const Index* outerIndexPtr() const { return m_outerIndex; }
+    inline Index* outerIndexPtr() { return m_outerIndex; }
+    //----------------------------------------
+
+    inline Scalar coeff(Index row, Index col) const
+    {
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      Index start = m_outerIndex[outer];
+      Index end = m_outerIndex[outer+1];
+      if (start==end)
+        return Scalar(0);
+      else if (end>0 && inner==m_innerIndices[end-1])
+        return m_values[end-1];
+      // ^^  optimization: let's first check if it is the last coefficient
+      // (very common in high level algorithms)
+
+      const Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner);
+      const Index id = r-&m_innerIndices[0];
+      return ((*r==inner) && (id<end)) ? m_values[id] : Scalar(0);
+    }
+
+    inline Scalar& coeffRef(Index row, Index col)
+    {
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      Index start = m_outerIndex[outer];
+      Index end = m_outerIndex[outer+1];
+      eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
+      eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
+      Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end],inner);
+      const Index id = r-&m_innerIndices[0];
+      eigen_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
+      return m_values[id];
+    }
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    /** \returns the number of non zero coefficients */
+    inline Index nonZeros() const  { return m_nnz; }
+
+    inline MappedSparseMatrix(Index rows, Index cols, Index nnz, Index* outerIndexPtr, Index* innerIndexPtr, Scalar* valuePtr)
+      : m_outerSize(IsRowMajor?rows:cols), m_innerSize(IsRowMajor?cols:rows), m_nnz(nnz), m_outerIndex(outerIndexPtr),
+        m_innerIndices(innerIndexPtr), m_values(valuePtr)
+    {}
+
+    /** Empty destructor */
+    inline ~MappedSparseMatrix() {}
+};
+
+template<typename Scalar, int _Flags, typename _Index>
+class MappedSparseMatrix<Scalar,_Flags,_Index>::InnerIterator
+{
+  public:
+    InnerIterator(const MappedSparseMatrix& mat, Index outer)
+      : m_matrix(mat),
+        m_outer(outer),
+        m_id(mat.outerIndexPtr()[outer]),
+        m_start(m_id),
+        m_end(mat.outerIndexPtr()[outer+1])
+    {}
+
+    inline InnerIterator& operator++() { m_id++; return *this; }
+
+    inline Scalar value() const { return m_matrix.valuePtr()[m_id]; }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix.valuePtr()[m_id]); }
+
+    inline Index index() const { return m_matrix.innerIndexPtr()[m_id]; }
+    inline Index row() const { return IsRowMajor ? m_outer : index(); }
+    inline Index col() const { return IsRowMajor ? index() : m_outer; }
+
+    inline operator bool() const { return (m_id < m_end) && (m_id>=m_start); }
+
+  protected:
+    const MappedSparseMatrix& m_matrix;
+    const Index m_outer;
+    Index m_id;
+    const Index m_start;
+    const Index m_end;
+};
+
+template<typename Scalar, int _Flags, typename _Index>
+class MappedSparseMatrix<Scalar,_Flags,_Index>::ReverseInnerIterator
+{
+  public:
+    ReverseInnerIterator(const MappedSparseMatrix& mat, Index outer)
+      : m_matrix(mat),
+        m_outer(outer),
+        m_id(mat.outerIndexPtr()[outer+1]),
+        m_start(mat.outerIndexPtr()[outer]),
+        m_end(m_id)
+    {}
+
+    inline ReverseInnerIterator& operator--() { m_id--; return *this; }
+
+    inline Scalar value() const { return m_matrix.valuePtr()[m_id-1]; }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix.valuePtr()[m_id-1]); }
+
+    inline Index index() const { return m_matrix.innerIndexPtr()[m_id-1]; }
+    inline Index row() const { return IsRowMajor ? m_outer : index(); }
+    inline Index col() const { return IsRowMajor ? index() : m_outer; }
+
+    inline operator bool() const { return (m_id <= m_end) && (m_id>m_start); }
+
+  protected:
+    const MappedSparseMatrix& m_matrix;
+    const Index m_outer;
+    Index m_id;
+    const Index m_start;
+    const Index m_end;
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_MAPPED_SPARSEMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/Sparse/SparseAssign.h b/extern/Eigen3/Eigen/src/SparseCore/SparseAssign.h
similarity index 100%
rename from extern/Eigen3/Eigen/src/Sparse/SparseAssign.h
rename to extern/Eigen3/Eigen/src/SparseCore/SparseAssign.h
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseBlock.h b/extern/Eigen3/Eigen/src/SparseCore/SparseBlock.h
new file mode 100644
index 0000000..eefd807
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseBlock.h
@@ -0,0 +1,387 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_BLOCK_H
+#define EIGEN_SPARSE_BLOCK_H
+
+namespace Eigen { 
+
+namespace internal {
+template<typename MatrixType, int Size>
+struct traits<SparseInnerVectorSet<MatrixType, Size> >
+{
+  typedef typename traits<MatrixType>::Scalar Scalar;
+  typedef typename traits<MatrixType>::Index Index;
+  typedef typename traits<MatrixType>::StorageKind StorageKind;
+  typedef MatrixXpr XprKind;
+  enum {
+    IsRowMajor = (int(MatrixType::Flags)&RowMajorBit)==RowMajorBit,
+    Flags = MatrixType::Flags,
+    RowsAtCompileTime = IsRowMajor ? Size : MatrixType::RowsAtCompileTime,
+    ColsAtCompileTime = IsRowMajor ? MatrixType::ColsAtCompileTime : Size,
+    MaxRowsAtCompileTime = RowsAtCompileTime,
+    MaxColsAtCompileTime = ColsAtCompileTime,
+    CoeffReadCost = MatrixType::CoeffReadCost
+  };
+};
+} // end namespace internal
+
+template<typename MatrixType, int Size>
+class SparseInnerVectorSet : internal::no_assignment_operator,
+  public SparseMatrixBase<SparseInnerVectorSet<MatrixType, Size> >
+{
+  public:
+
+    enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
+
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
+    class InnerIterator: public MatrixType::InnerIterator
+    {
+      public:
+        inline InnerIterator(const SparseInnerVectorSet& xpr, Index outer)
+          : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
+        {}
+        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
+        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
+      protected:
+        Index m_outer;
+    };
+    class ReverseInnerIterator: public MatrixType::ReverseInnerIterator
+    {
+      public:
+        inline ReverseInnerIterator(const SparseInnerVectorSet& xpr, Index outer)
+          : MatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
+        {}
+        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
+        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
+      protected:
+        Index m_outer;
+    };
+
+    inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
+      : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
+    {
+      eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
+    }
+
+    inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
+      : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
+    {
+      eigen_assert(Size!=Dynamic);
+      eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
+    }
+
+//     template<typename OtherDerived>
+//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
+//     {
+//       return *this;
+//     }
+
+//     template<typename Sparse>
+//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
+//     {
+//       return *this;
+//     }
+
+    EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+    EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+
+  protected:
+
+    const typename MatrixType::Nested m_matrix;
+    Index m_outerStart;
+    const internal::variable_if_dynamic<Index, Size> m_outerSize;
+};
+
+
+/***************************************************************************
+* specialisation for SparseMatrix
+***************************************************************************/
+
+template<typename _Scalar, int _Options, typename _Index, int Size>
+class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
+  : public SparseMatrixBase<SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size> >
+{
+    typedef SparseMatrix<_Scalar, _Options, _Index> MatrixType;
+  public:
+
+    enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
+
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
+    class InnerIterator: public MatrixType::InnerIterator
+    {
+      public:
+        inline InnerIterator(const SparseInnerVectorSet& xpr, Index outer)
+          : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
+        {}
+        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
+        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
+      protected:
+        Index m_outer;
+    };
+    class ReverseInnerIterator: public MatrixType::ReverseInnerIterator
+    {
+      public:
+        inline ReverseInnerIterator(const SparseInnerVectorSet& xpr, Index outer)
+          : MatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
+        {}
+        inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
+        inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
+      protected:
+        Index m_outer;
+    };
+
+    inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
+      : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
+    {
+      eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
+    }
+
+    inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
+      : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
+    {
+      eigen_assert(Size==1);
+      eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
+    }
+
+    template<typename OtherDerived>
+    inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
+    {
+      typedef typename internal::remove_all<typename MatrixType::Nested>::type _NestedMatrixType;
+      _NestedMatrixType& matrix = const_cast<_NestedMatrixType&>(m_matrix);;
+      // This assignement is slow if this vector set is not empty
+      // and/or it is not at the end of the nonzeros of the underlying matrix.
+
+      // 1 - eval to a temporary to avoid transposition and/or aliasing issues
+      SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, Index> tmp(other);
+
+      // 2 - let's check whether there is enough allocated memory
+      Index nnz           = tmp.nonZeros();
+      Index nnz_previous  = nonZeros();
+      Index free_size     = Index(matrix.data().allocatedSize()) + nnz_previous;
+      Index nnz_head      = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart];
+      Index tail          = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()];
+      Index nnz_tail      = matrix.nonZeros() - tail;
+
+      if(nnz>free_size)
+      {
+        // realloc manually to reduce copies
+        typename MatrixType::Storage newdata(m_matrix.nonZeros() - nnz_previous + nnz);
+
+        std::memcpy(&newdata.value(0), &m_matrix.data().value(0), nnz_head*sizeof(Scalar));
+        std::memcpy(&newdata.index(0), &m_matrix.data().index(0), nnz_head*sizeof(Index));
+
+        std::memcpy(&newdata.value(nnz_head), &tmp.data().value(0), nnz*sizeof(Scalar));
+        std::memcpy(&newdata.index(nnz_head), &tmp.data().index(0), nnz*sizeof(Index));
+
+        std::memcpy(&newdata.value(nnz_head+nnz), &matrix.data().value(tail), nnz_tail*sizeof(Scalar));
+        std::memcpy(&newdata.index(nnz_head+nnz), &matrix.data().index(tail), nnz_tail*sizeof(Index));
+
+        matrix.data().swap(newdata);
+      }
+      else
+      {
+        // no need to realloc, simply copy the tail at its respective position and insert tmp
+        matrix.data().resize(nnz_head + nnz + nnz_tail);
+
+        if(nnz<nnz_previous)
+        {
+          std::memcpy(&matrix.data().value(nnz_head+nnz), &matrix.data().value(tail), nnz_tail*sizeof(Scalar));
+          std::memcpy(&matrix.data().index(nnz_head+nnz), &matrix.data().index(tail), nnz_tail*sizeof(Index));
+        }
+        else
+        {
+          for(Index i=nnz_tail-1; i>=0; --i)
+          {
+            matrix.data().value(nnz_head+nnz+i) = matrix.data().value(tail+i);
+            matrix.data().index(nnz_head+nnz+i) = matrix.data().index(tail+i);
+          }
+        }
+
+        std::memcpy(&matrix.data().value(nnz_head), &tmp.data().value(0), nnz*sizeof(Scalar));
+        std::memcpy(&matrix.data().index(nnz_head), &tmp.data().index(0), nnz*sizeof(Index));
+      }
+
+      // update outer index pointers
+      Index p = nnz_head;
+      for(Index k=0; k<m_outerSize.value(); ++k)
+      {
+        matrix.outerIndexPtr()[m_outerStart+k] = p;
+        p += tmp.innerVector(k).nonZeros();
+      }
+      std::ptrdiff_t offset = nnz - nnz_previous;
+      for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
+      {
+        matrix.outerIndexPtr()[k] += offset;
+      }
+
+      return *this;
+    }
+
+    inline SparseInnerVectorSet& operator=(const SparseInnerVectorSet& other)
+    {
+      return operator=<SparseInnerVectorSet>(other);
+    }
+
+    inline const Scalar* valuePtr() const
+    { return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
+    inline Scalar* valuePtr()
+    { return m_matrix.const_cast_derived().valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
+
+    inline const Index* innerIndexPtr() const
+    { return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
+    inline Index* innerIndexPtr()
+    { return m_matrix.const_cast_derived().innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
+
+    inline const Index* outerIndexPtr() const
+    { return m_matrix.outerIndexPtr() + m_outerStart; }
+    inline Index* outerIndexPtr()
+    { return m_matrix.const_cast_derived().outerIndexPtr() + m_outerStart; }
+
+    Index nonZeros() const
+    {
+      if(m_matrix.isCompressed())
+        return  std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
+              - std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
+      else if(m_outerSize.value()==0)
+        return 0;
+      else
+        return Map<const Matrix<Index,Size,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
+    }
+
+    const Scalar& lastCoeff() const
+    {
+      EIGEN_STATIC_ASSERT_VECTOR_ONLY(SparseInnerVectorSet);
+      eigen_assert(nonZeros()>0);
+      if(m_matrix.isCompressed())
+        return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
+      else
+        return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
+    }
+
+//     template<typename Sparse>
+//     inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
+//     {
+//       return *this;
+//     }
+
+    EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+    EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+
+  protected:
+
+    typename MatrixType::Nested m_matrix;
+    Index m_outerStart;
+    const internal::variable_if_dynamic<Index, Size> m_outerSize;
+
+};
+
+//----------
+
+/** \returns the i-th row of the matrix \c *this. For row-major matrix only. */
+template<typename Derived>
+SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::row(Index i)
+{
+  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
+  return innerVector(i);
+}
+
+/** \returns the i-th row of the matrix \c *this. For row-major matrix only.
+  * (read-only version) */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::row(Index i) const
+{
+  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
+  return innerVector(i);
+}
+
+/** \returns the i-th column of the matrix \c *this. For column-major matrix only. */
+template<typename Derived>
+SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::col(Index i)
+{
+  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  return innerVector(i);
+}
+
+/** \returns the i-th column of the matrix \c *this. For column-major matrix only.
+  * (read-only version) */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::col(Index i) const
+{
+  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  return innerVector(i);
+}
+
+/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
+  * is col-major (resp. row-major).
+  */
+template<typename Derived>
+SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::innerVector(Index outer)
+{ return SparseInnerVectorSet<Derived,1>(derived(), outer); }
+
+/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
+  * is col-major (resp. row-major). Read-only.
+  */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,1> SparseMatrixBase<Derived>::innerVector(Index outer) const
+{ return SparseInnerVectorSet<Derived,1>(derived(), outer); }
+
+/** \returns the i-th row of the matrix \c *this. For row-major matrix only. */
+template<typename Derived>
+SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::middleRows(Index start, Index size)
+{
+  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
+  return innerVectors(start, size);
+}
+
+/** \returns the i-th row of the matrix \c *this. For row-major matrix only.
+  * (read-only version) */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::middleRows(Index start, Index size) const
+{
+  EIGEN_STATIC_ASSERT(IsRowMajor,THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES);
+  return innerVectors(start, size);
+}
+
+/** \returns the i-th column of the matrix \c *this. For column-major matrix only. */
+template<typename Derived>
+SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::middleCols(Index start, Index size)
+{
+  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  return innerVectors(start, size);
+}
+
+/** \returns the i-th column of the matrix \c *this. For column-major matrix only.
+  * (read-only version) */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::middleCols(Index start, Index size) const
+{
+  EIGEN_STATIC_ASSERT(!IsRowMajor,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+  return innerVectors(start, size);
+}
+
+
+
+/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
+  * is col-major (resp. row-major).
+  */
+template<typename Derived>
+SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
+{ return SparseInnerVectorSet<Derived,Dynamic>(derived(), outerStart, outerSize); }
+
+/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
+  * is col-major (resp. row-major). Read-only.
+  */
+template<typename Derived>
+const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
+{ return SparseInnerVectorSet<Derived,Dynamic>(derived(), outerStart, outerSize); }
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_BLOCK_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
new file mode 100644
index 0000000..d5f97f7
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
@@ -0,0 +1,324 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H
+#define EIGEN_SPARSE_CWISE_BINARY_OP_H
+
+namespace Eigen { 
+
+// Here we have to handle 3 cases:
+//  1 - sparse op dense
+//  2 - dense op sparse
+//  3 - sparse op sparse
+// We also need to implement a 4th iterator for:
+//  4 - dense op dense
+// Finally, we also need to distinguish between the product and other operations :
+//                configuration      returned mode
+//  1 - sparse op dense    product      sparse
+//                         generic      dense
+//  2 - dense op sparse    product      sparse
+//                         generic      dense
+//  3 - sparse op sparse   product      sparse
+//                         generic      sparse
+//  4 - dense op dense     product      dense
+//                         generic      dense
+
+namespace internal {
+
+template<> struct promote_storage_type<Dense,Sparse>
+{ typedef Sparse ret; };
+
+template<> struct promote_storage_type<Sparse,Dense>
+{ typedef Sparse ret; };
+
+template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
+  typename _LhsStorageMode = typename traits<Lhs>::StorageKind,
+  typename _RhsStorageMode = typename traits<Rhs>::StorageKind>
+class sparse_cwise_binary_op_inner_iterator_selector;
+
+} // end namespace internal
+
+template<typename BinaryOp, typename Lhs, typename Rhs>
+class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
+  : public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
+{
+  public:
+    class InnerIterator;
+    class ReverseInnerIterator;
+    typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
+    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
+    CwiseBinaryOpImpl()
+    {
+      typedef typename internal::traits<Lhs>::StorageKind LhsStorageKind;
+      typedef typename internal::traits<Rhs>::StorageKind RhsStorageKind;
+      EIGEN_STATIC_ASSERT((
+                (!internal::is_same<LhsStorageKind,RhsStorageKind>::value)
+            ||  ((Lhs::Flags&RowMajorBit) == (Rhs::Flags&RowMajorBit))),
+            THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH);
+    }
+};
+
+template<typename BinaryOp, typename Lhs, typename Rhs>
+class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
+  : public internal::sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator>
+{
+  public:
+    typedef typename Lhs::Index Index;
+    typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
+      BinaryOp,Lhs,Rhs, InnerIterator> Base;
+
+    EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, typename CwiseBinaryOpImpl::Index outer)
+      : Base(binOp.derived(),outer)
+    {}
+};
+
+/***************************************************************************
+* Implementation of inner-iterators
+***************************************************************************/
+
+// template<typename T> struct internal::func_is_conjunction { enum { ret = false }; };
+// template<typename T> struct internal::func_is_conjunction<internal::scalar_product_op<T> > { enum { ret = true }; };
+
+// TODO generalize the internal::scalar_product_op specialization to all conjunctions if any !
+
+namespace internal {
+
+// sparse - sparse  (generic)
+template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived>
+class sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, Sparse, Sparse>
+{
+    typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr;
+    typedef typename traits<CwiseBinaryXpr>::Scalar Scalar;
+    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+    typedef typename _LhsNested::InnerIterator LhsIterator;
+    typedef typename _RhsNested::InnerIterator RhsIterator;
+    typedef typename Lhs::Index Index;
+
+  public:
+
+    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+      : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
+    {
+      this->operator++();
+    }
+
+    EIGEN_STRONG_INLINE Derived& operator++()
+    {
+      if (m_lhsIter && m_rhsIter && (m_lhsIter.index() == m_rhsIter.index()))
+      {
+        m_id = m_lhsIter.index();
+        m_value = m_functor(m_lhsIter.value(), m_rhsIter.value());
+        ++m_lhsIter;
+        ++m_rhsIter;
+      }
+      else if (m_lhsIter && (!m_rhsIter || (m_lhsIter.index() < m_rhsIter.index())))
+      {
+        m_id = m_lhsIter.index();
+        m_value = m_functor(m_lhsIter.value(), Scalar(0));
+        ++m_lhsIter;
+      }
+      else if (m_rhsIter && (!m_lhsIter || (m_lhsIter.index() > m_rhsIter.index())))
+      {
+        m_id = m_rhsIter.index();
+        m_value = m_functor(Scalar(0), m_rhsIter.value());
+        ++m_rhsIter;
+      }
+      else
+      {
+        m_value = 0; // this is to avoid a compilation warning
+        m_id = -1;
+      }
+      return *static_cast<Derived*>(this);
+    }
+
+    EIGEN_STRONG_INLINE Scalar value() const { return m_value; }
+
+    EIGEN_STRONG_INLINE Index index() const { return m_id; }
+    EIGEN_STRONG_INLINE Index row() const { return Lhs::IsRowMajor ? m_lhsIter.row() : index(); }
+    EIGEN_STRONG_INLINE Index col() const { return Lhs::IsRowMajor ? index() : m_lhsIter.col(); }
+
+    EIGEN_STRONG_INLINE operator bool() const { return m_id>=0; }
+
+  protected:
+    LhsIterator m_lhsIter;
+    RhsIterator m_rhsIter;
+    const BinaryOp& m_functor;
+    Scalar m_value;
+    Index m_id;
+};
+
+// sparse - sparse  (product)
+template<typename T, typename Lhs, typename Rhs, typename Derived>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Sparse>
+{
+    typedef scalar_product_op<T> BinaryFunc;
+    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
+    typedef typename CwiseBinaryXpr::Scalar Scalar;
+    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+    typedef typename _LhsNested::InnerIterator LhsIterator;
+    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+    typedef typename _RhsNested::InnerIterator RhsIterator;
+    typedef typename Lhs::Index Index;
+  public:
+
+    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+      : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
+    {
+      while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
+      {
+        if (m_lhsIter.index() < m_rhsIter.index())
+          ++m_lhsIter;
+        else
+          ++m_rhsIter;
+      }
+    }
+
+    EIGEN_STRONG_INLINE Derived& operator++()
+    {
+      ++m_lhsIter;
+      ++m_rhsIter;
+      while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
+      {
+        if (m_lhsIter.index() < m_rhsIter.index())
+          ++m_lhsIter;
+        else
+          ++m_rhsIter;
+      }
+      return *static_cast<Derived*>(this);
+    }
+
+    EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsIter.value(), m_rhsIter.value()); }
+
+    EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); }
+    EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); }
+    EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); }
+
+    EIGEN_STRONG_INLINE operator bool() const { return (m_lhsIter && m_rhsIter); }
+
+  protected:
+    LhsIterator m_lhsIter;
+    RhsIterator m_rhsIter;
+    const BinaryFunc& m_functor;
+};
+
+// sparse - dense  (product)
+template<typename T, typename Lhs, typename Rhs, typename Derived>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Dense>
+{
+    typedef scalar_product_op<T> BinaryFunc;
+    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
+    typedef typename CwiseBinaryXpr::Scalar Scalar;
+    typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+    typedef typename traits<CwiseBinaryXpr>::RhsNested RhsNested;
+    typedef typename _LhsNested::InnerIterator LhsIterator;
+    typedef typename Lhs::Index Index;
+    enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit };
+  public:
+
+    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+      : m_rhs(xpr.rhs()), m_lhsIter(xpr.lhs(),outer), m_functor(xpr.functor()), m_outer(outer)
+    {}
+
+    EIGEN_STRONG_INLINE Derived& operator++()
+    {
+      ++m_lhsIter;
+      return *static_cast<Derived*>(this);
+    }
+
+    EIGEN_STRONG_INLINE Scalar value() const
+    { return m_functor(m_lhsIter.value(),
+                       m_rhs.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); }
+
+    EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); }
+    EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); }
+    EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); }
+
+    EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; }
+
+  protected:
+    RhsNested m_rhs;
+    LhsIterator m_lhsIter;
+    const BinaryFunc m_functor;
+    const Index m_outer;
+};
+
+// sparse - dense  (product)
+template<typename T, typename Lhs, typename Rhs, typename Derived>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Dense, Sparse>
+{
+    typedef scalar_product_op<T> BinaryFunc;
+    typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
+    typedef typename CwiseBinaryXpr::Scalar Scalar;
+    typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+    typedef typename _RhsNested::InnerIterator RhsIterator;
+    typedef typename Lhs::Index Index;
+
+    enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit };
+  public:
+
+    EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+      : m_xpr(xpr), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()), m_outer(outer)
+    {}
+
+    EIGEN_STRONG_INLINE Derived& operator++()
+    {
+      ++m_rhsIter;
+      return *static_cast<Derived*>(this);
+    }
+
+    EIGEN_STRONG_INLINE Scalar value() const
+    { return m_functor(m_xpr.lhs().coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); }
+
+    EIGEN_STRONG_INLINE Index index() const { return m_rhsIter.index(); }
+    EIGEN_STRONG_INLINE Index row() const { return m_rhsIter.row(); }
+    EIGEN_STRONG_INLINE Index col() const { return m_rhsIter.col(); }
+
+    EIGEN_STRONG_INLINE operator bool() const { return m_rhsIter; }
+
+  protected:
+    const CwiseBinaryXpr& m_xpr;
+    RhsIterator m_rhsIter;
+    const BinaryFunc& m_functor;
+    const Index m_outer;
+};
+
+} // end namespace internal
+
+/***************************************************************************
+* Implementation of SparseMatrixBase and SparseCwise functions/operators
+***************************************************************************/
+
+template<typename Derived>
+template<typename OtherDerived>
+EIGEN_STRONG_INLINE Derived &
+SparseMatrixBase<Derived>::operator-=(const SparseMatrixBase<OtherDerived> &other)
+{
+  return *this = derived() - other.derived();
+}
+
+template<typename Derived>
+template<typename OtherDerived>
+EIGEN_STRONG_INLINE Derived &
+SparseMatrixBase<Derived>::operator+=(const SparseMatrixBase<OtherDerived>& other)
+{
+  return *this = derived() + other.derived();
+}
+
+template<typename Derived>
+template<typename OtherDerived>
+EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
+SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
+{
+  return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(derived(), other.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_CWISE_BINARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h b/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h
new file mode 100644
index 0000000..5a50c78
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h
@@ -0,0 +1,163 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_CWISE_UNARY_OP_H
+#define EIGEN_SPARSE_CWISE_UNARY_OP_H
+
+namespace Eigen { 
+
+template<typename UnaryOp, typename MatrixType>
+class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>
+  : public SparseMatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
+{
+  public:
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
+    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
+
+  protected:
+    typedef typename internal::traits<Derived>::_XprTypeNested _MatrixTypeNested;
+    typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
+    typedef typename _MatrixTypeNested::ReverseInnerIterator MatrixTypeReverseIterator;
+};
+
+template<typename UnaryOp, typename MatrixType>
+class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
+    : public CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::MatrixTypeIterator
+{
+    typedef typename CwiseUnaryOpImpl::Scalar Scalar;
+    typedef typename CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::MatrixTypeIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryOpImpl& unaryOp, typename CwiseUnaryOpImpl::Index outer)
+      : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
+    {}
+
+    EIGEN_STRONG_INLINE InnerIterator& operator++()
+    { Base::operator++(); return *this; }
+
+    EIGEN_STRONG_INLINE typename CwiseUnaryOpImpl::Scalar value() const { return m_functor(Base::value()); }
+
+  protected:
+    const UnaryOp m_functor;
+  private:
+    typename CwiseUnaryOpImpl::Scalar& valueRef();
+};
+
+template<typename UnaryOp, typename MatrixType>
+class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::ReverseInnerIterator
+    : public CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::MatrixTypeReverseIterator
+{
+    typedef typename CwiseUnaryOpImpl::Scalar Scalar;
+    typedef typename CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::MatrixTypeReverseIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator(const CwiseUnaryOpImpl& unaryOp, typename CwiseUnaryOpImpl::Index outer)
+      : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
+    {}
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator& operator--()
+    { Base::operator--(); return *this; }
+
+    EIGEN_STRONG_INLINE typename CwiseUnaryOpImpl::Scalar value() const { return m_functor(Base::value()); }
+
+  protected:
+    const UnaryOp m_functor;
+  private:
+    typename CwiseUnaryOpImpl::Scalar& valueRef();
+};
+
+template<typename ViewOp, typename MatrixType>
+class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>
+  : public SparseMatrixBase<CwiseUnaryView<ViewOp, MatrixType> >
+{
+  public:
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
+    EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
+
+  protected:
+    typedef typename internal::traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
+    typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
+    typedef typename _MatrixTypeNested::ReverseInnerIterator MatrixTypeReverseIterator;
+};
+
+template<typename ViewOp, typename MatrixType>
+class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
+    : public CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::MatrixTypeIterator
+{
+    typedef typename CwiseUnaryViewImpl::Scalar Scalar;
+    typedef typename CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::MatrixTypeIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryViewImpl& unaryOp, typename CwiseUnaryViewImpl::Index outer)
+      : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
+    {}
+
+    EIGEN_STRONG_INLINE InnerIterator& operator++()
+    { Base::operator++(); return *this; }
+
+    EIGEN_STRONG_INLINE typename CwiseUnaryViewImpl::Scalar value() const { return m_functor(Base::value()); }
+    EIGEN_STRONG_INLINE typename CwiseUnaryViewImpl::Scalar& valueRef() { return m_functor(Base::valueRef()); }
+
+  protected:
+    const ViewOp m_functor;
+};
+
+template<typename ViewOp, typename MatrixType>
+class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::ReverseInnerIterator
+    : public CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::MatrixTypeReverseIterator
+{
+    typedef typename CwiseUnaryViewImpl::Scalar Scalar;
+    typedef typename CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::MatrixTypeReverseIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator(const CwiseUnaryViewImpl& unaryOp, typename CwiseUnaryViewImpl::Index outer)
+      : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
+    {}
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator& operator--()
+    { Base::operator--(); return *this; }
+
+    EIGEN_STRONG_INLINE typename CwiseUnaryViewImpl::Scalar value() const { return m_functor(Base::value()); }
+    EIGEN_STRONG_INLINE typename CwiseUnaryViewImpl::Scalar& valueRef() { return m_functor(Base::valueRef()); }
+
+  protected:
+    const ViewOp m_functor;
+};
+
+template<typename Derived>
+EIGEN_STRONG_INLINE Derived&
+SparseMatrixBase<Derived>::operator*=(const Scalar& other)
+{
+  for (Index j=0; j<outerSize(); ++j)
+    for (typename Derived::InnerIterator i(derived(),j); i; ++i)
+      i.valueRef() *= other;
+  return derived();
+}
+
+template<typename Derived>
+EIGEN_STRONG_INLINE Derived&
+SparseMatrixBase<Derived>::operator/=(const Scalar& other)
+{
+  for (Index j=0; j<outerSize(); ++j)
+    for (typename Derived::InnerIterator i(derived(),j); i; ++i)
+      i.valueRef() /= other;
+  return derived();
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_CWISE_UNARY_OP_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseDenseProduct.h b/extern/Eigen3/Eigen/src/SparseCore/SparseDenseProduct.h
new file mode 100644
index 0000000..6f32940
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseDenseProduct.h
@@ -0,0 +1,300 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEDENSEPRODUCT_H
+#define EIGEN_SPARSEDENSEPRODUCT_H
+
+namespace Eigen { 
+
+template<typename Lhs, typename Rhs, int InnerSize> struct SparseDenseProductReturnType
+{
+  typedef SparseTimeDenseProduct<Lhs,Rhs> Type;
+};
+
+template<typename Lhs, typename Rhs> struct SparseDenseProductReturnType<Lhs,Rhs,1>
+{
+  typedef SparseDenseOuterProduct<Lhs,Rhs,false> Type;
+};
+
+template<typename Lhs, typename Rhs, int InnerSize> struct DenseSparseProductReturnType
+{
+  typedef DenseTimeSparseProduct<Lhs,Rhs> Type;
+};
+
+template<typename Lhs, typename Rhs> struct DenseSparseProductReturnType<Lhs,Rhs,1>
+{
+  typedef SparseDenseOuterProduct<Rhs,Lhs,true> Type;
+};
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, bool Tr>
+struct traits<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
+{
+  typedef Sparse StorageKind;
+  typedef typename scalar_product_traits<typename traits<Lhs>::Scalar,
+                                            typename traits<Rhs>::Scalar>::ReturnType Scalar;
+  typedef typename Lhs::Index Index;
+  typedef typename Lhs::Nested LhsNested;
+  typedef typename Rhs::Nested RhsNested;
+  typedef typename remove_all<LhsNested>::type _LhsNested;
+  typedef typename remove_all<RhsNested>::type _RhsNested;
+
+  enum {
+    LhsCoeffReadCost = traits<_LhsNested>::CoeffReadCost,
+    RhsCoeffReadCost = traits<_RhsNested>::CoeffReadCost,
+
+    RowsAtCompileTime    = Tr ? int(traits<Rhs>::RowsAtCompileTime)     : int(traits<Lhs>::RowsAtCompileTime),
+    ColsAtCompileTime    = Tr ? int(traits<Lhs>::ColsAtCompileTime)     : int(traits<Rhs>::ColsAtCompileTime),
+    MaxRowsAtCompileTime = Tr ? int(traits<Rhs>::MaxRowsAtCompileTime)  : int(traits<Lhs>::MaxRowsAtCompileTime),
+    MaxColsAtCompileTime = Tr ? int(traits<Lhs>::MaxColsAtCompileTime)  : int(traits<Rhs>::MaxColsAtCompileTime),
+
+    Flags = Tr ? RowMajorBit : 0,
+
+    CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + NumTraits<Scalar>::MulCost
+  };
+};
+
+} // end namespace internal
+
+template<typename Lhs, typename Rhs, bool Tr>
+class SparseDenseOuterProduct
+ : public SparseMatrixBase<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
+{
+  public:
+
+    typedef SparseMatrixBase<SparseDenseOuterProduct> Base;
+    EIGEN_DENSE_PUBLIC_INTERFACE(SparseDenseOuterProduct)
+    typedef internal::traits<SparseDenseOuterProduct> Traits;
+
+  private:
+
+    typedef typename Traits::LhsNested LhsNested;
+    typedef typename Traits::RhsNested RhsNested;
+    typedef typename Traits::_LhsNested _LhsNested;
+    typedef typename Traits::_RhsNested _RhsNested;
+
+  public:
+
+    class InnerIterator;
+
+    EIGEN_STRONG_INLINE SparseDenseOuterProduct(const Lhs& lhs, const Rhs& rhs)
+      : m_lhs(lhs), m_rhs(rhs)
+    {
+      EIGEN_STATIC_ASSERT(!Tr,YOU_MADE_A_PROGRAMMING_MISTAKE);
+    }
+
+    EIGEN_STRONG_INLINE SparseDenseOuterProduct(const Rhs& rhs, const Lhs& lhs)
+      : m_lhs(lhs), m_rhs(rhs)
+    {
+      EIGEN_STATIC_ASSERT(Tr,YOU_MADE_A_PROGRAMMING_MISTAKE);
+    }
+
+    EIGEN_STRONG_INLINE Index rows() const { return Tr ? m_rhs.rows() : m_lhs.rows(); }
+    EIGEN_STRONG_INLINE Index cols() const { return Tr ? m_lhs.cols() : m_rhs.cols(); }
+
+    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
+    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
+
+  protected:
+    LhsNested m_lhs;
+    RhsNested m_rhs;
+};
+
+template<typename Lhs, typename Rhs, bool Transpose>
+class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNested::InnerIterator
+{
+    typedef typename _LhsNested::InnerIterator Base;
+  public:
+    EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
+      : Base(prod.lhs(), 0), m_outer(outer), m_factor(prod.rhs().coeff(outer))
+    {
+    }
+
+    inline Index outer() const { return m_outer; }
+    inline Index row() const { return Transpose ? Base::row() : m_outer; }
+    inline Index col() const { return Transpose ? m_outer : Base::row(); }
+
+    inline Scalar value() const { return Base::value() * m_factor; }
+
+  protected:
+    int m_outer;
+    Scalar m_factor;
+};
+
+namespace internal {
+template<typename Lhs, typename Rhs>
+struct traits<SparseTimeDenseProduct<Lhs,Rhs> >
+ : traits<ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs> >
+{
+  typedef Dense StorageKind;
+  typedef MatrixXpr XprKind;
+};
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType,
+         int LhsStorageOrder = ((SparseLhsType::Flags&RowMajorBit)==RowMajorBit) ? RowMajor : ColMajor,
+         bool ColPerCol = ((DenseRhsType::Flags&RowMajorBit)==0) || DenseRhsType::ColsAtCompileTime==1>
+struct sparse_time_dense_product_impl;
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType>
+struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, RowMajor, true>
+{
+  typedef typename internal::remove_all<SparseLhsType>::type Lhs;
+  typedef typename internal::remove_all<DenseRhsType>::type Rhs;
+  typedef typename internal::remove_all<DenseResType>::type Res;
+  typedef typename Lhs::Index Index;
+  typedef typename Lhs::InnerIterator LhsInnerIterator;
+  static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, typename Res::Scalar alpha)
+  {
+    for(Index c=0; c<rhs.cols(); ++c)
+    {
+      int n = lhs.outerSize();
+      for(Index j=0; j<n; ++j)
+      {
+        typename Res::Scalar tmp(0);
+        for(LhsInnerIterator it(lhs,j); it ;++it)
+          tmp += it.value() * rhs.coeff(it.index(),c);
+        res.coeffRef(j,c) = alpha * tmp;
+      }
+    }
+  }
+};
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType>
+struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, ColMajor, true>
+{
+  typedef typename internal::remove_all<SparseLhsType>::type Lhs;
+  typedef typename internal::remove_all<DenseRhsType>::type Rhs;
+  typedef typename internal::remove_all<DenseResType>::type Res;
+  typedef typename Lhs::InnerIterator LhsInnerIterator;
+  typedef typename Lhs::Index Index;
+  static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, typename Res::Scalar alpha)
+  {
+    for(Index c=0; c<rhs.cols(); ++c)
+    {
+      for(Index j=0; j<lhs.outerSize(); ++j)
+      {
+        typename Res::Scalar rhs_j = alpha * rhs.coeff(j,c);
+        for(LhsInnerIterator it(lhs,j); it ;++it)
+          res.coeffRef(it.index(),c) += it.value() * rhs_j;
+      }
+    }
+  }
+};
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType>
+struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, RowMajor, false>
+{
+  typedef typename internal::remove_all<SparseLhsType>::type Lhs;
+  typedef typename internal::remove_all<DenseRhsType>::type Rhs;
+  typedef typename internal::remove_all<DenseResType>::type Res;
+  typedef typename Lhs::InnerIterator LhsInnerIterator;
+  typedef typename Lhs::Index Index;
+  static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, typename Res::Scalar alpha)
+  {
+    for(Index j=0; j<lhs.outerSize(); ++j)
+    {
+      typename Res::RowXpr res_j(res.row(j));
+      for(LhsInnerIterator it(lhs,j); it ;++it)
+        res_j += (alpha*it.value()) * rhs.row(it.index());
+    }
+  }
+};
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType>
+struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, ColMajor, false>
+{
+  typedef typename internal::remove_all<SparseLhsType>::type Lhs;
+  typedef typename internal::remove_all<DenseRhsType>::type Rhs;
+  typedef typename internal::remove_all<DenseResType>::type Res;
+  typedef typename Lhs::InnerIterator LhsInnerIterator;
+  typedef typename Lhs::Index Index;
+  static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, typename Res::Scalar alpha)
+  {
+    for(Index j=0; j<lhs.outerSize(); ++j)
+    {
+      typename Rhs::ConstRowXpr rhs_j(rhs.row(j));
+      for(LhsInnerIterator it(lhs,j); it ;++it)
+        res.row(it.index()) += (alpha*it.value()) * rhs_j;
+    }
+  }
+};
+
+template<typename SparseLhsType, typename DenseRhsType, typename DenseResType,typename AlphaType>
+inline void sparse_time_dense_product(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha)
+{
+  sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType>::run(lhs, rhs, res, alpha);
+}
+
+} // end namespace internal
+
+template<typename Lhs, typename Rhs>
+class SparseTimeDenseProduct
+  : public ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(SparseTimeDenseProduct)
+
+    SparseTimeDenseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {}
+
+    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
+    {
+      internal::sparse_time_dense_product(m_lhs, m_rhs, dest, alpha);
+    }
+
+  private:
+    SparseTimeDenseProduct& operator=(const SparseTimeDenseProduct&);
+};
+
+
+// dense = dense * sparse
+namespace internal {
+template<typename Lhs, typename Rhs>
+struct traits<DenseTimeSparseProduct<Lhs,Rhs> >
+ : traits<ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs> >
+{
+  typedef Dense StorageKind;
+};
+} // end namespace internal
+
+template<typename Lhs, typename Rhs>
+class DenseTimeSparseProduct
+  : public ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(DenseTimeSparseProduct)
+
+    DenseTimeSparseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {}
+
+    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
+    {
+      Transpose<const _LhsNested> lhs_t(m_lhs);
+      Transpose<const _RhsNested> rhs_t(m_rhs);
+      Transpose<Dest> dest_t(dest);
+      internal::sparse_time_dense_product(rhs_t, lhs_t, dest_t, alpha);
+    }
+
+  private:
+    DenseTimeSparseProduct& operator=(const DenseTimeSparseProduct&);
+};
+
+// sparse * dense
+template<typename Derived>
+template<typename OtherDerived>
+inline const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
+SparseMatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
+{
+  return typename SparseDenseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEDENSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h b/extern/Eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h
new file mode 100644
index 0000000..095bf68
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h
@@ -0,0 +1,184 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_DIAGONAL_PRODUCT_H
+#define EIGEN_SPARSE_DIAGONAL_PRODUCT_H
+
+namespace Eigen { 
+
+// The product of a diagonal matrix with a sparse matrix can be easily
+// implemented using expression template.
+// We have two consider very different cases:
+// 1 - diag * row-major sparse
+//     => each inner vector <=> scalar * sparse vector product
+//     => so we can reuse CwiseUnaryOp::InnerIterator
+// 2 - diag * col-major sparse
+//     => each inner vector <=> densevector * sparse vector cwise product
+//     => again, we can reuse specialization of CwiseBinaryOp::InnerIterator
+//        for that particular case
+// The two other cases are symmetric.
+
+namespace internal {
+
+template<typename Lhs, typename Rhs>
+struct traits<SparseDiagonalProduct<Lhs, Rhs> >
+{
+  typedef typename remove_all<Lhs>::type _Lhs;
+  typedef typename remove_all<Rhs>::type _Rhs;
+  typedef typename _Lhs::Scalar Scalar;
+  typedef typename promote_index_type<typename traits<Lhs>::Index,
+                                         typename traits<Rhs>::Index>::type Index;
+  typedef Sparse StorageKind;
+  typedef MatrixXpr XprKind;
+  enum {
+    RowsAtCompileTime = _Lhs::RowsAtCompileTime,
+    ColsAtCompileTime = _Rhs::ColsAtCompileTime,
+
+    MaxRowsAtCompileTime = _Lhs::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = _Rhs::MaxColsAtCompileTime,
+
+    SparseFlags = is_diagonal<_Lhs>::ret ? int(_Rhs::Flags) : int(_Lhs::Flags),
+    Flags = (SparseFlags&RowMajorBit),
+    CoeffReadCost = Dynamic
+  };
+};
+
+enum {SDP_IsDiagonal, SDP_IsSparseRowMajor, SDP_IsSparseColMajor};
+template<typename Lhs, typename Rhs, typename SparseDiagonalProductType, int RhsMode, int LhsMode>
+class sparse_diagonal_product_inner_iterator_selector;
+
+} // end namespace internal
+
+template<typename Lhs, typename Rhs>
+class SparseDiagonalProduct
+  : public SparseMatrixBase<SparseDiagonalProduct<Lhs,Rhs> >,
+    internal::no_assignment_operator
+{
+    typedef typename Lhs::Nested LhsNested;
+    typedef typename Rhs::Nested RhsNested;
+
+    typedef typename internal::remove_all<LhsNested>::type _LhsNested;
+    typedef typename internal::remove_all<RhsNested>::type _RhsNested;
+
+    enum {
+      LhsMode = internal::is_diagonal<_LhsNested>::ret ? internal::SDP_IsDiagonal
+              : (_LhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor,
+      RhsMode = internal::is_diagonal<_RhsNested>::ret ? internal::SDP_IsDiagonal
+              : (_RhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor
+    };
+
+  public:
+
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseDiagonalProduct)
+
+    typedef internal::sparse_diagonal_product_inner_iterator_selector
+                <_LhsNested,_RhsNested,SparseDiagonalProduct,LhsMode,RhsMode> InnerIterator;
+
+    EIGEN_STRONG_INLINE SparseDiagonalProduct(const Lhs& lhs, const Rhs& rhs)
+      : m_lhs(lhs), m_rhs(rhs)
+    {
+      eigen_assert(lhs.cols() == rhs.rows() && "invalid sparse matrix * diagonal matrix product");
+    }
+
+    EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
+    EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
+
+    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
+    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
+
+  protected:
+    LhsNested m_lhs;
+    RhsNested m_rhs;
+};
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
+class sparse_diagonal_product_inner_iterator_selector
+<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
+  : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator
+{
+    typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator Base;
+    typedef typename Lhs::Index Index;
+  public:
+    inline sparse_diagonal_product_inner_iterator_selector(
+              const SparseDiagonalProductType& expr, Index outer)
+      : Base(expr.rhs()*(expr.lhs().diagonal().coeff(outer)), outer)
+    {}
+};
+
+template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
+class sparse_diagonal_product_inner_iterator_selector
+<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseColMajor>
+  : public CwiseBinaryOp<
+      scalar_product_op<typename Lhs::Scalar>,
+      SparseInnerVectorSet<Rhs,1>,
+      typename Lhs::DiagonalVectorType>::InnerIterator
+{
+    typedef typename CwiseBinaryOp<
+      scalar_product_op<typename Lhs::Scalar>,
+      SparseInnerVectorSet<Rhs,1>,
+      typename Lhs::DiagonalVectorType>::InnerIterator Base;
+    typedef typename Lhs::Index Index;
+  public:
+    inline sparse_diagonal_product_inner_iterator_selector(
+              const SparseDiagonalProductType& expr, Index outer)
+      : Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0)
+    {}
+};
+
+template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
+class sparse_diagonal_product_inner_iterator_selector
+<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
+  : public CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator
+{
+    typedef typename CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator Base;
+    typedef typename Lhs::Index Index;
+  public:
+    inline sparse_diagonal_product_inner_iterator_selector(
+              const SparseDiagonalProductType& expr, Index outer)
+      : Base(expr.lhs()*expr.rhs().diagonal().coeff(outer), outer)
+    {}
+};
+
+template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
+class sparse_diagonal_product_inner_iterator_selector
+<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseRowMajor,SDP_IsDiagonal>
+  : public CwiseBinaryOp<
+      scalar_product_op<typename Rhs::Scalar>,
+      SparseInnerVectorSet<Lhs,1>,
+      Transpose<const typename Rhs::DiagonalVectorType> >::InnerIterator
+{
+    typedef typename CwiseBinaryOp<
+      scalar_product_op<typename Rhs::Scalar>,
+      SparseInnerVectorSet<Lhs,1>,
+      Transpose<const typename Rhs::DiagonalVectorType> >::InnerIterator Base;
+    typedef typename Lhs::Index Index;
+  public:
+    inline sparse_diagonal_product_inner_iterator_selector(
+              const SparseDiagonalProductType& expr, Index outer)
+      : Base(expr.lhs().innerVector(outer) .cwiseProduct(expr.rhs().diagonal().transpose()), 0)
+    {}
+};
+
+} // end namespace internal
+
+// SparseMatrixBase functions
+
+template<typename Derived>
+template<typename OtherDerived>
+const SparseDiagonalProduct<Derived,OtherDerived>
+SparseMatrixBase<Derived>::operator*(const DiagonalBase<OtherDerived> &other) const
+{
+  return SparseDiagonalProduct<Derived,OtherDerived>(this->derived(), other.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_DIAGONAL_PRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseDot.h b/extern/Eigen3/Eigen/src/SparseCore/SparseDot.h
new file mode 100644
index 0000000..5c4a593
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseDot.h
@@ -0,0 +1,94 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_DOT_H
+#define EIGEN_SPARSE_DOT_H
+
+namespace Eigen { 
+
+template<typename Derived>
+template<typename OtherDerived>
+typename internal::traits<Derived>::Scalar
+SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
+{
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+  EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
+  EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
+    YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+
+  eigen_assert(size() == other.size());
+  eigen_assert(other.size()>0 && "you are using a non initialized vector");
+
+  typename Derived::InnerIterator i(derived(),0);
+  Scalar res(0);
+  while (i)
+  {
+    res += internal::conj(i.value()) * other.coeff(i.index());
+    ++i;
+  }
+  return res;
+}
+
+template<typename Derived>
+template<typename OtherDerived>
+typename internal::traits<Derived>::Scalar
+SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) const
+{
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
+  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
+  EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
+  EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
+    YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+
+  eigen_assert(size() == other.size());
+
+  typedef typename Derived::Nested  Nested;
+  typedef typename OtherDerived::Nested  OtherNested;
+  typedef typename internal::remove_all<Nested>::type  NestedCleaned;
+  typedef typename internal::remove_all<OtherNested>::type  OtherNestedCleaned;
+
+  const Nested nthis(derived());
+  const OtherNested nother(other.derived());
+
+  typename NestedCleaned::InnerIterator i(nthis,0);
+  typename OtherNestedCleaned::InnerIterator j(nother,0);
+  Scalar res(0);
+  while (i && j)
+  {
+    if (i.index()==j.index())
+    {
+      res += internal::conj(i.value()) * j.value();
+      ++i; ++j;
+    }
+    else if (i.index()<j.index())
+      ++i;
+    else
+      ++j;
+  }
+  return res;
+}
+
+template<typename Derived>
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
+SparseMatrixBase<Derived>::squaredNorm() const
+{
+  return internal::real((*this).cwiseAbs2().sum());
+}
+
+template<typename Derived>
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
+SparseMatrixBase<Derived>::norm() const
+{
+  return internal::sqrt(squaredNorm());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_DOT_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseFuzzy.h b/extern/Eigen3/Eigen/src/SparseCore/SparseFuzzy.h
new file mode 100644
index 0000000..45f36e9
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseFuzzy.h
@@ -0,0 +1,26 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_FUZZY_H
+#define EIGEN_SPARSE_FUZZY_H
+
+// template<typename Derived>
+// template<typename OtherDerived>
+// bool SparseMatrixBase<Derived>::isApprox(
+//   const OtherDerived& other,
+//   typename NumTraits<Scalar>::Real prec
+// ) const
+// {
+//   const typename internal::nested<Derived,2>::type nested(derived());
+//   const typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
+//   return    (nested - otherNested).cwise().abs2().sum()
+//          <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum());
+// }
+
+#endif // EIGEN_SPARSE_FUZZY_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseMatrix.h b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrix.h
new file mode 100644
index 0000000..efb774f
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrix.h
@@ -0,0 +1,1116 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEMATRIX_H
+#define EIGEN_SPARSEMATRIX_H
+
+namespace Eigen { 
+
+/** \ingroup SparseCore_Module
+  *
+  * \class SparseMatrix
+  *
+  * \brief A versatible sparse matrix representation
+  *
+  * This class implements a more versatile variants of the common \em compressed row/column storage format.
+  * Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index.
+  * All the non zeros are stored in a single large buffer. Unlike the \em compressed format, there might be extra
+  * space inbetween the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero
+  * can be done with limited memory reallocation and copies.
+  *
+  * A call to the function makeCompressed() turns the matrix into the standard \em compressed format
+  * compatible with many library.
+  *
+  * More details on this storage sceheme are given in the \ref TutorialSparse "manual pages".
+  *
+  * \tparam _Scalar the scalar type, i.e. the type of the coefficients
+  * \tparam _Options Union of bit flags controlling the storage scheme. Currently the only possibility
+  *                 is RowMajor. The default is 0 which means column-major.
+  * \tparam _Index the type of the indices. It has to be a \b signed type (e.g., short, int, std::ptrdiff_t). Default is \c int.
+  *
+  * This class can be extended with the help of the plugin mechanism described on the page
+  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIX_PLUGIN.
+  */
+
+namespace internal {
+template<typename _Scalar, int _Options, typename _Index>
+struct traits<SparseMatrix<_Scalar, _Options, _Index> >
+{
+  typedef _Scalar Scalar;
+  typedef _Index Index;
+  typedef Sparse StorageKind;
+  typedef MatrixXpr XprKind;
+  enum {
+    RowsAtCompileTime = Dynamic,
+    ColsAtCompileTime = Dynamic,
+    MaxRowsAtCompileTime = Dynamic,
+    MaxColsAtCompileTime = Dynamic,
+    Flags = _Options | NestByRefBit | LvalueBit,
+    CoeffReadCost = NumTraits<Scalar>::ReadCost,
+    SupportedAccessPatterns = InnerRandomAccessPattern
+  };
+};
+
+template<typename _Scalar, int _Options, typename _Index, int DiagIndex>
+struct traits<Diagonal<const SparseMatrix<_Scalar, _Options, _Index>, DiagIndex> >
+{
+  typedef SparseMatrix<_Scalar, _Options, _Index> MatrixType;
+  typedef typename nested<MatrixType>::type MatrixTypeNested;
+  typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
+
+  typedef _Scalar Scalar;
+  typedef Dense StorageKind;
+  typedef _Index Index;
+  typedef MatrixXpr XprKind;
+
+  enum {
+    RowsAtCompileTime = Dynamic,
+    ColsAtCompileTime = 1,
+    MaxRowsAtCompileTime = Dynamic,
+    MaxColsAtCompileTime = 1,
+    Flags = 0,
+    CoeffReadCost = _MatrixTypeNested::CoeffReadCost*10
+  };
+};
+
+} // end namespace internal
+
+template<typename _Scalar, int _Options, typename _Index>
+class SparseMatrix
+  : public SparseMatrixBase<SparseMatrix<_Scalar, _Options, _Index> >
+{
+  public:
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
+    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseMatrix, +=)
+    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseMatrix, -=)
+
+    typedef MappedSparseMatrix<Scalar,Flags> Map;
+    using Base::IsRowMajor;
+    typedef internal::CompressedStorage<Scalar,Index> Storage;
+    enum {
+      Options = _Options
+    };
+
+  protected:
+
+    typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix;
+
+    Index m_outerSize;
+    Index m_innerSize;
+    Index* m_outerIndex;
+    Index* m_innerNonZeros;     // optional, if null then the data is compressed
+    Storage m_data;
+    
+    Eigen::Map<Matrix<Index,Dynamic,1> > innerNonZeros() { return Eigen::Map<Matrix<Index,Dynamic,1> >(m_innerNonZeros, m_innerNonZeros?m_outerSize:0); }
+    const  Eigen::Map<const Matrix<Index,Dynamic,1> > innerNonZeros() const { return Eigen::Map<const Matrix<Index,Dynamic,1> >(m_innerNonZeros, m_innerNonZeros?m_outerSize:0); }
+
+  public:
+    
+    /** \returns whether \c *this is in compressed form. */
+    inline bool isCompressed() const { return m_innerNonZeros==0; }
+
+    /** \returns the number of rows of the matrix */
+    inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
+    /** \returns the number of columns of the matrix */
+    inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
+
+    /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */
+    inline Index innerSize() const { return m_innerSize; }
+    /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */
+    inline Index outerSize() const { return m_outerSize; }
+    
+    /** \returns a const pointer to the array of values.
+      * This function is aimed at interoperability with other libraries.
+      * \sa innerIndexPtr(), outerIndexPtr() */
+    inline const Scalar* valuePtr() const { return &m_data.value(0); }
+    /** \returns a non-const pointer to the array of values.
+      * This function is aimed at interoperability with other libraries.
+      * \sa innerIndexPtr(), outerIndexPtr() */
+    inline Scalar* valuePtr() { return &m_data.value(0); }
+
+    /** \returns a const pointer to the array of inner indices.
+      * This function is aimed at interoperability with other libraries.
+      * \sa valuePtr(), outerIndexPtr() */
+    inline const Index* innerIndexPtr() const { return &m_data.index(0); }
+    /** \returns a non-const pointer to the array of inner indices.
+      * This function is aimed at interoperability with other libraries.
+      * \sa valuePtr(), outerIndexPtr() */
+    inline Index* innerIndexPtr() { return &m_data.index(0); }
+
+    /** \returns a const pointer to the array of the starting positions of the inner vectors.
+      * This function is aimed at interoperability with other libraries.
+      * \sa valuePtr(), innerIndexPtr() */
+    inline const Index* outerIndexPtr() const { return m_outerIndex; }
+    /** \returns a non-const pointer to the array of the starting positions of the inner vectors.
+      * This function is aimed at interoperability with other libraries.
+      * \sa valuePtr(), innerIndexPtr() */
+    inline Index* outerIndexPtr() { return m_outerIndex; }
+
+    /** \returns a const pointer to the array of the number of non zeros of the inner vectors.
+      * This function is aimed at interoperability with other libraries.
+      * \warning it returns the null pointer 0 in compressed mode */
+    inline const Index* innerNonZeroPtr() const { return m_innerNonZeros; }
+    /** \returns a non-const pointer to the array of the number of non zeros of the inner vectors.
+      * This function is aimed at interoperability with other libraries.
+      * \warning it returns the null pointer 0 in compressed mode */
+    inline Index* innerNonZeroPtr() { return m_innerNonZeros; }
+
+    /** \internal */
+    inline Storage& data() { return m_data; }
+    /** \internal */
+    inline const Storage& data() const { return m_data; }
+
+    /** \returns the value of the matrix at position \a i, \a j
+      * This function returns Scalar(0) if the element is an explicit \em zero */
+    inline Scalar coeff(Index row, Index col) const
+    {
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+      Index end = m_innerNonZeros ? m_outerIndex[outer] + m_innerNonZeros[outer] : m_outerIndex[outer+1];
+      return m_data.atInRange(m_outerIndex[outer], end, inner);
+    }
+
+    /** \returns a non-const reference to the value of the matrix at position \a i, \a j
+      *
+      * If the element does not exist then it is inserted via the insert(Index,Index) function
+      * which itself turns the matrix into a non compressed form if that was not the case.
+      *
+      * This is a O(log(nnz_j)) operation (binary search) plus the cost of insert(Index,Index)
+      * function if the element does not already exist.
+      */
+    inline Scalar& coeffRef(Index row, Index col)
+    {
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      Index start = m_outerIndex[outer];
+      Index end = m_innerNonZeros ? m_outerIndex[outer] + m_innerNonZeros[outer] : m_outerIndex[outer+1];
+      eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
+      if(end<=start)
+        return insert(row,col);
+      const Index p = m_data.searchLowerIndex(start,end-1,inner);
+      if((p<end) && (m_data.index(p)==inner))
+        return m_data.value(p);
+      else
+        return insert(row,col);
+    }
+
+    /** \returns a reference to a novel non zero coefficient with coordinates \a row x \a col.
+      * The non zero coefficient must \b not already exist.
+      *
+      * If the matrix \c *this is in compressed mode, then \c *this is turned into uncompressed
+      * mode while reserving room for 2 non zeros per inner vector. It is strongly recommended to first
+      * call reserve(const SizesType &) to reserve a more appropriate number of elements per
+      * inner vector that better match your scenario.
+      *
+      * This function performs a sorted insertion in O(1) if the elements of each inner vector are
+      * inserted in increasing inner index order, and in O(nnz_j) for a random insertion.
+      *
+      */
+    EIGEN_DONT_INLINE Scalar& insert(Index row, Index col)
+    {
+      if(isCompressed())
+      {
+        reserve(VectorXi::Constant(outerSize(), 2));
+      }
+      return insertUncompressed(row,col);
+    }
+
+  public:
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    /** Removes all non zeros but keep allocated memory */
+    inline void setZero()
+    {
+      m_data.clear();
+      memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(Index));
+      if(m_innerNonZeros)
+        memset(m_innerNonZeros, 0, (m_outerSize)*sizeof(Index));
+    }
+
+    /** \returns the number of non zero coefficients */
+    inline Index nonZeros() const
+    {
+      if(m_innerNonZeros)
+        return innerNonZeros().sum();
+      return static_cast<Index>(m_data.size());
+    }
+
+    /** Preallocates \a reserveSize non zeros.
+      *
+      * Precondition: the matrix must be in compressed mode. */
+    inline void reserve(Index reserveSize)
+    {
+      eigen_assert(isCompressed() && "This function does not make sense in non compressed mode.");
+      m_data.reserve(reserveSize);
+    }
+    
+    #ifdef EIGEN_PARSED_BY_DOXYGEN
+    /** Preallocates \a reserveSize[\c j] non zeros for each column (resp. row) \c j.
+      *
+      * This function turns the matrix in non-compressed mode */
+    template<class SizesType>
+    inline void reserve(const SizesType& reserveSizes);
+    #else
+    template<class SizesType>
+    inline void reserve(const SizesType& reserveSizes, const typename SizesType::value_type& enableif = typename SizesType::value_type())
+    {
+      EIGEN_UNUSED_VARIABLE(enableif);
+      reserveInnerVectors(reserveSizes);
+    }
+    template<class SizesType>
+    inline void reserve(const SizesType& reserveSizes, const typename SizesType::Scalar& enableif =
+    #if (!defined(_MSC_VER)) || (_MSC_VER>=1500) // MSVC 2005 fails to compile with this typename
+        typename
+    #endif
+        SizesType::Scalar())
+    {
+      EIGEN_UNUSED_VARIABLE(enableif);
+      reserveInnerVectors(reserveSizes);
+    }
+    #endif // EIGEN_PARSED_BY_DOXYGEN
+  protected:
+    template<class SizesType>
+    inline void reserveInnerVectors(const SizesType& reserveSizes)
+    {
+      
+      if(isCompressed())
+      {
+        std::size_t totalReserveSize = 0;
+        // turn the matrix into non-compressed mode
+        m_innerNonZeros = new Index[m_outerSize];
+        
+        // temporarily use m_innerSizes to hold the new starting points.
+        Index* newOuterIndex = m_innerNonZeros;
+        
+        Index count = 0;
+        for(Index j=0; j<m_outerSize; ++j)
+        {
+          newOuterIndex[j] = count;
+          count += reserveSizes[j] + (m_outerIndex[j+1]-m_outerIndex[j]);
+          totalReserveSize += reserveSizes[j];
+        }
+        m_data.reserve(totalReserveSize);
+        std::ptrdiff_t previousOuterIndex = m_outerIndex[m_outerSize];
+        for(std::ptrdiff_t j=m_outerSize-1; j>=0; --j)
+        {
+          ptrdiff_t innerNNZ = previousOuterIndex - m_outerIndex[j];
+          for(std::ptrdiff_t i=innerNNZ-1; i>=0; --i)
+          {
+            m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
+            m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
+          }
+          previousOuterIndex = m_outerIndex[j];
+          m_outerIndex[j] = newOuterIndex[j];
+          m_innerNonZeros[j] = innerNNZ;
+        }
+        m_outerIndex[m_outerSize] = m_outerIndex[m_outerSize-1] + m_innerNonZeros[m_outerSize-1] + reserveSizes[m_outerSize-1];
+        
+        m_data.resize(m_outerIndex[m_outerSize]);
+      }
+      else
+      {
+        Index* newOuterIndex = new Index[m_outerSize+1];
+        Index count = 0;
+        for(Index j=0; j<m_outerSize; ++j)
+        {
+          newOuterIndex[j] = count;
+          Index alreadyReserved = (m_outerIndex[j+1]-m_outerIndex[j]) - m_innerNonZeros[j];
+          Index toReserve = std::max<std::ptrdiff_t>(reserveSizes[j], alreadyReserved);
+          count += toReserve + m_innerNonZeros[j];
+        }
+        newOuterIndex[m_outerSize] = count;
+        
+        m_data.resize(count);
+        for(ptrdiff_t j=m_outerSize-1; j>=0; --j)
+        {
+          std::ptrdiff_t offset = newOuterIndex[j] - m_outerIndex[j];
+          if(offset>0)
+          {
+            std::ptrdiff_t innerNNZ = m_innerNonZeros[j];
+            for(std::ptrdiff_t i=innerNNZ-1; i>=0; --i)
+            {
+              m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
+              m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
+            }
+          }
+        }
+        
+        std::swap(m_outerIndex, newOuterIndex);
+        delete[] newOuterIndex;
+      }
+      
+    }
+  public:
+
+    //--- low level purely coherent filling ---
+
+    /** \internal
+      * \returns a reference to the non zero coefficient at position \a row, \a col assuming that:
+      * - the nonzero does not already exist
+      * - the new coefficient is the last one according to the storage order
+      *
+      * Before filling a given inner vector you must call the statVec(Index) function.
+      *
+      * After an insertion session, you should call the finalize() function.
+      *
+      * \sa insert, insertBackByOuterInner, startVec */
+    inline Scalar& insertBack(Index row, Index col)
+    {
+      return insertBackByOuterInner(IsRowMajor?row:col, IsRowMajor?col:row);
+    }
+
+    /** \internal
+      * \sa insertBack, startVec */
+    inline Scalar& insertBackByOuterInner(Index outer, Index inner)
+    {
+      eigen_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
+      eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
+      Index p = m_outerIndex[outer+1];
+      ++m_outerIndex[outer+1];
+      m_data.append(0, inner);
+      return m_data.value(p);
+    }
+
+    /** \internal
+      * \warning use it only if you know what you are doing */
+    inline Scalar& insertBackByOuterInnerUnordered(Index outer, Index inner)
+    {
+      Index p = m_outerIndex[outer+1];
+      ++m_outerIndex[outer+1];
+      m_data.append(0, inner);
+      return m_data.value(p);
+    }
+
+    /** \internal
+      * \sa insertBack, insertBackByOuterInner */
+    inline void startVec(Index outer)
+    {
+      eigen_assert(m_outerIndex[outer]==int(m_data.size()) && "You must call startVec for each inner vector sequentially");
+      eigen_assert(m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially");
+      m_outerIndex[outer+1] = m_outerIndex[outer];
+    }
+
+    /** \internal
+      * Must be called after inserting a set of non zero entries using the low level compressed API.
+      */
+    inline void finalize()
+    {
+      if(isCompressed())
+      {
+        Index size = static_cast<Index>(m_data.size());
+        Index i = m_outerSize;
+        // find the last filled column
+        while (i>=0 && m_outerIndex[i]==0)
+          --i;
+        ++i;
+        while (i<=m_outerSize)
+        {
+          m_outerIndex[i] = size;
+          ++i;
+        }
+      }
+    }
+
+    //---
+
+    template<typename InputIterators>
+    void setFromTriplets(const InputIterators& begin, const InputIterators& end);
+
+    void sumupDuplicates();
+
+    //---
+    
+    /** \internal
+      * same as insert(Index,Index) except that the indices are given relative to the storage order */
+    EIGEN_DONT_INLINE Scalar& insertByOuterInner(Index j, Index i)
+    {
+      return insert(IsRowMajor ? j : i, IsRowMajor ? i : j);
+    }
+
+    /** Turns the matrix into the \em compressed format.
+      */
+    void makeCompressed()
+    {
+      if(isCompressed())
+        return;
+      
+      Index oldStart = m_outerIndex[1];
+      m_outerIndex[1] = m_innerNonZeros[0];
+      for(Index j=1; j<m_outerSize; ++j)
+      {
+        Index nextOldStart = m_outerIndex[j+1];
+        std::ptrdiff_t offset = oldStart - m_outerIndex[j];
+        if(offset>0)
+        {
+          for(Index k=0; k<m_innerNonZeros[j]; ++k)
+          {
+            m_data.index(m_outerIndex[j]+k) = m_data.index(oldStart+k);
+            m_data.value(m_outerIndex[j]+k) = m_data.value(oldStart+k);
+          }
+        }
+        m_outerIndex[j+1] = m_outerIndex[j] + m_innerNonZeros[j];
+        oldStart = nextOldStart;
+      }
+      delete[] m_innerNonZeros;
+      m_innerNonZeros = 0;
+      m_data.resize(m_outerIndex[m_outerSize]);
+      m_data.squeeze();
+    }
+
+    /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerence \a epsilon */
+    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
+    {
+      prune(default_prunning_func(reference,epsilon));
+    }
+    
+    /** Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predicate \a keep.
+      * The functor type \a KeepFunc must implement the following function:
+      * \code
+      * bool operator() (const Index& row, const Index& col, const Scalar& value) const;
+      * \endcode
+      * \sa prune(Scalar,RealScalar)
+      */
+    template<typename KeepFunc>
+    void prune(const KeepFunc& keep = KeepFunc())
+    {
+      // TODO optimize the uncompressed mode to avoid moving and allocating the data twice
+      // TODO also implement a unit test
+      makeCompressed();
+
+      Index k = 0;
+      for(Index j=0; j<m_outerSize; ++j)
+      {
+        Index previousStart = m_outerIndex[j];
+        m_outerIndex[j] = k;
+        Index end = m_outerIndex[j+1];
+        for(Index i=previousStart; i<end; ++i)
+        {
+          if(keep(IsRowMajor?j:m_data.index(i), IsRowMajor?m_data.index(i):j, m_data.value(i)))
+          {
+            m_data.value(k) = m_data.value(i);
+            m_data.index(k) = m_data.index(i);
+            ++k;
+          }
+        }
+      }
+      m_outerIndex[m_outerSize] = k;
+      m_data.resize(k,0);
+    }
+
+    /** Resizes the matrix to a \a rows x \a cols matrix and initializes it to zero.
+      * \sa resizeNonZeros(Index), reserve(), setZero()
+      */
+    void resize(Index rows, Index cols)
+    {
+      const Index outerSize = IsRowMajor ? rows : cols;
+      m_innerSize = IsRowMajor ? cols : rows;
+      m_data.clear();
+      if (m_outerSize != outerSize || m_outerSize==0)
+      {
+        delete[] m_outerIndex;
+        m_outerIndex = new Index [outerSize+1];
+        m_outerSize = outerSize;
+      }
+      if(m_innerNonZeros)
+      {
+        delete[] m_innerNonZeros;
+        m_innerNonZeros = 0;
+      }
+      memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(Index));
+    }
+
+    /** \internal
+      * Resize the nonzero vector to \a size */
+    void resizeNonZeros(Index size)
+    {
+      // TODO remove this function
+      m_data.resize(size);
+    }
+
+    /** \returns a const expression of the diagonal coefficients */
+    const Diagonal<const SparseMatrix> diagonal() const { return *this; }
+
+    /** Default constructor yielding an empty \c 0 \c x \c 0 matrix */
+    inline SparseMatrix()
+      : m_outerSize(-1), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0)
+    {
+      check_template_parameters();
+      resize(0, 0);
+    }
+
+    /** Constructs a \a rows \c x \a cols empty matrix */
+    inline SparseMatrix(Index rows, Index cols)
+      : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0)
+    {
+      check_template_parameters();
+      resize(rows, cols);
+    }
+
+    /** Constructs a sparse matrix from the sparse expression \a other */
+    template<typename OtherDerived>
+    inline SparseMatrix(const SparseMatrixBase<OtherDerived>& other)
+      : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0)
+    {
+      check_template_parameters();
+      *this = other.derived();
+    }
+
+    /** Copy constructor (it performs a deep copy) */
+    inline SparseMatrix(const SparseMatrix& other)
+      : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0)
+    {
+      check_template_parameters();
+      *this = other.derived();
+    }
+
+    /** Swaps the content of two sparse matrices of the same type.
+      * This is a fast operation that simply swaps the underlying pointers and parameters. */
+    inline void swap(SparseMatrix& other)
+    {
+      //EIGEN_DBG_SPARSE(std::cout << "SparseMatrix:: swap\n");
+      std::swap(m_outerIndex, other.m_outerIndex);
+      std::swap(m_innerSize, other.m_innerSize);
+      std::swap(m_outerSize, other.m_outerSize);
+      std::swap(m_innerNonZeros, other.m_innerNonZeros);
+      m_data.swap(other.m_data);
+    }
+
+    inline SparseMatrix& operator=(const SparseMatrix& other)
+    {
+      if (other.isRValue())
+      {
+        swap(other.const_cast_derived());
+      }
+      else
+      {
+        initAssignment(other);
+        if(other.isCompressed())
+        {
+          memcpy(m_outerIndex, other.m_outerIndex, (m_outerSize+1)*sizeof(Index));
+          m_data = other.m_data;
+        }
+        else
+        {
+          Base::operator=(other);
+        }
+      }
+      return *this;
+    }
+
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    template<typename Lhs, typename Rhs>
+    inline SparseMatrix& operator=(const SparseSparseProduct<Lhs,Rhs>& product)
+    { return Base::operator=(product); }
+    
+    template<typename OtherDerived>
+    inline SparseMatrix& operator=(const ReturnByValue<OtherDerived>& other)
+    { return Base::operator=(other.derived()); }
+    
+    template<typename OtherDerived>
+    inline SparseMatrix& operator=(const EigenBase<OtherDerived>& other)
+    { return Base::operator=(other.derived()); }
+    #endif
+
+    template<typename OtherDerived>
+    EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase<OtherDerived>& other)
+    {
+      initAssignment(other.derived());
+      const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
+      if (needToTranspose)
+      {
+        // two passes algorithm:
+        //  1 - compute the number of coeffs per dest inner vector
+        //  2 - do the actual copy/eval
+        // Since each coeff of the rhs has to be evaluated twice, let's evaluate it if needed
+        typedef typename internal::nested<OtherDerived,2>::type OtherCopy;
+        typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
+        OtherCopy otherCopy(other.derived());
+
+        Eigen::Map<Matrix<Index, Dynamic, 1> > (m_outerIndex,outerSize()).setZero();
+        // pass 1
+        // FIXME the above copy could be merged with that pass
+        for (Index j=0; j<otherCopy.outerSize(); ++j)
+          for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
+            ++m_outerIndex[it.index()];
+
+        // prefix sum
+        Index count = 0;
+        VectorXi positions(outerSize());
+        for (Index j=0; j<outerSize(); ++j)
+        {
+          Index tmp = m_outerIndex[j];
+          m_outerIndex[j] = count;
+          positions[j] = count;
+          count += tmp;
+        }
+        m_outerIndex[outerSize()] = count;
+        // alloc
+        m_data.resize(count);
+        // pass 2
+        for (Index j=0; j<otherCopy.outerSize(); ++j)
+        {
+          for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
+          {
+            Index pos = positions[it.index()]++;
+            m_data.index(pos) = j;
+            m_data.value(pos) = it.value();
+          }
+        }
+        return *this;
+      }
+      else
+      {
+        // there is no special optimization
+        return Base::operator=(other.derived());
+      }
+    }
+
+    friend std::ostream & operator << (std::ostream & s, const SparseMatrix& m)
+    {
+      EIGEN_DBG_SPARSE(
+        s << "Nonzero entries:\n";
+        if(m.isCompressed())
+          for (Index i=0; i<m.nonZeros(); ++i)
+            s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
+        else
+          for (Index i=0; i<m.outerSize(); ++i)
+          {
+            int p = m.m_outerIndex[i];
+            int pe = m.m_outerIndex[i]+m.m_innerNonZeros[i];
+            Index k=p;
+            for (; k<pe; ++k)
+              s << "(" << m.m_data.value(k) << "," << m.m_data.index(k) << ") ";
+            for (; k<m.m_outerIndex[i+1]; ++k)
+              s << "(_,_) ";
+          }
+        s << std::endl;
+        s << std::endl;
+        s << "Outer pointers:\n";
+        for (Index i=0; i<m.outerSize(); ++i)
+          s << m.m_outerIndex[i] << " ";
+        s << " $" << std::endl;
+        if(!m.isCompressed())
+        {
+          s << "Inner non zeros:\n";
+          for (Index i=0; i<m.outerSize(); ++i)
+            s << m.m_innerNonZeros[i] << " ";
+          s << " $" << std::endl;
+        }
+        s << std::endl;
+      );
+      s << static_cast<const SparseMatrixBase<SparseMatrix>&>(m);
+      return s;
+    }
+
+    /** Destructor */
+    inline ~SparseMatrix()
+    {
+      delete[] m_outerIndex;
+      delete[] m_innerNonZeros;
+    }
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** Overloaded for performance */
+    Scalar sum() const;
+#endif
+    
+#   ifdef EIGEN_SPARSEMATRIX_PLUGIN
+#     include EIGEN_SPARSEMATRIX_PLUGIN
+#   endif
+
+protected:
+
+    template<typename Other>
+    void initAssignment(const Other& other)
+    {
+      resize(other.rows(), other.cols());
+      if(m_innerNonZeros)
+      {
+        delete[] m_innerNonZeros;
+        m_innerNonZeros = 0;
+      }
+    }
+
+    /** \internal
+      * \sa insert(Index,Index) */
+    EIGEN_DONT_INLINE Scalar& insertCompressed(Index row, Index col)
+    {
+      eigen_assert(isCompressed());
+
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      Index previousOuter = outer;
+      if (m_outerIndex[outer+1]==0)
+      {
+        // we start a new inner vector
+        while (previousOuter>=0 && m_outerIndex[previousOuter]==0)
+        {
+          m_outerIndex[previousOuter] = static_cast<Index>(m_data.size());
+          --previousOuter;
+        }
+        m_outerIndex[outer+1] = m_outerIndex[outer];
+      }
+
+      // here we have to handle the tricky case where the outerIndex array
+      // starts with: [ 0 0 0 0 0 1 ...] and we are inserted in, e.g.,
+      // the 2nd inner vector...
+      bool isLastVec = (!(previousOuter==-1 && m_data.size()!=0))
+                    && (size_t(m_outerIndex[outer+1]) == m_data.size());
+
+      size_t startId = m_outerIndex[outer];
+      // FIXME let's make sure sizeof(long int) == sizeof(size_t)
+      size_t p = m_outerIndex[outer+1];
+      ++m_outerIndex[outer+1];
+
+      float reallocRatio = 1;
+      if (m_data.allocatedSize()<=m_data.size())
+      {
+        // if there is no preallocated memory, let's reserve a minimum of 32 elements
+        if (m_data.size()==0)
+        {
+          m_data.reserve(32);
+        }
+        else
+        {
+          // we need to reallocate the data, to reduce multiple reallocations
+          // we use a smart resize algorithm based on the current filling ratio
+          // in addition, we use float to avoid integers overflows
+          float nnzEstimate = float(m_outerIndex[outer])*float(m_outerSize)/float(outer+1);
+          reallocRatio = (nnzEstimate-float(m_data.size()))/float(m_data.size());
+          // furthermore we bound the realloc ratio to:
+          //   1) reduce multiple minor realloc when the matrix is almost filled
+          //   2) avoid to allocate too much memory when the matrix is almost empty
+          reallocRatio = (std::min)((std::max)(reallocRatio,1.5f),8.f);
+        }
+      }
+      m_data.resize(m_data.size()+1,reallocRatio);
+
+      if (!isLastVec)
+      {
+        if (previousOuter==-1)
+        {
+          // oops wrong guess.
+          // let's correct the outer offsets
+          for (Index k=0; k<=(outer+1); ++k)
+            m_outerIndex[k] = 0;
+          Index k=outer+1;
+          while(m_outerIndex[k]==0)
+            m_outerIndex[k++] = 1;
+          while (k<=m_outerSize && m_outerIndex[k]!=0)
+            m_outerIndex[k++]++;
+          p = 0;
+          --k;
+          k = m_outerIndex[k]-1;
+          while (k>0)
+          {
+            m_data.index(k) = m_data.index(k-1);
+            m_data.value(k) = m_data.value(k-1);
+            k--;
+          }
+        }
+        else
+        {
+          // we are not inserting into the last inner vec
+          // update outer indices:
+          Index j = outer+2;
+          while (j<=m_outerSize && m_outerIndex[j]!=0)
+            m_outerIndex[j++]++;
+          --j;
+          // shift data of last vecs:
+          Index k = m_outerIndex[j]-1;
+          while (k>=Index(p))
+          {
+            m_data.index(k) = m_data.index(k-1);
+            m_data.value(k) = m_data.value(k-1);
+            k--;
+          }
+        }
+      }
+
+      while ( (p > startId) && (m_data.index(p-1) > inner) )
+      {
+        m_data.index(p) = m_data.index(p-1);
+        m_data.value(p) = m_data.value(p-1);
+        --p;
+      }
+
+      m_data.index(p) = inner;
+      return (m_data.value(p) = 0);
+    }
+
+    /** \internal
+      * A vector object that is equal to 0 everywhere but v at the position i */
+    class SingletonVector
+    {
+        Index m_index;
+        Index m_value;
+      public:
+        typedef Index value_type;
+        SingletonVector(Index i, Index v)
+          : m_index(i), m_value(v)
+        {}
+
+        Index operator[](Index i) const { return i==m_index ? m_value : 0; }
+    };
+
+    /** \internal
+      * \sa insert(Index,Index) */
+    EIGEN_DONT_INLINE Scalar& insertUncompressed(Index row, Index col)
+    {
+      eigen_assert(!isCompressed());
+
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      std::ptrdiff_t room = m_outerIndex[outer+1] - m_outerIndex[outer];
+      std::ptrdiff_t innerNNZ = m_innerNonZeros[outer];
+      if(innerNNZ>=room)
+      {
+        // this inner vector is full, we need to reallocate the whole buffer :(
+        reserve(SingletonVector(outer,std::max<std::ptrdiff_t>(2,innerNNZ)));
+      }
+
+      Index startId = m_outerIndex[outer];
+      Index p = startId + m_innerNonZeros[outer];
+      while ( (p > startId) && (m_data.index(p-1) > inner) )
+      {
+        m_data.index(p) = m_data.index(p-1);
+        m_data.value(p) = m_data.value(p-1);
+        --p;
+      }
+
+      m_innerNonZeros[outer]++;
+
+      m_data.index(p) = inner;
+      return (m_data.value(p) = 0);
+    }
+
+public:
+    /** \internal
+      * \sa insert(Index,Index) */
+    inline Scalar& insertBackUncompressed(Index row, Index col)
+    {
+      const Index outer = IsRowMajor ? row : col;
+      const Index inner = IsRowMajor ? col : row;
+
+      eigen_assert(!isCompressed());
+      eigen_assert(m_innerNonZeros[outer]<=(m_outerIndex[outer+1] - m_outerIndex[outer]));
+
+      Index p = m_outerIndex[outer] + m_innerNonZeros[outer];
+      m_innerNonZeros[outer]++;
+      m_data.index(p) = inner;
+      return (m_data.value(p) = 0);
+    }
+
+private:
+  static void check_template_parameters()
+  {
+    EIGEN_STATIC_ASSERT(NumTraits<Index>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE);
+  }
+
+  struct default_prunning_func {
+    default_prunning_func(Scalar ref, RealScalar eps) : reference(ref), epsilon(eps) {}
+    inline bool operator() (const Index&, const Index&, const Scalar& value) const
+    {
+      return !internal::isMuchSmallerThan(value, reference, epsilon);
+    }
+    Scalar reference;
+    RealScalar epsilon;
+  };
+};
+
+template<typename Scalar, int _Options, typename _Index>
+class SparseMatrix<Scalar,_Options,_Index>::InnerIterator
+{
+  public:
+    InnerIterator(const SparseMatrix& mat, Index outer)
+      : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer), m_id(mat.m_outerIndex[outer])
+    {
+      if(mat.isCompressed())
+        m_end = mat.m_outerIndex[outer+1];
+      else
+        m_end = m_id + mat.m_innerNonZeros[outer];
+    }
+
+    inline InnerIterator& operator++() { m_id++; return *this; }
+
+    inline const Scalar& value() const { return m_values[m_id]; }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_values[m_id]); }
+
+    inline Index index() const { return m_indices[m_id]; }
+    inline Index outer() const { return m_outer; }
+    inline Index row() const { return IsRowMajor ? m_outer : index(); }
+    inline Index col() const { return IsRowMajor ? index() : m_outer; }
+
+    inline operator bool() const { return (m_id < m_end); }
+
+  protected:
+    const Scalar* m_values;
+    const Index* m_indices;
+    const Index m_outer;
+    Index m_id;
+    Index m_end;
+};
+
+template<typename Scalar, int _Options, typename _Index>
+class SparseMatrix<Scalar,_Options,_Index>::ReverseInnerIterator
+{
+  public:
+    ReverseInnerIterator(const SparseMatrix& mat, Index outer)
+      : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer), m_start(mat.m_outerIndex[outer])
+    {
+      if(mat.isCompressed())
+        m_id = mat.m_outerIndex[outer+1];
+      else
+        m_id = m_start + mat.m_innerNonZeros[outer];
+    }
+
+    inline ReverseInnerIterator& operator--() { --m_id; return *this; }
+
+    inline const Scalar& value() const { return m_values[m_id-1]; }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_values[m_id-1]); }
+
+    inline Index index() const { return m_indices[m_id-1]; }
+    inline Index outer() const { return m_outer; }
+    inline Index row() const { return IsRowMajor ? m_outer : index(); }
+    inline Index col() const { return IsRowMajor ? index() : m_outer; }
+
+    inline operator bool() const { return (m_id > m_start); }
+
+  protected:
+    const Scalar* m_values;
+    const Index* m_indices;
+    const Index m_outer;
+    Index m_id;
+    const Index m_start;
+};
+
+namespace internal {
+
+template<typename InputIterator, typename SparseMatrixType>
+void set_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, int Options = 0)
+{
+  EIGEN_UNUSED_VARIABLE(Options);
+  enum { IsRowMajor = SparseMatrixType::IsRowMajor };
+  typedef typename SparseMatrixType::Scalar Scalar;
+  typedef typename SparseMatrixType::Index Index;
+  SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols());
+
+  // pass 1: count the nnz per inner-vector
+  VectorXi wi(trMat.outerSize());
+  wi.setZero();
+  for(InputIterator it(begin); it!=end; ++it)
+    wi(IsRowMajor ? it->col() : it->row())++;
+
+  // pass 2: insert all the elements into trMat
+  trMat.reserve(wi);
+  for(InputIterator it(begin); it!=end; ++it)
+    trMat.insertBackUncompressed(it->row(),it->col()) = it->value();
+
+  // pass 3:
+  trMat.sumupDuplicates();
+
+  // pass 4: transposed copy -> implicit sorting
+  mat = trMat;
+}
+
+}
+
+
+/** Fill the matrix \c *this with the list of \em triplets defined by the iterator range \a begin - \b.
+  *
+  * A \em triplet is a tuple (i,j,value) defining a non-zero element.
+  * The input list of triplets does not have to be sorted, and can contains duplicated elements.
+  * In any case, the result is a \b sorted and \b compressed sparse matrix where the duplicates have been summed up.
+  * This is a \em O(n) operation, with \em n the number of triplet elements.
+  * The initial contents of \c *this is destroyed.
+  * The matrix \c *this must be properly resized beforehand using the SparseMatrix(Index,Index) constructor,
+  * or the resize(Index,Index) method. The sizes are not extracted from the triplet list.
+  *
+  * The \a InputIterators value_type must provide the following interface:
+  * \code
+  * Scalar value() const; // the value
+  * Scalar row() const;   // the row index i
+  * Scalar col() const;   // the column index j
+  * \endcode
+  * See for instance the Eigen::Triplet template class.
+  *
+  * Here is a typical usage example:
+  * \code
+    typedef Triplet<double> T;
+    std::vector<T> tripletList;
+    triplets.reserve(estimation_of_entries);
+    for(...)
+    {
+      // ...
+      tripletList.push_back(T(i,j,v_ij));
+    }
+    SparseMatrixType m(rows,cols);
+    m.setFromTriplets(tripletList.begin(), tripletList.end());
+    // m is ready to go!
+  * \endcode
+  *
+  * \warning The list of triplets is read multiple times (at least twice). Therefore, it is not recommended to define
+  * an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather
+  * be explicitely stored into a std::vector for instance.
+  */
+template<typename Scalar, int _Options, typename _Index>
+template<typename InputIterators>
+void SparseMatrix<Scalar,_Options,_Index>::setFromTriplets(const InputIterators& begin, const InputIterators& end)
+{
+  internal::set_from_triplets(begin, end, *this);
+}
+
+/** \internal */
+template<typename Scalar, int _Options, typename _Index>
+void SparseMatrix<Scalar,_Options,_Index>::sumupDuplicates()
+{
+  eigen_assert(!isCompressed());
+  // TODO, in practice we should be able to use m_innerNonZeros for that task
+  VectorXi wi(innerSize());
+  wi.fill(-1);
+  Index count = 0;
+  // for each inner-vector, wi[inner_index] will hold the position of first element into the index/value buffers
+  for(int j=0; j<outerSize(); ++j)
+  {
+    Index start   = count;
+    Index oldEnd  = m_outerIndex[j]+m_innerNonZeros[j];
+    for(Index k=m_outerIndex[j]; k<oldEnd; ++k)
+    {
+      Index i = m_data.index(k);
+      if(wi(i)>=start)
+      {
+        // we already meet this entry => accumulate it
+        m_data.value(wi(i)) += m_data.value(k);
+      }
+      else
+      {
+        m_data.value(count) = m_data.value(k);
+        m_data.index(count) = m_data.index(k);
+        wi(i) = count;
+        ++count;
+      }
+    }
+    m_outerIndex[j] = start;
+  }
+  m_outerIndex[m_outerSize] = count;
+
+  // turn the matrix into compressed form
+  delete[] m_innerNonZeros;
+  m_innerNonZeros = 0;
+  m_data.resize(m_outerIndex[m_outerSize]);
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEMATRIX_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h
new file mode 100644
index 0000000..9a12580
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h
@@ -0,0 +1,458 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEMATRIXBASE_H
+#define EIGEN_SPARSEMATRIXBASE_H
+
+namespace Eigen { 
+
+/** \ingroup SparseCore_Module
+  *
+  * \class SparseMatrixBase
+  *
+  * \brief Base class of any sparse matrices or sparse expressions
+  *
+  * \tparam Derived
+  *
+  * This class can be extended with the help of the plugin mechanism described on the page
+  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIXBASE_PLUGIN.
+  */
+template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
+{
+  public:
+
+    typedef typename internal::traits<Derived>::Scalar Scalar;
+    typedef typename internal::packet_traits<Scalar>::type PacketScalar;
+    typedef typename internal::traits<Derived>::StorageKind StorageKind;
+    typedef typename internal::traits<Derived>::Index Index;
+    typedef typename internal::add_const_on_value_type_if_arithmetic<
+                         typename internal::packet_traits<Scalar>::type
+                     >::type PacketReturnType;
+
+    typedef SparseMatrixBase StorageBaseType;
+    typedef EigenBase<Derived> Base;
+    
+    template<typename OtherDerived>
+    Derived& operator=(const EigenBase<OtherDerived> &other)
+    {
+      other.derived().evalTo(derived());
+      return derived();
+    }
+
+    enum {
+
+      RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
+        /**< The number of rows at compile-time. This is just a copy of the value provided
+          * by the \a Derived type. If a value is not known at compile-time,
+          * it is set to the \a Dynamic constant.
+          * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
+
+      ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
+        /**< The number of columns at compile-time. This is just a copy of the value provided
+          * by the \a Derived type. If a value is not known at compile-time,
+          * it is set to the \a Dynamic constant.
+          * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
+
+
+      SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
+                                                   internal::traits<Derived>::ColsAtCompileTime>::ret),
+        /**< This is equal to the number of coefficients, i.e. the number of
+          * rows times the number of columns, or to \a Dynamic if this is not
+          * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
+
+      MaxRowsAtCompileTime = RowsAtCompileTime,
+      MaxColsAtCompileTime = ColsAtCompileTime,
+
+      MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
+                                                      MaxColsAtCompileTime>::ret),
+
+      IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
+        /**< This is set to true if either the number of rows or the number of
+          * columns is known at compile-time to be equal to 1. Indeed, in that case,
+          * we are dealing with a column-vector (if there is only one column) or with
+          * a row-vector (if there is only one row). */
+
+      Flags = internal::traits<Derived>::Flags,
+        /**< This stores expression \ref flags flags which may or may not be inherited by new expressions
+          * constructed from this one. See the \ref flags "list of flags".
+          */
+
+      CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
+        /**< This is a rough measure of how expensive it is to read one coefficient from
+          * this expression.
+          */
+
+      IsRowMajor = Flags&RowMajorBit ? 1 : 0,
+
+      #ifndef EIGEN_PARSED_BY_DOXYGEN
+      _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC
+      #endif
+    };
+
+    /** \internal the return type of MatrixBase::adjoint() */
+    typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+                        CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Eigen::Transpose<const Derived> >,
+                        Transpose<const Derived>
+                     >::type AdjointReturnType;
+
+
+    typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor> PlainObject;
+
+
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** This is the "real scalar" type; if the \a Scalar type is already real numbers
+      * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If
+      * \a Scalar is \a std::complex<T> then RealScalar is \a T.
+      *
+      * \sa class NumTraits
+      */
+    typedef typename NumTraits<Scalar>::Real RealScalar;
+
+    /** \internal the return type of coeff()
+      */
+    typedef typename internal::conditional<_HasDirectAccess, const Scalar&, Scalar>::type CoeffReturnType;
+
+    /** \internal Represents a matrix with all coefficients equal to one another*/
+    typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
+
+    /** type of the equivalent square matrix */
+    typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime),
+                          EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
+
+    inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
+    inline Derived& derived() { return *static_cast<Derived*>(this); }
+    inline Derived& const_cast_derived() const
+    { return *static_cast<Derived*>(const_cast<SparseMatrixBase*>(this)); }
+#endif // not EIGEN_PARSED_BY_DOXYGEN
+
+#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
+#   include "../plugins/CommonCwiseUnaryOps.h"
+#   include "../plugins/CommonCwiseBinaryOps.h"
+#   include "../plugins/MatrixCwiseUnaryOps.h"
+#   include "../plugins/MatrixCwiseBinaryOps.h"
+#   ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN
+#     include EIGEN_SPARSEMATRIXBASE_PLUGIN
+#   endif
+#   undef EIGEN_CURRENT_STORAGE_BASE_CLASS
+#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
+
+
+    /** \returns the number of rows. \sa cols() */
+    inline Index rows() const { return derived().rows(); }
+    /** \returns the number of columns. \sa rows() */
+    inline Index cols() const { return derived().cols(); }
+    /** \returns the number of coefficients, which is \a rows()*cols().
+      * \sa rows(), cols(). */
+    inline Index size() const { return rows() * cols(); }
+    /** \returns the number of nonzero coefficients which is in practice the number
+      * of stored coefficients. */
+    inline Index nonZeros() const { return derived().nonZeros(); }
+    /** \returns true if either the number of rows or the number of columns is equal to 1.
+      * In other words, this function returns
+      * \code rows()==1 || cols()==1 \endcode
+      * \sa rows(), cols(), IsVectorAtCompileTime. */
+    inline bool isVector() const { return rows()==1 || cols()==1; }
+    /** \returns the size of the storage major dimension,
+      * i.e., the number of columns for a columns major matrix, and the number of rows otherwise */
+    Index outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); }
+    /** \returns the size of the inner dimension according to the storage order,
+      * i.e., the number of rows for a columns major matrix, and the number of cols otherwise */
+    Index innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); }
+
+    bool isRValue() const { return m_isRValue; }
+    Derived& markAsRValue() { m_isRValue = true; return derived(); }
+
+    SparseMatrixBase() : m_isRValue(false) { /* TODO check flags */ }
+
+    
+    template<typename OtherDerived>
+    Derived& operator=(const ReturnByValue<OtherDerived>& other)
+    {
+      other.evalTo(derived());
+      return derived();
+    }
+
+
+    template<typename OtherDerived>
+    inline Derived& operator=(const SparseMatrixBase<OtherDerived>& other)
+    {
+      return assign(other.derived());
+    }
+
+    inline Derived& operator=(const Derived& other)
+    {
+//       if (other.isRValue())
+//         derived().swap(other.const_cast_derived());
+//       else
+      return assign(other.derived());
+    }
+
+  protected:
+
+    template<typename OtherDerived>
+    inline Derived& assign(const OtherDerived& other)
+    {
+      const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
+      const Index outerSize = (int(OtherDerived::Flags) & RowMajorBit) ? other.rows() : other.cols();
+      if ((!transpose) && other.isRValue())
+      {
+        // eval without temporary
+        derived().resize(other.rows(), other.cols());
+        derived().setZero();
+        derived().reserve((std::max)(this->rows(),this->cols())*2);
+        for (Index j=0; j<outerSize; ++j)
+        {
+          derived().startVec(j);
+          for (typename OtherDerived::InnerIterator it(other, j); it; ++it)
+          {
+            Scalar v = it.value();
+            derived().insertBackByOuterInner(j,it.index()) = v;
+          }
+        }
+        derived().finalize();
+      }
+      else
+      {
+        assignGeneric(other);
+      }
+      return derived();
+    }
+
+    template<typename OtherDerived>
+    inline void assignGeneric(const OtherDerived& other)
+    {
+      //const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
+      eigen_assert(( ((internal::traits<Derived>::SupportedAccessPatterns&OuterRandomAccessPattern)==OuterRandomAccessPattern) ||
+                  (!((Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit)))) &&
+                  "the transpose operation is supposed to be handled in SparseMatrix::operator=");
+
+      enum { Flip = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit) };
+
+      const Index outerSize = other.outerSize();
+      //typedef typename internal::conditional<transpose, LinkedVectorMatrix<Scalar,Flags&RowMajorBit>, Derived>::type TempType;
+      // thanks to shallow copies, we always eval to a tempary
+      Derived temp(other.rows(), other.cols());
+
+      temp.reserve((std::max)(this->rows(),this->cols())*2);
+      for (Index j=0; j<outerSize; ++j)
+      {
+        temp.startVec(j);
+        for (typename OtherDerived::InnerIterator it(other.derived(), j); it; ++it)
+        {
+          Scalar v = it.value();
+          temp.insertBackByOuterInner(Flip?it.index():j,Flip?j:it.index()) = v;
+        }
+      }
+      temp.finalize();
+
+      derived() = temp.markAsRValue();
+    }
+
+  public:
+
+    template<typename Lhs, typename Rhs>
+    inline Derived& operator=(const SparseSparseProduct<Lhs,Rhs>& product);
+
+    friend std::ostream & operator << (std::ostream & s, const SparseMatrixBase& m)
+    {
+      typedef typename Derived::Nested Nested;
+      typedef typename internal::remove_all<Nested>::type NestedCleaned;
+
+      if (Flags&RowMajorBit)
+      {
+        const Nested nm(m.derived());
+        for (Index row=0; row<nm.outerSize(); ++row)
+        {
+          Index col = 0;
+          for (typename NestedCleaned::InnerIterator it(nm.derived(), row); it; ++it)
+          {
+            for ( ; col<it.index(); ++col)
+              s << "0 ";
+            s << it.value() << " ";
+            ++col;
+          }
+          for ( ; col<m.cols(); ++col)
+            s << "0 ";
+          s << std::endl;
+        }
+      }
+      else
+      {
+        const Nested nm(m.derived());
+        if (m.cols() == 1) {
+          Index row = 0;
+          for (typename NestedCleaned::InnerIterator it(nm.derived(), 0); it; ++it)
+          {
+            for ( ; row<it.index(); ++row)
+              s << "0" << std::endl;
+            s << it.value() << std::endl;
+            ++row;
+          }
+          for ( ; row<m.rows(); ++row)
+            s << "0" << std::endl;
+        }
+        else
+        {
+          SparseMatrix<Scalar, RowMajorBit> trans = m;
+          s << static_cast<const SparseMatrixBase<SparseMatrix<Scalar, RowMajorBit> >&>(trans);
+        }
+      }
+      return s;
+    }
+
+    template<typename OtherDerived>
+    Derived& operator+=(const SparseMatrixBase<OtherDerived>& other);
+    template<typename OtherDerived>
+    Derived& operator-=(const SparseMatrixBase<OtherDerived>& other);
+
+    Derived& operator*=(const Scalar& other);
+    Derived& operator/=(const Scalar& other);
+
+    #define EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE \
+      CwiseBinaryOp< \
+        internal::scalar_product_op< \
+          typename internal::scalar_product_traits< \
+            typename internal::traits<Derived>::Scalar, \
+            typename internal::traits<OtherDerived>::Scalar \
+          >::ReturnType \
+        >, \
+        Derived, \
+        OtherDerived \
+      >
+
+    template<typename OtherDerived>
+    EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
+    cwiseProduct(const MatrixBase<OtherDerived> &other) const;
+
+    // sparse * sparse
+    template<typename OtherDerived>
+    const typename SparseSparseProductReturnType<Derived,OtherDerived>::Type
+    operator*(const SparseMatrixBase<OtherDerived> &other) const;
+
+    // sparse * diagonal
+    template<typename OtherDerived>
+    const SparseDiagonalProduct<Derived,OtherDerived>
+    operator*(const DiagonalBase<OtherDerived> &other) const;
+
+    // diagonal * sparse
+    template<typename OtherDerived> friend
+    const SparseDiagonalProduct<OtherDerived,Derived>
+    operator*(const DiagonalBase<OtherDerived> &lhs, const SparseMatrixBase& rhs)
+    { return SparseDiagonalProduct<OtherDerived,Derived>(lhs.derived(), rhs.derived()); }
+
+    /** dense * sparse (return a dense object unless it is an outer product) */
+    template<typename OtherDerived> friend
+    const typename DenseSparseProductReturnType<OtherDerived,Derived>::Type
+    operator*(const MatrixBase<OtherDerived>& lhs, const Derived& rhs)
+    { return typename DenseSparseProductReturnType<OtherDerived,Derived>::Type(lhs.derived(),rhs); }
+
+    /** sparse * dense (returns a dense object unless it is an outer product) */
+    template<typename OtherDerived>
+    const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
+    operator*(const MatrixBase<OtherDerived> &other) const;
+    
+     /** \returns an expression of P H P^-1 where H is the matrix represented by \c *this */
+    SparseSymmetricPermutationProduct<Derived,Upper|Lower> twistedBy(const PermutationMatrix<Dynamic,Dynamic,Index>& perm) const
+    {
+      return SparseSymmetricPermutationProduct<Derived,Upper|Lower>(derived(), perm);
+    }
+
+    template<typename OtherDerived>
+    Derived& operator*=(const SparseMatrixBase<OtherDerived>& other);
+
+    #ifdef EIGEN2_SUPPORT
+    // deprecated
+    template<typename OtherDerived>
+    typename internal::plain_matrix_type_column_major<OtherDerived>::type
+    solveTriangular(const MatrixBase<OtherDerived>& other) const;
+
+    // deprecated
+    template<typename OtherDerived>
+    void solveTriangularInPlace(MatrixBase<OtherDerived>& other) const;
+    #endif // EIGEN2_SUPPORT
+
+    template<int Mode>
+    inline const SparseTriangularView<Derived, Mode> triangularView() const;
+
+    template<unsigned int UpLo> inline const SparseSelfAdjointView<Derived, UpLo> selfadjointView() const;
+    template<unsigned int UpLo> inline SparseSelfAdjointView<Derived, UpLo> selfadjointView();
+
+    template<typename OtherDerived> Scalar dot(const MatrixBase<OtherDerived>& other) const;
+    template<typename OtherDerived> Scalar dot(const SparseMatrixBase<OtherDerived>& other) const;
+    RealScalar squaredNorm() const;
+    RealScalar norm()  const;
+
+    Transpose<Derived> transpose() { return derived(); }
+    const Transpose<const Derived> transpose() const { return derived(); }
+    const AdjointReturnType adjoint() const { return transpose(); }
+
+    // sub-vector
+    SparseInnerVectorSet<Derived,1> row(Index i);
+    const SparseInnerVectorSet<Derived,1> row(Index i) const;
+    SparseInnerVectorSet<Derived,1> col(Index j);
+    const SparseInnerVectorSet<Derived,1> col(Index j) const;
+    SparseInnerVectorSet<Derived,1> innerVector(Index outer);
+    const SparseInnerVectorSet<Derived,1> innerVector(Index outer) const;
+
+    // set of sub-vectors
+    SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size);
+    const SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size) const;
+    SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size);
+    const SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size) const;
+    
+    SparseInnerVectorSet<Derived,Dynamic> middleRows(Index start, Index size);
+    const SparseInnerVectorSet<Derived,Dynamic> middleRows(Index start, Index size) const;
+    SparseInnerVectorSet<Derived,Dynamic> middleCols(Index start, Index size);
+    const SparseInnerVectorSet<Derived,Dynamic> middleCols(Index start, Index size) const;
+    SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize);
+    const SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize) const;
+
+      /** \internal use operator= */
+      template<typename DenseDerived>
+      void evalTo(MatrixBase<DenseDerived>& dst) const
+      {
+        dst.setZero();
+        for (Index j=0; j<outerSize(); ++j)
+          for (typename Derived::InnerIterator i(derived(),j); i; ++i)
+            dst.coeffRef(i.row(),i.col()) = i.value();
+      }
+
+      Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> toDense() const
+      {
+        return derived();
+      }
+
+    template<typename OtherDerived>
+    bool isApprox(const SparseMatrixBase<OtherDerived>& other,
+                  RealScalar prec = NumTraits<Scalar>::dummy_precision()) const
+    { return toDense().isApprox(other.toDense(),prec); }
+
+    template<typename OtherDerived>
+    bool isApprox(const MatrixBase<OtherDerived>& other,
+                  RealScalar prec = NumTraits<Scalar>::dummy_precision()) const
+    { return toDense().isApprox(other,prec); }
+
+    /** \returns the matrix or vector obtained by evaluating this expression.
+      *
+      * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
+      * a const reference, in order to avoid a useless copy.
+      */
+    inline const typename internal::eval<Derived>::type eval() const
+    { return typename internal::eval<Derived>::type(derived()); }
+
+    Scalar sum() const;
+
+  protected:
+
+    bool m_isRValue;
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEMATRIXBASE_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparsePermutation.h b/extern/Eigen3/Eigen/src/SparseCore/SparsePermutation.h
new file mode 100644
index 0000000..b897b75
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparsePermutation.h
@@ -0,0 +1,148 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2012 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_PERMUTATION_H
+#define EIGEN_SPARSE_PERMUTATION_H
+
+// This file implements sparse * permutation products
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename PermutationType, typename MatrixType, int Side, bool Transposed>
+struct traits<permut_sparsematrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
+{
+  typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
+  typedef typename MatrixTypeNestedCleaned::Scalar Scalar;
+  typedef typename MatrixTypeNestedCleaned::Index Index;
+  enum {
+    SrcStorageOrder = MatrixTypeNestedCleaned::Flags&RowMajorBit ? RowMajor : ColMajor,
+    MoveOuter = SrcStorageOrder==RowMajor ? Side==OnTheLeft : Side==OnTheRight
+  };
+
+  typedef typename internal::conditional<MoveOuter,
+        SparseMatrix<Scalar,SrcStorageOrder,Index>,
+        SparseMatrix<Scalar,int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor,Index> >::type ReturnType;
+};
+
+template<typename PermutationType, typename MatrixType, int Side, bool Transposed>
+struct permut_sparsematrix_product_retval
+ : public ReturnByValue<permut_sparsematrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
+{
+    typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
+    typedef typename MatrixTypeNestedCleaned::Scalar Scalar;
+    typedef typename MatrixTypeNestedCleaned::Index Index;
+
+    enum {
+      SrcStorageOrder = MatrixTypeNestedCleaned::Flags&RowMajorBit ? RowMajor : ColMajor,
+      MoveOuter = SrcStorageOrder==RowMajor ? Side==OnTheLeft : Side==OnTheRight
+    };
+
+    permut_sparsematrix_product_retval(const PermutationType& perm, const MatrixType& matrix)
+      : m_permutation(perm), m_matrix(matrix)
+    {}
+
+    inline int rows() const { return m_matrix.rows(); }
+    inline int cols() const { return m_matrix.cols(); }
+
+    template<typename Dest> inline void evalTo(Dest& dst) const
+    {
+      if(MoveOuter)
+      {
+        SparseMatrix<Scalar,SrcStorageOrder,Index> tmp(m_matrix.rows(), m_matrix.cols());
+        VectorXi sizes(m_matrix.outerSize());
+        for(Index j=0; j<m_matrix.outerSize(); ++j)
+        {
+          Index jp = m_permutation.indices().coeff(j);
+          sizes[((Side==OnTheLeft) ^ Transposed) ? jp : j] = m_matrix.innerVector(((Side==OnTheRight) ^ Transposed) ? jp : j).size();
+        }
+        tmp.reserve(sizes);
+        for(Index j=0; j<m_matrix.outerSize(); ++j)
+        {
+          Index jp = m_permutation.indices().coeff(j);
+          Index jsrc = ((Side==OnTheRight) ^ Transposed) ? jp : j;
+          Index jdst = ((Side==OnTheLeft) ^ Transposed) ? jp : j;
+          for(typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,jsrc); it; ++it)
+            tmp.insertByOuterInner(jdst,it.index()) = it.value();
+        }
+        dst = tmp;
+      }
+      else
+      {
+        SparseMatrix<Scalar,int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor,Index> tmp(m_matrix.rows(), m_matrix.cols());
+        VectorXi sizes(tmp.outerSize());
+        sizes.setZero();
+        PermutationMatrix<Dynamic,Dynamic,Index> perm;
+        if((Side==OnTheLeft) ^ Transposed)
+          perm = m_permutation;
+        else
+          perm = m_permutation.transpose();
+
+        for(Index j=0; j<m_matrix.outerSize(); ++j)
+          for(typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,j); it; ++it)
+            sizes[perm.indices().coeff(it.index())]++;
+        tmp.reserve(sizes);
+        for(Index j=0; j<m_matrix.outerSize(); ++j)
+          for(typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,j); it; ++it)
+            tmp.insertByOuterInner(perm.indices().coeff(it.index()),j) = it.value();
+        dst = tmp;
+      }
+    }
+
+  protected:
+    const PermutationType& m_permutation;
+    typename MatrixType::Nested m_matrix;
+};
+
+}
+
+
+
+/** \returns the matrix with the permutation applied to the columns
+  */
+template<typename SparseDerived, typename PermDerived>
+inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheRight, false>
+operator*(const SparseMatrixBase<SparseDerived>& matrix, const PermutationBase<PermDerived>& perm)
+{
+  return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheRight, false>(perm, matrix.derived());
+}
+
+/** \returns the matrix with the permutation applied to the rows
+  */
+template<typename SparseDerived, typename PermDerived>
+inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheLeft, false>
+operator*( const PermutationBase<PermDerived>& perm, const SparseMatrixBase<SparseDerived>& matrix)
+{
+  return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheLeft, false>(perm, matrix.derived());
+}
+
+
+
+/** \returns the matrix with the inverse permutation applied to the columns.
+  */
+template<typename SparseDerived, typename PermDerived>
+inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheRight, true>
+operator*(const SparseMatrixBase<SparseDerived>& matrix, const Transpose<PermutationBase<PermDerived> >& tperm)
+{
+  return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheRight, true>(tperm.nestedPermutation(), matrix.derived());
+}
+
+/** \returns the matrix with the inverse permutation applied to the rows.
+  */
+template<typename SparseDerived, typename PermDerived>
+inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheLeft, true>
+operator*(const Transpose<PermutationBase<PermDerived> >& tperm, const SparseMatrixBase<SparseDerived>& matrix)
+{
+  return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived, OnTheLeft, true>(tperm.nestedPermutation(), matrix.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_SELFADJOINTVIEW_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseProduct.h b/extern/Eigen3/Eigen/src/SparseCore/SparseProduct.h
new file mode 100644
index 0000000..6a555b8
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseProduct.h
@@ -0,0 +1,186 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEPRODUCT_H
+#define EIGEN_SPARSEPRODUCT_H
+
+namespace Eigen { 
+
+template<typename Lhs, typename Rhs>
+struct SparseSparseProductReturnType
+{
+  typedef typename internal::traits<Lhs>::Scalar Scalar;
+  enum {
+    LhsRowMajor = internal::traits<Lhs>::Flags & RowMajorBit,
+    RhsRowMajor = internal::traits<Rhs>::Flags & RowMajorBit,
+    TransposeRhs = (!LhsRowMajor) && RhsRowMajor,
+    TransposeLhs = LhsRowMajor && (!RhsRowMajor)
+  };
+
+  typedef typename internal::conditional<TransposeLhs,
+    SparseMatrix<Scalar,0>,
+    typename internal::nested<Lhs,Rhs::RowsAtCompileTime>::type>::type LhsNested;
+
+  typedef typename internal::conditional<TransposeRhs,
+    SparseMatrix<Scalar,0>,
+    typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type>::type RhsNested;
+
+  typedef SparseSparseProduct<LhsNested, RhsNested> Type;
+};
+
+namespace internal {
+template<typename LhsNested, typename RhsNested>
+struct traits<SparseSparseProduct<LhsNested, RhsNested> >
+{
+  typedef MatrixXpr XprKind;
+  // clean the nested types:
+  typedef typename remove_all<LhsNested>::type _LhsNested;
+  typedef typename remove_all<RhsNested>::type _RhsNested;
+  typedef typename _LhsNested::Scalar Scalar;
+  typedef typename promote_index_type<typename traits<_LhsNested>::Index,
+                                         typename traits<_RhsNested>::Index>::type Index;
+
+  enum {
+    LhsCoeffReadCost = _LhsNested::CoeffReadCost,
+    RhsCoeffReadCost = _RhsNested::CoeffReadCost,
+    LhsFlags = _LhsNested::Flags,
+    RhsFlags = _RhsNested::Flags,
+
+    RowsAtCompileTime    = _LhsNested::RowsAtCompileTime,
+    ColsAtCompileTime    = _RhsNested::ColsAtCompileTime,
+    MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
+    MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
+
+    InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
+
+    EvalToRowMajor = (RhsFlags & LhsFlags & RowMajorBit),
+
+    RemovedBits = ~(EvalToRowMajor ? 0 : RowMajorBit),
+
+    Flags = (int(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
+          | EvalBeforeAssigningBit
+          | EvalBeforeNestingBit,
+
+    CoeffReadCost = Dynamic
+  };
+
+  typedef Sparse StorageKind;
+};
+
+} // end namespace internal
+
+template<typename LhsNested, typename RhsNested>
+class SparseSparseProduct : internal::no_assignment_operator,
+  public SparseMatrixBase<SparseSparseProduct<LhsNested, RhsNested> >
+{
+  public:
+
+    typedef SparseMatrixBase<SparseSparseProduct> Base;
+    EIGEN_DENSE_PUBLIC_INTERFACE(SparseSparseProduct)
+
+  private:
+
+    typedef typename internal::traits<SparseSparseProduct>::_LhsNested _LhsNested;
+    typedef typename internal::traits<SparseSparseProduct>::_RhsNested _RhsNested;
+
+  public:
+
+    template<typename Lhs, typename Rhs>
+    EIGEN_STRONG_INLINE SparseSparseProduct(const Lhs& lhs, const Rhs& rhs)
+      : m_lhs(lhs), m_rhs(rhs), m_tolerance(0), m_conservative(true)
+    {
+      init();
+    }
+
+    template<typename Lhs, typename Rhs>
+    EIGEN_STRONG_INLINE SparseSparseProduct(const Lhs& lhs, const Rhs& rhs, RealScalar tolerance)
+      : m_lhs(lhs), m_rhs(rhs), m_tolerance(tolerance), m_conservative(false)
+    {
+      init();
+    }
+
+    SparseSparseProduct pruned(Scalar reference = 0, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision()) const
+    {
+      return SparseSparseProduct(m_lhs,m_rhs,internal::abs(reference)*epsilon);
+    }
+
+    template<typename Dest>
+    void evalTo(Dest& result) const
+    {
+      if(m_conservative)
+        internal::conservative_sparse_sparse_product_selector<_LhsNested, _RhsNested, Dest>::run(lhs(),rhs(),result);
+      else
+        internal::sparse_sparse_product_with_pruning_selector<_LhsNested, _RhsNested, Dest>::run(lhs(),rhs(),result,m_tolerance);
+    }
+
+    EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
+    EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); }
+
+    EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
+    EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
+
+  protected:
+    void init()
+    {
+      eigen_assert(m_lhs.cols() == m_rhs.rows());
+
+      enum {
+        ProductIsValid = _LhsNested::ColsAtCompileTime==Dynamic
+                      || _RhsNested::RowsAtCompileTime==Dynamic
+                      || int(_LhsNested::ColsAtCompileTime)==int(_RhsNested::RowsAtCompileTime),
+        AreVectors = _LhsNested::IsVectorAtCompileTime && _RhsNested::IsVectorAtCompileTime,
+        SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(_LhsNested,_RhsNested)
+      };
+      // note to the lost user:
+      //    * for a dot product use: v1.dot(v2)
+      //    * for a coeff-wise product use: v1.cwise()*v2
+      EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
+        INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
+      EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
+        INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
+      EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
+    }
+
+    LhsNested m_lhs;
+    RhsNested m_rhs;
+    RealScalar m_tolerance;
+    bool m_conservative;
+};
+
+// sparse = sparse * sparse
+template<typename Derived>
+template<typename Lhs, typename Rhs>
+inline Derived& SparseMatrixBase<Derived>::operator=(const SparseSparseProduct<Lhs,Rhs>& product)
+{
+  product.evalTo(derived());
+  return derived();
+}
+
+/** \returns an expression of the product of two sparse matrices.
+  * By default a conservative product preserving the symbolic non zeros is performed.
+  * The automatic pruning of the small values can be achieved by calling the pruned() function
+  * in which case a totally different product algorithm is employed:
+  * \code
+  * C = (A*B).pruned();             // supress numerical zeros (exact)
+  * C = (A*B).pruned(ref);
+  * C = (A*B).pruned(ref,epsilon);
+  * \endcode
+  * where \c ref is a meaningful non zero reference value.
+  * */
+template<typename Derived>
+template<typename OtherDerived>
+inline const typename SparseSparseProductReturnType<Derived,OtherDerived>::Type
+SparseMatrixBase<Derived>::operator*(const SparseMatrixBase<OtherDerived> &other) const
+{
+  return typename SparseSparseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEPRODUCT_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseRedux.h b/extern/Eigen3/Eigen/src/SparseCore/SparseRedux.h
new file mode 100644
index 0000000..f3da93a
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseRedux.h
@@ -0,0 +1,45 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEREDUX_H
+#define EIGEN_SPARSEREDUX_H
+
+namespace Eigen { 
+
+template<typename Derived>
+typename internal::traits<Derived>::Scalar
+SparseMatrixBase<Derived>::sum() const
+{
+  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+  Scalar res(0);
+  for (Index j=0; j<outerSize(); ++j)
+    for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
+      res += iter.value();
+  return res;
+}
+
+template<typename _Scalar, int _Options, typename _Index>
+typename internal::traits<SparseMatrix<_Scalar,_Options,_Index> >::Scalar
+SparseMatrix<_Scalar,_Options,_Index>::sum() const
+{
+  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
+}
+
+template<typename _Scalar, int _Options, typename _Index>
+typename internal::traits<SparseVector<_Scalar,_Options, _Index> >::Scalar
+SparseVector<_Scalar,_Options,_Index>::sum() const
+{
+  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEREDUX_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h b/extern/Eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h
new file mode 100644
index 0000000..86ec0a6
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h
@@ -0,0 +1,480 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_SELFADJOINTVIEW_H
+#define EIGEN_SPARSE_SELFADJOINTVIEW_H
+
+namespace Eigen { 
+
+/** \ingroup SparseCore_Module
+  * \class SparseSelfAdjointView
+  *
+  * \brief Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
+  *
+  * \param MatrixType the type of the dense matrix storing the coefficients
+  * \param UpLo can be either \c #Lower or \c #Upper
+  *
+  * This class is an expression of a sefladjoint matrix from a triangular part of a matrix
+  * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView()
+  * and most of the time this is the only way that it is used.
+  *
+  * \sa SparseMatrixBase::selfadjointView()
+  */
+template<typename Lhs, typename Rhs, int UpLo>
+class SparseSelfAdjointTimeDenseProduct;
+
+template<typename Lhs, typename Rhs, int UpLo>
+class DenseTimeSparseSelfAdjointProduct;
+
+namespace internal {
+  
+template<typename MatrixType, unsigned int UpLo>
+struct traits<SparseSelfAdjointView<MatrixType,UpLo> > : traits<MatrixType> {
+};
+
+template<int SrcUpLo,int DstUpLo,typename MatrixType,int DestOrder>
+void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm = 0);
+
+template<int UpLo,typename MatrixType,int DestOrder>
+void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm = 0);
+
+}
+
+template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView
+  : public EigenBase<SparseSelfAdjointView<MatrixType,UpLo> >
+{
+  public:
+
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::Index Index;
+    typedef Matrix<Index,Dynamic,1> VectorI;
+    typedef typename MatrixType::Nested MatrixTypeNested;
+    typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
+
+    inline SparseSelfAdjointView(const MatrixType& matrix) : m_matrix(matrix)
+    {
+      eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
+    }
+
+    inline Index rows() const { return m_matrix.rows(); }
+    inline Index cols() const { return m_matrix.cols(); }
+
+    /** \internal \returns a reference to the nested matrix */
+    const _MatrixTypeNested& matrix() const { return m_matrix; }
+    _MatrixTypeNested& matrix() { return m_matrix.const_cast_derived(); }
+
+    /** Efficient sparse self-adjoint matrix times dense vector/matrix product */
+    template<typename OtherDerived>
+    SparseSelfAdjointTimeDenseProduct<MatrixType,OtherDerived,UpLo>
+    operator*(const MatrixBase<OtherDerived>& rhs) const
+    {
+      return SparseSelfAdjointTimeDenseProduct<MatrixType,OtherDerived,UpLo>(m_matrix, rhs.derived());
+    }
+
+    /** Efficient dense vector/matrix times sparse self-adjoint matrix product */
+    template<typename OtherDerived> friend
+    DenseTimeSparseSelfAdjointProduct<OtherDerived,MatrixType,UpLo>
+    operator*(const MatrixBase<OtherDerived>& lhs, const SparseSelfAdjointView& rhs)
+    {
+      return DenseTimeSparseSelfAdjointProduct<OtherDerived,_MatrixTypeNested,UpLo>(lhs.derived(), rhs.m_matrix);
+    }
+
+    /** Perform a symmetric rank K update of the selfadjoint matrix \c *this:
+      * \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix.
+      *
+      * \returns a reference to \c *this
+      *
+      * To perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply
+      * call this function with u.adjoint().
+      */
+    template<typename DerivedU>
+    SparseSelfAdjointView& rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
+    
+    /** \internal triggered by sparse_matrix = SparseSelfadjointView; */
+    template<typename DestScalar,int StorageOrder> void evalTo(SparseMatrix<DestScalar,StorageOrder,Index>& _dest) const
+    {
+      internal::permute_symm_to_fullsymm<UpLo>(m_matrix, _dest);
+    }
+    
+    template<typename DestScalar> void evalTo(DynamicSparseMatrix<DestScalar,ColMajor,Index>& _dest) const
+    {
+      // TODO directly evaluate into _dest;
+      SparseMatrix<DestScalar,ColMajor,Index> tmp(_dest.rows(),_dest.cols());
+      internal::permute_symm_to_fullsymm<UpLo>(m_matrix, tmp);
+      _dest = tmp;
+    }
+    
+    /** \returns an expression of P H P^-1 */
+    SparseSymmetricPermutationProduct<_MatrixTypeNested,UpLo> twistedBy(const PermutationMatrix<Dynamic,Dynamic,Index>& perm) const
+    {
+      return SparseSymmetricPermutationProduct<_MatrixTypeNested,UpLo>(m_matrix, perm);
+    }
+    
+    template<typename SrcMatrixType,int SrcUpLo>
+    SparseSelfAdjointView& operator=(const SparseSymmetricPermutationProduct<SrcMatrixType,SrcUpLo>& permutedMatrix)
+    {
+      permutedMatrix.evalTo(*this);
+      return *this;
+    }
+
+
+    SparseSelfAdjointView& operator=(const SparseSelfAdjointView& src)
+    {
+      PermutationMatrix<Dynamic> pnull;
+      return *this = src.twistedBy(pnull);
+    }
+
+    template<typename SrcMatrixType,unsigned int SrcUpLo>
+    SparseSelfAdjointView& operator=(const SparseSelfAdjointView<SrcMatrixType,SrcUpLo>& src)
+    {
+      PermutationMatrix<Dynamic> pnull;
+      return *this = src.twistedBy(pnull);
+    }
+    
+
+    // const SparseLLT<PlainObject, UpLo> llt() const;
+    // const SparseLDLT<PlainObject, UpLo> ldlt() const;
+
+  protected:
+
+    typename MatrixType::Nested m_matrix;
+    mutable VectorI m_countPerRow;
+    mutable VectorI m_countPerCol;
+};
+
+/***************************************************************************
+* Implementation of SparseMatrixBase methods
+***************************************************************************/
+
+template<typename Derived>
+template<unsigned int UpLo>
+const SparseSelfAdjointView<Derived, UpLo> SparseMatrixBase<Derived>::selfadjointView() const
+{
+  return derived();
+}
+
+template<typename Derived>
+template<unsigned int UpLo>
+SparseSelfAdjointView<Derived, UpLo> SparseMatrixBase<Derived>::selfadjointView()
+{
+  return derived();
+}
+
+/***************************************************************************
+* Implementation of SparseSelfAdjointView methods
+***************************************************************************/
+
+template<typename MatrixType, unsigned int UpLo>
+template<typename DerivedU>
+SparseSelfAdjointView<MatrixType,UpLo>&
+SparseSelfAdjointView<MatrixType,UpLo>::rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha)
+{
+  SparseMatrix<Scalar,MatrixType::Flags&RowMajorBit?RowMajor:ColMajor> tmp = u * u.adjoint();
+  if(alpha==Scalar(0))
+    m_matrix.const_cast_derived() = tmp.template triangularView<UpLo>();
+  else
+    m_matrix.const_cast_derived() += alpha * tmp.template triangularView<UpLo>();
+
+  return *this;
+}
+
+/***************************************************************************
+* Implementation of sparse self-adjoint time dense matrix
+***************************************************************************/
+
+namespace internal {
+template<typename Lhs, typename Rhs, int UpLo>
+struct traits<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo> >
+ : traits<ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
+{
+  typedef Dense StorageKind;
+};
+}
+
+template<typename Lhs, typename Rhs, int UpLo>
+class SparseSelfAdjointTimeDenseProduct
+  : public ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(SparseSelfAdjointTimeDenseProduct)
+
+    SparseSelfAdjointTimeDenseProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {}
+
+    template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
+    {
+      // TODO use alpha
+      eigen_assert(alpha==Scalar(1) && "alpha != 1 is not implemented yet, sorry");
+      typedef typename internal::remove_all<Lhs>::type _Lhs;
+      typedef typename internal::remove_all<Rhs>::type _Rhs;
+      typedef typename _Lhs::InnerIterator LhsInnerIterator;
+      enum {
+        LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit,
+        ProcessFirstHalf =
+                 ((UpLo&(Upper|Lower))==(Upper|Lower))
+              || ( (UpLo&Upper) && !LhsIsRowMajor)
+              || ( (UpLo&Lower) && LhsIsRowMajor),
+        ProcessSecondHalf = !ProcessFirstHalf
+      };
+      for (Index j=0; j<m_lhs.outerSize(); ++j)
+      {
+        LhsInnerIterator i(m_lhs,j);
+        if (ProcessSecondHalf)
+        {
+          while (i && i.index()<j) ++i;
+          if(i && i.index()==j)
+          {
+            dest.row(j) += i.value() * m_rhs.row(j);
+            ++i;
+          }
+        }
+        for(; (ProcessFirstHalf ? i && i.index() < j : i) ; ++i)
+        {
+          Index a = LhsIsRowMajor ? j : i.index();
+          Index b = LhsIsRowMajor ? i.index() : j;
+          typename Lhs::Scalar v = i.value();
+          dest.row(a) += (v) * m_rhs.row(b);
+          dest.row(b) += internal::conj(v) * m_rhs.row(a);
+        }
+        if (ProcessFirstHalf && i && (i.index()==j))
+          dest.row(j) += i.value() * m_rhs.row(j);
+      }
+    }
+
+  private:
+    SparseSelfAdjointTimeDenseProduct& operator=(const SparseSelfAdjointTimeDenseProduct&);
+};
+
+namespace internal {
+template<typename Lhs, typename Rhs, int UpLo>
+struct traits<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo> >
+ : traits<ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
+{};
+}
+
+template<typename Lhs, typename Rhs, int UpLo>
+class DenseTimeSparseSelfAdjointProduct
+  : public ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs>
+{
+  public:
+    EIGEN_PRODUCT_PUBLIC_INTERFACE(DenseTimeSparseSelfAdjointProduct)
+
+    DenseTimeSparseSelfAdjointProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
+    {}
+
+    template<typename Dest> void scaleAndAddTo(Dest& /*dest*/, Scalar /*alpha*/) const
+    {
+      // TODO
+    }
+
+  private:
+    DenseTimeSparseSelfAdjointProduct& operator=(const DenseTimeSparseSelfAdjointProduct&);
+};
+
+/***************************************************************************
+* Implementation of symmetric copies and permutations
+***************************************************************************/
+namespace internal {
+  
+template<typename MatrixType, int UpLo>
+struct traits<SparseSymmetricPermutationProduct<MatrixType,UpLo> > : traits<MatrixType> {
+};
+
+template<int UpLo,typename MatrixType,int DestOrder>
+void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm)
+{
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  typedef SparseMatrix<Scalar,DestOrder,Index> Dest;
+  typedef Matrix<Index,Dynamic,1> VectorI;
+  
+  Dest& dest(_dest.derived());
+  enum {
+    StorageOrderMatch = int(Dest::IsRowMajor) == int(MatrixType::IsRowMajor)
+  };
+  
+  Index size = mat.rows();
+  VectorI count;
+  count.resize(size);
+  count.setZero();
+  dest.resize(size,size);
+  for(Index j = 0; j<size; ++j)
+  {
+    Index jp = perm ? perm[j] : j;
+    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
+    {
+      Index i = it.index();
+      Index r = it.row();
+      Index c = it.col();
+      Index ip = perm ? perm[i] : i;
+      if(UpLo==(Upper|Lower))
+        count[StorageOrderMatch ? jp : ip]++;
+      else if(r==c)
+        count[ip]++;
+      else if(( UpLo==Lower && r>c) || ( UpLo==Upper && r<c))
+      {
+        count[ip]++;
+        count[jp]++;
+      }
+    }
+  }
+  Index nnz = count.sum();
+  
+  // reserve space
+  dest.resizeNonZeros(nnz);
+  dest.outerIndexPtr()[0] = 0;
+  for(Index j=0; j<size; ++j)
+    dest.outerIndexPtr()[j+1] = dest.outerIndexPtr()[j] + count[j];
+  for(Index j=0; j<size; ++j)
+    count[j] = dest.outerIndexPtr()[j];
+  
+  // copy data
+  for(Index j = 0; j<size; ++j)
+  {
+    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
+    {
+      Index i = it.index();
+      Index r = it.row();
+      Index c = it.col();
+      
+      Index jp = perm ? perm[j] : j;
+      Index ip = perm ? perm[i] : i;
+      
+      if(UpLo==(Upper|Lower))
+      {
+        Index k = count[StorageOrderMatch ? jp : ip]++;
+        dest.innerIndexPtr()[k] = StorageOrderMatch ? ip : jp;
+        dest.valuePtr()[k] = it.value();
+      }
+      else if(r==c)
+      {
+        Index k = count[ip]++;
+        dest.innerIndexPtr()[k] = ip;
+        dest.valuePtr()[k] = it.value();
+      }
+      else if(( (UpLo&Lower)==Lower && r>c) || ( (UpLo&Upper)==Upper && r<c))
+      {
+        if(!StorageOrderMatch)
+          std::swap(ip,jp);
+        Index k = count[jp]++;
+        dest.innerIndexPtr()[k] = ip;
+        dest.valuePtr()[k] = it.value();
+        k = count[ip]++;
+        dest.innerIndexPtr()[k] = jp;
+        dest.valuePtr()[k] = internal::conj(it.value());
+      }
+    }
+  }
+}
+
+template<int _SrcUpLo,int _DstUpLo,typename MatrixType,int DstOrder>
+void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DstOrder,typename MatrixType::Index>& _dest, const typename MatrixType::Index* perm)
+{
+  typedef typename MatrixType::Index Index;
+  typedef typename MatrixType::Scalar Scalar;
+  SparseMatrix<Scalar,DstOrder,Index>& dest(_dest.derived());
+  typedef Matrix<Index,Dynamic,1> VectorI;
+  enum {
+    SrcOrder = MatrixType::IsRowMajor ? RowMajor : ColMajor,
+    StorageOrderMatch = int(SrcOrder) == int(DstOrder),
+    DstUpLo = DstOrder==RowMajor ? (_DstUpLo==Upper ? Lower : Upper) : _DstUpLo,
+    SrcUpLo = SrcOrder==RowMajor ? (_SrcUpLo==Upper ? Lower : Upper) : _SrcUpLo
+  };
+  
+  Index size = mat.rows();
+  VectorI count(size);
+  count.setZero();
+  dest.resize(size,size);
+  for(Index j = 0; j<size; ++j)
+  {
+    Index jp = perm ? perm[j] : j;
+    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
+    {
+      Index i = it.index();
+      if((int(SrcUpLo)==int(Lower) && i<j) || (int(SrcUpLo)==int(Upper) && i>j))
+        continue;
+                  
+      Index ip = perm ? perm[i] : i;
+      count[int(DstUpLo)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
+    }
+  }
+  dest.outerIndexPtr()[0] = 0;
+  for(Index j=0; j<size; ++j)
+    dest.outerIndexPtr()[j+1] = dest.outerIndexPtr()[j] + count[j];
+  dest.resizeNonZeros(dest.outerIndexPtr()[size]);
+  for(Index j=0; j<size; ++j)
+    count[j] = dest.outerIndexPtr()[j];
+  
+  for(Index j = 0; j<size; ++j)
+  {
+    
+    for(typename MatrixType::InnerIterator it(mat,j); it; ++it)
+    {
+      Index i = it.index();
+      if((int(SrcUpLo)==int(Lower) && i<j) || (int(SrcUpLo)==int(Upper) && i>j))
+        continue;
+                  
+      Index jp = perm ? perm[j] : j;
+      Index ip = perm? perm[i] : i;
+      
+      Index k = count[int(DstUpLo)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
+      dest.innerIndexPtr()[k] = int(DstUpLo)==int(Lower) ? (std::max)(ip,jp) : (std::min)(ip,jp);
+      
+      if(!StorageOrderMatch) std::swap(ip,jp);
+      if( ((int(DstUpLo)==int(Lower) && ip<jp) || (int(DstUpLo)==int(Upper) && ip>jp)))
+        dest.valuePtr()[k] = conj(it.value());
+      else
+        dest.valuePtr()[k] = it.value();
+    }
+  }
+}
+
+}
+
+template<typename MatrixType,int UpLo>
+class SparseSymmetricPermutationProduct
+  : public EigenBase<SparseSymmetricPermutationProduct<MatrixType,UpLo> >
+{
+  public:
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::Index Index;
+  protected:
+    typedef PermutationMatrix<Dynamic,Dynamic,Index> Perm;
+  public:
+    typedef Matrix<Index,Dynamic,1> VectorI;
+    typedef typename MatrixType::Nested MatrixTypeNested;
+    typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
+    
+    SparseSymmetricPermutationProduct(const MatrixType& mat, const Perm& perm)
+      : m_matrix(mat), m_perm(perm)
+    {}
+    
+    inline Index rows() const { return m_matrix.rows(); }
+    inline Index cols() const { return m_matrix.cols(); }
+    
+    template<typename DestScalar, int Options, typename DstIndex>
+    void evalTo(SparseMatrix<DestScalar,Options,DstIndex>& _dest) const
+    {
+      internal::permute_symm_to_fullsymm<UpLo>(m_matrix,_dest,m_perm.indices().data());
+    }
+    
+    template<typename DestType,unsigned int DestUpLo> void evalTo(SparseSelfAdjointView<DestType,DestUpLo>& dest) const
+    {
+      internal::permute_symm_to_symm<UpLo,DestUpLo>(m_matrix,dest.matrix(),m_perm.indices().data());
+    }
+    
+  protected:
+    MatrixTypeNested m_matrix;
+    const Perm& m_perm;
+
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_SELFADJOINTVIEW_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h b/extern/Eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h
new file mode 100644
index 0000000..2438ac5
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h
@@ -0,0 +1,149 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
+#define EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
+
+namespace Eigen { 
+
+namespace internal {
+
+
+// perform a pseudo in-place sparse * sparse product assuming all matrices are col major
+template<typename Lhs, typename Rhs, typename ResultType>
+static void sparse_sparse_product_with_pruning_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res, typename ResultType::RealScalar tolerance)
+{
+  // return sparse_sparse_product_with_pruning_impl2(lhs,rhs,res);
+
+  typedef typename remove_all<Lhs>::type::Scalar Scalar;
+  typedef typename remove_all<Lhs>::type::Index Index;
+
+  // make sure to call innerSize/outerSize since we fake the storage order.
+  Index rows = lhs.innerSize();
+  Index cols = rhs.outerSize();
+  //int size = lhs.outerSize();
+  eigen_assert(lhs.outerSize() == rhs.innerSize());
+
+  // allocate a temporary buffer
+  AmbiVector<Scalar,Index> tempVector(rows);
+
+  // estimate the number of non zero entries
+  // given a rhs column containing Y non zeros, we assume that the respective Y columns
+  // of the lhs differs in average of one non zeros, thus the number of non zeros for
+  // the product of a rhs column with the lhs is X+Y where X is the average number of non zero
+  // per column of the lhs.
+  // Therefore, we have nnz(lhs*rhs) = nnz(lhs) + nnz(rhs)
+  Index estimated_nnz_prod = lhs.nonZeros() + rhs.nonZeros();
+
+  // mimics a resizeByInnerOuter:
+  if(ResultType::IsRowMajor)
+    res.resize(cols, rows);
+  else
+    res.resize(rows, cols);
+
+  res.reserve(estimated_nnz_prod);
+  double ratioColRes = double(estimated_nnz_prod)/double(lhs.rows()*rhs.cols());
+  for (Index j=0; j<cols; ++j)
+  {
+    // FIXME:
+    //double ratioColRes = (double(rhs.innerVector(j).nonZeros()) + double(lhs.nonZeros())/double(lhs.cols()))/double(lhs.rows());
+    // let's do a more accurate determination of the nnz ratio for the current column j of res
+    tempVector.init(ratioColRes);
+    tempVector.setZero();
+    for (typename Rhs::InnerIterator rhsIt(rhs, j); rhsIt; ++rhsIt)
+    {
+      // FIXME should be written like this: tmp += rhsIt.value() * lhs.col(rhsIt.index())
+      tempVector.restart();
+      Scalar x = rhsIt.value();
+      for (typename Lhs::InnerIterator lhsIt(lhs, rhsIt.index()); lhsIt; ++lhsIt)
+      {
+        tempVector.coeffRef(lhsIt.index()) += lhsIt.value() * x;
+      }
+    }
+    res.startVec(j);
+    for (typename AmbiVector<Scalar,Index>::Iterator it(tempVector,tolerance); it; ++it)
+      res.insertBackByOuterInner(j,it.index()) = it.value();
+  }
+  res.finalize();
+}
+
+template<typename Lhs, typename Rhs, typename ResultType,
+  int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
+  int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
+  int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
+struct sparse_sparse_product_with_pruning_selector;
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct sparse_sparse_product_with_pruning_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
+{
+  typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
+  typedef typename ResultType::RealScalar RealScalar;
+
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, RealScalar tolerance)
+  {
+    typename remove_all<ResultType>::type _res(res.rows(), res.cols());
+    internal::sparse_sparse_product_with_pruning_impl<Lhs,Rhs,ResultType>(lhs, rhs, _res, tolerance);
+    res.swap(_res);
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct sparse_sparse_product_with_pruning_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
+{
+  typedef typename ResultType::RealScalar RealScalar;
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, RealScalar tolerance)
+  {
+    // we need a col-major matrix to hold the result
+    typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
+    SparseTemporaryType _res(res.rows(), res.cols());
+    internal::sparse_sparse_product_with_pruning_impl<Lhs,Rhs,SparseTemporaryType>(lhs, rhs, _res, tolerance);
+    res = _res;
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct sparse_sparse_product_with_pruning_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
+{
+  typedef typename ResultType::RealScalar RealScalar;
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, RealScalar tolerance)
+  {
+    // let's transpose the product to get a column x column product
+    typename remove_all<ResultType>::type _res(res.rows(), res.cols());
+    internal::sparse_sparse_product_with_pruning_impl<Rhs,Lhs,ResultType>(rhs, lhs, _res, tolerance);
+    res.swap(_res);
+  }
+};
+
+template<typename Lhs, typename Rhs, typename ResultType>
+struct sparse_sparse_product_with_pruning_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
+{
+  typedef typename ResultType::RealScalar RealScalar;
+  static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, RealScalar tolerance)
+  {
+    typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
+    ColMajorMatrix colLhs(lhs);
+    ColMajorMatrix colRhs(rhs);
+    internal::sparse_sparse_product_with_pruning_impl<ColMajorMatrix,ColMajorMatrix,ResultType>(colLhs, colRhs, res, tolerance);
+
+    // let's transpose the product to get a column x column product
+//     typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
+//     SparseTemporaryType _res(res.cols(), res.rows());
+//     sparse_sparse_product_with_pruning_impl<Rhs,Lhs,SparseTemporaryType>(rhs, lhs, _res);
+//     res = _res.transpose();
+  }
+};
+
+// NOTE the 2 others cases (col row *) must never occur since they are caught
+// by ProductReturnType which transforms it to (col col *) by evaluating rhs.
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseTranspose.h b/extern/Eigen3/Eigen/src/SparseCore/SparseTranspose.h
new file mode 100644
index 0000000..273f9de
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseTranspose.h
@@ -0,0 +1,61 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSETRANSPOSE_H
+#define EIGEN_SPARSETRANSPOSE_H
+
+namespace Eigen { 
+
+template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
+  : public SparseMatrixBase<Transpose<MatrixType> >
+{
+    typedef typename internal::remove_all<typename MatrixType::Nested>::type _MatrixTypeNested;
+  public:
+
+    EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
+};
+
+// NOTE: VC10 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
+// a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
+// does not fix the issue.
+// An alternative is to define the nested class in the parent class itself.
+template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerIterator
+  : public _MatrixTypeNested::InnerIterator
+{
+    typedef typename _MatrixTypeNested::InnerIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
+      : Base(trans.derived().nestedExpression(), outer)
+    {}
+    inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
+    inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
+};
+
+template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
+  : public _MatrixTypeNested::ReverseInnerIterator
+{
+    typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
+      : Base(xpr.derived().nestedExpression(), outer)
+    {}
+    inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
+    inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSETRANSPOSE_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseTriangularView.h b/extern/Eigen3/Eigen/src/SparseCore/SparseTriangularView.h
new file mode 100644
index 0000000..477e4bd
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseTriangularView.h
@@ -0,0 +1,164 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_TRIANGULARVIEW_H
+#define EIGEN_SPARSE_TRIANGULARVIEW_H
+
+namespace Eigen { 
+
+namespace internal {
+  
+template<typename MatrixType, int Mode>
+struct traits<SparseTriangularView<MatrixType,Mode> >
+: public traits<MatrixType>
+{};
+
+} // namespace internal
+
+template<typename MatrixType, int Mode> class SparseTriangularView
+  : public SparseMatrixBase<SparseTriangularView<MatrixType,Mode> >
+{
+    enum { SkipFirst = ((Mode&Lower) && !(MatrixType::Flags&RowMajorBit))
+                    || ((Mode&Upper) &&  (MatrixType::Flags&RowMajorBit)),
+           SkipLast = !SkipFirst,
+           HasUnitDiag = (Mode&UnitDiag) ? 1 : 0
+    };
+
+  public:
+    
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseTriangularView)
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    inline Index rows() const { return m_matrix.rows(); }
+    inline Index cols() const { return m_matrix.cols(); }
+
+    typedef typename MatrixType::Nested MatrixTypeNested;
+    typedef typename internal::remove_reference<MatrixTypeNested>::type MatrixTypeNestedNonRef;
+    typedef typename internal::remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
+
+    inline SparseTriangularView(const MatrixType& matrix) : m_matrix(matrix) {}
+
+    /** \internal */
+    inline const MatrixTypeNestedCleaned& nestedExpression() const { return m_matrix; }
+
+    template<typename OtherDerived>
+    typename internal::plain_matrix_type_column_major<OtherDerived>::type
+    solve(const MatrixBase<OtherDerived>& other) const;
+
+    template<typename OtherDerived> void solveInPlace(MatrixBase<OtherDerived>& other) const;
+    template<typename OtherDerived> void solveInPlace(SparseMatrixBase<OtherDerived>& other) const;
+
+  protected:
+    MatrixTypeNested m_matrix;
+};
+
+template<typename MatrixType, int Mode>
+class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixTypeNestedCleaned::InnerIterator
+{
+    typedef typename MatrixTypeNestedCleaned::InnerIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer)
+      : Base(view.nestedExpression(), outer), m_returnOne(false)
+    {
+      if(SkipFirst)
+      {
+        while((*this) && (HasUnitDiag ? this->index()<=outer : this->index()<outer))
+          Base::operator++();
+        if(HasUnitDiag)
+          m_returnOne = true;
+      }
+      else if(HasUnitDiag && ((!Base::operator bool()) || Base::index()>=Base::outer()))
+      {
+        if((!SkipFirst) && Base::operator bool())
+          Base::operator++();
+        m_returnOne = true;
+      }
+    }
+
+    EIGEN_STRONG_INLINE InnerIterator& operator++()
+    {
+      if(HasUnitDiag && m_returnOne)
+        m_returnOne = false;
+      else
+      {
+        Base::operator++();
+        if(HasUnitDiag && (!SkipFirst) && ((!Base::operator bool()) || Base::index()>=Base::outer()))
+        {
+          if((!SkipFirst) && Base::operator bool())
+            Base::operator++();
+          m_returnOne = true;
+        }
+      }
+      return *this;
+    }
+
+    inline Index row() const { return Base::row(); }
+    inline Index col() const { return Base::col(); }
+    inline Index index() const
+    {
+      if(HasUnitDiag && m_returnOne)  return Base::outer();
+      else                            return Base::index();
+    }
+    inline Scalar value() const
+    {
+      if(HasUnitDiag && m_returnOne)  return Scalar(1);
+      else                            return Base::value();
+    }
+
+    EIGEN_STRONG_INLINE operator bool() const
+    {
+      if(HasUnitDiag && m_returnOne)
+        return true;
+      return (SkipFirst ? Base::operator bool() : (Base::operator bool() && this->index() <= this->outer()));
+    }
+  protected:
+    bool m_returnOne;
+};
+
+template<typename MatrixType, int Mode>
+class SparseTriangularView<MatrixType,Mode>::ReverseInnerIterator : public MatrixTypeNestedCleaned::ReverseInnerIterator
+{
+    typedef typename MatrixTypeNestedCleaned::ReverseInnerIterator Base;
+  public:
+
+    EIGEN_STRONG_INLINE ReverseInnerIterator(const SparseTriangularView& view, Index outer)
+      : Base(view.nestedExpression(), outer)
+    {
+      eigen_assert((!HasUnitDiag) && "ReverseInnerIterator does not support yet triangular views with a unit diagonal");
+      if(SkipLast)
+        while((*this) && this->index()>outer)
+          --(*this);
+    }
+
+    EIGEN_STRONG_INLINE InnerIterator& operator--()
+    { Base::operator--(); return *this; }
+
+    inline Index row() const { return Base::row(); }
+    inline Index col() const { return Base::col(); }
+
+    EIGEN_STRONG_INLINE operator bool() const
+    {
+      return SkipLast ? Base::operator bool() : (Base::operator bool() && this->index() >= this->outer());
+    }
+};
+
+template<typename Derived>
+template<int Mode>
+inline const SparseTriangularView<Derived, Mode>
+SparseMatrixBase<Derived>::triangularView() const
+{
+  return derived();
+}
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_TRIANGULARVIEW_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseUtil.h b/extern/Eigen3/Eigen/src/SparseCore/SparseUtil.h
new file mode 100644
index 0000000..6062a08
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseUtil.h
@@ -0,0 +1,173 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEUTIL_H
+#define EIGEN_SPARSEUTIL_H
+
+namespace Eigen { 
+
+#ifdef NDEBUG
+#define EIGEN_DBG_SPARSE(X)
+#else
+#define EIGEN_DBG_SPARSE(X) X
+#endif
+
+#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
+template<typename OtherDerived> \
+EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase<OtherDerived>& other) \
+{ \
+  return Base::operator Op(other.derived()); \
+} \
+EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \
+{ \
+  return Base::operator Op(other); \
+}
+
+#define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
+template<typename Other> \
+EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
+{ \
+  return Base::operator Op(scalar); \
+}
+
+#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
+EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
+EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
+EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
+EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
+EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
+
+#define _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, BaseClass) \
+  typedef BaseClass Base; \
+  typedef typename Eigen::internal::traits<Derived >::Scalar Scalar; \
+  typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
+  typedef typename Eigen::internal::nested<Derived >::type Nested; \
+  typedef typename Eigen::internal::traits<Derived >::StorageKind StorageKind; \
+  typedef typename Eigen::internal::traits<Derived >::Index Index; \
+  enum { RowsAtCompileTime = Eigen::internal::traits<Derived >::RowsAtCompileTime, \
+        ColsAtCompileTime = Eigen::internal::traits<Derived >::ColsAtCompileTime, \
+        Flags = Eigen::internal::traits<Derived >::Flags, \
+        CoeffReadCost = Eigen::internal::traits<Derived >::CoeffReadCost, \
+        SizeAtCompileTime = Base::SizeAtCompileTime, \
+        IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
+  using Base::derived; \
+  using Base::const_cast_derived;
+
+#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
+  _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, Eigen::SparseMatrixBase<Derived >)
+
+const int CoherentAccessPattern     = 0x1;
+const int InnerRandomAccessPattern  = 0x2 | CoherentAccessPattern;
+const int OuterRandomAccessPattern  = 0x4 | CoherentAccessPattern;
+const int RandomAccessPattern       = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
+
+template<typename Derived> class SparseMatrixBase;
+template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseMatrix;
+template<typename _Scalar, int _Flags = 0, typename _Index = int>  class DynamicSparseMatrix;
+template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseVector;
+template<typename _Scalar, int _Flags = 0, typename _Index = int>  class MappedSparseMatrix;
+
+template<typename MatrixType, int Size>           class SparseInnerVectorSet;
+template<typename MatrixType, int Mode>           class SparseTriangularView;
+template<typename MatrixType, unsigned int UpLo>  class SparseSelfAdjointView;
+template<typename Lhs, typename Rhs>              class SparseDiagonalProduct;
+template<typename MatrixType> class SparseView;
+
+template<typename Lhs, typename Rhs>        class SparseSparseProduct;
+template<typename Lhs, typename Rhs>        class SparseTimeDenseProduct;
+template<typename Lhs, typename Rhs>        class DenseTimeSparseProduct;
+template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
+
+template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
+template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
+template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
+template<typename MatrixType,int UpLo> class SparseSymmetricPermutationProduct;
+
+namespace internal {
+
+template<typename T,int Rows,int Cols> struct sparse_eval;
+
+template<typename T> struct eval<T,Sparse>
+  : public sparse_eval<T, traits<T>::RowsAtCompileTime,traits<T>::ColsAtCompileTime>
+{};
+
+template<typename T,int Cols> struct sparse_eval<T,1,Cols> {
+    typedef typename traits<T>::Scalar _Scalar;
+    enum { _Flags = traits<T>::Flags| RowMajorBit };
+  public:
+    typedef SparseVector<_Scalar, _Flags> type;
+};
+
+template<typename T,int Rows> struct sparse_eval<T,Rows,1> {
+    typedef typename traits<T>::Scalar _Scalar;
+    enum { _Flags = traits<T>::Flags & (~RowMajorBit) };
+  public:
+    typedef SparseVector<_Scalar, _Flags> type;
+};
+
+template<typename T,int Rows,int Cols> struct sparse_eval {
+    typedef typename traits<T>::Scalar _Scalar;
+    enum { _Flags = traits<T>::Flags };
+  public:
+    typedef SparseMatrix<_Scalar, _Flags> type;
+};
+
+template<typename T> struct sparse_eval<T,1,1> {
+    typedef typename traits<T>::Scalar _Scalar;
+  public:
+    typedef Matrix<_Scalar, 1, 1> type;
+};
+
+template<typename T> struct plain_matrix_type<T,Sparse>
+{
+  typedef typename traits<T>::Scalar _Scalar;
+    enum {
+          _Flags = traits<T>::Flags
+    };
+
+  public:
+    typedef SparseMatrix<_Scalar, _Flags> type;
+};
+
+} // end namespace internal
+
+/** \ingroup SparseCore_Module
+  *
+  * \class Triplet
+  *
+  * \brief A small structure to hold a non zero as a triplet (i,j,value).
+  *
+  * \sa SparseMatrix::setFromTriplets()
+  */
+template<typename Scalar, typename Index=unsigned int>
+class Triplet
+{
+public:
+  Triplet() : m_row(0), m_col(0), m_value(0) {}
+
+  Triplet(const Index& i, const Index& j, const Scalar& v = Scalar(0))
+    : m_row(i), m_col(j), m_value(v)
+  {}
+
+  /** \returns the row index of the element */
+  const Index& row() const { return m_row; }
+
+  /** \returns the column index of the element */
+  const Index& col() const { return m_col; }
+
+  /** \returns the value of the element */
+  const Scalar& value() const { return m_value; }
+protected:
+  Index m_row, m_col;
+  Scalar m_value;
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEUTIL_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseVector.h b/extern/Eigen3/Eigen/src/SparseCore/SparseVector.h
new file mode 100644
index 0000000..c952f65
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseVector.h
@@ -0,0 +1,398 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEVECTOR_H
+#define EIGEN_SPARSEVECTOR_H
+
+namespace Eigen { 
+
+/** \ingroup SparseCore_Module
+  * \class SparseVector
+  *
+  * \brief a sparse vector class
+  *
+  * \tparam _Scalar the scalar type, i.e. the type of the coefficients
+  *
+  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
+  *
+  * This class can be extended with the help of the plugin mechanism described on the page
+  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEVECTOR_PLUGIN.
+  */
+
+namespace internal {
+template<typename _Scalar, int _Options, typename _Index>
+struct traits<SparseVector<_Scalar, _Options, _Index> >
+{
+  typedef _Scalar Scalar;
+  typedef _Index Index;
+  typedef Sparse StorageKind;
+  typedef MatrixXpr XprKind;
+  enum {
+    IsColVector = (_Options & RowMajorBit) ? 0 : 1,
+
+    RowsAtCompileTime = IsColVector ? Dynamic : 1,
+    ColsAtCompileTime = IsColVector ? 1 : Dynamic,
+    MaxRowsAtCompileTime = RowsAtCompileTime,
+    MaxColsAtCompileTime = ColsAtCompileTime,
+    Flags = _Options | NestByRefBit | LvalueBit | (IsColVector ? 0 : RowMajorBit),
+    CoeffReadCost = NumTraits<Scalar>::ReadCost,
+    SupportedAccessPatterns = InnerRandomAccessPattern
+  };
+};
+}
+
+template<typename _Scalar, int _Options, typename _Index>
+class SparseVector
+  : public SparseMatrixBase<SparseVector<_Scalar, _Options, _Index> >
+{
+  public:
+    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseVector)
+    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, +=)
+    EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, -=)
+
+  protected:
+  public:
+
+    typedef SparseMatrixBase<SparseVector> SparseBase;
+    enum { IsColVector = internal::traits<SparseVector>::IsColVector };
+    
+    enum {
+      Options = _Options
+    };
+
+    internal::CompressedStorage<Scalar,Index> m_data;
+    Index m_size;
+
+    internal::CompressedStorage<Scalar,Index>& _data() { return m_data; }
+    internal::CompressedStorage<Scalar,Index>& _data() const { return m_data; }
+
+  public:
+
+    EIGEN_STRONG_INLINE Index rows() const { return IsColVector ? m_size : 1; }
+    EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; }
+    EIGEN_STRONG_INLINE Index innerSize() const { return m_size; }
+    EIGEN_STRONG_INLINE Index outerSize() const { return 1; }
+
+    EIGEN_STRONG_INLINE const Scalar* valuePtr() const { return &m_data.value(0); }
+    EIGEN_STRONG_INLINE Scalar* valuePtr() { return &m_data.value(0); }
+
+    EIGEN_STRONG_INLINE const Index* innerIndexPtr() const { return &m_data.index(0); }
+    EIGEN_STRONG_INLINE Index* innerIndexPtr() { return &m_data.index(0); }
+
+    inline Scalar coeff(Index row, Index col) const
+    {
+      eigen_assert((IsColVector ? col : row)==0);
+      return coeff(IsColVector ? row : col);
+    }
+    inline Scalar coeff(Index i) const { return m_data.at(i); }
+
+    inline Scalar& coeffRef(Index row, Index col)
+    {
+      eigen_assert((IsColVector ? col : row)==0);
+      return coeff(IsColVector ? row : col);
+    }
+
+    /** \returns a reference to the coefficient value at given index \a i
+      * This operation involes a log(rho*size) binary search. If the coefficient does not
+      * exist yet, then a sorted insertion into a sequential buffer is performed.
+      *
+      * This insertion might be very costly if the number of nonzeros above \a i is large.
+      */
+    inline Scalar& coeffRef(Index i)
+    {
+      return m_data.atWithInsertion(i);
+    }
+
+  public:
+
+    class InnerIterator;
+    class ReverseInnerIterator;
+
+    inline void setZero() { m_data.clear(); }
+
+    /** \returns the number of non zero coefficients */
+    inline Index nonZeros() const  { return static_cast<Index>(m_data.size()); }
+
+    inline void startVec(Index outer)
+    {
+      EIGEN_UNUSED_VARIABLE(outer);
+      eigen_assert(outer==0);
+    }
+
+    inline Scalar& insertBackByOuterInner(Index outer, Index inner)
+    {
+      EIGEN_UNUSED_VARIABLE(outer);
+      eigen_assert(outer==0);
+      return insertBack(inner);
+    }
+    inline Scalar& insertBack(Index i)
+    {
+      m_data.append(0, i);
+      return m_data.value(m_data.size()-1);
+    }
+
+    inline Scalar& insert(Index row, Index col)
+    {
+      Index inner = IsColVector ? row : col;
+      Index outer = IsColVector ? col : row;
+      eigen_assert(outer==0);
+      return insert(inner);
+    }
+    Scalar& insert(Index i)
+    {
+      Index startId = 0;
+      Index p = Index(m_data.size()) - 1;
+      // TODO smart realloc
+      m_data.resize(p+2,1);
+
+      while ( (p >= startId) && (m_data.index(p) > i) )
+      {
+        m_data.index(p+1) = m_data.index(p);
+        m_data.value(p+1) = m_data.value(p);
+        --p;
+      }
+      m_data.index(p+1) = i;
+      m_data.value(p+1) = 0;
+      return m_data.value(p+1);
+    }
+
+    /**
+      */
+    inline void reserve(Index reserveSize) { m_data.reserve(reserveSize); }
+
+
+    inline void finalize() {}
+
+    void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
+    {
+      m_data.prune(reference,epsilon);
+    }
+
+    void resize(Index rows, Index cols)
+    {
+      eigen_assert(rows==1 || cols==1);
+      resize(IsColVector ? rows : cols);
+    }
+
+    void resize(Index newSize)
+    {
+      m_size = newSize;
+      m_data.clear();
+    }
+
+    void resizeNonZeros(Index size) { m_data.resize(size); }
+
+    inline SparseVector() : m_size(0) { resize(0); }
+
+    inline SparseVector(Index size) : m_size(0) { resize(size); }
+
+    inline SparseVector(Index rows, Index cols) : m_size(0) { resize(rows,cols); }
+
+    template<typename OtherDerived>
+    inline SparseVector(const SparseMatrixBase<OtherDerived>& other)
+      : m_size(0)
+    {
+      *this = other.derived();
+    }
+
+    inline SparseVector(const SparseVector& other)
+      : m_size(0)
+    {
+      *this = other.derived();
+    }
+
+    inline void swap(SparseVector& other)
+    {
+      std::swap(m_size, other.m_size);
+      m_data.swap(other.m_data);
+    }
+
+    inline SparseVector& operator=(const SparseVector& other)
+    {
+      if (other.isRValue())
+      {
+        swap(other.const_cast_derived());
+      }
+      else
+      {
+        resize(other.size());
+        m_data = other.m_data;
+      }
+      return *this;
+    }
+
+    template<typename OtherDerived>
+    inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other)
+    {
+      if (int(RowsAtCompileTime)!=int(OtherDerived::RowsAtCompileTime))
+        return assign(other.transpose());
+      else
+        return assign(other);
+    }
+
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    template<typename Lhs, typename Rhs>
+    inline SparseVector& operator=(const SparseSparseProduct<Lhs,Rhs>& product)
+    {
+      return Base::operator=(product);
+    }
+    #endif
+
+    friend std::ostream & operator << (std::ostream & s, const SparseVector& m)
+    {
+      for (Index i=0; i<m.nonZeros(); ++i)
+        s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
+      s << std::endl;
+      return s;
+    }
+
+    /** Destructor */
+    inline ~SparseVector() {}
+
+    /** Overloaded for performance */
+    Scalar sum() const;
+
+  public:
+
+    /** \deprecated use setZero() and reserve() */
+    EIGEN_DEPRECATED void startFill(Index reserve)
+    {
+      setZero();
+      m_data.reserve(reserve);
+    }
+
+    /** \deprecated use insertBack(Index,Index) */
+    EIGEN_DEPRECATED Scalar& fill(Index r, Index c)
+    {
+      eigen_assert(r==0 || c==0);
+      return fill(IsColVector ? r : c);
+    }
+
+    /** \deprecated use insertBack(Index) */
+    EIGEN_DEPRECATED Scalar& fill(Index i)
+    {
+      m_data.append(0, i);
+      return m_data.value(m_data.size()-1);
+    }
+
+    /** \deprecated use insert(Index,Index) */
+    EIGEN_DEPRECATED Scalar& fillrand(Index r, Index c)
+    {
+      eigen_assert(r==0 || c==0);
+      return fillrand(IsColVector ? r : c);
+    }
+
+    /** \deprecated use insert(Index) */
+    EIGEN_DEPRECATED Scalar& fillrand(Index i)
+    {
+      return insert(i);
+    }
+
+    /** \deprecated use finalize() */
+    EIGEN_DEPRECATED void endFill() {}
+    
+#   ifdef EIGEN_SPARSEVECTOR_PLUGIN
+#     include EIGEN_SPARSEVECTOR_PLUGIN
+#   endif
+
+protected:
+    template<typename OtherDerived>
+    EIGEN_DONT_INLINE SparseVector& assign(const SparseMatrixBase<OtherDerived>& _other)
+    {
+      const OtherDerived& other(_other.derived());
+      const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
+      if(needToTranspose)
+      {
+        Index size = other.size();
+        Index nnz = other.nonZeros();
+        resize(size);
+        reserve(nnz);
+        for(Index i=0; i<size; ++i)
+        {
+          typename OtherDerived::InnerIterator it(other, i);
+          if(it)
+              insert(i) = it.value();
+        }
+        return *this;
+      }
+      else
+      {
+        // there is no special optimization
+        return Base::operator=(other);
+      }
+    }
+};
+
+template<typename Scalar, int _Options, typename _Index>
+class SparseVector<Scalar,_Options,_Index>::InnerIterator
+{
+  public:
+    InnerIterator(const SparseVector& vec, Index outer=0)
+      : m_data(vec.m_data), m_id(0), m_end(static_cast<Index>(m_data.size()))
+    {
+      EIGEN_UNUSED_VARIABLE(outer);
+      eigen_assert(outer==0);
+    }
+
+    InnerIterator(const internal::CompressedStorage<Scalar,Index>& data)
+      : m_data(data), m_id(0), m_end(static_cast<Index>(m_data.size()))
+    {}
+
+    inline InnerIterator& operator++() { m_id++; return *this; }
+
+    inline Scalar value() const { return m_data.value(m_id); }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_data.value(m_id)); }
+
+    inline Index index() const { return m_data.index(m_id); }
+    inline Index row() const { return IsColVector ? index() : 0; }
+    inline Index col() const { return IsColVector ? 0 : index(); }
+
+    inline operator bool() const { return (m_id < m_end); }
+
+  protected:
+    const internal::CompressedStorage<Scalar,Index>& m_data;
+    Index m_id;
+    const Index m_end;
+};
+
+template<typename Scalar, int _Options, typename _Index>
+class SparseVector<Scalar,_Options,_Index>::ReverseInnerIterator
+{
+  public:
+    ReverseInnerIterator(const SparseVector& vec, Index outer=0)
+      : m_data(vec.m_data), m_id(static_cast<Index>(m_data.size())), m_start(0)
+    {
+      EIGEN_UNUSED_VARIABLE(outer);
+      eigen_assert(outer==0);
+    }
+
+    ReverseInnerIterator(const internal::CompressedStorage<Scalar,Index>& data)
+      : m_data(data), m_id(static_cast<Index>(m_data.size())), m_start(0)
+    {}
+
+    inline ReverseInnerIterator& operator--() { m_id--; return *this; }
+
+    inline Scalar value() const { return m_data.value(m_id-1); }
+    inline Scalar& valueRef() { return const_cast<Scalar&>(m_data.value(m_id-1)); }
+
+    inline Index index() const { return m_data.index(m_id-1); }
+    inline Index row() const { return IsColVector ? index() : 0; }
+    inline Index col() const { return IsColVector ? 0 : index(); }
+
+    inline operator bool() const { return (m_id > m_start); }
+
+  protected:
+    const internal::CompressedStorage<Scalar,Index>& m_data;
+    Index m_id;
+    const Index m_start;
+};
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSEVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseView.h b/extern/Eigen3/Eigen/src/SparseCore/SparseView.h
new file mode 100644
index 0000000..8b0b9ea
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/SparseView.h
@@ -0,0 +1,98 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+// Copyright (C) 2010 Daniel Lowengrub <lowdanie at gmail.com>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSEVIEW_H
+#define EIGEN_SPARSEVIEW_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename MatrixType>
+struct traits<SparseView<MatrixType> > : traits<MatrixType>
+{
+  typedef int Index;
+  typedef Sparse StorageKind;
+  enum {
+    Flags = int(traits<MatrixType>::Flags) & (RowMajorBit)
+  };
+};
+
+} // end namespace internal
+
+template<typename MatrixType>
+class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
+{
+  typedef typename MatrixType::Nested MatrixTypeNested;
+  typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
+public:
+  EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
+
+  SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0),
+             typename NumTraits<Scalar>::Real m_epsilon = NumTraits<Scalar>::dummy_precision()) : 
+    m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {}
+
+  class InnerIterator;
+
+  inline Index rows() const { return m_matrix.rows(); }
+  inline Index cols() const { return m_matrix.cols(); }
+
+  inline Index innerSize() const { return m_matrix.innerSize(); }
+  inline Index outerSize() const { return m_matrix.outerSize(); }
+
+protected:
+  MatrixTypeNested m_matrix;
+  Scalar m_reference;
+  typename NumTraits<Scalar>::Real m_epsilon;
+};
+
+template<typename MatrixType>
+class SparseView<MatrixType>::InnerIterator : public _MatrixTypeNested::InnerIterator
+{
+public:
+  typedef typename _MatrixTypeNested::InnerIterator IterBase;
+  InnerIterator(const SparseView& view, Index outer) :
+  IterBase(view.m_matrix, outer), m_view(view)
+  {
+    incrementToNonZero();
+  }
+
+  EIGEN_STRONG_INLINE InnerIterator& operator++()
+  {
+    IterBase::operator++();
+    incrementToNonZero();
+    return *this;
+  }
+
+  using IterBase::value;
+
+protected:
+  const SparseView& m_view;
+
+private:
+  void incrementToNonZero()
+  {
+    while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon))
+    {
+      IterBase::operator++();
+    }
+  }
+};
+
+template<typename Derived>
+const SparseView<Derived> MatrixBase<Derived>::sparseView(const Scalar& m_reference,
+                                                          typename NumTraits<Scalar>::Real m_epsilon) const
+{
+  return SparseView<Derived>(derived(), m_reference, m_epsilon);
+}
+
+} // end namespace Eigen
+
+#endif
diff --git a/extern/Eigen3/Eigen/src/SparseCore/TriangularSolver.h b/extern/Eigen3/Eigen/src/SparseCore/TriangularSolver.h
new file mode 100644
index 0000000..cb8ad82
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SparseCore/TriangularSolver.h
@@ -0,0 +1,334 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSETRIANGULARSOLVER_H
+#define EIGEN_SPARSETRIANGULARSOLVER_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, int Mode,
+  int UpLo = (Mode & Lower)
+           ? Lower
+           : (Mode & Upper)
+           ? Upper
+           : -1,
+  int StorageOrder = int(traits<Lhs>::Flags) & RowMajorBit>
+struct sparse_solve_triangular_selector;
+
+// forward substitution, row-major
+template<typename Lhs, typename Rhs, int Mode>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
+{
+  typedef typename Rhs::Scalar Scalar;
+  static void run(const Lhs& lhs, Rhs& other)
+  {
+    for(int col=0 ; col<other.cols() ; ++col)
+    {
+      for(int i=0; i<lhs.rows(); ++i)
+      {
+        Scalar tmp = other.coeff(i,col);
+        Scalar lastVal(0);
+        int lastIndex = 0;
+        for(typename Lhs::InnerIterator it(lhs, i); it; ++it)
+        {
+          lastVal = it.value();
+          lastIndex = it.index();
+          if(lastIndex==i)
+            break;
+          tmp -= lastVal * other.coeff(lastIndex,col);
+        }
+        if (Mode & UnitDiag)
+          other.coeffRef(i,col) = tmp;
+        else
+        {
+          eigen_assert(lastIndex==i);
+          other.coeffRef(i,col) = tmp/lastVal;
+        }
+      }
+    }
+  }
+};
+
+// backward substitution, row-major
+template<typename Lhs, typename Rhs, int Mode>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
+{
+  typedef typename Rhs::Scalar Scalar;
+  static void run(const Lhs& lhs, Rhs& other)
+  {
+    for(int col=0 ; col<other.cols() ; ++col)
+    {
+      for(int i=lhs.rows()-1 ; i>=0 ; --i)
+      {
+        Scalar tmp = other.coeff(i,col);
+        Scalar l_ii = 0;
+        typename Lhs::InnerIterator it(lhs, i);
+        while(it && it.index()<i)
+          ++it;
+        if(!(Mode & UnitDiag))
+        {
+          eigen_assert(it && it.index()==i);
+          l_ii = it.value();
+          ++it;
+        }
+        else if (it && it.index() == i)
+          ++it;
+        for(; it; ++it)
+        {
+          tmp -= it.value() * other.coeff(it.index(),col);
+        }
+
+        if (Mode & UnitDiag)
+          other.coeffRef(i,col) = tmp;
+        else
+          other.coeffRef(i,col) = tmp/l_ii;
+      }
+    }
+  }
+};
+
+// forward substitution, col-major
+template<typename Lhs, typename Rhs, int Mode>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
+{
+  typedef typename Rhs::Scalar Scalar;
+  static void run(const Lhs& lhs, Rhs& other)
+  {
+    for(int col=0 ; col<other.cols() ; ++col)
+    {
+      for(int i=0; i<lhs.cols(); ++i)
+      {
+        Scalar& tmp = other.coeffRef(i,col);
+        if (tmp!=Scalar(0)) // optimization when other is actually sparse
+        {
+          typename Lhs::InnerIterator it(lhs, i);
+          while(it && it.index()<i)
+            ++it;
+          if(!(Mode & UnitDiag))
+          {
+            eigen_assert(it && it.index()==i);
+            tmp /= it.value();
+          }
+          if (it && it.index()==i)
+            ++it;
+          for(; it; ++it)
+            other.coeffRef(it.index(), col) -= tmp * it.value();
+        }
+      }
+    }
+  }
+};
+
+// backward substitution, col-major
+template<typename Lhs, typename Rhs, int Mode>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor>
+{
+  typedef typename Rhs::Scalar Scalar;
+  static void run(const Lhs& lhs, Rhs& other)
+  {
+    for(int col=0 ; col<other.cols() ; ++col)
+    {
+      for(int i=lhs.cols()-1; i>=0; --i)
+      {
+        Scalar& tmp = other.coeffRef(i,col);
+        if (tmp!=Scalar(0)) // optimization when other is actually sparse
+        {
+          if(!(Mode & UnitDiag))
+          {
+            // TODO replace this by a binary search. make sure the binary search is safe for partially sorted elements
+            typename Lhs::ReverseInnerIterator it(lhs, i);
+            while(it && it.index()!=i)
+              --it;
+            eigen_assert(it && it.index()==i);
+            other.coeffRef(i,col) /= it.value();
+          }
+          typename Lhs::InnerIterator it(lhs, i);
+          for(; it && it.index()<i; ++it)
+            other.coeffRef(it.index(), col) -= tmp * it.value();
+        }
+      }
+    }
+  }
+};
+
+} // end namespace internal
+
+template<typename ExpressionType,int Mode>
+template<typename OtherDerived>
+void SparseTriangularView<ExpressionType,Mode>::solveInPlace(MatrixBase<OtherDerived>& other) const
+{
+  eigen_assert(m_matrix.cols() == m_matrix.rows() && m_matrix.cols() == other.rows());
+  eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
+
+  enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
+
+  typedef typename internal::conditional<copy,
+    typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
+  OtherCopy otherCopy(other.derived());
+
+  internal::sparse_solve_triangular_selector<ExpressionType, typename internal::remove_reference<OtherCopy>::type, Mode>::run(m_matrix, otherCopy);
+
+  if (copy)
+    other = otherCopy;
+}
+
+template<typename ExpressionType,int Mode>
+template<typename OtherDerived>
+typename internal::plain_matrix_type_column_major<OtherDerived>::type
+SparseTriangularView<ExpressionType,Mode>::solve(const MatrixBase<OtherDerived>& other) const
+{
+  typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
+  solveInPlace(res);
+  return res;
+}
+
+// pure sparse path
+
+namespace internal {
+
+template<typename Lhs, typename Rhs, int Mode,
+  int UpLo = (Mode & Lower)
+           ? Lower
+           : (Mode & Upper)
+           ? Upper
+           : -1,
+  int StorageOrder = int(Lhs::Flags) & (RowMajorBit)>
+struct sparse_solve_triangular_sparse_selector;
+
+// forward substitution, col-major
+template<typename Lhs, typename Rhs, int Mode, int UpLo>
+struct sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
+{
+  typedef typename Rhs::Scalar Scalar;
+  typedef typename promote_index_type<typename traits<Lhs>::Index,
+                                         typename traits<Rhs>::Index>::type Index;
+  static void run(const Lhs& lhs, Rhs& other)
+  {
+    const bool IsLower = (UpLo==Lower);
+    AmbiVector<Scalar,Index> tempVector(other.rows()*2);
+    tempVector.setBounds(0,other.rows());
+
+    Rhs res(other.rows(), other.cols());
+    res.reserve(other.nonZeros());
+
+    for(int col=0 ; col<other.cols() ; ++col)
+    {
+      // FIXME estimate number of non zeros
+      tempVector.init(.99/*float(other.col(col).nonZeros())/float(other.rows())*/);
+      tempVector.setZero();
+      tempVector.restart();
+      for (typename Rhs::InnerIterator rhsIt(other, col); rhsIt; ++rhsIt)
+      {
+        tempVector.coeffRef(rhsIt.index()) = rhsIt.value();
+      }
+
+      for(int i=IsLower?0:lhs.cols()-1;
+          IsLower?i<lhs.cols():i>=0;
+          i+=IsLower?1:-1)
+      {
+        tempVector.restart();
+        Scalar& ci = tempVector.coeffRef(i);
+        if (ci!=Scalar(0))
+        {
+          // find
+          typename Lhs::InnerIterator it(lhs, i);
+          if(!(Mode & UnitDiag))
+          {
+            if (IsLower)
+            {
+              eigen_assert(it.index()==i);
+              ci /= it.value();
+            }
+            else
+              ci /= lhs.coeff(i,i);
+          }
+          tempVector.restart();
+          if (IsLower)
+          {
+            if (it.index()==i)
+              ++it;
+            for(; it; ++it)
+              tempVector.coeffRef(it.index()) -= ci * it.value();
+          }
+          else
+          {
+            for(; it && it.index()<i; ++it)
+              tempVector.coeffRef(it.index()) -= ci * it.value();
+          }
+        }
+      }
+
+
+      int count = 0;
+      // FIXME compute a reference value to filter zeros
+      for (typename AmbiVector<Scalar,Index>::Iterator it(tempVector/*,1e-12*/); it; ++it)
+      {
+        ++ count;
+//         std::cerr << "fill " << it.index() << ", " << col << "\n";
+//         std::cout << it.value() << "  ";
+        // FIXME use insertBack
+        res.insert(it.index(), col) = it.value();
+      }
+//       std::cout << "tempVector.nonZeros() == " << int(count) << " / " << (other.rows()) << "\n";
+    }
+    res.finalize();
+    other = res.markAsRValue();
+  }
+};
+
+} // end namespace internal
+
+template<typename ExpressionType,int Mode>
+template<typename OtherDerived>
+void SparseTriangularView<ExpressionType,Mode>::solveInPlace(SparseMatrixBase<OtherDerived>& other) const
+{
+  eigen_assert(m_matrix.cols() == m_matrix.rows() && m_matrix.cols() == other.rows());
+  eigen_assert( (!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
+
+//   enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
+
+//   typedef typename internal::conditional<copy,
+//     typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
+//   OtherCopy otherCopy(other.derived());
+
+  internal::sparse_solve_triangular_sparse_selector<ExpressionType, OtherDerived, Mode>::run(m_matrix, other.derived());
+
+//   if (copy)
+//     other = otherCopy;
+}
+
+#ifdef EIGEN2_SUPPORT
+
+// deprecated stuff:
+
+/** \deprecated */
+template<typename Derived>
+template<typename OtherDerived>
+void SparseMatrixBase<Derived>::solveTriangularInPlace(MatrixBase<OtherDerived>& other) const
+{
+  this->template triangular<Flags&(Upper|Lower)>().solveInPlace(other);
+}
+
+/** \deprecated */
+template<typename Derived>
+template<typename OtherDerived>
+typename internal::plain_matrix_type_column_major<OtherDerived>::type
+SparseMatrixBase<Derived>::solveTriangular(const MatrixBase<OtherDerived>& other) const
+{
+  typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
+  derived().solveTriangularInPlace(res);
+  return res;
+}
+#endif // EIGEN2_SUPPORT
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSETRIANGULARSOLVER_H
diff --git a/extern/Eigen3/Eigen/src/StlSupport/StdDeque.h b/extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
index 6f12c10..4ee8e5c 100644
--- a/extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
+++ b/extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDDEQUE_H
 #define EIGEN_STDDEQUE_H
diff --git a/extern/Eigen3/Eigen/src/StlSupport/StdList.h b/extern/Eigen3/Eigen/src/StlSupport/StdList.h
index d329a0b..627381e 100644
--- a/extern/Eigen3/Eigen/src/StlSupport/StdList.h
+++ b/extern/Eigen3/Eigen/src/StlSupport/StdList.h
@@ -3,24 +3,9 @@
 //
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDLIST_H
 #define EIGEN_STDLIST_H
diff --git a/extern/Eigen3/Eigen/src/StlSupport/StdVector.h b/extern/Eigen3/Eigen/src/StlSupport/StdVector.h
index 27d6ab5..40a9abe 100644
--- a/extern/Eigen3/Eigen/src/StlSupport/StdVector.h
+++ b/extern/Eigen3/Eigen/src/StlSupport/StdVector.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STDVECTOR_H
 #define EIGEN_STDVECTOR_H
diff --git a/extern/Eigen3/Eigen/src/StlSupport/details.h b/extern/Eigen3/Eigen/src/StlSupport/details.h
index 397c8ef..d8debc7 100644
--- a/extern/Eigen3/Eigen/src/StlSupport/details.h
+++ b/extern/Eigen3/Eigen/src/StlSupport/details.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2009 Hauke Heibel <hauke.heibel at googlemail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_STL_DETAILS_H
 #define EIGEN_STL_DETAILS_H
diff --git a/extern/Eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h b/extern/Eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h
new file mode 100644
index 0000000..11fb014
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h
@@ -0,0 +1,1025 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SUPERLUSUPPORT_H
+#define EIGEN_SUPERLUSUPPORT_H
+
+namespace Eigen { 
+
+#define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE)		\
+    extern "C" {                                                                                          \
+      typedef struct { FLOATTYPE for_lu; FLOATTYPE total_needed; int expansions; } PREFIX##mem_usage_t;   \
+      extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,                  \
+                                char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *,           \
+                                void *, int, SuperMatrix *, SuperMatrix *,                                \
+                                FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *,                       \
+                                PREFIX##mem_usage_t *, SuperLUStat_t *, int *);                           \
+    }                                                                                                     \
+    inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A,                                \
+         int *perm_c, int *perm_r, int *etree, char *equed,                                               \
+         FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L,                                                      \
+         SuperMatrix *U, void *work, int lwork,                                                           \
+         SuperMatrix *B, SuperMatrix *X,                                                                  \
+         FLOATTYPE *recip_pivot_growth,                                                                   \
+         FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr,                                              \
+         SuperLUStat_t *stats, int *info, KEYTYPE) {                                                      \
+    PREFIX##mem_usage_t mem_usage;                                                                        \
+    PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L,                                      \
+         U, work, lwork, B, X, recip_pivot_growth, rcond,                                                 \
+         ferr, berr, &mem_usage, stats, info);                                                            \
+    return mem_usage.for_lu; /* bytes used by the factor storage */                                       \
+  }
+
+DECL_GSSVX(s,float,float)
+DECL_GSSVX(c,float,std::complex<float>)
+DECL_GSSVX(d,double,double)
+DECL_GSSVX(z,double,std::complex<double>)
+
+#ifdef MILU_ALPHA
+#define EIGEN_SUPERLU_HAS_ILU
+#endif
+
+#ifdef EIGEN_SUPERLU_HAS_ILU
+
+// similarly for the incomplete factorization using gsisx
+#define DECL_GSISX(PREFIX,FLOATTYPE,KEYTYPE)                                                    \
+    extern "C" {                                                                                \
+      extern void PREFIX##gsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *,        \
+                         char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *,        \
+                         void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, FLOATTYPE *,   \
+                         PREFIX##mem_usage_t *, SuperLUStat_t *, int *);                        \
+    }                                                                                           \
+    inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A,                      \
+         int *perm_c, int *perm_r, int *etree, char *equed,                                     \
+         FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L,                                            \
+         SuperMatrix *U, void *work, int lwork,                                                 \
+         SuperMatrix *B, SuperMatrix *X,                                                        \
+         FLOATTYPE *recip_pivot_growth,                                                         \
+         FLOATTYPE *rcond,                                                                      \
+         SuperLUStat_t *stats, int *info, KEYTYPE) {                                            \
+    PREFIX##mem_usage_t mem_usage;                                                              \
+    PREFIX##gsisx(options, A, perm_c, perm_r, etree, equed, R, C, L,                            \
+         U, work, lwork, B, X, recip_pivot_growth, rcond,                                       \
+         &mem_usage, stats, info);                                                              \
+    return mem_usage.for_lu; /* bytes used by the factor storage */                             \
+  }
+
+DECL_GSISX(s,float,float)
+DECL_GSISX(c,float,std::complex<float>)
+DECL_GSISX(d,double,double)
+DECL_GSISX(z,double,std::complex<double>)
+
+#endif
+
+template<typename MatrixType>
+struct SluMatrixMapHelper;
+
+/** \internal
+  *
+  * A wrapper class for SuperLU matrices. It supports only compressed sparse matrices
+  * and dense matrices. Supernodal and other fancy format are not supported by this wrapper.
+  *
+  * This wrapper class mainly aims to avoids the need of dynamic allocation of the storage structure.
+  */
+struct SluMatrix : SuperMatrix
+{
+  SluMatrix()
+  {
+    Store = &storage;
+  }
+
+  SluMatrix(const SluMatrix& other)
+    : SuperMatrix(other)
+  {
+    Store = &storage;
+    storage = other.storage;
+  }
+
+  SluMatrix& operator=(const SluMatrix& other)
+  {
+    SuperMatrix::operator=(static_cast<const SuperMatrix&>(other));
+    Store = &storage;
+    storage = other.storage;
+    return *this;
+  }
+
+  struct
+  {
+    union {int nnz;int lda;};
+    void *values;
+    int *innerInd;
+    int *outerInd;
+  } storage;
+
+  void setStorageType(Stype_t t)
+  {
+    Stype = t;
+    if (t==SLU_NC || t==SLU_NR || t==SLU_DN)
+      Store = &storage;
+    else
+    {
+      eigen_assert(false && "storage type not supported");
+      Store = 0;
+    }
+  }
+
+  template<typename Scalar>
+  void setScalarType()
+  {
+    if (internal::is_same<Scalar,float>::value)
+      Dtype = SLU_S;
+    else if (internal::is_same<Scalar,double>::value)
+      Dtype = SLU_D;
+    else if (internal::is_same<Scalar,std::complex<float> >::value)
+      Dtype = SLU_C;
+    else if (internal::is_same<Scalar,std::complex<double> >::value)
+      Dtype = SLU_Z;
+    else
+    {
+      eigen_assert(false && "Scalar type not supported by SuperLU");
+    }
+  }
+
+  template<typename MatrixType>
+  static SluMatrix Map(MatrixBase<MatrixType>& _mat)
+  {
+    MatrixType& mat(_mat.derived());
+    eigen_assert( ((MatrixType::Flags&RowMajorBit)!=RowMajorBit) && "row-major dense matrices are not supported by SuperLU");
+    SluMatrix res;
+    res.setStorageType(SLU_DN);
+    res.setScalarType<typename MatrixType::Scalar>();
+    res.Mtype     = SLU_GE;
+
+    res.nrow      = mat.rows();
+    res.ncol      = mat.cols();
+
+    res.storage.lda       = MatrixType::IsVectorAtCompileTime ? mat.size() : mat.outerStride();
+    res.storage.values    = mat.data();
+    return res;
+  }
+
+  template<typename MatrixType>
+  static SluMatrix Map(SparseMatrixBase<MatrixType>& mat)
+  {
+    SluMatrix res;
+    if ((MatrixType::Flags&RowMajorBit)==RowMajorBit)
+    {
+      res.setStorageType(SLU_NR);
+      res.nrow      = mat.cols();
+      res.ncol      = mat.rows();
+    }
+    else
+    {
+      res.setStorageType(SLU_NC);
+      res.nrow      = mat.rows();
+      res.ncol      = mat.cols();
+    }
+
+    res.Mtype       = SLU_GE;
+
+    res.storage.nnz       = mat.nonZeros();
+    res.storage.values    = mat.derived().valuePtr();
+    res.storage.innerInd  = mat.derived().innerIndexPtr();
+    res.storage.outerInd  = mat.derived().outerIndexPtr();
+
+    res.setScalarType<typename MatrixType::Scalar>();
+
+    // FIXME the following is not very accurate
+    if (MatrixType::Flags & Upper)
+      res.Mtype = SLU_TRU;
+    if (MatrixType::Flags & Lower)
+      res.Mtype = SLU_TRL;
+
+    eigen_assert(((MatrixType::Flags & SelfAdjoint)==0) && "SelfAdjoint matrix shape not supported by SuperLU");
+
+    return res;
+  }
+};
+
+template<typename Scalar, int Rows, int Cols, int Options, int MRows, int MCols>
+struct SluMatrixMapHelper<Matrix<Scalar,Rows,Cols,Options,MRows,MCols> >
+{
+  typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
+  static void run(MatrixType& mat, SluMatrix& res)
+  {
+    eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
+    res.setStorageType(SLU_DN);
+    res.setScalarType<Scalar>();
+    res.Mtype     = SLU_GE;
+
+    res.nrow      = mat.rows();
+    res.ncol      = mat.cols();
+
+    res.storage.lda       = mat.outerStride();
+    res.storage.values    = mat.data();
+  }
+};
+
+template<typename Derived>
+struct SluMatrixMapHelper<SparseMatrixBase<Derived> >
+{
+  typedef Derived MatrixType;
+  static void run(MatrixType& mat, SluMatrix& res)
+  {
+    if ((MatrixType::Flags&RowMajorBit)==RowMajorBit)
+    {
+      res.setStorageType(SLU_NR);
+      res.nrow      = mat.cols();
+      res.ncol      = mat.rows();
+    }
+    else
+    {
+      res.setStorageType(SLU_NC);
+      res.nrow      = mat.rows();
+      res.ncol      = mat.cols();
+    }
+
+    res.Mtype       = SLU_GE;
+
+    res.storage.nnz       = mat.nonZeros();
+    res.storage.values    = mat.valuePtr();
+    res.storage.innerInd  = mat.innerIndexPtr();
+    res.storage.outerInd  = mat.outerIndexPtr();
+
+    res.setScalarType<typename MatrixType::Scalar>();
+
+    // FIXME the following is not very accurate
+    if (MatrixType::Flags & Upper)
+      res.Mtype = SLU_TRU;
+    if (MatrixType::Flags & Lower)
+      res.Mtype = SLU_TRL;
+
+    eigen_assert(((MatrixType::Flags & SelfAdjoint)==0) && "SelfAdjoint matrix shape not supported by SuperLU");
+  }
+};
+
+namespace internal {
+
+template<typename MatrixType>
+SluMatrix asSluMatrix(MatrixType& mat)
+{
+  return SluMatrix::Map(mat);
+}
+
+/** View a Super LU matrix as an Eigen expression */
+template<typename Scalar, int Flags, typename Index>
+MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat)
+{
+  eigen_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
+         || (Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC);
+
+  Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow;
+
+  return MappedSparseMatrix<Scalar,Flags,Index>(
+    sluMat.nrow, sluMat.ncol, sluMat.storage.outerInd[outerSize],
+    sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast<Scalar*>(sluMat.storage.values) );
+}
+
+} // end namespace internal
+
+/** \ingroup SuperLUSupport_Module
+  * \class SuperLUBase
+  * \brief The base class for the direct and incomplete LU factorization of SuperLU
+  */
+template<typename _MatrixType, typename Derived>
+class SuperLUBase : internal::noncopyable
+{
+  public:
+    typedef _MatrixType MatrixType;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef Matrix<Scalar,Dynamic,1> Vector;
+    typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
+    typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;    
+    typedef SparseMatrix<Scalar> LUMatrixType;
+
+  public:
+
+    SuperLUBase() {}
+
+    ~SuperLUBase()
+    {
+      clearFactors();
+    }
+    
+    Derived& derived() { return *static_cast<Derived*>(this); }
+    const Derived& derived() const { return *static_cast<const Derived*>(this); }
+    
+    inline Index rows() const { return m_matrix.rows(); }
+    inline Index cols() const { return m_matrix.cols(); }
+    
+    /** \returns a reference to the Super LU option object to configure the  Super LU algorithms. */
+    inline superlu_options_t& options() { return m_sluOptions; }
+    
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+
+    /** Computes the sparse Cholesky decomposition of \a matrix */
+    void compute(const MatrixType& matrix)
+    {
+      derived().analyzePattern(matrix);
+      derived().factorize(matrix);
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<SuperLUBase, Rhs> solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "SuperLU is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "SuperLU::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<SuperLUBase, Rhs>(*this, b.derived());
+    }
+    
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+//     template<typename Rhs>
+//     inline const internal::sparse_solve_retval<SuperLU, Rhs> solve(const SparseMatrixBase<Rhs>& b) const
+//     {
+//       eigen_assert(m_isInitialized && "SuperLU is not initialized.");
+//       eigen_assert(rows()==b.rows()
+//                 && "SuperLU::solve(): invalid number of rows of the right hand side matrix b");
+//       return internal::sparse_solve_retval<SuperLU, Rhs>(*this, b.derived());
+//     }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      * 
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& /*matrix*/)
+    {
+      m_isInitialized = true;
+      m_info = Success;
+      m_analysisIsOk = true;
+      m_factorizationIsOk = false;
+    }
+    
+    template<typename Stream>
+    void dumpMemory(Stream& s)
+    {}
+    
+  protected:
+    
+    void initFactorization(const MatrixType& a)
+    {
+      set_default_options(&this->m_sluOptions);
+      
+      const int size = a.rows();
+      m_matrix = a;
+
+      m_sluA = internal::asSluMatrix(m_matrix);
+      clearFactors();
+
+      m_p.resize(size);
+      m_q.resize(size);
+      m_sluRscale.resize(size);
+      m_sluCscale.resize(size);
+      m_sluEtree.resize(size);
+
+      // set empty B and X
+      m_sluB.setStorageType(SLU_DN);
+      m_sluB.setScalarType<Scalar>();
+      m_sluB.Mtype          = SLU_GE;
+      m_sluB.storage.values = 0;
+      m_sluB.nrow           = 0;
+      m_sluB.ncol           = 0;
+      m_sluB.storage.lda    = size;
+      m_sluX                = m_sluB;
+      
+      m_extractedDataAreDirty = true;
+    }
+    
+    void init()
+    {
+      m_info = InvalidInput;
+      m_isInitialized = false;
+      m_sluL.Store = 0;
+      m_sluU.Store = 0;
+    }
+    
+    void extractData() const;
+
+    void clearFactors()
+    {
+      if(m_sluL.Store)
+        Destroy_SuperNode_Matrix(&m_sluL);
+      if(m_sluU.Store)
+        Destroy_CompCol_Matrix(&m_sluU);
+
+      m_sluL.Store = 0;
+      m_sluU.Store = 0;
+
+      memset(&m_sluL,0,sizeof m_sluL);
+      memset(&m_sluU,0,sizeof m_sluU);
+    }
+
+    // cached data to reduce reallocation, etc.
+    mutable LUMatrixType m_l;
+    mutable LUMatrixType m_u;
+    mutable IntColVectorType m_p;
+    mutable IntRowVectorType m_q;
+
+    mutable LUMatrixType m_matrix;  // copy of the factorized matrix
+    mutable SluMatrix m_sluA;
+    mutable SuperMatrix m_sluL, m_sluU;
+    mutable SluMatrix m_sluB, m_sluX;
+    mutable SuperLUStat_t m_sluStat;
+    mutable superlu_options_t m_sluOptions;
+    mutable std::vector<int> m_sluEtree;
+    mutable Matrix<RealScalar,Dynamic,1> m_sluRscale, m_sluCscale;
+    mutable Matrix<RealScalar,Dynamic,1> m_sluFerr, m_sluBerr;
+    mutable char m_sluEqued;
+
+    mutable ComputationInfo m_info;
+    bool m_isInitialized;
+    int m_factorizationIsOk;
+    int m_analysisIsOk;
+    mutable bool m_extractedDataAreDirty;
+    
+  private:
+    SuperLUBase(SuperLUBase& ) { }
+};
+
+
+/** \ingroup SuperLUSupport_Module
+  * \class SuperLU
+  * \brief A sparse direct LU factorization and solver based on the SuperLU library
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization
+  * using the SuperLU library. The sparse matrix A must be squared and invertible. The vectors or matrices
+  * X and B can be either dense or sparse.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType>
+class SuperLU : public SuperLUBase<_MatrixType,SuperLU<_MatrixType> >
+{
+  public:
+    typedef SuperLUBase<_MatrixType,SuperLU> Base;
+    typedef _MatrixType MatrixType;
+    typedef typename Base::Scalar Scalar;
+    typedef typename Base::RealScalar RealScalar;
+    typedef typename Base::Index Index;
+    typedef typename Base::IntRowVectorType IntRowVectorType;
+    typedef typename Base::IntColVectorType IntColVectorType;    
+    typedef typename Base::LUMatrixType LUMatrixType;
+    typedef TriangularView<LUMatrixType, Lower|UnitDiag>  LMatrixType;
+    typedef TriangularView<LUMatrixType,  Upper>           UMatrixType;
+
+  public:
+
+    SuperLU() : Base() { init(); }
+
+    SuperLU(const MatrixType& matrix) : Base()
+    {
+      Base::init();
+      compute(matrix);
+    }
+
+    ~SuperLU()
+    {
+    }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      * 
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      m_info = InvalidInput;
+      m_isInitialized = false;
+      Base::analyzePattern(matrix);
+    }
+    
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& matrix);
+    
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** \internal */
+    template<typename Rhs,typename Dest>
+    void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
+    #endif // EIGEN_PARSED_BY_DOXYGEN
+    
+    inline const LMatrixType& matrixL() const
+    {
+      if (m_extractedDataAreDirty) this->extractData();
+      return m_l;
+    }
+
+    inline const UMatrixType& matrixU() const
+    {
+      if (m_extractedDataAreDirty) this->extractData();
+      return m_u;
+    }
+
+    inline const IntColVectorType& permutationP() const
+    {
+      if (m_extractedDataAreDirty) this->extractData();
+      return m_p;
+    }
+
+    inline const IntRowVectorType& permutationQ() const
+    {
+      if (m_extractedDataAreDirty) this->extractData();
+      return m_q;
+    }
+    
+    Scalar determinant() const;
+    
+  protected:
+    
+    using Base::m_matrix;
+    using Base::m_sluOptions;
+    using Base::m_sluA;
+    using Base::m_sluB;
+    using Base::m_sluX;
+    using Base::m_p;
+    using Base::m_q;
+    using Base::m_sluEtree;
+    using Base::m_sluEqued;
+    using Base::m_sluRscale;
+    using Base::m_sluCscale;
+    using Base::m_sluL;
+    using Base::m_sluU;
+    using Base::m_sluStat;
+    using Base::m_sluFerr;
+    using Base::m_sluBerr;
+    using Base::m_l;
+    using Base::m_u;
+    
+    using Base::m_analysisIsOk;
+    using Base::m_factorizationIsOk;
+    using Base::m_extractedDataAreDirty;
+    using Base::m_isInitialized;
+    using Base::m_info;
+    
+    void init()
+    {
+      Base::init();
+      
+      set_default_options(&this->m_sluOptions);
+      m_sluOptions.PrintStat        = NO;
+      m_sluOptions.ConditionNumber  = NO;
+      m_sluOptions.Trans            = NOTRANS;
+      m_sluOptions.ColPerm          = COLAMD;
+    }
+    
+    
+  private:
+    SuperLU(SuperLU& ) { }
+};
+
+template<typename MatrixType>
+void SuperLU<MatrixType>::factorize(const MatrixType& a)
+{
+  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+  if(!m_analysisIsOk)
+  {
+    m_info = InvalidInput;
+    return;
+  }
+  
+  this->initFactorization(a);
+  
+  int info = 0;
+  RealScalar recip_pivot_growth, rcond;
+  RealScalar ferr, berr;
+
+  StatInit(&m_sluStat);
+  SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
+                &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
+                &m_sluL, &m_sluU,
+                NULL, 0,
+                &m_sluB, &m_sluX,
+                &recip_pivot_growth, &rcond,
+                &ferr, &berr,
+                &m_sluStat, &info, Scalar());
+  StatFree(&m_sluStat);
+
+  m_extractedDataAreDirty = true;
+
+  // FIXME how to better check for errors ???
+  m_info = info == 0 ? Success : NumericalIssue;
+  m_factorizationIsOk = true;
+}
+
+template<typename MatrixType>
+template<typename Rhs,typename Dest>
+void SuperLU<MatrixType>::_solve(const MatrixBase<Rhs> &b, MatrixBase<Dest>& x) const
+{
+  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()");
+
+  const int size = m_matrix.rows();
+  const int rhsCols = b.cols();
+  eigen_assert(size==b.rows());
+
+  m_sluOptions.Trans = NOTRANS;
+  m_sluOptions.Fact = FACTORED;
+  m_sluOptions.IterRefine = NOREFINE;
+  
+
+  m_sluFerr.resize(rhsCols);
+  m_sluBerr.resize(rhsCols);
+  m_sluB = SluMatrix::Map(b.const_cast_derived());
+  m_sluX = SluMatrix::Map(x.derived());
+  
+  typename Rhs::PlainObject b_cpy;
+  if(m_sluEqued!='N')
+  {
+    b_cpy = b;
+    m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());  
+  }
+
+  StatInit(&m_sluStat);
+  int info = 0;
+  RealScalar recip_pivot_growth, rcond;
+  SuperLU_gssvx(&m_sluOptions, &m_sluA,
+                m_q.data(), m_p.data(),
+                &m_sluEtree[0], &m_sluEqued,
+                &m_sluRscale[0], &m_sluCscale[0],
+                &m_sluL, &m_sluU,
+                NULL, 0,
+                &m_sluB, &m_sluX,
+                &recip_pivot_growth, &rcond,
+                &m_sluFerr[0], &m_sluBerr[0],
+                &m_sluStat, &info, Scalar());
+  StatFree(&m_sluStat);
+  m_info = info==0 ? Success : NumericalIssue;
+}
+
+// the code of this extractData() function has been adapted from the SuperLU's Matlab support code,
+//
+//  Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
+//
+//  THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
+//  EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+//
+template<typename MatrixType, typename Derived>
+void SuperLUBase<MatrixType,Derived>::extractData() const
+{
+  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for extracting factors, you must first call either compute() or analyzePattern()/factorize()");
+  if (m_extractedDataAreDirty)
+  {
+    int         upper;
+    int         fsupc, istart, nsupr;
+    int         lastl = 0, lastu = 0;
+    SCformat    *Lstore = static_cast<SCformat*>(m_sluL.Store);
+    NCformat    *Ustore = static_cast<NCformat*>(m_sluU.Store);
+    Scalar      *SNptr;
+
+    const int size = m_matrix.rows();
+    m_l.resize(size,size);
+    m_l.resizeNonZeros(Lstore->nnz);
+    m_u.resize(size,size);
+    m_u.resizeNonZeros(Ustore->nnz);
+
+    int* Lcol = m_l.outerIndexPtr();
+    int* Lrow = m_l.innerIndexPtr();
+    Scalar* Lval = m_l.valuePtr();
+
+    int* Ucol = m_u.outerIndexPtr();
+    int* Urow = m_u.innerIndexPtr();
+    Scalar* Uval = m_u.valuePtr();
+
+    Ucol[0] = 0;
+    Ucol[0] = 0;
+
+    /* for each supernode */
+    for (int k = 0; k <= Lstore->nsuper; ++k)
+    {
+      fsupc   = L_FST_SUPC(k);
+      istart  = L_SUB_START(fsupc);
+      nsupr   = L_SUB_START(fsupc+1) - istart;
+      upper   = 1;
+
+      /* for each column in the supernode */
+      for (int j = fsupc; j < L_FST_SUPC(k+1); ++j)
+      {
+        SNptr = &((Scalar*)Lstore->nzval)[L_NZ_START(j)];
+
+        /* Extract U */
+        for (int i = U_NZ_START(j); i < U_NZ_START(j+1); ++i)
+        {
+          Uval[lastu] = ((Scalar*)Ustore->nzval)[i];
+          /* Matlab doesn't like explicit zero. */
+          if (Uval[lastu] != 0.0)
+            Urow[lastu++] = U_SUB(i);
+        }
+        for (int i = 0; i < upper; ++i)
+        {
+          /* upper triangle in the supernode */
+          Uval[lastu] = SNptr[i];
+          /* Matlab doesn't like explicit zero. */
+          if (Uval[lastu] != 0.0)
+            Urow[lastu++] = L_SUB(istart+i);
+        }
+        Ucol[j+1] = lastu;
+
+        /* Extract L */
+        Lval[lastl] = 1.0; /* unit diagonal */
+        Lrow[lastl++] = L_SUB(istart + upper - 1);
+        for (int i = upper; i < nsupr; ++i)
+        {
+          Lval[lastl] = SNptr[i];
+          /* Matlab doesn't like explicit zero. */
+          if (Lval[lastl] != 0.0)
+            Lrow[lastl++] = L_SUB(istart+i);
+        }
+        Lcol[j+1] = lastl;
+
+        ++upper;
+      } /* for j ... */
+
+    } /* for k ... */
+
+    // squeeze the matrices :
+    m_l.resizeNonZeros(lastl);
+    m_u.resizeNonZeros(lastu);
+
+    m_extractedDataAreDirty = false;
+  }
+}
+
+template<typename MatrixType>
+typename SuperLU<MatrixType>::Scalar SuperLU<MatrixType>::determinant() const
+{
+  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for computing the determinant, you must first call either compute() or analyzePattern()/factorize()");
+  
+  if (m_extractedDataAreDirty)
+    this->extractData();
+
+  Scalar det = Scalar(1);
+  for (int j=0; j<m_u.cols(); ++j)
+  {
+    if (m_u.outerIndexPtr()[j+1]-m_u.outerIndexPtr()[j] > 0)
+    {
+      int lastId = m_u.outerIndexPtr()[j+1]-1;
+      eigen_assert(m_u.innerIndexPtr()[lastId]<=j);
+      if (m_u.innerIndexPtr()[lastId]==j)
+        det *= m_u.valuePtr()[lastId];
+    }
+  }
+  if(m_sluEqued!='N')
+    return det/m_sluRscale.prod()/m_sluCscale.prod();
+  else
+    return det;
+}
+
+#ifdef EIGEN_PARSED_BY_DOXYGEN
+#define EIGEN_SUPERLU_HAS_ILU
+#endif
+
+#ifdef EIGEN_SUPERLU_HAS_ILU
+
+/** \ingroup SuperLUSupport_Module
+  * \class SuperILU
+  * \brief A sparse direct \b incomplete LU factorization and solver based on the SuperLU library
+  *
+  * This class allows to solve for an approximate solution of A.X = B sparse linear problems via an incomplete LU factorization
+  * using the SuperLU library. This class is aimed to be used as a preconditioner of the iterative linear solvers.
+  *
+  * \warning This class requires SuperLU 4 or later.
+  *
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  *
+  * \sa \ref TutorialSparseDirectSolvers, class ConjugateGradient, class BiCGSTAB
+  */
+
+template<typename _MatrixType>
+class SuperILU : public SuperLUBase<_MatrixType,SuperILU<_MatrixType> >
+{
+  public:
+    typedef SuperLUBase<_MatrixType,SuperILU> Base;
+    typedef _MatrixType MatrixType;
+    typedef typename Base::Scalar Scalar;
+    typedef typename Base::RealScalar RealScalar;
+    typedef typename Base::Index Index;
+
+  public:
+
+    SuperILU() : Base() { init(); }
+
+    SuperILU(const MatrixType& matrix) : Base()
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~SuperILU()
+    {
+    }
+    
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      * 
+      * \sa factorize()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      Base::analyzePattern(matrix);
+    }
+    
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+      *
+      * \sa analyzePattern()
+      */
+    void factorize(const MatrixType& matrix);
+    
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** \internal */
+    template<typename Rhs,typename Dest>
+    void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
+    #endif // EIGEN_PARSED_BY_DOXYGEN
+    
+  protected:
+    
+    using Base::m_matrix;
+    using Base::m_sluOptions;
+    using Base::m_sluA;
+    using Base::m_sluB;
+    using Base::m_sluX;
+    using Base::m_p;
+    using Base::m_q;
+    using Base::m_sluEtree;
+    using Base::m_sluEqued;
+    using Base::m_sluRscale;
+    using Base::m_sluCscale;
+    using Base::m_sluL;
+    using Base::m_sluU;
+    using Base::m_sluStat;
+    using Base::m_sluFerr;
+    using Base::m_sluBerr;
+    using Base::m_l;
+    using Base::m_u;
+    
+    using Base::m_analysisIsOk;
+    using Base::m_factorizationIsOk;
+    using Base::m_extractedDataAreDirty;
+    using Base::m_isInitialized;
+    using Base::m_info;
+
+    void init()
+    {
+      Base::init();
+      
+      ilu_set_default_options(&m_sluOptions);
+      m_sluOptions.PrintStat        = NO;
+      m_sluOptions.ConditionNumber  = NO;
+      m_sluOptions.Trans            = NOTRANS;
+      m_sluOptions.ColPerm          = MMD_AT_PLUS_A;
+      
+      // no attempt to preserve column sum
+      m_sluOptions.ILU_MILU = SILU;
+      // only basic ILU(k) support -- no direct control over memory consumption
+      // better to use ILU_DropRule = DROP_BASIC | DROP_AREA
+      // and set ILU_FillFactor to max memory growth
+      m_sluOptions.ILU_DropRule = DROP_BASIC;
+      m_sluOptions.ILU_DropTol = NumTraits<Scalar>::dummy_precision()*10;
+    }
+    
+  private:
+    SuperILU(SuperILU& ) { }
+};
+
+template<typename MatrixType>
+void SuperILU<MatrixType>::factorize(const MatrixType& a)
+{
+  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+  if(!m_analysisIsOk)
+  {
+    m_info = InvalidInput;
+    return;
+  }
+  
+  this->initFactorization(a);
+
+  int info = 0;
+  RealScalar recip_pivot_growth, rcond;
+
+  StatInit(&m_sluStat);
+  SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
+                &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
+                &m_sluL, &m_sluU,
+                NULL, 0,
+                &m_sluB, &m_sluX,
+                &recip_pivot_growth, &rcond,
+                &m_sluStat, &info, Scalar());
+  StatFree(&m_sluStat);
+
+  // FIXME how to better check for errors ???
+  m_info = info == 0 ? Success : NumericalIssue;
+  m_factorizationIsOk = true;
+}
+
+template<typename MatrixType>
+template<typename Rhs,typename Dest>
+void SuperILU<MatrixType>::_solve(const MatrixBase<Rhs> &b, MatrixBase<Dest>& x) const
+{
+  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()");
+
+  const int size = m_matrix.rows();
+  const int rhsCols = b.cols();
+  eigen_assert(size==b.rows());
+
+  m_sluOptions.Trans = NOTRANS;
+  m_sluOptions.Fact = FACTORED;
+  m_sluOptions.IterRefine = NOREFINE;
+
+  m_sluFerr.resize(rhsCols);
+  m_sluBerr.resize(rhsCols);
+  m_sluB = SluMatrix::Map(b.const_cast_derived());
+  m_sluX = SluMatrix::Map(x.derived());
+
+  typename Rhs::PlainObject b_cpy;
+  if(m_sluEqued!='N')
+  {
+    b_cpy = b;
+    m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());  
+  }
+  
+  int info = 0;
+  RealScalar recip_pivot_growth, rcond;
+
+  StatInit(&m_sluStat);
+  SuperLU_gsisx(&m_sluOptions, &m_sluA,
+                m_q.data(), m_p.data(),
+                &m_sluEtree[0], &m_sluEqued,
+                &m_sluRscale[0], &m_sluCscale[0],
+                &m_sluL, &m_sluU,
+                NULL, 0,
+                &m_sluB, &m_sluX,
+                &recip_pivot_growth, &rcond,
+                &m_sluStat, &info, Scalar());
+  StatFree(&m_sluStat);
+
+  m_info = info==0 ? Success : NumericalIssue;
+}
+#endif
+
+namespace internal {
+  
+template<typename _MatrixType, typename Derived, typename Rhs>
+struct solve_retval<SuperLUBase<_MatrixType,Derived>, Rhs>
+  : solve_retval_base<SuperLUBase<_MatrixType,Derived>, Rhs>
+{
+  typedef SuperLUBase<_MatrixType,Derived> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve(rhs(),dst);
+  }
+};
+
+template<typename _MatrixType, typename Derived, typename Rhs>
+struct sparse_solve_retval<SuperLUBase<_MatrixType,Derived>, Rhs>
+  : sparse_solve_retval_base<SuperLUBase<_MatrixType,Derived>, Rhs>
+{
+  typedef SuperLUBase<_MatrixType,Derived> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec().derived()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SUPERLUSUPPORT_H
diff --git a/extern/Eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h b/extern/Eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h
new file mode 100644
index 0000000..f017203
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h
@@ -0,0 +1,431 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_UMFPACKSUPPORT_H
+#define EIGEN_UMFPACKSUPPORT_H
+
+namespace Eigen { 
+
+/* TODO extract L, extract U, compute det, etc... */
+
+// generic double/complex<double> wrapper functions:
+
+inline void umfpack_free_numeric(void **Numeric, double)
+{ umfpack_di_free_numeric(Numeric); *Numeric = 0; }
+
+inline void umfpack_free_numeric(void **Numeric, std::complex<double>)
+{ umfpack_zi_free_numeric(Numeric); *Numeric = 0; }
+
+inline void umfpack_free_symbolic(void **Symbolic, double)
+{ umfpack_di_free_symbolic(Symbolic); *Symbolic = 0; }
+
+inline void umfpack_free_symbolic(void **Symbolic, std::complex<double>)
+{ umfpack_zi_free_symbolic(Symbolic); *Symbolic = 0; }
+
+inline int umfpack_symbolic(int n_row,int n_col,
+                            const int Ap[], const int Ai[], const double Ax[], void **Symbolic,
+                            const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO])
+{
+  return umfpack_di_symbolic(n_row,n_col,Ap,Ai,Ax,Symbolic,Control,Info);
+}
+
+inline int umfpack_symbolic(int n_row,int n_col,
+                            const int Ap[], const int Ai[], const std::complex<double> Ax[], void **Symbolic,
+                            const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO])
+{
+  return umfpack_zi_symbolic(n_row,n_col,Ap,Ai,&internal::real_ref(Ax[0]),0,Symbolic,Control,Info);
+}
+
+inline int umfpack_numeric( const int Ap[], const int Ai[], const double Ax[],
+                            void *Symbolic, void **Numeric,
+                            const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO])
+{
+  return umfpack_di_numeric(Ap,Ai,Ax,Symbolic,Numeric,Control,Info);
+}
+
+inline int umfpack_numeric( const int Ap[], const int Ai[], const std::complex<double> Ax[],
+                            void *Symbolic, void **Numeric,
+                            const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO])
+{
+  return umfpack_zi_numeric(Ap,Ai,&internal::real_ref(Ax[0]),0,Symbolic,Numeric,Control,Info);
+}
+
+inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const double Ax[],
+                          double X[], const double B[], void *Numeric,
+                          const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
+{
+  return umfpack_di_solve(sys,Ap,Ai,Ax,X,B,Numeric,Control,Info);
+}
+
+inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const std::complex<double> Ax[],
+                          std::complex<double> X[], const std::complex<double> B[], void *Numeric,
+                          const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
+{
+  return umfpack_zi_solve(sys,Ap,Ai,&internal::real_ref(Ax[0]),0,&internal::real_ref(X[0]),0,&internal::real_ref(B[0]),0,Numeric,Control,Info);
+}
+
+inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double)
+{
+  return umfpack_di_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric);
+}
+
+inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, std::complex<double>)
+{
+  return umfpack_zi_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric);
+}
+
+inline int umfpack_get_numeric(int Lp[], int Lj[], double Lx[], int Up[], int Ui[], double Ux[],
+                               int P[], int Q[], double Dx[], int *do_recip, double Rs[], void *Numeric)
+{
+  return umfpack_di_get_numeric(Lp,Lj,Lx,Up,Ui,Ux,P,Q,Dx,do_recip,Rs,Numeric);
+}
+
+inline int umfpack_get_numeric(int Lp[], int Lj[], std::complex<double> Lx[], int Up[], int Ui[], std::complex<double> Ux[],
+                               int P[], int Q[], std::complex<double> Dx[], int *do_recip, double Rs[], void *Numeric)
+{
+  double& lx0_real = internal::real_ref(Lx[0]);
+  double& ux0_real = internal::real_ref(Ux[0]);
+  double& dx0_real = internal::real_ref(Dx[0]);
+  return umfpack_zi_get_numeric(Lp,Lj,Lx?&lx0_real:0,0,Up,Ui,Ux?&ux0_real:0,0,P,Q,
+                                Dx?&dx0_real:0,0,do_recip,Rs,Numeric);
+}
+
+inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO])
+{
+  return umfpack_di_get_determinant(Mx,Ex,NumericHandle,User_Info);
+}
+
+inline int umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO])
+{
+  double& mx_real = internal::real_ref(*Mx);
+  return umfpack_zi_get_determinant(&mx_real,0,Ex,NumericHandle,User_Info);
+}
+
+/** \ingroup UmfPackSupport_Module
+  * \brief A sparse LU factorization and solver based on UmfPack
+  *
+  * This class allows to solve for A.X = B sparse linear problems via a LU factorization
+  * using the UmfPack library. The sparse matrix A must be squared and full rank.
+  * The vectors or matrices X and B can be either dense or sparse.
+  *
+  * \WARNING The input matrix A should be in a \b compressed and \b column-major form.
+  * Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix.
+  * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+  *
+  * \sa \ref TutorialSparseDirectSolvers
+  */
+template<typename _MatrixType>
+class UmfPackLU : internal::noncopyable
+{
+  public:
+    typedef _MatrixType MatrixType;
+    typedef typename MatrixType::Scalar Scalar;
+    typedef typename MatrixType::RealScalar RealScalar;
+    typedef typename MatrixType::Index Index;
+    typedef Matrix<Scalar,Dynamic,1> Vector;
+    typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
+    typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
+    typedef SparseMatrix<Scalar> LUMatrixType;
+    typedef SparseMatrix<Scalar,ColMajor,int> UmfpackMatrixType;
+
+  public:
+
+    UmfPackLU() { init(); }
+
+    UmfPackLU(const MatrixType& matrix)
+    {
+      init();
+      compute(matrix);
+    }
+
+    ~UmfPackLU()
+    {
+      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());
+      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());
+    }
+
+    inline Index rows() const { return m_copyMatrix.rows(); }
+    inline Index cols() const { return m_copyMatrix.cols(); }
+
+    /** \brief Reports whether previous computation was successful.
+      *
+      * \returns \c Success if computation was succesful,
+      *          \c NumericalIssue if the matrix.appears to be negative.
+      */
+    ComputationInfo info() const
+    {
+      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+      return m_info;
+    }
+
+    inline const LUMatrixType& matrixL() const
+    {
+      if (m_extractedDataAreDirty) extractData();
+      return m_l;
+    }
+
+    inline const LUMatrixType& matrixU() const
+    {
+      if (m_extractedDataAreDirty) extractData();
+      return m_u;
+    }
+
+    inline const IntColVectorType& permutationP() const
+    {
+      if (m_extractedDataAreDirty) extractData();
+      return m_p;
+    }
+
+    inline const IntRowVectorType& permutationQ() const
+    {
+      if (m_extractedDataAreDirty) extractData();
+      return m_q;
+    }
+
+    /** Computes the sparse Cholesky decomposition of \a matrix 
+     *  Note that the matrix should be column-major, and in compressed format for best performance.
+     *  \sa SparseMatrix::makeCompressed().
+     */
+    void compute(const MatrixType& matrix)
+    {
+      analyzePattern(matrix);
+      factorize(matrix);
+    }
+
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+    template<typename Rhs>
+    inline const internal::solve_retval<UmfPackLU, Rhs> solve(const MatrixBase<Rhs>& b) const
+    {
+      eigen_assert(m_isInitialized && "UmfPackLU is not initialized.");
+      eigen_assert(rows()==b.rows()
+                && "UmfPackLU::solve(): invalid number of rows of the right hand side matrix b");
+      return internal::solve_retval<UmfPackLU, Rhs>(*this, b.derived());
+    }
+
+    /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+      *
+      * \sa compute()
+      */
+//     template<typename Rhs>
+//     inline const internal::sparse_solve_retval<UmfPAckLU, Rhs> solve(const SparseMatrixBase<Rhs>& b) const
+//     {
+//       eigen_assert(m_isInitialized && "UmfPAckLU is not initialized.");
+//       eigen_assert(rows()==b.rows()
+//                 && "UmfPAckLU::solve(): invalid number of rows of the right hand side matrix b");
+//       return internal::sparse_solve_retval<UmfPAckLU, Rhs>(*this, b.derived());
+//     }
+
+    /** Performs a symbolic decomposition on the sparcity of \a matrix.
+      *
+      * This function is particularly useful when solving for several problems having the same structure.
+      *
+      * \sa factorize(), compute()
+      */
+    void analyzePattern(const MatrixType& matrix)
+    {
+      if(m_symbolic)
+        umfpack_free_symbolic(&m_symbolic,Scalar());
+      if(m_numeric)
+        umfpack_free_numeric(&m_numeric,Scalar());
+      
+      grapInput(matrix);
+
+      int errorCode = 0;
+      errorCode = umfpack_symbolic(matrix.rows(), matrix.cols(), m_outerIndexPtr, m_innerIndexPtr, m_valuePtr,
+                                   &m_symbolic, 0, 0);
+
+      m_isInitialized = true;
+      m_info = errorCode ? InvalidInput : Success;
+      m_analysisIsOk = true;
+      m_factorizationIsOk = false;
+    }
+
+    /** Performs a numeric decomposition of \a matrix
+      *
+      * The given matrix must has the same sparcity than the matrix on which the pattern anylysis has been performed.
+      *
+      * \sa analyzePattern(), compute()
+      */
+    void factorize(const MatrixType& matrix)
+    {
+      eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");
+      if(m_numeric)
+        umfpack_free_numeric(&m_numeric,Scalar());
+
+      grapInput(matrix);
+
+      int errorCode;
+      errorCode = umfpack_numeric(m_outerIndexPtr, m_innerIndexPtr, m_valuePtr,
+                                  m_symbolic, &m_numeric, 0, 0);
+
+      m_info = errorCode ? NumericalIssue : Success;
+      m_factorizationIsOk = true;
+    }
+
+    #ifndef EIGEN_PARSED_BY_DOXYGEN
+    /** \internal */
+    template<typename BDerived,typename XDerived>
+    bool _solve(const MatrixBase<BDerived> &b, MatrixBase<XDerived> &x) const;
+    #endif
+
+    Scalar determinant() const;
+
+    void extractData() const;
+
+  protected:
+
+
+    void init()
+    {
+      m_info = InvalidInput;
+      m_isInitialized = false;
+      m_numeric = 0;
+      m_symbolic = 0;
+      m_outerIndexPtr = 0;
+      m_innerIndexPtr = 0;
+      m_valuePtr      = 0;
+    }
+    
+    void grapInput(const MatrixType& mat)
+    {
+      m_copyMatrix.resize(mat.rows(), mat.cols());
+      if( ((MatrixType::Flags&RowMajorBit)==RowMajorBit) || sizeof(typename MatrixType::Index)!=sizeof(int) || !mat.isCompressed() )
+      {
+        // non supported input -> copy
+        m_copyMatrix = mat;
+        m_outerIndexPtr = m_copyMatrix.outerIndexPtr();
+        m_innerIndexPtr = m_copyMatrix.innerIndexPtr();
+        m_valuePtr      = m_copyMatrix.valuePtr();
+      }
+      else
+      {
+        m_outerIndexPtr = mat.outerIndexPtr();
+        m_innerIndexPtr = mat.innerIndexPtr();
+        m_valuePtr      = mat.valuePtr();
+      }
+    }
+
+    // cached data to reduce reallocation, etc.
+    mutable LUMatrixType m_l;
+    mutable LUMatrixType m_u;
+    mutable IntColVectorType m_p;
+    mutable IntRowVectorType m_q;
+
+    UmfpackMatrixType m_copyMatrix;
+    const Scalar* m_valuePtr;
+    const int* m_outerIndexPtr;
+    const int* m_innerIndexPtr;
+    void* m_numeric;
+    void* m_symbolic;
+
+    mutable ComputationInfo m_info;
+    bool m_isInitialized;
+    int m_factorizationIsOk;
+    int m_analysisIsOk;
+    mutable bool m_extractedDataAreDirty;
+    
+  private:
+    UmfPackLU(UmfPackLU& ) { }
+};
+
+
+template<typename MatrixType>
+void UmfPackLU<MatrixType>::extractData() const
+{
+  if (m_extractedDataAreDirty)
+  {
+    // get size of the data
+    int lnz, unz, rows, cols, nz_udiag;
+    umfpack_get_lunz(&lnz, &unz, &rows, &cols, &nz_udiag, m_numeric, Scalar());
+
+    // allocate data
+    m_l.resize(rows,(std::min)(rows,cols));
+    m_l.resizeNonZeros(lnz);
+
+    m_u.resize((std::min)(rows,cols),cols);
+    m_u.resizeNonZeros(unz);
+
+    m_p.resize(rows);
+    m_q.resize(cols);
+
+    // extract
+    umfpack_get_numeric(m_l.outerIndexPtr(), m_l.innerIndexPtr(), m_l.valuePtr(),
+                        m_u.outerIndexPtr(), m_u.innerIndexPtr(), m_u.valuePtr(),
+                        m_p.data(), m_q.data(), 0, 0, 0, m_numeric);
+
+    m_extractedDataAreDirty = false;
+  }
+}
+
+template<typename MatrixType>
+typename UmfPackLU<MatrixType>::Scalar UmfPackLU<MatrixType>::determinant() const
+{
+  Scalar det;
+  umfpack_get_determinant(&det, 0, m_numeric, 0);
+  return det;
+}
+
+template<typename MatrixType>
+template<typename BDerived,typename XDerived>
+bool UmfPackLU<MatrixType>::_solve(const MatrixBase<BDerived> &b, MatrixBase<XDerived> &x) const
+{
+  const int rhsCols = b.cols();
+  eigen_assert((BDerived::Flags&RowMajorBit)==0 && "UmfPackLU backend does not support non col-major rhs yet");
+  eigen_assert((XDerived::Flags&RowMajorBit)==0 && "UmfPackLU backend does not support non col-major result yet");
+
+  int errorCode;
+  for (int j=0; j<rhsCols; ++j)
+  {
+    errorCode = umfpack_solve(UMFPACK_A,
+        m_outerIndexPtr, m_innerIndexPtr, m_valuePtr,
+        &x.col(j).coeffRef(0), &b.const_cast_derived().col(j).coeffRef(0), m_numeric, 0, 0);
+    if (errorCode!=0)
+      return false;
+  }
+
+  return true;
+}
+
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+struct solve_retval<UmfPackLU<_MatrixType>, Rhs>
+  : solve_retval_base<UmfPackLU<_MatrixType>, Rhs>
+{
+  typedef UmfPackLU<_MatrixType> Dec;
+  EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+template<typename _MatrixType, typename Rhs>
+struct sparse_solve_retval<UmfPackLU<_MatrixType>, Rhs>
+  : sparse_solve_retval_base<UmfPackLU<_MatrixType>, Rhs>
+{
+  typedef UmfPackLU<_MatrixType> Dec;
+  EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
+
+  template<typename Dest> void evalTo(Dest& dst) const
+  {
+    dec()._solve(rhs(),dst);
+  }
+};
+
+} // end namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_UMFPACKSUPPORT_H
diff --git a/extern/Eigen3/Eigen/src/misc/Image.h b/extern/Eigen3/Eigen/src/misc/Image.h
index 19b3e08..75c5f43 100644
--- a/extern/Eigen3/Eigen/src/misc/Image.h
+++ b/extern/Eigen3/Eigen/src/misc/Image.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MISC_IMAGE_H
 #define EIGEN_MISC_IMAGE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \class image_retval_base
@@ -92,4 +79,6 @@ template<typename _DecompositionType> struct image_retval_base
   image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
     : Base(dec, originalMatrix) {}
 
+} // end namespace Eigen
+
 #endif // EIGEN_MISC_IMAGE_H
diff --git a/extern/Eigen3/Eigen/src/misc/Kernel.h b/extern/Eigen3/Eigen/src/misc/Kernel.h
index 0115970..b9e1518 100644
--- a/extern/Eigen3/Eigen/src/misc/Kernel.h
+++ b/extern/Eigen3/Eigen/src/misc/Kernel.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MISC_KERNEL_H
 #define EIGEN_MISC_KERNEL_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \class kernel_retval_base
@@ -89,4 +76,6 @@ template<typename _DecompositionType> struct kernel_retval_base
   using Base::cols; \
   kernel_retval(const DecompositionType& dec) : Base(dec) {}
 
+} // end namespace Eigen
+
 #endif // EIGEN_MISC_KERNEL_H
diff --git a/extern/Eigen3/Eigen/src/misc/Solve.h b/extern/Eigen3/Eigen/src/misc/Solve.h
index b7cbcad..7f70d60 100644
--- a/extern/Eigen3/Eigen/src/misc/Solve.h
+++ b/extern/Eigen3/Eigen/src/misc/Solve.h
@@ -3,28 +3,15 @@
 //
 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_MISC_SOLVE_H
 #define EIGEN_MISC_SOLVE_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \class solve_retval_base
@@ -66,7 +53,7 @@ template<typename _DecompositionType, typename Rhs> struct solve_retval_base
 
   protected:
     const DecompositionType& m_dec;
-    const typename Rhs::Nested m_rhs;
+    typename Rhs::Nested m_rhs;
 };
 
 } // end namespace internal
@@ -84,4 +71,6 @@ template<typename _DecompositionType, typename Rhs> struct solve_retval_base
   solve_retval(const DecompositionType& dec, const Rhs& rhs) \
     : Base(dec, rhs) {}
 
+} // end namespace Eigen
+
 #endif // EIGEN_MISC_SOLVE_H
diff --git a/extern/Eigen3/Eigen/src/misc/SparseSolve.h b/extern/Eigen3/Eigen/src/misc/SparseSolve.h
new file mode 100644
index 0000000..272c4a4
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/misc/SparseSolve.h
@@ -0,0 +1,111 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud at inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SPARSE_SOLVE_H
+#define EIGEN_SPARSE_SOLVE_H
+
+namespace Eigen { 
+
+namespace internal {
+
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval_base;
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval;
+  
+template<typename DecompositionType, typename Rhs>
+struct traits<sparse_solve_retval_base<DecompositionType, Rhs> >
+{
+  typedef typename DecompositionType::MatrixType MatrixType;
+  typedef SparseMatrix<typename Rhs::Scalar, Rhs::Options, typename Rhs::Index> ReturnType;
+};
+
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval_base
+ : public ReturnByValue<sparse_solve_retval_base<_DecompositionType, Rhs> >
+{
+  typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
+  typedef _DecompositionType DecompositionType;
+  typedef ReturnByValue<sparse_solve_retval_base> Base;
+  typedef typename Base::Index Index;
+
+  sparse_solve_retval_base(const DecompositionType& dec, const Rhs& rhs)
+    : m_dec(dec), m_rhs(rhs)
+  {}
+
+  inline Index rows() const { return m_dec.cols(); }
+  inline Index cols() const { return m_rhs.cols(); }
+  inline const DecompositionType& dec() const { return m_dec; }
+  inline const RhsNestedCleaned& rhs() const { return m_rhs; }
+
+  template<typename Dest> inline void evalTo(Dest& dst) const
+  {
+    static_cast<const sparse_solve_retval<DecompositionType,Rhs>*>(this)->evalTo(dst);
+  }
+
+  protected:
+    const DecompositionType& m_dec;
+    typename Rhs::Nested m_rhs;
+};
+
+#define EIGEN_MAKE_SPARSE_SOLVE_HELPERS(DecompositionType,Rhs) \
+  typedef typename DecompositionType::MatrixType MatrixType; \
+  typedef typename MatrixType::Scalar Scalar; \
+  typedef typename MatrixType::RealScalar RealScalar; \
+  typedef typename MatrixType::Index Index; \
+  typedef Eigen::internal::sparse_solve_retval_base<DecompositionType,Rhs> Base; \
+  using Base::dec; \
+  using Base::rhs; \
+  using Base::rows; \
+  using Base::cols; \
+  sparse_solve_retval(const DecompositionType& dec, const Rhs& rhs) \
+    : Base(dec, rhs) {}
+
+
+
+template<typename DecompositionType, typename Rhs, typename Guess> struct solve_retval_with_guess;
+
+template<typename DecompositionType, typename Rhs, typename Guess>
+struct traits<solve_retval_with_guess<DecompositionType, Rhs, Guess> >
+{
+  typedef typename DecompositionType::MatrixType MatrixType;
+  typedef Matrix<typename Rhs::Scalar,
+                 MatrixType::ColsAtCompileTime,
+                 Rhs::ColsAtCompileTime,
+                 Rhs::PlainObject::Options,
+                 MatrixType::MaxColsAtCompileTime,
+                 Rhs::MaxColsAtCompileTime> ReturnType;
+};
+
+template<typename DecompositionType, typename Rhs, typename Guess> struct solve_retval_with_guess
+ : public ReturnByValue<solve_retval_with_guess<DecompositionType, Rhs, Guess> >
+{
+  typedef typename DecompositionType::Index Index;
+
+  solve_retval_with_guess(const DecompositionType& dec, const Rhs& rhs, const Guess& guess)
+    : m_dec(dec), m_rhs(rhs), m_guess(guess)
+  {}
+
+  inline Index rows() const { return m_dec.cols(); }
+  inline Index cols() const { return m_rhs.cols(); }
+
+  template<typename Dest> inline void evalTo(Dest& dst) const
+  {
+    dst = m_guess;
+    m_dec._solveWithGuess(m_rhs,dst);
+  }
+
+  protected:
+    const DecompositionType& m_dec;
+    const typename Rhs::Nested m_rhs;
+    const typename Guess::Nested m_guess;
+};
+
+} // namepsace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SPARSE_SOLVE_H
diff --git a/extern/Eigen3/Eigen/src/misc/blas.h b/extern/Eigen3/Eigen/src/misc/blas.h
new file mode 100644
index 0000000..6fce99e
--- /dev/null
+++ b/extern/Eigen3/Eigen/src/misc/blas.h
@@ -0,0 +1,658 @@
+#ifndef BLAS_H
+#define BLAS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define BLASFUNC(FUNC) FUNC##_
+
+#ifdef __WIN64__
+typedef long long BLASLONG;
+typedef unsigned long long BLASULONG;
+#else
+typedef long BLASLONG;
+typedef unsigned long BLASULONG;
+#endif
+
+int    BLASFUNC(xerbla)(const char *, int *info, int);
+
+float  BLASFUNC(sdot)  (int *, float  *, int *, float  *, int *);
+float  BLASFUNC(sdsdot)(int *, float  *,        float  *, int *, float  *, int *);
+
+double BLASFUNC(dsdot) (int *, float  *, int *, float  *, int *);
+double BLASFUNC(ddot)  (int *, double *, int *, double *, int *);
+double BLASFUNC(qdot)  (int *, double *, int *, double *, int *);
+
+int  BLASFUNC(cdotuw)  (int *, float  *, int *, float  *, int *, float*);
+int  BLASFUNC(cdotcw)  (int *, float  *, int *, float  *, int *, float*);
+int  BLASFUNC(zdotuw)  (int *, double  *, int *, double  *, int *, double*);
+int  BLASFUNC(zdotcw)  (int *, double  *, int *, double  *, int *, double*);
+
+int    BLASFUNC(saxpy) (int *, float  *, float  *, int *, float  *, int *);
+int    BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *);
+int    BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *);
+int    BLASFUNC(caxpy) (int *, float  *, float  *, int *, float  *, int *);
+int    BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *);
+int    BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *);
+int    BLASFUNC(caxpyc)(int *, float  *, float  *, int *, float  *, int *);
+int    BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *);
+int    BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *);
+
+int    BLASFUNC(scopy) (int *, float  *, int *, float  *, int *);
+int    BLASFUNC(dcopy) (int *, double *, int *, double *, int *);
+int    BLASFUNC(qcopy) (int *, double *, int *, double *, int *);
+int    BLASFUNC(ccopy) (int *, float  *, int *, float  *, int *);
+int    BLASFUNC(zcopy) (int *, double *, int *, double *, int *);
+int    BLASFUNC(xcopy) (int *, double *, int *, double *, int *);
+
+int    BLASFUNC(sswap) (int *, float  *, int *, float  *, int *);
+int    BLASFUNC(dswap) (int *, double *, int *, double *, int *);
+int    BLASFUNC(qswap) (int *, double *, int *, double *, int *);
+int    BLASFUNC(cswap) (int *, float  *, int *, float  *, int *);
+int    BLASFUNC(zswap) (int *, double *, int *, double *, int *);
+int    BLASFUNC(xswap) (int *, double *, int *, double *, int *);
+
+float  BLASFUNC(sasum) (int *, float  *, int *);
+float  BLASFUNC(scasum)(int *, float  *, int *);
+double BLASFUNC(dasum) (int *, double *, int *);
+double BLASFUNC(qasum) (int *, double *, int *);
+double BLASFUNC(dzasum)(int *, double *, int *);
+double BLASFUNC(qxasum)(int *, double *, int *);
+
+int    BLASFUNC(isamax)(int *, float  *, int *);
+int    BLASFUNC(idamax)(int *, double *, int *);
+int    BLASFUNC(iqamax)(int *, double *, int *);
+int    BLASFUNC(icamax)(int *, float  *, int *);
+int    BLASFUNC(izamax)(int *, double *, int *);
+int    BLASFUNC(ixamax)(int *, double *, int *);
+
+int    BLASFUNC(ismax) (int *, float  *, int *);
+int    BLASFUNC(idmax) (int *, double *, int *);
+int    BLASFUNC(iqmax) (int *, double *, int *);
+int    BLASFUNC(icmax) (int *, float  *, int *);
+int    BLASFUNC(izmax) (int *, double *, int *);
+int    BLASFUNC(ixmax) (int *, double *, int *);
+
+int    BLASFUNC(isamin)(int *, float  *, int *);
+int    BLASFUNC(idamin)(int *, double *, int *);
+int    BLASFUNC(iqamin)(int *, double *, int *);
+int    BLASFUNC(icamin)(int *, float  *, int *);
+int    BLASFUNC(izamin)(int *, double *, int *);
+int    BLASFUNC(ixamin)(int *, double *, int *);
+
+int    BLASFUNC(ismin)(int *, float  *, int *);
+int    BLASFUNC(idmin)(int *, double *, int *);
+int    BLASFUNC(iqmin)(int *, double *, int *);
+int    BLASFUNC(icmin)(int *, float  *, int *);
+int    BLASFUNC(izmin)(int *, double *, int *);
+int    BLASFUNC(ixmin)(int *, double *, int *);
+
+float  BLASFUNC(samax) (int *, float  *, int *);
+double BLASFUNC(damax) (int *, double *, int *);
+double BLASFUNC(qamax) (int *, double *, int *);
+float  BLASFUNC(scamax)(int *, float  *, int *);
+double BLASFUNC(dzamax)(int *, double *, int *);
+double BLASFUNC(qxamax)(int *, double *, int *);
+
+float  BLASFUNC(samin) (int *, float  *, int *);
+double BLASFUNC(damin) (int *, double *, int *);
+double BLASFUNC(qamin) (int *, double *, int *);
+float  BLASFUNC(scamin)(int *, float  *, int *);
+double BLASFUNC(dzamin)(int *, double *, int *);
+double BLASFUNC(qxamin)(int *, double *, int *);
+
+float  BLASFUNC(smax)  (int *, float  *, int *);
+double BLASFUNC(dmax)  (int *, double *, int *);
+double BLASFUNC(qmax)  (int *, double *, int *);
+float  BLASFUNC(scmax) (int *, float  *, int *);
+double BLASFUNC(dzmax) (int *, double *, int *);
+double BLASFUNC(qxmax) (int *, double *, int *);
+
+float  BLASFUNC(smin)  (int *, float  *, int *);
+double BLASFUNC(dmin)  (int *, double *, int *);
+double BLASFUNC(qmin)  (int *, double *, int *);
+float  BLASFUNC(scmin) (int *, float  *, int *);
+double BLASFUNC(dzmin) (int *, double *, int *);
+double BLASFUNC(qxmin) (int *, double *, int *);
+
+int    BLASFUNC(sscal) (int *,  float  *, float  *, int *);
+int    BLASFUNC(dscal) (int *,  double *, double *, int *);
+int    BLASFUNC(qscal) (int *,  double *, double *, int *);
+int    BLASFUNC(cscal) (int *,  float  *, float  *, int *);
+int    BLASFUNC(zscal) (int *,  double *, double *, int *);
+int    BLASFUNC(xscal) (int *,  double *, double *, int *);
+int    BLASFUNC(csscal)(int *,  float  *, float  *, int *);
+int    BLASFUNC(zdscal)(int *,  double *, double *, int *);
+int    BLASFUNC(xqscal)(int *,  double *, double *, int *);
+
+float  BLASFUNC(snrm2) (int *, float  *, int *);
+float  BLASFUNC(scnrm2)(int *, float  *, int *);
+
+double BLASFUNC(dnrm2) (int *, double *, int *);
+double BLASFUNC(qnrm2) (int *, double *, int *);
+double BLASFUNC(dznrm2)(int *, double *, int *);
+double BLASFUNC(qxnrm2)(int *, double *, int *);
+
+int    BLASFUNC(srot)  (int *, float  *, int *, float  *, int *, float  *, float  *);
+int    BLASFUNC(drot)  (int *, double *, int *, double *, int *, double *, double *);
+int    BLASFUNC(qrot)  (int *, double *, int *, double *, int *, double *, double *);
+int    BLASFUNC(csrot) (int *, float  *, int *, float  *, int *, float  *, float  *);
+int    BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *);
+int    BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *);
+
+int    BLASFUNC(srotg) (float  *, float  *, float  *, float  *);
+int    BLASFUNC(drotg) (double *, double *, double *, double *);
+int    BLASFUNC(qrotg) (double *, double *, double *, double *);
+int    BLASFUNC(crotg) (float  *, float  *, float  *, float  *);
+int    BLASFUNC(zrotg) (double *, double *, double *, double *);
+int    BLASFUNC(xrotg) (double *, double *, double *, double *);
+
+int    BLASFUNC(srotmg)(float  *, float  *, float  *, float  *, float  *);
+int    BLASFUNC(drotmg)(double *, double *, double *, double *, double *);
+
+int    BLASFUNC(srotm) (int *, float  *, int *, float  *, int *, float  *);
+int    BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *);
+int    BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *);
+
+/* Level 2 routines */
+
+int BLASFUNC(sger)(int *,    int *, float *,  float *, int *,
+		   float *,  int *, float *,  int *);
+int BLASFUNC(dger)(int *,    int *, double *, double *, int *,
+		   double *, int *, double *, int *);
+int BLASFUNC(qger)(int *,    int *, double *, double *, int *,
+		   double *, int *, double *, int *);
+int BLASFUNC(cgeru)(int *,    int *, float *,  float *, int *,
+		    float *,  int *, float *,  int *);
+int BLASFUNC(cgerc)(int *,    int *, float *,  float *, int *,
+		    float *,  int *, float *,  int *);
+int BLASFUNC(zgeru)(int *,    int *, double *, double *, int *,
+		    double *, int *, double *, int *);
+int BLASFUNC(zgerc)(int *,    int *, double *, double *, int *,
+		    double *, int *, double *, int *);
+int BLASFUNC(xgeru)(int *,    int *, double *, double *, int *,
+		    double *, int *, double *, int *);
+int BLASFUNC(xgerc)(int *,    int *, double *, double *, int *,
+		    double *, int *, double *, int *);
+
+int BLASFUNC(sgemv)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(cgemv)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+
+int BLASFUNC(strsv) (char *, char *, char *, int *, float  *, int *,
+		     float  *, int *);
+int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(ctrsv) (char *, char *, char *, int *, float  *, int *,
+		     float  *, int *);
+int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+
+int BLASFUNC(stpsv) (char *, char *, char *, int *, float  *, float  *, int *);
+int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(ctpsv) (char *, char *, char *, int *, float  *, float  *, int *);
+int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *);
+
+int BLASFUNC(strmv) (char *, char *, char *, int *, float  *, int *,
+		     float  *, int *);
+int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(ctrmv) (char *, char *, char *, int *, float  *, int *,
+		     float  *, int *);
+int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *,
+		     double *, int *);
+
+int BLASFUNC(stpmv) (char *, char *, char *, int *, float  *, float  *, int *);
+int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(ctpmv) (char *, char *, char *, int *, float  *, float  *, int *);
+int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *);
+int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *);
+
+int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+
+int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
+
+int BLASFUNC(ssymv) (char *, int *, float  *, float *, int *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(dsymv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(qsymv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(csymv) (char *, int *, float  *, float *, int *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(zsymv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(xsymv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+
+int BLASFUNC(sspmv) (char *, int *, float  *, float *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(dspmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(qspmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(cspmv) (char *, int *, float  *, float *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(zspmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(xspmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+
+int BLASFUNC(ssyr) (char *, int *, float   *, float  *, int *,
+		    float  *, int *);
+int BLASFUNC(dsyr) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+int BLASFUNC(qsyr) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+int BLASFUNC(csyr) (char *, int *, float   *, float  *, int *,
+		    float  *, int *);
+int BLASFUNC(zsyr) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+int BLASFUNC(xsyr) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+
+int BLASFUNC(ssyr2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(dsyr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+int BLASFUNC(qsyr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+int BLASFUNC(csyr2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(zsyr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+int BLASFUNC(xsyr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+
+int BLASFUNC(sspr) (char *, int *, float   *, float  *, int *,
+		    float  *);
+int BLASFUNC(dspr) (char *, int *, double  *, double *, int *,
+		    double *);
+int BLASFUNC(qspr) (char *, int *, double  *, double *, int *,
+		    double *);
+int BLASFUNC(cspr) (char *, int *, float   *, float  *, int *,
+		    float  *);
+int BLASFUNC(zspr) (char *, int *, double  *, double *, int *,
+		    double *);
+int BLASFUNC(xspr) (char *, int *, double  *, double *, int *,
+		    double *);
+
+int BLASFUNC(sspr2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *);
+int BLASFUNC(dspr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+int BLASFUNC(qspr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+int BLASFUNC(cspr2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *);
+int BLASFUNC(zspr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+int BLASFUNC(xspr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+
+int BLASFUNC(cher) (char *, int *, float   *, float  *, int *,
+		    float  *, int *);
+int BLASFUNC(zher) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+int BLASFUNC(xher) (char *, int *, double  *, double *, int *,
+		    double *, int *);
+
+int BLASFUNC(chpr) (char *, int *, float   *, float  *, int *, float  *);
+int BLASFUNC(zhpr) (char *, int *, double  *, double *, int *, double *);
+int BLASFUNC(xhpr) (char *, int *, double  *, double *, int *, double *);
+
+int BLASFUNC(cher2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *, int *);
+int BLASFUNC(zher2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+int BLASFUNC(xher2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *, int *);
+
+int BLASFUNC(chpr2) (char *, int *, float   *,
+		     float  *, int *, float  *, int *, float  *);
+int BLASFUNC(zhpr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+int BLASFUNC(xhpr2) (char *, int *, double  *,
+		     double *, int *, double *, int *, double *);
+
+int BLASFUNC(chemv) (char *, int *, float  *, float *, int *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(zhemv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(xhemv) (char *, int *, double  *, double *, int *,
+		     double  *, int *, double *, double *, int *);
+
+int BLASFUNC(chpmv) (char *, int *, float  *, float *,
+		     float  *, int *, float *, float *, int *);
+int BLASFUNC(zhpmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+int BLASFUNC(xhpmv) (char *, int *, double  *, double *,
+		     double  *, int *, double *, double *, int *);
+
+int BLASFUNC(snorm)(char *, int *, int *, float  *, int *);
+int BLASFUNC(dnorm)(char *, int *, int *, double *, int *);
+int BLASFUNC(cnorm)(char *, int *, int *, float  *, int *);
+int BLASFUNC(znorm)(char *, int *, int *, double *, int *);
+
+int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+
+int BLASFUNC(ssbmv)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(csbmv)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+
+int BLASFUNC(chbmv)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *,
+		    double *, int *, double *, double *, int *);
+
+/* Level 3 routines */
+
+int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *,
+	   float  *, int *, float  *, int *, float  *, float  *, int *);
+int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *,
+	   float  *, int *, float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+
+int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *,
+	   float  *, int *, float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *,
+	   double *, int *, double *, int *, double *, double *, int *);
+
+int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *,
+		     float *, float  *, int *, float  *, int *,
+		     float *, float  *, int *);
+int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *,
+		     double *, double  *, int *, double  *, int *,
+		     double *, double  *, int *);
+int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *,
+		     float *, float  *, int *, float  *, int *,
+		     float *, float  *, int *);
+int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *,
+		     double *, double  *, int *, double  *, int *,
+		     double *, double  *, int *);
+
+int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *,
+	   float *,  float *, int *, float *, int *);
+int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *,
+	   float *,  float *, int *, float *, int *);
+int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+
+int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *,
+	   float *,  float *, int *, float *, int *);
+int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *,
+	   float *,  float *, int *, float *, int *);
+int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *,
+	   double *,  double *, int *, double *, int *);
+
+int BLASFUNC(ssymm)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, int *, float  *, float  *, int *);
+int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(csymm)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+
+int BLASFUNC(csymm3m)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+
+int BLASFUNC(ssyrk)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, float  *, int *);
+int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+int BLASFUNC(csyrk)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, float  *, int *);
+int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+
+int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float *, int *, float  *, float  *, int *);
+int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(csyr2k)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float *, int *, float  *, float  *, int *);
+int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+
+int BLASFUNC(chemm)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+
+int BLASFUNC(chemm3m)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, int *, float  *, float  *, int *);
+int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, int *, double *, double *, int *);
+
+int BLASFUNC(cherk)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float  *, float  *, int *);
+int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *,
+	   double *, double *, int *);
+
+int BLASFUNC(cher2k)(char *, char *, int *, int *, float  *, float  *, int *,
+	   float *, int *, float  *, float  *, int *);
+int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float  *, float  *, int *,
+	   float *, int *, float  *, float  *, int *);
+int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *,
+	   double*, int *, double *, double *, int *);
+
+int BLASFUNC(sgemt)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *);
+int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *,
+		    double *, int *);
+int BLASFUNC(cgemt)(char *, int *, int *, float  *, float  *, int *,
+		    float  *, int *);
+int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *,
+		    double *, int *);
+
+int BLASFUNC(sgema)(char *, char *, int *, int *, float  *,
+		    float  *, int *, float *, float  *, int *, float *, int *);
+int BLASFUNC(dgema)(char *, char *, int *, int *, double *,
+		    double *, int *, double*, double *, int *, double*, int *);
+int BLASFUNC(cgema)(char *, char *, int *, int *, float  *,
+		    float  *, int *, float *, float  *, int *, float *, int *);
+int BLASFUNC(zgema)(char *, char *, int *, int *, double *,
+		    double *, int *, double*, double *, int *, double*, int *);
+
+int BLASFUNC(sgems)(char *, char *, int *, int *, float  *,
+		    float  *, int *, float *, float  *, int *, float *, int *);
+int BLASFUNC(dgems)(char *, char *, int *, int *, double *,
+		    double *, int *, double*, double *, int *, double*, int *);
+int BLASFUNC(cgems)(char *, char *, int *, int *, float  *,
+		    float  *, int *, float *, float  *, int *, float *, int *);
+int BLASFUNC(zgems)(char *, char *, int *, int *, double *,
+		    double *, int *, double*, double *, int *, double*, int *);
+
+int BLASFUNC(sgetf2)(int *, int *, float  *, int *, int *, int *);
+int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(cgetf2)(int *, int *, float  *, int *, int *, int *);
+int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *);
+
+int BLASFUNC(sgetrf)(int *, int *, float  *, int *, int *, int *);
+int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(cgetrf)(int *, int *, float  *, int *, int *, int *);
+int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *);
+int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *);
+
+int BLASFUNC(slaswp)(int *, float  *, int *, int *, int *, int *, int *);
+int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *);
+int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *);
+int BLASFUNC(claswp)(int *, float  *, int *, int *, int *, int *, int *);
+int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *);
+int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *);
+
+int BLASFUNC(sgetrs)(char *, int *, int *, float  *, int *, int *, float  *, int *, int *);
+int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
+int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
+int BLASFUNC(cgetrs)(char *, int *, int *, float  *, int *, int *, float  *, int *, int *);
+int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
+int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
+
+int BLASFUNC(sgesv)(int *, int *, float  *, int *, int *, float *, int *, int *);
+int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
+int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
+int BLASFUNC(cgesv)(int *, int *, float  *, int *, int *, float *, int *, int *);
+int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
+int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *);
+
+int BLASFUNC(spotf2)(char *, int *, float  *, int *, int *);
+int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *);
+int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *);
+int BLASFUNC(cpotf2)(char *, int *, float  *, int *, int *);
+int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *);
+int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *);
+
+int BLASFUNC(spotrf)(char *, int *, float  *, int *, int *);
+int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *);
+int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *);
+int BLASFUNC(cpotrf)(char *, int *, float  *, int *, int *);
+int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *);
+int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *);
+
+int BLASFUNC(slauu2)(char *, int *, float  *, int *, int *);
+int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *);
+int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *);
+int BLASFUNC(clauu2)(char *, int *, float  *, int *, int *);
+int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *);
+int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *);
+
+int BLASFUNC(slauum)(char *, int *, float  *, int *, int *);
+int BLASFUNC(dlauum)(char *, int *, double *, int *, int *);
+int BLASFUNC(qlauum)(char *, int *, double *, int *, int *);
+int BLASFUNC(clauum)(char *, int *, float  *, int *, int *);
+int BLASFUNC(zlauum)(char *, int *, double *, int *, int *);
+int BLASFUNC(xlauum)(char *, int *, double *, int *, int *);
+
+int BLASFUNC(strti2)(char *, char *, int *, float  *, int *, int *);
+int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(ctrti2)(char *, char *, int *, float  *, int *, int *);
+int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *);
+
+int BLASFUNC(strtri)(char *, char *, int *, float  *, int *, int *);
+int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(ctrtri)(char *, char *, int *, float  *, int *, int *);
+int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *);
+int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *);
+
+int BLASFUNC(spotri)(char *, int *, float  *, int *, int *);
+int BLASFUNC(dpotri)(char *, int *, double *, int *, int *);
+int BLASFUNC(qpotri)(char *, int *, double *, int *, int *);
+int BLASFUNC(cpotri)(char *, int *, float  *, int *, int *);
+int BLASFUNC(zpotri)(char *, int *, double *, int *, int *);
+int BLASFUNC(xpotri)(char *, int *, double *, int *, int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
index 7d509e7..5b979eb 100644
--- a/extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
+++ b/extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
@@ -29,6 +29,16 @@ operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
   */
 EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
 
+/** \returns an expression of the coefficient-wise min of \c *this and scalar \a other
+  *
+  * \sa max()
+  */
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const ConstantReturnType>
+(min)(const Scalar &other) const
+{
+  return (min)(Derived::PlainObject::Constant(rows(), cols(), other));
+}
+
 /** \returns an expression of the coefficient-wise max of \c *this and \a other
   *
   * Example: \include Cwise_max.cpp
@@ -38,6 +48,16 @@ EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
   */
 EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
 
+/** \returns an expression of the coefficient-wise max of \c *this and scalar \a other
+  *
+  * \sa min()
+  */
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const ConstantReturnType>
+(max)(const Scalar &other) const
+{
+  return (max)(Derived::PlainObject::Constant(rows(), cols(), other));
+}
+
 /** \returns an expression of the coefficient-wise \< operator of *this and \a other
   *
   * Example: \include Cwise_less.cpp
@@ -141,3 +161,39 @@ operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>&
 {
   return (-other) + scalar;
 }
+
+/** \returns an expression of the coefficient-wise && operator of *this and \a other
+  *
+  * \warning this operator is for expression of bool only.
+  *
+  * Example: \include Cwise_boolean_and.cpp
+  * Output: \verbinclude Cwise_boolean_and.out
+  *
+  * \sa operator||(), select()
+  */
+template<typename OtherDerived>
+inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>
+operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
+{
+  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
+                      THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
+  return CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>(derived(),other.derived());
+}
+
+/** \returns an expression of the coefficient-wise || operator of *this and \a other
+  *
+  * \warning this operator is for expression of bool only.
+  *
+  * Example: \include Cwise_boolean_or.cpp
+  * Output: \verbinclude Cwise_boolean_or.out
+  *
+  * \sa operator&&(), select()
+  */
+template<typename OtherDerived>
+inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>
+operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
+{
+  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
+                      THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
+  return CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>(derived(),other.derived());
+}
diff --git a/extern/Eigen3/Eigen/src/plugins/BlockMethods.h b/extern/Eigen3/Eigen/src/plugins/BlockMethods.h
index 4eba933..ef22400 100644
--- a/extern/Eigen3/Eigen/src/plugins/BlockMethods.h
+++ b/extern/Eigen3/Eigen/src/plugins/BlockMethods.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef EIGEN_BLOCKMETHODS_H
 #define EIGEN_BLOCKMETHODS_H
diff --git a/extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h b/extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h
index 8f7765e..688d224 100644
--- a/extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h
+++ b/extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // This file is a base class plugin containing common coefficient wise functions.
 
diff --git a/extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h b/extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h
index 941d515..08e931a 100644
--- a/extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h
+++ b/extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // This file is a base class plugin containing common coefficient wise functions.
 
diff --git a/extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h b/extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
index 35183f9..3a737df 100644
--- a/extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
+++ b/extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // This file is a base class plugin containing matrix specifics coefficient wise functions.
 
@@ -91,6 +76,16 @@ cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
   return CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
 }
 
+/** \returns an expression of the coefficient-wise min of *this and scalar \a other
+  *
+  * \sa class CwiseBinaryOp, min()
+  */
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const ConstantReturnType>
+cwiseMin(const Scalar &other) const
+{
+  return cwiseMin(Derived::PlainObject::Constant(rows(), cols(), other));
+}
+
 /** \returns an expression of the coefficient-wise max of *this and \a other
   *
   * Example: \include MatrixBase_cwiseMax.cpp
@@ -105,6 +100,17 @@ cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
   return CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
 }
 
+/** \returns an expression of the coefficient-wise max of *this and scalar \a other
+  *
+  * \sa class CwiseBinaryOp, min()
+  */
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const ConstantReturnType>
+cwiseMax(const Scalar &other) const
+{
+  return cwiseMax(Derived::PlainObject::Constant(rows(), cols(), other));
+}
+
+
 /** \returns an expression of the coefficient-wise quotient of *this and \a other
   *
   * Example: \include MatrixBase_cwiseQuotient.cpp
diff --git a/extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h b/extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
index a3d9a0e..0cf0640 100644
--- a/extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
+++ b/extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
@@ -4,24 +4,9 @@
 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud at inria.fr>
 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1 at gmail.com>
 //
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // This file is a base class plugin containing matrix specifics coefficient wise functions.
 
diff --git a/extern/SConscript b/extern/SConscript
index ce366de..71998ee 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -8,8 +8,11 @@ SConscript(['colamd/SConscript'])
 if env['WITH_BF_GAMEENGINE']:
     SConscript(['recastnavigation/SConscript'])
 
+# now only available in a branch
+'''
 if env['WITH_BF_ELTOPO']:
     SConscript(['eltopo/SConscript'])
+'''
 
 if env['WITH_BF_BULLET']:
     SConscript(['bullet2/src/SConscript'])
diff --git a/extern/bullet2/patches/convex_hull.patch b/extern/bullet2/patches/convex_hull.patch
new file mode 100644
index 0000000..1b29782
--- /dev/null
+++ b/extern/bullet2/patches/convex_hull.patch
@@ -0,0 +1,127 @@
+Index: extern/bullet2/src/Bullet-C-Api.h
+===================================================================
+--- extern/bullet2/src/Bullet-C-Api.h	(revision 51556)
++++ extern/bullet2/src/Bullet-C-Api.h	(working copy)
+@@ -167,6 +167,16 @@ extern "C" {
+ 	// needed for source/blender/blenkernel/intern/collision.c
+ 	double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
+ 
++
++	/* Convex Hull */
++	PL_DECLARE_HANDLE(plConvexHull);
++	plConvexHull plConvexHullCompute(float (*coords)[3], int count);
++	int plConvexHullNumVertices(plConvexHull hull);
++	int plConvexHullNumFaces(plConvexHull hull);
++	void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
++	int plConvexHullGetFaceSize(plConvexHull hull, int n);
++	void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices);
++
+ #ifdef __cplusplus
+ }
+ #endif
+Index: extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
+===================================================================
+--- extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp	(revision 51556)
++++ extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp	(working copy)
+@@ -23,7 +23,7 @@ subject to the following restrictions:
+ #include "Bullet-C-Api.h"
+ #include "btBulletDynamicsCommon.h"
+ #include "LinearMath/btAlignedAllocator.h"
+-
++#include "LinearMath/btConvexHullComputer.h"
+ 
+ 
+ #include "LinearMath/btVector3.h"
+@@ -403,3 +403,60 @@ double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float
+ 	return -1.0f;	
+ }
+ 
++// Convex hull
++plConvexHull plConvexHullCompute(float (*coords)[3], int count)
++{
++	btConvexHullComputer *computer = new btConvexHullComputer;
++	computer->compute(reinterpret_cast< float* >(coords),
++					  sizeof(*coords), count, 0, 0);
++	return reinterpret_cast<plConvexHull>(computer);
++}
++
++int plConvexHullNumVertices(plConvexHull hull)
++{
++	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
++	return computer->vertices.size();
++}
++
++int plConvexHullNumFaces(plConvexHull hull)
++{
++	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
++	return computer->faces.size();
++}
++
++void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3],
++						   int *original_index)
++{
++	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
++	const btVector3 &v(computer->vertices[n]);
++	coords[0] = v[0];
++	coords[1] = v[1];
++	coords[2] = v[2];
++	(*original_index) = computer->original_vertex_index[n];
++}
++
++int plConvexHullGetFaceSize(plConvexHull hull, int n)
++{
++	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
++	const btConvexHullComputer::Edge *e_orig, *e;
++	int count;
++
++	for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0;
++		 count == 0 || e != e_orig;
++		 e = e->getNextEdgeOfFace(), count++);
++	return count;
++}
++
++void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices)
++{
++	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
++	const btConvexHullComputer::Edge *e_orig, *e;
++	int count;
++
++	for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0;
++		 count == 0 || e != e_orig;
++		 e = e->getNextEdgeOfFace(), count++)
++	{
++		vertices[count] = e->getTargetVertex();
++	}
++}
+Index: extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
+===================================================================
+--- extern/bullet2/src/LinearMath/btConvexHullComputer.cpp	(revision 51556)
++++ extern/bullet2/src/LinearMath/btConvexHullComputer.cpp	(working copy)
+@@ -2661,6 +2661,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
+ 	}
+ 
+ 	vertices.resize(0);
++	original_vertex_index.resize(0);
+ 	edges.resize(0);
+ 	faces.resize(0);
+ 
+@@ -2671,6 +2672,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
+ 	{
+ 		btConvexHullInternal::Vertex* v = oldVertices[copied];
+ 		vertices.push_back(hull.getCoordinates(v));
++		original_vertex_index.push_back(v->point.index);
+ 		btConvexHullInternal::Edge* firstEdge = v->edges;
+ 		if (firstEdge)
+ 		{
+Index: extern/bullet2/src/LinearMath/btConvexHullComputer.h
+===================================================================
+--- extern/bullet2/src/LinearMath/btConvexHullComputer.h	(revision 51556)
++++ extern/bullet2/src/LinearMath/btConvexHullComputer.h	(working copy)
+@@ -67,6 +67,7 @@ class btConvexHullComputer
+ 
+ 		// Vertices of the output hull
+ 		btAlignedObjectArray<btVector3> vertices;
++		btAlignedObjectArray<int> original_vertex_index;
+ 
+ 		// Edges of the output hull
+ 		btAlignedObjectArray<Edge> edges;
diff --git a/extern/bullet2/readme.txt b/extern/bullet2/readme.txt
index 343cb10..7f5a7f1 100644
--- a/extern/bullet2/readme.txt
+++ b/extern/bullet2/readme.txt
@@ -14,6 +14,8 @@ Apply patches/make_id.patch to prevent duplicated define of MAKE_ID macro in ble
 side and bullet side.
 Sergey
 
-Apply patches/ghost_character.path to prevent characters from colliding with ghost objects.
+Apply patches/ghost_character.patch to prevent characters from colliding with ghost objects.
 Mitchell
 
+Apply patches/convex_hull.patch to add access to the convex hull
+operation, used in the BMesh convex hull operator.
diff --git a/extern/bullet2/src/Bullet-C-Api.h b/extern/bullet2/src/Bullet-C-Api.h
index f27a17d..2eabf38 100644
--- a/extern/bullet2/src/Bullet-C-Api.h
+++ b/extern/bullet2/src/Bullet-C-Api.h
@@ -167,6 +167,16 @@ extern "C" {
 	// needed for source/blender/blenkernel/intern/collision.c
 	double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
 
+
+	/* Convex Hull */
+	PL_DECLARE_HANDLE(plConvexHull);
+	plConvexHull plConvexHullCompute(float (*coords)[3], int count);
+	int plConvexHullNumVertices(plConvexHull hull);
+	int plConvexHullNumFaces(plConvexHull hull);
+	void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
+	int plConvexHullGetFaceSize(plConvexHull hull, int n);
+	void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
index bd8e274..cf73556 100644
--- a/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
+++ b/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
@@ -23,7 +23,7 @@ subject to the following restrictions:
 #include "Bullet-C-Api.h"
 #include "btBulletDynamicsCommon.h"
 #include "LinearMath/btAlignedAllocator.h"
-
+#include "LinearMath/btConvexHullComputer.h"
 
 
 #include "LinearMath/btVector3.h"
@@ -403,3 +403,60 @@ double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float
 	return -1.0f;	
 }
 
+// Convex hull
+plConvexHull plConvexHullCompute(float (*coords)[3], int count)
+{
+	btConvexHullComputer *computer = new btConvexHullComputer;
+	computer->compute(reinterpret_cast< float* >(coords),
+					  sizeof(*coords), count, 0, 0);
+	return reinterpret_cast<plConvexHull>(computer);
+}
+
+int plConvexHullNumVertices(plConvexHull hull)
+{
+	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+	return computer->vertices.size();
+}
+
+int plConvexHullNumFaces(plConvexHull hull)
+{
+	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+	return computer->faces.size();
+}
+
+void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3],
+						   int *original_index)
+{
+	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+	const btVector3 &v(computer->vertices[n]);
+	coords[0] = v[0];
+	coords[1] = v[1];
+	coords[2] = v[2];
+	(*original_index) = computer->original_vertex_index[n];
+}
+
+int plConvexHullGetFaceSize(plConvexHull hull, int n)
+{
+	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+	const btConvexHullComputer::Edge *e_orig, *e;
+	int count;
+
+	for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0;
+		 count == 0 || e != e_orig;
+		 e = e->getNextEdgeOfFace(), count++);
+	return count;
+}
+
+void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices)
+{
+	btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+	const btConvexHullComputer::Edge *e_orig, *e;
+	int count;
+
+	for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0;
+		 count == 0 || e != e_orig;
+		 e = e->getNextEdgeOfFace(), count++)
+	{
+		vertices[count] = e->getTargetVertex();
+	}
+}
diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
index c03c901..4fd81da 100644
--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
+++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
@@ -2661,6 +2661,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
 	}
 
 	vertices.resize(0);
+	original_vertex_index.resize(0);
 	edges.resize(0);
 	faces.resize(0);
 
@@ -2671,6 +2672,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
 	{
 		btConvexHullInternal::Vertex* v = oldVertices[copied];
 		vertices.push_back(hull.getCoordinates(v));
+		original_vertex_index.push_back(v->point.index);
 		btConvexHullInternal::Edge* firstEdge = v->edges;
 		if (firstEdge)
 		{
diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.h b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
index 7240ac4..6871ce8 100644
--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.h
+++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
@@ -67,6 +67,7 @@ class btConvexHullComputer
 
 		// Vertices of the output hull
 		btAlignedObjectArray<btVector3> vertices;
+		btAlignedObjectArray<int> original_vertex_index;
 
 		// Edges of the output hull
 		btAlignedObjectArray<Edge> edges;
diff --git a/extern/carve/lib/intersect_face_division.cpp b/extern/carve/lib/intersect_face_division.cpp
index 08550c0..c74b52d 100644
--- a/extern/carve/lib/intersect_face_division.cpp
+++ b/extern/carve/lib/intersect_face_division.cpp
@@ -1106,7 +1106,8 @@ namespace {
         }
 
         // copy up to the end of the path.
-        std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out));
+		if (pos < e1_1)
+            std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out));
 
         CARVE_ASSERT(base_loop[e1_1] == p1.back());
         std::copy(p1.rbegin(), p1.rend() - 1, std::back_inserter(out));
diff --git a/extern/eltopo/CMakeLists.txt b/extern/eltopo/CMakeLists.txt
deleted file mode 100644
index 7cc23c9..0000000
--- a/extern/eltopo/CMakeLists.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurai, Erwin Coumans
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
-	.
-	common
-	eltopo3d
-	common/meshes
-	common/newsparse
-	common/tunicate
-)
-
-set(INC_SYS
-
-)
-
-set(SRC
-	eltopo-capi.cpp
-	common/bfstream.cpp
-	common/ccd_wrapper.cpp
-	common/clamped_spline.cpp
-	common/collisionqueries.cpp
-	common/cubic_ccd_wrapper.cpp
-	common/fe_ccd_wrapper.cpp
-	common/fileio.cpp
-	common/levelset.cpp
-	common/makelevelset2.cpp
-	common/makelevelset3.cpp
-	common/marching_triangles.cpp
-	common/predicates.cpp
-	common/runstats.cpp
-	common/sos_ccd_wrapper.cpp
-	common/wallclocktime.cpp
-	eltopo3d/accelerationgrid.cpp
-	eltopo3d/broadphasegrid.cpp
-	eltopo3d/collisionpipeline.cpp
-	eltopo3d/dynamicsurface.cpp
-	eltopo3d/edgecollapser.cpp
-	eltopo3d/edgeflipper.cpp
-	eltopo3d/edgesplitter.cpp
-	eltopo3d/eltopo.cpp
-	eltopo3d/impactzonesolver.cpp
-	eltopo3d/meshmerger.cpp
-	eltopo3d/meshsmoother.cpp
-	eltopo3d/meshpincher.cpp
-	eltopo3d/nondestructivetrimesh.cpp
-	eltopo3d/subdivisionscheme.cpp
-	eltopo3d/surftrack.cpp
-	eltopo3d/trianglequality.cpp
-	common/newsparse/dense_matrix.cpp
-	common/newsparse/krylov_solvers.cpp
-	common/newsparse/sparse_matrix.cpp
-	common/sparse/incomplete_qr.cpp
-	common/tunicate/expansion.cpp
-	common/tunicate/intersection.cpp
-	common/tunicate/neg.cpp
-	common/tunicate/orientation.cpp
-	common/tunicate/sos_intersection.cpp
-	common/tunicate/sos_orientation.cpp
-
-	eltopo-capi.h
-	common/array1.h
-	common/array2.h
-	common/array3.h
-	common/array3_utils.h
-	common/bfstream.h
-	common/blas_wrapper.h
-	common/ccd_wrapper.h
-	common/clamped_spline.h
-	common/collisionqueries.h
-	common/fileio.h
-	common/grid3.h
-	common/hashtable.h
-	common/lapack_wrapper.h
-	common/levelset.h
-	common/makelevelset2.h
-	common/makelevelset3.h
-	common/marching_triangles.h
-	common/mat.h
-	common/matlapack.h
-	common/openglutils.h
-	common/predicates.h
-	common/util.h
-	common/vec.h
-	common/vector_math.h
-	common/wallclocktime.h
-	eltopo3d/accelerationgrid.h
-	eltopo3d/broadphase.h
-	eltopo3d/broadphasegrid.h
-	eltopo3d/dynamicsurface.h
-	eltopo3d/eltopo.h
-	eltopo3d/nondestructivetrimesh.h
-	eltopo3d/options.h
-	eltopo3d/subdivisionscheme.h
-	eltopo3d/surftrack.h
-	common/newsparse/dense_matrix.h
-	common/newsparse/krylov_solvers.h
-	common/newsparse/linear_operator.h
-	common/newsparse/sparse_matrix.h
-	common/sparse/cgsolver.h
-	common/sparse/crsolver.h
-	common/sparse/incomplete_qr.h
-	common/sparse/sparseilu.h
-	common/sparse/sparsematrix.h
-	common/sparse/sparsemilu.h
-	common/tunicate/expansion.h
-	common/tunicate/neg.h
-	common/tunicate/tunicate.h
-	)
-
-add_definitions(-DNO_GUI)
-add_definitions(-DUSE_FORTRAN_BLAS)
-
-blender_add_lib(extern_eltopo "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/eltopo/SConscript b/extern/eltopo/SConscript
deleted file mode 100644
index 5ae8ebb..0000000
--- a/extern/eltopo/SConscript
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/python
-
-Import('env')
-
-import os
-
-defs = []
-
-
-eltopo_src = env.Glob("common/*.cpp") + env.Glob("eltopo3d/*.cpp") + env.Glob("common/newsparse/*.cpp") + env.Glob("common/tunicate/*.cpp") + env.Glob("common/sparse/*.cpp") + ["eltopo-capi.cpp"]
-eltopo_src.remove( "common" + os.sep + "gluvi.cpp" )
-eltopo_src.remove( "common" + os.sep + "openglutils.cpp" )
-
-defs.append('USE_FORTRAN_BLAS')
-defs.append('NO_GUI')
-
-incs = '. common eltopo3d common/newsparse common/meshes common/sparse common/tunicate'
-
-env.BlenderLib ('extern_eltopo3d', Split(eltopo_src), Split(incs), defs, libtype=['extern'], priority=[40] )
-
diff --git a/extern/eltopo/common/array1.h b/extern/eltopo/common/array1.h
deleted file mode 100644
index c0285be..0000000
--- a/extern/eltopo/common/array1.h
+++ /dev/null
@@ -1,799 +0,0 @@
-#ifndef ARRAY1_H
-#define ARRAY1_H
-
-#include <algorithm>
-#include <cassert>
-#include <climits>
-#include <cstdlib>
-#include <cstring>
-#include <iostream>
-#include <stdexcept>
-#include <vector>
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include "BaseTsd.h"
-typedef SSIZE_T ssize_t;
-#endif
-
-// In this file:
-//   Array1<T>: a dynamic 1D array for plain-old-data (not objects)
-//   WrapArray1<T>: a 1D array wrapper around an existing array (perhaps objects, perhaps data)
-// For the most part std::vector operations are supported, though for the Wrap version
-// note that memory is never allocated/deleted and constructor/destructors are never called
-// from within the class, thus only shallow copies can be made and some operations such as
-// resize() and push_back() are limited.
-// Note: for the most part assertions are done with assert(), not exceptions...
-
-// gross template hacking to determine if a type is integral or not
-struct Array1True {};
-struct Array1False {};
-template<typename T> struct Array1IsIntegral{ typedef Array1False type; }; // default: no (specializations to yes follow)
-template<> struct Array1IsIntegral<bool>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<char>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<signed char>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<unsigned char>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<short>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<unsigned short>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<int>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<unsigned int>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<long>{ typedef Array1True type; };
-template<> struct Array1IsIntegral<unsigned long>{ typedef Array1True type; };
-//template<> struct Array1IsIntegral<long long>{ typedef Array1True type; };
-//template<> struct Array1IsIntegral<unsigned long long>{ typedef Array1True type; };
-
-//============================================================================
-template<typename T>
-struct Array1
-{
-    // STL-friendly typedefs
-    
-    typedef T* iterator;
-    typedef const T* const_iterator;
-    typedef unsigned long size_type;
-    typedef long difference_type;
-    typedef T& reference;
-    typedef const T& const_reference;
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef std::reverse_iterator<iterator> reverse_iterator;
-    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-    
-    // the actual representation
-    
-    unsigned long n;
-    unsigned long max_n;
-    T* data;
-    
-    // STL vector's interface, with additions, but only valid when used with plain-old-data
-    
-    Array1(void)
-    : n(0), max_n(0), data(0)
-    {}
-    
-    // note: default initial values are zero
-    Array1(unsigned long n_)
-    : n(0), max_n(0), data(0)
-    {
-        if(n_>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        data=(T*)std::calloc(n_, sizeof(T));
-        if(!data) throw std::bad_alloc();
-        n=n_;
-        max_n=n_;
-    }
-    
-    Array1(unsigned long n_, const T& value)
-    : n(0), max_n(0), data(0)
-    {
-        if(n_>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        data=(T*)std::calloc(n_, sizeof(T));
-        if(!data) throw std::bad_alloc();
-        n=n_;
-        max_n=n_;
-        for(unsigned long i=0; i<n; ++i) data[i]=value;
-    }
-    
-    Array1(unsigned long n_, const T& value, unsigned long max_n_)
-    : n(0), max_n(0), data(0)
-    {
-        assert(n_<=max_n_);
-        if(max_n_>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        data=(T*)std::calloc(max_n_, sizeof(T));
-        if(!data) throw std::bad_alloc();
-        n=n_;
-        max_n=max_n_;
-        for(unsigned long i=0; i<n; ++i) data[i]=value;
-    }
-    
-    Array1(unsigned long n_, const T* data_)
-    : n(0), max_n(0), data(0)
-    {
-        if(n_>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        data=(T*)std::calloc(n_, sizeof(T));
-        if(!data) throw std::bad_alloc();
-        n=n_;
-        max_n=n_;
-        assert(data_);
-        std::memcpy(data, data_, n*sizeof(T));
-    }
-    
-    Array1(unsigned long n_, const T* data_, unsigned long max_n_)
-    : n(0), max_n(0), data(0)
-    {
-        assert(n_<=max_n_);
-        if(max_n_>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        data=(T*)std::calloc(max_n_, sizeof(T));
-        if(!data) throw std::bad_alloc();
-        max_n=max_n_;
-        n=n_;
-        assert(data_);
-        std::memcpy(data, data_, n*sizeof(T));
-    }
-    
-    Array1(const Array1<T> &x)
-    : n(0), max_n(0), data(0)
-    {
-        data=(T*)std::malloc(x.n*sizeof(T));
-        if(!data) throw std::bad_alloc();
-        n=x.n;
-        max_n=x.n;
-        std::memcpy(data, x.data, n*sizeof(T));
-    }
-    
-    ~Array1(void)
-    {
-        std::free(data);
-#ifndef NDEBUG
-        data=0;
-        n=max_n=0;
-#endif
-    }
-    
-    const T& operator[](unsigned long i) const
-    { return data[i]; }
-    
-    T& operator[](unsigned long i)
-    { return data[i]; }
-    
-    // these are range-checked (in debug mode) versions of operator[], like at()
-    const T& operator()(unsigned long i) const
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    T& operator()(unsigned long i)
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    Array1<T>& operator=(const Array1<T>& x)
-    {
-        if(max_n<x.n){
-            T* new_data=(T*)std::malloc(x.n*sizeof(T));
-            if(!new_data) throw std::bad_alloc();
-            std::free(data);
-            data=new_data;
-            max_n=x.n;
-        }
-        n=x.n;
-        std::memcpy(data, x.data, n*sizeof(T));
-        return *this;
-    }
-    
-    bool operator==(const Array1<T>& x) const
-    {
-        if(n!=x.n) return false;
-        for(unsigned long i=0; i<n; ++i) if(!(data[i]==x.data[i])) return false;
-        return true;
-    }
-    
-    bool operator!=(const Array1<T>& x) const
-    {
-        if(n!=x.n) return true;
-        for(unsigned long i=0; i<n; ++i) if(data[i]!=x.data[i]) return true;
-        return false;
-    }
-    
-    bool operator<(const Array1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]<x[i]) return true;
-            else if(x[i]<data[i]) return false;
-        }
-        return n<x.n;
-    }
-    
-    bool operator>(const Array1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]>x[i]) return true;
-            else if(x[i]>data[i]) return false;
-        }
-        return n>x.n;
-    }
-    
-    bool operator<=(const Array1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]<x[i]) return true;
-            else if(x[i]<data[i]) return false;
-        }
-        return n<=x.n;
-    }
-    
-    bool operator>=(const Array1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]>x[i]) return true;
-            else if(x[i]>data[i]) return false;
-        }
-        return n>=x.n;
-    }
-    
-    void add_unique(const T& value)
-    {
-        for(unsigned long i=0; i<n; ++i) if(data[i]==value) return;
-        if(n==max_n) grow();
-        data[n++]=value;
-    }
-    
-    void assign(const T& value)
-    { for(unsigned long i=0; i<n; ++i) data[i]=value; }
-    
-    void assign(unsigned long num, const T& value)
-    { fill(num, value); } 
-    
-    // note: copydata may not alias this array's data, and this should not be
-    // used when T is a full object (which defines its own copying operation)
-    void assign(unsigned long num, const T* copydata)
-    {
-        assert(num==0 || copydata);
-        if(num>max_n){
-            if(num>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-            std::free(data);
-            data=(T*)std::malloc(num*sizeof(T));
-            if(!data) throw std::bad_alloc();
-            max_n=num;
-        }
-        n=num;
-        std::memcpy(data, copydata, n*sizeof(T));
-    }
-    
-    template<typename InputIterator>
-    void assign(InputIterator first, InputIterator last)
-    { assign_(first, last, typename Array1IsIntegral<InputIterator>::type()); }
-    
-    template<typename InputIterator>
-    void assign_(InputIterator first, InputIterator last, Array1True )
-    { fill(first, last); }
-    
-    template<typename InputIterator>
-    void assign_(InputIterator first, InputIterator last, Array1False )
-    {
-        unsigned long i=0;
-        InputIterator p=first;
-        for(; p!=last; ++p, ++i){
-            if(i==max_n) grow();
-            data[i]=*p;
-        }
-        n=i;
-    }
-    
-    const T& at(unsigned long i) const
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    T& at(unsigned long i)
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    const T& back(void) const
-    { 
-        assert(data && n>0);
-        return data[n-1];
-    }
-    
-    T& back(void)
-    {
-        assert(data && n>0);
-        return data[n-1];
-    }
-    
-    const T* begin(void) const
-    { return data; }
-    
-    T* begin(void)
-    { return data; }
-    
-    unsigned long capacity(void) const
-    { return max_n; }
-    
-    void clear(void)
-    {
-        std::free(data);
-        data=0;
-        max_n=0;
-        n=0;
-    }
-    
-    bool empty(void) const
-    { return n==0; }
-    
-    const T* end(void) const
-    { return data+n; }
-    
-    T* end(void)
-    { return data+n; }
-    
-    void erase(unsigned long index)
-    {
-        assert(index<n);
-        for(unsigned long i=index; i<n-1; ++i)
-            data[i]=data[i-1];
-        pop_back();
-    }
-    
-    void fill(unsigned long num, const T& value)
-    {
-        if(num>max_n){
-            if(num>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-            std::free(data);
-            data=(T*)std::malloc(num*sizeof(T));
-            if(!data) throw std::bad_alloc();
-            max_n=num;
-        }
-        n=num;
-        for(unsigned long i=0; i<n; ++i) data[i]=value;
-    }
-    
-    const T& front(void) const
-    {
-        assert(n>0);
-        return *data;
-    }
-    
-    T& front(void)
-    {
-        assert(n>0);
-        return *data;
-    }
-    
-    void grow(void)
-    {
-        unsigned long new_size=(max_n*sizeof(T)<ULONG_MAX/2 ? 2*max_n+1 : ULONG_MAX/sizeof(T));
-        T *new_data=(T*)std::realloc(data, new_size*sizeof(T));
-        if(!new_data) throw std::bad_alloc();
-        data=new_data;
-        max_n=new_size;
-    }
-    
-    void insert(unsigned long index, const T& entry)
-    {
-        assert(index<=n);
-        push_back(back());
-        for(unsigned long i=n-1; i>index; --i)
-            data[i]=data[i-1];
-        data[index]=entry;
-    }
-    
-    unsigned long max_size(void) const
-    { return ULONG_MAX/sizeof(T); }
-    
-    void pop_back(void)
-    {
-        assert(n>0);
-        --n;
-    }
-    
-    void push_back(const T& value)
-    {
-        if(n==max_n) grow();
-        data[n++]=value;
-    }
-    
-    reverse_iterator rbegin(void)
-    { return reverse_iterator(end()); }
-    
-    const_reverse_iterator rbegin(void) const
-    { return const_reverse_iterator(end()); }
-    
-    reverse_iterator rend(void)
-    { return reverse_iterator(begin()); }
-    
-    const_reverse_iterator rend(void) const
-    { return const_reverse_iterator(begin()); }
-    
-    void reserve(unsigned long r)
-    {
-        if(r>ULONG_MAX/sizeof(T)) throw std::bad_alloc();
-        T *new_data=(T*)std::realloc(data, r*sizeof(T));
-        if(!new_data) throw std::bad_alloc();
-        data=new_data;
-        max_n=r;
-    }
-    
-    void resize(unsigned long n_)
-    {
-        if(n_>max_n) reserve(n_);
-        n=n_;
-    }
-    
-    void resize(unsigned long n_, const T& value)
-    {
-        if(n_>max_n) reserve(n_);
-        if(n<n_) for(unsigned long i=n; i<n_; ++i) data[i]=value;
-        n=n_;
-    }
-    
-    void set_zero(void)
-    { std::memset(data, 0, n*sizeof(T)); }
-    
-    unsigned long size(void) const
-    { return n; }
-    
-    void swap(Array1<T>& x)
-    {
-        std::swap(n, x.n);
-        std::swap(max_n, x.max_n);
-        std::swap(data, x.data);
-    }
-    
-    // resize the array to avoid wasted space, without changing contents
-    // (Note: realloc, at least on some platforms, will not do the trick)
-    void trim(void)
-    {
-        if(n==max_n) return;
-        T *new_data=(T*)std::malloc(n*sizeof(T));
-        if(!new_data) return;
-        std::memcpy(new_data, data, n*sizeof(T));
-        std::free(data);
-        data=new_data;
-        max_n=n;
-    }
-};
-
-// some common arrays
-
-typedef Array1<double>             Array1d;
-typedef Array1<float>              Array1f;
-//typedef Array1<long long>          Array1ll;
-//typedef Array1<unsigned long long> Array1ull;
-typedef Array1<int>                Array1i;
-typedef Array1<unsigned int>       Array1ui;
-typedef Array1<short>              Array1s;
-typedef Array1<unsigned short>     Array1us;
-typedef Array1<char>               Array1c;
-typedef Array1<unsigned char>      Array1uc;
-
-//============================================================================
-template<typename T>
-struct WrapArray1
-{
-    // STL-friendly typedefs
-    
-    typedef T* iterator;
-    typedef const T* const_iterator;
-    typedef unsigned long size_type;
-    typedef long difference_type;
-    typedef T& reference;
-    typedef const T& const_reference;
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef std::reverse_iterator<iterator> reverse_iterator;
-    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-    
-    // the actual representation
-    
-    unsigned long n;
-    unsigned long max_n;
-    T* data;
-    
-    // most of STL vector's interface, with a few changes
-    
-    WrapArray1(void)
-    : n(0), max_n(0), data(0)
-    {}
-    
-    WrapArray1(unsigned long n_, T* data_)
-    : n(n_), max_n(n_), data(data_)
-    { assert(data || max_n==0); }
-    
-    WrapArray1(unsigned long n_, T* data_, unsigned long max_n_)
-    : n(n_), max_n(max_n_), data(data_)
-    {
-        assert(n<=max_n);
-        assert(data || max_n==0);
-    }
-    
-    // Allow for simple shallow copies of existing arrays
-    // Note that if the underlying arrays change where their data is, the WrapArray may be screwed up
-    
-    WrapArray1(Array1<T>& a)
-    : n(a.n), max_n(a.max_n), data(a.data)
-    {}
-    
-    WrapArray1(std::vector<T>& a)
-    : n(a.size()), max_n(a.capacity()), data(&a[0])
-    {}
-    
-    void init(unsigned long n_, T* data_, unsigned long max_n_)
-    {
-        assert(n_<=max_n_);
-        assert(data_ || max_n_==0);
-        n=n_;
-        max_n=max_n_;
-        data=data_;
-    }
-    
-    const T& operator[](unsigned long i) const
-    { return data[i]; }
-    
-    T& operator[](unsigned long i)
-    { return data[i]; }
-    
-    // these are range-checked (in debug mode) versions of operator[], like at()
-    const T& operator()(unsigned long i) const
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    T& operator()(unsigned long i)
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    bool operator==(const WrapArray1<T>& x) const
-    {
-        if(n!=x.n) return false;
-        for(unsigned long i=0; i<n; ++i) if(!(data[i]==x.data[i])) return false;
-        return true;
-    }
-    
-    bool operator!=(const WrapArray1<T>& x) const
-    {
-        if(n!=x.n) return true;
-        for(unsigned long i=0; i<n; ++i) if(data[i]!=x.data[i]) return true;
-        return false;
-    }
-    
-    bool operator<(const WrapArray1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]<x[i]) return true;
-            else if(x[i]<data[i]) return false;
-        }
-        return n<x.n;
-    }
-    
-    bool operator>(const WrapArray1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]>x[i]) return true;
-            else if(x[i]>data[i]) return false;
-        }
-        return n>x.n;
-    }
-    
-    bool operator<=(const WrapArray1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]<x[i]) return true;
-            else if(x[i]<data[i]) return false;
-        }
-        return n<=x.n;
-    }
-    
-    bool operator>=(const WrapArray1<T>& x) const
-    {
-        for(unsigned long i=0; i<n && i<x.n; ++i){
-            if(data[i]>x[i]) return true;
-            else if(x[i]>data[i]) return false;
-        }
-        return n>=x.n;
-    }
-    
-    void add_unique(const T& value)
-    {
-        for(unsigned long i=0; i<n; ++i) if(data[i]==value) return;
-        assert(n<max_n);
-        data[n++]=value;
-    }
-    
-    void assign(const T& value)
-    { for(unsigned long i=0; i<n; ++i) data[i]=value; }
-    
-    void assign(unsigned long num, const T& value)
-    { fill(num, value); } 
-    
-    // note: copydata may not alias this array's data, and this should not be
-    // used when T is a full object (which defines its own copying operation)
-    void assign(unsigned long num, const T* copydata)
-    {
-        assert(num==0 || copydata);
-        assert(num<=max_n);
-        n=num;
-        std::memcpy(data, copydata, n*sizeof(T));
-    }
-    
-    template<typename InputIterator>
-    void assign(InputIterator first, InputIterator last)
-    { assign_(first, last, typename Array1IsIntegral<InputIterator>::type()); }
-    
-    template<typename InputIterator>
-    void assign_(InputIterator first, InputIterator last, Array1True )
-    { fill(first, last); }
-    
-    template<typename InputIterator>
-    void assign_(InputIterator first, InputIterator last, Array1False )
-    {
-        unsigned long i=0;
-        InputIterator p=first;
-        for(; p!=last; ++p, ++i){
-            assert(i<max_n);
-            data[i]=*p;
-        }
-        n=i;
-    }
-    
-    const T& at(unsigned long i) const
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    T& at(unsigned long i)
-    {
-        assert(i<n);
-        return data[i];
-    }
-    
-    const T& back(void) const
-    { 
-        assert(data && n>0);
-        return data[n-1];
-    }
-    
-    T& back(void)
-    {
-        assert(data && n>0);
-        return data[n-1];
-    }
-    
-    const T* begin(void) const
-    { return data; }
-    
-    T* begin(void)
-    { return data; }
-    
-    unsigned long capacity(void) const
-    { return max_n; }
-    
-    void clear(void)
-    { n=0; }
-    
-    bool empty(void) const
-    { return n==0; }
-    
-    const T* end(void) const
-    { return data+n; }
-    
-    T* end(void)
-    { return data+n; }
-    
-    void erase(unsigned long index)
-    {
-        assert(index<n);
-        for(unsigned long i=index; i<n-1; ++i)
-            data[i]=data[i-1];
-        pop_back();
-    }
-    
-    void fill(unsigned long num, const T& value)
-    {
-        assert(num<=max_n);
-        n=num;
-        for(unsigned long i=0; i<n; ++i) data[i]=value;
-    }
-    
-    const T& front(void) const
-    {
-        assert(n>0);
-        return *data;
-    }
-    
-    T& front(void)
-    {
-        assert(n>0);
-        return *data;
-    }
-    
-    void insert(unsigned long index, const T& entry)
-    {
-        assert(index<=n);
-        push_back(back());
-        for(unsigned long i=n-1; i>index; --i)
-            data[i]=data[i-1];
-        data[index]=entry;
-    }
-    
-    unsigned long max_size(void) const
-    { return max_n; }
-    
-    void pop_back(void)
-    {
-        assert(n>0);
-        --n;
-    }
-    
-    void push_back(const T& value)
-    {
-        assert(n<max_n);
-        data[n++]=value;
-    }
-    
-    reverse_iterator rbegin(void)
-    { return reverse_iterator(end()); }
-    
-    const_reverse_iterator rbegin(void) const
-    { return const_reverse_iterator(end()); }
-    
-    reverse_iterator rend(void)
-    { return reverse_iterator(begin()); }
-    
-    const_reverse_iterator rend(void) const
-    { return const_reverse_iterator(begin()); }
-    
-    void reserve(unsigned long r)
-    { assert(r<=max_n); }
-    
-    void resize(unsigned long n_)
-    {
-        assert(n_<=max_n);
-        n=n_;
-    }
-    
-    void resize(unsigned long n_, const T& value)
-    {
-        assert(n_<=max_n);
-        if(n<n_) for(unsigned long i=n; i<n_; ++i) data[i]=value;
-        n=n_;
-    }
-    
-    // note: shouldn't be used when T is a full object (setting to zero may not make sense)
-    void set_zero(void)
-    { std::memset(data, 0, n*sizeof(T)); }
-    
-    unsigned long size(void) const
-    { return n; }
-    
-    void swap(WrapArray1<T>& x)
-    {
-        std::swap(n, x.n);
-        std::swap(max_n, x.max_n);
-        std::swap(data, x.data);
-    }
-};
-
-// some common arrays
-
-typedef WrapArray1<double>             WrapArray1d;
-typedef WrapArray1<float>              WrapArray1f;
-//typedef WrapArray1<long long>          WrapArray1ll;
-//typedef WrapArray1<unsigned long long> WrapArray1ull;
-typedef WrapArray1<int>                WrapArray1i;
-typedef WrapArray1<unsigned int>       WrapArray1ui;
-typedef WrapArray1<short>              WrapArray1s;
-typedef WrapArray1<unsigned short>     WrapArray1us;
-typedef WrapArray1<char>               WrapArray1c;
-typedef WrapArray1<unsigned char>      WrapArray1uc;
-
-#endif
diff --git a/extern/eltopo/common/array2.h b/extern/eltopo/common/array2.h
deleted file mode 100644
index 046869b..0000000
--- a/extern/eltopo/common/array2.h
+++ /dev/null
@@ -1,321 +0,0 @@
-#ifndef ARRAY2_H
-#define ARRAY2_H
-
-#include <algorithm>
-#include <array1.h>
-#include <cassert>
-#include <vector>
-
-template<class T, class ArrayT=std::vector<T> >
-struct Array2
-{
-    // STL-friendly typedefs
-    
-    typedef typename ArrayT::iterator iterator;
-    typedef typename ArrayT::const_iterator const_iterator;
-    typedef typename ArrayT::size_type size_type;
-    typedef long difference_type;
-    typedef T& reference;
-    typedef const T& const_reference;
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef typename ArrayT::reverse_iterator reverse_iterator;
-    typedef typename ArrayT::const_reverse_iterator const_reverse_iterator;
-    
-    // the actual representation
-    
-    ssize_t ni, nj;
-    ArrayT a;
-    
-    // the interface
-    
-    Array2(void)
-    : ni(0), nj(0), a(0)
-    {}
-    
-    Array2(int ni_, int nj_)
-    : ni(ni_), nj(nj_), a(ni_*nj_)
-    { assert(ni_>=0 && nj>=0); }
-    
-    Array2(int ni_, int nj_, ArrayT& a_)
-    : ni(ni_), nj(nj_), a(a_)
-    { assert(ni_>=0 && nj>=0); }
-    
-    Array2(int ni_, int nj_, const T& value)
-    : ni(ni_), nj(nj_), a(ni_*nj_, value)
-    { assert(ni_>=0 && nj>=0); }
-    
-    Array2(int ni_, int nj_, const T& value, size_type max_n_)
-    : ni(ni_), nj(nj_), a(ni_*nj_, value, max_n_)
-    { assert(ni_>=0 && nj>=0); }
-    
-    Array2(int ni_, int nj_, T* data_)
-    : ni(ni_), nj(nj_), a(ni_*nj_, data_)
-    { assert(ni_>=0 && nj>=0); }
-    
-    Array2(int ni_, int nj_, T* data_, size_type max_n_)
-    : ni(ni_), nj(nj_), a(ni_*nj_, data_, max_n_)
-    { assert(ni_>=0 && nj>=0); }
-    
-    template<class OtherArrayT>
-    Array2(Array2<T, OtherArrayT>& other)
-    : ni(other.ni), nj(other.nj), a(other.a)
-    {}
-    
-    ~Array2(void)
-    {
-#ifndef NDEBUG
-        ni=nj=0;
-#endif
-    }
-    
-    //   const T& operator()(int i, int j) const
-    //   {
-    //      assert(i>=0 && i<ni && j>=0 && j<nj);
-    //      return a[i+ni*j];
-    //   }
-    //
-    //   T& operator()(int i, int j)
-    //   {
-    //      assert(i>=0 && i<ni && j>=0 && j<nj);
-    //      return a[i+ni*j];
-    //   }
-    
-    const T& operator()(ssize_t i, ssize_t j) const
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj);
-        return a[i+ni*j];
-    }
-    
-    T& operator()(ssize_t i, ssize_t j)
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj);
-        return a[i+ni*j];
-    }
-    
-    bool operator==(const Array2<T>& x) const
-    { return ni==x.ni && nj==x.nj && a==x.a; }
-    
-    bool operator!=(const Array2<T>& x) const
-    { return ni!=x.ni || nj!=x.nj || a!=x.a; }
-    
-    bool operator<(const Array2<T>& x) const
-    {
-        if(ni<x.ni) return true; else if(ni>x.ni) return false;
-        if(nj<x.nj) return true; else if(nj>x.nj) return false;
-        return a<x.a;
-    }
-    
-    bool operator>(const Array2<T>& x) const
-    {
-        if(ni>x.ni) return true; else if(ni<x.ni) return false;
-        if(nj>x.nj) return true; else if(nj<x.nj) return false;
-        return a>x.a;
-    }
-    
-    bool operator<=(const Array2<T>& x) const
-    {
-        if(ni<x.ni) return true; else if(ni>x.ni) return false;
-        if(nj<x.nj) return true; else if(nj>x.nj) return false;
-        return a<=x.a;
-    }
-    
-    bool operator>=(const Array2<T>& x) const
-    {
-        if(ni>x.ni) return true; else if(ni<x.ni) return false;
-        if(nj>x.nj) return true; else if(nj<x.nj) return false;
-        return a>=x.a;
-    }
-    
-    void assign(const T& value)
-    { a.assign(value); }
-    
-    void assign(int ni_, int nj_, const T& value)
-    {
-        a.assign(ni_*nj_, value);
-        ni=ni_;
-        nj=nj_;
-    }
-    
-    void assign(int ni_, int nj_, const T* copydata)
-    {
-        a.assign(ni_*nj_, copydata);
-        ni=ni_;
-        nj=nj_;
-    }
-    
-    const T& at(int i, int j) const
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj);
-        return a[i+ni*j];
-    }
-    
-    T& at(int i, int j)
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj);
-        return a[i+ni*j];
-    }
-    
-    const T& back(void) const
-    { 
-        assert(a.size());
-        return a.back();
-    }
-    
-    T& back(void)
-    {
-        assert(a.size());
-        return a.back();
-    }
-    
-    const_iterator begin(void) const
-    { return a.begin(); }
-    
-    iterator begin(void)
-    { return a.begin(); }
-    
-    size_type capacity(void) const
-    { return a.capacity(); }
-    
-    void clear(void)
-    {
-        a.clear();
-        ni=nj=0;
-    }
-    
-    bool empty(void) const
-    { return a.empty(); }
-    
-    const_iterator end(void) const
-    { return a.end(); }
-    
-    iterator end(void)
-    { return a.end(); }
-    
-    void fill(int ni_, int nj_, const T& value)
-    {
-        a.fill(ni_*nj_, value);
-        ni=ni_;
-        nj=nj_;
-    }
-    
-    const T& front(void) const
-    {
-        assert(a.size());
-        return a.front();
-    }
-    
-    T& front(void)
-    {
-        assert(a.size());
-        return a.front();
-    }
-    
-    size_type max_size(void) const
-    { return a.max_size(); }
-    
-    reverse_iterator rbegin(void)
-    { return reverse_iterator(end()); }
-    
-    const_reverse_iterator rbegin(void) const
-    { return const_reverse_iterator(end()); }
-    
-    reverse_iterator rend(void)
-    { return reverse_iterator(begin()); }
-    
-    const_reverse_iterator rend(void) const
-    { return const_reverse_iterator(begin()); }
-    
-    void reserve(int reserve_ni, int reserve_nj)
-    { a.reserve(reserve_ni*reserve_nj); }
-    
-    //   void resize(int ni_, int nj_)
-    //   {
-    //      assert(ni_>=0 && nj_>=0);
-    //      a.resize(ni_*nj_);
-    //      ni=ni_;
-    //      nj=nj_;
-    //   }
-    //
-    //   void resize(int ni_, int nj_, const T& value)
-    //   {
-    //      assert(ni_>=0 && nj_>=0);
-    //      a.resize(ni_*nj_, value);
-    //      ni=ni_;
-    //      nj=nj_;
-    //   }
-    
-    void resize(ssize_t ni_, ssize_t nj_)
-    {
-        assert(ni_>=0 && nj_>=0);
-        a.resize(ni_*nj_);
-        ni=ni_;
-        nj=nj_;
-    }
-    
-    void resize(size_t ni_, size_t nj_, const T& value)
-    {
-        assert(ni_>=0 && nj_>=0);
-        a.resize(ni_*nj_, value);
-        ni=ni_;
-        nj=nj_;
-    }
-    
-    void set_zero(void)
-    { a.set_zero(); }
-    
-    size_type size(void) const
-    { return a.size(); }
-    
-    void swap(Array2<T>& x)
-    {
-        std::swap(ni, x.ni);
-        std::swap(nj, x.nj);
-        a.swap(x.a);
-    }
-    
-    void trim(void)
-    { a.trim(); }
-    
-    
-    unsigned int sub2ind( unsigned int i, unsigned int j )
-    {
-        return i+ni*j;
-    }
-    
-    void ind2sub( unsigned int sub, unsigned int& i, unsigned int &j )
-    {
-        j = sub / ni;
-        i = sub - ni * j;
-    }
-    
-};
-
-// some common arrays
-
-typedef Array2<double, Array1<double> >                         Array2d;
-typedef Array2<float, Array1<float> >                           Array2f;
-//typedef Array2<long long, Array1<long long> >                   Array2ll;
-//typedef Array2<unsigned long long, Array1<unsigned long long> > Array2ull;
-typedef Array2<int, Array1<int> >                               Array2i;
-typedef Array2<unsigned int, Array1<unsigned int> >             Array2ui;
-typedef Array2<short, Array1<short> >                           Array2s;
-typedef Array2<unsigned short, Array1<unsigned short> >         Array2us;
-typedef Array2<char, Array1<char> >                             Array2c;
-typedef Array2<unsigned char, Array1<unsigned char> >           Array2uc;
-
-// and wrapped versions
-
-typedef Array2<double, WrapArray1<double> >                         WrapArray2d;
-typedef Array2<float, WrapArray1<float> >                           WrapArray2f;
-//typedef Array2<long long, WrapArray1<long long> >                   WrapArray2ll;
-//typedef Array2<unsigned long long, WrapArray1<unsigned long long> > WrapArray2ull;
-typedef Array2<int, WrapArray1<int> >                               WrapArray2i;
-typedef Array2<unsigned int, WrapArray1<unsigned int> >             WrapArray2ui;
-typedef Array2<short, WrapArray1<short> >                           WrapArray2s;
-typedef Array2<unsigned short, WrapArray1<unsigned short> >         WrapArray2us;
-typedef Array2<char, WrapArray1<char> >                             WrapArray2c;
-typedef Array2<unsigned char, WrapArray1<unsigned char> >           WrapArray2uc;
-
-#endif
diff --git a/extern/eltopo/common/array2_utils.h b/extern/eltopo/common/array2_utils.h
deleted file mode 100644
index 27d3ab9..0000000
--- a/extern/eltopo/common/array2_utils.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef ARRAY2_UTILS_H
-#define ARRAY2_UTILS_H
-
-#include "vec.h"
-#include "array2.h"
-#include "util.h"
-
-template<class S, class T>
-T interpolate_value(const Vec<2,S>& point, const Array2<T, Array1<T> >& grid) {
-    ssize_t i,j;
-    S fx,fy;
-    
-    get_barycentric(point[0], i, fx, 0, grid.ni);
-    get_barycentric(point[1], j, fy, 0, grid.nj);
-    
-    return bilerp(
-                  grid(i,j), grid(i+1,j), 
-                  grid(i,j+1), grid(i+1,j+1), 
-                  fx, fy);
-}
-
-template<class S, class T>
-float interpolate_gradient(Vec<2,T>& gradient, const Vec<2,S>& point, const Array2<T, Array1<T> >& grid) {
-    ssize_t i,j;
-    S fx,fy;
-    get_barycentric(point[0], i, fx, 0, grid.ni);
-    get_barycentric(point[1], j, fy, 0, grid.nj);
-    
-    T v00 = grid(i,j);
-    T v01 = grid(i,j+1);
-    T v10 = grid(i+1,j);
-    T v11 = grid(i+1,j+1);
-    
-    T ddy0 = (v01 - v00);
-    T ddy1 = (v11 - v10);
-    
-    T ddx0 = (v10 - v00);
-    T ddx1 = (v11 - v01);
-    
-    gradient[0] = lerp(ddx0,ddx1,fy);
-    gradient[1] = lerp(ddy0,ddy1,fx);
-    
-    //may as well return value too
-    return bilerp(v00, v10, v01, v11, fx, fy);
-}
-
-template<class T>
-void write_matlab_array(std::ostream &output, Array2<T, Array1<T> >&a, const char *variable_name, bool transpose=false)
-{
-    output<<variable_name<<"=[";
-    for(int j = 0; j < a.nj; ++j) {
-        for(int i = 0; i < a.ni; ++i)  {
-            output<<a(i,j)<<" ";
-        }
-        output<<";";
-    }
-    output<<"]";
-    if(transpose)
-        output<<"'";
-    output<<";"<<std::endl;
-}
-
-#endif
diff --git a/extern/eltopo/common/array3.h b/extern/eltopo/common/array3.h
deleted file mode 100644
index facc75c..0000000
--- a/extern/eltopo/common/array3.h
+++ /dev/null
@@ -1,284 +0,0 @@
-#ifndef ARRAY3_H
-#define ARRAY3_H
-
-#include <algorithm>
-#include <array1.h>
-#include <cassert>
-#include <vector>
-
-template<class T, class ArrayT=std::vector<T> >
-struct Array3
-{
-    // STL-friendly typedefs
-    
-    typedef typename ArrayT::iterator iterator;
-    typedef typename ArrayT::const_iterator const_iterator;
-    typedef typename ArrayT::size_type size_type;
-    typedef long difference_type;
-    typedef T& reference;
-    typedef const T& const_reference;
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef typename ArrayT::reverse_iterator reverse_iterator;
-    typedef typename ArrayT::const_reverse_iterator const_reverse_iterator;
-    
-    // the actual representation
-    
-    ssize_t ni, nj, nk;
-    ArrayT a;
-    
-    // the interface
-    
-    Array3(void)
-    : ni(0), nj(0), nk(0), a(0)
-    {}
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_)
-    : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_, ArrayT& a_)
-    : ni(ni_), nj(nj_), nk(nk_), a(a_)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_, const T& value)
-    : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, value)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_, const T& value, size_type max_n_)
-    : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, value, max_n_)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_, T* data_)
-    : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, data_)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    Array3(ssize_t ni_, ssize_t nj_, ssize_t nk_, T* data_, size_type max_n_)
-    : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, data_, max_n_)
-    { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-    
-    ~Array3(void)
-    {
-#ifndef NDEBUG
-        ni=nj=0;
-#endif
-    }
-    
-    //   const T& operator()(int i, int j, int k) const
-    //   {
-    //      assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-    //      return a[i+ni*(j+nj*k)];
-    //   }
-    //
-    //   T& operator()(int i, int j, int k)
-    //   {
-    //      assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-    //      return a[i+ni*(j+nj*k)];
-    //   }
-    
-    const T& operator()(ssize_t i, ssize_t j, ssize_t k) const
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-        return a[i+ni*(j+nj*k)];
-    }
-    
-    T& operator()(ssize_t i, ssize_t j, ssize_t k)
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-        return a[i+ni*(j+nj*k)];
-    }
-    
-    bool operator==(const Array3<T>& x) const
-    { return ni==x.ni && nj==x.nj && nk==x.nk && a==x.a; }
-    
-    bool operator!=(const Array3<T>& x) const
-    { return ni!=x.ni || nj!=x.nj || nk!=x.nk || a!=x.a; }
-    
-    bool operator<(const Array3<T>& x) const
-    {
-        if(ni<x.ni) return true; else if(ni>x.ni) return false;
-        if(nj<x.nj) return true; else if(nj>x.nj) return false;
-        if(nk<x.nk) return true; else if(nk>x.nk) return false;
-        return a<x.a;
-    }
-    
-    bool operator>(const Array3<T>& x) const
-    {
-        if(ni>x.ni) return true; else if(ni<x.ni) return false;
-        if(nj>x.nj) return true; else if(nj<x.nj) return false;
-        if(nk>x.nk) return true; else if(nk<x.nk) return false;
-        return a>x.a;
-    }
-    
-    bool operator<=(const Array3<T>& x) const
-    {
-        if(ni<x.ni) return true; else if(ni>x.ni) return false;
-        if(nj<x.nj) return true; else if(nj>x.nj) return false;
-        if(nk<x.nk) return true; else if(nk>x.nk) return false;
-        return a<=x.a;
-    }
-    
-    bool operator>=(const Array3<T>& x) const
-    {
-        if(ni>x.ni) return true; else if(ni<x.ni) return false;
-        if(nj>x.nj) return true; else if(nj<x.nj) return false;
-        if(nk>x.nk) return true; else if(nk<x.nk) return false;
-        return a>=x.a;
-    }
-    
-    void assign(const T& value)
-    { a.assign(value); }
-    
-    void assign(int ni_, int nj_, int nk_, const T& value)
-    {
-        a.assign(ni_*nj_*nk_, value);
-        ni=ni_;
-        nj=nj_;
-        nk=nk_;
-    }
-    
-    void assign(int ni_, int nj_, int nk_, const T* copydata)
-    {
-        a.assign(ni_*nj_*nk_, copydata);
-        ni=ni_;
-        nj=nj_;
-        nk=nk_;
-    }
-    
-    const T& at(int i, int j, int k) const
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-        return a[i+ni*(j+nj*k)];
-    }
-    
-    T& at(int i, int j, int k)
-    {
-        assert(i>=0 && i<ni && j>=0 && j<nj && k>=0 && k<nk);
-        return a[i+ni*(j+nj*k)];
-    }
-    
-    const T& back(void) const
-    { 
-        assert(a.size());
-        return a.back();
-    }
-    
-    T& back(void)
-    {
-        assert(a.size());
-        return a.back();
-    }
-    
-    const_iterator begin(void) const
-    { return a.begin(); }
-    
-    iterator begin(void)
-    { return a.begin(); }
-    
-    size_type capacity(void) const
-    { return a.capacity(); }
-    
-    void clear(void)
-    {
-        a.clear();
-        ni=nj=nk=0;
-    }
-    
-    bool empty(void) const
-    { return a.empty(); }
-    
-    const_iterator end(void) const
-    { return a.end(); }
-    
-    iterator end(void)
-    { return a.end(); }
-    
-    void fill(int ni_, int nj_, int nk_, const T& value)
-    {
-        a.fill(ni_*nj_*nk_, value);
-        ni=ni_;
-        nj=nj_;
-        nk=nk_;
-    }
-    
-    const T& front(void) const
-    {
-        assert(a.size());
-        return a.front();
-    }
-    
-    T& front(void)
-    {
-        assert(a.size());
-        return a.front();
-    }
-    
-    size_type max_size(void) const
-    { return a.max_size(); }
-    
-    reverse_iterator rbegin(void)
-    { return reverse_iterator(end()); }
-    
-    const_reverse_iterator rbegin(void) const
-    { return const_reverse_iterator(end()); }
-    
-    reverse_iterator rend(void)
-    { return reverse_iterator(begin()); }
-    
-    const_reverse_iterator rend(void) const
-    { return const_reverse_iterator(begin()); }
-    
-    void reserve(int reserve_ni, int reserve_nj, int reserve_nk)
-    { a.reserve(reserve_ni*reserve_nj*reserve_nk); }
-    
-    void resize(ssize_t ni_, ssize_t nj_, ssize_t nk_)
-    {
-        assert(ni_>=0 && nj_>=0 && nk_>=0);
-        a.resize(ni_*nj_*nk_);
-        ni=ni_;
-        nj=nj_;
-        nk=nk_;
-    }
-    
-    void resize(ssize_t ni_, ssize_t nj_, ssize_t nk_, const T& value)
-    {
-        assert(ni_>=0 && nj_>=0 && nk_>=0);
-        a.resize(ni_*nj_*nk_, value);
-        ni=ni_;
-        nj=nj_;
-        nk=nk_;
-    }
-    
-    void set_zero(void)
-    { a.set_zero(); }
-    
-    size_type size(void) const
-    { return a.size(); }
-    
-    void swap(Array3<T>& x)
-    {
-        std::swap(ni, x.ni);
-        std::swap(nj, x.nj);
-        std::swap(nk, x.nk);
-        a.swap(x.a);
-    }
-    
-    void trim(void)
-    { a.trim(); }
-};
-
-// some common arrays
-
-typedef Array3<double, Array1<double> > Array3d;
-typedef Array3<float, Array1<float> > Array3f;
-//typedef Array3<long long, Array1<long long> > Array3ll;
-//typedef Array3<unsigned long long, Array1<unsigned long long> > Array3ull;
-typedef Array3<int, Array1<int> > Array3i;
-typedef Array3<unsigned int, Array1<unsigned int> > Array3ui;
-typedef Array3<short, Array1<short> > Array3s;
-typedef Array3<unsigned short, Array1<unsigned short> > Array3us;
-typedef Array3<char, Array1<char> > Array3c;
-typedef Array3<unsigned char, Array1<unsigned char> > Array3uc;
-
-#endif
diff --git a/extern/eltopo/common/array3_utils.h b/extern/eltopo/common/array3_utils.h
deleted file mode 100644
index 7ce2970..0000000
--- a/extern/eltopo/common/array3_utils.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef ARRAY3_UTILS_H
-#define ARRAY3_UTILS_H
-
-#include <array3.h>
-#include <util.h>
-#include <vec.h>
-
-template<class S, class T>
-T cubic_interpolate_value(const Vec<3,S>& point, const Array3<T, Array1<T> >& grid) 
-{
-    ssize_t i,j,k;
-    S fi,fj,fk;
-    
-    get_barycentric(point[0], i, fi, 0, grid.ni);
-    get_barycentric(point[1], j, fj, 0, grid.nj);
-    get_barycentric(point[2], k, fk, 0, grid.nk);
-    
-    return tricubic_interp( grid, i-1, j-1, k-1, fi, fj, fk );
-    
-}
-
-
-template<class S, class T>
-T interpolate_value(const Vec<3,S>& point, const Array3<T, Array1<T> >& grid) {
-    ssize_t i,j,k;
-    S fi,fj,fk;
-    
-    get_barycentric(point[0], i, fi, 0, grid.ni);
-    get_barycentric(point[1], j, fj, 0, grid.nj);
-    get_barycentric(point[2], k, fk, 0, grid.nk);
-    
-    return trilerp(
-                   grid(i,j,k), grid(i+1,j,k), grid(i,j+1,k), grid(i+1,j+1,k), 
-                   grid(i,j,k+1), grid(i+1,j,k+1), grid(i,j+1,k+1), grid(i+1,j+1,k+1), 
-                   fi,fj,fk);
-}
-
-template<class S,class T>
-T interpolate_gradient(Vec<3,T>& gradient, const Vec<3,S>& point, const Array3<T, Array1<T> >& grid) {
-    ssize_t i,j,k;
-    S fx,fy,fz;
-    
-    get_barycentric(point[0], i, fx, 0, grid.ni);
-    get_barycentric(point[1], j, fy, 0, grid.nj);
-    get_barycentric(point[2], k, fz, 0, grid.nk);
-    
-    T v000 = grid(i,j,k);
-    T v001 = grid(i,j,k+1);
-    T v010 = grid(i,j+1,k);
-    T v011 = grid(i,j+1,k+1);
-    T v100 = grid(i+1,j,k);
-    T v101 = grid(i+1,j,k+1);
-    T v110 = grid(i+1,j+1,k);
-    T v111 = grid(i+1,j+1,k+1);
-    
-    T ddx00 = (v100 - v000);
-    T ddx10 = (v110 - v010);
-    T ddx01 = (v101 - v001);
-    T ddx11 = (v111 - v011);
-    T dv_dx = bilerp(ddx00,ddx10,ddx01,ddx11, fy,fz);
-    
-    T ddy00 = (v010 - v000);
-    T ddy10 = (v110 - v100);
-    T ddy01 = (v011 - v001);
-    T ddy11 = (v111 - v101);
-    T dv_dy = bilerp(ddy00,ddy10,ddy01,ddy11, fx,fz);
-    
-    T ddz00 = (v001 - v000);
-    T ddz10 = (v101 - v100);
-    T ddz01 = (v011 - v010);
-    T ddz11 = (v111 - v110);
-    T dv_dz = bilerp(ddz00,ddz10,ddz01,ddz11, fx,fy);
-    
-    gradient[0] = dv_dx;
-    gradient[1] = dv_dy;
-    gradient[2] = dv_dz;
-    
-    //return value for good measure.
-    return trilerp(
-                   v000, v100,
-                   v010, v110, 
-                   v001, v101,
-                   v011, v111,
-                   fx, fy, fz);
-}
-
-#endif
diff --git a/extern/eltopo/common/bfstream.cpp b/extern/eltopo/common/bfstream.cpp
deleted file mode 100644
index b162e04..0000000
--- a/extern/eltopo/common/bfstream.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <bfstream.h>
-
-bifstream &operator>>(bifstream &input, bool &d)
-{ d=(bool)input.get(); return input; } // note: on some platforms sizeof(bool)!=1
-
-bifstream &operator>>(bifstream &input, char &d)
-{ d=(char)input.get(); return input; }
-
-bifstream &operator>>(bifstream &input, signed char &d)
-{ d=(signed char)input.get(); return input; }
-
-bifstream &operator>>(bifstream &input, unsigned char &d)
-{ d=(unsigned char)input.get(); return input; }
-
-bifstream &operator>>(bifstream &input, short int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, unsigned short int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, unsigned int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, long int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, unsigned long int &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, float &d)
-{ return input.templated_read(d); }
-
-bifstream &operator>>(bifstream &input, double &d)
-{ return input.templated_read(d); }
-
-//=============================================================================
-
-bofstream &operator<<(bofstream &output, const bool &d)
-{ output.put((char)d); return output; }
-
-bofstream &operator<<(bofstream &output, const char &d)
-{ output.put(d); return output; }
-
-bofstream &operator<<(bofstream &output, const signed char &d)
-{ output.put((char)d); return output; }
-
-bofstream &operator<<(bofstream &output, const unsigned char &d)
-{ output.put((char)d); return output; }
-
-bofstream &operator<<(bofstream &output, const short int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const unsigned short int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const unsigned int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const long int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const unsigned long int &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const float &d)
-{ return output.templated_write(d); }
-
-bofstream &operator<<(bofstream &output, const double &d)
-{ return output.templated_write(d); }
-
diff --git a/extern/eltopo/common/bfstream.h b/extern/eltopo/common/bfstream.h
deleted file mode 100644
index b97f35e..0000000
--- a/extern/eltopo/common/bfstream.h
+++ /dev/null
@@ -1,373 +0,0 @@
-#ifndef BFSTREAM_H
-#define BFSTREAM_H
-
-#include <cassert>
-#include <cstdarg>
-#include <cstdlib>
-#include <fstream>
-
-#ifdef __BIG_ENDIAN__
-#ifdef __LITTLE_ENDIAN__
-#error Cannot be both big and little endian
-#endif
-#else
-#ifndef __LITTLE_ENDIAN__
-#error Need to define either big or little endian
-#endif
-#endif
-
-//=================================================================================
-template<class T> inline void swap_endianity(T &x)
-{
-    assert(sizeof(T)<=8); // should not be called on composite types: instead specialize swap_endianity if needed.
-    T old=x;
-    for(unsigned int k=0; k<sizeof(T); ++k)
-        ((char*)&x)[k] = ((char*)&old)[sizeof(T)-1-k];
-}
-
-
-//=================================================================================
-struct bifstream
-{
-    std::ifstream input;
-    bool big_endian;
-    
-    bifstream(void) :
-    input(),
-#ifdef __BIG_ENDIAN__
-    big_endian(true)
-#else
-    big_endian(false)
-#endif
-    {
-        assert_correct_endianity();
-    }
-    
-    bifstream(const char *filename_format, ...) :
-    input(),
-#ifdef __BIG_ENDIAN__
-    big_endian(true)
-#else
-    big_endian(false)
-#endif
-    {
-#ifdef WIN32
-        va_list ap;
-        va_start(ap, filename_format);
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        delete[] filename;
-        va_end(ap);
-#else
-        va_list ap;
-        va_start(ap, filename_format);
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        std::free(filename);
-        va_end(ap);
-#endif
-    }
-    
-    void assert_correct_endianity(void)
-    {
-        int test=1;
-#ifdef __BIG_ENDIAN__
-        assert(*(char*)&test == 0); // if this fails, you should have defined __LITTLE_ENDIAN__ instead
-#else
-        assert(*(char*)&test == 1); // if this fails, you should have defined __BIG_ENDIAN__ instead
-#endif
-    }
-    
-    void open(const char *filename_format, ...)
-    {
-#ifdef WIN32
-        va_list ap;
-        va_start(ap, filename_format);
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        delete[] filename;
-        va_end(ap);
-#else
-        va_list ap;
-        va_start(ap, filename_format);
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        std::free(filename);
-        va_end(ap);
-#endif
-    }
-    
-    void vopen(const char *filename_format, va_list ap)
-    {
-#ifdef WIN32
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        delete[] filename;
-#else
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        input.open(filename, std::ifstream::binary);
-        std::free(filename);
-#endif
-    }
-    
-    bool good(void)
-    { return input.good(); }
-    
-    bool fail(void)
-    { return input.fail(); }
-    
-    void close(void)
-    { input.close(); }
-    
-    void set_big_endian(void)
-    { big_endian=true; }
-    
-    void set_little_endian(void)
-    { big_endian=false; }
-    
-    void read_endianity(void)
-    { (*this)>>big_endian; }
-    
-    void skip(long numbytes)
-    { input.seekg(numbytes, std::ios_base::cur); }
-    
-    void seek(long position)
-    { input.seekg(position); }
-    
-    int get(void)
-    { return input.get(); }
-    
-private: // don't expose dangerous template
-    template<class T>
-    bifstream &templated_read(T &d)
-    {
-        input.read((char*)&d, sizeof(T));
-#ifdef __BIG_ENDIAN__
-        if(!big_endian)
-#else
-            if(big_endian)
-#endif
-                swap_endianity(d);
-        return *this;
-    }
-public:
-    
-    template<class T>
-    void read(T *d, unsigned int num)
-    {
-        assert(d!=0);
-        for(unsigned int i=0; i<num; ++i) (*this)>>d[i];
-    }
-    
-    friend bifstream &operator>>(bifstream &, bool &);
-    friend bifstream &operator>>(bifstream &, unsigned char &);
-    friend bifstream &operator>>(bifstream &, short int &);
-    friend bifstream &operator>>(bifstream &, unsigned short int &);
-    friend bifstream &operator>>(bifstream &, int &);
-    friend bifstream &operator>>(bifstream &, unsigned int &);
-    friend bifstream &operator>>(bifstream &, long int &);
-    friend bifstream &operator>>(bifstream &, unsigned long int &);
-    friend bifstream &operator>>(bifstream &, float &);
-    friend bifstream &operator>>(bifstream &, double &);
-};
-
-
-bifstream &operator>>(bifstream &input, bool &d);
-bifstream &operator>>(bifstream &input, char &d);
-bifstream &operator>>(bifstream &input, signed char &d);
-bifstream &operator>>(bifstream &input, unsigned char &d);
-bifstream &operator>>(bifstream &input, short int &d);
-bifstream &operator>>(bifstream &input, unsigned short int &d);
-bifstream &operator>>(bifstream &input, int &d);
-bifstream &operator>>(bifstream &input, unsigned int &d);
-bifstream &operator>>(bifstream &input, long int &d);
-bifstream &operator>>(bifstream &input, unsigned long int &d);
-bifstream &operator>>(bifstream &input, float &d);
-bifstream &operator>>(bifstream &input, double &d);
-
-
-//=================================================================================
-struct bofstream
-{
-    std::ofstream output;
-    bool big_endian;
-    
-    bofstream(void) :
-    output(),
-#ifdef __BIG_ENDIAN__
-    big_endian(true)
-#else
-    big_endian(false)
-#endif
-    {
-        assert_correct_endianity();
-    }
-    
-    bofstream(const char *filename_format, ...) :
-    output(),
-#ifdef __BIG_ENDIAN__
-    big_endian(true)
-#else
-    big_endian(false)
-#endif
-    {
-        assert_correct_endianity();
-#ifdef WIN32
-        va_list ap;
-        va_start(ap, filename_format);
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        delete[] filename;
-        va_end(ap);
-#else
-        va_list ap;
-        va_start(ap, filename_format);
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        std::free(filename);
-        va_end(ap);
-#endif
-    }
-    
-    void assert_correct_endianity(void)
-    {
-        int test=1;
-#ifdef __BIG_ENDIAN__
-        assert(*(char*)&test == 0); // if this fails, you should have defined __LITTLE_ENDIAN__ instead
-#else
-        assert(*(char*)&test == 1); // if this fails, you should have defined __BIG_ENDIAN__ instead
-#endif
-    }
-    
-    void open(const char *filename_format, ...)
-    {
-#ifdef WIN32
-        va_list ap;
-        va_start(ap, filename_format);
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        delete[] filename;
-        va_end(ap);
-#else
-        va_list ap;
-        va_start(ap, filename_format);
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        std::free(filename);
-        va_end(ap);
-#endif
-    }
-    
-    void vopen(const char *filename_format, va_list ap)
-    {
-        
-#ifdef WIN32
-        int len=_vscprintf(filename_format, ap) // _vscprintf doesn't count
-        +1; // terminating '\0'
-        char *filename=new char[len];
-        vsprintf(filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        delete[] filename;
-#else
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        output.open(filename, std::ofstream::binary);
-        std::free(filename);
-#endif
-    }
-    
-    bool good(void)
-    { return output.good(); }
-    
-    bool fail(void)
-    { return output.fail(); }
-    
-    void close(void)
-    { output.close(); }
-    
-    void set_big_endian(void)
-    { big_endian=true; }
-    
-    void set_little_endian(void)
-    { big_endian=false; }
-    
-    void write_endianity(void)
-    { (*this)<<big_endian; }
-    
-    void write_zero(unsigned int numbytes)
-    { for(unsigned int i=0; i<numbytes; ++i) output.put(0); }
-    
-    void put(char byte)
-    { output.put(byte); }
-    
-private: // don't expose dangerous templates
-    template<class T>
-    bofstream &templated_write(const T &d)
-    {
-#ifdef __BIG_ENDIAN__
-        if(!big_endian)
-#else
-            if(big_endian)
-#endif
-            {
-                T swapped_copy=d;
-                swap_endianity(swapped_copy);
-                output.write((const char*)&swapped_copy, sizeof(T));
-            }else
-                output.write((const char*)&d, sizeof(T));
-        return *this;
-    }
-public:
-    
-    template<class T>
-    void write(const T *d, unsigned int num)
-    {
-        assert(d!=0);
-        for(unsigned int i=0; i<num; ++i) (*this)<<d[i];
-    }
-    
-    friend bofstream &operator<<(bofstream &, const bool &);
-    friend bofstream &operator<<(bofstream &, const short int &);
-    friend bofstream &operator<<(bofstream &, const unsigned short int &);
-    friend bofstream &operator<<(bofstream &, const int &);
-    friend bofstream &operator<<(bofstream &, const unsigned int &);
-    friend bofstream &operator<<(bofstream &, const long int &);
-    friend bofstream &operator<<(bofstream &, const unsigned long int &);
-    friend bofstream &operator<<(bofstream &, const float &);
-    friend bofstream &operator<<(bofstream &, const double &);
-};
-
-bofstream &operator<<(bofstream &output, const bool &d);
-bofstream &operator<<(bofstream &output, const char &d);
-bofstream &operator<<(bofstream &output, const signed char &d);
-bofstream &operator<<(bofstream &output, const unsigned char &d);
-bofstream &operator<<(bofstream &output, const short int &d);
-bofstream &operator<<(bofstream &output, const unsigned short int &d);
-bofstream &operator<<(bofstream &output, const int &d);
-bofstream &operator<<(bofstream &output, const unsigned int &d);
-bofstream &operator<<(bofstream &output, const long int &d);
-bofstream &operator<<(bofstream &output, const unsigned long int &d);
-bofstream &operator<<(bofstream &output, const float &d);
-bofstream &operator<<(bofstream &output, const double &d);
-
-#endif
diff --git a/extern/eltopo/common/blas_wrapper.h b/extern/eltopo/common/blas_wrapper.h
deleted file mode 100644
index 58ba719..0000000
--- a/extern/eltopo/common/blas_wrapper.h
+++ /dev/null
@@ -1,598 +0,0 @@
-#ifndef BLAS_WRAPPER_H
-#define BLAS_WRAPPER_H
-
-#include <cassert>
-#include <cmath>
-#include <cstring>
-#include <vector>
-
-// Useful dense kernels from BLAS, with readable, overloaded, cross-platform names and some simplified calling
-//  dot    (dot-product of vectors)
-//  nrm2   (2-norm of a vector)
-//  asum   (1-norm of a vector)
-//  amax   (index of maximum absolute value in a vector)
-//  swap   (exchanging values in two vectors)
-//  copy   (copying values from one vector to another)
-//  axpy   (adding a scalar times a vector to another vector)
-//  scal   (multiplying a vector by a scalar)
-//  gemv   (multiplying a matrix times a vector, scaling, and adding result to another vector))
-//  gemm   (multiplying two matrices, scaling, and adding result to another matrix)
-// In addition:
-//  set_zero  (zero out all entries in a vector)
-//  abs_max   (return the infinity norm of a vector, i.e. the magnitude of its largest element)
-// There are also version using std::vector for convenience.
-
-// Matrices are always assumed to be in column-major format.
-
-// You can #define one of:
-//    USE_FORTRAN_BLAS (if your BLAS calls should look like dgemm_ with FORTRAN calling conventions, as in GOTO BLAS)
-//    USE_AMD_BLAS     (if using the AMD Math Library)
-//    USE_CBLAS        (if instead you have calls like cblas_dgemm, and have a file "cblas.h" available)
-// or, if you're on the Mac, it will default to the vecLib CBLAS if none of these are specified.
-
-namespace BLAS{
-    
-    template<class T>
-    inline void set_zero(int n, T *x)
-    { std::memset(x, 0, n*sizeof(T)); }
-    
-}
-
-//============================================================================
-#ifdef USE_FORTRAN_BLAS
-
-extern "C" {
-    double dsdot_(const int*, const float*, const int*, const float*, const int*);
-    double sdot_(const int*, const float*, const int*, const float*, const int*);
-    double ddot_(const int*, const double*, const int*, const double*, const int*);
-    float snrm2_(const int*, const float*, const int*);
-    double dnrm2_(const int*, const double*, const int*);
-    float sasum_(const int*, const float*, const int*);
-    double dasum_(const int*, const double*, const int*);
-    int isamax_(const int*, const float*, const int*);
-    int idamax_(const int*, const double*, const int*);
-    void sswap_(const int*, float*, const int*, float*, const int*);
-    void dswap_(const int*, double*, const int*, double*, const int*);
-    void scopy_(const int*, const float*, const int*, float*, const int*);
-    void dcopy_(const int*, const double*, const int*, double*, const int*);
-    void saxpy_(const int*, const float*, const float*, const int*, float*, const int*);
-    void daxpy_(const int*, const double*, const double*, const int*, double*, const int*);
-    void sscal_(const int*, const float*, float*, const int*);
-    void dscal_(const int*, const double*, double*, const int*);
-    void sgemv_(const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
-    void dgemv_(const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
-    void sgemm_(const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
-    void dgemm_(const char*, const char*, const int*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
-}
-
-namespace BLAS{
-    
-    enum Transpose {NoTrans='N', Trans='T'};
-    enum UpperLower {Upper='U', Lower='L'};
-    enum UnitDiag {NonUnit='N', Unit='U'};
-    enum Side {Left='L', Right='R'};
-    
-    // dot products
-    
-    inline double dot(int n, const float *x, int incx, const float *y, int incy=1)
-    { return dsdot_(&n, x, &incx, y, &incy); }
-    
-    inline double dot(int n, const float *x, const float *y, int incy=1)
-    { const int one=1; return dsdot_(&n, x, &one, y, &incy); }
-    
-    inline float dotf(int n, const float *x, int incx, const float *y, int incy=1)
-    { return (float)sdot_(&n, x, &incx, y, &incy); }
-    
-    inline float dotf(int n, const float *x, const float *y, int incy=1)
-    { const int one=1; return (float)sdot_(&n, x, &one, y, &incy); }
-    
-    inline double dot(int n, const double *x, int incx, const double *y, int incy=1)
-    { return ddot_(&n, x, &incx, y, &incy); }
-    
-    inline double dot(int n, const double *x, const double *y, int incy=1)
-    { const int one=1; return ddot_(&n, x, &one, y, &incy); }
-    
-    // 2-norm 
-    
-    inline float norm2(int n, const float *x, int incx=1)
-    { return snrm2_(&n, x, &incx); }
-    
-    inline double norm2(int n, const double *x, int incx=1)
-    { return dnrm2_(&n, x, &incx); }
-    
-    // 1-norm (sum of absolute values)
-    
-    inline float abs_sum(int n, const float *x, int incx=1)
-    { return sasum_(&n, x, &incx); }
-    
-    inline double abs_sum(int n, const double *x, int incx=1)
-    { return dasum_(&n, x, &incx); }
-    
-    // inf-norm (maximum absolute value: index of max returned)
-    
-    inline int index_abs_max(int n, const float *x, int incx=1)
-    { return isamax_(&n, x, &incx)-1; }
-    
-    inline int index_abs_max(int n, const double *x, int incx=1)
-    { return idamax_(&n, x, &incx)-1; }
-    
-    inline float abs_max(int n, const float *x, int incx=1)
-    { return std::fabs(x[isamax_(&n, x, &incx)-1]); }
-    
-    inline double abs_max(int n, const double *x, int incx=1)
-    { return std::fabs(x[idamax_(&n, x, &incx)-1]); }
-    
-    // swap (actual data exchanged, not just pointers)
-    
-    inline void swap(int n, float *x, int incx, float *y, int incy=1)
-    { sswap_(&n, x, &incx, y, &incy); }
-    
-    inline void swap(int n, float *x, float *y, int incy=1)
-    { const int one=1; sswap_(&n, x, &one, y, &incy); }
-    
-    inline void swap(int n, double *x, int incx, double *y, int incy=1)
-    { dswap_(&n, x, &incx, y, &incy); }
-    
-    inline void swap(int n, double *x, double *y, int incy=1)
-    { const int one=1; dswap_(&n, x, &one, y, &incy); }
-    
-    // copy (y=x)
-    
-    inline void copy(int n, const float *x, int incx, float *y, int incy=1)
-    { scopy_(&n, x, &incx, y, &incy); }
-    
-    inline void copy(int n, const float *x, float *y, int incy=1)
-    { const int one=1; scopy_(&n, x, &one, y, &incy); }
-    
-    inline void copy(int n, const double *x, int incx, double *y, int incy=1)
-    { dcopy_(&n, x, &incx, y, &incy); }
-    
-    inline void copy(int n, const double *x, double *y, int incy=1)
-    { const int one=1; dcopy_(&n, x, &one, y, &incy); }
-    
-    // saxpy (y=alpha*x+y)
-    
-    inline void add_scaled(int n, float alpha, const float *x, int incx, float *y, int incy=1)
-    { saxpy_(&n, &alpha, x, &incx, y, &incy); }
-    
-    inline void add_scaled(int n, float alpha, const float *x, float *y, int incy=1)
-    { const int one=1; saxpy_(&n, &alpha, x, &one, y, &incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, int incx, double *y, int incy=1)
-    { daxpy_(&n, &alpha, x, &incx, y, &incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, double *y, int incy=1)
-    { const int one=1; daxpy_(&n, &alpha, x, &one, y, &incy); }
-    
-    // scale (x=alpha*x)
-    
-    inline void scale(int n, float alpha, float *x, int incx=1)
-    { sscal_(&n, &alpha, x, &incx); }
-    
-    inline void scale(int n, double alpha, double *x, int incx=1)
-    { dscal_(&n, &alpha, x, &incx); }
-    
-    // gemv (y=alpha*A*x+beta*y, or using A^T)
-    // The matrix is always m*n; the size of x and y depend on if A is transposed.
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, float alpha, const float *A, int lda,
-                                       const float *x, int incx, float beta, float *y, int incy=1)
-    { sgemv_((const char*)&transpose, &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const float *A, const float *x, float *y, int incy=1) // y=A*x
-    { const int onei=1; const float zero=0, onef=1; sgemv_("N", &m, &n, &onef, A, &m, x, &onei, &zero, y, &incy); }
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, double alpha, const double *A, int lda,
-                                       const double *x, int incx, double beta, double *y, int incy=1)
-    { dgemv_((const char*)&transpose, &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const double *A, const double *x, double *y, int incy=1) // y=A*x
-    { const int onei=1; const double zero=0, onef=1; dgemv_("N", &m, &n, &onef, A, &m, x, &onei, &zero, y, &incy); }
-    
-    // gemm (C=alpha*A*B+beta*C)
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, float alpha, const float *A, int lda,
-                                       const float *B, int ldb, float beta, float *C, int ldc)
-    { sgemm_((const char*)&transA, (const char*)&transB, &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const float *A, const float *B, float *C) 
-    { const float zero=0, one=1; sgemm_("N", "N", &m, &n, &k, &one, A, &m, B, &k, &zero, C, &m); } // C=A*B
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, double alpha, const double *A, int lda,
-                                       const double *B, int ldb, double beta, double *C, int ldc)
-    { dgemm_((const char*)&transA, (const char*)&transB, &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const double *A, const double *B, double *C) 
-    { const double zero=0, one=1; dgemm_("N", "N", &m, &n, &k, &one, A, &m, B, &k, &zero, C, &m); } // C=A*B
-    
-}
-
-//============================================================================
-#elif defined USE_AMD_BLAS
-
-#include <acml.h>
-
-namespace BLAS{
-    
-    enum Transpose {NoTrans='N', Trans='T'};
-    enum UpperLower {Upper='U', Lower='L'};
-    enum UnitDiag {NonUnit='N', Unit='U'};
-    enum Side {Left='L', Right='R'};
-    
-    // dot products
-    
-    inline double dot(int n, const float *x, int incx, const float *y, int incy=1)
-    { return dsdot(n, (float*)x, incx, (float*)y, incy); }
-    
-    inline double dot(int n, const float *x, const float *y, int incy=1)
-    { return dsdot(n, (float*)x, 1, (float*)y, incy); }
-    
-    inline float dotf(int n, const float *x, int incx, const float *y, int incy=1)
-    { return sdot(n, (float*)x, incx, (float*)y, incy); }
-    
-    inline float dotf(int n, const float *x, const float *y, int incy=1)
-    { return sdot(n, (float*)x, 1, (float*)y, incy); }
-    
-    inline double dot(int n, const double *x, int incx, const double *y, int incy=1)
-    { return ddot(n, (double *)x, incx, (double *)y, incy); }
-    
-    inline double dot(int n, const double *x, const double *y, int incy=1)
-    { return ddot(n, (double *)x, 1, (double *)y, incy); }
-    
-    // 2-norm 
-    
-    inline float norm2(int n, const float *x, int incx=1)
-    { return snrm2(n, (float*)x, incx); }
-    
-    inline double norm2(int n, const double *x, int incx=1)
-    { return dnrm2(n, (double*)x, incx); }
-    
-    // 1-norm (sum of absolute values)
-    
-    inline float abs_sum(int n, const float *x, int incx=1)
-    { return sasum(n, (float*)x, incx); }
-    
-    inline double abs_sum(int n, const double *x, int incx=1)
-    { return dasum(n, (double*)x, incx); }
-    
-    // inf-norm (maximum absolute value: index of max returned)
-    
-    inline int index_abs_max(int n, const float *x, int incx=1)
-    { return isamax(n, (float*)x, incx)-1; }
-    
-    inline int index_abs_max(int n, const double *x, int incx=1)
-    { return idamax(n, (double*)x, incx)-1; }
-    
-    inline float abs_max(int n, const float *x, int incx=1)
-    { return std::fabs(x[isamax(n, (float*)x, incx)]-1); }
-    
-    inline double abs_max(int n, const double *x, int incx=1)
-    { return std::fabs(x[idamax(n, (double*)x, incx)]-1); }
-    
-    // swap (actual data exchanged, not just pointers)
-    
-    inline void swap(int n, float *x, int incx, float *y, int incy=1)
-    { sswap(n, x, incx, y, incy); }
-    
-    inline void swap(int n, float *x, float *y, int incy=1)
-    { sswap(n, x, 1, y, incy); }
-    
-    inline void swap(int n, double *x, int incx, double *y, int incy=1)
-    { dswap(n, x, incx, y, incy); }
-    
-    inline void swap(int n, double *x, double *y, int incy=1)
-    { dswap(n, x, 1, y, incy); }
-    
-    // copy (y=x)
-    
-    inline void copy(int n, const float *x, int incx, float *y, int incy=1)
-    { scopy(n, (float*)x, incx, y, incy); }
-    
-    inline void copy(int n, const float *x, float *y, int incy=1)
-    { scopy(n, (float*)x, 1, y, incy); }
-    
-    inline void copy(int n, const double *x, int incx, double *y, int incy=1)
-    { dcopy(n, (double *)x, incx, y, incy); }
-    
-    inline void copy(int n, const double *x, double *y, int incy=1)
-    { dcopy(n, (double *)x, 1, y, incy); }
-    
-    // saxpy (y=alpha*x+y)
-    
-    inline void add_scaled(int n, float alpha, const float *x, int incx, float *y, int incy=1)
-    { saxpy(n, alpha, (float*)x, incx, y, incy); }
-    
-    inline void add_scaled(int n, float alpha, const float *x, float *y, int incy=1)
-    { saxpy(n, alpha, (float*)x, 1, y, incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, int incx, double *y, int incy=1)
-    { daxpy(n, alpha, (double*)x, incx, y, incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, double *y, int incy=1)
-    { daxpy(n, alpha, (double*)x, 1, y, incy); }
-    
-    // scale (x=alpha*x)
-    
-    inline void scale(int n, float alpha, float *x, int incx=1)
-    { sscal(n, alpha, x, incx); }
-    
-    inline void scale(int n, double alpha, double *x, int incx=1)
-    { dscal(n, alpha, x, incx); }
-    
-    // gemv (y=alpha*A*x+beta*y, or using A^T)
-    // The matrix is always m*n; the size of x and y depend on if A is transposed.
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, float alpha, const float *A, int lda,
-                                       const float *x, int incx, float beta, float *y, int incy=1)
-    { sgemv(transpose, m, n, alpha, (float*)A, lda, (float*)x, incx, beta, y, incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const float *A, const float *x, float *y, int incy=1) // y=A*x
-    { sgemv(NoTrans, m, n, 1.f, (float*)A, m, (float*)x, 1, 0.f, y, incy); }
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, double alpha, const double *A, int lda,
-                                       const double *x, int incx, double beta, double *y, int incy=1)
-    { dgemv(transpose, m, n, alpha, (double*)A, lda, (double*)x, incx, beta, y, incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const double *A, const double *x, double *y, int incy=1) // y=A*x
-    { dgemv(NoTrans, m, n, 1., (double*)A, m, (double*)x, 1, 0., y, incy); }
-    
-    // gemm (C=alpha*A*B+beta*C)
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, float alpha, const float *A, int lda,
-                                       const float *B, int ldb, float beta, float *C, int ldc)
-    { sgemm(transA, transB, m, n, k, alpha, (float*)A, lda, (float*)B, ldb, beta, C, ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const float *A, const float *B, float *C) 
-    { sgemm(NoTrans, NoTrans, m, n, k, 1.f, (float*)A, m, (float*)B, k, 0.f, C, m); } // C=A*B
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, double alpha, const double *A, int lda,
-                                       const double *B, int ldb, double beta, double *C, int ldc)
-    { dgemm(transA, transB, m, n, k, alpha, (double*)A, lda, (double*)B, ldb, beta, C, ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const double *A, const double *B, double *C) 
-    { dgemm(NoTrans, NoTrans, m, n, k, 1., (double*)A, m, (double*)B, k, 0., C, m); } // C=A*B
-    
-};
-
-//============================================================================
-#elif defined USE_CBLAS || defined __APPLE__
-
-#ifdef USE_CBLAS
-#include <cblas.h>
-#elif defined __APPLE__
-#include <vecLib/cblas.h>
-#endif
-
-namespace BLAS{
-    
-    enum Transpose {NoTrans=CblasNoTrans, Trans=CblasTrans};
-    enum UpperLower {Upper=CblasUpper, Lower=CblasLower};
-    enum UnitDiag {NonUnit=CblasNonUnit, Unit=CblasUnit};
-    enum Side {Left=CblasLeft, Right=CblasRight};
-    
-    // dot products
-    
-    inline float dotf(int n, const float *x, int incx, const float *y, int incy=1)
-    { return cblas_sdot(n, x, incx, y, incy); }
-    
-    inline float dotf(int n, const float *x, const float *y, int incy=1)
-    { return cblas_sdot(n, x, 1, y, incy); }
-    
-    inline double dot(int n, const float *x, int incx, const float *y, int incy=1)
-    { return cblas_dsdot(n, x, incx, y, incy); }
-    
-    inline double dot(int n, const float *x, const float *y, int incy=1)
-    { return cblas_dsdot(n, x, 1, y, incy); }
-    
-    inline double dot(int n, const double *x, int incx, const double *y, int incy=1)
-    { return cblas_ddot(n, x, incx, y, incy); }
-    
-    inline double dot(int n, const double *x, const double *y, int incy=1)
-    { return cblas_ddot(n, x, 1, y, incy); }
-    
-    // 2-norm
-    
-    inline float norm2(int n, const float *x, int incx=1)
-    { return cblas_snrm2(n, x, incx); }
-    
-    inline double norm2(int n, const double *x, int incx=1)
-    { return cblas_dnrm2(n, x, incx); }
-    
-    // 1-norm (sum of absolute values)
-    
-    inline float abs_sum(int n, const float *x, int incx=1)
-    { return cblas_sasum(n, x, incx); }
-    
-    inline double abs_sum(int n, const double *x, int incx=1)
-    { return cblas_dasum(n, x, incx); }
-    
-    // inf-norm (maximum absolute value)
-    
-    inline int index_abs_max(int n, const float *x, int incx=1)
-    { return cblas_isamax(n, x, incx); }
-    
-    inline int index_abs_max(int n, const double *x, int incx=1)
-    { return cblas_idamax(n, x, incx); }
-    
-    inline float abs_max(int n, const float *x, int incx=1)
-    { return std::fabs(x[cblas_isamax(n, x, incx)]); }
-    
-    inline double abs_max(int n, const double *x, int incx=1)
-    { return std::fabs(x[cblas_idamax(n, x, incx)]); }
-    
-    // swap (actual data exchanged, not just pointers)
-    
-    inline void swap(int n, float *x, int incx, float *y, int incy=1)
-    { cblas_sswap(n, x, incx, y, incy); }
-    
-    inline void swap(int n, float *x, float *y, int incy=1)
-    { cblas_sswap(n, x, 1, y, incy); }
-    
-    inline void swap(int n, double *x, int incx, double *y, int incy=1)
-    { cblas_dswap(n, x, incx, y, incy); }
-    
-    inline void swap(int n, double *x, double *y, int incy=1)
-    { cblas_dswap(n, x, 1, y, incy); }
-    
-    // copy (y=x)
-    
-    inline void copy(int n, const float *x, int incx, float *y, int incy=1)
-    { cblas_scopy(n, x, incx, y, incy); }
-    
-    inline void copy(int n, const float *x, float *y, int incy=1)
-    { cblas_scopy(n, x, 1, y, incy); }
-    
-    inline void copy(int n, const double *x, int incx, double *y, int incy=1)
-    { cblas_dcopy(n, x, incx, y, incy); }
-    
-    inline void copy(int n, const double *x, double *y, int incy=1)
-    { cblas_dcopy(n, x, 1, y, incy); }
-    
-    // saxpy (y=alpha*x+y)
-    
-    inline void add_scaled(int n, float alpha, const float *x, int incx, float *y, int incy=1)
-    { cblas_saxpy(n, alpha, x, incx, y, incy); }
-    
-    inline void add_scaled(int n, float alpha, const float *x, float *y, int incy=1)
-    { cblas_saxpy(n, alpha, x, 1, y, incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, int incx, double *y, int incy=1)
-    { cblas_daxpy(n, alpha, x, incx, y, incy); }
-    
-    inline void add_scaled(int n, double alpha, const double *x, double *y, int incy=1)
-    { cblas_daxpy(n, alpha, x, 1, y, incy); }
-    
-    // scale (x=alpha*x)
-    
-    inline void scale(int n, float alpha, float *x, int incx=1)
-    { cblas_sscal(n, alpha, x, incx); }
-    
-    inline void scale(int n, double alpha, double *x, int incx=1)
-    { cblas_dscal(n, alpha, x, incx); }
-    
-    // gemv (y=alpha*A*x+beta*y, or using A^T)
-    // The matrix is always m*n; the size of x and y depend on if A is transposed.
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, float alpha, const float *A, int lda,
-                                       const float *x, int incx,
-                                       float beta, float *y, int incy=1)
-    { cblas_sgemv(CblasColMajor, (CBLAS_TRANSPOSE)transpose, m, n, alpha, A, lda, x, incx, beta, y, incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const float *A, const float *x, float *y, int incy=1) // y=A*x
-    { cblas_sgemv(CblasColMajor, CblasNoTrans, m, n, 1.f, A, m, x, 1, 0.f, y, incy); }
-    
-    inline void multiply_matrix_vector(Transpose transpose,
-                                       int m, int n, double alpha, const double *A, int lda,
-                                       const double *x, int incx, double beta, double *y, int incy=1)
-    { cblas_dgemv(CblasColMajor, (CBLAS_TRANSPOSE)transpose, m, n, alpha, A, lda, x, incx, beta, y, incy); }
-    
-    inline void multiply_matrix_vector(int m, int n, const double *A, const double *x, double *y, int incy=1) // y=A*x
-    { cblas_dgemv(CblasColMajor, CblasNoTrans, m, n, 1., A, m, x, 1, 0., y, incy); }
-    
-    // gemm (C=alpha*A*B+beta*C)
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, float alpha, const float *A, int lda,
-                                       const float *B, int ldb, float beta, float *C, int ldc)
-    { cblas_sgemm(CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const float *A, const float *B, float *C) 
-    { cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1.f, A, m, B, k, 0.f, C, m); } // C=A*B
-    
-    inline void multiply_matrix_matrix(Transpose transA, Transpose transB,
-                                       int m, int n, int k, double alpha, const double *A, int lda,
-                                       const double *B, int ldb, double beta, double *C, int ldc)
-    { cblas_dgemm(CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc); }
-    
-    inline void multiply_matrix_matrix(int m, int n, int k, const double *A, const double *B, double *C) 
-    { cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1., A, m, B, k, 0., C, m); } // C=A*B
-    
-    inline void rank_one_update( int m, int n, double alpha, const double* x, const double* y, double* A )
-    {
-        cblas_dger( CblasColMajor, m, n, alpha, x, 1, y, 1, A, m );
-    }
-    
-}  // namespace BLAS
-
-
-#endif
-
-// std::vector calls =========================================================
-namespace BLAS{
-    
-    template<class T>
-    inline void set_zero(std::vector<T> &x)
-    { set_zero((int)x.size(), &x[0]); }
-    
-    inline float dotf(const std::vector<float> &x, const std::vector<float> &y)
-    { assert(x.size()==y.size()); return dotf((int)x.size(), &x[0], &y[0]); }
-    
-    inline double dot(const std::vector<float> &x, const std::vector<float> &y)
-    { assert(x.size()==y.size()); return dot((int)x.size(), &x[0], &y[0]); }
-    
-    inline double dot(const std::vector<double> &x, const std::vector<double> &y)
-    { assert(x.size()==y.size()); return dot((int)x.size(), &x[0], &y[0]); }
-    
-    inline float norm2(const std::vector<float> &x)
-    { return norm2((int)x.size(), &x[0]); }
-    
-    inline double norm2(const std::vector<double> &x)
-    { return norm2((int)x.size(), &x[0]); }
-    
-    inline float abs_sum(const std::vector<float> &x)
-    { return abs_sum((int)x.size(), &x[0]); }
-    
-    inline double abs_sum(const std::vector<double> &x)
-    { return abs_sum((int)x.size(), &x[0]); }
-    
-    inline int index_abs_max(const std::vector<float> &x)
-    { return index_abs_max((int)x.size(), &x[0]); }
-    
-    inline int index_abs_max(const std::vector<double> &x)
-    { return index_abs_max((int)x.size(), &x[0]); }
-    
-    inline float abs_max(const std::vector<float> &x)
-    { return abs_max((int)x.size(), &x[0]); }
-    
-    inline double abs_max(const std::vector<double> &x)
-    { return abs_max((int)x.size(), &x[0]); }
-    
-    inline void swap(std::vector<float> &x, std::vector<float> &y)
-    { assert(x.size()==y.size()); swap((int)x.size(), &x[0], &y[0]); }
-    
-    inline void swap(std::vector<double> &x, std::vector<double> &y)
-    { assert(x.size()==y.size()); swap((int)x.size(), &x[0], &y[0]); }
-    
-    inline void copy(const std::vector<float> &x, std::vector<float> &y)
-    { assert(x.size()==y.size()); copy((int)x.size(), &x[0], &y[0]); }
-    
-    inline void copy(const std::vector<double> &x, std::vector<double> &y)
-    { assert(x.size()==y.size()); copy((int)x.size(), &x[0], &y[0]); }
-    
-    inline void add_scaled(float alpha, const std::vector<float> &x, std::vector<float> &y)
-    { assert(x.size()==y.size()); add_scaled((int)x.size(), alpha, &x[0], &y[0]); }
-    
-    inline void add_scaled(double alpha, const std::vector<double> &x, std::vector<double> &y)
-    { assert(x.size()==y.size()); add_scaled((int)x.size(), alpha, &x[0], &y[0]); }
-    
-    inline void scale(float alpha, std::vector<float> &x)
-    { scale((int)x.size(), alpha, &x[0]); }
-    
-    inline void scale(float alpha, std::vector<double> &x)
-    { scale((int)x.size(), alpha, &x[0]); }
-    
-    // I'm not sure if it makes sense to include level 2 or level 3 std::vector versions,
-    // since there isn't an STL matrix type...
-    
-}  // namespace BLAS
-
-#endif
diff --git a/extern/eltopo/common/ccd_defs.h b/extern/eltopo/common/ccd_defs.h
deleted file mode 100644
index b77738b..0000000
--- a/extern/eltopo/common/ccd_defs.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// ---------------------------------------------------------
-//
-//  ccd_defs.h
-//  Tyson Brochu 2011
-//
-// ---------------------------------------------------------
-
-#ifndef CCD_DEFS_H
-#define CCD_DEFS_H
-
-// Uncomment one of the following (cubic solver version has been tested hardest):
-//
-
-// #define USE_CUBIC_SOLVER_CCD
-#define USE_TUNICATE_CCD
-
-#endif
diff --git a/extern/eltopo/common/ccd_wrapper.cpp b/extern/eltopo/common/ccd_wrapper.cpp
deleted file mode 100644
index 985dc33..0000000
--- a/extern/eltopo/common/ccd_wrapper.cpp
+++ /dev/null
@@ -1,811 +0,0 @@
-// ---------------------------------------------------------
-//
-//  ccd_wrapper.cpp
-//  Tyson Brochu 2009
-//
-//  Tunicate-based implementation of collision and intersection queries.  (See Robert Bridson's "Tunicate" library.)
-//
-// ---------------------------------------------------------
-
-#include <bfstream.h>
-#include <ccd_defs.h>
-#include <ccd_wrapper.h>
-#include <collisionqueries.h>
-#include <tunicate.h>
-#include <vec.h>
-
-bool tunicate_verbose = false;
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#define random() rand() // not sure if this define is valid
-#define _Ios_Fmtflags ios::fmtflags
-#endif
-
-
-#ifdef USE_TUNICATE_CCD
-
-
-// --------------------------------------------------------------------------------------------------
-// Local functions
-// --------------------------------------------------------------------------------------------------
-
-namespace {
-    
-    bool tunicate_point_segment_collision( const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                                          const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                                          const Vec2d& x2, const Vec2d& xnew2, size_t index2 );
-    
-    bool tunicate_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                                          const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                                          const Vec2d& x2, const Vec2d& xnew2, size_t index2,
-                                          double& edge_alpha, Vec2d& normal, double& time, double& relative_normal_displacement );
-    
-    bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                           const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                           const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                           const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                                           double& bary1, double& bary2, double& bary3,
-                                           Vec3d& normal,
-                                           double& t,
-                                           double& relative_normal_displacement,
-                                           bool verbose );
-    
-    bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                           const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                           const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                           const Vec3d& x3, const Vec3d& xnew3, size_t index3 );
-    
-    bool tunicate_segment_segment_collision( const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                            const Vec3d& x1, const Vec3d& xnew1,  size_t index1,
-                                            const Vec3d& x2, const Vec3d& xnew2,  size_t index2,
-                                            const Vec3d& x3, const Vec3d& xnew3,  size_t index3,
-                                            double& bary0, double& bary2,
-                                            Vec3d& normal,
-                                            double& t,
-                                            double& relative_normal_displacement,
-                                            bool verbose );
-    
-    bool tunicate_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                            const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                            const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                            const Vec3d& x3, const Vec3d& xnew3, size_t index3);
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    Vec2d get_normal( const Vec2d& v )
-    {
-        Vec2d p = perp( v );
-        double m = mag(p);
-        if ( m > 0.0 ) { return p / m; }
-        
-        // degenerate, pick a random unit vector:
-        p[0] = random()%2 ? -0.707106781186548 : 0.707106781186548;
-        p[1] = random()%2 ? -0.707106781186548 : 0.707106781186548;
-        
-        return p;
-    }
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    Vec3d get_normal(const Vec3d& u, const Vec3d& v)
-    {
-        Vec3d c=cross(u,v);
-        double m=mag(c);
-        if(m) return c/m;
-        
-        // degenerate case: either u and v are parallel, or at least one is zero; pick an arbitrary orthogonal vector
-        if(mag2(u)>=mag2(v)){
-            if(std::fabs(u[0])>=std::fabs(u[1]) && std::fabs(u[0])>=std::fabs(u[2]))
-                c=Vec3d(-u[1]-u[2], u[0], u[0]);
-            else if(std::fabs(u[1])>=std::fabs(u[2]))
-                c=Vec3d(u[1], -u[0]-u[2], u[1]);
-            else
-                c=Vec3d(u[2], u[2], -u[0]-u[1]);
-        }else{
-            if(std::fabs(v[0])>=std::fabs(v[1]) && std::fabs(v[0])>=std::fabs(v[2]))
-                c=Vec3d(-v[1]-v[2], v[0], v[0]);
-            else if(std::fabs(v[1])>=std::fabs(v[2]))
-                c=Vec3d(v[1], -v[0]-v[2], v[1]);
-            else
-                c=Vec3d(v[2], v[2], -v[0]-v[1]);
-        }
-        m=mag(c);
-        if(m) return c/m;
-        
-        // really degenerate case: u and v are both zero vectors; pick a random unit-length vector
-        c[0]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-        c[1]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-        c[2]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-        return c;
-        
-    }
-    
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_point_segment_collision( const Vec2d& x0, const Vec2d& xnew0, size_t,
-                                          const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                                          const Vec2d& x2, const Vec2d& xnew2, size_t index2 )
-    {
-        assert( index1 < index2 );
-        
-        const int segment_triangle_test = 2;
-        
-        double p0[3] = { x0[0], x0[1], 0.0 };
-        double pnew0[3] = { xnew0[0], xnew0[1], 1.0 };
-        double p1[3] = { x1[0], x1[1], 0.0 };
-        double pnew1[3] = { xnew1[0], xnew1[1], 1.0 };
-        double p2[3] = { x2[0], x2[1], 0.0 };
-        double pnew2[3] = { xnew2[0], xnew2[1], 1.0 };
-        
-        double bary[5];
-        
-        bool intersections[2] = { false, false };
-        
-        if ( simplex_intersection3d( segment_triangle_test,
-                                    p0, pnew0, p1, p2, pnew2,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ) )
-        {
-            intersections[0] = true;
-        }
-        
-        if ( simplex_intersection3d( segment_triangle_test,
-                                    p0, pnew0, p1, pnew1, pnew2,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ) )
-        {
-            intersections[1] = true;
-        }
-        
-        return ( intersections[0] ^ intersections[1] );  
-        
-    }
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t,
-                                          const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                                          const Vec2d& x2, const Vec2d& xnew2, size_t index2,
-                                          double& edge_alpha, Vec2d& normal, double& time, double& relative_normal_displacement )
-    {
-        
-        assert( index1 < index2 );
-        
-        const int segment_triangle_test = 2;
-        
-        double p0[3] = { x0[0], x0[1], 0.0 };
-        double pnew0[3] = { xnew0[0], xnew0[1], 1.0 };
-        double p1[3] = { x1[0], x1[1], 0.0 };
-        double pnew1[3] = { xnew1[0], xnew1[1], 1.0 };
-        double p2[3] = { x2[0], x2[1], 0.0 };
-        double pnew2[3] = { xnew2[0], xnew2[1], 1.0 };
-        
-        double bary[5];   
-        bool intersections[2] = { false, false };
-        
-        if ( simplex_intersection3d( segment_triangle_test,
-                                    p0, pnew0, p1, p2, pnew2,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ) )
-        {
-            intersections[0] = true;      
-            edge_alpha=0;     // bary1 = 0, bary2 = 1
-            time=bary[1];
-            normal = get_normal( x2-x1 );
-            relative_normal_displacement = dot( normal, (xnew0-x0)-(xnew2-x2) );
-        }
-        
-        if ( simplex_intersection3d( segment_triangle_test,
-                                    p0, pnew0, p1, pnew1, pnew2,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ) )
-        {
-            intersections[1] = true;
-            edge_alpha=1;     // bary1 = 1, bary2 = 0
-            time=bary[1];
-            normal = get_normal( xnew2-xnew1 );
-            relative_normal_displacement = dot( normal, (xnew0-x0)-(xnew1-x1) );
-        }
-        
-        return ( intersections[0] ^ intersections[1] );  
-        
-    }
-    
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t,
-                                           const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                           const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                           const Vec3d& x3, const Vec3d& xnew3, size_t index3 )
-    {
-        
-        assert( index1 < index2 && index2 < index3 );
-        
-        const int segment_tetrahedron_test = 2;
-        
-        double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-        double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-        double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-        double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-        double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-        double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-        double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-        double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-        
-        
-        size_t num_intersections = 0;
-        
-        double bary[6];
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, pnew1, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( num_intersections == 0 || num_intersections == 2 )
-        {
-            return false;
-        }
-        
-        return true;
-        
-    }
-    
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t,
-                                           const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                           const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                           const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                                           double& bary1, double& bary2, double& bary3,
-                                           Vec3d& normal,
-                                           double& t,
-                                           double& relative_normal_displacement,
-                                           bool /*verbose*/ )
-    {
-        
-        assert( index1 < index2 && index2 < index3 );
-        
-        const int segment_tetrahedron_test = 2;
-        
-        double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-        double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-        double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-        double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-        
-        double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-        double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };  
-        double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-        double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-        
-        unsigned int num_intersections = 0;
-        t = 2.0;
-        double bary[6];
-        bool any_degen = false;
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            bary1=0;
-            bary2=0;
-            bary3=1;      
-            t=bary[1];
-            normal=get_normal(x2-x1, x3-x1);
-            relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-            
-            for ( unsigned int i = 0; i < 6; ++i ) { if ( bary[i] == 0.0 ) { any_degen = true; }  }
-        }
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            if( bary[1]<t )
-            {
-                bary1=0;
-                bary2=(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-                bary3=1-bary2;                  
-                t=bary[1];
-                normal=get_normal(x2-x1, xnew3-xnew1);
-                relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-            }
-            
-            for ( unsigned int i = 0; i < 6; ++i ) { if ( bary[i] == 0.0 ) { any_degen = true; }  }
-        }
-        
-        if ( simplex_intersection4d( segment_tetrahedron_test,
-                                    p0, pnew0, p1, pnew1, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            if( bary[1]<t)
-            {
-                bary1=(bary[3]+1e-300)/(bary[3]+bary[4]+bary[5]+3e-300); // guard against zero/zero
-                bary2=(bary[4]+1e-300)/(bary[3]+bary[4]+bary[5]+3e-300); // guard against zero/zero
-                bary3=1-bary1-bary2;         
-                t=bary[1];
-                normal=get_normal(xnew2-xnew1, xnew3-xnew1);
-                relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew1-x1));
-            }
-            
-            for ( unsigned int i = 0; i < 6; ++i ) { if ( bary[i] == 0.0 ) { any_degen = true; }  }
-            
-        }
-        
-        if ( tunicate_verbose )
-        {
-            std::cout << "point-triangle, num_intersections: " << num_intersections << std::endl;
-        }
-        
-        if ( num_intersections == 0 || num_intersections == 2 )
-        {
-            if ( any_degen ) 
-            { 
-                //g_stats.add_to_int( "tunicate_pt_degens", 1 );
-                return true; 
-            }
-            
-            return false;
-        }
-        
-        return true;
-        
-    }
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                            const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                                            const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                                            const Vec3d& x3, const Vec3d& xnew3, size_t index3)
-    {
-        
-        assert( index0 < index1 );
-        assert( index2 < index3 );
-        
-        const int triangle_triangle_test = 3;
-        
-        double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-        double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-        double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-        double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-        double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-        double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-        double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-        double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-        
-        unsigned int num_intersections = 0;
-        double bary[6];
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, p1, pnew1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, pnew0, pnew1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, p1, pnew1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, pnew0, pnew1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-        }
-        
-        if ( num_intersections % 2 == 0 )
-        {
-            return false;
-        }
-        
-        return true;
-        
-    }
-    
-    
-    // --------------------------------------------------------------------------------------------------------------
-    
-    bool tunicate_segment_segment_collision( const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                                            const Vec3d& x1, const Vec3d& xnew1,  size_t index1,
-                                            const Vec3d& x2, const Vec3d& xnew2,  size_t index2,
-                                            const Vec3d& x3, const Vec3d& xnew3,  size_t index3,
-                                            double& bary0, double& bary2,
-                                            Vec3d& normal,
-                                            double& t,
-                                            double& relative_normal_displacement,
-                                            bool /*verbose*/ )
-    {
-        
-        assert( index0 < index1 );
-        assert( index2 < index3 );
-        
-        const int triangle_triangle_test = 3;
-        
-        double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-        double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-        double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-        double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-        
-        double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-        double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-        double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-        double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-        
-        double bary[6];
-        t = 2.0;
-        
-        unsigned int num_intersections = 0;
-        
-        std::vector<unsigned int> degen_counts(10, 0);
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, p1, pnew1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            if ( bary[0] == 0 ) { degen_counts[2]++; degen_counts[4]++; }
-            if ( bary[1] == 0 ) { degen_counts[1]++; }
-            if ( bary[2] == 0 ) { degen_counts[0]++; degen_counts[3]; }
-            if ( bary[3] == 0 ) { degen_counts[7]++; degen_counts[9]++; }
-            if ( bary[4] == 0 ) { degen_counts[6]++; }
-            if ( bary[5] == 0 ) { degen_counts[5]++; degen_counts[8]++; }      
-            
-            if ( tunicate_verbose )
-            {
-                std::cout << "intersection A, barys: ";
-                std::cout << bary[0] << " " << bary[1] << " " << bary[2] << " " << bary[3] << " " << bary[4] << " " << bary[5] << std::endl;
-            }
-            
-            bary0=0;
-            bary2=0;
-            t=bary[2];
-            normal=get_normal(x1-x0, x3-x2);
-            relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew3-x3));            
-        }
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, pnew0, pnew1, p2, p3, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            if ( bary[0] == 0 ) { degen_counts[2]++; degen_counts[4]++; }
-            if ( bary[1] == 0 ) { degen_counts[1]++; }
-            if ( bary[2] == 0 ) { degen_counts[0]++; degen_counts[3]; }
-            if ( bary[3] == 0 ) { degen_counts[7]++; degen_counts[9]++; }
-            if ( bary[4] == 0 ) { degen_counts[6]++; }
-            if ( bary[5] == 0 ) { degen_counts[5]++; degen_counts[8]++; }
-            
-            if ( tunicate_verbose )
-            {
-                std::cout << "intersection B, barys: ";
-                std::cout << bary[0] << " " << bary[1] << " " << bary[2] << " " << bary[3] << " " << bary[4] << " " << bary[5] << std::endl;
-            }
-            
-            if( bary[5]<t )
-            {
-                bary0=(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-                bary2=0;
-                t=bary[5];
-                normal=get_normal(xnew1-xnew0, x3-x2);
-                relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-            }
-        }
-        
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, p1, pnew1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            ++num_intersections;
-            
-            if ( bary[0] == 0 ) { degen_counts[2]++; degen_counts[4]++; }
-            if ( bary[1] == 0 ) { degen_counts[1]++; }
-            if ( bary[2] == 0 ) { degen_counts[0]++; degen_counts[3]; }
-            if ( bary[3] == 0 ) { degen_counts[7]++; degen_counts[9]++; }
-            if ( bary[4] == 0 ) { degen_counts[6]++; }
-            if ( bary[5] == 0 ) { degen_counts[5]++; degen_counts[8]++; }
-            
-            if ( tunicate_verbose )
-            {
-                std::cout << "intersection C, barys: ";
-                std::cout << bary[0] << " " << bary[1] << " " << bary[2] << " " << bary[3] << " " << bary[4] << " " << bary[5] << std::endl;
-            }
-            
-            if( bary[2]<t )
-            {
-                bary0=0;
-                bary2=(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-                t=bary[2];
-                normal=get_normal(x1-x0, xnew3-xnew2);
-                relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew2-x2));
-            }
-        }
-        
-        if ( simplex_intersection4d( triangle_triangle_test,
-                                    p0, pnew0, pnew1, p2, pnew2, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-        {
-            
-            ++num_intersections;
-            
-            if ( bary[0] == 0 ) { degen_counts[2]++; degen_counts[4]++; }
-            if ( bary[1] == 0 ) { degen_counts[1]++; }
-            if ( bary[2] == 0 ) { degen_counts[0]++; degen_counts[3]; }
-            if ( bary[3] == 0 ) { degen_counts[7]++; degen_counts[9]++; }
-            if ( bary[4] == 0 ) { degen_counts[6]++; }
-            if ( bary[5] == 0 ) { degen_counts[5]++; degen_counts[8]++; }
-            
-            if ( tunicate_verbose )
-            {
-                std::cout << "intersection D, barys: ";
-                std::cout << bary[0] << " " << bary[1] << " " << bary[2] << " " << bary[3] << " " << bary[4] << " " << bary[5] << std::endl;
-            }
-            
-            if( 1-bary[0]<t)
-            {
-                bary0=(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-                bary2=(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-                t=1-bary[0];
-                normal=get_normal(xnew1-xnew0, xnew3-xnew2);
-                relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-            }
-        }
-        
-        if ( tunicate_verbose )
-        {
-            std::cout << "edge-edge, num_intersections: " << num_intersections;
-            std::cout << "degen_counts: ";
-            for ( size_t i = 0; i < degen_counts.size(); ++i ) { std::cout << degen_counts[i] << " "; }
-            std::cout << std::endl;
-            
-        }
-        
-        if ( num_intersections % 2 == 0 )
-        {
-            for ( size_t i = 0; i < degen_counts.size(); ++i ) 
-            { 
-                if( degen_counts[i] > 0 ) 
-                { 
-                    //g_stats.add_to_int( "tunicate_ee_degens", 1 );
-                    return true; 
-                } 
-            }
-            
-            return false;
-        }
-        
-        return true;
-        
-    }
-    
-}     // namespace
-
-
-// --------------------------------------------------------------------------------------------------
-// 2D Continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------------------
-
-bool point_segment_collision( const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t index2 )
-{
-    return tunicate_point_segment_collision( x0, xnew0, index0, 
-                                            x1, xnew1, index1, 
-                                            x2, xnew2, index2 );
-}
-
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t index2,
-                             double& edge_alpha, Vec2d& normal, double& time, double& relative_normal_displacement )
-{
-    bool tunicate_result = tunicate_point_segment_collision( x0, xnew0, index0, 
-                                                            x1, xnew1, index1, 
-                                                            x2, xnew2, index2,
-                                                            edge_alpha, normal, time, relative_normal_displacement );
-    
-    return tunicate_result;
-    
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 2D Static intersection detection / distance queries
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------------------
-
-bool segment_segment_intersection(const Vec2d& x0, size_t /*index0*/, 
-                                  const Vec2d& x1, size_t /*index1*/,
-                                  const Vec2d& x2, size_t /*index2*/,
-                                  const Vec2d& x3, size_t /*index3*/)
-{
-    double bary[4];   // not returned   
-    return simplex_intersection2d( 2, x0.v, x1.v, x2.v, x3.v, &bary[0], &bary[1], &bary[2], &bary[3] );
-}
-
-// --------------------------------------------------------------------------------------------------------------
-
-bool segment_segment_intersection(const Vec2d& x0, size_t /*index0*/, 
-                                  const Vec2d& x1, size_t /*index1*/,
-                                  const Vec2d& x2, size_t /*index2*/,
-                                  const Vec2d& x3, size_t /*index3*/,
-                                  double &s0, double& s2 )
-{
-    double s1, s3;    // not returned
-    return simplex_intersection2d( 2, x0.v, x1.v, x2.v, x3.v, &s0, &s1, &s2, &s3 );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D Continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t index3 )
-{
-    bool tunicate_result = tunicate_point_triangle_collision( x0, xnew0, index0,
-                                                             x1, xnew1, index1,
-                                                             x2, xnew2, index2,
-                                                             x3, xnew3, index3 );                                            
-    
-    return tunicate_result;
-    
-} 
-
-// --------------------------------------------------------------------------------------------------------------
-
-bool point_triangle_collision( const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                              double& bary1, double& bary2, double& bary3,
-                              Vec3d& normal,
-                              double& relative_normal_displacement )
-{
-    
-    double time;
-    bool verbose = false;
-    bool tunicate_result = tunicate_point_triangle_collision( x0, xnew0, index0,
-                                                             x1, xnew1, index1,
-                                                             x2, xnew2, index2,
-                                                             x3, xnew3, index3,
-                                                             bary1, bary2, bary3,
-                                                             normal, time, relative_normal_displacement, verbose );
-    
-    return tunicate_result;
-    
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t index3)
-{
-    bool tunicate_result = tunicate_segment_segment_collision( x0, xnew0, index0,
-                                                              x1, xnew1, index1,
-                                                              x2, xnew2, index2,
-                                                              x3, xnew3, index3 );
-    
-    return tunicate_result;
-}
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool segment_segment_collision( const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                               double& bary0, double& bary2,
-                               Vec3d& normal,
-                               double& relative_normal_displacement )
-{
-    double time;
-    bool verbose = false;
-    bool tunicate_result = tunicate_segment_segment_collision( x0, xnew0, index0,
-                                                              x1, xnew1, index1,
-                                                              x2, xnew2, index2,
-                                                              x3, xnew3, index3,
-                                                              bary0, bary2, normal, time, relative_normal_displacement, verbose );
-    
-    return tunicate_result;
-    
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D Static intersection detection
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------
-
-// x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, size_t /*index0*/,
-                                   const Vec3d& x1, size_t /*index1*/,
-                                   const Vec3d& x2, size_t /*index2*/,
-                                   const Vec3d& x3, size_t /*index3*/,
-                                   const Vec3d& x4, size_t /*index4*/,
-                                   bool /*degenerate_counts_as_intersection*/,
-                                   bool /*verbose*/ )
-{
-    double bary[5];
-    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] );
-}
-
-
-bool segment_triangle_intersection(const Vec3d& x0, size_t /*index0*/,
-                                   const Vec3d& x1, size_t /*index1*/,
-                                   const Vec3d& x2, size_t /*index2*/,
-                                   const Vec3d& x3, size_t /*index3*/,
-                                   const Vec3d& x4, size_t /*index4*/,
-                                   double& bary0, double& bary1, double& bary2, double& bary3, double& bary4,
-                                   bool /*degenerate_counts_as_intersection*/,
-                                   bool /*verbose*/ )
-{
-    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary0, &bary1, &bary2, &bary3, &bary4 );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, size_t /*index0*/,
-                                    const Vec3d& x1, size_t /*index1*/,
-                                    const Vec3d& x2, size_t /*index2*/,
-                                    const Vec3d& x3, size_t /*index3*/,
-                                    const Vec3d& x4, size_t /*index4*/)
-{
-    double bary[5];
-    return simplex_intersection3d( 1, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] );   
-}
-
-
-#endif
-
-
diff --git a/extern/eltopo/common/ccd_wrapper.h b/extern/eltopo/common/ccd_wrapper.h
deleted file mode 100644
index bd8b6bc..0000000
--- a/extern/eltopo/common/ccd_wrapper.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// ---------------------------------------------------------
-//
-//  ccd_wrapper.h
-//  Tyson Brochu 2009
-//
-//  General interface for collision and intersection queries.
-//
-// ---------------------------------------------------------
-
-
-#ifndef CCD_WRAPPER_H
-#define CCD_WRAPPER_H
-
-#include <vec.h>
-
-
-// --------------------------------------------------------------------------------------------------
-// 2D continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-// x0 is the point, x1-x2 is the segment. Take care to specify x1,x2 in sorted order of index!
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t index2);
-
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t index2,
-                             double& edge_alpha, Vec2d& normal, double& time, double& rel_disp);
-
-// --------------------------------------------------------------------------------------------------
-// 2D static intersection detection
-// --------------------------------------------------------------------------------------------------
-
-bool segment_segment_intersection(const Vec2d& x0, size_t index0, 
-                                  const Vec2d& x1, size_t index1,
-                                  const Vec2d& x2, size_t index2,
-                                  const Vec2d& x3, size_t index3);
-
-bool segment_segment_intersection(const Vec2d& x0, size_t index0, 
-                                  const Vec2d& x1, size_t index1,
-                                  const Vec2d& x2, size_t index2,
-                                  const Vec2d& x3, size_t index3,
-                                  double &s0, double& s2 );
-
-// --------------------------------------------------------------------------------------------------
-// 3D continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t index3);
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-// If there is a collision, returns true and sets bary1, bary2, bary3 to the barycentric coordinates of
-// the collision point, sets normal to the collision point, t to the collision time, and the relative
-// normal displacement (in terms of point 0 minus triangle 1-2-3)
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                              double& bary1, double& bary2, double& bary3,
-                              Vec3d& normal,
-                              double& relative_normal_displacement );
-
-// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t index3);
-
-// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
-// If there is a collision, returns true and sets bary0 and bary2 to parts of the barycentric coordinates of
-// the collision point, sets normal to the collision point, t to the collision time, and the relative
-// normal displacement (in terms of edge 0-1 minus edge 2-3)
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t index3,
-                               double& bary0, double& bary2,
-                               Vec3d& normal,
-                               double& relative_normal_displacement );
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D static intersection detection
-// --------------------------------------------------------------------------------------------------
-
-// x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, size_t index0,
-                                   const Vec3d& x1, size_t index1,
-                                   const Vec3d& x2, size_t index2,
-                                   const Vec3d& x3, size_t index3,
-                                   const Vec3d& x4, size_t index4,
-                                   bool degenerate_counts_as_intersection,
-                                   bool verbose = false );
-
-bool segment_triangle_intersection(const Vec3d& x0, size_t index0,
-                                   const Vec3d& x1, size_t index1,
-                                   const Vec3d& x2, size_t index2,
-                                   const Vec3d& x3, size_t index3,
-                                   const Vec3d& x4, size_t index4,
-                                   double& bary0, double& bary1, double& bary2, double& bary3, double& bary4,
-                                   bool degenerate_counts_as_intersection,
-                                   bool verbose = false );
-
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, size_t index0,
-                                    const Vec3d& x1, size_t index1,
-                                    const Vec3d& x2, size_t index2,
-                                    const Vec3d& x3, size_t index3,
-                                    const Vec3d& x4, size_t index4);
-
-
-#endif
-
diff --git a/extern/eltopo/common/clamped_spline.cpp b/extern/eltopo/common/clamped_spline.cpp
deleted file mode 100644
index 2410ed3..0000000
--- a/extern/eltopo/common/clamped_spline.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *  clamped_spline.cpp
- *  eltopo2d_project
- *
- *  Created by tyson on 30/10/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include <clamped_spline.h>
-#include <sparse_matrix.h>
-#include <krylov_solvers.h>
-
-// -------------------------------------------------------------
-
-
-void compute_cubic_spline_coefficients( const std::vector<double>& t, 
-                                        const std::vector<double>& f, 
-                                        std::vector<Vec4d>& coeffs )
-{
-
-   unsigned int n = f.size();
-   
-   std::vector<double> h(n-1);
-   for ( unsigned int i = 0; i < n-1; ++i )
-   {
-      h[i] = t[i+1] - t[i];
-   }
-   
-   // build tridiagonal matrix
-   
-   SparseMatrixDynamicCSR A(n,n);
-   
-   A(0,0) = 2*h[0];
-   A(0,1) = h[0];
-   
-   for ( unsigned int i = 1; i < n-2; ++i )
-   {
-      A(i,i-1) = h[i];
-      A(i,i) = 2*(h[i] + h[i+1]);
-      A(i,i+1) = h[i];
-   }
-   
-   A(n-1, n-2) = h[n-2];
-   A(n-1, n-1) = 2*h[n-2];
-   
-   // right-hand side
-   
-   double *rhs = new double[n];
-   rhs[0] = 3.0*(f[1] - f[0]) / h[0];
-   for ( unsigned int i = 1; i < n-2; ++i )
-   {
-      rhs[i] = 3.0 * (f[i+1] - f[i]) / h[i] - 3.0*(f[i] - f[i-1])/h[i-1];
-   }
-   rhs[n-1] = -3.0*(f[n-1] - f[n-2]) / h[n-2];
-   
-   // solve system
-   
-   double *sol = new double[n];
-   CGNR_Solver solver;
-      
-   solver.max_iterations = 1000;
-   KrylovSolverStatus result = solver.solve( A, rhs, sol );
-   
-   assert( result == KRYLOV_CONVERGED );
-   
-   // compute coefficients
-   
-   coeffs.resize( n-1 );
-   
-   std::cout << std::endl;
-   
-   for ( unsigned int j = 0; j < n-1; ++j )
-   {
-      coeffs[j][0] = (sol[j+1] - sol[j]) / (3*h[j]);      
-      coeffs[j][1] = sol[j];
-      coeffs[j][2] = 1/h[j] * (f[j+1] - f[j]) - h[j]/3 * (2*sol[j] + sol[j+1]);
-      coeffs[j][3] = f[j];
-
-//      std::cout << "f_j(t_j) = " << coeffs[j][3] << std::endl;
-//      std::cout << "f_j(t_j + dt) = " << coeffs[j][0]*h[j]*h[j]*h[j] + coeffs[j][1]*h[j]*h[j] + coeffs[j][2]*h[j] + coeffs[j][3] << std::endl;
-
-      std::cout << "df_j/dt(t_j) = " << coeffs[j][2] << std::endl;
-      std::cout << "df_j/dt(t_j + dt) = " << 3.0*coeffs[j][0]*h[j]*h[j] + 2.0*coeffs[j][1]*h[j] + coeffs[j][2] << std::endl;
-   }
-      
-   delete[] rhs;
-   delete[] sol;
-   
-}
-
-
-
-// -------------------------------------------------------------
-
-
-
-void evaluate_spline( const std::vector<double>& coarse_t, 
-                      const std::vector<double>& coarse_f, 
-                      const std::vector<Vec4d>& coeffs, 
-                      const std::vector<double>& fine_t, 
-                      std::vector<double>& fine_f )
-{
-   
-   fine_f.resize( fine_t.size() );
-   
-   // for each t in fine t
-   
-   for ( unsigned int i = 0; i < fine_t.size(); ++i )
-   {
-      double t = fine_t[i];
-   
-      // find the suitable subrange
-      
-      unsigned int j = 0;
-      while ( (j < coarse_t.size() - 1) && (coarse_t[j+1] < t) )
-      {
-         ++j;
-      }
-      
-      assert( t >= coarse_t[j] );
-      assert( t <= coarse_t[j+1] );
-   
-      double x = t - coarse_t[j];
-   
-      // evaluate using the subrange's coefficients        
-      
-      fine_f[i] = coeffs[j][0]*x*x*x + coeffs[j][1]*x*x + coeffs[j][2]*x + coeffs[j][3];
-
-   }
-   
-}
-
-
-
-
-
diff --git a/extern/eltopo/common/clamped_spline.h b/extern/eltopo/common/clamped_spline.h
deleted file mode 100644
index 5c56999..0000000
--- a/extern/eltopo/common/clamped_spline.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  clamped_spline.h
- *  eltopo2d_project
- *
- *  Created by tyson on 30/10/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
- *
- */
-
-
-#include <vec.h>
-
-void compute_cubic_spline_coefficients( const std::vector<double>& t, 
-                                        const std::vector<double>& f, 
-                                        std::vector<Vec4d>& coeffs );
-
-
-void evaluate_spline( const std::vector<double>& coarse_t, 
-                      const std::vector<double>& coarse_f, 
-                      const std::vector<Vec4d>& coeffs, 
-                      const std::vector<double>& fine_t, 
-                      std::vector<double>& fine_f );
-
-
diff --git a/extern/eltopo/common/collisionqueries.cpp b/extern/eltopo/common/collisionqueries.cpp
deleted file mode 100644
index fd23246..0000000
--- a/extern/eltopo/common/collisionqueries.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-#include <collisionqueries.h>
-#include <commonoptions.h>
-
-
-
-void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, const Vec3d &x2,
-                                double &distance)
-{
-    Vec3d dx(x2-x1);
-    double m2=mag2(dx);
-    // find parameter value of closest point on segment
-    double s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-    // and find the distance
-    if(update){
-        distance=min(distance, dist(x0,s*x1+(1-s)*x2));
-    }else{
-        distance=dist(x0,s*x1+(1-s)*x2);
-    }
-}
-
-// normal is from 1-2 towards 0, unless normal_multiplier<0
-void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, const Vec3d &x2,
-                                double &distance, double &s, Vec3d &normal, double normal_multiplier)
-{
-    Vec3d dx(x2-x1);
-    double m2=mag2(dx);
-    if(update){
-        // find parameter value of closest point on segment
-        double this_s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-        // and find the distance
-        Vec3d this_normal=x0-(this_s*x1+(1-this_s)*x2);
-        double this_distance=mag(this_normal);
-        if(this_distance<distance){
-            s=this_s;
-            distance=this_distance;
-            normal=(normal_multiplier/(this_distance+1e-30))*this_normal;
-        }
-    }else{
-        // find parameter value of closest point on segment
-        s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-        // and find the distance
-        normal=x0-(s*x1+(1-s)*x2);
-        distance=mag(normal);
-        normal*=normal_multiplier/(distance+1e-30);
-    }
-}
-
-void check_point_edge_proximity( bool update, const Vec2d &x0, const Vec2d &x1, const Vec2d &x2,
-                                double &distance)
-{
-    Vec2d dx(x2-x1);
-    double m2=mag2(dx);
-    // find parameter value of closest point on segment
-    double s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-    // and find the distance
-    if(update){
-        distance=min(distance, dist(x0,s*x1+(1-s)*x2));
-    }else{
-        distance=dist(x0, s*x1+(1-s)*x2);
-    }
-}
-
-// normal is from 1-2 towards 0, unless normal_multiplier<0
-void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, const Vec2d &x2,
-                                double &distance, double &s, Vec2d &normal, double normal_multiplier)
-{
-    Vec2d dx(x2-x1);
-    double m2=mag2(dx);
-    if(update){
-        // find parameter value of closest point on segment
-        double this_s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-        // and find the distance
-        Vec2d this_normal=x0-(this_s*x1+(1-this_s)*x2);
-        double this_distance=mag(this_normal);
-        if(this_distance<distance){
-            s=this_s;
-            distance=this_distance;
-            normal=(normal_multiplier/(this_distance+1e-30))*this_normal;
-        }
-    }else{
-        // find parameter value of closest point on segment
-        s=clamp(dot(x2-x0, dx)/m2, 0., 1.);
-        // and find the distance
-        normal=x0-(s*x1+(1-s)*x2);
-        distance=mag(normal);
-        if ( distance < 1e-10 )
-        {
-            normal = normalized(perp(x2 - x1));
-            return;
-        }
-        
-        normal*=normal_multiplier/(distance+1e-30);
-    }
-}
-
-void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3, double &distance)
-{
-    // let's do it the QR way for added robustness
-    Vec3d x01=x0-x1;
-    double r00=mag(x01)+1e-30;
-    x01/=r00;
-    Vec3d x32=x3-x2;
-    double r01=dot(x32,x01);
-    x32-=r01*x01;
-    double r11=mag(x32)+1e-30;
-    x32/=r11;
-    Vec3d x31=x3-x1;
-    double s2=dot(x32,x31)/r11;
-    double s0=(dot(x01,x31)-r01*s2)/r00;
-    // check if we're in range
-    if(s0<0){
-        if(s2<0){
-            // check both x1 against 2-3 and 3 against 0-1
-            check_point_edge_proximity(false, x1, x2, x3, distance);
-            check_point_edge_proximity(true, x3, x0, x1, distance);
-        }else if(s2>1){
-            // check both x1 against 2-3 and 2 against 0-1
-            check_point_edge_proximity(false, x1, x2, x3, distance);
-            check_point_edge_proximity(true, x2, x0, x1, distance);
-        }else{
-            s0=0;
-            // check x1 against 2-3
-            check_point_edge_proximity(false, x1, x2, x3, distance);
-        }
-    }else if(s0>1){
-        if(s2<0){
-            // check both x0 against 2-3 and 3 against 0-1
-            check_point_edge_proximity(false, x0, x2, x3, distance);
-            check_point_edge_proximity(true, x3, x0, x1, distance);
-        }else if(s2>1){
-            // check both x0 against 2-3 and 2 against 0-1
-            check_point_edge_proximity(false, x0, x2, x3, distance);
-            check_point_edge_proximity(true, x2, x0, x1, distance);
-        }else{
-            s0=1;
-            // check x0 against 2-3
-            check_point_edge_proximity(false, x0, x2, x3, distance);
-        }
-    }else{
-        if(s2<0){
-            s2=0;
-            // check x3 against 0-1
-            check_point_edge_proximity(false, x3, x0, x1, distance);
-        }else if(s2>1){
-            s2=1;
-            // check x2 against 0-1
-            check_point_edge_proximity(false, x2, x0, x1, distance);
-        }else{ // we already got the closest points!
-            distance=dist(s2*x2+(1-s2)*x3, s0*x0+(1-s0)*x1);
-        }
-    }
-}
-
-// find distance between 0-1 and 2-3, with barycentric coordinates for closest points, and
-// a normal that points from 0-1 towards 2-3 (unreliable if distance==0 or very small)
-void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                               double &distance, double &s0, double &s2, Vec3d &normal)
-{
-    // let's do it the QR way for added robustness
-    Vec3d x01=x0-x1;
-    double r00=mag(x01)+1e-30;
-    x01/=r00;
-    Vec3d x32=x3-x2;
-    double r01=dot(x32,x01);
-    x32-=r01*x01;
-    double r11=mag(x32)+1e-30;
-    x32/=r11;
-    Vec3d x31=x3-x1;
-    s2=dot(x32,x31)/r11;
-    s0=(dot(x01,x31)-r01*s2)/r00;
-    // check if we're in range
-    if(s0<0){
-        if(s2<0){
-            // check both x1 against 2-3 and 3 against 0-1
-            check_point_edge_proximity(false, x1, x2, x3, distance, s2, normal, 1.);
-            check_point_edge_proximity(true, x3, x0, x1, distance, s0, normal, -1.);
-        }else if(s2>1){
-            // check both x1 against 2-3 and 2 against 0-1
-            check_point_edge_proximity(false, x1, x2, x3, distance, s2, normal, 1.);
-            check_point_edge_proximity(true, x2, x0, x1, distance, s0, normal, -1.);
-        }else{
-            s0=0;
-            // check x1 against 2-3
-            check_point_edge_proximity(false, x1, x2, x3, distance, s2, normal, 1.);
-        }
-    }else if(s0>1){
-        if(s2<0){
-            // check both x0 against 2-3 and 3 against 0-1
-            check_point_edge_proximity(false, x0, x2, x3, distance, s2, normal, 1.);
-            check_point_edge_proximity(true, x3, x0, x1, distance, s0, normal, -1.);
-        }else if(s2>1){
-            // check both x0 against 2-3 and 2 against 0-1
-            check_point_edge_proximity(false, x0, x2, x3, distance, s2, normal, 1.);
-            check_point_edge_proximity(true, x2, x0, x1, distance, s0, normal, -1.);
-        }else{
-            s0=1;
-            // check x0 against 2-3
-            check_point_edge_proximity(false, x0, x2, x3, distance, s2, normal, 1.);
-        }
-    }else{
-        if(s2<0){
-            s2=0;
-            // check x3 against 0-1
-            check_point_edge_proximity(false, x3, x0, x1, distance, s0, normal, -1.);
-        }else if(s2>1){
-            s2=1;
-            // check x2 against 0-1
-            check_point_edge_proximity(false, x2, x0, x1, distance, s0, normal, -1.);
-        }else{ // we already got the closest points!
-            normal=(s0*x0+(1-s0)*x1)-(s2*x2+(1-s2)*x3);
-            distance=mag(normal);
-            if(distance>0) normal/=distance;
-            else{
-                normal=cross(x1-x0, x3-x2);
-                normal/=mag(normal)+1e-300;
-            }
-        }
-    }
-}
-
-void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                    double &distance)
-{
-    // do it the QR way for added robustness
-    Vec3d x13=x1-x3;
-    double r00=mag(x13)+1e-30;
-    x13/=r00;
-    Vec3d x23=x2-x3;
-    double r01=dot(x23,x13);
-    x23-=r01*x13;
-    double r11=mag(x23)+1e-30;
-    x23/=r11;
-    Vec3d x03=x0-x3;
-    double s2=dot(x23,x03)/r11;
-    double s1=(dot(x13,x03)-r01*s2)/r00;
-    double s3=1-s1-s2;
-    // check if we are in range
-    if(s1>=0 && s2>=0 && s3>=0){
-        distance=dist(x0, s1*x1+s2*x2+s3*x3);
-    }else{
-        if(s1>0){ // rules out edge 2-3
-            check_point_edge_proximity(false, x0, x1, x2, distance);
-            check_point_edge_proximity(true, x0, x1, x3, distance);
-        }else if(s2>0){ // rules out edge 1-3
-            check_point_edge_proximity(false, x0, x1, x2, distance);
-            check_point_edge_proximity(true, x0, x2, x3, distance);
-        }else{ // s3>0: rules out edge 1-2
-            check_point_edge_proximity(false, x0, x2, x3, distance);
-            check_point_edge_proximity(true, x0, x1, x3, distance);
-        }
-    }
-}
-
-// find distance between 0 and 1-2-3, with barycentric coordinates for closest point, and
-// a normal that points from 1-2-3 towards 0 (unreliable if distance==0 or very small)
-void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                    double &distance, double &s1, double &s2, double &s3, Vec3d &normal)
-{
-    // do it the QR way for added robustness
-    Vec3d x13=x1-x3;
-    double r00=mag(x13)+1e-30;
-    x13/=r00;
-    Vec3d x23=x2-x3;
-    double r01=dot(x23,x13);
-    x23-=r01*x13;
-    double r11=mag(x23)+1e-30;
-    x23/=r11;
-    Vec3d x03=x0-x3;
-    s2=dot(x23,x03)/r11;
-    s1=(dot(x13,x03)-r01*s2)/r00;
-    s3=1-s1-s2;
-    // check if we are in range
-    if(s1>=0 && s2>=0 && s3>=0){
-        normal=x0-(s1*x1+s2*x2+s3*x3);
-        distance=mag(normal);
-        if(distance>0) normal/=distance;
-        else{
-            normal=cross(x2-x1, x3-x1);
-            normal/=mag(normal)+1e-300;
-        }
-    }else{
-        double s, d;
-        if(s1>0){ // rules out edge 2-3
-            check_point_edge_proximity(false, x0, x1, x2, distance, s, normal, 1.);
-            s1=s; s2=1-s; s3=0; d=distance;
-            check_point_edge_proximity(true, x0, x1, x3, distance, s, normal, 1.);
-            if(distance<d){
-                s1=s; s2=0; s3=1-s;
-            }
-        }else if(s2>0){ // rules out edge 1-3
-            check_point_edge_proximity(false, x0, x1, x2, distance, s, normal, 1.);
-            s1=s; s2=1-s; s3=0; d=distance;
-            check_point_edge_proximity(true, x0, x2, x3, distance, s, normal, 1.);
-            if(distance<d){
-                s1=0; s2=s; s3=1-s; d=distance;
-            }
-        }else{ // s3>0: rules out edge 1-2
-            check_point_edge_proximity(false, x0, x2, x3, distance, s, normal, 1.);
-            s1=0; s2=s; s3=1-s; d=distance;
-            check_point_edge_proximity(true, x0, x1, x3, distance, s, normal, 1.);
-            if(distance<d){
-                s1=s; s2=0; s3=1-s;
-            }
-        }
-    }
-}
-
-double signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3)
-{
-    // Equivalent to triple(x1-x0, x2-x0, x3-x0), six times the signed volume of the tetrahedron.
-    // But, for robustness, we want the result (up to sign) to be independent of the ordering.
-    // And want it as accurate as possible...
-    // But all that stuff is hard, so let's just use the common assumption that all coordinates are >0,
-    // and do something reasonably accurate in fp.
-    
-    // This formula does almost four times too much multiplication, but if the coordinates are non-negative
-    // it suffers in a minimal way from cancellation error.
-    return ( x0[0]*(x1[1]*x3[2]+x3[1]*x2[2]+x2[1]*x1[2])
-            +x1[0]*(x2[1]*x3[2]+x3[1]*x0[2]+x0[1]*x2[2])
-            +x2[0]*(x3[1]*x1[2]+x1[1]*x0[2]+x0[1]*x3[2])
-            +x3[0]*(x1[1]*x2[2]+x2[1]*x0[2]+x0[1]*x1[2]) )
-    
-    - ( x0[0]*(x2[1]*x3[2]+x3[1]*x1[2]+x1[1]*x2[2])
-       +x1[0]*(x3[1]*x2[2]+x2[1]*x0[2]+x0[1]*x3[2])
-       +x2[0]*(x1[1]*x3[2]+x3[1]*x0[2]+x0[1]*x1[2])
-       +x3[0]*(x2[1]*x1[2]+x1[1]*x0[2]+x0[1]*x2[2]) );
-}
-
diff --git a/extern/eltopo/common/collisionqueries.h b/extern/eltopo/common/collisionqueries.h
deleted file mode 100644
index 4f91fe6..0000000
--- a/extern/eltopo/common/collisionqueries.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef COLLISIONQUERIES_H
-#define COLLISIONQUERIES_H
-
-#include <vec.h>
-
-// 2D ====================================================================================================
-
-
-void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, const Vec2d &x2,
-                                double &distance);
-
-void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, const Vec2d &x2,
-                                double &distance, double &s, Vec2d &normal, double normal_multiplier);
-
-// 3D ====================================================================================================
-
-void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, const Vec3d &x2,
-                                double &distance);
-void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, const Vec3d &x2,
-                                double &distance, double &s, Vec3d &normal, double normal_multiplier);
-
-void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                               double &distance);
-void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                               double &distance, double &s0, double &s2, Vec3d &normal);
-
-void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                    double &distance);
-void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                    double &distance, double &s1, double &s2, double &s3, Vec3d &normal);
-
-
-double signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3);
-
-
-#endif
diff --git a/extern/eltopo/common/commonoptions.h b/extern/eltopo/common/commonoptions.h
deleted file mode 100644
index 6f145f1..0000000
--- a/extern/eltopo/common/commonoptions.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// ---------------------------------------------------------
-//
-//  options.h
-//  Tyson Brochu 2008
-//
-//  Constants and macro defines
-//
-// ---------------------------------------------------------
-
-#ifndef COMMONOPTIONS_H
-#define COMMONOPTIONS_H
-
-// ---------------------------------------------------------
-// Global constants
-// ---------------------------------------------------------
-
-const double UNINITIALIZED_DOUBLE = 0x0F;
-const double BIG_DOUBLE = 1e30;
-
-
-#endif
-
diff --git a/extern/eltopo/common/cubic_ccd_wrapper.cpp b/extern/eltopo/common/cubic_ccd_wrapper.cpp
deleted file mode 100644
index e73ea14..0000000
--- a/extern/eltopo/common/cubic_ccd_wrapper.cpp
+++ /dev/null
@@ -1,760 +0,0 @@
-// ---------------------------------------------------------
-//
-//  cubic_ccd_wrapper.cpp
-//  Tyson Brochu 2009
-//
-//  Cubic solver-based implementation of collision and intersection queries.
-//
-// ---------------------------------------------------------
-
-
-#include <ccd_defs.h>
-#include <ccd_wrapper.h>
-
-bool simplex_verbose = false;
-
-
-#ifdef USE_CUBIC_SOLVER_CCD
-
-#include <collisionqueries.h>
-#include <tunicate.h>
-
-namespace
-{
-    
-    const double cubic_solver_tol = 1e-8;
-    const double degen_normal_epsilon = 1e-6;
-    const double g_collision_epsilon = 1e-6;
-    
-    bool check_edge_edge_intersection(const Vec2d &x0, const Vec2d &x1, const Vec2d &x2, const Vec2d &x3, double &s01, double &s23, double tolerance );
-    
-    bool check_point_edge_collision( const Vec2d &x0old, const Vec2d &x1old, const Vec2d &x2old,
-                                    const Vec2d &x0new, const Vec2d &x1new, const Vec2d &x2new,
-                                    double collision_epsilon );
-    
-    bool check_point_edge_collision( const Vec2d &x0old, const Vec2d &x1old, const Vec2d &x2old,
-                                    const Vec2d &x0new, const Vec2d &x1new, const Vec2d &x2new,
-                                    double &s12, Vec2d &normal, double &collision_time, double collision_epsilon );
-    
-    bool check_edge_edge_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                   const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                   double collision_epsilon);
-    bool check_edge_edge_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                   const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                   double &s0, double &s2, Vec3d &normal, double &t, double collision_epsilon);
-    
-    
-    bool check_point_triangle_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                        const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                        double collision_epsilon);
-    bool check_point_triangle_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                        const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                        double &s1, double &s2, double &s3, Vec3d &normal, double &t,
-                                        double collision_epsilon);
-    
-    void find_coplanarity_times(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                std::vector<double> &possible_times);
-    
-    
-    // ---------------------------------------------------------
-    
-    
-    
-    // check if segment x0-x1 and segment x2-x3 are intersecting and return barycentric coordinates of intersection if so
-    bool check_edge_edge_intersection( const Vec2d &x0, const Vec2d &x1, const Vec2d &x2, const Vec2d &x3, double &s01, double &s23, double tolerance )
-    {
-        double x10=x1[0]-x0[0], y10=x1[1]-x0[1];
-        double x31=x3[0]-x1[0], y31=x3[1]-x1[1];
-        double x32=x3[0]-x2[0], y32=x3[1]-x2[1];
-        double det=x32*y10-x10*y32;
-        s01=(x31*y32-x32*y31)/det;
-        if(s01 < -tolerance || s01 > 1+tolerance) return false;
-        s23=(x31*y10-x10*y31)/det;
-        if(s23< -tolerance || s23 > 1+tolerance) return false;
-        // clamp
-        if(s01<0) s01=0; else if(s01>1) s01=1;
-        if(s23<0) s23=0; else if(s23>1) s23=1;
-        return true;
-    }
-    
-    
-    // append all possible roots in [0,1] for the quadratic A*t^2+B*t+C to possible_t
-    void find_possible_quadratic_roots_in_01( double A, double B, double C, std::vector<double> &possible_t, double tol )
-    {
-        if(A!=0){
-            double discriminant=B*B-4*A*C;
-            if(discriminant>0){
-                double numer;
-                if(B>0) numer=0.5*(-B-sqrt(discriminant));
-                else    numer=0.5*(-B+sqrt(discriminant));
-                double t0=numer/A, t1=C/numer;
-                if(t0<t1){
-                    if(t0>=-tol && t0<1)
-                        possible_t.push_back(max(0.,t0));
-                    if(t1>=-tol && t1<1)
-                        possible_t.push_back(max(0.,t1));
-                }else{
-                    if(t1>=-tol && t1<1)
-                        possible_t.push_back(max(0.,t1));
-                    if(t0>=-tol && t0<1)
-                        possible_t.push_back(max(0.,t0));
-                }
-            }else{
-                double t=-B/(2*A); // the extremum of the quadratic
-                if(t>=-tol && t<1)
-                    possible_t.push_back(max(0.,t));
-            }
-        }else if(B!=0){
-            double t=-C/B;
-            if(t>=-tol && t<1)
-                possible_t.push_back(max(0.,t));
-        }
-    }
-    
-    bool check_point_edge_collision( const Vec2d &x0old, const Vec2d &x1old, const Vec2d &x2old,
-                                    const Vec2d &x0new, const Vec2d &x1new, const Vec2d &x2new, 
-                                    double collision_epsilon )
-    {
-        Vec2d x10=x1old-x0old, x20=x2old-x0old;
-        Vec2d d10=(x1new-x0new)-x10, d20=(x2new-x0new)-x20;
-        // figure out possible collision times to check
-        std::vector<double> possible_t;
-        double A=cross(d10,d20), B=cross(d10,x20)+cross(x10,d20), C=cross(x10,x20);
-        find_possible_quadratic_roots_in_01(A, B, C, possible_t, collision_epsilon );
-        possible_t.push_back(1); // always check the end
-        // check proximities at possible collision times
-        double proximity_tol=collision_epsilon*std::sqrt(mag2(x0old)+mag2(x0new)+mag2(x1old)+mag2(x1new)+mag2(x2new)+mag2(x2old));
-        for(size_t i=0; i<possible_t.size(); ++i)
-        {
-            double collision_time=possible_t[i];
-            double u=1-collision_time;
-            double distance;
-            check_point_edge_proximity( false, u*x0old+collision_time*x0new, u*x1old+collision_time*x1new, u*x2old+collision_time*x2new, distance );
-            if(distance<=proximity_tol) return true;
-        }
-        return false;
-    }
-    
-    // check if point x0 collides with segment x1-x2 during the motion from
-    // old to new positions, return barycentric coordinates, normal, and time if so.
-    bool check_point_edge_collision( const Vec2d &x0old, const Vec2d &x1old, const Vec2d &x2old,
-                                    const Vec2d &x0new, const Vec2d &x1new, const Vec2d &x2new,
-                                    double &s12, Vec2d &normal, double &collision_time, double tol )
-    {
-        Vec2d x10=x1old-x0old, x20=x2old-x0old;
-        Vec2d d10=(x1new-x0new)-x10, d20=(x2new-x0new)-x20;
-        // figure out possible collision times to check
-        std::vector<double> possible_t;
-        double A=cross(d10,d20), B=cross(d10,x20)+cross(x10,d20), C=cross(x10,x20);
-        find_possible_quadratic_roots_in_01(A, B, C, possible_t, tol );
-        possible_t.push_back(1); // always check the end
-        // check proximities at possible collision times
-        double proximity_tol=tol*std::sqrt(mag2(x0old)+mag2(x0new)+mag2(x1old)+mag2(x1new)+mag2(x2new)+mag2(x2old));
-        for(size_t i=0; i<possible_t.size(); ++i)
-        {
-            collision_time=possible_t[i];
-            double u=1-collision_time;
-            double distance;
-            check_point_edge_proximity( false, 
-                                       u*x0old+collision_time*x0new, 
-                                       u*x1old+collision_time*x1new, 
-                                       u*x2old+collision_time*x2new,
-                                       distance, s12, normal, 1.0 );
-            
-            if(distance<=proximity_tol) 
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    // ---------------------------------------------------------
-    
-    
-    bool check_edge_edge_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                   const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                   double collision_epsilon)
-    {
-        std::vector<double> possible_times;
-        find_coplanarity_times(x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, possible_times);
-        for(size_t a=0; a<possible_times.size(); ++a){
-            double t=possible_times[a];
-            Vec3d xt0=(1-t)*x0+t*xnew0, xt1=(1-t)*x1+t*xnew1, xt2=(1-t)*x2+t*xnew2, xt3=(1-t)*x3+t*xnew3;
-            double distance;
-            check_edge_edge_proximity(xt0, xt1, xt2, xt3, distance);
-            if(distance<collision_epsilon)
-                return true;
-        }
-        return false;
-    }
-    
-    
-    // ---------------------------------------------------------
-    
-    void degenerate_get_edge_edge_collision_normal(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                                   double s0, double s2, Vec3d& normal )
-    {  
-        
-        // if that didn't work, try cross-product of edges at the start
-        normal=cross(x1-x0, x3-x2);
-        double m=mag(normal);
-        if(m>sqr(degen_normal_epsilon)){
-            normal/=m;
-        }else{
-            // if that didn't work, try vector between points at the start
-            normal=(s2*x2+(1-s2)*x3)-(s0*x0+(1-s0)*x1);
-            m=mag(normal);
-            if(m>degen_normal_epsilon){
-                normal/=m;
-            }else{
-                // if that didn't work, boy are we in trouble; just get any non-parallel vector
-                Vec3d dx=x1-x0;
-                if(dx[0]!=0 || dx[1]!=0){
-                    normal=Vec3d(dx[1], -dx[0], 0);
-                    normal/=mag(normal);
-                }else{
-                    dx=x3-x2;
-                    if(dx[0]!=0 || dx[1]!=0){
-                        normal=Vec3d(dx[1], -dx[0], 0);
-                        normal/=mag(normal);
-                    }else{
-                        normal=Vec3d(0, 1, 0); // the last resort
-                    }
-                }
-            }
-        }
-        
-    }
-    
-    
-    // ---------------------------------------------------------
-    
-    bool check_edge_edge_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                   const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                   double &s0, double &s2, Vec3d &normal, double &t, double collision_epsilon)
-    {
-        std::vector<double> possible_times;
-        find_coplanarity_times(x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, possible_times);
-        for(size_t a=0; a<possible_times.size(); ++a){
-            t=possible_times[a];
-            Vec3d xt0=(1-t)*x0+t*xnew0, xt1=(1-t)*x1+t*xnew1, xt2=(1-t)*x2+t*xnew2, xt3=(1-t)*x3+t*xnew3;
-            double distance;
-            check_edge_edge_proximity(xt0, xt1, xt2, xt3, distance, s0, s2, normal);
-            if(distance<collision_epsilon){
-                // now figure out a decent normal
-                if(distance<1e-2*degen_normal_epsilon){ // if we don't trust the normal...
-                    // first try the cross-product of edges at collision time
-                    normal=cross(xt1-xt0, xt3-xt2);
-                    double m=mag(normal);
-                    if(m>sqr(degen_normal_epsilon)){
-                        normal/=m;
-                    }else
-                    {
-                        degenerate_get_edge_edge_collision_normal( x0, x1, x2, x3, s0, s2, normal );
-                    }
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    // ---------------------------------------------------------
-    
-    bool check_point_triangle_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                        const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                        double collision_epsilon)
-    {
-        std::vector<double> possible_times;
-        find_coplanarity_times(x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, possible_times);
-        for(size_t a=0; a<possible_times.size(); ++a){
-            double t=possible_times[a];
-            Vec3d xt0=(1-t)*x0+t*xnew0, xt1=(1-t)*x1+t*xnew1, xt2=(1-t)*x2+t*xnew2, xt3=(1-t)*x3+t*xnew3;
-            double distance;
-            check_point_triangle_proximity(xt0, xt1, xt2, xt3, distance);
-            if(distance<collision_epsilon)
-                return true;
-        }
-        return false;
-    }
-    
-    // ---------------------------------------------------------
-    
-    
-    void degenerate_get_point_triangle_collision_normal(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                                        
-                                                        double &s1, double &s2, double &s3,
-                                                        Vec3d& normal )
-    {
-        
-        // try triangle normal at start
-        normal=cross(x2-x1, x3-x1);
-        double m=mag(normal);
-        if(m>sqr(degen_normal_epsilon))
-        {
-            normal/=m;
-        }
-        else
-        {
-            // if that didn't work, try vector between points at the start
-            
-            normal=(s1*x1+s2*x2+s3*x3)-x0;
-            m=mag(normal);
-            if(m>degen_normal_epsilon)
-            {
-                normal/=m;
-            }
-            else
-            {
-                // if that didn't work, boy are we in trouble; just get any non-parallel vector
-                Vec3d dx=x2-x1;
-                if(dx[0]!=0 || dx[1]!=0)
-                {
-                    normal=Vec3d(dx[1], -dx[0], 0);
-                    normal/=mag(normal);
-                }
-                else
-                {
-                    dx=x3-x1;
-                    if(dx[0]!=0 || dx[1]!=0)
-                    {
-                        normal=Vec3d(dx[1], -dx[0], 0);
-                        normal/=mag(normal);
-                    }
-                    else
-                    {
-                        normal=Vec3d(0, 1, 0); // the last resort
-                    }
-                }
-            }
-        }
-    }
-    
-    
-    // ---------------------------------------------------------
-    
-    bool check_point_triangle_collision(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                        const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                        double &s1, double &s2, double &s3, Vec3d &normal, double &t, double collision_epsilon)
-    {
-        std::vector<double> possible_times;
-        find_coplanarity_times(x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, possible_times);
-        
-        for(size_t a=0; a<possible_times.size(); ++a){
-            t=possible_times[a];
-            Vec3d xt0=(1-t)*x0+t*xnew0, xt1=(1-t)*x1+t*xnew1, xt2=(1-t)*x2+t*xnew2, xt3=(1-t)*x3+t*xnew3;
-            double distance;
-            check_point_triangle_proximity(xt0, xt1, xt2, xt3, distance, s1, s2, s3, normal);
-            if(distance<collision_epsilon){
-                // now figure out a decent normal
-                if(distance<1e-2*degen_normal_epsilon)
-                { // if we don't trust the normal...
-                    // first try the triangle normal at collision time
-                    normal=cross(xt2-xt1, xt3-xt1);
-                    double m=mag(normal);
-                    if(m>sqr(degen_normal_epsilon)){
-                        normal/=m;
-                    }
-                    else
-                    {
-                        degenerate_get_point_triangle_collision_normal( x0, x1, x2, x3, s1, s2, s3, normal );               
-                    }
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    
-    void find_coplanarity_times(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3,
-                                const Vec3d &xnew0, const Vec3d &xnew1, const Vec3d &xnew2, const Vec3d &xnew3,
-                                std::vector<double> &possible_times)
-    {
-        
-        if ( simplex_verbose )
-        {
-            std::cout << "finding coplanarity times... " << std::endl;
-        }
-        
-        possible_times.clear();
-        
-        // cubic coefficients, A*t^3+B*t^2+C*t+D (for t in [0,1])
-        Vec3d x03=x0-x3, x13=x1-x3, x23=x2-x3;
-        Vec3d v03=(xnew0-xnew3)-x03, v13=(xnew1-xnew3)-x13, v23=(xnew2-xnew3)-x23;
-        double A=triple(v03,v13,v23),
-        B=triple(x03,v13,v23)+triple(v03,x13,v23)+triple(v03,v13,x23),
-        C=triple(x03,x13,v23)+triple(x03,v13,x23)+triple(v03,x13,x23),
-        D=triple(x03,x13,x23);
-        const double convergence_tol=cubic_solver_tol*(std::fabs(A)+std::fabs(B)+std::fabs(C)+std::fabs(D));
-        
-        // find intervals to check, or just solve it if it reduces to a quadratic =============================
-        std::vector<double> interval_times;
-        double discriminant=B*B-3*A*C; // of derivative of cubic, 3*A*t^2+2*B*t+C, divided by 4 for convenience
-        if(discriminant<=0){ // monotone cubic: only one root in [0,1] possible
-            
-            if ( simplex_verbose ) { std::cout << "monotone cubic" << std::endl; }
-            
-            // so we just 
-            interval_times.push_back(0);
-            interval_times.push_back(1);
-        }else{ // positive discriminant, B!=0
-            if(A==0){ // the cubic is just a quadratic, B*t^2+C*t+D ========================================
-                discriminant=C*C-4*B*D; // of the quadratic
-                if(discriminant<=0){
-                    double t=-C/(2*B);
-                    if(t>=-cubic_solver_tol && t<=1+cubic_solver_tol){
-                        t=clamp(t, 0., 1.);
-                        if(std::fabs(signed_volume((1-t)*x0+t*xnew0, (1-t)*x1+t*xnew1, (1-t)*x2+t*xnew2, (1-t)*x3+t*xnew3))<convergence_tol)
-                            possible_times.push_back(t);
-                    }
-                }else{ // two separate real roots
-                    double t0, t1;
-                    if(C>0) t0=(-C-std::sqrt(discriminant))/(2*B);
-                    else    t0=(-C+std::sqrt(discriminant))/(2*B);
-                    t1=D/(B*t0);
-                    if(t1<t0) swap(t0,t1);
-                    if(t0>=-cubic_solver_tol && t0<=1+cubic_solver_tol) possible_times.push_back(clamp(t0, 0., 1.));
-                    if(t1>=-cubic_solver_tol && t1<=1+cubic_solver_tol) add_unique(possible_times, clamp(t1, 0., 1.));
-                }
-                
-                if ( simplex_verbose )
-                {
-                    std::cout << "A == 0" << std::endl;
-                    for ( size_t i = 0; i < possible_times.size(); ++i )
-                    {
-                        std::cout << "possible_time: " << possible_times[i] << std::endl;
-                    }
-                    std::cout << std::endl;
-                }
-                
-                return;
-            }else{ // cubic is not monotone: divide up [0,1] accordingly =====================================
-                double t0, t1;
-                if(B>0) t0=(-B-std::sqrt(discriminant))/(3*A);
-                else    t0=(-B+std::sqrt(discriminant))/(3*A);
-                t1=C/(3*A*t0);
-                if(t1<t0) swap(t0,t1);
-                
-                if ( simplex_verbose ) { std::cout << "interval times: " << t0 << ", " << t1 << std::endl; }
-                
-                interval_times.push_back(0);
-                if(t0>0 && t0<1)
-                    interval_times.push_back(t0);
-                if(t1>0 && t1<1)
-                    interval_times.push_back(t1);
-                interval_times.push_back(1);
-            }
-        }
-        
-        if ( simplex_verbose )
-        {
-            unsigned int n_samples = 20;
-            double dt = 1.0 / (double)n_samples;
-            double min_val = 1e30;
-            for ( unsigned int i = 0; i < n_samples; ++i )
-            {
-                double sample_t = dt * i;
-                double sample_val = signed_volume((1-sample_t)*x0+sample_t*xnew0, 
-                                                  (1-sample_t)*x1+sample_t*xnew1, 
-                                                  (1-sample_t)*x2+sample_t*xnew2, 
-                                                  (1-sample_t)*x3+sample_t*xnew3);
-                
-                std::cout << "sample_val: " << sample_val << std::endl;
-                
-                min_val = min( min_val, fabs(sample_val) );
-            }
-            std::cout << "min_val: " << min_val << std::endl;
-        }   
-        
-        
-        // look for roots in indicated intervals ==============================================================
-        // evaluate coplanarity more accurately at each endpoint of the intervals
-        std::vector<double> interval_values(interval_times.size());
-        for(size_t i=0; i<interval_times.size(); ++i){
-            double t=interval_times[i];
-            interval_values[i]=signed_volume((1-t)*x0+t*xnew0, (1-t)*x1+t*xnew1, (1-t)*x2+t*xnew2, (1-t)*x3+t*xnew3);   
-            if ( simplex_verbose ) 
-            {  
-                std::cout << "interval time: " << t << ", value: " << interval_values[i] << std::endl; 
-            }
-        }
-        
-        if ( simplex_verbose ) 
-        {  
-            std::cout << "convergence_tol: " << convergence_tol << std::endl;
-        }
-        
-        // first look for interval endpoints that are close enough to zero, without a sign change
-        for(size_t i=0; i<interval_times.size(); ++i){
-            if(interval_values[i]==0){
-                possible_times.push_back(interval_times[i]);
-            }else if(std::fabs(interval_values[i])<convergence_tol){
-                if((i==0 || (interval_values[i-1]>=0 && interval_values[i]>=0) || (interval_values[i-1]<=0 && interval_values[i]<=0))    
-                   &&(i==interval_times.size()-1 || (interval_values[i+1]>=0 && interval_values[i]>=0) || (interval_values[i+1]<=0 && interval_values[i]<=0))){
-                    possible_times.push_back(interval_times[i]);
-                }
-            }
-        }
-        // and then search in intervals with a sign change
-        for(size_t i=1; i<interval_times.size(); ++i){
-            double tlo=interval_times[i-1], thi=interval_times[i], tmid;
-            double vlo=interval_values[i-1], vhi=interval_values[i], vmid;
-            if((vlo<0 && vhi>0) || (vlo>0 && vhi<0)){
-                // start off with secant approximation (in case the cubic is actually linear)
-                double alpha=vhi/(vhi-vlo);
-                tmid=alpha*tlo+(1-alpha)*thi;
-                int iteration=0;
-                
-                if ( simplex_verbose ) { std::cout << "cubic solver tol: " << 1e-2*convergence_tol << std::endl; }
-                
-                for(; iteration<50; ++iteration){
-                    vmid=signed_volume((1-tmid)*x0+tmid*xnew0, (1-tmid)*x1+tmid*xnew1,
-                                       (1-tmid)*x2+tmid*xnew2, (1-tmid)*x3+tmid*xnew3);
-                    if(std::fabs(vmid)<1e-2*convergence_tol) break;
-                    if((vlo<0 && vmid>0) || (vlo>0 && vmid<0)){ // if sign change between lo and mid
-                        thi=tmid;
-                        vhi=vmid;
-                    }else{ // otherwise sign change between hi and mid
-                        tlo=tmid;
-                        vlo=vmid;
-                    }
-                    if(iteration%2) alpha=0.5; // sometimes go with bisection to guarantee we make progress
-                    else alpha=vhi/(vhi-vlo); // other times go with secant to hopefully get there fast
-                    tmid=alpha*tlo+(1-alpha)*thi;
-                }
-                if ( iteration >= 50 && simplex_verbose )
-                {
-                    std::cout << "cubic solve failed" << std::endl;
-                }
-                possible_times.push_back(tmid);
-            }
-        }
-        sort(possible_times.begin(), possible_times.end());
-        
-        if ( simplex_verbose )
-        {
-            std::cout << "=================" << std::endl;
-            
-            for ( size_t i = 0; i < possible_times.size(); ++i )
-            {
-                std::cout << "possible_time: " << possible_times[i] << std::endl;
-            }
-            std::cout << std::endl;
-        }
-        
-        
-    }
-    
-    
-    
-} // namespace
-
-
-// --------------------------------------------------------------------------------------------------
-// 2D Continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t ,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t ,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t ,
-                             double& edge_alpha, Vec2d& normal, double& time, double& rel_disp)
-{
-    bool result = check_point_edge_collision( x0, x1, x2, xnew0, xnew1, xnew2, edge_alpha, normal, time, g_collision_epsilon );
-    
-    if ( result )
-    {
-        Vec2d dx0 = xnew0 - x0;
-        Vec2d dx1 = xnew1 - x1;
-        Vec2d dx2 = xnew2 - x2;
-        rel_disp = dot( normal, dx0 - (edge_alpha)*dx1 - (1.0-edge_alpha)*dx2 );
-    }
-    
-    
-    return result;
-    
-}
-
-// --------------------------------------------------------------------------------------------------
-
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t ,
-                             const Vec2d& x1, const Vec2d& xnew1, size_t ,
-                             const Vec2d& x2, const Vec2d& xnew2, size_t  )
-{
-    
-    bool result = check_point_edge_collision( x0, x1, x2, xnew0, xnew1, xnew2, g_collision_epsilon );
-    
-    return result;
-    
-}
-
-// --------------------------------------------------------------------------------------------------
-// 2D Static intersection detection
-// --------------------------------------------------------------------------------------------------
-
-bool segment_segment_intersection(const Vec2d& x0, size_t , 
-                                  const Vec2d& x1, size_t ,
-                                  const Vec2d& x2, size_t ,
-                                  const Vec2d& x3, size_t )
-{
-    double s0, s2;
-    return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, g_collision_epsilon );
-}
-
-bool segment_segment_intersection(const Vec2d& x0, size_t , 
-                                  const Vec2d& x1, size_t ,
-                                  const Vec2d& x2, size_t ,
-                                  const Vec2d& x3, size_t ,
-                                  double &s0, double& s2 )
-{
-    return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, g_collision_epsilon );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D Continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------
-
-
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t ,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t ,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t ,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t  )
-{   
-    bool cubic_result = check_point_triangle_collision( x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, g_collision_epsilon );
-    return cubic_result;
-}
-
-// --------------------------------------------------------------------------------------------------
-
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t ,
-                              const Vec3d& x1, const Vec3d& xnew1, size_t ,
-                              const Vec3d& x2, const Vec3d& xnew2, size_t ,
-                              const Vec3d& x3, const Vec3d& xnew3, size_t ,
-                              double& bary1, double& bary2, double& bary3,
-                              Vec3d& normal,
-                              double& relative_normal_displacement )
-{
-    
-    double t;
-    bool cubic_result = check_point_triangle_collision( x0, x1, x2, x3, 
-                                                       xnew0, xnew1, xnew2, xnew3,
-                                                       bary1, bary2, bary3,
-                                                       normal, t, g_collision_epsilon );
-    
-    Vec3d dx0 = xnew0 - x0;
-    Vec3d dx1 = xnew1 - x1;
-    Vec3d dx2 = xnew2 - x2;
-    Vec3d dx3 = xnew3 - x3;   
-    relative_normal_displacement = dot( normal, dx0 - bary1*dx1 - bary2*dx2 - bary3*dx3 );
-    
-    return cubic_result;
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t ,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t ,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t ,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t )
-{
-    
-    bool cubic_result = check_edge_edge_collision( x0, x1, x2, x3,
-                                                  xnew0, xnew1, xnew2, xnew3,
-                                                  g_collision_epsilon );
-    
-    return cubic_result;
-    
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-
-
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t ,
-                               const Vec3d& x1, const Vec3d& xnew1, size_t ,
-                               const Vec3d& x2, const Vec3d& xnew2, size_t ,
-                               const Vec3d& x3, const Vec3d& xnew3, size_t ,
-                               double& bary0, double& bary2,
-                               Vec3d& normal,
-                               double& relative_normal_displacement )
-{
-    
-    double t;
-    bool cubic_result = check_edge_edge_collision( x0, x1, x2, x3,
-                                                  xnew0, xnew1, xnew2, xnew3,
-                                                  bary0, bary2,
-                                                  normal, t, 
-                                                  g_collision_epsilon );
-    
-    Vec3d dx0 = xnew0 - x0;
-    Vec3d dx1 = xnew1 - x1;
-    Vec3d dx2 = xnew2 - x2;
-    Vec3d dx3 = xnew3 - x3;   
-    
-    relative_normal_displacement = dot( normal, bary0*dx0 + (1.0-bary0)*dx1 - bary2*dx2 - (1.0-bary2)*dx3 );
-    
-    return cubic_result;
-    
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D Static intersection detection
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------
-
-// x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, size_t ,
-                                   const Vec3d& x1, size_t ,
-                                   const Vec3d& x2, size_t ,
-                                   const Vec3d& x3, size_t ,
-                                   const Vec3d& x4, size_t ,
-                                   bool ,
-                                   bool  )
-{
-    double bary[5];
-    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-bool segment_triangle_intersection(const Vec3d& x0, size_t ,
-                                   const Vec3d& x1, size_t ,
-                                   const Vec3d& x2, size_t ,
-                                   const Vec3d& x3, size_t ,
-                                   const Vec3d& x4, size_t ,
-                                   double& bary0, double& bary1, double& bary2, double& bary3, double& bary4,
-                                   bool ,
-                                   bool  )
-{
-    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary0, &bary1, &bary2, &bary3, &bary4 );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, size_t ,
-                                    const Vec3d& x1, size_t ,
-                                    const Vec3d& x2, size_t ,
-                                    const Vec3d& x3, size_t ,
-                                    const Vec3d& x4, size_t )
-{
-    double bary[5];
-    return simplex_intersection3d( 1, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] );
-}
-
-#endif
-
-
-
diff --git a/extern/eltopo/common/fe_ccd_wrapper.cpp b/extern/eltopo/common/fe_ccd_wrapper.cpp
deleted file mode 100644
index 2110249..0000000
--- a/extern/eltopo/common/fe_ccd_wrapper.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-// ---------------------------------------------------------
-//
-//  fe_ccd_wrapper.cpp
-//  Tyson Brochu 2009
-//
-//  Forward error analysis implementation of collision and intersection queries.
-//
-// ---------------------------------------------------------
-
-#include <ccd_wrapper.h>
-
-#ifdef USE_FORWARD_ERROR_CCD
-
-#include <predicates.h>
-#include <vec.h>
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                       const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                       const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                       const Vec3d& x3, const Vec3d& xnew3, unsigned int index3 )
-{
-   assert( index1 < index2 && index2 < index3 );
-   return fe_point_triangle_collision( x0, xnew0, x1, xnew1, x2, xnew2, x3, xnew3 );
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                       const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                       const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                       const Vec3d& x3, const Vec3d& xnew3, unsigned int index3,
-                                       double& bary1, double& bary2, double& bary3,
-                                       Vec3d& normal,
-                                       double& t,
-                                       double& relative_normal_displacement,
-                                       bool verbose )
-{
-   assert( index1 < index2 && index2 < index3 );
-   return fe_point_triangle_collision( x0, xnew0, x1, xnew1, x2, xnew2, x3, xnew3, bary1, bary2, bary3, normal, t, relative_normal_displacement, verbose );
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                        const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                        const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                        const Vec3d& x3, const Vec3d& xnew3, unsigned int index3)
-{
-   assert( index0 < index1 && index2 < index3 );
-   return fe_segment_segment_collision( x0, xnew0, x1, xnew1, x2, xnew2, x3, xnew3 );
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-
-bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                        const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                        const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                        const Vec3d& x3, const Vec3d& xnew3, unsigned int index3,
-                                        double& bary0, double& bary2,
-                                        Vec3d& normal,
-                                        double& t,
-                                        double& relative_normal_displacement,
-                                        bool verbose )
-{
-   assert( index0 < index1 && index2 < index3 );
-   return fe_segment_segment_collision( x0, xnew0, x1, xnew1, x2, xnew2, x3, xnew3, bary0, bary2, normal, t, relative_normal_displacement, verbose );
-}
-
-
-#endif
-
-
diff --git a/extern/eltopo/common/fileio.cpp b/extern/eltopo/common/fileio.cpp
deleted file mode 100644
index 00c9f5e..0000000
--- a/extern/eltopo/common/fileio.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-// ---------------------------------------------------------
-//
-//  fileio.cpp
-//  Tyson Brochu 2009
-//
-// ---------------------------------------------------------
-
-#include "fileio.h"
-
-#include <bfstream.h>
-
-const unsigned int NUM_RAYTRACER_BOOLEAN_PARAMETERS = 2;
-const unsigned int NUM_RAYTRACER_FLOAT_PARAMETERS = 9;
-
-// ---------------------------------------------------------
-///
-/// Write mesh in binary format
-///
-// ---------------------------------------------------------
-
-bool write_mesh_file( double curr_t,
-                     unsigned int nverts,
-                     const double* verts,
-                     const double* masses,
-                     unsigned int ntris,
-                     const unsigned int* tris,
-                     const char *filename_format, ...)
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bofstream outfile( filename_format, ap );
-    va_end(ap);
-    
-    outfile.write_endianity();
-    
-    outfile << curr_t;
-    
-    outfile << nverts;
-    for ( unsigned int i = 0; i < nverts; ++i )
-    {
-        outfile << verts[3*i+0];
-        outfile << verts[3*i+1];
-        outfile << verts[3*i+2];
-    }
-    
-    for ( unsigned int i = 0; i < nverts; ++i )
-    {
-        outfile << masses[i];
-    }
-    
-    outfile << ntris;
-    
-    for ( unsigned int t = 0; t < ntris; ++t )
-    {
-        outfile << tris[3*t+0];
-        outfile << tris[3*t+1];
-        outfile << tris[3*t+2];
-    }
-    
-    outfile.close();
-    
-    return outfile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// Write mesh in binary format, with per-vertex velocities
-///
-// ---------------------------------------------------------
-bool write_mesh_file_with_velocities( double curr_t,
-                                     unsigned int nverts,
-                                     const double* verts,
-                                     const double* velocities,
-                                     const double* masses,
-                                     unsigned int ntris,
-                                     const unsigned int* tris,
-                                     const char *filename_format, ...)
-{
-    
-    va_list ap;
-    va_start(ap, filename_format);   
-    bofstream outfile( filename_format, ap );
-    va_end(ap);
-    
-    outfile.write_endianity();
-    
-    outfile << curr_t;
-    
-    outfile << nverts;
-    for ( unsigned int i = 0; i < nverts; ++i )
-    {
-        outfile << verts[3*i+0];
-        outfile << verts[3*i+1];
-        outfile << verts[3*i+2];
-    }
-    
-    for ( unsigned int i = 0; i < nverts; ++i )
-    {
-        outfile << velocities[3*i+0];
-        outfile << velocities[3*i+1];
-        outfile << velocities[3*i+2];
-    }
-    
-    for ( unsigned int i = 0; i < nverts; ++i )
-    {
-        outfile << masses[i];
-    }
-    
-    outfile << ntris;
-    
-    for ( unsigned int t = 0; t < ntris; ++t )
-    {
-        outfile << tris[3*t+0];
-        outfile << tris[3*t+1];
-        outfile << tris[3*t+2];
-    }   
-    
-    return outfile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// Read mesh in binary format
-///
-// ---------------------------------------------------------
-
-bool read_mesh_file( double* curr_t,
-                    unsigned int* nverts,
-                    double** verts,
-                    double** masses,
-                    unsigned int* ntris,
-                    unsigned int** tris,
-                    const char *filename_format, ...)
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bifstream infile( filename_format, ap );
-    va_end(ap);
-    
-    assert( infile.good() );
-    
-    infile.read_endianity();
-    
-    infile >> *curr_t;
-    
-    infile >> *nverts;
-    
-    *verts = new double[3*(*nverts)];
-    
-    for ( unsigned int i = 0; i < (*nverts); ++i )
-    {
-        infile >> (*verts)[3*i+0];
-        infile >> (*verts)[3*i+1];
-        infile >> (*verts)[3*i+2];
-    }
-    
-    *masses = new double[*nverts];
-    
-    for ( unsigned int i = 0; i < *nverts; ++i )
-    {
-        infile >> (*masses)[i];
-    }
-    
-    infile >> *ntris;
-    
-    *tris = new unsigned int[3*(*ntris)];
-    
-    for ( unsigned int t = 0; t < *ntris; ++t )
-    {
-        infile >> (*tris)[3*t+0];
-        infile >> (*tris)[3*t+1];
-        infile >> (*tris)[3*t+2];
-    }
-    
-    infile.close();
-    
-    return infile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// Read mesh in binary format, with per-vertex velocities
-///
-// ---------------------------------------------------------
-
-bool read_mesh_file_with_velocities( double* curr_t,
-                                    unsigned int* nverts,
-                                    double** verts,
-                                    double** velocities,
-                                    double** masses,
-                                    unsigned int* ntris,
-                                    unsigned int** tris,
-                                    const char *filename_format, ...)
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bifstream infile( filename_format, ap );
-    va_end(ap);
-    
-    assert( infile.good() );
-    
-    infile.read_endianity();
-    
-    infile >> *curr_t;
-    
-    infile >> *nverts;
-    
-    *verts = new double[3*(*nverts)];
-    
-    for ( unsigned int i = 0; i < (*nverts); ++i )
-    {
-        infile >> (*verts)[3*i+0];
-        infile >> (*verts)[3*i+1];
-        infile >> (*verts)[3*i+2];
-    }
-    
-    *velocities = new double[3*(*nverts)];
-    
-    for ( unsigned int i = 0; i < (*nverts); ++i )
-    {
-        infile >> (*velocities)[3*i+0];
-        infile >> (*velocities)[3*i+1];
-        infile >> (*velocities)[3*i+2];
-    }
-    
-    *masses = new double[*nverts];
-    
-    for ( unsigned int i = 0; i < *nverts; ++i )
-    {
-        infile >> (*masses)[i];
-    }
-    
-    infile >> *ntris;
-    
-    *tris = new unsigned int[3*(*ntris)];
-    
-    for ( unsigned int t = 0; t < *ntris; ++t )
-    {
-        infile >> (*tris)[3*t+0];
-        infile >> (*tris)[3*t+1];
-        infile >> (*tris)[3*t+2];
-    }
-    
-    infile.close();
-    
-    return infile.good();
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-void free_mesh_data( double* verts,
-                    double* masses,
-                    unsigned int* tris )
-{
-    delete[] verts;
-    delete[] masses;
-    delete[] tris;
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-void free_mesh_data_with_velocities( double* verts,
-                                    double* velocities,
-                                    double* masses,
-                                    unsigned int* tris )
-{
-    delete[] verts;
-    delete[] velocities;
-    delete[] masses;
-    delete[] tris;
-}
-
-// ---------------------------------------------------------
-// ---------------------------------------------------------
-// ---------------------------------------------------------
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-
-bool write_raytracer_file( const bool *booleanParameters,
-                          const float *floatParameters,
-                          const char *filename_format, ... )
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bofstream outfile( filename_format, ap );
-    va_end(ap);
-    
-    outfile.write_endianity();
-    
-    for ( unsigned int i = 0; i < NUM_RAYTRACER_BOOLEAN_PARAMETERS; ++i )
-    {
-        outfile << booleanParameters[i];
-    }
-    
-    for ( unsigned int i = 0; i < NUM_RAYTRACER_FLOAT_PARAMETERS; ++i )
-    {
-        outfile << floatParameters[i];
-    }
-    
-    outfile.close();
-    
-    return outfile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-
-bool read_raytracer_file( bool **booleanParameters,
-                         float **floatParameters,
-                         const char *filename_format, ... )
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bifstream infile( filename_format, ap );
-    va_end(ap);
-    
-    assert( infile.good() );
-    
-    infile.read_endianity();
-    
-    *booleanParameters = new bool[NUM_RAYTRACER_BOOLEAN_PARAMETERS];
-    
-    for ( unsigned int i = 0; i < NUM_RAYTRACER_BOOLEAN_PARAMETERS; ++i )
-    {
-        infile >> (*booleanParameters)[i];
-    }
-    
-    *floatParameters = new float[NUM_RAYTRACER_FLOAT_PARAMETERS];
-    
-    for ( unsigned int i = 0; i < NUM_RAYTRACER_FLOAT_PARAMETERS; ++i )
-    {
-        infile >> (*floatParameters)[i];
-    }
-    
-    infile.close();
-    
-    return infile.good();
-    
-}
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-
-void free_raytracer_data( bool *booleanParameters, 
-                         float *floatParameters )
-{
-    delete[] booleanParameters;
-    delete[] floatParameters;
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-bool write_marker_particle_file( int nparticles,
-                                const float* x,
-                                const char *filename_format, ... )
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bofstream outfile( filename_format, ap );
-    va_end(ap);
-    
-    outfile.write_endianity();
-    
-    outfile << nparticles;
-    
-    for ( int i = 0; i < nparticles; ++i )
-    {
-        outfile << x[3*i+0];
-        outfile << x[3*i+1];
-        outfile << x[3*i+2];      
-    }
-    
-    outfile.close();
-    return outfile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-bool read_marker_particle_file( int* nparticles,
-                               float** x,
-                               const char *filename_format, ... )
-{
-    va_list ap;
-    va_start(ap, filename_format);   
-    bifstream infile( filename_format, ap );
-    va_end(ap);
-    
-    if ( !infile.good() )
-    {
-        fprintf( stderr, "bad infile\n" );
-        return false;
-    }
-    
-    infile.read_endianity();
-    
-    infile >> *nparticles;
-    
-    (*x) = new float[ 3 * (*nparticles) ];
-    
-    for ( int i = 0; i < *nparticles; ++i )
-    {
-        infile >> (*x)[3*i+0];
-        infile >> (*x)[3*i+1];
-        infile >> (*x)[3*i+2];      
-    }
-    
-    infile.close();
-    return infile.good();
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-
-void free_marker_particle_data( float* x )
-{
-    delete[] x;
-}
-
-
diff --git a/extern/eltopo/common/fileio.h b/extern/eltopo/common/fileio.h
deleted file mode 100644
index 6b31b1e..0000000
--- a/extern/eltopo/common/fileio.h
+++ /dev/null
@@ -1,135 +0,0 @@
-
-#ifndef FILEIO_H
-#define FILEIO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-    extern const unsigned int NUM_RAYTRACER_BOOLEAN_PARAMETERS;
-    extern const unsigned int NUM_RAYTRACER_FLOAT_PARAMETERS;
-    
-    // -----------------------------------------------------------------------
-    //
-    // Triangle mesh file format:
-    //
-    // endianity
-    // current sim time     (double)
-    // number of verts      (unsigned int)
-    // verts                (3 * nverts doubles)
-    // OPTIONAL: velocities (3 * nverts doubles)
-    // masses               (nverts doubles)
-    // number of triangles  (unsinged int)
-    // triangles            (3 * ntris unsigned ints)
-    //
-    // -----------------------------------------------------------------------
-    
-    
-    bool write_mesh_file( double curr_t,
-                         unsigned int nverts,
-                         const double* verts,
-                         const double* masses,
-                         unsigned int ntris,
-                         const unsigned int* tris,
-                         const char *filename_format, ...);
-    
-    bool write_mesh_file_with_velocities( double curr_t,
-                                         unsigned int nverts,
-                                         const double* verts,
-                                         const double* velocities,
-                                         const double* masses,
-                                         unsigned int ntris,
-                                         const unsigned int* tris,
-                                         const char *filename_format, ...);
-    
-    bool read_mesh_file( double* curr_t,
-                        unsigned int* nverts,
-                        double** verts,
-                        double** masses,
-                        unsigned int* ntris,
-                        unsigned int** tris,
-                        const char *filename_format, ...);
-    
-    bool read_mesh_file_with_velocities( double* curr_t,
-                                        unsigned int* nverts,
-                                        double** verts,
-                                        double** velocities,
-                                        double** masses,
-                                        unsigned int* ntris,
-                                        unsigned int** tris,
-                                        const char *filename_format, ...);
-    
-    void free_mesh_data( double* verts,
-                        double* masses,
-                        unsigned int* tris );
-    
-    void free_mesh_data_with_velocities( double* verts,
-                                        double* velocities,
-                                        double* masses,
-                                        unsigned int* tris );
-    
-    // -----------------------------------------------------------------------
-    //
-    // Raytracer parameter file format
-    // 
-    // endianity
-    // scatterShader           (bool)
-    // diffuseShader           (bool)
-    // falloff                 (float)
-    // minTransmittance        (float)
-    // scatter                 (float)
-    // averageSampleInterval   (float)
-    // sampleIntervalVariance  (float)
-    // whiteLevel              (float)
-    // ambientLight            (float)
-    // overheadLight           (float)
-    // fillLight               (float)
-    //
-    // -----------------------------------------------------------------------
-    
-    bool write_raytracer_file( const bool *booleanParameters,
-                              const float *floatParameters,
-                              const char *filename_format, ... );
-    
-    bool read_raytracer_file( bool **booleanParameters,
-                             float **floatParameters,
-                             const char *filename_format, ... );
-    
-    void free_raytracer_data( bool *booleanParameters, 
-                             float *floatParameters );
-    
-    // -----------------------------------------------------------------------
-    //
-    // Marker particle file format:
-    //
-    // endianity
-    // number of particles  (int)
-    // particle locations   ( 3 * nparticles floats)
-    //
-    // -----------------------------------------------------------------------
-    
-    bool write_marker_particle_file( int nparticles,
-                                    const float* x,
-                                    const char *filename_format, ... );
-    
-    bool read_marker_particle_file( int* nparticles,
-                                   float** x,
-                                   const char *filename_format, ... );
-    
-    void free_marker_particle_data( float* x );
-    
-    // -----------------------------------------------------------------------
-    //
-    // Procedural flow field parameters
-    //
-    // -----------------------------------------------------------------------
-    
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
-
diff --git a/extern/eltopo/common/gluvi.cpp b/extern/eltopo/common/gluvi.cpp
deleted file mode 100644
index 6f2cca9..0000000
--- a/extern/eltopo/common/gluvi.cpp
+++ /dev/null
@@ -1,1307 +0,0 @@
-
-#include <cmath>
-#include <cstdarg>
-#include <cstdlib>
-#include <fstream>
-#include <gluvi.h>
-#include <limits>
-#include <vec.h>
-
-#ifdef __APPLE__
-#include <OpenGL/OpenGL.h>
-#else
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <GL/glut.h>
-#include <GL/glext.h>
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846f
-#endif
-
-using namespace std;
-
-namespace Gluvi{
-    
-    bool taking_screenshot = false;
-    GLuint screenshot_fbo;
-    
-    
-    Target3D::
-    Target3D(float target_[3], float dist_, float heading_, float pitch_, float fovy_, float near_clip_factor_, float far_clip_factor_)
-    : dist(dist_), heading(heading_), pitch(pitch_),
-    default_dist(dist_), default_heading(heading_), default_pitch(pitch_),
-    fovy(fovy_), 
-    near_clip_factor(near_clip_factor_), far_clip_factor(far_clip_factor_),
-    action_mode(INACTIVE),
-    oldmousex(0), oldmousey(0)
-    {
-        if(target_){
-            target[0]=target_[0];
-            target[1]=target_[1];
-            target[2]=target_[2];
-        }else{
-            target[0]=0;
-            target[1]=0;
-            target[2]=0;
-        }
-        default_target[0]=target[0];
-        default_target[1]=target[1];
-        default_target[2]=target[2];
-    }
-    
-    void Target3D::
-    click(int button, int state, int x, int y)
-    {
-        if(state==GLUT_UP)
-            action_mode=INACTIVE;
-        else if(button==GLUT_LEFT_BUTTON)
-            action_mode=ROTATE;
-        else if(button==GLUT_MIDDLE_BUTTON)
-            action_mode=TRUCK;
-        else if(button==GLUT_RIGHT_BUTTON)
-            action_mode=DOLLY;
-        oldmousex=x;
-        oldmousey=y;
-    }
-    
-    void Target3D::
-    drag(int x, int y)
-    {
-        switch(action_mode){
-            case INACTIVE:
-                return; // nothing to do
-            case ROTATE:
-                heading+=0.007f*(oldmousex-x);
-                if(heading<-M_PI) heading+=2.0f*(float)M_PI;
-                else if(heading>M_PI) heading-=2.0f*(float)M_PI;
-                pitch+=0.007f*(oldmousey-y);
-                if(pitch<-0.5*M_PI) pitch=-0.5f*(float)M_PI;
-                else if(pitch>0.5*M_PI) pitch=0.5f*(float)M_PI;
-                break;
-            case TRUCK:
-                target[0]+=(0.002f*dist)*cos(heading)*(oldmousex-x);
-                target[1]-=(0.002f*dist)*(oldmousey-y);
-                target[2]-=(0.002f*dist)*sin(heading)*(oldmousex-x);
-                break;
-            case DOLLY:
-                dist*=pow(1.01f, oldmousey-y + x-oldmousex);
-                break;
-        }
-        oldmousex=x;
-        oldmousey=y;
-        glutPostRedisplay();
-    }
-    
-    void Target3D::
-    return_to_default(void)
-    {
-        target[0]=default_target[0];
-        target[1]=default_target[1];
-        target[2]=default_target[2];
-        dist=default_dist;
-        heading=default_heading;
-        pitch=default_pitch;
-    }
-    
-    void Target3D::
-    transform_mouse(int x, int y, float ray_origin[3], float ray_direction[3])
-    {
-        float ch=cos(heading), sh=sin(heading);
-        float cp=cos(pitch), sp=sin(pitch);
-        
-        ray_origin[0]=target[0]+dist*sh*cp;
-        ray_origin[1]=target[1]-dist*sp;
-        ray_origin[2]=target[2]+dist*ch*cp;
-        
-        float scale=0.5f*tan(fovy)/winheight;
-        float camx=(x-0.5f*winwidth)*scale, camy=(0.5f*winheight-y)*scale, camz=-1.0f; // in camera coordinates, this is ray_direction (but not normalized)
-        // now need to rotate into world space from camera space
-        float px=camx, py=camy*cp-camz*sp, pz=camy*sp+camz*cp;
-        ray_direction[0]=px*ch+pz*sh;
-        ray_direction[1]=py;
-        ray_direction[2]=-px*sh+pz*ch;
-        
-        //@@@ is this right to get us to the near clipping plane?
-        ray_origin[0]+=near_clip_factor*dist*ray_direction[0];
-        ray_origin[1]+=near_clip_factor*dist*ray_direction[1];
-        ray_origin[2]+=near_clip_factor*dist*ray_direction[2];
-        
-        // normalize direction vector
-        float mag=sqrt(ray_direction[0]*ray_direction[0]
-                       + ray_direction[1]*ray_direction[1]
-                       + ray_direction[2]*ray_direction[2]);
-        ray_direction[0]/=mag;
-        ray_direction[1]/=mag;
-        ray_direction[2]/=mag;
-    }
-    
-    void Target3D::
-    get_viewing_direction(float direction[3])
-    {
-        float ch=cos(heading), sh=sin(heading);
-        float cp=cos(pitch), sp=sin(pitch);
-        direction[0]=-sh*cp;
-        direction[1]=sp;
-        direction[2]=-ch*cp;
-    }
-    
-    void Target3D::get_up_vector(float up[3])
-    {
-        // Rotate the y-coordinate vector about the x-axis by pitch, then the y-axis by heading
-        // up = R_y(h) * R_x(p) * <0,1,0>
-        
-        float ch=cos(heading), sh=sin(heading);
-        float cp=cos(pitch), sp=sin(pitch);
-        up[0] = sh*sp;
-        up[1] = cp;
-        up[2] = ch*sp;   
-    }
-    
-    void Target3D::
-    gl_transform(void)
-    {
-        glViewport(0, 0, (GLsizei)winwidth, (GLsizei)winheight);
-        
-        glMatrixMode(GL_PROJECTION);
-        glLoadIdentity();
-        //gluPerspective(fovy, winwidth/(float)winheight, near_clip_factor*dist, far_clip_factor*dist);
-        
-        gluPerspective(fovy, winwidth/(float)winheight, near_clip_factor, far_clip_factor);
-        
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-        //   GLfloat pos[3];
-        //   pos[0]=target[0]-dist*sin(heading)*cos(pitch);
-        //   pos[1]=target[1]-dist*sin(pitch);
-        //   pos[2]=target[2]-dist*cos(heading)*cos(pitch);
-        glTranslatef(0, 0, -dist); // translate target dist away in the z direction
-        glRotatef(-180.0f/(float)M_PI*pitch, 1.0f, 0.0f, 0.0f); // rotate pitch in the yz plane
-        glRotatef(-180.0f/(float)M_PI*heading, 0.0f, 1.0f, 0.0f); // rotate heading in the xz plane
-        glTranslatef(-target[0], -target[1], -target[2]); // translate target to origin
-    }
-    
-    void Target3D::
-    export_rib(ostream &output)
-    {
-        output<<"Clipping "<<near_clip_factor*dist<<" "<<far_clip_factor*dist<<endl; // could be more generous here!
-        output<<"Projection \"perspective\" \"fov\" "<<fovy<<endl;
-        output<<"ReverseOrientation"<<endl;  // RenderMan has a different handedness from OpenGL's default
-        output<<"Scale 1 1 -1"<<endl;        // so we need to correct for that here
-        output<<"Translate 0 0 "<<-dist<<endl;
-        output<<"Rotate "<<-180/M_PI*pitch<<" 1 0 0"<<endl;
-        output<<"Rotate "<<-180/M_PI*heading<<" 0 1 0"<<endl;
-        output<<"Translate "<<-target[0]<<" "<<-target[1]<<" "<<-target[2]<<endl;
-    }
-    
-    //=================================================================================
-    
-    TargetOrtho3D::
-    TargetOrtho3D(float target_[3], float dist_, float heading_, float pitch_, float height_factor_, float near_clip_factor_, float far_clip_factor_)
-    : dist(dist_), heading(heading_), pitch(pitch_),
-    default_dist(dist_), default_heading(heading_), default_pitch(pitch_),
-    height_factor(height_factor_),
-    near_clip_factor(near_clip_factor_), far_clip_factor(far_clip_factor_), action_mode(INACTIVE),   
-    oldmousex(0), oldmousey(0)
-    {
-        if(target_){
-            target[0]=target_[0];
-            target[1]=target_[1];
-            target[2]=target_[2];
-        }else{
-            target[0]=0;
-            target[1]=0;
-            target[2]=0;
-        }
-        default_target[0]=target[0];
-        default_target[1]=target[1];
-        default_target[2]=target[2];
-        default_dist=dist;
-        default_heading=heading;
-        default_pitch=pitch;
-    }
-    
-    void TargetOrtho3D::
-    click(int button, int state, int x, int y)
-    {
-        if(state==GLUT_UP)
-            action_mode=INACTIVE;
-        else if(button==GLUT_LEFT_BUTTON)
-            action_mode=ROTATE;
-        else if(button==GLUT_MIDDLE_BUTTON)
-            action_mode=TRUCK;
-        else if(button==GLUT_RIGHT_BUTTON)
-            action_mode=DOLLY;
-        oldmousex=x;
-        oldmousey=y;
-    }
-    
-    void TargetOrtho3D::
-    drag(int x, int y)
-    {
-        switch(action_mode){
-            case INACTIVE:
-                return; // nothing to do
-            case ROTATE:
-                heading+=0.007f*(oldmousex-x);
-                if(heading<-M_PI) heading+=2.0f*(float)M_PI;
-                else if(heading>M_PI) heading-=2.0f*(float)M_PI;
-                pitch+=0.007f*(oldmousey-y);
-                if(pitch<-0.5f*(float)M_PI) pitch=-0.5f*(float)M_PI;
-                else if(pitch>0.5f*(float)M_PI) pitch=0.5f*(float)M_PI;
-                break;
-            case TRUCK:
-                target[0]+=(0.002f*dist)*cos(heading)*(oldmousex-x);
-                target[1]-=(0.002f*dist)*(oldmousey-y);
-                target[2]-=(0.002f*dist)*sin(heading)*(oldmousex-x);
-                break;
-            case DOLLY:
-                dist*=pow(1.01f, oldmousey-y + x-oldmousex);
-                break;
-        }
-        oldmousex=x;
-        oldmousey=y;
-        glutPostRedisplay();
-    }
-    
-    void TargetOrtho3D::
-    return_to_default(void)
-    {
-        target[0]=default_target[0];
-        target[1]=default_target[1];
-        target[2]=default_target[2];
-        dist=default_dist;
-        heading=default_heading;
-        pitch=default_pitch;
-    }
-    
-    void TargetOrtho3D::
-    transform_mouse(int, int, float* /*ray_origin[3]*/, float* /*ray_direction[3]*/ )
-    {
-        // @@@ unimplemented
-    }
-    
-    void TargetOrtho3D::
-    get_viewing_direction(float direction[3])
-    {
-        float ch=cos(heading), sh=sin(heading);
-        float cp=cos(pitch), sp=sin(pitch);
-        direction[0]=-sh*cp;
-        direction[1]=sp;
-        direction[2]=-ch*cp;
-    }
-    
-    void TargetOrtho3D::
-    gl_transform(void)
-    {
-        glViewport(0, 0, (GLsizei)winwidth, (GLsizei)winheight);
-        
-        glMatrixMode(GL_PROJECTION);
-        glLoadIdentity();
-        float halfheight=0.5f*height_factor*dist, halfwidth=halfheight*winwidth/(float)winheight;
-        glOrtho(-halfwidth, halfwidth, -halfheight, halfheight, near_clip_factor*dist, far_clip_factor*dist);
-        
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-        glTranslatef(0, 0, -dist); // translate target dist away in the z direction
-        glRotatef(-180.0f/(float)M_PI*pitch, 1.0f, 0.0f, 0.0f); // rotate pitch in the yz plane
-        glRotatef(-180.0f/(float)M_PI*heading, 0.0f, 1.0f, 0.0f); // rotate heading in the xz plane
-        glTranslatef(-target[0], -target[1], -target[2]); // translate target to origin
-    }
-    
-    void TargetOrtho3D::
-    export_rib(ostream &output)
-    {
-        output<<"Clipping "<<near_clip_factor*dist<<" "<<far_clip_factor*dist<<endl; // could be more generous here!
-        output<<"Projection \"orthographic\""<<endl;
-        //@@@ incomplete: need a scaling according to height_factor*dist somewhere in here
-        output<<"ReverseOrientation"<<endl;  // RenderMan has a different handedness from OpenGL's default
-        output<<"Scale 1 1 -1"<<endl;        // so we need to correct for that here
-        output<<"Translate 0 0 "<<-dist<<endl;
-        output<<"Rotate "<<-180/M_PI*pitch<<" 1 0 0"<<endl;
-        output<<"Rotate "<<-180/M_PI*heading<<" 0 1 0"<<endl;
-        output<<"Translate "<<-target[0]<<" "<<-target[1]<<" "<<-target[2]<<endl;
-    }
-    
-    //=================================================================================
-    
-    PanZoom2D::
-    PanZoom2D(float bottom_, float left_, float height_)
-    : bottom(bottom_), left(left_), height(height_), 
-    default_bottom(bottom_), default_left(left_), default_height(height_), action_mode(INACTIVE),
-    oldmousex(0), oldmousey(0), moved_since_mouse_down(false),
-    clickx(~0), clicky(~0)
-    {}
-    
-    void PanZoom2D::
-    click(int button, int state, int x, int y)
-    {
-        if(state==GLUT_UP){
-            float r=height/winheight;
-            switch(action_mode){
-                case PAN:
-                    if(!moved_since_mouse_down){
-                        // make mouse click the centre of the window
-                        left+=r*(x-0.5f*winwidth);
-                        bottom+=r*(0.5f*winheight-y);
-                        glutPostRedisplay();
-                    }
-                    break;
-                case ZOOM_IN:
-                    if(moved_since_mouse_down){
-                        // zoom in to selection
-                        float desired_width=fabs((x-clickx)*height/winheight);
-                        float desired_height=fabs((y-clicky)*height/winheight);
-                        if(desired_height==0) desired_height=height/winheight;
-                        if(desired_width*winheight > desired_height*winwidth)
-                            desired_height=winheight*desired_width/winwidth;
-                        else
-                            desired_width=winwidth*desired_height/winheight;
-                        left+=0.5f*(x+clickx)*height/winheight-0.5f*desired_width;
-                        bottom+=(winheight-0.5f*(y+clicky))*height/winheight-0.5f*desired_height;
-                        height=desired_height;
-                        
-                    }else{
-                        // zoom in by some constant factor on the mouse click
-                        float factor=0.70710678118654752440084f;
-                        left+=(1-factor)*height*(x/(float)winheight);
-                        bottom+=(1-factor)*height*(1-y/(float)winheight);
-                        height*=factor;
-                    }
-                    glutPostRedisplay();
-                    break;
-                case ZOOM_OUT:
-                    // zoom out by some constant factor
-                {
-                    float factor=1.41421356237309504880168f;
-                    left-=0.5f*(factor-1)*height;
-                    bottom-=0.5f*(factor-1)*winwidth*height/winheight;
-                    height*=factor;
-                }
-                    glutPostRedisplay();
-                    break;
-                default:
-                    ;// nothing to do
-            }
-            action_mode=INACTIVE;
-            
-        }else if(button==GLUT_LEFT_BUTTON)
-        {
-            action_mode=PAN;
-        }
-        else if(button==GLUT_MIDDLE_BUTTON){
-            clickx=x;
-            clicky=y;
-            action_mode=ZOOM_IN;
-        }else if(button==GLUT_RIGHT_BUTTON)
-            action_mode=ZOOM_OUT;
-        moved_since_mouse_down=false;
-        oldmousex=x;
-        oldmousey=y;
-    }
-    
-    void PanZoom2D::
-    drag(int x, int y)
-    {
-        if(x!=oldmousex || y!=oldmousey){
-            moved_since_mouse_down=true;
-            if(action_mode==PAN){
-                float r=height/winheight;
-                left-=r*(x-oldmousex);
-                bottom+=r*(y-oldmousey);
-                glutPostRedisplay();
-            }else if(action_mode==ZOOM_IN)
-                glutPostRedisplay();
-            
-            glutPostRedisplay();
-            oldmousex=x;
-            oldmousey=y;
-        }
-    }
-    
-    void PanZoom2D::
-    return_to_default(void)
-    {
-        bottom=default_bottom;
-        left=default_left;
-        height=default_height;
-    }
-    
-    void PanZoom2D::
-    transform_mouse(int x, int y, float coords[2])
-    {
-        float r=height/winheight;
-        coords[0]=x*r+left;
-        coords[1]=(winheight-y)*r+bottom;
-    }
-    
-    void PanZoom2D::
-    gl_transform(void)
-    {
-        glViewport(0, 0, (GLsizei)winwidth, (GLsizei)winheight);
-        glMatrixMode(GL_PROJECTION);
-        glLoadIdentity();
-        glOrtho(left, left+(height*winwidth)/winheight, bottom, bottom+height, 0, 1);
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-    }
-    
-    void PanZoom2D::
-    export_rib(ostream &output)
-    {
-        // no projection matrix
-        output<<"Clipping 1 2000"<<endl; // somewhat arbitrary - hopefully this is plenty of space
-        output<<"ReverseOrientation"<<endl;  // RenderMan has a different handedness from OpenGL's default
-        output<<"Scale 1 1 -1"<<endl;        // so we need to correct for that here
-        // scale so that smaller dimension gets scaled to size 2
-        float scalefactor;
-        if(winwidth>winheight) scalefactor=2.0f/height;
-        else scalefactor=2.0f/(winwidth*height/winheight);
-        output<<"Scale "<<scalefactor<<" "<<scalefactor<<" 1"<<endl;
-        // translate so centre of view gets mapped to (0,0,1000)
-        output<<"Translate "<<-(left+0.5*winwidth*height/winheight)<<" "<<-(bottom+0.5*height)<< " 1000"<<endl;
-    }
-    
-    void PanZoom2D::
-    display_screen(void)
-    {
-        if(action_mode==ZOOM_IN && moved_since_mouse_down){
-            glColor3f(1,1,1);
-            glBegin(GL_LINE_STRIP);
-            glVertex2i(clickx, winheight-clicky);
-            glVertex2i(oldmousex, winheight-clicky);
-            glVertex2i(oldmousex, winheight-oldmousey);
-            glVertex2i(clickx, winheight-oldmousey);
-            glVertex2i(clickx, winheight-clicky);
-            glEnd();
-        }
-    }
-    
-    //=================================================================================
-    
-    StaticText::
-    StaticText(const char *text_)
-    : text(text_)
-    {}
-    
-    void StaticText::
-    display(int x, int y)
-    {
-        dispx=x;
-        dispy=y;
-        width=glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)text)+1;
-        height=15;
-        glColor3f(0.3f, 0.3f, 0.3f);
-        glRasterPos2i(x, y-height+2);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-        glColor3f(1, 1, 1);
-        glRasterPos2i(x+1, y-height+3);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-    }
-    
-    //=================================================================================
-    
-    DynamicText::DynamicText( const std::string& text_ )
-    : 
-    text(text_)
-    {
-        color[0] = 0.0f;
-        color[1] = 0.0f;
-        color[2] = 0.0f;
-    }
-    
-    void DynamicText::set_color( float r, float g, float b )
-    {
-        color[0] = r;
-        color[1] = g;
-        color[2] = b;
-    }
-    
-    void DynamicText::display( int x, int y )
-    {
-        dispx=x;
-        dispy=y;
-        width=glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)text.c_str())+1;
-        height=15;
-        
-        //   glColor3f(0.3f, 0.3f, 0.3f);
-        //   glRasterPos2i(x, y-height+2);
-        //   for(int i=0; text[i]!=0; ++i)
-        //      glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-        
-        glColor3f( color[0], color[1], color[2] );
-        
-        glRasterPos2i(x+1, y-height+3);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);   
-    }
-    
-    
-    //=================================================================================
-    
-    Button::
-    Button(const char *text_, int minwidth_)
-    : status(UNINVOLVED), text(text_), minwidth(minwidth_)
-    {}
-    
-    void Button::
-    display(int x, int y)
-    {
-        dispx=x;
-        dispy=y;
-        int textwidth=glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)text);
-        if(textwidth<minwidth) width=minwidth+24;
-        else width=textwidth+24;
-        height=17;
-        if(status==UNINVOLVED){
-            glColor3f(0.7f, 0.7f, 0.7f);
-            glBegin(GL_QUADS);
-            glVertex2i(x+1, y-1);
-            glVertex2i(x+width, y-1);
-            glVertex2i(x+width, y-height+1);
-            glVertex2i(x+1, y-height+1);
-            glEnd();
-            glColor3f(0.3f, 0.3f, 0.3f);
-            glLineWidth(1);
-            glBegin(GL_LINE_STRIP);
-            glVertex2i(x, y-2);
-            glVertex2i(x, y-height);
-            glVertex2i(x+width-1, y-height);
-            glEnd();
-            glColor3f(0.3f, 0.3f, 0.3f);
-        }else{
-            if(status==SELECTED) glColor3f(0.8f, 0.8f, 0.8f);
-            else                 glColor3f(1, 1, 1);
-            glBegin(GL_QUADS);
-            glVertex2i(x, y-1);
-            glVertex2i(x+width, y-1);
-            glVertex2i(x+width, y-height);
-            glVertex2i(x, y-height);
-            glEnd();
-            glColor3f(0, 0, 0);
-        }
-        glRasterPos2i(x+(width-textwidth)/2, y-height+5);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-    }
-    
-    bool Button::
-    click(int state, int x, int y)
-    {
-        if(state==GLUT_DOWN && x>dispx && x<=dispx+width && y<dispy-2 && y>=dispy-height){
-            status=HIGHLIGHTED;
-            glutPostRedisplay();
-            return true;
-        }else if(state==GLUT_UP && status!=UNINVOLVED){
-            status=UNINVOLVED;
-            glutPostRedisplay();
-            if(x>=dispx && x<dispx+width && y<dispy-2 && y>=dispy-height)
-                action();
-            return true;
-        }else
-            return false;
-    }
-    
-    void Button::
-    drag(int x, int y)
-    {
-        // needs to control highlighting (SELECTED vs. HIGHLIGHTED)
-        if(status==SELECTED && x>=dispx && x<dispx+width && y<dispy-2 && y>=dispy-height){
-            status=HIGHLIGHTED;
-            glutPostRedisplay();
-        }else if(status==HIGHLIGHTED && !(x>=dispx && x<dispx+width && y<dispy-2 && y>=dispy-height)){
-            status=SELECTED;
-            glutPostRedisplay();
-        }
-    }
-    
-    //=================================================================================
-    
-    Slider::
-    Slider(const char *text_, int length_, int position_, int justify_)
-    : status(UNINVOLVED), text(text_), length(length_), justify(justify_), position(position_),
-    scrollxmin(~0), scrollxmax(~0), scrollymin(~0), scrollymax(~0), clickx(~0) 
-    {}
-    
-    void Slider::
-    display(int x, int y)
-    {
-        dispx=x;
-        dispy=y;
-        width=glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)text);
-        if(width<justify) width=justify;
-        width+=11+6+length+1;
-        height=15;
-        glColor3f(0.3f, 0.3f, 0.3f);
-        glRasterPos2i(x, y-height+2);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-        glColor3f(1, 1, 1);
-        glRasterPos2i(x+1, y-height+3);
-        for(int i=0; text[i]!=0; ++i)
-            glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, text[i]);
-        scrollxmin=x+width-length-12;
-        scrollxmax=x+width;
-        scrollymin=y-height+1;
-        scrollymax=y-2;
-        glColor3f(0.3f, 0.3f, 0.3f);
-        glLineWidth(1);
-        glBegin(GL_LINE_STRIP);
-        glVertex2i(scrollxmin, scrollymax-1);
-        glVertex2i(scrollxmin, scrollymin);
-        glVertex2i(scrollxmax-1, scrollymin);
-        glVertex2i(scrollxmax-1, scrollymax-1);
-        glEnd();
-        glColor3f(0.7f, 0.7f, 0.7f);
-        glBegin(GL_LINE_STRIP);
-        glVertex2i(scrollxmin+1, scrollymax);
-        glVertex2i(scrollxmin+1, scrollymin+1);
-        glVertex2i(scrollxmax, scrollymin+1);
-        glVertex2i(scrollxmax, scrollymax);
-        glEnd();
-        if(status==UNINVOLVED){
-            glColor3f(0.3f, 0.3f, 0.3f);
-            glBegin(GL_LINE_STRIP);
-            glVertex2i(scrollxmin+position+2, scrollymax-2);
-            glVertex2i(scrollxmin+position+2, scrollymin+2);
-            glVertex2i(scrollxmin+position+10, scrollymin+2);
-            glEnd();
-            glColor3f(0.7f, 0.7f, 0.7f);
-            glBegin(GL_QUADS);
-            glVertex2i(scrollxmin+position+3, scrollymin+3);
-            glVertex2i(scrollxmin+position+11, scrollymin+3);
-            glVertex2i(scrollxmin+position+11, scrollymax);
-            glVertex2i(scrollxmin+position+3, scrollymax);
-            glEnd();
-        }else{ // SELECTED
-            glColor3f(1, 1, 1);
-            glBegin(GL_QUADS);
-            glVertex2i(scrollxmin+position+2, scrollymin+2);
-            glVertex2i(scrollxmin+position+11, scrollymin+2);
-            glVertex2i(scrollxmin+position+11, scrollymax);
-            glVertex2i(scrollxmin+position+2, scrollymax);
-            glEnd();
-        }
-    }
-    
-    bool Slider::
-    click(int state, int x, int y)
-    {
-        if(state==GLUT_DOWN && x>scrollxmin+position+2 && x<=scrollxmin+position+11 && y<scrollymax-1 && y>=scrollymin+2){
-            status=SELECTED;
-            clickx=x;
-            glutPostRedisplay();
-            return true;
-        }else if(status!=UNINVOLVED && state==GLUT_UP){
-            status=UNINVOLVED;
-            glutPostRedisplay();
-            return true;
-        }else
-            return false;
-    }
-    
-    void Slider::
-    drag(int x, int /*y*/ )
-    {
-        if(status==SELECTED){
-            glutPostRedisplay();
-            int newposition=position+(x-clickx);
-            clickx=x;
-            if(newposition<0){
-                clickx+=(0-newposition);
-                newposition=0;
-            }else if(newposition>length){
-                clickx+=(length-newposition);
-                newposition=length;
-            }
-            if(newposition!=position){
-                position=newposition;
-                action();
-                glutPostRedisplay();
-            }
-        }
-    }
-    
-    //=================================================================================
-    
-    WidgetList::
-    WidgetList(int indent_, bool hidden_)
-    : indent(indent_), hidden(hidden_), list(), downclicked_member(-1)
-    {
-    }
-    
-    void WidgetList::
-    display(int x, int y)
-    {
-        dispx=x;
-        dispy=y;
-        if(hidden){
-            width=height=0;
-        }else{
-            height=0;
-            for(unsigned int i=0; i<list.size(); ++i){
-                list[i]->display(x+indent, y-height);
-                height+=list[i]->height;
-                width=(width<indent+list[i]->width) ? indent+list[i]->width : width;
-            }
-        }
-    }
-    
-    bool WidgetList::
-    click(int state, int x, int y)
-    {
-        //if(hidden || x<dispx || x>=dispx+width || y>=dispy || y<dispy-height) return false; // early exit
-        if(state==GLUT_DOWN){ // search for correct widget
-            for(unsigned int i=0; i<list.size(); ++i){
-                if(list[i]->click(state, x, y)){
-                    downclicked_member=i;
-                    return true;
-                }
-            }
-        }else if(state==GLUT_UP && downclicked_member>=0){
-            list[downclicked_member]->click(state, x, y);
-            downclicked_member=-1;
-        }
-        return false;
-    }
-    
-    void WidgetList::
-    drag(int x, int y)
-    {
-        if(downclicked_member>=0)
-            list[downclicked_member]->drag(x, y);
-    }
-    
-    
-    //=================================================================================
-    
-    typedef enum {NOBODY, CAMERA, WIDGETS, USER} MouseOwnerType;
-    
-    MouseOwnerType mouse_owner = NOBODY;
-    
-    //
-    // Local ("static") functions
-    //
-    
-    namespace {
-        
-        //=================================================================================
-        
-        void gluviReshape(int w, int h)
-        {
-            winwidth=w;
-            winheight=h;
-            glutPostRedisplay(); // triggers the camera to adjust itself to the new dimensions
-        }
-        
-        //=================================================================================
-        
-        void gluviDisplay()
-        {
-            
-            glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-            
-            // draw the scene
-            if(camera) camera->gl_transform();
-            if(userDisplayFunc) userDisplayFunc();
-            
-            // now draw widgets on top
-            glPushAttrib(GL_CURRENT_BIT|GL_ENABLE_BIT|GL_LINE_BIT);
-            glDisable(GL_DEPTH_TEST);
-            glDisable(GL_LIGHTING);
-            glLineWidth(1);
-            // and probably more needs setting before widgets
-            
-            glMatrixMode(GL_MODELVIEW);
-            glLoadIdentity();
-            glMatrixMode(GL_PROJECTION);
-            glLoadIdentity();
-            gluOrtho2D(0, winwidth, 0, winheight);
-            
-            root.display(0, winheight);
-            
-            // and allow the camera to draw something on screen (e.g. for zooming extent)
-            if(camera) camera->display_screen();
-            
-            glPopAttrib();
-            
-            glutSwapBuffers();
-        }
-        
-        void gluviMouse(int button, int state, int x, int y)
-        {
-            if(state==GLUT_DOWN){
-                int mods=glutGetModifiers();
-                if(camera && mods==GLUT_ACTIVE_SHIFT){
-                    camera->click(button, state, x, y);
-                    mouse_owner=CAMERA;
-                    //}else if(button==GLUT_LEFT_BUTTON && root.click(state, x, winheight-y)){
-                    //   mouse_owner=WIDGETS;
-                }else if(userMouseFunc){
-                    userMouseFunc(button, state, x, y);
-                    mouse_owner=USER;
-                }
-            }else{ // mouse up - send event to whoever got the mouse down
-                switch(mouse_owner){
-                    case CAMERA:
-                        camera->click(button, state, x, y);
-                        break;
-                    case WIDGETS:
-                        //root.click(state, x, winheight-y);
-                        break;
-                    case USER:
-                        if(userMouseFunc) userMouseFunc(button, state, x, y);
-                        break;
-                    default:
-                        ;// nothing to do
-                }
-                mouse_owner=NOBODY;
-            }
-        }
-        
-        //=================================================================================
-        
-        void gluviDrag(int x, int y)
-        {
-            switch(mouse_owner){
-                case CAMERA:
-                    camera->drag(x, y);
-                    break;
-                case WIDGETS:
-                    //root.drag(x, winheight-y);
-                    break;
-                case USER:
-                    if(userDragFunc) userDragFunc(x, y);
-                    break;
-                default:
-                    ;// nothing to do
-            }
-        }
-        
-        
-    }  // namespace
-    
-    
-    //=================================================================================
-    
-    void ppm_screenshot(const char *filename_format, ...)
-    {
-        va_list ap;
-        va_start(ap, filename_format);
-#ifdef _MSC_VER
-#define FILENAMELENGTH 256
-        char filename[FILENAMELENGTH];
-        _vsnprintf(filename, FILENAMELENGTH, filename_format, ap);
-        ofstream out(filename, ofstream::binary);
-#else
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        ofstream out(filename, ofstream::binary);
-        free(filename);
-#endif
-        if(!out) return;
-        GLubyte *image_buffer=new GLubyte[3*winwidth*winheight];
-        glReadBuffer(GL_FRONT);
-        glReadPixels(0, 0, winwidth, winheight, GL_RGB, GL_UNSIGNED_BYTE, image_buffer);
-        out<<"P6\n"<<winwidth<<' '<<winheight<<" 255\n";
-        for(int i=1; i<=winheight; ++i)
-            out.write((const char*)image_buffer+3*winwidth*(winheight-i), 3*winwidth);
-        delete[] image_buffer;
-    }
-    
-    namespace { 
-        
-        void write_big_endian_ushort(std::ostream &output, unsigned short v)
-        {
-            output.put( static_cast<char>((v>>8)%256) );
-            output.put( static_cast<char>(v%256) );
-        }
-        
-        void write_big_endian_uint(std::ostream &output, unsigned int v)
-        {
-            output.put(static_cast<char>((v>>24)%256));
-            output.put(static_cast<char>((v>>16)%256));
-            output.put(static_cast<char>((v>>8)%256));
-            output.put(static_cast<char>(v%256));
-        }
-        
-    }  // unnamed namespace
-    
-    void sgi_screenshot(const char *filename_format, ...)
-    {
-        va_list ap;
-        va_start(ap, filename_format);
-#ifdef _MSC_VER
-#define FILENAMELENGTH 256
-        char filename[FILENAMELENGTH];
-        _vsnprintf(filename, FILENAMELENGTH, filename_format, ap);
-        ofstream output(filename, ofstream::binary);
-#else
-        char *filename;
-        vasprintf(&filename, filename_format, ap);
-        ofstream output(filename, ofstream::binary);
-#endif
-        if(!output) return;
-        
-        const int mipmap_level = 1;
-        const int size_scale = 1 << (mipmap_level);
-        
-        winwidth = size_scale * winwidth;
-        winheight = size_scale * winheight;
-        
-        glGenFramebuffers(1, &screenshot_fbo);
-        glBindFramebuffer(GL_FRAMEBUFFER, screenshot_fbo);
-        
-        GLuint textureId;
-        glGenTextures(1, &textureId);
-        glBindTexture(GL_TEXTURE_2D, textureId);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); // automatic mipmap
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmap_level);
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, winwidth, winheight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-        
-        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textureId, 0);
-        
-        //
-        // Depth/stencil buffer
-        //
-        
-        GLuint depthRenderbuffer;
-        glGenRenderbuffers(1, &depthRenderbuffer);
-        glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
-        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, winwidth, winheight);
-        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);
-        GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
-        
-        if (status != GL_FRAMEBUFFER_COMPLETE) 
-        {
-            std::cout << "Problem with OpenGL framebuffer after specifying depth/stencil render buffer: " << hex << status << std::endl;
-            assert(0);
-        }
-        
-        glPixelStorei(GL_PACK_ALIGNMENT, 1);
-        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);   
-        glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
-        
-        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-        
-        // draw the scene
-        
-        taking_screenshot = true;
-        
-        if(camera) camera->gl_transform();
-        if(userDisplayFunc) userDisplayFunc();
-        
-        taking_screenshot = false;
-        
-        glEnable(GL_TEXTURE_2D);
-        glGenerateMipmapEXT(GL_TEXTURE_2D);
-        
-        GLint file_width, file_height;
-        glGetTexLevelParameteriv( GL_TEXTURE_2D, mipmap_level, GL_TEXTURE_WIDTH, &file_width );
-        glGetTexLevelParameteriv( GL_TEXTURE_2D, mipmap_level, GL_TEXTURE_HEIGHT, &file_height );
-        
-        GLubyte *buffer = new GLubyte[ 4 * file_width * file_height ]; 
-        
-        glGetTexImage( GL_TEXTURE_2D, mipmap_level, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
-        
-        
-        GLubyte* r_buffer = new GLubyte[file_width*file_height];            
-        GLubyte* g_buffer = new GLubyte[file_width*file_height];            
-        GLubyte* b_buffer = new GLubyte[file_width*file_height];            
-        
-        for(int y = 0; y < file_height; y++)
-            for(int x = 0; x < file_width; x++)
-            {
-                int startAddressOfPixel = ((y*file_width) + x)*4;
-                
-                r_buffer[ ((y*file_width) + x) ] = buffer[startAddressOfPixel+0];
-                g_buffer[ ((y*file_width) + x) ] = buffer[startAddressOfPixel+1];
-                b_buffer[ ((y*file_width) + x) ] = buffer[startAddressOfPixel+2];
-            }
-        
-        
-        // first write the SGI header
-        
-        write_big_endian_ushort(output, 474); // magic number to identify this as an SGI image file
-        output.put(0); // uncompressed
-        output.put(1); // use 8-bit colour depth
-        write_big_endian_ushort(output, 3); // number of dimensions
-        assert( file_width < std::numeric_limits<unsigned short>::max() );
-        assert( file_height < std::numeric_limits<unsigned short>::max() );   
-        write_big_endian_ushort(output, static_cast<unsigned short>(file_width) ); // x size
-        write_big_endian_ushort(output, static_cast<unsigned short>(file_height) ); // y size
-        write_big_endian_ushort(output, 3); // three colour channels (z size)
-        write_big_endian_uint(output, 0); // minimum pixel value
-        write_big_endian_uint(output, 255); // maximum pixel value
-        write_big_endian_uint(output, 0); // dummy spacing
-        // image name
-        int i;
-        for(i=0; i<80 && filename[i]; ++i)
-            output.put(filename[i]);
-        for(; i<80; ++i)
-            output.put(0);
-        write_big_endian_uint(output, 0); // colormap is normal
-        for(i=0; i<404; ++i) output.put(0); // filler to complete header
-        
-        // now write the SGI image data
-        
-        output.write((const char*)r_buffer, file_width*file_height);
-        output.write((const char*)g_buffer, file_width*file_height);
-        output.write((const char*)b_buffer, file_width*file_height);
-        
-        delete[] r_buffer;
-        delete[] g_buffer;
-        delete[] b_buffer;
-        delete[] buffer;
-        
-        glBindFramebuffer( GL_FRAMEBUFFER, 0 );
-        glBindTexture(GL_TEXTURE_2D, 0);
-        
-        winwidth /= size_scale;
-        winheight /= size_scale;
-        if(camera) camera->gl_transform();
-        
-        glDeleteTextures( 1, &textureId );
-        glDeleteRenderbuffers( 1, &depthRenderbuffer );
-        glDeleteFramebuffers(1, &screenshot_fbo);
-        
-#ifndef _MSC_VER
-        free(filename);
-#endif
-    }
-    
-    void set_generic_lights(void)
-    {
-        glEnable(GL_LIGHTING);
-        {
-            GLfloat ambient[4] = {.3f, .3f, .3f, 1.0f};
-            glLightModelfv (GL_LIGHT_MODEL_AMBIENT,ambient);
-        }
-        {
-            GLfloat color[4] = {.4f, .4f, .4f, 1.0f};
-            glLightfv (GL_LIGHT0, GL_DIFFUSE, color);
-            glLightfv (GL_LIGHT0, GL_SPECULAR, color);
-            glEnable (GL_LIGHT0);
-        }
-        {
-            GLfloat color[4] = {.4f, .4f, .4f, 1.0f};
-            glLightfv (GL_LIGHT1, GL_DIFFUSE, color);
-            glLightfv (GL_LIGHT1, GL_SPECULAR, color);
-            glEnable (GL_LIGHT1);
-        }
-        {
-            GLfloat color[4] = {.2f, .2f, .2f, 1.0f};
-            glLightfv (GL_LIGHT2, GL_DIFFUSE, color);
-            glLightfv (GL_LIGHT2, GL_SPECULAR, color);
-            glEnable (GL_LIGHT2);
-        }
-    }
-    
-    void set_generic_material(float r, float g, float b, GLenum face)
-    {
-        GLfloat ambient[4], diffuse[4], specular[4];
-        ambient[0]=0.1f*r+0.03f; ambient[1]=0.1f*g+0.03f; ambient[2]=0.1f*b+0.03f; ambient[3]=1.0f;
-        diffuse[0]=0.7f*r;      diffuse[1]=0.7f*g;      diffuse[2]=0.7f*b;      diffuse[3]=1.0f;
-        specular[0]=0.1f*r+0.1f; specular[1]=0.1f*g+0.1f; specular[2]=0.1f*b+0.1f; specular[3]=1.0f;
-        glMaterialfv(face, GL_AMBIENT, ambient);
-        glMaterialfv(face, GL_DIFFUSE, diffuse);
-        glMaterialfv(face, GL_SPECULAR, specular);
-        glMaterialf(face, GL_SHININESS, 32);
-    }
-    
-    void set_matte_material(float r, float g, float b, GLenum face)
-    {
-        GLfloat ambient[4], diffuse[4], specular[4];
-        ambient[0]=0.1f*r+0.03f; ambient[1]=0.1f*g+0.03f; ambient[2]=0.1f*b+0.03f; ambient[3]=1.0f;
-        diffuse[0]=0.9f*r;      diffuse[1]=0.9f*g;      diffuse[2]=0.9f*b;      diffuse[3]=1.0f;
-        specular[0]=0;         specular[1]=0;         specular[2]=0;         specular[3]=1;
-        glMaterialfv(face, GL_AMBIENT, ambient);
-        glMaterialfv(face, GL_DIFFUSE, diffuse);
-        glMaterialfv(face, GL_SPECULAR, specular);
-    }
-    
-    /** 
-     * Draw a vector in 3D.  If arrow_head_length not specified, set it to 10% of vector length.
-     * Mar 29, 2006
-     */
-    void draw_3d_arrow(const float base[3], const float point[3], float arrow_head_length)
-    {
-        //glPushAttrib(GL_CURRENT_BIT|GL_ENABLE_BIT|GL_LINE_BIT);
-        //glDisable(GL_LIGHTING);
-        glLineWidth(1);
-        glColor3f(0.5f,0.5f,0.5f);
-        
-        Vec3f w(point[0]-base[0], point[1]-base[1], point[2]-base[2]);
-        float len = mag(w);
-        w = w / len;    // normalize to build coordinate system
-        
-        // create a coordinate system from the vector:
-        // get a vector perp to w and y-axis
-        Vec3f u = cross(w, Vec3f(0,1,0));
-        
-        // If vector is parallel to the y-axis, use the x-axis
-        if (mag(u) == 0)
-            u = cross(w, Vec3f(1,0,0));
-        
-        // get a vector perp to w and u
-        Vec3f v = cross(w, u/mag(u));
-        v = v/mag(v);
-        
-        if (!arrow_head_length)
-            arrow_head_length = 0.1f * len;
-        
-        // arrow head points
-        //@@@@@@@ POSSIBILITY: CREATE FOUR ARROW HEAD SEGMENTS INSTEAD OF TWO
-        Vec3f arrow1, arrow2;
-        arrow1[0] = point[0] + arrow_head_length * (v[0] - w[0]);
-        arrow1[1] = point[1] + arrow_head_length * (v[1] - w[1]);
-        arrow1[2] = point[2] + arrow_head_length * (v[2] - w[2]);
-        arrow2[0] = point[0] + arrow_head_length * (-v[0] - w[0]);
-        arrow2[1] = point[1] + arrow_head_length * (-v[1] - w[1]);
-        arrow2[2] = point[2] + arrow_head_length * (-v[2] - w[2]);
-        
-        glBegin(GL_LINES);
-        glVertex3f(base[0],   base[1],   base[2]);
-        glVertex3f(point[0],  point[1],  point[2]);
-        glVertex3f(point[0],  point[1],  point[2]);
-        glVertex3f(arrow1[0], arrow1[1], arrow1[2]);
-        glVertex3f(point[0],  point[1],  point[2]);
-        glVertex3f(arrow2[0], arrow2[1], arrow2[2]);
-        glEnd();
-        
-        //glPopAttrib();
-    }
-    
-    // draw_2d_arrow assumptions: 
-    // line width, point size, and color are set by the user prior to calling the routine
-    /*
-     void draw_2d_arrow(const Vec2f base, const Vec2f point, float arrow_head_length)
-     {
-     //glPushAttrib(GL_CURRENT_BIT|GL_ENABLE_BIT|GL_LINE_BIT);
-     //glDisable(GL_LIGHTING);
-     
-     Vec2f w = point-base;
-     float len = mag(w);
-     
-     if (len==0) {
-     glBegin(GL_POINTS);
-     glVertex2f(base[0], base[1]);
-     glEnd();
-     return;
-     }
-     
-     w = w / len;    // normalize to build coordinate system
-     
-     // u = w + 90 
-     // using rotation matrix  0  1
-     //	                     -1  0
-     Vec2f u = Vec2f(1*w[1], -1*w[0]);
-     u = u/mag(u);
-     
-     // v = w - 90 (in fact v=-u)
-     Vec2f v = Vec2f(-1*w[1], 1*w[0]);
-     v = v/mag(v);
-     
-     if (!arrow_head_length) {
-     arrow_head_length = 0.1f * len;
-     }
-     
-     // arrow head points
-     Vec2f arrow1, arrow2;
-     arrow1 = point + arrow_head_length * (v-w);
-     arrow2 = point + arrow_head_length * (u-w);
-     
-     glBegin(GL_LINES);
-     glVertex2f(base[0], base[1]);
-     glVertex2f(point[0], point[1]);
-     glVertex2f(point[0], point[1]);
-     glVertex2f(arrow1[0], arrow1[1]);
-     glVertex2f(point[0], point[1]);
-     glVertex2f(arrow2[0], arrow2[1]);
-     glEnd();
-     
-     //glPopAttrib();
-     }
-     */
-    
-    void draw_coordinate_grid(float size, int spacing)
-    {
-        glPushAttrib(GL_CURRENT_BIT|GL_ENABLE_BIT|GL_LINE_BIT);
-        glDisable(GL_LIGHTING);
-        glLineWidth(1);
-        
-        glBegin(GL_LINES);
-        glColor3f(0.5f,0.5f,0.5f);
-        for(int i=-spacing; i<=spacing; ++i){
-            glVertex3f(-size,0,i*size/spacing);
-            glVertex3f((i!=0)*size,0,i*size/spacing);
-            glVertex3f(i*size/spacing,0,-size);
-            glVertex3f(i*size/spacing,0,(i!=0)*size);
-        }
-        glColor3f(1,0,0);
-        glVertex3f(0,0,0);
-        glVertex3f(size,0,0);
-        glColor3f(0,1,0);
-        glVertex3f(0,0,0);
-        glVertex3f(0,size,0);
-        glColor3f(0,0,1);
-        glVertex3f(0,0,0);
-        glVertex3f(0,0,size);
-        glEnd();
-        
-        glPopAttrib();
-    }
-    
-    void draw_text( const float* /*point[3]*/, const char* /*text*/, int /*fontsize*/ )
-    {
-        // please implement me!
-    }
-    
-    int windowID = 0;
-    
-    //=================================================================================
-    
-    void init(const char *windowtitle, int *argc, char **argv)
-    {
-        glutInit(argc, argv);
-        glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_ALPHA|GLUT_DEPTH|GLUT_STENCIL);
-        glutInitWindowSize(winwidth, winheight);
-        windowID = glutCreateWindow(windowtitle);
-        glutReshapeFunc(gluviReshape);
-        glutDisplayFunc(gluviDisplay);
-        glutMouseFunc(gluviMouse);
-        glutMotionFunc(gluviDrag);
-        glEnable(GL_DEPTH_TEST);
-        glClearDepth(1);
-        glPixelStorei(GL_PACK_ALIGNMENT, 1);
-        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-        
-        glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
-        glClearColor (1.0f, 1.0f, 1.0f, 1.0f);
-    }
-    
-    //=================================================================================
-    
-    void (*userDisplayFunc)(void)=0; 
-    void (*userMouseFunc)(int button, int state, int x, int y)=0;
-    void (*userDragFunc)(int x, int y)=0;
-    Camera *camera=0;
-    WidgetList root(0);
-    int winwidth=720, winheight=480;
-    
-    //=================================================================================
-    
-    void run(void)
-    {
-        glutMainLoop();
-    }
-    
-}     // namespace Gluvi
-
diff --git a/extern/eltopo/common/gluvi.h b/extern/eltopo/common/gluvi.h
deleted file mode 100644
index e2de945..0000000
--- a/extern/eltopo/common/gluvi.h
+++ /dev/null
@@ -1,234 +0,0 @@
-#ifndef GLUVI_H
-#define GLUVI_H
-
-#include <iostream>
-#include <vector>
-
-#ifdef __APPLE__
-#include <GLUT/glut.h> // why does Apple have to put glut.h here...
-#else
-#include <GL/glut.h> // ...when everyone else puts it here?
-#endif
-
-namespace Gluvi{
-    
-    // the camera capability for Gluvi
-    struct Camera
-    {
-        virtual ~Camera(void) {}
-        virtual void click(int button, int state, int x, int y) = 0;
-        virtual void drag(int x, int y) = 0;
-        virtual void return_to_default(void) = 0;
-        //@@@ add these to be called by a user glutKeyboardFunc() thing so that
-        //@@@ cameras can easily add keyboard shortcuts for e.g. return_to_default, transformation, etc.
-        //virtual void navigation_keyboard_handler(unsigned char key, int x, int y) = 0;
-        //virtual void navigation_special_key_handler(int key, int x, int y) = 0;
-        virtual void gl_transform(void) = 0;
-        virtual void export_rib(std::ostream &output) = 0;
-        virtual void display_screen(void) {} // in case the camera needs to show anything on screen
-    };
-    
-    struct Target3D : public Camera
-    {
-        float target[3], dist;
-        float heading, pitch;
-        float default_target[3], default_dist;
-        float default_heading, default_pitch;
-        float fovy;
-        float near_clip_factor, far_clip_factor;
-        enum {INACTIVE, ROTATE, TRUCK, DOLLY} action_mode;
-        int oldmousex, oldmousey;
-        
-        Target3D(float target_[3]=0, float dist_=1.f, float heading_=0.f, float pitch_=0.f, float fovy_=45.f,
-                 float near_clip_factor_=0.01f, float far_clip_factor_=100.f);
-        void click(int button, int state, int x, int y);
-        void drag(int x, int y);
-        void return_to_default(void);
-        void transform_mouse(int x, int y, float ray_origin[3], float ray_direction[3]);
-        void get_viewing_direction(float direction[3]);
-        
-        void get_up_vector(float up[3]);
-        
-        void gl_transform(void);
-        void export_rib(std::ostream &output);
-    };
-    
-    // same as above, but with orthographic projection
-    struct TargetOrtho3D : public Camera
-    {
-        float target[3], dist;
-        float heading, pitch;
-        float default_target[3], default_dist;
-        float default_heading, default_pitch;
-        float height_factor;
-        float near_clip_factor, far_clip_factor;
-        enum {INACTIVE, ROTATE, TRUCK, DOLLY} action_mode;   // @@@@ WHAT ABOUT ZOOMING??? IS WIDTH ALWAYS A FUNCTION OF DIST?
-        int oldmousex, oldmousey;
-        
-        TargetOrtho3D(float target_[3]=0, float dist_=1.0f, float heading_=0.0f, float pitch_=0.0f, float height_factor_=1.0f,
-                      float near_clip_factor_=0.01f, float far_clip_factor_=100.0f);
-        void click(int button, int state, int x, int y);
-        void drag(int x, int y);
-        void return_to_default(void);
-        void transform_mouse(int x, int y, float ray_origin[3], float ray_direction[3]);
-        void get_viewing_direction(float direction[3]);
-        void gl_transform(void);
-        void export_rib(std::ostream &output);
-    };
-    
-    struct PanZoom2D : public Camera
-    {
-        float bottom, left, height;
-        float default_bottom, default_left, default_height;
-        enum {INACTIVE, PAN, ZOOM_IN, ZOOM_OUT} action_mode;
-        int oldmousex, oldmousey;
-        bool moved_since_mouse_down; // to distinuish simple clicks from drags
-        int clickx, clicky;
-        
-        PanZoom2D(float bottom_=0, float left_=0, float height_=1);
-        void click(int button, int state, int x, int y);
-        void drag(int x, int y);
-        void return_to_default(void);
-        void transform_mouse(int x, int y, float coords[2]);
-        void gl_transform(void);
-        void export_rib(std::ostream &output);
-        void display_screen(void);
-    };
-    
-    // overlaid user-interface widgets
-    struct Widget
-    {
-        Widget() : dispx(~0), dispy(~0), width(~0), height(~0) {}
-        
-        int dispx, dispy, width, height; // set in display()
-        
-        virtual ~Widget() {}
-        virtual void display(int x, int y) = 0;
-        // virtual bool click( int state, int x, int y );
-        virtual bool click(int, int, int ) { return false; } // returns true if click handled by widget
-        // virtual void drag(int x, int y) {}
-        virtual void drag(int, int ) {}
-    };
-    
-    struct StaticText : public Widget
-    {
-        const char *text;
-        
-        StaticText(const char *text_);
-        void display(int x, int y);
-        
-    private:
-        StaticText( const StaticText& );
-        StaticText operator=( const StaticText& );
-        
-    };
-    
-    struct DynamicText : public Widget
-    {
-        std::string text;
-        float color[3];
-        
-        DynamicText( const std::string& text_ );
-        
-        void set_color( float r, float g, float b );
-        
-        void display(int x, int y);
-        
-    private:
-        DynamicText( const DynamicText& );
-        DynamicText operator=( const DynamicText& );
-        
-    };
-    
-    
-    struct Button : public Widget
-    {
-        enum {UNINVOLVED, SELECTED, HIGHLIGHTED} status;
-        const char *text;
-        int minwidth;
-        
-        Button(const char *text_, int minwidth_=0);
-        void display(int x, int y);
-        bool click(int state, int x, int y);
-        void drag(int x, int y);
-        virtual void action() {}
-        
-    private:
-        Button( const Button& );
-        Button operator=( const Button& );
-        
-    };
-    
-    struct Slider : public Widget
-    {
-        enum {UNINVOLVED, SELECTED} status;
-        const char *text;
-        int length, justify;
-        int position;
-        int scrollxmin, scrollxmax, scrollymin, scrollymax;
-        int clickx;
-        
-        Slider(const char *text_, int length_=100, int position_=0, int justify_=0);
-        void display(int x, int y);
-        bool click(int state, int x, int y);
-        void drag(int x, int y);
-        virtual void action() {}
-        
-    private:
-        Slider( const Slider& );
-        Slider operator=( const Slider& );
-        
-    };
-    
-    struct WidgetList : public Widget
-    {
-        int indent;
-        bool hidden;
-        std::vector<Widget*> list;
-        int downclicked_member;
-        
-        WidgetList(int listindent_=12, bool hidden_=false);
-        void display(int x, int y);
-        bool click(int state, int x, int y);
-        void drag(int x, int y);
-    };
-    
-    // display callback
-    extern void (*userDisplayFunc)(void); 
-    
-    // mouse callbacks for events that Gluvi ignores (control not pressed, or mouse not on an active widget)
-    extern void (*userMouseFunc)(int button, int state, int x, int y);
-    extern void (*userDragFunc)(int x, int y);
-    
-    // user is free to do their own callbacks for everything else except glutReshape()
-    
-    // additional helpful functions
-    void ppm_screenshot(const char *filename_format, ...);
-    void sgi_screenshot(const char *filename_format, ...);
-    void set_generic_lights(void);
-    void set_generic_material(float r, float g, float b, GLenum face=GL_FRONT_AND_BACK);
-    void set_matte_material(float r, float g, float b, GLenum face=GL_FRONT_AND_BACK);
-    //@@@@@@@ USEFUL FUNCTIONALITY:
-    void draw_3d_arrow(const float base[3], const float point[3], float arrow_head_length=0);
-    //void draw_2d_arrow(const Vec2f base, const Vec2f point, float arrow_head_length);
-    void draw_coordinate_grid(float size=1, int spacing=10);
-    void draw_text(const float point[3], const char *text, int fontsize=12);
-    
-    // call init first thing
-    void init(const char *windowtitle, int *argc, char **argv);
-    
-    // the Gluvi state
-    extern Camera *camera;
-    extern WidgetList root;
-    extern int winwidth, winheight;
-    extern int windowID;
-    
-    extern bool taking_screenshot;
-    extern GLuint screenshot_fbo;
-    
-    // then after setting the Gluvi state and doing any of your own set-up, call run()
-    void run(void);
-    
-} // end of namespace
-
-#endif
diff --git a/extern/eltopo/common/grid3.h b/extern/eltopo/common/grid3.h
deleted file mode 100644
index 37b16b0..0000000
--- a/extern/eltopo/common/grid3.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef GRID3_H
-#define GRID3_H
-
-#include <vec.h>
-
-template<class T>
-struct Grid3
-{
-    Vec<3,T> origin;
-    T dx, over_dx;
-};
-
-typedef Grid3<float> Grid3f;
-typedef Grid3<double> Grid3d;
-
-
-#endif
diff --git a/extern/eltopo/common/hashtable.h b/extern/eltopo/common/hashtable.h
deleted file mode 100644
index bbb0ae9..0000000
--- a/extern/eltopo/common/hashtable.h
+++ /dev/null
@@ -1,251 +0,0 @@
-#ifndef HASHTABLE_H
-#define HASHTABLE_H
-
-#include <functional>
-#include <iostream>
-#include <vector>
-
-template<class Key, class Data>
-struct HashEntry
-{
-    HashEntry() : key(), data(), next(~0) {}
-    
-    Key key;
-    Data data;
-    int next;
-};
-
-// a useful core hash function
-inline unsigned int hash(unsigned int k)
-{ return k*2654435769u; }
-
-// default hash function object
-struct DefaultHashFunction
-{
-    template<typename Key>
-    unsigned int operator() (const Key &k) const { return hash(k); }
-};
-
-struct equal
-{
-    template<typename T>
-    bool operator() (const T &a, const T &b) const { return a==b; }
-};
-
-template<typename Key, typename Data, class HashFunction=DefaultHashFunction, class KeyEqual=equal>
-struct HashTable
-{
-    unsigned int table_rank;
-    unsigned int table_bits;
-    std::vector<int> table;
-    unsigned int num_entries;
-    std::vector<HashEntry<Key, Data> > pool;
-    int free_list;
-    const HashFunction hash_function;
-    const KeyEqual key_equal;
-    
-    explicit HashTable(unsigned int expected_size=64)
-    :  table_rank(static_cast<unsigned int>(~0)), table_bits(static_cast<unsigned int>(~0)), table(0), num_entries(static_cast<unsigned int>(~0)), pool(), free_list(static_cast<unsigned int>(~0)),
-    hash_function(HashFunction()), key_equal(KeyEqual())
-    { init(expected_size); }
-    
-    explicit HashTable(const HashFunction &hf, unsigned int expected_size=64)
-    : hash_function(hf), key_equal(KeyEqual())
-    { init(expected_size); }
-    
-    void init(unsigned int expected_size)
-    {
-        unsigned int i;
-        num_entries=0;
-        table_rank=4;
-        while(1u<<table_rank < expected_size)
-            ++table_rank;
-        ++table_rank; // give us some extra room
-        table_bits=(1u<<table_rank)-1;
-        table.resize(1u<<table_rank);
-        for(i=0; i<table.size(); ++i)
-            table[i]=-1; // empty list
-        pool.resize(1u<<table_rank);
-        free_list=0;
-        for(unsigned int j=0; j<pool.size()-1; ++j)
-            pool[j].next=j+1;
-        pool[pool.size()-1].next=-1; // end of free list
-    }
-    
-    void add(const Key &k, const Data &d)
-    {
-        if(free_list==-1)
-            reserve(1u<<(table_rank+1));
-        int i=free_list; // where we're going to put the new entry
-        free_list=pool[i].next;
-        unsigned int t=hash_function(k)&table_bits; // index into table
-        pool[i].key=k;
-        pool[i].data=d;
-        pool[i].next=table[t]; // put the new entry at the start of table[t]'s list
-        table[t]=i;
-        ++num_entries;
-    }
-    
-    void delete_entry(const Key &k, const Data &d) // delete first entry that matches both key and data
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t], *p_i=&table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key) && d==pool[i].data){
-                *p_i=pool[i].next; // make list skip over this entry
-                pool[i].next=free_list; // and put it on the front of the free list
-                free_list=i;
-                return; // and we're done
-            }
-            p_i=&pool[i].next;
-            i=*p_i;
-        }
-    }
-    
-    unsigned int size() const
-    { return num_entries; }
-    
-    void clear()
-    {
-        unsigned int i=0;
-        num_entries=0;
-        for(i=0; i<table.size(); ++i)
-            table[i]=-1; // empty list
-        free_list=0;
-        for(i=0; i<pool.size()-1; ++i)
-            pool[i].next=i+1;
-        pool[pool.size()-1].next=-1;
-    }
-    
-    void reserve(unsigned int expected_size)
-    {
-        if(expected_size<=pool.size())
-            return;
-        while(1u<<table_rank < expected_size)
-            ++table_rank;
-        table_bits=(1u<<table_rank)-1;
-        // increase room for new entries
-        unsigned int old_size=(unsigned int)pool.size(), i;
-        pool.resize(1u<<table_rank);
-        for(i=old_size; i<pool.size()-1; ++i)
-            pool[i].next=i+1;
-        pool[i].next=free_list;
-        free_list=old_size;
-        // And finally need to redo table (rehash entries)
-        old_size=(unsigned int)table.size();
-        table.resize(1u<<table_rank);
-        unsigned int t;
-        for(t=old_size; t<table.size(); ++t)
-            table[t]=-1; // initially make new lists empty
-        int j, *p_j;
-        for(t=0; t<old_size; ++t){
-            j=table[t]; 
-            p_j=&table[t];
-            while(j!=-1){
-                unsigned int new_t=hash_function(pool[j].key)&table_bits;
-                if(new_t!=t){ // j doesn't belong in this list anymore?
-                    // delete from this list
-                    *p_j=pool[j].next;
-                    // add to correct list
-                    pool[j].next=table[new_t];
-                    table[new_t]=j;
-                }else
-                    p_j=&(pool[j].next);
-                j=*p_j;
-            }
-        }
-    }
-    
-    bool has_entry(const Key &k) const
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key))
-                return true;
-            i=pool[i].next;
-        }
-        return false;
-    }
-    
-    bool get_entry(const Key &k, Data &data_return) const
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key)){
-                data_return=pool[i].data;
-                return true;
-            }
-            i=pool[i].next;
-        }
-        return false;
-    }
-    
-    void append_all_entries(const Key& k, std::vector<Data>& data_return) const
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key)) data_return.push_back(pool[i].data);
-            i=pool[i].next;
-        }
-    }
-    
-    Data &operator() (const Key &k, const Data &missing_data)
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key))
-                return pool[i].data;
-            i=pool[i].next;
-        }
-        add(k, missing_data); // note - this could cause the table to be resized, and t made out-of-date
-        return pool[table[hash_function(k)&table_bits]].data; // we know that add() puts it here!
-    }
-    
-    const Data &operator() (const Key &k, const Data &missing_data) const
-    {
-        unsigned int t=hash_function(k)&table_bits;
-        int i=table[t];
-        while(i!=-1){
-            if(key_equal(k, pool[i].key))
-                return pool[i].data;
-            i=pool[i].next;
-        }
-        return missing_data;
-    }
-    
-    void output_statistics() const
-    {
-        std::vector<int> lengthcount(table.size());
-        unsigned int t;
-        int total=0;
-        for(t=0; t<table.size(); ++t){
-            int i=table[t], length=0;
-            while(i!=-1){
-                ++length;
-                i=pool[i].next;
-            }
-            ++lengthcount[length];
-            ++total;
-        }
-        int subtotal=0;
-        int maxlength=0;
-        for(t=0; t<lengthcount.size() && t<10; ++t){
-            subtotal+=lengthcount[t];
-            if(lengthcount[t]>0){
-                std::cout<<"length "<<t<<": "<<lengthcount[t]<<"   ("<<lengthcount[t]/(float)total*100.0<<"%)"<<std::endl;
-                maxlength=t;
-            }
-        }
-        std::cout<<"rest: "<<total-subtotal<<"   ("<<100.0*(1.0-subtotal/(float)total)<<"%)"<<std::endl;
-        for(; t<lengthcount.size(); ++t)
-            if(lengthcount[t]>0)
-                maxlength=t;
-        std::cout<<"longest list: "<<maxlength<<std::endl;
-    }
-};
-
-#endif
diff --git a/extern/eltopo/common/lapack_wrapper.h b/extern/eltopo/common/lapack_wrapper.h
deleted file mode 100644
index 9d4dab0..0000000
--- a/extern/eltopo/common/lapack_wrapper.h
+++ /dev/null
@@ -1,242 +0,0 @@
-#ifndef LAPACK_WRAPPER_H
-#define LAPACK_WRAPPER_H
-
-// Simplified LAPACK wrapper (overloaded readable names, standard across platforms)
-// as well as versions with stride==1 assumed.
-// For the moment, no complex number support, and most routines have been dropped.
-
-#include <cmath>
-#include <iostream>
-
-using std::max;
-using std::min;
-
-namespace LAPACK{
-    
-    // ---------------------------------------------------------
-    //  Function declarations
-    // ---------------------------------------------------------
-    
-    int solve_general_system(int &n, int &nrhs, float *a, int lda, int *ipiv, float *b, int ldb, int &info);
-    int solve_general_system(int n, int nrhs, double *a, int lda, int *ipiv, double *b, int ldb, int &info);
-    int factor_general_matrix(int m, int n, double *a, int lda, int *ipiv, int &info);
-    void invert_general_matrix(int n, double *a, int lda, int *ipiv, double *work, int lwork, int &info);
-    void get_eigen_decomposition( int *n, double *a, int* /*lda*/, double *eigenvalues, double *work, int *lwork, int *info );
-    int svd( int* m, int* n, double* a, int* lda, double *s, double *u, int* ldu, double* vt, int *ldvt, double *work, int* lwork, int* iwork, int* info );
-    int least_squares_svd( int* m, int* n, int* nrhs,  double* a, int* lda,  double* rhs_sol, int* ldb,  double* s, double* rcond, int* rank, double* work, int* lwork, int* iwork, int *info );
-    void simple_least_squares_svd( int m, int n, int nrhs, double* a, int lda, double* rhs_sol, int& info );
-    void solve_least_squares(char trans, int m, int n, int nrhs, double*a, int lda, double*b, int ldb, int& info );
-    
-    // ---------------------------------------------------------
-    //  Inline function definitions --- common for all platforms
-    // ---------------------------------------------------------
-    
-    inline void simple_least_squares_svd( int m, int n, int nrhs, double* a, int lda, double* rhs_sol, int& info )
-    {
-        int lapack_m = m;
-        int lapack_n = n;
-        int lapack_nrhs = nrhs;
-        int lapack_lda = lda;   
-        int lapack_ldb = max( lapack_m, lapack_n );
-        double* s = new double[ min(lapack_m, lapack_n) ];
-        double rcond = -1.0;
-        int rank;   
-        double optimal_work_size;
-        int lwork = -1;
-        int nlvl = 26;
-        int liwork = 2*min(lapack_m,lapack_n)*nlvl + 11*min(lapack_m,lapack_n);
-        int *iwork = new int[liwork];
-        
-        // query for optimal work size
-        unsigned int lapack_status = LAPACK::least_squares_svd( &lapack_m, 
-                                                               &lapack_n, 
-                                                               &lapack_nrhs, 
-                                                               a, 
-                                                               &lapack_lda, 
-                                                               rhs_sol, 
-                                                               &lapack_ldb, 
-                                                               s, 
-                                                               &rcond, 
-                                                               &rank, 
-                                                               &optimal_work_size, 
-                                                               &lwork, 
-                                                               iwork, 
-                                                               &info );
-        
-        
-        if ( info != 0 ) 
-        {
-            std::cout << "lapack info: " << info << "; lapack_status: " << lapack_status << std::endl;
-        }
-        
-        assert( info == 0 );
-        
-        lwork = (int)ceil(optimal_work_size);
-        
-        double *work = new double[lwork];
-        
-        lapack_status = LAPACK::least_squares_svd( &lapack_m, 
-                                                  &lapack_n, 
-                                                  &lapack_nrhs, 
-                                                  a, 
-                                                  &lapack_lda, 
-                                                  rhs_sol, 
-                                                  &lapack_ldb, 
-                                                  s, 
-                                                  &rcond, 
-                                                  &rank, 
-                                                  work, 
-                                                  &lwork, 
-                                                  iwork, 
-                                                  &info );
-        
-        assert( info == 0 );
-        
-        delete[] s;
-        delete[] iwork;
-        delete[] work;
-        
-    }
-    
-    inline void solve_least_squares(char, int m, int n, int nrhs, double*a, int lda, double*b, int, int& info ) 
-    {
-        simple_least_squares_svd( m, n, nrhs, a, lda, b, info );
-    }
-    
-    // end of platform-independent code
-    
-    // ---------------------------------------------------------
-    //  Inline function definitions --- Apple
-    // ---------------------------------------------------------
-    
-#ifdef __APPLE__
-#include <vecLib/clapack.h>
-    
-    inline int solve_general_system(int &n, int &nrhs, float *a, int lda, int *ipiv, float *b, int ldb, int &info)
-    { return sgesv_( (__CLPK_integer*) &n, 
-                    (__CLPK_integer*) &nrhs, 
-                    a, 
-                    (__CLPK_integer*) &lda, 
-                    (__CLPK_integer*) ipiv, 
-                    b, 
-                    (__CLPK_integer*) &ldb, 
-                    (__CLPK_integer*) &info); }
-    
-    inline int solve_general_system(int n, int nrhs, double *a, int lda, int *ipiv, double *b, int ldb, int &info)
-    { return dgesv_( (__CLPK_integer*) &n, 
-                    (__CLPK_integer*) &nrhs, 
-                    a, 
-                    (__CLPK_integer*) &lda, 
-                    (__CLPK_integer*) ipiv, 
-                    b, 
-                    (__CLPK_integer*) &ldb, 
-                    (__CLPK_integer*) &info); }
-    
-    
-    inline int factor_general_matrix(int m, int n, double *a, int lda, int *ipiv, int &info)
-    { return dgetrf_( (__CLPK_integer*)&m, (__CLPK_integer*)&n, a, (__CLPK_integer*)&lda, (__CLPK_integer*)ipiv, (__CLPK_integer*)&info); }
-    
-    
-    inline void invert_general_matrix(int n, double *a, int lda, int *ipiv, double *work, int lwork, int &info)
-    {
-        factor_general_matrix( n, n, a, lda, ipiv, info);
-        assert( info == 0 );
-        dgetri_( (__CLPK_integer*)&n, a, (__CLPK_integer*)&lda, (__CLPK_integer*)ipiv, work, (__CLPK_integer*)&lwork, (__CLPK_integer*)&info);  
-    }
-    
-    inline void get_eigen_decomposition( int *n, double *a, int* /*lda*/, double *eigenvalues, double *work, int *lwork, int *info )
-    {
-        static char char_v = 'V';
-        static char char_l = 'L';
-        dsyev_( &char_v, &char_l, (__CLPK_integer*)n, a, (__CLPK_integer*)n, eigenvalues, work, (__CLPK_integer*)lwork, (__CLPK_integer*)info );      
-    }
-    
-    
-    inline int svd( int* m, int* n, double* a, int* lda, double *s, double *u, int* ldu, double* vt, int *ldvt, double *work, int* lwork, int* iwork, int* info )
-    {
-        char char_a = 'A';
-        return dgesdd_( &char_a, (__CLPK_integer*)m, (__CLPK_integer*)n, a, (__CLPK_integer*)lda, s, u, (__CLPK_integer*)ldu, vt, (__CLPK_integer*)ldvt, work, (__CLPK_integer*)lwork, (__CLPK_integer*)iwork, (__CLPK_integer*)info ); 
-    }
-    
-    inline int least_squares_svd( int* m, int* n, int* nrhs,  double* a, int* lda,  double* rhs_sol, int* ldb,  double* s, double* rcond, int* rank, double* work, int* lwork, int* iwork, int *info )
-    {
-        return dgelsd_(  (__CLPK_integer*)m,  (__CLPK_integer*)n, (__CLPK_integer*)nrhs, a, (__CLPK_integer*)lda, rhs_sol, (__CLPK_integer*)ldb, s, rcond, (__CLPK_integer*) rank, work, (__CLPK_integer*) lwork, (__CLPK_integer*) iwork , (__CLPK_integer*) info );
-    }
-    
-#endif // end of __APPLE__ version of this file
-    
-    
-    // ---------------------------------------------------------
-    //  Inline function definitions --- Linux and Windows
-    // ---------------------------------------------------------
-    
-#ifndef __APPLE__ 
-    
-}     // namespace LAPACK
-
-extern "C" {
-    int   sgesv_(const int *N, const int *nrhs, float *A, const int *lda, int *ipiv, float *b, const int *ldb, int *info);   
-    int 	dgesv_ (int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info);
-    int 	dgeev_ (char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info);
-    int 	dsygv_ (int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork, int *info);
-    int 	dgelss_ (int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *s, double *rcond, int *rank, double *work, int *lwork, int *info);
-    int 	dgelsd_ (int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *s, double *rcond, int *rank, double *work, int *lwork, int *iwork, int *info);
-    int 	dsyev_ (char *jobz, char *uplo, int *n, double *fa, int *lda, double *w, double *work, int *lwork, int *info);
-    int 	dsysv_ (char *uplo, int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, double *work, int *lwork, int *info);
-    int 	dgetrf_ (int *m, int *n, double *a, int *lda, int *ipiv, int *info);
-    int 	dgetri_ (int *n, double *a, int *lda, int *ipiv, int *info);
-    void 	dgebrd_ (int *m, int *n, double *a, int *lda, double *d, double *e, double *tauq, double *taup, double *work, int *lwork, int *info);
-    void 	dorgbr_ (char *vect, int *m, int *n, int *k, double *a, int *lda, double *tau, double *work, int *lwork, int *info);
-    void 	dbdsqr_ (char *uplo, int *n, int *ncvt, int *nru, int *ncc, double *d, double *e, double *vt, int *ldvt, double *u, int *ldu, double *c, int *ldc, double *work, int *info);
-    void 	dgetrs_ (char *trans, int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info);
-    void 	dpotrf_ (char *uplo, int *n, double *a, int *lda, int *info);
-    void 	dgeqpf_ (int *m, int *n, double *a, int *lda, int *jpvt, double *tau, double *work, int *info);   
-    int dgesdd_( char* jobz, int* m, int* n, double* a, int* lda, double *s, double *u, int* ldu, double* vt, int *ldvt, double *work, int* lwork, int* iwork, int* info );
-}
-
-namespace LAPACK
-{
-    
-    inline void solve_general_system(int n, int nrhs, float *a, int lda, int *ipiv, float *b, int ldb, int &info)
-    { 
-        sgesv_(&n, &nrhs, a, &lda, ipiv, b, &ldb, &info); 
-    }
-    
-    inline int solve_general_system(int n, int nrhs, double *a, int lda, int *ipiv, double *b, int ldb, int &info)
-    { 
-        return dgesv_(&n, &nrhs, a, &lda, ipiv, b, &ldb, &info); 
-    }
-    
-    inline int factor_general_matrix(int m, int n, double *a, int lda, int *ipiv, int &info)
-    { return dgetrf_(&m, &n, a, &lda, ipiv, &info); }
-    
-    inline void invert_general_matrix(int n, double *a, int lda, int *ipiv, double* /*work*/, int /*lwork*/, int &info)
-    {
-        factor_general_matrix(n, n, a, lda, ipiv, info);
-        dgetri_(&n, a, &lda, ipiv, &info);  
-    }
-    
-    inline void get_eigen_decomposition( int *n, double *a, int* /*lda*/, double *eigenvalues, double *work, int *lwork, int *info )
-    {
-        static char char_v = 'V';
-        static char char_l = 'L';
-        dsyev_( &char_v, &char_l, n, a, n, eigenvalues, work, lwork, info );      
-    }
-    
-    inline int svd( int* m, int* n, double* a, int* lda, double *s, double *u, int* ldu, double* vt, int *ldvt, double *work, int* lwork, int* iwork, int* info )
-    {
-        char char_a = 'A';
-        return dgesdd_( &char_a, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, iwork, info ); 
-    }
-    
-    inline int least_squares_svd( int* m, int* n, int* nrhs,  double* a, int* lda,  double* rhs_sol, int* ldb,  double* s, double* rcond, int* rank, double* work, int* lwork, int* iwork, int *info )
-    {
-        return dgelsd_( m,  n, nrhs, a, lda, rhs_sol, ldb, s, rcond, rank, work, lwork, iwork, info );
-    }   
-    
-    
-#endif //End of Windows and Linux version of this file
-    
-} // end of namespace LAPACK
-
-#endif
diff --git a/extern/eltopo/common/levelset.cpp b/extern/eltopo/common/levelset.cpp
deleted file mode 100644
index 2779a17..0000000
--- a/extern/eltopo/common/levelset.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-#if 0
-#include "levelset.h"
-#include "util.h"
-#include "array2_utils.h"
-#include "array3_utils.h"
-
-float interpolate_phi(const Vec2f& point, const Array2f& grid, const Vec2f& origin, const float dx) {
-   float inv_dx = 1/dx;
-   Vec2f temp = (point-origin)*inv_dx;
-   return interpolate_value(temp, grid);
-}
-
-float interpolate_phi(const Vec3f& point, const Array3f& grid, const Vec3f& origin, const float dx) {
-   float inv_dx = 1/dx;
-   Vec3f temp = (point-origin)*inv_dx;
-   return interpolate_value(temp, grid);
-}
-
-float interpolate_normal(Vec2f& normal, const Vec2f& point, const Array2f& grid, const Vec2f& origin, const float dx) {
-   float inv_dx = 1/dx;
-   Vec2f temp = (point-origin)*inv_dx;
-   float value = interpolate_gradient(normal, temp, grid);
-   if(mag(normal) != 0)
-      normalize(normal);
-   return value;
-}
-
-float interpolate_normal(Vec3f& normal, const Vec3f& point, const Array3f& grid, const Vec3f& origin, const float dx) {
-   float inv_dx = 1/dx;
-   Vec3f temp = (point-origin)*inv_dx;
-   float value = interpolate_gradient(normal, temp, grid);
-   if(mag(normal) != 0)
-      normalize(normal);
-   return value;
-}
-
-void project_to_isosurface(Vec2f& point, const float target_value, const Array2f& grid, const Vec2f& origin, const float dx) {
-   float tol = 0.01f*dx; //some fraction of a grid cell;
-   int max_iter = 5;
-   
-   int iter = 0;
-   Vec2f normal;
-   float phi = interpolate_normal(normal, point, grid, origin, dx);
-   while(fabs(phi - target_value) > tol && iter++ < max_iter) {
-      point -= (phi - target_value) * normal;
-      phi = interpolate_normal(normal, point, grid, origin, dx);
-   }
-}
-
-void project_to_isosurface(Vec3f& point, const float target_value, const Array3f& grid, const Vec3f& origin, const float dx) {
-   float tol = 0.01f*dx; //some fraction of a grid cell;
-   int max_iter = 5;
-   
-   int iter = 0;
-   Vec3f normal;
-   float phi = interpolate_normal(normal, point, grid, origin, dx);
-   while(fabs(phi - target_value) > tol && iter++ < max_iter) {
-      point -= (phi - target_value) * normal;
-      phi = interpolate_normal(normal, point, grid, origin, dx);
-   }
-}
-
-
-//On a signed distance field, compute the fraction inside the (negative) isosurface
-//along the 1D line segment joining phi_left and phi_right sample points.
-float fraction_inside(float phi_left, float phi_right)
-{
-   //Note: should not generate divide by zero, because if
-   //signs are different, and both values are != 0,
-   //abs(left - right) is necessarily >= left, or right, alone, ie. not 0
-   
-   return 
-      (phi_left >= 0 && phi_right >= 0)? //all empty
-         0.0f : 
-         (  (phi_left < 0 && phi_right < 0)? //all full
-            1.0f:
-            (
-               (phi_left >= 0)?
-               (1 - phi_left / (phi_left - phi_right)): //right inside 
-               (phi_left / (phi_left - phi_right)) //left inside
-            )
-         );
-}
-
-//On a signed distance field, compute the fraction inside the (negative) isosurface
-//along the 1D line segment joining phi_left and phi_right sample points.
-//Except now there are two level sets, and we want the fraction that is the union
-//of their interiors
-float fraction_inside_either(float phi_left0, float phi_right0, float phi_left1, float phi_right1)
-{
-   if(phi_left0 <= 0) {
-      if(phi_right0 <= 0) {
-         //entirely inside solid0 [-/-][?]
-         return 1;
-      }
-      else { //phi_right0 > 0
-         if(phi_left1 <= 0) {
-            if(phi_right1 <= 0) {
-               //entirely inside solid1 -> [-/+][-/-]
-               return 1;
-            }
-            else {//both left sides are inside, neither right side [-/+][-/+]
-               return max( fraction_inside(phi_left0, phi_right0), 
-                           fraction_inside(phi_left1, phi_right1) );
-            }
-         }
-         else { //phi_left1 > 0 
-            if(phi_right1 <= 0) { //opposite sides are interior [-/+][+/-]
-               float frac0 = fraction_inside(phi_left0, phi_right0);
-               float frac1 = fraction_inside(phi_left1, phi_right1);
-               float total =  frac0+frac1;
-               if(total <= 1)
-                  return total;
-               else
-                  return 1;
-
-            }
-            else {//phi_right1 > 0
-               //phi1 plays no role, both outside [-/+][+/+]
-               return fraction_inside(phi_left0, phi_right0);
-            }
-         }
-      }
-   }
-   else {
-      if(phi_right0 <= 0) {
-         if(phi_left1 <= 0) {
-            if(phi_right1 <= 0) {
-               //entirely inside solid1[+/-][-/-]
-               return 1;
-            }
-            else {
-               //coming in from opposing sides [+/-][-/+]
-               float frac0 = fraction_inside(phi_left0, phi_right0);
-               float frac1 = fraction_inside(phi_left1, phi_right1);
-               float total =  frac0+frac1;
-               if(total <= 1)
-                  return total;
-               else
-                  return 1;
-            }
-         }
-         else { //phi_left1 > 0 
-            if(phi_right1 <= 0) {
-               //coming from the same side, take the larger one [+/-][+/-]
-               return max( fraction_inside(phi_left0, phi_right0), 
-                           fraction_inside(phi_left1, phi_right1) );
-            }
-            else { //phi_right > 0
-               //Only have to worry about phi_0 [+/-][+/+]
-               return fraction_inside(phi_left0, phi_right0);
-            }
-             
-         }
-      }
-      else {
-         //Only have to worry about phi_1 [+/+][?]
-         return fraction_inside(phi_left1, phi_right1);
-      }
-   }
-}
-
-void compute_volume_fractions(const Array2f& levelset, const Vec2f& ls_origin, float ls_dx, Array2f& volumes, const Vec2f& v_origin, float v_dx, int subdivisions) {
-   
-   float sub_dx = v_dx / (float)(subdivisions+1);
-   
-   for(int j = 0; j < volumes.nj; ++j) for(int i = 0; i < volumes.ni; ++i) {
-      //centre of the volume cells
-      Vec2f bottom_left = v_origin + Vec2f(i*v_dx, j*v_dx);
-      int inside_samples = 0;
-      for(int subj = 0; subj < subdivisions+1; ++subj) for(int subi = 0; subi < subdivisions+1; ++subi) {
-         Vec2f point = bottom_left + Vec2f( (subi+0.5f)*sub_dx, (subj+0.5f)*sub_dx);
-         float data = interpolate_phi(point, levelset, ls_origin, ls_dx);
-         inside_samples += (data < 0)?1:0;
-      }
-      volumes(i,j) = (float)inside_samples / (float)sqr(subdivisions+1);
-   }
-}
-
-void compute_volume_fractions(const Array3f& levelset, const Vec3f& ls_origin, float ls_dx, Array3f& volumes, const Vec3f& v_origin, float v_dx, int subdivisions) {
-   
-   float sub_dx = v_dx / (float)(subdivisions+1);
-   
-   for(int k = 0; k < volumes.nk; ++k) for(int j = 0; j < volumes.nj; ++j) for(int i = 0; i < volumes.ni; ++i) {
-      //centre of the volume cells
-      Vec3f bottom_left = v_origin + Vec3f((i-0.5f)*v_dx, (j-0.5f)*v_dx, (k-0.5f)*v_dx);
-      int inside_samples = 0;
-      
-      //Speedup! Test the centre point, and if it's more than a grid cell away from the interface, we can assume 
-      //the cell is either totally full or totally empty
-      float estimate = interpolate_phi(bottom_left + 0.5f*v_dx*Vec3f(1,1,1), levelset, ls_origin, ls_dx);
-      if(estimate > v_dx) {
-         volumes(i,j,k) = 0;
-         continue;
-      }
-      else if(estimate < -v_dx) {
-         volumes(i,j,k) = 1;
-         continue;
-      }
-
-      for(int subk = 0; subk < subdivisions+1; ++subk) for(int subj = 0; subj < subdivisions+1; ++subj) for(int subi = 0; subi < subdivisions+1; ++subi) {
-         Vec3f point = bottom_left + Vec3f( (subi+0.5f)*sub_dx, (subj+0.5f)*sub_dx, (subk+0.5f)*sub_dx);
-         float data = interpolate_phi(point, levelset, ls_origin, ls_dx);
-         inside_samples += (data < 0)?1:0;
-      }
-      volumes(i,j,k) = (float)inside_samples / (float)cube(subdivisions+1);
-   }
-}
-
-#endif
diff --git a/extern/eltopo/common/levelset.h b/extern/eltopo/common/levelset.h
deleted file mode 100644
index 3d917cc..0000000
--- a/extern/eltopo/common/levelset.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "array2.h"
-#include "array3.h"
-#include "vec.h"
-
-//Functions for dealing with grid-based level sets, data stored at nodes
-float interpolate_phi(const Vec2f& point, const Array2f& grid, const Vec2f& origin, const float dx);
-float interpolate_phi(const Vec3f& point, const Array3f& grid, const Vec3f& origin, const float dx);
-float interpolate_normal(Vec2f& normal, const Vec2f& point, const Array2f& grid, const Vec2f& origin, const float dx);
-float interpolate_normal(Vec3f& normal, const Vec3f& point, const Array3f& grid, const Vec3f& origin, const float dx);
-void project_to_isosurface(Vec2f& point, const float target_value, const Array2f& grid, const Vec2f& origin, const float dx);
-void project_to_isosurface(Vec3f& point, const float target_value, const Array3f& grid, const Vec3f& origin, const float dx);
-void compute_volume_fractions(const Array2f& levelset, const Vec2f& ls_origin, float ls_dx, Array2f& volumes, const Vec2f& v_origin, float v_dx, int subdivisions);
-void compute_volume_fractions(const Array3f& levelset, const Vec3f& ls_origin, float ls_dx, Array3f& volumes, const Vec3f& v_origin, float v_dx, int subdivisions);
-
-//a couple handy functions for 1D distance fractions
-float fraction_inside(float phi_left, float phi_right);
-float fraction_inside_either(float phi_left0, float phi_right0, float phi_left1, float phi_right1);
-
diff --git a/extern/eltopo/common/lexer.cpp b/extern/eltopo/common/lexer.cpp
deleted file mode 100644
index 1345f0c..0000000
--- a/extern/eltopo/common/lexer.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-#include <lexer.h>
-#include <cstdio>
-
-Token::
-Token(const Token &source) :
-type(source.type),
-number_value( source.number_value ),
-string_value( source.string_value )
-{
-}
-
-Token &Token::
-operator=(const Token &source)
-{
-    number_value=source.number_value;
-    string_value=source.string_value;
-    return *this;
-}
-
-void Token::
-set(TokenType type_)
-{
-    type=type_;
-    number_value=0;
-    string_value.clear();
-}
-
-void Token::
-set(TokenType type_, const std::string &value)
-{
-    clear();
-    type=type_;
-    string_value=value;
-}
-
-void Token::
-set(TokenType type_, double value)
-{
-    clear();
-    type=type_;
-    number_value=value;
-}
-
-void Token::
-clear()
-{
-    string_value.clear();
-}
-
-std::ostream& operator<<(std::ostream& out, const Token& t)
-{
-    switch(t.type){
-        case TOKEN_EOF:           out<<"EOF"; break;
-        case TOKEN_ERROR:         out<<"ERROR("<<t.string_value<<")"; break;
-        case TOKEN_IDENTIFIER:    out<<"ID("<<t.string_value<<")"; break;
-        case TOKEN_NUMBER:        out<<"NUMBER("<<t.number_value<<")"; break;
-        case TOKEN_STRING:        out<<"STRING("<<t.string_value<<")"; break;
-        case TOKEN_LEFT_PAREN:    out<<"LEFT_PAREN"; break;
-        case TOKEN_RIGHT_PAREN:   out<<"RIGHT_PAREN"; break;
-        case TOKEN_LEFT_BRACKET:  out<<"LEFT_BRACKET"; break;
-        case TOKEN_RIGHT_BRACKET: out<<"RIGHT_BRACKET"; break;
-    }
-    return out;
-}
-
-namespace {
-    
-    double double_of_string(const std::string &s)
-    {
-        double v;
-        std::sscanf(s.c_str(), "%lf", &v);
-        return v;
-    }
-    
-} // namespace
-
-void Lexer::
-read(Token &tok)
-{
-    char c;
-    enum {MODE_UNKNOWN, MODE_ERROR, MODE_MINUS, MODE_NUMBER, MODE_MANTISSA, MODE_E,
-        MODE_EMINUS, MODE_EXPONENT, MODE_IDENTIFIER, MODE_STRING, MODE_STRINGESCAPE} mode=MODE_UNKNOWN;
-    std::string token_string;
-    
-    for(;;){
-        input.get(c);
-        if(input.eof() || !input.good()){ // on end of input ////////////////////////////////////////////
-            switch(mode){
-                case MODE_UNKNOWN:
-                    tok.set(TOKEN_EOF); return;
-                case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS: case MODE_STRING: case MODE_STRINGESCAPE:
-                    tok.set(TOKEN_ERROR, token_string); return;
-                case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                    tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                case MODE_IDENTIFIER:
-                    tok.set(TOKEN_IDENTIFIER, token_string); return;
-            }
-        }else{
-            switch(c){ // on a good character ///////////////////////////////////////
-                case '-':
-                    token_string.push_back(c);
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            mode=MODE_MINUS;
-                            break;
-                        case MODE_IDENTIFIER: case MODE_STRING:
-                            break;
-                        case MODE_STRINGESCAPE:
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_E:
-                            mode=MODE_EMINUS;
-                            break;
-                        default:
-                            mode=MODE_ERROR;
-                            break;
-                    }
-                    break;
-                    
-                case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
-                    token_string.push_back(c);
-                    switch(mode){
-                        case MODE_UNKNOWN: case MODE_MINUS:
-                            mode=MODE_NUMBER;
-                            break;
-                        case MODE_E: case MODE_EMINUS:
-                            mode=MODE_EXPONENT;
-                            break;
-                        case MODE_STRINGESCAPE:
-                            mode=MODE_STRING;
-                            break;
-                        default:
-                            break;
-                    }
-                    break;
-                    
-                case '.':
-                    token_string.push_back(c);
-                    switch(mode){
-                        case MODE_UNKNOWN: case MODE_NUMBER: case MODE_MINUS:
-                            mode=MODE_MANTISSA;
-                            break;
-                        case MODE_IDENTIFIER: case MODE_STRING:
-                            break;
-                        case MODE_STRINGESCAPE:
-                            mode=MODE_STRING;
-                            break;
-                        default:
-                            mode=MODE_ERROR;
-                    }
-                    break;
-                    
-                case 'e': case 'E':
-                    token_string.push_back(c);
-                    switch(mode){
-                        case MODE_NUMBER: case MODE_MANTISSA:
-                            mode=MODE_E;
-                            break;
-                        case MODE_IDENTIFIER: case MODE_STRING:
-                            break;
-                        case MODE_STRINGESCAPE:
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_UNKNOWN:
-                            mode=MODE_IDENTIFIER;
-                            break;
-                        default:
-                            mode=MODE_ERROR;
-                    }
-                    break;
-                    
-                case '"': // start or end of a string
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_STRING:
-                            tok.set(TOKEN_STRING, token_string); return;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                case '\\': // escape within a string, otherwise nothing special
-                    switch(mode){
-                        case MODE_UNKNOWN: case MODE_IDENTIFIER:
-                            token_string.push_back(c);
-                            mode=MODE_IDENTIFIER;
-                            break;
-                        case MODE_STRING:
-                            mode=MODE_STRINGESCAPE;
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            token_string.push_back(c);
-                            mode=MODE_ERROR;
-                            break;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            input.putback('(');
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                    }
-                    break;
-                    
-                case ' ': case '\t': case '\r': case '\n':
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            break; // keep going
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                case '#':
-                    switch(mode){
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        default: // ignore the rest of the line as a comment
-                            do input.get(c);
-                            while(!input.eof() && input.good() && c!='\n' && c!='\r');
-                    }
-                    break;
-                    
-                case '(':
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            tok.set(TOKEN_LEFT_PAREN); return;
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            input.putback('(');
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            input.putback('(');
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            input.putback('(');
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                case ')':
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            tok.set(TOKEN_RIGHT_PAREN); return;
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            input.putback(')');
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            input.putback(')');
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            input.putback(')');
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                case '[':
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            tok.set(TOKEN_LEFT_BRACKET); return;
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            input.putback('[');
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            input.putback('[');
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            input.putback('[');
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                case ']':
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            tok.set(TOKEN_RIGHT_BRACKET); return;
-                        case MODE_STRING:
-                            token_string.push_back(c);
-                            break;
-                        case MODE_STRINGESCAPE:
-                            token_string.push_back(c);
-                            mode=MODE_STRING;
-                            break;
-                        case MODE_ERROR: case MODE_MINUS: case MODE_E: case MODE_EMINUS:
-                            input.putback(']');
-                            tok.set(TOKEN_ERROR, token_string); return;
-                        case MODE_NUMBER: case MODE_MANTISSA: case MODE_EXPONENT:
-                            input.putback(']');
-                            tok.set(TOKEN_NUMBER, double_of_string(token_string)); return;
-                        case MODE_IDENTIFIER:
-                            input.putback(']');
-                            tok.set(TOKEN_IDENTIFIER, token_string); return;
-                    }
-                    break;
-                    
-                default:
-                    token_string.push_back(c);
-                    switch(mode){
-                        case MODE_UNKNOWN:
-                            mode=MODE_IDENTIFIER;
-                            break;
-                        case MODE_IDENTIFIER: case MODE_STRING:
-                            break;
-                        case MODE_STRINGESCAPE:
-                            mode=MODE_STRING;
-                            break;
-                        default:
-                            mode=MODE_ERROR;
-                    }
-                    break;
-            }
-        }
-    }
-}
-
diff --git a/extern/eltopo/common/lexer.h b/extern/eltopo/common/lexer.h
deleted file mode 100644
index 8eecd1d..0000000
--- a/extern/eltopo/common/lexer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef LEXER_H
-#define LEXER_H
-
-#include <iostream>
-#include <string>
-
-enum TokenType {TOKEN_EOF, TOKEN_ERROR, TOKEN_IDENTIFIER, TOKEN_NUMBER, TOKEN_STRING,
-    TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN,
-    TOKEN_LEFT_BRACKET, TOKEN_RIGHT_BRACKET};
-
-struct Token
-{
-    TokenType type;
-    // typically only one of the following has a meaningful value
-    double number_value;
-    std::string string_value;
-    
-    Token() : type(TOKEN_ERROR), number_value(1e+30), string_value("ERROR") {}
-    ~Token() { clear(); }
-    
-    Token(const Token &source);
-    Token &operator=(const Token &source);
-    
-    void set(TokenType type_);
-    void set(TokenType type_, const std::string &value);
-    void set(TokenType type_, double value);
-    void clear(); // free up string storage after finished with a TOKEN_ERROR or TOKEN_IDENTIFIER
-};
-
-std::ostream& operator<<(std::ostream& out, const Token& t);
-
-struct Lexer
-{
-    std::istream& input;
-    
-    Lexer(std::istream& input_) : input(input_) {}
-    
-    void read(Token &tok);
-};
-
-#endif
diff --git a/extern/eltopo/common/makelevelset2.cpp b/extern/eltopo/common/makelevelset2.cpp
deleted file mode 100644
index 3f0add8..0000000
--- a/extern/eltopo/common/makelevelset2.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "makelevelset2.h"
-
-// find distance x0 is from segment x1-x2
-static double point_segment_distance(const Vec2d &x0, const Vec2d &x1, const Vec2d &x2)
-{
-   Vec2d dx(x2-x1);
-   double m2=mag2(dx);
-   // find parameter value of closest point on segment
-   double s12=(double)( dot(x2-x0, dx)/m2 );
-   if(s12<0){
-      s12=0;
-   }else if(s12>1){
-      s12=1;
-   }
-   // and find the distance
-   return mag(s12*x1+(1-s12)*x2 - x0);
-}
-
-static void check_neighbour(const std::vector<Vec2ui> &edge, const std::vector<Vec2d> &x,
-                            Array2d &phi, Array2i &closest_edge,
-                            const Vec2d &gx, int i0, int j0, int i1, int j1)
-{
-   if(closest_edge(i0,j0)==closest_edge(i1,j1))
-      return;
-   if(closest_edge(i1,j1)>=0){
-      unsigned int p, q; assign(edge[closest_edge(i1,j1)], p, q);
-      double d=point_segment_distance(gx, x[p], x[q]);
-      if(d<phi(i0,j0)){
-         phi(i0,j0)=d;
-         closest_edge(i0,j0)=closest_edge(i1,j1);
-      }
-   }
-}
-
-void make_level_set2(const std::vector<Vec2ui> &edge, const std::vector<Vec2d> &x,
-                     const Vec2d &origin, double dx, int nx, int ny,
-                     Array2d &phi)
-{
-   phi.resize(nx, ny);
-   phi.assign((nx+ny)*dx); // upper bound on distance
-   Array2i closest_edge(nx, ny, -1);
-   Array2i intersection_count(nx, ny, 0); // intersection_count(i,j) is # of edge intersections in (i-1,i]x{j}
-   // we begin by initializing distances near the mesh, and figuring out intersection counts
-   Vec2d ijmin, ijmax;
-   for(unsigned int e=0; e<edge.size(); ++e){
-      unsigned int p, q; assign(edge[e], p, q);
-      minmax((x[p]-origin)/dx, (x[q]-origin)/dx, ijmin, ijmax);
-      // do distances
-      int i0=clamp(int(ijmin[0])-1, 0, nx-1), i1=clamp(int(ijmax[0])+2, 0, nx-1);
-      int j0=clamp(int(ijmin[1])-1, 0, ny-1), j1=clamp(int(ijmax[1])+2, 0, ny-1);
-      for(int j=j0; j<=j1; ++j) for(int i=i0; i<=i1; ++i){
-         Vec2d gx(i*dx+origin[0], j*dx+origin[1]);
-         double d=point_segment_distance(gx, x[p], x[q]);
-         if(d<phi(i,j)){
-            phi(i,j)=d;
-            closest_edge(i,j)=e;
-         }
-      }
-      // and do intersection counts
-      if(x[p][1]!=x[q][1]){ // if it's not a horizontal edge
-         double fi0, fj0, fi1, fj1;
-         if(x[p][1]<x[q][1]){
-            fi0=((double)x[p][0]-origin[0])/dx;
-            fj0=((double)x[p][1]-origin[1])/dx;
-            fi1=((double)x[q][0]-origin[0])/dx;
-            fj1=((double)x[q][1]-origin[1])/dx;
-         }else{
-            fi0=((double)x[q][0]-origin[0])/dx;
-            fj0=((double)x[q][1]-origin[1])/dx;
-            fi1=((double)x[p][0]-origin[0])/dx;
-            fj1=((double)x[p][1]-origin[1])/dx;
-         }
-         j0=clamp(int(std::floor(fj0)), 0, ny-1)+1;
-         j1=clamp(int(std::floor(fj1)), 0, ny-1);
-         for(int j=j0; j<=j1; ++j){
-            double alpha=(j-fj0)/(fj1-fj0);
-            double fi=(1-alpha)*fi0 + alpha*fi1; // where the edge intersects the j'th grid line
-            int i_interval=int(std::ceil(fi)); // intersection is in (i_interval-1,i_interval]
-            if(i_interval<0) i_interval=0; // we enlarge the first interval to include everything to the left
-            if(i_interval<nx){
-               ++intersection_count(i_interval,j);
-            } // we ignore intersections that are beyond the right edge of the grid
-         }
-      }
-   }
-   // and now we fill in the rest of the distances with fast sweeping
-   for(unsigned int pass=0; pass<2; ++pass){
-      for(int j=1; j<ny; ++j) for(int i=1; i<nx; ++i){
-         Vec2d gx(i*dx+origin[0], j*dx+origin[1]);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i-1, j-1);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i-1, j);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i, j-1);
-      }
-      for(int j=ny-2; j>=0; --j) for(int i=nx-2; i>=0; --i){
-         Vec2d gx(i*dx+origin[0], j*dx+origin[1]);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i+1, j+1);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i+1, j);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i, j+1);
-      }
-      for(int j=ny-2; j>=0; --j) for(int i=1; i<nx; ++i){
-         Vec2d gx(i*dx+origin[0], j*dx+origin[1]);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i-1, j+1);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i-1, j);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i, j+1);
-      }
-      for(int j=1; j<ny; ++j) for(int i=nx-2; i>=0; --i){
-         Vec2d gx(i*dx+origin[0], j*dx+origin[1]);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i+1, j-1);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i+1, j);
-         check_neighbour(edge, x, phi, closest_edge, gx, i, j, i, j-1);
-      }
-   }
-   // then figure out signs (inside/outside) from intersection counts
-   for(int j=0; j<ny; ++j){
-      int total_count=0;
-      for(int i=0; i<nx; ++i){
-         total_count+=intersection_count(i,j);
-         if(total_count%2==1){ // if parity of intersections so far is odd,
-            phi(i,j)=-phi(i,j); // we are inside the mesh
-         }
-      }
-   }
-}
-
diff --git a/extern/eltopo/common/makelevelset2.h b/extern/eltopo/common/makelevelset2.h
deleted file mode 100644
index c727063..0000000
--- a/extern/eltopo/common/makelevelset2.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef MAKELEVELSET2_H
-#define MAKELEVELSET2_H
-
-#include "array2.h"
-#include "vec.h"
-
-// edge is a list of edges in the mesh, and x is the positions of the vertices
-void make_level_set2(const std::vector<Vec2ui> &edge, const std::vector<Vec2d> &x,
-                     const Vec2d &origin, double dx, int nx, int ny,
-                     Array2d &phi);
-
-#endif
diff --git a/extern/eltopo/common/makelevelset3.cpp b/extern/eltopo/common/makelevelset3.cpp
deleted file mode 100644
index ed2ff9a..0000000
--- a/extern/eltopo/common/makelevelset3.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-#include <makelevelset3.h>
-
-namespace {
-    
-    // find distance x0 is from segment x1-x2
-    double point_segment_distance(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2)
-    {
-        Vec3d dx(x2-x1);
-        double m2=mag2(dx);
-        // find parameter value of closest point on segment
-        double s12=dot(x2-x0, dx)/m2;
-        if(s12<0){
-            s12=0;
-        }else if(s12>1){
-            s12=1;
-        }
-        // and find the distance
-        return dist(x0, s12*x1+(1-s12)*x2);
-    }
-    
-    // find distance x0 is from triangle x1-x2-x3
-    double point_triangle_distance(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3)
-    {
-        // first find barycentric coordinates of closest point on infinite plane
-        Vec3d x13(x1-x3), x23(x2-x3), x03(x0-x3);
-        double m13=mag2(x13), m23=mag2(x23), d=dot(x13,x23);
-        double invdet=1.f/max(m13*m23-d*d,1e-30);
-        double a=dot(x13,x03), b=dot(x23,x03);
-        // the barycentric coordinates themselves
-        double w23=invdet*(m23*a-d*b);
-        double w31=invdet*(m13*b-d*a);
-        double w12=1-w23-w31;
-        if(w23>=0 && w31>=0 && w12>=0){ // if we're inside the triangle
-            return dist(x0, w23*x1+w31*x2+w12*x3); 
-        }else{ // we have to clamp to one of the edges
-            if(w23>0) // this rules out edge 2-3 for us
-                return min(point_segment_distance(x0,x1,x2), point_segment_distance(x0,x1,x3));
-            else if(w31>0) // this rules out edge 1-3
-                return min(point_segment_distance(x0,x1,x2), point_segment_distance(x0,x2,x3));
-            else // w12 must be >0, ruling out edge 1-2
-                return min(point_segment_distance(x0,x1,x3), point_segment_distance(x0,x2,x3));
-        }
-    }
-    
-    void check_neighbour(const std::vector<Vec3st> &tri, const std::vector<Vec3d> &x,
-                         Array3d &phi, Array3i &closest_tri,
-                         const Vec3d &gx, size_t i0, size_t j0, size_t k0, size_t i1, size_t j1, size_t k1)
-    {
-        if(closest_tri(i1,j1,k1)>=0){
-            size_t p, q, r; assign(tri[closest_tri(i1,j1,k1)], p, q, r);
-            double d=point_triangle_distance(gx, x[p], x[q], x[r]);
-            if(d<phi(i0,j0,k0)){
-                phi(i0,j0,k0)=d;
-                closest_tri(i0,j0,k0)=closest_tri(i1,j1,k1);
-            }
-        }
-    }
-    
-    void sweep(const std::vector<Vec3st> &tri, const std::vector<Vec3d> &x,
-               Array3d &phi, Array3i &closest_tri, const Vec3d &origin, double dx,
-               int di, int dj, int dk)
-    {
-        ssize_t i0, i1;
-        if(di>0){ i0=1; i1=phi.ni; }
-        else{ i0=phi.ni-2; i1=-1; }
-        ssize_t j0, j1;
-        if(dj>0){ j0=1; j1=phi.nj; }
-        else{ j0=phi.nj-2; j1=-1; }
-        ssize_t k0, k1;
-        if(dk>0){ k0=1; k1=phi.nk; }
-        else{ k0=phi.nk-2; k1=-1; }
-        for(ssize_t k=k0; k!=k1; k+=dk) for(ssize_t j=j0; j!=j1; j+=dj) for(ssize_t i=i0; i!=i1; i+=di){
-            Vec3d gx(i*dx+origin[0], j*dx+origin[1], k*dx+origin[2]);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i-di, j,    k);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i,    j-dj, k);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i-di, j-dj, k);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i,    j,    k-dk);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i-di, j,    k-dk);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i,    j-dj, k-dk);
-            check_neighbour(tri, x, phi, closest_tri, gx, i, j, k, i-di, j-dj, k-dk);
-        }
-    }
-    
-    // calculate twice signed area of triangle (0,0)-(x1,y1)-(x2,y2)
-    // return an SOS-determined sign (-1, +1, or 0 only if it's a truly degenerate triangle)
-    int orientation(double x1, double y1, double x2, double y2, double &twice_signed_area)
-    {
-        twice_signed_area=y1*x2-x1*y2;
-        if(twice_signed_area>0) return 1;
-        else if(twice_signed_area<0) return -1;
-        else if(y2>y1) return 1;
-        else if(y2<y1) return -1;
-        else if(x1>x2) return 1;
-        else if(x1<x2) return -1;
-        else return 0; // only true when x1==x2 and y1==y2
-    }
-    
-    // robust test of (x0,y0) in the triangle (x1,y1)-(x2,y2)-(x3,y3)
-    // if true is returned, the barycentric coordinates are set in a,b,c.
-    bool point_in_triangle_2d(double x0, double y0, 
-                              double x1, double y1, double x2, double y2, double x3, double y3,
-                              double& a, double& b, double& c)
-    {
-        x1-=x0; x2-=x0; x3-=x0;
-        y1-=y0; y2-=y0; y3-=y0;
-        int signa=orientation(x2, y2, x3, y3, a);
-        if(signa==0) return false;
-        int signb=orientation(x3, y3, x1, y1, b);
-        if(signb!=signa) return false;
-        int signc=orientation(x1, y1, x2, y2, c);
-        if(signc!=signa) return false;
-        double sum=a+b+c;
-        assert(sum!=0); // if the SOS signs match and are nonkero, there's no way all of a, b, and c are zero.
-        a/=sum;
-        b/=sum;
-        c/=sum;
-        return true;
-    }
-    
-} // unnamed namespace
-
-void make_level_set3(const std::vector<Vec3st> &tri, const std::vector<Vec3d> &x,
-                     const Vec3d &origin, double dx, int ni, int nj, int nk,
-                     Array3d &phi, Array3i& closest_tri, const int exact_band )
-{
-    
-    phi.resize(ni, nj, nk);
-    phi.assign((ni+nj+nk)*dx); // upper bound on distance
-    closest_tri.clear();
-    closest_tri.resize(ni, nj, nk, -1);
-    Array3i intersection_count(ni, nj, nk, 0); // intersection_count(i,j,k) is # of tri intersections in (i-1,i]x{j}x{k}
-    // we begin by initializing distances near the mesh, and figuring out intersection counts
-    Vec3d ijkmin, ijkmax;
-    for(unsigned int t=0; t<tri.size(); ++t){
-        size_t p, q, r; assign(tri[t], p, q, r);
-        // coordinates in grid to high precision
-        double fip=((double)x[p][0]-origin[0])/dx, fjp=((double)x[p][1]-origin[1])/dx, fkp=((double)x[p][2]-origin[2])/dx;
-        double fiq=((double)x[q][0]-origin[0])/dx, fjq=((double)x[q][1]-origin[1])/dx, fkq=((double)x[q][2]-origin[2])/dx;
-        double fir=((double)x[r][0]-origin[0])/dx, fjr=((double)x[r][1]-origin[1])/dx, fkr=((double)x[r][2]-origin[2])/dx;
-        // do distances nearby
-        int i0=clamp(int(min(fip,fiq,fir))-exact_band, 0, ni-1), i1=clamp(int(max(fip,fiq,fir))+exact_band+1, 0, ni-1);
-        int j0=clamp(int(min(fjp,fjq,fjr))-exact_band, 0, nj-1), j1=clamp(int(max(fjp,fjq,fjr))+exact_band+1, 0, nj-1);
-        int k0=clamp(int(min(fkp,fkq,fkr))-exact_band, 0, nk-1), k1=clamp(int(max(fkp,fkq,fkr))+exact_band+1, 0, nk-1);
-        for(int k=k0; k<=k1; ++k) for(int j=j0; j<=j1; ++j) for(int i=i0; i<=i1; ++i){
-            Vec3d gx(i*dx+origin[0], j*dx+origin[1], k*dx+origin[2]);
-            double d=point_triangle_distance(gx, x[p], x[q], x[r]);
-            if(d<phi(i,j,k)){
-                phi(i,j,k)=d;
-                closest_tri(i,j,k)=t;
-            }
-        }
-        // and do intersection counts
-        j0=clamp((int)std::ceil(min(fjp,fjq,fjr)), 0, nj-1);
-        j1=clamp((int)std::floor(max(fjp,fjq,fjr)), 0, nj-1);
-        k0=clamp((int)std::ceil(min(fkp,fkq,fkr)), 0, nk-1);
-        k1=clamp((int)std::floor(max(fkp,fkq,fkr)), 0, nk-1);
-        for(int k=k0; k<=k1; ++k) for(int j=j0; j<=j1; ++j){
-            double a, b, c;
-            if(point_in_triangle_2d(j, k, fjp, fkp, fjq, fkq, fjr, fkr, a, b, c)){
-                double fi=a*fip+b*fiq+c*fir; // intersection i coordinate
-                int i_interval=int(std::ceil(fi)); // intersection is in (i_interval-1,i_interval]
-                if(i_interval<0) ++intersection_count(0, j, k); // we enlarge the first interval to include everything to the -x direction
-                else if(i_interval<ni) ++intersection_count(i_interval,j,k);
-                // we ignore intersections that are beyond the +x side of the grid
-            }
-        }
-    }
-    // and now we fill in the rest of the distances with fast sweeping
-    for(unsigned int pass=0; pass<2; ++pass){
-        sweep(tri, x, phi, closest_tri, origin, dx, +1, +1, +1);
-        sweep(tri, x, phi, closest_tri, origin, dx, -1, -1, -1);
-        sweep(tri, x, phi, closest_tri, origin, dx, +1, +1, -1);
-        sweep(tri, x, phi, closest_tri, origin, dx, -1, -1, +1);
-        sweep(tri, x, phi, closest_tri, origin, dx, +1, -1, +1);
-        sweep(tri, x, phi, closest_tri, origin, dx, -1, +1, -1);
-        sweep(tri, x, phi, closest_tri, origin, dx, +1, -1, -1);
-        sweep(tri, x, phi, closest_tri, origin, dx, -1, +1, +1);
-    }
-    // then figure out signs (inside/outside) from intersection counts
-    for(int k=0; k<nk; ++k) for(int j=0; j<nj; ++j){
-        int total_count=0;
-        for(int i=0; i<ni; ++i){
-            total_count+=intersection_count(i,j,k);
-            if(total_count%2==1){ // if parity of intersections so far is odd,
-                phi(i,j,k)=-phi(i,j,k); // we are inside the mesh
-            }
-        }
-    }
-}
-
diff --git a/extern/eltopo/common/makelevelset3.h b/extern/eltopo/common/makelevelset3.h
deleted file mode 100644
index fc934aa..0000000
--- a/extern/eltopo/common/makelevelset3.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef MAKELEVELSET3_H
-#define MAKELEVELSET3_H
-
-#include <array3.h>
-#include <vec.h>
-
-// TODO: make 32/64 bit agnostic
-
-// tri is a list of triangles in the mesh, and x is the positions of the vertices
-// absolute distances will be nearly correct for triangle soup, but a closed mesh is
-// needed for accurate signs. Distances for all grid cells within exact_band cells of
-// a triangle should be exact; further away a distance is calculated but it might not
-// be to the closest triangle - just one nearby.
-
-void make_level_set3(const std::vector<Vec3st> &tri, const std::vector<Vec3d> &x,
-                     const Vec3d &origin, double dx, int ni, int nj, int nk,
-                     Array3d &phi, Array3i& closest_tri, const int exact_band );
-
-
-inline void make_level_set3(const std::vector<Vec3st> &tri, const std::vector<Vec3d> &x,
-                            const Vec3d &origin, double dx, int ni, int nj, int nk,
-                            Array3d &phi, const int exact_band )
-{
-    Array3i ignore;
-    make_level_set3( tri, x, origin, dx, ni, nj, nk, phi, ignore, exact_band );
-}
-
-#endif
diff --git a/extern/eltopo/common/marching_tiles_hires.cpp b/extern/eltopo/common/marching_tiles_hires.cpp
deleted file mode 100644
index 9f2466b..0000000
--- a/extern/eltopo/common/marching_tiles_hires.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-#include <marching_tiles_hires.h>
-
-// definition of acute tile
-static const int num_nodes=40;
-static Vec3i node[num_nodes]={
-    Vec3i(1,0,0),
-    Vec3i(2,2,0),
-    Vec3i(1,4,0),
-    Vec3i(3,4,0),
-    Vec3i(2,6,0),
-    Vec3i(1,0,4),
-    Vec3i(3,0,4),
-    Vec3i(2,1,2),
-    Vec3i(0,2,1),
-    Vec3i(0,2,3),
-    Vec3i(2,2,4),   // 10
-    Vec3i(1,4,4),
-    Vec3i(3,4,4),
-    Vec3i(0,4,2),
-    Vec3i(2,3,2),
-    Vec3i(2,5,2),
-    Vec3i(4,2,1),
-    Vec3i(4,2,3),
-    Vec3i(5,4,4),
-    Vec3i(4,4,2),
-    Vec3i(0,6,1),   // 20
-    Vec3i(0,6,3),
-    Vec3i(2,6,4),
-    Vec3i(2,7,2),
-    Vec3i(4,6,1),
-    Vec3i(4,6,3),
-    Vec3i(0,2,5),
-    Vec3i(2,3,6),
-    Vec3i(2,5,6),
-    Vec3i(4,2,5),
-    Vec3i(4,4,6),   // 30
-    Vec3i(4,6,5),
-    Vec3i(2,1,6),
-    Vec3i(0,0,2),
-    Vec3i(5,0,4),
-    Vec3i(4,0,2),
-    Vec3i(3,0,0),
-    Vec3i(4,0,6),
-    Vec3i(5,0,0),
-    Vec3i(5,4,0)
-};
-static const int num_tets=46;
-static Vec4i tet[num_tets]={
-    Vec4i(2,3,15,14),
-    Vec4i(2,15,13,14),
-    Vec4i(6,29,17,10),
-    Vec4i(6,17,34,35),
-    Vec4i(12,14,17,10),
-    Vec4i(0,36,1,7),
-    Vec4i(29,12,18,17),
-    Vec4i(3,14,16,19),
-    Vec4i(3,15,14,19),
-    Vec4i(14,16,1,3),
-    Vec4i(0,7,8,33),
-    Vec4i(7,16,36,1),
-    Vec4i(9,7,5,33),
-    Vec4i(8,7,9,33),
-    Vec4i(14,12,17,19),
-    Vec4i(12,29,10,17),
-    Vec4i(14,9,13,8),
-    Vec4i(8,2,14,1),
-    Vec4i(14,17,16,19),
-    Vec4i(17,14,7,10),
-    Vec4i(16,7,36,35),
-    Vec4i(17,6,7,35),
-    Vec4i(11,15,14,13),
-    Vec4i(3,2,1,14),
-    Vec4i(9,14,7,8),
-    Vec4i(9,14,11,10),
-    Vec4i(1,8,0,7),
-    Vec4i(14,8,1,7),
-    Vec4i(12,15,19,14),
-    Vec4i(19,39,16,3),
-    Vec4i(17,12,18,19),
-    Vec4i(14,9,11,13),
-    Vec4i(14,12,11,10),
-    Vec4i(2,8,14,13),
-    Vec4i(6,17,7,10),
-    Vec4i(5,9,26,10),
-    Vec4i(14,9,7,10),
-    Vec4i(11,9,10,26),
-    Vec4i(7,9,5,10),
-    Vec4i(17,6,34,29),
-    Vec4i(6,7,5,10),
-    Vec4i(15,12,11,14),
-    Vec4i(16,14,1,7),
-    Vec4i(7,17,35,16),
-    Vec4i(38,35,16,36),
-    Vec4i(14,16,17,7)
-};
-
-void MarchingTilesHiRes::
-contour(void)
-{
-    tri.resize(0);
-    x.resize(0);
-    edge_cross.clear();
-    for(ssize_t k=0; k<phi.nk; ++k) for(ssize_t j=0; j<phi.nj; ++j) for(ssize_t i=0; i<phi.ni; ++i)
-        contour_tile(i,j,k);
-}
-
-void MarchingTilesHiRes::
-improve_mesh(void)
-{
-    // first get adjacency information
-    std::vector<Array1ui> nbr(x.size());
-    for(unsigned int t=0; t<tri.size(); ++t){
-        unsigned int p, q, r; assign(tri[t], p, q, r);
-        nbr[p].add_unique(q);
-        nbr[p].add_unique(r);
-        nbr[q].add_unique(p);
-        nbr[q].add_unique(r);
-        nbr[r].add_unique(p);
-        nbr[r].add_unique(q);
-    }
-    // then sweep through the mesh a few times incrementally improving positions
-    for(unsigned int sweep=0; sweep<3; ++sweep){
-        for(unsigned int p=0; p<x.size(); ++p){
-            // get a weighted average of neighbourhood positions
-            Vec3d target=x[p];
-            for(unsigned int a=0; a<nbr[p].size(); ++a)
-                target+=x[nbr[p][a]];
-            target/=(1.0+nbr[p].size());
-            // project onto level set surface with Newton
-            for(int projection_step=0; projection_step<5; ++projection_step){
-                double i=(target[0]-origin[0])/dx, j=(target[1]-origin[1])/dx, k=(target[2]-origin[2])/dx;
-                double f=eval(i,j,k);
-                Vec3d g; eval_gradient(i,j,k,g);
-                double m2=mag2(g), m=std::sqrt(m2);
-                double alpha=clamp(-f/(m2+1e-30), -0.25*m, 0.25*m); // clamp to avoid stepping more than a fraction of a grid cell
-                // do line search to make sure we actually are getting closer to the zero level set
-                bool line_search_success=false;
-                for(int line_search_step=0; line_search_step<10; ++line_search_step){
-                    double fnew=eval(i+alpha*g[0], j+alpha*g[1], k+alpha*g[2]);
-                    if(std::fabs(fnew)<=std::fabs(f)){
-                        target += Vec3d( (alpha*dx)*g[0], (alpha*dx)*g[0], (alpha*dx)*g[0] );
-                        target += Vec3d( (alpha*dx)*g[1], (alpha*dx)*g[1], (alpha*dx)*g[1] );
-                        target += Vec3d( (alpha*dx)*g[2], (alpha*dx)*g[2], (alpha*dx)*g[2] );
-                        line_search_success=true;
-                        break;
-                    }else
-                        alpha*=0.5;
-                }
-                if(!line_search_success){ // if we stalled trying to find the zero isocontour...
-                    // weight the target closer to the original x[p]
-                    std::cout<<"line search failed (p="<<p<<" project="<<projection_step<<" sweep="<<sweep<<")"<<std::endl;
-                    target= 0.5 * (x[p]+target);
-                }
-            }
-            x[p]=target;
-        }
-    }
-}
-
-void MarchingTilesHiRes::
-estimate_normals(void)
-{
-    normal.resize(x.size());
-    for(unsigned int p=0; p<x.size(); ++p){
-        eval_gradient((x[p][0]-origin[0])/dx,
-                      (x[p][1]-origin[1])/dx,
-                      (x[p][2]-origin[2])/dx,
-                      normal[p]);
-        normalize(normal[p]);
-    }
-}
-
-double MarchingTilesHiRes::
-eval(double i, double j, double k)
-{
-    ssize_t p, q, r;
-    double f, g, h;
-    /*
-     get_barycentric(i, p, f, 0, phi.ni);
-     get_barycentric(j, q, g, 0, phi.nj);
-     get_barycentric(k, r, h, 0, phi.nk);
-     return trilerp(phi(p,q,r), phi(p+1,q,r), phi(p,q+1,r), phi(p+1,q+1,r),
-     phi(p,q,r+1), phi(p+1,q,r+1), phi(p,q+1,r+1), phi(p+1,q+1,r+1), f, g, h);
-     */
-    get_barycentric(i+0.5f, p, f, 1, phi.ni);
-    get_barycentric(j+0.5f, q, g, 1, phi.nj);
-    get_barycentric(k+0.5f, r, h, 1, phi.nk);
-    double wx0, wx1, wx2, wy0, wy1, wy2, wz0, wz1, wz2;
-    quadratic_bspline_weights(f, wx0, wx1, wx2);
-    quadratic_bspline_weights(g, wy0, wy1, wy2);
-    quadratic_bspline_weights(h, wz0, wz1, wz2);
-    return wx0*( wy0*( wz0*phi(p-1,q-1,r-1) + wz1*phi(p-1,q-1,r) + wz2*phi(p-1,q-1,r+1) )
-                +wy1*( wz0*phi(p-1,q,  r-1) + wz1*phi(p-1,q,  r) + wz2*phi(p-1,q,  r+1) )
-                +wy2*( wz0*phi(p-1,q+1,r-1) + wz1*phi(p-1,q+1,r) + wz2*phi(p-1,q+1,r+1) ) )
-    +wx1*( wy0*( wz0*phi(p,  q-1,r-1) + wz1*phi(p,  q-1,r) + wz2*phi(p,  q-1,r+1) )
-          +wy1*( wz0*phi(p,  q,  r-1) + wz1*phi(p,  q,  r) + wz2*phi(p,  q,  r+1) )
-          +wy2*( wz0*phi(p,  q+1,r-1) + wz1*phi(p,  q+1,r) + wz2*phi(p,  q+1,r+1) ) )
-    +wx2*( wy0*( wz0*phi(p+1,q-1,r-1) + wz1*phi(p+1,q-1,r) + wz2*phi(p+1,q-1,r+1) )
-          +wy1*( wz0*phi(p+1,q,  r-1) + wz1*phi(p+1,q,  r) + wz2*phi(p+1,q,  r+1) )
-          +wy2*( wz0*phi(p+1,q+1,r-1) + wz1*phi(p+1,q+1,r) + wz2*phi(p+1,q+1,r+1) ) );
-}
-
-void MarchingTilesHiRes::
-eval_gradient(double i, double j, double k, Vec3d& grad)
-{
-    /*
-     double gx=(eval(i+1e-3d,j,k)-eval(i-1e-3d,j,k))/2e-3d;
-     double gy=(eval(i,j+1e-3d,k)-eval(i,j-1e-3d,k))/2e-3d;
-     double gz=(eval(i,j,k+1e-3d)-eval(i,j,k-1e-3d))/2e-3d;
-     grad[0]=gx;
-     grad[1]=gy;
-     grad[2]=gz;
-     */
-    ssize_t p, q, r;
-    double f, g, h;
-    get_barycentric(i+0.5f, p, f, 1, phi.ni);
-    get_barycentric(j+0.5f, q, g, 1, phi.nj);
-    get_barycentric(k+0.5f, r, h, 1, phi.nk);
-    double wx0, wx1, wx2, wy0, wy1, wy2, wz0, wz1, wz2;
-    quadratic_bspline_weights(f, wx0, wx1, wx2);
-    quadratic_bspline_weights(g, wy0, wy1, wy2);
-    quadratic_bspline_weights(h, wz0, wz1, wz2);
-    
-    grad[0]=wz0*( wy0*lerp(phi(p,q-1,r-1)-phi(p-1,q-1,r-1), phi(p+1,q-1,r-1)-phi(p,q-1,r-1), f)
-                 +wy1*lerp(phi(p,q,  r-1)-phi(p-1,q,  r-1), phi(p+1,q,  r-1)-phi(p,q,  r-1), f)
-                 +wy2*lerp(phi(p,q+1,r-1)-phi(p-1,q+1,r-1), phi(p+1,q+1,r-1)-phi(p,q+1,r-1), f) )
-    +wz1*( wy0*lerp(phi(p,q-1,r  )-phi(p-1,q-1,r  ), phi(p+1,q-1,r  )-phi(p,q-1,r  ), f)
-          +wy1*lerp(phi(p,q,  r  )-phi(p-1,q,  r  ), phi(p+1,q,  r  )-phi(p,q,  r  ), f)
-          +wy2*lerp(phi(p,q+1,r  )-phi(p-1,q+1,r  ), phi(p+1,q+1,r  )-phi(p,q+1,r  ), f) )
-    +wz2*( wy0*lerp(phi(p,q-1,r+1)-phi(p-1,q-1,r+1), phi(p+1,q-1,r+1)-phi(p,q-1,r+1), f)
-          +wy1*lerp(phi(p,q,  r+1)-phi(p-1,q,  r+1), phi(p+1,q,  r+1)-phi(p,q,  r+1), f)
-          +wy2*lerp(phi(p,q+1,r+1)-phi(p-1,q+1,r+1), phi(p+1,q+1,r+1)-phi(p,q+1,r+1), f) );
-    
-    grad[1]=wz0*( wx0*lerp(phi(p-1,q,r-1)-phi(p-1,q-1,r-1), phi(p-1,q+1,r-1)-phi(p-1,q,r-1), g)
-                 +wx1*lerp(phi(p,  q,r-1)-phi(p,  q-1,r-1), phi(p,  q+1,r-1)-phi(p,  q,r-1), g)
-                 +wx2*lerp(phi(p+1,q,r-1)-phi(p+1,q-1,r-1), phi(p+1,q+1,r-1)-phi(p+1,q,r-1), g) )
-    +wz1*( wx0*lerp(phi(p-1,q,r  )-phi(p-1,q-1,r  ), phi(p-1,q+1,r  )-phi(p-1,q,r  ), g)
-          +wx1*lerp(phi(p,  q,r  )-phi(p,  q-1,r  ), phi(p,  q+1,r  )-phi(p,  q,r  ), g)
-          +wx2*lerp(phi(p+1,q,r  )-phi(p+1,q-1,r  ), phi(p+1,q+1,r  )-phi(p+1,q,r  ), g) )
-    +wz2*( wx0*lerp(phi(p-1,q,r+1)-phi(p-1,q-1,r+1), phi(p-1,q+1,r+1)-phi(p-1,q,r+1), g)
-          +wx1*lerp(phi(p,  q,r+1)-phi(p,  q-1,r+1), phi(p,  q+1,r+1)-phi(p,  q,r+1), g)
-          +wx2*lerp(phi(p+1,q,r+1)-phi(p+1,q-1,r+1), phi(p+1,q+1,r+1)-phi(p+1,q,r+1), g) );
-    
-    grad[2]=wx0*( wy0*lerp(phi(p-1,q-1,r)-phi(p-1,q-1,r-1), phi(p-1,q-1,r+1)-phi(p-1,q-1,r), h)
-                 +wy1*lerp(phi(p-1,q,  r)-phi(p-1,q,  r-1), phi(p-1,q,  r+1)-phi(p-1,q,  r), h)
-                 +wy2*lerp(phi(p-1,q+1,r)-phi(p-1,q+1,r-1), phi(p-1,q+1,r+1)-phi(p-1,q+1,r), h) )
-    +wx1*( wy0*lerp(phi(p,  q-1,r)-phi(p,  q-1,r-1), phi(p,  q-1,r+1)-phi(p,  q-1,r), h)
-          +wy1*lerp(phi(p,  q,  r)-phi(p,  q,  r-1), phi(p,  q,  r+1)-phi(p,  q,  r), h)
-          +wy2*lerp(phi(p,  q+1,r)-phi(p,  q+1,r-1), phi(p,  q+1,r+1)-phi(p,  q+1,r), h) )
-    +wx2*( wy0*lerp(phi(p+1,q-1,r)-phi(p+1,q-1,r-1), phi(p+1,q-1,r+1)-phi(p+1,q-1,r), h)
-          +wy1*lerp(phi(p+1,q,  r)-phi(p+1,q,  r-1), phi(p+1,q,  r+1)-phi(p+1,q,  r), h)
-          +wy2*lerp(phi(p+1,q+1,r)-phi(p+1,q+1,r-1), phi(p+1,q+1,r+1)-phi(p+1,q+1,r), h) );
-    
-}
-
-void MarchingTilesHiRes::
-contour_tile(size_t i, size_t j, size_t k)
-{
-    Vec3i cell((int)(4*i),(int)(4*j),(int)(4*k)); // coordinates on the acute lattice, not the grid for phi
-    for(int t=0; t<num_tets; ++t){
-        int a, b, c, d; assign(tet[t], a, b, c, d);
-        contour_tet(cell+node[a], cell+node[b], cell+node[c], cell+node[d],
-                    eval(0.25f*(cell[0]+node[a][0]), 0.25f*(cell[1]+node[a][1]), 0.25f*(cell[2]+node[a][2])),
-                    eval(0.25f*(cell[0]+node[b][0]), 0.25f*(cell[1]+node[b][1]), 0.25f*(cell[2]+node[b][2])),
-                    eval(0.25f*(cell[0]+node[c][0]), 0.25f*(cell[1]+node[c][1]), 0.25f*(cell[2]+node[c][2])),
-                    eval(0.25f*(cell[0]+node[d][0]), 0.25f*(cell[1]+node[d][1]), 0.25f*(cell[2]+node[d][2])));
-    }
-}
-
-// contour the tet with given grid point vertices and function values
-// --- corners arranged so that 0-1-2 uses right-hand-rule to get to 3
-void MarchingTilesHiRes::
-contour_tet(const Vec3i& x0, const Vec3i& x1, const Vec3i& x2, const Vec3i& x3, double p0, double p1, double p2, double p3)
-{
-    // guard against topological degeneracies
-    if(p0==0) p0=1e-30f;
-    if(p1==0) p1=1e-30f;
-    if(p2==0) p2=1e-30f;
-    if(p3==0) p3=1e-30f;
-    
-    if(p0<0){
-        if(p1<0){
-            if(p2<0){
-                if(p3<0){
-                    return; // no contour here
-                }else // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x2,x3,p2,p3)));
-            }else{ // p2>=0
-                if(p3<0)
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x3,x2,p3,p2),
-                                         find_edge_cross(x1,x2,p1,p2)));
-                else{ // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x0,x2,p0,p2)));
-                    tri.push_back(Vec3ui(find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x1,x2,p1,p2),
-                                         find_edge_cross(x0,x2,p0,p2)));
-                }
-            }
-        }else{ // p1>=0
-            if(p2<0){
-                if(p3<0)
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x2,x1,p2,p1),
-                                         find_edge_cross(x3,x1,p3,p1)));
-                else{ // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x2,x3,p2,p3)));
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x2,x1,p2,p1),
-                                         find_edge_cross(x2,x3,p2,p3)));
-                }
-            }else{ // p2>=0
-                if(p3<0){
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x3,x2,p3,p2)));
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x3,x2,p3,p2),
-                                         find_edge_cross(x3,x1,p3,p1)));
-                }else // p3>=_0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x0,x3,p0,p3)));
-            }
-        }
-    }else{ // p0>=0
-        if(p1<0){
-            if(p2<0){
-                if(p3<0)
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x0,x2,p0,p2)));
-                else{ // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x3,x1,p3,p1),
-                                         find_edge_cross(x3,x2,p3,p2)));
-                    tri.push_back(Vec3ui(find_edge_cross(x3,x2,p3,p2),
-                                         find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x0,x1,p0,p1)));
-                }
-            }else{ // p2>=0
-                if(p3<0){
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x3,x2,p3,p2)));
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x1,p0,p1),
-                                         find_edge_cross(x3,x2,p3,p2),
-                                         find_edge_cross(x2,x1,p2,p1)));
-                }else // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x1,x0,p1,p0),
-                                         find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x1,x2,p1,p2)));
-            }
-        }else{ // p1>=0
-            if(p2<0){
-                if(p3<0){
-                    tri.push_back(Vec3ui(find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x0,x2,p0,p2)));
-                    tri.push_back(Vec3ui(find_edge_cross(x1,x3,p1,p3),
-                                         find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x1,x2,p1,p2)));
-                }else // p3>=0
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x2,p0,p2),
-                                         find_edge_cross(x1,x2,p1,p2),
-                                         find_edge_cross(x3,x2,p3,p2)));
-            }else{ // p2>=0
-                if(p3<0)
-                    tri.push_back(Vec3ui(find_edge_cross(x0,x3,p0,p3),
-                                         find_edge_cross(x2,x3,p2,p3),
-                                         find_edge_cross(x1,x3,p1,p3)));
-                else{ // p3>=0
-                    return; // assume no degenerate cases (where some of the p's are zero)
-                }
-            }
-        }
-    }
-}
-
-// return the vertex of the edge crossing (create it if necessary) between given grid points and function values
-int MarchingTilesHiRes::
-find_edge_cross(const Vec3i& x0, const Vec3i& x1, double p0, double p1)
-{
-    unsigned int vertex_index;
-    if(edge_cross.get_entry(Vec6i(x0.v[0], x0.v[1], x0.v[2], x1.v[0], x1.v[1], x1.v[2]), vertex_index)){
-        return vertex_index;
-    }else if(edge_cross.get_entry(Vec6i(x1.v[0], x1.v[1], x1.v[2], x0.v[0], x0.v[1], x0.v[2]), vertex_index)){
-        return vertex_index;
-    }else{
-        double a=p1/(p1-p0), b=1-a;
-        vertex_index=(int)x.size();
-        x.push_back(Vec3d(origin[0]+dx*0.25f*(a*x0[0]+b*x1[0]),
-                          origin[1]+dx*0.25f*(a*x0[1]+b*x1[1]),
-                          origin[2]+dx*0.25f*(a*x0[2]+b*x1[2])));
-        edge_cross.add(Vec6i(x0.v[0], x0.v[1], x0.v[2], x1.v[0], x1.v[1], x1.v[2]), vertex_index);
-        return vertex_index;
-    }
-}
-
diff --git a/extern/eltopo/common/marching_tiles_hires.h b/extern/eltopo/common/marching_tiles_hires.h
deleted file mode 100644
index 98a2889..0000000
--- a/extern/eltopo/common/marching_tiles_hires.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef MARCHING_TILES_HIRES_H
-#define MARCHING_TILES_HIRES_H
-
-#include <array3.h>
-#include <hashtable.h>
-#include <vec.h>
-
-struct MarchingTilesHiRes
-{
-    std::vector<Vec3ui> tri;
-    std::vector<Vec3d> x;
-    std::vector<Vec3d> normal;
-    Vec3d origin;
-    double dx;
-    const Array3d& phi;
-    
-    MarchingTilesHiRes(const Vec3d &origin_, double dx_, const Array3d& phi_) : 
-    tri(0), x(0), normal(0),
-    origin(origin_), dx(dx_), phi(phi_),
-    edge_cross()
-    {}
-    
-    void contour(void);
-    void improve_mesh(void);
-    void estimate_normals(void);
-    
-private:
-    HashTable<Vec6i,unsigned int> edge_cross; // stores vertices that have been created already at given edge crossings
-    
-    double eval(double i, double j, double k); // interpolate if non-integer coordinates given
-    void eval_gradient(double i, double j, double k, Vec3d& grad);
-    void contour_tile(size_t i, size_t j, size_t k); // add triangles for contour in the given tile (starting at grid point (4*i,4*j,4*k))
-    void contour_tet(const Vec3i& x0, const Vec3i& x1, const Vec3i& x2, const Vec3i& x3, double p0, double p1, double p2, double p3);
-    int find_edge_cross(const Vec3i& x0, const Vec3i& x1, double p0, double p1);
-};
-
-#endif
diff --git a/extern/eltopo/common/marching_triangles.cpp b/extern/eltopo/common/marching_triangles.cpp
deleted file mode 100644
index 0f77faa..0000000
--- a/extern/eltopo/common/marching_triangles.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "marching_triangles.h"
-
-void MarchingTriangles::
-contour_grid(void)
-{
-   edge.resize(0);
-   x.resize(0);
-   edge_cross.clear();
-   for(int j=0; j+1<phi.nj; ++j) for(int i=0; i+1<phi.ni; ++i)
-      contour_square(i,j);
-}
-
-void MarchingTriangles::
-contour_square(int i, int j)
-{
-   contour_triangle(Vec2i(i,j), Vec2i(i+1,j), Vec2i(i+1,j+1), phi(i,j), phi(i+1,j), phi(i+1,j+1));
-   contour_triangle(Vec2i(i,j), Vec2i(i+1,j+1), Vec2i(i,j+1), phi(i,j), phi(i+1,j+1), phi(i,j+1));
-}
-
-// assumes triangle is oriented counterclockwise
-void MarchingTriangles::
-contour_triangle(const Vec2i& x0, const Vec2i& x1, const Vec2i& x2, float p0, float p1, float p2)
-{
-   // guard against topological degeneracies
-   if(p0==0) p0=1e-30f;
-   if(p1==0) p1=1e-30f;
-   if(p2==0) p2=1e-30f;
-
-   if(p0<0){
-      if(p1<0){
-         if(p2<0) return; // no contour here
-         else /* p2>0 */ edge.push_back(Vec2i(find_edge_cross(x1,x2,p1,p2), find_edge_cross(x0,x2,p0,p2)));
-      }else{ // p1>0
-         if(p2<0)        edge.push_back(Vec2i(find_edge_cross(x0,x1,p0,p1), find_edge_cross(x1,x2,p1,p2)));
-         else /* p2>0 */ edge.push_back(Vec2i(find_edge_cross(x0,x1,p0,p1), find_edge_cross(x0,x2,p0,p2)));
-      }
-   }else{ // p0>0
-      if(p1<0){
-         if(p2<0)        edge.push_back(Vec2i(find_edge_cross(x0,x2,p0,p2), find_edge_cross(x0,x1,p0,p1)));
-         else /* p2>0 */ edge.push_back(Vec2i(find_edge_cross(x1,x2,p1,p2), find_edge_cross(x0,x1,p0,p1)));
-      }else{ // p1>0
-         if(p2<0)        edge.push_back(Vec2i(find_edge_cross(x0,x2,p0,p2), find_edge_cross(x1,x2,p1,p2)));
-         else /* p2>0 */ return; // no contour here
-      }
-   }
-}
-
-// return the vertex of the edge crossing (create it if necessary) between given grid points and function values
-int MarchingTriangles::
-find_edge_cross(const Vec2i& x0, const Vec2i& x1, float p0, float p1)
-{
-   unsigned int vertex_index;
-   if(edge_cross.get_entry(Vec4i(x0.v[0], x0.v[1], x1.v[0], x1.v[1]), vertex_index)){
-      return vertex_index;
-   }else if(edge_cross.get_entry(Vec4i(x1.v[0], x1.v[1], x0.v[0], x0.v[1]), vertex_index)){
-      return vertex_index;
-   }else{
-      float a=p1/(p1-p0), b=1-a;
-      vertex_index=(int)x.size();
-      x.push_back(Vec2f(origin[0]+dx*(a*x0[0]+b*x1[0]),
-                        origin[1]+dx*(a*x0[1]+b*x1[1])));
-      edge_cross.add(Vec4i(x0.v[0], x0.v[1], x1.v[0], x1.v[1]), vertex_index);
-      return vertex_index;
-   }
-}
-
diff --git a/extern/eltopo/common/marching_triangles.h b/extern/eltopo/common/marching_triangles.h
deleted file mode 100644
index 2c59683..0000000
--- a/extern/eltopo/common/marching_triangles.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef MARCHING_TRIANGLES_H
-#define MARCHING_TRIANGLES_H
-
-#include "array2.h"
-#include "hashtable.h"
-#include "vec.h"
-
-struct MarchingTriangles
-{
-   std::vector<Vec2i> edge;
-   std::vector<Vec2f> x;
-   Vec2f origin;
-   float dx;
-   Array2f phi;
-
-   explicit MarchingTriangles(float dx_=1)
-      : origin(0), dx(dx_)
-   {}
-
-   explicit MarchingTriangles(const Vec2f &origin_, float dx_=1)
-      : origin(origin_), dx(dx_)
-   {}
-
-   void contour_grid(void);
-
-   private:
-   HashTable<Vec4i,unsigned int> edge_cross; // stores vertices that have been created already at given edge crossings
-   void contour_square(int i, int j); // add triangles for contour in the given grid square (i,j) to (i+1,j+1)
-   void contour_triangle(const Vec2i& x0, const Vec2i& x1, const Vec2i& x2, float p0, float p1, float p2);
-   int find_edge_cross(const Vec2i& x0, const Vec2i& x1, float p0, float p1);
-};
-
-#endif
diff --git a/extern/eltopo/common/mat.h b/extern/eltopo/common/mat.h
deleted file mode 100644
index 7fcfb87..0000000
--- a/extern/eltopo/common/mat.h
+++ /dev/null
@@ -1,478 +0,0 @@
-#ifndef MAT_H
-#define MAT_H
-
-#include <cstring>
-#include <vec.h>
-
-template<unsigned int M, unsigned int N, class T>
-struct Mat
-{
-    T a[M*N]; // entries stored column by column (FORTRAN layout)
-    
-    Mat<M,N,T>(void)
-    {}
-    
-    template<class S>
-    Mat<M,N,T>(const S *source)
-    {
-        for(unsigned int i=0; i<M*N; ++i) a[i]=source[i];
-    }
-    
-    Mat<M,N,T>(T a0, T a1, T a2, T a3)
-    {
-        assert(M*N==4);
-        a[0]=a0; a[1]=a1; a[2]=a2; a[3]=a3;
-    }
-    
-    Mat<M,N,T>(T a0, T a1, T a2, T a3, T a4, T a5)
-    {
-        assert(M*N==6);
-        a[0]=a0; a[1]=a1; a[2]=a2; a[3]=a3; a[4]=a4; a[5]=a5;
-    }
-    
-    Mat<M,N,T>(T a0, T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8)
-    {
-        assert(M*N==9);
-        a[0]=a0; a[1]=a1; a[2]=a2; a[3]=a3; a[4]=a4; a[5]=a5; a[6]=a6; a[7]=a7; a[8]=a8;
-    }
-    
-    Mat<M,N,T>(const Vec<M,T> &col0, const Vec<M,T> &col1)
-    {
-        assert(N==2);
-        setcol(0,col0); setcol(1,col1);
-    }
-    
-    Mat<M,N,T>(const Vec<M,T> &col0, const Vec<M,T> &col1, const Vec<M,T> &col2)
-    {
-        assert(N==3);
-        setcol(0,col0); setcol(1,col1); setcol(2,col2);
-    }
-    
-    Mat<M,N,T>(const Vec<M,T> &col0, const Vec<M,T> &col1, const Vec<M,T> &col2, const Vec<M,T> &col3)
-    {
-        assert(N==4);
-        setcol(0,col0); setcol(1,col1); setcol(2,col2); setcol(3,col3);
-    }
-    
-    T &operator()(int i, int j)
-    {
-        assert(0<=i && (unsigned int)i<M && 0<=j && (unsigned int)j<N);
-        return a[i+M*j];
-    }
-    
-    const T &operator()(int i, int j) const
-    {
-        assert(0<=i && (unsigned int)i<M && 0<=j && (unsigned int)j<N);
-        return a[i+M*j];
-    }
-    
-    Vec<M,T> col(int j) const
-    {
-        assert(0<=j && (unsigned int)j<N);
-        return Vec<M,T>(a+j*M);
-    }
-    
-    Vec<N,T> row(int i) const
-    {
-        assert(0<=i && i<M);
-        Vec<N,T> v;
-        for(unsigned int j=0; j<N; ++j) v[j]=a(i,j);
-        return v;
-    }
-    
-    Mat<M,N,T> operator+=(const Mat<M,N,T> &b)
-    {
-        for(unsigned int i=0; i<M*N; ++i) a[i]+=b.a[i];
-        return *this;
-    }
-    
-    Mat<M,N,T> operator+(const Mat<M,N,T> &b) const
-    {
-        Mat<M,N,T> sum(*this);
-        sum+=b;
-        return sum;
-    }
-    
-    Mat<M,N,T> operator-=(const Mat<M,N,T> &b)
-    {
-        for(unsigned int i=0; i<M*N; ++i) a[i]-=b.a[i];
-        return *this;
-    }
-    
-    Mat<M,N,T> operator-(const Mat<M,N,T> &b) const
-    {
-        Mat<M,N,T> diff(*this);
-        diff-=b;
-        return diff;
-    }
-    
-    Mat<M,N,T> operator*=(T scalar)
-    {
-        for(unsigned int i=0; i<M*N; ++i) a[i]*=scalar;
-        return *this;
-    }
-    
-    Mat<M,N,T> operator*(T scalar) const
-    {
-        Mat<M,N,T> b(*this);
-        b*=scalar;
-        return b;
-    }
-    
-    Vec<M,T> operator*(const Vec<N,T> v) const
-    {
-        Vec<M,T> r;
-        unsigned int i, j;
-        const T *pa, *pv;
-        T s, *pr=r.v;
-        for(i=0; i<M; ++i, ++pr){
-            pa=a+i;
-            pv=v.v;
-            s=0;
-            for(j=0; j<N; ++j, pa+=M, ++pv)
-                s+=*pa*(*pv);
-            *pr=s;
-        }
-        return r;
-    }
-    
-    template<unsigned int P>
-    Mat<M,P,T> operator*(const Mat<N,P,T> b) const
-    {
-        Mat<M,P,T> c;
-        unsigned int i, j, k;
-        const T *pa, *pb;
-        T s, *pc=c.a;
-        for(k=0; k<P; ++k){
-            for(i=0; i<M; ++i, ++pc){
-                pa=a+i;
-                pb=b.a+N*k;
-                s=0;
-                for(j=0; j<N; ++j, pa+=M, ++pb)
-                    s+=*pa*(*pb);
-                *pc=s;
-            }
-        }
-        return c;
-    }
-    
-    Mat<M,N,T> operator/=(T scalar)
-    {
-        for(unsigned int i=0; i<M*N; ++i) a[i]/=scalar;
-        return *this;
-    }
-    
-    Mat<M,N,T> operator/(T scalar) const
-    {
-        Mat<M,N,T> b(*this);
-        b/=scalar;
-        return b;
-    }
-    
-    Mat<N,M,T> transpose() const {
-        Mat<N,M,T> result;
-        
-        for(unsigned int i = 0; i < M; ++i) {
-            for(unsigned int j = 0; j < N; ++j) {
-                result(j,i) = (*this)(i,j);
-            }
-        }
-        return result;
-    }
-};
-
-typedef Mat<2,2,double> Mat22d;
-typedef Mat<2,2,float>  Mat22f;
-typedef Mat<2,2,int>    Mat22i;
-typedef Mat<3,2,double> Mat32d;
-typedef Mat<3,2,float>  Mat32f;
-typedef Mat<3,2,int>    Mat32i;
-typedef Mat<2,3,double> Mat23d;
-typedef Mat<2,3,float>  Mat23f;
-typedef Mat<2,3,int>    Mat23i;
-typedef Mat<3,3,double> Mat33d;
-typedef Mat<3,3,float>  Mat33f;
-typedef Mat<3,3,int>    Mat33i;
-typedef Mat<4,4,double> Mat44d;
-typedef Mat<4,4,float>  Mat44f;
-typedef Mat<4,4,int>    Mat44i;
-
-// more for human eyes than a good machine-readable format
-template<unsigned int M, unsigned int N, class T>
-std::ostream &operator<<(std::ostream &out, const Mat<M,N,T> &a)
-{
-    for(unsigned int i=0; i<M; ++i){
-        out<<(i==0 ? '[' : ' ');
-        for(unsigned int j=0; j<N-1; ++j)
-            out<<a(i,j)<<',';
-        out<<a(i,N-1);
-        if(i<M-1) out<<';'<<std::endl;
-        else out<<']';
-    }
-    return out;
-}
-
-template<unsigned int M, unsigned int N, class T>
-inline Mat<M,N,T> operator*(T scalar, const Mat<M,N,T> &a)
-{
-    Mat<M,N,T> b(a);
-    b*=scalar;
-    return b;
-}
-
-template<unsigned int M, unsigned int N, class T>
-inline Mat<M,N,T> outer(const Vec<M,T> &x, const Vec<N,T> &y)
-{
-    Mat<M,N,T> r;
-    T *pr=r.a;
-    for(unsigned int j=0; j<N; ++j)
-        for(unsigned int i=0; i<M; ++i, ++pr)
-            *pr=x[i]*y[j];
-    return r;
-}
-
-template<unsigned int M, unsigned int N, class T>
-inline void zero(Mat<M,N,T>& mat) {
-    std::memset(mat.a, 0, N*M*sizeof(T));
-}
-
-template<unsigned int N, class T>
-inline void make_identity(Mat<N,N,T>& mat)
-{
-    std::memset(mat.a, 0, N*N*sizeof(T));
-    for(unsigned int i=0; i<N; ++i)
-        mat.a[(N+1)*i]=1;
-}
-
-template<unsigned int N, class T>
-inline T trace(Mat<N,N,T>& mat)
-{
-    T t=0;
-    for(unsigned int i=0; i<N; ++i)
-        t+=mat.a[(N+1)*i];
-    return t;
-}
-
-template<class T>
-inline Mat<3,3,T> star_matrix(const Vec<3,T> &w)
-{
-    return Mat<3,3,T>(0, -w.v[2], w.v[1],
-                      w.v[2], 0, -w.v[0],
-                      -w.v[1], w.v[0], 0);
-}
-
-// determine rotation Q and symmetrix matrix A so that Q*A=F
-template<class T>
-void signed_polar_decomposition(const Mat<2,2,T>& F, Mat<2,2,T>& Q, Mat<2,2,T>& A)
-{
-    T s=F(0,1)-F(1,0);
-    if(s){
-        T c=F(0,0)+F(1,1), hyp=std::sqrt(c*c+s*s);
-        if(c>0){ c/=hyp; s/=hyp; }
-        else{ c/=-hyp; s/=-hyp; }
-        Q(0,0)=c; Q(0,1)=s; Q(1,0)=-s; Q(1,1)=c;
-        A(0,0)=c*F(0,0)-s*F(1,0);
-        A(1,0)=A(0,1)=s*F(0,0)+c*F(1,0);
-        A(1,1)=s*F(0,1)+c*F(1,1);
-    }else{ // F is already symmetric: no rotation needed
-        Q(0,0)=1; Q(0,1)=0; Q(1,0)=0; Q(1,1)=1;
-        A=F;
-    }
-}
-
-// for symmetric A, determine c and s for rotation Q and diagonal matrix D so that Q'*A*Q=D
-// (D sorted, with |D[0]|>=|D[1]|; the upper triangular entry of A is ignored)
-template<class T>
-void symmetric_eigenproblem(const Mat<2,2,T>& A, T& c, T& s, Vec<2,T>& D)
-{
-    s=2*A(1,0);
-    if(s==0){ // already diagonal
-        c=1;
-        D[0]=A(0,0); D[1]=A(1,1);
-    }else{
-        T d=A(0,0)-A(1,1);
-        T disc=std::sqrt(d*d+s*s);
-        c=d+(d>0 ? disc : -disc);
-        T hyp=std::sqrt(c*c+s*s);
-        c/=hyp; s/=hyp;
-        // there is probably a better way of computing these (more stable etc.)
-        D[0]=c*c*A(0,0)+2*c*s*A(1,0)+s*s*A(1,1);
-        D[1]=s*s*A(0,0)-2*c*s*A(1,0)+c*c*A(1,1);
-    }
-    if(std::fabs(D[0])<std::fabs(D[1])){ // if D is in the wrong order, fix it
-        std::swap(D[0], D[1]);
-        c=-c;
-        std::swap(c, s);
-    }
-    if(c<0){ c=-c; s=-s; }
-}
-
-template<class T>
-inline T determinant(const Mat<3,3,T> &mat)
-{
-    return mat(0,0)*(mat(2,2)*mat(1,1)-mat(2,1)*mat(1,2))-
-    mat(1,0)*(mat(2,2)*mat(0,1)-mat(2,1)*mat(0,2))+
-    mat(2,0)*(mat(1,2)*mat(0,1)-mat(1,1)*mat(0,2));
-}
-
-// for symmetric A, determine rotation Q and diagonal matrix D so that Q'*A*Q=D
-// (D not sorted! and the upper triangular entry is ignored)
-template<class T>
-void symmetric_eigenproblem(const Mat<2,2,T>& A, Mat<2,2,T>& Q, Vec<2,T>& D)
-{
-    T c, s;
-    symmetric_eigenproblem(A, c, s, D);
-    Q(0,0)=c; Q(1,0)=s; Q(0,1)=-s; Q(1,1)=c;
-}
-
-// figures out A=U*S*V' with U and V rotations, S diagonal
-// (S is sorted by magnitude, and may contain both positive and negative entries)
-template<class T>
-void signed_svd(const Mat<2,2,T>& A, Mat<2,2,T>& U, Mat<2,2,T>& V, Vec<2,T>& S)
-{
-    Vec<2,T> D;
-    symmetric_eigenproblem(Mat<2,2,T>(sqr(A(0,0))+sqr(A(0,1)),
-                                      A(0,0)*A(1,0)+A(0,1)*A(1,1),
-                                      0, // ignored by routine, so we don't need to fill it in
-                                      sqr(A(1,0))+sqr(A(1,1))),
-                           U, D);
-    // form F=A'*U 
-    T f00=A(0,0)*U(0,0)+A(1,0)*U(1,0),
-    f10=A(0,1)*U(0,0)+A(1,1)*U(1,0),
-    f01=A(0,0)*U(0,1)+A(1,0)*U(1,1),
-    f11=A(0,1)*U(0,1)+A(1,1)*U(1,1);
-    // do signed polar decomposition of F to get V
-    T s=f01-f10, c;
-    if(s){
-        c=f00+f11;
-        T hyp=std::sqrt(c*c+s*s);
-        if(c>0){ c/=hyp; s/=hyp; }
-        else{ c/=-hyp; s/=-hyp; }
-    }else
-        c=1;
-    V(0,0)=c; V(0,1)=s; V(1,0)=-s; V(1,1)=c;
-    // and finally grab the singular values from direct computation (maybe there's a better way?)
-    S[0]=(U(0,0)*A(0,0)+U(1,0)*A(1,0))*V(0,0) + (U(0,0)*A(0,1)+U(1,0)*A(1,1))*V(1,0);
-    S[1]=(U(0,1)*A(0,0)+U(1,1)*A(1,0))*V(0,1) + (U(0,1)*A(0,1)+U(1,1)*A(1,1))*V(1,1);
-}
-
-// 3x3 version: Get the A=QR decomposition using Householder reflections
-template<class T>
-void find_QR(const Mat<3,3,T>& A, Mat<3,3,T>& Q, Mat<3,3,T>& R)
-{
-    Q(0,0)=1; Q(0,1)=0; Q(0,2)=0;
-    Q(1,0)=0; Q(1,1)=1; Q(1,2)=0;
-    Q(2,0)=0; Q(2,1)=0; Q(2,2)=1;
-    R=A;
-    Vec<3,T> u;
-    T n2, u2, n, c, d;
-    
-    // first column
-    n2=sqr(R(0,0))+sqr(R(1,0))+sqr(R(2,0));
-    u[0]=R(0,0); u[1]=R(1,0); u[2]=R(2,0); // will change u[0] in a moment
-    u2=sqr(u[1])+sqr(u[2]); // will add in sqr(u[0]) when we know it
-    R(1,0)=0; R(2,0)=0;
-    if(u2){ // if there are entries to annihilate below the diagonal in this column
-        n=std::sqrt(n2);
-        u[0]+=(u[0]>0 ? n : -n);
-        u2+=sqr(u[0]);
-        c=2/u2;
-        // update diagonal entrt of R
-        R(0,0)=(u[0]>0 ? -n : n);
-        // update rest of R with reflection
-        // second column
-        d=c*(u[0]*R(0,1)+u[1]*R(1,1)+u[2]*R(2,1));
-        R(0,1)-=d*u[0]; R(1,1)-=d*u[1]; R(2,1)-=d*u[2];
-        // third column
-        d=c*(u[0]*R(0,2)+u[1]*R(1,2)+u[2]*R(2,2));
-        R(0,2)-=d*u[0]; R(1,2)-=d*u[1]; R(2,2)-=d*u[2];
-        // set Q to this symmetric reflection
-        Q(0,0)-=c*u[0]*u[0]; Q(0,1)-=c*u[0]*u[1]; Q(0,2)-=c*u[0]*u[2];
-        Q(1,0)=Q(0,1);       Q(1,1)-=c*u[1]*u[1]; Q(1,2)-=c*u[1]*u[2];
-        Q(2,0)=Q(0,2);       Q(2,1)=Q(1,2);       Q(2,2)-=c*u[2]*u[2];
-    }else{
-        // still do a reflection around (1,0,0), since we want there to be exactly two reflections (to get back to rotation)
-        R(0,0)=-R(0,0); R(0,1)=-R(0,1); R(0,2)=-R(0,2);
-        Q(0,0)=-1;
-    }
-    
-    // second column
-    n2=sqr(R(1,1))+sqr(R(2,1));
-    u[1]=R(1,1); u[2]=R(2,1); // will change u[1] in a moment
-    u2=sqr(u[2]); // will add in sqr(u[1]) when we know it
-    R(2,1)=0;
-    if(u2){ // if there are entries to annihilate below the diagonal in this column
-        n=std::sqrt(n2);
-        u[1]+=(u[1]>0 ? n : -n);
-        u2+=sqr(u[1]);
-        c=2/u2;
-        // update diagonal entrt of R
-        R(1,1)=(u[1]>0 ? -n : n);
-        // update rest of R with reflection
-        // third column
-        d=c*(u[1]*R(1,2)+u[2]*R(2,2));
-        R(1,2)-=d*u[1]; R(2,2)-=d*u[2];
-        // update Q by right multiplication with the reflection
-        d=c*(Q(0,1)*u[1]+Q(0,2)*u[2]); Q(0,1)-=d*u[1]; Q(0,2)-=d*u[2]; // row 0
-        d=c*(Q(1,1)*u[1]+Q(1,2)*u[2]); Q(1,1)-=d*u[1]; Q(1,2)-=d*u[2]; // row 1
-        d=c*(Q(2,1)*u[1]+Q(2,2)*u[2]); Q(2,1)-=d*u[1]; Q(2,2)-=d*u[2]; // row 2
-    }else{
-        // still need to multiply in a reflection around (0,1,0), to get Q back to being a rotation
-        R(1,1)=-R(1,1); R(1,2)=-R(1,2);
-        Q(0,1)=-Q(0,1); Q(1,1)=-Q(1,1); Q(2,1)=-Q(2,1);
-    }
-    
-    // flip back some signs to be closer to A
-    R(0,0)=-R(0,0); R(0,1)=-R(0,1); R(0,2)=-R(0,2);
-    R(1,1)=-R(1,1); R(1,2)=-R(1,2);
-    Q(0,0)=-Q(0,0); Q(0,1)=-Q(0,1);
-    Q(1,0)=-Q(1,0); Q(1,1)=-Q(1,1);
-    Q(2,0)=-Q(2,0); Q(2,1)=-Q(2,1);
-}
-
-// Specialization for 2xN case: use a Givens rotation
-template<unsigned int N, class T>
-void find_QR(const Mat<2,N,T>& A, Mat<2,N,T>& Q, Mat<2,N,T>& R)
-{
-    T c=A(0,0), s=A(1,0), hyp=std::sqrt(c*c+s*s);
-    if(hyp){
-        c/=hyp;
-        s/=hyp;
-        Q(0,0)=c; Q(1,0)=s; Q(0,1)=-s; Q(1,1)=c;
-        R(0,0)=hyp; R(1,0)=0;
-        for(unsigned int j=1; j<N; ++j){
-            R(0,j)=c*A(0,j)+s*A(1,j);
-            R(1,j)=-s*A(0,j)+c*A(1,j);
-        }
-    }else{
-        Q(0,0)=1; Q(1,0)=0; Q(0,1)=0; Q(1,1)=1;
-        R=A;
-    }
-}
-
-
-template<class T>
-inline Mat<2,2,T> inverse(const Mat<2,2,T> &mat)
-{
-    const T& a = mat(0,0);
-    const T& b = mat(0,1);
-    const T& c = mat(1,0);
-    const T& d = mat(1,1);
-    
-    T invdet = 1.0 / ( a*d - b*c );
-    return Mat<2,2,T>( invdet*d, -invdet*c, -invdet*b, invdet*a );
-}
-
-
-template<class T>
-inline Mat<3,3,T> inverse(const Mat<3,3,T> &mat)
-{
-    T invdet = 1.0 / determinant(mat);
-    return Mat<3,3,T>(
-                      invdet*(mat(2,2)*mat(1,1)-mat(2,1)*mat(1,2)), -invdet*(mat(2,2)*mat(0,1)-mat(2,1)*mat(0,2)),  invdet*(mat(1,2)*mat(0,1)-mat(1,1)*mat(0,2)),
-                      -invdet*(mat(2,2)*mat(1,0)-mat(2,0)*mat(1,2)),  invdet*(mat(2,2)*mat(0,0)-mat(2,0)*mat(0,2)), -invdet*(mat(1,2)*mat(0,0)-mat(1,0)*mat(0,2)),
-                      invdet*(mat(2,1)*mat(1,0)-mat(2,0)*mat(1,1)), -invdet*(mat(2,1)*mat(0,0)-mat(2,0)*mat(0,1)),  invdet*(mat(1,1)*mat(0,0)-mat(1,0)*mat(0,1))
-                      );
-}
-
-#endif
diff --git a/extern/eltopo/common/matlapack.h b/extern/eltopo/common/matlapack.h
deleted file mode 100644
index 53c2f6a..0000000
--- a/extern/eltopo/common/matlapack.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef MATLAPACK_H
-#define MATLAPACK_H
-
-#include "lapack_wrapper.h"
-#include "mat.h"
-
-template<unsigned int M, unsigned int N, class T>
-void invert(Mat<M,N,T>& matrix) {
-	assert(M==N);
-    static int ipiv[M];
-	static T work[M];
-	int lwork = M;
-	int info;
-    
-	LAPACK::invert_general_matrix(M, matrix.a, M, ipiv, info);
-}
-
-
-template<unsigned int M, unsigned int N, class T>
-void least_squares(Mat<M,N,T>&matrix, Vec<M,T>&rhs) {
-    int info = 0;
-    LAPACK::solve_least_squares('N', M, N, 1, matrix.a, M, rhs.v, max(M,N), info);
-}
-#endif
diff --git a/extern/eltopo/common/meshes/Edge.hpp b/extern/eltopo/common/meshes/Edge.hpp
deleted file mode 100644
index 88dcb2e..0000000
--- a/extern/eltopo/common/meshes/Edge.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#ifndef EDGE__HPP
-#define EDGE__HPP
-
-#include <iostream>
-#include <fstream>
-
-
-#define EMPTY_VERTEX 500000000
-
-/*
-  class VertexIndex
-  {
-  private :
-  GLuint i;
-  public :
-  VertexIndex()
-  {
-  i = EMPTY_TRIANGLE;
-  }
-  
-  VertexIndex(const GLuint x) : i(x)
-  {
-  }
-
-  const GLuint getIndex() const
-  {
-  return i;
-  }
-
-  void setIndex(const GLuint x)
-  {
-  i = x;
-  }
-
-  const bool operator == (const VertexIndex& s) const
-  {
-  bool temp;
-  temp = (i == s.getIndex());
-  return temp;  
-  }
-
-  const bool operator != (const VertexIndex& s) const
-  {
-  return (!((*this) == s));
-  }
-
-  const bool operator < (const VertexIndex& s) const
-  {
-  bool temp;
-  temp = (i < s.getIndex());
-  return temp;  
-  }
-
-  // Ostream
-  friend std::ostream& operator << (std::ostream& out, const VertexIndex& s)
-  {
-  out << s.getIndex();
-  return out;
-  }
-  };
-*/
-
-/* This class defines a SORTED pair of int */
-
-class Edge
-{
-   std::pair<int, int> p;
-   
-public :
-  // Default constructor
-   Edge() : p() {}
-	
-  // Copy constructor
-  Edge(const Edge& s) : p( s.p.first, s.p.second )
-  {
-  }
-
-  // Constructor by parameters
-   Edge(int s1, int s2) : p()
-  {
-    if (s1 < s2)
-      {
-	p.first = s1;
-	p.second = s2;
-      }
-    else
-      {
-	p.first = s2;
-	p.second = s1;
-      }
-  }
-
-  const bool operator == (const Edge& s) const
-  {
-    bool temp;
-    temp = ((p.first == s.p.first) && (p.second == s.p.second));
-    return temp;  
-  }
-
-  const bool operator != (const Edge& s) const
-  {
-    return (!((*this) == s));  
-  }
-
-  // Operator <
-  const bool operator < (const Edge& s) const
-  {
-    bool temp;
-    temp = (((p.first < s.p.first))
-    	    || ((p.first == s.p.first) && (p.second < s.p.second)));
-    return temp;  
-  }
-  
-  
-  // ostream
-  friend std::ostream& operator << (std::ostream& out, const Edge& s)
-  {
-    out << "["<< s.p.first << ", " << s.p.second << "] ";
-    return out;
-  }
-};
-
-#endif
diff --git a/extern/eltopo/common/meshes/ObjLoader.cpp b/extern/eltopo/common/meshes/ObjLoader.cpp
deleted file mode 100644
index 483a337..0000000
--- a/extern/eltopo/common/meshes/ObjLoader.cpp
+++ /dev/null
@@ -1,2761 +0,0 @@
-/*    
-      glm.c
-
-      Nate Robins, 1997, 2000
-
-      nate at pobox.com, http://www.pobox.com/~nate
-
- 
-
-      Wavefront OBJ model file format reader/writer/manipulator.
-
-
-
-      Includes routines for generating smooth normals with
-
-      preservation of edges, welding redundant vertices & texture
-
-      coordinate generation (spheremap and planar projections) + more.
-
-  
-*/
-
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "ObjLoader.hpp"
-#include <iostream>
-//#include <QGLViewer/vec.h>
-#ifdef __APPLE__
-#include <GLUT/glut.h>
-#include <OpenGL/glu.h>
-#else
-#include <GL/glut.h>
-#include <GL/glu.h>
-#endif
-#include "vec.h"
-//#include <opengl_image.h>
-
-using namespace std;
-
-#define T(x) (model->triangles[(x)])
-
-
-/* _GLMnode: general purpose node */
-typedef struct _GLMnode {
-    GLuint         index;
-    GLboolean      averaged;
-    struct _GLMnode* next;
-} GLMnode;
-
-
-/* glmMax: returns the maximum of two floats */
-static GLfloat
-glmMax(GLfloat a, GLfloat b) 
-{
-    if (b > a)
-        return b;
-    return a;
-}
-
-/* glmAbs: returns the absolute value of a float */
-static GLfloat
-glmAbs(GLfloat f)
-{
-    if (f < 0)
-        return -f;
-    return f;
-}
-
-/* glmDot: compute the dot product of two vectors
- *
- * u - array of 3 GLfloats (GLfloat u[3])
- * v - array of 3 GLfloats (GLfloat v[3])
- */
-static GLfloat
-glmDot(GLfloat* u, GLfloat* v)
-{
-    assert(u); assert(v);
-    
-    return u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
-}
-
-/* glmCross: compute the cross product of two vectors
- *
- * u - array of 3 GLfloats (GLfloat u[3])
- * v - array of 3 GLfloats (GLfloat v[3])
- * n - array of 3 GLfloats (GLfloat n[3]) to return the cross product in
- */
-static GLvoid
-glmCross(GLfloat* u, GLfloat* v, GLfloat* n)
-{
-    assert(u); assert(v); assert(n);
-    
-    n[0] = u[1]*v[2] - u[2]*v[1];
-    n[1] = u[2]*v[0] - u[0]*v[2];
-    n[2] = u[0]*v[1] - u[1]*v[0];
-}
-
-/* glmNormalize: normalize a vector
- *
- * v - array of 3 GLfloats (GLfloat v[3]) to be normalized
- */
-static GLvoid
-glmNormalize(GLfloat* v)
-{
-    GLfloat l;
-    
-    assert(v);
-    
-    l = (GLfloat)sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
-    v[0] /= l;
-    v[1] /= l;
-    v[2] /= l;
-}
-
-/* glmEqual: compares two vectors and returns GL_TRUE if they are
- * equal (within a certain threshold) or GL_FALSE if not. An epsilon
- * that works fairly well is 0.000001.
- *
- * u - array of 3 GLfloats (GLfloat u[3])
- * v - array of 3 GLfloats (GLfloat v[3]) 
- */
-static GLboolean
-glmEqual(GLfloat* u, GLfloat* v, GLfloat epsilon)
-{
-    if (glmAbs(u[0] - v[0]) < epsilon &&
-        glmAbs(u[1] - v[1]) < epsilon &&
-        glmAbs(u[2] - v[2]) < epsilon) 
-    {
-        return GL_TRUE;
-    }
-    return GL_FALSE;
-}
-
-/* glmWeldVectors: eliminate (weld) vectors that are within an
- * epsilon of each other.
- *
- * vectors     - array of GLfloat[3]'s to be welded
- * numvectors - number of GLfloat[3]'s in vectors
- * epsilon     - maximum difference between vectors 
- *
- */
-GLfloat*
-glmWeldVectors(GLfloat* vectors, GLuint* numvectors, GLfloat epsilon)
-{
-    GLfloat* copies;
-    GLuint   copied;
-    GLuint   i, j;
-    
-    copies = (GLfloat*)malloc(sizeof(GLfloat) * 3 * (*numvectors + 1));
-    memcpy(copies, vectors, (sizeof(GLfloat) * 3 * (*numvectors + 1)));
-    
-    copied = 1;
-    for (i = 1; i <= *numvectors; i++) {
-        for (j = 1; j <= copied; j++) {
-            if (glmEqual(&vectors[3 * i], &copies[3 * j], epsilon)) {
-                goto duplicate;
-            }
-        }
-        
-        /* must not be any duplicates -- add to the copies array */
-        copies[3 * copied + 0] = vectors[3 * i + 0];
-        copies[3 * copied + 1] = vectors[3 * i + 1];
-        copies[3 * copied + 2] = vectors[3 * i + 2];
-        j = copied;             /* pass this along for below */
-        copied++;
-        
-duplicate:
-/* set the first component of this vector to point at the correct
-        index into the new copies array */
-        vectors[3 * i + 0] = (GLfloat)j;
-    }
-    
-    *numvectors = copied-1;
-    return copies;
-}
-
-/* glmFindGroup: Find a group in the model */
-GLMgroup*
-glmFindGroup(GLMmodel* model, char* name)
-{
-    GLMgroup* group;
-    
-    assert(model);
-    
-    group = model->groups;
-    while(group) {
-        if (!strcmp(name, group->name))
-            break;
-        group = group->next;
-    }
-    
-    return group;
-}
-
-/* glmAddGroup: Add a group to the model */
-GLMgroup*
-glmAddGroup(GLMmodel* model, char* name)
-{
-    GLMgroup* group;
-    
-    group = glmFindGroup(model, name);
-    if (!group) {
-        group = (GLMgroup*)malloc(sizeof(GLMgroup));
-        group->name = strdup(name);
-        group->material = 0;
-        group->numtriangles = 0;
-        group->triangles = NULL;
-        group->next = model->groups;
-        model->groups = group;
-        model->numgroups++;
-    }
-    
-    return group;
-}
-
-/* glmFindGroup: Find a material in the model */
-GLuint
-glmFindMaterial(GLMmodel* model, char* name)
-{
-    GLuint i;
-    
-    /* XXX doing a linear search on a string key'd list is pretty lame,
-    but it works and is fast enough for now. */
-    for (i = 0; i < model->nummaterials; i++) {
-        if (!strcmp(model->materials[i].name, name))
-            goto found;
-    }
-    
-    /* didn't find the name, so print a warning and return the default
-    material (0). */
-    printf("glmFindMaterial():  can't find material \"%s\".\n", name);
-    i = 0;
-    
-found:
-    return i;
-}
-
-
-/* glmDirName: return the directory given a path
- *
- * path - filesystem path
- *
- * NOTE: the return value should be free'd.
- */
-static char*
-glmDirName(char* path)
-{
-    char* dir;
-    char* s;
-    
-    dir = strdup(path);
-    
-    s = strrchr(dir, '/');
-    if (s)
-        s[1] = '\0';
-    else
-        dir[0] = '\0';
-    
-    return dir;
-}
-
-/*   written by  M a r c  */
-#define MAX_TEXS 64
-
-int glmInitTex(char *name)
-{
-  static int idTexs[MAX_TEXS], nbTex=0;
-  static char nameTexs[MAX_TEXS][256];
-  for(int i=0;i<nbTex;i++)
-    {
-      // search if texture already loaded
-      if (!strcmp(nameTexs[i],name)){
-	return idTexs[i];
-      }
-    }
-  
-  int texWidth, texHeight;
-
-  GLubyte *image=glmReadPPM (name, &texWidth, &texHeight);
-
-  GLuint idOglTex;
-  if (image==(GLubyte*)NULL){
-    fprintf(stderr,"Sorry, map '%s' not found.\n", name);
-    return -1;
-  }
-  
-  fprintf(stderr,"glmInitTex map '%s' loaded (%dx%d).\n", name, texWidth, texHeight);
-  glGenTextures(1, &idOglTex );
-  glBindTexture(GL_TEXTURE_2D, idOglTex);	idTexs[nbTex]=(int)idOglTex;	nbTex++;
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-  //glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-  glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-  gluBuild2DMipmaps (GL_TEXTURE_2D,    // target: 2D texture
-		     3,                // 3 components (R, G, and B)
-		     texWidth,         // image width
-		     texHeight,        // image height
-		     GL_RGB,           // image format
-		     GL_UNSIGNED_BYTE, // format of data within image file
-		     (const void*)image);		// image file
-  fprintf(stderr,"glmInitTex finito. tex %d is %s\n", (int)idOglTex, name);
-  return (int)idOglTex;
-}
-
-void glmUseTex(int id){
-	// fprintf(stderr,"glmUseTex %d\n",id);
-	if (id>=0){
-		glBindTexture(GL_TEXTURE_2D, (GLuint)id);
-		glEnable(GL_TEXTURE_2D);
-	}
-}
-
-/* glmReadMTL: read a wavefront material library file
- *
- * model - properly initialized GLMmodel structure
- * name  - name of the material library
- */
-static GLvoid
-glmReadMTL(GLMmodel* model, char* name, GLuint texId)
-{
-  FILE* file;
-  char* dir;
-  char* filename;
-  char    buf[128];
-  GLuint nummaterials, i;
-    
-  dir = glmDirName(model->pathname);
-  filename = (char*)malloc(sizeof(char) * (strlen(dir) + strlen(name) + 1));
-  strcpy(filename, dir);
-  strcat(filename, name);
-  free(dir);
-    
-  file = fopen(filename, "r");
-  if (!file) {
-    fprintf(stderr, "glmReadMTL() failed: can't open material file \"%s\".\n",
-            filename);
-    exit(1);
-  }
-  free(filename);
-    
-  /* count the number of materials in the file */
-  nummaterials = 1;
-  while(fscanf(file, "%s", buf) != EOF) {
-    switch(buf[0]) {
-    case '#':               /* comment */
-      /* eat up rest of line */
-      fgets(buf, sizeof(buf), file);
-      break;
-    case 'n':               /* newmtl */
-      fgets(buf, sizeof(buf), file);
-      nummaterials++;
-      sscanf(buf, "%s %s", buf, buf);
-      break;
-    default:
-      /* eat up rest of line */
-      fgets(buf, sizeof(buf), file);
-      break;
-    }
-  }
-    
-  rewind(file);
-    
-  model->materials = (GLMmaterial*)malloc(sizeof(GLMmaterial) * nummaterials);
-  model->nummaterials = nummaterials;
-    
-  /* set the default material */
-  for (i = 0; i < nummaterials; i++) {
-    model->materials[i].name = NULL;
-    model->materials[i].shininess = 65.0f;
-    model->materials[i].diffuse[0] = 0.8f;
-    model->materials[i].diffuse[1] = 0.8f;
-    model->materials[i].diffuse[2] = 0.8f;
-    model->materials[i].diffuse[3] = 1.0f;
-    model->materials[i].ambient[0] = 0.2f;
-    model->materials[i].ambient[1] = 0.2f;
-    model->materials[i].ambient[2] = 0.2f;
-    model->materials[i].ambient[3] = 1.0f;
-    model->materials[i].specular[0] = 0.0f;
-    model->materials[i].specular[1] = 0.0f;
-    model->materials[i].specular[2] = 0.0f;
-    model->materials[i].specular[3] = 1.0f;
-  }
-  model->materials[0].name = strdup("default");
-    
-  /* now, read in the data */
-  nummaterials = 0;
-  while(fscanf(file, "%s", buf) != EOF) {
-    switch(buf[0]) {
-    case '#':               /* comment */
-      /* eat up rest of line */
-      fgets(buf, sizeof(buf), file);
-      break;
-    case 'n':               /* newmtl */
-      fgets(buf, sizeof(buf), file);
-      sscanf(buf, "%s %s", buf, buf);
-      nummaterials++;
-      model->materials[nummaterials].name = strdup(buf);
-      break;
-    case 'N':
-      fscanf(file, "%f", &model->materials[nummaterials].shininess);
-      /* wavefront shininess is from [0, 1000], so scale for OpenGL */
-      model->materials[nummaterials].shininess /= 1000.0f;
-      model->materials[nummaterials].shininess *= 128.0f;
-      break;
-      /*  M a r c  */
-    case 'M':
-    case 'm':
-      fgets(buf, sizeof(buf), file);
-      sscanf(buf, "%s %s", buf, buf);
-      //model->materials[nummaterials].idTex=glmInitTex(buf);
-      model->materials[nummaterials].idTex=texId;
-      break;
-    case 'K':
-      switch(buf[1]) {
-      case 'd':
-	fscanf(file, "%f %f %f",
-	       &model->materials[nummaterials].diffuse[0],
-	       &model->materials[nummaterials].diffuse[1],
-	       &model->materials[nummaterials].diffuse[2]);
-	break;
-      case 's':
-	fscanf(file, "%f %f %f",
-	       &model->materials[nummaterials].specular[0],
-	       &model->materials[nummaterials].specular[1],
-	       &model->materials[nummaterials].specular[2]);
-	break;
-      case 'a':
-	fscanf(file, "%f %f %f",
-	       &model->materials[nummaterials].ambient[0],
-	       &model->materials[nummaterials].ambient[1],
-	       &model->materials[nummaterials].ambient[2]);
-	break;
-      default:
-	/* eat up rest of line */
-	fgets(buf, sizeof(buf), file);
-	break;
-      }
-      break;
-    default:
-      /* eat up rest of line */
-      fgets(buf, sizeof(buf), file);
-      break;
-    }
-  }
-					 
-  fclose(file);
-}
-
-/* glmWriteMTL: write a wavefront material library file
- *
- * model   - properly initialized GLMmodel structure
- * modelpath  - pathname of the model being written
- * mtllibname - name of the material library to be written
- */
-static GLvoid
-glmWriteMTL(GLMmodel* model, char* modelpath, char* mtllibname)
-{
-    FILE* file;
-    char* dir;
-    char* filename;
-    GLMmaterial* material;
-    GLuint i;
-    
-    dir = glmDirName(modelpath);
-    filename = (char*)malloc(sizeof(char) * (strlen(dir)+strlen(mtllibname)));
-    strcpy(filename, dir);
-    strcat(filename, mtllibname);
-    free(dir);
-    
-    /* open the file */
-    file = fopen(filename, "w");
-    if (!file) {
-        fprintf(stderr, "glmWriteMTL() failed: can't open file \"%s\".\n",
-            filename);
-        exit(1);
-    }
-    free(filename);
-    
-    /* spit out a header */
-    fprintf(file, "#  \n");
-    fprintf(file, "#  Wavefront MTL generated by GLM library\n");
-    fprintf(file, "#  \n");
-    fprintf(file, "#  GLM library\n");
-    fprintf(file, "#  Nate Robins\n");
-    fprintf(file, "#  ndr at pobox.com\n");
-    fprintf(file, "#  http://www.pobox.com/~ndr\n");
-    fprintf(file, "#  \n\n");
-    
-    for (i = 0; i < model->nummaterials; i++) {
-        material = &model->materials[i];
-        fprintf(file, "newmtl %s\n", material->name);
-        fprintf(file, "Ka %f %f %f\n", 
-            material->ambient[0], material->ambient[1], material->ambient[2]);
-        fprintf(file, "Kd %f %f %f\n", 
-            material->diffuse[0], material->diffuse[1], material->diffuse[2]);
-        fprintf(file, "Ks %f %f %f\n", 
-            material->specular[0],material->specular[1],material->specular[2]);
-        fprintf(file, "Ns %f\n", material->shininess / 128.0 * 1000.0);
-        fprintf(file, "\n");
-    }
-}
-
-
-/* glmFirstPass: first pass at a Wavefront OBJ file that gets all the
- * statistics of the model (such as #vertices, #normals, etc)
- *
- * model - properly initialized GLMmodel structure
- * file  - (fopen'd) file descriptor 
- */
-static GLvoid
-glmFirstPass(GLMmodel* model, FILE* file, GLuint texID) 
-{
-    GLuint  numvertices;        /* number of vertices in model */
-    GLuint  numnormals;         /* number of normals in model */
-    GLuint  numtexcoords;       /* number of texcoords in model */
-    GLuint  numtriangles;       /* number of triangles in model */
-    GLMgroup* group;            /* current group */
-    unsigned    v, n, t;
-    char        buf[128];
-    
-    /* make a default group */
-    group = glmAddGroup(model, "default");
-    
-    numvertices = numnormals = numtexcoords = numtriangles = 0;
-    while(fscanf(file, "%s", buf) != EOF) {
-        switch(buf[0]) {
-        case '#':               /* comment */
-            /* eat up rest of line */
-            fgets(buf, sizeof(buf), file);
-            break;
-        case 'v':               /* v, vn, vt */
-            switch(buf[1]) {
-            case '\0':          /* vertex */
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                numvertices++;
-                break;
-            case 'n':           /* normal */
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                numnormals++;
-                break;
-            case 't':           /* texcoord */
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                numtexcoords++;
-                break;
-            default:
-                printf("glmFirstPass(): Unknown token \"%s\".\n", buf);
-                exit(1);
-                break;
-            }
-            break;
-            case 'm':
-                fgets(buf, sizeof(buf), file);
-                sscanf(buf, "%s %s", buf, buf);
-                model->mtllibname = strdup(buf);
-                glmReadMTL(model, buf, texID);
-                break;
-            case 'u':
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                break;
-            case 'g':               /* group */
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-#if SINGLE_STRING_GROUP_NAMES
-                sscanf(buf, "%s", buf);
-#else
-                buf[strlen(buf)-1] = '\0';  /* nuke '\n' */
-#endif
-                group = glmAddGroup(model, buf);
-                break;
-            case 'f':               /* face */
-                v = n = t = 0;
-                fscanf(file, "%s", buf);
-                /* can be one of %d, %d//%d, %d/%d, %d/%d/%d %d//%d */
-                if (strstr(buf, "//")) {
-                    /* v//n */
-                    sscanf(buf, "%u//%u", &v, &n);
-                    fscanf(file, "%u//%u", &v, &n);
-                    fscanf(file, "%u//%u", &v, &n);
-                    numtriangles++;
-                    group->numtriangles++;
-                    while(fscanf(file, "%u//%u", &v, &n) > 0) {
-                        numtriangles++;
-                        group->numtriangles++;
-                    }
-                } else if (sscanf(buf, "%u/%u/%u", &v, &t, &n) == 3) {
-                    /* v/t/n */
-                    fscanf(file, "%u/%u/%u", &v, &t, &n);
-                    fscanf(file, "%u/%u/%u", &v, &t, &n);
-                    numtriangles++;
-                    group->numtriangles++;
-                    while(fscanf(file, "%u/%u/%u", &v, &t, &n) > 0) {
-                        numtriangles++;
-                        group->numtriangles++;
-                    }
-                } else if (sscanf(buf, "%u/%u", &v, &t) == 2) {
-                    /* v/t */
-                    fscanf(file, "%u/%u", &v, &t);
-                    fscanf(file, "%u/%u", &v, &t);
-                    numtriangles++;
-                    group->numtriangles++;
-                    while(fscanf(file, "%u/%u", &v, &t) > 0) {
-                        numtriangles++;
-                        group->numtriangles++;
-                    }
-                } else {
-                    /* v */
-                    fscanf(file, "%u", &v);
-                    fscanf(file, "%u", &v);
-                    numtriangles++;
-                    group->numtriangles++;
-                    while(fscanf(file, "%u", &v) > 0) {
-                        numtriangles++;
-                        group->numtriangles++;
-                    }
-                }
-                break;
-                
-            default:
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                break;
-        }
-  }
-  
-  /* set the stats in the model structure */
-  model->numvertices  = numvertices;
-  model->numnormals   = numnormals;
-  model->numtexcoords = numtexcoords;
-  model->numtriangles = numtriangles;
-  
-  /* allocate memory for the triangles in each group */
-  group = model->groups;
-  while(group) {
-      group->triangles = (GLuint*)malloc(sizeof(GLuint) * group->numtriangles);
-      group->numtriangles = 0;
-      group = group->next;
-  }
-}
-
-/* glmSecondPass: second pass at a Wavefront OBJ file that gets all
- * the data.
- *
- * model - properly initialized GLMmodel structure
- * file  - (fopen'd) file descriptor 
- */
-static GLvoid
-glmSecondPass(GLMmodel* model, FILE* file) 
-{
-    GLuint  numvertices;        /* number of vertices in model */
-    GLuint  numnormals;         /* number of normals in model */
-    GLuint  numtexcoords;       /* number of texcoords in model */
-    GLuint  numtriangles;       /* number of triangles in model */
-    GLfloat*    vertices;           /* array of vertices  */
-    GLfloat*    normals;            /* array of normals */
-    GLfloat*    texcoords;          /* array of texture coordinates */
-    GLMgroup* group;            /* current group pointer */
-    GLuint  material;           /* current material */
-    GLuint  v, n, t;
-    char        buf[128];
-    
-    /* set the pointer shortcuts */
-    vertices       = model->vertices;
-    normals    = model->normals;
-    texcoords    = model->texcoords;
-    group      = model->groups;
-    
-    /* on the second pass through the file, read all the data into the
-    allocated arrays */
-    numvertices = numnormals = numtexcoords = 1;
-    numtriangles = 0;
-    material = 0;
-    while(fscanf(file, "%s", buf) != EOF) {
-        switch(buf[0]) {
-        case '#':               /* comment */
-            /* eat up rest of line */
-            fgets(buf, sizeof(buf), file);
-            break;
-        case 'v':               /* v, vn, vt */
-            switch(buf[1]) {
-            case '\0':          /* vertex */
-                fscanf(file, "%f %f %f", 
-                    &vertices[3 * numvertices + 0], 
-                    &vertices[3 * numvertices + 1], 
-                    &vertices[3 * numvertices + 2]);
-                numvertices++;
-                break;
-            case 'n':           /* normal */
-                fscanf(file, "%f %f %f", 
-                    &normals[3 * numnormals + 0],
-                    &normals[3 * numnormals + 1], 
-                    &normals[3 * numnormals + 2]);
-                numnormals++;
-                break;
-            case 't':           /* texcoord */
-                fscanf(file, "%f %f", 
-                    &texcoords[2 * numtexcoords + 0],
-                    &texcoords[2 * numtexcoords + 1]);
-                numtexcoords++;
-                break;
-            }
-            break;
-            case 'u':
-                fgets(buf, sizeof(buf), file);
-                sscanf(buf, "%s %s", buf, buf);
-                group->material = material = glmFindMaterial(model, buf);
-                break;
-            case 'g':               /* group */
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-#if SINGLE_STRING_GROUP_NAMES
-                sscanf(buf, "%s", buf);
-#else
-                buf[strlen(buf)-1] = '\0';  /* nuke '\n' */
-#endif
-                group = glmFindGroup(model, buf);
-                group->material = material;
-                break;
-            case 'f':               /* face */
-                v = n = t = 0;
-                fscanf(file, "%s", buf);
-                /* can be one of %d, %d//%d, %d/%d, %d/%d/%d %d//%d */
-                if (strstr(buf, "//")) {
-                    /* v//n */
-                    sscanf(buf, "%d//%d", (int*)&v, (int*)&n);
-                    T(numtriangles).vindices[0] = v;
-                    T(numtriangles).nindices[0] = n;
-                    fscanf(file, "%d//%d", (int*)&v, (int*)&n);
-                    T(numtriangles).vindices[1] = v;
-                    T(numtriangles).nindices[1] = n;
-                    fscanf(file, "%d//%d", (int*)&v, (int*)&n);
-                    T(numtriangles).vindices[2] = v;
-                    T(numtriangles).nindices[2] = n;
-                    group->triangles[group->numtriangles++] = numtriangles;
-                    numtriangles++;
-                    while(fscanf(file, "%d//%d", (int*)&v, (int*)&n) > 0) {
-                        T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
-                        T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0];
-                        T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
-                        T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2];
-                        T(numtriangles).vindices[2] = v;
-                        T(numtriangles).nindices[2] = n;
-                        group->triangles[group->numtriangles++] = numtriangles;
-                        numtriangles++;
-                    }
-                } else if (sscanf(buf, "%d/%d/%d", (int*)&v, (int*)&t, (int*)&n) == 3) {
-                    /* v/t/n */
-                    T(numtriangles).vindices[0] = v;
-                    T(numtriangles).tindices[0] = t;
-                    T(numtriangles).nindices[0] = n;
-                    fscanf(file, "%d/%d/%d", (int*)&v, (int*)&t, (int*)&n);
-                    T(numtriangles).vindices[1] = v;
-                    T(numtriangles).tindices[1] = t;
-                    T(numtriangles).nindices[1] = n;
-                    fscanf(file, "%d/%d/%d", (int*)&v, (int*)&t, (int*)&n);
-                    T(numtriangles).vindices[2] = v;
-                    T(numtriangles).tindices[2] = t;
-                    T(numtriangles).nindices[2] = n;
-                    group->triangles[group->numtriangles++] = numtriangles;
-                    numtriangles++;
-                    while(fscanf(file, "%d/%d/%d", (int*)&v, (int*)&t, (int*)&n) > 0) {
-                        T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
-                        T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0];
-                        T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0];
-                        T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
-                        T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2];
-                        T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2];
-                        T(numtriangles).vindices[2] = v;
-                        T(numtriangles).tindices[2] = t;
-                        T(numtriangles).nindices[2] = n;
-                        group->triangles[group->numtriangles++] = numtriangles;
-                        numtriangles++;
-                    }
-                } else if (sscanf(buf, "%d/%d", (int*)&v, (int*)&t) == 2) {
-                    /* v/t */
-                    T(numtriangles).vindices[0] = v;
-                    T(numtriangles).tindices[0] = t;
-                    fscanf(file, "%d/%d", (int*)&v, (int*)&t);
-                    T(numtriangles).vindices[1] = v;
-                    T(numtriangles).tindices[1] = t;
-                    fscanf(file, "%d/%d", (int*)&v, (int*)&t);
-                    T(numtriangles).vindices[2] = v;
-                    T(numtriangles).tindices[2] = t;
-                    group->triangles[group->numtriangles++] = numtriangles;
-                    numtriangles++;
-                    while(fscanf(file, "%d/%d", (int*)&v, (int*)&t) > 0) {
-                        T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
-                        T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0];
-                        T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
-                        T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2];
-                        T(numtriangles).vindices[2] = v;
-                        T(numtriangles).tindices[2] = t;
-                        group->triangles[group->numtriangles++] = numtriangles;
-                        numtriangles++;
-                    }
-                } else {
-                    /* v */
-                    sscanf(buf, "%d", (int*)&v);
-                    T(numtriangles).vindices[0] = v;
-                    fscanf(file, "%d", (int*)&v);
-                    T(numtriangles).vindices[1] = v;
-                    fscanf(file, "%d", (int*)&v);
-                    T(numtriangles).vindices[2] = v;
-                    group->triangles[group->numtriangles++] = numtriangles;
-                    numtriangles++;
-                    while(fscanf(file, "%d", (int*)&v) > 0) {
-                        T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
-                        T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
-                        T(numtriangles).vindices[2] = v;
-                        group->triangles[group->numtriangles++] = numtriangles;
-                        numtriangles++;
-                    }
-                }
-                break;
-                
-            default:
-                /* eat up rest of line */
-                fgets(buf, sizeof(buf), file);
-                break;
-    }
-  }
-  
-#if 1
-  /* announce the memory requirements */
-  printf(" Memory: %lu bytes\n",
-      numvertices  * 3*sizeof(GLfloat) +
-      numnormals   * 3*sizeof(GLfloat) * (numnormals ? 1 : 0) +
-      numtexcoords * 3*sizeof(GLfloat) * (numtexcoords ? 1 : 0) +
-      numtriangles * sizeof(GLMtriangle));
-#endif
-}
-
-
-/* public functions */
-
-
-/* glmUnitize: "unitize" a model by translating it to the origin and
- * scaling it to fit in a unit cube around the origin.   Returns the
- * scalefactor used.
- *
- * model - properly initialized GLMmodel structure 
- */
-GLfloat
-glmUnitize(GLMmodel* model)
-{
-    GLuint  i;
-    GLfloat maxx, minx, maxy, miny, maxz, minz;
-    GLfloat cx, cy, cz, w, h, d;
-    GLfloat scale;
-    
-    assert(model);
-    assert(model->vertices);
-    
-    /* get the max/mins */
-    maxx = minx = model->vertices[3 + 0];
-    maxy = miny = model->vertices[3 + 1];
-    maxz = minz = model->vertices[3 + 2];
-    for (i = 1; i <= model->numvertices; i++) {
-        if (maxx < model->vertices[3 * i + 0])
-            maxx = model->vertices[3 * i + 0];
-        if (minx > model->vertices[3 * i + 0])
-            minx = model->vertices[3 * i + 0];
-        
-        if (maxy < model->vertices[3 * i + 1])
-            maxy = model->vertices[3 * i + 1];
-        if (miny > model->vertices[3 * i + 1])
-            miny = model->vertices[3 * i + 1];
-        
-        if (maxz < model->vertices[3 * i + 2])
-            maxz = model->vertices[3 * i + 2];
-        if (minz > model->vertices[3 * i + 2])
-            minz = model->vertices[3 * i + 2];
-    }
-    
-    /* calculate model width, height, and depth */
-    w = glmAbs(maxx) + glmAbs(minx);
-    h = glmAbs(maxy) + glmAbs(miny);
-    d = glmAbs(maxz) + glmAbs(minz);
-    
-    /* calculate center of the model */
-    cx = (maxx + minx) / 2.0f;
-    cy = (maxy + miny) / 2.0f;
-    cz = (maxz + minz) / 2.0f;
-    
-    /* calculate unitizing scale factor */
-    scale = 2.0f / glmMax(glmMax(w, h), d);
-    
-    /* translate around center then scale */
-    for (i = 1; i <= model->numvertices; i++) {
-        model->vertices[3 * i + 0] -= cx;
-        model->vertices[3 * i + 1] -= cy;
-        model->vertices[3 * i + 2] -= cz;
-        model->vertices[3 * i + 0] *= scale;
-        model->vertices[3 * i + 1] *= scale;
-        model->vertices[3 * i + 2] *= scale;
-    }
-    
-    return scale;
-}
-
-/* glmDimensions: Calculates the dimensions (width, height, depth) of
- * a model.
- *
- * model   - initialized GLMmodel structure
- * dimensions - array of 3 GLfloats (GLfloat dimensions[3])
- */
-GLvoid
-glmDimensions(GLMmodel* model, GLfloat* dimensions)
-{
-    GLuint i;
-    GLfloat maxx, minx, maxy, miny, maxz, minz;
-    
-    assert(model);
-    assert(model->vertices);
-    assert(dimensions);
-    
-    /* get the max/mins */
-    maxx = minx = model->vertices[3 + 0];
-    maxy = miny = model->vertices[3 + 1];
-    maxz = minz = model->vertices[3 + 2];
-    for (i = 1; i <= model->numvertices; i++) {
-        if (maxx < model->vertices[3 * i + 0])
-            maxx = model->vertices[3 * i + 0];
-        if (minx > model->vertices[3 * i + 0])
-            minx = model->vertices[3 * i + 0];
-        
-        if (maxy < model->vertices[3 * i + 1])
-            maxy = model->vertices[3 * i + 1];
-        if (miny > model->vertices[3 * i + 1])
-            miny = model->vertices[3 * i + 1];
-        
-        if (maxz < model->vertices[3 * i + 2])
-            maxz = model->vertices[3 * i + 2];
-        if (minz > model->vertices[3 * i + 2])
-            minz = model->vertices[3 * i + 2];
-    }
-    
-    /* calculate model width, height, and depth */
-    dimensions[0] = glmAbs(maxx) + glmAbs(minx);
-    dimensions[1] = glmAbs(maxy) + glmAbs(miny);
-    dimensions[2] = glmAbs(maxz) + glmAbs(minz);
-}
-
-/* glmScale: Scales a model by a given amount.
- * 
- * model - properly initialized GLMmodel structure
- * scale - scalefactor (0.5 = half as large, 2.0 = twice as large)
- */
-GLvoid
-glmScale(GLMmodel* model, GLfloat scale)
-{
-    GLuint i;
-    
-    for (i = 1; i <= model->numvertices; i++) {
-        model->vertices[3 * i + 0] *= scale;
-        model->vertices[3 * i + 1] *= scale;
-        model->vertices[3 * i + 2] *= scale;
-    }
-}
-
-/* glmTranslate: Translates along direction d a model by a given amount.
- * 
- * model - properly initialized GLMmodel structure
- * transl - translationfactor 
- */
-GLvoid
-glmTranslate(GLMmodel* model, GLfloat transl, int d)
-{
-    GLuint i;
-    
-    for (i = 1; i <= model->numvertices; i++)
-	{
-		switch (d)
-		{
-			case 0 :
-				// translation selon x
-        		model->vertices[3 * i + 0] += transl;
-        		break;
-			case 1 :
-				// translation selon y
-				model->vertices[3 * i + 1] += transl;
-        		break;
-			case 2 :
-				// translation selon z
-				model->vertices[3 * i + 2] += transl;
-				break;
-		}
-    }
-}
-
-/* glmReverseWinding: Reverse the polygon winding for all polygons in
- * this model.   Default winding is counter-clockwise.  Also changes
- * the direction of the normals.
- * 
- * model - properly initialized GLMmodel structure 
- */
-GLvoid
-glmReverseWinding(GLMmodel* model)
-{
-    GLuint i, swap;
-    
-    assert(model);
-    
-    for (i = 0; i < model->numtriangles; i++) {
-        swap = T(i).vindices[0];
-        T(i).vindices[0] = T(i).vindices[2];
-        T(i).vindices[2] = swap;
-        
-        if (model->numnormals) {
-            swap = T(i).nindices[0];
-            T(i).nindices[0] = T(i).nindices[2];
-            T(i).nindices[2] = swap;
-        }
-        
-        if (model->numtexcoords) {
-            swap = T(i).tindices[0];
-            T(i).tindices[0] = T(i).tindices[2];
-            T(i).tindices[2] = swap;
-        }
-    }
-    
-    /* reverse facet normals */
-    for (i = 1; i <= model->numfacetnorms; i++) {
-        model->facetnorms[3 * i + 0] = -model->facetnorms[3 * i + 0];
-        model->facetnorms[3 * i + 1] = -model->facetnorms[3 * i + 1];
-        model->facetnorms[3 * i + 2] = -model->facetnorms[3 * i + 2];
-    }
-    
-    /* reverse vertex normals */
-    for (i = 1; i <= model->numnormals; i++) {
-        model->normals[3 * i + 0] = -model->normals[3 * i + 0];
-        model->normals[3 * i + 1] = -model->normals[3 * i + 1];
-        model->normals[3 * i + 2] = -model->normals[3 * i + 2];
-    }
-}
-
-/* glmFacetNormals: Generates facet normals for a model (by taking the
- * cross product of the two vectors derived from the sides of each
- * triangle).  Assumes a counter-clockwise winding.
- *
- * model - initialized GLMmodel structure
- */
-GLvoid
-glmFacetNormals(GLMmodel* model)
-{
-    GLuint  i;
-    GLfloat u[3];
-    GLfloat v[3];
-    
-    assert(model);
-    assert(model->vertices);
-    
-    /* clobber any old facetnormals */
-    if (model->facetnorms)
-        free(model->facetnorms);
-    
-    /* allocate memory for the new facet normals */
-    model->numfacetnorms = model->numtriangles;
-    model->facetnorms = (GLfloat*)malloc(sizeof(GLfloat) *
-                       3 * (model->numfacetnorms + 1));
-    
-    for (i = 0; i < model->numtriangles; i++) {
-        model->triangles[i].findex = i+1;
-        
-        u[0] = model->vertices[3 * T(i).vindices[1] + 0] -
-            model->vertices[3 * T(i).vindices[0] + 0];
-        u[1] = model->vertices[3 * T(i).vindices[1] + 1] -
-            model->vertices[3 * T(i).vindices[0] + 1];
-        u[2] = model->vertices[3 * T(i).vindices[1] + 2] -
-            model->vertices[3 * T(i).vindices[0] + 2];
-        
-        v[0] = model->vertices[3 * T(i).vindices[2] + 0] -
-            model->vertices[3 * T(i).vindices[0] + 0];
-        v[1] = model->vertices[3 * T(i).vindices[2] + 1] -
-            model->vertices[3 * T(i).vindices[0] + 1];
-        v[2] = model->vertices[3 * T(i).vindices[2] + 2] -
-            model->vertices[3 * T(i).vindices[0] + 2];
-        
-        glmCross(u, v, &model->facetnorms[3 * (i+1)]);
-        glmNormalize(&model->facetnorms[3 * (i+1)]);
-    }
-}
-
-/* glmVertexNormals: Generates smooth vertex normals for a model.
- * First builds a list of all the triangles each vertex is in.   Then
- * loops through each vertex in the the list averaging all the facet
- * normals of the triangles each vertex is in.   Finally, sets the
- * normal index in the triangle for the vertex to the generated smooth
- * normal.   If the dot product of a facet normal and the facet normal
- * associated with the first triangle in the list of triangles the
- * current vertex is in is greater than the cosine of the angle
- * parameter to the function, that facet normal is not added into the
- * average normal calculation and the corresponding vertex is given
- * the facet normal.  This tends to preserve hard edges.  The angle to
- * use depends on the model, but 90 degrees is usually a good start.
- *
- * model - initialized GLMmodel structure
- * angle - maximum angle (in degrees) to smooth across
- */
-GLvoid
-glmVertexNormals(GLMmodel* model, GLfloat angle)
-{
-    GLMnode*    node;
-    GLMnode*    tail;
-    GLMnode** members;
-    GLfloat*    normals;
-    GLuint  numnormals;
-    GLfloat average[3];
-    GLfloat dot, cos_angle;
-    GLuint  i, avg;
-    
-    assert(model);
-    assert(model->facetnorms);
-    
-    /* calculate the cosine of the angle (in degrees) */
-    cos_angle = cos(angle * (float)M_PI / 180.0f);
-    
-    /* nuke any previous normals */
-    if (model->normals)
-        free(model->normals);
-    
-    /* allocate space for new normals */
-    model->numnormals = model->numtriangles * 3; /* 3 normals per triangle */
-    model->normals = (GLfloat*)malloc(sizeof(GLfloat)* 3* (model->numnormals+1));
-    
-    /* allocate a structure that will hold a linked list of triangle
-    indices for each vertex */
-    members = (GLMnode**)malloc(sizeof(GLMnode*) * (model->numvertices + 1));
-    for (i = 1; i <= model->numvertices; i++)
-        members[i] = NULL;
-    
-    /* for every triangle, create a node for each vertex in it */
-    for (i = 0; i < model->numtriangles; i++) {
-        node = (GLMnode*)malloc(sizeof(GLMnode));
-        node->index = i;
-        node->next  = members[T(i).vindices[0]];
-        members[T(i).vindices[0]] = node;
-        
-        node = (GLMnode*)malloc(sizeof(GLMnode));
-        node->index = i;
-        node->next  = members[T(i).vindices[1]];
-        members[T(i).vindices[1]] = node;
-        
-        node = (GLMnode*)malloc(sizeof(GLMnode));
-        node->index = i;
-        node->next  = members[T(i).vindices[2]];
-        members[T(i).vindices[2]] = node;
-    }
-    
-    /* calculate the average normal for each vertex */
-    numnormals = 1;
-    for (i = 1; i <= model->numvertices; i++) {
-    /* calculate an average normal for this vertex by averaging the
-        facet normal of every triangle this vertex is in */
-        node = members[i];
-        if (!node)
-            fprintf(stderr, "glmVertexNormals(): vertex w/o a triangle\n");
-        average[0] = 0.0f; average[1] = 0.0f; average[2] = 0.0f;
-        avg = 0;
-        while (node) {
-        /* only average if the dot product of the angle between the two
-        facet normals is greater than the cosine of the threshold
-        angle -- or, said another way, the angle between the two
-            facet normals is less than (or equal to) the threshold angle */
-            dot = glmDot(&model->facetnorms[3 * T(node->index).findex],
-                &model->facetnorms[3 * T(members[i]->index).findex]);
-            if (dot > cos_angle) {
-                node->averaged = GL_TRUE;
-                average[0] += model->facetnorms[3 * T(node->index).findex + 0];
-                average[1] += model->facetnorms[3 * T(node->index).findex + 1];
-                average[2] += model->facetnorms[3 * T(node->index).findex + 2];
-                avg = 1;            /* we averaged at least one normal! */
-            } else {
-                node->averaged = GL_FALSE;
-            }
-            node = node->next;
-        }
-        
-        if (avg) {
-            /* normalize the averaged normal */
-            glmNormalize(average);
-            
-            /* add the normal to the vertex normals list */
-            model->normals[3 * numnormals + 0] = average[0];
-            model->normals[3 * numnormals + 1] = average[1];
-            model->normals[3 * numnormals + 2] = average[2];
-            avg = numnormals;
-            numnormals++;
-        }
-        
-        /* set the normal of this vertex in each triangle it is in */
-        node = members[i];
-        while (node) {
-            if (node->averaged) {
-                /* if this node was averaged, use the average normal */
-                if (T(node->index).vindices[0] == i)
-                    T(node->index).nindices[0] = avg;
-                else if (T(node->index).vindices[1] == i)
-                    T(node->index).nindices[1] = avg;
-                else if (T(node->index).vindices[2] == i)
-                    T(node->index).nindices[2] = avg;
-            } else {
-                /* if this node wasn't averaged, use the facet normal */
-                model->normals[3 * numnormals + 0] = 
-                    model->facetnorms[3 * T(node->index).findex + 0];
-                model->normals[3 * numnormals + 1] = 
-                    model->facetnorms[3 * T(node->index).findex + 1];
-                model->normals[3 * numnormals + 2] = 
-                    model->facetnorms[3 * T(node->index).findex + 2];
-                if (T(node->index).vindices[0] == i)
-                    T(node->index).nindices[0] = numnormals;
-                else if (T(node->index).vindices[1] == i)
-                    T(node->index).nindices[1] = numnormals;
-                else if (T(node->index).vindices[2] == i)
-                    T(node->index).nindices[2] = numnormals;
-                numnormals++;
-            }
-            node = node->next;
-        }
-    }
-    
-    model->numnormals = numnormals - 1;
-    
-    /* free the member information */
-    for (i = 1; i <= model->numvertices; i++) {
-        node = members[i];
-        while (node) {
-            tail = node;
-            node = node->next;
-            free(tail);
-        }
-    }
-    free(members);
-    
-    /* pack the normals array (we previously allocated the maximum
-    number of normals that could possibly be created (numtriangles *
-    3), so get rid of some of them (usually alot unless none of the
-    facet normals were averaged)) */
-    normals = model->normals;
-    model->normals = (GLfloat*)malloc(sizeof(GLfloat)* 3* (model->numnormals+1));
-    for (i = 1; i <= model->numnormals; i++) {
-        model->normals[3 * i + 0] = normals[3 * i + 0];
-        model->normals[3 * i + 1] = normals[3 * i + 1];
-        model->normals[3 * i + 2] = normals[3 * i + 2];
-    }
-    free(normals);
-}
-
-
-/* glmLinearTexture: Generates texture coordinates according to a
- * linear projection of the texture map.  It generates these by
- * linearly mapping the vertices onto a square.
- *
- * model - pointer to initialized GLMmodel structure
- */
-GLvoid
-glmLinearTexture(GLMmodel* model)
-{
-    GLMgroup *group;
-    GLfloat dimensions[3];
-    GLfloat x, y, scalefactor;
-    GLuint i;
-    
-    assert(model);
-    
-    if (model->texcoords)
-        free(model->texcoords);
-    model->numtexcoords = model->numvertices;
-    model->texcoords=(GLfloat*)malloc(sizeof(GLfloat)*2*(model->numtexcoords+1));
-    
-    glmDimensions(model, dimensions);
-    scalefactor = 2.0f / 
-        glmAbs(glmMax(glmMax(dimensions[0], dimensions[1]), dimensions[2]));
-    
-    /* do the calculations */
-    for(i = 1; i <= model->numvertices; i++) {
-        x = model->vertices[3 * i + 0] * scalefactor;
-        y = model->vertices[3 * i + 2] * scalefactor;
-        model->texcoords[2 * i + 0] = (x + 1.0f) / 2.0f;
-        model->texcoords[2 * i + 1] = (y + 1.0f) / 2.0f;
-    }
-    
-    /* go through and put texture coordinate indices in all the triangles */
-    group = model->groups;
-    while(group) {
-        for(i = 0; i < group->numtriangles; i++) {
-            T(group->triangles[i]).tindices[0] = T(group->triangles[i]).vindices[0];
-            T(group->triangles[i]).tindices[1] = T(group->triangles[i]).vindices[1];
-            T(group->triangles[i]).tindices[2] = T(group->triangles[i]).vindices[2];
-        }    
-        group = group->next;
-    }
-    
-#if 0
-    printf("glmLinearTexture(): generated %d linear texture coordinates\n",
-        model->numtexcoords);
-#endif
-}
-
-/* glmSpheremapTexture: Generates texture coordinates according to a
- * spherical projection of the texture map.  Sometimes referred to as
- * spheremap, or reflection map texture coordinates.  It generates
- * these by using the normal to calculate where that vertex would map
- * onto a sphere.  Since it is impossible to map something flat
- * perfectly onto something spherical, there is distortion at the
- * poles.  This particular implementation causes the poles along the X
- * axis to be distorted.
- *
- * model - pointer to initialized GLMmodel structure
- */
-GLvoid
-glmSpheremapTexture(GLMmodel* model)
-{
-    GLMgroup* group;
-    GLfloat theta, phi, rho, x, y, z, r;
-    GLuint i;
-    
-    assert(model);
-    assert(model->normals);
-    
-    if (model->texcoords)
-        free(model->texcoords);
-    model->numtexcoords = model->numnormals;
-    model->texcoords=(GLfloat*)malloc(sizeof(GLfloat)*2*(model->numtexcoords+1));
-    
-    for (i = 1; i <= model->numnormals; i++) {
-        z = model->normals[3 * i + 0];  /* re-arrange for pole distortion */
-        y = model->normals[3 * i + 1];
-        x = model->normals[3 * i + 2];
-        r = sqrt((x * x) + (y * y));
-        rho = sqrt((r * r) + (z * z));
-        
-        if(r == 0.0) {
-            theta = 0.0f;
-            phi = 0.0f;
-        } else {
-            if(z == 0.0)
-                phi = 3.14159265f / 2.0f;
-            else
-                phi = acos(z / rho);
-            
-            if(y == 0.0)
-                theta = 3.141592365f / 2.0f;
-            else
-                theta = asin(y / r) + (3.14159265f / 2.0f);
-        }
-        
-        model->texcoords[2 * i + 0] = theta / 3.14159265f;
-        model->texcoords[2 * i + 1] = phi / 3.14159265f;
-    }
-    
-    /* go through and put texcoord indices in all the triangles */
-    group = model->groups;
-    while(group) {
-        for (i = 0; i < group->numtriangles; i++) {
-            T(group->triangles[i]).tindices[0] = T(group->triangles[i]).nindices[0];
-            T(group->triangles[i]).tindices[1] = T(group->triangles[i]).nindices[1];
-            T(group->triangles[i]).tindices[2] = T(group->triangles[i]).nindices[2];
-        }
-        group = group->next;
-    }
-}
-
-/* glmDelete: Deletes a GLMmodel structure.
- *
- * model - initialized GLMmodel structure
- */
-GLvoid
-glmDelete(GLMmodel* model)
-{
-  GLMgroup* group;
-  GLuint i;
-    
-  assert(model);
-    
-  if (model->pathname)     free(model->pathname);
-  if (model->mtllibname) free(model->mtllibname);
-  if (model->vertices)     free(model->vertices);
-  if (model->normals)  free(model->normals);
-  if (model->texcoords)  free(model->texcoords);
-  if (model->facetnorms) free(model->facetnorms);
-  if (model->triangles)  free(model->triangles);
-  if (model->materials)
-    {
-      for (i = 0; i < model->nummaterials; i++)
-	free(model->materials[i].name);
-    }
-  free(model->materials);
-  while(model->groups)
-    {
-      group = model->groups;
-      model->groups = model->groups->next;
-      if (group->name)
-	{
-	  // cout<<"on efface "<<group->name<<endl;
-	  free(group->name);
-	}
-      if (group->triangles)
-	free(group->triangles);
-      free(group);
-    }
-  free(model);
-}
-
-/* glmReadOBJ: Reads a model description from a Wavefront .OBJ file.
- * Returns a pointer to the created object which should be free'd with
- * glmDelete().
- *
- * filename - name of the file containing the Wavefront .OBJ format data.  
- */
-GLMmodel* 
-glmReadOBJ(char* filename, GLuint texId)
-{
-    GLMmodel* model;
-    FILE*   file;
-    
-    /* open the file */
-    file = fopen(filename, "r");
-    if (!file) {
-        fprintf(stderr, "glmReadOBJ() failed: can't open data file \"%s\".\n",
-            filename);
-        exit(1);
-    }
-    
-    /* allocate a new model */
-    model = (GLMmodel*)malloc(sizeof(GLMmodel));
-    model->pathname    = strdup(filename);
-    model->mtllibname    = NULL;
-    model->numvertices   = 0;
-    model->vertices    = NULL;
-    model->numnormals    = 0;
-    model->normals     = NULL;
-    model->numtexcoords  = 0;
-    model->texcoords       = NULL;
-    model->numfacetnorms = 0;
-    model->facetnorms    = NULL;
-    model->numtriangles  = 0;
-    model->triangles       = NULL;
-    model->nummaterials  = 0;
-    model->materials       = NULL;
-    model->numgroups       = 0;
-    model->groups      = NULL;
-    model->position[0]   = 0.0f;
-    model->position[1]   = 0.0f;
-    model->position[2]   = 0.0f;
-    
-    /* make a first pass through the file to get a count of the number
-    of vertices, normals, texcoords & triangles */
-    glmFirstPass(model, file, texId);
-    
-    /* allocate memory */
-    model->vertices = (GLfloat*)malloc(sizeof(GLfloat) *
-        3 * (model->numvertices + 1));
-    model->triangles = (GLMtriangle*)malloc(sizeof(GLMtriangle) *
-        model->numtriangles);
-    if (model->numnormals) {
-        model->normals = (GLfloat*)malloc(sizeof(GLfloat) *
-            3 * (model->numnormals + 1));
-    }
-    if (model->numtexcoords) {
-        model->texcoords = (GLfloat*)malloc(sizeof(GLfloat) *
-            2 * (model->numtexcoords + 1));
-    }
-    
-    /* rewind to beginning of file and read in the data this pass */
-    rewind(file);
-    
-    glmSecondPass(model, file);
-    
-    /* close the file */
-    fclose(file);
-    
-    return model;
-}
-
-/* glmWriteOBJ: Writes a model description in Wavefront .OBJ format to
- * a file.
- *
- * model - initialized GLMmodel structure
- * filename - name of the file to write the Wavefront .OBJ format data to
- * mode  - a bitwise or of values describing what is written to the file
- *             GLM_NONE     -  render with only vertices
- *             GLM_FLAT     -  render with facet normals
- *             GLM_SMOOTH   -  render with vertex normals
- *             GLM_TEXTURE  -  render with texture coords
- *             GLM_COLOR    -  render with colors (color material)
- *             GLM_MATERIAL -  render with materials
- *             GLM_COLOR and GLM_MATERIAL should not both be specified.  
- *             GLM_FLAT and GLM_SMOOTH should not both be specified.  
- */
-GLvoid
-glmWriteOBJ(GLMmodel* model, char* filename, GLuint mode)
-{
-    GLuint  i;
-    FILE*   file;
-    GLMgroup* group;
-    
-    assert(model);
-    
-    /* do a bit of warning */
-    if (mode & GLM_FLAT && !model->facetnorms) {
-        printf("glmWriteOBJ() warning: flat normal output requested "
-            "with no facet normals defined.\n");
-        mode &= ~GLM_FLAT;
-    }
-    if (mode & GLM_SMOOTH && !model->normals) {
-        printf("glmWriteOBJ() warning: smooth normal output requested "
-            "with no normals defined.\n");
-        mode &= ~GLM_SMOOTH;
-    }
-    if (mode & GLM_TEXTURE && !model->texcoords) {
-        printf("glmWriteOBJ() warning: texture coordinate output requested "
-            "with no texture coordinates defined.\n");
-        mode &= ~GLM_TEXTURE;
-    }
-    if (mode & GLM_FLAT && mode & GLM_SMOOTH) {
-        printf("glmWriteOBJ() warning: flat normal output requested "
-            "and smooth normal output requested (using smooth).\n");
-        mode &= ~GLM_FLAT;
-    }
-    if (mode & GLM_COLOR && !model->materials) {
-        printf("glmWriteOBJ() warning: color output requested "
-            "with no colors (materials) defined.\n");
-        mode &= ~GLM_COLOR;
-    }
-    if (mode & GLM_MATERIAL && !model->materials) {
-        printf("glmWriteOBJ() warning: material output requested "
-            "with no materials defined.\n");
-        mode &= ~GLM_MATERIAL;
-    }
-    if (mode & GLM_COLOR && mode & GLM_MATERIAL) {
-        printf("glmWriteOBJ() warning: color and material output requested "
-            "outputting only materials.\n");
-        mode &= ~GLM_COLOR;
-    }
-    
-    
-    /* open the file */
-    file = fopen(filename, "w");
-    if (!file) {
-        fprintf(stderr, "glmWriteOBJ() failed: can't open file \"%s\" to write.\n",
-            filename);
-        exit(1);
-    }
-    
-    /* spit out a header */
-    fprintf(file, "#  \n");
-    fprintf(file, "#  Wavefront OBJ generated by GLM library\n");
-    fprintf(file, "#  \n");
-    fprintf(file, "#  GLM library\n");
-    fprintf(file, "#  Nate Robins\n");
-    fprintf(file, "#  ndr at pobox.com\n");
-    fprintf(file, "#  http://www.pobox.com/~ndr\n");
-    fprintf(file, "#  \n");
-    
-    if (mode & GLM_MATERIAL && model->mtllibname) {
-        fprintf(file, "\nmtllib %s\n\n", model->mtllibname);
-        glmWriteMTL(model, filename, model->mtllibname);
-    }
-    
-    /* spit out the vertices */
-    fprintf(file, "\n");
-    fprintf(file, "# %d vertices\n", model->numvertices);
-    for (i = 1; i <= model->numvertices; i++) {
-        fprintf(file, "v %f %f %f\n", 
-            model->vertices[3 * i + 0],
-            model->vertices[3 * i + 1],
-            model->vertices[3 * i + 2]);
-    }
-    
-    /* spit out the smooth/flat normals */
-    if (mode & GLM_SMOOTH) {
-        fprintf(file, "\n");
-        fprintf(file, "# %d normals\n", model->numnormals);
-        for (i = 1; i <= model->numnormals; i++) {
-            fprintf(file, "vn %f %f %f\n", 
-                model->normals[3 * i + 0],
-                model->normals[3 * i + 1],
-                model->normals[3 * i + 2]);
-        }
-    } else if (mode & GLM_FLAT) {
-        fprintf(file, "\n");
-        fprintf(file, "# %d normals\n", model->numfacetnorms);
-        for (i = 1; i <= model->numnormals; i++) {
-            fprintf(file, "vn %f %f %f\n", 
-                model->facetnorms[3 * i + 0],
-                model->facetnorms[3 * i + 1],
-                model->facetnorms[3 * i + 2]);
-        }
-    }
-    
-    /* spit out the texture coordinates */
-    if (mode & GLM_TEXTURE) {
-        fprintf(file, "\n");
-        fprintf(file, "# %d texcoords\n", model->numtexcoords);
-        for (i = 1; i <= model->numtexcoords; i++) {
-            fprintf(file, "vt %f %f\n", 
-                model->texcoords[2 * i + 0],
-                model->texcoords[2 * i + 1]);
-        }
-    }
-    
-    fprintf(file, "\n");
-    fprintf(file, "# %d groups\n", model->numgroups);
-    fprintf(file, "# %d faces (triangles)\n", model->numtriangles);
-    fprintf(file, "\n");
-    
-    group = model->groups;
-    while(group) {
-        fprintf(file, "g %s\n", group->name);
-        if (mode & GLM_MATERIAL)
-            fprintf(file, "usemtl %s\n", model->materials[group->material].name);
-        for (i = 0; i < group->numtriangles; i++) {
-            if (mode & GLM_SMOOTH && mode & GLM_TEXTURE) {
-                fprintf(file, "f %d/%d/%d %d/%d/%d %d/%d/%d\n",
-                    T(group->triangles[i]).vindices[0], 
-                    T(group->triangles[i]).nindices[0], 
-                    T(group->triangles[i]).tindices[0],
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).nindices[1],
-                    T(group->triangles[i]).tindices[1],
-                    T(group->triangles[i]).vindices[2],
-                    T(group->triangles[i]).nindices[2],
-                    T(group->triangles[i]).tindices[2]);
-            } else if (mode & GLM_FLAT && mode & GLM_TEXTURE) {
-                fprintf(file, "f %d/%d %d/%d %d/%d\n",
-                    T(group->triangles[i]).vindices[0],
-                    T(group->triangles[i]).findex,
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).findex,
-                    T(group->triangles[i]).vindices[2],
-                    T(group->triangles[i]).findex);
-            } else if (mode & GLM_TEXTURE) {
-                fprintf(file, "f %d/%d %d/%d %d/%d\n",
-                    T(group->triangles[i]).vindices[0],
-                    T(group->triangles[i]).tindices[0],
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).tindices[1],
-                    T(group->triangles[i]).vindices[2],
-                    T(group->triangles[i]).tindices[2]);
-            } else if (mode & GLM_SMOOTH) {
-                fprintf(file, "f %d//%d %d//%d %d//%d\n",
-                    T(group->triangles[i]).vindices[0],
-                    T(group->triangles[i]).nindices[0],
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).nindices[1],
-                    T(group->triangles[i]).vindices[2], 
-                    T(group->triangles[i]).nindices[2]);
-            } else if (mode & GLM_FLAT) {
-                fprintf(file, "f %d//%d %d//%d %d//%d\n",
-                    T(group->triangles[i]).vindices[0], 
-                    T(group->triangles[i]).findex,
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).findex,
-                    T(group->triangles[i]).vindices[2],
-                    T(group->triangles[i]).findex);
-            } else {
-                fprintf(file, "f %d %d %d\n",
-                    T(group->triangles[i]).vindices[0],
-                    T(group->triangles[i]).vindices[1],
-                    T(group->triangles[i]).vindices[2]);
-            }
-        }
-        fprintf(file, "\n");
-        group = group->next;
-    }
-    
-    fclose(file);
-}
-
-/* glmDraw: Renders the model to the current OpenGL context using the
- * mode specified.
- *
- * model - initialized GLMmodel structure
- * mode  - a bitwise OR of values describing what is to be rendered.
- *             GLM_NONE     -  render with only vertices
- *             GLM_FLAT     -  render with facet normals
- *             GLM_SMOOTH   -  render with vertex normals
- *             GLM_TEXTURE  -  render with texture coords
- *             GLM_COLOR    -  render with colors (color material)
- *             GLM_MATERIAL -  render with materials
- *             GLM_COLOR and GLM_MATERIAL should not both be specified.  
- *             GLM_FLAT and GLM_SMOOTH should not both be specified.  
- */
-GLvoid
-//glmDraw(GLMmodel* model, GLuint mode, const bool names, const int selectTriangle)
-glmDraw(GLMmodel* model, GLuint mode, const float basisColor[3], const float alpha, const bool names, std::map<int, TriangleIndex> map)
-{
-  static GLuint i;
-  static GLMgroup* group;
-  static GLMtriangle* triangle;
-  static GLMmaterial* material;
-    
-  assert(model);
-  assert(model->vertices);
-    
-  /* do a bit of warning */
-  if (mode & GLM_FLAT && !model->facetnorms) {
-    printf("glmDraw() warning: flat render mode requested "
-	   "with no facet normals defined.\n");
-    mode &= ~GLM_FLAT;
-  }
-  if (mode & GLM_SMOOTH && !model->normals) {
-    printf("glmDraw() warning: smooth render mode requested "
-	   "with no normals defined.\n");
-    mode &= ~GLM_SMOOTH;
-  }
-  if (mode & GLM_TEXTURE && !model->texcoords) {
-    printf("glmDraw() warning: texture render mode requested "
-	   "with no texture coordinates defined.\n");
-    mode &= ~GLM_TEXTURE;
-  }
-  if (mode & GLM_FLAT && mode & GLM_SMOOTH) {
-    printf("glmDraw() warning: flat render mode requested "
-	   "and smooth render mode requested (using smooth).\n");
-    mode &= ~GLM_FLAT;
-  }
-  if (mode & GLM_COLOR && !model->materials) {
-    printf("glmDraw() warning: color render mode requested "
-	   "with no materials defined.\n");
-    mode &= ~GLM_COLOR;
-  }
-  if (mode & GLM_MATERIAL && !model->materials) {
-    printf("glmDraw() warning: material render mode requested "
-	   "with no materials defined.\n");
-    mode &= ~GLM_MATERIAL;
-  }
-  if (mode & GLM_COLOR && mode & GLM_MATERIAL) {
-    printf("glmDraw() warning: color and material render mode requested "
-	   "using only material mode.\n");
-    mode &= ~GLM_COLOR;
-  }
-  if (mode & GLM_COLOR)
-    glEnable(GL_COLOR_MATERIAL);
-  else if (mode & GLM_MATERIAL)
-    glDisable(GL_COLOR_MATERIAL);
-    
-  /* perhaps this loop should be unrolled into material, color, flat,
-     smooth, etc. loops?  since most cpu's have good branch prediction
-     schemes (and these branches will always go one way), probably
-     wouldn't gain too much?  */
-  
-  group = model->groups;
-
-  // FLO
-  unsigned short nTrianglesPrev = 0;
-  unsigned short int groupID = 0;
-  // --
-
-  if (!names)
-    {
-      while (group)
-	{
-	  // FLO
-	  //cout<<"groupID = "<<groupID<<endl;
-	  // --
-      
-	  if (mode & GLM_MATERIAL)
-	    {
-	      material = &model->materials[group->material];
-	      glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, material->ambient);
-	      glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, material->diffuse);
-	      glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, material->specular);
-	      glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, material->shininess);
-	    }
-
-	  /*  M a r c  */
-	  if (mode & GLM_TEXTURE)
-	    {
-	      glmUseTex(material->idTex);
-	    }
-	  else glDisable(GL_TEXTURE_2D);
-    
-	  
-	  if (mode & GLM_COLOR)
-	    {
-	      glColor3fv(material->diffuse);
-	    }
-        
-	  glBegin(GL_TRIANGLES);
-	  for (i = 0; i < group->numtriangles; i++)
-	    {
-	      // FLO
-	  
-	      // Global index of the triangle i of current group
-	      //   ie. index of the triangle in the whole model
-	      GLuint triangleID = (group->triangles)[i];
-	  
-	      // selected triangles are drawn in a special color
-	      // IMPROVE the test !!
-	      GLuint triangleIndex = (map[triangleID]).getIndex();
-	      //  if (map[(int)triangleID] == triangleID)
-	      if (triangleIndex == triangleID)
-		{
-		  //cout<<"triangleID = "<<triangleID<<endl;
-		  //glColor3f(0.30, 0.20, 0.1);
-		  glColor3f(0.15f, 0.1f, 0.05f);
-		}
-	      else
-		// Access to an empty triangle
-		{
-		  assert(triangleIndex == EMPTY_TRIANGLE);
-		  //glColor3fv(basisColor);
-		  glColor4f(basisColor[0], basisColor[1], basisColor[2], alpha);
-		}
-	      // --
-
-	      triangle = &T(group->triangles[i]);
-
-	      // FLO
-
-	      // NB : in 'vertices' array of the model, points are stores as blocks of 3 floats
-	      //   [P0x, P0y, P0z, P1x, P1y, P1z, P2x, P2y, P2z, ...]
-	  
-	      // So to access to point Pk knowing index k, you have to compute vertices[3*k] (which
-	      // gives the index of Pkx), and then get the block of 3 floats starting at this address
-
-	      // Here, 3*triangle->vindices[k] is the starting index of the point Pk in 'vertices' array
-	    
-	      // --
-	  
-	      if (mode & GLM_FLAT)
-		glNormal3fv(&model->facetnorms[3 * triangle->findex]);
-            
-	      if (mode & GLM_SMOOTH)
-		glNormal3fv(&model->normals[3 * triangle->nindices[0]]);
-	      if (mode & GLM_TEXTURE)
-		glTexCoord2fv(&model->texcoords[2 * triangle->tindices[0]]);
-	      
-	      glVertex3fv(&model->vertices[3 * triangle->vindices[0]]);
-            
-	      if (mode & GLM_SMOOTH)
-		glNormal3fv(&model->normals[3 * triangle->nindices[1]]);
-	      if (mode & GLM_TEXTURE)
-		glTexCoord2fv(&model->texcoords[2 * triangle->tindices[1]]);
-	      
-	      glVertex3fv(&model->vertices[3 * triangle->vindices[1]]);
-            
-	      if (mode & GLM_SMOOTH)
-		glNormal3fv(&model->normals[3 * triangle->nindices[2]]);
-	      if (mode & GLM_TEXTURE)
-		glTexCoord2fv(&model->texcoords[2 * triangle->tindices[2]]);
-	      
-	      glVertex3fv(&model->vertices[3 * triangle->vindices[2]]);
-
-	    }
-      
-	  glEnd();
-
-	  // FLO
-	  // Updating nTrianglesPrev
-	  nTrianglesPrev = group->numtriangles;
-	  //cout<<"numTriangles = "<<nTrianglesPrev<<endl;
-	  // --
-      
-	  group = group->next;
-
-	  // FLO
-	  ++groupID;
-	  // --
-	}
-    }
-
-  // FLO
-  else
-    // names == true
-    {
-      group = model->groups;
-      //group = group->next;
-      //group = group->next;
-
-      while (group)
-	{
-	  for (i = 0; i < group->numtriangles; i++)
-	    {		  
-	      // Global index of the triangle i of current group
-	      //   ie. index of the triangle in the whole model
-	      int triangleID = (group->triangles)[i];
-	  	  
-	      glPushName(triangleID);
-
-	      glBegin(GL_TRIANGLES);
-
-	      // triangle = &((model->triangle)[group->triangles[i]])
-	      //   gives
-	      triangle = &T(group->triangles[i]);
-
-	      // NB : in 'vertices' array of the model, points are stores as blocks of 3 floats
-	      //   [P0x, P0y, P0z, P1x, P1y, P1z, P2x, P2y, P2z, ...]
-	  
-	      // So to access to point Pk knowing index k, you have to compute vertices[3*k] (which
-	      // gives the index of Pkx), and then get the block of 3 floats starting at this address
-
-	      // Here, 3*triangle->vindices[k] is the starting index of the point Pk in 'vertices' array
-
-	      glVertex3fv(&model->vertices[3*triangle->vindices[0]]);
-	      glVertex3fv(&model->vertices[3*triangle->vindices[1]]);
-	      glVertex3fv(&model->vertices[3*triangle->vindices[2]]);
-
-	      glEnd();
-	  
-	      glPopName();
-	    } // end for
-	  group = group->next;
-	} // end while
-    } // end else
-  // --
-}
-
-
-GLvoid
-glmDrawSelectedTriangles(GLMmodel* model, GLuint mode, std::map<int, TriangleIndex> * selectedTriangles)
-{
-
-  //cout<<"Entre dans glmDrawSelectedTriangles"<<endl;
-
-  //cout<<"map size = "<<selectedTriangles->size()<<endl;
-  static GLMtriangle* triangle;
-    
-  assert(model);
-  assert(model->vertices);
-    
-  /* do a bit of warning */
-  if (mode & GLM_FLAT && !model->facetnorms) {
-    printf("glmDraw() warning: flat render mode requested "
-	   "with no facet normals defined.\n");
-    mode &= ~GLM_FLAT;
-  }
-  if (mode & GLM_SMOOTH && !model->normals) {
-    printf("glmDraw() warning: smooth render mode requested "
-	   "with no normals defined.\n");
-    mode &= ~GLM_SMOOTH;
-  }
-  if (mode & GLM_TEXTURE && !model->texcoords) {
-    printf("glmDraw() warning: texture render mode requested "
-	   "with no texture coordinates defined.\n");
-    mode &= ~GLM_TEXTURE;
-  }
-  if (mode & GLM_FLAT && mode & GLM_SMOOTH) {
-    printf("glmDraw() warning: flat render mode requested "
-	   "and smooth render mode requested (using smooth).\n");
-    mode &= ~GLM_FLAT;
-  }
-  if (mode & GLM_COLOR && !model->materials) {
-    printf("glmDraw() warning: color render mode requested "
-	   "with no materials defined.\n");
-    mode &= ~GLM_COLOR;
-  }
-  if (mode & GLM_MATERIAL && !model->materials) {
-    printf("glmDraw() warning: material render mode requested "
-	   "with no materials defined.\n");
-    mode &= ~GLM_MATERIAL;
-  }
-  if (mode & GLM_COLOR && mode & GLM_MATERIAL) {
-    printf("glmDraw() warning: color and material render mode requested "
-	   "using only material mode.\n");
-    mode &= ~GLM_COLOR;
-  }
-  if (mode & GLM_COLOR)
-    glEnable(GL_COLOR_MATERIAL);
-  else if (mode & GLM_MATERIAL)
-    glDisable(GL_COLOR_MATERIAL);
-    
-  /* perhaps this loop should be unrolled into material, color, flat,
-     smooth, etc. loops?  since most cpu's have good branch prediction
-     schemes (and these branches will always go one way), probably
-     wouldn't gain too much?  */
-
-
-  glColor3f(0.0f, 0.7f, 1.0f);
-
-  std::map<int, TriangleIndex>::const_iterator mapIter;
-
-  glBegin(GL_TRIANGLES);
-  for (mapIter = selectedTriangles->begin(); mapIter != selectedTriangles->end(); ++mapIter)
-    {      
-
-      glColor3f(0.0f, 0.7f, 1.0f);
-      // Global index of the triangle i of current group
-      //   ie. index of the triangle in the whole model
-      GLuint triangleID = (mapIter->second).getIndex();
-
-      cout<<"triangleID = "<<triangleID<<endl;
-      triangle = &T(triangleID);
-	  
-      if (mode & GLM_FLAT)
-	glNormal3fv(&model->facetnorms[3 * triangle->findex]);
-            
-      if (mode & GLM_SMOOTH)
-	glNormal3fv(&model->normals[3 * triangle->nindices[0]]);
-      if (mode & GLM_TEXTURE)
-	glTexCoord2fv(&model->texcoords[2 * triangle->tindices[0]]);
-
-      glVertex3fv(&model->vertices[3 * triangle->vindices[0]]);
-            
-      if (mode & GLM_SMOOTH)
-	glNormal3fv(&model->normals[3 * triangle->nindices[1]]);
-      if (mode & GLM_TEXTURE)
-	glTexCoord2fv(&model->texcoords[2 * triangle->tindices[1]]);
-
-      glVertex3fv(&model->vertices[3 * triangle->vindices[1]]);
-            
-      if (mode & GLM_SMOOTH)
-	glNormal3fv(&model->normals[3 * triangle->nindices[2]]);
-      if (mode & GLM_TEXTURE)
-	glTexCoord2fv(&model->texcoords[2 * triangle->tindices[2]]);
-
-      glVertex3fv(&model->vertices[3 * triangle->vindices[2]]);	
-            
-    } // end for
-  glEnd();
-}
-
-
-GLMmodel * extractSubModel(GLMmodel * model, const std::map<int, TriangleIndex>& selectedTrianglesMap, char * name)
-{
-  GLMmodel * extrModel;
-  
-  // allocate a new model
-  extrModel = (GLMmodel*)malloc(sizeof(GLMmodel));
-  extrModel->pathname    = NULL;
-  extrModel->mtllibname    = NULL;
-  extrModel->numvertices   = 0;
-  extrModel->vertices    = NULL;
-  extrModel->numnormals    = 0;
-  extrModel->normals     = NULL;
-  extrModel->numtexcoords  = 0;
-  extrModel->texcoords       = NULL;
-  extrModel->numfacetnorms = 0;
-  extrModel->facetnorms    = NULL;
-  extrModel->numtriangles  = 0;
-  extrModel->triangles       = NULL;
-  extrModel->nummaterials  = 0;
-  extrModel->materials       = NULL;
-  extrModel->numgroups       = 0;
-  extrModel->groups      = NULL;
-  extrModel->position[0]   = model->position[0];
-  extrModel->position[1]   = model->position[1];
-  extrModel->position[2]   = model->position[2];
-
-  //cout<<"Position modèle = "<<extrModel->position[0]<<", "<<extrModel->position[1]<<", "<<extrModel->position[2]<<endl;
-  
-
-  
-  // Gettint the number of vertices, normals, texcoords and triangles
-
-  // VERTICES
-
-  // Building a vertices map to get the number of vertices + their values
-  //    map : index of the vertex in the WHOLE model --> (value of the vertex, index of the vertex in the EXTRACTED model)
-
-  std::map<GLuint, std::pair<Vec3d, GLuint> > selectedVerticesMap;
-
-
-  // Browsing the triangles map to find the number of vertices (getting rid of doublons)
-  
-  std::map<int, TriangleIndex>::const_iterator trianglesMapIter;
-
-  for (trianglesMapIter = selectedTrianglesMap.begin(); trianglesMapIter != selectedTrianglesMap.end(); ++trianglesMapIter)
-    {
-      // index of the corresponding triangle in the whole model
-      GLuint index = (trianglesMapIter->second).getIndex();
-
-      // finding the corresponding triangle in the whole model
-      GLMtriangle triangle = (model->triangles)[index];
-
-      // indexes of the 3 vertices of the triangle in the whole model
-      GLuint v1index, v2index, v3index;
-
-      v1index = triangle.vindices[0];
-      v2index = triangle.vindices[1];
-      v3index = triangle.vindices[2];
-
-      // values of the corresponding vertices
-      Vec3d v1, v2, v3;
-
-      for (int k = 0; k != 3; ++k)
-	{
-	  v1[k] = model->vertices[3*v1index + k];
-	  v2[k] = model->vertices[3*v2index + k];
-	  v3[k] = model->vertices[3*v3index + k];
-	}
-
-      // filling vertices map
-      //   for the moment, with a fake new index (to be corrected during the filling step)
-      selectedVerticesMap[v1index] = std::pair<Vec3d, GLuint>(v1, 0);
-      selectedVerticesMap[v2index] = std::pair<Vec3d, GLuint>(v2, 0);
-      selectedVerticesMap[v3index] = std::pair<Vec3d, GLuint>(v3, 0);
-    }
-  
-  extrModel->numvertices = (unsigned int)selectedVerticesMap.size();
-
-  //cout<<"numvertices = "<<extrModel->numvertices<<endl;
-  
-  // allocate memory
-  // !! CAREFUL : indexation begins at 1 !
-  extrModel->vertices = (GLfloat*)malloc(sizeof(GLfloat) *
-					 3 * (extrModel->numvertices + 1));
-
-  // filling
-  std::map<GLuint, std::pair<Vec3d, GLuint> >::iterator verticesMapIter;
-  unsigned short int j = 1;
-  for (verticesMapIter = selectedVerticesMap.begin(); verticesMapIter != selectedVerticesMap.end(); ++verticesMapIter)
-    {
-      // index of the vertex in the whole model
-      //GLuint index = verticesMapIter->first;
-      // corresponding vertex
-      Vec3d vertex = (verticesMapIter->second).first;
-      
-      // filling the vertices array of extrModel
-      for (int k = 0; k != 3; ++k)
-         extrModel->vertices[3*j + k] = (float)vertex[k];
-
-      // correcting the vertices map with the proper new index
-      (verticesMapIter->second).second = j;
-      
-      ++j;
-    }
-
-  
-  // TRIANGLES
-  extrModel->numtriangles = (unsigned int)selectedTrianglesMap.size();
-
-  //cout<<"numtriangles = "<<extrModel->numtriangles<<endl;
-  
-  // allocation
-  extrModel->triangles = (GLMtriangle*)malloc(sizeof(GLMtriangle) *
-					      extrModel->numtriangles);
-  // filling
-  //std::map<int, GLuint>::const_iterator trianglesMapIter;
-  //unsigned short j = 0;
-  j = 0;
-  for (trianglesMapIter = selectedTrianglesMap.begin(); trianglesMapIter != selectedTrianglesMap.end(); ++trianglesMapIter)
-    {
-      // index of the corresponding triangle in the whole model
-      int index = trianglesMapIter->first;
-
-      //cout<<"index = "<<index<<endl;
-      
-      // building the corresponding triangle
-      GLMtriangle triangle;
-
-      for (int k = 0; k != 3; ++k)
-	{
-	  GLuint oldVindk = (model->triangles[index]).vindices[k]; 
-	  triangle.vindices[k] = (selectedVerticesMap[oldVindk]).second;
-	  triangle.nindices[k] = (model->triangles[index]).nindices[k];
-	  triangle.tindices[k] = (model->triangles[index]).tindices[k];
-	}
-      triangle.findex = (model->triangles[index]).findex;
-
-      // filling the triangles array of extrModel
-      extrModel->triangles[j] = triangle;
-      
-      ++j;
-    }
-
-  
-
-
-  // GROUPS
-  extrModel->numgroups = 1;
-
-  // allocate memory
-  extrModel->groups = (GLMgroup*)malloc(sizeof(GLMgroup) *
-					extrModel->numgroups);
-
-  (extrModel->groups)->name = (char*)malloc(sizeof(char) * strlen(name) + 1);
-
-  (extrModel->groups)->triangles = (GLuint*)malloc(sizeof(GLuint) *
-						   extrModel->numtriangles);
-
-  // filling
-
-  //(extrModel->groups)->name = NULL;//"scalp";
-  strcpy((extrModel->groups)->name, name);
-  
-  (extrModel->groups)->numtriangles = extrModel->numtriangles;
-
-  for (GLuint i = 0; i != extrModel->numtriangles; ++i)
-    {
-      ((extrModel->groups)->triangles)[i] = i;
-    }
-  
-  (extrModel->groups)->material = 0;
-  (extrModel->groups)->next = NULL;
-
-
-  
-  //glmFacetNormals(extrModel);
-  
-  /*
-    if (extrModel->numnormals)
-    {
-    extrModel->normals = (GLfloat*)malloc(sizeof(GLfloat) *
-    3 * (extrModel->numnormals + 1));
-    }
-  
-    if (extrModel->numtexcoords)
-    {
-    extrModel->texcoords = (GLfloat*)malloc(sizeof(GLfloat) *
-    2 * (extrModel->numtexcoords + 1));
-    }
-  */
-  return extrModel;
-}
-
-
-//void glmBuildNeighborsMap(GLMmodel * model, std::map<GLuint, TriangleIDVector>& neighborsMap)
-void glmBuildNeighborsMap(GLMmodel * model, std::map<GLuint, TriangleIDTriplet>& neighborsMap)
-{
-  std::map<Edge, TriangleIDVector> adjacencyMap;
-  GLMtriangle triangle;
-  int v0, v1, v2;
-
-  // Clearing the neigborsMap
-  neighborsMap.clear();
-  
-  // Building an adjacent map based on the edges
-  
-  for (GLuint i = 0; i != model->numtriangles; ++i)
-    {
-      // Current triangle
-      triangle = model->triangles[i];
-
-      // The 3 vertices of the triangle
-      v0 = triangle.vindices[0];
-      v1 = triangle.vindices[1];
-      v2 = triangle.vindices[2];
-
-      // Filling the adjacency map
-      Edge e0(v0, v1);
-      Edge e1(v1, v2);
-      Edge e2(v2, v0);
-      
-      adjacencyMap[e0].push_back(TriangleIndex(i));
-      adjacencyMap[e1].push_back(TriangleIndex(i));
-      adjacencyMap[e2].push_back(TriangleIndex(i));
-    }
-  
-  /*
-  // Showing the adjacency map
-  cout<<endl<<"Adjacency map"<<endl;
-  cout<<"size = "<<adjacencyMap.size()<<endl;
-  for (std::map<Edge, TriangleIDVector>::const_iterator it = adjacencyMap.begin(); it != adjacencyMap.end(); ++it)
-  {
-  cout<<"Edge "<<it->first;
-  for (TriangleIDVector::const_iterator it2 = (it->second).begin(); it2 != (it->second).end(); ++it2)
-  cout<<it2->getIndex()<<" ";
-  cout<<endl;
-  }
-  */
-  
-  // Building the neighbors map from the adjacent map
-  for (GLuint i = 0; i != model->numtriangles; ++i)
-    {
-      //cout<<endl<<"i = "<<i<<" *************"<<endl;
-      // Current triangle
-      triangle = model->triangles[i];
-
-      // The 3 vertices of the triangle
-      v0 = triangle.vindices[0];
-      v1 = triangle.vindices[1];
-      v2 = triangle.vindices[2];
-
-      // The vector that contains all the triangles adjacent to the current one
-      //   (with no doublon)
-      //TriangleIDVector concat;
-      TriangleIDTriplet concat;
-      
-      // Filling this concac vector using the adjacency map
-
-      TriangleIDVector::const_iterator iter;
-
-      // First edge *****************************
-      TriangleIDVector adj = adjacencyMap[Edge(v0, v1)];
-      assert((adj.size() > 0) && (adj.size() <= 2));
-
-      if (adj.size() == 1)
-	{
-	  assert((adj.begin())->getIndex() == i);
-	  //concat.push_back(TriangleIndex(EMPTY_TRIANGLE));
-	  concat.setFirstIndex(TriangleIndex(EMPTY_TRIANGLE));
-	}
-      else
-	{
-	  for (iter = adj.begin(); iter != adj.end(); ++iter)
-	    {
-	      if (iter->getIndex() != i)
-		//concat.push_back(*iter);
-		concat.setFirstIndex(*iter);
-	    }
-	}
-      
-      
-      // Second edge *****************************
-      adj = adjacencyMap[Edge(v1, v2)];
-      assert((adj.size() > 0) && (adj.size() <= 2));
-
-     
-      if (adj.size() == 1)
-	{
-	  assert((adj.begin())->getIndex() == i);
-	  //concat.push_back(TriangleIndex(EMPTY_TRIANGLE));
-	  concat.setSecondIndex(TriangleIndex(EMPTY_TRIANGLE));
-	}
-      else
-	{
-	  for (iter = adj.begin(); iter != adj.end(); ++iter)
-	    {
-	      if (iter->getIndex() != i)
-		//concat.push_back(*iter);
-		concat.setSecondIndex(*iter);
-	    }
-	}
-      
-      
-      // Third edge *****************************
-      adj = adjacencyMap[Edge(v2, v0)];
-      assert((adj.size() > 0) && (adj.size() <= 2));
-
-      if (adj.size() == 1)
-	{
-	  assert((adj.begin())->getIndex() == i);
-	  //concat.push_back(TriangleIndex(EMPTY_TRIANGLE));
-	  concat.setThirdIndex(TriangleIndex(EMPTY_TRIANGLE));
-	}
-      else
-	{
-	  for (iter = adj.begin(); iter != adj.end(); ++iter)
-	    {
-	      if (iter->getIndex() != i)
-		//concat.push_back(*iter);
-		concat.setThirdIndex(*iter);
-	    }
-	}
-      
-      //cout<<"concat.size = "<<concat.size()<<endl;
-      //assert(concat.size() == 3);
-
-      // Filling the neighbors map
-      /*
-      for (iter = concat.begin(); iter != concat.end(); ++iter)
-	{
-	  neighborsMap[i].push_back(*iter);
-	}
-      assert(neighborsMap[i].size() == 3);
-      */
-      neighborsMap[i] = concat;
-    }
-
-  
-  // Showing the neighbors map
-  cout<<endl<<"Neighbors map"<<endl;
-  cout<<"size = "<<(unsigned int)neighborsMap.size()<<endl;
-  for (std::map<GLuint, TriangleIDTriplet>::const_iterator nit = neighborsMap.begin(); nit != neighborsMap.end(); ++nit)
-    {
-      cout<<"Triangle "<<nit->first<<" : ";
-      cout<<nit->second;
-      cout<<endl;
-    }
-  
-}
-
-/*
-  void glmBuildEdgePointsMap(GLMmodel * model, std::map<int, qglviewer::Vec>& edgePointsMap)
-  {
-  std::map<Edge, TriangleIDVector> adjacencyMap;
-  GLMtriangle triangle;
-  int v0, v1, v2;
-
-  // Clearing the edgesPointMap
-  edgePointsMap.clear();
-  
-  // Building an adjacent map based on the edges
-  
-  for (GLuint i = 0; i != model->numtriangles; ++i)
-  {
-  // Current triangle
-  triangle = model->triangles[i];
-
-  // The 3 vertices of the triangle
-  v0 = triangle.vindices[0];
-  v1 = triangle.vindices[1];
-  v2 = triangle.vindices[2];
-
-  // Filling the adjacency map
-  Edge e0(v0, v1);
-  Edge e1(v1, v2);
-  Edge e2(v2, v0);
-      
-  adjacencyMap[e0].push_back(TriangleIndex(i));
-  adjacencyMap[e1].push_back(TriangleIndex(i));
-  adjacencyMap[e2].push_back(TriangleIndex(i));
-  }
-  
-  //
-  //// Showing the adjacency map
-  //cout<<endl<<"Adjacency map"<<endl;
-  //cout<<"size = "<<adjacencyMap.size()<<endl;
-  //for (std::map<Edge, TriangleIDVector>::const_iterator it = adjacencyMap.begin(); it != adjacencyMap.end(); ++it)
-  //{
-  //cout<<"Edge "<<it->first;
-  //for (TriangleIDVector::const_iterator it2 = (it->second).begin(); it2 != (it->second).end(); ++it2)
-  //cout<<it2->getIndex()<<" ";
-  //cout<<endl;
-  //}
-  
-  // Building the edge points map from the adjacent map
-  std::map<Edge, TriangleIDVector>::const_iterator it;
-  for (it = adjacencyMap.begin(); it != adjacencyMap.end(); ++it)
-  {
-  Edge ed = it->first;
-      
-  TriangleIDVector triangleVec = it->second;
-  int nbAdjacentTriangles = triangleVec.size();
-
-  assert((nbAdjacentTriangles > 0) && (nbAdjacentTriangles <= 2));
-
-  if (nbAdjacentTriangles == 1)
-  {
-  // Inserting the points of the corresponding edge in the Edge Points Map
-  GLuint p1, p2;
-  qglviewer::Vec pos1, pos2;
-  p1 = ed.first;
-  p2 = ed.second;
-
-  assert((p1 <= model->numvertices) && (p2 <= model->numvertices));
-
-  for (int k = 0; k != 3; ++k)
-  {
-  pos1[k] = model->vertices[3*p1 + k];
-  pos2[k] = model->vertices[3*p2 + k];
-  }
-
-  edgePointsMap[p1] = pos1;
-  edgePointsMap[p2] = pos2;
-  }
-  }
-  }
-*/
-
-
-/* glmList: Generates and returns a display list for the model using
- * the mode specified.
- *
- * model - initialized GLMmodel structure
- * mode  - a bitwise OR of values describing what is to be rendered.
- *             GLM_NONE     -  render with only vertices
- *             GLM_FLAT     -  render with facet normals
- *             GLM_SMOOTH   -  render with vertex normals
- *             GLM_TEXTURE  -  render with texture coords
- *             GLM_COLOR    -  render with colors (color material)
- *             GLM_MATERIAL -  render with materials
- *             GLM_COLOR and GLM_MATERIAL should not both be specified.  
- * GLM_FLAT and GLM_SMOOTH should not both be specified.  
-
- */
-GLuint
-glmList(GLMmodel* model, GLuint mode)
-{
-  // AJOUT FLO
-  float color[3] = {1.0f, 1.0f, 1.0f};
-  //
-  
-  GLuint list;
-    
-  list = glGenLists(1);
-  glNewList(list, GL_COMPILE);
-  glmDraw(model, mode, color);
-  glEndList();
-    
-  return list;
-}
-
-/* glmWeld: eliminate (weld) vectors that are within an epsilon of
- * each other.
- *
- * model   - initialized GLMmodel structure
- * epsilon     - maximum difference between vertices
- *               ( 0.00001 is a good start for a unitized model)
- *
- */
-GLvoid
-glmWeld(GLMmodel* model, GLfloat epsilon)
-{
-    GLfloat* vectors;
-    GLfloat* copies;
-    GLuint   numvectors;
-    GLuint   i;
-    
-    /* vertices */
-    numvectors = model->numvertices;
-    vectors  = model->vertices;
-    copies = glmWeldVectors(vectors, &numvectors, epsilon);
-    
-#if 1
-    printf("glmWeld(): %d redundant vertices.\n", 
-        model->numvertices - numvectors - 1);
-#endif
-    
-    for (i = 0; i < model->numtriangles; i++) {
-        T(i).vindices[0] = (GLuint)vectors[3 * T(i).vindices[0] + 0];
-        T(i).vindices[1] = (GLuint)vectors[3 * T(i).vindices[1] + 0];
-        T(i).vindices[2] = (GLuint)vectors[3 * T(i).vindices[2] + 0];
-    }
-    
-    /* free space for old vertices */
-    free(vectors);
-    
-    /* allocate space for the new vertices */
-    model->numvertices = numvectors;
-    model->vertices = (GLfloat*)malloc(sizeof(GLfloat) * 
-        3 * (model->numvertices + 1));
-    
-    /* copy the optimized vertices into the actual vertex list */
-    for (i = 1; i <= model->numvertices; i++) {
-        model->vertices[3 * i + 0] = copies[3 * i + 0];
-        model->vertices[3 * i + 1] = copies[3 * i + 1];
-        model->vertices[3 * i + 2] = copies[3 * i + 2];
-    }
-    
-    free(copies);
-}
-
-/* glmReadPPM: read a PPM raw (type P6) file.  The PPM file has a header
-
- * that should look something like:
-
- *
-
- *    P6
-
- *    # comment
-
- *    width height max_value
-
- *    rgbrgbrgb...
-
- *
-
- * where "P6" is the magic cookie which identifies the file type and
-
- * should be the only characters on the first line followed by a
-
- * carriage return.  Any line starting with a # mark will be treated
-
- * as a comment and discarded.   After the magic cookie, three integer
-
- * values are expected: width, height of the image and the maximum
-
- * value for a pixel (max_value must be < 256 for PPM raw files).  The
-
- * data section consists of width*height rgb triplets (one byte each)
-
- * in binary format (i.e., such as that written with fwrite() or
-
- * equivalent).
-
- *
-
- * The rgb data is returned as an array of unsigned chars (packed
-
- * rgb).  The malloc()'d memory should be free()'d by the caller.  If
-
- * an error occurs, an error message is sent to stderr and NULL is
-
- * returned.
-
- *
-
- * filename   - name of the .ppm file.
-
- * width      - will contain the width of the image on return.
-
- * height     - will contain the height of the image on return.
-
- *
-
- */
-
-GLubyte* 
-
-glmReadPPM(char* filename, int* width, int* height)
-
-{
-
-    FILE* fp;
-
-    int i, w, h, d;
-
-    unsigned char* image;
-
-    char head[70];          /* max line <= 70 in PPM (per spec). */
-
-    
-
-    fp = fopen(filename, "rb");
-
-    if (!fp) {
-
-        perror(filename);
-
-        return NULL;
-
-    }
-
-    
-
-    /* grab first two chars of the file and make sure that it has the
-
-       correct magic cookie for a raw PPM file. */
-
-    fgets(head, 70, fp);
-
-    if (strncmp(head, "P6", 2)) {
-
-        fprintf(stderr, "%s: Not a raw PPM file\n", filename);
-
-        return NULL;
-
-    }
-
-    
-
-    /* grab the three elements in the header (width, height, maxval). */
-
-    i = 0;
-
-    while(i < 3) {
-
-        fgets(head, 70, fp);
-
-        if (head[0] == '#')     /* skip comments. */
-
-            continue;
-
-        if (i == 0)
-
-            i += sscanf(head, "%d %d %d", &w, &h, &d);
-
-        else if (i == 1)
-
-            i += sscanf(head, "%d %d", &h, &d);
-
-        else if (i == 2)
-
-            i += sscanf(head, "%d", &d);
-
-    }
-
-    
-
-    /* grab all the image data in one fell swoop. */
-
-    image = (unsigned char*)malloc(sizeof(unsigned char)*w*h*3);
-
-    fread(image, sizeof(unsigned char), w*h*3, fp);
-
-    fclose(fp);
-
-    
-
-    *width = w;
-
-    *height = h;
-
-    return image;
-
-}
-
-
-#if 0
-/* normals */
-if (model->numnormals) {
-    numvectors = model->numnormals;
-    vectors  = model->normals;
-    copies = glmOptimizeVectors(vectors, &numvectors);
-    
-    printf("glmOptimize(): %d redundant normals.\n", 
-        model->numnormals - numvectors);
-    
-    for (i = 0; i < model->numtriangles; i++) {
-        T(i).nindices[0] = (GLuint)vectors[3 * T(i).nindices[0] + 0];
-        T(i).nindices[1] = (GLuint)vectors[3 * T(i).nindices[1] + 0];
-        T(i).nindices[2] = (GLuint)vectors[3 * T(i).nindices[2] + 0];
-    }
-    
-    /* free space for old normals */
-    free(vectors);
-    
-    /* allocate space for the new normals */
-    model->numnormals = numvectors;
-    model->normals = (GLfloat*)malloc(sizeof(GLfloat) * 
-        3 * (model->numnormals + 1));
-    
-    /* copy the optimized vertices into the actual vertex list */
-    for (i = 1; i <= model->numnormals; i++) {
-        model->normals[3 * i + 0] = copies[3 * i + 0];
-        model->normals[3 * i + 1] = copies[3 * i + 1];
-        model->normals[3 * i + 2] = copies[3 * i + 2];
-    }
-    
-    free(copies);
-}
-
-/* texcoords */
-if (model->numtexcoords) {
-    numvectors = model->numtexcoords;
-    vectors  = model->texcoords;
-    copies = glmOptimizeVectors(vectors, &numvectors);
-    
-    printf("glmOptimize(): %d redundant texcoords.\n", 
-        model->numtexcoords - numvectors);
-    
-    for (i = 0; i < model->numtriangles; i++) {
-        for (j = 0; j < 3; j++) {
-            T(i).tindices[j] = (GLuint)vectors[3 * T(i).tindices[j] + 0];
-        }
-    }
-    
-    /* free space for old texcoords */
-    free(vectors);
-    
-    /* allocate space for the new texcoords */
-    model->numtexcoords = numvectors;
-    model->texcoords = (GLfloat*)malloc(sizeof(GLfloat) * 
-        2 * (model->numtexcoords + 1));
-    
-    /* copy the optimized vertices into the actual vertex list */
-    for (i = 1; i <= model->numtexcoords; i++) {
-        model->texcoords[2 * i + 0] = copies[2 * i + 0];
-        model->texcoords[2 * i + 1] = copies[2 * i + 1];
-    }
-    
-    free(copies);
-}
-#endif
-
-#if 0
-/* look for unused vertices */
-/* look for unused normals */
-/* look for unused texcoords */
-for (i = 1; i <= model->numvertices; i++) {
-    for (j = 0; j < model->numtriangles; i++) {
-        if (T(j).vindices[0] == i || 
-            T(j).vindices[1] == i || 
-            T(j).vindices[1] == i)
-            break;
-    }
-}
-#endif
diff --git a/extern/eltopo/common/meshes/ObjLoader.hpp b/extern/eltopo/common/meshes/ObjLoader.hpp
deleted file mode 100644
index 92e1e12..0000000
--- a/extern/eltopo/common/meshes/ObjLoader.hpp
+++ /dev/null
@@ -1,351 +0,0 @@
-#ifndef OBJ__LOADER
-#define OBJ__LOADER
-
-
-/*    
-      glm.h
-      Nate Robins, 1997, 2000
-      nate at pobox.com, http://www.pobox.com/~nate
- 
-      Wavefront OBJ model file format reader/writer/manipulator.
-
-      Includes routines for generating smooth normals with
-      preservation of edges, welding redundant vertices & texture
-      coordinate generation (spheremap and planar projections) + more.
-
- */
-
-#include "stdlib.h"
-#ifdef __APPLE__
-#include <GLUT/glut.h>
-#else
-#include <GL/glut.h>
-#endif
-#include <map>
-#include "TriangleIndex.hpp"
-#include "Edge.hpp"
-//#include <QGLViewer/vec.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265f
-#endif
-
-#define GLM_NONE     (0)            /* render with only vertices */
-#define GLM_FLAT     (1 << 0)       /* render with facet normals */
-#define GLM_SMOOTH   (1 << 1)       /* render with vertex normals */
-#define GLM_TEXTURE  (1 << 2)       /* render with texture coords */
-#define GLM_COLOR    (1 << 3)       /* render with colors */
-#define GLM_MATERIAL (1 << 4)       /* render with materials */
-#define GLM_LINE     (1 << 5)	    /* render with glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) */
-
-
-
-/* GLMmaterial: Structure that defines a material in a model. 
- */
-typedef struct _GLMmaterial
-{
-  char* name;                   /* name of material */
-  GLfloat diffuse[4];           /* diffuse component */
-  GLfloat ambient[4];           /* ambient component */
-  GLfloat specular[4];          /* specular component */
-  GLfloat emmissive[4];         /* emmissive component */
-  GLfloat shininess;            /* specular exponent */
-  GLint idTex;            		/* texture id */
-} GLMmaterial;
-
-/* GLMtriangle: Structure that defines a triangle in a model.
- */
-typedef struct _GLMtriangle {
-  GLuint vindices[3];           /* array of triangle vertex indices */
-  GLuint nindices[3];           /* array of triangle normal indices */
-  GLuint tindices[3];           /* array of triangle texcoord indices*/
-  GLuint findex;                /* index of triangle facet normal */
-} GLMtriangle;
-
-/* GLMgroup: Structure that defines a group in a model.
- */
-typedef struct _GLMgroup {
-  char*             name;           /* name of this group */
-  GLuint            numtriangles;   /* number of triangles in this group */
-  GLuint*           triangles;      /* array of triangle indices */
-  GLuint            material;       /* index to material for group */
-  struct _GLMgroup* next;           /* pointer to next group in model */
-} GLMgroup;
-
-/* GLMmodel: Structure that defines a model.
- */
-typedef struct _GLMmodel {
-  char*    pathname;            /* path to this model */
-  char*    mtllibname;          /* name of the material library */
-
-  GLuint   numvertices;         /* number of vertices in model */
-  GLfloat* vertices;            /* array of vertices  */
-
-  GLuint   numnormals;          /* number of normals in model */
-  GLfloat* normals;             /* array of normals */
-
-  GLuint   numtexcoords;        /* number of texcoords in model */
-  GLfloat* texcoords;           /* array of texture coordinates */
-
-  GLuint   numfacetnorms;       /* number of facetnorms in model */
-  GLfloat* facetnorms;          /* array of facetnorms */
-
-  GLuint       numtriangles;    /* number of triangles in model */
-  GLMtriangle* triangles;       /* array of triangles */
-
-  GLuint       nummaterials;    /* number of materials in model */
-  GLMmaterial* materials;       /* array of materials */
-
-  GLuint       numgroups;       /* number of groups in model */
-  GLMgroup*    groups;          /* linked list of groups */
-
-  GLfloat position[3];          /* position of the model */
-
-} GLMmodel;
-
-
-/* glmUnitize: "unitize" a model by translating it to the origin and
- * scaling it to fit in a unit cube around the origin.  Returns the
- * scalefactor used.
- *
- * model - properly initialized GLMmodel structure 
- */
-GLfloat
-glmUnitize(GLMmodel* model);
-
-/* glmDimensions: Calculates the dimensions (width, height, depth) of
- * a model.
- *
- * model      - initialized GLMmodel structure
- * dimensions - array of 3 GLfloats (GLfloat dimensions[3])
- */
-GLvoid
-glmDimensions(GLMmodel* model, GLfloat* dimensions);
-
-/* glmScale: Scales a model by a given amount.
- * 
- * model - properly initialized GLMmodel structure
- * scale - scalefactor (0.5 = half as large, 2.0 = twice as large)
- */
-GLvoid
-glmScale(GLMmodel* model, GLfloat scale);
-
-/* glmTranslate: Translates along direction d a model by a given amount.
- * 
- * model - properly initialized GLMmodel structure
- * transl - translationfactor 
- */
-GLvoid
-glmTranslate(GLMmodel* model, GLfloat transl, int d);
-
-/* glmReverseWinding: Reverse the polygon winding for all polygons in
- * this model.  Default winding is counter-clockwise.  Also changes
- * the direction of the normals.
- * 
- * model - properly initialized GLMmodel structure 
- */
-GLvoid
-glmReverseWinding(GLMmodel* model);
-
-/* glmFacetNormals: Generates facet normals for a model (by taking the
- * cross product of the two vectors derived from the sides of each
- * triangle).  Assumes a counter-clockwise winding.
- *
- * model - initialized GLMmodel structure
- */
-GLvoid
-glmFacetNormals(GLMmodel* model);
-
-/* glmVertexNormals: Generates smooth vertex normals for a model.
- * First builds a list of all the triangles each vertex is in.  Then
- * loops through each vertex in the the list averaging all the facet
- * normals of the triangles each vertex is in.  Finally, sets the
- * normal index in the triangle for the vertex to the generated smooth
- * normal.  If the dot product of a facet normal and the facet normal
- * associated with the first triangle in the list of triangles the
- * current vertex is in is greater than the cosine of the angle
- * parameter to the function, that facet normal is not added into the
- * average normal calculation and the corresponding vertex is given
- * the facet normal.  This tends to preserve hard edges.  The angle to
- * use depends on the model, but 90 degrees is usually a good start.
- *
- * model - initialized GLMmodel structure
- * angle - maximum angle (in degrees) to smooth across
- */
-GLvoid
-glmVertexNormals(GLMmodel* model, GLfloat angle);
-
-/* glmLinearTexture: Generates texture coordinates according to a
- * linear projection of the texture map.  It generates these by
- * linearly mapping the vertices onto a square.
- *
- * model - pointer to initialized GLMmodel structure
- */
-GLvoid
-glmLinearTexture(GLMmodel* model);
-
-/* glmSpheremapTexture: Generates texture coordinates according to a
- * spherical projection of the texture map.  Sometimes referred to as
- * spheremap, or reflection map texture coordinates.  It generates
- * these by using the normal to calculate where that vertex would map
- * onto a sphere.  Since it is impossible to map something flat
- * perfectly onto something spherical, there is distortion at the
- * poles.  This particular implementation causes the poles along the X
- * axis to be distorted.
- *
- * model - pointer to initialized GLMmodel structure
- */
-GLvoid
-glmSpheremapTexture(GLMmodel* model);
-
-/* glmDelete: Deletes a GLMmodel structure.
- *
- * model - initialized GLMmodel structure
- */
-GLvoid
-glmDelete(GLMmodel* model);
-
-/* glmReadOBJ: Reads a model description from a Wavefront .OBJ file.
- * Returns a pointer to the created object which should be free'd with
- * glmDelete().
- *
- * filename - name of the file containing the Wavefront .OBJ format data.  
- */
-GLMmodel* 
-glmReadOBJ(char* filename, GLuint texId = 1);
-
-/* glmWriteOBJ: Writes a model description in Wavefront .OBJ format to
- * a file.
- *
- * model    - initialized GLMmodel structure
- * filename - name of the file to write the Wavefront .OBJ format data to
- * mode     - a bitwise or of values describing what is written to the file
- *            GLM_NONE    -  write only vertices
- *            GLM_FLAT    -  write facet normals
- *            GLM_SMOOTH  -  write vertex normals
- *            GLM_TEXTURE -  write texture coords
- *            GLM_FLAT and GLM_SMOOTH should not both be specified.
- */
-GLvoid
-glmWriteOBJ(GLMmodel* model, char* filename, GLuint mode);
-
-/* glmDraw: Renders the model to the current OpenGL context using the
- * mode specified.
- *
- * model    - initialized GLMmodel structure
- * mode     - a bitwise OR of values describing what is to be rendered.
- *            GLM_NONE    -  render with only vertices
- *            GLM_FLAT    -  render with facet normals
- *            GLM_SMOOTH  -  render with vertex normals
- *            GLM_TEXTURE -  render with texture coords
- *            GLM_FLAT and GLM_SMOOTH should not both be specified.
- */
-GLvoid
-//glmDraw(GLMmodel* model, GLuint mode, const bool names = false, const int selectTriangle = -1);
-glmDraw(GLMmodel* model, GLuint mode, const float basisColor[3], const float alpha = 1, const bool names = false, std::map<int, TriangleIndex> map = std::map<int, TriangleIndex>());
-
-// FLO
-GLvoid
-glmDrawSelectedTriangles(GLMmodel* model, GLuint mode, std::map<int, TriangleIndex> * selectedTriangles);
-
-// Extraction and creation of a submodel from a global model
-GLMmodel * extractSubModel(GLMmodel * model, const std::map<int, TriangleIndex>& selectedTrianglesMap, char * name);
-
-
-// Builds a map containing for each triangle a triplet which indicates its neighbours adjacent to each edge
-void glmBuildNeighborsMap(GLMmodel * model, std::map<GLuint, TriangleIDTriplet>& neighborsMap);
-
-// Builds a map containing the positions of the points lying on the edge of the mesh model
-//  The map associates a point ID to its 3D position
-//void glmBuildEdgePointsMap(GLMmodel * model, std::map<int, qglviewer::Vec>& edgePointsMap);
-
-// --
-
-/* glmList: Generates and returns a display list for the model using
- * the mode specified.
- *
- * model    - initialized GLMmodel structure
- * mode     - a bitwise OR of values describing what is to be rendered.
- *            GLM_NONE    -  render with only vertices
- *            GLM_FLAT    -  render with facet normals
- *            GLM_SMOOTH  -  render with vertex normals
- *            GLM_TEXTURE -  render with texture coords
- *            GLM_FLAT and GLM_SMOOTH should not both be specified.  
- */
-GLuint
-glmList(GLMmodel* model, GLuint mode);
-
-/* glmWeld: eliminate (weld) vectors that are within an epsilon of
- * each other.
- *
- * model      - initialized GLMmodel structure
- * epsilon    - maximum difference between vertices
- *              ( 0.00001 is a good start for a unitized model)
- *
- */
-GLvoid
-glmWeld(GLMmodel* model, GLfloat epsilon);
-
-/* glmReadPPM: read a PPM raw (type P6) file.  The PPM file has a header
-
- * that should look something like:
-
- *
-
- *    P6
-
- *    # comment
-
- *    width height max_value
-
- *    rgbrgbrgb...
-
- *
-
- * where "P6" is the magic cookie which identifies the file type and
-
- * should be the only characters on the first line followed by a
-
- * carriage return.  Any line starting with a # mark will be treated
-
- * as a comment and discarded.   After the magic cookie, three integer
-
- * values are expected: width, height of the image and the maximum
-
- * value for a pixel (max_value must be < 256 for PPM raw files).  The
-
- * data section consists of width*height rgb triplets (one byte each)
-
- * in binary format (i.e., such as that written with fwrite() or
-
- * equivalent).
-
- *
-
- * The rgb data is returned as an array of unsigned chars (packed
-
- * rgb).  The malloc()'d memory should be free()'d by the caller.  If
-
- * an error occurs, an error message is sent to stderr and NULL is
-
- * returned.
-
- *
-
- * filename   - name of the .ppm file.
-
- * width      - will contain the width of the image on return.
-
- * height     - will contain the height of the image on return.
-
- *
-
- */
-
-GLubyte* 
-
-glmReadPPM(char* filename, int* width, int* height);
-
-int glmInitTex(char *name);
-
-#endif
diff --git a/extern/eltopo/common/meshes/TriangleIndex.hpp b/extern/eltopo/common/meshes/TriangleIndex.hpp
deleted file mode 100644
index 075d72a..0000000
--- a/extern/eltopo/common/meshes/TriangleIndex.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef TRIANGLE__INDEX
-#define TRIANGLE__INDEX
-
-#include <iostream>
-#include <fstream>
-
-#include <vector>
-
-#define EMPTY_TRIANGLE 500000000
-
-class TriangleIndex
-{
-private :
-  GLuint i;
-public :
-   TriangleIndex() : i(EMPTY_TRIANGLE)
-   {}
-  
-  TriangleIndex(const GLuint x) : i(x)
-  {}
-
-  const GLuint getIndex() const
-  {
-    return i;
-  }
-
-  void setIndex(const GLuint x)
-  {
-    i = x;
-  }
-
-  const bool isEmpty() const
-  {
-    if (i == EMPTY_TRIANGLE)
-      return true;
-    else return false;
-  }
-
-  // ostream
-  friend std::ostream& operator << (std::ostream& out, const TriangleIndex& ind)
-  {
-    out << ind.getIndex();
-    return out;
-  }
-};
-
-class TriangleIDTriplet
-{
-private :
-  TriangleIndex i;
-  TriangleIndex j;
-  TriangleIndex k;
-
-public :
-  TriangleIDTriplet()
-   :
-   i ( TriangleIndex(EMPTY_TRIANGLE) ),
-   j ( TriangleIndex(EMPTY_TRIANGLE) ),
-   k ( TriangleIndex(EMPTY_TRIANGLE) )
-   {}
-
-  TriangleIDTriplet(const TriangleIndex x, const TriangleIndex y, const TriangleIndex z) : i(x), j(y), k(z)
-  {
-  }
-
-  const TriangleIndex getFirstIndex() const
-  {
-    return i;
-  }
-
-  const TriangleIndex getSecondIndex() const
-  {
-    return j;
-  }
-
-  const TriangleIndex getThirdIndex() const
-  {
-    return k;
-  }
-
-  void setFirstIndex(const TriangleIndex t)
-  {
-    i = t;
-  }
-
-  void setSecondIndex(const TriangleIndex t)
-  {
-    j = t;
-  }
-
-  void setThirdIndex(const TriangleIndex t)
-  {
-    k = t;
-  }  
-
-  // ostream
-  friend std::ostream& operator << (std::ostream& out, const TriangleIDTriplet& tr)
-  {
-    out << "[" << tr.getFirstIndex() << ", " << tr.getSecondIndex() << ", " <<tr.getThirdIndex() << "]";
-    return out;
-  }
-};
-
-typedef std::vector<TriangleIndex> TriangleIDVector;
-
-#endif
diff --git a/extern/eltopo/common/meshes/meshloader.cpp b/extern/eltopo/common/meshes/meshloader.cpp
deleted file mode 100644
index 3662227..0000000
--- a/extern/eltopo/common/meshes/meshloader.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "meshloader.h"
-#include <iostream>
-
-using namespace std;
-
-MeshLoader::MeshLoader(const std::string& filepath, MeshType type)  :
-   mesh(NULL)
-{
-   ifstream stream(filepath.c_str());
-   if (stream.good())
-   {
-      stream.close();
-
-      if(type == DEFAULT) {
-         std::string ending = filepath.substr(filepath.length()-3);
-         if(ending == "OBJ" || ending == "obj") {
-            type = OBJ;
-         }
-         else {
-            cout << "ERROR: Unrecognized file format: ." << ending << "\nAssuming OBJ type.\n";
-            type = OBJ;
-         }
-      }
-
-      if(type == OBJ) {
-         mesh = new ObjFile(filepath);
-      }
-      else {
-         cout << "ERROR: Unknown type parameter. Giving up.\n";
-         mesh = 0;
-      }
-   }
-   else 
-   {
-      assert(0);
-      stream.close();
-      mesh = 0;
-   }
-}
-
-void MeshLoader::get_triangles(std::vector<Vec3ui>& tris) const {
-   mesh->get_triangles(tris);
-}
-
-void MeshLoader::get_vertices(std::vector<Vec3d>& verts) const {
-   mesh->get_vertices(verts);
-}
-
-MeshLoader::~MeshLoader() {
-   delete mesh;
-}
-//------------------------------------------
-// OBJ File format
-//------------------------------------------
-
-ObjFile::ObjFile(const std::string& filepath) :
-   mesh( glmReadOBJ((char*)filepath.c_str()) )
-{
-}
-
-void ObjFile::get_triangles(std::vector<Vec3ui>& tris) const {
-   tris.clear();
-   for(unsigned int i = 0; i < mesh->numtriangles; ++i) {
-      _GLMtriangle triangle = mesh->triangles[i];
-      Vec3ui tri3ui(triangle.vindices[0]-1, triangle.vindices[1]-1, triangle.vindices[2]-1);
-      tris.push_back(tri3ui);
-   }
-}
-
-void ObjFile::get_vertices(std::vector<Vec3d>& verts) const {
-   verts.clear();
-   for(unsigned int i = 1; i <= mesh->numvertices; ++i) {
-      Vec3d vertex(
-         mesh->vertices[i*3],  
-         mesh->vertices[i*3+1],
-         mesh->vertices[i*3+2]);
-      verts.push_back( vertex );
-   }
-}
-
-ObjFile::~ObjFile() {
-   glmDelete(mesh);
-}
diff --git a/extern/eltopo/common/meshes/meshloader.h b/extern/eltopo/common/meshes/meshloader.h
deleted file mode 100644
index f6f3d1a..0000000
--- a/extern/eltopo/common/meshes/meshloader.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef MESH_LOADER_H
-#define MESH_LOADER_H
-
-#include "ObjLoader.hpp"
-
-#include <string>
-#include <vector>
-#include "vec.h"
-
-enum MeshType {DEFAULT, OBJ, PLY};
-
-class MeshFile;
-
-class MeshLoader 
-{
-   
-   MeshFile* mesh;
-   
-public:
-   MeshLoader(const std::string& file_path, MeshType type = DEFAULT);
-   ~MeshLoader();
-
-   void get_triangles(std::vector<Vec3ui>& tris) const;
-   void get_vertices(std::vector<Vec3d>& verts) const;
-
-private:
-   MeshLoader( const MeshLoader& );
-   MeshLoader operator=( const MeshLoader& );
-   
-};
-
-//base class for all mesh formats we want to support
-class MeshFile {
-public:
-   virtual void get_triangles(std::vector<Vec3ui>& tris) const = 0;
-   virtual void get_vertices(std::vector<Vec3d>& verts) const = 0;
-   virtual ~MeshFile() {}
-};
-
-//Alias Wavefront OBJ format, courtesy of Nate Robins glm.h
-class ObjFile : public MeshFile {
-   GLMmodel* mesh;
-public:
-   ObjFile(const std::string& file_path);
-   ~ObjFile();
-   void get_triangles(std::vector<Vec3ui>& tris) const;
-   void get_vertices(std::vector<Vec3d>& verts) const;
-   
-private:
-   ObjFile( const ObjFile& );
-   ObjFile operator=( const ObjFile& );
-};
-
-//UNC/Stanford's PLY format, courtesy of Greg Turk's PLY Tools
-/*
-class PlyFileData : public MeshFile {
-   // Couldn't call it just PlyFile since that name is used by the PLY Tools internally
-   std::vector<Vec3ui> stored_tris;
-   std::vector<Vec3d> stored_verts;
-   
-public:
-   PlyFileData(const std::string& file_path);
-   ~PlyFileData();
-   void get_triangles(std::vector<Vec3ui>& tris) const;
-   void get_vertices(std::vector<Vec3d>& verts) const;
-   
-};
-*/
-
-#endif
-
diff --git a/extern/eltopo/common/newparser.cpp b/extern/eltopo/common/newparser.cpp
deleted file mode 100644
index 9f70626..0000000
--- a/extern/eltopo/common/newparser.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-#include <newparser.h>
-#include <lexer.h>
-
-const ParseTree* ParseTree::
-get_branch(const std::string& name) const
-{
-    std::map<std::string,ParseTree>::const_iterator p=branches.find(name);
-    if(p==branches.end()) return 0;
-    else return &p->second;
-}
-
-bool ParseTree::remove_first_matching_branch( const std::string& name )
-{
-    std::map<std::string,ParseTree>::iterator p=branches.find(name);
-    if(p==branches.end()) return false;
-    branches.erase( p );
-    return true;
-}
-
-bool ParseTree::
-get_number(const std::string& name, double& result) const
-{
-    std::map<std::string,double>::const_iterator p=numbers.find(name);
-    if(p==numbers.end()) return false;
-    result=p->second;
-    return true;
-}
-
-bool ParseTree::
-get_int(const std::string& name, int& result) const
-{
-    double number;
-    if(get_number(name, number)){
-        result=(int)std::floor(number);
-        return true;
-    }else
-        return false;
-}
-
-bool ParseTree::
-get_string(const std::string& name, std::string& result) const
-{
-    std::map<std::string,std::string>::const_iterator p=strings.find(name);
-    if(p==strings.end()) return false;
-    result=p->second;
-    return true;
-}
-
-const Array1d* ParseTree::
-get_vector(const std::string& name) const
-{
-    std::map<std::string,Array1d>::const_iterator p=vectors.find(name);
-    if(p==vectors.end()) return 0;
-    else return &p->second;
-}
-
-bool ParseTree::
-get_vec2d(const std::string& name, Vec2d& v) const
-{
-    std::map<std::string,Array1d>::const_iterator p=vectors.find(name);
-    if(p==vectors.end()) return false;
-    if(p->second.n!=2){
-        std::cerr<<"Error: looking for 2d vector ["<<name<<"] but got dimension "<<p->second.n<<std::endl;
-        return false;
-    }
-    v[0]=p->second[0];
-    v[1]=p->second[1];
-    return true;
-}
-
-bool ParseTree::
-get_vec3d(const std::string& name, Vec3d& v) const
-{
-    std::map<std::string,Array1d>::const_iterator p=vectors.find(name);
-    if(p==vectors.end()) return false;
-    if(p->second.n!=3){
-        std::cerr<<"Error: looking for 3d vector ["<<name<<"] but got dimension "<<p->second.n<<std::endl;
-        return false;
-    }
-    v[0]=p->second[0];
-    v[1]=p->second[1];
-    v[2]=p->second[2];
-    return true;
-}
-
-namespace {
-    
-    bool parse_vector(Lexer& lexer, Array1d& v)
-    {
-        Token token;
-        v.resize(0);
-        for(;;){
-            lexer.read(token);
-            switch(token.type){
-                case TOKEN_EOF:
-                    std::cerr<<"Parse error: looking for closing bracket but hit end-of-file"<<std::endl;
-                    return false;
-                case TOKEN_ERROR:
-                    std::cerr<<"Lex error: cannot make sense of ["<<token.string_value<<"]"<<std::endl;
-                    return false;
-                case TOKEN_NUMBER:
-                    v.push_back(token.number_value);
-                    break;
-                case TOKEN_RIGHT_BRACKET:
-                    return true;
-                default:
-                    std::cerr<<"Parse error: looking for a number or a closing bracket, got unexpected token "<<token<<std::endl;
-                    return false;
-            }
-        }
-    }
-    
-    bool recursive_parse(Lexer& lexer, ParseTree& tree, bool root_level)
-    {
-        Token token;
-        std::string name;
-        for(;;){
-            lexer.read(token);
-            switch(token.type){
-                case TOKEN_EOF:
-                    if(!root_level){
-                        std::cerr<<"Parse error: looking for closing parenthesis but hit end-of-file"<<std::endl;
-                        return false;
-                    }else
-                        return true;
-                case TOKEN_ERROR:
-                    std::cerr<<"Lex error: cannot make sense of ["<<token.string_value<<"]"<<std::endl;
-                    return false;
-                case TOKEN_IDENTIFIER: case TOKEN_STRING:
-                    name=token.string_value;
-                    if(tree.branches.find(name)!=tree.branches.end()
-                       || tree.numbers.find(name)!=tree.numbers.end()
-                       || tree.strings.find(name)!=tree.strings.end()
-                       || tree.vectors.find(name)!=tree.vectors.end()){
-                        std::cerr<<"Parse error: name ["<<name<<"] appears multiple times in record"<<std::endl;
-                        return false;
-                    }
-                    break;
-                case TOKEN_RIGHT_PAREN:
-                    if(root_level){
-                        std::cerr<<"Parse error: hit closing parenthesis at root level"<<std::endl;
-                        return false;
-                    }else
-                        return true;
-                default:
-                    std::cerr<<"Parse error: looking for a name, got unexpected token "<<token<<std::endl;
-                    return false;
-            }
-            // we've now got the name, let's read the value
-            lexer.read(token);
-            switch(token.type){
-                case TOKEN_EOF:
-                    std::cerr<<"Parse error: looking for a value for ["<<name<<"] but hit end-of-file"<<std::endl;
-                    return false;
-                case TOKEN_ERROR:
-                    std::cerr<<"Lex error: cannot make sense of ["<<token.string_value<<"]"<<std::endl;
-                    return false;
-                case TOKEN_IDENTIFIER: case TOKEN_STRING:
-                    tree.strings.insert(std::make_pair(name, token.string_value));
-                    break;
-                case TOKEN_NUMBER:
-                    tree.numbers.insert(std::make_pair(name, token.number_value));
-                    break;
-                case TOKEN_LEFT_PAREN:
-                {
-                    ParseTree subtree;
-                    if(!recursive_parse(lexer, subtree, false)) return false;
-                    tree.branches.insert(std::make_pair(name, subtree));
-                }
-                    break;
-                case TOKEN_RIGHT_PAREN:
-                    std::cerr<<"Parse error: looking for a value for ["<<name<<"] but hit closing parenthesis"<<std::endl;
-                    return false;
-                case TOKEN_LEFT_BRACKET:
-                {
-                    Array1d v;
-                    if(!parse_vector(lexer, v)) return false;
-                    tree.vectors.insert(std::make_pair(name, v));
-                }
-                    break;
-                case TOKEN_RIGHT_BRACKET:
-                    std::cerr<<"Parse error: looking for a value for ["<<name<<"] but hit closing bracket"<<std::endl;
-                    return false;
-            }
-        }
-    }
-    
-}  // unnamed namespace
-
-
-bool parse_stream(std::istream& input, ParseTree& tree)
-{
-    Lexer lexer(input);
-    return recursive_parse(lexer, tree, true);
-}
diff --git a/extern/eltopo/common/newparser.h b/extern/eltopo/common/newparser.h
deleted file mode 100644
index 7bb01fd..0000000
--- a/extern/eltopo/common/newparser.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef NEWPARSER_H
-#define NEWPARSER_H
-
-#include <iostream>
-#include <map>
-#include <string>
-#include <array1.h>
-#include <vec.h>
-
-struct ParseTree
-{
-    ParseTree() :
-    branches(),
-    numbers(),
-    strings(),
-    vectors()
-    {}
-    
-    std::map<std::string, ParseTree> branches;
-    std::map<std::string, double> numbers;
-    std::map<std::string, std::string> strings;
-    std::map<std::string, Array1d> vectors;
-    
-    const ParseTree* get_branch(const std::string& name) const;
-    bool get_number(const std::string& name, double& result) const;
-    bool get_int(const std::string& name, int& result) const;
-    bool get_string(const std::string& name, std::string& result) const;
-    const Array1d* get_vector(const std::string& name) const;
-    bool get_vec2d(const std::string& name, Vec2d& v) const;
-    bool get_vec3d(const std::string& name, Vec3d& v) const;
-    
-    bool remove_first_matching_branch( const std::string& name );
-    
-};
-
-std::ostream& operator<<(std::ostream& out, const ParseTree& tree);
-
-// return true if no errors occur
-bool parse_stream(std::istream& input, ParseTree& tree);
-
-#endif
-
diff --git a/extern/eltopo/common/newsparse/dense_matrix.cpp b/extern/eltopo/common/newsparse/dense_matrix.cpp
deleted file mode 100644
index 2d09846..0000000
--- a/extern/eltopo/common/newsparse/dense_matrix.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <dense_matrix.h>
-#include <blas_wrapper.h>
-#include <cstring>
-
-void DenseMatrix::
-clear(void)
-{
-    m=n=0;
-    value.clear();
-}
-
-void DenseMatrix::
-set_zero(void)
-{
-    BLAS::set_zero(value);
-}
-
-void DenseMatrix::
-resize(int m_, int n_)
-{
-    m=m_; n=n_;
-    value.resize(m*n, 0);
-}
-
-void DenseMatrix::
-apply(const double *x, double *y) const
-{
-    assert(x && y);
-    BLAS::multiply_matrix_vector(m, n, &value[0], x, y);
-}
-
-void DenseMatrix::
-apply_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y);
-    if(y!=z) BLAS::copy(m, y, z);
-    BLAS::multiply_matrix_vector(BLAS::NoTrans, m, n, -1, &value[0], m, x, 1, 1, z);
-}
-
-void DenseMatrix::
-apply_transpose(const double *x, double *y) const
-{
-    assert(x && y);
-    BLAS::multiply_matrix_vector(BLAS::Trans, m, n, 1, &value[0], m, x, 1, 0, y);
-}
-
-void DenseMatrix::
-apply_transpose_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y);
-    if(y!=z) BLAS::copy(n, y, z);
-    BLAS::multiply_matrix_vector(BLAS::Trans, m, n, -1, &value[0], m, x, 1, 1, z);
-}
-
-void DenseMatrix::
-write_matlab(std::ostream &output, const char *variable_name) const
-{
-    output<<variable_name<<"=[";
-    std::streamsize old_precision=output.precision();
-    output.precision(18);
-    for(int i=0; i<m; ++i){
-        if(i>0) output<<" ";
-        for(int j=0; j<n-1; ++j) output<<value[i+j*m]<<" ";
-        output<<value[i+(n-1)*m];
-        if(i<m-1) output<<std::endl;
-        else      output<<"];"<<std::endl;
-    }
-    output.precision(old_precision);
-}
-
-void transpose(const DenseMatrix &A, DenseMatrix &Atranspose)
-{
-    Atranspose.resize(A.n, A.m);
-    for(int j=0; j<A.n; ++j) for(int i=0; i<A.m; ++i){
-        Atranspose(j,i)=A(i,j);
-    }
-}
-
-void multiply(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &C)
-{
-    assert(A.n==B.m);
-    C.resize(A.m, B.n);
-    BLAS::multiply_matrix_matrix(A.m, A.n, B.m, &A.value[0], &B.value[0], &C.value[0]);
-}
-
-void multiply_with_transpose(const DenseMatrix &A, DenseMatrix &ATA)
-{
-    ATA.resize(A.n, A.n);
-    BLAS::multiply_matrix_matrix(BLAS::Trans, BLAS::NoTrans, A.n, A.n, A.m, 1, &A.value[0], A.m, &A.value[0], A.m,
-                                 0, &ATA.value[0], A.n);
-}
-
diff --git a/extern/eltopo/common/newsparse/dense_matrix.h b/extern/eltopo/common/newsparse/dense_matrix.h
deleted file mode 100644
index 5a147c4..0000000
--- a/extern/eltopo/common/newsparse/dense_matrix.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef DENSE_MATRIX_H
-#define DENSE_MATRIX_H
-
-#include <linear_operator.h>
-
-//============================================================================
-struct DenseMatrix: public LinearOperator
-{
-    std::vector<double> value;
-    
-    DenseMatrix(int m_=0)
-    : LinearOperator(m_, m_), value(m_*m_, 0)
-    {}
-    
-    DenseMatrix(int m_, int n_)
-    : LinearOperator(m_, n_), value(m_*n_, 0)
-    {}
-    
-    void clear(void);
-    void set_zero(void);
-    void resize(int m_, int n_);
-    
-    const double &operator()(int i, int j) const
-    {
-        assert(i>=0 && i<m && j>=0 && j<n);
-        return value[i+j*m];
-    }
-    
-    double &operator()(int i, int j)
-    {
-        assert(i>=0 && i<m && j>=0 && j<n);
-        return value[i+j*m];
-    }
-    
-    using LinearOperator::apply;
-    using LinearOperator::apply_and_subtract;
-    using LinearOperator::apply_transpose;
-    using LinearOperator::apply_transpose_and_subtract;
-    
-    virtual void apply(const double *input_vector, double *output_vector) const;
-    virtual void apply_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void apply_transpose(const double *input_vector, double *output_vector) const;
-    virtual void apply_transpose_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void write_matlab(std::ostream &output, const char *variable_name) const;
-};
-
-void transpose(const DenseMatrix &A, DenseMatrix &Atranspose);
-void multiply(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &C);
-void multiply_with_transpose(const DenseMatrix &A, DenseMatrix &ATA);
-
-#endif
diff --git a/extern/eltopo/common/newsparse/krylov_solvers.cpp b/extern/eltopo/common/newsparse/krylov_solvers.cpp
deleted file mode 100644
index 61b5867..0000000
--- a/extern/eltopo/common/newsparse/krylov_solvers.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-#include <krylov_solvers.h>
-#include <blas_wrapper.h>
-#include <cassert>
-
-//============================================================================
-KrylovSolverStatus CG_Solver::
-solve(const LinearOperator &A, const double *rhs, double *result,
-      const LinearOperator *preconditioner, bool use_given_initial_guess)
-{
-    const int n=A.m;
-    assert(A.n==n);
-    assert(preconditioner==0 || (preconditioner->m==n && preconditioner->n==n));
-    if((int)s.size()!=n){
-        r.resize(n);
-        z.resize(n);
-        s.resize(n);
-    }
-    // convergence tolerance
-    double tol=tolerance_factor*BLAS::abs_max(n, rhs);
-    // initial guess
-    if(use_given_initial_guess){
-        A.apply_and_subtract(result, rhs, &r[0]);
-    }else{
-        BLAS::set_zero(n, result);
-        BLAS::copy(n, rhs, &r[0]);
-    }
-    // check instant convergence
-    iteration=0;
-    residual_norm=BLAS::abs_max(r);
-    if(residual_norm==0) return status=KRYLOV_CONVERGED;
-    // set up CG
-    double rho;
-    if(preconditioner) preconditioner->apply(r, z); else BLAS::copy(r, z);
-    rho=BLAS::dot(r, z);
-    if(rho<=0 || rho!=rho) return status=KRYLOV_BREAKDOWN;
-    BLAS::copy(z, s);
-    // and iterate
-    for(iteration=1; iteration<max_iterations; ++iteration){
-        double alpha;
-        A.apply(s, z); // reusing z=A*s
-        double sz=BLAS::dot(s, z);
-        if(sz<=0 || sz!=sz) return status=KRYLOV_BREAKDOWN;
-        alpha=rho/sz;
-        BLAS::add_scaled(n, alpha, &s[0], result);
-        BLAS::add_scaled(-alpha, z, r);
-        residual_norm=BLAS::abs_max(r);
-        if(residual_norm<=tol) return status=KRYLOV_CONVERGED;
-        if(preconditioner) preconditioner->apply(r, z); else BLAS::copy(r, z);
-        double rho_new=BLAS::dot(r, z);
-        if(rho_new<=0 || rho_new!=rho_new) return status=KRYLOV_BREAKDOWN;
-        double beta=rho_new/rho;
-        BLAS::add_scaled(beta, s, z); s.swap(z); // s=beta*s+z
-        rho=rho_new;
-    }
-    return status=KRYLOV_EXCEEDED_MAX_ITERATIONS;
-}
-
-//============================================================================
-KrylovSolverStatus MINRES_CR_Solver::
-solve(const LinearOperator &A, const double *rhs, double *result,
-      const LinearOperator *preconditioner, bool use_given_initial_guess)
-{
-    const int n=A.m;
-    assert(A.n==n);
-    assert(preconditioner==0 || (preconditioner->m==n && preconditioner->n==n));
-    if((int)s.size()!=n){
-        r.resize(n);
-        z.resize(n);
-        q.resize(n);
-        s.resize(n);
-        t.resize(n);
-    }
-    // convergence tolerance
-    double tol=tolerance_factor*BLAS::abs_max(n, rhs);
-    // initial guess
-    if(use_given_initial_guess){
-        A.apply_and_subtract(result, rhs, &r[0]);
-    }else{
-        BLAS::set_zero(n, result);
-        BLAS::copy(n, rhs, &r[0]);
-    }
-    // check instant convergence
-    iteration=0;
-    residual_norm=BLAS::abs_max(r);
-    if(residual_norm==0) return status=KRYLOV_CONVERGED;
-    // set up CR
-    double rho;
-    if(preconditioner) preconditioner->apply(r, z); else BLAS::copy(r, s);
-    A.apply(s, t);
-    rho=BLAS::dot(r, t);
-    if(rho==0 || rho!=rho) return status=KRYLOV_BREAKDOWN;
-    // and iterate
-    for(iteration=1; iteration<max_iterations; ++iteration){
-        double alpha;
-        double tt=BLAS::dot(t, t);
-        if(tt==0 || tt!=tt) return status=KRYLOV_BREAKDOWN;
-        alpha=rho/tt;
-        BLAS::add_scaled(n, alpha, &s[0], result);
-        BLAS::add_scaled(-alpha, t, r);
-        residual_norm=BLAS::abs_max(r);
-        if(residual_norm<=tol) return KRYLOV_CONVERGED;
-        if(preconditioner) preconditioner->apply(r, z);
-        else               BLAS::copy(r, z);
-        A.apply(z, q);
-        double rho_new=BLAS::dot(r, q);
-        if(rho_new==0 || rho_new!=rho_new) return KRYLOV_BREAKDOWN;
-        double beta=rho_new/rho;
-        BLAS::add_scaled(beta, s, z); s.swap(z); // s=beta*s+z
-        BLAS::add_scaled(beta, t, q); t.swap(q); // t=beta*t+q
-        rho=rho_new;
-    }
-    return KRYLOV_EXCEEDED_MAX_ITERATIONS;
-}
-
-//============================================================================
-KrylovSolverStatus CGNR_Solver::
-solve(const LinearOperator &A, const double *rhs, double *result,
-      const LinearOperator *preconditioner, bool use_given_initial_guess)
-{
-    const int m=A.m, n=A.n;
-    assert(preconditioner==0 || (preconditioner->m==n && preconditioner->n==n));
-    if((int)s.size()!=n){
-        r.resize(n);
-        z.resize(n);
-        s.resize(n);
-        u.resize(m);
-    }
-    // convergence tolerance
-    A.apply_transpose(rhs, &r[0]); // form A^T*rhs in r
-    double tol=tolerance_factor*BLAS::abs_max(r);
-    // initial guess
-    if(use_given_initial_guess){
-        A.apply_and_subtract(result, rhs, &u[0]);
-        A.apply_transpose(u, r);
-    }else{
-        BLAS::set_zero(n, result);
-    }
-    // check instant convergence
-    iteration=0;
-    residual_norm=BLAS::abs_max(r);
-    if(residual_norm==0) return status=KRYLOV_CONVERGED;
-    // set up CG
-    double rho;
-    if(preconditioner) preconditioner->apply(r, z); else BLAS::copy(r, z);
-    rho=BLAS::dot(r, z);
-    if(rho<=0 || rho!=rho) return status=KRYLOV_BREAKDOWN;
-    BLAS::copy(z, s);
-    // and iterate
-    for(iteration=1; iteration<max_iterations; ++iteration){
-        double alpha;
-        A.apply(s, u);
-        A.apply_transpose(u, z);
-        double sz=BLAS::dot(u, u);
-        if(sz<=0 || sz!=sz) return status=KRYLOV_BREAKDOWN;
-        alpha=rho/sz;
-        BLAS::add_scaled(n, alpha, &s[0], result);
-        BLAS::add_scaled(-alpha, z, r);
-        residual_norm=BLAS::abs_max(r);
-        if(residual_norm<=tol) return status=KRYLOV_CONVERGED;
-        if(preconditioner) preconditioner->apply(r, z); else BLAS::copy(r, z);
-        double rho_new=BLAS::dot(r, z);
-        if(rho_new<=0 || rho_new!=rho_new) return status=KRYLOV_BREAKDOWN;
-        double beta=rho_new/rho;
-        BLAS::add_scaled(beta, s, z); s.swap(z); // s=beta*s+z
-        rho=rho_new;
-        
-        //      if ( iteration % 5000 == 0 )
-        //      {
-        //         std::cout << "CGNR_Solver --- residual_norm: " << residual_norm << std::endl;
-        //      }
-        
-    }
-    return status=KRYLOV_EXCEEDED_MAX_ITERATIONS;
-}
-
diff --git a/extern/eltopo/common/newsparse/krylov_solvers.h b/extern/eltopo/common/newsparse/krylov_solvers.h
deleted file mode 100644
index 242a91b..0000000
--- a/extern/eltopo/common/newsparse/krylov_solvers.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef KRYLOV_SOLVERS_H
-#define KRYLOV_SOLVERS_H
-
-#include <linear_operator.h>
-
-enum KrylovSolverStatus{
-    KRYLOV_CONVERGED,
-    KRYLOV_EXCEEDED_MAX_ITERATIONS,
-    KRYLOV_BREAKDOWN
-};
-
-//============================================================================
-// Only guaranteed for symmetric positive definite systems.
-// Singular systems may be solved, but round-off error may cause problems,
-// and if the system is inconsistent convergence will not be automatically detected.
-struct CG_Solver
-{
-    double tolerance_factor;
-    unsigned int max_iterations;
-    double residual_norm; // we use the infinity norm
-    unsigned int iteration;
-    KrylovSolverStatus status;
-    std::vector<double> r, z, s;
-    
-    CG_Solver(void)
-    : tolerance_factor(1e-9), max_iterations(100), residual_norm(0), iteration(0), status(KRYLOV_CONVERGED), r(0), z(0), s(0)
-    {}
-    
-    // Attempt to solve A*result=rhs for result.
-    // Sets residual_norm, iteration, and status (and also returns status)
-    // If optional preconditioner given, use it.
-    // If "use_given_initial_guess" is false (default), take initial guess to be all zeros;
-    //  if true, instead use whatever is in result at the moment. 
-    KrylovSolverStatus solve(const LinearOperator &A, const double *rhs, double *result,
-                             const LinearOperator *preconditioner=0, bool use_given_initial_guess=false);
-};
-
-//============================================================================
-// MINRES using the Conjugate Residual (CR) algorithm.
-// May work on symmetric indefinite problems, but is vulnerable to breakdown
-// except in the positive definite case.
-struct MINRES_CR_Solver
-{
-    double tolerance_factor;
-    unsigned int max_iterations;
-    double residual_norm; // we use the infinity norm
-    unsigned int iteration;
-    KrylovSolverStatus status;
-    std::vector<double> r, z, q, s, t;
-    
-    MINRES_CR_Solver(void)
-    : tolerance_factor(1e-9), max_iterations(100), residual_norm(0), iteration(0), status(KRYLOV_CONVERGED), r(0), z(0), q(0), s(0), t(0)
-    {}
-    
-    // Attempt to solve A*result=rhs for result.
-    // Sets residual_norm, iteration, and status (and also returns status)
-    // If optional preconditioner given, use it.
-    // If "use_given_initial_guess" is false (default), take initial guess to be all zeros;
-    //  if true, instead use whatever is in result at the moment. 
-    KrylovSolverStatus solve(const LinearOperator &A, const double *rhs, double *result,
-                             const LinearOperator *preconditioner=0, bool use_given_initial_guess=false);
-};
-
-//============================================================================
-// CGNR (Conjugate Gradient applied to the Normal Equations)
-// Should be able to solve min ||b-Ax|| for A with full column rank,
-// including the case Ax=b for general non-singular A. Rank-deficient problems
-// may still work.
-struct CGNR_Solver
-{
-    double tolerance_factor;
-    unsigned int max_iterations;
-    double residual_norm; // we use the infinity norm of the residual in the normal equations, A^T*(b-A*x)
-    // Please note --- this is not the same as the residual of the original, b-A*x
-    unsigned int iteration;
-    KrylovSolverStatus status;
-    std::vector<double> r, z, s, u;
-    
-    CGNR_Solver(void)
-    : tolerance_factor(1e-9), max_iterations(100), residual_norm(0), iteration(0), status(KRYLOV_CONVERGED), r(0), z(0), s(0), u(0)
-    {}
-    
-    // Attempt to solve min ||rhs-A*result|| (or A*result=rhs for nonsingular A) for result.
-    // Sets residual_norm, iteration, and status (and also returns status)
-    // If optional preconditioner given, use it; it should precondition A, so that A*M is close to orthogonal.
-    // If "use_given_initial_guess" is false (default), take initial guess to be all zeros;
-    //  if true, instead use whatever is in result at the moment. 
-    KrylovSolverStatus solve(const LinearOperator &A, const double *rhs, double *result,
-                             const LinearOperator *preconditioner=0, bool use_given_initial_guess=false);
-};
-
-#endif
diff --git a/extern/eltopo/common/newsparse/linear_operator.h b/extern/eltopo/common/newsparse/linear_operator.h
deleted file mode 100644
index 4c094bb..0000000
--- a/extern/eltopo/common/newsparse/linear_operator.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef LINEAR_OPERATOR_H
-#define LINEAR_OPERATOR_H
-
-#include <cassert>
-#include <iostream>
-#include <vector>
-
-// virtual base class for linear operators
-
-struct LinearOperator
-{
-    int m, n; // like an m*n matrix
-    
-    LinearOperator(int m_=0) : m(m_), n(m_) {}
-    LinearOperator(int m_, int n_) : m(m_), n(n_) {}
-    virtual ~LinearOperator(void) {}
-    
-    // y=A*x: x should have dimension n, y dimension m
-    virtual void apply(const double *x, double *y) const = 0;
-    
-    // z=y-A*x: x should have dimension n, y and z dimension m
-    // z and y may be aliased (y==z)
-    virtual void apply_and_subtract(const double *x, const double *y, double *z) const = 0;
-    
-    // y=A^T*x: x should have dimension m, y dimension n
-    virtual void apply_transpose(const double *x, double *y) const = 0;
-    
-    // z=y-A^T*x: x should have dimension m, y and z dimension n
-    // z and y may be aliased (y==z)
-    virtual void apply_transpose_and_subtract(const double *x, const double *y, double *z) const = 0;
-    
-    // shortcuts if you're using std::vector
-    virtual void apply(const std::vector<double> &x, std::vector<double> &y) const
-    {
-        assert(x.size()>=(size_t)n);
-        y.resize(m);
-        apply(&x[0], &y[0]);
-    }
-    
-    virtual void apply_and_subtract(const std::vector<double> &x, const std::vector<double> &y, std::vector<double> &z) const
-    {
-        assert(x.size()>=(size_t)n && y.size()>=(size_t)m);
-        z.resize(m);
-        apply_and_subtract(&x[0], &y[0], &z[0]);
-    }
-    
-    virtual void apply_transpose(const std::vector<double> &x, std::vector<double> &y) const
-    {
-        assert(x.size()>=(size_t)m);
-        y.resize(n);
-        apply_transpose(&x[0], &y[0]);
-    }
-    
-    virtual void apply_transpose_and_subtract(const std::vector<double> &x, const std::vector<double> &y, std::vector<double> &z) const
-    {
-        assert(x.size()>=(size_t)m && y.size()>=(size_t)n);
-        z.resize(n);
-        apply_transpose_and_subtract(&x[0], &y[0], &z[0]);
-    }
-    
-    // the following might not be implemented depending on the operator
-    virtual void write_matlab(std::ostream &output, const char *variable_name) const
-    {
-        output<<variable_name<<"='unimplemented LinearOperator output';"<<std::endl;
-    }
-};
-
-// useful extra: compositions of linear operators (e.g. for factored preconditioners)
-struct FactoredLinearOperator: public LinearOperator
-{
-    std::vector<const LinearOperator*> factors;
-    std::vector<bool> transpose;
-    
-    FactoredLinearOperator(int m_=0) : LinearOperator(m_), factors(0), transpose(0), temp(0) {}
-    FactoredLinearOperator(const LinearOperator *A, bool Atranspose=false);
-    FactoredLinearOperator(const LinearOperator *A, bool Atranspose, const LinearOperator *B, bool Btranspose);
-    FactoredLinearOperator(const LinearOperator *A, bool Atranspose, const LinearOperator *B, bool Btranspose, const LinearOperator *C, bool Ctranspose);
-    bool check_dimensions(void);
-    using LinearOperator::apply;
-    using LinearOperator::apply_and_subtract;
-    using LinearOperator::apply_transpose;
-    using LinearOperator::apply_transpose_and_subtract;
-    virtual void apply(const double *x, double *y) const;
-    virtual void apply_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void apply_transpose(const double *x, double *y) const;
-    virtual void apply_transpose_and_subtract(const double *x, const double *y, double *z) const;
-    
-private:
-    std::vector<double> temp; // intermediate vector for use in the apply functions if needed
-};
-
-#endif
diff --git a/extern/eltopo/common/newsparse/sparse_matrix.cpp b/extern/eltopo/common/newsparse/sparse_matrix.cpp
deleted file mode 100644
index fb25a94..0000000
--- a/extern/eltopo/common/newsparse/sparse_matrix.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-#include <sparse_matrix.h>
-#include <util.h>
-
-
-//============================================================================
-void SparseMatrixDynamicCSR::
-clear(void)
-{
-    m=n=0;
-    row.clear();
-}
-
-void SparseMatrixDynamicCSR::
-set_zero(void)
-{
-    for(int i=0; i<m; ++i) row[i].clear();
-}
-
-void SparseMatrixDynamicCSR::
-resize(int m_, int n_)
-{
-    m=m_;
-    n=n_;
-    row.resize(m);
-}
-
-const double &SparseMatrixDynamicCSR::
-operator()(int i, int j) const
-{
-    assert(i>=0 && i<m && j>=0 && j<n);
-    const DynamicSparseVector &r=row[i];
-    for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p){
-        if(p->index==j) return p->value;
-        else if(p->index>j) break;
-    }
-    return zero;
-}
-
-double &SparseMatrixDynamicCSR::
-operator()(int i, int j)
-{
-    assert(i>=0 && i<m && j>=0 && j<n);
-    DynamicSparseVector &r=row[i];
-    DynamicSparseVector::iterator p;
-    for(p=r.begin(); p!=r.end(); ++p){
-        if(p->index==j) return p->value;
-        else if(p->index>j) break;
-    }
-    return (r.insert(p, SparseEntry(j, 0)))->value;
-}
-
-void SparseMatrixDynamicCSR::
-add_sparse_row(int i, const DynamicSparseVector &x, double multiplier)
-{
-    assert(i>=0 && i<m);
-    DynamicSparseVector &r=row[i];
-    DynamicSparseVector::iterator p=r.begin();
-    DynamicSparseVector::const_iterator q=x.begin();
-    while(p!=r.end() && q!=x.end()){
-        if(p->index<q->index) ++p;
-        else if(p->index>q->index){
-            r.insert(p, SparseEntry(q->index, multiplier*q->value));
-            ++q;
-        }else{
-            p->value+=multiplier*q->value;
-            ++p;
-            ++q;
-        }
-    }
-    for(; q!=x.end(); ++q) r.push_back(SparseEntry(q->index, multiplier*q->value));
-}
-
-void SparseMatrixDynamicCSR::
-apply(const double *x, double *y) const
-{
-    assert(x && y);
-    for(int i=0; i<m; ++i){
-        double d=0;
-        const DynamicSparseVector &r=row[i];
-        for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p)
-            d+=p->value*x[p->index];
-        y[i]=d;
-    }
-}
-
-void SparseMatrixDynamicCSR::
-apply_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y && z);
-    for(int i=0; i<m; ++i){
-        double d=0;
-        const DynamicSparseVector &r=row[i];
-        for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p)
-            d+=p->value*x[p->index];
-        z[i]=y[i]-d;
-    }
-}
-
-void SparseMatrixDynamicCSR::
-apply_transpose(const double *x, double *y) const
-{
-    assert(x && y);
-    BLAS::set_zero(n, y);
-    for(int i=0; i<m; ++i){
-        const DynamicSparseVector &r=row[i];
-        double xi=x[i];
-        for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p)
-            y[p->index]+=p->value*xi;
-    }
-}
-
-void SparseMatrixDynamicCSR::
-apply_transpose_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y && z);
-    if(y!=z) BLAS::copy(n, y, z);
-    for(int i=0; i<m; ++i){
-        const DynamicSparseVector &r=row[i];
-        double xi=x[i];
-        for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p)
-            z[p->index]-=p->value*xi;
-    }
-}
-
-void SparseMatrixDynamicCSR::
-write_matlab(std::ostream &output, const char *variable_name) const
-{
-    output<<variable_name<<"=sparse([";
-    for(int i=0; i<m; ++i) for(DynamicSparseVector::const_iterator p=row[i].begin(); p!=row[i].end(); ++p)
-        output<<i+1<<" ";
-    output<<"],...\n  [";
-    for(int i=0; i<m; ++i) for(DynamicSparseVector::const_iterator p=row[i].begin(); p!=row[i].end(); ++p)
-        output<<p->index+1<<" ";
-    output<<"],...\n  [";
-    for(int i=0; i<m; ++i) for(DynamicSparseVector::const_iterator p=row[i].begin(); p!=row[i].end(); ++p)
-        output<<p->value<<" ";
-    output<<"], "<<m<<", "<<n<<");"<<std::endl;
-}
-
-//============================================================================
-
-SparseMatrixStaticCSR::
-SparseMatrixStaticCSR(const SparseMatrixDynamicCSR &matrix)
-: LinearOperator(matrix.m, matrix.n), rowstart(matrix.m+1, 0),
-colindex(0), value(0)
-{
-    ssize_t nnz=0;
-    for(int i=0; i<m; ++i){
-        nnz+=matrix.row[i].size();
-        rowstart[i+1]=static_cast<int>(nnz);
-    }
-    colindex.resize(nnz);
-    value.resize(nnz);
-    for(int i=0, k=0; i<m; ++i){
-        const DynamicSparseVector &r=matrix.row[i];
-        for(DynamicSparseVector::const_iterator p=r.begin(); p!=r.end(); ++p){
-            colindex[k]=p->index;
-            value[k]=p->value;
-            ++k;
-        }
-    }
-}
-
-void SparseMatrixStaticCSR::
-clear(void)
-{
-    m=n=0;
-    rowstart.clear();
-    rowstart.push_back(0);
-    colindex.clear();
-    value.clear();
-}
-
-void SparseMatrixStaticCSR::
-set_zero(void)
-{
-    std::memset(&rowstart[0], 0, (m+1)*sizeof(int));
-    colindex.resize(0);
-    value.resize(0);
-}
-
-void SparseMatrixStaticCSR::
-resize(int m_, int n_)
-{
-    assert(m_>=0 && n_>=0);
-    n=n_;
-    if(m_>m){ // extra rows?
-        m=m_;
-        rowstart.resize(m+1,rowstart.back());
-    }else if(m_<m){ // deleting rows?
-        m=m_;
-        rowstart.resize(m+1);
-        colindex.resize(rowstart.back());
-        value.resize(rowstart.back());
-    }
-}
-
-double SparseMatrixStaticCSR::
-operator()(int i, int j) const
-{
-    assert(i>=0 && i<m && j>=0 && j<n);
-    // linear search for now - could be accelerated if needed!
-    for(int k=rowstart[i]; k<rowstart[k+1]; ++k){
-        if(colindex[k]==j) return value[k];
-        else if(colindex[k]>j) break;
-    }
-    return 0;
-}
-
-void SparseMatrixStaticCSR::
-apply_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y && z);
-    for(int i=0, k=rowstart[0]; i<m; ++i){
-        double d=0;
-        for(; k<rowstart[i+1]; ++k) d+=value[k]*x[colindex[k]];
-        z[i]=y[i]-d;
-    }
-}
-
-
-void SparseMatrixStaticCSR::
-apply_transpose_and_subtract(const double *x, const double *y, double *z) const
-{
-    assert(x && y && z);
-    if(y!=z) BLAS::copy(n, y, z);
-    for(int i=0, k=rowstart[0]; i<m; ++i){
-        double xi=x[i];
-        for(; k<rowstart[i+1]; ++k) z[colindex[k]]-=value[k]*xi;
-    }
-}
-
-void SparseMatrixStaticCSR::
-write_matlab(std::ostream &output, const char *variable_name) const
-{
-    output<<variable_name<<"=sparse([";
-    for(int i=0, k=rowstart[0]; i<m; ++i) for(; k<rowstart[i+1]; ++k)
-        output<<i+1<<" ";
-    output<<"],...\n  [";
-    for(int i=0, k=rowstart[0]; i<m; ++i) for(; k<rowstart[i+1]; ++k)
-        output<<colindex[k]+1<<" ";
-    output<<"],...\n  [";
-    for(int i=0, k=rowstart[0]; i<m; ++i) for(; k<rowstart[i+1]; ++k)
-        output<<value[k]<<" ";
-    output<<"], "<<m<<", "<<n<<");"<<std::endl;
-}
diff --git a/extern/eltopo/common/newsparse/sparse_matrix.h b/extern/eltopo/common/newsparse/sparse_matrix.h
deleted file mode 100644
index 782c373..0000000
--- a/extern/eltopo/common/newsparse/sparse_matrix.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef SPARSE_MATRIX_H
-#define SPARSE_MATRIX_H
-
-// Definitions for a variety of sparse matrix formats.
-// By default everything keeps entries in sorted order, with no duplicates.
-
-#include <blas_wrapper.h>
-#include <linear_operator.h>
-#include <list>
-
-//============================================================================
-// useful for dynamic data structures
-struct SparseEntry
-{
-    int index;
-    double value;
-    
-    SparseEntry(void) : index(~0), value(1e+30) {}
-    SparseEntry(int index_, double value_) : index(index_), value(value_) {}
-    bool operator<(const SparseEntry &e) const { return index<e.index; }
-};
-
-typedef std::list<SparseEntry> DynamicSparseVector;
-
-//============================================================================
-// Dynamic Compressed Sparse Row
-// This probably should only be used when constructing a new matrix; for
-// iteratively solving etc. you probably want to convert it to a more efficienct
-// static structure.
-struct SparseMatrixDynamicCSR: public LinearOperator
-{
-    std::vector<DynamicSparseVector> row;
-    const double zero; // may need to return a reference to zero for convenience in operator()
-    
-    SparseMatrixDynamicCSR(int m_=0) : LinearOperator(m_), row(m_), zero(0) {}
-    SparseMatrixDynamicCSR(int m_, int n_) : LinearOperator(m_, n_), row(m_), zero(0) {}
-    void clear(void);
-    void set_zero(void);
-    void resize(int m_, int n_); // note: eliminates extra rows, but not extra columns
-    const double &operator()(int i, int j) const;
-    double &operator()(int i, int j); // will create a new zero entry at (i,j) if one doesn't exist already; this may invalidate other references in row i
-    void add_sparse_row(int i, const DynamicSparseVector &x, double multiplier=1);
-    using LinearOperator::apply;
-    using LinearOperator::apply_and_subtract;
-    using LinearOperator::apply_transpose;
-    using LinearOperator::apply_transpose_and_subtract;
-    virtual void apply(const double *x, double *y) const;
-    virtual void apply_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void apply_transpose(const double *x, double *y) const;
-    virtual void apply_transpose_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void write_matlab(std::ostream &output, const char *variable_name) const;
-};
-
-//============================================================================
-// Static Compressed Sparse Row
-struct SparseMatrixStaticCSR: public LinearOperator
-{
-    std::vector<int> rowstart;
-    std::vector<int> colindex;
-    std::vector<double> value;
-    
-    SparseMatrixStaticCSR(int m_=0) : LinearOperator(m_), rowstart(m_+1, 0), colindex(0), value(0) {}
-    SparseMatrixStaticCSR(int m_, int n_) : LinearOperator(m_, n_), rowstart(m_+1, 0), colindex(0), value(0) {}
-    SparseMatrixStaticCSR(const SparseMatrixDynamicCSR &matrix);
-    void clear(void);
-    void set_zero(void);
-    void resize(int m_, int n_); // note: eliminates extra rows, but not extra columns
-    double operator()(int i, int j) const;
-    using LinearOperator::apply;
-    using LinearOperator::apply_and_subtract;
-    using LinearOperator::apply_transpose;
-    using LinearOperator::apply_transpose_and_subtract;
-    virtual void apply(const double *x, double *y) const;
-    virtual void apply_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void apply_transpose(const double *x, double *y) const;
-    virtual void apply_transpose_and_subtract(const double *x, const double *y, double *z) const;
-    virtual void write_matlab(std::ostream &output, const char *variable_name) const;
-};
-
-inline void SparseMatrixStaticCSR::
-apply(const double *x, double *y) const
-{
-    assert(x && y);
-    for(int i=0, k=rowstart[0]; i<m; ++i){
-        double d=0;
-        for(; k<rowstart[i+1]; ++k) d+=value[k]*x[colindex[k]];
-        y[i]=d;
-    }
-}
-
-inline void SparseMatrixStaticCSR::
-apply_transpose(const double *x, double *y) const
-{
-    assert(x && y);
-    BLAS::set_zero(n, y);
-    for(int i=0, k=rowstart[0]; i<m; ++i){
-        double xi=x[i];
-        for(; k<rowstart[i+1]; ++k) y[colindex[k]]+=value[k]*xi;
-    }
-}
-
-
-#endif
diff --git a/extern/eltopo/common/openglutils.cpp b/extern/eltopo/common/openglutils.cpp
deleted file mode 100644
index 8360b60..0000000
--- a/extern/eltopo/common/openglutils.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-#include "openglutils.h"
-
-#ifdef __APPLE__
-#include <GLUT/glut.h> // why does Apple have to put glut.h here...
-#else
-#include <GL/glut.h> // ...when everyone else puts it here?
-#endif
-
-#include "vec.h"
-#include <cfloat>
-
-void draw_circle2d(const Vec2f& centre, float rad, int segs)
-{
-   glBegin(GL_POLYGON);
-   for(int i=0;i<segs;i++){
-      float cosine=rad*cos(i*2*M_PI/(float)(segs));
-      float sine=rad* sin(i*2*M_PI/(float)(segs));
-      glVertex2fv((Vec2f(cosine,sine) + centre).v);
-   }
-   glEnd();
-}
-
-void draw_grid2d(const Vec2f& origin, float dx, int nx, int ny) {
-   float width = nx*dx;
-   float height = ny*dx;
-   
-   glBegin(GL_LINES);
-   for(int i = 0; i <= nx; i++) {
-      Vec2f a(i*dx, 0);
-      Vec2f b(i*dx, height);
-      glVertex2fv((origin+a).v); 
-      glVertex2fv((origin+b).v);
-   }
-   for(int j = 0; j <= ny; ++j) {
-      Vec2f a(0,j*dx);
-      Vec2f b(width,j*dx);
-      glVertex2fv((origin + a).v); 
-      glVertex2fv((origin + b).v);
-   }
-   glEnd();
-}
-
-void draw_box2d(const Vec2f& origin, float width, float height) {
-   glBegin(GL_POLYGON);
-   glVertex2fv(origin.v);
-   glVertex2fv((origin + Vec2f(0, height)).v);
-   glVertex2fv((origin + Vec2f(width, height)).v);
-   glVertex2fv((origin + Vec2f(width, 0)).v);
-   glEnd();
-}
-
-void draw_segmentset2d(const std::vector<Vec2f>& vertices, const std::vector<Vec2ui>& edges) {
-   glBegin(GL_LINES);
-   for(unsigned int i = 0; i < edges.size(); ++i) {
-      glVertex2fv(vertices[edges[i][0]].v);      
-      glVertex2fv(vertices[edges[i][1]].v);
-   }
-   glEnd();
-}
-
-void draw_segmentset2d(const std::vector<Vec2f>& vertices, const std::vector<Vec2i>& edges) {
-   glBegin(GL_LINES);
-   for(unsigned int i = 0; i < edges.size(); ++i) {
-      glVertex2fv(vertices[edges[i][0]].v);      
-      glVertex2fv(vertices[edges[i][1]].v);
-   }
-   glEnd();
-}
-
-void draw_points2d(const std::vector<Vec2f>& points) {
-   glBegin(GL_POINTS);
-   for(unsigned int i = 0; i < points.size(); ++i) {
-      glVertex2fv(points[i].v);      
-   }
-   glEnd();
-}
-
-void draw_polygon2d(const std::vector<Vec2f>& vertices) {
-   glBegin(GL_POLYGON);
-   for(unsigned int i = 0; i < vertices.size(); ++i)
-      glVertex2fv(vertices[i].v);      
-   glEnd();
-}
-
-void draw_polygon2d(const std::vector<Vec2f>& vertices, const std::vector<int>& order) {
-   glBegin(GL_POLYGON);
-   for(unsigned int i = 0; i < order.size(); ++i)
-      glVertex2fv(vertices[order[i]].v);      
-   glEnd();
-
-}
-void draw_segment2d(const Vec2f& start, const Vec2f& end) {
-   glBegin(GL_LINES);
-   glVertex2fv(start.v);      
-   glVertex2fv(end.v);      
-   glEnd();
-}
-
-void draw_arrow2d(const Vec2f& start, const Vec2f& end, float arrow_head_len)
-{
-   Vec2f direction = end - start;
-
-   Vec2f dir_norm = direction;
-   
-   //TODO Possibly automatically scale arrowhead length based on vector magnitude
-   if(mag(dir_norm) < 1e-14)
-      return;
-
-   normalize(dir_norm);
-   Vec2f perp(dir_norm[1],-dir_norm[0]);
-
-   Vec2f tip_left = end + arrow_head_len/(float)sqrt(2.0)*(-dir_norm + perp);
-   Vec2f tip_right = end + arrow_head_len/(float)sqrt(2.0)*(-dir_norm - perp);
-   
-   glBegin(GL_LINES);
-   glVertex2fv(start.v);
-   glVertex2fv(end.v);
-   glVertex2fv(end.v);
-   glVertex2fv(tip_left.v);
-   glVertex2fv(end.v);
-   glVertex2fv(tip_right.v);
-   glEnd();
-    
-}
-
-void draw_trimesh2d(const std::vector<Vec2f>& vertices, const std::vector<Vec3ui>& tris) {
-   glBegin(GL_TRIANGLES);
-   for(unsigned int i = 0; i < tris.size(); ++i) {
-      glVertex2fv(vertices[tris[i][0]].v);
-      glVertex2fv(vertices[tris[i][1]].v);
-      glVertex2fv(vertices[tris[i][2]].v);
-    }
-   glEnd();
-}
-       
-       
-void hueToRGB(float hue, float sat, float val, float &r, float &g, float &b) {   
-   //compute hue (adapted from an older Wikipedia article)
-   int Hi = (int)(floor(hue / 60.0f)) % 6;
-   float f = hue / 60 - Hi;
-   float p = val * (1 - sat);
-   float q = val * (1- f * sat);
-   float t = val * (1 - (1 - f) * sat);
-   
-   switch(Hi) {
-      case 0:
-         r=val;
-         g=t;
-         b=p;
-         break;
-      case 1:
-         r=q;
-         g=val;
-         b=p;
-         break;
-      case 2:
-         r=p;
-         g=val;
-         b=t;
-         break;
-      case 3:
-         r=p;
-         g=q;
-         b=val;
-         break;
-      case 4:
-         r=t;
-         g=p;
-         b=val;
-        break;
-      case 5:
-         r=val;
-         g=p;
-         b=q;
-         break;
-   }
-}
-
-void draw_grid_data2d(Array2f& data, Vec2f origin, float dx, bool color) {
-   float max_val = FLT_MIN;
-   float min_val = FLT_MAX;
-   for(int j = 0; j < data.nj; ++j) for(int i = 0; i < data.ni; ++i) {
-      max_val = max(data(i,j),max_val);
-      min_val = min(data(i,j),min_val);
-   }
-   
-   for(int j = 0; j < data.nj; ++j) {
-      for(int i = 0; i < data.ni; ++i) {
-         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-         Vec2f bl = origin + Vec2f(i*dx,j*dx);
-         float r,g,b;
-         if(color) {
-            hueToRGB(240*(data(i,j) - min_val)/(max_val-min_val), 1, 1, r,g,b);
-         }
-         else {
-            float gray = (data(i,j) - min_val)/(max_val-min_val);
-            r = g = b = gray;
-         }
-         //TODO Black body colormap, if I can find it.
-         glColor3f(r,g,b);
-         draw_box2d(bl, dx, dx);
-      }
-   }
-
-}
-
-void draw_trimesh3d(const std::vector<Vec3f>& vertices, const std::vector<Vec3ui>& tris) {
-   glBegin(GL_TRIANGLES);
-   for(unsigned int i = 0; i < tris.size(); ++i) {
-      glVertex3fv(vertices[tris[i][0]].v);
-      glVertex3fv(vertices[tris[i][1]].v);
-      glVertex3fv(vertices[tris[i][2]].v);
-   }
-   glEnd();
-}
-
-void draw_trimesh3d(const std::vector<Vec3f>& vertices, const std::vector<Vec3ui>& tris, const std::vector<Vec3f> & normals) {
-   glBegin(GL_TRIANGLES);
-   for(unsigned int i = 0; i < tris.size(); ++i) {
-      glNormal3fv(normals[tris[i][0]].v);
-      glVertex3fv(vertices[tris[i][0]].v);
-      glNormal3fv(normals[tris[i][1]].v);
-      glVertex3fv(vertices[tris[i][1]].v);
-      glNormal3fv(normals[tris[i][2]].v);
-      glVertex3fv(vertices[tris[i][2]].v);
-   }
-   glEnd();
-}
-
-void draw_box3d(const Vec3f& dimensions) {
-   
-   //Draw an axis-aligned box with specified dimensions, 
-   //where the midpoint of the box is at the origin
-
-   float width = dimensions[0];
-   float height = dimensions[1];
-   float depth = dimensions[2];
-
-   glBegin(GL_POLYGON);
-   glNormal3f(-1,0,0);
-   glVertex3f(-0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(-0.5*width, 0.5*height, 0.5*depth);
-   glVertex3f(-0.5*width, 0.5*height, -0.5*depth);
-   glVertex3f(-0.5*width, -0.5*height, -0.5*depth);
-   glEnd();
-
-   glBegin(GL_POLYGON);
-   glNormal3f(1,0,0);
-   glVertex3f(0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, -0.5*depth);
-   glVertex3f(0.5*width, -0.5*height, -0.5*depth);
-   glEnd();
-
-   glBegin(GL_POLYGON);
-   glNormal3f(0,0,-1);
-   glVertex3f(-0.5*width, -0.5*height, -0.5*depth);
-   glVertex3f(0.5*width, -0.5*height, -0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, -0.5*depth);
-   glVertex3f(-0.5*width, 0.5*height, -0.5*depth);
-   glEnd();
-
-   glBegin(GL_POLYGON);
-   glNormal3f(0,0,1);
-   glVertex3f(-0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, 0.5*depth);
-   glVertex3f(-0.5*width, 0.5*height, 0.5*depth);
-   glEnd();
-
-   glBegin(GL_POLYGON);
-   glNormal3f(0,-1,0);
-   glVertex3f(-0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, -0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, -0.5*height, -0.5*depth);
-   glVertex3f(-0.5*width, -0.5*height, -0.5*depth);
-   glEnd();
-
-   glBegin(GL_POLYGON);
-   glNormal3f(0,1,0);
-   glVertex3f(-0.5*width, 0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, 0.5*depth);
-   glVertex3f(0.5*width, 0.5*height, -0.5*depth);
-   glVertex3f(-0.5*width, 0.5*height, -0.5*depth);
-   glEnd();
-}
diff --git a/extern/eltopo/common/openglutils.h b/extern/eltopo/common/openglutils.h
deleted file mode 100644
index 0d111be..0000000
--- a/extern/eltopo/common/openglutils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef OPENGL_UTILS_H
-#define OPENGL_UTILS_H
-
-#include <vector>
-#include "vec.h"
-#include "array2.h"
-
-void draw_circle2d(const Vec2f& centre, float rad, int segs);
-void draw_grid2d(const Vec2f& origin, float dx, int nx, int ny);
-void draw_box2d(const Vec2f& origin, float width, float height);
-void draw_segmentset2d(const std::vector<Vec2f>& vertices, const std::vector<Vec2ui>& edges);
-void draw_segmentset2d(const std::vector<Vec2f>& vertices, const std::vector<Vec2i>& edges);
-void draw_points2d(const std::vector<Vec2f>& points);
-void draw_polygon2d(const std::vector<Vec2f>& vertices);
-void draw_polygon2d(const std::vector<Vec2f>& vertices, const std::vector<int>& order);
-void draw_segment2d(const Vec2f& start, const Vec2f& end);
-void draw_arrow2d(const Vec2f& start, const Vec2f& end, float arrow_head_len);
-void draw_grid_data2d(Array2f& data, Vec2f origin, float dx, bool color = false);
-void draw_trimesh2d(const std::vector<Vec2f>& vertices, const std::vector<Vec3ui>& tris);    
-   
-void draw_trimesh3d(const std::vector<Vec3f>& vertices, const std::vector<Vec3ui>& tris);
-void draw_trimesh3d(const std::vector<Vec3f>& vertices, const std::vector<Vec3ui>& tris, const std::vector<Vec3f>& normals);
-void draw_box3d(const Vec3f& dimensions);
-
-#endif
\ No newline at end of file
diff --git a/extern/eltopo/common/predicates.cpp b/extern/eltopo/common/predicates.cpp
deleted file mode 100644
index 84e069e..0000000
--- a/extern/eltopo/common/predicates.cpp
+++ /dev/null
@@ -1,1008 +0,0 @@
-#include <cfloat>
-#include <predicates.h>
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#define random() rand() // not sure if this define is valid
-#define _Ios_Fmtflags ios::fmtflags
-#endif
-
-static void print_hex( double d )
-{
-    std::_Ios_Fmtflags originalFlags = std::cout.flags();
-    
-    assert( sizeof(double) == 2 * sizeof(long int) );
-    
-    union double_ints
-    {
-        double d;
-        long int c[2];
-    };
-    
-    double_ints dc;
-    dc.d = d;
-    
-    std::cout.setf(std::ios::hex, std::ios::basefield );
-    
-    std::cout << dc.c[0] << dc.c[1];
-    
-    std::cout.flags(originalFlags);
-}
-
-static void print_hex( const Vec3d& v )
-{
-    print_hex( v[0] );
-    std::cout << " ";
-    print_hex( v[1] );
-    std::cout << " ";
-    print_hex( v[2] );
-    std::cout << std::endl;   
-}
-
-
-
-//=======================================================================================================
-//=======================================================================================================
-// DOUBLE PRECISION VERSIONS
-//=======================================================================================================
-//=======================================================================================================
-
-// Determine the orientation of 4 points in 2d space and 1d time
-// with end0 indicating if point 0 is at t=1 instead of t=0, etc.
-// Returns zero if the determinant is too small to reliably know the sign.
-static double orient(const Vec2d& x0, bool end0,
-                     const Vec2d& x1, bool end1,
-                     const Vec2d& x2, bool end2,
-                     const Vec2d& x3, bool end3)
-{
-    assert(end0 || end1 || end2 || end3);
-    assert(!end0 || !end1 || !end2 || !end3);
-    // first do all six 2x2 determinants and permanents (error ratio slightly more than 2*DBL_EPSILON)
-    double d01=x0[0]*x1[1]-x0[1]*x1[0], p01=std::fabs(x0[0]*x1[1])+std::fabs(x0[1]*x1[0]); 
-    double d02=x0[0]*x2[1]-x0[1]*x2[0], p02=std::fabs(x0[0]*x2[1])+std::fabs(x0[1]*x2[0]); 
-    double d03=x0[0]*x3[1]-x0[1]*x3[0], p03=std::fabs(x0[0]*x3[1])+std::fabs(x0[1]*x3[0]); 
-    double d12=x1[0]*x2[1]-x1[1]*x2[0], p12=std::fabs(x1[0]*x2[1])+std::fabs(x1[1]*x2[0]); 
-    double d13=x1[0]*x3[1]-x1[1]*x3[0], p13=std::fabs(x1[0]*x3[1])+std::fabs(x1[1]*x3[0]); 
-    double d23=x2[0]*x3[1]-x2[1]*x3[0], p23=std::fabs(x2[0]*x3[1])+std::fabs(x2[1]*x3[0]); 
-    // then add up as needed
-    double det=0, perm=0;
-    if(end0){
-        det=d12+d23-d13;
-        perm=p12+p23-p13;
-    }
-    if(end1){
-        det-=d02+d23-d03;
-        perm+=p02+p23+p03;
-    }
-    if(end2){
-        det+=d01+d13-d03;
-        perm+=p01+p13+p03;
-    }
-    if(end3){
-        det-=d01+d12-d02;
-        perm+=p01+p12+p02;
-    }
-    double err=perm*4.1*DBL_EPSILON; // should be safe, I think
-    if(det>err || det<-err) return det;
-    else return 0;
-}
-
-static bool point_point_collision(const Vec2d& x0, const Vec2d& xnew0,
-                                  const Vec2d& x1, const Vec2d& xnew1)
-{
-    if(orient(x0, false, xnew0, true, x1, false, xnew1, true)) return false; // lines are skew
-    // check if points retain ordering along any axis
-    if((x0[0]<x1[0] && xnew0[0]<xnew1[0]) || (x0[0]>x1[0] && xnew0[0]>xnew1[0])) return false;
-    if((x0[1]<x1[1] && xnew0[1]<xnew1[1]) || (x0[1]>x1[1] && xnew0[1]>xnew1[1])) return false;
-    // otherwise, must have intersection or they're exactly the same point
-    return true;
-}
-
-static bool segment_triangle_intersection(const Vec2d& x0, const Vec2d& xnew0,
-                                          const Vec2d& x1, bool end1,
-                                          const Vec2d& x2, bool end2,
-                                          const Vec2d& x3, bool end3,
-                                          bool verbose = false )
-{
-    // first check if the segment crosses the plane of the triangle
-    double s= orient(x0, false, x1, end1, x2, end2, x3, end3),
-    t=-orient(xnew0, true, x1, end1, x2, end2, x3, end3);
-    if((s<0 && t>0) || (s>0 && t<0)) return false;
-    // check if the line of the segment pierces the triangle
-    double a= orient(x0, false, xnew0, true, x2, end2, x3, end3),
-    b=-orient(x0, false, xnew0, true, x1, end1, x3, end3),
-    c= orient(x0, false, xnew0, true, x1, end1, x2, end2);
-    
-    if ( verbose ) 
-    { 
-        std::cout << "a: " << a << "\nb: " << b << "\nc: " << c << std::endl; 
-        std::cout << "ends: " << end1 << ", " << end2 << ", " << end3 << std::endl;
-    }
-    
-    if((s==0 || t==0) || (a==0 || b==0 || c==0)){ // degenerate cases
-        if(end1){
-            if(end2) return point_point_collision(x0, xnew0, x3, x1) || point_point_collision(x0, xnew0, x3, x2);
-            else     return point_point_collision(x0, xnew0, x3, x1) || point_point_collision(x0, xnew0, x2, x1);
-        }else if(end2){
-            if(end3) return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x1, x3);
-            else     return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x3, x2);
-        }else
-        {
-            if ( verbose ) 
-            {
-                std::cout << "point-point: " << x0 << ", " << xnew0 << ", " << x1 << ", " << x2 << std::endl;
-                std::cout << "point-point: " << x0 << ", " << xnew0 << ", " << x1 << ", " << x3 << std::endl;
-            }
-            return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x1, x3);
-        }
-    }
-    // non-degenerate case
-    return ((a<=0 && b<=0 && c<=0) || (a>=0 && b>=0 && c>=0));
-}
-
-static bool segment_triangle_intersection(const Vec2d& x0, const Vec2d& xnew0,
-                                          const Vec2d& x1, bool end1,
-                                          const Vec2d& x2, bool end2,
-                                          const Vec2d& x3, bool end3,
-                                          double& bary )
-{
-    // first check if the segment crosses the plane of the triangle
-    double s = orient(x0, false, x1, end1, x2, end2, x3, end3);
-    double t = -orient(xnew0, true, x1, end1, x2, end2, x3, end3);
-    
-    //std::cout << "segment_triangle_intersection -- s: " << s << ", t: " << t << std::endl;
-    
-    if((s<0 && t>0) || (s>0 && t<0)) return false;
-    
-    // check if the line of the segment pierces the triangle
-    double a= orient(x0, false, xnew0, true, x2, end2, x3, end3),
-    b=-orient(x0, false, xnew0, true, x1, end1, x3, end3),
-    c= orient(x0, false, xnew0, true, x1, end1, x2, end2);
-    
-    //std::cout << "segment_triangle_intersection -- a: " << a << ", b: " << b << ", c: " << c << std::endl;
-    
-    if((s==0 || t==0) || (a==0 || b==0 || c==0)){ // degenerate cases
-        bary = 0.0;    // in degenerate case
-        if(end1){
-            if(end2) return point_point_collision(x0, xnew0, x3, x1) || point_point_collision(x0, xnew0, x3, x2);
-            else     return point_point_collision(x0, xnew0, x3, x1) || point_point_collision(x0, xnew0, x2, x1);
-        }else if(end2){
-            if(end3) return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x1, x3);
-            else     return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x3, x2);
-        }else
-            return point_point_collision(x0, xnew0, x1, x2) || point_point_collision(x0, xnew0, x1, x3);
-    }
-    
-    // non-degenerate case
-    bary = s / (s+t);
-    return ((a<=0 && b<=0 && c<=0) || (a>=0 && b>=0 && c>=0));
-}
-
-
-bool fe_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0,
-                                const Vec2d& x1, const Vec2d& xnew1,
-                                const Vec2d& x2, const Vec2d& xnew2)
-{
-    bool intersections[2] = { false, false };
-    if(segment_triangle_intersection(x0, xnew0, x1, false, x2, false, xnew1, true))
-    {
-        intersections[0] = true;
-    }
-    
-    if(segment_triangle_intersection(x0, xnew0, x2, false, xnew2, true, xnew1, true))
-    {
-        intersections[1] = true;
-    }
-    
-    return (intersections[0] ^ intersections[1]);
-}
-
-
-bool fe_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0,
-                                const Vec2d& x1, const Vec2d& xnew1,
-                                const Vec2d& x2, const Vec2d& xnew2,
-                                double& edge_bary, Vec2d& normal, double& t,
-                                double& relative_normal_displacement )
-{
-    bool intersections[2] = { false, false };
-    double bary = 0.0;
-    
-    if( segment_triangle_intersection(x0, xnew0, x1, false, x2, false, xnew1, true, bary) )
-    {
-        //std::cout << "collision (a) t: " << bary << std::endl;
-        
-        // collision happens in triangle with one "new" point
-        intersections[0] = true;
-        edge_bary = 1.0;
-        t = bary;
-        normal = perp( x2 - x1 );
-        normal /= mag(normal);
-        relative_normal_displacement=dot( normal, (xnew0-x0) - (xnew1-x1) );
-    }
-    
-    if( segment_triangle_intersection(x0, xnew0, x2, false, xnew2, true, xnew1, true, bary) )
-    {
-        //std::cout << "collision (b) t: " << bary << std::endl;
-        // collision happens in triangle with two "new" points
-        intersections[1] = true;
-        edge_bary = 0.5;
-        t = bary;
-        normal = perp( xnew2 - xnew1 );
-        normal /= mag(normal);
-        relative_normal_displacement=dot( normal, (xnew0-x0) - (xnew2-x2) );         
-    }
-    
-    return (intersections[0] ^ intersections[1]);
-    
-}
-
-
-//=======================================================================================================
-
-// determine the orientation of 3 points in 2d space
-static double orient(const Vec2d& x0,
-                     const Vec2d& x1,
-                     const Vec2d& x2)
-{
-    double det=x0[0]*x1[1] + x1[0]*x2[1] + x2[0]*x0[1]
-    - x0[1]*x1[0] - x1[1]*x2[0] - x2[1]*x0[0];
-    double perm=std::fabs(x0[0]*x1[1]) + std::fabs(x1[0]*x2[1]) + std::fabs(x2[0]*x0[1])
-    + std::fabs(x0[1]*x1[0]) + std::fabs(x1[1]*x2[0]) + std::fabs(x2[1]*x0[0]);
-    double err=perm*6.1*DBL_EPSILON; // should be safe, I think
-    if(det>err || det<-err) return det;
-    else return 0;
-}
-
-static bool point_segment_intersection(const Vec2d& x0,
-                                       const Vec2d& x1, const Vec2d& x2)
-{
-    if(orient(x0,x1,x2)) return false; // point is not on the line of the segment
-    if(x1[0]==x2[0]){
-        if(x1[1]==x2[1]) return x0[0]==x1[0] && x0[1]==x1[1];
-        else return (x0[1]>=x1[1] && x0[1]<=x2[1]) || (x0[1]>=x2[1] && x0[1]<=x1[1]);
-    }else
-        return (x0[0]>=x1[0] && x0[0]<=x2[0]) || (x0[0]>=x2[0] && x0[0]<=x1[0]);
-}
-
-bool fe_segment_segment_intersection(const Vec2d& x0, const Vec2d& x1,
-                                     const Vec2d& x2, const Vec2d& x3)
-{
-    double d0=orient(x0,x2,x3), d1=orient(x1,x2,x3);
-    if((d0<0 && d1<0) || (d0>0 && d1>0)) return false; // 0-1 lies entirely on one side of 2-3
-    double d2=orient(x2,x0,x1), d3=orient(x3,x0,x1);
-    if((d2<0 && d3<0) || (d2>0 && d3>0)) return false; // 2-3 lies entirely on one side of 1-2
-    if((d0==0 || d1==0) || (d2==0 || d3==0)){ // check for degeneracy
-        return point_segment_intersection(x0, x2, x3)
-        || point_segment_intersection(x1, x2, x3)
-        || point_segment_intersection(x2, x0, x1)
-        || point_segment_intersection(x3, x0, x1);
-    }
-    return true;
-}
-
-bool fe_segment_segment_intersection(const Vec2d& x0, const Vec2d& x1,
-                                     const Vec2d& x2, const Vec2d& x3,
-                                     double& alpha, double& beta )
-{
-    double d0=orient(x0,x2,x3), d1=orient(x1,x2,x3);
-    if((d0<0 && d1<0) || (d0>0 && d1>0)) return false; // 0-1 lies entirely on one side of 2-3
-    double d2=orient(x2,x0,x1), d3=orient(x3,x0,x1);
-    if((d2<0 && d3<0) || (d2>0 && d3>0)) return false; // 2-3 lies entirely on one side of 1-2
-    if((d0==0 || d1==0) || (d2==0 || d3==0)) { // check for degeneracy
-        return point_segment_intersection(x0, x2, x3)
-        || point_segment_intersection(x1, x2, x3)
-        || point_segment_intersection(x2, x0, x1)
-        || point_segment_intersection(x3, x0, x1);
-    }
-    alpha = 0.0;
-    beta = 1.0;
-    return true;
-}
-
-//=======================================================================================================
-
-static double determinant(const Vec3d& x0,
-                          const Vec3d& x1,
-                          const Vec3d& x2)
-{
-    return x0[0]*(x1[1]*x2[2]-x2[1]*x1[2])
-    -x1[0]*(x0[1]*x2[2]-x2[1]*x0[2])
-    +x2[0]*(x0[1]*x1[2]-x1[1]*x0[2]);
-}
-
-// make sure inputs are all non-negative!
-static double permanent(const Vec3d& a0,
-                        const Vec3d& a1,
-                        const Vec3d& a2)
-{
-    return a0[0]*(a1[1]*a2[2]+a2[1]*a1[2])
-    +a1[0]*(a0[1]*a2[2]+a2[1]*a0[2])
-    +a2[0]*(a0[1]*a1[2]+a1[1]*a0[2]);
-}
-
-static double check_error(double value, double bound, double multiplier)
-{
-    double err=bound*multiplier*DBL_EPSILON;
-    //std::cout<<" ######### checking value "<<value<<" against error bound "<<err<<std::endl;
-    if(value>err || value<-err) return value;
-    return 0;
-}
-
-// determine the orientations of 6 points in 3d space and 1d time
-// with end0 indicating if point 0 is at t=1 instead of t=0, etc.
-static void orient(const Vec3d& x0, bool end0,
-                   const Vec3d& x1, bool end1,
-                   const Vec3d& x2, bool end2,
-                   const Vec3d& x3, bool end3,
-                   const Vec3d& x4, bool end4,
-                   const Vec3d& x5, bool end5,
-                   double orientations[6])
-{
-    assert(end0 || end1 || end2 || end3 || end4 || end5);
-    assert(!end0 || !end1 || !end2 || !end3 || !end4 || !end5);
-    // @@@
-    // Determinants may be a bad way to do this (since there is so much arithmetic)!
-    // Actually solving the linear system with QR might make more sense, though it would involve
-    // nastier floating-point error analysis.
-    // @@@
-    // first do the 3x3's
-    double d012, d013, d014, d015, d023, d024, d025, d034, d035, d045,
-    d123, d124, d125, d134, d135, d145, d234, d235, d245, d345;
-    d012=determinant(x0, x1, x2); d013=determinant(x0, x1, x3); d014=determinant(x0, x1, x4);
-    d015=determinant(x0, x1, x5); d023=determinant(x0, x2, x3); d024=determinant(x0, x2, x4);
-    d025=determinant(x0, x2, x5); d034=determinant(x0, x3, x4); d035=determinant(x0, x3, x5);
-    d045=determinant(x0, x4, x5); d123=determinant(x1, x2, x3); d124=determinant(x1, x2, x4);
-    d125=determinant(x1, x2, x5); d134=determinant(x1, x3, x4); d135=determinant(x1, x3, x5);
-    d145=determinant(x1, x4, x5); d234=determinant(x2, x3, x4); d235=determinant(x2, x3, x5);
-    d245=determinant(x2, x4, x5); d345=determinant(x3, x4, x5);
-    double p012, p013, p014, p015, p023, p024, p025, p034, p035, p045,
-    p123, p124, p125, p134, p135, p145, p234, p235, p245, p345;
-    Vec3d a0(std::fabs(x0[0]), std::fabs(x0[1]), std::fabs(x0[2])),
-    a1(std::fabs(x1[0]), std::fabs(x1[1]), std::fabs(x1[2])),
-    a2(std::fabs(x2[0]), std::fabs(x2[1]), std::fabs(x2[2])),
-    a3(std::fabs(x3[0]), std::fabs(x3[1]), std::fabs(x3[2])),
-    a4(std::fabs(x4[0]), std::fabs(x4[1]), std::fabs(x4[2])),
-    a5(std::fabs(x5[0]), std::fabs(x5[1]), std::fabs(x5[2]));
-    p012=permanent(a0, a1, a2); p013=permanent(a0, a1, a3); p014=permanent(a0, a1, a4);
-    p015=permanent(a0, a1, a5); p023=permanent(a0, a2, a3); p024=permanent(a0, a2, a4);
-    p025=permanent(a0, a2, a5); p034=permanent(a0, a3, a4); p035=permanent(a0, a3, a5);
-    p045=permanent(a0, a4, a5); p123=permanent(a1, a2, a3); p124=permanent(a1, a2, a4);
-    p125=permanent(a1, a2, a5); p134=permanent(a1, a3, a4); p135=permanent(a1, a3, a5);
-    p145=permanent(a1, a4, a5); p234=permanent(a2, a3, a4); p235=permanent(a2, a3, a5);
-    p245=permanent(a2, a4, a5); p345=permanent(a3, a4, a5);
-    // error in dABC is bounded by pABC*5.1*DBL_EPSILON I believe
-    
-    // now do the 4x4's
-    double d0123=(d123-d023)+(d013-d012), p0123=(p123+p023)+(p013+p012),
-    d0124=(d124-d024)+(d014-d012), p0124=(p124+p024)+(p014+p012),
-    d0125=(d125-d025)+(d015-d012), p0125=(p125+p025)+(p015+p012),
-    d0134=(d134-d034)+(d014-d013), p0134=(p134+p034)+(p014+p013),
-    d0135=(d135-d035)+(d015-d013), p0135=(p135+p035)+(p015+p013),
-    d0145=(d145-d045)+(d015-d014), p0145=(p145+p045)+(p015+p014),
-    d0234=(d234-d034)+(d024-d023), p0234=(p234+p034)+(p024+p023),
-    d0235=(d235-d035)+(d025-d023), p0235=(p235+p035)+(p025+p023),
-    d0245=(d245-d045)+(d025-d024), p0245=(p245+p045)+(p025+p024),
-    d0345=(d345-d045)+(d035-d034), p0345=(p345+p045)+(p035+p034),
-    d1234=(d234-d134)+(d124-d123), p1234=(p234+p134)+(p124+p123),
-    d1235=(d235-d135)+(d125-d123), p1235=(p235+p135)+(p125+p123),
-    d1245=(d245-d145)+(d125-d124), p1245=(p245+p145)+(p125+p124),
-    d1345=(d345-d145)+(d135-d134), p1345=(p345+p145)+(p135+p134),
-    d2345=(d345-d245)+(d235-d234), p2345=(p345+p245)+(p235+p234);
-    // error in dABCD is bounded by pABCD*8.1*DBL_EPSILON I believe
-    
-    // and the answers are the 5x5's, with an error less than permanent*11.1*DBL_EPSILON I believe
-    orientations[0]= check_error((end1?d2345:0)-(end2?d1345:0)+(end3?d1245:0)-(end4?d1235:0)+(end5?d1234:0),
-                                 (end1?p2345:0)+(end2?p1345:0)+(end3?p1245:0)+(end4?p1235:0)+(end5?p1234:0), 12);
-    orientations[1]=-check_error((end0?d2345:0)-(end2?d0345:0)+(end3?d0245:0)-(end4?d0235:0)+(end5?d0234:0),
-                                 (end0?p2345:0)+(end2?p0345:0)+(end3?p0245:0)+(end4?p0235:0)+(end5?p0234:0), 12);
-    orientations[2]= check_error((end0?d1345:0)-(end1?d0345:0)+(end3?d0145:0)-(end4?d0135:0)+(end5?d0134:0),
-                                 (end0?p1345:0)+(end1?p0345:0)+(end3?p0145:0)+(end4?p0135:0)+(end5?p0134:0), 12);
-    orientations[3]=-check_error((end0?d1245:0)-(end1?d0245:0)+(end2?d0145:0)-(end4?d0125:0)+(end5?d0124:0),
-                                 (end0?p1245:0)+(end1?p0245:0)+(end2?p0145:0)+(end4?p0125:0)+(end5?p0124:0), 12);
-    orientations[4]= check_error((end0?d1235:0)-(end1?d0235:0)+(end2?d0135:0)-(end3?d0125:0)+(end5?d0123:0),
-                                 (end0?p1235:0)+(end1?p0235:0)+(end2?p0135:0)+(end3?p0125:0)+(end5?p0123:0), 12);
-    orientations[5]=-check_error((end0?d1234:0)-(end1?d0234:0)+(end2?d0134:0)-(end3?d0124:0)+(end4?d0123:0),
-                                 (end0?p1234:0)+(end1?p0234:0)+(end2?p0134:0)+(end3?p0124:0)+(end4?p0123:0), 12);
-    
-    // self check
-    double sumo=orientations[0]+orientations[1]+orientations[2]
-    +orientations[3]+orientations[4]+orientations[5];
-    double sumt=orientations[0]*end0+orientations[1]*end1+orientations[2]*end2
-    +orientations[3]*end3+orientations[4]*end4+orientations[5]*end5;
-    Vec3d sumx=orientations[0]*x0+ orientations[1]*x1+orientations[2]*x2+
-    orientations[3]*x3+orientations[4]*x4+orientations[5]*x5;
-    double rough_size=cube(mag(a0)+mag(a1)+mag(a2)+mag(a3));
-    double rough_x=sqr(sqr(mag(a0)+mag(a1)+mag(a2)+mag(a3)));
-    assert(std::fabs(sumo)<=1000*DBL_EPSILON*rough_size);
-    assert(std::fabs(sumt)<=1000*DBL_EPSILON*rough_size);
-    assert(mag(sumx)<=1000*DBL_EPSILON*rough_x);
-}
-
-//=======================================================================================================
-
-// return a unit-length vector orthogonal to u and v
-static Vec3d get_normal(const Vec3d& u, const Vec3d& v)
-{
-    Vec3d c=cross(u,v);
-    double m=mag(c);
-    if(m) return c/m;
-    // degenerate case: either u and v are parallel, or at least one is zero; pick an arbitrary orthogonal vector
-    if(mag2(u)>=mag2(v)){
-        if(std::fabs(u[0])>=std::fabs(u[1]) && std::fabs(u[0])>=std::fabs(u[2]))
-            c=Vec3d(-u[1]-u[2], u[0], u[0]);
-        else if(std::fabs(u[1])>=std::fabs(u[2]))
-            c=Vec3d(u[1], -u[0]-u[2], u[1]);
-        else
-            c=Vec3d(u[2], u[2], -u[0]-u[1]);
-    }else{
-        if(std::fabs(v[0])>=std::fabs(v[1]) && std::fabs(v[0])>=std::fabs(v[2]))
-            c=Vec3d(-v[1]-v[2], v[0], v[0]);
-        else if(std::fabs(v[1])>=std::fabs(v[2]))
-            c=Vec3d(v[1], -v[0]-v[2], v[1]);
-        else
-            c=Vec3d(v[2], v[2], -v[0]-v[1]);
-    }
-    m=mag(c);
-    if(m) return c/m;
-    // really degenerate case: u and v are both zero vectors; pick a random unit-length vector
-    c[0]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-    c[1]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-    c[2]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-    return c;
-}
-
-//=======================================================================================================
-
-// check 0 against 1-2-3
-static bool segment_triangle_intersection(const Vec3d& x0, const Vec3d& xnew0,
-                                          const Vec3d& x1, bool end1,
-                                          const Vec3d& x2, bool end2,
-                                          const Vec3d& x3, bool end3,
-                                          double orientation, bool verbose = false )
-{
-    assert(end1 || end2 || end3);
-    assert(!end1 || !end2 || !end3);
-    // First want to know if we're in a skew situation - no possibility of intersection.
-    if(orientation) return false;
-    
-    if ( verbose ) { std::cout << "checking projections" << std::endl; }
-    
-    return segment_triangle_intersection(Vec2d(x0[0],x0[1]),
-                                         Vec2d(xnew0[0],xnew0[1]),
-                                         Vec2d(x1[0],x1[1]), end1,
-                                         Vec2d(x2[0],x2[1]), end2,
-                                         Vec2d(x3[0],x3[1]), end3, verbose)
-    && segment_triangle_intersection(Vec2d(x0[0],x0[2]),
-                                     Vec2d(xnew0[0],xnew0[2]),
-                                     Vec2d(x1[0],x1[2]), end1,
-                                     Vec2d(x2[0],x2[2]), end2,
-                                     Vec2d(x3[0],x3[2]), end3, verbose)
-    && segment_triangle_intersection(Vec2d(x0[1],x0[2]),
-                                     Vec2d(xnew0[1],xnew0[2]),
-                                     Vec2d(x1[1],x1[2]), end1,
-                                     Vec2d(x2[1],x2[2]), end2,
-                                     Vec2d(x3[1],x3[2]), end3, verbose);
-}
-
-//=======================================================================================================
-
-static bool segment_tetrahedron_intersection(const Vec3d& x0, const Vec3d& xnew0,
-                                             const Vec3d& x1, bool end1,
-                                             const Vec3d& x2, bool end2,
-                                             const Vec3d& x3, bool end3,
-                                             const Vec3d& x4, bool end4, bool )
-{
-    double o[6];
-    orient(x0, false, xnew0, true, x1, end1, x2, end2, x3, end3, x4, end4, o);
-    if((o[0]==0 || o[1]==0) || (o[2]==0 || o[3]==0 || o[4]==0 || o[5]==0)){ // check for degeneracy
-        if(!(end1==end2 && end1==end3)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x2, end2, x3, end3, o[5])) return true;
-        if(!(end1==end2 && end1==end4)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x2, end2, x4, end4, o[4])) return true;
-        if(!(end1==end3 && end1==end4)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x3, end3, x4, end4, o[3])) return true;
-        if(!(end2==end3 && end2==end4)
-           && segment_triangle_intersection(x0, xnew0, x2, end2, x3, end3, x4, end4, o[2])) return true;
-        return false;
-    }
-    // otherwise, just some sign checks
-    if((o[0]<0 && o[1]>0) || (o[0]>0 && o[1]<0)) return false;
-    return (o[2]<=0 && o[3]<=0 && o[4]<=0 && o[5]<=0)
-    || (o[2]>=0 && o[3]>=0 && o[4]>=0 && o[5]>=0);
-}
-
-static bool segment_tetrahedron_intersection(const Vec3d& x0, const Vec3d& xnew0,
-                                             const Vec3d& x1, bool end1,
-                                             const Vec3d& x2, bool end2,
-                                             const Vec3d& x3, bool end3,
-                                             const Vec3d& x4, bool end4,
-                                             double bary[6], bool verbose )
-{
-    double o[6];
-    orient(x0, false, xnew0, true, x1, end1, x2, end2, x3, end3, x4, end4, o);
-    
-    if ( verbose )
-    {
-        std::cout << "-------" << std::endl;
-        std::cout << "orient: " << std::endl;
-        std::cout << o[0] << std::endl;
-        std::cout << o[1] << std::endl;
-        std::cout << o[2] << std::endl;
-        std::cout << o[3] << std::endl;
-        std::cout << o[4] << std::endl;
-        std::cout << o[5] << std::endl;
-        std::cout << "-------" << std::endl;
-    }
-    
-    if((o[0]==0 || o[1]==0) || (o[2]==0 || o[3]==0 || o[4]==0 || o[5]==0)){ // check for degeneracy
-        // what do we do for bary in this case?
-        // probably best to do something smart, but since degeneracies should be rare and not too
-        // important to handle exactly, just assume equal barycentric coordinates at end of time step
-        
-        if ( verbose ) 
-        { 
-            std::cout << "degen \n ends:" << std::endl; 
-            std::cout << end1 << std::endl;
-            std::cout << end2 << std::endl;
-            std::cout << end3 << std::endl;
-            std::cout << end4 << std::endl;         
-        }
-        
-        bary[0]=0;
-        bary[1]=1;
-        bary[2]=(double)end1/(double)(end1+end2+end3+end4);
-        bary[3]=(double)end2/(double)(end1+end2+end3+end4);
-        bary[4]=(double)end3/(double)(end1+end2+end3+end4);
-        bary[5]=(double)end4/(double)(end1+end2+end3+end4);
-        if(!(end1==end2 && end1==end3)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x2, end2, x3, end3, o[5], verbose )) { if ( verbose ) { std::cout << "1" << std::endl; } return true; }
-        if(!(end1==end2 && end1==end4)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x2, end2, x4, end4, o[4], verbose )) { if ( verbose ) { std::cout << "2" << std::endl; } return true; }
-        if(!(end1==end3 && end1==end4)
-           && segment_triangle_intersection(x0, xnew0, x1, end1, x3, end3, x4, end4, o[3], verbose )) { if ( verbose ) { std::cout << "3" << std::endl; } return true; }
-        if(!(end2==end3 && end2==end4)
-           && segment_triangle_intersection(x0, xnew0, x2, end2, x3, end3, x4, end4, o[2], verbose )) { if ( verbose ) { std::cout << "4" << std::endl; } return true; }
-        
-        return false;
-    }
-    // otherwise, just some sign checks
-    if((o[0]<0 && o[1]>0) || (o[0]>0 && o[1]<0)) return false;
-    if((o[2]<=0 && o[3]<=0 && o[4]<=0 && o[5]<=0) || (o[2]>=0 && o[3]>=0 && o[4]>=0 && o[5]>=0)){
-        bary[0]=o[0]/(o[0]+o[1]);
-        bary[1]=1-bary[0];
-        double sum=o[2]+o[3]+o[4]+o[5]; // actually should be identical to -(o[0]+o[1]) up to rounding error
-        bary[2]=o[2]/sum;
-        bary[3]=o[3]/sum;
-        bary[4]=o[4]/sum;
-        bary[5]=o[5]/sum;
-        return true;
-    }else
-        return false;
-}
-
-// =================================================================================================================================
-
-bool fe_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                 const Vec3d& x1, const Vec3d& xnew1,
-                                 const Vec3d& x2, const Vec3d& xnew2,
-                                 const Vec3d& x3, const Vec3d& xnew3)
-{
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, x2, false, x3, false, xnew3, true, false )) return true;
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, x2, false, xnew2, true, xnew3, true, false)) return true;
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, xnew1, true, xnew2, true, xnew3, true, false)) return true;
-    return false;
-}
-
-bool fe_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                 const Vec3d& x1, const Vec3d& xnew1,
-                                 const Vec3d& x2, const Vec3d& xnew2,
-                                 const Vec3d& x3, const Vec3d& xnew3,
-                                 double& bary1, double& bary2, double& bary3,
-                                 Vec3d& normal,
-                                 double& relative_normal_displacement,
-                                 bool verbose )
-{
-    
-    double t;
-    
-    if ( verbose )
-    {
-        std::cout.precision(20);
-        std::cout << x0 << std::endl;
-        std::cout << xnew0 << std::endl;
-        std::cout << x1 << std::endl;
-        std::cout << xnew1 << std::endl;
-        std::cout << x2 << std::endl;
-        std::cout << xnew2 << std::endl;
-        std::cout << x3 << std::endl;
-        std::cout << xnew3 << std::endl;
-        std::cout << std::endl;
-        
-        print_hex( x0 );
-        print_hex( xnew0 );      
-        print_hex( x1 );
-        print_hex( xnew1 );      
-        print_hex( x2 );
-        print_hex( xnew2 );      
-        print_hex( x3 );
-        print_hex( xnew3 );      
-        std::cout << std::endl;
-    }
-    
-    
-    bool collision=false;
-    double bary[6];
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, x2, false, x3, false, xnew3, true, bary, verbose)){
-        if ( verbose ) { std::cout << "seg-tet 1" << std::endl; }
-        collision=true;
-        bary1=0;
-        bary2=0;
-        bary3=1;
-        t=bary[1];
-        normal=get_normal(x2-x1, x3-x1);
-        relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-    }
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, x2, false, xnew2, true, xnew3, true, bary, verbose)){
-        if(!collision || bary[1]<t){
-            if ( verbose ) { std::cout << "seg-tet 2" << std::endl; }
-            collision=true;
-            bary1=0;
-            bary2=0.5;//(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-            bary3=0.5;//1-bary2;         
-            t=bary[1];
-            normal=get_normal(x2-x1, xnew3-xnew2);
-            relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-        }
-    }
-    if(segment_tetrahedron_intersection(x0, xnew0, x1, false, xnew1, true, xnew2, true, xnew3, true, bary, verbose)){
-        if(!collision || bary[1]<t){
-            if ( verbose ) { std::cout << "seg-tet 3" << std::endl; }
-            collision=true;
-            bary1=0.3333333333333333333333333;//(bary[3]+1e-300)/(bary[3]+bary[4]+bary[5]+3e-300); // guard against zero/zero
-            bary2=0.3333333333333333333333333;//(bary[4]+1e-300)/(bary[3]+bary[4]+bary[5]+3e-300); // guard against zero/zero
-            bary3=0.3333333333333333333333333;//1-bary1-bary2;
-            t=bary[1];
-            normal=get_normal(xnew2-xnew1, xnew3-xnew1);
-            relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew1-x1));
-        }
-    }
-    return collision;
-}
-
-
-//=======================================================================================================
-
-static bool triangle_triangle_intersection(const Vec3d& x0, bool end0,
-                                           const Vec3d& x1, bool end1,
-                                           const Vec3d& x2, bool end2,
-                                           const Vec3d& x3, bool end3,
-                                           const Vec3d& x4, bool end4,
-                                           const Vec3d& x5, bool end5)
-{
-    double o[6];
-    orient(x0, end0, x1, end1, x2, end2, x3, end3, x4, end4, x5, end5, o);
-    if((o[0]==0 || o[1]==0 || o[2]==0) || (o[3]==0 || o[4]==0 || o[5]==0)){ // check for degeneracy
-        if(!end0 && end1 && segment_triangle_intersection(x0, x1, x3, end3, x4, end4, x5, end5, o[2])) return true;
-        if(end0 && !end1 && segment_triangle_intersection(x1, x0, x3, end3, x4, end4, x5, end5, o[2])) return true;
-        if(!end0 && end2 && segment_triangle_intersection(x0, x2, x3, end3, x4, end4, x5, end5, o[1])) return true;
-        if(end0 && !end2 && segment_triangle_intersection(x2, x0, x3, end3, x4, end4, x5, end5, o[1])) return true;
-        if(!end1 && end2 && segment_triangle_intersection(x1, x2, x3, end3, x4, end4, x5, end5, o[0])) return true;
-        if(end1 && !end2 && segment_triangle_intersection(x2, x1, x3, end3, x4, end4, x5, end5, o[0])) return true;
-        if(!end3 && end4 && segment_triangle_intersection(x3, x4, x0, end0, x1, end1, x2, end2, o[5])) return true;
-        if(end3 && !end4 && segment_triangle_intersection(x4, x3, x0, end0, x1, end1, x2, end2, o[5])) return true;
-        if(!end3 && end5 && segment_triangle_intersection(x3, x5, x0, end0, x1, end1, x2, end2, o[4])) return true;
-        if(end3 && !end5 && segment_triangle_intersection(x5, x3, x0, end0, x1, end1, x2, end2, o[4])) return true;
-        if(!end4 && end5 && segment_triangle_intersection(x4, x5, x0, end0, x1, end1, x2, end2, o[3])) return true;
-        if(end4 && !end5 && segment_triangle_intersection(x5, x4, x0, end0, x1, end1, x2, end2, o[3])) return true;
-        return false;
-    }
-    // otherwise, just some simple sign checks
-    if((o[0]<=0 && o[1]<=0 && o[2]<=0) || (o[0]>=0 && o[1]>=0 && o[2]>=0))
-        return (o[3]<=0 && o[4]<=0 && o[5]<=0) || (o[3]>=0 && o[4]>=0 && o[5]>=0);
-    else
-        return false;
-}
-
-static bool triangle_triangle_intersection(const Vec3d& x0, bool end0,
-                                           const Vec3d& x1, bool end1,
-                                           const Vec3d& x2, bool end2,
-                                           const Vec3d& x3, bool end3,
-                                           const Vec3d& x4, bool end4,
-                                           const Vec3d& x5, bool end5,
-                                           double bary[6])
-{
-    double o[6];
-    orient(x0, end0, x1, end1, x2, end2, x3, end3, x4, end4, x5, end5, o);
-    if((o[0]==0 || o[1]==0 || o[2]==0) || (o[3]==0 || o[4]==0 || o[5]==0)){ // check for degeneracy
-        // what do we do for bary here?
-        // probably best to do something smart, but since degeneracies should be rare and not too
-        // important to handle exactly, just assume equal barycentric coordinates at the end of the time step
-        bary[0]=(double)end0/(double)(end0+end1+end2);
-        bary[1]=(double)end1/(double)(end0+end1+end2);
-        bary[2]=(double)end2/(double)(end0+end1+end2);
-        bary[3]=(double)end3/(double)(end3+end4+end5);
-        bary[4]=(double)end4/(double)(end3+end4+end5);
-        bary[5]=(double)end5/(double)(end3+end4+end5);
-        if(!end0 && end1 && segment_triangle_intersection(x0, x1, x3, end3, x4, end4, x5, end5, o[2])) return true;
-        if(end0 && !end1 && segment_triangle_intersection(x1, x0, x3, end3, x4, end4, x5, end5, o[2])) return true;
-        if(!end0 && end2 && segment_triangle_intersection(x0, x2, x3, end3, x4, end4, x5, end5, o[1])) return true;
-        if(end0 && !end2 && segment_triangle_intersection(x2, x0, x3, end3, x4, end4, x5, end5, o[1])) return true;
-        if(!end1 && end2 && segment_triangle_intersection(x1, x2, x3, end3, x4, end4, x5, end5, o[0])) return true;
-        if(end1 && !end2 && segment_triangle_intersection(x2, x1, x3, end3, x4, end4, x5, end5, o[0])) return true;
-        if(!end3 && end4 && segment_triangle_intersection(x3, x4, x0, end0, x1, end1, x2, end2, o[5])) return true;
-        if(end3 && !end4 && segment_triangle_intersection(x4, x3, x0, end0, x1, end1, x2, end2, o[5])) return true;
-        if(!end3 && end5 && segment_triangle_intersection(x3, x5, x0, end0, x1, end1, x2, end2, o[4])) return true;
-        if(end3 && !end5 && segment_triangle_intersection(x5, x3, x0, end0, x1, end1, x2, end2, o[4])) return true;
-        if(!end4 && end5 && segment_triangle_intersection(x4, x5, x0, end0, x1, end1, x2, end2, o[3])) return true;
-        if(end4 && !end5 && segment_triangle_intersection(x5, x4, x0, end0, x1, end1, x2, end2, o[3])) return true;
-        return false;
-    }
-    // otherwise, just some simple sign checks
-    if((o[0]<=0 && o[1]<=0 && o[2]<=0) || (o[0]>=0 && o[1]>=0 && o[2]>=0)){
-        if((o[3]<=0 && o[4]<=0 && o[5]<=0) || (o[3]>=0 && o[4]>=0 && o[5]>=0)){
-            double sum=o[0]+o[1]+o[2];
-            bary[0]=o[0]/sum;
-            bary[1]=o[1]/sum;
-            bary[2]=1-bary[0]-bary[1];
-            sum=o[3]+o[4]+o[5]; // recompute for safety, but it should be the negative of the first sum up to rounding
-            bary[3]=o[3]/sum;
-            bary[4]=o[4]/sum;
-            bary[5]=1-bary[3]-bary[4];
-            return true;
-        }else
-            return false;
-    }else
-        return false;
-}
-
-bool fe_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                  const Vec3d& x1, const Vec3d& xnew1,
-                                  const Vec3d& x2, const Vec3d& xnew2,
-                                  const Vec3d& x3, const Vec3d& xnew3)
-{
-    if(triangle_triangle_intersection(x0, false, x1, false, xnew1, true, x2, false, x3, false, xnew3, true))
-        return true;
-    if(triangle_triangle_intersection(x0, false, xnew0, true, xnew1, true, x2, false, x3, false, xnew3, true))
-        return true;
-    if(triangle_triangle_intersection(x0, false, x1, false, xnew1, true, x2, false, xnew2, true, xnew3, true))
-        return true;
-    if(triangle_triangle_intersection(x0, false, xnew0, true, xnew1, true, x2, false, xnew2, true, xnew3, true))
-        return true;
-    return false;
-}
-
-bool fe_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                  const Vec3d& x1, const Vec3d& xnew1,
-                                  const Vec3d& x2, const Vec3d& xnew2,
-                                  const Vec3d& x3, const Vec3d& xnew3,
-                                  double& bary0, double& bary2,
-                                  Vec3d& normal,
-                                  double& relative_normal_displacement,
-                                  bool verbose )
-{
-    double t;
-    
-    if ( verbose )
-    {
-        std::cout << x0 << std::endl;
-        std::cout << xnew0 << std::endl;
-        std::cout << x1 << std::endl;
-        std::cout << xnew1 << std::endl;
-        std::cout << x2 << std::endl;
-        std::cout << xnew2 << std::endl;
-        std::cout << x3 << std::endl;
-        std::cout << xnew3 << std::endl;
-        std::cout << std::endl;
-        
-        print_hex( x0 );
-        print_hex( xnew0 );      
-        print_hex( x1 );
-        print_hex( xnew1 );      
-        print_hex( x2 );
-        print_hex( xnew2 );      
-        print_hex( x3 );
-        print_hex( xnew3 );      
-        std::cout << std::endl;
-    }
-    
-    bool collision=false;
-    double bary[6];
-    if(triangle_triangle_intersection(x0, false, x1, false, xnew1, true, x2, false, x3, false, xnew3, true, bary)){
-        collision=true;
-        bary0=0;
-        bary2=0;
-        t=bary[2];
-        normal=get_normal(x1-x0, x3-x2);
-        relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew3-x3));
-    }
-    if(triangle_triangle_intersection(x0, false, xnew0, true, xnew1, true, x2, false, x3, false, xnew3, true, bary)){
-        if(!collision || bary[5]<t){
-            collision=true;
-            bary0=0.5;//(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-            bary2=0;
-            t=bary[5];
-            normal=get_normal(xnew1-xnew0, x3-x2);
-            relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-        }
-    }
-    if(triangle_triangle_intersection(x0, false, x1, false, xnew1, true, x2, false, xnew2, true, xnew3, true, bary)){
-        if(!collision || bary[2]<t){
-            collision=true;
-            bary0=0;
-            bary2=0.5;//(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-            t=bary[2];
-            normal=get_normal(x1-x0, xnew3-xnew2);
-            relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew2-x2));
-        }
-    }
-    if(triangle_triangle_intersection(x0, false, xnew0, true, xnew1, true, x2, false, xnew2, true, xnew3, true, bary)){
-        if(!collision || 1-bary[0]<t){
-            collision=true;
-            bary0=0.5;//(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-            bary2=0.5;//(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-            t=1-bary[0];
-            normal=get_normal(xnew1-xnew0, xnew3-xnew2);
-            relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-        }
-    }
-    return collision;
-}
-
-
-//=======================================================================================================
-
-static bool segment_segment_intersection(const Vec3d& x0, const Vec3d& x1,
-                                         const Vec3d& x2, const Vec3d& x3,
-                                         double coplanarity)
-{
-    if(coplanarity) return false; // points are not coplanar, so segments are skew, therefore no intersection
-    // now we know they're in a single plane in 3d; try all projections
-    return fe_segment_segment_intersection(Vec2d(x0[0],x0[1]),
-                                           Vec2d(x1[0],x1[1]),
-                                           Vec2d(x2[0],x2[1]),
-                                           Vec2d(x3[0],x3[1]))
-    && fe_segment_segment_intersection(Vec2d(x0[0],x0[2]),
-                                       Vec2d(x1[0],x1[2]),
-                                       Vec2d(x2[0],x2[2]),
-                                       Vec2d(x3[0],x3[2]))
-    && fe_segment_segment_intersection(Vec2d(x0[1],x0[2]),
-                                       Vec2d(x1[1],x1[2]),
-                                       Vec2d(x2[1],x2[2]),
-                                       Vec2d(x3[1],x3[2]));
-}
-
-
-bool fe_segment_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                      const Vec3d& x2, const Vec3d& x3, const Vec3d& x4, 
-                                      double& a, double& b, double& c, double& s, double& t, 
-                                      bool /*degenerate_counts_as_intersection*/,
-                                      bool /*verbose*/ )
-{
-    double d012, d013, d014, d023, d024, d034, d123, d124, d134, d234;
-    d012=determinant(x0, x1, x2); d013=determinant(x0, x1, x3); d014=determinant(x0, x1, x4);
-    d023=determinant(x0, x2, x3); d024=determinant(x0, x2, x4); d034=determinant(x0, x3, x4);
-    d123=determinant(x1, x2, x3); d124=determinant(x1, x2, x4); d134=determinant(x1, x3, x4);
-    d234=determinant(x2, x3, x4);
-    double p012, p013, p014, p023, p024, p034, p123, p124, p134, p234;
-    Vec3d a0(std::fabs(x0[0]), std::fabs(x0[1]), std::fabs(x0[2])),
-    a1(std::fabs(x1[0]), std::fabs(x1[1]), std::fabs(x1[2])),
-    a2(std::fabs(x2[0]), std::fabs(x2[1]), std::fabs(x2[2])),
-    a3(std::fabs(x3[0]), std::fabs(x3[1]), std::fabs(x3[2])),
-    a4(std::fabs(x4[0]), std::fabs(x4[1]), std::fabs(x4[2]));
-    p012=permanent(a0, a1, a2); p013=permanent(a0, a1, a3); p014=permanent(a0, a1, a4);
-    p023=permanent(a0, a2, a3); p024=permanent(a0, a2, a4); p034=permanent(a0, a3, a4);
-    p123=permanent(a1, a2, a3); p124=permanent(a1, a2, a4); p134=permanent(a1, a3, a4);
-    p234=permanent(a2, a3, a4);
-    // error in dABC is certainly bounded by pABC*5.1*DBL_EPSILON
-    
-    // now do the 4x4's
-    double d0123=(d123-d023)+(d013-d012), p0123=(p123+p023)+(p013+p012),
-    d0124=(d124-d024)+(d014-d012), p0124=(p124+p024)+(p014+p012),
-    d0134=(d134-d034)+(d014-d013), p0134=(p134+p034)+(p014+p013),
-    d0234=(d234-d034)+(d024-d023), p0234=(p234+p034)+(p024+p023),
-    d1234=(d234-d134)+(d124-d123), p1234=(p234+p134)+(p124+p123);
-    // error in dABCD is certainly bounded by pABCD*8.1*DBL_EPSILON
-    
-    // and the actual values
-    s=check_error(d1234, p1234, 9), t=-check_error(d0234, p0234, 9);
-    if((s<0 && t>0) || (s>0 && t<0)) return false;
-    a=check_error(d0134, p0134, 9),
-    b=-check_error(d0124, p0124, 9),
-    c=check_error(d0123, p0123, 9);
-    if((s==0 || t==0) || (a==0 || b==0 || c==0)){ // check for degeneracy
-        return segment_segment_intersection(x0, x1, x2, x3, c)
-        || segment_segment_intersection(x0, x1, x2, x4, b)
-        || segment_segment_intersection(x0, x1, x3, x4, a);
-    }
-    return (a<=0 && b<=0 && c<=0) || (a>=0 && b>=0 && c>=0);
-}
-
-
-
-bool fe_segment_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                      const Vec3d& x2, const Vec3d& x3, const Vec3d& x4, 
-                                      bool degenerate_counts_as_intersection,
-                                      bool verbose )
-{
-    double a, b, c, s, t;
-    return fe_segment_triangle_intersection( x0, x1, x2, x3, x4, a, b, c, s, t, degenerate_counts_as_intersection, verbose );
-}
-
-
-
-
-//=======================================================================================================
-
-static bool point_triangle_intersection(const Vec2d& x0, const Vec2d& x1,
-                                        const Vec2d& x2, const Vec2d& x3)
-{
-    double a=orient(x0, x2, x3), b=orient(x0, x1, x3), c=orient(x0, x1, x2);
-    if(a==0 || b==0 || c==0){ // check for degeneracy
-        return point_segment_intersection(x0, x1, x2)
-        || point_segment_intersection(x0, x1, x3)
-        || point_segment_intersection(x0, x2, x3);
-    }
-    return (a<=0 && b<=0 && c<=0) || (a>=0 && b>=0 && c>=0);
-}
-
-
-static bool point_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                        const Vec3d& x2, const Vec3d& x3,
-                                        double coplanarity)
-{
-    if(coplanarity) return false; // points are not coplanar, so point is not in triangle
-    // now we know they're in a single plane in 3d - check all projections
-    return point_triangle_intersection(Vec2d(x0[0],x0[1]),
-                                       Vec2d(x1[0],x1[1]),
-                                       Vec2d(x2[0],x2[1]),
-                                       Vec2d(x3[0],x3[1]))
-    && point_triangle_intersection(Vec2d(x0[0],x0[2]),
-                                   Vec2d(x1[0],x1[2]),
-                                   Vec2d(x2[0],x2[2]),
-                                   Vec2d(x3[0],x3[2]))
-    && point_triangle_intersection(Vec2d(x0[1],x0[2]),
-                                   Vec2d(x1[1],x1[2]),
-                                   Vec2d(x2[1],x2[2]),
-                                   Vec2d(x3[1],x3[2]));
-}
-
-bool fe_point_tetrahedron_intersection(const Vec3d& x0, const Vec3d& x1,
-                                       const Vec3d& x2, const Vec3d& x3, const Vec3d& x4)
-{
-    double d012, d013, d014, d023, d024, d034, d123, d124, d134, d234;
-    d012=determinant(x0, x1, x2); d013=determinant(x0, x1, x3); d014=determinant(x0, x1, x4);
-    d023=determinant(x0, x2, x3); d024=determinant(x0, x2, x4); d034=determinant(x0, x3, x4);
-    d123=determinant(x1, x2, x3); d124=determinant(x1, x2, x4); d134=determinant(x1, x3, x4);
-    d234=determinant(x2, x3, x4);
-    double p012, p013, p014, p023, p024, p034, p123, p124, p134, p234;
-    Vec3d a0(std::fabs(x0[0]), std::fabs(x0[1]), std::fabs(x0[2])),
-    a1(std::fabs(x1[0]), std::fabs(x1[1]), std::fabs(x1[2])),
-    a2(std::fabs(x2[0]), std::fabs(x2[1]), std::fabs(x2[2])),
-    a3(std::fabs(x3[0]), std::fabs(x3[1]), std::fabs(x3[2])),
-    a4(std::fabs(x4[0]), std::fabs(x4[1]), std::fabs(x4[2]));
-    p012=permanent(a0, a1, a2); p013=permanent(a0, a1, a3); p014=permanent(a0, a1, a4);
-    p023=permanent(a0, a2, a3); p024=permanent(a0, a2, a4); p034=permanent(a0, a3, a4);
-    p123=permanent(a1, a2, a3); p124=permanent(a1, a2, a4); p134=permanent(a1, a3, a4);
-    p234=permanent(a2, a3, a4);
-    // error in dABC is certainly bounded by pABC*5.1*DBL_EPSILON
-    
-    // now do the 4x4's
-    double d0123=(d123-d023)+(d013-d012), p0123=(p123+p023)+(p013+p012),
-    d0124=(d124-d024)+(d014-d012), p0124=(p124+p024)+(p014+p012),
-    d0134=(d134-d034)+(d014-d013), p0134=(p134+p034)+(p014+p013),
-    d0234=(d234-d034)+(d024-d023), p0234=(p234+p034)+(p024+p023);
-    // error in dABCD is certainly bounded by pABCD*8.1*DBL_EPSILON
-    
-    // and the actual values
-    double a=check_error(d0234, p0234, 9),
-    b=-check_error(d0134, p0134, 9),
-    c=check_error(d0124, p0124, 9),
-    d=-check_error(d0123, p0123, 9);
-    if(a==0 || b==0 || c==0 || d==0){ // check for degeneracy
-        return point_triangle_intersection(x0, x2, x3, x4, a)
-        || point_triangle_intersection(x0, x1, x3, x4, b)
-        || point_triangle_intersection(x0, x1, x2, x4, c)
-        || point_triangle_intersection(x0, x1, x2, x3, d);
-    }
-    return (a<=0 && b<=0 && c<=0 && d<=0) || (a>=0 && b>=0 && c>=0 && d>=0);
-}
-
diff --git a/extern/eltopo/common/predicates.h b/extern/eltopo/common/predicates.h
deleted file mode 100644
index 4a21090..0000000
--- a/extern/eltopo/common/predicates.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef PREDICATES_H
-#define PREDICATES_H
-
-#include <vec.h>
-
-const int MAX_COORD_2D=619925131;
-const int MAX_COORD_3D=577053;
-
-
-//======================================================================================================
-// double precision floating point versions; they err on the side of safety (indicate collision when
-// it's too close to tell for sure, or exactly touches)
-//======================================================================================================
-
-// x0 is the point, x1-x2 is the segment. Take care to specify x1,x2 in sorted order of index!
-bool fe_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0,
-                                const Vec2d& x1, const Vec2d& xnew1,
-                                const Vec2d& x2, const Vec2d& xnew2);
-
-bool fe_point_segment_collision(const Vec2d& x0, const Vec2d& xnew0,
-                                const Vec2d& x1, const Vec2d& xnew1,
-                                const Vec2d& x2, const Vec2d& xnew2,
-                                double& edge_bary, Vec2d& normal, double& t,
-                                double& relative_normal_displacement );
-
-// x0-x1 and x2-x3 are the segments. Order is irrelevant.
-bool fe_segment_segment_intersection(const Vec2d& x0, const Vec2d& x1,
-                                     const Vec2d& x2, const Vec2d& x3);
-
-bool fe_segment_segment_intersection(const Vec2d& x0, const Vec2d& x1,
-                                     const Vec2d& x2, const Vec2d& x3,
-                                     double& alpha, double& beta );
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-bool fe_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                 const Vec3d& x1, const Vec3d& xnew1,
-                                 const Vec3d& x2, const Vec3d& xnew2,
-                                 const Vec3d& x3, const Vec3d& xnew3);
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-// If there is a collision, returns true and sets bary1, bary2, bary3 to the barycentric coordinates of
-// the collision point, sets normal to the collision point, t to the collision time, and the relative
-// normal displacement (in terms of point 0 minus triangle 1-2-3)
-bool fe_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                 const Vec3d& x1, const Vec3d& xnew1,
-                                 const Vec3d& x2, const Vec3d& xnew2,
-                                 const Vec3d& x3, const Vec3d& xnew3,
-                                 double& bary1, double& bary2, double& bary3,
-                                 Vec3d& normal,
-                                 double& relative_normal_displacement,
-                                 bool verbose = false );
-
-// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
-bool fe_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                  const Vec3d& x1, const Vec3d& xnew1,
-                                  const Vec3d& x2, const Vec3d& xnew2,
-                                  const Vec3d& x3, const Vec3d& xnew3);
-
-// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
-// If there is a collision, returns true and sets bary0 and bary2 to parts of the barycentric coordinates of
-// the collision point, sets normal to the collision point, t to the collision time, and the relative
-// normal displacement (in terms of edge 0-1 minus edge 2-3)
-bool fe_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0,
-                                  const Vec3d& x1, const Vec3d& xnew1,
-                                  const Vec3d& x2, const Vec3d& xnew2,
-                                  const Vec3d& x3, const Vec3d& xnew3,
-                                  double& bary0, double& bary2,
-                                  Vec3d& normal,
-                                  double& relative_normal_displacement,
-                                  bool verbose = false );
-
-bool fe_segment_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                      const Vec3d& x2, const Vec3d& x3, const Vec3d& x4, 
-                                      double& a, double& b, double& c, double& s, double& t, 
-                                      bool /*degenerate_counts_as_intersection*/,
-                                      bool /*verbose*/ );
-
-// x0-x1 is the segment and and x2-x3-x4 is the triangle. Order is irrelevant.
-bool fe_segment_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                      const Vec3d& x2, const Vec3d& x3, const Vec3d& x4, 
-                                      bool degenerate_counts_as_intersection,
-                                      bool verbose = false );
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool fe_point_tetrahedron_intersection(const Vec3d& x0, const Vec3d& x1,
-                                       const Vec3d& x2, const Vec3d& x3, const Vec3d& x4);
-
-#endif
diff --git a/extern/eltopo/common/runstats.cpp b/extern/eltopo/common/runstats.cpp
deleted file mode 100644
index a8bdf22..0000000
--- a/extern/eltopo/common/runstats.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- *  runstats.cpp
- *  eltopo3d_project
- *
- *  Created by tyson on 21/04/11.
- *
- */
-
-#include <runstats.h>
-
-#include <commonoptions.h>
-#include <fstream>
-
-// ------------------------------------------------------------------
-
-void RunStats::set_int( std::string name, int64_t value )
-{
-    int_stats[name] = value;
-}
-
-void RunStats::add_to_int( std::string name, int64_t increment )
-{
-    int64_t value = 0;
-    bool exists = get_int( name, value );
-    if ( !exists )
-    {
-        value = 0;
-    }
-    value += increment;
-    set_int( name, value );
-}
-
-int64_t RunStats::get_int( std::string name )
-{
-    std::map<std::string, int64_t>::iterator iter = int_stats.find( name );
-    if (  iter == int_stats.end() ) { return ~0; }
-    return iter->second;
-}
-
-bool RunStats::get_int( std::string name, int64_t& value )
-{
-    std::map<std::string, int64_t>::iterator iter = int_stats.find( name );
-    if ( iter == int_stats.end() )
-    {
-        return false;
-    }
-    value = iter->second;
-    return true;  
-}
-
-void RunStats::update_min_int( std::string name, int64_t value )
-{
-    int64_t current_min;
-    bool exists = get_int( name, current_min );
-    if ( !exists ) { current_min = value; }
-    int_stats[name] = std::min( value, current_min );
-}
-
-void RunStats::update_max_int( std::string name, int64_t value )
-{
-    int64_t current_max;
-    bool exists = get_int( name, current_max );
-    if ( !exists ) { current_max = value; }
-    int_stats[name] = std::max( value, current_max );
-}
-
-// ------------------------------------------------------------------
-
-void RunStats::set_double( std::string name, double value )
-{
-    double_stats[name] = value;
-}
-
-void RunStats::add_to_double( std::string name, double increment )
-{
-    double value = 0;
-    bool exists = get_double( name, value );
-    if ( !exists )
-    {
-        value = 0;
-    }
-    value += increment;
-    set_double( name, value );
-}
-
-double RunStats::get_double( std::string name )
-{
-    std::map<std::string, double>::iterator iter = double_stats.find( name );
-    if ( iter == double_stats.end() ) { return UNINITIALIZED_DOUBLE; }
-    return iter->second;
-}
-
-bool RunStats::get_double( std::string name, double& value )
-{
-    std::map<std::string, double>::iterator iter = double_stats.find( name );
-    if ( iter == double_stats.end() )
-    {
-        return false;
-    }
-    value = iter->second;
-    return true;     
-}
-
-void RunStats::update_min_double( std::string name, double value )
-{
-    double current_min;
-    bool exists = get_double( name, current_min );
-    if ( !exists ) { current_min = value; }
-    double_stats[name] = std::min( value, current_min );
-}
-
-void RunStats::update_max_double( std::string name, double value )
-{
-    double current_max;
-    bool exists = get_double( name, current_max );
-    if ( !exists ) { current_max = value; }
-    double_stats[name] = std::max( value, current_max );
-}
-
-// ------------------------------------------------------------------
-
-void RunStats::add_per_frame_int( std::string name, int frame, int64_t value )
-{
-    std::vector<PerFrameInt>& sequence = per_frame_int_stats[name];
-    sequence.push_back( PerFrameInt(frame,value) );
-}
-
-bool RunStats::get_per_frame_ints( std::string name, std::vector<PerFrameInt>& sequence )
-{
-    std::map<std::string, std::vector<PerFrameInt> >::iterator iter = per_frame_int_stats.find( name );
-    if ( iter == per_frame_int_stats.end() )
-    {
-        return false;
-    }
-    sequence = iter->second;
-    return true;  
-}
-
-// ------------------------------------------------------------------
-
-void RunStats::add_per_frame_double( std::string name, int frame, double value )
-{
-    std::vector<PerFrameDouble>& sequence = per_frame_double_stats[name];
-    sequence.push_back( PerFrameDouble(frame,value) );
-}
-
-bool RunStats::get_per_frame_doubles( std::string name, std::vector<PerFrameDouble>& sequence )
-{
-    std::map<std::string, std::vector<PerFrameDouble> >::iterator iter = per_frame_double_stats.find( name );
-    if ( iter == per_frame_double_stats.end() )
-    {
-        return false;
-    }
-    sequence = iter->second;
-    return true;  
-}
-
-// ------------------------------------------------------------------
-
-void RunStats::write_to_file( const char* filename )
-{
-    std::ofstream file( filename );
-    
-    // ----------
-    if ( !int_stats.empty() )
-    {
-        file << "int_stats: " << std::endl << "----------" << std::endl;
-        std::map<std::string, int64_t>::iterator int_iterator = int_stats.begin();
-        for ( ; int_iterator != int_stats.end(); ++int_iterator )
-        {
-            file << int_iterator->first << ": " << int_iterator->second << std::endl;
-        }   
-        file << std::endl;
-    }
-    
-    // ----------
-    
-    if ( !double_stats.empty() )
-    {
-        file << "double_stats: " << std::endl << "----------" << std::endl;
-        std::map<std::string, double>::iterator double_iterator = double_stats.begin();
-        for ( ; double_iterator != double_stats.end(); ++double_iterator )
-        {
-            file << double_iterator->first << ": " << double_iterator->second << std::endl;
-        }
-        file << std::endl;
-    }
-    
-    // ----------
-    
-    if ( !per_frame_int_stats.empty() )
-    {
-        file << "per_frame_int_stats: " << std::endl << "----------" << std::endl;
-        std::map<std::string, std::vector<PerFrameInt> >::iterator pfi_iter = per_frame_int_stats.begin();
-        for ( ; pfi_iter != per_frame_int_stats.end(); ++pfi_iter )
-        {
-            file << pfi_iter->first << ": " << std::endl;
-            std::vector<PerFrameInt>& sequence = pfi_iter->second;
-            for ( unsigned int i = 0; i < sequence.size(); ++i )
-            {
-                file << sequence[i].first << " " << sequence[i].second << std::endl;
-            }
-        }
-        file << std::endl;
-    }   
-    
-    // ----------
-    
-    if ( !per_frame_double_stats.empty() )
-    {
-        file << "per_frame_double_stats: " << std::endl << "----------" << std::endl;
-        std::map<std::string, std::vector<PerFrameDouble> >::iterator pfd_iter = per_frame_double_stats.begin();
-        for ( ; pfd_iter != per_frame_double_stats.end(); ++pfd_iter )
-        {
-            file << pfd_iter->first << ": " << std::endl;
-            std::vector<PerFrameDouble>& sequence = pfd_iter->second;
-            for ( unsigned int i = 0; i < sequence.size(); ++i )
-            {
-                file << sequence[i].first << " " << sequence[i].second << std::endl;
-            }
-        }
-        file << std::endl;      
-    }
-    
-}
-
-// ------------------------------------------------------------------
-
-void RunStats::clear()
-{
-    int_stats.clear();
-    double_stats.clear();
-    per_frame_int_stats.clear();
-    per_frame_double_stats.clear();
-}
-
-
-
-
diff --git a/extern/eltopo/common/runstats.h b/extern/eltopo/common/runstats.h
deleted file mode 100644
index bbaa9d3..0000000
--- a/extern/eltopo/common/runstats.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *  runstats.h
- *  eltopo3d_project
- *
- *  Created by tyson on 21/04/11.
- *
- */
-
-// Hold some runtime stats
-
-#ifndef RUNSTATS_H
-#define RUNSTATS_H
-
-#include <map>
-#include <string>
-#  if (defined(_MSC_VER) && _MSC_VER < 1600)
-// stdint.h is not available before VS2010
-#if defined(_WIN32) && !defined(__MINGW32__)
-/* The __intXX are built-in types of the visual complier! So we don't
-   need to include anything else here.
-   This typedefs should be in sync with types from MEM_sys_types.h */
-
-typedef signed __int8  int8_t;
-typedef signed __int16 int16_t;
-typedef signed __int32 int32_t;
-
-typedef unsigned __int8  uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-#endif
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#  else
-#    include <stdint.h>
-#  endif
-#include <vector>
-
-class RunStats
-{
-    
-public:
-    
-    RunStats() :
-    int_stats(),
-    double_stats(),
-    per_frame_int_stats(),
-    per_frame_double_stats()
-    {}
-    
-    
-    typedef std::pair<int, int64_t> PerFrameInt;
-    typedef std::pair<int, double> PerFrameDouble;
-    
-    void set_int( std::string name, int64_t value );
-    void add_to_int( std::string name, int64_t increment );
-    int64_t get_int( std::string name );
-    bool get_int( std::string name, int64_t& value );
-    void update_min_int( std::string name, int64_t value );
-    void update_max_int( std::string name, int64_t value );
-    
-    void set_double( std::string name, double value );
-    void add_to_double( std::string name, double increment );
-    double get_double( std::string name );
-    bool get_double( std::string name, double& value );
-    void update_min_double( std::string name, double value );
-    void update_max_double( std::string name, double value );
-    
-    void add_per_frame_int( std::string name, int frame, int64_t value );   
-    bool get_per_frame_ints( std::string name, std::vector<PerFrameInt>& sequence );
-    
-    void add_per_frame_double( std::string name, int frame, double value );  
-    bool get_per_frame_doubles( std::string name, std::vector<PerFrameDouble>& sequence );
-    
-    void write_to_file( const char* filename );
-    
-    void clear();
-    
-private:
-    
-    std::map<std::string, int64_t> int_stats;
-    std::map<std::string, double> double_stats;
-    
-    std::map<std::string, std::vector<PerFrameInt> > per_frame_int_stats;
-    std::map<std::string, std::vector<PerFrameDouble> > per_frame_double_stats;
-    
-};
-
-
-
-#endif
diff --git a/extern/eltopo/common/sos_ccd_wrapper.cpp b/extern/eltopo/common/sos_ccd_wrapper.cpp
deleted file mode 100644
index 3703114..0000000
--- a/extern/eltopo/common/sos_ccd_wrapper.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-
-// ---------------------------------------------------------
-//
-//  sos_ccd_wrapper.cpp
-//  Tyson Brochu 2009
-//
-//  Tunicate-based implementation of collision and intersection queries.  Uses exact arithmetic with SoS.
-//  (See Robert Bridson's "Tunicate" library.)
-//
-// ---------------------------------------------------------
-
-#include <ccd_wrapper.h>
-
-#ifdef USE_SOS_TUNICATE_CCD
-
-
-#include <tunicate.h>
-#include <vec.h>
-
-const unsigned int nv = 1000000;
-
-// return a unit-length vector orthogonal to u and v
-static Vec3d get_normal(const Vec3d& u, const Vec3d& v)
-{
-   Vec3d c=cross(u,v);
-   double m=mag(c);
-   if(m) return c/m;
-   // degenerate case: either u and v are parallel, or at least one is zero; pick an arbitrary orthogonal vector
-   if(mag2(u)>=mag2(v)){
-      if(std::fabs(u[0])>=std::fabs(u[1]) && std::fabs(u[0])>=std::fabs(u[2]))
-         c=Vec3d(-u[1]-u[2], u[0], u[0]);
-      else if(std::fabs(u[1])>=std::fabs(u[2]))
-         c=Vec3d(u[1], -u[0]-u[2], u[1]);
-      else
-         c=Vec3d(u[2], u[2], -u[0]-u[1]);
-   }else{
-      if(std::fabs(v[0])>=std::fabs(v[1]) && std::fabs(v[0])>=std::fabs(v[2]))
-         c=Vec3d(-v[1]-v[2], v[0], v[0]);
-      else if(std::fabs(v[1])>=std::fabs(v[2]))
-         c=Vec3d(v[1], -v[0]-v[2], v[1]);
-      else
-         c=Vec3d(v[2], v[2], -v[0]-v[1]);
-   }
-   m=mag(c);
-   if(m) return c/m;
-   // really degenerate case: u and v are both zero vectors; pick a random unit-length vector
-   c[0]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-   c[1]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-   c[2]=random()%2 ? -0.577350269189626 : 0.577350269189626;
-   return c;
-}
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                       const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                       const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                       const Vec3d& x3, const Vec3d& xnew3, unsigned int index3 )
-{
-   
-   const int segment_tetrahedron_test = 2;
-
-   double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-   double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-   double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-   double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-   double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-   double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-   double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-   double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-   
-   double a0, a1, a2, a3, a4, a5;
-   
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1, p1,
-                                    index2, p2,
-                                    index3, p3,
-                                    index3 + nv, pnew3,
-                                    &a0, &a1, &a2, &a3, &a4, &a5 ) )
-   {
-      return true;
-   }
-
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1, p1,
-                                    index2, p2,
-                                    index2 + nv, pnew2,
-                                    index3 + nv, pnew3,
-                                    &a0, &a1, &a2, &a3, &a4, &a5 ) )
-   {
-      return true;
-   }
-
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1, p1,
-                                    index1 + nv, pnew1,
-                                    index2 + nv, pnew2,
-                                    index3 + nv, pnew3,
-                                    &a0, &a1, &a2, &a3, &a4, &a5 ) )
-   {
-      return true;
-   }
-   
-   return false;
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool tunicate_point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                       const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                       const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                       const Vec3d& x3, const Vec3d& xnew3, unsigned int index3,
-                                       double& bary1, double& bary2, double& bary3,
-                                       Vec3d& normal,
-                                       double& t,
-                                       double& relative_normal_displacement,
-                                       bool verbose )
-{
- 
-   const int segment_tetrahedron_test = 2;
-   
-   double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-   double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-   double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-   double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-   double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-   double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-   double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-   double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-   
-   bool collision=false;
-   double bary[6];
-   
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1, p1,
-                                    index2, p2,
-                                    index3, p3,
-                                    index3 + nv, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      collision=true;
-      t=bary[1];
-      normal=get_normal(x2-x1, x3-x1);
-      relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-   }
-   
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                   index0, p0,
-                                   index0 + nv, pnew0,
-                                   index1, p1,
-                                   index2, p2,
-                                   index2 + nv, pnew2,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[1]<t)
-      {
-         collision=true;
-         t=bary[1];
-         normal=get_normal(x2-x1, xnew3-xnew2);
-         relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-      }
-   }
-
-   if ( sos_simplex_intersection4d( segment_tetrahedron_test,
-                                   index0, p0,
-                                   index0 + nv, pnew0,
-                                   index1, p1,
-                                   index1 + nv, pnew1,
-                                   index2 + nv, pnew2,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[1]<t)
-      {
-         collision=true;
-         t=bary[1];
-         normal=get_normal(xnew2-xnew1, xnew3-xnew1);
-         relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew1-x1));
-      }
-   }
-   
-   return collision;
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-bool tunicate_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                        const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                        const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                        const Vec3d& x3, const Vec3d& xnew3, unsigned int index3)
-{
-   
-   const int triangle_triangle_test = 3;
-   
-   double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-   double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-   double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-   double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-   double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-   double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-   double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-   double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-   
-   double bary[6];
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                    index0, p0,
-                                    index1, p1,
-                                    index1, p1,
-                                    index2, p2,
-                                    index3, p3,
-                                    index3 + nv, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1 + nv, pnew1,
-                                    index2, p2,
-                                    index3, p3,
-                                    index3 + nv, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                    index0, p0,
-                                    index1, p1,
-                                    index1 + nv, pnew1,
-                                    index2, p2,
-                                    index2 + nv, pnew2,
-                                    index3 + nv, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                    index0, p0,
-                                    index0 + nv, pnew0,
-                                    index1 + nv, pnew1,
-                                    index2, p2,
-                                    index2 + nv, pnew2,
-                                    index3 + nv, pnew3,
-                                    &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   return false;
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-
-
-
-bool tunicate_segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int index0,
-                                        const Vec3d& x1, const Vec3d& xnew1, unsigned int index1,
-                                        const Vec3d& x2, const Vec3d& xnew2, unsigned int index2,
-                                        const Vec3d& x3, const Vec3d& xnew3, unsigned int index3,
-                                        double& bary0, double& bary2,
-                                        Vec3d& normal,
-                                        double& t,
-                                        double& relative_normal_displacement,
-                                        bool verbose )
-{
-
-   const int triangle_triangle_test = 3;
-   
-   double p0[4] = { x0[0], x0[1], x0[2], 0.0 };
-   double pnew0[4] = { xnew0[0], xnew0[1], xnew0[2], 1.0 };
-   double p1[4] = { x1[0], x1[1], x1[2], 0.0 };
-   double pnew1[4] = { xnew1[0], xnew1[1], xnew1[2], 1.0 };
-   double p2[4] = { x2[0], x2[1], x2[2], 0.0 };
-   double pnew2[4] = { xnew2[0], xnew2[1], xnew2[2], 1.0 };
-   double p3[4] = { x3[0], x3[1], x3[2], 0.0 };
-   double pnew3[4] = { xnew3[0], xnew3[1], xnew3[2], 1.0 };
-   
-   bool collision=false;
-   double bary[6];
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                   index0, p0,
-                                   index1, p1,
-                                   index1 + nv, pnew1,
-                                   index2, p2,
-                                   index3, p3,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      collision=true;
-      bary0=0;
-      bary2=0;
-      t=bary[2];
-      normal=get_normal(x1-x0, x3-x2);
-      relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew3-x3));
-   }
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                   index0, p0,
-                                   index0 + nv, pnew0,
-                                   index1 + nv, pnew1,
-                                   index2, p2,
-                                   index3, p3,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[5]<t)
-      {
-         collision=true;
-         bary0=0.5;//(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-         bary2=0;
-         t=bary[5];
-         normal=get_normal(xnew1-xnew0, x3-x2);
-         relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew3-x3));
-      }
-   }
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                   index0, p0,
-                                   index1, p1,
-                                   index1 + nv, pnew1,
-                                   index2, p2,
-                                   index2 + nv, pnew2,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[2]<t){
-         collision=true;
-         bary0=0;
-         bary2=0.5;//(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-         t=bary[2];
-         normal=get_normal(x1-x0, xnew3-xnew2);
-         relative_normal_displacement=dot(normal, (xnew1-x1)-(xnew2-x2));
-      }
-   }
-   
-   if ( sos_simplex_intersection4d( triangle_triangle_test,
-                                   index0, p0,
-                                   index0 + nv, pnew0,
-                                   index1 + nv, pnew1,
-                                   index2, p2,
-                                   index2 + nv, pnew2,
-                                   index3 + nv, pnew3,
-                                   &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || 1-bary[0]<t){
-         collision=true;
-         bary0=0.5;//(bary[1]+1e-300)/(bary[1]+bary[2]+2e-300); // guard against zero/zero
-         bary2=0.5;//(bary[4]+1e-300)/(bary[4]+bary[5]+2e-300); // guard against zero/zero
-         t=1-bary[0];
-         normal=get_normal(xnew1-xnew0, xnew3-xnew2);
-         relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-      }
-   }
-
-   return collision;
-   
-}
-
-
-
-#endif
-
-
diff --git a/extern/eltopo/common/sparse/cgsolver.h b/extern/eltopo/common/sparse/cgsolver.h
deleted file mode 100644
index 12e23de..0000000
--- a/extern/eltopo/common/sparse/cgsolver.h
+++ /dev/null
@@ -1,178 +0,0 @@
-#ifndef CGSOLVER_H
-#define CGSOLVER_H
-
-#include <fstream>
-#include "sparse/sparsematrix.h"
-#include "sparse/sparseilu.h"
-#include "sparse/sparsemilu.h"
-#include "wallclocktime.h"
-#include "vector_math.h"
-
-#define MODIFIED
-//#define DEBUG_MATLAB_DUMP
-
-
-template <class T>
-class CGSolver {
-   
-   //Incomplete cholesky factor
-#ifdef MODIFIED
-   SparseColumnLowerFactor<T> ic_factor;
-#else
-   SparseLowerFactor<T> ic_factor;
-#endif
-   
-   //CG temporary vectors
-   std::vector<T> m, z, s, r;
-
-   // used within loop
-   FixedSparseMatrix<T> fixed_matrix;
-
-public:
-
-   //Parameters
-   T tolerance_factor;
-   int max_iterations;
-   T modified_incomplete_cholesky_parameter;
-   T min_diagonal_ratio;
-
-   CGSolver()
-   {
-      set_solver_parameters(1e-5f, 100, 0.97, 0.25);
-   }
-
-   void set_solver_parameters(T tolerance_factor_, int max_iterations_, T modified_incomplete_cholesky_parameter_ = 0.97, T min_diagonal_ratio_=0.25)
-   {
-      tolerance_factor=tolerance_factor_;
-      if(tolerance_factor<1e-30) tolerance_factor=1e-30;
-      max_iterations=max_iterations_;
-      modified_incomplete_cholesky_parameter=modified_incomplete_cholesky_parameter_;
-      min_diagonal_ratio = min_diagonal_ratio_;
-   }
-
-   bool solve(const SparseMatrix<T>& matrix, const std::vector<T> & rhs, std::vector<T> & result, T& residual_out, int& iterations_out) 
-   {
-#ifdef DEBUG_MATLAB_DUMP
-      static int suspicious_frame=0;
-#endif
-      
-      if(m.size() != matrix.n) {
-         m.resize(matrix.n);
-         s.resize(matrix.n);
-         z.resize(matrix.n);
-         r.resize(matrix.n);
-         zero(m);
-         zero(s);
-         zero(z);
-         zero(r);
-      }
-      copy(rhs,r);
-      double t0 = get_time_in_seconds();
-      form_preconditioner(matrix);
-      double t1 = get_time_in_seconds();
-      
-      double time = get_time_in_seconds();
-      fixed_matrix.construct_from_matrix(matrix);
-
-      zero(result);
-      residual_out = abs_max(r);
-      double tol=tolerance_factor*residual_out;
-      if(residual_out == 0) {
-         printf("CGSolver: Completed. Input was an exact solution.\n");
-         iterations_out = 0;
-         return true;
-      }
-
-      apply_preconditioner(r, z);
-
-      copy(z, s);
-      double rho=dot(z, r);
-      if(rho==0 || rho!=rho) {
-         printf("*** CGSolver: Crashed early! rho = %f ***\n", rho);
-         iterations_out = 0;
-#ifdef DEBUG_MATLAB_DUMP
-         char dumpname[100];
-         std::sprintf(dumpname, "linearsystem%d.m", suspicious_frame++); 
-         std::ofstream output(dumpname);
-         output.precision(18);
-         fixed_matrix.write_matlab(output, "A");
-         ic_factor.write_matlab(output, "L");
-         write_matlab(output, rhs, "b");
-         write_matlab(output, result, "x");
-#endif
-         return false;
-      }
-
-      int iteration;
-      for(iteration=0; iteration<max_iterations; ++iteration){
-         multiply(fixed_matrix, s, z);
-         double alpha=rho/dot(s, z);
-         add_scaled(alpha, s, result);
-         add_scaled(-alpha, z, r);
-         residual_out = abs_max(r);
-         if(residual_out <= tol) {
-            double time2 = get_time_in_seconds();
-            printf("CGSolver: Completed, %d iterations in %f seconds. Remaining residual: %e\n", iteration, time2-time, abs_max(r));     
-            printf("          Time to form preconditioner: %f seconds\n", t1-t0);
-            iterations_out = iteration + 1;
-#ifdef DEBUG_MATLAB_DUMP
-            if(iterations_out==1){
-               char dumpname[100];
-               std::sprintf(dumpname, "linearsystem%d.m", suspicious_frame++); 
-               std::ofstream output(dumpname);
-               output.precision(18);
-               fixed_matrix.write_matlab(output, "A");
-               ic_factor.write_matlab(output, "L");
-               write_matlab(output, rhs, "b");
-               write_matlab(output, result, "x");
-            }
-#endif
-            return true; 
-         }
-         
-         apply_preconditioner(r, z);
-
-         double rho_new=dot(z, r);
-         double beta=rho_new/rho;
-         add_scaled(beta, s, z); s.swap(z); // s=beta*s+z
-         rho=rho_new;
-      }
-      
-      iterations_out = iteration;
-      printf("*** CGSolver: No convergence after %d iterations! Remaining residual %e ***\n", iteration, abs_max(r));
-#ifdef DEBUG_MATLAB_DUMP
-      char dumpname[100];
-      std::sprintf(dumpname, "linearsystem%d.m", suspicious_frame++); 
-      std::ofstream output(dumpname);
-      output.precision(18);
-      fixed_matrix.write_matlab(output, "A");
-      ic_factor.write_matlab(output, "L");
-      write_matlab(output, rhs, "b");
-      write_matlab(output, result, "x");
-#endif
-      return false;
-   }
-
-protected:
-
-   void form_preconditioner(const SparseMatrix<T>& matrix) {
-      
-#ifdef MODIFIED
-      factor_modified_incomplete_cholesky0(matrix, ic_factor);
-#else
-      factor_incomplete_cholesky0(matrix, ic_factor, min_diagonal_ratio);
-#endif
-   }
-
-   void apply_preconditioner(const std::vector<T> &x, std::vector<T> &result) {
-      solve_lower(ic_factor, x, result);
-      solve_lower_transpose_in_place(ic_factor,result);
-   }
-
-};
-
-
-
-
-
-#endif
diff --git a/extern/eltopo/common/sparse/crsolver.h b/extern/eltopo/common/sparse/crsolver.h
deleted file mode 100644
index 565b641..0000000
--- a/extern/eltopo/common/sparse/crsolver.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef CRSOLVER_H
-#define CRSOLVER_H
-
-#include <fstream>
-#include "sparse/sparsematrix.h"
-#include "sparse/sparseilu.h"
-#include "sparse/sparsemilu.h"
-#include "wallclocktime.h"
-#include "vector_math.h"
-
-//Unpreconditioned Conjugate Residual (variant of MINRES)
-//Based off pseudocode in Y. Saad's "Iterative Methods for Sparse Linear Systems" 
-//First Edition, Algorithm 6.19
-
-//TODO: Perhaps modify it to more clearly parallel our CG Solver (for consistency)
-//TODO: Add support for preconditioning
-//TODO: Add debug info as in the CG Solver
-
-//This is ugly, there's probably a smarter/faster way to do this, possibly using swap as in the CGSolver
-template<class T> 
-void add_scaled2(T alpha, const std::vector<T>& x, std::vector<T>& y) { // y = alpha*y + x
-   for(unsigned int i = 0; i < x.size(); ++i)
-      y[i] = alpha*y[i] + x[i];
-
-}
-
-template <class T>
-class CRSolver {
-   
-   //CR temporary vectors
-   std::vector<T> p, Ap, r, Ar;
-
-   // used within loop
-   FixedSparseMatrix<T> fixed_matrix;
-
-public:
-
-   //Parameters
-   T tolerance_factor;
-   int max_iterations;
-  
-   CRSolver()
-   {
-      set_solver_parameters(1e-5f, 100);
-   }
-
-   void set_solver_parameters(T tolerance_factor_, int max_iterations_)
-   {
-      tolerance_factor=tolerance_factor_;
-      if(tolerance_factor<1e-30) tolerance_factor=1e-30;
-      max_iterations=max_iterations_;
-   }
-
-   bool solve(const SparseMatrix<T>& matrix, const std::vector<T> & rhs, std::vector<T> & result, T& residual_out, int& iterations_out) 
-   {
-      
-      if(r.size() != matrix.n) {
-         p.resize(matrix.n);
-         Ap.resize(matrix.n);
-         r.resize(matrix.n);
-         Ar.resize(matrix.n);
-         zero(r);
-         zero(Ar);
-         zero(p);
-         zero(Ap);
-      }
-
-      double time = get_time_in_seconds();
-      fixed_matrix.construct_from_matrix(matrix);
-      
-      zero(result);
-      copy(rhs,r); //r = b - A*result, where result is initialized to zero 
-      
-      residual_out = abs_max(r);
-      double tol=tolerance_factor*residual_out;
-      
-      if(residual_out == 0) {
-         printf("CRSolver: Completed. Input was an exact solution.\n");
-         iterations_out = 0;
-         return true;
-      }
-      
-      copy(r, p);
-    
-      int iteration;
-      double rho;
-      multiply(fixed_matrix, r, Ar);
-      multiply(fixed_matrix, p, Ap);
-      rho = dot(r,Ar);
-      
-      if(rho==0 || rho!=rho) {
-         printf("*** CGSolver: Crashed early! rho = %f ***\n", rho);
-         iterations_out = 0;
-      }
-
-      for(iteration=0; iteration<max_iterations; ++iteration){
-         double alpha = rho/dot(Ap,Ap);
-
-         add_scaled(alpha, p, result);
-         add_scaled(-alpha, Ap, r); 
-         
-         residual_out = abs_max(r);
-         if(residual_out <= tol) {
-            double time2 = get_time_in_seconds();
-            printf("CRSolver: Completed, %d iterations in %f seconds. Remaining residual: %e\n", iteration, time2-time, abs_max(r));     
-            iterations_out = iteration + 1;
-            return true; 
-         }
-
-         double rho_old = rho;
-         
-         multiply(fixed_matrix, r, Ar); 
-         rho = dot(r,Ar);
-         double beta = rho/rho_old; 
-
-         add_scaled2(beta,r,p); 
-         add_scaled2(beta,Ar,Ap); 
-         
-      }
-      
-      iterations_out = iteration;
-      printf("*** CRSolver: No convergence after %d iterations! Remaining residual %e ***\n", iteration, abs_max(r));
-
-      return false;
-   }
-
-
-};
-
-
-
-
-
-#endif
diff --git a/extern/eltopo/common/sparse/incomplete_qr.cpp b/extern/eltopo/common/sparse/incomplete_qr.cpp
deleted file mode 100644
index 9d759b5..0000000
--- a/extern/eltopo/common/sparse/incomplete_qr.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <cmath>
-#include <list>
-#include <vector>
-#include "incomplete_qr.h"
-
-/* The MATLAB code for this algorithm:
-for i=1:n
-   q=A(:,i);
-   for j=find(Rpattern(1:i-1,i))'
-      R(j,i)=Q(:,j)'*q;
-      q=q-Q(:,j)*R(j,i);
-   end
-   R(i,i)=norm(q);
-   q=q.*(abs(q)>Qdroptol*R(i,i));
-   Q(:,i)=q/(norm(q)+1e-300);
-end
-*/
-
-static inline double sqr(double x)
-{
-   return x*x;
-}
-
-struct SparseEntry
-{
-   int index;
-   double value;
-
-   SparseEntry(void) {}
-   SparseEntry(int index_, double value_) : index(index_), value(value_) {}
-   bool operator<(const SparseEntry &e) const { return index<e.index; }
-};
-
-typedef std::list<SparseEntry> DynamicSparseVector;
-typedef std::vector<SparseEntry> StaticSparseVector;
-
-static void copy_column(int colstart, int nextcolstart, const int *rowindex, const double *value,
-                        DynamicSparseVector &v)
-{
-   for(int i=colstart; i<nextcolstart; ++i)
-      v.push_back(SparseEntry(rowindex[i], value[i]));
-}
-
-static double dot_product(const StaticSparseVector &u, const DynamicSparseVector &v)
-{
-   StaticSparseVector::const_iterator p=u.begin();
-   if(p==u.end()) return 0;
-   DynamicSparseVector::const_iterator q=v.begin();
-   if(q==v.end()) return 0;
-   double result=0;
-   for(;;){
-      if(p->index < q->index){
-         ++p; if(p==u.end()) break;
-      }else if(p->index > q->index){
-         ++q; if(q==v.end()) break;
-      }else{ // p->index == q->index
-         result+=p->value*q->value;
-         ++p; if(p==u.end()) break;
-         ++q; if(q==v.end()) break;
-      }
-   }
-   return result;
-}
-
-static void add_to_vector(double multiplier, const StaticSparseVector &u, DynamicSparseVector &v)
-{
-   StaticSparseVector::const_iterator p=u.begin();
-   if(p==u.end()) return;
-   DynamicSparseVector::iterator q=v.begin();
-   for(;;){
-      if(q==v.end()) break;
-      if(p->index < q->index){
-         q=v.insert(q, SparseEntry(p->index, multiplier*p->value));
-         ++p; if(p==u.end()) return;
-      }else if(p->index > q->index){
-         ++q; if(q==v.end()) break;
-      }else{ // p->index == q->index){
-         q->value+=multiplier*p->value;
-         ++p; if(p==u.end()) return;
-         ++q; if(q==v.end()) break;
-      }
-   }
-   for(;;){
-      v.push_back(SparseEntry(p->index, multiplier*p->value));
-      ++p; if(p==u.end()) return;
-   }
-}
-
-static double vector_norm(const DynamicSparseVector &v)
-{
-   double norm_squared=0;
-   DynamicSparseVector::const_iterator p;
-   for(p=v.begin(); p!=v.end(); ++p) norm_squared+=sqr(p->value);
-   return std::sqrt(norm_squared);
-}
-
-static void copy_large_entries(const DynamicSparseVector &u, double threshhold, StaticSparseVector &v)
-{
-   DynamicSparseVector::const_iterator p;
-   for(p=u.begin(); p!=u.end(); ++p){
-      if(std::fabs(p->value)>threshhold) v.push_back(*p);
-   }
-}
-
-static void normalize(StaticSparseVector &v)
-{
-   double norm_squared=0;
-   StaticSparseVector::iterator p;
-   for(p=v.begin(); p!=v.end(); ++p) norm_squared+=sqr(p->value);
-   if(norm_squared>0){
-      double scale=1/std::sqrt(norm_squared);
-      for(p=v.begin(); p!=v.end(); ++p) p->value*=scale;
-   }
-}
-
-void incomplete_qr(int m, int n, const int *Acolstart, const int *Arowindex, const double *Avalue,
-                   double Qdroptol,
-                   const int *Rcolstart, const int *Rrowindex, double *Rvalue, double *Rdiag)
-{
-   // column storage for intermediate Q
-   std::vector<StaticSparseVector> Q(n);
-
-   // for each column of Q, how many more times it will be used in making R
-   // (once this gets decremented to zero, we can free the column)
-   std::vector<int> dependency_count(n,0);
-   for(int i=0; i<n; ++i){
-      for(int a=Rcolstart[i]; a<Rcolstart[i+1]; ++a){
-         int j=Rrowindex[a];
-         if(j<i) ++dependency_count[j];
-      }
-   }
-
-   // construct R a column at a time
-   for(int i=0; i<n; ++i){
-      DynamicSparseVector q;
-      copy_column(Acolstart[i], Acolstart[i+1], Arowindex, Avalue, q);
-      for(int a=Rcolstart[i]; a<Rcolstart[i+1]; ++a){
-         int j=Rrowindex[a];
-         if(j<i){
-            Rvalue[a]=dot_product(Q[j], q);
-            add_to_vector(-Rvalue[a], Q[j], q);
-            --dependency_count[j];
-            if(dependency_count[j]==0) Q[j].clear();
-         }else // j>i
-            Rvalue[a]=0; // ideally structure of R is upper triangular, so this waste of space won't happen
-      }
-      Rdiag[i]=vector_norm(q);
-      copy_large_entries(q, Qdroptol*Rdiag[i], Q[i]);
-      normalize(Q[i]);
-   }
-}
-
diff --git a/extern/eltopo/common/sparse/incomplete_qr.h b/extern/eltopo/common/sparse/incomplete_qr.h
deleted file mode 100644
index 1f6f824..0000000
--- a/extern/eltopo/common/sparse/incomplete_qr.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef INCOMPLETE_QR_H
-#define INCOMPLETE_QR_H
-
-// input: sparse matrix A (m by n, in CSC format),
-//        drop tolerance for keeping intermediate Q sparse,
-//        and sparsity structure of n by n upper triangular factor R
-// output: values in R so that R is roughly the R in the QR decomposition of A (i.e. Cholesky factor of A^T*A)
-//
-// Note that Rvalue should already be allocated when calling this function
-
-void incomplete_qr(int m, int n, const int *Acolstart, const int *Arowindex, const double *Avalue,
-                   double Qdroptol,
-                   const int *Rcolstart, const int *Rrowindex, double *Rvalue, double *Rdiag);
-
-#endif
diff --git a/extern/eltopo/common/sparse/sparseilu.h b/extern/eltopo/common/sparse/sparseilu.h
deleted file mode 100644
index f6e0b08..0000000
--- a/extern/eltopo/common/sparse/sparseilu.h
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef SPARSEILU_H
-#define SPARSEILU_H
-
-#include <cmath>
-#include "sparsematrix.h"
-#include "incomplete_qr.h"
-
-template<class T>
-struct SparseLowerFactor
-{
-   unsigned int n;
-   std::vector<T> invdiag; // reciprocals of diagonal elements
-   std::vector<T> value; // values below the diagonal, listed row by row
-   std::vector<unsigned int> colindex; // a list of all columns indices, for each row in turn
-   std::vector<unsigned int> rowstart; // where each row begins in colindex (plus an extra entry at the end, of #nonzeros)
-
-   explicit SparseLowerFactor(unsigned int n_=0)
-      : n(n_), invdiag(n_), rowstart(n_+1)
-   {}
-
-   void clear(void)
-   {
-      n=0;
-      invdiag.clear();
-      value.clear();
-      colindex.clear();
-      rowstart.clear();
-   }
-
-   void resize(unsigned int n_)
-   {
-      n=n_;
-      invdiag.resize(n);
-      rowstart.resize(n+1);
-   }
-
-   void write_matlab(std::ostream &output, const char *variable_name)
-   {
-      output<<variable_name<<"=sparse([";
-      for(unsigned int i=0; i<n; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<i+1<<" ";
-         }
-         output<<i+1<<" ";
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<n; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<colindex[j]+1<<" ";
-         }
-         output<<i+1<<" ";
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<n; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<value[j]<<" ";
-         }
-         output<<1/invdiag[i]<<" ";
-      }
-      output<<"], "<<n<<", "<<n<<");"<<std::endl;
-   }
-};
-
-typedef SparseLowerFactor<float> SparseLowerFactorf;
-typedef SparseLowerFactor<double> SparseLowerFactord;
-
-template<class T>
-void factor_incomplete_cholesky0(const SparseMatrix<T> &matrix, SparseLowerFactor<T> &factor,
-                                 T min_diagonal_ratio=0.25)
-{
-   // first copy lower triangle of matrix into factor
-   factor.resize(matrix.n);
-   factor.value.resize(0);
-   factor.colindex.resize(0);
-   for(unsigned int i=0; i<matrix.n; ++i){
-      factor.rowstart[i]=(unsigned int)factor.colindex.size();
-      for(unsigned int j=0; j<matrix.index[i].size(); ++j){
-         if(matrix.index[i][j]<i){
-            factor.colindex.push_back(matrix.index[i][j]);
-            factor.value.push_back(matrix.value[i][j]);
-         }else if(matrix.index[i][j]==i)
-            factor.invdiag[i]=matrix.value[i][j];
-         else
-            break;
-      }
-   }
-   int small_pivot_count = 0;
-   factor.rowstart[matrix.n]=(unsigned int)factor.colindex.size();
-   // now do the incomplete factorization (figure out numerical values)
-   for(unsigned int i=0; i<matrix.n; ++i){
-      T d=factor.invdiag[i]; // start of computing the diagonal entry L(i,i)
-      if(d==0) continue; // null row/column
-      // do the offdiagonal entries in row i
-      for(unsigned int k=factor.rowstart[i]; k<factor.rowstart[i+1]; ++k){
-         unsigned int j=factor.colindex[k];
-         // figure out off-diagonal entry L(i,j)=(A(i,j)-L(i,1:j-1)*L(j,1:j-1)')/L(j,j)
-         unsigned int a=factor.rowstart[i], b=factor.rowstart[j];
-         while(a<k && b<factor.rowstart[j+1]){
-            if(factor.colindex[a]==factor.colindex[b]){
-               factor.value[k]-=factor.value[a]*factor.value[b];
-               ++a;
-               ++b;
-            }else if(factor.colindex[a]<factor.colindex[b])
-               ++a;
-            else
-               ++b;
-         }
-         factor.value[k]*=factor.invdiag[j];
-         d-=sqr(factor.value[k]);
-      }
-      // safety check for dangerously small pivots
-      if(d<min_diagonal_ratio*factor.invdiag[i]){
-         d=factor.invdiag[i]; // drop to Gauss-Seidel in this case
-         ++small_pivot_count;
-      }
-      factor.invdiag[i]=1/std::sqrt(d);
-   }
-   if(small_pivot_count) {
-      printf("Warning: %d small pivots encountered while forming preconditioner.\n", small_pivot_count);
-   }
-}
-
-// this only works for T=double at the moment!
-template<class T>
-void factor_incomplete_qr(const FixedSparseMatrix<T> &J, const SparseMatrix<T> &JJtranspose,
-                          SparseLowerFactor<T> &factor, T Qdroptol=0.1)
-{
-   // first copy structure of lower triangle of matrix into factor
-   factor.resize(JJtranspose.m);
-   factor.colindex.resize(0);
-   for(unsigned int i=0; i<JJtranspose.m; ++i){
-      factor.rowstart[i]=(unsigned int)factor.colindex.size();
-      for(unsigned int j=0; j<JJtranspose.index[i].size(); ++j){
-         if(JJtranspose.index[i][j]<i) factor.colindex.push_back(JJtranspose.index[i][j]);
-      }
-   }
-   factor.rowstart[JJtranspose.m]=(unsigned int)factor.colindex.size();
-   factor.value.resize(factor.colindex.size());
-   // do the incomplete QR factorization (actually LQ, since we're using rows here but the routine is phrased in terms of columns)
-   incomplete_qr(J.n, J.m, &J.rowstart[0], &J.colindex[0], &J.value[0], Qdroptol, &factor.rowstart[0], &factor.colindex[0], &factor.value[0], &factor.invdiag[0]);
-   // correct for zero diagonal entries
-   int small_pivot_count=0;
-   for(unsigned int i=0; i<J.m; ++i){
-      if(factor.invdiag[i]>0) factor.invdiag[i]=1/factor.invdiag[i];
-      else ++small_pivot_count;
-   }
-   if(small_pivot_count){
-      printf("Warning: %d small pivots encountered while forming preconditioner.\n", small_pivot_count);
-   }
-}
-
-// solve L*result=rhs
-template<class T>
-void solve_lower(const SparseLowerFactor<T> &factor, const std::vector<T> &rhs, std::vector<T> &result)
-{
-   assert(factor.n==rhs.size());
-   assert(factor.n==result.size());
-   for(unsigned int i=0; i<factor.n; ++i){
-      T d=0;
-      for(unsigned int j=factor.rowstart[i]; j<factor.rowstart[i+1]; ++j){
-         d+=factor.value[j]*result[factor.colindex[j]];
-      }
-      result[i]=(rhs[i]-d)*factor.invdiag[i];
-   }
-}
-
-// solve L^T*result=rhs
-template<class T>
-void solve_lower_transpose_in_place(const SparseLowerFactor<T> &factor, std::vector<T> &x)
-{
-   assert(factor.n==x.size());
-   unsigned int i=factor.n;
-   do{
-      --i;
-      x[i]*=factor.invdiag[i];
-      for(unsigned int j=factor.rowstart[i]; j<factor.rowstart[i+1]; ++j){
-         x[factor.colindex[j]]-=factor.value[j]*x[i]; 
-      }
-   }while(i!=0);
-}
-
-#endif
diff --git a/extern/eltopo/common/sparse/sparsematrix.h b/extern/eltopo/common/sparse/sparsematrix.h
deleted file mode 100644
index 79d20c6..0000000
--- a/extern/eltopo/common/sparse/sparsematrix.h
+++ /dev/null
@@ -1,407 +0,0 @@
-#ifndef SPARSEMATRIX_H
-#define SPARSEMATRIX_H
-
-// using a variant on CSR format
-
-#include <iostream>
-#include <vector>
-#include "util.h"
-#include <assert.h>
-
-template<class T>
-struct SparseMatrix
-{
-   unsigned int m, n; // dimensions
-   std::vector<std::vector<unsigned int> > index; // for each row, a list of all column indices (sorted)
-   std::vector<std::vector<T> > value; // values corresponding to index
-
-   explicit SparseMatrix(unsigned int m_=0)
-      : m(m_), n(m_), index(m_), value(m_)
-   {
-      const unsigned int expected_nonzeros_per_row=7;
-      for(unsigned int i=0; i<m; ++i){
-         index[i].reserve(expected_nonzeros_per_row);
-         value[i].reserve(expected_nonzeros_per_row);
-      }
-   }
-
-   explicit SparseMatrix(unsigned int m_, unsigned int n_, unsigned int expected_nonzeros_per_row)
-      : m(m_), n(n_), index(m_), value(m_)
-   {
-      for(unsigned int i=0; i<m; ++i){
-         index[i].reserve(expected_nonzeros_per_row);
-         value[i].reserve(expected_nonzeros_per_row);
-      }
-   }
-
-   void clear(void)
-   {
-      m=n=0;
-      index.clear();
-      value.clear();
-   }
-
-   void zero(void)
-   {
-      for(unsigned int i=0; i<m; ++i){
-         index[i].resize(0);
-         value[i].resize(0);
-      }
-   }
-
-   void resize(unsigned int m_, unsigned int n_)
-   {
-      m=m_;
-      n=n_;
-      index.resize(m);
-      value.resize(m);
-   }
-
-   T operator()(unsigned int i, unsigned int j) const
-   {
-      assert(i<m && j<n);
-      for(unsigned int k=0; k<index[i].size(); ++k){
-         if(index[i][k]==j) return value[i][k];
-         else if(index[i][k]>j) return 0;
-      }
-      return 0;
-   }
-
-   void set_element(unsigned int i, unsigned int j, T new_value)
-   {
-      assert(i<m && j<n);
-      unsigned int k=0;
-      for(; k<index[i].size(); ++k){
-         if(index[i][k]==j){
-            value[i][k]=new_value;
-            return;
-         }else if(index[i][k]>j){
-            insert(index[i], k, j);
-            insert(value[i], k, new_value);
-            return;
-         }
-      }
-      index[i].push_back(j);
-      value[i].push_back(new_value);
-   }
-
-   void add_to_element(unsigned int i, unsigned int j, T increment_value)
-   {
-      assert(i<m && j<n);
-      unsigned int k=0;
-      for(; k<index[i].size(); ++k){
-         if(index[i][k]==j){
-            value[i][k]+=increment_value;
-            return;
-         }else if(index[i][k]>j){
-            insert(index[i], k, j);
-            insert(value[i], k, increment_value);
-            return;
-         }
-      }
-      index[i].push_back(j);
-      value[i].push_back(increment_value);
-   }
-
-   // assumes indices is already sorted
-   void add_sparse_row(unsigned int i, const std::vector<unsigned int> &indices, const std::vector<T> &values)
-   {
-      assert(i<m);
-      unsigned int j=0, k=0;
-      while(j<indices.size() && k<index[i].size()){
-         if(index[i][k]<indices[j]){
-            ++k;
-         }else if(index[i][k]>indices[j]){
-            insert(index[i], k, indices[j]);
-            insert(value[i], k, values[j]);
-            ++j;
-         }else{
-            value[i][k]+=values[j];
-            ++j;
-            ++k;
-         }
-      }
-      for(; j<indices.size(); ++j){
-         index[i].push_back(indices[j]);
-         value[i].push_back(values[j]);
-      }
-   }
-
-   // assumes indices is already sorted
-   void add_sparse_row(unsigned int i, const std::vector<unsigned int> &indices, T multiplier, const std::vector<T> &values)
-   {
-      assert(i<m);
-      unsigned int j=0, k=0;
-      while(j<indices.size() && k<index[i].size()){
-         if(index[i][k]<indices[j]){
-            ++k;
-         }else if(index[i][k]>indices[j]){
-            insert(index[i], k, indices[j]);
-            insert(value[i], k, multiplier*values[j]);
-            ++j;
-         }else{
-            value[i][k]+=multiplier*values[j];
-            ++j;
-            ++k;
-         }
-      }
-      for(;j<indices.size(); ++j){
-         index[i].push_back(indices[j]);
-         value[i].push_back(multiplier*values[j]);
-      }
-   }
-
-   // assumes matrix has symmetric structure - so the indices in row i tell us which columns to delete i from
-   void symmetric_remove_row_and_column(unsigned int i)
-   {
-      assert(m==n && i<m);
-      for(unsigned int a=0; a<index[i].size(); ++a){
-         unsigned int j=index[i][a]; // 
-         for(unsigned int b=0; b<index[j].size(); ++b){
-            if(index[j][b]==i){
-               erase(index[j], b);
-               erase(value[j], b);
-               break;
-            }
-         }
-      }
-      index[i].resize(0);
-      value[i].resize(0);
-   }
-
-   void write_matlab(std::ostream &output, const char *variable_name)
-   {
-      output<<variable_name<<"=sparse([";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=0; j<index[i].size(); ++j){
-            output<<i+1<<" ";
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=0; j<index[i].size(); ++j){
-            output<<index[i][j]+1<<" ";
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=0; j<value[i].size(); ++j){
-            output<<value[i][j]<<" ";
-         }
-      }
-      output<<"], "<<m<<", "<<n<<");"<<std::endl;
-   }
-};
-
-typedef SparseMatrix<float> SparseMatrixf;
-typedef SparseMatrix<double> SparseMatrixd;
-
-// perform result=matrix*x
-template<class T>
-void multiply(const SparseMatrix<T> &matrix, const std::vector<T> &x, std::vector<T> &result)
-{
-   assert(matrix.n==x.size());
-   result.resize(matrix.m);
-   for(unsigned int i=0; i<matrix.m; ++i){
-      result[i]=0;
-      for(unsigned int j=0; j<matrix.index[i].size(); ++j){
-         result[i]+=matrix.value[i][j]*x[matrix.index[i][j]];
-      }
-   }
-}
-
-// perform result=result-matrix*x
-template<class T>
-void multiply_and_subtract(const SparseMatrix<T> &matrix, const std::vector<T> &x, std::vector<T> &result)
-{
-   assert(matrix.n==x.size());
-   result.resize(matrix.m);
-   for(unsigned int i=0; i<matrix.m; ++i){
-      for(unsigned int j=0; j<matrix.index[i].size(); ++j){
-         result[i]-=matrix.value[i][j]*x[matrix.index[i][j]];
-      }
-   }
-}
-
-// compute C=A*B (B might equal A)
-template<class T>
-void multiply_sparse_matrices(const SparseMatrix<T> &A, const SparseMatrix<T> &B, SparseMatrix<T> &C)
-{
-   assert(A.n==B.m);
-   C.resize(A.m, B.n);
-   C.zero();
-   for(unsigned int i=0; i<A.m; ++i){
-      for(unsigned int p=0; p<A.index[i].size(); ++p){
-         unsigned int k=A.index[i][p];
-         C.add_sparse_row(i, B.index[k], A.value[i][p], B.value[k]);
-      }
-   }
-}
-
-// compute C=A^T*B (B might equal A)
-template<class T>
-void multiply_AtB(const SparseMatrix<T> &A, const SparseMatrix<T> &B, SparseMatrix<T> &C)
-{
-   assert(A.m==B.m);
-   C.resize(A.n, B.n);
-   C.zero();
-   for(unsigned int k=0; k<A.m; ++k){
-      for(unsigned int p=0; p<A.index[k].size(); ++p){
-         unsigned int i=A.index[k][p];
-         C.add_sparse_row(i, B.index[k], A.value[k][p], B.value[k]);
-      }
-   }
-}
-
-// compute C=A*D*B (B might equal A)
-template<class T>
-void multiply_sparse_matrices_with_diagonal_weighting(const SparseMatrix<T> &A, const std::vector<T> &diagD,
-                                                      const SparseMatrix<T> &B, SparseMatrix<T> &C)
-{
-   assert(A.n==B.m);
-   assert(diagD.size()==A.n);
-   C.resize(A.m, B.n);
-   C.zero();
-   for(unsigned int i=0; i<A.m; ++i){
-      for(unsigned int p=0; p<A.index[i].size(); ++p){
-         unsigned int k=A.index[i][p];
-         C.add_sparse_row(i, B.index[k], A.value[i][p]*diagD[k], B.value[k]);
-      }
-   }
-}
-
-// compute C=A^T*D*B (B might equal A)
-template<class T>
-void multiply_AtDB(const SparseMatrix<T> &A, const std::vector<T>& diagD, const SparseMatrix<T> &B, SparseMatrix<T> &C)
-{
-   assert(A.m==B.m);
-   C.resize(A.n, B.n);
-   C.zero();
-   for(unsigned int k=0; k<A.m; ++k){
-      for(unsigned int p=0; p<A.index[k].size(); ++p){
-         unsigned int i=A.index[k][p];
-         C.add_sparse_row(i, B.index[k], A.value[k][p]*diagD[k], B.value[k]);
-      }
-   }
-}
-
-// set T to the transpose of A
-template<class T>
-void compute_transpose(const SparseMatrix<T> &A, SparseMatrix<T> &C)
-{
-   C.resize(A.n, A.m);
-   C.zero();
-   for(unsigned int i=0; i<A.m; ++i){
-      for(unsigned int p=0; p<A.index[i].size(); ++p){
-         unsigned int k=A.index[i][p];
-         C.index[k].push_back(i);
-         C.value[k].push_back(A.value[i][p]);
-      }
-   }
-}
-
-template<class T>
-struct FixedSparseMatrix
-{
-   unsigned int m, n; // dimension
-   std::vector<T> value; // nonzero values row by row
-   std::vector<unsigned int> colindex; // corresponding column indices
-   std::vector<unsigned int> rowstart; // where each row starts in value and colindex (and last entry is one past the end, the number of nonzeros)
-
-   explicit FixedSparseMatrix(unsigned int m_=0)
-      : m(m_), n(m_), value(0), colindex(0), rowstart(m_+1)
-   {}
-
-   explicit FixedSparseMatrix(unsigned int m_, unsigned int n_)
-      : m(m_), n(n_), value(0), colindex(0), rowstart(m_+1)
-   {}
-
-   void clear(void)
-   {
-      m=n=0;
-      value.clear();
-      colindex.clear();
-      rowstart.clear();
-   }
-
-   void resize(unsigned int m_, unsigned int n_)
-   {
-      m=m_;
-      n=n_;
-      rowstart.resize(m+1);
-   }
-
-   void construct_from_matrix(const SparseMatrix<T> &matrix)
-   {
-      resize(matrix.m, matrix.n);
-      rowstart[0]=0;
-      for(unsigned int i=0; i<m; ++i){
-         rowstart[i+1]=rowstart[i]+matrix.index[i].size();
-      }
-      value.resize(rowstart[m]);
-      colindex.resize(rowstart[m]);
-      unsigned int j=0;
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int k=0; k<matrix.index[i].size(); ++k){
-            value[j]=matrix.value[i][k];
-            colindex[j]=matrix.index[i][k];
-            ++j;
-         }
-      }
-   }
-
-   void write_matlab(std::ostream &output, const char *variable_name)
-   {
-      output<<variable_name<<"=sparse([";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<i+1<<" ";
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<colindex[j]+1<<" ";
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<m; ++i){
-         for(unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j){
-            output<<value[j]<<" ";
-         }
-      }
-      output<<"], "<<m<<", "<<n<<");"<<std::endl;
-   }
-};
-
-typedef FixedSparseMatrix<float> FixedSparseMatrixf;
-typedef FixedSparseMatrix<double> FixedSparseMatrixd;
-
-// perform result=matrix*x
-template<class T>
-void multiply(const FixedSparseMatrix<T> &matrix, const std::vector<T> &x, std::vector<T> &result)
-{
-   assert(matrix.n==x.size());
-   result.resize(matrix.m);
-   for(unsigned int i=0; i<matrix.m; ++i){
-      result[i]=0;
-      for(unsigned int j=matrix.rowstart[i]; j<matrix.rowstart[i+1]; ++j){
-         result[i]+=matrix.value[j]*x[matrix.colindex[j]];
-      }
-   }
-}
-
-// perform result=result-matrix*x
-template<class T>
-void multiply_and_subtract(const FixedSparseMatrix<T> &matrix, const std::vector<T> &x, std::vector<T> &result)
-{
-   assert(matrix.n==x.size());
-   result.resize(matrix.m);
-   for(unsigned int i=0; i<matrix.m; ++i){
-      for(unsigned int j=matrix.rowstart[i]; j<matrix.rowstart[i+1]; ++j){
-         result[i]-=matrix.value[j]*x[matrix.colindex[j]];
-      }
-   }
-}
-
-#endif
diff --git a/extern/eltopo/common/sparse/sparsemilu.h b/extern/eltopo/common/sparse/sparsemilu.h
deleted file mode 100644
index d7cfef0..0000000
--- a/extern/eltopo/common/sparse/sparsemilu.h
+++ /dev/null
@@ -1,208 +0,0 @@
-#ifndef SPARSEMILU_H
-#define SPARSEMILU_H
-
-#include <cmath>
-#include "blas_wrapper.h"
-#include "sparsematrix.h"
-
-template<class T>
-struct SparseColumnLowerFactor{
-   unsigned int n;
-   std::vector<T> invdiag; // reciprocals of diagonal elements
-   std::vector<T> value; // values below the diagonal, listed column by column
-   std::vector<unsigned int> rowindex; // a list of all row indices, for each column in turn
-   std::vector<unsigned int> colstart; // where each column begins in rowindex (plus an extra entry at the end, of #nonzeros)
-   std::vector<T> adiag; // just used in factorization: minimum "safe" diagonal entry allowed
-
-   explicit SparseColumnLowerFactor(unsigned int n_=0)
-      : n(n_), invdiag(n_), colstart(n_+1), adiag(n_)
-   {}
-
-   void clear(void)
-   {
-      n=0;
-      invdiag.clear();
-      value.clear();
-      rowindex.clear();
-      colstart.clear();
-      adiag.clear();
-   }
-
-   void resize(unsigned int n_)
-   {
-      n=n_;
-      invdiag.resize(n);
-      colstart.resize(n+1);
-      adiag.resize(n);
-   }
-
-   void write_matlab(std::ostream &output, const char *variable_name)
-   {
-      output<<variable_name<<"=sparse([";
-      for(unsigned int i=0; i<n; ++i){
-         output<<" "<<i+1;
-         for(unsigned int j=colstart[i]; j<colstart[i+1]; ++j){
-            output<<" "<<rowindex[j]+1;
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<n; ++i){
-         output<<" "<<i+1;
-         for(unsigned int j=colstart[i]; j<colstart[i+1]; ++j){
-            output<<" "<<i+1;
-         }
-      }
-      output<<"],...\n  [";
-      for(unsigned int i=0; i<n; ++i){
-         output<<" "<<(invdiag[i]!=0 ? 1/invdiag[i] : 0);
-         for(unsigned int j=colstart[i]; j<colstart[i+1]; ++j){
-            output<<" "<<value[j];
-         }
-      }
-      output<<"], "<<n<<", "<<n<<");"<<std::endl;
-   }
-};
-
-typedef SparseColumnLowerFactor<float> SparseColumnLowerFactorf;
-typedef SparseColumnLowerFactor<double> SparseColumnLowerFactord;
-
-template<class T>
-void factor_modified_incomplete_cholesky0(const SparseMatrix<T> &matrix, SparseColumnLowerFactor<T> &factor,
-                                          T modification_parameter=0.97, T min_diagonal_ratio=0.25)
-{
-   // first copy lower triangle of matrix into factor (Note: assuming A is symmetric of course!)
-   factor.resize(matrix.n);
-   zero(factor.invdiag); // important: eliminate old values from previous solves!
-   factor.value.resize(0);
-   factor.rowindex.resize(0);
-   zero(factor.adiag);
-   for(unsigned int i=0; i<matrix.n; ++i){
-      factor.colstart[i]=(unsigned int)factor.rowindex.size();
-      for(unsigned int j=0; j<matrix.index[i].size(); ++j){
-         if(matrix.index[i][j]>i){
-            factor.rowindex.push_back(matrix.index[i][j]);
-            factor.value.push_back(matrix.value[i][j]);
-         }else if(matrix.index[i][j]==i){
-            factor.invdiag[i]=factor.adiag[i]=matrix.value[i][j];
-         }
-      }
-   }
-   factor.colstart[matrix.n]=(unsigned int)factor.rowindex.size();
-   // now do the incomplete factorization (figure out numerical values)
-
-   // MATLAB code:
-   // L=tril(A);
-   // for k=1:size(L,2)
-   //   L(k,k)=sqrt(L(k,k));
-   //   L(k+1:end,k)=L(k+1:end,k)/L(k,k);
-   //   for j=find(L(:,k))'
-   //     if j>k
-   //       fullupdate=L(:,k)*L(j,k);
-   //       incompleteupdate=fullupdate.*(A(:,j)~=0);
-   //       missing=sum(fullupdate-incompleteupdate);
-   //       L(j:end,j)=L(j:end,j)-incompleteupdate(j:end);
-   //       L(j,j)=L(j,j)-omega*missing;
-   //     end
-   //   end
-   // end
-   int small_pivot_count = 0;
-   for(unsigned int k=0; k<matrix.n; ++k){
-      if(factor.adiag[k]==0) continue; // null row/column
-      // figure out the final L(k,k) entry
-      if(factor.invdiag[k]<min_diagonal_ratio*factor.adiag[k]) {
-         factor.invdiag[k]=1/sqrt(factor.adiag[k]); // drop to Gauss-Seidel here if the pivot looks dangerously small
-         ++small_pivot_count;
-      }
-      else
-         factor.invdiag[k]=1/sqrt(factor.invdiag[k]);
-      // finalize the k'th column L(:,k)
-      for(unsigned int p=factor.colstart[k]; p<factor.colstart[k+1]; ++p){
-         factor.value[p]*=factor.invdiag[k];
-      }
-      // incompletely eliminate L(:,k) from future columns, modifying diagonals
-      for(unsigned int p=factor.colstart[k]; p<factor.colstart[k+1]; ++p){
-         unsigned int j=factor.rowindex[p]; // work on column j
-         T multiplier=factor.value[p];
-         T missing=0;
-         unsigned int a=factor.colstart[k];
-         // first look for contributions to missing from dropped entries above the diagonal in column j
-         unsigned int b=0;
-         while(a<factor.colstart[k+1] && factor.rowindex[a]<j){
-            // look for factor.rowindex[a] in matrix.index[j] starting at b
-            while(b<matrix.index[j].size()){
-               if(matrix.index[j][b]<factor.rowindex[a])
-                  ++b;
-               else if(matrix.index[j][b]==factor.rowindex[a])
-                  break;
-               else{
-                  missing+=factor.value[a];
-                  break;
-               }
-            }
-            ++a;
-         }
-         // adjust the diagonal j,j entry
-         if(a<factor.colstart[k+1] && factor.rowindex[a]==j){
-            factor.invdiag[j]-=multiplier*factor.value[a];
-         }
-         ++a;
-         // and now eliminate from the nonzero entries below the diagonal in column j (or add to missing if we can't)
-         b=factor.colstart[j];
-         while(a<factor.colstart[k+1] && b<factor.colstart[j+1]){
-            if(factor.rowindex[b]<factor.rowindex[a])
-               ++b;
-            else if(factor.rowindex[b]==factor.rowindex[a]){
-               factor.value[b]-=multiplier*factor.value[a];
-               ++a;
-               ++b;
-            }else{
-               missing+=factor.value[a];
-               ++a;
-            }
-         }
-         // and if there's anything left to do, add it to missing
-         while(a<factor.colstart[k+1]){
-            missing+=factor.value[a];
-            ++a;
-         }
-         // and do the final diagonal adjustment from the missing entries
-         factor.invdiag[j]-=modification_parameter*multiplier*missing;
-      }
-   }
-   if(small_pivot_count > 0) {
-      printf("Warning: %d small pivots encountered while forming preconditioner.\n", small_pivot_count);
-   }
-}
-
-// solve L*result=rhs
-template<class T>
-void solve_lower(const SparseColumnLowerFactor<T> &factor, const std::vector<T> &rhs, std::vector<T> &result)
-{
-   assert(factor.n==rhs.size());
-   assert(factor.n==result.size());
-   BLAS::copy(factor.n, &rhs[0], &result[0]);
-   for(unsigned int i=0; i<factor.n; ++i){
-      result[i]*=factor.invdiag[i];
-      for(unsigned int j=factor.colstart[i]; j<factor.colstart[i+1]; ++j){
-         result[factor.rowindex[j]]-=factor.value[j]*result[i];
-      }
-   }
-}
-
-// solve L^T*result=rhs
-template<class T>
-void solve_lower_transpose_in_place(const SparseColumnLowerFactor<T> &factor, std::vector<T> &x)
-{
-   assert(factor.n==x.size());
-   assert(factor.n>0);
-   unsigned int i=factor.n;
-   do{
-      --i;
-      for(unsigned int j=factor.colstart[i]; j<factor.colstart[i+1]; ++j){
-         x[i]-=factor.value[j]*x[factor.rowindex[j]];
-      }
-      x[i]*=factor.invdiag[i];
-   }while(i!=0);
-}
-
-#endif
diff --git a/extern/eltopo/common/tunicate/expansion.cpp b/extern/eltopo/common/tunicate/expansion.cpp
deleted file mode 100644
index 2451d67..0000000
--- a/extern/eltopo/common/tunicate/expansion.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-// Released into the public-domain by Robert Bridson, 2009.
-
-#include <expansion.h>
-
-#include <bitset>
-#include <cassert>
-#include <cmath>
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include <float.h>
-#else
-#include <fenv.h>
-#endif
-#include <iostream>
-#include <string.h>
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include "BaseTsd.h"
-typedef SSIZE_T ssize_t;
-#endif
-
-
-namespace {
-    
-    //==============================================================================
-    void
-    two_sum(double a,
-            double b,
-            double& x,
-            double& y)
-    {
-        x=a+b;
-        double z=x-a;
-        y=(a-(x-z))+(b-z);
-    }
-    
-    //==============================================================================
-    // requires that |a|>=|b|
-    void
-    fast_two_sum(double a,
-                 double b,
-                 double& x,
-                 double& y)
-    {
-        assert( a == a && b == b );
-        assert(std::fabs(a)>=std::fabs(b));
-        x=a+b;
-        y=(a-x)+b;
-    }
-    
-    //==============================================================================
-    void
-    split(double a,
-          double& x,
-          double& y)
-    {
-        double c=134217729*a;
-        x=c-(c-a);
-        y=a-x;
-    }
-    
-    //==============================================================================
-    void
-    two_product(double a,
-                double b,
-                double& x,
-                double& y)
-    {
-        x=a*b;
-        double a1, a2, b1, b2;
-        split(a, a1, a2);
-        split(b, b1, b2);
-        y=a2*b2-(((x-a1*b1)-a2*b1)-a1*b2);
-    }
-    
-}  // namespace
-
-
-//==============================================================================
-bool
-is_zero( const expansion& a )
-{
-    return ( a.v.size() == 0 );
-}
-
-
-//==============================================================================
-int 
-sign( const expansion& a )
-{
-    if ( a.v.size() == 0 ) { return 0; }
-    
-    // REVIEW: I'm assuming we can get the sign of the expansion by the sign of its leading term (i.e. the sum of all other terms < leading term )
-    // This true if the expansion if increasing and nonoverlapping
-    if ( a.v.back() > 0 )
-    {
-        return 1;
-    }
-    return -1;
-}
-
-
-//==============================================================================
-void
-add(double a, double b, expansion& sum)
-{
-    sum.resize(2);
-    two_sum(a, b, sum.v[1], sum.v[0]);
-}
-
-//==============================================================================
-// a and sum may be aliased to the same expansion for in-place addition
-void
-add(const expansion& a, double b, expansion& sum)
-{
-    size_t m=a.v.size();
-    sum.v.reserve(m+1);
-    double s;
-    for(size_t i=0; i<m; ++i){
-        two_sum(b, a.v[i], b, s);
-        if(s) sum.v.push_back(s);
-    }
-    sum.v.push_back(b);
-}
-
-//==============================================================================
-// aliasing a, b and sum is safe
-void
-add(const expansion& a, const expansion& b, expansion& sum)
-{
-    
-    if(a.v.empty())
-    {
-        sum=b;
-        return;
-    }else if(b.v.empty())
-    {
-        sum=a;
-        return;
-    }
-    
-    // Shewchuk's fast-expansion-sum
-    expansion merge(a.v.size()+b.v.size(), 0);
-    unsigned int i=0, j=0, k=0;
-    for(;;){
-        if(std::fabs(a.v[i])<std::fabs(b.v[j])){
-            merge.v[k++]=a.v[i++];
-            if(i==a.v.size()){
-                while(j<b.v.size()) merge.v[k++]=b.v[j++];
-                break;
-            }
-        }else{
-            merge.v[k++]=b.v[j++];
-            if(j==b.v.size()){
-                while(i<a.v.size()) merge.v[k++]=a.v[i++];
-                break;
-            }
-        }
-    }
-    sum.v.reserve(merge.v.size());
-    sum.v.resize(0);
-    double q, r;
-    fast_two_sum(merge.v[1], merge.v[0], q, r);
-    if(r) sum.v.push_back(r);
-    for(i=2; i<merge.v.size(); ++i){
-        two_sum(q, merge.v[i], q, r);    
-        if(r) sum.v.push_back(r);
-    }
-    if(q) sum.v.push_back(q);
-    
-}
-
-//==============================================================================
-void
-subtract( const double& a, const double& b, expansion& difference)
-{
-    add( a, -b, difference );
-}
-
-//==============================================================================
-void
-subtract(const expansion& a, const expansion& b, expansion& difference)
-{
-    // could improve this a bit!
-    expansion c;
-    negative(b, c);
-    add(a, c, difference);
-}
-
-//==============================================================================
-void
-negative(const expansion& input, expansion& output)
-{
-    output.resize(input.v.size());
-    for(unsigned int i=0; i<input.v.size(); ++i)
-        output.v[i]=-input.v[i];
-}
-
-//==============================================================================
-void
-multiply(double a, double b, expansion& product)
-{
-    product.resize(2);
-    two_product(a, b, product.v[1], product.v[0]);
-}
-
-//==============================================================================
-void
-multiply(double a, double b, double c, expansion& product)
-{
-    expansion ab;
-    multiply(a, b, ab);
-    multiply(ab, c, product);
-}
-
-//==============================================================================
-void
-multiply(double a, double b, double c, double d, expansion& product)
-{
-    multiply(a, b, product);
-    expansion abc;
-    multiply(product, c, abc);
-    multiply(abc, d, product);
-}
-
-//==============================================================================
-void
-multiply(const expansion& a, double b, expansion& product)
-{
-    
-    // basic idea:
-    // multiply each entry in a by b (producing two new entries), then
-    // two_sum them in such a way to guarantee increasing/non-overlapping output
-    product.resize(2*a.v.size());
-    if(a.v.empty()) return;
-    two_product(a.v[0], b, product.v[1], product.v[0]); // finalize product[0]
-    double x, y, z;
-    for(unsigned int i=1; i<a.v.size(); ++i){
-        two_product(a.v[i], b, x, y);
-        // finalize product[2*i-1]
-        two_sum(product.v[2*i-1], y, z, product.v[2*i-1]);
-        // finalize product[2*i], could be fast_two_sum instead
-        fast_two_sum(x, z, product.v[2*i+1], product.v[2*i]);
-    }
-    // multiplication is a prime candidate for producing spurious zeros, so
-    // remove them by default
-    remove_zeros(product);
-    
-} 
-
-//==============================================================================
-void
-multiply(const expansion& a, const expansion& b, expansion& product)
-{
-    // most stupid way of doing it:
-    // multiply a by each entry in b, add each to product
-    product.resize(0);
-    expansion term;
-    for(unsigned int i=0; i<b.v.size(); ++i){
-        multiply(a, b.v[i], term);
-        add(product, term, product);
-    }
-}
-
-
-//==============================================================================
-
-
-void compress( const expansion& e, expansion& h )
-{
-    if ( is_zero( e ) )
-    {
-        make_zero( h );
-        return;
-    }
-    
-    expansion g( e.v.size(), 0 );
-    
-    size_t bottom = e.v.size() - 1;
-    double q = e.v[bottom];
-    
-    for ( ssize_t i = e.v.size() - 2; i >= 0; --i )
-    {
-        double new_q, small_q;
-        fast_two_sum( q, e.v[i], new_q, small_q );
-        if ( small_q != 0 )
-        {
-            g.v[bottom--] = new_q;
-            q = small_q;
-        }
-        else
-        {
-            q = new_q;
-        }
-    }
-    g.v[bottom] = q;
-    
-    h.v.resize( e.v.size(), 0 );
-    
-    unsigned int top = 0;
-    
-    for ( size_t i = bottom+1; i < e.v.size(); ++i )
-    {
-        double new_q, small_q;
-        fast_two_sum( g.v[i], q, new_q, small_q );
-        if ( small_q != 0 )
-        {
-            h.v[top++] = small_q;
-        }
-        q = new_q;
-    }
-    h.v[top] = q;
-    h.resize( top+1 );
-    
-}
-
-
-//==============================================================================
-
-bool divide( const expansion& x, const expansion& y, expansion& q )
-{
-    
-    assert( !is_zero( y ) );
-    
-    if ( is_zero( x ) ) 
-    {
-        // 0 / y = 0
-        make_expansion( 0, q );
-        return true;
-    }
-    
-    const double divisor = estimate(y);
-    
-    // q is the quotient, built by repeatedly dividing the remainder
-    // Initially, q = estimate(x) / estimate(y)
-    
-    make_expansion( estimate(x) / divisor, q );
-    
-    expansion qy;
-    multiply( q, y, qy );
-    expansion r;
-    subtract( x, qy, r );  
-    
-    while ( !is_zero(r) )
-    {
-        // s is the next term in the quotient q:
-        // s = estimate(r) / estimate(y)
-        expansion s;
-        make_expansion( estimate(r) / divisor, s );
-        
-        if ( is_zero(s) )
-        {
-            assert ( !is_zero(y) );
-            std::cout << "underflow, s == 0" << std::endl;
-            std::cout << "r: "; print_full( r );
-            std::cout << "divisor: " << divisor << std::endl;
-            return false;         
-        }
-        
-        // q += s
-        add( q, s, q );
-        
-        // r -= s*y
-        expansion sy;
-        multiply( s, y, sy );
-        
-        // underflow, quotient not representable by an expansion
-        if ( is_zero(sy) )
-        {
-            assert ( !is_zero(s) && !is_zero(y) );
-            std::cout << "underflow, sy == 0" << std::endl;
-            return false;
-        }
-        
-        subtract( r, sy, r );     
-        
-        expansion compressed_r;
-        compress( r, compressed_r );
-        r = compressed_r;
-        
-    }
-    
-    remove_zeros( q );
-    return true;
-    
-}
-
-//==============================================================================
-void
-remove_zeros(expansion& a)
-{
-    
-    unsigned int i, j;
-    
-    for ( i = 0, j = 0; i < a.v.size(); ++i )
-    {
-        if ( a.v[i] )
-        {
-            a.v[j++] = a.v[i];
-        }
-    }
-    
-    a.resize(j);
-    
-}
-
-//==============================================================================
-double
-estimate(const expansion& a)
-{
-    double x=0;
-    for(unsigned int i=0; i<a.v.size(); ++i)
-        x+=a.v[i];
-    return x;
-}
-
-//==============================================================================
-
-bool equals( const expansion& a, const expansion& b )
-{
-    bool same = (a.v.size() == b.v.size());
-    
-    if (!same) { return false; }
-    
-    for ( unsigned int i = 0; i < a.v.size(); ++i )
-    {
-        same &= (a.v[i] == b.v[i]);
-    }
-    
-    return same;
-    
-}
-
-//==============================================================================
-
-void print_full( const expansion& e )
-{
-    if ( e.v.size() == 0 ) 
-    { 
-        std::cout << "0" << std::endl;
-        return; 
-    }
-    
-    for ( unsigned int j = 0; j < e.v.size(); ++j )
-    {
-        std::cout << e.v[j] << " ";
-    }
-    std::cout << std::endl;   
-}
-
-
-//==============================================================================
-
-static void print_binary_byte( unsigned char x )
-{
-    char b[9];
-    b[0] = '\0';
-    unsigned char z;
-    for (z = 128; z > 0; z >>= 1)
-    {
-        strcat(b, ((x & z) == z) ? "1" : "0");
-    }
-    
-    std::cout << b;
-}
-
-
-//==============================================================================
-
-
-union udouble {
-    double d;
-    size_t u; // was "unsigned long"
-};
-
-
-long get_exponent( double x )
-{
-    
-    udouble ux;
-    ux.d = x;
-    std::bitset<64> bits(ux.u);
-    
-    assert ( sizeof(size_t /* unsigned long */) == 8 ); // this is a real problem, better use size_t instead of double
-    assert ( sizeof(double) == 8 );    // required by IEEE 754 thank you very much
-    
-    // grab the 11 exponent bits
-    
-    std::bitset<64> exponent_bits( 0 );
-    
-    for ( int i = 0; i < 11; ++i )
-    {
-        int src_bit = 62 - i;
-        exponent_bits[10-i] = bits[src_bit];
-    }
-    
-    return exponent_bits.to_ulong() - 1023;
-}
-
-
-//==============================================================================
-
-void print_binary( const expansion& e )
-{
-    
-    if ( e.v.size() == 0 ) { std::cout << "0" << std::endl; }
-    
-    for ( unsigned int j = 0; j < e.v.size(); ++j )
-    {
-        std::cout << e.v[j] << ": ";
-        
-        udouble un;
-        un.d = e.v[j];
-        std::cout << std::hex << un.u << " " << std::endl;
-        //printf( "%x ", un.u );
-        
-        double ej = e.v[j];
-        const unsigned char* c = reinterpret_cast<const unsigned char*> ( &ej );
-        
-        for ( int i = sizeof(double) - 1; i >= 0; --i )
-            //for ( int i = 0; i < sizeof(double); ++i )
-        {
-            //printf( "%d ", c[i] );
-            //printf( "%2x ", c[i] );
-            print_binary_byte( c[i] ); std::cout << " ";
-        }
-        
-        std::cout << std::endl;   
-    }
-    
-    
-}
-
-
-
diff --git a/extern/eltopo/common/tunicate/expansion.h b/extern/eltopo/common/tunicate/expansion.h
deleted file mode 100644
index 379cf4b..0000000
--- a/extern/eltopo/common/tunicate/expansion.h
+++ /dev/null
@@ -1,224 +0,0 @@
-#ifndef EXPANSION_H
-#define EXPANSION_H
-
-// Released into the public-domain by Robert Bridson, 2009.
-// Simple functions for manipulating multiprecision floating-point
-// expansions, with simplicity favoured over speed.
-
-#include <cstddef>
-#include <vector>
-
-// The basic type is a vector of *increasing* and *nonoverlapping* doubles,
-// apart from allowed zeroes anywhere.
-//typedef std::vector<double> expansion;
-
-
-class expansion;
-
-void negative(const expansion& input, expansion& output);
-
-int sign( const expansion& a );
-
-bool
-is_zero( const expansion& a );
-
-void
-add(double a, double b, expansion& sum);
-
-// a and sum may be aliased to the same expansion for in-place addition
-void
-add(const expansion& a, double b, expansion& sum);
-
-inline void
-add(double a, const expansion& b, expansion& sum)
-{ add(b, a, sum); }
-
-// aliasing a, b and sum is safe
-void
-add(const expansion& a, const expansion& b, expansion& sum);
-
-void
-subtract( const double& a, const double& b, expansion& difference);
-
-// aliasing a, b and difference is safe
-void
-subtract(const expansion& a, const expansion& b, expansion& difference);
-
-// aliasing input and output is safe
-void
-negative(const expansion& input, expansion& output);
-
-void
-multiply(double a, double b, expansion& product);
-
-void
-multiply(double a, double b, double c, expansion& product);
-
-void
-multiply(double a, double b, double c, double d, expansion& product);
-
-void
-multiply(const expansion& a, double b, expansion& product);
-
-inline void
-multiply(double a, const expansion& b, expansion& product)
-{ multiply(b, a, product); }
-
-// Aliasing NOT safe
-void
-multiply(const expansion& a, const expansion& b, expansion& product);
-
-void compress( const expansion& e, expansion& h );
-
-// Aliasing NOT safe
-bool divide( const expansion& x, const expansion& y, expansion& q );
-
-void
-remove_zeros(expansion& a);
-
-double
-estimate(const expansion& a);
-
-bool equals( const expansion& a, const expansion& b );
-
-void
-print_full( const expansion& e );
-
-void print_binary( const expansion& e );
-
-long get_exponent( double x );
-
-
-// ----------------------------------------------------
-
-class expansion
-{
-    
-public:
-    
-    std::vector<double> v;
-    
-    expansion()
-    : v(0)
-    {}
-    
-    //   explicit expansion( std::size_t n )
-    //   : std::vector<double>(n)
-    //   {}
-    
-    explicit expansion( double val )
-    : v(1, val)
-    {}
-    
-    expansion( std::size_t n, double val )
-    : v(n,val)
-    {}
-    
-    virtual ~expansion() {}
-    
-    expansion& operator+=(const expansion &rhs)
-    {
-        add( *this, rhs, *this );
-        return *this;
-    }
-    
-    expansion& operator-=(const expansion &rhs)
-    {
-        subtract( *this, rhs, *this );
-        return *this;
-    }
-    
-    expansion& operator*=(const expansion &rhs)
-    {
-        expansion p;
-        multiply( *this, rhs, p );
-        *this = p;
-        return *this;
-    }
-    
-    inline expansion operator+(const expansion &other) const 
-    {
-        expansion result = *this;     
-        result += other;  
-        return result;              
-    }
-    
-    inline expansion operator-(const expansion &other) const 
-    {
-        expansion result = *this;    
-        result -= other;  
-        return result;              
-    }
-    
-    
-    inline expansion operator*(const expansion &other) const
-    {
-        expansion result = *this;    
-        result *= other;  
-        return result;              
-    }
-    
-    inline expansion operator-( ) const
-    {
-        expansion result;
-        negative( *this, result );
-        return result;
-    }
-    
-    inline double estimate() const
-    {
-        return ::estimate( *this );
-    }
-    
-    inline bool indefinite_sign() const
-    {
-        return false;
-    }
-    
-    static void begin_special_arithmetic()
-    {}
-    
-    static void end_special_arithmetic()
-    {}
-    
-    inline void clear()
-    {
-        v.clear();
-    }
-    
-    inline void resize( size_t new_size )
-    {
-        v.resize(new_size);
-    }
-    
-};
-
-
-inline void make_expansion( double a, expansion& e )
-{ 
-    if(a) 
-    {
-        e = expansion(1, a); 
-    }
-    else
-    {
-        e.clear();
-    }
-}
-
-inline void
-make_zero(expansion& e)
-{ e.resize(0); }
-
-inline void create_from_double( double a, expansion& out )
-{
-    make_expansion( a, out );
-}
-
-inline bool certainly_opposite_sign( const expansion& a, const expansion& b )
-{
-    return ( sign(a) > 0 && sign(b) < 0 ) || ( sign(a) < 0 && sign(b) > 0 );
-}
-
-
-#endif
diff --git a/extern/eltopo/common/tunicate/intersection.cpp b/extern/eltopo/common/tunicate/intersection.cpp
deleted file mode 100644
index 68ec4b7..0000000
--- a/extern/eltopo/common/tunicate/intersection.cpp
+++ /dev/null
@@ -1,951 +0,0 @@
-// Released into the public domain by Robert Bridson, 2009.
-
-#include <cassert>
-#include <cmath>
-#include <iostream>
-#include <tunicate.h>
-
-//==============================================================================
-static bool
-same_sign(double a, double b)
-{
-    return (a<=0 && b<=0) || (a>=0 && b>=0);
-}
-
-//==============================================================================
-int
-simplex_intersection1d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2)
-{
-    assert(1<=k && k<=2);
-    assert(alpha0 && alpha1 && alpha2);
-    if(k==1){
-        if(x1[0]<x2[0]){
-            if(x0[0]<x1[0]) return 0;
-            else if(x0[0]>x2[0]) return 0;
-            *alpha0=1;
-            *alpha1=(x2[0]-x0[0])/(x2[0]-x1[0]);
-            *alpha2=(x0[0]-x1[0])/(x2[0]-x1[0]);
-            return 1;
-        }else if(x1[0]>x2[0]){
-            if(x0[0]<x2[0]) return 0;
-            else if(x0[0]>x1[0]) return 0;
-            *alpha0=1;
-            *alpha1=(x2[0]-x0[0])/(x2[0]-x1[0]);
-            *alpha2=(x0[0]-x1[0])/(x2[0]-x1[0]);
-            return 1;
-        }else{ // x1[0]==x2[0]
-            if(x0[0]!=x1[0]) return 0;
-            *alpha0=1;
-            *alpha1=0.5;
-            *alpha2=0.5;
-            return 1;
-        }
-    }else
-        return simplex_intersection1d(1, x2, x1, 0, alpha2, alpha1, alpha0);
-}
-
-//==============================================================================
-// degenerate test in 2d - assumes three points lie on the same line
-static int
-simplex_intersection2d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2)
-{
-    assert(k==1);
-    // try projecting each coordinate out in turn
-    double ax0, ax1, ax2;
-    if(!simplex_intersection1d(1, x0+1, x1+1, x2+1, &ax0, &ax1, &ax2)) return 0;
-    double ay0, ay1, ay2;
-    if(!simplex_intersection1d(1, x0, x1, x2, &ay0, &ay1, &ay2)) return 0;
-    // decide which solution is more accurate for barycentric coordinates
-    double checkx=std::fabs(-ax0*x0[0]+ax1*x1[0]+ax2*x2[0])
-    +std::fabs(-ax0*x0[1]+ax1*x1[1]+ax2*x2[1]);
-    double checky=std::fabs(-ay0*x0[0]+ay1*x1[0]+ay2*x2[0])
-    +std::fabs(-ay0*x0[1]+ay1*x1[1]+ay2*x2[1]);
-    if(checkx<=checky){
-        *alpha0=ax0;
-        *alpha1=ax1;
-        *alpha2=ax2;
-    }else{
-        *alpha0=ay0;
-        *alpha1=ay1;
-        *alpha2=ay2;
-    }
-    return 1;
-}
-
-//==============================================================================
-int
-simplex_intersection2d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2,
-                       double* alpha3)
-{
-    assert(1<=k && k<=3);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. triangle
-            *alpha1=-orientation2d(x0, x2, x3);
-            *alpha2= orientation2d(x0, x1, x3);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-orientation2d(x0, x1, x2);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            sum2=*alpha1+*alpha2+*alpha3;
-            if(sum2){ // triangle not degenerate?
-                *alpha0=1;
-                *alpha1/=sum2;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                return 1;
-            }else{ // triangle is degenerate and point lies on same line
-                if(simplex_intersection2d(1, x0, x1, x2, alpha0, alpha1, alpha2)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection2d(1, x0, x1, x3, alpha0, alpha1, alpha3)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection2d(1, x0, x2, x3, alpha0, alpha2, alpha3)){
-                    *alpha1=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 2: // segment vs. segment
-            *alpha0= orientation2d(x1, x2, x3);
-            *alpha1=-orientation2d(x0, x2, x3);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation2d(x0, x1, x3);
-            *alpha3=-orientation2d(x0, x1, x2);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            sum1=*alpha0+*alpha1;
-            sum2=*alpha2+*alpha3;
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                return 1;
-            }else{ // degenerate: segments lie on the same line
-                if(simplex_intersection2d(1, x0, x2, x3, alpha0, alpha2, alpha3)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection2d(1, x1, x2, x3, alpha1, alpha2, alpha3)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection2d(1, x2, x0, x1, alpha2, alpha0, alpha1)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection2d(1, x3, x0, x1, alpha3, alpha0, alpha1)){
-                    *alpha2=0;
-                    return 1;
-                }
-                return 0;
-            }
-        case 3: // triangle vs. point
-            return simplex_intersection2d(1, x3, x2, x1, x0,
-                                          alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-// degenerate test in 3d - assumes four points lie on the same plane
-static int
-simplex_intersection3d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2,
-                       double* )
-{
-    assert(k<=2);
-    // try projecting each coordinate out in turn
-    double ax0, ax1, ax2, ax3;
-    if(!simplex_intersection2d(k, x0+1, x1+1, x2+1, x3+1, &ax0, &ax1, &ax2,&ax3))
-        return 0;
-    double ay0, ay1, ay2, ay3;
-    double p0[2]={x0[0], x0[2]}, p1[2]={x1[0], x1[2]},
-    p2[2]={x2[0], x2[2]}, p3[2]={x3[0], x3[2]};
-    if(!simplex_intersection2d(k, p0, p1, p2, p3, &ay0, &ay1, &ay2, &ay3))
-        return 0;
-    double az0, az1, az2, az3;
-    if(!simplex_intersection2d(k, x0, x1, x2, x3, &az0, &az1, &az2, &az3))
-        return 0;
-    // decide which solution is more accurate for barycentric coordinates
-    double checkx, checky, checkz;
-    if(k==1){
-        checkx=std::fabs(-ax0*x0[0]+ax1*x1[0]+ax2*x2[0]+ax3*x3[0])
-        +std::fabs(-ax0*x0[1]+ax1*x1[1]+ax2*x2[1]+ax3*x3[1])
-        +std::fabs(-ax0*x0[2]+ax1*x1[2]+ax2*x2[2]+ax3*x3[2]);
-        checky=std::fabs(-ay0*x0[0]+ay1*x1[0]+ay2*x2[0]+ay3*x3[0])
-        +std::fabs(-ay0*x0[1]+ay1*x1[1]+ay2*x2[1]+ay3*x3[1])
-        +std::fabs(-ay0*x0[2]+ay1*x1[2]+ay2*x2[2]+ay3*x3[2]);
-        checkz=std::fabs(-az0*x0[0]+az1*x1[0]+az2*x2[0]+az3*x3[0])
-        +std::fabs(-az0*x0[1]+az1*x1[1]+az2*x2[1]+az3*x3[1])
-        +std::fabs(-az0*x0[2]+az1*x1[2]+az2*x2[2]+az3*x3[2]);
-    }else{
-        checkx=std::fabs(-ax0*x0[0]-ax1*x1[0]+ax2*x2[0]+ax3*x3[0])
-        +std::fabs(-ax0*x0[1]-ax1*x1[1]+ax2*x2[1]+ax3*x3[1])
-        +std::fabs(-ax0*x0[2]-ax1*x1[2]+ax2*x2[2]+ax3*x3[2]);
-        checky=std::fabs(-ay0*x0[0]-ay1*x1[0]+ay2*x2[0]+ay3*x3[0])
-        +std::fabs(-ay0*x0[1]-ay1*x1[1]+ay2*x2[1]+ay3*x3[1])
-        +std::fabs(-ay0*x0[2]-ay1*x1[2]+ay2*x2[2]+ay3*x3[2]);
-        checkz=std::fabs(-az0*x0[0]-az1*x1[0]+az2*x2[0]+az3*x3[0])
-        +std::fabs(-az0*x0[1]-az1*x1[1]+az2*x2[1]+az3*x3[1])
-        +std::fabs(-az0*x0[2]-az1*x1[2]+az2*x2[2]+az3*x3[2]);
-    }
-    if(checkx<=checky && checkx<=checkz){
-        *alpha0=ax0;
-        *alpha1=ax1;
-        *alpha2=ax2;
-        *alpha2=ax3;
-    }else if(checky<=checkz){
-        *alpha0=ay0;
-        *alpha1=ay1;
-        *alpha2=ay2;
-        *alpha2=ay3;
-    }else{
-        *alpha0=az0;
-        *alpha1=az1;
-        *alpha2=az2;
-        *alpha2=az3;
-    }
-    return 1;
-}
-
-//==============================================================================
-int
-simplex_intersection3d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2,
-                       double* alpha3,
-                       double* alpha4)
-{
-    assert(1<=k && k<=4);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. tetrahedron
-            *alpha1=-orientation3d(x0, x2, x3, x4);
-            *alpha2= orientation3d(x0, x1, x3, x4);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-orientation3d(x0, x1, x2, x4);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= orientation3d(x0, x1, x2, x3);
-            if(!same_sign(*alpha1, *alpha4)) return 0;
-            if(!same_sign(*alpha2, *alpha4)) return 0;         
-            if(!same_sign(*alpha3, *alpha4)) return 0;                  
-            *alpha0=1;
-            sum2=*alpha1+*alpha2+*alpha3+*alpha4;
-            if(sum2){
-                *alpha1/=sum2;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                return 1;
-            }else{ // degenerate: point and tetrahedron in same plane
-                if(simplex_intersection3d(1, x0, x2, x3, x4,
-                                          alpha0, alpha2, alpha3, alpha4)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(1, x0, x1, x3, x4,
-                                          alpha0, alpha1, alpha3, alpha4)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(1, x0, x1, x2, x4,
-                                          alpha0, alpha1, alpha2, alpha4)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(1, x0, x1, x2, x3,
-                                          alpha0, alpha1, alpha2, alpha3)){
-                    *alpha4=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 2: // segment vs. triangle
-            *alpha0= orientation3d(x1, x2, x3, x4);
-            *alpha1=-orientation3d(x0, x2, x3, x4);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation3d(x0, x1, x3, x4);
-            *alpha3=-orientation3d(x0, x1, x2, x4);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= orientation3d(x0, x1, x2, x3);
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            if(!same_sign(*alpha3, *alpha4)) return 0;
-            sum1=*alpha0+*alpha1;
-            sum2=*alpha2+*alpha3+*alpha4;
-            
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                return 1;
-            }else{ // degenerate: segment and triangle in same plane
-                if(simplex_intersection3d(1, x1, x2, x3, x4,
-                                          alpha1, alpha2, alpha3, alpha4)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(1, x0, x2, x3, x4,
-                                          alpha0, alpha2, alpha3, alpha4)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(2, x0, x1, x3, x4,
-                                          alpha0, alpha1, alpha3, alpha4)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(2, x0, x1, x2, x4,
-                                          alpha0, alpha1, alpha2, alpha4)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection3d(2, x0, x1, x2, x3,
-                                          alpha0, alpha1, alpha2, alpha3)){
-                    *alpha4=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 3: // triangle vs. segment
-        case 4: // tetrahedron vs. point
-            return simplex_intersection3d(5-k, x4, x3, x2, x1, x0,
-                                          alpha4, alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-// degenerate test in 3d+time - assumes five points lie on the same hyper-plane
-static int
-simplex_intersection_time3d(int k,
-                            const double* x0, int time0,
-                            const double* x1, int time1,
-                            const double* x2, int time2,
-                            const double* x3, int time3,
-                            const double* x4, int time4,
-                            double* alpha0, 
-                            double* alpha1, 
-                            double* alpha2,
-                            double* alpha3,
-                            double* )
-{
-    assert(k<=2);
-    assert(time0==0 || time0==1);
-    assert(time1==0 || time1==1);
-    assert(time2==0 || time2==1);
-    assert(time3==0 || time3==1);
-    assert(time4==0 || time4==1);
-    // try projecting each coordinate out in turn
-    double ax0, ax1, ax2, ax3, ax4;
-    double r0[3]={x0[0], x0[2], time0}, r1[3]={x1[0], x1[2], time1},
-    r2[3]={x2[0], x2[2], time2}, r3[3]={x3[0], x3[2], time3},
-    r4[3]={x4[0], x4[2], time4};
-    if(!simplex_intersection3d(k, r0, r1, r2, r3, r4,
-                               &ax0, &ax1, &ax2, &ax3, &ax4)) return 0;
-    double ay0, ay1, ay2, ay3, ay4;
-    double p0[3]={x0[0], x0[2], time0}, p1[3]={x1[0], x1[2], time1},
-    p2[3]={x2[0], x2[2], time2}, p3[3]={x3[0], x3[2], time3},
-    p4[3]={x4[0], x4[2], time4};
-    if(!simplex_intersection3d(k, p0, p1, p2, p3, p4,
-                               &ay0, &ay1, &ay2, &ay3, &ay4)) return 0;
-    double az0, az1, az2, az3, az4;
-    double q0[3]={x0[0], x0[1], time0}, q1[3]={x1[0], x1[1], time1},
-    q2[3]={x2[0], x2[1], time2}, q3[3]={x3[0], x3[1], time3},
-    q4[3]={x4[0], x4[1], time4};
-    if(!simplex_intersection3d(k, q0, q1, q2, q3, q4,
-                               &az0, &az1, &az2, &az3, &az4)) return 0;
-    double at0, at1, at2, at3, at4;
-    if(!simplex_intersection3d(k, x0, x1, x2, x3, x4,
-                               &at0, &at1, &at2, &at3, &at4)) return 0;
-    // decide which solution is more accurate for barycentric coordinates
-    double checkx, checky, checkz, checkt;
-    if(k==1){
-        checkx=std::fabs(-ax0*x0[0]+ax1*x1[0]+ax2*x2[0]+ax3*x3[0]+ax4*x4[0])
-        +std::fabs(-ax0*x0[1]+ax1*x1[1]+ax2*x2[1]+ax3*x3[1]+ax4*x4[1])
-        +std::fabs(-ax0*x0[2]+ax1*x1[2]+ax2*x2[2]+ax3*x3[2]+ax4*x4[2])
-        +std::fabs(-ax0*time0+ax1*time1+ax2*time2+ax3*time3+ax4*time4);
-        checky=std::fabs(-ay0*x0[0]+ay1*x1[0]+ay2*x2[0]+ay3*x3[0]+ay4*x4[0])
-        +std::fabs(-ay0*x0[1]+ay1*x1[1]+ay2*x2[1]+ay3*x3[1]+ay4*x4[1])
-        +std::fabs(-ay0*x0[2]+ay1*x1[2]+ay2*x2[2]+ay3*x3[2]+ay4*x4[2])
-        +std::fabs(-ay0*time0+ay1*time1+ay2*time2+ay3*time3+ay4*time4);
-        checkz=std::fabs(-az0*x0[0]+az1*x1[0]+az2*x2[0]+az3*x3[0]+az4*x4[0])
-        +std::fabs(-az0*x0[1]+az1*x1[1]+az2*x2[1]+az3*x3[1]+az4*x4[1])
-        +std::fabs(-az0*x0[2]+az1*x1[2]+az2*x2[2]+az3*x3[2]+az4*x4[2])
-        +std::fabs(-az0*time0+az1*time1+az2*time2+az3*time3+az4*time4);
-        checkt=std::fabs(-at0*x0[0]+at1*x1[0]+at2*x2[0]+at3*x3[0]+at4*x4[0])
-        +std::fabs(-at0*x0[1]+at1*x1[1]+at2*x2[1]+at3*x3[1]+at4*x4[1])
-        +std::fabs(-at0*x0[2]+at1*x1[2]+at2*x2[2]+at3*x3[2]+at4*x4[2])
-        +std::fabs(-at0*time0+at1*time1+at2*time2+at3*time3+at4*time4);
-    }else{
-        checkx=std::fabs(-ax0*x0[0]-ax1*x1[0]+ax2*x2[0]+ax3*x3[0]+ax4*x4[0])
-        +std::fabs(-ax0*x0[1]-ax1*x1[1]+ax2*x2[1]+ax3*x3[1]+ax4*x4[1])
-        +std::fabs(-ax0*x0[2]-ax1*x1[2]+ax2*x2[2]+ax3*x3[2]+ax4*x4[2])
-        +std::fabs(-ax0*time0-ax1*time1+ax2*time2+ax3*time3+ax4*time4);
-        checky=std::fabs(-ay0*x0[0]-ay1*x1[0]+ay2*x2[0]+ay3*x3[0]+ay4*x4[0])
-        +std::fabs(-ay0*x0[1]-ay1*x1[1]+ay2*x2[1]+ay3*x3[1]+ay4*x4[1])
-        +std::fabs(-ay0*x0[2]-ay1*x1[2]+ay2*x2[2]+ay3*x3[2]+ay4*x4[2])
-        +std::fabs(-ay0*time0-ay1*time1+ay2*time2+ay3*time3+ay4*time4);
-        checkz=std::fabs(-az0*x0[0]-az1*x1[0]+az2*x2[0]+az3*x3[0]+az4*x4[0])
-        +std::fabs(-az0*x0[1]-az1*x1[1]+az2*x2[1]+az3*x3[1]+az4*x4[1])
-        +std::fabs(-az0*x0[2]-az1*x1[2]+az2*x2[2]+az3*x3[2]+az4*x4[2])
-        +std::fabs(-az0*time0-az1*time1+az2*time2+az3*time3+az4*time4);
-        checkt=std::fabs(-at0*x0[0]-at1*x1[0]+at2*x2[0]+at3*x3[0]+at4*x4[0])
-        +std::fabs(-at0*x0[1]-at1*x1[1]+at2*x2[1]+at3*x3[1]+at4*x4[1])
-        +std::fabs(-at0*x0[2]-at1*x1[2]+at2*x2[2]+at3*x3[2]+at4*x4[2])
-        +std::fabs(-at0*time0-at1*time1+at2*time2+at3*time3+at4*time4);
-    }
-    if(checkx<=checky && checkx<=checkz && checkx<=checkt){
-        *alpha0=ax0;
-        *alpha1=ax1;
-        *alpha2=ax2;
-        *alpha3=ax3;
-    }else if(checky<=checkz && checky<=checkt){
-        *alpha0=ay0;
-        *alpha1=ay1;
-        *alpha2=ay2;
-        *alpha3=ay3;
-    }else if(checkz<=checkt){
-        *alpha0=az0;
-        *alpha1=az1;
-        *alpha2=az2;
-        *alpha3=az3;
-    }else{
-        *alpha0=at0;
-        *alpha1=at1;
-        *alpha2=at2;
-        *alpha3=at3;
-    }
-    return 1;
-}
-
-//==============================================================================
-int
-simplex_intersection_time3d(int k,
-                            const double* x0, int t0,
-                            const double* x1, int t1,
-                            const double* x2, int t2,
-                            const double* x3, int t3,
-                            const double* x4, int t4,
-                            const double* x5, int t5,
-                            double* alpha0, 
-                            double* alpha1, 
-                            double* alpha2,
-                            double* alpha3,
-                            double* alpha4,
-                            double* alpha5)
-{
-    assert(1<=k && k<=5);
-    assert(t0==0 || t0==1);
-    assert(t1==0 || t1==1);
-    assert(t2==0 || t2==1);
-    assert(t3==0 || t3==1);
-    assert(t4==0 || t4==1);
-    assert(t5==0 || t5==1);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. pentachoron
-            *alpha1=-orientation_time3d(x0, t0, x2, t2, x3, t3, x4, t4, x5, t5);
-            *alpha2= orientation_time3d(x0, t0, x1, t1, x3, t3, x4, t4, x5, t5);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-orientation_time3d(x0, t0, x1, t1, x2, t3, x4, t4, x5, t5);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            *alpha4= orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x5, t5);
-            if(!same_sign(*alpha1, *alpha4)) return 0;
-            *alpha5=-orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x4, t4);
-            if(!same_sign(*alpha1, *alpha5)) return 0;
-            sum2=*alpha1+*alpha2+*alpha3+*alpha4+*alpha5;
-            if(sum2){
-                *alpha0=1;
-                *alpha1/=sum2;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection_time3d(1, x0, t0, x2, t2, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(1, x0, t0, x1, t1, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(1, x0, t0, x1, t1, x2, t2, x4, t4,
-                                               x5, t5, alpha0, alpha1, alpha2, alpha4, alpha5)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(1, x0, t0, x1, t1, x2, t2, x3, t3,
-                                               x5, t5, alpha0, alpha1, alpha2, alpha3, alpha5)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(1, x0, t0, x1, t1, x2, t2, x3, t3,
-                                               x4, t4, alpha0, alpha1, alpha2, alpha3, alpha4)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 2: // segment vs. tetrahedron
-            *alpha0= orientation_time3d(x1, t1, x2, t2, x3, t3, x4, t4, x5, t5);
-            *alpha1=-orientation_time3d(x0, t0, x2, t2, x3, t3, x4, t4, x5, t5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation_time3d(x0, t0, x1, t1, x3, t3, x4, t4, x5, t5);
-            *alpha3=-orientation_time3d(x0, t0, x1, t1, x2, t2, x4, t4, x5, t5);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x5, t5);
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            *alpha5=-orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x4, t4);
-            if(!same_sign(*alpha2, *alpha5)) return 0;
-            sum1=*alpha0+*alpha1;
-            sum2=*alpha2+*alpha3+*alpha4+*alpha5;
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection_time3d(1, x1, t1, x2, t2, x3, t3, x4, t4,
-                                               x5, t5, alpha1, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(1, x0, t0, x2, t2, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x1, t1, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x1, t1, x2, t2, x4, t4,
-                                               x5, t5, alpha0, alpha1, alpha2, alpha4, alpha5)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x1, t1, x2, t2, x3, t3,
-                                               x5, t5, alpha0, alpha1, alpha2, alpha3, alpha5)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x1, t1, x2, t2, x3, t3,
-                                               x4, t4, alpha0, alpha1, alpha2, alpha3, alpha4)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 3: // triangle vs. triangle
-            *alpha0= orientation_time3d(x1, t1, x2, t2, x3, t3, x4, t4, x5, t5);
-            *alpha1=-orientation_time3d(x0, t0, x2, t2, x3, t3, x4, t4, x5, t5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation_time3d(x0, t0, x1, t1, x3, t3, x4, t4, x5, t5);
-            if(!same_sign(*alpha0, *alpha2)) return 0;
-            *alpha3=-orientation_time3d(x0, t0, x1, t1, x2, t2, x4, t4, x5, t5);
-            *alpha4= orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x5, t5);
-            if(!same_sign(*alpha3, *alpha4)) return 0;
-            *alpha5=-orientation_time3d(x0, t0, x1, t1, x2, t2, x3, t3, x4, t4);
-            if(!same_sign(*alpha3, *alpha5)) return 0;
-            sum1=*alpha0+*alpha1+*alpha2;
-            sum2=*alpha3+*alpha4+*alpha5;
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum1;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection_time3d(2, x1, t1, x2, t2, x3, t3, x4, t4,
-                                               x5, t5, alpha1, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x2, t2, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x0, t0, x1, t1, x3, t3, x4, t4,
-                                               x5, t5, alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x4, t4, x5, t5, x0, t0, x1, t1,
-                                               x2, t2, alpha4, alpha5, alpha0, alpha1, alpha2)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x3, t3, x5, t5, x0, t0, x1, t1,
-                                               x2, t2, alpha3, alpha5, alpha0, alpha1, alpha2)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection_time3d(2, x3, t3, x4, t4, x0, t0, x1, t1,
-                                               x2, t2, alpha3, alpha4, alpha0, alpha1, alpha2)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 4: // tetrahedron vs. segment
-        case 5: // pentachoron vs. point
-            return simplex_intersection_time3d(6-k, x5, t5, x4, t4, x3, t3, x2, t2,
-                                               x1, t1, x0, t0, alpha5, alpha4, alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-// degenerate test in 4d - assumes five points lie on the same hyper-plane
-static int
-simplex_intersection4d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2,
-                       double* alpha3,
-                       double* )
-{
-    assert(k<=2);
-    // try projecting each coordinate out in turn
-    double ax0, ax1, ax2, ax3, ax4;
-    if(!simplex_intersection3d(k, x0+1, x1+1, x2+1, x3+1, x4+1,
-                               &ax0, &ax1, &ax2, &ax3, &ax4)) return 0;
-    double ay0, ay1, ay2, ay3, ay4;
-    double p0[3]={x0[0], x0[2], x0[3]}, p1[3]={x1[0], x1[2], x1[3]},
-    p2[3]={x2[0], x2[2], x2[3]}, p3[3]={x3[0], x3[2], x3[3]},
-    p4[3]={x4[0], x4[2], x4[3]};
-    if(!simplex_intersection3d(k, p0, p1, p2, p3, p4,
-                               &ay0, &ay1, &ay2, &ay3, &ay4)) return 0;
-    double az0, az1, az2, az3, az4;
-    double q0[3]={x0[0], x0[1], x0[3]}, q1[3]={x1[0], x1[1], x1[3]},
-    q2[3]={x2[0], x2[1], x2[3]}, q3[3]={x3[0], x3[1], x3[3]},
-    q4[3]={x4[0], x4[1], x4[3]};
-    if(!simplex_intersection3d(k, q0, q1, q2, q3, q4,
-                               &az0, &az1, &az2, &az3, &az4)) return 0;
-    double at0, at1, at2, at3, at4;
-    if(!simplex_intersection3d(k, x0, x1, x2, x3, x4,
-                               &at0, &at1, &at2, &at3, &at4)) return 0;
-    // decide which solution is more accurate for barycentric coordinates
-    double checkx, checky, checkz, checkt;
-    if(k==1){
-        checkx=std::fabs(-ax0*x0[0]+ax1*x1[0]+ax2*x2[0]+ax3*x3[0]+ax4*x4[0])
-        +std::fabs(-ax0*x0[1]+ax1*x1[1]+ax2*x2[1]+ax3*x3[1]+ax4*x4[1])
-        +std::fabs(-ax0*x0[2]+ax1*x1[2]+ax2*x2[2]+ax3*x3[2]+ax4*x4[2])
-        +std::fabs(-ax0*x0[3]+ax1*x1[3]+ax2*x2[3]+ax3*x3[3]+ax4*x4[3]);
-        checky=std::fabs(-ay0*x0[0]+ay1*x1[0]+ay2*x2[0]+ay3*x3[0]+ay4*x4[0])
-        +std::fabs(-ay0*x0[1]+ay1*x1[1]+ay2*x2[1]+ay3*x3[1]+ay4*x4[1])
-        +std::fabs(-ay0*x0[2]+ay1*x1[2]+ay2*x2[2]+ay3*x3[2]+ay4*x4[2])
-        +std::fabs(-ay0*x0[3]+ay1*x1[3]+ay2*x2[3]+ay3*x3[3]+ay4*x4[3]);
-        checkz=std::fabs(-az0*x0[0]+az1*x1[0]+az2*x2[0]+az3*x3[0]+az4*x4[0])
-        +std::fabs(-az0*x0[1]+az1*x1[1]+az2*x2[1]+az3*x3[1]+az4*x4[1])
-        +std::fabs(-az0*x0[2]+az1*x1[2]+az2*x2[2]+az3*x3[2]+az4*x4[2])
-        +std::fabs(-az0*x0[3]+az1*x1[3]+az2*x2[3]+az3*x3[3]+az4*x4[3]);
-        checkt=std::fabs(-at0*x0[0]+at1*x1[0]+at2*x2[0]+at3*x3[0]+at4*x4[0])
-        +std::fabs(-at0*x0[1]+at1*x1[1]+at2*x2[1]+at3*x3[1]+at4*x4[1])
-        +std::fabs(-at0*x0[2]+at1*x1[2]+at2*x2[2]+at3*x3[2]+at4*x4[2])
-        +std::fabs(-at0*x0[3]+at1*x1[3]+at2*x2[3]+at3*x3[3]+at4*x4[3]);
-    }else{
-        checkx=std::fabs(-ax0*x0[0]-ax1*x1[0]+ax2*x2[0]+ax3*x3[0]+ax4*x4[0])
-        +std::fabs(-ax0*x0[1]-ax1*x1[1]+ax2*x2[1]+ax3*x3[1]+ax4*x4[1])
-        +std::fabs(-ax0*x0[2]-ax1*x1[2]+ax2*x2[2]+ax3*x3[2]+ax4*x4[2])
-        +std::fabs(-ax0*x0[3]-ax1*x1[3]+ax2*x2[3]+ax3*x3[3]+ax4*x4[3]);
-        checky=std::fabs(-ay0*x0[0]-ay1*x1[0]+ay2*x2[0]+ay3*x3[0]+ay4*x4[0])
-        +std::fabs(-ay0*x0[1]-ay1*x1[1]+ay2*x2[1]+ay3*x3[1]+ay4*x4[1])
-        +std::fabs(-ay0*x0[2]-ay1*x1[2]+ay2*x2[2]+ay3*x3[2]+ay4*x4[2])
-        +std::fabs(-ay0*x0[3]-ay1*x1[3]+ay2*x2[3]+ay3*x3[3]+ay4*x4[3]);
-        checkz=std::fabs(-az0*x0[0]-az1*x1[0]+az2*x2[0]+az3*x3[0]+az4*x4[0])
-        +std::fabs(-az0*x0[1]-az1*x1[1]+az2*x2[1]+az3*x3[1]+az4*x4[1])
-        +std::fabs(-az0*x0[2]-az1*x1[2]+az2*x2[2]+az3*x3[2]+az4*x4[2])
-        +std::fabs(-az0*x0[3]-az1*x1[3]+az2*x2[3]+az3*x3[3]+az4*x4[3]);
-        checkt=std::fabs(-at0*x0[0]-at1*x1[0]+at2*x2[0]+at3*x3[0]+at4*x4[0])
-        +std::fabs(-at0*x0[1]-at1*x1[1]+at2*x2[1]+at3*x3[1]+at4*x4[1])
-        +std::fabs(-at0*x0[2]-at1*x1[2]+at2*x2[2]+at3*x3[2]+at4*x4[2])
-        +std::fabs(-at0*x0[3]-at1*x1[3]+at2*x2[3]+at3*x3[3]+at4*x4[3]);
-    }
-    if(checkx<=checky && checkx<=checkz && checkx<=checkt){
-        *alpha0=ax0;
-        *alpha1=ax1;
-        *alpha2=ax2;
-        *alpha3=ax3;
-    }else if(checky<=checkz && checky<=checkt){
-        *alpha0=ay0;
-        *alpha1=ay1;
-        *alpha2=ay2;
-        *alpha3=ay3;
-    }else if(checkz<=checkt){
-        *alpha0=az0;
-        *alpha1=az1;
-        *alpha2=az2;
-        *alpha3=az3;
-    }else{
-        *alpha0=at0;
-        *alpha1=at1;
-        *alpha2=at2;
-        *alpha3=at3;
-    }
-    return 1;
-}
-
-//==============================================================================
-int
-simplex_intersection4d(int k,
-                       const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4,
-                       const double* x5,
-                       double* alpha0, 
-                       double* alpha1, 
-                       double* alpha2,
-                       double* alpha3,
-                       double* alpha4,
-                       double* alpha5)
-{
-    assert(1<=k && k<=5);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. pentachoron
-            *alpha1=-orientation4d(x0, x2, x3, x4, x5);
-            *alpha2= orientation4d(x0, x1, x3, x4, x5);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-orientation4d(x0, x1, x2, x4, x5);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= orientation4d(x0, x1, x2, x3, x5);
-            if(!same_sign(*alpha1, *alpha4)) return 0;
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            if(!same_sign(*alpha3, *alpha4)) return 0;
-            *alpha5=-orientation4d(x0, x1, x2, x3, x4);
-            if(!same_sign(*alpha1, *alpha5)) return 0;
-            if(!same_sign(*alpha2, *alpha5)) return 0;
-            if(!same_sign(*alpha3, *alpha5)) return 0;
-            if(!same_sign(*alpha4, *alpha5)) return 0;
-            
-            
-            sum2=*alpha1+*alpha2+*alpha3+*alpha4+*alpha5;
-            if(sum2){
-                *alpha0=1;
-                *alpha1/=sum2;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection4d(1, x0, x2, x3, x4, x5,
-                                          alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(1, x0, x1, x3, x4, x5,
-                                          alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(1, x0, x1, x2, x4, x5,
-                                          alpha0, alpha1, alpha2, alpha4, alpha5)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(1, x0, x1, x2, x3, x5,
-                                          alpha0, alpha1, alpha2, alpha3, alpha5)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(1, x0, x1, x2, x3, x4,
-                                          alpha0, alpha1, alpha2, alpha3, alpha4)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 2: // segment vs. tetrahedron
-            *alpha0= orientation4d(x1, x2, x3, x4, x5);
-            *alpha1=-orientation4d(x0, x2, x3, x4, x5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation4d(x0, x1, x3, x4, x5);
-            *alpha3=-orientation4d(x0, x1, x2, x4, x5);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= orientation4d(x0, x1, x2, x3, x5);
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            if(!same_sign(*alpha3, *alpha4)) return 0;         
-            *alpha5=-orientation4d(x0, x1, x2, x3, x4);
-            if(!same_sign(*alpha2, *alpha5)) return 0;
-            if(!same_sign(*alpha3, *alpha5)) return 0;
-            if(!same_sign(*alpha4, *alpha5)) return 0;         
-            
-            sum1=*alpha0+*alpha1;
-            sum2=*alpha2+*alpha3+*alpha4+*alpha5;
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum2;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection4d(1, x1, x2, x3, x4, x5,
-                                          alpha1, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(1, x0, x2, x3, x4, x5,
-                                          alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x1, x3, x4, x5,
-                                          alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x1, x2, x4, x5,
-                                          alpha0, alpha1, alpha2, alpha4, alpha5)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x1, x2, x3, x5,
-                                          alpha0, alpha1, alpha2, alpha3, alpha5)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x1, x2, x3, x4,
-                                          alpha0, alpha1, alpha2, alpha3, alpha4)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 3: // triangle vs. triangle
-            *alpha0= orientation4d(x1, x2, x3, x4, x5);
-            *alpha1=-orientation4d(x0, x2, x3, x4, x5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= orientation4d(x0, x1, x3, x4, x5);
-            if(!same_sign(*alpha0, *alpha2)) return 0;
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-orientation4d(x0, x1, x2, x4, x5);
-            *alpha4= orientation4d(x0, x1, x2, x3, x5);
-            if(!same_sign(*alpha3, *alpha4)) return 0;
-            *alpha5=-orientation4d(x0, x1, x2, x3, x4);
-            if(!same_sign(*alpha3, *alpha5)) return 0;
-            if(!same_sign(*alpha4, *alpha5)) return 0;         
-            
-            sum1=*alpha0+*alpha1+*alpha2;
-            sum2=*alpha3+*alpha4+*alpha5;
-            if(sum1 && sum2){
-                *alpha0/=sum1;
-                *alpha1/=sum1;
-                *alpha2/=sum1;
-                *alpha3/=sum2;
-                *alpha4/=sum2;
-                *alpha5/=sum2;
-                return 1;
-            }else{
-                if(simplex_intersection4d(2, x1, x2, x3, x4, x5,
-                                          alpha1, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha0=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x2, x3, x4, x5,
-                                          alpha0, alpha2, alpha3, alpha4, alpha5)){
-                    *alpha1=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x0, x1, x3, x4, x5,
-                                          alpha0, alpha1, alpha3, alpha4, alpha5)){
-                    *alpha2=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x4, x5, x0, x1, x2,
-                                          alpha4, alpha5, alpha0, alpha1, alpha2)){
-                    *alpha3=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x3, x5, x0, x1, x2,
-                                          alpha3, alpha5, alpha0, alpha1, alpha2)){
-                    *alpha4=0;
-                    return 1;
-                }
-                if(simplex_intersection4d(2, x3, x4, x0, x1, x2,
-                                          alpha3, alpha4, alpha0, alpha1, alpha2)){
-                    *alpha5=0;
-                    return 1;
-                }
-                return 0;
-            }
-            
-        case 4: // tetrahedron vs. segment
-        case 5: // pentachoron vs. point
-            return simplex_intersection4d(6-k, x5, x4, x3, x2, x1, x0,
-                                          alpha5, alpha4, alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
diff --git a/extern/eltopo/common/tunicate/neg.cpp b/extern/eltopo/common/tunicate/neg.cpp
deleted file mode 100644
index 78b5e5d..0000000
--- a/extern/eltopo/common/tunicate/neg.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// Released into the public domain by Robert Bridson, 2009.
-
-#include <neg.h>
-
-//==============================================================================
-// Try to force the compiler to add a negative instead of subtracting.
-// (i.e. write a+neg(b) since a+(-b) is erroneously simplified to a-b)
-// Aggressive (and well-intentioned but *wrong*) inter-procedural analysis
-// performed by the compiler at link time could defeat this; you might have
-// to struggle with your compiler.
-
-double
-neg(double x)
-{
-    return -x;
-}
diff --git a/extern/eltopo/common/tunicate/neg.h b/extern/eltopo/common/tunicate/neg.h
deleted file mode 100644
index 01dd540..0000000
--- a/extern/eltopo/common/tunicate/neg.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef NEG_H
-#define NEG_H
-
-// Released into the public domain by Robert Bridson, 2009.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-    double
-    neg(double x);
-    
-#ifdef __cplusplus
-} // end of extern "C" block
-#endif
-
-#endif
diff --git a/extern/eltopo/common/tunicate/orientation.cpp b/extern/eltopo/common/tunicate/orientation.cpp
deleted file mode 100644
index 7d6064d..0000000
--- a/extern/eltopo/common/tunicate/orientation.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-// Released into the public domain by Robert Bridson, 2009.
-
-#include <cassert>
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include <float.h>
-#pragma fenv_access (on)
-#define FE_UPWARD _RC_UP
-#define FE_DOWNWARD _RC_DOWN
-#define FE_TONEAREST _RC_NEAR
-#define fesetround(r) (_controlfp(r, _MCW_RC))
-#else
-#include <fenv.h>
-#endif
-#include <cmath>
-#include <limits>
-#include <tunicate.h>
-#include <expansion.h>
-#include <neg.h>
-
-
-
-
-void
-interval_orientation4d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4,
-                       double* lower,
-                       double* upper);
-
-
-
-//==============================================================================
-double
-orientation1d(const double* x0,
-              const double* x1)
-{
-    assert(x0 && x1);
-    return x0[0]-x1[0];
-}
-
-//==============================================================================
-static double
-simple_orientation2d(const double* x0,
-                     const double* x1,
-                     const double* x2)
-{
-    return x0[0]*x1[1] + neg(x0[0])*x2[1]
-    + x1[0]*x2[1] + neg(x1[0])*x0[1]
-    + x2[0]*x0[1] + neg(x2[0])*x1[1];
-}
-
-//==============================================================================
-void
-interval_orientation2d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       double* lower,
-                       double* upper)
-{
-    fesetround(FE_DOWNWARD);
-    *lower=simple_orientation2d(x0, x1, x2);
-    fesetround(FE_UPWARD);
-    *upper=simple_orientation2d(x0, x1, x2);
-    assert(*lower<=*upper);
-}
-
-//==============================================================================
-// calculates the exact result, as an expansion.
-static void
-expansion_orientation2d(const double* x0,
-                        const double* x1,
-                        const double* x2,
-                        expansion& result)
-{
-    expansion product;
-    multiply(x0[0],  x1[1], result);
-    multiply(x0[0], -x2[1], product); add(result, product, result);
-    multiply(x1[0],  x2[1], product); add(result, product, result);
-    multiply(x1[0], -x0[1], product); add(result, product, result);
-    multiply(x2[0],  x0[1], product); add(result, product, result);
-    multiply(x2[0], -x1[1], product); add(result, product, result);
-}
-
-//==============================================================================
-// returns a sign-accurate result
-// (zero if and only if the true answer is zero or underflows too far)
-static double
-accurate_orientation2d(const double* x0,
-                       const double* x1,
-                       const double* x2)
-{
-    expansion result;
-    expansion_orientation2d(x0, x1, x2, result);
-    return estimate(result);
-}
-
-//==============================================================================
-double
-orientation2d(const double* x0,
-              const double* x1,
-              const double* x2)
-{
-    assert(x0 && x1 && x2);
-    double lower, upper;
-    interval_orientation2d(x0, x1, x2, &lower, &upper);
-    fesetround(FE_TONEAREST);
-    if(upper<0 || lower>0)
-        return 0.5*(lower+upper);
-    else if(lower==upper) // and hence are both equal to zero
-        return 0;
-    else // not an exact zero - we don't know sign for sure
-        return accurate_orientation2d(x0, x1, x2);
-}
-
-//==============================================================================
-// Multiply three numbers together in a way where the rounding mode is
-// respected (upward or downward) no matter the signs of the factors.
-static double
-three_product(double a,
-              double b,
-              double c)
-{
-    if(a>0)
-        return a*(b*c);
-    else
-        return neg(a)*(-b*c);
-}
-
-//==============================================================================
-static double
-simple_orientation3d(const double* x0,
-                     const double* x1,
-                     const double* x2,
-                     const double* x3)
-{
-    return three_product( x0[0], x1[1], x2[2])
-    + three_product(-x0[0], x1[1], x3[2])
-    + three_product(-x0[0], x2[1], x1[2])
-    + three_product( x0[0], x2[1], x3[2])
-    + three_product( x0[0], x3[1], x1[2])
-    + three_product(-x0[0], x3[1], x2[2])
-    
-    + three_product(-x1[0], x0[1], x2[2])
-    + three_product( x1[0], x0[1], x3[2])
-    + three_product( x1[0], x2[1], x0[2])
-    + three_product(-x1[0], x2[1], x3[2])
-    + three_product(-x1[0], x3[1], x0[2])
-    + three_product( x1[0], x3[1], x2[2])
-    
-    + three_product( x2[0], x0[1], x1[2])
-    + three_product(-x2[0], x0[1], x3[2])
-    + three_product(-x2[0], x1[1], x0[2])
-    + three_product( x2[0], x1[1], x3[2])
-    + three_product( x2[0], x3[1], x0[2])
-    + three_product(-x2[0], x3[1], x1[2])
-    
-    + three_product(-x3[0], x0[1], x1[2])
-    + three_product( x3[0], x0[1], x2[2])
-    + three_product( x3[0], x1[1], x0[2])
-    + three_product(-x3[0], x1[1], x2[2])
-    + three_product(-x3[0], x2[1], x0[2])
-    + three_product( x3[0], x2[1], x1[2]);
-}
-
-//==============================================================================
-void
-interval_orientation3d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       double* lower,
-                       double* upper)
-{
-    fesetround(FE_DOWNWARD);
-    *lower=simple_orientation3d(x0, x1, x2, x3);
-    fesetround(FE_UPWARD);
-    *upper=simple_orientation3d(x0, x1, x2, x3);
-    assert(*lower<=*upper);
-}
-
-//==============================================================================
-// calculates the exact result, as an expansion.
-static void
-expansion_orientation3d(const double* x0,
-                        const double* x1,
-                        const double* x2,
-                        const double* x3,
-                        expansion& result)
-{
-    expansion d, p;
-    expansion_orientation2d(x1, x2, x3, d);
-    multiply(x0[2], d, result);
-    
-    expansion_orientation2d(x0, x2, x3, d);
-    multiply(-x1[2], d, p); 
-    add(result, p, result);
-    
-    expansion_orientation2d(x0, x1, x3, d);
-    multiply(x2[2], d, p); 
-    add(result, p, result);
-    
-    expansion_orientation2d(x0, x1, x2, d);
-    multiply(-x3[2], d, p); 
-    add(result, p, result);
-    
-}
-
-//==============================================================================
-// returns a sign-accurate result
-// (zero if and only if the true answer is zero or underflows too far)
-static double
-accurate_orientation3d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3)
-{
-    expansion result;
-    expansion_orientation3d(x0, x1, x2, x3, result);
-    return estimate(result);
-}
-
-//==============================================================================
-double
-orientation3d(const double* x0,
-              const double* x1,
-              const double* x2,
-              const double* x3)
-{
-    assert(x0 && x1 && x2 && x3);
-    double lower, upper;
-    interval_orientation3d(x0, x1, x2, x3, &lower, &upper);
-    fesetround(FE_TONEAREST);
-    if(upper<0 || lower>0)
-        return 0.5*(lower+upper);
-    else if(lower==upper) // and hence exactly zero
-        return 0;
-    else // not an exact zero - we don't know sign for sure
-        return accurate_orientation3d(x0, x1, x2, x3);
-}
-
-//==============================================================================
-static void
-interval_orientation_time3d(const double* x0, int time0,
-                            const double* x1, int time1,
-                            const double* x2, int time2,
-                            const double* x3, int time3,
-                            const double* x4, int time4,
-                            double* lower,
-                            double* upper)
-{
-    double lower1234=0, upper1234=0;
-    if(time0) interval_orientation3d(x1, x2, x3, x4, &lower1234, &upper1234);
-    double lower0234=0, upper0234=0;
-    if(time1) interval_orientation3d(x0, x2, x3, x4, &lower0234, &upper0234);
-    double lower0134=0, upper0134=0;
-    if(time2) interval_orientation3d(x0, x1, x3, x4, &lower0134, &upper0134);
-    double lower0124=0, upper0124=0;
-    if(time3) interval_orientation3d(x0, x1, x2, x4, &lower0124, &upper0124);
-    double lower0123=0, upper0123=0;
-    if(time4) interval_orientation3d(x0, x1, x2, x3, &lower0123, &upper0123);
-    fesetround(FE_DOWNWARD);
-    *lower=-upper1234+lower0234-upper0134+lower0124-upper0123;
-    fesetround(FE_UPWARD);
-    *upper=-lower1234+upper0234-lower0134+upper0124-lower0123;
-    assert(*lower<=*upper);
-}
-
-//==============================================================================
-// calculates the exact result, as an expansion.
-static void
-expansion_orientation_time3d(const double* x0, int time0,
-                             const double* x1, int time1,
-                             const double* x2, int time2,
-                             const double* x3, int time3,
-                             const double* x4, int,
-                             expansion& result)
-{
-    make_zero(result);
-    expansion d;
-    if(time0){
-        expansion_orientation3d(x1, x2, x3, x4, d);
-        negative(d, result);
-    }
-    if(time1){
-        expansion_orientation3d(x0, x2, x3, x4, d);
-        add(result, d, result);
-    }
-    if(time2){
-        expansion_orientation3d(x0, x1, x3, x4, d);
-        subtract(result, d, result);
-    }
-    if(time3){
-        expansion_orientation3d(x0, x1, x2, x4, d);
-        add(result, d, result);
-    }
-    if(time3){
-        expansion_orientation3d(x0, x1, x2, x3, d);
-        subtract(result, d, result);
-    }
-}
-
-//==============================================================================
-// returns a sign-accurate result
-// (zero if and only if the true answer is zero or underflows too far)
-static double
-accurate_orientation_time3d(const double* x0, int time0,
-                            const double* x1, int time1,
-                            const double* x2, int time2,
-                            const double* x3, int time3,
-                            const double* x4, int time4)
-{
-    expansion result;
-    expansion_orientation_time3d(x0, time0, x1, time1, x2, time2,
-                                 x3, time3, x4, time4, result);
-    return estimate(result);
-}
-
-//==============================================================================
-double
-orientation_time3d(const double* x0, int time0,
-                   const double* x1, int time1,
-                   const double* x2, int time2,
-                   const double* x3, int time3,
-                   const double* x4, int time4)
-{
-    assert(x0 && x1 && x2 && x3);
-    double lower, upper;
-    interval_orientation_time3d(x0, time0, x1, time1, x2, time2, x3, time3,
-                                x4, time4, &lower, &upper);
-    fesetround(FE_TONEAREST);
-    if(upper<0 || lower>0)
-        return 0.5*(lower+upper);
-    else if(lower==upper) // and hence exactly zero
-        return 0;
-    else // not an exact zero - we don't know sign for sure
-        return accurate_orientation_time3d(x0, time0, x1, time1, x2, time2,
-                                           x3, time3, x4, time4);
-}
-
-//==============================================================================
-void
-interval_orientation4d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4,
-                       double* lower,
-                       double* upper)
-{
-    double lower1234, upper1234;
-    interval_orientation3d(x1+1, x2+1, x3+1, x4+1, &lower1234, &upper1234);
-    double lower0234, upper0234;
-    interval_orientation3d(x0+1, x2+1, x3+1, x4+1, &lower0234, &upper0234);
-    double lower0134, upper0134;
-    interval_orientation3d(x0+1, x1+1, x3+1, x4+1, &lower0134, &upper0134);
-    double lower0124, upper0124;
-    interval_orientation3d(x0+1, x1+1, x2+1, x4+1, &lower0124, &upper0124);
-    double lower0123, upper0123;
-    interval_orientation3d(x0+1, x1+1, x2+1, x3+1, &lower0123, &upper0123);
-    fesetround(FE_DOWNWARD);
-    *lower= x0[0]*(x0[0]<0 ? upper1234 : lower1234)
-    +neg(x1[0])*(x1[0]>0 ? upper0234 : lower0234)
-    +x2[0]*(x2[0]<0 ? upper0134 : lower0134)
-    +neg(x3[0])*(x3[0]>0 ? upper0124 : lower0124)
-    +x4[0]*(x4[0]<0 ? upper0123 : lower0123);
-    fesetround(FE_UPWARD);
-    *upper= x0[0]*(x0[0]>0 ? upper1234 : lower1234)
-    +neg(x1[0])*(x1[0]<0 ? upper0234 : lower0234)
-    +x2[0]*(x2[0]>0 ? upper0134 : lower0134)
-    +neg(x3[0])*(x3[0]<0 ? upper0124 : lower0124)
-    +x4[0]*(x4[0]>0 ? upper0123 : lower0123);
-    assert(*lower<=*upper);
-}
-
-//==============================================================================
-// calculates the exact result, as an expansion.
-static void
-expansion_orientation4d(const double* x0,
-                        const double* x1,
-                        const double* x2,
-                        const double* x3,
-                        const double* x4,
-                        expansion& result)
-{
-    // do the 2d subsets
-    expansion d012, d013, d014, d023, d024, d034, d123, d124, d134, d234;
-    expansion_orientation2d(x0+2, x1+2, x2+2, d012);
-    expansion_orientation2d(x0+2, x1+2, x3+2, d013);
-    expansion_orientation2d(x0+2, x1+2, x4+2, d014);
-    expansion_orientation2d(x0+2, x2+2, x3+2, d023);
-    expansion_orientation2d(x0+2, x2+2, x4+2, d024);
-    expansion_orientation2d(x0+2, x3+2, x4+2, d034);
-    expansion_orientation2d(x1+2, x2+2, x3+2, d123);
-    expansion_orientation2d(x1+2, x2+2, x4+2, d124);
-    expansion_orientation2d(x1+2, x3+2, x4+2, d134);
-    expansion_orientation2d(x2+2, x3+2, x4+2, d234);
-    
-    // then the 3d subsets
-    expansion d0123, d0124, d0134, d0234, d1234, product;
-    // d0123=x0[1]*d123+(-x1[1])*d023+x2[1]*d013+(-x3[1])*d012,
-    multiply( x0[1], d123, d0123);
-    multiply(-x1[1], d023, product); add(d0123, product, d0123);
-    multiply( x2[1], d013, product); add(d0123, product, d0123);
-    multiply(-x3[1], d012, product); add(d0123, product, d0123);
-    // d0124=x0[1]*d124+(-x1[1])*d024+x2[1]*d014+(-x4[1])*d012,
-    multiply( x0[1], d124, d0124);
-    multiply(-x1[1], d024, product); add(d0124, product, d0124);
-    multiply( x2[1], d014, product); add(d0124, product, d0124);
-    multiply(-x4[1], d012, product); add(d0124, product, d0124);
-    
-    // d0134=x0[1]*d134+(-x1[1])*d034+x3[1]*d014+(-x4[1])*d013,
-    multiply( x0[1], d134, d0134);
-    multiply(-x1[1], d034, product); add(d0134, product, d0134);
-    multiply( x3[1], d014, product); add(d0134, product, d0134);
-    multiply(-x4[1], d013, product); add(d0134, product, d0134);
-    
-    // d0234=x0[1]*d234+(-x2[1])*d034+x3[1]*d024+(-x4[1])*d023,
-    multiply( x0[1], d234, d0234);
-    multiply(-x2[1], d034, product); add(d0234, product, d0234);
-    multiply( x3[1], d024, product); add(d0234, product, d0234);
-    multiply(-x4[1], d023, product); add(d0234, product, d0234);
-    
-    // d1234=x1[1]*d234+(-x2[1])*d134+x3[1]*d124+(-x4[1])*d123;
-    multiply( x1[1], d234, d1234);
-    multiply(-x2[1], d134, product); add(d1234, product, d1234);
-    multiply( x3[1], d124, product); add(d1234, product, d1234);
-    multiply(-x4[1], d123, product); add(d1234, product, d1234);
-    
-    // and finally get the 4d answer
-    // x0[0]*d1234+(-x1[0])*d0234+x2[0]*d0134+(-x3[0])*d0124+x4[0]*d0123;
-    multiply( x0[0], d1234, result);
-    multiply(-x1[0], d0234, product); add(result, product, result);
-    multiply( x2[0], d0134, product); add(result, product, result);
-    multiply(-x3[0], d0124, product); add(result, product, result);
-    multiply( x4[0], d0123, product); add(result, product, result);
-}
-
-//==============================================================================
-// returns a sign-accurate result
-// (zero if and only if the true answer is zero or underflows too far)
-static double
-accurate_orientation4d(const double* x0,
-                       const double* x1,
-                       const double* x2,
-                       const double* x3,
-                       const double* x4)
-{
-    expansion result;
-    expansion_orientation4d(x0, x1, x2, x3, x4, result);
-    return estimate(result);
-}
-
-//==============================================================================
-double
-orientation4d(const double* x0,
-              const double* x1,
-              const double* x2,
-              const double* x3,
-              const double* x4)
-{
-    assert(x0 && x1 && x2 && x3 && x4);
-    double lower, upper;
-    interval_orientation4d(x0, x1, x2, x3, x4, &lower, &upper);
-    fesetround(FE_TONEAREST);
-    if(upper<0 || lower>0)
-        return 0.5*(lower+upper);
-    else if(lower==upper) // and hence exactly zero
-        return 0;
-    else // not an exact zero - we don't know sign for sure
-        return accurate_orientation4d(x0, x1, x2, x3, x4);
-}
diff --git a/extern/eltopo/common/tunicate/sos_intersection.cpp b/extern/eltopo/common/tunicate/sos_intersection.cpp
deleted file mode 100644
index 42fd2d7..0000000
--- a/extern/eltopo/common/tunicate/sos_intersection.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-// Released into the public domain by Robert Bridson, 2009.
-
-#include <cassert>
-#include <tunicate.h>
-
-//==============================================================================
-// Note: it is assumed all arguments are nonzero (have a sign).
-
-namespace {
-    bool
-    same_sign(double a, double b)
-    {
-        return (a<0 && b<0) || (a>0 && b>0);
-    }
-}
-
-//==============================================================================
-int
-sos_simplex_intersection1d(int k,
-                           int pri0, const double* x0,
-                           int pri1, const double* x1,
-                           int pri2, const double* x2,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2)
-{
-    assert(1<=k && k<=2);
-    assert(alpha0 && alpha1 && alpha2);
-    double sum;
-    switch(k){
-        case 1: // point vs. segment
-            *alpha1=-sos_orientation1d(pri0, x0, pri2, x2);
-            *alpha2= sos_orientation1d(pri0, x0, pri1, x1);
-            if(same_sign(*alpha1, *alpha2)){
-                *alpha0=1;
-                sum=*alpha1+*alpha2;
-                *alpha1/=sum;
-                *alpha2/=sum;
-                return 1;
-            }else
-                return 0;
-        case 2: // segment vs. point
-            return sos_simplex_intersection1d(1, pri2, x2,
-                                              pri1, x1,
-                                              pri0, x0,
-                                              alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-int
-sos_simplex_intersection2d(int k,
-                           int pri0, const double* x0,
-                           int pri1, const double* x1,
-                           int pri2, const double* x2,
-                           int pri3, const double* x3,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3)
-{
-    assert(1<=k && k<=3);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. triangle
-            *alpha1=-sos_orientation2d(pri0, x0, pri2, x2, pri3, x3);
-            *alpha2= sos_orientation2d(pri0, x0, pri1, x1, pri3, x3);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-sos_orientation2d(pri0, x0, pri1, x1, pri2, x2);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            *alpha0=1;
-            sum2=*alpha1+*alpha2+*alpha3;
-            *alpha1/=sum2;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            return 1;
-        case 2: // segment vs. segment
-            *alpha0= sos_orientation2d(pri1, x1, pri2, x2, pri3, x3);
-            *alpha1=-sos_orientation2d(pri0, x0, pri2, x2, pri3, x3);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= sos_orientation2d(pri0, x0, pri1, x1, pri3, x3);
-            *alpha3=-sos_orientation2d(pri0, x0, pri1, x1, pri2, x2);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            sum1=*alpha0+*alpha1;
-            *alpha0/=sum1;
-            *alpha1/=sum1;
-            sum2=*alpha2+*alpha3;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            return 1;
-        case 3: // triangle vs. point
-            return sos_simplex_intersection2d(1, pri3, x3,
-                                              pri2, x2,
-                                              pri1, x1,
-                                              pri0, x0,
-                                              alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-int
-sos_simplex_intersection3d(int k,
-                           int pri0, const double* x0,
-                           int pri1, const double* x1,
-                           int pri2, const double* x2,
-                           int pri3, const double* x3,
-                           int pri4, const double* x4,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3,
-                           double* alpha4)
-{
-    assert(1<=k && k<=4);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. tetrahedron
-            *alpha1=-sos_orientation3d(pri0, x0, pri2, x2, pri3, x3, pri4, x4);
-            *alpha2= sos_orientation3d(pri0, x0, pri1, x1, pri3, x3, pri4, x4);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-sos_orientation3d(pri0, x0, pri1, x1, pri2, x2, pri4, x4);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            *alpha4= sos_orientation3d(pri0, x0, pri1, x1, pri2, x2, pri3, x3);
-            if(!same_sign(*alpha1, *alpha4)) return 0;
-            *alpha0=1;
-            sum2=*alpha1+*alpha2+*alpha3+*alpha4;
-            *alpha1/=sum2;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            *alpha4/=sum2;
-            return 1;
-        case 2: // segment vs. triangle
-            *alpha0= sos_orientation3d(pri1, x1, pri2, x2, pri3, x3, pri4, x4);
-            *alpha1=-sos_orientation3d(pri0, x0, pri2, x2, pri3, x3, pri4, x4);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= sos_orientation3d(pri0, x0, pri1, x1, pri3, x3, pri4, x4);
-            *alpha3=-sos_orientation3d(pri0, x0, pri1, x1, pri2, x2, pri4, x4);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= sos_orientation3d(pri0, x0, pri1, x1, pri2, x2, pri3, x3);
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            sum1=*alpha0+*alpha1;
-            *alpha0/=sum1;
-            *alpha1/=sum1;
-            sum2=*alpha2+*alpha3+*alpha4;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            *alpha4/=sum2;
-            return 1;
-        case 3: // triangle vs. segment
-        case 4: // tetrahedron vs. point
-            return sos_simplex_intersection3d(5-k, pri4, x4,
-                                              pri3, x3,
-                                              pri2, x2,
-                                              pri1, x1,
-                                              pri0, x0,
-                                              alpha4, alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
-
-//==============================================================================
-int
-sos_simplex_intersection4d(int k,
-                           int pri0, const double* x0,
-                           int pri1, const double* x1,
-                           int pri2, const double* x2,
-                           int pri3, const double* x3,
-                           int pri4, const double* x4,
-                           int pri5, const double* x5,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3,
-                           double* alpha4,
-                           double* alpha5)
-{
-    assert(1<=k && k<=5);
-    double sum1, sum2;
-    switch(k){
-        case 1: // point vs. pentachoron
-            *alpha1=-sos_orientation4d(pri0,x0,pri2,x2,pri3,x3,pri4,x4,pri5,x5);
-            *alpha2= sos_orientation4d(pri0,x0,pri1,x1,pri3,x3,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha1, *alpha2)) return 0;
-            *alpha3=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha1, *alpha3)) return 0;
-            *alpha4= sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri5,x5);
-            if(!same_sign(*alpha1, *alpha4)) return 0;
-            *alpha5=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri4,x4);
-            if(!same_sign(*alpha1, *alpha5)) return 0;
-            *alpha0=1;
-            sum2=*alpha1+*alpha2+*alpha3+*alpha4+*alpha5;
-            *alpha1/=sum2;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            *alpha4/=sum2;
-            *alpha5/=sum2;
-            return 1;
-        case 2: // segment vs. tetrahedron
-            *alpha0= sos_orientation4d(pri1,x1,pri2,x2,pri3,x3,pri4,x4,pri5,x5);
-            *alpha1=-sos_orientation4d(pri0,x0,pri2,x2,pri3,x3,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= sos_orientation4d(pri0,x0,pri1,x1,pri3,x3,pri4,x4,pri5,x5);
-            *alpha3=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha2, *alpha3)) return 0;
-            *alpha4= sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri5,x5);
-            if(!same_sign(*alpha2, *alpha4)) return 0;
-            *alpha5=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri4,x4);
-            if(!same_sign(*alpha2, *alpha5)) return 0;
-            sum1=*alpha0+*alpha1;
-            *alpha0/=sum1;
-            *alpha1/=sum1;
-            sum2=*alpha2+*alpha3+*alpha4+*alpha5;
-            *alpha2/=sum2;
-            *alpha3/=sum2;
-            *alpha4/=sum2;
-            *alpha5/=sum2;
-            return 1;
-        case 3: // triangle vs. triangle
-            *alpha0= sos_orientation4d(pri1,x1,pri2,x2,pri3,x3,pri4,x4,pri5,x5);
-            *alpha1=-sos_orientation4d(pri0,x0,pri2,x2,pri3,x3,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha0, *alpha1)) return 0;
-            *alpha2= sos_orientation4d(pri0,x0,pri1,x1,pri3,x3,pri4,x4,pri5,x5);
-            if(!same_sign(*alpha0, *alpha2)) return 0;
-            *alpha3=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri4,x4,pri5,x5);
-            *alpha4= sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri5,x5);
-            if(!same_sign(*alpha3, *alpha4)) return 0;
-            *alpha5=-sos_orientation4d(pri0,x0,pri1,x1,pri2,x2,pri3,x3,pri4,x4);
-            if(!same_sign(*alpha3, *alpha5)) return 0;
-            sum1=*alpha0+*alpha1+*alpha2;
-            *alpha0/=sum1;
-            *alpha1/=sum1;
-            *alpha2/=sum1;
-            sum2=*alpha3+*alpha4+*alpha5;
-            *alpha3/=sum2;
-            *alpha4/=sum2;
-            *alpha5/=sum2;
-            return 1;
-        case 4: // tetrahedron vs. segment
-        case 5: // pentachoron vs. point
-            return sos_simplex_intersection4d(6-k, pri5, x5,
-                                              pri4, x4,
-                                              pri3, x3,
-                                              pri2, x2,
-                                              pri1, x1,
-                                              pri0, x0,
-                                              alpha5, alpha4, alpha3, alpha2, alpha1, alpha0);
-        default:
-            return -1; // should never get here
-    }
-}
diff --git a/extern/eltopo/common/tunicate/sos_orientation.cpp b/extern/eltopo/common/tunicate/sos_orientation.cpp
deleted file mode 100644
index 861bc1d..0000000
--- a/extern/eltopo/common/tunicate/sos_orientation.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-// Released into the public domain by Robert Bridson, 2009.
-
-#include <algorithm>
-#include <cassert>
-#include <cmath>
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include <float.h>
-#pragma fenv_access (on)
-#else
-#include <fenv.h>
-#endif
-#include <limits>
-#include <tunicate.h>
-
-// short hand
-static const double dbl_min=std::numeric_limits<double>::min();
-
-//==============================================================================
-double
-sos_orientation1d(int priority0, const double* x0,
-                  int priority1, const double* x1)
-{
-    assert(priority0!=priority1);
-    double d=orientation1d(x0, x1);
-    if(d) return d;
-    // if we have an exact zero, use SoS to decide the sign 
-    if(priority0>priority1) return dbl_min;
-    else return -dbl_min;
-}
-
-//==============================================================================
-namespace {
-    
-    void
-    sort_points(int& priority0, const double*& x0,
-                int& priority1, const double*& x1,
-                double& sign)
-    {
-        if(priority0<priority1){
-            std::swap(priority0, priority1);
-            std::swap(x0, x1);
-            sign=-sign;
-        }
-    }
-    
-} // namespace
-
-//==============================================================================
-double
-sos_orientation2d(int priority0, const double* x0,
-                  int priority1, const double* x1,
-                  int priority2, const double* x2)
-{
-    assert(priority0!=priority1 && priority0!=priority2 && priority1!=priority2);
-    double d=orientation2d(x0, x1, x2);
-    if(d) return d;
-    // If we have an exact zero, use SoS to decide the sign.
-    // Sort by priority first, keeping track of sign of permutation.
-    double sign=1;
-    sort_points(priority0, x0, priority1, x1, sign);
-    sort_points(priority0, x0, priority2, x2, sign);
-    sort_points(priority1, x1, priority2, x2, sign);
-    // Evaluate SoS terms one by one, looking for the first nonzero.
-    
-    // row 0
-    d= orientation1d(x1+1, x2+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation1d(x0+1, x2+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 1
-    d=-orientation1d(x1, x2);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    return -sign*dbl_min;
-}
-
-//==============================================================================
-double
-sos_orientation3d(int priority0, const double* x0,
-                  int priority1, const double* x1,
-                  int priority2, const double* x2,
-                  int priority3, const double* x3)
-{
-    assert(priority0!=priority1 && priority0!=priority2 && priority0!=priority3);
-    assert(priority1!=priority2 && priority1!=priority3);
-    assert(priority2!=priority3);
-    double d=orientation3d(x0, x1, x2, x3);
-    if(d) return d;
-    // If we have an exact zero, use SoS to decide the sign.
-    // Sort by priority first, keeping track of sign of permutation.
-    double sign=1;
-    sort_points(priority0, x0, priority2, x2, sign);
-    sort_points(priority1, x1, priority3, x3, sign);
-    sort_points(priority0, x0, priority1, x1, sign);
-    sort_points(priority2, x2, priority3, x3, sign);
-    sort_points(priority1, x1, priority2, x2, sign);
-    // Evaluate SoS terms one by one, looking for the first nonzero.
-    // (We skip a few that must be zero if the preceding are zero, and stop
-    // at the first term which must always be nonzero.)
-    
-    // row 0
-    d= orientation2d(x1+1, x2+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(x0+1, x2+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(x0+1, x1+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(x0+1, x1+1, x2+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 1
-    double c0[2]={x0[0], x0[2]}, c1[2]={x1[0], x1[2]},
-    c2[2]={x2[0], x2[2]}, c3[2]={x3[0], x3[2]};
-    d=-orientation2d(c1, c2, c3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation1d(x2+2, x3+2);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(x1+2, x3+2);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c0, c2, c3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(x0+2, x3+2);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 2
-    d= orientation2d(x1, x2, x3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(x2+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation1d(x1+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(x2, x3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    return -sign*dbl_min;
-}
-
-//==============================================================================
-double
-sos_orientation4d(int priority0, const double* x0,
-                  int priority1, const double* x1,
-                  int priority2, const double* x2,
-                  int priority3, const double* x3,
-                  int priority4, const double* x4)
-{
-    assert(priority0!=priority1 && priority0!=priority2 && priority0!=priority3);
-    assert(priority0!=priority4 && priority1!=priority2 && priority1!=priority3);
-    assert(priority1!=priority4 && priority2!=priority3 && priority2!=priority4);
-    assert(priority3!=priority4);
-    double d=orientation4d(x0, x1, x2, x3, x4);
-    if(d) return d;
-    // If we have an exact zero, use SoS to decide the sign.
-    // Sort by priority first, keeping track of sign of permutation.
-    // (we could do a better job with this, but this is easy to code...)
-    double sign=1;
-    sort_points(priority0, x0, priority1, x1, sign);
-    sort_points(priority2, x2, priority3, x3, sign);
-    sort_points(priority0, x0, priority2, x2, sign);
-    sort_points(priority1, x1, priority3, x3, sign);
-    sort_points(priority1, x1, priority2, x2, sign);
-    sort_points(priority0, x0, priority4, x4, sign);
-    sort_points(priority1, x1, priority4, x4, sign);
-    sort_points(priority2, x2, priority4, x4, sign);
-    sort_points(priority3, x3, priority4, x4, sign);
-    // Evaluate SoS terms one by one, looking for the first nonzero.
-    // (We skip a few that must be zero if the preceding are zero, and stop
-    // at the first term which must always be nonzero.)
-    
-    // row 0
-    d= orientation3d(x1+1, x2+1, x3+1, x4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(x0+1, x2+1, x3+1, x4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(x0+1, x1+1, x3+1, x4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(x0+1, x1+1, x2+1, x4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(x0+1, x1+1, x2+1, x3+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 1
-    double c0[3]={x0[0], x0[2], x0[3]},
-    c1[3]={x1[0], x1[2], x1[3]},
-    c2[3]={x2[0], x2[2], x2[3]},
-    c3[3]={x3[0], x3[2], x3[3]},
-    c4[3]={x4[0], x4[2], x4[3]};
-    d=-orientation3d(c1, c2, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c2+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c1+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c1+1, c2+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(c0, c2, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c0+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c0+1, c2+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(c0, c1, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c0+1, c1+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(c0, c1, c2, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(c0, c1, c2, c3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 2
-    c0[1]=x0[1]; c1[1]=x1[1]; c2[1]=x2[1]; c3[1]=x3[1]; c4[1]=x4[1];
-    d= orientation3d(c1, c2, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c2+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c1+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c1+1, c2+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    double b0[2]={x0[0], x0[3]},
-    b1[2]={x1[0], x1[3]},
-    b2[2]={x2[0], x2[3]},
-    b3[2]={x3[0], x3[3]},
-    b4[2]={x4[0], x4[3]};
-    d=-orientation2d(b2, b3, b4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation1d(b3+1, b4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(b2+1, b4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(b1, b3, b4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation1d(b1+1, b4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(b1, b2, b4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(c0, c2, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c0+1, c3+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(c0+1, c2+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(b0, b3, b4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation1d(b0+1, b4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(c0, c1, c3, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation2d(c0+1, c1+1, c4+1);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation2d(b0, b1, b4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d=-orientation3d(c0, c1, c2, c4);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    d= orientation3d(c0, c1, c2, c3);
-    if(d<0) return sign*dbl_min; else if(d>0) return -sign*dbl_min;
-    
-    // row 3
-    return sign*sos_orientation3d(priority1, x1, priority2, x2,
-                                  priority3, x3, priority4, x4);
-}
diff --git a/extern/eltopo/common/tunicate/tunicate.h b/extern/eltopo/common/tunicate/tunicate.h
deleted file mode 100644
index 967cf2d..0000000
--- a/extern/eltopo/common/tunicate/tunicate.h
+++ /dev/null
@@ -1,260 +0,0 @@
-#ifndef TUNICATE_H
-#define TUNICATE_H
-
-// Released into the public domain by Robert Bridson, 2009.
-
-// Warning: this code hasn't been formally proven to be correct, and
-// almost certainly *will* fail in cases of overflow or underflow.
-
-// Note: all routines (except in 1d) internally change the floating point
-// rounding mode, and set it to the usual "round-to-nearest" on exit. If the
-// calling code relies on it being something else, you must arrange this
-// yourself.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-    //==============================================================================
-    // The orientation routines take, in n dimensions, n+1 vectors
-    // describing the vertices of a simplex, and return the associated
-    // determinant (related to the signed volume of the simplex).
-    // The sign of this determinant gives the orientation of the simplex.
-    // The sign is determined exactly, with zero indicating a degenerate simplex.
-    // The magnitude of the result is only approximate.
-    
-    // This one is a little silly, but useful in generality.
-    // It returns the length of interval x0-x1.
-    double
-    orientation1d(const double* x0,
-                  const double* x1);
-    
-    // This returns twice the signed area of the triangle x0-x1-x2.
-    double
-    orientation2d(const double* x0,
-                  const double* x1,
-                  const double* x2);
-    
-    void
-    interval_orientation2d(const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           double* lower,
-                           double* upper);
-    
-    // This returns six times the signed volume of the tetrahedron x0-x1-x2-x3.
-    double
-    orientation3d(const double* x0,
-                  const double* x1,
-                  const double* x2,
-                  const double* x3);
-    
-    void
-    interval_orientation3d(const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           const double* x3,
-                           double* lower,
-                           double* upper);
-    
-    // This returns 24 times the signed hypervolume of the simplex x0-x1-x2-x3-x4.
-    // x0, ..., x4 are 3d vectors; time0, ..., time4 should be either 0 or 1,
-    // providing the fourth coordinate.
-    double
-    orientation_time3d(const double* x0, int time0,
-                       const double* x1, int time1,
-                       const double* x2, int time2,
-                       const double* x3, int time3,
-                       const double* x4, int time4);
-    
-    // This returns 24 times the signed hypervolume of the simplex x0-x1-x2-x3-x4.
-    double
-    orientation4d(const double* x0,
-                  const double* x1,
-                  const double* x2,
-                  const double* x3,
-                  const double* x4);
-    
-    //==============================================================================
-    // The sos_orientation routines are similar to the orientation routines, only
-    // are guaranteed to never return zero: Edelsbrunner and Mucke's Simulation
-    // of Simplicity (SoS) procudure is used to perturb the results to positive or
-    // negative in a consistent way (returning plus or minus the minimum double
-    // instead of zero). The crucial requirement is that a distinct integer
-    // priority be given to each vertex, say the index in a mesh. Each coordinate
-    // of each vertex is symbolically perturbed by an infinitesimal positibe
-    // amount, with the perturbation of the i'th coordinate of the j'th point
-    // being unassailably larger than that of i'th coordinates points less than j,
-    // and the i+1'st or greater coordinates of all points.
-    
-    // This one is a little silly, but useful in generality.
-    // It returns the length of interval x0-x1.
-    double
-    sos_orientation1d(int priority0, const double* x0,
-                      int priority1, const double* x1);
-    
-    // This returns twice the signed area of the triangle x0-x1-x2.
-    double
-    sos_orientation2d(int priority0, const double* x0,
-                      int priority1, const double* x1,
-                      int priority2, const double* x2);
-    
-    // This returns six times the signed volume of the tetrahedron x0-x1-x2-x3.
-    double
-    sos_orientation3d(int priority0, const double* x0,
-                      int priority1, const double* x1,
-                      int priority2, const double* x2,
-                      int priority3, const double* x3);
-    
-    // This returns 24 times the signed hypervolume of the simplex x0-x1-x2-x3-x4.
-    double
-    sos_orientation4d(int priority0, const double* x0,
-                      int priority1, const double* x1,
-                      int priority2, const double* x2,
-                      int priority3, const double* x3,
-                      int priority4, const double* x4);
-    
-    //==============================================================================
-    // Simplex-simplex intersection tests, in n dimensions, take n+2 points as the
-    // vertices of the two simplices along with an integer k (1<=k<=n+1) specifying
-    // the number of vertices in the first simplex: the first simplex uses vertices
-    // 0, 1, ..., k-1, and the second simplex uses the rest. The routines return 0
-    // for no intersection, and 1 for intersection (including degenerate cases).
-    // If there is an intersection, approximations to the barycentric coordinates
-    // (alpha) of the intersection are also determined, with the sum of the first k
-    // alpha values approximately equal to 1, the sum of the remainder also
-    // approximately equal to 1, and the point of intersection approximately equal
-    // to the associated weighted sum of either simplice's vertices. If there is no
-    // intersection, some or all of the alpha values may be overwritten with
-    // intermediate values of no use.
-    
-    int
-    simplex_intersection1d(int k,
-                           const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2);
-    
-    int
-    simplex_intersection2d(int k,
-                           const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           const double* x3,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3);
-    
-    int
-    simplex_intersection3d(int k,
-                           const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           const double* x3,
-                           const double* x4,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3,
-                           double* alpha4);
-    
-    int
-    simplex_intersection_time3d(int k,
-                                const double* x0, int time0,
-                                const double* x1, int time1,
-                                const double* x2, int time2,
-                                const double* x3, int time3,
-                                const double* x4, int time4,
-                                const double* x5, int time5,
-                                double* alpha0, 
-                                double* alpha1, 
-                                double* alpha2,
-                                double* alpha3,
-                                double* alpha4,
-                                double* alpha5);
-    
-    int
-    simplex_intersection4d(int k,
-                           const double* x0,
-                           const double* x1,
-                           const double* x2,
-                           const double* x3,
-                           const double* x4,
-                           const double* x5,
-                           double* alpha0, 
-                           double* alpha1, 
-                           double* alpha2,
-                           double* alpha3,
-                           double* alpha4,
-                           double* alpha5);
-    
-    //==============================================================================
-    // The SoS simplex intersection tests, in n dimensions, take n+2 points as the
-    // vertices of the two simplices along with an integer k (1<=k<=n+1) specifying
-    // the number of vertices in the first simplex: the first simplex uses vertices
-    // 0, 1, ..., k-1, and the second simplex uses the rest. The routines return 0
-    // for no intersection, and 1 for intersection---with SoS perturbation as above
-    // to handle degenerate situations. If there is an intersection, approximations
-    // to the barycentric coordinates (alpha) of the intersection are also
-    // determined, with the sum of the first k alpha values approximately equal
-    // to 1, the sum of the remainder also approximately equal to 1, and the
-    // point of intersection approximately equal to the associated weighted sum of
-    // either simplice's vertices. If there is no intersection, some or all of
-    // the alpha values may be overwritten with intermediate values of no use.
-    
-    int
-    sos_simplex_intersection1d(int k,
-                               int priority0, const double* x0,
-                               int priority1, const double* x1,
-                               int priority2, const double* x2,
-                               double* alpha0, 
-                               double* alpha1, 
-                               double* alpha2);
-    
-    int
-    sos_simplex_intersection2d(int k,
-                               int priority0, const double* x0,
-                               int priority1, const double* x1,
-                               int priority2, const double* x2,
-                               int priority3, const double* x3,
-                               double* alpha0, 
-                               double* alpha1, 
-                               double* alpha2,
-                               double* alpha3);
-    
-    int
-    sos_simplex_intersection3d(int k,
-                               int priority0, const double* x0,
-                               int priority1, const double* x1,
-                               int priority2, const double* x2,
-                               int priority3, const double* x3,
-                               int priority4, const double* x4,
-                               double* alpha0, 
-                               double* alpha1, 
-                               double* alpha2,
-                               double* alpha3,
-                               double* alpha4);
-    
-    int
-    sos_simplex_intersection4d(int k,
-                               int priority0, const double* x0,
-                               int priority1, const double* x1,
-                               int priority2, const double* x2,
-                               int priority3, const double* x3,
-                               int priority4, const double* x4,
-                               int priority5, const double* x5,
-                               double* alpha0, 
-                               double* alpha1, 
-                               double* alpha2,
-                               double* alpha3,
-                               double* alpha4,
-                               double* alpha5);
-    
-#ifdef __cplusplus
-} // end of extern "C" block
-#endif
-
-#endif
diff --git a/extern/eltopo/common/util.h b/extern/eltopo/common/util.h
deleted file mode 100644
index c9cad1c..0000000
--- a/extern/eltopo/common/util.h
+++ /dev/null
@@ -1,510 +0,0 @@
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <algorithm>
-#include <array3.h>
-#include <climits>
-#include <cmath>
-#include <iostream>
-#include <vector>
-
-#ifndef M_PI
-const double M_PI = 3.1415926535897932384626433832795;
-#endif
-
-#ifdef WIN32
-#undef min
-#undef max
-#endif
-
-using std::min;
-using std::max;
-using std::swap;
-
-template<class T>
-inline T sqr(const T& x)
-{ return x*x; }
-
-template<class T>
-inline T cube(const T& x)
-{ return x*x*x; }
-
-template<class T>
-inline T min(T a1, T a2, T a3)
-{ return min(a1, min(a2, a3)); }
-
-template<class T>
-inline T min(T a1, T a2, T a3, T a4)
-{ return min(min(a1, a2), min(a3, a4)); }
-
-template<class T>
-inline T min(T a1, T a2, T a3, T a4, T a5)
-{ return min(min(a1, a2), min(a3, a4), a5); }
-
-template<class T>
-inline T min(T a1, T a2, T a3, T a4, T a5, T a6)
-{ return min(min(a1, a2), min(a3, a4), min(a5, a6)); }
-
-template<class T>
-inline T max(T a1, T a2, T a3)
-{ return max(a1, max(a2, a3)); }
-
-template<class T>
-inline T max(T a1, T a2, T a3, T a4)
-{ return max(max(a1, a2), max(a3, a4)); }
-
-template<class T>
-inline T max(T a1, T a2, T a3, T a4, T a5)
-{ return max(max(a1, a2), max(a3, a4),  a5); }
-
-template<class T>
-inline T max(T a1, T a2, T a3, T a4, T a5, T a6)
-{ return max(max(a1, a2), max(a3, a4),  max(a5, a6)); }
-
-template<class T>
-inline void minmax(T a1, T a2, T& amin, T& amax)
-{
-    if(a1<a2){
-        amin=a1;
-        amax=a2;
-    }else{
-        amin=a2;
-        amax=a1;
-    }
-}
-
-template<class T>
-inline void minmax(T a1, T a2, T a3, T& amin, T& amax)
-{
-    if(a1<a2){
-        if(a1<a3){
-            amin=a1;
-            if(a2<a3) amax=a3;
-            else amax=a2;
-        }else{
-            amin=a3;
-            if(a1<a2) amax=a2;
-            else amax=a1;
-        }
-    }else{
-        if(a2<a3){
-            amin=a2;
-            if(a1<a3) amax=a3;
-            else amax=a1;
-        }else{
-            amin=a3;
-            amax=a1;
-        }
-    }
-}
-
-template<class T>
-inline void minmax(T a1, T a2, T a3, T a4, T& amin, T& amax)
-{
-    if(a1<a2){
-        if(a3<a4){
-            amin=min(a1,a3);
-            amax=max(a2,a4);
-        }else{
-            amin=min(a1,a4);
-            amax=max(a2,a3);
-        }
-    }else{
-        if(a3<a4){
-            amin=min(a2,a3);
-            amax=max(a1,a4);
-        }else{
-            amin=min(a2,a4);
-            amax=max(a1,a3);
-        }
-    }
-}
-
-template<class T>
-inline void minmax(T a1, T a2, T a3, T a4, T a5, T& amin, T& amax)
-{
-    //@@@ the logic could be shortcircuited a lot!
-    amin=min(a1,a2,a3,a4,a5);
-    amax=max(a1,a2,a3,a4,a5);
-}
-
-template<class T>
-inline void minmax(T a1, T a2, T a3, T a4, T a5, T a6, T& amin, T& amax)
-{
-    //@@@ the logic could be shortcircuited a lot!
-    amin=min(a1,a2,a3,a4,a5,a6);
-    amax=max(a1,a2,a3,a4,a5,a6);
-}
-
-template<class T>
-inline void update_minmax(T a1, T& amin, T& amax)
-{
-    if(a1<amin) amin=a1;
-    else if(a1>amax) amax=a1;
-}
-
-template<class T>
-inline void sort(T &a, T &b, T &c)
-{
-    T temp;
-    if(a<b){
-        if(a<c){
-            if(c<b){ // a<c<b
-                temp=c;c=b;b=temp;
-            } // else: a<b<c
-        }else{ // c<a<b
-            temp=c;c=b;b=a;a=temp;
-        }
-    }else{
-        if(b<c){
-            if(a<c){ //b<a<c
-                temp=b;b=a;a=temp;
-            }else{ // b<c<a
-                temp=b;b=c;c=a;a=temp;
-            }
-        }else{ // c<b<a
-            temp=c;c=a;a=temp;
-        }
-    }
-}
-
-template<class T>
-inline T clamp(T a, T lower, T upper)
-{
-    if(a<lower) return lower;
-    else if(a>upper) return upper;
-    else return a;
-}
-
-// only makes sense with T=float or double
-template<class T>
-inline T smooth_step(T r)
-{
-    if(r<0) return 0;
-    else if(r>1) return 1;
-    return r*r*r*(10+r*(-15+r*6));
-}
-
-// only makes sense with T=float or double
-template<class T>
-inline T smooth_step(T r, T r_lower, T r_upper, T value_lower, T value_upper)
-{ return value_lower + smooth_step((r-r_lower)/(r_upper-r_lower)) * (value_upper-value_lower); }
-
-// only makes sense with T=float or double
-template<class T>
-inline T ramp(T r)
-{ return smooth_step((r+1)/2)*2-1; }
-
-#ifdef WIN32
-inline int lround(double x)
-{
-    if(x>0)
-        return (x-floor(x)<0.5) ? (int)floor(x) : (int)ceil(x);
-    else
-        return (x-floor(x)<=0.5) ? (int)floor(x) : (int)ceil(x);
-}
-
-inline double remainder(double x, double y)
-{
-    return x-std::floor(x/y+0.5)*y;
-}
-#endif
-
-inline unsigned int round_up_to_power_of_two(unsigned int n)
-{
-    int exponent=0;
-    --n;
-    while(n){
-        ++exponent;
-        n>>=1;
-    }
-    return 1<<exponent;
-}
-
-inline unsigned int round_down_to_power_of_two(unsigned int n)
-{
-    int exponent=0;
-    while(n>1){
-        ++exponent;
-        n>>=1;
-    }
-    return 1<<exponent;
-}
-
-// Transforms even the sequence 0,1,2,3,... into reasonably good random numbers 
-// Challenge: improve on this in speed and "randomness"!
-// This seems to pass several statistical tests, and is a bijective map (of 32-bit unsigned ints)
-
-inline unsigned int randhash(unsigned int seed)
-{
-    unsigned int i=(seed^12345391u)*2654435769u;
-    i^=(i<<6)^(i>>26);
-    i*=2654435769u;
-    i+=(i<<5)^(i>>12);
-    return i;
-}
-
-// the inverse of randhash
-inline unsigned int unhash(unsigned int h)
-{
-    h*=340573321u;
-    h^=(h>>16);
-    h*=340573321u;
-    h^=(h>>16);
-    h*=340573321u;
-    h^=0xA3C59AC3u;
-    return h;
-}
-
-// returns repeatable stateless pseudo-random number in [0,1]
-inline double randhashd(unsigned int seed)
-{ return randhash(seed)/(double)UINT_MAX; }
-inline float randhashf(unsigned int seed)
-{ return randhash(seed)/(float)UINT_MAX; }
-
-// returns repeatable stateless pseudo-random number in [a,b]
-inline double randhashd(unsigned int seed, double a, double b)
-{ return (b-a)*randhash(seed)/(double)UINT_MAX + a; }
-inline float randhashf(unsigned int seed, float a, float b)
-{ return ( (b-a)*randhash(seed)/(float)UINT_MAX + a); }
-
-inline int intlog2(int x)
-{
-    int exp=-1;
-    while(x){
-        x>>=1;
-        ++exp;
-    }
-    return exp;
-}
-
-template<class T>
-inline void get_barycentric(T x, ssize_t& i, T& f, ssize_t i_low, ssize_t i_high)
-{
-    T s=std::floor(x);
-    i=(int)s;
-    if(i<i_low){
-        i=i_low;
-        f=0;
-    }else if(i>i_high-2){
-        i=i_high-2;
-        f=1;
-    }else
-        f=(T)(x-s);
-}
-
-template<class S, class T>
-inline S lerp(const S& value0, const S& value1, T f)
-{ return (1-f)*value0 + f*value1; }
-
-template<class S, class T>
-inline S bilerp(const S& v00, const S& v10, 
-                const S& v01, const S& v11, 
-                T fx, T fy)
-{ 
-    return lerp(lerp(v00, v10, fx),
-                lerp(v01, v11, fx), 
-                fy);
-}
-
-template<class S, class T>
-inline S trilerp(const S& v000, const S& v100,
-                 const S& v010, const S& v110,
-                 const S& v001, const S& v101,  
-                 const S& v011, const S& v111,
-                 T fx, T fy, T fz) 
-{
-    return lerp(bilerp(v000, v100, v010, v110, fx, fy),
-                bilerp(v001, v101, v011, v111, fx, fy),
-                fz);
-}
-
-template<class S, class T>
-inline S quadlerp(const S& v0000, const S& v1000,
-                  const S& v0100, const S& v1100,
-                  const S& v0010, const S& v1010,  
-                  const S& v0110, const S& v1110,
-                  const S& v0001, const S& v1001,
-                  const S& v0101, const S& v1101,
-                  const S& v0011, const S& v1011,  
-                  const S& v0111, const S& v1111,
-                  T fx, T fy, T fz, T ft) 
-{
-    return lerp(trilerp(v0000, v1000, v0100, v1100, v0010, v1010, v0110, v1110, fx, fy, fz),
-                trilerp(v0001, v1001, v0101, v1101, v0011, v1011, v0111, v1111, fx, fy, fz),
-                ft);
-}
-
-// f should be between 0 and 1, with f=0.5 corresponding to balanced weighting between w0 and w2
-template<class T>
-inline void quadratic_bspline_weights(T f, T& w0, T& w1, T& w2)
-{
-    w0=T(0.5)*sqr(f-1);
-    w1=T(0.75)-sqr(f-T(0.5));;
-    w2=T(0.5)*sqr(f);
-}
-
-// f should be between 0 and 1
-template<class T>
-inline void cubic_interp_weights(T f, T& wneg1, T& w0, T& w1, T& w2)
-{
-    T f2(f*f), f3(f2*f);
-    wneg1=-T(1./3)*f+T(1./2)*f2-T(1./6)*f3;
-    w0=1-f2+T(1./2)*(f3-f);
-    w1=f+T(1./2)*(f2-f3);
-    w2=T(1./6)*(f3-f);
-}
-
-template<class S, class T>
-inline S cubic_interp(const S& value_neg1, const S& value0, const S& value1, const S& value2, T f)
-{
-    T wneg1, w0, w1, w2;
-    cubic_interp_weights(f, wneg1, w0, w1, w2);
-    return wneg1*value_neg1 + w0*value0 + w1*value1 + w2*value2;
-}
-
-template<class S, class T>
-inline S bicubic_interp(const S& v00, const S& v10, const S& v20, const S& v30,
-                        const S& v01, const S& v11, const S& v21, const S& v31,
-                        const S& v02, const S& v12, const S& v22, const S& v32, 
-                        const S& v03, const S& v13, const S& v23, const S& v33, 
-                        T fx, T fy )
-{
-    return cubic_interp( cubic_interp( v00, v10, v20, v30, fx ),
-                        cubic_interp( v01, v11, v21, v31, fx ),
-                        cubic_interp( v02, v12, v22, v32, fx ),
-                        cubic_interp( v03, v13, v23, v33, fx ),
-                        fy );   
-}
-
-template<class S, class T>
-inline S tricubic_interp( const Array3<S, Array1<S> >& v, ssize_t i, ssize_t j, ssize_t k, T fx, T fy, T fz )
-{
-    return cubic_interp( bicubic_interp( v(i+0,j+0,k+0), v(i+1,j+0,k+0), v(i+2,j+0,k+0), v(i+3,j+0,k+0), 
-                                        v(i+0,j+1,k+0), v(i+1,j+1,k+0), v(i+2,j+1,k+0), v(i+3,j+1,k+0), 
-                                        v(i+0,j+2,k+0), v(i+1,j+2,k+0), v(i+2,j+2,k+0), v(i+3,j+2,k+0), 
-                                        v(i+0,j+3,k+0), v(i+1,j+3,k+0), v(i+2,j+3,k+0), v(i+3,j+3,k+0), fx, fy ),
-                        bicubic_interp( v(i+0,j+0,k+1), v(i+1,j+0,k+1), v(i+2,j+0,k+1), v(i+3,j+0,k+1), 
-                                       v(i+0,j+1,k+1), v(i+1,j+1,k+1), v(i+2,j+1,k+1), v(i+3,j+1,k+1), 
-                                       v(i+0,j+2,k+1), v(i+1,j+2,k+1), v(i+2,j+2,k+1), v(i+3,j+2,k+1), 
-                                       v(i+0,j+3,k+1), v(i+1,j+3,k+1), v(i+2,j+3,k+1), v(i+3,j+3,k+1), fx, fy ),
-                        bicubic_interp( v(i+0,j+0,k+2), v(i+1,j+0,k+2), v(i+2,j+0,k+2), v(i+3,j+0,k+2), 
-                                       v(i+0,j+1,k+2), v(i+1,j+1,k+2), v(i+2,j+1,k+2), v(i+3,j+1,k+2), 
-                                       v(i+0,j+2,k+2), v(i+1,j+2,k+2), v(i+2,j+2,k+2), v(i+3,j+2,k+2), 
-                                       v(i+0,j+3,k+2), v(i+1,j+3,k+2), v(i+2,j+3,k+2), v(i+3,j+3,k+2), fx, fy ),
-                        bicubic_interp( v(i+0,j+0,k+3), v(i+1,j+0,k+3), v(i+2,j+0,k+3), v(i+3,j+0,k+3), 
-                                       v(i+0,j+1,k+3), v(i+1,j+1,k+3), v(i+2,j+1,k+3), v(i+3,j+1,k+3), 
-                                       v(i+0,j+2,k+3), v(i+1,j+2,k+3), v(i+2,j+2,k+3), v(i+3,j+2,k+3), 
-                                       v(i+0,j+3,k+3), v(i+1,j+3,k+3), v(i+2,j+3,k+3), v(i+3,j+3,k+3), fx, fy ),                       
-                        fz );
-}
-
-
-
-template<class T>
-void zero(std::vector<T>& v)
-{ for(int i=(int)v.size()-1; i>=0; --i) v[i]=0; }
-
-template<class T>
-T abs_max(const std::vector<T>& v)
-{
-    T m=0;
-    for(int i=(int)v.size()-1; i>=0; --i){
-        if(std::fabs(v[i])>m)
-            m=std::fabs(v[i]);
-    }
-    return m;
-}
-
-template<class T>
-bool contains(const std::vector<T>& a, T e)
-{
-    for(unsigned int i=0; i<a.size(); ++i)
-        if(a[i]==e) return true;
-    return false;
-}
-
-template<class T>
-void add_unique(std::vector<T>& a, T e)
-{
-    for(unsigned int i=0; i<a.size(); ++i)
-        if(a[i]==e) return;
-    a.push_back(e);
-}
-
-template<class T>
-void insert(std::vector<T>& a, unsigned int index, T e)
-{
-    a.push_back(a.back());
-    for(unsigned int i=(unsigned int)a.size()-1; i>index; --i)
-        a[i]=a[i-1];
-    a[index]=e;
-}
-
-template<class T>
-void erase(std::vector<T>& a, unsigned int index)
-{
-    for(unsigned int i=index; i<a.size()-1; ++i)
-        a[i]=a[i+1];
-    a.pop_back();
-}
-
-template<class T>
-void erase_swap(std::vector<T>& a, unsigned int index)
-{
-    for(unsigned int i=index; i<a.size()-1; ++i)
-        swap(a[i], a[i+1]);
-    a.pop_back();
-}
-
-template<class T>
-void erase_unordered(std::vector<T>& a, unsigned int index)
-{
-    a[index]=a.back();
-    a.pop_back();
-}
-
-template<class T>
-void erase_unordered_swap(std::vector<T>& a, unsigned int index)
-{
-    swap(a[index], a.back());
-    a.pop_back();
-}
-
-template<class T>
-void find_and_erase_unordered(std::vector<T>& a, const T& doomed_element)
-{
-    for(unsigned int i=0; i<a.size(); ++i)
-        if(a[i]==doomed_element){
-            erase_unordered(a, i);
-            return;
-        }
-}
-
-template<class T>
-void replace_once(std::vector<T>& a, const T& old_element, const T& new_element)
-{
-    for(unsigned int i=0; i<a.size(); ++i)
-        if(a[i]==old_element){
-            a[i]=new_element;
-            return;
-        }
-}
-
-template<class T>
-void write_matlab(std::ostream& output, const std::vector<T>& a, const char *variable_name, bool column_vector=true, int significant_digits=18)
-{
-    output<<variable_name<<"=[";
-    std::streamsize old_precision=output.precision();
-    output.precision(significant_digits);
-    for(unsigned int i=0; i<a.size(); ++i){
-        output<<a[i]<<" ";
-    }
-    output<<"]";
-    if(column_vector)
-        output<<"'";
-    output<<";"<<std::endl;
-    output.precision(old_precision);
-}
-
-#endif
diff --git a/extern/eltopo/common/vec.h b/extern/eltopo/common/vec.h
deleted file mode 100644
index 1802358..0000000
--- a/extern/eltopo/common/vec.h
+++ /dev/null
@@ -1,505 +0,0 @@
-#ifndef VEC_H
-#define VEC_H
-
-#include <cassert>
-#include <cmath>
-#include <hashtable.h>
-#include <iostream>
-#include <util.h>
-
-// Defines a thin wrapper around fixed size C-style arrays, using template parameters,
-// which is useful for dealing with vectors of different dimensions.
-// For example, float[3] is equivalent to Vec<3,float>.
-// Entries in the vector are accessed with the overloaded [] operator, so
-// for example if x is a Vec<3,float>, then the middle entry is x[1].
-// For convenience, there are a number of typedefs for abbreviation:
-//   Vec<3,float> -> Vec3f
-//   Vec<2,int>   -> Vec2i
-// and so on.
-// Arithmetic operators are appropriately overloaded, and functions are defined
-// for additional operations (such as dot-products, norms, cross-products, etc.)
-
-template<unsigned int N, class T>
-struct Vec
-{
-    T v[N];
-    
-    Vec<N,T>(void)
-    {}
-    
-    explicit Vec<N,T>(T value_for_all)
-    { for(unsigned int i=0; i<N; ++i) v[i]=value_for_all; }
-    
-    template<class S>
-    explicit Vec<N,T>(const S *source)
-    { for(unsigned int i=0; i<N; ++i) v[i]=(T)source[i]; }
-    
-    template <class S>
-    explicit Vec<N,T>(const Vec<N,S>& source)
-    { for(unsigned int i=0; i<N; ++i) v[i]=(T)source[i]; }
-    
-    Vec<N,T>(T v0, T v1)
-    {
-        assert(N==2);
-        v[0]=v0; v[1]=v1;
-    }
-    
-    Vec<N,T>(T v0, T v1, T v2)
-    {
-        assert(N==3);
-        v[0]=v0; v[1]=v1; v[2]=v2;
-    }
-    
-    Vec<N,T>(T v0, T v1, T v2, T v3)
-    {
-        assert(N==4);
-        v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3;
-    }
-    
-    Vec<N,T>(T v0, T v1, T v2, T v3, T v4)
-    {
-        assert(N==5);
-        v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3; v[4]=v4;
-    }
-    
-    Vec<N,T>(T v0, T v1, T v2, T v3, T v4, T v5)
-    {
-        assert(N==6);
-        v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3; v[4]=v4; v[5]=v5;
-    }
-    
-    T &operator[](int index)
-    {
-        assert(0<=index && (unsigned int)index<N);
-        return v[index];
-    }
-    
-    const T &operator[](int index) const
-    {
-        assert(0<=index && (unsigned int)index<N);
-        return v[index];
-    }
-    
-    bool nonzero(void) const
-    {
-        for(unsigned int i=0; i<N; ++i) if(v[i]) return true;
-        return false;
-    }
-    
-    Vec<N,T> operator+=(const Vec<N,T> &w)
-    {
-        for(unsigned int i=0; i<N; ++i) v[i]+=w[i];
-        return *this;
-    }
-    
-    Vec<N,T> operator+(const Vec<N,T> &w) const
-    {
-        Vec<N,T> sum(*this);
-        sum+=w;
-        return sum;
-    }
-    
-    Vec<N,T> operator-=(const Vec<N,T> &w)
-    {
-        for(unsigned int i=0; i<N; ++i) v[i]-=w[i];
-        return *this;
-    }
-    
-    Vec<N,T> operator-(void) const // unary minus
-    {
-        Vec<N,T> negative;
-        for(unsigned int i=0; i<N; ++i) negative.v[i]=-v[i];
-        return negative;
-    }
-    
-    Vec<N,T> operator-(const Vec<N,T> &w) const // (binary) subtraction
-    {
-        Vec<N,T> diff(*this);
-        diff-=w;
-        return diff;
-    }
-    
-    Vec<N,T> operator*=(T a)
-    {
-        for(unsigned int i=0; i<N; ++i) v[i]*=a;
-        return *this;
-    }
-    
-    Vec<N,T> operator*(T a) const
-    {
-        Vec<N,T> w(*this);
-        w*=a;
-        return w;
-    }
-    
-    Vec<N,T> operator*=(const Vec<N,T> &w)
-    {
-        for(unsigned int i=0; i<N; ++i) v[i]*=w.v[i];
-        return *this;
-    }
-    
-    Vec<N,T> operator*(const Vec<N,T> &w) const
-    {
-        Vec<N,T> componentwise_product;
-        for(unsigned int i=0; i<N; ++i) componentwise_product[i]=v[i]*w.v[i];
-        return componentwise_product;
-    }
-    
-    Vec<N,T> operator/=(T a)
-    {
-        for(unsigned int i=0; i<N; ++i) v[i]/=a;
-        return *this;
-    }
-    
-    Vec<N,T> operator/(T a) const
-    {
-        Vec<N,T> w(*this);
-        w/=a;
-        return w;
-    }
-};
-
-typedef Vec<2,double>         Vec2d;
-typedef Vec<2,float>          Vec2f;
-typedef Vec<2,int>            Vec2i;
-typedef Vec<2,unsigned int>   Vec2ui;
-typedef Vec<2,short>          Vec2s;
-typedef Vec<2,unsigned short> Vec2us;
-typedef Vec<2,char>           Vec2c;
-typedef Vec<2,unsigned char>  Vec2uc;
-typedef Vec<2,size_t>         Vec2st;
-
-typedef Vec<3,double>         Vec3d;
-typedef Vec<3,float>          Vec3f;
-typedef Vec<3,int>            Vec3i;
-typedef Vec<3,unsigned int>   Vec3ui;
-typedef Vec<3,short>          Vec3s;
-typedef Vec<3,unsigned short> Vec3us;
-typedef Vec<3,char>           Vec3c;
-typedef Vec<3,unsigned char>  Vec3uc;
-typedef Vec<3,size_t>         Vec3st;
-
-typedef Vec<4,double>         Vec4d;
-typedef Vec<4,float>          Vec4f;
-typedef Vec<4,int>            Vec4i;
-typedef Vec<4,unsigned int>   Vec4ui;
-typedef Vec<4,short>          Vec4s;
-typedef Vec<4,unsigned short> Vec4us;
-typedef Vec<4,char>           Vec4c;
-typedef Vec<4,unsigned char>  Vec4uc;
-typedef Vec<4,size_t>         Vec4st;
-
-typedef Vec<6,double>         Vec6d;
-typedef Vec<6,float>          Vec6f;
-typedef Vec<6,unsigned int>   Vec6ui;
-typedef Vec<6,int>            Vec6i;
-typedef Vec<6,short>          Vec6s;
-typedef Vec<6,unsigned short> Vec6us;
-typedef Vec<6,char>           Vec6c;
-typedef Vec<6,unsigned char>  Vec6uc;
-
-
-template<unsigned int N, class T>
-T mag2(const Vec<N,T> &a)
-{
-    T l=sqr(a.v[0]);
-    for(unsigned int i=1; i<N; ++i) l+=sqr(a.v[i]);
-    return l;
-}
-
-template<unsigned int N, class T>
-T mag(const Vec<N,T> &a)
-{ return (T)sqrt(mag2(a)); }
-
-template<unsigned int N, class T> 
-inline T dist2(const Vec<N,T> &a, const Vec<N,T> &b)
-{ 
-    T d=sqr(a.v[0]-b.v[0]);
-    for(unsigned int i=1; i<N; ++i) d+=sqr(a.v[i]-b.v[i]);
-    return d;
-}
-
-template<unsigned int N, class T> 
-inline T dist(const Vec<N,T> &a, const Vec<N,T> &b)
-{ return std::sqrt(dist2(a,b)); }
-
-template<unsigned int N, class T> 
-inline void normalize(Vec<N,T> &a)
-{ a/=mag(a); }
-
-template<unsigned int N, class T> 
-inline Vec<N,T> normalized(const Vec<N,T> &a)
-{ return a/mag(a); }
-
-template<unsigned int N, class T> 
-inline T infnorm(const Vec<N,T> &a)
-{
-    T d=std::fabs(a.v[0]);
-    for(unsigned int i=1; i<N; ++i) d=max(std::fabs(a.v[i]),d);
-    return d;
-}
-
-template<unsigned int N, class T>
-void zero(Vec<N,T> &a)
-{ 
-    for(unsigned int i=0; i<N; ++i)
-        a.v[i] = 0;
-}
-
-template<unsigned int N, class T>
-std::ostream &operator<<(std::ostream &out, const Vec<N,T> &v)
-{
-    out<<v.v[0];
-    for(unsigned int i=1; i<N; ++i)
-        out<<' '<<v.v[i];
-    return out;
-}
-
-template<unsigned int N, class T>
-std::istream &operator>>(std::istream &in, Vec<N,T> &v)
-{
-    in>>v.v[0];
-    for(unsigned int i=1; i<N; ++i)
-        in>>v.v[i];
-    return in;
-}
-
-template<unsigned int N, class T> 
-inline bool operator==(const Vec<N,T> &a, const Vec<N,T> &b)
-{ 
-    bool t = (a.v[0] == b.v[0]);
-    unsigned int i=1;
-    while(i<N && t) {
-        t = t && (a.v[i]==b.v[i]); 
-        ++i;
-    }
-    return t;
-}
-
-template<unsigned int N, class T> 
-inline bool operator!=(const Vec<N,T> &a, const Vec<N,T> &b)
-{ 
-    bool t = (a.v[0] != b.v[0]);
-    unsigned int i=1;
-    while(i<N && !t) {
-        t = t || (a.v[i]!=b.v[i]); 
-        ++i;
-    }
-    return t;
-}
-
-template<unsigned int N, class T>
-inline Vec<N,T> operator*(T a, const Vec<N,T> &v)
-{
-    Vec<N,T> w(v);
-    w*=a;
-    return w;
-}
-
-template<unsigned int N, class T>
-inline T min(const Vec<N,T> &a)
-{
-    T m=a.v[0];
-    for(unsigned int i=1; i<N; ++i) if(a.v[i]<m) m=a.v[i];
-    return m;
-}
-
-template<unsigned int N, class T>
-inline Vec<N,T> min_union(const Vec<N,T> &a, const Vec<N,T> &b)
-{
-    Vec<N,T> m;
-    for(unsigned int i=0; i<N; ++i) (a.v[i] < b.v[i]) ? m.v[i]=a.v[i] : m.v[i]=b.v[i];
-    return m;
-}
-
-template<unsigned int N, class T>
-inline Vec<N,T> max_union(const Vec<N,T> &a, const Vec<N,T> &b)
-{
-    Vec<N,T> m;
-    for(unsigned int i=0; i<N; ++i) (a.v[i] > b.v[i]) ? m.v[i]=a.v[i] : m.v[i]=b.v[i];
-    return m;
-}
-
-template<unsigned int N, class T>
-inline T max(const Vec<N,T> &a)
-{
-    T m=a.v[0];
-    for(unsigned int i=1; i<N; ++i) if(a.v[i]>m) m=a.v[i];
-    return m;
-}
-
-template<unsigned int N, class T>
-inline T dot(const Vec<N,T> &a, const Vec<N,T> &b)
-{
-    T d=a.v[0]*b.v[0];
-    for(unsigned int i=1; i<N; ++i) d+=a.v[i]*b.v[i];
-    return d;
-}
-
-template<class T> 
-inline Vec<2,T> rotate(const Vec<2,T>& a, const T& angle) 
-{
-    T c = cos(angle);
-    T s = sin(angle);
-    return Vec<2,T>(c*a[0] - s*a[1],s*a[0] + c*a[1]); // counter-clockwise rotation
-}
-
-// Rotate the point (x,y,z) around the vector (u,v,w)
-template<class T> 
-inline Vec<3,T> rotate( const Vec<3,T>& x, const T& angle, const Vec<3,T>& u )
-{
-    T ux = u[0]*x[0];
-    T uy = u[0]*x[1];
-    T uz = u[0]*x[2];
-    T vx = u[1]*x[0];
-    T vy = u[1]*x[1];
-    T vz = u[1]*x[2];
-    T wx = u[2]*x[0];
-    T wy = u[2]*x[1];
-    T wz = u[2]*x[2];
-    
-    T sa = (T) sin(angle);
-    T ca = (T) cos(angle);
-    
-    return Vec<3,T> ( u[0] * (ux+vy+wz) + (x[0]*(u[1]*u[1]+u[2]*u[2])-u[0]*(vy+wz))*ca+(-wy+vz)*sa,
-                     u[1] * (ux+vy+wz) + (x[1]*(u[0]*u[0]+u[2]*u[2])-u[1]*(ux+wz))*ca+(wx-uz)*sa,
-                     u[2] * (ux+vy+wz) + (x[2]*(u[0]*u[0]+u[1]*u[1])-u[2]*(ux+vy))*ca+(-vx+uy)*sa );
-    
-}
-
-template<class T>
-inline Vec<2,T> perp(const Vec<2,T> &a)
-{ return Vec<2,T>(-a.v[1], a.v[0]); } // counter-clockwise rotation by 90 degrees
-
-template<class T>
-inline T cross(const Vec<2,T> &a, const Vec<2,T> &b)
-{ return a.v[0]*b.v[1]-a.v[1]*b.v[0]; }
-
-template<class T>
-inline Vec<3,T> cross(const Vec<3,T> &a, const Vec<3,T> &b)
-{ return Vec<3,T>(a.v[1]*b.v[2]-a.v[2]*b.v[1], a.v[2]*b.v[0]-a.v[0]*b.v[2], a.v[0]*b.v[1]-a.v[1]*b.v[0]); }
-
-template<class T>
-inline T triple(const Vec<3,T> &a, const Vec<3,T> &b, const Vec<3,T> &c)
-{ return a.v[0]*(b.v[1]*c.v[2]-b.v[2]*c.v[1])
-    +a.v[1]*(b.v[2]*c.v[0]-b.v[0]*c.v[2])
-    +a.v[2]*(b.v[0]*c.v[1]-b.v[1]*c.v[0]); }
-
-template<unsigned int N, class T>
-inline unsigned int hash(const Vec<N,T> &a)
-{
-    unsigned int h=a.v[0];
-    for(unsigned int i=1; i<N; ++i)
-        h=hash(h ^ a.v[i]);
-    return h;
-}
-
-template<unsigned int N, class T>
-inline void assign(const Vec<N,T> &a, T &a0, T &a1)
-{ 
-    assert(N==2);
-    a0=a.v[0]; a1=a.v[1];
-}
-
-template<unsigned int N, class T>
-inline void assign(const Vec<N,T> &a, T &a0, T &a1, T &a2)
-{ 
-    assert(N==3);
-    a0=a.v[0]; a1=a.v[1]; a2=a.v[2];
-}
-
-template<unsigned int N, class T>
-inline void assign(const Vec<N,T> &a, T &a0, T &a1, T &a2, T &a3)
-{ 
-    assert(N==4);
-    a0=a.v[0]; a1=a.v[1]; a2=a.v[2]; a3=a.v[3];
-}
-
-template<unsigned int N, class T>
-inline void assign(const Vec<N,T> &a, T &a0, T &a1, T &a2, T &a3, T &a4, T &a5)
-{ 
-    assert(N==6);
-    a0=a.v[0]; a1=a.v[1]; a2=a.v[2]; a3=a.v[3]; a4=a.v[4]; a5=a.v[5];
-}
-
-template<unsigned int N, class T>
-inline Vec<N,int> round(const Vec<N,T> &a)
-{ 
-    Vec<N,int> rounded;
-    for(unsigned int i=0; i<N; ++i)
-        rounded.v[i]=lround(a.v[i]);
-    return rounded; 
-}
-
-template<unsigned int N, class T>
-inline Vec<N,int> floor(const Vec<N,T> &a)
-{ 
-    Vec<N,int> rounded;
-    for(unsigned int i=0; i<N; ++i)
-        rounded.v[i]=(int)floor(a.v[i]);
-    return rounded; 
-}
-
-template<unsigned int N, class T>
-inline Vec<N,int> ceil(const Vec<N,T> &a)
-{ 
-    Vec<N,int> rounded;
-    for(unsigned int i=0; i<N; ++i)
-        rounded.v[i]=(int)ceil(a.v[i]);
-    return rounded; 
-}
-
-template<unsigned int N, class T>
-inline Vec<N,T> fabs(const Vec<N,T> &a)
-{ 
-    Vec<N,T> result;
-    for(unsigned int i=0; i<N; ++i)
-        result.v[i]=(T)fabs(a.v[i]);
-    return result; 
-}
-
-template<unsigned int N, class T>
-inline void minmax(const Vec<N,T> &x0, const Vec<N,T> &x1, Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i)
-        minmax(x0.v[i], x1.v[i], xmin.v[i], xmax.v[i]);
-}
-
-template<unsigned int N, class T>
-inline void minmax(const Vec<N,T> &x0, const Vec<N,T> &x1, const Vec<N,T> &x2, Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i)
-        minmax(x0.v[i], x1.v[i], x2.v[i], xmin.v[i], xmax.v[i]);
-}
-
-template<unsigned int N, class T>
-inline void minmax(const Vec<N,T> &x0, const Vec<N,T> &x1, const Vec<N,T> &x2, const Vec<N,T> &x3,
-                   Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i)
-        minmax(x0.v[i], x1.v[i], x2.v[i], x3.v[i], xmin.v[i], xmax.v[i]);
-}
-
-template<unsigned int N, class T>
-inline void minmax(const Vec<N,T> &x0, const Vec<N,T> &x1, const Vec<N,T> &x2, const Vec<N,T> &x3, const Vec<N,T> &x4,
-                   Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i)
-        minmax(x0.v[i], x1.v[i], x2.v[i], x3.v[i], x4.v[i], xmin.v[i], xmax.v[i]);
-}
-
-template<unsigned int N, class T>
-inline void minmax(const Vec<N,T> &x0, const Vec<N,T> &x1, const Vec<N,T> &x2, const Vec<N,T> &x3, const Vec<N,T> &x4,
-                   const Vec<N,T> &x5, Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i)
-        minmax(x0.v[i], x1.v[i], x2.v[i], x3.v[i], x4.v[i], x5.v[i], xmin.v[i], xmax.v[i]);
-}
-
-template<unsigned int N, class T>
-inline void update_minmax(const Vec<N,T> &x, Vec<N,T> &xmin, Vec<N,T> &xmax)
-{
-    for(unsigned int i=0; i<N; ++i) update_minmax(x[i], xmin[i], xmax[i]);
-}
-
-#endif
diff --git a/extern/eltopo/common/vector_math.h b/extern/eltopo/common/vector_math.h
deleted file mode 100644
index 1ced278..0000000
--- a/extern/eltopo/common/vector_math.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef VECTOR_MATH_H
-#define VECTOR_MATH_H
-
-#include <vector>
-#include <algorithm>
-#include "blas_wrapper.h"
-
-template<class T>
-T sum(std::vector<T>& data) {
-    T result = 0;
-    for(unsigned int i = 0; i < data.size(); ++i)
-        result += data[i];
-    return result;
-}
-
-template<class T>
-void copy(const std::vector<T> & src, std::vector<T>& dest) {
-    std::copy(src.begin(), src.end(), dest.begin());
-}
-
-template<class T>
-T dot(const std::vector<T>& a, const std::vector<T>& b) {
-    return BLAS::dot((int)a.size(), &a[0], &b[0]);
-}
-
-template<class T>
-void scale(T factor, std::vector<T>& data) {
-    BLAS::scale((int)data.size(), factor, &data[0]);
-}
-
-template<class T> 
-void add_scaled(T alpha, const std::vector<T>& x, std::vector<T>& y) { // y = y + alpha*x
-    BLAS::add_scaled((int)x.size(), alpha, &x[0], &y[0]);
-}
-
-#endif
diff --git a/extern/eltopo/common/wallclocktime.cpp b/extern/eltopo/common/wallclocktime.cpp
deleted file mode 100644
index 149b95b..0000000
--- a/extern/eltopo/common/wallclocktime.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifdef WIN32
-
-#include <Windows.h>
-
-static unsigned __int64 timer_frequency;
-static unsigned __int64 base_time;
-
-void set_time_base(void)
-{
-    QueryPerformanceFrequency((LARGE_INTEGER*)&timer_frequency);
-    QueryPerformanceCounter((LARGE_INTEGER*)&base_time);
-}
-
-double get_time_in_seconds(void)
-{
-    unsigned __int64 newtime;
-    QueryPerformanceCounter((LARGE_INTEGER*)&newtime);
-    return (double)(newtime - base_time) / (double)timer_frequency;
-}
-
-#else
-
-#include <wallclocktime.h>
-#include <sys/time.h>
-
-static long base_seconds=0;
-
-void set_time_base(void)
-{
-    struct timeval tv;
-    struct timezone tz;
-    gettimeofday(&tv, &tz);
-    base_seconds=tv.tv_sec;
-}
-
-double get_time_in_seconds(void)
-{
-    struct timeval tv;
-    struct timezone tz;
-    gettimeofday(&tv, &tz);
-    return 0.000001*tv.tv_usec + (tv.tv_sec-base_seconds);
-}
-
-#endif
diff --git a/extern/eltopo/common/wallclocktime.h b/extern/eltopo/common/wallclocktime.h
deleted file mode 100644
index da5869b..0000000
--- a/extern/eltopo/common/wallclocktime.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef WALLCLOCKTIME_H
-#define WALLCLOCKTIME_H
-
-void set_time_base(void);
-double get_time_in_seconds(void);
-
-#endif
diff --git a/extern/eltopo/eltopo-capi.cpp b/extern/eltopo/eltopo-capi.cpp
deleted file mode 100644
index 0da39cf..0000000
--- a/extern/eltopo/eltopo-capi.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "common/vec.h"
-#include "ccd_wrapper.h"
-#include "cfloat"
-#include "../../source/blender/blenlib/BLI_memarena.h"
-// --------------------------------------------------------------------------------------------------
-// Continuous collision detection
-// --------------------------------------------------------------------------------------------------
-
-MemArena *arena = NULL;
-
-/*overload default new operator*/
-void *operator new(size_t size) {
-	if (arena)
-		return BLI_memarena_alloc(arena, size);
-	else
-		return malloc(size);
-}
-
-void operator delete(void *ptr) {
-	if (!arena)
-		free(ptr);
-}
-
-extern "C" void eltopo_start_memarena(void)
-{
-	arena = BLI_memarena_new(1<<18, "eltopo arena");	
-}
-
-extern "C" void eltopo_end_memarena(void)
-{
-	if (arena) {
-		BLI_memarena_free(arena);
-		arena = NULL;
-	}
-}
diff --git a/extern/eltopo/eltopo-capi.h b/extern/eltopo/eltopo-capi.h
deleted file mode 100644
index f127efd..0000000
--- a/extern/eltopo/eltopo-capi.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _cplusplus
-extern "C" {
-
-#endif
-
-void eltopo_start_memarena(void);
-void eltopo_end_memarena(void);
-
-#ifdef _cplusplus
-}
-#endif
diff --git a/extern/eltopo/eltopo3d/Makefile b/extern/eltopo/eltopo3d/Makefile
deleted file mode 100644
index da62a61..0000000
--- a/extern/eltopo/eltopo3d/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# --------------------
-#
-# Makefile for El Topo.
-#
-# Create a file called Makefile.local_defs before running make.  See Makefile.example_defs for suggestions.
-#
-# --------------------
-
-# This is for GNU make; other versions of make may not run correctly.
-
-# Local machine settings
-include Makefile.local_defs
-
-# --------------------
-# El Topo library
-# --------------------
-
-LIBRARY = libeltopo
-include Makefile.inc
-
-# how to compile each file
-.SUFFIXES:
-obj/%.o:
-	$(CC) -c $(RELEASE_FLAGS) $(INCLUDE_PATH) -o $@ $<
-obj_debug/%.o:
-	$(CC) -c $(DEBUG_FLAGS) $(INCLUDE_PATH) -o $@ $<
-
-.PHONY: release
-release: $(LIBRARY)_release.a 
-
-.PHONY: debug
-debug: $(LIBRARY)_debug.a 
-
-# cleaning up
-.PHONY: clean
-clean:
-	-rm -f obj/*.o obj/depend $(LIBRARY)_debug.a obj_debug/*.o obj_debug/depend $(LIBRARY)_release.a *core
-
-# dependencies are automatically generated
-.PHONY: depend
-depend:
-	-mkdir obj
-	-rm -f obj/depend
-	$(foreach srcfile,$(LIB_SRC),$(DEPEND) -MM $(srcfile) -MT $(patsubst %.cpp,obj/%.o,$(notdir $(srcfile))) $(INCLUDE_PATH) >> obj/depend;)
-	-mkdir obj_debug
-	-rm -f obj_debug/depend
-	$(foreach srcfile,$(LIB_SRC),$(DEPEND) -MM $(srcfile) -MT $(patsubst %.cpp,obj_debug/%.o,$(notdir $(srcfile))) $(INCLUDE_PATH) >> obj_debug/depend;)
-
--include obj/depend
--include obj_debug/depend
diff --git a/extern/eltopo/eltopo3d/Makefile.example_defs b/extern/eltopo/eltopo3d/Makefile.example_defs
deleted file mode 100644
index 839ad23..0000000
--- a/extern/eltopo/eltopo3d/Makefile.example_defs
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# This for use with Makefile
-#
-# NOTE: Rename this file to "Makefile.local_defs" after specifying your machine settings
-#
-
-INCLUDE_PATH = -I. -I../common -I../common/newsparse -I../common/meshes -I../common/tunicate
-
-# local machine settings
-
-# For example, on Linux on a PC this will likely work:
-
-DEPEND = g++ -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI -m32
-CC = g++ -Wall -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI -fPIC -m32
-RELEASE_FLAGS = -O3 -funroll-loops
-DEBUG_FLAGS = -g
-LINK = g++
-
-# sub in your local lapack and blas paths here:
-LINK_LIBS = -lGL -lGLU -lglut -llapack -lblas 
-
-# On Mac OS X (on a G5), this probably will work:
-
-#DEPEND = g++ -DNO_GUI
-#CC = g++ -Wall -DNO_GUI -fPIC 
-#RELEASE_FLAGS = -fast # add -mcpu=7450 for a G4, or -mcpu=750 for a G3 since -fast enables 970(G5) instructions by default
-#DEBUG_FLAGS = -g
-#LINK = g++
-#LINK_LIBS = -framework OpenGL -framework GLUT -framework vecLib 
diff --git a/extern/eltopo/eltopo3d/Makefile.inc b/extern/eltopo/eltopo3d/Makefile.inc
deleted file mode 100644
index f686e67..0000000
--- a/extern/eltopo/eltopo3d/Makefile.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# Source files
-LIB_SRC = accelerationgrid.cpp broadphasegrid.cpp collisionpipeline.cpp \
-          dynamicsurface.cpp edgecollapser.cpp edgeflipper.cpp edgesplitter.cpp \
-          eltopo.cpp impactzonesolver.cpp meshmerger.cpp meshpincher.cpp meshsmoother.cpp \
-          meshrenderer.cpp nondestructivetrimesh.cpp subdivisionscheme.cpp surftrack.cpp \
-          trianglequality.cpp \
-
-# Common
-LIB_SRC += ../common/collisionqueries.cpp ../common/wallclocktime.cpp \
-           ../common/newsparse/sparse_matrix.cpp \
-           ../common/newsparse/krylov_solvers.cpp \
-
-LIB_SRC += ../common/tunicate/expansion.cpp ../common/tunicate/intersection.cpp ../common/tunicate/neg.cpp \
-           ../common/tunicate/orientation.cpp 
-
-LIB_SRC += ../common/ccd_wrapper.cpp ../common/cubic_ccd_wrapper.cpp ../common/collisionqueries.cpp
-
-LIB_SRC += ../common/lexer.cpp ../common/newparser.cpp 
-
-# object files
-LIB_RELEASE_OBJ = $(patsubst %.cpp,obj/%.o,$(notdir $(LIB_SRC)))
-LIB_DEBUG_OBJ = $(patsubst %.cpp,obj_debug/%.o,$(notdir $(LIB_SRC)))
-
-# Build the library
-$(LIBRARY)_release.a: $(LIB_RELEASE_OBJ)
-	ar r $@ $(LIB_RELEASE_OBJ)
-	ranlib $@
-		  
-$(LIBRARY)_debug.a: $(LIB_DEBUG_OBJ)
-	ar r $@ $(LIB_DEBUG_OBJ)
-	ranlib $@
-
diff --git a/extern/eltopo/eltopo3d/Makefile.local_defs b/extern/eltopo/eltopo3d/Makefile.local_defs
deleted file mode 100644
index 6d5ed6c..0000000
--- a/extern/eltopo/eltopo3d/Makefile.local_defs
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# This for use with Makefile
-#
-# NOTE: Rename this file to "Makefile.local_defs" after specifying your machine settings
-#
-
-INCLUDE_PATH = -I. -I../common -I../common/newsparse -I../common/meshes -I../common/tunicate
-
-# local machine settings
-
-# For example, on Linux on a PC this will likely work:
-
-DEPEND = g++ -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DUSE_GUI
-CC = g++ -Wall -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DUSE_GUI
-RELEASE_FLAGS = -O3 -funroll-loops
-DEBUG_FLAGS = -g
-LINK = g++
-
-# sub in your local lapack and blas paths here:
-LINK_LIBS = -lGL -lGLU -lglut -llapack -lblas 
-
-# On Mac OS X (on a G5), this probably will work:
-
-#DEPEND = g++ -DNO_GUI
-#CC = g++ -Wall -DNO_GUI
-#RELEASE_FLAGS = -fast # add -mcpu=7450 for a G4, or -mcpu=750 for a G3 since -fast enables 970(G5) instructions by default
-#DEBUG_FLAGS = -g
-#LINK = g++
-#LINK_LIBS = -framework OpenGL -framework GLUT -framework vecLib 
diff --git a/extern/eltopo/eltopo3d/accelerationgrid.cpp b/extern/eltopo/eltopo3d/accelerationgrid.cpp
deleted file mode 100644
index ea18f04..0000000
--- a/extern/eltopo/eltopo3d/accelerationgrid.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-// ---------------------------------------------------------
-//
-//  accelerationgrid.cpp
-//  Tyson Brochu 2008
-//  
-//  A grid-based collision test culling structure.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <accelerationgrid.h>
-
-#include <array3.h>
-#include <limits>
-#include <util.h>
-#include <vec.h>
-#include <vector>
-#include <wallclocktime.h>
-
-// ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Default constructor
-///
-// --------------------------------------------------------
-
-AccelerationGrid::AccelerationGrid() :
-m_cells(0,0,0),
-m_elementidxs(0),
-m_elementxmins(0),
-m_elementxmaxs(0),
-m_elementquery(0),
-m_lastquery(0),
-m_gridxmin(0,0,0),
-m_gridxmax(0,0,0),
-m_cellsize(0,0,0),
-m_invcellsize(0,0,0)
-{
-    Vec3st dims(1,1,1);
-    Vec3d xmin(0,0,0), xmax(1,1,1);
-    set(dims, xmin, xmax);
-}
-
-// --------------------------------------------------------
-///
-/// Calls assignment operator, which does a deep copy.
-///
-// --------------------------------------------------------
-
-AccelerationGrid::AccelerationGrid(AccelerationGrid& other) :
-m_cells(0,0,0),
-m_elementidxs(0),
-m_elementxmins(0),
-m_elementxmaxs(0),
-m_elementquery(0),
-m_lastquery(0),
-m_gridxmin(0,0,0),
-m_gridxmax(0,0,0),
-m_cellsize(0,0,0),
-m_invcellsize(0,0,0)
-{
-    
-    // Call assignment operator
-    *this = other;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Deep copy.
-///
-// --------------------------------------------------------
-
-AccelerationGrid& AccelerationGrid::operator=( const AccelerationGrid& other)
-{
-    m_cells.resize( other.m_cells.ni, other.m_cells.nj, other.m_cells.nk, 0 );
-    for ( size_t i = 0; i < m_cells.a.size(); ++i )
-    {
-        if (other.m_cells.a[i])
-        {
-            m_cells.a[i] = new std::vector<size_t>();
-            *(m_cells.a[i]) = *(other.m_cells.a[i]);
-        }
-    }
-    
-    m_elementidxs = other.m_elementidxs;
-    m_elementxmins = other.m_elementxmins;
-    m_elementxmaxs = other.m_elementxmaxs;
-    m_elementquery = other.m_elementquery;
-    m_lastquery = other.m_lastquery;
-    m_gridxmin = other.m_gridxmin;
-    m_gridxmax = other.m_gridxmax;
-    m_cellsize = other.m_cellsize;
-    m_invcellsize = other.m_invcellsize;   
-    
-    return *this;
-}
-
-// --------------------------------------------------------
-///
-/// Destructor: clear all grids
-///
-// --------------------------------------------------------
-
-AccelerationGrid::~AccelerationGrid()
-{
-    clear();
-}
-
-// --------------------------------------------------------
-///
-/// Define the grid, given the extents of the domain and the number of desired voxels along each dimension
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::set( const Vec3st& dims, const Vec3d& xmin, const Vec3d& xmax )
-{
-    m_gridxmin = xmin;
-    m_gridxmax = xmax;
-    
-    for(unsigned int i = 0; i < 3; i++)
-    {
-        m_cellsize[i] = (m_gridxmax[i]-m_gridxmin[i])/dims[i];
-        m_invcellsize[i] = 1.0 / m_cellsize[i];
-    }
-    
-    clear();
-    
-    m_cells.resize(dims[0], dims[1], dims[2]);    
-    for(size_t i = 0; i < m_cells.a.size(); i++)
-    {
-        m_cells.a[i] = 0;
-    }   
-}
-
-// --------------------------------------------------------
-///
-/// Generate a set of voxel indices from a pair of AABB extents
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::boundstoindices(const Vec3d& xmin, const Vec3d& xmax, Vec3i& xmini, Vec3i& xmaxi)
-{
-    
-    xmini[0] = (int) floor((xmin[0] - m_gridxmin[0]) * m_invcellsize[0]);
-    xmini[1] = (int) floor((xmin[1] - m_gridxmin[1]) * m_invcellsize[1]);
-    xmini[2] = (int) floor((xmin[2] - m_gridxmin[2]) * m_invcellsize[2]);
-    
-    xmaxi[0] = (int) floor((xmax[0] - m_gridxmin[0]) * m_invcellsize[0]);
-    xmaxi[1] = (int) floor((xmax[1] - m_gridxmin[1]) * m_invcellsize[1]);
-    xmaxi[2] = (int) floor((xmax[2] - m_gridxmin[2]) * m_invcellsize[2]);
-    
-    if(xmini[0] < 0) xmini[0] = 0;
-    if(xmini[1] < 0) xmini[1] = 0;
-    if(xmini[2] < 0) xmini[2] = 0;
-    
-    if(xmaxi[0] < 0) xmaxi[0] = 0;
-    if(xmaxi[1] < 0) xmaxi[1] = 0;
-    if(xmaxi[2] < 0) xmaxi[2] = 0;
-    
-    assert( m_cells.ni < INT_MAX );
-    assert( m_cells.nj < INT_MAX );
-    assert( m_cells.nk < INT_MAX );
-    
-    if(xmaxi[0] >= (int)m_cells.ni) xmaxi[0] = (int)m_cells.ni-1;
-    if(xmaxi[1] >= (int)m_cells.nj) xmaxi[1] = (int)m_cells.nj-1;
-    if(xmaxi[2] >= (int)m_cells.nk) xmaxi[2] = (int)m_cells.nk-1;
-    
-    if(xmini[0] >= (int)m_cells.ni) xmini[0] = (int)m_cells.ni-1;
-    if(xmini[1] >= (int)m_cells.nj) xmini[1] = (int)m_cells.nj-1;
-    if(xmini[2] >= (int)m_cells.nk) xmini[2] = (int)m_cells.nk-1;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Add an object with the specified index and AABB to the grid
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::add_element(size_t idx, const Vec3d& xmin, const Vec3d& xmax)
-{
-    if(m_elementidxs.size() <= idx)
-    {
-        m_elementidxs.resize(idx+1);
-        m_elementxmins.resize(idx+1);
-        m_elementxmaxs.resize(idx+1);
-        m_elementquery.resize(idx+1);
-    }
-    
-    m_elementxmins[idx] = xmin;
-    m_elementxmaxs[idx] = xmax;
-    m_elementquery[idx] = 0;
-    
-    Vec3i xmini, xmaxi;
-    boundstoindices(xmin, xmax, xmini, xmaxi);
-    
-    for(int i = xmini[0]; i <= xmaxi[0]; i++)
-    {
-        for(int j = xmini[1]; j <= xmaxi[1]; j++)
-        {
-            for(int k = xmini[2]; k <= xmaxi[2]; k++)
-            {
-                std::vector<size_t>*& cell = m_cells(i, j, k);
-                if(!cell)
-                    cell = new std::vector<size_t>();
-                
-                cell->push_back(idx);
-                m_elementidxs[idx].push_back(Vec3st(i, j, k));
-            }
-        }
-    }
-}
-
-// --------------------------------------------------------
-///
-/// Remove an object with the specified index from the grid
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::remove_element(size_t idx)
-{
-    
-    if ( idx >= m_elementidxs.size() ) { return; }
-    
-    for(size_t c = 0; c < m_elementidxs[idx].size(); c++)
-    {
-        Vec3st cellcoords = m_elementidxs[idx][c];
-        std::vector<size_t>* cell = m_cells(cellcoords[0], cellcoords[1], cellcoords[2]);
-        
-        std::vector<size_t>::iterator it = cell->begin();
-        while(*it != idx)
-        {
-            it++;
-        }
-        
-        cell->erase(it);
-    }
-    
-    m_elementidxs[idx].clear();
-}
-
-// --------------------------------------------------------
-///
-/// Reset the specified object's AABB
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::update_element(size_t idx, const Vec3d& xmin, const Vec3d& xmax)
-{
-    remove_element(idx);
-    add_element(idx, xmin, xmax);
-}
-
-// --------------------------------------------------------
-///
-/// Remove all elements from the grid
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::clear()
-{
-    for(size_t i = 0; i < m_cells.a.size(); i++)
-    {
-        std::vector<size_t>*& cell = m_cells.a[i];  
-        if(cell)
-        {
-            delete cell;
-            cell = 0;
-        }
-    }
-    
-    m_elementidxs.clear();
-    m_elementxmins.clear();
-    m_elementxmaxs.clear();
-    m_elementquery.clear();
-    m_lastquery = 0;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Return the set of elements which have AABBs overlapping the query AABB.
-///
-// --------------------------------------------------------
-
-void AccelerationGrid::find_overlapping_elements( const Vec3d& xmin, const Vec3d& xmax, std::vector<size_t>& results ) 
-{
-    if(m_lastquery == std::numeric_limits<unsigned int>::max())
-    {
-        std::vector<unsigned int>::iterator iter = m_elementquery.begin();
-        for( ; iter != m_elementquery.end(); ++iter )
-        {
-            *iter = 0;
-        }
-        m_lastquery = 0;
-    }
-    
-    ++m_lastquery;
-    
-    Vec3i xmini, xmaxi;
-    boundstoindices(xmin, xmax, xmini, xmaxi);
-    
-    for(int i = xmini[0]; i <= xmaxi[0]; ++i)
-    {
-        for(int j = xmini[1]; j <= xmaxi[1]; ++j)
-        {
-            for(int k = xmini[2]; k <= xmaxi[2]; ++k)
-            {
-                std::vector<size_t>* cell = m_cells(i, j, k);
-                
-                if(cell)
-                {
-                    for( std::vector<size_t>::const_iterator citer = cell->begin(); citer != cell->end(); ++citer)
-                    {
-                        size_t oidx = *citer;
-                        
-                        // Check if the object has already been found during this query
-                        
-                        if(m_elementquery[oidx] < m_lastquery)
-                        {
-                            
-                            // Object has not been found.  Set m_elementquery so that it will not be tested again during this query.
-                            
-                            m_elementquery[oidx] = m_lastquery;
-                            
-                            const Vec3d& oxmin = m_elementxmins[oidx];
-                            const Vec3d& oxmax = m_elementxmaxs[oidx];
-                            
-                            if( (xmin[0] <= oxmax[0] && xmin[1] <= oxmax[1] && xmin[2] <= oxmax[2]) &&
-                               (xmax[0] >= oxmin[0] && xmax[1] >= oxmin[1] && xmax[2] >= oxmin[2]) )
-                            {
-                                results.push_back(oidx);
-                            }
-                            
-                        }
-                    }
-                }
-                
-            }
-        }
-    }
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/accelerationgrid.h b/extern/eltopo/eltopo3d/accelerationgrid.h
deleted file mode 100644
index e9cada4..0000000
--- a/extern/eltopo/eltopo3d/accelerationgrid.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// ---------------------------------------------------------
-//
-//  accelerationgrid.h
-//  Tyson Brochu 2008
-//  
-//  A grid-based collision test culling structure.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_ACCELERATIONGRID_H
-#define EL_TOPO_ACCELERATIONGRID_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <array3.h>
-#include <vec.h>
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Regular grid collision culling structure
-///
-// --------------------------------------------------------
-
-class AccelerationGrid
-{
-    
-public:
-    
-    AccelerationGrid();
-    ~AccelerationGrid();
-    
-    // deep copy
-    AccelerationGrid(AccelerationGrid& other);
-    AccelerationGrid& operator=(const AccelerationGrid& other);
-    
-    /// Define the grid given, the extents of the domain and the number of voxels along each dimension
-    ///
-    void set( const Vec3st& dims, const Vec3d& xmin, const Vec3d& xmax );
-    
-    /// Generate a set of voxel indices from a pair of AABB extents
-    ///
-    void boundstoindices( const Vec3d& xmin, const Vec3d& xmax, Vec3i& xmini, Vec3i& xmaxi);
-    
-    /// Add an object with the specified index and AABB to the grid
-    ///
-    void add_element(size_t idx, const Vec3d& xmin, const Vec3d& xmax);
-    
-    /// Remove an object with the specified index from the grid
-    ///
-    void remove_element(size_t idx);
-    
-    /// Reset the specified object's AABB
-    ///
-    void update_element(size_t idx, const Vec3d& xmin, const Vec3d& xmax);
-    
-    /// Remove all elements from the grid
-    ///
-    void clear();
-    
-    /// Return the set of elements which have AABBs overlapping the query AABB.
-    ///
-    void find_overlapping_elements( const Vec3d& xmin, const Vec3d& xmax, std::vector<size_t>& results );
-    
-    
-    /// Each cell contains an array of indices specifying the elements whose AABBs overlap the cell
-    ///
-    Array3<std::vector<size_t>* > m_cells;
-    
-    /// For each element, a list of triples, each triple specifying a cell which overlaps the element. 
-    ///
-    std::vector<std::vector<Vec3st> > m_elementidxs;
-    
-    /// Element AABBs
-    ///
-    std::vector<Vec3d> m_elementxmins, m_elementxmaxs;
-    
-    /// For each element, the timestamp of the last query that examined the element
-    ///
-    std::vector<unsigned int> m_elementquery;
-    
-    /// Timestamp of the last query
-    ///
-    unsigned int m_lastquery;
-    
-    /// Lower/upper corners of the entire grid
-    ///
-    Vec3d m_gridxmin, m_gridxmax;
-    
-    /// Cell dimensions
-    ///
-    Vec3d m_cellsize;
-    
-    /// Inverse cell dimensions
-    ///
-    Vec3d m_invcellsize;
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/broadphase.h b/extern/eltopo/eltopo3d/broadphase.h
deleted file mode 100644
index 8972fcb..0000000
--- a/extern/eltopo/eltopo3d/broadphase.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// ---------------------------------------------------------
-//
-//  broadphase.h
-//  Tyson Brochu 2008
-//  
-//  Interface for abstract broad phase collision detector class.  The main function of a broad phase is to avoid performing 
-//  collision detection between all primitives. Abstract so we can try different strategies, however only BroadPhaseGrid is 
-//  currently implemented.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_BROADPHASE_H
-#define EL_TOPO_BROADPHASE_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <vec.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class DynamicSurface;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Abstract broad phase collision detector
-///
-// --------------------------------------------------------
-
-class BroadPhase
-{   
-public:
-    
-    virtual ~BroadPhase() 
-    {}
-    
-    /// Rebuild the broad phase
-    ///
-    virtual void update_broad_phase( const DynamicSurface& surface, bool continuous ) = 0;
-    
-    
-    /// Add a vertex with the specified bounding box to the broad phase
-    ///
-    virtual void add_vertex( size_t index,
-                            const Vec3d& aabb_low,
-                            const Vec3d& aabb_high,
-                            bool is_solid ) = 0;
-
-    /// Add an edge with the specified bounding box to the broad phase
-    ///
-    virtual void add_edge( size_t index,
-                          const Vec3d& aabb_low,
-                          const Vec3d& aabb_high,
-                          bool is_solid ) = 0;
-
-    /// Add a triangle with the specified bounding box to the broad phase
-    ///
-    virtual void add_triangle( size_t index,
-                              const Vec3d& aabb_low,
-                              const Vec3d& aabb_high,
-                              bool is_solid ) = 0;
-
-    /// Update a vertex's broad phase entry
-    ///
-    virtual void update_vertex( size_t index,
-                               const Vec3d& aabb_low,
-                               const Vec3d& aabb_high,
-                               bool is_solid ) = 0;
-
-    /// Update an edges's broad phase entry
-    ///
-    virtual void update_edge( size_t index,
-                             const Vec3d& aabb_low,
-                             const Vec3d& aabb_high,
-                             bool is_solid ) = 0;
-    
-    /// Update a triangle's broad phase entry
-    ///
-    virtual void update_triangle( size_t index,
-                                 const Vec3d& aabb_low,
-                                 const Vec3d& aabb_high,
-                                 bool is_solid ) = 0;
-    
-    /// Remove a vertex from the broad phase
-    ///
-    virtual void remove_vertex( size_t index ) = 0;
-    
-    /// Remove an edge from the broad phase
-    ///
-    virtual void remove_edge( size_t index ) = 0;
-    
-    /// Remove a triangle from the broad phase
-    ///
-    virtual void remove_triangle( size_t index ) = 0; 
-    
-    /// Get the stored axis-aligned bounding box of a vertex
-    ///
-    virtual void get_vertex_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high ) = 0;
-    
-    /// Get the stored axis-aligned bounding box of an edge
-    ///    
-    virtual void get_edge_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high ) = 0;
-    
-    /// Get the stored axis-aligned bounding box of a triangle
-    ///        
-    virtual void get_triangle_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high ) = 0;
-    
-    /// Get the set of vertices whose bounding volumes overlap the specified bounding volume
-    ///
-    virtual void get_potential_vertex_collisions( const Vec3d& aabb_low, 
-                                                 const Vec3d& aabb_high,
-                                                 bool return_solid,
-                                                 bool return_dynamic,
-                                                 std::vector<size_t>& overlapping_vertices ) = 0;
-    
-    /// Get the set of edges whose bounding volumes overlap the specified bounding volume
-    ///
-    virtual void get_potential_edge_collisions( const Vec3d& aabb_low, 
-                                               const Vec3d& aabb_high, 
-                                               bool return_solid,
-                                               bool return_dynamic,
-                                               std::vector<size_t>& overlapping_edges ) = 0;
-    
-    /// Get the set of triangles whose bounding volumes overlap the specified bounding volume
-    ///
-    virtual void get_potential_triangle_collisions( const Vec3d& aabb_low, 
-                                                   const Vec3d& aabb_high,
-                                                   bool return_solid,
-                                                   bool return_dynamic,
-                                                   std::vector<size_t>& overlapping_triangles ) = 0;
-    
-};
-
-
-#endif
-
diff --git a/extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp b/extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp
deleted file mode 100644
index a8fb609..0000000
--- a/extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#if 0
-// ---------------------------------------------------------
-//
-//  broadphase_blenderbvh.cpp
-//  Joseph Eagar 2010
-//  
-//  Broad phase collision detection culling using blender's kdop bvh.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <broadphasegrid.h>
-#include <dynamicsurface.h>
-
-// ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-
-// --------------------------------------------------------
-///
-/// Rebuild acceleration grids according to the given triangle mesh
-///
-// --------------------------------------------------------
-
-static void build_bvh_tree
-void BroadPhaseGrid::update_broad_phase_static( const DynamicSurface& surface )
-{
-   double grid_scale = surface.get_average_edge_length();
-   
-   {
-      unsigned int num_vertices = surface.m_positions.size();
-      std::vector<Vec3d> vertex_xmins(num_vertices), vertex_xmaxs(num_vertices);
-      for(unsigned int i = 0; i < num_vertices; i++)
-      {
-         surface.vertex_static_bounds(i, vertex_xmins[i], vertex_xmaxs[i]);
-      }      
-      build_acceleration_grid( m_vertex_grid, vertex_xmins, vertex_xmaxs, grid_scale, surface.m_proximity_epsilon );
-   }
-   
-   {
-      unsigned int num_edges = surface.m_mesh.m_edges.size();
-      std::vector<Vec3d> edge_xmins(num_edges), edge_xmaxs(num_edges);
-      for(unsigned int i = 0; i < num_edges; i++)
-      {
-         surface.edge_static_bounds(i, edge_xmins[i], edge_xmaxs[i]);
-      }      
-      if (num_edges)
-		  build_acceleration_grid( m_edge_grid, edge_xmins, edge_xmaxs, grid_scale, surface.m_proximity_epsilon );
-   }
-   
-   {
-      unsigned int num_triangles = surface.m_mesh.m_tris.size();
-      std::vector<Vec3d> tri_xmins(num_triangles), tri_xmaxs(num_triangles);
-      for(unsigned int i = 0; i < num_triangles; i++)
-      {
-         surface.triangle_static_bounds(i, tri_xmins[i], tri_xmaxs[i]);
-      }   
-	  
-      if (num_triangles)
-		  build_acceleration_grid( m_triangle_grid, tri_xmins, tri_xmaxs, grid_scale, surface.m_proximity_epsilon );  
-   }
-   
-}
-
-
-
-// --------------------------------------------------------
-///
-/// Rebuild acceleration grids according to the given triangle mesh
-///
-// --------------------------------------------------------
-
-void BroadPhaseGrid::update_broad_phase_continuous( const DynamicSurface& surface )
-{
-   double grid_scale = surface.get_average_edge_length();
-   
-   {
-      unsigned int num_vertices = surface.m_positions.size();
-      std::vector<Vec3d> vertex_xmins(num_vertices), vertex_xmaxs(num_vertices);
-      for(unsigned int i = 0; i < num_vertices; i++)
-      {           
-         surface.vertex_continuous_bounds(i, vertex_xmins[i], vertex_xmaxs[i]);
-      }
-	  
-      build_acceleration_grid( m_vertex_grid, vertex_xmins, vertex_xmaxs, grid_scale, surface.m_proximity_epsilon );
-   }
-   
-   {
-      unsigned int num_edges = surface.m_mesh.m_edges.size();
-      std::vector<Vec3d> edge_xmins(num_edges), edge_xmaxs(num_edges);
-      for(unsigned int i = 0; i < num_edges; i++)
-      {
-         surface.edge_continuous_bounds(i, edge_xmins[i], edge_xmaxs[i]);
-      }
-      if (num_edges)
-		  build_acceleration_grid( m_edge_grid, edge_xmins, edge_xmaxs, grid_scale, surface.m_proximity_epsilon );
-   }
-   
-   {
-      unsigned int num_triangles = surface.m_mesh.m_tris.size();
-      std::vector<Vec3d> tri_xmins(num_triangles), tri_xmaxs(num_triangles);
-      for(unsigned int i = 0; i < num_triangles; i++)
-      {            
-         surface.triangle_continuous_bounds(i, tri_xmins[i], tri_xmaxs[i]);
-      }
-      if (num_triangles)
-		  build_acceleration_grid( m_triangle_grid, tri_xmins, tri_xmaxs, grid_scale, surface.m_proximity_epsilon );  
-   }
-   
-}
-
-#endif
diff --git a/extern/eltopo/eltopo3d/broadphase_blenderbvh.h b/extern/eltopo/eltopo3d/broadphase_blenderbvh.h
deleted file mode 100644
index df1728c..0000000
--- a/extern/eltopo/eltopo3d/broadphase_blenderbvh.h
+++ /dev/null
@@ -1,230 +0,0 @@
-#if 0
-// ---------------------------------------------------------
-//
-//  broadphase_blenderbvh.h
-//  Joseph Eagar 2011
-//  
-//  Broad phase collision detection culling using a K-DOP bvh structure
-//
-// ---------------------------------------------------------
-
-#ifndef BROADPHASEGRID_H
-#define BROADPHASEGRID_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <broadphase.h>
-#include "../../../source/blender/blenlib/BLI_kdopbvh.h"
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class DynamicSurface;
-
-// ---------------------------------------------------------
-//  Interface declarations
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Broad phase collision detector using three regular grids: one grid each for vertices, edges and triangles.
-///
-// --------------------------------------------------------
-
-class BroadPhaseBVH : public BroadPhase
-{
-private:
-	BVHTree *v_bvhtree;
-	BVHTree *e_bvhtree;
-	BVHTree *t_bvhtree;
-
-public:
-   
-	BroadPhaseBVH() {
-		m_bvhtree = NULL;
-	}
-  
-   ~BroadPhaseGrid();
-   
-   /// Rebuild the broad phase using current vertex positions
-   ///
-   void update_broad_phase_static( const DynamicSurface& surface );
-   
-   /// Rebuild the broad phase using current and predicted vertex positions
-   ///
-   void update_broad_phase_continuous( const DynamicSurface& surface );
-
-   inline void add_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ); 
-   inline void add_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ); 
-   inline void add_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high );   
-   
-   inline void update_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ); 
-   inline void update_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ); 
-   inline void update_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ); 
-   
-   inline void remove_vertex( unsigned int index ); 
-   inline void remove_edge( unsigned int index ); 
-   inline void remove_triangle( unsigned int index ); 
-   
-   /// Get the set of vertices whose bounding volumes overlap the specified bounding volume
-   ///
-   inline void get_potential_vertex_collisions( const Vec3d& aabb_low, 
-                                                const Vec3d& aabb_high, 
-                                                std::vector<unsigned int>& overlapping_vertices );
-   
-   /// Get the set of edges whose bounding volumes overlap the specified bounding volume
-   ///
-   inline void get_potential_edge_collisions( const Vec3d& aabb_low, 
-                                              const Vec3d& aabb_high, 
-                                              std::vector<unsigned int>& overlapping_edges );
-   
-   /// Get the set of triangles whose bounding volumes overlap the specified bounding volume
-   ///
-   inline void get_potential_triangle_collisions( const Vec3d& aabb_low, 
-                                                  const Vec3d& aabb_high, 
-                                                  std::vector<unsigned int>& overlapping_triangles );
-
-   /// Rebuild one of the grids
-   ///
-   void build_acceleration_grid( AccelerationGrid& grid, 
-                                 std::vector<Vec3d>& xmins, 
-                                 std::vector<Vec3d>& xmaxs, 
-                                 double length_scale, 
-                                 double grid_padding );
-   
-   /// Regular grids
-   ///
-   AccelerationGrid m_vertex_grid;
-   AccelerationGrid m_edge_grid;
-   AccelerationGrid m_triangle_grid;  
-   
-};
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Add a vertex to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_vertex_grid.add_element( index, aabb_low, aabb_high );
-}
-
-// --------------------------------------------------------
-///
-/// Add an edge to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_edge_grid.add_element( index, aabb_low, aabb_high );
-}
-
-// --------------------------------------------------------
-///
-/// Add a triangle to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_triangle_grid.add_element( index, aabb_low, aabb_high );
-}
-
-
-inline void BroadPhaseGrid::update_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_vertex_grid.update_element( index, aabb_low, aabb_high );
-}
-
-inline void BroadPhaseGrid::update_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_edge_grid.update_element( index, aabb_low, aabb_high );   
-}
-
-inline void BroadPhaseGrid::update_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
-{
-   m_triangle_grid.update_element( index, aabb_low, aabb_high );   
-}
-
-
-// --------------------------------------------------------
-///
-/// Remove a vertex from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_vertex( unsigned int index )
-{
-   m_vertex_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Remove an edge from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_edge( unsigned int index )
-{
-   m_edge_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Remove a triangle from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_triangle( unsigned int index )
-{
-   m_triangle_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all vertices overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_vertex_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_vertices )
-{
-   m_vertex_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_vertices );
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all edges overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_edge_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_edges )
-{
-   m_edge_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_edges );
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all triangles overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_triangle_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_triangles )
-{
-   m_triangle_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_triangles );
-}
-
-#endif
-
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/broadphasegrid.cpp b/extern/eltopo/eltopo3d/broadphasegrid.cpp
deleted file mode 100644
index 8233f18..0000000
--- a/extern/eltopo/eltopo3d/broadphasegrid.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-// ---------------------------------------------------------
-//
-//  broadphasegrid.cpp
-//  Tyson Brochu 2008
-//  
-//  Broad phase collision detection culling using three regular, volumetric grids.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <broadphasegrid.h>
-#include <dynamicsurface.h>
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Construct one grid from the given set of AABBs, using the given length scale as the cell size, with the given padding
-///
-// --------------------------------------------------------
-
-void BroadPhaseGrid::build_acceleration_grid( AccelerationGrid& grid, 
-                                             std::vector<Vec3d>& xmins, 
-                                             std::vector<Vec3d>& xmaxs, 
-                                             std::vector<size_t>& indices,
-                                             double length_scale, 
-                                             double grid_padding )
-{
-    
-    assert( xmaxs.size() == xmins.size() );
-    assert( xmins.size() == indices.size() );
-    
-    if ( indices.empty() )
-    {
-        grid.clear();
-        return;
-    }
-    
-    Vec3d xmax = xmaxs[0];
-    Vec3d xmin = xmins[0];
-    double maxdistance = 0;
-    
-    size_t n = xmins.size();
-    
-    for(size_t i = 0; i < n; i++)
-    {
-        update_minmax(xmins[i], xmin, xmax);
-        update_minmax(xmaxs[i], xmin, xmax);
-        maxdistance = std::max(maxdistance, mag(xmaxs[i] - xmins[i]));
-    }
-    
-    for(unsigned int i = 0; i < 3; i++)
-    {
-        xmin[i] -= 2*maxdistance + grid_padding;
-        xmax[i] += 2*maxdistance + grid_padding;
-    }
-    
-    Vec3st dims(1,1,1);
-    
-    const size_t MAX_D = 2000;
-    
-    if(mag(xmax-xmin) > grid_padding)
-    {
-        for(unsigned int i = 0; i < 3; i++)
-        {
-            size_t d = (size_t)ceil((xmax[i] - xmin[i])/length_scale);
-            
-            if(d < 1) d = 1;
-            
-            if(d > MAX_D) 
-            {
-                d = MAX_D;
-            }
-            
-            dims[i] = d;
-        }
-    }
-    
-    grid.set(dims, xmin, xmax);
-    
-    // going backwards from n to 0, so hopefully the grid only has to allocate once
-    
-    for( ssize_t i = n-1; i >= 0; i-- )
-    {
-        // don't add inside-out AABBs
-        if ( xmins[i][0] > xmaxs[i][0] )  { continue; }
-        grid.add_element( indices[i], xmins[i], xmaxs[i]);
-    }
-}
-
-
-// --------------------------------------------------------
-///
-/// Rebuild acceleration grids according to the given triangle mesh
-///
-// --------------------------------------------------------
-
-void BroadPhaseGrid::update_broad_phase( const DynamicSurface& surface, bool continuous )
-{
-    
-    double grid_scale = surface.get_average_edge_length();
-    
-    // 
-    // vertices
-    // 
-    
-    {
-        size_t num_vertices = surface.get_num_vertices();
-        
-        std::vector<Vec3d> solid_vertex_xmins, solid_vertex_xmaxs;
-        std::vector<size_t> solid_vertex_indices;
-        std::vector<Vec3d> dynamic_vertex_xmins, dynamic_vertex_xmaxs;
-        std::vector<size_t> dynamic_vertex_indices;
-        
-        for(size_t i = 0; i < num_vertices; i++)
-        {
-            Vec3d xmin, xmax;
-            
-            if ( continuous )
-            {
-                surface.vertex_continuous_bounds( i, xmin, xmax );
-            }
-            else
-            {
-                surface.vertex_static_bounds( i, xmin, xmax );
-            }
-            
-            if ( surface.vertex_is_solid( i ) )
-            {
-                solid_vertex_xmins.push_back( xmin );
-                solid_vertex_xmaxs.push_back( xmax );
-                solid_vertex_indices.push_back( i );
-            }
-            else
-            {
-                dynamic_vertex_xmins.push_back( xmin );
-                dynamic_vertex_xmaxs.push_back( xmax );
-                dynamic_vertex_indices.push_back( i );
-            }
-        }
-        
-        build_acceleration_grid( m_solid_vertex_grid,
-                                solid_vertex_xmins,
-                                solid_vertex_xmaxs,
-                                solid_vertex_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-        build_acceleration_grid( m_dynamic_vertex_grid,
-                                dynamic_vertex_xmins,
-                                dynamic_vertex_xmaxs,
-                                dynamic_vertex_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-    }
-    
-    //
-    // edges
-    //
-    
-    {
-        size_t num_edges = surface.m_mesh.m_edges.size();
-        
-        std::vector<Vec3d> solid_edge_xmins, solid_edge_xmaxs;
-        std::vector<size_t> solid_edge_indices;
-        std::vector<Vec3d> dynamic_edge_xmins, dynamic_edge_xmaxs;
-        std::vector<size_t> dynamic_edge_indices;
-        
-        for(size_t i = 0; i < num_edges; i++)
-        {
-            Vec3d xmin, xmax;
-            
-            if ( continuous )
-            {
-                surface.edge_continuous_bounds( i, xmin, xmax );
-            }
-            else
-            {
-                surface.edge_static_bounds( i, xmin, xmax );
-            }
-            
-            // if either vertex is solid, it has to go into the solid broad phase
-            if ( surface.edge_is_solid(i) )
-            {
-                solid_edge_xmins.push_back( xmin );
-                solid_edge_xmaxs.push_back( xmax );
-                solid_edge_indices.push_back( i );
-            }
-            else
-            {
-                dynamic_edge_xmins.push_back( xmin );
-                dynamic_edge_xmaxs.push_back( xmax );
-                dynamic_edge_indices.push_back( i );
-            }
-        }      
-        
-        build_acceleration_grid( m_solid_edge_grid,
-                                solid_edge_xmins,
-                                solid_edge_xmaxs,
-                                solid_edge_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-        build_acceleration_grid( m_dynamic_edge_grid,
-                                dynamic_edge_xmins,
-                                dynamic_edge_xmaxs,
-                                dynamic_edge_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-    }
-    
-    //
-    // triangles
-    //
-    
-    {
-        size_t num_triangles = surface.m_mesh.num_triangles();
-        
-        std::vector<Vec3d> solid_tri_xmins, solid_tri_xmaxs;
-        std::vector<size_t> solid_tri_indices;
-        std::vector<Vec3d> dynamic_tri_xmins, dynamic_tri_xmaxs;
-        std::vector<size_t> dynamic_tri_indices;
-        
-        for(size_t i = 0; i < num_triangles; i++)
-        {
-            Vec3d xmin, xmax;
-            
-            if ( continuous )
-            {
-                surface.triangle_continuous_bounds(i, xmin, xmax);
-            }
-            else
-            {
-                surface.triangle_static_bounds(i, xmin, xmax);
-            }
-            
-            if ( surface.triangle_is_solid( i ) )
-            {
-                solid_tri_xmins.push_back( xmin );
-                solid_tri_xmaxs.push_back( xmax );
-                solid_tri_indices.push_back( i );
-            }
-            else
-            {
-                dynamic_tri_xmins.push_back( xmin );
-                dynamic_tri_xmaxs.push_back( xmax );
-                dynamic_tri_indices.push_back( i );
-            }
-        }
-        
-        build_acceleration_grid( m_solid_triangle_grid,
-                                solid_tri_xmins,
-                                solid_tri_xmaxs,
-                                solid_tri_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-        build_acceleration_grid( m_dynamic_triangle_grid,
-                                dynamic_tri_xmins,
-                                dynamic_tri_xmaxs,
-                                dynamic_tri_indices,
-                                grid_scale,
-                                surface.m_aabb_padding );
-        
-    }
-    
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/broadphasegrid.h b/extern/eltopo/eltopo3d/broadphasegrid.h
deleted file mode 100644
index 776830c..0000000
--- a/extern/eltopo/eltopo3d/broadphasegrid.h
+++ /dev/null
@@ -1,458 +0,0 @@
-// ---------------------------------------------------------
-//
-//  broadphasegrid.h
-//  Tyson Brochu 2008
-//  
-//  Broad phase collision detection culling using three regular, volumetric grids.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_BROADPHASEGRID_H
-#define EL_TOPO_BROADPHASEGRID_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <broadphase.h>
-#include <accelerationgrid.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class DynamicSurface;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Broad phase collision detector using three regular grids: one grid each for vertices, edges and triangles.
-///
-// --------------------------------------------------------
-
-class BroadPhaseGrid : public BroadPhase
-{
-public:
-    
-    /// Default constructor, just initialize empty grids
-    ///
-    BroadPhaseGrid() :
-    m_solid_vertex_grid(),
-    m_solid_edge_grid(),
-    m_solid_triangle_grid(),
-    m_dynamic_vertex_grid(),
-    m_dynamic_edge_grid(),
-    m_dynamic_triangle_grid()
-    {}
-    
-    
-    /// Do-nothing destructor
-    ///
-    ~BroadPhaseGrid() 
-    {}
-    
-    /// Rebuild the broad phase
-    ///
-    void update_broad_phase( const DynamicSurface& surface, bool continuous );
-    
-    /// Add a vertex with the specified bounding box to the broad phase
-    ///
-    inline void add_vertex( size_t index,
-                           const Vec3d& aabb_low,
-                           const Vec3d& aabb_high,
-                           bool is_solid );
-    
-    /// Add an edge with the specified bounding box to the broad phase
-    ///
-    inline void add_edge( size_t index,
-                         const Vec3d& aabb_low,
-                         const Vec3d& aabb_high,
-                         bool is_solid );
-
-    /// Add a triangle with the specified bounding box to the broad phase
-    ///
-    inline void add_triangle( size_t index,
-                             const Vec3d& aabb_low,
-                             const Vec3d& aabb_high,
-                             bool is_solid );
-
-    /// Update a vertex's broad phase entry
-    ///
-    inline void update_vertex( size_t index,
-                              const Vec3d& aabb_low,
-                              const Vec3d& aabb_high,
-                              bool is_solid );
-    
-    /// Update an edge's broad phase entry
-    ///
-    inline void update_edge( size_t index,
-                            const Vec3d& aabb_low,
-                            const Vec3d& aabb_high,
-                            bool is_solid );
-
-    /// Update a triangle's broad phase entry
-    ///
-    inline void update_triangle( size_t index,
-                                const Vec3d& aabb_low,
-                                const Vec3d& aabb_high,
-                                bool is_solid );
-
-    /// Remove a vertex from the broad phase
-    ///
-    inline void remove_vertex( size_t index );
-    
-    /// Remove an edge from the broad phase
-    ///    
-    inline void remove_edge( size_t index );
-    
-    /// Remove a triangle from the broad phase
-    ///        
-    inline void remove_triangle( size_t index ); 
-    
-    /// Get the stored axis-aligned bounding box of a vertex
-    ///
-    virtual void get_vertex_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high );
-    
-    /// Get the stored axis-aligned bounding box of an edge
-    ///
-    virtual void get_edge_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high );
-    
-    /// Get the stored axis-aligned bounding box of a triangle
-    ///
-    virtual void get_triangle_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high );
-    
-    /// Get the set of vertices whose bounding volumes overlap the specified bounding volume
-    ///
-    inline void get_potential_vertex_collisions( const Vec3d& aabb_low, 
-                                                const Vec3d& aabb_high,
-                                                bool return_solid,
-                                                bool return_dynamic,
-                                                std::vector<size_t>& overlapping_vertices );
-    
-    /// Get the set of edges whose bounding volumes overlap the specified bounding volume
-    ///
-    inline void get_potential_edge_collisions( const Vec3d& aabb_low, 
-                                              const Vec3d& aabb_high, 
-                                              bool return_solid,
-                                              bool return_dynamic,
-                                              std::vector<size_t>& overlapping_edges );
-    
-    /// Get the set of triangles whose bounding volumes overlap the specified bounding volume
-    ///
-    inline void get_potential_triangle_collisions( const Vec3d& aabb_low, 
-                                                  const Vec3d& aabb_high,
-                                                  bool return_solid,
-                                                  bool return_dynamic,
-                                                  std::vector<size_t>& overlapping_triangles );
-    
-    /// Rebuild one of the grids
-    ///
-    void build_acceleration_grid( AccelerationGrid& grid, 
-                                 std::vector<Vec3d>& xmins, 
-                                 std::vector<Vec3d>& xmaxs,
-                                 std::vector<size_t>& indices,
-                                 double length_scale, 
-                                 double grid_padding );
-    
-    /// Regular grids for solid mesh elements
-    ///
-    AccelerationGrid m_solid_vertex_grid;
-    AccelerationGrid m_solid_edge_grid;
-    AccelerationGrid m_solid_triangle_grid;
-
-    /// Regular grids for dynamic mesh elements
-    ///
-    AccelerationGrid m_dynamic_vertex_grid;
-    AccelerationGrid m_dynamic_edge_grid;
-    AccelerationGrid m_dynamic_triangle_grid;
-    
-};
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Add a vertex to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_vertex( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_vertex_grid.add_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_vertex_grid.add_element( index, aabb_low, aabb_high );
-    }
-}
-
-// --------------------------------------------------------
-///
-/// Add an edge to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_edge( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_edge_grid.add_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_edge_grid.add_element( index, aabb_low, aabb_high );
-    }
-}
-
-// --------------------------------------------------------
-///
-/// Add a triangle to the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::add_triangle( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_triangle_grid.add_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_triangle_grid.add_element( index, aabb_low, aabb_high );
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update a vertex's broad phase entry
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::update_vertex( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_vertex_grid.update_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_vertex_grid.update_element( index, aabb_low, aabb_high );
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Update an edge's broad phase entry
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::update_edge( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_edge_grid.update_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_edge_grid.update_element( index, aabb_low, aabb_high );
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Update a triangle's broad phase entry
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::update_triangle( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
-{
-    if ( is_solid )
-    {
-        m_solid_triangle_grid.update_element( index, aabb_low, aabb_high );
-    }
-    else
-    {
-        m_dynamic_triangle_grid.update_element( index, aabb_low, aabb_high );
-    }
-}
-
-
-// --------------------------------------------------------
-///
-/// Remove a vertex from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_vertex( size_t index )
-{
-    m_solid_vertex_grid.remove_element( index );
-    m_dynamic_vertex_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Remove an edge from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_edge( size_t index )
-{
-    m_solid_edge_grid.remove_element( index );
-    m_dynamic_edge_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Remove a triangle from the broad phase
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::remove_triangle( size_t index )
-{
-    m_solid_triangle_grid.remove_element( index );
-    m_dynamic_triangle_grid.remove_element( index );
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all vertices overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_vertex_collisions( const Vec3d& aabb_low,
-                                                            const Vec3d& aabb_high,
-                                                            bool return_solid,
-                                                            bool return_dynamic,
-                                                            std::vector<size_t>& overlapping_vertices )
-{
-    if ( return_solid )
-    {
-        m_solid_vertex_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_vertices );
-    }
-    
-    if ( return_dynamic )
-    {
-        m_dynamic_vertex_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_vertices );
-    }
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all edges overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_edge_collisions( const Vec3d& aabb_low,
-                                                          const Vec3d& aabb_high,
-                                                          bool return_solid,
-                                                          bool return_dynamic,
-                                                          std::vector<size_t>& overlapping_edges )
-{
-    if ( return_solid )
-    {
-        m_solid_edge_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_edges );
-    }
-    
-    if ( return_dynamic )
-    {
-        m_dynamic_edge_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_edges );
-    }
-}
-
-// --------------------------------------------------------
-///
-/// Query the broad phase to get the set of all triangles overlapping the given AABB
-///
-// --------------------------------------------------------
-
-inline void BroadPhaseGrid::get_potential_triangle_collisions( const Vec3d& aabb_low,
-                                                              const Vec3d& aabb_high,
-                                                              bool return_solid,
-                                                              bool return_dynamic,
-                                                              std::vector<size_t>& overlapping_triangles )
-{
-    if ( return_solid )
-    {
-        m_solid_triangle_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_triangles );
-    }
-    
-    if ( return_dynamic )
-    {
-        m_dynamic_triangle_grid.find_overlapping_elements( aabb_low, aabb_high, overlapping_triangles );
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Get the stored axis-aligned bounding box of a vertex
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::get_vertex_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high )
-{
-    if ( is_solid )
-    {
-        aabb_low = m_solid_vertex_grid.m_elementxmins[index];
-        aabb_high = m_solid_vertex_grid.m_elementxmaxs[index];
-    }
-    else
-    {
-        aabb_low = m_dynamic_vertex_grid.m_elementxmins[index];
-        aabb_high = m_dynamic_vertex_grid.m_elementxmaxs[index];      
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Get the stored axis-aligned bounding box of an edge
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::get_edge_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high )
-{
-    if ( is_solid )
-    {
-        aabb_low = m_solid_edge_grid.m_elementxmins[index];
-        aabb_high = m_solid_edge_grid.m_elementxmaxs[index];
-    }
-    else
-    {
-        aabb_low = m_dynamic_edge_grid.m_elementxmins[index];
-        aabb_high = m_dynamic_edge_grid.m_elementxmaxs[index];      
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Get the stored axis-aligned bounding box of a triangle
-///
-// ---------------------------------------------------------
-
-inline void BroadPhaseGrid::get_triangle_aabb( size_t index, bool is_solid, Vec3d& aabb_low, Vec3d& aabb_high )
-{
-    if ( is_solid )
-    {
-        aabb_low = m_solid_triangle_grid.m_elementxmins[index];
-        aabb_high = m_solid_triangle_grid.m_elementxmaxs[index];
-    }
-    else
-    {
-        aabb_low = m_dynamic_triangle_grid.m_elementxmins[index];
-        aabb_high = m_dynamic_triangle_grid.m_elementxmaxs[index];      
-    }   
-}
-
-
-#endif
-
-
-
diff --git a/extern/eltopo/eltopo3d/collisionpipeline.cpp b/extern/eltopo/eltopo3d/collisionpipeline.cpp
deleted file mode 100644
index f48058e..0000000
--- a/extern/eltopo/eltopo3d/collisionpipeline.cpp
+++ /dev/null
@@ -1,1562 +0,0 @@
-// ---------------------------------------------------------
-//
-//  collisionpipeline.cpp
-//  Tyson Brochu 2011
-//  
-//  Encapsulates all collision detection and resolution functions.
-//
-// ---------------------------------------------------------
-
-
-#include <collisionpipeline.h>
-#include <broadphase.h>
-#include <collisionqueries.h>
-#include <dynamicsurface.h>
-#include <impactzonesolver.h>
-#include <runstats.h>
-#include <wallclocktime.h>
-
-// ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// File-local variables, functions, etc.
-// ---------------------------------------------------------
-
-namespace {
-    
-    // ---------------------------------------------------------
-    // Local constants, typedefs, macros
-    // ---------------------------------------------------------
-    
-    const double IMPULSE_MULTIPLIER = 1.0;
-    
-    // ---------------------------------------------------------
-    // Static function definitions
-    // ---------------------------------------------------------
-    
-    // ---------------------------------------------------------
-    ///
-    /// Comparison function for sorting collision candidates
-    ///
-    // ---------------------------------------------------------
-    
-    bool CollisionCandidateSetLT(const Vec3st& a, const Vec3st& b)
-    {
-        if (a[0] < b[0])
-        {
-            return true;
-        }
-        else if (a[0] == b[0])
-        {
-            if (a[1] < b[1])
-            {
-                return true;
-            }
-            else if (a[1] == b[1])
-            {
-                if (a[2] < b[2])
-                {
-                    return true;
-                }
-            }
-        }
-        
-        return false;
-        
-    }
-    
-}   // namespace
-
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Constructor
-///
-// ---------------------------------------------------------
-
-CollisionPipeline::CollisionPipeline( DynamicSurface& surface,
-                                     BroadPhase& broadphase,
-                                     double in_friction_coefficient ) :
-m_friction_coefficient( in_friction_coefficient ),
-m_surface( surface ),
-m_broadphase( broadphase )
-{}
-
-
-
-// ---------------------------------------------------------
-///
-/// Apply an impulse along the given normal to the specified vertices, weighted by the given barycentric coordinates
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::apply_impulse( const Vec4d& alphas, 
-                                      const Vec4st& vertex_indices, 
-                                      double impulse_magnitude, 
-                                      const Vec3d& normal,
-                                      double dt )
-{
-    
-    size_t e0 = vertex_indices[0];
-    size_t e1 = vertex_indices[1];
-    size_t e2 = vertex_indices[2];
-    size_t e3 = vertex_indices[3];
-    
-    Vec3d& v0 = m_surface.m_velocities[e0];
-    Vec3d& v1 = m_surface.m_velocities[e1];
-    Vec3d& v2 = m_surface.m_velocities[e2];
-    Vec3d& v3 = m_surface.m_velocities[e3];
-    
-    double inv_m0 = 1.0 / m_surface.m_masses[e0];
-    double inv_m1 = 1.0 / m_surface.m_masses[e1];
-    double inv_m2 = 1.0 / m_surface.m_masses[e2];
-    double inv_m3 = 1.0 / m_surface.m_masses[e3];
-    
-    double s0 = alphas[0];
-    double s1 = alphas[1];
-    double s2 = alphas[2];
-    double s3 = alphas[3];
-    
-    double i = impulse_magnitude / (s0*s0*inv_m0 + s1*s1*inv_m1 + s2*s2*inv_m2 + s3*s3*inv_m3);
-
-    if ( i > 100.0 / dt )
-    {
-        std::cout << "big impulse: " << i << std::endl;
-    }
-    
-    Vec3d pre_relative_velocity = s0*v0 + s1*v1 + s2*v2 + s3*v3;
-    Vec3d pre_rv_normal = dot( normal, pre_relative_velocity ) * normal;
-    Vec3d pre_rv_tangential = pre_relative_velocity - pre_rv_normal;
-    
-    v0 += i*s0*inv_m0 * normal;
-    v1 += i*s1*inv_m1 * normal;
-    v2 += i*s2*inv_m2 * normal;
-    v3 += i*s3*inv_m3 * normal;
-    
-    //
-    // Friction
-    //
-    
-    Vec3d post_relative_velocity = s0*v0 + s1*v1 + s2*v2 + s3*v3;
-    Vec3d post_rv_normal = dot( normal, post_relative_velocity ) * normal;   
-    double delta_rv_normal = mag( post_rv_normal - pre_rv_normal );
-    double friction_impulse = min( m_friction_coefficient * delta_rv_normal, mag(pre_rv_tangential) );
-    double friction_i = friction_impulse / (s0*s0*inv_m0 + s1*s1*inv_m1 + s2*s2*inv_m2 + s3*s3*inv_m3);
-    
-    Vec3d tan_collision_normal = -pre_rv_tangential;
-    double mag_n = mag( tan_collision_normal );
-    if ( mag_n > 1e-8 )
-    {
-        tan_collision_normal /= mag_n;
-    }
-    else
-    {
-        tan_collision_normal = Vec3d(0);
-    }
-    
-    v0 += friction_i*s0*inv_m0 * tan_collision_normal;
-    v1 += friction_i*s1*inv_m1 * tan_collision_normal;
-    v2 += friction_i*s2*inv_m2 * tan_collision_normal;
-    v3 += friction_i*s3*inv_m3 * tan_collision_normal;
-    
-    m_surface.set_newposition( e0, m_surface.get_position(e0) + dt * m_surface.m_velocities[e0] );
-    m_surface.set_newposition( e1, m_surface.get_position(e1) + dt * m_surface.m_velocities[e1] );
-    m_surface.set_newposition( e2, m_surface.get_position(e2) + dt * m_surface.m_velocities[e2] );
-    m_surface.set_newposition( e3, m_surface.get_position(e3) + dt * m_surface.m_velocities[e3] );
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Apply an impulse between two edges 
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::apply_edge_edge_impulse( const Collision& collision, double impulse_magnitude, double dt )
-{
-    assert( collision.m_is_edge_edge );
-    
-    double s0 = collision.m_alphas[0];
-    double s1 = collision.m_alphas[1];
-    double s2 = collision.m_alphas[2];
-    double s3 = collision.m_alphas[3];
-    
-    Vec4d alphas;
-    alphas[0] = s0;
-    alphas[1] = s1;
-    alphas[2] = -s2;
-    alphas[3] = -s3;
-    
-    apply_impulse( alphas, collision.m_vertex_indices, impulse_magnitude, collision.m_normal, dt );
-    
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Apply an impulse between a point and a triangle
-///
-// ---------------------------------------------------------
-
-
-void CollisionPipeline::apply_triangle_point_impulse( const Collision& collision, double impulse_magnitude, double dt )
-{
-    assert( !collision.m_is_edge_edge );
-    
-    double s0 = collision.m_alphas[0];
-    double s1 = collision.m_alphas[1];
-    double s2 = collision.m_alphas[2];
-    double s3 = collision.m_alphas[3];
-    
-    assert( s0 == 1.0 );
-    
-    Vec4d alphas;
-    alphas[0] = s0;
-    alphas[1] = -s1;
-    alphas[2] = -s2;
-    alphas[3] = -s3;
-    
-    apply_impulse( alphas, collision.m_vertex_indices, impulse_magnitude, collision.m_normal, dt );
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Add point-triangle collision candidates for a specified triangle
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::add_triangle_candidates(size_t t,
-                                                bool return_solid,
-                                                bool return_dynamic,
-                                                CollisionCandidateSet& collision_candidates)
-{
-    Vec3d tmin, tmax;
-    m_surface.triangle_continuous_bounds(t, tmin, tmax);
-    
-    std::vector<size_t> candidate_vertices;
-    m_broadphase.get_potential_vertex_collisions(tmin, tmax, return_solid, return_dynamic, candidate_vertices);
-    
-    for (size_t j = 0; j < candidate_vertices.size(); j++)
-    {
-        collision_candidates.push_back( Vec3st(t, candidate_vertices[j], 0) );
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Add edge-edge collision candidates for a specified edge
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::add_edge_candidates( size_t e,
-                                            bool return_solid,
-                                            bool return_dynamic,
-                                            CollisionCandidateSet& collision_candidates )
-{
-    Vec3d emin, emax;
-    m_surface.edge_continuous_bounds(e, emin, emax);
-    
-    std::vector<size_t> candidate_edges;
-    m_broadphase.get_potential_edge_collisions(emin, emax, return_solid, return_dynamic, candidate_edges);
-    
-    for (size_t j = 0; j < candidate_edges.size(); j++)
-    {      
-        collision_candidates.push_back( Vec3st(e, candidate_edges[j], 1) );
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Add point-triangle collision candidates for a specified vertex
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::add_point_candidates( size_t v,
-                                             bool return_solid,
-                                             bool return_dynamic,
-                                             CollisionCandidateSet& collision_candidates )
-{
-    Vec3d vmin, vmax;
-    m_surface.vertex_continuous_bounds(v, vmin, vmax);
-    
-    std::vector<size_t> candidate_triangles;
-    m_broadphase.get_potential_triangle_collisions(vmin, vmax, return_solid, return_dynamic, candidate_triangles);
-    
-    for (size_t j = 0; j < candidate_triangles.size(); j++)
-    {
-        collision_candidates.push_back( Vec3st(candidate_triangles[j], v, 0) );
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Add collision candidates for a specified vertex and all elements incident on the vertex
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::add_point_update_candidates( size_t v,
-                                                    CollisionCandidateSet& collision_candidates)
-{
-    
-    // Avoid solid-vs-solid tests during sequential impulses phase
-    
-    if ( m_surface.vertex_is_solid(v) ) { return; }
-    
-    add_point_candidates(v, true, true, collision_candidates);
-    
-    std::vector<size_t>& incident_triangles = m_surface.m_mesh.m_vertex_to_triangle_map[v];
-    std::vector<size_t>& incident_edges = m_surface.m_mesh.m_vertex_to_edge_map[v];
-    
-    for (size_t i = 0; i < incident_triangles.size(); i++)
-    {
-        add_triangle_candidates(incident_triangles[i], true, true, collision_candidates);
-    }
-    
-    for (size_t i = 0; i < incident_edges.size(); i++)
-    {
-        add_edge_candidates(incident_edges[i], true, true, collision_candidates);
-    }
-    
-}
-
-
-// =========================================================
-//
-// PROXIMITIES
-//
-// =========================================================
-
-// ---------------------------------------------------------
-///
-/// Apply impulses to all proximal elements in the list of potentially proximal elements
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::process_proximity_candidates( double dt,
-                                                     CollisionCandidateSet& candidates )
-{
-    
-    static const double k = 10.0;
-    
-    while ( false == candidates.empty() )
-    {
-        CollisionCandidateSet::iterator iter = candidates.begin();
-        Vec3st candidate = *iter;
-        candidates.erase(iter);
-        
-        if ( candidate[2] == 1 )
-        {
-            // edge-edge
-            
-            Vec2st e0 = m_surface.m_mesh.m_edges[candidate[0]];
-            Vec2st e1 = m_surface.m_mesh.m_edges[candidate[1]];
-            
-            if (e0[0] == e0[1]) { continue; }
-            if (e1[0] == e1[1]) { continue; }
-            
-            if ( e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1] )
-            {
-                double distance, s0, s2;
-                Vec3d normal;
-                
-                check_edge_edge_proximity(m_surface.get_position( e0[0] ), 
-                                          m_surface.get_position( e0[1] ), 
-                                          m_surface.get_position( e1[0] ), 
-                                          m_surface.get_position( e1[1] ),
-                                          distance, s0, s2, normal );
-                
-                if (distance < m_surface.m_proximity_epsilon)
-                {
-                    
-                    double relvel = dot( normal,
-                                        s0 * m_surface.m_velocities[e0[0]] +
-                                        (1.0 - s0) * m_surface.m_velocities[e0[1]] -
-                                        s2 * m_surface.m_velocities[e1[0]] -
-                                        (1.0 - s2) * m_surface.m_velocities[e1[1]] );
-                    
-                    Vec3d diff = s0 * m_surface.get_position(e0[0]) + 
-                    (1.0 - s0) * m_surface.get_position(e0[1]) - 
-                    s2 * m_surface.get_position(e1[0]) - 
-                    (1.0 - s2) * m_surface.get_position(e1[1]);
-                    
-                    if ( dot( normal, diff ) < 0.0 )
-                    {
-                        continue;
-                    }
-                    
-                    double d = m_surface.m_proximity_epsilon - distance;
-                    
-                    if (relvel > 0.1 * d / dt )
-                    {
-                        continue;
-                    }
-                    
-                    double impulse1 = max( 0.0, 0.1 * d / dt - relvel );
-                    
-                    double impulse2 = dt * k * d;
-                    
-                    double impulse = min( impulse1, impulse2 );
-                    
-                    Collision proximity( true, 
-                                        Vec4st( e0[0], e0[1], e1[0], e1[1] ),
-                                        normal,
-                                        Vec4d( s0, 1.0-s0, s2, 1.0-s2 ),
-                                        dt * relvel );
-                    
-                    apply_edge_edge_impulse( proximity, impulse, dt );
-                    
-                }
-            }
-            
-        }
-        else
-        {
-            // point-triangle
-            
-            size_t t = candidate[0];
-            const Vec3st& tri = m_surface.m_mesh.get_triangle(t);
-            size_t v = candidate[1];
-            
-            if ( tri[0] != v && tri[1] != v && tri[2] != v )
-            {
-                double distance, s1, s2, s3;
-                Vec3d normal;
-                
-                check_point_triangle_proximity( m_surface.get_position(v), 
-                                               m_surface.get_position(tri[0]),
-                                               m_surface.get_position(tri[1]),
-                                               m_surface.get_position(tri[2]),
-                                               distance, s1, s2, s3, normal );
-                
-                if ( distance < m_surface.m_proximity_epsilon )
-                {
-                    
-                    double relvel = dot(normal,
-                                        m_surface.m_velocities[v] -
-                                        ( s1 * m_surface.m_velocities[tri[0]] +
-                                         s2 * m_surface.m_velocities[tri[1]] +
-                                         s3 * m_surface.m_velocities[tri[2]] ) );
-                    
-                    Vec3d diff = m_surface.get_position(v) -
-                    ( s1 * m_surface.get_position(tri[0]) +
-                     s2 * m_surface.get_position(tri[1]) +
-                     s3 * m_surface.get_position(tri[2]) );
-                    
-                    if ( dot( normal, diff ) < 0.0 )
-                    {
-                        continue;
-                    }
-                    
-                    double d = m_surface.m_proximity_epsilon - distance;
-                    
-                    if (relvel > 0.1 * d / dt )
-                    {
-                        continue;
-                    }
-                    
-                    double impulse1 = max( 0.0, 0.1 * d / dt - relvel );
-                    
-                    double impulse2 = dt * k * d;
-                    
-                    double impulse = min( impulse1, impulse2 );
-                    
-                    Collision proximity( false, 
-                                        Vec4st( v, tri[0], tri[1], tri[2] ),
-                                        normal,
-                                        Vec4d( 1.0, s1, s2, s3 ),
-                                        dt * relvel );
-                    
-                    apply_triangle_point_impulse( proximity, impulse, dt );
-                    
-                }
-            }
-        }
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Handle dynamic point vs. solid triangle proximities
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_point_vs_solid_triangle_proximities(double dt)
-{
-    // dynamic point vs solid triangles
-    
-    CollisionCandidateSet point_collision_candidates;
-    
-    for ( size_t i = 0; i < m_surface.get_num_vertices(); ++i )
-    {
-        if ( m_surface.vertex_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        // check vs solid triangles
-        add_point_candidates( i, true, false, point_collision_candidates );
-    }
-    
-    process_proximity_candidates( dt, point_collision_candidates );
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Handle dynamic triangle vs. all points proximities
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_triangle_vs_all_point_proximities(double dt)
-{
-    
-    CollisionCandidateSet triangle_collision_candidates;
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.num_triangles(); ++i )
-    {
-        if ( m_surface.triangle_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        // check vs all points
-        
-        add_triangle_candidates( i, true, true, triangle_collision_candidates );
-    }
-    
-    process_proximity_candidates( dt, triangle_collision_candidates );
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Handle dynamic edge vs. all other edges proximities
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_edge_vs_all_edge_proximities(double dt)
-{
-    
-    CollisionCandidateSet edge_collision_candidates;
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.m_edges.size(); ++i )
-    {
-        if ( m_surface.edge_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        // check vs all edges
-        add_edge_candidates( i, true, true, edge_collision_candidates);
-    }
-    
-    process_proximity_candidates( dt, edge_collision_candidates );
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Detect all proximities and apply repulsion forces
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::handle_proximities(double dt)
-{
-    
-    // dynamic point vs solid triangles
-    
-    dynamic_point_vs_solid_triangle_proximities( dt );
-    
-    // dynamic triangle vs static points
-    // dynamic triangle vs dynamic points
-    
-    dynamic_triangle_vs_all_point_proximities( dt );
-    
-    // dynamic edge vs static edges
-    // dynamic edge vs dynamic edges
-    
-    dynamic_edge_vs_all_edge_proximities( dt );
-    
-}
-
-
-// =========================================================
-//
-// COLLISIONS
-//
-// =========================================================
-
-// ---------------------------------------------------------
-///
-/// Detect is there is a collision between two edges (continuous)
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::detect_segment_segment_collision( const Vec3st& candidate, Collision& collision )
-{
-    
-    assert( candidate[2] == 1 );
-    
-    Vec2st e0 = m_surface.m_mesh.m_edges[candidate[0]];
-    Vec2st e1 = m_surface.m_mesh.m_edges[candidate[1]];
-    
-    if (e0[0] == e0[1]) { return false; }
-    if (e1[0] == e1[1]) { return false; }
-    
-    if ( e0[0] == e1[0] || e0[0] == e1[1] || e0[1] == e1[0] || e0[1] == e1[1] )
-    {
-        return false;
-    }
-    
-    if (e0[1] < e0[0]) { swap(e0[0], e0[1]); }
-    if (e1[1] < e1[0]) { swap(e1[0], e1[1]); }
-    
-    
-    if ( m_surface.edge_is_solid( candidate[0] ) && m_surface.edge_is_solid( candidate[1] ) )
-    {
-        return false;
-    }
-    
-    double s0, s2, rel_disp;
-    Vec3d normal;
-    
-    size_t a = e0[0];
-    size_t b = e0[1];
-    size_t c = e1[0];
-    size_t d = e1[1];
-    
-    if (segment_segment_collision(m_surface.get_position(a), m_surface.get_newposition(a), a, 
-                                  m_surface.get_position(b), m_surface.get_newposition(b), b, 
-                                  m_surface.get_position(c), m_surface.get_newposition(c), c,
-                                  m_surface.get_position(d), m_surface.get_newposition(d), d, 
-                                  s0, s2, normal, rel_disp) )
-    {
-        collision = Collision( true, Vec4st( a,b,c,d ), normal, Vec4d( s0, (1-s0), s2, (1-s2) ), rel_disp );         
-        return true;
-    }
-    
-    return false;        
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Detect is there is a collision between a point and a triangle (continuous)
-///
-// ---------------------------------------------------------
-
-
-bool CollisionPipeline::detect_point_triangle_collision( const Vec3st& candidate, Collision& collision )
-{
-    assert( candidate[2] == 0 );
-    
-    size_t t = candidate[0];
-    const Vec3st& tri = m_surface.m_mesh.get_triangle( candidate[0] );
-    size_t v = candidate[1];
-    
-    if ( tri[0] == v || tri[1] == v || tri[2] == v )
-    {
-        return false;
-    }
-    
-    
-    if ( m_surface.triangle_is_solid( t ) && m_surface.vertex_is_solid( v ) )
-    {
-        return false;
-    }
-    
-    double s1, s2, s3, rel_disp;
-    Vec3d normal;
-    Vec3st sorted_tri = sort_triangle(tri);
-    
-    if ( point_triangle_collision(m_surface.get_position(v), m_surface.get_newposition(v), v,
-                                  m_surface.get_position(sorted_tri[0]), m_surface.get_newposition(sorted_tri[0]), sorted_tri[0],
-                                  m_surface.get_position(sorted_tri[1]), m_surface.get_newposition(sorted_tri[1]), sorted_tri[1],
-                                  m_surface.get_position(sorted_tri[2]), m_surface.get_newposition(sorted_tri[2]), sorted_tri[2],
-                                  s1, s2, s3, normal, rel_disp) )
-        
-    {
-        collision = Collision( false, Vec4st( v, sorted_tri[0], sorted_tri[1], sorted_tri[2] ), normal, Vec4d( 1, s1, s2, s3 ), rel_disp ); 
-        return true;
-    }
-    
-    return false;
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Run collision detection on all given collision candidates, and apply 
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::process_collision_candidates( double dt,
-                                                     CollisionCandidateSet& candidates,
-                                                     bool add_to_new_candidates,
-                                                     CollisionCandidateSet& new_candidates,
-                                                     ProcessCollisionStatus& status )
-{
-    
-    size_t max_iteration = 5 * candidates.size();
-    size_t i = 0;
-    
-    static const size_t MAX_CANDIDATES = 1000000;
-    
-    while ( false == candidates.empty() && i++ < max_iteration )
-    {
-        CollisionCandidateSet::iterator iter = candidates.begin();
-        Vec3st candidate = *iter;
-        candidates.erase(iter);
-        
-        if ( candidate[2] == 1 )
-        {
-            // edge-edge
-            Collision collision;
-            if ( detect_segment_segment_collision( candidate, collision ) )
-            {
-                
-                g_stats.add_to_int( "CollisionPipeline::total_num_collisions", 1 );
-                
-                double relvel = collision.m_relative_displacement * dt;
-                double desired_relative_velocity = 0.0;
-                double impulse = IMPULSE_MULTIPLIER * (desired_relative_velocity - relvel);
-                apply_edge_edge_impulse( collision, impulse, dt );
-                
-                status.collision_found = true;
-                
-                if ( new_candidates.size() > MAX_CANDIDATES )
-                {
-                    status.overflow = true;
-                }
-                
-                if ( !status.overflow && add_to_new_candidates )
-                {
-                    add_point_update_candidates( collision.m_vertex_indices[0], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[1], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[2], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[3], new_candidates);
-                }
-            }
-		}
-
-        else
-        {
-            // point-triangle
-            
-            Collision collision;
-            if ( detect_point_triangle_collision( candidate, collision ) )
-            {
-                
-                g_stats.add_to_int( "CollisionPipeline::total_num_collisions", 1 );
-                
-                double relvel = collision.m_relative_displacement * dt;
-				// printf("collision.m_relative_displacement: %lf\n", collision.m_relative_displacement);
-                double desired_relative_velocity = 0.0;
-                double impulse = IMPULSE_MULTIPLIER * (desired_relative_velocity - relvel);
-                apply_triangle_point_impulse( collision, impulse, dt );
-                
-                status.collision_found = true;
-                
-                if ( new_candidates.size() > MAX_CANDIDATES )
-                {
-                    status.overflow = true;
-                }
-                
-                if ( !status.overflow && add_to_new_candidates )
-                {
-                    add_point_update_candidates( collision.m_vertex_indices[0], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[1], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[2], new_candidates);
-                    add_point_update_candidates( collision.m_vertex_indices[3], new_candidates);
-                }  
-            }
-            
-		}
-
-    }
-    
-    if ( m_surface.m_verbose && max_iteration > 0 && i >= max_iteration )
-    {
-        std::cout << "CollisionPipeline::process_collision_candidates: max_iteration reached" << std::endl;
-    }
-    
-    status.all_candidates_processed = candidates.empty();
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Run collision detection on all given collision candidates
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::test_collision_candidates( CollisionCandidateSet& candidates,
-                                                  std::vector<Collision>& collisions,
-                                                  ProcessCollisionStatus& status )
-{
-    
-    const size_t MAX_COLLISIONS = 5000;
-    
-    while ( false == candidates.empty() )
-    {
-        CollisionCandidateSet::iterator iter = candidates.begin();
-        Vec3st candidate = *iter;
-        candidates.erase(iter);
-        
-        if ( candidate[2] == 1 )
-        {
-            // edge-edge
-            Collision collision;
-            if ( detect_segment_segment_collision( candidate, collision ) )
-            {
-                status.collision_found = true;
-                
-                collisions.push_back( collision );
-                
-                if ( collisions.size() > MAX_COLLISIONS ) 
-                {
-                    status.overflow = true;
-                    status.all_candidates_processed = false;
-                    return; 
-                }                 
-            }
-            
-        }
-        else
-        {
-            // point-triangle
-            
-            Collision collision;
-            if ( detect_point_triangle_collision( candidate, collision ) )
-            {               
-                status.collision_found = true;
-                
-                collisions.push_back( collision );
-                
-                if ( collisions.size() > MAX_COLLISIONS ) 
-                {
-                    status.overflow = true;
-                    status.all_candidates_processed = false;                  
-                    return; 
-                }               
-            }
-            
-        }
-    }
-    
-    
-    status.all_candidates_processed = true;
-    
-    assert( status.all_candidates_processed == !status.overflow );
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Check if any collision exists in the set of candidates.  Stop when the first collision is found.
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::any_collision( CollisionCandidateSet& candidates, Collision& collision )
-{
-    
-    CollisionCandidateSet::iterator iter = candidates.begin();
-    
-    for ( ; iter != candidates.end(); ++iter )
-    {
-        
-        Vec3st candidate = *iter;
-        
-        if ( candidate[2] == 1 )
-        {
-            // edge-edge
-            if ( detect_segment_segment_collision( candidate, collision ) )
-            {
-                return true;
-            }         
-        }
-        else
-        {
-            // point-triangle
-            if ( detect_point_triangle_collision( candidate, collision ) )
-            {
-                return true;
-            }
-        }
-    }
-    
-    return false;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Check for collisions between dynamic points and solid triangles
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_point_vs_solid_triangle_collisions(double dt,
-                                                                   bool collect_candidates,
-                                                                   CollisionCandidateSet& update_collision_candidates,
-                                                                   ProcessCollisionStatus& status )
-{
-    // dynamic point vs solid triangles
-    
-    for ( size_t i = 0; i < m_surface.get_num_vertices(); ++i )
-    {
-        if ( m_surface.vertex_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        CollisionCandidateSet point_collision_candidates;
-        
-        // check vs solid triangles
-        add_point_candidates( i, true, false, point_collision_candidates );
-        
-        process_collision_candidates( dt,
-                                     point_collision_candidates,
-                                     collect_candidates,
-                                     update_collision_candidates,
-                                     status );
-        
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Check for collisions between dynamic triangles and all points
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_triangle_vs_all_point_collisions( double dt,
-                                                                 bool collect_candidates,
-                                                                 CollisionCandidateSet& update_collision_candidates,
-                                                                 ProcessCollisionStatus& status )
-{
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.num_triangles(); ++i )
-    {
-        if ( m_surface.triangle_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        CollisionCandidateSet triangle_collision_candidates;
-        
-        // check vs all points
-        add_triangle_candidates( i, true, true, triangle_collision_candidates );
-        
-        process_collision_candidates( dt,
-                                     triangle_collision_candidates,
-                                     collect_candidates,
-                                     update_collision_candidates,
-                                     status );
-        
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Check for collisions between dynamic edges and all other edges 
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::dynamic_edge_vs_all_edge_collisions( double dt,
-                                                            bool collect_candidates,
-                                                            CollisionCandidateSet& update_collision_candidates,
-                                                            ProcessCollisionStatus& status )
-{
-    
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.m_edges.size(); ++i )
-    {
-        if ( m_surface.edge_is_solid( i ) )
-        {
-            continue;
-        }
-        
-        CollisionCandidateSet edge_collision_candidates;
-        
-        // check vs all edges
-        add_edge_candidates( i, true, true, edge_collision_candidates);
-        
-        process_collision_candidates( dt,
-                                     edge_collision_candidates,
-                                     collect_candidates,
-                                     update_collision_candidates,
-                                     status );
-        
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Detect and fix all collisions, sweeping over all mesh primitives a number of times.
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::handle_collisions(double dt)
-{
-    
-    bool verbose = m_surface.m_verbose;
-    
-    static const int MAX_PASS = 3;
-    
-    CollisionCandidateSet update_collision_candidates;
-    
-    //m_surface.check_continuous_broad_phase_is_up_to_date();
-    
-    for ( int pass = 0; pass < MAX_PASS; ++pass )
-    {
-        // if last time through the loop, fill out the update_collision_candidates array
-        // when the loop exits, we will wind down this array
-        
-        bool collect_candidates = ( pass == (MAX_PASS-1) );
-        
-        bool collision_found = false;
-        ProcessCollisionStatus status;
-        
-        status.overflow = false;
-        status.collision_found = false;
-        status.all_candidates_processed = false;
-        
-        // dynamic point vs solid triangles
-      
-        dynamic_point_vs_solid_triangle_collisions( dt,
-                                                   collect_candidates,
-                                                   update_collision_candidates,
-                                                   status );
-        
-        collision_found |= status.collision_found;
-
-        // dynamic triangle vs static points
-        // dynamic triangle vs dynamic points
-        
-        dynamic_triangle_vs_all_point_collisions( dt,
-                                                 collect_candidates,
-                                                 update_collision_candidates,
-                                                 status );
-        
-        collision_found |= status.collision_found;
-        
-        // dynamic edge vs static edges
-        // dynamic edge vs dynamic edges
-        
-        dynamic_edge_vs_all_edge_collisions( dt,
-                                            collect_candidates,
-                                            update_collision_candidates,
-                                            status );
-        
-        collision_found |= status.collision_found;
-  
-        if ( status.overflow )
-        {
-            if ( verbose )
-            {
-                std::cout << "overflow, returning early" << std::endl;
-            }
-            return false;
-        }
-        
-        if ( !collision_found )
-        {
-            if ( verbose )
-            {
-                std::cout << "no collision found this pass, returning early" << std::endl;
-            }
-            return true;
-        }
-        
-        if ( verbose )
-        {
-            std::cout << "collision pass " << pass << " completed" << std::endl;
-        }
-        
-    }
-    
-    // Unique-ify the remaining list of candidates
-    std::sort( update_collision_candidates.begin(), update_collision_candidates.end(), CollisionCandidateSetLT );
-    CollisionCandidateSet::iterator new_end = std::unique(update_collision_candidates.begin(), update_collision_candidates.end());
-    update_collision_candidates.erase(new_end, update_collision_candidates.end());
-    
-    // now wind down the update_collision_candidates list
-    ProcessCollisionStatus status;
-    status.overflow = false;
-    process_collision_candidates( dt, update_collision_candidates, true, update_collision_candidates, status );
-    
-    bool ok = status.all_candidates_processed;
-    
-    if (  m_surface.m_verbose && !ok ) 
-    { 
-        std::cout << "Didn't resolve all collisions" << std::endl; 
-        g_stats.add_to_int("CollisionPipeline::handle_collisions:didnt_resolve_all_collisions", 1 );
-    }
-    
-    if ( status.overflow )
-    {
-        ok = false;
-        if ( m_surface.m_verbose )
-        {
-            std::cout << "overflowed candidate list" << std::endl;
-            g_stats.add_to_int("CollisionPipeline::handle_collisions:overflowed_candidate_list", 1 );
-        }
-    }
-    
-    return ok;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Check all elements for collisions, returning a vector of all collisions
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::detect_collisions( std::vector<Collision>& collisions )
-{
-    //m_surface.check_continuous_broad_phase_is_up_to_date();
-    
-    CollisionCandidateSet collision_candidates;
-    
-    // dynamic point vs solid triangles
-    
-    for ( size_t i = 0; i < m_surface.get_num_vertices(); ++i )
-    {
-        if ( m_surface.vertex_is_solid(i) )
-        {
-            continue;
-        }
-        
-        // check vs solid triangles
-        add_point_candidates( i, true, false, collision_candidates );
-    }
-    
-    // dynamic triangles vs all points
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.num_triangles(); ++i )
-    {
-        if ( m_surface.triangle_is_solid(i) )
-        {
-            continue;
-        }
-        
-        // check vs all points
-        add_triangle_candidates( i, true, true, collision_candidates );
-        
-    }
-    
-    // dynamic edges vs all edges
-    
-    for ( size_t i = 0; i < m_surface.m_mesh.m_edges.size(); ++i )
-    {
-        if ( m_surface.edge_is_solid(i) )
-        {
-            continue;
-        }
-        
-        // check vs all edges
-        add_edge_candidates( i, true, true, collision_candidates );
-    }
-    
-    
-    //
-    // Run narrow phase collision detection on all candidates
-    //
-    
-    ProcessCollisionStatus status;
-    test_collision_candidates( collision_candidates,
-                              collisions,
-                              status );
-    
-    // Check if all collisions were tested
-    
-    if ( !status.all_candidates_processed )
-    {
-        assert( status.overflow );
-        return false;
-    }
-    
-    return true;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Detect continuous collisions among elements in the given ImpactZones, and adjacent to the given ImpactZones.
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::detect_new_collisions( const std::vector<ImpactZone> impact_zones, std::vector<Collision>& collisions ) 
-{
-    //m_surface.check_continuous_broad_phase_is_up_to_date();
-    
-    std::vector<size_t> zone_vertices;
-    std::vector<size_t> zone_edges;
-    std::vector<size_t> zone_triangles;
-    
-    // Get all vertices in the impact zone
-    
-    for ( size_t i = 0; i < impact_zones.size(); ++i )
-    {
-        for ( size_t j = 0; j < impact_zones[i].m_collisions.size(); ++j )
-        {
-            add_unique( zone_vertices, impact_zones[i].m_collisions[j].m_vertex_indices[0] );
-            add_unique( zone_vertices, impact_zones[i].m_collisions[j].m_vertex_indices[1] );
-            add_unique( zone_vertices, impact_zones[i].m_collisions[j].m_vertex_indices[2] );
-            add_unique( zone_vertices, impact_zones[i].m_collisions[j].m_vertex_indices[3] );         
-        }
-    }
-    
-    // Get all triangles in the impact zone
-    
-    const NonDestructiveTriMesh& mesh = m_surface.m_mesh; 
-    
-    for ( size_t i = 0; i < zone_vertices.size(); ++i )
-    {
-        for ( size_t j = 0; j < mesh.m_vertex_to_triangle_map[zone_vertices[i]].size(); ++j )
-        {
-            add_unique( zone_triangles, mesh.m_vertex_to_triangle_map[zone_vertices[i]][j] );
-        }
-    }
-    
-    // Get all edges in the impact zone
-    
-    for ( size_t i = 0; i < zone_vertices.size(); ++i )
-    {
-        for ( size_t j = 0; j < mesh.m_vertex_to_edge_map[zone_vertices[i]].size(); ++j )
-        {
-            add_unique( zone_edges, mesh.m_vertex_to_edge_map[zone_vertices[i]][j] );
-        }
-    }
-    
-    CollisionCandidateSet collision_candidates;
-    
-    
-    // Check dynamic point vs all triangles
-    
-    for ( size_t j = 0; j < zone_vertices.size(); ++j )
-    {
-        size_t vertex_index = zone_vertices[j];
-        
-        // check vs all triangles
-        add_point_candidates( vertex_index, true, true, collision_candidates );
-        
-    }
-    
-    
-    // dynamic triangles vs all points
-    
-    for ( size_t j = 0; j < zone_triangles.size(); ++j )
-    {
-        size_t triangle_index = zone_triangles[j];
-        
-        // check vs all points
-        add_triangle_candidates( triangle_index, true, true, collision_candidates );
-        
-    }
-    
-    
-    // dynamic edges vs all edges
-    
-    for ( size_t j = 0; j < zone_edges.size(); ++j )
-    {
-        size_t edge_index = zone_edges[j];
-        
-        // check vs all edges
-        add_edge_candidates( edge_index, true, true, collision_candidates );
-    }
-    
-    
-    //
-    // Run narrow phase collision detection on all candidates
-    //
-    
-    ProcessCollisionStatus status;
-    status.overflow = false;
-    
-    test_collision_candidates( collision_candidates,
-                              collisions,
-                              status );
-    
-    // Check if all collisions were tested
-    
-    if ( !status.all_candidates_processed || status.overflow )
-    {
-        return false;
-    }
-    
-    return true;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Detect collisions between elements of the given edge and triangle
-///
-// ---------------------------------------------------------
-
-void CollisionPipeline::detect_collisions( size_t edge_index, 
-                                          size_t triangle_index, 
-                                          std::vector<Collision>& collisions )
-
-{
-    
-    size_t e0 = m_surface.m_mesh.m_edges[edge_index][0];
-    size_t e1 = m_surface.m_mesh.m_edges[edge_index][1];
-    if ( e1 < e0 ) { swap( e0, e1 ); }
-    
-    Vec3st tri = m_surface.m_mesh.get_triangle(triangle_index);
-    tri = sort_triangle( tri );
-    
-    size_t t0 = tri[0];
-    size_t t1 = tri[1];
-    size_t t2 = tri[2];
-    
-    double s0, s1, s2, s3, rel_disp;
-    Vec3d normal;
-    
-    extern bool tunicate_verbose;   
-    tunicate_verbose = true;
-    
-    extern bool simplex_verbose;
-    simplex_verbose = true;
-    
-    // edge vs triangle edge 0
-    
-    if (segment_segment_collision(m_surface.get_position(e0), m_surface.get_newposition(e0), e0,
-                                  m_surface.get_position(e1), m_surface.get_newposition(e1), e1,
-                                  m_surface.get_position(t0), m_surface.get_newposition(t0), t0,
-                                  m_surface.get_position(t1), m_surface.get_newposition(t1), t1,
-                                  s0, s2, normal, rel_disp) )
-        
-    {      
-        Collision new_collision( true, Vec4st( e0, e1, t0, t1 ), normal, Vec4d( s0, (1-s0), s2, (1-s2) ), rel_disp );
-        collisions.push_back( new_collision );
-        
-        size_t edge1 = m_surface.m_mesh.get_edge_index( t0, t1 ); 
-        assert( edge1 < m_surface.m_mesh.m_edges.size() );      
-        Vec3st check_candidate( edge_index, edge1, 1 );
-        Collision check_collision;
-        bool check_hit = detect_segment_segment_collision( check_candidate, check_collision );
-        assert( check_hit );
-        
-    }
-    
-    // edge vs triangle edge 1
-    
-    if (segment_segment_collision(m_surface.get_position(e0), m_surface.get_newposition(e0), e0,
-                                  m_surface.get_position(e1), m_surface.get_newposition(e1), e1,
-                                  m_surface.get_position(t1), m_surface.get_newposition(t1), t1,
-                                  m_surface.get_position(t2), m_surface.get_newposition(t2), t2,
-                                  s0, s2, normal, rel_disp) )
-        
-    {      
-        Collision new_collision( true, Vec4st( e0, e1, t1, t2 ), normal, Vec4d( s0, (1-s0), s2, (1-s2) ), rel_disp );
-        collisions.push_back( new_collision );
-        
-        size_t edge1 = m_surface.m_mesh.get_edge_index( t1, t2 );
-        assert( edge1 < m_surface.m_mesh.m_edges.size() );      
-        Vec3st check_candidate( edge_index, edge1, 1 );
-        Collision check_collision;
-        bool check_hit = detect_segment_segment_collision( check_candidate, check_collision );
-        assert( check_hit );
-        
-    }
-    
-    
-    // edge vs triangle edge 2
-    
-    
-    if (segment_segment_collision(m_surface.get_position(e0), m_surface.get_newposition(e0), e0,
-                                  m_surface.get_position(e1), m_surface.get_newposition(e1), e1,
-                                  m_surface.get_position(t0), m_surface.get_newposition(t0), t0,
-                                  m_surface.get_position(t2), m_surface.get_newposition(t2), t2,
-                                  s0, s2, normal, rel_disp) )
-        
-    {      
-        Collision new_collision( true, Vec4st( e0, e1, t2, t0 ), normal, Vec4d( s0, (1-s0), s2, (1-s2) ), rel_disp );
-        collisions.push_back( new_collision );
-        
-        size_t edge1 = m_surface.m_mesh.get_edge_index( t2, t0 ); 
-        assert( edge1 < m_surface.m_mesh.m_edges.size() );
-        Vec3st check_candidate( edge_index, edge1, 1 );
-        Collision check_collision;
-        bool check_hit = detect_segment_segment_collision( check_candidate, check_collision );
-        assert( check_hit );
-        
-    }
-    
-    // edge point 0 vs triangle
-    
-    if ( point_triangle_collision(m_surface.get_position(e0), m_surface.get_newposition(e0), e0,
-                                  m_surface.get_position(t0), m_surface.get_newposition(t0), t0,
-                                  m_surface.get_position(t1), m_surface.get_newposition(t1), t1,
-                                  m_surface.get_position(t2), m_surface.get_newposition(t2), t2,
-                                  s1, s2, s3, normal, rel_disp) )
-    {
-        Collision new_collision( false, Vec4st( e0, t0, t1, t2 ), normal, Vec4d( 1.0, s1, s2, s3 ), rel_disp );
-        collisions.push_back( new_collision );
-    }
-    
-    // edge point 1 vs triangle
-    
-    if ( point_triangle_collision(m_surface.get_position(e1), m_surface.get_newposition(e1), e1,
-                                  m_surface.get_position(t0), m_surface.get_newposition(t0), t0,
-                                  m_surface.get_position(t1), m_surface.get_newposition(t1), t1,
-                                  m_surface.get_position(t2), m_surface.get_newposition(t2), t2,
-                                  s1, s2, s3, normal, rel_disp) )
-    {
-        Collision new_collision( false, Vec4st( e1, t0, t1, t2 ), normal, Vec4d( 1.0, s1, s2, s3 ), rel_disp );
-        collisions.push_back( new_collision );
-    }
-    
-    
-    tunicate_verbose = false;
-    simplex_verbose = false;
-    
-    // ------
-    
-    for ( size_t i = 0; i < collisions.size(); ++i )
-    {
-        Collision& coll = collisions[i];
-        
-        std::cout << "\n ======== Collision: is_edge_edge: " << coll.m_is_edge_edge << ", indices: " << coll.m_vertex_indices << std::endl;
-        
-        if ( coll.m_is_edge_edge )
-        {
-            
-            size_t edge0 = m_surface.m_mesh.get_edge_index( coll.m_vertex_indices[0], coll.m_vertex_indices[1] );         
-            std::cout << "edge0: " << edge0 << std::endl;
-            
-            size_t edge1 = m_surface.m_mesh.get_edge_index( coll.m_vertex_indices[2], coll.m_vertex_indices[3] ); 
-            std::cout << "edge1: " << edge1 << std::endl;
-            
-            Vec3st check_candidate( edge0, edge1, 1 );
-            Collision check_collision;
-            bool check_hit = detect_segment_segment_collision( check_candidate, check_collision );
-            assert( check_hit );
-            
-            
-            CollisionCandidateSet collision_candidates0;
-            add_edge_candidates( edge0, true, true, collision_candidates0 );
-            bool edge1_found = false;
-            for ( size_t j = 0; j < collision_candidates0.size(); ++j )
-            {
-                if ( collision_candidates0[j][0] == edge1 || collision_candidates0[j][1] == edge1 )
-                {
-                    edge1_found = true;
-                }
-            }
-            
-            if ( !edge1_found ) { std::cout << "broadphase didn't find edge " << edge1 << std::endl; }           
-            
-            CollisionCandidateSet collision_candidates1;
-            add_edge_candidates( edge1, true, true, collision_candidates1 );
-            bool edge0_found = false;
-            for ( size_t j = 0; j < collision_candidates1.size(); ++j )
-            {
-                if ( collision_candidates1[j][0] == edge0 || collision_candidates1[j][1] == edge0 )
-                {
-                    edge0_found = true;
-                }
-            }
-            
-            if ( !edge0_found ) { std::cout << "broadphase didn't find edge " << edge0 << std::endl; }
-            
-        }
-        else
-        {
-            size_t vert = coll.m_vertex_indices[0];
-            size_t collision_tri = m_surface.m_mesh.get_triangle_index( coll.m_vertex_indices[1], coll.m_vertex_indices[2], coll.m_vertex_indices[3] );
-            
-            CollisionCandidateSet v_collision_candidates;
-            add_point_candidates( vert, true, true, v_collision_candidates );
-            bool tri_found = false;
-            for ( size_t j = 0; j < v_collision_candidates.size(); ++j )
-            {
-                if ( v_collision_candidates[j][0] == collision_tri || v_collision_candidates[j][1] == collision_tri )
-                {
-                    tri_found = true;
-                }
-            }
-            
-            if ( !tri_found ) { std::cout << "broadphase didn't find tri " << collision_tri << std::endl; }           
-            
-            CollisionCandidateSet t_collision_candidates;
-            add_triangle_candidates( collision_tri, true, true, t_collision_candidates );
-            bool vert_found = false;
-            for ( size_t j = 0; j < t_collision_candidates.size(); ++j )
-            {
-                if ( t_collision_candidates[j][0] == vert || t_collision_candidates[j][1] == vert )
-                {
-                    vert_found = true;
-                }
-            }
-            
-            if ( !vert_found ) { std::cout << "broadphase didn't find vertex " << vert << std::endl; }
-            
-        }
-        
-        
-    }
-    
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Determine if the vertices specified by the Collision object are still in collision
-///
-// ---------------------------------------------------------
-
-bool CollisionPipeline::check_if_collision_persists( const Collision& collision )
-{
-    const Vec4st& vs = collision.m_vertex_indices;
-    
-    
-    if ( collision.m_is_edge_edge )
-    {
-        return segment_segment_collision( m_surface.get_position(vs[0]), m_surface.get_newposition(vs[0]), vs[0], 
-                                         m_surface.get_position(vs[1]), m_surface.get_newposition(vs[1]), vs[1], 
-                                         m_surface.get_position(vs[2]), m_surface.get_newposition(vs[2]), vs[2],
-                                         m_surface.get_position(vs[3]), m_surface.get_newposition(vs[3]), vs[3] ); 
-        
-    }
-    else
-    {
-        return point_triangle_collision( m_surface.get_position(vs[0]), m_surface.get_newposition(vs[0]), vs[0], 
-                                        m_surface.get_position(vs[1]), m_surface.get_newposition(vs[1]), vs[1], 
-                                        m_surface.get_position(vs[2]), m_surface.get_newposition(vs[2]), vs[2],
-                                        m_surface.get_position(vs[3]), m_surface.get_newposition(vs[3]), vs[3] ); 
-        
-    }
-    
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/collisionpipeline.h b/extern/eltopo/eltopo3d/collisionpipeline.h
deleted file mode 100644
index 646a3fa..0000000
--- a/extern/eltopo/eltopo3d/collisionpipeline.h
+++ /dev/null
@@ -1,337 +0,0 @@
-// ---------------------------------------------------------
-//
-//  collisionpipeline.h
-//  Tyson Brochu 2011
-//  
-//  Encapsulates all collision detection and resolution functions.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_COLLISIONPIPELINE_H
-#define EL_TOPO_COLLISIONPIPELINE_H
-
-#include <deque>
-#include <options.h>
-#include <vec.h>
-
-class BroadPhase;
-class DynamicSurface;
-struct ImpactZone;
-
-// A potentially colliding pair of primitives.  Each pair is a triple of size_ts:
-//  elements 0 and 1 are the indices of the primitives involved.
-//  element 2 specifies if the potential collision is point-triangle or edge-edge
-typedef std::deque<Vec3st> CollisionCandidateSet;
-
-// --------------------------------------------------------
-///
-/// A collision between a triangle and a vertex or between two edges
-///
-// --------------------------------------------------------
-
-struct Collision
-{
-    /// Default collision constructor
-    ///
-    Collision() :
-    m_is_edge_edge( false ),
-    m_vertex_indices( Vec4st(static_cast<size_t>(~0)) ),
-    m_normal( Vec3d(UNINITIALIZED_DOUBLE) ),
-    m_alphas( Vec4d(UNINITIALIZED_DOUBLE) ),
-    m_relative_displacement( UNINITIALIZED_DOUBLE )
-    {}   
-    
-    /// Collision constructor
-    ///
-    Collision( bool in_is_edge_edge, const Vec4st& in_vertex_indices, const Vec3d& in_normal, const Vec4d& in_alphas, double in_relative_displacement ) :
-    m_is_edge_edge( in_is_edge_edge ),
-    m_vertex_indices( in_vertex_indices ),
-    m_normal( in_normal ),
-    m_alphas( in_alphas ),
-    m_relative_displacement( in_relative_displacement )
-    {
-        if ( !m_is_edge_edge ) { assert( m_alphas[0] == 1.0 ); }
-    }
-    
-    /// Determine if one or more vertices is shared between this Collision and other
-    ///
-    inline bool overlap_vertices( const Collision& other ) const;
-    
-    /// Determine if ALL vertices are shared between this Collision and other
-    ///
-    inline bool same_vertices( const Collision& other ) const;
-    
-    /// Are the two elements both edges
-    ///
-    bool m_is_edge_edge;
-    
-    /// Which vertices are involved in the collision
-    ///
-    Vec4st m_vertex_indices;
-    
-    /// Collision normal
-    ///
-    Vec3d m_normal;
-    
-    /// Barycentric coordinates of the point of intersection
-    ///
-    Vec4d m_alphas;
-    
-    /// Magnitude of relative motion over the timestep
-    ///
-    double m_relative_displacement;
-    
-};
-
-
-// --------------------------------------------------------
-///
-/// The results of processing a group of collision candidates.
-///
-// --------------------------------------------------------
-
-struct ProcessCollisionStatus
-{
-    /// Constructor
-    ///
-    ProcessCollisionStatus() :
-    collision_found( false ),
-    overflow(false),
-    all_candidates_processed( false )
-    {}
-    
-    /// Whether one or more collisions was found.
-    ///
-    bool collision_found;
-    
-    /// Whether the number of collision candidates overflowed the candidate container.
-    ///
-    bool overflow;
-    
-    /// Whether all collision candidates were processed, or if the processing was terminated early.
-    /// This is not necessarily equivalent to (!overflow): processing might stop early without overflow.
-    ///
-    bool all_candidates_processed;
-    
-};
-
-
-// --------------------------------------------------------
-///
-/// Encapsulates all collision detection and resolution.
-///
-// --------------------------------------------------------
-
-class CollisionPipeline
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    CollisionPipeline(DynamicSurface& surface,
-                      BroadPhase& broadphase,
-                      double in_friction_coefficient );
-    
-    /// Repulsion forces
-    ///
-    void handle_proximities( double dt );
-    
-    /// Sequential impulses
-    ///
-    bool handle_collisions( double dt );
-    
-    /// Get all collisions at once
-    ///   
-    bool detect_collisions( std::vector<Collision>& collisions );
-    
-    /// Get collisions involving vertices in the impact zones
-    /// 
-    bool detect_new_collisions( const std::vector<ImpactZone> impact_zones, 
-                               std::vector<Collision>& collisions );
-    
-    /// Get any collisions involving an edge and a triangle
-    ///
-    void detect_collisions( size_t edge_index, size_t triangle_index, std::vector<Collision>& collisions );
-    
-    /// Re-check the elements in the specified collision objectto see if there is still a collision
-    ///
-    bool check_if_collision_persists( const Collision& collision );
-    
-    /// Friction coefficient to apply during collision resolution
-    ///
-    double m_friction_coefficient;
-    
-private: 
-    
-    friend class DynamicSurface;
-    friend class EdgeCollapser;
-    
-    /// Apply a collision implulse between two edges
-    /// 
-    void apply_edge_edge_impulse( const Collision& collision, double impulse_magnitude, double dt );
-
-    /// Apply a collision implulse between a triangle and a vertex
-    /// 
-    void apply_triangle_point_impulse( const Collision& collision, double impulse_magnitude, double dt );
-    
-    /// Apply a collision implulse to the specified vertices, weighted by the alphas, along the specified normal
-    ///     
-    void apply_impulse(const Vec4d& alphas, 
-                       const Vec4st& vertex_indices, 
-                       double impulse_magnitude, 
-                       const Vec3d& normal,
-                       double dt );
-    
-    /// Check all triangles for AABB overlaps against the specified vertex.
-    ///
-    void add_point_candidates(size_t vertex_index,
-                              bool return_solid,
-                              bool return_dynamic,
-                              CollisionCandidateSet& collision_candidates );
-
-    /// Check all edges for AABB overlaps against the specified edge.
-    ///
-    void add_edge_candidates(size_t edge_index,
-                             bool return_solid,
-                             bool return_dynamic,
-                             CollisionCandidateSet& collision_candidates );
-
-    /// Check all edges for AABB overlaps against the specified edge.
-    ///
-    void add_triangle_candidates(size_t triangle_index,
-                                 bool return_solid,
-                                 bool return_dynamic,
-                                 CollisionCandidateSet& collision_candidates );
-    
-    /// Called when the specified vertex is moved.  Checks all incident mesh elements for AABB overlaps.
-    ///
-    void add_point_update_candidates(size_t vertex_index, 
-                                     CollisionCandidateSet& collision_candidates );
-    
-    /// Run continuous collision detection on a pair of edges.
-    ///
-    bool detect_segment_segment_collision( const Vec3st& candidate, Collision& collision );
-
-    /// Run continuous collision detection on a vertex-triangle pair.
-    ///
-    bool detect_point_triangle_collision( const Vec3st& candidate, Collision& collision );
-    
-    /// Test the candidates for proximity and apply impulses
-    ///
-    void process_proximity_candidates( double dt,
-                                      CollisionCandidateSet& candidates );
-    
-    /// Test dynamic points vs. solid triangles for proximities, and apply repulsion forces
-    /// 
-    void dynamic_point_vs_solid_triangle_proximities(double dt);
-
-    /// Test dynamic triangles vs. all vertices for proximities, and apply repulsion forces
-    /// 
-    void dynamic_triangle_vs_all_point_proximities(double dt);
-    
-    /// Test dynamic edges vs. all edges for proximities, and apply repulsion forces
-    /// 
-    void dynamic_edge_vs_all_edge_proximities(double dt);  
-    
-    
-    /// Test the candidates and fix any collisions with impulses
-    ///
-    void process_collision_candidates(double dt,
-                                      CollisionCandidateSet& candidates,
-                                      bool add_to_new_candidates,
-                                      CollisionCandidateSet& new_candidates,
-                                      ProcessCollisionStatus& status );
-    
-    /// Test the candidates and return collision info
-    ///
-    void test_collision_candidates(CollisionCandidateSet& candidates,
-                                   std::vector<Collision>& collisions,
-                                   ProcessCollisionStatus& status );
-    
-    /// Check if any collision exists in the set of candidates.  Stop when the first collision is found.
-    /// 
-    bool any_collision( CollisionCandidateSet& candidates, Collision& collision );
-    
-    /// Check for collisions between dynamic points and solid triangles
-    ///
-    void dynamic_point_vs_solid_triangle_collisions(double dt,
-                                                    bool collect_candidates,
-                                                    CollisionCandidateSet& update_collision_candidates,
-                                                    ProcessCollisionStatus& status );
-    
-    /// Check for collisions between dynamic triangles and all points
-    ///
-    void dynamic_triangle_vs_all_point_collisions(double dt,
-                                                  bool collect_candidates,
-                                                  CollisionCandidateSet& update_collision_candidates,
-                                                  ProcessCollisionStatus& status );
-    
-    /// Check for collisions between dynamic edges and all other edges 
-    ///
-    void dynamic_edge_vs_all_edge_collisions( double dt,
-                                             bool collect_candidates,
-                                             CollisionCandidateSet& update_collision_candidates,
-                                             ProcessCollisionStatus& status );
-    
-    DynamicSurface& m_surface;
-    BroadPhase& m_broadphase;
-    
-};
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Determine if another collision has any vertices in common with this collision.
-///
-// --------------------------------------------------------
-
-inline bool Collision::overlap_vertices( const Collision& other ) const
-{
-    for ( unsigned short i = 0; i < 4; ++i )
-    {
-        if ( m_vertex_indices[i] == other.m_vertex_indices[0] || 
-            m_vertex_indices[i] == other.m_vertex_indices[1] || 
-            m_vertex_indices[i] == other.m_vertex_indices[2] || 
-            m_vertex_indices[i] == other.m_vertex_indices[3] )
-        {
-            return true;
-        }
-    }
-    
-    return false;
-}
-
-// --------------------------------------------------------
-///
-/// Determine if another collision has all the same vertices as this collision.
-///
-// --------------------------------------------------------
-
-inline bool Collision::same_vertices( const Collision& other ) const
-{
-    bool found[4];
-    for ( unsigned short i = 0; i < 4; ++i )
-    {
-        if ( m_vertex_indices[i] == other.m_vertex_indices[0] || 
-            m_vertex_indices[i] == other.m_vertex_indices[1] || 
-            m_vertex_indices[i] == other.m_vertex_indices[2] || 
-            m_vertex_indices[i] == other.m_vertex_indices[3] )
-        {
-            found[i] = true;
-        }
-        else
-        {
-            found[i] = false;
-        }
-    }
-    
-    return ( found[0] && found[1] && found[2] && found[3] );
-}
-
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/cpp-file-template.txt b/extern/eltopo/eltopo3d/cpp-file-template.txt
deleted file mode 100644
index 1781ed3..0000000
--- a/extern/eltopo/eltopo3d/cpp-file-template.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-// ---------------------------------------------------------
-//
-//  file.cpp
-//
-//  Description
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
diff --git a/extern/eltopo/eltopo3d/dynamicsurface.cpp b/extern/eltopo/eltopo3d/dynamicsurface.cpp
deleted file mode 100644
index 4da34e2..0000000
--- a/extern/eltopo/eltopo3d/dynamicsurface.cpp
+++ /dev/null
@@ -1,1686 +0,0 @@
-// ---------------------------------------------------------
-//
-//  dynamicsurface.cpp
-//  Tyson Brochu 2008
-//  
-//  A triangle mesh with associated vertex locations and  masses.  Query functions for getting geometry info.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <dynamicsurface.h>
-
-#include <broadphasegrid.h>
-#include <cassert>
-#include <ccd_wrapper.h>
-#include <collisionpipeline.h>
-#include <collisionqueries.h>
-#include <ctime>
-#include <impactzonesolver.h>
-// #include <iomesh.h> NOT NEEDED
-#include <lapack_wrapper.h>
-#include <mat.h>
-#include <queue>
-#include <runstats.h>
-#include <vec.h>
-#include <vector>
-#include <wallclocktime.h>
-
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Extern globals
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// DynamicSurface constructor.  Copy triangles and vertex locations.
-///
-// ---------------------------------------------------------
-
-DynamicSurface::DynamicSurface( const std::vector<Vec3d>& vertex_positions, 
-                               const std::vector<Vec3st>& triangles,
-                               const std::vector<double>& masses,
-                               double in_proximity_epsilon,
-                               double in_friction_coefficient,
-                               bool in_collision_safety,
-                               bool in_verbose ) :
-m_proximity_epsilon( in_proximity_epsilon ),
-m_verbose( in_verbose ),   
-m_collision_safety( in_collision_safety ),
-m_masses( masses ), 
-m_mesh(), 
-m_broad_phase( new BroadPhaseGrid() ),
-m_collision_pipeline( NULL ),    // allocated and initialized in the constructor body
-m_aabb_padding( max( in_proximity_epsilon, 1e-4 ) ),
-pm_positions(vertex_positions), 
-pm_newpositions(vertex_positions),
-m_velocities(0)
-{
-    
-    if ( m_verbose )
-    {
-        std::cout << "constructing dynamic surface" << std::endl;
-    }
-    
-    // if masses not provided, set all to 1.0
-    if ( m_masses.size() == 0 )
-    {
-        m_masses.resize( get_num_vertices(), 1.0 );
-    }
-    
-    m_mesh.set_num_vertices( get_num_vertices() );   
-    m_mesh.replace_all_triangles( triangles );
-    
-    // Some compilers worry about using "this" in the initialization list, so initialize it here
-    m_collision_pipeline = new CollisionPipeline( *this, *m_broad_phase, in_friction_coefficient );
-    
-    if ( m_verbose )
-    {
-        std::cout << "constructed dynamic surface" << std::endl;
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Destructor. Frees memory allocated by DynamicSurface for the broad phase and collision pipeline objects.
-///
-// ---------------------------------------------------------
-
-DynamicSurface::~DynamicSurface()
-{
-    delete m_broad_phase;
-    delete m_collision_pipeline;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the unsigned distance to the surface.
-///
-// ---------------------------------------------------------
-
-double DynamicSurface::distance_to_surface( const Vec3d& p, size_t& closest_triangle ) const
-{
-    
-    double padding = m_aabb_padding;
-    double min_distance = BIG_DOUBLE;
-    
-    while ( min_distance == BIG_DOUBLE )
-    {
-        
-        Vec3d xmin( p - Vec3d( padding ) );
-        Vec3d xmax( p + Vec3d( padding ) );
-        
-        std::vector<size_t> nearby_triangles;   
-        
-        m_broad_phase->get_potential_triangle_collisions( xmin, xmax, true, true, nearby_triangles );
-        
-        for ( size_t j = 0; j < nearby_triangles.size(); ++j )
-        {
-            const Vec3st& tri = m_mesh.get_triangle( nearby_triangles[j] );
-            
-            if ( tri[0] == tri[1] || tri[1] == tri[2] || tri[0] == tri[2] ) { continue; }
-            
-            double curr_distance;
-            check_point_triangle_proximity( p, get_position(tri[0]), get_position(tri[1]), get_position(tri[2]), curr_distance );
-            if ( curr_distance < padding )
-            {   
-                min_distance = min( min_distance, curr_distance );
-                closest_triangle = nearby_triangles[j];
-            }
-        }
-        
-        padding *= 2.0;
-        
-    }
-    
-    return min_distance;
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Break up the triangle mesh into connected components, determine surface IDs for all vertices.
-///
-// --------------------------------------------------------
-
-void DynamicSurface::partition_surfaces( std::vector<size_t>& surface_ids, std::vector< std::vector< size_t> >& surfaces ) const
-{
-    
-    static const size_t UNASSIGNED = (size_t) ~0;
-    
-    surfaces.clear();
-    
-    surface_ids.clear();
-    surface_ids.resize( get_num_vertices(), UNASSIGNED );
-    
-    size_t curr_surface = 0;
-    
-    while ( true )
-    { 
-        size_t next_unassigned_vertex;
-        for ( next_unassigned_vertex = 0; next_unassigned_vertex < surface_ids.size(); ++next_unassigned_vertex )
-        {
-            if ( m_mesh.m_vertex_to_edge_map[next_unassigned_vertex].empty() ) { continue; }
-            
-            if ( surface_ids[next_unassigned_vertex] == UNASSIGNED )
-            {
-                break;
-            }
-        }
-        
-        if ( next_unassigned_vertex == surface_ids.size() )
-        {
-            break;
-        }
-        
-        std::queue<size_t> open;
-        open.push( next_unassigned_vertex );
-        
-        std::vector<size_t> surface_vertices;
-        
-        while ( false == open.empty() )
-        {
-            size_t vertex_index = open.front();
-            open.pop();
-            
-            if ( m_mesh.m_vertex_to_edge_map[vertex_index].empty() ) { continue; }
-            
-            if ( surface_ids[vertex_index] != UNASSIGNED )
-            {
-                assert( surface_ids[vertex_index] == curr_surface );
-                continue;
-            }
-            
-            surface_ids[vertex_index] = curr_surface;
-            surface_vertices.push_back( vertex_index );
-            
-            const std::vector<size_t>& incident_edges = m_mesh.m_vertex_to_edge_map[vertex_index];
-            
-            for( size_t i = 0; i < incident_edges.size(); ++i )
-            {
-                size_t adjacent_vertex = m_mesh.m_edges[ incident_edges[i] ][0];
-                if ( adjacent_vertex == vertex_index ) { adjacent_vertex = m_mesh.m_edges[ incident_edges[i] ][1]; }
-                
-                if ( surface_ids[adjacent_vertex] == UNASSIGNED )
-                {
-                    open.push( adjacent_vertex );
-                }
-                else
-                {
-                    assert( surface_ids[adjacent_vertex] == curr_surface );
-                }
-                
-            } 
-        }
-        
-        surfaces.push_back( surface_vertices );
-        
-        ++curr_surface;
-        
-    }
-    
-    //
-    // assert all vertices are assigned and share volume IDs with their neighbours
-    //
-    
-    for ( size_t i = 0; i < surface_ids.size(); ++i )
-    {
-        if ( m_mesh.m_vertex_to_edge_map[i].empty() ) { continue; }
-        
-        assert( surface_ids[i] != UNASSIGNED );
-        
-        const std::vector<size_t>& incident_edges = m_mesh.m_vertex_to_edge_map[i];    
-        for( size_t j = 0; j < incident_edges.size(); ++j )
-        {
-            size_t adjacent_vertex = m_mesh.m_edges[ incident_edges[j] ][0];
-            if ( adjacent_vertex == i ) { adjacent_vertex = m_mesh.m_edges[ incident_edges[j] ][1]; }
-            assert( surface_ids[adjacent_vertex] == surface_ids[i] );         
-        } 
-        
-    }
-    
-}
-
-// --------------------------------------------------------
-///
-/// Compute all vertex normals (unweighted average).
-///
-// --------------------------------------------------------
-
-void DynamicSurface::get_all_vertex_normals( std::vector<Vec3d>& normals ) const
-{
-    normals.resize( get_num_vertices() );
-    for ( size_t i = 0; i < get_num_vertices(); ++i )
-    {
-        normals[i] = get_vertex_normal(i);
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Run intersection detection against all triangles
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::get_triangle_intersections( const Vec3d& segment_point_a, 
-                                                const Vec3d& segment_point_b,
-                                                std::vector<double>& hit_ss,
-                                                std::vector<size_t>& hit_triangles ) const
-{
-    Vec3d aabb_low, aabb_high;
-    minmax( segment_point_a, segment_point_b, aabb_low, aabb_high );
-    
-    std::vector<size_t> overlapping_triangles;
-    m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, true, true, overlapping_triangles );
-    
-    for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-    {
-        const Vec3st& tri = m_mesh.get_triangle( overlapping_triangles[i] );
-        
-        Vec3st t = sort_triangle( tri );
-        assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-        
-        const Vec3d& v0 = get_position( t[0] );
-        const Vec3d& v1 = get_position( t[1] );
-        const Vec3d& v2 = get_position( t[2] );      
-        
-        size_t dummy_index = get_num_vertices();
-        
-        double bary1, bary2, bary3;
-        Vec3d normal;
-        double sa, sb;
-        
-        bool hit = segment_triangle_intersection(segment_point_a, dummy_index, 
-                                                 segment_point_b, dummy_index+1,
-                                                 v0, t[0],
-                                                 v1, t[1],
-                                                 v2, t[2],
-                                                 sa, sb, bary1, bary2, bary3,
-                                                 false, false );
-        
-        if ( hit )
-        {
-            hit_ss.push_back( sb );
-            hit_triangles.push_back( overlapping_triangles[i] );
-        }         
-        
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Run intersection detection against all triangles and return the number of hits.
-///
-// ---------------------------------------------------------
-
-size_t DynamicSurface::get_number_of_triangle_intersections( const Vec3d& segment_point_a, 
-                                                            const Vec3d& segment_point_b ) const
-{
-    int num_hits = 0;
-    int num_misses = 0;
-    Vec3d aabb_low, aabb_high;
-    minmax( segment_point_a, segment_point_b, aabb_low, aabb_high );
-    
-    std::vector<size_t> overlapping_triangles;
-    m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, true, true, overlapping_triangles );
-    
-    for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-    {
-        const Vec3st& tri = m_mesh.get_triangle( overlapping_triangles[i] );
-        
-        Vec3st t = sort_triangle( tri );
-        assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-        
-        const Vec3d& v0 = get_position( t[0] );
-        const Vec3d& v1 = get_position( t[1] );
-        const Vec3d& v2 = get_position( t[2] );      
-        
-        size_t dummy_index = get_num_vertices();
-        static const bool degenerate_counts_as_hit = true;
-        
-        bool hit = segment_triangle_intersection( segment_point_a, dummy_index,
-                                                 segment_point_b, dummy_index + 1, 
-                                                 v0, t[0],
-                                                 v1, t[1],
-                                                 v2, t[2],   
-                                                 degenerate_counts_as_hit );
-        
-        if ( hit )
-        {
-            ++num_hits;
-        }         
-        else
-        {
-            ++num_misses;
-        }
-    }
-    
-    return num_hits;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute rank of the quadric metric tensor at a vertex
-///
-// ---------------------------------------------------------
-
-unsigned int DynamicSurface::vertex_primary_space_rank( size_t v ) const
-{     
-    if ( m_mesh.m_vertex_to_triangle_map[v].empty() )     { return 0; }
-    
-    const std::vector<size_t>& incident_triangles = m_mesh.m_vertex_to_triangle_map[v];
-    
-    
-    Mat33d A(0,0,0,0,0,0,0,0,0);
-    
-    for ( size_t i = 0; i < incident_triangles.size(); ++i )
-    {
-        size_t triangle_index = incident_triangles[i];
-        Vec3d normal = get_triangle_normal(triangle_index);
-        double w = get_triangle_area(triangle_index);
-        
-        A(0,0) += normal[0] * w * normal[0];
-        A(1,0) += normal[1] * w * normal[0];
-        A(2,0) += normal[2] * w * normal[0];
-        
-        A(0,1) += normal[0] * w * normal[1];
-        A(1,1) += normal[1] * w * normal[1];
-        A(2,1) += normal[2] * w * normal[1];
-        
-        A(0,2) += normal[0] * w * normal[2];
-        A(1,2) += normal[1] * w * normal[2];
-        A(2,2) += normal[2] * w * normal[2];
-    }
-    
-    // get eigen decomposition
-    double eigenvalues[3];
-    double work[9];
-    int info = ~0, n = 3, lwork = 9;
-    LAPACK::get_eigen_decomposition( &n, A.a, &n, eigenvalues, work, &lwork, &info );
-    
-    if ( info != 0 )
-    {
-        if ( m_verbose )
-        {
-            std::cout << "Eigen decomp failed.  Incident triangles: " << std::endl;
-            for ( size_t i = 0; i < incident_triangles.size(); ++i )
-            {
-                size_t triangle_index = incident_triangles[i];
-                Vec3d normal = get_triangle_normal(triangle_index);
-                double w = get_triangle_area(triangle_index);
-                
-                std::cout << "normal: ( " << normal << " )    ";  
-                std::cout << "area: " << w << std::endl;
-            }
-        }
-        return 4;
-    }
-    
-    // compute rank of primary space
-    unsigned int rank = 0;
-    for ( unsigned int i = 0; i < 3; ++i )
-    {
-        if ( eigenvalues[i] > G_EIGENVALUE_RANK_RATIO * eigenvalues[2] )
-        {
-            ++rank;
-        }
-    }
-    
-    return rank;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Advance mesh by one time step 
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::integrate( double desired_dt, double& actual_dt )
-{     
-    
-    static const bool DEGEN_DOES_NOT_COUNT = false;   
-    static const bool USE_NEW_POSITIONS = true;
-    
-    if ( m_verbose ) 
-    {
-        std::cout << "---------------------- El Topo: integration and collision handling --------------------" << std::endl;
-    }
-    
-    double start_time = get_time_in_seconds();
-    
-    double curr_dt = desired_dt;
-    bool success = false;
-    
-    const std::vector<Vec3d> saved_predicted_positions = get_newpositions();
-    
-    while ( !success )
-    {
-        
-        m_velocities.resize( get_num_vertices() );
-        for(size_t i = 0; i < get_num_vertices(); i++)
-        {
-            m_velocities[i] = ( get_newposition(i) - get_position(i) ) / curr_dt;  
-        }
-        
-        // Handle proximities
-        
-        if ( m_collision_safety )
-        {
-            m_collision_pipeline->handle_proximities( curr_dt );
-            //check_continuous_broad_phase_is_up_to_date();
-        }
-        
-        if ( m_collision_safety )
-        {        
-            
-            // Handle continuous collisions
-            bool all_collisions_handled = false;
-            
-            all_collisions_handled = m_collision_pipeline->handle_collisions( curr_dt );
-
-            
-            // failsafe impact zones 
-            
-            ImpactZoneSolver impactZoneSolver( *this );
-            
-            bool solver_ok = all_collisions_handled;
-            
-            if ( !solver_ok )
-            {
-                //if ( m_verbose ) 
-                { std::cout << "IIZ" << std::endl; }
-                solver_ok = impactZoneSolver.inelastic_impact_zones( curr_dt );            
-            }
-            
-            if ( !solver_ok )
-            {
-                //if ( m_verbose ) 
-                { std::cout << "RIZ" << std::endl; }
-                // punt to rigid impact zones
-                solver_ok = impactZoneSolver.rigid_impact_zones( curr_dt );
-            }  
-            
-            if ( !solver_ok )
-            {
-                // back up and try again:
-                
-                curr_dt = 0.5 * curr_dt;
-                for ( size_t i = 0; i < get_num_vertices(); ++i )
-                {
-                    set_newposition(i, get_position(i) + 0.5 * (saved_predicted_positions[i] - get_position(i)) ) ;
-                }
-                
-                continue;      
-            }
-            
-            
-            // verify intersection-free predicted mesh
-            std::vector<Intersection> intersections;
-            get_intersections( DEGEN_DOES_NOT_COUNT, USE_NEW_POSITIONS, intersections );
-            
-            if ( !intersections.empty() )
-            {
-                std::cout << "Intersection in predicted mesh." << std::endl;
-                
-                if ( all_collisions_handled )
-                {
-                    std::cout << "Intersection in predicted mesh but handle collisions returned ok." << std::endl;
-                    assert( false );
-                }
-                
-				if ( m_verbose )
-				{
-                    std::cout << "Intersection in predicted mesh, cutting timestep." << std::endl;
-				}
-
-                // back up and try again:
-                
-                curr_dt = 0.5 * curr_dt;
-				for ( size_t i = 0; i < get_num_vertices(); ++i )
-				{
-					set_newposition( i, get_position(i) + 0.5 * ( saved_predicted_positions[i] - get_position(i) ) );
-				}
-                
-				continue;   
-                
-			}               
-            
-        }
-        
-        // Set m_positions
-        set_positions_to_newpositions();
-        
-        if ( m_collision_safety )
-        {
-            assert_mesh_is_intersection_free( DEGEN_DOES_NOT_COUNT );
-        }
-        
-        actual_dt = curr_dt;
-        
-        success = true;
-        
-    }
-    
-    double end_time = get_time_in_seconds();
-    
-    static unsigned int step = 0;
-    g_stats.add_per_frame_double( "DynamicSurface:integration_time_per_timestep", step, end_time - start_time );
-    ++step;
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Construct static acceleration structure
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::rebuild_static_broad_phase()
-{
-    assert( m_collision_safety );
-    m_broad_phase->update_broad_phase( *this, false );
-}
-
-// ---------------------------------------------------------
-///
-/// Construct continuous acceleration structure
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::rebuild_continuous_broad_phase()
-{
-    assert( m_collision_safety );
-    m_broad_phase->update_broad_phase( *this, true );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update the broadphase elements incident to the given vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::update_static_broad_phase( size_t vertex_index )
-{
-    const std::vector<size_t>& incident_tris = m_mesh.m_vertex_to_triangle_map[ vertex_index ];
-    const std::vector<size_t>& incident_edges = m_mesh.m_vertex_to_edge_map[ vertex_index ];
-    
-    Vec3d low, high;
-    vertex_static_bounds( vertex_index, low, high );
-    m_broad_phase->update_vertex( vertex_index, low, high, vertex_is_solid(vertex_index) );
-    
-    for ( size_t t = 0; t < incident_tris.size(); ++t )
-    {
-        triangle_static_bounds( incident_tris[t], low, high );
-        m_broad_phase->update_triangle( incident_tris[t], low, high, triangle_is_solid(incident_tris[t]) );
-    }
-    
-    for ( size_t e = 0; e < incident_edges.size(); ++e )
-    {
-        edge_static_bounds( incident_edges[e], low, high );
-        m_broad_phase->update_edge( incident_edges[e], low, high, edge_is_solid(incident_edges[e]) );
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update the broadphase elements incident to the given vertex, using current and predicted vertex positions
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::update_continuous_broad_phase( size_t vertex_index )
-{
-    assert( m_collision_safety );
-    
-    const std::vector<size_t>& incident_tris = m_mesh.m_vertex_to_triangle_map[ vertex_index ];
-    const std::vector<size_t>& incident_edges = m_mesh.m_vertex_to_edge_map[ vertex_index ];
-    
-    Vec3d low, high;
-    vertex_continuous_bounds( vertex_index, low, high );
-    m_broad_phase->update_vertex( vertex_index, low, high, vertex_is_solid(vertex_index) );
-    
-    for ( size_t t = 0; t < incident_tris.size(); ++t )
-    {
-        triangle_continuous_bounds( incident_tris[t], low, high );
-        m_broad_phase->update_triangle( incident_tris[t], low, high, triangle_is_solid(incident_tris[t]) );
-    }
-    
-    for ( size_t e = 0; e < incident_edges.size(); ++e )
-    {
-        edge_continuous_bounds( incident_edges[e], low, high );
-        m_broad_phase->update_edge( incident_edges[e], low, high, edge_is_solid(incident_edges[e]) );
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the (padded) AABB of a vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::vertex_static_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const
-{
-    if ( m_mesh.m_vertex_to_triangle_map[v].empty() )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding);
-    }
-    else
-    {
-        xmin = get_position(v) - Vec3d(m_aabb_padding);
-        xmax = get_position(v) + Vec3d(m_aabb_padding);
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of an edge
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::edge_static_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const
-{
-    const Vec2st& edge = m_mesh.m_edges[e];
-    if ( edge[0] == edge[1] )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding); 
-    }
-    else
-    {            
-        minmax( get_position(edge[0]), get_position(edge[1]), xmin, xmax);
-        xmin -= Vec3d(m_aabb_padding);
-        xmax += Vec3d(m_aabb_padding);
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a triangle
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::triangle_static_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const
-{
-    const Vec3st& tri = m_mesh.get_triangle(t);  
-    if ( tri[0] == tri[1] )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding);
-    }
-    else
-    {      
-        minmax(get_position(tri[0]), get_position(tri[1]), get_position(tri[2]), xmin, xmax);
-        xmin -= Vec3d(m_aabb_padding);
-        xmax += Vec3d(m_aabb_padding);
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::vertex_continuous_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const
-{
-    if ( m_mesh.m_vertex_to_triangle_map[v].empty() )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding);
-    }
-    else
-    {
-        minmax( get_position(v), get_newposition(v), xmin, xmax);
-        xmin -= Vec3d(m_aabb_padding);
-        xmax += Vec3d(m_aabb_padding);
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous edge
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::edge_continuous_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const
-{
-    const Vec2st& edge = m_mesh.m_edges[e];   
-    if ( edge[0] == edge[1] )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding);
-    }
-    else
-    {      
-        minmax(get_position(edge[0]), get_newposition(edge[0]), 
-               get_position(edge[1]), get_newposition(edge[1]), 
-               xmin, xmax);
-        xmin -= Vec3d(m_aabb_padding);
-        xmax += Vec3d(m_aabb_padding);
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous triangle
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::triangle_continuous_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const
-{
-    const Vec3st& tri = m_mesh.get_triangle(t);
-    if ( tri[0] == tri[1] )
-    {
-        xmin = Vec3d(m_aabb_padding);
-        xmax = -Vec3d(m_aabb_padding);
-    }
-    else
-    {
-        minmax(get_position(tri[0]), get_newposition(tri[0]), 
-               get_position(tri[1]), get_newposition(tri[1]), 
-               get_position(tri[2]), get_newposition(tri[2]), 
-               xmin, xmax);
-        
-        xmin -= Vec3d(m_aabb_padding);
-        xmax += Vec3d(m_aabb_padding);
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Check two axis-aligned bounding boxes for intersection
-///
-// ---------------------------------------------------------
-
-static bool aabbs_intersect( const Vec3d& a_xmin, const Vec3d& a_xmax, const Vec3d& b_xmin, const Vec3d& b_xmax )
-{
-    if ( (a_xmin[0] <= b_xmax[0] && a_xmin[1] <= b_xmax[1] && a_xmin[2] <= b_xmax[2]) &&
-        (a_xmax[0] >= b_xmin[0] && a_xmax[1] >= b_xmin[1] && a_xmax[2] >= b_xmin[2]) )
-    {
-        return true;
-    }
-    
-    return false;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Caution: slow!
-/// Check the consistency of the broad phase by comparing against the N^2 broadphase.
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::check_static_broad_phase_is_up_to_date() const
-{
-    
-    // Verify by running against the n^2 broad phase
-    
-    //
-    // vertex vs triangle
-    //
-    
-    for ( size_t i = 0; i < get_num_vertices(); ++i )
-    {
-        if ( m_mesh.vertex_is_deleted(i) ) { continue; }
-        
-        // First, accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        vertex_static_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_triangles;
-        m_broad_phase->get_potential_triangle_collisions(aabb_low, aabb_high, true, true, overlapping_triangles); 
-        
-        // filter deleted triangles
-        for ( int k = 0; k < (int)overlapping_triangles.size(); ++k )
-        {
-            if ( m_mesh.triangle_is_deleted( overlapping_triangles[k] ) )
-            {
-                overlapping_triangles.erase( overlapping_triangles.begin() + k );
-                --k;
-            }
-        }
-        
-        // Second, brute force check
-        
-        std::vector<size_t> brute_force_overlapping_triangles;
-        
-        for ( size_t j = 0; j < m_mesh.num_triangles(); ++j )
-        {
-            if ( m_mesh.triangle_is_deleted(j) ) { continue; }
-            
-            Vec3d tri_aabb_low, tri_aabb_high;
-            triangle_static_bounds( j, tri_aabb_low, tri_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, tri_aabb_low, tri_aabb_high ) )
-            {
-                brute_force_overlapping_triangles.push_back( j );            
-            }
-        }
-        
-        assert( overlapping_triangles.size() == brute_force_overlapping_triangles.size() );
-        
-        std::sort(overlapping_triangles.begin(), overlapping_triangles.end());
-        std::sort(brute_force_overlapping_triangles.begin(), brute_force_overlapping_triangles.end());
-        
-        for ( size_t k = 0; k < overlapping_triangles.size(); ++k )
-        {
-            assert( overlapping_triangles[k] == brute_force_overlapping_triangles[k] );
-        }
-        
-    }
-    
-    //
-    // edge vs edge
-    //
-    
-    for ( size_t i = 0; i < m_mesh.m_edges.size(); ++i )
-    {
-        if ( m_mesh.edge_is_deleted(i) ) { continue; }
-        
-        // Accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        edge_static_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_edges;
-        m_broad_phase->get_potential_edge_collisions( aabb_low, aabb_high, true, true, overlapping_edges );
-        
-        // filter deleted edges
-        for ( int k = 0; k < (int)overlapping_edges.size(); ++k )
-        {
-            if ( m_mesh.edge_is_deleted( overlapping_edges[k] ) )
-            {
-                overlapping_edges.erase( overlapping_edges.begin() + k );
-                --k;
-            }
-        }
-        
-        // Brute force
-        std::vector<size_t> brute_force_overlapping_edges;
-        for ( size_t j = 0; j < m_mesh.m_edges.size(); ++j )
-        {
-            if ( m_mesh.edge_is_deleted(j) ) { continue; }
-            
-            Vec3d edge_aabb_low, edge_aabb_high;
-            edge_static_bounds( j, edge_aabb_low, edge_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, edge_aabb_low, edge_aabb_high ) )
-            {
-                brute_force_overlapping_edges.push_back( j );
-            }
-        }
-        
-        if ( overlapping_edges.size() != brute_force_overlapping_edges.size() )
-        {
-            
-            std::cout << "edge " << i << ": " << m_mesh.m_edges[i] << std::endl;
-            std::cout << "overlapping_edges.size(): " << overlapping_edges.size() << std::endl;
-            for ( size_t k = 0; k < overlapping_edges.size(); ++k )
-            {
-                std::cout << k << ": " << overlapping_edges[k] << std::endl;
-            }
-            
-            std::cout << "brute_force_overlapping_edges.size(): " << brute_force_overlapping_edges.size() << std::endl;
-            for ( size_t k = 0; k < brute_force_overlapping_edges.size(); ++k )
-            {
-                std::cout << k << ": " << brute_force_overlapping_edges[k] << std::endl;
-            }
-            
-        }
-        
-        assert( overlapping_edges.size() == brute_force_overlapping_edges.size() );
-        
-        std::sort( overlapping_edges.begin(), overlapping_edges.end() );
-        std::sort( brute_force_overlapping_edges.begin(), brute_force_overlapping_edges.end() );
-        
-        for ( size_t k = 0; k < overlapping_edges.size(); ++k )
-        {
-            assert( overlapping_edges[k] == brute_force_overlapping_edges[k] );
-        }
-    }
-    
-    //
-    // triangle vs vertex
-    //
-    
-    for ( size_t i = 0; i < m_mesh.num_triangles(); ++i )
-    {
-        if ( m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        // Accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        triangle_static_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_vertices;
-        m_broad_phase->get_potential_vertex_collisions( aabb_low, aabb_high, true, true, overlapping_vertices );
-        
-        // filter deleted vertices
-        for ( int k = 0; k < (int)overlapping_vertices.size(); ++k )
-        {
-            if ( m_mesh.vertex_is_deleted( overlapping_vertices[k] ) )
-            {
-                overlapping_vertices.erase( overlapping_vertices.begin() + k );
-                --k;
-            }
-        }
-        
-        // Brute force
-        std::vector<size_t> brute_force_overlapping_vertices;
-        for ( size_t j = 0; j < get_num_vertices(); ++j )
-        {
-            if ( m_mesh.vertex_is_deleted(j) ) { continue; }
-            
-            Vec3d vertex_aabb_low, vertex_aabb_high;
-            vertex_static_bounds( j, vertex_aabb_low, vertex_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, vertex_aabb_low, vertex_aabb_high ) )
-            {
-                brute_force_overlapping_vertices.push_back( j );
-            }
-        }
-        
-        if ( overlapping_vertices.size() != brute_force_overlapping_vertices.size() )
-        {
-            std::cout << "triangle " << i << ": " << m_mesh.get_triangle(i) << std::endl;
-            std::cout << "overlapping_vertices.size(): " << overlapping_vertices.size() << std::endl;
-            for ( size_t k = 0; k < overlapping_vertices.size(); ++k )
-            {
-                std::cout << k << ": " << overlapping_vertices[k] << " --- ";
-                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( overlapping_vertices[k] ) << std::endl;
-            }
-            
-            std::cout << "brute_force_overlapping_vertices.size(): " << brute_force_overlapping_vertices.size() << std::endl;
-            for ( size_t k = 0; k < brute_force_overlapping_vertices.size(); ++k )
-            {
-                std::cout << k << ": " << brute_force_overlapping_vertices[k] << " --- ";
-                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( brute_force_overlapping_vertices[k] ) << std::endl;
-            }
-        }
-        
-        assert( overlapping_vertices.size() == brute_force_overlapping_vertices.size() );
-        
-        std::sort( overlapping_vertices.begin(), overlapping_vertices.end() );
-        std::sort( brute_force_overlapping_vertices.begin(), brute_force_overlapping_vertices.end() );
-        
-        for ( size_t k = 0; k < overlapping_vertices.size(); ++k )
-        {
-            assert( overlapping_vertices[k] == brute_force_overlapping_vertices[k] );
-        }
-        
-    }
-    
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Caution: slow!
-/// Check the consistency of the broad phase by comparing against the N^2 broadphase.  Checks using current and predicted vertex 
-/// positions.
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::check_continuous_broad_phase_is_up_to_date() const
-{
-    
-    // Verify by running against the n^2 broad phase
-    
-    //
-    // vertex vs triangle
-    //
-    
-    for ( size_t i = 0; i < get_num_vertices(); ++i )
-    {
-        if ( m_mesh.vertex_is_deleted(i) ) { continue; }
-        
-        // First, accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        vertex_continuous_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_triangles;
-        m_broad_phase->get_potential_triangle_collisions(aabb_low, aabb_high, true, true, overlapping_triangles); 
-        
-        // filter deleted triangles
-        for ( int k = 0; k < (int)overlapping_triangles.size(); ++k )
-        {
-            if ( m_mesh.triangle_is_deleted( overlapping_triangles[k] ) )
-            {
-                overlapping_triangles.erase( overlapping_triangles.begin() + k );
-                --k;
-            }
-        }
-        
-        // Second, brute force check
-        
-        std::vector<size_t> brute_force_overlapping_triangles;
-        
-        for ( size_t j = 0; j < m_mesh.num_triangles(); ++j )
-        {
-            if ( m_mesh.triangle_is_deleted(j) ) { continue; }
-            
-            Vec3d tri_aabb_low, tri_aabb_high;
-            triangle_continuous_bounds( j, tri_aabb_low, tri_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, tri_aabb_low, tri_aabb_high ) )
-            {
-                brute_force_overlapping_triangles.push_back( j );            
-            }
-        }
-        
-        assert( overlapping_triangles.size() == brute_force_overlapping_triangles.size() );
-        
-        std::sort(overlapping_triangles.begin(), overlapping_triangles.end());
-        std::sort(brute_force_overlapping_triangles.begin(), brute_force_overlapping_triangles.end());
-        
-        for ( size_t k = 0; k < overlapping_triangles.size(); ++k )
-        {
-            assert( overlapping_triangles[k] == brute_force_overlapping_triangles[k] );
-        }
-        
-    }
-    
-    //
-    // edge vs edge
-    //
-    
-    for ( size_t i = 0; i < m_mesh.m_edges.size(); ++i )
-    {
-        if ( m_mesh.edge_is_deleted(i) ) { continue; }
-        
-        // Accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        edge_continuous_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_edges;
-        m_broad_phase->get_potential_edge_collisions( aabb_low, aabb_high, true, true, overlapping_edges );
-        
-        // filter deleted edges
-        for ( int k = 0; k < (int)overlapping_edges.size(); ++k )
-        {
-            if ( m_mesh.edge_is_deleted( overlapping_edges[k] ) )
-            {
-                overlapping_edges.erase( overlapping_edges.begin() + k );
-                --k;
-            }
-        }
-        
-        // Brute force
-        std::vector<size_t> brute_force_overlapping_edges;
-        for ( size_t j = 0; j < m_mesh.m_edges.size(); ++j )
-        {
-            if ( m_mesh.edge_is_deleted(j) ) { continue; }
-            
-            Vec3d edge_aabb_low, edge_aabb_high;
-            edge_continuous_bounds( j, edge_aabb_low, edge_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, edge_aabb_low, edge_aabb_high ) )
-            {
-                brute_force_overlapping_edges.push_back( j );
-            }
-        }
-        
-        if ( overlapping_edges.size() != brute_force_overlapping_edges.size() )
-        {
-            
-            std::cout << "edge " << i << ": " << m_mesh.m_edges[i] << std::endl;
-            std::cout << "overlapping_edges.size(): " << overlapping_edges.size() << std::endl;
-            for ( size_t k = 0; k < overlapping_edges.size(); ++k )
-            {
-                std::cout << k << ": " << overlapping_edges[k] << std::endl;
-            }
-            
-            std::cout << "brute_force_overlapping_edges.size(): " << brute_force_overlapping_edges.size() << std::endl;
-            for ( size_t k = 0; k < brute_force_overlapping_edges.size(); ++k )
-            {
-                std::cout << k << ": " << brute_force_overlapping_edges[k] << std::endl;
-            }
-            
-        }
-        
-        assert( overlapping_edges.size() == brute_force_overlapping_edges.size() );
-        
-        std::sort( overlapping_edges.begin(), overlapping_edges.end() );
-        std::sort( brute_force_overlapping_edges.begin(), brute_force_overlapping_edges.end() );
-        
-        for ( size_t k = 0; k < overlapping_edges.size(); ++k )
-        {
-            assert( overlapping_edges[k] == brute_force_overlapping_edges[k] );
-        }
-    }
-    
-    //
-    // triangle vs vertex
-    //
-    
-    for ( size_t i = 0; i < m_mesh.num_triangles(); ++i )
-    {
-        if ( m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        // Accelerated broad phase
-        
-        Vec3d aabb_low, aabb_high;
-        triangle_continuous_bounds( i, aabb_low, aabb_high );
-        
-        std::vector<size_t> overlapping_vertices;
-        m_broad_phase->get_potential_vertex_collisions( aabb_low, aabb_high, true, true, overlapping_vertices );
-        
-        // filter deleted vertices
-        for ( int k = 0; k < (int)overlapping_vertices.size(); ++k )
-        {
-            if ( m_mesh.vertex_is_deleted( overlapping_vertices[k] ) )
-            {
-                overlapping_vertices.erase( overlapping_vertices.begin() + k );
-                --k;
-            }
-        }
-        
-        // Brute force
-        std::vector<size_t> brute_force_overlapping_vertices;
-        for ( size_t j = 0; j < get_num_vertices(); ++j )
-        {
-            if ( m_mesh.vertex_is_deleted(j) ) { continue; }
-            
-            Vec3d vertex_aabb_low, vertex_aabb_high;
-            vertex_continuous_bounds( j, vertex_aabb_low, vertex_aabb_high );
-            
-            if ( aabbs_intersect( aabb_low, aabb_high, vertex_aabb_low, vertex_aabb_high ) )
-            {
-                brute_force_overlapping_vertices.push_back( j );
-            }
-        }
-        
-        if ( overlapping_vertices.size() != brute_force_overlapping_vertices.size() )
-        {
-            std::cout << "triangle " << i << ": " << m_mesh.get_triangle(i) << std::endl;
-            std::cout << "overlapping_vertices.size(): " << overlapping_vertices.size() << std::endl;
-            for ( size_t k = 0; k < overlapping_vertices.size(); ++k )
-            {
-                std::cout << k << ": " << overlapping_vertices[k] << " --- ";
-                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( overlapping_vertices[k] ) << std::endl;
-            }
-            
-            std::cout << "brute_force_overlapping_vertices.size(): " << brute_force_overlapping_vertices.size() << std::endl;
-            for ( size_t k = 0; k < brute_force_overlapping_vertices.size(); ++k )
-            {
-                std::cout << k << ": " << brute_force_overlapping_vertices[k] << " --- ";
-                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( brute_force_overlapping_vertices[k] ) << std::endl;
-                
-                Vec3d lo, hi;
-                bool is_solid = vertex_is_solid( brute_force_overlapping_vertices[k] );
-                m_broad_phase->get_vertex_aabb( brute_force_overlapping_vertices[k], is_solid, lo, hi );
-                std::cout << "AABB: " << lo << " - " << hi << std::endl;
-                std::cout << "x: " << pm_positions[brute_force_overlapping_vertices[k]] << ", new_x: " << pm_newpositions[brute_force_overlapping_vertices[k]] << std::endl;
-                
-                bool query_overlaps_broadphase_aabb = aabbs_intersect( aabb_low, aabb_high, lo, hi );
-                std::cout << "query_overlaps_broadphase_aabb: " << query_overlaps_broadphase_aabb << std::endl;
-                
-                
-                BroadPhaseGrid* grid_bf = static_cast<BroadPhaseGrid*>(m_broad_phase);
-                
-                const std::vector<Vec3st>& cells = grid_bf->m_dynamic_vertex_grid.m_elementidxs[ brute_force_overlapping_vertices[k] ];
-                std::cout << "cells: " << std::endl;
-                for ( size_t m = 0; m < cells.size(); ++m )
-                {
-                    std::cout << cells[m] << std::endl;
-                }
-                
-            }
-        }
-        
-        assert( overlapping_vertices.size() == brute_force_overlapping_vertices.size() );
-        
-        std::sort( overlapping_vertices.begin(), overlapping_vertices.end() );
-        std::sort( brute_force_overlapping_vertices.begin(), brute_force_overlapping_vertices.end() );
-        
-        for ( size_t k = 0; k < overlapping_vertices.size(); ++k )
-        {
-            assert( overlapping_vertices[k] == brute_force_overlapping_vertices[k] );
-        }
-        
-    }
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Check a triangle (by index) vs all other triangles for any kind of intersection
-///
-// --------------------------------------------------------
-
-bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( size_t tri_index  )
-{
-    return check_triangle_vs_all_triangles_for_intersection( m_mesh.get_triangle(tri_index) );
-}
-
-// --------------------------------------------------------
-///
-/// Check a triangle vs all other triangles for any kind of intersection
-///
-// --------------------------------------------------------
-
-bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( const Vec3st& tri )
-{
-    bool any_intersection = false;
-    
-    std::vector<size_t> overlapping_triangles;
-    Vec3d low, high;
-    
-    minmax( get_position(tri[0]), get_position(tri[1]), low, high );
-    low -= Vec3d(m_aabb_padding);
-    high += Vec3d(m_aabb_padding);
-    
-    m_broad_phase->get_potential_triangle_collisions( low, high, true, true, overlapping_triangles );
-    
-    for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-    {
-        
-        const Vec3st& curr_tri = m_mesh.get_triangle( overlapping_triangles[i] );
-        bool result = check_edge_triangle_intersection_by_index( tri[0], tri[1],
-                                                                curr_tri[0], curr_tri[1], curr_tri[2],
-                                                                get_positions(),
-                                                                false );
-        
-        if ( result )
-        {
-            check_edge_triangle_intersection_by_index( tri[0], tri[1],
-                                                      curr_tri[0], curr_tri[1], curr_tri[2],
-                                                      get_positions(),
-                                                      true );
-            
-            any_intersection = true;
-        }
-    }
-    
-    minmax( get_position(tri[1]), get_position(tri[2]), low, high );
-    low -= Vec3d(m_aabb_padding);
-    high += Vec3d(m_aabb_padding);
-    
-    overlapping_triangles.clear();
-    m_broad_phase->get_potential_triangle_collisions( low, high, true, true,  overlapping_triangles );
-    
-    for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-    {
-        const Vec3st& curr_tri = m_mesh.get_triangle( overlapping_triangles[i] );
-        
-        bool result = check_edge_triangle_intersection_by_index( tri[1], tri[2],
-                                                                curr_tri[0], curr_tri[1], curr_tri[2],
-                                                                get_positions(),
-                                                                false );
-        
-        if ( result )
-        {
-            check_edge_triangle_intersection_by_index( tri[1], tri[2],
-                                                      curr_tri[0], curr_tri[1], curr_tri[2],
-                                                      get_positions(),
-                                                      true );
-            
-            any_intersection = true;
-        }
-    }
-    
-    minmax( get_position(tri[2]), get_position(tri[0]), low, high );
-    low -= Vec3d(m_aabb_padding);
-    high += Vec3d(m_aabb_padding);
-    
-    overlapping_triangles.clear();
-    m_broad_phase->get_potential_triangle_collisions( low, high, true, true, overlapping_triangles );
-    
-    for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-    {
-        const Vec3st& curr_tri = m_mesh.get_triangle( overlapping_triangles[i] );
-        
-        bool result = check_edge_triangle_intersection_by_index( tri[2], tri[0],
-                                                                curr_tri[0], curr_tri[1], curr_tri[2],
-                                                                get_positions(),
-                                                                false );
-        
-        if ( result )
-        {
-            check_edge_triangle_intersection_by_index( tri[2], tri[0],
-                                                      curr_tri[0], curr_tri[1], curr_tri[2],
-                                                      get_positions(),
-                                                      true );
-            
-            any_intersection = true;         
-        }
-    }
-    
-    //
-    // edges
-    //
-    
-    minmax( get_position(tri[0]), get_position(tri[1]), get_position(tri[2]), low, high );
-    low -= Vec3d(m_aabb_padding);
-    high += Vec3d(m_aabb_padding);
-    
-    std::vector<size_t> overlapping_edges;
-    m_broad_phase->get_potential_edge_collisions( low, high, true, true, overlapping_edges );
-    
-    for ( size_t i = 0; i < overlapping_edges.size(); ++i )
-    {
-        
-        bool result = check_edge_triangle_intersection_by_index(m_mesh.m_edges[overlapping_edges[i]][0], 
-                                                                m_mesh.m_edges[overlapping_edges[i]][1], 
-                                                                tri[0], tri[1], tri[2],
-                                                                get_positions(),
-                                                                false );
-        
-        if ( result )
-        {
-            check_edge_triangle_intersection_by_index(m_mesh.m_edges[overlapping_edges[i]][0], 
-                                                      m_mesh.m_edges[overlapping_edges[i]][1], 
-                                                      tri[0], tri[1], tri[2],
-                                                      get_positions(),
-                                                      true );
-            
-            any_intersection = true;         
-        }
-    }
-    
-    return any_intersection;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Detect all edge-triangle intersections.
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::get_intersections( bool degeneracy_counts_as_intersection, 
-                                       bool use_new_positions, 
-                                       std::vector<Intersection>& intersections )
-{
-    
-    //assert( degeneracy_counts_as_intersection == false );
-    
-    //   if ( use_new_positions )
-    //   {
-    //      check_continuous_broad_phase_is_up_to_date();
-    //   }
-    //   else
-    //   {
-    //      check_static_broad_phase_is_up_to_date();
-    //   }
-    
-    for ( size_t i = 0; i < m_mesh.num_triangles(); ++i )
-    {
-        std::vector<size_t> edge_candidates;
-        
-        bool get_solid_edges = !triangle_is_solid(i);
-        
-        Vec3d low, high;
-        triangle_static_bounds( i, low, high );       
-        m_broad_phase->get_potential_edge_collisions( low, high, get_solid_edges, true, edge_candidates );
-        
-        const Vec3st& triangle = m_mesh.get_triangle(i);
-        
-        if ( triangle[0] == triangle[1] || triangle[1] == triangle[2] || triangle[2] == triangle[0] )    { continue; }
-        
-        assert( m_mesh.get_edge_index( triangle[0], triangle[1] ) != m_mesh.m_edges.size() );
-        assert( m_mesh.get_edge_index( triangle[1], triangle[2] ) != m_mesh.m_edges.size() );
-        assert( m_mesh.get_edge_index( triangle[2], triangle[0] ) != m_mesh.m_edges.size() );
-        
-        for ( size_t j = 0; j < edge_candidates.size(); ++j )
-        {
-            
-            assert ( !triangle_is_solid( i ) || !edge_is_solid( edge_candidates[j] ) );
-            
-            const Vec2st& edge = m_mesh.m_edges[ edge_candidates[j] ];
-            
-            if ( edge[0] == edge[1] )    { continue; }
-            
-            if (    edge[0] == triangle[0] || edge[0] == triangle[1] || edge[0] == triangle[2] 
-                || edge[1] == triangle[0] || edge[1] == triangle[1] || edge[1] == triangle[2] )
-            {
-                continue;
-            }
-            
-            const Vec3d& e0 = use_new_positions ? get_newposition(edge[0]) : get_position(edge[0]);
-            const Vec3d& e1 = use_new_positions ? get_newposition(edge[1]) : get_position(edge[1]);
-            const Vec3d& t0 = use_new_positions ? get_newposition(triangle[0]) : get_position(triangle[0]);
-            const Vec3d& t1 = use_new_positions ? get_newposition(triangle[1]) : get_position(triangle[1]);
-            const Vec3d& t2 = use_new_positions ? get_newposition(triangle[2]) : get_position(triangle[2]);
-            
-            if ( segment_triangle_intersection( e0, edge[0], 
-                                               e1, edge[1],
-                                               t0, triangle[0], 
-                                               t1, triangle[1], 
-                                               t2, triangle[2], 
-                                               degeneracy_counts_as_intersection, m_verbose ) )
-            {
-                std::cout << "intersection: " << edge << " vs " << triangle << std::endl;
-                std::cout << "e0: " << e0 << std::endl;
-                std::cout << "e1: " << e1 << std::endl;
-                std::cout << "t0: " << t0 << std::endl;
-                std::cout << "t1: " << t1 << std::endl;
-                std::cout << "t2: " << t2 << std::endl;            
-                
-                intersections.push_back( Intersection( edge_candidates[j], i ) );
-            }
-            
-        }
-        
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Fire an assert if any edge is intersecting any triangles
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::assert_mesh_is_intersection_free( bool degeneracy_counts_as_intersection )
-{
-    
-    std::vector<Intersection> intersections;
-    get_intersections( degeneracy_counts_as_intersection, false, intersections );
-    
-    for ( size_t i = 0; i < intersections.size(); ++i )
-    {
-        
-        const Vec3st& triangle = m_mesh.get_triangle( intersections[i].m_triangle_index );
-        const Vec2st& edge = m_mesh.m_edges[ intersections[i].m_edge_index ];
-        
-        std::cout << "Intersection!  Triangle " << triangle << " vs edge " << edge << std::endl;
-        
-        segment_triangle_intersection( get_position(edge[0]), edge[0], 
-                                      get_position(edge[1]), edge[1],
-                                      get_position(triangle[0]), triangle[0],
-                                      get_position(triangle[1]), triangle[1], 
-                                      get_position(triangle[2]), triangle[2],
-                                      true, true );
-        
-        assert( false );
-        
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Using m_newpositions as the geometry, fire an assert if any edge is intersecting any triangles.
-/// This is a useful debugging tool, as it will detect any missed collisions before the mesh is advected
-/// into an intersecting state.
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::assert_predicted_mesh_is_intersection_free( bool degeneracy_counts_as_intersection )
-{
-    
-    std::vector<Intersection> intersections;
-    get_intersections( degeneracy_counts_as_intersection, true, intersections );
-    
-    for ( size_t i = 0; i < intersections.size(); ++i )
-    {
-        
-        const Vec3st& triangle = m_mesh.get_triangle( intersections[i].m_triangle_index );
-        const Vec2st& edge = m_mesh.m_edges[ intersections[i].m_edge_index ];
-        
-        std::cout << "Intersection!  Triangle " << triangle << " vs edge " << edge << std::endl;
-        
-        segment_triangle_intersection(get_position(edge[0]), edge[0], 
-                                      get_position(edge[1]), edge[1],
-                                      get_position(triangle[0]), triangle[0],
-                                      get_position(triangle[1]), triangle[1], 
-                                      get_position(triangle[2]), triangle[2],
-                                      true, true );
-        
-        const Vec3d& ea = get_position(edge[0]);
-        const Vec3d& eb = get_position(edge[1]);
-        const Vec3d& ta = get_position(triangle[0]);
-        const Vec3d& tb = get_position(triangle[1]);
-        const Vec3d& tc = get_position(triangle[2]);
-        
-        m_verbose = true;
-        
-        std::vector<Collision> check_collisions;
-        m_collision_pipeline->detect_collisions( check_collisions );
-        std::cout << "number of collisions detected: " << check_collisions.size() << std::endl;
-        
-        for ( size_t c = 0; c < check_collisions.size(); ++c )
-        {
-            const Collision& collision = check_collisions[c];
-            std::cout << "Collision " << c << ": " << std::endl;
-            if ( collision.m_is_edge_edge )
-            {
-                std::cout << "edge-edge: ";
-            }
-            else
-            {
-                std::cout << "point-triangle: ";
-            }
-            std::cout << collision.m_vertex_indices << std::endl;
-            
-        }
-        
-        std::cout << "-----\n edge-triangle check using m_positions:" << std::endl;
-        
-        bool result = segment_triangle_intersection( get_position(edge[0]), edge[0], 
-                                                    get_position(edge[1]), edge[1],
-                                                    get_position(triangle[0]), triangle[0], 
-                                                    get_position(triangle[1]), triangle[1],
-                                                    get_position(triangle[2]), triangle[2],
-                                                    degeneracy_counts_as_intersection, 
-                                                    m_verbose );
-        
-        std::cout << "result: " << result << std::endl;
-        
-        std::cout << "-----\n edge-triangle check using new m_positions" << std::endl;
-        
-        result = segment_triangle_intersection( get_newposition(edge[0]), edge[0], 
-                                               get_newposition(edge[1]), edge[1],
-                                               get_newposition(triangle[0]), triangle[0], 
-                                               get_newposition(triangle[1]), triangle[1],
-                                               get_newposition(triangle[2]), triangle[2],
-                                               degeneracy_counts_as_intersection, 
-                                               m_verbose );
-        
-        std::cout << "result: " << result << std::endl;
-        
-        const Vec3d& ea_new = get_newposition(edge[0]);
-        const Vec3d& eb_new = get_newposition(edge[1]);
-        const Vec3d& ta_new = get_newposition(triangle[0]);
-        const Vec3d& tb_new = get_newposition(triangle[1]);
-        const Vec3d& tc_new = get_newposition(triangle[2]);
-        
-        std::cout.precision(20);
-        
-        std::cout << "old: (edge0 edge1 tri0 tri1 tri2 )" << std::endl;
-        
-        std::cout << "Vec3d ea( " << ea[0] << ", " << ea[1] << ", " << ea[2] << ");" << std::endl;
-        std::cout << "Vec3d eb( " << eb[0] << ", " << eb[1] << ", " << eb[2] << ");" << std::endl;            
-        std::cout << "Vec3d ta( " << ta[0] << ", " << ta[1] << ", " << ta[2] << ");" << std::endl;
-        std::cout << "Vec3d tb( " << tb[0] << ", " << tb[1] << ", " << tb[2] << ");" << std::endl;            
-        std::cout << "Vec3d tc( " << tc[0] << ", " << tc[1] << ", " << tc[2] << ");" << std::endl;
-        
-        std::cout << "Vec3d ea_new( " << ea_new[0] << ", " << ea_new[1] << ", " << ea_new[2] << ");" << std::endl;
-        std::cout << "Vec3d eb_new( " << eb_new[0] << ", " << eb_new[1] << ", " << eb_new[2] << ");" << std::endl;            
-        std::cout << "Vec3d ta_new( " << ta_new[0] << ", " << ta_new[1] << ", " << ta_new[2] << ");" << std::endl;
-        std::cout << "Vec3d tb_new( " << tb_new[0] << ", " << tb_new[1] << ", " << tb_new[2] << ");" << std::endl;            
-        std::cout << "Vec3d tc_new( " << tc_new[0] << ", " << tc_new[1] << ", " << tc_new[2] << ");" << std::endl;
-        
-        std::vector<double> possible_times;
-        
-        Vec3d normal;
-        
-        std::cout << "-----" << std::endl;
-        
-        assert( !segment_segment_collision(ea, ea_new, edge[0], eb, eb_new, edge[1], 
-                                           ta, ta_new, triangle[0], tb, tb_new, triangle[1] ) );
-        
-        std::cout << "-----" << std::endl;
-        
-        assert( !segment_segment_collision(ea, ea_new, edge[0], eb, eb_new, edge[1], 
-                                           tb, tb_new, triangle[1], tc, tc_new, triangle[2] ) );
-        
-        std::cout << "-----" << std::endl;
-        
-        assert( !segment_segment_collision(ea, ea_new, edge[0], eb, eb_new, edge[1], 
-                                           ta, ta_new, triangle[0], tc, tc_new, triangle[2] ) );
-        
-        std::cout << "-----" << std::endl;
-        
-        assert( !point_triangle_collision(ea, ea_new, edge[0], ta, ta_new, triangle[0], 
-                                          tb, tb_new, triangle[1], tc, tc_new, triangle[2] ) );
-        
-        std::cout << "-----" << std::endl;
-        
-        assert( !point_triangle_collision(eb, eb_new, edge[1], ta, ta_new, triangle[0], 
-                                          tb, tb_new, triangle[1], tc, tc_new, triangle[2] ) );
-        
-        m_verbose = false;
-        
-        std::cout << "no collisions detected" << std::endl;
-        
-        assert( false );
-        
-    }
-    
-}
-
-
-
-
-
diff --git a/extern/eltopo/eltopo3d/dynamicsurface.h b/extern/eltopo/eltopo3d/dynamicsurface.h
deleted file mode 100644
index 3137d69..0000000
--- a/extern/eltopo/eltopo3d/dynamicsurface.h
+++ /dev/null
@@ -1,1067 +0,0 @@
-// ---------------------------------------------------------
-//
-//  dynamicsurface.h
-//  Tyson Brochu 2008
-//  
-//  A triangle mesh with associated vertex locations and  masses.  Query functions for getting geometry info.
-//
-//  The most important function is integrate(), which advances the mesh vertices from m_positions to m_newpositions, while 
-//  performing collision detection and resolution.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_DYNAMICSURFACE_H
-#define EL_TOPO_DYNAMICSURFACE_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <ccd_wrapper.h>
-#include <nondestructivetrimesh.h>
-#include <limits>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-// Broad-phase collision detector.  Avoids performing collision detection between far-away primitives.
-class BroadPhase;
-
-// Class for encapsulating all collision detection and resolution functionality.
-class CollisionPipeline;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Edge-triangle intersection info.
-///
-// --------------------------------------------------------
-
-struct Intersection
-{
-    
-    /// Constructor
-    ///
-    Intersection(size_t edge_index, 
-                 size_t triangle_index ) :
-    m_edge_index( edge_index ),
-    m_triangle_index( triangle_index )
-    {}
-    
-    /// The index of the edge intersecting the triangle
-    ///
-    size_t m_edge_index;
-    
-    /// Index of the triangle intersecting the edge
-    ///
-    size_t m_triangle_index;
-    
-};
-
-
-// --------------------------------------------------------
-///
-/// A surface mesh.  Essentially consists of a NonDestructiveTriMesh object coupled with a set of vertex locations in 3D space.
-///
-// --------------------------------------------------------
-
-class DynamicSurface
-{
-    
-public:
-    
-    /// Create a DynamicSurface object from the specified vertices, triangles, and vertex masses.
-    ///
-    DynamicSurface( const std::vector<Vec3d>& vs, 
-                   const std::vector<Vec3st>& ts, 
-                   const std::vector<double>& masses,
-                   double in_proximity_epsilon = 1e-4,
-                   double in_friction_coefficient = 0.0,
-                   bool in_collision_safety = true,
-                   bool in_verbose = false );
-    
-    /// Destructor
-    /// 
-    virtual ~DynamicSurface(); 
-    
-private:
-    
-    /// Disallowed, do not implement
-    ///
-    DynamicSurface( const DynamicSurface& );
-    
-    /// Disallowed, do not implement
-    ///
-    DynamicSurface& operator=( const DynamicSurface& );
-    
-public:
-    
-    /// Advance from current state to a collision-free state as close as possible to predicted state.
-    /// 
-    virtual void integrate( double dt, double& actual_dt );
-
-    //
-    // Utility
-    //
-
-    /// Break up the triangle mesh into connected components, determine surface IDs for all vertices.
-    ///
-    void partition_surfaces( std::vector<size_t>& surface_ids, std::vector< std::vector< size_t> >& surfaces ) const;
-    
-    /// Compute the area of the specified triangle
-    ///
-    inline double get_triangle_area(size_t tri) const;
-    
-    /// Compute the area of the specified triangle
-    ///    
-    inline double get_triangle_area(const Vec3st& tri) const;
-    
-    /// Compute the area of the specified triangle
-    ///
-    inline double get_triangle_area(size_t v0, size_t v1, size_t v2) const;
-    
-    /// Get the smallest triangle in the mesh by area.
-    ///
-    inline double get_min_triangle_area( size_t& out_triangle_index ) const;
-    
-    /// Compute the vector normal to the specified triangle's plane
-    ///
-    inline Vec3d get_triangle_normal(size_t tri) const;
-    
-    /// Compute the vector normal to the specified triangle's plane
-    ///    
-    inline Vec3d get_triangle_normal(const Vec3st& tri) const;
-    
-    /// Compute the vector normal to the specified triangle's plane
-    ///    
-    inline Vec3d get_triangle_normal(size_t v0, size_t v1, size_t v2) const;
-    
-    /// Compute the specified triangle's barycenter
-    ///    
-    inline Vec3d get_triangle_barycenter( size_t triangle_index ) const;
-    
-    /// Get an estimate for the surface normal at the specified vertex. Computed using an unweighted average of the normals of 
-    /// incident triangles.
-    ///
-    inline Vec3d get_vertex_normal( size_t vertex ) const;
-    
-    /// Compute all vertex normals, using an unweighted average of incident triangle normals.
-    ///
-    void get_all_vertex_normals( std::vector<Vec3d>& normals ) const;
-    
-    /// Get an estimate for the surface normal at the specified vertex. Computed using a weighted average as described in [Max 1999].
-    ///
-    inline Vec3d get_vertex_normal_max( size_t vertex_index ) const;
-    
-    /// Compute the edge length of the specified edge
-    ///
-    inline double get_edge_length( size_t edge_index ) const;
-    
-    /// Get the average edge length over all edges
-    ///
-    inline double get_average_edge_length() const;
-    
-    /// Get the average edge length, disregarding edges with vertices marked as solid
-    ///
-    inline double get_average_non_solid_edge_length() const;
-    
-    /// Determine if the vertex is on a solid surface (has infinite mass).
-    ///
-    inline bool vertex_is_solid( size_t vertex_index ) const;
-    
-    /// Determine if the edge is on a solid surface (has infinite mass).
-    ///
-    inline bool edge_is_solid( size_t eedge_index ) const;
-    
-    /// Determine if the triangle is on a solid surface (has infinite mass).
-    ///    
-    inline bool triangle_is_solid( size_t triangle_index ) const;
-    
-    /// Compute the total surface area defined by the mesh
-    ///
-    inline double get_surface_area( ) const;
-    
-    /// Compute the total surface area using predicted vertex locations (m_newpositions)
-    ///
-    inline double get_predicted_surface_area() const;
-    
-    /// Compute the volume enclosed by the surface
-    ///
-    inline double get_volume() const;
-    
-    /// Compute the volume enclosed by the surface, using predicted vertex locations (m_newpositions)
-    ///
-    inline double get_predicted_volume() const;
-    
-    /// Compute the distance from the given point to the surface.  Also return the index of the closest triangle.
-    ///
-    double distance_to_surface( const Vec3d& p, size_t& out_closest_triangle ) const;
-    
-    /// Determine the rank of the primary space at the given vertex (see Jiao07).
-    /// Rank {1, 2, 3} == {smooth, ridge, peak}
-    ///
-    unsigned int vertex_primary_space_rank( size_t v ) const;
-    
-
-    //
-    // Broad phase collision detector
-    //
-    
-    /// Delete and rebuild the broad phase object, using AABBs defined from m_positions.
-    ///
-    void rebuild_static_broad_phase( );
-    
-    /// Delete and rebuild the broad phase object, using AABBs defined from m_positions and m_newpositions.
-    ///
-    void rebuild_continuous_broad_phase( );
-    
-    /// Assume that the specified vertex has moved.  Update the broadphase entries of the vertex, its incident edges and incident 
-    /// triangles.
-    ///
-    void update_static_broad_phase( size_t vertex_index );
-    
-    /// Assume that the specified vertex has moved.  Update the broadphase entries of the vertex, its incident edges and incident 
-    /// triangles, using current and predicted positions.
-    ///    
-    void update_continuous_broad_phase( size_t vertex_index );  
-    
-    /// Get the padded AABB of the specified vertex using current positions.
-    ///
-    void vertex_static_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const;
-    
-    /// Get the padded AABB of the specified edge using current positions.
-    ///
-    void edge_static_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const;
-    
-    /// Get the padded AABB of the specified triangle using current positions.
-    ///
-    void triangle_static_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const; 
-    
-    /// Get the padded AABB of the specified vertex using current and predicted positions.
-    ///
-    void vertex_continuous_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const;
-    
-    /// Get the padded AABB of the specified edge using current and predicted positions.
-    ///    
-    void edge_continuous_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const;
-    
-    /// Get the padded AABB of the specified triangle using current and predicted positions.
-    ///        
-    void triangle_continuous_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const;
-    
-    /// Caution: slow!
-    /// Check the consistency of the broad phase by comparing against the N^2 broadphase.
-    ///
-    void check_static_broad_phase_is_up_to_date() const;
-    
-    /// Caution: slow!
-    /// Check the consistency of the broad phase by comparing against the N^2 broadphase.  Checks using current and predicted vertex 
-    /// positions.
-    void check_continuous_broad_phase_is_up_to_date() const;
-    
-    // 
-    // Intersection detection 
-    //
-    
-    /// Get the set of triangles intersected by the given segment. Also returns the barycentric coordinate along the segment of each
-    /// intersection.
-    ///
-    void get_triangle_intersections(const Vec3d& segment_point_a, 
-                                    const Vec3d& segment_point_b,
-                                    std::vector<double>& hit_ss,
-                                    std::vector<size_t>& hit_triangles ) const;
-    
-    /// Count the number of triangles intersected by the given segment.
-    ///
-    size_t get_number_of_triangle_intersections( const Vec3d& segment_point_a, 
-                                                const Vec3d& segment_point_b ) const;
-    
-    /// Using exact intersection testing, count the number of triangle intersected by the given segment.
-    ///
-    size_t get_number_of_triangle_intersections_exact( const Vec3d& segment_point_a, 
-                                                      const Vec3d& segment_point_b ) const;
-    
-    /// Test the given triangle against all other triangles in the mesh for intersection.
-    ///
-    bool check_triangle_vs_all_triangles_for_intersection( size_t tri_index );
-    
-    /// Test the given triangle against all other triangles in the mesh for intersection.
-    ///
-    bool check_triangle_vs_all_triangles_for_intersection( const Vec3st& tri );
-    
-    /// Get all self-intersections in the surface
-    ///
-    void get_intersections(bool degeneracy_counts_as_intersection, 
-                           bool use_new_positions, 
-                           std::vector<Intersection>& intersections );
-    
-    /// Look for self-intersections, but stop when the first one is found
-    ///
-    void get_first_intersection( bool degeneracy_counts_as_intersection, 
-                                bool use_new_positions, 
-                                Intersection& intersections );
-    
-    /// Fire an assert if the mesh contains a self-intersection. Uses m_positions as the vertex locations.
-    ///
-    void assert_mesh_is_intersection_free( bool degeneracy_counts_as_intersection );              
-    
-    /// Using m_newpositions as the vertex locations, fire an assert if the mesh contains a self-intersection.
-    ///
-    void assert_predicted_mesh_is_intersection_free( bool degeneracy_counts_as_intersection ); 
-
-    /// Returns the number of vertices in the mesh, including any vertices marked as deleted
-    ///
-    inline size_t get_num_vertices() const;
-    
-    /// Returns the current positions of a vertex.
-    ///
-    inline const Vec3d& get_position( size_t index ) const;
-
-    /// Returns the set of all current vertex positions.
-    ///
-    inline const std::vector<Vec3d>& get_positions( ) const;
-    
-    /// Set the current position of an individual vertex.
-    ///
-    inline void set_position( size_t index, const Vec3d& x );   
-    
-    /// Set the current positions of all vertices in the mesh.
-    ///
-    inline void set_all_positions( const std::vector<Vec3d>& xs );
-    
-    /// Set the current positions of all vertices in the mesh, from a C-array of doubles
-    ///
-    inline void set_all_positions( size_t n, const double* xs );
-    
-    /// Copy predicted vertex positions into the current positions
-    ///
-    inline void set_positions_to_newpositions();
-
-    /// Returns the predicted position of a vertex.
-    ///
-    inline const Vec3d& get_newposition( size_t index ) const;
-    
-    /// Returns the set of all predicted vertex positions.
-    ///
-    inline const std::vector<Vec3d>& get_newpositions( ) const;
-    
-    /// Set the predicted position of an individual vertex.
-    ///
-    inline void set_newposition( size_t index, const Vec3d& x );   
-    
-    /// Set the predicted positions of all vertices in the mesh.
-    ///
-    inline void set_all_newpositions( const std::vector<Vec3d>& xs );
-    
-    /// Set the predicted positions of all vertices in the mesh from a C-array.
-    ///
-    inline void set_all_newpositions( size_t n, const double* xs );
-    
-    
-    //
-    // Data members
-    //
-    
-    /// Elements closer than this have repulsion forces applied
-    ///
-    double m_proximity_epsilon;
-    
-    /// Dump lots of details to stdout
-    ///
-    bool m_verbose;
-    
-    /// Ensure that no mesh elements intersect, during mesh moving and mesh maintenance
-    ///
-    bool m_collision_safety;
-    
-    /// Vertex positions, predicted locations, velocities and masses
-    ///
-    std::vector<double> m_masses;
-    
-    /// The mesh graph
-    ///
-    NonDestructiveTriMesh m_mesh;
-    
-    /// collision acceleration structures
-    ///
-    BroadPhase* m_broad_phase;
-    
-    /// Encapsulates the collision detection functionality
-    ///
-    CollisionPipeline* m_collision_pipeline;
-    
-    /// Amount to pad AABBs by when doing broad-phase collision detection
-    ///
-    double m_aabb_padding;
-    
-protected:
-    
-    friend class CollisionPipeline;
-    friend class ImpactZoneSolver;
-    friend class MeshSmoother;
-    
-    /// Current and predicted vertex positions
-    ///
-    std::vector<Vec3d> pm_positions, pm_newpositions;
-    
-    /// Temporary velocities field
-    ///
-    std::vector<Vec3d> m_velocities;
-    
-};
-
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Compute area of a triangle specified by three vertices
-///
-// --------------------------------------------------------
-
-inline double triangle_area( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
-{
-    return 0.5 * mag( cross( v1 - v0, v2 - v0 ) );
-}
-
-// --------------------------------------------------------
-///
-/// Compute area of a triangle specified by a triangle index
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_triangle_area(size_t tri) const
-{
-    const Vec3st &t = m_mesh.get_triangle( tri ); 
-    return get_triangle_area(t[0], t[1], t[2]);
-}
-
-// --------------------------------------------------------
-///
-/// Compute area of a triangle specified by a triple of vertex indices
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_triangle_area(const Vec3st& tri) const
-{
-    return get_triangle_area(tri[0], tri[1], tri[2]);
-}
-
-// --------------------------------------------------------
-///
-/// Compute area of a triangle specified by a three vertex indices
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_triangle_area(size_t v0, size_t v1, size_t v2) const
-{
-    const Vec3d &p0 = get_position(v0);
-    const Vec3d &p1 = get_position(v1);
-    const Vec3d &p2 = get_position(v2);
-    
-    return 0.5 * mag(cross(p1-p0, p2-p0));
-}
-
-// --------------------------------------------------------
-///
-/// Compute the normal of a triangle specified by three vertices
-///
-// --------------------------------------------------------
-
-inline Vec3d triangle_normal( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
-{
-    Vec3d u = v1 - v0;
-    Vec3d v = v2 - v0;
-    return normalized(cross(u, v));
-}
-
-// --------------------------------------------------------
-///
-/// Compute the normal of a triangle specified by a triangle index
-///
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_triangle_normal(size_t tri) const
-{
-    const Vec3st &t = m_mesh.get_triangle( tri ); 
-    return get_triangle_normal(t[0], t[1], t[2]);
-}
-
-// --------------------------------------------------------
-///
-/// Compute the normal of a triangle specified by a triple of vertex indices
-///
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_triangle_normal(const Vec3st& tri) const
-{
-    return get_triangle_normal(tri[0], tri[1], tri[2]);
-}
-
-// --------------------------------------------------------
-///
-/// Compute the normal of a triangle specified by three vertex indices
-///
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_triangle_normal(size_t v0, size_t v1, size_t v2) const
-{
-    Vec3d u = get_position(v1) - get_position(v0);
-    Vec3d v = get_position(v2) - get_position(v0);
-    return normalized(cross(u, v));
-}
-
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_triangle_barycenter( size_t triangle_index ) const
-{
-    const Vec3st& tri = m_mesh.get_triangle( triangle_index );
-    return 1.0 / 3.0 * ( get_position( tri[0] ) + get_position( tri[1] ) + get_position( tri[2] ) );
-}
-
-// --------------------------------------------------------
-///
-/// Return the triangle with the the smallest area, and that area
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_min_triangle_area( size_t& triangle_index ) const
-{
-    double min_area = BIG_DOUBLE;
-    for ( size_t i = 0; i < m_mesh.num_triangles(); ++i )
-    {
-        if ( m_mesh.get_triangle(i)[0] == m_mesh.get_triangle(i)[1] )
-        {
-            continue;
-        }
-        
-        double area = get_triangle_area(i);
-        if ( area < min_area )
-        {
-            min_area = area;
-            triangle_index = i;
-        }
-    }
-    
-    return min_area;
-}
-
-// --------------------------------------------------------
-///
-/// Compute surface normal at the specified vertex (unweighted average of incident triangle normals).
-///
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_vertex_normal( size_t vertex ) const
-{
-    Vec3d normal(0,0,0);
-    for ( size_t i = 0; i < m_mesh.m_vertex_to_triangle_map[vertex].size(); ++i )
-    {
-        normal += get_triangle_normal( m_mesh.m_vertex_to_triangle_map[vertex][i] );
-    }
-    normal /= double(m_mesh.m_vertex_to_triangle_map[vertex].size());
-    normal /= mag(normal);
-    
-    return normal;
-}
-
-// --------------------------------------------------------
-///
-/// Compute surface normal at the specified vertex (weighted according to [Max 1999]).
-///
-// --------------------------------------------------------
-
-inline Vec3d DynamicSurface::get_vertex_normal_max( size_t vertex_index ) const
-{
-    const std::vector<size_t>& inc_tris = m_mesh.m_vertex_to_triangle_map[vertex_index];
-    
-    Vec3d sum_cross_products(0,0,0);
-    
-    for ( size_t i = 0; i < inc_tris.size(); ++i )
-    {
-        const Vec3st& curr_tri = m_mesh.get_triangle( inc_tris[i] );
-        
-        if ( curr_tri[0] == curr_tri[1] ) { continue; }
-        
-        Vec2ui other_two;
-        NonDestructiveTriMesh::index_in_triangle( curr_tri, vertex_index, other_two );
-        
-        size_t verti = curr_tri[other_two[0]];
-        size_t vertnext = curr_tri[other_two[1]];
-        
-        Vec3d vi = get_position(verti) - get_position(vertex_index);
-        Vec3d vnext = get_position(vertnext) - get_position(vertex_index);
-        
-        sum_cross_products += cross( vi, vnext ) / ( mag2(vi)*mag2(vnext) );
-    }
-    
-    sum_cross_products /= mag( sum_cross_products );
-    
-    return sum_cross_products;
-}
-
-
-// --------------------------------------------------------
-///
-/// Compute length of the specified edge
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_edge_length( size_t edge_index ) const
-{
-    return mag( get_position( m_mesh.m_edges[edge_index][1] ) - get_position( m_mesh.m_edges[edge_index][0] ) );
-}
-
-// --------------------------------------------------------
-///
-/// Compute average length over all mesh edges
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_average_edge_length() const
-{
-    double sum_lengths = 0;
-    for ( size_t i = 0; i < m_mesh.m_edges.size(); ++i )
-    {
-        const Vec2st& e = m_mesh.m_edges[i]; 
-        if ( e[0] == e[1] )  { continue; }
-        sum_lengths += mag( get_position(e[1]) - get_position(e[0]) ); 
-    }
-
-	double len = sum_lengths / (double) m_mesh.m_edges.size();
-
-    return len;   
-}
-
-// --------------------------------------------------------
-///
-/// Compute average length over edges on non-solid meshes
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_average_non_solid_edge_length() const
-{
-    double sum_lengths = 0;
-    size_t counted_edges = 0;
-    for ( size_t i = 0; i < m_mesh.m_edges.size(); ++i )
-    {
-        const Vec2st& e = m_mesh.m_edges[i]; 
-        if ( e[0] == e[1] )  { continue; }
-        if ( edge_is_solid(i) ) { continue; }
-        sum_lengths += mag( get_position(e[1]) - get_position(e[0]) ); 
-        ++counted_edges;
-    }
-    return sum_lengths / (double) counted_edges;   
-}
-
-// --------------------------------------------------------
-///
-/// Compute the surface area
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_surface_area( ) const
-{
-    double area=0;
-    const std::vector<Vec3st>& tris = m_mesh.get_triangles();
-    for(size_t t=0; t < tris.size(); ++t )
-    {
-        if ( tris[t][0] ==  tris[t][1] ) { continue; }
-        area += get_triangle_area(t);
-    }
-    return area;
-}
-// --------------------------------------------------------
-///
-/// Compute the surface area using predicted vertex locations
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_predicted_surface_area( ) const
-{
-    double area=0;
-    const std::vector<Vec3st>& tris = m_mesh.get_triangles();
-    for(size_t t=0; t < tris.size(); ++t )
-    {
-        if ( tris[t][0] ==  tris[t][1] ) { continue; }
-        const Vec3d &p0 = get_newposition(tris[t][0]);
-        const Vec3d &p1 = get_newposition(tris[t][1]);
-        const Vec3d &p2 = get_newposition(tris[t][2]);      
-        area += 0.5 * mag(cross(p1-p0, p2-p0));
-    }
-    return area;
-}
-
-// --------------------------------------------------------
-///
-/// Compute the volume enclosed by this surface
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_volume( ) const
-{
-    static const double inv_six = 1.0/6.0;
-    double volume=0;
-    const std::vector<Vec3st>& tris = m_mesh.get_triangles();
-    for(size_t t=0; t < tris.size(); ++t )
-    {
-        if ( tris[t][0] == tris[t][1] ) { continue; }
-        const Vec3st& tri = tris[t];
-        volume += inv_six * triple(get_position(tri[0]), get_position(tri[1]), get_position(tri[2]));
-    }
-    return volume;
-}
-
-// --------------------------------------------------------
-///
-/// Compute the volume using predicted vertex locations
-///
-// --------------------------------------------------------
-
-inline double DynamicSurface::get_predicted_volume( ) const
-{
-    static const double inv_six = 1.0/6.0;
-    double volume=0;
-    const std::vector<Vec3st>& tris = m_mesh.get_triangles();
-    for(size_t t=0; t < tris.size(); ++t )
-    {
-        if ( tris[t][0] ==  tris[t][1] ) { continue; }
-        const Vec3st& tri = tris[t];
-        volume += inv_six * triple(get_newposition(tri[0]), get_newposition(tri[1]), get_newposition(tri[2]));
-    }
-    return volume;
-}
-
-// --------------------------------------------------------
-///
-/// Return true if the specified vertex is solid (should be treated as having infinite mass).
-///
-// --------------------------------------------------------
-
-inline bool DynamicSurface::vertex_is_solid( size_t v ) const
-{
-    assert( v < m_masses.size() );
-    return ( m_masses[v] == std::numeric_limits<double>::infinity() );
-}
-
-// --------------------------------------------------------
-///
-/// Return true if either end vertex of the specified edge is solid (should be treated as having infinite mass).
-///
-// --------------------------------------------------------
-
-inline bool DynamicSurface::edge_is_solid( size_t e ) const
-{
-    const Vec2st& edge = m_mesh.m_edges[e];
-    return ( vertex_is_solid(edge[0]) || vertex_is_solid(edge[1]) );
-}
-
-// --------------------------------------------------------
-///
-/// Return true if any corner vertex of the specified triangle is solid (should be treated as having infinite mass).
-///
-// --------------------------------------------------------
-
-inline bool DynamicSurface::triangle_is_solid( size_t t ) const
-{
-    const Vec3st& tri = m_mesh.get_triangle(t);
-    return ( vertex_is_solid(tri[0]) || vertex_is_solid(tri[1]) || vertex_is_solid(tri[2]) );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Returns the number of vertices in the mesh, including any vertices marked as deleted
-///
-// ---------------------------------------------------------
-
-inline size_t DynamicSurface::get_num_vertices() const
-{
-    return pm_positions.size();
-}
-
-// ---------------------------------------------------------
-///
-/// Returns the current positions of a vertex.
-///
-// ---------------------------------------------------------
-
-inline const Vec3d& DynamicSurface::get_position( size_t index ) const
-{
-    assert( index < pm_positions.size() );
-    return pm_positions[index];   
-}
-
-// ---------------------------------------------------------
-///
-/// Returns the set of all current vertex positions.
-///
-// ---------------------------------------------------------
-
-inline const std::vector<Vec3d>& DynamicSurface::get_positions( ) const
-{
-    return pm_positions;
-}
-
-// ---------------------------------------------------------
-///
-/// Set the current position of an individual vertex.
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_position( size_t index, const Vec3d& x )
-{
-    assert( index < pm_positions.size() );
-    pm_positions[index] = x;
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        update_continuous_broad_phase( index );
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Set the current positions of all vertices in the mesh.
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_all_positions( const std::vector<Vec3d>& xs )
-{
-    pm_positions = xs;
-    pm_newpositions = xs;
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Set the current positions of all vertices in the mesh, from a C-array of doubles
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_all_positions( size_t n, const double* xs )
-{
-    pm_positions.resize(n);
-    for ( size_t i = 0; i < n; ++i )
-    {
-        pm_positions[i][0] = xs[3*i+0];
-        pm_positions[i][1] = xs[3*i+1];
-        pm_positions[i][2] = xs[3*i+2];
-    }
-    
-    pm_newpositions = pm_positions;
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Copy predicted vertex positions into the current positions
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_positions_to_newpositions()
-{
-    pm_positions = pm_newpositions;
-    
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Returns the predicted position of a vertex.
-///
-// ---------------------------------------------------------
-
-inline const Vec3d& DynamicSurface::get_newposition( size_t index ) const
-{
-    assert( index < pm_newpositions.size() );
-    return pm_newpositions[index];   
-}
-
-// ---------------------------------------------------------
-///
-/// Set the predicted position of an individual vertex.
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_newposition( size_t index, const Vec3d& x )
-{
-    assert( index < pm_newpositions.size() );
-    
-    pm_newpositions[index] = x;
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        update_continuous_broad_phase( index );
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Set the predicted positions of all vertices in the mesh.
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_all_newpositions( const std::vector<Vec3d>& xs )
-{
-    pm_newpositions = xs;
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Set the predicted positions of all vertices in the mesh from a C-array.
-///
-// ---------------------------------------------------------
-
-inline void DynamicSurface::set_all_newpositions( size_t n, const double* xs )
-{
-    pm_newpositions.resize(n);
-    for ( size_t i = 0; i < n; ++i )
-    {
-        pm_newpositions[i][0] = xs[3*i+0];
-        pm_newpositions[i][1] = xs[3*i+1];
-        pm_newpositions[i][2] = xs[3*i+2];
-    }
-    
-    // update broad phase
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-}
-
-// ---------------------------------------------------------
-///
-/// Returns the set of all predicted vertex positions.
-///
-// ---------------------------------------------------------
-
-inline const std::vector<Vec3d>& DynamicSurface::get_newpositions( ) const
-{
-    return pm_newpositions;
-}
-
-
-// --------------------------------------------------------
-///
-/// Returns true if the specified edge is intersecting the specified triangle
-///
-// --------------------------------------------------------
-
-inline bool check_edge_triangle_intersection_by_index( size_t edge_a, 
-                                                      size_t edge_b, 
-                                                      size_t triangle_a, 
-                                                      size_t triangle_b, 
-                                                      size_t triangle_c, 
-                                                      const std::vector<Vec3d>& m_positions, 
-                                                      bool verbose )
-{
-    if (    edge_a == triangle_a || edge_a == triangle_b || edge_a == triangle_c 
-        || edge_b == triangle_a || edge_b == triangle_b || edge_b == triangle_c )
-    {
-        return false;
-    }
-    
-    static const bool DEGEN_COUNTS_AS_INTERSECTION = true;
-    
-    return segment_triangle_intersection(m_positions[edge_a], edge_a, m_positions[edge_b], edge_b,
-                                         m_positions[triangle_a], triangle_a, 
-                                         m_positions[triangle_b], triangle_b, 
-                                         m_positions[triangle_c], triangle_c,
-                                         DEGEN_COUNTS_AS_INTERSECTION, verbose);
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Returns true if the an edge from one of the triangles intersects the other triangle.
-/// NOTE: Using this routine will produce duplicate checks.  Better to use check_edge_triangle_intersection where possible.
-///
-// --------------------------------------------------------
-
-inline bool check_triangle_triangle_intersection( Vec3st triangle_a, 
-                                                 Vec3st triangle_b, 
-                                                 const std::vector<Vec3d>& positions )
-{
-    if ( triangle_a[0] == triangle_a[1] || triangle_b[0] == triangle_b[1] )    
-    { 
-        return false; 
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_a[0], triangle_a[1], 
-                                                   triangle_b[0], triangle_b[1], triangle_b[2], 
-                                                   positions, false ) )
-    {
-        return true;
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_a[1], triangle_a[2], 
-                                                   triangle_b[0], triangle_b[1], triangle_b[2], 
-                                                   positions, false ) )
-    {
-        return true;
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_a[2], triangle_a[0], 
-                                                   triangle_b[0], triangle_b[1], triangle_b[2], 
-                                                   positions, false ) )
-    {
-        return true;
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_b[0], triangle_b[1], 
-                                                   triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                   positions, false ) )
-    {
-        return true;
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_b[1], triangle_b[2], 
-                                                   triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                   positions, false ) )
-    {
-        return true;
-    }
-    
-    if ( check_edge_triangle_intersection_by_index( triangle_b[2], triangle_b[0], 
-                                                   triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                   positions, false ) )
-    {
-		return true;
-    }
-    
-    return false;
-}
-
-#endif
-
-
diff --git a/extern/eltopo/eltopo3d/edgecollapser.cpp b/extern/eltopo/eltopo3d/edgecollapser.cpp
deleted file mode 100644
index f389e13..0000000
--- a/extern/eltopo/eltopo3d/edgecollapser.cpp
+++ /dev/null
@@ -1,871 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgecollapser.cpp
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge collapse" operation: removing short edges from the mesh.
-//
-// ---------------------------------------------------------
-
-#include <edgecollapser.h>
-
-#include <broadphase.h>
-#include <collisionpipeline.h>
-#include <collisionqueries.h>
-#include <nondestructivetrimesh.h>
-#include <runstats.h>
-#include <subdivisionscheme.h>
-#include <surftrack.h>
-#include <trianglequality.h>
-
-// ---------------------------------------------------------
-//  Extern globals
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Edge collapser constructor.  Takes a SurfTrack object and curvature-adaptive parameters.
-///
-// --------------------------------------------------------
-
-EdgeCollapser::EdgeCollapser( SurfTrack& surf, bool use_curvature, double min_curvature_multiplier ) :
-m_min_edge_length( UNINITIALIZED_DOUBLE ),
-m_use_curvature( use_curvature ),
-m_min_curvature_multiplier( min_curvature_multiplier ),
-m_surf( surf )
-{}
-
-
-// --------------------------------------------------------
-///
-/// Get all triangles which are incident on either edge end vertex.
-///
-// --------------------------------------------------------
-
-void EdgeCollapser::get_moving_triangles(size_t source_vertex, 
-                                         size_t destination_vertex, 
-                                         std::vector<size_t>& moving_triangles )
-{
-    
-    moving_triangles.clear();
-    
-    for ( size_t i = 0; i < m_surf.m_mesh.m_vertex_to_triangle_map[source_vertex].size(); ++i )
-    {
-        moving_triangles.push_back( m_surf.m_mesh.m_vertex_to_triangle_map[source_vertex][i] );
-    }
-    for ( size_t i = 0; i < m_surf.m_mesh.m_vertex_to_triangle_map[destination_vertex].size(); ++i )
-    {
-        moving_triangles.push_back( m_surf.m_mesh.m_vertex_to_triangle_map[destination_vertex][i] );
-    }
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Get all edges which are incident on either edge end vertex.
-///
-// --------------------------------------------------------
-
-void EdgeCollapser::get_moving_edges( size_t source_vertex, 
-                                     size_t destination_vertex, 
-                                     size_t,
-                                     std::vector<size_t>& moving_edges )
-{
-    
-    moving_edges = m_surf.m_mesh.m_vertex_to_edge_map[ source_vertex ];
-    moving_edges.insert( moving_edges.end(), m_surf.m_mesh.m_vertex_to_edge_map[ destination_vertex ].begin(), m_surf.m_mesh.m_vertex_to_edge_map[ destination_vertex ].end() );
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Check the "pseudo motion" introduced by a collapsing edge for collision
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::collapse_edge_pseudo_motion_introduces_collision( size_t source_vertex, 
-                                                                     size_t destination_vertex, 
-                                                                     size_t edge_index, 
-                                                                     const Vec3d& )
-{
-    assert( m_surf.m_collision_safety );
-    
-    // Get the set of triangles which move because of this motion
-    std::vector<size_t> moving_triangles;
-    get_moving_triangles( source_vertex, destination_vertex, moving_triangles );
-    
-    // And the set of edges
-    std::vector<size_t> moving_edges;
-    get_moving_edges( source_vertex, destination_vertex, edge_index, moving_edges );
-    
-    
-    // Check for collisions, holding everything static except for the source and destination vertices
-    
-    CollisionCandidateSet collision_candidates;
-    
-    // triangle-point candidates
-    for ( size_t i = 0; i < moving_triangles.size(); ++i )
-    { 
-        m_surf.m_collision_pipeline->add_triangle_candidates( moving_triangles[i], true, true, collision_candidates );
-    }      
-    
-    // point-triangle candidates
-    m_surf.m_collision_pipeline->add_point_candidates( source_vertex, true, true, collision_candidates );
-    m_surf.m_collision_pipeline->add_point_candidates( destination_vertex, true, true, collision_candidates );
-    
-    // edge-edge candidates
-    for ( size_t i = 0; i < moving_edges.size(); ++i )
-    {
-        m_surf.m_collision_pipeline->add_edge_candidates( moving_edges[i], true, true, collision_candidates );
-    }
-    
-    // Prune collision candidates containing both the source and destination vertex (they will trivially be collisions )
-    
-    for ( size_t i = 0; i < collision_candidates.size(); ++i )
-    {
-        const Vec3st& candidate = collision_candidates[i];
-        bool should_delete = false;
-        
-        if ( candidate[2] == 1 )
-        {
-            // edge-edge
-            const Vec2st& e0 = m_surf.m_mesh.m_edges[ candidate[0] ];
-            const Vec2st& e1 = m_surf.m_mesh.m_edges[ candidate[1] ];
-            
-            if ( e0[0] == source_vertex || e0[1] == source_vertex || e1[0] == source_vertex || e1[1] == source_vertex )
-            {
-                if ( e0[0] == destination_vertex || e0[1] == destination_vertex || e1[0] == destination_vertex || e1[1] == destination_vertex )
-                {
-                    should_delete = true;
-                }
-            }
-            
-        }
-        else
-        {
-            // point-triangle
-            size_t t = candidate[0];
-            const Vec3st& tri = m_surf.m_mesh.get_triangle(t);
-            size_t v = candidate[1];
-            
-            if ( v == source_vertex || tri[0] == source_vertex || tri[1] == source_vertex || tri[2] == source_vertex )
-            {
-                if ( v == destination_vertex || tri[0] == destination_vertex || tri[1] == destination_vertex || tri[2] == destination_vertex )
-                {
-                    should_delete = true;
-                }
-            }
-        }
-        
-        if ( should_delete )
-        {
-            collision_candidates.erase( collision_candidates.begin() + i );
-            --i;
-        }
-        
-    }
-    
-    Collision collision;
-    if ( m_surf.m_collision_pipeline->any_collision( collision_candidates, collision ) )
-    {
-        return true;
-    }
-    
-    return false;
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Determine if the edge collapse operation would invert the normal of any incident triangles.
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::collapse_edge_introduces_normal_inversion( size_t source_vertex, 
-                                                              size_t destination_vertex, 
-                                                              size_t edge_index, 
-                                                              const Vec3d& vertex_new_position )
-{
-    
-    // Get the set of triangles which are going to be deleted
-    std::vector< size_t >& triangles_incident_to_edge = m_surf.m_mesh.m_edge_to_triangle_map[edge_index];   
-    
-    // Get the set of triangles which move because of this motion
-    std::vector<size_t> moving_triangles;
-    for ( size_t i = 0; i < m_surf.m_mesh.m_vertex_to_triangle_map[source_vertex].size(); ++i )
-    {
-        moving_triangles.push_back( m_surf.m_mesh.m_vertex_to_triangle_map[source_vertex][i] );
-    }
-    for ( size_t i = 0; i < m_surf.m_mesh.m_vertex_to_triangle_map[destination_vertex].size(); ++i )
-    {
-        moving_triangles.push_back( m_surf.m_mesh.m_vertex_to_triangle_map[destination_vertex][i] );
-    }
-    
-    //
-    // check for normal inversion
-    //
-    
-    for ( size_t i = 0; i < moving_triangles.size(); ++i )
-    { 
-        
-        // Disregard triangles which will end up being deleted - those triangles incident to the collapsing edge.
-        bool triangle_will_be_deleted = false;
-        for ( size_t j = 0; j < triangles_incident_to_edge.size(); ++j )
-        {
-            if ( moving_triangles[i] == triangles_incident_to_edge[j] )
-            {
-                triangle_will_be_deleted = true;
-                break;
-            }
-        }
-        
-        if ( triangle_will_be_deleted ) { continue; }
-        
-        const Vec3st& current_triangle = m_surf.m_mesh.get_triangle( moving_triangles[i] );
-        Vec3d old_normal = m_surf.get_triangle_normal( current_triangle );
-        
-        Vec3d new_normal;
-        
-        double new_area;
-        if ( current_triangle[0] == source_vertex || current_triangle[0] == destination_vertex )
-        { 
-            new_normal = triangle_normal( vertex_new_position, m_surf.get_position(current_triangle[1]), m_surf.get_position(current_triangle[2]) ); 
-            new_area = triangle_area( vertex_new_position, m_surf.get_position(current_triangle[1]), m_surf.get_position(current_triangle[2]) ); 
-        }
-        else if ( current_triangle[1] == source_vertex || current_triangle[1] == destination_vertex ) 
-        { 
-            new_normal = triangle_normal( m_surf.get_position(current_triangle[0]), vertex_new_position, m_surf.get_position(current_triangle[2]) ); 
-            new_area = triangle_area( m_surf.get_position(current_triangle[0]), vertex_new_position, m_surf.get_position(current_triangle[2]) ); 
-        }
-        else 
-        { 
-            assert( current_triangle[2] == source_vertex || current_triangle[2] == destination_vertex ); 
-            new_normal = triangle_normal( m_surf.get_position(current_triangle[0]), m_surf.get_position(current_triangle[1]), vertex_new_position );
-            new_area = triangle_area( m_surf.get_position(current_triangle[0]), m_surf.get_position(current_triangle[1]), vertex_new_position );
-        }      
-        
-        if ( dot( new_normal, old_normal ) < 1e-5 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "collapse edge introduces normal inversion" << std::endl; }
-            
-            g_stats.add_to_int( "EdgeCollapser:collapse_normal_inversion", 1 );
-            
-            return true;
-        } 
-        
-        if ( new_area < m_surf.m_min_triangle_area )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "collapse edge introduces tiny triangle area" << std::endl; }
-            
-            g_stats.add_to_int( "EdgeCollapser:collapse_degenerate_triangle", 1 );
-            
-            return true;
-        } 
-        
-    }
-    
-    return false;
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Determine whether collapsing an edge will introduce an unacceptable change in volume.
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::collapse_edge_introduces_volume_change( size_t source_vertex, 
-                                                           size_t edge_index, 
-                                                           const Vec3d& vertex_new_position )
-{
-    //
-    // If any incident triangle has a tiny area, collapse the edge without regard to volume change
-    //
-    
-    const std::vector<size_t>& inc_tris = m_surf.m_mesh.m_edge_to_triangle_map[edge_index];
-    
-    for ( size_t i = 0; i < inc_tris.size(); ++i )
-    {
-        if ( m_surf.get_triangle_area( inc_tris[i] ) < m_surf.m_min_triangle_area )
-        {
-            return false;
-        }
-    }
-    
-    //
-    // Check volume change
-    //
-    
-    const std::vector< size_t >& triangles_incident_to_vertex = m_surf.m_mesh.m_vertex_to_triangle_map[source_vertex];
-    double volume_change = 0;
-    
-    for ( size_t i = 0; i < triangles_incident_to_vertex.size(); ++i )
-    {
-        const Vec3st& inc_tri = m_surf.m_mesh.get_triangle( triangles_incident_to_vertex[i] );
-        volume_change += signed_volume( vertex_new_position, m_surf.get_position(inc_tri[0]), m_surf.get_position(inc_tri[1]), m_surf.get_position(inc_tri[2]) );
-    }
-    
-    if ( fabs(volume_change) > m_surf.m_max_volume_change )
-    {
-        if ( m_surf.m_verbose ) { std::cout << "collapse edge introduces volume change"  << std::endl; }
-        return true;
-    }
-    
-    return false;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Returns true if the edge collapse would introduce a triangle with a min or max angle outside of the speficied min or max.
-///
-// ---------------------------------------------------------
-
-bool EdgeCollapser::collapse_edge_introduces_bad_angle(size_t source_vertex, 
-                                                       size_t destination_vertex, 
-                                                       const Vec3d& vertex_new_position )
-{
-    
-    std::vector<size_t> moving_triangles;
-    get_moving_triangles( source_vertex, destination_vertex,  moving_triangles );
-    
-    for ( size_t i = 0; i < moving_triangles.size(); ++i )
-    {
-        const Vec3st& tri = m_surf.m_mesh.get_triangle( moving_triangles[i] );
-        
-        Vec3d a = m_surf.get_position( tri[0] );
-        
-        if ( tri[0] == source_vertex || tri[0] == destination_vertex )
-        {
-            a = vertex_new_position;
-        }
-        
-        Vec3d b = m_surf.get_position( tri[1] );
-        
-        if ( tri[1] == source_vertex || tri[1] == destination_vertex )
-        {
-            b = vertex_new_position;
-        }
-        
-        Vec3d c = m_surf.get_position( tri[2] );
-        
-        if ( tri[2] == source_vertex || tri[2] == destination_vertex )
-        {
-            c = vertex_new_position;
-        }
-        
-        double min_angle = min_triangle_angle( a, b, c );
-        
-        if ( rad2deg(min_angle) < m_surf.m_min_triangle_angle )
-        {
-            return true;
-        }
-        
-        double max_angle = max_triangle_angle( a, b, c );
-        
-        if ( rad2deg(max_angle) > m_surf.m_max_triangle_angle )
-        {
-            return true;
-        }
-        
-    }
-    
-    return false;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Delete an edge by moving its source vertex to its destination vertex
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::collapse_edge( size_t edge )
-{
-    
-    size_t vertex_to_keep = m_surf.m_mesh.m_edges[edge][0];
-    size_t vertex_to_delete = m_surf.m_mesh.m_edges[edge][1];
-    
-    assert( !m_surf.m_mesh.m_is_boundary_vertex[vertex_to_keep] );
-    assert( !m_surf.m_mesh.m_is_boundary_vertex[vertex_to_delete] );
-    
-    if ( m_surf.m_verbose ) { std::cout << "Collapsing edge.  Doomed vertex: " << vertex_to_delete << " --- Vertex to keep: " << vertex_to_keep << std::endl; }
-    
-    // --------------
-    
-    // If we're disallowing topology changes, don't let an edge collapse form a degenerate tet
-    
-    if ( false == m_surf.m_allow_non_manifold )
-    {
-        
-        bool would_be_non_manifold = false;
-        
-        // for each triangle that *would* be created, make sure that there isn't already a triangle with those 3 vertices
-        
-        for ( size_t i = 0; i < m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_delete].size(); ++i )
-        {
-            Vec3st new_triangle = m_surf.m_mesh.get_triangle( m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_delete][i] );
-            if ( new_triangle[0] == vertex_to_delete )   { new_triangle[0] = vertex_to_keep; }
-            if ( new_triangle[1] == vertex_to_delete )   { new_triangle[1] = vertex_to_keep; }
-            if ( new_triangle[2] == vertex_to_delete )   { new_triangle[2] = vertex_to_keep; }
-            
-            for ( size_t j = 0; j < m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_keep].size(); ++j )
-            {
-                if ( NonDestructiveTriMesh::triangle_has_these_verts( m_surf.m_mesh.get_triangle( m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_keep][j] ), new_triangle ) )
-                {
-                    if ( m_surf.m_verbose ) { std::cout << "would_be_non_manifold" << std::endl; }
-                    would_be_non_manifold = true;
-                    return false;
-                }            
-            }
-        }
-        
-        assert ( !would_be_non_manifold );
-        
-        // Look for a vertex which is adjacent to both vertices on the edge, and which isn't on one of the incident triangles
-        
-        const std::vector< size_t >& triangles_incident_to_edge = m_surf.m_mesh.m_edge_to_triangle_map[edge];
-        std::vector< size_t > third_vertices;
-        
-        for ( size_t i = 0; i < triangles_incident_to_edge.size(); ++i )
-        {
-            const Vec3st& inc_triangle = m_surf.m_mesh.get_triangle( triangles_incident_to_edge[i] );
-            size_t opposite = m_surf.m_mesh.get_third_vertex( edge, inc_triangle );
-            third_vertices.push_back( opposite );
-        }
-        
-        std::vector<size_t> adj_vertices0, adj_vertices1;
-        m_surf.m_mesh.get_adjacent_vertices( vertex_to_delete, adj_vertices0 );
-        m_surf.m_mesh.get_adjacent_vertices( vertex_to_keep, adj_vertices1 );
-        
-        for ( size_t i = 0; i < adj_vertices0.size(); ++i )
-        {
-            for ( size_t j = 0; j < adj_vertices1.size(); ++j )
-            {
-                if ( adj_vertices0[i] == adj_vertices1[j] )
-                {
-                    bool is_on_inc_triangle = false;
-                    for ( size_t k = 0; k < third_vertices.size(); ++k )
-                    {
-                        if ( adj_vertices0[i] == third_vertices[k] )
-                        {
-                            is_on_inc_triangle = true;
-                            break;
-                        }
-                    }
-                    
-                    if ( !is_on_inc_triangle )
-                    {
-                        // found a vertex adjacent to both edge vertices, which doesn't lie on the incident triangles
-                        if ( m_surf.m_verbose )
-                        {
-                            std::cout << " --- Edge Collapser: found a vertex adjacent to both edge vertices, which doesn't lie on the incident triangles " << std::endl;
-                            std::cout << " --- Adjacent vertex: " << adj_vertices0[i] << ", incident triangles: ";
-                        }
-                        
-                        return false;
-                    }
-                    
-                }
-            }
-        }
-        
-        
-    }
-    
-    
-    // --------------
-    
-    {
-        const std::vector< size_t >& r_triangles_incident_to_edge = m_surf.m_mesh.m_edge_to_triangle_map[edge];
-        
-        // Do not collapse edge on a degenerate tet or degenerate triangle
-        for ( size_t i=0; i < r_triangles_incident_to_edge.size(); ++i )
-        {
-            const Vec3st& triangle_i = m_surf.m_mesh.get_triangle( r_triangles_incident_to_edge[i] );
-            
-            if ( triangle_i[0] == triangle_i[1] || triangle_i[1] == triangle_i[2] || triangle_i[2] == triangle_i[0] )
-            {
-                if ( m_surf.m_verbose ) { std::cout << "duplicate vertices on triangle" << std::endl; }
-                return false;
-            }
-            
-            for ( size_t j=i+1; j < r_triangles_incident_to_edge.size(); ++j )
-            {
-                const Vec3st& triangle_j = m_surf.m_mesh.get_triangle( r_triangles_incident_to_edge[j] );
-                
-                if ( NonDestructiveTriMesh::triangle_has_these_verts( triangle_i, triangle_j ) )            
-                {
-                    if ( m_surf.m_verbose ) { std::cout << "two triangles share vertices" << std::endl; }
-                    g_stats.add_to_int( "EdgeCollapser:collapse_degen_tet", 1 );
-                    return false;
-                }
-            }
-        }
-    }
-    
-    
-    // --------------
-    // decide on new vertex position
-    
-    // rank 1, 2, 3 = smooth, ridge, peak
-    // if the vertex ranks don't match, keep the higher rank vertex
-    
-    Vec3d vertex_new_position;
-    
-#define USE_VERTEX_RANKS
-#ifdef USE_VERTEX_RANKS
-    
-    unsigned int keep_rank = m_surf.vertex_primary_space_rank( vertex_to_keep );
-    unsigned int delete_rank = m_surf.vertex_primary_space_rank( vertex_to_delete );
-    
-    if ( m_surf.m_allow_vertex_movement )
-    {      
-        if ( keep_rank > delete_rank )
-        {
-            vertex_new_position = m_surf.get_position(vertex_to_keep);
-        }
-        else if ( delete_rank > keep_rank )
-        {
-            size_t tmp = vertex_to_delete;
-            vertex_to_delete = vertex_to_keep;
-            vertex_to_keep = tmp;
-            
-            vertex_new_position = m_surf.get_position(vertex_to_keep);
-        }
-        else
-        {
-            // ranks are equal
-            m_surf.m_subdivision_scheme->generate_new_midpoint( edge, m_surf, vertex_new_position );
-        }
-    }
-    else
-    {
-        // Not allowed to move the vertex tangential to the surface during improve
-        
-        if ( delete_rank > keep_rank )
-        {
-            size_t tmp = vertex_to_delete;
-            vertex_to_delete = vertex_to_keep;
-            vertex_to_keep = tmp;
-        }
-        
-        vertex_new_position = m_surf.get_position(vertex_to_keep);
-    }
-    
-#else
-    
-    m_surf.m_subdivision_scheme->generate_new_midpoint( edge, m_surf, vertex_new_position );
-    
-#endif
-    
-    
-    if ( m_surf.m_verbose ) { std::cout << "Collapsing edge.  Doomed vertex: " << vertex_to_delete << " --- Vertex to keep: " << vertex_to_keep << std::endl; }
-    
-    
-    
-    // --------------
-    
-    // Check vertex pseudo motion for collisions and volume change
-    
-    if ( mag ( m_surf.get_position(m_surf.m_mesh.m_edges[edge][1]) - m_surf.get_position(m_surf.m_mesh.m_edges[edge][0]) ) > 0 )
-    {
-        
-        // Change source vertex predicted position to superimpose onto dest vertex
-        m_surf.set_newposition( vertex_to_keep, vertex_new_position );
-        m_surf.set_newposition( vertex_to_delete, vertex_new_position );
-        
-        bool volume_change = collapse_edge_introduces_volume_change( vertex_to_delete, edge, vertex_new_position );
-        
-        if ( volume_change )
-        {
-            // Restore saved positions which were changed by the function we just called.
-            m_surf.set_newposition( vertex_to_keep, m_surf.get_position(vertex_to_keep) );
-            m_surf.set_newposition( vertex_to_delete, m_surf.get_position(vertex_to_delete) );
-            
-            g_stats.add_to_int( "EdgeCollapser:collapse_volume_change", 1 );
-            
-            if ( m_surf.m_verbose ) { std::cout << "collapse_volume_change" << std::endl; }
-            
-            return false;
-        }
-        
-        bool normal_inversion = collapse_edge_introduces_normal_inversion(  vertex_to_delete, vertex_to_keep, edge, vertex_new_position );
-        
-        if ( normal_inversion )
-        {
-            // Restore saved positions which were changed by the function we just called.
-            m_surf.set_newposition( vertex_to_keep, m_surf.get_position(vertex_to_keep) );
-            m_surf.set_newposition( vertex_to_delete, m_surf.get_position(vertex_to_delete) );
-            
-            if ( m_surf.m_verbose ) { std::cout << "normal_inversion" << std::endl; }
-            
-            return false;
-        }
-        
-        bool bad_angle = collapse_edge_introduces_bad_angle( vertex_to_delete, vertex_to_keep, vertex_new_position );
-        
-        if ( bad_angle )
-        {
-            // Restore saved positions which were changed by the function we just called.
-            m_surf.set_newposition( vertex_to_keep, m_surf.get_position(vertex_to_keep) );
-            m_surf.set_newposition( vertex_to_delete, m_surf.get_position(vertex_to_delete) );
-            
-            if ( m_surf.m_verbose ) { std::cout << "bad_angle" << std::endl; }
-            
-            g_stats.add_to_int( "EdgeCollapser:collapse_bad_angle", 1 );
-            
-            return false;
-            
-        }
-        
-        bool collision = false;
-        
-        if ( m_surf.m_collision_safety )
-        {
-            collision = collapse_edge_pseudo_motion_introduces_collision( vertex_to_delete, vertex_to_keep, edge, vertex_new_position );
-        }
-        
-        if ( collision ) 
-        { 
-            if ( m_surf.m_verbose ) { std::cout << "collision" << std::endl; }
-            g_stats.add_to_int( "EdgeCollapser:collapse_collisions", 1 ); 
-        }
-        
-        // Restore saved positions which were changed by the function we just called.
-        m_surf.set_newposition( vertex_to_keep, m_surf.get_position(vertex_to_keep) );
-        m_surf.set_newposition( vertex_to_delete, m_surf.get_position(vertex_to_delete) );
-        
-        if ( collision )
-        {
-            // edge collapse would introduce collision or change volume too much or invert triangle normals
-            return false;
-        }
-    }
-    
-    // --------------
-    
-    // move the vertex we decided to keep
-    
-    m_surf.set_position( vertex_to_keep, vertex_new_position );
-    m_surf.set_newposition( vertex_to_keep, vertex_new_position );
-    
-    
-    // Copy this vector, don't take a reference, as deleting will change the original
-    std::vector< size_t > triangles_incident_to_edge = m_surf.m_mesh.m_edge_to_triangle_map[edge];
-    
-    // Delete triangles incident on the edge
-    
-    for ( size_t i=0; i < triangles_incident_to_edge.size(); ++i )
-    {
-        if ( m_surf.m_verbose )
-        {
-            std::cout << "removing edge-incident triangle: " << m_surf.m_mesh.get_triangle( triangles_incident_to_edge[i] ) << std::endl;
-        }
-        
-        m_surf.remove_triangle( triangles_incident_to_edge[i] );
-    }
-    
-    // Find anything pointing to the doomed vertex and change it
-    
-    // copy the list of triangles, don't take a refence to it
-    std::vector< size_t > triangles_incident_to_vertex = m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_delete];    
-    
-    for ( size_t i=0; i < triangles_incident_to_vertex.size(); ++i )
-    {
-        assert( triangles_incident_to_vertex[i] != triangles_incident_to_edge[0] );
-        assert( triangles_incident_to_vertex[i] != triangles_incident_to_edge[1] );
-        
-        Vec3st new_triangle = m_surf.m_mesh.get_triangle( triangles_incident_to_vertex[i] );
-        
-        if ( new_triangle[0] == vertex_to_delete )   { new_triangle[0] = vertex_to_keep; }
-        if ( new_triangle[1] == vertex_to_delete )   { new_triangle[1] = vertex_to_keep; }
-        if ( new_triangle[2] == vertex_to_delete )   { new_triangle[2] = vertex_to_keep; }
-        
-        if ( m_surf.m_verbose ) { std::cout << "adding updated triangle: " << new_triangle << std::endl; }
-        
-        size_t new_triangle_index = m_surf.add_triangle( new_triangle );
-        
-        m_surf.m_dirty_triangles.push_back( new_triangle_index );
-    }
-    
-    for ( size_t i=0; i < triangles_incident_to_vertex.size(); ++i )
-    {  
-        if ( m_surf.m_verbose )
-        {
-            std::cout << "removing vertex-incident triangle: " << m_surf.m_mesh.get_triangle( triangles_incident_to_vertex[i] ) << std::endl;
-        }
-        
-        m_surf.remove_triangle( triangles_incident_to_vertex[i] );
-    }
-    
-    // Delete vertex
-    assert( m_surf.m_mesh.m_vertex_to_triangle_map[vertex_to_delete].empty() );
-    m_surf.remove_vertex( vertex_to_delete );
-    
-    m_surf.m_mesh.update_is_boundary_vertex( vertex_to_keep );
-    
-    return true;
-}
-
-// --------------------------------------------------------
-///
-/// Determine if the edge should be allowed to collapse
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::edge_is_collapsible( size_t edge_index )
-{
-    
-    // skip deleted and solid edges
-    if ( m_surf.m_mesh.edge_is_deleted(edge_index) ) { return false; }
-    if ( m_surf.edge_is_solid(edge_index) ) { return false; }
-    
-    // skip non-manifold and boundary edges
-    if ( m_surf.m_mesh.m_edge_to_triangle_map[edge_index].size() != 2 ) { return false; }
-    if ( m_surf.m_mesh.m_is_boundary_edge[edge_index] ) { return false; }
-    
-    // also skip edges with one vertex on a boundary
-    const Vec2st& edge = m_surf.m_mesh.m_edges[edge_index];
-    if ( m_surf.m_mesh.m_is_boundary_vertex[edge[0]] || m_surf.m_mesh.m_is_boundary_vertex[edge[1]] ) { return false; }
-    
-    return true;
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Collapse all short edges
-///
-// --------------------------------------------------------
-
-bool EdgeCollapser::collapse_pass()
-{
-    
-    if ( m_surf.m_verbose )
-    {
-        std::cout << "\n\n\n---------------------- EdgeCollapser: collapsing ----------------------" << std::endl;
-        std::cout << "m_min_edge_length: " << m_min_edge_length;
-        std::cout << ", m_use_curvature: " << m_use_curvature;
-        std::cout << ", m_min_curvature_multiplier: " << m_min_curvature_multiplier << std::endl;
-        std::cout << "m_surf.m_collision_safety: " << m_surf.m_collision_safety << std::endl;
-    }
-    
-    bool collapse_occurred = false;
-    
-    assert( m_surf.m_dirty_triangles.size() == 0 );
-    
-    std::vector<SortableEdge> sortable_edges_to_try;
-    
-    
-    //
-    // get set of edges to collapse
-    //
-    
-    for( size_t i = 0; i < m_surf.m_mesh.m_edges.size(); i++ )
-    {    
-        if ( m_surf.m_mesh.edge_is_deleted(i) )   { continue; }  // skip deleted edges
-        if ( m_surf.edge_is_solid(i) ) { continue; }             // skip solids
-        
-        if ( m_surf.m_mesh.m_edge_to_triangle_map[i].size() < 2 )  { continue; }  // skip boundary edges
-        
-        if( m_surf.m_mesh.m_is_boundary_vertex[m_surf.m_mesh.m_edges[i][0]] || 
-           m_surf.m_mesh.m_is_boundary_vertex[m_surf.m_mesh.m_edges[i][1]] )
-        {
-            continue;
-        }
-        
-        double current_length;
-        
-        if ( m_use_curvature )
-        {
-            current_length = get_curvature_scaled_length( m_surf, m_surf.m_mesh.m_edges[i][0], m_surf.m_mesh.m_edges[i][1], m_min_curvature_multiplier, 1e+30 );
-        }
-        else
-        {
-            current_length = m_surf.get_edge_length(i);
-        }
-        
-        if ( current_length < m_min_edge_length )
-        {
-            sortable_edges_to_try.push_back( SortableEdge( i, current_length ) );
-        }
-    }
-    
-    //
-    // sort in ascending order by length (collapse shortest edges first)
-    //
-    
-    std::sort( sortable_edges_to_try.begin(), sortable_edges_to_try.end() );
-    
-    if ( m_surf.m_verbose )
-    {
-        std::cout << sortable_edges_to_try.size() << " candidate edges sorted" << std::endl;
-        std::cout << "total edges: " << m_surf.m_mesh.m_edges.size() << std::endl;
-    }
-    
-    //
-    // attempt to collapse each edge in the sorted list
-    //
-    
-    for ( size_t si = 0; si < sortable_edges_to_try.size(); ++si )
-    {
-        size_t e = sortable_edges_to_try[si].m_edge_index;
-        
-        assert( e < m_surf.m_mesh.m_edges.size() );
-        
-        if ( m_surf.m_mesh.edge_is_deleted(e) ) { continue; }
-        
-        double edge_length;
-        
-        if ( m_use_curvature )
-        {
-            edge_length = get_curvature_scaled_length( m_surf, m_surf.m_mesh.m_edges[e][0], m_surf.m_mesh.m_edges[e][1], m_min_curvature_multiplier, 1e+30 );
-        }
-        else
-        {
-            edge_length = m_surf.get_edge_length(e);
-        }
-        
-        if ( edge_length < m_min_edge_length )
-        {        
-            
-            if ( m_surf.m_mesh.m_edges[e][0] == m_surf.m_mesh.m_edges[e][1] )   { continue; }     // skip deleted edges         
-            if ( m_surf.m_mesh.m_edge_to_triangle_map[e].size() < 2 )  { continue; }  // skip boundary edges
-            
-            if( m_surf.m_mesh.m_is_boundary_vertex[m_surf.m_mesh.m_edges[e][0]] || 
-               m_surf.m_mesh.m_is_boundary_vertex[m_surf.m_mesh.m_edges[e][1]] )
-            {
-                continue;
-            }
-            
-            bool result = collapse_edge( e );
-            
-            if ( result )
-            { 
-                // clean up degenerate triangles and tets
-                m_surf.trim_non_manifold( m_surf.m_dirty_triangles );            
-            }
-            
-            collapse_occurred |= result;
-            
-        }
-    }
-    
-    return collapse_occurred;
-    
-    
-}
-
diff --git a/extern/eltopo/eltopo3d/edgecollapser.h b/extern/eltopo/eltopo3d/edgecollapser.h
deleted file mode 100644
index 0d46e52..0000000
--- a/extern/eltopo/eltopo3d/edgecollapser.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgecollapser.h
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge collapse" operation: removing short edges from the mesh.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_EDGECOLLAPSER_H
-#define EL_TOPO_EDGECOLLAPSER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,double> Vec3d;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Edge collapser object.  Removes edges smaller than the specified threshold, optionally scaling measures by mean curvature.
-///
-// ---------------------------------------------------------
-
-class EdgeCollapser
-{
-    
-public:
-    
-    /// Edge collapser constructor.  Takes a SurfTrack object and curvature-adaptive parameters.
-    ///
-    EdgeCollapser( SurfTrack& surf, bool use_curvature, double min_curvature_multiplier );
-
-    /// Collapse all short edges
-    ///
-    bool collapse_pass();
-    
-    
-    /// Mimimum edge length.  Edges shorter than this will be collapsed.
-    ///
-    double m_min_edge_length;   
-    
-    /// Whether to scale by curvature when computing edge lengths, in order to coarsen low-curvature regions
-    ///
-    bool m_use_curvature;
-    
-    /// The minimum curvature scaling allowed
-    ///
-    double m_min_curvature_multiplier;
-    
-private:
-    
-    friend class SurfTrack;
-    
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;
-
-    /// Get all triangles which are incident on either edge end vertex.
-    ///
-    void get_moving_triangles(size_t source_vertex, 
-                              size_t destination_vertex, 
-                              std::vector<size_t>& moving_triangles );
-    
-    
-    /// Get all edges which are incident on either edge end vertex.
-    ///
-    void get_moving_edges(size_t source_vertex, 
-                          size_t destination_vertex, 
-                          size_t edge_index,
-                          std::vector<size_t>& moving_edges );
-    
-    /// Check the "pseudo motion" introduced by a collapsing edge for collision
-    ///
-    bool collapse_edge_pseudo_motion_introduces_collision( size_t source_vertex, 
-                                                          size_t destination_vertex, 
-                                                          size_t edge_index, 
-                                                          const Vec3d& vertex_new_position );
-    
-    /// Determine if the edge collapse operation would invert the normal of any incident triangles.
-    ///
-    bool collapse_edge_introduces_normal_inversion( size_t source_vertex, 
-                                                   size_t destination_vertex, 
-                                                   size_t edge_index, 
-                                                   const Vec3d& vertex_new_position );
-    
-    /// Determine whether collapsing an edge will introduce an unacceptable change in volume.
-    ///
-    bool collapse_edge_introduces_volume_change( size_t source_vertex, 
-                                                size_t edge_index, 
-                                                const Vec3d& vertex_new_position );   
-    
-    /// Returns true if the edge collapse would introduce a triangle with a min or max angle outside of the speficied min or max.
-    ///
-    bool collapse_edge_introduces_bad_angle( size_t source_vertex, 
-                                            size_t destination_vertex, 
-                                            const Vec3d& vertex_new_position );
-    
-    /// Delete an edge by moving its source vertex to its destination vertex
-    ///
-    bool collapse_edge( size_t edge );
-    
-    /// Determine if the edge should be allowed to collapse
-    ///
-    bool edge_is_collapsible( size_t edge_index );
-    
-    
-};
-
-#endif
-
-
diff --git a/extern/eltopo/eltopo3d/edgeflipper.cpp b/extern/eltopo/eltopo3d/edgeflipper.cpp
deleted file mode 100644
index e7a92e0..0000000
--- a/extern/eltopo/eltopo3d/edgeflipper.cpp
+++ /dev/null
@@ -1,540 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgeflipper.cpp
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge flip" operation: replacing non-delaunay edges with their dual edge.
-//
-// ---------------------------------------------------------
-
-#include <edgeflipper.h>
-
-#include <broadphase.h>
-#include <collisionqueries.h>
-#include <nondestructivetrimesh.h>
-#include <runstats.h>
-#include <surftrack.h>
-#include <trianglequality.h>
-
-// ---------------------------------------------------------
-//  Extern globals
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Check whether the new triangles created by flipping an edge introduce any intersection
-///
-// --------------------------------------------------------
-
-bool EdgeFlipper::flip_introduces_collision( size_t edge_index, 
-                                            const Vec2st& new_edge, 
-                                            const Vec3st& new_triangle_a, 
-                                            const Vec3st& new_triangle_b )
-{  
-    
-    NonDestructiveTriMesh& m_mesh = m_surf.m_mesh;
-    const std::vector<Vec3d>& xs = m_surf.get_positions();
-    
-    if ( !m_surf.m_collision_safety )
-    {
-        return false;
-    }
-    
-    const Vec2st& old_edge = m_mesh.m_edges[edge_index];
-    
-    size_t tet_vertex_indices[4] = { old_edge[0], old_edge[1], new_edge[0], new_edge[1] };
-    
-    const Vec3d tet_vertex_positions[4] = { xs[ tet_vertex_indices[0] ], 
-        xs[ tet_vertex_indices[1] ], 
-        xs[ tet_vertex_indices[2] ], 
-        xs[ tet_vertex_indices[3] ] };
-    
-    Vec3d low, high;
-    minmax( tet_vertex_positions[0], tet_vertex_positions[1], tet_vertex_positions[2], tet_vertex_positions[3], low, high );
-    
-    std::vector<size_t> overlapping_vertices;
-    m_surf.m_broad_phase->get_potential_vertex_collisions( low, high, true, true, overlapping_vertices );
-    
-    // do point-in-tet tests
-    for ( size_t i = 0; i < overlapping_vertices.size(); ++i ) 
-    { 
-        if ( (overlapping_vertices[i] == old_edge[0]) || (overlapping_vertices[i] == old_edge[1]) || 
-            (overlapping_vertices[i] == new_edge[0]) || (overlapping_vertices[i] == new_edge[1]) ) 
-        {
-            continue;
-        }
-        
-        if ( point_tetrahedron_intersection( xs[overlapping_vertices[i]], overlapping_vertices[i],
-                                            tet_vertex_positions[0], tet_vertex_indices[0],
-                                            tet_vertex_positions[1], tet_vertex_indices[1],
-                                            tet_vertex_positions[2], tet_vertex_indices[2],
-                                            tet_vertex_positions[3], tet_vertex_indices[3] ) ) 
-        {
-            return true;
-        }
-    }
-    
-    //
-    // Check new triangle A vs existing edges
-    //
-    
-    minmax( xs[new_triangle_a[0]], xs[new_triangle_a[1]], xs[new_triangle_a[2]], low, high );
-    std::vector<size_t> overlapping_edges;
-    m_surf.m_broad_phase->get_potential_edge_collisions( low, high, true, true, overlapping_edges );
-    
-    for ( size_t i = 0; i < overlapping_edges.size(); ++i )
-    {
-        size_t overlapping_edge_index = overlapping_edges[i];
-        const Vec2st& edge = m_mesh.m_edges[overlapping_edge_index];
-        
-        if ( check_edge_triangle_intersection_by_index( edge[0], edge[1], 
-                                                       new_triangle_a[0], new_triangle_a[1], new_triangle_a[2], 
-                                                       xs, m_surf.m_verbose ) )
-        {
-            return true;
-        }      
-    }
-    
-    //
-    // Check new triangle B vs existing edges
-    //
-    
-    minmax( xs[new_triangle_b[0]], xs[new_triangle_b[1]], xs[new_triangle_b[2]], low, high );
-    
-    overlapping_edges.clear();
-    m_surf.m_broad_phase->get_potential_edge_collisions( low, high, true, true, overlapping_edges );
-    
-    for ( size_t i = 0; i < overlapping_edges.size(); ++i )
-    {
-        size_t overlapping_edge_index = overlapping_edges[i];
-        const Vec2st& edge = m_mesh.m_edges[overlapping_edge_index];
-        
-        if ( check_edge_triangle_intersection_by_index( edge[0], edge[1], 
-                                                       new_triangle_b[0], new_triangle_b[1], new_triangle_b[2], 
-                                                       xs, m_surf.m_verbose ) )
-        {
-            return true;
-        }      
-    }
-    
-    //
-    // Check new edge vs existing triangles
-    //   
-    
-    minmax( xs[new_edge[0]], xs[new_edge[1]], low, high );
-    std::vector<size_t> overlapping_triangles;
-    m_surf.m_broad_phase->get_potential_triangle_collisions( low, high, true, true, overlapping_triangles );
-    
-    for ( size_t i = 0; i <  overlapping_triangles.size(); ++i )
-    {
-        const Vec3st& tri = m_mesh.get_triangle(overlapping_triangles[i]);
-        
-        if ( check_edge_triangle_intersection_by_index( new_edge[0], new_edge[1],
-                                                       tri[0], tri[1], tri[2],
-                                                       xs, m_surf.m_verbose ) )
-        {         
-            return true;
-        }                                              
-    }
-    
-    return false;
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Flip an edge: remove the edge and its incident triangles, then add a new edge and two new triangles
-///
-// --------------------------------------------------------
-
-bool EdgeFlipper::flip_edge( size_t edge, 
-                            size_t tri0, 
-                            size_t tri1, 
-                            size_t third_vertex_0, 
-                            size_t third_vertex_1 )
-{  
-    
-    g_stats.add_to_int( "EdgeFlipper:edge_flip_attempt", 1 );
-    
-    NonDestructiveTriMesh& m_mesh = m_surf.m_mesh;
-    const std::vector<Vec3d>& xs = m_surf.get_positions();
-    
-    Vec2st& edge_vertices = m_mesh.m_edges[edge];
-    
-    // Find the vertices which will form the new edge
-    Vec2st new_edge( third_vertex_0, third_vertex_1);
-    
-    // --------------
-    
-    // Control volume change
-    double vol = fabs( signed_volume( xs[edge_vertices[0]], 
-                                     xs[edge_vertices[1]], 
-                                     xs[new_edge[0]], 
-                                     xs[new_edge[1]] ) ); 
-    
-    if ( vol > m_surf.m_max_volume_change )
-    {
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_volume_change", 1 );
-        if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: volume change = " << vol << std::endl; }
-        return false;
-    }
-    
-    // --------------
-    
-    // Prevent non-manifold surfaces if we're not allowing them
-    if ( false == m_surf.m_allow_non_manifold )
-    {
-        for ( size_t i = 0; i < m_mesh.m_vertex_to_edge_map[ third_vertex_0 ].size(); ++i )
-        {
-            if ( ( m_mesh.m_edges[ m_mesh.m_vertex_to_edge_map[third_vertex_0][i] ][0] == third_vertex_1 ) ||
-                ( m_mesh.m_edges[ m_mesh.m_vertex_to_edge_map[third_vertex_0][i] ][1] == third_vertex_1 ) )
-            {
-                // edge already exists
-                if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: edge exists" << std::endl;             }
-                
-                g_stats.add_to_int( "EdgeFlipper:edge_flip_would_be_nonmanifold", 1 );
-                
-                return false;
-            }
-        }
-    }
-    
-    // --------------
-    
-    // Don't flip edge on a degenerate tet
-    if ( third_vertex_0 == third_vertex_1 )
-    {
-        if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: degenerate tet" << std::endl; }
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_on_degenerate_tet", 1 );
-        return false;
-    }
-    
-    // --------------
-    
-    // Create the new triangles
-    // new edge winding order == winding order of old triangle0 == winding order of new triangle0
-    
-    size_t new_triangle_third_vertex_0, new_triangle_third_vertex_1;
-    if ( m_mesh.oriented( m_mesh.m_edges[edge][0], m_mesh.m_edges[edge][1], m_mesh.get_triangle(tri0) ) ) 
-    {
-		assert( m_mesh.oriented( m_mesh.m_edges[edge][1], m_mesh.m_edges[edge][0], m_mesh.get_triangle(tri1) ) );
-        new_triangle_third_vertex_0 = m_mesh.m_edges[edge][1];
-        new_triangle_third_vertex_1 = m_mesh.m_edges[edge][0];
-    }
-    else
-    {
-		assert( m_mesh.oriented( m_mesh.m_edges[edge][0], m_mesh.m_edges[edge][1], m_mesh.get_triangle(tri1) ) );
-		assert( m_mesh.oriented( m_mesh.m_edges[edge][1], m_mesh.m_edges[edge][0], m_mesh.get_triangle(tri0) ) );
-        new_triangle_third_vertex_0 = m_mesh.m_edges[edge][0];
-        new_triangle_third_vertex_1 = m_mesh.m_edges[edge][1];
-    }
-    
-    Vec3st new_triangle0( new_edge[0], new_edge[1], new_triangle_third_vertex_0 );
-    Vec3st new_triangle1( new_edge[1], new_edge[0], new_triangle_third_vertex_1 );
-    
-    if ( m_surf.m_verbose )
-    {
-        std::cout << "flip --- new triangle 0: " << new_triangle0 << std::endl;
-        std::cout << "flip --- new triangle 1: " << new_triangle1 << std::endl;
-    }
-    
-    // --------------
-    
-    // if both triangle normals agree before flipping, make sure they agree after flipping
-    if ( dot( m_surf.get_triangle_normal(tri0), m_surf.get_triangle_normal(tri1) ) > 0.0 ) 
-    {
-        if ( dot( m_surf.get_triangle_normal(new_triangle0), m_surf.get_triangle_normal(new_triangle1) ) < 0.0 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: normal inversion" << std::endl; }
-            g_stats.add_to_int( "EdgeFlipper:edge_flip_normal_inversion", 1 );
-            return false;
-        }
-        
-        if ( dot( m_surf.get_triangle_normal(new_triangle0), m_surf.get_triangle_normal(tri0) ) < 0.0 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: normal inversion" << std::endl; }
-            g_stats.add_to_int( "EdgeFlipper:edge_flip_normal_inversion", 1 );         
-            return false;
-        }
-        
-        if ( dot( m_surf.get_triangle_normal(new_triangle1), m_surf.get_triangle_normal(tri1) ) < 0.0 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: normal inversion" << std::endl; }
-            g_stats.add_to_int( "EdgeFlipper:edge_flip_normal_inversion", 1 );         
-            return false;
-        }
-        
-        if ( dot( m_surf.get_triangle_normal(new_triangle0), m_surf.get_triangle_normal(tri1) ) < 0.0 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: normal inversion" << std::endl; }
-            g_stats.add_to_int( "EdgeFlipper:edge_flip_normal_inversion", 1 );         
-            return false;
-        }
-        
-        if ( dot( m_surf.get_triangle_normal(new_triangle1), m_surf.get_triangle_normal(tri0) ) < 0.0 )
-        {
-            if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: normal inversion" << std::endl; }
-            g_stats.add_to_int( "EdgeFlipper:edge_flip_normal_inversion", 1 );         
-            return false;
-        }
-    }
-    
-    // --------------
-    
-    // Prevent intersection
-    if ( m_surf.m_collision_safety && flip_introduces_collision( edge, new_edge, new_triangle0, new_triangle1 ) )
-    {
-        if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: intersection" << std::endl; }
-        
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_collision", 1 );
-        
-        return false;
-    }
-    
-    // --------------
-    
-    // Prevent degenerate triangles
-    if ( triangle_area( xs[new_triangle0[0]], xs[new_triangle0[1]], xs[new_triangle0[2]] ) < m_surf.m_min_triangle_area )
-    {
-        if ( m_surf.m_verbose ) { std::cout << "edge flip rejected: area too small" << std::endl;    }
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_new_area_too_small", 1 );      
-        return false;
-    }
-    
-    if ( triangle_area( xs[new_triangle1[0]], xs[new_triangle1[1]], xs[new_triangle1[2]] ) < m_surf.m_min_triangle_area )
-    {
-        if ( m_surf.m_verbose ) {std::cout << "edge flip rejected: area too small" << std::endl; }
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_new_area_too_small", 1 );            
-        return false;
-    }
-    
-    
-    // --------------
-    
-    // Control change in area
-    
-    double old_area = m_surf.get_triangle_area( tri0 ) + m_surf.get_triangle_area( tri1 );
-    double new_area = triangle_area( xs[new_triangle0[0]], xs[new_triangle0[1]], xs[new_triangle0[2]] ) 
-    + triangle_area( xs[new_triangle1[0]], xs[new_triangle1[1]], xs[new_triangle1[2]] );
-    
-    if ( fabs( old_area - new_area ) > 0.1 * old_area )
-    {
-        if ( m_surf.m_verbose ) {std::cout << "edge flip rejected: area change too great" << std::endl; }
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_area_change_too_large", 1 );            
-        return false;
-    }
-    
-    // --------------
-    
-    // Don't flip unless both vertices are on a smooth patch
-    if ( ( m_surf.vertex_primary_space_rank( edge_vertices[0] ) > 1 ) || ( m_surf.vertex_primary_space_rank( edge_vertices[1] ) > 1 ) )
-    {
-        if ( m_surf.m_verbose ) {std::cout << "edge flip rejected: vertices not on smooth patch" << std::endl;  }
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_not_smooth", 1 );                  
-        return false;
-    }        
-    
-    
-    // --------------
-    
-    // Don't introduce a large or small angle
-    
-    double min_angle = min_triangle_angle( xs[new_triangle0[0]], xs[new_triangle0[1]], xs[new_triangle0[2]] );
-    min_angle = min( min_angle, min_triangle_angle( xs[new_triangle1[0]], xs[new_triangle1[1]], xs[new_triangle1[2]] ) );
-    
-    if ( rad2deg(min_angle) < m_surf.m_min_triangle_angle )
-    {
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_bad_angle", 1 );                  
-        return false;
-    }
-    
-    double max_angle = max_triangle_angle( xs[new_triangle0[0]], xs[new_triangle0[1]], xs[new_triangle0[2]] );
-    max_angle = max( max_angle, max_triangle_angle( xs[new_triangle1[0]], xs[new_triangle1[1]], xs[new_triangle1[2]] ) );
-    
-    if ( rad2deg(max_angle) > m_surf.m_max_triangle_angle )
-    {
-        g_stats.add_to_int( "EdgeFlipper:edge_flip_bad_angle", 1 );                  
-        return false;
-    }
-    
-    // --------------
-    
-    // Okay, now do the actual operation
-    
-    Vec3st old_tri0 = m_mesh.get_triangle(tri0);
-    Vec3st old_tri1 = m_mesh.get_triangle(tri1);
-    
-    m_surf.remove_triangle( tri0 );
-    m_surf.remove_triangle( tri1 );
-    
-    size_t new_triangle_index_0 = m_surf.add_triangle( new_triangle0 );
-    size_t new_triangle_index_1 = m_surf.add_triangle( new_triangle1 );
-    
-    if ( m_surf.m_collision_safety )
-    {
-        if ( m_surf.check_triangle_vs_all_triangles_for_intersection( new_triangle_index_0 ) )
-        {
-            std::cout << "missed an intersection.  New triangles: " << new_triangle0 << ", " << new_triangle1 << std::endl;
-            std::cout << "old triangles: " << old_tri0 << ", " << old_tri1 << std::endl;
-            assert(0);
-        }
-        
-        if ( m_surf.check_triangle_vs_all_triangles_for_intersection( new_triangle_index_1 ) )
-        {
-            std::cout << "missed an intersection.  New triangles: " << new_triangle0 << ", " << new_triangle1 << std::endl;
-            std::cout << "old triangles: " << old_tri0 << ", " << old_tri1 << std::endl;      
-            assert(0);
-        }
-    }
-    
-    m_surf.m_dirty_triangles.push_back( new_triangle_index_0 );
-    m_surf.m_dirty_triangles.push_back( new_triangle_index_1 );   
-    
-    if ( m_surf.m_verbose ) { std::cout << "edge flip: ok" << std::endl; }
-    
-    g_stats.add_to_int( "EdgeFlipper:edge_flip_success", 1 );
-    
-    return true;
-    
-}
-
-
-
-// --------------------------------------------------------
-///
-/// Flip all non-delaunay edges
-///
-// --------------------------------------------------------
-
-bool EdgeFlipper::flip_pass( )
-{
-    
-    if ( m_surf.m_verbose )
-    {
-        std::cout << "---------------------- EdgeFlipper: flipping ----------------------" << std::endl;
-    }
-	
-    //   if ( m_surf.m_collision_safety )
-    //   {
-    //      m_surf.check_continuous_broad_phase_is_up_to_date();
-    //   }
-    
-    m_surf.m_dirty_triangles.clear();
-    
-    bool flip_occurred_ever = false;          // A flip occurred in this function call
-    bool flip_occurred = true;                // A flip occurred in the current loop iteration
-    
-    static unsigned int MAX_NUM_FLIP_PASSES = 5;
-    unsigned int num_flip_passes = 0;
-    
-    NonDestructiveTriMesh& m_mesh = m_surf.m_mesh;
-    const std::vector<Vec3d>& xs = m_surf.get_positions();
-    
-    //
-    // Each "pass" is once over the entire set of edges (ignoring edges created during the current pass)
-    //
-    
-    while ( flip_occurred && num_flip_passes++ < MAX_NUM_FLIP_PASSES )
-    {
-        if ( m_surf.m_verbose )
-        {
-            std::cout << "---------------------- El Topo: flipping ";
-            std::cout << "pass " << num_flip_passes << "/" << MAX_NUM_FLIP_PASSES;
-            std::cout << "----------------------" << std::endl;
-        }
-        
-        flip_occurred = false;
-        
-        size_t number_of_edges = m_mesh.m_edges.size();      // don't work on newly created edges
-        
-        for( size_t i = 0; i < number_of_edges; i++ )
-        {
-            if ( m_mesh.m_edges[i][0] == m_mesh.m_edges[i][1] )   { continue; }
-            if ( m_mesh.m_edge_to_triangle_map[i].size() > 4 || m_mesh.m_edge_to_triangle_map[i].size() < 2 )   { continue; }
-            if ( m_mesh.m_is_boundary_vertex[ m_mesh.m_edges[i][0] ] || m_mesh.m_is_boundary_vertex[ m_mesh.m_edges[i][1] ] )  { continue; }  // skip boundary vertices
-            
-            size_t triangle_a = (size_t)~0, triangle_b =(size_t)~0;
-            
-            if ( m_mesh.m_edge_to_triangle_map[i].size() == 2 )
-            {    
-                triangle_a = m_mesh.m_edge_to_triangle_map[i][0];
-                triangle_b = m_mesh.m_edge_to_triangle_map[i][1];         
-                assert (    m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.get_triangle(triangle_a) ) 
-                        != m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.get_triangle(triangle_b) ) );
-            }
-            else if ( m_mesh.m_edge_to_triangle_map[i].size() == 4 )
-            {           
-                triangle_a = m_mesh.m_edge_to_triangle_map[i][0];
-                
-                // Find first triangle with orientation opposite triangle_a's orientation
-                unsigned int j = 1;
-                for ( ; j < 4; ++j )
-                {
-                    triangle_b = m_mesh.m_edge_to_triangle_map[i][j];
-                    if (    m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.get_triangle(triangle_a) ) 
-                        != m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.get_triangle(triangle_b) ) )
-                    {
-                        break;
-                    }
-                }
-                assert ( j < 4 );
-            }
-            else
-            {
-                std::cout << m_mesh.m_edge_to_triangle_map[i].size() << " triangles incident to an edge" << std::endl;
-                assert(0);
-            }
-            
-            // Don't flip edge on a degenerate triangle
-            const Vec3st& tri_a = m_mesh.get_triangle( triangle_a );
-            const Vec3st& tri_b = m_mesh.get_triangle( triangle_b );
-            
-            if (   tri_a[0] == tri_a[1] 
-                || tri_a[1] == tri_a[2] 
-                || tri_a[2] == tri_a[0] 
-                || tri_b[0] == tri_b[1] 
-                || tri_b[1] == tri_b[2] 
-                || tri_b[2] == tri_b[0] )
-            {
-                continue;
-            }
-            
-            size_t third_vertex_0 = m_mesh.get_third_vertex( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], tri_a );
-            size_t third_vertex_1 = m_mesh.get_third_vertex( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], tri_b );
-            
-            if ( third_vertex_0 == third_vertex_1 )
-            {
-                continue;
-            }
-            
-            bool flipped = false;
-            
-            double current_length = mag( xs[m_mesh.m_edges[i][1]] - xs[m_mesh.m_edges[i][0]] );        
-            double potential_length = mag( xs[third_vertex_1] - xs[third_vertex_0] );     
-            if ( potential_length < current_length - m_edge_flip_min_length_change )
-            {
-                flipped = flip_edge( i, triangle_a, triangle_b, third_vertex_0, third_vertex_1 );            
-            }
-            
-            flip_occurred |= flipped;
-        }
-        
-        flip_occurred_ever |= flip_occurred;
-    }
-    
-    
-    if ( flip_occurred_ever )
-    {
-        m_surf.trim_non_manifold( m_surf.m_dirty_triangles );
-    }
-    
-    return flip_occurred_ever;
-    
-}
diff --git a/extern/eltopo/eltopo3d/edgeflipper.h b/extern/eltopo/eltopo3d/edgeflipper.h
deleted file mode 100644
index d7739f7..0000000
--- a/extern/eltopo/eltopo3d/edgeflipper.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgeflipper.h
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge flip" operation: replacing non-delaunay edges with their dual edges.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_EDGEFLIPPER_H
-#define EL_TOPO_EDGEFLIPPER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,double> Vec3d;
-typedef Vec<2,size_t> Vec2st;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Edge flipper object.  Tries to produce Delaunay mesh by replacing edges with the "opposite" edge in their neighbourhood.
-///
-// ---------------------------------------------------------
-
-class EdgeFlipper
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    EdgeFlipper( SurfTrack& surf, double edge_flip_min_length_change ) :
-    m_surf( surf ),
-    m_edge_flip_min_length_change( edge_flip_min_length_change )
-    {}
-    
-    /// Flip all non-delaunay edges
-    ///
-    bool flip_pass();
-    
-    
-private:
-
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;
-    
-    /// Minimum edge length improvement in order to flip an edge
-    ///
-    double m_edge_flip_min_length_change;
-    
-    /// Check whether the new triangles created by flipping an edge introduce any intersection
-    ///
-    bool flip_introduces_collision(size_t edge_index, 
-                                   const Vec2st& new_edge, 
-                                   const Vec3st& new_triangle_a, 
-                                   const Vec3st& new_triangle_b );
-    
-    /// Flip an edge: remove the edge and its incident triangles, then add a new edge and two new triangles
-    ///
-    bool flip_edge( size_t edge, size_t tri0, size_t tri1, size_t third_vertex_0, size_t third_vertex_1 );
-    
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/edgesplitter.cpp b/extern/eltopo/eltopo3d/edgesplitter.cpp
deleted file mode 100644
index 5fd6509..0000000
--- a/extern/eltopo/eltopo3d/edgesplitter.cpp
+++ /dev/null
@@ -1,740 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgesplitter.cpp
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge split" operation: subdividing an edge into two shorter edges.
-//
-// ---------------------------------------------------------
-
-#include <edgesplitter.h>
-#include <broadphase.h>
-#include <collisionqueries.h>
-#include <runstats.h>
-#include <subdivisionscheme.h>
-#include <surftrack.h>
-#include <trianglequality.h>
-
-
-// ---------------------------------------------------------
-//  Extern globals
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Constructor.  Active SurfTrack object must be supplied.
-///
-// ---------------------------------------------------------
-
-EdgeSplitter::EdgeSplitter( SurfTrack& surf, bool use_curvature, double max_curvature_multiplier ) :
-m_max_edge_length( UNINITIALIZED_DOUBLE ),
-m_use_curvature( use_curvature ),
-m_max_curvature_multiplier( max_curvature_multiplier ),
-m_surf( surf )
-{}
-
-
-// --------------------------------------------------------
-///
-/// Check collisions between the edge [neighbour, new] and the given edge 
-///
-// --------------------------------------------------------
-
-bool EdgeSplitter::split_edge_edge_collision( size_t neighbour_index, 
-                                             const Vec3d& new_vertex_position, 
-                                             const Vec3d& new_vertex_smooth_position, 
-                                             const Vec2st& edge )
-{
-    
-    size_t edge_vertex_0 = edge[0];
-    size_t edge_vertex_1 = edge[1];
-    size_t dummy_index = m_surf.get_num_vertices();
-    
-    if ( neighbour_index == edge_vertex_0 || neighbour_index == edge_vertex_1 )  { return false; }
-    
-    const std::vector<Vec3d>& x = m_surf.get_positions();
-    
-    double t_zero_distance; 
-    check_edge_edge_proximity( new_vertex_position, 
-                              x[ neighbour_index ], 
-                              x[ edge_vertex_0 ], 
-                              x[ edge_vertex_1 ],
-                              t_zero_distance );
-    
-    if ( t_zero_distance < m_surf.m_improve_collision_epsilon )
-    {
-        return true;
-    }
-    
-    if ( edge_vertex_1 < edge_vertex_0 ) { swap( edge_vertex_0, edge_vertex_1 ); }
-    
-    if ( segment_segment_collision(x[ neighbour_index ], x[ neighbour_index ], neighbour_index,
-                                   new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                   x[ edge_vertex_0 ], x[ edge_vertex_0 ], edge_vertex_0,
-                                   x[ edge_vertex_1 ], x[ edge_vertex_1 ], edge_vertex_1 ) )
-        
-    {      
-        return true;
-    }
-    
-    return false;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Determine if the new vertex introduced by the edge split has a collision along its pseudo-trajectory.
-///
-// ---------------------------------------------------------
-
-bool EdgeSplitter::split_triangle_vertex_collision( const Vec3st& triangle_indices, 
-                                                   const Vec3d& new_vertex_position, 
-                                                   const Vec3d& new_vertex_smooth_position, 
-                                                   size_t overlapping_vert_index, 
-                                                   const Vec3d& vert )
-{
-    
-    if ( overlapping_vert_index == triangle_indices[0] || overlapping_vert_index == triangle_indices[1] || overlapping_vert_index == triangle_indices[2] )
-    {
-        return false;
-    }
-    
-    Vec3st sorted_triangle = sort_triangle( triangle_indices );
-    
-    Vec3d tri_positions[3];
-    Vec3d tri_smooth_positions[3];
-    
-    for ( unsigned int i = 0; i < 3; ++i )
-    {
-        if ( sorted_triangle[i] == m_surf.get_num_vertices() )
-        {
-            tri_positions[i] = new_vertex_position;
-            tri_smooth_positions[i] = new_vertex_smooth_position;
-        }
-        else
-        {
-            tri_positions[i] = m_surf.get_position( sorted_triangle[i] );
-            tri_smooth_positions[i] = m_surf.get_position( sorted_triangle[i] );
-        }
-    }
-    
-    
-    // check distance at time t=0
-    double t_zero_distance;
-    check_point_triangle_proximity( vert, tri_positions[0], tri_positions[1], tri_positions[2], t_zero_distance );
-    
-    
-    if ( t_zero_distance < m_surf.m_improve_collision_epsilon )
-    {
-        return true;
-    }
-    
-    
-    // now check continuous collision
-    
-    if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                  tri_positions[0], tri_smooth_positions[0], sorted_triangle[0],
-                                  tri_positions[1], tri_smooth_positions[1], sorted_triangle[1],
-                                  tri_positions[2], tri_smooth_positions[2], sorted_triangle[2] ) )
-    {         
-        return true;
-    }
-    
-    return false;
-    
-    
-}
-
-
-
-// ---------------------------------------------------------
-///
-/// Determine if the pseudo-trajectory of the new vertex has a collision with the existing mesh.
-///
-// ---------------------------------------------------------
-
-bool EdgeSplitter::split_edge_pseudo_motion_introduces_intersection( const Vec3d& new_vertex_position, 
-                                                                    const Vec3d& new_vertex_smooth_position, 
-                                                                    size_t edge,
-                                                                    size_t tri0, 
-                                                                    size_t tri1, 
-                                                                    size_t vertex_a,
-                                                                    size_t vertex_b,
-                                                                    size_t vertex_c,
-                                                                    size_t vertex_d )
-{
-    
-    NonDestructiveTriMesh& m_mesh = m_surf.m_mesh;
-    
-    if ( !m_surf.m_collision_safety)
-    {
-        return false;
-    }
-    
-    // 
-    // new point vs all triangles
-    // 
-    
-    {
-        
-        Vec3d aabb_low, aabb_high;
-        minmax( new_vertex_position, new_vertex_smooth_position, aabb_low, aabb_high );
-        
-        aabb_low -= m_surf.m_aabb_padding * Vec3d(1,1,1);
-        aabb_high += m_surf.m_aabb_padding * Vec3d(1,1,1);
-        
-        std::vector<size_t> overlapping_triangles;
-        m_surf.m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, true, true, overlapping_triangles );
-        
-        for ( size_t i = 0; i < overlapping_triangles.size(); ++i )
-        {
-            
-            if ( overlapping_triangles[i] == tri0 || overlapping_triangles[i] == tri1 )
-            {
-                continue;
-            }
-            
-            size_t triangle_vertex_0 = m_mesh.get_triangle( overlapping_triangles[i] )[0];
-            size_t triangle_vertex_1 = m_mesh.get_triangle( overlapping_triangles[i] )[1];
-            size_t triangle_vertex_2 = m_mesh.get_triangle( overlapping_triangles[i] )[2];
-            
-            double t_zero_distance;
-            
-            check_point_triangle_proximity( new_vertex_position, 
-                                           m_surf.get_position( triangle_vertex_0 ),
-                                           m_surf.get_position( triangle_vertex_1 ),
-                                           m_surf.get_position( triangle_vertex_2 ),
-                                           t_zero_distance );
-            
-            size_t dummy_index = m_surf.get_num_vertices();
-            
-            if ( t_zero_distance < m_surf.m_improve_collision_epsilon )
-            {
-                return true;
-            }
-            
-            Vec3st sorted_triangle = sort_triangle( Vec3st( triangle_vertex_0, triangle_vertex_1, triangle_vertex_2 ) );
-            
-            
-            if ( point_triangle_collision(  new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                          m_surf.get_position( sorted_triangle[0] ), m_surf.get_position( sorted_triangle[0] ), sorted_triangle[0],
-                                          m_surf.get_position( sorted_triangle[1] ), m_surf.get_position( sorted_triangle[1] ), sorted_triangle[1],
-                                          m_surf.get_position( sorted_triangle[2] ), m_surf.get_position( sorted_triangle[2] ), sorted_triangle[2] ) )
-                
-            {
-                return true;
-            }
-        }
-        
-    }
-    
-    //
-    // new edges vs all edges
-    //
-    
-    {
-        
-        Vec3d edge_aabb_low, edge_aabb_high;
-        
-        // do one big query into the broadphase for all 4 new edges
-        minmax( new_vertex_position, new_vertex_smooth_position, 
-               m_surf.get_position( vertex_a ), m_surf.get_position( vertex_b ), m_surf.get_position( vertex_c ), m_surf.get_position( vertex_d ),
-               edge_aabb_low, edge_aabb_high );
-        
-        edge_aabb_low -= m_surf.m_aabb_padding * Vec3d(1,1,1);
-        edge_aabb_high += m_surf.m_aabb_padding * Vec3d(1,1,1);
-        
-        std::vector<size_t> overlapping_edges;
-        m_surf.m_broad_phase->get_potential_edge_collisions( edge_aabb_low, edge_aabb_high, true, true, overlapping_edges );
-        
-        const size_t vertex_neighbourhood[4] = { vertex_a, vertex_b, vertex_c, vertex_d };
-        
-        for ( size_t i = 0; i < overlapping_edges.size(); ++i )
-        {
-            
-            if ( overlapping_edges[i] == edge ) { continue; }
-            if ( m_mesh.m_edges[ overlapping_edges[i] ][0] == m_mesh.m_edges[ overlapping_edges[i] ][1] ) { continue; }
-            
-            for ( size_t v = 0; v < 4; ++v )
-            {
-                bool collision = split_edge_edge_collision( vertex_neighbourhood[v], 
-                                                           new_vertex_position, 
-                                                           new_vertex_smooth_position, 
-                                                           m_mesh.m_edges[overlapping_edges[i]] );
-                
-                if ( collision ) { return true; }
-            }
-        }      
-    }
-    
-    //
-    // new triangles vs all points
-    //
-    
-    {
-        Vec3d triangle_aabb_low, triangle_aabb_high;
-        
-        // do one big query into the broadphase for all 4 new triangles
-        minmax( new_vertex_position, new_vertex_smooth_position, 
-               m_surf.get_position( vertex_a ), m_surf.get_position( vertex_b ), m_surf.get_position( vertex_c ), m_surf.get_position( vertex_d ),
-               triangle_aabb_low, triangle_aabb_high );
-        
-        triangle_aabb_low -= m_surf.m_aabb_padding * Vec3d(1,1,1);
-        triangle_aabb_high += m_surf.m_aabb_padding * Vec3d(1,1,1);
-        
-        std::vector<size_t> overlapping_vertices;
-        m_surf.m_broad_phase->get_potential_vertex_collisions( triangle_aabb_low, triangle_aabb_high, true, true, overlapping_vertices );
-        
-        size_t dummy_e = m_surf.get_num_vertices();
-        
-        std::vector< Vec3st > triangle_indices;
-        
-        triangle_indices.push_back( Vec3st( vertex_a, dummy_e, vertex_c ) );    // triangle aec      
-        triangle_indices.push_back( Vec3st( vertex_c, dummy_e, vertex_b ) );    // triangle ceb      
-        triangle_indices.push_back( Vec3st( vertex_d, vertex_b, dummy_e ) );    // triangle dbe
-        triangle_indices.push_back( Vec3st( vertex_d, dummy_e, vertex_a ) );    // triangle dea
-        
-        for ( size_t i = 0; i < overlapping_vertices.size(); ++i )
-        {
-            if ( m_mesh.m_vertex_to_triangle_map[overlapping_vertices[i]].empty() ) 
-            { 
-                continue; 
-            }
-            
-            size_t overlapping_vert_index = overlapping_vertices[i];
-            const Vec3d& vert = m_surf.get_position(overlapping_vert_index);
-            
-            for ( size_t j = 0; j < triangle_indices.size(); ++j )
-            {
-                bool collision = split_triangle_vertex_collision( triangle_indices[j], 
-                                                                 new_vertex_position, 
-                                                                 new_vertex_smooth_position, 
-                                                                 overlapping_vert_index, 
-                                                                 vert );
-                
-                if ( collision ) 
-                { 
-                    return true; 
-                }
-                
-            }
-        }
-        
-    }
-    
-    return false;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Split an edge, using subdivision_scheme to determine the new vertex location, if safe to do so.
-///
-// --------------------------------------------------------
-
-bool EdgeSplitter::split_edge( size_t edge )
-{   
-    
-    g_stats.add_to_int( "EdgeSplitter:edge_split_attempts", 1 );
-    
-    assert( edge_is_splittable(edge) );
-    
-    NonDestructiveTriMesh& mesh = m_surf.m_mesh;
-    
-    // --------------
-    
-    // Only split edges inicident on 2 triangles
-    assert ( mesh.m_edge_to_triangle_map[edge].size() == 2 );
-    
-    // --------------
-    
-    size_t tri0 = mesh.m_edge_to_triangle_map[edge][0];
-    size_t tri1 = mesh.m_edge_to_triangle_map[edge][1];
-    double area0 = m_surf.get_triangle_area( tri0 );
-    double area1 = m_surf.get_triangle_area( tri1 );
-    
-    // Splitting degenerate triangles causes problems
-    if ( area0 < m_surf.m_min_triangle_area || area1 < m_surf.m_min_triangle_area )
-    {
-        g_stats.add_to_int( "EdgeSplitter:split_edge_incident_to_tiny_triangle", 1 );
-        return false;
-    }
-    
-    // --------------
-    
-    // convert triangles abc and dba into triangles aec, ceb, dbe and dea
-    
-    size_t vertex_a = mesh.m_edges[edge][0];
-    size_t vertex_b = mesh.m_edges[edge][1];
-    size_t vertex_c, vertex_d;
-    
-    if ( mesh.oriented( vertex_a, vertex_b, mesh.get_triangle(tri0) ) )
-    {
-        // tri0 = abc
-		assert( mesh.oriented( vertex_b, vertex_a, mesh.get_triangle(tri1) ) );
-        vertex_c = mesh.get_third_vertex( vertex_a, vertex_b, mesh.get_triangle(tri0) );      
-        vertex_d = mesh.get_third_vertex( vertex_b, vertex_a, mesh.get_triangle(tri1) );
-    }
-    else
-    {
-        // tri1 = abc
-        assert( mesh.oriented( vertex_a, vertex_b, mesh.get_triangle(tri1) ) );
-        assert( mesh.oriented( vertex_b, vertex_a, mesh.get_triangle(tri0) ) );
-        vertex_c = mesh.get_third_vertex( vertex_a, vertex_b, mesh.get_triangle(tri1) );
-        vertex_d = mesh.get_third_vertex( vertex_b, vertex_a, mesh.get_triangle(tri0) );
-    }
-    
-    // --------------
-    
-    // get edge midpoint and the point on the smooth surface
-    
-    Vec3d new_vertex_position = 0.5 * ( m_surf.get_position( vertex_a ) + m_surf.get_position( vertex_b ) );
-    Vec3d new_vertex_smooth_position;
-    
-    // generate the new midpoint according to the subdivision scheme
-    m_surf.m_subdivision_scheme->generate_new_midpoint( edge, m_surf, new_vertex_smooth_position );
-    
-    // --------------
-    
-    // check if the generated point introduces an intersection
-    
-    bool use_smooth_point = ! ( split_edge_pseudo_motion_introduces_intersection( new_vertex_position, 
-                                                                                 new_vertex_smooth_position, 
-                                                                                 edge, 
-                                                                                 tri0, 
-                                                                                 tri1, 
-                                                                                 vertex_a, 
-                                                                                 vertex_b, 
-                                                                                 vertex_c, 
-                                                                                 vertex_d ) );
-    
-    if ( !use_smooth_point ) { g_stats.add_to_int( "EdgeSplitter:split_smooth_vertex_collisions", 1 ); }
-    
-    // --------------
-    
-    // check normal inversion
-    
-    if ( use_smooth_point )
-    {
-        
-        Vec3d tri0_normal = m_surf.get_triangle_normal( tri0 );
-        Vec3d tri1_normal = m_surf.get_triangle_normal( tri1 );
-        
-        if ( dot( tri0_normal, tri1_normal ) >= 0.0 )
-        {
-            Vec3d new_normal = triangle_normal( m_surf.get_position(vertex_a), new_vertex_smooth_position, m_surf.get_position(vertex_c) );
-            if ( dot( new_normal, tri0_normal ) < 0.0 || dot( new_normal, tri1_normal ) < 0.0 )
-            {
-                use_smooth_point = false;
-            }
-            new_normal = triangle_normal( m_surf.get_position(vertex_c), new_vertex_smooth_position, m_surf.get_position(vertex_b) );
-            if ( dot( new_normal, tri0_normal ) < 0.0 || dot( new_normal, tri1_normal ) < 0.0 )
-            {
-                use_smooth_point = false;
-            }         
-            new_normal = triangle_normal( m_surf.get_position(vertex_d), m_surf.get_position(vertex_b), new_vertex_smooth_position );
-            if ( dot( new_normal, tri0_normal ) < 0.0 || dot( new_normal, tri1_normal ) < 0.0 )
-            {
-                use_smooth_point = false;
-            }         
-            new_normal = triangle_normal( m_surf.get_position(vertex_d), new_vertex_smooth_position, m_surf.get_position(vertex_a) );
-            if ( dot( new_normal, tri0_normal ) < 0.0 || dot( new_normal, tri1_normal ) < 0.0 )
-            {
-                use_smooth_point = false;
-            }         
-        }
-    }
-    
-    // --------------
-    
-    // if the new point introduces an intersection, try using the edge midpoint
-    
-    if ( use_smooth_point == false )
-    {
-        
-        if ( m_surf.m_verbose ) { std::cout << "not using smooth subdivision" << std::endl; }
-        
-        new_vertex_smooth_position = new_vertex_position;
-        
-        if ( split_edge_pseudo_motion_introduces_intersection( new_vertex_position, 
-                                                              new_vertex_smooth_position, 
-                                                              edge, 
-                                                              tri0, 
-                                                              tri1, 
-                                                              vertex_a, 
-                                                              vertex_b, 
-                                                              vertex_c, 
-                                                              vertex_d ) )
-        {
-            
-            g_stats.add_to_int( "EdgeSplitter:split_midpoint_collisions", 1 );
-            
-            if ( m_surf.m_verbose )  { std::cout << "Even mid-point subdivision introduces collision.  Backing out." << std::endl; }
-            return false;
-        }
-    }
- 	else
-    {
-        if ( m_surf.m_verbose ) { std::cout << "using smooth subdivision" << std::endl; }
-    }
-    
-    
-    // --------------
-    
-    // Check angles on new triangles
-    
-    const Vec3d& va = m_surf.get_position( vertex_a );
-    const Vec3d& vb = m_surf.get_position( vertex_b );
-    const Vec3d& vc = m_surf.get_position( vertex_c );
-    const Vec3d& vd = m_surf.get_position( vertex_d );
-    const Vec3d& ve = new_vertex_smooth_position;
-    
-    double min_new_angle = min_triangle_angle( va, ve, vc );
-    min_new_angle = min( min_new_angle, min_triangle_angle( vc, ve, vb ) );
-    min_new_angle = min( min_new_angle, min_triangle_angle( vd, vb, ve ) );
-    min_new_angle = min( min_new_angle, min_triangle_angle( vd, ve, va ) );
-    
-    if ( rad2deg(min_new_angle) < m_surf.m_min_triangle_angle )
-    {
-        g_stats.add_to_int( "EdgeSplitter:edge_split_small_angle", 1 );
-        return false;
-    }
-    
-    double max_current_angle = max_triangle_angle( va, vb, vc );
-    max_current_angle = max( max_current_angle, max_triangle_angle( va, vb, vd ) );
-    
-    double max_new_angle = max_triangle_angle( va, ve, vc );
-    max_new_angle = max( max_new_angle, max_triangle_angle( vc, ve, vb ) );
-    max_new_angle = max( max_new_angle, max_triangle_angle( vd, vb, ve ) );
-    max_new_angle = max( max_new_angle, max_triangle_angle( vd, ve, va ) );
-    
-    // if new angle is greater than the allowed angle, and doesn't 
-    // improve the current max angle, prevent the split
-    
-    if ( rad2deg(max_new_angle) > m_surf.m_max_triangle_angle )
-    {
-        
-        // if new triangle improves a large angle, allow it
-        
-        if ( rad2deg(max_new_angle) < rad2deg(max_current_angle) )
-        {
-            g_stats.add_to_int( "EdgeSplitter:edge_split_large_angle", 1 );      
-            return false;
-        }
-    }
-    
-    // --------------
-    
-    // Do the actual splitting
-    
-    double new_vertex_mass = 0.5 * ( m_surf.m_masses[ vertex_a ] + m_surf.m_masses[ vertex_b ] );
-    size_t vertex_e = m_surf.add_vertex( new_vertex_smooth_position, new_vertex_mass );
-    
-    // Add to change history
-    m_surf.m_vertex_change_history.push_back( VertexUpdateEvent( VertexUpdateEvent::VERTEX_ADD, vertex_e, Vec2st( vertex_a, vertex_b) ) );
-    
-    if ( m_surf.m_verbose ) { std::cout << "new vertex: " << vertex_e << std::endl; }
-    
-    m_surf.remove_triangle( tri0 );
-    m_surf.remove_triangle( tri1 );
-    
-    m_surf.add_triangle( Vec3st( vertex_a, vertex_e, vertex_c ) );
-    m_surf.add_triangle( Vec3st( vertex_c, vertex_e, vertex_b ) );
-    m_surf.add_triangle( Vec3st( vertex_d, vertex_b, vertex_e ) );
-    m_surf.add_triangle( Vec3st( vertex_d, vertex_e, vertex_a ) );      
-    
-    return true;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Determine if edge should be allowed to be split
-///
-// --------------------------------------------------------
-
-bool EdgeSplitter::edge_is_splittable( size_t edge_index )
-{
-    
-    // skip deleted and solid edges
-    if ( m_surf.m_mesh.edge_is_deleted(edge_index) ) { return false; }
-    if ( m_surf.edge_is_solid(edge_index) ) { return false; }
-    
-    // skip non-manifold and boundary edges
-    if ( m_surf.m_mesh.m_edge_to_triangle_map[edge_index].size() != 2 ) { return false; }
-    if ( m_surf.m_mesh.m_is_boundary_edge[edge_index] ) { return false; }
-    
-    return true;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Split edges opposite large angles
-///
-// --------------------------------------------------------
-
-bool EdgeSplitter::large_angle_split_pass()
-{
-    
-    NonDestructiveTriMesh& mesh = m_surf.m_mesh;
-    
-    bool split_occurred = false;
-    
-    for ( size_t e = 0; e < mesh.m_edges.size(); ++e )
-    {
-        
-        if ( !edge_is_splittable(e) ) { continue; }
-        
-        // get edge end points
-        const Vec2st& edge = m_surf.m_mesh.m_edges[e];      
-        const Vec3d& edge_point0 = m_surf.get_position( edge[0] );
-        const Vec3d& edge_point1 = m_surf.get_position( edge[1] );
-        
-        // get triangles incident to the edge
-        size_t t0 = mesh.m_edge_to_triangle_map[e][0];
-        size_t t1 = mesh.m_edge_to_triangle_map[e][1];
-        const Vec3st& tri0 = mesh.get_triangle(t0);
-        const Vec3st& tri1 = mesh.get_triangle(t1);
-        
-        // get vertex opposite the edge for each triangle
-        size_t opposite0 = mesh.get_third_vertex( e, tri0 );
-        size_t opposite1 = mesh.get_third_vertex( e, tri1 );
-        
-        // compute the angle at each opposite vertex
-        const Vec3d& opposite_point0 = m_surf.get_position(opposite0);
-        const Vec3d& opposite_point1 = m_surf.get_position(opposite1);
-        double angle0 = rad2deg( acos( dot( normalized(edge_point0-opposite_point0), normalized(edge_point1-opposite_point0) ) ) );
-        double angle1 = rad2deg( acos( dot( normalized(edge_point0-opposite_point1), normalized(edge_point1-opposite_point1) ) ) );
-        
-        // if an angle is above the max threshold, split the edge
-        
-        if ( angle0 > m_surf.m_max_triangle_angle || angle1 > m_surf.m_max_triangle_angle )
-        {
-            
-            bool result = split_edge( e );
-            
-            if ( result )
-            {
-                g_stats.add_to_int( "EdgeSplitter:large_angle_split_success", 1 );
-            }
-            else
-            {
-                g_stats.add_to_int( "EdgeSplitter:large_angle_split_failed", 1 );
-            }
-            
-            split_occurred |= result;
-        }
-    }
-    
-    
-    return split_occurred;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Split all long edges
-///
-// --------------------------------------------------------
-
-bool EdgeSplitter::split_pass()
-{
-    
-    if ( m_surf.m_verbose )
-    {
-        std::cout << "---------------------- Edge Splitter: splitting ----------------------" << std::endl;
-    }
-    
-    assert( m_max_edge_length != UNINITIALIZED_DOUBLE );
-    
-    NonDestructiveTriMesh& mesh = m_surf.m_mesh;
-    std::vector<SortableEdge> sortable_edges_to_try;
-    
-    for( size_t i = 0; i < mesh.m_edges.size(); i++ )
-    {    
-        if ( !edge_is_splittable(i) ) { continue; }
-        
-        size_t vertex_a = mesh.m_edges[i][0];
-        size_t vertex_b = mesh.m_edges[i][1];
-        
-        assert( vertex_a < m_surf.get_num_vertices() );
-        assert( vertex_b < m_surf.get_num_vertices() );
-        
-        double length;
-        
-        if ( m_use_curvature )
-        {
-            length = get_curvature_scaled_length( m_surf, vertex_a, vertex_b, 0.0, m_max_curvature_multiplier );
-        }
-        else
-        {
-            length = m_surf.get_edge_length(i);
-        }
-        
-        if ( length > m_max_edge_length )
-        {
-            sortable_edges_to_try.push_back( SortableEdge( i, length ) );
-        }
-    }
-    
-    
-    //
-    // sort in ascending order, then iterate backwards to go from longest edge to shortest
-    //
-    
-    // whether a split operation was successful in this pass
-    
-    bool split_occurred = false;
-    
-    std::sort( sortable_edges_to_try.begin(), sortable_edges_to_try.end() );
-    
-    std::vector<SortableEdge>::reverse_iterator iter = sortable_edges_to_try.rbegin();
-    
-    for ( ; iter != sortable_edges_to_try.rend(); ++iter )
-    {
-        size_t longest_edge = iter->m_edge_index;
-        
-        if ( !edge_is_splittable(longest_edge) ) { continue; }
-        
-        size_t vertex_a = mesh.m_edges[longest_edge][0];
-        size_t vertex_b = mesh.m_edges[longest_edge][1];
-        
-        // recompute edge length -- a prior split may have somehow fixed this edge already
-        double longest_edge_length;
-        
-        if ( m_use_curvature )
-        {
-            longest_edge_length = get_curvature_scaled_length( m_surf, vertex_a, vertex_b, 0.0, m_max_curvature_multiplier );
-        }
-        else
-        {
-            longest_edge_length = m_surf.get_edge_length(longest_edge);
-        }
-        
-        if ( longest_edge_length > m_max_edge_length )
-        {
-            // perform the actual edge split
-            bool result = split_edge( longest_edge );         
-            split_occurred |= result;
-        }
-    }
-    
-    
-    // Now split to reduce large angles
-    
-    bool large_angle_split_occurred = large_angle_split_pass();
-    
-    return split_occurred || large_angle_split_occurred;
-    
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/edgesplitter.h b/extern/eltopo/eltopo3d/edgesplitter.h
deleted file mode 100644
index 851f8ab..0000000
--- a/extern/eltopo/eltopo3d/edgesplitter.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// ---------------------------------------------------------
-//
-//  edgesplitter.h
-//  Tyson Brochu 2011
-//  
-//  Functions supporting the "edge split" operation: subdividing an edge into two shorter edges.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_EDGESPLITTER_H
-#define EL_TOPO_EDGESPLITTER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,double> Vec3d;
-typedef Vec<2,size_t> Vec2st;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Edge splitter object.  Splits "long" edges by introducing a new vertex at the midpoint, optionally offsetting for curvature 
-/// preservation.
-///
-// ---------------------------------------------------------
-
-class EdgeSplitter
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    EdgeSplitter( SurfTrack& surf, bool use_curvature, double max_curvature_multiplier );
-    
-    /// Split all long edges
-    ///
-    bool split_pass();
-    
-    /// Split edges opposite large angles
-    ///
-    bool large_angle_split_pass();
-    
-
-    /// Maximum edge length.  Edges longer than this will be subdivided.
-    ///
-    double m_max_edge_length;   
-
-    /// Whether to scale by curvature when computing edge lengths, in order to refine high-curvature regions
-    ///
-    bool m_use_curvature;
-    
-    /// The maximum curvature scaling allowed
-    ///
-    double m_max_curvature_multiplier;
-        
-private:
-    
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;   
-    
-    /// Check collisions between the edge [neighbour, new] and the given edge 
-    ///
-    bool split_edge_edge_collision(size_t neighbour_index, 
-                                   const Vec3d& new_vertex_position, 
-                                   const Vec3d& new_vertex_smooth_position, 
-                                   const Vec2st& edge );
-    
-    /// Determine if the new vertex introduced by the edge split has a collision along its pseudo-trajectory.
-    ///
-    bool split_triangle_vertex_collision( const Vec3st& triangle_indices, 
-                                         const Vec3d& new_vertex_position, 
-                                         const Vec3d& new_vertex_smooth_position, 
-                                         size_t overlapping_vert_index, 
-                                         const Vec3d& vert );
-    
-    /// Determine if the pseudo-trajectory of the new vertex has a collision with the existing mesh.
-    ///
-    bool split_edge_pseudo_motion_introduces_intersection( const Vec3d& new_vertex_position, 
-                                                          const Vec3d& new_vertex_smooth_position, 
-                                                          size_t edge,
-                                                          size_t tri0, 
-                                                          size_t tri1,
-                                                          size_t vertex_a,
-                                                          size_t vertex_b,
-                                                          size_t vertex_c,
-                                                          size_t vertex_d );
-    /// Determine if edge should be allowed to be split
-    ///    
-    bool edge_is_splittable( size_t edge_index );
-    
-    /// Split an edge, using subdivision_scheme to determine the new vertex location, if safe to do so.
-    ///
-    bool split_edge( size_t edge );
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/eltopo.cpp b/extern/eltopo/eltopo3d/eltopo.cpp
deleted file mode 100644
index 1256274..0000000
--- a/extern/eltopo/eltopo3d/eltopo.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-// ---------------------------------------------------------
-//
-//  eltopo.cpp
-//  Tyson Brochu 2009
-//
-//  C-callable API for El Topo
-//
-// ---------------------------------------------------------
-
-#include <eltopo.h>
-#include <surftrack.h>
-
-#include "../common/runstats.h"
-RunStats g_stats;
-
-// ---------------------------------------------------------
-///
-/// Static operations: edge collapse, edge split, edge flip, null-space smoothing, and topological changes
-///
-// ---------------------------------------------------------
-
-void el_topo_static_operations( const ElTopoMesh* inputs,
-                               const struct ElTopoGeneralOptions* general_options,
-                               const struct ElTopoStaticOperationsOptions* options, 
-                               struct ElTopoDefragInformation* defrag_info,  
-                               struct ElTopoMesh* outputs )
-{
-    //
-    // data wrangling
-    //
-    
-    std::vector<Vec3d> vs;
-    std::vector<double> masses;
-    
-    for ( int i = 0; i < inputs->num_vertices; ++i )
-    {
-        vs.push_back( Vec3d( inputs->vertex_locations[3*i], inputs->vertex_locations[3*i + 1], inputs->vertex_locations[3*i + 2] ) );
-        masses.push_back( inputs->vertex_masses[i] );      
-    }
-    
-    std::vector<Vec3st> ts;
-    for ( int i = 0; i < inputs->num_triangles; ++i )
-    {
-        ts.push_back( Vec3st( inputs->triangles[3*i], inputs->triangles[3*i + 1], inputs->triangles[3*i + 2] ) );
-    }
-    
-    
-    // =================================================================================
-    
-    //
-    // do the actual operations
-    //
-    
-    // build a SurfTrack
-    SurfTrackInitializationParameters construction_parameters;
-    
-    construction_parameters.m_proximity_epsilon = general_options->m_proximity_epsilon;
-    
-    construction_parameters.m_use_fraction = false;
-    construction_parameters.m_min_edge_length = options->m_min_edge_length;
-    construction_parameters.m_max_edge_length = options->m_max_edge_length;
-    construction_parameters.m_max_volume_change = options->m_max_volume_change;   
-    construction_parameters.m_min_triangle_angle = options->m_min_triangle_angle;
-    construction_parameters.m_max_triangle_angle = options->m_max_triangle_angle;
-    construction_parameters.m_use_curvature_when_splitting = options->m_use_curvature_when_splitting;
-    construction_parameters.m_use_curvature_when_collapsing = options->m_use_curvature_when_collapsing;
-    construction_parameters.m_min_curvature_multiplier = options->m_min_curvature_multiplier;
-    construction_parameters.m_max_curvature_multiplier = options->m_max_curvature_multiplier;
-    construction_parameters.m_allow_vertex_movement = options->m_allow_vertex_movement;
-    construction_parameters.m_edge_flip_min_length_change = options->m_edge_flip_min_length_change;   
-    construction_parameters.m_merge_proximity_epsilon = options->m_merge_proximity_epsilon;
-    construction_parameters.m_collision_safety = general_options->m_collision_safety;
-    construction_parameters.m_allow_topology_changes = options->m_allow_topology_changes;
-    construction_parameters.m_perform_improvement = options->m_perform_improvement;
-    construction_parameters.m_subdivision_scheme = (SubdivisionScheme*) options->m_subdivision_scheme;
-    
-    
-    SurfTrack surface_tracker( vs, ts, masses, construction_parameters ); 
-    
-    surface_tracker.improve_mesh();
-    
-    // do merging
-    surface_tracker.topology_changes();
-    
-    surface_tracker.defrag_mesh();
-    
-    
-    // =================================================================================
-    
-    defrag_info->num_vertex_changes = to_int(surface_tracker.m_vertex_change_history.size());
-    defrag_info->vertex_is_remove = (int*) malloc( defrag_info->num_vertex_changes * sizeof(int) );
-    defrag_info->vertex_index = (int*) malloc( defrag_info->num_vertex_changes * sizeof(int) );
-    defrag_info->split_edge = (int*) malloc( 2 * defrag_info->num_vertex_changes * sizeof(int) );
-    
-    for ( int i = 0; i < defrag_info->num_vertex_changes; ++i )
-    {
-        defrag_info->vertex_is_remove[i] = surface_tracker.m_vertex_change_history[i].m_is_remove ? 1 : 0;
-        defrag_info->vertex_index[i] = to_int(surface_tracker.m_vertex_change_history[i].m_vertex_index);
-        defrag_info->split_edge[2*i+0] = to_int(surface_tracker.m_vertex_change_history[i].m_split_edge[0]);
-        defrag_info->split_edge[2*i+1] = to_int(surface_tracker.m_vertex_change_history[i].m_split_edge[1]);
-    }
-    
-    defrag_info->num_triangle_changes = to_int(surface_tracker.m_triangle_change_history.size());
-    defrag_info->triangle_is_remove = (int*) malloc( defrag_info->num_triangle_changes * sizeof(int) );
-    defrag_info->triangle_index = (int*) malloc( defrag_info->num_triangle_changes * sizeof(int) );
-    defrag_info->new_tri = (int*) malloc( 3 * defrag_info->num_triangle_changes * sizeof(int) );
-    
-    for ( int i = 0; i < defrag_info->num_triangle_changes; ++i )
-    {
-        defrag_info->triangle_is_remove[i] = surface_tracker.m_triangle_change_history[i].m_is_remove ? 1 : 0;
-        defrag_info->triangle_index[i] = to_int(surface_tracker.m_triangle_change_history[i].m_triangle_index);
-        defrag_info->new_tri[3*i+0] = to_int(surface_tracker.m_triangle_change_history[i].m_tri[0]);
-        defrag_info->new_tri[3*i+1] = to_int(surface_tracker.m_triangle_change_history[i].m_tri[1]);
-        defrag_info->new_tri[3*i+2] = to_int(surface_tracker.m_triangle_change_history[i].m_tri[2]);
-    }
-    
-    
-    defrag_info->defragged_triangle_map_size = to_int(surface_tracker.m_defragged_triangle_map.size());
-    defrag_info->defragged_triangle_map = (int*) malloc( 2 * defrag_info->defragged_triangle_map_size * sizeof(int)  );
-    
-    for ( int i = 0; i < defrag_info->defragged_triangle_map_size; ++i )
-    {
-        defrag_info->defragged_triangle_map[2*i+0] = to_int(surface_tracker.m_defragged_triangle_map[i][0]);
-        defrag_info->defragged_triangle_map[2*i+1] = to_int(surface_tracker.m_defragged_triangle_map[i][1]);
-    }
-    
-    defrag_info->defragged_vertex_map_size = to_int(surface_tracker.m_defragged_vertex_map.size());
-    defrag_info->defragged_vertex_map = (int*) malloc( 2 * defrag_info->defragged_vertex_map_size * sizeof(int) );
-    
-    for ( int i = 0; i < defrag_info->defragged_vertex_map_size; ++i )
-    {
-        defrag_info->defragged_vertex_map[2*i+0] = to_int(surface_tracker.m_defragged_vertex_map[i][0]);
-        defrag_info->defragged_vertex_map[2*i+1] = to_int(surface_tracker.m_defragged_vertex_map[i][1]);
-    }
-    
-    // =================================================================================
-    
-    //
-    // data wrangling
-    //
-    
-    outputs->num_vertices = to_int(surface_tracker.get_num_vertices());
-    outputs->vertex_locations = (double*) malloc( 3 * (outputs->num_vertices) * sizeof(double) );
-    outputs->vertex_masses = (double*) malloc( (outputs->num_vertices) * sizeof(double) );
-    
-    for ( int i = 0; i < outputs->num_vertices; ++i )
-    {
-        const Vec3d& pos = surface_tracker.get_position(i);
-        outputs->vertex_locations[3*i + 0] = pos[0];
-        outputs->vertex_locations[3*i + 1] = pos[1];  
-        outputs->vertex_locations[3*i + 2] = pos[2];
-        outputs->vertex_masses[i] = surface_tracker.m_masses[i];
-    }
-    
-    outputs->num_triangles = to_int(surface_tracker.m_mesh.num_triangles());
-    outputs->triangles = (int*) malloc( 3 * (outputs->num_triangles) * sizeof(int) );
-    
-    for ( int i = 0; i < outputs->num_triangles; ++i )
-    {
-        const Vec3st& curr_tri = surface_tracker.m_mesh.get_triangle(i); 
-        outputs->triangles[3*i + 0] = to_int(curr_tri[0]);
-        outputs->triangles[3*i + 1] = to_int(curr_tri[1]);
-        outputs->triangles[3*i + 2] = to_int(curr_tri[2]);
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Free memory allocated by static operations and defrag.
-///
-// ---------------------------------------------------------
-
-void el_topo_free_static_operations_results( ElTopoMesh* outputs, struct ElTopoDefragInformation* defrag_info )
-{
-    free( outputs->vertex_locations );
-    free( outputs->vertex_masses );
-    free( outputs->triangles );
-    
-    free( defrag_info->vertex_is_remove );
-    free( defrag_info->vertex_index );
-    free( defrag_info->split_edge );
-    free( defrag_info->triangle_is_remove );
-    free( defrag_info->triangle_index );
-    free( defrag_info->new_tri );
-    free( defrag_info->defragged_triangle_map );
-    free( defrag_info->defragged_vertex_map );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Surface vertex position integration.
-///
-// ---------------------------------------------------------
-
-void el_topo_integrate( const ElTopoMesh* inputs,
-                       const double* in_vertex_new_locations,
-                       const struct ElTopoGeneralOptions* general_options,
-                       const struct ElTopoIntegrationOptions* options,
-                       double **out_vertex_locations,
-                       double *out_dt )
-{
-    //
-    // data wrangling
-    //
-    
-    std::vector<Vec3d> vs;
-    std::vector<double> masses;
-    
-    for ( int i = 0; i < inputs->num_vertices; ++i )
-    {
-        vs.push_back( Vec3d( inputs->vertex_locations[3*i], inputs->vertex_locations[3*i + 1], inputs->vertex_locations[3*i + 2] ) );
-        masses.push_back( inputs->vertex_masses[i] );
-    }
-    
-    std::vector<Vec3st> ts;
-    for ( int i = 0; i < inputs->num_triangles; ++i )
-    {
-        ts.push_back( Vec3st( inputs->triangles[3*i], inputs->triangles[3*i + 1], inputs->triangles[3*i + 2] ) );
-    }
-    
-    // =================================================================================
-    
-    //
-    // do the integration
-    //
-    
-    // build a DynamicSurface
-	DynamicSurface dynamic_surface( vs, ts, masses, general_options->m_proximity_epsilon, options->m_friction_coefficient, general_options->m_collision_safety, general_options->m_verbose );
-    
-    dynamic_surface.set_all_newpositions( inputs->num_vertices, in_vertex_new_locations );
-    
-    // advance by dt
-    double actual_dt;
-    dynamic_surface.integrate( options->m_dt, actual_dt );
-    
-    // the dt used may be different than specified (if we cut the time step)
-    *out_dt = actual_dt;
-    
-    
-    // =================================================================================   
-    
-    //
-    // data wrangling
-    //
-    
-    *out_vertex_locations = (double*) malloc( 3 * inputs->num_vertices * sizeof(double) );
-    for ( int i = 0; i < inputs->num_vertices; ++i )
-    {
-        const Vec3d& pos = dynamic_surface.get_position(i);
-        (*out_vertex_locations)[3*i]     = pos[0];
-        (*out_vertex_locations)[3*i + 1] = pos[1];
-        (*out_vertex_locations)[3*i + 2] = pos[2];
-    }
-    
-}
-
-
-
-// ---------------------------------------------------------
-///
-/// Free memory allocated by integration.
-///
-// ---------------------------------------------------------
-
-void el_topo_free_integrate_results( double* out_vertex_locations )
-{
-    free( out_vertex_locations );
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/eltopo.h b/extern/eltopo/eltopo3d/eltopo.h
deleted file mode 100644
index b66658e..0000000
--- a/extern/eltopo/eltopo3d/eltopo.h
+++ /dev/null
@@ -1,267 +0,0 @@
-// ---------------------------------------------------------
-//
-//  eltopo.h
-//  Tyson Brochu 2009
-//
-//  C-callable API for El Topo
-//
-// ---------------------------------------------------------
-
-#ifndef ELTOPO_H
-#define ELTOPO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-    
-    // =========================================================
-    //  STRUCTURES FOR SPECIFYING OPTIONS
-    // =========================================================   
-    
-    // ---------------------------------------------------------
-    ///
-    /// Options common to static operations and position integration.
-    ///
-    // ---------------------------------------------------------
-    
-    struct ElTopoGeneralOptions
-    {
-        int m_verbose;               // whether to output a lot of information to the console
-        int m_collision_safety;      // whether to enforce an intersection-free mesh at all times
-        double m_proximity_epsilon;
-    };
-    
-    // ---------------------------------------------------------
-    ///
-    /// Options for static operations (mesh maintenance and topology change)
-    ///
-    // ---------------------------------------------------------
-    
-    struct ElTopoStaticOperationsOptions
-    {
-        /// whether to perform mesh maintenance
-        int m_perform_improvement;            
-        
-        /// whether to allow merging and separation
-        int m_allow_topology_changes;     
-        
-        /// maximum allowable change in volume when performing mesh maintenance
-        double m_max_volume_change;       
-        
-        /// edges shorter than this length will be collapsed
-        double m_min_edge_length;              
-        
-        /// edges longer then this length will be subdivided
-        double m_max_edge_length;              
-        
-        /// prevent triangles smaller than this area
-        double m_min_triangle_area;
-        
-        /// prevent interior angles smaller than this
-        double m_min_triangle_angle;
-        
-        /// prevent interior angles greater than this
-        double m_max_triangle_angle;   
-        
-        /// boolean, whether to use curvature adaptivity when splitting edges
-        int m_use_curvature_when_splitting;
-
-        /// whether to use curvature adaptivity when collapsing edges        
-        int m_use_curvature_when_collapsing;
-        
-        /// clamp curvature scaling to these values
-        double m_min_curvature_multiplier;
-        
-        /// clamp curvature scaling to these values
-        double m_max_curvature_multiplier;
-        
-        /// boolean, whether to allow vertices to move during improvement
-        int m_allow_vertex_movement;
-        
-        /// Minimum edge length improvement in order to flip an edge
-        double m_edge_flip_min_length_change;
-        
-        /// Elements within this distance will trigger a merge attempt   
-        double m_merge_proximity_epsilon;
-        
-        /// Type of subdivision to use when collapsing or splitting (butterfly, quadric error minimization, etc.)
-        void *m_subdivision_scheme;   
-        
-        /// boolean, whether to enforce collision-free surfaces (including during mesh maintenance operations)
-        int m_collision_safety;
-        
-        /// boolean, whether to allow non-manifold (edges incident on more than two triangles)
-        int m_allow_non_manifold;
-        
-    };
-    
-    // ---------------------------------------------------------
-    ///
-    /// Options for position integration
-    ///
-    // ---------------------------------------------------------
-    
-    struct ElTopoIntegrationOptions
-    {
-        /// friction coefficient to apply during collision resolution
-        double m_friction_coefficient;
-        
-        /// integration timestep size
-        double m_dt;                     
-    };
-    
-    
-    // ---------------------------------------------------------
-    ///
-    /// A mesh object: list of triangles, vertex positions, and vertex masses
-    ///
-    // ---------------------------------------------------------
-    
-    struct ElTopoMesh
-    {
-        
-        /// Number of vertices
-        int num_vertices;
-        
-        /// Vertex positions in 3D space.  This array should be shaped like: [x0 y0 z0 x1 y1 z1 ... ]
-        double* vertex_locations;
-        
-        /// Number of traingles
-        int num_triangles;
-        
-        /// Triangles, indexing into the vertex array. [a0 b0 c0 a1 b1 c1 ... ], where triangle i has vertices (ai,bi,ci).
-        int* triangles;
-        
-        /// For each vertex i, array element i is 1 if the vertex is solid, 0 otherwise
-        double* vertex_masses;
-        
-    };
-    
-    
-    // ---------------------------------------------------------
-    ///
-    /// Defragment information, recording all vertex and triangle operations, and maps from old indices to new ones
-    ///
-    // ---------------------------------------------------------
-    
-    struct ElTopoDefragInformation
-    {
-        /// Number of entries in the vertex change history
-        int num_vertex_changes;     // = N
-            
-        /// Boolean, 0: vertex addition, non-zero: vertex removal
-        int* vertex_is_remove;      // size N
-        
-        /// The index of the affected vertex
-        int* vertex_index;          // size N
-        
-        /// If this is a vertex addition due to splitting, the split edge, stored as pairs of vertex indices
-        int* split_edge;            // size 2*N
-        
-        
-        /// Number of entries in the triangle change history
-        int num_triangle_changes;  // = N
-        
-        /// Boolean, 0: triangle addition, non-zero: triangle removal
-        int* triangle_is_remove;   // boolean, size N
-        
-        /// The index of the affected triangle
-        int* triangle_index;       // N
-        
-        /// If this is a triangle addition, the new triangle, stored as a triplet of vertex indices
-        int* new_tri;              // 3*N
-        
-        /// Size of the defragged triangle map
-        int defragged_triangle_map_size;    // = N
-        
-        /// For each triangle, a pair of indices (old, new), where old is the triangle index at before defrag, and new is the 
-        /// triangle index after defrag
-        int* defragged_triangle_map;        // 2*N
-
-        /// Size of the defragged vertex map
-        int defragged_vertex_map_size;      // = N
-        
-        /// For each vertex, a pair of indices (old, new), where old is the vertex index at before defrag, and new is the vertex
-        /// index after defrag        
-        int* defragged_vertex_map;          // 2*N
-        
-    };
-    
-    
-    // =========================================================
-    //  API FUNCTIONS
-    // =========================================================   
-    
-    
-    // ---------------------------------------------------------
-    ///
-    /// Static operations: edge collapse, edge split, edge flip, null-space 
-    /// smoothing, and topological changes
-    ///
-    /// Parameters:
-    ///   input_mesh:                (Input) ElTopoMesh to be operated on
-    ///   general_otions             (Input) Structure specifying options common to
-    ///                                      static operations and integration.
-    ///   options                    (Input) Structure specifying options specific 
-    ///                                      to static operations.
-    ///   defrag_info                (Output, allocated by El Topo) Change history and defrag maps, recording the operations 
-    ///                                       performed at the vertex and triangle level.
-    ///   output_mesh                (Output, allocated by El Topo) Mesh data structure after remeshing and topology operations.
-    ///
-    // ---------------------------------------------------------
-    
-    void el_topo_static_operations( const struct ElTopoMesh* input_mesh,
-                                   const struct ElTopoGeneralOptions* general_options,
-                                   const struct ElTopoStaticOperationsOptions* options, 
-                                   struct ElTopoDefragInformation* defrag_info, 
-                                   struct ElTopoMesh* output_mesh );
-    
-    // ---------------------------------------------------------
-    ///
-    /// Free memory allocated by static operations.
-    ///
-    // ---------------------------------------------------------
-    
-    void el_topo_free_static_operations_results( struct ElTopoMesh* outputs, struct ElTopoDefragInformation* defrag_info  );
-    
-    
-    // ---------------------------------------------------------
-    ///
-    /// Surface vertex position integration.
-    ///
-    /// Parameters:
-    ///   input_mesh:               (Input) Mesh data structure to be integrated forward.
-    ///   in_vertex_new_locations   (Input) Predicted vertex positions at the end of the time step.  
-    ///   general_otions            (Input) Structure specifying options common to
-    ///                                      static operations and integration.
-    ///   options                   (Input) Structure specifying options specific 
-    ///                                      to integration operations.    
-    ///   out_vertex_locations      (Output) Final vertex positions after integration.
-    ///   out_dt                    (Output) Actual time step taken by the function.
-    ///     
-    ///
-    // ---------------------------------------------------------
-    
-    void el_topo_integrate(const struct ElTopoMesh* input_mesh,
-                           const double* in_vertex_new_locations,
-                           const struct ElTopoGeneralOptions* general_options,
-                           const struct ElTopoIntegrationOptions* options,
-                           double **out_vertex_locations,
-                           double *out_dt );
-    
-    
-    // ---------------------------------------------------------
-    ///
-    /// Free memory allocated by integration.
-    ///
-    // ---------------------------------------------------------
-    
-    void el_topo_free_integrate_results( double* out_vertex_locations );
-    
-    
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/extern/eltopo/eltopo3d/h-file-template.txt b/extern/eltopo/eltopo3d/h-file-template.txt
deleted file mode 100644
index 545bc4f..0000000
--- a/extern/eltopo/eltopo3d/h-file-template.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-// ---------------------------------------------------------
-//
-//  file.h
-//
-//  Description
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
diff --git a/extern/eltopo/eltopo3d/impactzonesolver.cpp b/extern/eltopo/eltopo3d/impactzonesolver.cpp
deleted file mode 100644
index 12f6f97..0000000
--- a/extern/eltopo/eltopo3d/impactzonesolver.cpp
+++ /dev/null
@@ -1,768 +0,0 @@
-// ---------------------------------------------------------
-//
-//  impactzonesolver.cpp
-//  Tyson Brochu 2011
-//  
-//  Encapsulates two impact zone solvers: inelastic impact zones, and rigid impact zones.
-//
-// ---------------------------------------------------------
-
-#include <collisionpipeline.h>
-#include <dynamicsurface.h>
-#include <impactzonesolver.h>
-#include <krylov_solvers.h>
-#include <mat.h>
-#include <sparse_matrix.h>
-#include <runstats.h>
-
-namespace {
-    
-    // ---------------------------------------------------------
-    ///
-    /// Combine impact zones which have overlapping vertex stencils
-    ///
-    // ---------------------------------------------------------
-    
-    void merge_impact_zones( std::vector<ImpactZone>& new_impact_zones, std::vector<ImpactZone>& master_impact_zones )
-    {
-        
-        bool merge_ocurred = true;
-        
-        for ( size_t i = 0; i < master_impact_zones.size(); ++i )
-        {
-            master_impact_zones[i].m_all_solved = true;
-        }
-        
-        for ( size_t i = 0; i < new_impact_zones.size(); ++i )
-        {
-            new_impact_zones[i].m_all_solved = false;
-        }
-        
-        
-        while ( merge_ocurred )
-        {
-            
-            merge_ocurred = false;
-            
-            for ( size_t i = 0; i < new_impact_zones.size(); ++i )
-            {
-                bool i_is_disjoint = true;
-                
-                for ( size_t j = 0; j < master_impact_zones.size(); ++j )
-                {
-                    // check if impact zone i and j share any vertices
-                    
-                    if ( master_impact_zones[j].share_vertices( new_impact_zones[i] ) )
-                    {
-                        
-                        bool found_new_collision = false;
-                        
-                        // steal all of j's collisions
-                        for ( size_t c = 0; c < new_impact_zones[i].m_collisions.size(); ++c )
-                        {
-                            
-                            bool same_collision_exists = false;
-                            
-                            for ( size_t m = 0; m < master_impact_zones[j].m_collisions.size(); ++m )
-                            {                 
-                                if ( master_impact_zones[j].m_collisions[m].same_vertices( new_impact_zones[i].m_collisions[c] ) )
-                                {
-                                    
-                                    same_collision_exists = true;
-                                    break;
-                                }
-                                
-                            }
-                            
-                            if ( !same_collision_exists )
-                            {
-                                master_impact_zones[j].m_collisions.push_back( new_impact_zones[i].m_collisions[c] );
-                                found_new_collision = true;
-                            }
-                        }
-                        
-                        // did we find any collisions in zone i that zone j didn't already have?
-                        if ( found_new_collision )
-                        {
-                            master_impact_zones[j].m_all_solved &= new_impact_zones[i].m_all_solved;
-                        }
-                        
-                        merge_ocurred = true;
-                        i_is_disjoint = false;
-                        break;
-                    }
-                    
-                }     // end for(j)
-                
-                if ( i_is_disjoint )
-                {
-                    // copy the impact zone
-                    
-                    ImpactZone new_zone;
-                    for ( size_t c = 0; c < new_impact_zones[i].m_collisions.size(); ++c )
-                    {
-                        new_zone.m_collisions.push_back( new_impact_zones[i].m_collisions[c] );
-                    }
-                    
-                    new_zone.m_all_solved = new_impact_zones[i].m_all_solved;
-                    
-                    master_impact_zones.push_back( new_zone );
-                }
-            }     // end for(i)
-            
-            new_impact_zones = master_impact_zones;
-            master_impact_zones.clear();
-            
-        }  // while
-        
-        master_impact_zones = new_impact_zones;
-        
-    }
-    
-    // ---------------------------------------------------------
-    ///
-    /// Helper function: multiply transpose(A) * D * B
-    ///
-    // ---------------------------------------------------------
-    
-    void AtDB(const SparseMatrixDynamicCSR &A, const double* diagD, const SparseMatrixDynamicCSR &B, SparseMatrixDynamicCSR &C)
-    {
-        assert(A.m==B.m);
-        C.resize(A.n, B.n);
-        C.set_zero();
-        for(int k=0; k<A.m; ++k)
-        {
-            const DynamicSparseVector& r = A.row[k];
-            
-            for( DynamicSparseVector::const_iterator p=r.begin(); p != r.end(); ++p )
-            {
-                int i = p->index;
-                double multiplier = p->value * diagD[k];
-                C.add_sparse_row( i, B.row[k], multiplier );
-            }
-        }
-    }
-    
-}  // unnamed namespace 
-
-
-// ---------------------------------------------------------
-///
-/// Constructor
-///
-// ---------------------------------------------------------
-
-ImpactZoneSolver::ImpactZoneSolver( DynamicSurface& surface) :
-m_surface( surface ),
-m_rigid_zone_infinite_mass( 1000.0 )
-{}
-
-
-// ---------------------------------------------------------
-///
-/// Iteratively project out relative normal velocities for a set of collisions in an impact zone until all collisions are solved.
-///
-// ---------------------------------------------------------
-
-bool ImpactZoneSolver::iterated_inelastic_projection( ImpactZone& iz, double dt )
-{
-    assert( m_surface.m_masses.size() == m_surface.get_num_vertices() );
-    
-    static const unsigned int MAX_PROJECTION_ITERATIONS = 20;
-    
-    for ( unsigned int i = 0; i < MAX_PROJECTION_ITERATIONS; ++i )
-    {
-        bool success = inelastic_projection( iz );
-        
-        if ( !success )
-        {
-            if ( m_surface.m_verbose ) { std::cout << "failure in inelastic projection" << std::endl; }
-            return false;
-        }
-        
-        bool collision_still_exists = false;
-        
-        for ( size_t c = 0; c < iz.m_collisions.size(); ++c )
-        {
-            
-            // run collision detection on this pair again
-            
-            Collision& collision = iz.m_collisions[c];
-            const Vec4st& vs = collision.m_vertex_indices;
-            
-            m_surface.set_newposition( vs[0], m_surface.get_position(vs[0]) + dt * m_surface.m_velocities[vs[0]]);
-            m_surface.set_newposition( vs[1], m_surface.get_position(vs[1]) + dt * m_surface.m_velocities[vs[1]]);
-            m_surface.set_newposition( vs[2], m_surface.get_position(vs[2]) + dt * m_surface.m_velocities[vs[2]]);
-            m_surface.set_newposition( vs[3], m_surface.get_position(vs[3]) + dt * m_surface.m_velocities[vs[3]]);         
-            
-            if ( m_surface.m_verbose ) { std::cout << "checking collision " << vs << std::endl; }
-            
-            if ( collision.m_is_edge_edge )
-            {
-                
-                double s0, s2, rel_disp;
-                Vec3d normal;
-                
-                assert( vs[0] < vs[1] && vs[2] < vs[3] );       // should have been sorted by original collision detection
-                
-                if ( segment_segment_collision( m_surface.get_position(vs[0]), m_surface.get_newposition(vs[0]), vs[0],
-                                               m_surface.get_position(vs[1]), m_surface.get_newposition(vs[1]), vs[1],
-                                               m_surface.get_position(vs[2]), m_surface.get_newposition(vs[2]), vs[2],
-                                               m_surface.get_position(vs[3]), m_surface.get_newposition(vs[3]), vs[3],
-                                               s0, s2,
-                                               normal,
-                                               rel_disp ) )               
-                {
-                    collision.m_normal = normal;
-                    collision.m_alphas = Vec4d( -s0, -(1-s0), s2, (1-s2) );
-                    collision.m_relative_displacement = rel_disp;
-                    collision_still_exists = true;
-                }
-                
-            }
-            else
-            {
-                
-                double s1, s2, s3, rel_disp;
-                Vec3d normal;
-                
-                assert( vs[1] < vs[2] && vs[2] < vs[3] && vs[1] < vs[3] );    // should have been sorted by original collision detection
-                
-                if ( point_triangle_collision( m_surface.get_position(vs[0]), m_surface.get_newposition(vs[0]), vs[0],
-                                              m_surface.get_position(vs[1]), m_surface.get_newposition(vs[1]), vs[1],
-                                              m_surface.get_position(vs[2]), m_surface.get_newposition(vs[2]), vs[2],
-                                              m_surface.get_position(vs[3]), m_surface.get_newposition(vs[3]), vs[3],
-                                              s1, s2, s3,
-                                              normal,
-                                              rel_disp ) )                                 
-                {
-                    collision.m_normal = normal;
-                    collision.m_alphas = Vec4d( 1, -s1, -s2, -s3 );
-                    collision.m_relative_displacement = rel_disp;
-                    collision_still_exists = true;
-                }
-                
-            }
-            
-        } // for collisions
-        
-        if ( false == collision_still_exists )  
-        {
-            return true; 
-        }
-        
-    } // for iterations
-    
-    if ( m_surface.m_verbose ) 
-    { 
-        std::cout << "reached max iterations for this zone" << std::endl; 
-    }
-    
-    return false;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Project out relative normal velocities for a set of collisions in an impact zone.
-///
-// ---------------------------------------------------------
-
-bool ImpactZoneSolver::inelastic_projection( const ImpactZone& iz )
-{
-    
-    if ( m_surface.m_verbose )
-    {
-        std::cout << " ----- using sparse solver " << std::endl;
-    }
-    
-    const size_t k = iz.m_collisions.size();    // notation from [Harmon et al 2008]: k == number of collisions
-    
-    std::vector<size_t> zone_vertices;
-    iz.get_all_vertices( zone_vertices );
-    
-    const size_t n = zone_vertices.size();       // n == number of distinct colliding vertices
-    
-    if ( m_surface.m_verbose ) { std::cout << "GCT: " << 3*n << "x" << k << std::endl; }
-    
-    SparseMatrixDynamicCSR GCT( to_int(3*n), to_int(k) );
-    GCT.set_zero();
-    
-    // construct matrix grad C transpose
-    for ( int i = 0; i < to_int(k); ++i )
-    {
-        // set col i
-        const Collision& coll = iz.m_collisions[i];
-        
-        for ( unsigned int v = 0; v < 4; ++v )
-        {
-            // block row j ( == block column j of grad C )
-            size_t j = coll.m_vertex_indices[v];
-            
-            std::vector<size_t>::iterator zone_vertex_iter = find( zone_vertices.begin(), zone_vertices.end(), j );
-            
-            assert( zone_vertex_iter != zone_vertices.end() );
-            
-            int mat_j = to_int( zone_vertex_iter - zone_vertices.begin() );
-            
-            GCT(mat_j*3, i) = coll.m_alphas[v] * coll.m_normal[0];
-            GCT(mat_j*3+1, i) = coll.m_alphas[v] * coll.m_normal[1];
-            GCT(mat_j*3+2, i) = coll.m_alphas[v] * coll.m_normal[2];
-            
-        }
-    }
-    
-    Array1d inv_masses;
-    inv_masses.reserve(3*n);
-    Array1d column_velocities;
-    column_velocities.reserve(3*n);
-    
-    for ( size_t i = 0; i < n; ++i )
-    {
-        
-        inv_masses.push_back( 1.0 / m_surface.m_masses[zone_vertices[i]] );
-        inv_masses.push_back( 1.0 / m_surface.m_masses[zone_vertices[i]] );
-        inv_masses.push_back( 1.0 / m_surface.m_masses[zone_vertices[i]] );
-        
-        column_velocities.push_back( m_surface.m_velocities[zone_vertices[i]][0] );
-        column_velocities.push_back( m_surface.m_velocities[zone_vertices[i]][1] );
-        column_velocities.push_back( m_surface.m_velocities[zone_vertices[i]][2] );
-    }
-    
-    //
-    // minimize | M^(-1/2) * GC^T x - M^(1/2) * v |^2
-    //
-    
-    // solution vector
-    Array1d x(k);
-    
-    KrylovSolverStatus solver_result;
-    
-    // normal equations: GC * M^(-1) GCT * x = GC * v
-    //                   A * x = b
-    
-    SparseMatrixDynamicCSR A( to_int(k), to_int(k) );
-    A.set_zero();
-    AtDB( GCT, inv_masses.data, GCT, A ); 
-    
-    Array1d b(k);
-    GCT.apply_transpose( column_velocities.data, b.data );   
-    
-    if ( m_surface.m_verbose )  { std::cout << "system built" << std::endl; }
-    
-    MINRES_CR_Solver solver;   
-    SparseMatrixStaticCSR solver_matrix( A );    // convert dynamic to static
-    solver.max_iterations = 1000;
-    solver_result = solver.solve( solver_matrix, b.data, x.data ); 
-    
-    if ( solver_result != KRYLOV_CONVERGED )
-    {
-        if ( m_surface.m_verbose )
-        {
-            std::cout << "CR solver failed: ";      
-            if ( solver_result == KRYLOV_BREAKDOWN )
-            {
-                std::cout << "KRYLOV_BREAKDOWN" << std::endl;
-            }
-            else
-            {
-                std::cout << "KRYLOV_EXCEEDED_MAX_ITERATIONS" << std::endl;
-            }
-            
-            double residual_norm = BLAS::abs_max(solver.r);
-            std::cout << "residual_norm: " << residual_norm << std::endl;
-            
-        }
-        
-        return false;          
-    } 
-    
-    // apply impulses 
-    Array1d applied_impulses(3*n);
-    GCT.apply( x.data, applied_impulses.data );
-    
-    static const double IMPULSE_MULTIPLIER = 0.8;
-    
-    for ( size_t i = 0; i < applied_impulses.size(); ++i )
-    {
-        column_velocities[i] -= IMPULSE_MULTIPLIER * inv_masses[i] * applied_impulses[i];      
-    }
-    
-    for ( size_t i = 0; i < n; ++i )
-    {
-        m_surface.m_velocities[zone_vertices[i]][0] = column_velocities[3*i];
-        m_surface.m_velocities[zone_vertices[i]][1] = column_velocities[3*i + 1];
-        m_surface.m_velocities[zone_vertices[i]][2] = column_velocities[3*i + 2];      
-    }
-    
-    
-    return true;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Handle all collisions simultaneously by iteratively solving individual impact zones until no new collisions are detected.
-///
-// ---------------------------------------------------------
-
-bool ImpactZoneSolver::inelastic_impact_zones(double dt)
-{
-    
-    // copy
-    std::vector<Vec3d> old_velocities = m_surface.m_velocities;
-    
-    std::vector<ImpactZone> impact_zones;
-    
-    bool finished_detecting_collisions = false;
-    
-    std::vector<Collision> total_collisions;
-    finished_detecting_collisions = m_surface.m_collision_pipeline->detect_collisions(total_collisions);
-    
-    while ( false == total_collisions.empty() )
-    {      
-        // insert each new collision constraint into its own impact zone
-        std::vector<ImpactZone> new_impact_zones;
-        for ( size_t i = 0; i < total_collisions.size(); ++i )
-        {
-            ImpactZone new_zone;
-            new_zone.m_collisions.push_back( total_collisions[i] );
-            new_impact_zones.push_back( new_zone );
-        }
-        
-        // now we have one zone for each collision
-        assert( new_impact_zones.size() == total_collisions.size() );
-        
-        // merge all impact zones that share vertices
-        merge_impact_zones( new_impact_zones, impact_zones );
-        
-        // remove impact zones which have been solved
-        for ( int i = 0; i < (int) impact_zones.size(); ++i )
-        {
-            if ( impact_zones[i].m_all_solved ) 
-            {
-                impact_zones.erase( impact_zones.begin() + i );
-                --i;
-            }
-        }
-        
-        for ( int i = 0; i < (int) impact_zones.size(); ++i )
-        {
-            assert( false == impact_zones[i].m_all_solved );
-        }            
-        
-        bool all_zones_solved_ok = true;
-        
-        // for each impact zone
-        for ( size_t i = 0; i < impact_zones.size(); ++i )
-        {
-            
-            // reset impact zone to pre-response m_velocities
-            for ( size_t j = 0; j < impact_zones[i].m_collisions.size(); ++j )
-            {
-                const Vec4st& vs = impact_zones[i].m_collisions[j].m_vertex_indices;            
-                m_surface.m_velocities[vs[0]] = old_velocities[vs[0]];
-                m_surface.m_velocities[vs[1]] = old_velocities[vs[1]];
-                m_surface.m_velocities[vs[2]] = old_velocities[vs[2]];
-                m_surface.m_velocities[vs[3]] = old_velocities[vs[3]]; 
-            }
-            
-            // apply inelastic projection
-            
-            all_zones_solved_ok &= iterated_inelastic_projection( impact_zones[i], dt );
-            
-            // reset predicted positions
-            for ( size_t j = 0; j < impact_zones[i].m_collisions.size(); ++j )
-            {
-                const Vec4st& vs = impact_zones[i].m_collisions[j].m_vertex_indices;            
-                
-                m_surface.set_newposition( vs[0], m_surface.get_position(vs[0]) + dt * m_surface.m_velocities[vs[0]] );
-                m_surface.set_newposition( vs[1], m_surface.get_position(vs[1]) + dt * m_surface.m_velocities[vs[1]] );
-                m_surface.set_newposition( vs[2], m_surface.get_position(vs[2]) + dt * m_surface.m_velocities[vs[2]] );
-                m_surface.set_newposition( vs[3], m_surface.get_position(vs[3]) + dt * m_surface.m_velocities[vs[3]] );
-                
-            } 
-            
-        }  // for IZs
-        
-        
-        if ( false == all_zones_solved_ok )
-        {
-            if ( m_surface.m_verbose ) 
-            { 
-                std::cout << "at least one impact zone had a solver problem" << std::endl; 
-            }
-            
-            return false;
-        }
-        
-        total_collisions.clear();
-        
-        if ( !finished_detecting_collisions )
-        {
-            if ( m_surface.m_verbose ) { std::cout << "attempting to finish global collision detection" << std::endl; }
-            finished_detecting_collisions = m_surface.m_collision_pipeline->detect_collisions( total_collisions );
-            impact_zones.clear();
-        }
-        else
-        {
-            bool detect_ok = m_surface.m_collision_pipeline->detect_new_collisions( impact_zones, total_collisions );
-            if ( !detect_ok )
-            {
-                return false;
-            }
-        }
-        
-    }
-    
-    return true;
-    
-}
-
-
-
-// ---------------------------------------------------------
-///
-///  Rigid Impact Zones, as described in [Bridson, Fedkiw, Anderson 2002].
-///
-// ---------------------------------------------------------
-
-
-bool ImpactZoneSolver::rigid_impact_zones(double dt)
-{
-    
-    extern RunStats g_stats;
-    g_stats.add_to_int( "ImpactZoneSolver:rigid_impact_zones", 1 );
-    
-    // copy
-    std::vector<Vec3d> old_velocities = m_surface.m_velocities;
-    
-    std::vector<ImpactZone> impact_zones;
-    
-    bool finished_detecting_collisions = false;
-    
-    std::vector<Collision> total_collisions;
-    finished_detecting_collisions = m_surface.m_collision_pipeline->detect_collisions(total_collisions);
-    
-    while ( false == total_collisions.empty() )
-    {      
-        // insert each new collision constraint into its own impact zone
-        std::vector<ImpactZone> new_impact_zones;
-        for ( size_t i = 0; i < total_collisions.size(); ++i )
-        {
-            ImpactZone new_zone;
-            new_zone.m_collisions.push_back( total_collisions[i] );
-            new_impact_zones.push_back( new_zone );
-            
-        }  // for loop over total_collisions
-        
-        assert( new_impact_zones.size() == total_collisions.size() );
-        
-        // merge all impact zones that share vertices
-        merge_impact_zones( new_impact_zones, impact_zones );
-        
-        for ( int i = 0; i < (int) impact_zones.size(); ++i )
-        {
-            if ( impact_zones[i].m_all_solved ) 
-            {
-                impact_zones[i].m_all_solved = false;
-                impact_zones.erase( impact_zones.begin() + i );
-                --i;
-            }
-        }
-        
-        for ( int i = 0; i < (int) impact_zones.size(); ++i )
-        {
-            assert( false == impact_zones[i].m_all_solved );
-        }            
-        
-        // for each impact zone
-        for ( size_t i = 0; i < impact_zones.size(); ++i )
-        {
-            
-            std::vector<size_t> zone_vertices;
-            impact_zones[i].get_all_vertices( zone_vertices );
-            bool rigid_motion_ok = calculate_rigid_motion(dt, zone_vertices);
-            
-            if ( !rigid_motion_ok )
-            {
-                std::cout << "rigid impact zone fails" << std::endl;
-                return false;
-            }
-            
-        }  
-        
-        total_collisions.clear();
-        
-        if ( !finished_detecting_collisions )
-        {
-            finished_detecting_collisions = m_surface.m_collision_pipeline->detect_collisions( total_collisions );
-            impact_zones.clear();
-        }
-        else
-        {
-            bool detect_ok = m_surface.m_collision_pipeline->detect_new_collisions( impact_zones, total_collisions );
-            std::cout << "new collisions detected: " << total_collisions.size() << std::endl;
-            
-            if ( !detect_ok )
-            {
-                return false;
-            }
-            
-        }
-        
-    }
-    
-    return true;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the best-fit rigid motion for the set of moving vertices
-///
-// ---------------------------------------------------------
-
-bool ImpactZoneSolver::calculate_rigid_motion(double dt, std::vector<size_t>& vs)
-{
-    Vec3d xcm(0,0,0);
-    Vec3d vcm(0,0,0);
-    double mass = 0;
-    
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        size_t idx = vs[i];
-        
-        double m = m_surface.m_masses[idx];
-        
-        if ( m_surface.vertex_is_solid(idx) )
-        {
-            m = m_rigid_zone_infinite_mass;
-        }
-        
-        assert( m != std::numeric_limits<double>::infinity() );
-        
-        mass += m;
-        
-        m_surface.m_velocities[idx] = ( m_surface.get_newposition(idx) - m_surface.get_position(idx) ) / dt;
-        
-        xcm += m * m_surface.get_position(idx);
-        vcm += m * m_surface.m_velocities[idx];
-    }
-    
-    
-    double min_dist_t0 = 1e+30;
-    double min_dist_t1 = 1e+30;
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        for(size_t j = i+1; j < vs.size(); j++)
-        {
-            min_dist_t0 = min( min_dist_t0, dist( m_surface.get_position(vs[i]), m_surface.get_position(vs[j]) ) );
-            min_dist_t1 = min( min_dist_t1, dist( m_surface.get_newposition(vs[i]), m_surface.get_newposition(vs[j]) ) );
-        }
-    }
-    
-    assert( mass > 0 );
-    
-    xcm /= mass;
-    vcm /= mass;
-    
-    Vec3d L(0,0,0);
-    
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        size_t idx = vs[i];
-        
-        double m = m_surface.m_masses[idx];
-        
-        if ( m_surface.vertex_is_solid(idx) )
-        {
-            m = m_rigid_zone_infinite_mass;
-        }
-        
-        assert( m != std::numeric_limits<double>::infinity() );
-        
-        Vec3d xdiff = m_surface.get_position(idx) - xcm;
-        Vec3d vdiff = m_surface.m_velocities[idx] - vcm;
-        
-        L += m * cross(xdiff, vdiff);
-    }
-    
-    Mat33d I(0,0,0,0,0,0,0,0,0);
-    
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        size_t idx = vs[i];
-        double m = m_surface.m_masses[idx];
-        
-        if ( m_surface.vertex_is_solid(idx) )
-        {
-            m = m_rigid_zone_infinite_mass;
-        }
-        
-        assert( m != std::numeric_limits<double>::infinity() );
-        
-        Vec3d xdiff = m_surface.get_position(idx) - xcm;
-        Mat33d tens = outer(-xdiff, xdiff);
-        
-        double d = mag2(xdiff);
-        tens(0,0) += d;
-        tens(1,1) += d;
-        tens(2,2) += d;
-        
-        I += m * tens;
-    }
-    
-    double det = determinant(I);
-    assert( det != 0 );   
-    Vec3d w = inverse(I) * L;
-    double wmag = mag(w);
-    
-    if ( wmag == 0 )
-    {
-        return false;
-    }
-    
-    assert( wmag > 0 );
-    
-    Vec3d wnorm = w/wmag;
-    
-    double cosdtw = cos(dt * wmag);
-    Vec3d sindtww = sin(dt * wmag) * wnorm;
-    
-    Vec3d xrigid = xcm + dt * vcm;
-    
-    double max_velocity_mag = -1.0;
-    
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        size_t idx = vs[i];
-        
-        Vec3d xdiff = m_surface.get_position(idx) - xcm;
-        Vec3d xf = dot(xdiff, wnorm) * wnorm;
-        Vec3d xr = xdiff - xf;
-        
-        m_surface.set_newposition( idx, xrigid + xf + cosdtw * xr + cross(sindtww, xr) );
-        
-        m_surface.m_velocities[idx] = ( m_surface.get_newposition(idx) - m_surface.get_position(idx) ) / dt;
-        
-        max_velocity_mag = max( max_velocity_mag, mag( m_surface.m_velocities[idx] ) );
-        
-    }
-    
-    min_dist_t1 = 1e+30;
-    for(size_t i = 0; i < vs.size(); i++)
-    {
-        for(size_t j = i+1; j < vs.size(); j++)
-        {
-            min_dist_t1 = min( min_dist_t1, dist( m_surface.get_newposition(vs[i]), m_surface.get_newposition(vs[j]) ) );
-        }
-    }
-    
-    return true;
-    
-}
-
-
diff --git a/extern/eltopo/eltopo3d/impactzonesolver.h b/extern/eltopo/eltopo3d/impactzonesolver.h
deleted file mode 100644
index 30bc104..0000000
--- a/extern/eltopo/eltopo3d/impactzonesolver.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// ---------------------------------------------------------
-//
-//  impactzonesolver.h
-//  Tyson Brochu 2011
-//  
-//  Encapsulates two impact zone solvers: inelastic impact zones, and rigid impact zones.
-//
-// ---------------------------------------------------------
-
-
-#ifndef EL_TOPO_IMPACTZONES_H
-#define EL_TOPO_IMPACTZONES_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <collisionpipeline.h>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class DynamicSurface;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Used in the simultaneous handling of collisions: a set of connected elements which are in collision
-///
-// --------------------------------------------------------
-
-struct ImpactZone
-{
-    /// Constructor
-    ///
-    ImpactZone() :
-    m_collisions(),
-    m_all_solved( false )
-    {}
-    
-    /// Get the set of all vertices in this impact zone
-    ///
-    void get_all_vertices( std::vector<size_t>& vertices ) const;
-    
-    /// Whether this ImpactZones shares vertices with other
-    ///
-    bool share_vertices( const ImpactZone& other ) const;
-    
-    /// Set of collisions with connected vertices
-    ///
-    std::vector<Collision> m_collisions;  
-    
-    /// Whether all collisions in this zone have been solved (i.e. no longer colliding)
-    ///
-    bool m_all_solved;
-    
-};
-
-
-// ---------------------------------------------------------
-///
-/// Impact zone solver.  Handles inelastic impact zones (Harmon et al. 2008) and rigid impact zones (Bridson et al. 2002).
-///
-// ---------------------------------------------------------
-
-class ImpactZoneSolver
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    ImpactZoneSolver( DynamicSurface& surface );
-    
-    /// Handle all collisions simultaneously by iteratively solving individual impact zones until no new collisions are detected.
-    ///
-    bool inelastic_impact_zones(double dt);
-
-    ///  Rigid Impact Zones, as described in [Bridson et al. 2002].
-    ///
-    bool rigid_impact_zones(double dt);
-    
-protected:
-    
-    /// Iteratively project out relative normal velocities for a set of collisions in an impact zone until all collisions are solved.
-    ///
-    bool iterated_inelastic_projection( ImpactZone& iz, double dt );
-    
-    /// Project out relative normal velocities for a set of collisions in an impact zone.
-    ///
-    bool inelastic_projection( const ImpactZone& iz );
-    
-    /// Compute the best-fit rigid motion for the set of moving vertices
-    ///
-    bool calculate_rigid_motion(double dt, std::vector<size_t>& vs);
-    
-    /// The mesh this object operates on
-    /// 
-    DynamicSurface& m_surface;
-    
-    /// For rigid impact zones, treat solid vertices as having high but not infinite mass.  Use this value for mass.
-    ///
-    const double m_rigid_zone_infinite_mass;     
-    
-};
-
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Extract the set of all vertices in all collisions in an ImpactZone
-///
-// --------------------------------------------------------
-
-inline void ImpactZone::get_all_vertices( std::vector<size_t>& vertices ) const
-{
-    vertices.clear();
-    for ( size_t i = 0; i < m_collisions.size(); ++i )
-    {
-        add_unique( vertices, m_collisions[i].m_vertex_indices[0] );
-        add_unique( vertices, m_collisions[i].m_vertex_indices[1] );
-        add_unique( vertices, m_collisions[i].m_vertex_indices[2] );
-        add_unique( vertices, m_collisions[i].m_vertex_indices[3] );
-    }
-}
-
-
-// --------------------------------------------------------
-///
-/// Determine whether another ImpactZone shares any vertices with this ImpactZone
-///
-// --------------------------------------------------------
-
-inline bool ImpactZone::share_vertices( const ImpactZone& other ) const
-{
-    for ( size_t i = 0; i < m_collisions.size(); ++i )
-    {
-        for ( size_t j = 0; j < other.m_collisions.size(); ++j )
-        {
-            if ( m_collisions[i].overlap_vertices( other.m_collisions[j] ) )
-            {
-                return true;
-            }
-        }
-    }
-    
-    return false;
-}
-
-
-#endif
-
-
diff --git a/extern/eltopo/eltopo3d/meshmerger.cpp b/extern/eltopo/eltopo3d/meshmerger.cpp
deleted file mode 100644
index 0cb8423..0000000
--- a/extern/eltopo/eltopo3d/meshmerger.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshmerger.cpp
-//  Tyson Brochu 2011
-//  
-//  Search for mesh edges which are near to each other, zipper their neighbouring triangles together.
-//
-// ---------------------------------------------------------
-
-
-#include <meshmerger.h>
-
-#include <broadphase.h>
-#include <collisionqueries.h>
-#include <queue>
-#include <runstats.h>
-#include <surftrack.h>
-
-// ---------------------------------------------------------
-//  Extern globals
-// ---------------------------------------------------------
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Move vertices around so v[0] and v[4] are closest together
-///
-// --------------------------------------------------------
-
-void MeshMerger::twist_vertices( size_t *zipper_vertices )
-{
-    double min_dist = 1e+30, dist;
-    Vec2st min_pair((size_t)~0, (size_t)~0);
-    
-    // find the closest pair among the 8 vertices
-    for (int i=0; i<4; ++i) 
-    {
-        for (int j=4; j<8; ++j) 
-        {
-            dist = mag( m_surf.get_position(zipper_vertices[i]) - m_surf.get_position(zipper_vertices[j]) );
-            if (dist < min_dist) 
-            {
-                min_dist = dist;
-                min_pair[0] = i;
-                min_pair[1] = j;
-            }
-        }
-    }
-    
-    size_t new_vertices[8];
-    for (int i=0; i<4; ++i) 
-    {
-        new_vertices[i]   = zipper_vertices[(min_pair[0] + i) % 4];
-        new_vertices[i+4] = zipper_vertices[(min_pair[1] + i - 4) % 4 + 4];
-    }
-    
-    memcpy( zipper_vertices, new_vertices, 8 * sizeof(size_t) );
-    
-}
-
-// --------------------------------------------------------
-///
-/// Create a set of triangles to add to perform the zippering operation
-///
-// --------------------------------------------------------
-
-bool MeshMerger::get_zipper_triangles( size_t edge_index_a, size_t edge_index_b, std::vector<Vec3st>& output_triangles )
-{
-    assert( output_triangles.size() == 8 );
-    
-    const Vec2st& edge_a = m_surf.m_mesh.m_edges[edge_index_a];
-    const Vec2st& edge_b = m_surf.m_mesh.m_edges[edge_index_b];
-    
-    size_t zipper_vertices[8];
-    
-    zipper_vertices[0] = edge_a[0];
-    zipper_vertices[2] = edge_a[1];
-    zipper_vertices[4] = edge_b[0];
-    zipper_vertices[6] = edge_b[1];
-    
-    const std::vector<size_t>& incident_triangles_a = m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a];
-    
-    assert( incident_triangles_a.size() == 2 );       // should be checked before calling this function
-    
-    const Vec3st& inc_tri_a0 = m_surf.m_mesh.get_triangle( incident_triangles_a[0] );
-    const Vec3st& inc_tri_a1 = m_surf.m_mesh.get_triangle( incident_triangles_a[1] );
-    
-    size_t third_vertices[2];
-    third_vertices[0] = m_surf.m_mesh.get_third_vertex( zipper_vertices[0], zipper_vertices[2], inc_tri_a0 );
-    third_vertices[1] = m_surf.m_mesh.get_third_vertex( zipper_vertices[0], zipper_vertices[2], inc_tri_a1 );
-    
-    if ( m_surf.m_mesh.oriented(zipper_vertices[0], zipper_vertices[2], inc_tri_a0 ) ) 
-    {
-        zipper_vertices[1] = third_vertices[0];
-        zipper_vertices[3] = third_vertices[1];
-    } 
-    else if ( m_surf.m_mesh.oriented(zipper_vertices[0], zipper_vertices[2], inc_tri_a1) ) 
-    {
-        zipper_vertices[3] = third_vertices[0];
-        zipper_vertices[1] = third_vertices[1];
-    } 
-    else 
-    {
-        // Should not happen
-        std::cout << "Orientation check failed" << std::endl;
-        assert( false );
-    }
-    
-    const std::vector<size_t>& incident_triangles_b = m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b];
-    
-    assert( incident_triangles_b.size() == 2 );       // should be checked before calling this function
-    
-    assert( edge_index_b < m_surf.m_mesh.m_edges.size() );
-    
-    const Vec2st& ce = m_surf.m_mesh.m_edges[edge_index_b];
-    const std::vector<size_t>& et = m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b];
-    
-    const Vec3st& inc_tri_b0 = m_surf.m_mesh.get_triangle( incident_triangles_b[0] );
-    const Vec3st& inc_tri_b1 = m_surf.m_mesh.get_triangle( incident_triangles_b[1] );
-    
-    third_vertices[0] = m_surf.m_mesh.get_third_vertex( ce[0], ce[1], m_surf.m_mesh.get_triangle( et[0] ) );
-    
-    third_vertices[0] = m_surf.m_mesh.get_third_vertex( zipper_vertices[4], zipper_vertices[6], inc_tri_b0 );
-    third_vertices[1] = m_surf.m_mesh.get_third_vertex( zipper_vertices[4], zipper_vertices[6], inc_tri_b1 );   
-    
-    if ( m_surf.m_mesh.oriented(zipper_vertices[4], zipper_vertices[6], inc_tri_b0) ) 
-    {
-        zipper_vertices[5] = third_vertices[0];
-        zipper_vertices[7] = third_vertices[1];
-    } 
-    else if ( m_surf.m_mesh.oriented(zipper_vertices[4], zipper_vertices[6], inc_tri_b1) ) 
-    {
-        zipper_vertices[7] = third_vertices[0];
-        zipper_vertices[5] = third_vertices[1];
-    } 
-    else 
-    {
-        // Should not happen
-        std::cout << "Orientation check failed" << std::endl;
-        assert( false );
-    }
-    
-    // Check for degenerate case
-    for ( unsigned int i = 0; i < 8; ++i) 
-    {
-        for ( unsigned int j = i+1; j < 8; ++j) 
-        {
-            
-            if ( zipper_vertices[i] == zipper_vertices[j] )         // vertices not distinct
-            {
-                return false;
-            }
-            
-            // Check if an edge already exists between two vertices in opposite edge neighbourhoods
-            // (i.e. look for an edge which would be created by zippering)
-            
-            if ( (i < 4) && (j > 3) )
-            {
-                
-                for ( size_t ii = 0; ii < m_surf.m_mesh.m_vertex_to_edge_map[ zipper_vertices[i] ].size(); ++ii )
-                {
-                    for ( size_t jj = 0; jj < m_surf.m_mesh.m_vertex_to_edge_map[ zipper_vertices[j] ].size(); ++jj )
-                    {
-                        if ( m_surf.m_mesh.m_vertex_to_edge_map[ zipper_vertices[i] ][ii] == m_surf.m_mesh.m_vertex_to_edge_map[ zipper_vertices[j] ][jj] )
-                        {
-                            return false;
-                        }
-                    }
-                }
-            }
-            
-        }
-    }
-    
-    // Twist so that vertices 0 and 4 are the pair closest together
-    twist_vertices( zipper_vertices );
-    
-    // now we can use a closed formula to construct zippering triangles
-    
-    output_triangles[0] = Vec3st( zipper_vertices[0], zipper_vertices[4], zipper_vertices[1] );  // a e b
-    output_triangles[1] = Vec3st( zipper_vertices[1], zipper_vertices[4], zipper_vertices[7] );  // b e h
-    output_triangles[2] = Vec3st( zipper_vertices[1], zipper_vertices[7], zipper_vertices[2] );  // b h c
-    output_triangles[3] = Vec3st( zipper_vertices[2], zipper_vertices[7], zipper_vertices[6] );  // c h g
-    output_triangles[4] = Vec3st( zipper_vertices[2], zipper_vertices[6], zipper_vertices[3] );  // c g d
-    output_triangles[5] = Vec3st( zipper_vertices[3], zipper_vertices[6], zipper_vertices[5] );  // d g f
-    output_triangles[6] = Vec3st( zipper_vertices[3], zipper_vertices[5], zipper_vertices[0] );  // d f a
-    output_triangles[7] = Vec3st( zipper_vertices[0], zipper_vertices[5], zipper_vertices[4] );  // a f e
-    
-    return true;
-}
-
-
-// --------------------------------------------------------
-///
-/// Check whether the introduction of the new zippering triangles causes a collision 
-///
-// --------------------------------------------------------
-
-bool MeshMerger::zippering_introduces_collision( const std::vector<Vec3st>& new_triangles, 
-                                                const std::vector<size_t>& deleted_triangles )
-{
-    for ( size_t i = 0; i < new_triangles.size(); ++i )
-    {
-        // Check all existing edges vs new triangles
-        Vec3d low, high;
-        minmax(m_surf.get_position(new_triangles[i][0]), m_surf.get_position(new_triangles[i][1]), m_surf.get_position(new_triangles[i][2]), low, high);
-        
-        std::vector<size_t> overlapping_triangles;
-        m_surf.m_broad_phase->get_potential_triangle_collisions( low, high, true, true, overlapping_triangles );
-        
-        const Vec3st& current_triangle = new_triangles[i];
-        
-        // Check to make sure there doesn't already exist triangles with the same vertices
-        for ( size_t t = 0; t < overlapping_triangles.size(); ++t )      
-        {
-            const Vec3st& other_triangle = m_surf.m_mesh.get_triangle(overlapping_triangles[t]);
-            
-            if (    ((current_triangle[0] == other_triangle[0]) || (current_triangle[0] == other_triangle[1]) || (current_triangle[0] == other_triangle[2]))
-                && ((current_triangle[1] == other_triangle[0]) || (current_triangle[1] == other_triangle[1]) || (current_triangle[1] == other_triangle[2]))
-                && ((current_triangle[2] == other_triangle[0]) || (current_triangle[2] == other_triangle[1]) || (current_triangle[2] == other_triangle[2])) ) 
-            {
-                return true;
-            }
-        }
-        
-        // Check all existing triangles vs new triangles
-        for ( size_t t = 0; t < overlapping_triangles.size(); ++t )      
-        {
-            bool go_to_next_triangle = false;
-            for ( size_t d = 0; d < deleted_triangles.size(); ++d )
-            {
-                if ( overlapping_triangles[t] == deleted_triangles[d] )
-                {
-                    go_to_next_triangle = true;
-                    break;
-                }
-            }
-            if ( go_to_next_triangle )   
-            { 
-                continue; 
-            }
-            
-            if ( check_triangle_triangle_intersection( new_triangles[i], 
-                                                      m_surf.m_mesh.get_triangle(overlapping_triangles[t]), 
-                                                      m_surf.get_positions() ) )
-            {
-                return true;
-            }     
-        }
-        
-        // Check new triangles vs each other
-        for ( size_t j = 0; j < new_triangles.size(); ++j )
-        {
-            if ( i == j )  { continue; }
-            
-            if ( check_triangle_triangle_intersection( new_triangles[i], 
-                                                      new_triangles[j], 
-                                                      m_surf.get_positions() ) )
-            {
-                return true;
-            }
-        }      
-    }
-    
-    // For real collision safety, we need to check for vertices inside the new, joined volume.  
-    // Checking edges vs triangles is technically not enough.
-    
-    return false;
-}
-
-
-// --------------------------------------------------------
-///
-/// Attempt to merge between two edges
-///
-// --------------------------------------------------------
-
-bool MeshMerger::zipper_edges( size_t edge_index_a, size_t edge_index_b )
-{
-    // For now we'll only zipper edges which are incident on 2 triangles
-    if ( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a].size() != 2 || m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b].size() != 2 )
-    {
-        g_stats.add_to_int( "merge_non_manifold_edges", 1 );
-        return false;
-    }
-    
-    //
-    // Get the set of 8 new triangles which will join the two holes in the mesh
-    //
-    
-    std::vector<Vec3st> new_triangles;
-    new_triangles.resize(8);
-    if ( false == get_zipper_triangles( edge_index_a, edge_index_b, new_triangles ) )
-    {
-        g_stats.add_to_int( "merge_no_set_of_triangles", 1 );
-        return false;
-    }
-    
-    // Keep a list of triangles to delete
-    std::vector<size_t> deleted_triangles;
-    deleted_triangles.push_back( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a][0] );
-    deleted_triangles.push_back( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a][1] );
-    deleted_triangles.push_back( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b][0] );
-    deleted_triangles.push_back( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b][1] );   
-    
-    //
-    // Check the new triangles for collision safety, ignoring the triangles which will be deleted
-    //
-    
-    bool saved_verbose = m_surf.m_verbose;
-    m_surf.m_verbose = false;
-    
-    if ( m_surf.m_collision_safety && zippering_introduces_collision( new_triangles, deleted_triangles ) )
-    {
-        m_surf.m_verbose = saved_verbose;
-        g_stats.add_to_int( "merge_not_intersection_safe", 1 );
-        return false;
-    }
-    
-    m_surf.m_verbose = saved_verbose;
-    
-    //
-    // Add the new triangles
-    //
-    
-    size_t new_index = m_surf.add_triangle( new_triangles[0] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[1] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[2] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[3] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[4] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[5] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[6] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    new_index = m_surf.add_triangle( new_triangles[7] );
-    m_surf.m_dirty_triangles.push_back( new_index );
-    
-    //
-    // Remove the old triangles
-    //
-    
-    m_surf.remove_triangle( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a][0] );
-    m_surf.remove_triangle( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_a][0] );
-    m_surf.remove_triangle( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b][0] );
-    m_surf.remove_triangle( m_surf.m_mesh.m_edge_to_triangle_map[edge_index_b][0] );
-    
-    return true;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Look for pairs of edges close to each other, attempting to merge when close edges are found.
-///
-// ---------------------------------------------------------
-
-bool MeshMerger::merge_pass( )
-{
-    
-    std::queue<Vec2st> edge_edge_candidates;
-    
-    //
-    // Check edge-edge proximities for zippering candidates
-    //
-    
-    bool merge_occured = false;
-    
-    // sorted by proximity so we merge closest pairs first
-    std::vector<SortableEdgeEdgeProximity> proximities;
-    
-    for(size_t i = 0; i < m_surf.m_mesh.m_edges.size(); i++)
-    {
-        const Vec2st& e0 = m_surf.m_mesh.m_edges[i];
-        
-        if ( e0[0] == e0[1] ) { continue; }
-        if ( m_surf.edge_is_solid(i) ) { continue; }
-        
-        if ( m_surf.m_mesh.m_is_boundary_vertex[ e0[0] ] || m_surf.m_mesh.m_is_boundary_vertex[ e0[1] ] )  { continue; }  // skip boundary vertices
-        
-        Vec3d emin, emax;
-        m_surf.edge_static_bounds(i, emin, emax);
-        emin -= m_surf.m_merge_proximity_epsilon * Vec3d(1,1,1);
-        emax += m_surf.m_merge_proximity_epsilon * Vec3d(1,1,1);
-        
-        std::vector<size_t> edge_candidates;
-        m_surf.m_broad_phase->get_potential_edge_collisions( emin, emax, false, true, edge_candidates );
-        
-        for(size_t j = 0; j < edge_candidates.size(); j++)
-        {
-            size_t proximal_edge_index = edge_candidates[j];
-            const Vec2st& e1 = m_surf.m_mesh.m_edges[proximal_edge_index];
-            
-            if ( proximal_edge_index <= i )
-            {
-                continue;
-            }
-            
-            if ( m_surf.m_mesh.m_is_boundary_vertex[ e1[0] ] || m_surf.m_mesh.m_is_boundary_vertex[ e1[1] ] )  { continue; }  // skip boundary vertices
-            
-            if(e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1])
-            {
-                double distance, s0, s2;
-                Vec3d normal;
-                
-                check_edge_edge_proximity( m_surf.get_position(e0[0]), 
-                                          m_surf.get_position(e0[1]), 
-                                          m_surf.get_position(e1[0]), 
-                                          m_surf.get_position(e1[1]), 
-                                          distance, s0, s2, normal );
-                
-                if (distance < m_surf.m_merge_proximity_epsilon)
-                {
-                    
-                    if ( m_surf.m_verbose ) 
-                    { 
-                        std::cout << "proximity: " << distance << " / " << m_surf.m_merge_proximity_epsilon << std::endl; //proximities[i].distance << std::endl; 
-                    }
-                    
-                    if ( zipper_edges( i, proximal_edge_index ) )
-                    {
-                        
-                        m_surf.trim_non_manifold( m_surf.m_dirty_triangles );
-                        
-                        if ( m_surf.m_verbose ) 
-                        { 
-                            std::cout << "zippered" << std::endl; 
-                        }
-                        
-                        merge_occured = true;
-                        
-                        g_stats.add_to_int( "merge_success", 1 );
-                    }
-                    else
-                    {
-                        g_stats.add_to_int( "merge_failed", 1 );
-                    }
-                    
-                }
-            }
-        }
-    }
-    
-    
-    if ( merge_occured )
-    {
-        m_surf.assert_no_degenerate_triangles();
-    }
-    
-    return merge_occured;
-    
-    
-}
diff --git a/extern/eltopo/eltopo3d/meshmerger.h b/extern/eltopo/eltopo3d/meshmerger.h
deleted file mode 100644
index d0066c2..0000000
--- a/extern/eltopo/eltopo3d/meshmerger.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshmerger.h
-//  Tyson Brochu 2011
-//  
-//  Search for mesh edges which are near to each other, zipper their neighbouring triangles together.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_MESHMERGER_H
-#define EL_TOPO_MESHMERGER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Pair of proximal edges, sortable by distance.  Used to build a list of edge pairs in ascending order of proximity, so we can 
-/// handle them from nearest to farthest.
-///
-// ---------------------------------------------------------
-
-struct SortableEdgeEdgeProximity
-{
-    /// Constructor
-    /// 
-    SortableEdgeEdgeProximity( size_t a, size_t b, double d ) :
-    edge_a( a ),
-    edge_b( b ),
-    distance( d )
-    {}
-    
-    /// Edges indices
-    ///
-    size_t edge_a, edge_b;
-    
-    /// Distance between the two edges
-    /// 
-    double distance;
-    
-    /// Comparison operator for this class, compares edge-edge distance for each pair
-    /// 
-    bool operator<( const SortableEdgeEdgeProximity& other ) const
-    {
-        return distance < other.distance;
-    }
-    
-};
-
-// ---------------------------------------------------------
-///
-/// Mesh merger object.  Sweeps over all pairs of edges, attempting to merge the surface when nearby edges are found.
-///
-// ---------------------------------------------------------
-
-class MeshMerger
-{
-    
-public:
-    
-    /// Constructor
-    /// 
-    MeshMerger( SurfTrack& surf ) :
-    m_surf( surf )
-    {}
-    
-    /// Look for pairs of edges close to each other, attempting to merge when close edges are found.
-    ///
-    bool merge_pass();
-    
-    
-private:
-
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;
-    
-    /// Move vertices around so v[0] and v[4] are closest together
-    ///
-    void twist_vertices( size_t *zipper_vertices );
-    
-    /// Create a set of triangles to add to perform the zippering operation
-    ///
-    bool get_zipper_triangles( size_t edge_index_0, size_t edge_index_1, std::vector<Vec3st>& output_triangles );
-    
-    /// Check whether the introduction of the new zippering triangles causes a collision 
-    ///
-    bool zippering_introduces_collision( const std::vector<Vec3st>& new_triangles, const std::vector<size_t>& deleted_triangles );
-    
-    /// Attempt to merge between two edges
-    ///    
-    bool zipper_edges( size_t edge_index_a, size_t edge_index_b );
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/meshpincher.cpp b/extern/eltopo/eltopo3d/meshpincher.cpp
deleted file mode 100644
index b89c35c..0000000
--- a/extern/eltopo/eltopo3d/meshpincher.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshpincher.cpp
-//  Tyson Brochu 2011
-//  
-//  Identifies "singular vertices", defined as having more than one connected triangle neighbourhoods, and
-//  splits the mesh surface at these vertices.
-//
-// ---------------------------------------------------------
-
-#include <meshpincher.h>
-
-#include <broadphase.h>
-#include <surftrack.h>
-
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Partition the triangles incident to a vertex into connected components
-///
-// --------------------------------------------------------
-
-void MeshPincher::partition_vertex_neighbourhood( size_t vertex_index, std::vector< TriangleSet >& connected_components )
-{
-    // triangles incident to vertex
-	TriangleSet triangles_incident_to_vertex = m_surf.m_mesh.m_vertex_to_triangle_map[vertex_index];
-	
-    // unvisited triangles which are adjacent to some visited ones and incident to vt
-    TriangleSet unvisited_triangles, visited_triangles;
-    
-    while ( triangles_incident_to_vertex.size() > 0 )
-    {
-        unvisited_triangles.clear();
-        visited_triangles.clear();
-        unvisited_triangles.push_back( triangles_incident_to_vertex.back() );
-        
-        while ( unvisited_triangles.size() > 0 )
-        {
-            // get an unvisited triangle
-            size_t curr_tri = unvisited_triangles.back();
-            unvisited_triangles.pop_back();
-            
-            // delete it from triangles_incident_to_vertex
-            triangles_incident_to_vertex.erase( find(triangles_incident_to_vertex.begin(), triangles_incident_to_vertex.end(), curr_tri) );
-            
-            // put it on closed
-            visited_triangles.push_back(curr_tri);
-            
-            // get find a triangle which is incident to vertex and adjacent to curr_tri
-            for ( size_t i = 0; i < triangles_incident_to_vertex.size(); ++i )
-            {
-                size_t incident_triangle_index =  triangles_incident_to_vertex[i];
-                
-                if ( curr_tri == incident_triangle_index )
-                {
-                    continue;
-                }
-                
-                if ( m_surf.m_mesh.triangles_are_adjacent( curr_tri, incident_triangle_index ) )
-                {
-                    // if not in visited_triangles or unvisited_triangles, put them on unvisited_triangles
-                    if ( ( find(unvisited_triangles.begin(), unvisited_triangles.end(), incident_triangle_index) == unvisited_triangles.end() ) &&
-                        ( find(visited_triangles.begin(), visited_triangles.end(), incident_triangle_index) == visited_triangles.end() ) ) 
-                    {
-                        unvisited_triangles.push_back( incident_triangle_index );
-                    }
-                }
-            }
-        }
-        
-        // one connected component = visited triangles
-        connected_components.push_back(visited_triangles);
-    }   
-}
-
-// --------------------------------------------------------
-///
-/// Duplicate a vertex and move the two copies away from each other slightly
-///
-// --------------------------------------------------------
-
-bool MeshPincher::pull_apart_vertex( size_t vertex_index, const std::vector< TriangleSet >& connected_components )
-{
-    double dx = 10.0 * m_surf.m_proximity_epsilon;
-    
-    TriangleSet triangles_to_delete;
-    std::vector< Vec3st > triangles_to_add;
-    std::vector< size_t > vertices_added;
-    
-    // for each connected component except the last one, create a duplicate vertex
-    for ( int i = 0; i < (int)connected_components.size() - 1; ++i )
-    {
-        // duplicate the vertex 
-        size_t duplicate_vertex_index = m_surf.add_vertex( m_surf.get_position(vertex_index), m_surf.m_masses[vertex_index] );
-        
-        vertices_added.push_back( duplicate_vertex_index );
-        
-        Vec3d centroid( 0.0, 0.0, 0.0 );
-        
-        // map component triangles to the duplicate vertex
-        for ( size_t t = 0; t < connected_components[i].size(); ++t ) 
-        {
-            // create a new triangle with 2 vertices the same, and one vertex set to the new duplicate vertex
-            Vec3st new_triangle = m_surf.m_mesh.get_triangle( connected_components[i][t] ); 
-            
-            for ( unsigned short v = 0; v < 3; ++v ) 
-            {
-                if ( new_triangle[v] == vertex_index )
-                {
-                    new_triangle[v] = duplicate_vertex_index;
-                }
-                else
-                {         
-                    centroid += m_surf.get_position( new_triangle[v] );
-                }
-            }
-            
-            triangles_to_add.push_back( new_triangle );
-            triangles_to_delete.push_back( connected_components[i][t] ); 
-        }
-        
-        // compute the centroid    
-        centroid /= ( connected_components[i].size() * 2 );
-        
-        // move the duplicate vertex towards the centroid
-        
-        Vec3d added_vertex_position = (1.0 - dx) * m_surf.get_position(duplicate_vertex_index) + dx * centroid;
-        
-        m_surf.set_position( duplicate_vertex_index, added_vertex_position );
-        m_surf.set_newposition( duplicate_vertex_index, added_vertex_position );
-        
-    }
-    
-    // check new triangles for collision safety
-    
-    bool collision_occurs = false;
-    
-    if ( m_surf.m_collision_safety )
-    {
-        
-        for ( size_t i = 0; i < triangles_to_add.size(); ++i ) 
-        {
-            const Vec3st& current_triangle = triangles_to_add[i];
-            Vec3d low, high;
-            
-            minmax( m_surf.get_position(current_triangle[0]), m_surf.get_position(current_triangle[1]), m_surf.get_position(current_triangle[2]), low, high );
-            
-            std::vector<size_t> overlapping_triangles;
-            m_surf.m_broad_phase->get_potential_triangle_collisions( low, high, true, true, overlapping_triangles );
-            
-            for ( size_t j=0; j < overlapping_triangles.size(); ++j )
-            {        
-                const Vec3st& tri_j = m_surf.m_mesh.get_triangle(overlapping_triangles[j]);
-                
-                assert( tri_j[0] != tri_j[1] );
-                
-                if ( check_triangle_triangle_intersection( current_triangle, tri_j, m_surf.get_positions() ) )
-                {
-                    // collision occurs - abort separation
-                    collision_occurs = true;
-                    break;
-                }
-            }
-        }
-        
-        // check new triangles vs each other as well
-        for ( size_t i = 0; i < triangles_to_add.size(); ++i ) 
-        {
-            for ( size_t j = i+1; j < triangles_to_add.size(); ++j ) 
-            {
-                if ( check_triangle_triangle_intersection( triangles_to_add[i], triangles_to_add[j], m_surf.get_positions() ) )
-                {
-                    // collision occurs - abort separation
-                    collision_occurs = true;
-                    break;
-                }         
-            }
-        }
-    }
-    
-    // abort separation, remove added vertices and return
-    
-    if ( collision_occurs )
-    {
-        for ( size_t i = 0; i < vertices_added.size(); ++i )
-        {
-            m_surf.remove_vertex( vertices_added[i] );
-        }
-        return false;
-    }
-    
-    // all new triangles check out okay for collision safety.  Add them to the data structure.
-    
-    for ( size_t i = 0; i < triangles_to_add.size(); ++i )
-    {
-        m_surf.add_triangle( triangles_to_add[i] );
-    }
-    
-    for ( size_t i = 0; i < triangles_to_delete.size(); ++i )
-    {
-        m_surf.remove_triangle( triangles_to_delete[i] );
-    }
-    
-    
-    if ( m_surf.m_collision_safety )
-    {
-        m_surf.assert_mesh_is_intersection_free(false);
-    }
-    
-    if ( m_surf.m_verbose ) { std::cout << "pulled apart a vertex" << std::endl; }
-    
-    return true;
-}
-
-
-// --------------------------------------------------------
-///
-/// Find vertices with disconnected neighbourhoods, and pull them apart
-///
-// --------------------------------------------------------
-
-void MeshPincher::separate_singular_vertices()
-{
-    
-    for ( size_t i = 0; i < m_surf.get_num_vertices(); ++i )
-    {
-        // Partition the set of triangles adjacent to this vertex into connected components
-        std::vector< TriangleSet > connected_components;
-        partition_vertex_neighbourhood( i, connected_components );
-        
-        if ( connected_components.size() > 1 ) 
-        {
-            bool pinched = pull_apart_vertex( i, connected_components );
-            if ( pinched )
-            {
-                // TODO: Shouldn't need this.
-                m_surf.rebuild_continuous_broad_phase();
-            }
-        }
-    }
-}
-
-
-
-
-
diff --git a/extern/eltopo/eltopo3d/meshpincher.h b/extern/eltopo/eltopo3d/meshpincher.h
deleted file mode 100644
index f94e583..0000000
--- a/extern/eltopo/eltopo3d/meshpincher.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshpincher.h
-//  Tyson Brochu 2011
-//  
-//  Identifies "singular vertices", defined as having more than one connected triangle neighbourhoods, and
-//  splits the mesh surface at these vertices.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_MESHPINCHER_H
-#define EL_TOPO_MESHPINCHER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Mesh pincher object.  Identifies "singular vertices", defined as having more than one connected triangle neighbourhoods, and
-/// splits the mesh surface at these vertices.
-///
-// ---------------------------------------------------------
-
-class MeshPincher
-{
-    
-public:
-    
-    /// Save some typing when dealing with vertex neighbourhoods
-    ///
-    typedef std::vector<size_t> TriangleSet;
-    
-    /// Constructor
-    /// 
-    MeshPincher( SurfTrack& surf ) :
-    m_surf( surf )
-    {}
-    
-    /// Find vertices with disconnected neighbourhoods, and pull them apart
-    ///
-    void separate_singular_vertices();
-    
-private:
-
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;
-    
-    /// Partition the triangles incident to a vertex into connected components
-    ///
-    void partition_vertex_neighbourhood( size_t vertex_index, std::vector< TriangleSet >& connected_components );
-    
-    /// Duplicate a vertex and move the two copies away from each other slightly
-    ///
-    bool pull_apart_vertex( size_t vertex_index, const std::vector< TriangleSet >& connected_components );
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/meshrenderer.cpp b/extern/eltopo/eltopo3d/meshrenderer.cpp
deleted file mode 100644
index 93dfaea..0000000
--- a/extern/eltopo/eltopo3d/meshrenderer.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshrenderer.cpp
-//  Tyson Brochu 2011
-//  
-//  OpenGL rendering for a triangle mesh.
-//
-// ---------------------------------------------------------
-
-#include <meshrenderer.h>
-
-#ifndef NO_GUI
-
-#include <dynamicsurface.h>
-#include <gluvi.h>
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// OpenGL render a mesh surface
-///
-// ---------------------------------------------------------
-
-void MeshRenderer::render( const DynamicSurface& surface )
-{
-    //
-    // edges
-    //
-    
-    glDisable(GL_LIGHTING);
-    glDepthFunc(GL_LEQUAL);
-    
-    if ( render_edges )
-    {
-        glLineWidth(2);
-        glBegin(GL_LINES);
-        
-        for(size_t e = 0; e < surface.m_mesh.m_edges.size(); e++)
-        {
-            if ( surface.m_mesh.m_is_boundary_edge[e] )
-            {
-                glColor3d(1,0,0);
-            }
-            else
-            {
-                glColor3d(0,0,0);
-            }
-            
-            const Vec2st& edge = surface.m_mesh.m_edges[e];
-            const Vec3d& vtx0 = surface.get_position(edge[0]);
-            const Vec3d& vtx1 = surface.get_position(edge[1]);
-            glVertex3d(vtx0[0], vtx0[1], vtx0[2]);
-            glVertex3d(vtx1[0], vtx1[1], vtx1[2]);
-        }
-        
-        glEnd(); 
-    }
-    
-    //
-    // vertices
-    //
-    
-    if ( render_vertex_rank )
-    {
-        glPointSize(5);
-        glBegin(GL_POINTS);
-        
-        for ( size_t v = 0; v < surface.get_num_vertices(); ++v )
-        {
-            if ( surface.m_mesh.m_vertex_to_triangle_map[v].empty() )
-            {
-                continue;
-            }
-            
-            if ( surface.vertex_is_solid(v) )
-            {
-                glColor3f( 1.0f, 0.0f, 0.0f );
-            }
-            else
-            {
-                glColor3f( 0.0f, 1.0f, 0.0f );
-            }
-            
-            glVertex3dv( surface.get_position(v).v );      
-            
-        }
-        glEnd();
-    }   
-    
-    //
-    // triangles
-    //
-    
-    if ( render_fill_triangles )
-    {
-        if ( two_sided )
-        {
-            glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1 );
-        }
-        else
-        {
-            glEnable(GL_CULL_FACE);
-        }
-        
-        glEnable(GL_LIGHTING);
-        glShadeModel(GL_SMOOTH);
-        Gluvi::set_generic_lights();
-        Gluvi::set_generic_material(1.0f, 1.0f, 1.0f, GL_FRONT);   // exterior surface colour
-        Gluvi::set_generic_material(1.0f, 1.0f, 1.0f, GL_BACK);
-        
-        if ( !smooth_shading )
-        {
-            glDisable(GL_LIGHTING);
-            glColor3d(1,1,1);
-        }
-        
-        if ( render_edges )
-        {
-            glEnable(GL_POLYGON_OFFSET_FILL);
-            glPolygonOffset(1.0f, 1.0f);      //  allow the wireframe to show through
-        }
-        
-        glEnable(GL_DEPTH_TEST);
-        glDepthMask(GL_TRUE);
-        
-        glBegin(GL_TRIANGLES);
-        
-        for(size_t i = 0; i < surface.m_mesh.num_triangles(); i++)
-        {
-            const Vec3st& tri = surface.m_mesh.get_triangle(i);
-            
-            const Vec3d& v0 = surface.get_position(tri[0]);
-            const Vec3d& v1 = surface.get_position(tri[1]);
-            const Vec3d& v2 = surface.get_position(tri[2]);
-            
-            glNormal3dv( surface.get_vertex_normal(tri[0]).v );
-            glVertex3d(v0[0], v0[1], v0[2]);
-            
-            glNormal3dv( surface.get_vertex_normal(tri[1]).v );
-            glVertex3d(v1[0], v1[1], v1[2]);
-            
-            glNormal3dv( surface.get_vertex_normal(tri[2]).v );
-            glVertex3d(v2[0], v2[1], v2[2]);
-            
-        }
-        
-        glEnd();
-        
-        
-        if ( render_edges )
-        {
-            glDisable(GL_POLYGON_OFFSET_FILL);
-        }
-        
-        glDisable(GL_LIGHTING);
-        
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// OpenGL render a mesh surface
-///
-// ---------------------------------------------------------
-
-void MeshRenderer::render(const std::vector<Vec3d>& xs,
-                          const std::vector<Vec3d>& normals,
-                          const std::vector<Vec3st>& triangles,
-                          const std::vector<Vec2st>& edges )
-
-{
-    
-    //
-    // edges
-    //
-    
-    glDisable(GL_LIGHTING);
-    glDepthFunc(GL_LEQUAL);
-    
-    if ( render_edges )
-    {
-        glLineWidth(2);
-        glColor3f( 0.0f, 0.0f, 0.0f );
-        glBegin(GL_LINES);
-        for(size_t e = 0; e < edges.size(); e++)
-        {
-            const Vec2st& edge = edges[e];
-            const Vec3d& vtx0 = xs[edge[0]];
-            const Vec3d& vtx1 = xs[edge[1]];
-            glVertex3dv( vtx0.v );
-            glVertex3dv( vtx1.v );
-        }
-        glEnd(); 
-    }
-    
-    //
-    // vertices
-    //
-    
-    if ( render_vertex_rank )
-    {
-        glPointSize(5);
-        glBegin(GL_POINTS);
-        for ( size_t v = 0; v < xs.size(); ++v )
-        {
-            glVertex3dv( xs[v].v );               
-        }
-        glEnd();
-    }   
-    
-    //
-    // triangles
-    //
-    
-    if ( render_fill_triangles )
-    {
-        if ( two_sided )
-        {
-            glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1 );
-        }
-        else
-        {
-            glEnable(GL_CULL_FACE);
-        }
-        
-        glEnable(GL_LIGHTING);
-        glShadeModel(GL_SMOOTH);
-        Gluvi::set_generic_lights();
-        Gluvi::set_generic_material(1.0f, 1.0f, 1.0f, GL_FRONT);   // exterior surface colour
-        Gluvi::set_generic_material(1.0f, 1.0f, 1.0f, GL_BACK);
-        
-        if ( !smooth_shading )
-        {
-            glDisable(GL_LIGHTING);
-            glColor3d(1,1,1);
-        }
-        
-        if ( render_edges )
-        {
-            glEnable(GL_POLYGON_OFFSET_FILL);
-            glPolygonOffset(1.0f, 1.0f);      //  allow the wireframe to show through
-        }
-        
-        glEnable(GL_DEPTH_TEST);
-        glDepthMask(GL_TRUE);
-        
-        glBegin(GL_TRIANGLES);
-        for(size_t i = 0; i < triangles.size(); i++)
-        {
-            const Vec3st& tri = triangles[i];
-            glNormal3dv( normals[tri[0]].v );
-            glVertex3dv( xs[tri[0]].v );
-            glNormal3dv( normals[tri[1]].v );
-            glVertex3dv( xs[tri[1]].v );
-            glNormal3dv( normals[tri[2]].v );
-            glVertex3dv( xs[tri[2]].v );
-        }      
-        glEnd();
-        
-        if ( render_edges )
-        {
-            glDisable(GL_POLYGON_OFFSET_FILL);
-        }
-        
-        glDisable(GL_LIGHTING);
-    }
-    
-}
-
-
-#endif // ndef NO_GUI
-
diff --git a/extern/eltopo/eltopo3d/meshrenderer.h b/extern/eltopo/eltopo3d/meshrenderer.h
deleted file mode 100644
index 66640f1..0000000
--- a/extern/eltopo/eltopo3d/meshrenderer.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshrenderer.h
-//  Tyson Brochu 2011
-//  
-//  OpenGL rendering for a triangle mesh.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_MESHRENDERER_H
-#define EL_TOPO_MESHRENDERER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <vec.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class DynamicSurface;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Mesh rendering object.  Contains current rendering options and functions for doing OpenGL render of a mesh.
-///
-// ---------------------------------------------------------
-
-class MeshRenderer
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    MeshRenderer() :
-    render_edges( true ),
-    render_fill_triangles( true ),
-    render_vertex_rank( false ),
-    smooth_shading( true ),
-    two_sided( true )
-    {}
-    
-    /// Whether to show mesh edges (wireframe)
-    ///
-    bool render_edges;
-    
-    /// Whether to render opaque triangles
-    ///
-    bool render_fill_triangles;
-    
-    /// Whether to render the primary-space rank for each vertex
-    ///
-    bool render_vertex_rank;
-    
-    /// Whether to use smooth or flat shading
-    ///    
-    bool smooth_shading;
-
-    /// Render both sides of the triangles
-    ///    
-    bool two_sided;
-    
-    /// Display the surface in OpenGL using the current options settings
-    ///
-    void render( const DynamicSurface& surface );
-
-    /// Display the specified geometry in OpenGL using the current options settings
-    ///
-    void render(const std::vector<Vec3d>& xs,
-                const std::vector<Vec3d>& normals,
-                const std::vector<Vec3st>& triangles,
-                const std::vector<Vec2st>& edges );
-    
-    
-};
-
-
-#endif
diff --git a/extern/eltopo/eltopo3d/meshsmoother.cpp b/extern/eltopo/eltopo3d/meshsmoother.cpp
deleted file mode 100644
index 01cb913..0000000
--- a/extern/eltopo/eltopo3d/meshsmoother.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshsmoother.cpp
-//  Tyson Brochu 2011
-//  
-//  Functions related to the tangent-space mesh smoothing operation.
-//
-// ---------------------------------------------------------
-
-#include <meshsmoother.h>
-
-#include <impactzonesolver.h>
-#include <lapack_wrapper.h>
-#include <mat.h>
-#include <nondestructivetrimesh.h>
-#include <surftrack.h>
-
-// ========================================================
-//  NULL-space smoothing functions
-// ========================================================
-
-// ---------------------------------------------------------
-///
-/// Compute the maximum timestep that will not invert any triangle normals, using a quadratic solve as in [Jiao 2007].
-///
-// ---------------------------------------------------------
-
-double MeshSmoother::compute_max_timestep_quadratic_solve( const std::vector<Vec3st>& tris, 
-                                                          const std::vector<Vec3d>& positions, 
-                                                          const std::vector<Vec3d>& displacements, 
-                                                          bool verbose ) 
-{
-    double max_beta = 1.0;
-    
-    double min_area = BIG_DOUBLE;
-    
-    for ( size_t i = 0; i < tris.size(); ++i )
-    {
-        if ( tris[i][0] == tris[i][1] ) { continue; }
-        
-        const Vec3d& x1 = positions[tris[i][0]];
-        const Vec3d& x2 = positions[tris[i][1]];
-        const Vec3d& x3 = positions[tris[i][2]];
-        
-        const Vec3d& u1 = displacements[tris[i][0]];
-        const Vec3d& u2 = displacements[tris[i][1]];
-        const Vec3d& u3 = displacements[tris[i][2]];
-        
-        Vec3d new_x1 = x1 + u1;
-        Vec3d new_x2 = x2 + u2;
-        Vec3d new_x3 = x3 + u3;
-        
-        const Vec3d c0 = cross( (x2-x1), (x3-x1) );
-        const Vec3d c1 = cross( (x2-x1), (u3-u1) ) - cross( (x3-x1), (u2-u1) );
-        const Vec3d c2 = cross( (u2-u1), (u3-u1) );
-        const double a = dot(c0, c2);
-        const double b = dot(c0, c1);
-        const double c = dot(c0, c0);
-        
-        double beta = 1.0;
-        
-        min_area = min( min_area, c );
-        
-        if ( c < 1e-14 )
-        {
-            if ( verbose ) { std::cout << "super small triangle " << i << " (" << tris[i] << ")" << std::endl; }
-        }
-        
-        if ( fabs(a) == 0 )
-        {
-            
-            if ( ( fabs(b) > 1e-14 ) && ( -c / b >= 0.0 ) )
-            {
-                beta = -c / b;
-            }
-            else
-            {
-                if ( verbose )
-                {
-                    if ( fabs(b) < 1e-14 )
-                    {
-                        std::cout << "triangle " << i << ": "; 
-                        std::cout <<  "b == " << b << std::endl; 
-                    }
-                }
-            }
-        }
-        else
-        {
-            double descriminant = b*b - 4.0*a*c;
-            
-            if ( descriminant < 0.0  )
-            {
-                // Hmm, what does this mean?
-                if ( verbose )
-                {
-                    std::cout << "triangle " << i << ": descriminant == " << descriminant << std::endl;
-                }
-                
-                beta = 1.0;
-            }
-            else
-            {
-                double q;
-                if ( b > 0.0 )
-                {
-                    q = -0.5 * ( b + sqrt( descriminant ) );
-                }
-                else
-                {
-                    q = -0.5 * ( b - sqrt( descriminant ) );
-                }
-                
-                double beta_1 = q / a;
-                double beta_2 = c / q;
-                
-                if ( beta_1 < 0.0 )
-                {
-                    if ( beta_2 < 0.0 )
-                    {
-                        assert( dot( triangle_normal(x1, x2, x3), triangle_normal(new_x1, new_x2, new_x3) ) > 0.0 );
-                    }
-                    else
-                    {
-                        beta = beta_2;
-                    }
-                }
-                else
-                {
-                    if ( beta_2 < 0.0 )
-                    {
-                        beta = beta_1;
-                    }
-                    else if ( beta_1 < beta_2 )
-                    {
-                        beta = beta_1;
-                    }
-                    else
-                    {
-                        beta = beta_2;
-                    }
-                }
-                
-            }
-        }
-        
-        bool changed = false;
-        if ( beta < max_beta )
-        {
-            max_beta = 0.99 * beta;
-            changed = true;
-            
-            if ( verbose )
-            {
-                std::cout << "changing beta --- triangle: " << i << std::endl;
-                std::cout << "new max beta: " << max_beta << std::endl;
-                std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl;
-            }
-            
-            if ( max_beta < 1e-4 )
-            {
-                //assert(0);
-            }
-            
-        }
-        
-        new_x1 = x1 + max_beta * u1;
-        new_x2 = x2 + max_beta * u2;
-        new_x3 = x3 + max_beta * u3;
-        
-        Vec3d old_normal = cross(x2-x1, x3-x1);
-        Vec3d new_normal = cross(new_x2-new_x1, new_x3-new_x1);
-        
-        if ( dot( old_normal, new_normal ) < 0.0 )
-        {
-            std::cout << "triangle " << i << ": " << tris[i] << std::endl;
-            std::cout << "old normal: " << old_normal << std::endl;
-            std::cout << "new normal: " << new_normal << std::endl;
-            std::cout << "dot product: " << dot( triangle_normal(x1, x2, x3), triangle_normal(new_x1, new_x2, new_x3) ) << std::endl;
-            std::cout << (changed ? "changed" : "not changed") << std::endl;
-            std::cout << "beta: " << beta << std::endl;
-            std::cout << "max beta: " << max_beta << std::endl;
-        }
-    }
-    
-    return max_beta;
-}
-
-
-// --------------------------------------------------------
-///
-/// Find a new vertex location using NULL-space smoothing
-///
-// --------------------------------------------------------
-
-void MeshSmoother::null_space_smooth_vertex( size_t v, 
-                                            const std::vector<double>& triangle_areas, 
-                                            const std::vector<Vec3d>& triangle_normals, 
-                                            const std::vector<Vec3d>& triangle_centroids, 
-                                            Vec3d& displacement ) const
-{
-    
-    const NonDestructiveTriMesh& mesh = m_surf.m_mesh;
-    
-    if ( mesh.m_vertex_to_triangle_map[v].empty() )     
-    { 
-        displacement = Vec3d(0,0,0);
-        return; 
-    }
-    
-    const std::vector<size_t>& edges = mesh.m_vertex_to_edge_map[v];
-    for ( size_t j = 0; j < edges.size(); ++j )
-    {
-        if ( mesh.m_edge_to_triangle_map[ edges[j] ].size() == 1 )
-        {
-            displacement = Vec3d(0,0,0);
-            return;
-        }
-    }
-    
-    const std::vector<size_t>& incident_triangles = mesh.m_vertex_to_triangle_map[v];
-    
-    std::vector< Vec3d > N;
-    std::vector< double > W;
-    
-    for ( size_t i = 0; i < incident_triangles.size(); ++i )
-    {
-        size_t triangle_index = incident_triangles[i];
-        N.push_back( triangle_normals[triangle_index] );
-        W.push_back( triangle_areas[triangle_index] );
-    }
-    
-    Mat33d A(0,0,0,0,0,0,0,0,0);
-    
-    // Ax = b from N^TWni = N^TWd
-    for ( size_t i = 0; i < N.size(); ++i )
-    {
-        A(0,0) += N[i][0] * W[i] * N[i][0];
-        A(1,0) += N[i][1] * W[i] * N[i][0];
-        A(2,0) += N[i][2] * W[i] * N[i][0];
-        
-        A(0,1) += N[i][0] * W[i] * N[i][1];
-        A(1,1) += N[i][1] * W[i] * N[i][1];
-        A(2,1) += N[i][2] * W[i] * N[i][1];
-        
-        A(0,2) += N[i][0] * W[i] * N[i][2];
-        A(1,2) += N[i][1] * W[i] * N[i][2];
-        A(2,2) += N[i][2] * W[i] * N[i][2];
-    }
-    
-    // get eigen decomposition
-    double eigenvalues[3];
-    double work[9];
-    int info = ~0, n = 3, lwork = 9;
-    LAPACK::get_eigen_decomposition( &n, A.a, &n, eigenvalues, work, &lwork, &info );      
-    
-    if ( info != 0 )
-    {
-        std::cout << "Eigen decomposition failed" << std::endl;
-        std::cout << "number of incident_triangles: " << incident_triangles.size() << std::endl;
-        for ( size_t i = 0; i < incident_triangles.size(); ++i )
-        {
-            size_t triangle_index = incident_triangles[i];
-            std::cout << "triangle: " << m_surf.m_mesh.get_triangle(triangle_index) << std::endl;
-            std::cout << "normal: " << triangle_normals[triangle_index] << std::endl;
-            std::cout << "area: " << triangle_areas[triangle_index] << std::endl;
-        }
-        
-        assert(0);
-    }
-    
-    // compute basis for null space
-    std::vector<Vec3d> T;
-    for ( unsigned int i = 0; i < 3; ++i )
-    {
-        if ( eigenvalues[i] < G_EIGENVALUE_RANK_RATIO * eigenvalues[2] )
-        {
-            T.push_back( Vec3d( A(0,i), A(1,i), A(2,i) ) );
-        }
-    }
-    
-    //   Mat33d null_space_projection( 1,0,0, 0,1,0, 0,0,1 );
-    
-    Mat33d null_space_projection(0,0,0,0,0,0,0,0,0);
-    for ( unsigned int row = 0; row < 3; ++row )
-    {
-        for ( unsigned int col = 0; col < 3; ++col )
-        {
-            for ( size_t i = 0; i < T.size(); ++i )
-            {
-                null_space_projection(row, col) += T[i][row] * T[i][col];
-            }
-        }  
-    }
-    
-    Vec3d t(0,0,0);      // displacement
-    double sum_areas = 0;
-    
-    for ( size_t i = 0; i < incident_triangles.size(); ++i )
-    {
-        double area = triangle_areas[incident_triangles[i]];
-        sum_areas += area;
-        Vec3d c = triangle_centroids[incident_triangles[i]] - m_surf.get_position(v);
-        t += area * c;
-    }
-    
-    t = null_space_projection * t;
-    t /= sum_areas;
-    
-    displacement = t;
-}
-
-
-
-// --------------------------------------------------------
-///
-/// NULL-space smoothing
-///
-// --------------------------------------------------------
-
-bool MeshSmoother::null_space_smoothing_pass( double dt )
-{
-    if ( m_surf.m_verbose )
-    {
-        std::cout << "---------------------- El Topo: vertex redistribution ----------------------" << std::endl;
-    }
-    
-    std::vector<double> triangle_areas;
-    triangle_areas.reserve( m_surf.m_mesh.num_triangles());
-    std::vector<Vec3d> triangle_normals;
-    triangle_normals.reserve( m_surf.m_mesh.num_triangles());
-    std::vector<Vec3d> triangle_centroids;
-    triangle_centroids.reserve( m_surf.m_mesh.num_triangles());
-    
-    for ( size_t i = 0; i < m_surf.m_mesh.num_triangles(); ++i )
-    {
-        const Vec3st& tri = m_surf.m_mesh.get_triangle(i);
-        if ( tri[0] == tri[1] )
-        {
-            triangle_areas.push_back( 0 );
-            triangle_normals.push_back( Vec3d(0,0,0) );
-            triangle_centroids.push_back( Vec3d(0,0,0) );
-        }
-        else
-        {
-            triangle_areas.push_back( m_surf.get_triangle_area( i ) );
-            triangle_normals.push_back( m_surf.get_triangle_normal( i ) );
-            triangle_centroids.push_back( (m_surf.get_position(tri[0]) + m_surf.get_position(tri[1]) + m_surf.get_position(tri[2])) / 3 );
-        }
-    }
-    
-    std::vector<Vec3d> displacements;
-    displacements.resize( m_surf.get_num_vertices(), Vec3d(0) );
-    
-    double max_displacement = 1e-30;
-    for ( size_t i = 0; i < m_surf.get_num_vertices(); ++i )
-    {
-        if ( !m_surf.vertex_is_solid(i) )
-        {
-            null_space_smooth_vertex( i, triangle_areas, triangle_normals, triangle_centroids, displacements[i] );
-            max_displacement = max( max_displacement, mag( displacements[i] ) );
-        }
-    }
-    
-    // compute maximum dt
-    double max_beta = 1.0; //compute_max_timestep_quadratic_solve( m_surf.m_mesh.get_triangles(), m_surf.m_positions, displacements, m_surf.m_verbose );
-    
-    if ( m_surf.m_verbose ) { std::cout << "max beta: " << max_beta << std::endl; }
-    
-    m_surf.m_velocities.resize( m_surf.get_num_vertices() );
-    
-    for ( size_t i = 0; i < m_surf.get_num_vertices(); ++i )
-    {
-        m_surf.set_newposition( i, m_surf.get_position(i) + (max_beta) * displacements[i] );
-        m_surf.m_velocities[i] = (m_surf.get_newposition(i) - m_surf.get_position(i)) / dt;
-    }
-    
-    // repositioned locations stored in m_newpositions, but needs to be collision safe
-    if ( m_surf.m_collision_safety )
-    {
-        
-        bool all_collisions_handled = m_surf.m_collision_pipeline->handle_collisions(dt);
-        
-        if ( !all_collisions_handled )
-        {
-            ImpactZoneSolver solver( m_surf );
-            bool result = solver.inelastic_impact_zones(dt);
-            
-            if ( !result )
-            {
-                result = solver.rigid_impact_zones(dt);
-            }
-            
-            if ( !result ) 
-            {
-                // couldn't fix collisions!
-                std::cerr << "WARNING: Aborting mesh null-space smoothing due to CCD problem" << std::endl;
-                return true;
-            }
-        }
-        
-        
-        // TODO: Replace this with a cut-back and re-integrate
-        // Actually, a call to DynamicSurface::integrate(dt) would be even better
-        
-        std::vector<Intersection> intersections;
-        m_surf.get_intersections( false, true, intersections );
-        
-        if ( intersections.size() != 0 )
-        {
-            // couldn't fix collisions!
-            std::cerr << "WARNING: Aborting mesh null-space smoothing due to CCD problem" << std::endl;
-            return true;         
-        }
-        
-    }
-    
-    // used to test convergence
-    double max_position_change = 0.0;
-    
-    // Set positions
-    for(size_t i = 0; i < m_surf.get_num_vertices(); i++)
-    {
-        max_position_change = max( max_position_change, mag( m_surf.get_newposition(i) - m_surf.get_position(i) ) );
-    } 
-    
-    m_surf.set_positions_to_newpositions();
-    
-    
-    if ( m_surf.m_verbose ) { std::cout << "max_position_change: " << max_position_change << std::endl; }
-    
-    // We will test convergence by checking whether the largest change in
-    // position has magnitude less than: CONVERGENCE_TOL_SCALAR * average_edge_length  
-    const static double CONVERGENCE_TOL_SCALAR = 1.0;   
-    bool converged = false;
-    if ( max_position_change < CONVERGENCE_TOL_SCALAR * m_surf.get_average_edge_length() )
-    {
-        converged = true;
-    }
-    
-    return !converged;
-}
-
-
-
diff --git a/extern/eltopo/eltopo3d/meshsmoother.h b/extern/eltopo/eltopo3d/meshsmoother.h
deleted file mode 100644
index 0b2dee0..0000000
--- a/extern/eltopo/eltopo3d/meshsmoother.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// ---------------------------------------------------------
-//
-//  meshsmoother.h
-//  Tyson Brochu 2011
-//  
-//  Functions related to the tangent-space mesh smoothing operation.
-//
-// ---------------------------------------------------------
-
-
-#ifndef EL_TOPO_MESHSMOOTHER_H
-#define EL_TOPO_MESHSMOOTHER_H
-
-// ---------------------------------------------------------
-//  Nested includes
-// ---------------------------------------------------------
-
-#include <cstddef>
-#include <vector>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-template<unsigned int N, class T> struct Vec;
-typedef Vec<3,double> Vec3d;
-typedef Vec<2,size_t> Vec2st;
-typedef Vec<3,size_t> Vec3st;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Mesh smoother object.  Performs NULL-space constrained Laplacian smoothing of mesh vertices.
-///
-// ---------------------------------------------------------
-
-class MeshSmoother
-{
-    
-public:
-    
-    /// Constructor
-    ///
-    MeshSmoother( SurfTrack& surf ) :
-    m_surf( surf )
-    {}
-    
-    /// NULL-space smoothing of all vertices
-    ///
-    bool null_space_smoothing_pass( double dt );
-    
-    /// Compute the maximum timestep that will not invert any triangle normals, using a quadratic solve as in [Jiao 2007].
-    ///
-    static double compute_max_timestep_quadratic_solve( const std::vector<Vec3st>& tris, 
-                                                       const std::vector<Vec3d>& positions, 
-                                                       const std::vector<Vec3d>& displacements, 
-                                                       bool verbose );   
-    
-    /// Find a new vertex location using NULL-space smoothing
-    ///
-    void null_space_smooth_vertex( size_t v, 
-                                  const std::vector<double>& triangle_areas, 
-                                  const std::vector<Vec3d>& triangle_normals, 
-                                  const std::vector<Vec3d>& triangle_centroids, 
-                                  Vec3d& displacement ) const;      
-    
-private:
-    
-    /// The mesh this object operates on
-    /// 
-    SurfTrack& m_surf;
-    
-};
-
-#endif
-
diff --git a/extern/eltopo/eltopo3d/nondestructivetrimesh.cpp b/extern/eltopo/eltopo3d/nondestructivetrimesh.cpp
deleted file mode 100644
index 294927a..0000000
--- a/extern/eltopo/eltopo3d/nondestructivetrimesh.cpp
+++ /dev/null
@@ -1,706 +0,0 @@
-// ---------------------------------------------------------
-//
-//  nondestructivetrimesh.cpp
-//  Tyson Brochu 2008
-//  
-//  Implementation of NonDestructiveTriMesh: the graph of a 
-//  triangle surface mesh.  See header for more details.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <nondestructivetrimesh.h>
-
-#include <cmath>
-#include <cstdarg>
-#include <cstdlib>
-#include <fstream>
-#include <wallclocktime.h>
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-namespace {
-    
-/// Avoid modulo operator in (i+1)%3
-const unsigned int i_plus_one_mod_three[3] = {1,2,0};
-    
-}   // namespace
-
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Clear all mesh information
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::clear()
-{
-    m_tris.clear();
-    clear_connectivity();
-}
-
-
-// --------------------------------------------------------
-///
-/// Mark a triangle as deleted without actually changing the data structures
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::nondestructive_remove_triangle(size_t tri)
-{
-    // Update the vertex->triangle map, m_vertex_to_triangle_map
-    
-    Vec3st& t = m_tris[tri];
-    for(unsigned int i = 0; i < 3; i++)
-    {
-        // Get the set of triangles incident on vertex t[i]
-        std::vector<size_t>& vt = m_vertex_to_triangle_map[t[i]];
-        
-        for( int j = 0; j < (int)vt.size(); j++ )
-        {
-            // If a triangle incident on vertex t[i] is tri, delete it
-            if(vt[j] == tri)
-            {  
-                vt.erase( vt.begin() + j );
-                --j;
-            }
-        }
-    }
-    
-    // Update the triangle->edge map, m_triangle_to_edge_map
-    
-    Vec3st& te = m_triangle_to_edge_map[tri];
-    
-    for(unsigned int i = 0; i < 3; i++)
-    {
-        size_t inc_edge = te[i];
-        
-        std::vector<size_t>& et = m_edge_to_triangle_map[inc_edge];
-        
-        for( int j = 0; j < (int) et.size(); j++)
-        {
-            if(et[j] == tri)
-            {
-                et.erase( et.begin() + j );
-                --j;
-            }
-        }
-        
-        if ( et.size() == 1 )
-        {
-            m_is_boundary_edge[inc_edge] = true;
-        }
-        else
-        {
-            m_is_boundary_edge[inc_edge] = false;
-        }
-        
-        if ( et.empty() )
-        {
-            // No triangles are incident on this edge.  Delete it.
-            nondestructive_remove_edge( inc_edge );
-        }         
-    }
-    
-    // triangle is deleted, clear its auxiliary structures
-    te[0] = te[1] = te[2] = 0;
-    
-    update_is_boundary_vertex( t[0] );
-    update_is_boundary_vertex( t[1] );   
-    update_is_boundary_vertex( t[2] );
-    
-    // Clear t, marking it as deleted
-    t[0] = t[1] = t[2] = 0;
-    
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Add a triangle to the tris structure, update connectivity
-///
-// --------------------------------------------------------
-
-size_t NonDestructiveTriMesh::nondestructive_add_triangle( const Vec3st& tri )
-{
-    assert( tri[0] < m_vertex_to_edge_map.size() );
-    assert( tri[1] < m_vertex_to_edge_map.size() );
-    assert( tri[2] < m_vertex_to_edge_map.size() );
-    
-    size_t idx = m_tris.size();
-    m_tris.push_back(tri);
-    m_triangle_to_edge_map.resize(idx+1);
-    
-    for(unsigned int i = 0; i < 3; i++)
-    {
-        size_t vtx0 = tri[ i ];
-        size_t vtx1 = tri[ i_plus_one_mod_three[i] ];
-        
-        // Find the edge composed of these two vertices
-        size_t e = get_edge_index(vtx0, vtx1);
-        if(e == m_edges.size())
-        {
-            // if the edge doesn't exist, add it
-            e = nondestructive_add_edge(vtx0, vtx1);
-        }
-        
-        // Update connectivity
-        m_edge_to_triangle_map[e].push_back(idx);       // edge->triangle
-        
-        if ( m_edge_to_triangle_map[e].size() == 1 )
-        {
-            m_is_boundary_edge[e] = true; 
-        }
-        else
-        {
-            m_is_boundary_edge[e] = false;
-        }
-        
-        m_triangle_to_edge_map[idx][i] = e;                // triangle->edge
-        m_vertex_to_triangle_map[tri[i]].push_back(idx);   // vertex->triangle      
-    }
-    
-    update_is_boundary_vertex( tri[0] );
-    update_is_boundary_vertex( tri[1] );
-    update_is_boundary_vertex( tri[2] );
-    
-    return idx;
-    
-}
-
-// --------------------------------------------------------
-///
-/// Add a vertex, update connectivity.  Return index of new vertex.
-///
-// --------------------------------------------------------
-
-size_t NonDestructiveTriMesh::nondestructive_add_vertex( )
-{  
-    assert( m_vertex_to_edge_map.size() == m_vertex_to_triangle_map.size() );
-    assert( m_vertex_to_edge_map.size() == m_is_boundary_vertex.size() );
-    
-    m_vertex_to_edge_map.resize( m_vertex_to_edge_map.size() + 1 );
-    m_vertex_to_triangle_map.resize( m_vertex_to_triangle_map.size() + 1 );
-    m_is_boundary_vertex.resize( m_is_boundary_vertex.size() + 1 );
-    
-    return m_vertex_to_triangle_map.size() - 1;
-}
-
-
-// --------------------------------------------------------
-///
-/// Remove a vertex, update connectivity
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::nondestructive_remove_vertex(size_t vtx)
-{
-    
-    m_vertex_to_triangle_map[vtx].clear();    //triangles incident on vertices
-    
-    // check any m_edges incident on this vertex are marked as deleted
-    for ( size_t i = 0; i < m_vertex_to_edge_map[vtx].size(); ++i )
-    {
-        assert( m_edges[ m_vertex_to_edge_map[vtx][i] ][0] == m_edges[ m_vertex_to_edge_map[vtx][i] ][1] );
-    }
-    
-    m_vertex_to_edge_map[vtx].clear();   //edges incident on vertices
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update the number of vertices in the mesh.
-///
-// ---------------------------------------------------------
-
-void NonDestructiveTriMesh::set_num_vertices( size_t num_vertices )
-{
-    if ( num_vertices >= m_vertex_to_triangle_map.size() )
-    {
-        // expand the vertex data structures with empties
-    }
-    else
-    {
-        // reduce the number of vertices
-        
-        assert( m_vertex_to_triangle_map.size() == m_vertex_to_edge_map.size() );
-        assert( m_vertex_to_triangle_map.size() == m_is_boundary_vertex.size() );
-        
-        for ( size_t i = num_vertices; i < m_vertex_to_triangle_map.size(); ++i )
-        {
-            assert( vertex_is_deleted(i) );
-            assert( m_vertex_to_edge_map[i].size() == 0 );
-            assert( m_vertex_to_triangle_map[i].size() == 0 );
-        }
-    }
-    
-    m_vertex_to_edge_map.resize( num_vertices );
-    m_vertex_to_triangle_map.resize( num_vertices );
-    m_is_boundary_vertex.resize( num_vertices );
-    test_connectivity();
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Add an edge to the list.  Return the index of the new edge.
-///
-// --------------------------------------------------------
-
-size_t NonDestructiveTriMesh::nondestructive_add_edge(size_t vtx0, size_t vtx1)
-{
-    
-    size_t edge_index = m_edges.size();
-    m_edges.push_back(Vec2st(vtx0, vtx1));
-    
-    m_edge_to_triangle_map.push_back( std::vector<size_t>( 0 ) );
-    
-    m_is_boundary_edge.push_back( true );
-    
-    m_vertex_to_edge_map[vtx0].push_back(edge_index);
-    m_vertex_to_edge_map[vtx1].push_back(edge_index);
-    
-    return edge_index;
-}
-
-
-// --------------------------------------------------------
-///
-/// Mark an edge as deleted, update connectivity
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::nondestructive_remove_edge( size_t edge_index )
-{
-    // vertex 0
-    {
-        std::vector<size_t>& vertex_to_edge_map = m_vertex_to_edge_map[ m_edges[edge_index][0] ];
-        for ( int i=0; i < (int)vertex_to_edge_map.size(); ++i)
-        {
-            if ( vertex_to_edge_map[i] == edge_index )
-            {
-                vertex_to_edge_map.erase( vertex_to_edge_map.begin() + i );
-                --i;
-            }
-        }
-    }
-    
-    // vertex 1
-    {
-        std::vector<size_t>& vertex_to_edge_map = m_vertex_to_edge_map[ m_edges[edge_index][1] ];
-        for ( int i=0; i < (int)vertex_to_edge_map.size(); ++i)
-        {
-            if ( vertex_to_edge_map[i] == edge_index )
-            {
-                vertex_to_edge_map.erase( vertex_to_edge_map.begin() + i );
-                --i;
-            }
-        }
-    }
-    
-    m_edges[edge_index][0] = 0;
-    m_edges[edge_index][1] = 0; 
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Determine if the given vertex is on a boundary edge and store in data structure.
-///
-// ---------------------------------------------------------
-
-void NonDestructiveTriMesh::update_is_boundary_vertex( size_t v )
-{
-    m_is_boundary_vertex[v] = false;
-    
-    for ( size_t i = 0; i < m_vertex_to_edge_map[v].size(); ++i )
-    {
-        size_t edge_index = m_vertex_to_edge_map[v][i];
-        
-        if ( m_is_boundary_edge[edge_index] )
-        {
-            m_is_boundary_vertex[v] = true;
-            return;
-        }
-    }
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Ensure that all adjacent triangles have consistent orientation.
-///
-// ---------------------------------------------------------
-
-void NonDestructiveTriMesh::verify_orientation( )
-{
-    for ( size_t i = 0; i < m_edges.size(); ++i )
-    {
-        if ( m_edge_to_triangle_map[i].size() != 2 )
-        {
-            continue;
-        }
-        
-        if ( edge_is_deleted(i) ) { continue; }
-        
-        size_t a = m_edges[i][0];
-        size_t b = m_edges[i][1];
-        const Vec3st& tri0 = m_tris[ m_edge_to_triangle_map[i][0] ];
-        const Vec3st& tri1 = m_tris[ m_edge_to_triangle_map[i][1] ]; 
-        
-        bool orient0 = oriented(a, b, tri0 );
-        bool orient1 = oriented(a, b, tri1 );
-        
-        assert( orient0 != orient1 );
-    }
-}
-
-
-// --------------------------------------------------------
-///
-/// Find edge specified by two vertices.  Return edges.size if the edge is not found.
-///
-// --------------------------------------------------------
-
-size_t NonDestructiveTriMesh::get_edge_index(size_t vtx0, size_t vtx1) const
-{
-    assert( vtx0 < m_vertex_to_edge_map.size() );
-    assert( vtx1 < m_vertex_to_edge_map.size() );
-    
-    const std::vector<size_t>& edges0 = m_vertex_to_edge_map[vtx0];
-    const std::vector<size_t>& edges1 = m_vertex_to_edge_map[vtx1];
-    
-    for(size_t e0 = 0; e0 < edges0.size(); e0++)
-    {
-        size_t edge0 = edges0[e0];
-        
-        for(size_t e1 = 0; e1 < edges1.size(); e1++)
-        {
-            if( edge0 == edges1[e1] && m_edges[edge0][0] != m_edges[edge0][1] )
-            {
-                assert( ( m_edges[edge0][0] == vtx0 && m_edges[edge0][1] == vtx1 ) ||
-                       ( m_edges[edge0][1] == vtx0 && m_edges[edge0][0] == vtx1 ) );
-                
-                return edge0;
-            }
-        }
-    }
-    
-    return m_edges.size();
-}
-
-
-// --------------------------------------------------------
-///
-/// Find triangle specified by three vertices.  Return triangles.size if the triangle is not found.
-///
-// --------------------------------------------------------
-
-size_t NonDestructiveTriMesh::get_triangle_index( size_t vtx0, size_t vtx1, size_t vtx2 ) const
-{
-    Vec3st verts( vtx0, vtx1, vtx2 );
-    
-    const std::vector<size_t>& triangles0 = m_vertex_to_triangle_map[vtx0];
-    for ( size_t i = 0; i < triangles0.size(); ++i )
-    {
-        if ( triangle_has_these_verts( m_tris[triangles0[i]], verts ) )
-        {
-            return triangles0[i];
-        }
-    }
-    
-    return m_tris.size();
-    
-}
-
-
-
-// --------------------------------------------------------
-///
-/// Remove triangles which have been deleted by nondestructive_remove_triangle
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::clear_deleted_triangles( std::vector<Vec2st>* defragged_triangle_map )
-{  
-    
-    std::vector<Vec3st> new_tris;
-    new_tris.reserve( m_tris.size() );
-    
-    if ( defragged_triangle_map != NULL )
-    {
-        for ( size_t i = 0; i < m_tris.size(); ++i )
-        {
-            if ( !triangle_is_deleted(i) ) 
-            {
-                new_tris.push_back( m_tris[i] );
-                Vec2st map_entry(i, new_tris.size()-1);
-                defragged_triangle_map->push_back( map_entry );
-            }
-        }
-    }
-    else
-    {
-        for ( size_t i = 0; i < m_tris.size(); ++i )
-        {
-            if ( !triangle_is_deleted(i) ) 
-            {
-                new_tris.push_back( m_tris[i] );
-            }
-        }      
-    }
-    
-    replace_all_triangles( new_tris );
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Remove auxiliary connectivity information
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::clear_connectivity()
-{
-    m_edges.clear();
-    m_vertex_to_edge_map.clear();
-    m_vertex_to_triangle_map.clear();
-    m_edge_to_triangle_map.clear();
-    m_triangle_to_edge_map.clear();
-    m_is_boundary_edge.clear();
-    m_is_boundary_vertex.clear();
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Clear and rebuild connectivity information
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::update_connectivity( )
-{
-    
-    clear_connectivity();
-    
-    size_t nv = 0;
-    for ( size_t i = 0; i < m_tris.size(); ++i )
-    {
-        nv = max( nv, m_tris[i][0] );
-        nv = max( nv, m_tris[i][1] );
-        nv = max( nv, m_tris[i][2] );      
-    }
-    ++nv;
-    
-    m_vertex_to_triangle_map.resize(nv);
-    m_vertex_to_edge_map.resize(nv);
-    m_triangle_to_edge_map.resize(m_tris.size());
-    
-    for(size_t i = 0; i < m_tris.size(); i++)
-    {
-        Vec3st& t = m_tris[i];
-        
-        if(t[0] != t[1])
-        {
-            
-            assert( t[0] < nv );
-            assert( t[1] < nv );
-            assert( t[2] < nv );
-            
-            for(unsigned int j = 0; j < 3; j++)
-                m_vertex_to_triangle_map[t[j]].push_back(i);
-            
-            Vec3st& te = m_triangle_to_edge_map[i];
-            
-            for(int j = 0; j < 3; j++)
-            {
-                size_t vtx0 = t[j];
-                size_t vtx1 = t[ i_plus_one_mod_three[j] ];
-                
-                size_t e = get_edge_index(vtx0, vtx1);
-                
-                if(e == m_edges.size())
-                {
-                    e = nondestructive_add_edge(vtx0, vtx1);
-                }
-                
-                te[j] = e;
-                m_edge_to_triangle_map[e].push_back(i);
-            }
-        }
-    }
-    
-    // find boundary edges and vertices
-    m_is_boundary_edge.resize( m_edges.size() );
-    m_is_boundary_vertex.resize( nv, false );
-    
-    for ( size_t e = 0; e < m_edge_to_triangle_map.size(); ++e )
-    {
-        if ( m_edge_to_triangle_map[e].size() % 2 == 0 )
-        {
-            m_is_boundary_edge[e] = false;
-        }
-        else
-        {
-            m_is_boundary_edge[e] = true;
-            m_is_boundary_vertex[ m_edges[e][0] ] = true;
-            m_is_boundary_vertex[ m_edges[e][1] ] = true;
-        }
-    }
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Check the consistency of auxiliary data structures
-///
-// --------------------------------------------------------
-
-void NonDestructiveTriMesh::test_connectivity() const
-{
-    
-    // check sizes
-    
-    assert( m_is_boundary_edge.size() == m_edges.size() );
-    assert( m_edge_to_triangle_map.size() == m_edges.size() );
-    
-    assert( m_is_boundary_vertex.size() == m_vertex_to_edge_map.size() );
-    assert( m_is_boundary_vertex.size() == m_vertex_to_triangle_map.size() );   
-    
-    assert( m_triangle_to_edge_map.size() == m_tris.size() );
-    
-    // m_is_boundary_edge
-    
-    for ( size_t i = 0; i < m_is_boundary_edge.size(); ++i )
-    {
-        if ( edge_is_deleted(i) ) { continue; }
-        if ( m_is_boundary_edge[i] )
-        {
-            assert( m_edge_to_triangle_map[i].size() == 1 );
-        }
-        else
-        {
-            assert( m_edge_to_triangle_map[i].size() > 1 );
-        }
-    }
-    
-    // m_is_boundary_vertex
-    
-    for ( size_t i = 0; i < m_is_boundary_vertex.size(); ++i )
-    {
-        if ( vertex_is_deleted(i) ) { continue; }
-        
-        bool found_incident_boundary_edge = false;
-        for ( size_t j = 0; j < m_vertex_to_edge_map[i].size(); ++j )
-        {
-            size_t inc_edge = m_vertex_to_edge_map[i][j];
-            if ( m_is_boundary_edge[inc_edge] )
-            {
-                found_incident_boundary_edge = true;
-            }
-        }
-        assert( m_is_boundary_vertex[i] == found_incident_boundary_edge );
-    }
-    
-    // m_vertex_to_edge_map
-    
-    for ( size_t i = 0; i < m_vertex_to_edge_map.size(); ++i )
-    {
-        if ( vertex_is_deleted(i) ) { continue; }
-        for ( size_t j = 0; j < m_vertex_to_edge_map[i].size(); ++j )
-        {
-            size_t inc_edge = m_vertex_to_edge_map[i][j];         
-            assert( !edge_is_deleted( inc_edge ) );
-            assert( m_edges[inc_edge][0] == i || m_edges[inc_edge][1] == i );
-        }         
-    }
-    
-    
-    // m_vertex_to_triangle_map
-    
-    for ( size_t i = 0; i < m_vertex_to_triangle_map.size(); ++i )
-    {
-        if ( vertex_is_deleted(i) ) { continue; }
-        for ( size_t j = 0; j < m_vertex_to_triangle_map[i].size(); ++j )
-        {
-            size_t inc_triangle = m_vertex_to_triangle_map[i][j];
-            assert( m_tris[inc_triangle][0] == i || m_tris[inc_triangle][1] == i || m_tris[inc_triangle][2] == i );
-        }         
-    }
-    
-    // m_edge_to_triangle_map
-    
-    for ( size_t i = 0; i < m_edge_to_triangle_map.size(); ++i )
-    {
-        if ( edge_is_deleted(i) ) { continue; }
-        for ( size_t j = 0; j < m_edge_to_triangle_map[i].size(); ++j )
-        {
-            size_t triangle_index = m_edge_to_triangle_map[i][j];
-            size_t num_common_verts = 0;
-            if ( m_tris[triangle_index][0] == m_edges[i][0] || m_tris[triangle_index][0] == m_edges[i][1] )
-            {
-                ++num_common_verts;
-            }
-            if ( m_tris[triangle_index][1] == m_edges[i][0] || m_tris[triangle_index][1] == m_edges[i][1] )
-            {
-                ++num_common_verts;
-            }
-            if ( m_tris[triangle_index][2] == m_edges[i][0] || m_tris[triangle_index][2] == m_edges[i][1] )
-            {
-                ++num_common_verts;
-            }
-            assert( num_common_verts == 2 );
-        }
-    }
-    
-    // m_triangle_to_edge_map
-    
-    for ( size_t i = 0; i < m_triangle_to_edge_map.size(); ++i )
-    {
-        if ( triangle_is_deleted(i) ) { continue; }
-        
-        const Vec3st& inc_edges = m_triangle_to_edge_map[i];
-        
-        const Vec2st& edge0 = m_edges[inc_edges[0]];
-        const Vec2st& edge1 = m_edges[inc_edges[1]];
-        const Vec2st& edge2 = m_edges[inc_edges[2]];
-        
-        assert( !edge_is_deleted( inc_edges[0] ) );
-        assert( !edge_is_deleted( inc_edges[1] ) );
-        assert( !edge_is_deleted( inc_edges[2] ) );
-        
-        assert( edge0[0] != edge0[1] );
-        assert( edge1[0] != edge1[1] );
-        assert( edge2[0] != edge2[1] );
-        
-        assert( edge0[0] == m_tris[i][0] || edge0[0] == m_tris[i][1] || edge0[0] == m_tris[i][2] );
-        assert( edge0[1] == m_tris[i][0] || edge0[1] == m_tris[i][1] || edge0[1] == m_tris[i][2] );
-        assert( edge1[0] == m_tris[i][0] || edge1[0] == m_tris[i][1] || edge1[0] == m_tris[i][2] );
-        assert( edge1[1] == m_tris[i][0] || edge1[1] == m_tris[i][1] || edge1[1] == m_tris[i][2] );
-        assert( edge2[0] == m_tris[i][0] || edge2[0] == m_tris[i][1] || edge2[0] == m_tris[i][2] );
-        assert( edge2[1] == m_tris[i][0] || edge2[1] == m_tris[i][1] || edge2[1] == m_tris[i][2] );
-    }
-    
-}
-
-
-
-
-
diff --git a/extern/eltopo/eltopo3d/nondestructivetrimesh.h b/extern/eltopo/eltopo3d/nondestructivetrimesh.h
deleted file mode 100644
index 877f294..0000000
--- a/extern/eltopo/eltopo3d/nondestructivetrimesh.h
+++ /dev/null
@@ -1,678 +0,0 @@
-// ---------------------------------------------------------
-//
-//  nondestructivetrimesh.h
-//  Tyson Brochu 2008
-//  
-//  The graph of a triangle surface mesh (no spatial information).  Elements can be added and 
-//  removed dynamically.  Removing elements leaves empty space in the data structures, but they 
-//  can be defragmented by updating the connectivity information (rebuilding the mesh).
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_NONDESTRUCTIVETRIMESH_H
-#define EL_TOPO_NONDESTRUCTIVETRIMESH_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <cassert>
-#include <options.h>
-#include <vector>
-#include <vec.h>
-
-
-// ---------------------------------------------------------
-//  Non-member function declarations
-// ---------------------------------------------------------
-
-/// Safely convert a size_t to an int
-///
-int to_int( size_t a );
-
-/// Safely convert a ssize_t to an int
-///
-int to_int( ssize_t a );
-
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Connectivity information for a triangle mesh.  Contains no information on the vertex locations in space.
-///
-// --------------------------------------------------------
-
-class NonDestructiveTriMesh
-{  
-    
-public:
-    
-    /// Constructor
-    ///
-    NonDestructiveTriMesh() :
-    m_edges(0),
-    m_is_boundary_edge(0), m_is_boundary_vertex(0),
-    m_vertex_to_edge_map(0), m_vertex_to_triangle_map(0), m_edge_to_triangle_map(0), m_triangle_to_edge_map(0),
-    m_tris(0)
-    {}
-
-    
-    /// Return a const reference to the set of all triangles, including triangles marked as deleted.
-    ///
-    inline const std::vector<Vec3st>& get_triangles() const;
-    
-    /// Return a const reference to the specified triangle.
-    ///
-    inline const Vec3st& get_triangle( size_t index ) const;
-    
-    /// Get the number of triangles in the mesh.
-    ///
-    inline size_t num_triangles() const;
-    
-    /// Clear all mesh information
-    ///
-    void clear();
-    
-    /// Remove auxiliary connectivity information
-    ///
-    void clear_connectivity();
-    
-    /// Clear and rebuild connectivity information
-    ///
-    void update_connectivity( );
-    
-    /// Determine if the given vertex is on a boundary edge and store in data structure
-    ///
-    void update_is_boundary_vertex( size_t v );
-    
-    /// Find the index of an edge in the list of edges, if it exists. Return edges.size if the edge is not found.
-    ///
-    size_t get_edge_index(size_t vtx0, size_t vtx1) const;  
-    
-    /// Find the index of a triangle, if it exists. Return triangles.size if the triangle is not found.
-    ///
-    size_t get_triangle_index( size_t vtx0, size_t vtx1, size_t vtx2 ) const;  
-    
-    /// Get all triangles adjacent to the specified triangle
-    ///
-    void get_adjacent_triangles( size_t triangle_index, std::vector<size_t>& adjacent_triangles ) const;
-    
-    /// Get all vertices adjacent to the specified vertex
-    ///
-    void get_adjacent_vertices( size_t vertex_index, std::vector<size_t>& adjacent_vertices ) const;
-    
-    /// Add a triangle to the tris structure, update connectivity
-    ///
-    size_t nondestructive_add_triangle(const Vec3st& tri);
-    
-    /// Mark a triangle as deleted without actually changing the data structures
-    ///
-    void nondestructive_remove_triangle(size_t tri);
-    
-    /// Add a vertex, update connectivity.  Return index of new vertex.
-    ///
-    size_t nondestructive_add_vertex( );
-    
-    /// Remove a vertex, update connectivity
-    ///
-    void nondestructive_remove_vertex(size_t vtx);
-    
-    /// Set the stored set of triangles to the specified set.
-    ///
-    void replace_all_triangles( const std::vector<Vec3st>& new_tris );
-
-    /// Update the number of vertices in the mesh.
-    ///
-    void set_num_vertices( size_t num_vertices );
-    
-    /// Given two vertices on a triangle, return the third vertex
-    ///
-    inline size_t get_third_vertex( size_t vertex0, size_t vertex1, const Vec3st& triangle ) const;
-
-    /// Given two vertices on a triangle, return the third vertex
-    ///
-    inline size_t get_third_vertex( size_t edge_index, const Vec3st& triangle ) const;
-    
-    /// Given two vertices on a triangle, return the third vertex
-    ///
-    inline size_t get_third_vertex( size_t edge_index, size_t triangle_index ) const;
-    
-    /// Given two vertices on a triangle, return whether or not the triangle has the same orientation
-    ///
-    inline static bool oriented( size_t vertex0, size_t vertex1, const Vec3st& triangle );
-    
-    /// Ensure that all adjacent triangles have consistent orientation.
-    ///
-    void verify_orientation( );
-    
-    /// Return true if the given triangle is made up of the given vertices
-    ///
-    inline static bool triangle_has_these_verts( const Vec3st& tri, const Vec3st& verts );
-    
-    /// Return which vertex in tri matches v.  Also returns the other two vertices in tri.
-    ///
-    inline static size_t index_in_triangle( const Vec3st& tri, size_t v, Vec2ui& other_two );
-    
-    /// Return the edge incident on two triangles.  Returns ~0 if triangles are not adjacent.
-    ///
-    inline size_t get_common_edge( size_t triangle_a, size_t triangle_b );
-    
-    /// Determine if two triangles are adjacent (if they share an edge)
-    ///
-    inline bool triangles_are_adjacent( size_t triangle_a, size_t triangle_b );
-    
-    /// Remove triangles which have been deleted
-    ///
-    void clear_deleted_triangles( std::vector<Vec2st>* defragged_triangle_map = NULL );
-    
-    /// Determine if the given edge is on a surface composed of a single tet
-    ///
-    bool edge_is_on_single_tet( size_t edge_index ) const;
-    
-    /// Returns true if the triangle is marked for deletion
-    ///
-    inline bool triangle_is_deleted( size_t triangle_index ) const;
-    
-    /// Returns true if the edge is marked for deletion
-    ///
-    inline bool edge_is_deleted( size_t edge_index ) const;
-    
-    /// Returns true if the vertex is marked for deletion
-    ///
-    inline bool vertex_is_deleted( size_t vertex_index ) const;
-    
-    /// Check the consistency of auxiliary data structures
-    ///
-    void test_connectivity() const;
-    
-    // 
-    // Data members
-    //
-    
-    /// Edges as vertex pairs
-    ///
-    std::vector<Vec2st> m_edges;    
-    
-    /// Whether an edge is on a boundary
-    ///
-    std::vector<bool> m_is_boundary_edge;
-    
-    /// Whether a vertex is on a boundary
-    ///
-    std::vector<bool> m_is_boundary_vertex;
-    
-    /// Edges incident on vertices (given a vertex, which edges is it incident on)
-    ///
-    std::vector<std::vector<size_t> > m_vertex_to_edge_map; 
-    
-    /// Triangles incident on vertices (given a vertex, which triangles is it incident on)
-    ///
-    std::vector<std::vector<size_t> > m_vertex_to_triangle_map;    
-    
-    /// Triangles incident on edges (given an edge, which triangles is it incident on)
-    ///
-    std::vector<std::vector<size_t> > m_edge_to_triangle_map;    
-    
-    /// Edges around triangles (given a triangle, which 3 edges does it contain)
-    ///
-    std::vector<Vec3st> m_triangle_to_edge_map; 
-    
-    
-private:
-    
-    /// List of triangles: the fundamental data
-    ///
-    std::vector<Vec3st> m_tris;
-    
-    /// Add an edge to the list of edges.  Return the index of the new edge.
-    ///
-    size_t nondestructive_add_edge(size_t vtx0, size_t vtx1);
-    
-    /// Mark an edge as deleted, update connectivity
-    ///
-    void nondestructive_remove_edge( size_t edge_index );
-    
-};
-
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Safely convert a size_t to an int
-///
-// ---------------------------------------------------------
-
-inline int to_int( size_t a )
-{
-    assert( a < INT_MAX );
-    return static_cast<int>(a);
-}
-
-// ---------------------------------------------------------
-///
-/// Safely convert a ssize_t to an int
-///
-// ---------------------------------------------------------
-
-inline int to_int( ssize_t a )
-{
-    assert( a < INT_MAX );
-    return static_cast<int>(a);
-}
-
-// ---------------------------------------------------------
-///
-/// Return a reference to the set of all triangles, including triangles marked as deleted.
-///
-// ---------------------------------------------------------
-
-inline const std::vector<Vec3st>& NonDestructiveTriMesh::get_triangles() const
-{
-    return m_tris;
-}
-
-// ---------------------------------------------------------
-///
-/// Return a reference to the specified triangle.
-///
-// ---------------------------------------------------------
-
-inline const Vec3st& NonDestructiveTriMesh::get_triangle( size_t index ) const
-{
-    return m_tris[index];
-}
-
-// ---------------------------------------------------------
-///
-/// Get the number of triangles in the mesh.
-///
-// ---------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::num_triangles() const
-{
-    return m_tris.size();
-}
-
-
-// --------------------------------------------------------
-///
-/// Return the vertices of the specified triangle, but in ascending order.
-///
-// --------------------------------------------------------
-
-inline Vec3st sort_triangle( const Vec3st& t )
-{
-    if ( t[0] < t[1] )
-    {
-        if ( t[0] < t[2] )
-        {
-            if ( t[1] < t[2] )
-            {
-                return t;
-            }
-            else
-            {
-                return Vec3st( t[0], t[2], t[1] );
-            }
-        }
-        else
-        {
-            return Vec3st( t[2], t[0], t[1] );
-        }
-    }
-    else
-    {
-        if ( t[1] < t[2] )
-        {
-            if ( t[0] < t[2] )
-            {
-                return Vec3st( t[1], t[0], t[2] );
-            }
-            else
-            {
-                return Vec3st( t[1], t[2], t[0] );
-            }
-        }
-        else
-        {
-            return Vec3st( t[2], t[1], t[0] );
-        }
-    }
-}
-
-
-// --------------------------------------------------------
-///
-/// Given a triangle and two vertices incident on it, return the third vertex in the triangle.
-///
-// --------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::get_third_vertex( size_t vertex0, size_t vertex1, const Vec3st& triangle ) const
-{
-    if ( !( ( triangle[0] == vertex0 || triangle[1] == vertex0 || triangle[2] == vertex0 ) && ( triangle[0] == vertex1 || triangle[1] == vertex1 || triangle[2] == vertex1 ) ) )
-    {
-        std::cout << "tri: " << triangle << std::endl;
-        std::cout << "v0: " << vertex0 << ", v1: " << vertex1 << std::endl;
-        assert(false);
-    }
-    
-    if ( triangle[0] == vertex0 )
-    {
-        if ( triangle[1] == vertex1 )
-        {
-            return triangle[2];
-        }
-        else
-        {
-            return triangle[1];
-        }
-    }
-    else if ( triangle[1] == vertex0 )
-    {
-        if ( triangle[2] == vertex1 )
-        {
-            return triangle[0];
-        }
-        else
-        {
-            return triangle[2];
-        }
-    }
-    else
-    {
-        if ( triangle[0] == vertex1 )
-        {
-            return triangle[1];
-        }
-        else
-        {
-            return triangle[0];
-        }
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Given an edge and a triangle, return the vertex in the triangle and not on the edge.
-///
-// ---------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::get_third_vertex( size_t edge_index, const Vec3st& triangle ) const
-{
-    return get_third_vertex( m_edges[edge_index][0], m_edges[edge_index][1], triangle );
-}
-
-// ---------------------------------------------------------
-///
-/// Given an edge and a triangle, return the vertex in the triangle and not on the edge.
-///
-// ---------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::get_third_vertex( size_t edge_index, size_t triangle_index ) const
-{
-    return get_third_vertex( m_edges[edge_index][0], m_edges[edge_index][1], m_tris[triangle_index] );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Set the stored set of triangles to the specified set.
-///
-// ---------------------------------------------------------
-
-inline void NonDestructiveTriMesh::replace_all_triangles( const std::vector<Vec3st>& new_tris )
-{
-    m_tris = new_tris;
-    update_connectivity( );
-}
-
-
-// --------------------------------------------------------
-///
-/// Given a triangle and two vertices incident on it, determine if the triangle is oriented according to the order of the
-/// given vertices.
-///
-// --------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::oriented( size_t vertex0, size_t vertex1, const Vec3st& triangle )
-{
-    assert ( triangle[0] == vertex0 || triangle[1] == vertex0 || triangle[2] == vertex0 );
-    assert ( triangle[0] == vertex1 || triangle[1] == vertex1 || triangle[2] == vertex1 );
-    
-    if ( ( (triangle[0] == vertex0) && (triangle[1] == vertex1) ) || 
-        ( (triangle[1] == vertex0) && (triangle[2] == vertex1) ) ||
-        ( (triangle[2] == vertex0) && (triangle[0] == vertex1) ) )
-    {
-        return true;
-    }
-    
-    return false;
-}
-
-// --------------------------------------------------------
-///
-/// Return true if the given triangle is made up of the given vertices
-///
-// --------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::triangle_has_these_verts( const Vec3st& tri, const Vec3st& verts )
-{
-    if ( ( tri[0] == verts[0] || tri[0] == verts[1] || tri[0] == verts[2] ) &&
-        ( tri[1] == verts[0] || tri[1] == verts[1] || tri[1] == verts[2] ) &&
-        ( tri[2] == verts[0] || tri[2] == verts[1] || tri[2] == verts[2] ) )
-    {
-        return true;
-    }
-    
-    return false;
-}
-
-// --------------------------------------------------------
-///
-/// Return true if the given triangle is made up of the given vertices
-///
-// --------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::index_in_triangle( const Vec3st& tri, size_t v, Vec2ui& other_two )
-{
-    if ( v == tri[0] )
-    {
-        other_two[0] = 1;
-        other_two[1] = 2;
-        return 0;
-    }
-    
-    if ( v == tri[1] )
-    {
-        other_two[0] = 2;
-        other_two[1] = 0;      
-        return 1;
-    }
-    
-    if ( v == tri[2] )
-    {
-        other_two[0] = 0;
-        other_two[1] = 1;
-        return 2;
-    }
-    
-    assert(0);
-    
-    other_two[0] = static_cast<unsigned int>(~0);
-    other_two[1] = static_cast<unsigned int>(~0);
-    return static_cast<size_t>(~0);
-}
-
-
-// --------------------------------------------------------
-///
-/// Get the set of all triangles adjacent to a given triangle
-///
-// --------------------------------------------------------
-
-inline void NonDestructiveTriMesh::get_adjacent_triangles( size_t triangle_index, std::vector<size_t>& adjacent_triangles ) const
-{
-    adjacent_triangles.clear();
-    
-    for ( unsigned int i = 0; i < 3; ++i )
-    {
-        size_t edge_index = m_triangle_to_edge_map[triangle_index][i];
-        
-        for ( size_t t = 0; t < m_edge_to_triangle_map[edge_index].size(); ++t )
-        {
-            if ( m_edge_to_triangle_map[edge_index][t] != triangle_index )
-            {  
-                adjacent_triangles.push_back( m_edge_to_triangle_map[edge_index][t] );
-            }
-        }
-    }
-    
-}
-
-// --------------------------------------------------------
-///
-/// Get the set of all vertices adjacent to a given vertices
-///
-// --------------------------------------------------------
-
-inline void NonDestructiveTriMesh::get_adjacent_vertices( size_t vertex_index, std::vector<size_t>& adjacent_vertices ) const
-{
-    adjacent_vertices.clear();
-    const std::vector<size_t>& incident_edges = m_vertex_to_edge_map[vertex_index];
-    
-    for ( size_t i = 0; i < incident_edges.size(); ++i )
-    {
-        if ( m_edges[ incident_edges[i] ][0] == vertex_index )
-        {
-            adjacent_vertices.push_back( m_edges[ incident_edges[i] ][1] );
-        }
-        else
-        {
-            assert( m_edges[ incident_edges[i] ][1] == vertex_index );
-            adjacent_vertices.push_back( m_edges[ incident_edges[i] ][0] );
-        }      
-    }
-    
-}
-
-// --------------------------------------------------------
-///
-/// Determine if the given edge is on a surface composed of a single tet
-///
-// --------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::edge_is_on_single_tet( size_t edge_index ) const
-{
-    const Vec2st& e = m_edges[edge_index];
-    const std::vector<size_t>& incident_tris0 = m_vertex_to_triangle_map[ e[0] ];
-    const std::vector<size_t>& incident_tris1 = m_vertex_to_triangle_map[ e[1] ];
-    
-    size_t triangle_nhood_size = incident_tris0.size();
-    
-    for ( size_t i = 0; i < incident_tris1.size(); ++i )
-    {
-        bool already_counted = false;
-        for ( size_t j = 0; j < incident_tris0.size(); ++j )
-        {
-            if ( incident_tris1[i] == incident_tris0[j] )
-            {
-                already_counted = true;
-                break;
-            }
-        }
-        
-        if ( !already_counted )
-        {
-            ++triangle_nhood_size;
-        }
-        
-    }
-    
-    // will fire if one of the vertices is on a boundary
-    assert( triangle_nhood_size >= 4 );
-    
-    return (triangle_nhood_size == 4);
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Returns true if the triangle is marked for deletion
-///
-// ---------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::triangle_is_deleted( size_t triangle_index ) const
-{
-    return ( m_tris[triangle_index][0] == m_tris[triangle_index][1] || 
-            m_tris[triangle_index][1] == m_tris[triangle_index][2] ||
-            m_tris[triangle_index][2] == m_tris[triangle_index][0] );
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Returns true if the edge is marked for deletion
-///
-// ---------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::edge_is_deleted( size_t edge_index ) const
-{
-    return ( m_edges[edge_index][0] == m_edges[edge_index][1] );
-}
-
-// ---------------------------------------------------------
-///
-/// Returns true if the vertex is marked for deletion
-///
-// ---------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::vertex_is_deleted( size_t vertex_index ) const
-{
-    return ( m_vertex_to_edge_map[vertex_index].size() == 0 );
-}
-
-// --------------------------------------------------------
-///
-/// Return the edge incident on two triangles.  Returns ~0 if triangles are not adjacent.
-///
-// --------------------------------------------------------
-
-inline size_t NonDestructiveTriMesh::get_common_edge( size_t triangle_a, size_t triangle_b )
-{
-    const Vec3st& triangle_a_edges = m_triangle_to_edge_map[triangle_a];
-    const Vec3st& triangle_b_edges = m_triangle_to_edge_map[triangle_b];
-    
-    for ( unsigned int i = 0; i < 3; ++i )
-    {
-        for ( unsigned int j = 0; j < 3; ++j )
-        {
-            if ( triangle_a_edges[i] == triangle_b_edges[j] )
-            {
-                return triangle_a_edges[i];
-            }
-        }      
-    }
-    
-    return static_cast<unsigned int>(~0);
-}
-
-
-// --------------------------------------------------------
-///
-/// Determine if two triangles are adjacent (if they share an edge)
-///
-// --------------------------------------------------------
-
-inline bool NonDestructiveTriMesh::triangles_are_adjacent( size_t triangle_a, size_t triangle_b )
-{
-    return ( get_common_edge( triangle_a, triangle_b ) != (size_t) ~0 );
-}
-
-#endif
diff --git a/extern/eltopo/eltopo3d/options.h b/extern/eltopo/eltopo3d/options.h
deleted file mode 100644
index a6967fd..0000000
--- a/extern/eltopo/eltopo3d/options.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// ---------------------------------------------------------
-//
-//  options.h
-//  Tyson Brochu 2008
-//
-//  Constants and macro defines
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_OPTIONS_H
-#define EL_TOPO_OPTIONS_H
-
-#include <commonoptions.h>
-
-// ---------------------------------------------------------
-// Global constants
-// ---------------------------------------------------------
-
-extern const double G_EIGENVALUE_RANK_RATIO;    // in surftrack.cpp
-
-
-#endif
-
diff --git a/extern/eltopo/eltopo3d/readme.txt b/extern/eltopo/eltopo3d/readme.txt
deleted file mode 100644
index 447df31..0000000
--- a/extern/eltopo/eltopo3d/readme.txt
+++ /dev/null
@@ -1,143 +0,0 @@
-
-EL TOPO: ROBUST TOPOLOGICAL OPERATIONS FOR DYNAMIC EXPLICIT SURFACES
-===============================================================================
-
-El Topo is a C-callable library built in C++.  This readme describes:
-
-- how to build the library
-- how to use the library
-
-(Also included in this release is code for creating an executable with various 
-example applications.  See the talpa directory for more details.)
-
-
-Building the library:
-=====================
-
-1) Create Makefile.local_defs
-
-Makefile should handle building El Topo library on Linux and OS/X with g++.  It 
-reads a file called Makefile.local_defs, which contains platform-specific 
-definitions.  You must create this file!  Makefile.example_defs includes 
-suggested settings for Linux and OS/X.
-
-2) Generate dependencies and compile
-
-Once you have created a file called Makefile.local_defs, you can build the El 
-Topo library by running "make depend", followed by "make release" or 
-"make debug".  This will create a file called "libeltopo_release.a" or 
-"libeltopo_debug.a" which can be used by your C/C++ program.
-
-Example:
-$> make depend
-$> make release
-
-3) Link to your program
-
-The library is written in C++, so if you are using it from a C program, you must
-link against the standard C++ library when building your program.  It also 
-requires the BLAS and LAPACK libraries.
-
-Example:
-$> gcc main.c libeltopo_release.a -llapack -lblas -lstdc++ -o your_executable
-
-
-Using the library:
-=====================
-
-The files eltopo.h and eltopo.cpp define the interface for El Topo.  There are 
-two main functions,  el_topo_static_operations() and el_topo_integrate(), which 
-take as parameters input and output vertex coordinates, triangles, and masses, 
-as well as some special structures.  These structures define the parameters to 
-be used by El Topo (see eltopo.h for more details).  The function 
-el_topo_static_operations() performs mesh improvement and topological changes 
-such as merging and separation, and el_topo_integrate() moves the surface 
-vertices while guaranteeing no self-intersections.
-
-
-A tour of the code base:
-=====================
-
-Our method is outlined in our SISC paper [Brochu and Bridson 2009], however it 
-may be helpful to browse our code base.  The main classes you probably want to 
-look at are:
-
-NonDestructiveTriMesh
-DynamicSurface
-SurfTrack
-
-NonDestructiveTriMesh
----------------------
-
-This is a basic triangle mesh class.  The fundamental data is simply a list of 
-triangles.  It is "nondestructive" in that when you remove a triangle, it marks 
-the triangle as deleted, but doesn't change the size of the list.  The list of 
-triangles can then be defragmented as necessary.
-
-There is a set of auxiliary data structures containing various incidence 
-relations.  For example, vtxtri contains, for each vertex, the set of triangles 
-incident on that vertex.  These structures are useful for getting around the 
-mesh, but must be updated when the set of triangles changes.
-
-We generally defrag the list of triangles once per frame if the connectivity 
-changes, then rebuild the auxiliary data structures.
-
-DynamicSurface
----------------------
-
-Main data members of this class are the mesh (NonDestructiveTriMesh) and a set 
-of vertex locations.  Additional data members include per-vertex data such as 
-velocities and masses.
-
-Most important member functions are collision detection and resolution 
-functions.  This class contains enough functionality to advect a surface from 
-one time step to the next in an intersection-free state, without changing 
-topology or connectivity.
-
-(This class would be sufficient for representing cloth if no mesh refinement 
-was required.)
-
-SurfTrack
----------------------
-
-A child class of DynamicSurface.  This class contains functions for mesh 
-adaptivity and topological changes.
-
-Other classes and files:
-=====================
-
-BroadPhase, BroadPhaseGrid and AccelerationGrid
----------------------
-
-The acceleration structure for broad phase collision detection.  It currently 
-consists of three regular grids, one grid each for triangles, edges and 
-vertices.  Other broad phase approaches could be implemented by subclassing the 
-BroadPhase base class.
-
-SubdivisionScheme
----------------------
-
-An interface for interpolating subdivision schemes.  We currently use 
-ButterflySubdivision for all our examples.
-
-Common:
----------------------
-
-Common is a set of files shared by our research group.  It contains several 
-useful classes and functions, notably:
-
-vec: A templated n-dimensional vector class.  For example, Vec3d (a vector of 
-3 doubles) is used all over the place.
-mat: A templated matrix class.
-gluvi: An OpenGL GUI.
-blas_wrapper and lapack_wrapper: Cross-platform interfaces to BLAS and LAPACK 
-functions.
-
-
-References
-=====================
-
-[Brochu and Bridson 2009]: Tyson Brochu and Robert Bridson, Robust Topological 
-Operations for Dynamic Explicit Surfaces, SIAM J. Sci. Comput., vol. 31, no. 4 
-(2009), pp. 2472-2493 
-
diff --git a/extern/eltopo/eltopo3d/subdivisionscheme.cpp b/extern/eltopo/eltopo3d/subdivisionscheme.cpp
deleted file mode 100644
index d4b6f4f..0000000
--- a/extern/eltopo/eltopo3d/subdivisionscheme.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-// ---------------------------------------------------------
-//
-//  subdivisionscheme.cpp
-//  Tyson Brochu 2008
-//  
-//  A collection of interpolation schemes for generating vertex locations.
-//
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <subdivisionscheme.h>
-
-#include <mat.h>
-#include <surftrack.h>
-
-// ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Member function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Midpoint scheme: simply places the new vertex at the midpoint of the edge
-///
-// --------------------------------------------------------
-
-void MidpointScheme::generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point )
-{
-    const NonDestructiveTriMesh& mesh = surface.m_mesh;
-    const std::vector<Vec3d>& positions = surface.get_positions();
-    size_t p1_index = mesh.m_edges[edge_index][0];
-	size_t p2_index = mesh.m_edges[edge_index][1];   
-    
-    new_point = 0.5 * ( positions[ p1_index ] + positions[ p2_index ] );
-}
-
-
-// --------------------------------------------------------
-///
-/// Butterfly scheme: uses a defined weighting of nearby vertices to determine the new vertex location
-///
-// --------------------------------------------------------
-
-void ButterflyScheme::generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point )
-{
-    const NonDestructiveTriMesh& mesh = surface.m_mesh;
-    const std::vector<Vec3d>& positions = surface.get_positions();
-    
-    size_t p1_index = mesh.m_edges[edge_index][0];
-	size_t p2_index = mesh.m_edges[edge_index][1];
-	
-    size_t tri0 = mesh.m_edge_to_triangle_map[edge_index][0];
-    size_t tri1 = mesh.m_edge_to_triangle_map[edge_index][1];
-    
-	size_t p3_index = mesh.get_third_vertex( mesh.m_edges[edge_index][0], mesh.m_edges[edge_index][1], mesh.get_triangle(tri0) );
-	size_t p4_index = mesh.get_third_vertex( mesh.m_edges[edge_index][0], mesh.m_edges[edge_index][1], mesh.get_triangle(tri1) );
-	
-	size_t adj_edges[4] = { mesh.get_edge_index( p1_index, p3_index ),
-        mesh.get_edge_index( p2_index, p3_index ),
-        mesh.get_edge_index( p1_index, p4_index ),
-        mesh.get_edge_index( p2_index, p4_index ) };
-    
-	size_t q_indices[4];
-	
-	for ( size_t i = 0; i < 4; ++i )
-	{
-		const std::vector<size_t>& adj_tris = mesh.m_edge_to_triangle_map[ adj_edges[i] ];
-		if ( adj_tris.size() != 2 )
-		{
-            // abort
-			new_point = 0.5 * ( positions[ p1_index ] + positions[ p2_index ] );
-            return;
-		}
-		
-		if ( adj_tris[0] == tri0 || adj_tris[0] == tri1 )
-		{
-			q_indices[i] = mesh.get_third_vertex( mesh.m_edges[ adj_edges[i] ][0], mesh.m_edges[ adj_edges[i] ][1], mesh.get_triangle( adj_tris[1] ) );
-		}
-		else
-		{
-			q_indices[i] = mesh.get_third_vertex( mesh.m_edges[ adj_edges[i] ][0], mesh.m_edges[ adj_edges[i] ][1], mesh.get_triangle( adj_tris[0] ) );
-		}
-	}
-    
-	new_point =   8. * positions[ p1_index ] + 8. * positions[ p2_index ] + 2. * positions[ p3_index ] + 2. * positions[ p4_index ]
-    - positions[ q_indices[0] ] - positions[ q_indices[1] ] - positions[ q_indices[2] ] - positions[ q_indices[3] ];
-    
-	new_point *= 0.0625;
-    
-}
-
-
-
-// --------------------------------------------------------
-///
-/// Quadric error minimization scheme: places the new vertex at the location that minimizes the change in the quadric metric tensor along the edge.
-///
-// --------------------------------------------------------
-
-void QuadraticErrorMinScheme::generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point )
-{
-    const NonDestructiveTriMesh& mesh = surface.m_mesh;
-    const std::vector<Vec3d>& positions = surface.get_positions();
-    
-    size_t v0 = mesh.m_edges[edge_index][0];
-    size_t v1 = mesh.m_edges[edge_index][1];
-    
-    Mat33d Q;
-    zero(Q);
-    Vec3d b;
-    zero(b);
-    
-    std::vector<size_t> triangles_counted;
-    
-    Mat<1,1,double> constant_dist;
-    constant_dist.a[0] = 0;
-    
-    for ( size_t i = 0; i < mesh.m_vertex_to_triangle_map[v0].size(); ++i )
-    {
-        size_t t = mesh.m_vertex_to_triangle_map[v0][i];
-        const Vec3d& plane_normal = surface.get_triangle_normal( t );
-        Q += outer( plane_normal, plane_normal );
-        b += dot( positions[v0], plane_normal ) * plane_normal;
-        constant_dist.a[0] += dot( plane_normal, positions[v0] ) * dot( plane_normal, positions[v0] );
-        triangles_counted.push_back(t);
-    }
-    
-    for ( size_t i = 0; i < mesh.m_vertex_to_triangle_map[v1].size(); ++i )
-    {
-        size_t t = mesh.m_vertex_to_triangle_map[v1][i];
-        
-        bool already_counted = false;
-        for ( size_t j = 0; j < triangles_counted.size(); ++j ) 
-        {
-            if ( t == triangles_counted[j] )
-            {
-                already_counted = true;
-            }
-        }
-        
-        if ( !already_counted )
-        {
-            const Vec3d& plane_normal = surface.get_triangle_normal( t );
-            Q += outer( plane_normal, plane_normal );
-            b += dot( positions[v1], plane_normal ) * plane_normal;
-            constant_dist.a[0] += dot( plane_normal, positions[v1] ) * dot( plane_normal, positions[v1] );
-        }
-    }
-    
-    // Compute normal direction
-    Vec3d normal = 0.5 * (surface.get_vertex_normal(v0) + surface.get_vertex_normal(v1));
-    normalize(normal);
-    
-    Mat<3,1,double> n;
-    n(0,0) = normal[0];
-    n(1,0) = normal[1];
-    n(2,0) = normal[2];
-    
-    // Compute edge midpoint
-    Vec3d midpoint = 0.5 * (positions[v0] + positions[v1]);   
-    Mat<3,1,double> m;
-    m(0,0) = midpoint[0];
-    m(1,0) = midpoint[1];
-    m(2,0) = midpoint[2]; 
-    
-    Mat<3,1,double> d;
-    d(0,0) = b[0];
-    d(1,0) = b[1];
-    d(2,0) = b[2];
-    
-    double LHS = 2.0 * (n.transpose()*Q*n).a[0];              // result of multiplication is Mat<1,1,double>, hence the .a[0]
-    double RHS = ( 2.0 * (n.transpose()*d) - (n.transpose()*Q*m) - (m.transpose()*Q*n) ).a[0];
-    
-    double a;
-    if ( fabs(LHS) > 1e-10 )
-    {
-        a = RHS / LHS;
-    }
-    else
-    {
-        a = 0.0;
-    }
-    
-    Mat<3,1,double> v = m + (a * n);
-    
-    double v_error = (v.transpose() * Q * v - 2.0 * (v.transpose() * d) + constant_dist).a[0];
-    double m_error = (m.transpose() * Q * m - 2.0 * (m.transpose() * d) + constant_dist).a[0];
-    
-    //assert( v_error < m_error + 1e-8 );
-    
-    if ( surface.m_verbose )
-    {
-        std::cout << "a: " << a << std::endl;
-        std::cout << "error at v: " << v_error << std::endl;
-        std::cout << "error at midpoint: " << m_error << std::endl;
-    }
-    
-    new_point = Vec3d( v.a[0], v.a[1], v.a[2] );
-    
-}
diff --git a/extern/eltopo/eltopo3d/subdivisionscheme.h b/extern/eltopo/eltopo3d/subdivisionscheme.h
deleted file mode 100644
index dee15fa..0000000
--- a/extern/eltopo/eltopo3d/subdivisionscheme.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// ---------------------------------------------------------
-//
-//  subdivisionscheme.h
-//  Tyson Brochu 2008
-//  
-//  A collection of interpolation schemes for generating vertex locations.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_SUBDIVISIONSCHEME_H
-#define EL_TOPO_SUBDIVISIONSCHEME_H
-
-// ---------------------------------------------------------
-// Nested includes
-// ---------------------------------------------------------
-
-#include <vec.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-class NonDestructiveTriMesh;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Subdivision scheme interface.  Declares the function prototype for finding an interpolated vertex location.
-///
-// --------------------------------------------------------
-
-class SubdivisionScheme
-{
-public:
-    
-    virtual ~SubdivisionScheme() {}
-    
-    /// Given an edge, compute the offset midpoint
-    ///
-    virtual void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point ) = 0;
-    
-};
-
-// --------------------------------------------------------
-///
-/// Midpoint scheme: simply places the new vertex at the midpoint of the edge
-///
-// --------------------------------------------------------
-
-class MidpointScheme : public SubdivisionScheme
-{
-public:
-    
-    /// Given an edge, compute the offset midpoint
-    ///
-    void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point );   
-    
-};
-
-// --------------------------------------------------------
-///
-/// Butterfly scheme: uses a defined weighting of nearby vertices to determine the new vertex location
-///
-// --------------------------------------------------------
-
-class ButterflyScheme : public SubdivisionScheme
-{
-public:  
-    
-    /// Given an edge, compute the offset midpoint
-    ///
-    void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point );
-    
-};
-
-
-// --------------------------------------------------------
-///
-/// Quadric error minimization scheme: places the new vertex at the location that minimizes the change in the quadric metric tensor along the edge.
-///
-// --------------------------------------------------------
-
-class QuadraticErrorMinScheme : public SubdivisionScheme
-{
-public:
-    
-    /// Given an edge, compute the offset midpoint
-    ///
-    void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point );
-    
-};
-
-
-#endif
-
-
-
diff --git a/extern/eltopo/eltopo3d/surftrack.cpp b/extern/eltopo/eltopo3d/surftrack.cpp
deleted file mode 100644
index ce82711..0000000
--- a/extern/eltopo/eltopo3d/surftrack.cpp
+++ /dev/null
@@ -1,699 +0,0 @@
-// ---------------------------------------------------------
-//
-//  surftrack.cpp
-//  Tyson Brochu 2008
-//  
-//  Implementation of the SurfTrack class: a dynamic mesh with 
-//  topological changes and mesh maintenance operations.
-//
-// ---------------------------------------------------------
-
-
-// ---------------------------------------------------------
-// Includes
-// ---------------------------------------------------------
-
-#include <surftrack.h>
-
-#include <array3.h>
-#include <broadphase.h>
-#include <cassert>
-#include <ccd_wrapper.h>
-#include <collisionpipeline.h>
-#include <collisionqueries.h>
-#include <edgeflipper.h>
-#include <impactzonesolver.h>
-#include <lapack_wrapper.h>
-#include <nondestructivetrimesh.h>
-#include <queue>
-#include <runstats.h>
-#include <subdivisionscheme.h>
-#include <stdio.h>
-#include <trianglequality.h>
-#include <vec.h>
-#include <vector>
-#include <wallclocktime.h>
-
-
-// ---------------------------------------------------------
-//  Global externs
-// ---------------------------------------------------------
-
-const double G_EIGENVALUE_RANK_RATIO = 0.03;
-
-extern RunStats g_stats;
-
-// ---------------------------------------------------------
-//  Member function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Default initialization parameters
-///
-// ---------------------------------------------------------
-
-SurfTrackInitializationParameters::SurfTrackInitializationParameters() :
-m_proximity_epsilon( 1e-4 ),
-m_friction_coefficient( 0.0 ),
-m_min_triangle_area( 1e-7 ),
-m_improve_collision_epsilon( 2e-6 ),
-m_use_fraction( false ),
-m_min_edge_length( UNINITIALIZED_DOUBLE ),     // <- Don't allow instantiation without setting these parameters
-m_max_edge_length( UNINITIALIZED_DOUBLE ),     // <-
-m_max_volume_change( UNINITIALIZED_DOUBLE ),   // <-
-m_min_triangle_angle( 0.0 ),
-m_max_triangle_angle( 180.0 ),
-m_use_curvature_when_splitting( false ),
-m_use_curvature_when_collapsing( false ),
-m_min_curvature_multiplier( 1.0 ),
-m_max_curvature_multiplier( 1.0 ),
-m_allow_vertex_movement( true ),
-m_edge_flip_min_length_change( 1e-8 ),
-m_merge_proximity_epsilon( 1e-5 ),
-m_subdivision_scheme(NULL),
-m_collision_safety(true),
-m_allow_topology_changes(true),
-m_allow_non_manifold(true),
-m_perform_improvement(true)
-{}
-
-
-// ---------------------------------------------------------
-///
-/// Create a SurfTrack object from a set of vertices and triangles using the specified paramaters
-///
-// ---------------------------------------------------------
-
-SurfTrack::SurfTrack( const std::vector<Vec3d>& vs, 
-                     const std::vector<Vec3st>& ts, 
-                     const std::vector<double>& masses,
-                     const SurfTrackInitializationParameters& initial_parameters ) :
-
-DynamicSurface( vs, 
-               ts,
-               masses,
-               initial_parameters.m_proximity_epsilon, 
-               initial_parameters.m_friction_coefficient,
-               initial_parameters.m_collision_safety ),
-
-m_collapser( *this, initial_parameters.m_use_curvature_when_collapsing, initial_parameters.m_min_curvature_multiplier ),
-m_splitter( *this, initial_parameters.m_use_curvature_when_splitting, initial_parameters.m_max_curvature_multiplier ),
-m_flipper( *this, initial_parameters.m_edge_flip_min_length_change ),
-m_smoother( *this ),
-m_merger( *this ),
-m_pincher( *this ),
-m_improve_collision_epsilon( initial_parameters.m_improve_collision_epsilon ),
-m_edge_flip_min_length_change( initial_parameters.m_edge_flip_min_length_change ),
-m_max_volume_change( UNINITIALIZED_DOUBLE ),   
-m_min_edge_length( UNINITIALIZED_DOUBLE ),
-m_max_edge_length( UNINITIALIZED_DOUBLE ),
-m_merge_proximity_epsilon( initial_parameters.m_merge_proximity_epsilon ),   
-m_min_triangle_area( initial_parameters.m_min_triangle_area ),
-m_min_triangle_angle( initial_parameters.m_min_triangle_angle ),
-m_max_triangle_angle( initial_parameters.m_max_triangle_angle ),
-m_subdivision_scheme( initial_parameters.m_subdivision_scheme ),
-should_delete_subdivision_scheme_object( m_subdivision_scheme == NULL ? true : false ),
-m_dirty_triangles(0),   
-m_allow_topology_changes( initial_parameters.m_allow_topology_changes ),
-m_allow_non_manifold( initial_parameters.m_allow_non_manifold ),
-m_perform_improvement( initial_parameters.m_perform_improvement ),
-m_allow_vertex_movement( initial_parameters.m_allow_vertex_movement ),
-m_vertex_change_history(),
-m_triangle_change_history(),
-m_defragged_triangle_map(),
-m_defragged_vertex_map()
-{
-    
-    if ( m_verbose )
-    {
-        std::cout << " ======== SurfTrack ======== " << std::endl;   
-        std::cout << "m_allow_topology_changes: " << m_allow_topology_changes << std::endl;
-        std::cout << "m_perform_improvement: " << m_perform_improvement << std::endl;   
-        std::cout << "m_min_triangle_area: " << m_min_triangle_area << std::endl;
-        std::cout << "initial_parameters.m_use_fraction: " << initial_parameters.m_use_fraction << std::endl;
-    }
-    
-    if ( m_collision_safety )
-    {
-        rebuild_static_broad_phase();
-    }
-    
-    assert( initial_parameters.m_min_edge_length != UNINITIALIZED_DOUBLE );
-    assert( initial_parameters.m_max_edge_length != UNINITIALIZED_DOUBLE );
-    assert( initial_parameters.m_max_volume_change != UNINITIALIZED_DOUBLE );
-    
-    if ( initial_parameters.m_use_fraction )
-    {
-        double avg_length = DynamicSurface::get_average_non_solid_edge_length();   
-        m_collapser.m_min_edge_length = initial_parameters.m_min_edge_length * avg_length;
-        m_splitter.m_max_edge_length = initial_parameters.m_max_edge_length * avg_length;
-        m_min_edge_length = initial_parameters.m_min_edge_length * avg_length;
-        m_max_edge_length = initial_parameters.m_max_edge_length * avg_length;
-        m_max_volume_change = initial_parameters.m_max_volume_change * avg_length * avg_length * avg_length;        
-    }
-    else
-    {
-        m_collapser.m_min_edge_length = initial_parameters.m_min_edge_length;
-        m_splitter.m_max_edge_length = initial_parameters.m_max_edge_length;
-        m_min_edge_length = initial_parameters.m_min_edge_length;
-        m_max_edge_length = initial_parameters.m_max_edge_length;
-        m_max_volume_change = initial_parameters.m_max_volume_change;  
-    }
-    
-    if ( m_verbose )
-    {
-        std::cout << "m_min_edge_length: " << m_min_edge_length << std::endl;
-        std::cout << "m_max_edge_length: " << m_max_edge_length << std::endl;
-        std::cout << "m_max_volume_change: " << m_max_volume_change << std::endl;
-    }
-    
-    if ( m_subdivision_scheme == NULL )
-    {
-        m_subdivision_scheme = new MidpointScheme();
-        should_delete_subdivision_scheme_object = true;
-    }
-    else
-    {
-        should_delete_subdivision_scheme_object = false;
-    }
-    
-    if ( false == m_allow_topology_changes )
-    {
-        m_allow_non_manifold = false;
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Destructor.  Deallocates the subdivision scheme object if we created one.
-///
-// ---------------------------------------------------------
-
-SurfTrack::~SurfTrack()
-{
-    if ( should_delete_subdivision_scheme_object )
-    {
-        delete m_subdivision_scheme;
-    }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid. 
-///
-// ---------------------------------------------------------
-
-size_t SurfTrack::add_triangle( const Vec3st& t )
-{
-    size_t new_triangle_index = m_mesh.nondestructive_add_triangle( t );
-    
-    assert( t[0] < get_num_vertices() );
-    assert( t[1] < get_num_vertices() );
-    assert( t[2] < get_num_vertices() );
-    
-    if ( m_collision_safety )
-    {
-        // Add to the triangle grid
-        Vec3d low, high;
-        triangle_static_bounds( new_triangle_index, low, high );
-        m_broad_phase->add_triangle( new_triangle_index, low, high, triangle_is_solid(new_triangle_index) );
-        
-        // Add edges to grid as well
-        size_t new_edge_index = m_mesh.get_edge_index( t[0], t[1] );
-        assert( new_edge_index != m_mesh.m_edges.size() );
-        edge_static_bounds( new_edge_index, low, high );
-        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index ) );
-        
-        new_edge_index = m_mesh.get_edge_index( t[1], t[2] );
-        assert( new_edge_index != m_mesh.m_edges.size() );   
-        edge_static_bounds( new_edge_index, low, high );
-        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index )  );
-        
-        new_edge_index = m_mesh.get_edge_index( t[2], t[0] );
-        assert( new_edge_index != m_mesh.m_edges.size() );   
-        edge_static_bounds( new_edge_index, low, high );
-        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index )  );
-    }
-    
-    m_triangle_change_history.push_back( TriangleUpdateEvent( TriangleUpdateEvent::TRIANGLE_ADD, new_triangle_index, t ) );
-    
-    return new_triangle_index;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Remove a triangle from the surface.  Update the underlying TriMesh and acceleration grid. 
-///
-// ---------------------------------------------------------
-
-void SurfTrack::remove_triangle(size_t t)
-{
-    m_mesh.nondestructive_remove_triangle( t );
-    if ( m_collision_safety )
-    {
-        m_broad_phase->remove_triangle( t );
-    }
-    
-    m_triangle_change_history.push_back( TriangleUpdateEvent( TriangleUpdateEvent::TRIANGLE_REMOVE, t, Vec3st(0) ) );
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Add a vertex to the surface.  Update the acceleration grid. 
-///
-// ---------------------------------------------------------
-
-size_t SurfTrack::add_vertex( const Vec3d& new_vertex_position, double new_vertex_mass )
-{
-    size_t new_vertex_index = m_mesh.nondestructive_add_vertex( );
-    
-    if( new_vertex_index > get_num_vertices() - 1 )
-    {
-        pm_positions.resize( new_vertex_index  + 1 );
-        pm_newpositions.resize( new_vertex_index  + 1 );
-        m_masses.resize( new_vertex_index  + 1 );
-    }
-    
-    pm_positions[new_vertex_index] = new_vertex_position;
-    pm_newpositions[new_vertex_index] = new_vertex_position;
-    m_masses[new_vertex_index] = new_vertex_mass;
-    
-    if ( m_collision_safety )
-    {
-        m_broad_phase->add_vertex( new_vertex_index, get_position(new_vertex_index), get_position(new_vertex_index), vertex_is_solid(new_vertex_index) );       
-    }
-    
-    return new_vertex_index;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Remove a vertex from the surface.  Update the acceleration grid. 
-///
-// ---------------------------------------------------------
-
-void SurfTrack::remove_vertex( size_t vertex_index )
-{
-    m_mesh.nondestructive_remove_vertex( vertex_index );
-    
-    if ( m_collision_safety )
-    {
-        m_broad_phase->remove_vertex( vertex_index );
-    }
-    
-    m_vertex_change_history.push_back( VertexUpdateEvent( VertexUpdateEvent::VERTEX_REMOVE, vertex_index, Vec2st(0,0) ) );
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Remove deleted vertices and triangles from the mesh data structures
-///
-// ---------------------------------------------------------
-
-void SurfTrack::defrag_mesh( )
-{
-    
-    //
-    // First clear deleted vertices from the data stuctures
-    // 
-    
-    double start_time = get_time_in_seconds();
-    
-    
-    // do a quick pass through to see if any vertices have been deleted
-    bool any_deleted = false;
-    for ( size_t i = 0; i < get_num_vertices(); ++i )
-    {  
-        if ( m_mesh.vertex_is_deleted(i) )
-        {
-            any_deleted = true;
-            break;
-        }
-    }    
-    
-    if ( !any_deleted )
-    {
-        for ( size_t i = 0; i < get_num_vertices(); ++i )
-        {
-            m_defragged_vertex_map.push_back( Vec2st(i,i) );
-        }
-        
-        double end_time = get_time_in_seconds();      
-        g_stats.add_to_double( "total_clear_deleted_vertices_time", end_time - start_time );
-        
-    }
-    else
-    {
-        
-        // Note: We could rebuild the mesh from scratch, rather than adding/removing 
-        // triangles, however this function is not a major computational bottleneck.
-        
-        size_t j = 0;
-        
-        std::vector<Vec3st> new_tris = m_mesh.get_triangles();
-        
-        for ( size_t i = 0; i < get_num_vertices(); ++i )
-        {      
-            if ( !m_mesh.vertex_is_deleted(i) )
-            {
-                pm_positions[j] = pm_positions[i];
-                pm_newpositions[j] = pm_newpositions[i];
-                m_masses[j] = m_masses[i];
-                
-                m_defragged_vertex_map.push_back( Vec2st(i,j) );
-                
-                // Now rewire the triangles containting vertex i
-                
-                // copy this, since we'll be changing the original as we go
-                std::vector<size_t> inc_tris = m_mesh.m_vertex_to_triangle_map[i];
-                
-                for ( size_t t = 0; t < inc_tris.size(); ++t )
-                {
-                    Vec3st triangle = m_mesh.get_triangle( inc_tris[t] );
-                    
-                    assert( triangle[0] == i || triangle[1] == i || triangle[2] == i );
-                    if ( triangle[0] == i ) { triangle[0] = j; }
-                    if ( triangle[1] == i ) { triangle[1] = j; }
-                    if ( triangle[2] == i ) { triangle[2] = j; }        
-                    
-                    remove_triangle(inc_tris[t]);       // mark the triangle deleted
-                    add_triangle(triangle);             // add the updated triangle
-                }
-                
-                ++j;
-            }
-        }
-        
-        pm_positions.resize(j);
-        pm_newpositions.resize(j);
-        m_masses.resize(j);
-    }
-    
-    double end_time = get_time_in_seconds();
-    
-    g_stats.add_to_double( "total_clear_deleted_vertices_time", end_time - start_time );
-    
-    
-    //
-    // Now clear deleted triangles from the mesh
-    // 
-    
-    m_mesh.set_num_vertices( get_num_vertices() );    
-    m_mesh.clear_deleted_triangles( &m_defragged_triangle_map );
-    
-    if ( m_collision_safety )
-    {
-        rebuild_continuous_broad_phase();
-    }
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Fire an assert if any triangle has repeated vertices or if any zero-volume tets are found.
-///
-// --------------------------------------------------------
-
-void SurfTrack::assert_no_degenerate_triangles( )
-{
-    
-    // for each triangle on the surface
-    for ( size_t i = 0; i < m_mesh.num_triangles(); ++i )
-    {
-        
-        const Vec3st& current_triangle = m_mesh.get_triangle(i);
-        
-        if ( (current_triangle[0] == 0) && (current_triangle[1] == 0) && (current_triangle[2] == 0) ) 
-        {
-            // deleted triangle
-            continue;
-        }
-        
-        //
-        // check if triangle has repeated vertices
-        //
-        
-        assert ( !( (current_triangle[0] == current_triangle[1]) || 
-                   (current_triangle[1] == current_triangle[2]) || 
-                   (current_triangle[2] == current_triangle[0]) ) );
-        
-        //
-        // look for flaps
-        //
-        const Vec3st& tri_edges = m_mesh.m_triangle_to_edge_map[i];
-        
-        bool flap_found = false;
-        
-        for ( unsigned int e = 0; e < 3 && flap_found == false; ++e )
-        {
-            const std::vector<size_t>& edge_tris = m_mesh.m_edge_to_triangle_map[ tri_edges[e] ];
-            
-            for ( size_t t = 0; t < edge_tris.size(); ++t )
-            {
-                if ( edge_tris[t] == i )
-                {
-                    continue;
-                }
-                
-                size_t other_triangle_index = edge_tris[t];
-                const Vec3st& other_triangle = m_mesh.get_triangle( other_triangle_index );
-                
-                if ( (other_triangle[0] == other_triangle[1]) || 
-                    (other_triangle[1] == other_triangle[2]) || 
-                    (other_triangle[2] == other_triangle[0]) ) 
-                {
-                    assert( !"repeated vertices" );
-                }
-                
-                if ( ((current_triangle[0] == other_triangle[0]) || (current_triangle[0] == other_triangle[1]) || (current_triangle[0] == other_triangle[2])) &&
-                    ((current_triangle[1] == other_triangle[0]) || (current_triangle[1] == other_triangle[1]) || (current_triangle[1] == other_triangle[2])) &&
-                    ((current_triangle[2] == other_triangle[0]) || (current_triangle[2] == other_triangle[1]) || (current_triangle[2] == other_triangle[2])) ) 
-                {
-                    
-                    size_t common_edge = tri_edges[e];
-                    if ( m_mesh.oriented( m_mesh.m_edges[common_edge][0], m_mesh.m_edges[common_edge][1], current_triangle ) == 
-                        m_mesh.oriented( m_mesh.m_edges[common_edge][0], m_mesh.m_edges[common_edge][1], other_triangle ) )
-                    { 
-                        assert( false );
-                        continue;
-                    }
-                    
-                    assert( false );
-                }
-            }         
-        }
-        
-    }
-    
-}
-
-
-// --------------------------------------------------------
-///
-/// Delete flaps and zero-area triangles.  Then separate singular vertices.
-///
-// --------------------------------------------------------
-
-void SurfTrack::trim_non_manifold( std::vector<size_t>& triangle_indices )
-{   
-    
-    // If we're not allowing non-manifold, assert we don't have any
-    
-    if ( false == m_allow_non_manifold )
-    {
-        // check for edges incident on more than 2 triangles
-        
-        for ( size_t i = 0; i < m_mesh.m_edge_to_triangle_map.size(); ++i )
-        {
-            if ( m_mesh.edge_is_deleted(i) ) { continue; }
-            assert( m_mesh.m_edge_to_triangle_map[i].size() == 1 ||
-                   m_mesh.m_edge_to_triangle_map[i].size() == 2 );
-        }
-        
-        triangle_indices.clear();
-        return;
-    }
-    
-    for ( size_t j = 0; j < triangle_indices.size(); ++j )      
-    {
-        size_t i = triangle_indices[j];
-        
-        const Vec3st& current_triangle = m_mesh.get_triangle(i);
-        
-        if ( (current_triangle[0] == 0) && (current_triangle[1] == 0) && (current_triangle[2] == 0) ) 
-        {
-            continue;
-        }
-        
-        //
-        // look for triangles with repeated vertices
-        //
-        if (    (current_triangle[0] == current_triangle[1])
-            || (current_triangle[1] == current_triangle[2]) 
-            || (current_triangle[2] == current_triangle[0]) )
-        {
-            
-            if ( m_verbose ) { std::cout << "deleting degenerate triangle " << i << ": " << current_triangle << std::endl; }
-            
-            // delete it
-            remove_triangle( i );
-            
-            continue;
-        }
-        
-        
-        //
-        // look for flaps
-        //
-        const Vec3st& tri_edges = m_mesh.m_triangle_to_edge_map[i];
-        
-        bool flap_found = false;
-        
-        for ( unsigned int e = 0; e < 3 && flap_found == false; ++e )
-        {
-            const std::vector<size_t>& edge_tris = m_mesh.m_edge_to_triangle_map[ tri_edges[e] ];
-            
-            for ( size_t t = 0; t < edge_tris.size(); ++t )
-            {
-                if ( edge_tris[t] == i )
-                {
-                    continue;
-                }
-                
-                size_t other_triangle_index = edge_tris[t];
-                const Vec3st& other_triangle = m_mesh.get_triangle( other_triangle_index );
-                
-                if (    (other_triangle[0] == other_triangle[1]) 
-                    || (other_triangle[1] == other_triangle[2]) 
-                    || (other_triangle[2] == other_triangle[0]) ) 
-                {
-                    continue;
-                }
-                
-                if ( ((current_triangle[0] == other_triangle[0]) || (current_triangle[0] == other_triangle[1]) || (current_triangle[0] == other_triangle[2])) &&
-                    ((current_triangle[1] == other_triangle[0]) || (current_triangle[1] == other_triangle[1]) || (current_triangle[1] == other_triangle[2])) &&
-                    ((current_triangle[2] == other_triangle[0]) || (current_triangle[2] == other_triangle[1]) || (current_triangle[2] == other_triangle[2])) ) 
-                {
-                    
-                    if ( false == m_allow_topology_changes )
-                    {
-                        std::cout << "flap found while topology changes disallowed" << std::endl;
-                        std::cout << current_triangle << std::endl;
-                        std::cout << other_triangle << std::endl;
-                        assert(0);
-                    }
-                    
-                    size_t common_edge = tri_edges[e];
-                    if ( m_mesh.oriented( m_mesh.m_edges[common_edge][0], m_mesh.m_edges[common_edge][1], current_triangle ) == 
-                        m_mesh.oriented( m_mesh.m_edges[common_edge][0], m_mesh.m_edges[common_edge][1], other_triangle ) )
-                    {
-                        continue;
-                    }
-                    
-                    // the dangling vertex will be safely removed by the vertex cleanup function
-                    
-                    // delete the triangle
-                    
-                    if ( m_verbose )
-                    {
-                        std::cout << "flap: triangles << " << i << " [" << current_triangle << 
-                        "] and " << edge_tris[t] << " [" << other_triangle << "]" << std::endl;
-                    }
-                    
-                    remove_triangle( i );
-                    
-                    // delete its opposite
-                    
-                    remove_triangle( other_triangle_index );
-                    
-                    flap_found = true;
-                    break;
-                }
-                
-            }
-            
-        }
-        
-    }
-    
-    triangle_indices.clear();
-    
-}
-
-// --------------------------------------------------------
-///
-/// One pass: split long edges, flip non-delaunay edges, collapse short edges, null-space smoothing
-///
-// --------------------------------------------------------
-
-void SurfTrack::improve_mesh( )
-{     
-    
-    if ( m_perform_improvement )
-    {
-        
-        // edge splitting
-        while ( m_splitter.split_pass() ) {}
-        
-        // edge flipping
-        m_flipper.flip_pass();		
-        
-        // edge collapsing
-        while ( m_collapser.collapse_pass() ) {}
-        
-        // null-space smoothing
-        if ( m_allow_vertex_movement )
-        {
-            m_smoother.null_space_smoothing_pass( 1.0 );
-        }
-        
-        if ( m_collision_safety )
-        {
-            assert_mesh_is_intersection_free( false );
-        }      
-    }
-    
-}
-
-// --------------------------------------------------------
-///
-/// Perform a pass of merge attempts
-///
-// --------------------------------------------------------
-
-void SurfTrack::topology_changes( )
-{
-    
-    if ( false == m_allow_topology_changes )
-    {
-        return;
-    }
-    
-    bool merge_occurred = true;
-    while ( merge_occurred )
-    {
-        
-        merge_occurred = m_merger.merge_pass();
-        
-        m_pincher.separate_singular_vertices();
-        
-        if ( m_collision_safety )
-        {
-            assert_mesh_is_intersection_free( false );
-        }
-    }      
-    
-}
-
-
-
-
diff --git a/extern/eltopo/eltopo3d/surftrack.h b/extern/eltopo/eltopo3d/surftrack.h
deleted file mode 100644
index 70ecdbc..0000000
--- a/extern/eltopo/eltopo3d/surftrack.h
+++ /dev/null
@@ -1,479 +0,0 @@
-// ---------------------------------------------------------
-//
-//  surftrack.h
-//  Tyson Brochu 2008
-//  
-//  The SurfTrack class: a dynamic mesh with topological changes and mesh maintenance operations.
-//
-// ---------------------------------------------------------
-
-#ifndef EL_TOPO_SURFTRACK_H
-#define EL_TOPO_SURFTRACK_H
-
-#include <dynamicsurface.h>
-#include <edgecollapser.h>
-#include <edgeflipper.h>
-#include <edgesplitter.h>
-#include <meshmerger.h>
-#include <meshpincher.h>
-#include <meshsmoother.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SubdivisionScheme;
-typedef std::vector<size_t> TriangleSet;
-
-// ---------------------------------------------------------
-//  Class definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Structure for setting up a SurfTrack object with some initial parameters.  This is passed to the SurfTrack constructor.
-///
-// ---------------------------------------------------------
-
-struct SurfTrackInitializationParameters
-{
-    
-    ///  Constructor. Sets default values for parameters which are not likely to be specified.
-    ///
-    SurfTrackInitializationParameters();
-    
-    /// Elements closer than this are considered "near" (or proximate)
-    ///
-    double m_proximity_epsilon;
-    
-    /// Coefficient of friction to apply during collisions
-    ///
-    double m_friction_coefficient;
-    
-    /// Smallest triangle area to allow
-    ///
-    double m_min_triangle_area;
-    
-    /// Collision epsilon to use during mesh improvment operations (i.e. if any mesh elements are closer than this, the operation is 
-    /// aborted).  NOTE: This should be greater than collision_epsilon, to prevent improvement operations from moving elements into 
-    /// a collision configuration.
-    ///
-    double m_improve_collision_epsilon;
-    
-    /// Whether to set the min and max edge lengths as fractions of the initial average edge length
-    ///
-    bool m_use_fraction;
-    
-    // If use_fraction is true, the following three values are taken to be fractions of the average edge length of the new surface.
-    // If use_fraction is false, these are absolute.
-    
-    /// Smallest edge length allowed
-    ///
-    double m_min_edge_length;
-    
-    /// Longest edge length allowed
-    ///
-    double m_max_edge_length; 
-    
-    /// Maximum change in volume allowed for one operation
-    ///
-    double m_max_volume_change;
-    
-    /// Smallest interior angle at a triangle vertex allowed
-    ///
-    double m_min_triangle_angle;
-    
-    /// Largest interior angle at a triangle vertex allowed
-    ///
-    double m_max_triangle_angle;   
-    
-    /// Whether to scale by curvature when computing edge lengths, in order to refine high-curvature regions
-    ///
-    bool m_use_curvature_when_splitting;
-
-    /// Whether to scale by curvature when computing edge lengths, in order to coarsen low-curvature regions
-    ///
-    bool m_use_curvature_when_collapsing;
-    
-    /// The minimum curvature scaling allowed
-    ///
-    double m_min_curvature_multiplier;
-    
-    /// The maximum curvature scaling allowed
-    ///
-    double m_max_curvature_multiplier;
-    
-    /// Whether to allow vertices to move during improvement
-    ///
-    bool m_allow_vertex_movement;
-    
-    /// Minimum edge length improvement in order to flip an edge
-    //
-    double m_edge_flip_min_length_change;
-    
-    /// Elements within this distance will trigger a merge attempt   
-    ///
-    double m_merge_proximity_epsilon;
-    
-    /// Type of subdivision to use when collapsing or splitting (butterfly, quadric error minimization, etc.)
-    ///
-    SubdivisionScheme *m_subdivision_scheme;   
-    
-    /// Whether to enforce collision-free surfaces (including during mesh maintenance operations)
-    ///
-    bool m_collision_safety;
-    
-    /// Whether to allow changes in topology
-    ///
-    bool m_allow_topology_changes;
-    
-    /// Whether to allow non-manifold (edges incident on more than two triangles)
-    ///
-    bool m_allow_non_manifold;
-    
-    /// Whether to allow mesh improvement
-    ///
-    bool m_perform_improvement;
-    
-};
-
-// ---------------------------------------------------------
-///
-/// Used to build a list of edges sorted in order of increasing length.
-/// 
-// ---------------------------------------------------------
-
-struct SortableEdge
-{    
-    /// Constructor
-    ///
-    SortableEdge( size_t ei, double el ) : 
-    m_edge_index(ei), 
-    m_edge_length(el) 
-    {}
-    
-    /// Comparison operator for sorting
-    ///
-    bool operator<( const SortableEdge& other ) const
-    {
-        return (this->m_edge_length < other.m_edge_length);
-    }
-    
-    /// The index of the edge
-    ///
-    size_t m_edge_index;
-    
-    /// The stored edge length
-    ///
-    double m_edge_length;
-
-};
-
-
-// ---------------------------------------------------------
-///
-/// Keeps track of a vertex removal or addition.  If it's an addition, it also points to the edge that was split to create it.
-///
-// ---------------------------------------------------------
-
-struct VertexUpdateEvent
-{
-    /// Constructor
-    ///
-    VertexUpdateEvent(bool is_remove = false, 
-                      size_t vertex_index = (size_t)~0, 
-                      const Vec2st& split_edge = Vec2st((size_t)~0) ) :
-    m_is_remove( is_remove ),
-    m_vertex_index( vertex_index ),
-    m_split_edge( split_edge )
-    {}
-    
-    /// Tag for identifying a vertex removal
-    ///
-    static const bool VERTEX_REMOVE = true;
-    
-    /// Tag for identifying a vertex addition
-    ///
-    static const bool VERTEX_ADD = false;
-    
-    /// Wether this event is a vertex removal
-    ///
-    bool m_is_remove;
-    
-    /// The index of the vertex being added or removed
-    ///
-    size_t m_vertex_index;   
-    
-    /// If this is a vertex addition due to edge splitting, the edge that was split
-    ///
-    Vec2st m_split_edge;
-    
-};
-
-
-// ---------------------------------------------------------
-///
-/// Keeps track of a triangle removal or addition. If addition, contains the three vertices that form the new triangle.
-///
-// ---------------------------------------------------------
-
-struct TriangleUpdateEvent
-{
-    /// Constructor
-    ///
-    TriangleUpdateEvent(bool is_remove = false, 
-                        size_t triangle_index = (size_t)~0, 
-                        const Vec3st& triangle = Vec3st((size_t)~0) ) :
-    m_is_remove( is_remove ),
-    m_triangle_index( triangle_index ),
-    m_tri( triangle )
-    {}
-    
-    /// Tag for identifying a triangle removal
-    ///
-    static const bool TRIANGLE_REMOVE = true;
-    
-    /// Tag for identifying a triangle addition
-    ///
-    static const bool TRIANGLE_ADD = false;
-    
-    /// Wether this event is a triangle removal
-    ///
-    bool m_is_remove;
-    
-    /// The index of the triangle being added or removed
-    ///
-    size_t m_triangle_index;  
-    
-    /// If this is a triangle addition, the triangle added
-    ///
-    Vec3st m_tri;
-    
-};
-
-
-// ---------------------------------------------------------
-///
-/// A DynamicSurface with topological and mesh maintenance operations.
-///
-// ---------------------------------------------------------
-
-class SurfTrack : public DynamicSurface
-{
-    
-public:
-    
-    /// Create a SurfTrack object from a set of vertices and triangles using the specified paramaters
-    ///
-    SurfTrack(const std::vector<Vec3d>& vs, 
-              const std::vector<Vec3st>& ts, 
-              const std::vector<double>& masses,
-              const SurfTrackInitializationParameters& initial_parameters );
-    
-    /// Destructor
-    ///
-    ~SurfTrack();
-    
-private:
-    
-    /// Disallow copying and assignment by declaring private
-    ///
-    SurfTrack( const SurfTrack& );
-    
-    /// Disallow copying and assignment by declaring private
-    ///
-    SurfTrack& operator=( const SurfTrack& );
-    
-    
-public:
-    
-    //
-    // Mesh bookkeeping
-    //
-    
-    /// Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid. 
-    ///
-    size_t add_triangle(const Vec3st& t);
-    
-    /// Remove a triangle from the surface.  Update the underlying TriMesh and acceleration grid. 
-    ///
-    void remove_triangle(size_t t);  
-    
-    /// Add a vertex to the surface.  Update the acceleration grid. 
-    ///
-    size_t add_vertex( const Vec3d& new_vertex_position, double new_vertex_mass );
-    
-    /// Remove a vertex from the surface.  Update the acceleration grid. 
-    ///
-    void remove_vertex(size_t v);
-    
-    /// Remove deleted vertices and triangles from the mesh data structures
-    ///
-    void defrag_mesh();
-
-    //
-    // Main operations
-    //
-    
-    /// Run mesh maintenance operations
-    ///
-    void improve_mesh( );
-    
-    /// Run edge-edge merging
-    ///
-    void topology_changes( );
-    
-    //
-    // Mesh cleanup
-    //
-    
-    /// Check for and delete flaps and zero-area triangles among the given triangle indices, then separate singular vertices.
-    ///
-    void trim_non_manifold( std::vector<size_t>& triangle_indices );
-    
-    /// Check for and delete flaps and zero-area triangles among *all* triangles, then separate singular vertices.
-    ///
-    inline void trim_non_manifold();
-    
-    /// Fire an assert if any degenerate triangles or tets (flaps) are found.
-    /// 
-    void assert_no_degenerate_triangles();
-    
-    //
-    // Member variables
-    //
-    
-    /// Edge collapse operation object
-    ///
-    EdgeCollapser m_collapser;
-    
-    /// Edge split operation object
-    ///
-    EdgeSplitter m_splitter;
-    
-    /// Edge flip operation object
-    ///
-    EdgeFlipper m_flipper;
-    
-    /// NULL-space surface smoothing
-    /// 
-    MeshSmoother m_smoother;
-    
-    /// Surface merging object
-    ///
-    MeshMerger m_merger;
-    
-    /// Surface splitting operation object
-    ///
-    MeshPincher m_pincher;
-    
-    /// Collision epsilon to use during mesh improvment operations
-    ///
-    double m_improve_collision_epsilon;
-    
-    /// Minimum edge length improvement in order to flip an edge
-    ///
-    double m_edge_flip_min_length_change;
-    
-    /// Maximum volume change allowed when flipping or collapsing an edge
-    ///
-    double m_max_volume_change;
-    
-    /// Mimimum edge length.  Edges shorter than this will be collapsed.
-    ///
-    double m_min_edge_length;   
-    
-    /// Maximum edge length.  Edges longer than this will be subdivided.
-    ///
-    double m_max_edge_length;   
-    
-    /// Elements within this distance will trigger a merge attempt
-    ///
-    double m_merge_proximity_epsilon;
-    
-    /// Try to prevent triangles with area less than this
-    ///
-    double m_min_triangle_area;
-    
-    /// Don't create triangles with angles less than this.  If angles less than this do exist, try to remove them.
-    ///
-    double m_min_triangle_angle;
-    
-    /// Don't create triangles with angles greater than this.  If angles greater than this do exist, try to remove them.
-    ///
-    double m_max_triangle_angle;
-    
-    /// Interpolation scheme, determines edge midpoint location
-    ///
-    SubdivisionScheme *m_subdivision_scheme;
-    
-    /// If we allocate our own SubdivisionScheme object, we must delete it in this object's deconstructor.
-    ///
-    bool should_delete_subdivision_scheme_object;
-    
-    /// Triangles which are involved in connectivity changes which may introduce degeneracies
-    ///
-    std::vector<size_t> m_dirty_triangles;
-    
-    /// Whether to allow merging and separation
-    ///
-    bool m_allow_topology_changes;
-    
-    /// Whether to allow non-manifold (edges incident on more than two triangles)
-    ///
-    bool m_allow_non_manifold;
-    
-    /// Whether to perform adaptivity operations
-    ///
-    bool m_perform_improvement;
-    
-    /// When doing mesh optimization, whether to allow the vertices to move.  If set to false, we allow edge flipping, edge 
-    /// splitting, and edge collapsing (where the edge is collapsed down to one of its endpoints).  If true, we do mesh smoothing,
-    /// as well as allowing a collapsed edge to collapse down to some point other than an endpoint.
-    ///
-    bool m_allow_vertex_movement;
-        
-    /// History of vertex removal or addition events
-    ///
-    std::vector<VertexUpdateEvent> m_vertex_change_history;
-    
-    /// History of triangle removal or addition events
-    ///    
-    std::vector<TriangleUpdateEvent> m_triangle_change_history;
-    
-    /// Map of triangle indices, mapping pre-defrag triangle indices to post-defrag indices
-    ///
-    std::vector<Vec2st> m_defragged_triangle_map;
-    
-    /// Map of vertex indices, mapping pre-defrag vertex indices to post-defrag indices
-    ///
-    std::vector<Vec2st> m_defragged_vertex_map;
-    
-};
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Search the entire mesh for non-manifold elements and remove them
-/// NOTE: SHOULD USE THE VERSION THAT ACCEPTS A SET OF TRIANGLE INDICES INSTEAD.
-///
-// ---------------------------------------------------------
-
-inline void SurfTrack::trim_non_manifold()
-{
-    
-    std::vector<size_t> triangle_indices;
-    triangle_indices.resize( m_mesh.num_triangles() );
-    for ( size_t i = 0; i < triangle_indices.size(); ++i )
-    {
-        triangle_indices[i] = i;
-    }
-    
-    trim_non_manifold( triangle_indices );
-}
-
-#endif
-
diff --git a/extern/eltopo/eltopo3d/trianglequality.cpp b/extern/eltopo/eltopo3d/trianglequality.cpp
deleted file mode 100644
index 768b102..0000000
--- a/extern/eltopo/eltopo3d/trianglequality.cpp
+++ /dev/null
@@ -1,494 +0,0 @@
-// ---------------------------------------------------------
-//
-//  trianglequality.cpp
-//  Tyson Brochu 2011
-//  
-//  Functions for getting various triangle mesh measures.
-//
-// ---------------------------------------------------------
-
-#include <trianglequality.h>
-#include <limits>
-#include <surftrack.h>
-
-
-// ---------------------------------------------------------
-///
-/// Determine the "mixed" voronoi and barycentric area of the vertex within the given triangle.
-///
-// ---------------------------------------------------------
-
-double mixed_area( size_t vertex_index, size_t triangle_index, const SurfTrack& surf )
-{
-    const Vec3st& tri = surf.m_mesh.get_triangle(triangle_index);
-    
-    Vec2st opposite_edge;
-    if ( vertex_index == tri[0] )
-    {
-        opposite_edge = Vec2st( tri[1], tri[2] );
-    }
-    else if ( vertex_index == tri[1] )
-    {
-        opposite_edge = Vec2st( tri[2], tri[0] );
-    }
-    else
-    {
-        opposite_edge = Vec2st( tri[0], tri[1] );
-    }
-    
-    const Vec3d& a = surf.get_position(vertex_index);
-    const Vec3d& b = surf.get_position(opposite_edge[0]);
-    const Vec3d& c = surf.get_position(opposite_edge[1]);
-    
-    bool obtuse_triangle = ( ( dot(b-a, c-a) < 0.0 ) || ( dot(a-b, c-b) < 0.0 ) || ( dot(a-c, b-c) < 0.0 ) );
-    
-    if ( obtuse_triangle )
-    {
-        //std::cout << "obtuse_triangle " << triangle_index << ": " << tri << std::endl;
-        
-        if ( dot(b-a, c-a) < 0.0 )
-        {
-            // obtuse at a
-            return 0.5 * surf.get_triangle_area( triangle_index );
-        }
-        else
-        {
-            // obtuse somewhere else
-            return 0.25 * surf.get_triangle_area( triangle_index );
-        }
-    }
-    else
-    {
-        // not obtuse, use voronoi area
-        
-        double cross_c = mag( cross( a-c, b-c ) );      
-        double cot_c = dot( a-c, b-c) / cross_c;      
-        
-        double cross_b = mag( cross( a-b, c-b ) );      
-        double cot_b = dot( a-b, c-b) / cross_b;      
-        
-        return 1.0 / 8.0 * (mag2(b-a) * cot_c + mag2(c-a) * cot_b);
-    }
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Get Kappa * n, the surface normal multiplied by mean curvature at the specified vertex.
-///
-// ---------------------------------------------------------
-
-void vertex_mean_curvature_normal( size_t vertex_index, const SurfTrack& surf, Vec3d& out, double& weight_sum )
-{
-    Vec3d mean_curvature_normal( 0, 0, 0 );
-    weight_sum = 0;
-    
-    double edge_length_sum = 0.0;
-    
-    for ( size_t i = 0; i < surf.m_mesh.m_vertex_to_edge_map[vertex_index].size(); ++i )
-    {
-        size_t e = surf.m_mesh.m_vertex_to_edge_map[vertex_index][i];
-        const Vec2st& curr_edge = surf.m_mesh.m_edges[e];
-        Vec3d edge_vector;
-        if ( curr_edge[0] == vertex_index )
-        {
-            edge_vector = surf.get_position( curr_edge[1] ) - surf.get_position( vertex_index );
-        }
-        else
-        {
-            assert( curr_edge[1] == vertex_index );
-            edge_vector = surf.get_position( curr_edge[0] ) - surf.get_position( vertex_index );
-        }
-        
-        edge_length_sum += mag( edge_vector );
-        
-        if ( surf.m_mesh.m_edge_to_triangle_map[e].size() != 2 )
-        {
-            // TODO: properly handle more than 2 incident triangles
-            out = Vec3d(0,0,0);
-            return;
-        }
-        
-        size_t tri0 = surf.m_mesh.m_edge_to_triangle_map[e][0];
-        size_t tri1 = surf.m_mesh.m_edge_to_triangle_map[e][1];
-        
-        size_t third_vertex_0 = surf.m_mesh.get_third_vertex( curr_edge[0], curr_edge[1], surf.m_mesh.get_triangle(tri0) );
-        size_t third_vertex_1 = surf.m_mesh.get_third_vertex( curr_edge[0], curr_edge[1], surf.m_mesh.get_triangle(tri1) );
-        
-        Vec3d v00 = surf.get_position( curr_edge[0] ) - surf.get_position( third_vertex_0 );
-        Vec3d v10 = surf.get_position( curr_edge[1] ) - surf.get_position( third_vertex_0 );
-        
-        double cross_0 = mag( cross( v00, v10 ) );
-        if ( cross_0 < 1e-10 )
-        {
-            continue;
-        }
-        double cot_0 = dot(v00, v10) / cross_0;
-        
-        Vec3d v01 = surf.get_position( curr_edge[0] ) - surf.get_position( third_vertex_1 );
-        Vec3d v11 = surf.get_position( curr_edge[1] ) - surf.get_position( third_vertex_1 );
-        
-        double cross_1 = mag( cross( v01, v11 ) );
-        if ( cross_1 < 1e-10 )
-        {
-            continue;
-        }
-        
-        double cot_1 = dot(v01, v11) / cross_1;
-        
-        double weight = cot_0 + cot_1;
-        weight_sum += weight;
-        
-        mean_curvature_normal += weight * edge_vector;
-        
-    }
-    
-    double vertex_area = 0.0;
-    for ( size_t i = 0; i < surf.m_mesh.m_vertex_to_triangle_map[vertex_index].size(); ++i )
-    {
-        vertex_area += mixed_area( vertex_index, surf.m_mesh.m_vertex_to_triangle_map[vertex_index][i], surf );
-    }
-    
-    double coeff = 1.0 / (2.0 * vertex_area);
-    
-    weight_sum *= coeff;
-    
-    out = coeff * mean_curvature_normal;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Return an estimate for mean curvature at the given vertex, computed using the Kappa * n estimate above.
-///
-// ---------------------------------------------------------
-
-double unsigned_vertex_mean_curvature( size_t vertex_index, const SurfTrack& surf )
-{
-    Vec3d mc_normal;
-    double weight_sum;
-    
-    vertex_mean_curvature_normal( vertex_index, surf, mc_normal, weight_sum );
-    
-    return mag( mc_normal );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Return an estimate for curvature by computing the minimum radius of a sphere defined by the edge neighbourhood around a vertex,
-/// and taking the reciprocal.
-///
-// ---------------------------------------------------------
-
-double inv_min_radius_curvature( const SurfTrack& surf, size_t vertex )
-{
-    
-    Vec3d normal = surf.get_vertex_normal( vertex );
-    
-    //   double min_radius = BIG_DOUBLE;
-    
-    double inv_min_radius = -BIG_DOUBLE;
-    
-    for ( size_t i = 0; i < surf.m_mesh.m_vertex_to_edge_map[vertex].size(); ++i )
-    {
-        size_t edge_index = surf.m_mesh.m_vertex_to_edge_map[vertex][i];
-        
-        assert( edge_index < surf.m_mesh.m_edges.size() );
-        
-        const Vec2st& edge = surf.m_mesh.m_edges[ edge_index ];
-        
-        Vec3d P;
-        if ( edge[0] == vertex )
-        {
-            P = surf.get_position( edge[1] ) - surf.get_position( vertex );
-        }
-        else
-        {
-            P = surf.get_position( edge[0] ) - surf.get_position( vertex );
-        }
-        
-        //      double radius = 0.5 * dot( P, P ) / dot( normal, P );
-        //      min_radius = min( min_radius, radius );
-        
-        double inv_radius = 2.0 * dot( normal, P ) / dot( P, P );
-        inv_min_radius = max( inv_min_radius, inv_radius );
-        
-    }
-    
-    return inv_min_radius;
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Compute curvatures at all vertices using inv_min_radius_curvature.
-///
-// ---------------------------------------------------------
-
-void compute_vertex_curvatures( const SurfTrack& surf, std::vector<double>& vertex_curvatures )
-{
-    
-    vertex_curvatures.resize( surf.get_num_vertices() );
-    
-    for ( size_t i = 0; i < surf.get_num_vertices(); ++i )
-    {
-        
-        if ( surf.m_mesh.m_is_boundary_vertex[i] ) 
-        { 
-            vertex_curvatures[i] = 1.0;
-            continue; 
-        }
-        
-        vertex_curvatures[i] = inv_min_radius_curvature( surf, i );
-    }   
-}
-
-
-#define USE_INV_MIN_RADIUS
-
-// ---------------------------------------------------------
-///
-/// Get the length of the specified edge, scaled by an estimate of curvature at each of the vertices.
-///
-// ---------------------------------------------------------
-
-double get_curvature_scaled_length(const SurfTrack& surf, 
-                                   size_t vertex_a, 
-                                   size_t vertex_b, 
-                                   double min_curvature_multiplier,
-                                   double max_curvature_multiplier,
-                                   double rest_curvature )
-{
-    
-    assert( vertex_a < surf.get_num_vertices() );
-    assert( vertex_b < surf.get_num_vertices() );
-    
-    double length = dist(  surf.get_position( vertex_a ), surf.get_position( vertex_b ) );
-    
-    
-#ifdef USE_INV_MIN_RADIUS
-    double curv_a = std::fabs( inv_min_radius_curvature( surf, vertex_a ) );
-#else
-    double curv_a = unsigned_vertex_mean_curvature( vertex_a, surf );
-#endif
-    
-    curv_a /= rest_curvature;
-    curv_a = std::max( min_curvature_multiplier, curv_a );
-    curv_a = std::min( max_curvature_multiplier, curv_a );
-    
-#ifdef USE_INV_MIN_RADIUS
-    double curv_b = std::fabs( inv_min_radius_curvature( surf, vertex_b ) );
-#else
-    double curv_b = unsigned_vertex_mean_curvature( vertex_b, m_surf );
-#endif
-    
-    curv_b /= rest_curvature;
-    curv_b = std::max( min_curvature_multiplier, curv_b );
-    curv_b = std::min( max_curvature_multiplier, curv_b );
-    
-    length *= 0.5 * ( curv_a + curv_b );
-    
-    return length;
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Return the minimun triangle area in the specified surface.
-///
-// ---------------------------------------------------------
-
-double min_triangle_area( const SurfTrack& surf )
-{
-    double min_area = BIG_DOUBLE;
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        if ( surf.m_mesh.triangle_is_deleted(i) ) { continue; }
-        if ( surf.triangle_is_solid(i) ) { continue; }
-        
-        double area = surf.get_triangle_area(i);
-        min_area = std::min( area, min_area );
-    }
-    
-    return min_area;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Return the minimun triangle angle in the specified surface.
-///
-// ---------------------------------------------------------
-
-double min_triangle_angle( const SurfTrack& surf )
-{
-    double min_angle = BIG_DOUBLE;
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        if ( surf.m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        const Vec3d& a = surf.get_position( surf.m_mesh.get_triangle(i)[0] );
-        const Vec3d& b = surf.get_position( surf.m_mesh.get_triangle(i)[1] );
-        const Vec3d& c = surf.get_position( surf.m_mesh.get_triangle(i)[2] );
-        
-        double curr_min_angle = min_triangle_angle( a, b, c );
-        
-        min_angle = std::min( curr_min_angle, min_angle );
-    }
-    
-    return min_angle;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Return the maximum triangle angle in the specified surface.
-///
-// ---------------------------------------------------------
-
-double max_triangle_angle( const SurfTrack& surf )
-{
-    double max_angle = -BIG_DOUBLE;
-    
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        if ( surf.m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        const Vec3d& a = surf.get_position( surf.m_mesh.get_triangle(i)[0] );
-        const Vec3d& b = surf.get_position( surf.m_mesh.get_triangle(i)[1] );
-        const Vec3d& c = surf.get_position( surf.m_mesh.get_triangle(i)[2] );
-        
-        double curr_max_angle = max_triangle_angle( a, b, c );
-        
-        max_angle = std::max( curr_max_angle, max_angle );
-    }
-    
-    return max_angle;
-}   
-
-
-// ---------------------------------------------------------
-///
-/// Count the number of triangle angles below the given threshold.
-///
-// ---------------------------------------------------------
-
-size_t num_angles_below_threshold( const SurfTrack& surf, double low_threshold )
-{
-    size_t num_small_angles = 0;
-    
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        if ( surf.m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        const Vec3d& a = surf.get_position( surf.m_mesh.get_triangle(i)[0] );
-        const Vec3d& b = surf.get_position( surf.m_mesh.get_triangle(i)[1] );
-        const Vec3d& c = surf.get_position( surf.m_mesh.get_triangle(i)[2] );
-        
-        double angle_a, angle_b, angle_c;
-        triangle_angles( a, b, c, angle_a, angle_b, angle_c );
-        
-        if ( angle_a < low_threshold ) { ++num_small_angles; }
-        if ( angle_b < low_threshold ) { ++num_small_angles; }
-        if ( angle_c < low_threshold ) { ++num_small_angles; }
-    }
-    
-    return num_small_angles;
-    
-}
-
-// ---------------------------------------------------------
-///
-/// Count the number of triangle angles above the given threshold.
-///
-// ---------------------------------------------------------
-
-size_t num_angles_above_threshold( const SurfTrack& surf, double high_threshold )
-{
-    size_t num_large_angles = 0;
-    
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        if ( surf.m_mesh.triangle_is_deleted(i) ) { continue; }
-        
-        const Vec3d& a = surf.get_position( surf.m_mesh.get_triangle(i)[0] );
-        const Vec3d& b = surf.get_position( surf.m_mesh.get_triangle(i)[1] );
-        const Vec3d& c = surf.get_position( surf.m_mesh.get_triangle(i)[2] );
-        
-        double angle_a, angle_b, angle_c;
-        triangle_angles( a, b, c, angle_a, angle_b, angle_c );
-        
-        if ( angle_a > high_threshold ) { ++num_large_angles; }
-        if ( angle_b > high_threshold ) { ++num_large_angles; }
-        if ( angle_c > high_threshold ) { ++num_large_angles; }
-    }
-    
-    return num_large_angles;
-    
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the aspect ratio of the given triangle
-///
-// ---------------------------------------------------------
-
-double triangle_aspect_ratio( const SurfTrack& surf, size_t triangle_index )
-{
-    const Vec3st& tri = surf.m_mesh.get_triangle(triangle_index);
-    assert( tri[0] != tri[1] );
-    return triangle_aspect_ratio( surf.get_position(tri[0]), surf.get_position(tri[1]), surf.get_position(tri[2]) );   
-}
-
-// ---------------------------------------------------------
-///
-/// Find the smallest triangle aspect ratio in the given mesh
-///
-// ---------------------------------------------------------
-
-double min_triangle_aspect_ratio( const SurfTrack& surf, size_t& output_triangle_index )
-{
-    double min_ratio = std::numeric_limits<double>::max();
-    output_triangle_index = (size_t)~0;
-    
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        double a_ratio = triangle_aspect_ratio( surf, i );
-        if ( a_ratio < min_ratio )
-        {
-            output_triangle_index = i;
-            min_ratio = a_ratio;
-        }
-    }
-    return min_ratio;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Find the greatest triangle aspect ratio in the given mesh
-///
-// ---------------------------------------------------------
-
-double max_triangle_aspect_ratio( const SurfTrack& surf, size_t& output_triangle_index )
-{
-    double max_ratio = -1.0;
-    output_triangle_index = (size_t)~0;
-    
-    for ( size_t i = 0; i < surf.m_mesh.num_triangles(); ++i )
-    {
-        double a_ratio = triangle_aspect_ratio( surf, i );
-        if ( a_ratio > max_ratio )
-        {
-            output_triangle_index = i;
-            max_ratio = a_ratio;
-        }
-    }
-    return max_ratio;
-}
-
diff --git a/extern/eltopo/eltopo3d/trianglequality.h b/extern/eltopo/eltopo3d/trianglequality.h
deleted file mode 100644
index b4c21e1..0000000
--- a/extern/eltopo/eltopo3d/trianglequality.h
+++ /dev/null
@@ -1,231 +0,0 @@
-// ---------------------------------------------------------
-//
-//  trianglequality.h
-//  Tyson Brochu 2011
-//  
-//  Functions for getting various triangle mesh measures.
-//
-// ---------------------------------------------------------
-
-
-#ifndef EL_TOPO_TRIANGLEQUALITY_H
-#define EL_TOPO_TRIANGLEQUALITY_H
-
-#include <vec.h>
-
-// ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-class SurfTrack;
-
-// ---------------------------------------------------------
-//  Function declarations
-// ---------------------------------------------------------
-
-/// Convert radians to degrees
-///
-inline double rad2deg( double radians );
-
-/// Convert degrees to radians
-///
-inline double deg2rad( double degrees );
-
-/// Area of a triangle
-///
-inline double area( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 );
-
-/// Radius of the circle passing through the triangle's three vertices.
-///
-inline double circumcircle_radius( const Vec3d& a, const Vec3d& b, const Vec3d& c );
-
-/// Each angle within the triangle (in radians).
-///
-inline void triangle_angles( const Vec3d& a, const Vec3d& b, const Vec3d& c, 
-                            double& angle_a, double& angle_b, double& angle_c );
-
-/// Minimum angle within the triangle (in radians)
-///
-inline double min_triangle_angle( const Vec3d& a, const Vec3d& b, const Vec3d& c );
-
-/// Maximum angle within the triangle (in radians)
-///
-inline double max_triangle_angle( const Vec3d& a, const Vec3d& b, const Vec3d& c );
-
-/// Return an estimate for mean curvature at the given vertex, computed using the Kappa * n estimate above.
-/// 
-double unsigned_vertex_mean_curvature( size_t vertex_index, const SurfTrack& surf );
-
-/// 1 over the minimum radius of curvature around the given vertex
-///
-double inv_min_radius_curvature( const SurfTrack& surf, size_t vertex );
-
-/// 1 over the minimum radius of curvature around each vertex
-///
-void compute_vertex_curvatures( const SurfTrack& surf, std::vector<double>& vertex_curvatures );
-
-/// Determine the "mixed" voronoi and barycentric area of the vertex within the given triangle.
-///
-double mixed_area( size_t vertex_index, size_t triangle_index, const SurfTrack& surf );
-
-/// Get the length of the specified edge, scaled by an estimate of curvature at each of the vertices.
-///
-double get_curvature_scaled_length(const SurfTrack& surf, 
-                                   size_t vertex_a, 
-                                   size_t vertex_b,
-                                   double min_curvature_multiplier,
-                                   double max_curvature_multiplier,
-                                   double rest_curvature = 2.0 );
-
-/// Get Kappa * n, the surface normal multiplied by mean curvature at the specified vertex.
-///
-void vertex_mean_curvature_normal( size_t vertex_index, const SurfTrack& surf, Vec3d& out, double& weight_sum );
-
-/// Minumum of all triangle areas
-///
-double min_triangle_area( const SurfTrack& surf );
-
-/// Minimum angle in all triangles (in radians)
-///
-double min_triangle_angle( const SurfTrack& surf );
-
-/// Maximum angle in all triangles (in radians)
-///
-double max_triangle_angle( const SurfTrack& surf );
-
-/// Number of angles below the given value (in radians)
-///
-size_t num_angles_below_threshold( const SurfTrack& surf, double low_threshold );
-
-/// Number of angles above the given value (in radians)
-///
-size_t num_angles_above_threshold( const SurfTrack& surf, double high_threshold );
-
-/// Compute the aspect ratio of the given triangle
-///
-double triangle_aspect_ratio( const SurfTrack& surf, size_t triangle_index );
-
-/// Find the smallest triangle aspect ratio in the given mesh
-///
-double min_triangle_aspect_ratio( const SurfTrack& surf, size_t& output_triangle_index );
-
-/// Find the greatest triangle aspect ratio in the given mesh
-///
-double max_triangle_aspect_ratio( const SurfTrack& surf, size_t& output_triangle_index );
-
-
-// ---------------------------------------------------------
-//  Inline functions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-///
-/// Radians to degrees
-///
-// ---------------------------------------------------------
-
-inline double rad2deg( double radians )
-{
-    // d = r * 180 / pi
-    static const double OVER_PI = 1.0 / M_PI;
-    return radians * 180.0 * OVER_PI;
-}
-
-// ---------------------------------------------------------
-///
-/// Degrees to radians
-///
-// ---------------------------------------------------------
-
-inline double deg2rad( double degrees )
-{
-    // r = d * pi / 180
-    static const double OVER_180 = 1.0 / 180.0;
-    return degrees * M_PI * OVER_180;
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the area of the triangle specified by three vertex positions.
-///
-// ---------------------------------------------------------
-
-inline double area( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
-{
-    return 0.5 * mag( cross( v1 - v0, v2 - v0 ) );
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the radius of the circumcircle of the given triangle.
-///
-// ---------------------------------------------------------
-
-inline double circumcircle_radius( const Vec3d& a, const Vec3d& b, const Vec3d& c )
-{
-    return 0.25 * dist(a,b) * dist(b,c) * dist(c,a) / area( a, b, c );
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the interior angles at the vertices of the given triangle.
-///
-// ---------------------------------------------------------
-
-inline void triangle_angles(const Vec3d& a, const Vec3d& b, const Vec3d& c, 
-                            double& angle_a, double& angle_b, double& angle_c )
-{   
-    angle_a = acos( dot( normalized(b-a), normalized(c-a) ) );
-    angle_b = acos( dot( normalized(a-b), normalized(c-b) ) );
-    angle_c = acos( dot( normalized(b-c), normalized(a-c) ) );   
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the minimum "triangle angle", defined as an interior angle at a vertex.
-///
-// ---------------------------------------------------------
-
-inline double min_triangle_angle( const Vec3d& a, const Vec3d& b, const Vec3d& c )
-{
-    double angle_a, angle_b, angle_c;
-    triangle_angles( a, b, c, angle_a, angle_b, angle_c );
-    return min( angle_a, angle_b, angle_c );
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the maximum "triangle angle", defined as an interior angle at a vertex.
-///
-// ---------------------------------------------------------
-
-inline double max_triangle_angle( const Vec3d& a, const Vec3d& b, const Vec3d& c )
-{
-    double angle_a, angle_b, angle_c;
-    triangle_angles( a, b, c, angle_a, angle_b, angle_c );
-    return max( angle_a, angle_b, angle_c );   
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the aspect ratio of the given triangle
-///
-// ---------------------------------------------------------
-
-inline double triangle_aspect_ratio( const Vec3d& a, const Vec3d& b, const Vec3d& c )
-{
-    
-    static const double NORMALIZATION_FACTOR = 6.0 / sqrt(3.0);
-    
-    double len_01 = dist( b, a );
-    double len_12 = dist( c, b );
-    double len_20 = dist( a, c );
-    double max_edge_length = max( len_01, len_12, len_20 );
-    double semiperimeter = 0.5 * ( len_01 + len_12 + len_20 );
-    double tri_area = area( a, b, c );
-    
-    return NORMALIZATION_FACTOR * tri_area / ( semiperimeter * max_edge_length );
-}
-
-#endif
-
diff --git a/extern/eltopo/readme.txt b/extern/eltopo/readme.txt
deleted file mode 100644
index 1927cf4..0000000
--- a/extern/eltopo/readme.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-EL TOPO: ROBUST TOPOLOGICAL OPERATIONS FOR DYNAMIC EXPLICIT SURFACES
-===============================================================================
-
-This distribution contains the following directories:
-
-eltopo3d: the El Topo library
-talpa: an example executable using El Topo
-common: source code shared by our research group used by El Topo and Talpa
-
-For information on building El Topo or Talpa, see the readme files in their
-respective directories.  I highly recommend seeing at least the El Topo readme before getting started.
-
-
-
-Tyson Brochu
-June 30, 2009
-
-
diff --git a/extern/glew/src/glew.c b/extern/glew/src/glew.c
index 5d886ce..833d399 100644
--- a/extern/glew/src/glew.c
+++ b/extern/glew/src/glew.c
@@ -93,7 +93,7 @@ void* dlGetProcAddress (const GLubyte* name)
 #include <string.h>
 #include <AvailabilityMacros.h>
 
-#ifdef MAC_OS_X_VERSION_10_3
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
 
 #include <dlfcn.h>
 
@@ -142,7 +142,7 @@ void* NSGLGetProcAddress (const GLubyte *name)
   return NULL;
 #endif
 }
-#endif /* MAC_OS_X_VERSION_10_3 */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
 #endif /* __APPLE__ */
 
 /*
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 602372f..ebc5953 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -28,14 +28,14 @@
 
 set(INC
 	.
-	../Eigen3
-	third_party/ssba
-	third_party/ldl/Include
 	../colamd/Include
 	third_party/ceres/include
 )
 
 set(INC_SYS
+	../Eigen3
+	third_party/ssba
+	third_party/ldl/Include
 	${PNG_INCLUDE_DIR}
 	${ZLIB_INCLUDE_DIRS}
 )
@@ -102,6 +102,8 @@ set(SRC
 	libmv/multiview/conditioning.h
 	libmv/multiview/euclidean_resection.h
 	libmv/multiview/fundamental.h
+	libmv/multiview/homography.h
+	libmv/multiview/homography_parameterization.h
 	libmv/multiview/nviewtriangulation.h
 	libmv/multiview/projection.h
 	libmv/multiview/resection.h
@@ -131,6 +133,7 @@ set(SRC
 	libmv/tracking/pyramid_region_tracker.h
 	libmv/tracking/region_tracker.h
 	libmv/tracking/retrack_region_tracker.h
+	libmv/tracking/track_region.h
 	libmv/tracking/trklt_region_tracker.h
 
 	third_party/fast/fast.h
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index 3f87750..1e386ec 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -124,14 +124,14 @@ cat > CMakeLists.txt << EOF
 
 set(INC
 	.
-	../Eigen3
-	third_party/ssba
-	third_party/ldl/Include
 	../colamd/Include
 	third_party/ceres/include
 )
 
 set(INC_SYS
+	../Eigen3
+	third_party/ssba
+	third_party/ldl/Include
 	\${PNG_INCLUDE_DIR}
 	\${ZLIB_INCLUDE_DIRS}
 )
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index 0f73234..8e483ab 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -192,7 +192,7 @@ static void imageToFloatBuf(const libmv::FloatImage *image, int channels, float
 }
 
 #if defined(DUMP_FAILURE) || defined (DUMP_ALWAYS)
-void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
+static void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
 {
 	png_infop info_ptr;
 	png_structp png_ptr;
@@ -437,6 +437,9 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
 #endif
 		saveImage("old_patch", old_patch, x1[4], y1[4]);
 		saveImage("new_patch", new_patch, x2[4], y2[4]);
+
+		if (options->image1_mask)
+			saveImage("mask", image1_mask, x2[4], y2[4]);
 	}
 #endif
 
@@ -550,7 +553,8 @@ static void libmv_solveRefineIntrinsics(libmv::Tracks *tracks, libmv::CameraIntr
 }
 
 libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyframe1, int keyframe2,
-			int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
+			int refine_intrinsics, double focal_length, double principal_x, double principal_y,
+			double k1, double k2, double k3, struct libmv_reconstructionOptions *options,
 			reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
 {
 	/* Invert the camera intrinsics. */
@@ -558,6 +562,7 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
 	libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
 	libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
 	libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
+	libmv::ReconstructionOptions reconstruction_options;
 
 	ReconstructUpdateCallback update_callback =
 		ReconstructUpdateCallback(progress_update_callback, callback_customdata);
@@ -566,6 +571,9 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
 	intrinsics->SetPrincipalPoint(principal_x, principal_y);
 	intrinsics->SetRadialDistortion(k1, k2, k3);
 
+	reconstruction_options.success_threshold = options->success_threshold;
+	reconstruction_options.use_fallback_reconstruction = options->use_fallback_reconstruction;
+
 	for (int i = 0; i < markers.size(); ++i) {
 		intrinsics->InvertIntrinsics(markers[i].x,
 			markers[i].y,
@@ -584,7 +592,8 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
 
 	libmv::EuclideanReconstructTwoFrames(keyframe_markers, reconstruction);
 	libmv::EuclideanBundle(normalized_tracks, reconstruction);
-	libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction, &update_callback);
+	libmv::EuclideanCompleteReconstruction(reconstruction_options, normalized_tracks,
+	                                       reconstruction, &update_callback);
 
 	if (refine_intrinsics) {
 		libmv_solveRefineIntrinsics((libmv::Tracks *)tracks, intrinsics, reconstruction,
@@ -891,7 +900,7 @@ void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics *libmvIntrinsics
 		intrinsics->SetFocalLength(focal_length, focal_length);
 
 	if (intrinsics->principal_point_x() != principal_x || intrinsics->principal_point_y() != principal_y)
-		intrinsics->SetFocalLength(focal_length, focal_length);
+		intrinsics->SetPrincipalPoint(principal_x, principal_y);
 
 	if (intrinsics->k1() != k1 || intrinsics->k2() != k2 || intrinsics->k3() != k3)
 		intrinsics->SetRadialDistortion(k1, k2, k3);
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index 5253ba7..e5885e7 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -91,13 +91,20 @@ void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks);
 #define LIBMV_REFINE_RADIAL_DISTORTION_K1 (1<<2)
 #define LIBMV_REFINE_RADIAL_DISTORTION_K2 (1<<4)
 
+/* TODO: make keyframes/distortion model a part of options? */
+struct libmv_reconstructionOptions {
+	double success_threshold;
+	int use_fallback_reconstruction;
+};
+
 typedef void (*reconstruct_progress_update_cb) (void *customdata, double progress, const char *message);
 
 int libmv_refineParametersAreValid(int parameters);
 
 struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2,
 			int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
-			reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
+			struct libmv_reconstructionOptions *options, reconstruct_progress_update_cb progress_update_callback,
+			void *callback_customdata);
 struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
 			double principal_x, double principal_y, double k1, double k2, double k3,
 			reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
diff --git a/extern/libmv/libmv/multiview/euclidean_resection.cc b/extern/libmv/libmv/multiview/euclidean_resection.cc
index 6cad4ca..2605bf0 100644
--- a/extern/libmv/libmv/multiview/euclidean_resection.cc
+++ b/extern/libmv/libmv/multiview/euclidean_resection.cc
@@ -37,13 +37,14 @@ typedef unsigned int uint;
 bool EuclideanResection(const Mat2X &x_camera, 
                         const Mat3X &X_world,
                         Mat3 *R, Vec3 *t,
-                        ResectionMethod method) {
+                        ResectionMethod method,
+                        double success_threshold) {
   switch (method) {
     case RESECTION_ANSAR_DANIILIDIS:
       EuclideanResectionAnsarDaniilidis(x_camera, X_world, R, t);
       break;
     case RESECTION_EPNP:
-      return EuclideanResectionEPnP(x_camera, X_world, R, t);      
+      return EuclideanResectionEPnP(x_camera, X_world, R, t, success_threshold);
       break;
     default:
       LOG(FATAL) << "Unknown resection method.";
@@ -435,8 +436,9 @@ static void ComputePointsCoordinatesInCameraFrame(
 }
 
 bool EuclideanResectionEPnP(const Mat2X &x_camera,
-                            const Mat3X &X_world, 
-                            Mat3 *R, Vec3 *t) {
+                            const Mat3X &X_world,
+                            Mat3 *R, Vec3 *t,
+                            double success_threshold) {
   CHECK(x_camera.cols() == X_world.cols());
   CHECK(x_camera.cols() > 3);
   size_t num_points = X_world.cols();
@@ -544,7 +546,12 @@ bool EuclideanResectionEPnP(const Mat2X &x_camera,
   //
   // TODO(keir): Decide if setting this to infinity, effectively disabling the
   // check, is the right approach. So far this seems the case.
-  double kSuccessThreshold = std::numeric_limits<double>::max();
+  //
+  // TODO(sergey): Made it an option for now, in some cases it makes sense to
+  // still fallback to reprojection solution (see bug [#32765] from Blender bug tracker)
+
+  // double kSuccessThreshold = std::numeric_limits<double>::max();
+  double kSuccessThreshold = success_threshold;
 
   // Find the first possible solution for R, t corresponding to:
   // Betas          = [b00 b01 b11 b02 b12 b22 b03 b13 b23 b33]
diff --git a/extern/libmv/libmv/multiview/euclidean_resection.h b/extern/libmv/libmv/multiview/euclidean_resection.h
index f20513d..b0428ec 100644
--- a/extern/libmv/libmv/multiview/euclidean_resection.h
+++ b/extern/libmv/libmv/multiview/euclidean_resection.h
@@ -45,11 +45,14 @@ enum ResectionMethod {
  * \param R         Solution for the camera rotation matrix
  * \param t         Solution for the camera translation vector
  * \param method    The resection method to use.
+ * \param success_threshold  Threshold of an error which is still considered a success
+ *                           (currently used by EPnP algorithm only)
  */
 bool EuclideanResection(const Mat2X &x_camera, 
                         const Mat3X &X_world,
                         Mat3 *R, Vec3 *t,
-                        ResectionMethod method = RESECTION_EPNP);
+                        ResectionMethod method = RESECTION_EPNP,
+                        double success_threshold = 1e-3);
 
 /**
  * Computes the extrinsic parameters, R and t for a calibrated camera
@@ -110,6 +113,7 @@ void EuclideanResectionAnsarDaniilidis(const Mat2X &x_camera,
  * \param X_world 3D points in the world coordinate system
  * \param R       Solution for the camera rotation matrix
  * \param t       Solution for the camera translation vector
+ * \param success_threshold  Threshold of an error which is still considered a success
  *
  * This is the algorithm described in:
  * "{EP$n$P: An Accurate $O(n)$ Solution to the P$n$P Problem", by V. Lepetit
@@ -118,7 +122,8 @@ void EuclideanResectionAnsarDaniilidis(const Mat2X &x_camera,
  */
 bool EuclideanResectionEPnP(const Mat2X &x_camera,
                             const Mat3X &X_world, 
-                            Mat3 *R, Vec3 *t);
+                            Mat3 *R, Vec3 *t,
+                            double success_threshold = 1e-3);
 
 } // namespace euclidean_resection
 } // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.cc b/extern/libmv/libmv/simple_pipeline/pipeline.cc
index 4773a70..efceda5 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.cc
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.cc
@@ -50,9 +50,10 @@ struct EuclideanPipelineRoutines {
     EuclideanBundle(tracks, reconstruction);
   }
 
-  static bool Resect(const vector<Marker> &markers,
+  static bool Resect(const ReconstructionOptions &options,
+                     const vector<Marker> &markers,
                      EuclideanReconstruction *reconstruction, bool final_pass) {
-    return EuclideanResect(markers, reconstruction, final_pass);
+    return EuclideanResect(options, markers, reconstruction, final_pass);
   }
 
   static bool Intersect(const vector<Marker> &markers,
@@ -88,7 +89,8 @@ struct ProjectivePipelineRoutines {
     ProjectiveBundle(tracks, reconstruction);
   }
 
-  static bool Resect(const vector<Marker> &markers,
+  static bool Resect(const ReconstructionOptions &options,
+                     const vector<Marker> &markers,
                      ProjectiveReconstruction *reconstruction, bool final_pass) {
     return ProjectiveResect(markers, reconstruction);
   }
@@ -136,6 +138,7 @@ static void CompleteReconstructionLogProress(ProgressUpdateCallback *update_call
 
 template<typename PipelineRoutines>
 void InternalCompleteReconstruction(
+    const ReconstructionOptions &options,
     const Tracks &tracks,
     typename PipelineRoutines::Reconstruction *reconstruction,
     ProgressUpdateCallback *update_callback = NULL) {
@@ -204,7 +207,7 @@ void InternalCompleteReconstruction(
       if (reconstructed_markers.size() >= 5) {
         CompleteReconstructionLogProress(update_callback,
                                          (double)tot_resects/(max_image));
-        if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, false)) {
+        if (PipelineRoutines::Resect(options, reconstructed_markers, reconstruction, false)) {
           num_resects++;
           tot_resects++;
           LG << "Ran Resect() for image " << image;
@@ -240,7 +243,7 @@ void InternalCompleteReconstruction(
     if (reconstructed_markers.size() >= 5) {
       CompleteReconstructionLogProress(update_callback,
                                        (double)tot_resects/(max_image));
-      if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, true)) {
+      if (PipelineRoutines::Resect(options, reconstructed_markers, reconstruction, true)) {
         num_resects++;
         LG << "Ran final Resect() for image " << image;
       } else {
@@ -325,17 +328,21 @@ double ProjectiveReprojectionError(
                                                                intrinsics);
 }
 
-void EuclideanCompleteReconstruction(const Tracks &tracks,
+void EuclideanCompleteReconstruction(const ReconstructionOptions &options,
+                                     const Tracks &tracks,
                                      EuclideanReconstruction *reconstruction,
                                      ProgressUpdateCallback *update_callback) {
-  InternalCompleteReconstruction<EuclideanPipelineRoutines>(tracks,
+  InternalCompleteReconstruction<EuclideanPipelineRoutines>(options,
+                                                            tracks,
                                                             reconstruction,
                                                             update_callback);
 }
 
-void ProjectiveCompleteReconstruction(const Tracks &tracks,
+void ProjectiveCompleteReconstruction(const ReconstructionOptions &options,
+                                      const Tracks &tracks,
                                       ProjectiveReconstruction *reconstruction) {
-  InternalCompleteReconstruction<ProjectivePipelineRoutines>(tracks,
+  InternalCompleteReconstruction<ProjectivePipelineRoutines>(options,
+                                                             tracks,
                                                              reconstruction);
 }
 
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.h b/extern/libmv/libmv/simple_pipeline/pipeline.h
index e940b57..11c1129 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.h
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.h
@@ -39,6 +39,9 @@ namespace libmv {
     repeated until all points and cameras are estimated. Periodically, bundle
     adjustment is run to ensure a quality reconstruction.
 
+    \a options are used to define some specific befaviours based on settings
+    see documentation for ReconstructionOptions
+
     \a tracks should contain markers used in the reconstruction.
     \a reconstruction should contain at least some 3D points or some estimated
     cameras. The minimum number of cameras is two (with no 3D points) and the
@@ -46,7 +49,8 @@ namespace libmv {
 
     \sa EuclideanResect, EuclideanIntersect, EuclideanBundle
 */
-void EuclideanCompleteReconstruction(const Tracks &tracks,
+void EuclideanCompleteReconstruction(const ReconstructionOptions &options,
+                                     const Tracks &tracks,
                                      EuclideanReconstruction *reconstruction,
                                      ProgressUpdateCallback *update_callback = NULL);
 
@@ -63,6 +67,9 @@ void EuclideanCompleteReconstruction(const Tracks &tracks,
     repeated until all points and cameras are estimated. Periodically, bundle
     adjustment is run to ensure a quality reconstruction.
 
+    \a options are used to define some specific befaviours based on settings
+    see documentation for ReconstructionOptions
+
     \a tracks should contain markers used in the reconstruction.
     \a reconstruction should contain at least some 3D points or some estimated
     cameras. The minimum number of cameras is two (with no 3D points) and the
@@ -70,7 +77,8 @@ void EuclideanCompleteReconstruction(const Tracks &tracks,
 
     \sa ProjectiveResect, ProjectiveIntersect, ProjectiveBundle
 */
-void ProjectiveCompleteReconstruction(const Tracks &tracks,
+void ProjectiveCompleteReconstruction(const ReconstructionOptions &options,
+                                      const Tracks &tracks,
                                       ProjectiveReconstruction *reconstruction);
 
 
diff --git a/extern/libmv/libmv/simple_pipeline/reconstruction.h b/extern/libmv/libmv/simple_pipeline/reconstruction.h
index 947a063..71789e3 100644
--- a/extern/libmv/libmv/simple_pipeline/reconstruction.h
+++ b/extern/libmv/libmv/simple_pipeline/reconstruction.h
@@ -26,6 +26,17 @@
 
 namespace libmv {
 
+struct ReconstructionOptions {
+	// threshold value of reconstruction error which is still considered successful
+	// if reconstruction error bigger than this value, fallback reconstruction
+	// algorithm would be used (if enabled)
+	double success_threshold;
+
+	// use fallback reconstruction algorithm in cases main reconstruction algorithm
+	// failed to reconstruct
+	bool use_fallback_reconstruction;
+};
+
 /*!
     A EuclideanCamera is the location and rotation of the camera viewing \a image.
 
diff --git a/extern/libmv/libmv/simple_pipeline/resect.cc b/extern/libmv/libmv/simple_pipeline/resect.cc
index 8737182..3929271 100644
--- a/extern/libmv/libmv/simple_pipeline/resect.cc
+++ b/extern/libmv/libmv/simple_pipeline/resect.cc
@@ -57,7 +57,7 @@ struct EuclideanResectCostFunction {
 
   EuclideanResectCostFunction(const vector<Marker> &markers,
                               const EuclideanReconstruction &reconstruction,
-                              const Mat3 initial_R)
+                              const Mat3 &initial_R)
     : markers(markers),
       reconstruction(reconstruction),
       initial_R(initial_R) {}
@@ -90,7 +90,8 @@ struct EuclideanResectCostFunction {
 
 }  // namespace
 
-bool EuclideanResect(const vector<Marker> &markers,
+bool EuclideanResect(const ReconstructionOptions &options,
+                     const vector<Marker> &markers,
                      EuclideanReconstruction *reconstruction, bool final_pass) {
   if (markers.size() < 5) {
     return false;
@@ -104,13 +105,24 @@ bool EuclideanResect(const vector<Marker> &markers,
 
   Mat3 R;
   Vec3 t;
-  if (0 || !euclidean_resection::EuclideanResection(points_2d, points_3d, &R, &t)) {
+
+  double success_threshold = std::numeric_limits<double>::max();
+
+  if(options.use_fallback_reconstruction)
+    success_threshold = options.success_threshold;
+
+  if (0 || !euclidean_resection::EuclideanResection(points_2d, points_3d, &R, &t,
+                                                    euclidean_resection::RESECTION_EPNP,
+                                                    success_threshold))
+  {
     // printf("Resection for image %d failed\n", markers[0].image);
     LG << "Resection for image " << markers[0].image << " failed;"
        << " trying fallback projective resection.";
 
-    LG << "No fallback; failing resection for " << markers[0].image;
-    return false;
+    if (!options.use_fallback_reconstruction) {
+        LG << "No fallback; failing resection for " << markers[0].image;
+        return false;
+    }
 
     if (!final_pass) return false;
     // Euclidean resection failed. Fall back to projective resection, which is
diff --git a/extern/libmv/libmv/simple_pipeline/resect.h b/extern/libmv/libmv/simple_pipeline/resect.h
index f8b5b9f..1691e7e 100644
--- a/extern/libmv/libmv/simple_pipeline/resect.h
+++ b/extern/libmv/libmv/simple_pipeline/resect.h
@@ -35,6 +35,9 @@ namespace libmv {
     reconstruction object, and solves for the pose and orientation of the
     camera for that frame.
 
+    \a options are used to define some specific befaviours based on settings
+    see documentation for ReconstructionOptions
+
     \a markers should contain \l Marker markers \endlink belonging to tracks
     visible in the one frame to be resectioned. Each of the tracks associated
     with the markers must have a corresponding reconstructed 3D position in the
@@ -51,7 +54,8 @@ namespace libmv {
 
     \sa EuclideanIntersect, EuclideanReconstructTwoFrames
 */
-bool EuclideanResect(const vector<Marker> &markers,
+bool EuclideanResect(const ReconstructionOptions &options,
+                     const vector<Marker> &markers,
                      EuclideanReconstruction *reconstruction, bool final_pass);
 
 /*!
diff --git a/extern/libmv/third_party/ceres/CMakeLists.txt b/extern/libmv/third_party/ceres/CMakeLists.txt
index 0ce8e27..e2f06d7 100644
--- a/extern/libmv/third_party/ceres/CMakeLists.txt
+++ b/extern/libmv/third_party/ceres/CMakeLists.txt
@@ -28,13 +28,13 @@
 
 set(INC
 	.
-	../../../Eigen3
 	include
 	internal
 	../gflags
 )
 
 set(INC_SYS
+	../../../Eigen3
 )
 
 set(SRC
diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh
index 902fce5..ccf6d0a 100755
--- a/extern/libmv/third_party/ceres/bundle.sh
+++ b/extern/libmv/third_party/ceres/bundle.sh
@@ -117,13 +117,13 @@ cat > CMakeLists.txt << EOF
 
 set(INC
 	.
-	../../../Eigen3
 	include
 	internal
 	../gflags
 )
 
 set(INC_SYS
+	../../../Eigen3
 )
 
 set(SRC
diff --git a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
index 130c08e..b52da59 100644
--- a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
+++ b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
@@ -1015,7 +1015,7 @@ bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompa
 		maxhh = rcMax(maxhh, ymax-ymin);
 	}
 	
-	hp.data = (unsigned short*)rcAlloc(sizeof(unsigned short)*maxhw*maxhh, RC_ALLOC_TEMP);
+	hp.data = (unsigned short *)rcAlloc(sizeof(unsigned short)*maxhw*maxhh, RC_ALLOC_TEMP);
 	if (!hp.data)
 	{
 		ctx->log(RC_LOG_ERROR, "rcBuildPolyMeshDetail: Out of memory 'hp.data' (%d).", maxhw*maxhh);
diff --git a/extern/xdnd/xdnd.c b/extern/xdnd/xdnd.c
index 9bdee89..50d1fec 100644
--- a/extern/xdnd/xdnd.c
+++ b/extern/xdnd/xdnd.c
@@ -347,7 +347,7 @@ void xdnd_set_dnd_aware (DndClass * dnd, Window window, Atom * typelist)
                     &nchildren_return);
     if (children_return)
         XFree (children_return);
-    if (r)
+    if (r && parent != root_return)
         xdnd_set_dnd_aware (dnd, parent, typelist);
 }
 
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 2551df6..be797c4 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -49,11 +49,6 @@ if(WITH_MOD_SMOKE)
 	add_subdirectory(smoke)
 endif()
 
-if(WITH_MOD_DECIMATE)
-	add_subdirectory(container)
-	add_subdirectory(decimation)
-endif()
-
 if(WITH_MOD_BOOLEAN)
 	add_subdirectory(bsp)
 endif()
@@ -70,6 +65,10 @@ if(WITH_CYCLES)
 	add_subdirectory(cycles)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_subdirectory(locale)
+endif()
+
 # only windows needs utf16 converter
 if(WIN32)
 	add_subdirectory(utfconv)
diff --git a/intern/SConscript b/intern/SConscript
index 3e40ef3..5360ce4 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -6,9 +6,7 @@ SConscript(['audaspace/SConscript',
             'ghost/SConscript',
             'guardedalloc/SConscript',
             'moto/SConscript',
-            'container/SConscript',
             'memutil/SConscript/',
-            'decimation/SConscript',
             'iksolver/SConscript',
             'itasc/SConscript',
             'opencolorio/SConscript',
@@ -17,6 +15,9 @@ SConscript(['audaspace/SConscript',
             'smoke/SConscript',
             'raskter/SConscript'])
 
+# currently only contains headers
+# SConscript('container/SConscript')
+
 if env ['WITH_BF_REMESH']:
     SConscript(['dualcon/SConscript'])
 
@@ -29,6 +30,9 @@ if env['WITH_BF_CYCLES']:
 if env['WITH_BF_BOOLEAN']:
     SConscript(['bsp/SConscript'])
 
+if env['WITH_BF_INTERNATIONAL']:
+    SConscript(['locale/SConscript'])
+
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
     SConscript(['utfconv/SConscript'])
 
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index dc4ca79..91b0549 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -28,11 +28,13 @@ set(INC
 
 set(INC_SYS
 	${PTHREADS_INCLUDE_DIRS}
+	${BOOST_INCLUDE_DIR}
 )
 
 set(SRC
 	FX/AUD_AccumulatorFactory.cpp
 	FX/AUD_BaseIIRFilterReader.cpp
+	FX/AUD_ButterworthCalculator.cpp
 	FX/AUD_ButterworthFactory.cpp
 	FX/AUD_CallbackIIRFilterReader.cpp
 	FX/AUD_DelayFactory.cpp
@@ -46,6 +48,7 @@ set(SRC
 	FX/AUD_EnvelopeFactory.cpp
 	FX/AUD_FaderFactory.cpp
 	FX/AUD_FaderReader.cpp
+	FX/AUD_HighpassCalculator.cpp
 	FX/AUD_HighpassFactory.cpp
 	FX/AUD_IIRFilterFactory.cpp
 	FX/AUD_IIRFilterReader.cpp
@@ -53,6 +56,7 @@ set(SRC
 	FX/AUD_LimiterReader.cpp
 	FX/AUD_LoopFactory.cpp
 	FX/AUD_LoopReader.cpp
+	FX/AUD_LowpassCalculator.cpp
 	FX/AUD_LowpassFactory.cpp
 	FX/AUD_PingPongFactory.cpp
 	FX/AUD_PitchFactory.cpp
@@ -94,6 +98,7 @@ set(SRC
 	intern/AUD_IDevice.h
 	intern/AUD_IFactory.h
 	intern/AUD_IHandle.h
+	intern/AUD_ILockable.h
 	intern/AUD_IReader.h
 	intern/AUD_IWriter.h
 	intern/AUD_JOSResampleFactory.cpp
@@ -108,16 +113,17 @@ set(SRC
 	intern/AUD_Mixer.h
 	intern/AUD_MixerFactory.cpp
 	intern/AUD_MixerFactory.h
+	intern/AUD_MutexLock.h
 	intern/AUD_NULLDevice.cpp
 	intern/AUD_NULLDevice.h
 	intern/AUD_PyInit.h
 	intern/AUD_ReadDevice.cpp
 	intern/AUD_ReadDevice.h
-	intern/AUD_Reference.h
-	intern/AUD_ReferenceHandler.cpp
 	intern/AUD_ResampleFactory.h
 	intern/AUD_ResampleReader.cpp
 	intern/AUD_ResampleReader.h
+	intern/AUD_Sequencer.cpp
+	intern/AUD_Sequencer.h
 	intern/AUD_SequencerEntry.cpp
 	intern/AUD_SequencerEntry.h
 	intern/AUD_SequencerFactory.cpp
@@ -142,12 +148,14 @@ set(SRC
 
 	FX/AUD_AccumulatorFactory.h
 	FX/AUD_BaseIIRFilterReader.h
+	FX/AUD_ButterworthCalculator.h
 	FX/AUD_ButterworthFactory.h
 	FX/AUD_CallbackIIRFilterReader.h
 	FX/AUD_DelayFactory.h
 	FX/AUD_DelayReader.h
 	FX/AUD_DoubleFactory.h
 	FX/AUD_DoubleReader.h
+	FX/AUD_IDynamicIIRFilterCalculator.h
 	FX/AUD_DynamicIIRFilterFactory.h
 	FX/AUD_DynamicIIRFilterReader.h
 	FX/AUD_EffectFactory.h
@@ -155,6 +163,7 @@ set(SRC
 	FX/AUD_EnvelopeFactory.h
 	FX/AUD_FaderFactory.h
 	FX/AUD_FaderReader.h
+	FX/AUD_HighpassCalculator.h
 	FX/AUD_HighpassFactory.h
 	FX/AUD_IIRFilterFactory.h
 	FX/AUD_IIRFilterReader.h
@@ -162,6 +171,7 @@ set(SRC
 	FX/AUD_LimiterReader.h
 	FX/AUD_LoopFactory.h
 	FX/AUD_LoopReader.h
+	FX/AUD_LowpassCalculator.h
 	FX/AUD_LowpassFactory.h
 	FX/AUD_PingPongFactory.h
 	FX/AUD_PitchFactory.h
diff --git a/intern/audaspace/FX/AUD_AccumulatorFactory.cpp b/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
index 1862b9a..00d3a9f 100644
--- a/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
+++ b/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
@@ -50,15 +50,15 @@ sample_t AUD_AccumulatorFactory::accumulatorFilter(AUD_CallbackIIRFilterReader*
 	return out;
 }
 
-AUD_AccumulatorFactory::AUD_AccumulatorFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_AccumulatorFactory::AUD_AccumulatorFactory(boost::shared_ptr<AUD_IFactory> factory,
 											   bool additive) :
 		AUD_EffectFactory(factory),
 		m_additive(additive)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_AccumulatorFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_AccumulatorFactory::createReader()
 {
-	return new AUD_CallbackIIRFilterReader(getReader(), 2, 2,
-							m_additive ? accumulatorFilterAdditive : accumulatorFilter);
+	return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 2, 2,
+							m_additive ? accumulatorFilterAdditive : accumulatorFilter));
 }
diff --git a/intern/audaspace/FX/AUD_AccumulatorFactory.h b/intern/audaspace/FX/AUD_AccumulatorFactory.h
index ac73c5a..9087218 100644
--- a/intern/audaspace/FX/AUD_AccumulatorFactory.h
+++ b/intern/audaspace/FX/AUD_AccumulatorFactory.h
@@ -58,9 +58,9 @@ public:
 	 * \param factory The input factory.
 	 * \param additive Whether the accumulator is additive.
 	 */
-	AUD_AccumulatorFactory(AUD_Reference<AUD_IFactory> factory, bool additive = false);
+	AUD_AccumulatorFactory(boost::shared_ptr<AUD_IFactory> factory, bool additive = false);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 
 	static sample_t accumulatorFilterAdditive(AUD_CallbackIIRFilterReader* reader, void* useless);
 	static sample_t accumulatorFilter(AUD_CallbackIIRFilterReader* reader, void* useless);
diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.cpp b/intern/audaspace/FX/AUD_BandpassCalculator.cpp
new file mode 100644
index 0000000..f5bbd63
--- /dev/null
+++ b/intern/audaspace/FX/AUD_BandpassCalculator.cpp
@@ -0,0 +1,5 @@
+#include "AUD_BandpassCalculator.h"
+
+AUD_BandpassCalculator::AUD_BandpassCalculator()
+{
+}
diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.h b/intern/audaspace/FX/AUD_BandpassCalculator.h
new file mode 100644
index 0000000..b5b3cad
--- /dev/null
+++ b/intern/audaspace/FX/AUD_BandpassCalculator.h
@@ -0,0 +1,10 @@
+#ifndef AUD_BANDPASSCALCULATOR_H
+#define AUD_BANDPASSCALCULATOR_H
+
+class AUD_BandpassCalculator
+{
+public:
+  AUD_BandpassCalculator();
+};
+
+#endif // AUD_BANDPASSCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp b/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp
index fa9e874..eadfc52 100644
--- a/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp
+++ b/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp
@@ -33,7 +33,7 @@
 
 #define CC m_specs.channels + m_channel
 
-AUD_BaseIIRFilterReader::AUD_BaseIIRFilterReader(AUD_Reference<AUD_IReader> reader, int in,
+AUD_BaseIIRFilterReader::AUD_BaseIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in,
 												 int out) :
 		AUD_EffectReader(reader),
 		m_specs(reader->getSpecs()),
diff --git a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h b/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
index 43970c9..fe0a8ef 100644
--- a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
@@ -90,7 +90,7 @@ protected:
 	 * \param in The count of past input samples needed.
 	 * \param out The count of past output samples needed.
 	 */
-	AUD_BaseIIRFilterReader(AUD_Reference<AUD_IReader> reader, int in, int out);
+	AUD_BaseIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in, int out);
 
 	void setLengths(int in, int out);
 
diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.cpp b/intern/audaspace/FX/AUD_ButterworthCalculator.cpp
new file mode 100644
index 0000000..7a3c6f7
--- /dev/null
+++ b/intern/audaspace/FX/AUD_ButterworthCalculator.cpp
@@ -0,0 +1,38 @@
+#include "AUD_ButterworthCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#define BWPB41 0.76536686473
+#define BWPB42 1.84775906502
+
+AUD_ButterworthCalculator::AUD_ButterworthCalculator(float frequency) :
+	m_frequency(frequency)
+{
+}
+
+void AUD_ButterworthCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+	float omega = 2 * tan(m_frequency * M_PI / rate);
+	float o2 = omega * omega;
+	float o4 = o2 * o2;
+	float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f;
+	float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f;
+	float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f;
+	float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f;
+	float o228 = 2.0f * o2 - 8.0f;
+	float norm = x1 * x2;
+	a.push_back(1);
+	a.push_back((x1 + x2) * o228 / norm);
+	a.push_back((x1 * y2 + x2 * y1 + o228 * o228) / norm);
+	a.push_back((y1 + y2) * o228 / norm);
+	a.push_back(y1 * y2 / norm);
+	b.push_back(o4 / norm);
+	b.push_back(4 * o4 / norm);
+	b.push_back(6 * o4 / norm);
+	b.push_back(b[1]);
+	b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.h b/intern/audaspace/FX/AUD_ButterworthCalculator.h
new file mode 100644
index 0000000..a7ae196
--- /dev/null
+++ b/intern/audaspace/FX/AUD_ButterworthCalculator.h
@@ -0,0 +1,20 @@
+#ifndef AUD_BUTTERWORTHCALCULATOR_H
+#define AUD_BUTTERWORTHCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_ButterworthCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+	/**
+	 * The attack value in seconds.
+	 */
+	const float m_frequency;
+
+public:
+	AUD_ButterworthCalculator(float frequency);
+
+	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_BUTTERWORTHCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.cpp b/intern/audaspace/FX/AUD_ButterworthFactory.cpp
index 5edca30..12c4306 100644
--- a/intern/audaspace/FX/AUD_ButterworthFactory.cpp
+++ b/intern/audaspace/FX/AUD_ButterworthFactory.cpp
@@ -29,44 +29,11 @@
 
 #include "AUD_ButterworthFactory.h"
 #include "AUD_IIRFilterReader.h"
+#include "AUD_ButterworthCalculator.h"
 
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define BWPB41 0.76536686473
-#define BWPB42 1.84775906502
-
-AUD_ButterworthFactory::AUD_ButterworthFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_ButterworthFactory::AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory,
 											   float frequency) :
-		AUD_DynamicIIRFilterFactory(factory),
-		m_frequency(frequency)
+		AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_ButterworthCalculator(frequency)))
 {
 }
 
-void AUD_ButterworthFactory::recalculateCoefficients(AUD_SampleRate rate,
-													 std::vector<float> &b,
-													 std::vector<float> &a)
-{
-	float omega = 2 * tan(m_frequency * M_PI / rate);
-	float o2 = omega * omega;
-	float o4 = o2 * o2;
-	float x1 = o2 + 2 * BWPB41 * omega + 4;
-	float x2 = o2 + 2 * BWPB42 * omega + 4;
-	float y1 = o2 - 2 * BWPB41 * omega + 4;
-	float y2 = o2 - 2 * BWPB42 * omega + 4;
-	float o228 = 2 * o2 - 8;
-	float norm = x1 * x2;
-	a.push_back(1);
-	a.push_back((x1 + x2) * o228 / norm);
-	a.push_back((x1 * y2 + x2 * y1 + o228 * o228) / norm);
-	a.push_back((y1 + y2) * o228 / norm);
-	a.push_back(y1 * y2 / norm);
-	b.push_back(o4 / norm);
-	b.push_back(4 * o4 / norm);
-	b.push_back(6 * o4 / norm);
-	b.push_back(b[1]);
-	b.push_back(b[0]);
-}
diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.h b/intern/audaspace/FX/AUD_ButterworthFactory.h
index dc8b4d9..3a86b14 100644
--- a/intern/audaspace/FX/AUD_ButterworthFactory.h
+++ b/intern/audaspace/FX/AUD_ButterworthFactory.h
@@ -38,11 +38,6 @@
 class AUD_ButterworthFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-	/**
-	 * The attack value in seconds.
-	 */
-	const float m_frequency;
-
 	// hide copy constructor and operator=
 	AUD_ButterworthFactory(const AUD_ButterworthFactory&);
 	AUD_ButterworthFactory& operator=(const AUD_ButterworthFactory&);
@@ -53,11 +48,7 @@ public:
 	 * \param factory The input factory.
 	 * \param frequency The cutoff frequency.
 	 */
-	AUD_ButterworthFactory(AUD_Reference<AUD_IFactory> factory, float frequency);
-
-	virtual void recalculateCoefficients(AUD_SampleRate rate,
-	                                     std::vector<float>& b,
-	                                     std::vector<float>& a);
+	AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency);
 };
 
 #endif //__AUD_BUTTERWORTHFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp
index 1a5c99a..b5157d4 100644
--- a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp
+++ b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_CallbackIIRFilterReader.h"
 
-AUD_CallbackIIRFilterReader::AUD_CallbackIIRFilterReader(AUD_Reference<AUD_IReader> reader,
+AUD_CallbackIIRFilterReader::AUD_CallbackIIRFilterReader(boost::shared_ptr<AUD_IReader> reader,
 														 int in, int out,
 														 doFilterIIR doFilter,
 														 endFilterIIR endFilter,
diff --git a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
index 7ced738..d9df65f 100644
--- a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
@@ -74,7 +74,7 @@ public:
 	 * \param endFilter The finishing callback.
 	 * \param data Data pointer for the callbacks.
 	 */
-	AUD_CallbackIIRFilterReader(AUD_Reference<AUD_IReader> reader, int in, int out,
+	AUD_CallbackIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in, int out,
 								doFilterIIR doFilter,
 								endFilterIIR endFilter = 0,
 								void* data = 0);
diff --git a/intern/audaspace/FX/AUD_DelayFactory.cpp b/intern/audaspace/FX/AUD_DelayFactory.cpp
index a460659..3e5a7cf 100644
--- a/intern/audaspace/FX/AUD_DelayFactory.cpp
+++ b/intern/audaspace/FX/AUD_DelayFactory.cpp
@@ -31,7 +31,7 @@
 #include "AUD_DelayReader.h"
 #include "AUD_Space.h"
 
-AUD_DelayFactory::AUD_DelayFactory(AUD_Reference<AUD_IFactory> factory, float delay) :
+AUD_DelayFactory::AUD_DelayFactory(boost::shared_ptr<AUD_IFactory> factory, float delay) :
 		AUD_EffectFactory(factory),
 		m_delay(delay)
 {
@@ -42,7 +42,7 @@ float AUD_DelayFactory::getDelay() const
 	return m_delay;
 }
 
-AUD_Reference<AUD_IReader> AUD_DelayFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_DelayFactory::createReader()
 {
-	return new AUD_DelayReader(getReader(), m_delay);
+	return boost::shared_ptr<AUD_IReader>(new AUD_DelayReader(getReader(), m_delay));
 }
diff --git a/intern/audaspace/FX/AUD_DelayFactory.h b/intern/audaspace/FX/AUD_DelayFactory.h
index 26855a0..8cfb2be 100644
--- a/intern/audaspace/FX/AUD_DelayFactory.h
+++ b/intern/audaspace/FX/AUD_DelayFactory.h
@@ -53,14 +53,14 @@ public:
 	 * \param factory The input factory.
 	 * \param delay The desired delay in seconds.
 	 */
-	AUD_DelayFactory(AUD_Reference<AUD_IFactory> factory, float delay = 0);
+	AUD_DelayFactory(boost::shared_ptr<AUD_IFactory> factory, float delay = 0);
 
 	/**
 	 * Returns the delay in seconds.
 	 */
 	float getDelay() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_DELAYFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DelayReader.cpp b/intern/audaspace/FX/AUD_DelayReader.cpp
index 903e043..050508f 100644
--- a/intern/audaspace/FX/AUD_DelayReader.cpp
+++ b/intern/audaspace/FX/AUD_DelayReader.cpp
@@ -31,10 +31,10 @@
 
 #include <cstring>
 
-AUD_DelayReader::AUD_DelayReader(AUD_Reference<AUD_IReader> reader, float delay) :
+AUD_DelayReader::AUD_DelayReader(boost::shared_ptr<AUD_IReader> reader, float delay) :
 		AUD_EffectReader(reader),
-		m_delay(int(delay * reader->getSpecs().rate)),
-		m_remdelay(int(delay * reader->getSpecs().rate))
+		m_delay(int((AUD_SampleRate)delay * reader->getSpecs().rate)),
+		m_remdelay(int((AUD_SampleRate)delay * reader->getSpecs().rate))
 {
 }
 
diff --git a/intern/audaspace/FX/AUD_DelayReader.h b/intern/audaspace/FX/AUD_DelayReader.h
index 9d9b661..d4388e3 100644
--- a/intern/audaspace/FX/AUD_DelayReader.h
+++ b/intern/audaspace/FX/AUD_DelayReader.h
@@ -59,7 +59,7 @@ public:
 	 * \param reader The reader to read from.
 	 * \param delay The delay in seconds.
 	 */
-	AUD_DelayReader(AUD_Reference<AUD_IReader> reader, float delay);
+	AUD_DelayReader(boost::shared_ptr<AUD_IReader> reader, float delay);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/FX/AUD_DoubleFactory.cpp b/intern/audaspace/FX/AUD_DoubleFactory.cpp
index ab0111f..21bcbc2 100644
--- a/intern/audaspace/FX/AUD_DoubleFactory.cpp
+++ b/intern/audaspace/FX/AUD_DoubleFactory.cpp
@@ -30,15 +30,15 @@
 #include "AUD_DoubleFactory.h"
 #include "AUD_DoubleReader.h"
 
-AUD_DoubleFactory::AUD_DoubleFactory(AUD_Reference<AUD_IFactory> factory1, AUD_Reference<AUD_IFactory> factory2) :
+AUD_DoubleFactory::AUD_DoubleFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2) :
 		m_factory1(factory1), m_factory2(factory2)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_DoubleFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_DoubleFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader1 = m_factory1->createReader();
-	AUD_Reference<AUD_IReader> reader2 = m_factory2->createReader();
+	boost::shared_ptr<AUD_IReader> reader1 = m_factory1->createReader();
+	boost::shared_ptr<AUD_IReader> reader2 = m_factory2->createReader();
 
-	return new AUD_DoubleReader(reader1, reader2);
+	return boost::shared_ptr<AUD_IReader>(new AUD_DoubleReader(reader1, reader2));
 }
diff --git a/intern/audaspace/FX/AUD_DoubleFactory.h b/intern/audaspace/FX/AUD_DoubleFactory.h
index e4d8fbf..4a02cc7 100644
--- a/intern/audaspace/FX/AUD_DoubleFactory.h
+++ b/intern/audaspace/FX/AUD_DoubleFactory.h
@@ -41,12 +41,12 @@ private:
 	/**
 	 * First played factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory1;
+	boost::shared_ptr<AUD_IFactory> m_factory1;
 
 	/**
 	 * Second played factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory2;
+	boost::shared_ptr<AUD_IFactory> m_factory2;
 
 	// hide copy constructor and operator=
 	AUD_DoubleFactory(const AUD_DoubleFactory&);
@@ -58,9 +58,9 @@ public:
 	 * \param factory1 The first input factory.
 	 * \param factory2 The second input factory.
 	 */
-	AUD_DoubleFactory(AUD_Reference<AUD_IFactory> factory1, AUD_Reference<AUD_IFactory> factory2);
+	AUD_DoubleFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_DOUBLEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DoubleReader.cpp b/intern/audaspace/FX/AUD_DoubleReader.cpp
index 2b28bc7..ee18914 100644
--- a/intern/audaspace/FX/AUD_DoubleReader.cpp
+++ b/intern/audaspace/FX/AUD_DoubleReader.cpp
@@ -31,8 +31,8 @@
 
 #include <cstring>
 
-AUD_DoubleReader::AUD_DoubleReader(AUD_Reference<AUD_IReader> reader1,
-								   AUD_Reference<AUD_IReader> reader2) :
+AUD_DoubleReader::AUD_DoubleReader(boost::shared_ptr<AUD_IReader> reader1,
+								   boost::shared_ptr<AUD_IReader> reader2) :
 		m_reader1(reader1), m_reader2(reader2), m_finished1(false)
 {
 	AUD_Specs s1, s2;
diff --git a/intern/audaspace/FX/AUD_DoubleReader.h b/intern/audaspace/FX/AUD_DoubleReader.h
index 1489f4e..5d2f65f 100644
--- a/intern/audaspace/FX/AUD_DoubleReader.h
+++ b/intern/audaspace/FX/AUD_DoubleReader.h
@@ -32,7 +32,8 @@
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
-#include "AUD_Reference.h"
+
+#include <boost/shared_ptr.hpp>
 
 /**
  * This reader plays two readers sequently.
@@ -43,12 +44,12 @@ private:
 	/**
 	 * The first reader.
 	 */
-	AUD_Reference<AUD_IReader> m_reader1;
+	boost::shared_ptr<AUD_IReader> m_reader1;
 
 	/**
 	 * The second reader.
 	 */
-	AUD_Reference<AUD_IReader> m_reader2;
+	boost::shared_ptr<AUD_IReader> m_reader2;
 
 	/**
 	 * Whether we've reached the end of the first reader.
@@ -65,7 +66,7 @@ public:
 	 * \param reader1 The first reader to read from.
 	 * \param reader2 The second reader to read from.
 	 */
-	AUD_DoubleReader(AUD_Reference<AUD_IReader> reader1, AUD_Reference<AUD_IReader> reader2);
+	AUD_DoubleReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2);
 
 	/**
 	 * Destroys the reader.
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp
index 3d6beb6..319a78c 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp
@@ -29,12 +29,16 @@
 #include "AUD_DynamicIIRFilterFactory.h"
 #include "AUD_DynamicIIRFilterReader.h"
 
-AUD_DynamicIIRFilterFactory::AUD_DynamicIIRFilterFactory(AUD_Reference<AUD_IFactory> factory) :
-	AUD_EffectFactory(factory)
+
+AUD_DynamicIIRFilterFactory::AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory,
+														 boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator) :
+	AUD_EffectFactory(factory),
+	m_calculator(calculator)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_DynamicIIRFilterFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_DynamicIIRFilterFactory::createReader()
 {
-	return new AUD_DynamicIIRFilterReader(getReader(), this);
+	return boost::shared_ptr<AUD_IReader>(new AUD_DynamicIIRFilterReader(getReader(), m_calculator));
 }
+
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
index 5b297db..aece7a8 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
@@ -30,6 +30,7 @@
 #define __AUD_DYNAMICIIRFILTERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
+#include "AUD_IDynamicIIRFilterCalculator.h"
 #include <vector>
 
 /**
@@ -40,24 +41,18 @@
  */
 class AUD_DynamicIIRFilterFactory : public AUD_EffectFactory
 {
+protected:
+	boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> m_calculator;
+
 public:
 	/**
 	 * Creates a new Dynmic IIR filter factory.
 	 * \param factory The input factory.
 	 */
-	AUD_DynamicIIRFilterFactory(AUD_Reference<AUD_IFactory> factory);
-
-	virtual AUD_Reference<AUD_IReader> createReader();
+	AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory,
+								boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator);
 
-	/**
-	 * Recalculates the filter coefficients.
-	 * \param rate The sample rate of the audio data.
-	 * \param[out] b The input filter coefficients.
-	 * \param[out] a The output filter coefficients.
-	 */
-	virtual void recalculateCoefficients(AUD_SampleRate rate,
-	                                     std::vector<float>& b,
-	                                     std::vector<float>& a)=0;
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif // __AUD_DYNAMICIIRFILTERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp
index 24332eb..52aaf23 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp
@@ -28,10 +28,10 @@
 
 #include "AUD_DynamicIIRFilterReader.h"
 
-AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(AUD_Reference<AUD_IReader> reader,
-													   AUD_Reference<AUD_DynamicIIRFilterFactory> factory) :
+AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(boost::shared_ptr<AUD_IReader> reader,
+													   boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator) :
 	AUD_IIRFilterReader(reader, std::vector<float>(), std::vector<float>()),
-	m_factory(factory)
+	m_calculator(calculator)
 {
 	sampleRateChanged(reader->getSpecs().rate);
 }
@@ -39,6 +39,6 @@ AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(AUD_Reference<AUD_IReader
 void AUD_DynamicIIRFilterReader::sampleRateChanged(AUD_SampleRate rate)
 {
 	std::vector<float> a, b;
-	m_factory->recalculateCoefficients(rate, b, a);
+	m_calculator->recalculateCoefficients(rate, b, a);
 	setCoefficients(b, a);
 }
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
index 8a53c15..0b68578 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
@@ -30,7 +30,7 @@
 #define __AUD_DYNAMICIIRFILTERREADER_H__
 
 #include "AUD_IIRFilterReader.h"
-#include "AUD_DynamicIIRFilterFactory.h"
+#include "AUD_IDynamicIIRFilterCalculator.h"
 
 /**
  * This class is for dynamic infinite impulse response filters with simple
@@ -42,11 +42,11 @@ private:
 	/**
 	 * The factory for dynamically recalculating filter coefficients.
 	 */
-	AUD_Reference<AUD_DynamicIIRFilterFactory> m_factory;
+	boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> m_calculator;
 
 public:
-	AUD_DynamicIIRFilterReader(AUD_Reference<AUD_IReader> reader,
-							   AUD_Reference<AUD_DynamicIIRFilterFactory> factory);
+	AUD_DynamicIIRFilterReader(boost::shared_ptr<AUD_IReader> reader,
+							   boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator);
 
 	virtual void sampleRateChanged(AUD_SampleRate rate);
 };
diff --git a/intern/audaspace/FX/AUD_EffectFactory.cpp b/intern/audaspace/FX/AUD_EffectFactory.cpp
index d35f8af..6018ed5 100644
--- a/intern/audaspace/FX/AUD_EffectFactory.cpp
+++ b/intern/audaspace/FX/AUD_EffectFactory.cpp
@@ -30,7 +30,7 @@
 #include "AUD_EffectFactory.h"
 #include "AUD_IReader.h"
 
-AUD_EffectFactory::AUD_EffectFactory(AUD_Reference<AUD_IFactory> factory)
+AUD_EffectFactory::AUD_EffectFactory(boost::shared_ptr<AUD_IFactory> factory)
 {
 	m_factory = factory;
 }
@@ -39,7 +39,7 @@ AUD_EffectFactory::~AUD_EffectFactory()
 {
 }
 
-AUD_Reference<AUD_IFactory> AUD_EffectFactory::getFactory() const
+boost::shared_ptr<AUD_IFactory> AUD_EffectFactory::getFactory() const
 {
 	return m_factory;
 }
diff --git a/intern/audaspace/FX/AUD_EffectFactory.h b/intern/audaspace/FX/AUD_EffectFactory.h
index c8d26a1..d098726 100644
--- a/intern/audaspace/FX/AUD_EffectFactory.h
+++ b/intern/audaspace/FX/AUD_EffectFactory.h
@@ -47,7 +47,7 @@ protected:
 	/**
 	 * If there is no reader it is created out of this factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory;
+	boost::shared_ptr<AUD_IFactory> m_factory;
 
 	/**
 	 * Returns the reader created out of the factory.
@@ -55,7 +55,7 @@ protected:
 	 * classes.
 	 * \return The reader created out of the factory.
 	 */
-	inline AUD_Reference<AUD_IReader> getReader() const
+	inline boost::shared_ptr<AUD_IReader> getReader() const
 	{
 		return m_factory->createReader();
 	}
@@ -65,7 +65,7 @@ public:
 	 * Creates a new factory.
 	 * \param factory The input factory.
 	 */
-	AUD_EffectFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_EffectFactory(boost::shared_ptr<AUD_IFactory> factory);
 
 	/**
 	 * Destroys the factory.
@@ -76,7 +76,7 @@ public:
 	 * Returns the saved factory.
 	 * \return The factory or NULL if there has no factory been saved.
 	 */
-	AUD_Reference<AUD_IFactory> getFactory() const;
+	boost::shared_ptr<AUD_IFactory> getFactory() const;
 };
 
 #endif //__AUD_EFFECTFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_EffectReader.cpp b/intern/audaspace/FX/AUD_EffectReader.cpp
index 6c08549..b3e80be 100644
--- a/intern/audaspace/FX/AUD_EffectReader.cpp
+++ b/intern/audaspace/FX/AUD_EffectReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_EffectReader.h"
 
-AUD_EffectReader::AUD_EffectReader(AUD_Reference<AUD_IReader> reader)
+AUD_EffectReader::AUD_EffectReader(boost::shared_ptr<AUD_IReader> reader)
 {
 	m_reader = reader;
 }
diff --git a/intern/audaspace/FX/AUD_EffectReader.h b/intern/audaspace/FX/AUD_EffectReader.h
index b089ec9..2745c12 100644
--- a/intern/audaspace/FX/AUD_EffectReader.h
+++ b/intern/audaspace/FX/AUD_EffectReader.h
@@ -31,7 +31,8 @@
 #define __AUD_EFFECTREADER_H__
 
 #include "AUD_IReader.h"
-#include "AUD_Reference.h"
+
+#include <boost/shared_ptr.hpp>
 
 /**
  * This reader is a base class for all effect readers that take one other reader
@@ -48,14 +49,14 @@ protected:
 	/**
 	 * The reader to read from.
 	 */
-	AUD_Reference<AUD_IReader> m_reader;
+	boost::shared_ptr<AUD_IReader> m_reader;
 
 public:
 	/**
 	 * Creates a new effect reader.
 	 * \param reader The reader to read from.
 	 */
-	AUD_EffectReader(AUD_Reference<AUD_IReader> reader);
+	AUD_EffectReader(boost::shared_ptr<AUD_IReader> reader);
 
 	/**
 	 * Destroys the reader.
diff --git a/intern/audaspace/FX/AUD_EnvelopeFactory.cpp b/intern/audaspace/FX/AUD_EnvelopeFactory.cpp
index c717666..1e57375 100644
--- a/intern/audaspace/FX/AUD_EnvelopeFactory.cpp
+++ b/intern/audaspace/FX/AUD_EnvelopeFactory.cpp
@@ -54,7 +54,7 @@ void AUD_EnvelopeFactory::endEnvelopeFilter(EnvelopeParameters* param)
 	delete param;
 }
 
-AUD_EnvelopeFactory::AUD_EnvelopeFactory(AUD_Reference<AUD_IFactory> factory, float attack,
+AUD_EnvelopeFactory::AUD_EnvelopeFactory(boost::shared_ptr<AUD_IFactory> factory, float attack,
 										 float release, float threshold,
 										 float arthreshold) :
 		AUD_EffectFactory(factory),
@@ -65,9 +65,9 @@ AUD_EnvelopeFactory::AUD_EnvelopeFactory(AUD_Reference<AUD_IFactory> factory, fl
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_EnvelopeFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_EnvelopeFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader = getReader();
+	boost::shared_ptr<AUD_IReader> reader = getReader();
 
 	EnvelopeParameters* param = new EnvelopeParameters();
 	param->arthreshold = m_arthreshold;
@@ -75,8 +75,8 @@ AUD_Reference<AUD_IReader> AUD_EnvelopeFactory::createReader()
 	param->release = pow(m_arthreshold, 1.0f/(static_cast<float>(reader->getSpecs().rate) * m_release));
 	param->threshold = m_threshold;
 
-	return new AUD_CallbackIIRFilterReader(reader, 1, 2,
+	return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(reader, 1, 2,
 										   (doFilterIIR) envelopeFilter,
 										   (endFilterIIR) endEnvelopeFilter,
-										   param);
+										   param));
 }
diff --git a/intern/audaspace/FX/AUD_EnvelopeFactory.h b/intern/audaspace/FX/AUD_EnvelopeFactory.h
index c8f3dc3..656212c 100644
--- a/intern/audaspace/FX/AUD_EnvelopeFactory.h
+++ b/intern/audaspace/FX/AUD_EnvelopeFactory.h
@@ -73,10 +73,10 @@ public:
 	 * \param threshold The threshold value.
 	 * \param arthreshold The attack/release threshold value.
 	 */
-	AUD_EnvelopeFactory(AUD_Reference<AUD_IFactory> factory, float attack, float release,
+	AUD_EnvelopeFactory(boost::shared_ptr<AUD_IFactory> factory, float attack, float release,
 						float threshold, float arthreshold);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 
 	static sample_t envelopeFilter(AUD_CallbackIIRFilterReader* reader, EnvelopeParameters* param);
 	static void endEnvelopeFilter(EnvelopeParameters* param);
diff --git a/intern/audaspace/FX/AUD_FaderFactory.cpp b/intern/audaspace/FX/AUD_FaderFactory.cpp
index ec119ef..b34d213 100644
--- a/intern/audaspace/FX/AUD_FaderFactory.cpp
+++ b/intern/audaspace/FX/AUD_FaderFactory.cpp
@@ -30,7 +30,7 @@
 #include "AUD_FaderFactory.h"
 #include "AUD_FaderReader.h"
 
-AUD_FaderFactory::AUD_FaderFactory(AUD_Reference<AUD_IFactory> factory, AUD_FadeType type,
+AUD_FaderFactory::AUD_FaderFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_FadeType type,
 								   float start, float length) :
 		AUD_EffectFactory(factory),
 		m_type(type),
@@ -54,7 +54,7 @@ float AUD_FaderFactory::getLength() const
 	return m_length;
 }
 
-AUD_Reference<AUD_IReader> AUD_FaderFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_FaderFactory::createReader()
 {
-	return new AUD_FaderReader(getReader(), m_type, m_start, m_length);
+	return boost::shared_ptr<AUD_IReader>(new AUD_FaderReader(getReader(), m_type, m_start, m_length));
 }
diff --git a/intern/audaspace/FX/AUD_FaderFactory.h b/intern/audaspace/FX/AUD_FaderFactory.h
index 82eaf2f..f9ad88a 100644
--- a/intern/audaspace/FX/AUD_FaderFactory.h
+++ b/intern/audaspace/FX/AUD_FaderFactory.h
@@ -67,7 +67,7 @@ public:
 	 * \param start The time where fading should start in seconds.
 	 * \param length How long fading should last in seconds.
 	 */
-	AUD_FaderFactory(AUD_Reference<AUD_IFactory> factory,
+	AUD_FaderFactory(boost::shared_ptr<AUD_IFactory> factory,
 	                 AUD_FadeType type = AUD_FADE_IN,
 	                 float start = 0.0f, float length = 1.0f);
 
@@ -86,7 +86,7 @@ public:
 	 */
 	float getLength() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_FADERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_FaderReader.cpp b/intern/audaspace/FX/AUD_FaderReader.cpp
index 4ece91c..e090720 100644
--- a/intern/audaspace/FX/AUD_FaderReader.cpp
+++ b/intern/audaspace/FX/AUD_FaderReader.cpp
@@ -31,7 +31,7 @@
 
 #include <cstring>
 
-AUD_FaderReader::AUD_FaderReader(AUD_Reference<AUD_IReader> reader, AUD_FadeType type,
+AUD_FaderReader::AUD_FaderReader(boost::shared_ptr<AUD_IReader> reader, AUD_FadeType type,
 								 float start,float length) :
 		AUD_EffectReader(reader),
 		m_type(type),
diff --git a/intern/audaspace/FX/AUD_FaderReader.h b/intern/audaspace/FX/AUD_FaderReader.h
index 788e853..a49960b 100644
--- a/intern/audaspace/FX/AUD_FaderReader.h
+++ b/intern/audaspace/FX/AUD_FaderReader.h
@@ -67,7 +67,7 @@ public:
 	 * \param start The time where fading should start in seconds.
 	 * \param length How long fading should last in seconds.
 	 */
-	AUD_FaderReader(AUD_Reference<AUD_IReader> reader, AUD_FadeType type,
+	AUD_FaderReader(boost::shared_ptr<AUD_IReader> reader, AUD_FadeType type,
 					float start,float length);
 
 	virtual void read(int& length, bool& eos, sample_t* buffer);
diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.cpp b/intern/audaspace/FX/AUD_HighpassCalculator.cpp
new file mode 100644
index 0000000..573bba1
--- /dev/null
+++ b/intern/audaspace/FX/AUD_HighpassCalculator.cpp
@@ -0,0 +1,27 @@
+#include "AUD_HighpassCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+AUD_HighpassCalculator::AUD_HighpassCalculator(float frequency, float Q) :
+	m_frequency(frequency),
+	m_Q(Q)
+{
+}
+
+void AUD_HighpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+	float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate;
+	float alpha = (float)(sin(w0) / (2.0 * (double)m_Q));
+	float norm = 1 + alpha;
+	float c = cos(w0);
+	a.push_back(1);
+	a.push_back(-2 * c / norm);
+	a.push_back((1 - alpha) / norm);
+	b.push_back((1 + c) / (2 * norm));
+	b.push_back((-1 - c) / norm);
+	b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.h b/intern/audaspace/FX/AUD_HighpassCalculator.h
new file mode 100644
index 0000000..bad1c08
--- /dev/null
+++ b/intern/audaspace/FX/AUD_HighpassCalculator.h
@@ -0,0 +1,25 @@
+#ifndef AUD_HIGHPASSCALCULATOR_H
+#define AUD_HIGHPASSCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_HighpassCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+	/**
+	 * The cutoff frequency.
+	 */
+	const float m_frequency;
+
+	/**
+	 * The Q factor.
+	 */
+	const float m_Q;
+
+public:
+	AUD_HighpassCalculator(float frequency, float Q);
+
+	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_HIGHPASSCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_HighpassFactory.cpp b/intern/audaspace/FX/AUD_HighpassFactory.cpp
index 4107084..2456085 100644
--- a/intern/audaspace/FX/AUD_HighpassFactory.cpp
+++ b/intern/audaspace/FX/AUD_HighpassFactory.cpp
@@ -29,33 +29,11 @@
 
 #include "AUD_HighpassFactory.h"
 #include "AUD_IIRFilterReader.h"
+#include "AUD_HighpassCalculator.h"
 
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-AUD_HighpassFactory::AUD_HighpassFactory(AUD_Reference<AUD_IFactory> factory, float frequency,
+AUD_HighpassFactory::AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency,
 										 float Q) :
-		AUD_DynamicIIRFilterFactory(factory),
-		m_frequency(frequency),
-		m_Q(Q)
+		AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_HighpassCalculator(frequency, Q)))
 {
 }
 
-void AUD_HighpassFactory::recalculateCoefficients(AUD_SampleRate rate,
-												  std::vector<float> &b,
-												  std::vector<float> &a)
-{
-	float w0 = 2 * M_PI * m_frequency / rate;
-	float alpha = sin(w0) / (2 * m_Q);
-	float norm = 1 + alpha;
-	float c = cos(w0);
-	a.push_back(1);
-	a.push_back(-2 * c / norm);
-	a.push_back((1 - alpha) / norm);
-	b.push_back((1 + c) / (2 * norm));
-	b.push_back((-1 - c) / norm);
-	b.push_back(b[0]);
-}
diff --git a/intern/audaspace/FX/AUD_HighpassFactory.h b/intern/audaspace/FX/AUD_HighpassFactory.h
index 66aa809..56ced91 100644
--- a/intern/audaspace/FX/AUD_HighpassFactory.h
+++ b/intern/audaspace/FX/AUD_HighpassFactory.h
@@ -38,16 +38,6 @@
 class AUD_HighpassFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-	/**
-	 * The cutoff frequency.
-	 */
-	const float m_frequency;
-
-	/**
-	 * The Q factor.
-	 */
-	const float m_Q;
-
 	// hide copy constructor and operator=
 	AUD_HighpassFactory(const AUD_HighpassFactory&);
 	AUD_HighpassFactory& operator=(const AUD_HighpassFactory&);
@@ -59,9 +49,7 @@ public:
 	 * \param frequency The cutoff frequency.
 	 * \param Q The Q factor.
 	 */
-	AUD_HighpassFactory(AUD_Reference<AUD_IFactory> factory, float frequency, float Q = 1.0f);
-
-	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+	AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f);
 };
 
 #endif //__AUD_HIGHPASSFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h b/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h
new file mode 100644
index 0000000..29b87e5
--- /dev/null
+++ b/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h
@@ -0,0 +1,54 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2009-2011 Jörg Hermann Müller
+ *
+ * This file is part of AudaSpace.
+ *
+ * Audaspace is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * AudaSpace is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Audaspace; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file audaspace/FX/AUD_IDynamicIIRFilterCalculator.h
+ *  \ingroup audfx
+ */
+
+#ifndef AUD_IDYNAMICIIRFILTERCALCULATOR_H
+#define AUD_IDYNAMICIIRFILTERCALCULATOR_H
+
+#include "AUD_Space.h"
+
+#include <vector>
+
+/**
+ * This interface calculates dynamic filter coefficients which depend on the
+ * sampling rate for AUD_DynamicIIRFilterReaders.
+ */
+class AUD_IDynamicIIRFilterCalculator
+{
+public:
+	/**
+	 * Recalculates the filter coefficients.
+	 * \param rate The sample rate of the audio data.
+	 * \param[out] b The input filter coefficients.
+	 * \param[out] a The output filter coefficients.
+	 */
+	virtual void recalculateCoefficients(AUD_SampleRate rate,
+										 std::vector<float>& b,
+										 std::vector<float>& a)=0;
+};
+
+#endif // AUD_IDYNAMICIIRFILTERCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_IIRFilterFactory.cpp b/intern/audaspace/FX/AUD_IIRFilterFactory.cpp
index 807b0ef..c4f94a2 100644
--- a/intern/audaspace/FX/AUD_IIRFilterFactory.cpp
+++ b/intern/audaspace/FX/AUD_IIRFilterFactory.cpp
@@ -30,14 +30,14 @@
 #include "AUD_IIRFilterFactory.h"
 #include "AUD_IIRFilterReader.h"
 
-AUD_IIRFilterFactory::AUD_IIRFilterFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_IIRFilterFactory::AUD_IIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory,
 										   std::vector<float> b,
 										   std::vector<float> a) :
 		AUD_EffectFactory(factory), m_a(a), m_b(b)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_IIRFilterFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_IIRFilterFactory::createReader()
 {
-	return new AUD_IIRFilterReader(getReader(), m_b, m_a);
+	return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), m_b, m_a));
 }
diff --git a/intern/audaspace/FX/AUD_IIRFilterFactory.h b/intern/audaspace/FX/AUD_IIRFilterFactory.h
index 43256a1..0b55c12 100644
--- a/intern/audaspace/FX/AUD_IIRFilterFactory.h
+++ b/intern/audaspace/FX/AUD_IIRFilterFactory.h
@@ -31,6 +31,7 @@
 #define __AUD_IIRFILTERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
+#include "AUD_IDynamicIIRFilterCalculator.h"
 
 #include <vector>
 
@@ -61,10 +62,10 @@ public:
 	 * \param b The input filter coefficients.
 	 * \param a The output filter coefficients.
 	 */
-	AUD_IIRFilterFactory(AUD_Reference<AUD_IFactory> factory, std::vector<float> b,
+	AUD_IIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory, std::vector<float> b,
 						 std::vector<float> a);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_IIRFILTERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.cpp b/intern/audaspace/FX/AUD_IIRFilterReader.cpp
index 8f78c11..6716e6b 100644
--- a/intern/audaspace/FX/AUD_IIRFilterReader.cpp
+++ b/intern/audaspace/FX/AUD_IIRFilterReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_IIRFilterReader.h"
 
-AUD_IIRFilterReader::AUD_IIRFilterReader(AUD_Reference<AUD_IReader> reader,
+AUD_IIRFilterReader::AUD_IIRFilterReader(boost::shared_ptr<AUD_IReader> reader,
 										 const std::vector<float>& b,
 										 const std::vector<float>& a) :
 	AUD_BaseIIRFilterReader(reader, b.size(), a.size()), m_a(a), m_b(b)
diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.h b/intern/audaspace/FX/AUD_IIRFilterReader.h
index d9be52f..d663805 100644
--- a/intern/audaspace/FX/AUD_IIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_IIRFilterReader.h
@@ -61,7 +61,7 @@ public:
 	 * \param b The input filter coefficients.
 	 * \param a The output filter coefficients.
 	 */
-	AUD_IIRFilterReader(AUD_Reference<AUD_IReader> reader, const std::vector<float>& b,
+	AUD_IIRFilterReader(boost::shared_ptr<AUD_IReader> reader, const std::vector<float>& b,
 						const std::vector<float>& a);
 
 	virtual sample_t filter();
diff --git a/intern/audaspace/FX/AUD_LimiterFactory.cpp b/intern/audaspace/FX/AUD_LimiterFactory.cpp
index e58657d..679ed3a 100644
--- a/intern/audaspace/FX/AUD_LimiterFactory.cpp
+++ b/intern/audaspace/FX/AUD_LimiterFactory.cpp
@@ -31,7 +31,7 @@
 #include "AUD_LimiterReader.h"
 #include "AUD_Space.h"
 
-AUD_LimiterFactory::AUD_LimiterFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_LimiterFactory::AUD_LimiterFactory(boost::shared_ptr<AUD_IFactory> factory,
 									   float start, float end) :
 		AUD_EffectFactory(factory),
 		m_start(start),
@@ -49,7 +49,7 @@ float AUD_LimiterFactory::getEnd() const
 	return m_end;
 }
 
-AUD_Reference<AUD_IReader> AUD_LimiterFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_LimiterFactory::createReader()
 {
-	return new AUD_LimiterReader(getReader(), m_start, m_end);
+	return boost::shared_ptr<AUD_IReader>(new AUD_LimiterReader(getReader(), m_start, m_end));
 }
diff --git a/intern/audaspace/FX/AUD_LimiterFactory.h b/intern/audaspace/FX/AUD_LimiterFactory.h
index ddc8183..0376952 100644
--- a/intern/audaspace/FX/AUD_LimiterFactory.h
+++ b/intern/audaspace/FX/AUD_LimiterFactory.h
@@ -60,7 +60,7 @@ public:
 	 * \param end The desired end time, a negative value signals that it should
 	 *            play to the end.
 	 */
-	AUD_LimiterFactory(AUD_Reference<AUD_IFactory> factory,
+	AUD_LimiterFactory(boost::shared_ptr<AUD_IFactory> factory,
 					   float start = 0, float end = -1);
 
 	/**
@@ -73,7 +73,7 @@ public:
 	 */
 	float getEnd() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_LIMITERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_LimiterReader.cpp b/intern/audaspace/FX/AUD_LimiterReader.cpp
index 0abf496..9c1d444 100644
--- a/intern/audaspace/FX/AUD_LimiterReader.cpp
+++ b/intern/audaspace/FX/AUD_LimiterReader.cpp
@@ -30,7 +30,7 @@
 #include "AUD_LimiterReader.h"
 #include "AUD_Buffer.h"
 
-AUD_LimiterReader::AUD_LimiterReader(AUD_Reference<AUD_IReader> reader,
+AUD_LimiterReader::AUD_LimiterReader(boost::shared_ptr<AUD_IReader> reader,
 									 float start, float end) :
 		AUD_EffectReader(reader),
 		m_start(start),
diff --git a/intern/audaspace/FX/AUD_LimiterReader.h b/intern/audaspace/FX/AUD_LimiterReader.h
index 34c4ea7..607eb9e 100644
--- a/intern/audaspace/FX/AUD_LimiterReader.h
+++ b/intern/audaspace/FX/AUD_LimiterReader.h
@@ -60,7 +60,7 @@ public:
 	 * \param end The desired end time (sample exklusive), a negative value
 	 *            signals that it should play to the end.
 	 */
-	AUD_LimiterReader(AUD_Reference<AUD_IReader> reader, float start = 0, float end = -1);
+	AUD_LimiterReader(boost::shared_ptr<AUD_IReader> reader, float start = 0, float end = -1);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/FX/AUD_LoopFactory.cpp b/intern/audaspace/FX/AUD_LoopFactory.cpp
index 32c9e6b..a9e83e3 100644
--- a/intern/audaspace/FX/AUD_LoopFactory.cpp
+++ b/intern/audaspace/FX/AUD_LoopFactory.cpp
@@ -30,7 +30,7 @@
 #include "AUD_LoopFactory.h"
 #include "AUD_LoopReader.h"
 
-AUD_LoopFactory::AUD_LoopFactory(AUD_Reference<AUD_IFactory> factory, int loop) :
+AUD_LoopFactory::AUD_LoopFactory(boost::shared_ptr<AUD_IFactory> factory, int loop) :
 		AUD_EffectFactory(factory),
 		m_loop(loop)
 {
@@ -41,7 +41,7 @@ int AUD_LoopFactory::getLoop() const
 	return m_loop;
 }
 
-AUD_Reference<AUD_IReader> AUD_LoopFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_LoopFactory::createReader()
 {
-	return new AUD_LoopReader(getReader(), m_loop);
+	return boost::shared_ptr<AUD_IReader>(new AUD_LoopReader(getReader(), m_loop));
 }
diff --git a/intern/audaspace/FX/AUD_LoopFactory.h b/intern/audaspace/FX/AUD_LoopFactory.h
index 754b780..570536b 100644
--- a/intern/audaspace/FX/AUD_LoopFactory.h
+++ b/intern/audaspace/FX/AUD_LoopFactory.h
@@ -55,14 +55,14 @@ public:
 	 * \param loop The desired loop count, negative values result in endless
 	 *        looping.
 	 */
-	AUD_LoopFactory(AUD_Reference<AUD_IFactory> factory, int loop = -1);
+	AUD_LoopFactory(boost::shared_ptr<AUD_IFactory> factory, int loop = -1);
 
 	/**
 	 * Returns the loop count.
 	 */
 	int getLoop() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_LOOPFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_LoopReader.cpp b/intern/audaspace/FX/AUD_LoopReader.cpp
index 863f66f..6fbcaa5 100644
--- a/intern/audaspace/FX/AUD_LoopReader.cpp
+++ b/intern/audaspace/FX/AUD_LoopReader.cpp
@@ -32,7 +32,7 @@
 
 #include <cstring>
 
-AUD_LoopReader::AUD_LoopReader(AUD_Reference<AUD_IReader> reader, int loop) :
+AUD_LoopReader::AUD_LoopReader(boost::shared_ptr<AUD_IReader> reader, int loop) :
 		AUD_EffectReader(reader), m_count(loop), m_left(loop)
 {
 }
diff --git a/intern/audaspace/FX/AUD_LoopReader.h b/intern/audaspace/FX/AUD_LoopReader.h
index fd2dd71..12b8078 100644
--- a/intern/audaspace/FX/AUD_LoopReader.h
+++ b/intern/audaspace/FX/AUD_LoopReader.h
@@ -61,7 +61,7 @@ public:
 	 * \param loop The desired loop count, negative values result in endless
 	 *        looping.
 	 */
-	AUD_LoopReader(AUD_Reference<AUD_IReader> reader, int loop);
+	AUD_LoopReader(boost::shared_ptr<AUD_IReader> reader, int loop);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.cpp b/intern/audaspace/FX/AUD_LowpassCalculator.cpp
new file mode 100644
index 0000000..57452f0
--- /dev/null
+++ b/intern/audaspace/FX/AUD_LowpassCalculator.cpp
@@ -0,0 +1,27 @@
+#include "AUD_LowpassCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+AUD_LowpassCalculator::AUD_LowpassCalculator(float frequency, float Q) :
+	m_frequency(frequency),
+	m_Q(Q)
+{
+}
+
+void AUD_LowpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+	float w0 = 2 * M_PI * m_frequency / rate;
+	float alpha = sin(w0) / (2 * m_Q);
+	float norm = 1 + alpha;
+	float c = cos(w0);
+	a.push_back(1);
+	a.push_back(-2 * c / norm);
+	a.push_back((1 - alpha) / norm);
+	b.push_back((1 - c) / (2 * norm));
+	b.push_back((1 - c) / norm);
+	b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.h b/intern/audaspace/FX/AUD_LowpassCalculator.h
new file mode 100644
index 0000000..18bb11f
--- /dev/null
+++ b/intern/audaspace/FX/AUD_LowpassCalculator.h
@@ -0,0 +1,25 @@
+#ifndef AUD_LOWPASSCALCULATOR_H
+#define AUD_LOWPASSCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_LowpassCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+	/**
+	 * The cutoff frequency.
+	 */
+	const float m_frequency;
+
+	/**
+	 * The Q factor.
+	 */
+	const float m_Q;
+
+public:
+	AUD_LowpassCalculator(float frequency, float Q);
+
+	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_LOWPASSCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_LowpassFactory.cpp b/intern/audaspace/FX/AUD_LowpassFactory.cpp
index 14dbc95..bd22599 100644
--- a/intern/audaspace/FX/AUD_LowpassFactory.cpp
+++ b/intern/audaspace/FX/AUD_LowpassFactory.cpp
@@ -29,33 +29,10 @@
 
 #include "AUD_LowpassFactory.h"
 #include "AUD_IIRFilterReader.h"
+#include "AUD_LowpassCalculator.h"
 
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-AUD_LowpassFactory::AUD_LowpassFactory(AUD_Reference<AUD_IFactory> factory, float frequency,
+AUD_LowpassFactory::AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency,
 									   float Q) :
-		AUD_DynamicIIRFilterFactory(factory),
-		m_frequency(frequency),
-		m_Q(Q)
-{
-}
-
-void AUD_LowpassFactory::recalculateCoefficients(AUD_SampleRate rate,
-												 std::vector<float> &b,
-												 std::vector<float> &a)
+		AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_LowpassCalculator(frequency, Q)))
 {
-	float w0 = 2 * M_PI * m_frequency / rate;
-	float alpha = sin(w0) / (2 * m_Q);
-	float norm = 1 + alpha;
-	float c = cos(w0);
-	a.push_back(1);
-	a.push_back(-2 * c / norm);
-	a.push_back((1 - alpha) / norm);
-	b.push_back((1 - c) / (2 * norm));
-	b.push_back((1 - c) / norm);
-	b.push_back(b[0]);
 }
diff --git a/intern/audaspace/FX/AUD_LowpassFactory.h b/intern/audaspace/FX/AUD_LowpassFactory.h
index 7e98720..dfd8ab3 100644
--- a/intern/audaspace/FX/AUD_LowpassFactory.h
+++ b/intern/audaspace/FX/AUD_LowpassFactory.h
@@ -38,16 +38,6 @@
 class AUD_LowpassFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-	/**
-	 * The cutoff frequency.
-	 */
-	const float m_frequency;
-
-	/**
-	 * The Q factor.
-	 */
-	const float m_Q;
-
 	// hide copy constructor and operator=
 	AUD_LowpassFactory(const AUD_LowpassFactory&);
 	AUD_LowpassFactory& operator=(const AUD_LowpassFactory&);
@@ -59,9 +49,7 @@ public:
 	 * \param frequency The cutoff frequency.
 	 * \param Q The Q factor.
 	 */
-	AUD_LowpassFactory(AUD_Reference<AUD_IFactory> factory, float frequency, float Q = 1.0f);
-
-	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+	AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f);
 };
 
 #endif //__AUD_LOWPASSFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PingPongFactory.cpp b/intern/audaspace/FX/AUD_PingPongFactory.cpp
index 3d5011c..84e4b29 100644
--- a/intern/audaspace/FX/AUD_PingPongFactory.cpp
+++ b/intern/audaspace/FX/AUD_PingPongFactory.cpp
@@ -31,16 +31,16 @@
 #include "AUD_DoubleReader.h"
 #include "AUD_ReverseFactory.h"
 
-AUD_PingPongFactory::AUD_PingPongFactory(AUD_Reference<AUD_IFactory> factory) :
+AUD_PingPongFactory::AUD_PingPongFactory(boost::shared_ptr<AUD_IFactory> factory) :
 		AUD_EffectFactory(factory)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_PingPongFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_PingPongFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader = getReader();
+	boost::shared_ptr<AUD_IReader> reader = getReader();
 	AUD_ReverseFactory factory(m_factory);
-	AUD_Reference<AUD_IReader> reader2 = factory.createReader();
+	boost::shared_ptr<AUD_IReader> reader2 = factory.createReader();
 
-	return new AUD_DoubleReader(reader, reader2);
+	return boost::shared_ptr<AUD_IReader>(new AUD_DoubleReader(reader, reader2));
 }
diff --git a/intern/audaspace/FX/AUD_PingPongFactory.h b/intern/audaspace/FX/AUD_PingPongFactory.h
index f25624a..e8ee5c9 100644
--- a/intern/audaspace/FX/AUD_PingPongFactory.h
+++ b/intern/audaspace/FX/AUD_PingPongFactory.h
@@ -48,9 +48,9 @@ public:
 	 * Creates a new ping pong factory.
 	 * \param factory The input factory.
 	 */
-	AUD_PingPongFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_PingPongFactory(boost::shared_ptr<AUD_IFactory> factory);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_PINGPONGFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PitchFactory.cpp b/intern/audaspace/FX/AUD_PitchFactory.cpp
index c6e9ae0..9dc27a5 100644
--- a/intern/audaspace/FX/AUD_PitchFactory.cpp
+++ b/intern/audaspace/FX/AUD_PitchFactory.cpp
@@ -31,13 +31,13 @@
 #include "AUD_PitchReader.h"
 #include "AUD_Space.h"
 
-AUD_PitchFactory::AUD_PitchFactory(AUD_Reference<AUD_IFactory> factory, float pitch) :
+AUD_PitchFactory::AUD_PitchFactory(boost::shared_ptr<AUD_IFactory> factory, float pitch) :
 		AUD_EffectFactory(factory),
 		m_pitch(pitch)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_PitchFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_PitchFactory::createReader()
 {
-	return new AUD_PitchReader(getReader(), m_pitch);
+	return boost::shared_ptr<AUD_IReader>(new AUD_PitchReader(getReader(), m_pitch));
 }
diff --git a/intern/audaspace/FX/AUD_PitchFactory.h b/intern/audaspace/FX/AUD_PitchFactory.h
index 5ad37ad..159388b 100644
--- a/intern/audaspace/FX/AUD_PitchFactory.h
+++ b/intern/audaspace/FX/AUD_PitchFactory.h
@@ -53,9 +53,9 @@ public:
 	 * \param factory The input factory.
 	 * \param pitch The desired pitch.
 	 */
-	AUD_PitchFactory(AUD_Reference<AUD_IFactory> factory, float pitch);
+	AUD_PitchFactory(boost::shared_ptr<AUD_IFactory> factory, float pitch);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_PITCHFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PitchReader.cpp b/intern/audaspace/FX/AUD_PitchReader.cpp
index 0d1ff01..218af4f 100644
--- a/intern/audaspace/FX/AUD_PitchReader.cpp
+++ b/intern/audaspace/FX/AUD_PitchReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_PitchReader.h"
 
-AUD_PitchReader::AUD_PitchReader(AUD_Reference<AUD_IReader> reader, float pitch) :
+AUD_PitchReader::AUD_PitchReader(boost::shared_ptr<AUD_IReader> reader, float pitch) :
 		AUD_EffectReader(reader), m_pitch(pitch)
 {
 }
diff --git a/intern/audaspace/FX/AUD_PitchReader.h b/intern/audaspace/FX/AUD_PitchReader.h
index 3185bfd..d22e589 100644
--- a/intern/audaspace/FX/AUD_PitchReader.h
+++ b/intern/audaspace/FX/AUD_PitchReader.h
@@ -53,7 +53,7 @@ public:
 	 * \param reader The reader to read from.
 	 * \param pitch The pitch value.
 	 */
-	AUD_PitchReader(AUD_Reference<AUD_IReader> reader, float pitch);
+	AUD_PitchReader(boost::shared_ptr<AUD_IReader> reader, float pitch);
 
 	virtual AUD_Specs getSpecs() const;
 
diff --git a/intern/audaspace/FX/AUD_RectifyFactory.cpp b/intern/audaspace/FX/AUD_RectifyFactory.cpp
index ad01f40..26bb561 100644
--- a/intern/audaspace/FX/AUD_RectifyFactory.cpp
+++ b/intern/audaspace/FX/AUD_RectifyFactory.cpp
@@ -37,12 +37,12 @@ sample_t AUD_RectifyFactory::rectifyFilter(AUD_CallbackIIRFilterReader* reader,
 	return fabs(reader->x(0));
 }
 
-AUD_RectifyFactory::AUD_RectifyFactory(AUD_Reference<AUD_IFactory> factory) :
+AUD_RectifyFactory::AUD_RectifyFactory(boost::shared_ptr<AUD_IFactory> factory) :
 		AUD_EffectFactory(factory)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_RectifyFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_RectifyFactory::createReader()
 {
-	return new AUD_CallbackIIRFilterReader(getReader(), 1, 1, rectifyFilter);
+	return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 1, 1, rectifyFilter));
 }
diff --git a/intern/audaspace/FX/AUD_RectifyFactory.h b/intern/audaspace/FX/AUD_RectifyFactory.h
index 5ad41d4..eb595e4 100644
--- a/intern/audaspace/FX/AUD_RectifyFactory.h
+++ b/intern/audaspace/FX/AUD_RectifyFactory.h
@@ -48,9 +48,9 @@ public:
 	 * Creates a new rectify factory.
 	 * \param factory The input factory.
 	 */
-	AUD_RectifyFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_RectifyFactory(boost::shared_ptr<AUD_IFactory> factory);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 
 	static sample_t rectifyFilter(AUD_CallbackIIRFilterReader* reader, void* useless);
 };
diff --git a/intern/audaspace/FX/AUD_ReverseFactory.cpp b/intern/audaspace/FX/AUD_ReverseFactory.cpp
index 063cbc8..afb4ad2 100644
--- a/intern/audaspace/FX/AUD_ReverseFactory.cpp
+++ b/intern/audaspace/FX/AUD_ReverseFactory.cpp
@@ -31,12 +31,12 @@
 #include "AUD_ReverseReader.h"
 #include "AUD_Space.h"
 
-AUD_ReverseFactory::AUD_ReverseFactory(AUD_Reference<AUD_IFactory> factory) :
+AUD_ReverseFactory::AUD_ReverseFactory(boost::shared_ptr<AUD_IFactory> factory) :
 		AUD_EffectFactory(factory)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_ReverseFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_ReverseFactory::createReader()
 {
-	return new AUD_ReverseReader(getReader());
+	return boost::shared_ptr<AUD_IReader>(new AUD_ReverseReader(getReader()));
 }
diff --git a/intern/audaspace/FX/AUD_ReverseFactory.h b/intern/audaspace/FX/AUD_ReverseFactory.h
index e2d75dc..5b0c9e3 100644
--- a/intern/audaspace/FX/AUD_ReverseFactory.h
+++ b/intern/audaspace/FX/AUD_ReverseFactory.h
@@ -48,9 +48,9 @@ public:
 	 * Creates a new reverse factory.
 	 * \param factory The input factory.
 	 */
-	AUD_ReverseFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_ReverseFactory(boost::shared_ptr<AUD_IFactory> factory);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_REVERSEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_ReverseReader.cpp b/intern/audaspace/FX/AUD_ReverseReader.cpp
index 6b454c6..c0a5962 100644
--- a/intern/audaspace/FX/AUD_ReverseReader.cpp
+++ b/intern/audaspace/FX/AUD_ReverseReader.cpp
@@ -34,7 +34,7 @@
 static const char* props_error = "AUD_ReverseReader: The reader has to be "
 								 "seekable and a finite length.";
 
-AUD_ReverseReader::AUD_ReverseReader(AUD_Reference<AUD_IReader> reader) :
+AUD_ReverseReader::AUD_ReverseReader(boost::shared_ptr<AUD_IReader> reader) :
 		AUD_EffectReader(reader),
 		m_length(reader->getLength()),
 		m_position(0)
diff --git a/intern/audaspace/FX/AUD_ReverseReader.h b/intern/audaspace/FX/AUD_ReverseReader.h
index d1e5179..2190479 100644
--- a/intern/audaspace/FX/AUD_ReverseReader.h
+++ b/intern/audaspace/FX/AUD_ReverseReader.h
@@ -61,7 +61,7 @@ public:
 	 * \exception AUD_Exception Thrown if the reader specified has an
 	 *            undeterminable/infinite length or is not seekable.
 	 */
-	AUD_ReverseReader(AUD_Reference<AUD_IReader> reader);
+	AUD_ReverseReader(boost::shared_ptr<AUD_IReader> reader);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/FX/AUD_SquareFactory.cpp b/intern/audaspace/FX/AUD_SquareFactory.cpp
index 7aabdb7..4b4dccb 100644
--- a/intern/audaspace/FX/AUD_SquareFactory.cpp
+++ b/intern/audaspace/FX/AUD_SquareFactory.cpp
@@ -46,7 +46,7 @@ void AUD_SquareFactory::endSquareFilter(float* threshold)
 	delete threshold;
 }
 
-AUD_SquareFactory::AUD_SquareFactory(AUD_Reference<AUD_IFactory> factory, float threshold) :
+AUD_SquareFactory::AUD_SquareFactory(boost::shared_ptr<AUD_IFactory> factory, float threshold) :
 		AUD_EffectFactory(factory),
 		m_threshold(threshold)
 {
@@ -57,10 +57,10 @@ float AUD_SquareFactory::getThreshold() const
 	return m_threshold;
 }
 
-AUD_Reference<AUD_IReader> AUD_SquareFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SquareFactory::createReader()
 {
-	return new AUD_CallbackIIRFilterReader(getReader(), 1, 1,
+	return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 1, 1,
 										   (doFilterIIR) squareFilter,
 										   (endFilterIIR) endSquareFilter,
-										   new float(m_threshold));
+										   new float(m_threshold)));
 }
diff --git a/intern/audaspace/FX/AUD_SquareFactory.h b/intern/audaspace/FX/AUD_SquareFactory.h
index 9c0dea2..27e62b6 100644
--- a/intern/audaspace/FX/AUD_SquareFactory.h
+++ b/intern/audaspace/FX/AUD_SquareFactory.h
@@ -54,14 +54,14 @@ public:
 	 * \param factory The input factory.
 	 * \param threshold The threshold.
 	 */
-	AUD_SquareFactory(AUD_Reference<AUD_IFactory> factory, float threshold = 0.0f);
+	AUD_SquareFactory(boost::shared_ptr<AUD_IFactory> factory, float threshold = 0.0f);
 
 	/**
 	 * Returns the threshold.
 	 */
 	float getThreshold() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 
 	static sample_t squareFilter(AUD_CallbackIIRFilterReader* reader, float* threshold);
 	static void endSquareFilter(float* threshold);
diff --git a/intern/audaspace/FX/AUD_SumFactory.cpp b/intern/audaspace/FX/AUD_SumFactory.cpp
index b58c44b..7f82233 100644
--- a/intern/audaspace/FX/AUD_SumFactory.cpp
+++ b/intern/audaspace/FX/AUD_SumFactory.cpp
@@ -30,16 +30,16 @@
 #include "AUD_SumFactory.h"
 #include "AUD_IIRFilterReader.h"
 
-AUD_SumFactory::AUD_SumFactory(AUD_Reference<AUD_IFactory> factory) :
+AUD_SumFactory::AUD_SumFactory(boost::shared_ptr<AUD_IFactory> factory) :
 		AUD_EffectFactory(factory)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_SumFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SumFactory::createReader()
 {
 	std::vector<float> a, b;
 	a.push_back(1);
 	a.push_back(-1);
 	b.push_back(1);
-	return new AUD_IIRFilterReader(getReader(), b, a);
+	return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), b, a));
 }
diff --git a/intern/audaspace/FX/AUD_SumFactory.h b/intern/audaspace/FX/AUD_SumFactory.h
index ec17faf..a916f35 100644
--- a/intern/audaspace/FX/AUD_SumFactory.h
+++ b/intern/audaspace/FX/AUD_SumFactory.h
@@ -47,9 +47,9 @@ public:
 	 * Creates a new sum factory.
 	 * \param factory The input factory.
 	 */
-	AUD_SumFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_SumFactory(boost::shared_ptr<AUD_IFactory> factory);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SUMFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_SuperposeFactory.cpp b/intern/audaspace/FX/AUD_SuperposeFactory.cpp
index 30c5719..3efad37 100644
--- a/intern/audaspace/FX/AUD_SuperposeFactory.cpp
+++ b/intern/audaspace/FX/AUD_SuperposeFactory.cpp
@@ -30,15 +30,15 @@
 #include "AUD_SuperposeFactory.h"
 #include "AUD_SuperposeReader.h"
 
-AUD_SuperposeFactory::AUD_SuperposeFactory(AUD_Reference<AUD_IFactory> factory1, AUD_Reference<AUD_IFactory> factory2) :
+AUD_SuperposeFactory::AUD_SuperposeFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2) :
 		m_factory1(factory1), m_factory2(factory2)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_SuperposeFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SuperposeFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader1 = m_factory1->createReader();
-	AUD_Reference<AUD_IReader> reader2 = m_factory2->createReader();
+	boost::shared_ptr<AUD_IReader> reader1 = m_factory1->createReader();
+	boost::shared_ptr<AUD_IReader> reader2 = m_factory2->createReader();
 
-	return new AUD_SuperposeReader(reader1, reader2);
+	return boost::shared_ptr<AUD_IReader>(new AUD_SuperposeReader(reader1, reader2));
 }
diff --git a/intern/audaspace/FX/AUD_SuperposeFactory.h b/intern/audaspace/FX/AUD_SuperposeFactory.h
index 2da8e34..caa0dfb 100644
--- a/intern/audaspace/FX/AUD_SuperposeFactory.h
+++ b/intern/audaspace/FX/AUD_SuperposeFactory.h
@@ -43,12 +43,12 @@ private:
 	/**
 	 * First played factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory1;
+	boost::shared_ptr<AUD_IFactory> m_factory1;
 
 	/**
 	 * Second played factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory2;
+	boost::shared_ptr<AUD_IFactory> m_factory2;
 
 	// hide copy constructor and operator=
 	AUD_SuperposeFactory(const AUD_SuperposeFactory&);
@@ -60,9 +60,9 @@ public:
 	 * \param factory1 The first input factory.
 	 * \param factory2 The second input factory.
 	 */
-	AUD_SuperposeFactory(AUD_Reference<AUD_IFactory> factory1, AUD_Reference<AUD_IFactory> factory2);
+	AUD_SuperposeFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SUPERPOSEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_SuperposeReader.cpp b/intern/audaspace/FX/AUD_SuperposeReader.cpp
index 535d359..294a48b 100644
--- a/intern/audaspace/FX/AUD_SuperposeReader.cpp
+++ b/intern/audaspace/FX/AUD_SuperposeReader.cpp
@@ -34,7 +34,7 @@
 static const char* specs_error = "AUD_SuperposeReader: Both readers have to "
 								 "have the same specs.";
 
-AUD_SuperposeReader::AUD_SuperposeReader(AUD_Reference<AUD_IReader> reader1, AUD_Reference<AUD_IReader> reader2) :
+AUD_SuperposeReader::AUD_SuperposeReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2) :
 	m_reader1(reader1), m_reader2(reader2)
 {
 }
diff --git a/intern/audaspace/FX/AUD_SuperposeReader.h b/intern/audaspace/FX/AUD_SuperposeReader.h
index d0fde13..a04ab90 100644
--- a/intern/audaspace/FX/AUD_SuperposeReader.h
+++ b/intern/audaspace/FX/AUD_SuperposeReader.h
@@ -32,7 +32,8 @@
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
-#include "AUD_Reference.h"
+
+#include <boost/shared_ptr.hpp>
 
 /**
  * This reader plays two readers with the same specs in parallel.
@@ -43,12 +44,12 @@ private:
 	/**
 	 * The first reader.
 	 */
-	AUD_Reference<AUD_IReader> m_reader1;
+	boost::shared_ptr<AUD_IReader> m_reader1;
 
 	/**
 	 * The second reader.
 	 */
-	AUD_Reference<AUD_IReader> m_reader2;
+	boost::shared_ptr<AUD_IReader> m_reader2;
 
 	/**
 	 * Buffer used for mixing.
@@ -66,7 +67,7 @@ public:
 	 * \param reader2 The second reader to read from.
 	 * \exception AUD_Exception Thrown if the specs from the readers differ.
 	 */
-	AUD_SuperposeReader(AUD_Reference<AUD_IReader> reader1, AUD_Reference<AUD_IReader> reader2);
+	AUD_SuperposeReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2);
 
 	/**
 	 * Destroys the reader.
diff --git a/intern/audaspace/FX/AUD_VolumeFactory.cpp b/intern/audaspace/FX/AUD_VolumeFactory.cpp
index f5e635e..4f0e1e4 100644
--- a/intern/audaspace/FX/AUD_VolumeFactory.cpp
+++ b/intern/audaspace/FX/AUD_VolumeFactory.cpp
@@ -30,7 +30,7 @@
 #include "AUD_VolumeFactory.h"
 #include "AUD_IIRFilterReader.h"
 
-AUD_VolumeFactory::AUD_VolumeFactory(AUD_Reference<AUD_IFactory> factory, float volume) :
+AUD_VolumeFactory::AUD_VolumeFactory(boost::shared_ptr<AUD_IFactory> factory, float volume) :
 		AUD_EffectFactory(factory),
 		m_volume(volume)
 {
@@ -41,10 +41,10 @@ float AUD_VolumeFactory::getVolume() const
 	return m_volume;
 }
 
-AUD_Reference<AUD_IReader> AUD_VolumeFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_VolumeFactory::createReader()
 {
 	std::vector<float> a, b;
 	a.push_back(1);
 	b.push_back(m_volume);
-	return new AUD_IIRFilterReader(getReader(), b, a);
+	return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), b, a));
 }
diff --git a/intern/audaspace/FX/AUD_VolumeFactory.h b/intern/audaspace/FX/AUD_VolumeFactory.h
index b128383..6fe779f 100644
--- a/intern/audaspace/FX/AUD_VolumeFactory.h
+++ b/intern/audaspace/FX/AUD_VolumeFactory.h
@@ -55,7 +55,7 @@ public:
 	 * \param factory The input factory.
 	 * \param volume The desired volume.
 	 */
-	AUD_VolumeFactory(AUD_Reference<AUD_IFactory> factory, float volume);
+	AUD_VolumeFactory(boost::shared_ptr<AUD_IFactory> factory, float volume);
 
 	/**
 	 * Returns the volume.
@@ -63,7 +63,7 @@ public:
 	 */
 	float getVolume() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_VOLUMEFACTORY_H__
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index f68d41f..371e000 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -31,6 +31,7 @@
 #include "AUD_IFactory.h"
 #include "AUD_IReader.h"
 #include "AUD_ConverterReader.h"
+#include "AUD_MutexLock.h"
 
 #include <cstring>
 #include <limits>
@@ -66,7 +67,7 @@ static const char* queue_error = "AUD_OpenALDevice: Buffer couldn't be "
 static const char* bufferdata_error = "AUD_OpenALDevice: Buffer couldn't be "
 									  "filled with data.";
 
-AUD_OpenALDevice::AUD_OpenALHandle::AUD_OpenALHandle(AUD_OpenALDevice* device, ALenum format, AUD_Reference<AUD_IReader> reader, bool keep) :
+AUD_OpenALDevice::AUD_OpenALHandle::AUD_OpenALHandle(AUD_OpenALDevice* device, ALenum format, boost::shared_ptr<AUD_IReader> reader, bool keep) :
 	m_isBuffered(false), m_reader(reader), m_keep(keep), m_format(format), m_current(0),
 	m_eos(false), m_loopcount(0), m_stop(NULL), m_stop_data(NULL), m_status(AUD_STATUS_PLAYING),
 	m_device(device)
@@ -125,22 +126,27 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::pause()
 {
 	if(m_status)
 	{
-		m_device->lock();
+		AUD_MutexLock lock(*m_device);
 
 		if(m_status == AUD_STATUS_PLAYING)
 		{
-			m_device->m_playingSounds.remove(this);
-			m_device->m_pausedSounds.push_back(this);
+			for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
+			{
+				if(it->get() == this)
+				{
+					boost::shared_ptr<AUD_OpenALHandle> This = *it;
 
-			alSourcePause(m_source);
+					m_device->m_playingSounds.erase(it);
+					m_device->m_pausedSounds.push_back(This);
 
-			m_status = AUD_STATUS_PAUSED;
-			m_device->unlock();
+					alSourcePause(m_source);
 
-			return true;
-		}
+					m_status = AUD_STATUS_PAUSED;
 
-		m_device->unlock();
+					return true;
+				}
+			}
+		}
 	}
 
 	return false;
@@ -150,20 +156,26 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::resume()
 {
 	if(m_status)
 	{
-		m_device->lock();
+		AUD_MutexLock lock(*m_device);
 
 		if(m_status == AUD_STATUS_PAUSED)
 		{
-			m_device->m_pausedSounds.remove(this);
-			m_device->m_playingSounds.push_back(this);
+			for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+			{
+				if(it->get() == this)
+				{
+					boost::shared_ptr<AUD_OpenALHandle> This = *it;
 
-			m_device->start();
-			m_status = AUD_STATUS_PLAYING;
-			m_device->unlock();
-			return true;
-		}
+					m_device->m_pausedSounds.erase(it);
+					m_device->m_playingSounds.push_back(This);
+
+					m_device->start();
+					m_status = AUD_STATUS_PLAYING;
 
-		m_device->unlock();
+					return true;
+				}
+			}
+		}
 	}
 
 	return false;
@@ -174,25 +186,39 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::stop()
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	// AUD_XXX Create a reference of our own object so that it doesn't get
-	// deleted before the end of this function
-	AUD_Reference<AUD_OpenALHandle> This = this;
-
-	if(m_status == AUD_STATUS_PLAYING)
-		m_device->m_playingSounds.remove(This);
-	else
-		m_device->m_pausedSounds.remove(This);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	m_status = AUD_STATUS_INVALID;
 
 	alDeleteSources(1, &m_source);
 	if(!m_isBuffered)
 		alDeleteBuffers(CYCLE_BUFFERS, m_buffers);
 
-	m_status = AUD_STATUS_INVALID;
-	return true;
+	for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			boost::shared_ptr<AUD_OpenALHandle> This = *it;
+
+			m_device->m_playingSounds.erase(it);
+
+			return true;
+		}
+	}
+
+	for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			m_device->m_pausedSounds.erase(it);
+			return true;
+		}
+	}
+
+	return false;
 }
 
 bool AUD_OpenALDevice::AUD_OpenALHandle::getKeep()
@@ -208,11 +234,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setKeep(bool keep)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	m_keep = keep;
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	m_keep = keep;
 
 	return true;
 }
@@ -222,7 +249,10 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return false;
 
 	if(m_isBuffered)
 		alSourcef(m_source, AL_SEC_OFFSET, position);
@@ -272,17 +302,18 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
 		}
 	}
 
-	m_device->unlock();
-
 	return true;
 }
 
 float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
 {
 	if(!m_status)
-		return 0.0f;
+		return false;
+
+	AUD_MutexLock lock(*m_device);
 
-	m_device->lock();
+	if(!m_status)
+		return 0.0f;
 
 	float position = 0.0f;
 
@@ -295,8 +326,6 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
 					 CYCLE_BUFFERS) / (float)specs.rate;
 	}
 
-	m_device->unlock();
-
 	return position;
 }
 
@@ -310,13 +339,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolume()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_GAIN, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_GAIN, &result);
 
 	return result;
 }
@@ -326,11 +356,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolume(float volume)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_GAIN, volume);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_GAIN, volume);
 
 	return true;
 }
@@ -340,13 +371,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPitch()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_PITCH, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_PITCH, &result);
 
 	return result;
 }
@@ -356,11 +388,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setPitch(float pitch)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_PITCH, pitch);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_PITCH, pitch);
 
 	return true;
 }
@@ -385,13 +418,14 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setStopCallback(stopCallback callback,
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return false;
 
 	m_stop = callback;
 	m_stop_data = data;
 
-	m_device->unlock();
-
 	return true;
 }
 
@@ -404,15 +438,16 @@ AUD_Vector3 AUD_OpenALDevice::AUD_OpenALHandle::getSourceLocation()
 	AUD_Vector3 result = AUD_Vector3(0, 0, 0);
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return result;
 
 	ALfloat p[3];
 	alGetSourcefv(m_source, AL_POSITION, p);
 
-	m_device->unlock();
-
 	result = AUD_Vector3(p[0], p[1], p[2]);
 
 	return result;
@@ -423,11 +458,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceLocation(const AUD_Vector3& lo
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcefv(m_source, AL_POSITION, (ALfloat*)location.get());
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcefv(m_source, AL_POSITION, (ALfloat*)location.get());
 
 	return true;
 }
@@ -437,15 +473,16 @@ AUD_Vector3 AUD_OpenALDevice::AUD_OpenALHandle::getSourceVelocity()
 	AUD_Vector3 result = AUD_Vector3(0, 0, 0);
 
 	if(!m_status)
-		return result;
+		return false;
+
+	AUD_MutexLock lock(*m_device);
 
-	m_device->lock();
+	if(!m_status)
+		return result;
 
 	ALfloat v[3];
 	alGetSourcefv(m_source, AL_VELOCITY, v);
 
-	m_device->unlock();
-
 	result = AUD_Vector3(v[0], v[1], v[2]);
 
 	return result;
@@ -456,11 +493,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceVelocity(const AUD_Vector3& ve
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcefv(m_source, AL_VELOCITY, (ALfloat*)velocity.get());
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcefv(m_source, AL_VELOCITY, (ALfloat*)velocity.get());
 
 	return true;
 }
@@ -472,9 +510,6 @@ AUD_Quaternion AUD_OpenALDevice::AUD_OpenALHandle::getSourceOrientation()
 
 bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaternion& orientation)
 {
-	if(!m_status)
-		return false;
-
 	ALfloat direction[3];
 	direction[0] = -2 * (orientation.w() * orientation.y() +
 						 orientation.x() * orientation.z());
@@ -482,11 +517,16 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaterni
 						orientation.z() * orientation.y());
 	direction[2] = 2 * (orientation.x() * orientation.x() +
 						orientation.y() * orientation.y()) - 1;
-	m_device->lock();
 
-	alSourcefv(m_source, AL_DIRECTION, direction);
+	if(!m_status)
+		return false;
+
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcefv(m_source, AL_DIRECTION, direction);
 
 	m_orientation = orientation;
 
@@ -500,11 +540,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::isRelative()
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcei(m_source, AL_SOURCE_RELATIVE, &result);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alGetSourcei(m_source, AL_SOURCE_RELATIVE, &result);
 
 	return result;
 }
@@ -514,11 +555,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setRelative(bool relative)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcei(m_source, AL_SOURCE_RELATIVE, relative);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcei(m_source, AL_SOURCE_RELATIVE, relative);
 
 	return true;
 }
@@ -528,13 +570,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolumeMaximum()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_MAX_GAIN, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_MAX_GAIN, &result);
 
 	return result;
 }
@@ -544,11 +587,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolumeMaximum(float volume)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_MAX_GAIN, volume);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_MAX_GAIN, volume);
 
 	return true;
 }
@@ -558,13 +602,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolumeMinimum()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_MIN_GAIN, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_MIN_GAIN, &result);
 
 	return result;
 }
@@ -574,11 +619,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolumeMinimum(float volume)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_MIN_GAIN, volume);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_MIN_GAIN, volume);
 
 	return true;
 }
@@ -588,13 +634,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getDistanceMaximum()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_MAX_DISTANCE, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_MAX_DISTANCE, &result);
 
 	return result;
 }
@@ -604,11 +651,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setDistanceMaximum(float distance)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_MAX_DISTANCE, distance);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_MAX_DISTANCE, distance);
 
 	return true;
 }
@@ -618,13 +666,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getDistanceReference()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_REFERENCE_DISTANCE, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_REFERENCE_DISTANCE, &result);
 
 	return result;
 }
@@ -634,11 +683,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setDistanceReference(float distance)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_REFERENCE_DISTANCE, distance);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_REFERENCE_DISTANCE, distance);
 
 	return true;
 }
@@ -648,13 +698,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getAttenuation()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_ROLLOFF_FACTOR, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_ROLLOFF_FACTOR, &result);
 
 	return result;
 }
@@ -664,11 +715,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setAttenuation(float factor)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_ROLLOFF_FACTOR, factor);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_ROLLOFF_FACTOR, factor);
 
 	return true;
 }
@@ -678,13 +730,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeAngleOuter()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_CONE_OUTER_ANGLE, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_CONE_OUTER_ANGLE, &result);
 
 	return result;
 }
@@ -694,11 +747,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeAngleOuter(float angle)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_CONE_OUTER_ANGLE, angle);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_CONE_OUTER_ANGLE, angle);
 
 	return true;
 }
@@ -708,13 +762,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeAngleInner()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_CONE_INNER_ANGLE, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_CONE_INNER_ANGLE, &result);
 
 	return result;
 }
@@ -724,11 +779,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeAngleInner(float angle)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_CONE_INNER_ANGLE, angle);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_CONE_INNER_ANGLE, angle);
 
 	return true;
 }
@@ -738,13 +794,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeVolumeOuter()
 	float result = std::numeric_limits<float>::quiet_NaN();
 
 	if(!m_status)
-		return result;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alGetSourcef(m_source, AL_CONE_OUTER_GAIN, &result);
+	if(!m_status)
+		return result;
 
-	m_device->unlock();
+	alGetSourcef(m_source, AL_CONE_OUTER_GAIN, &result);
 
 	return result;
 }
@@ -754,11 +811,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeVolumeOuter(float volume)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	alSourcef(m_source, AL_CONE_OUTER_GAIN, volume);
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	alSourcef(m_source, AL_CONE_OUTER_GAIN, volume);
 
 	return true;
 }
@@ -776,7 +834,7 @@ static void *AUD_openalRunThread(void *device)
 
 void AUD_OpenALDevice::start(bool join)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(!m_playing)
 	{
@@ -793,21 +851,19 @@ void AUD_OpenALDevice::start(bool join)
 
 		m_playing = true;
 	}
-
-	unlock();
 }
 
 void AUD_OpenALDevice::updateStreams()
 {
-	AUD_Reference<AUD_OpenALHandle> sound;
+	boost::shared_ptr<AUD_OpenALHandle> sound;
 
 	int length;
 
 	ALint info;
 	AUD_DeviceSpecs specs = m_specs;
 	ALCenum cerr;
-	std::list<AUD_Reference<AUD_OpenALHandle> > stopSounds;
-	std::list<AUD_Reference<AUD_OpenALHandle> > pauseSounds;
+	std::list<boost::shared_ptr<AUD_OpenALHandle> > stopSounds;
+	std::list<boost::shared_ptr<AUD_OpenALHandle> > pauseSounds;
 	AUD_HandleIterator it;
 
 	while(1)
@@ -970,7 +1026,6 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
 {
 	// cannot determine how many channels or which format OpenAL uses, but
 	// it at least is able to play 16 bit stereo audio
-	specs.channels = AUD_CHANNELS_STEREO;
 	specs.format = AUD_FORMAT_S16;
 
 #if 0
@@ -1009,6 +1064,11 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
 
 	m_useMC = alIsExtensionPresent("AL_EXT_MCFORMATS") == AL_TRUE;
 
+	if((!m_useMC && specs.channels > AUD_CHANNELS_STEREO) ||
+			specs.channels == AUD_CHANNELS_STEREO_LFE ||
+			specs.channels == AUD_CHANNELS_SURROUND5)
+		specs.channels = AUD_CHANNELS_STEREO;
+
 	alGetError();
 	alcGetError(m_device);
 
@@ -1161,36 +1221,36 @@ bool AUD_OpenALDevice::getFormat(ALenum &format, AUD_Specs specs)
 	return valid;
 }
 
-AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_OpenALDevice::play(boost::shared_ptr<AUD_IReader> reader, bool keep)
 {
 	AUD_Specs specs = reader->getSpecs();
 
 	// check format
 	if(specs.channels == AUD_CHANNELS_INVALID)
-		return AUD_Reference<AUD_IHandle>();
+		return boost::shared_ptr<AUD_IHandle>();
 
 	if(m_specs.format != AUD_FORMAT_FLOAT32)
-		reader = new AUD_ConverterReader(reader, m_specs);
+		reader = boost::shared_ptr<AUD_IReader>(new AUD_ConverterReader(reader, m_specs));
 
 	ALenum format;
 
 	if(!getFormat(format, specs))
-		return AUD_Reference<AUD_IHandle>();
+		return boost::shared_ptr<AUD_IHandle>();
+
+	AUD_MutexLock lock(*this);
 
-	lock();
 	alcSuspendContext(m_context);
 
-	AUD_Reference<AUD_OpenALDevice::AUD_OpenALHandle> sound;
+	boost::shared_ptr<AUD_OpenALDevice::AUD_OpenALHandle> sound;
 
 	try
 	{
 		// create the handle
-		sound = new AUD_OpenALDevice::AUD_OpenALHandle(this, format, reader, keep);
+		sound = boost::shared_ptr<AUD_OpenALDevice::AUD_OpenALHandle>(new AUD_OpenALDevice::AUD_OpenALHandle(this, format, reader, keep));
 	}
 	catch(AUD_Exception&)
 	{
 		alcProcessContext(m_context);
-		unlock();
 		throw;
 	}
 
@@ -1201,12 +1261,10 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IReader> rea
 
 	start();
 
-	unlock();
-
-	return AUD_Reference<AUD_IHandle>(sound);
+	return boost::shared_ptr<AUD_IHandle>(sound);
 }
 
-AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IFactory> factory, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_OpenALDevice::play(boost::shared_ptr<AUD_IFactory> factory, bool keep)
 {
 	/* AUD_XXX disabled
 	AUD_OpenALHandle* sound = NULL;
@@ -1285,7 +1343,8 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IFactory> fa
 
 void AUD_OpenALDevice::stopAll()
 {
-	lock();
+	AUD_MutexLock lock(*this);
+
 	alcSuspendContext(m_context);
 
 	while(!m_playingSounds.empty())
@@ -1295,7 +1354,6 @@ void AUD_OpenALDevice::stopAll()
 		m_pausedSounds.front()->stop();
 
 	alcProcessContext(m_context);
-	unlock();
 }
 
 void AUD_OpenALDevice::lock()
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
index 0a409b4..d2a4be2 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
@@ -58,7 +58,7 @@ private:
 		bool m_isBuffered;
 
 		/// The reader source.
-		AUD_Reference<AUD_IReader> m_reader;
+		boost::shared_ptr<AUD_IReader> m_reader;
 
 		/// Whether to keep the source if end of it is reached.
 		bool m_keep;
@@ -105,7 +105,7 @@ private:
 		 * \param reader The reader this handle plays.
 		 * \param keep Whether to keep the handle alive when the reader ends.
 		 */
-		AUD_OpenALHandle(AUD_OpenALDevice* device, ALenum format, AUD_Reference<AUD_IReader> reader, bool keep);
+		AUD_OpenALHandle(AUD_OpenALDevice* device, ALenum format, boost::shared_ptr<AUD_IReader> reader, bool keep);
 
 		virtual ~AUD_OpenALHandle() {}
 		virtual bool pause();
@@ -150,7 +150,7 @@ private:
 		virtual bool setConeVolumeOuter(float volume);
 	};
 
-	typedef std::list<AUD_Reference<AUD_OpenALHandle> >::iterator AUD_HandleIterator;
+	typedef std::list<boost::shared_ptr<AUD_OpenALHandle> >::iterator AUD_HandleIterator;
 
 	/**
 	 * The OpenAL device handle.
@@ -175,12 +175,12 @@ private:
 	/**
 	 * The list of sounds that are currently playing.
 	 */
-	std::list<AUD_Reference<AUD_OpenALHandle> > m_playingSounds;
+	std::list<boost::shared_ptr<AUD_OpenALHandle> > m_playingSounds;
 
 	/**
 	 * The list of sounds that are currently paused.
 	 */
-	std::list<AUD_Reference<AUD_OpenALHandle> > m_pausedSounds;
+	std::list<boost::shared_ptr<AUD_OpenALHandle> > m_pausedSounds;
 
 	/**
 	 * The list of buffered factories.
@@ -255,8 +255,8 @@ public:
 	virtual ~AUD_OpenALDevice();
 
 	virtual AUD_DeviceSpecs getSpecs() const;
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false);
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IReader> reader, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IFactory> factory, bool keep = false);
 	virtual void stopAll();
 	virtual void lock();
 	virtual void unlock();
diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp
index dd58e5a..9beba2e 100644
--- a/intern/audaspace/Python/AUD_PyAPI.cpp
+++ b/intern/audaspace/Python/AUD_PyAPI.cpp
@@ -90,7 +90,7 @@ static void
 Factory_dealloc(Factory* self)
 {
 	if(self->factory)
-		delete reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory);
+		delete reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory);
 	Py_XDECREF(self->child_list);
 	Py_TYPE(self)->tp_free((PyObject *)self);
 }
@@ -114,7 +114,7 @@ Factory_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 
 		try
 		{
-			self->factory = new AUD_Reference<AUD_IFactory>(new AUD_FileFactory(filename));
+			self->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_FileFactory(filename));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -154,7 +154,7 @@ Factory_sine(PyTypeObject* type, PyObject *args)
 	{
 		try
 		{
-			self->factory = new AUD_Reference<AUD_IFactory>(new AUD_SinusFactory(frequency, (AUD_SampleRate)rate));
+			self->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_SinusFactory(frequency, (AUD_SampleRate)rate));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -193,7 +193,7 @@ Factory_file(PyTypeObject* type, PyObject *args)
 	{
 		try
 		{
-			self->factory = new AUD_Reference<AUD_IFactory>(new AUD_FileFactory(filename));
+			self->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_FileFactory(filename));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -236,7 +236,7 @@ Factory_lowpass(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_LowpassFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), frequency, Q));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_LowpassFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), frequency, Q));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -277,7 +277,7 @@ Factory_delay(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_DelayFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), delay));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_DelayFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), delay));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -321,7 +321,7 @@ Factory_join(Factory* self, PyObject *object)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_DoubleFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(child->factory)));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_DoubleFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), *reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(child->factory)));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -364,7 +364,7 @@ Factory_highpass(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_HighpassFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), frequency, Q));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_HighpassFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), frequency, Q));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -405,7 +405,7 @@ Factory_limit(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_LimiterFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), start, end));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_LimiterFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), start, end));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -449,7 +449,7 @@ Factory_pitch(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_PitchFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), factor));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_PitchFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), factor));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -491,7 +491,7 @@ Factory_volume(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_VolumeFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), volume));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_VolumeFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), volume));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -534,7 +534,7 @@ Factory_fadein(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_FaderFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), AUD_FADE_IN, start, length));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_FaderFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), AUD_FADE_IN, start, length));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -578,7 +578,7 @@ Factory_fadeout(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_FaderFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), AUD_FADE_OUT, start, length));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_FaderFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), AUD_FADE_OUT, start, length));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -620,7 +620,7 @@ Factory_loop(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_LoopFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), loop));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_LoopFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), loop));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -663,7 +663,7 @@ Factory_mix(Factory* self, PyObject *object)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_SuperposeFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(child->factory)));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_SuperposeFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), *reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(child->factory)));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -696,7 +696,7 @@ Factory_pingpong(Factory* self)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_PingPongFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory)));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_PingPongFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory)));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -735,7 +735,7 @@ Factory_reverse(Factory* self)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_ReverseFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory)));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_ReverseFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory)));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -770,7 +770,7 @@ Factory_buffer(Factory* self)
 	{
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_StreamBufferFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory)));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_StreamBufferFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory)));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -812,7 +812,7 @@ Factory_square(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_SquareFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), threshold));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_SquareFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), threshold));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -915,7 +915,7 @@ Factory_filter(Factory* self, PyObject *args)
 
 		try
 		{
-			parent->factory = new AUD_Reference<AUD_IFactory>(new AUD_IIRFilterFactory(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(self->factory), b, a));
+			parent->factory = new boost::shared_ptr<AUD_IFactory>(new AUD_IIRFilterFactory(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(self->factory), b, a));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -1039,7 +1039,7 @@ static void
 Handle_dealloc(Handle* self)
 {
 	if(self->handle)
-		delete reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle);
+		delete reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle);
 	Py_TYPE(self)->tp_free((PyObject *)self);
 }
 
@@ -1054,7 +1054,7 @@ Handle_pause(Handle *self)
 {
 	try
 	{
-		return PyBool_FromLong((long)(*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->pause());
+		return PyBool_FromLong((long)(*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->pause());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1074,7 +1074,7 @@ Handle_resume(Handle *self)
 {
 	try
 	{
-		return PyBool_FromLong((long)(*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->resume());
+		return PyBool_FromLong((long)(*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->resume());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1095,7 +1095,7 @@ Handle_stop(Handle *self)
 {
 	try
 	{
-		return PyBool_FromLong((long)(*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->stop());
+		return PyBool_FromLong((long)(*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->stop());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1125,7 +1125,7 @@ Handle_get_position(Handle *self, void* nothing)
 {
 	try
 	{
-		return Py_BuildValue("f", (*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getPosition());
+		return Py_BuildValue("f", (*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getPosition());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1144,7 +1144,7 @@ Handle_set_position(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		if((*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->seek(position))
+		if((*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->seek(position))
 			return 0;
 		PyErr_SetString(AUDError, "Couldn't seek the sound!");
 	}
@@ -1170,7 +1170,7 @@ Handle_get_keep(Handle *self, void* nothing)
 {
 	try
 	{
-		return PyBool_FromLong((long)(*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getKeep());
+		return PyBool_FromLong((long)(*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getKeep());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1192,7 +1192,7 @@ Handle_set_keep(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		if((*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->setKeep(keep))
+		if((*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->setKeep(keep))
 			return 0;
 		PyErr_SetString(AUDError, "Couldn't set keep of the sound!");
 	}
@@ -1212,7 +1212,7 @@ Handle_get_status(Handle *self, void* nothing)
 {
 	try
 	{
-		return PyBool_FromLong((long)(*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getStatus());
+		return PyBool_FromLong((long)(*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getStatus());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1229,7 +1229,7 @@ Handle_get_volume(Handle *self, void* nothing)
 {
 	try
 	{
-		return Py_BuildValue("f", (*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getVolume());
+		return Py_BuildValue("f", (*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getVolume());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1248,7 +1248,7 @@ Handle_set_volume(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		if((*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->setVolume(volume))
+		if((*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->setVolume(volume))
 			return 0;
 		PyErr_SetString(AUDError, "Couldn't set the sound volume!");
 	}
@@ -1268,7 +1268,7 @@ Handle_get_pitch(Handle *self, void* nothing)
 {
 	try
 	{
-		return Py_BuildValue("f", (*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getPitch());
+		return Py_BuildValue("f", (*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getPitch());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1287,7 +1287,7 @@ Handle_set_pitch(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		if((*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->setPitch(pitch))
+		if((*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->setPitch(pitch))
 			return 0;
 		PyErr_SetString(AUDError, "Couldn't set the sound pitch!");
 	}
@@ -1307,7 +1307,7 @@ Handle_get_loop_count(Handle *self, void* nothing)
 {
 	try
 	{
-		return Py_BuildValue("i", (*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->getLoopCount());
+		return Py_BuildValue("i", (*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->getLoopCount());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -1326,7 +1326,7 @@ Handle_set_loop_count(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		if((*reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle))->setLoopCount(loops))
+		if((*reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle))->setLoopCount(loops))
 			return 0;
 		PyErr_SetString(AUDError, "Couldn't set the loop count!");
 	}
@@ -1346,7 +1346,7 @@ Handle_get_location(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Vector3 v = handle->getSourceLocation();
@@ -1375,7 +1375,7 @@ Handle_set_location(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Vector3 location(x, y, z);
@@ -1402,7 +1402,7 @@ Handle_get_velocity(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Vector3 v = handle->getSourceVelocity();
@@ -1431,7 +1431,7 @@ Handle_set_velocity(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Vector3 velocity(x, y, z);
@@ -1458,7 +1458,7 @@ Handle_get_orientation(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Quaternion o = handle->getSourceOrientation();
@@ -1487,7 +1487,7 @@ Handle_set_orientation(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			AUD_Quaternion orientation(w, x, y, z);
@@ -1514,7 +1514,7 @@ Handle_get_relative(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return PyBool_FromLong((long)handle->isRelative());
@@ -1545,7 +1545,7 @@ Handle_set_relative(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setRelative(relative))
@@ -1572,7 +1572,7 @@ Handle_get_volume_minimum(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getVolumeMinimum());
@@ -1600,7 +1600,7 @@ Handle_set_volume_minimum(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setVolumeMinimum(volume))
@@ -1627,7 +1627,7 @@ Handle_get_volume_maximum(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getVolumeMaximum());
@@ -1655,7 +1655,7 @@ Handle_set_volume_maximum(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setVolumeMaximum(volume))
@@ -1683,7 +1683,7 @@ Handle_get_distance_reference(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getDistanceReference());
@@ -1711,7 +1711,7 @@ Handle_set_distance_reference(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setDistanceReference(distance))
@@ -1739,7 +1739,7 @@ Handle_get_distance_maximum(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getDistanceMaximum());
@@ -1767,7 +1767,7 @@ Handle_set_distance_maximum(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setDistanceMaximum(distance))
@@ -1795,7 +1795,7 @@ Handle_get_attenuation(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getAttenuation());
@@ -1823,7 +1823,7 @@ Handle_set_attenuation(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setAttenuation(factor))
@@ -1856,7 +1856,7 @@ Handle_get_cone_angle_inner(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getConeAngleInner());
@@ -1884,7 +1884,7 @@ Handle_set_cone_angle_inner(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setConeAngleInner(angle))
@@ -1911,7 +1911,7 @@ Handle_get_cone_angle_outer(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getConeAngleOuter());
@@ -1939,7 +1939,7 @@ Handle_set_cone_angle_outer(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setConeAngleOuter(angle))
@@ -1966,7 +1966,7 @@ Handle_get_cone_volume_outer(Handle *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			return Py_BuildValue("f", handle->getConeVolumeOuter());
@@ -1994,7 +1994,7 @@ Handle_set_cone_volume_outer(Handle *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<AUD_Reference<AUD_IHandle>*>(self->handle)->get());
+		AUD_I3DHandle* handle = dynamic_cast<AUD_I3DHandle*>(reinterpret_cast<boost::shared_ptr<AUD_IHandle>*>(self->handle)->get());
 		if(handle)
 		{
 			if(handle->setConeVolumeOuter(volume))
@@ -2104,7 +2104,7 @@ static void
 Device_dealloc(Device* self)
 {
 	if(self->device)
-		delete reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device);
+		delete reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device);
 	Py_TYPE(self)->tp_free((PyObject *)self);
 }
 
@@ -2147,21 +2147,21 @@ Device_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 			{
 			case AUD_DEVICE_NULL:
 				(void)specs; /* quiet warning when others disabled */
-				self->device = new AUD_Reference<AUD_IDevice>(new AUD_NULLDevice());
+				self->device = new boost::shared_ptr<AUD_IDevice>(new AUD_NULLDevice());
 				break;
 			case AUD_DEVICE_OPENAL:
 #ifdef WITH_OPENAL
-				self->device = new AUD_Reference<AUD_IDevice>(new AUD_OpenALDevice(specs, buffersize));
+				self->device = new boost::shared_ptr<AUD_IDevice>(new AUD_OpenALDevice(specs, buffersize));
 #endif
 				break;
 			case AUD_DEVICE_SDL:
 #ifdef WITH_SDL
-				self->device = new AUD_Reference<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
+				self->device = new boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
 #endif
 				break;
 			case AUD_DEVICE_JACK:
 #ifdef WITH_JACK
-				self->device = new AUD_Reference<AUD_IDevice>(new AUD_JackDevice(name, specs, buffersize));
+				self->device = new boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice(name, specs, buffersize));
 #endif
 				break;
 			case AUD_DEVICE_READ:
@@ -2236,7 +2236,7 @@ Device_play(Device *self, PyObject *args, PyObject *kwds)
 	{
 		try
 		{
-			handle->handle = new AUD_Reference<AUD_IHandle>((*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->play(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->factory), keep));
+			handle->handle = new boost::shared_ptr<AUD_IHandle>((*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->play(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(sound->factory), keep));
 		}
 		catch(AUD_Exception& e)
 		{
@@ -2258,7 +2258,7 @@ Device_stopAll(Device *self)
 {
 	try
 	{
-		(*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->stopAll();
+		(*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->stopAll();
 		Py_RETURN_NONE;
 	}
 	catch(AUD_Exception& e)
@@ -2284,7 +2284,7 @@ Device_lock(Device *self)
 {
 	try
 	{
-		(*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->lock();
+		(*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->lock();
 		Py_RETURN_NONE;
 	}
 	catch(AUD_Exception& e)
@@ -2304,7 +2304,7 @@ Device_unlock(Device *self)
 {
 	try
 	{
-		(*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->unlock();
+		(*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->unlock();
 		Py_RETURN_NONE;
 	}
 	catch(AUD_Exception& e)
@@ -2338,7 +2338,7 @@ Device_get_rate(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_DeviceSpecs specs = (*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->getSpecs();
+		AUD_DeviceSpecs specs = (*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->getSpecs();
 		return Py_BuildValue("d", specs.rate);
 	}
 	catch(AUD_Exception& e)
@@ -2356,7 +2356,7 @@ Device_get_format(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_DeviceSpecs specs = (*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->getSpecs();
+		AUD_DeviceSpecs specs = (*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->getSpecs();
 		return Py_BuildValue("i", specs.format);
 	}
 	catch(AUD_Exception& e)
@@ -2374,7 +2374,7 @@ Device_get_channels(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_DeviceSpecs specs = (*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->getSpecs();
+		AUD_DeviceSpecs specs = (*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->getSpecs();
 		return Py_BuildValue("i", specs.channels);
 	}
 	catch(AUD_Exception& e)
@@ -2392,7 +2392,7 @@ Device_get_volume(Device *self, void* nothing)
 {
 	try
 	{
-		return Py_BuildValue("f", (*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->getVolume());
+		return Py_BuildValue("f", (*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->getVolume());
 	}
 	catch(AUD_Exception& e)
 	{
@@ -2411,7 +2411,7 @@ Device_set_volume(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		(*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->setVolume(volume);
+		(*reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device))->setVolume(volume);
 		return 0;
 	}
 	catch(AUD_Exception& e)
@@ -2429,7 +2429,7 @@ Device_get_listener_location(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Vector3 v = device->getListenerLocation();
@@ -2458,7 +2458,7 @@ Device_set_listener_location(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Vector3 location(x, y, z);
@@ -2484,7 +2484,7 @@ Device_get_listener_velocity(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Vector3 v = device->getListenerVelocity();
@@ -2513,7 +2513,7 @@ Device_set_listener_velocity(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Vector3 velocity(x, y, z);
@@ -2539,7 +2539,7 @@ Device_get_listener_orientation(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Quaternion o = device->getListenerOrientation();
@@ -2568,7 +2568,7 @@ Device_set_listener_orientation(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			AUD_Quaternion orientation(w, x, y, z);
@@ -2595,7 +2595,7 @@ Device_get_speed_of_sound(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			return Py_BuildValue("f", device->getSpeedOfSound());
@@ -2623,7 +2623,7 @@ Device_set_speed_of_sound(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			device->setSpeedOfSound(speed);
@@ -2651,7 +2651,7 @@ Device_get_doppler_factor(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			return Py_BuildValue("f", device->getDopplerFactor());
@@ -2679,7 +2679,7 @@ Device_set_doppler_factor(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			device->setDopplerFactor(factor);
@@ -2705,7 +2705,7 @@ Device_get_distance_model(Device *self, void* nothing)
 {
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			return Py_BuildValue("i", int(device->getDistanceModel()));
@@ -2733,7 +2733,7 @@ Device_set_distance_model(Device *self, PyObject *args, void* nothing)
 
 	try
 	{
-		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device)->get());
+		AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(reinterpret_cast<boost::shared_ptr<AUD_IDevice>*>(self->device)->get());
 		if(device)
 		{
 			device->setDistanceModel(AUD_DistanceModel(model));
diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript
index 50c81db..e2b6efa 100644
--- a/intern/audaspace/SConscript
+++ b/intern/audaspace/SConscript
@@ -3,7 +3,7 @@
 Import ('env')
 
 sources = env.Glob('intern/*.cpp') + env.Glob('FX/*.cpp')
-incs = '. intern FX ' + env['BF_PTHREADS_INC']
+incs = '. intern FX ' + env['BF_PTHREADS_INC'] + ' ' + env['BF_BOOST_INC']
 defs = []
 
 if env['WITH_BF_FFMPEG']:
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
index c4c384f..403c367 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
@@ -46,10 +46,10 @@ AUD_FFMPEGFactory::AUD_FFMPEGFactory(const data_t* buffer, int size) :
 	memcpy(m_buffer->getBuffer(), buffer, size);
 }
 
-AUD_Reference<AUD_IReader> AUD_FFMPEGFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_FFMPEGFactory::createReader()
 {
-	if(m_buffer.isNull())
-		return new AUD_FFMPEGReader(m_filename);
+	if(m_buffer.get())
+		return boost::shared_ptr<AUD_IReader>(new AUD_FFMPEGReader(m_buffer));
 	else
-		return new AUD_FFMPEGReader(m_buffer);
+		return boost::shared_ptr<AUD_IReader>(new AUD_FFMPEGReader(m_filename));
 }
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
index 349f55d..23d0f07 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
@@ -31,10 +31,10 @@
 #define __AUD_FFMPEGFACTORY_H__
 
 #include "AUD_IFactory.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
 #include <string>
+#include <boost/shared_ptr.hpp>
 
 /**
  * This factory reads a sound file via ffmpeg.
@@ -52,7 +52,7 @@ private:
 	/**
 	 * The buffer to read from.
 	 */
-	AUD_Reference<AUD_Buffer> m_buffer;
+	boost::shared_ptr<AUD_Buffer> m_buffer;
 
 	// hide copy constructor and operator=
 	AUD_FFMPEGFactory(const AUD_FFMPEGFactory&);
@@ -72,7 +72,7 @@ public:
 	 */
 	AUD_FFMPEGFactory(const data_t* buffer, int size);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_FFMPEGFACTORY_H__
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index 28a14a9..0a3d0f8 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -197,7 +197,7 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(std::string filename) :
 static const char* streamopen_error = "AUD_FFMPEGReader: Stream couldn't be "
 									  "opened.";
 
-AUD_FFMPEGReader::AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer) :
+AUD_FFMPEGReader::AUD_FFMPEGReader(boost::shared_ptr<AUD_Buffer> buffer) :
 		m_pkgbuf(AVCODEC_MAX_AUDIO_FRAME_SIZE<<1),
 		m_membuffer(buffer),
 		m_membufferpos(0)
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
index 2b354b0..d5d9fb3 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
@@ -32,10 +32,10 @@
 
 #include "AUD_ConverterFunctions.h"
 #include "AUD_IReader.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
 #include <string>
+#include <boost/shared_ptr.hpp>
 
 struct AVCodecContext;
 extern "C" {
@@ -99,7 +99,7 @@ private:
 	/**
 	 * The memory file to read from.
 	 */
-	AUD_Reference<AUD_Buffer> m_membuffer;
+	boost::shared_ptr<AUD_Buffer> m_membuffer;
 
 	/**
 	 * The buffer to read with.
@@ -143,7 +143,7 @@ public:
 	 * \exception AUD_Exception Thrown if the buffer specified cannot be read
 	 *                          with ffmpeg.
 	 */
-	AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer);
+	AUD_FFMPEGReader(boost::shared_ptr<AUD_Buffer> buffer);
 
 	/**
 	 * Destroys the reader and closes the file.
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.cpp b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
index 8a5c538..0b333e6 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.cpp
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
@@ -28,6 +28,7 @@
 
 
 #include "AUD_AnimateableProperty.h"
+#include "AUD_MutexLock.h"
 
 #include <cstring>
 #include <cmath>
@@ -63,17 +64,15 @@ void AUD_AnimateableProperty::unlock()
 
 void AUD_AnimateableProperty::write(const float* data)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_isAnimated = false;
 	memcpy(getBuffer(), data, m_count * sizeof(float));
-
-	unlock();
 }
 
 void AUD_AnimateableProperty::write(const float* data, int position, int count)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_isAnimated = true;
 
@@ -87,18 +86,15 @@ void AUD_AnimateableProperty::write(const float* data, int position, int count)
 
 	for(int i = pos; i < position; i++)
 		memcpy(buf + i * m_count, buf + (pos - 1) * m_count, m_count * sizeof(float));
-
-	unlock();
 }
 
 void AUD_AnimateableProperty::read(float position, float* out)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(!m_isAnimated)
 	{
 		memcpy(out, getBuffer(), m_count * sizeof(float));
-		unlock();
 		return;
 	}
 
@@ -147,8 +143,6 @@ void AUD_AnimateableProperty::read(float position, float* out)
 					 (t3 - 2 * t2 + t) * m0 + (t3 - t2) * m1;
 		}
 	}
-
-	unlock();
 }
 
 bool AUD_AnimateableProperty::isAnimated() const
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.h b/intern/audaspace/intern/AUD_AnimateableProperty.h
index 2f25e33..322748a 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.h
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.h
@@ -31,13 +31,14 @@
 #define __AUD_ANIMATEABLEPROPERTY_H__
 
 #include "AUD_Buffer.h"
+#include "AUD_ILockable.h"
 
 #include <pthread.h>
 
 /**
  * This class saves animation data for float properties.
  */
-class AUD_AnimateableProperty : private AUD_Buffer
+class AUD_AnimateableProperty : private AUD_Buffer, public AUD_ILockable
 {
 private:
 	/// The count of floats for a single property.
@@ -68,12 +69,12 @@ public:
 	/**
 	 * Locks the property.
 	 */
-	void lock();
+	virtual void lock();
 
 	/**
 	 * Unlocks the previously locked property.
 	 */
-	void unlock();
+	virtual void unlock();
 
 	/**
 	 * Writes the properties value and marks it non-animated.
diff --git a/intern/audaspace/intern/AUD_BufferReader.cpp b/intern/audaspace/intern/AUD_BufferReader.cpp
index dbff700..b9d819f 100644
--- a/intern/audaspace/intern/AUD_BufferReader.cpp
+++ b/intern/audaspace/intern/AUD_BufferReader.cpp
@@ -33,7 +33,7 @@
 
 #include <cstring>
 
-AUD_BufferReader::AUD_BufferReader(AUD_Reference<AUD_Buffer> buffer,
+AUD_BufferReader::AUD_BufferReader(boost::shared_ptr<AUD_Buffer> buffer,
 								   AUD_Specs specs) :
 	m_position(0), m_buffer(buffer), m_specs(specs)
 {
diff --git a/intern/audaspace/intern/AUD_BufferReader.h b/intern/audaspace/intern/AUD_BufferReader.h
index 0e8c5de..d0c90ce 100644
--- a/intern/audaspace/intern/AUD_BufferReader.h
+++ b/intern/audaspace/intern/AUD_BufferReader.h
@@ -31,9 +31,10 @@
 #define __AUD_BUFFERREADER_H__
 
 #include "AUD_IReader.h"
-#include "AUD_Reference.h"
 class AUD_Buffer;
 
+#include <boost/shared_ptr.hpp>
+
 /**
  * This class represents a simple reader from a buffer that exists in memory.
  * \warning Notice that the buffer used for creating the reader must exist as
@@ -50,7 +51,7 @@ private:
 	/**
 	 * The buffer that is read.
 	 */
-	AUD_Reference<AUD_Buffer> m_buffer;
+	boost::shared_ptr<AUD_Buffer> m_buffer;
 
 	/**
 	 * The specification of the sample data in the buffer.
@@ -67,7 +68,7 @@ public:
 	 * \param buffer The buffer to read from.
 	 * \param specs The specification of the sample data in the buffer.
 	 */
-	AUD_BufferReader(AUD_Reference<AUD_Buffer> buffer, AUD_Specs specs);
+	AUD_BufferReader(boost::shared_ptr<AUD_Buffer> buffer, AUD_Specs specs);
 
 	virtual bool isSeekable() const;
 	virtual void seek(int position);
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 46bba23..3150c1a 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -68,6 +68,7 @@
 #include "AUD_SequencerFactory.h"
 #include "AUD_SequencerEntry.h"
 #include "AUD_SilenceFactory.h"
+#include "AUD_MutexLock.h"
 
 #ifdef WITH_SDL
 #include "AUD_SDLDevice.h"
@@ -90,10 +91,10 @@ extern "C" {
 
 #include <cassert>
 
-typedef AUD_Reference<AUD_IFactory> AUD_Sound;
-typedef AUD_Reference<AUD_ReadDevice> AUD_Device;
-typedef AUD_Reference<AUD_IHandle> AUD_Handle;
-typedef AUD_Reference<AUD_SequencerEntry> AUD_SEntry;
+typedef boost::shared_ptr<AUD_IFactory> AUD_Sound;
+typedef boost::shared_ptr<AUD_ReadDevice> AUD_Device;
+typedef boost::shared_ptr<AUD_IHandle> AUD_Handle;
+typedef boost::shared_ptr<AUD_SequencerEntry> AUD_SEntry;
 
 #define AUD_CAPI_IMPLEMENTATION
 #include "AUD_C-API.h"
@@ -102,7 +103,7 @@ typedef AUD_Reference<AUD_SequencerEntry> AUD_SEntry;
 #  define NULL (void *)0
 #endif
 
-static AUD_Reference<AUD_IDevice> AUD_device;
+static boost::shared_ptr<AUD_IDevice> AUD_device;
 static AUD_I3DDevice *AUD_3ddevice;
 
 void AUD_initOnce()
@@ -114,25 +115,25 @@ void AUD_initOnce()
 
 int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
 {
-	AUD_Reference<AUD_IDevice> dev;
+	boost::shared_ptr<AUD_IDevice> dev;
 
-	if (!AUD_device.isNull()) {
+	if (AUD_device.get()) {
 		AUD_exit();
 	}
 
 	try {
 		switch(device) {
 		case AUD_NULL_DEVICE:
-			dev = new AUD_NULLDevice();
+			dev = boost::shared_ptr<AUD_IDevice>(new AUD_NULLDevice());
 			break;
 #ifdef WITH_SDL
 		case AUD_SDL_DEVICE:
-			dev = new AUD_SDLDevice(specs, buffersize);
+			dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
 			break;
 #endif
 #ifdef WITH_OPENAL
 		case AUD_OPENAL_DEVICE:
-			dev = new AUD_OpenALDevice(specs, buffersize);
+			dev = boost::shared_ptr<AUD_IDevice>(new AUD_OpenALDevice(specs, buffersize));
 			break;
 #endif
 #ifdef WITH_JACK
@@ -146,7 +147,7 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
 			else
 			{
 #endif
-				dev = new AUD_JackDevice("Blender", specs, buffersize);
+				dev = boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice("Blender", specs, buffersize));
 				break;
 #ifdef __APPLE__
 			}
@@ -169,17 +170,17 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
 
 void AUD_exit()
 {
-	AUD_device = AUD_Reference<AUD_IDevice>();
+	AUD_device = boost::shared_ptr<AUD_IDevice>();
 	AUD_3ddevice = NULL;
 }
 
 #ifdef WITH_PYTHON
 static PyObject *AUD_getCDevice(PyObject *self)
 {
-	if (!AUD_device.isNull()) {
+	if (AUD_device.get()) {
 		Device *device = (Device *)Device_empty();
 		if (device != NULL) {
-			device->device = new AUD_Reference<AUD_IDevice>(AUD_device);
+			device->device = new boost::shared_ptr<AUD_IDevice>(AUD_device);
 			return (PyObject *)device;
 		}
 	}
@@ -205,12 +206,12 @@ static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
 
 	if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
 		if (lptr) {
-			AUD_Reference<AUD_IFactory>* factory = (AUD_Reference<AUD_IFactory>*) sound_get_factory((void *) lptr);
+			boost::shared_ptr<AUD_IFactory>* factory = (boost::shared_ptr<AUD_IFactory>*) sound_get_factory((void *) lptr);
 
 			if (factory) {
 				Factory *obj = (Factory *)Factory_empty();
 				if (obj) {
-					obj->factory = new AUD_Reference<AUD_IFactory>(*factory);
+					obj->factory = new boost::shared_ptr<AUD_IFactory>(*factory);
 					return (PyObject *) obj;
 				}
 			}
@@ -245,7 +246,7 @@ void *AUD_getPythonFactory(AUD_Sound *sound)
 	if (sound) {
 		Factory *obj = (Factory *) Factory_empty();
 		if (obj) {
-			obj->factory = new AUD_Reference<AUD_IFactory>(*sound);
+			obj->factory = new boost::shared_ptr<AUD_IFactory>(*sound);
 			return (PyObject *) obj;
 		}
 	}
@@ -260,7 +261,7 @@ AUD_Sound *AUD_getPythonSound(void *sound)
 	if (!factory)
 		return NULL;
 
-	return new AUD_Reference<AUD_IFactory>(*reinterpret_cast<AUD_Reference<AUD_IFactory>*>(factory->factory));
+	return new boost::shared_ptr<AUD_IFactory>(*reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(factory->factory));
 }
 
 #endif
@@ -285,9 +286,9 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
 	info.length = 0.0f;
 
 	try {
-		AUD_Reference<AUD_IReader> reader = (*sound)->createReader();
+		boost::shared_ptr<AUD_IReader> reader = (*sound)->createReader();
 
-		if (!reader.isNull()) {
+		if (reader.get()) {
 			info.specs = reader->getSpecs();
 			info.length = reader->getLength() / (float) info.specs.rate;
 		}
@@ -431,7 +432,7 @@ AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
 	assert(sound);
 	try {
 		AUD_Handle handle = AUD_device->play(*sound, keep);
-		if (!handle.isNull()) {
+		if (handle.get()) {
 			return new AUD_Handle(handle);
 		}
 	}
@@ -551,9 +552,9 @@ int AUD_setDistanceModel(AUD_DistanceModel model)
 int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		AUD_Vector3 v(location[0], location[1], location[2]);
 		return h->setSourceLocation(v);
 	}
@@ -564,9 +565,9 @@ int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
 int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		AUD_Vector3 v(velocity[0], velocity[1], velocity[2]);
 		return h->setSourceVelocity(v);
 	}
@@ -577,9 +578,9 @@ int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
 int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		AUD_Quaternion q(orientation[3], orientation[0], orientation[1], orientation[2]);
 		return h->setSourceOrientation(q);
 	}
@@ -590,9 +591,9 @@ int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
 int AUD_setRelative(AUD_Handle *handle, int relative)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setRelative(relative);
 	}
 
@@ -602,9 +603,9 @@ int AUD_setRelative(AUD_Handle *handle, int relative)
 int AUD_setVolumeMaximum(AUD_Handle *handle, float volume)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setVolumeMaximum(volume);
 	}
 
@@ -614,9 +615,9 @@ int AUD_setVolumeMaximum(AUD_Handle *handle, float volume)
 int AUD_setVolumeMinimum(AUD_Handle *handle, float volume)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setVolumeMinimum(volume);
 	}
 
@@ -626,9 +627,9 @@ int AUD_setVolumeMinimum(AUD_Handle *handle, float volume)
 int AUD_setDistanceMaximum(AUD_Handle *handle, float distance)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setDistanceMaximum(distance);
 	}
 
@@ -638,9 +639,9 @@ int AUD_setDistanceMaximum(AUD_Handle *handle, float distance)
 int AUD_setDistanceReference(AUD_Handle *handle, float distance)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setDistanceReference(distance);
 	}
 
@@ -650,9 +651,9 @@ int AUD_setDistanceReference(AUD_Handle *handle, float distance)
 int AUD_setAttenuation(AUD_Handle *handle, float factor)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setAttenuation(factor);
 	}
 
@@ -662,9 +663,9 @@ int AUD_setAttenuation(AUD_Handle *handle, float factor)
 int AUD_setConeAngleOuter(AUD_Handle *handle, float angle)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setConeAngleOuter(angle);
 	}
 
@@ -674,9 +675,9 @@ int AUD_setConeAngleOuter(AUD_Handle *handle, float angle)
 int AUD_setConeAngleInner(AUD_Handle *handle, float angle)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setConeAngleInner(angle);
 	}
 
@@ -686,9 +687,9 @@ int AUD_setConeAngleInner(AUD_Handle *handle, float angle)
 int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume)
 {
 	assert(handle);
-	AUD_Reference<AUD_I3DHandle> h(*handle);
+	boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
 
-	if (!h.isNull()) {
+	if (h.get()) {
 		return h->setConeVolumeOuter(volume);
 	}
 
@@ -733,7 +734,7 @@ AUD_Handle *AUD_playDevice(AUD_Device *device, AUD_Sound *sound, float seek)
 
 	try {
 		AUD_Handle handle = (*device)->play(*sound);
-		if (!handle.isNull()) {
+		if (handle.get()) {
 			handle->seek(seek);
 			return new AUD_Handle(handle);
 		}
@@ -792,38 +793,38 @@ float *AUD_readSoundBuffer(const char *filename, float low, float high,
 	AUD_DeviceSpecs specs;
 	specs.channels = AUD_CHANNELS_MONO;
 	specs.rate = (AUD_SampleRate)samplerate;
-	AUD_Reference<AUD_IFactory> sound;
+	boost::shared_ptr<AUD_IFactory> sound;
 
-	AUD_Reference<AUD_IFactory> file = new AUD_FileFactory(filename);
+	boost::shared_ptr<AUD_IFactory> file = boost::shared_ptr<AUD_IFactory>(new AUD_FileFactory(filename));
 
 	int position = 0;
 
 	try {
-		AUD_Reference<AUD_IReader> reader = file->createReader();
+		boost::shared_ptr<AUD_IReader> reader = file->createReader();
 
 		AUD_SampleRate rate = reader->getSpecs().rate;
 
-		sound = new AUD_ChannelMapperFactory(file, specs);
+		sound = boost::shared_ptr<AUD_IFactory>(new AUD_ChannelMapperFactory(file, specs));
 
 		if (high < rate)
-			sound = new AUD_LowpassFactory(sound, high);
+			sound = boost::shared_ptr<AUD_IFactory>(new AUD_LowpassFactory(sound, high));
 		if (low > 0)
-			sound = new AUD_HighpassFactory(sound, low);
+			sound = boost::shared_ptr<AUD_IFactory>(new AUD_HighpassFactory(sound, low));
 
-		sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f);
-		sound = new AUD_LinearResampleFactory(sound, specs);
+		sound = boost::shared_ptr<AUD_IFactory>(new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f));
+		sound = boost::shared_ptr<AUD_IFactory>(new AUD_LinearResampleFactory(sound, specs));
 
 		if (square)
-			sound = new AUD_SquareFactory(sound, sthreshold);
+			sound = boost::shared_ptr<AUD_IFactory>(new AUD_SquareFactory(sound, sthreshold));
 
 		if (accumulate)
-			sound = new AUD_AccumulatorFactory(sound, additive);
+			sound = boost::shared_ptr<AUD_IFactory>(new AUD_AccumulatorFactory(sound, additive));
 		else if (additive)
-			sound = new AUD_SumFactory(sound);
+			sound = boost::shared_ptr<AUD_IFactory>(new AUD_SumFactory(sound));
 
 		reader = sound->createReader();
 
-		if (reader.isNull())
+		if (!reader.get())
 			return NULL;
 
 		int len;
@@ -855,16 +856,15 @@ static void pauseSound(AUD_Handle *handle)
 
 AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
 {
-	AUD_Reference<AUD_IFactory> silence = new AUD_SilenceFactory;
-	AUD_Reference<AUD_IFactory> limiter = new AUD_LimiterFactory(silence, 0, seconds);
+	boost::shared_ptr<AUD_IFactory> silence = boost::shared_ptr<AUD_IFactory>(new AUD_SilenceFactory);
+	boost::shared_ptr<AUD_IFactory> limiter = boost::shared_ptr<AUD_IFactory>(new AUD_LimiterFactory(silence, 0, seconds));
 
-	AUD_device->lock();
+	AUD_MutexLock lock(*AUD_device);
 
 	try {
 		AUD_Handle handle2 = AUD_device->play(limiter);
-		if (!handle2.isNull()) {
+		if (handle2.get()) {
 			handle2->setStopCallback((stopCallback)pauseSound, handle);
-			AUD_device->unlock();
 			return new AUD_Handle(handle2);
 		}
 	}
@@ -872,8 +872,6 @@ AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
 	{
 	}
 
-	AUD_device->unlock();
-
 	return NULL;
 }
 
@@ -883,7 +881,7 @@ AUD_Sound *AUD_createSequencer(float fps, int muted)
 	AUD_Specs specs;
 	specs.channels = AUD_CHANNELS_STEREO;
 	specs.rate = AUD_RATE_44100;
-	AUD_Sound *sequencer = new AUD_Sound(AUD_Reference<AUD_SequencerFactory>(new AUD_SequencerFactory(specs, fps, muted)));
+	AUD_Sound *sequencer = new AUD_Sound(boost::shared_ptr<AUD_SequencerFactory>(new AUD_SequencerFactory(specs, fps, muted)));
 	return sequencer;
 }
 
@@ -1072,7 +1070,7 @@ int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_pe
 	specs.channels = AUD_CHANNELS_MONO;
 	specs.format = AUD_FORMAT_INVALID;
 
-	AUD_Reference<AUD_IReader> reader = AUD_ChannelMapperFactory(*sound, specs).createReader();
+	boost::shared_ptr<AUD_IReader> reader = AUD_ChannelMapperFactory(*sound, specs).createReader();
 
 	specs.specs = reader->getSpecs();
 	int len;
@@ -1126,7 +1124,7 @@ int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_pe
 
 AUD_Sound *AUD_copy(AUD_Sound *sound)
 {
-	return new AUD_Reference<AUD_IFactory>(*sound);
+	return new boost::shared_ptr<AUD_IFactory>(*sound);
 }
 
 void AUD_freeHandle(AUD_Handle *handle)
@@ -1178,9 +1176,9 @@ const char *AUD_mixdown(AUD_Sound *sound, unsigned int start, unsigned int lengt
 		AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sound->get());
 
 		f->setSpecs(specs.specs);
-		AUD_Reference<AUD_IReader> reader = f->createQualityReader();
+		boost::shared_ptr<AUD_IReader> reader = f->createQualityReader();
 		reader->seek(start);
-		AUD_Reference<AUD_IWriter> writer = AUD_FileWriter::createWriter(filename, specs, format, codec, bitrate);
+		boost::shared_ptr<AUD_IWriter> writer = AUD_FileWriter::createWriter(filename, specs, format, codec, bitrate);
 		AUD_FileWriter::writeReader(reader, writer, length, buffersize);
 
 		return NULL;
@@ -1198,7 +1196,7 @@ const char *AUD_mixdown_per_channel(AUD_Sound *sound, unsigned int start, unsign
 
 		f->setSpecs(specs.specs);
 
-		std::vector<AUD_Reference<AUD_IWriter> > writers;
+		std::vector<boost::shared_ptr<AUD_IWriter> > writers;
 
 		int channels = specs.channels;
 		specs.channels = AUD_CHANNELS_MONO;
@@ -1222,7 +1220,7 @@ const char *AUD_mixdown_per_channel(AUD_Sound *sound, unsigned int start, unsign
 			writers.push_back(AUD_FileWriter::createWriter(stream.str(), specs, format, codec, bitrate));
 		}
 
-		AUD_Reference<AUD_IReader> reader = f->createQualityReader();
+		boost::shared_ptr<AUD_IReader> reader = f->createQualityReader();
 		reader->seek(start);
 		AUD_FileWriter::writeReader(reader, writers, length, buffersize);
 
@@ -1244,7 +1242,7 @@ AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, f
 		dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(specs.specs);
 
 		AUD_Handle handle = device->play(*sequencer);
-		if (!handle.isNull()) {
+		if (handle.get()) {
 			handle->seek(start);
 		}
 
@@ -1256,7 +1254,7 @@ AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, f
 	}
 }
 
-AUD_Reference<AUD_IDevice> AUD_getDevice()
+boost::shared_ptr<AUD_IDevice> AUD_getDevice()
 {
 	return AUD_device;
 }
diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h
index 75e3456..9c6611f 100644
--- a/intern/audaspace/intern/AUD_C-API.h
+++ b/intern/audaspace/intern/AUD_C-API.h
@@ -755,7 +755,7 @@ extern AUD_Sound *AUD_getPythonSound(void *sound);
 #ifdef __cplusplus
 }
 
-#include "AUD_Reference.h"
+#include <boost/shared_ptr.hpp>
 class AUD_IDevice;
 class AUD_I3DDevice;
 
@@ -763,7 +763,7 @@ class AUD_I3DDevice;
  * Returns the current playback device.
  * \return The playback device.
  */
-AUD_Reference<AUD_IDevice> AUD_getDevice();
+boost::shared_ptr<AUD_IDevice> AUD_getDevice();
 
 /**
  * Returns the current playback 3D device.
diff --git a/intern/audaspace/intern/AUD_ChannelMapperFactory.cpp b/intern/audaspace/intern/AUD_ChannelMapperFactory.cpp
index 7743ccf..f4ba5d0 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperFactory.cpp
+++ b/intern/audaspace/intern/AUD_ChannelMapperFactory.cpp
@@ -32,14 +32,14 @@
 
 #include <cstring>
 
-AUD_ChannelMapperFactory::AUD_ChannelMapperFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_ChannelMapperFactory::AUD_ChannelMapperFactory(boost::shared_ptr<AUD_IFactory> factory,
 												   AUD_DeviceSpecs specs) :
 		AUD_MixerFactory(factory, specs)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_ChannelMapperFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_ChannelMapperFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader = getReader();
-	return new AUD_ChannelMapperReader(reader, m_specs.channels);
+	boost::shared_ptr<AUD_IReader> reader = getReader();
+	return boost::shared_ptr<AUD_IReader>(new AUD_ChannelMapperReader(reader, m_specs.channels));
 }
diff --git a/intern/audaspace/intern/AUD_ChannelMapperFactory.h b/intern/audaspace/intern/AUD_ChannelMapperFactory.h
index b60a32d..611b504 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperFactory.h
+++ b/intern/audaspace/intern/AUD_ChannelMapperFactory.h
@@ -49,9 +49,9 @@ public:
 	 * \param factory The input factory.
 	 * \param specs The target specifications.
 	 */
-	AUD_ChannelMapperFactory(AUD_Reference<AUD_IFactory> factory, AUD_DeviceSpecs specs);
+	AUD_ChannelMapperFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_DeviceSpecs specs);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_CHANNELMAPPERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
index 6179609..8b983d5 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
+++ b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
@@ -38,7 +38,7 @@
 
 #include "AUD_ChannelMapperReader.h"
 
-AUD_ChannelMapperReader::AUD_ChannelMapperReader(AUD_Reference<AUD_IReader> reader,
+AUD_ChannelMapperReader::AUD_ChannelMapperReader(boost::shared_ptr<AUD_IReader> reader,
 												 AUD_Channels channels) :
 		AUD_EffectReader(reader), m_target_channels(channels),
 	m_source_channels(AUD_CHANNELS_INVALID), m_mapping(0), m_map_size(0), m_mono_angle(0)
@@ -67,10 +67,12 @@ void AUD_ChannelMapperReader::setMonoAngle(float angle)
 
 float AUD_ChannelMapperReader::angleDistance(float alpha, float beta)
 {
-	alpha = fabs(alpha - beta);
+	alpha = beta - alpha;
 
 	if(alpha > M_PI)
-		alpha = fabs(alpha - 2 * M_PI);
+		alpha -= 2 * M_PI;
+	if(alpha < -M_PI)
+		alpha += 2 * M_PI;
 
 	return alpha;
 }
@@ -107,8 +109,8 @@ void AUD_ChannelMapperReader::calculateMapping()
 	if(m_source_channels == AUD_CHANNELS_MONO)
 		source_angles = &m_mono_angle;
 
-	int channel_min1, channel_min2;
-	float angle_min1, angle_min2, angle;
+	int channel_left, channel_right;
+	float angle_left, angle_right, angle;
 
 	for(int i = 0; i < m_source_channels; i++)
 	{
@@ -120,38 +122,46 @@ void AUD_ChannelMapperReader::calculateMapping()
 			continue;
 		}
 
-		channel_min1 = channel_min2 = -1;
-		angle_min1 = angle_min2 = 2 * M_PI;
+		channel_left = channel_right = -1;
+		angle_left = -2 * M_PI;
+		angle_right = 2 * M_PI;
 
 		for(int j = 0; j < m_target_channels; j++)
 		{
 			if(j == lfe)
 				continue;
 			angle = angleDistance(source_angles[i], target_angles[j]);
-			if(angle < angle_min1)
+			if(angle < 0)
 			{
-				channel_min2 = channel_min1;
-				angle_min2 = angle_min1;
-
-				channel_min1 = j;
-				angle_min1 = angle;
+				if(angle > angle_left)
+				{
+					angle_left = angle;
+					channel_left = j;
+				}
 			}
-			else if(angle < angle_min2)
+			else
 			{
-				channel_min2 = j;
-				angle_min2 = angle;
+				if(angle < angle_right)
+				{
+					angle_right = angle;
+					channel_right = j;
+				}
 			}
 		}
 
-		angle = angle_min1 + angle_min2;
-		if(channel_min2 == -1 || angle == 0)
+		angle = angle_right - angle_left;
+		if(channel_right == -1 || angle == 0)
+		{
+			m_mapping[channel_left * m_source_channels + i] = 1;
+		}
+		else if(channel_left == -1)
 		{
-			m_mapping[channel_min1 * m_source_channels + i] = 1;
+			m_mapping[channel_right * m_source_channels + i] = 1;
 		}
 		else
 		{
-			m_mapping[channel_min1 * m_source_channels + i] = cos(M_PI_2 * angle_min1 / angle);
-			m_mapping[channel_min2 * m_source_channels + i] = cos(M_PI_2 * angle_min2 / angle);
+			m_mapping[channel_left * m_source_channels + i] = cos(M_PI_2 * angle_left / angle);
+			m_mapping[channel_right * m_source_channels + i] = cos(M_PI_2 * angle_right / angle);
 		}
 	}
 
diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.h b/intern/audaspace/intern/AUD_ChannelMapperReader.h
index 32adb05..b122b07 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperReader.h
+++ b/intern/audaspace/intern/AUD_ChannelMapperReader.h
@@ -110,7 +110,7 @@ public:
 	 * \param reader The reader to map.
 	 * \param mapping The mapping specification as two dimensional float array.
 	 */
-	AUD_ChannelMapperReader(AUD_Reference<AUD_IReader> reader, AUD_Channels channels);
+	AUD_ChannelMapperReader(boost::shared_ptr<AUD_IReader> reader, AUD_Channels channels);
 
 	/**
 	 * Destroys the reader.
diff --git a/intern/audaspace/intern/AUD_ConverterFactory.cpp b/intern/audaspace/intern/AUD_ConverterFactory.cpp
index b61f9bc..7cbf64f 100644
--- a/intern/audaspace/intern/AUD_ConverterFactory.cpp
+++ b/intern/audaspace/intern/AUD_ConverterFactory.cpp
@@ -30,18 +30,18 @@
 #include "AUD_ConverterFactory.h"
 #include "AUD_ConverterReader.h"
 
-AUD_ConverterFactory::AUD_ConverterFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_ConverterFactory::AUD_ConverterFactory(boost::shared_ptr<AUD_IFactory> factory,
 										   AUD_DeviceSpecs specs) :
 		AUD_MixerFactory(factory, specs)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_ConverterFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_ConverterFactory::createReader()
 {
-	AUD_Reference<AUD_IReader> reader = getReader();
+	boost::shared_ptr<AUD_IReader> reader = getReader();
 
 	if(m_specs.format != AUD_FORMAT_FLOAT32)
-		reader = new AUD_ConverterReader(reader, m_specs);
+		reader = boost::shared_ptr<AUD_IReader>(new AUD_ConverterReader(reader, m_specs));
 
 	return reader;
 }
diff --git a/intern/audaspace/intern/AUD_ConverterFactory.h b/intern/audaspace/intern/AUD_ConverterFactory.h
index 3211b60..2c9c82d 100644
--- a/intern/audaspace/intern/AUD_ConverterFactory.h
+++ b/intern/audaspace/intern/AUD_ConverterFactory.h
@@ -49,9 +49,9 @@ public:
 	 * \param factory The input factory.
 	 * \param specs The target specifications.
 	 */
-	AUD_ConverterFactory(AUD_Reference<AUD_IFactory> factory, AUD_DeviceSpecs specs);
+	AUD_ConverterFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_DeviceSpecs specs);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_CONVERTERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ConverterReader.cpp b/intern/audaspace/intern/AUD_ConverterReader.cpp
index 63178f3..a90a546 100644
--- a/intern/audaspace/intern/AUD_ConverterReader.cpp
+++ b/intern/audaspace/intern/AUD_ConverterReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_ConverterReader.h"
 
-AUD_ConverterReader::AUD_ConverterReader(AUD_Reference<AUD_IReader> reader,
+AUD_ConverterReader::AUD_ConverterReader(boost::shared_ptr<AUD_IReader> reader,
 										 AUD_DeviceSpecs specs) :
 	AUD_EffectReader(reader),
 	m_format(specs.format)
diff --git a/intern/audaspace/intern/AUD_ConverterReader.h b/intern/audaspace/intern/AUD_ConverterReader.h
index 2dedbd8..987b7c7 100644
--- a/intern/audaspace/intern/AUD_ConverterReader.h
+++ b/intern/audaspace/intern/AUD_ConverterReader.h
@@ -65,7 +65,7 @@ public:
 	 * \param reader The reader to convert.
 	 * \param specs The target specification.
 	 */
-	AUD_ConverterReader(AUD_Reference<AUD_IReader> reader, AUD_DeviceSpecs specs);
+	AUD_ConverterReader(boost::shared_ptr<AUD_IReader> reader, AUD_DeviceSpecs specs);
 
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
diff --git a/intern/audaspace/intern/AUD_FileFactory.cpp b/intern/audaspace/intern/AUD_FileFactory.cpp
index a27acff..f9353db 100644
--- a/intern/audaspace/intern/AUD_FileFactory.cpp
+++ b/intern/audaspace/intern/AUD_FileFactory.cpp
@@ -56,15 +56,15 @@ AUD_FileFactory::AUD_FileFactory(const data_t* buffer, int size) :
 
 static const char* read_error = "AUD_FileFactory: File couldn't be read.";
 
-AUD_Reference<AUD_IReader> AUD_FileFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_FileFactory::createReader()
 {
 #ifdef WITH_SNDFILE
 	try
 	{
-		if(m_buffer.isNull())
-			return new AUD_SndFileReader(m_filename);
+		if(m_buffer.get())
+			return boost::shared_ptr<AUD_IReader>(new AUD_SndFileReader(m_buffer));
 		else
-			return new AUD_SndFileReader(m_buffer);
+			return boost::shared_ptr<AUD_IReader>(new AUD_SndFileReader(m_filename));
 	}
 	catch(AUD_Exception&) {}
 #endif
@@ -72,10 +72,10 @@ AUD_Reference<AUD_IReader> AUD_FileFactory::createReader()
 #ifdef WITH_FFMPEG
 	try
 	{
-		if(m_buffer.isNull())
-			return new AUD_FFMPEGReader(m_filename);
+		if(m_buffer.get())
+			return boost::shared_ptr<AUD_IReader>(new AUD_FFMPEGReader(m_buffer));
 		else
-			return new AUD_FFMPEGReader(m_buffer);
+			return boost::shared_ptr<AUD_IReader>(new AUD_FFMPEGReader(m_filename));
 	}
 	catch(AUD_Exception&) {}
 #endif
diff --git a/intern/audaspace/intern/AUD_FileFactory.h b/intern/audaspace/intern/AUD_FileFactory.h
index 4ea4a93..35c8db7 100644
--- a/intern/audaspace/intern/AUD_FileFactory.h
+++ b/intern/audaspace/intern/AUD_FileFactory.h
@@ -31,10 +31,10 @@
 #define __AUD_FILEFACTORY_H__
 
 #include "AUD_IFactory.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
 #include <string>
+#include <boost/shared_ptr.hpp>
 
 /**
  * This factory tries to read a sound file via all available file readers.
@@ -50,7 +50,7 @@ private:
 	/**
 	 * The buffer to read from.
 	 */
-	AUD_Reference<AUD_Buffer> m_buffer;
+	boost::shared_ptr<AUD_Buffer> m_buffer;
 
 	// hide copy constructor and operator=
 	AUD_FileFactory(const AUD_FileFactory&);
@@ -70,7 +70,7 @@ public:
 	 */
 	AUD_FileFactory(const data_t* buffer, int size);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_FILEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_FileWriter.cpp b/intern/audaspace/intern/AUD_FileWriter.cpp
index f74021a..e3072fa 100644
--- a/intern/audaspace/intern/AUD_FileWriter.cpp
+++ b/intern/audaspace/intern/AUD_FileWriter.cpp
@@ -43,13 +43,13 @@
 
 static const char* write_error = "AUD_FileWriter: File couldn't be written.";
 
-AUD_Reference<AUD_IWriter> AUD_FileWriter::createWriter(std::string filename,AUD_DeviceSpecs specs,
+boost::shared_ptr<AUD_IWriter> AUD_FileWriter::createWriter(std::string filename,AUD_DeviceSpecs specs,
 														AUD_Container format, AUD_Codec codec, unsigned int bitrate)
 {
 #ifdef WITH_SNDFILE
 	try
 	{
-		return new AUD_SndFileWriter(filename, specs, format, codec, bitrate);
+		return boost::shared_ptr<AUD_IWriter>(new AUD_SndFileWriter(filename, specs, format, codec, bitrate));
 	}
 	catch(AUD_Exception&) {}
 #endif
@@ -57,7 +57,7 @@ AUD_Reference<AUD_IWriter> AUD_FileWriter::createWriter(std::string filename,AUD
 #ifdef WITH_FFMPEG
 	try
 	{
-		return new AUD_FFMPEGWriter(filename, specs, format, codec, bitrate);
+		return boost::shared_ptr<AUD_IWriter>(new AUD_FFMPEGWriter(filename, specs, format, codec, bitrate));
 	}
 	catch(AUD_Exception&) {}
 #endif
@@ -65,7 +65,7 @@ AUD_Reference<AUD_IWriter> AUD_FileWriter::createWriter(std::string filename,AUD
 	AUD_THROW(AUD_ERROR_SPECS, write_error);
 }
 
-void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_IWriter> writer, unsigned int length, unsigned int buffersize)
+void AUD_FileWriter::writeReader(boost::shared_ptr<AUD_IReader> reader, boost::shared_ptr<AUD_IWriter> writer, unsigned int length, unsigned int buffersize)
 {
 	AUD_Buffer buffer(buffersize * AUD_SAMPLE_SIZE(writer->getSpecs()));
 	sample_t* buf = buffer.getBuffer();
@@ -94,7 +94,7 @@ void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, AUD_Referenc
 	}
 }
 
-void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize)
+void AUD_FileWriter::writeReader(boost::shared_ptr<AUD_IReader> reader, std::vector<boost::shared_ptr<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize)
 {
 	AUD_Buffer buffer(buffersize * AUD_SAMPLE_SIZE(reader->getSpecs()));
 	AUD_Buffer buffer2(buffersize * sizeof(sample_t));
diff --git a/intern/audaspace/intern/AUD_FileWriter.h b/intern/audaspace/intern/AUD_FileWriter.h
index 385aba5..3291c1a 100644
--- a/intern/audaspace/intern/AUD_FileWriter.h
+++ b/intern/audaspace/intern/AUD_FileWriter.h
@@ -32,8 +32,7 @@
 
 #include <string>
 #include <vector>
-
-#include "AUD_Reference.h"
+#include <boost/shared_ptr.hpp>
 
 #include "AUD_IWriter.h"
 #include "AUD_IReader.h"
@@ -59,25 +58,25 @@ public:
 	 * \param bitrate The bitrate for encoding.
 	 * \return The writer to write data to.
 	 */
-	static AUD_Reference<AUD_IWriter> createWriter(std::string filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
+	static boost::shared_ptr<AUD_IWriter> createWriter(std::string filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
 
 	/**
 	 * Writes a reader to a writer.
 	 * \param reader The reader to read from.
 	 * \param writer The writer to write to.
-	 * \param length How many samples should be transfered.
-	 * \param buffersize How many samples should be transfered at once.
+	 * \param length How many samples should be transferred.
+	 * \param buffersize How many samples should be transferred at once.
 	 */
-	static void writeReader(AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
+	static void writeReader(boost::shared_ptr<AUD_IReader> reader, boost::shared_ptr<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
 
 	/**
 	 * Writes a reader to several writers.
 	 * \param reader The reader to read from.
 	 * \param writers The writers to write to.
-	 * \param length How many samples should be transfered.
-	 * \param buffersize How many samples should be transfered at once.
+	 * \param length How many samples should be transferred.
+	 * \param buffersize How many samples should be transferred at once.
 	 */
-	static void writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize);
+	static void writeReader(boost::shared_ptr<AUD_IReader> reader, std::vector<boost::shared_ptr<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize);
 };
 
 #endif //__AUD_FILEWRITER_H__
diff --git a/intern/audaspace/intern/AUD_IDevice.h b/intern/audaspace/intern/AUD_IDevice.h
index 1d6f8ca..a7f9a98 100644
--- a/intern/audaspace/intern/AUD_IDevice.h
+++ b/intern/audaspace/intern/AUD_IDevice.h
@@ -31,10 +31,12 @@
 #define __AUD_IDEVICE_H__
 
 #include "AUD_Space.h"
-#include "AUD_Reference.h"
 #include "AUD_IFactory.h"
 #include "AUD_IReader.h"
 #include "AUD_IHandle.h"
+#include "AUD_ILockable.h"
+
+#include <boost/shared_ptr.hpp>
 
 /**
  * This class represents an output device for sound sources.
@@ -44,7 +46,7 @@
  * \warning Thread safety must be insured so that no reader is beeing called
  *          twice at the same time.
  */
-class AUD_IDevice
+class AUD_IDevice : public AUD_ILockable
 {
 public:
 	/**
@@ -67,7 +69,7 @@ public:
 	 * \exception AUD_Exception Thrown if there's an unexpected (from the
 	 *            device side) error during creation of the reader.
 	 */
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false)=0;
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IReader> reader, bool keep = false)=0;
 
 	/**
 	 * Plays a sound source.
@@ -79,7 +81,7 @@ public:
 	 * \exception AUD_Exception Thrown if there's an unexpected (from the
 	 *            device side) error during creation of the reader.
 	 */
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false)=0;
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IFactory> factory, bool keep = false)=0;
 
 	/**
 	 * Stops all playing sounds.
diff --git a/intern/audaspace/intern/AUD_IFactory.h b/intern/audaspace/intern/AUD_IFactory.h
index 95b4643..7510396 100644
--- a/intern/audaspace/intern/AUD_IFactory.h
+++ b/intern/audaspace/intern/AUD_IFactory.h
@@ -31,9 +31,10 @@
 #define __AUD_IFACTORY_H__
 
 #include "AUD_Space.h"
-#include "AUD_Reference.h"
 #include "AUD_IReader.h"
 
+#include <boost/shared_ptr.hpp>
+
 /**
  * This class represents a type of sound source and saves the necessary values
  * for it. It is able to create a reader that is actually usable for playback
@@ -54,7 +55,7 @@ public:
 	 * \exception AUD_Exception An exception may be thrown if there has been
 	 *            a more unexpected error during reader creation.
 	 */
-	virtual AUD_Reference<AUD_IReader> createReader()=0;
+	virtual boost::shared_ptr<AUD_IReader> createReader()=0;
 };
 
 #endif //__AUD_IFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ILockable.h b/intern/audaspace/intern/AUD_ILockable.h
new file mode 100644
index 0000000..9bc4175
--- /dev/null
+++ b/intern/audaspace/intern/AUD_ILockable.h
@@ -0,0 +1,21 @@
+#ifndef AUD_ILOCKABLE_H
+#define AUD_ILOCKABLE_H
+
+/**
+ * This class provides an interface for lockable objects.
+ * The main reason for this interface is to be used with AUD_MutexLock.
+ */
+class AUD_ILockable
+{
+public:
+	/**
+	 * Locks the object.
+	 */
+	virtual void lock()=0;
+	/**
+	 * Unlocks the previously locked object.
+	 */
+	virtual void unlock()=0;
+};
+
+#endif // AUD_ILOCKABLE_H
diff --git a/intern/audaspace/intern/AUD_JOSResampleFactory.cpp b/intern/audaspace/intern/AUD_JOSResampleFactory.cpp
index 21aae6b..188960f 100644
--- a/intern/audaspace/intern/AUD_JOSResampleFactory.cpp
+++ b/intern/audaspace/intern/AUD_JOSResampleFactory.cpp
@@ -30,13 +30,13 @@
 #include "AUD_JOSResampleFactory.h"
 #include "AUD_JOSResampleReader.h"
 
-AUD_JOSResampleFactory::AUD_JOSResampleFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_JOSResampleFactory::AUD_JOSResampleFactory(boost::shared_ptr<AUD_IFactory> factory,
 													 AUD_DeviceSpecs specs) :
 		AUD_MixerFactory(factory, specs)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_JOSResampleFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_JOSResampleFactory::createReader()
 {
-	return new AUD_JOSResampleReader(getReader(), m_specs.specs);
+	return boost::shared_ptr<AUD_IReader>(new AUD_JOSResampleReader(getReader(), m_specs.specs));
 }
diff --git a/intern/audaspace/intern/AUD_JOSResampleFactory.h b/intern/audaspace/intern/AUD_JOSResampleFactory.h
index 6d18150..b6c2961 100644
--- a/intern/audaspace/intern/AUD_JOSResampleFactory.h
+++ b/intern/audaspace/intern/AUD_JOSResampleFactory.h
@@ -48,9 +48,9 @@ public:
 	 * \param factory The input factory.
 	 * \param specs The target specifications.
 	 */
-	AUD_JOSResampleFactory(AUD_Reference<AUD_IFactory> factory, AUD_DeviceSpecs specs);
+	AUD_JOSResampleFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_DeviceSpecs specs);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_JOSRESAMPLEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.cpp b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
index 0f7a038..62fab48 100644
--- a/intern/audaspace/intern/AUD_JOSResampleReader.cpp
+++ b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
@@ -68,7 +68,7 @@ static inline int lrint(double d)
 #define fp_rest(x) (x & ((1 << SHIFT_BITS) - 1))
 #define fp_rest_to_double(x) fp_to_double(fp_rest(x))
 
-AUD_JOSResampleReader::AUD_JOSResampleReader(AUD_Reference<AUD_IReader> reader, AUD_Specs specs) :
+AUD_JOSResampleReader::AUD_JOSResampleReader(boost::shared_ptr<AUD_IReader> reader, AUD_Specs specs) :
 	AUD_ResampleReader(reader, specs.rate),
 	m_channels(AUD_CHANNELS_INVALID),
 	m_n(0),
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.h b/intern/audaspace/intern/AUD_JOSResampleReader.h
index 94524c1..fb68e4d 100644
--- a/intern/audaspace/intern/AUD_JOSResampleReader.h
+++ b/intern/audaspace/intern/AUD_JOSResampleReader.h
@@ -123,7 +123,7 @@ public:
 	 * \param reader The reader to mix.
 	 * \param specs The target specification.
 	 */
-	AUD_JOSResampleReader(AUD_Reference<AUD_IReader> reader, AUD_Specs specs);
+	AUD_JOSResampleReader(boost::shared_ptr<AUD_IReader> reader, AUD_Specs specs);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/intern/AUD_LinearResampleFactory.cpp b/intern/audaspace/intern/AUD_LinearResampleFactory.cpp
index 7f60259..cd573f1 100644
--- a/intern/audaspace/intern/AUD_LinearResampleFactory.cpp
+++ b/intern/audaspace/intern/AUD_LinearResampleFactory.cpp
@@ -30,13 +30,13 @@
 #include "AUD_LinearResampleFactory.h"
 #include "AUD_LinearResampleReader.h"
 
-AUD_LinearResampleFactory::AUD_LinearResampleFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_LinearResampleFactory::AUD_LinearResampleFactory(boost::shared_ptr<AUD_IFactory> factory,
 													 AUD_DeviceSpecs specs) :
 		AUD_MixerFactory(factory, specs)
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_LinearResampleFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_LinearResampleFactory::createReader()
 {
-	return new AUD_LinearResampleReader(getReader(), m_specs.specs);
+	return boost::shared_ptr<AUD_IReader>(new AUD_LinearResampleReader(getReader(), m_specs.specs));
 }
diff --git a/intern/audaspace/intern/AUD_LinearResampleFactory.h b/intern/audaspace/intern/AUD_LinearResampleFactory.h
index 7d9efa0..ceb29ef 100644
--- a/intern/audaspace/intern/AUD_LinearResampleFactory.h
+++ b/intern/audaspace/intern/AUD_LinearResampleFactory.h
@@ -48,9 +48,9 @@ public:
 	 * \param factory The input factory.
 	 * \param specs The target specifications.
 	 */
-	AUD_LinearResampleFactory(AUD_Reference<AUD_IFactory> factory, AUD_DeviceSpecs specs);
+	AUD_LinearResampleFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_DeviceSpecs specs);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_LINEARRESAMPLEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_LinearResampleReader.cpp b/intern/audaspace/intern/AUD_LinearResampleReader.cpp
index aff62d7..b342b8f 100644
--- a/intern/audaspace/intern/AUD_LinearResampleReader.cpp
+++ b/intern/audaspace/intern/AUD_LinearResampleReader.cpp
@@ -34,7 +34,7 @@
 
 #define CC m_channels + channel
 
-AUD_LinearResampleReader::AUD_LinearResampleReader(AUD_Reference<AUD_IReader> reader,
+AUD_LinearResampleReader::AUD_LinearResampleReader(boost::shared_ptr<AUD_IReader> reader,
 												   AUD_Specs specs) :
 	AUD_ResampleReader(reader, specs.rate),
 	m_channels(reader->getSpecs().channels),
@@ -81,7 +81,7 @@ void AUD_LinearResampleReader::read(int& length, bool& eos, sample_t* buffer)
 	int samplesize = AUD_SAMPLE_SIZE(specs);
 	int size = length;
 	float factor = m_rate / m_reader->getSpecs().rate;
-	float spos;
+	float spos = 0.0f;
 	sample_t low, high;
 	eos = false;
 
diff --git a/intern/audaspace/intern/AUD_LinearResampleReader.h b/intern/audaspace/intern/AUD_LinearResampleReader.h
index 4f6d422..9beea25 100644
--- a/intern/audaspace/intern/AUD_LinearResampleReader.h
+++ b/intern/audaspace/intern/AUD_LinearResampleReader.h
@@ -74,7 +74,7 @@ public:
 	 * \param reader The reader to mix.
 	 * \param specs The target specification.
 	 */
-	AUD_LinearResampleReader(AUD_Reference<AUD_IReader> reader, AUD_Specs specs);
+	AUD_LinearResampleReader(boost::shared_ptr<AUD_IReader> reader, AUD_Specs specs);
 
 	virtual void seek(int position);
 	virtual int getLength() const;
diff --git a/intern/audaspace/intern/AUD_Mixer.h b/intern/audaspace/intern/AUD_Mixer.h
index 0de9b7f..3dd03b0 100644
--- a/intern/audaspace/intern/AUD_Mixer.h
+++ b/intern/audaspace/intern/AUD_Mixer.h
@@ -32,9 +32,10 @@
 
 #include "AUD_ConverterFunctions.h"
 #include "AUD_Buffer.h"
-#include "AUD_Reference.h"
 class AUD_IReader;
 
+#include <boost/shared_ptr.hpp>
+
 /**
  * This abstract class is able to mix audiosignals with same channel count
  * and sample rate and convert it to a specific output format.
diff --git a/intern/audaspace/intern/AUD_MixerFactory.cpp b/intern/audaspace/intern/AUD_MixerFactory.cpp
index 95a7291..f3f00ea 100644
--- a/intern/audaspace/intern/AUD_MixerFactory.cpp
+++ b/intern/audaspace/intern/AUD_MixerFactory.cpp
@@ -30,12 +30,12 @@
 #include "AUD_MixerFactory.h"
 #include "AUD_IReader.h"
 
-AUD_Reference<AUD_IReader> AUD_MixerFactory::getReader() const
+boost::shared_ptr<AUD_IReader> AUD_MixerFactory::getReader() const
 {
 	return m_factory->createReader();
 }
 
-AUD_MixerFactory::AUD_MixerFactory(AUD_Reference<AUD_IFactory> factory,
+AUD_MixerFactory::AUD_MixerFactory(boost::shared_ptr<AUD_IFactory> factory,
 								   AUD_DeviceSpecs specs) :
 	m_specs(specs), m_factory(factory)
 {
@@ -46,7 +46,7 @@ AUD_DeviceSpecs AUD_MixerFactory::getSpecs() const
 	return m_specs;
 }
 
-AUD_Reference<AUD_IFactory> AUD_MixerFactory::getFactory() const
+boost::shared_ptr<AUD_IFactory> AUD_MixerFactory::getFactory() const
 {
 	return m_factory;
 }
diff --git a/intern/audaspace/intern/AUD_MixerFactory.h b/intern/audaspace/intern/AUD_MixerFactory.h
index d65eb8e..1d2b6a4 100644
--- a/intern/audaspace/intern/AUD_MixerFactory.h
+++ b/intern/audaspace/intern/AUD_MixerFactory.h
@@ -46,7 +46,7 @@ protected:
 	/**
 	 * If there is no reader it is created out of this factory.
 	 */
-	AUD_Reference<AUD_IFactory> m_factory;
+	boost::shared_ptr<AUD_IFactory> m_factory;
 
 	/**
 	 * Returns the reader created out of the factory.
@@ -54,7 +54,7 @@ protected:
 	 * classes.
 	 * \return The reader to mix.
 	 */
-	AUD_Reference<AUD_IReader> getReader() const;
+	boost::shared_ptr<AUD_IReader> getReader() const;
 
 public:
 	/**
@@ -62,7 +62,7 @@ public:
 	 * \param factory The factory to create the readers to mix out of.
 	 * \param specs The target specification.
 	 */
-	AUD_MixerFactory(AUD_Reference<AUD_IFactory> factory, AUD_DeviceSpecs specs);
+	AUD_MixerFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_DeviceSpecs specs);
 
 	/**
 	 * Returns the target specification for resampling.
@@ -73,7 +73,7 @@ public:
 	 * Returns the saved factory.
 	 * \return The factory.
 	 */
-	AUD_Reference<AUD_IFactory> getFactory() const;
+	boost::shared_ptr<AUD_IFactory> getFactory() const;
 };
 
 #endif //__AUD_MIXERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_MutexLock.h b/intern/audaspace/intern/AUD_MutexLock.h
new file mode 100644
index 0000000..b6f6d2b
--- /dev/null
+++ b/intern/audaspace/intern/AUD_MutexLock.h
@@ -0,0 +1,24 @@
+#ifndef AUD_MUTEXLOCK_H
+#define AUD_MUTEXLOCK_H
+
+#include "AUD_ILockable.h"
+
+class AUD_MutexLock
+{
+public:
+	inline AUD_MutexLock(AUD_ILockable& lockable) :
+		lockable(lockable)
+	{
+		lockable.lock();
+	}
+
+	inline ~AUD_MutexLock()
+	{
+		lockable.unlock();
+	}
+
+private:
+	AUD_ILockable& lockable;
+};
+
+#endif // AUD_MUTEXLOCK_H
diff --git a/intern/audaspace/intern/AUD_NULLDevice.cpp b/intern/audaspace/intern/AUD_NULLDevice.cpp
index f390971..98a0d32 100644
--- a/intern/audaspace/intern/AUD_NULLDevice.cpp
+++ b/intern/audaspace/intern/AUD_NULLDevice.cpp
@@ -127,14 +127,14 @@ AUD_DeviceSpecs AUD_NULLDevice::getSpecs() const
 	return specs;
 }
 
-AUD_Reference<AUD_IHandle> AUD_NULLDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_NULLDevice::play(boost::shared_ptr<AUD_IReader> reader, bool keep)
 {
-	return new AUD_NULLHandle();
+	return boost::shared_ptr<AUD_IHandle>(new AUD_NULLHandle());
 }
 
-AUD_Reference<AUD_IHandle> AUD_NULLDevice::play(AUD_Reference<AUD_IFactory> factory, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_NULLDevice::play(boost::shared_ptr<AUD_IFactory> factory, bool keep)
 {
-	return new AUD_NULLHandle();
+	return boost::shared_ptr<AUD_IHandle>(new AUD_NULLHandle());
 }
 
 void AUD_NULLDevice::stopAll()
diff --git a/intern/audaspace/intern/AUD_NULLDevice.h b/intern/audaspace/intern/AUD_NULLDevice.h
index ee97b15..ae1435b 100644
--- a/intern/audaspace/intern/AUD_NULLDevice.h
+++ b/intern/audaspace/intern/AUD_NULLDevice.h
@@ -72,8 +72,8 @@ public:
 	virtual ~AUD_NULLDevice();
 
 	virtual AUD_DeviceSpecs getSpecs() const;
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false);
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IReader> reader, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IFactory> factory, bool keep = false);
 	virtual void stopAll();
 	virtual void lock();
 	virtual void unlock();
diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h
deleted file mode 100644
index 5a1aa94..0000000
--- a/intern/audaspace/intern/AUD_Reference.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * Copyright 2009-2011 Jörg Hermann Müller
- *
- * This file is part of AudaSpace.
- *
- * Audaspace is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * AudaSpace is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Audaspace; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file audaspace/intern/AUD_Reference.h
- *  \ingroup audaspaceintern
- */
-
-#ifndef __AUD_REFERENCE_H__
-#define __AUD_REFERENCE_H__
-
-#include <map>
-#include <cstddef>
-#include <pthread.h>
-
-// #define MEM_DEBUG
-
-#ifdef MEM_DEBUG
-#include <iostream>
-#include <typeinfo>
-#endif
-
-/**
- * This class handles the reference counting.
- */
-class AUD_ReferenceHandler
-{
-private:
-	/**
-	 * Saves the reference counts.
-	 */
-	static std::map<void*, unsigned int> m_references;
-	static pthread_mutex_t m_mutex;
-	static bool m_mutex_initialised;
-
-public:
-
-	static pthread_mutex_t* getMutex();
-
-	/**
-	 * Reference increment.
-	 * \param reference The reference.
-	 */
-	static inline void incref(void* reference)
-	{
-		if(!reference)
-			return;
-
-		std::map<void*, unsigned int>::iterator result = m_references.find(reference);
-		if(result != m_references.end())
-		{
-			m_references[reference]++;
-		}
-		else
-		{
-			m_references[reference] = 1;
-		}
-	}
-
-	/**
-	 * Reference decrement.
-	 * \param reference The reference.
-	 * \return Whether the reference has to be deleted.
-	 */
-	static inline bool decref(void* reference)
-	{
-		if(!reference)
-			return false;
-
-		if(!--m_references[reference])
-		{
-			m_references.erase(reference);
-			return true;
-		}
-		return false;
-	}
-};
-
-template <class T>
-/**
- * This class provides reference counting functionality.
- */
-class AUD_Reference
-{
-private:
-	/// The reference.
-	T* m_reference;
-	void* m_original;
-public:
-	/**
-	 * Creates a new reference counter.
-	 * \param reference The reference.
-	 */
-	template <class U>
-	AUD_Reference(U* reference)
-	{
-		pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-		m_original = reference;
-		m_reference = dynamic_cast<T*>(reference);
-		AUD_ReferenceHandler::incref(m_original);
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "+" << typeid(*m_reference).name() << std::endl;
-#endif
-		pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-	}
-
-	AUD_Reference()
-	{
-		m_original = NULL;
-		m_reference = NULL;
-	}
-
-	/**
-	 * Copies an AUD_Reference object.
-	 * \param ref The AUD_Reference object to copy.
-	 */
-	AUD_Reference(const AUD_Reference& ref)
-	{
-		pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-		m_original = ref.m_original;
-		m_reference = ref.m_reference;
-		AUD_ReferenceHandler::incref(m_original);
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "+" << typeid(*m_reference).name() << std::endl;
-#endif
-		pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-	}
-
-	template <class U>
-	explicit AUD_Reference(const AUD_Reference<U>& ref)
-	{
-		pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-		m_original = ref.get();
-		m_reference = dynamic_cast<T*>(ref.get());
-		AUD_ReferenceHandler::incref(m_original);
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "+" << typeid(*m_reference).name() << std::endl;
-#endif
-		pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-	}
-
-	/**
-	 * Destroys a AUD_Reference object, if there's no furthere reference on the
-	 * reference, it is destroyed as well.
-	 */
-	~AUD_Reference()
-	{
-		pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "-" << typeid(*m_reference).name() << std::endl;
-#endif
-		if(AUD_ReferenceHandler::decref(m_original))
-		{
-			pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-			delete m_reference;
-		}
-		else
-		{
-			pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-		}
-	}
-
-	/**
-	 * Assigns an AUD_Reference to this object.
-	 * \param ref The AUD_Reference object to assign.
-	 */
-	AUD_Reference& operator=(const AUD_Reference& ref)
-	{
-		if(&ref == this)
-			return *this;
-
-		pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "-" << typeid(*m_reference).name() << std::endl;
-#endif
-		if(AUD_ReferenceHandler::decref(m_original))
-		{
-			pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-			delete m_reference;
-			pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
-		}
-
-		m_original = ref.m_original;
-		m_reference = ref.m_reference;
-		AUD_ReferenceHandler::incref(m_original);
-#ifdef MEM_DEBUG
-		if(m_reference != NULL)
-			std::cerr << "+" << typeid(*m_reference).name() << std::endl;
-#endif
-
-		pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
-
-		return *this;
-	}
-
-	/**
-	 * Returns whether the reference is NULL.
-	 */
-	inline bool isNull() const
-	{
-		return m_reference == NULL;
-	}
-
-	/**
-	 * Returns the reference.
-	 */
-	inline T* get() const
-	{
-		return m_reference;
-	}
-
-	/**
-	 * Returns the original pointer.
-	 */
-	inline void* getOriginal() const
-	{
-		return m_original;
-	}
-
-	/**
-	 * Returns the reference.
-	 */
-	inline T& operator*() const
-	{
-		return *m_reference;
-	}
-
-	/**
-	 * Returns the reference.
-	 */
-	inline T* operator->() const
-	{
-		return m_reference;
-	}
-};
-
-template<class T, class U>
-inline bool operator==(const AUD_Reference<T>& a, const AUD_Reference<U>& b)
-{
-	return a.getOriginal() == b.getOriginal();
-}
-
-template<class T, class U>
-inline bool operator!=(const AUD_Reference<T>& a, const AUD_Reference<U>& b)
-{
-	return a.getOriginal() != b.getOriginal();
-}
-
-#endif // __AUD_REFERENCE_H__
diff --git a/intern/audaspace/intern/AUD_ReferenceHandler.cpp b/intern/audaspace/intern/AUD_ReferenceHandler.cpp
deleted file mode 100644
index 6aa4f87..0000000
--- a/intern/audaspace/intern/AUD_ReferenceHandler.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * Copyright 2009-2011 Jörg Hermann Müller
- *
- * This file is part of AudaSpace.
- *
- * Audaspace is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * AudaSpace is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Audaspace; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file audaspace/intern/AUD_ReferenceHandler.cpp
- *  \ingroup audaspaceintern
- */
-
-#include "AUD_Reference.h"
-
-std::map<void*, unsigned int> AUD_ReferenceHandler::m_references;
-pthread_mutex_t AUD_ReferenceHandler::m_mutex;
-bool AUD_ReferenceHandler::m_mutex_initialised = false;
-
-pthread_mutex_t *AUD_ReferenceHandler::getMutex()
-{
-	if(!m_mutex_initialised)
-	{
-		pthread_mutexattr_t attr;
-		pthread_mutexattr_init(&attr);
-		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-
-		pthread_mutex_init(&m_mutex, &attr);
-
-		pthread_mutexattr_destroy(&attr);
-
-		m_mutex_initialised = true;
-	}
-
-	return &m_mutex;
-}
-
diff --git a/intern/audaspace/intern/AUD_ResampleReader.cpp b/intern/audaspace/intern/AUD_ResampleReader.cpp
index 514d790..4b247ff 100644
--- a/intern/audaspace/intern/AUD_ResampleReader.cpp
+++ b/intern/audaspace/intern/AUD_ResampleReader.cpp
@@ -29,7 +29,7 @@
 
 #include "AUD_ResampleReader.h"
 
-AUD_ResampleReader::AUD_ResampleReader(AUD_Reference<AUD_IReader> reader, AUD_SampleRate rate) :
+AUD_ResampleReader::AUD_ResampleReader(boost::shared_ptr<AUD_IReader> reader, AUD_SampleRate rate) :
 	AUD_EffectReader(reader), m_rate(rate)
 {
 }
diff --git a/intern/audaspace/intern/AUD_ResampleReader.h b/intern/audaspace/intern/AUD_ResampleReader.h
index c423326..7e21989 100644
--- a/intern/audaspace/intern/AUD_ResampleReader.h
+++ b/intern/audaspace/intern/AUD_ResampleReader.h
@@ -47,7 +47,7 @@ protected:
 	 * \param reader The reader to mix.
 	 * \param rate The target sampling rate.
 	 */
-	AUD_ResampleReader(AUD_Reference<AUD_IReader> reader, AUD_SampleRate rate);
+	AUD_ResampleReader(boost::shared_ptr<AUD_IReader> reader, AUD_SampleRate rate);
 
 public:
 	/**
diff --git a/intern/audaspace/intern/AUD_Sequencer.cpp b/intern/audaspace/intern/AUD_Sequencer.cpp
new file mode 100644
index 0000000..58e8f68
--- /dev/null
+++ b/intern/audaspace/intern/AUD_Sequencer.cpp
@@ -0,0 +1,176 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2009-2011 Jörg Hermann Müller
+ *
+ * This file is part of AudaSpace.
+ *
+ * Audaspace is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * AudaSpace is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Audaspace; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file audaspace/intern/AUD_Sequencer.cpp
+ *  \ingroup audaspaceintern
+ */
+
+
+#include "AUD_Sequencer.h"
+#include "AUD_SequencerReader.h"
+#include "AUD_3DMath.h"
+#include "AUD_MutexLock.h"
+
+AUD_Sequencer::AUD_Sequencer(AUD_Specs specs, float fps, bool muted) :
+	m_specs(specs),
+	m_status(0),
+	m_entry_status(0),
+	m_id(0),
+	m_muted(muted),
+	m_fps(fps),
+	m_speed_of_sound(434),
+	m_doppler_factor(1),
+	m_distance_model(AUD_DISTANCE_MODEL_INVERSE_CLAMPED),
+	m_location(3),
+	m_orientation(4)
+{
+	AUD_Quaternion q;
+	m_orientation.write(q.get());
+	float f = 1;
+	m_volume.write(&f);
+
+	pthread_mutexattr_t attr;
+	pthread_mutexattr_init(&attr);
+	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+
+	pthread_mutex_init(&m_mutex, &attr);
+
+	pthread_mutexattr_destroy(&attr);
+}
+
+AUD_Sequencer::~AUD_Sequencer()
+{
+	pthread_mutex_destroy(&m_mutex);
+}
+
+void AUD_Sequencer::lock()
+{
+	pthread_mutex_lock(&m_mutex);
+}
+
+void AUD_Sequencer::unlock()
+{
+	pthread_mutex_unlock(&m_mutex);
+}
+
+void AUD_Sequencer::setSpecs(AUD_Specs specs)
+{
+	AUD_MutexLock lock(*this);
+
+	m_specs = specs;
+	m_status++;
+}
+
+void AUD_Sequencer::setFPS(float fps)
+{
+	AUD_MutexLock lock(*this);
+
+	m_fps = fps;
+}
+
+void AUD_Sequencer::mute(bool muted)
+{
+	AUD_MutexLock lock(*this);
+
+	m_muted = muted;
+}
+
+bool AUD_Sequencer::getMute() const
+{
+	return m_muted;
+}
+
+float AUD_Sequencer::getSpeedOfSound() const
+{
+	return m_speed_of_sound;
+}
+
+void AUD_Sequencer::setSpeedOfSound(float speed)
+{
+	AUD_MutexLock lock(*this);
+
+	m_speed_of_sound = speed;
+	m_status++;
+}
+
+float AUD_Sequencer::getDopplerFactor() const
+{
+	return m_doppler_factor;
+}
+
+void AUD_Sequencer::setDopplerFactor(float factor)
+{
+	AUD_MutexLock lock(*this);
+
+	m_doppler_factor = factor;
+	m_status++;
+}
+
+AUD_DistanceModel AUD_Sequencer::getDistanceModel() const
+{
+	return m_distance_model;
+}
+
+void AUD_Sequencer::setDistanceModel(AUD_DistanceModel model)
+{
+	AUD_MutexLock lock(*this);
+
+	m_distance_model = model;
+	m_status++;
+}
+
+AUD_AnimateableProperty* AUD_Sequencer::getAnimProperty(AUD_AnimateablePropertyType type)
+{
+	switch(type)
+	{
+	case AUD_AP_VOLUME:
+		return &m_volume;
+	case AUD_AP_LOCATION:
+		return &m_location;
+	case AUD_AP_ORIENTATION:
+		return &m_orientation;
+	default:
+		return NULL;
+	}
+}
+
+boost::shared_ptr<AUD_SequencerEntry> AUD_Sequencer::add(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip)
+{
+	AUD_MutexLock lock(*this);
+
+	boost::shared_ptr<AUD_SequencerEntry> entry = boost::shared_ptr<AUD_SequencerEntry>(new AUD_SequencerEntry(sound, begin, end, skip, m_id++));
+
+	m_entries.push_front(entry);
+	m_entry_status++;
+
+	return entry;
+}
+
+void AUD_Sequencer::remove(boost::shared_ptr<AUD_SequencerEntry> entry)
+{
+	AUD_MutexLock lock(*this);
+
+	m_entries.remove(entry);
+	m_entry_status++;
+}
diff --git a/intern/audaspace/intern/AUD_Sequencer.h b/intern/audaspace/intern/AUD_Sequencer.h
new file mode 100644
index 0000000..9fdf537
--- /dev/null
+++ b/intern/audaspace/intern/AUD_Sequencer.h
@@ -0,0 +1,206 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2009-2011 Jörg Hermann Müller
+ *
+ * This file is part of AudaSpace.
+ *
+ * Audaspace is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * AudaSpace is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Audaspace; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file audaspace/intern/AUD_Sequencer.h
+ *  \ingroup audaspaceintern
+ */
+
+
+#ifndef __AUD_SEQUENCER_H__
+#define __AUD_SEQUENCER_H__
+
+#include "AUD_AnimateableProperty.h"
+#include "AUD_IFactory.h"
+#include "AUD_ILockable.h"
+
+#include <list>
+#include <pthread.h>
+
+class AUD_SequencerEntry;
+
+/**
+ * This class represents sequenced entries to play a sound scene.
+ */
+class AUD_Sequencer : public AUD_ILockable
+{
+	friend class AUD_SequencerReader;
+private:
+	/// The target specification.
+	AUD_Specs m_specs;
+
+	/// The status of the sequence. Changes every time a non-animated parameter changes.
+	int m_status;
+
+	/// The entry status. Changes every time an entry is removed or added.
+	int m_entry_status;
+
+	/// The next unused ID for the entries.
+	int m_id;
+
+	/// The sequenced entries.
+	std::list<boost::shared_ptr<AUD_SequencerEntry> > m_entries;
+
+	/// Whether the whole scene is muted.
+	bool m_muted;
+
+	/// The FPS of the scene.
+	float m_fps;
+
+	/// Speed of Sound.
+	float m_speed_of_sound;
+
+	/// Doppler factor.
+	float m_doppler_factor;
+
+	/// Distance model.
+	AUD_DistanceModel m_distance_model;
+
+	/// The animated volume.
+	AUD_AnimateableProperty m_volume;
+
+	/// The animated listener location.
+	AUD_AnimateableProperty m_location;
+
+	/// The animated listener orientation.
+	AUD_AnimateableProperty m_orientation;
+
+	/// The mutex for locking.
+	pthread_mutex_t m_mutex;
+
+	// hide copy constructor and operator=
+	AUD_Sequencer(const AUD_Sequencer&);
+	AUD_Sequencer& operator=(const AUD_Sequencer&);
+
+public:
+	/**
+	 * Creates a new sound scene.
+	 * \param specs The output audio data specification.
+	 * \param fps The FPS of the scene.
+	 * \param muted Whether the whole scene is muted.
+	 */
+	AUD_Sequencer(AUD_Specs specs, float fps, bool muted);
+	~AUD_Sequencer();
+
+	/**
+	 * Locks the sequence.
+	 */
+	virtual void lock();
+
+	/**
+	 * Unlocks the previously locked sequence.
+	 */
+	virtual void unlock();
+
+	/**
+	 * Sets the audio output specification.
+	 * \param specs The new specification.
+	 */
+	void setSpecs(AUD_Specs specs);
+
+	/**
+	 * Sets the scene's FPS.
+	 * \param fps The new FPS.
+	 */
+	void setFPS(float fps);
+
+	/**
+	 * Sets the muting state of the scene.
+	 * \param muted Whether the scene is muted.
+	 */
+	void mute(bool muted);
+
+	/**
+	 * Retrieves the muting state of the scene.
+	 * \return Whether the scene is muted.
+	 */
+	bool getMute() const;
+
+	/**
+	 * Retrieves the speed of sound.
+	 * This value is needed for doppler effect calculation.
+	 * \return The speed of sound.
+	 */
+	float getSpeedOfSound() const;
+
+	/**
+	 * Sets the speed of sound.
+	 * This value is needed for doppler effect calculation.
+	 * \param speed The new speed of sound.
+	 */
+	void setSpeedOfSound(float speed);
+
+	/**
+	 * Retrieves the doppler factor.
+	 * This value is a scaling factor for the velocity vectors of sources and
+	 * listener which is used while calculating the doppler effect.
+	 * \return The doppler factor.
+	 */
+	float getDopplerFactor() const;
+
+	/**
+	 * Sets the doppler factor.
+	 * This value is a scaling factor for the velocity vectors of sources and
+	 * listener which is used while calculating the doppler effect.
+	 * \param factor The new doppler factor.
+	 */
+	void setDopplerFactor(float factor);
+
+	/**
+	 * Retrieves the distance model.
+	 * \return The distance model.
+	 */
+	AUD_DistanceModel getDistanceModel() const;
+
+	/**
+	 * Sets the distance model.
+	 * \param model distance model.
+	 */
+	void setDistanceModel(AUD_DistanceModel model);
+
+	/**
+	 * Retrieves one of the animated properties of the sequence.
+	 * \param type Which animated property to retrieve.
+	 * \return A pointer to the animated property, valid as long as the
+	 *         sequence is.
+	 */
+	AUD_AnimateableProperty* getAnimProperty(AUD_AnimateablePropertyType type);
+
+	/**
+	 * Adds a new entry to the scene.
+	 * \param sound The sound this entry should play.
+	 * \param begin The start time.
+	 * \param end The end time or a negative value if determined by the sound.
+	 * \param skip How much seconds should be skipped at the beginning.
+	 * \return The entry added.
+	 */
+	boost::shared_ptr<AUD_SequencerEntry> add(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip);
+
+	/**
+	 * Removes an entry from the scene.
+	 * \param entry The entry to remove.
+	 */
+	void remove(boost::shared_ptr<AUD_SequencerEntry> entry);
+};
+
+#endif //__AUD_SEQUENCER_H__
diff --git a/intern/audaspace/intern/AUD_SequencerEntry.cpp b/intern/audaspace/intern/AUD_SequencerEntry.cpp
index 6e6e239..005557b 100644
--- a/intern/audaspace/intern/AUD_SequencerEntry.cpp
+++ b/intern/audaspace/intern/AUD_SequencerEntry.cpp
@@ -29,11 +29,12 @@
 
 #include "AUD_SequencerEntry.h"
 #include "AUD_SequencerReader.h"
+#include "AUD_MutexLock.h"
 
 #include <cmath>
 #include <limits>
 
-AUD_SequencerEntry::AUD_SequencerEntry(AUD_Reference<AUD_IFactory> sound, float begin, float end, float skip, int id) :
+AUD_SequencerEntry::AUD_SequencerEntry(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip, int id) :
 	m_status(0),
 	m_pos_status(1),
 	m_sound_status(0),
@@ -85,22 +86,20 @@ void AUD_SequencerEntry::unlock()
 	pthread_mutex_unlock(&m_mutex);
 }
 
-void AUD_SequencerEntry::setSound(AUD_Reference<AUD_IFactory> sound)
+void AUD_SequencerEntry::setSound(boost::shared_ptr<AUD_IFactory> sound)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(m_sound.get() != sound.get())
 	{
 		m_sound = sound;
 		m_sound_status++;
 	}
-
-	unlock();
 }
 
 void AUD_SequencerEntry::move(float begin, float end, float skip)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(m_begin != begin || m_skip != skip || m_end != end)
 	{
@@ -109,17 +108,13 @@ void AUD_SequencerEntry::move(float begin, float end, float skip)
 		m_end = end;
 		m_pos_status++;
 	}
-
-	unlock();
 }
 
 void AUD_SequencerEntry::mute(bool mute)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_muted = mute;
-
-	unlock();
 }
 
 int AUD_SequencerEntry::getID() const
@@ -150,7 +145,7 @@ void AUD_SequencerEntry::updateAll(float volume_max, float volume_min, float dis
 								   float distance_reference, float attenuation, float cone_angle_outer,
 								   float cone_angle_inner, float cone_volume_outer)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(volume_max != m_volume_max)
 	{
@@ -199,8 +194,6 @@ void AUD_SequencerEntry::updateAll(float volume_max, float volume_min, float dis
 		m_cone_volume_outer = cone_volume_outer;
 		m_status++;
 	}
-
-	unlock();
 }
 
 bool AUD_SequencerEntry::isRelative()
@@ -210,15 +203,13 @@ bool AUD_SequencerEntry::isRelative()
 
 void AUD_SequencerEntry::setRelative(bool relative)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	if(m_relative != relative)
 	{
 		m_relative = relative;
 		m_status++;
 	}
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getVolumeMaximum()
@@ -228,12 +219,10 @@ float AUD_SequencerEntry::getVolumeMaximum()
 
 void AUD_SequencerEntry::setVolumeMaximum(float volume)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_volume_max = volume;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getVolumeMinimum()
@@ -243,12 +232,10 @@ float AUD_SequencerEntry::getVolumeMinimum()
 
 void AUD_SequencerEntry::setVolumeMinimum(float volume)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_volume_min = volume;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getDistanceMaximum()
@@ -258,12 +245,10 @@ float AUD_SequencerEntry::getDistanceMaximum()
 
 void AUD_SequencerEntry::setDistanceMaximum(float distance)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_distance_max = distance;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getDistanceReference()
@@ -273,12 +258,10 @@ float AUD_SequencerEntry::getDistanceReference()
 
 void AUD_SequencerEntry::setDistanceReference(float distance)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_distance_reference = distance;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getAttenuation()
@@ -288,12 +271,10 @@ float AUD_SequencerEntry::getAttenuation()
 
 void AUD_SequencerEntry::setAttenuation(float factor)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_attenuation = factor;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getConeAngleOuter()
@@ -303,12 +284,10 @@ float AUD_SequencerEntry::getConeAngleOuter()
 
 void AUD_SequencerEntry::setConeAngleOuter(float angle)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_cone_angle_outer = angle;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getConeAngleInner()
@@ -318,12 +297,10 @@ float AUD_SequencerEntry::getConeAngleInner()
 
 void AUD_SequencerEntry::setConeAngleInner(float angle)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_cone_angle_inner = angle;
 	m_status++;
-
-	unlock();
 }
 
 float AUD_SequencerEntry::getConeVolumeOuter()
@@ -333,10 +310,8 @@ float AUD_SequencerEntry::getConeVolumeOuter()
 
 void AUD_SequencerEntry::setConeVolumeOuter(float volume)
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	m_cone_volume_outer = volume;
 	m_status++;
-
-	unlock();
 }
diff --git a/intern/audaspace/intern/AUD_SequencerEntry.h b/intern/audaspace/intern/AUD_SequencerEntry.h
index 7ff6fff..aa1edeb 100644
--- a/intern/audaspace/intern/AUD_SequencerEntry.h
+++ b/intern/audaspace/intern/AUD_SequencerEntry.h
@@ -30,16 +30,17 @@
 #ifndef __AUD_SEQUENCERENTRY_H__
 #define __AUD_SEQUENCERENTRY_H__
 
-#include "AUD_Reference.h"
 #include "AUD_AnimateableProperty.h"
 #include "AUD_IFactory.h"
+#include "AUD_ILockable.h"
 
 #include <pthread.h>
+#include <boost/shared_ptr.hpp>
 
 /**
  * This class represents a sequenced entry in a sequencer factory.
  */
-class AUD_SequencerEntry
+class AUD_SequencerEntry : public AUD_ILockable
 {
 	friend class AUD_SequencerHandle;
 private:
@@ -56,7 +57,7 @@ private:
 	int m_id;
 
 	/// The sound this entry plays.
-	AUD_Reference<AUD_IFactory> m_sound;
+	boost::shared_ptr<AUD_IFactory> m_sound;
 
 	/// The begin time.
 	float m_begin;
@@ -124,24 +125,24 @@ public:
 	 * \param skip How much seconds should be skipped at the beginning.
 	 * \param id The ID of the entry.
 	 */
-	AUD_SequencerEntry(AUD_Reference<AUD_IFactory> sound, float begin, float end, float skip, int id);
+	AUD_SequencerEntry(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip, int id);
 	virtual ~AUD_SequencerEntry();
 
 	/**
 	 * Locks the entry.
 	 */
-	void lock();
+	virtual void lock();
 
 	/**
 	 * Unlocks the previously locked entry.
 	 */
-	void unlock();
+	virtual void unlock();
 
 	/**
 	 * Sets the sound of the entry.
 	 * \param sound The new sound.
 	 */
-	void setSound(AUD_Reference<AUD_IFactory> sound);
+	void setSound(boost::shared_ptr<AUD_IFactory> sound);
 
 	/**
 	 * Moves the entry.
diff --git a/intern/audaspace/intern/AUD_SequencerFactory.cpp b/intern/audaspace/intern/AUD_SequencerFactory.cpp
index fd495f4..f607660 100644
--- a/intern/audaspace/intern/AUD_SequencerFactory.cpp
+++ b/intern/audaspace/intern/AUD_SequencerFactory.cpp
@@ -30,40 +30,14 @@
 #include "AUD_SequencerFactory.h"
 #include "AUD_SequencerReader.h"
 #include "AUD_3DMath.h"
+#include "AUD_MutexLock.h"
 
-AUD_SequencerFactory::AUD_SequencerFactory(AUD_Specs specs, float fps, bool muted) :
-	m_specs(specs),
-	m_status(0),
-	m_entry_status(0),
-	m_id(0),
-	m_muted(muted),
-	m_fps(fps),
-	m_speed_of_sound(434),
-	m_doppler_factor(1),
-	m_distance_model(AUD_DISTANCE_MODEL_INVERSE_CLAMPED),
-	m_location(3),
-	m_orientation(4)
+AUD_SequencerFactory::AUD_SequencerFactory(AUD_Specs specs, float fps, bool muted)
 {
-	AUD_Quaternion q;
-	m_orientation.write(q.get());
-	float f = 1;
-	m_volume.write(&f);
-
-	pthread_mutexattr_t attr;
-	pthread_mutexattr_init(&attr);
-	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-
-	pthread_mutex_init(&m_mutex, &attr);
-
-	pthread_mutexattr_destroy(&attr);
+	m_sequence = boost::shared_ptr<AUD_Sequencer>(new AUD_Sequencer(specs, fps, muted));
 }
 
-AUD_SequencerFactory::~AUD_SequencerFactory()
-{
-	pthread_mutex_destroy(&m_mutex);
-}
-
-void AUD_SequencerFactory::lock()
+/*void AUD_SequencerFactory::lock()
 {
 	pthread_mutex_lock(&m_mutex);
 }
@@ -71,131 +45,79 @@ void AUD_SequencerFactory::lock()
 void AUD_SequencerFactory::unlock()
 {
 	pthread_mutex_unlock(&m_mutex);
-}
+}*/
 
 void AUD_SequencerFactory::setSpecs(AUD_Specs specs)
 {
-	lock();
-
-	m_specs = specs;
-	m_status++;
-
-	unlock();
+	m_sequence->setSpecs(specs);
 }
 
 void AUD_SequencerFactory::setFPS(float fps)
 {
-	lock();
-
-	m_fps = fps;
-
-	unlock();
+	m_sequence->setFPS(fps);
 }
 
 void AUD_SequencerFactory::mute(bool muted)
 {
-	lock();
-
-	m_muted = muted;
-
-	unlock();
+	m_sequence->mute(muted);
 }
 
 bool AUD_SequencerFactory::getMute() const
 {
-	return m_muted;
+	return m_sequence->getMute();
 }
 
 float AUD_SequencerFactory::getSpeedOfSound() const
 {
-	return m_speed_of_sound;
+	return m_sequence->getSpeedOfSound();
 }
 
 void AUD_SequencerFactory::setSpeedOfSound(float speed)
 {
-	lock();
-
-	m_speed_of_sound = speed;
-	m_status++;
-
-	unlock();
+	m_sequence->setSpeedOfSound(speed);
 }
 
 float AUD_SequencerFactory::getDopplerFactor() const
 {
-	return m_doppler_factor;
+	return m_sequence->getDopplerFactor();
 }
 
 void AUD_SequencerFactory::setDopplerFactor(float factor)
 {
-	lock();
-
-	m_doppler_factor = factor;
-	m_status++;
-
-	unlock();
+	m_sequence->setDopplerFactor(factor);
 }
 
 AUD_DistanceModel AUD_SequencerFactory::getDistanceModel() const
 {
-	return m_distance_model;
+	return m_sequence->getDistanceModel();
 }
 
 void AUD_SequencerFactory::setDistanceModel(AUD_DistanceModel model)
 {
-	lock();
-
-	m_distance_model = model;
-	m_status++;
-
-	unlock();
+	m_sequence->setDistanceModel(model);
 }
 
 AUD_AnimateableProperty* AUD_SequencerFactory::getAnimProperty(AUD_AnimateablePropertyType type)
 {
-	switch(type)
-	{
-	case AUD_AP_VOLUME:
-		return &m_volume;
-	case AUD_AP_LOCATION:
-		return &m_location;
-	case AUD_AP_ORIENTATION:
-		return &m_orientation;
-	default:
-		return NULL;
-	}
+	return m_sequence->getAnimProperty(type);
 }
 
-AUD_Reference<AUD_SequencerEntry> AUD_SequencerFactory::add(AUD_Reference<AUD_IFactory> sound, float begin, float end, float skip)
+boost::shared_ptr<AUD_SequencerEntry> AUD_SequencerFactory::add(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip)
 {
-	lock();
-
-	AUD_Reference<AUD_SequencerEntry> entry = new AUD_SequencerEntry(sound, begin, end, skip, m_id++);
-
-	m_entries.push_front(entry);
-	m_entry_status++;
-
-	unlock();
-
-	return entry;
+	return m_sequence->add(sound, begin, end, skip);
 }
 
-void AUD_SequencerFactory::remove(AUD_Reference<AUD_SequencerEntry> entry)
+void AUD_SequencerFactory::remove(boost::shared_ptr<AUD_SequencerEntry> entry)
 {
-	lock();
-
-	m_entries.remove(entry);
-	m_entry_status++;
-
-	unlock();
+	m_sequence->remove(entry);
 }
 
-AUD_Reference<AUD_IReader> AUD_SequencerFactory::createQualityReader()
+boost::shared_ptr<AUD_IReader> AUD_SequencerFactory::createQualityReader()
 {
-	return new AUD_SequencerReader(this, true);
+	return boost::shared_ptr<AUD_IReader>(new AUD_SequencerReader(m_sequence, true));
 }
 
-AUD_Reference<AUD_IReader> AUD_SequencerFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SequencerFactory::createReader()
 {
-	return new AUD_SequencerReader(this);
+	return boost::shared_ptr<AUD_IReader>(new AUD_SequencerReader(m_sequence));
 }
diff --git a/intern/audaspace/intern/AUD_SequencerFactory.h b/intern/audaspace/intern/AUD_SequencerFactory.h
index 3824111..3ef847d 100644
--- a/intern/audaspace/intern/AUD_SequencerFactory.h
+++ b/intern/audaspace/intern/AUD_SequencerFactory.h
@@ -32,6 +32,8 @@
 
 #include "AUD_IFactory.h"
 #include "AUD_AnimateableProperty.h"
+//#include "AUD_ILockable.h"
+#include "AUD_Sequencer.h"
 
 #include <list>
 #include <pthread.h>
@@ -41,51 +43,12 @@ class AUD_SequencerEntry;
 /**
  * This factory represents sequenced entries to play a sound scene.
  */
-class AUD_SequencerFactory : public AUD_IFactory
+class AUD_SequencerFactory : public AUD_IFactory//, public AUD_ILockable
 {
 	friend class AUD_SequencerReader;
 private:
-	/// The target specification.
-	AUD_Specs m_specs;
-
-	/// The status of the factory. Changes every time a non-animated parameter changes.
-	int m_status;
-
-	/// The entry status. Changes every time an entry is removed or added.
-	int m_entry_status;
-
-	/// The next unused ID for the entries.
-	int m_id;
-
-	/// The sequenced entries.
-	std::list<AUD_Reference<AUD_SequencerEntry> > m_entries;
-
-	/// Whether the whole scene is muted.
-	bool m_muted;
-
-	/// The FPS of the scene.
-	float m_fps;
-
-	/// Speed of Sound.
-	float m_speed_of_sound;
-
-	/// Doppler factor.
-	float m_doppler_factor;
-
-	/// Distance model.
-	AUD_DistanceModel m_distance_model;
-
-	/// The animated volume.
-	AUD_AnimateableProperty m_volume;
-
-	/// The animated listener location.
-	AUD_AnimateableProperty m_location;
-
-	/// The animated listener orientation.
-	AUD_AnimateableProperty m_orientation;
-
-	/// The mutex for locking.
-	pthread_mutex_t m_mutex;
+	/// The sequence.
+	boost::shared_ptr<AUD_Sequencer> m_sequence;
 
 	// hide copy constructor and operator=
 	AUD_SequencerFactory(const AUD_SequencerFactory&);
@@ -99,17 +62,18 @@ public:
 	 * \param muted Whether the whole scene is muted.
 	 */
 	AUD_SequencerFactory(AUD_Specs specs, float fps, bool muted);
-	~AUD_SequencerFactory();
 
+#if 0
 	/**
 	 * Locks the factory.
 	 */
-	void lock();
+	virtual void lock();
 
 	/**
 	 * Unlocks the previously locked factory.
 	 */
-	void unlock();
+	virtual void unlock();
+#endif
 
 	/**
 	 * Sets the audio output specification.
@@ -193,21 +157,21 @@ public:
 	 * \param skip How much seconds should be skipped at the beginning.
 	 * \return The entry added.
 	 */
-	AUD_Reference<AUD_SequencerEntry> add(AUD_Reference<AUD_IFactory> sound, float begin, float end, float skip);
+	boost::shared_ptr<AUD_SequencerEntry> add(boost::shared_ptr<AUD_IFactory> sound, float begin, float end, float skip);
 
 	/**
 	 * Removes an entry from the scene.
 	 * \param entry The entry to remove.
 	 */
-	void remove(AUD_Reference<AUD_SequencerEntry> entry);
+	void remove(boost::shared_ptr<AUD_SequencerEntry> entry);
 
 	/**
 	 * Creates a new reader with high quality resampling.
 	 * \return The new reader.
 	 */
-	AUD_Reference<AUD_IReader> createQualityReader();
+	boost::shared_ptr<AUD_IReader> createQualityReader();
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SEQUENCERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SequencerHandle.cpp b/intern/audaspace/intern/AUD_SequencerHandle.cpp
index f4bfae6..c9473cf 100644
--- a/intern/audaspace/intern/AUD_SequencerHandle.cpp
+++ b/intern/audaspace/intern/AUD_SequencerHandle.cpp
@@ -29,18 +29,19 @@
 
 #include "AUD_SequencerHandle.h"
 #include "AUD_ReadDevice.h"
+#include "AUD_MutexLock.h"
 
-AUD_SequencerHandle::AUD_SequencerHandle(AUD_Reference<AUD_SequencerEntry> entry, AUD_ReadDevice& device) :
+AUD_SequencerHandle::AUD_SequencerHandle(boost::shared_ptr<AUD_SequencerEntry> entry, AUD_ReadDevice& device) :
 	m_entry(entry),
 	m_status(0),
 	m_pos_status(0),
 	m_sound_status(0),
 	m_device(device)
 {
-	if(!entry->m_sound.isNull())
+	if(entry->m_sound.get())
 	{
 		m_handle = device.play(entry->m_sound, true);
-		m_3dhandle = AUD_Reference<AUD_I3DHandle>(m_handle);
+		m_3dhandle = boost::dynamic_pointer_cast<AUD_I3DHandle>(m_handle);
 	}
 }
 
@@ -49,7 +50,7 @@ AUD_SequencerHandle::~AUD_SequencerHandle()
 	stop();
 }
 
-int AUD_SequencerHandle::compare(AUD_Reference<AUD_SequencerEntry> entry) const
+int AUD_SequencerHandle::compare(boost::shared_ptr<AUD_SequencerEntry> entry) const
 {
 	if(m_entry->getID() < entry->getID())
 		return -1;
@@ -60,15 +61,15 @@ int AUD_SequencerHandle::compare(AUD_Reference<AUD_SequencerEntry> entry) const
 
 void AUD_SequencerHandle::stop()
 {
-	if(!m_handle.isNull())
+	if(m_handle.get())
 		m_handle->stop();
 }
 
 void AUD_SequencerHandle::update(float position, float frame, float fps)
 {
-	if(!m_handle.isNull())
+	if(m_handle.get())
 	{
-		m_entry->lock();
+		AUD_MutexLock lock(*m_entry);
 		if(position >= m_entry->m_end && m_entry->m_end >= 0)
 			m_handle->pause();
 		else if(position >= m_entry->m_begin)
@@ -76,13 +77,13 @@ void AUD_SequencerHandle::update(float position, float frame, float fps)
 
 		if(m_sound_status != m_entry->m_sound_status)
 		{
-			if(!m_handle.isNull())
+			if(m_handle.get())
 				m_handle->stop();
 
-			if(!m_entry->m_sound.isNull())
+			if(m_entry->m_sound.get())
 			{
 				m_handle = m_device.play(m_entry->m_sound, true);
-				m_3dhandle = AUD_Reference<AUD_I3DHandle>(m_handle);
+				m_3dhandle = boost::dynamic_pointer_cast<AUD_I3DHandle>(m_handle);
 			}
 
 			m_sound_status = m_entry->m_sound_status;
@@ -134,19 +135,17 @@ void AUD_SequencerHandle::update(float position, float frame, float fps)
 
 		if(m_entry->m_muted)
 			m_handle->setVolume(0);
-		m_entry->unlock();
 	}
 }
 
 void AUD_SequencerHandle::seek(float position)
 {
-	if(!m_handle.isNull())
+	if(m_handle.get())
 	{
-		m_entry->lock();
+		AUD_MutexLock lock(*m_entry);
 		if(position >= m_entry->m_end && m_entry->m_end >= 0)
 		{
 			m_handle->pause();
-			m_entry->unlock();
 			return;
 		}
 
@@ -160,6 +159,5 @@ void AUD_SequencerHandle::seek(float position)
 			m_handle->pause();
 		else
 			m_handle->resume();
-		m_entry->unlock();
 	}
 }
diff --git a/intern/audaspace/intern/AUD_SequencerHandle.h b/intern/audaspace/intern/AUD_SequencerHandle.h
index 72d3240..881bbdd 100644
--- a/intern/audaspace/intern/AUD_SequencerHandle.h
+++ b/intern/audaspace/intern/AUD_SequencerHandle.h
@@ -43,13 +43,13 @@ class AUD_SequencerHandle
 {
 private:
 	/// The entry this handle belongs to.
-	AUD_Reference<AUD_SequencerEntry> m_entry;
+	boost::shared_ptr<AUD_SequencerEntry> m_entry;
 
 	/// The handle in the read device.
-	AUD_Reference<AUD_IHandle> m_handle;
+	boost::shared_ptr<AUD_IHandle> m_handle;
 
 	/// The 3D handle in the read device.
-	AUD_Reference<AUD_I3DHandle> m_3dhandle;
+	boost::shared_ptr<AUD_I3DHandle> m_3dhandle;
 
 	/// The last read status from the entry.
 	int m_status;
@@ -69,7 +69,7 @@ public:
 	 * \param entry The entry this handle plays.
 	 * \param device The read device to play on.
 	 */
-	AUD_SequencerHandle(AUD_Reference<AUD_SequencerEntry> entry, AUD_ReadDevice& device);
+	AUD_SequencerHandle(boost::shared_ptr<AUD_SequencerEntry> entry, AUD_ReadDevice& device);
 
 	/**
 	 * Destroys the handle.
@@ -81,7 +81,7 @@ public:
 	 * \param entry The entry to compare to.
 	 * \return Whether the entries ID is smaller, equal or bigger.
 	 */
-	int compare(AUD_Reference<AUD_SequencerEntry> entry) const;
+	int compare(boost::shared_ptr<AUD_SequencerEntry> entry) const;
 
 	/**
 	 * Stops playing back the handle.
diff --git a/intern/audaspace/intern/AUD_SequencerReader.cpp b/intern/audaspace/intern/AUD_SequencerReader.cpp
index 2e41a99..d5e1459 100644
--- a/intern/audaspace/intern/AUD_SequencerReader.cpp
+++ b/intern/audaspace/intern/AUD_SequencerReader.cpp
@@ -28,12 +28,13 @@
 
 
 #include "AUD_SequencerReader.h"
+#include "AUD_MutexLock.h"
 
-typedef std::list<AUD_Reference<AUD_SequencerHandle> >::iterator AUD_HandleIterator;
-typedef std::list<AUD_Reference<AUD_SequencerEntry> >::iterator AUD_EntryIterator;
+typedef std::list<boost::shared_ptr<AUD_SequencerHandle> >::iterator AUD_HandleIterator;
+typedef std::list<boost::shared_ptr<AUD_SequencerEntry> >::iterator AUD_EntryIterator;
 
-AUD_SequencerReader::AUD_SequencerReader(AUD_Reference<AUD_SequencerFactory> factory, bool quality) :
-	m_position(0), m_device(factory->m_specs), m_factory(factory), m_status(0), m_entry_status(0)
+AUD_SequencerReader::AUD_SequencerReader(boost::shared_ptr<AUD_Sequencer> sequence, bool quality) :
+	m_position(0), m_device(sequence->m_specs), m_sequence(sequence), m_status(0), m_entry_status(0)
 {
 	m_device.setQuality(quality);
 }
@@ -56,7 +57,7 @@ void AUD_SequencerReader::seek(int position)
 
 	for(AUD_HandleIterator it = m_handles.begin(); it != m_handles.end(); it++)
 	{
-		(*it)->seek(position / m_factory->m_specs.rate);
+		(*it)->seek(position / m_sequence->m_specs.rate);
 	}
 }
 
@@ -72,37 +73,37 @@ int AUD_SequencerReader::getPosition() const
 
 AUD_Specs AUD_SequencerReader::getSpecs() const
 {
-	return m_factory->m_specs;
+	return m_sequence->m_specs;
 }
 
 void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 {
-	m_factory->lock();
+	AUD_MutexLock lock(*m_sequence);
 
-	if(m_factory->m_status != m_status)
+	if(m_sequence->m_status != m_status)
 	{
-		m_device.changeSpecs(m_factory->m_specs);
-		m_device.setSpeedOfSound(m_factory->m_speed_of_sound);
-		m_device.setDistanceModel(m_factory->m_distance_model);
-		m_device.setDopplerFactor(m_factory->m_doppler_factor);
+		m_device.changeSpecs(m_sequence->m_specs);
+		m_device.setSpeedOfSound(m_sequence->m_speed_of_sound);
+		m_device.setDistanceModel(m_sequence->m_distance_model);
+		m_device.setDopplerFactor(m_sequence->m_doppler_factor);
 
-		m_status = m_factory->m_status;
+		m_status = m_sequence->m_status;
 	}
 
-	if(m_factory->m_entry_status != m_entry_status)
+	if(m_sequence->m_entry_status != m_entry_status)
 	{
-		std::list<AUD_Reference<AUD_SequencerHandle> > handles;
+		std::list<boost::shared_ptr<AUD_SequencerHandle> > handles;
 
 		AUD_HandleIterator hit = m_handles.begin();
-		AUD_EntryIterator  eit = m_factory->m_entries.begin();
+		AUD_EntryIterator  eit = m_sequence->m_entries.begin();
 
 		int result;
-		AUD_Reference<AUD_SequencerHandle> handle;
+		boost::shared_ptr<AUD_SequencerHandle> handle;
 
-		while(hit != m_handles.end() && eit != m_factory->m_entries.end())
+		while(hit != m_handles.end() && eit != m_sequence->m_entries.end())
 		{
 			handle = *hit;
-			AUD_Reference<AUD_SequencerEntry> entry = *eit;
+			boost::shared_ptr<AUD_SequencerEntry> entry = *eit;
 
 			result = handle->compare(entry);
 
@@ -110,7 +111,7 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 			{
 				try
 				{
-					handle = new AUD_SequencerHandle(entry, m_device);
+					handle = boost::shared_ptr<AUD_SequencerHandle>(new AUD_SequencerHandle(entry, m_device));
 					handles.push_front(handle);
 				}
 				catch(AUD_Exception&)
@@ -137,11 +138,11 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 			hit++;
 		}
 
-		while(eit != m_factory->m_entries.end())
+		while(eit != m_sequence->m_entries.end())
 		{
 			try
 			{
-				handle = new AUD_SequencerHandle(*eit, m_device);
+				handle = boost::shared_ptr<AUD_SequencerHandle>(new AUD_SequencerHandle(*eit, m_device));
 				handles.push_front(handle);
 			}
 			catch(AUD_Exception&)
@@ -152,10 +153,10 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 
 		m_handles = handles;
 
-		m_entry_status = m_factory->m_entry_status;
+		m_entry_status = m_sequence->m_entry_status;
 	}
 
-	AUD_Specs specs = m_factory->m_specs;
+	AUD_Specs specs = m_sequence->m_specs;
 	int pos = 0;
 	float time = float(m_position) / float(specs.rate);
 	float volume, frame;
@@ -166,30 +167,30 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 
 	while(pos < length)
 	{
-		frame = time * m_factory->m_fps;
+		frame = time * m_sequence->m_fps;
 		cfra = int(floor(frame));
 
-		len = int(ceil((cfra + 1) / m_factory->m_fps * specs.rate)) - m_position;
+		len = int(ceil((cfra + 1) / m_sequence->m_fps * specs.rate)) - m_position;
 		len = AUD_MIN(length - pos, len);
 		len = AUD_MAX(len, 1);
 
 		for(AUD_HandleIterator it = m_handles.begin(); it != m_handles.end(); it++)
 		{
-			(*it)->update(time, frame, m_factory->m_fps);
+			(*it)->update(time, frame, m_sequence->m_fps);
 		}
 
-		m_factory->m_volume.read(frame, &volume);
-		if(m_factory->m_muted)
+		m_sequence->m_volume.read(frame, &volume);
+		if(m_sequence->m_muted)
 			volume = 0.0f;
 		m_device.setVolume(volume);
 
-		m_factory->m_orientation.read(frame, q.get());
+		m_sequence->m_orientation.read(frame, q.get());
 		m_device.setListenerOrientation(q);
-		m_factory->m_location.read(frame, v.get());
+		m_sequence->m_location.read(frame, v.get());
 		m_device.setListenerLocation(v);
-		m_factory->m_location.read(frame + 1, v2.get());
+		m_sequence->m_location.read(frame + 1, v2.get());
 		v2 -= v;
-		m_device.setListenerVelocity(v2 * m_factory->m_fps);
+		m_device.setListenerVelocity(v2 * m_sequence->m_fps);
 
 		m_device.read(reinterpret_cast<data_t*>(buffer + specs.channels * pos), len);
 
@@ -197,8 +198,6 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
 		time += float(len) / float(specs.rate);
 	}
 
-	m_factory->unlock();
-
 	m_position += length;
 
 	eos = false;
diff --git a/intern/audaspace/intern/AUD_SequencerReader.h b/intern/audaspace/intern/AUD_SequencerReader.h
index b3c3a3e..6b3dbc9 100644
--- a/intern/audaspace/intern/AUD_SequencerReader.h
+++ b/intern/audaspace/intern/AUD_SequencerReader.h
@@ -32,7 +32,7 @@
 
 #include "AUD_IReader.h"
 #include "AUD_ReadDevice.h"
-#include "AUD_SequencerFactory.h"
+#include "AUD_Sequencer.h"
 #include "AUD_SequencerHandle.h"
 
 /**
@@ -52,22 +52,22 @@ private:
 	AUD_ReadDevice m_device;
 
 	/**
-	 * Saves the SequencerFactory the reader belongs to.
+	 * Saves the sequence the reader belongs to.
 	 */
-	AUD_Reference<AUD_SequencerFactory> m_factory;
+	boost::shared_ptr<AUD_Sequencer> m_sequence;
 
 	/**
 	 * The list of playback handles for the entries.
 	 */
-	std::list<AUD_Reference<AUD_SequencerHandle> > m_handles;
+	std::list<boost::shared_ptr<AUD_SequencerHandle> > m_handles;
 
 	/**
-	 * Last status read from the factory.
+	 * Last status read from the sequence.
 	 */
 	int m_status;
 
 	/**
-	 * Last entry status read from the factory.
+	 * Last entry status read from the sequence.
 	 */
 	int m_entry_status;
 
@@ -81,7 +81,7 @@ public:
 	 * \param reader The reader to mix.
 	 * \param specs The target specification.
 	 */
-	AUD_SequencerReader(AUD_Reference<AUD_SequencerFactory> factory, bool quality = false);
+	AUD_SequencerReader(boost::shared_ptr<AUD_Sequencer> sequence, bool quality = false);
 
 	/**
 	 * Destroys the reader.
diff --git a/intern/audaspace/intern/AUD_SilenceFactory.cpp b/intern/audaspace/intern/AUD_SilenceFactory.cpp
index 0ba553f..85034b3 100644
--- a/intern/audaspace/intern/AUD_SilenceFactory.cpp
+++ b/intern/audaspace/intern/AUD_SilenceFactory.cpp
@@ -35,7 +35,7 @@ AUD_SilenceFactory::AUD_SilenceFactory()
 {
 }
 
-AUD_Reference<AUD_IReader> AUD_SilenceFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SilenceFactory::createReader()
 {
-	return new AUD_SilenceReader();
+	return boost::shared_ptr<AUD_IReader>(new AUD_SilenceReader());
 }
diff --git a/intern/audaspace/intern/AUD_SilenceFactory.h b/intern/audaspace/intern/AUD_SilenceFactory.h
index 3bc7fc0..de62a2f 100644
--- a/intern/audaspace/intern/AUD_SilenceFactory.h
+++ b/intern/audaspace/intern/AUD_SilenceFactory.h
@@ -48,7 +48,7 @@ public:
 	 */
 	AUD_SilenceFactory();
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SILENCEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SinusFactory.cpp b/intern/audaspace/intern/AUD_SinusFactory.cpp
index 3ef6a11..2b9742c 100644
--- a/intern/audaspace/intern/AUD_SinusFactory.cpp
+++ b/intern/audaspace/intern/AUD_SinusFactory.cpp
@@ -42,7 +42,7 @@ float AUD_SinusFactory::getFrequency() const
 	return m_frequency;
 }
 
-AUD_Reference<AUD_IReader> AUD_SinusFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SinusFactory::createReader()
 {
-	return new AUD_SinusReader(m_frequency, m_sampleRate);
+	return boost::shared_ptr<AUD_IReader>(new AUD_SinusReader(m_frequency, m_sampleRate));
 }
diff --git a/intern/audaspace/intern/AUD_SinusFactory.h b/intern/audaspace/intern/AUD_SinusFactory.h
index d83323c..d1909de 100644
--- a/intern/audaspace/intern/AUD_SinusFactory.h
+++ b/intern/audaspace/intern/AUD_SinusFactory.h
@@ -66,7 +66,7 @@ public:
 	 */
 	float getFrequency() const;
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SINUSFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.cpp b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
index 1d993ab..a7e5b25 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.cpp
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
@@ -33,6 +33,7 @@
 #include "AUD_IFactory.h"
 #include "AUD_JOSResampleReader.h"
 #include "AUD_LinearResampleReader.h"
+#include "AUD_MutexLock.h"
 
 #include <cstring>
 #include <cmath>
@@ -56,7 +57,7 @@ typedef enum
 /********************** AUD_SoftwareHandle Handle Code ************************/
 /******************************************************************************/
 
-AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, AUD_Reference<AUD_ResampleReader> resampler, AUD_Reference<AUD_ChannelMapperReader> mapper, bool keep) :
+AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, boost::shared_ptr<AUD_IReader> reader, boost::shared_ptr<AUD_PitchReader> pitch, boost::shared_ptr<AUD_ResampleReader> resampler, boost::shared_ptr<AUD_ChannelMapperReader> mapper, bool keep) :
 	m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(1.0f), m_loopcount(0),
 	m_relative(true), m_volume_max(1.0f), m_volume_min(0), m_distance_max(std::numeric_limits<float>::max()),
 	m_distance_reference(1.0f), m_attenuation(1.0f), m_cone_angle_outer(M_PI), m_cone_angle_inner(M_PI), m_cone_volume_outer(0),
@@ -226,22 +227,28 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::pause()
 {
 	if(m_status)
 	{
-		m_device->lock();
+		AUD_MutexLock lock(*m_device);
 
 		if(m_status == AUD_STATUS_PLAYING)
 		{
-			m_device->m_playingSounds.remove(this);
-			m_device->m_pausedSounds.push_back(this);
+			for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
+			{
+				if(it->get() == this)
+				{
+					boost::shared_ptr<AUD_SoftwareHandle> This = *it;
 
-			if(m_device->m_playingSounds.empty())
-				m_device->playing(m_device->m_playback = false);
-			m_status = AUD_STATUS_PAUSED;
-			m_device->unlock();
+					m_device->m_playingSounds.erase(it);
+					m_device->m_pausedSounds.push_back(This);
 
-			return true;
-		}
+					if(m_device->m_playingSounds.empty())
+						m_device->playing(m_device->m_playback = false);
 
-		m_device->unlock();
+					m_status = AUD_STATUS_PAUSED;
+
+					return true;
+				}
+			}
+		}
 	}
 
 	return false;
@@ -251,21 +258,29 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::resume()
 {
 	if(m_status)
 	{
-		m_device->lock();
+		AUD_MutexLock lock(*m_device);
 
 		if(m_status == AUD_STATUS_PAUSED)
 		{
-			m_device->m_pausedSounds.remove(this);
-			m_device->m_playingSounds.push_back(this);
+			for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+			{
+				if(it->get() == this)
+				{
+					boost::shared_ptr<AUD_SoftwareHandle> This = *it;
 
-			if(!m_device->m_playback)
-				m_device->playing(m_device->m_playback = true);
-			m_status = AUD_STATUS_PLAYING;
-			m_device->unlock();
-			return true;
+					m_device->m_pausedSounds.erase(it);
+
+					m_device->m_playingSounds.push_back(This);
+
+					if(!m_device->m_playback)
+						m_device->playing(m_device->m_playback = true);
+					m_status = AUD_STATUS_PLAYING;
+
+					return true;
+				}
+			}
 		}
 
-		m_device->unlock();
 	}
 
 	return false;
@@ -276,25 +291,38 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::stop()
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return false;
 
-	// AUD_XXX Create a reference of our own object so that it doesn't get
-	// deleted before the end of this function
-	AUD_Reference<AUD_SoftwareHandle> This = this;
+	m_status = AUD_STATUS_INVALID;
 
-	if(m_status == AUD_STATUS_PLAYING)
+	for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
 	{
-		m_device->m_playingSounds.remove(This);
+		if(it->get() == this)
+		{
+			boost::shared_ptr<AUD_SoftwareHandle> This = *it;
 
-		if(m_device->m_playingSounds.empty())
-			m_device->playing(m_device->m_playback = false);
+			m_device->m_playingSounds.erase(it);
+
+			if(m_device->m_playingSounds.empty())
+				m_device->playing(m_device->m_playback = false);
+
+			return true;
+		}
 	}
-	else
-		m_device->m_pausedSounds.remove(This);
 
-	m_device->unlock();
-	m_status = AUD_STATUS_INVALID;
-	return true;
+	for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			m_device->m_pausedSounds.erase(it);
+			return true;
+		}
+	}
+
+	return false;
 }
 
 bool AUD_SoftwareDevice::AUD_SoftwareHandle::getKeep()
@@ -310,11 +338,12 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setKeep(bool keep)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	m_keep = keep;
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	m_keep = keep;
 
 	return true;
 }
@@ -324,11 +353,12 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::seek(float position)
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	m_reader->seek((int)(position * m_reader->getSpecs().rate));
+	if(!m_status)
+		return false;
 
-	m_device->unlock();
+	m_reader->seek((int)(position * m_reader->getSpecs().rate));
 
 	return true;
 }
@@ -336,13 +366,14 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::seek(float position)
 float AUD_SoftwareDevice::AUD_SoftwareHandle::getPosition()
 {
 	if(!m_status)
-		return 0.0f;
+		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
 
-	float position = m_reader->getPosition() / (float)m_device->m_specs.rate;
+	if(!m_status)
+		return 0.0f;
 
-	m_device->unlock();
+	float position = m_reader->getPosition() / (float)m_device->m_specs.rate;
 
 	return position;
 }
@@ -407,13 +438,14 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setStopCallback(stopCallback callba
 	if(!m_status)
 		return false;
 
-	m_device->lock();
+	AUD_MutexLock lock(*m_device);
+
+	if(!m_status)
+		return false;
 
 	m_stop = callback;
 	m_stop_data = data;
 
-	m_device->unlock();
-
 	return true;
 }
 
@@ -657,7 +689,7 @@ void AUD_SoftwareDevice::create()
 {
 	m_playback = false;
 	m_volume = 1.0f;
-	m_mixer = new AUD_Mixer(m_specs);
+	m_mixer = boost::shared_ptr<AUD_Mixer>(new AUD_Mixer(m_specs));
 	m_speed_of_sound = 343.0f;
 	m_doppler_factor = 1.0f;
 	m_distance_model = AUD_DISTANCE_MODEL_INVERSE_CLAMPED;
@@ -691,15 +723,15 @@ void AUD_SoftwareDevice::mix(data_t* buffer, int length)
 {
 	m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
 
-	lock();
+	AUD_MutexLock lock(*this);
 
 	{
-		AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound;
+		boost::shared_ptr<AUD_SoftwareDevice::AUD_SoftwareHandle> sound;
 		int len;
 		int pos;
 		bool eos;
-		std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > stopSounds;
-		std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > pauseSounds;
+		std::list<boost::shared_ptr<AUD_SoftwareDevice::AUD_SoftwareHandle> > stopSounds;
+		std::list<boost::shared_ptr<AUD_SoftwareDevice::AUD_SoftwareHandle> > pauseSounds;
 		sample_t* buf = m_buffer.getBuffer();
 
 		m_mixer->clear(length);
@@ -775,8 +807,6 @@ void AUD_SoftwareDevice::mix(data_t* buffer, int length)
 			sound->pause();
 		}
 	}
-
-	unlock();
 }
 
 void AUD_SoftwareDevice::setPanning(AUD_IHandle* handle, float pan)
@@ -806,59 +836,57 @@ AUD_DeviceSpecs AUD_SoftwareDevice::getSpecs() const
 	return m_specs;
 }
 
-AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_SoftwareDevice::play(boost::shared_ptr<AUD_IReader> reader, bool keep)
 {
 	// prepare the reader
 	// pitch
 
-	AUD_Reference<AUD_PitchReader> pitch = new AUD_PitchReader(reader, 1);
-	reader = AUD_Reference<AUD_IReader>(pitch);
+	boost::shared_ptr<AUD_PitchReader> pitch = boost::shared_ptr<AUD_PitchReader>(new AUD_PitchReader(reader, 1));
+	reader = boost::shared_ptr<AUD_IReader>(pitch);
 
-	AUD_Reference<AUD_ResampleReader> resampler;
+	boost::shared_ptr<AUD_ResampleReader> resampler;
 
 	// resample
 	if(m_quality)
-		resampler = new AUD_JOSResampleReader(reader, m_specs.specs);
+		resampler = boost::shared_ptr<AUD_ResampleReader>(new AUD_JOSResampleReader(reader, m_specs.specs));
 	else
-		resampler = new AUD_LinearResampleReader(reader, m_specs.specs);
-	reader = AUD_Reference<AUD_IReader>(resampler);
+		resampler = boost::shared_ptr<AUD_ResampleReader>(new AUD_LinearResampleReader(reader, m_specs.specs));
+	reader = boost::shared_ptr<AUD_IReader>(resampler);
 
 	// rechannel
-	AUD_Reference<AUD_ChannelMapperReader> mapper = new AUD_ChannelMapperReader(reader, m_specs.channels);
-	reader = AUD_Reference<AUD_IReader>(mapper);
+	boost::shared_ptr<AUD_ChannelMapperReader> mapper = boost::shared_ptr<AUD_ChannelMapperReader>(new AUD_ChannelMapperReader(reader, m_specs.channels));
+	reader = boost::shared_ptr<AUD_IReader>(mapper);
 
-	if(reader.isNull())
-		return AUD_Reference<AUD_IHandle>();
+	if(!reader.get())
+		return boost::shared_ptr<AUD_IHandle>();
 
 	// play sound
-	AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, resampler, mapper, keep);
+	boost::shared_ptr<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = boost::shared_ptr<AUD_SoftwareDevice::AUD_SoftwareHandle>(new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, resampler, mapper, keep));
+
+	AUD_MutexLock lock(*this);
 
-	lock();
 	m_playingSounds.push_back(sound);
 
 	if(!m_playback)
 		playing(m_playback = true);
-	unlock();
 
-	return AUD_Reference<AUD_IHandle>(sound);
+	return boost::shared_ptr<AUD_IHandle>(sound);
 }
 
-AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IFactory> factory, bool keep)
+boost::shared_ptr<AUD_IHandle> AUD_SoftwareDevice::play(boost::shared_ptr<AUD_IFactory> factory, bool keep)
 {
 	return play(factory->createReader(), keep);
 }
 
 void AUD_SoftwareDevice::stopAll()
 {
-	lock();
+	AUD_MutexLock lock(*this);
 
 	while(!m_playingSounds.empty())
 		m_playingSounds.front()->stop();
 
 	while(!m_pausedSounds.empty())
 		m_pausedSounds.front()->stop();
-
-	unlock();
 }
 
 void AUD_SoftwareDevice::lock()
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.h b/intern/audaspace/intern/AUD_SoftwareDevice.h
index c429508..8675a5c 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.h
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.h
@@ -59,16 +59,16 @@ protected:
 	{
 	public:
 		/// The reader source.
-		AUD_Reference<AUD_IReader> m_reader;
+		boost::shared_ptr<AUD_IReader> m_reader;
 
 		/// The pitch reader in between.
-		AUD_Reference<AUD_PitchReader> m_pitch;
+		boost::shared_ptr<AUD_PitchReader> m_pitch;
 
 		/// The resample reader in between.
-		AUD_Reference<AUD_ResampleReader> m_resampler;
+		boost::shared_ptr<AUD_ResampleReader> m_resampler;
 
 		/// The channel mapper reader in between.
-		AUD_Reference<AUD_ChannelMapperReader> m_mapper;
+		boost::shared_ptr<AUD_ChannelMapperReader> m_mapper;
 
 		/// Whether to keep the source if end of it is reached.
 		bool m_keep;
@@ -150,7 +150,7 @@ protected:
 		 * \param mapper The channel mapping reader.
 		 * \param keep Whether to keep the handle when the sound ends.
 		 */
-		AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, AUD_Reference<AUD_ResampleReader> resampler, AUD_Reference<AUD_ChannelMapperReader> mapper, bool keep);
+		AUD_SoftwareHandle(AUD_SoftwareDevice* device, boost::shared_ptr<AUD_IReader> reader, boost::shared_ptr<AUD_PitchReader> pitch, boost::shared_ptr<AUD_ResampleReader> resampler, boost::shared_ptr<AUD_ChannelMapperReader> mapper, bool keep);
 
 		/**
 		 * Updates the handle's playback parameters.
@@ -206,7 +206,7 @@ protected:
 		virtual bool setConeVolumeOuter(float volume);
 	};
 
-	typedef std::list<AUD_Reference<AUD_SoftwareHandle> >::iterator AUD_HandleIterator;
+	typedef std::list<boost::shared_ptr<AUD_SoftwareHandle> >::iterator AUD_HandleIterator;
 
 	/**
 	 * The specification of the device.
@@ -216,7 +216,7 @@ protected:
 	/**
 	 * The mixer.
 	 */
-	AUD_Reference<AUD_Mixer> m_mixer;
+	boost::shared_ptr<AUD_Mixer> m_mixer;
 
 	/**
 	 * Whether to do high or low quality resampling.
@@ -261,12 +261,12 @@ private:
 	/**
 	 * The list of sounds that are currently playing.
 	 */
-	std::list<AUD_Reference<AUD_SoftwareHandle> > m_playingSounds;
+	std::list<boost::shared_ptr<AUD_SoftwareHandle> > m_playingSounds;
 
 	/**
 	 * The list of sounds that are currently paused.
 	 */
-	std::list<AUD_Reference<AUD_SoftwareHandle> > m_pausedSounds;
+	std::list<boost::shared_ptr<AUD_SoftwareHandle> > m_pausedSounds;
 
 	/**
 	 * Whether there is currently playback.
@@ -320,8 +320,8 @@ public:
 	void setQuality(bool quality);
 
 	virtual AUD_DeviceSpecs getSpecs() const;
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false);
-	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IReader> reader, bool keep = false);
+	virtual boost::shared_ptr<AUD_IHandle> play(boost::shared_ptr<AUD_IFactory> factory, bool keep = false);
 	virtual void stopAll();
 	virtual void lock();
 	virtual void unlock();
diff --git a/intern/audaspace/intern/AUD_StreamBufferFactory.cpp b/intern/audaspace/intern/AUD_StreamBufferFactory.cpp
index 1c8d2a9..daa714a 100644
--- a/intern/audaspace/intern/AUD_StreamBufferFactory.cpp
+++ b/intern/audaspace/intern/AUD_StreamBufferFactory.cpp
@@ -33,10 +33,10 @@
 
 #include <cstring>
 
-AUD_StreamBufferFactory::AUD_StreamBufferFactory(AUD_Reference<AUD_IFactory> factory) :
+AUD_StreamBufferFactory::AUD_StreamBufferFactory(boost::shared_ptr<AUD_IFactory> factory) :
 	m_buffer(new AUD_Buffer())
 {
-	AUD_Reference<AUD_IReader> reader = factory->createReader();
+	boost::shared_ptr<AUD_IReader> reader = factory->createReader();
 
 	m_specs = reader->getSpecs();
 
@@ -70,7 +70,7 @@ AUD_StreamBufferFactory::AUD_StreamBufferFactory(AUD_Reference<AUD_IFactory> fac
 	m_buffer->resize(index * sample_size, true);
 }
 
-AUD_Reference<AUD_IReader> AUD_StreamBufferFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_StreamBufferFactory::createReader()
 {
-	return new AUD_BufferReader(m_buffer, m_specs);
+	return boost::shared_ptr<AUD_IReader>(new AUD_BufferReader(m_buffer, m_specs));
 }
diff --git a/intern/audaspace/intern/AUD_StreamBufferFactory.h b/intern/audaspace/intern/AUD_StreamBufferFactory.h
index 99795d9..1bcd73d 100644
--- a/intern/audaspace/intern/AUD_StreamBufferFactory.h
+++ b/intern/audaspace/intern/AUD_StreamBufferFactory.h
@@ -31,9 +31,10 @@
 #define __AUD_STREAMBUFFERFACTORY_H__
 
 #include "AUD_IFactory.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
+#include <boost/shared_ptr.hpp>
+
 /**
  * This factory creates a buffer out of a reader. This way normally streamed
  * sound sources can be loaded into memory for buffered playback.
@@ -44,7 +45,7 @@ private:
 	/**
 	 * The buffer that holds the audio data.
 	 */
-	AUD_Reference<AUD_Buffer> m_buffer;
+	boost::shared_ptr<AUD_Buffer> m_buffer;
 
 	/**
 	 * The specification of the samples.
@@ -62,9 +63,9 @@ public:
 	 * \param factory The factory that creates the reader for buffering.
 	 * \exception AUD_Exception Thrown if the reader cannot be created.
 	 */
-	AUD_StreamBufferFactory(AUD_Reference<AUD_IFactory> factory);
+	AUD_StreamBufferFactory(boost::shared_ptr<AUD_IFactory> factory);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_STREAMBUFFERFACTORY_H__
diff --git a/intern/audaspace/sndfile/AUD_SndFileFactory.cpp b/intern/audaspace/sndfile/AUD_SndFileFactory.cpp
index 1fc77fb..106b293 100644
--- a/intern/audaspace/sndfile/AUD_SndFileFactory.cpp
+++ b/intern/audaspace/sndfile/AUD_SndFileFactory.cpp
@@ -43,10 +43,10 @@ AUD_SndFileFactory::AUD_SndFileFactory(const data_t* buffer, int size) :
 	memcpy(m_buffer->getBuffer(), buffer, size);
 }
 
-AUD_Reference<AUD_IReader> AUD_SndFileFactory::createReader()
+boost::shared_ptr<AUD_IReader> AUD_SndFileFactory::createReader()
 {
-	if(m_buffer.isNull())
-		return new AUD_SndFileReader(m_filename);
+	if(m_buffer.get())
+		return boost::shared_ptr<AUD_IReader>(new AUD_SndFileReader(m_buffer));
 	else
-		return new AUD_SndFileReader(m_buffer);
+		return boost::shared_ptr<AUD_IReader>(new AUD_SndFileReader(m_filename));
 }
diff --git a/intern/audaspace/sndfile/AUD_SndFileFactory.h b/intern/audaspace/sndfile/AUD_SndFileFactory.h
index 7039c7a..bc96325 100644
--- a/intern/audaspace/sndfile/AUD_SndFileFactory.h
+++ b/intern/audaspace/sndfile/AUD_SndFileFactory.h
@@ -31,10 +31,10 @@
 #define __AUD_SNDFILEFACTORY_H__
 
 #include "AUD_IFactory.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
 #include <string>
+#include <boost/shared_ptr.hpp>
 
 /**
  * This factory reads a sound file via libsndfile.
@@ -50,7 +50,7 @@ private:
 	/**
 	 * The buffer to read from.
 	 */
-	AUD_Reference<AUD_Buffer> m_buffer;
+	boost::shared_ptr<AUD_Buffer> m_buffer;
 
 	// hide copy constructor and operator=
 	AUD_SndFileFactory(const AUD_SndFileFactory&);
@@ -70,7 +70,7 @@ public:
 	 */
 	AUD_SndFileFactory(const data_t* buffer, int size);
 
-	virtual AUD_Reference<AUD_IReader> createReader();
+	virtual boost::shared_ptr<AUD_IReader> createReader();
 };
 
 #endif //__AUD_SNDFILEFACTORY_H__
diff --git a/intern/audaspace/sndfile/AUD_SndFileReader.cpp b/intern/audaspace/sndfile/AUD_SndFileReader.cpp
index 8dbb43c..aaee814 100644
--- a/intern/audaspace/sndfile/AUD_SndFileReader.cpp
+++ b/intern/audaspace/sndfile/AUD_SndFileReader.cpp
@@ -100,7 +100,7 @@ AUD_SndFileReader::AUD_SndFileReader(std::string filename) :
 	m_seekable = sfinfo.seekable;
 }
 
-AUD_SndFileReader::AUD_SndFileReader(AUD_Reference<AUD_Buffer> buffer) :
+AUD_SndFileReader::AUD_SndFileReader(boost::shared_ptr<AUD_Buffer> buffer) :
 	m_position(0),
 	m_membuffer(buffer),
 	m_memoffset(0)
diff --git a/intern/audaspace/sndfile/AUD_SndFileReader.h b/intern/audaspace/sndfile/AUD_SndFileReader.h
index 81d8b45..5cac505 100644
--- a/intern/audaspace/sndfile/AUD_SndFileReader.h
+++ b/intern/audaspace/sndfile/AUD_SndFileReader.h
@@ -31,11 +31,11 @@
 #define __AUD_SNDFILEREADER_H__
 
 #include "AUD_IReader.h"
-#include "AUD_Reference.h"
 #include "AUD_Buffer.h"
 
 #include <string>
 #include <sndfile.h>
+#include <boost/shared_ptr.hpp>
 
 typedef sf_count_t (*sf_read_f)(SNDFILE *sndfile, void *ptr, sf_count_t frames);
 
@@ -78,7 +78,7 @@ private:
 	/**
 	 * The pointer to the memory file.
 	 */
-	AUD_Reference<AUD_Buffer> m_membuffer;
+	boost::shared_ptr<AUD_Buffer> m_membuffer;
 
 	/**
 	 * The current reading pointer of the memory file.
@@ -110,7 +110,7 @@ public:
 	 * \exception AUD_Exception Thrown if the buffer specified cannot be read
 	 *                          with libsndfile.
 	 */
-	AUD_SndFileReader(AUD_Reference<AUD_Buffer> buffer);
+	AUD_SndFileReader(boost::shared_ptr<AUD_Buffer> buffer);
 
 	/**
 	 * Destroys the reader and closes the file.
diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt
index 136c168..e3907c5 100644
--- a/intern/bsp/CMakeLists.txt
+++ b/intern/bsp/CMakeLists.txt
@@ -29,11 +29,10 @@ set(INC
 	../guardedalloc
 	../memutil
 	../moto/include
-	../../extern/carve/include
 )
 
 set(INC_SYS
-
+	../../extern/carve/include
 )
 
 set(SRC
diff --git a/intern/bsp/extern/CSG_BooleanOps.h b/intern/bsp/extern/CSG_BooleanOps.h
index 94a74c3..5ba6e0d 100644
--- a/intern/bsp/extern/CSG_BooleanOps.h
+++ b/intern/bsp/extern/CSG_BooleanOps.h
@@ -61,9 +61,9 @@ extern "C" {
 #endif
 
 typedef struct  {
-  int vertex_index[4];
-  int vertex_number;
-  int orig_face;
+	int vertex_index[4];
+	int vertex_number;
+	int orig_face;
 } CSG_IFace;
 
 /**
@@ -72,7 +72,7 @@ typedef struct  {
  */
 
 typedef struct  {
-  float position[3];
+	float position[3];
 } CSG_IVertex;
 
 /**
diff --git a/intern/bsp/intern/BOP_CarveInterface.cpp b/intern/bsp/intern/BOP_CarveInterface.cpp
index 1f9c989..bb3a783 100644
--- a/intern/bsp/intern/BOP_CarveInterface.cpp
+++ b/intern/bsp/intern/BOP_CarveInterface.cpp
@@ -60,7 +60,7 @@ static bool isQuadPlanar(carve::geom3d::Vector &v1, carve::geom3d::Vector &v2,
 	float production = carve::geom::dot(cross, vec3);
 	float magnitude = 1e-5 * cross.length();
 
-	return fabs(production) < magnitude;
+	return fabsf(production) < magnitude;
 }
 
 static bool isFacePlanar(CSG_IFace &face, std::vector<carve::geom3d::Vector> &vertices)
@@ -135,10 +135,10 @@ static bool Carve_checkEdgeFaceIntersections(carve::csg::Intersections &intersec
 
 static inline bool Carve_facesAreCoplanar(const MeshSet<3>::face_t *a, const MeshSet<3>::face_t *b)
 {
-  carve::geom3d::Ray temp;
-  // XXX: Find a better definition. This may be a source of problems
-  // if floating point inaccuracies cause an incorrect answer.
-  return !carve::geom3d::planeIntersection(a->plane, b->plane, temp);
+	carve::geom3d::Ray temp;
+	// XXX: Find a better definition. This may be a source of problems
+	// if floating point inaccuracies cause an incorrect answer.
+	return !carve::geom3d::planeIntersection(a->plane, b->plane, temp);
 }
 
 static bool Carve_checkMeshSetInterseciton_do(carve::csg::Intersections &intersections,
@@ -205,7 +205,7 @@ static void Carve_getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> &
 	std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin();
 	std::vector< RTreeNode<3, Face<3> *> *> meshRTree;
 
-	while(it != meshes.end()) {
+	while (it != meshes.end()) {
 		MeshSet<3>::mesh_t *mesh = *it;
 		bool isAdded = false;
 
@@ -279,7 +279,7 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
 		return poly;
 	}
 
-	while(orig_meshes.size()) {
+	while (orig_meshes.size()) {
 		MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, otherAABB);
 
 		if (!right) {
@@ -559,8 +559,6 @@ static bool Carve_checkDegeneratedFace(std::map<MeshSet<3>::vertex_t*, uint> *ve
 
 		if (v1 == v2 || v2 == v3 || v1 == v3)
 			return true;
-
-		return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON;
 	}
 	else if (face->n_edges == 4) {
 		uint v1, v2, v3, v4;
@@ -572,9 +570,6 @@ static bool Carve_checkDegeneratedFace(std::map<MeshSet<3>::vertex_t*, uint> *ve
 
 		if (v1 == v2 || v1 == v3 || v1 == v4 || v2 == v3 || v2 == v4 || v3 == v4)
 			return true;
-
-		return triangleArea(face->edge->vert->v, face->edge->next->vert->v, face->edge->next->next->vert->v) +
-		       triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->next->vert->v) < DBL_EPSILON;
 	}
 
 	return false;
diff --git a/intern/container/CMakeLists.txt b/intern/container/CMakeLists.txt
index b29eea3..8adc46a 100644
--- a/intern/container/CMakeLists.txt
+++ b/intern/container/CMakeLists.txt
@@ -33,14 +33,11 @@ set(INC_SYS
 )
 
 set(SRC
-	intern/CTR_List.cpp
-
 	CTR_HashedPtr.h
-	CTR_List.h
 	CTR_Map.h
 	CTR_TaggedIndex.h
 	CTR_TaggedSetOps.h
-	CTR_UHeap.h
 )
 
+# infact nothing to compile!
 blender_add_lib(bf_intern_ctr "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/container/CTR_HashedPtr.h b/intern/container/CTR_HashedPtr.h
index 11dc37b..ee832ee 100644
--- a/intern/container/CTR_HashedPtr.h
+++ b/intern/container/CTR_HashedPtr.h
@@ -30,8 +30,8 @@
  *  \ingroup ctr
  */
 
-#ifndef CTR_HASHEDPTR_H
-#define CTR_HASHEDPTR_H
+#ifndef __CTR_HASHEDPTR_H__
+#define __CTR_HASHEDPTR_H__
 
 #include <stdlib.h>
 
@@ -43,13 +43,20 @@ inline unsigned int CTR_Hash(void *inDWord)
 
 class CTR_HashedPtr
 {
-	void* m_valptr;
+	void *m_valptr;
 public:
-	CTR_HashedPtr(void* val) : m_valptr(val) {};
-	unsigned int hash() const { return CTR_Hash(m_valptr);};
-	inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
-	void *getValue() const { return m_valptr; }
+	CTR_HashedPtr(void *val) : m_valptr(val) {
+	}
+	unsigned int hash() const {
+		return CTR_Hash(m_valptr);
+	}
+	inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) {
+		return rhs.m_valptr == lhs.m_valptr;
+	}
+	void *getValue() const {
+		return m_valptr;
+	}
 };
 
-#endif //CTR_HASHEDPTR_H
+#endif  /* __CTR_HASHEDPTR_H__ */
 
diff --git a/intern/container/CTR_List.h b/intern/container/CTR_List.h
deleted file mode 100644
index 404a08f..0000000
--- a/intern/container/CTR_List.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/CTR_List.h
- *  \ingroup ctr
- */
-
-
-
-#ifndef CTR_LIST_H
-#define CTR_LIST_H
-
-class CTR_Link {
-public:
-	CTR_Link(
-	);
-
-	CTR_Link(
-		CTR_Link *next,
-		CTR_Link *prev
-	);
-
-		CTR_Link *
-	getNext(
-	) const;
-
-		CTR_Link *
-	getPrev(
-	) const;
-
-		bool 
-	isHead(
-	) const;
-
-		bool 
-	isTail(
-	) const;
-
-		void 
-	insertBefore(
-		CTR_Link *link
-	);
-
-		void 
-	insertAfter(
-		CTR_Link *link
-	);
-
-		void 
-	remove(
-	);
-
-private:  
-	CTR_Link  *m_next;
-	CTR_Link  *m_prev;
-};
-
-class CTR_List {
-public:
-
-	CTR_List(
-	);
-
-		CTR_Link *
-	getHead(
-	) const;
- 
-		CTR_Link *
-	getTail(
-	) const;
-
-		void 
-	addHead(
-		CTR_Link *link
-	);
-
-		void 
-	addTail(
-		CTR_Link *link
-	);
-
-private:
-	CTR_Link m_head;
-	CTR_Link m_tail;
-};
-
-#endif
-
diff --git a/intern/container/CTR_Map.h b/intern/container/CTR_Map.h
index 9557821..c278fe5 100644
--- a/intern/container/CTR_Map.h
+++ b/intern/container/CTR_Map.h
@@ -29,22 +29,22 @@
  *  \ingroup ctr
  */
 
-
-#ifndef CTR_MAP_H
-#define CTR_MAP_H
+#ifndef __CTR_MAP_H__
+#define __CTR_MAP_H__
 
 template <class Key, class Value>
 class CTR_Map {
 private:
 	struct Entry {
 		Entry (Entry *next, Key key, Value value) :
-		    m_next(next),
-		    m_key(key),
-		    m_value(value) {}
+			m_next(next),
+			m_key(key),
+			m_value(value) {
+		}
 
 		Entry *m_next;
-		Key    m_key;
-		Value  m_value;
+		Key m_key;
+		Value m_value;
 	};
 
 public:
@@ -63,18 +63,18 @@ public:
 		for (int i = 0; i < m_num_buckets; ++i) {
 			m_buckets[i] = 0;
 
-			for (Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+			for (Entry *entry = map.m_buckets[i]; entry; entry = entry->m_next) {
 				insert(entry->m_key, entry->m_value);
+			}
 		}
 	}
 
-	int size() {
-		int count=0;
-		for (int i=0;i<m_num_buckets;i++)
-		{
-			Entry* bucket = m_buckets[i];
-			while(bucket)
-			{
+	int size()
+	{
+		int count = 0;
+		for (int i = 0; i < m_num_buckets; i++) {
+			Entry *bucket = m_buckets[i];
+			while (bucket) {
 				bucket = bucket->m_next;
 				count++;
 			}
@@ -82,15 +82,13 @@ public:
 		return count;
 	}
 
-	Value* at(int index) {
-		int count=0;
-		for (int i=0;i<m_num_buckets;i++)
-		{
-			Entry* bucket = m_buckets[i];
-			while(bucket)
-			{
-				if (count==index)
-				{
+	Value *at(int index)
+	{
+		int count = 0;
+		for (int i = 0; i < m_num_buckets; i++) {
+			Entry *bucket = m_buckets[i];
+			while (bucket) {
+				if (count == index) {
 					return &bucket->m_value;
 				}
 				bucket = bucket->m_next;
@@ -100,15 +98,13 @@ public:
 		return 0;
 	}
 
-	Key* getKey(int index) {
-		int count=0;
-		for (int i=0;i<m_num_buckets;i++)
-		{
-			Entry* bucket = m_buckets[i];
-			while(bucket)
-			{
-				if (count==index)
-				{
+	Key *getKey(int index)
+	{
+		int count = 0;
+		for (int i = 0; i < m_num_buckets; i++) {
+			Entry *bucket = m_buckets[i];
+			while (bucket) {
+				if (count == index) {
 					return &bucket->m_key;
 				}
 				bucket = bucket->m_next;
@@ -118,7 +114,8 @@ public:
 		return 0;
 	}
 
-	void clear() {
+	void clear()
+	{
 		for (int i = 0; i < m_num_buckets; ++i) {
 			Entry *entry_ptr = m_buckets[i];
 
@@ -131,12 +128,14 @@ public:
 		}
 	}
 
-	~CTR_Map() {
+	~CTR_Map()
+	{
 		clear();
-		delete [] m_buckets;
+		delete[] m_buckets;
 	}
 
-	void insert(const Key& key, const Value& value) {
+	void insert(const Key& key, const Value& value)
+	{
 		Entry *entry_ptr = m_buckets[key.hash() % m_num_buckets];
 		while ((entry_ptr != 0) && !(key == entry_ptr->m_key)) {
 			entry_ptr = entry_ptr->m_next;
@@ -151,7 +150,8 @@ public:
 		}
 	}
 
-	void remove(const Key& key) {
+	void remove(const Key& key)
+	{
 		Entry **entry_ptr = &m_buckets[key.hash() % m_num_buckets];
 		while ((*entry_ptr != 0) && !(key == (*entry_ptr)->m_key)) {
 			entry_ptr = &(*entry_ptr)->m_next;
@@ -164,7 +164,8 @@ public:
 		}
 	}
 
-	Value *operator[](Key key) {
+	Value *operator[](Key key)
+	{
 		Entry *bucket = m_buckets[key.hash() % m_num_buckets];
 		while ((bucket != 0) && !(key == bucket->m_key)) {
 			bucket = bucket->m_next;
@@ -177,5 +178,4 @@ private:
 	Entry **m_buckets;
 };
 
-#endif
-
+#endif  /* __CTR_MAP_H__ */
diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h
index 8420414..0eb4e02 100644
--- a/intern/container/CTR_TaggedIndex.h
+++ b/intern/container/CTR_TaggedIndex.h
@@ -29,13 +29,6 @@
  *  \ingroup ctr
  */
 
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- * Simple tagged index class.
- */
-
 #ifndef __CTR_TAGGEDINDEX_H__
 #define __CTR_TAGGEDINDEX_H__
 
@@ -53,7 +46,6 @@
 #include "MEM_sys_types.h"
 
 enum {
-
 	empty_tag = 0x0,
 	empty_index = 0xffffffff
 };
@@ -191,7 +183,7 @@ public:
 		return (Tag() == Empty().Tag());
 	}
 	
-	// functionals 
+	/* functionals */
 
 	struct greater : std::binary_function<CTR_TaggedIndex, CTR_TaggedIndex, bool>
 	{
@@ -213,7 +205,6 @@ private :
 	unsigned int m_val;
 
 
-};			
-
-#endif
+};
 
+#endif  /* __CTR_TAGGEDINDEX_H__ */
diff --git a/intern/container/CTR_TaggedSetOps.h b/intern/container/CTR_TaggedSetOps.h
index d30081d..6ebf20b 100644
--- a/intern/container/CTR_TaggedSetOps.h
+++ b/intern/container/CTR_TaggedSetOps.h
@@ -50,16 +50,16 @@
  * type ObjectType must have the following public methods to be used by
  * this template class:
  *
- * 	int
+ *  int
  * OpenTag(void) --- return a persistent tag value for the primitive
  *
- *	void
+ *  void
  * SetOpenTag(int bla) --- set the persistent tag value for this primitive to bla.
  *
- *	bool
+ *  bool
  * SelectTag() --- return a persistent boolean tag for this primitive
  *
- *	void
+ *  void
  * SetSelectTag(bool bla) --- set the persistent boolean tag for this primitive to bla.
  *
  * Here persistent means that the tag should be associated with the object for the
@@ -86,16 +86,16 @@ public :
 		unsigned int shift
 	) {
 
-		// iterate through vectors in index_list
-		// iterate through individual members of each vector
-		// mark each obejct that the index points to 
+		/* iterate through vectors in index_list
+		 * iterate through individual members of each vector
+		 * mark each obejct that the index points to */
 
 		typename std::vector< std::vector<IndexType> >::const_iterator 
 			last_vector = index_list.end();
 		typename std::vector< std::vector<IndexType> >::const_iterator 
 			start_vector = index_list.begin();
 
-		// FIXME some temporary space
+		/* FIXME some temporary space */
 
 		std::vector<IndexType> temp_union;
 		temp_union.reserve(64);
@@ -114,7 +114,7 @@ public :
 				ObjectType & prim = primitives[*start_index];
 
 				if (!prim.OpenTag()) {
-					// compute the union
+					/* compute the union */
 					temp_union.push_back(*start_index);
 				}
 				int tag = prim.OpenTag();
@@ -126,7 +126,7 @@ public :
 			++tag_num;
 		}
 				
-		// now iterate through the union and pull out all those with the right tag
+		/* now iterate through the union and pull out all those with the right tag */
 		
 		typename std::vector<IndexType>::const_iterator last_index = 
 			temp_union.end();
@@ -138,20 +138,20 @@ public :
 			ObjectType & prim = primitives[*start_index];
 
 			if (prim.OpenTag() == tag_num) {
-				//it's part of the intersection!
+				/* it's part of the intersection! */
 
 				output.push_back(*start_index);
-				// because we're iterating through the union 
-				// it's safe to remove the tag at this point
+				/* because we're iterating through the union
+				 * it's safe to remove the tag at this point */
 
 				prim.SetOpenTag(prim.OpenTag() & ~mask);
 			}
 		}
 	};
 		
-	// note not a strict set intersection!
-	// if x appears twice in b and is part of the intersection
-	// it will appear twice in the intersection
+	/* note not a strict set intersection!
+	 * if x appears twice in b and is part of the intersection
+	 * it will appear twice in the intersection */
 
 	static
 		void
@@ -180,7 +180,7 @@ public :
 				output.push_back(*start_index);
 			}
 		}
-		// deselect
+		/* deselect */
 		last_index = a.end();
 		start_index = a.begin();
 
@@ -199,9 +199,9 @@ public :
 		std::vector<IndexType> &output
 	) {
 	
-		// iterate through vectors in index_list
-		// iterate through individual members of each vector
-		// mark each obejct that the index points to 
+		/* iterate through vectors in index_list
+		 * iterate through individual members of each vector
+		 * mark each obejct that the index points to */
 
 		typename std::vector< std::vector<IndexType> >::const_iterator 
 			last_vector = index_list.end();
@@ -220,15 +220,15 @@ public :
 				ObjectType & prim = primitives[*start_index];
 
 				if (!prim.SelectTag()) {
-					// compute the union
+					/* compute the union */
 					output.push_back(*start_index);
 					prim.SetSelectTag(true);
 				}
 			}
 		}
 				
-		// now iterate through the union and reset the tags
-		
+		/* now iterate through the union and reset the tags */
+
 		typename std::vector<IndexType>::const_iterator last_index = 
 			output.end();
 		typename std::vector<IndexType>::iterator start_index = 
@@ -238,7 +238,7 @@ public :
 
 			ObjectType & prim = primitives[*start_index];
 			prim.SetSelectTag(false);
-		}			
+		}
 	}
 
 
@@ -251,8 +251,8 @@ public :
 		std::vector< IndexType> &output
 	) {
 
-		// iterate through b mark all
-		// iterate through a and add to output all unmarked 
+		/* iterate through b mark all
+		 * iterate through a and add to output all unmarked */
 
 		typename std::vector<IndexType>::const_iterator last_index = 
 			b.end();
@@ -276,7 +276,7 @@ public :
 			}
 		}
 
-		// clean up the tags
+		/* clean up the tags */
 	
 		last_index = b.end();
 		start_index = b.begin();
@@ -290,12 +290,11 @@ public :
 
 private :
 
-	// private constructor - this class is not meant for
-	// instantiation
+	/* private constructor - this class is not meant for
+	 * instantiation */
 
 	CTR_TaggedSetOps();
 
 };
 
-#endif
-
+#endif  /* __CTR_TAGGEDSETOPS_H__ */
diff --git a/intern/container/CTR_UHeap.h b/intern/container/CTR_UHeap.h
deleted file mode 100644
index 8330faa..0000000
--- a/intern/container/CTR_UHeap.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/CTR_UHeap.h
- *  \ingroup ctr
- */
-
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- *
- * @author Laurence
- * @mainpage CTR_UHeap an updatable heap template class (also
- * known as an updatable priority queue)
- *
- * Todo: Make CTR_UHeapable a template class with m_key the
- * template parameter, so that arbitrary value types with
- * operators (=,>) defined can be used.
- *
- */
-
-#ifndef __CTR_UHEAP_H__
-#define __CTR_UHEAP_H__
-
-#include <vector>
-
-#include "MEM_NonCopyable.h"
-
-class CTR_UHeapable {
-
-public:
-	int &
-	HeapPos(
-	    ) {
-		return m_ind;
-	};
-	float &
-	HeapKey(
-	    ) {
-		return m_key;
-	};
-
-	const 
-	float &
-	HeapKey(
-	    ) const {
-		return m_key;
-	};
-
-	const 
-	int &
-	HeapPos(
-	    ) const {
-		return m_ind;
-	};
-
-private:
-
-	float m_key;
-	int m_ind;
-
-protected:
-
-	CTR_UHeapable(
-	    ) : m_key(0),
-		m_ind(0)
-	{
-	};
-
-	~CTR_UHeapable(
-	    ) {
-	};
-};
-	
-template <class HeapType> 	
-class CTR_UHeap : public MEM_NonCopyable
-{
-
-public:		
-
-	static
-	CTR_UHeap *
-	New(
-	    ) {
-		return new CTR_UHeap();
-	}
-
-	void
-	MakeHeap(
-	    HeapType *base
-	    ) {
-		int i;
-		int start = Parent(m_vector.size() - 1);
-		for (i = start; i >= 0; --i) {
-			DownHeap(base, i);
-		}
-	}; 
-	
-	void
-	Insert(
-	    HeapType *base,
-	    int elem
-	    ) {
-		// add element to vector
-		m_vector.push_back(elem);
-		base[elem].HeapPos() = m_vector.size() - 1;
-
-		// push the element up the heap
-		UpHeap(base, m_vector.size() - 1);
-	}
-
-	// access to the vector for initial loading of elements
-
-	std::vector<int> &
-	HeapVector(
-	    ) {
-		return m_vector;
-	};
-
-
-	void
-	Remove(
-	    HeapType *base,
-	    int i
-	    ) {
-	
-		// exchange with last element - pop last
-		// element and move up or down the heap as appropriate
-		if (m_vector.empty()) {
-			assert(false);
-		}
-
-		if (i != int(m_vector.size()) - 1) {
-			
-			Swap(base, i, m_vector.size() - 1);
-			m_vector.pop_back();
-
-			if (!m_vector.empty()) {
-				UpHeap(base, i);
-				DownHeap(base, i);
-			}
-		}
-		else {
-			m_vector.pop_back();
-		}
-	}
-
-	int
-	Top(
-	    ) const {
-		if (m_vector.empty()) return -1;
-		return m_vector[0];
-	}
-		
-
-	void
-	SC_Heap(
-	    HeapType *base
-	    ) {
-		int i;
-		for (i = 1; i < int(m_vector.size()); i++) {
-			
-			CTR_UHeapable *elem = base + m_vector[i];
-			CTR_UHeapable *p_elem = base + m_vector[Parent(i)];
-
-			assert(p_elem->HeapKey() >= elem->HeapKey());
-			assert(elem->HeapPos() == i);
-		}
-
-	};
-			
-
-	~CTR_UHeap(
-	    ) {
-	};	
-
-
-private:
-
-	CTR_UHeap(
-	    ) {
-	};
-
-
-	std::vector<int> m_vector;
-		
-private:
-	void
-	Swap(
-	    HeapType *base,
-	    int i,
-	    int j
-	    ) {
-		std::swap(m_vector[i], m_vector[j]);
-		
-		CTR_UHeapable *heap_i = base + m_vector[i];
-		CTR_UHeapable *heap_j = base + m_vector[j];
-		
-		// Exchange heap positions
-		heap_i->HeapPos() = i;
-		heap_j->HeapPos() = j;
-	}
-
-	int
-	Parent(
-	    unsigned int i
-	    ) {
-		return (i - 1) >> 1;
-	}
-	int
-	Left(
-	    int i
-	    ) {
-		return (i << 1) + 1;
-	}
-
-	int
-	Right(
-	    int i
-	    ) {
-		return (i << 1) + 2;
-	}
-
-	float
-	HeapVal(
-	    HeapType *base,
-	    int i
-	    ) {
-		return base[m_vector[i]].HeapKey();
-	}
-
-	void
-	DownHeap(
-	    HeapType *base,
-	    int i
-	    ) {
-		int heap_size = m_vector.size();
-
-		int l = Left(i);
-		int r = Right(i);
-
-		int largest;
-		if (l < heap_size && HeapVal(base, l) > HeapVal(base, i)) {
-			largest = l;
-		}
-		else {
-			largest = i;
-		}
-
-		if (r < heap_size && HeapVal(base, r) > HeapVal(base, largest)) {
-			largest = r;
-		}	
-
-		if (largest != i) {
-			// exchange i and largest
-			Swap(base, i, largest);
-			DownHeap(base, largest);
-		}
-	}
-
-	void
-	UpHeap(
-	    HeapType *base,
-	    int i
-	    ) {
-
-		// swap parents untill it's found a place in the heap < it's parent or
-		// top of heap
-
-		while (i > 0) {
-			int p = Parent(i);
-			if (HeapVal(base, i) < HeapVal(base, p)) {
-				break;
-			}
-			Swap(base, p, i);
-			i = p;
-		}
-	}		
-};
-
-#endif
-
diff --git a/intern/container/intern/CTR_List.cpp b/intern/container/intern/CTR_List.cpp
deleted file mode 100644
index c72d3cc..0000000
--- a/intern/container/intern/CTR_List.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/intern/CTR_List.cpp
- *  \ingroup ctr
- */
-
-
-#include "CTR_List.h"
-
-
-CTR_Link::CTR_Link() :
-	m_next(0), 
-	m_prev(0) 
-{
-}
-
-CTR_Link::CTR_Link(CTR_Link *next, CTR_Link *prev) :
-	m_next(next), 
-	m_prev(prev) 
-{
-}
-
-CTR_Link *
-CTR_Link::getNext() const
-{
-	return m_next; 
-}
-
-CTR_Link *
-CTR_Link::getPrev() const
-{
-	return m_prev; 
-}  
-
-bool
-CTR_Link::isHead() const
-{
-	return m_prev == 0; 
-}
-
-bool
-CTR_Link::isTail() const
-{
-	return m_next == 0; 
-}
-
-void
-CTR_Link::insertBefore(CTR_Link *link)
-{
-	m_next = link;
-	m_prev = link->m_prev;
-	m_next->m_prev = this;
-	m_prev->m_next = this;
-} 
-
-void
-CTR_Link::insertAfter(CTR_Link *link)
-{
-	m_next = link->m_next;
-	m_prev = link;
-	m_next->m_prev = this;
-	m_prev->m_next = this;
-} 
-
-void
-CTR_Link::remove()
-{
-	m_next->m_prev = m_prev;
-	m_prev->m_next = m_next;
-}
-
-
-CTR_List::CTR_List() :
-	m_head(&m_tail, 0), 
-	m_tail(0, &m_head) 
-{
-}
-
-CTR_Link *
-CTR_List:: getHead() const
-{
-	return m_head.getNext(); 
-}
-
-CTR_Link *
-CTR_List::getTail() const
-{
-	return m_tail.getPrev();
-} 
-
-void
-CTR_List::addHead(CTR_Link *link)
-{
-	link->insertAfter(&m_head); 
-}
-
-void
-CTR_List::addTail(CTR_Link *link)
-{
-	link->insertBefore(&m_tail); 
-}
-
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 38daf79..12829f1 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -21,8 +21,11 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
 endif()
 
 # for OSL
-set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
-# set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+if(WIN32 AND MSVC)
+	set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
+	set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+endif()
 
 # Definitions and Includes
 
@@ -41,10 +44,7 @@ endif()
 
 if(WITH_CYCLES_OSL)
 	add_definitions(-DWITH_OSL)
-endif()
-
-if(WITH_CYCLES_PARTIO)
-	add_definitions(-DWITH_PARTIO)
+	include_directories(${OSL_INCLUDES})
 endif()
 
 if(WITH_CYCLES_CUDA_BINARIES)
@@ -68,7 +68,10 @@ if(WITH_CYCLES_BLENDER)
 	add_subdirectory(blender)
 endif()
 
-add_subdirectory(app)
+if(WITH_CYCLES_TEST)
+	add_subdirectory(app)
+endif()
+
 add_subdirectory(bvh)
 add_subdirectory(device)
 add_subdirectory(doc)
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index a7b8637..a0e2650 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -23,16 +23,21 @@ defs.append('WITH_OPENCL')
 defs.append('WITH_MULTI')
 defs.append('WITH_CUDA')
 
+if env['WITH_BF_CYCLES_OSL']:
+    defs.append('WITH_OSL')
+    incs.append(cycles['BF_OSL_INC'])
+
 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
     defs.append('WITH_CUDA_BINARIES')
 
 incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
 incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())
 incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
-incs.extend('#extern/glew/include'.split())
+incs.extend('#extern/glew/include #intern/mikktspace'.split())
 incs.append(cycles['BF_OIIO_INC'])
 incs.append(cycles['BF_BOOST_INC'])
-incs.append(cycles['BF_PYTHON_INC'])
+incs.append(cycles['BF_OPENEXR_INC'].split())
+incs.extend(cycles['BF_PYTHON_INC'].split())
 
 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
@@ -44,7 +49,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
 
 # optimized kernel
 if env['WITH_BF_RAYOPTIMIZATION']:
-    optim_cxxflags = []
+    optim_cxxflags = Split(env['CXXFLAGS'])
 
     if env['OURPLATFORM'] == 'win32-vc':
         optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
@@ -62,6 +67,12 @@ if env['WITH_BF_RAYOPTIMIZATION']:
 
 cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], cxx_compileflags=cxxflags)
 
+if env['WITH_BF_CYCLES_OSL']:
+    oso_files = SConscript(['kernel/shaders/SConscript'])
+    cycles.Depends("kernel/osl/osl_shader.o", oso_files)
+
+    SConscript(['kernel/osl/SConscript'])
+
 # cuda kernel binaries
 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
     kernel_binaries = SConscript(['kernel/SConscript'])
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 83b3f73..3fb8aaf 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -35,10 +35,6 @@ if(WITH_CYCLES_OSL)
 	list(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES})
 endif()
 
-if(WITH_CYCLES_PARTIO)
-	list(APPEND LIBRARIES ${PARTIO_LIBRARIES})
-endif()
-
 include_directories(${INC})
 include_directories(SYSTEM ${INC_SYS})
 
diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp
index e921cc4..625e8cc 100644
--- a/intern/cycles/app/cycles_test.cpp
+++ b/intern/cycles/app/cycles_test.cpp
@@ -326,7 +326,7 @@ using namespace ccl;
 
 int main(int argc, const char **argv)
 {
-	path_init("../build/bin/2.59/scripts/addons/cycles/");
+	path_init();
 
 	options_parse(argc, argv);
 
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 87a238e..5de9d71 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -591,6 +591,7 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
 					if(string_iequals(in->name, attr.name())) {
 						switch(in->type) {
 							case SHADER_SOCKET_FLOAT:
+							case SHADER_SOCKET_INT:
 								xml_read_float(&in->value.x, node, attr.name());
 								break;
 							case SHADER_SOCKET_COLOR:
diff --git a/intern/cycles/blender/CCL_api.h b/intern/cycles/blender/CCL_api.h
index 469d63d..b8a30b7 100644
--- a/intern/cycles/blender/CCL_api.h
+++ b/intern/cycles/blender/CCL_api.h
@@ -23,12 +23,12 @@
 extern "C" {
 #endif
 
-/* returns a list of devices for selection, array is name NULL pointer
+/* returns a list of devices for selection, array is empty identifier
  * terminated and must not be freed */
 
 typedef struct CCLDeviceInfo {
-	const char *identifier;
-	const char *name;
+	char identifier[128];
+	char name[512];
 	int value;
 } CCLDeviceInfo;
 
diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt
index a8c7eef..292c37d 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -7,6 +7,7 @@ set(INC
 	../util
 	../subd
 	../../guardedalloc
+	../../mikktspace
 	../../../source/blender/makesdna
 	../../../source/blender/makesrna
 	../../../source/blender/blenloader
@@ -38,6 +39,7 @@ set(ADDON_FILES
 	addon/__init__.py
 	addon/engine.py 
 	addon/enums.py
+	addon/osl.py
 	addon/presets.py
 	addon/properties.py
 	addon/ui.py
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py
index 6292c09..0fad2ac 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -48,7 +48,11 @@ class CyclesRender(bpy.types.RenderEngine):
 
     # final render
     def update(self, data, scene):
-        engine.create(self, data, scene)
+        if not self.session:
+            engine.create(self, data, scene)
+        else:
+            engine.reset(self, data, scene)
+
         engine.update(self, data, scene)
 
     def render(self, scene):
@@ -71,6 +75,13 @@ class CyclesRender(bpy.types.RenderEngine):
     def view_draw(self, context):
         engine.draw(self, context.region, context.space_data, context.region_data)
 
+    def update_script_node(self, node):
+        if engine.with_osl():
+            from . import osl
+            osl.update_script_node(node, self.report)
+        else:
+            self.report({'ERROR'}, "OSL support disabled in this build.")
+
 
 def register():
     properties.register()
@@ -84,3 +95,4 @@ def unregister():
     properties.unregister()
     presets.unregister()
     bpy.utils.unregister_module(__name__)
+
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index 05b1f88..ca5cbee 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -61,6 +61,13 @@ def render(engine):
         _cycles.render(engine.session)
 
 
+def reset(engine, data, scene):
+    import _cycles
+    data = data.as_pointer()
+    scene = scene.as_pointer()
+    _cycles.reset(engine.session, data, scene)
+
+
 def update(engine, data, scene):
     import _cycles
     _cycles.sync(engine.session)
@@ -83,3 +90,4 @@ def available_devices():
 def with_osl():
     import _cycles
     return _cycles.with_osl
+
diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py
index 6cc3010..82b4897 100644
--- a/intern/cycles/blender/addon/enums.py
+++ b/intern/cycles/blender/addon/enums.py
@@ -58,5 +58,6 @@ aperture_types = (
 panorama_types = (
     ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
-    ('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration"),
+    ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
+                          "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
     )
diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py
new file mode 100644
index 0000000..79ce3df
--- /dev/null
+++ b/intern/cycles/blender/addon/osl.py
@@ -0,0 +1,128 @@
+#
+# Copyright 2011, Blender Foundation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+# <pep8 compliant>
+
+import bpy, _cycles, os, tempfile
+
+# compile .osl file with given filepath to temporary .oso file
+def osl_compile(input_path, report):
+    output_file = tempfile.NamedTemporaryFile(mode='w', suffix=".oso", delete=False)
+    output_path = output_file.name
+    output_file.close()
+
+    ok = _cycles.osl_compile(input_path, output_path)
+
+    if ok:
+        report({'INFO'}, "OSL shader compilation succeeded")
+
+    return ok, output_path
+
+# compile and update shader script node
+def update_script_node(node, report):
+    import os, shutil
+
+    if node.mode == 'EXTERNAL':
+        # compile external script file
+        script_path = bpy.path.abspath(node.filepath, library=node.id_data.library)
+        script_path_noext, script_ext = os.path.splitext(script_path)
+
+        if script_ext == ".oso":
+            # it's a .oso file, no need to compile
+            ok, oso_path = True, script_path
+            oso_file_remove = False
+        elif script_ext == ".osl":
+            # compile .osl file
+            ok, oso_path = osl_compile(script_path, report)
+            oso_file_remove = True
+
+            if ok:
+                # copy .oso from temporary path to .osl directory
+                dst_path = script_path_noext + ".oso"
+                try:
+                    shutil.copy2(oso_path, dst_path)
+                except:
+                    report({'ERROR'}, "Failed to write .oso file next to external .osl file at " + dst_path)
+        elif os.path.dirname(node.filepath) == "":
+            # module in search path
+            oso_path = node.filepath
+            oso_file_remove = False
+            ok = True
+        else:
+            # unknown
+            report({'ERROR'}, "External shader script must have .osl or .oso extension, or be a module name")
+            ok = False
+
+        if ok:
+            node.bytecode = ""
+            node.bytecode_hash = ""
+
+    elif node.mode == 'INTERNAL' and node.script:
+        # internal script, we will store bytecode in the node
+        script = node.script
+        osl_path = bpy.path.abspath(script.filepath, library=script.library)
+
+        if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path):
+            # write text datablock contents to temporary file
+            osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False)
+            osl_file.write(script.as_string())
+            osl_file.close()
+
+            ok, oso_path = osl_compile(osl_file.name, report)
+            oso_file_remove = False
+            os.remove(osl_file.name)
+        else:
+            # compile text datablock from disk directly
+            ok, oso_path = osl_compile(osl_path, report)
+            oso_file_remove = False
+
+        if ok:
+            # read bytecode
+            try:
+                oso = open(oso_path, 'r')
+                node.bytecode = oso.read()
+                oso.close()
+            except:
+                import traceback
+                traceback.print_exc()
+
+                report({'ERROR'}, "Can't read OSO bytecode to store in node at %r" % oso_path)
+                ok = False
+    
+    else:
+        report({'WARNING'}, "No text or file specified in node, nothing to compile")
+        return
+
+    if ok:
+        # now update node with new sockets
+        ok = _cycles.osl_update_node(node.id_data.as_pointer(), node.as_pointer(), oso_path)
+
+        if not ok:
+            report({'ERROR'}, "OSL query failed to open " + oso_path)
+    else:
+        report({'ERROR'}, "OSL script compilation failed, see console for errors")
+
+    # remove temporary oso file
+    if oso_file_remove:
+        try:
+            os.remove(oso_path)
+        except:
+            pass
+
+    return ok
+
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 0fadfa0..0b8ca6e 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -136,7 +136,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 )
         cls.blur_glossy = FloatProperty(
                 name="Filter Glossy",
-                description="Adaptively blur glossy shaders after blurry bounces, to reduce noise at the cost of accuracy",
+                description="Adaptively blur glossy shaders after blurry bounces, "
+                            "to reduce noise at the cost of accuracy",
                 min=0.0, max=10.0,
                 default=0.0,
                 )
@@ -230,7 +231,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
         cls.sample_clamp = FloatProperty(
                 name="Clamp",
-                description="If non-zero, the maximum value for a sample, higher values will be scaled down to avoid too much noise and slow convergence at the cost of accuracy",
+                description="If non-zero, the maximum value for a sample, "
+                            "higher values will be scaled down to avoid too "
+                            "much noise and slow convergence at the cost of accuracy",
                 min=0.0, max=1e8,
                 default=0.0,
                 )
@@ -244,7 +247,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
         cls.preview_start_resolution = IntProperty(
                 name="Start Resolution",
-                description="Resolution to start rendering preview at, progressively increasing it to the full viewport size",
+                description="Resolution to start rendering preview at, "
+                            "progressively increasing it to the full viewport size",
                 min=8, max=16384,
                 default=64,
                 )
@@ -284,6 +288,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 description="Cache last built BVH to disk for faster re-render if no geometry changed",
                 default=False,
                 )
+        cls.use_progressive_refine = BoolProperty(
+                name="Progressive Refine",
+                description="Instead of rendering each tile until it is finished, "
+                            "refine the whole image progressively "
+                            "(this renders somewhat slower, "
+                            "but time can be saved by manually stopping the render when the noise is low enough)",
+                default=False,
+                )
 
     @classmethod
     def unregister(cls):
@@ -369,12 +381,15 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
                 )
         cls.sample_as_light = BoolProperty(
                 name="Sample as Lamp",
-                description="Use direct light sampling for this material, disabling may reduce overall noise for large objects that emit little light compared to other light sources",
+                description="Use direct light sampling for this material, "
+                            "disabling may reduce overall noise for large "
+                            "objects that emit little light compared to other light sources",
                 default=True,
                 )
         cls.homogeneous_volume = BoolProperty(
                 name="Homogeneous Volume",
-                description="When using volume rendering, assume volume has the same density everywhere, for faster rendering",
+                description="When using volume rendering, assume volume has the same density everywhere, "
+                            "for faster rendering",
                 default=False,
                 )
 
@@ -418,12 +433,14 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
                 )
         cls.sample_as_light = BoolProperty(
                 name="Sample as Lamp",
-                description="Use direct light sampling for the environment, enabling for non-solid colors is recommended",
+                description="Use direct light sampling for the environment, "
+                            "enabling for non-solid colors is recommended",
                 default=False,
                 )
         cls.sample_map_resolution = IntProperty(
                 name="Map Resolution",
-                description="Importance map size is resolution x resolution; higher values potentially produce less noise, at the cost of memory and speed",
+                description="Importance map size is resolution x resolution; "
+                            "higher values potentially produce less noise, at the cost of memory and speed",
                 min=4, max=8096,
                 default=256,
                 )
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 4f4b037..ba93146 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -134,10 +134,6 @@ class CyclesRender_PT_motion_blur(CyclesButtonsPanel, Panel):
     bl_label = "Motion Blur"
     bl_options = {'DEFAULT_CLOSED'}
 
-    @classmethod
-    def poll(cls, context):
-        return False
-
     def draw_header(self, context):
         rd = context.scene.render
 
@@ -197,10 +193,12 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
         sub.prop(rd, "threads")
 
         sub = col.column(align=True)
-        sub.label(text="Tiles:")
+        sub.label(text="Tile Size:")
 
-        sub.prop(rd, "parts_x", text="X")
-        sub.prop(rd, "parts_y", text="Y")
+        sub.prop(rd, "tile_x", text="X")
+        sub.prop(rd, "tile_y", text="Y")
+
+        sub.prop(cscene, "use_progressive_refine")
 
         subsub = sub.column()
         subsub.enabled = not rd.use_border
@@ -218,6 +216,10 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
         sub.label(text="Viewport:")
         sub.prop(cscene, "preview_start_resolution")
 
+        sub = col.column(align=True)
+        sub.label(text="Final Render:")
+        sub.prop(rd, "use_persistent_data", text="Persistent Images")
+
 
 class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
     bl_label = "Layers"
@@ -955,7 +957,7 @@ def draw_device(self, context):
         elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
             layout.prop(cscene, "device")
 
-        if engine.with_osl() and (cscene.device == 'CPU' or device_type == 'None'):
+        if engine.with_osl() and (cscene.device == 'CPU' or device_type == 'NONE'):
             layout.prop(cscene, "shading_system")
 
 
@@ -990,6 +992,7 @@ def get_panels():
         bpy.types.DATA_PT_context_mesh,
         bpy.types.DATA_PT_context_camera,
         bpy.types.DATA_PT_context_lamp,
+        bpy.types.DATA_PT_context_speaker,
         bpy.types.DATA_PT_texture_space,
         bpy.types.DATA_PT_curve_texture_space,
         bpy.types.DATA_PT_mball_texture_space,
@@ -1000,10 +1003,14 @@ def get_panels():
         bpy.types.DATA_PT_camera,
         bpy.types.DATA_PT_camera_display,
         bpy.types.DATA_PT_lens,
+        bpy.types.DATA_PT_speaker,
+        bpy.types.DATA_PT_distance,
+        bpy.types.DATA_PT_cone,
         bpy.types.DATA_PT_customdata,
         bpy.types.DATA_PT_custom_props_mesh,
         bpy.types.DATA_PT_custom_props_camera,
         bpy.types.DATA_PT_custom_props_lamp,
+        bpy.types.DATA_PT_custom_props_speaker,
         bpy.types.TEXTURE_PT_clouds,
         bpy.types.TEXTURE_PT_wood,
         bpy.types.TEXTURE_PT_marble,
@@ -1019,6 +1026,8 @@ def get_panels():
         bpy.types.TEXTURE_PT_voxeldata,
         bpy.types.TEXTURE_PT_pointdensity,
         bpy.types.TEXTURE_PT_pointdensity_turbulence,
+        bpy.types.TEXTURE_PT_mapping,
+        bpy.types.TEXTURE_PT_influence,
         bpy.types.PARTICLE_PT_context_particles,
         bpy.types.PARTICLE_PT_emission,
         bpy.types.PARTICLE_PT_hair_dynamics,
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index e166773..0cbd2a0 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -56,15 +56,16 @@ struct BlenderCamera {
 	float sensor_width;
 	float sensor_height;
 
-	float border_left;
-	float border_right;
-	float border_bottom;
-	float border_top;
+	int full_width;
+	int full_height;
+
+	BoundBox2D border;
+	BoundBox2D pano_viewplane;
 
 	Transform matrix;
 };
 
-static void blender_camera_init(BlenderCamera *bcam)
+static void blender_camera_init(BlenderCamera *bcam, BL::Scene b_scene)
 {
 	memset(bcam, 0, sizeof(BlenderCamera));
 
@@ -75,8 +76,16 @@ static void blender_camera_init(BlenderCamera *bcam)
 	bcam->sensor_height = 18.0f;
 	bcam->sensor_fit = BlenderCamera::AUTO;
 	bcam->shuttertime = 1.0f;
-	bcam->border_right = 1.0f;
-	bcam->border_top = 1.0f;
+	bcam->border.right = 1.0f;
+	bcam->border.top = 1.0f;
+	bcam->pano_viewplane.right = 1.0f;
+	bcam->pano_viewplane.top = 1.0f;
+
+	/* render resolution */
+	BL::RenderSettings r = b_scene.render();
+
+	bcam->full_width = (int)(r.resolution_x()*r.resolution_percentage()/100);
+	bcam->full_height = (int)(r.resolution_y()*r.resolution_percentage()/100);
 }
 
 static float blender_camera_focal_distance(BL::Object b_ob, BL::Camera b_camera)
@@ -199,7 +208,7 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
 }
 
 static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
-	float *left, float *right, float *bottom, float *top, float *aspectratio, float *sensor_size)
+	BoundBox2D *viewplane, float *aspectratio, float *sensor_size)
 {
 	/* dimensions */
 	float xratio = width*bcam->pixelaspect.x;
@@ -207,10 +216,9 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
 
 	/* compute x/y aspect and ratio */
 	float xaspect, yaspect;
-
-	/* sensor fitting */
 	bool horizontal_fit;
 
+	/* sensor fitting */
 	if(bcam->sensor_fit == BlenderCamera::AUTO) {
 		horizontal_fit = (xratio > yratio);
 		*sensor_size = bcam->sensor_width;
@@ -244,32 +252,26 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
 
 	if(bcam->type == CAMERA_PANORAMA) {
 		/* set viewplane */
-		*left = 0.0f;
-		*right = 1.0f;
-		*bottom = 0.0f;
-		*top = 1.0f;
+		*viewplane = bcam->pano_viewplane;
 	}
 	else {
 		/* set viewplane */
-		*left = -xaspect;
-		*right = xaspect;
-		*bottom = -yaspect;
-		*top = yaspect;
+		viewplane->left = -xaspect;
+		viewplane->right = xaspect;
+		viewplane->bottom = -yaspect;
+		viewplane->top = yaspect;
 
 		/* zoom for 3d camera view */
-		*left *= bcam->zoom;
-		*right *= bcam->zoom;
-		*bottom *= bcam->zoom;
-		*top *= bcam->zoom;
+		*viewplane = (*viewplane) * bcam->zoom;
 
 		/* modify viewplane with camera shift and 3d camera view offset */
 		float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
 		float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
 
-		*left += dx;
-		*right += dx;
-		*bottom += dy;
-		*top += dy;
+		viewplane->left += dx;
+		viewplane->right += dx;
+		viewplane->bottom += dy;
+		viewplane->top += dy;
 	}
 }
 
@@ -281,11 +283,37 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 
 	/* viewplane */
 	blender_camera_viewplane(bcam, width, height,
-		&cam->left, &cam->right, &cam->bottom, &cam->top, &aspectratio, &sensor_size);
+		&cam->viewplane, &aspectratio, &sensor_size);
+
+	/* panorama sensor */
+	if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
+		float fit_xratio = bcam->full_width*bcam->pixelaspect.x;
+		float fit_yratio = bcam->full_height*bcam->pixelaspect.y;
+		bool horizontal_fit;
+		float sensor_size;
+
+		if(bcam->sensor_fit == BlenderCamera::AUTO) {
+			horizontal_fit = (fit_xratio > fit_yratio);
+			sensor_size = bcam->sensor_width;
+		}
+		else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
+			horizontal_fit = true;
+			sensor_size = bcam->sensor_width;
+		}
+		else { /* vertical */
+			horizontal_fit = false;
+			sensor_size = bcam->sensor_height;
+		}
 
-	/* sensor */
-	cam->sensorwidth = bcam->sensor_width;
-	cam->sensorheight = bcam->sensor_height;
+		if(horizontal_fit) {
+			cam->sensorwidth = sensor_size;
+			cam->sensorheight = sensor_size * fit_yratio / fit_xratio;
+		}
+		else {
+			cam->sensorwidth = sensor_size * fit_xratio / fit_yratio;
+			cam->sensorheight = sensor_size;
+		}
+	}
 
 	/* clipping distances */
 	cam->nearclip = bcam->nearclip;
@@ -314,10 +342,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 	cam->shuttertime = bcam->shuttertime;
 
 	/* border */
-	cam->border_left = bcam->border_left;
-	cam->border_right = bcam->border_right;
-	cam->border_bottom = bcam->border_bottom;
-	cam->border_top = bcam->border_top;
+	cam->border = bcam->border;
 
 	/* set update flag */
 	if(cam->modified(prevcam))
@@ -329,7 +354,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
 {
 	BlenderCamera bcam;
-	blender_camera_init(&bcam);
+	blender_camera_init(&bcam, b_scene);
 
 	/* pixel aspect */
 	BL::RenderSettings r = b_scene.render();
@@ -340,10 +365,10 @@ void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
 
 	/* border */
 	if(r.use_border()) {
-		bcam.border_left = r.border_min_x();
-		bcam.border_right = r.border_max_x();
-		bcam.border_bottom = r.border_min_y();
-		bcam.border_top = r.border_max_y();
+		bcam.border.left = r.border_min_x();
+		bcam.border.right = r.border_max_x();
+		bcam.border.bottom = r.border_min_y();
+		bcam.border.top = r.border_max_y();
 	}
 
 	/* camera object */
@@ -381,6 +406,9 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, int motion)
 
 /* Sync 3D View Camera */
 
+static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::SpaceView3D b_v3d,
+	BL::RegionView3D b_rv3d, int width, int height, BoundBox2D *view_box, BoundBox2D *cam_box);
+
 static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height, bool skip_panorama = false)
 {
 	/* 3d view parameters */
@@ -396,14 +424,25 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
 		if(b_ob) {
 			blender_camera_from_object(bcam, b_ob, skip_panorama);
 
-			/* magic zoom formula */
-			bcam->zoom = (float)b_rv3d.view_camera_zoom();
-			bcam->zoom = (1.41421f + bcam->zoom/50.0f);
-			bcam->zoom *= bcam->zoom;
-			bcam->zoom = 2.0f/bcam->zoom;
-
-			/* offset */
-			bcam->offset = get_float2(b_rv3d.view_camera_offset());
+			if(!skip_panorama && bcam->type == CAMERA_PANORAMA) {
+				/* in panorama camera view, we map viewplane to camera border */
+				BoundBox2D view_box, cam_box;
+
+				blender_camera_view_subset(b_scene, b_ob, b_v3d, b_rv3d, width, height,
+					&view_box, &cam_box);
+
+				bcam->pano_viewplane = view_box.make_relative_to(cam_box);
+			}
+			else {
+				/* magic zoom formula */
+				bcam->zoom = (float)b_rv3d.view_camera_zoom();
+				bcam->zoom = (1.41421f + bcam->zoom/50.0f);
+				bcam->zoom *= bcam->zoom;
+				bcam->zoom = 2.0f/bcam->zoom;
+
+				/* offset */
+				bcam->offset = get_float2(b_rv3d.view_camera_offset());
+			}
 		}
 	}
 	else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) {
@@ -411,8 +450,14 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
 		bcam->farclip *= 0.5f;
 		bcam->nearclip = -bcam->farclip;
 
+		float sensor_size;
+		if(bcam->sensor_fit == BlenderCamera::VERTICAL)
+			sensor_size = bcam->sensor_height;
+		else
+			sensor_size = bcam->sensor_width;
+
 		bcam->type = CAMERA_ORTHOGRAPHIC;
-		bcam->ortho_scale = b_rv3d.view_distance();
+		bcam->ortho_scale = b_rv3d.view_distance() * sensor_size / b_v3d.lens();
 	}
 
 	bcam->zoom *= 2.0f;
@@ -421,102 +466,110 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
 	bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
 }
 
-static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d,
-	BL::RegionView3D b_rv3d, int width, int height)
+static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::SpaceView3D b_v3d,
+	BL::RegionView3D b_rv3d, int width, int height, BoundBox2D *view_box, BoundBox2D *cam_box)
 {
-	BL::RenderSettings r = b_scene.render();
-
-	if(!r.use_border())
-		return;
-
-	/* camera view? */
-	if(!(b_rv3d && b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA))
-		return;
-
-	BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
-
-	if(!b_ob)
-		return;
-
-	bcam->border_left = r.border_min_x();
-	bcam->border_right = r.border_max_x();
-	bcam->border_bottom = r.border_min_y();
-	bcam->border_top = r.border_max_y();
-
-	float cam_left, cam_right, cam_bottom, cam_top;
-	float view_left, view_right, view_bottom, view_top;
+//	BL::RenderSettings r = b_scene.render();  /* UNUSED */
+	BoundBox2D cam, view;
 	float view_aspect, cam_aspect, sensor_size;
 
 	/* get viewport viewplane */
 	BlenderCamera view_bcam;
-	blender_camera_init(&view_bcam);
+	blender_camera_init(&view_bcam, b_scene);
 	blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height, true);
 
 	blender_camera_viewplane(&view_bcam, width, height,
-		&view_left, &view_right, &view_bottom, &view_top, &view_aspect, &sensor_size);
-
-	view_left /= view_aspect;
-	view_right /= view_aspect;
-	view_bottom /= view_aspect;
-	view_top /= view_aspect;
+		&view, &view_aspect, &sensor_size);
 
 	/* get camera viewplane */
 	BlenderCamera cam_bcam;
-	blender_camera_init(&cam_bcam);
+	blender_camera_init(&cam_bcam, b_scene);
 	blender_camera_from_object(&cam_bcam, b_ob, true);
 
-	width = (int)(r.resolution_x()*r.resolution_percentage()/100);
-	height = (int)(r.resolution_y()*r.resolution_percentage()/100);
+	blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
+		&cam, &cam_aspect, &sensor_size);
+	
+	/* return */
+	*view_box = view * (1.0f/view_aspect);
+	*cam_box = cam * (1.0f/cam_aspect);
+}
+
+static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d,
+	BL::RegionView3D b_rv3d, int width, int height)
+{
+	BL::RenderSettings r = b_scene.render();
+	bool is_camera_view;
+
+	/* camera view? */
+	is_camera_view = b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA;
+
+	if(!is_camera_view) {
+		/* for non-camera view check whether render border is enabled for viewport
+		 * and if so use border from 3d viewport
+		 * assume viewport has got correctly clamped border already
+		 */
+		if(b_v3d.use_render_border()) {
+			bcam->border.left = b_v3d.render_border_min_x();
+			bcam->border.right = b_v3d.render_border_max_x();
+			bcam->border.bottom = b_v3d.render_border_min_y();
+			bcam->border.top = b_v3d.render_border_max_y();
+
+			return;
+		}
+	}
+	else if(!r.use_border())
+		return;
 
-	blender_camera_viewplane(&cam_bcam, width, height,
-		&cam_left, &cam_right, &cam_bottom, &cam_top, &cam_aspect, &sensor_size);
+	BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
 
-	cam_left /= cam_aspect;
-	cam_right /= cam_aspect;
-	cam_bottom /= cam_aspect;
-	cam_top /= cam_aspect;
+	if(!b_ob)
+		return;
+
+	bcam->border.left = r.border_min_x();
+	bcam->border.right = r.border_max_x();
+	bcam->border.bottom = r.border_min_y();
+	bcam->border.top = r.border_max_y();
+
+	/* determine camera viewport subset */
+	BoundBox2D view_box, cam_box;
+
+	blender_camera_view_subset(b_scene, b_ob, b_v3d, b_rv3d, width, height,
+		&view_box, &cam_box);
 
 	/* determine viewport subset matching camera border */
-	float tmp_left = ((cam_left - view_left) / (view_right - view_left));
-	float tmp_right = ((cam_right - view_left) / (view_right - view_left));
-	float tmp_bottom = ((cam_bottom - view_bottom) / (view_top - view_bottom));
-	float tmp_top = ((cam_top - view_bottom) / (view_top - view_bottom));
-
-	bcam->border_left = tmp_left + bcam->border_left*(tmp_right - tmp_left);
-	bcam->border_right = tmp_left + bcam->border_right*(tmp_right - tmp_left);
-	bcam->border_bottom = tmp_bottom + bcam->border_bottom*(tmp_top - tmp_bottom);
-	bcam->border_top = tmp_bottom + bcam->border_top*(tmp_top - tmp_bottom);
-
-	/* clamp */
-	bcam->border_left = clamp(bcam->border_left, 0.0f, 1.0f);
-	bcam->border_right = clamp(bcam->border_right, 0.0f, 1.0f);
-	bcam->border_bottom = clamp(bcam->border_bottom, 0.0f, 1.0f);
-	bcam->border_top = clamp(bcam->border_top, 0.0f, 1.0f);
+	cam_box = cam_box.make_relative_to(view_box);
+	bcam->border = cam_box.subset(bcam->border).clamp();
 }
 
 void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
 {
 	BlenderCamera bcam;
-	blender_camera_init(&bcam);
+	blender_camera_init(&bcam, b_scene);
 	blender_camera_from_view(&bcam, b_scene, b_v3d, b_rv3d, width, height);
 	blender_camera_border(&bcam, b_scene, b_v3d, b_rv3d, width, height);
 
 	blender_camera_sync(scene->camera, &bcam, width, height);
 }
 
-BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, Camera *cam, int width, int height)
+BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, Camera *cam, int width, int height)
 {
 	BufferParams params;
+	bool use_border = false;
 
 	params.full_width = width;
 	params.full_height = height;
 
-	if(b_scene.render().use_border()) {
+	if(b_v3d && b_rv3d && b_rv3d.view_perspective() != BL::RegionView3D::view_perspective_CAMERA)
+		use_border = b_v3d.use_render_border();
+	else
+		use_border = b_scene.render().use_border();
+
+	if(use_border) {
 		/* border render */
-		params.full_x = cam->border_left*width;
-		params.full_y = cam->border_bottom*height;
-		params.width = (int)(cam->border_right*width) - params.full_x;
-		params.height = (int)(cam->border_top*height) - params.full_y;
+		params.full_x = cam->border.left*width;
+		params.full_y = cam->border.bottom*height;
+		params.width = (int)(cam->border.right*width) - params.full_x;
+		params.height = (int)(cam->border.top*height) - params.full_y;
 
 		/* survive in case border goes out of view or becomes too small */
 		params.width = max(params.width, 1);
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 9764f24..c974875 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -16,6 +16,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+ 
 #include "mesh.h"
 #include "object.h"
 #include "scene.h"
@@ -29,9 +30,172 @@
 
 #include "util_foreach.h"
 
+#include "mikktspace.h"
+
 CCL_NAMESPACE_BEGIN
 
-/* Find/Add */
+/* Tangent Space */
+
+struct MikkUserData {
+	MikkUserData(const BL::Mesh mesh_, const BL::MeshTextureFaceLayer layer_, int num_faces_)
+	: mesh(mesh_), layer(layer_), num_faces(num_faces_)
+	{
+		tangent.resize(num_faces*4);
+	}
+
+	BL::Mesh mesh;
+	BL::MeshTextureFaceLayer layer;
+	int num_faces;
+	vector<float4> tangent;
+};
+
+static int mikk_get_num_faces(const SMikkTSpaceContext *context)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+	return userdata->num_faces;
+}
+
+static int mikk_get_num_verts_of_face(const SMikkTSpaceContext *context, const int face_num)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+	BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+	int4 vi = get_int4(f.vertices_raw());
+
+	return (vi[3] == 0)? 3: 4;
+}
+
+static void mikk_get_position(const SMikkTSpaceContext *context, float P[3], const int face_num, const int vert_num)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+	BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+	int4 vi = get_int4(f.vertices_raw());
+	BL::MeshVertex v = userdata->mesh.vertices[vi[vert_num]];
+	float3 vP = get_float3(v.co());
+
+	P[0] = vP.x;
+	P[1] = vP.y;
+	P[2] = vP.z;
+}
+
+static void mikk_get_texture_coordinate(const SMikkTSpaceContext *context, float uv[2], const int face_num, const int vert_num)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+	BL::MeshTextureFace tf = userdata->layer.data[face_num];
+	float3 tfuv;
+
+	if(vert_num == 0)
+		tfuv = get_float3(tf.uv1());
+	else if(vert_num == 1)
+		tfuv = get_float3(tf.uv2());
+	else if(vert_num == 2)
+		tfuv = get_float3(tf.uv3());
+	else
+		tfuv = get_float3(tf.uv4());
+	
+	uv[0] = tfuv.x;
+	uv[1] = tfuv.y;
+}
+
+static void mikk_get_normal(const SMikkTSpaceContext *context, float N[3], const int face_num, const int vert_num)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+	BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+	int4 vi = get_int4(f.vertices_raw());
+	BL::MeshVertex v = userdata->mesh.vertices[vi[vert_num]];
+	float3 vN = get_float3(v.normal());
+
+	N[0] = vN.x;
+	N[1] = vN.y;
+	N[2] = vN.z;
+}
+
+static void mikk_set_tangent_space(const SMikkTSpaceContext *context, const float T[], const float sign, const int face, const int vert)
+{
+	MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+
+	userdata->tangent[face*4 + vert] = make_float4(T[0], T[1], T[2], sign);
+}
+
+static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_layer, Mesh *mesh, vector<int>& nverts, bool need_sign, bool active_render)
+{
+	/* setup userdata */
+	MikkUserData userdata(b_mesh, b_layer, nverts.size());
+
+	/* setup interface */
+	SMikkTSpaceInterface sm_interface;
+	memset(&sm_interface, 0, sizeof(sm_interface));
+	sm_interface.m_getNumFaces = mikk_get_num_faces;
+	sm_interface.m_getNumVerticesOfFace = mikk_get_num_verts_of_face;
+	sm_interface.m_getPosition = mikk_get_position;
+	sm_interface.m_getTexCoord = mikk_get_texture_coordinate;
+	sm_interface.m_getNormal = mikk_get_normal;
+	sm_interface.m_setTSpaceBasic = mikk_set_tangent_space;
+
+	/* setup context */
+	SMikkTSpaceContext context;
+	memset(&context, 0, sizeof(context));
+	context.m_pUserData = &userdata;
+	context.m_pInterface = &sm_interface;
+
+	/* compute tangents */
+	genTangSpaceDefault(&context);
+
+	/* create tangent attributes */
+	Attribute *attr;
+	ustring name = ustring((string(b_layer.name().c_str()) + ".tangent").c_str());
+
+	if(active_render)
+		attr = mesh->attributes.add(ATTR_STD_UV_TANGENT, name);
+	else
+		attr = mesh->attributes.add(name, TypeDesc::TypeVector, Attribute::CORNER);
+
+	float3 *tangent = attr->data_float3();
+
+	/* create bitangent sign attribute */
+	float *tangent_sign = NULL;
+
+	if(need_sign) {
+		Attribute *attr_sign;
+		ustring name_sign = ustring((string(b_layer.name().c_str()) + ".tangent_sign").c_str());
+
+		if(active_render)
+			attr_sign = mesh->attributes.add(ATTR_STD_UV_TANGENT_SIGN, name_sign);
+		else
+			attr_sign = mesh->attributes.add(name_sign, TypeDesc::TypeFloat, Attribute::CORNER);
+
+		tangent_sign = attr_sign->data_float();
+	}
+
+	for(int i = 0; i < nverts.size(); i++) {
+		tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
+		tangent[1] = float4_to_float3(userdata.tangent[i*4 + 1]);
+		tangent[2] = float4_to_float3(userdata.tangent[i*4 + 2]);
+		tangent += 3;
+
+		if(tangent_sign) {
+			tangent_sign[0] = userdata.tangent[i*4 + 0].w;
+			tangent_sign[1] = userdata.tangent[i*4 + 1].w;
+			tangent_sign[2] = userdata.tangent[i*4 + 2].w;
+			tangent_sign += 3;
+		}
+
+		if(nverts[i] == 4) {
+			tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
+			tangent[1] = float4_to_float3(userdata.tangent[i*4 + 2]);
+			tangent[2] = float4_to_float3(userdata.tangent[i*4 + 3]);
+			tangent += 3;
+
+			if(tangent_sign) {
+				tangent_sign[0] = userdata.tangent[i*4 + 0].w;
+				tangent_sign[1] = userdata.tangent[i*4 + 2].w;
+				tangent_sign[2] = userdata.tangent[i*4 + 3].w;
+				tangent_sign += 3;
+			}
+		}
+	}
+}
+
+/* Create Mesh */
 
 static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<uint>& used_shaders)
 {
@@ -67,27 +231,6 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 		nverts.push_back(n);
 	}
 
-	/* create generated coordinates. todo: we should actually get the orco
-	 * coordinates from modifiers, for now we use texspace loc/size which
-	 * is available in the api. */
-	if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
-		Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
-		float3 loc = get_float3(b_mesh.texspace_location());
-		float3 size = get_float3(b_mesh.texspace_size());
-
-		if(size.x != 0.0f) size.x = 0.5f/size.x;
-		if(size.y != 0.0f) size.y = 0.5f/size.y;
-		if(size.z != 0.0f) size.z = 0.5f/size.z;
-
-		loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
-
-		float3 *fdata = attr->data_float3();
-		size_t i = 0;
-
-		for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v)
-			fdata[i++] = get_float3(v->co())*size - loc;
-	}
-
 	/* create vertex color attributes */
 	{
 		BL::Mesh::tessface_vertex_colors_iterator l;
@@ -125,38 +268,72 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 		BL::Mesh::tessface_uv_textures_iterator l;
 
 		for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l) {
-			AttributeStandard std = (l->active_render())? ATTR_STD_UV: ATTR_STD_NONE;
+			bool active_render = l->active_render();
+			AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
 			ustring name = ustring(l->name().c_str());
 
-			if(!(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)))
-				continue;
-
-			Attribute *attr;
-
-			if(l->active_render())
-				attr = mesh->attributes.add(std, name);
-			else
-				attr = mesh->attributes.add(name, TypeDesc::TypePoint, Attribute::CORNER);
+			/* UV map */
+			if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
+				Attribute *attr;
 
-			BL::MeshTextureFaceLayer::data_iterator t;
-			float3 *fdata = attr->data_float3();
-			size_t i = 0;
+				if(active_render)
+					attr = mesh->attributes.add(std, name);
+				else
+					attr = mesh->attributes.add(name, TypeDesc::TypePoint, Attribute::CORNER);
 
-			for(l->data.begin(t); t != l->data.end(); ++t, ++i) {
-				fdata[0] =  get_float3(t->uv1());
-				fdata[1] =  get_float3(t->uv2());
-				fdata[2] =  get_float3(t->uv3());
-				fdata += 3;
+				BL::MeshTextureFaceLayer::data_iterator t;
+				float3 *fdata = attr->data_float3();
+				size_t i = 0;
 
-				if(nverts[i] == 4) {
+				for(l->data.begin(t); t != l->data.end(); ++t, ++i) {
 					fdata[0] =  get_float3(t->uv1());
-					fdata[1] =  get_float3(t->uv3());
-					fdata[2] =  get_float3(t->uv4());
+					fdata[1] =  get_float3(t->uv2());
+					fdata[2] =  get_float3(t->uv3());
 					fdata += 3;
+
+					if(nverts[i] == 4) {
+						fdata[0] =  get_float3(t->uv1());
+						fdata[1] =  get_float3(t->uv3());
+						fdata[2] =  get_float3(t->uv4());
+						fdata += 3;
+					}
 				}
 			}
+
+			/* UV tangent */
+			std = (active_render)? ATTR_STD_UV_TANGENT: ATTR_STD_NONE;
+			name = ustring((string(l->name().c_str()) + ".tangent").c_str());
+
+			if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
+				std = (active_render)? ATTR_STD_UV_TANGENT_SIGN: ATTR_STD_NONE;
+				name = ustring((string(l->name().c_str()) + ".tangent_sign").c_str());
+				bool need_sign = (mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std));
+
+				mikk_compute_tangents(b_mesh, *l, mesh, nverts, need_sign, active_render);
+			}
 		}
 	}
+
+	/* create generated coordinates. todo: we should actually get the orco
+	 * coordinates from modifiers, for now we use texspace loc/size which
+	 * is available in the api. */
+	if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
+		Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
+		float3 loc = get_float3(b_mesh.texspace_location());
+		float3 size = get_float3(b_mesh.texspace_size());
+
+		if(size.x != 0.0f) size.x = 0.5f/size.x;
+		if(size.y != 0.0f) size.y = 0.5f/size.y;
+		if(size.z != 0.0f) size.z = 0.5f/size.z;
+
+		loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
+
+		float3 *generated = attr->data_float3();
+		size_t i = 0;
+
+		for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v)
+			generated[i++] = get_float3(v->co())*size - loc;
+	}
 }
 
 static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, const vector<uint>& used_shaders)
@@ -270,7 +447,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
 			create_mesh(scene, mesh, b_mesh, used_shaders);
 
 		/* free derived mesh */
-		object_remove_mesh(b_data, b_mesh);
+		b_data.meshes.remove(b_mesh);
 	}
 
 	/* displacement method */
@@ -328,7 +505,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
 			mesh->attributes.remove(std);
 
 		/* free derived mesh */
-		object_remove_mesh(b_data, b_mesh);
+		b_data.meshes.remove(b_mesh);
 	}
 }
 
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 2730102..38f27bc 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -17,12 +17,14 @@
  */
 
 #include "camera.h"
+#include "integrator.h"
 #include "graph.h"
 #include "light.h"
 #include "mesh.h"
 #include "object.h"
 #include "scene.h"
 #include "nodes.h"
+#include "particles.h"
 #include "shader.h"
 
 #include "blender_sync.h"
@@ -84,11 +86,11 @@ static uint object_ray_visibility(BL::Object b_ob)
 
 /* Light */
 
-void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm)
+void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm)
 {
 	/* test if we need to sync */
 	Light *light;
-	ObjectKey key(b_parent, b_index, b_ob);
+	ObjectKey key(b_parent, persistent_id, b_ob);
 
 	if(!light_map.sync(&light, b_ob, b_parent, key))
 		return;
@@ -194,23 +196,24 @@ void BlenderSync::sync_background_light()
 
 /* Object */
 
-void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, int motion, int particle_id)
+Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, int motion)
 {
 	BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
 	
 	/* light is handled separately */
 	if(object_is_light(b_ob)) {
 		if(!motion)
-			sync_light(b_parent, b_index, b_ob, tfm);
-		return;
+			sync_light(b_parent, persistent_id, b_ob, tfm);
+
+		return NULL;
 	}
 
 	/* only interested in object that we can create meshes from */
 	if(!object_is_mesh(b_ob))
-		return;
+		return NULL;
 
 	/* key to lookup object */
-	ObjectKey key(b_parent, b_index, b_ob);
+	ObjectKey key(b_parent, persistent_id, b_ob);
 	Object *object;
 
 	/* motion vector case */
@@ -227,10 +230,12 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
 				object->use_motion = true;
 			}
 
-			sync_mesh_motion(b_ob, object->mesh, motion);
+			/* mesh deformation blur not supported yet */
+			if(!scene->integrator->motion_blur)
+				sync_mesh_motion(b_ob, object->mesh, motion);
 		}
 
-		return;
+		return object;
 	}
 
 	/* test if we need to sync */
@@ -244,13 +249,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
 	/* mesh sync */
 	object->mesh = sync_mesh(b_ob, object_updated);
 
+	/* sspecial case not tracked by object update flags */
 	if(use_holdout != object->use_holdout) {
 		object->use_holdout = use_holdout;
 		scene->object_manager->tag_update(scene);
+		object_updated = true;
 	}
 
-	/* object sync */
-	/* transform comparison should not be needed, but duplis don't work perfect
+	/* object sync
+	 * transform comparison should not be needed, but duplis don't work perfect
 	 * in the depsgraph and may not signal changes, so this is a workaround */
 	if(object_updated || (object->mesh && object->mesh->need_update) || tfm != object->tfm) {
 		object->name = b_ob.name().c_str();
@@ -260,7 +267,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
 		object->motion.post = tfm;
 		object->use_motion = false;
 
-		object->random_id = hash_int_2d(hash_string(object->name.c_str()), b_index);
+		/* random number */
+		object->random_id = hash_string(object->name.c_str());
+
+		if(persistent_id) {
+			for(int i = 0; i < OBJECT_PERSISTENT_ID_SIZE; i++)
+				object->random_id = hash_int_2d(object->random_id, persistent_id[i]);
+		}
+		else
+			object->random_id = hash_int_2d(object->random_id, 0);
 
 		/* visibility flags for both parent */
 		object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
@@ -269,6 +284,10 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
 			object->random_id ^= hash_int(hash_string(b_parent.name().c_str()));
 		}
 
+		/* make holdout objects on excluded layer invisible for non-camera rays */
+		if(use_holdout && (layer_flag & render_layer.exclude_layer))
+			object->visibility &= ~(PATH_RAY_ALL - PATH_RAY_CAMERA);
+
 		/* camera flag is not actually used, instead is tested
 		 * against render layer flags */
 		if(object->visibility & PATH_RAY_CAMERA) {
@@ -285,10 +304,17 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
 			object->dupli_uv = make_float2(0.0f, 0.0f);
 		}
 
-		object->particle_id = particle_id;
-
 		object->tag_update(scene);
 	}
+
+	return object;
+}
+
+static bool object_dupli_hide_original(BL::Object::dupli_type_enum dupli_type)
+{
+	return (dupli_type == BL::Object::dupli_type_VERTS ||
+	        dupli_type == BL::Object::dupli_type_FACES ||
+	        dupli_type == BL::Object::dupli_type_FRAMES);
 }
 
 /* Object Loop */
@@ -304,12 +330,15 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
 		mesh_map.pre_sync();
 		object_map.pre_sync();
 		mesh_synced.clear();
+		particle_system_map.pre_sync();
 	}
 
 	/* object loop */
 	BL::Scene::objects_iterator b_ob;
 	BL::Scene b_sce = b_scene;
-	int particle_offset = 1;	/* first particle is dummy for regular, non-instanced objects */
+
+	/* global particle index counter */
+	int particle_id = 1;
 
 	bool cancel = false;
 
@@ -322,45 +351,81 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
 			if(!hide) {
 				progress.set_sync_status("Synchronizing object", (*b_ob).name());
 
-				int num_particles = object_count_particles(*b_ob);
-
 				if(b_ob->is_duplicator()) {
-					hide = true;	/* duplicators hidden by default */
+					/* duplicators hidden by default */
+					hide = true;
 
 					/* dupli objects */
-					object_create_duplilist(*b_ob, b_scene);
+					b_ob->dupli_list_create(b_scene, 2);
 
 					BL::Object::dupli_list_iterator b_dup;
-					int b_index = 0;
 
 					for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
 						Transform tfm = get_transform(b_dup->matrix());
 						BL::Object b_dup_ob = b_dup->object();
 						bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
+						bool emitter_hide = false;
+
+						if(b_dup_ob.is_duplicator()) {
+							/* duplicators hidden by default, except dupliframes which duplicate self */
+							if(b_dup_ob.dupli_type() != BL::Object::dupli_type_FRAMES)
+								emitter_hide = true;
+							
+							/* check if we should render or hide particle emitter */
+							BL::Object::particle_systems_iterator b_psys;
+							for(b_dup_ob.particle_systems.begin(b_psys); b_psys != b_dup_ob.particle_systems.end(); ++b_psys)
+								if(b_psys->settings().use_render_emitter())
+									emitter_hide = false;
+						}
+
+						/* hide original object for duplis */
+						BL::Object parent = b_dup_ob.parent();
+						if(parent && object_dupli_hide_original(parent.dupli_type()))
+							if(b_dup->type() == BL::DupliObject::type_GROUP)
+								dup_hide = true;
+
+						if(!(b_dup->hide() || dup_hide || emitter_hide)) {
+							/* the persistent_id allows us to match dupli objects
+							 * between frames and updates */
+							BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
+
+							/* sync object and mesh or light data */
+							Object *object = sync_object(*b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion);
+
+							/* sync possible particle data, note particle_id
+							 * starts counting at 1, first is dummy particle */
+							if(!motion && object && sync_dupli_particle(*b_ob, *b_dup, object)) {
+								if(particle_id != object->particle_id) {
+									object->particle_id = particle_id;
+									scene->object_manager->tag_update(scene);
+								}
+
+								particle_id++;
+							}
 
-						if(!(b_dup->hide() || dup_hide)) {
-							sync_object(*b_ob, b_index, *b_dup, tfm, ob_layer, motion, b_dup->particle_index() + particle_offset);
 						}
-						
-						++b_index;
 					}
 
-					object_free_duplilist(*b_ob);
+					b_ob->dupli_list_clear();
 				}
 
 				/* check if we should render or hide particle emitter */
 				BL::Object::particle_systems_iterator b_psys;
+
 				for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
 					if(b_psys->settings().use_render_emitter())
 						hide = false;
 
+				/* hide original object for duplis */
+				BL::Object parent = b_ob->parent();
+				if(parent && object_dupli_hide_original(parent.dupli_type()))
+					hide = true;
+
 				if(!hide) {
 					/* object itself */
 					Transform tfm = get_transform(b_ob->matrix_world());
-					sync_object(*b_ob, 0, PointerRNA_NULL, tfm, ob_layer, motion, 0);
+					sync_object(*b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion);
 				}
-
-				particle_offset += num_particles;
 			}
 
 			cancel = progress.get_cancel();
@@ -379,6 +444,8 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
 			scene->mesh_manager->tag_update(scene);
 		if(object_map.post_sync())
 			scene->object_manager->tag_update(scene);
+		if(particle_system_map.post_sync())
+			scene->particle_system_manager->tag_update(scene);
 		mesh_synced.clear();
 	}
 }
@@ -393,11 +460,13 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override)
 	if(b_override)
 		b_cam = b_override;
 
+	Camera prevcam = *(scene->camera);
+	
 	/* go back and forth one frame */
 	int frame = b_scene.frame_current();
 
 	for(int motion = -1; motion <= 1; motion += 2) {
-		scene_frame_set(b_scene, frame + motion);
+		b_scene.frame_set(frame + motion, 0.0f);
 
 		/* camera object */
 		if(b_cam)
@@ -407,7 +476,11 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override)
 		sync_objects(b_v3d, motion);
 	}
 
-	scene_frame_set(b_scene, frame);
+	b_scene.frame_set(frame, 0.0f);
+
+	/* tag camera for motion update */
+	if(scene->camera->motion_modified(prevcam))
+		scene->camera->tag_update();
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/blender_particles.cpp b/intern/cycles/blender/blender_particles.cpp
index f309960..769cd9f 100644
--- a/intern/cycles/blender/blender_particles.cpp
+++ b/intern/cycles/blender/blender_particles.cpp
@@ -17,6 +17,7 @@
  */
 
 #include "mesh.h"
+#include "object.h"
 #include "particles.h"
 
 #include "blender_sync.h"
@@ -28,191 +29,57 @@ CCL_NAMESPACE_BEGIN
 
 /* Utilities */
 
+bool BlenderSync::sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object)
+{
+	/* test if this dupli was generated from a particle sytem */
+	BL::ParticleSystem b_psys = b_dup.particle_system();
+	if(!b_psys)
+		return false;
 
-/* Particles Sync */
+	/* test if we need particle data */
+	if(!object->mesh->need_attribute(scene, ATTR_STD_PARTICLE))
+		return false;
 
-bool BlenderSync::psys_need_update(BL::ParticleSystem b_psys)
-{
-	/* Particle data is only needed for
-	 * a) Billboard render mode if object's own material uses particle info
-	 * b) object/group render mode if any dupli object's material uses particle info
-	 *
-	 * Note: Meshes have to be synced at this point!
-	 */
-	bool need_update = false;
-	
-	switch (b_psys.settings().render_type()) {
-		/* XXX not implemented yet! 
-		 * billboards/strands would become part of the mesh data (?),
-		 * so the mesh attributes would store whether particle info is required.
-		 */
-		#if 0
-		case BL::ParticleSettings::render_type_BILLBOARD:
-		case BL::ParticleSettings::render_type_PATH: {	/* for strand rendering */
-			BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob.data();
-			Mesh *mesh = mesh_map.find(key);
-			if (mesh) {
-				need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
-			}
-			break;
-		}
-		#endif
-		
-		case BL::ParticleSettings::render_type_OBJECT: {
-			BL::Object b_dupli_ob = b_psys.settings().dupli_object();
-			if (b_dupli_ob) {
-				BL::ID key = (BKE_object_is_modified(b_dupli_ob))? b_dupli_ob: b_dupli_ob.data();
-				Mesh *mesh = mesh_map.find(key);
-				if (mesh) {
-					need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
-				}
-			}
-			break;
-		}
-		
-		case BL::ParticleSettings::render_type_GROUP: {
-			BL::Group b_dupli_group = b_psys.settings().dupli_group();
-			if (b_dupli_group) {
-				BL::Group::objects_iterator b_gob;
-				for (b_dupli_group.objects.begin(b_gob); b_gob != b_dupli_group.objects.end(); ++b_gob) {
-					BL::ID key = (BKE_object_is_modified(*b_gob))? *b_gob: b_gob->data();
-					Mesh *mesh = mesh_map.find(key);
-					if (mesh) {
-						need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
-					}
-				}
-			}
-			break;
-		}
-		
-		default:
-			/* avoid compiler warning */
-			break;
-	}
-	
-	return need_update;
-}
+	/* don't handle child particles yet */
+	BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup.persistent_id();
 
-static bool use_particle_system(BL::ParticleSystem b_psys)
-{
-	/* only use duplicator particles? disabled particle info for
-	 * halo and billboard to reduce particle count.
-	 * Probably not necessary since particles don't contain a huge amount
-	 * of data compared to other textures.
-	 */
-	#if 0
-	int render_type = b_psys->settings().render_type();
-	return (render_type == BL::ParticleSettings::render_type_OBJECT
-	        || render_type == BL::ParticleSettings::render_type_GROUP);
-	#endif
-	
-	return true;
-}
+	if(persistent_id[0] >= b_psys.particles.length())
+		return false;
 
-static bool use_particle(BL::Particle b_pa)
-{
-	return b_pa.is_exist() && b_pa.is_visible() &&
-	        (b_pa.alive_state()==BL::Particle::alive_state_ALIVE || b_pa.alive_state()==BL::Particle::alive_state_DYING);
-}
+	/* find particle system */
+	ParticleSystemKey key(b_ob, persistent_id);
+	ParticleSystem *psys;
 
-static int psys_count_particles(BL::ParticleSystem b_psys)
-{
-	int tot = 0;
-	BL::ParticleSystem::particles_iterator b_pa;
-	for(b_psys.particles.begin(b_pa); b_pa != b_psys.particles.end(); ++b_pa) {
-		if(use_particle(*b_pa))
-			++tot;
-	}
-	return tot;
-}
+	bool first_use = !particle_system_map.is_used(key);
+	bool need_update = particle_system_map.sync(&psys, b_ob, b_dup.object(), key);
 
-int BlenderSync::object_count_particles(BL::Object b_ob)
-{
-	int tot = 0;
-	BL::Object::particle_systems_iterator b_psys;
-	for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
-		if (use_particle_system(*b_psys))
-			tot += psys_count_particles(*b_psys);
-	}
-	return tot;
-}
+	/* no update needed? */
+	if(!need_update && !object->mesh->need_update && !scene->object_manager->need_update)
+		return true;
 
-void BlenderSync::sync_particles(BL::Object b_ob, BL::ParticleSystem b_psys)
-{
-	/* depending on settings the psys may not even be rendered */
-	if (!use_particle_system(b_psys))
-		return;
-	
-	/* key to lookup particle system */
-	ParticleSystemKey key(b_ob, b_psys);
-	ParticleSystem *psys;
-	
-	/* test if we need to sync */
-	bool object_updated = false;
-	
-	if(particle_system_map.sync(&psys, b_ob, b_ob, key))
-		object_updated = true;
-	
-	bool need_update = psys_need_update(b_psys);
-	
-	if (object_updated || need_update) {
-		int tot = psys_count_particles(b_psys);
+	/* first time used in this sync loop? clear and tag update */
+	if(first_use) {
 		psys->particles.clear();
-		psys->particles.reserve(tot);
-		
-		int index = 0;
-		BL::ParticleSystem::particles_iterator b_pa;
-		for(b_psys.particles.begin(b_pa); b_pa != b_psys.particles.end(); ++b_pa) {
-			if(use_particle(*b_pa)) {
-				Particle pa;
-				
-				pa.index = index;
-				pa.age = b_scene.frame_current() - b_pa->birth_time();
-				pa.lifetime = b_pa->lifetime();
-				pa.location = get_float3(b_pa->location());
-				pa.rotation = get_float4(b_pa->rotation());
-				pa.size = b_pa->size();
-				pa.velocity = get_float3(b_pa->velocity());
-				pa.angular_velocity = get_float3(b_pa->angular_velocity());
-				
-				psys->particles.push_back(pa);
-			}
-			
-			++index;
-		}
-		
 		psys->tag_update(scene);
 	}
-}
 
-void BlenderSync::sync_particle_systems()
-{
-	/* layer data */
-	uint scene_layer = render_layer.scene_layer;
+	/* add particle */
+	BL::Particle b_pa = b_psys.particles[persistent_id[0]];
+	Particle pa;
 	
-	particle_system_map.pre_sync();
-
-	/* object loop */
-	BL::Scene::objects_iterator b_ob;
-	BL::Scene b_sce = b_scene;
-
-	for(; b_sce; b_sce = b_sce.background_set()) {
-		for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
-			bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
-			uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), render_layer.use_localview, object_is_light(*b_ob));
-			hide = hide || !(ob_layer & scene_layer);
-
-			if(!hide) {
-				BL::Object::particle_systems_iterator b_psys;
-				for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
-					sync_particles(*b_ob, *b_psys);
-			}
-		}
-	}
-
-	/* handle removed data and modified pointers */
-	if(particle_system_map.post_sync())
-		scene->particle_system_manager->tag_update(scene);
+	pa.index = persistent_id[0];
+	pa.age = b_scene.frame_current() - b_pa.birth_time();
+	pa.lifetime = b_pa.lifetime();
+	pa.location = get_float3(b_pa.location());
+	pa.rotation = get_float4(b_pa.rotation());
+	pa.size = b_pa.size();
+	pa.velocity = get_float3(b_pa.velocity());
+	pa.angular_velocity = get_float3(b_pa.angular_velocity());
+
+	psys->particles.push_back(pa);
+
+	/* return that this object has particle data */
+	return true;
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index d9220b7..d164920 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -24,9 +24,17 @@
 #include "blender_session.h"
 
 #include "util_foreach.h"
+#include "util_md5.h"
 #include "util_opengl.h"
 #include "util_path.h"
 
+#ifdef WITH_OSL
+#include "osl.h"
+
+#include <OSL/oslquery.h>
+#include <OSL/oslconfig.h>
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 static PyObject *init_func(PyObject *self, PyObject *args)
@@ -138,6 +146,32 @@ static PyObject *draw_func(PyObject *self, PyObject *args)
 	Py_RETURN_NONE;
 }
 
+static PyObject *reset_func(PyObject *self, PyObject *args)
+{
+	PyObject *pysession, *pydata, *pyscene;
+
+	if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pyscene))
+		return NULL;
+
+	BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+
+	PointerRNA dataptr;
+	RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr);
+	BL::BlendData b_data(dataptr);
+
+	PointerRNA sceneptr;
+	RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
+	BL::Scene b_scene(sceneptr);
+
+	Py_BEGIN_ALLOW_THREADS
+
+	session->reset_session(b_data, b_scene);
+
+	Py_END_ALLOW_THREADS
+
+	Py_RETURN_NONE;
+}
+
 static PyObject *sync_func(PyObject *self, PyObject *value)
 {
 	Py_BEGIN_ALLOW_THREADS
@@ -163,6 +197,182 @@ static PyObject *available_devices_func(PyObject *self, PyObject *args)
 	return ret;
 }
 
+#ifdef WITH_OSL
+static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
+{
+	PyObject *pynodegroup, *pynode;
+	const char *filepath = NULL;
+
+	if(!PyArg_ParseTuple(args, "OOs", &pynodegroup, &pynode, &filepath))
+		return NULL;
+
+	/* RNA */
+	PointerRNA nodeptr;
+	RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr);
+	BL::ShaderNodeScript b_node(nodeptr);
+
+	/* update bytecode hash */
+	string bytecode = b_node.bytecode();
+
+	if(!bytecode.empty()) {
+		MD5Hash md5;
+		md5.append((const uint8_t*)bytecode.c_str(), bytecode.size());
+		b_node.bytecode_hash(md5.get_hex().c_str());
+	}
+	else
+		b_node.bytecode_hash("");
+
+	/* query from file path */
+	OSL::OSLQuery query;
+
+	if(!OSLShaderManager::osl_query(query, filepath))
+		Py_RETURN_FALSE;
+
+	/* add new sockets from parameters */
+	set<void*> used_sockets;
+
+	for(int i = 0; i < query.nparams(); i++) {
+		const OSL::OSLQuery::Parameter *param = query.getparam(i);
+
+		/* skip unsupported types */
+		if(param->varlenarray || param->isstruct || param->type.arraylen > 1)
+			continue;
+
+		/* determine socket type */
+		BL::NodeSocket::type_enum socket_type;
+		float default_float4[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+		float default_float = 0.0f;
+		int default_int = 0;
+		std::string default_string = "";
+		
+		if(param->isclosure) {
+			socket_type = BL::NodeSocket::type_SHADER;
+		}
+		else if(param->type.vecsemantics == TypeDesc::COLOR) {
+			socket_type = BL::NodeSocket::type_RGBA;
+
+			if(param->validdefault) {
+				default_float4[0] = param->fdefault[0];
+				default_float4[1] = param->fdefault[1];
+				default_float4[2] = param->fdefault[2];
+			}
+		}
+		else if(param->type.vecsemantics == TypeDesc::POINT ||
+		        param->type.vecsemantics == TypeDesc::VECTOR ||
+		        param->type.vecsemantics == TypeDesc::NORMAL) {
+			socket_type = BL::NodeSocket::type_VECTOR;
+
+			if(param->validdefault) {
+				default_float4[0] = param->fdefault[0];
+				default_float4[1] = param->fdefault[1];
+				default_float4[2] = param->fdefault[2];
+			}
+		}
+		else if(param->type.aggregate == TypeDesc::SCALAR) {
+			if(param->type.basetype == TypeDesc::INT) {
+				socket_type = BL::NodeSocket::type_INT;
+				if(param->validdefault)
+					default_int = param->idefault[0];
+			}
+			else if(param->type.basetype == TypeDesc::FLOAT) {
+				socket_type = BL::NodeSocket::type_VALUE;
+				if(param->validdefault)
+					default_float = param->fdefault[0];
+			}
+			else if(param->type.basetype == TypeDesc::STRING) {
+				socket_type =  BL::NodeSocket::type_STRING;
+				if(param->validdefault)
+					default_string = param->sdefault[0];
+			}
+			else
+				continue;
+		}
+		else
+			continue;
+
+		/* find socket socket */
+		BL::NodeSocket b_sock = b_node.find_socket(param->name.c_str(), param->isoutput);
+
+		/* remove if type no longer matches */
+		if(b_sock && b_sock.type() != socket_type) {
+			b_node.remove_socket(b_sock);
+			b_sock = BL::NodeSocket(PointerRNA_NULL);
+		}
+
+		/* create new socket */
+		if(!b_sock) {
+			b_sock = b_node.add_socket(param->name.c_str(), socket_type, param->isoutput);
+
+			/* set default value */
+			if(socket_type == BL::NodeSocket::type_VALUE) {
+				BL::NodeSocketFloatNone b_float_sock(b_sock.ptr);
+				b_float_sock.default_value(default_float);
+			}
+			else if(socket_type == BL::NodeSocket::type_INT) {
+				BL::NodeSocketIntNone b_int_sock(b_sock.ptr);
+				b_int_sock.default_value(default_int);
+			}
+			else if(socket_type == BL::NodeSocket::type_RGBA) {
+				BL::NodeSocketRGBA b_rgba_sock(b_sock.ptr);
+				b_rgba_sock.default_value(default_float4);
+			}
+			else if(socket_type == BL::NodeSocket::type_VECTOR) {
+				BL::NodeSocketVectorNone b_vector_sock(b_sock.ptr);
+				b_vector_sock.default_value(default_float4);
+			}
+			else if(socket_type == BL::NodeSocket::type_STRING) {
+				BL::NodeSocketStringNone b_string_sock(b_sock.ptr);
+				b_string_sock.default_value(default_string);
+			}
+		}
+
+		used_sockets.insert(b_sock.ptr.data);
+	}
+
+	/* remove unused parameters */
+	bool removed;
+
+	do {
+		BL::Node::inputs_iterator b_input;
+		BL::Node::outputs_iterator b_output;
+
+		removed = false;
+
+		for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
+			if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) {
+				b_node.remove_socket(*b_input);
+				removed = true;
+				break;
+			}
+		}
+
+		for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
+			if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) {
+				b_node.remove_socket(*b_output);
+				removed = true;
+				break;
+			}
+		}
+	} while(removed);
+
+	Py_RETURN_TRUE;
+}
+
+static PyObject *osl_compile_func(PyObject *self, PyObject *args)
+{
+	const char *inputfile = NULL, *outputfile = NULL;
+
+	if(!PyArg_ParseTuple(args, "ss", &inputfile, &outputfile))
+		return NULL;
+	
+	/* return */
+	if(!OSLShaderManager::osl_compile(inputfile, outputfile))
+		Py_RETURN_FALSE;
+
+	Py_RETURN_TRUE;
+}
+#endif
+
 static PyMethodDef methods[] = {
 	{"init", init_func, METH_VARARGS, ""},
 	{"create", create_func, METH_VARARGS, ""},
@@ -170,6 +380,11 @@ static PyMethodDef methods[] = {
 	{"render", render_func, METH_O, ""},
 	{"draw", draw_func, METH_VARARGS, ""},
 	{"sync", sync_func, METH_O, ""},
+	{"reset", reset_func, METH_VARARGS, ""},
+#ifdef WITH_OSL
+	{"osl_update_node", osl_update_node_func, METH_VARARGS, ""},
+	{"osl_compile", osl_compile_func, METH_VARARGS, ""},
+#endif
 	{"available_devices", available_devices_func, METH_NOARGS, ""},
 	{NULL, NULL, 0, NULL},
 };
@@ -203,14 +418,23 @@ static CCLDeviceInfo *compute_device_list(DeviceType type)
 			if(info.type == type ||
 			   (info.type == DEVICE_MULTI && info.multi_devices[0].type == type))
 			{
-				CCLDeviceInfo cinfo = {info.id.c_str(), info.description.c_str(), i++};
+				CCLDeviceInfo cinfo;
+
+				strncpy(cinfo.identifier, info.id.c_str(), sizeof(cinfo.identifier));
+				cinfo.identifier[info.id.length()] = '\0';
+
+				strncpy(cinfo.name, info.description.c_str(), sizeof(cinfo.name));
+				cinfo.name[info.description.length()] = '\0';
+
+				cinfo.value = i++;
+
 				device_list.push_back(cinfo);
 			}
 		}
 
 		/* null terminate */
 		if(!device_list.empty()) {
-			CCLDeviceInfo cinfo = {NULL, NULL, 0};
+			CCLDeviceInfo cinfo = {"", "", 0};
 			device_list.push_back(cinfo);
 		}
 	}
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 7b80c52..b8ed942 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -105,13 +105,57 @@ void BlenderSession::create_session()
 		sync->sync_camera(b_engine.camera_override(), width, height);
 
 	/* set buffer parameters */
-	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
+	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_v3d, b_rv3d, scene->camera, width, height);
+	session->reset(buffer_params, session_params.samples);
+}
+
+void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_)
+{
+	b_data = b_data_;
+	b_scene = b_scene_;
+
+	SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background);
+	SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
+
+	width = b_engine.resolution_x();
+	height = b_engine.resolution_y();
+
+	if(scene->params.modified(scene_params) ||
+	   session->params.modified(session_params))
+	{
+		/* if scene or session parameters changed, it's easier to simply re-create
+		 * them rather than trying to distinguish which settings need to be updated
+		 */
+
+		delete session;
+
+		create_session();
+
+		return;
+	}
+
+	session->progress.reset();
+	scene->reset();
+
+	/* peak memory usage should show current render peak, not peak for all renders
+	 * made by this render session
+	 */
+	session->stats.mem_peak = session->stats.mem_used;
+
+	/* sync object should be re-created */
+	sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress);
+	sync->sync_data(b_v3d, b_engine.camera_override());
+	sync->sync_camera(b_engine.camera_override(), width, height);
+
+	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, PointerRNA_NULL, PointerRNA_NULL, scene->camera, width, height);
 	session->reset(buffer_params, session_params.samples);
 }
 
 void BlenderSession::free_session()
 {
-	delete sync;
+	if(sync)
+		delete sync;
+
 	delete session;
 }
 
@@ -178,15 +222,12 @@ static PassType get_pass_type(BL::RenderPass b_pass)
 
 static BL::RenderResult begin_render_result(BL::RenderEngine b_engine, int x, int y, int w, int h, const char *layername)
 {
-	RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, x, y, w, h, layername);
-	PointerRNA rrptr;
-	RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
-	return BL::RenderResult(rrptr);
+	return b_engine.begin_result(x, y, w, h, layername);
 }
 
 static void end_render_result(BL::RenderEngine b_engine, BL::RenderResult b_rr, bool cancel = false)
 {
-	RE_engine_end_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data, (int)cancel);
+	b_engine.end_result(b_rr, (int)cancel);
 }
 
 void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_update_only)
@@ -239,7 +280,7 @@ void BlenderSession::render()
 
 	/* get buffer parameters */
 	SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
-	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
+	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_v3d, b_rv3d, scene->camera, width, height);
 
 	/* render each layer */
 	BL::RenderSettings r = b_scene.render();
@@ -307,6 +348,15 @@ void BlenderSession::render()
 	/* clear callback */
 	session->write_render_tile_cb = NULL;
 	session->update_render_tile_cb = NULL;
+
+	/* free all memory used (host and device), so we wouldn't leave render
+	 * engine with extra memory allocated
+	 */
+
+	session->device_free();
+
+	delete sync;
+	sync = NULL;
 }
 
 void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile, bool do_update_only)
@@ -335,16 +385,16 @@ void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::Re
 
 			/* copy pixels */
 			if(buffers->get_pass_rect(pass_type, exposure, rtile.sample, components, &pixels[0]))
-				rna_RenderPass_rect_set(&b_pass.ptr, &pixels[0]);
+				b_pass.rect(&pixels[0]);
 		}
 	}
 
 	/* copy combined pass */
 	if(buffers->get_pass_rect(PASS_COMBINED, exposure, rtile.sample, 4, &pixels[0]))
-		rna_RenderLayer_rect_set(&b_rlay.ptr, &pixels[0]);
+		b_rlay.rect(&pixels[0]);
 
 	/* tag result as updated */
-	RE_engine_update_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
+	b_engine.update_result(b_rr);
 }
 
 void BlenderSession::write_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile)
@@ -399,7 +449,7 @@ void BlenderSession::synchronize()
 
 	/* reset if needed */
 	if(scene->need_reset()) {
-		BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
+		BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_v3d, b_rv3d, scene->camera, width, height);
 		session->reset(buffer_params, session_params.samples);
 	}
 }
@@ -437,7 +487,7 @@ bool BlenderSession::draw(int w, int h)
 		/* reset if requested */
 		if(reset) {
 			SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
-			BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, w, h);
+			BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_v3d, b_rv3d, scene->camera, w, h);
 
 			session->reset(buffer_params, session_params.samples);
 		}
@@ -447,7 +497,7 @@ bool BlenderSession::draw(int w, int h)
 	update_status_progress();
 
 	/* draw */
-	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
+	BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_v3d, b_rv3d, scene->camera, width, height);
 
 	return !session->draw(buffer_params);
 }
@@ -466,9 +516,12 @@ void BlenderSession::get_progress(float& progress, double& total_time)
 	session->progress.get_tile(tile, total_time, tile_time);
 
 	sample = session->progress.get_sample();
-	samples_per_tile = session->tile_manager.state.num_samples;
+	samples_per_tile = session->params.samples;
 
-	progress = ((float)sample/(float)(tile_total * samples_per_tile));
+	if(samples_per_tile && tile_total)
+		progress = ((float)sample / (float)(tile_total * samples_per_tile));
+	else
+		progress = 0.0;
 }
 
 void BlenderSession::update_status_progress()
@@ -477,11 +530,15 @@ void BlenderSession::update_status_progress()
 	float progress;
 	double total_time;
 	char time_str[128];
+	float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
+	float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
 
 	get_status(status, substatus);
 	get_progress(progress, total_time);
 
-	timestatus = b_scene.name();
+	timestatus = string_printf("Mem: %.2fM, Peak: %.2fM | ", mem_used, mem_peak);
+
+	timestatus += b_scene.name();
 	if(b_rlay_name != "")
 		timestatus += ", "  + b_rlay_name;
 	timestatus += " | ";
@@ -493,11 +550,12 @@ void BlenderSession::update_status_progress()
 		status += " | " + substatus;
 
 	if(status != last_status) {
-		RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", (timestatus + status).c_str());
+		b_engine.update_stats("", (timestatus + status).c_str());
+		b_engine.update_memory_stats(mem_used, mem_peak);
 		last_status = status;
 	}
 	if(progress != last_progress) {
-		RE_engine_update_progress((RenderEngine*)b_engine.ptr.data, progress);
+		b_engine.update_progress(progress);
 		last_progress = progress;
 	}
 }
@@ -505,7 +563,7 @@ void BlenderSession::update_status_progress()
 void BlenderSession::tag_update()
 {
 	/* tell blender that we want to get another update callback */
-	engine_tag_update((RenderEngine*)b_engine.ptr.data);
+	b_engine.tag_update();
 }
 
 void BlenderSession::tag_redraw()
@@ -517,13 +575,13 @@ void BlenderSession::tag_redraw()
 
 		/* offline render, redraw if timeout passed */
 		if(time_dt() - last_redraw_time > 1.0) {
-			engine_tag_redraw((RenderEngine*)b_engine.ptr.data);
+			b_engine.tag_redraw();
 			last_redraw_time = time_dt();
 		}
 	}
 	else {
 		/* tell blender that we want to redraw */
-		engine_tag_redraw((RenderEngine*)b_engine.ptr.data);
+		b_engine.tag_redraw();
 	}
 }
 
@@ -531,7 +589,7 @@ void BlenderSession::test_cancel()
 {
 	/* test if we need to cancel rendering */
 	if(background)
-		if(RE_engine_test_break((RenderEngine*)b_engine.ptr.data))
+		if(b_engine.test_break())
 			session->progress.set_cancel("Cancelled");
 }
 
diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h
index d52e010..7f3973a 100644
--- a/intern/cycles/blender/blender_session.h
+++ b/intern/cycles/blender/blender_session.h
@@ -46,6 +46,8 @@ public:
 	void create_session();
 	void free_session();
 
+	void reset_session(BL::BlendData b_data, BL::Scene b_scene);
+
 	/* offline render */
 	void render();
 
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index b6d5cc6..c9380d8 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -20,6 +20,7 @@
 #include "graph.h"
 #include "light.h"
 #include "nodes.h"
+#include "osl.h"
 #include "scene.h"
 #include "shader.h"
 
@@ -43,6 +44,7 @@ void BlenderSync::find_shader(BL::ID id, vector<uint>& used_shaders, int default
 	for(size_t i = 0; i < scene->shaders.size(); i++) {
 		if(scene->shaders[i] == shader) {
 			used_shaders.push_back(i);
+			scene->shaders[i]->tag_used(scene);
 			break;
 		}
 	}
@@ -80,22 +82,25 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
 	switch (b_type) {
 	case BL::NodeSocket::type_VALUE:
 		return SHADER_SOCKET_FLOAT;
+	case BL::NodeSocket::type_INT:
+		return SHADER_SOCKET_INT;
 	case BL::NodeSocket::type_VECTOR:
 		return SHADER_SOCKET_VECTOR;
 	case BL::NodeSocket::type_RGBA:
 		return SHADER_SOCKET_COLOR;
 	case BL::NodeSocket::type_SHADER:
 		return SHADER_SOCKET_CLOSURE;
+	case BL::NodeSocket::type_STRING:
+		return SHADER_SOCKET_STRING;
 	
 	case BL::NodeSocket::type_BOOLEAN:
 	case BL::NodeSocket::type_MESH:
-	case BL::NodeSocket::type_INT:
 	default:
 		return SHADER_SOCKET_FLOAT;
 	}
 }
 
-static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
+static void set_default_value(ShaderInput *input, BL::NodeSocket sock, BL::BlendData b_data, BL::ID b_id)
 {
 	/* copy values for non linked inputs */
 	switch(input->type) {
@@ -104,6 +109,11 @@ static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
 		input->set(value_sock.default_value());
 		break;
 	}
+	case SHADER_SOCKET_INT: {
+		BL::NodeSocketIntNone value_sock(sock);
+		input->set((float)value_sock.default_value());
+		break;
+	}
 	case SHADER_SOCKET_COLOR: {
 		BL::NodeSocketRGBA rgba_sock(sock);
 		input->set(get_float3(rgba_sock.default_value()));
@@ -116,6 +126,11 @@ static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
 		input->set(get_float3(vec_sock.default_value()));
 		break;
 	}
+	case SHADER_SOCKET_STRING: {
+		BL::NodeSocketStringNone string_sock(sock);
+		input->set((ustring)blender_absolute_path(b_data, b_id, string_sock.default_value()));
+		break;
+	}
 	case SHADER_SOCKET_CLOSURE:
 		break;
 	}
@@ -152,7 +167,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
 		mapping->max = get_float3(b_mapping.max());
 }
 
-static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNode b_node)
+static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, BL::ShaderNode b_node)
 {
 	ShaderNode *node = NULL;
 
@@ -165,6 +180,7 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 		case BL::ShaderNode::type_OUTPUT: break;
 		case BL::ShaderNode::type_SQUEEZE: break;
 		case BL::ShaderNode::type_TEXTURE: break;
+		case BL::ShaderNode::type_FRAME: break;
 		/* handled outside this function */
 		case BL::ShaderNode::type_GROUP: break;
 		/* existing blender nodes */
@@ -315,6 +331,10 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			node = new HoldoutNode();
 			break;
 		}
+		case BL::ShaderNode::type_BSDF_ANISOTROPIC: {
+			node = new WardBsdfNode();
+			break;
+		}
 		case BL::ShaderNode::type_BSDF_DIFFUSE: {
 			node = new DiffuseBsdfNode();
 			break;
@@ -354,6 +374,23 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			node = glass;
 			break;
 		}
+		case BL::ShaderNode::type_BSDF_REFRACTION: {
+			BL::ShaderNodeBsdfRefraction b_refraction_node(b_node);
+			RefractionBsdfNode *refraction = new RefractionBsdfNode();
+			switch(b_refraction_node.distribution()) {
+				case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
+					refraction->distribution = ustring("Sharp");
+					break;
+				case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN:
+					refraction->distribution = ustring("Beckmann");
+					break;
+				case BL::ShaderNodeBsdfRefraction::distribution_GGX:
+					refraction->distribution = ustring("GGX");
+					break;
+			}
+			node = refraction;
+			break;
+		}
 		case BL::ShaderNode::type_BSDF_TRANSLUCENT: {
 			node = new TranslucentBsdfNode();
 			break;
@@ -370,6 +407,10 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			node = new EmissionNode();
 			break;
 		}
+		case BL::ShaderNode::type_AMBIENT_OCCLUSION: {
+			node = new AmbientOcclusionNode();
+			break;
+		}
 		case BL::ShaderNode::type_VOLUME_ISOTROPIC: {
 			node = new IsotropicVolumeNode();
 			break;
@@ -398,13 +439,71 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			node = new ParticleInfoNode();
 			break;
 		}
+		case BL::ShaderNode::type_BUMP: {
+			node = new BumpNode();
+			break;
+		}
+		case BL::ShaderNode::type_SCRIPT: {
+#ifdef WITH_OSL
+			if(!scene->shader_manager->use_osl())
+				break;
+
+			/* create script node */
+			BL::ShaderNodeScript b_script_node(b_node);
+			OSLScriptNode *script_node = new OSLScriptNode();
+			
+			/* Generate inputs/outputs from node sockets
+			 *
+			 * Note: the node sockets are generated from OSL parameters,
+			 * so the names match those of the corresponding parameters exactly.
+			 *
+			 * Note 2: ShaderInput/ShaderOutput store shallow string copies only!
+			 * Socket names must be stored in the extra lists instead. */
+			BL::Node::inputs_iterator b_input;
+
+			for (b_script_node.inputs.begin(b_input); b_input != b_script_node.inputs.end(); ++b_input) {
+				script_node->input_names.push_back(ustring(b_input->name()));
+				ShaderInput *input = script_node->add_input(script_node->input_names.back().c_str(), convert_socket_type(b_input->type()));
+				set_default_value(input, *b_input, b_data, b_ntree);
+			}
+
+			BL::Node::outputs_iterator b_output;
+
+			for (b_script_node.outputs.begin(b_output); b_output != b_script_node.outputs.end(); ++b_output) {
+				script_node->output_names.push_back(ustring(b_output->name()));
+				script_node->add_output(script_node->output_names.back().c_str(), convert_socket_type(b_output->type()));
+			}
+
+			/* load bytecode or filepath */
+			OSLShaderManager *manager = (OSLShaderManager*)scene->shader_manager;
+			string bytecode_hash = b_script_node.bytecode_hash();
+
+			if(!bytecode_hash.empty()) {
+				/* loaded bytecode if not already done */
+				if(!manager->shader_test_loaded(bytecode_hash))
+					manager->shader_load_bytecode(bytecode_hash, b_script_node.bytecode());
+
+				script_node->bytecode_hash = bytecode_hash;
+			}
+			else {
+				/* set filepath */
+				script_node->filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+			}
+			
+			node = script_node;
+#endif
+
+			break;
+		}
 		case BL::ShaderNode::type_TEX_IMAGE: {
 			BL::ShaderNodeTexImage b_image_node(b_node);
 			BL::Image b_image(b_image_node.image());
 			ImageTextureNode *image = new ImageTextureNode();
 			/* todo: handle generated/builtin images */
-			if(b_image && b_image.source() != BL::Image::source_MOVIE)
+			if(b_image && b_image.source() != BL::Image::source_MOVIE) {
 				image->filename = image_user_file_path(b_image_node.image_user(), b_image, b_scene.frame_current());
+				image->animated = b_image_node.image_user().use_auto_refresh();
+			}
 			image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
 			image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
 			image->projection_blend = b_image_node.projection_blend();
@@ -416,8 +515,10 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			BL::ShaderNodeTexEnvironment b_env_node(b_node);
 			BL::Image b_image(b_env_node.image());
 			EnvironmentTextureNode *env = new EnvironmentTextureNode();
-			if(b_image && b_image.source() != BL::Image::source_MOVIE)
+			if(b_image && b_image.source() != BL::Image::source_MOVIE) {
 				env->filename = image_user_file_path(b_env_node.image_user(), b_image, b_scene.frame_current());
+				env->animated = b_env_node.image_user().use_auto_refresh();
+			}
 			env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
 			env->projection = EnvironmentTextureNode::projection_enum[(int)b_env_node.projection()];
 			get_tex_mapping(&env->tex_mapping, b_env_node.texture_mapping());
@@ -505,6 +606,23 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
 			node = sky;
 			break;
 		}
+		case BL::ShaderNode::type_NORMAL_MAP: {
+			BL::ShaderNodeNormalMap b_normal_map_node(b_node);
+			NormalMapNode *nmap = new NormalMapNode();
+			nmap->space = NormalMapNode::space_enum[(int)b_normal_map_node.space()];
+			nmap->attribute = b_normal_map_node.uv_map();
+			node = nmap;
+			break;
+		}
+		case BL::ShaderNode::type_TANGENT: {
+			BL::ShaderNodeTangent b_tangent_node(b_node);
+			TangentNode *tangent = new TangentNode();
+			tangent->direction_type = TangentNode::direction_type_enum[(int)b_tangent_node.direction_type()];
+			tangent->axis = TangentNode::axis_enum[(int)b_tangent_node.axis()];
+			tangent->attribute = b_tangent_node.uv_map();
+			node = tangent;
+			break;
+		}
 	}
 
 	if(node && node != graph->output())
@@ -561,7 +679,7 @@ static SocketPair node_socket_map_pair(PtrNodeMap& node_map, BL::Node b_node, BL
 	return SocketPair(node_map[b_node.ptr.data], name);
 }
 
-static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
+static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
 {
 	/* add nodes */
 	BL::ShaderNodeTree::nodes_iterator b_node;
@@ -569,7 +687,34 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 	PtrSockMap proxy_map;
 
 	for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
-		if(b_node->is_a(&RNA_NodeGroup)) {
+		if(b_node->mute()) {
+			BL::Node::inputs_iterator b_input;
+			BL::Node::outputs_iterator b_output;
+			bool found_match = false;
+
+			/* this is slightly different than blender logic, we just connect a
+			 * single pair for of input/output, but works ok for the node we have */
+			for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
+				if(b_input->is_linked()) {
+					for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
+						if(b_output->is_linked() && b_input->type() == b_output->type()) {
+							ProxyNode *proxy = new ProxyNode(convert_socket_type(b_input->type()), convert_socket_type(b_output->type()));
+							graph->add(proxy);
+
+							proxy_map[b_input->ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+							proxy_map[b_output->ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+							found_match = true;
+
+							break;
+						}
+					}
+				}
+
+				if(found_match)
+					break;
+			}
+		}
+		else if(b_node->is_a(&RNA_NodeGroup)) {
 			/* add proxy converter nodes for inputs and outputs */
 			BL::NodeGroup b_gnode(*b_node);
 			BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
@@ -592,7 +737,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 				group_sockmap[b_input->group_socket().ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
 				
 				/* default input values of the group node */
-				set_default_value(proxy->inputs[0], *b_input);
+				set_default_value(proxy->inputs[0], *b_input, b_data, b_group_ntree);
 			}
 			
 			for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
@@ -606,13 +751,13 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 				group_sockmap[b_output->group_socket().ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
 				
 				/* default input values of internal, unlinked group outputs */
-				set_default_value(proxy->inputs[0], b_output->group_socket());
+				set_default_value(proxy->inputs[0], b_output->group_socket(), b_data, b_group_ntree);
 			}
 			
-			add_nodes(b_data, b_scene, graph, b_group_ntree, group_sockmap);
+			add_nodes(scene, b_data, b_scene, graph, b_group_ntree, group_sockmap);
 		}
 		else {
-			ShaderNode *node = add_node(b_data, b_scene, graph, BL::ShaderNode(*b_node));
+			ShaderNode *node = add_node(scene, b_data, b_scene, graph, b_ntree, BL::ShaderNode(*b_node));
 			
 			if(node) {
 				BL::Node::inputs_iterator b_input;
@@ -626,7 +771,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 					assert(input);
 					
 					/* copy values for non linked inputs */
-					set_default_value(input, *b_input);
+					set_default_value(input, *b_input, b_data, b_ntree);
 				}
 			}
 		}
@@ -649,7 +794,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 
 		/* from sock */
 		if(b_from_node) {
-			if (b_from_node.is_a(&RNA_NodeGroup))
+			if (b_from_node.mute() || b_from_node.is_a(&RNA_NodeGroup))
 				from_pair = proxy_map[b_from_sock.ptr.data];
 			else
 				from_pair = node_socket_map_pair(node_map, b_from_node, b_from_sock);
@@ -659,7 +804,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 
 		/* to sock */
 		if(b_to_node) {
-			if (b_to_node.is_a(&RNA_NodeGroup))
+			if (b_to_node.mute() || b_to_node.is_a(&RNA_NodeGroup))
 				to_pair = proxy_map[b_to_sock.ptr.data];
 			else
 				to_pair = node_socket_map_pair(node_map, b_to_node, b_to_sock);
@@ -680,7 +825,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
 
 /* Sync Materials */
 
-void BlenderSync::sync_materials()
+void BlenderSync::sync_materials(bool update_all)
 {
 	shader_map.set_default(scene->shaders[scene->default_surface]);
 
@@ -691,7 +836,7 @@ void BlenderSync::sync_materials()
 		Shader *shader;
 		
 		/* test if we need to sync */
-		if(shader_map.sync(&shader, *b_mat)) {
+		if(shader_map.sync(&shader, *b_mat) || update_all) {
 			ShaderGraph *graph = new ShaderGraph();
 
 			shader->name = b_mat->name().c_str();
@@ -702,7 +847,7 @@ void BlenderSync::sync_materials()
 				PtrSockMap sock_to_node;
 				BL::ShaderNodeTree b_ntree(b_mat->node_tree());
 
-				add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+				add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
 			}
 			else {
 				ShaderNode *closure, *out;
@@ -727,14 +872,14 @@ void BlenderSync::sync_materials()
 
 /* Sync World */
 
-void BlenderSync::sync_world()
+void BlenderSync::sync_world(bool update_all)
 {
 	Background *background = scene->background;
 	Background prevbackground = *background;
 
 	BL::World b_world = b_scene.world();
 
-	if(world_recalc || b_world.ptr.data != world_map) {
+	if(world_recalc || update_all || b_world.ptr.data != world_map) {
 		Shader *shader = scene->shaders[scene->default_background];
 		ShaderGraph *graph = new ShaderGraph();
 
@@ -743,7 +888,7 @@ void BlenderSync::sync_world()
 			PtrSockMap sock_to_node;
 			BL::ShaderNodeTree b_ntree(b_world.node_tree());
 
-			add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+			add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
 		}
 		else if(b_world) {
 			ShaderNode *closure, *out;
@@ -781,7 +926,7 @@ void BlenderSync::sync_world()
 
 /* Sync Lamps */
 
-void BlenderSync::sync_lamps()
+void BlenderSync::sync_lamps(bool update_all)
 {
 	shader_map.set_default(scene->shaders[scene->default_light]);
 
@@ -792,7 +937,7 @@ void BlenderSync::sync_lamps()
 		Shader *shader;
 		
 		/* test if we need to sync */
-		if(shader_map.sync(&shader, *b_lamp)) {
+		if(shader_map.sync(&shader, *b_lamp) || update_all) {
 			ShaderGraph *graph = new ShaderGraph();
 
 			/* create nodes */
@@ -802,7 +947,7 @@ void BlenderSync::sync_lamps()
 				PtrSockMap sock_to_node;
 				BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
 
-				add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+				add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
 			}
 			else {
 				ShaderNode *closure, *out;
@@ -831,11 +976,20 @@ void BlenderSync::sync_lamps()
 
 void BlenderSync::sync_shaders()
 {
+	/* for auto refresh images */
+	bool auto_refresh_update = false;
+
+	if(preview) {
+		ImageManager *image_manager = scene->image_manager;
+		int frame = b_scene.frame_current();
+		auto_refresh_update = image_manager->set_animation_frame_update(frame);
+	}
+
 	shader_map.pre_sync();
 
-	sync_world();
-	sync_lamps();
-	sync_materials();
+	sync_world(auto_refresh_update);
+	sync_lamps(auto_refresh_update);
+	sync_materials(auto_refresh_update);
 
 	/* false = don't delete unused shaders, not supported */
 	shader_map.post_sync(false);
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index b4990eb..d0e8b50 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -17,6 +17,7 @@
  */
 
 #include "background.h"
+#include "camera.h"
 #include "film.h"
 #include "../render/filter.h"
 #include "graph.h"
@@ -141,7 +142,6 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, const
 	sync_film();
 	sync_shaders();
 	sync_objects(b_v3d);
-	sync_particle_systems();
 	sync_motion(b_v3d, b_override);
 }
 
@@ -149,6 +149,9 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, const
 
 void BlenderSync::sync_integrator()
 {
+#ifdef __CAMERA_MOTION__
+	BL::RenderSettings r = b_scene.render();
+#endif
 	PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
 	experimental = (RNA_enum_get(&cscene, "feature_set") != 0);
@@ -175,8 +178,15 @@ void BlenderSync::sync_integrator()
 	integrator->layer_flag = render_layer.layer;
 
 	integrator->sample_clamp = get_float(cscene, "sample_clamp");
-#ifdef __MOTION__
-	integrator->motion_blur = (!preview && r.use_motion_blur());
+#ifdef __CAMERA_MOTION__
+	if(!preview) {
+		if(integrator->motion_blur != r.use_motion_blur()) {
+			scene->object_manager->tag_update(scene);
+			scene->camera->tag_update();
+		}
+
+		integrator->motion_blur = r.use_motion_blur();
+	}
 #endif
 
 	integrator->diffuse_samples = get_int(cscene, "diffuse_samples");
@@ -233,6 +243,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
 			render_layer.use_localview = (b_v3d.local_view() ? true : false);
 			render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view(), render_layer.use_localview);
 			render_layer.layer = render_layer.scene_layer;
+			render_layer.exclude_layer = 0;
 			render_layer.holdout_layer = 0;
 			render_layer.material_override = PointerRNA_NULL;
 			render_layer.use_background = true;
@@ -250,10 +261,16 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
 	for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
 		if((!layer && first_layer) || (layer && b_rlay->name() == layer)) {
 			render_layer.name = b_rlay->name();
-			render_layer.scene_layer = get_layer(b_scene.layers()) & ~get_layer(b_rlay->layers_exclude());
-			render_layer.layer = get_layer(b_rlay->layers());
+
 			render_layer.holdout_layer = get_layer(b_rlay->layers_zmask());
+			render_layer.exclude_layer = get_layer(b_rlay->layers_exclude());
+
+			render_layer.scene_layer = get_layer(b_scene.layers()) & ~render_layer.exclude_layer;
+			render_layer.scene_layer |= render_layer.exclude_layer & render_layer.holdout_layer;
+
+			render_layer.layer = get_layer(b_rlay->layers());
 			render_layer.layer |= render_layer.holdout_layer;
+
 			render_layer.material_override = b_rlay->material_override();
 			render_layer.use_background = b_rlay->use_sky();
 			render_layer.use_viewport_visibility = false;
@@ -269,6 +286,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
 
 SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
 {
+	BL::RenderSettings r = b_scene.render();
 	SceneParams params;
 	PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 	int shadingsystem = RNA_enum_get(&cscene, "shading_system");
@@ -286,6 +304,8 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
 	params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
 	params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
 
+	params.persistent_images = (background)? r.use_persistent_data(): false;
+
 	return params;
 }
 
@@ -371,19 +391,36 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
 	params.start_resolution = get_int(cscene, "preview_start_resolution");
 
 	/* other parameters */
-	params.threads = b_scene.render().threads();
+	if(b_scene.render().threads_mode() == BL::RenderSettings::threads_mode_FIXED)
+		params.threads = b_scene.render().threads();
+	else
+		params.threads = 0;
 
 	params.cancel_timeout = get_float(cscene, "debug_cancel_timeout");
 	params.reset_timeout = get_float(cscene, "debug_reset_timeout");
 	params.text_timeout = get_float(cscene, "debug_text_timeout");
 
+	params.progressive_refine = get_boolean(cscene, "use_progressive_refine");
+
 	if(background) {
-		params.progressive = false;
+		if(params.progressive_refine)
+			params.progressive = true;
+		else
+			params.progressive = false;
+
 		params.start_resolution = INT_MAX;
 	}
 	else
 		params.progressive = true;
-	
+
+	/* shading system - scene level needs full refresh */
+	int shadingsystem = RNA_enum_get(&cscene, "shading_system");
+
+	if(shadingsystem == 0)
+		params.shadingsystem = SessionParams::SVM;
+	else if(shadingsystem == 1)
+		params.shadingsystem = SessionParams::OSL;
+
 	return params;
 }
 
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index ce56308..d3d21fb 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -42,6 +42,7 @@ class Film;
 class Light;
 class Mesh;
 class Object;
+class ParticleSystem;
 class Scene;
 class Shader;
 class ShaderGraph;
@@ -63,38 +64,37 @@ public:
 	static SceneParams get_scene_params(BL::Scene b_scene, bool background);
 	static SessionParams get_session_params(BL::RenderEngine b_engine, BL::UserPreferences b_userpref, BL::Scene b_scene, bool background);
 	static bool get_session_pause(BL::Scene b_scene, bool background);
-	static BufferParams get_buffer_params(BL::Scene b_scene, Camera *cam, int width, int height);
+	static BufferParams get_buffer_params(BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, Camera *cam, int width, int height);
 
 private:
 	/* sync */
-	void sync_lamps();
-	void sync_materials();
+	void sync_lamps(bool update_all);
+	void sync_materials(bool update_all);
 	void sync_objects(BL::SpaceView3D b_v3d, int motion = 0);
 	void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override);
 	void sync_film();
 	void sync_integrator();
 	void sync_view();
-	void sync_world();
+	void sync_world(bool update_all);
 	void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
 	void sync_shaders();
-	void sync_particle_systems();
 
 	void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
 	Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
-	void sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, int motion, int particle_id);
-	void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
+	Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, int motion);
+	void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
 	void sync_background_light();
 	void sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion);
 	void sync_camera_motion(BL::Object b_ob, int motion);
-	void sync_particles(BL::Object b_ob, BL::ParticleSystem b_psys);
+
+	/* particles */
+	bool sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object);
 
 	/* util */
 	void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader);
 	bool BKE_object_is_modified(BL::Object b_ob);
 	bool object_is_mesh(BL::Object b_ob);
 	bool object_is_light(BL::Object b_ob);
-	bool psys_need_update(BL::ParticleSystem b_psys);
-	int object_count_particles(BL::Object b_ob);
 
 	/* variables */
 	BL::RenderEngine b_engine;
@@ -116,7 +116,8 @@ private:
 
 	struct RenderLayerInfo {
 		RenderLayerInfo()
-		: scene_layer(0), layer(0), holdout_layer(0),
+		: scene_layer(0), layer(0),
+		  holdout_layer(0), exclude_layer(0),
 		  material_override(PointerRNA_NULL),
 		  use_background(true),
 		  use_viewport_visibility(false),
@@ -127,6 +128,7 @@ private:
 		uint scene_layer;
 		uint layer;
 		uint holdout_layer;
+		uint exclude_layer;
 		BL::Material material_override;
 		bool use_background;
 		bool use_viewport_visibility;
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index da8f30e..0a9f2dd 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -30,29 +30,7 @@
  * todo: clean this up ... */
 
 extern "C" {
-
-struct RenderEngine;
-struct RenderResult;
-
-ID *rna_Object_to_mesh(void *_self, void *reports, void *scene, int apply_modifiers, int settings);
-void rna_Main_meshes_remove(void *bmain, void *reports, void *mesh);
-void rna_Object_create_duplilist(void *ob, void *reports, void *sce, int settings);
-void rna_Object_free_duplilist(void *ob);
-void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values);
-void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
-struct RenderResult *RE_engine_begin_result(struct RenderEngine *engine, int x, int y, int w, int h, const char *layername);
-void RE_engine_update_result(struct RenderEngine *engine, struct RenderResult *result);
-void RE_engine_end_result(struct RenderEngine *engine, struct RenderResult *result, int cancel);
-int RE_engine_test_break(struct RenderEngine *engine);
-void RE_engine_update_stats(struct RenderEngine *engine, const char *stats, const char *info);
-void RE_engine_update_progress(struct RenderEngine *engine, float progress);
-void engine_tag_redraw(void *engine);
-void engine_tag_update(void *engine);
-int rna_Object_is_modified(void *ob, void *scene, int settings);
-int rna_Object_is_deform_modified(void *ob, void *scene, int settings);
 void BLI_timestr(double _time, char *str);
-void rna_ColorRamp_eval(void *coba, float position, float color[4]);
-void rna_Scene_frame_set(void *scene, int frame, float subframe);
 void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr);
 void BKE_image_user_file_path(void *iuser, void *ima, char *path);
 }
@@ -61,10 +39,7 @@ CCL_NAMESPACE_BEGIN
 
 static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
 {
-	ID *data = rna_Object_to_mesh(self.ptr.data, NULL, scene.ptr.data, apply_modifiers, (render)? 2: 1);
-	PointerRNA ptr;
-	RNA_id_pointer_create(data, &ptr);
-	return BL::Mesh(ptr);
+	return self.to_mesh(scene, apply_modifiers, (render)? 2: 1);
 }
 
 static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
@@ -72,34 +47,19 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
 	for(int i = 0; i < size; i++) {
 		float color[4];
 
-		rna_ColorRamp_eval(ramp.ptr.data, i/(float)(size-1), color);
+		ramp.evaluate(i/(float)(size-1), color);
 		data[i] = make_float4(color[0], color[1], color[2], color[3]);
 	}
 }
 
-static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh)
-{
-	rna_Main_meshes_remove(data.ptr.data, NULL, mesh.ptr.data);
-}
-
-static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
-{
-	rna_Object_create_duplilist(self.ptr.data, NULL, scene.ptr.data, 2);
-}
-
-static inline void object_free_duplilist(BL::Object self)
-{
-	rna_Object_free_duplilist(self.ptr.data);
-}
-
 static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
 {
-	return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
+	return self.is_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
 }
 
 static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview)
 {
-	return rna_Object_is_deform_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
+	return self.is_deform_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
 }
 
 static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, int cfra)
@@ -110,11 +70,6 @@ static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, in
 	return string(filepath);
 }
 
-static inline void scene_frame_set(BL::Scene scene, int frame)
-{
-	rna_Scene_frame_set(scene.ptr.data, frame, 0.0f);
-}
-
 /* Utilities */
 
 static inline Transform get_transform(BL::Array<float, 16> array)
@@ -329,6 +284,12 @@ public:
 		return recalc;
 	}
 
+	bool is_used(const K& key)
+	{
+		T *data = find(key);
+		return (data) ? used_set.find(data) != used_set.end() : false;
+	}
+
 	void used(T *data)
 	{
 		/* tag data as still in use */
@@ -388,27 +349,63 @@ protected:
 
 /* Object Key */
 
+enum { OBJECT_PERSISTENT_ID_SIZE = 8 };
+
 struct ObjectKey {
 	void *parent;
-	int index;
+	int id[OBJECT_PERSISTENT_ID_SIZE];
 	void *ob;
 
-	ObjectKey(void *parent_, int index_, void *ob_)
-	: parent(parent_), index(index_), ob(ob_) {}
+	ObjectKey(void *parent_, int id_[OBJECT_PERSISTENT_ID_SIZE], void *ob_)
+	: parent(parent_), ob(ob_)
+	{
+		if(id_)
+			memcpy(id, id_, sizeof(id));
+		else
+			memset(id, 0, sizeof(id));
+	}
 
 	bool operator<(const ObjectKey& k) const
-	{ return (parent < k.parent || (parent == k.parent && (index < k.index || (index == k.index && ob < k.ob)))); }
+	{
+		if(ob < k.ob) {
+			return true;
+		}
+		else if(ob == k.ob) {
+			if(parent < k.parent)
+				return true;
+			else if(parent == k.parent)
+				return memcmp(id, k.id, sizeof(id)) < 0;
+		}
+
+		return false;
+	}
 };
 
+/* Particle System Key */
+
 struct ParticleSystemKey {
 	void *ob;
-	void *psys;
+	int id[OBJECT_PERSISTENT_ID_SIZE];
 
-	ParticleSystemKey(void *ob_, void *psys_)
-	: ob(ob_), psys(psys_) {}
+	ParticleSystemKey(void *ob_, int id_[OBJECT_PERSISTENT_ID_SIZE])
+	: ob(ob_)
+	{
+		if(id_)
+			memcpy(id, id_, sizeof(id));
+		else
+			memset(id, 0, sizeof(id));
+	}
 
 	bool operator<(const ParticleSystemKey& k) const
-	{ return (ob < k.ob && psys < k.psys); }
+	{
+		/* first id is particle index, we don't compare that */
+		if(ob < k.ob)
+			return true;
+		else if(ob == k.ob)
+			return memcmp(id+1, k.id+1, sizeof(int)*(OBJECT_PERSISTENT_ID_SIZE-1)) < 0;
+
+		return false;
+	}
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt
index ba5c378..cbbd23f 100644
--- a/intern/cycles/bvh/CMakeLists.txt
+++ b/intern/cycles/bvh/CMakeLists.txt
@@ -7,6 +7,7 @@ set(INC
 	../util
 	../device
 )
+
 set(INC_SYS
 )
 
diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index 5c00f7b..a0d10a4 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -54,7 +54,7 @@ public:
 
 	// Subtree functions
 	int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const;
-	float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;	
+	float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
 	void deleteSubtree();
 
 	uint update_visibility();
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index 332d3d7..7900498 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -18,33 +18,6 @@ else()
 endif()
 
 ###########################################################################
-# Partio
-
-if(WITH_CYCLES_PARTIO)
-
-	set(CYCLES_PARTIO "" CACHE PATH "Path to Partio installation")
-
-	message(STATUS "CYCLES_PARTIO = ${CYCLES_PARTIO}")
-
-	find_library(PARTIO_LIBRARIES NAMES partio PATHS ${CYCLES_PARTIO}/lib)
-	find_path(PARTIO_INCLUDES Partio.h ${CYCLES_PARTIO}/include)
-
-	find_package(ZLIB)
-
-	if(PARTIO_INCLUDES AND PARTIO_LIBRARIES AND ZLIB_LIBRARIES)
-		list(APPEND PARTIO_LIBRARIES ${ZLIB_LIBRARIES})
-		set(PARTIO_FOUND TRUE)
-		message(STATUS "PARTIO includes = ${PARTIO_INCLUDES}")
-		message(STATUS "PARTIO library = ${PARTIO_LIBRARIES}")
-	else()
-		message(STATUS "PARTIO not found")
-	endif()
-
-	include_directories(${PARTIO_INCLUDES})
-
-endif()
-
-###########################################################################
 # CUDA
 
 if(WITH_CYCLES_CUDA_BINARIES)
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt
index 1d7c6ef..0071bbe 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -7,6 +7,7 @@ set(INC
 	../util
 	../render
 )
+
 set(INC_SYS
 	${OPENGL_INCLUDE_DIR}
 	${GLEW_INCLUDE_PATH}
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 9a4d364..1248b42 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -28,6 +28,7 @@
 #include "util_math.h"
 #include "util_opencl.h"
 #include "util_opengl.h"
+#include "util_time.h"
 #include "util_types.h"
 #include "util_vector.h"
 
@@ -77,36 +78,36 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
 		glDisable(GL_BLEND);
 }
 
-Device *Device::create(DeviceInfo& info, bool background, int threads)
+Device *Device::create(DeviceInfo& info, Stats &stats, bool background)
 {
 	Device *device;
 
 	switch(info.type) {
 		case DEVICE_CPU:
-			device = device_cpu_create(info, threads);
+			device = device_cpu_create(info, stats);
 			break;
 #ifdef WITH_CUDA
 		case DEVICE_CUDA:
 			if(cuLibraryInit())
-				device = device_cuda_create(info, background);
+				device = device_cuda_create(info, stats, background);
 			else
 				device = NULL;
 			break;
 #endif
 #ifdef WITH_MULTI
 		case DEVICE_MULTI:
-			device = device_multi_create(info, background);
+			device = device_multi_create(info, stats, background);
 			break;
 #endif
 #ifdef WITH_NETWORK
 		case DEVICE_NETWORK:
-			device = device_network_create(info, "127.0.0.1");
+			device = device_network_create(info, stats, "127.0.0.1");
 			break;
 #endif
 #ifdef WITH_OPENCL
 		case DEVICE_OPENCL:
 			if(clLibraryInit())
-				device = device_opencl_create(info, background);
+				device = device_opencl_create(info, stats, background);
 			else
 				device = NULL;
 			break;
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 2ee2e04..9840687 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -25,6 +25,7 @@
 #include "device_task.h"
 
 #include "util_list.h"
+#include "util_stats.h"
 #include "util_string.h"
 #include "util_thread.h"
 #include "util_types.h"
@@ -72,7 +73,7 @@ public:
 
 class Device {
 protected:
-	Device() {}
+	Device(Stats &stats_) : stats(stats_) {}
 
 	bool background;
 	string error_msg;
@@ -84,6 +85,9 @@ public:
 	DeviceInfo info;
 	virtual const string& error_message() { return error_msg; }
 
+	/* statistics */
+	Stats &stats;
+
 	/* regular memory */
 	virtual void mem_alloc(device_memory& mem, MemoryType type) = 0;
 	virtual void mem_copy_to(device_memory& mem) = 0;
@@ -130,7 +134,7 @@ public:
 	virtual int device_number(Device *sub_device) { return 0; }
 
 	/* static */
-	static Device *create(DeviceInfo& info, bool background = true, int threads = 0);
+	static Device *create(DeviceInfo& info, Stats &stats, bool background = true);
 
 	static DeviceType type_from_string(const char *name);
 	static string string_from_type(DeviceType type);
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 4c54671..a1d7706 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -23,9 +23,12 @@
 #include "device_intern.h"
 
 #include "kernel.h"
+#include "kernel_compat_cpu.h"
 #include "kernel_types.h"
+#include "kernel_globals.h"
 
 #include "osl_shader.h"
+#include "osl_globals.h"
 
 #include "buffers.h"
 
@@ -43,11 +46,16 @@ class CPUDevice : public Device
 {
 public:
 	TaskPool task_pool;
-	KernelGlobals *kg;
+	KernelGlobals kernel_globals;
+#ifdef WITH_OSL
+	OSLGlobals osl_globals;
+#endif
 	
-	CPUDevice(int threads_num)
+	CPUDevice(Stats &stats) : Device(stats)
 	{
-		kg = kernel_globals_create();
+#ifdef WITH_OSL
+		kernel_globals.osl = &osl_globals;
+#endif
 
 		/* do now to avoid thread issues */
 		system_cpu_support_optimized();
@@ -56,7 +64,6 @@ public:
 	~CPUDevice()
 	{
 		task_pool.stop();
-		kernel_globals_free(kg);
 	}
 
 	bool support_advanced_shading()
@@ -67,6 +74,8 @@ public:
 	void mem_alloc(device_memory& mem, MemoryType type)
 	{
 		mem.device_pointer = mem.data_pointer;
+
+		stats.mem_alloc(mem.memory_size());
 	}
 
 	void mem_copy_to(device_memory& mem)
@@ -87,28 +96,34 @@ public:
 	void mem_free(device_memory& mem)
 	{
 		mem.device_pointer = 0;
+
+		stats.mem_free(mem.memory_size());
 	}
 
 	void const_copy_to(const char *name, void *host, size_t size)
 	{
-		kernel_const_copy(kg, name, host, size);
+		kernel_const_copy(&kernel_globals, name, host, size);
 	}
 
 	void tex_alloc(const char *name, device_memory& mem, bool interpolation, bool periodic)
 	{
-		kernel_tex_copy(kg, name, mem.data_pointer, mem.data_width, mem.data_height);
+		kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height);
 		mem.device_pointer = mem.data_pointer;
+
+		stats.mem_alloc(mem.memory_size());
 	}
 
 	void tex_free(device_memory& mem)
 	{
 		mem.device_pointer = 0;
+
+		stats.mem_free(mem.memory_size());
 	}
 
 	void *osl_memory()
 	{
 #ifdef WITH_OSL
-		return kernel_osl_memory(kg);
+		return &osl_globals;
 #else
 		return NULL;
 #endif
@@ -135,12 +150,15 @@ public:
 
 	void thread_path_trace(DeviceTask& task)
 	{
-		if(task_pool.cancelled())
-			return;
+		if(task_pool.cancelled()) {
+			if(task.need_finish_queue == false)
+				return;
+		}
+
+		KernelGlobals kg = kernel_globals;
 
 #ifdef WITH_OSL
-		if(kernel_osl_use(kg))
-			OSLShader::thread_init(kg);
+		OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
 #endif
 
 		RenderTile tile;
@@ -154,12 +172,14 @@ public:
 #ifdef WITH_OPTIMIZED_KERNEL
 			if(system_cpu_support_optimized()) {
 				for(int sample = start_sample; sample < end_sample; sample++) {
-					if (task.get_cancel() || task_pool.cancelled())
-						break;
+					if (task.get_cancel() || task_pool.cancelled()) {
+						if(task.need_finish_queue == false)
+							break;
+					}
 
 					for(int y = tile.y; y < tile.y + tile.h; y++) {
 						for(int x = tile.x; x < tile.x + tile.w; x++) {
-							kernel_cpu_optimized_path_trace(kg, render_buffer, rng_state,
+							kernel_cpu_optimized_path_trace(&kg, render_buffer, rng_state,
 								sample, x, y, tile.offset, tile.stride);
 						}
 					}
@@ -173,12 +193,14 @@ public:
 #endif
 			{
 				for(int sample = start_sample; sample < end_sample; sample++) {
-					if (task.get_cancel() || task_pool.cancelled())
-						break;
+					if (task.get_cancel() || task_pool.cancelled()) {
+						if(task.need_finish_queue == false)
+							break;
+					}
 
 					for(int y = tile.y; y < tile.y + tile.h; y++) {
 						for(int x = tile.x; x < tile.x + tile.w; x++) {
-							kernel_cpu_path_trace(kg, render_buffer, rng_state,
+							kernel_cpu_path_trace(&kg, render_buffer, rng_state,
 								sample, x, y, tile.offset, tile.stride);
 						}
 					}
@@ -191,13 +213,14 @@ public:
 
 			task.release_tile(tile);
 
-			if(task_pool.cancelled())
-				break;
+			if(task_pool.cancelled()) {
+				if(task.need_finish_queue == false)
+					break;
+			}
 		}
 
 #ifdef WITH_OSL
-		if(kernel_osl_use(kg))
-			OSLShader::thread_free(kg);
+		OSLShader::thread_free(&kg);
 #endif
 	}
 
@@ -207,7 +230,7 @@ public:
 		if(system_cpu_support_optimized()) {
 			for(int y = task.y; y < task.y + task.h; y++)
 				for(int x = task.x; x < task.x + task.w; x++)
-					kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer,
+					kernel_cpu_optimized_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
 						task.sample, task.resolution, x, y, task.offset, task.stride);
 		}
 		else
@@ -215,22 +238,23 @@ public:
 		{
 			for(int y = task.y; y < task.y + task.h; y++)
 				for(int x = task.x; x < task.x + task.w; x++)
-					kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer,
+					kernel_cpu_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
 						task.sample, task.resolution, x, y, task.offset, task.stride);
 		}
 	}
 
 	void thread_shader(DeviceTask& task)
 	{
+		KernelGlobals kg = kernel_globals;
+
 #ifdef WITH_OSL
-		if(kernel_osl_use(kg))
-			OSLShader::thread_init(kg);
+		OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
 #endif
 
 #ifdef WITH_OPTIMIZED_KERNEL
 		if(system_cpu_support_optimized()) {
 			for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
-				kernel_cpu_optimized_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
+				kernel_cpu_optimized_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
 
 				if(task_pool.cancelled())
 					break;
@@ -240,7 +264,7 @@ public:
 #endif
 		{
 			for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
-				kernel_cpu_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
+				kernel_cpu_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
 
 				if(task_pool.cancelled())
 					break;
@@ -248,8 +272,7 @@ public:
 		}
 
 #ifdef WITH_OSL
-		if(kernel_osl_use(kg))
-			OSLShader::thread_free(kg);
+		OSLShader::thread_free(&kg);
 #endif
 	}
 
@@ -258,7 +281,7 @@ public:
 		/* split task into smaller ones, more than number of threads for uneven
 		 * workloads where some parts of the image render slower than others */
 		list<DeviceTask> tasks;
-		task.split(tasks, TaskScheduler::num_threads()+1);
+		task.split(tasks, TaskScheduler::num_threads());
 
 		foreach(DeviceTask& task, tasks)
 			task_pool.push(new CPUDeviceTask(this, task));
@@ -275,9 +298,9 @@ public:
 	}
 };
 
-Device *device_cpu_create(DeviceInfo& info, int threads)
+Device *device_cpu_create(DeviceInfo& info, Stats &stats)
 {
-	return new CPUDevice(threads);
+	return new CPUDevice(stats);
 }
 
 void device_cpu_info(vector<DeviceInfo>& devices)
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index c8dcfdc..14f8cfa 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -60,7 +60,7 @@ public:
 		return (CUdeviceptr)mem;
 	}
 
-	const char *cuda_error_string(CUresult result)
+	static const char *cuda_error_string(CUresult result)
 	{
 		switch(result) {
 			case CUDA_SUCCESS: return "No errors";
@@ -157,7 +157,7 @@ public:
 		cuda_assert(cuCtxSetCurrent(NULL));
 	}
 
-	CUDADevice(DeviceInfo& info, bool background_)
+	CUDADevice(DeviceInfo& info, Stats &stats, bool background_) : Device(stats)
 	{
 		background = background_;
 
@@ -316,8 +316,10 @@ public:
 	{
 		cuda_push_context();
 		CUdeviceptr device_pointer;
-		cuda_assert(cuMemAlloc(&device_pointer, mem.memory_size()))
+		size_t size = mem.memory_size();
+		cuda_assert(cuMemAlloc(&device_pointer, size))
 		mem.device_pointer = (device_ptr)device_pointer;
+		stats.mem_alloc(size);
 		cuda_pop_context();
 	}
 
@@ -356,6 +358,8 @@ public:
 			cuda_pop_context();
 
 			mem.device_pointer = 0;
+
+			stats.mem_free(mem.memory_size());
 		}
 	}
 
@@ -424,6 +428,8 @@ public:
 			cuda_assert(cuTexRefSetFlags(texref, CU_TRSF_NORMALIZED_COORDINATES))
 
 			mem.device_pointer = (device_ptr)handle;
+
+			stats.mem_alloc(size);
 		}
 		else {
 			cuda_pop_context();
@@ -463,6 +469,8 @@ public:
 
 				tex_interp_map.erase(tex_interp_map.find(mem.device_pointer));
 				mem.device_pointer = 0;
+
+				stats.mem_free(mem.memory_size());
 			}
 			else {
 				tex_interp_map.erase(tex_interp_map.find(mem.device_pointer));
@@ -707,6 +715,8 @@ public:
 				mem.device_pointer = pmem.cuTexId;
 				pixel_mem_map[mem.device_pointer] = pmem;
 
+				stats.mem_alloc(mem.memory_size());
+
 				return;
 			}
 			else {
@@ -762,6 +772,8 @@ public:
 				pixel_mem_map.erase(pixel_mem_map.find(mem.device_pointer));
 				mem.device_pointer = 0;
 
+				stats.mem_free(mem.memory_size());
+
 				return;
 			}
 
@@ -837,8 +849,10 @@ public:
 				int end_sample = tile.start_sample + tile.num_samples;
 
 				for(int sample = start_sample; sample < end_sample; sample++) {
-					if (task->get_cancel())
-						break;
+					if (task->get_cancel()) {
+						if(task->need_finish_queue == false)
+							break;
+					}
 
 					path_trace(tile, sample);
 
@@ -894,19 +908,28 @@ public:
 	}
 };
 
-Device *device_cuda_create(DeviceInfo& info, bool background)
+Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background)
 {
-	return new CUDADevice(info, background);
+	return new CUDADevice(info, stats, background);
 }
 
 void device_cuda_info(vector<DeviceInfo>& devices)
 {
+	CUresult result;
 	int count = 0;
 
-	if(cuInit(0) != CUDA_SUCCESS)
+	result = cuInit(0);
+	if(result != CUDA_SUCCESS) {
+		if(result != CUDA_ERROR_NO_DEVICE)
+			fprintf(stderr, "CUDA cuInit: %s\n", CUDADevice::cuda_error_string(result));
 		return;
-	if(cuDeviceGetCount(&count) != CUDA_SUCCESS)
+	}
+
+	result = cuDeviceGetCount(&count);
+	if(result != CUDA_SUCCESS) {
+		fprintf(stderr, "CUDA cuDeviceGetCount: %s\n", CUDADevice::cuda_error_string(result));
 		return;
+	}
 	
 	vector<DeviceInfo> display_devices;
 	
diff --git a/intern/cycles/device/device_intern.h b/intern/cycles/device/device_intern.h
index e3601aa..b49ebba 100644
--- a/intern/cycles/device/device_intern.h
+++ b/intern/cycles/device/device_intern.h
@@ -23,11 +23,11 @@ CCL_NAMESPACE_BEGIN
 
 class Device;
 
-Device *device_cpu_create(DeviceInfo& info, int threads);
-Device *device_opencl_create(DeviceInfo& info, bool background);
-Device *device_cuda_create(DeviceInfo& info, bool background);
-Device *device_network_create(DeviceInfo& info, const char *address);
-Device *device_multi_create(DeviceInfo& info, bool background);
+Device *device_cpu_create(DeviceInfo& info, Stats &stats);
+Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background);
+Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background);
+Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address);
+Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background);
 
 void device_cpu_info(vector<DeviceInfo>& devices);
 void device_opencl_info(vector<DeviceInfo>& devices);
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 546ffe5..807bfe5 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -46,14 +46,14 @@ public:
 	list<SubDevice> devices;
 	device_ptr unique_ptr;
 
-	MultiDevice(DeviceInfo& info, bool background_)
-	: unique_ptr(1)
+	MultiDevice(DeviceInfo& info, Stats &stats, bool background_)
+	: Device(stats), unique_ptr(1)
 	{
 		Device *device;
 		background = background_;
 
 		foreach(DeviceInfo& subinfo, info.multi_devices) {
-			device = Device::create(subinfo, background);
+			device = Device::create(subinfo, stats, background);
 			devices.push_back(SubDevice(device));
 		}
 
@@ -314,9 +314,9 @@ public:
 	}
 };
 
-Device *device_multi_create(DeviceInfo& info, bool background)
+Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background)
 {
-	return new MultiDevice(info, background);
+	return new MultiDevice(info, stats, background);
 }
 
 static bool device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool with_display, bool with_advanced_shading, const char *id_fmt, int num)
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp
index 931890b..a5e0d39 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -32,8 +32,8 @@ public:
 	boost::asio::io_service io_service;
 	tcp::socket socket;
 
-	NetworkDevice(const char *address)
-	: socket(io_service)
+	NetworkDevice(Stats &stats, const char *address)
+	: Device(stats), socket(io_service)
 	{
 		stringstream portstr;
 		portstr << SERVER_PORT;
@@ -202,9 +202,9 @@ public:
 	}
 };
 
-Device *device_network_create(DeviceInfo& info, const char *address)
+Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address)
 {
-	return new NetworkDevice(address);
+	return new NetworkDevice(stats, address);
 }
 
 void device_network_info(vector<DeviceInfo>& devices)
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 673ffdf..69287f1 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -144,7 +144,8 @@ public:
 		}
 	}
 
-	OpenCLDevice(DeviceInfo& info, bool background_)
+	OpenCLDevice(DeviceInfo& info, Stats &stats, bool background_)
+	  : Device(stats)
 	{
 		background = background_;
 		cpPlatform = NULL;
@@ -473,6 +474,8 @@ public:
 			mem.device_pointer = (device_ptr)clCreateBuffer(cxContext, CL_MEM_READ_WRITE, size, NULL, &ciErr);
 
 		opencl_assert(ciErr);
+
+		stats.mem_alloc(size);
 	}
 
 	void mem_copy_to(device_memory& mem)
@@ -506,6 +509,8 @@ public:
 			ciErr = clReleaseMemObject(CL_MEM_PTR(mem.device_pointer));
 			mem.device_pointer = 0;
 			opencl_assert(ciErr);
+
+			stats.mem_free(mem.memory_size());
 		}
 	}
 
@@ -686,8 +691,10 @@ public:
 				int end_sample = tile.start_sample + tile.num_samples;
 
 				for(int sample = start_sample; sample < end_sample; sample++) {
-					if (task->get_cancel())
-						break;
+					if (task->get_cancel()) {
+						if(task->need_finish_queue == false)
+							break;
+					}
 
 					path_trace(tile, sample);
 
@@ -726,9 +733,9 @@ public:
 	}
 };
 
-Device *device_opencl_create(DeviceInfo& info, bool background)
+Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
 {
-	return new OpenCLDevice(info, background);
+	return new OpenCLDevice(info, stats, background);
 }
 
 void device_opencl_info(vector<DeviceInfo>& devices)
diff --git a/intern/cycles/device/device_task.cpp b/intern/cycles/device/device_task.cpp
index c85e182..b3f02de 100644
--- a/intern/cycles/device/device_task.cpp
+++ b/intern/cycles/device/device_task.cpp
@@ -101,7 +101,7 @@ void DeviceTask::update_progress(RenderTile &rtile)
 	if(update_tile_sample) {
 		double current_time = time_dt();
 
-		if (current_time - last_update_time >= 1.0f) {
+		if (current_time - last_update_time >= 1.0) {
 			update_tile_sample(rtile);
 
 			last_update_time = current_time;
diff --git a/intern/cycles/device/device_task.h b/intern/cycles/device/device_task.h
index cfb3d8d..8ca8b88 100644
--- a/intern/cycles/device/device_task.h
+++ b/intern/cycles/device/device_task.h
@@ -65,6 +65,7 @@ public:
 	boost::function<void(RenderTile&)> release_tile;
 	boost::function<bool(void)> get_cancel;
 
+	bool need_finish_queue;
 protected:
 	double last_update_time;
 };
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index df8a9b1..5a57032 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -5,7 +5,9 @@ set(INC
 	osl
 	svm
 )
+
 set(INC_SYS
+
 )
 
 set(SRC
@@ -31,13 +33,11 @@ set(SRC_HEADERS
 	kernel_globals.h
 	kernel_light.h
 	kernel_math.h
-	kernel_mbvh.h
 	kernel_montecarlo.h
 	kernel_object.h
 	kernel_passes.h
 	kernel_path.h
 	kernel_projection.h
-	kernel_qbvh.h
 	kernel_random.h
 	kernel_shader.h
 	kernel_textures.h
@@ -45,18 +45,22 @@ set(SRC_HEADERS
 	kernel_types.h
 )
 
+set(SRC_CLOSURE_HEADERS
+	closure/bsdf.h
+	closure/bsdf_ashikhmin_velvet.h
+	closure/bsdf_diffuse.h
+	closure/bsdf_microfacet.h
+	closure/bsdf_oren_nayar.h
+	closure/bsdf_phong_ramp.h
+	closure/bsdf_reflection.h
+	closure/bsdf_refraction.h
+	closure/bsdf_transparent.h
+	closure/bsdf_ward.h
+	closure/bsdf_westin.h
+	closure/emissive.h
+	closure/volume.h
+)
 set(SRC_SVM_HEADERS
-	svm/bsdf.h
-	svm/bsdf_ashikhmin_velvet.h
-	svm/bsdf_diffuse.h
-	svm/bsdf_oren_nayar.h
-	svm/bsdf_microfacet.h
-	svm/bsdf_reflection.h
-	svm/bsdf_refraction.h
-	svm/bsdf_transparent.h
-	svm/bsdf_ward.h
-	svm/bsdf_westin.h
-	svm/emissive.h
 	svm/svm.h
 	svm/svm_attribute.h
 	svm/svm_bsdf.h
@@ -92,7 +96,6 @@ set(SRC_SVM_HEADERS
 	svm/svm_value.h
 	svm/svm_voronoi.h
 	svm/svm_wave.h
-	svm/volume.h
 )
 
 set(SRC_UTIL_HEADERS
@@ -110,7 +113,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
 		set(CUDA_BITS 32)
 	endif()
 
-	set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_UTIL_HEADERS})
+	set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
 	set(cuda_cubins)
 
 	foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
@@ -132,6 +135,7 @@ endif()
 
 if(WITH_CYCLES_OSL)
 	add_subdirectory(osl)
+	add_subdirectory(shaders)
 endif()
 
 # CPU module
@@ -139,7 +143,7 @@ endif()
 include_directories(${INC})
 include_directories(SYSTEM ${INC_SYS})
 
-add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS})
+add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS})
 
 if(WITH_CYCLES_OPTIMIZED_KERNEL)
 	set_source_files_properties(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_OPTIMIZED_KERNEL_FLAGS}")
@@ -162,6 +166,7 @@ endif()
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/kernel)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
+delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/closure)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
 
diff --git a/intern/cycles/kernel/SConscript b/intern/cycles/kernel/SConscript
index 1489016..730f758 100644
--- a/intern/cycles/kernel/SConscript
+++ b/intern/cycles/kernel/SConscript
@@ -32,16 +32,17 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
     kernel_file = os.path.join(source_dir, "kernel.cu")
     util_dir = os.path.join(source_dir, "../util")
     svm_dir = os.path.join(source_dir, "../svm")
+    closure_dir = os.path.join(source_dir, "../closure")
 
     # nvcc flags
     nvcc_flags = "-m%s" % (bits)
     nvcc_flags += " --cubin --ptxas-options=\"-v\" --maxrregcount=24"
     nvcc_flags += " --opencc-options -OPT:Olimit=0"
     nvcc_flags += " -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC"
-    nvcc_flags += " -I \"%s\" -I \"%s\"" % (util_dir, svm_dir)
+    nvcc_flags += " -I \"%s\" -I \"%s\" -I \"%s\"" % (util_dir, svm_dir, closure_dir)
 
     # dependencies
-    dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h')
+    dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('closure/*.h')
     last_cubin_file = None
 
     # add command for each cuda architecture
diff --git a/intern/cycles/kernel/svm/bsdf.h b/intern/cycles/kernel/closure/bsdf.h
similarity index 100%
rename from intern/cycles/kernel/svm/bsdf.h
rename to intern/cycles/kernel/closure/bsdf.h
diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
new file mode 100644
index 0000000..016fd73
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
@@ -0,0 +1,153 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_ASHIKHMIN_VELVET_H__
+#define __BSDF_ASHIKHMIN_VELVET_H__
+
+CCL_NAMESPACE_BEGIN
+
+__device int bsdf_ashikhmin_velvet_setup(ShaderClosure *sc)
+{
+	float sigma = sc->data0;
+	sigma = fmaxf(sigma, 0.01f);
+
+	float m_invsigma2 = 1.0f/(sigma * sigma);
+
+	sc->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
+	sc->data0 = m_invsigma2;
+
+	return SD_BSDF|SD_BSDF_HAS_EVAL;
+}
+
+__device void bsdf_ashikhmin_velvet_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_invsigma2 = sc->data0;
+	float3 N = sc->N;
+
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO > 0 && cosNI > 0) {
+		float3 H = normalize(omega_in + I);
+
+		float cosNH = dot(N, H);
+		float cosHO = fabsf(dot(I, H));
+
+		if(!(fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f))
+			return make_float3(0, 0, 0);
+
+		float cosNHdivHO = cosNH / cosHO;
+		cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
+
+		float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
+		float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
+
+		float sinNH2 = 1 - cosNH * cosNH;
+		float sinNH4 = sinNH2 * sinNH2;
+		float cotangent2 = (cosNH * cosNH) / sinNH2;
+
+		float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
+		float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
+
+		float out = 0.25f * (D * G) / cosNO;
+
+		*pdf = 0.5f * M_1_PI_F;
+		return make_float3(out, out, out);
+	}
+
+	return make_float3(0, 0, 0);
+}
+
+__device float3 bsdf_ashikhmin_velvet_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_invsigma2 = sc->data0;
+	float3 N = sc->N;
+
+	// we are viewing the surface from above - send a ray out with uniform
+	// distribution over the hemisphere
+	sample_uniform_hemisphere(N, randu, randv, omega_in, pdf);
+
+	if(dot(Ng, *omega_in) > 0) {
+		float3 H = normalize(*omega_in + I);
+
+		float cosNI = dot(N, *omega_in);
+		float cosNO = dot(N, I);
+		float cosNH = dot(N, H);
+		float cosHO = fabsf(dot(I, H));
+
+		if(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f) {
+			float cosNHdivHO = cosNH / cosHO;
+			cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
+
+			float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
+			float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
+
+			float sinNH2 = 1 - cosNH * cosNH;
+			float sinNH4 = sinNH2 * sinNH2;
+			float cotangent2 =  (cosNH * cosNH) / sinNH2;
+
+			float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
+			float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
+
+			float power = 0.25f * (D * G) / cosNO;
+
+			*eval = make_float3(power, power, power);
+
+#ifdef __RAY_DIFFERENTIALS__
+			// TODO: find a better approximation for the retroreflective bounce
+			*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
+			*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
+			*domega_in_dx *= 125.0f;
+			*domega_in_dy *= 125.0f;
+#endif
+		}
+		else
+			*pdf = 0.0f;
+	}
+	else
+		*pdf = 0.0f;
+
+	return LABEL_REFLECT|LABEL_DIFFUSE;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_diffuse.h b/intern/cycles/kernel/closure/bsdf_diffuse.h
new file mode 100644
index 0000000..88b40e3
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_diffuse.h
@@ -0,0 +1,144 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_DIFFUSE_H__
+#define __BSDF_DIFFUSE_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* DIFFUSE */
+
+__device int bsdf_diffuse_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_DIFFUSE_ID;
+	return SD_BSDF|SD_BSDF_HAS_EVAL;
+}
+
+__device void bsdf_diffuse_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float3 N = sc->N;
+
+	float cos_pi = fmaxf(dot(N, omega_in), 0.0f) * M_1_PI_F;
+	*pdf = cos_pi;
+	return make_float3(cos_pi, cos_pi, cos_pi);
+}
+
+__device float3 bsdf_diffuse_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_diffuse_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float3 N = sc->N;
+
+	// distribution over the hemisphere
+	sample_cos_hemisphere(N, randu, randv, omega_in, pdf);
+
+	if(dot(Ng, *omega_in) > 0.0f) {
+		*eval = make_float3(*pdf, *pdf, *pdf);
+#ifdef __RAY_DIFFERENTIALS__
+		// TODO: find a better approximation for the diffuse bounce
+		*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
+		*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
+		*domega_in_dx *= 125.0f;
+		*domega_in_dy *= 125.0f;
+#endif
+	}
+	else
+		*pdf = 0.0f;
+	
+	return LABEL_REFLECT|LABEL_DIFFUSE;
+}
+
+/* TRANSLUCENT */
+
+__device int bsdf_translucent_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_TRANSLUCENT_ID;
+	return SD_BSDF|SD_BSDF_HAS_EVAL;
+}
+
+__device void bsdf_translucent_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_translucent_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device float3 bsdf_translucent_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float3 N = sc->N;
+
+	float cos_pi = fmaxf(-dot(N, omega_in), 0.0f) * M_1_PI_F;
+	*pdf = cos_pi;
+	return make_float3 (cos_pi, cos_pi, cos_pi);
+}
+
+__device float bsdf_translucent_albedo(const ShaderClosure *sc, const float3 I)
+{
+	return 1.0f;
+}
+
+__device int bsdf_translucent_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float3 N = sc->N;
+
+	// we are viewing the surface from the right side - send a ray out with cosine
+	// distribution over the hemisphere
+	sample_cos_hemisphere (-N, randu, randv, omega_in, pdf);
+	if(dot(Ng, *omega_in) < 0) {
+		*eval = make_float3(*pdf, *pdf, *pdf);
+#ifdef __RAY_DIFFERENTIALS__
+		// TODO: find a better approximation for the diffuse bounce
+		*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
+		*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
+		*domega_in_dx *= -125.0f;
+		*domega_in_dy *= -125.0f;
+#endif
+	}
+	else {
+		*pdf = 0;
+	}
+	return LABEL_TRANSMIT|LABEL_DIFFUSE;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_DIFFUSE_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h
new file mode 100644
index 0000000..a564b99
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -0,0 +1,506 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_MICROFACET_H__
+#define __BSDF_MICROFACET_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* GGX */
+
+__device_inline float safe_sqrtf(float f)
+{
+	return sqrtf(max(f, 0.0f));
+}
+
+__device int bsdf_microfacet_ggx_setup(ShaderClosure *sc)
+{
+	float ag = sc->data0;
+
+	float m_ag = clamp(ag, 1e-4f, 1.0f);
+
+	sc->data0 = m_ag;
+	sc->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
+
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device int bsdf_microfacet_ggx_refraction_setup(ShaderClosure *sc)
+{
+	float ag = sc->data0;
+	float eta = sc->data1;
+
+	float m_ag = clamp(ag, 1e-4f, 1.0f);
+	float m_eta = eta;
+
+	sc->data0 = m_ag;
+	sc->data1 = m_eta;
+	sc->type = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
+
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_microfacet_ggx_blur(ShaderClosure *sc, float roughness)
+{
+	float m_ag = sc->data0;
+	m_ag = fmaxf(roughness, m_ag);
+	sc->data0 = m_ag;
+}
+
+__device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_ag = sc->data0;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
+	float3 N = sc->N;
+
+	if(m_refractive) return make_float3 (0, 0, 0);
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNI > 0 && cosNO > 0) {
+		// get half vector
+		float3 Hr = normalize(omega_in + I);
+		// eq. 20: (F*G*D)/(4*in*on)
+		// eq. 33: first we calculate D(m) with m=Hr:
+		float alpha2 = m_ag * m_ag;
+		float cosThetaM = dot(N, Hr);
+		float cosThetaM2 = cosThetaM * cosThetaM;
+		float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
+		float cosThetaM4 = cosThetaM2 * cosThetaM2;
+		float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+		// eq. 34: now calculate G1(i,m) and G1(o,m)
+		float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
+		float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+		float G = G1o * G1i;
+		float out = (G * D) * 0.25f / cosNO;
+		// eq. 24
+		float pm = D * cosThetaM;
+		// convert into pdf of the sampled direction
+		// eq. 38 - but see also:
+		// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
+		*pdf = pm * 0.25f / dot(Hr, I);
+		return make_float3 (out, out, out);
+	}
+	return make_float3 (0, 0, 0);
+}
+
+__device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_ag = sc->data0;
+	float m_eta = sc->data1;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
+	float3 N = sc->N;
+
+	if(!m_refractive) return make_float3 (0, 0, 0);
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO <= 0 || cosNI >= 0)
+		return make_float3 (0, 0, 0); // vectors on same side -- not possible
+	// compute half-vector of the refraction (eq. 16)
+	float3 ht = -(m_eta * omega_in + I);
+	float3 Ht = normalize(ht);
+	float cosHO = dot(Ht, I);
+
+	float cosHI = dot(Ht, omega_in);
+	// eq. 33: first we calculate D(m) with m=Ht:
+	float alpha2 = m_ag * m_ag;
+	float cosThetaM = dot(N, Ht);
+	float cosThetaM2 = cosThetaM * cosThetaM;
+	float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
+	float cosThetaM4 = cosThetaM2 * cosThetaM2;
+	float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+	// eq. 34: now calculate G1(i,m) and G1(o,m)
+	float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
+	float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+	float G = G1o * G1i;
+	// probability
+	float invHt2 = 1 / dot(ht, ht);
+	*pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
+	float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
+	return make_float3 (out, out, out);
+}
+
+__device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_ag = sc->data0;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
+	float3 N = sc->N;
+
+	float cosNO = dot(N, I);
+	if(cosNO > 0) {
+		float3 X, Y, Z = N;
+		make_orthonormals(Z, &X, &Y);
+		// generate a random microfacet normal m
+		// eq. 35,36:
+		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
+		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
+		float alpha2 = m_ag * m_ag;
+		float tanThetaM2 = alpha2 * randu / (1 - randu);
+		float cosThetaM  = 1 / safe_sqrtf(1 + tanThetaM2);
+		float sinThetaM  = cosThetaM * safe_sqrtf(tanThetaM2);
+		float phiM = 2 * M_PI_F * randv;
+		float3 m = (cosf(phiM) * sinThetaM) * X +
+				 (sinf(phiM) * sinThetaM) * Y +
+							   cosThetaM  * Z;
+		if(!m_refractive) {
+			float cosMO = dot(m, I);
+			if(cosMO > 0) {
+				// eq. 39 - compute actual reflected direction
+				*omega_in = 2 * cosMO * m - I;
+				if(dot(Ng, *omega_in) > 0) {
+					// microfacet normal is visible to this ray
+					// eq. 33
+					float cosThetaM2 = cosThetaM * cosThetaM;
+					float cosThetaM4 = cosThetaM2 * cosThetaM2;
+					float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+					// eq. 24
+					float pm = D * cosThetaM;
+					// convert into pdf of the sampled direction
+					// eq. 38 - but see also:
+					// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
+					*pdf = pm * 0.25f / cosMO;
+					// eval BRDF*cosNI
+					float cosNI = dot(N, *omega_in);
+					// eq. 34: now calculate G1(i,m) and G1(o,m)
+					float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
+					float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+					float G = G1o * G1i;
+					// eq. 20: (F*G*D)/(4*in*on)
+					float out = (G * D) * 0.25f / cosNO;
+					*eval = make_float3(out, out, out);
+#ifdef __RAY_DIFFERENTIALS__
+					*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
+					*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
+					// Since there is some blur to this reflection, make the
+					// derivatives a bit bigger. In theory this varies with the
+					// roughness but the exact relationship is complex and
+					// requires more ops than are practical.
+					*domega_in_dx *= 10.0f;
+					*domega_in_dy *= 10.0f;
+#endif
+				}
+			}
+		}
+		else {
+			// CAUTION: the i and o variables are inverted relative to the paper
+			// eq. 39 - compute actual refractive direction
+			float3 R, T;
+#ifdef __RAY_DIFFERENTIALS__
+			float3 dRdx, dRdy, dTdx, dTdy;
+#endif
+			float m_eta = sc->data1;
+			bool inside;
+			fresnel_dielectric(m_eta, m, I, &R, &T,
+#ifdef __RAY_DIFFERENTIALS__
+				dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy,
+#endif
+				&inside);
+			
+			if(!inside) {
+				*omega_in = T;
+#ifdef __RAY_DIFFERENTIALS__
+				*domega_in_dx = dTdx;
+				*domega_in_dy = dTdy;
+#endif
+				// eq. 33
+				float cosThetaM2 = cosThetaM * cosThetaM;
+				float cosThetaM4 = cosThetaM2 * cosThetaM2;
+				float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+				// eq. 24
+				float pm = D * cosThetaM;
+				// eval BRDF*cosNI
+				float cosNI = dot(N, *omega_in);
+				// eq. 34: now calculate G1(i,m) and G1(o,m)
+				float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
+				float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+				float G = G1o * G1i;
+				// eq. 21
+				float cosHI = dot(m, *omega_in);
+				float cosHO = dot(m, I);
+				float Ht2 = m_eta * cosHI + cosHO;
+				Ht2 *= Ht2;
+				float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
+				// eq. 38 and eq. 17
+				*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
+				*eval = make_float3(out, out, out);
+#ifdef __RAY_DIFFERENTIALS__
+				// Since there is some blur to this refraction, make the
+				// derivatives a bit bigger. In theory this varies with the
+				// roughness but the exact relationship is complex and
+				// requires more ops than are practical.
+				*domega_in_dx *= 10.0f;
+				*domega_in_dy *= 10.0f;
+#endif
+			}
+		}
+	}
+	return (m_refractive) ? LABEL_TRANSMIT|LABEL_GLOSSY : LABEL_REFLECT|LABEL_GLOSSY;
+}
+
+/* BECKMANN */
+
+__device int bsdf_microfacet_beckmann_setup(ShaderClosure *sc)
+{
+	float ab = sc->data0;
+	float m_ab = clamp(ab, 1e-4f, 1.0f);
+
+	sc->data0 = m_ab;
+
+	sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device int bsdf_microfacet_beckmann_refraction_setup(ShaderClosure *sc)
+{
+	float ab = sc->data0;
+	float eta = sc->data1;
+	float m_ab = clamp(ab, 1e-4f, 1.0f);
+	float m_eta = eta;
+
+	sc->data0 = m_ab;
+	sc->data1 = m_eta;
+
+	sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_microfacet_beckmann_blur(ShaderClosure *sc, float roughness)
+{
+	float m_ab = sc->data0;
+	m_ab = fmaxf(roughness, m_ab);
+	sc->data0 = m_ab;
+}
+
+__device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_ab = sc->data0;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
+	float3 N = sc->N;
+
+	if(m_refractive) return make_float3 (0, 0, 0);
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO > 0 && cosNI > 0) {
+	   // get half vector
+	   float3 Hr = normalize(omega_in + I);
+	   // eq. 20: (F*G*D)/(4*in*on)
+	   // eq. 25: first we calculate D(m) with m=Hr:
+	   float alpha2 = m_ab * m_ab;
+	   float cosThetaM = dot(N, Hr);
+	   float cosThetaM2 = cosThetaM * cosThetaM;
+	   float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
+	   float cosThetaM4 = cosThetaM2 * cosThetaM2;
+	   float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
+	   // eq. 26, 27: now calculate G1(i,m) and G1(o,m)
+	   float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
+	   float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+	   float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
+	   float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
+	   float G = G1o * G1i;
+	   float out = (G * D) * 0.25f / cosNO;
+	   // eq. 24
+	   float pm = D * cosThetaM;
+	   // convert into pdf of the sampled direction
+	   // eq. 38 - but see also:
+	   // eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
+	   *pdf = pm * 0.25f / dot(Hr, I);
+	   return make_float3 (out, out, out);
+	}
+	return make_float3 (0, 0, 0);
+}
+
+__device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_ab = sc->data0;
+	float m_eta = sc->data1;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
+	float3 N = sc->N;
+
+	if(!m_refractive) return make_float3 (0, 0, 0);
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO <= 0 || cosNI >= 0)
+		return make_float3 (0, 0, 0);
+	// compute half-vector of the refraction (eq. 16)
+	float3 ht = -(m_eta * omega_in + I);
+	float3 Ht = normalize(ht);
+	float cosHO = dot(Ht, I);
+
+	float cosHI = dot(Ht, omega_in);
+	// eq. 33: first we calculate D(m) with m=Ht:
+	float alpha2 = m_ab * m_ab;
+	float cosThetaM = dot(N, Ht);
+	float cosThetaM2 = cosThetaM * cosThetaM;
+	float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
+	float cosThetaM4 = cosThetaM2 * cosThetaM2;
+	float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
+	// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
+	float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
+	float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+	float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
+	float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
+	float G = G1o * G1i;
+	// probability
+	float invHt2 = 1 / dot(ht, ht);
+	*pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
+	float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
+	return make_float3 (out, out, out);
+}
+
+__device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_ab = sc->data0;
+	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
+	float3 N = sc->N;
+
+	float cosNO = dot(N, I);
+	if(cosNO > 0) {
+		float3 X, Y, Z = N;
+		make_orthonormals(Z, &X, &Y);
+		// generate a random microfacet normal m
+		// eq. 35,36:
+		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
+		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
+		float alpha2 = m_ab * m_ab;
+		float tanThetaM = safe_sqrtf(-alpha2 * logf(1 - randu));
+		float cosThetaM = 1 / safe_sqrtf(1 + tanThetaM * tanThetaM);
+		float sinThetaM = cosThetaM * tanThetaM;
+		float phiM = 2 * M_PI_F * randv;
+		float3 m = (cosf(phiM) * sinThetaM) * X +
+				 (sinf(phiM) * sinThetaM) * Y +
+							   cosThetaM  * Z;
+
+		if(!m_refractive) {
+			float cosMO = dot(m, I);
+			if(cosMO > 0) {
+				// eq. 39 - compute actual reflected direction
+				*omega_in = 2 * cosMO * m - I;
+				if(dot(Ng, *omega_in) > 0) {
+					// microfacet normal is visible to this ray
+					// eq. 25
+					float cosThetaM2 = cosThetaM * cosThetaM;
+					float tanThetaM2 = tanThetaM * tanThetaM;
+					float cosThetaM4 = cosThetaM2 * cosThetaM2;
+					float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
+					// eq. 24
+					float pm = D * cosThetaM;
+					// convert into pdf of the sampled direction
+					// eq. 38 - but see also:
+					// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
+					*pdf = pm * 0.25f / cosMO;
+					// Eval BRDF*cosNI
+					float cosNI = dot(N, *omega_in);
+					// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
+					float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
+					float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+					float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
+					float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
+					float G = G1o * G1i;
+					// eq. 20: (F*G*D)/(4*in*on)
+					float out = (G * D) * 0.25f / cosNO;
+					*eval = make_float3(out, out, out);
+#ifdef __RAY_DIFFERENTIALS__
+					*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
+					*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
+					// Since there is some blur to this reflection, make the
+					// derivatives a bit bigger. In theory this varies with the
+					// roughness but the exact relationship is complex and
+					// requires more ops than are practical.
+					*domega_in_dx *= 10.0f;
+					*domega_in_dy *= 10.0f;
+#endif
+				}
+			}
+		}
+		else {
+			// CAUTION: the i and o variables are inverted relative to the paper
+			// eq. 39 - compute actual refractive direction
+			float3 R, T;
+#ifdef __RAY_DIFFERENTIALS__
+			float3 dRdx, dRdy, dTdx, dTdy;
+#endif
+			float m_eta = sc->data1;
+			bool inside;
+			fresnel_dielectric(m_eta, m, I, &R, &T,
+#ifdef __RAY_DIFFERENTIALS__
+				dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy,
+#endif
+				&inside);
+
+			if(!inside) {
+				*omega_in = T;
+#ifdef __RAY_DIFFERENTIALS__
+				*domega_in_dx = dTdx;
+				*domega_in_dy = dTdy;
+#endif
+
+				// eq. 33
+				float cosThetaM2 = cosThetaM * cosThetaM;
+				float tanThetaM2 = tanThetaM * tanThetaM;
+				float cosThetaM4 = cosThetaM2 * cosThetaM2;
+				float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
+				// eq. 24
+				float pm = D * cosThetaM;
+				// eval BRDF*cosNI
+				float cosNI = dot(N, *omega_in);
+				// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
+				float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
+				float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+				float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
+				float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
+				float G = G1o * G1i;
+				// eq. 21
+				float cosHI = dot(m, *omega_in);
+				float cosHO = dot(m, I);
+				float Ht2 = m_eta * cosHI + cosHO;
+				Ht2 *= Ht2;
+				float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
+				// eq. 38 and eq. 17
+				*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
+				*eval = make_float3(out, out, out);
+#ifdef __RAY_DIFFERENTIALS__
+				// Since there is some blur to this refraction, make the
+				// derivatives a bit bigger. In theory this varies with the
+				// roughness but the exact relationship is complex and
+				// requires more ops than are practical.
+				*domega_in_dx *= 10.0f;
+				*domega_in_dy *= 10.0f;
+#endif
+			}
+		}
+	}
+	return (m_refractive) ? LABEL_TRANSMIT|LABEL_GLOSSY : LABEL_REFLECT|LABEL_GLOSSY;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_MICROFACET_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_oren_nayar.h b/intern/cycles/kernel/closure/bsdf_oren_nayar.h
new file mode 100644
index 0000000..066937d
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_oren_nayar.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __BSDF_OREN_NAYAR_H__
+#define __BSDF_OREN_NAYAR_H__
+
+CCL_NAMESPACE_BEGIN
+
+__device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n, float3 v, float3 l)
+{
+	float nl = max(dot(n, l), 0.0f);
+	float nv = max(dot(n, v), 0.0f);
+	float t = dot(l, v) - nl * nv;
+
+	if (t > 0.0f)
+		t /= max(nl, nv) + FLT_MIN;
+	float is = nl * (sc->data0 + sc->data1 * t);
+	return make_float3(is, is, is);
+}
+
+__device int bsdf_oren_nayar_setup(ShaderClosure *sc)
+{
+	float sigma = sc->data0;
+
+	sc->type = CLOSURE_BSDF_OREN_NAYAR_ID;
+
+	sigma = clamp(sigma, 0.0f, 1.0f);
+
+	float div = 1.0f / (M_PI_F + ((3.0f * M_PI_F - 4.0f) / 6.0f) * sigma);
+
+	sc->data0 = 1.0f * div;
+	sc->data1 = sigma * div;
+
+	return SD_BSDF | SD_BSDF_HAS_EVAL;
+}
+
+__device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_oren_nayar_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	if (dot(sc->N, omega_in) > 0.0f) {
+		*pdf = 0.5f * M_1_PI_F;
+		return bsdf_oren_nayar_get_intensity(sc, sc->N, I, omega_in);
+	}
+	else {
+		*pdf = 0.0f;
+		return make_float3(0.0f, 0.0f, 0.0f);
+	}
+}
+
+__device float3 bsdf_oren_nayar_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_oren_nayar_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	sample_uniform_hemisphere(sc->N, randu, randv, omega_in, pdf);
+
+	if (dot(Ng, *omega_in) > 0.0f) {
+		*eval = bsdf_oren_nayar_get_intensity(sc, sc->N, I, *omega_in);
+
+#ifdef __RAY_DIFFERENTIALS__
+		// TODO: find a better approximation for the bounce
+		*domega_in_dx = (2.0f * dot(sc->N, dIdx)) * sc->N - dIdx;
+		*domega_in_dy = (2.0f * dot(sc->N, dIdy)) * sc->N - dIdy;
+		*domega_in_dx *= 125.0f;
+		*domega_in_dy *= 125.0f;
+#endif
+	}
+	else {
+		*pdf = 0.0f;
+		*eval = make_float3(0.0f, 0.0f, 0.0f);
+	}
+
+	return LABEL_REFLECT | LABEL_DIFFUSE;
+}
+
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_OREN_NAYAR_H__ */
diff --git a/intern/cycles/kernel/closure/bsdf_phong_ramp.h b/intern/cycles/kernel/closure/bsdf_phong_ramp.h
new file mode 100644
index 0000000..575a798
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_phong_ramp.h
@@ -0,0 +1,140 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2012, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_PHONG_RAMP_H__
+#define __BSDF_PHONG_RAMP_H__
+
+CCL_NAMESPACE_BEGIN
+
+__device float3 bsdf_phong_ramp_get_color(const ShaderClosure *sc, const float3 colors[8], float pos)
+{
+	int MAXCOLORS = 8;
+	
+	float npos = pos * (float)(MAXCOLORS - 1);
+	int ipos = (int)npos;
+	if (ipos >= (MAXCOLORS - 1))
+		return colors[MAXCOLORS - 1];
+	float offset = npos - (float)ipos;
+	return colors[ipos] * (1.0f - offset) + colors[ipos+1] * offset;
+}
+
+__device int bsdf_phong_ramp_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_PHONG_RAMP_ID;
+	return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_phong_ramp_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_phong_ramp_eval_reflect(const ShaderClosure *sc, const float3 colors[8], const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_exponent = sc->data0;
+	float cosNI = dot(sc->N, omega_in);
+	float cosNO = dot(sc->N, I);
+	
+	if (cosNI > 0 && cosNO > 0) {
+		// reflect the view vector
+		float3 R = (2 * cosNO) * sc->N - I;
+		float cosRI = dot(R, omega_in);
+		if (cosRI > 0) {
+			float cosp = powf(cosRI, m_exponent);
+			float common = 0.5f * (float) M_1_PI_F * cosp;
+			float out = cosNI * (m_exponent + 2) * common;
+			*pdf = (m_exponent + 1) * common;
+			return bsdf_phong_ramp_get_color(sc, colors, cosp) * out;
+		}
+	}
+	
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device float3 bsdf_phong_ramp_eval_transmit(const ShaderClosure *sc, const float3 colors[8], const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_phong_ramp_sample(const ShaderClosure *sc, const float3 colors[8], float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float cosNO = dot(sc->N, I);
+	float m_exponent = sc->data0;
+	
+	if (cosNO > 0) {
+		// reflect the view vector
+		float3 R = (2 * cosNO) * sc->N - I;
+
+#ifdef __RAY_DIFFERENTIALS__
+		*domega_in_dx = (2 * dot(sc->N, dIdx)) * sc->N - dIdx;
+		*domega_in_dy = (2 * dot(sc->N, dIdy)) * sc->N - dIdy;
+#endif
+		
+		float3 T, B;
+		make_orthonormals (R, &T, &B);
+		float phi = 2 * M_PI_F * randu;
+		float cosTheta = powf(randv, 1 / (m_exponent + 1));
+		float sinTheta2 = 1 - cosTheta * cosTheta;
+		float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
+		*omega_in = (cosf(phi) * sinTheta) * T +
+				   (sinf(phi) * sinTheta) * B +
+				   (            cosTheta) * R;
+		if (dot(Ng, *omega_in) > 0.0f)
+		{
+			// common terms for pdf and eval
+			float cosNI = dot(sc->N, *omega_in);
+			// make sure the direction we chose is still in the right hemisphere
+			if (cosNI > 0)
+			{
+				float cosp = powf(cosTheta, m_exponent);
+				float common = 0.5f * M_1_PI_F * cosp;
+				*pdf = (m_exponent + 1) * common;
+				float out = cosNI * (m_exponent + 2) * common;
+				*eval = bsdf_phong_ramp_get_color(sc, colors, cosp) * out;
+				
+#ifdef __RAY_DIFFERENTIALS__
+				// Since there is some blur to this reflection, make the
+				// derivatives a bit bigger. In theory this varies with the
+				// exponent but the exact relationship is complex and
+				// requires more ops than are practical.
+				*domega_in_dx *= 10;
+				*domega_in_dy *= 10;
+#endif
+			}
+		}
+	}
+	return LABEL_REFLECT|LABEL_GLOSSY;
+}
+
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_PHONG_RAMP_H__ */
diff --git a/intern/cycles/kernel/closure/bsdf_reflection.h b/intern/cycles/kernel/closure/bsdf_reflection.h
new file mode 100644
index 0000000..9356f95
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_reflection.h
@@ -0,0 +1,84 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_REFLECTION_H__
+#define __BSDF_REFLECTION_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* REFLECTION */
+
+__device int bsdf_reflection_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_REFLECTION_ID;
+	return SD_BSDF;
+}
+
+__device void bsdf_reflection_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_reflection_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device float3 bsdf_reflection_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_reflection_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	//const BsdfReflectionClosure *self = (const BsdfReflectionClosure*)sc->data;
+	float3 N = sc->N;
+
+	// only one direction is possible
+	float cosNO = dot(N, I);
+	if(cosNO > 0) {
+		*omega_in = (2 * cosNO) * N - I;
+		if(dot(Ng, *omega_in) > 0) {
+#ifdef __RAY_DIFFERENTIALS__
+			*domega_in_dx = 2 * dot(N, dIdx) * N - dIdx;
+			*domega_in_dy = 2 * dot(N, dIdy) * N - dIdy;
+#endif
+			*pdf = 1;
+			*eval = make_float3(1, 1, 1);
+		}
+	}
+	return LABEL_REFLECT|LABEL_SINGULAR;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_REFLECTION_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_refraction.h b/intern/cycles/kernel/closure/bsdf_refraction.h
new file mode 100644
index 0000000..ef79d6c
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_refraction.h
@@ -0,0 +1,91 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_REFRACTION_H__
+#define __BSDF_REFRACTION_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* REFRACTION */
+
+__device int bsdf_refraction_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_REFRACTION_ID;
+	return SD_BSDF;
+}
+
+__device void bsdf_refraction_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_refraction_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device float3 bsdf_refraction_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_refraction_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_eta = sc->data0;
+	float3 N = sc->N;
+
+	float3 R, T;
+#ifdef __RAY_DIFFERENTIALS__
+	float3 dRdx, dRdy, dTdx, dTdy;
+#endif
+	bool inside;
+	fresnel_dielectric(m_eta, N, I, &R, &T,
+#ifdef __RAY_DIFFERENTIALS__
+		dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy,
+#endif
+		&inside);
+	
+	if(!inside) {
+		*pdf = 1;
+		*eval = make_float3(1.0f, 1.0f, 1.0f);
+		*omega_in = T;
+#ifdef __RAY_DIFFERENTIALS__
+		*domega_in_dx = dTdx;
+		*domega_in_dy = dTdy;
+#endif
+	}
+	return LABEL_TRANSMIT|LABEL_SINGULAR;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_REFRACTION_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_transparent.h b/intern/cycles/kernel/closure/bsdf_transparent.h
new file mode 100644
index 0000000..81bc769
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_transparent.h
@@ -0,0 +1,74 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_TRANSPARENT_H__
+#define __BSDF_TRANSPARENT_H__
+
+CCL_NAMESPACE_BEGIN
+
+__device int bsdf_transparent_setup(ShaderClosure *sc)
+{
+	sc->type = CLOSURE_BSDF_TRANSPARENT_ID;
+	return SD_BSDF;
+}
+
+__device void bsdf_transparent_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_transparent_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device float3 bsdf_transparent_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_transparent_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	// only one direction is possible
+	*omega_in = -I;
+#ifdef __RAY_DIFFERENTIALS__
+	*domega_in_dx = -dIdx;
+	*domega_in_dy = -dIdy;
+#endif
+	*pdf = 1;
+	*eval = make_float3(1, 1, 1);
+	return LABEL_TRANSMIT|LABEL_TRANSPARENT;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_TRANSPARENT_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_ward.h b/intern/cycles/kernel/closure/bsdf_ward.h
new file mode 100644
index 0000000..dbddcf2
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_ward.h
@@ -0,0 +1,201 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_WARD_H__
+#define __BSDF_WARD_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* WARD */
+
+__device int bsdf_ward_setup(ShaderClosure *sc)
+{
+	float ax = sc->data0;
+	float ay = sc->data1;
+
+	float m_ax = clamp(ax, 1e-4f, 1.0f);
+	float m_ay = clamp(ay, 1e-4f, 1.0f);
+
+	sc->data0 = m_ax;
+	sc->data1 = m_ay;
+
+	sc->type = CLOSURE_BSDF_WARD_ID;
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_ward_blur(ShaderClosure *sc, float roughness)
+{
+	sc->data0 = fmaxf(roughness, sc->data0);
+	sc->data1 = fmaxf(roughness, sc->data1);
+}
+
+__device float3 bsdf_ward_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_ax = sc->data0;
+	float m_ay = sc->data1;
+	float3 N = sc->N;
+	float3 T = sc->T;
+
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+
+	if(cosNI > 0.0f && cosNO > 0.0f) {
+		cosNO = max(cosNO, 1e-4f);
+		cosNI = max(cosNI, 1e-4f);
+
+		// get half vector and get x,y basis on the surface for anisotropy
+		float3 H = normalize(omega_in + I); // normalize needed for pdf
+		float3 X, Y;
+		make_orthonormals_tangent(N, T, &X, &Y);
+		// eq. 4
+		float dotx = dot(H, X) / m_ax;
+		float doty = dot(H, Y) / m_ay;
+		float dotn = dot(H, N);
+		float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
+		float denom = (4 * M_PI_F * m_ax * m_ay * sqrtf(cosNO * cosNI));
+		float exp_val = expf(-exp_arg);
+		float out = cosNI * exp_val / denom;
+		float oh = dot(H, I);
+		denom = 4 * M_PI_F * m_ax * m_ay * oh * dotn * dotn * dotn;
+		*pdf = exp_val / denom;
+		return make_float3 (out, out, out);
+	}
+
+	return make_float3 (0, 0, 0);
+}
+
+__device float3 bsdf_ward_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_ward_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_ax = sc->data0;
+	float m_ay = sc->data1;
+	float3 N = sc->N;
+	float3 T = sc->T;
+
+	float cosNO = dot(N, I);
+	if(cosNO > 0.0f) {
+		// get x,y basis on the surface for anisotropy
+		float3 X, Y;
+		make_orthonormals_tangent(N, T, &X, &Y);
+		// generate random angles for the half vector
+		// eq. 7 (taking care around discontinuities to keep
+		//ttoutput angle in the right quadrant)
+		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
+		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
+		float alphaRatio = m_ay / m_ax;
+		float cosPhi, sinPhi;
+		if(randu < 0.25f) {
+			float val = 4 * randu;
+			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
+			cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
+			sinPhi = tanPhi * cosPhi;
+		}
+		else if(randu < 0.5f) {
+			float val = 1 - 4 * (0.5f - randu);
+			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
+			// phi = M_PI_F - phi;
+			cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
+			sinPhi = -tanPhi * cosPhi;
+		}
+		else if(randu < 0.75f) {
+			float val = 4 * (randu - 0.5f);
+			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
+			//phi = M_PI_F + phi;
+			cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
+			sinPhi = tanPhi * cosPhi;
+		}
+		else {
+			float val = 1 - 4 * (1 - randu);
+			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
+			// phi = 2 * M_PI_F - phi;
+			cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
+			sinPhi = -tanPhi * cosPhi;
+		}
+		// eq. 6
+		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
+		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
+		float thetaDenom = (cosPhi * cosPhi) / (m_ax * m_ax) + (sinPhi * sinPhi) / (m_ay * m_ay);
+		float tanTheta2 = -logf(1 - randv) / thetaDenom;
+		float cosTheta  = 1 / sqrtf(1 + tanTheta2);
+		float sinTheta  = cosTheta * sqrtf(tanTheta2);
+
+		float3 h; // already normalized becaused expressed from spherical coordinates
+		h.x = sinTheta * cosPhi;
+		h.y = sinTheta * sinPhi;
+		h.z = cosTheta;
+		// compute terms that are easier in local space
+		float dotx = h.x / m_ax;
+		float doty = h.y / m_ay;
+		float dotn = h.z;
+		// transform to world space
+		h = h.x * X + h.y * Y + h.z * N;
+		// generate the final sample
+		float oh = dot(h, I);
+		*omega_in = 2.0f * oh * h - I;
+		if(dot(Ng, *omega_in) > 0) {
+			float cosNI = dot(N, *omega_in);
+			if(cosNI > 0) {
+				cosNO = max(cosNO, 1e-4f);
+				cosNI = max(cosNI, 1e-4f);
+
+				// eq. 9
+				float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
+				float denom = 4 * M_PI_F * m_ax * m_ay * oh * dotn * dotn * dotn;
+				*pdf = expf(-exp_arg) / denom;
+				// compiler will reuse expressions already computed
+				denom = (4 * M_PI_F * m_ax * m_ay * sqrtf(cosNO * cosNI));
+				float power = cosNI * expf(-exp_arg) / denom;
+				*eval = make_float3(power, power, power);
+#ifdef __RAY_DIFFERENTIALS__
+				*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
+				*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
+				// Since there is some blur to this reflection, make the
+				// derivatives a bit bigger. In theory this varies with the
+				// roughness but the exact relationship is complex and
+				// requires more ops than are practical.
+				*domega_in_dx *= 10.0f;
+				*domega_in_dy *= 10.0f;
+#endif
+			}
+		}
+	}
+	return LABEL_REFLECT|LABEL_GLOSSY;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_WARD_H__ */
+
diff --git a/intern/cycles/kernel/closure/bsdf_westin.h b/intern/cycles/kernel/closure/bsdf_westin.h
new file mode 100644
index 0000000..9681732
--- /dev/null
+++ b/intern/cycles/kernel/closure/bsdf_westin.h
@@ -0,0 +1,192 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __BSDF_WESTIN_H__
+#define __BSDF_WESTIN_H__
+
+CCL_NAMESPACE_BEGIN
+
+/* WESTIN BACKSCATTER */
+
+__device int bsdf_westin_backscatter_setup(ShaderClosure *sc)
+{
+	float roughness = sc->data0;
+	roughness = clamp(roughness, 1e-5f, 1.0f);
+	float m_invroughness = 1.0f/roughness;
+
+	sc->type = CLOSURE_BSDF_WESTIN_BACKSCATTER_ID;
+	sc->data0 = m_invroughness;
+
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_westin_backscatter_blur(ShaderClosure *sc, float roughness)
+{
+	float m_invroughness = sc->data0;
+	m_invroughness = min(1.0f/roughness, m_invroughness);
+	sc->data0 = m_invroughness;
+}
+
+__device float3 bsdf_westin_backscatter_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_invroughness = sc->data0;
+	float3 N = sc->N;
+
+	// pdf is implicitly 0 (no indirect sampling)
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO > 0 && cosNI > 0) {
+		float cosine = dot(I, omega_in);
+		*pdf = cosine > 0 ? (m_invroughness + 1) * powf(cosine, m_invroughness) : 0;
+		*pdf *= 0.5f * M_1_PI_F;
+		return make_float3 (*pdf, *pdf, *pdf);
+	}
+	return make_float3 (0, 0, 0);
+}
+
+__device float3 bsdf_westin_backscatter_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_invroughness = sc->data0;
+	float3 N = sc->N;
+
+	float cosNO = dot(N, I);
+	if(cosNO > 0) {
+#ifdef __RAY_DIFFERENTIALS__
+		*domega_in_dx = dIdx;
+		*domega_in_dy = dIdy;
+#endif
+		float3 T, B;
+		make_orthonormals (I, &T, &B);
+		float phi = 2 * M_PI_F * randu;
+		float cosTheta = powf(randv, 1 / (m_invroughness + 1));
+		float sinTheta2 = 1 - cosTheta * cosTheta;
+		float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
+		*omega_in = (cosf(phi) * sinTheta) * T +
+				   (sinf(phi) * sinTheta) * B +
+				   (cosTheta) * I;
+		if(dot(Ng, *omega_in) > 0)
+		{
+			// common terms for pdf and eval
+			float cosNI = dot(N, *omega_in);
+			// make sure the direction we chose is still in the right hemisphere
+			if(cosNI > 0)
+			{
+				*pdf = 0.5f * M_1_PI_F * powf(cosTheta, m_invroughness);
+				*pdf = (m_invroughness + 1) * (*pdf);
+				*eval = make_float3(*pdf, *pdf, *pdf);
+#ifdef __RAY_DIFFERENTIALS__
+				// Since there is some blur to this reflection, make the
+				// derivatives a bit bigger. In theory this varies with the
+				// exponent but the exact relationship is complex and
+				// requires more ops than are practical.
+				*domega_in_dx *= 10.0f;
+				*domega_in_dy *= 10.0f;
+#endif
+			}
+		}
+	}
+	return LABEL_REFLECT|LABEL_GLOSSY;
+}
+
+/* WESTIN SHEEN */
+
+__device int bsdf_westin_sheen_setup(ShaderClosure *sc)
+{
+	float edginess = sc->data0;
+	sc->type = CLOSURE_BSDF_WESTIN_SHEEN_ID;
+	sc->data0 = edginess;
+	return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
+}
+
+__device void bsdf_westin_sheen_blur(ShaderClosure *sc, float roughness)
+{
+}
+
+__device float3 bsdf_westin_sheen_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	float m_edginess = sc->data0;
+	float3 N = sc->N;
+
+	// pdf is implicitly 0 (no indirect sampling)
+	float cosNO = dot(N, I);
+	float cosNI = dot(N, omega_in);
+	if(cosNO > 0 && cosNI > 0) {
+		float sinNO2 = 1 - cosNO * cosNO;
+		*pdf = cosNI * M_1_PI_F;
+		float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * (*pdf) : 0;
+		return make_float3 (westin, westin, westin);
+	}
+	return make_float3 (0, 0, 0);
+}
+
+__device float3 bsdf_westin_sheen_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
+{
+	return make_float3(0.0f, 0.0f, 0.0f);
+}
+
+__device int bsdf_westin_sheen_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
+{
+	float m_edginess = sc->data0;
+	float3 N = sc->N;
+
+	// we are viewing the surface from the right side - send a ray out with cosine
+	// distribution over the hemisphere
+	sample_cos_hemisphere(N, randu, randv, omega_in, pdf);
+	if(dot(Ng, *omega_in) > 0) {
+		// TODO: account for sheen when sampling
+		float cosNO = dot(N, I);
+		float sinNO2 = 1 - cosNO * cosNO;
+		float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * (*pdf) : 0;
+		*eval = make_float3(westin, westin, westin);
+#ifdef __RAY_DIFFERENTIALS__
+		// TODO: find a better approximation for the diffuse bounce
+		*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
+		*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
+		*domega_in_dx *= 125.0f;
+		*domega_in_dy *= 125.0f;
+#endif
+	}
+	else {
+		pdf = 0;
+	}
+	return LABEL_REFLECT|LABEL_DIFFUSE;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __BSDF_WESTIN_H__ */
+
diff --git a/intern/cycles/kernel/closure/emissive.h b/intern/cycles/kernel/closure/emissive.h
new file mode 100644
index 0000000..cbf9d9a
--- /dev/null
+++ b/intern/cycles/kernel/closure/emissive.h
@@ -0,0 +1,65 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+CCL_NAMESPACE_BEGIN
+
+/* EMISSION CLOSURE */
+
+/* return the probability distribution function in the direction I,
+ * given the parameters and the light's surface normal.  This MUST match
+ * the PDF computed by sample(). */
+__device float emissive_pdf(const float3 Ng, const float3 I)
+{
+	float cosNO = fabsf(dot(Ng, I));
+	return (cosNO > 0.0f)? 1.0f: 0.0f;
+}
+
+__device void emissive_sample(const float3 Ng, float randu, float randv,
+	float3 *omega_out, float *pdf)
+{
+	/* todo: not implemented and used yet */
+}
+
+__device float3 emissive_eval(const float3 Ng, const float3 I)
+{
+	float res = emissive_pdf(Ng, I);
+	
+	return make_float3(res, res, res);
+}
+
+__device float3 svm_emissive_eval(ShaderData *sd, ShaderClosure *sc)
+{
+	return emissive_eval(sd->Ng, sd->I);
+}
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/kernel/closure/volume.h b/intern/cycles/kernel/closure/volume.h
new file mode 100644
index 0000000..734f911
--- /dev/null
+++ b/intern/cycles/kernel/closure/volume.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+CCL_NAMESPACE_BEGIN
+
+/* note: the interfaces here are just as an example, need to figure
+ * out the right functions and parameters to use */
+
+/* ISOTROPIC VOLUME CLOSURE */
+
+__device int volume_isotropic_setup(ShaderClosure *sc, float density)
+{
+	sc->type = CLOSURE_VOLUME_ISOTROPIC_ID;
+	sc->data0 = density;
+
+	return SD_VOLUME;
+}
+
+__device float3 volume_isotropic_eval_phase(const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
+{
+	return make_float3(1.0f, 1.0f, 1.0f);
+}
+
+/* TRANSPARENT VOLUME CLOSURE */
+
+__device int volume_transparent_setup(ShaderClosure *sc, float density)
+{
+	sc->type = CLOSURE_VOLUME_TRANSPARENT_ID;
+	sc->data0 = density;
+
+	return SD_VOLUME;
+}
+
+__device float3 volume_transparent_eval_phase(const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
+{
+	return make_float3(1.0f, 1.0f, 1.0f);
+}
+
+/* VOLUME CLOSURE */
+
+__device float3 volume_eval_phase(const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
+{
+	float3 eval;
+
+	switch(sc->type) {
+		case CLOSURE_VOLUME_ISOTROPIC_ID:
+			eval = volume_isotropic_eval_phase(sc, omega_in, omega_out);
+			break;
+		case CLOSURE_VOLUME_TRANSPARENT_ID:
+			eval = volume_transparent_eval_phase(sc, omega_in, omega_out);
+			break;
+		default:
+			eval = make_float3(0.0f, 0.0f, 0.0f);
+			break;
+	}
+
+	return eval;
+}
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/kernel/kernel.cpp b/intern/cycles/kernel/kernel.cpp
index 62d79bd..d760e63 100644
--- a/intern/cycles/kernel/kernel.cpp
+++ b/intern/cycles/kernel/kernel.cpp
@@ -29,38 +29,6 @@
 
 CCL_NAMESPACE_BEGIN
 
-/* Globals */
-
-KernelGlobals *kernel_globals_create()
-{
-	KernelGlobals *kg = new KernelGlobals();
-#ifdef WITH_OSL
-	kg->osl.use = false;
-#endif
-	return kg;
-}
-
-void kernel_globals_free(KernelGlobals *kg)
-{
-	delete kg;
-}
-
-/* OSL */
-
-#ifdef WITH_OSL
-
-void *kernel_osl_memory(KernelGlobals *kg)
-{
-	return (void*)&kg->osl;
-}
-
-bool kernel_osl_use(KernelGlobals *kg)
-{
-	return kg->osl.use;
-}
-
-#endif
-
 /* Memory Copy */
 
 void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size)
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 2f2314c..d99beb8 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -301,10 +301,6 @@ __device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L)
 
 __device_inline void path_radiance_clamp(PathRadiance *L, float3 *L_sum, float clamp)
 {
-	#ifdef __OSL__
-	using std::isfinite;
-	#endif
-
 	float sum = fabsf((*L_sum).x) + fabsf((*L_sum).y) + fabsf((*L_sum).z);
 
 	if(!isfinite(sum)) {
diff --git a/intern/cycles/kernel/kernel_attribute.h b/intern/cycles/kernel/kernel_attribute.h
index 115de2f..b7ad731 100644
--- a/intern/cycles/kernel/kernel_attribute.h
+++ b/intern/cycles/kernel/kernel_attribute.h
@@ -19,13 +19,6 @@
 #ifndef __KERNEL_ATTRIBUTE_CL__
 #define __KERNEL_ATTRIBUTE_CL__
 
-#include "util_types.h"
-
-#ifdef __OSL__
-#include <string>
-#include "util_attribute.h"
-#endif
-
 CCL_NAMESPACE_BEGIN
 
 /* note: declared in kernel.h, have to add it here because kernel.h is not available */
@@ -33,20 +26,9 @@ bool kernel_osl_use(KernelGlobals *kg);
 
 __device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
 {
-
 #ifdef __OSL__
-	if (kernel_osl_use(kg)) {
-		/* for OSL, a hash map is used to lookup the attribute by name. */
-		OSLGlobals::AttributeMap &attr_map = kg->osl.attribute_map[sd->object];
-		ustring stdname(std::string("std::") + std::string(attribute_standard_name((AttributeStandard)id)));
-		OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname);
-		if (it != attr_map.end()) {
-			const OSLGlobals::Attribute &osl_attr = it->second;
-			/* return result */
-			return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset;
-		}
-		else
-			return (int)ATTR_STD_NOT_FOUND;
+	if (kg->osl) {
+		return OSLShader::find_attribute(kg, sd, id);
 	}
 	else
 #endif
@@ -59,7 +41,7 @@ __device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
 			attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
 		
 		/* return result */
-		return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
+		return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : (int)attr_map.z;
 	}
 }
 
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h
index 34a44af..d70485f 100644
--- a/intern/cycles/kernel/kernel_bvh.h
+++ b/intern/cycles/kernel/kernel_bvh.h
@@ -57,7 +57,7 @@ __device_inline float3 bvh_inverse_direction(float3 dir)
 
 __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
 {
-	Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_INVERSE_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
 	*P = transform_point(&tfm, ray->P);
 
@@ -75,7 +75,7 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray
 __device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
 {
 	if(*t != FLT_MAX) {
-		Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM);
+		Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
 		*t *= len(transform_direction(&tfm, 1.0f/(*idir)));
 	}
 
@@ -83,6 +83,35 @@ __device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray *
 	*idir = bvh_inverse_direction(ray->D);
 }
 
+#ifdef __OBJECT_MOTION__
+__device_inline void bvh_instance_motion_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, Transform *tfm, const float tmax)
+{
+	Transform itfm;
+	*tfm = object_fetch_transform_motion_test(kg, object, ray->time, &itfm);
+
+	*P = transform_point(&itfm, ray->P);
+
+	float3 dir = transform_direction(&itfm, ray->D);
+
+	float len;
+	dir = normalize_len(dir, &len);
+
+	*idir = bvh_inverse_direction(dir);
+
+	if(*t != FLT_MAX)
+		*t *= len;
+}
+
+__device_inline void bvh_instance_motion_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, Transform *tfm, const float tmax)
+{
+	if(*t != FLT_MAX)
+		*t *= len(transform_direction(tfm, 1.0f/(*idir)));
+
+	*P = ray->P;
+	*idir = bvh_inverse_direction(ray->D);
+}
+#endif
+
 /* intersect two bounding boxes */
 __device_inline void bvh_node_intersect(KernelGlobals *kg,
 	bool *traverseChild0, bool *traverseChild1,
@@ -176,7 +205,7 @@ __device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *ise
 	}
 }
 
-__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
+__device_inline bool bvh_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
 {
 	/* traversal stack in CUDA thread-local memory */
 	int traversalStack[BVH_STACK_SIZE];
@@ -268,7 +297,6 @@ __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const ui
 				else {
 					/* instance push */
 					object = kernel_tex_fetch(__prim_object, -primAddr-1);
-
 					bvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
 
 					++stackPtr;
@@ -296,6 +324,135 @@ __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const ui
 	return (isect->prim != ~0);
 }
 
+#ifdef __OBJECT_MOTION__
+__device_inline bool bvh_intersect_motion(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
+{
+	/* traversal stack in CUDA thread-local memory */
+	int traversalStack[BVH_STACK_SIZE];
+	traversalStack[0] = ENTRYPOINT_SENTINEL;
+
+	/* traversal variables in registers */
+	int stackPtr = 0;
+	int nodeAddr = kernel_data.bvh.root;
+
+	/* ray parameters in registers */
+	const float tmax = ray->t;
+	float3 P = ray->P;
+	float3 idir = bvh_inverse_direction(ray->D);
+	int object = ~0;
+
+	Transform ob_tfm;
+
+	isect->t = tmax;
+	isect->object = ~0;
+	isect->prim = ~0;
+	isect->u = 0.0f;
+	isect->v = 0.0f;
+
+	/* traversal loop */
+	do {
+		do
+		{
+			/* traverse internal nodes */
+			while(nodeAddr >= 0 && nodeAddr != ENTRYPOINT_SENTINEL)
+			{
+				bool traverseChild0, traverseChild1, closestChild1;
+				int nodeAddrChild1;
+
+				bvh_node_intersect(kg, &traverseChild0, &traverseChild1,
+					&closestChild1, &nodeAddr, &nodeAddrChild1,
+					P, idir, isect->t, visibility, nodeAddr);
+
+				if(traverseChild0 != traverseChild1) {
+					/* one child was intersected */
+					if(traverseChild1) {
+						nodeAddr = nodeAddrChild1;
+					}
+				}
+				else {
+					if(!traverseChild0) {
+						/* neither child was intersected */
+						nodeAddr = traversalStack[stackPtr];
+						--stackPtr;
+					}
+					else {
+						/* both children were intersected, push the farther one */
+						if(closestChild1) {
+							int tmp = nodeAddr;
+							nodeAddr = nodeAddrChild1;
+							nodeAddrChild1 = tmp;
+						}
+
+						++stackPtr;
+						traversalStack[stackPtr] = nodeAddrChild1;
+					}
+				}
+			}
+
+			/* if node is leaf, fetch triangle list */
+			if(nodeAddr < 0) {
+				float4 leaf = kernel_tex_fetch(__bvh_nodes, (-nodeAddr-1)*BVH_NODE_SIZE+(BVH_NODE_SIZE-1));
+				int primAddr = __float_as_int(leaf.x);
+
+				if(primAddr >= 0) {
+					int primAddr2 = __float_as_int(leaf.y);
+
+					/* pop */
+					nodeAddr = traversalStack[stackPtr];
+					--stackPtr;
+
+					/* triangle intersection */
+					while(primAddr < primAddr2) {
+						/* intersect ray against triangle */
+						bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
+
+						/* shadow ray early termination */
+						if(visibility == PATH_RAY_SHADOW_OPAQUE && isect->prim != ~0)
+							return true;
+
+						primAddr++;
+					}
+				}
+				else {
+					/* instance push */
+					object = kernel_tex_fetch(__prim_object, -primAddr-1);
+					bvh_instance_motion_push(kg, object, ray, &P, &idir, &isect->t, &ob_tfm, tmax);
+
+					++stackPtr;
+					traversalStack[stackPtr] = ENTRYPOINT_SENTINEL;
+
+					nodeAddr = kernel_tex_fetch(__object_node, object);
+				}
+			}
+		} while(nodeAddr != ENTRYPOINT_SENTINEL);
+
+		if(stackPtr >= 0) {
+			kernel_assert(object != ~0);
+
+			/* instance pop */
+			bvh_instance_motion_pop(kg, object, ray, &P, &idir, &isect->t, &ob_tfm, tmax);
+			object = ~0;
+			nodeAddr = traversalStack[stackPtr];
+			--stackPtr;
+		}
+	} while(nodeAddr != ENTRYPOINT_SENTINEL);
+
+	return (isect->prim != ~0);
+}
+#endif
+
+__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
+{
+#ifdef __OBJECT_MOTION__
+	if(kernel_data.bvh.have_motion)
+		return bvh_intersect_motion(kg, ray, visibility, isect);
+	else
+		return bvh_intersect(kg, ray, visibility, isect);
+#else
+	return bvh_intersect(kg, ray, visibility, isect);
+#endif
+}
+
 __device_inline float3 ray_offset(float3 P, float3 Ng)
 {
 #ifdef __INTERSECTION_REFINE__
@@ -349,10 +506,10 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, ShaderData *sd, co
 
 #ifdef __INTERSECTION_REFINE__
 	if(isect->object != ~0) {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 		Transform tfm = sd->ob_itfm;
 #else
-		Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_INVERSE_TRANSFORM);
+		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
 #endif
 
 		P = transform_point(&tfm, P);
@@ -370,10 +527,10 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, ShaderData *sd, co
 	P = P + D*rt;
 
 	if(isect->object != ~0) {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 		Transform tfm = sd->ob_tfm;
 #else
-		Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_TRANSFORM);
+		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
 #endif
 
 		P = transform_point(&tfm, P);
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 7fa9871..97d37a8 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -63,9 +63,9 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
 	/* transform ray from camera to world */
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	if(kernel_data.cam.have_motion)
-		transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
+		transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
 #endif
 
 	ray->P = transform_point(&cameratoworld, ray->P);
@@ -106,9 +106,9 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 	/* transform ray from camera to world */
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	if(kernel_data.cam.have_motion)
-		transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
+		transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
 #endif
 
 	ray->P = transform_point(&cameratoworld, ray->P);
@@ -180,9 +180,9 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra
 	/* transform ray from camera to world */
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	if(kernel_data.cam.have_motion)
-		transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
+		transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
 #endif
 
 	ray->P = transform_point(&cameratoworld, ray->P);
@@ -212,12 +212,12 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
 	float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE);
 	float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE);
 
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	/* motion blur */
 	if(kernel_data.cam.shuttertime == 0.0f)
 		ray->time = TIME_INVALID;
 	else
-		ray->time = 0.5f + (time - 0.5f)*kernel_data.cam.shuttertime;
+		ray->time = 0.5f + 0.5f*(time - 0.5f)*kernel_data.cam.shuttertime;
 #endif
 
 	/* sample */
@@ -229,5 +229,20 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
 		camera_sample_panorama(kg, raster_x, raster_y, lens_u, lens_v, ray);
 }
 
+/* Utilities */
+
+__device_inline float camera_distance(KernelGlobals *kg, float3 P)
+{
+	Transform cameratoworld = kernel_data.cam.cameratoworld;
+	float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+
+	if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
+		float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
+		return fabsf(dot((P - camP), camD));
+	}
+	else
+		return len(P - camP);
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/kernel_displace.h b/intern/cycles/kernel/kernel_displace.h
index 6461a1e..a55f7a7 100644
--- a/intern/cycles/kernel/kernel_displace.h
+++ b/intern/cycles/kernel/kernel_displace.h
@@ -47,6 +47,9 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, uint4 *input, float4 *ou
 		ray.P = make_float3(0.0f, 0.0f, 0.0f);
 		ray.D = equirectangular_to_direction(u, v);
 		ray.t = 0.0f;
+#ifdef __CAMERA_MOTION__
+		ray.time = 0.5f;
+#endif
 
 #ifdef __RAY_DIFFERENTIALS__
 		ray.dD.dx = make_float3(0.0f, 0.0f, 0.0f);
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 53d53b4..6d650a0 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -32,8 +32,15 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
 		Ray ray;
 		ray.D = ls->D;
 		ray.P = ls->P;
+		ray.t = 1.0f;
+#ifdef __OBJECT_MOTION__
+		ray.time = time;
+#endif
 		ray.dP.dx = make_float3(0.0f, 0.0f, 0.0f);
 		ray.dP.dy = make_float3(0.0f, 0.0f, 0.0f);
+#ifdef __CAMERA_MOTION__
+		ray.time = time;
+#endif
 		shader_setup_from_background(kg, &sd, &ray);
 		eval = shader_eval_background(kg, &sd, 0);
 	}
diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h
index 1e56c11..529b7b8 100644
--- a/intern/cycles/kernel/kernel_globals.h
+++ b/intern/cycles/kernel/kernel_globals.h
@@ -18,14 +18,6 @@
 
 /* Constant Globals */
 
-#ifdef __KERNEL_CPU__
-
-#ifdef __OSL__
-#include "osl_globals.h"
-#endif
-
-#endif
-
 CCL_NAMESPACE_BEGIN
 
 /* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in
@@ -35,6 +27,12 @@ CCL_NAMESPACE_BEGIN
 
 #ifdef __KERNEL_CPU__
 
+#ifdef __OSL__
+struct OSLGlobals;
+struct OSLThreadData;
+struct OSLShadingSystem;
+#endif
+
 #define MAX_BYTE_IMAGES   512
 #define MAX_FLOAT_IMAGES  5
 
@@ -51,7 +49,9 @@ typedef struct KernelGlobals {
 #ifdef __OSL__
 	/* On the CPU, we also have the OSL globals here. Most data structures are shared
 	 * with SVM, the difference is in the shaders and object/mesh attributes. */
-	OSLGlobals osl;
+	OSLGlobals *osl;
+	OSLShadingSystem *osl_ss;
+	OSLThreadData *osl_tdata;
 #endif
 
 } KernelGlobals;
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 1084415..97ae2d3 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -301,8 +301,13 @@ __device void triangle_light_sample(KernelGlobals *kg, int prim, int object,
 #ifdef __INSTANCING__
 	/* instance transform */
 	if(ls->object >= 0) {
-		Transform tfm = object_fetch_transform(kg, ls->object, time, OBJECT_TRANSFORM);
-		Transform itfm = object_fetch_transform(kg, ls->object, time, OBJECT_INVERSE_TRANSFORM);
+#ifdef __OBJECT_MOTION__
+		Transform itfm;
+		Transform tfm = object_fetch_transform_motion_test(kg, object, time, &itfm);
+#else
+		Transform tfm = object_fetch_transform(kg, ls->object, OBJECT_TRANSFORM);
+		Transform itfm = object_fetch_transform(kg, ls->object, OBJECT_INVERSE_TRANSFORM);
+#endif
 
 		ls->P = transform_point(&tfm, ls->P);
 		ls->Ng = normalize(transform_direction_transposed(&itfm, ls->Ng));
@@ -345,10 +350,9 @@ __device int light_distribution_sample(KernelGlobals *kg, float randt)
 		}
 	}
 
-	first = max(0, first-1);
-	kernel_assert(first >= 0 && first < kernel_data.integrator.num_distribution);
-
-	return first;
+	/* clamping should not be needed but float rounding errors seem to
+	 * make this fail on rare occasions */
+	return clamp(first-1, 0, kernel_data.integrator.num_distribution-1);
 }
 
 /* Generic Light */
diff --git a/intern/cycles/kernel/kernel_mbvh.h b/intern/cycles/kernel/kernel_mbvh.h
deleted file mode 100644
index ccbd3d0..0000000
--- a/intern/cycles/kernel/kernel_mbvh.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-CCL_NAMESPACE_BEGIN
-
-#define MBVH_OBJECT_SENTINEL 0x76543210
-#define MBVH_NODE_SIZE 8
-#define MBVH_STACK_SIZE 1024
-#define MBVH_RAY_STACK_SIZE 10000
-
-typedef struct MBVHTask {
-	int node;
-	int index;
-	int num;
-	int object;
-} MBVHTask;
-
-typedef struct MVBHRay {
-	float3 P;
-	float u;
-	float3 idir;
-	float v;
-	float t;
-	int index;
-	int object;
-
-	float3 origP;
-	float3 origD;
-	float tmax;
-} MBVHRay;
-
-__device float3 mbvh_inverse_direction(float3 dir)
-{
-	// Avoid divide by zero (ooeps = exp2f(-80.0f))
-	float ooeps = 0.00000000000000000000000082718061255302767487140869206996285356581211090087890625f;
-	float3 idir;
-
-	idir.x = 1.0f / (fabsf(dir.x) > ooeps ? dir.x : copysignf(ooeps, dir.x));
-	idir.y = 1.0f / (fabsf(dir.y) > ooeps ? dir.y : copysignf(ooeps, dir.y));
-	idir.z = 1.0f / (fabsf(dir.z) > ooeps ? dir.z : copysignf(ooeps, dir.z));
-
-	return idir;
-}
-
-__device void mbvh_instance_push(KernelGlobals *kg, int object, MBVHRay *ray)
-{
-	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
-
-	ray->P = transform_point(&tfm, ray->origP);
-
-	float3 dir = ray->origD;
-
-	if(ray->t != ray->tmax) dir *= ray->t;
-
-	dir = transform_direction(&tfm, dir);
-	ray->idir = mbvh_inverse_direction(normalize(dir));
-
-	if(ray->t != ray->tmax) ray->t = len(dir);
-}
-
-__device void mbvh_instance_pop(KernelGlobals *kg, int object, MBVHRay *ray)
-{
-	Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
-
-	if(ray->t != ray->tmax)
-		ray->t = len(transform_direction(&tfm, (1.0f/(ray->idir)) * (ray->t)));
-
-	ray->P = ray->origP;
-	ray->idir = mbvh_inverse_direction(ray->origD);
-}
-
-/* Sven Woop's algorithm */
-__device void mbvh_triangle_intersect(KernelGlobals *kg, MBVHRay *ray, int object, int triAddr)
-{
-	float3 P = ray->P;
-	float3 idir = ray->idir;
-
-	/* compute and check intersection t-value */
-	float4 v00 = kernel_tex_fetch(__tri_woop, triAddr*MBVH_NODE_SIZE+0);
-	float4 v11 = kernel_tex_fetch(__tri_woop, triAddr*MBVH_NODE_SIZE+1);
-	float3 dir = 1.0f/idir;
-
-	float Oz = v00.w - P.x*v00.x - P.y*v00.y - P.z*v00.z;
-	float invDz = 1.0f/(dir.x*v00.x + dir.y*v00.y + dir.z*v00.z);
-	float t = Oz * invDz;
-
-	if(t > 0.0f && t < ray->t) {
-		/* compute and check barycentric u */
-		float Ox = v11.w + P.x*v11.x + P.y*v11.y + P.z*v11.z;
-		float Dx = dir.x*v11.x + dir.y*v11.y + dir.z*v11.z;
-		float u = Ox + t*Dx;
-
-		if(u >= 0.0f) {
-			/* compute and check barycentric v */
-			float4 v22 = kernel_tex_fetch(__tri_woop, triAddr*MBVH_NODE_SIZE+2);
-			float Oy = v22.w + P.x*v22.x + P.y*v22.y + P.z*v22.z;
-			float Dy = dir.x*v22.x + dir.y*v22.y + dir.z*v22.z;
-			float v = Oy + t*Dy;
-
-			if(v >= 0.0f && u + v <= 1.0f) {
-				/* record intersection */
-				ray->index = triAddr;
-				ray->object = object;
-				ray->u = u;
-				ray->v = v;
-				ray->t = t;
-			}
-		}
-	}
-}
-
-__device void mbvh_node_intersect(KernelGlobals *kg, __m128 *traverseChild,
-	__m128 *tHit, float3 P, float3 idir, float t, int nodeAddr)
-{
-	/* X axis */
-	const __m128 bminx = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+0);
-	const __m128 t0x = _mm_mul_ps(_mm_sub_ps(bminx, _mm_set_ps1(P.x)), _mm_set_ps1(idir.x));
-	const __m128 bmaxx = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+1);
-	const __m128 t1x = _mm_mul_ps(_mm_sub_ps(bmaxx, _mm_set_ps1(P.x)), _mm_set_ps1(idir.x));
-
-	__m128 tmin = _mm_max_ps(_mm_min_ps(t0x, t1x), _mm_setzero_ps());
-	__m128 tmax = _mm_min_ps(_mm_max_ps(t0x, t1x), _mm_set_ps1(t));
-
-	/* Y axis */
-	const __m128 bminy = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+2);
-	const __m128 t0y = _mm_mul_ps(_mm_sub_ps(bminy, _mm_set_ps1(P.y)), _mm_set_ps1(idir.y));
-	const __m128 bmaxy = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+3);
-	const __m128 t1y = _mm_mul_ps(_mm_sub_ps(bmaxy, _mm_set_ps1(P.y)), _mm_set_ps1(idir.y));
-
-	tmin = _mm_max_ps(_mm_min_ps(t0y, t1y), tmin);
-	tmax = _mm_min_ps(_mm_max_ps(t0y, t1y), tmax);
-
-	/* Z axis */
-	const __m128 bminz = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+4);
-	const __m128 t0z = _mm_mul_ps(_mm_sub_ps(bminz, _mm_set_ps1(P.z)), _mm_set_ps1(idir.z));
-	const __m128 bmaxz = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*MBVH_NODE_SIZE+5);
-	const __m128 t1z = _mm_mul_ps(_mm_sub_ps(bmaxz, _mm_set_ps1(P.z)), _mm_set_ps1(idir.z));
-
-	tmin = _mm_max_ps(_mm_min_ps(t0z, t1z), tmin);
-	tmax = _mm_min_ps(_mm_max_ps(t0z, t1z), tmax);
-
-	/* compare and get mask */
-	*traverseChild = _mm_cmple_ps(tmin, tmax);
-
-	/* get distance XXX probably wrong */
-	*tHit = tmin;
-}
-
-static void mbvh_sort_by_length(int id[4], float len[4])
-{
-	for(int i = 1; i < 4; i++) {
-		int j = i - 1;
-
-		while(j >= 0 && len[j] > len[j+1]) {
-			swap(len[j], len[j+1]);
-			swap(id[j], id[j+1]);
-			j--;
-		}
-	}
-}
-
-__device void scene_intersect(KernelGlobals *kg, MBVHRay *rays, int numrays)
-{
-	/* traversal stacks */
-	MBVHTask task_stack[MBVH_STACK_SIZE];
-	int active_ray_stacks[4][MBVH_RAY_STACK_SIZE];
-	int num_task, num_active[4] = {0, 0, 0, 0};
-	__m128i one_mm = _mm_set1_epi32(1);
-
-	/* push root node task on stack */
-	task_stack[0].node = kernel_data.bvh.root;
-	task_stack[0].index = 0;
-	task_stack[0].num = numrays;
-	task_stack[0].object = ~0;
-	num_task = 1;
-
-	/* push all rays in first SIMD lane */
-	for(int i = 0; i < numrays; i++)
-		active_ray_stacks[0][i] = i;
-	num_active[0] = numrays;
-	
-	while(num_task >= 1) {
-		/* pop task */
-		MBVHTask task = task_stack[--num_task];
-
-		if(task.node == MBVH_OBJECT_SENTINEL) {
-			/* instance pop */
-
-			/* pop rays from stack */
-			num_active[task.index] -= task.num;
-			int ray_offset = num_active[task.index];
-
-			/* transform rays */
-			for(int i = 0; i < task.num; i++) {
-				MBVHRay *ray = &rays[active_ray_stacks[task.index][ray_offset + i]];
-				mbvh_instance_pop(kg, task.object, ray);
-			}
-		}
-		else if(task.node >= 0) {
-			/* inner node? */
-
-			/* pop rays from stack*/
-			num_active[task.index] -= task.num;
-			int ray_offset = num_active[task.index];
-
-			/* initialze simd values */
-			__m128i num_active_mm = _mm_load_si128((__m128i*)num_active);
-			__m128 len_mm = _mm_set_ps1(0.0f);
-
-			for(int i = 0; i < task.num; i++) {
-				int rayid = active_ray_stacks[task.index][ray_offset + i];
-				MVBHRay *ray = rays + rayid;
-
-				/* intersect 4 QBVH node children */
-				__m128 result;
-				__m128 thit;
-
-				mbvh_node_intersect(kg, &result, &thit, ray->P, ray->idir, ray->t, task.node);
-
-				/* update length for sorting */
-				len_mm = _mm_add_ps(len_mm, _mm_and_ps(thit, result));
-
-				/* push rays on stack */
-				for(int j = 0; j < 4; j++)
-					active_ray_stacks[j][num_active[j]] = rayid;
-
-				/* update num active */
-				__m128i resulti = _mm_and_si128(*((__m128i*)&result), one_mm);
-				num_active_mm = _mm_add_epi32(resulti, num_active_mm);
-				_mm_store_si128((__m128i*)num_active, num_active_mm);
-			}
-
-			if(num_active[0] || num_active[1] || num_active[2] || num_active[3]) {
-				/* load child node addresses */
-				float4 cnodes = kernel_tex_fetch(__bvh_nodes, task.node);
-				int child[4] = {
-					__float_as_int(cnodes.x),
-					__float_as_int(cnodes.y),
-					__float_as_int(cnodes.z),
-					__float_as_int(cnodes.w)};
-
-				/* sort nodes by average intersection distance */
-				int ids[4] = {0, 1, 2, 3};
-				float len[4];
-
-				_mm_store_ps(len, len_mm);
-				mbvh_sort_by_length(ids, len);
-
-				/* push new tasks on stack */
-				for(int j = 0; j < 4; j++) {
-					if(num_active[j]) {
-						int id = ids[j];
-
-						task_stack[num_task].node = child[id];
-						task_stack[num_task].index = id;
-						task_stack[num_task].num = num_active[id];
-						task_stack[num_task].object = task.object;
-						num_task++;
-					}
-				}
-			}
-		}
-		else {
-			/* fetch leaf node data */
-			float4 leaf = kernel_tex_fetch(__bvh_nodes, (-task.node-1)*MBVH_NODE_SIZE+(MBVH_NODE_SIZE-2));
-			int triAddr = __float_as_int(leaf.x);
-			int triAddr2 = __float_as_int(leaf.y);
-
-			/* pop rays from stack*/
-			num_active[task.index] -= task.num;
-			int ray_offset = num_active[task.index];
-
-			/* triangles */
-			if(triAddr >= 0) {
-				int i, numq = (task.num >> 2) << 2;
-
-				/* SIMD ray leaf intersection */
-				for(i = 0; i < numq; i += 4) {
-					MBVHRay *ray4[4] = {
-						&rays[active_ray_stacks[task.index][ray_offset + i + 0]],
-						&rays[active_ray_stacks[task.index][ray_offset + i + 1]],
-						&rays[active_ray_stacks[task.index][ray_offset + i + 2]],
-						&rays[active_ray_stacks[task.index][ray_offset + i + 3]]};
-
-					/* load SoA */
-
-					while(triAddr < triAddr2) {
-						mbvh_triangle_intersect(ray4[0], task.object, task.node);
-						mbvh_triangle_intersect(ray4[1], task.object, task.node);
-						mbvh_triangle_intersect(ray4[2], task.object, task.node);
-						mbvh_triangle_intersect(ray4[3], task.object, task.node);
-						triAddr++;
-
-						/* some shadow ray optim could be done by setting t=0 */
-					}
-
-					/* store AoS */
-				}
-
-				/* mono ray leaf intersection */
-				for(; i < task.num; i++) {
-					MBVHRay *ray = &rays[active_ray_stacks[task.index][ray_offset + i]];
-
-					while(triAddr < triAddr2) {
-						mbvh_triangle_intersect(kg, ray, task.object, task.node);
-						triAddr++;
-					}
-				}
-			}
-			else {
-				/* instance push */
-				int object = -triAddr-1;
-				int node = triAddr;
-
-				/* push instance pop task */
-				task_stack[num_task].node = MBVH_OBJECT_SENTINEL;
-				task_stack[num_task].index = task.index;
-				task_stack[num_task].num = task.num;
-				task_stack[num_task].object = object;
-				num_task++;
-
-				num_active[task.index] += task.num;
-
-				/* push node task */
-				task_stack[num_task].node = node;
-				task_stack[num_task].index = task.index;
-				task_stack[num_task].num = task.num;
-				task_stack[num_task].object = object;
-				num_task++;
-
-				for(int i = 0; i < task.num; i++) {
-					int rayid = active_ray_stacks[task.index][ray_offset + i];
-
-					/* push on stack for last task */
-					active_ray_stacks[task.index][num_active[task.index]] = rayid;
-					num_active[task.index]++;
-
-					/* transform ray */
-					MBVHRay *ray = &rays[rayid];
-					mbvh_instance_push(kg, object, ray);
-				}
-			}
-		}
-	}
-}
-
-__device void mbvh_set_ray(MBVHRay *rays, int i, Ray *ray, float tmax)
-{
-	MBVHRay *mray = &rays[i];
-
-	/* ray parameters in registers */
-	mray->P = ray->P;
-	mray->idir = mbvh_inverse_direction(ray->D);
-	mray->t = tmax;
-}
-
-__device bool mbvh_get_intersection(MVBHRay *rays, int i, Intersection *isect, float tmax)
-{
-	MBVHRay *mray = &rays[i];
-
-	if(mray->t == tmax)
-		return false;
-	
-	isect->t = mray->t;
-	isect->u = mray->u;
-	isect->v = mray->v;
-	isect->index = mray->index;
-	isect->object = mray->object;
-
-	return true;
-}
-
-__device bool mbvh_get_shadow(MBVHRay *rays, int i, float tmax)
-{
-	return (rays[i].t == tmax);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h
index d0b588a..48d1aa6 100644
--- a/intern/cycles/kernel/kernel_montecarlo.h
+++ b/intern/cycles/kernel/kernel_montecarlo.h
@@ -72,7 +72,7 @@ __device void to_unit_disk(float *x, float *y)
 
 __device void make_orthonormals_tangent(const float3 N, const float3 T, float3 *a, float3 *b)
 {
-	*b = cross(N, T);
+	*b = normalize(cross(N, T));
 	*a = cross(*b, N);
 }
 
diff --git a/intern/cycles/kernel/kernel_object.h b/intern/cycles/kernel/kernel_object.h
index 01da505..2b38544 100644
--- a/intern/cycles/kernel/kernel_object.h
+++ b/intern/cycles/kernel/kernel_object.h
@@ -27,103 +27,124 @@ enum ObjectTransform {
 	OBJECT_DUPLI = 16
 };
 
-__device_inline Transform object_fetch_transform(KernelGlobals *kg, int object, float time, enum ObjectTransform type)
+__device_inline Transform object_fetch_transform(KernelGlobals *kg, int object, enum ObjectTransform type)
 {
+	int offset = object*OBJECT_SIZE + (int)type;
+
 	Transform tfm;
+	tfm.x = kernel_tex_fetch(__objects, offset + 0);
+	tfm.y = kernel_tex_fetch(__objects, offset + 1);
+	tfm.z = kernel_tex_fetch(__objects, offset + 2);
+	tfm.w = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
 
-#ifdef __MOTION__
-	/* if we do motion blur */
-	if(sd->flag & SD_OBJECT_MOTION) {
-		/* fetch motion transforms */
-		MotionTransform motion;
+	return tfm;
+}
 
-		motion.pre.x = have_motion;
-		motion.pre.y = kernel_tex_fetch(__objects, offset + 1);
-		motion.pre.z = kernel_tex_fetch(__objects, offset + 2);
-		motion.pre.w = kernel_tex_fetch(__objects, offset + 3);
+#ifdef __OBJECT_MOTION__
+__device_inline Transform object_fetch_transform_motion(KernelGlobals *kg, int object, float time)
+{
+	DecompMotionTransform motion;
 
-		motion.post.x = kernel_tex_fetch(__objects, offset + 4);
-		motion.post.y = kernel_tex_fetch(__objects, offset + 5);
-		motion.post.z = kernel_tex_fetch(__objects, offset + 6);
-		motion.post.w = kernel_tex_fetch(__objects, offset + 7);
+	int offset = object*OBJECT_SIZE + (int)OBJECT_TRANSFORM_MOTION_PRE;
 
-		/* interpolate (todo: do only once per object) */
-		transform_motion_interpolate(&tfm, &motion, time);
+	motion.mid.x = kernel_tex_fetch(__objects, offset + 0);
+	motion.mid.y = kernel_tex_fetch(__objects, offset + 1);
+	motion.mid.z = kernel_tex_fetch(__objects, offset + 2);
+	motion.mid.w = kernel_tex_fetch(__objects, offset + 3);
 
-		/* invert */
-		if(type == OBJECT_INVERSE_TRANSFORM)
-			tfm = transform_quick_inverse(tfm);
+	motion.pre_x = kernel_tex_fetch(__objects, offset + 4);
+	motion.pre_y = kernel_tex_fetch(__objects, offset + 5);
+	motion.post_x = kernel_tex_fetch(__objects, offset + 6);
+	motion.post_y = kernel_tex_fetch(__objects, offset + 7);
 
-		return tfm;
-	}
-#endif
+	Transform tfm;
+	transform_motion_interpolate(&tfm, &motion, time);
 
-	int offset = object*OBJECT_SIZE + (int)type;
+	return tfm;
+}
 
-	tfm.x = kernel_tex_fetch(__objects, offset + 0);
-	tfm.y = kernel_tex_fetch(__objects, offset + 1);
-	tfm.z = kernel_tex_fetch(__objects, offset + 2);
-	tfm.w = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
+__device_inline Transform object_fetch_transform_motion_test(KernelGlobals *kg, int object, float time, Transform *itfm)
+{
+	int object_flag = kernel_tex_fetch(__object_flag, object);
 
-	return tfm;
+	if(object_flag & SD_OBJECT_MOTION) {
+		/* if we do motion blur */
+		Transform tfm = object_fetch_transform_motion(kg, object, time);
+
+		if(itfm)
+			*itfm = transform_quick_inverse(tfm);
+
+		return tfm;
+	}
+	else {
+		Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
+		if(itfm)
+			*itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
+
+		return tfm;
+	}
 }
+#endif
 
 __device_inline void object_position_transform(KernelGlobals *kg, ShaderData *sd, float3 *P)
 {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	*P = transform_point(&sd->ob_tfm, *P);
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
 	*P = transform_point(&tfm, *P);
 #endif
 }
 
 __device_inline void object_inverse_position_transform(KernelGlobals *kg, ShaderData *sd, float3 *P)
 {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	*P = transform_point(&sd->ob_itfm, *P);
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_INVERSE_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
 	*P = transform_point(&tfm, *P);
 #endif
 }
 
 __device_inline void object_inverse_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N)
 {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	*N = normalize(transform_direction_transposed(&sd->ob_tfm, *N));
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
 	*N = normalize(transform_direction_transposed(&tfm, *N));
 #endif
 }
 
 __device_inline void object_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N)
 {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	*N = normalize(transform_direction_transposed(&sd->ob_itfm, *N));
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_INVERSE_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
 	*N = normalize(transform_direction_transposed(&tfm, *N));
 #endif
 }
 
 __device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, float3 *D)
 {
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	*D = transform_direction(&sd->ob_tfm, *D);
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
 	*D = transform_direction(&tfm, *D);
 #endif
 }
 
 __device_inline float3 object_location(KernelGlobals *kg, ShaderData *sd)
 {
-#ifdef __MOTION__
+	if(sd->object == ~0)
+		return make_float3(0.0f, 0.0f, 0.0f);
+
+#ifdef __OBJECT_MOTION__
 	return make_float3(sd->ob_tfm.x.w, sd->ob_tfm.y.w, sd->ob_tfm.z.w);
 #else
-	Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);
+	Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
 	return make_float3(tfm.x.w, tfm.y.w, tfm.z.w);
 #endif
 }
@@ -249,6 +270,5 @@ __device float3 particle_angular_velocity(KernelGlobals *kg, int particle)
 	return make_float3(f3.z, f3.w, f4.x);
 }
 
-
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 42733d6..7f8b611 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -52,9 +52,7 @@ __device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float
 	if(!(path_flag & PATH_RAY_TRANSPARENT)) {
 		if(sample == 0) {
 			if(flag & PASS_DEPTH) {
-				Transform tfm = kernel_data.cam.worldtocamera;
-				float depth = len(transform_point(&tfm, sd->P));
-
+				float depth = camera_distance(kg, sd->P);
 				kernel_write_pass_float(buffer + kernel_data.film.pass_depth, sample, depth);
 			}
 			if(flag & PASS_OBJECT_ID) {
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index d606c3d..3588b09 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -16,10 +16,16 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef __OSL__
+#include "osl_shader.h"
+#endif
+
 #include "kernel_differential.h"
 #include "kernel_montecarlo.h"
 #include "kernel_projection.h"
 #include "kernel_object.h"
+#include "kernel_attribute.h"
+#include "kernel_projection.h"
 #include "kernel_triangle.h"
 #ifdef __QBVH__
 #include "kernel_qbvh.h"
@@ -326,15 +332,18 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 
 #ifdef __AO__
 		/* ambient occlusion */
-		if(kernel_data.integrator.use_ambient_occlusion) {
+		if(kernel_data.integrator.use_ambient_occlusion || (sd.flag & SD_AO)) {
 			/* todo: solve correlation */
 			float bsdf_u = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_U);
 			float bsdf_v = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_V);
 
+			float ao_factor = kernel_data.background.ao_factor;
+			float3 ao_N;
+			float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
 			float3 ao_D;
 			float ao_pdf;
 
-			sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
+			sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
 
 			if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
 				Ray light_ray;
@@ -343,14 +352,12 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 				light_ray.P = ray_offset(sd.P, sd.Ng);
 				light_ray.D = ao_D;
 				light_ray.t = kernel_data.background.ao_distance;
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 				light_ray.time = sd.time;
 #endif
 
-				if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
-					float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*kernel_data.background.ao_factor;
+				if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
 					path_radiance_accum_ao(&L, throughput, ao_bsdf, ao_shadow, state.bounce);
-				}
 			}
 		}
 #endif
@@ -368,7 +375,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 				BsdfEval L_light;
 				bool is_lamp;
 
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 				light_ray.time = sd.time;
 #endif
 
@@ -423,7 +430,12 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 		/* setup ray */
 		ray.P = ray_offset(sd.P, (label & LABEL_TRANSMIT)? -sd.Ng: sd.Ng);
 		ray.D = bsdf_omega_in;
-		ray.t = FLT_MAX;
+
+		if(state.bounce == 0)
+			ray.t -= sd.ray_length; /* clipping works through transparent */
+		else
+			ray.t = FLT_MAX;
+
 #ifdef __RAY_DIFFERENTIALS__
 		ray.dP = sd.dP;
 		ray.dD = bsdf_domega_in;
@@ -503,15 +515,18 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 
 #ifdef __AO__
 		/* ambient occlusion */
-		if(kernel_data.integrator.use_ambient_occlusion) {
+		if(kernel_data.integrator.use_ambient_occlusion || (sd.flag & SD_AO)) {
 			/* todo: solve correlation */
 			float bsdf_u = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_U);
 			float bsdf_v = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_V);
 
+			float ao_factor = kernel_data.background.ao_factor;
+			float3 ao_N;
+			float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
 			float3 ao_D;
 			float ao_pdf;
 
-			sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
+			sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
 
 			if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
 				Ray light_ray;
@@ -520,14 +535,12 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 				light_ray.P = ray_offset(sd.P, sd.Ng);
 				light_ray.D = ao_D;
 				light_ray.t = kernel_data.background.ao_distance;
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 				light_ray.time = sd.time;
 #endif
 
-				if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
-					float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*kernel_data.background.ao_factor;
+				if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
 					path_radiance_accum_ao(L, throughput, ao_bsdf, ao_shadow, state.bounce);
-				}
 			}
 		}
 #endif
@@ -545,7 +558,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 				BsdfEval L_light;
 				bool is_lamp;
 
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 				light_ray.time = sd.time;
 #endif
 
@@ -706,10 +719,12 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
 #ifdef __AO__
 		/* ambient occlusion */
-		if(kernel_data.integrator.use_ambient_occlusion) {
+		if(kernel_data.integrator.use_ambient_occlusion || (sd.flag & SD_AO)) {
 			int num_samples = kernel_data.integrator.ao_samples;
 			float num_samples_inv = 1.0f/num_samples;
 			float ao_factor = kernel_data.background.ao_factor;
+			float3 ao_N;
+			float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
 
 			for(int j = 0; j < num_samples; j++) {
 				/* todo: solve correlation */
@@ -719,7 +734,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 				float3 ao_D;
 				float ao_pdf;
 
-				sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
+				sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
 
 				if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
 					Ray light_ray;
@@ -728,14 +743,12 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 					light_ray.P = ray_offset(sd.P, sd.Ng);
 					light_ray.D = ao_D;
 					light_ray.t = kernel_data.background.ao_distance;
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 					light_ray.time = sd.time;
 #endif
 
-					if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
-						float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*ao_factor;
+					if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
 						path_radiance_accum_ao(&L, throughput*num_samples_inv, ao_bsdf, ao_shadow, state.bounce);
-					}
 				}
 			}
 		}
@@ -748,7 +761,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 			BsdfEval L_light;
 			bool is_lamp;
 
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 			light_ray.time = sd.time;
 #endif
 
@@ -867,7 +880,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 				bsdf_ray.dP = sd.dP;
 				bsdf_ray.dD = bsdf_domega_in;
 #endif
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 				bsdf_ray.time = sd.time;
 #endif
 
@@ -885,6 +898,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
 		path_state_next(kg, &state, LABEL_TRANSPARENT);
 		ray.P = ray_offset(sd.P, -sd.Ng);
+		ray.t -= sd.ray_length; /* clipping works through transparent */
 	}
 
 	float3 L_sum = path_radiance_sum(kg, &L);
@@ -925,7 +939,7 @@ __device void kernel_path_trace(KernelGlobals *kg,
 	float lens_u = path_rng(kg, &rng, sample, PRNG_LENS_U);
 	float lens_v = path_rng(kg, &rng, sample, PRNG_LENS_V);
 
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	float time = path_rng(kg, &rng, sample, PRNG_TIME);
 #else
 	float time = 0.0f;
diff --git a/intern/cycles/kernel/kernel_projection.h b/intern/cycles/kernel/kernel_projection.h
index 64747bc..6516b9e 100644
--- a/intern/cycles/kernel/kernel_projection.h
+++ b/intern/cycles/kernel/kernel_projection.h
@@ -98,7 +98,7 @@ __device float3 fisheye_to_direction(float u, float v, float fov)
 		return make_float3(0.0f, 0.0f, 0.0f);
 
 	float phi = acosf((r != 0.0f)? u/r: 0.0f);
-	float theta = asinf(r) * (fov / M_PI_F);
+	float theta = r * fov * 0.5f;
 
 	if(v < 0.0f) phi = -phi;
 
diff --git a/intern/cycles/kernel/kernel_qbvh.h b/intern/cycles/kernel/kernel_qbvh.h
deleted file mode 100644
index 525b616..0000000
--- a/intern/cycles/kernel/kernel_qbvh.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-CCL_NAMESPACE_BEGIN
-
-/*
- * "Persistent while-while kernel" used in:
- *
- * "Understanding the Efficiency of Ray Traversal on GPUs",
- * Timo Aila and Samuli Laine,
- * Proc. High-Performance Graphics 2009
- */
-
-/* bottom-most stack entry, indicating the end of traversal */
-
-#define ENTRYPOINT_SENTINEL 0x76543210
-/* 64 object BVH + 64 mesh BVH + 64 object node splitting */
-#define QBVH_STACK_SIZE 192
-#define QBVH_NODE_SIZE 8
-#define TRI_NODE_SIZE 3
-
-__device_inline float3 qbvh_inverse_direction(float3 dir)
-{
-	// Avoid divide by zero (ooeps = exp2f(-80.0f))
-	float ooeps = 0.00000000000000000000000082718061255302767487140869206996285356581211090087890625f;
-	float3 idir;
-
-	idir.x = 1.0f/((fabsf(dir.x) > ooeps)? dir.x: copysignf(ooeps, dir.x));
-	idir.y = 1.0f/((fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y));
-	idir.z = 1.0f/((fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z));
-
-	return idir;
-}
-
-__device_inline void qbvh_instance_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
-{
-	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
-
-	*P = transform_point(&tfm, ray->P);
-
-	float3 dir = transform_direction(&tfm, ray->D);
-
-	float len;
-	dir = normalize_len(dir, &len);
-
-	*idir = qbvh_inverse_direction(dir);
-
-	if(*t != FLT_MAX)
-		*t *= len;
-}
-
-__device_inline void qbvh_instance_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
-{
-	Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
-
-	if(*t != FLT_MAX)
-		*t *= len(transform_direction(&tfm, 1.0f/(*idir)));
-
-	*P = ray->P;
-	*idir = qbvh_inverse_direction(ray->D);
-}
-
-#ifdef __KERNEL_CPU__
-
-__device_inline void qbvh_node_intersect(KernelGlobals *kg, int *traverseChild,
-	int nodeAddrChild[4], float3 P, float3 idir, float t, int nodeAddr)
-{
-	/* X axis */
-	const __m128 bminx = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+0);
-	const __m128 t0x = _mm_mul_ps(_mm_sub_ps(bminx, _mm_set_ps1(P.x)), _mm_set_ps1(idir.x));
-	const __m128 bmaxx = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+1);
-	const __m128 t1x = _mm_mul_ps(_mm_sub_ps(bmaxx, _mm_set_ps1(P.x)), _mm_set_ps1(idir.x));
-
-	__m128 tmin = _mm_max_ps(_mm_min_ps(t0x, t1x), _mm_setzero_ps());
-	__m128 tmax = _mm_min_ps(_mm_max_ps(t0x, t1x), _mm_set_ps1(t));
-
-	/* Y axis */
-	const __m128 bminy = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+2);
-	const __m128 t0y = _mm_mul_ps(_mm_sub_ps(bminy, _mm_set_ps1(P.y)), _mm_set_ps1(idir.y));
-	const __m128 bmaxy = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+3);
-	const __m128 t1y = _mm_mul_ps(_mm_sub_ps(bmaxy, _mm_set_ps1(P.y)), _mm_set_ps1(idir.y));
-
-	tmin = _mm_max_ps(_mm_min_ps(t0y, t1y), tmin);
-	tmax = _mm_min_ps(_mm_max_ps(t0y, t1y), tmax);
-
-	/* Z axis */
-	const __m128 bminz = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+4);
-	const __m128 t0z = _mm_mul_ps(_mm_sub_ps(bminz, _mm_set_ps1(P.z)), _mm_set_ps1(idir.z));
-	const __m128 bmaxz = kernel_tex_fetch_m128(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+5);
-	const __m128 t1z = _mm_mul_ps(_mm_sub_ps(bmaxz, _mm_set_ps1(P.z)), _mm_set_ps1(idir.z));
-
-	tmin = _mm_max_ps(_mm_min_ps(t0z, t1z), tmin);
-	tmax = _mm_min_ps(_mm_max_ps(t0z, t1z), tmax);
-
-	/* compare and get mask */
-	*traverseChild = _mm_movemask_ps(_mm_cmple_ps(tmin, tmax));
-
-	/* get node addresses */
-	float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+6);
-
-	nodeAddrChild[0] = __float_as_int(cnodes.x);
-	nodeAddrChild[1] = __float_as_int(cnodes.y);
-	nodeAddrChild[2] = __float_as_int(cnodes.z);
-	nodeAddrChild[3] = __float_as_int(cnodes.w);
-}
-
-#else
-
-__device_inline bool qbvh_bb_intersect(float3 bmin, float3 bmax, float3 P, float3 idir, float t)
-{
-	float t0x = (bmin.x - P.x)*idir.x;
-	float t1x = (bmax.x - P.x)*idir.x;
-	float t0y = (bmin.y - P.y)*idir.y;
-	float t1y = (bmax.y - P.y)*idir.y;
-	float t0z = (bmin.z - P.z)*idir.z;
-	float t1z = (bmax.z - P.z)*idir.z;
-
-	float minx = min(t0x, t1x);
-	float maxx = max(t0x, t1x);
-	float miny = min(t0y, t1y);
-	float maxy = max(t0y, t1y);
-	float minz = min(t0z, t1z);
-	float maxz = max(t0z, t1z);
-
-	float tmin = max4(0.0f, minx, miny, minz);
-	float tmax = min4(t, maxx, maxy, maxz);
-
-	return (tmin <= tmax);
-}
-
-/* intersect four bounding boxes */
-__device_inline void qbvh_node_intersect(KernelGlobals *kg, int *traverseChild,
-	int nodeAddrChild[4], float3 P, float3 idir, float t, int nodeAddr)
-{
-	/* fetch node data */
-	float4 minx = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+0);
-	float4 miny = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+2);
-	float4 minz = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+4);
-	float4 maxx = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+1);
-	float4 maxy = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+3);
-	float4 maxz = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+5);
-
-	/* intersect bounding boxes */
-	bool traverseChild0 = qbvh_bb_intersect(make_float3(minx.x, miny.x, minz.x), make_float3(maxx.x, maxy.x, maxz.x), P, idir, t);
-	bool traverseChild1 = qbvh_bb_intersect(make_float3(minx.y, miny.y, minz.y), make_float3(maxx.y, maxy.y, maxz.y), P, idir, t);
-	bool traverseChild2 = qbvh_bb_intersect(make_float3(minx.z, miny.z, minz.z), make_float3(maxx.z, maxy.z, maxz.z), P, idir, t);
-	bool traverseChild3 = qbvh_bb_intersect(make_float3(minx.w, miny.w, minz.w), make_float3(maxx.w, maxy.w, maxz.w), P, idir, t);
-
-	*traverseChild = 0;
-	if(traverseChild0) *traverseChild |= 1;
-	if(traverseChild1) *traverseChild |= 2;
-	if(traverseChild2) *traverseChild |= 4;
-	if(traverseChild3) *traverseChild |= 8;
-
-	/* get node addresses */
-	float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr*QBVH_NODE_SIZE+6);
-
-	nodeAddrChild[0] = __float_as_int(cnodes.x);
-	nodeAddrChild[1] = __float_as_int(cnodes.y);
-	nodeAddrChild[2] = __float_as_int(cnodes.z);
-	nodeAddrChild[3] = __float_as_int(cnodes.w);
-}
-
-#endif
-
-/* Sven Woop's algorithm */
-__device_inline void qbvh_triangle_intersect(KernelGlobals *kg, Intersection *isect, float3 P, float3 idir, int object, int triAddr)
-{
-	/* compute and check intersection t-value */
-	float4 v00 = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0);
-	float4 v11 = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1);
-	float3 dir = 1.0f/idir;
-
-	float Oz = v00.w - P.x*v00.x - P.y*v00.y - P.z*v00.z;
-	float invDz = 1.0f/(dir.x*v00.x + dir.y*v00.y + dir.z*v00.z);
-	float t = Oz * invDz;
-
-	if(t > 0.0f && t < isect->t) {
-		/* compute and check barycentric u */
-		float Ox = v11.w + P.x*v11.x + P.y*v11.y + P.z*v11.z;
-		float Dx = dir.x*v11.x + dir.y*v11.y + dir.z*v11.z;
-		float u = Ox + t*Dx;
-
-		if(u >= 0.0f) {
-			/* compute and check barycentric v */
-			float4 v22 = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2);
-			float Oy = v22.w + P.x*v22.x + P.y*v22.y + P.z*v22.z;
-			float Dy = dir.x*v22.x + dir.y*v22.y + dir.z*v22.z;
-			float v = Oy + t*Dy;
-
-			if(v >= 0.0f && u + v <= 1.0f) {
-				/* record intersection */
-				isect->prim = triAddr;
-				isect->object = object;
-				isect->u = u;
-				isect->v = v;
-				isect->t = t;
-			}
-		}
-	}
-}
-
-__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const bool isshadowray, Intersection *isect)
-{
-	/* traversal stack in CUDA thread-local memory */
-	int traversalStack[QBVH_STACK_SIZE];
-	traversalStack[0] = ENTRYPOINT_SENTINEL;
-
-	/* traversal variables in registers */
-	int stackPtr = 0;
-	int nodeAddr = kernel_data.bvh.root;
-
-	/* ray parameters in registers */
-	const float tmax = ray->t;
-	float3 P = ray->P;
-	float3 idir = qbvh_inverse_direction(ray->D);
-	int object = ~0;
-
-	isect->t = tmax;
-	isect->object = ~0;
-	isect->prim = ~0;
-	isect->u = 0.0f;
-	isect->v = 0.0f;
-
-	/* traversal loop */
-	do {
-		do
-		{
-			/* traverse internal nodes */
-			while(nodeAddr >= 0 && nodeAddr != ENTRYPOINT_SENTINEL)
-			{
-				int traverseChild, nodeAddrChild[4];
-
-				qbvh_node_intersect(kg, &traverseChild, nodeAddrChild,
-					P, idir, isect->t, nodeAddr);
-
-				if(traverseChild & 1) {
-					++stackPtr;
-					traversalStack[stackPtr] = nodeAddrChild[0];
-				}
-
-				if(traverseChild & 2) {
-					++stackPtr;
-					traversalStack[stackPtr] = nodeAddrChild[1];
-				}
-				if(traverseChild & 4) {
-					++stackPtr;
-					traversalStack[stackPtr] = nodeAddrChild[2];
-				}
-
-				if(traverseChild & 8) {
-					++stackPtr;
-					traversalStack[stackPtr] = nodeAddrChild[3];
-				}
-
-				nodeAddr = traversalStack[stackPtr];
-				--stackPtr;
-			}
-
-			/* if node is leaf, fetch triangle list */
-			if(nodeAddr < 0) {
-				float4 leaf = kernel_tex_fetch(__bvh_nodes, (-nodeAddr-1)*QBVH_NODE_SIZE+(QBVH_NODE_SIZE-2));
-				int primAddr = __float_as_int(leaf.x);
-
-#ifdef __INSTANCING__
-				if(primAddr >= 0) {
-#endif
-					int primAddr2 = __float_as_int(leaf.y);
-
-					/* pop */
-					nodeAddr = traversalStack[stackPtr];
-					--stackPtr;
-
-					/* triangle intersection */
-					while(primAddr < primAddr2) {
-						/* intersect ray against triangle */
-						qbvh_triangle_intersect(kg, isect, P, idir, object, primAddr);
-
-						/* shadow ray early termination */
-						if(isshadowray && isect->prim != ~0)
-							return true;
-
-						primAddr++;
-					}
-#ifdef __INSTANCING__
-				}
-				else {
-					/* instance push */
-					object = kernel_tex_fetch(__prim_object, -primAddr-1);
-
-					qbvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
-
-					++stackPtr;
-					traversalStack[stackPtr] = ENTRYPOINT_SENTINEL;
-
-					nodeAddr = kernel_tex_fetch(__object_node, object);
-				}
-#endif
-			}
-		} while(nodeAddr != ENTRYPOINT_SENTINEL);
-
-#ifdef __INSTANCING__
-		if(stackPtr >= 0) {
-			kernel_assert(object != ~0);
-
-			/* instance pop */
-			qbvh_instance_pop(kg, object, ray, &P, &idir, &isect->t, tmax);
-			object = ~0;
-			nodeAddr = traversalStack[stackPtr];
-			--stackPtr;
-		}
-#endif
-	} while(nodeAddr != ENTRYPOINT_SENTINEL);
-
-	return (isect->prim != ~0);
-}
-
-__device_inline float3 ray_offset(float3 P, float3 Ng)
-{
-#ifdef __INTERSECTION_REFINE__
-	const float epsilon_f = 1e-5f;
-	const int epsilon_i = 32;
-
-	float3 res;
-
-	/* x component */
-	if(fabsf(P.x) < epsilon_f) {
-		res.x = P.x + Ng.x*epsilon_f;
-	}
-	else {
-		uint ix = __float_as_uint(P.x);
-		ix += ((ix ^ __float_as_uint(Ng.x)) >> 31)? -epsilon_i: epsilon_i;
-		res.x = __uint_as_float(ix);
-	}
-
-	/* y component */
-	if(fabsf(P.y) < epsilon_f) {
-		res.y = P.y + Ng.y*epsilon_f;
-	}
-	else {
-		uint iy = __float_as_uint(P.y);
-		iy += ((iy ^ __float_as_uint(Ng.y)) >> 31)? -epsilon_i: epsilon_i;
-		res.y = __uint_as_float(iy);
-	}
-
-	/* z component */
-	if(fabsf(P.z) < epsilon_f) {
-		res.z = P.z + Ng.z*epsilon_f;
-	}
-	else {
-		uint iz = __float_as_uint(P.z);
-		iz += ((iz ^ __float_as_uint(Ng.z)) >> 31)? -epsilon_i: epsilon_i;
-		res.z = __uint_as_float(iz);
-	}
-
-	return res;
-#else
-	const float epsilon_f = 1e-4f;
-	return P + epsilon_f*Ng;
-#endif
-}
-
-__device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection *isect, const Ray *ray)
-{
-	float3 P = ray->P;
-	float3 D = ray->D;
-	float t = isect->t;
-
-#ifdef __INTERSECTION_REFINE__
-	if(isect->object != ~0) {
-		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
-
-		P = transform_point(&tfm, P);
-		D = transform_direction(&tfm, D*t);
-		D = normalize_len(D, &t);
-	}
-
-	P = P + D*t;
-
-	float4 v00 = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0);
-	float Oz = v00.w - P.x*v00.x - P.y*v00.y - P.z*v00.z;
-	float invDz = 1.0f/(D.x*v00.x + D.y*v00.y + D.z*v00.z);
-	float rt = Oz * invDz;
-
-	P = P + D*rt;
-
-	if(isect->object != ~0) {
-		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
-		P = transform_point(&tfm, P);
-	}
-
-	return P;
-#else
-	return P + D*t;
-#endif
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index b57e27b..98a7ec5 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -26,28 +26,38 @@
  *
  */
 
-#ifdef __OSL__
-
-#include "osl_shader.h"
-
-#endif
+#include "closure/bsdf.h"
+#include "closure/emissive.h"
+#include "closure/volume.h"
 
-#include "svm/bsdf.h"
-#include "svm/emissive.h"
-#include "svm/volume.h"
 #include "svm/svm_bsdf.h"
 #include "svm/svm.h"
 
-
 CCL_NAMESPACE_BEGIN
 
 /* ShaderData setup from incoming ray */
 
+#ifdef __OBJECT_MOTION__
+__device_noinline void shader_setup_object_transforms(KernelGlobals *kg, ShaderData *sd, float time)
+{
+	/* note that this is a separate non-inlined function to work around crash
+	 * on CUDA sm 2.0, otherwise kernel execution crashes (compiler bug?) */
+	if(sd->flag & SD_OBJECT_MOTION) {
+		sd->ob_tfm = object_fetch_transform_motion(kg, sd->object, time);
+		sd->ob_itfm= transform_quick_inverse(sd->ob_tfm);
+	}
+	else {
+		sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
+		sd->ob_itfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
+	}
+}
+#endif
+
 __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
 	const Intersection *isect, const Ray *ray)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::init(kg, sd);
 #endif
 
@@ -67,11 +77,12 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
 	sd->v = isect->v;
 #endif
 
-	/* matrices and time */
-#ifdef __MOTION__
-	sd->ob_tfm = object_fetch_transform(kg, sd->object, ray->time, OBJECT_TRANSFORM);
-	sd->ob_itfm = object_fetch_transform(kg, sd->object, ray->time, OBJECT_INVERSE_TRANSFORM);
+	sd->flag = kernel_tex_fetch(__shader_flag, (shader & SHADER_MASK)*2);
+	sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
 
+	/* matrices and time */
+#ifdef __OBJECT_MOTION__
+	shader_setup_object_transforms(kg, sd, ray->time);
 	sd->time = ray->time;
 #endif
 
@@ -87,9 +98,6 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
 	if(sd->shader & SHADER_SMOOTH_NORMAL)
 		sd->N = triangle_smooth_normal(kg, sd->prim, sd->u, sd->v);
 
-	sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
-	sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
-
 #ifdef __DPDU__
 	/* dPdu/dPdv */
 	triangle_dPdudv(kg, &sd->dPdu, &sd->dPdv, sd->prim);
@@ -135,7 +143,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
 	int shader, int object, int prim, float u, float v, float t, float time)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::init(kg, sd);
 #endif
 
@@ -171,11 +179,17 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
 	}
 #endif
 
-#ifdef __MOTION__
-	sd->time = time;
+	sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
+	if(sd->object != -1) {
+		sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
+
+#ifdef __OBJECT_MOTION__
+		shader_setup_object_transforms(kg, sd, time);
+	}
 
-	sd->ob_tfm = object_fetch_transform(kg, sd->object, time, OBJECT_TRANSFORM);
-	sd->ob_itfm = object_fetch_transform(kg, sd->object, time, OBJECT_INVERSE_TRANSFORM);
+	sd->time = time;
+#else
+	}
 #endif
 
 	/* smooth normal */
@@ -188,10 +202,6 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
 #endif
 	}
 
-	sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
-	if(sd->object != -1)
-		sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
-
 #ifdef __DPDU__
 	/* dPdu/dPdv */
 	if(sd->prim == ~0) {
@@ -264,7 +274,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
 __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::init(kg, sd);
 #endif
 
@@ -275,7 +285,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData
 	sd->I = -sd->P;
 	sd->shader = kernel_data.background.shader;
 	sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
-#ifdef __MOTION__
+#ifdef __OBJECT_MOTION__
 	sd->time = ray->time;
 #endif
 	sd->ray_length = 0.0f;
@@ -373,7 +383,7 @@ __device void shader_bsdf_eval(KernelGlobals *kg, const ShaderData *sd,
 	bsdf_eval_init(eval, NBUILTIN_CLOSURES, make_float3(0.0f, 0.0f, 0.0f), kernel_data.film.use_light_pass);
 
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		return _shader_bsdf_multi_eval_osl(sd, omega_in, pdf, -1, eval, 0.0f, 0.0f);
 	else
 #endif
@@ -430,7 +440,7 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
 
 	*pdf = 0.0f;
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf);
 	else
 #endif
@@ -442,7 +452,7 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
 		if(sd->num_closure > 1) {
 			float sweight = sc->sample_weight;
 #ifdef __OSL__
-			if (kernel_osl_use(kg))
+			if (kg->osl)
 				_shader_bsdf_multi_eval_osl(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
 			else
 #endif
@@ -469,7 +479,7 @@ __device int shader_bsdf_sample_closure(KernelGlobals *kg, const ShaderData *sd,
 
 	*pdf = 0.0f;
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf);
 	else
 #endif
@@ -483,18 +493,22 @@ __device int shader_bsdf_sample_closure(KernelGlobals *kg, const ShaderData *sd,
 
 __device void shader_bsdf_blur(KernelGlobals *kg, ShaderData *sd, float roughness)
 {
-#ifndef __OSL__
 #ifdef __MULTI_CLOSURE__
 	for(int i = 0; i< sd->num_closure; i++) {
 		ShaderClosure *sc = &sd->closure[i];
 
-		if(CLOSURE_IS_BSDF(sc->type))
-			svm_bsdf_blur(sc, roughness);
+		if(CLOSURE_IS_BSDF(sc->type)) {
+#ifdef __OSL__
+			if (kg->osl)
+				OSLShader::bsdf_blur(sc, roughness);
+			else
+#endif
+				svm_bsdf_blur(sc, roughness);
+		}
 	}
 #else
 	svm_bsdf_blur(&sd->closure, roughness);
 #endif
-#endif
 }
 
 __device float3 shader_bsdf_transparency(KernelGlobals *kg, ShaderData *sd)
@@ -581,6 +595,44 @@ __device float3 shader_bsdf_transmission(KernelGlobals *kg, ShaderData *sd)
 #endif
 }
 
+__device float3 shader_bsdf_ao(KernelGlobals *kg, ShaderData *sd, float ao_factor, float3 *N)
+{
+#ifdef __MULTI_CLOSURE__
+	float3 eval = make_float3(0.0f, 0.0f, 0.0f);
+
+	*N = make_float3(0.0f, 0.0f, 0.0f);
+
+	for(int i = 0; i< sd->num_closure; i++) {
+		ShaderClosure *sc = &sd->closure[i];
+
+		if(CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
+			eval += sc->weight*ao_factor;
+			*N += sc->N*average(sc->weight);
+		}
+		if(CLOSURE_IS_AMBIENT_OCCLUSION(sc->type)) {
+			eval += sc->weight;
+			*N += sd->N*average(sc->weight);
+		}
+	}
+
+	if(is_zero(*N))
+		*N = sd->N;
+	else
+		*N = normalize(*N);
+
+	return eval;
+#else
+	*N = sd->N;
+
+	if(CLOSURE_IS_BSDF_DIFFUSE(sd->closure.type))
+		return sd->closure.weight*ao_factor;
+	else if(CLOSURE_IS_AMBIENT_OCCLUSION(sd->closure.type))
+		return sd->closure.weight;
+	else
+		return make_float3(0.0f, 0.0f, 0.0f);
+#endif
+}
+
 /* Emission */
 
 __device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd)
@@ -594,7 +646,7 @@ __device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd)
 
 		if(CLOSURE_IS_EMISSION(sc->type)) {
 #ifdef __OSL__
-			if (kernel_osl_use(kg))
+			if (kg->osl)
 				eval += OSLShader::emissive_eval(sd, sc)*sc->weight;
 			else
 #endif
@@ -638,7 +690,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd,
 	float randb, int path_flag)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::eval_surface(kg, sd, randb, path_flag);
 	else
 #endif
@@ -646,7 +698,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd,
 #ifdef __SVM__
 		svm_eval_nodes(kg, sd, SHADER_TYPE_SURFACE, randb, path_flag);
 #else
-		bsdf_diffuse_setup(sd, &sd->closure);
+		bsdf_diffuse_setup(&sd->closure);
 		sd->closure.weight = make_float3(0.8f, 0.8f, 0.8f);
 #endif
 	}
@@ -657,7 +709,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd,
 __device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		return OSLShader::eval_background(kg, sd, path_flag);
 	else
 #endif
@@ -703,17 +755,17 @@ __device float3 shader_volume_eval_phase(KernelGlobals *kg, ShaderData *sd,
 
 		if(CLOSURE_IS_VOLUME(sc->type)) {
 #ifdef __OSL__
-			if (kernel_osl_use(kg))
-				eval += OSLShader::volume_eval_phase(sd, sc, omega_in, omega_out);
+			if (kg->osl)
+				eval += OSLShader::volume_eval_phase(sc, omega_in, omega_out);
 			else
 #endif
-				eval += volume_eval_phase(sd, sc, omega_in, omega_out);
+				eval += volume_eval_phase(sc, omega_in, omega_out);
 		}
 	}
 
 	return eval;
 #else
-	return volume_eval_phase(sd, &sd->closure, omega_in, omega_out);
+	return volume_eval_phase(&sd->closure, omega_in, omega_out);
 #endif
 }
 
@@ -724,7 +776,7 @@ __device void shader_eval_volume(KernelGlobals *kg, ShaderData *sd,
 {
 #ifdef __SVM__
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::eval_volume(kg, sd, randb, path_flag);
 	else
 #endif
@@ -739,7 +791,7 @@ __device void shader_eval_displacement(KernelGlobals *kg, ShaderData *sd)
 	/* this will modify sd->P */
 #ifdef __SVM__
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::eval_displacement(kg, sd);
 	else
 #endif
@@ -795,7 +847,7 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
 __device void shader_release(KernelGlobals *kg, ShaderData *sd)
 {
 #ifdef __OSL__
-	if (kernel_osl_use(kg))
+	if (kg->osl)
 		OSLShader::release(kg, sd);
 #endif
 }
diff --git a/intern/cycles/kernel/kernel_triangle.h b/intern/cycles/kernel/kernel_triangle.h
index f57c59a..0db4472 100644
--- a/intern/cycles/kernel/kernel_triangle.h
+++ b/intern/cycles/kernel/kernel_triangle.h
@@ -16,9 +16,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "kernel_attribute.h"
-#include "kernel_projection.h"
-
 CCL_NAMESPACE_BEGIN
 
 /* Point on triangle for Moller-Trumbore triangles */
@@ -68,6 +65,17 @@ __device_inline float3 triangle_normal_MT(KernelGlobals *kg, int tri_index, int
 #endif
 }
 
+/* Return 3 triangle vertex locations */
+__device_inline void triangle_vertices(KernelGlobals *kg, int tri_index, float3 P[3])
+{
+	/* load triangle vertices */
+	float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, tri_index));
+
+	P[0] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x)));
+	P[1] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y)));
+	P[2] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z)));
+}
+
 __device_inline float3 triangle_smooth_normal(KernelGlobals *kg, int tri_index, float u, float v)
 {
 	/* load triangle vertices */
@@ -201,10 +209,10 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)
 	 * transformation was set match the world/object space of motion_pre/post */
 	Transform tfm;
 	
-	tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM_MOTION_PRE);
+	tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM_MOTION_PRE);
 	motion_pre = transform_point(&tfm, motion_pre);
 
-	tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM_MOTION_POST);
+	tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM_MOTION_POST);
 	motion_post = transform_point(&tfm, motion_post);
 
 	float3 P;
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 48e271a..e3a766e 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -36,6 +36,8 @@ CCL_NAMESPACE_BEGIN
 #define PARTICLE_SIZE 		5
 #define TIME_INVALID		FLT_MAX
 
+#define TEX_NUM_FLOAT_IMAGES	5
+
 /* device capabilities */
 #ifdef __KERNEL_CPU__
 #define __KERNEL_SHADING__
@@ -100,6 +102,7 @@ CCL_NAMESPACE_BEGIN
 #define __IMAGE_TEXTURES__
 #define __EXTRA_NODES__
 #define __HOLDOUT__
+#define __NORMAL_MAP__
 #endif
 
 #ifdef __KERNEL_ADV_SHADING__
@@ -108,11 +111,12 @@ CCL_NAMESPACE_BEGIN
 #define __PASSES__
 #define __BACKGROUND_MIS__
 #define __AO__
-//#define __MOTION__
+#define __CAMERA_MOTION__
+#define __ANISOTROPIC__
+#define __OBJECT_MOTION__
 #endif
 
 //#define __SOBOL_FULL_SCREEN__
-//#define __QBVH__
 
 /* Shader Evaluation */
 
@@ -129,7 +133,7 @@ enum PathTraceDimension {
 	PRNG_FILTER_V = 1,
 	PRNG_LENS_U = 2,
 	PRNG_LENS_V = 3,
-#ifdef __MOTION__
+#ifdef __CAMERA_MOTION__
 	PRNG_TIME = 4,
 	PRNG_UNUSED = 5,
 	PRNG_BASE_NUM = 6,
@@ -148,9 +152,7 @@ enum PathTraceDimension {
 	PRNG_BOUNCE_NUM = 8
 };
 
-/* these flag values correspond exactly to OSL defaults, so be careful not to
- * change this, or if you do, set the "raytypes" shading system attribute with
- * your own new ray types and bitflag values.
+/* these flags values correspond to raytypes in osl.cpp, so keep them in sync!
  *
  * for ray visibility tests in BVH traversal, the upper 20 bits are used for
  * layer visibility tests. */
@@ -364,12 +366,17 @@ typedef struct ShaderClosure {
 	float sample_weight;
 #endif
 
-#ifdef __OSL__
-	void *prim;
-#endif
 	float data0;
 	float data1;
 
+	float3 N;
+#ifdef __ANISOTROPIC__
+	float3 T;
+#endif
+
+#ifdef __OSL__
+	void *prim;
+#endif
 } ShaderClosure;
 
 /* Shader Data
@@ -386,16 +393,18 @@ enum ShaderDataFlag {
 	SD_BSDF_GLOSSY = 16,	/* have glossy bsdf */
 	SD_HOLDOUT = 32,		/* have holdout closure? */
 	SD_VOLUME = 64,			/* have volume closure? */
+	SD_AO = 128,			/* have ao closure? */
 
 	/* shader flags */
-	SD_SAMPLE_AS_LIGHT = 128,			/* direct light sample */
-	SD_HAS_SURFACE_TRANSPARENT = 256,	/* has surface transparency */
-	SD_HAS_VOLUME = 512,				/* has volume shader */
-	SD_HOMOGENEOUS_VOLUME = 1024,		/* has homogeneous volume */
+	SD_SAMPLE_AS_LIGHT = 256,			/* direct light sample */
+	SD_HAS_SURFACE_TRANSPARENT = 512,	/* has surface transparency */
+	SD_HAS_VOLUME = 1024,				/* has volume shader */
+	SD_HOMOGENEOUS_VOLUME = 2048,		/* has homogeneous volume */
 
 	/* object flags */
-	SD_HOLDOUT_MASK = 2048,				/* holdout for camera rays */
-	SD_OBJECT_MOTION = 4096				/* has object motion blur */
+	SD_HOLDOUT_MASK = 4096,				/* holdout for camera rays */
+	SD_OBJECT_MOTION = 8192,			/* has object motion blur */
+	SD_TRANSFORM_APPLIED = 16384 		/* vertices have transform applied */
 };
 
 typedef struct ShaderData {
@@ -408,7 +417,7 @@ typedef struct ShaderData {
 	/* view/incoming direction */
 	float3 I;
 	/* shader id */
-	int shader;	
+	int shader;
 	/* booleans describing shader, see ShaderDataFlag */
 	int flag;
 
@@ -426,13 +435,6 @@ typedef struct ShaderData {
 	/* length of the ray being shaded */
 	float ray_length;
 
-#ifdef __MOTION__
-	/* object <-> world space transformations, cached to avoid
-	 * re-interpolating them constantly for shading */
-	Transform ob_tfm;
-	Transform ob_itfm;
-#endif
-
 #ifdef __RAY_DIFFERENTIALS__
 	/* differential of P. these are orthogonal to Ng, not N */
 	differential3 dP;
@@ -448,6 +450,13 @@ typedef struct ShaderData {
 	float3 dPdu, dPdv;
 #endif
 
+#ifdef __OBJECT_MOTION__
+	/* object <-> world space transformations, cached to avoid
+	 * re-interpolating them constantly for shading */
+	Transform ob_tfm;
+	Transform ob_itfm;
+#endif
+
 #ifdef __MULTI_CLOSURE__
 	/* Closure data, we store a fixed array of closures */
 	ShaderClosure closure[MAX_CLOSURE];
@@ -511,7 +520,9 @@ typedef struct KernelCamera {
 	/* more matrices */
 	Transform screentoworld;
 	Transform rastertoworld;
-	Transform ndctoworld;
+	/* work around cuda sm 2.0 crash, this seems to
+	 * cross some limit in combination with motion 
+	 * Transform ndctoworld; */
 	Transform worldtoscreen;
 	Transform worldtoraster;
 	Transform worldtondc;
@@ -627,7 +638,8 @@ typedef struct KernelBVH {
 	/* root node */
 	int root;
 	int attributes_map_stride;
-	int pad1, pad2;
+	int have_motion;
+	int pad2;
 } KernelBVH;
 
 typedef struct KernelData {
diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt
index 65d7a7a..1b1bb55 100644
--- a/intern/cycles/kernel/osl/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/CMakeLists.txt
@@ -7,28 +7,18 @@ set(INC
 	../../util
 	../../device
 )
+
 set(INC_SYS
+
 )
 
 set(SRC
 	background.cpp
-	bsdf_ashikhmin_velvet.cpp
-	bsdf_diffuse.cpp
-	bsdf_oren_nayar.cpp
-	bsdf_phong.cpp
-	bsdf_microfacet.cpp
-	bsdf_reflection.cpp
-	bsdf_refraction.cpp
-	bsdf_transparent.cpp
-	bsdf_ward.cpp
-	bsdf_westin.cpp
-	bssrdf.cpp
-	debug.cpp
+	bsdf_phong_ramp.cpp
 	emissive.cpp
 	osl_closures.cpp
 	osl_services.cpp
 	osl_shader.cpp
-	vol_subsurface.cpp
 )
 
 set(HEADER_SRC
@@ -45,4 +35,3 @@ include_directories(SYSTEM ${INC_SYS})
 
 add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC})
 
-add_subdirectory(nodes)
diff --git a/intern/cycles/kernel/osl/SConscript b/intern/cycles/kernel/osl/SConscript
new file mode 100644
index 0000000..d4b42d2
--- /dev/null
+++ b/intern/cycles/kernel/osl/SConscript
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+Import('env')
+
+defs = []
+incs = []
+cxxflags = Split(env['CXXFLAGS'])
+
+sources = env.Glob('*.cpp')
+
+incs.extend('. .. ../svm ../../render ../../util ../../device'.split())
+incs.append(env['BF_OIIO_INC'])
+incs.append(env['BF_BOOST_INC'])
+incs.append(env['BF_OSL_INC'])
+incs.append(env['BF_OPENEXR_INC'].split())
+
+defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
+defs.append('CCL_NAMESPACE_END=}')
+defs.append('WITH_OSL')
+
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+    cxxflags.append('-DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
+    incs.append(env['BF_PTHREADS_INC'])
+else:
+    cxxflags.append('-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
+
+env.BlenderLib ('cycles_kernel_osl', sources, incs, defs, libtype=['intern'], priority=[10], cxx_compileflags=cxxflags)
diff --git a/intern/cycles/kernel/osl/background.cpp b/intern/cycles/kernel/osl/background.cpp
index 6290eed..eed4446 100644
--- a/intern/cycles/kernel/osl/background.cpp
+++ b/intern/cycles/kernel/osl/background.cpp
@@ -46,23 +46,16 @@ using namespace OSL;
 /// to return a color in background shaders. No methods,
 /// only the weight is taking into account
 ///
-class GenericBackgroundClosure : public BackgroundClosure {
+class GenericBackgroundClosure : public OSL::BackgroundClosure {
 public:
 	GenericBackgroundClosure() {}
 
 	void setup() {};
-
 	size_t memsize() const { return sizeof(*this); }
-
 	const char *name() const { return "background"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " ()";
-	}
-
+	void print_on(std::ostream &out) const { out << name() << " ()"; }
 };
 
-
 /// Holdout closure
 ///
 /// This will be used by the shader to mark the
@@ -75,16 +68,26 @@ public:
 	HoldoutClosure () : ClosurePrimitive(Holdout) {}
 
 	void setup() {};
-
 	size_t memsize() const { return sizeof(*this); }
-
 	const char *name() const { return "holdout"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " ()";
-	}
+	void print_on(std::ostream &out) const { out << name() << " ()"; }
 };
 
+/// ambient occlusion closure
+///
+/// We only have a ambient occlusion closure for the shaders
+/// to return a color in ambient occlusion shaders. No methods,
+/// only the weight is taking into account
+///
+class AmbientOcclusionClosure : public ClosurePrimitive {
+public:
+	AmbientOcclusionClosure () : ClosurePrimitive((ClosurePrimitive::Category)AmbientOcclusion) {}
+
+	void setup() {};
+	size_t memsize() const { return sizeof(*this); }
+	const char *name() const { return "ambient_occlusion"; }
+	void print_on(std::ostream &out) const { out << name() << " ()"; }
+};
 
 ClosureParam *closure_background_params()
 {
@@ -107,5 +110,16 @@ ClosureParam *closure_holdout_params()
 
 CLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)
 
+ClosureParam *closure_ambient_occlusion_params()
+{
+	static ClosureParam params[] = {
+	    CLOSURE_STRING_KEYPARAM("label"),
+	    CLOSURE_FINISH_PARAM(AmbientOcclusionClosure)
+	};
+	return params;
+}
+
+CLOSURE_PREPARE(closure_ambient_occlusion_prepare, AmbientOcclusionClosure)
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp b/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp
deleted file mode 100644
index a1904d7..0000000
--- a/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class AshikhminVelvetClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_sigma;
-	float m_invsigma2;
-
-	AshikhminVelvetClosure() : BSDFClosure(Labels::DIFFUSE) {}
-
-	void setup()
-	{
-		m_sigma = max(m_sigma, 0.01f);
-		m_invsigma2 = 1.0f / (m_sigma * m_sigma);
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const AshikhminVelvetClosure *comp = (const AshikhminVelvetClosure *)other;
-		return m_N == comp->m_N && m_sigma == comp->m_sigma &&
-		       BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "ashikhmin_velvet"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_sigma;
-		out << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO > 0 && cosNI > 0) {
-			Vec3 H = omega_in + omega_out;
-			H.normalize();
-
-			float cosNH = m_N.dot(H);
-			float cosHO = fabsf(omega_out.dot(H));
-
-			if(!(fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f))
-				return Color3(0, 0, 0);
-
-			float cosNHdivHO = cosNH / cosHO;
-			cosNHdivHO = max(cosNHdivHO, 1e-5f);
-
-			float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
-			float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
-
-			float sinNH2 = 1 - cosNH * cosNH;
-			float sinNH4 = sinNH2 * sinNH2;
-			float cotangent2 =  (cosNH * cosNH) / sinNH2;
-
-			float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * float(M_1_PI) / sinNH4;
-			float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
-
-			float out = 0.25f * (D * G) / cosNO;
-
-			pdf = 0.5f * (float) M_1_PI;
-			return Color3(out, out, out);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// we are viewing the surface from above - send a ray out with uniform
-		// distribution over the hemisphere
-		sample_uniform_hemisphere(m_N, omega_out, randu, randv, omega_in, pdf);
-		if (Ng.dot(omega_in) > 0) {
-			Vec3 H = omega_in + omega_out;
-			H.normalize();
-
-			float cosNI = m_N.dot(omega_in);
-			float cosNO = m_N.dot(omega_out);
-			float cosNH = m_N.dot(H);
-			float cosHO = fabsf(omega_out.dot(H));
-
-			if(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f) {
-				float cosNHdivHO = cosNH / cosHO;
-				cosNHdivHO = max(cosNHdivHO, 1e-5f);
-
-				float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
-				float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
-
-				float sinNH2 = 1 - cosNH * cosNH;
-				float sinNH4 = sinNH2 * sinNH2;
-				float cotangent2 =  (cosNH * cosNH) / sinNH2;
-
-				float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * float(M_1_PI) / sinNH4;
-				float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
-
-				float power = 0.25f * (D * G) / cosNO;
-
-				eval.setValue(power, power, power);
-
-				// TODO: find a better approximation for the retroreflective bounce
-				domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-				domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-				domega_in_dx *= 125;
-				domega_in_dy *= 125;
-			}
-			else
-				pdf = 0;
-		}
-		else
-			pdf = 0;
-		return Labels::REFLECT;
-	}
-
-};
-
-
-
-ClosureParam *bsdf_ashikhmin_velvet_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, m_N),
-	    CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, m_sigma),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(AshikhminVelvetClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_ashikhmin_velvet_prepare, AshikhminVelvetClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_diffuse.cpp b/intern/cycles/kernel/osl/bsdf_diffuse.cpp
deleted file mode 100644
index 1e06d3b..0000000
--- a/intern/cycles/kernel/osl/bsdf_diffuse.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class DiffuseClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-
-	DiffuseClosure() : BSDFClosure(Labels::DIFFUSE) {}
-
-	void setup() {};
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const DiffuseClosure *comp = (const DiffuseClosure *)other;
-		return m_N == comp->m_N && BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "diffuse"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " ((" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "))";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		float cos_pi = max(m_N.dot(omega_in), 0.0f) * (float) M_1_PI;
-		pdf = cos_pi;
-		return Color3(cos_pi, cos_pi, cos_pi);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// we are viewing the surface from the right side - send a ray out with cosine
-		// distribution over the hemisphere
-		sample_cos_hemisphere(m_N, omega_out, randu, randv, omega_in, pdf);
-		if (Ng.dot(omega_in) > 0) {
-			eval.setValue(pdf, pdf, pdf);
-			// TODO: find a better approximation for the diffuse bounce
-			domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-			domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-			domega_in_dx *= 125;
-			domega_in_dy *= 125;
-		}
-		else
-			pdf = 0;
-		return Labels::REFLECT;
-	}
-};
-
-
-
-class TranslucentClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-
-	TranslucentClosure() : BSDFClosure(Labels::DIFFUSE, Back) {}
-
-	void setup() {};
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const TranslucentClosure *comp = (const TranslucentClosure *)other;
-		return m_N == comp->m_N && BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "translucent"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " ((" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "))";
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		float cos_pi = max(-m_N.dot(omega_in), 0.0f) * (float) M_1_PI;
-		pdf = cos_pi;
-		return Color3(cos_pi, cos_pi, cos_pi);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// we are viewing the surface from the right side - send a ray out with cosine
-		// distribution over the hemisphere
-		sample_cos_hemisphere(-m_N, omega_out, randu, randv, omega_in, pdf);
-		if (Ng.dot(omega_in) < 0) {
-			eval.setValue(pdf, pdf, pdf);
-			// TODO: find a better approximation for the diffuse bounce
-			domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-			domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-			domega_in_dx *= -125;
-			domega_in_dy *= -125;
-		}
-		else
-			pdf = 0;
-		return Labels::TRANSMIT;
-	}
-};
-
-ClosureParam *bsdf_diffuse_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(DiffuseClosure, m_N),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(DiffuseClosure)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_translucent_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(TranslucentClosure, m_N),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(TranslucentClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_diffuse_prepare, DiffuseClosure)
-CLOSURE_PREPARE(bsdf_translucent_prepare, TranslucentClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_microfacet.cpp b/intern/cycles/kernel/osl/bsdf_microfacet.cpp
deleted file mode 100644
index 8446dbb..0000000
--- a/intern/cycles/kernel/osl/bsdf_microfacet.cpp
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-#include "util_math.h"
-
-using namespace OSL;
-
-CCL_NAMESPACE_BEGIN
-
-// TODO: fresnel_dielectric is only used for derivatives, could be optimized
-
-// TODO: refactor these two classes so they share everything by the microfacet
-//       distribution terms
-
-// microfacet model with GGX facet distribution
-// see http://www.graphics.cornell.edu/~bjw/microfacetbsdf.pdf
-template <int Refractive = 0>
-class MicrofacetGGXClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_ag;   // width parameter (roughness)
-	float m_eta;  // index of refraction (for fresnel term)
-	MicrofacetGGXClosure() : BSDFClosure(Labels::GLOSSY, Refractive ? Back : Front) { m_eta = 1.0f; }
-
-	void setup()
-	{
-		m_ag = clamp(m_ag, 1e-5f, 1.0f);
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const MicrofacetGGXClosure *comp = (const MicrofacetGGXClosure *)other;
-		return m_N == comp->m_N && m_ag == comp->m_ag &&
-		       m_eta == comp->m_eta && BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const {
-		return Refractive ? "microfacet_ggx_refraction" : "microfacet_ggx";
-	}
-
-	void print_on(std::ostream &out) const {
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_ag << ", ";
-		out << m_eta;
-		out << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		if (Refractive == 1) return Color3(0, 0, 0);
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNI > 0 && cosNO > 0) {
-			// get half vector
-			Vec3 Hr = omega_in + omega_out;
-			Hr.normalize();
-			// eq. 20: (F*G*D)/(4*in*on)
-			// eq. 33: first we calculate D(m) with m=Hr:
-			float alpha2 = m_ag * m_ag;
-			float cosThetaM = m_N.dot(Hr);
-			float cosThetaM2 = cosThetaM * cosThetaM;
-			float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-			float cosThetaM4 = cosThetaM2 * cosThetaM2;
-			float D = alpha2 / ((float) M_PI * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-			// eq. 34: now calculate G1(i,m) and G1(o,m)
-			float G1o = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-			float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
-			float G = G1o * G1i;
-			float out = (G * D) * 0.25f / cosNO;
-			// eq. 24
-			float pm = D * cosThetaM;
-			// convert into pdf of the sampled direction
-			// eq. 38 - but see also:
-			// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-			pdf = pm * 0.25f / Hr.dot(omega_out);
-			return Color3(out, out, out);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		if (Refractive == 0) return Color3(0, 0, 0);
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO <= 0 || cosNI >= 0)
-			return Color3(0, 0, 0);  // vectors on same side -- not possible
-		// compute half-vector of the refraction (eq. 16)
-		Vec3 ht = -(m_eta * omega_in + omega_out);
-		Vec3 Ht = ht; Ht.normalize();
-		float cosHO = Ht.dot(omega_out);
-
-		float cosHI = Ht.dot(omega_in);
-		// eq. 33: first we calculate D(m) with m=Ht:
-		float alpha2 = m_ag * m_ag;
-		float cosThetaM = m_N.dot(Ht);
-		float cosThetaM2 = cosThetaM * cosThetaM;
-		float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-		float cosThetaM4 = cosThetaM2 * cosThetaM2;
-		float D = alpha2 / ((float) M_PI * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-		// eq. 34: now calculate G1(i,m) and G1(o,m)
-		float G1o = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-		float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-		float G = G1o * G1i;
-		// probability
-		float invHt2 = 1 / ht.dot(ht);
-		pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
-		float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
-		return Color3(out, out, out);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		if (cosNO > 0) {
-			Vec3 X, Y, Z = m_N;
-			make_orthonormals(Z, X, Y);
-			// generate a random microfacet normal m
-			// eq. 35,36:
-			// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-			//                  and sin(atan(x)) == x/sqrt(1+x^2)
-			float alpha2 = m_ag * m_ag;
-			float tanThetaM2 = alpha2 * randu / (1 - randu);
-			float cosThetaM  = 1 / sqrtf(1 + tanThetaM2);
-			float sinThetaM  = cosThetaM * sqrtf(tanThetaM2);
-			float phiM = 2 * float(M_PI) * randv;
-			Vec3 m = (cosf(phiM) * sinThetaM) * X +
-			         (sinf(phiM) * sinThetaM) * Y +
-			         cosThetaM  * Z;
-			if (Refractive == 0) {
-				float cosMO = m.dot(omega_out);
-				if (cosMO > 0) {
-					// eq. 39 - compute actual reflected direction
-					omega_in = 2 * cosMO * m - omega_out;
-					if (Ng.dot(omega_in) > 0) {
-						// microfacet normal is visible to this ray
-						// eq. 33
-						float cosThetaM2 = cosThetaM * cosThetaM;
-						float cosThetaM4 = cosThetaM2 * cosThetaM2;
-						float D = alpha2 / (float(M_PI) * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-						// eq. 24
-						float pm = D * cosThetaM;
-						// convert into pdf of the sampled direction
-						// eq. 38 - but see also:
-						// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-						pdf = pm * 0.25f / cosMO;
-						// eval BRDF*cosNI
-						float cosNI = m_N.dot(omega_in);
-						// eq. 34: now calculate G1(i,m) and G1(o,m)
-						float G1o = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-						float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
-						float G = G1o * G1i;
-						// eq. 20: (F*G*D)/(4*in*on)
-						float out = (G * D) * 0.25f / cosNO;
-						eval.setValue(out, out, out);
-						domega_in_dx = (2 * m.dot(domega_out_dx)) * m - domega_out_dx;
-						domega_in_dy = (2 * m.dot(domega_out_dy)) * m - domega_out_dy;
-
-						/* disabled for now - gives texture filtering problems */
-#if 0
-						// Since there is some blur to this reflection, make the
-						// derivatives a bit bigger. In theory this varies with the
-						// roughness but the exact relationship is complex and
-						// requires more ops than are practical.
-						domega_in_dx *= 10;
-						domega_in_dy *= 10;
-#endif
-					}
-				}
-			}
-			else {
-				// CAUTION: the i and o variables are inverted relative to the paper
-				// eq. 39 - compute actual refractive direction
-				Vec3 R, dRdx, dRdy;
-				Vec3 T, dTdx, dTdy;
-				bool inside;
-				fresnel_dielectric(m_eta, m, omega_out, domega_out_dx, domega_out_dy,
-				                   R, dRdx, dRdy,
-				                   T, dTdx, dTdy,
-				                   inside);
-
-				if (!inside) {
-					omega_in = T;
-					domega_in_dx = dTdx;
-					domega_in_dy = dTdy;
-					// eq. 33
-					float cosThetaM2 = cosThetaM * cosThetaM;
-					float cosThetaM4 = cosThetaM2 * cosThetaM2;
-					float D = alpha2 / (float(M_PI) * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-					// eq. 24
-					float pm = D * cosThetaM;
-					// eval BRDF*cosNI
-					float cosNI = m_N.dot(omega_in);
-					// eq. 34: now calculate G1(i,m) and G1(o,m)
-					float G1o = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
-					float G = G1o * G1i;
-					// eq. 21
-					float cosHI = m.dot(omega_in);
-					float cosHO = m.dot(omega_out);
-					float Ht2 = m_eta * cosHI + cosHO;
-					Ht2 *= Ht2;
-					float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
-					// eq. 38 and eq. 17
-					pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
-					eval.setValue(out, out, out);
-
-					/* disabled for now - gives texture filtering problems */
-#if 0
-					// Since there is some blur to this refraction, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// roughness but the exact relationship is complex and
-					// requires more ops than are practical.
-					domega_in_dx *= 10;
-					domega_in_dy *= 10;
-#endif
-				}
-			}
-		}
-		return Refractive ? Labels::TRANSMIT : Labels::REFLECT;
-	}
-};
-
-// microfacet model with Beckmann facet distribution
-// see http://www.graphics.cornell.edu/~bjw/microfacetbsdf.pdf
-template <int Refractive = 0>
-class MicrofacetBeckmannClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_ab;   // width parameter (roughness)
-	float m_eta;  // index of refraction (for fresnel term)
-	MicrofacetBeckmannClosure() : BSDFClosure(Labels::GLOSSY, Refractive ? Back : Front) {
-	}
-
-	void setup()
-	{
-		m_ab = clamp(m_ab, 1e-5f, 1.0f);
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const MicrofacetBeckmannClosure *comp = (const MicrofacetBeckmannClosure *)other;
-		return m_N == comp->m_N && m_ab == comp->m_ab &&
-		       m_eta == comp->m_eta && BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const {
-		return sizeof(*this);
-	}
-
-	const char *name() const {
-		return Refractive ? "microfacet_beckmann_refraction"
-			   : "microfacet_beckmann";
-	}
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_ab << ", ";
-		out << m_eta;
-		out << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		if (Refractive == 1) return Color3(0, 0, 0);
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO > 0 && cosNI > 0) {
-			// get half vector
-			Vec3 Hr = omega_in + omega_out;
-			Hr.normalize();
-			// eq. 20: (F*G*D)/(4*in*on)
-			// eq. 25: first we calculate D(m) with m=Hr:
-			float alpha2 = m_ab * m_ab;
-			float cosThetaM = m_N.dot(Hr);
-			float cosThetaM2 = cosThetaM * cosThetaM;
-			float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-			float cosThetaM4 = cosThetaM2 * cosThetaM2;
-			float D = expf(-tanThetaM2 / alpha2) / (float(M_PI) * alpha2 *  cosThetaM4);
-			// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-			float ao = 1 / (m_ab * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-			float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-			float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-			float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-			float G = G1o * G1i;
-			float out = (G * D) * 0.25f / cosNO;
-			// eq. 24
-			float pm = D * cosThetaM;
-			// convert into pdf of the sampled direction
-			// eq. 38 - but see also:
-			// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-			pdf = pm * 0.25f / Hr.dot(omega_out);
-			return Color3(out, out, out);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		if (Refractive == 0) return Color3(0, 0, 0);
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO <= 0 || cosNI >= 0)
-			return Color3(0, 0, 0);
-		// compute half-vector of the refraction (eq. 16)
-		Vec3 ht = -(m_eta * omega_in + omega_out);
-		Vec3 Ht = ht; Ht.normalize();
-		float cosHO = Ht.dot(omega_out);
-
-		float cosHI = Ht.dot(omega_in);
-		// eq. 33: first we calculate D(m) with m=Ht:
-		float alpha2 = m_ab * m_ab;
-		float cosThetaM = m_N.dot(Ht);
-		float cosThetaM2 = cosThetaM * cosThetaM;
-		float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-		float cosThetaM4 = cosThetaM2 * cosThetaM2;
-		float D = expf(-tanThetaM2 / alpha2) / (float(M_PI) * alpha2 *  cosThetaM4);
-		// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-		float ao = 1 / (m_ab * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-		float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-		float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-		float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-		float G = G1o * G1i;
-		// probability
-		float invHt2 = 1 / ht.dot(ht);
-		pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
-		float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
-		return Color3(out, out, out);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		if (cosNO > 0) {
-			Vec3 X, Y, Z = m_N;
-			make_orthonormals(Z, X, Y);
-			// generate a random microfacet normal m
-			// eq. 35,36:
-			// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-			//                  and sin(atan(x)) == x/sqrt(1+x^2)
-			float alpha2 = m_ab * m_ab;
-			float tanThetaM = sqrtf(-alpha2 * logf(1 - randu));
-			float cosThetaM = 1 / sqrtf(1 + tanThetaM * tanThetaM);
-			float sinThetaM = cosThetaM * tanThetaM;
-			float phiM = 2 * float(M_PI) * randv;
-			Vec3 m = (cosf(phiM) * sinThetaM) * X +
-			         (sinf(phiM) * sinThetaM) * Y +
-			         cosThetaM  * Z;
-			if (Refractive == 0) {
-				float cosMO = m.dot(omega_out);
-				if (cosMO > 0) {
-					// eq. 39 - compute actual reflected direction
-					omega_in = 2 * cosMO * m - omega_out;
-					if (Ng.dot(omega_in) > 0) {
-						// microfacet normal is visible to this ray
-						// eq. 25
-						float cosThetaM2 = cosThetaM * cosThetaM;
-						float tanThetaM2 = tanThetaM * tanThetaM;
-						float cosThetaM4 = cosThetaM2 * cosThetaM2;
-						float D = expf(-tanThetaM2 / alpha2) / (float(M_PI) * alpha2 *  cosThetaM4);
-						// eq. 24
-						float pm = D * cosThetaM;
-						// convert into pdf of the sampled direction
-						// eq. 38 - but see also:
-						// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-						pdf = pm * 0.25f / cosMO;
-						// Eval BRDF*cosNI
-						float cosNI = m_N.dot(omega_in);
-						// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-						float ao = 1 / (m_ab * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-						float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-						float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-						float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-						float G = G1o * G1i;
-						// eq. 20: (F*G*D)/(4*in*on)
-						float out = (G * D) * 0.25f / cosNO;
-						eval.setValue(out, out, out);
-						domega_in_dx = (2 * m.dot(domega_out_dx)) * m - domega_out_dx;
-						domega_in_dy = (2 * m.dot(domega_out_dy)) * m - domega_out_dy;
-
-						/* disabled for now - gives texture filtering problems */
-#if 0
-						// Since there is some blur to this reflection, make the
-						// derivatives a bit bigger. In theory this varies with the
-						// roughness but the exact relationship is complex and
-						// requires more ops than are practical.
-						domega_in_dx *= 10;
-						domega_in_dy *= 10;
-#endif
-					}
-				}
-			}
-			else {
-				// CAUTION: the i and o variables are inverted relative to the paper
-				// eq. 39 - compute actual refractive direction
-				Vec3 R, dRdx, dRdy;
-				Vec3 T, dTdx, dTdy;
-				bool inside;
-				fresnel_dielectric(m_eta, m, omega_out, domega_out_dx, domega_out_dy,
-				                   R, dRdx, dRdy,
-				                   T, dTdx, dTdy,
-				                   inside);
-				if (!inside) {
-					omega_in = T;
-					domega_in_dx = dTdx;
-					domega_in_dy = dTdy;
-					// eq. 33
-					float cosThetaM2 = cosThetaM * cosThetaM;
-					float tanThetaM2 = tanThetaM * tanThetaM;
-					float cosThetaM4 = cosThetaM2 * cosThetaM2;
-					float D = expf(-tanThetaM2 / alpha2) / (float(M_PI) * alpha2 *  cosThetaM4);
-					// eq. 24
-					float pm = D * cosThetaM;
-					// eval BRDF*cosNI
-					float cosNI = m_N.dot(omega_in);
-					// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-					float ao = 1 / (m_ab * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-					float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-					float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-					float G = G1o * G1i;
-					// eq. 21
-					float cosHI = m.dot(omega_in);
-					float cosHO = m.dot(omega_out);
-					float Ht2 = m_eta * cosHI + cosHO;
-					Ht2 *= Ht2;
-					float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
-					// eq. 38 and eq. 17
-					pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
-					eval.setValue(out, out, out);
-
-					/* disabled for now - gives texture filtering problems */
-#if 0
-					// Since there is some blur to this refraction, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// roughness but the exact relationship is complex and
-					// requires more ops than are practical.
-					domega_in_dx *= 10;
-					domega_in_dy *= 10;
-#endif
-				}
-			}
-		}
-		return Refractive ? Labels::TRANSMIT : Labels::REFLECT;
-	}
-};
-
-
-
-ClosureParam *bsdf_microfacet_ggx_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<0>, m_N),
-	    CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<0>, m_ag),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<0>)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_microfacet_ggx_refraction_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<1>, m_N),
-	    CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_ag),
-	    CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_eta),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<1>)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_microfacet_beckmann_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<0>, m_N),
-	    CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<0>, m_ab),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<0>)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_microfacet_beckmann_refraction_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<1>, m_N),
-	    CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_ab),
-	    CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_eta),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<1>)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_microfacet_ggx_prepare,                 MicrofacetGGXClosure<0>)
-CLOSURE_PREPARE(bsdf_microfacet_ggx_refraction_prepare,      MicrofacetGGXClosure<1>)
-CLOSURE_PREPARE(bsdf_microfacet_beckmann_prepare,            MicrofacetBeckmannClosure<0>)
-CLOSURE_PREPARE(bsdf_microfacet_beckmann_refraction_prepare, MicrofacetBeckmannClosure<1>)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp b/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp
deleted file mode 100644
index 2a00100..0000000
--- a/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <OpenImageIO/fmath.h>
-#include <OSL/genclosure.h>
-#include "osl_closures.h"
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-
-class OrenNayarClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_sigma;
-	float m_a, m_b;
-
-	OrenNayarClosure() : BSDFClosure(Labels::DIFFUSE) {}
-
-	void setup() {
-		m_sigma = clamp(m_sigma, 0.0f, 1.0f);
-		
-		float div = 1.0f / (M_PI + ((3.0f * M_PI - 4.0f) / 6.0f) * m_sigma);
-
-		m_a =    1.0f * div;
-		m_b = m_sigma * div;
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const OrenNayarClosure *comp = static_cast<const OrenNayarClosure *>(other);
-		return
-		    m_N == comp->m_N &&
-		    m_sigma == comp->m_sigma &&
-		    BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const {
-		return sizeof(*this);
-	}
-
-	const char *name() const {
-		return "oren_nayar";
-	}
-
-	void print_on(std::ostream& out) const {
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_sigma;
-		out << ")";
-	}
-
-	float albedo(const Vec3& omega_out) const {
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3& omega_out, const Vec3& omega_in, float& pdf) const {
-		if (m_N.dot(omega_in) > 0.0f) {
-			pdf = float(0.5 * M_1_PI);
-			float is = get_intensity(m_N, omega_out, omega_in);
-			return Color3(is, is, is);
-		}
-		else {
-			pdf = 0.0f;
-			return Color3(0.0f, 0.0f, 0.0f);
-		}
-	}
-
-	Color3 eval_transmit(const Vec3& omega_out, const Vec3& omega_in, float& pdf) const {
-		return Color3(0.0f, 0.0f, 0.0f);
-	}
-
-	ustring sample(
-	    const Vec3& Ng,
-	    const Vec3& omega_out, const Vec3& domega_out_dx, const Vec3& domega_out_dy,
-	    float randu, float randv,
-	    Vec3& omega_in, Vec3& domega_in_dx, Vec3& domega_in_dy,
-	    float& pdf, Color3& eval
-	    ) const {
-		sample_uniform_hemisphere(m_N, omega_out, randu, randv, omega_in, pdf);
-
-		if (Ng.dot(omega_in) > 0.0f) {
-			float is = get_intensity(m_N, omega_out, omega_in);
-			eval.setValue(is, is, is);
-
-			// TODO: find a better approximation for the bounce
-			domega_in_dx = (2.0f * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-			domega_in_dy = (2.0f * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-			domega_in_dx *= 125.0f;
-			domega_in_dy *= 125.0f;
-		}
-		else {
-			pdf = 0.0f;
-		}
-
-		return Labels::REFLECT;
-	}
-
-private:
-	float get_intensity(Vec3 const& n, Vec3 const& v, Vec3 const& l) const {
-		float nl = max(n.dot(l), 0.0f);
-		float nv = max(n.dot(v), 0.0f);
-		float t = l.dot(v) - nl * nv;
-		
-		if (t > 0.0f) {
-			t /= max(nl, nv) + 1e-8f;
-		}
-		return nl * (m_a + m_b * t);
-	}
-};
-
-ClosureParam *bsdf_oren_nayar_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(OrenNayarClosure, m_N),
-	    CLOSURE_FLOAT_PARAM(OrenNayarClosure, m_sigma),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(OrenNayarClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_oren_nayar_prepare, OrenNayarClosure)
-
-
-CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/bsdf_phong.cpp b/intern/cycles/kernel/osl/bsdf_phong.cpp
deleted file mode 100644
index 1f430cc..0000000
--- a/intern/cycles/kernel/osl/bsdf_phong.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2012, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-#include "osl_closures.h"
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-// vanilla phong - leaks energy at grazing angles
-// see Global Illumination Compendium entry (66) 
-class PhongClosure : public BSDFClosure {
-public:
-    Vec3 m_N;
-    float m_exponent;
-    PhongClosure() : BSDFClosure(Labels::GLOSSY) { }
-
-    void setup() {};
-
-    bool mergeable (const ClosurePrimitive *other) const {
-        const PhongClosure *comp = (const PhongClosure *)other;
-        return m_N == comp->m_N && m_exponent == comp->m_exponent &&
-            BSDFClosure::mergeable(other);
-    }
-
-    size_t memsize () const { return sizeof(*this); }
-
-    const char *name () const { return "phong"; }
-
-    void print_on (std::ostream &out) const {
-        out << name() << " ((";
-        out << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-        out << m_exponent << ")";
-    }
-
-    float albedo (const Vec3 &omega_out) const
-    {
-         return 1.0f;
-    }
-
-    Color3 eval_reflect (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-    {
-        float cosNI = m_N.dot(omega_in);
-        float cosNO = m_N.dot(omega_out);
-        if (cosNI > 0 && cosNO > 0) {
-           // reflect the view vector
-           Vec3 R = (2 * cosNO) * m_N - omega_out;
-           float cosRI = R.dot(omega_in);
-           if (cosRI > 0) {
-               float common = 0.5f * (float) M_1_PI * powf(cosRI, m_exponent);
-               float out = cosNI * (m_exponent + 2) * common;
-               pdf = (m_exponent + 1) * common;
-               return Color3 (out, out, out);
-           }
-        }
-        return Color3 (0, 0, 0);
-    }
-
-    Color3 eval_transmit (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-    {
-        return Color3 (0, 0, 0);
-    }
-
-    ustring sample (const Vec3 &Ng,
-                 const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-                 float randu, float randv,
-                 Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-                 float &pdf, Color3 &eval) const
-    {
-        float cosNO = m_N.dot(omega_out);
-        if (cosNO > 0) {
-            // reflect the view vector
-            Vec3 R = (2 * cosNO) * m_N - omega_out;
-            domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-            domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-            Vec3 T, B;
-            make_orthonormals (R, T, B);
-            float phi = 2 * (float) M_PI * randu;
-            float cosTheta = powf(randv, 1 / (m_exponent + 1));
-            float sinTheta2 = 1 - cosTheta * cosTheta;
-            float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
-            omega_in = (cosf(phi) * sinTheta) * T +
-                       (sinf(phi) * sinTheta) * B +
-                       (            cosTheta) * R;
-            if (Ng.dot(omega_in) > 0)
-            {
-                // common terms for pdf and eval
-                float cosNI = m_N.dot(omega_in);
-                // make sure the direction we chose is still in the right hemisphere
-                if (cosNI > 0)
-                {
-                    float common = 0.5f * (float) M_1_PI * powf(cosTheta, m_exponent);
-                    pdf = (m_exponent + 1) * common;
-                    float out = cosNI * (m_exponent + 2) * common;
-                    eval.setValue(out, out, out);
-                    // Since there is some blur to this reflection, make the
-                    // derivatives a bit bigger. In theory this varies with the
-                    // exponent but the exact relationship is complex and
-                    // requires more ops than are practical.
-                    domega_in_dx *= 10;
-                    domega_in_dy *= 10;
-                }
-            }
-        }
-        return Labels::REFLECT;
-    }
-};
-
-
-class PhongRampClosure : public BSDFClosure {
-public:
-    static const int MAXCOLORS = 8;
-    Vec3 m_N;
-    float m_exponent;
-    Color3 m_colors[MAXCOLORS];
-    PhongRampClosure() : BSDFClosure(Labels::GLOSSY) { }
-
-    void setup() {};
-
-    bool mergeable (const ClosurePrimitive *other) const {
-        const PhongRampClosure *comp = (const PhongRampClosure *)other;
-        if (! (m_N == comp->m_N && m_exponent == comp->m_exponent && 
-               BSDFClosure::mergeable(other)))
-            return false;
-        for (int i = 0;  i < MAXCOLORS;  ++i)
-            if (m_colors[i] != comp->m_colors[i])
-                return false;
-        return true;
-    }
-
-    size_t memsize () const { return sizeof(*this); }
-
-    const char *name () const { return "phong_ramp"; }
-
-    void print_on (std::ostream &out) const {
-        out << name() << " ((";
-        out << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-        out << m_exponent << ")";
-    }
-
-    Color3 get_color (float pos) const
-    {
-        float npos = pos * (float)(MAXCOLORS - 1);
-        int ipos = (int)npos;
-        if (ipos >= (MAXCOLORS - 1))
-            return m_colors[MAXCOLORS - 1];
-        float offset = npos - (float)ipos;
-        return m_colors[ipos] * (1.0f - offset) + m_colors[ipos+1] * offset;
-    }
-
-    float albedo (const Vec3 &omega_out) const
-    {
-         return 1.0f;
-    }
-
-    Color3 eval_reflect (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-    {
-        float cosNI = m_N.dot(omega_in);
-        float cosNO = m_N.dot(omega_out);
-        if (cosNI > 0 && cosNO > 0) {
-            // reflect the view vector
-            Vec3 R = (2 * cosNO) * m_N - omega_out;
-            float cosRI = R.dot(omega_in);
-            if (cosRI > 0) {
-                float cosp = powf(cosRI, m_exponent);
-                float common = 0.5f * (float) M_1_PI * cosp;
-                float out = cosNI * (m_exponent + 2) * common;
-                pdf = (m_exponent + 1) * common;
-                return get_color(cosp) * out;
-            }
-        }
-        return Color3 (0, 0, 0);
-    }
-
-    Color3 eval_transmit (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-    {
-        return Color3 (0, 0, 0);
-    }
-
-    ustring sample (const Vec3 &Ng,
-                 const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-                 float randu, float randv,
-                 Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-                 float &pdf, Color3 &eval) const
-    {
-        float cosNO = m_N.dot(omega_out);
-        if (cosNO > 0) {
-            // reflect the view vector
-            Vec3 R = (2 * cosNO) * m_N - omega_out;
-            domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-            domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-            Vec3 T, B;
-            make_orthonormals (R, T, B);
-            float phi = 2 * (float) M_PI * randu;
-            float cosTheta = powf(randv, 1 / (m_exponent + 1));
-            float sinTheta2 = 1 - cosTheta * cosTheta;
-            float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
-            omega_in = (cosf(phi) * sinTheta) * T +
-                       (sinf(phi) * sinTheta) * B +
-                       (            cosTheta) * R;
-            if (Ng.dot(omega_in) > 0)
-            {
-                // common terms for pdf and eval
-                float cosNI = m_N.dot(omega_in);
-                // make sure the direction we chose is still in the right hemisphere
-                if (cosNI > 0)
-                {
-                    float cosp = powf(cosTheta, m_exponent);
-                    float common = 0.5f * (float) M_1_PI * cosp;
-                    pdf = (m_exponent + 1) * common;
-                    float out = cosNI * (m_exponent + 2) * common;
-                    eval = get_color(cosp) * out;
-                    // Since there is some blur to this reflection, make the
-                    // derivatives a bit bigger. In theory this varies with the
-                    // exponent but the exact relationship is complex and
-                    // requires more ops than are practical.
-                    domega_in_dx *= 10;
-                    domega_in_dy *= 10;
-                }
-            }
-        }
-        return Labels::REFLECT;
-    }
-};
-
-
-
-ClosureParam *bsdf_phong_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(PhongClosure, m_N),
-	    CLOSURE_FLOAT_PARAM (PhongClosure, m_exponent),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(PhongClosure)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_phong_ramp_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM     (PhongRampClosure, m_N),
-	    CLOSURE_FLOAT_PARAM      (PhongRampClosure, m_exponent),
-	    CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, m_colors, PhongRampClosure::MAXCOLORS),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM     (PhongRampClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_phong_prepare, PhongClosure)
-CLOSURE_PREPARE(bsdf_phong_ramp_prepare, PhongRampClosure)
-
-CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp
new file mode 100644
index 0000000..fb144be
--- /dev/null
+++ b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp
@@ -0,0 +1,115 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2011, Blender Foundation.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <OpenImageIO/fmath.h>
+
+#include <OSL/genclosure.h>
+
+#include "osl_closures.h"
+
+#include "kernel_types.h"
+#include "closure/bsdf_phong_ramp.h"
+
+CCL_NAMESPACE_BEGIN
+
+using namespace OSL;
+
+class PhongRampClosure : public CBSDFClosure {
+public:
+	PhongRampClosure() : CBSDFClosure(LABEL_GLOSSY) {}
+	Color3 colors[8];
+	float3 fcolors[8];
+
+	size_t memsize() const { return sizeof(*this); }
+	const char *name() const { return "phong_ramp"; }
+
+	void setup()
+	{
+		sc.N = TO_FLOAT3(N);
+		m_shaderdata_flag = bsdf_phong_ramp_setup(&sc);
+
+		for(int i = 0; i < 8; i++)
+			fcolors[i] = TO_FLOAT3(colors[i]);
+	}
+
+	bool mergeable(const ClosurePrimitive *other) const
+	{
+		return false;
+	}
+
+	void blur(float roughness)
+	{
+		bsdf_phong_ramp_blur(&sc, roughness);
+	}
+
+	void print_on(std::ostream &out) const
+	{
+		out << name() << " ((" << sc.N[0] << ", " << sc.N[1] << ", " << sc.N[2] << "))";
+	}
+
+	float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
+	{
+		return bsdf_phong_ramp_eval_reflect(&sc, fcolors, omega_out, omega_in, &pdf);
+	}
+
+	float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
+	{
+		return bsdf_phong_ramp_eval_transmit(&sc, fcolors, omega_out, omega_in, &pdf);
+	}
+
+	int sample(const float3 &Ng,
+	           const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
+	           float randu, float randv,
+	           float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
+	           float &pdf, float3 &eval) const
+	{
+		return bsdf_phong_ramp_sample(&sc, fcolors, Ng, omega_out, domega_out_dx, domega_out_dy,
+			randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
+	}
+};
+
+ClosureParam *closure_bsdf_phong_ramp_params()
+{
+	static ClosureParam params[] = {
+		CLOSURE_VECTOR_PARAM(PhongRampClosure, N),
+		CLOSURE_FLOAT_PARAM(PhongRampClosure, sc.data0),
+		CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, colors, 8),
+		CLOSURE_STRING_KEYPARAM("label"),
+	    CLOSURE_FINISH_PARAM(PhongRampClosure)
+	};
+	return params;
+}
+
+CLOSURE_PREPARE(closure_bsdf_phong_ramp_prepare, PhongRampClosure)
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/kernel/osl/bsdf_reflection.cpp b/intern/cycles/kernel/osl/bsdf_reflection.cpp
deleted file mode 100644
index 1b85ec1..0000000
--- a/intern/cycles/kernel/osl/bsdf_reflection.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class ReflectionClosure : public BSDFClosure {
-public:
-	Vec3 m_N;     // shading normal
-	ReflectionClosure() : BSDFClosure(Labels::SINGULAR) {}
-
-	void setup() {};
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const ReflectionClosure *comp = (const ReflectionClosure *)other;
-		return m_N == comp->m_N && BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "reflection"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "))";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// only one direction is possible
-		float cosNO = m_N.dot(omega_out);
-		if (cosNO > 0) {
-			omega_in = (2 * cosNO) * m_N - omega_out;
-			if (Ng.dot(omega_in) > 0) {
-				domega_in_dx = 2 * m_N.dot(domega_out_dx) * m_N - domega_out_dx;
-				domega_in_dy = 2 * m_N.dot(domega_out_dy) * m_N - domega_out_dy;
-				pdf = 1;
-				eval.setValue(1, 1, 1);
-			}
-		}
-		return Labels::REFLECT;
-	}
-};
-
-ClosureParam *bsdf_reflection_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(ReflectionClosure, m_N),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(ReflectionClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_reflection_prepare, ReflectionClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_refraction.cpp b/intern/cycles/kernel/osl/bsdf_refraction.cpp
deleted file mode 100644
index 76ee53f..0000000
--- a/intern/cycles/kernel/osl/bsdf_refraction.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class RefractionClosure : public BSDFClosure {
-public:
-	Vec3 m_N;      // shading normal
-	float m_eta;   // ratio of indices of refraction (inside / outside)
-	RefractionClosure() : BSDFClosure(Labels::SINGULAR, Back) {}
-
-	void setup() {}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const RefractionClosure *comp = (const RefractionClosure *)other;
-		return m_N == comp->m_N && m_eta == comp->m_eta &&
-		       BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "refraction"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_eta;
-		out << ")";
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		Vec3 R, dRdx, dRdy;
-		Vec3 T, dTdx, dTdy;
-		bool inside;
-
-		fresnel_dielectric(m_eta, m_N,
-		                   omega_out, domega_out_dx, domega_out_dy,
-		                   R, dRdx, dRdy,
-		                   T, dTdx, dTdy,
-		                   inside);
-
-		if (!inside) {
-			pdf = 1;
-			eval.setValue(1.0f, 1.0f, 1.0f);
-			omega_in = T;
-			domega_in_dx = dTdx;
-			domega_in_dy = dTdy;
-		}
-
-		return Labels::TRANSMIT;
-	}
-};
-
-ClosureParam *bsdf_refraction_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(RefractionClosure, m_N),
-	    CLOSURE_FLOAT_PARAM(RefractionClosure, m_eta),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(RefractionClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_refraction_prepare, RefractionClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_transparent.cpp b/intern/cycles/kernel/osl/bsdf_transparent.cpp
deleted file mode 100644
index 29cef8e..0000000
--- a/intern/cycles/kernel/osl/bsdf_transparent.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class TransparentClosure : public BSDFClosure {
-public:
-	TransparentClosure() : BSDFClosure(Labels::STRAIGHT, Back) {}
-
-	void setup() {}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "transparent"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " ()";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// only one direction is possible
-		omega_in = -omega_out;
-		domega_in_dx = -domega_out_dx;
-		domega_in_dy = -domega_out_dy;
-		pdf = 1;
-		eval.setValue(1, 1, 1);
-		return Labels::TRANSMIT;
-	}
-};
-
-
-
-ClosureParam *bsdf_transparent_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(TransparentClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_transparent_prepare, TransparentClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_ward.cpp b/intern/cycles/kernel/osl/bsdf_ward.cpp
deleted file mode 100644
index 9d8d2fc..0000000
--- a/intern/cycles/kernel/osl/bsdf_ward.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-// anisotropic ward - leaks energy at grazing angles
-// see http://www.graphics.cornell.edu/~bjw/wardnotes.pdf 
-class WardClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	Vec3 m_T;
-	float m_ax, m_ay;
-	WardClosure() : BSDFClosure(Labels::GLOSSY) {}
-
-	void setup()
-	{
-		m_ax = clamp(m_ax, 1e-5f, 1.0f);
-		m_ay = clamp(m_ay, 1e-5f, 1.0f);
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const WardClosure *comp = (const WardClosure *)other;
-		return m_N == comp->m_N && m_T == comp->m_T &&
-		       m_ax == comp->m_ax && m_ay == comp->m_ay &&
-		       BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "ward"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " ((";
-		out << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), (";
-		out << m_T[0] << ", " << m_T[1] << ", " << m_T[2] << "), ";
-		out << m_ax << ", " << m_ay << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNI > 0 && cosNO > 0) {
-			// get half vector and get x,y basis on the surface for anisotropy
-			Vec3 H = omega_in + omega_out;
-			H.normalize();  // normalize needed for pdf
-			Vec3 X, Y;
-			make_orthonormals(m_N, m_T, X, Y);
-			// eq. 4
-			float dotx = H.dot(X) / m_ax;
-			float doty = H.dot(Y) / m_ay;
-			float dotn = H.dot(m_N);
-			float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
-			float denom = (4 * (float) M_PI * m_ax * m_ay * sqrtf(cosNO * cosNI));
-			float exp_val = expf(-exp_arg);
-			float out = cosNI * exp_val / denom;
-			float oh = H.dot(omega_out);
-			denom = 4 * (float) M_PI * m_ax * m_ay * oh * dotn * dotn * dotn;
-			pdf = exp_val / denom;
-			return Color3(out, out, out);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		if (cosNO > 0) {
-			// get x,y basis on the surface for anisotropy
-			Vec3 X, Y;
-			make_orthonormals(m_N, m_T, X, Y);
-			// generate random angles for the half vector
-			// eq. 7 (taking care around discontinuities to keep
-			//        output angle in the right quadrant)
-			// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-			//                  and sin(atan(x)) == x/sqrt(1+x^2)
-			float alphaRatio = m_ay / m_ax;
-			float cosPhi, sinPhi;
-			if (randu < 0.25f) {
-				float val = 4 * randu;
-				float tanPhi = alphaRatio * tanf((float) M_PI_2 * val);
-				cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
-				sinPhi = tanPhi * cosPhi;
-			}
-			else if (randu < 0.5) {
-				float val = 1 - 4 * (0.5f - randu);
-				float tanPhi = alphaRatio * tanf((float) M_PI_2 * val);
-				// phi = (float) M_PI - phi;
-				cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
-				sinPhi = -tanPhi * cosPhi;
-			}
-			else if (randu < 0.75f) {
-				float val = 4 * (randu - 0.5f);
-				float tanPhi = alphaRatio * tanf((float) M_PI_2 * val);
-				//phi = (float) M_PI + phi;
-				cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
-				sinPhi = tanPhi * cosPhi;
-			}
-			else {
-				float val = 1 - 4 * (1 - randu);
-				float tanPhi = alphaRatio * tanf((float) M_PI_2 * val);
-				// phi = 2 * (float) M_PI - phi;
-				cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
-				sinPhi = -tanPhi * cosPhi;
-			}
-			// eq. 6
-			// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-			//                  and sin(atan(x)) == x/sqrt(1+x^2)
-			float thetaDenom = (cosPhi * cosPhi) / (m_ax * m_ax) + (sinPhi * sinPhi) / (m_ay * m_ay);
-			float tanTheta2 = -logf(1 - randv) / thetaDenom;
-			float cosTheta  = 1 / sqrtf(1 + tanTheta2);
-			float sinTheta  = cosTheta * sqrtf(tanTheta2);
-
-			Vec3 h; // already normalized becaused expressed from spherical coordinates
-			h.x = sinTheta * cosPhi;
-			h.y = sinTheta * sinPhi;
-			h.z = cosTheta;
-			// compute terms that are easier in local space
-			float dotx = h.x / m_ax;
-			float doty = h.y / m_ay;
-			float dotn = h.z;
-			// transform to world space
-			h = h.x * X + h.y * Y + h.z * m_N;
-			// generate the final sample
-			float oh = h.dot(omega_out);
-			omega_in.x = 2 * oh * h.x - omega_out.x;
-			omega_in.y = 2 * oh * h.y - omega_out.y;
-			omega_in.z = 2 * oh * h.z - omega_out.z;
-			if (Ng.dot(omega_in) > 0) {
-				float cosNI = m_N.dot(omega_in);
-				if (cosNI > 0) {
-					// eq. 9
-					float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
-					float denom = 4 * (float) M_PI * m_ax * m_ay * oh * dotn * dotn * dotn;
-					pdf = expf(-exp_arg) / denom;
-					// compiler will reuse expressions already computed
-					denom = (4 * (float) M_PI * m_ax * m_ay * sqrtf(cosNO * cosNI));
-					float power = cosNI * expf(-exp_arg) / denom;
-					eval.setValue(power, power, power);
-					domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-					domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-
-					/* disabled for now - gives texture filtering problems */
-#if 0
-					// Since there is some blur to this reflection, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// roughness but the exact relationship is complex and
-					// requires more ops than are practical.
-					domega_in_dx *= 10;
-					domega_in_dy *= 10;
-#endif
-				}
-			}
-		}
-		return Labels::REFLECT;
-	}
-};
-
-
-
-ClosureParam *bsdf_ward_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(WardClosure, m_N),
-	    CLOSURE_VECTOR_PARAM(WardClosure, m_T),
-	    CLOSURE_FLOAT_PARAM(WardClosure, m_ax),
-	    CLOSURE_FLOAT_PARAM(WardClosure, m_ay),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(WardClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_ward_prepare, WardClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bsdf_westin.cpp b/intern/cycles/kernel/osl/bsdf_westin.cpp
deleted file mode 100644
index 6716376..0000000
--- a/intern/cycles/kernel/osl/bsdf_westin.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-#include "util_math.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class WestinBackscatterClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_roughness;
-	float m_invroughness;
-	WestinBackscatterClosure() : BSDFClosure(Labels::GLOSSY) {}
-
-	void setup()
-	{
-		m_roughness = clamp(m_roughness, 1e-5f, 1.0f);
-		m_invroughness = m_roughness > 0 ? 1 / m_roughness : 0;
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const WestinBackscatterClosure *comp = (const WestinBackscatterClosure *)other;
-		return m_N == comp->m_N && m_roughness == comp->m_roughness &&
-		       BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "westin_backscatter"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_roughness;
-		out << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float &pdf) const
-	{
-		// pdf is implicitly 0 (no indirect sampling)
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO > 0 && cosNI > 0) {
-			float cosine = omega_out.dot(omega_in);
-			pdf = cosine > 0 ? (m_invroughness + 1) * powf(cosine, m_invroughness) : 0;
-			pdf *= 0.5f * float(M_1_PI);
-			return Color3(pdf, pdf, pdf);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float &pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		float cosNO = m_N.dot(omega_out);
-		if (cosNO > 0) {
-			domega_in_dx = domega_out_dx;
-			domega_in_dy = domega_out_dy;
-			Vec3 T, B;
-			make_orthonormals(omega_out, T, B);
-			float phi = 2 * (float) M_PI * randu;
-			float cosTheta = powf(randv, 1 / (m_invroughness + 1));
-			float sinTheta2 = 1 - cosTheta * cosTheta;
-			float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
-			omega_in = (cosf(phi) * sinTheta) * T +
-			           (sinf(phi) * sinTheta) * B +
-			           (cosTheta) * omega_out;
-			if (Ng.dot(omega_in) > 0)
-			{
-				// common terms for pdf and eval
-				float cosNI = m_N.dot(omega_in);
-				// make sure the direction we chose is still in the right hemisphere
-				if (cosNI > 0)
-				{
-					pdf = 0.5f * (float) M_1_PI * powf(cosTheta, m_invroughness);
-					pdf = (m_invroughness + 1) * pdf;
-					eval.setValue(pdf, pdf, pdf);
-					// Since there is some blur to this reflection, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// exponent but the exact relationship is complex and
-					// requires more ops than are practical.
-					domega_in_dx *= 10;
-					domega_in_dy *= 10;
-				}
-			}
-		}
-		return Labels::REFLECT;
-	}
-
-};
-
-
-class WestinSheenClosure : public BSDFClosure {
-public:
-	Vec3 m_N;
-	float m_edginess;
-//    float m_normalization;
-	WestinSheenClosure() : BSDFClosure(Labels::DIFFUSE) {}
-
-	void setup() {};
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const WestinSheenClosure *comp = (const WestinSheenClosure *)other;
-		return m_N == comp->m_N && m_edginess == comp->m_edginess &&
-		       BSDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "westin_sheen"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " (";
-		out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
-		out << m_edginess;
-		out << ")";
-	}
-
-	float albedo(const Vec3 &omega_out) const
-	{
-		return 1.0f;
-	}
-
-	Color3 eval_reflect(const Vec3 &omega_out, const Vec3 &omega_in, float &pdf) const
-	{
-		// pdf is implicitly 0 (no indirect sampling)
-		float cosNO = m_N.dot(omega_out);
-		float cosNI = m_N.dot(omega_in);
-		if (cosNO > 0 && cosNI > 0) {
-			float sinNO2 = 1 - cosNO * cosNO;
-			pdf = cosNI * float(M_1_PI);
-			float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * pdf : 0;
-			return Color3(westin, westin, westin);
-		}
-		return Color3(0, 0, 0);
-	}
-
-	Color3 eval_transmit(const Vec3 &omega_out, const Vec3 &omega_in, float &pdf) const
-	{
-		return Color3(0, 0, 0);
-	}
-
-	ustring sample(const Vec3 &Ng,
-	               const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
-	               float randu, float randv,
-	               Vec3 &omega_in, Vec3 &domega_in_dx, Vec3 &domega_in_dy,
-	               float &pdf, Color3 &eval) const
-	{
-		// we are viewing the surface from the right side - send a ray out with cosine
-		// distribution over the hemisphere
-		sample_cos_hemisphere(m_N, omega_out, randu, randv, omega_in, pdf);
-		if (Ng.dot(omega_in) > 0) {
-			// TODO: account for sheen when sampling
-			float cosNO = m_N.dot(omega_out);
-			float sinNO2 = 1 - cosNO * cosNO;
-			float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * pdf : 0;
-			eval.setValue(westin, westin, westin);
-			// TODO: find a better approximation for the diffuse bounce
-			domega_in_dx = (2 * m_N.dot(domega_out_dx)) * m_N - domega_out_dx;
-			domega_in_dy = (2 * m_N.dot(domega_out_dy)) * m_N - domega_out_dy;
-			domega_in_dx *= 125;
-			domega_in_dy *= 125;
-		}
-		else {
-			pdf = 0;
-		}
-		return Labels::REFLECT;
-	}
-};
-
-
-
-ClosureParam *bsdf_westin_backscatter_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, m_N),
-	    CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, m_roughness),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(WestinBackscatterClosure)
-	};
-	return params;
-}
-
-ClosureParam *bsdf_westin_sheen_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_VECTOR_PARAM(WestinSheenClosure, m_N),
-	    CLOSURE_FLOAT_PARAM(WestinSheenClosure, m_edginess),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(WestinSheenClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(bsdf_westin_backscatter_prepare, WestinBackscatterClosure)
-CLOSURE_PREPARE(bsdf_westin_sheen_prepare,        WestinSheenClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/bssrdf.cpp b/intern/cycles/kernel/osl/bssrdf.cpp
deleted file mode 100644
index 889e8a5..0000000
--- a/intern/cycles/kernel/osl/bssrdf.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-class BSSRDFCubicClosure : public BSSRDFClosure {
-public:
-	Color3 m_radius;
-	Color3 m_scale;
-	float m_max_radius;
-
-	template <typename T>
-	static inline T pow3(const T &x) { return x * x * x; }
-
-	template <typename T>
-	static inline T pow5(const T &x) { T x2 = x * x; return x2 * x2 * x; }
-
-	BSSRDFCubicClosure() {}
-
-	void setup()
-	{
-		// pre-compute some terms
-		m_max_radius = 0;
-		for (int i = 0; i < 3; i++) {
-			m_scale[i] = m_radius[i] > 0 ? 4 / pow5(m_radius[i]) : 0;
-			m_max_radius = std::max(m_max_radius, m_radius[i]);
-		}
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const BSSRDFCubicClosure *comp = (const BSSRDFCubicClosure *)other;
-		return m_radius == comp->m_radius && BSSRDFClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "bssrdf_cubic"; }
-
-	void print_on(std::ostream &out) const
-	{
-		out << name() << " ((" << m_radius[0] << ", " << m_radius[1] << ", " << m_radius[2] << "), ("
-		    << m_scale[0] << ", " << m_scale[1] << ", " << m_scale[2] << "))";
-	}
-
-	Color3 eval(float r) const
-	{
-		return Color3((r < m_radius.x) ? pow3(m_radius.x - r) * m_scale.x : 0,
-		              (r < m_radius.y) ? pow3(m_radius.y - r) * m_scale.y : 0,
-		              (r < m_radius.z) ? pow3(m_radius.z - r) * m_scale.z : 0);
-	}
-
-	float max_radius() const
-	{
-		return m_max_radius;
-	}
-};
-
-
-
-ClosureParam *closure_bssrdf_cubic_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_COLOR_PARAM(BSSRDFCubicClosure, m_radius),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(BSSRDFCubicClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(closure_bssrdf_cubic_prepare, BSSRDFCubicClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/debug.cpp b/intern/cycles/kernel/osl/debug.cpp
deleted file mode 100644
index ee5fb30..0000000
--- a/intern/cycles/kernel/osl/debug.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-/// Debug closure
-///
-/// This is going to be used for mask AOV's and similar
-/// purposes. A tag (string) is always associated with
-/// this closure, that "selects: the channel where the
-/// weight should be sent.
-
-class DebugClosure : public ClosurePrimitive {
-public:
-	ustring m_tag;
-
-	DebugClosure () : ClosurePrimitive(Debug) {}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const DebugClosure *comp = (const DebugClosure *)other;
-		return m_tag == comp->m_tag &&
-		       ClosurePrimitive::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "debug"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " (\"" << m_tag.c_str() << "\")";
-	}
-
-};
-
-ClosureParam *closure_debug_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_STRING_PARAM(DebugClosure, m_tag),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(DebugClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(closure_debug_prepare, DebugClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp
index 3ee57cb..37e3e37 100644
--- a/intern/cycles/kernel/osl/emissive.cpp
+++ b/intern/cycles/kernel/osl/emissive.cpp
@@ -36,6 +36,9 @@
 
 #include "osl_closures.h"
 
+#include "kernel_types.h"
+#include "closure/emissive.h"
+
 CCL_NAMESPACE_BEGIN
 
 using namespace OSL;
@@ -52,51 +55,34 @@ public:
 	GenericEmissiveClosure() { }
 
 	void setup() {}
-
 	size_t memsize() const { return sizeof(*this); }
-
 	const char *name() const { return "emission"; }
 
-	void print_on(std::ostream &out) const {
+	void print_on(std::ostream &out) const
+	{
 		out << name() << "()";
 	}
 
 	Color3 eval(const Vec3 &Ng, const Vec3 &omega_out) const
 	{
-		float cosNO = fabsf(Ng.dot(omega_out));
-		float res = cosNO > 0 ? 1.0f : 0.0f;
-		return Color3(res, res, res);
+		float3 result = emissive_eval(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
+		return TO_COLOR3(result);
 	}
 
 	void sample(const Vec3 &Ng, float randu, float randv,
 	            Vec3 &omega_out, float &pdf) const
 	{
-		// We don't do anything sophisticated here for the step
-		// We just sample the whole cone uniformly to the cosine
-		Vec3 T, B;
-		make_orthonormals(Ng, T, B);
-		float phi = 2 * (float) M_PI * randu;
-		float cosTheta = sqrtf(1.0f - 1.0f * randv);
-		float sinTheta = sqrtf(1.0f - cosTheta * cosTheta);
-		omega_out = (cosf(phi) * sinTheta) * T +
-		            (sinf(phi) * sinTheta) * B +
-		            cosTheta  * Ng;
-		pdf = 1.0f / float(M_PI);
+		float3 omega_out_;
+		emissive_sample(TO_FLOAT3(Ng), randu, randv, &omega_out_, &pdf);
+		omega_out = TO_VEC3(omega_out_);
 	}
 
-	/// Return the probability distribution function in the direction omega_out,
-	/// given the parameters and the light's surface normal.  This MUST match
-	/// the PDF computed by sample().
-	float pdf(const Vec3 &Ng,
-	          const Vec3 &omega_out) const
+	float pdf(const Vec3 &Ng, const Vec3 &omega_out) const
 	{
-		float cosNO = Ng.dot(omega_out);
-		return cosNO > 0 ? 1.0f : 0.0f;
+		return emissive_pdf(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
 	}
 };
 
-
-
 ClosureParam *closure_emission_params()
 {
 	static ClosureParam params[] = {
diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt
deleted file mode 100644
index 541076f..0000000
--- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-
-# OSL node shaders
-
-set(SRC_OSL
-	node_add_closure.osl
-	node_attribute.osl
-	node_background.osl
-	node_brick_texture.osl
-	node_bump.osl
-	node_camera.osl
-	node_checker_texture.osl
-	node_combine_rgb.osl
-	node_convert_from_color.osl
-	node_convert_from_float.osl
-	node_convert_from_normal.osl
-	node_convert_from_point.osl
-	node_convert_from_vector.osl
-	node_diffuse_bsdf.osl
-	node_emission.osl
-	node_environment_texture.osl
-	node_fresnel.osl
-	node_gamma.osl
-	node_gradient_texture.osl
-	node_brightness.osl
-	node_geometry.osl
-	node_glass_bsdf.osl
-	node_glossy_bsdf.osl
-	node_holdout.osl
-	node_hsv.osl
-	node_image_texture.osl
-	node_invert.osl
-	node_light_path.osl
-	node_magic_texture.osl
-	node_mapping.osl
-	node_math.osl
-	node_mix.osl
-	node_mix_closure.osl
-	node_musgrave_texture.osl
-	node_normal.osl
-	node_noise_texture.osl
-	node_object_info.osl
-	node_output_displacement.osl
-	node_output_surface.osl
-	node_output_volume.osl
-	node_particle_info.osl
-	node_rgb_ramp.osl
-	node_separate_rgb.osl
-	node_sky_texture.osl
-	node_texture_coordinate.osl
-	node_translucent_bsdf.osl
-	node_transparent_bsdf.osl
-	node_value.osl
-	node_vector_math.osl
-	node_velvet_bsdf.osl
-	node_voronoi_texture.osl
-	node_ward_bsdf.osl
-	node_wave_texture.osl
-)
-
-set(SRC_OSL_HEADERS
-	node_texture.h
-	node_color.h
-	node_fresnel.h
-	stdosl.h
-	oslutil.h
-)
-
-set(SRC_OSO
-
-)
-
-# TODO, add a module to compile OSL
-foreach(_file ${SRC_OSL})
-	set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-	string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})  # TODO, replace extension only
-	string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
-	add_custom_command(
-		OUTPUT ${_OSO_FILE} 
-		COMMAND ${OSL_COMPILER} -O2 ${_OSL_FILE}
-		DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
-	list(APPEND SRC_OSO
-		${_OSO_FILE}
-	)
-	
-	unset(_OSL_FILE)
-	unset(_OSO_FILE)
-endforeach()
-
-add_custom_target(shader ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
-
-# CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
-delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)
diff --git a/intern/cycles/kernel/osl/nodes/node_attribute.osl b/intern/cycles/kernel/osl/nodes/node_attribute.osl
deleted file mode 100644
index d273d0c..0000000
--- a/intern/cycles/kernel/osl/nodes/node_attribute.osl
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_attribute(
-	string bump_offset = "center",
-	string name = "",
-	output point Vector = point(0.0, 0.0, 0.0),
-	output color Color = color(0.0, 0.0, 0.0),
-	output float Fac = 0.0)
-{
-	getattribute(name, Color);
-	Vector = point(Color);
-	getattribute(name, Fac);
-
-	if(bump_offset == "dx") {
-		Color += Dx(Color);
-		Vector += Dx(Vector);
-		Fac += Dx(Fac);
-	}
-	else if(bump_offset == "dy") {
-		Color += Dy(Color);
-		Vector += Dy(Vector);
-		Fac += Dy(Fac);
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_background.osl b/intern/cycles/kernel/osl/nodes/node_background.osl
deleted file mode 100644
index 69f8d85..0000000
--- a/intern/cycles/kernel/osl/nodes/node_background.osl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_background(
-	color Color = color(0.8, 0.8, 0.8),
-	float Strength = 1.0,
-	output closure color Background = background())
-{
-	Background = Color*Strength*background();
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl b/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
deleted file mode 100644
index d834819..0000000
--- a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_fresnel.h"
-
-shader node_blend_weight(
-	float Blend = 0.3,
-	normal Normal = N,
-	output float Fresnel = 0.0,
-	output float Facing = 0.0)
-{
-	float f = max(1.0 - Blend, 1e-5);
-	Fresnel = fresnel_dielectric(I, Normal, backfacing()? f: 1.0/f);
-
-	Facing = abs(dot(I, Normal));
-
-	if(Blend != 0.5) {
-		Blend = clamp(Blend, 0.0, 1.0); 
-		Blend = (Blend < 0.5)? 2.0*Blend: 0.5/(1.0 - Blend);
-
-		Facing = powf(Facing, Blend);
-	}
-
-	Facing = 1.0 - Facing;
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_brick_texture.osl b/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
deleted file mode 100644
index 4daceb4..0000000
--- a/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2012, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Brick */
-
-float brick_noise(int n) /* fast integer noise */
-{
-	int nn;
-	n = (n >> 13) ^ n;
-	nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 2147483647;
-	return 0.5 * ((float)nn / 1073741824.0);
-}
-
-float brick(point p, float mortar_size, float bias,
-	float BrickWidth, float row_height, float offset_amount, int offset_frequency,
-	float squash_amount, int squash_frequency, float tint)
-{
-	int bricknum, rownum;
-	float offset = 0.0;
-	float brick_width = BrickWidth;
-	float x, y;
-
-	rownum = (int)floor(p[1] / row_height);
-	
-	if(offset_frequency && squash_frequency) {
-		brick_width *= ((int)(rownum) % squash_frequency ) ? 1.0 : squash_amount; /* squash */
-		offset = ((int)(rownum) % offset_frequency ) ? 0 : (brick_width*offset_amount); /* offset */
-	}
-
-	bricknum = (int)floor((p[0]+offset) / brick_width);
-
-	x = (p[0]+offset) - brick_width*bricknum;
-	y = p[1] - row_height*rownum;
-
-	tint = clamp((brick_noise((rownum << 16) + (bricknum & 65535)) + bias), 0.0, 1.0);
-
-	return (x < mortar_size || y < mortar_size ||
-		x > (brick_width - mortar_size) ||
-		y > (row_height - mortar_size)) ? 1.0 : 0.0;
-}
-
-shader node_brick_texture(
-	float Offset = 0.5,
-	int OffsetFrequency = 2,
-	float Squash = 1.0,
-	int SquashFrequency = 1,
-	point Vector = P,
-	color Color1 = color(0.2, 0.2, 0.2),
-	color Color2 = color(0.8, 0.8, 0.8),
-	color Mortar = color(0.0, 0.0, 0.0),
-	float Scale = 5.0,
-	float MortarSize = 0.02,
-	float Bias = 0.0,
-	float BrickWidth = 0.5,
-	float RowHeight = 0.25,
-	output float Fac = 0.0,
-	output color Color = color(0.2, 0.2, 0.2))
-{
-	float tint = 0.0;
-	color Col = Color1;
-	
-	Fac = brick(Vector*Scale, MortarSize, Bias, BrickWidth, RowHeight,
-		Offset, OffsetFrequency, Squash, SquashFrequency, tint);
-		
-	if(Fac != 1.0) {
-		float facm = 1.0 - tint;
-
-		Col[0] = facm * (Color1[0]) + tint * Color2[0];
-		Col[1] = facm * (Color1[1]) + tint * Color2[1];
-		Col[2] = facm * (Color1[2]) + tint * Color2[2];
-	}
-	
-	Color = (Fac == 1.0) ? Mortar: Col;
-
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_brightness.osl b/intern/cycles/kernel/osl/nodes/node_brightness.osl
deleted file mode 100644
index 4f19a20..0000000
--- a/intern/cycles/kernel/osl/nodes/node_brightness.osl
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_brightness(
-	color ColorIn = color(0.8, 0.8, 0.8),
-	float Brightness = 0.0,
-	float Contrast = 0.0,
-	output color ColorOut = color(0.8, 0.8, 0.8))
-{
-	float delta = Contrast * (1.0/200.0);
-	float a = 1.0 - delta * 2.0;
-	float b;
-
-	/* input value is a percentage */
-	float bright_factor = Brightness / 100.0;
-
-	/*
-	* The algorithm is by Werner D. Streidt
-	* (http://visca.com/ffactory/archives/5-99/msg00021.html)
-	* Extracted of OpenCV demhist.c
-	*/
-
-	if (Contrast > 0.0) {
-		a = (a < 0.0 ? 1.0/a : 0.0);
-		b = a * (bright_factor - delta);
-	}
-	else {
-		delta *= -1.0;
-		b = a * (bright_factor + delta);
-	}
-
-	ColorOut = a * ColorIn + b;
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_bump.osl b/intern/cycles/kernel/osl/nodes/node_bump.osl
deleted file mode 100644
index a3849e7..0000000
--- a/intern/cycles/kernel/osl/nodes/node_bump.osl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-/* "Bump Mapping Unparametrized Surfaces on the GPU"
- * Morten S. Mikkelsen, 2010 */
-
-surface node_bump(
-	float SampleCenter = 0.0,
-	float SampleX = 0.0,
-	float SampleY = 0.0,
-	output normal Normal = N)
-{
-	float dx = SampleX - SampleCenter;
-	float dy = SampleY - SampleCenter;
-
-	vector dPdx = Dx(P);
-	vector dPdy = Dy(P);
-
-	vector Rx = cross(dPdy, N);
-	vector Ry = cross(N, dPdx);
-
-	float det = dot(dPdx, Rx);
-	vector surfgrad = dx*Rx + dy*Ry;
-
-	surfgrad *= 0.1; /* todo: remove this factor */
-	
-	Normal = normalize(abs(det)*N - sign(det)*surfgrad);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl b/intern/cycles/kernel/osl/nodes/node_checker_texture.osl
deleted file mode 100644
index e92d7be..0000000
--- a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2012, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Checker */
-
-float checker(point p)
-{
-	p[0] = (p[0] + 0.00001)*0.9999;
-	p[1] = (p[1] + 0.00001)*0.9999;
-	p[2] = (p[2] + 0.00001)*0.9999;
-	
-	int xi = (int)fabs(floor(p[0]));
-	int yi = (int)fabs(floor(p[1]));
-	int zi = (int)fabs(floor(p[2]));
-
-	if((xi % 2 == yi % 2) == (zi % 2)) {
-		return 1.0;
-	}
-	else {
-		return 0.0;
-	}
-}
-
-shader node_checker_texture(
-	float Scale = 5.0,
-	point Vector = P,
-	color Color1 = color(0.8, 0.8, 0.8),
-	color Color2 = color(0.2, 0.2, 0.2),
-	output float Fac = 0.0,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	Fac = checker(Vector*Scale);
-	if(Fac == 1.0) {
-		Color = Color1;
-	}
-	else {
-		Color = Color2;
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl
deleted file mode 100644
index 9735613..0000000
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_convert_from_color(
-	color Color = color(0.0, 0.0, 0.0),
-	output float Val = 0.0,
-	output vector Vector = vector(0.0, 0.0, 0.0),
-	output point Point = point(0.0, 0.0, 0.0),
-	output normal Normal = normal(0.0, 0.0, 0.0))
-{
-	Val = Color[0]*0.2126 + Color[1]*0.7152 + Color[2]*0.0722;
-	Vector = vector(Color[0], Color[1], Color[2]);
-	Point = point(Color[0], Color[1], Color[2]);
-	Normal = normal(Color[0], Color[1], Color[2]);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_float.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_float.osl
deleted file mode 100644
index 00e78f3..0000000
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_float.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_convert_from_float(
-	float Val = 0.0,
-	output color Color = color(0.0, 0.0, 0.0),
-	output vector Vector = vector(0.0, 0.0, 0.0),
-	output point Point = point(0.0, 0.0, 0.0),
-	output normal Normal = normal(0.0, 0.0, 0.0))
-{
-	Color = color(Val, Val, Val);
-	Vector = vector(Val, Val, Val);
-	Point = point(Val, Val, Val);
-	Normal = normal(Val, Val, Val);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
deleted file mode 100644
index 0bb9092..0000000
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_convert_from_normal(
-	normal Normal = normal(0.0, 0.0, 0.0),
-	output float Val = 0.0,
-	output vector Vector = vector(0.0, 0.0, 0.0),
-	output color Color = color(0.0, 0.0, 0.0),
-	output point Point = point(0.0, 0.0, 0.0))
-{
-	Val = (Normal[0] + Normal[1] + Normal[2])*(1.0/3.0);
-	Vector = vector(Normal[0], Normal[1], Normal[2]);
-	Color = color(Normal[0], Normal[1], Normal[2]);
-	Point = point(Normal[0], Normal[1], Normal[2]);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
deleted file mode 100644
index e66d6a8..0000000
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_convert_from_point(
-	point Point = point(0.0, 0.0, 0.0),
-	output float Val = 0.0,
-	output vector Vector = vector(0.0, 0.0, 0.0),
-	output color Color = color(0.0, 0.0, 0.0),
-	output normal Normal = normal(0.0, 0.0, 0.0))
-{
-	Val = (Point[0] + Point[1] + Point[2])*(1.0/3.0);
-	Vector = vector(Point[0], Point[1], Point[2]);
-	Color = color(Point[0], Point[1], Point[2]);
-	Normal = normal(Point[0], Point[1], Point[2]);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
deleted file mode 100644
index 37ba958..0000000
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_convert_from_vector(
-	vector Vector = vector(0.0, 0.0, 0.0),
-	output float Val = 0.0,
-	output color Color = color(0.0, 0.0, 0.0),
-	output point Point = point(0.0, 0.0, 0.0),
-	output normal Normal = normal(0.0, 0.0, 0.0))
-{
-	Val = (Vector[0] + Vector[1] + Vector[2])*(1.0/3.0);
-	Color = color(Vector[0], Vector[1], Vector[2]);
-	Point = point(Vector[0], Vector[1], Vector[2]);
-	Normal = normal(Vector[0], Vector[1], Vector[2]);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl
deleted file mode 100644
index 6075b7c..0000000
--- a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_diffuse_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	float Roughness = 0.0,
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	if(Roughness == 0.0)
-		BSDF = Color * diffuse(Normal);
-	else
-		BSDF = Color * oren_nayar(Normal, Roughness);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_emission.osl b/intern/cycles/kernel/osl/nodes/node_emission.osl
deleted file mode 100644
index 8bfd1af..0000000
--- a/intern/cycles/kernel/osl/nodes/node_emission.osl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_emission(
-	int TotalPower = 0,
-	color Color = color(0.8, 0.8, 0.8),
-	float Strength = 1.0,
-	output closure color Emission = emission())
-{
-	if(TotalPower)
-		Emission = ((Strength/surfacearea())*Color)*emission();
-	else
-		Emission = (Strength*Color)*emission();
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl b/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
deleted file mode 100644
index 3ad8067..0000000
--- a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_color.h"
-
-shader node_environment_texture(
-	vector Vector = P,
-	string filename = "",
-	string color_space = "sRGB",
-	output color Color = color(0.0, 0.0, 0.0),
-	output float Alpha = 1.0)
-{
-	Color = (color)environment(filename, Vector, "alpha", Alpha);
-
-	if(color_space == "sRGB")
-		Color = color_srgb_to_scene_linear(Color);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_fresnel.osl b/intern/cycles/kernel/osl/nodes/node_fresnel.osl
deleted file mode 100644
index 3af4448..0000000
--- a/intern/cycles/kernel/osl/nodes/node_fresnel.osl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_fresnel.h"
-
-shader node_fresnel(
-	float IOR = 1.45,
-	normal Normal = N,
-	output float Fac = 0.0)
-{
-	float f = max(IOR, 1.0 + 1e-5);
-	float eta = backfacing()? 1.0/f: f;
-	Fac = fresnel_dielectric(I, Normal, eta);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_geometry.osl b/intern/cycles/kernel/osl/nodes/node_geometry.osl
deleted file mode 100644
index 9efc2a7..0000000
--- a/intern/cycles/kernel/osl/nodes/node_geometry.osl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_geometry(
-	normal NormalIn = N,
-	string bump_offset = "center",
-
-	output point Position = point(0.0, 0.0, 0.0),
-	output normal Normal = normal(0.0, 0.0, 0.0),
-	output normal Tangent = normal(0.0, 0.0, 0.0),
-	output normal TrueNormal = normal(0.0, 0.0, 0.0),
-	output vector Incoming = vector(0.0, 0.0, 0.0),
-	output point Parametric = point(0.0, 0.0, 0.0),
-	output float Backfacing = 0.0)
-{
-	Position = P;
-	Normal = NormalIn;
-	Tangent = normalize(dPdu);
-	TrueNormal = Ng;
-	Incoming = I;
-	Parametric = point(u, v, 0.0);
-	Backfacing = backfacing();
-
-	if(bump_offset == "dx") {
-		Position += Dx(Position);
-		Parametric += Dx(Parametric);
-	}
-	else if(bump_offset == "dy") {
-		Position += Dy(Position);
-		Parametric += Dy(Parametric);
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
deleted file mode 100644
index 5274366..0000000
--- a/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_fresnel.h"
-
-shader node_glass_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	string distribution = "Sharp",
-	float Roughness = 0.2,
-	float IOR = 1.45,
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	float f = max(IOR, 1.0 + 1e-5);
-	float eta = backfacing()? 1.0/f: f;
-	float Fr = fresnel_dielectric(I, Normal, eta);
-
-	if(distribution == "Sharp")
-		BSDF = Color*(Fr*reflection(Normal) + (1.0-Fr)*refraction(Normal, eta));
-	else if(distribution == "Beckmann")
-		BSDF = Color*(Fr*microfacet_beckmann(Normal, Roughness, eta) + (1.0-Fr)*microfacet_beckmann_refraction(Normal, Roughness, eta));
-	else if(distribution == "GGX")
-		BSDF = Color*(Fr*microfacet_ggx(Normal, Roughness, eta) + (1.0-Fr)*microfacet_ggx_refraction(Normal, Roughness, eta));
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
deleted file mode 100644
index 3890630..0000000
--- a/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_fresnel.h"
-
-shader node_glossy_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	string distribution = "Beckmann",
-	float Roughness = 0.2,
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	if(distribution == "Sharp")
-		BSDF = Color*reflection(Normal);
-	else if(distribution == "Beckmann")
-		BSDF = Color*microfacet_beckmann(Normal, Roughness, 1.0);
-	else if(distribution == "GGX")
-		BSDF = Color*microfacet_ggx(Normal, Roughness, 1.0);
-
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl b/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
deleted file mode 100644
index e0cbc2c..0000000
--- a/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Gradient */
-
-float gradient(point p, string type)
-{
-	float x, y, z;
-	
-	x = p[0];
-	y = p[1];
-	z = p[2];
-
-	float result = 0.0;
-
-	if(type == "Linear") {
-		result = x;
-	}
-	else if(type == "Quadratic") {
-		float r = max(x, 0.0);
-		result = r*r;
-	}
-	else if(type == "Easing") {
-		float r = min(max(x, 0.0), 1.0);
-		float t = r*r;
-		
-		result = (3.0*t - 2.0*t*r);
-	}
-	else if(type == "Diagonal") {
-		result = (x + y)/2.0;
-	}
-	else if(type == "Radial") {
-		result = atan2(y, x)/(2.0*M_PI) + 0.5;
-	}
-	else {
-		float r = max(1.0 - sqrt(x*x + y*y + z*z), 0.0);
-
-		if(type == "Quadratic Sphere")
-			result = r*r;
-		else if(type == "Spherical")
-			result = r;
-	}
-
-	return result;
-}
-
-shader node_gradient_texture(
-	string Type = "Linear",
-	point Vector = P,
-	output float Fac = 0.0,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	Fac = gradient(Vector, Type);
-	Color = color(Fac, Fac, Fac);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_hsv.osl b/intern/cycles/kernel/osl/nodes/node_hsv.osl
deleted file mode 100644
index 8fd7a16..0000000
--- a/intern/cycles/kernel/osl/nodes/node_hsv.osl
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_color.h"
-
-shader node_hsv(
-	float Hue = 0.5,
-	float Saturation = 1.0,
-	float Value = 1.0,
-	float Fac = 0.5,
-	color ColorIn = color(0.0, 0.0, 0.0),
-	output color ColorOut = color(0.0, 0.0, 0.0))
-{
-	float t = clamp(Fac, 0.0, 1.0);
-	color Color = rgb_to_hsv(ColorIn);
-
-	// remember: fmod doesn't work for negative numbers
-	Color[0] += Hue + 0.5;
-	Color[0] = fmod(Color[0], 1.0);
-	Color[1] *= Saturation;
-	Color[2] *= Value;
-
-	Color = hsv_to_rgb(Color);
-
-	ColorOut = mix(Color, ColorIn, t);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_image_texture.osl b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
deleted file mode 100644
index 3812640..0000000
--- a/intern/cycles/kernel/osl/nodes/node_image_texture.osl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_color.h"
-
-shader node_image_texture(
-	point Vector = P,
-	string filename = "",
-	string color_space = "sRGB",
-	output color Color = color(0.0, 0.0, 0.0),
-	output float Alpha = 1.0)
-{
-	Color = (color)texture(filename, Vector[0], 1.0-Vector[1], "wrap", "periodic", "alpha", Alpha);
-
-	if(color_space == "sRGB")
-		Color = color_srgb_to_scene_linear(Color);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_light_path.osl b/intern/cycles/kernel/osl/nodes/node_light_path.osl
deleted file mode 100644
index 0ead20b..0000000
--- a/intern/cycles/kernel/osl/nodes/node_light_path.osl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_light_path(
-	output float IsCameraRay = 0.0,
-	output float IsShadowRay = 0.0,
-	output float IsDiffuseRay = 0.0,
-	output float IsGlossyRay = 0.0,
-	output float IsSingularRay = 0.0,
-	output float IsReflectionRay = 0.0,
-	output float IsTransmissionRay = 0.0)
-{
-	IsCameraRay = raytype("camera");
-	IsShadowRay = raytype("shadow");
-	IsDiffuseRay = raytype("diffuse");
-	IsGlossyRay = raytype("glossy");
-	IsSingularRay = raytype("singular");
-	IsReflectionRay = raytype("reflection");
-	IsTransmissionRay = raytype("refraction");
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_magic_texture.osl b/intern/cycles/kernel/osl/nodes/node_magic_texture.osl
deleted file mode 100644
index c013ebf..0000000
--- a/intern/cycles/kernel/osl/nodes/node_magic_texture.osl
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Magic */
-
-color magic(point p, int n, float distortion)
-{
-	float dist = distortion;
-
-	float x = sin((p[0] + p[1] + p[2])*5.0);
-	float y = cos((-p[0] + p[1] - p[2])*5.0);
-	float z = -cos((-p[0] - p[1] + p[2])*5.0);
-
-	if(n > 0) {
-		x *= dist;
-		y *= dist;
-		z *= dist;
-		y = -cos(x-y+z);
-		y *= dist;
-
-		if(n > 1) {
-			x = cos(x-y-z);
-			x *= dist;
-
-			if(n > 2) {
-				z = sin(-x-y-z);
-				z *= dist;
-
-				if(n > 3) {
-					x = -cos(-x+y-z);
-					x *= dist;
-
-					if(n > 4) {
-						y = -sin(-x+y+z);
-						y *= dist;
-
-						if(n > 5) {
-							y = -cos(-x+y+z);
-							y *= dist;
-
-							if(n > 6) {
-								x = cos(x+y+z);
-								x *= dist;
-
-								if(n > 7) {
-									z = sin(x+y-z);
-									z *= dist;
-
-									if(n > 8) {
-										x = -cos(-x-y+z);
-										x *= dist;
-
-										if(n > 9) {
-											y = -sin(x-y+z);
-											y *= dist;
-										}
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-
-	if(dist != 0.0) {
-		dist *= 2.0;
-		x /= dist;
-		y /= dist;
-		z /= dist;
-	}
-
-	return color(0.5 - x, 0.5 - y, 0.5 - z);
-}
-
-shader node_magic_texture(
-	int Depth = 2,
-	float Distortion = 5.0,
-	float Scale = 5.0,
-	point Vector = P,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	Color = magic(Vector*Scale, Depth, Distortion);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_mapping.osl b/intern/cycles/kernel/osl/nodes/node_mapping.osl
deleted file mode 100644
index f342837..0000000
--- a/intern/cycles/kernel/osl/nodes/node_mapping.osl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_mapping(
-	matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
-	point Vector = point(0.0, 0.0, 0.0),
-	output point Vector_ = point(0.0, 0.0, 0.0))
-{
-	Vector_ = transform(Matrix, Vector);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_math.osl b/intern/cycles/kernel/osl/nodes/node_math.osl
deleted file mode 100644
index 3327795..0000000
--- a/intern/cycles/kernel/osl/nodes/node_math.osl
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-float safe_divide(float a, float b)
-{
-	float result;
-
-	if(b == 0.0)
-		result = 0.0;
-	else
-		result = a/b;
-	
-	return result;
-}
-
-float safe_log(float a, float b)
-{
-	if(a < 0.0 || b < 0.0)
-		return 0.0;
-	
-	return log(a)/log(b);
-}
-
-shader node_math(
-	string type = "Add",
-	int Clamp = 0,
-	float Value1 = 0.0,
-	float Value2 = 0.0,
-	output float Value = 0.0)
-{
-	/* OSL asin, acos, pow check for values that could give rise to nan */
-
-	if(type == "Add")
-		Value = Value1 + Value2;
-	if(type == "Subtract")
-		Value = Value1 - Value2;
-	if(type == "Multiply")
-		Value = Value1*Value2;
-	if(type == "Divide")
-		Value = safe_divide(Value1, Value2);
-	if(type == "Sine")
-		Value = sin(Value1);
-	if(type == "Cosine")
-		Value = cos(Value1);
-	if(type == "Tangent")
-		Value = tan(Value1);
-	if(type == "Arcsine")
-		Value = asin(Value1);
-	if(type == "Arccosine")
-		Value = acos(Value1);
-	if(type == "Arctangent")
-		Value = atan(Value1);
-	if(type == "Power")
-		Value = pow(Value1, Value2);
-	if(type == "Logarithm")
-		Value = safe_log(Value1, Value2);
-	if(type == "Minimum")
-		Value = min(Value1, Value2);
-	if(type == "Maximum")
-		Value = max(Value1, Value2);
-	if(type == "Round")
-		Value = floor(Value1 + 0.5);
-	if(type == "Less Than")
-		Value = Value1 < Value2;
-	if(type == "Greater Than")
-		Value = Value1 > Value2;
-
-	if(Clamp)
-		Value = clamp(Value1, 0.0, 1.0);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_mix.osl b/intern/cycles/kernel/osl/nodes/node_mix.osl
deleted file mode 100644
index 2ce342c..0000000
--- a/intern/cycles/kernel/osl/nodes/node_mix.osl
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_color.h"
-
-color node_mix_blend(float t, color col1, color col2)
-{
-	return mix(col1, col2, t);
-}
-
-color node_mix_add(float t, color col1, color col2)
-{
-	return mix(col1, col1 + col2, t);
-}
-
-color node_mix_mul(float t, color col1, color col2)
-{
-	return mix(col1, col1 * col2, t);
-}
-
-color node_mix_screen(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	return color(1.0) - (color(tm) + t*(color(1.0) - col2))*(color(1.0) - col1);
-}
-
-color node_mix_overlay(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	color outcol = col1;
-
-	if(outcol[0] < 0.5)
-		outcol[0] *= tm + 2.0*t*col2[0];
-	else
-		outcol[0] = 1.0 - (tm + 2.0*t*(1.0 - col2[0]))*(1.0 - outcol[0]);
-
-	if(outcol[1] < 0.5)
-		outcol[1] *= tm + 2.0*t*col2[1];
-	else
-		outcol[1] = 1.0 - (tm + 2.0*t*(1.0 - col2[1]))*(1.0 - outcol[1]);
-
-	if(outcol[2] < 0.5)
-		outcol[2] *= tm + 2.0*t*col2[2];
-	else
-		outcol[2] = 1.0 - (tm + 2.0*t*(1.0 - col2[2]))*(1.0 - outcol[2]);
-	
-	return outcol;
-}
-
-color node_mix_sub(float t, color col1, color col2)
-{
-	return mix(col1, col1 - col2, t);
-}
-
-color node_mix_div(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	color outcol = col1;
-
-	if(col2[0] != 0.0) outcol[0] = tm*outcol[0] + t*outcol[0]/col2[0];
-	if(col2[1] != 0.0) outcol[1] = tm*outcol[1] + t*outcol[1]/col2[1];
-	if(col2[2] != 0.0) outcol[2] = tm*outcol[2] + t*outcol[2]/col2[2];
-
-	return outcol;
-}
-
-color node_mix_diff(float t, color col1, color col2)
-{
-	return mix(col1, abs(col1 - col2), t);
-}
-
-color node_mix_dark(float t, color col1, color col2)
-{
-	return min(col1, col2*t);
-}
-
-color node_mix_light(float t, color col1, color col2)
-{
-	return max(col1, col2*t);
-}
-
-color node_mix_dodge(float t, color col1, color col2)
-{
-	color outcol = col1;
-
-	if(outcol[0] != 0.0) {
-		float tmp = 1.0 - t*col2[0];
-		if(tmp <= 0.0)
-			outcol[0] = 1.0;
-		else if((tmp = outcol[0]/tmp) > 1.0)
-			outcol[0] = 1.0;
-		else
-			outcol[0] = tmp;
-	}
-	if(outcol[1] != 0.0) {
-		float tmp = 1.0 - t*col2[1];
-		if(tmp <= 0.0)
-			outcol[1] = 1.0;
-		else if((tmp = outcol[1]/tmp) > 1.0)
-			outcol[1] = 1.0;
-		else
-			outcol[1] = tmp;
-	}
-	if(outcol[2] != 0.0) {
-		float tmp = 1.0 - t*col2[2];
-		if(tmp <= 0.0)
-			outcol[2] = 1.0;
-		else if((tmp = outcol[2]/tmp) > 1.0)
-			outcol[2] = 1.0;
-		else
-			outcol[2] = tmp;
-	}
-
-	return outcol;
-}
-
-color node_mix_burn(float t, color col1, color col2)
-{
-	float tmp, tm = 1.0 - t;
-
-	color outcol = col1;
-
-	tmp = tm + t*col2[0];
-	if(tmp <= 0.0)
-		outcol[0] = 0.0;
-	else if((tmp = (1.0 - (1.0 - outcol[0])/tmp)) < 0.0)
-		outcol[0] = 0.0;
-	else if(tmp > 1.0)
-		outcol[0] = 1.0;
-	else
-		outcol[0] = tmp;
-
-	tmp = tm + t*col2[1];
-	if(tmp <= 0.0)
-		outcol[1] = 0.0;
-	else if((tmp = (1.0 - (1.0 - outcol[1])/tmp)) < 0.0)
-		outcol[1] = 0.0;
-	else if(tmp > 1.0)
-		outcol[1] = 1.0;
-	else
-		outcol[1] = tmp;
-
-	tmp = tm + t*col2[2];
-	if(tmp <= 0.0)
-		outcol[2] = 0.0;
-	else if((tmp = (1.0 - (1.0 - outcol[2])/tmp)) < 0.0)
-		outcol[2] = 0.0;
-	else if(tmp > 1.0)
-		outcol[2] = 1.0;
-	else
-		outcol[2] = tmp;
-	
-	return outcol;
-}
-
-color node_mix_hue(float t, color col1, color col2)
-{
-	color outcol = col1;
-	color hsv2 = rgb_to_hsv(col2);
-
-	if(hsv2[1] != 0.0) {
-		color hsv = rgb_to_hsv(outcol);
-		hsv[0] = hsv2[0];
-		color tmp = hsv_to_rgb(hsv); 
-
-		outcol = mix(outcol, tmp, t);
-	}
-
-	return outcol;
-}
-
-color node_mix_sat(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	color outcol = col1;
-
-	color hsv = rgb_to_hsv(outcol);
-
-	if(hsv[1] != 0.0) {
-		color hsv2 = rgb_to_hsv(col2);
-
-		hsv[1] = tm*hsv[1] + t*hsv2[1];
-		outcol = hsv_to_rgb(hsv);
-	}
-
-	return outcol;
-}
-
-color node_mix_val(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	color hsv = rgb_to_hsv(col1);
-	color hsv2 = rgb_to_hsv(col2);
-
-	hsv[2] = tm*hsv[2] + t*hsv2[2];
-
-	return hsv_to_rgb(hsv);
-}
-
-color node_mix_color(float t, color col1, color col2)
-{
-	color outcol = col1;
-	color hsv2 = rgb_to_hsv(col2);
-
-	if(hsv2[1] != 0.0) {
-		color hsv = rgb_to_hsv(outcol);
-		hsv[0] = hsv2[0];
-		hsv[1] = hsv2[1];
-		color tmp = hsv_to_rgb(hsv); 
-
-		outcol = mix(outcol, tmp, t);
-	}
-
-	return outcol;
-}
-
-color node_mix_soft(float t, color col1, color col2)
-{
-	float tm = 1.0 - t;
-
-	color one = color(1.0);
-	color scr = one - (one - col2)*(one - col1);
-
-	return tm*col1 + t*((one - col1)*col2*col1 + col1*scr);
-}
-
-color node_mix_linear(float t, color col1, color col2)
-{
-	color outcol = col1;
-
-	if(col2[0] > 0.5)
-		outcol[0]= col1[0] + t*(2.0*(col2[0] - 0.5));
-	else
-		outcol[0]= col1[0] + t*(2.0*(col2[0]) - 1.0);
-
-	if(col2[1] > 0.5)
-		outcol[1]= col1[1] + t*(2.0*(col2[1] - 0.5));
-	else
-		outcol[1]= col1[1] + t*(2.0*(col2[1]) - 1.0);
-
-	if(col2[2] > 0.5)
-		outcol[2]= col1[2] + t*(2.0*(col2[2] - 0.5));
-	else
-		outcol[2]= col1[2] + t*(2.0*(col2[2]) - 1.0);
-	
-	return outcol;
-}
-
-color node_mix_clamp(color col)
-{
-	color outcol = col;
-
-	outcol[0] = clamp(col[0], 0.0, 1.0);
-	outcol[1] = clamp(col[2], 0.0, 1.0);
-	outcol[2] = clamp(col[2], 0.0, 1.0);
-
-	return outcol;
-}
-
-shader node_mix(
-	string type = "Mix",
-	int Clamp = 0,
-	float Fac = 0.5,
-	color Color1 = color(0.0, 0.0, 0.0),
-	color Color2 = color(0.0, 0.0, 0.0),
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	float t = clamp(Fac, 0.0, 1.0);
-
-	if(type == "Mix")
-		Color = node_mix_blend(t, Color1, Color2);
-	if(type == "Add")
-		Color = node_mix_add(t, Color1, Color2);
-	if(type == "Multiply")
-		Color = node_mix_mul(t, Color1, Color2);
-	if(type == "Screen")
-		Color = node_mix_screen(t, Color1, Color2);
-	if(type == "Overlay")
-		Color = node_mix_overlay(t, Color1, Color2);
-	if(type == "Subtract")
-		Color = node_mix_sub(t, Color1, Color2);
-	if(type == "Divide")
-		Color = node_mix_div(t, Color1, Color2);
-	if(type == "Difference")
-		Color = node_mix_diff(t, Color1, Color2);
-	if(type == "Darken")
-		Color = node_mix_dark(t, Color1, Color2);
-	if(type == "Lighten")
-		Color = node_mix_light(t, Color1, Color2);
-	if(type == "Dodge")
-		Color = node_mix_dodge(t, Color1, Color2);
-	if(type == "Burn")
-		Color = node_mix_burn(t, Color1, Color2);
-	if(type == "Hue")
-		Color = node_mix_hue(t, Color1, Color2);
-	if(type == "Saturation")
-		Color = node_mix_sat(t, Color1, Color2);
-	if(type == "Value")
-		Color = node_mix_val (t, Color1, Color2);
-	if(type == "Color")
-		Color = node_mix_color(t, Color1, Color2);
-	if(type == "Soft Light")
-		Color = node_mix_soft(t, Color1, Color2);
-	if(type == "Linear Light")
-		Color = node_mix_linear(t, Color1, Color2);
-
-	if(Clamp)
-		Color = node_mix_clamp(Color);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_mix_closure.osl b/intern/cycles/kernel/osl/nodes/node_mix_closure.osl
deleted file mode 100644
index 1a377ab..0000000
--- a/intern/cycles/kernel/osl/nodes/node_mix_closure.osl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_mix_closure(
-	float Fac = 0.5,
-	closure color Closure1 = background(),
-	closure color Closure2 = background(),
-	output closure color Closure = background())
-{
-	float t = clamp(Fac, 0.0, 1.0);
-	Closure = (1.0 - t)*Closure1 + t*Closure2;
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl b/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
deleted file mode 100644
index 7d125d5..0000000
--- a/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Musgrave fBm
- *
- * H: fractal increment parameter
- * lacunarity: gap between successive frequencies
- * octaves: number of frequencies in the fBm
- *
- * from "Texturing and Modelling: A procedural approach"
- */
-
-float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float octaves)
-{
-	float rmd;
-	float value = 0.0;
-	float pwr = 1.0;
-	float pwHL = pow(lacunarity, -H);
-	int i;
-
-	for(i = 0; i < (int)octaves; i++) {
-		value += noise("perlin", p) * pwr;
-		pwr *= pwHL;
-		p *= lacunarity;
-	}
-
-	rmd = octaves - floor(octaves);
-	if(rmd != 0.0)
-		value += rmd * noise("perlin", p) * pwr;
-
-	return value;
-}
-
-/* Musgrave Multifractal
- *
- * H: highest fractal dimension
- * lacunarity: gap between successive frequencies
- * octaves: number of frequencies in the fBm
- */
-
-float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunarity, float octaves)
-{
-	float rmd;
-	float value = 1.0;
-	float pwr = 1.0;
-	float pwHL = pow(lacunarity, -H);
-	int i;
-
-	for(i = 0; i < (int)octaves; i++) {
-		value *= (pwr * noise("perlin", p) + 1.0);
-		pwr *= pwHL;
-		p *= lacunarity;
-	}
-
-	rmd = octaves - floor(octaves);
-	if(rmd != 0.0)
-		value *= (rmd * pwr * noise("perlin", p) + 1.0); /* correct? */
-
-	return value;
-}
-
-/* Musgrave Heterogeneous Terrain
- *
- * H: fractal dimension of the roughest area
- * lacunarity: gap between successive frequencies
- * octaves: number of frequencies in the fBm
- * offset: raises the terrain from `sea level'
- */
-
-float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacunarity, float octaves, float offset)
-{
-	float value, increment, rmd;
-	float pwHL = pow(lacunarity, -H);
-	float pwr = pwHL;
-	int i;
-
-	/* first unscaled octave of function; later octaves are scaled */
-	value = offset + noise("perlin", p);
-	p *= lacunarity;
-
-	for(i = 1; i < (int)octaves; i++) {
-		increment = (noise("perlin", p) + offset) * pwr * value;
-		value += increment;
-		pwr *= pwHL;
-		p *= lacunarity;
-	}
-
-	rmd = octaves - floor(octaves);
-	if(rmd != 0.0) {
-		increment = (noise("perlin", p) + offset) * pwr * value;
-		value += rmd * increment;
-	}
-
-	return value;
-}
-
-/* Hybrid Additive/Multiplicative Multifractal Terrain
- *
- * H: fractal dimension of the roughest area
- * lacunarity: gap between successive frequencies
- * octaves: number of frequencies in the fBm
- * offset: raises the terrain from `sea level'
- */
-
-float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float lacunarity, float octaves, float offset, float gain)
-{
-	float result, signal, weight, rmd;
-	float pwHL = pow(lacunarity, -H);
-	float pwr = pwHL;
-	int i;
-
-	result = noise("perlin", p) + offset;
-	weight = gain * result;
-	p *= lacunarity;
-
-	for(i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
-		if(weight > 1.0)
-			weight = 1.0;
-
-		signal = (noise("perlin", p) + offset) * pwr;
-		pwr *= pwHL;
-		result += weight * signal;
-		weight *= gain * signal;
-		p *= lacunarity;
-	}
-
-	rmd = octaves - floor(octaves);
-	if(rmd != 0.0)
-		result += rmd * ((noise("perlin", p) + offset) * pwr);
-
-	return result;
-}
-
-/* Ridged Multifractal Terrain
- *
- * H: fractal dimension of the roughest area
- * lacunarity: gap between successive frequencies
- * octaves: number of frequencies in the fBm
- * offset: raises the terrain from `sea level'
- */
-
-float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, float lacunarity, float octaves, float offset, float gain)
-{
-	float result, signal, weight;
-	float pwHL = pow(lacunarity, -H);
-	float pwr = pwHL;
-	int i;
-
-	signal = offset - fabs(noise("perlin", p));
-	signal *= signal;
-	result = signal;
-	weight = 1.0;
-
-	for(i = 1; i < (int)octaves; i++) {
-		p *= lacunarity;
-		weight = clamp(signal * gain, 0.0, 1.0);
-		signal = offset - fabs(noise("perlin", p));
-		signal *= signal;
-		signal *= weight;
-		result += signal * pwr;
-		pwr *= pwHL;
-	}
-
-	return result;
-}
-
-/* Shader */
-
-shader node_musgrave_texture(
-	string Type = "fBM",
-	float Dimension = 2.0,
-	float Lacunarity = 1.0,
-	float Detail = 2.0,
-	float Offset = 0.0,
-	float Gain = 1.0,
-	float Scale = 5.0,
-	point Vector = P,
-	output float Fac = 0.0,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	float dimension = max(Dimension, 1e-5);
-	float octaves = clamp(Detail, 0.0, 16.0);
-	float lacunarity = max(Lacunarity, 1e-5);
-	string Basis = "Perlin";
-	float intensity = 1.0;
-
-	point p = Vector*Scale;
-
-	if(Type == "Multifractal")
-		Fac = intensity*noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
-	else if(Type == "fBM")
-		Fac = intensity*noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
-	else if(Type == "Hybrid Multifractal")
-		Fac = intensity*noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
-	else if(Type == "Ridged Multifractal")
-		Fac = intensity*noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
-	else if(Type == "Hetero Terrain")
-		Fac = intensity*noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
-	
-	Color = color(Fac, Fac, Fac);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
deleted file mode 100644
index 1ddb4d8..0000000
--- a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Noise */
-
-float noise(point p, string basis, float distortion, float detail, float fac, color Color)
-{
-	point r;
-	int hard = 0;
-	
-	if(distortion != 0.0) {
-		r[0] = noise_basis(p + point(13.5), basis) * distortion;
-		r[1] = noise_basis(p, basis) * distortion;
-		r[2] = noise_basis(p - point(13.5), basis) * distortion;
-		
-		p += r;
-	}
-
-	fac = noise_turbulence(p, basis, detail, hard);
-	
-	Color = color(fac, noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard),
-		noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard));
-
-	return fac;
-}
-
-shader node_noise_texture(
-	float Distortion = 0.0,
-	float Scale = 5.0,
-	float Detail = 2.0,
-	point Vector = P,
-	output float Fac = 0.0,
-	output color Color = color(0.2, 0.2, 0.2))
-{
-	string Basis = "Perlin";
-	Fac = noise(Vector*Scale, Basis, Distortion, Detail, Fac, Color);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_object_info.osl b/intern/cycles/kernel/osl/nodes/node_object_info.osl
deleted file mode 100644
index 21e50d8..0000000
--- a/intern/cycles/kernel/osl/nodes/node_object_info.osl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_object_info(
-    output point Location = point(0.0, 0.0, 0.0),
-    output float ObjectIndex = 0.0,
-    output float MaterialIndex = 0.0,
-    output float Random = 0.0
-    )
-{
-    getattribute("std::object_location", Location);
-    getattribute("std::object_index", ObjectIndex);
-    getattribute("std::material_index", MaterialIndex);
-    getattribute("std::object_random", Random);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_output_displacement.osl b/intern/cycles/kernel/osl/nodes/node_output_displacement.osl
deleted file mode 100644
index a6b452c..0000000
--- a/intern/cycles/kernel/osl/nodes/node_output_displacement.osl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-displacement node_output_displacement(float Displacement = 0.0)
-{
-	P += N*Displacement*0.1; /* todo: get rid of this factor */
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_particle_info.osl b/intern/cycles/kernel/osl/nodes/node_particle_info.osl
deleted file mode 100644
index aadc281..0000000
--- a/intern/cycles/kernel/osl/nodes/node_particle_info.osl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_particle_info(
-    output float Index = 0.0,
-    output float Age = 0.0,
-    output float Lifetime = 0.0,
-    output point Location = point(0.0, 0.0, 0.0),
-    output float Size = 0.0,
-    output vector Velocity = point(0.0, 0.0, 0.0),
-    output vector AngularVelocity = point(0.0, 0.0, 0.0)
-    )
-{
-    getattribute("std::particle_index", Index);
-    getattribute("std::particle_age", Age);
-    getattribute("std::particle_lifetime", Lifetime);
-    getattribute("std::particle_location", Location);
-    getattribute("std::particle_size", Size);
-    getattribute("std::particle_velocity", Velocity);
-    getattribute("std::particle_angular_velocity", AngularVelocity);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl b/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
deleted file mode 100644
index 2bc10f3..0000000
--- a/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "oslutil.h"
-
-shader node_rgb_ramp(
-    color ramp_color[RAMP_TABLE_SIZE] = {0.0},
-    float ramp_alpha[RAMP_TABLE_SIZE] = {0.0},
-
-    float Fac = 0.0,
-    output color Color = color(0.0, 0.0, 0.0),
-    output float Alpha = 1.0
-    )
-{
-    float f = clamp(Fac, 0.0, 1.0)*(RAMP_TABLE_SIZE-1);
-
-    int i = (int)f;
-    float t = f - (float)i;
-
-    Color = ramp_color[i];
-    Alpha = ramp_alpha[i];
-
-    if (t > 0.0) {
-        Color = (1.0 - t)*Color + t*ramp_color[i+1];
-        Alpha = (1.0 - t)*Alpha + t*ramp_alpha[i+1];
-    }
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_sky_texture.osl b/intern/cycles/kernel/osl/nodes/node_sky_texture.osl
deleted file mode 100644
index fdb9b1d..0000000
--- a/intern/cycles/kernel/osl/nodes/node_sky_texture.osl
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-struct KernelSunSky {
-	/* sun direction in spherical and cartesian */
-	float theta, phi;
-	vector dir;
-
-	/* perez function parameters */
-	float zenith_Y, zenith_x, zenith_y;
-	float perez_Y[5], perez_x[5], perez_y[5];
-};
-
-color xyY_to_xyz(float x, float y, float Y)
-{
-	float X, Z;
-
-	if(y != 0.0) X = (x / y) * Y;
-	else X = 0.0;
-
-	if(y != 0.0 && Y != 0.0) Z = ((1.0 - x - y) / y) * Y;
-	else Z = 0.0;
-
-	return color(X, Y, Z);
-}
-
-color xyz_to_rgb(float x, float y, float z)
-{
-	return color(3.240479 * x + -1.537150 * y + -0.498535 * z,
-				 -0.969256 * x + 1.875991 * y + 0.041556 * z,
-				 0.055648 * x + -0.204043 * y + 1.057311 * z);
-}
-
-float sky_angle_between(float thetav, float phiv, float theta, float phi)
-{
-	float cospsi = sin(thetav)*sin(theta)*cos(phi - phiv) + cos(thetav)*cos(theta);
-
-	if(cospsi > 1.0)
-		return 0.0;
-	if(cospsi < -1.0)
-		return M_PI;
-
-	return acos(cospsi);
-}
-
-vector sky_spherical_coordinates(vector dir)
-{
-	return vector(acos(dir[2]), atan2(dir[0], dir[1]), 0);
-}
-
-float sky_perez_function(float lam[5], float theta, float gamma)
-{
-	float ctheta = cos(theta);
-	float cgamma = cos(gamma);
-
-	return (1.0 + lam[0]*exp(lam[1] / ctheta)) * (1.0 + lam[2]*exp(lam[3]*gamma) + lam[4]*cgamma*cgamma);
-}
-
-color sky_xyz_radiance(KernelSunSky sunsky, vector dir)
-{
-	/* convert vector to spherical coordinates */
-	vector spherical = sky_spherical_coordinates(dir);
-	float theta = spherical[0];
-	float phi = spherical[1];
-
-	/* angle between sun direction and dir */
-	float gamma = sky_angle_between(theta, phi, sunsky.theta, sunsky.phi);
-
-	/* clamp theta to horizon */
-	theta = min(theta, M_PI_2 - 0.001);
-
-	/* compute xyY color space values */
-	float x = sunsky.zenith_x * sky_perez_function(sunsky.perez_x, theta, gamma);
-	float y = sunsky.zenith_y * sky_perez_function(sunsky.perez_y, theta, gamma);
-	float Y = sunsky.zenith_Y * sky_perez_function(sunsky.perez_Y, theta, gamma);
-
-	/* convert to RGB */
-	color xyz = xyY_to_xyz(x, y, Y);
-	return xyz_to_rgb(xyz[0], xyz[1], xyz[2]);
-}
-
-void precompute_sunsky(vector dir, float turbidity, output KernelSunSky sunsky)
-{
-	vector spherical = sky_spherical_coordinates(dir);
-	float theta = spherical[0];
-	float phi = spherical[1];
-
-	sunsky.theta = theta;
-	sunsky.phi = phi;
-	sunsky.dir = dir;
-
-	float theta2 = theta*theta;
-	float theta3 = theta*theta*theta;
-	float T = turbidity;
-	float T2 = T*T;
-
-	float chi = (4.0/ 9.0- T / 120.0) * (M_PI - 2.0* theta);
-	sunsky.zenith_Y = (4.0453*T - 4.9710) * tan(chi) - 0.2155*T + 2.4192;
-	sunsky.zenith_Y *= 0.06;
-
-	sunsky.zenith_x =
-	(0.00166* theta3 - 0.00375* theta2 + 0.00209* theta)*T2 +
-	(-0.02903* theta3 + 0.06377* theta2 - 0.03202* theta + 0.00394)*T +
-	(0.11693* theta3 - 0.21196* theta2 + 0.06052* theta + 0.25886);
-
-	sunsky.zenith_y =
-	(0.00275* theta3 - 0.00610* theta2 + 0.00317* theta)*T2 +
-	(-0.04214* theta3 + 0.08970* theta2 - 0.04153* theta + 0.00516)*T +
-	(0.15346* theta3 - 0.26756* theta2 + 0.06670* theta + 0.26688);
-
-	sunsky.perez_Y[0] = (0.1787*T - 1.4630);
-	sunsky.perez_Y[1] = (-0.3554*T + 0.4275);
-	sunsky.perez_Y[2] = (-0.0227*T + 5.3251);
-	sunsky.perez_Y[3] = (0.1206*T - 2.5771);
-	sunsky.perez_Y[4] = (-0.0670*T + 0.3703);
-
-	sunsky.perez_x[0] = (-0.0193*T - 0.2592);
-	sunsky.perez_x[1] = (-0.0665*T + 0.0008);
-	sunsky.perez_x[2] = (-0.0004*T + 0.2125);
-	sunsky.perez_x[3] = (-0.0641*T - 0.8989);
-	sunsky.perez_x[4] = (-0.0033*T + 0.0452);
-
-	sunsky.perez_y[0] = (-0.0167*T - 0.2608);
-	sunsky.perez_y[1] = (-0.0950*T + 0.0092);
-	sunsky.perez_y[2] = (-0.0079*T + 0.2102);
-	sunsky.perez_y[3] = (-0.0441*T - 1.6537);
-	sunsky.perez_y[4] = (-0.0109*T + 0.0529);
-
-	sunsky.zenith_Y /= sky_perez_function(sunsky.perez_Y, 0, theta);
-	sunsky.zenith_x /= sky_perez_function(sunsky.perez_x, 0, theta);
-	sunsky.zenith_y /= sky_perez_function(sunsky.perez_y, 0, theta);
-}
-
-shader node_sky_texture(
-	vector Vector = P,
-	vector sun_direction = vector(0, 0, 1),
-	float turbidity = 2.2,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	KernelSunSky sunsky;
-
-	precompute_sunsky(sun_direction, turbidity, sunsky);
-	Color = sky_xyz_radiance(sunsky, Vector);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_texture.h b/intern/cycles/kernel/osl/nodes/node_texture.h
deleted file mode 100644
index 7cd0742..0000000
--- a/intern/cycles/kernel/osl/nodes/node_texture.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/* Voronoi Distances */
-
-float voronoi_distance(string distance_metric, vector d, float e)
-{
-	float result = 0.0;
-
-	if (distance_metric == "Distance Squared")
-		result = dot(d, d);
-	if (distance_metric == "Actual Distance")
-		result = length(d);
-	if (distance_metric == "Manhattan")
-		result = fabs(d[0]) + fabs(d[1]) + fabs(d[2]);
-	if (distance_metric == "Chebychev")
-		result = max(fabs(d[0]), max(fabs(d[1]), fabs(d[2])));
-	if (distance_metric == "Minkovsky 1/2")
-		result = sqrt(fabs(d[0])) + sqrt(fabs(d[1])) + sqrt(fabs(d[1]));
-	if (distance_metric == "Minkovsky 4")
-		result = sqrt(sqrt(dot(d * d, d * d)));
-	if (distance_metric == "Minkovsky")
-		result = pow(pow(fabs(d[0]), e) + pow(fabs(d[1]), e) + pow(fabs(d[2]), e), 1.0 / e);
-	
-	return result;
-}
-
-/* Voronoi / Worley like */
-
-color cellnoise_color(point p)
-{
-	float r = cellnoise(p);
-	float g = cellnoise(point(p[1], p[0], p[2]));
-	float b = cellnoise(point(p[1], p[2], p[0]));
-
-	return color(r, g, b);
-}
-
-void voronoi(point p, string distance_metric, float e, float da[4], point pa[4])
-{
-	/* returns distances in da and point coords in pa */
-	int xx, yy, zz, xi, yi, zi;
-
-	xi = (int)floor(p[0]);
-	yi = (int)floor(p[1]);
-	zi = (int)floor(p[2]);
-
-	da[0] = 1e10;
-	da[1] = 1e10;
-	da[2] = 1e10;
-	da[3] = 1e10;
-
-	for (xx = xi - 1; xx <= xi + 1; xx++) {
-		for (yy = yi - 1; yy <= yi + 1; yy++) {
-			for (zz = zi - 1; zz <= zi + 1; zz++) {
-				point ip = point(xx, yy, zz);
-				point vp = (point)cellnoise_color(ip);
-				point pd = p - (vp + ip);
-				float d = voronoi_distance(distance_metric, pd, e);
-
-				vp += point(xx, yy, zz);
-
-				if (d < da[0]) {
-					da[3] = da[2];
-					da[2] = da[1];
-					da[1] = da[0];
-					da[0] = d;
-
-					pa[3] = pa[2];
-					pa[2] = pa[1];
-					pa[1] = pa[0];
-					pa[0] = vp;
-				}
-				else if (d < da[1]) {
-					da[3] = da[2];
-					da[2] = da[1];
-					da[1] = d;
-
-					pa[3] = pa[2];
-					pa[2] = pa[1];
-					pa[1] = vp;
-				}
-				else if (d < da[2]) {
-					da[3] = da[2];
-					da[2] = d;
-
-					pa[3] = pa[2];
-					pa[2] = vp;
-				}
-				else if (d < da[3]) {
-					da[3] = d;
-					pa[3] = vp;
-				}
-			}
-		}
-	}
-}
-
-float voronoi_Fn(point p, int n)
-{
-	float da[4];
-	point pa[4];
-
-	voronoi(p, "Distance Squared", 0, da, pa);
-
-	return da[n];
-}
-
-float voronoi_FnFn(point p, int n1, int n2)
-{
-	float da[4];
-	point pa[4];
-
-	voronoi(p, "Distance Squared", 0, da, pa);
-
-	return da[n2] - da[n1];
-}
-
-float voronoi_F1(point p) { return voronoi_Fn(p, 0); }
-float voronoi_F2(point p) { return voronoi_Fn(p, 1); }
-float voronoi_F3(point p) { return voronoi_Fn(p, 2); }
-float voronoi_F4(point p) { return voronoi_Fn(p, 3); }
-float voronoi_F1F2(point p) { return voronoi_FnFn(p, 0, 1); }
-
-float voronoi_Cr(point p)
-{
-	/* crackle type pattern, just a scale/clamp of F2-F1 */
-	float t = 10.0 * voronoi_F1F2(p);
-	return (t > 1.0) ? 1.0 : t;
-}
-
-float voronoi_F1S(point p) { return 2.0 * voronoi_F1(p) - 1.0; }
-float voronoi_F2S(point p) { return 2.0 * voronoi_F2(p) - 1.0; }
-float voronoi_F3S(point p) { return 2.0 * voronoi_F3(p) - 1.0; }
-float voronoi_F4S(point p) { return 2.0 * voronoi_F4(p) - 1.0; }
-float voronoi_F1F2S(point p) { return 2.0 * voronoi_F1F2(p) - 1.0; }
-float voronoi_CrS(point p) { return 2.0 * voronoi_Cr(p) - 1.0; }
-
-/* Noise Bases */
-
-float noise_basis(point p, string basis)
-{
-	float result = 0.0;
-
-	if (basis == "Perlin")
-		result = noise(p); /* returns perlin noise in range 0..1 */
-	if (basis == "Voronoi F1")
-		result = voronoi_F1S(p);
-	if (basis == "Voronoi F2")
-		result = voronoi_F2S(p);
-	if (basis == "Voronoi F3")
-		result = voronoi_F3S(p);
-	if (basis == "Voronoi F4")
-		result = voronoi_F4S(p);
-	if (basis == "Voronoi F2-F1")
-		result = voronoi_F1F2S(p);
-	if (basis == "Voronoi Crackle")
-		result = voronoi_CrS(p);
-	if (basis == "Cell Noise")
-		result = cellnoise(p);
-	
-	return result;
-}
-
-/* Soft/Hard Noise */
-
-float noise_basis_hard(point p, string basis, int hard)
-{
-	float t = noise_basis(p, basis);
-	return (hard) ? fabs(2.0 * t - 1.0) : t;
-}
-
-/* Waves */
-
-float noise_wave(string wave, float a)
-{
-	float result = 0.0;
-
-	if (wave == "Sine") {
-		result = 0.5 + 0.5 * sin(a);
-	}
-	else if (wave == "Saw") {
-		float b = 2 * M_PI;
-		int n = (int)(a / b);
-		a -= n * b;
-		if (a < 0) a += b;
-
-		result = a / b;
-	}
-	else if (wave == "Tri") {
-		float b = 2 * M_PI;
-		float rmax = 1.0;
-
-		result = rmax - 2.0 * fabs(floor((a * (1.0 / b)) + 0.5) - (a * (1.0 / b)));
-	}
-
-	return result;
-}
-
-/* Turbulence */
-
-float noise_turbulence(point p, string basis, float details, int hard)
-{
-	float fscale = 1.0;
-	float amp = 1.0;
-	float sum = 0.0;
-	int i, n;
-	
-	float octaves = clamp(details, 0.0, 16.0);
-	n = (int)octaves;
-
-	for (i = 0; i <= n; i++) {
-		float t = noise_basis(fscale * p, basis);
-
-		if (hard)
-			t = fabs(2.0 * t - 1.0);
-
-		sum += t * amp;
-		amp *= 0.5;
-		fscale *= 2.0;
-	}
-	
-	float rmd = octaves - floor(octaves);
-
-	if(rmd != 0.0) {
-		float t = noise_basis(fscale*p, basis);
-
-		if(hard)
-			t = fabs(2.0*t - 1.0);
-
-		float sum2 = sum + t*amp;
-
-		sum *= ((float)(1 << n)/(float)((1 << (n+1)) - 1));
-		sum2 *= ((float)(1 << (n+1))/(float)((1 << (n+2)) - 1));
-
-		return (1.0 - rmd)*sum + rmd*sum2;
-	}
-	else {
-		sum *= ((float)(1 << n)/(float)((1 << (n+1)) - 1));
-		return sum;
-	}
-}
-
-/* Utility */
-
-float nonzero(float f, float eps)
-{
-	float r;
-
-	if (abs(f) < eps)
-		r = sign(f) * eps;
-	else
-		r = f;
-	
-	return r;
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl b/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
deleted file mode 100644
index 2acf72a..0000000
--- a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_texture_coordinate(
-	normal Normal = N,
-	int is_background = 0,
-	string bump_offset = "center",
-
-	output point Generated = point(0.0, 0.0, 0.0),
-	output point UV = point(0.0, 0.0, 0.0),
-	output point Object = point(0.0, 0.0, 0.0),
-	output point Camera = point(0.0, 0.0, 0.0),
-	output point Window = point(0.0, 0.0, 0.0),
-	output point Reflection = point(0.0, 0.0, 0.0))
-{
-	if(is_background) {
-		Generated = P;
-		UV = point(0.0, 0.0, 0.0);
-		Object = P;
-		point Pcam = transform("camera", "world", point(0, 0, 0));
-		Camera = transform("camera", P + Pcam);
-		Window = transform("NDC", P + Pcam);
-		Reflection = I;
-	}
-	else {
-		getattribute("std::generated", Generated); 
-		getattribute("std::uv", UV);
-		Object = transform("object", P);
-		Camera = transform("camera", P);
-		Window = transform("NDC", P);
-		Reflection = reflect(I, Normal);
-	}
-
-	if(bump_offset == "dx") {
-		Generated += Dx(Generated);
-		UV += Dx(UV);
-		Object += Dx(Object);
-		Camera += Dx(Camera);
-		Window += Dx(Window);
-	}
-	else if(bump_offset == "dy") {
-		Generated += Dy(Generated);
-		UV += Dy(UV);
-		Object += Dy(Object);
-		Camera += Dy(Camera);
-		Window += Dy(Window);
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl
deleted file mode 100644
index 9acd467..0000000
--- a/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_translucent_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	BSDF = Color*translucent(Normal);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl
deleted file mode 100644
index b347bfb..0000000
--- a/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_transparent_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	BSDF = Color*transparent();
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_vector_math.osl b/intern/cycles/kernel/osl/nodes/node_vector_math.osl
deleted file mode 100644
index 9e0f0b6..0000000
--- a/intern/cycles/kernel/osl/nodes/node_vector_math.osl
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_vector_math(
-	string type = "Add",
-	vector Vector1 = vector(0.0, 0.0, 0.0),
-	vector Vector2 = vector(0.0, 0.0, 0.0),
-	output float Value = 0.0,
-	output vector Vector = vector(0.0, 0.0, 0.0))
-{
-	if(type == "Add") {
-		Vector = Vector1 + Vector2;
-		Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2]))/3.0;
-	}
-	if(type == "Subtract") {
-		Vector = Vector1 - Vector2;
-		Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2]))/3.0;
-	}
-	if(type == "Average") {
-		Value = length(Vector1 + Vector2);
-		Vector = normalize(Vector1 + Vector2);
-	}
-	if(type == "Dot Product") {
-		Value = dot(Vector1, Vector2);
-	}
-	if(type == "Cross Product") {
-		vector c = cross(Vector1, Vector2);
-		Value = length(c);
-		Vector = normalize(c);
-	}
-	if(type == "Normalize") {
-		Value = length(Vector1);
-		Vector = normalize(Vector1);
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
deleted file mode 100644
index 5e0cae8..0000000
--- a/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_fresnel.h"
-
-shader node_velvet_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	float Sigma = 0.0,
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	float sigma = clamp(Sigma, 0.0, 1.0);
-
-	BSDF = Color*ashikhmin_velvet(Normal, sigma, 1.0);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl b/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl
deleted file mode 100644
index db08b64..0000000
--- a/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Voronoi */
-
-shader node_voronoi_texture(
-	string Coloring = "Intensity",
-	float Scale = 5.0,
-	point Vector = P,
-	output float Fac = 0.0,
-	output color Color = color(0.0, 0.0, 0.0))
-{
-	/* compute distance and point coordinate of 4 nearest neighbours */
-	float da[4];
-	point pa[4];
-
-	voronoi(Vector*Scale, "Distance Squared", 1.0, da, pa);
-
-	/* Colored output */
-	if(Coloring == "Intensity") {
-		Fac = fabs(da[0]);
-		Color = color(Fac);
-	}
-	else {
-		Color = cellnoise_color(pa[0]);
-		Fac = (Color[0]+Color[1]+Color[2])*(1.0/3.0);
-
-	}
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl
deleted file mode 100644
index 68db071..0000000
--- a/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-
-shader node_ward_bsdf(
-	color Color = color(0.8, 0.8, 0.8),
-	float RoughnessU = 0.0,
-	float RoughnessV = 0.0,
-	normal Normal = N,
-	output closure color BSDF = diffuse(Normal))
-{
-	BSDF = Color*ward(Normal, normalize(dPdu), RoughnessU, RoughnessV);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
deleted file mode 100644
index db53faa..0000000
--- a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2012, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Wave */
-
-float wave(point p, float scale, string type, float detail, float distortion, float dscale)
-{
-	float x = p[0] * scale;
-	float y = p[1] * scale;
-	float z = p[2] * scale;
-
-	float result = 0.0;
-	float n = 0.0;
-
-	if(type == "Bands") {
-		n = (x + y + z)*10.0;
-	}
-	else if(type == "Rings") {
-		n = (sqrt(x*x + y*y + z*z)*20.0);
-	}
-	
-	if(distortion != 0.0) {
-		n = n +(distortion * noise_turbulence(p*dscale, "Perlin", detail, 0));
-	}
-	result = noise_wave("Sine", n);
-	
-	return result;
-}
-
-shader node_wave_texture(
-	string Type = "Bands",
-	float Scale = 5.0,
-	float Distortion = 0.0,
-	float Detail = 2.0,
-	float DetailScale = 1.0,
-	point Vector = P,
-	output float Fac = 0.0,
-	output color Color = color (0.0, 0.0, 0.0))
-{
-	Fac = wave(Vector, Scale, Type, Detail, Distortion, DetailScale);
-	Color = color(Fac, Fac, Fac);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/stdosl.h b/intern/cycles/kernel/osl/nodes/stdosl.h
deleted file mode 100644
index e5accf4..0000000
--- a/intern/cycles/kernel/osl/nodes/stdosl.h
+++ /dev/null
@@ -1,537 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.  All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Sony Pictures Imageworks nor the names of its
-//   contributors may be used to endorse or promote products derived from
-//   this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-/////////////////////////////////////////////////////////////////////////////
-
-
-#ifndef CCL_STDOSL_H
-#define CCL_STDOSL_H
-
-
-#ifndef M_PI
-#define M_PI       3.1415926535897932        /* pi */
-#define M_PI_2     1.5707963267948966        /* pi/2 */
-#define M_PI_4     0.7853981633974483        /* pi/4 */
-#define M_2_PI     0.6366197723675813        /* 2/pi */
-#define M_2PI      6.2831853071795865        /* 2*pi */
-#define M_4PI     12.566370614359173         /* 4*pi */
-#define M_2_SQRTPI 1.1283791670955126        /* 2/sqrt(pi) */
-#define M_E        2.7182818284590452        /* e (Euler's number) */
-#define M_LN2      0.6931471805599453        /* ln(2) */
-#define M_LN10     2.3025850929940457        /* ln(10) */
-#define M_LOG2E    1.4426950408889634        /* log_2(e) */
-#define M_LOG10E   0.4342944819032518        /* log_10(e) */
-#define M_SQRT2    1.4142135623730950        /* sqrt(2) */
-#define M_SQRT1_2  0.7071067811865475        /* 1/sqrt(2) */
-#endif
-
-
-
-// Declaration of built-in functions and closures
-#define BUILTIN [[ int builtin = 1 ]]
-#define BUILTIN_DERIV [[ int builtin = 1, int deriv = 1 ]]
-
-#define PERCOMP1(name)                          \
-    normal name (normal x) BUILTIN;             \
-    vector name (vector x) BUILTIN;             \
-    point  name (point x) BUILTIN;              \
-    color  name (color x) BUILTIN;              \
-    float  name (float x) BUILTIN;
-
-#define PERCOMP2(name)                          \
-    normal name (normal x, normal y) BUILTIN;   \
-    vector name (vector x, vector y) BUILTIN;   \
-    point  name (point x, point y) BUILTIN;     \
-    color  name (color x, color y) BUILTIN;     \
-    float  name (float x, float y) BUILTIN;
-
-#define PERCOMP2F(name)                         \
-    normal name (normal x, float y) BUILTIN;    \
-    vector name (vector x, float y) BUILTIN;    \
-    point  name (point x, float y) BUILTIN;     \
-    color  name (color x, float y) BUILTIN;     \
-    float  name (float x, float y) BUILTIN;
-
-
-// Basic math
-normal degrees (normal x) { return x*(180.0/M_PI); }
-vector degrees (vector x) { return x*(180.0/M_PI); }
-point  degrees (point x)  { return x*(180.0/M_PI); }
-color  degrees (color x)  { return x*(180.0/M_PI); }
-float  degrees (float x)  { return x*(180.0/M_PI); }
-normal radians (normal x) { return x*(M_PI/180.0); }
-vector radians (vector x) { return x*(M_PI/180.0); }
-point  radians (point x)  { return x*(M_PI/180.0); }
-color  radians (color x)  { return x*(M_PI/180.0); }
-float  radians (float x)  { return x*(M_PI/180.0); }
-PERCOMP1 (cos)
-PERCOMP1 (sin)
-PERCOMP1 (tan)
-PERCOMP1 (acos)
-PERCOMP1 (asin)
-PERCOMP1 (atan)
-PERCOMP2 (atan2)
-PERCOMP1 (cosh)
-PERCOMP1 (sinh)
-PERCOMP1 (tanh)
-PERCOMP2F (pow)
-PERCOMP1 (exp)
-PERCOMP1 (exp2)
-PERCOMP1 (expm1)
-PERCOMP1 (log)
-point  log (point a,  float b) { return log(a)/log(b); }
-vector log (vector a, float b) { return log(a)/log(b); }
-color  log (color a,  float b) { return log(a)/log(b); }
-float  log (float a,  float b) { return log(a)/log(b); }
-PERCOMP1 (log2)
-PERCOMP1 (log10)
-PERCOMP1 (logb)
-PERCOMP1 (sqrt)
-PERCOMP1 (inversesqrt)
-float hypot (float a, float b) { return sqrt (a*a + b*b); }
-float hypot (float a, float b, float c) { return sqrt (a*a + b*b + c*c); }
-PERCOMP1 (abs)
-int abs (int x) BUILTIN;
-PERCOMP1 (fabs)
-int fabs (int x) BUILTIN;
-PERCOMP1 (sign)
-PERCOMP1 (floor)
-PERCOMP1 (ceil)
-PERCOMP1 (round)
-PERCOMP1 (trunc)
-PERCOMP2 (fmod)
-PERCOMP2F (fmod)
-int    mod (int    a, int    b) { return a - b*(int)floor(a/b); }
-point  mod (point  a, point  b) { return a - b*floor(a/b); }
-vector mod (vector a, vector b) { return a - b*floor(a/b); }
-normal mod (normal a, normal b) { return a - b*floor(a/b); }
-color  mod (color  a, color  b) { return a - b*floor(a/b); }
-point  mod (point  a, float  b) { return a - b*floor(a/b); }
-vector mod (vector a, float  b) { return a - b*floor(a/b); }
-normal mod (normal a, float  b) { return a - b*floor(a/b); }
-color  mod (color  a, float  b) { return a - b*floor(a/b); }
-float  mod (float  a, float  b) { return a - b*floor(a/b); }
-PERCOMP2 (min)
-PERCOMP2 (max)
-normal clamp (normal x, normal minval, normal maxval) { return max(min(x,maxval),minval); }
-vector clamp (vector x, vector minval, vector maxval) { return max(min(x,maxval),minval); }
-point  clamp (point x, point minval, point maxval) { return max(min(x,maxval),minval); }
-color  clamp (color x, color minval, color maxval) { return max(min(x,maxval),minval); }
-float  clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); }
-normal mix (normal x, normal y, normal a) { return x*(1-a) + y*a; }
-normal mix (normal x, normal y, float  a) { return x*(1-a) + y*a; }
-vector mix (vector x, vector y, vector a) { return x*(1-a) + y*a; }
-vector mix (vector x, vector y, float  a) { return x*(1-a) + y*a; }
-point  mix (point  x, point  y, point  a) { return x*(1-a) + y*a; }
-point  mix (point  x, point  y, float  a) { return x*(1-a) + y*a; }
-color  mix (color  x, color  y, color  a) { return x*(1-a) + y*a; }
-color  mix (color  x, color  y, float  a) { return x*(1-a) + y*a; }
-float  mix (float  x, float  y, float  a) { return x*(1-a) + y*a; }
-int isnan (float x) BUILTIN;
-int isinf (float x) BUILTIN;
-int isfinite (float x) BUILTIN;
-float erf (float x) BUILTIN;
-float erfc (float x) BUILTIN;
-
-// Vector functions
-
-vector cross (vector a, vector b) BUILTIN;
-float dot (vector a, vector b) BUILTIN;
-float length (vector v) BUILTIN;
-float distance (point a, point b) BUILTIN;
-float distance (point a, point b, point q) BUILTIN;
-normal normalize (normal v) BUILTIN;
-vector normalize (vector v) BUILTIN;
-vector faceforward (vector N, vector I, vector Nref) BUILTIN;
-vector faceforward (vector N, vector I) BUILTIN;
-vector reflect (vector I, vector N) { return I - 2*dot(N,I)*N; }
-vector refract (vector I, vector N, float eta) {
-    float IdotN = dot (I, N);
-    float k = 1 - eta*eta * (1 - IdotN*IdotN);
-    return (k < 0) ? vector(0,0,0) : (eta*I - N * (eta*IdotN + sqrt(k)));
-}
-void fresnel (vector I, normal N, float eta,
-              output float Kr, output float Kt,
-              output vector R, output vector T)
-{
-    float sqr(float x) { return x*x; }
-    float c = dot(I, N);
-    if (c < 0)
-        c = -c;
-    R = reflect(I, N);
-    float g = 1.0 / sqr(eta) - 1.0 + c * c;
-    if (g >= 0.0) {
-        g = sqrt (g);
-        float beta = g - c;
-        float F = (c * (g+c) - 1.0) / (c * beta + 1.0);
-        F = 0.5 * (1.0 + sqr(F));
-        F *= sqr (beta / (g+c));
-        Kr = F;
-        Kt = (1.0 - Kr) * eta*eta;
-        // OPT: the following recomputes some of the above values, but it 
-        // gives us the same result as if the shader-writer called refract()
-        T = refract(I, N, eta);
-    } else {
-        // total internal reflection
-        Kr = 1.0;
-        Kt = 0.0;
-        T = vector (0,0,0);
-    }
-}
-
-void fresnel (vector I, normal N, float eta,
-              output float Kr, output float Kt)
-{
-    vector R, T;
-    fresnel(I, N, eta, Kr, Kt, R, T);
-}
-
-
-normal transform (matrix Mto, normal p) BUILTIN;
-vector transform (matrix Mto, vector p) BUILTIN;
-point  transform (matrix Mto, point p) BUILTIN;
-normal transform (string from, string to, normal p) BUILTIN;
-vector transform (string from, string to, vector p) BUILTIN;
-point  transform (string from, string to, point p) BUILTIN;
-normal transform (string to, normal p) { return transform("common",to,p); }
-vector transform (string to, vector p) { return transform("common",to,p); }
-point  transform (string to, point p)  { return transform("common",to,p); }
-
-float transformu (string tounits, float x) BUILTIN;
-float transformu (string fromunits, string tounits, float x) BUILTIN;
-
-point rotate (point p, float angle, point a, point b)
-{
-    vector axis = normalize (b - a);
-    float cosang, sinang;
-    sincos (angle, sinang, cosang);
-    float cosang1 = 1.0 - cosang;
-    float x = axis[0], y = axis[1], z = axis[2];
-    matrix M = matrix (x * x + (1.0 - x * x) * cosang,
-                       x * y * cosang1 + z * sinang,
-                       x * z * cosang1 - y * sinang,
-                       0.0,
-                       x * y * cosang1 - z * sinang,
-                       y * y + (1.0 - y * y) * cosang,
-                       y * z * cosang1 + x * sinang,
-                       0.0,
-                       x * z * cosang1 + y * sinang,
-                       y * z * cosang1 - x * sinang,
-                       z * z + (1.0 - z * z) * cosang,
-                       0.0,
-                       0.0, 0.0, 0.0, 1.0);
-    return transform (M, p-a) + a;
-}
-
-
-
-// Color functions
-
-float luminance (color c) BUILTIN;
-color blackbody (float temperatureK) BUILTIN;
-color wavelength_color (float wavelength_nm) BUILTIN;
-
-
-color transformc (string to, color x)
-{
-    color rgb_to_hsv (color rgb) {  // See Foley & van Dam
-        float r = rgb[0], g = rgb[1], b = rgb[2];
-        float mincomp = min (r, min (g, b));
-        float maxcomp = max (r, max (g, b));
-        float delta = maxcomp - mincomp;  // chroma
-        float h, s, v;
-        v = maxcomp;
-        if (maxcomp > 0)
-            s = delta / maxcomp;
-        else s = 0;
-        if (s <= 0)
-            h = 0;
-        else {
-            if      (r >= maxcomp) h = (g-b) / delta;
-            else if (g >= maxcomp) h = 2 + (b-r) / delta;
-            else                   h = 4 + (r-g) / delta;
-            h /= 6;
-            if (h < 0)
-                h += 1;
-        }
-        return color (h, s, v);
-    }
-
-    color rgb_to_hsl (color rgb) {  // See Foley & van Dam
-        // First convert rgb to hsv, then to hsl
-        float minval = min (rgb[0], min (rgb[1], rgb[2]));
-        color hsv = rgb_to_hsv (rgb);
-        float maxval = hsv[2];   // v == maxval
-        float h = hsv[0], s, l = (minval+maxval) / 2;
-        if (minval == maxval)
-            s = 0;  // special 'achromatic' case, hue is 0
-        else if (l <= 0.5)
-            s = (maxval - minval) / (maxval + minval);
-        else
-            s = (maxval - minval) / (2 - maxval - minval);
-        return color (h, s, l);
-    }
-
-    color r;
-    if (to == "rgb" || to == "RGB")
-        r = x;
-    else if (to == "hsv")
-        r = rgb_to_hsv (x);
-    else if (to == "hsl")
-        r = rgb_to_hsl (x);
-    else if (to == "YIQ")
-        r = color (dot (vector(0.299,  0.587,  0.114), (vector)x),
-                   dot (vector(0.596, -0.275, -0.321), (vector)x),
-                   dot (vector(0.212, -0.523,  0.311), (vector)x));
-    else if (to == "xyz")
-        r = color (dot (vector(0.412453, 0.357580, 0.180423), (vector)x),
-                   dot (vector(0.212671, 0.715160, 0.072169), (vector)x),
-                   dot (vector(0.019334, 0.119193, 0.950227), (vector)x));
-    else {
-        error ("Unknown color space \"%s\"", to);
-        r = x;
-    }
-    return r;
-}
-
-
-color transformc (string from, string to, color x)
-{
-    color hsv_to_rgb (color c) { // Reference: Foley & van Dam
-        float h = c[0], s = c[1], v = c[2];
-        color r;
-        if (s < 0.0001) {
-            r = v;
-        } else {
-            h = 6 * (h - floor(h));  // expand to [0..6)
-            int hi = (int)h;
-            float f = h - hi;
-            float p = v * (1-s);
-            float q = v * (1-s*f);
-            float t = v * (1-s*(1-f));
-            if      (hi == 0) r = color (v, t, p);
-            else if (hi == 1) r = color (q, v, p);
-            else if (hi == 2) r = color (p, v, t);
-            else if (hi == 3) r = color (p, q, v);
-            else if (hi == 4) r = color (t, p, v);
-            else              r = color (v, p, q);
-        }
-        return r;
-    }
-
-    color hsl_to_rgb (color c) {
-        float h = c[0], s = c[1], l = c[2];
-        // Easiest to convert hsl -> hsv, then hsv -> RGB (per Foley & van Dam)
-        float v = (l <= 0.5) ? (l * (1 + s)) : (l * (1 - s) + s);
-        color r;
-        if (v <= 0) {
-            r = 0;
-        } else {
-            float min = 2 * l - v;
-            s = (v - min) / v;
-            r = hsv_to_rgb (color (h, s, v));
-        }
-        return r;
-    }
-
-    color r;
-    if (from == "rgb" || from == "RGB")
-        r = x;
-    else if (from == "hsv")
-        r = hsv_to_rgb (x);
-    else if (from == "hsl")
-        r = hsl_to_rgb (x);
-    else if (from == "YIQ")
-        r = color (dot (vector(1,  0.9557,  0.6199), (vector)x),
-                   dot (vector(1, -0.2716, -0.6469), (vector)x),
-                   dot (vector(1, -1.1082,  1.7051), (vector)x));
-    else if (from == "xyz")
-        r = color (dot (vector( 3.240479, -1.537150, -0.498535), (vector)x),
-                   dot (vector(-0.969256,  1.875991,  0.041556), (vector)x),
-                   dot (vector( 0.055648, -0.204043,  1.057311), (vector)x));
-    else {
-        error ("Unknown color space \"%s\"", to);
-        r = x;
-    }
-    return transformc (to, r);
-}
-
- 
-
-// Matrix functions
-
-float determinant (matrix m) BUILTIN;
-matrix transpose (matrix m) BUILTIN;
-
-
-
-// Pattern generation
-
-float step (float edge, float x) BUILTIN;
-color step (color edge, color x) BUILTIN;
-point step (point edge, point x) BUILTIN;
-vector step (vector edge, vector x) BUILTIN;
-normal step (normal edge, normal x) BUILTIN;
-float smoothstep (float edge0, float edge1, float x) BUILTIN;
-
-
-// Derivatives and area operators
-
-
-// Displacement functions
-
-
-// String functions
-
-int strlen (string s) BUILTIN;
-int startswith (string s, string prefix) BUILTIN;
-int endswith (string s, string suffix) BUILTIN;
-string substr (string s, int start, int len) BUILTIN;
-string substr (string s, int start) { return substr (s, start, strlen(s)); }
-
-// Define concat in terms of shorter concat
-string concat (string a, string b, string c) {
-    return concat(concat(a,b), c);
-}
-string concat (string a, string b, string c, string d) {
-    return concat(concat(a,b,c), d);
-}
-string concat (string a, string b, string c, string d, string e) {
-    return concat(concat(a,b,c,d), e);
-}
-string concat (string a, string b, string c, string d, string e, string f) {
-    return concat(concat(a,b,c,d,e), f);
-}
-
-
-// Texture
-
-
-// Closures
-
-closure color diffuse(normal N) BUILTIN;
-closure color oren_nayar(normal N, float sigma) BUILTIN;
-closure color translucent(normal N) BUILTIN;
-closure color reflection(normal N, float eta) BUILTIN;
-closure color reflection(normal N) { return reflection (N, 0.0); }
-closure color refraction(normal N, float eta) BUILTIN;
-closure color dielectric(normal N, float eta) BUILTIN;
-closure color transparent() BUILTIN;
-closure color microfacet_ggx(normal N, float ag, float eta) BUILTIN;
-closure color microfacet_ggx_refraction(normal N, float ag, float eta) BUILTIN;
-closure color microfacet_beckmann(normal N, float ab, float eta) BUILTIN;
-closure color microfacet_beckmann_refraction(normal N, float ab, float eta) BUILTIN;
-closure color ward(normal N, vector T,float ax, float ay) BUILTIN;
-closure color phong(normal N, float exponent) BUILTIN;
-closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN;
-closure color hair_diffuse(vector T) BUILTIN;
-closure color hair_specular(vector T, float offset, float exponent) BUILTIN;
-closure color ashikhmin_velvet(normal N, float sigma, float eta) BUILTIN;
-closure color westin_backscatter(normal N, float roughness) BUILTIN;
-closure color westin_sheen(normal N, float edginess) BUILTIN;
-closure color bssrdf_cubic(color radius) BUILTIN;
-closure color emission(float inner_angle, float outer_angle) BUILTIN;
-closure color emission(float outer_angle) BUILTIN;
-closure color emission() BUILTIN;
-closure color debug(string tag) BUILTIN;
-closure color background() BUILTIN;
-closure color holdout() BUILTIN;
-closure color subsurface(float eta, float g, color mfp, color albedo) BUILTIN;
-
-closure color cloth(normal N, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy,
-                    float area_scaled, vector dPdu, color diff_warp_col, color diff_weft_col,
-                    color spec_warp_col, color spec_weft_col, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v) BUILTIN;
-closure color cloth_specular(normal N, color spec_col[4], float eta[4], int thread_pattern[4],
-                             float pattern_weight[4], int   current_thread, float brdf_interp,
-                             float btf_interp, float uux, float vvx, float area_scaled, vector dPdu,
-                             float eccentricity[4], float angle[4], float Kx[4], float Ky[4],
-                             float Sx[4], float Sy[4]) BUILTIN;
-closure color fakefur_diffuse(normal N, vector T, float fur_reflectivity, float fur_transmission,
-                              float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
-                              float fur_avg_radius, float fur_length, float fur_shadow_fraction) BUILTIN;
-closure color fakefur_specular(normal N, vector T, float offset, float exp, float fur_reflectivity,
-                               float fur_transmission, float shadow_start, float shadow_end,
-                               float fur_attenuation, float fur_density, float fur_avg_radius,
-                               float fur_length, float fur_shadow_fraction) BUILTIN;
-
-closure color fakefur_skin(vector N, vector T, float fur_reflectivity, float fur_transmission,
-                           float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
-                           float fur_avg_radius, float fur_length) BUILTIN;
-
-
-closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft, 
-                    color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v)
-{
-
-    return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
-                 fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle, 
-                 warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v);
-}
-
-closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft, 
-                    color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v, string tok, string val)
-{
-
-    return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
-                 fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle, 
-                 warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v, tok, val);
-}
-
-
-
-// Renderer state
-int raytype (string typename) BUILTIN;
-// the individual 'isFOOray' functions are deprecated
-int iscameraray () { return raytype("camera"); }
-int isdiffuseray () { return raytype("diffuse"); }
-int isglossyray () { return raytype("glossy"); }
-int isshadowray () { return raytype("shadow"); }
-int getmatrix (string fromspace, string tospace, output matrix M) BUILTIN;
-int getmatrix (string fromspace, output matrix M) {
-    return getmatrix (fromspace, "common", M);
-}
-
-
-// Miscellaneous
-
-
-
-
-#undef BUILTIN
-#undef BUILTIN_DERIV
-#undef PERCOMP1
-#undef PERCOMP2
-#undef PERCOMP2F
-
-#endif /* CCL_STDOSL_H */
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index 9e99d4d..f95859d 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -37,10 +37,101 @@
 #include "osl_shader.h"
 
 #include "util_debug.h"
+#include "util_math.h"
 #include "util_param.h"
 
+#include "kernel_types.h"
+#include "kernel_montecarlo.h"
+
+#include "closure/bsdf.h"
+#include "closure/bsdf_ashikhmin_velvet.h"
+#include "closure/bsdf_diffuse.h"
+#include "closure/bsdf_microfacet.h"
+#include "closure/bsdf_oren_nayar.h"
+#include "closure/bsdf_phong_ramp.h"
+#include "closure/bsdf_reflection.h"
+#include "closure/bsdf_refraction.h"
+#include "closure/bsdf_transparent.h"
+#include "closure/bsdf_ward.h"
+#include "closure/bsdf_westin.h"
+
 CCL_NAMESPACE_BEGIN
 
+using namespace OSL;
+
+/* BSDF class definitions */
+
+BSDF_CLOSURE_CLASS_BEGIN(Diffuse, diffuse, diffuse, LABEL_DIFFUSE)
+	CLOSURE_VECTOR_PARAM(DiffuseClosure, N),
+BSDF_CLOSURE_CLASS_END(Diffuse, diffuse)
+
+BSDF_CLOSURE_CLASS_BEGIN(Translucent, translucent, translucent, LABEL_DIFFUSE)
+	CLOSURE_VECTOR_PARAM(TranslucentClosure, N),
+BSDF_CLOSURE_CLASS_END(Translucent, translucent)
+
+BSDF_CLOSURE_CLASS_BEGIN(OrenNayar, oren_nayar, oren_nayar, LABEL_DIFFUSE)
+	CLOSURE_VECTOR_PARAM(OrenNayarClosure, N),
+	CLOSURE_FLOAT_PARAM(OrenNayarClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(OrenNayar, oren_nayar)
+
+BSDF_CLOSURE_CLASS_BEGIN(Reflection, reflection, reflection, LABEL_SINGULAR)
+	CLOSURE_VECTOR_PARAM(ReflectionClosure, N),
+BSDF_CLOSURE_CLASS_END(Reflection, reflection)
+
+BSDF_CLOSURE_CLASS_BEGIN(Refraction, refraction, refraction, LABEL_SINGULAR)
+	CLOSURE_VECTOR_PARAM(RefractionClosure, N),
+	CLOSURE_FLOAT_PARAM(RefractionClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(Refraction, refraction)
+
+BSDF_CLOSURE_CLASS_BEGIN(WestinBackscatter, westin_backscatter, westin_backscatter, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, N),
+	CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(WestinBackscatter, westin_backscatter)
+
+BSDF_CLOSURE_CLASS_BEGIN(WestinSheen, westin_sheen, westin_sheen, LABEL_DIFFUSE)
+	CLOSURE_VECTOR_PARAM(WestinSheenClosure, N),
+	CLOSURE_FLOAT_PARAM(WestinSheenClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(WestinSheen, westin_sheen)
+
+BSDF_CLOSURE_CLASS_BEGIN(Transparent, transparent, transparent, LABEL_SINGULAR)
+BSDF_CLOSURE_CLASS_END(Transparent, transparent)
+
+BSDF_CLOSURE_CLASS_BEGIN(AshikhminVelvet, ashikhmin_velvet, ashikhmin_velvet, LABEL_DIFFUSE)
+	CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, N),
+	CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(AshikhminVelvet, ashikhmin_velvet)
+
+BSDF_CLOSURE_CLASS_BEGIN(Ward, ward, ward, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(WardClosure, N),
+	CLOSURE_VECTOR_PARAM(WardClosure, T),
+	CLOSURE_FLOAT_PARAM(WardClosure, sc.data0),
+	CLOSURE_FLOAT_PARAM(WardClosure, sc.data1),
+BSDF_CLOSURE_CLASS_END(Ward, ward)
+
+BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGX, microfacet_ggx, microfacet_ggx, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure, N),
+	CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(MicrofacetGGX, microfacet_ggx)
+
+BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmann, microfacet_beckmann, microfacet_beckmann, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure, N),
+	CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure, sc.data0),
+BSDF_CLOSURE_CLASS_END(MicrofacetBeckmann, microfacet_beckmann)
+
+BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGXRefraction, microfacet_ggx_refraction, microfacet_ggx, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(MicrofacetGGXRefractionClosure, N),
+	CLOSURE_FLOAT_PARAM(MicrofacetGGXRefractionClosure, sc.data0),
+	CLOSURE_FLOAT_PARAM(MicrofacetGGXRefractionClosure, sc.data1),
+BSDF_CLOSURE_CLASS_END(MicrofacetGGXRefraction, microfacet_ggx_refraction)
+
+BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmannRefraction, microfacet_beckmann_refraction, microfacet_beckmann, LABEL_GLOSSY)
+	CLOSURE_VECTOR_PARAM(MicrofacetBeckmannRefractionClosure, N),
+	CLOSURE_FLOAT_PARAM(MicrofacetBeckmannRefractionClosure, sc.data0),
+	CLOSURE_FLOAT_PARAM(MicrofacetBeckmannRefractionClosure, sc.data1),
+BSDF_CLOSURE_CLASS_END(MicrofacetBeckmannRefraction, microfacet_beckmann_refraction)
+
+/* Registration */
+
 static void generic_closure_setup(OSL::RendererServices *, int id, void *data)
 {
 	assert(data);
@@ -62,30 +153,49 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
 	ss->register_closure(name, id, params, prepare, generic_closure_setup, generic_closure_compare);
 }
 
-void OSLShader::register_closures(OSL::ShadingSystem *ss)
+void OSLShader::register_closures(OSLShadingSystem *ss_)
 {
-	register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params(), bsdf_diffuse_prepare);
-	register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params(), bsdf_oren_nayar_prepare);
-	register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params(), bsdf_translucent_prepare);
-	register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params(), bsdf_reflection_prepare);
-	register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params(), bsdf_refraction_prepare);
-	register_closure(ss, "transparent", OSL_CLOSURE_BSDF_TRANSPARENT_ID, bsdf_transparent_params(), bsdf_transparent_prepare);
-	register_closure(ss, "microfacet_ggx", OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
-	register_closure(ss, "microfacet_ggx_refraction", OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, bsdf_microfacet_ggx_refraction_params(), bsdf_microfacet_ggx_refraction_prepare);
-	register_closure(ss, "microfacet_beckmann", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, bsdf_microfacet_beckmann_params(), bsdf_microfacet_beckmann_prepare);
-	register_closure(ss, "microfacet_beckmann_refraction", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, bsdf_microfacet_beckmann_refraction_params(), bsdf_microfacet_beckmann_refraction_prepare);
-	register_closure(ss, "ward", OSL_CLOSURE_BSDF_WARD_ID, bsdf_ward_params(), bsdf_ward_prepare);
-	register_closure(ss, "phong", OSL_CLOSURE_BSDF_PHONG_ID, bsdf_phong_params(), bsdf_phong_prepare);
-	register_closure(ss, "phong_ramp", OSL_CLOSURE_BSDF_PHONG_RAMP_ID, bsdf_phong_ramp_params(), bsdf_phong_ramp_prepare);
-	register_closure(ss, "ashikhmin_velvet", OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, bsdf_ashikhmin_velvet_params(), bsdf_ashikhmin_velvet_prepare);
-	register_closure(ss, "westin_backscatter", OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, bsdf_westin_backscatter_params(), bsdf_westin_backscatter_prepare);
-	register_closure(ss, "westin_sheen", OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, bsdf_westin_sheen_params(), bsdf_westin_sheen_prepare);
-	register_closure(ss, "bssrdf_cubic", OSL_CLOSURE_BSSRDF_CUBIC_ID, closure_bssrdf_cubic_params(), closure_bssrdf_cubic_prepare);
-	register_closure(ss, "emission", OSL_CLOSURE_EMISSION_ID, closure_emission_params(), closure_emission_prepare);
-	register_closure(ss, "debug", OSL_CLOSURE_DEBUG_ID, closure_debug_params(), closure_debug_prepare);
-	register_closure(ss, "background", OSL_CLOSURE_BACKGROUND_ID, closure_background_params(), closure_background_prepare);
-	register_closure(ss, "holdout", OSL_CLOSURE_HOLDOUT_ID, closure_holdout_params(), closure_holdout_prepare);
-	register_closure(ss, "subsurface", OSL_CLOSURE_SUBSURFACE_ID, closure_subsurface_params(), closure_subsurface_prepare);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)ss_;
+	int id = 0;
+
+	register_closure(ss, "diffuse", id++,
+		bsdf_diffuse_params(), bsdf_diffuse_prepare);
+	register_closure(ss, "oren_nayar", id++,
+		bsdf_oren_nayar_params(), bsdf_oren_nayar_prepare);
+	register_closure(ss, "translucent", id++,
+		bsdf_translucent_params(), bsdf_translucent_prepare);
+	register_closure(ss, "reflection", id++,
+		bsdf_reflection_params(), bsdf_reflection_prepare);
+	register_closure(ss, "refraction", id++,
+		bsdf_refraction_params(), bsdf_refraction_prepare);
+	register_closure(ss, "transparent", id++,
+		bsdf_transparent_params(), bsdf_transparent_prepare);
+	register_closure(ss, "microfacet_ggx", id++,
+		bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
+	register_closure(ss, "microfacet_ggx_refraction", id++,
+		bsdf_microfacet_ggx_refraction_params(), bsdf_microfacet_ggx_refraction_prepare);
+	register_closure(ss, "microfacet_beckmann", id++,
+		bsdf_microfacet_beckmann_params(), bsdf_microfacet_beckmann_prepare);
+	register_closure(ss, "microfacet_beckmann_refraction", id++,
+		bsdf_microfacet_beckmann_refraction_params(), bsdf_microfacet_beckmann_refraction_prepare);
+	register_closure(ss, "ward", id++,
+		bsdf_ward_params(), bsdf_ward_prepare);
+	register_closure(ss, "ashikhmin_velvet", id++,
+		bsdf_ashikhmin_velvet_params(), bsdf_ashikhmin_velvet_prepare);
+	register_closure(ss, "westin_backscatter", id++,
+		bsdf_westin_backscatter_params(), bsdf_westin_backscatter_prepare);
+	register_closure(ss, "westin_sheen", id++,
+		bsdf_westin_sheen_params(), bsdf_westin_sheen_prepare);
+	register_closure(ss, "emission", id++,
+		closure_emission_params(), closure_emission_prepare);
+	register_closure(ss, "background", id++,
+		closure_background_params(), closure_background_prepare);
+	register_closure(ss, "holdout", id++,
+		closure_holdout_params(), closure_holdout_prepare);
+	register_closure(ss, "ambient_occlusion", id++,
+		closure_ambient_occlusion_params(), closure_ambient_occlusion_prepare);
+	register_closure(ss, "phong_ramp", id++,
+		closure_bsdf_phong_ramp_params(), closure_bsdf_phong_ramp_prepare);
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h
index a69af45..2d91b37 100644
--- a/intern/cycles/kernel/osl/osl_closures.h
+++ b/intern/cycles/kernel/osl/osl_closures.h
@@ -37,78 +37,27 @@
 #include <OSL/oslexec.h>
 #include <OSL/genclosure.h>
 
-CCL_NAMESPACE_BEGIN
+#include "kernel_types.h"
 
-enum {
-	OSL_CLOSURE_BSDF_DIFFUSE_ID,
-	OSL_CLOSURE_BSDF_OREN_NAYAR_ID,
-	OSL_CLOSURE_BSDF_TRANSLUCENT_ID,
-	OSL_CLOSURE_BSDF_REFLECTION_ID,
-	OSL_CLOSURE_BSDF_REFRACTION_ID,
-	OSL_CLOSURE_BSDF_TRANSPARENT_ID,
-	OSL_CLOSURE_BSDF_MICROFACET_GGX_ID,
-	OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
-	OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
-	OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
-	OSL_CLOSURE_BSDF_WARD_ID,
-	OSL_CLOSURE_BSDF_PHONG_ID,
-	OSL_CLOSURE_BSDF_PHONG_RAMP_ID,
-	OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
-	OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
-	OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID,
-	OSL_CLOSURE_BSSRDF_CUBIC_ID,
-	OSL_CLOSURE_EMISSION_ID,
-	OSL_CLOSURE_DEBUG_ID,
-	OSL_CLOSURE_BACKGROUND_ID,
-	OSL_CLOSURE_HOLDOUT_ID,
-	OSL_CLOSURE_SUBSURFACE_ID
-};
+#include "util_types.h"
+
+CCL_NAMESPACE_BEGIN
 
-OSL::ClosureParam *bsdf_diffuse_params();
-OSL::ClosureParam *bsdf_oren_nayar_params();
-OSL::ClosureParam *bsdf_translucent_params();
-OSL::ClosureParam *bsdf_reflection_params();
-OSL::ClosureParam *bsdf_refraction_params();
-OSL::ClosureParam *bsdf_transparent_params();
-OSL::ClosureParam *bsdf_microfacet_ggx_params();
-OSL::ClosureParam *bsdf_microfacet_ggx_refraction_params();
-OSL::ClosureParam *bsdf_microfacet_beckmann_params();
-OSL::ClosureParam *bsdf_microfacet_beckmann_refraction_params();
-OSL::ClosureParam *bsdf_ward_params();
-OSL::ClosureParam *bsdf_phong_params();
-OSL::ClosureParam *bsdf_phong_ramp_params();
-OSL::ClosureParam *bsdf_ashikhmin_velvet_params();
-OSL::ClosureParam *bsdf_westin_backscatter_params();
-OSL::ClosureParam *bsdf_westin_sheen_params();
-OSL::ClosureParam *closure_bssrdf_cubic_params();
 OSL::ClosureParam *closure_emission_params();
-OSL::ClosureParam *closure_debug_params();
 OSL::ClosureParam *closure_background_params();
 OSL::ClosureParam *closure_holdout_params();
-OSL::ClosureParam *closure_subsurface_params();
-
-void bsdf_diffuse_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_oren_nayar_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_translucent_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_reflection_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_refraction_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_transparent_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_microfacet_ggx_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_microfacet_ggx_refraction_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_microfacet_beckmann_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_microfacet_beckmann_refraction_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_ward_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_phong_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_phong_ramp_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_ashikhmin_velvet_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_westin_backscatter_prepare(OSL::RendererServices *, int id, void *data);
-void bsdf_westin_sheen_prepare(OSL::RendererServices *, int id, void *data);
-void closure_bssrdf_cubic_prepare(OSL::RendererServices *, int id, void *data);
+OSL::ClosureParam *closure_ambient_occlusion_params();
+OSL::ClosureParam *closure_bsdf_phong_ramp_params();
+
 void closure_emission_prepare(OSL::RendererServices *, int id, void *data);
-void closure_debug_prepare(OSL::RendererServices *, int id, void *data);
 void closure_background_prepare(OSL::RendererServices *, int id, void *data);
 void closure_holdout_prepare(OSL::RendererServices *, int id, void *data);
-void closure_subsurface_prepare(OSL::RendererServices *, int id, void *data);
+void closure_ambient_occlusion_prepare(OSL::RendererServices *, int id, void *data);
+void closure_bsdf_phong_ramp_prepare(OSL::RendererServices *, int id, void *data);
+
+enum {
+	AmbientOcclusion = 100
+};
 
 #define CLOSURE_PREPARE(name, classname)          \
 void name(RendererServices *, int id, void *data) \
@@ -117,6 +66,108 @@ void name(RendererServices *, int id, void *data) \
 	new (data) classname();                       \
 }
 
+#define CLOSURE_PREPARE_STATIC(name, classname) static CLOSURE_PREPARE(name, classname)
+
+#define TO_VEC3(v) (*(OSL::Vec3 *)&(v))
+#define TO_COLOR3(v) (*(OSL::Color3 *)&(v))
+#define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
+
+/* BSDF */
+
+class CBSDFClosure : public OSL::ClosurePrimitive {
+public:
+	ShaderClosure sc;
+	OSL::Vec3 N, T;
+
+	CBSDFClosure(int scattering) : OSL::ClosurePrimitive(BSDF),
+	  m_scattering_label(scattering), m_shaderdata_flag(0) { }
+	~CBSDFClosure() { }
+
+	int scattering() const { return m_scattering_label; }
+	int shaderdata_flag() const { return m_shaderdata_flag; }
+	ClosureType shaderclosure_type() const { return sc.type; }
+
+	virtual void blur(float roughness) = 0;
+	virtual float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
+	virtual float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
+
+	virtual int sample(const float3 &Ng,
+	                   const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
+	                   float randu, float randv,
+	                   float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
+	                   float &pdf, float3 &eval) const = 0;
+
+protected:
+	int m_scattering_label;
+	int m_shaderdata_flag;
+};
+
+#define BSDF_CLOSURE_CLASS_BEGIN(Upper, lower, svmlower, TYPE) \
+\
+class Upper##Closure : public CBSDFClosure { \
+public: \
+	Upper##Closure() : CBSDFClosure(TYPE) {} \
+	size_t memsize() const { return sizeof(*this); } \
+	const char *name() const { return #lower; } \
+\
+	void setup() \
+	{ \
+		sc.N = TO_FLOAT3(N); \
+		sc.T = TO_FLOAT3(T); \
+		m_shaderdata_flag = bsdf_##lower##_setup(&sc); \
+	} \
+\
+	bool mergeable(const ClosurePrimitive *other) const \
+	{ \
+		return false; \
+	} \
+	\
+	void blur(float roughness) \
+	{ \
+		bsdf_##svmlower##_blur(&sc, roughness); \
+	} \
+\
+	void print_on(std::ostream &out) const \
+	{ \
+		out << name() << " ((" << sc.N[0] << ", " << sc.N[1] << ", " << sc.N[2] << "))"; \
+	} \
+\
+	float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const \
+	{ \
+		return bsdf_##svmlower##_eval_reflect(&sc, omega_out, omega_in, &pdf); \
+	} \
+\
+	float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const \
+	{ \
+		return bsdf_##svmlower##_eval_transmit(&sc, omega_out, omega_in, &pdf); \
+	} \
+\
+	int sample(const float3 &Ng, \
+	           const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy, \
+	           float randu, float randv, \
+	           float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy, \
+	           float &pdf, float3 &eval) const \
+	{ \
+		return bsdf_##svmlower##_sample(&sc, Ng, omega_out, domega_out_dx, domega_out_dy, \
+			randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf); \
+	} \
+}; \
+\
+static ClosureParam *bsdf_##lower##_params() \
+{ \
+	static ClosureParam params[] = {
+
+/* parameters */
+
+#define BSDF_CLOSURE_CLASS_END(Upper, lower) \
+		CLOSURE_STRING_KEYPARAM("label"), \
+	    CLOSURE_FINISH_PARAM(Upper##Closure) \
+	}; \
+	return params; \
+} \
+\
+CLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure)
+
 CCL_NAMESPACE_END
 
 #endif /* __OSL_CLOSURES_H__ */
diff --git a/intern/cycles/kernel/osl/osl_globals.h b/intern/cycles/kernel/osl/osl_globals.h
index 8cbbfc8..1a2a210 100644
--- a/intern/cycles/kernel/osl/osl_globals.h
+++ b/intern/cycles/kernel/osl/osl_globals.h
@@ -22,22 +22,35 @@
 #ifdef WITH_OSL
 
 #include <OSL/oslexec.h>
+#include <cmath>
 
 #include "util_map.h"
 #include "util_param.h"
 #include "util_thread.h"
 #include "util_vector.h"
 
+#ifndef WIN32
+using std::isfinite;
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 class OSLRenderServices;
 
 struct OSLGlobals {
-	/* use */
+	OSLGlobals()
+	{
+		ss = NULL;
+		ts = NULL;
+		services = NULL;
+		use = false;
+	}
+
 	bool use;
 
 	/* shading system */
 	OSL::ShadingSystem *ss;
+	OSL::TextureSystem *ts;
 	OSLRenderServices *services;
 
 	/* shader states */
@@ -59,14 +72,13 @@ struct OSLGlobals {
 
 	vector<AttributeMap> attribute_map;
 	ObjectNameMap object_name_map;
+	vector<ustring> object_names;
+};
 
-	/* thread key for thread specific data lookup */
-	struct ThreadData {
-		OSL::ShaderGlobals globals;
-		OSL::PerThreadInfo *thread_info;
-	};
-
-	static tls_ptr(ThreadData, thread_data);
+/* thread key for thread specific data lookup */
+struct OSLThreadData {
+	OSL::ShaderGlobals globals;
+	OSL::PerThreadInfo *thread_info;
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index f1deaa9..b584a54 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -22,6 +22,8 @@
 #include "object.h"
 #include "scene.h"
 
+#include "osl_closures.h"
+#include "osl_globals.h"
 #include "osl_services.h"
 #include "osl_shader.h"
 
@@ -30,8 +32,16 @@
 
 #include "kernel_compat_cpu.h"
 #include "kernel_globals.h"
+#include "kernel_montecarlo.h"
+#include "kernel_projection.h"
+#include "kernel_differential.h"
 #include "kernel_object.h"
+#include "kernel_bvh.h"
+#include "kernel_attribute.h"
+#include "kernel_projection.h"
 #include "kernel_triangle.h"
+#include "kernel_accumulate.h"
+#include "kernel_shader.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -46,6 +56,34 @@ ustring OSLRenderServices::u_camera("camera");
 ustring OSLRenderServices::u_screen("screen");
 ustring OSLRenderServices::u_raster("raster");
 ustring OSLRenderServices::u_ndc("NDC");
+ustring OSLRenderServices::u_object_location("object:location");
+ustring OSLRenderServices::u_object_index("object:index");
+ustring OSLRenderServices::u_geom_dupli_generated("geom:dupli_generated");
+ustring OSLRenderServices::u_geom_dupli_uv("geom:dupli_uv");
+ustring OSLRenderServices::u_material_index("material:index");
+ustring OSLRenderServices::u_object_random("object:random");
+ustring OSLRenderServices::u_particle_index("particle:index");
+ustring OSLRenderServices::u_particle_age("particle:age");
+ustring OSLRenderServices::u_particle_lifetime("particle:lifetime");
+ustring OSLRenderServices::u_particle_location("particle:location");
+ustring OSLRenderServices::u_particle_rotation("particle:rotation");
+ustring OSLRenderServices::u_particle_size("particle:size");
+ustring OSLRenderServices::u_particle_velocity("particle:velocity");
+ustring OSLRenderServices::u_particle_angular_velocity("particle:angular_velocity");
+ustring OSLRenderServices::u_geom_numpolyvertices("geom:numpolyvertices");
+ustring OSLRenderServices::u_geom_trianglevertices("geom:trianglevertices");
+ustring OSLRenderServices::u_geom_polyvertices("geom:polyvertices");
+ustring OSLRenderServices::u_geom_name("geom:name");
+ustring OSLRenderServices::u_path_ray_length("path:ray_length");
+ustring OSLRenderServices::u_trace("trace");
+ustring OSLRenderServices::u_hit("hit");
+ustring OSLRenderServices::u_hitdist("hitdist");
+ustring OSLRenderServices::u_N("N");
+ustring OSLRenderServices::u_Ng("Ng");
+ustring OSLRenderServices::u_P("P");
+ustring OSLRenderServices::u_I("I");
+ustring OSLRenderServices::u_u("u");
+ustring OSLRenderServices::u_v("v");
 ustring OSLRenderServices::u_empty;
 
 OSLRenderServices::OSLRenderServices()
@@ -72,7 +110,16 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr
 		int object = sd->object;
 
 		if (object != ~0) {
-			Transform tfm = object_fetch_transform(kg, object, time, OBJECT_TRANSFORM);
+#ifdef __OBJECT_MOTION__
+			Transform tfm;
+
+			if(time == sd->time)
+				tfm = sd->ob_tfm;
+			else
+				tfm = object_fetch_transform_motion_test(kg, object, time, NULL);
+#else
+			Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
+#endif
 			tfm = transform_transpose(tfm);
 			result = TO_MATRIX44(tfm);
 
@@ -93,9 +140,18 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::Transform
 		int object = sd->object;
 
 		if (object != ~0) {
-			Transform tfm = object_fetch_transform(kg, object, time, OBJECT_INVERSE_TRANSFORM);
-			tfm = transform_transpose(tfm);
-			result = TO_MATRIX44(tfm);
+#ifdef __OBJECT_MOTION__
+			Transform itfm;
+
+			if(time == sd->time)
+				itfm = sd->ob_itfm;
+			else
+				object_fetch_transform_motion_test(kg, object, time, &itfm);
+#else
+			Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
+#endif
+			itfm = transform_transpose(itfm);
+			result = TO_MATRIX44(itfm);
 
 			return true;
 		}
@@ -109,7 +165,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from, float ti
 	KernelGlobals *kg = kernel_globals;
 
 	if (from == u_ndc) {
-		Transform tfm = transform_transpose(kernel_data.cam.ndctoworld);
+		Transform tfm = transform_transpose(transform_quick_inverse(kernel_data.cam.worldtondc));
 		result = TO_MATRIX44(tfm);
 		return true;
 	}
@@ -162,14 +218,108 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to, fl
 
 bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform)
 {
-	// XXX implementation
-	return true;
+	/* this is only used for shader and object space, we don't really have
+	 * a concept of shader space, so we just use object space for both. */
+	if (xform) {
+		const ShaderData *sd = (const ShaderData *)xform;
+		int object = sd->object;
+
+		if (object != ~0) {
+#ifdef __OBJECT_MOTION__
+			Transform tfm = sd->ob_tfm;
+#else
+			KernelGlobals *kg = kernel_globals;
+			Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
+#endif
+			tfm = transform_transpose(tfm);
+			result = TO_MATRIX44(tfm);
+
+			return true;
+		}
+	}
+
+	return false;
+}
+
+bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform)
+{
+	/* this is only used for shader and object space, we don't really have
+	 * a concept of shader space, so we just use object space for both. */
+	if (xform) {
+		const ShaderData *sd = (const ShaderData *)xform;
+		int object = sd->object;
+
+		if (object != ~0) {
+#ifdef __OBJECT_MOTION__
+			Transform tfm = sd->ob_itfm;
+#else
+			KernelGlobals *kg = kernel_globals;
+			Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
+#endif
+			tfm = transform_transpose(tfm);
+			result = TO_MATRIX44(tfm);
+
+			return true;
+		}
+	}
+
+	return false;
 }
 
 bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from)
 {
-	// XXX implementation
-	return true;
+	KernelGlobals *kg = kernel_globals;
+
+	if (from == u_ndc) {
+		Transform tfm = transform_transpose(transform_quick_inverse(kernel_data.cam.worldtondc));
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (from == u_raster) {
+		Transform tfm = transform_transpose(kernel_data.cam.rastertoworld);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (from == u_screen) {
+		Transform tfm = transform_transpose(kernel_data.cam.screentoworld);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (from == u_camera) {
+		Transform tfm = transform_transpose(kernel_data.cam.cameratoworld);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+
+	return false;
+}
+
+bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to)
+{
+	KernelGlobals *kg = kernel_globals;
+	
+	if (to == u_ndc) {
+		Transform tfm = transform_transpose(kernel_data.cam.worldtondc);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (to == u_raster) {
+		Transform tfm = transform_transpose(kernel_data.cam.worldtoraster);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (to == u_screen) {
+		Transform tfm = transform_transpose(kernel_data.cam.worldtoscreen);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	else if (to == u_camera) {
+		Transform tfm = transform_transpose(kernel_data.cam.worldtocamera);
+		result = TO_MATRIX44(tfm);
+		return true;
+	}
+	
+	return false;
 }
 
 bool OSLRenderServices::get_array_attribute(void *renderstate, bool derivatives, 
@@ -179,72 +329,185 @@ bool OSLRenderServices::get_array_attribute(void *renderstate, bool derivatives,
 	return false;
 }
 
-static void set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, void *val)
+static bool set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, void *val)
 {
 	if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
 	    type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
 	{
-		float3 *fval = (float3 *)val;
-		fval[0] = f[0];
+		float *fval = (float *)val;
+
+		fval[0] = f[0].x;
+		fval[1] = f[0].y;
+		fval[2] = f[0].z;
+
 		if (derivatives) {
-			fval[1] = f[1];
-			fval[2] = f[2];
+			fval[3] = f[1].x;
+			fval[4] = f[1].y;
+			fval[5] = f[1].z;
+
+			fval[6] = f[2].x;
+			fval[7] = f[2].y;
+			fval[8] = f[2].z;
 		}
+
+		return true;
 	}
-	else {
+	else if(type == TypeDesc::TypeFloat) {
 		float *fval = (float *)val;
 		fval[0] = average(f[0]);
+
 		if (derivatives) {
 			fval[1] = average(f[1]);
 			fval[2] = average(f[2]);
 		}
+
+		return true;
 	}
+
+	return false;
+}
+
+static bool set_attribute_float3(float3 f, TypeDesc type, bool derivatives, void *val)
+{
+	float3 fv[3];
+
+	fv[0] = f;
+	fv[1] = make_float3(0.0f, 0.0f, 0.0f);
+	fv[2] = make_float3(0.0f, 0.0f, 0.0f);
+
+	return set_attribute_float3(fv, type, derivatives, val);
 }
 
-static void set_attribute_float(float f[3], TypeDesc type, bool derivatives, void *val)
+static bool set_attribute_float(float f[3], TypeDesc type, bool derivatives, void *val)
 {
 	if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
 	    type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
 	{
-		float3 *fval = (float3 *)val;
-		fval[0] = make_float3(f[0], f[0], f[0]);
+		float *fval = (float *)val;
+		fval[0] = f[0];
+		fval[1] = f[1];
+		fval[2] = f[2];
+
 		if (derivatives) {
-			fval[1] = make_float3(f[1], f[2], f[1]);
-			fval[2] = make_float3(f[2], f[2], f[2]);
+			fval[3] = f[1];
+			fval[4] = f[1];
+			fval[5] = f[1];
+
+			fval[6] = f[2];
+			fval[7] = f[2];
+			fval[8] = f[2];
 		}
+
+		return true;
 	}
-	else {
+	else if(type == TypeDesc::TypeFloat) {
 		float *fval = (float *)val;
 		fval[0] = f[0];
+
 		if (derivatives) {
 			fval[1] = f[1];
 			fval[2] = f[2];
 		}
+
+		return true;
 	}
+
+	return false;
 }
 
-static bool get_mesh_attribute(KernelGlobals *kg, const ShaderData *sd, const OSLGlobals::Attribute& attr,
-                               const TypeDesc& type, bool derivatives, void *val)
+static bool set_attribute_float(float f, TypeDesc type, bool derivatives, void *val)
 {
-	if (attr.type == TypeDesc::TypeFloat) {
-		float fval[3];
-		fval[0] = triangle_attribute_float(kg, sd, attr.elem, attr.offset,
-		                                   (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
-		set_attribute_float(fval, type, derivatives, val);
+	float fv[3];
+
+	fv[0] = f;
+	fv[1] = 0.0f;
+	fv[2] = 0.0f;
+
+	return set_attribute_float(fv, type, derivatives, val);
+}
+
+static bool set_attribute_int(int i, TypeDesc type, bool derivatives, void *val)
+{
+	if(type.basetype == TypeDesc::INT && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
+		int *ival = (int *)val;
+		ival[0] = i;
+
+		if (derivatives) {
+			ival[1] = 0;
+			ival[2] = 0;
+		}
+
+		return true;
+	}
+
+	return false;
+}
+
+static bool set_attribute_string(ustring str, TypeDesc type, bool derivatives, void *val)
+{
+	if(type.basetype == TypeDesc::INT && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
+		ustring *sval = (ustring *)val;
+		sval[0] = str;
+
+		if (derivatives) {
+			sval[1] = OSLRenderServices::u_empty;
+			sval[2] = OSLRenderServices::u_empty;
+		}
+
+		return true;
+	}
+
+	return false;
+}
+
+static bool set_attribute_float3_3(float3 P[3], TypeDesc type, bool derivatives, void *val)
+{
+	if(type.vecsemantics == TypeDesc::POINT && type.arraylen >= 3) {
+		float *fval = (float *)val;
+
+		fval[0] = P[0].x;
+		fval[1] = P[0].y;
+		fval[2] = P[0].z;
+
+		fval[3] = P[1].x;
+		fval[4] = P[1].y;
+		fval[5] = P[1].z;
+
+		fval[6] = P[2].x;
+		fval[7] = P[2].y;
+		fval[8] = P[2].z;
+
+		if(type.arraylen > 3)
+			memset(fval + 3*3, 0, sizeof(float)*3*(type.arraylen - 3));
+		if (derivatives)
+			memset(fval + type.arraylen*3, 0, sizeof(float)*2*3*type.arraylen);
+
 		return true;
 	}
-	else if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
-	         attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor)
+
+	return false;
+}
+
+static bool get_mesh_attribute(KernelGlobals *kg, const ShaderData *sd, const OSLGlobals::Attribute& attr,
+                               const TypeDesc& type, bool derivatives, void *val)
+{
+	if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
+	    attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor)
 	{
-		/* todo: this won't work when float3 has w component */
 		float3 fval[3];
 		fval[0] = triangle_attribute_float3(kg, sd, attr.elem, attr.offset,
 		                                    (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
-		set_attribute_float3(fval, type, derivatives, val);
-		return true;
+		return set_attribute_float3(fval, type, derivatives, val);
 	}
-	else
+	else if (attr.type == TypeDesc::TypeFloat) {
+		float fval[3];
+		fval[0] = triangle_attribute_float(kg, sd, attr.elem, attr.offset,
+		                                   (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+		return set_attribute_float(fval, type, derivatives, val);
+	}
+	else {
 		return false;
+	}
 }
 
 static void get_object_attribute(const OSLGlobals::Attribute& attr, bool derivatives, void *val)
@@ -256,105 +519,110 @@ static void get_object_attribute(const OSLGlobals::Attribute& attr, bool derivat
 		memset((char *)val + datasize, 0, datasize * 2);
 }
 
-static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
-                                          TypeDesc type, bool derivatives, void *val)
+bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
+                                                      TypeDesc type, bool derivatives, void *val)
 {
+	/* todo: turn this into hash table? */
+
 	/* Object Attributes */
-	if (name == "std::object_location") {
-		float3 fval[3];
-		fval[0] = object_location(kg, sd);
-		fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0);	/* derivates set to 0 */
-		set_attribute_float3(fval, type, derivatives, val);
-		return true;
+	if (name == u_object_location) {
+		float3 f = object_location(kg, sd);
+		return set_attribute_float3(f, type, derivatives, val);
 	}
-	else if (name == "std::object_index") {
-		float fval[3];
-		fval[0] = object_pass_id(kg, sd->object);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+	else if (name == u_object_index) {
+		float f = object_pass_id(kg, sd->object);
+		return set_attribute_float(f, type, derivatives, val);
 	}
-	else if (name == "std::material_index") {
-		float fval[3];
-		fval[0] = shader_pass_id(kg, sd);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+	else if (name == u_geom_dupli_generated) {
+		float3 f = object_dupli_generated(kg, sd->object);
+		return set_attribute_float3(f, type, derivatives, val);
 	}
-	else if (name == "std::object_random") {
-		float fval[3];
-		fval[0] = object_random_number(kg, sd->object);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+	else if (name == u_geom_dupli_uv) {
+		float3 f = object_dupli_uv(kg, sd->object);
+		return set_attribute_float3(f, type, derivatives, val);
+	}
+	else if (name == u_material_index) {
+		float f = shader_pass_id(kg, sd);
+		return set_attribute_float(f, type, derivatives, val);
+	}
+	else if (name == u_object_random) {
+		float f = object_random_number(kg, sd->object);
+		return set_attribute_float(f, type, derivatives, val);
 	}
 
 	/* Particle Attributes */
-	else if (name == "std::particle_index") {
-		float fval[3];
+	else if (name == u_particle_index) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_index(kg, particle_id);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+		float f = particle_index(kg, particle_id);
+		return set_attribute_float(f, type, derivatives, val);
 	}
-	else if (name == "std::particle_age") {
-		float fval[3];
+	else if (name == u_particle_age) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_age(kg, particle_id);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+		float f = particle_age(kg, particle_id);
+		return set_attribute_float(f, type, derivatives, val);
 	}
-	else if (name == "std::particle_lifetime") {
-		float fval[3];
+	else if (name == u_particle_lifetime) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_lifetime(kg, particle_id);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+		float f= particle_lifetime(kg, particle_id);
+		return set_attribute_float(f, type, derivatives, val);
 	}
-	else if (name == "std::particle_location") {
-		float3 fval[3];
+	else if (name == u_particle_location) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_location(kg, particle_id);
-		fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0);	/* derivates set to 0 */
-		set_attribute_float3(fval, type, derivatives, val);
-		return true;
+		float3 f = particle_location(kg, particle_id);
+		return set_attribute_float3(f, type, derivatives, val);
 	}
 #if 0	/* unsupported */
-	else if (name == "std::particle_rotation") {
-		float4 fval[3];
+	else if (name == u_particle_rotation) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_rotation(kg, particle_id);
-		fval[1] = fval[2] = make_float4(0.0, 0.0, 0.0, 0.0);	/* derivates set to 0 */
-		set_attribute_float4(fval, type, derivatives, val);
-		return true;
+		float4 f = particle_rotation(kg, particle_id);
+		return set_attribute_float4(f, type, derivatives, val);
 	}
 #endif
-	else if (name == "std::particle_size") {
-		float fval[3];
+	else if (name == u_particle_size) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_size(kg, particle_id);
-		fval[1] = fval[2] = 0.0;	/* derivates set to 0 */
-		set_attribute_float(fval, type, derivatives, val);
-		return true;
+		float f = particle_size(kg, particle_id);
+		return set_attribute_float(f, type, derivatives, val);
 	}
-	else if (name == "std::particle_velocity") {
-		float3 fval[3];
+	else if (name == u_particle_velocity) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_velocity(kg, particle_id);
-		fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0);	/* derivates set to 0 */
-		set_attribute_float3(fval, type, derivatives, val);
-		return true;
+		float3 f = particle_velocity(kg, particle_id);
+		return set_attribute_float3(f, type, derivatives, val);
 	}
-	else if (name == "std::particle_angular_velocity") {
-		float3 fval[3];
+	else if (name == u_particle_angular_velocity) {
 		uint particle_id = object_particle_id(kg, sd->object);
-		fval[0] = particle_angular_velocity(kg, particle_id);
-		fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0);	/* derivates set to 0 */
-		set_attribute_float3(fval, type, derivatives, val);
-		return true;
+		float3 f = particle_angular_velocity(kg, particle_id);
+		return set_attribute_float3(f, type, derivatives, val);
+	}
+	else if (name == u_geom_numpolyvertices) {
+		return set_attribute_int(3, type, derivatives, val);
+	}
+	else if (name == u_geom_trianglevertices || name == u_geom_polyvertices) {
+		float3 P[3];
+		triangle_vertices(kg, sd->prim, P);
+
+		if(!(sd->flag & SD_TRANSFORM_APPLIED)) {
+			object_position_transform(kg, sd, &P[0]);
+			object_position_transform(kg, sd, &P[1]);
+			object_position_transform(kg, sd, &P[2]);
+		}
+
+		return set_attribute_float3_3(P, type, derivatives, val);
+	}
+	else if(name == u_geom_name) {
+		ustring object_name = kg->osl->object_names[sd->object];
+		return set_attribute_string(object_name, type, derivatives, val);
+	}
+	else
+		return false;
+}
+
+bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
+                                                 TypeDesc type, bool derivatives, void *val)
+{
+	/* Ray Length */
+	if (name == u_path_ray_length) {
+		float f = sd->ray_length;
+		return set_attribute_float(f, type, derivatives, val);
 	}
 	
 	else
@@ -371,26 +639,25 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri
 
 	/* lookup of attribute on another object */
 	if (object_name != u_empty) {
-		OSLGlobals::ObjectNameMap::iterator it = kg->osl.object_name_map.find(object_name);
+		OSLGlobals::ObjectNameMap::iterator it = kg->osl->object_name_map.find(object_name);
 
-		if (it == kg->osl.object_name_map.end())
+		if (it == kg->osl->object_name_map.end())
 			return false;
 
 		object = it->second;
 		tri = ~0;
 	}
 	else if (object == ~0) {
-		/* no background attributes supported */
-		return false;
+		return get_background_attribute(kg, sd, name, type, derivatives, val);
 	}
 
 	/* find attribute on object */
-	OSLGlobals::AttributeMap& attribute_map = kg->osl.attribute_map[object];
+	OSLGlobals::AttributeMap& attribute_map = kg->osl->attribute_map[object];
 	OSLGlobals::AttributeMap::iterator it = attribute_map.find(name);
 
 	if (it != attribute_map.end()) {
 		const OSLGlobals::Attribute& attr = it->second;
-		
+
 		if (attr.elem != ATTR_ELEMENT_VALUE) {
 			/* triangle and vertex attributes */
 			if (tri != ~0)
@@ -404,7 +671,12 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri
 	}
 	else {
 		/* not found in attribute, check standard object info */
-		return get_object_standard_attribute(kg, sd, name, type, derivatives, val);
+		bool is_std_object_attribute = get_object_standard_attribute(kg, sd, name, type, derivatives, val);
+
+		if (is_std_object_attribute)
+			return true;
+
+		return get_background_attribute(kg, sd, name, type, derivatives, val);
 	}
 
 	return false;
@@ -421,6 +693,80 @@ bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, void *renderst
 	return false; /* never called by OSL */
 }
 
+bool OSLRenderServices::texture(ustring filename, TextureOpt &options,
+                                OSL::ShaderGlobals *sg,
+                                float s, float t, float dsdx, float dtdx,
+                                float dsdy, float dtdy, float *result)
+{
+	OSL::TextureSystem *ts = kernel_globals->osl->ts;
+	bool status = ts->texture(filename, options, s, t, dsdx, dtdx, dsdy, dtdy, result);
+
+	if(!status) {
+		if(options.nchannels == 3 || options.nchannels == 4) {
+			result[0] = 1.0f;
+			result[1] = 0.0f;
+			result[2] = 1.0f;
+
+			if(options.nchannels == 4)
+				result[3] = 1.0f;
+		}
+	}
+
+	return status;
+}
+
+bool OSLRenderServices::texture3d(ustring filename, TextureOpt &options,
+                                  OSL::ShaderGlobals *sg, const OSL::Vec3 &P,
+                                  const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
+                                  const OSL::Vec3 &dPdz, float *result)
+{
+	OSL::TextureSystem *ts = kernel_globals->osl->ts;
+	bool status = ts->texture3d(filename, options, P, dPdx, dPdy, dPdz, result);
+
+	if(!status) {
+		if(options.nchannels == 3 || options.nchannels == 4) {
+			result[0] = 1.0f;
+			result[1] = 0.0f;
+			result[2] = 1.0f;
+
+			if(options.nchannels == 4)
+				result[3] = 1.0f;
+		}
+
+	}
+
+	return status;
+}
+
+bool OSLRenderServices::environment(ustring filename, TextureOpt &options,
+                                    OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+                                    const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result)
+{
+	OSL::TextureSystem *ts = kernel_globals->osl->ts;
+	bool status = ts->environment(filename, options, R, dRdx, dRdy, result);
+
+	if(!status) {
+		if(options.nchannels == 3 || options.nchannels == 4) {
+			result[0] = 1.0f;
+			result[1] = 0.0f;
+			result[2] = 1.0f;
+
+			if(options.nchannels == 4)
+				result[3] = 1.0f;
+		}
+	}
+
+	return status;
+}
+
+bool OSLRenderServices::get_texture_info(ustring filename, int subimage,
+                                         ustring dataname,
+                                         TypeDesc datatype, void *data)
+{
+	OSL::TextureSystem *ts = kernel_globals->osl->ts;
+	return ts->get_texture_info(filename, subimage, dataname, datatype, data);
+}
+
 int OSLRenderServices::pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 &center,
                                          float radius, int max_points, bool sort,
                                          size_t *out_indices, float *out_distances, int derivs_offset)
@@ -434,4 +780,107 @@ int OSLRenderServices::pointcloud_get(ustring filename, size_t *indices, int cou
 	return 0;
 }
 
+bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg,
+	const OSL::Vec3 &P, const OSL::Vec3 &dPdx,
+	const OSL::Vec3 &dPdy, const OSL::Vec3 &R,
+	const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy)
+{
+	/* todo: options.shader support, maybe options.traceset */
+	ShaderData *sd = (ShaderData *)(sg->renderstate);
+
+	/* setup ray */
+	Ray ray;
+
+	ray.P = TO_FLOAT3(P);
+	ray.D = TO_FLOAT3(R);
+	ray.t = (options.maxdist == 1.0e30)? FLT_MAX: options.maxdist - options.mindist;
+	ray.time = sd->time;
+
+	if(options.mindist == 0.0f) {
+		/* avoid self-intersections */
+		if(ray.P == sd->P) {
+			bool transmit = (dot(sd->Ng, ray.D) < 0.0f);
+			ray.P = ray_offset(sd->P, (transmit)? -sd->Ng: sd->Ng);
+		}
+	}
+	else {
+		/* offset for minimum distance */
+		ray.P += options.mindist*ray.D;
+	}
+
+	/* ray differentials */
+	ray.dP.dx = TO_FLOAT3(dPdx);
+	ray.dP.dy = TO_FLOAT3(dPdy);
+	ray.dD.dx = TO_FLOAT3(dRdx);
+	ray.dD.dy = TO_FLOAT3(dRdy);
+
+	/* allocate trace data */
+	TraceData *tracedata = new TraceData();
+	tracedata->ray = ray;
+	tracedata->setup = false;
+
+	if(sg->tracedata)
+		delete (TraceData*)sg->tracedata;
+	sg->tracedata = tracedata;
+
+	/* raytrace */
+	return scene_intersect(kernel_globals, &ray, ~0, &tracedata->isect);
+}
+
+
+bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
+	TypeDesc type, void *val, bool derivatives)
+{
+	TraceData *tracedata = (TraceData*)sg->tracedata;
+
+	if(source == u_trace && tracedata) {
+		if(name == u_hit) {
+			return set_attribute_int((tracedata->isect.prim != ~0), type, derivatives, val);
+		}
+		else if(tracedata->isect.prim != ~0) {
+			if(name == u_hitdist) {
+				float f[3] = {tracedata->isect.t, 0.0f, 0.0f};
+				return set_attribute_float(f, type, derivatives, val);
+			}
+			else {
+				KernelGlobals *kg = kernel_globals;
+				ShaderData *sd = &tracedata->sd;
+
+				if(!tracedata->setup) {
+					/* lazy shader data setup */
+					shader_setup_from_ray(kg, sd, &tracedata->isect, &tracedata->ray);
+					tracedata->setup = true;
+				}
+
+				if(name == u_N) {
+					return set_attribute_float3(sd->N, type, derivatives, val);
+				}
+				else if(name == u_Ng) {
+					return set_attribute_float3(sd->Ng, type, derivatives, val);
+				}
+				else if(name == u_P) {
+					float3 f[3] = {sd->P, sd->dP.dx, sd->dP.dy};
+					return set_attribute_float3(f, type, derivatives, val);
+				}
+				else if(name == u_I) {
+					float3 f[3] = {sd->I, sd->dI.dx, sd->dI.dy};
+					return set_attribute_float3(f, type, derivatives, val);
+				}
+				else if(name == u_u) {
+					float f[3] = {sd->u, sd->du.dx, sd->du.dy};
+					return set_attribute_float(f, type, derivatives, val);
+				}
+				else if(name == u_v) {
+					float f[3] = {sd->v, sd->dv.dx, sd->dv.dy};
+					return set_attribute_float(f, type, derivatives, val);
+				}
+
+				return get_attribute(sd, derivatives, u_empty, type, name, val);
+			}
+		}
+	}
+
+	return false;
+}
+
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index 790b02a..e687700 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -54,7 +54,10 @@ public:
 	bool get_inverse_matrix(OSL::Matrix44 &result, ustring to, float time);
 	
 	bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform);
+	bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform);
+	
 	bool get_matrix(OSL::Matrix44 &result, ustring from);
+	bool get_inverse_matrix(OSL::Matrix44 &result, ustring from);
 
 	bool get_array_attribute(void *renderstate, bool derivatives,
 	                         ustring object, TypeDesc type, ustring name,
@@ -73,8 +76,42 @@ public:
 	int pointcloud_get(ustring filename, size_t *indices, int count, ustring attr_name,
 	                   TypeDesc attr_type, void *out_data);
 
-private:
-	KernelGlobals *kernel_globals;
+	bool trace(TraceOpt &options, OSL::ShaderGlobals *sg,
+	           const OSL::Vec3 &P, const OSL::Vec3 &dPdx,
+	           const OSL::Vec3 &dPdy, const OSL::Vec3 &R,
+	           const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy);
+
+	bool getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
+	                TypeDesc type, void *val, bool derivatives);
+
+	bool texture(ustring filename, TextureOpt &options,
+	             OSL::ShaderGlobals *sg,
+	             float s, float t, float dsdx, float dtdx,
+	             float dsdy, float dtdy, float *result);
+
+	bool texture3d(ustring filename, TextureOpt &options,
+	               OSL::ShaderGlobals *sg, const OSL::Vec3 &P,
+	               const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
+	               const OSL::Vec3 &dPdz, float *result);
+
+	bool environment(ustring filename, TextureOpt &options,
+	                 OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+	                 const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result);
+
+	bool get_texture_info(ustring filename, int subimage,
+	                      ustring dataname, TypeDesc datatype, void *data);
+
+	static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
+			TypeDesc type, bool derivatives, void *val);
+	static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
+			TypeDesc type, bool derivatives, void *val);
+
+	struct TraceData {
+		Ray ray;
+		Intersection isect;
+		ShaderData sd;
+		bool setup;
+	};
 
 	static ustring u_distance;
 	static ustring u_index;
@@ -82,7 +119,38 @@ private:
 	static ustring u_screen;
 	static ustring u_raster;
 	static ustring u_ndc;
+	static ustring u_object_location;
+	static ustring u_object_index;
+	static ustring u_geom_dupli_generated;
+	static ustring u_geom_dupli_uv;
+	static ustring u_material_index;
+	static ustring u_object_random;
+	static ustring u_particle_index;
+	static ustring u_particle_age;
+	static ustring u_particle_lifetime;
+	static ustring u_particle_location;
+	static ustring u_particle_rotation;
+	static ustring u_particle_size;
+	static ustring u_particle_velocity;
+	static ustring u_particle_angular_velocity;
+	static ustring u_geom_numpolyvertices;
+	static ustring u_geom_trianglevertices;
+	static ustring u_geom_polyvertices;
+	static ustring u_geom_name;
+	static ustring u_path_ray_length;
+	static ustring u_trace;
+	static ustring u_hit;
+	static ustring u_hitdist;
+	static ustring u_N;
+	static ustring u_Ng;
+	static ustring u_P;
+	static ustring u_I;
+	static ustring u_u;
+	static ustring u_v;
 	static ustring u_empty;
+
+private:
+	KernelGlobals *kernel_globals;
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp
index ea508dc..32712b2 100644
--- a/intern/cycles/kernel/osl/osl_shader.cpp
+++ b/intern/cycles/kernel/osl/osl_shader.cpp
@@ -21,50 +21,61 @@
 #include "kernel_globals.h"
 #include "kernel_object.h"
 
+#include "osl_closures.h"
+#include "osl_globals.h"
 #include "osl_services.h"
 #include "osl_shader.h"
 
+#include "util_attribute.h"
 #include "util_foreach.h"
 
 #include <OSL/oslexec.h>
 
 CCL_NAMESPACE_BEGIN
 
-tls_ptr(OSLGlobals::ThreadData, OSLGlobals::thread_data);
-
 /* Threads */
 
-void OSLShader::thread_init(KernelGlobals *kg)
+void OSLShader::thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OSLGlobals *osl_globals)
 {
-	OSL::ShadingSystem *ss = kg->osl.ss;
+	/* no osl used? */
+	if(!osl_globals->use) {
+		kg->osl = NULL;
+		return;
+	}
+
+	/* per thread kernel data init*/
+	kg->osl = osl_globals;
+	kg->osl->services->thread_init(kernel_globals);
 
-	OSLGlobals::ThreadData *tdata = new OSLGlobals::ThreadData();
+	OSL::ShadingSystem *ss = kg->osl->ss;
+	OSLThreadData *tdata = new OSLThreadData();
 
 	memset(&tdata->globals, 0, sizeof(OSL::ShaderGlobals));
 	tdata->thread_info = ss->create_thread_info();
 
-	tls_set(kg->osl.thread_data, tdata);
-
-	kg->osl.services->thread_init(kg);
+	kg->osl_ss = (OSLShadingSystem*)ss;
+	kg->osl_tdata = tdata;
 }
 
 void OSLShader::thread_free(KernelGlobals *kg)
 {
-	OSL::ShadingSystem *ss = kg->osl.ss;
+	if(!kg->osl)
+		return;
 
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 
 	ss->destroy_thread_info(tdata->thread_info);
 
 	delete tdata;
+
+	kg->osl = NULL;
+	kg->osl_ss = NULL;
+	kg->osl_tdata = NULL;
 }
 
 /* Globals */
 
-#define TO_VEC3(v) (*(OSL::Vec3 *)&(v))
-#define TO_COLOR3(v) (*(OSL::Color3 *)&(v))
-#define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
-
 static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
                                         int path_flag, OSL::ShaderGlobals *globals)
 {
@@ -86,6 +97,7 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
 	globals->dPdu = TO_VEC3(sd->dPdu);
 	globals->dPdv = TO_VEC3(sd->dPdv);
 	globals->surfacearea = (sd->object == ~0) ? 1.0f : object_surface_area(kg, sd->object);
+	globals->time = sd->time;
 
 	/* booleans */
 	globals->raytype = path_flag; /* todo: add our own ray types */
@@ -96,6 +108,7 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
 	
 	/* shader data to be used in services callbacks */
 	globals->renderstate = sd; 
+	globals->tracedata = NULL;
 
 	/* hacky, we leave it to services to fetch actual object matrix */
 	globals->shader2common = sd;
@@ -127,42 +140,25 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
 					if (sd->num_closure == MAX_CLOSURE)
 						return;
 
-					OSL::BSDFClosure *bsdf = (OSL::BSDFClosure *)prim;
-					ustring scattering = bsdf->scattering();
+					CBSDFClosure *bsdf = (CBSDFClosure *)prim;
+					int scattering = bsdf->scattering();
 
 					/* no caustics option */
-					if (no_glossy && scattering == OSL::Labels::GLOSSY)
+					if (no_glossy && scattering == LABEL_GLOSSY)
 						return;
 
 					/* sample weight */
-					float albedo = bsdf->albedo(TO_VEC3(sd->I));
-					float sample_weight = fabsf(average(weight)) * albedo;
+					float sample_weight = fabsf(average(weight));
 
 					sc.sample_weight = sample_weight;
-
-					/* scattering flags */
-					if (scattering == OSL::Labels::DIFFUSE) {
-						sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL;
-						sc.type = CLOSURE_BSDF_DIFFUSE_ID;
-					}
-					else if (scattering == OSL::Labels::GLOSSY) {
-						sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_GLOSSY;
-						sc.type = CLOSURE_BSDF_GLOSSY_ID;
-					}
-					else if (scattering == OSL::Labels::STRAIGHT) {
-						sd->flag |= SD_BSDF;
-						sc.type = CLOSURE_BSDF_TRANSPARENT_ID;
-					}
-					else {
-						/* todo: we don't actually have a way to determine if
-						 * this closure will reflect/transmit. could add our own
-						 * own scattering flag that do give this info */
-						sd->flag |= SD_BSDF;
-						sc.type = CLOSURE_BSDF_GLOSSY_ID;
-					}
+					sc.type = bsdf->shaderclosure_type();
+					sc.N = bsdf->sc.N; /* needed for AO */
 
 					/* add */
-					sd->closure[sd->num_closure++] = sc;
+					if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) {
+						sd->closure[sd->num_closure++] = sc;
+						sd->flag |= bsdf->shaderdata_flag();
+					}
 					break;
 				}
 				case OSL::ClosurePrimitive::Emissive: {
@@ -176,9 +172,26 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
 					sc.type = CLOSURE_EMISSION_ID;
 
 					/* flag */
-					sd->flag |= SD_EMISSION;
+					if(sd->num_closure < MAX_CLOSURE) {
+						sd->closure[sd->num_closure++] = sc;
+						sd->flag |= SD_EMISSION;
+					}
+					break;
+				}
+				case AmbientOcclusion: {
+					if (sd->num_closure == MAX_CLOSURE)
+						return;
+
+					/* sample weight */
+					float sample_weight = fabsf(average(weight));
+
+					sc.sample_weight = sample_weight;
+					sc.type = CLOSURE_AMBIENT_OCCLUSION_ID;
 
-					sd->closure[sd->num_closure++] = sc;
+					if(sd->num_closure < MAX_CLOSURE) {
+						sd->closure[sd->num_closure++] = sc;
+						sd->flag |= SD_AO;
+					}
 					break;
 				}
 				case OSL::ClosurePrimitive::Holdout:
@@ -187,8 +200,11 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
 
 					sc.sample_weight = 0.0f;
 					sc.type = CLOSURE_HOLDOUT_ID;
-					sd->flag |= SD_HOLDOUT;
-					sd->closure[sd->num_closure++] = sc;
+
+					if(sd->num_closure < MAX_CLOSURE) {
+						sd->closure[sd->num_closure++] = sc;
+						sd->flag |= SD_HOLDOUT;
+					}
 					break;
 				case OSL::ClosurePrimitive::BSSRDF:
 				case OSL::ClosurePrimitive::Debug:
@@ -213,8 +229,8 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
 void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag)
 {
 	/* gather pointers */
-	OSL::ShadingSystem *ss = kg->osl.ss;
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 	OSL::ShaderGlobals *globals = &tdata->globals;
 	OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
@@ -224,8 +240,12 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int
 	/* execute shader for this point */
 	int shader = sd->shader & SHADER_MASK;
 
-	if (kg->osl.surface_state[shader])
-		ss->execute(*ctx, *(kg->osl.surface_state[shader]), *globals);
+	if (kg->osl->surface_state[shader])
+		ss->execute(*ctx, *(kg->osl->surface_state[shader]), *globals);
+
+	/* free trace data */
+	if(globals->tracedata)
+		delete (OSLRenderServices::TraceData*)globals->tracedata;
 
 	/* flatten closure tree */
 	sd->num_closure = 0;
@@ -270,8 +290,8 @@ static float3 flatten_background_closure_tree(const OSL::ClosureColor *closure)
 float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag)
 {
 	/* gather pointers */
-	OSL::ShadingSystem *ss = kg->osl.ss;
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 	OSL::ShaderGlobals *globals = &tdata->globals;
 	OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
@@ -279,8 +299,12 @@ float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_fl
 	shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
 
 	/* execute shader for this point */
-	if (kg->osl.background_state)
-		ss->execute(*ctx, *(kg->osl.background_state), *globals);
+	if (kg->osl->background_state)
+		ss->execute(*ctx, *(kg->osl->background_state), *globals);
+
+	/* free trace data */
+	if(globals->tracedata)
+		delete (OSLRenderServices::TraceData*)globals->tracedata;
 
 	/* return background color immediately */
 	if (globals->Ci)
@@ -318,7 +342,8 @@ static void flatten_volume_closure_tree(ShaderData *sd,
 					sc.type = CLOSURE_VOLUME_ID;
 
 					/* add */
-					sd->closure[sd->num_closure++] = sc;
+					if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE)
+						sd->closure[sd->num_closure++] = sc;
 					break;
 				}
 				case OSL::ClosurePrimitive::Holdout:
@@ -346,8 +371,8 @@ static void flatten_volume_closure_tree(ShaderData *sd,
 void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag)
 {
 	/* gather pointers */
-	OSL::ShadingSystem *ss = kg->osl.ss;
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 	OSL::ShaderGlobals *globals = &tdata->globals;
 	OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
@@ -357,8 +382,12 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int
 	/* execute shader */
 	int shader = sd->shader & SHADER_MASK;
 
-	if (kg->osl.volume_state[shader])
-		ss->execute(*ctx, *(kg->osl.volume_state[shader]), *globals);
+	if (kg->osl->volume_state[shader])
+		ss->execute(*ctx, *(kg->osl->volume_state[shader]), *globals);
+
+	/* free trace data */
+	if(globals->tracedata)
+		delete (OSLRenderServices::TraceData*)globals->tracedata;
 
 	if (globals->Ci)
 		flatten_volume_closure_tree(sd, globals->Ci);
@@ -369,8 +398,8 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int
 void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
 {
 	/* gather pointers */
-	OSL::ShadingSystem *ss = kg->osl.ss;
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 	OSL::ShaderGlobals *globals = &tdata->globals;
 	OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
@@ -380,8 +409,12 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
 	/* execute shader */
 	int shader = sd->shader & SHADER_MASK;
 
-	if (kg->osl.displacement_state[shader])
-		ss->execute(*ctx, *(kg->osl.displacement_state[shader]), *globals);
+	if (kg->osl->displacement_state[shader])
+		ss->execute(*ctx, *(kg->osl->displacement_state[shader]), *globals);
+
+	/* free trace data */
+	if(globals->tracedata)
+		delete (OSLRenderServices::TraceData*)globals->tracedata;
 
 	/* get back position */
 	sd->P = TO_FLOAT3(globals->P);
@@ -389,15 +422,15 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
 
 void OSLShader::init(KernelGlobals *kg, ShaderData *sd)
 {
-	OSL::ShadingSystem *ss = kg->osl.ss;
-	OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
+	OSLThreadData *tdata = kg->osl_tdata;
 	
 	sd->osl_ctx = ss->get_context(tdata->thread_info);
 }
 
 void OSLShader::release(KernelGlobals *kg, ShaderData *sd)
 {
-	OSL::ShadingSystem *ss = kg->osl.ss;
+	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
 	
 	ss->release_context((OSL::ShadingContext *)sd->osl_ctx);
 }
@@ -406,54 +439,34 @@ void OSLShader::release(KernelGlobals *kg, ShaderData *sd)
 
 int OSLShader::bsdf_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3& eval, float3& omega_in, differential3& domega_in, float& pdf)
 {
-	OSL::BSDFClosure *sample_bsdf = (OSL::BSDFClosure *)sc->prim;
-	int label = LABEL_NONE;
+	CBSDFClosure *sample_bsdf = (CBSDFClosure *)sc->prim;
 
 	pdf = 0.0f;
 
-	/* sample BSDF closure */
-	ustring ulabel;
-
-	ulabel = sample_bsdf->sample(TO_VEC3(sd->Ng),
-	                             TO_VEC3(sd->I), TO_VEC3(sd->dI.dx), TO_VEC3(sd->dI.dy),
-	                             randu, randv,
-	                             TO_VEC3(omega_in), TO_VEC3(domega_in.dx), TO_VEC3(domega_in.dy),
-	                             pdf, TO_COLOR3(eval));
-
-	/* convert OSL label */
-	if (ulabel == OSL::Labels::REFLECT)
-		label = LABEL_REFLECT;
-	else if (ulabel == OSL::Labels::TRANSMIT)
-		label = LABEL_TRANSMIT;
-	else
-		return LABEL_NONE;  /* sampling failed */
-
-	/* convert scattering to our bitflag label */
-	ustring uscattering = sample_bsdf->scattering();
-
-	if (uscattering == OSL::Labels::DIFFUSE)
-		label |= LABEL_DIFFUSE;
-	else if (uscattering == OSL::Labels::GLOSSY)
-		label |= LABEL_GLOSSY;
-	else if (uscattering == OSL::Labels::SINGULAR)
-		label |= LABEL_SINGULAR;
-	else
-		label |= LABEL_TRANSPARENT;
-
-	return label;
+	return sample_bsdf->sample(sd->Ng,
+	                           sd->I, sd->dI.dx, sd->dI.dy,
+	                           randu, randv,
+	                           omega_in, domega_in.dx, domega_in.dy,
+	                           pdf, eval);
 }
 
 float3 OSLShader::bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, const float3& omega_in, float& pdf)
 {
-	OSL::BSDFClosure *bsdf = (OSL::BSDFClosure *)sc->prim;
-	OSL::Color3 bsdf_eval;
+	CBSDFClosure *bsdf = (CBSDFClosure *)sc->prim;
+	float3 bsdf_eval;
 
 	if (dot(sd->Ng, omega_in) >= 0.0f)
-		bsdf_eval = bsdf->eval_reflect(TO_VEC3(sd->I), TO_VEC3(omega_in), pdf);
+		bsdf_eval = bsdf->eval_reflect(sd->I, omega_in, pdf);
 	else
-		bsdf_eval = bsdf->eval_transmit(TO_VEC3(sd->I), TO_VEC3(omega_in), pdf);
+		bsdf_eval = bsdf->eval_transmit(sd->I, omega_in, pdf);
 	
-	return TO_FLOAT3(bsdf_eval);
+	return bsdf_eval;
+}
+
+void OSLShader::bsdf_blur(ShaderClosure *sc, float roughness)
+{
+	CBSDFClosure *bsdf = (CBSDFClosure *)sc->prim;
+	bsdf->blur(roughness);
 }
 
 /* Emissive Closure */
@@ -468,12 +481,30 @@ float3 OSLShader::emissive_eval(const ShaderData *sd, const ShaderClosure *sc)
 
 /* Volume Closure */
 
-float3 OSLShader::volume_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
+float3 OSLShader::volume_eval_phase(const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
 {
 	OSL::VolumeClosure *volume = (OSL::VolumeClosure *)sc->prim;
 	OSL::Color3 volume_eval = volume->eval_phase(TO_VEC3(omega_in), TO_VEC3(omega_out));
 	return TO_FLOAT3(volume_eval) * sc->weight;
 }
 
+/* Attributes */
+
+int OSLShader::find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id)
+{
+	/* for OSL, a hash map is used to lookup the attribute by name. */
+	OSLGlobals::AttributeMap &attr_map = kg->osl->attribute_map[sd->object];
+	ustring stdname(std::string("std::") + std::string(attribute_standard_name((AttributeStandard)id)));
+	OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname);
+
+	if (it != attr_map.end()) {
+		const OSLGlobals::Attribute &osl_attr = it->second;
+		/* return result */
+		return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset;
+	}
+	else
+		return (int)ATTR_STD_NOT_FOUND;
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/osl/osl_shader.h b/intern/cycles/kernel/osl/osl_shader.h
index e2f4d1e..e614f24 100644
--- a/intern/cycles/kernel/osl/osl_shader.h
+++ b/intern/cycles/kernel/osl/osl_shader.h
@@ -31,33 +31,27 @@
  * This means no thread state must be passed along in the kernel itself.
  */
 
-#include <OSL/oslexec.h>
-#include <OSL/oslclosure.h>
-
 #include "kernel_types.h"
 
-#include "util_map.h"
-#include "util_param.h"
-#include "util_vector.h"
-
 CCL_NAMESPACE_BEGIN
 
-namespace OSL = ::OSL;
-
-class OSLRenderServices;
 class Scene;
+
 struct ShaderClosure;
 struct ShaderData;
 struct differential3;
 struct KernelGlobals;
 
+struct OSLGlobals;
+struct OSLShadingSystem;
+
 class OSLShader {
 public:
 	/* init */
-	static void register_closures(OSL::ShadingSystem *ss);
+	static void register_closures(OSLShadingSystem *ss);
 
 	/* per thread data */
-	static void thread_init(KernelGlobals *kg);
+	static void thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OSLGlobals *osl_globals);
 	static void thread_free(KernelGlobals *kg);
 
 	/* eval */
@@ -72,15 +66,19 @@ public:
 	                       float3& eval, float3& omega_in, differential3& domega_in, float& pdf);
 	static float3 bsdf_eval(const ShaderData *sd, const ShaderClosure *sc,
 	                        const float3& omega_in, float& pdf);
+	static void bsdf_blur(ShaderClosure *sc, float roughness);
 
 	static float3 emissive_eval(const ShaderData *sd, const ShaderClosure *sc);
 
-	static float3 volume_eval_phase(const ShaderData *sd, const ShaderClosure *sc,
+	static float3 volume_eval_phase(const ShaderClosure *sc,
 	                                const float3 omega_in, const float3 omega_out);
 
 	/* release */
 	static void init(KernelGlobals *kg, ShaderData *sd);
 	static void release(KernelGlobals *kg, ShaderData *sd);
+
+	/* attributes */
+	static int find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/vol_subsurface.cpp b/intern/cycles/kernel/osl/vol_subsurface.cpp
deleted file mode 100644
index 5845428..0000000
--- a/intern/cycles/kernel/osl/vol_subsurface.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <OpenImageIO/fmath.h>
-
-#include <OSL/genclosure.h>
-
-#include "osl_closures.h"
-
-CCL_NAMESPACE_BEGIN
-
-using namespace OSL;
-
-// Computes scattering properties based on Jensen's reparameterization
-// described in:
-//    http://graphics.ucsd.edu/~henrik/papers/fast_bssrdf/
-
-class SubsurfaceClosure : public VolumeClosure {
-public:
-	float m_g;
-	float m_eta;
-	Color3 m_mfp, m_albedo;
-	static float root_find_Rd(const float Rd0, const float A) {
-		// quick exit for trivial cases
-		if (Rd0 <= 0) return 0;
-		const float A43 = A * 4.0f / 3.0f;
-		// Find alpha such that f(alpha) = Rd (see eq.15). A simple bisection
-		// method can be used because this function is monotonicaly increasing.
-		float lo = 0, hi = 1;
-		for (int i = 0; i < 20; i++) { // 2^20 divisions should be sufficient
-			// eval function at midpoint
-			float alpha = 0.5f * (lo + hi);
-			float a1 = sqrtf(3 * (1 - alpha));
-			float e1 = expf(-a1);
-			float e2 = expf(-A43 * a1);
-			float Rd = 0.5f * alpha * (1 + e2) * e1 - Rd0;
-			if (fabsf(Rd) < 1e-6f)
-				return alpha;  // close enough
-			else if (Rd > 0)
-				hi = alpha;  // root is on left side
-			else
-				lo = alpha;  // root is on right side
-		}
-		// didn't quite converge, pick result in the middle of remaining interval
-		return 0.5f * (lo + hi);
-	}
-	SubsurfaceClosure() {
-	}
-
-	void setup()
-	{
-		ior(m_eta);
-
-		if (m_g >=  0.99f) m_g =  0.99f;
-		if (m_g <= -0.99f) m_g = -0.99f;
-
-		// eq.10
-		float inv_eta = 1 / m_eta;
-		float Fdr = -1.440f * inv_eta * inv_eta + 0.710 * inv_eta + 0.668f + 0.0636 * m_eta;
-		float A = (1 + Fdr) / (1 - Fdr);
-		// compute sigma_s, sigma_a (eq.16)
-		Color3 alpha_prime = Color3(root_find_Rd(m_albedo[0], A),
-		                            root_find_Rd(m_albedo[1], A),
-		                            root_find_Rd(m_albedo[2], A));
-		Color3 sigma_t_prime = Color3(m_mfp.x > 0 ? 1.0f / (m_mfp[0] * sqrtf(3 * (1 - alpha_prime[0]))) : 0.0f,
-		                              m_mfp.y > 0 ? 1.0f / (m_mfp[1] * sqrtf(3 * (1 - alpha_prime[1]))) : 0.0f,
-		                              m_mfp.z > 0 ? 1.0f / (m_mfp[2] * sqrtf(3 * (1 - alpha_prime[2]))) : 0.0f);
-		Color3 sigma_s_prime = alpha_prime * sigma_t_prime;
-
-		sigma_s((1.0f / (1 - m_g)) * sigma_s_prime);
-		sigma_a(sigma_t_prime - sigma_s_prime);
-	}
-
-	bool mergeable(const ClosurePrimitive *other) const {
-		const SubsurfaceClosure *comp = (const SubsurfaceClosure *)other;
-		return m_g == comp->m_g && VolumeClosure::mergeable(other);
-	}
-
-	size_t memsize() const { return sizeof(*this); }
-
-	const char *name() const { return "subsurface"; }
-
-	void print_on(std::ostream &out) const {
-		out << name() << " ()";
-	}
-
-	virtual Color3 eval_phase(const Vec3 &omega_in, const Vec3 &omega_out) const {
-		float costheta = omega_in.dot(omega_out);
-		float ph = 0.25f * float(M_1_PI) * ((1 - m_g * m_g) / powf(1 + m_g * m_g - 2.0f * m_g * costheta, 1.5f));
-		return Color3(ph, ph, ph);
-	}
-};
-
-
-
-ClosureParam *closure_subsurface_params()
-{
-	static ClosureParam params[] = {
-	    CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_eta),
-	    CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_g),
-	    CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_mfp),
-	    CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_albedo),
-	    CLOSURE_STRING_KEYPARAM("label"),
-	    CLOSURE_FINISH_PARAM(SubsurfaceClosure)
-	};
-	return params;
-}
-
-CLOSURE_PREPARE(closure_subsurface_prepare, SubsurfaceClosure)
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/shaders/CMakeLists.txt b/intern/cycles/kernel/shaders/CMakeLists.txt
new file mode 100644
index 0000000..f7fec62
--- /dev/null
+++ b/intern/cycles/kernel/shaders/CMakeLists.txt
@@ -0,0 +1,102 @@
+
+# OSL node shaders
+
+set(SRC_OSL
+	node_add_closure.osl
+	node_ambient_occlusion.osl
+	node_attribute.osl
+	node_background.osl
+	node_brick_texture.osl
+	node_brightness.osl
+	node_bump.osl
+	node_camera.osl
+	node_checker_texture.osl
+	node_combine_rgb.osl
+	node_convert_from_color.osl
+	node_convert_from_float.osl
+	node_convert_from_int.osl
+	node_convert_from_normal.osl
+	node_convert_from_point.osl
+	node_convert_from_vector.osl
+	node_diffuse_bsdf.osl
+	node_emission.osl
+	node_environment_texture.osl
+	node_fresnel.osl
+	node_gamma.osl
+	node_geometry.osl
+	node_glass_bsdf.osl
+	node_glossy_bsdf.osl
+	node_gradient_texture.osl
+	node_holdout.osl
+	node_hsv.osl
+	node_image_texture.osl
+	node_invert.osl
+	node_layer_weight.osl
+	node_light_falloff.osl
+	node_light_path.osl
+	node_magic_texture.osl
+	node_mapping.osl
+	node_math.osl
+	node_mix.osl
+	node_mix_closure.osl
+	node_musgrave_texture.osl
+	node_noise_texture.osl
+	node_normal.osl
+	node_normal_map.osl
+	node_object_info.osl
+	node_output_displacement.osl
+	node_output_surface.osl
+	node_output_volume.osl
+	node_particle_info.osl
+	node_refraction_bsdf.osl
+	node_rgb_ramp.osl
+	node_separate_rgb.osl
+	node_set_normal.osl
+	node_sky_texture.osl
+	node_tangent.osl
+	node_texture_coordinate.osl
+	node_translucent_bsdf.osl
+	node_transparent_bsdf.osl
+	node_value.osl
+	node_vector_math.osl
+	node_velvet_bsdf.osl
+	node_voronoi_texture.osl
+	node_ward_bsdf.osl
+	node_wave_texture.osl
+)
+
+set(SRC_OSL_HEADERS
+	node_texture.h
+	node_color.h
+	node_fresnel.h
+	stdosl.h
+	oslutil.h
+)
+
+set(SRC_OSO
+
+)
+
+# TODO, add a module to compile OSL
+foreach(_file ${SRC_OSL})
+	set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+	string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})
+	string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
+	add_custom_command(
+		OUTPUT ${_OSO_FILE} 
+		COMMAND ${OSL_COMPILER} -O2  -I"${CMAKE_CURRENT_SOURCE_DIR}" ${_OSL_FILE}
+		DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
+	list(APPEND SRC_OSO
+		${_OSO_FILE}
+	)
+
+	unset(_OSL_FILE)
+	unset(_OSO_FILE)
+endforeach()
+
+add_custom_target(cycles_osl_shaders ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
+
+# CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
+delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)
+delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "${SRC_OSL_HEADERS}" ${CYCLES_INSTALL_PATH}/shader)
+
diff --git a/intern/cycles/kernel/shaders/SConscript b/intern/cycles/kernel/shaders/SConscript
new file mode 100644
index 0000000..36b86d7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/SConscript
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+import sys
+import os
+import Blender as B
+
+def normpath(path):
+    return os.path.abspath(os.path.normpath(path))
+
+Import ('env')
+
+oso_files = []
+
+if env['WITH_BF_CYCLES_OSL']:
+    shaders = env.Clone()
+
+    # osl compiler
+    osl_compiler = File(env.subst(env['BF_OSL_COMPILER'])).abspath
+
+    # build directory
+    root_build_dir = normpath(env['BF_BUILDDIR'])
+    build_dir = os.path.join(root_build_dir, 'intern/cycles/kernel/shaders')
+
+    # source directories and files
+    source_dir = Dir('.').srcnode().path
+
+    # dependencies
+    dependencies = shaders.Glob('*.h')
+
+    for f in os.listdir(source_dir):
+        if f.endswith('.osl'):
+            osl_file = os.path.join(source_dir, f)
+            oso_file = os.path.join(build_dir, f.replace('.osl', '.oso'))
+
+            command = "%s -O2 -I%s -o %s %s" % (osl_compiler, source_dir, oso_file, osl_file)
+
+            shaders.Command(oso_file, f, command)
+            shaders.Depends(oso_file, [f] + dependencies)
+
+            oso_files.append(oso_file)
+
+
+Return('oso_files')
diff --git a/intern/cycles/kernel/osl/nodes/node_add_closure.osl b/intern/cycles/kernel/shaders/node_add_closure.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_add_closure.osl
rename to intern/cycles/kernel/shaders/node_add_closure.osl
diff --git a/intern/cycles/kernel/shaders/node_ambient_occlusion.osl b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
new file mode 100644
index 0000000..b942334
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_ambient_occlusion(
+	normal NormalIn = N,
+	color Color = color(0.8, 0.8, 0.8),
+	output closure color AO = ambient_occlusion())
+{
+	AO = Color * ambient_occlusion();
+}
+
diff --git a/intern/cycles/kernel/shaders/node_attribute.osl b/intern/cycles/kernel/shaders/node_attribute.osl
new file mode 100644
index 0000000..8e7c846
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_attribute.osl
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_attribute(
+	string bump_offset = "center",
+	string name = "",
+	output point Vector = point(0.0, 0.0, 0.0),
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Fac = 0.0)
+{
+	getattribute(name, Color);
+	Vector = point(Color);
+	getattribute(name, Fac);
+
+	if (bump_offset == "dx") {
+		Color += Dx(Color);
+		Vector += Dx(Vector);
+		Fac += Dx(Fac);
+	}
+	else if (bump_offset == "dy") {
+		Color += Dy(Color);
+		Vector += Dy(Vector);
+		Fac += Dy(Fac);
+	}
+}
+
diff --git a/intern/cycles/kernel/shaders/node_background.osl b/intern/cycles/kernel/shaders/node_background.osl
new file mode 100644
index 0000000..b51a168
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_background.osl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_background(
+	color Color = color(0.8, 0.8, 0.8),
+	float Strength = 1.0,
+	output closure color Background = background())
+{
+	Background = Color * Strength * background();
+}
+
diff --git a/intern/cycles/kernel/shaders/node_brick_texture.osl b/intern/cycles/kernel/shaders/node_brick_texture.osl
new file mode 100644
index 0000000..b1f2a35
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_brick_texture.osl
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Brick */
+
+float brick_noise(int n) /* fast integer noise */
+{
+	int nn;
+	n = (n >> 13) ^ n;
+	nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 2147483647;
+	return 0.5 * ((float)nn / 1073741824.0);
+}
+
+float brick(point p, float mortar_size, float bias,
+	float BrickWidth, float row_height, float offset_amount, int offset_frequency,
+	float squash_amount, int squash_frequency, float tint)
+{
+	int bricknum, rownum;
+	float offset = 0.0;
+	float brick_width = BrickWidth;
+	float x, y;
+
+	rownum = (int)floor(p[1] / row_height);
+	
+	if (offset_frequency && squash_frequency) {
+		brick_width *= ((int)(rownum) % squash_frequency) ? 1.0 : squash_amount;                /* squash */
+		offset       = ((int)(rownum) % offset_frequency) ? 0 : (brick_width * offset_amount);  /* offset */
+	}
+
+	bricknum = (int)floor((p[0] + offset) / brick_width);
+
+	x = (p[0] + offset) - brick_width * bricknum;
+	y = p[1] - row_height * rownum;
+
+	tint = clamp((brick_noise((rownum << 16) + (bricknum & 65535)) + bias), 0.0, 1.0);
+
+	return (x < mortar_size || y < mortar_size ||
+	        x > (brick_width - mortar_size) ||
+	        y > (row_height - mortar_size)) ? 1.0 : 0.0;
+}
+
+shader node_brick_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	float Offset = 0.5,
+	int OffsetFrequency = 2,
+	float Squash = 1.0,
+	int SquashFrequency = 1,
+	point Vector = P,
+	color Color1 = color(0.2, 0.2, 0.2),
+	color Color2 = color(0.8, 0.8, 0.8),
+	color Mortar = color(0.0, 0.0, 0.0),
+	float Scale = 5.0,
+	float MortarSize = 0.02,
+	float Bias = 0.0,
+	float BrickWidth = 0.5,
+	float RowHeight = 0.25,
+	output float Fac = 0.0,
+	output color Color = color(0.2, 0.2, 0.2))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	float tint = 0.0;
+	color Col = Color1;
+	
+	Fac = brick(p * Scale, MortarSize, Bias, BrickWidth, RowHeight,
+		Offset, OffsetFrequency, Squash, SquashFrequency, tint);
+		
+	if (Fac != 1.0) {
+		float facm = 1.0 - tint;
+
+		Col[0] = facm * (Color1[0]) + tint * Color2[0];
+		Col[1] = facm * (Color1[1]) + tint * Color2[1];
+		Col[2] = facm * (Color1[2]) + tint * Color2[2];
+	}
+	
+	Color = (Fac == 1.0) ? Mortar: Col;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_brightness.osl b/intern/cycles/kernel/shaders/node_brightness.osl
new file mode 100644
index 0000000..b263d81
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_brightness.osl
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_brightness(
+	color ColorIn = color(0.8, 0.8, 0.8),
+	float Bright = 0.0,
+	float Contrast = 0.0,
+	output color ColorOut = color(0.8, 0.8, 0.8))
+{
+	float a = 1.0 + Contrast;
+	float b = Bright - Contrast*0.5;
+
+	ColorOut[0] = max(a*ColorIn[0] + b, 0.0);
+	ColorOut[1] = max(a*ColorIn[1] + b, 0.0);
+	ColorOut[2] = max(a*ColorIn[2] + b, 0.0);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_bump.osl b/intern/cycles/kernel/shaders/node_bump.osl
new file mode 100644
index 0000000..24db1b2
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_bump.osl
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+/* "Bump Mapping Unparameterized Surfaces on the GPU"
+ * Morten S. Mikkelsen, 2010 */
+
+surface node_bump(
+	normal NormalIn = N,
+	float Strength = 0.0,
+	float SampleCenter = 0.0,
+	float SampleX = 0.0,
+	float SampleY = 0.0,
+	output normal Normal = N)
+{
+	/* get surface tangents from normal */
+	vector dPdx = Dx(P);
+	vector dPdy = Dy(P);
+
+	vector Rx = cross(dPdy, NormalIn);
+	vector Ry = cross(NormalIn, dPdx);
+
+	/* compute surface gradient and determinant */
+	float det = dot(dPdx, Rx);
+	vector surfgrad = (SampleX - SampleCenter) * Rx + (SampleY - SampleCenter) * Ry;
+
+	surfgrad *= Strength;
+	float absdet = fabs(det);
+	
+	/* compute and output perturbed normal */
+	Normal = normalize(absdet * NormalIn - sign(det) * surfgrad);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_camera.osl b/intern/cycles/kernel/shaders/node_camera.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_camera.osl
rename to intern/cycles/kernel/shaders/node_camera.osl
diff --git a/intern/cycles/kernel/shaders/node_checker_texture.osl b/intern/cycles/kernel/shaders/node_checker_texture.osl
new file mode 100644
index 0000000..eed56f4
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_checker_texture.osl
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Checker */
+
+float checker(point p)
+{
+	p[0] = (p[0] + 0.00001) * 0.9999;
+	p[1] = (p[1] + 0.00001) * 0.9999;
+	p[2] = (p[2] + 0.00001) * 0.9999;
+	
+	int xi = (int)fabs(floor(p[0]));
+	int yi = (int)fabs(floor(p[1]));
+	int zi = (int)fabs(floor(p[2]));
+
+	if ((xi % 2 == yi % 2) == (zi % 2)) {
+		return 1.0;
+	}
+	else {
+		return 0.0;
+	}
+}
+
+shader node_checker_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	float Scale = 5.0,
+	point Vector = P,
+	color Color1 = color(0.8, 0.8, 0.8),
+	color Color2 = color(0.2, 0.2, 0.2),
+	output float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	Fac = checker(p * Scale);
+	if (Fac == 1.0) {
+		Color = Color1;
+	}
+	else {
+		Color = Color2;
+	}
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_color.h b/intern/cycles/kernel/shaders/node_color.h
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_color.h
rename to intern/cycles/kernel/shaders/node_color.h
diff --git a/intern/cycles/kernel/osl/nodes/node_combine_rgb.osl b/intern/cycles/kernel/shaders/node_combine_rgb.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_combine_rgb.osl
rename to intern/cycles/kernel/shaders/node_combine_rgb.osl
diff --git a/intern/cycles/kernel/shaders/node_convert_from_color.osl b/intern/cycles/kernel/shaders/node_convert_from_color.osl
new file mode 100644
index 0000000..ea488c9
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_color.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_color(
+	color Color = color(0.0, 0.0, 0.0),
+	output string String = "",
+	output float Val = 0.0,
+	output int ValInt = 0,
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+	Val = Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722;
+	ValInt = (int)(Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722);
+	Vector = vector(Color[0], Color[1], Color[2]);
+	Point = point(Color[0], Color[1], Color[2]);
+	Normal = normal(Color[0], Color[1], Color[2]);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_float.osl b/intern/cycles/kernel/shaders/node_convert_from_float.osl
new file mode 100644
index 0000000..a20b491
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_float.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_float(
+	float Val = 0.0,
+	output string String = "",
+	output int ValInt = 0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+	ValInt = (int)Val;
+	Color = color(Val, Val, Val);
+	Vector = vector(Val, Val, Val);
+	Point = point(Val, Val, Val);
+	Normal = normal(Val, Val, Val);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_int.osl b/intern/cycles/kernel/shaders/node_convert_from_int.osl
new file mode 100644
index 0000000..911b492
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_int.osl
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_int(
+	int ValInt = 0,
+	output string String = "",
+	output float Val = 0.0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+	float f = (float)ValInt;
+	Val = f;
+	Color = color(f, f, f);
+	Vector = vector(f, f, f);
+	Point = point(f, f, f);
+	Normal = normal(f, f, f);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_normal.osl b/intern/cycles/kernel/shaders/node_convert_from_normal.osl
new file mode 100644
index 0000000..1add740
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_normal.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_normal(
+	normal Normal = normal(0.0, 0.0, 0.0),
+	output string String = "",
+	output float Val = 0.0,
+	output int ValInt = 0,
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output color Color = color(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0))
+{
+	Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0);
+	ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
+	Vector = vector(Normal[0], Normal[1], Normal[2]);
+	Color = color(Normal[0], Normal[1], Normal[2]);
+	Point = point(Normal[0], Normal[1], Normal[2]);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_point.osl b/intern/cycles/kernel/shaders/node_convert_from_point.osl
new file mode 100644
index 0000000..8a31582
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_point.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_point(
+	point Point = point(0.0, 0.0, 0.0),
+	output string String = "",
+	output float Val = 0.0,
+	output int ValInt = 0,
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output color Color = color(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+	Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0);
+	ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
+	Vector = vector(Point[0], Point[1], Point[2]);
+	Color = color(Point[0], Point[1], Point[2]);
+	Normal = normal(Point[0], Point[1], Point[2]);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_string.osl b/intern/cycles/kernel/shaders/node_convert_from_string.osl
new file mode 100644
index 0000000..f40535a
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_string.osl
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_string(
+	string String = "",
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Val = 0.0,
+	output int ValInt = 0,
+	output vector Vector = vector(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+}
+
diff --git a/intern/cycles/kernel/shaders/node_convert_from_vector.osl b/intern/cycles/kernel/shaders/node_convert_from_vector.osl
new file mode 100644
index 0000000..ae9f974
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_convert_from_vector.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_convert_from_vector(
+	vector Vector = vector(0.0, 0.0, 0.0),
+	output string String = "",
+	output float Val = 0.0,
+	output int ValInt = 0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output point Point = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0))
+{
+	Val = (Vector[0] + Vector[1] + Vector[2]) * (1.0 / 3.0);
+	ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
+	Color = color(Vector[0], Vector[1], Vector[2]);
+	Point = point(Vector[0], Vector[1], Vector[2]);
+	Normal = normal(Vector[0], Vector[1], Vector[2]);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_diffuse_bsdf.osl b/intern/cycles/kernel/shaders/node_diffuse_bsdf.osl
new file mode 100644
index 0000000..d6dc173
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_diffuse_bsdf.osl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_diffuse_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	float Roughness = 0.0,
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	if (Roughness == 0.0)
+		BSDF = Color * diffuse(Normal);
+	else
+		BSDF = Color * oren_nayar(Normal, Roughness);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_emission.osl b/intern/cycles/kernel/shaders/node_emission.osl
new file mode 100644
index 0000000..7ad0f9f
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_emission.osl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_emission(
+	int TotalPower = 0,
+	color Color = color(0.8, 0.8, 0.8),
+	float Strength = 1.0,
+	output closure color Emission = emission())
+{
+	if (TotalPower)
+		Emission = ((Strength / surfacearea()) * Color) * emission();
+	else
+		Emission = (Strength * Color) * emission();
+}
+
diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl
new file mode 100644
index 0000000..7da336a
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_environment_texture.osl
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_color.h"
+
+vector environment_texture_direction_to_equirectangular(vector dir)
+{
+	float u = -atan2(dir[1], dir[0]) / (2.0 * M_PI) + 0.5;
+	float v = atan2(dir[2], hypot(dir[0], dir[1])) / M_PI + 0.5;
+
+	return vector(u, v, 0.0);
+}
+
+vector environment_texture_direction_to_mirrorball(vector dir)
+{
+	dir[1] -= 1.0;
+
+	float div = 2.0 * sqrt(max(-0.5 * dir[1], 0.0));
+	if (div > 0.0)
+		dir /= div;
+
+	float u = 0.5 * (dir[0] + 1.0);
+	float v = 0.5 * (dir[2] + 1.0);
+
+	return vector(u, v, 0.0);
+}
+
+shader node_environment_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	vector Vector = P,
+	string filename = "",
+	string projection = "Equirectangular",
+	string color_space = "sRGB",
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Alpha = 1.0)
+{
+	vector p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+	
+	p = normalize(p);
+
+	if (projection == "Equirectangular")
+		p = environment_texture_direction_to_equirectangular(p);
+	else
+		p = environment_texture_direction_to_mirrorball(p);
+
+	/* todo: use environment for better texture filtering of equirectangular */
+	Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha);
+
+	if (color_space == "sRGB")
+		Color = color_srgb_to_scene_linear(Color);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_fresnel.h b/intern/cycles/kernel/shaders/node_fresnel.h
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_fresnel.h
rename to intern/cycles/kernel/shaders/node_fresnel.h
diff --git a/intern/cycles/kernel/shaders/node_fresnel.osl b/intern/cycles/kernel/shaders/node_fresnel.osl
new file mode 100644
index 0000000..e8d8e94
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_fresnel.osl
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_fresnel.h"
+
+shader node_fresnel(
+	float IOR = 1.45,
+	normal Normal = N,
+	output float Fac = 0.0)
+{
+	float f = max(IOR, 1.0 + 1e-5);
+	float eta = backfacing() ? 1.0 / f: f;
+	Fac = fresnel_dielectric(I, Normal, eta);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_gamma.osl b/intern/cycles/kernel/shaders/node_gamma.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_gamma.osl
rename to intern/cycles/kernel/shaders/node_gamma.osl
diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl
new file mode 100644
index 0000000..d1c11b7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_geometry.osl
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_geometry(
+	normal NormalIn = N,
+	string bump_offset = "center",
+
+	output point Position = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0),
+	output normal Tangent = normal(0.0, 0.0, 0.0),
+	output normal TrueNormal = normal(0.0, 0.0, 0.0),
+	output vector Incoming = vector(0.0, 0.0, 0.0),
+	output point Parametric = point(0.0, 0.0, 0.0),
+	output float Backfacing = 0.0)
+{
+	Position = P;
+	Normal = NormalIn;
+	TrueNormal = Ng;
+	Incoming = I;
+	Parametric = point(u, v, 0.0);
+	Backfacing = backfacing();
+
+	if (bump_offset == "dx") {
+		Position += Dx(Position);
+		Parametric += Dx(Parametric);
+	}
+	else if (bump_offset == "dy") {
+		Position += Dy(Position);
+		Parametric += Dy(Parametric);
+	}
+
+	/* first try to get tangent attribute */
+	point generated;
+
+	/* try to create spherical tangent from generated coordinates */
+	if (getattribute("geom:generated", generated)) {
+		matrix project = matrix(0.0, 1.0, 0.0, 0.0,
+		                        -1.0, 0.0, 0.0, 0.0,
+		                        0.0, 0.0, 0.0, 0.0,
+		                        0.5, -0.5, 0.0, 1.0);
+
+		vector T = transform(project, generated);
+		T = transform("object", "world", T);
+		Tangent = cross(Normal, normalize(cross(T, Normal)));
+	}
+	else {
+		/* otherwise use surface derivatives */
+		Tangent = normalize(dPdu);
+	}
+}
+
diff --git a/intern/cycles/kernel/shaders/node_glass_bsdf.osl b/intern/cycles/kernel/shaders/node_glass_bsdf.osl
new file mode 100644
index 0000000..30b9d30
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_glass_bsdf.osl
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_fresnel.h"
+
+shader node_glass_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	string distribution = "Sharp",
+	float Roughness = 0.2,
+	float IOR = 1.45,
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	float f = max(IOR, 1.0 + 1e-5);
+	float eta = backfacing() ? 1.0 / f: f;
+	float Fr = fresnel_dielectric(I, Normal, eta);
+
+	if (distribution == "Sharp")
+		BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
+	else if (distribution == "Beckmann")
+		BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) +
+		                (1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
+	else if (distribution == "GGX")
+		BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness) +
+		                (1.0 - Fr) * microfacet_ggx_refraction(Normal, Roughness, eta));
+}
+
diff --git a/intern/cycles/kernel/shaders/node_glossy_bsdf.osl b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl
new file mode 100644
index 0000000..03340c7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_fresnel.h"
+
+shader node_glossy_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	string distribution = "Beckmann",
+	float Roughness = 0.2,
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	if (distribution == "Sharp")
+		BSDF = Color * reflection(Normal);
+	else if (distribution == "Beckmann")
+		BSDF = Color * microfacet_beckmann(Normal, Roughness);
+	else if (distribution == "GGX")
+		BSDF = Color * microfacet_ggx(Normal, Roughness);
+
+}
+
diff --git a/intern/cycles/kernel/shaders/node_gradient_texture.osl b/intern/cycles/kernel/shaders/node_gradient_texture.osl
new file mode 100644
index 0000000..8d862db
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_gradient_texture.osl
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Gradient */
+
+float gradient(point p, string type)
+{
+	float x, y, z;
+	
+	x = p[0];
+	y = p[1];
+	z = p[2];
+
+	float result = 0.0;
+
+	if (type == "Linear") {
+		result = x;
+	}
+	else if (type == "Quadratic") {
+		float r = max(x, 0.0);
+		result = r * r;
+	}
+	else if (type == "Easing") {
+		float r = min(max(x, 0.0), 1.0);
+		float t = r * r;
+		
+		result = (3.0 * t - 2.0 * t * r);
+	}
+	else if (type == "Diagonal") {
+		result = (x + y) / 2.0;
+	}
+	else if (type == "Radial") {
+		result = atan2(y, x) / (2.0 * M_PI) + 0.5;
+	}
+	else {
+		float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0);
+
+		if (type == "Quadratic Sphere")
+			result = r * r;
+		else if (type == "Spherical")
+			result = r;
+	}
+
+	return result;
+}
+
+shader node_gradient_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	string Type = "Linear",
+	point Vector = P,
+	output float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	Fac = gradient(p, Type);
+	Color = color(Fac, Fac, Fac);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_holdout.osl b/intern/cycles/kernel/shaders/node_holdout.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_holdout.osl
rename to intern/cycles/kernel/shaders/node_holdout.osl
diff --git a/intern/cycles/kernel/shaders/node_hsv.osl b/intern/cycles/kernel/shaders/node_hsv.osl
new file mode 100644
index 0000000..0f4bedf
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_hsv.osl
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_color.h"
+
+shader node_hsv(
+	float Hue = 0.5,
+	float Saturation = 1.0,
+	float Value = 1.0,
+	float Fac = 0.5,
+	color ColorIn = color(0.0, 0.0, 0.0),
+	output color ColorOut = color(0.0, 0.0, 0.0))
+{
+	color Color = rgb_to_hsv(ColorIn);
+
+	// remember: fmod doesn't work for negative numbers
+	Color[0] += Hue + 0.5;
+	Color[0] = fmod(Color[0], 1.0);
+	Color[1] *= Saturation;
+	Color[2] *= Value;
+
+	Color = hsv_to_rgb(Color);
+
+	ColorOut = mix(ColorIn, Color, Fac);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl
new file mode 100644
index 0000000..9907467
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_image_texture.osl
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_color.h"
+
+color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha)
+{
+	color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha);
+
+	if (color_space == "sRGB")
+		rgb = color_srgb_to_scene_linear(rgb);
+
+	return rgb;
+}
+
+shader node_image_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	point Vector = P,
+	string filename = "",
+	string color_space = "sRGB",
+	string projection = "Flat",
+	float projection_blend = 0.0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Alpha = 1.0)
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	if (projection == "Flat") {
+		Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha);
+	}
+	else if (projection == "Box") {
+		/* object space normal */
+		vector Nob = transform("world", "object", N);
+
+		/* project from direction vector to barycentric coordinates in triangles */
+		Nob = vector(fabs(Nob[0]), fabs(Nob[1]), fabs(Nob[2]));
+		Nob /= (Nob[0] + Nob[1] + Nob[2]);
+
+		/* basic idea is to think of this as a triangle, each corner representing
+		 * one of the 3 faces of the cube. in the corners we have single textures,
+		 * in between we blend between two textures, and in the middle we a blend
+		 * between three textures.
+		 *
+		 * the Nxyz values are the barycentric coordinates in an equilateral
+		 * triangle, which in case of blending, in the middle has a smaller
+		 * equilateral triangle where 3 textures blend. this divides things into
+		 * 7 zones, with an if () test for each zone */
+
+		vector weight = vector(0.0, 0.0, 0.0);
+		float blend = projection_blend;
+		float limit = 0.5 * (1.0 + blend);
+
+		/* first test for corners with single texture */
+		if (Nob[0] > limit * (Nob[0] + Nob[1]) && Nob[0] > limit * (Nob[0] + Nob[2])) {
+			weight[0] = 1.0;
+		}
+		else if (Nob[1] > limit * (Nob[0] + Nob[1]) && Nob[1] > limit * (Nob[1] + Nob[2])) {
+			weight[1] = 1.0;
+		}
+		else if (Nob[2] > limit * (Nob[0] + Nob[2]) && Nob[2] > limit * (Nob[1] + Nob[2])) {
+			weight[2] = 1.0;
+		}
+		else if (blend > 0.0) {
+			/* in case of blending, test for mixes between two textures */
+			if (Nob[2] < (1.0 - limit) * (Nob[1] + Nob[0])) {
+				weight[0] = Nob[0] / (Nob[0] + Nob[1]);
+				weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+				weight[1] = 1.0 - weight[0];
+			}
+			else if (Nob[0] < (1.0 - limit) * (Nob[1] + Nob[2])) {
+				weight[1] = Nob[1] / (Nob[1] + Nob[2]);
+				weight[1] = clamp((weight[1] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+				weight[2] = 1.0 - weight[1];
+			}
+			else if (Nob[1] < (1.0 - limit) * (Nob[0] + Nob[2])) {
+				weight[0] = Nob[0] / (Nob[0] + Nob[2]);
+				weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+				weight[2] = 1.0 - weight[0];
+			}
+			else {
+				/* last case, we have a mix between three */
+				weight[0] = ((2.0 - limit) * Nob[0] + (limit - 1.0)) / (2.0 * limit - 1.0);
+				weight[1] = ((2.0 - limit) * Nob[1] + (limit - 1.0)) / (2.0 * limit - 1.0);
+				weight[2] = ((2.0 - limit) * Nob[2] + (limit - 1.0)) / (2.0 * limit - 1.0);
+			}
+		}
+
+		Color = color(0.0, 0.0, 0.0);
+		Alpha = 0.0;
+
+		float tmp_alpha;
+
+		if (weight[0] > 0.0) {
+			Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha);
+			Alpha += weight[0] * tmp_alpha;
+		}
+		if (weight[1] > 0.0) {
+			Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha);
+			Alpha += weight[1] * tmp_alpha;
+		}
+		if (weight[2] > 0.0) {
+			Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha);
+			Alpha += weight[2] * tmp_alpha;
+		}
+	}
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_invert.osl b/intern/cycles/kernel/shaders/node_invert.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_invert.osl
rename to intern/cycles/kernel/shaders/node_invert.osl
diff --git a/intern/cycles/kernel/shaders/node_layer_weight.osl b/intern/cycles/kernel/shaders/node_layer_weight.osl
new file mode 100644
index 0000000..3ea57f7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_layer_weight.osl
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_fresnel.h"
+
+shader node_layer_weight(
+	float Blend = 0.5,
+	normal Normal = N,
+	output float Fresnel = 0.0,
+	output float Facing = 0.0)
+{
+	float blend = Blend;
+
+	/* Fresnel */ 
+	float eta = max(1.0 - Blend, 1e-5);
+	eta = backfacing() ? eta : 1.0 / eta;
+	Fresnel = fresnel_dielectric(I, Normal, eta);
+
+	/* Facing */ 
+	Facing = abs(dot(I, Normal));
+
+	if (blend != 0.5) {
+		blend = clamp(blend, 0.0, 1.0 - 1e-5);
+		blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend);
+
+		Facing = pow(Facing, blend);
+	}
+
+	Facing = 1.0 - Facing;
+}
diff --git a/intern/cycles/kernel/shaders/node_light_falloff.osl b/intern/cycles/kernel/shaders/node_light_falloff.osl
new file mode 100644
index 0000000..a9d4160
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_light_falloff.osl
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_light_falloff(
+	float Strength = 0.0,
+	float Smooth = 0.0,
+	output float Quadratic = 0.0,
+	output float Linear = 0.0,
+	output float Constant = 0.0)
+{
+	float ray_length = 0.0;
+	float strength = Strength;
+	getattribute("path:ray_length", ray_length);
+
+	if (Smooth > 0.0) {
+		float squared = ray_length * ray_length;
+		strength *= squared / (Smooth + squared);
+	}
+
+	/* Quadratic */ 
+	Quadratic = strength;
+	
+	/* Linear */
+	Linear = (strength * ray_length);
+
+	/* Constant */
+	Constant = (strength * ray_length * ray_length);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_light_path.osl b/intern/cycles/kernel/shaders/node_light_path.osl
new file mode 100644
index 0000000..9e3f6c7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_light_path.osl
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_light_path(
+	output float IsCameraRay = 0.0,
+	output float IsShadowRay = 0.0,
+	output float IsDiffuseRay = 0.0,
+	output float IsGlossyRay = 0.0,
+	output float IsSingularRay = 0.0,
+	output float IsReflectionRay = 0.0,
+	output float IsTransmissionRay = 0.0,
+	output float RayLength = 0.0)
+{
+	IsCameraRay = raytype("camera");
+	IsShadowRay = raytype("shadow");
+	IsDiffuseRay = raytype("diffuse");
+	IsGlossyRay = raytype("glossy");
+	IsSingularRay = raytype("singular");
+	IsReflectionRay = raytype("reflection");
+	IsTransmissionRay = raytype("refraction");
+
+	getattribute("path:ray_length", RayLength);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_magic_texture.osl b/intern/cycles/kernel/shaders/node_magic_texture.osl
new file mode 100644
index 0000000..b81a304
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_magic_texture.osl
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Magic */
+
+color magic(point p, int n, float distortion)
+{
+	float dist = distortion;
+
+	float x =  sin(( p[0] + p[1] + p[2]) * 5.0);
+	float y =  cos((-p[0] + p[1] - p[2]) * 5.0);
+	float z = -cos((-p[0] - p[1] + p[2]) * 5.0);
+
+	if (n > 0) {
+		x *= dist;
+		y *= dist;
+		z *= dist;
+		y = -cos(x - y + z);
+		y *= dist;
+
+		if (n > 1) {
+			x = cos(x - y - z);
+			x *= dist;
+
+			if (n > 2) {
+				z = sin(-x - y - z);
+				z *= dist;
+
+				if (n > 3) {
+					x = -cos(-x + y - z);
+					x *= dist;
+
+					if (n > 4) {
+						y = -sin(-x + y + z);
+						y *= dist;
+
+						if (n > 5) {
+							y = -cos(-x + y + z);
+							y *= dist;
+
+							if (n > 6) {
+								x = cos(x + y + z);
+								x *= dist;
+
+								if (n > 7) {
+									z = sin(x + y - z);
+									z *= dist;
+
+									if (n > 8) {
+										x = -cos(-x - y + z);
+										x *= dist;
+
+										if (n > 9) {
+											y = -sin(x - y + z);
+											y *= dist;
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	if (dist != 0.0) {
+		dist *= 2.0;
+		x /= dist;
+		y /= dist;
+		z /= dist;
+	}
+
+	return color(0.5 - x, 0.5 - y, 0.5 - z);
+}
+
+shader node_magic_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	int Depth = 2,
+	float Distortion = 5.0,
+	float Scale = 5.0,
+	point Vector = P,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	Color = magic(p * Scale, Depth, Distortion);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_mapping.osl b/intern/cycles/kernel/shaders/node_mapping.osl
new file mode 100644
index 0000000..92df043
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_mapping.osl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_mapping(
+	matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	point mapping_min = point(0.0, 0.0, 0.0),
+	point mapping_max = point(0.0, 0.0, 0.0),
+	int use_minmax = 0,
+	point VectorIn = point(0.0, 0.0, 0.0),
+	output point VectorOut = point(0.0, 0.0, 0.0))
+{
+	point p = transform(Matrix, VectorIn);
+
+	if(use_minmax)
+		p = min(max(mapping_min, p), mapping_max);
+	
+	VectorOut = p;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_math.osl b/intern/cycles/kernel/shaders/node_math.osl
new file mode 100644
index 0000000..24dce89
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_math.osl
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+float safe_divide(float a, float b)
+{
+	float result;
+
+	if (b == 0.0)
+		result = 0.0;
+	else
+		result = a / b;
+	
+	return result;
+}
+
+float safe_log(float a, float b)
+{
+	if (a < 0.0 || b < 0.0)
+		return 0.0;
+	
+	return log(a) / log(b);
+}
+
+shader node_math(
+	string type = "Add",
+	int Clamp = 0,
+	float Value1 = 0.0,
+	float Value2 = 0.0,
+	output float Value = 0.0)
+{
+	/* OSL asin, acos, pow check for values that could give rise to nan */
+
+	if (type == "Add")
+		Value = Value1 + Value2;
+	if (type == "Subtract")
+		Value = Value1 - Value2;
+	if (type == "Multiply")
+		Value = Value1 * Value2;
+	if (type == "Divide")
+		Value = safe_divide(Value1, Value2);
+	if (type == "Sine")
+		Value = sin(Value1);
+	if (type == "Cosine")
+		Value = cos(Value1);
+	if (type == "Tangent")
+		Value = tan(Value1);
+	if (type == "Arcsine")
+		Value = asin(Value1);
+	if (type == "Arccosine")
+		Value = acos(Value1);
+	if (type == "Arctangent")
+		Value = atan(Value1);
+	if (type == "Power")
+		Value = pow(Value1, Value2);
+	if (type == "Logarithm")
+		Value = safe_log(Value1, Value2);
+	if (type == "Minimum")
+		Value = min(Value1, Value2);
+	if (type == "Maximum")
+		Value = max(Value1, Value2);
+	if (type == "Round")
+		Value = floor(Value1 + 0.5);
+	if (type == "Less Than")
+		Value = Value1 < Value2;
+	if (type == "Greater Than")
+		Value = Value1 > Value2;
+
+	if (Clamp)
+		Value = clamp(Value1, 0.0, 1.0);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_mix.osl b/intern/cycles/kernel/shaders/node_mix.osl
new file mode 100644
index 0000000..b2af362
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_mix.osl
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_color.h"
+
+color node_mix_blend(float t, color col1, color col2)
+{
+	return mix(col1, col2, t);
+}
+
+color node_mix_add(float t, color col1, color col2)
+{
+	return mix(col1, col1 + col2, t);
+}
+
+color node_mix_mul(float t, color col1, color col2)
+{
+	return mix(col1, col1 * col2, t);
+}
+
+color node_mix_screen(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	return color(1.0) - (color(tm) + t * (color(1.0) - col2)) * (color(1.0) - col1);
+}
+
+color node_mix_overlay(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	color outcol = col1;
+
+	if (outcol[0] < 0.5)
+		outcol[0] *= tm + 2.0 * t * col2[0];
+	else
+		outcol[0] = 1.0 - (tm + 2.0 * t * (1.0 - col2[0])) * (1.0 - outcol[0]);
+
+	if (outcol[1] < 0.5)
+		outcol[1] *= tm + 2.0 * t * col2[1];
+	else
+		outcol[1] = 1.0 - (tm + 2.0 * t * (1.0 - col2[1])) * (1.0 - outcol[1]);
+
+	if (outcol[2] < 0.5)
+		outcol[2] *= tm + 2.0 * t * col2[2];
+	else
+		outcol[2] = 1.0 - (tm + 2.0 * t * (1.0 - col2[2])) * (1.0 - outcol[2]);
+	
+	return outcol;
+}
+
+color node_mix_sub(float t, color col1, color col2)
+{
+	return mix(col1, col1 - col2, t);
+}
+
+color node_mix_div(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	color outcol = col1;
+
+	if (col2[0] != 0.0) outcol[0] = tm * outcol[0] + t * outcol[0] / col2[0];
+	if (col2[1] != 0.0) outcol[1] = tm * outcol[1] + t * outcol[1] / col2[1];
+	if (col2[2] != 0.0) outcol[2] = tm * outcol[2] + t * outcol[2] / col2[2];
+
+	return outcol;
+}
+
+color node_mix_diff(float t, color col1, color col2)
+{
+	return mix(col1, abs(col1 - col2), t);
+}
+
+color node_mix_dark(float t, color col1, color col2)
+{
+	return min(col1, col2 * t);
+}
+
+color node_mix_light(float t, color col1, color col2)
+{
+	return max(col1, col2 * t);
+}
+
+color node_mix_dodge(float t, color col1, color col2)
+{
+	color outcol = col1;
+
+	if (outcol[0] != 0.0) {
+		float tmp = 1.0 - t * col2[0];
+		if (tmp <= 0.0)
+			outcol[0] = 1.0;
+		else if ((tmp = outcol[0] / tmp) > 1.0)
+			outcol[0] = 1.0;
+		else
+			outcol[0] = tmp;
+	}
+	if (outcol[1] != 0.0) {
+		float tmp = 1.0 - t * col2[1];
+		if (tmp <= 0.0)
+			outcol[1] = 1.0;
+		else if ((tmp = outcol[1] / tmp) > 1.0)
+			outcol[1] = 1.0;
+		else
+			outcol[1] = tmp;
+	}
+	if (outcol[2] != 0.0) {
+		float tmp = 1.0 - t * col2[2];
+		if (tmp <= 0.0)
+			outcol[2] = 1.0;
+		else if ((tmp = outcol[2] / tmp) > 1.0)
+			outcol[2] = 1.0;
+		else
+			outcol[2] = tmp;
+	}
+
+	return outcol;
+}
+
+color node_mix_burn(float t, color col1, color col2)
+{
+	float tmp, tm = 1.0 - t;
+
+	color outcol = col1;
+
+	tmp = tm + t * col2[0];
+	if (tmp <= 0.0)
+		outcol[0] = 0.0;
+	else if ((tmp = (1.0 - (1.0 - outcol[0]) / tmp)) < 0.0)
+		outcol[0] = 0.0;
+	else if (tmp > 1.0)
+		outcol[0] = 1.0;
+	else
+		outcol[0] = tmp;
+
+	tmp = tm + t * col2[1];
+	if (tmp <= 0.0)
+		outcol[1] = 0.0;
+	else if ((tmp = (1.0 - (1.0 - outcol[1]) / tmp)) < 0.0)
+		outcol[1] = 0.0;
+	else if (tmp > 1.0)
+		outcol[1] = 1.0;
+	else
+		outcol[1] = tmp;
+
+	tmp = tm + t * col2[2];
+	if (tmp <= 0.0)
+		outcol[2] = 0.0;
+	else if ((tmp = (1.0 - (1.0 - outcol[2]) / tmp)) < 0.0)
+		outcol[2] = 0.0;
+	else if (tmp > 1.0)
+		outcol[2] = 1.0;
+	else
+		outcol[2] = tmp;
+	
+	return outcol;
+}
+
+color node_mix_hue(float t, color col1, color col2)
+{
+	color outcol = col1;
+	color hsv2 = rgb_to_hsv(col2);
+
+	if (hsv2[1] != 0.0) {
+		color hsv = rgb_to_hsv(outcol);
+		hsv[0] = hsv2[0];
+		color tmp = hsv_to_rgb(hsv); 
+
+		outcol = mix(outcol, tmp, t);
+	}
+
+	return outcol;
+}
+
+color node_mix_sat(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	color outcol = col1;
+
+	color hsv = rgb_to_hsv(outcol);
+
+	if (hsv[1] != 0.0) {
+		color hsv2 = rgb_to_hsv(col2);
+
+		hsv[1] = tm * hsv[1] + t * hsv2[1];
+		outcol = hsv_to_rgb(hsv);
+	}
+
+	return outcol;
+}
+
+color node_mix_val(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	color hsv = rgb_to_hsv(col1);
+	color hsv2 = rgb_to_hsv(col2);
+
+	hsv[2] = tm * hsv[2] + t * hsv2[2];
+
+	return hsv_to_rgb(hsv);
+}
+
+color node_mix_color(float t, color col1, color col2)
+{
+	color outcol = col1;
+	color hsv2 = rgb_to_hsv(col2);
+
+	if (hsv2[1] != 0.0) {
+		color hsv = rgb_to_hsv(outcol);
+		hsv[0] = hsv2[0];
+		hsv[1] = hsv2[1];
+		color tmp = hsv_to_rgb(hsv); 
+
+		outcol = mix(outcol, tmp, t);
+	}
+
+	return outcol;
+}
+
+color node_mix_soft(float t, color col1, color col2)
+{
+	float tm = 1.0 - t;
+
+	color one = color(1.0);
+	color scr = one - (one - col2) * (one - col1);
+
+	return tm * col1 + t * ((one - col1) * col2 * col1 + col1 * scr);
+}
+
+color node_mix_linear(float t, color col1, color col2)
+{
+	color outcol = col1;
+
+	if (col2[0] > 0.5)
+		outcol[0] = col1[0] + t * (2.0 * (col2[0] - 0.5));
+	else
+		outcol[0] = col1[0] + t * (2.0 * (col2[0]) - 1.0);
+
+	if (col2[1] > 0.5)
+		outcol[1] = col1[1] + t * (2.0 * (col2[1] - 0.5));
+	else
+		outcol[1] = col1[1] + t * (2.0 * (col2[1]) - 1.0);
+
+	if (col2[2] > 0.5)
+		outcol[2] = col1[2] + t * (2.0 * (col2[2] - 0.5));
+	else
+		outcol[2] = col1[2] + t * (2.0 * (col2[2]) - 1.0);
+	
+	return outcol;
+}
+
+color node_mix_clamp(color col)
+{
+	color outcol = col;
+
+	outcol[0] = clamp(col[0], 0.0, 1.0);
+	outcol[1] = clamp(col[1], 0.0, 1.0);
+	outcol[2] = clamp(col[2], 0.0, 1.0);
+
+	return outcol;
+}
+
+shader node_mix(
+	string type = "Mix",
+	int Clamp = 0,
+	float Fac = 0.5,
+	color Color1 = color(0.0, 0.0, 0.0),
+	color Color2 = color(0.0, 0.0, 0.0),
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	float t = clamp(Fac, 0.0, 1.0);
+
+	if (type == "Mix")
+		Color = node_mix_blend(t, Color1, Color2);
+	if (type == "Add")
+		Color = node_mix_add(t, Color1, Color2);
+	if (type == "Multiply")
+		Color = node_mix_mul(t, Color1, Color2);
+	if (type == "Screen")
+		Color = node_mix_screen(t, Color1, Color2);
+	if (type == "Overlay")
+		Color = node_mix_overlay(t, Color1, Color2);
+	if (type == "Subtract")
+		Color = node_mix_sub(t, Color1, Color2);
+	if (type == "Divide")
+		Color = node_mix_div(t, Color1, Color2);
+	if (type == "Difference")
+		Color = node_mix_diff(t, Color1, Color2);
+	if (type == "Darken")
+		Color = node_mix_dark(t, Color1, Color2);
+	if (type == "Lighten")
+		Color = node_mix_light(t, Color1, Color2);
+	if (type == "Dodge")
+		Color = node_mix_dodge(t, Color1, Color2);
+	if (type == "Burn")
+		Color = node_mix_burn(t, Color1, Color2);
+	if (type == "Hue")
+		Color = node_mix_hue(t, Color1, Color2);
+	if (type == "Saturation")
+		Color = node_mix_sat(t, Color1, Color2);
+	if (type == "Value")
+		Color = node_mix_val (t, Color1, Color2);
+	if (type == "Color")
+		Color = node_mix_color(t, Color1, Color2);
+	if (type == "Soft Light")
+		Color = node_mix_soft(t, Color1, Color2);
+	if (type == "Linear Light")
+		Color = node_mix_linear(t, Color1, Color2);
+
+	if (Clamp)
+		Color = node_mix_clamp(Color);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_mix_closure.osl b/intern/cycles/kernel/shaders/node_mix_closure.osl
new file mode 100644
index 0000000..e28dd1f
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_mix_closure.osl
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_mix_closure(
+	float Fac = 0.5,
+	closure color Closure1 = background(),
+	closure color Closure2 = background(),
+	output closure color Closure = background())
+{
+	float t = clamp(Fac, 0.0, 1.0);
+	Closure = (1.0 - t) * Closure1 + t * Closure2;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_musgrave_texture.osl b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
new file mode 100644
index 0000000..afdbca2
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Musgrave fBm
+ *
+ * H: fractal increment parameter
+ * lacunarity: gap between successive frequencies
+ * octaves: number of frequencies in the fBm
+ *
+ * from "Texturing and Modelling: A procedural approach"
+ */
+
+float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float octaves)
+{
+	float rmd;
+	float value = 0.0;
+	float pwr = 1.0;
+	float pwHL = pow(lacunarity, -H);
+	int i;
+
+	for (i = 0; i < (int)octaves; i++) {
+		value += noise("perlin", p) * pwr;
+		pwr *= pwHL;
+		p *= lacunarity;
+	}
+
+	rmd = octaves - floor(octaves);
+	if (rmd != 0.0)
+		value += rmd * noise("perlin", p) * pwr;
+
+	return value;
+}
+
+/* Musgrave Multifractal
+ *
+ * H: highest fractal dimension
+ * lacunarity: gap between successive frequencies
+ * octaves: number of frequencies in the fBm
+ */
+
+float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunarity, float octaves)
+{
+	float rmd;
+	float value = 1.0;
+	float pwr = 1.0;
+	float pwHL = pow(lacunarity, -H);
+	int i;
+
+	for (i = 0; i < (int)octaves; i++) {
+		value *= (pwr * noise("perlin", p) + 1.0);
+		pwr *= pwHL;
+		p *= lacunarity;
+	}
+
+	rmd = octaves - floor(octaves);
+	if (rmd != 0.0)
+		value *= (rmd * pwr * noise("perlin", p) + 1.0); /* correct? */
+
+	return value;
+}
+
+/* Musgrave Heterogeneous Terrain
+ *
+ * H: fractal dimension of the roughest area
+ * lacunarity: gap between successive frequencies
+ * octaves: number of frequencies in the fBm
+ * offset: raises the terrain from `sea level'
+ */
+
+float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacunarity, float octaves, float offset)
+{
+	float value, increment, rmd;
+	float pwHL = pow(lacunarity, -H);
+	float pwr = pwHL;
+	int i;
+
+	/* first unscaled octave of function; later octaves are scaled */
+	value = offset + noise("perlin", p);
+	p *= lacunarity;
+
+	for (i = 1; i < (int)octaves; i++) {
+		increment = (noise("perlin", p) + offset) * pwr * value;
+		value += increment;
+		pwr *= pwHL;
+		p *= lacunarity;
+	}
+
+	rmd = octaves - floor(octaves);
+	if (rmd != 0.0) {
+		increment = (noise("perlin", p) + offset) * pwr * value;
+		value += rmd * increment;
+	}
+
+	return value;
+}
+
+/* Hybrid Additive/Multiplicative Multifractal Terrain
+ *
+ * H: fractal dimension of the roughest area
+ * lacunarity: gap between successive frequencies
+ * octaves: number of frequencies in the fBm
+ * offset: raises the terrain from `sea level'
+ */
+
+float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
+                                          float lacunarity, float octaves, float offset, float gain)
+{
+	float result, signal, weight, rmd;
+	float pwHL = pow(lacunarity, -H);
+	float pwr = pwHL;
+	int i;
+
+	result = noise("perlin", p) + offset;
+	weight = gain * result;
+	p *= lacunarity;
+
+	for (i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
+		if (weight > 1.0)
+			weight = 1.0;
+
+		signal = (noise("perlin", p) + offset) * pwr;
+		pwr *= pwHL;
+		result += weight * signal;
+		weight *= gain * signal;
+		p *= lacunarity;
+	}
+
+	rmd = octaves - floor(octaves);
+	if (rmd != 0.0)
+		result += rmd * ((noise("perlin", p) + offset) * pwr);
+
+	return result;
+}
+
+/* Ridged Multifractal Terrain
+ *
+ * H: fractal dimension of the roughest area
+ * lacunarity: gap between successive frequencies
+ * octaves: number of frequencies in the fBm
+ * offset: raises the terrain from `sea level'
+ */
+
+float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
+                                          float lacunarity, float octaves, float offset, float gain)
+{
+	float result, signal, weight;
+	float pwHL = pow(lacunarity, -H);
+	float pwr = pwHL;
+	int i;
+
+	signal = offset - fabs(noise("perlin", p));
+	signal *= signal;
+	result = signal;
+	weight = 1.0;
+
+	for (i = 1; i < (int)octaves; i++) {
+		p *= lacunarity;
+		weight = clamp(signal * gain, 0.0, 1.0);
+		signal = offset - fabs(noise("perlin", p));
+		signal *= signal;
+		signal *= weight;
+		result += signal * pwr;
+		pwr *= pwHL;
+	}
+
+	return result;
+}
+
+/* Shader */
+
+shader node_musgrave_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	string Type = "fBM",
+	float Dimension = 2.0,
+	float Lacunarity = 1.0,
+	float Detail = 2.0,
+	float Offset = 0.0,
+	float Gain = 1.0,
+	float Scale = 5.0,
+	point Vector = P,
+	output float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	float dimension = max(Dimension, 1e-5);
+	float octaves = clamp(Detail, 0.0, 16.0);
+	float lacunarity = max(Lacunarity, 1e-5);
+	string Basis = "Perlin";
+	float intensity = 1.0;
+
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	p = p * Scale;
+
+	if (Type == "Multifractal")
+		Fac = intensity * noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
+	else if (Type == "fBM")
+		Fac = intensity * noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
+	else if (Type == "Hybrid Multifractal")
+		Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+	else if (Type == "Ridged Multifractal")
+		Fac = intensity * noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+	else if (Type == "Hetero Terrain")
+		Fac = intensity * noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
+	
+	Color = color(Fac, Fac, Fac);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_noise_texture.osl b/intern/cycles/kernel/shaders/node_noise_texture.osl
new file mode 100644
index 0000000..0a37949
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_noise_texture.osl
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Noise */
+
+float noise(point p, string basis, float distortion, float detail, float fac, color Color)
+{
+	point r;
+	int hard = 0;
+
+	if (distortion != 0.0) {
+		r[0] = noise_basis(p + point(13.5), basis) * distortion;
+		r[1] = noise_basis(p, basis) * distortion;
+		r[2] = noise_basis(p - point(13.5), basis) * distortion;
+		
+		p += r;
+	}
+
+	fac = noise_turbulence(p, basis, detail, hard);
+	
+	Color = color(fac, noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard),
+		noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard));
+
+	return fac;
+}
+
+shader node_noise_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	float Distortion = 0.0,
+	float Scale = 5.0,
+	float Detail = 2.0,
+	point Vector = P,
+	output float Fac = 0.0,
+	output color Color = color(0.2, 0.2, 0.2))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	string Basis = "Perlin";
+	Fac = noise(p * Scale, Basis, Distortion, Detail, Fac, Color);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_normal.osl b/intern/cycles/kernel/shaders/node_normal.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_normal.osl
rename to intern/cycles/kernel/shaders/node_normal.osl
diff --git a/intern/cycles/kernel/shaders/node_normal_map.osl b/intern/cycles/kernel/shaders/node_normal_map.osl
new file mode 100644
index 0000000..dc25eb8
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_normal_map.osl
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_normal_map(
+	normal NormalIn = N,
+	float Strength = 1.0,
+	color Color = color(0.5, 0.5, 1.0),
+	string space = "Tangent",
+	string attr_name = "geom:tangent",
+	string attr_sign_name = "geom:tangent_sign",
+	output normal Normal = NormalIn)
+{
+	color mcolor = 2.0 * color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5);
+
+	if (space == "Tangent") {
+		vector tangent;
+		float tangent_sign;
+
+		getattribute(attr_name, tangent);
+		getattribute(attr_sign_name, tangent_sign);
+
+		tangent = transform("object", "world", tangent);
+
+		vector B = tangent_sign * cross(NormalIn, tangent);
+		Normal = normalize(mcolor[0] * tangent + mcolor[1] * B + mcolor[2] * NormalIn);
+	}
+	else if (space == "Object")
+		Normal = normalize(transform("object", "world", vector(mcolor)));
+	else if (space == "World")
+		Normal = normalize(vector(mcolor));
+	
+	if (Strength != 1.0)
+		Normal = normalize(NormalIn + (Normal - NormalIn) * max(Strength, 0.0));
+}
+
diff --git a/intern/cycles/kernel/shaders/node_object_info.osl b/intern/cycles/kernel/shaders/node_object_info.osl
new file mode 100644
index 0000000..c3b1ff2
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_object_info.osl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_object_info(
+	output point Location = point(0.0, 0.0, 0.0),
+	output float ObjectIndex = 0.0,
+	output float MaterialIndex = 0.0,
+	output float Random = 0.0)
+{
+	getattribute("object:location", Location);
+	getattribute("object:index", ObjectIndex);
+	getattribute("material:index", MaterialIndex);
+	getattribute("object:random", Random);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_output_displacement.osl b/intern/cycles/kernel/shaders/node_output_displacement.osl
new file mode 100644
index 0000000..5649b87
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_output_displacement.osl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+displacement node_output_displacement(float Displacement = 0.0)
+{
+	P += N * Displacement * 0.1;  /* todo: get rid of this factor */
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_output_surface.osl b/intern/cycles/kernel/shaders/node_output_surface.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_output_surface.osl
rename to intern/cycles/kernel/shaders/node_output_surface.osl
diff --git a/intern/cycles/kernel/osl/nodes/node_output_volume.osl b/intern/cycles/kernel/shaders/node_output_volume.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_output_volume.osl
rename to intern/cycles/kernel/shaders/node_output_volume.osl
diff --git a/intern/cycles/kernel/shaders/node_particle_info.osl b/intern/cycles/kernel/shaders/node_particle_info.osl
new file mode 100644
index 0000000..5e59ad1
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_particle_info.osl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_particle_info(
+    output float Index = 0.0,
+    output float Age = 0.0,
+    output float Lifetime = 0.0,
+    output point Location = point(0.0, 0.0, 0.0),
+    output float Size = 0.0,
+    output vector Velocity = point(0.0, 0.0, 0.0),
+    output vector AngularVelocity = point(0.0, 0.0, 0.0))
+{
+	getattribute("particle:index", Index);
+	getattribute("particle:age", Age);
+	getattribute("particle:lifetime", Lifetime);
+	getattribute("particle:location", Location);
+	getattribute("particle:size", Size);
+	getattribute("particle:velocity", Velocity);
+	getattribute("particle:angular_velocity", AngularVelocity);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_refraction_bsdf.osl b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl
new file mode 100644
index 0000000..0cf9d46
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_refraction_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	string distribution = "Sharp",
+	float Roughness = 0.2,
+	float IOR = 1.45,
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	float f = max(IOR, 1.0 + 1e-5);
+	float eta = backfacing() ? 1.0 / f: f;
+
+	if (distribution == "Sharp")
+		BSDF = Color * refraction(Normal, eta);
+	else if (distribution == "Beckmann")
+		BSDF = Color * microfacet_beckmann_refraction(Normal, Roughness, eta);
+	else if (distribution == "GGX")
+		BSDF = Color * microfacet_ggx_refraction(Normal, Roughness, eta);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_rgb_ramp.osl b/intern/cycles/kernel/shaders/node_rgb_ramp.osl
new file mode 100644
index 0000000..0df11bb
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_rgb_ramp.osl
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "oslutil.h"
+
+shader node_rgb_ramp(
+	color ramp_color[RAMP_TABLE_SIZE] = {0.0},
+	float ramp_alpha[RAMP_TABLE_SIZE] = {0.0},
+
+	float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Alpha = 1.0)
+{
+	float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
+
+	/* clamp int as well in case of NaN */
+	int i = (int)f;
+	if (i < 0) i = 0;
+	if (i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE - 1;
+	float t = f - (float)i;
+
+	Color = ramp_color[i];
+	Alpha = ramp_alpha[i];
+
+	if (t > 0.0) {
+		Color = (1.0 - t) * Color + t * ramp_color[i + 1];
+		Alpha = (1.0 - t) * Alpha + t * ramp_alpha[i + 1];
+	}
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_separate_rgb.osl b/intern/cycles/kernel/shaders/node_separate_rgb.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_separate_rgb.osl
rename to intern/cycles/kernel/shaders/node_separate_rgb.osl
diff --git a/intern/cycles/kernel/shaders/node_set_normal.osl b/intern/cycles/kernel/shaders/node_set_normal.osl
new file mode 100644
index 0000000..27a4b2f
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_set_normal.osl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+surface node_set_normal(
+	normal Direction = N,
+	output normal Normal = N)
+{
+	N = Direction;
+	Normal = Direction;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_sky_texture.osl b/intern/cycles/kernel/shaders/node_sky_texture.osl
new file mode 100644
index 0000000..24a63c7
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_sky_texture.osl
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+struct KernelSunSky {
+	/* sun direction in spherical and cartesian */
+	float theta, phi;
+	vector dir;
+
+	/* perez function parameters */
+	float zenith_Y, zenith_x, zenith_y;
+	float perez_Y[5], perez_x[5], perez_y[5];
+};
+
+color xyY_to_xyz(float x, float y, float Y)
+{
+	float X, Z;
+
+	if (y != 0.0) X = (x / y) * Y;
+	else X = 0.0;
+
+	if (y != 0.0 && Y != 0.0) Z = ((1.0 - x - y) / y) * Y;
+	else Z = 0.0;
+
+	return color(X, Y, Z);
+}
+
+color xyz_to_rgb(float x, float y, float z)
+{
+	return color( 3.240479 * x + -1.537150 * y + -0.498535 * z,
+	             -0.969256 * x +  1.875991 * y +  0.041556 * z,
+	              0.055648 * x + -0.204043 * y +  1.057311 * z);
+}
+
+float sky_angle_between(float thetav, float phiv, float theta, float phi)
+{
+	float cospsi = sin(thetav) * sin(theta) * cos(phi - phiv) + cos(thetav) * cos(theta);
+
+	if (cospsi > 1.0)
+		return 0.0;
+	if (cospsi < -1.0)
+		return M_PI;
+
+	return acos(cospsi);
+}
+
+vector sky_spherical_coordinates(vector dir)
+{
+	return vector(acos(dir[2]), atan2(dir[0], dir[1]), 0);
+}
+
+float sky_perez_function(float lam[5], float theta, float gamma)
+{
+	float ctheta = cos(theta);
+	float cgamma = cos(gamma);
+
+	return (1.0 + lam[0] * exp(lam[1] / ctheta)) * (1.0 + lam[2] * exp(lam[3] * gamma) + lam[4] * cgamma * cgamma);
+}
+
+color sky_xyz_radiance(KernelSunSky sunsky, vector dir)
+{
+	/* convert vector to spherical coordinates */
+	vector spherical = sky_spherical_coordinates(dir);
+	float theta = spherical[0];
+	float phi = spherical[1];
+
+	/* angle between sun direction and dir */
+	float gamma = sky_angle_between(theta, phi, sunsky.theta, sunsky.phi);
+
+	/* clamp theta to horizon */
+	theta = min(theta, M_PI_2 - 0.001);
+
+	/* compute xyY color space values */
+	float x = sunsky.zenith_x * sky_perez_function(sunsky.perez_x, theta, gamma);
+	float y = sunsky.zenith_y * sky_perez_function(sunsky.perez_y, theta, gamma);
+	float Y = sunsky.zenith_Y * sky_perez_function(sunsky.perez_Y, theta, gamma);
+
+	/* convert to RGB */
+	color xyz = xyY_to_xyz(x, y, Y);
+	return xyz_to_rgb(xyz[0], xyz[1], xyz[2]);
+}
+
+void precompute_sunsky(vector dir, float turbidity, output KernelSunSky sunsky)
+{
+	vector spherical = sky_spherical_coordinates(dir);
+	float theta = spherical[0];
+	float phi = spherical[1];
+
+	sunsky.theta = theta;
+	sunsky.phi = phi;
+	sunsky.dir = dir;
+
+	float theta2 = theta * theta;
+	float theta3 = theta * theta * theta;
+	float T = turbidity;
+	float T2 = T * T;
+
+	float chi = (4.0 / 9.0 - T / 120.0) * (M_PI - 2.0 * theta);
+	sunsky.zenith_Y = (4.0453 * T - 4.9710) * tan(chi) - 0.2155 * T + 2.4192;
+	sunsky.zenith_Y *= 0.06;
+
+	sunsky.zenith_x =
+	        ( 0.00166 * theta3 - 0.00375 * theta2 + 0.00209 * theta) * T2 +
+	        (-0.02903 * theta3 + 0.06377 * theta2 - 0.03202 * theta + 0.00394) * T +
+	        ( 0.11693 * theta3 - 0.21196 * theta2 + 0.06052 * theta + 0.25886);
+
+	sunsky.zenith_y =
+	        ( 0.00275 * theta3 - 0.00610 * theta2 + 0.00317 * theta) * T2 +
+	        (-0.04214 * theta3 + 0.08970 * theta2 - 0.04153 * theta + 0.00516) * T +
+	        ( 0.15346 * theta3 - 0.26756 * theta2 + 0.06670 * theta + 0.26688);
+
+	sunsky.perez_Y[0] = ( 0.1787 * T - 1.4630);
+	sunsky.perez_Y[1] = (-0.3554 * T + 0.4275);
+	sunsky.perez_Y[2] = (-0.0227 * T + 5.3251);
+	sunsky.perez_Y[3] = ( 0.1206 * T - 2.5771);
+	sunsky.perez_Y[4] = (-0.0670 * T + 0.3703);
+
+	sunsky.perez_x[0] = (-0.0193 * T - 0.2592);
+	sunsky.perez_x[1] = (-0.0665 * T + 0.0008);
+	sunsky.perez_x[2] = (-0.0004 * T + 0.2125);
+	sunsky.perez_x[3] = (-0.0641 * T - 0.8989);
+	sunsky.perez_x[4] = (-0.0033 * T + 0.0452);
+
+	sunsky.perez_y[0] = (-0.0167 * T - 0.2608);
+	sunsky.perez_y[1] = (-0.0950 * T + 0.0092);
+	sunsky.perez_y[2] = (-0.0079 * T + 0.2102);
+	sunsky.perez_y[3] = (-0.0441 * T - 1.6537);
+	sunsky.perez_y[4] = (-0.0109 * T + 0.0529);
+
+	sunsky.zenith_Y /= sky_perez_function(sunsky.perez_Y, 0, theta);
+	sunsky.zenith_x /= sky_perez_function(sunsky.perez_x, 0, theta);
+	sunsky.zenith_y /= sky_perez_function(sunsky.perez_y, 0, theta);
+}
+
+shader node_sky_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	vector Vector = P,
+	vector sun_direction = vector(0, 0, 1),
+	float turbidity = 2.2,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	vector p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	KernelSunSky sunsky;
+
+	precompute_sunsky(sun_direction, turbidity, sunsky);
+	Color = sky_xyz_radiance(sunsky, p);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_tangent.osl b/intern/cycles/kernel/shaders/node_tangent.osl
new file mode 100644
index 0000000..731af89
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_tangent.osl
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_tangent(
+	normal NormalIn = N,
+	string attr_name = "geom:tangent",
+	string direction_type = "Radial",
+	string axis = "Z",
+	output normal Tangent = normalize(dPdu))
+{
+	vector T;
+
+	if (direction_type == "UV Map") {
+		getattribute(attr_name, T);
+	}
+	else if (direction_type == "Radial") {
+		point generated;
+
+		if (!getattribute("geom:generated", generated))
+			generated = P;
+
+		if (axis == "X")
+			T = vector(0.0, -(generated[2] - 0.5), (generated[1] - 0.5));
+		else if (axis == "Y")
+			T = vector(-(generated[2] - 0.5), 0.0, (generated[0] - 0.5));
+		else
+			T = vector(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0);
+	}
+
+	T = transform("object", "world", T);
+	Tangent = cross(NormalIn, normalize(cross(T, NormalIn)));
+}
+
diff --git a/intern/cycles/kernel/shaders/node_texture.h b/intern/cycles/kernel/shaders/node_texture.h
new file mode 100644
index 0000000..1b3ba82
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_texture.h
@@ -0,0 +1,270 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* Voronoi Distances */
+
+float voronoi_distance(string distance_metric, vector d, float e)
+{
+	float result = 0.0;
+
+	if (distance_metric == "Distance Squared")
+		result = dot(d, d);
+	if (distance_metric == "Actual Distance")
+		result = length(d);
+	if (distance_metric == "Manhattan")
+		result = fabs(d[0]) + fabs(d[1]) + fabs(d[2]);
+	if (distance_metric == "Chebychev")
+		result = max(fabs(d[0]), max(fabs(d[1]), fabs(d[2])));
+	if (distance_metric == "Minkovsky 1/2")
+		result = sqrt(fabs(d[0])) + sqrt(fabs(d[1])) + sqrt(fabs(d[1]));
+	if (distance_metric == "Minkovsky 4")
+		result = sqrt(sqrt(dot(d * d, d * d)));
+	if (distance_metric == "Minkovsky")
+		result = pow(pow(fabs(d[0]), e) + pow(fabs(d[1]), e) + pow(fabs(d[2]), e), 1.0 / e);
+	
+	return result;
+}
+
+/* Voronoi / Worley like */
+
+color cellnoise_color(point p)
+{
+	float r = cellnoise(p);
+	float g = cellnoise(point(p[1], p[0], p[2]));
+	float b = cellnoise(point(p[1], p[2], p[0]));
+
+	return color(r, g, b);
+}
+
+void voronoi(point p, string distance_metric, float e, float da[4], point pa[4])
+{
+	/* returns distances in da and point coords in pa */
+	int xx, yy, zz, xi, yi, zi;
+
+	xi = (int)floor(p[0]);
+	yi = (int)floor(p[1]);
+	zi = (int)floor(p[2]);
+
+	da[0] = 1e10;
+	da[1] = 1e10;
+	da[2] = 1e10;
+	da[3] = 1e10;
+
+	for (xx = xi - 1; xx <= xi + 1; xx++) {
+		for (yy = yi - 1; yy <= yi + 1; yy++) {
+			for (zz = zi - 1; zz <= zi + 1; zz++) {
+				point ip = point(xx, yy, zz);
+				point vp = (point)cellnoise_color(ip);
+				point pd = p - (vp + ip);
+				float d = voronoi_distance(distance_metric, pd, e);
+
+				vp += point(xx, yy, zz);
+
+				if (d < da[0]) {
+					da[3] = da[2];
+					da[2] = da[1];
+					da[1] = da[0];
+					da[0] = d;
+
+					pa[3] = pa[2];
+					pa[2] = pa[1];
+					pa[1] = pa[0];
+					pa[0] = vp;
+				}
+				else if (d < da[1]) {
+					da[3] = da[2];
+					da[2] = da[1];
+					da[1] = d;
+
+					pa[3] = pa[2];
+					pa[2] = pa[1];
+					pa[1] = vp;
+				}
+				else if (d < da[2]) {
+					da[3] = da[2];
+					da[2] = d;
+
+					pa[3] = pa[2];
+					pa[2] = vp;
+				}
+				else if (d < da[3]) {
+					da[3] = d;
+					pa[3] = vp;
+				}
+			}
+		}
+	}
+}
+
+float voronoi_Fn(point p, int n)
+{
+	float da[4];
+	point pa[4];
+
+	voronoi(p, "Distance Squared", 0, da, pa);
+
+	return da[n];
+}
+
+float voronoi_FnFn(point p, int n1, int n2)
+{
+	float da[4];
+	point pa[4];
+
+	voronoi(p, "Distance Squared", 0, da, pa);
+
+	return da[n2] - da[n1];
+}
+
+float voronoi_F1(point p) { return voronoi_Fn(p, 0); }
+float voronoi_F2(point p) { return voronoi_Fn(p, 1); }
+float voronoi_F3(point p) { return voronoi_Fn(p, 2); }
+float voronoi_F4(point p) { return voronoi_Fn(p, 3); }
+float voronoi_F1F2(point p) { return voronoi_FnFn(p, 0, 1); }
+
+float voronoi_Cr(point p)
+{
+	/* crackle type pattern, just a scale/clamp of F2-F1 */
+	float t = 10.0 * voronoi_F1F2(p);
+	return (t > 1.0) ? 1.0 : t;
+}
+
+float voronoi_F1S(point p) { return 2.0 * voronoi_F1(p) - 1.0; }
+float voronoi_F2S(point p) { return 2.0 * voronoi_F2(p) - 1.0; }
+float voronoi_F3S(point p) { return 2.0 * voronoi_F3(p) - 1.0; }
+float voronoi_F4S(point p) { return 2.0 * voronoi_F4(p) - 1.0; }
+float voronoi_F1F2S(point p) { return 2.0 * voronoi_F1F2(p) - 1.0; }
+float voronoi_CrS(point p) { return 2.0 * voronoi_Cr(p) - 1.0; }
+
+/* Noise Bases */
+
+float noise_basis(point p, string basis)
+{
+	float result = 0.0;
+
+	if (basis == "Perlin")
+		result = noise(p); /* returns perlin noise in range 0..1 */
+	if (basis == "Voronoi F1")
+		result = voronoi_F1S(p);
+	if (basis == "Voronoi F2")
+		result = voronoi_F2S(p);
+	if (basis == "Voronoi F3")
+		result = voronoi_F3S(p);
+	if (basis == "Voronoi F4")
+		result = voronoi_F4S(p);
+	if (basis == "Voronoi F2-F1")
+		result = voronoi_F1F2S(p);
+	if (basis == "Voronoi Crackle")
+		result = voronoi_CrS(p);
+	if (basis == "Cell Noise")
+		result = cellnoise(p);
+	
+	return result;
+}
+
+/* Soft/Hard Noise */
+
+float noise_basis_hard(point p, string basis, int hard)
+{
+	float t = noise_basis(p, basis);
+	return (hard) ? fabs(2.0 * t - 1.0) : t;
+}
+
+/* Waves */
+
+float noise_wave(string wave, float a)
+{
+	float result = 0.0;
+
+	if (wave == "Sine") {
+		result = 0.5 + 0.5 * sin(a);
+	}
+	else if (wave == "Saw") {
+		float b = 2 * M_PI;
+		int n = (int)(a / b);
+		a -= n * b;
+		if (a < 0) a += b;
+
+		result = a / b;
+	}
+	else if (wave == "Tri") {
+		float b = 2 * M_PI;
+		float rmax = 1.0;
+
+		result = rmax - 2.0 * fabs(floor((a * (1.0 / b)) + 0.5) - (a * (1.0 / b)));
+	}
+
+	return result;
+}
+
+/* Turbulence */
+
+float noise_turbulence(point p, string basis, float details, int hard)
+{
+	float fscale = 1.0;
+	float amp = 1.0;
+	float sum = 0.0;
+	int i, n;
+	
+	float octaves = clamp(details, 0.0, 16.0);
+	n = (int)octaves;
+
+	for (i = 0; i <= n; i++) {
+		float t = noise_basis(fscale * p, basis);
+
+		if (hard)
+			t = fabs(2.0 * t - 1.0);
+
+		sum += t * amp;
+		amp *= 0.5;
+		fscale *= 2.0;
+	}
+	
+	float rmd = octaves - floor(octaves);
+
+	if (rmd != 0.0) {
+		float t = noise_basis(fscale * p, basis);
+
+		if (hard)
+			t = fabs(2.0 * t - 1.0);
+
+		float sum2 = sum + t*amp;
+
+		sum *= ((float)(1 << n) / (float)((1 << (n + 1)) - 1));
+		sum2 *= ((float)(1 << (n + 1)) / (float)((1 << (n + 2)) - 1));
+
+		return (1.0 - rmd)*sum + rmd*sum2;
+	}
+	else {
+		sum *= ((float)(1 << n) / (float)((1 << (n + 1)) - 1));
+		return sum;
+	}
+}
+
+/* Utility */
+
+float nonzero(float f, float eps)
+{
+	float r;
+
+	if (abs(f) < eps)
+		r = sign(f) * eps;
+	else
+		r = f;
+	
+	return r;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_texture_coordinate.osl b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
new file mode 100644
index 0000000..37460bc
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_texture_coordinate(
+	normal NormalIn = N,
+	int is_background = 0,
+	int from_dupli = 0,
+	string bump_offset = "center",
+
+	output point Generated = point(0.0, 0.0, 0.0),
+	output point UV = point(0.0, 0.0, 0.0),
+	output point Object = point(0.0, 0.0, 0.0),
+	output point Camera = point(0.0, 0.0, 0.0),
+	output point Window = point(0.0, 0.0, 0.0),
+	output normal Normal = normal(0.0, 0.0, 0.0),
+	output point Reflection = point(0.0, 0.0, 0.0))
+{
+	if (is_background) {
+		Generated = P;
+		UV = point(0.0, 0.0, 0.0);
+		Object = P;
+		point Pcam = transform("camera", "world", point(0, 0, 0));
+		Camera = transform("camera", P + Pcam);
+		Window = transform("NDC", P + Pcam);
+		Normal = NormalIn;
+		Reflection = I;
+	}
+	else {
+		if (from_dupli) {
+			getattribute("geom:dupli_generated", Generated); 
+			getattribute("geom:dupli_uv", UV);
+		}
+		else {
+			getattribute("geom:generated", Generated); 
+			getattribute("geom:uv", UV);
+		}
+
+		Object = transform("object", P);
+		Camera = transform("camera", P);
+		Window = transform("NDC", P);
+		Normal = transform("world", "object", NormalIn);
+		Reflection = -reflect(I, NormalIn);
+	}
+
+	if (bump_offset == "dx") {
+		if (!from_dupli) {
+			Generated += Dx(Generated);
+			UV += Dx(UV);
+		}
+		Object += Dx(Object);
+		Camera += Dx(Camera);
+		Window += Dx(Window);
+	}
+	else if (bump_offset == "dy") {
+		if (!from_dupli) {
+			Generated += Dy(Generated);
+			UV += Dy(UV);
+		}
+		Object += Dy(Object);
+		Camera += Dy(Camera);
+		Window += Dy(Window);
+	}
+
+	Window[2] = 0.0;
+}
+
diff --git a/intern/cycles/kernel/shaders/node_translucent_bsdf.osl b/intern/cycles/kernel/shaders/node_translucent_bsdf.osl
new file mode 100644
index 0000000..e7efe73
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_translucent_bsdf.osl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_translucent_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	BSDF = Color * translucent(Normal);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_transparent_bsdf.osl b/intern/cycles/kernel/shaders/node_transparent_bsdf.osl
new file mode 100644
index 0000000..875bce3
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_transparent_bsdf.osl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_transparent_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	BSDF = Color * transparent();
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_value.osl b/intern/cycles/kernel/shaders/node_value.osl
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/node_value.osl
rename to intern/cycles/kernel/shaders/node_value.osl
diff --git a/intern/cycles/kernel/shaders/node_vector_math.osl b/intern/cycles/kernel/shaders/node_vector_math.osl
new file mode 100644
index 0000000..f22a6e8
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_vector_math.osl
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_vector_math(
+	string type = "Add",
+	vector Vector1 = vector(0.0, 0.0, 0.0),
+	vector Vector2 = vector(0.0, 0.0, 0.0),
+	output float Value = 0.0,
+	output vector Vector = vector(0.0, 0.0, 0.0))
+{
+	if (type == "Add") {
+		Vector = Vector1 + Vector2;
+		Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
+	}
+	if (type == "Subtract") {
+		Vector = Vector1 - Vector2;
+		Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
+	}
+	if (type == "Average") {
+		Value = length(Vector1 + Vector2);
+		Vector = normalize(Vector1 + Vector2);
+	}
+	if (type == "Dot Product") {
+		Value = dot(Vector1, Vector2);
+	}
+	if (type == "Cross Product") {
+		vector c = cross(Vector1, Vector2);
+		Value = length(c);
+		Vector = normalize(c);
+	}
+	if (type == "Normalize") {
+		Value = length(Vector1);
+		Vector = normalize(Vector1);
+	}
+}
+
diff --git a/intern/cycles/kernel/shaders/node_velvet_bsdf.osl b/intern/cycles/kernel/shaders/node_velvet_bsdf.osl
new file mode 100644
index 0000000..3aa662b
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_velvet_bsdf.osl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_fresnel.h"
+
+shader node_velvet_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	float Sigma = 0.0,
+	normal Normal = N,
+	output closure color BSDF = diffuse(Normal))
+{
+	float sigma = clamp(Sigma, 0.0, 1.0);
+
+	BSDF = Color * ashikhmin_velvet(Normal, sigma);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_voronoi_texture.osl b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
new file mode 100644
index 0000000..43f8ecc
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Voronoi */
+
+shader node_voronoi_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	string Coloring = "Intensity",
+	float Scale = 5.0,
+	point Vector = P,
+	output float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	/* compute distance and point coordinate of 4 nearest neighbours */
+	float da[4];
+	point pa[4];
+
+	voronoi(p * Scale, "Distance Squared", 1.0, da, pa);
+
+	/* Colored output */
+	if (Coloring == "Intensity") {
+		Fac = fabs(da[0]);
+		Color = color(Fac);
+	}
+	else {
+		Color = cellnoise_color(pa[0]);
+		Fac = (Color[0] + Color[1] + Color[2]) * (1.0 / 3.0);
+
+	}
+}
+
diff --git a/intern/cycles/kernel/shaders/node_ward_bsdf.osl b/intern/cycles/kernel/shaders/node_ward_bsdf.osl
new file mode 100644
index 0000000..82ce15a
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_ward_bsdf.osl
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_ward_bsdf(
+	color Color = color(0.8, 0.8, 0.8),
+	float Roughness = 0.0,
+	float Anisotropy = 0.0,
+	float Rotation = 0.0,
+	normal Normal = N,
+	normal Tangent = normalize(dPdu),
+	output closure color BSDF = diffuse(Normal))
+{
+	/* rotate tangent around normal */
+	vector T = Tangent;
+
+	if (Rotation != 0.0)
+		T = rotate(T, Rotation*2.0*M_PI, point(0.0, 0.0, 0.0), Normal);
+
+	/* compute roughness */
+	float RoughnessU, RoughnessV;
+	float aniso = clamp(Anisotropy, -0.99, 0.99);
+
+	if (aniso < 0.0) {
+		RoughnessU = Roughness / (1.0 + aniso);
+		RoughnessV = Roughness * (1.0 + aniso);
+	}
+	else {
+		RoughnessU = Roughness * (1.0 - aniso);
+		RoughnessV = Roughness / (1.0 - aniso);
+	}
+
+	BSDF = Color * ward(Normal, T, RoughnessU, RoughnessV);
+}
+
diff --git a/intern/cycles/kernel/shaders/node_wave_texture.osl b/intern/cycles/kernel/shaders/node_wave_texture.osl
new file mode 100644
index 0000000..6648cd0
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_wave_texture.osl
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Wave */
+
+float wave(point p, float scale, string type, float detail, float distortion, float dscale)
+{
+	float x = p[0] * scale;
+	float y = p[1] * scale;
+	float z = p[2] * scale;
+
+	float result = 0.0;
+	float n = 0.0;
+
+	if (type == "Bands") {
+		n = (x + y + z) * 10.0;
+	}
+	else if (type == "Rings") {
+		n = (sqrt(x * x + y * y + z * z) * 20.0);
+	}
+
+	if (distortion != 0.0) {
+		n = n + (distortion * noise_turbulence(p * dscale, "Perlin", detail, 0));
+	}
+	result = noise_wave("Sine", n);
+	
+	return result;
+}
+
+shader node_wave_texture(
+	int use_mapping = 0,
+	matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+	string Type = "Bands",
+	float Scale = 5.0,
+	float Distortion = 0.0,
+	float Detail = 2.0,
+	float DetailScale = 1.0,
+	point Vector = P,
+	output float Fac = 0.0,
+	output color Color = color (0.0, 0.0, 0.0))
+{
+	point p = Vector;
+
+	if (use_mapping)
+		p = transform(mapping, p);
+
+	Fac = wave(p, Scale, Type, Detail, Distortion, DetailScale);
+	Color = color(Fac, Fac, Fac);
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/oslutil.h b/intern/cycles/kernel/shaders/oslutil.h
similarity index 100%
rename from intern/cycles/kernel/osl/nodes/oslutil.h
rename to intern/cycles/kernel/shaders/oslutil.h
diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h
new file mode 100644
index 0000000..24c3a50
--- /dev/null
+++ b/intern/cycles/kernel/shaders/stdosl.h
@@ -0,0 +1,476 @@
+/////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.  All Rights Reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+//   notice, this list of conditions and the following disclaimer in the
+//   documentation and/or other materials provided with the distribution.
+// * Neither the name of Sony Pictures Imageworks nor the names of its
+//   contributors may be used to endorse or promote products derived from
+//   this software without specific prior written permission.
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef CCL_STDOSL_H
+#define CCL_STDOSL_H
+
+
+#ifndef M_PI
+#define M_PI       3.1415926535897932        /* pi */
+#define M_PI_2     1.5707963267948966        /* pi/2 */
+#define M_PI_4     0.7853981633974483        /* pi/4 */
+#define M_2_PI     0.6366197723675813        /* 2/pi */
+#define M_2PI      6.2831853071795865        /* 2*pi */
+#define M_4PI     12.566370614359173         /* 4*pi */
+#define M_2_SQRTPI 1.1283791670955126        /* 2/sqrt(pi) */
+#define M_E        2.7182818284590452        /* e (Euler's number) */
+#define M_LN2      0.6931471805599453        /* ln(2) */
+#define M_LN10     2.3025850929940457        /* ln(10) */
+#define M_LOG2E    1.4426950408889634        /* log_2(e) */
+#define M_LOG10E   0.4342944819032518        /* log_10(e) */
+#define M_SQRT2    1.4142135623730950        /* sqrt(2) */
+#define M_SQRT1_2  0.7071067811865475        /* 1/sqrt(2) */
+#endif
+
+
+
+// Declaration of built-in functions and closures
+#define BUILTIN [[ int builtin = 1 ]]
+#define BUILTIN_DERIV [[ int builtin = 1, int deriv = 1 ]]
+
+#define PERCOMP1(name)                          \
+    normal name (normal x) BUILTIN;             \
+    vector name (vector x) BUILTIN;             \
+    point  name (point x) BUILTIN;              \
+    color  name (color x) BUILTIN;              \
+    float  name (float x) BUILTIN;
+
+#define PERCOMP2(name)                          \
+    normal name (normal x, normal y) BUILTIN;   \
+    vector name (vector x, vector y) BUILTIN;   \
+    point  name (point x, point y) BUILTIN;     \
+    color  name (color x, color y) BUILTIN;     \
+    float  name (float x, float y) BUILTIN;
+
+#define PERCOMP2F(name)                         \
+    normal name (normal x, float y) BUILTIN;    \
+    vector name (vector x, float y) BUILTIN;    \
+    point  name (point x, float y) BUILTIN;     \
+    color  name (color x, float y) BUILTIN;     \
+    float  name (float x, float y) BUILTIN;
+
+
+// Basic math
+normal degrees (normal x) { return x*(180.0/M_PI); }
+vector degrees (vector x) { return x*(180.0/M_PI); }
+point  degrees (point x)  { return x*(180.0/M_PI); }
+color  degrees (color x)  { return x*(180.0/M_PI); }
+float  degrees (float x)  { return x*(180.0/M_PI); }
+normal radians (normal x) { return x*(M_PI/180.0); }
+vector radians (vector x) { return x*(M_PI/180.0); }
+point  radians (point x)  { return x*(M_PI/180.0); }
+color  radians (color x)  { return x*(M_PI/180.0); }
+float  radians (float x)  { return x*(M_PI/180.0); }
+PERCOMP1 (cos)
+PERCOMP1 (sin)
+PERCOMP1 (tan)
+PERCOMP1 (acos)
+PERCOMP1 (asin)
+PERCOMP1 (atan)
+PERCOMP2 (atan2)
+PERCOMP1 (cosh)
+PERCOMP1 (sinh)
+PERCOMP1 (tanh)
+PERCOMP2F (pow)
+PERCOMP1 (exp)
+PERCOMP1 (exp2)
+PERCOMP1 (expm1)
+PERCOMP1 (log)
+point  log (point a,  float b) { return log(a)/log(b); }
+vector log (vector a, float b) { return log(a)/log(b); }
+color  log (color a,  float b) { return log(a)/log(b); }
+float  log (float a,  float b) { return log(a)/log(b); }
+PERCOMP1 (log2)
+PERCOMP1 (log10)
+PERCOMP1 (logb)
+PERCOMP1 (sqrt)
+PERCOMP1 (inversesqrt)
+float hypot (float a, float b) { return sqrt (a*a + b*b); }
+float hypot (float a, float b, float c) { return sqrt (a*a + b*b + c*c); }
+PERCOMP1 (abs)
+int abs (int x) BUILTIN;
+PERCOMP1 (fabs)
+int fabs (int x) BUILTIN;
+PERCOMP1 (sign)
+PERCOMP1 (floor)
+PERCOMP1 (ceil)
+PERCOMP1 (round)
+PERCOMP1 (trunc)
+PERCOMP2 (fmod)
+PERCOMP2F (fmod)
+int    mod (int    a, int    b) { return a - b*(int)floor(a/b); }
+point  mod (point  a, point  b) { return a - b*floor(a/b); }
+vector mod (vector a, vector b) { return a - b*floor(a/b); }
+normal mod (normal a, normal b) { return a - b*floor(a/b); }
+color  mod (color  a, color  b) { return a - b*floor(a/b); }
+point  mod (point  a, float  b) { return a - b*floor(a/b); }
+vector mod (vector a, float  b) { return a - b*floor(a/b); }
+normal mod (normal a, float  b) { return a - b*floor(a/b); }
+color  mod (color  a, float  b) { return a - b*floor(a/b); }
+float  mod (float  a, float  b) { return a - b*floor(a/b); }
+PERCOMP2 (min)
+PERCOMP2 (max)
+normal clamp (normal x, normal minval, normal maxval) { return max(min(x,maxval),minval); }
+vector clamp (vector x, vector minval, vector maxval) { return max(min(x,maxval),minval); }
+point  clamp (point x, point minval, point maxval) { return max(min(x,maxval),minval); }
+color  clamp (color x, color minval, color maxval) { return max(min(x,maxval),minval); }
+float  clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); }
+normal mix (normal x, normal y, normal a) { return x*(1-a) + y*a; }
+normal mix (normal x, normal y, float  a) { return x*(1-a) + y*a; }
+vector mix (vector x, vector y, vector a) { return x*(1-a) + y*a; }
+vector mix (vector x, vector y, float  a) { return x*(1-a) + y*a; }
+point  mix (point  x, point  y, point  a) { return x*(1-a) + y*a; }
+point  mix (point  x, point  y, float  a) { return x*(1-a) + y*a; }
+color  mix (color  x, color  y, color  a) { return x*(1-a) + y*a; }
+color  mix (color  x, color  y, float  a) { return x*(1-a) + y*a; }
+float  mix (float  x, float  y, float  a) { return x*(1-a) + y*a; }
+int isnan (float x) BUILTIN;
+int isinf (float x) BUILTIN;
+int isfinite (float x) BUILTIN;
+float erf (float x) BUILTIN;
+float erfc (float x) BUILTIN;
+
+// Vector functions
+
+vector cross (vector a, vector b) BUILTIN;
+float dot (vector a, vector b) BUILTIN;
+float length (vector v) BUILTIN;
+float distance (point a, point b) BUILTIN;
+float distance (point a, point b, point q) BUILTIN;
+normal normalize (normal v) BUILTIN;
+vector normalize (vector v) BUILTIN;
+vector faceforward (vector N, vector I, vector Nref) BUILTIN;
+vector faceforward (vector N, vector I) BUILTIN;
+vector reflect (vector I, vector N) { return I - 2*dot(N,I)*N; }
+vector refract (vector I, vector N, float eta) {
+    float IdotN = dot (I, N);
+    float k = 1 - eta*eta * (1 - IdotN*IdotN);
+    return (k < 0) ? vector(0,0,0) : (eta*I - N * (eta*IdotN + sqrt(k)));
+}
+void fresnel (vector I, normal N, float eta,
+              output float Kr, output float Kt,
+              output vector R, output vector T)
+{
+    float sqr(float x) { return x*x; }
+    float c = dot(I, N);
+    if (c < 0)
+        c = -c;
+    R = reflect(I, N);
+    float g = 1.0 / sqr(eta) - 1.0 + c * c;
+    if (g >= 0.0) {
+        g = sqrt (g);
+        float beta = g - c;
+        float F = (c * (g+c) - 1.0) / (c * beta + 1.0);
+        F = 0.5 * (1.0 + sqr(F));
+        F *= sqr (beta / (g+c));
+        Kr = F;
+        Kt = (1.0 - Kr) * eta*eta;
+        // OPT: the following recomputes some of the above values, but it 
+        // gives us the same result as if the shader-writer called refract()
+        T = refract(I, N, eta);
+    } else {
+        // total internal reflection
+        Kr = 1.0;
+        Kt = 0.0;
+        T = vector (0,0,0);
+    }
+}
+
+void fresnel (vector I, normal N, float eta,
+              output float Kr, output float Kt)
+{
+    vector R, T;
+    fresnel(I, N, eta, Kr, Kt, R, T);
+}
+
+
+normal transform (matrix Mto, normal p) BUILTIN;
+vector transform (matrix Mto, vector p) BUILTIN;
+point  transform (matrix Mto, point p) BUILTIN;
+normal transform (string from, string to, normal p) BUILTIN;
+vector transform (string from, string to, vector p) BUILTIN;
+point  transform (string from, string to, point p) BUILTIN;
+normal transform (string to, normal p) { return transform("common",to,p); }
+vector transform (string to, vector p) { return transform("common",to,p); }
+point  transform (string to, point p)  { return transform("common",to,p); }
+
+float transformu (string tounits, float x) BUILTIN;
+float transformu (string fromunits, string tounits, float x) BUILTIN;
+
+point rotate (point p, float angle, point a, point b)
+{
+    vector axis = normalize (b - a);
+    float cosang, sinang;
+    sincos (angle, sinang, cosang);
+    float cosang1 = 1.0 - cosang;
+    float x = axis[0], y = axis[1], z = axis[2];
+    matrix M = matrix (x * x + (1.0 - x * x) * cosang,
+                       x * y * cosang1 + z * sinang,
+                       x * z * cosang1 - y * sinang,
+                       0.0,
+                       x * y * cosang1 - z * sinang,
+                       y * y + (1.0 - y * y) * cosang,
+                       y * z * cosang1 + x * sinang,
+                       0.0,
+                       x * z * cosang1 + y * sinang,
+                       y * z * cosang1 - x * sinang,
+                       z * z + (1.0 - z * z) * cosang,
+                       0.0,
+                       0.0, 0.0, 0.0, 1.0);
+    return transform (M, p-a) + a;
+}
+
+
+
+// Color functions
+
+float luminance (color c) BUILTIN;
+color blackbody (float temperatureK) BUILTIN;
+color wavelength_color (float wavelength_nm) BUILTIN;
+
+
+color transformc (string to, color x)
+{
+    color rgb_to_hsv (color rgb) {  // See Foley & van Dam
+        float r = rgb[0], g = rgb[1], b = rgb[2];
+        float mincomp = min (r, min (g, b));
+        float maxcomp = max (r, max (g, b));
+        float delta = maxcomp - mincomp;  // chroma
+        float h, s, v;
+        v = maxcomp;
+        if (maxcomp > 0)
+            s = delta / maxcomp;
+        else s = 0;
+        if (s <= 0)
+            h = 0;
+        else {
+            if      (r >= maxcomp) h = (g-b) / delta;
+            else if (g >= maxcomp) h = 2 + (b-r) / delta;
+            else                   h = 4 + (r-g) / delta;
+            h /= 6;
+            if (h < 0)
+                h += 1;
+        }
+        return color (h, s, v);
+    }
+
+    color rgb_to_hsl (color rgb) {  // See Foley & van Dam
+        // First convert rgb to hsv, then to hsl
+        float minval = min (rgb[0], min (rgb[1], rgb[2]));
+        color hsv = rgb_to_hsv (rgb);
+        float maxval = hsv[2];   // v == maxval
+        float h = hsv[0], s, l = (minval+maxval) / 2;
+        if (minval == maxval)
+            s = 0;  // special 'achromatic' case, hue is 0
+        else if (l <= 0.5)
+            s = (maxval - minval) / (maxval + minval);
+        else
+            s = (maxval - minval) / (2 - maxval - minval);
+        return color (h, s, l);
+    }
+
+    color r;
+    if (to == "rgb" || to == "RGB")
+        r = x;
+    else if (to == "hsv")
+        r = rgb_to_hsv (x);
+    else if (to == "hsl")
+        r = rgb_to_hsl (x);
+    else if (to == "YIQ")
+        r = color (dot (vector(0.299,  0.587,  0.114), (vector)x),
+                   dot (vector(0.596, -0.275, -0.321), (vector)x),
+                   dot (vector(0.212, -0.523,  0.311), (vector)x));
+    else if (to == "xyz")
+        r = color (dot (vector(0.412453, 0.357580, 0.180423), (vector)x),
+                   dot (vector(0.212671, 0.715160, 0.072169), (vector)x),
+                   dot (vector(0.019334, 0.119193, 0.950227), (vector)x));
+    else {
+        error ("Unknown color space \"%s\"", to);
+        r = x;
+    }
+    return r;
+}
+
+
+color transformc (string from, string to, color x)
+{
+    color hsv_to_rgb (color c) { // Reference: Foley & van Dam
+        float h = c[0], s = c[1], v = c[2];
+        color r;
+        if (s < 0.0001) {
+            r = v;
+        } else {
+            h = 6 * (h - floor(h));  // expand to [0..6)
+            int hi = (int)h;
+            float f = h - hi;
+            float p = v * (1-s);
+            float q = v * (1-s*f);
+            float t = v * (1-s*(1-f));
+            if      (hi == 0) r = color (v, t, p);
+            else if (hi == 1) r = color (q, v, p);
+            else if (hi == 2) r = color (p, v, t);
+            else if (hi == 3) r = color (p, q, v);
+            else if (hi == 4) r = color (t, p, v);
+            else              r = color (v, p, q);
+        }
+        return r;
+    }
+
+    color hsl_to_rgb (color c) {
+        float h = c[0], s = c[1], l = c[2];
+        // Easiest to convert hsl -> hsv, then hsv -> RGB (per Foley & van Dam)
+        float v = (l <= 0.5) ? (l * (1 + s)) : (l * (1 - s) + s);
+        color r;
+        if (v <= 0) {
+            r = 0;
+        } else {
+            float min = 2 * l - v;
+            s = (v - min) / v;
+            r = hsv_to_rgb (color (h, s, v));
+        }
+        return r;
+    }
+
+    color r;
+    if (from == "rgb" || from == "RGB")
+        r = x;
+    else if (from == "hsv")
+        r = hsv_to_rgb (x);
+    else if (from == "hsl")
+        r = hsl_to_rgb (x);
+    else if (from == "YIQ")
+        r = color (dot (vector(1,  0.9557,  0.6199), (vector)x),
+                   dot (vector(1, -0.2716, -0.6469), (vector)x),
+                   dot (vector(1, -1.1082,  1.7051), (vector)x));
+    else if (from == "xyz")
+        r = color (dot (vector( 3.240479, -1.537150, -0.498535), (vector)x),
+                   dot (vector(-0.969256,  1.875991,  0.041556), (vector)x),
+                   dot (vector( 0.055648, -0.204043,  1.057311), (vector)x));
+    else {
+        error ("Unknown color space \"%s\"", to);
+        r = x;
+    }
+    return transformc (to, r);
+}
+
+ 
+
+// Matrix functions
+
+float determinant (matrix m) BUILTIN;
+matrix transpose (matrix m) BUILTIN;
+
+
+
+// Pattern generation
+
+float step (float edge, float x) BUILTIN;
+color step (color edge, color x) BUILTIN;
+point step (point edge, point x) BUILTIN;
+vector step (vector edge, vector x) BUILTIN;
+normal step (normal edge, normal x) BUILTIN;
+float smoothstep (float edge0, float edge1, float x) BUILTIN;
+
+
+// Derivatives and area operators
+
+
+// Displacement functions
+
+
+// String functions
+
+int strlen (string s) BUILTIN;
+int startswith (string s, string prefix) BUILTIN;
+int endswith (string s, string suffix) BUILTIN;
+string substr (string s, int start, int len) BUILTIN;
+string substr (string s, int start) { return substr (s, start, strlen(s)); }
+
+// Define concat in terms of shorter concat
+string concat (string a, string b, string c) {
+    return concat(concat(a,b), c);
+}
+string concat (string a, string b, string c, string d) {
+    return concat(concat(a,b,c), d);
+}
+string concat (string a, string b, string c, string d, string e) {
+    return concat(concat(a,b,c,d), e);
+}
+string concat (string a, string b, string c, string d, string e, string f) {
+    return concat(concat(a,b,c,d,e), f);
+}
+
+
+// Texture
+
+
+// Closures
+
+closure color diffuse(normal N) BUILTIN;
+closure color oren_nayar(normal N, float sigma) BUILTIN;
+closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN;
+closure color translucent(normal N) BUILTIN;
+closure color reflection(normal N) BUILTIN;
+closure color refraction(normal N, float eta) BUILTIN;
+closure color transparent() BUILTIN;
+closure color microfacet_ggx(normal N, float ag) BUILTIN;
+closure color microfacet_ggx_refraction(normal N, float ag, float eta) BUILTIN;
+closure color microfacet_beckmann(normal N, float ab) BUILTIN;
+closure color microfacet_beckmann_refraction(normal N, float ab, float eta) BUILTIN;
+closure color ward(normal N, vector T,float ax, float ay) BUILTIN;
+closure color ashikhmin_velvet(normal N, float sigma) BUILTIN;
+closure color emission() BUILTIN;
+closure color background() BUILTIN;
+closure color holdout() BUILTIN;
+closure color ambient_occlusion() BUILTIN;
+
+// Renderer state
+int raytype (string typename) BUILTIN;
+// the individual 'isFOOray' functions are deprecated
+int iscameraray () { return raytype("camera"); }
+int isdiffuseray () { return raytype("diffuse"); }
+int isglossyray () { return raytype("glossy"); }
+int isshadowray () { return raytype("shadow"); }
+int getmatrix (string fromspace, string tospace, output matrix M) BUILTIN;
+int getmatrix (string fromspace, output matrix M) {
+    return getmatrix (fromspace, "common", M);
+}
+
+
+// Miscellaneous
+
+
+
+
+#undef BUILTIN
+#undef BUILTIN_DERIV
+#undef PERCOMP1
+#undef PERCOMP2
+#undef PERCOMP2F
+
+#endif /* CCL_STDOSL_H */
diff --git a/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h
deleted file mode 100644
index 40249db..0000000
--- a/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_ASHIKHMIN_VELVET_H__
-#define __BSDF_ASHIKHMIN_VELVET_H__
-
-CCL_NAMESPACE_BEGIN
-
-typedef struct BsdfAshikhminVelvetClosure {
-	//float3 m_N;
-	float m_invsigma2;
-} BsdfAshikhminVelvetClosure;
-
-__device void bsdf_ashikhmin_velvet_setup(ShaderData *sd, ShaderClosure *sc, float sigma)
-{
-	sigma = fmaxf(sigma, 0.01f);
-
-	float m_invsigma2 = 1.0f/(sigma * sigma);
-
-	sc->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL;
-	sc->data0 = m_invsigma2;
-}
-
-__device void bsdf_ashikhmin_velvet_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_invsigma2 = sc->data0;
-	float3 m_N = sd->N;
-
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO > 0 && cosNI > 0) {
-		float3 H = normalize(omega_in + I);
-
-		float cosNH = dot(m_N, H);
-		float cosHO = fabsf(dot(I, H));
-
-		if(!(fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f))
-			return make_float3(0, 0, 0);
-
-		float cosNHdivHO = cosNH / cosHO;
-		cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
-
-		float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
-		float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
-
-		float sinNH2 = 1 - cosNH * cosNH;
-		float sinNH4 = sinNH2 * sinNH2;
-		float cotangent2 = (cosNH * cosNH) / sinNH2;
-
-		float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
-		float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
-
-		float out = 0.25f * (D * G) / cosNO;
-
-		*pdf = 0.5f * M_1_PI_F;
-		return make_float3(out, out, out);
-	}
-
-	return make_float3(0, 0, 0);
-}
-
-__device float3 bsdf_ashikhmin_velvet_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_ashikhmin_velvet_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_ashikhmin_velvet_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_invsigma2 = sc->data0;
-	float3 m_N = sd->N;
-
-	// we are viewing the surface from above - send a ray out with uniform
-	// distribution over the hemisphere
-	sample_uniform_hemisphere(m_N, randu, randv, omega_in, pdf);
-
-	if(dot(sd->Ng, *omega_in) > 0) {
-		float3 H = normalize(*omega_in + sd->I);
-
-		float cosNI = dot(m_N, *omega_in);
-		float cosNO = dot(m_N, sd->I);
-		float cosNH = dot(m_N, H);
-		float cosHO = fabsf(dot(sd->I, H));
-
-		if(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f) {
-			float cosNHdivHO = cosNH / cosHO;
-			cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
-
-			float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
-			float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
-
-			float sinNH2 = 1 - cosNH * cosNH;
-			float sinNH4 = sinNH2 * sinNH2;
-			float cotangent2 =  (cosNH * cosNH) / sinNH2;
-
-			float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
-			float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
-
-			float power = 0.25f * (D * G) / cosNO;
-
-			*eval = make_float3(power, power, power);
-
-#ifdef __RAY_DIFFERENTIALS__
-			// TODO: find a better approximation for the retroreflective bounce
-			*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
-			*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
-			*domega_in_dx *= 125.0f;
-			*domega_in_dy *= 125.0f;
-#endif
-		}
-		else
-			*pdf = 0.0f;
-	}
-	else
-		*pdf = 0.0f;
-
-	return LABEL_REFLECT|LABEL_DIFFUSE;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_diffuse.h b/intern/cycles/kernel/svm/bsdf_diffuse.h
deleted file mode 100644
index edf8dd9..0000000
--- a/intern/cycles/kernel/svm/bsdf_diffuse.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_DIFFUSE_H__
-#define __BSDF_DIFFUSE_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* DIFFUSE */
-
-typedef struct BsdfDiffuseClosure {
-	//float3 m_N;
-} BsdfDiffuseClosure;
-
-__device void bsdf_diffuse_setup(ShaderData *sd, ShaderClosure *sc)
-{
-	sc->type = CLOSURE_BSDF_DIFFUSE_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL;
-}
-
-__device void bsdf_diffuse_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_diffuse_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float3 m_N = sd->N;
-
-	float cos_pi = fmaxf(dot(m_N, omega_in), 0.0f) * M_1_PI_F;
-	*pdf = cos_pi;
-	return make_float3(cos_pi, cos_pi, cos_pi);
-}
-
-__device float3 bsdf_diffuse_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_diffuse_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_diffuse_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float3 m_N = sd->N;
-
-	// distribution over the hemisphere
-	sample_cos_hemisphere(m_N, randu, randv, omega_in, pdf);
-
-	if(dot(sd->Ng, *omega_in) > 0.0f) {
-		*eval = make_float3(*pdf, *pdf, *pdf);
-#ifdef __RAY_DIFFERENTIALS__
-		// TODO: find a better approximation for the diffuse bounce
-		*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
-		*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
-		*domega_in_dx *= 125.0f;
-		*domega_in_dy *= 125.0f;
-#endif
-	}
-	else
-		*pdf = 0.0f;
-	
-	return LABEL_REFLECT|LABEL_DIFFUSE;
-}
-
-/* TRANSLUCENT */
-
-typedef struct BsdfTranslucentClosure {
-	//float3 m_N;
-} BsdfTranslucentClosure;
-
-__device void bsdf_translucent_setup(ShaderData *sd, ShaderClosure *sc)
-{
-	sc->type = CLOSURE_BSDF_TRANSLUCENT_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL;
-}
-
-__device void bsdf_translucent_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_translucent_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float3 bsdf_translucent_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float3 m_N = sd->N;
-
-	float cos_pi = fmaxf(-dot(m_N, omega_in), 0.0f) * M_1_PI_F;
-	*pdf = cos_pi;
-	return make_float3 (cos_pi, cos_pi, cos_pi);
-}
-
-__device float bsdf_translucent_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_translucent_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float3 m_N = sd->N;
-
-	// we are viewing the surface from the right side - send a ray out with cosine
-	// distribution over the hemisphere
-	sample_cos_hemisphere (-m_N, randu, randv, omega_in, pdf);
-	if(dot(sd->Ng, *omega_in) < 0) {
-		*eval = make_float3(*pdf, *pdf, *pdf);
-#ifdef __RAY_DIFFERENTIALS__
-		// TODO: find a better approximation for the diffuse bounce
-		*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
-		*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
-		*domega_in_dx *= -125.0f;
-		*domega_in_dy *= -125.0f;
-#endif
-	}
-	else {
-		*pdf = 0;
-	}
-	return LABEL_TRANSMIT|LABEL_DIFFUSE;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_DIFFUSE_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_microfacet.h b/intern/cycles/kernel/svm/bsdf_microfacet.h
deleted file mode 100644
index d8f0310..0000000
--- a/intern/cycles/kernel/svm/bsdf_microfacet.h
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_MICROFACET_H__
-#define __BSDF_MICROFACET_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* GGX */
-
-typedef struct BsdfMicrofacetGGXClosure {
-	//float3 m_N;
-	float m_ag;
-	float m_eta;
-} BsdfMicrofacetGGXClosure;
-
-__device_inline float safe_sqrtf(float f)
-{
-	return sqrtf(max(f, 0.0f));
-}
-
-__device void bsdf_microfacet_ggx_setup(ShaderData *sd, ShaderClosure *sc, float ag, float eta, bool refractive)
-{
-	float m_ag = clamp(ag, 1e-4f, 1.0f);
-	float m_eta = eta;
-
-	sc->data0 = m_ag;
-	sc->data1 = m_eta;
-
-	if(refractive)
-		sc->type = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
-	else
-		sc->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
-
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
-}
-
-__device void bsdf_microfacet_ggx_blur(ShaderClosure *sc, float roughness)
-{
-	float m_ag = sc->data0;
-	m_ag = fmaxf(roughness, m_ag);
-	sc->data0 = m_ag;
-}
-
-__device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_ag = sc->data0;
-	//float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	if(m_refractive) return make_float3 (0, 0, 0);
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNI > 0 && cosNO > 0) {
-		// get half vector
-		float3 Hr = normalize(omega_in + I);
-		// eq. 20: (F*G*D)/(4*in*on)
-		// eq. 33: first we calculate D(m) with m=Hr:
-		float alpha2 = m_ag * m_ag;
-		float cosThetaM = dot(m_N, Hr);
-		float cosThetaM2 = cosThetaM * cosThetaM;
-		float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-		float cosThetaM4 = cosThetaM2 * cosThetaM2;
-		float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-		// eq. 34: now calculate G1(i,m) and G1(o,m)
-		float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-		float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-		float G = G1o * G1i;
-		float out = (G * D) * 0.25f / cosNO;
-		// eq. 24
-		float pm = D * cosThetaM;
-		// convert into pdf of the sampled direction
-		// eq. 38 - but see also:
-		// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-		*pdf = pm * 0.25f / dot(Hr, I);
-		return make_float3 (out, out, out);
-	}
-	return make_float3 (0, 0, 0);
-}
-
-__device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_ag = sc->data0;
-	float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	if(!m_refractive) return make_float3 (0, 0, 0);
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO <= 0 || cosNI >= 0)
-		return make_float3 (0, 0, 0); // vectors on same side -- not possible
-	// compute half-vector of the refraction (eq. 16)
-	float3 ht = -(m_eta * omega_in + I);
-	float3 Ht = normalize(ht);
-	float cosHO = dot(Ht, I);
-
-	float cosHI = dot(Ht, omega_in);
-	// eq. 33: first we calculate D(m) with m=Ht:
-	float alpha2 = m_ag * m_ag;
-	float cosThetaM = dot(m_N, Ht);
-	float cosThetaM2 = cosThetaM * cosThetaM;
-	float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-	float cosThetaM4 = cosThetaM2 * cosThetaM2;
-	float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-	// eq. 34: now calculate G1(i,m) and G1(o,m)
-	float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-	float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-	float G = G1o * G1i;
-	// probability
-	float invHt2 = 1 / dot(ht, ht);
-	*pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
-	float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
-	return make_float3 (out, out, out);
-}
-
-__device float bsdf_microfacet_ggx_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_microfacet_ggx_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_ag = sc->data0;
-	float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	float cosNO = dot(m_N, sd->I);
-	if(cosNO > 0) {
-		float3 X, Y, Z = m_N;
-		make_orthonormals(Z, &X, &Y);
-		// generate a random microfacet normal m
-		// eq. 35,36:
-		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
-		float alpha2 = m_ag * m_ag;
-		float tanThetaM2 = alpha2 * randu / (1 - randu);
-		float cosThetaM  = 1 / safe_sqrtf(1 + tanThetaM2);
-		float sinThetaM  = cosThetaM * safe_sqrtf(tanThetaM2);
-		float phiM = 2 * M_PI_F * randv;
-		float3 m = (cosf(phiM) * sinThetaM) * X +
-				 (sinf(phiM) * sinThetaM) * Y +
-							   cosThetaM  * Z;
-		if(!m_refractive) {
-			float cosMO = dot(m, sd->I);
-			if(cosMO > 0) {
-				// eq. 39 - compute actual reflected direction
-				*omega_in = 2 * cosMO * m - sd->I;
-				if(dot(sd->Ng, *omega_in) > 0) {
-					// microfacet normal is visible to this ray
-					// eq. 33
-					float cosThetaM2 = cosThetaM * cosThetaM;
-					float cosThetaM4 = cosThetaM2 * cosThetaM2;
-					float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-					// eq. 24
-					float pm = D * cosThetaM;
-					// convert into pdf of the sampled direction
-					// eq. 38 - but see also:
-					// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-					*pdf = pm * 0.25f / cosMO;
-					// eval BRDF*cosNI
-					float cosNI = dot(m_N, *omega_in);
-					// eq. 34: now calculate G1(i,m) and G1(o,m)
-					float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-					float G = G1o * G1i;
-					// eq. 20: (F*G*D)/(4*in*on)
-					float out = (G * D) * 0.25f / cosNO;
-					*eval = make_float3(out, out, out);
-#ifdef __RAY_DIFFERENTIALS__
-					*domega_in_dx = (2 * dot(m, sd->dI.dx)) * m - sd->dI.dx;
-					*domega_in_dy = (2 * dot(m, sd->dI.dy)) * m - sd->dI.dy;
-					// Since there is some blur to this reflection, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// roughness but the exact relationship is complex and
-					// requires more ops than are practical.
-					*domega_in_dx *= 10.0f;
-					*domega_in_dy *= 10.0f;
-#endif
-				}
-			}
-		}
-		else {
-			// CAUTION: the i and o variables are inverted relative to the paper
-			// eq. 39 - compute actual refractive direction
-			float3 R, T;
-#ifdef __RAY_DIFFERENTIALS__
-			float3 dRdx, dRdy, dTdx, dTdy;
-#endif
-			bool inside;
-			fresnel_dielectric(m_eta, m, sd->I, &R, &T,
-#ifdef __RAY_DIFFERENTIALS__
-				sd->dI.dx, sd->dI.dy, &dRdx, &dRdy, &dTdx, &dTdy,
-#endif
-				&inside);
-			
-			if(!inside) {
-				*omega_in = T;
-#ifdef __RAY_DIFFERENTIALS__
-				*domega_in_dx = dTdx;
-				*domega_in_dy = dTdy;
-#endif
-				// eq. 33
-				float cosThetaM2 = cosThetaM * cosThetaM;
-				float cosThetaM4 = cosThetaM2 * cosThetaM2;
-				float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-				// eq. 24
-				float pm = D * cosThetaM;
-				// eval BRDF*cosNI
-				float cosNI = dot(m_N, *omega_in);
-				// eq. 34: now calculate G1(i,m) and G1(o,m)
-				float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-				float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-				float G = G1o * G1i;
-				// eq. 21
-				float cosHI = dot(m, *omega_in);
-				float cosHO = dot(m, sd->I);
-				float Ht2 = m_eta * cosHI + cosHO;
-				Ht2 *= Ht2;
-				float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
-				// eq. 38 and eq. 17
-				*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
-				*eval = make_float3(out, out, out);
-#ifdef __RAY_DIFFERENTIALS__
-				// Since there is some blur to this refraction, make the
-				// derivatives a bit bigger. In theory this varies with the
-				// roughness but the exact relationship is complex and
-				// requires more ops than are practical.
-				*domega_in_dx *= 10.0f;
-				*domega_in_dy *= 10.0f;
-#endif
-			}
-		}
-	}
-	return (m_refractive) ? LABEL_TRANSMIT|LABEL_GLOSSY : LABEL_REFLECT|LABEL_GLOSSY;
-}
-
-/* BECKMANN */
-
-typedef struct BsdfMicrofacetBeckmannClosure {
-	//float3 m_N;
-	float m_ab;
-	float m_eta;
-} BsdfMicrofacetBeckmannClosure;
-
-__device void bsdf_microfacet_beckmann_setup(ShaderData *sd, ShaderClosure *sc, float ab, float eta, bool refractive)
-{
-	float m_ab = clamp(ab, 1e-4f, 1.0f);
-	float m_eta = eta;
-
-	sc->data0 = m_ab;
-	sc->data1 = m_eta;
-
-	if(refractive)
-		sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
-	else
-		sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
-
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
-}
-
-__device void bsdf_microfacet_beckmann_blur(ShaderClosure *sc, float roughness)
-{
-	float m_ab = sc->data0;
-	m_ab = fmaxf(roughness, m_ab);
-	sc->data0 = m_ab;
-}
-
-__device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_ab = sc->data0;
-	//float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	if(m_refractive) return make_float3 (0, 0, 0);
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO > 0 && cosNI > 0) {
-	   // get half vector
-	   float3 Hr = normalize(omega_in + I);
-	   // eq. 20: (F*G*D)/(4*in*on)
-	   // eq. 25: first we calculate D(m) with m=Hr:
-	   float alpha2 = m_ab * m_ab;
-	   float cosThetaM = dot(m_N, Hr);
-	   float cosThetaM2 = cosThetaM * cosThetaM;
-	   float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-	   float cosThetaM4 = cosThetaM2 * cosThetaM2;
-	   float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
-	   // eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-	   float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-	   float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-	   float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-	   float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-	   float G = G1o * G1i;
-	   float out = (G * D) * 0.25f / cosNO;
-	   // eq. 24
-	   float pm = D * cosThetaM;
-	   // convert into pdf of the sampled direction
-	   // eq. 38 - but see also:
-	   // eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-	   *pdf = pm * 0.25f / dot(Hr, I);
-	   return make_float3 (out, out, out);
-	}
-	return make_float3 (0, 0, 0);
-}
-
-__device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_ab = sc->data0;
-	float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	if(!m_refractive) return make_float3 (0, 0, 0);
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO <= 0 || cosNI >= 0)
-		return make_float3 (0, 0, 0);
-	// compute half-vector of the refraction (eq. 16)
-	float3 ht = -(m_eta * omega_in + I);
-	float3 Ht = normalize(ht);
-	float cosHO = dot(Ht, I);
-
-	float cosHI = dot(Ht, omega_in);
-	// eq. 33: first we calculate D(m) with m=Ht:
-	float alpha2 = m_ab * m_ab;
-	float cosThetaM = dot(m_N, Ht);
-	float cosThetaM2 = cosThetaM * cosThetaM;
-	float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2;
-	float cosThetaM4 = cosThetaM2 * cosThetaM2;
-	float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
-	// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-	float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-	float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-	float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-	float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-	float G = G1o * G1i;
-	// probability
-	float invHt2 = 1 / dot(ht, ht);
-	*pdf = D * fabsf(cosThetaM) * (fabsf(cosHI) * (m_eta * m_eta)) * invHt2;
-	float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D) * invHt2) / cosNO;
-	return make_float3 (out, out, out);
-}
-
-__device float bsdf_microfacet_beckmann_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_microfacet_beckmann_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_ab = sc->data0;
-	float m_eta = sc->data1;
-	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
-	float3 m_N = sd->N;
-
-	float cosNO = dot(m_N, sd->I);
-	if(cosNO > 0) {
-		float3 X, Y, Z = m_N;
-		make_orthonormals(Z, &X, &Y);
-		// generate a random microfacet normal m
-		// eq. 35,36:
-		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
-		float alpha2 = m_ab * m_ab;
-		float tanThetaM = safe_sqrtf(-alpha2 * logf(1 - randu));
-		float cosThetaM = 1 / safe_sqrtf(1 + tanThetaM * tanThetaM);
-		float sinThetaM = cosThetaM * tanThetaM;
-		float phiM = 2 * M_PI_F * randv;
-		float3 m = (cosf(phiM) * sinThetaM) * X +
-				 (sinf(phiM) * sinThetaM) * Y +
-							   cosThetaM  * Z;
-
-		if(!m_refractive) {
-			float cosMO = dot(m, sd->I);
-			if(cosMO > 0) {
-				// eq. 39 - compute actual reflected direction
-				*omega_in = 2 * cosMO * m - sd->I;
-				if(dot(sd->Ng, *omega_in) > 0) {
-					// microfacet normal is visible to this ray
-					// eq. 25
-					float cosThetaM2 = cosThetaM * cosThetaM;
-					float tanThetaM2 = tanThetaM * tanThetaM;
-					float cosThetaM4 = cosThetaM2 * cosThetaM2;
-					float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
-					// eq. 24
-					float pm = D * cosThetaM;
-					// convert into pdf of the sampled direction
-					// eq. 38 - but see also:
-					// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-					*pdf = pm * 0.25f / cosMO;
-					// Eval BRDF*cosNI
-					float cosNI = dot(m_N, *omega_in);
-					// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-					float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-					float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-					float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-					float G = G1o * G1i;
-					// eq. 20: (F*G*D)/(4*in*on)
-					float out = (G * D) * 0.25f / cosNO;
-					*eval = make_float3(out, out, out);
-#ifdef __RAY_DIFFERENTIALS__
-					*domega_in_dx = (2 * dot(m, sd->dI.dx)) * m - sd->dI.dx;
-					*domega_in_dy = (2 * dot(m, sd->dI.dy)) * m - sd->dI.dy;
-					// Since there is some blur to this reflection, make the
-					// derivatives a bit bigger. In theory this varies with the
-					// roughness but the exact relationship is complex and
-					// requires more ops than are practical.
-					*domega_in_dx *= 10.0f;
-					*domega_in_dy *= 10.0f;
-#endif
-				}
-			}
-		}
-		else {
-			// CAUTION: the i and o variables are inverted relative to the paper
-			// eq. 39 - compute actual refractive direction
-			float3 R, T;
-#ifdef __RAY_DIFFERENTIALS__
-			float3 dRdx, dRdy, dTdx, dTdy;
-#endif
-			bool inside;
-			fresnel_dielectric(m_eta, m, sd->I, &R, &T,
-#ifdef __RAY_DIFFERENTIALS__
-				sd->dI.dx, sd->dI.dy, &dRdx, &dRdy, &dTdx, &dTdy,
-#endif
-				&inside);
-
-			if(!inside) {
-				*omega_in = T;
-#ifdef __RAY_DIFFERENTIALS__
-				*domega_in_dx = dTdx;
-				*domega_in_dy = dTdy;
-#endif
-
-				// eq. 33
-				float cosThetaM2 = cosThetaM * cosThetaM;
-				float tanThetaM2 = tanThetaM * tanThetaM;
-				float cosThetaM4 = cosThetaM2 * cosThetaM2;
-				float D = expf(-tanThetaM2 / alpha2) / (M_PI_F * alpha2 *  cosThetaM4);
-				// eq. 24
-				float pm = D * cosThetaM;
-				// eval BRDF*cosNI
-				float cosNI = dot(m_N, *omega_in);
-				// eq. 26, 27: now calculate G1(i,m) and G1(o,m)
-				float ao = 1 / (m_ab * safe_sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-				float ai = 1 / (m_ab * safe_sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
-				float G1o = ao < 1.6f ? (3.535f * ao + 2.181f * ao * ao) / (1 + 2.276f * ao + 2.577f * ao * ao) : 1.0f;
-				float G1i = ai < 1.6f ? (3.535f * ai + 2.181f * ai * ai) / (1 + 2.276f * ai + 2.577f * ai * ai) : 1.0f;
-				float G = G1o * G1i;
-				// eq. 21
-				float cosHI = dot(m, *omega_in);
-				float cosHO = dot(m, sd->I);
-				float Ht2 = m_eta * cosHI + cosHO;
-				Ht2 *= Ht2;
-				float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
-				// eq. 38 and eq. 17
-				*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
-				*eval = make_float3(out, out, out);
-#ifdef __RAY_DIFFERENTIALS__
-				// Since there is some blur to this refraction, make the
-				// derivatives a bit bigger. In theory this varies with the
-				// roughness but the exact relationship is complex and
-				// requires more ops than are practical.
-				*domega_in_dx *= 10.0f;
-				*domega_in_dy *= 10.0f;
-#endif
-			}
-		}
-	}
-	return (m_refractive) ? LABEL_TRANSMIT|LABEL_GLOSSY : LABEL_REFLECT|LABEL_GLOSSY;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_MICROFACET_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_oren_nayar.h b/intern/cycles/kernel/svm/bsdf_oren_nayar.h
deleted file mode 100644
index a7edccd..0000000
--- a/intern/cycles/kernel/svm/bsdf_oren_nayar.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef __BSDF_OREN_NAYAR_H__
-#define __BSDF_OREN_NAYAR_H__
-
-CCL_NAMESPACE_BEGIN
-
-typedef struct BsdfOrenNayarClosure {
-	float m_a;
-	float m_b;
-} BsdfOrenNayarClosure;
-
-__device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n, float3 v, float3 l)
-{
-	float nl = max(dot(n, l), 0.0f);
-	float nv = max(dot(n, v), 0.0f);
-	float t = dot(l, v) - nl * nv;
-
-	if (t > 0.0f)
-		t /= max(nl, nv) + FLT_MIN;
-	float is = nl * (sc->data0 + sc->data1 * t);
-	return make_float3(is, is, is);
-}
-
-__device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sigma)
-{
-	sc->type = CLOSURE_BSDF_OREN_NAYAR_ID;
-	sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL;
-
-	sigma = clamp(sigma, 0.0f, 1.0f);
-
-	float div = 1.0f / (M_PI_F + ((3.0f * M_PI_F - 4.0f) / 6.0f) * sigma);
-
-	sc->data0 = 1.0f * div;
-	sc->data1 = sigma * div;
-}
-
-__device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_oren_nayar_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	if (dot(sd->N, omega_in) > 0.0f) {
-		*pdf = 0.5f * M_1_PI_F;
-		return bsdf_oren_nayar_get_intensity(sc, sd->N, I, omega_in);
-	}
-	else {
-		*pdf = 0.0f;
-		return make_float3(0.0f, 0.0f, 0.0f);
-	}
-}
-
-__device float3 bsdf_oren_nayar_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_oren_nayar_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_oren_nayar_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	sample_uniform_hemisphere(sd->N, randu, randv, omega_in, pdf);
-
-	if (dot(sd->Ng, *omega_in) > 0.0f) {
-		*eval = bsdf_oren_nayar_get_intensity(sc, sd->N, sd->I, *omega_in);
-
-#ifdef __RAY_DIFFERENTIALS__
-		// TODO: find a better approximation for the bounce
-		*domega_in_dx = (2.0f * dot(sd->N, sd->dI.dx)) * sd->N - sd->dI.dx;
-		*domega_in_dy = (2.0f * dot(sd->N, sd->dI.dy)) * sd->N - sd->dI.dy;
-		*domega_in_dx *= 125.0f;
-		*domega_in_dy *= 125.0f;
-#endif
-	}
-	else {
-		*pdf = 0.0f;
-		*eval = make_float3(0.0f, 0.0f, 0.0f);
-	}
-
-	return LABEL_REFLECT | LABEL_DIFFUSE;
-}
-
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_OREN_NAYAR_H__ */
diff --git a/intern/cycles/kernel/svm/bsdf_reflection.h b/intern/cycles/kernel/svm/bsdf_reflection.h
deleted file mode 100644
index 09b4e0e..0000000
--- a/intern/cycles/kernel/svm/bsdf_reflection.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_REFLECTION_H__
-#define __BSDF_REFLECTION_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* REFLECTION */
-
-typedef struct BsdfReflectionClosure {
-	//float3 m_N;
-} BsdfReflectionClosure;
-
-__device void bsdf_reflection_setup(ShaderData *sd, ShaderClosure *sc)
-{
-	sc->type = CLOSURE_BSDF_REFLECTION_ID;
-	sd->flag |= SD_BSDF;
-}
-
-__device void bsdf_reflection_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_reflection_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float3 bsdf_reflection_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_reflection_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_reflection_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	//const BsdfReflectionClosure *self = (const BsdfReflectionClosure*)sc->data;
-	float3 m_N = sd->N;
-
-	// only one direction is possible
-	float cosNO = dot(m_N, sd->I);
-	if(cosNO > 0) {
-		*omega_in = (2 * cosNO) * m_N - sd->I;
-		if(dot(sd->Ng, *omega_in) > 0) {
-#ifdef __RAY_DIFFERENTIALS__
-			*domega_in_dx = 2 * dot(m_N, sd->dI.dx) * m_N - sd->dI.dx;
-			*domega_in_dy = 2 * dot(m_N, sd->dI.dy) * m_N - sd->dI.dy;
-#endif
-			*pdf = 1;
-			*eval = make_float3(1, 1, 1);
-		}
-	}
-	return LABEL_REFLECT|LABEL_SINGULAR;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_REFLECTION_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_refraction.h b/intern/cycles/kernel/svm/bsdf_refraction.h
deleted file mode 100644
index c9c2689..0000000
--- a/intern/cycles/kernel/svm/bsdf_refraction.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_REFRACTION_H__
-#define __BSDF_REFRACTION_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* REFRACTION */
-
-typedef struct BsdfRefractionClosure {
-	float m_eta;
-} BsdfRefractionClosure;
-
-__device void bsdf_refraction_setup(ShaderData *sd, ShaderClosure *sc, float eta)
-{
-	sc->data0 = eta;
-
-	sc->type = CLOSURE_BSDF_REFRACTION_ID;
-	sd->flag |= SD_BSDF;
-}
-
-__device void bsdf_refraction_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_refraction_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float3 bsdf_refraction_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_refraction_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_refraction_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_eta = sc->data0;
-	float3 m_N = sd->N;
-
-	float3 R, T;
-#ifdef __RAY_DIFFERENTIALS__
-	float3 dRdx, dRdy, dTdx, dTdy;
-#endif
-	bool inside;
-	fresnel_dielectric(m_eta, m_N, sd->I, &R, &T,
-#ifdef __RAY_DIFFERENTIALS__
-		sd->dI.dx, sd->dI.dy, &dRdx, &dRdy, &dTdx, &dTdy,
-#endif
-		&inside);
-	
-	if(!inside) {
-		*pdf = 1;
-		*eval = make_float3(1.0f, 1.0f, 1.0f);
-		*omega_in = T;
-#ifdef __RAY_DIFFERENTIALS__
-		*domega_in_dx = dTdx;
-		*domega_in_dy = dTdy;
-#endif
-	}
-	return LABEL_TRANSMIT|LABEL_SINGULAR;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_REFRACTION_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_transparent.h b/intern/cycles/kernel/svm/bsdf_transparent.h
deleted file mode 100644
index 511836c..0000000
--- a/intern/cycles/kernel/svm/bsdf_transparent.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_TRANSPARENT_H__
-#define __BSDF_TRANSPARENT_H__
-
-CCL_NAMESPACE_BEGIN
-
-__device void bsdf_transparent_setup(ShaderData *sd, ShaderClosure *sc)
-{
-	sc->type = CLOSURE_BSDF_TRANSPARENT_ID;
-	sd->flag |= SD_BSDF;
-}
-
-__device void bsdf_transparent_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_transparent_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float3 bsdf_transparent_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_transparent_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_transparent_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	// only one direction is possible
-	*omega_in = -sd->I;
-#ifdef __RAY_DIFFERENTIALS__
-	*domega_in_dx = -sd->dI.dx;
-	*domega_in_dy = -sd->dI.dy;
-#endif
-	*pdf = 1;
-	*eval = make_float3(1, 1, 1);
-	return LABEL_TRANSMIT|LABEL_TRANSPARENT;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_TRANSPARENT_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_ward.h b/intern/cycles/kernel/svm/bsdf_ward.h
deleted file mode 100644
index 6ae4594..0000000
--- a/intern/cycles/kernel/svm/bsdf_ward.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_WARD_H__
-#define __BSDF_WARD_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* WARD */
-
-typedef struct BsdfWardClosure {
-	//float3 m_N;
-	//float3 m_T;
-	float m_ax;
-	float m_ay;
-} BsdfWardClosure;
-
-__device void bsdf_ward_setup(ShaderData *sd, ShaderClosure *sc, float3 T, float ax, float ay)
-{
-	float m_ax = clamp(ax, 1e-5f, 1.0f);
-	float m_ay = clamp(ay, 1e-5f, 1.0f);
-
-	sc->data0 = m_ax;
-	sc->data1 = m_ay;
-
-	sc->type = CLOSURE_BSDF_WARD_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
-}
-
-__device void bsdf_ward_blur(ShaderClosure *sc, float roughness)
-{
-	sc->data0 = fmaxf(roughness, sc->data0);
-	sc->data1 = fmaxf(roughness, sc->data1);
-}
-
-__device float3 bsdf_ward_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_ax = sc->data0;
-	float m_ay = sc->data1;
-	float3 m_N = sd->N;
-	float3 m_T = normalize(sd->dPdu);
-
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-
-	if(cosNI > 0 && cosNO > 0) {
-		// get half vector and get x,y basis on the surface for anisotropy
-		float3 H = normalize(omega_in + I); // normalize needed for pdf
-		float3 X, Y;
-		make_orthonormals_tangent(m_N, m_T, &X, &Y);
-		// eq. 4
-		float dotx = dot(H, X) / m_ax;
-		float doty = dot(H, Y) / m_ay;
-		float dotn = dot(H, m_N);
-		float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
-		float denom = (4 * M_PI_F * m_ax * m_ay * sqrtf(cosNO * cosNI));
-		float exp_val = expf(-exp_arg);
-		float out = cosNI * exp_val / denom;
-		float oh = dot(H, I);
-		denom = 4 * M_PI_F * m_ax * m_ay * oh * dotn * dotn * dotn;
-		*pdf = exp_val / denom;
-		return make_float3 (out, out, out);
-	}
-	return make_float3 (0, 0, 0);
-}
-
-__device float3 bsdf_ward_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_ward_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_ward_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_ax = sc->data0;
-	float m_ay = sc->data1;
-	float3 m_N = sd->N;
-	float3 m_T = normalize(sd->dPdu);
-
-	float cosNO = dot(m_N, sd->I);
-	if(cosNO > 0) {
-		// get x,y basis on the surface for anisotropy
-		float3 X, Y;
-		make_orthonormals_tangent(m_N, m_T, &X, &Y);
-		// generate random angles for the half vector
-		// eq. 7 (taking care around discontinuities to keep
-		//ttoutput angle in the right quadrant)
-		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
-		float alphaRatio = m_ay / m_ax;
-		float cosPhi, sinPhi;
-		if(randu < 0.25f) {
-			float val = 4 * randu;
-			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
-			cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
-			sinPhi = tanPhi * cosPhi;
-		}
-		else if(randu < 0.5f) {
-			float val = 1 - 4 * (0.5f - randu);
-			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
-			// phi = M_PI_F - phi;
-			cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
-			sinPhi = -tanPhi * cosPhi;
-		}
-		else if(randu < 0.75f) {
-			float val = 4 * (randu - 0.5f);
-			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
-			//phi = M_PI_F + phi;
-			cosPhi = -1 / sqrtf(1 + tanPhi * tanPhi);
-			sinPhi = tanPhi * cosPhi;
-		}
-		else {
-			float val = 1 - 4 * (1 - randu);
-			float tanPhi = alphaRatio * tanf(M_PI_2_F * val);
-			// phi = 2 * M_PI_F - phi;
-			cosPhi = 1 / sqrtf(1 + tanPhi * tanPhi);
-			sinPhi = -tanPhi * cosPhi;
-		}
-		// eq. 6
-		// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
-		//tttt  and sin(atan(x)) == x/sqrt(1+x^2)
-		float thetaDenom = (cosPhi * cosPhi) / (m_ax * m_ax) + (sinPhi * sinPhi) / (m_ay * m_ay);
-		float tanTheta2 = -logf(1 - randv) / thetaDenom;
-		float cosTheta  = 1 / sqrtf(1 + tanTheta2);
-		float sinTheta  = cosTheta * sqrtf(tanTheta2);
-
-		float3 h; // already normalized becaused expressed from spherical coordinates
-		h.x = sinTheta * cosPhi;
-		h.y = sinTheta * sinPhi;
-		h.z = cosTheta;
-		// compute terms that are easier in local space
-		float dotx = h.x / m_ax;
-		float doty = h.y / m_ay;
-		float dotn = h.z;
-		// transform to world space
-		h = h.x * X + h.y * Y + h.z * m_N;
-		// generate the final sample
-		float oh = dot(h, sd->I);
-		*omega_in = 2.0f * oh * h - sd->I;
-		if(dot(sd->Ng, *omega_in) > 0) {
-			float cosNI = dot(m_N, *omega_in);
-			if(cosNI > 0) {
-				// eq. 9
-				float exp_arg = (dotx * dotx + doty * doty) / (dotn * dotn);
-				float denom = 4 * M_PI_F * m_ax * m_ay * oh * dotn * dotn * dotn;
-				*pdf = expf(-exp_arg) / denom;
-				// compiler will reuse expressions already computed
-				denom = (4 * M_PI_F * m_ax * m_ay * sqrtf(cosNO * cosNI));
-				float power = cosNI * expf(-exp_arg) / denom;
-				*eval = make_float3(power, power, power);
-#ifdef __RAY_DIFFERENTIALS__
-				*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
-				*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
-				// Since there is some blur to this reflection, make the
-				// derivatives a bit bigger. In theory this varies with the
-				// roughness but the exact relationship is complex and
-				// requires more ops than are practical.
-				*domega_in_dx *= 10.0f;
-				*domega_in_dy *= 10.0f;
-#endif
-			}
-		}
-	}
-	return LABEL_REFLECT|LABEL_GLOSSY;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_WARD_H__ */
-
diff --git a/intern/cycles/kernel/svm/bsdf_westin.h b/intern/cycles/kernel/svm/bsdf_westin.h
deleted file mode 100644
index 3e7c27f..0000000
--- a/intern/cycles/kernel/svm/bsdf_westin.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __BSDF_WESTIN_H__
-#define __BSDF_WESTIN_H__
-
-CCL_NAMESPACE_BEGIN
-
-/* WESTIN BACKSCATTER */
-
-typedef struct BsdfWestinBackscatterClosure {
-	//float3 m_N;
-	float m_invroughness;
-} BsdfWestinBackscatterClosure;
-
-__device void bsdf_westin_backscatter_setup(ShaderData *sd, ShaderClosure *sc, float roughness)
-{
-	roughness = clamp(roughness, 1e-5f, 1.0f);
-	float m_invroughness = 1.0f/roughness;
-
-	sc->type = CLOSURE_BSDF_WESTIN_BACKSCATTER_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
-	sc->data0 = m_invroughness;
-}
-
-__device void bsdf_westin_backscatter_blur(ShaderClosure *sc, float roughness)
-{
-	float m_invroughness = sc->data0;
-	m_invroughness = min(1.0f/roughness, m_invroughness);
-	sc->data0 = m_invroughness;
-}
-
-__device float3 bsdf_westin_backscatter_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_invroughness = sc->data0;
-	float3 m_N = sd->N;
-
-	// pdf is implicitly 0 (no indirect sampling)
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO > 0 && cosNI > 0) {
-		float cosine = dot(I, omega_in);
-		*pdf = cosine > 0 ? (m_invroughness + 1) * powf(cosine, m_invroughness) : 0;
-		*pdf *= 0.5f * M_1_PI_F;
-		return make_float3 (*pdf, *pdf, *pdf);
-	}
-	return make_float3 (0, 0, 0);
-}
-
-__device float3 bsdf_westin_backscatter_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_westin_backscatter_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_westin_backscatter_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_invroughness = sc->data0;
-	float3 m_N = sd->N;
-
-	float cosNO = dot(m_N, sd->I);
-	if(cosNO > 0) {
-#ifdef __RAY_DIFFERENTIALS__
-		*domega_in_dx = sd->dI.dx;
-		*domega_in_dy = sd->dI.dy;
-#endif
-		float3 T, B;
-		make_orthonormals (sd->I, &T, &B);
-		float phi = 2 * M_PI_F * randu;
-		float cosTheta = powf(randv, 1 / (m_invroughness + 1));
-		float sinTheta2 = 1 - cosTheta * cosTheta;
-		float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
-		*omega_in = (cosf(phi) * sinTheta) * T +
-				   (sinf(phi) * sinTheta) * B +
-				   (cosTheta) * sd->I;
-		if(dot(sd->Ng, *omega_in) > 0)
-		{
-			// common terms for pdf and eval
-			float cosNI = dot(m_N, *omega_in);
-			// make sure the direction we chose is still in the right hemisphere
-			if(cosNI > 0)
-			{
-				*pdf = 0.5f * M_1_PI_F * powf(cosTheta, m_invroughness);
-				*pdf = (m_invroughness + 1) * (*pdf);
-				*eval = make_float3(*pdf, *pdf, *pdf);
-#ifdef __RAY_DIFFERENTIALS__
-				// Since there is some blur to this reflection, make the
-				// derivatives a bit bigger. In theory this varies with the
-				// exponent but the exact relationship is complex and
-				// requires more ops than are practical.
-				*domega_in_dx *= 10.0f;
-				*domega_in_dy *= 10.0f;
-#endif
-			}
-		}
-	}
-	return LABEL_REFLECT|LABEL_GLOSSY;
-}
-
-/* WESTIN SHEEN */
-
-typedef struct BsdfWestinSheenClosure {
-	//float3 m_N;
-	float m_edginess;
-} BsdfWestinSheenClosure;
-
-__device void bsdf_westin_sheen_setup(ShaderData *sd, ShaderClosure *sc, float edginess)
-{
-	sc->type = CLOSURE_BSDF_WESTIN_SHEEN_ID;
-	sd->flag |= SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
-	sc->data0 = edginess;
-}
-
-__device void bsdf_westin_sheen_blur(ShaderClosure *sc, float roughness)
-{
-}
-
-__device float3 bsdf_westin_sheen_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	float m_edginess = sc->data0;
-	float3 m_N = sd->N;
-
-	// pdf is implicitly 0 (no indirect sampling)
-	float cosNO = dot(m_N, I);
-	float cosNI = dot(m_N, omega_in);
-	if(cosNO > 0 && cosNI > 0) {
-		float sinNO2 = 1 - cosNO * cosNO;
-		*pdf = cosNI * M_1_PI_F;
-		float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * (*pdf) : 0;
-		return make_float3 (westin, westin, westin);
-	}
-	return make_float3 (0, 0, 0);
-}
-
-__device float3 bsdf_westin_sheen_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
-{
-	return make_float3(0.0f, 0.0f, 0.0f);
-}
-
-__device float bsdf_westin_sheen_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I)
-{
-	return 1.0f;
-}
-
-__device int bsdf_westin_sheen_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
-{
-	float m_edginess = sc->data0;
-	float3 m_N = sd->N;
-
-	// we are viewing the surface from the right side - send a ray out with cosine
-	// distribution over the hemisphere
-	sample_cos_hemisphere(m_N, randu, randv, omega_in, pdf);
-	if(dot(sd->Ng, *omega_in) > 0) {
-		// TODO: account for sheen when sampling
-		float cosNO = dot(m_N, sd->I);
-		float sinNO2 = 1 - cosNO * cosNO;
-		float westin = sinNO2 > 0 ? powf(sinNO2, 0.5f * m_edginess) * (*pdf) : 0;
-		*eval = make_float3(westin, westin, westin);
-#ifdef __RAY_DIFFERENTIALS__
-		// TODO: find a better approximation for the diffuse bounce
-		*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
-		*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
-		*domega_in_dx *= 125.0f;
-		*domega_in_dy *= 125.0f;
-#endif
-	}
-	else {
-		pdf = 0;
-	}
-	return LABEL_REFLECT|LABEL_DIFFUSE;
-}
-
-CCL_NAMESPACE_END
-
-#endif /* __BSDF_WESTIN_H__ */
-
diff --git a/intern/cycles/kernel/svm/emissive.h b/intern/cycles/kernel/svm/emissive.h
deleted file mode 100644
index 9a906f8..0000000
--- a/intern/cycles/kernel/svm/emissive.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Adapted from Open Shading Language with this license:
- *
- * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
- * All Rights Reserved.
- *
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Sony Pictures Imageworks nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-CCL_NAMESPACE_BEGIN
-
-/* EMISSION CLOSURE */
-
-/// Return the probability distribution function in the direction I,
-/// given the parameters and the light's surface normal.  This MUST match
-/// the PDF computed by sample().
-__device float emissive_pdf(const float3 Ng, const float3 I)
-{
-	float cosNO = fabsf(dot(Ng, I));
-	return (cosNO > 0.0f)? 1.0f: 0.0f;
-}
-
-__device float3 emissive_eval(const float3 Ng, const float3 I)
-{
-	float res = emissive_pdf(Ng, I);
-	
-	return make_float3(res, res, res);
-}
-
-__device float3 svm_emissive_eval(ShaderData *sd, ShaderClosure *sc)
-{
-	return emissive_eval(sd->Ng, sd->I);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index 5b0f192..9c79886 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -82,6 +82,25 @@ __device_inline void stack_store_float(float *stack, uint a, float f)
 	stack[a] = f;
 }
 
+__device_inline int stack_load_int(float *stack, uint a)
+{
+	kernel_assert(a < SVM_STACK_SIZE);
+
+	return __float_as_int(stack[a]);
+}
+
+__device_inline float stack_load_int_default(float *stack, uint a, uint value)
+{
+	return (a == (uint)SVM_STACK_INVALID)? (int)value: stack_load_int(stack, a);
+}
+
+__device_inline void stack_store_int(float *stack, uint a, int i)
+{
+	kernel_assert(a < SVM_STACK_SIZE);
+
+	stack[a] = __int_as_float(i);
+}
+
 __device_inline bool stack_valid(uint a)
 {
 	return a != (uint)SVM_STACK_INVALID;
@@ -185,7 +204,7 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 				break;
 			}
 			case NODE_CLOSURE_BSDF:
-				svm_node_closure_bsdf(kg, sd, stack, node, randb, path_flag);
+				svm_node_closure_bsdf(kg, sd, stack, node, randb, path_flag, &offset);
 				break;
 			case NODE_CLOSURE_EMISSION:
 				svm_node_closure_emission(sd, stack, node);
@@ -196,6 +215,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 			case NODE_CLOSURE_HOLDOUT:
 				svm_node_closure_holdout(sd, stack, node);
 				break;
+			case NODE_CLOSURE_AMBIENT_OCCLUSION:
+				svm_node_closure_ambient_occlusion(sd, stack, node);
+				break;
 			case NODE_CLOSURE_VOLUME:
 				svm_node_closure_volume(kg, sd, stack, node, path_flag);
 				break;
@@ -261,14 +283,14 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 				svm_node_camera(kg, sd, stack, node.y, node.z, node.w);
 				break;
 			case NODE_GEOMETRY:
-				svm_node_geometry(sd, stack, node.y, node.z);
+				svm_node_geometry(kg, sd, stack, node.y, node.z);
 				break;
 #ifdef __EXTRA_NODES__
 			case NODE_GEOMETRY_BUMP_DX:
-				svm_node_geometry_bump_dx(sd, stack, node.y, node.z);
+				svm_node_geometry_bump_dx(kg, sd, stack, node.y, node.z);
 				break;
 			case NODE_GEOMETRY_BUMP_DY:
-				svm_node_geometry_bump_dy(sd, stack, node.y, node.z);
+				svm_node_geometry_bump_dy(kg, sd, stack, node.y, node.z);
 				break;
 			case NODE_LIGHT_PATH:
 				svm_node_light_path(sd, stack, node.y, node.z, path_flag);
@@ -334,7 +356,7 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 				svm_node_set_displacement(sd, stack, node.y);
 				break;
 			case NODE_SET_BUMP:
-				svm_node_set_bump(sd, stack, node.y, node.z, node.w);
+				svm_node_set_bump(kg, sd, stack, node);
 				break;
 			case NODE_MATH:
 				svm_node_math(kg, sd, stack, node.y, node.z, node.w, &offset);
@@ -362,6 +384,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 			case NODE_TEX_COORD_BUMP_DY:
 				svm_node_tex_coord_bump_dy(kg, sd, stack, node.y, node.z);
 				break;
+			case NODE_CLOSURE_SET_NORMAL:
+				svm_node_set_normal(kg, sd, stack, node.y, node.z );
+				break;			
 #endif
 			case NODE_EMISSION_SET_WEIGHT_TOTAL:
 				svm_node_emission_set_weight_total(kg, sd, node.y, node.z, node.w);
@@ -376,7 +401,17 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 			case NODE_LIGHT_FALLOFF:
 				svm_node_light_falloff(sd, stack, node);
 				break;
-#endif
+#endif			
+#ifdef __ANISOTROPIC__
+			case NODE_TANGENT:
+				svm_node_tangent(kg, sd, stack, node);
+				break;
+#endif			
+#ifdef __NORMAL_MAP__
+			case NODE_NORMAL_MAP:
+				svm_node_normal_map(kg, sd, stack, node);
+				break;
+#endif			
 			case NODE_END:
 			default:
 #ifndef __MULTI_CLOSURE__
diff --git a/intern/cycles/kernel/svm/svm_brick.h b/intern/cycles/kernel/svm/svm_brick.h
index 7e38ac8..49466c0 100644
--- a/intern/cycles/kernel/svm/svm_brick.h
+++ b/intern/cycles/kernel/svm/svm_brick.h
@@ -28,9 +28,9 @@ __device_noinline float brick_noise(int n) /* fast integer noise */
 	return 0.5f * ((float)nn / 1073741824.0f);
 }
 
-__device_noinline float svm_brick(float3 p, float scale, float mortar_size, float bias,
+__device_noinline float2 svm_brick(float3 p, float scale, float mortar_size, float bias,
 	float brick_width, float row_height, float offset_amount, int offset_frequency,
-	float squash_amount, int squash_frequency, float *tint)
+	float squash_amount, int squash_frequency)
 {	
 	p *= scale;
 
@@ -50,11 +50,12 @@ __device_noinline float svm_brick(float3 p, float scale, float mortar_size, floa
 	x = (p.x+offset) - brick_width*bricknum;
 	y = p.y - row_height*rownum;
 
-	*tint = clamp((brick_noise((rownum << 16) + (bricknum & 0xFFFF)) + bias), 0.0f, 1.0f);
+	return make_float2(
+		clamp((brick_noise((rownum << 16) + (bricknum & 0xFFFF)) + bias), 0.0f, 1.0f),
 
-	return (x < mortar_size || y < mortar_size ||
+		(x < mortar_size || y < mortar_size ||
 		x > (brick_width - mortar_size) ||
-		y > (row_height - mortar_size)) ? 1.0f : 0.0f;
+		y > (row_height - mortar_size)) ? 1.0f : 0.0f);
 }
 
 __device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
@@ -70,8 +71,6 @@ __device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *stack
 	/* RNA properties */
 	uint offset_frequency, squash_frequency;
 	
-	float tint = 0.0f;
-
 	decode_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &mortar_offset);
 	decode_node_uchar4(node.z, &scale_offset, &mortar_size_offset, &bias_offset, &brick_width_offset);
 	decode_node_uchar4(node.w, &row_height_offset, &color_offset, &fac_offset, NULL);
@@ -92,9 +91,11 @@ __device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *stack
 	float offset_amount = __int_as_float(node3.z);
 	float squash_amount = __int_as_float(node3.w);
 	
-	float f = svm_brick(co, scale, mortar_size, bias, brick_width, row_height,
-		offset_amount, offset_frequency, squash_amount, squash_frequency,
-		&tint);
+	float2 f2 = svm_brick(co, scale, mortar_size, bias, brick_width, row_height,
+		offset_amount, offset_frequency, squash_amount, squash_frequency);
+
+	float tint = f2.x;
+	float f = f2.y;
 	
 	if(f != 1.0f) {
 		float facm = 1.0f - tint;
diff --git a/intern/cycles/kernel/svm/svm_bsdf.h b/intern/cycles/kernel/svm/svm_bsdf.h
index 411916f..07927fe 100644
--- a/intern/cycles/kernel/svm/svm_bsdf.h
+++ b/intern/cycles/kernel/svm/svm_bsdf.h
@@ -16,17 +16,18 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "bsdf_ashikhmin_velvet.h"
-#include "bsdf_diffuse.h"
-#include "bsdf_oren_nayar.h"
-#include "bsdf_microfacet.h"
-#include "bsdf_reflection.h"
-#include "bsdf_refraction.h"
-#include "bsdf_transparent.h"
-#ifdef __DPDU__
-#include "bsdf_ward.h"
+#include "../closure/bsdf_ashikhmin_velvet.h"
+#include "../closure/bsdf_diffuse.h"
+#include "../closure/bsdf_oren_nayar.h"
+#include "../closure/bsdf_phong_ramp.h"
+#include "../closure/bsdf_microfacet.h"
+#include "../closure/bsdf_reflection.h"
+#include "../closure/bsdf_refraction.h"
+#include "../closure/bsdf_transparent.h"
+#ifdef __ANISOTROPIC__
+#include "../closure/bsdf_ward.h"
 #endif
-#include "bsdf_westin.h"
+#include "../closure/bsdf_westin.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -36,45 +37,61 @@ __device int svm_bsdf_sample(const ShaderData *sd, const ShaderClosure *sc, floa
 
 	switch(sc->type) {
 		case CLOSURE_BSDF_DIFFUSE_ID:
-			label = bsdf_diffuse_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_diffuse_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 #ifdef __SVM__
 		case CLOSURE_BSDF_OREN_NAYAR_ID:
-			label = bsdf_oren_nayar_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_oren_nayar_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
+		/*case CLOSURE_BSDF_PHONG_RAMP_ID:
+			label = bsdf_phong_ramp_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			break;*/
 		case CLOSURE_BSDF_TRANSLUCENT_ID:
-			label = bsdf_translucent_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_translucent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_REFLECTION_ID:
-			label = bsdf_reflection_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_reflection_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_REFRACTION_ID:
-			label = bsdf_refraction_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_refraction_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_TRANSPARENT_ID:
-			label = bsdf_transparent_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_transparent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_MICROFACET_GGX_ID:
 		case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-			label = bsdf_microfacet_ggx_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_microfacet_ggx_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 		case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-			label = bsdf_microfacet_beckmann_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_microfacet_beckmann_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
 		case CLOSURE_BSDF_WARD_ID:
-			label = bsdf_ward_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_ward_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 #endif
 		case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
-			label = bsdf_ashikhmin_velvet_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_ashikhmin_velvet_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
-			label = bsdf_westin_backscatter_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_westin_backscatter_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 		case CLOSURE_BSDF_WESTIN_SHEEN_ID:
-			label = bsdf_westin_sheen_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
+			label = bsdf_westin_sheen_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
+				eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
 			break;
 #endif
 		default:
@@ -92,45 +109,48 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con
 	if(dot(sd->Ng, omega_in) >= 0.0f) {
 		switch(sc->type) {
 			case CLOSURE_BSDF_DIFFUSE_ID:
-				eval = bsdf_diffuse_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 #ifdef __SVM__
 			case CLOSURE_BSDF_OREN_NAYAR_ID:
-				eval = bsdf_oren_nayar_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_oren_nayar_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
+			/*case CLOSURE_BSDF_PHONG_RAMP_ID:
+				eval = bsdf_phong_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
+				break;*/
 			case CLOSURE_BSDF_TRANSLUCENT_ID:
-				eval = bsdf_translucent_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_translucent_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_REFLECTION_ID:
-				eval = bsdf_reflection_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_REFRACTION_ID:
-				eval = bsdf_refraction_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_refraction_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_TRANSPARENT_ID:
-				eval = bsdf_transparent_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_transparent_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_MICROFACET_GGX_ID:
 			case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-				eval = bsdf_microfacet_ggx_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_microfacet_ggx_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 			case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-				eval = bsdf_microfacet_beckmann_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
 			case CLOSURE_BSDF_WARD_ID:
-				eval = bsdf_ward_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_ward_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 #endif
 			case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
-				eval = bsdf_ashikhmin_velvet_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_ashikhmin_velvet_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
-				eval = bsdf_westin_backscatter_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_westin_backscatter_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_WESTIN_SHEEN_ID:
-				eval = bsdf_westin_sheen_eval_reflect(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_westin_sheen_eval_reflect(sc, sd->I, omega_in, pdf);
 				break;
 #endif
 			default:
@@ -141,45 +161,45 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con
 	else {
 		switch(sc->type) {
 			case CLOSURE_BSDF_DIFFUSE_ID:
-				eval = bsdf_diffuse_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 #ifdef __SVM__
 			case CLOSURE_BSDF_OREN_NAYAR_ID:
-				eval = bsdf_oren_nayar_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_oren_nayar_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_TRANSLUCENT_ID:
-				eval = bsdf_translucent_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_translucent_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_REFLECTION_ID:
-				eval = bsdf_reflection_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_REFRACTION_ID:
-				eval = bsdf_refraction_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_refraction_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_TRANSPARENT_ID:
-				eval = bsdf_transparent_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_transparent_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_MICROFACET_GGX_ID:
 			case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-				eval = bsdf_microfacet_ggx_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_microfacet_ggx_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 			case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-				eval = bsdf_microfacet_beckmann_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
 			case CLOSURE_BSDF_WARD_ID:
-				eval = bsdf_ward_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_ward_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 #endif
 			case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
-				eval = bsdf_ashikhmin_velvet_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_ashikhmin_velvet_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
-				eval = bsdf_westin_backscatter_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_westin_backscatter_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 			case CLOSURE_BSDF_WESTIN_SHEEN_ID:
-				eval = bsdf_westin_sheen_eval_transmit(sd, sc, sd->I, omega_in, pdf);
+				eval = bsdf_westin_sheen_eval_transmit(sc, sd->I, omega_in, pdf);
 				break;
 #endif
 			default:
@@ -201,6 +221,9 @@ __device void svm_bsdf_blur(ShaderClosure *sc, float roughness)
 		case CLOSURE_BSDF_OREN_NAYAR_ID:
 			bsdf_oren_nayar_blur(sc, roughness);
 			break;
+		/*case CLOSURE_BSDF_PHONG_RAMP_ID:
+			bsdf_phong_ramp_blur(sc, roughness);
+			break;*/
 		case CLOSURE_BSDF_TRANSLUCENT_ID:
 			bsdf_translucent_blur(sc, roughness);
 			break;
@@ -221,7 +244,7 @@ __device void svm_bsdf_blur(ShaderClosure *sc, float roughness)
 		case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
 			bsdf_microfacet_beckmann_blur(sc, roughness);
 			break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
 		case CLOSURE_BSDF_WARD_ID:
 			bsdf_ward_blur(sc, roughness);
 			break;
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index 9355040..b5bd2b4 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -20,44 +20,75 @@ CCL_NAMESPACE_BEGIN
 
 /* Closure Nodes */
 
-__device void svm_node_glossy_setup(ShaderData *sd, ShaderClosure *sc, int type, float eta, float roughness, bool refract)
+__device void svm_node_glass_setup(ShaderData *sd, ShaderClosure *sc, int type, float eta, float roughness, bool refract)
 {
-	if(type == CLOSURE_BSDF_REFRACTION_ID) {
+	if(type == CLOSURE_BSDF_SHARP_GLASS_ID) {
+		if(refract) {
+			sc->data0 = eta;
+			sd->flag |= bsdf_refraction_setup(sc);
+		}
+		else
+			sd->flag |= bsdf_reflection_setup(sc);
+	}
+	else if(type == CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID) {
+		sc->data0 = roughness;
+		sc->data1 = eta;
+
 		if(refract)
-			bsdf_refraction_setup(sd, sc, eta);
+			sd->flag |= bsdf_microfacet_beckmann_refraction_setup(sc);
 		else
-			bsdf_reflection_setup(sd, sc);
+			sd->flag |= bsdf_microfacet_beckmann_setup(sc);
 	}
-	else if(type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID) {
-		bsdf_microfacet_beckmann_setup(sd, sc, roughness, eta, refract);
+	else {
+		sc->data0 = roughness;
+		sc->data1 = eta;
+
+		if(refract)
+			sd->flag |= bsdf_microfacet_ggx_refraction_setup(sc);
+		else
+			sd->flag |= bsdf_microfacet_ggx_setup(sc);
 	}
-	else
-		bsdf_microfacet_ggx_setup(sd, sc, roughness, eta, refract);
 }
 
-__device_inline ShaderClosure *svm_node_closure_get(ShaderData *sd)
+__device_inline ShaderClosure *svm_node_closure_get_non_bsdf(ShaderData *sd, ClosureType type, float mix_weight)
 {
 #ifdef __MULTI_CLOSURE__
 	ShaderClosure *sc = &sd->closure[sd->num_closure];
 
-	if(sd->num_closure < MAX_CLOSURE)
+	if(sd->num_closure < MAX_CLOSURE) {
+		sc->weight *= mix_weight;
+		sc->type = type;
 		sd->num_closure++;
+		return sc;
+	}
 
-	return sc;
+	return NULL;
 #else
 	return &sd->closure;
 #endif
 }
 
-__device_inline void svm_node_closure_set_mix_weight(ShaderClosure *sc, float mix_weight)
+__device_inline ShaderClosure *svm_node_closure_get_bsdf(ShaderData *sd, float mix_weight)
 {
 #ifdef __MULTI_CLOSURE__
-	sc->weight *= mix_weight;
-	sc->sample_weight = fabsf(average(sc->weight));
+	ShaderClosure *sc = &sd->closure[sd->num_closure];
+	float3 weight = sc->weight * mix_weight;
+	float sample_weight = fabsf(average(weight));
+
+	if(sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) {
+		sc->weight = weight;
+		sc->sample_weight = sample_weight;
+		sd->num_closure++;
+		return sc;
+	}
+
+	return NULL;
+#else
+	return &sd->closure;
 #endif
 }
 
-__device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, float randb, int path_flag)
+__device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, float randb, int path_flag, int *offset)
 {
 	uint type, param1_offset, param2_offset;
 
@@ -66,11 +97,19 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
 	decode_node_uchar4(node.y, &type, &param1_offset, &param2_offset, &mix_weight_offset);
 	float mix_weight = (stack_valid(mix_weight_offset)? stack_load_float(stack, mix_weight_offset): 1.0f);
 
+	/* note we read this extra node before weight check, so offset is added */
+	uint4 data_node = read_node(kg, offset);
+
 	if(mix_weight == 0.0f)
 		return;
+
+	float3 N = stack_valid(data_node.y)? stack_load_float3(stack, data_node.y): sd->N; 
 #else
 	decode_node_uchar4(node.y, &type, &param1_offset, &param2_offset, NULL);
 	float mix_weight = 1.0f;
+
+	uint4 data_node = read_node(kg, offset);
+	float3 N = stack_valid(data_node.y)? stack_load_float3(stack, data_node.y): sd->N; 
 #endif
 
 	float param1 = (stack_valid(param1_offset))? stack_load_float(stack, param1_offset): __int_as_float(node.z);
@@ -78,26 +117,39 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
 
 	switch(type) {
 		case CLOSURE_BSDF_DIFFUSE_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
 
-			float roughness = param1;
-			if(roughness == 0.0f)
-				bsdf_diffuse_setup(sd, sc);
-			else
-				bsdf_oren_nayar_setup(sd, sc, roughness);
+			if(sc) {
+				sc->N = N;
+
+				float roughness = param1;
+
+				if(roughness == 0.0f) {
+					sd->flag |= bsdf_diffuse_setup(sc);
+				}
+				else {
+					sc->data0 = roughness;
+					sd->flag |= bsdf_oren_nayar_setup(sc);
+				}
+			}
 			break;
 		}
 		case CLOSURE_BSDF_TRANSLUCENT_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
-			bsdf_translucent_setup(sd, sc);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
+
+			if(sc) {
+				sc->N = N;
+				sd->flag |= bsdf_translucent_setup(sc);
+			}
 			break;
 		}
 		case CLOSURE_BSDF_TRANSPARENT_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
-			bsdf_transparent_setup(sd, sc);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
+
+			if(sc) {
+				sc->N = N;
+				sd->flag |= bsdf_transparent_setup(sc);
+			}
 			break;
 		}
 		case CLOSURE_BSDF_REFLECTION_ID:
@@ -107,18 +159,20 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
 			if(kernel_data.integrator.no_caustics && (path_flag & PATH_RAY_DIFFUSE))
 				break;
 #endif
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
 
-			float roughness = param1;
+			if(sc) {
+				sc->N = N;
+				sc->data0 = param1;
 
-			/* setup bsdf */
-			if(type == CLOSURE_BSDF_REFLECTION_ID)
-				bsdf_reflection_setup(sd, sc);
-			else if(type == CLOSURE_BSDF_MICROFACET_BECKMANN_ID)
-				bsdf_microfacet_beckmann_setup(sd, sc, roughness, 1.0f, false);
-			else
-				bsdf_microfacet_ggx_setup(sd, sc, roughness, 1.0f, false);
+				/* setup bsdf */
+				if(type == CLOSURE_BSDF_REFLECTION_ID)
+					sd->flag |= bsdf_reflection_setup(sc);
+				else if(type == CLOSURE_BSDF_MICROFACET_BECKMANN_ID)
+					sd->flag |= bsdf_microfacet_beckmann_setup(sc);
+				else
+					sd->flag |= bsdf_microfacet_ggx_setup(sc);
+			}
 
 			break;
 		}
@@ -129,67 +183,127 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
 			if(kernel_data.integrator.no_caustics && (path_flag & PATH_RAY_DIFFUSE))
 				break;
 #endif
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
+
+			if(sc) {
+				sc->N = N;
+				sc->data0 = param1;
+
+				float eta = fmaxf(param2, 1.0f + 1e-5f);
+				sc->data1 = (sd->flag & SD_BACKFACING)? 1.0f/eta: eta;
+
+				/* setup bsdf */
+				if(type == CLOSURE_BSDF_REFRACTION_ID)
+					sd->flag |= bsdf_refraction_setup(sc);
+				else if(type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID)
+					sd->flag |= bsdf_microfacet_beckmann_refraction_setup(sc);
+				else
+					sd->flag |= bsdf_microfacet_ggx_refraction_setup(sc);
+			}
+
+			break;
+		}
+		case CLOSURE_BSDF_SHARP_GLASS_ID:
+		case CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID:
+		case CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID: {
+#ifdef __CAUSTICS_TRICKS__
+			if(kernel_data.integrator.no_caustics && (path_flag & PATH_RAY_DIFFUSE))
+				break;
+#endif
 			/* index of refraction */
 			float eta = fmaxf(param2, 1.0f + 1e-5f);
 			eta = (sd->flag & SD_BACKFACING)? 1.0f/eta: eta;
 
 			/* fresnel */
-			float cosNO = dot(sd->N, sd->I);
+			float cosNO = dot(N, sd->I);
 			float fresnel = fresnel_dielectric_cos(cosNO, eta);
 			float roughness = param1;
 
 #ifdef __MULTI_CLOSURE__
 			/* reflection */
-			ShaderClosure *sc = svm_node_closure_get(sd);
-
+			ShaderClosure *sc = &sd->closure[sd->num_closure];
 			float3 weight = sc->weight;
 			float sample_weight = sc->sample_weight;
 
-			svm_node_closure_set_mix_weight(sc, mix_weight*fresnel);
-			svm_node_glossy_setup(sd, sc, type, eta, roughness, false);
+			sc = svm_node_closure_get_bsdf(sd, mix_weight*fresnel);
 
-			/* refraction */
-			sc = svm_node_closure_get(sd);
+			if(sc) {
+				sc->N = N;
+				svm_node_glass_setup(sd, sc, type, eta, roughness, false);
+			}
 
+			/* refraction */
+			sc = &sd->closure[sd->num_closure];
 			sc->weight = weight;
 			sc->sample_weight = sample_weight;
 
-			svm_node_closure_set_mix_weight(sc, mix_weight*(1.0f - fresnel));
-			svm_node_glossy_setup(sd, sc, type, eta, roughness, true);
-#else
-			ShaderClosure *sc = svm_node_closure_get(sd);
+			sc = svm_node_closure_get_bsdf(sd, mix_weight*(1.0f - fresnel));
 
-			bool refract = (randb > fresnel);
+			if(sc) {
+				sc->N = N;
+				svm_node_glass_setup(sd, sc, type, eta, roughness, true);
+			}
+#else
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
 
-			svm_node_closure_set_mix_weight(sc, mix_weight);
-			svm_node_glossy_setup(sd, sc, type, eta, roughness, refract);
+			if(sc) {
+				sc->N = N;
+				bool refract = (randb > fresnel);
+				svm_node_glass_setup(sd, sc, type, eta, roughness, refract);
+			}
 #endif
 
 			break;
 		}
-#ifdef __DPDU__
 		case CLOSURE_BSDF_WARD_ID: {
 #ifdef __CAUSTICS_TRICKS__
 			if(kernel_data.integrator.no_caustics && (path_flag & PATH_RAY_DIFFUSE))
 				break;
 #endif
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
+
+			if(sc) {
+				sc->N = N;
 
-			float roughness_u = param1;
-			float roughness_v = param2;
+#ifdef __ANISOTROPIC__
+				sc->T = stack_load_float3(stack, data_node.z);
 
-			bsdf_ward_setup(sd, sc, normalize(sd->dPdu), roughness_u, roughness_v);
+				/* rotate tangent */
+				float rotation = stack_load_float(stack, data_node.w);
+
+				if(rotation != 0.0f)
+					sc->T = rotate_around_axis(sc->T, sc->N, rotation * 2.0f * M_PI_F);
+
+				/* compute roughness */
+				float roughness = param1;
+				float anisotropy = clamp(param2, -0.99f, 0.99f);
+
+				if(anisotropy < 0.0f) {
+					sc->data0 = roughness/(1.0f + anisotropy);
+					sc->data1 = roughness*(1.0f + anisotropy);
+				}
+				else {
+					sc->data0 = roughness*(1.0f - anisotropy);
+					sc->data1 = roughness/(1.0f - anisotropy);
+				}
+
+				sd->flag |= bsdf_ward_setup(sc);
+#else
+				sd->flag |= bsdf_diffuse_setup(sc);
+#endif
+			}
 			break;
 		}
-#endif
 		case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
+
+			if(sc) {
+				sc->N = N;
 
-			/* sigma */
-			float sigma = clamp(param1, 0.0f, 1.0f);
-			bsdf_ashikhmin_velvet_setup(sd, sc, sigma);
+				/* sigma */
+				sc->data0 = clamp(param1, 0.0f, 1.0f);
+				sd->flag |= bsdf_ashikhmin_velvet_setup(sc);
+			}
 			break;
 		}
 		default:
@@ -218,19 +332,21 @@ __device void svm_node_closure_volume(KernelGlobals *kg, ShaderData *sd, float *
 
 	switch(type) {
 		case CLOSURE_VOLUME_TRANSPARENT_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
 
-			float density = param1;
-			volume_transparent_setup(sd, sc, density);
+			if(sc) {
+				float density = param1;
+				sd->flag |= volume_transparent_setup(sc, density);
+			}
 			break;
 		}
 		case CLOSURE_VOLUME_ISOTROPIC_ID: {
-			ShaderClosure *sc = svm_node_closure_get(sd);
-			svm_node_closure_set_mix_weight(sc, mix_weight);
+			ShaderClosure *sc = svm_node_closure_get_bsdf(sd, mix_weight);
 
-			float density = param1;
-			volume_isotropic_setup(sd, sc, density);
+			if(sc) {
+				float density = param1;
+				sd->flag |= volume_isotropic_setup(sc, density);
+			}
 			break;
 		}
 		default:
@@ -249,15 +365,10 @@ __device void svm_node_closure_emission(ShaderData *sd, float *stack, uint4 node
 		if(mix_weight == 0.0f)
 			return;
 
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->weight *= mix_weight;
-		sc->type = CLOSURE_EMISSION_ID;
-	}
-	else {
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->type = CLOSURE_EMISSION_ID;
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_EMISSION_ID, mix_weight);
 	}
-
+	else
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_EMISSION_ID, 1.0f);
 #else
 	ShaderClosure *sc = &sd->closure;
 	sc->type = CLOSURE_EMISSION_ID;
@@ -277,15 +388,10 @@ __device void svm_node_closure_background(ShaderData *sd, float *stack, uint4 no
 		if(mix_weight == 0.0f)
 			return;
 
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->weight *= mix_weight;
-		sc->type = CLOSURE_BACKGROUND_ID;
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_BACKGROUND_ID, mix_weight);
 	}
-	else {
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->type = CLOSURE_BACKGROUND_ID;
-	}
-
+	else
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_BACKGROUND_ID, 1.0f);
 #else
 	ShaderClosure *sc = &sd->closure;
 	sc->type = CLOSURE_BACKGROUND_ID;
@@ -303,15 +409,10 @@ __device void svm_node_closure_holdout(ShaderData *sd, float *stack, uint4 node)
 		if(mix_weight == 0.0f)
 			return;
 
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->weight = make_float3(mix_weight, mix_weight, mix_weight);
-		sc->type = CLOSURE_HOLDOUT_ID;
-	}
-	else {
-		ShaderClosure *sc = svm_node_closure_get(sd);
-		sc->weight = make_float3(1.0f, 1.0f, 1.0f);
-		sc->type = CLOSURE_HOLDOUT_ID;
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_HOLDOUT_ID, mix_weight);
 	}
+	else
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_HOLDOUT_ID, 1.0f);
 #else
 	ShaderClosure *sc = &sd->closure;
 	sc->type = CLOSURE_HOLDOUT_ID;
@@ -320,12 +421,36 @@ __device void svm_node_closure_holdout(ShaderData *sd, float *stack, uint4 node)
 	sd->flag |= SD_HOLDOUT;
 }
 
+__device void svm_node_closure_ambient_occlusion(ShaderData *sd, float *stack, uint4 node)
+{
+#ifdef __MULTI_CLOSURE__
+	uint mix_weight_offset = node.y;
+
+	if(stack_valid(mix_weight_offset)) {
+		float mix_weight = stack_load_float(stack, mix_weight_offset);
+
+		if(mix_weight == 0.0f)
+			return;
+
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_AMBIENT_OCCLUSION_ID, mix_weight);
+	}
+	else
+		svm_node_closure_get_non_bsdf(sd, CLOSURE_AMBIENT_OCCLUSION_ID, 1.0f);
+#else
+	ShaderClosure *sc = &sd->closure;
+	sc->type = CLOSURE_AMBIENT_OCCLUSION_ID;
+#endif
+
+	sd->flag |= SD_AO;
+}
+
 /* Closure Nodes */
 
 __device_inline void svm_node_closure_store_weight(ShaderData *sd, float3 weight)
 {
 #ifdef __MULTI_CLOSURE__
-	sd->closure[sd->num_closure].weight = weight;
+	if(sd->num_closure < MAX_CLOSURE)
+		sd->closure[sd->num_closure].weight = weight;
 #else
 	sd->closure.weight = weight;
 #endif
@@ -425,5 +550,14 @@ __device void svm_node_add_closure(ShaderData *sd, float *stack, uint unused,
 #endif
 }
 
+/* (Bump) normal */
+
+__device void svm_node_set_normal(KernelGlobals *kg, ShaderData *sd, float *stack, uint in_direction, uint out_normal)
+{
+	float3 normal = stack_load_float3(stack, in_direction);
+	sd->N = normal;
+	stack_store_float3(stack, out_normal, normal);
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/svm/svm_convert.h b/intern/cycles/kernel/svm/svm_convert.h
index 188b048..f74915a 100644
--- a/intern/cycles/kernel/svm/svm_convert.h
+++ b/intern/cycles/kernel/svm/svm_convert.h
@@ -23,6 +23,11 @@ CCL_NAMESPACE_BEGIN
 __device void svm_node_convert(ShaderData *sd, float *stack, uint type, uint from, uint to)
 {
 	switch(type) {
+		case NODE_CONVERT_FI: {
+			float f = stack_load_float(stack, from);
+			stack_store_int(stack, to, (int)f);
+			break;
+		}
 		case NODE_CONVERT_FV: {
 			float f = stack_load_float(stack, from);
 			stack_store_float3(stack, to, make_float3(f, f, f));
@@ -34,13 +39,34 @@ __device void svm_node_convert(ShaderData *sd, float *stack, uint type, uint fro
 			stack_store_float(stack, to, g);
 			break;
 		}
+		case NODE_CONVERT_CI: {
+			float3 f = stack_load_float3(stack, from);
+			int i = (int)linear_rgb_to_gray(f);
+			stack_store_int(stack, to, i);
+			break;
+		}
 		case NODE_CONVERT_VF: {
 			float3 f = stack_load_float3(stack, from);
 			float g = (f.x + f.y + f.z)*(1.0f/3.0f);
 			stack_store_float(stack, to, g);
 			break;
 		}
-
+		case NODE_CONVERT_VI: {
+			float3 f = stack_load_float3(stack, from);
+			int i = (f.x + f.y + f.z)*(1.0f/3.0f);
+			stack_store_int(stack, to, i);
+			break;
+		}
+		case NODE_CONVERT_IF: {
+			float f = (float)stack_load_int(stack, from);
+			stack_store_float(stack, to, f);
+			break;
+		}
+		case NODE_CONVERT_IV: {
+			float f = (float)stack_load_int(stack, from);
+			stack_store_float3(stack, to, make_float3(f, f, f));
+			break;
+		}
 	}
 }
 
diff --git a/intern/cycles/kernel/svm/svm_displace.h b/intern/cycles/kernel/svm/svm_displace.h
index b1677f6..92f2399 100644
--- a/intern/cycles/kernel/svm/svm_displace.h
+++ b/intern/cycles/kernel/svm/svm_displace.h
@@ -20,23 +20,35 @@ CCL_NAMESPACE_BEGIN
 
 /* Bump Node */
 
-__device void svm_node_set_bump(ShaderData *sd, float *stack, uint c_offset, uint x_offset, uint y_offset)
+__device void svm_node_set_bump(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
 {
 #ifdef __RAY_DIFFERENTIALS__
+	/* get normal input */
+	float3 normal_in = stack_valid(node.y)? stack_load_float3(stack, node.y): sd->N;
+
+	/* get surface tangents from normal */
+	float3 Rx = cross(sd->dP.dy, normal_in);
+	float3 Ry = cross(normal_in, sd->dP.dx);
+
+	/* get bump values */
+	uint c_offset, x_offset, y_offset, intensity_offset;
+	decode_node_uchar4(node.z, &c_offset, &x_offset, &y_offset, &intensity_offset);
+
 	float h_c = stack_load_float(stack, c_offset);
 	float h_x = stack_load_float(stack, x_offset);
 	float h_y = stack_load_float(stack, y_offset);
 
-	float3 Rx = cross(sd->dP.dy, sd->N);
-	float3 Ry = cross(sd->N, sd->dP.dx);
-
+	/* compute surface gradient and determinant */
 	float det = dot(sd->dP.dx, Rx);
 	float3 surfgrad = (h_x - h_c)*Rx + (h_y - h_c)*Ry;
+	float intensity = stack_load_float(stack, intensity_offset);
 
-	surfgrad *= 0.1f; /* todo: remove this factor */
-
+	surfgrad *= intensity;
 	float absdet = fabsf(det);
-	sd->N = normalize(absdet*sd->N - signf(det)*surfgrad);
+
+	/* compute and output perturbed normal */
+	float3 outN = normalize(absdet*normal_in - signf(det)*surfgrad);
+	stack_store_float3(stack, node.w, outN);
 #endif
 }
 
diff --git a/intern/cycles/kernel/svm/svm_fresnel.h b/intern/cycles/kernel/svm/svm_fresnel.h
index 7684eab..d5b415a 100644
--- a/intern/cycles/kernel/svm/svm_fresnel.h
+++ b/intern/cycles/kernel/svm/svm_fresnel.h
@@ -54,7 +54,7 @@ __device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node)
 		f = fabsf(dot(sd->I, sd->N));
 
 		if(blend != 0.5f) {
-			blend = clamp(blend, 0.0f, 1.0f);
+			blend = clamp(blend, 0.0f, 1.0f-1e-5f);
 			blend = (blend < 0.5f)? 2.0f*blend: 0.5f/(1.0f - blend);
 
 			f = powf(f, blend);
diff --git a/intern/cycles/kernel/svm/svm_geometry.h b/intern/cycles/kernel/svm/svm_geometry.h
index 22741bd..c4d03c1 100644
--- a/intern/cycles/kernel/svm/svm_geometry.h
+++ b/intern/cycles/kernel/svm/svm_geometry.h
@@ -20,7 +20,7 @@ CCL_NAMESPACE_BEGIN
 
 /* Geometry Node */
 
-__device void svm_node_geometry(ShaderData *sd, float *stack, uint type, uint out_offset)
+__device void svm_node_geometry(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
 {
 	float3 data;
 
@@ -28,7 +28,23 @@ __device void svm_node_geometry(ShaderData *sd, float *stack, uint type, uint ou
 		case NODE_GEOM_P: data = sd->P; break;
 		case NODE_GEOM_N: data = sd->N; break;
 #ifdef __DPDU__
-		case NODE_GEOM_T: data = normalize(sd->dPdu); break;
+		case NODE_GEOM_T: {
+			/* try to create spherical tangent from generated coordinates */
+			int attr_offset = (sd->object != ~0)? find_attribute(kg, sd, ATTR_STD_GENERATED): ATTR_STD_NOT_FOUND;
+
+			if(attr_offset != ATTR_STD_NOT_FOUND) {
+				data = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_VERTEX, attr_offset, NULL, NULL);
+				data = make_float3(-(data.y - 0.5f), (data.x - 0.5f), 0.0f);
+				object_normal_transform(kg, sd, &data);
+				data = cross(sd->N, normalize(cross(data, sd->N)));;
+			}
+			else {
+				/* otherwise use surface derivatives */
+				data = normalize(sd->dPdu);
+			}
+
+			break;
+		}
 #endif
 		case NODE_GEOM_I: data = sd->I; break;
 		case NODE_GEOM_Ng: data = sd->Ng; break;
@@ -40,7 +56,7 @@ __device void svm_node_geometry(ShaderData *sd, float *stack, uint type, uint ou
 	stack_store_float3(stack, out_offset, data);
 }
 
-__device void svm_node_geometry_bump_dx(ShaderData *sd, float *stack, uint type, uint out_offset)
+__device void svm_node_geometry_bump_dx(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
 {
 #ifdef __RAY_DIFFERENTIALS__
 	float3 data;
@@ -48,16 +64,16 @@ __device void svm_node_geometry_bump_dx(ShaderData *sd, float *stack, uint type,
 	switch(type) {
 		case NODE_GEOM_P: data = sd->P + sd->dP.dx; break;
 		case NODE_GEOM_uv: data = make_float3(sd->u + sd->du.dx, sd->v + sd->dv.dx, 0.0f); break;
-		default: svm_node_geometry(sd, stack, type, out_offset); return;
+		default: svm_node_geometry(kg, sd, stack, type, out_offset); return;
 	}
 
 	stack_store_float3(stack, out_offset, data);
 #else
-	svm_node_geometry(sd, stack, type, out_offset);
+	svm_node_geometry(kg, sd, stack, type, out_offset);
 #endif
 }
 
-__device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type, uint out_offset)
+__device void svm_node_geometry_bump_dy(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
 {
 #ifdef __RAY_DIFFERENTIALS__
 	float3 data;
@@ -65,12 +81,12 @@ __device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type,
 	switch(type) {
 		case NODE_GEOM_P: data = sd->P + sd->dP.dy; break;
 		case NODE_GEOM_uv: data = make_float3(sd->u + sd->du.dy, sd->v + sd->dv.dy, 0.0f); break;
-		default: svm_node_geometry(sd, stack, type, out_offset); return;
+		default: svm_node_geometry(kg, sd, stack, type, out_offset); return;
 	}
 
 	stack_store_float3(stack, out_offset, data);
 #else
-	svm_node_geometry(sd, stack, type, out_offset);
+	svm_node_geometry(kg, sd, stack, type, out_offset);
 #endif
 }
 
diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h
index bce11d6..26b6141 100644
--- a/intern/cycles/kernel/svm/svm_hsv.h
+++ b/intern/cycles/kernel/svm/svm_hsv.h
@@ -110,7 +110,7 @@ __device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, uint
 
 	color = rgb_to_hsv(color);
 
-	// remember: fmod doesn't work for negative numbers
+	/* remember: fmod doesn't work for negative numbers here */
 	color.x += hue + 0.5f;
 	color.x = fmod(color.x, 1.0f);
 	color.y *= sat;
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index 6624194..0894c9c 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -52,6 +52,12 @@ __device_inline float svm_image_texture_frac(float x, int *ix)
 
 __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb)
 {
+	/* first slots are used by float textures, which are not supported here */
+	if(id < TEX_NUM_FLOAT_IMAGES)
+		return make_float4(1.0f, 0.0f, 1.0f, 1.0f);
+
+	id -= TEX_NUM_FLOAT_IMAGES;
+
 	uint4 info = kernel_tex_fetch(__tex_image_packed_info, id);
 	uint width = info.x;
 	uint height = info.y;
@@ -265,7 +271,7 @@ __device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float *s
 	 * between three textures.
 	 *
 	 * the Nxyz values are the barycentric coordinates in an equilateral
-	 * triangle, which in case of blending in the middle has a smaller
+	 * triangle, which in case of blending, in the middle has a smaller
 	 * equilateral triangle where 3 textures blend. this divides things into
 	 * 7 zones, with an if() test for each zone */
 
diff --git a/intern/cycles/kernel/svm/svm_math.h b/intern/cycles/kernel/svm/svm_math.h
index e39c7a4..db3b8d3 100644
--- a/intern/cycles/kernel/svm/svm_math.h
+++ b/intern/cycles/kernel/svm/svm_math.h
@@ -38,6 +38,21 @@ __device float safe_acosf(float a)
 	return acosf(a);
 }
 
+__device float compatible_powf(float x, float y)
+{
+	/* GPU pow doesn't accept negative x, do manual checks here */
+	if(x < 0.0f) {
+		if(fmod(-y, 2.0f) == 0.0f)
+			return powf(-x, y);
+		else
+			return -powf(-x, y);
+	}
+	else if(x == 0.0f)
+		return 0.0f;
+
+	return powf(x, y);
+}
+
 __device float safe_powf(float a, float b)
 {
 	if(b == 0.0f)
@@ -47,7 +62,7 @@ __device float safe_powf(float a, float b)
 	if(a < 0.0f && b != (int)b)
 		return 0.0f;
 	
-	return powf(a, b);
+	return compatible_powf(a, b);
 }
 
 __device float safe_logf(float a, float b)
diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h
index 55c2b3f..c64413c 100644
--- a/intern/cycles/kernel/svm/svm_ramp.h
+++ b/intern/cycles/kernel/svm/svm_ramp.h
@@ -25,7 +25,8 @@ __device float4 rgb_ramp_lookup(KernelGlobals *kg, int offset, float f)
 {
 	f = clamp(f, 0.0f, 1.0f)*(RAMP_TABLE_SIZE-1);
 
-	int i = (int)f;
+	/* clamp int as well in case of NaN */
+	int i = clamp((int)f, 0, RAMP_TABLE_SIZE-1);
 	float t = f - (float)i;
 
 	float4 a = fetch_node_float(kg, offset+i);
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h
index 6bd8f2a..9f2d336 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -20,17 +20,19 @@ CCL_NAMESPACE_BEGIN
 
 /* Texture Coordinate Node */
 
-__device_inline float3 svm_background_offset(KernelGlobals *kg)
+__device_inline float3 svm_background_position(KernelGlobals *kg, float3 P)
 {
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
-	return make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+	float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+
+	return camP + P;
 }
 
 __device_inline float3 svm_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float3 P)
 {
 	if(kernel_data.cam.type != CAMERA_PANORAMA) {
 		if(sd->object == ~0)
-			P += svm_background_offset(kg);
+			P = svm_background_position(kg, P);
 
 		Transform tfm = kernel_data.cam.worldtondc;
 		return transform_perspective(&tfm, P);
@@ -78,11 +80,12 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
 			if(sd->object != ~0)
 				data = transform_point(&tfm, sd->P);
 			else
-				data = transform_point(&tfm, sd->P + svm_background_offset(kg));
+				data = transform_point(&tfm, svm_background_position(kg, sd->P));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			data = svm_world_to_ndc(kg, sd, sd->P);
+			data.z = 0.0f;
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
@@ -135,11 +138,12 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
 			if(sd->object != ~0)
 				data = transform_point(&tfm, sd->P + sd->dP.dx);
 			else
-				data = transform_point(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+				data = transform_point(&tfm, svm_background_position(kg, sd->P + sd->dP.dx));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dx);
+			data.z = 0.0f;
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
@@ -195,11 +199,12 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
 			if(sd->object != ~0)
 				data = transform_point(&tfm, sd->P + sd->dP.dy);
 			else
-				data = transform_point(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+				data = transform_point(&tfm, svm_background_position(kg, sd->P + sd->dP.dy));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dy);
+			data.z = 0.0f;
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
@@ -225,5 +230,100 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
 #endif
 }
 
+__device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
+{
+	uint color_offset, strength_offset, normal_offset, space;
+	decode_node_uchar4(node.y, &color_offset, &strength_offset, &normal_offset, &space);
+
+	float3 color = stack_load_float3(stack, color_offset);
+	color = 2.0f*make_float3(color.x - 0.5f, color.y - 0.5f, color.z - 0.5f);
+
+	float3 N;
+
+	if(space == NODE_NORMAL_MAP_TANGENT) {
+		/* tangent space */
+		if(sd->object == ~0) {
+			stack_store_float3(stack, normal_offset, make_float3(0.0f, 0.0f, 0.0f));
+			return;
+		}
+
+		/* first try to get tangent attribute */
+		int attr_offset = find_attribute(kg, sd, node.z);
+		int attr_sign_offset = find_attribute(kg, sd, node.w);
+
+		if(attr_offset == ATTR_STD_NOT_FOUND || attr_sign_offset == ATTR_STD_NOT_FOUND) {
+			stack_store_float3(stack, normal_offset, make_float3(0.0f, 0.0f, 0.0f));
+			return;
+		}
+
+		/* ensure orthogonal and normalized (interpolation breaks it) */
+		float3 tangent = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_CORNER, attr_offset, NULL, NULL);
+		float sign = triangle_attribute_float(kg, sd, ATTR_ELEMENT_CORNER, attr_sign_offset, NULL, NULL);
+
+		object_normal_transform(kg, sd, &tangent);
+		tangent = cross(sd->N, normalize(cross(tangent, sd->N)));;
+
+		float3 B = sign * cross(sd->N, tangent);
+		N = normalize(color.x * tangent + color.y * B + color.z * sd->N);
+	}
+	else {
+		/* object, world space */
+		N = color;
+
+		if(space == NODE_NORMAL_MAP_OBJECT)
+			object_normal_transform(kg, sd, &N);
+
+		N = normalize(N);
+	}
+
+	float strength = stack_load_float(stack, strength_offset);
+
+	if(strength != 1.0f) {
+		strength = max(strength, 0.0f);
+		N = normalize(sd->N + (N - sd->N)*strength);
+	}
+
+	stack_store_float3(stack, normal_offset, N);
+}
+
+__device void svm_node_tangent(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
+{
+	uint tangent_offset, direction_type, axis;
+	decode_node_uchar4(node.y, &tangent_offset, &direction_type, &axis, NULL);
+
+	float3 tangent;
+
+	if(direction_type == NODE_TANGENT_UVMAP) {
+		/* UV map */
+		int attr_offset = find_attribute(kg, sd, node.z);
+
+		if(attr_offset == ATTR_STD_NOT_FOUND)
+			tangent = make_float3(0.0f, 0.0f, 0.0f);
+		else
+			tangent = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_CORNER, attr_offset, NULL, NULL);
+	}
+	else {
+		/* radial */
+		int attr_offset = find_attribute(kg, sd, node.z);
+		float3 generated;
+
+		if(attr_offset == ATTR_STD_NOT_FOUND)
+			generated = sd->P;
+		else
+			generated = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_VERTEX, attr_offset, NULL, NULL);
+
+		if(axis == NODE_TANGENT_AXIS_X)
+			tangent = make_float3(0.0f, -(generated.z - 0.5f), (generated.y - 0.5f));
+		else if(axis == NODE_TANGENT_AXIS_Y)
+			tangent = make_float3(-(generated.z - 0.5f), 0.0f, (generated.x - 0.5f));
+		else
+			tangent = make_float3(-(generated.y - 0.5f), (generated.x - 0.5f), 0.0f);
+	}
+
+	object_normal_transform(kg, sd, &tangent);
+	tangent = cross(sd->N, normalize(cross(tangent, sd->N)));
+	stack_store_float3(stack, tangent_offset, tangent);
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h
index 6c22d98..a4f6691 100644
--- a/intern/cycles/kernel/svm/svm_texture.h
+++ b/intern/cycles/kernel/svm/svm_texture.h
@@ -42,8 +42,12 @@ __device float voronoi_distance(NodeDistanceMetric distance_metric, float3 d, fl
 
 /* Voronoi / Worley like */
 
-__device_noinline void voronoi(float3 p, NodeDistanceMetric distance_metric, float e, float da[4], float3 pa[4])
+__device_noinline float4 voronoi_Fn(float3 p, float e, int n1, int n2)
 {
+	float da[4];
+	float3 pa[4];
+	NodeDistanceMetric distance_metric = NODE_VORONOI_DISTANCE_SQUARED;
+
 	/* returns distances in da and point coords in pa */
 	int xx, yy, zz, xi, yi, zi;
 
@@ -105,33 +109,20 @@ __device_noinline void voronoi(float3 p, NodeDistanceMetric distance_metric, flo
 			}
 		}
 	}
-}
-
-__device float voronoi_Fn(float3 p, int n)
-{
-	float da[4];
-	float3 pa[4];
-
-	voronoi(p, NODE_VORONOI_DISTANCE_SQUARED, 0, da, pa);
-
-	return da[n];
-}
 
-__device float voronoi_FnFn(float3 p, int n1, int n2)
-{
-	float da[4];
-	float3 pa[4];
+	float4 result = make_float4(pa[n1].x, pa[n1].y, pa[n1].z, da[n1]);
 
-	voronoi(p, NODE_VORONOI_DISTANCE_SQUARED, 0, da, pa);
+	if(n2 != -1)
+		result = make_float4(pa[n2].x, pa[n2].y, pa[n2].z, da[n2]) - result;
 
-	return da[n2] - da[n1];
+	return result;
 }
 
-__device float voronoi_F1(float3 p) { return voronoi_Fn(p, 0); }
-__device float voronoi_F2(float3 p) { return voronoi_Fn(p, 1); }
-__device float voronoi_F3(float3 p) { return voronoi_Fn(p, 2); }
-__device float voronoi_F4(float3 p) { return voronoi_Fn(p, 3); }
-__device float voronoi_F1F2(float3 p) { return voronoi_FnFn(p, 0, 1); }
+__device float voronoi_F1(float3 p) { return voronoi_Fn(p, 0.0f, 0, -1).w; }
+__device float voronoi_F2(float3 p) { return voronoi_Fn(p, 0.0f, 1, -1).w; }
+__device float voronoi_F3(float3 p) { return voronoi_Fn(p, 0.0f, 2, -1).w; }
+__device float voronoi_F4(float3 p) { return voronoi_Fn(p, 0.0f, 3, -1).w; }
+__device float voronoi_F1F2(float3 p) { return voronoi_Fn(p, 0.0f, 0, 1).w; }
 
 __device float voronoi_Cr(float3 p)
 {
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index ee42357..b41e34a 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -92,7 +92,11 @@ typedef enum NodeType {
 	NODE_LIGHT_FALLOFF,
 	NODE_OBJECT_INFO,
 	NODE_PARTICLE_INFO,
-	NODE_TEX_BRICK
+	NODE_TEX_BRICK,
+	NODE_CLOSURE_SET_NORMAL,
+	NODE_CLOSURE_AMBIENT_OCCLUSION,
+	NODE_TANGENT,
+	NODE_NORMAL_MAP
 } NodeType;
 
 typedef enum NodeAttributeType {
@@ -209,8 +213,13 @@ typedef enum NodeVectorMath {
 
 typedef enum NodeConvert {
 	NODE_CONVERT_FV,
+	NODE_CONVERT_FI,
 	NODE_CONVERT_CF,
-	NODE_CONVERT_VF
+	NODE_CONVERT_CI,
+	NODE_CONVERT_VF,
+	NODE_CONVERT_VI,
+	NODE_CONVERT_IF,
+	NODE_CONVERT_IV
 } NodeConvert;
 
 typedef enum NodeDistanceMetric {
@@ -273,6 +282,23 @@ typedef enum NodeBlendWeightType {
 	NODE_LAYER_WEIGHT_FACING
 } NodeBlendWeightType;
 
+typedef enum NodeTangentDirectionType {
+	NODE_TANGENT_RADIAL,
+	NODE_TANGENT_UVMAP
+} NodeTangentDirectionType;
+
+typedef enum NodeTangentAxis {
+	NODE_TANGENT_AXIS_X,
+	NODE_TANGENT_AXIS_Y,
+	NODE_TANGENT_AXIS_Z
+} NodeTangentAxis;
+
+typedef enum NodeNormalMapSpace {
+	NODE_NORMAL_MAP_TANGENT,
+	NODE_NORMAL_MAP_OBJECT,
+	NODE_NORMAL_MAP_WORLD
+} NodeNormalMapSpace;
+
 typedef enum ShaderType {
 	SHADER_TYPE_SURFACE,
 	SHADER_TYPE_VOLUME,
@@ -294,6 +320,7 @@ typedef enum ClosureType {
 	CLOSURE_BSDF_WARD_ID,
 	CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
 	CLOSURE_BSDF_WESTIN_SHEEN_ID,
+	CLOSURE_BSDF_PHONG_RAMP_ID,
 
 	CLOSURE_BSDF_TRANSMISSION_ID,
 	CLOSURE_BSDF_TRANSLUCENT_ID,
@@ -301,7 +328,9 @@ typedef enum ClosureType {
 	CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
 	CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
 	CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
-	CLOSURE_BSDF_GLASS_ID,
+	CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID,
+	CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID,
+	CLOSURE_BSDF_SHARP_GLASS_ID,
 
 	CLOSURE_BSDF_TRANSPARENT_ID,
 
@@ -311,6 +340,7 @@ typedef enum ClosureType {
 	CLOSURE_BACKGROUND_ID,
 	CLOSURE_HOLDOUT_ID,
 	CLOSURE_SUBSURFACE_ID,
+	CLOSURE_AMBIENT_OCCLUSION_ID,
 
 	CLOSURE_VOLUME_ID,
 	CLOSURE_VOLUME_TRANSPARENT_ID,
@@ -322,12 +352,13 @@ typedef enum ClosureType {
 /* watch this, being lazy with memory usage */
 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
 #define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_OREN_NAYAR_ID)
-#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
-#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_GLASS_ID)
+#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_PHONG_RAMP_ID)
+#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_SHARP_GLASS_ID)
 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
+#define CLOSURE_IS_AMBIENT_OCCLUSION(type) (type == CLOSURE_AMBIENT_OCCLUSION_ID)
 
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h
index 7e7bd97..55110d0 100644
--- a/intern/cycles/kernel/svm/svm_voronoi.h
+++ b/intern/cycles/kernel/svm/svm_voronoi.h
@@ -23,21 +23,18 @@ CCL_NAMESPACE_BEGIN
 __device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float scale, float3 p)
 {
 	/* compute distance and point coordinate of 4 nearest neighbours */
-	float da[4];
-	float3 pa[4];
-
-	voronoi(p*scale, NODE_VORONOI_DISTANCE_SQUARED, 1.0f, da, pa);
+	float4 dpa0 = voronoi_Fn(p*scale, 1.0f, 0, -1);
 
 	/* output */
 	float fac;
 	float3 color;
 
 	if(coloring == NODE_VORONOI_INTENSITY) {
-		fac = fabsf(da[0]);
+		fac = fabsf(dpa0.w);
 		color = make_float3(fac, fac, fac);
 	}
 	else {
-		color = cellnoise_color(pa[0]);
+		color = cellnoise_color(float4_to_float3(dpa0));
 		fac = average(color);
 	}
 
diff --git a/intern/cycles/kernel/svm/volume.h b/intern/cycles/kernel/svm/volume.h
deleted file mode 100644
index 10e9c5d..0000000
--- a/intern/cycles/kernel/svm/volume.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-CCL_NAMESPACE_BEGIN
-
-/* note: the interfaces here are just as an example, need to figure
- * out the right functions and parameters to use */
-
-/* ISOTROPIC VOLUME CLOSURE */
-
-__device void volume_isotropic_setup(ShaderData *sd, ShaderClosure *sc, float density)
-{
-	sc->type = CLOSURE_VOLUME_ISOTROPIC_ID;
-	sd->flag |= SD_VOLUME;
-	sc->data0 = density;
-}
-
-__device float3 volume_isotropic_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
-{
-	return make_float3(1.0f, 1.0f, 1.0f);
-}
-
-/* TRANSPARENT VOLUME CLOSURE */
-
-__device void volume_transparent_setup(ShaderData *sd, ShaderClosure *sc, float density)
-{
-	sc->type = CLOSURE_VOLUME_TRANSPARENT_ID;
-	sd->flag |= SD_VOLUME;
-	sc->data0 = density;
-}
-
-__device float3 volume_transparent_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
-{
-	return make_float3(1.0f, 1.0f, 1.0f);
-}
-
-/* VOLUME CLOSURE */
-
-__device float3 volume_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
-{
-	float3 eval;
-
-	switch(sc->type) {
-		case CLOSURE_VOLUME_ISOTROPIC_ID:
-			eval = volume_isotropic_eval_phase(sd, sc, omega_in, omega_out);
-			break;
-		case CLOSURE_VOLUME_TRANSPARENT_ID:
-			eval = volume_transparent_eval_phase(sd, sc, omega_in, omega_out);
-			break;
-		default:
-			eval = make_float3(0.0f, 0.0f, 0.0f);
-			break;
-	}
-
-	return eval;
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt
index e75a3b3..7907061 100644
--- a/intern/cycles/render/CMakeLists.txt
+++ b/intern/cycles/render/CMakeLists.txt
@@ -8,6 +8,7 @@ set(INC
 	../bvh
 	../util
 )
+
 set(INC_SYS
 	${GLEW_INCLUDE_PATH}
 )
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index 5122c1a..95941c1 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -162,6 +162,10 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
 		attr = add(name, TypeDesc::TypeNormal, Attribute::FACE);
 	else if(std == ATTR_STD_UV)
 		attr = add(name, TypeDesc::TypePoint, Attribute::CORNER);
+	else if(std == ATTR_STD_UV_TANGENT)
+		attr = add(name, TypeDesc::TypeVector, Attribute::CORNER);
+	else if(std == ATTR_STD_UV_TANGENT_SIGN)
+		attr = add(name, TypeDesc::TypeFloat, Attribute::CORNER);
 	else if(std == ATTR_STD_GENERATED)
 		attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX);
 	else if(std == ATTR_STD_POSITION_UNDEFORMED)
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index 6f8740b..3b61ccd 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -101,7 +101,7 @@ RenderTile::RenderTile()
 
 RenderBuffers::RenderBuffers(Device *device_)
 {
-	device = device_;
+  device = device_;
 }
 
 RenderBuffers::~RenderBuffers()
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 3fd7a1b..a78ede9 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -19,6 +19,8 @@
 #include "camera.h"
 #include "scene.h"
 
+#include "device.h"
+
 #include "util_vector.h"
 
 CCL_NAMESPACE_BEGIN
@@ -53,15 +55,10 @@ Camera::Camera()
 	width = 1024;
 	height = 512;
 
-	left = -((float)width/(float)height);
-	right = (float)width/(float)height;
-	bottom = -1.0f;
-	top = 1.0f;
-
-	border_left = 0.0f;
-	border_right = 1.0f;
-	border_bottom = 0.0f;
-	border_top = 1.0f;
+	viewplane.left = -((float)width/(float)height);
+	viewplane.right = (float)width/(float)height;
+	viewplane.bottom = -1.0f;
+	viewplane.top = 1.0f;
 
 	screentoworld = transform_identity();
 	rastertoworld = transform_identity();
@@ -92,12 +89,12 @@ void Camera::update()
 	Transform ndctoraster = transform_scale(width, height, 1.0f);
 
 	/* raster to screen */
-	Transform screentoraster = ndctoraster;
-	
-	screentoraster = ndctoraster *
-		transform_scale(1.0f/(right - left), 1.0f/(top - bottom), 1.0f) *
-		transform_translate(-left, -bottom, 0.0f);
+	Transform screentondc = 
+		transform_scale(1.0f/(viewplane.right - viewplane.left),
+		                1.0f/(viewplane.top - viewplane.bottom), 1.0f) *
+		transform_translate(-viewplane.left, -viewplane.bottom, 0.0f);
 
+	Transform screentoraster = ndctoraster * screentondc;
 	Transform rastertoscreen = transform_inverse(screentoraster);
 
 	/* screen to camera */
@@ -107,14 +104,24 @@ void Camera::update()
 		screentocamera = transform_inverse(transform_orthographic(nearclip, farclip));
 	else
 		screentocamera = transform_identity();
+	
+	Transform cameratoscreen = transform_inverse(screentocamera);
 
 	rastertocamera = screentocamera * rastertoscreen;
+	cameratoraster = screentoraster * cameratoscreen;
 
 	cameratoworld = matrix;
 	screentoworld = cameratoworld * screentocamera;
 	rastertoworld = cameratoworld * rastertocamera;
 	ndctoworld = rastertoworld * ndctoraster;
-	worldtoraster = transform_inverse(rastertoworld);
+
+	/* note we recompose matrices instead of taking inverses of the above, this
+	 * is needed to avoid inverting near degenerate matrices that happen due to
+	 * precision issues with large scenes */
+	worldtocamera = transform_inverse(matrix);
+	worldtoscreen = cameratoscreen * worldtocamera;
+	worldtondc = screentondc * worldtoscreen;
+	worldtoraster = ndctoraster * worldtondc;
 
 	/* differentials */
 	if(type == CAMERA_ORTHOGRAPHIC) {
@@ -141,7 +148,7 @@ void Camera::update()
 
 void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 {
-	Scene::MotionType need_motion = scene->need_motion();
+	Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading);
 
 	update();
 
@@ -160,13 +167,12 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 	/* store matrices */
 	kcam->screentoworld = screentoworld;
 	kcam->rastertoworld = rastertoworld;
-	kcam->ndctoworld = ndctoworld;
 	kcam->rastertocamera = rastertocamera;
 	kcam->cameratoworld = cameratoworld;
-	kcam->worldtoscreen = transform_inverse(screentoworld);
+	kcam->worldtocamera = worldtocamera;
+	kcam->worldtoscreen = worldtoscreen;
 	kcam->worldtoraster = worldtoraster;
-	kcam->worldtondc = transform_inverse(ndctoworld);
-	kcam->worldtocamera = transform_inverse(cameratoworld);
+	kcam->worldtondc = worldtondc;
 
 	/* camera motion */
 	kcam->have_motion = 0;
@@ -184,8 +190,8 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 		}
 		else {
 			if(use_motion) {
-				kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
-				kcam->motion.post = transform_inverse(motion.post * rastertocamera);
+				kcam->motion.pre = cameratoraster * transform_inverse(motion.pre);
+				kcam->motion.post = cameratoraster * transform_inverse(motion.post);
 			}
 			else {
 				kcam->motion.pre = worldtoraster;
@@ -193,13 +199,14 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 			}
 		}
 	}
+#ifdef __CAMERA_MOTION__
 	else if(need_motion == Scene::MOTION_BLUR) {
-		/* todo: exact camera position will not be hit this way */
 		if(use_motion) {
-			transform_motion_decompose(&kcam->motion, &motion);
+			transform_motion_decompose((DecompMotionTransform*)&kcam->motion, &motion, &matrix);
 			kcam->have_motion = 1;
 		}
 	}
+#endif
 
 	/* depth of field */
 	kcam->aperturesize = aperturesize;
@@ -208,7 +215,11 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 	kcam->bladesrotation = bladesrotation;
 
 	/* motion blur */
+#ifdef __CAMERA_MOTION__
 	kcam->shuttertime = (need_motion == Scene::MOTION_BLUR) ? shuttertime: 0.0f;
+#else
+	kcam->shuttertime = 0.0f;
+#endif
 
 	/* type */
 	kcam->type = type;
@@ -259,22 +270,20 @@ bool Camera::modified(const Camera& cam)
 		// modified for progressive render
 		// (width == cam.width) &&
 		// (height == cam.height) &&
-		(left == cam.left) &&
-		(right == cam.right) &&
-		(bottom == cam.bottom) &&
-		(top == cam.top) &&
-		(border_left == cam.border_left) &&
-		(border_right == cam.border_right) &&
-		(border_bottom == cam.border_bottom) &&
-		(border_top == cam.border_top) &&
+		(viewplane == cam.viewplane) &&
+		(border == cam.border) &&
 		(matrix == cam.matrix) &&
-		(motion == cam.motion) &&
-		(use_motion == cam.use_motion) &&
 		(panorama_type == cam.panorama_type) &&
 		(fisheye_fov == cam.fisheye_fov) &&
 		(fisheye_lens == cam.fisheye_lens));
 }
 
+bool Camera::motion_modified(const Camera& cam)
+{
+	return !((motion == cam.motion) &&
+		(use_motion == cam.use_motion));
+}
+
 void Camera::tag_update()
 {
 	need_update = true;
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index 82852bd..9696161 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -21,6 +21,7 @@
 
 #include "kernel_types.h"
 
+#include "util_boundbox.h"
 #include "util_transform.h"
 #include "util_types.h"
 
@@ -65,10 +66,10 @@ public:
 
 	/* screen */
 	int width, height;
-	float left, right, bottom, top;
+	BoundBox2D viewplane;
 
 	/* border */
-	float border_left, border_right, border_bottom, border_top;
+	BoundBox2D border;
 
 	/* transformation */
 	Transform matrix;
@@ -81,9 +82,15 @@ public:
 	Transform screentoworld;
 	Transform rastertoworld;
 	Transform ndctoworld;
-	Transform rastertocamera;
 	Transform cameratoworld;
+
 	Transform worldtoraster;
+	Transform worldtoscreen;
+	Transform worldtondc;
+	Transform worldtocamera;
+
+	Transform rastertocamera;
+	Transform cameratoraster;;
 
 	float3 dx;
 	float3 dy;
@@ -103,6 +110,7 @@ public:
 	void device_free(Device *device, DeviceScene *dscene);
 
 	bool modified(const Camera& cam);
+	bool motion_modified(const Camera& cam);
 	void tag_update();
 };
 
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 6275812..14b2193 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -37,7 +37,7 @@ ShaderInput::ShaderInput(ShaderNode *parent_, const char *name_, ShaderSocketTyp
 	value = make_float3(0, 0, 0);
 	stack_offset = SVM_STACK_INVALID;
 	default_value = NONE;
-	osl_only = false;
+	usage = USE_ALL;
 }
 
 ShaderOutput::ShaderOutput(ShaderNode *parent_, const char *name_, ShaderSocketType type_)
@@ -85,27 +85,29 @@ ShaderOutput *ShaderNode::output(const char *name)
 	return NULL;
 }
 
-ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, float value)
+ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, float value, int usage)
 {
 	ShaderInput *input = new ShaderInput(this, name, type);
 	input->value.x = value;
+	input->usage = usage;
 	inputs.push_back(input);
 	return input;
 }
 
-ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, float3 value)
+ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, float3 value, int usage)
 {
 	ShaderInput *input = new ShaderInput(this, name, type);
 	input->value = value;
+	input->usage = usage;
 	inputs.push_back(input);
 	return input;
 }
 
-ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, ShaderInput::DefaultValue value, bool osl_only)
+ShaderInput *ShaderNode::add_input(const char *name, ShaderSocketType type, ShaderInput::DefaultValue value, int usage)
 {
 	ShaderInput *input = add_input(name, type);
 	input->default_value = value;
-	input->osl_only = osl_only;
+	input->usage = usage;
 	return input;
 }
 
@@ -219,7 +221,7 @@ void ShaderGraph::disconnect(ShaderInput *to)
 	from->links.erase(remove(from->links.begin(), from->links.end(), to), from->links.end());
 }
 
-void ShaderGraph::finalize(bool do_bump, bool do_osl)
+void ShaderGraph::finalize(bool do_bump, bool do_osl, bool do_multi_transform)
 {
 	/* before compiling, the shader graph may undergo a number of modifications.
 	 * currently we set default geometry shader inputs, and create automatic bump
@@ -229,9 +231,23 @@ void ShaderGraph::finalize(bool do_bump, bool do_osl)
 	if(!finalized) {
 		clean();
 		default_inputs(do_osl);
+		refine_bump_nodes();
+
 		if(do_bump)
 			bump_from_displacement();
 
+		if(do_multi_transform) {
+			ShaderInput *surface_in = output()->input("Surface");
+			ShaderInput *volume_in = output()->input("Volume");
+
+			/* todo: make this work when surface and volume closures are tangled up */
+
+			if(surface_in->link)
+				transform_multi_closure(surface_in->link->parent, NULL, false);
+			if(volume_in->link)
+				transform_multi_closure(volume_in->link->parent, NULL, true);
+		}
+
 		finalized = true;
 	}
 }
@@ -324,6 +340,7 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
 					
 					/* transfer the default input value to the target socket */
 					to->set(input->value);
+					to->set(input->value_string);
 				}
 			}
 			
@@ -437,7 +454,7 @@ void ShaderGraph::default_inputs(bool do_osl)
 
 	foreach(ShaderNode *node, nodes) {
 		foreach(ShaderInput *input, node->inputs) {
-			if(!input->link && !(input->osl_only && !do_osl)) {
+			if(!input->link && ((input->usage & ShaderInput::USE_SVM) || do_osl)) {
 				if(input->default_value == ShaderInput::TEXTURE_GENERATED) {
 					if(!texco)
 						texco = new TextureCoordinateNode();
@@ -468,6 +485,12 @@ void ShaderGraph::default_inputs(bool do_osl)
 
 					connect(geom->output("Position"), input);
 				}
+				else if(input->default_value == ShaderInput::TANGENT) {
+					if(!geom)
+						geom = new GeometryNode();
+
+					connect(geom->output("Tangent"), input);
+				}
 			}
 		}
 	}
@@ -478,6 +501,61 @@ void ShaderGraph::default_inputs(bool do_osl)
 		add(texco);
 }
 
+void ShaderGraph::refine_bump_nodes()
+{
+	/* we transverse the node graph looking for bump nodes, when we find them,
+	 * like in bump_from_displacement(), we copy the sub-graph defined from "bump"
+	 * input to the inputs "center","dx" and "dy" What is in "bump" input is moved
+	 * to "center" input. */
+
+	foreach(ShaderNode *node, nodes) {
+		if(node->name == ustring("bump") && node->input("Height")->link) {
+			ShaderInput *bump_input = node->input("Height");
+			set<ShaderNode*> nodes_bump;
+
+			/* make 2 extra copies of the subgraph defined in Bump input */
+			map<ShaderNode*, ShaderNode*> nodes_dx;
+			map<ShaderNode*, ShaderNode*> nodes_dy;
+
+			/* find dependencies for the given input */
+			find_dependencies(nodes_bump, bump_input );
+
+			copy_nodes(nodes_bump, nodes_dx);
+			copy_nodes(nodes_bump, nodes_dy);
+	
+			/* mark nodes to indicate they are use for bump computation, so
+			   that any texture coordinates are shifted by dx/dy when sampling */
+			foreach(ShaderNode *node, nodes_bump)
+				node->bump = SHADER_BUMP_CENTER;
+			foreach(NodePair& pair, nodes_dx)
+				pair.second->bump = SHADER_BUMP_DX;
+			foreach(NodePair& pair, nodes_dy)
+				pair.second->bump = SHADER_BUMP_DY;
+
+			ShaderOutput *out = bump_input->link;
+			ShaderOutput *out_dx = nodes_dx[out->parent]->output(out->name);
+			ShaderOutput *out_dy = nodes_dy[out->parent]->output(out->name);
+
+			connect(out_dx, node->input("SampleX"));
+			connect(out_dy, node->input("SampleY"));
+			
+			/* add generated nodes */
+			foreach(NodePair& pair, nodes_dx)
+				add(pair.second);
+			foreach(NodePair& pair, nodes_dy)
+				add(pair.second);
+			
+			/* connect what is conected is bump to samplecenter input*/
+			connect(out , node->input("SampleCenter"));
+
+			/* bump input is just for connectivity purpose for the graph input,
+			 * we reconected this input to samplecenter, so lets disconnect it
+			 * from bump input */
+			disconnect(bump_input);
+		}
+	}
+}
+
 void ShaderGraph::bump_from_displacement()
 {
 	/* generate bump mapping automatically from displacement. bump mapping is
@@ -491,7 +569,7 @@ void ShaderGraph::bump_from_displacement()
 	 * different shifted coordinates.
 	 *
 	 * these 3 displacement values are then fed into the bump node, which will
-	 * modify the normal. */
+	 * output the the perturbed normal. */
 
 	ShaderInput *displacement_in = output()->input("Displacement");
 
@@ -520,6 +598,12 @@ void ShaderGraph::bump_from_displacement()
 	foreach(NodePair& pair, nodes_dy)
 		pair.second->bump = SHADER_BUMP_DY;
 
+	/* add set normal node and connect the bump normal ouput to the set normal
+	 * output, so it can finally set the shader normal, note we are only doing
+	 * this for bump from displacement, this will be the only bump allowed to
+	 * overwrite the shader normal */
+	ShaderNode *set_normal = add(new SetNormalNode());
+	
 	/* add bump node and connect copied graphs to it */
 	ShaderNode *bump = add(new BumpNode());
 
@@ -531,6 +615,9 @@ void ShaderGraph::bump_from_displacement()
 	connect(out_center, bump->input("SampleCenter"));
 	connect(out_dx, bump->input("SampleX"));
 	connect(out_dy, bump->input("SampleY"));
+	
+	/* connect the bump out to the set normal in: */
+	connect(bump->output("Normal"), set_normal->input("Direction"));
 
 	/* connect bump output to normal input nodes that aren't set yet. actually
 	 * this will only set the normal input to the geometry node that we created
@@ -538,8 +625,14 @@ void ShaderGraph::bump_from_displacement()
 	foreach(ShaderNode *node, nodes)
 		foreach(ShaderInput *input, node->inputs)
 			if(!input->link && input->default_value == ShaderInput::NORMAL)
-				connect(bump->output("Normal"), input);
-	
+				connect(set_normal->output("Normal"), input);
+
+	/* for displacement bump, clear the normal input in case the above loop
+	 * connected the setnormal out to the bump normalin */
+	ShaderInput *bump_normal_in = bump->input("NormalIn");
+	if(bump_normal_in)
+		bump_normal_in->link = NULL;
+
 	/* finally, add the copied nodes to the graph. we can't do this earlier
 	 * because we would create dependency cycles in the above loop */
 	foreach(NodePair& pair, nodes_center)
@@ -550,5 +643,81 @@ void ShaderGraph::bump_from_displacement()
 		add(pair.second);
 }
 
+void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight_out, bool volume)
+{
+	/* for SVM in multi closure mode, this transforms the shader mix/add part of
+	 * the graph into nodes that feed weights into closure nodes. this is too
+	 * avoid building a closure tree and then flattening it, and instead write it
+	 * directly to an array */
+	
+	if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) {
+		ShaderInput *fin = node->input("Fac");
+		ShaderInput *cl1in = node->input("Closure1");
+		ShaderInput *cl2in = node->input("Closure2");
+		ShaderOutput *weight1_out, *weight2_out;
+
+		if(fin) {
+			/* mix closure: add node to mix closure weights */
+			ShaderNode *mix_node = add(new MixClosureWeightNode());
+			ShaderInput *fac_in = mix_node->input("Fac"); 
+			ShaderInput *weight_in = mix_node->input("Weight"); 
+
+			if(fin->link)
+				connect(fin->link, fac_in);
+			else
+				fac_in->value = fin->value;
+
+			if(weight_out)
+				connect(weight_out, weight_in);
+
+			weight1_out = mix_node->output("Weight1");
+			weight2_out = mix_node->output("Weight2");
+		}
+		else {
+			/* add closure: just pass on any weights */
+			weight1_out = weight_out;
+			weight2_out = weight_out;
+		}
+
+		if(cl1in->link)
+			transform_multi_closure(cl1in->link->parent, weight1_out, volume);
+		if(cl2in->link)
+			transform_multi_closure(cl2in->link->parent, weight2_out, volume);
+	}
+	else {
+		ShaderInput *weight_in = node->input((volume)? "VolumeMixWeight": "SurfaceMixWeight");
+
+		/* not a closure node? */
+		if(!weight_in)
+			return;
+
+		/* already has a weight connected to it? add weights */
+		if(weight_in->link || weight_in->value.x != 0.0f) {
+			ShaderNode *math_node = add(new MathNode());
+			ShaderInput *value1_in = math_node->input("Value1");
+			ShaderInput *value2_in = math_node->input("Value2");
+
+			if(weight_in->link)
+				connect(weight_in->link, value1_in);
+			else
+				value1_in->value = weight_in->value;
+
+			if(weight_out)
+				connect(weight_out, value2_in);
+			else
+				value2_in->value.x = 1.0f;
+
+			weight_out = math_node->output("Value");
+			disconnect(weight_in);
+		}
+
+		/* connected to closure mix weight */
+		if(weight_out)
+			connect(weight_out, weight_in);
+		else
+			weight_in->value.x += 1.0f;
+	}
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index c3b674d..b791678 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -44,11 +44,13 @@ class OSLCompiler;
 
 enum ShaderSocketType {
 	SHADER_SOCKET_FLOAT,
+	SHADER_SOCKET_INT,
 	SHADER_SOCKET_COLOR,
 	SHADER_SOCKET_VECTOR,
 	SHADER_SOCKET_POINT,
 	SHADER_SOCKET_NORMAL,
-	SHADER_SOCKET_CLOSURE
+	SHADER_SOCKET_CLOSURE,
+	SHADER_SOCKET_STRING
 };
 
 /* Bump
@@ -112,12 +114,20 @@ public:
 		INCOMING,
 		NORMAL,
 		POSITION,
+		TANGENT,
 		NONE
 	};
 
+	enum Usage {
+		USE_SVM = 1,
+		USE_OSL = 2,
+		USE_ALL = USE_SVM|USE_OSL
+	};
+
 	ShaderInput(ShaderNode *parent, const char *name, ShaderSocketType type);
 	void set(const float3& v) { value = v; }
 	void set(float f) { value = make_float3(f, 0, 0); }
+	void set(const ustring v) { value_string = v; }
 
 	const char *name;
 	ShaderSocketType type;
@@ -127,9 +137,10 @@ public:
 
 	DefaultValue default_value;
 	float3 value;
+	ustring value_string;
 
 	int stack_offset; /* for SVM compiler */
-	bool osl_only;
+	int usage;
 };
 
 /* Output
@@ -162,9 +173,9 @@ public:
 	ShaderInput *input(const char *name);
 	ShaderOutput *output(const char *name);
 
-	ShaderInput *add_input(const char *name, ShaderSocketType type, float value=0.0f);
-	ShaderInput *add_input(const char *name, ShaderSocketType type, float3 value);
-	ShaderInput *add_input(const char *name, ShaderSocketType type, ShaderInput::DefaultValue value, bool osl_only=false);
+	ShaderInput *add_input(const char *name, ShaderSocketType type, float value=0.0f, int usage=ShaderInput::USE_ALL);
+	ShaderInput *add_input(const char *name, ShaderSocketType type, float3 value, int usage=ShaderInput::USE_ALL);
+	ShaderInput *add_input(const char *name, ShaderSocketType type, ShaderInput::DefaultValue value, int usage=ShaderInput::USE_ALL);
 	ShaderOutput *add_output(const char *name, ShaderSocketType type);
 
 	virtual ShaderNode *clone() const = 0;
@@ -222,7 +233,7 @@ public:
 	void connect(ShaderOutput *from, ShaderInput *to);
 	void disconnect(ShaderInput *to);
 
-	void finalize(bool do_bump = false, bool do_osl = false);
+	void finalize(bool do_bump = false, bool do_osl = false, bool do_multi_closure = false);
 
 protected:
 	typedef pair<ShaderNode* const, ShaderNode*> NodePair;
@@ -234,7 +245,9 @@ protected:
 	void break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack);
 	void clean();
 	void bump_from_displacement();
+	void refine_bump_nodes();
 	void default_inputs(bool do_osl);
+	void transform_multi_closure(ShaderNode *node, ShaderOutput *weight_out, bool volume);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index f136f08..230a12f 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -36,6 +36,7 @@ ImageManager::ImageManager()
 	need_update = true;
 	pack_images = false;
 	osl_texture_system = NULL;
+	animation_frame = 0;
 
 	tex_num_images = TEX_NUM_IMAGES;
 	tex_num_float_images = TEX_NUM_FLOAT_IMAGES;
@@ -67,7 +68,24 @@ void ImageManager::set_extended_image_limits(void)
 	tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START;
 }
 
-static bool is_float_image(const string& filename)
+bool ImageManager::set_animation_frame_update(int frame)
+{
+	if(frame != animation_frame) {
+		animation_frame = frame;
+
+		for(size_t slot = 0; slot < images.size(); slot++)
+			if(images[slot] && images[slot]->animated)
+				return true;
+
+		for(size_t slot = 0; slot < float_images.size(); slot++)
+			if(float_images[slot] && float_images[slot]->animated)
+				return true;
+	}
+	
+	return false;
+}
+
+bool ImageManager::is_float_image(const string& filename)
 {
 	ImageInput *in = ImageInput::create(filename);
 	bool is_float = false;
@@ -95,7 +113,7 @@ static bool is_float_image(const string& filename)
 	return is_float;
 }
 
-int ImageManager::add_image(const string& filename, bool& is_float)
+int ImageManager::add_image(const string& filename, bool animated, bool& is_float)
 {
 	Image *img;
 	size_t slot;
@@ -133,6 +151,7 @@ int ImageManager::add_image(const string& filename, bool& is_float)
 		img = new Image();
 		img->filename = filename;
 		img->need_load = true;
+		img->animated = animated;
 		img->users = 1;
 
 		float_images[slot] = img;
@@ -166,6 +185,7 @@ int ImageManager::add_image(const string& filename, bool& is_float)
 		img = new Image();
 		img->filename = filename;
 		img->need_load = true;
+		img->animated = animated;
 		img->users = 1;
 
 		images[slot] = img;
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 8fb2292..4d17717 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -25,9 +25,10 @@
 #include "util_thread.h"
 #include "util_vector.h"
 
+#include "kernel_types.h"  /* for TEX_NUM_FLOAT_IMAGES */
+
 CCL_NAMESPACE_BEGIN
 
-#define TEX_NUM_FLOAT_IMAGES	5
 #define TEX_NUM_IMAGES			95
 #define TEX_IMAGE_BYTE_START	TEX_NUM_FLOAT_IMAGES
 
@@ -50,16 +51,17 @@ public:
 	ImageManager();
 	~ImageManager();
 
-	int add_image(const string& filename, bool& is_float);
+	int add_image(const string& filename, bool animated, bool& is_float);
 	void remove_image(const string& filename);
+	bool is_float_image(const string& filename);
 
 	void device_update(Device *device, DeviceScene *dscene, Progress& progress);
 	void device_free(Device *device, DeviceScene *dscene);
 
 	void set_osl_texture_system(void *texture_system);
 	void set_pack_images(bool pack_images_);
-
 	void set_extended_image_limits(void);
+	bool set_animation_frame_update(int frame);
 
 	bool need_update;
 
@@ -68,11 +70,13 @@ private:
 	int tex_num_float_images;
 	int tex_image_byte_start;
 	thread_mutex device_mutex;
+	int animation_frame;
 
 	struct Image {
 		string filename;
 
 		bool need_load;
+		bool animated;
 		int users;
 	};
 
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index d77516a..4173da4 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -147,6 +147,10 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
 		Mesh *mesh = object->mesh;
 		bool have_emission = false;
 
+		/* skip if we are not visible for BSDFs */
+		if(!(object->visibility & (PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY|PATH_RAY_TRANSMIT)))
+			continue;
+
 		/* skip if we have no emission shaders */
 		foreach(uint sindex, mesh->used_shaders) {
 			Shader *shader = scene->shaders[sindex];
@@ -183,6 +187,10 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
 		Mesh *mesh = object->mesh;
 		bool have_emission = false;
 
+		/* skip if we are not visible for BSDFs */
+		if(!(object->visibility & (PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY|PATH_RAY_TRANSMIT)))
+			continue;
+
 		/* skip if we have no emission shaders */
 		foreach(uint sindex, mesh->used_shaders) {
 			Shader *shader = scene->shaders[sindex];
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 7037e36..bc782a7 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -19,6 +19,7 @@
 #include "bvh.h"
 #include "bvh_build.h"
 
+#include "camera.h"
 #include "device.h"
 #include "shader.h"
 #include "light.h"
@@ -324,6 +325,7 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
 
 	og->object_name_map.clear();
 	og->attribute_map.clear();
+	og->object_names.clear();
 
 	og->attribute_map.resize(scene->objects.size());
 
@@ -331,6 +333,7 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
 		/* set object name to object index map */
 		Object *object = scene->objects[i];
 		og->object_name_map[object->name] = i;
+		og->object_names.push_back(object->name);
 
 		/* set object attributes */
 		foreach(ParamValue& attr, object->attributes) {
@@ -354,6 +357,9 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
 
 		/* set object attributes */
 		foreach(AttributeRequest& req, attributes.requests) {
+			if(req.element == ATTR_ELEMENT_NONE)
+				continue;
+
 			OSLGlobals::Attribute osl_attr;
 
 			osl_attr.elem = req.element;
@@ -365,8 +371,8 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
 				osl_attr.type = TypeDesc::TypeColor;
 
 			if(req.std != ATTR_STD_NONE) {
-				/* if standard attribute, add lookup by std:: name convention */
-				ustring stdname(std::string("std::") + std::string(attribute_standard_name(req.std)));
+				/* if standard attribute, add lookup by geom: name convention */
+				ustring stdname(string("geom:") + string(attribute_standard_name(req.std)));
 				og->attribute_map[i][stdname] = osl_attr;
 			}
 			else if(req.name != ustring()) {
@@ -541,7 +547,7 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene,
 	}
 
 	/* create attribute lookup maps */
-	if(scene->params.shadingsystem == SceneParams::OSL)
+	if(scene->shader_manager->use_osl())
 		update_osl_attributes(device, scene, mesh_attributes);
 	else
 		update_svm_attributes(device, dscene, scene, mesh_attributes);
@@ -722,10 +728,16 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
 	foreach(Shader *shader, scene->shaders)
 		shader->need_update_attributes = false;
 
-	bool motion_blur = scene->need_motion() == Scene::MOTION_BLUR;
+	float shuttertime = scene->camera->shuttertime;
+#ifdef __OBJECT_MOTION__
+	Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading);
+	bool motion_blur = need_motion == Scene::MOTION_BLUR;
+#else
+	bool motion_blur = false;
+#endif
 
 	foreach(Object *object, scene->objects)
-		object->compute_bounds(motion_blur);
+		object->compute_bounds(motion_blur, shuttertime);
 
 	if(progress.get_cancel()) return;
 
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 4e16eea..3f8055b 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -100,6 +100,16 @@ void TextureMapping::compile(SVMCompiler& compiler, int offset_in, int offset_ou
 	}
 }
 
+void TextureMapping::compile(OSLCompiler &compiler)
+{
+	if(!skip()) {
+		Transform tfm = transform_transpose(compute_transform());
+
+		compiler.parameter("mapping", tfm);
+		compiler.parameter("use_mapping", 1);
+	}
+}
+
 /* Image Texture */
 
 static ShaderEnum color_space_init()
@@ -130,11 +140,12 @@ ImageTextureNode::ImageTextureNode()
 {
 	image_manager = NULL;
 	slot = -1;
-	is_float = false;
+	is_float = -1;
 	filename = "";
 	color_space = ustring("Color");
 	projection = ustring("Flat");;
 	projection_blend = 0.0f;
+	animated = false;
 
 	add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::TEXTURE_UV);
 	add_output("Color", SHADER_SOCKET_COLOR);
@@ -152,7 +163,7 @@ ShaderNode *ImageTextureNode::clone() const
 	ImageTextureNode *node = new ImageTextureNode(*this);
 	node->image_manager = NULL;
 	node->slot = -1;
-	node->is_float = false;
+	node->is_float = -1;
 	return node;
 }
 
@@ -163,8 +174,11 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
 	ShaderOutput *alpha_out = output("Alpha");
 
 	image_manager = compiler.image_manager;
-	if(slot == -1)
-		slot = image_manager->add_image(filename, is_float);
+	if(is_float == -1) {
+		bool is_float_bool;
+		slot = image_manager->add_image(filename, animated, is_float_bool);
+		is_float = (int)is_float_bool;
+	}
 
 	if(!color_out->links.empty())
 		compiler.stack_assign(color_out);
@@ -220,11 +234,18 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
 
 void ImageTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
+	if(is_float == -1)
+		is_float = (int)image_manager->is_float_image(filename);
+
 	compiler.parameter("filename", filename.c_str());
 	if(is_float || color_space != "Color")
 		compiler.parameter("color_space", "Linear");
 	else
 		compiler.parameter("color_space", "sRGB");
+	compiler.parameter("projection", projection);
+	compiler.parameter("projection_blend", projection_blend);
 	compiler.add(this, "node_image_texture");
 }
 
@@ -248,10 +269,11 @@ EnvironmentTextureNode::EnvironmentTextureNode()
 {
 	image_manager = NULL;
 	slot = -1;
-	is_float = false;
+	is_float = -1;
 	filename = "";
 	color_space = ustring("Color");
 	projection = ustring("Equirectangular");
+	animated = false;
 
 	add_input("Vector", SHADER_SOCKET_VECTOR, ShaderInput::POSITION);
 	add_output("Color", SHADER_SOCKET_COLOR);
@@ -269,7 +291,7 @@ ShaderNode *EnvironmentTextureNode::clone() const
 	EnvironmentTextureNode *node = new EnvironmentTextureNode(*this);
 	node->image_manager = NULL;
 	node->slot = -1;
-	node->is_float = false;
+	node->is_float = -1;
 	return node;
 }
 
@@ -280,8 +302,11 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
 	ShaderOutput *alpha_out = output("Alpha");
 
 	image_manager = compiler.image_manager;
-	if(slot == -1)
-		slot = image_manager->add_image(filename, is_float);
+	if(slot == -1) {
+		bool is_float_bool;
+		slot = image_manager->add_image(filename, animated, is_float_bool);
+		is_float = (int)is_float_bool;
+	}
 
 	if(!color_out->links.empty())
 		compiler.stack_assign(color_out);
@@ -326,7 +351,13 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
 
 void EnvironmentTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
+	if(is_float == -1)
+		is_float = (int)image_manager->is_float_image(filename);
+
 	compiler.parameter("filename", filename.c_str());
+	compiler.parameter("projection", projection);
 	if(is_float || color_space != "Color")
 		compiler.parameter("color_space", "Linear");
 	else
@@ -436,6 +467,8 @@ void SkyTextureNode::compile(SVMCompiler& compiler)
 
 void SkyTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter_vector("sun_direction", sun_direction);
 	compiler.parameter("turbidity", turbidity);
 	compiler.add(this, "node_sky_texture");
@@ -499,6 +532,8 @@ void GradientTextureNode::compile(SVMCompiler& compiler)
 
 void GradientTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Type", type);
 	compiler.add(this, "node_gradient_texture");
 }
@@ -557,6 +592,8 @@ void NoiseTextureNode::compile(SVMCompiler& compiler)
 
 void NoiseTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.add(this, "node_noise_texture");
 }
 
@@ -617,6 +654,8 @@ void VoronoiTextureNode::compile(SVMCompiler& compiler)
 
 void VoronoiTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Coloring", coloring);
 	compiler.add(this, "node_voronoi_texture");
 }
@@ -704,6 +743,8 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler)
 
 void MusgraveTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Type", type);
 
 	compiler.add(this, "node_musgrave_texture");
@@ -782,6 +823,8 @@ void WaveTextureNode::compile(SVMCompiler& compiler)
 
 void WaveTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Type", type);
 
 	compiler.add(this, "node_wave_texture");
@@ -839,6 +882,8 @@ void MagicTextureNode::compile(SVMCompiler& compiler)
 
 void MagicTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Depth", depth);
 	compiler.add(this, "node_magic_texture");
 }
@@ -895,6 +940,8 @@ void CheckerTextureNode::compile(SVMCompiler& compiler)
 
 void CheckerTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.add(this, "node_checker_texture");
 }
 
@@ -983,6 +1030,8 @@ void BrickTextureNode::compile(SVMCompiler& compiler)
 
 void BrickTextureNode::compile(OSLCompiler& compiler)
 {
+	tex_mapping.compile(compiler);
+
 	compiler.parameter("Offset", offset);
 	compiler.parameter("OffsetFrequency", offset_frequency);
 	compiler.parameter("Squash", squash);
@@ -1049,6 +1098,9 @@ void MappingNode::compile(OSLCompiler& compiler)
 {
 	Transform tfm = transform_transpose(tex_mapping.compute_transform());
 	compiler.parameter("Matrix", tfm);
+	compiler.parameter_point("mapping_min", tex_mapping.min);
+	compiler.parameter_point("mapping_max", tex_mapping.max);
+	compiler.parameter("use_minmax", tex_mapping.use_minmax);
 
 	compiler.add(this, "node_mapping");
 }
@@ -1065,6 +1117,8 @@ ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_)
 
 	if(from == SHADER_SOCKET_FLOAT)
 		add_input("Val", SHADER_SOCKET_FLOAT);
+	else if(from == SHADER_SOCKET_INT)
+		add_input("ValInt", SHADER_SOCKET_INT);
 	else if(from == SHADER_SOCKET_COLOR)
 		add_input("Color", SHADER_SOCKET_COLOR);
 	else if(from == SHADER_SOCKET_VECTOR)
@@ -1073,11 +1127,15 @@ ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_)
 		add_input("Point", SHADER_SOCKET_POINT);
 	else if(from == SHADER_SOCKET_NORMAL)
 		add_input("Normal", SHADER_SOCKET_NORMAL);
+	else if(from == SHADER_SOCKET_STRING)
+		add_input("String", SHADER_SOCKET_STRING);
 	else
 		assert(0);
 
 	if(to == SHADER_SOCKET_FLOAT)
 		add_output("Val", SHADER_SOCKET_FLOAT);
+	else if(to == SHADER_SOCKET_INT)
+		add_output("ValInt", SHADER_SOCKET_INT);
 	else if(to == SHADER_SOCKET_COLOR)
 		add_output("Color", SHADER_SOCKET_COLOR);
 	else if(to == SHADER_SOCKET_VECTOR)
@@ -1086,6 +1144,8 @@ ConvertNode::ConvertNode(ShaderSocketType from_, ShaderSocketType to_)
 		add_output("Point", SHADER_SOCKET_POINT);
 	else if(to == SHADER_SOCKET_NORMAL)
 		add_output("Normal", SHADER_SOCKET_NORMAL);
+	else if(to == SHADER_SOCKET_STRING)
+		add_output("String", SHADER_SOCKET_STRING);
 	else
 		assert(0);
 }
@@ -1095,7 +1155,29 @@ void ConvertNode::compile(SVMCompiler& compiler)
 	ShaderInput *in = inputs[0];
 	ShaderOutput *out = outputs[0];
 
-	if(to == SHADER_SOCKET_FLOAT) {
+	if(from == SHADER_SOCKET_FLOAT) {
+		compiler.stack_assign(in);
+		compiler.stack_assign(out);
+
+		if(to == SHADER_SOCKET_INT)
+			/* float to int */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_FI, in->stack_offset, out->stack_offset);
+		else
+			/* float to float3 */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_FV, in->stack_offset, out->stack_offset);
+	}
+	else if(from == SHADER_SOCKET_INT) {
+		compiler.stack_assign(in);
+		compiler.stack_assign(out);
+
+		if(to == SHADER_SOCKET_FLOAT)
+			/* int to float */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_IF, in->stack_offset, out->stack_offset);
+		else
+			/* int to vector/point/normal */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_IV, in->stack_offset, out->stack_offset);
+	}
+	else if(to == SHADER_SOCKET_FLOAT) {
 		compiler.stack_assign(in);
 		compiler.stack_assign(out);
 
@@ -1106,12 +1188,16 @@ void ConvertNode::compile(SVMCompiler& compiler)
 			/* vector/point/normal to float */
 			compiler.add_node(NODE_CONVERT, NODE_CONVERT_VF, in->stack_offset, out->stack_offset);
 	}
-	else if(from == SHADER_SOCKET_FLOAT) {
+	else if(to == SHADER_SOCKET_INT) {
 		compiler.stack_assign(in);
 		compiler.stack_assign(out);
 
-		/* float to float3 */
-		compiler.add_node(NODE_CONVERT, NODE_CONVERT_FV, in->stack_offset, out->stack_offset);
+		if(from == SHADER_SOCKET_COLOR)
+			/* color to int */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_CI, in->stack_offset, out->stack_offset);
+		else
+			/* vector/point/normal to int */
+			compiler.add_node(NODE_CONVERT, NODE_CONVERT_VI, in->stack_offset, out->stack_offset);
 	}
 	else {
 		/* float3 to float3 */
@@ -1134,6 +1220,8 @@ void ConvertNode::compile(OSLCompiler& compiler)
 {
 	if(from == SHADER_SOCKET_FLOAT)
 		compiler.add(this, "node_convert_from_float");
+	else if(from == SHADER_SOCKET_INT)
+		compiler.add(this, "node_convert_from_int");
 	else if(from == SHADER_SOCKET_COLOR)
 		compiler.add(this, "node_convert_from_color");
 	else if(from == SHADER_SOCKET_VECTOR)
@@ -1175,14 +1263,17 @@ BsdfNode::BsdfNode()
 	closure = ccl::CLOSURE_BSDF_DIFFUSE_ID;
 
 	add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
-	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL);
+	add_input("SurfaceMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
 
 	add_output("BSDF", SHADER_SOCKET_CLOSURE);
 }
 
-void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2)
+void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3)
 {
 	ShaderInput *color_in = input("Color");
+	ShaderInput *normal_in = input("Normal");
+	ShaderInput *tangent_in = input("Tangent");
 
 	if(color_in->link) {
 		compiler.stack_assign(color_in);
@@ -1195,6 +1286,14 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
 		compiler.stack_assign(param1);
 	if(param2)
 		compiler.stack_assign(param2);
+	if(param3)
+		compiler.stack_assign(param3);
+
+	if(normal_in->link)
+		compiler.stack_assign(normal_in);
+
+	if(tangent_in && tangent_in->link)
+		compiler.stack_assign(tangent_in);
 
 	compiler.add_node(NODE_CLOSURE_BSDF,
 		compiler.encode_uchar4(closure,
@@ -1203,6 +1302,14 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
 			compiler.closure_mix_weight_offset()),
 		__float_as_int((param1)? param1->value.x: 0.0f),
 		__float_as_int((param2)? param2->value.x: 0.0f));
+
+	if(tangent_in) {
+		compiler.add_node(NODE_CLOSURE_BSDF, normal_in->stack_offset, tangent_in->stack_offset,
+			(param3)? param3->stack_offset: SVM_STACK_INVALID);
+	}
+	else {
+		compiler.add_node(NODE_CLOSURE_BSDF, normal_in->stack_offset);
+	}
 }
 
 void BsdfNode::compile(SVMCompiler& compiler)
@@ -1221,13 +1328,26 @@ WardBsdfNode::WardBsdfNode()
 {
 	closure = CLOSURE_BSDF_WARD_ID;
 
-	add_input("Roughness U", SHADER_SOCKET_FLOAT, 0.2f);
-	add_input("Roughness V", SHADER_SOCKET_FLOAT, 0.2f);
+	add_input("Tangent", SHADER_SOCKET_VECTOR, ShaderInput::TANGENT);
+
+	add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f);
+	add_input("Anisotropy", SHADER_SOCKET_FLOAT, 0.5f);
+	add_input("Rotation", SHADER_SOCKET_FLOAT, 0.0f);
+}
+
+void WardBsdfNode::attributes(AttributeRequestSet *attributes)
+{
+	ShaderInput *tangent_in = input("Tangent");
+
+	if(!tangent_in->link)
+		attributes->add(ATTR_STD_GENERATED);
+
+	ShaderNode::attributes(attributes);
 }
 
 void WardBsdfNode::compile(SVMCompiler& compiler)
 {
-	BsdfNode::compile(compiler, input("Roughness U"), input("Roughness V"));
+	BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation"));
 }
 
 void WardBsdfNode::compile(OSLCompiler& compiler)
@@ -1279,9 +1399,9 @@ static ShaderEnum glass_distribution_init()
 {
 	ShaderEnum enm;
 
-	enm.insert("Sharp", CLOSURE_BSDF_REFRACTION_ID);
-	enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID);
-	enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID);
+	enm.insert("Sharp", CLOSURE_BSDF_SHARP_GLASS_ID);
+	enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID);
+	enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID);
 
 	return enm;
 }
@@ -1300,7 +1420,7 @@ void GlassBsdfNode::compile(SVMCompiler& compiler)
 {
 	closure = (ClosureType)distribution_enum[distribution];
 
-	if(closure == CLOSURE_BSDF_REFRACTION_ID)
+	if(closure == CLOSURE_BSDF_SHARP_GLASS_ID)
 		BsdfNode::compile(compiler, NULL, input("IOR"));
 	else
 		BsdfNode::compile(compiler, input("Roughness"), input("IOR"));
@@ -1312,6 +1432,45 @@ void GlassBsdfNode::compile(OSLCompiler& compiler)
 	compiler.add(this, "node_glass_bsdf");
 }
 
+/* Refraction BSDF Closure */
+
+static ShaderEnum refraction_distribution_init()
+{
+	ShaderEnum enm;
+
+	enm.insert("Sharp", CLOSURE_BSDF_REFRACTION_ID);
+	enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID);
+	enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID);
+
+	return enm;
+}
+
+ShaderEnum RefractionBsdfNode::distribution_enum = refraction_distribution_init();
+
+RefractionBsdfNode::RefractionBsdfNode()
+{
+	distribution = ustring("Sharp");
+
+	add_input("Roughness", SHADER_SOCKET_FLOAT, 0.0f);
+	add_input("IOR", SHADER_SOCKET_FLOAT, 0.3f);
+}
+
+void RefractionBsdfNode::compile(SVMCompiler& compiler)
+{
+	closure = (ClosureType)distribution_enum[distribution];
+
+	if(closure == CLOSURE_BSDF_REFRACTION_ID)
+		BsdfNode::compile(compiler, NULL, input("IOR"));
+	else
+		BsdfNode::compile(compiler, input("Roughness"), input("IOR"));
+}
+
+void RefractionBsdfNode::compile(OSLCompiler& compiler)
+{
+	compiler.parameter("distribution", distribution);
+	compiler.add(this, "node_refraction_bsdf");
+}
+
 /* Velvet BSDF Closure */
 
 VelvetBsdfNode::VelvetBsdfNode()
@@ -1393,6 +1552,8 @@ EmissionNode::EmissionNode()
 
 	add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
 	add_input("Strength", SHADER_SOCKET_FLOAT, 10.0f);
+	add_input("SurfaceMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
+
 	add_output("Emission", SHADER_SOCKET_CLOSURE);
 }
 
@@ -1427,6 +1588,8 @@ BackgroundNode::BackgroundNode()
 {
 	add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
 	add_input("Strength", SHADER_SOCKET_FLOAT, 1.0f);
+	add_input("SurfaceMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
+
 	add_output("Background", SHADER_SOCKET_CLOSURE);
 }
 
@@ -1456,11 +1619,17 @@ void BackgroundNode::compile(OSLCompiler& compiler)
 HoldoutNode::HoldoutNode()
 : ShaderNode("holdout")
 {
+	add_input("SurfaceMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
+	add_input("VolumeMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
+
 	add_output("Holdout", SHADER_SOCKET_CLOSURE);
 }
 
 void HoldoutNode::compile(SVMCompiler& compiler)
 {
+	float3 value = make_float3(1.0f, 1.0f, 1.0f);
+
+	compiler.add_node(NODE_CLOSURE_SET_WEIGHT, value);
 	compiler.add_node(NODE_CLOSURE_HOLDOUT, compiler.closure_mix_weight_offset());
 }
 
@@ -1469,6 +1638,37 @@ void HoldoutNode::compile(OSLCompiler& compiler)
 	compiler.add(this, "node_holdout");
 }
 
+/* Ambient Occlusion */
+
+AmbientOcclusionNode::AmbientOcclusionNode()
+: ShaderNode("ambient_occlusion")
+{
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
+	add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
+	add_input("SurfaceMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
+
+	add_output("AO", SHADER_SOCKET_CLOSURE);
+}
+
+void AmbientOcclusionNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput *color_in = input("Color");
+
+	if(color_in->link) {
+		compiler.stack_assign(color_in);
+		compiler.add_node(NODE_CLOSURE_WEIGHT, color_in->stack_offset);
+	}
+	else
+		compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value);
+
+	compiler.add_node(NODE_CLOSURE_AMBIENT_OCCLUSION, compiler.closure_mix_weight_offset());
+}
+
+void AmbientOcclusionNode::compile(OSLCompiler& compiler)
+{
+	compiler.add(this, "node_ambient_occlusion");
+}
+
 /* Volume Closure */
 
 VolumeNode::VolumeNode()
@@ -1478,6 +1678,7 @@ VolumeNode::VolumeNode()
 
 	add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
 	add_input("Density", SHADER_SOCKET_FLOAT, 1.0f);
+	add_input("VolumeMixWeight", SHADER_SOCKET_FLOAT, 0.0f, ShaderInput::USE_SVM);
 
 	add_output("Volume", SHADER_SOCKET_CLOSURE);
 }
@@ -1556,7 +1757,7 @@ void IsotropicVolumeNode::compile(OSLCompiler& compiler)
 GeometryNode::GeometryNode()
 : ShaderNode("geometry")
 {
-	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
 	add_output("Position", SHADER_SOCKET_POINT);
 	add_output("Normal", SHADER_SOCKET_NORMAL);
 	add_output("Tangent", SHADER_SOCKET_NORMAL);
@@ -1566,6 +1767,14 @@ GeometryNode::GeometryNode()
 	add_output("Backfacing", SHADER_SOCKET_FLOAT);
 }
 
+void GeometryNode::attributes(AttributeRequestSet *attributes)
+{
+	if(!output("Tangent")->links.empty())
+		attributes->add(ATTR_STD_GENERATED);
+
+	ShaderNode::attributes(attributes);
+}
+
 void GeometryNode::compile(SVMCompiler& compiler)
 {
 	ShaderOutput *out;
@@ -1636,7 +1845,7 @@ void GeometryNode::compile(OSLCompiler& compiler)
 TextureCoordinateNode::TextureCoordinateNode()
 : ShaderNode("texture_coordinate")
 {
-	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
 	add_output("Generated", SHADER_SOCKET_POINT);
 	add_output("Normal", SHADER_SOCKET_NORMAL);
 	add_output("UV", SHADER_SOCKET_POINT);
@@ -1758,6 +1967,8 @@ void TextureCoordinateNode::compile(OSLCompiler& compiler)
 	
 	if(compiler.background)
 		compiler.parameter("is_background", true);
+	
+	compiler.parameter("from_dupli", from_dupli);
 
 	compiler.add(this, "node_texture_coordinate");
 }
@@ -1996,13 +2207,14 @@ void ParticleInfoNode::compile(SVMCompiler& compiler)
 		compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_LOCATION, out->stack_offset);
 	}
 	
-	#if 0	/* XXX Quaternion data is not yet supported by Cycles */
+	/* quaternion data is not yet supported by Cycles */
+#if 0
 	out = output("Rotation");
 	if(!out->links.empty()) {
 		compiler.stack_assign(out);
 		compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_ROTATION, out->stack_offset);
 	}
-	#endif
+#endif
 	
 	out = output("Size");
 	if(!out->links.empty()) {
@@ -2123,6 +2335,39 @@ void MixClosureNode::compile(OSLCompiler& compiler)
 	compiler.add(this, "node_mix_closure");
 }
 
+/* Mix Closure */
+
+MixClosureWeightNode::MixClosureWeightNode()
+: ShaderNode("mix_closure_weight")
+{
+	add_input("Weight", SHADER_SOCKET_FLOAT, 1.0f);
+	add_input("Fac", SHADER_SOCKET_FLOAT, 1.0f);
+	add_output("Weight1", SHADER_SOCKET_FLOAT);
+	add_output("Weight2", SHADER_SOCKET_FLOAT);
+}
+
+void MixClosureWeightNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput *weight_in = input("Weight");
+	ShaderInput *fac_in = input("Fac");
+	ShaderOutput *weight1_out = output("Weight1");
+	ShaderOutput *weight2_out = output("Weight2");
+
+	compiler.stack_assign(weight_in);
+	compiler.stack_assign(fac_in);
+	compiler.stack_assign(weight1_out);
+	compiler.stack_assign(weight2_out);
+
+	compiler.add_node(NODE_MIX_CLOSURE,
+		compiler.encode_uchar4(fac_in->stack_offset, weight_in->stack_offset,
+			weight1_out->stack_offset, weight2_out->stack_offset));
+}
+
+void MixClosureWeightNode::compile(OSLCompiler& compiler)
+{
+	assert(0);
+}
+
 /* Invert */
 
 InvertNode::InvertNode()
@@ -2184,7 +2429,7 @@ static ShaderEnum mix_type_init()
 	enm.insert("Burn", NODE_MIX_BURN);
 	enm.insert("Hue", NODE_MIX_HUE);
 	enm.insert("Saturation", NODE_MIX_SAT);
-	enm.insert("Value", NODE_MIX_VAL );
+	enm.insert("Value", NODE_MIX_VAL);
 	enm.insert("Color", NODE_MIX_COLOR);
 	enm.insert("Soft Light", NODE_MIX_SOFT);
 	enm.insert("Linear Light", NODE_MIX_LINEAR);
@@ -2488,7 +2733,7 @@ void CameraNode::compile(OSLCompiler& compiler)
 FresnelNode::FresnelNode()
 : ShaderNode("Fresnel")
 {
-	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
 	add_input("IOR", SHADER_SOCKET_FLOAT, 1.45f);
 	add_output("Fac", SHADER_SOCKET_FLOAT);
 }
@@ -2513,7 +2758,7 @@ void FresnelNode::compile(OSLCompiler& compiler)
 LayerWeightNode::LayerWeightNode()
 : ShaderNode("LayerWeight")
 {
-	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+	add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
 	add_input("Blend", SHADER_SOCKET_FLOAT, 0.5f);
 
 	add_output("Fresnel", SHADER_SOCKET_FLOAT);
@@ -2544,7 +2789,7 @@ void LayerWeightNode::compile(SVMCompiler& compiler)
 
 void LayerWeightNode::compile(OSLCompiler& compiler)
 {
-	compiler.add(this, "node_blend_weight");
+	compiler.add(this, "node_layer_weight");
 }
 
 /* Output */
@@ -2555,6 +2800,7 @@ OutputNode::OutputNode()
 	add_input("Surface", SHADER_SOCKET_CLOSURE);
 	add_input("Volume", SHADER_SOCKET_CLOSURE);
 	add_input("Displacement", SHADER_SOCKET_FLOAT);
+	add_input("Normal", SHADER_SOCKET_NORMAL);
 }
 
 void OutputNode::compile(SVMCompiler& compiler)
@@ -2702,9 +2948,15 @@ void VectorMathNode::compile(OSLCompiler& compiler)
 BumpNode::BumpNode()
 : ShaderNode("bump")
 {
+	/* this input is used by the user, but after graph transform it is no longer
+	 * used and moved to sampler center/x/y instead */
+	add_input("Height", SHADER_SOCKET_FLOAT);
+
 	add_input("SampleCenter", SHADER_SOCKET_FLOAT);
 	add_input("SampleX", SHADER_SOCKET_FLOAT);
 	add_input("SampleY", SHADER_SOCKET_FLOAT);
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL);
+	add_input("Strength", SHADER_SOCKET_FLOAT, 0.1f);
 
 	add_output("Normal", SHADER_SOCKET_NORMAL);
 }
@@ -2714,12 +2966,25 @@ void BumpNode::compile(SVMCompiler& compiler)
 	ShaderInput *center_in = input("SampleCenter");
 	ShaderInput *dx_in = input("SampleX");
 	ShaderInput *dy_in = input("SampleY");
+	ShaderInput *normal_in = input("NormalIn");
+	ShaderInput *intensity_in = input("Strength");
+	ShaderOutput *normal_out = output("Normal");
 
 	compiler.stack_assign(center_in);
 	compiler.stack_assign(dx_in);
 	compiler.stack_assign(dy_in);
+	compiler.stack_assign(intensity_in);
+	compiler.stack_assign(normal_out);
 
-	compiler.add_node(NODE_SET_BUMP, center_in->stack_offset, dx_in->stack_offset, dy_in->stack_offset);
+	if(normal_in->link)
+		compiler.stack_assign(normal_in);
+	
+	/* pack all parameters in the node */
+	compiler.add_node(NODE_SET_BUMP,
+		normal_in->stack_offset,
+		compiler.encode_uchar4(center_in->stack_offset, dx_in->stack_offset,
+			dy_in->stack_offset, intensity_in->stack_offset),
+		normal_out->stack_offset);
 }
 
 void BumpNode::compile(OSLCompiler& compiler)
@@ -2788,17 +3053,245 @@ void RGBRampNode::compile(OSLCompiler& compiler)
 	/* NB: cycles float3 type is actually 4 floats! need to use an explicit array */
 	float ramp_color[RAMP_TABLE_SIZE][3];
 	float ramp_alpha[RAMP_TABLE_SIZE];
+
 	for (int i = 0; i < RAMP_TABLE_SIZE; ++i) {
 		ramp_color[i][0] = ramp[i].x;
 		ramp_color[i][1] = ramp[i].y;
 		ramp_color[i][2] = ramp[i].z;
 		ramp_alpha[i] = ramp[i].w;
 	}
+
 	compiler.parameter_color_array("ramp_color", ramp_color, RAMP_TABLE_SIZE);
 	compiler.parameter_array("ramp_alpha", ramp_alpha, RAMP_TABLE_SIZE);
 	
 	compiler.add(this, "node_rgb_ramp");
 }
 
+/* Set Normal Node */
+
+SetNormalNode::SetNormalNode()
+: ShaderNode("set_normal")
+{
+	add_input("Direction", SHADER_SOCKET_VECTOR);
+	add_output("Normal", SHADER_SOCKET_NORMAL);
+}
+
+void SetNormalNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput  *direction_in = input("Direction");
+	ShaderOutput *normal_out = output("Normal");
+
+	compiler.stack_assign(direction_in);
+	compiler.stack_assign(normal_out);
+
+	compiler.add_node(NODE_CLOSURE_SET_NORMAL, direction_in->stack_offset, normal_out->stack_offset);
+}
+
+void SetNormalNode::compile(OSLCompiler& compiler)
+{
+	compiler.add(this, "node_set_normal"); 
+}
+
+/* OSLScriptNode */
+
+OSLScriptNode::OSLScriptNode()
+: ShaderNode("osl_script")
+{
+}
+
+void OSLScriptNode::compile(SVMCompiler& compiler)
+{
+	/* doesn't work for SVM, obviously ... */
+}
+
+void OSLScriptNode::compile(OSLCompiler& compiler)
+{
+	if(!filepath.empty())
+		compiler.add(this, filepath.c_str(), true);
+	else
+		compiler.add(this, bytecode_hash.c_str(), false);
+}
+
+/* Normal Map */
+
+static ShaderEnum normal_map_space_init()
+{
+	ShaderEnum enm;
+
+	enm.insert("Tangent", NODE_NORMAL_MAP_TANGENT);
+	enm.insert("Object", NODE_NORMAL_MAP_OBJECT);
+	enm.insert("World", NODE_NORMAL_MAP_WORLD);
+
+	return enm;
+}
+
+ShaderEnum NormalMapNode::space_enum = normal_map_space_init();
+
+NormalMapNode::NormalMapNode()
+: ShaderNode("normal_map")
+{
+	space = ustring("Tangent");
+	attribute = ustring("");
+
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
+	add_input("Strength", SHADER_SOCKET_FLOAT, 1.0f);
+	add_input("Color", SHADER_SOCKET_COLOR);
+
+	add_output("Normal", SHADER_SOCKET_NORMAL);
+}
+
+void NormalMapNode::attributes(AttributeRequestSet *attributes)
+{
+	if(space == ustring("Tangent")) {
+		if(attribute == ustring("")) {
+			attributes->add(ATTR_STD_UV_TANGENT);
+			attributes->add(ATTR_STD_UV_TANGENT_SIGN);
+		}
+		else {
+			attributes->add(ustring((string(attribute.c_str()) + ".tangent").c_str()));
+			attributes->add(ustring((string(attribute.c_str()) + ".tangent_sign").c_str()));
+		}
+	}
+	
+	ShaderNode::attributes(attributes);
+}
+
+void NormalMapNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput  *color_in = input("Color");
+	ShaderInput  *strength_in = input("Strength");
+	ShaderOutput *normal_out = output("Normal");
+	int attr = 0, attr_sign = 0;
+
+	if(space == ustring("Tangent")) {
+		if(attribute == ustring("")) {
+			attr = compiler.attribute(ATTR_STD_UV_TANGENT);
+			attr_sign = compiler.attribute(ATTR_STD_UV_TANGENT_SIGN);
+		}
+		else {
+			attr = compiler.attribute(ustring((string(attribute.c_str()) + ".tangent").c_str()));
+			attr_sign = compiler.attribute(ustring((string(attribute.c_str()) + ".tangent_sign").c_str()));
+		}
+	}
+
+	compiler.stack_assign(color_in);
+	compiler.stack_assign(strength_in);
+	compiler.stack_assign(normal_out);
+
+	compiler.add_node(NODE_NORMAL_MAP,
+		compiler.encode_uchar4(
+			color_in->stack_offset,
+			strength_in->stack_offset,
+			normal_out->stack_offset,
+			space_enum[space]),
+		attr, attr_sign);
+}
+
+void NormalMapNode::compile(OSLCompiler& compiler)
+{
+	if(space == ustring("Tangent")) {
+		if(attribute == ustring("")) {
+			compiler.parameter("attr_name", ustring("geom:tangent"));
+			compiler.parameter("attr_sign_name", ustring("geom:tangent_sign"));
+		}
+		else {
+			compiler.parameter("attr_name", ustring((string(attribute.c_str()) + ".tangent").c_str()));
+			compiler.parameter("attr_sign_name", ustring((string(attribute.c_str()) + ".tangent_sign").c_str()));
+		}
+	}
+
+	compiler.parameter("space", space);
+
+	compiler.add(this, "node_normal_map"); 
+}
+
+/* Tangent */
+
+static ShaderEnum tangent_direction_type_init()
+{
+	ShaderEnum enm;
+
+	enm.insert("Radial", NODE_TANGENT_RADIAL);
+	enm.insert("UV Map", NODE_TANGENT_UVMAP);
+
+	return enm;
+}
+
+static ShaderEnum tangent_axis_init()
+{
+	ShaderEnum enm;
+
+	enm.insert("X", NODE_TANGENT_AXIS_X);
+	enm.insert("Y", NODE_TANGENT_AXIS_Y);
+	enm.insert("Z", NODE_TANGENT_AXIS_Z);
+
+	return enm;
+}
+
+ShaderEnum TangentNode::direction_type_enum = tangent_direction_type_init();
+ShaderEnum TangentNode::axis_enum = tangent_axis_init();
+
+TangentNode::TangentNode()
+: ShaderNode("normal_map")
+{
+	direction_type = ustring("Radial");
+	axis = ustring("X");
+	attribute = ustring("");
+
+	add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, ShaderInput::USE_OSL);
+	add_output("Tangent", SHADER_SOCKET_NORMAL);
+}
+
+void TangentNode::attributes(AttributeRequestSet *attributes)
+{
+	if(direction_type == ustring("UV Map")) {
+		if(attribute == ustring(""))
+			attributes->add(ATTR_STD_UV_TANGENT);
+		else
+			attributes->add(ustring((string(attribute.c_str()) + ".tangent").c_str()));
+	}
+	else
+		attributes->add(ATTR_STD_GENERATED);
+	
+	ShaderNode::attributes(attributes);
+}
+
+void TangentNode::compile(SVMCompiler& compiler)
+{
+	ShaderOutput *tangent_out = output("Tangent");
+	int attr;
+
+	if(direction_type == ustring("UV Map")) {
+		if(attribute == ustring(""))
+			attr = compiler.attribute(ATTR_STD_UV_TANGENT);
+		else
+			attr = compiler.attribute(ustring((string(attribute.c_str()) + ".tangent").c_str()));
+	}
+	else
+		attr = compiler.attribute(ATTR_STD_GENERATED);
+
+	compiler.stack_assign(tangent_out);
+
+	compiler.add_node(NODE_TANGENT,
+		compiler.encode_uchar4(
+			tangent_out->stack_offset,
+			direction_type_enum[direction_type],
+			axis_enum[axis]), attr);
+}
+
+void TangentNode::compile(OSLCompiler& compiler)
+{
+	if(direction_type == ustring("UV Map")) {
+		if(attribute == ustring(""))
+			compiler.parameter("attr_name", ustring("geom:tangent"));
+		else
+			compiler.parameter("attr_name", ustring((string(attribute.c_str()) + ".tangent").c_str()));
+	}
+
+	compiler.parameter("direction_type", direction_type);
+	compiler.parameter("axis", axis);
+	compiler.add(this, "node_tangent"); 
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index e8e584d..6773314 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -36,6 +36,7 @@ public:
 	Transform compute_transform();
 	bool skip();
 	void compile(SVMCompiler& compiler, int offset_in, int offset_out);
+	void compile(OSLCompiler &compiler);
 
 	float3 translation;
 	float3 rotation;
@@ -67,11 +68,12 @@ public:
 
 	ImageManager *image_manager;
 	int slot;
-	bool is_float;
+	int is_float;
 	string filename;
 	ustring color_space;
 	ustring projection;
 	float projection_blend;
+	bool animated;
 
 	static ShaderEnum color_space_enum;
 	static ShaderEnum projection_enum;
@@ -85,10 +87,11 @@ public:
 
 	ImageManager *image_manager;
 	int slot;
-	bool is_float;
+	int is_float;
 	string filename;
 	ustring color_space;
 	ustring projection;
+	bool animated;
 
 	static ShaderEnum color_space_enum;
 	static ShaderEnum projection_enum;
@@ -193,7 +196,7 @@ class BsdfNode : public ShaderNode {
 public:
 	SHADER_NODE_CLASS(BsdfNode)
 
-	void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2);
+	void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL);
 
 	ClosureType closure;
 };
@@ -201,6 +204,7 @@ public:
 class WardBsdfNode : public BsdfNode {
 public:
 	SHADER_NODE_CLASS(WardBsdfNode)
+	void attributes(AttributeRequestSet *attributes);
 };
 
 class DiffuseBsdfNode : public BsdfNode {
@@ -239,6 +243,14 @@ public:
 	static ShaderEnum distribution_enum;
 };
 
+class RefractionBsdfNode : public BsdfNode {
+public:
+	SHADER_NODE_CLASS(RefractionBsdfNode)
+
+	ustring distribution;
+	static ShaderEnum distribution_enum;
+};
+
 class EmissionNode : public ShaderNode {
 public:
 	SHADER_NODE_CLASS(EmissionNode)
@@ -256,6 +268,11 @@ public:
 	SHADER_NODE_CLASS(HoldoutNode)
 };
 
+class AmbientOcclusionNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(AmbientOcclusionNode)
+};
+
 class VolumeNode : public ShaderNode {
 public:
 	SHADER_NODE_CLASS(VolumeNode)
@@ -278,6 +295,7 @@ public:
 class GeometryNode : public ShaderNode {
 public:
 	SHADER_NODE_CLASS(GeometryNode)
+	void attributes(AttributeRequestSet *attributes);
 };
 
 class TextureCoordinateNode : public ShaderNode {
@@ -333,6 +351,11 @@ public:
 	SHADER_NODE_CLASS(MixClosureNode)
 };
 
+class MixClosureWeightNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(MixClosureWeightNode);
+};
+
 class InvertNode : public ShaderNode {
 public:
 	SHADER_NODE_CLASS(InvertNode)
@@ -438,6 +461,48 @@ public:
 	float4 ramp[RAMP_TABLE_SIZE];
 };
 
+class SetNormalNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(SetNormalNode)
+};
+
+class OSLScriptNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(OSLScriptNode)
+	string filepath;
+	string bytecode_hash;
+	
+	/* ShaderInput/ShaderOutput only stores a shallow string copy (const char *)!
+	 * The actual socket names have to be stored externally to avoid memory errors. */
+	vector<ustring> input_names;
+	vector<ustring> output_names;
+};
+
+class NormalMapNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(NormalMapNode)
+	void attributes(AttributeRequestSet *attributes);
+
+	ustring space;
+	static ShaderEnum space_enum;
+
+	ustring attribute;
+};
+
+class TangentNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(TangentNode)
+	void attributes(AttributeRequestSet *attributes);
+
+	ustring direction_type;
+	static ShaderEnum direction_type_enum;
+
+	ustring axis;
+	static ShaderEnum axis_enum;
+
+	ustring attribute;
+};
+
 CCL_NAMESPACE_END
 
 #endif /* __NODES_H__ */
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index d78a82d..bd9f16d 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -51,20 +51,23 @@ Object::~Object()
 {
 }
 
-void Object::compute_bounds(bool motion_blur)
+void Object::compute_bounds(bool motion_blur, float shuttertime)
 {
 	BoundBox mbounds = mesh->bounds;
 
 	if(motion_blur && use_motion) {
-		MotionTransform decomp;
-		transform_motion_decompose(&decomp, &motion);
+		DecompMotionTransform decomp;
+		transform_motion_decompose(&decomp, &motion, &tfm);
 
 		bounds = BoundBox::empty;
 
 		/* todo: this is really terrible. according to pbrt there is a better
 		 * way to find this iteratively, but did not find implementation yet
 		 * or try to implement myself */
-		for(float t = 0.0f; t < 1.0f; t += 1.0f/128.0f) {
+		float start_t = 0.5f - shuttertime*0.25f;
+		float end_t = 0.5f + shuttertime*0.25f;
+
+		for(float t = start_t; t < end_t; t += (1.0f/128.0f)*shuttertime) {
 			Transform ttfm;
 
 			transform_motion_interpolate(&ttfm, &decomp, t);
@@ -109,7 +112,7 @@ void Object::apply_transform()
 
 	if(bounds.valid()) {
 		mesh->compute_bounds();
-		compute_bounds(false);
+		compute_bounds(false, 0.0f);
 	}
 
 	/* tfm is not reset to identity, all code that uses it needs to check the
@@ -145,13 +148,13 @@ ObjectManager::~ObjectManager()
 {
 }
 
-void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
+void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress)
 {
 	float4 *objects = dscene->objects.resize(OBJECT_SIZE*scene->objects.size());
-	uint *object_flag = dscene->object_flag.resize(scene->objects.size());
 	int i = 0;
 	map<Mesh*, float> surface_area_map;
-	Scene::MotionType need_motion = scene->need_motion();
+	Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading);
+	bool have_motion = false;
 
 	foreach(Object *ob, scene->objects) {
 		Mesh *mesh = ob->mesh;
@@ -220,20 +223,23 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
 			memcpy(&objects[offset+8], &mtfm_pre, sizeof(float4)*4);
 			memcpy(&objects[offset+12], &mtfm_post, sizeof(float4)*4);
 		}
+#ifdef __OBJECT_MOTION__
 		else if(need_motion == Scene::MOTION_BLUR) {
 			if(ob->use_motion) {
 				/* decompose transformations for interpolation */
-				MotionTransform decomp;
+				DecompMotionTransform decomp;
 
-				transform_motion_decompose(&decomp, &ob->motion);
+				transform_motion_decompose(&decomp, &ob->motion, &ob->tfm);
 				memcpy(&objects[offset+8], &decomp, sizeof(float4)*8);
 				flag |= SD_OBJECT_MOTION;
+				have_motion = true;
 			}
 			else {
 				float4 no_motion = make_float4(FLT_MAX);
-				memcpy(&objects[offset+8], &no_motion, sizeof(float4));
+				memcpy(&objects[offset+8], &no_motion, sizeof(float4)*8);
 			}
 		}
+#endif
 
 		/* dupli object coords */
 		objects[offset+16] = make_float4(ob->dupli_generated[0], ob->dupli_generated[1], ob->dupli_generated[2], 0.0f);
@@ -250,7 +256,8 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
 	}
 
 	device->tex_alloc("__objects", dscene->objects);
-	device->tex_alloc("__object_flag", dscene->object_flag);
+
+	dscene->data.bvh.have_motion = have_motion;
 }
 
 void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
@@ -263,9 +270,12 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
 	if(scene->objects.size() == 0)
 		return;
 
+	/* object info flag */
+	uint *object_flag = dscene->object_flag.resize(scene->objects.size());
+
 	/* set object transform matrices, before applying static transforms */
 	progress.set_status("Updating Objects", "Copying Transformations to device");
-	device_update_transforms(device, dscene, scene, progress);
+	device_update_transforms(device, dscene, scene, object_flag, progress);
 
 	if(progress.get_cancel()) return;
 
@@ -273,10 +283,11 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
 	/* todo: do before to support getting object level coords? */
 	if(scene->params.bvh_type == SceneParams::BVH_STATIC) {
 		progress.set_status("Updating Objects", "Applying Static Transformations");
-		apply_static_transforms(scene, progress);
+		apply_static_transforms(scene, object_flag, progress);
 	}
 
-	if(progress.get_cancel()) return;
+	/* allocate object flag */
+	device->tex_alloc("__object_flag", dscene->object_flag);
 
 	need_update = false;
 }
@@ -290,14 +301,20 @@ void ObjectManager::device_free(Device *device, DeviceScene *dscene)
 	dscene->object_flag.clear();
 }
 
-void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress)
+void ObjectManager::apply_static_transforms(Scene *scene, uint *object_flag, Progress& progress)
 {
 	/* todo: normals and displacement should be done before applying transform! */
 	/* todo: create objects/meshes in right order! */
 
 	/* counter mesh users */
 	map<Mesh*, int> mesh_users;
-	bool motion_blur = scene->need_motion() == Scene::MOTION_BLUR;
+#ifdef __OBJECT_MOTION__
+	Scene::MotionType need_motion = scene->need_motion();
+	bool motion_blur = need_motion == Scene::MOTION_BLUR;
+#else
+	bool motion_blur = false;
+#endif
+	int i = 0;
 
 	foreach(Object *object, scene->objects) {
 		map<Mesh*, int>::iterator it = mesh_users.find(object->mesh);
@@ -320,8 +337,12 @@ void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress)
 
 					if(progress.get_cancel()) return;
 				}
+
+				object_flag[i] |= SD_TRANSFORM_APPLIED;
 			}
 		}
+
+		i++;
 	}
 }
 
diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h
index e2c3ad4..9c9b11b 100644
--- a/intern/cycles/render/object.h
+++ b/intern/cycles/render/object.h
@@ -59,7 +59,7 @@ public:
 
 	void tag_update(Scene *scene);
 
-	void compute_bounds(bool motion_blur);
+	void compute_bounds(bool motion_blur, float shuttertime);
 	void apply_transform();
 };
 
@@ -73,12 +73,12 @@ public:
 	~ObjectManager();
 
 	void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
-	void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
+	void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress);
 	void device_free(Device *device, DeviceScene *dscene);
 
 	void tag_update(Scene *scene);
 
-	void apply_static_transforms(Scene *scene, Progress& progress);
+	void apply_static_transforms(Scene *scene, uint *object_flag, Progress& progress);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 6d23097..e4ee40d 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -31,6 +31,7 @@
 #include "osl_shader.h"
 
 #include "util_foreach.h"
+#include "util_md5.h"
 #include "util_path.h"
 #include "util_progress.h"
 
@@ -46,20 +47,8 @@ OSLShaderManager::OSLShaderManager()
 {
 	services = new OSLRenderServices();
 
-	/* if we let OSL create it, it leaks */
-	ts = TextureSystem::create(true);
-	ts->attribute("automip",  1);
-	ts->attribute("autotile", 64);
-
-	ss = OSL::ShadingSystem::create(services, ts, &errhandler);
-	ss->attribute("lockgeom", 1);
-	ss->attribute("commonspace", "world");
-	ss->attribute("optimize", 2);
-	//ss->attribute("debug", 1);
-	//ss->attribute("statistics:level", 1);
-	ss->attribute("searchpath:shader", path_get("shader").c_str());
-
-	OSLShader::register_closures(ss);
+	shading_system_init();
+	texture_system_init();
 }
 
 OSLShaderManager::~OSLShaderManager()
@@ -71,18 +60,14 @@ OSLShaderManager::~OSLShaderManager()
 
 void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
 {
-	/* test if we need to update */
-	bool need_update = false;
-
-	foreach(Shader *shader, scene->shaders)
-		if(shader->need_update)
-			need_update = true;
-	
 	if(!need_update)
 		return;
 
 	device_free(device, dscene);
 
+	/* determine which shaders are in use */
+	device_update_shaders_used(scene);
+
 	/* create shaders */
 	OSLGlobals *og = (OSLGlobals*)device->osl_memory();
 
@@ -94,22 +79,23 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
 		if(shader->sample_as_light && shader->has_surface_emission)
 			scene->light_manager->need_update = true;
 
-		OSLCompiler compiler((void*)ss);
+		OSLCompiler compiler((void*)this, (void*)ss, scene->image_manager);
 		compiler.background = (shader == scene->shaders[scene->default_background]);
 		compiler.compile(og, shader);
 	}
 
 	/* setup shader engine */
 	og->ss = ss;
+	og->ts = ts;
 	og->services = services;
 	int background_id = scene->shader_manager->get_shader_id(scene->default_background);
 	og->background_state = og->surface_state[background_id & SHADER_MASK];
 	og->use = true;
 
-	tls_create(OSLGlobals::ThreadData, og->thread_data);
-
 	foreach(Shader *shader, scene->shaders)
 		shader->need_update = false;
+
+	need_update = false;
 	
 	/* set texture system */
 	scene->image_manager->set_osl_texture_system((void*)ts);
@@ -126,8 +112,7 @@ void OSLShaderManager::device_free(Device *device, DeviceScene *dscene)
 	/* clear shader engine */
 	og->use = false;
 	og->ss = NULL;
-
-	tls_delete(OSLGlobals::ThreadData, og->thread_data);
+	og->ts = NULL;
 
 	og->surface_state.clear();
 	og->volume_state.clear();
@@ -135,11 +120,168 @@ void OSLShaderManager::device_free(Device *device, DeviceScene *dscene)
 	og->background_state.reset();
 }
 
+void OSLShaderManager::texture_system_init()
+{
+	/* if we let OSL create it, it leaks */
+	ts = TextureSystem::create(true);
+	ts->attribute("automip",  1);
+	ts->attribute("autotile", 64);
+	ts->attribute("gray_to_rgb", 1);
+
+	/* effectively unlimited for now, until we support proper mipmap lookups */
+	ts->attribute("max_memory_MB", 16384);
+}
+
+void OSLShaderManager::shading_system_init()
+{
+	ss = OSL::ShadingSystem::create(services, ts, &errhandler);
+	ss->attribute("lockgeom", 1);
+	ss->attribute("commonspace", "world");
+	ss->attribute("optimize", 2);
+	//ss->attribute("debug", 1);
+	//ss->attribute("statistics:level", 1);
+	ss->attribute("searchpath:shader", path_get("shader"));
+
+	/* our own ray types */
+	static const char *raytypes[] = {
+		"camera",		/* PATH_RAY_CAMERA */
+		"reflection",	/* PATH_RAY_REFLECT */
+		"refraction",	/* PATH_RAY_TRANSMIT */
+		"diffuse",		/* PATH_RAY_DIFFUSE */
+		"glossy",		/* PATH_RAY_GLOSSY */
+		"singular",		/* PATH_RAY_SINGULAR */
+		"transparent",	/* PATH_RAY_TRANSPARENT */
+		"shadow",		/* PATH_RAY_SHADOW_OPAQUE */
+		"shadow",		/* PATH_RAY_SHADOW_TRANSPARENT */
+	};
+
+	const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]);
+	ss->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
+
+	OSLShader::register_closures((OSLShadingSystem*)ss);
+
+	loaded_shaders.clear();
+}
+
+bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile)
+{
+	vector<string> options;
+	string stdosl_path;
+
+	/* specify output file name */
+	options.push_back("-o");
+	options.push_back(outputfile);
+
+	/* specify standard include path */
+	options.push_back("-I" + path_get("shader"));
+	stdosl_path = path_get("shader/stdosl.h");
+
+	/* compile */
+	OSL::OSLCompiler *compiler = OSL::OSLCompiler::create();
+	bool ok = compiler->compile(inputfile, options, stdosl_path);
+	delete compiler;
+
+	return ok;
+}
+
+bool OSLShaderManager::osl_query(OSL::OSLQuery& query, const string& filepath)
+{
+	string searchpath = path_user_get("shaders");
+	return query.open(filepath, searchpath);
+}
+
+static string shader_filepath_hash(const string& filepath, uint64_t modified_time)
+{
+	/* compute a hash from filepath and modified time to detect changes */
+	MD5Hash md5;
+	md5.append((const uint8_t*)filepath.c_str(), filepath.size());
+	md5.append((const uint8_t*)&modified_time, sizeof(modified_time));
+
+	return md5.get_hex();
+}
+
+const char *OSLShaderManager::shader_test_loaded(const string& hash)
+{
+	set<string>::iterator it = loaded_shaders.find(hash);
+	return (it == loaded_shaders.end())? NULL: it->c_str();
+}
+
+const char *OSLShaderManager::shader_load_filepath(string filepath)
+{
+	size_t len = filepath.size();
+	string extension = filepath.substr(len - 4);
+	uint64_t modified_time = path_modified_time(filepath);
+
+	if(extension == ".osl") {
+		/* .OSL File */
+		string osopath = filepath.substr(0, len - 4) + ".oso";
+		uint64_t oso_modified_time = path_modified_time(osopath);
+
+		/* test if we have loaded the corresponding .OSO already */
+		if(oso_modified_time != 0) {
+			const char *hash = shader_test_loaded(shader_filepath_hash(osopath, oso_modified_time));
+
+			if(hash)
+				return hash;
+		}
+
+		/* autocompile .OSL to .OSO if needed */
+		if(oso_modified_time == 0 || (oso_modified_time < modified_time)) {
+			OSLShaderManager::osl_compile(filepath, osopath);
+			modified_time = path_modified_time(osopath);
+		}
+		else
+			modified_time = oso_modified_time;
+
+		filepath = osopath;
+	}
+	else {
+		if(extension == ".oso") {
+			/* .OSO File, nothing to do */
+		}
+		else if(path_dirname(filepath) == "") {
+			/* .OSO File in search path */
+			filepath = path_join(path_user_get("shaders"), filepath + ".oso");
+		}
+		else {
+			/* unknown file */
+			return NULL;
+		}
+
+		/* test if we have loaded this .OSO already */
+		const char *hash = shader_test_loaded(shader_filepath_hash(filepath, modified_time));
+
+		if(hash)
+			return hash;
+	}
+
+	/* read oso bytecode from file */
+	string bytecode_hash = shader_filepath_hash(filepath, modified_time);
+	string bytecode;
+
+	if(!path_read_text(filepath, bytecode)) {
+		fprintf(stderr, "Cycles shader graph: failed to read file %s\n", filepath.c_str());
+		loaded_shaders.insert(bytecode_hash); /* to avoid repeat tries */
+		return NULL;
+	}
+
+	return shader_load_bytecode(bytecode_hash, bytecode);
+}
+
+const char *OSLShaderManager::shader_load_bytecode(const string& hash, const string& bytecode)
+{
+	ss->LoadMemoryShader(hash.c_str(), bytecode.c_str());
+
+	return loaded_shaders.insert(hash).first->c_str();
+}
+
 /* Graph Compiler */
 
-OSLCompiler::OSLCompiler(void *shadingsys_)
+OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, ImageManager *image_manager_)
 {
+	manager = manager_;
 	shadingsys = shadingsys_;
+	image_manager = image_manager_;
 	current_type = SHADER_TYPE_SURFACE;
 	current_shader = NULL;
 	background = false;
@@ -183,7 +325,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
 	while((i = sname.find(" ")) != string::npos)
 		sname.replace(i, 1, "");
 	
-	/* if output exists with the same name, add "In" suffix */
+	/* if input exists with the same name, add "Out" suffix */
 	foreach(ShaderInput *input, node->inputs) {
 		if (strcmp(input->name, output->name)==0) {
 			sname += "Out";
@@ -198,6 +340,9 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
 {
 	/* exception for output node, only one input is actually used
 	 * depending on the current shader type */
+	
+	if(!(input->usage & ShaderInput::USE_OSL))
+		return true;
 
 	if(node->name == ustring("output")) {
 		if(strcmp(input->name, "Surface") == 0 && current_type != SHADER_TYPE_SURFACE)
@@ -206,6 +351,12 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
 			return true;
 		if(strcmp(input->name, "Displacement") == 0 && current_type != SHADER_TYPE_DISPLACEMENT)
 			return true;
+		if(strcmp(input->name, "Normal") == 0)
+			return true;
+	}
+	else if(node->name == ustring("bump")) {
+		if(strcmp(input->name, "Height") == 0)
+			return true;
 	}
 	else if(current_type == SHADER_TYPE_DISPLACEMENT && input->link && input->link->parent->name == ustring("bump"))
 		return true;
@@ -213,10 +364,18 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
 	return false;
 }
 
-void OSLCompiler::add(ShaderNode *node, const char *name)
+void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
 {
 	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
 
+	/* load filepath */
+	if(isfilepath) {
+		name = ((OSLShaderManager*)manager)->shader_load_filepath(name);
+
+		if(name == NULL)
+			return;
+	}
+
 	/* pass in fixed parameter values */
 	foreach(ShaderInput *input, node->inputs) {
 		if(!input->link) {
@@ -244,6 +403,12 @@ void OSLCompiler::add(ShaderNode *node, const char *name)
 				case SHADER_SOCKET_FLOAT:
 					parameter(param_name.c_str(), input->value.x);
 					break;
+				case SHADER_SOCKET_INT:
+					parameter(param_name.c_str(), (int)input->value.x);
+					break;
+				case SHADER_SOCKET_STRING:
+					parameter(param_name.c_str(), input->value_string);
+					break;
 				case SHADER_SOCKET_CLOSURE:
 					break;
 			}
@@ -482,82 +647,85 @@ void OSLCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
 
 void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
 {
-	OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
-	ShaderGraph *graph = shader->graph;
-	ShaderNode *output = (graph)? graph->output(): NULL;
+	if(shader->need_update) {
+		OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
+		ShaderGraph *graph = shader->graph;
+		ShaderNode *output = (graph)? graph->output(): NULL;
 
-	/* copy graph for shader with bump mapping */
-	if(output->input("Surface")->link && output->input("Displacement")->link)
-		if(!shader->graph_bump)
-			shader->graph_bump = shader->graph->copy();
+		/* copy graph for shader with bump mapping */
+		if(output->input("Surface")->link && output->input("Displacement")->link)
+			if(!shader->graph_bump)
+				shader->graph_bump = shader->graph->copy();
 
-	/* finalize */
-	shader->graph->finalize(false, true);
-	if(shader->graph_bump)
-		shader->graph_bump->finalize(true, true);
+		/* finalize */
+		shader->graph->finalize(false, true);
+		if(shader->graph_bump)
+			shader->graph_bump->finalize(true, true);
 
-	current_shader = shader;
+		current_shader = shader;
 
-	shader->has_surface = false;
-	shader->has_surface_emission = false;
-	shader->has_surface_transparent = false;
-	shader->has_volume = false;
-	shader->has_displacement = false;
+		shader->has_surface = false;
+		shader->has_surface_emission = false;
+		shader->has_surface_transparent = false;
+		shader->has_volume = false;
+		shader->has_displacement = false;
 
-	/* generate surface shader */
-	if(graph && output->input("Surface")->link) {
-		compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
-		og->surface_state.push_back(ss->state());
+		/* generate surface shader */
+		if(shader->used && graph && output->input("Surface")->link) {
+			compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
+			shader->osl_surface_ref = ss->state();
 
-		if(shader->graph_bump) {
+			if(shader->graph_bump) {
+				ss->clear_state();
+				compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE);
+			}
+
+			shader->osl_surface_bump_ref = ss->state();
 			ss->clear_state();
-			compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE);
-			og->surface_state.push_back(ss->state());
-		}
-		else
-			og->surface_state.push_back(ss->state());
 
-		ss->clear_state();
+			shader->has_surface = true;
+		}
+		else {
+			shader->osl_surface_ref = OSL::ShadingAttribStateRef();
+			shader->osl_surface_bump_ref = OSL::ShadingAttribStateRef();
+		}
 
-		shader->has_surface = true;
-	}
-	else {
-		og->surface_state.push_back(OSL::ShadingAttribStateRef());
-		og->surface_state.push_back(OSL::ShadingAttribStateRef());
-	}
+		/* generate volume shader */
+		if(shader->used && graph && output->input("Volume")->link) {
+			compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
+			shader->has_volume = true;
 
-	/* generate volume shader */
-	if(graph && output->input("Volume")->link) {
-		compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
-		shader->has_volume = true;
+			shader->osl_volume_ref = ss->state();
+			ss->clear_state();
+		}
+		else
+			shader->osl_volume_ref = OSL::ShadingAttribStateRef();
 
-		og->volume_state.push_back(ss->state());
-		og->volume_state.push_back(ss->state());
-		ss->clear_state();
-	}
-	else {
-		og->volume_state.push_back(OSL::ShadingAttribStateRef());
-		og->volume_state.push_back(OSL::ShadingAttribStateRef());
+		/* generate displacement shader */
+		if(shader->used && graph && output->input("Displacement")->link) {
+			compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
+			shader->has_displacement = true;
+			shader->osl_displacement_ref = ss->state();
+			ss->clear_state();
+		}
+		else
+			shader->osl_displacement_ref = OSL::ShadingAttribStateRef();
 	}
 
-	/* generate displacement shader */
-	if(graph && output->input("Displacement")->link) {
-		compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
-		shader->has_displacement = true;
+	/* push state to array for lookup */
+	og->surface_state.push_back(shader->osl_surface_ref);
+	og->surface_state.push_back(shader->osl_surface_bump_ref);
 
-		og->displacement_state.push_back(ss->state());
-		og->displacement_state.push_back(ss->state());
-		ss->clear_state();
-	}
-	else {
-		og->displacement_state.push_back(OSL::ShadingAttribStateRef());
-		og->displacement_state.push_back(OSL::ShadingAttribStateRef());
-	}
+	og->volume_state.push_back(shader->osl_volume_ref);
+	og->volume_state.push_back(shader->osl_volume_ref);
+
+	og->displacement_state.push_back(shader->osl_displacement_ref);
+	og->displacement_state.push_back(shader->osl_displacement_ref);
 }
 
 #else
 
-void OSLCompiler::add(ShaderNode *node, const char *name)
+void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
 {
 }
 
diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h
index 90107a3..9b58745 100644
--- a/intern/cycles/render/osl.h
+++ b/intern/cycles/render/osl.h
@@ -20,11 +20,14 @@
 #define __OSL_H__
 
 #include "util_set.h"
+#include "util_string.h"
 
 #include "shader.h"
 
 #ifdef WITH_OSL
+#include <OSL/oslcomp.h>
 #include <OSL/oslexec.h>
+#include <OSL/oslquery.h>
 #endif
 
 CCL_NAMESPACE_BEGIN
@@ -49,14 +52,29 @@ public:
 	OSLShaderManager();
 	~OSLShaderManager();
 
+	bool use_osl() { return true; }
+
 	void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
 	void device_free(Device *device, DeviceScene *dscene);
 
-private:
+	/* osl compile and query */
+	static bool osl_compile(const string& inputfile, const string& outputfile);
+	static bool osl_query(OSL::OSLQuery& query, const string& filepath);
+
+	/* shader file loading, all functions return pointer to hash string if found */
+	const char *shader_test_loaded(const string& hash);
+	const char *shader_load_bytecode(const string& hash, const string& bytecode);
+	const char *shader_load_filepath(string filepath);
+
+protected:
+	void texture_system_init();
+	void shading_system_init();
+
 	OSL::ShadingSystem *ss;
 	OSL::TextureSystem *ts;
 	OSLRenderServices *services;
 	OSL::ErrorHandler errhandler;
+	set<string> loaded_shaders;
 };
 
 #endif
@@ -65,10 +83,10 @@ private:
 
 class OSLCompiler {
 public:
-	OSLCompiler(void *shadingsys);
+	OSLCompiler(void *manager, void *shadingsys, ImageManager *image_manager);
 	void compile(OSLGlobals *og, Shader *shader);
 
-	void add(ShaderNode *node, const char *name);
+	void add(ShaderNode *node, const char *name, bool isfilepath = false);
 
 	void parameter(const char *name, float f);
 	void parameter_color(const char *name, float3 f);
@@ -92,6 +110,7 @@ public:
 	ShaderType output_type() { return current_type; }
 
 	bool background;
+	ImageManager *image_manager;
 
 private:
 	string id(ShaderNode *node);
@@ -104,6 +123,7 @@ private:
 	void generate_nodes(const set<ShaderNode*>& nodes);
 
 	void *shadingsys;
+	void *manager;
 	ShaderType current_type;
 	Shader *current_shader;
 };
diff --git a/intern/cycles/render/particles.cpp b/intern/cycles/render/particles.cpp
index 9f951d9..2a1570f 100644
--- a/intern/cycles/render/particles.cpp
+++ b/intern/cycles/render/particles.cpp
@@ -57,8 +57,7 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
 {
 	/* count particles.
 	 * adds one dummy particle at the beginning to avoid invalid lookups,
-	 * in case a shader uses particle info without actual particle data.
-	 */
+	 * in case a shader uses particle info without actual particle data. */
 	int num_particles = 1;
 	foreach(ParticleSystem *psys, scene->particle_systems)
 		num_particles += psys->particles.size();
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index 071338d..8085cfd 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -53,42 +53,25 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
 	object_manager = new ObjectManager();
 	integrator = new Integrator();
 	image_manager = new ImageManager();
-	shader_manager = ShaderManager::create(this);
 	particle_system_manager = new ParticleSystemManager();
 
+	/* OSL only works on the CPU */
+	if(device_info_.type == DEVICE_CPU)
+		shader_manager = ShaderManager::create(this, params.shadingsystem);
+	else
+		shader_manager = ShaderManager::create(this, SceneParams::SVM);
+
 	if (device_info_.type == DEVICE_CPU)
 		image_manager->set_extended_image_limits();
 }
 
 Scene::~Scene()
 {
-	if(device) camera->device_free(device, &dscene);
-	delete camera;
-
-	if(device) filter->device_free(device, &dscene);
-	delete filter;
-
-	if(device) film->device_free(device, &dscene);
-	delete film;
-
-	if(device) background->device_free(device, &dscene);
-	delete background;
-
-	if(device) mesh_manager->device_free(device, &dscene);
-	delete mesh_manager;
-
-	if(device) object_manager->device_free(device, &dscene);
-	delete object_manager;
-
-	if(device) integrator->device_free(device, &dscene);
-	delete integrator;
-
-	if(device) shader_manager->device_free(device, &dscene);
-	delete shader_manager;
-
-	if(device) light_manager->device_free(device, &dscene);
-	delete light_manager;
+	free_memory(true);
+}
 
+void Scene::free_memory(bool final)
+{
 	foreach(Shader *s, shaders)
 		delete s;
 	foreach(Mesh *m, meshes)
@@ -100,11 +83,44 @@ Scene::~Scene()
 	foreach(ParticleSystem *p, particle_systems)
 		delete p;
 
-	if(device) image_manager->device_free(device, &dscene);
-	delete image_manager;
-
-	if(device) particle_system_manager->device_free(device, &dscene);
-	delete particle_system_manager;
+	if(device) {
+		camera->device_free(device, &dscene);
+		filter->device_free(device, &dscene);
+		film->device_free(device, &dscene);
+		background->device_free(device, &dscene);
+		integrator->device_free(device, &dscene);
+
+		object_manager->device_free(device, &dscene);
+		mesh_manager->device_free(device, &dscene);
+		shader_manager->device_free(device, &dscene);
+		light_manager->device_free(device, &dscene);
+
+		particle_system_manager->device_free(device, &dscene);
+
+		if(!params.persistent_images || final)
+			image_manager->device_free(device, &dscene);
+	}
+
+	if(final) {
+		delete filter;
+		delete camera;
+		delete film;
+		delete background;
+		delete integrator;
+		delete object_manager;
+		delete mesh_manager;
+		delete shader_manager;
+		delete light_manager;
+		delete particle_system_manager;
+		delete image_manager;
+	}
+	else {
+		shaders.clear();
+		meshes.clear();
+		objects.clear();
+		lights.clear();
+		particle_systems.clear();
+	}
 }
 
 void Scene::device_update(Device *device_, Progress& progress)
@@ -183,10 +199,10 @@ void Scene::device_update(Device *device_, Progress& progress)
 	device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
 }
 
-Scene::MotionType Scene::need_motion()
+Scene::MotionType Scene::need_motion(bool advanced_shading)
 {
 	if(integrator->motion_blur)
-		return MOTION_BLUR;
+		return (advanced_shading)? MOTION_BLUR: MOTION_NONE;
 	else if(Pass::contains(film->passes, PASS_MOTION))
 		return MOTION_PASS;
 	else
@@ -229,5 +245,22 @@ bool Scene::need_reset()
 		|| particle_system_manager->need_update);
 }
 
+void Scene::reset()
+{
+	shader_manager->add_default(this);
+
+	/* ensure all objects are updated */
+	camera->tag_update();
+	filter->tag_update(this);
+	film->tag_update(this);
+	background->tag_update(this);
+	integrator->tag_update(this);
+}
+
+void Scene::device_free()
+{
+	free_memory(false);
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index 09087fb..92ef692 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -120,6 +120,7 @@ public:
 	bool use_bvh_cache;
 	bool use_bvh_spatial_split;
 	bool use_qbvh;
+	bool persistent_images;
 
 	SceneParams()
 	{
@@ -139,7 +140,8 @@ public:
 		&& bvh_type == params.bvh_type
 		&& use_bvh_cache == params.use_bvh_cache
 		&& use_bvh_spatial_split == params.use_bvh_spatial_split
-		&& use_qbvh == params.use_qbvh); }
+		&& use_qbvh == params.use_qbvh
+		&& persistent_images == params.persistent_images); }
 };
 
 /* Scene */
@@ -194,10 +196,16 @@ public:
 	void need_global_attributes(AttributeRequestSet& attributes);
 
 	enum MotionType { MOTION_NONE = 0, MOTION_PASS, MOTION_BLUR };
-	MotionType need_motion();
+	MotionType need_motion(bool advanced_shading = true);
 
 	bool need_update();
 	bool need_reset();
+
+	void reset();
+	void device_free();
+
+protected:
+	void free_memory(bool final);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index cd410e4..1d1a3d5 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -34,16 +34,22 @@
 
 CCL_NAMESPACE_BEGIN
 
+/* Note about  preserve_tile_device option for tile manager:
+ * progressive refine and viewport rendering does requires tiles to
+ * always be allocated for the same device
+ */
 Session::Session(const SessionParams& params_)
 : params(params_),
   tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution,
-  	(params.background)? 1: max(params.device.multi_devices.size(), 1))
+       params.background == false || params.progressive_refine, params.background,
+       max(params.device.multi_devices.size(), 1)),
+  stats()
 {
 	device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
 
 	TaskScheduler::init(params.threads);
 
-	device = Device::create(params.device, params.background, params.threads);
+	device = Device::create(params.device, stats, params.background);
 
 	if(params.background) {
 		buffers = NULL;
@@ -96,6 +102,9 @@ Session::~Session()
 		display->write(device, params.output_path);
 	}
 
+	foreach(RenderBuffers *buffers, tile_buffers)
+		delete buffers;
+
 	delete buffers;
 	delete display;
 	delete scene;
@@ -173,9 +182,12 @@ bool Session::draw_gpu(BufferParams& buffer_params)
 
 void Session::run_gpu()
 {
+	bool tiles_written = false;
+
 	start_time = time_dt();
 	reset_time = time_dt();
 	paused_time = 0.0;
+	last_update_time = time_dt();
 
 	if(!params.background)
 		progress.set_start_time(start_time + paused_time);
@@ -267,10 +279,15 @@ void Session::run_gpu()
 			if(device->error_message() != "")
 				progress.set_cancel(device->error_message());
 
+			tiles_written = update_progressive_refine(progress.get_cancel());
+
 			if(progress.get_cancel())
 				break;
 		}
 	}
+
+	if(!tiles_written)
+		update_progressive_refine(true);
 }
 
 /* CPU Session */
@@ -313,14 +330,18 @@ bool Session::draw_cpu(BufferParams& buffer_params)
 
 bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
 {
-	if(progress.get_cancel())
-		return false;
+	if(progress.get_cancel()) {
+		if(params.progressive_refine == false) {
+			/* for progressive refine current sample should be finished for all tiles */
+			return false;
+		}
+	}
 
 	thread_scoped_lock tile_lock(tile_mutex);
 
 	/* get next tile from manager */
 	Tile tile;
-	int device_num = (params.background)? 0: device->device_number(tile_device);
+	int device_num = device->device_number(tile_device);
 
 	if(!tile_manager.next_tile(tile, device_num))
 		return false;
@@ -338,7 +359,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
 
 	/* in case of a permant buffer, return it, otherwise we will allocate
 	 * a new temporary buffer */
-	if(!write_render_tile_cb) {
+	if(!params.background) {
 		tile_manager.state.buffer.get_offset_stride(rtile.offset, rtile.stride);
 
 		rtile.buffer = buffers->buffer.device_pointer;
@@ -360,9 +381,30 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
 
 	buffer_params.get_offset_stride(rtile.offset, rtile.stride);
 
-	/* allocate buffers */
 	RenderBuffers *tilebuffers = new RenderBuffers(tile_device);
-	tilebuffers->reset(tile_device, buffer_params);
+
+	/* allocate buffers */
+	if(params.progressive_refine) {
+		tile_lock.lock();
+
+		if(tile_buffers.size() == 0)
+			tile_buffers.resize(tile_manager.state.num_tiles, NULL);
+
+		tilebuffers = tile_buffers[tile.index];
+		if(tilebuffers == NULL) {
+			tilebuffers = new RenderBuffers(tile_device);
+			tile_buffers[tile.index] = tilebuffers;
+
+			tilebuffers->reset(tile_device, buffer_params);
+		}
+
+		tile_lock.unlock();
+	}
+	else {
+		tilebuffers = new RenderBuffers(tile_device);
+
+		tilebuffers->reset(tile_device, buffer_params);
+	}
 
 	rtile.buffer = tilebuffers->buffer.device_pointer;
 	rtile.rng_state = tilebuffers->rng_state.device_pointer;
@@ -377,9 +419,11 @@ void Session::update_tile_sample(RenderTile& rtile)
 	thread_scoped_lock tile_lock(tile_mutex);
 
 	if(update_render_tile_cb) {
-		/* todo: optimize this by making it thread safe and removing lock */
+		if(params.progressive_refine == false) {
+			/* todo: optimize this by making it thread safe and removing lock */
 
-		update_render_tile_cb(rtile);
+			update_render_tile_cb(rtile);
+		}
 	}
 
 	update_status_time();
@@ -390,10 +434,12 @@ void Session::release_tile(RenderTile& rtile)
 	thread_scoped_lock tile_lock(tile_mutex);
 
 	if(write_render_tile_cb) {
-		/* todo: optimize this by making it thread safe and removing lock */
-		write_render_tile_cb(rtile);
+		if(params.progressive_refine == false) {
+			/* todo: optimize this by making it thread safe and removing lock */
+			write_render_tile_cb(rtile);
 
-		delete rtile.buffers;
+			delete rtile.buffers;
+		}
 	}
 
 	update_status_time();
@@ -401,6 +447,10 @@ void Session::release_tile(RenderTile& rtile)
 
 void Session::run_cpu()
 {
+	bool tiles_written = false;
+
+	last_update_time = time_dt();
+
 	{
 		/* reset once to start */
 		thread_scoped_lock reset_lock(delayed_reset.mutex);
@@ -502,10 +552,15 @@ void Session::run_cpu()
 
 			if(device->error_message() != "")
 				progress.set_cancel(device->error_message());
+
+			tiles_written = update_progressive_refine(progress.get_cancel());
 		}
 
 		progress.set_update();
 	}
+
+	if(!tiles_written)
+		update_progressive_refine(true);
 }
 
 void Session::run()
@@ -582,6 +637,15 @@ void Session::reset(BufferParams& buffer_params, int samples)
 		reset_gpu(buffer_params, samples);
 	else
 		reset_cpu(buffer_params, samples);
+
+	if(params.progressive_refine) {
+		thread_scoped_lock buffers_lock(buffers_mutex);
+
+		foreach(RenderBuffers *buffers, tile_buffers)
+			delete buffers;
+
+		tile_buffers.clear();
+	}
 }
 
 void Session::set_samples(int samples)
@@ -657,10 +721,13 @@ void Session::update_status_time(bool show_pause, bool show_done)
 	string status, substatus;
 
 	if(!params.progressive) {
+		bool is_gpu = params.device.type == DEVICE_CUDA || params.device.type == DEVICE_OPENCL;
+		bool is_multidevice = params.device.multi_devices.size() > 1;
+		bool is_cpu = params.device.type == DEVICE_CPU;
+
 		substatus = string_printf("Path Tracing Tile %d/%d", tile, num_tiles);
 
-		if(params.device.type == DEVICE_CUDA || params.device.type == DEVICE_OPENCL ||
-			(params.device.type == DEVICE_CPU && num_tiles == 1)) {
+		if((is_gpu && !is_multidevice) || (is_cpu && num_tiles == 1)) {
 			/* when rendering on GPU multithreading happens within single tile, as in
 			 * tiles are handling sequentially and in this case we could display
 			 * currently rendering sample number
@@ -699,7 +766,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
 	if(preview_time == 0.0 && resolution == 1)
 		preview_time = time_dt();
 	
-	double tile_time = (tile == 0)? 0.0: (time_dt() - preview_time - paused_time)/(sample);
+	double tile_time = (tile == 0 || sample == 0)? 0.0: (time_dt() - preview_time - paused_time) / sample;
 
 	/* negative can happen when we pause a bit before rendering, can discard that */
 	if(preview_time < 0.0) preview_time = 0.0;
@@ -722,6 +789,7 @@ void Session::path_trace()
 	task.get_cancel = function_bind(&Progress::get_cancel, &this->progress);
 	task.update_tile_sample = function_bind(&Session::update_tile_sample, this, _1);
 	task.update_progress_sample = function_bind(&Session::update_progress_sample, this);
+	task.need_finish_queue = params.progressive_refine;
 
 	device->task_add(task);
 }
@@ -752,5 +820,49 @@ void Session::tonemap()
 	display_outdated = false;
 }
 
-CCL_NAMESPACE_END
+bool Session::update_progressive_refine(bool cancel)
+{
+	int sample = tile_manager.state.sample + 1;
+	bool write = sample == params.samples || cancel;
+
+	double current_time = time_dt();
+
+	if (current_time - last_update_time < 1.0) {
+		/* if last sample was processed, we need to write buffers anyway  */
+		if (!write)
+			return false;
+	}
+
+	if(params.progressive_refine) {
+		foreach(RenderBuffers *buffers, tile_buffers) {
+			RenderTile rtile;
+			rtile.buffers = buffers;
+			rtile.sample = sample;
 
+			if(write)
+				write_render_tile_cb(rtile);
+			else
+				update_render_tile_cb(rtile);
+		}
+	}
+
+	last_update_time = current_time;
+
+	return write;
+}
+
+void Session::device_free()
+{
+	scene->device_free();
+
+	foreach(RenderBuffers *buffers, tile_buffers)
+		delete buffers;
+
+	tile_buffers.clear();
+
+	/* used from background render only, so no need to
+	 * re-create render/display buffers here
+	 */
+}
+
+CCL_NAMESPACE_END
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index eda8b3d..cfc1502 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -24,7 +24,9 @@
 #include "tile.h"
 
 #include "util_progress.h"
+#include "util_stats.h"
 #include "util_thread.h"
+#include "util_vector.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -42,6 +44,7 @@ class SessionParams {
 public:
 	DeviceInfo device;
 	bool background;
+	bool progressive_refine;
 	string output_path;
 
 	bool progressive;
@@ -55,9 +58,12 @@ public:
 	double reset_timeout;
 	double text_timeout;
 
+	enum { OSL, SVM } shadingsystem;
+
 	SessionParams()
 	{
 		background = false;
+		progressive_refine = false;
 		output_path = "";
 
 		progressive = false;
@@ -70,12 +76,15 @@ public:
 		cancel_timeout = 0.1;
 		reset_timeout = 0.1;
 		text_timeout = 1.0;
+
+		shadingsystem = SVM;
 	}
 
 	bool modified(const SessionParams& params)
 	{ return !(device.type == params.device.type
 		&& device.id == params.device.id
 		&& background == params.background
+		&& progressive_refine == params.progressive_refine
 		&& output_path == params.output_path
 		/* && samples == params.samples */
 		&& progressive == params.progressive
@@ -85,7 +94,8 @@ public:
 		&& threads == params.threads
 		&& cancel_timeout == params.cancel_timeout
 		&& reset_timeout == params.reset_timeout
-		&& text_timeout == params.text_timeout); }
+		&& text_timeout == params.text_timeout
+		&& shadingsystem == params.shadingsystem); }
 
 };
 
@@ -103,6 +113,7 @@ public:
 	Progress progress;
 	SessionParams params;
 	TileManager tile_manager;
+	Stats stats;
 
 	boost::function<void(RenderTile&)> write_render_tile_cb;
 	boost::function<void(RenderTile&)> update_render_tile_cb;
@@ -119,6 +130,7 @@ public:
 	void set_samples(int samples);
 	void set_pause(bool pause);
 
+	void device_free();
 protected:
 	struct DelayedReset {
 		thread_mutex mutex;
@@ -173,6 +185,12 @@ protected:
 	double reset_time;
 	double preview_time;
 	double paused_time;
+
+	/* progressive refine */
+	double last_update_time;
+	bool update_progressive_refine(bool cancel);
+
+	vector<RenderBuffers *> tile_buffers;
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index fae1d6b..b9b49bf 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -49,6 +49,8 @@ Shader::Shader()
 	has_volume = false;
 	has_displacement = false;
 
+	used = false;
+
 	need_update = true;
 	need_update_attributes = true;
 }
@@ -98,6 +100,16 @@ void Shader::tag_update(Scene *scene)
 	}
 }
 
+void Shader::tag_used(Scene *scene)
+{
+	/* if an unused shader suddenly gets used somewhere, it needs to be
+	 * recompiled because it was skipped for compilation before */
+	if(!used) {
+		need_update = true;
+		scene->shader_manager->need_update = true;
+	}
+}
+
 /* Shader Manager */
 
 ShaderManager::ShaderManager()
@@ -109,12 +121,12 @@ ShaderManager::~ShaderManager()
 {
 }
 
-ShaderManager *ShaderManager::create(Scene *scene)
+ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
 {
 	ShaderManager *manager;
 
 #ifdef WITH_OSL
-	if(scene->params.shadingsystem == SceneParams::OSL)
+	if(shadingsystem == SceneParams::OSL)
 		manager = new OSLShaderManager();
 	else
 #endif
@@ -161,6 +173,27 @@ int ShaderManager::get_shader_id(uint shader, Mesh *mesh, bool smooth)
 	return id;
 }
 
+void ShaderManager::device_update_shaders_used(Scene *scene)
+{
+	/* figure out which shaders are in use, so SVM/OSL can skip compiling them
+	 * for speed and avoid loading image textures into memory */
+	foreach(Shader *shader, scene->shaders)
+		shader->used = false;
+
+	scene->shaders[scene->default_surface]->used = true;
+	scene->shaders[scene->default_light]->used = true;
+	scene->shaders[scene->default_background]->used = true;
+	scene->shaders[scene->default_holdout]->used = true;
+	scene->shaders[scene->default_empty]->used = true;
+
+	foreach(Mesh *mesh, scene->meshes)
+		foreach(uint shader, mesh->used_shaders)
+			scene->shaders[shader]->used = true;
+
+	foreach(Light *light, scene->lights)
+		scene->shaders[light->shader]->used = true;
+}
+
 void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
 {
 	device_free_common(device, dscene);
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 0278800..d442100 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -27,6 +27,10 @@
 #include "util_string.h"
 #include "util_types.h"
 
+#ifdef WITH_OSL
+#include <OSL/oslexec.h>
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 class Device;
@@ -75,11 +79,23 @@ public:
 	/* requested mesh attributes */
 	AttributeRequestSet attributes;
 
+	/* determined before compiling */
+	bool used;
+
+#ifdef WITH_OSL
+	/* osl shading state references */
+	OSL::ShadingAttribStateRef osl_surface_ref;
+	OSL::ShadingAttribStateRef osl_surface_bump_ref;
+	OSL::ShadingAttribStateRef osl_volume_ref;
+	OSL::ShadingAttribStateRef osl_displacement_ref;
+#endif
+
 	Shader();
 	~Shader();
 
 	void set_graph(ShaderGraph *graph);
 	void tag_update(Scene *scene);
+	void tag_used(Scene *scene);
 };
 
 /* Shader Manager virtual base class
@@ -91,13 +107,16 @@ class ShaderManager {
 public:
 	bool need_update;
 
-	static ShaderManager *create(Scene *scene);
+	static ShaderManager *create(Scene *scene, int shadingsystem);
 	virtual ~ShaderManager();
 
+	virtual bool use_osl() { return false; }
+
 	/* device update */
 	virtual void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) = 0;
 	virtual void device_free(Device *device, DeviceScene *dscene) = 0;
 
+	void device_update_shaders_used(Scene *scene);
 	void device_update_common(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
 	void device_free_common(Device *device, DeviceScene *dscene);
 
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 844ce01..4acd174 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -48,6 +48,9 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
 	/* test if we need to update */
 	device_free(device, dscene);
 
+	/* determine which shaders are in use */
+	device_update_shaders_used(scene);
+
 	/* svm_nodes */
 	vector<int4> svm_nodes;
 	size_t i;
@@ -119,6 +122,8 @@ int SVMCompiler::stack_size(ShaderSocketType type)
 {
 	if(type == SHADER_SOCKET_FLOAT)
 		return 1;
+	else if(type == SHADER_SOCKET_INT)
+		return 1;
 	else if(type == SHADER_SOCKET_COLOR)
 		return 3;
 	else if(type == SHADER_SOCKET_VECTOR)
@@ -212,10 +217,13 @@ void SVMCompiler::stack_assign(ShaderInput *input)
 			if(input->type == SHADER_SOCKET_FLOAT) {
 				add_node(NODE_VALUE_F, __float_as_int(input->value.x), input->stack_offset);
 			}
+			else if(input->type == SHADER_SOCKET_INT) {
+				add_node(NODE_VALUE_F, (int)input->value.x, input->stack_offset);
+			}
 			else if(input->type == SHADER_SOCKET_VECTOR ||
-				input->type == SHADER_SOCKET_NORMAL ||
-				input->type == SHADER_SOCKET_POINT ||
-				input->type == SHADER_SOCKET_COLOR) {
+			        input->type == SHADER_SOCKET_NORMAL ||
+			        input->type == SHADER_SOCKET_POINT ||
+			        input->type == SHADER_SOCKET_COLOR) {
 
 				add_node(NODE_VALUE_V, input->stack_offset);
 				add_node(NODE_VALUE_V, input->value);
@@ -479,56 +487,28 @@ void SVMCompiler::generate_closure(ShaderNode *node, set<ShaderNode*>& done)
 	}
 }
 
-void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, uint in_offset)
+void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, set<ShaderNode*>& closure_done)
 {
 	/* todo: the weaks point here is that unlike the single closure sampling 
 	 * we will evaluate all nodes even if they are used as input for closures
 	 * that are unused. it's not clear what would be the best way to skip such
 	 * nodes at runtime, especially if they are tangled up  */
+	
+	/* only generate once */
+	if(closure_done.find(node) != closure_done.end())
+		return;
+
+	closure_done.insert(node);
 
 	if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) {
-		ShaderInput *fin = node->input("Fac");
+		/* weighting is already taken care of in ShaderGraph::transform_multi_closure */
 		ShaderInput *cl1in = node->input("Closure1");
 		ShaderInput *cl2in = node->input("Closure2");
 
-		uint out1_offset = SVM_STACK_INVALID;
-		uint out2_offset = SVM_STACK_INVALID;
-
-		if(fin) {
-			/* mix closure */
-			set<ShaderNode*> dependencies;
-			find_dependencies(dependencies, done, fin);
-			generate_svm_nodes(dependencies, done);
-
-			stack_assign(fin);
-
-			if(cl1in->link)
-				out1_offset = stack_find_offset(SHADER_SOCKET_FLOAT);
-			if(cl2in->link)
-				out2_offset = stack_find_offset(SHADER_SOCKET_FLOAT);
-
-			add_node(NODE_MIX_CLOSURE, 
-				encode_uchar4(fin->stack_offset, in_offset, out1_offset, out2_offset));
-		}
-		else {
-			/* add closure */
-			out1_offset = in_offset;
-			out2_offset = in_offset;
-		}
-
-		if(cl1in->link) {
-			generate_multi_closure(cl1in->link->parent, done, out1_offset);
-
-			if(fin)
-				stack_clear_offset(SHADER_SOCKET_FLOAT, out1_offset);
-		}
-
-		if(cl2in->link) {
-			generate_multi_closure(cl2in->link->parent, done, out2_offset);
-
-			if(fin)
-				stack_clear_offset(SHADER_SOCKET_FLOAT, out2_offset);
-		}
+		if(cl1in->link)
+			generate_multi_closure(cl1in->link->parent, done, closure_done);
+		if(cl2in->link)
+			generate_multi_closure(cl2in->link->parent, done, closure_done);
 	}
 	else {
 		/* execute dependencies for closure */
@@ -540,7 +520,16 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
 			}
 		}
 
-		mix_weight_offset = in_offset;
+		/* closure mix weight */
+		const char *weight_name = (current_type == SHADER_TYPE_VOLUME)? "VolumeMixWeight": "SurfaceMixWeight";
+		ShaderInput *weight_in = node->input(weight_name);
+
+		if(weight_in && (weight_in->link || weight_in->value.x != 1.0f)) {
+			stack_assign(weight_in);
+			mix_weight_offset = weight_in->stack_offset;
+		}
+		else
+			mix_weight_offset = SVM_STACK_INVALID;
 
 		/* compile closure itself */
 		node->compile(*this);
@@ -553,9 +542,9 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
 			current_shader->has_surface_emission = true;
 		if(node->name == ustring("transparent"))
 			current_shader->has_surface_transparent = true;
-
-		/* end node is added outside of this */
 	}
+
+	done.insert(node);
 }
 
 
@@ -604,36 +593,40 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
 			output->stack_offset = SVM_STACK_INVALID;
 	}
 
-	if(clin->link) {
-		bool generate = false;
-		if(type == SHADER_TYPE_SURFACE) {
-			/* generate surface shader */
-			generate = true;
-			shader->has_surface = true;
-		}
-		else if(type == SHADER_TYPE_VOLUME) {
-			/* generate volume shader */
-			generate = true;
-			shader->has_volume = true;
-		}
-		else if(type == SHADER_TYPE_DISPLACEMENT) {
-			/* generate displacement shader */
-			generate = true;
-			shader->has_displacement = true;
-		}
+	if(shader->used) {
+		if(clin->link) {
+			bool generate = false;
+			if(type == SHADER_TYPE_SURFACE) {
+				/* generate surface shader */
+				generate = true;
+				shader->has_surface = true;
+			}
+			else if(type == SHADER_TYPE_VOLUME) {
+				/* generate volume shader */
+				generate = true;
+				shader->has_volume = true;
+			}
+			else if(type == SHADER_TYPE_DISPLACEMENT) {
+				/* generate displacement shader */
+				generate = true;
+				shader->has_displacement = true;
+			}
 
-		if(generate) {
-			set<ShaderNode*> done;
+			if(generate) {
+				set<ShaderNode*> done;
 
-			if(use_multi_closure)
-				generate_multi_closure(clin->link->parent, done, SVM_STACK_INVALID);
-			else
-				generate_closure(clin->link->parent, done);
+				if(use_multi_closure) {
+					set<ShaderNode*> closure_done;
+					generate_multi_closure(clin->link->parent, done, closure_done);
+				}
+				else
+					generate_closure(clin->link->parent, done);
+			}
 		}
-	}
 
-	/* compile output node */
-	node->compile(*this);
+		/* compile output node */
+		node->compile(*this);
+	}
 
 	add_node(NODE_END, 0, 0, 0);
 }
@@ -648,9 +641,9 @@ void SVMCompiler::compile(Shader *shader, vector<int4>& global_svm_nodes, int in
 			shader->graph_bump = shader->graph->copy();
 
 	/* finalize */
-	shader->graph->finalize(false, false);
+	shader->graph->finalize(false, false, use_multi_closure);
 	if(shader->graph_bump)
-		shader->graph_bump->finalize(true, false);
+		shader->graph_bump->finalize(true, false, use_multi_closure);
 
 	current_shader = shader;
 
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index 0db68f4..0b15c5a 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -81,6 +81,7 @@ public:
 	bool background;
 
 protected:
+	/* stack */
 	struct Stack {
 		Stack() { memset(users, 0, sizeof(users)); }
 		Stack(const Stack& other) { memcpy(users, other.users, sizeof(users)); }
@@ -123,11 +124,15 @@ protected:
 
 	bool node_skip_input(ShaderNode *node, ShaderInput *input);
 
+	/* single closure */
 	void find_dependencies(set<ShaderNode*>& dependencies, const set<ShaderNode*>& done, ShaderInput *input);
 	void generate_svm_nodes(const set<ShaderNode*>& nodes, set<ShaderNode*>& done);
 	void generate_closure(ShaderNode *node, set<ShaderNode*>& done);
-	void generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, uint in_offset);
 
+	/* multi closure */
+	void generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, set<ShaderNode*>& closure_done);
+
+	/* compile */
 	void compile_type(Shader *shader, ShaderGraph *graph, ShaderType type);
 
 	vector<int4> svm_nodes;
diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp
index 874f1a6..bbcdb47 100644
--- a/intern/cycles/render/tile.cpp
+++ b/intern/cycles/render/tile.cpp
@@ -23,12 +23,15 @@
 
 CCL_NAMESPACE_BEGIN
 
-TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_, int num_devices_)
+TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_,
+                         bool preserve_tile_device_, bool background_, int num_devices_)
 {
 	progressive = progressive_;
 	tile_size = tile_size_;
 	start_resolution = start_resolution_;
 	num_devices = num_devices_;
+	preserve_tile_device = preserve_tile_device_;
+	background = background_;
 
 	BufferParams buffer_params;
 	reset(buffer_params, 0);
@@ -70,7 +73,45 @@ void TileManager::set_samples(int num_samples_)
 	num_samples = num_samples_;
 }
 
-void TileManager::set_tiles()
+/* splits image into tiles and assigns equal amount of tiles to every render device */
+void TileManager::gen_tiles_global()
+{
+	int resolution = state.resolution_divider;
+	int image_w = max(1, params.width/resolution);
+	int image_h = max(1, params.height/resolution);
+
+	state.tiles.clear();
+
+	int tile_w = (tile_size.x >= image_w)? 1: (image_w + tile_size.x - 1)/tile_size.x;
+	int tile_h = (tile_size.y >= image_h)? 1: (image_h + tile_size.y - 1)/tile_size.y;
+
+	int num_logical_devices = preserve_tile_device? num_devices: 1;
+	int num = min(image_h, num_logical_devices);
+	int tile_index = 0;
+
+	int tiles_per_device = (tile_w * tile_h + num - 1) / num;
+	int cur_device = 0, cur_tiles = 0;
+
+	for(int tile_y = 0; tile_y < tile_h; tile_y++) {
+		for(int tile_x = 0; tile_x < tile_w; tile_x++, tile_index++) {
+			int x = tile_x * tile_size.x;
+			int y = tile_y * tile_size.y;
+			int w = (tile_x == tile_w-1)? image_w - x: tile_size.x;
+			int h = (tile_y == tile_h-1)? image_h - y: tile_size.y;
+
+			state.tiles.push_back(Tile(tile_index, x, y, w, h, cur_device));
+			cur_tiles++;
+
+			if(cur_tiles == tiles_per_device) {
+				cur_tiles = 0;
+				cur_device++;
+			}
+		}
+	}
+}
+
+/* slices image into as much pieces as how many devices are rendering this image */
+void TileManager::gen_tiles_sliced()
 {
 	int resolution = state.resolution_divider;
 	int image_w = max(1, params.width/resolution);
@@ -78,7 +119,9 @@ void TileManager::set_tiles()
 
 	state.tiles.clear();
 
-	int num = min(image_h, num_devices);
+	int num_logical_devices = preserve_tile_device? num_devices: 1;
+	int num = min(image_h, num_logical_devices);
+	int tile_index = 0;
 
 	for(int device = 0; device < num; device++) {
 		int device_y = (image_h/num)*device;
@@ -86,20 +129,30 @@ void TileManager::set_tiles()
 
 		int tile_w = (tile_size.x >= image_w)? 1: (image_w + tile_size.x - 1)/tile_size.x;
 		int tile_h = (tile_size.y >= device_h)? 1: (device_h + tile_size.y - 1)/tile_size.y;
-		int sub_w = (image_w + tile_w - 1)/tile_w;
-		int sub_h = (device_h + tile_h - 1)/tile_h;
 
 		for(int tile_y = 0; tile_y < tile_h; tile_y++) {
-			for(int tile_x = 0; tile_x < tile_w; tile_x++) {
-				int x = tile_x * sub_w;
-				int y = tile_y * sub_h;
-				int w = (tile_x == tile_w-1)? image_w - x: sub_w;
-				int h = (tile_y == tile_h-1)? device_h - y: sub_h;
+			for(int tile_x = 0; tile_x < tile_w; tile_x++, tile_index++) {
+				int x = tile_x * tile_size.x;
+				int y = tile_y * tile_size.y;
+				int w = (tile_x == tile_w-1)? image_w - x: tile_size.x;
+				int h = (tile_y == tile_h-1)? device_h - y: tile_size.y;
 
-				state.tiles.push_back(Tile(x, y + device_y, w, h, device));
+				state.tiles.push_back(Tile(tile_index, x, y + device_y, w, h, device));
 			}
 		}
 	}
+}
+
+void TileManager::set_tiles()
+{
+	int resolution = state.resolution_divider;
+	int image_w = max(1, params.width/resolution);
+	int image_h = max(1, params.height/resolution);
+
+	if(background)
+		gen_tiles_global();
+	else
+		gen_tiles_sliced();
 
 	state.num_tiles = state.tiles.size();
 
@@ -120,13 +173,10 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
 	int image_w = max(1, params.width/resolution);
 	int image_h = max(1, params.height/resolution);
 
-	int num = min(image_h, num_devices);
-
-	int device_y = (image_h / num) * device;
-	int device_h = (device == num - 1) ? image_h - device * (image_h / num) : image_h / num;
+	int logical_device = preserve_tile_device? device: 0;
 
-	int64_t centx = image_w / 2, centy = device_y + device_h / 2, tot = 1;
-	int64_t mindist = (int64_t) image_w * (int64_t) device_h;
+	int64_t centx = image_w / 2, centy = image_h / 2, tot = 1;
+	int64_t mindist = (int64_t) image_w * (int64_t) image_h;
 
 	/* find center of rendering tiles, image center counts for 1 too */
 	for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
@@ -143,7 +193,7 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
 
 	/* closest of the non-rendering tiles */
 	for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
-		if(iter->device == device && iter->rendering == false) {
+		if(iter->device == logical_device && iter->rendering == false) {
 			Tile &cur_tile = *iter;
 
 			int64_t distx = centx - (cur_tile.x + cur_tile.w / 2);
@@ -160,11 +210,28 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
 	return best;
 }
 
+list<Tile>::iterator TileManager::next_simple_tile(int device)
+{
+	list<Tile>::iterator iter;
+
+	int logical_device = preserve_tile_device? device: 0;
+
+	for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
+		if(iter->device == logical_device && iter->rendering == false)
+			return iter;
+	}
+
+	return state.tiles.end();
+}
+
 bool TileManager::next_tile(Tile& tile, int device)
 {
 	list<Tile>::iterator tile_it;
 
-	tile_it = next_center_tile(device);
+	if(background)
+		tile_it = next_center_tile(device);
+	else
+		tile_it = next_simple_tile(device);
 
 	if(tile_it != state.tiles.end()) {
 		tile_it->rendering = true;
diff --git a/intern/cycles/render/tile.h b/intern/cycles/render/tile.h
index d820f74..6f7a8f2 100644
--- a/intern/cycles/render/tile.h
+++ b/intern/cycles/render/tile.h
@@ -30,6 +30,7 @@ CCL_NAMESPACE_BEGIN
 
 class Tile {
 public:
+	int index;
 	int x, y, w, h;
 	int device;
 	bool rendering;
@@ -37,8 +38,8 @@ public:
 	Tile()
 	{}
 
-	Tile(int x_, int y_, int w_, int h_, int device_)
-	: x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
+	Tile(int index_, int x_, int y_, int w_, int h_, int device_)
+	: index(index_), x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
 };
 
 /* Tile Manager */
@@ -57,7 +58,8 @@ public:
 		list<Tile> tiles;
 	} state;
 
-	TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, int num_devices = 1);
+	TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution,
+	            bool preserve_tile_device, bool background, int num_devices = 1);
 	~TileManager();
 
 	void reset(BufferParams& params, int num_samples);
@@ -75,7 +77,38 @@ protected:
 	int start_resolution;
 	int num_devices;
 
-	list<Tile>::iterator next_center_tile(int device = 0);
+	/* in some cases it is important that the same tile will be returned for the same
+	 * device it was originally generated for (i.e. viewport rendering when buffer is
+	 * allocating once for tile and then always used by it)
+	 *
+	 * in other cases any tile could be handled by any device (i.e. final rendering
+	 * without progressive refine)
+	 */
+	bool preserve_tile_device;
+
+	/* for background render tiles should exactly match render parts generated from
+	 * blender side, which means image first gets split into tiles and then tiles are
+	 * assigning to render devices
+	 *
+	 * however viewport rendering expects tiles to be allocated in a special way,
+	 * meaning image is being sliced horizontally first and every device handles
+	 * it's own slice
+	 */
+	bool background;
+
+	/* splits image into tiles and assigns equal amount of tiles to every render device */
+	void gen_tiles_global();
+
+	/* slices image into as much pieces as how many devices are rendering this image */
+	void gen_tiles_sliced();
+
+	/* returns closest tile to center of rendered tiles
+	 * mimics behavior of blender internal's tile order
+	 */
+	list<Tile>::iterator next_center_tile(int device);
+
+	/* returns first unhandled tile starting from left bottom corner of the image */
+	list<Tile>::iterator next_simple_tile(int device);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/subd/CMakeLists.txt b/intern/cycles/subd/CMakeLists.txt
index c0986e9..838776d 100644
--- a/intern/cycles/subd/CMakeLists.txt
+++ b/intern/cycles/subd/CMakeLists.txt
@@ -6,7 +6,9 @@ set(INC
 	../kernel/svm
 	../render
 )
+
 set(INC_SYS
+
 )
 
 set(SRC
diff --git a/intern/cycles/subd/subd_build.cpp b/intern/cycles/subd/subd_build.cpp
index 312980f..8e84da7 100644
--- a/intern/cycles/subd/subd_build.cpp
+++ b/intern/cycles/subd/subd_build.cpp
@@ -333,7 +333,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
 					/* @@ this probably does not provide watertight results!! (1/3 + 1/3 + 1/3 != 1) */
 
 					/* distribute weight to all verts */
-					stencil->get(eid1, vert) += beta * costerm1_b / 3.0f;				
+					stencil->get(eid1, vert) += beta * costerm1_b / 3.0f;
 					stencil->get(eid1, edge->to()) += beta * costerm1_b / 3.0f;
 					stencil->get(eid1, edge->next->to()) += beta * costerm1_b / 3.0f;
 
diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt
index c677f2b..dce4177 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -2,6 +2,7 @@
 set(INC
 	.
 )
+
 set(INC_SYS
 	${GLEW_INCLUDE_PATH}
 	${OPENGL_INCLUDE_DIR}
@@ -53,6 +54,7 @@ set(SRC_HEADERS
 	util_path.h
 	util_progress.h
 	util_set.h
+	util_stats.h
 	util_string.h
 	util_system.h
 	util_task.h
@@ -60,8 +62,8 @@ set(SRC_HEADERS
 	util_time.h
 	util_transform.h
 	util_types.h
-	util_view.h
 	util_vector.h
+	util_view.h
 	util_xml.h
 )
 
diff --git a/intern/cycles/util/util_attribute.cpp b/intern/cycles/util/util_attribute.cpp
index 3a1c2b6..057fb62 100644
--- a/intern/cycles/util/util_attribute.cpp
+++ b/intern/cycles/util/util_attribute.cpp
@@ -30,6 +30,10 @@ const char *attribute_standard_name(AttributeStandard std)
 		return "uv";
 	else if(std == ATTR_STD_GENERATED)
 		return "generated";
+	else if(std == ATTR_STD_UV_TANGENT)
+		return "tangent";
+	else if(std == ATTR_STD_UV_TANGENT_SIGN)
+		return "tangent_sign";
 	else if(std == ATTR_STD_POSITION_UNDEFORMED)
 		return "undeformed";
 	else if(std == ATTR_STD_POSITION_UNDISPLACED)
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index b35c4c1..6dd1c6c 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -31,6 +31,8 @@ using namespace std;
 
 CCL_NAMESPACE_BEGIN
 
+/* 3D BoundBox */
+
 class BoundBox
 {
 public:
@@ -160,6 +162,85 @@ __forceinline BoundBox intersect(const BoundBox& a, const BoundBox& b, const Bou
 	return intersect(a, intersect(b, c));
 }
 
+/* 2D BoundBox */
+
+class BoundBox2D {
+public:
+	float left;
+	float right;
+	float bottom;
+	float top;
+
+	BoundBox2D()
+	: left(0.0f), right(1.0f), bottom(0.0f), top(1.0f)
+	{
+	}
+
+	bool operator==(const BoundBox2D& other) const
+	{
+		return (left == other.left && right == other.right &&
+		        bottom == other.bottom && top == other.top);
+	}
+
+	float width()
+	{
+		return right - left;
+	}
+
+	float height()
+	{
+		return top - bottom;
+	}
+
+	BoundBox2D operator*(float f) const
+	{
+		BoundBox2D result;
+
+		result.left = left*f;
+		result.right = right*f;
+		result.bottom = bottom*f;
+		result.top = top*f;
+
+		return result;
+	}
+
+	BoundBox2D subset(const BoundBox2D& other) const
+	{
+		BoundBox2D subset;
+
+		subset.left = left + other.left*(right - left);
+		subset.right = left + other.right*(right - left);
+		subset.bottom = bottom + other.bottom*(top - bottom);
+		subset.top = bottom + other.top*(top - bottom);
+
+		return subset;
+	}
+
+	BoundBox2D make_relative_to(const BoundBox2D& other) const
+	{
+		BoundBox2D result;
+
+		result.left = ((left - other.left) / (other.right - other.left));
+		result.right = ((right - other.left) / (other.right - other.left));
+		result.bottom = ((bottom - other.bottom) / (other.top - other.bottom));
+		result.top = ((top - other.bottom) / (other.top - other.bottom));
+
+		return result;
+	}
+
+	BoundBox2D clamp(float mn = 0.0f, float mx = 1.0f)
+	{
+		BoundBox2D result;
+
+		result.left = ccl::clamp(left, mn, mx);
+		result.right = ccl::clamp(right, mn, mx);
+		result.bottom = ccl::clamp(bottom, mn, mx);
+		result.top = ccl::clamp(top, mn, mx);
+
+		return result;
+	}
+};
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_BOUNDBOX_H__ */
diff --git a/intern/cycles/util/util_cuda.cpp b/intern/cycles/util/util_cuda.cpp
index 2960022..2716f00 100644
--- a/intern/cycles/util/util_cuda.cpp
+++ b/intern/cycles/util/util_cuda.cpp
@@ -17,6 +17,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "util_cuda.h"
 #include "util_debug.h"
@@ -413,8 +414,18 @@ string cuCompilerPath()
 		return nvcc;
 
 #ifndef _WIN32
-	if(system("which nvcc") == 0)
-		return "nvcc";
+	{
+		FILE *handle = popen("which nvcc", "r");
+		if(handle) {
+			char buffer[4096] = {0};
+			int len = fread(buffer, 1, sizeof(buffer) - 1, handle);
+			buffer[len] = '\0';
+			pclose(handle);
+
+			if(buffer[0])
+				return "nvcc";
+		}
+	}
 #endif
 
 	return "";
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 0b6f020..70adee4 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -1069,6 +1069,29 @@ __device_inline float3 safe_divide_color(float3 a, float3 b)
 	return make_float3(x, y, z);
 }
 
+/* Rotation of point around axis and angle */
+
+__device_inline float3 rotate_around_axis(float3 p, float3 axis, float angle)
+{
+	float costheta = cosf(angle);
+	float sintheta = sinf(angle);
+	float3 r;
+
+	r.x = ((costheta + (1 - costheta) * axis.x * axis.x) * p.x) +
+		(((1 - costheta) * axis.x * axis.y - axis.z * sintheta) * p.y) +
+		(((1 - costheta) * axis.x * axis.z + axis.y * sintheta) * p.z);
+
+	r.y = (((1 - costheta) * axis.x * axis.y + axis.z * sintheta) * p.x) +
+		((costheta + (1 - costheta) * axis.y * axis.y) * p.y) +
+		(((1 - costheta) * axis.y * axis.z - axis.x * sintheta) * p.z);
+
+	r.z = (((1 - costheta) * axis.x * axis.z - axis.y * sintheta) * p.x) +
+		(((1 - costheta) * axis.y * axis.z + axis.x * sintheta) * p.y) +
+		((costheta + (1 - costheta) * axis.z * axis.z) * p.z);
+
+	return r;
+}
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_MATH_H__ */
diff --git a/intern/cycles/util/util_md5.h b/intern/cycles/util/util_md5.h
index 43e08e6..aab177d 100644
--- a/intern/cycles/util/util_md5.h
+++ b/intern/cycles/util/util_md5.h
@@ -44,7 +44,7 @@ public:
 	bool append_file(const string& filepath);
 	string get_hex();
 
-	protected:
+protected:
 	void process(const uint8_t *data);
 	void finish(uint8_t digest[16]);
 
diff --git a/intern/cycles/util/util_opencl.cpp b/intern/cycles/util/util_opencl.cpp
index 40b637f..c146c14 100644
--- a/intern/cycles/util/util_opencl.cpp
+++ b/intern/cycles/util/util_opencl.cpp
@@ -140,6 +140,10 @@ int clLibraryInit()
 #endif
 	int error = 0;
 
+	// OpenCL disabled for now, only works with this environment variable set
+	if(!getenv("CYCLES_OPENCL_TEST"))
+		return 0;
+
 	//  Check if already initialized
 	if (module != NULL)
 	{
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index a571fe8..8cf23bc 100644
--- a/intern/cycles/util/util_path.cpp
+++ b/intern/cycles/util/util_path.cpp
@@ -170,7 +170,7 @@ bool path_read_binary(const string& path, vector<uint8_t>& binary)
 	return true;
 }
 
-static bool path_read_text(const string& path, string& text)
+bool path_read_text(const string& path, string& text)
 {
 	vector<uint8_t> binary;
 
@@ -184,6 +184,14 @@ static bool path_read_text(const string& path, string& text)
 	return true;
 }
 
+uint64_t path_modified_time(const string& path)
+{
+	if(boost::filesystem::exists(path))
+		return (uint64_t)boost::filesystem::last_write_time(path);
+	
+	return 0;
+}
+
 string path_source_replace_includes(const string& source_, const string& path)
 {
 	/* our own little c preprocessor that replaces #includes with the file
diff --git a/intern/cycles/util/util_path.h b/intern/cycles/util/util_path.h
index 6cba6a3..89e4452 100644
--- a/intern/cycles/util/util_path.h
+++ b/intern/cycles/util/util_path.h
@@ -45,6 +45,9 @@ string path_files_md5_hash(const string& dir);
 void path_create_directories(const string& path);
 bool path_write_binary(const string& path, const vector<uint8_t>& binary);
 bool path_read_binary(const string& path, vector<uint8_t>& binary);
+bool path_read_text(const string& path, string& text);
+
+uint64_t path_modified_time(const string& path);
 
 string path_source_replace_includes(const string& source, const string& path);
 
diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h
index c97379d..03e25d4 100644
--- a/intern/cycles/util/util_progress.h
+++ b/intern/cycles/util/util_progress.h
@@ -68,6 +68,21 @@ public:
 		return *this;
 	}
 
+	void reset()
+	{
+		tile = 0;
+		sample = 0;
+		start_time = time_dt();
+		total_time = 0.0f;
+		tile_time = 0.0f;
+		status = "Initializing";
+		substatus = "";
+		sync_status = "";
+		sync_substatus = "";
+		cancel = false;
+		cancel_message = "";
+	}
+
 	/* cancel */
 	void set_cancel(const string& cancel_message_)
 	{
diff --git a/intern/cycles/util/util_stats.h b/intern/cycles/util/util_stats.h
new file mode 100644
index 0000000..2763801
--- /dev/null
+++ b/intern/cycles/util/util_stats.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __UTIL_STATS_H__
+#define __UTIL_STATS_H__
+
+CCL_NAMESPACE_BEGIN
+
+class Stats {
+public:
+	Stats() : mem_used(0), mem_peak(0) {}
+
+	void mem_alloc(size_t size) {
+		mem_used += size;
+		if(mem_used > mem_peak)
+			mem_peak = mem_used;
+	}
+
+	void mem_free(size_t size) {
+		mem_used -= size;
+	}
+
+	size_t mem_used;
+	size_t mem_peak;
+};
+
+CCL_NAMESPACE_END
+
+#endif /* __UTIL_STATS_H__ */
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index ea0abd6..8c4ec31 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -168,10 +168,16 @@ void TaskScheduler::init(int num_threads)
 	if(users == 0) {
 		do_exit = false;
 
-		/* launch threads that will be waiting for work */
-		if(num_threads == 0)
+		if(num_threads == 0) {
+			/* automatic number of threads will be main thread + num cores */
 			num_threads = system_cpu_thread_count();
+		}
+		else {
+			/* main thread will also work, for fixed threads we count it too */
+			num_threads -= 1;
+		}
 
+		/* launch threads that will be waiting for work */
 		threads.resize(num_threads);
 		thread_level.resize(num_threads);
 
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
index 401a503..b795ca7 100644
--- a/intern/cycles/util/util_task.h
+++ b/intern/cycles/util/util_task.h
@@ -94,7 +94,11 @@ public:
 	static void init(int num_threads = 0);
 	static void exit();
 
-	static int num_threads() { return threads.size(); }
+	/* number of threads that can work on tasks, main thread counts too */
+	static int num_threads() { return threads.size() + 1; }
+
+	/* test if any session is using the scheduler */
+	static bool active() { return users != 0; }
 
 protected:
 	friend class TaskPool;
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index 843764c..d7e9ec0 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -70,41 +70,6 @@ protected:
 	bool joined;
 };
 
-/* Thread Local Storage
- *
- * Boost implementation is a bit slow, and Mac OS X __thread is not supported
- * but the pthreads implementation is optimized, so we use these macros. */
-
-#ifdef __APPLE__
-
-#define tls_ptr(type, name) \
-	pthread_key_t name
-#define tls_set(name, value) \
-	pthread_setspecific(name, value)
-#define tls_get(type, name) \
-	((type*)pthread_getspecific(name))
-#define tls_create(type, name) \
-	pthread_key_create(&name, NULL)
-#define tls_delete(type, name) \
-	pthread_key_delete(name);
-
-#else
-
-#ifdef __WIN32
-#define __thread __declspec(thread)
-#endif
-
-#define tls_ptr(type, name) \
-	__thread type *name
-#define tls_set(name, value) \
-	name = value
-#define tls_get(type, name) \
-	name
-#define tls_create(type, name)
-#define tls_delete(type, name)
-
-#endif
-
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_THREAD_H__ */
diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp
index b3c6506..ca19146 100644
--- a/intern/cycles/util/util_transform.cpp
+++ b/intern/cycles/util/util_transform.cpp
@@ -246,10 +246,30 @@ static void transform_decompose(Transform *decomp, const Transform *tfm)
 	decomp->w = make_float4(scale.y.z, scale.z.x, scale.z.y, scale.z.z);
 }
 
-void transform_motion_decompose(MotionTransform *decomp, const MotionTransform *motion)
+void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid)
 {
-	transform_decompose(&decomp->pre, &motion->pre);
-	transform_decompose(&decomp->post, &motion->post);
+	Transform pre, post;
+
+	transform_decompose(&pre, &motion->pre);
+	transform_decompose(&decomp->mid, mid);
+	transform_decompose(&post, &motion->post);
+
+	/* ensure rotation around shortest angle, negated quaternions are the same
+	 * but this means we don't have to do the check in quat_interpolate */
+	if(dot(decomp->mid.x, post.x) < 0.0f)
+		decomp->mid.x = -decomp->mid.x;
+	if(dot(pre.x, decomp->mid.x) < 0.0f)
+		pre.x = -pre.x;
+	
+	/* drop scale of pre/post */
+	pre.y.w = decomp->mid.y.w;
+	post.y.w = decomp->mid.y.w;
+
+	/* store translation/rotation part of pre/post */
+	decomp->pre_x = pre.x;
+	decomp->pre_y = pre.y;
+	decomp->post_x = post.x;
+	decomp->post_y = post.y;
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index d93bbff..a1c12dd 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -39,14 +39,23 @@ typedef struct Transform {
 #endif
 } Transform;
 
+/* transform decomposed in rotation/translation/scale. we use the same data
+ * structure as Transform, and tightly pack decomposition into it. first the
+ * rotation (4), then translation (3), then 3x3 scale matrix (9).
+ *
+ * For the DecompMotionTransform we drop scale from pre/post. */
+
 typedef struct MotionTransform {
 	Transform pre;
+	Transform mid;
 	Transform post;
 } MotionTransform;
 
-/* transform decomposed in rotation/translation/scale. we use the same data
- * structure as Transform, and tightly pack decomposition into it. first the
- * rotation (4), then translation (3), then 3x3 scale matrix (9) */
+typedef struct DecompMotionTransform {
+	Transform mid;
+	float4 pre_x, pre_y;
+	float4 post_x, post_y;
+} DecompMotionTransform;
 
 /* Functions */
 
@@ -302,21 +311,35 @@ __device_inline Transform transform_clear_scale(const Transform& tfm)
 
 __device_inline float4 quat_interpolate(float4 q1, float4 q2, float t)
 {
+	/* use simpe nlerp instead of slerp. it's faster and almost the same */
+	return normalize((1.0f - t)*q1 + t*q2);
+
+#if 0
+	/* note: this does not ensure rotation around shortest angle, q1 and q2
+	 * are assumed to be matched already in transform_motion_decompose */
 	float costheta = dot(q1, q2);
 
+	/* possible optimization: it might be possible to precompute theta/qperp */
+
 	if(costheta > 0.9995f) {
+		/* linear interpolation in degenerate case */
 		return normalize((1.0f - t)*q1 + t*q2);
 	}
 	else  {
+		/* slerp */
 		float theta = acosf(clamp(costheta, -1.0f, 1.0f));
-		float thetap = theta * t;
 		float4 qperp = normalize(q2 - q1 * costheta);
+		float thetap = theta * t;
 		return q1 * cosf(thetap) + qperp * sinf(thetap);
 	}
+#endif
 }
 
 __device_inline Transform transform_quick_inverse(Transform M)
 {
+	/* possible optimization: can we avoid doing this altogether and construct
+	 * the inverse matrix directly from negated translation, transposed rotation,
+	 * scale can be inverted but what about shearing? */
 	Transform R;
 	float det = M.x.x*(M.z.z*M.y.y - M.z.y*M.y.z) - M.y.x*(M.z.z*M.x.y - M.z.y*M.x.z) + M.z.x*(M.y.z*M.x.y - M.y.y*M.x.z);
 
@@ -371,15 +394,56 @@ __device_inline void transform_compose(Transform *tfm, const Transform *decomp)
 	tfm->w = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
 }
 
-__device void transform_motion_interpolate(Transform *tfm, const MotionTransform *motion, float t)
+/* Disabled for now, need arc-length parametrization for constant speed motion.
+ * #define CURVED_MOTION_INTERPOLATE */
+
+__device void transform_motion_interpolate(Transform *tfm, const DecompMotionTransform *motion, float t)
 {
+	/* possible optimization: is it worth it adding a check to skip scaling?
+	 * it's probably quite uncommon to have scaling objects. or can we skip
+	 * just shearing perhaps? */
 	Transform decomp;
 
-	decomp.x = quat_interpolate(motion->pre.x, motion->post.x, t);
-	decomp.y = (1.0f - t)*motion->pre.y + t*motion->post.y;
-	decomp.z = (1.0f - t)*motion->pre.z + t*motion->post.z;
-	decomp.w = (1.0f - t)*motion->pre.w + t*motion->post.w;
+#ifdef CURVED_MOTION_INTERPOLATE
+	/* 3 point bezier curve interpolation for position */
+	float3 Ppre = float4_to_float3(motion->pre_y);
+	float3 Pmid = float4_to_float3(motion->mid.y);
+	float3 Ppost = float4_to_float3(motion->post_y);
+
+	float3 Pcontrol = 2.0f*Pmid - 0.5f*(Ppre + Ppost);
+	float3 P = Ppre*t*t + Pcontrol*2.0f*t*(1.0f - t) + Ppost*(1.0f - t)*(1.0f - t);
+
+	decomp.y.x = P.x;
+	decomp.y.y = P.y;
+	decomp.y.z = P.z;
+#endif
+
+	/* linear interpolation for rotation and scale */
+	if(t < 0.5f) {
+		t *= 2.0f;
+
+		decomp.x = quat_interpolate(motion->pre_x, motion->mid.x, t);
+#ifdef CURVED_MOTION_INTERPOLATE
+		decomp.y.w = (1.0f - t)*motion->pre_y.w + t*motion->mid.y.w;
+#else
+		decomp.y = (1.0f - t)*motion->pre_y + t*motion->mid.y;
+#endif
+	}
+	else {
+		t = (t - 0.5f)*2.0f;
+
+		decomp.x = quat_interpolate(motion->mid.x, motion->post_x, t);
+#ifdef CURVED_MOTION_INTERPOLATE
+		decomp.y.w = (1.0f - t)*motion->mid.y.w + t*motion->post_y.w;
+#else
+		decomp.y = (1.0f - t)*motion->mid.y + t*motion->post_y;
+#endif
+	}
+
+	decomp.z = motion->mid.z;
+	decomp.w = motion->mid.w;
 
+	/* compose rotation, translation, scale into matrix */
 	transform_compose(tfm, &decomp);
 }
 
@@ -390,7 +454,7 @@ __device_inline bool operator==(const MotionTransform& A, const MotionTransform&
 	return (A.pre == B.pre && A.post == B.post);
 }
 
-void transform_motion_decompose(MotionTransform *decomp, const MotionTransform *motion);
+void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
 
 #endif
 
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index 5c6b9d5..3d24610 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -41,7 +41,9 @@
 #define __align(...) __declspec(align(__VA_ARGS__))
 #else
 #define __device_inline static inline __attribute__((always_inline))
+#ifndef FREE_WINDOWS64
 #define __forceinline inline __attribute__((always_inline))
+#endif
 #define __align(...) __attribute__((aligned(__VA_ARGS__)))
 #endif
 
@@ -449,6 +451,8 @@ typedef enum AttributeStandard {
 	ATTR_STD_VERTEX_NORMAL,
 	ATTR_STD_FACE_NORMAL,
 	ATTR_STD_UV,
+	ATTR_STD_UV_TANGENT,
+	ATTR_STD_UV_TANGENT_SIGN,
 	ATTR_STD_GENERATED,
 	ATTR_STD_POSITION_UNDEFORMED,
 	ATTR_STD_POSITION_UNDISPLACED,
diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt
deleted file mode 100644
index 73b67d7..0000000
--- a/intern/decimation/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
-	.
-	../container
-	../guardedalloc
-	../memutil
-	../moto/include
-)
-
-set(INC_SYS
-
-)
-
-set(SRC
-	intern/LOD_EdgeCollapser.cpp
-	intern/LOD_ExternNormalEditor.cpp
-	intern/LOD_FaceNormalEditor.cpp
-	intern/LOD_ManMesh2.cpp
-	intern/LOD_MeshPrimitives.cpp
-	intern/LOD_QSDecimator.cpp
-	intern/LOD_QuadricEditor.cpp
-	intern/LOD_decimation.cpp
-
-	extern/LOD_decimation.h
-	intern/LOD_DecimationClass.h
-	intern/LOD_EdgeCollapser.h
-	intern/LOD_ExternBufferEditor.h
-	intern/LOD_ExternNormalEditor.h
-	intern/LOD_FaceNormalEditor.h
-	intern/LOD_ManMesh2.h
-	intern/LOD_MeshBounds.h
-	intern/LOD_MeshException.h
-	intern/LOD_MeshPrimitives.h
-	intern/LOD_QSDecimator.h
-	intern/LOD_Quadric.h
-	intern/LOD_QuadricEditor.h
-)
-
-blender_add_lib(bf_intern_decimate "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
deleted file mode 100644
index 6f4befb..0000000
--- a/intern/decimation/SConscript
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = env.Glob('intern/*.cpp')
-
-incs = '. ../moto/include ../container ../memutil ../guardedalloc'
-
-env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )
diff --git a/intern/decimation/extern/LOD_decimation.h b/intern/decimation/extern/LOD_decimation.h
deleted file mode 100644
index 4c52cb1..0000000
--- a/intern/decimation/extern/LOD_decimation.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/extern/LOD_decimation.h
- *  \ingroup decimation
- */
-
-
-/**
-
- * @author Laurence Bourn
- * @date 6/7/2001
- *
- * This is the external interface for the decimation module.
- */
-
-#ifndef __LOD_DECIMATION_H__
-#define __LOD_DECIMATION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** 
- * External decimation structure
- */
-
-typedef struct LOD_Decimation_Info {
-	float * vertex_buffer;
-	float * vertex_normal_buffer;
-	int * triangle_index_buffer;
-	int vertex_num;
-	int face_num;
-	void * intern;
-} LOD_Decimation_Info; 
-
-typedef LOD_Decimation_Info* LOD_Decimation_InfoPtr;
-
-/** 
- * Create internal mesh representation from 
- * LOD_Decimation_Info structure.
- * @return 1 on successful loading
- * @return 0 on failure
- * @warning This should be changed to return an enumeration
- * detailing the error encountered
- */
-
-extern int LOD_LoadMesh(LOD_Decimation_InfoPtr info);
-
-/**
- * Allocate and Compute internal data strucures required for
- * decimation.
- * @return 1 on successful computation of data
- * @return 0 on failure
- * @warning This should be changed to return an enumeration
- * detailing the error encountered
- */
-
-extern int LOD_PreprocessMesh(LOD_Decimation_InfoPtr info);
-
-/** 
- * Once both the stages above have been completed
- * this function collapses a single edge in the mesh.
- * The LOD_Decimation_Info structure is updated
- * to represent the new mesh.
- * @return 1 if an edge was collapsed.
- * @return 0 if no suitable edge was found to be collapsable
- * You should stop calling this method in this case
- * @warning Do not expect that the order of polygons, vertices or
- * vertex normals will be preserved by this operation. This function
- * returns a packed array of polygons and vertices and so necessarily
- * the order will be different. This means you should not expect to
- * find the same polygon in the same place in the polygon array after 
- * this function has been called.
- */
-
-extern int LOD_CollapseEdge(LOD_Decimation_InfoPtr info);
-
-/** 
- * Free any memory the decimation process used 
- * during the decimation process
- * @return 1 if internal data successfully freed
- * @return 0 if no data was freed
- */
-
-extern int LOD_FreeDecimationData(LOD_Decimation_InfoPtr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __LOD_DECIMATION_H__
-
diff --git a/intern/decimation/intern/LOD_DecimationClass.h b/intern/decimation/intern/LOD_DecimationClass.h
deleted file mode 100644
index ecf2e4e..0000000
--- a/intern/decimation/intern/LOD_DecimationClass.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_DecimationClass.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_DECIMATIONCLASS_H__
-#define __LOD_DECIMATIONCLASS_H__
-
-#include "MEM_SmartPtr.h"
-#include "MEM_NonCopyable.h"
-
-#include "LOD_ManMesh2.h"
-#include "LOD_QSDecimator.h"
-#include "LOD_ExternNormalEditor.h"
-#include "../extern/LOD_decimation.h"
-#include "LOD_ExternBufferEditor.h"
-
-
-class LOD_DecimationClass : public MEM_NonCopyable
-{
-public :
-
-	enum {
-		e_not_loaded,
-		e_loaded,
-		e_preprocessed
-	} m_e_decimation_state;
-
-
-	static
-		LOD_DecimationClass *
-	New(
-		LOD_Decimation_InfoPtr extern_info
-	) {
-		// create everything 
-	
-		MEM_SmartPtr<LOD_DecimationClass> output(new LOD_DecimationClass());
-		MEM_SmartPtr<LOD_ManMesh2> mesh(LOD_ManMesh2::New());
-		MEM_SmartPtr<LOD_ExternBufferEditor> extern_editor(LOD_ExternBufferEditor::New(extern_info));
-
-		if (mesh == NULL || extern_editor == NULL) return NULL;
-		MEM_SmartPtr<LOD_ExternNormalEditor> normals(LOD_ExternNormalEditor::New(extern_info,mesh.Ref()));
-
-		if (normals == NULL) return NULL;
-		MEM_SmartPtr<LOD_QSDecimator> decimator(LOD_QSDecimator::New(
-			mesh.Ref(),
-			normals.Ref(),
-			extern_editor.Ref()
-		));		
-		if (decimator == NULL || output == NULL) return NULL;
-
-		output->m_mesh = mesh.Release();
-		output->m_decimator = decimator.Release();
-		output->m_normals = normals.Release();
-		output->m_extern_editor = extern_editor.Release();
-
-		return output.Release();
-	}
-
-		LOD_ManMesh2 &
-	Mesh(
-	){
-		return m_mesh.Ref();
-	}
-
-		LOD_QSDecimator &
-	Decimator(
-	) {
-		return m_decimator.Ref();
-	}
-
-		LOD_ExternNormalEditor &
-	FaceEditor(
-	){
-		return m_normals.Ref();
-	}
-			
-private :
-
-	LOD_DecimationClass(
-	) : m_e_decimation_state(e_not_loaded) {
-	};
-
-	MEM_SmartPtr<LOD_ManMesh2> m_mesh;
-	MEM_SmartPtr<LOD_QSDecimator> m_decimator;
-	MEM_SmartPtr<LOD_ExternNormalEditor> m_normals;
-	MEM_SmartPtr<LOD_ExternBufferEditor> m_extern_editor;
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.cpp b/intern/decimation/intern/LOD_EdgeCollapser.cpp
deleted file mode 100644
index 1405d6f..0000000
--- a/intern/decimation/intern/LOD_EdgeCollapser.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_EdgeCollapser.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_EdgeCollapser.h"
-
-#include "LOD_ManMesh2.h"
-#include "CTR_TaggedSetOps.h"
-#include <algorithm>
-#include <functional>
-
-
-using namespace std;
-
-
-	LOD_EdgeCollapser * 
-LOD_EdgeCollapser::
-New(
-){
-	return new LOD_EdgeCollapser();
-}
-
-
-	bool
-LOD_EdgeCollapser::
-TJunctionTest(
-	LOD_ManMesh2 &mesh,
-	vector<LOD_EdgeInd> &e_v0v1,
-	LOD_EdgeInd collapse_edge
-){
-
-	// we need to copy the edges in e_v0v1 from the mesh
-	// into a new buffer -> we are going to modify them
-
-	int original_size = e_v0v1.size();
-	if (original_size == 0) return true;
-
-	vector<LOD_Edge> &edge_set = mesh.EdgeSet();
-
-	LOD_VertexInd c_v0 = edge_set[collapse_edge].m_verts[0];
-	LOD_VertexInd c_v1 = edge_set[collapse_edge].m_verts[1];
-
-	vector<LOD_Edge> temp_edges;
-	temp_edges.reserve(e_v0v1.size());
-
-	vector<LOD_EdgeInd>::iterator edge_it = e_v0v1.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = e_v0v1.end();
-
-	for (;edge_it != edge_end; ++edge_it) {
-		temp_edges.push_back(edge_set[*edge_it]);
-	}
-
-	// in the copied edges replace all instances of c_v0 with c_v1
-
-	vector<LOD_Edge>::iterator e_it = temp_edges.begin();
-	vector<LOD_Edge>::const_iterator e_it_end = temp_edges.end();
-		
-	for (; e_it != e_it_end; ++e_it) {
-
-		if (e_it->m_verts[0] == c_v0) {
-			e_it->m_verts[0] = c_v1;
-		}
-		if (e_it->m_verts[1] == c_v0) {
-			e_it->m_verts[1] = c_v1;
-		}
-
-		// normalize the edge
-		if (int(e_it->m_verts[0]) > int(e_it->m_verts[1])) {
-			LOD_EdgeInd temp = e_it->m_verts[0];
-			e_it->m_verts[0] = e_it->m_verts[1];
-			e_it->m_verts[1] = temp;
-		}
-	}
-
-	// sort the edges using the edge less functional 
-
-	sort(temp_edges.begin(),temp_edges.end(),LOD_EdgeCollapser::less());
-	// count the unique edges.
-
-	e_it = temp_edges.begin();
-	e_it_end = temp_edges.end();
-	
-	int coincedent_edges = 0;
-
-	vector<LOD_Edge>::const_iterator last_edge = e_it;
-	++e_it;
-		
-	for (; e_it != e_it_end; ++e_it) {
-	
-		if ((e_it->m_verts[0] == last_edge->m_verts[0]) &&
-			(e_it->m_verts[1] == last_edge->m_verts[1])
-		) {
-			++coincedent_edges;
-		}
-		last_edge = e_it;
-	}
-
-	// now if the collapse edge is a boundary edges 
-	// then we are alloved at most one coincedent edge
-
-	// otherwise at most 2 coincedent edges
-
-	if (edge_set[collapse_edge].BoundaryEdge()) {
-		return (coincedent_edges > 1);
-	} else {
-		return (coincedent_edges > 2);
-	}
-
-
-}
-
-
-	
-	bool
-LOD_EdgeCollapser::
-CollapseEdge(
-	LOD_EdgeInd ei,
-	LOD_ManMesh2 &mesh,
-	vector<LOD_EdgeInd> & degenerate_edges,
-	vector<LOD_FaceInd> & degenerate_faces,
-	vector<LOD_VertexInd> & degenerate_vertices,
-	vector<LOD_EdgeInd> & new_edges,
-	vector<LOD_FaceInd> & update_faces,
-	vector<LOD_VertexInd> & update_vertices
-){
-
-	vector<LOD_Vertex>	&verts = mesh.VertexSet();
-	vector<LOD_Edge>	&edges = mesh.EdgeSet();
-	vector<LOD_TriFace> &faces = mesh.FaceSet();
-
-	// shouldn't do this (use mesh interface instead!)
-	LOD_VertexInd v0_ind = edges[ei].m_verts[0];
-	LOD_VertexInd v1_ind = edges[ei].m_verts[1];
-#if 0
-	LOD_Vertex &v0 = verts[v0_ind];
-	LOD_Vertex &v1 = verts[v1_ind];
-#endif
-	vector<vector<LOD_EdgeInd> > e_v01(2);
-	e_v01[0].reserve(32);
-	e_v01[1].reserve(32);
-	
-	mesh.VertexEdges(v0_ind,e_v01[0]);
-	mesh.VertexEdges(v1_ind,e_v01[1]);
-
-
-	// compute the union of e_v0 and e_v1 -> this is the degenerate edges of the collapse
-	// we remove old edges and replace edges inside the collapse zone with new ones 
-
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Union(e_v01,edges,degenerate_edges);
-
-	vector< vector<LOD_FaceInd> > p_v01(2);
-	p_v01[0].reserve(32);
-	p_v01[1].reserve(32);
-
-	mesh.VertexFaces(v0_ind,p_v01[0]);
-	mesh.VertexFaces(v1_ind,p_v01[1]);
-
-	// compute the union of p_v0 anf p_v1
-	vector<LOD_FaceInd> p_v0v1;
-	p_v0v1.reserve(32);
-
-	CTR_TaggedSetOps<LOD_FaceInd,LOD_TriFace>::Union(p_v01,faces,p_v0v1);
-
-	// compute the union of all the edges in p_v0v1 this is the collapse zone
-
-	vector<vector<LOD_EdgeInd> > e_input_vectors(p_v0v1.size());
-
-	vector<LOD_FaceInd>::iterator p_v0v1_end = p_v0v1.end();
-	vector<LOD_FaceInd>::iterator p_v0v1_start = p_v0v1.begin();
-
-	vector<vector<LOD_FaceInd> >::iterator vector_insert_it = e_input_vectors.begin();
-	
-	for (;p_v0v1_start != p_v0v1_end; ++p_v0v1_start , ++vector_insert_it) {
-		mesh.FaceEdges(*p_v0v1_start,*vector_insert_it);
-	}
-
-	vector<LOD_EdgeInd> collapse_zone;
-	collapse_zone.reserve(32);
-
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Union(e_input_vectors,edges,collapse_zone);
-
-	// compute the ring edges = collpase_zone - e_v0v1
-
-	vector<LOD_EdgeInd> edge_ring;
-	edge_ring.reserve(32);
-
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Difference(collapse_zone,degenerate_edges,edges,edge_ring);
-
-	// T Junction test
-	//////////////////
-	// At this point we check to see if any of the polygons
-	// in p_v0v1 are coninceddent - this leads
-	// to errors later on if we try and insert a polygon
-	// into the mesh to an edge which already has 2 polygons.
-
-	// not that t junctions occur naturally from edge collapses
-	// and are not just the result of coincedent polygons
-	// for example consider collapsing an edge that forms part
-	// of a triangular bottle neck.
-
-	// Really we need to make sure that we don't create t-junctions.
-
-	// I think that a sufficient test is to check the number of
-	// coincedent edge pairs after a collapse. If it is more than 2
-	// then collapsing the edge may result in an undeleted edge 
-	// sharing more than 2 polygons. This test probably is too 
-	// restictive though.
-	
-	// To perform this test we need to make a copy of the edges
-	// in e_v0v1. We then apply the contraction to these edge
-	// copies. Sort them using a function that places coincedent 
-	// edges next to each other. And then count the number
-	// of coincedent pairs. 
-
-	// Of course we have to do this test before we change any of the
-	// mesh -> so we can back out safely.
-
-	if (TJunctionTest(mesh,degenerate_edges,ei)) return false; 
-
-	// Compute the set of possibly degenerate vertices
-	// this is the union of all the vertices of polygons
-	// of v0 and v1
-
-	vector<LOD_FaceInd>::iterator face_it = p_v0v1.begin();
-	vector<LOD_FaceInd>::const_iterator face_end = p_v0v1.end();
-
-
-	vector<vector<LOD_VertexInd> > p_v0v1_vertices(p_v0v1.size());
-	
-	for (int i = 0; face_it != face_end; ++face_it, ++i) {
-		mesh.FaceVertices(*face_it,p_v0v1_vertices[i]);
-	}
-	
-	vector<LOD_VertexInd> vertex_ring;
-	vertex_ring.reserve(32);
-
-	CTR_TaggedSetOps<LOD_VertexInd,LOD_Vertex>::Union(p_v0v1_vertices,verts,vertex_ring);
-
-	// remove all the internal edges e_v0v1 from the mesh.
-	// for each edge remove the egde from it's vertices edge lists.
-
-	vector<LOD_EdgeInd>::iterator edge_it = degenerate_edges.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = degenerate_edges.end();
-
-	for (; !(edge_it == edge_end); ++edge_it) {
-			
-		LOD_EdgeInd ed = (*edge_it);
-		LOD_Edge & edge = edges[ed];//*edge_it];
-	
-		verts[edge.m_verts[0]].RemoveEdge(ed);
-		verts[edge.m_verts[1]].RemoveEdge(ed);
-	}
-
-	// we postpone deletion of the internal edges untill the end
-	// this is because deleting edges invalidates all of the 
-	// EdgeInd vectors above.
-
-		
-	// now untie all the polygons in p_v0v1 from the edge ring
-
-	// select all polygons in p_v0v1
-
-	face_it = p_v0v1.begin();
-	face_end = p_v0v1.end();
-
-	for (;face_it != face_end; ++face_it) {
-		faces[*face_it].SetSelectTag(true);
-	}
-
-	edge_it = edge_ring.begin();
-	edge_end = edge_ring.end();
-
-	for (;edge_it != edge_end; ++edge_it) {
-		LOD_Edge & edge = edges[*edge_it];
-
-		// presumably all edges in edge_ring point to at least
-		// one polygon from p_v0v1
-		
-		if (!edge.m_faces[0].IsEmpty() && faces[edge.m_faces[0]].SelectTag()) {
-			edge.m_faces[0].Invalidate();
-		}
-
-		if (!edge.m_faces[1].IsEmpty() && faces[edge.m_faces[1]].SelectTag()) {
-			edge.m_faces[1].Invalidate();
-		}
-	}
-	
-	// deselect the faces
-
-	face_it = p_v0v1.begin();
-	face_end = p_v0v1.end();
-
-	for (;face_it != face_end; ++face_it) {
-		faces[*face_it].SetSelectTag(false);
-	}
-
-	// perform the edge collapse
-	////////////////////////////
-
-	// iterate through the polygons of p_v0 and replace the vertex
-	// index v0 with v1
-
-	face_it = p_v01[0].begin();
-	face_end = p_v01[0].end();
-	
-	for (;face_it != face_end; ++face_it) {
-		faces[*face_it].SwapVertex(v0_ind,v1_ind);
-	}
-
-	face_it = p_v0v1.begin();
-	face_end = p_v0v1.end();
-	
-	for (;face_it != face_end; ++face_it) {
-		if (faces[*face_it].Degenerate()) {
-			degenerate_faces.push_back(*face_it);
-		} else {
-			update_faces.push_back(*face_it);
-		}
-	}
-	
-	// Add all the non-degenerate faces back into the 
-	// mesh. Get a record of the new edges created in
-	// this process.
-
-	face_it = update_faces.begin();
-	face_end = update_faces.end();
-
-	for (;face_it != face_end; ++face_it) {
-		mesh.ConnectTriangle(*face_it,new_edges);
-	}
-
-	// degenerate ring primitives
-	/////////////////////////////
-
-	// we now need to examine each of the edges on the ring
-	// and work out if they are degenerate - if so we attempt
-	// to delete them -> add them to the other edges to delete
-	// in e_v0v1
-
-	edge_it = edge_ring.begin();
-	edge_end = edge_ring.end();
-
-	for (;edge_it != edge_end; ++edge_it) {
-		if (edges[*edge_it].Degenerate()) {
-			degenerate_edges.push_back(*edge_it);
-		}
-	}
-
-	// do the same for the ring vertices.
-		
-	vector<LOD_VertexInd>::iterator vertex_it = vertex_ring.begin();
-	vector<LOD_VertexInd>::const_iterator vertex_end = vertex_ring.end();
-
-	for (;vertex_it != vertex_end; ++vertex_it) {
-		if (verts[*vertex_it].Degenerate()) {
-			degenerate_vertices.push_back(*vertex_it);
-		} else {
-			update_vertices.push_back(*vertex_it);
-		}
-	}
-
-	// we now know all the degenerate primitives
-	// and the new primitives we have inserted into the mesh
-
-	// We now delete the mesh primitives, mesh.DeleteXXXXXX() methods
-	// assume that the index vectors are sorted into descending order.
-	// we do that now.
-
-	sort(degenerate_edges.begin(),degenerate_edges.end(),LOD_EdgeInd::greater());
-	sort(degenerate_faces.begin(),degenerate_faces.end(),LOD_FaceInd::greater());
-	sort(degenerate_vertices.begin(),degenerate_vertices.end(),LOD_VertexInd::greater());
-
-	
-	return true;
-	
-}
-
-LOD_EdgeCollapser::
-LOD_EdgeCollapser(
-){
-	// nothing to do
-}
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.h b/intern/decimation/intern/LOD_EdgeCollapser.h
deleted file mode 100644
index 75a8b70..0000000
--- a/intern/decimation/intern/LOD_EdgeCollapser.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_EdgeCollapser.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_EDGECOLLAPSER_H__
-#define __LOD_EDGECOLLAPSER_H__
-
-// This is a helper class that collapses edges of a 2 - manifold mesh.
-
-#include "LOD_MeshPrimitives.h"
-#include "MEM_NonCopyable.h"
-#include <vector>
-#include <functional>
-
-class LOD_ManMesh2;
-
-class LOD_EdgeCollapser 
-: public  MEM_NonCopyable
-{
-
-public :
-			
-	static
-		LOD_EdgeCollapser * 
-	New(
-	);
-
-	// returns via arguments the set of modified
-	// verts,edges and faces.
-
-		bool
-	CollapseEdge(
-		LOD_EdgeInd ei,
-		LOD_ManMesh2 &mesh,
-		std::vector<LOD_EdgeInd> &	degenerate_edges,
-		std::vector<LOD_FaceInd> &	degenerate_faces,
-		std::vector<LOD_VertexInd> & degenerate_vertices,
-		std::vector<LOD_EdgeInd> &	new_edges,
-		std::vector<LOD_FaceInd> &	update_faces,
-		std::vector<LOD_VertexInd> & update_vertices
-	);
-
-private :
-
-	LOD_EdgeCollapser(
-	);
-
-	// Test to see if the result of collapsing the
-	// edge produces 2 junctions in the mesh i.e. where
-	// an edge is shared by more than 2 polygons
-
-	// We count the number of coincedent edge pairs that
-	// result from the collapse of collapse_edge.
-
-	// If collapse edge is a boundary edge then the number of
-	// coincedent pairs should be 1
-	// else it should be 2.
-
-		bool
-	TJunctionTest(
-		LOD_ManMesh2 &mesh,
-		std::vector<LOD_EdgeInd> &e_v0v1,
-		LOD_EdgeInd collapse_edge
-	);
-
-	// here's the definition of the sort function
-	// we use to determine coincedent edges
-
-	// assumes the edges are normalized i.e. m_verts[0] <= m_verts[1]
-
-	struct less : std::binary_function<LOD_Edge, LOD_Edge, bool> {
-			bool 
-		operator()(
-			const LOD_Edge& a,
-			const LOD_Edge& b
-		) const {
-				
-			if (int(a.m_verts[0]) == int(b.m_verts[0])) {
-				return (int(a.m_verts[1]) < int(b.m_verts[1]));
-			} else {
-				return (int(a.m_verts[0]) < int(b.m_verts[0]));
-			}
-		}
-	};
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ExternBufferEditor.h b/intern/decimation/intern/LOD_ExternBufferEditor.h
deleted file mode 100644
index c903b25..0000000
--- a/intern/decimation/intern/LOD_ExternBufferEditor.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternBufferEditor.h
- *  \ingroup decimation
- */
-
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- */
-
-#ifndef __LOD_EXTERNBUFFEREDITOR_H__
-#define __LOD_EXTERNBUFFEREDITOR_H__
-
-#include "LOD_MeshPrimitives.h"
-#include <vector>
-#include "LOD_ManMesh2.h"
-#include "../extern/LOD_decimation.h"
-
-
-// This class syncs external vertex/face buffers 
-// with the internal mesh representation during
-// decimation.
-
-class LOD_ExternBufferEditor 
-{
-
-public :
-
-	static 
-		LOD_ExternBufferEditor *
-	New(
-		LOD_Decimation_InfoPtr extern_info
-	){
-		if (extern_info == NULL) return NULL;
-		return new LOD_ExternBufferEditor(extern_info);
-	}
-	
-	// update the external vertex buffer with vertices
-	// from the mesh
-
-		void
-	CopyModifiedVerts(
-		LOD_ManMesh2 & mesh,
-		const std::vector<LOD_VertexInd> & mod_vertices
-	){
-	
-		std::vector<LOD_VertexInd>::const_iterator v_start = mod_vertices.begin();
-		std::vector<LOD_VertexInd>::const_iterator v_end = mod_vertices.end();
-
-		std::vector<LOD_Vertex> & mesh_verts = mesh.VertexSet();
-
-		float * const extern_vertex_ptr = m_extern_info->vertex_buffer;
-
-		for (; v_start != v_end; ++v_start) {
-			float * mod_vert = extern_vertex_ptr + int(*v_start)*3;
-			mesh_verts[*v_start].CopyPosition(mod_vert);
-		}
-	}			
-		
-	// update the external face buffer with faces from the mesh
-
-		void
-	CopyModifiedFaces(
-		LOD_ManMesh2 & mesh,
-		const std::vector<LOD_FaceInd> & mod_faces
-	){
-	
-		std::vector<LOD_FaceInd>::const_iterator f_start = mod_faces.begin();
-		std::vector<LOD_FaceInd>::const_iterator f_end = mod_faces.end();
-
-		std::vector<LOD_TriFace> &mesh_faces = mesh.FaceSet();
-
-		int * const extern_face_ptr = m_extern_info->triangle_index_buffer;
-
-		for (; f_start != f_end; ++f_start) {
-			int *mod_face = extern_face_ptr + 3*int(*f_start);
-			mesh_faces[*f_start].CopyVerts(mod_face);
-		}
-	}
-
-
-	// Copy the last vertex over the vertex specified by
-	// vi. Decrement the size of the vertex array	
-
-		void
-	CopyBackVertex(
-		LOD_VertexInd vi
-	){
-
-		float * const extern_vertex_ptr = m_extern_info->vertex_buffer;
-		int * extern_vertex_num = &(m_extern_info->vertex_num);
-
-		float * last_external_vert = extern_vertex_ptr + 3*((*extern_vertex_num) - 1);
-		float * external_vert = extern_vertex_ptr + 3*int(vi);
-
-		external_vert[0] = last_external_vert[0];
-		external_vert[1] = last_external_vert[1];
-		external_vert[2] = last_external_vert[2];
-
-		*extern_vertex_num -=1;
-	}
-
-	// Copy the last face over the face specified by fi
-	// Decrement the size of the face array
-
-		void
-	CopyBackFace(
-		LOD_FaceInd fi
-	) {
-		int * const extern_face_ptr = m_extern_info->triangle_index_buffer;
-		int * extern_face_num = &(m_extern_info->face_num);
-		
-		int * last_external_face = extern_face_ptr + 3*((*extern_face_num) -1);
-		int * external_face = extern_face_ptr + 3*int(fi);
-		external_face[0] = last_external_face[0];
-		external_face[1] = last_external_face[1];
-		external_face[2] = last_external_face[2];
-
-		*extern_face_num -=1;
-	}	
-
-
-private :
-		
-	LOD_ExternBufferEditor(
-		LOD_Decimation_InfoPtr extern_info	
-	) :
-		m_extern_info (extern_info)
-	{
-	}
-
-	LOD_Decimation_InfoPtr const m_extern_info;
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.cpp b/intern/decimation/intern/LOD_ExternNormalEditor.cpp
deleted file mode 100644
index 90033fe..0000000
--- a/intern/decimation/intern/LOD_ExternNormalEditor.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternNormalEditor.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_ExternNormalEditor.h"
-#include <vector>
-
-using namespace std;
-
-
-LOD_ExternNormalEditor::
-LOD_ExternNormalEditor(
-	LOD_Decimation_InfoPtr extern_info,
-	LOD_ManMesh2 &mesh
-) :
-	m_mesh(mesh),
-	m_extern_info (extern_info)
-{
-}
-
-	LOD_ExternNormalEditor *
-LOD_ExternNormalEditor::
-New(
-	LOD_Decimation_InfoPtr extern_info,
-	LOD_ManMesh2 &mesh
-){
-	if (extern_info == NULL) return NULL;
-	
-	MEM_SmartPtr<LOD_ExternNormalEditor> output(new LOD_ExternNormalEditor(extern_info,mesh));
-
-	int face_num = mesh.FaceSet().size();
-
-	MEM_SmartPtr<vector<MT_Vector3> > normals(new vector<MT_Vector3>);
-
-	if (output == NULL ||
-		normals == NULL
-	) {
-		return NULL;
-	}	
-
-	normals->reserve(face_num);
-	output->m_normals = normals.Release();
-
-	return output.Release();
-};
-	
-
-	void
-LOD_ExternNormalEditor::
-Remove(
-	std::vector<LOD_FaceInd> &sorted_faces
-){
-	// assumes a collection of faces sorted in descending order .
-	
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
-	vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (normals.size() > 0) {
-			MT_Vector3 temp = normals[*it_start];
-		
-			normals[*it_start] = normals.back();
-			normals.back() = temp;
-
-			normals.pop_back();
-		}
-
-		// FIXME - throw exception
-	}
-}
-
-
-	void
-LOD_ExternNormalEditor::
-Add(
-){
-	MT_Vector3 zero(0.0f,0.0f,0.0f);
-	m_normals->push_back(zero);
-};	
-
-	void
-LOD_ExternNormalEditor::
-Update(
-	std::vector<LOD_FaceInd> &sorted_faces
-){
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
-	vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-
-	for (; it_start != it_end; ++it_start) {		
-		normals[*it_start] = ComputeNormal(faces[*it_start]);		
-	}	
-};
-
-
-
-	
-// vertex normals
-/////////////////
-
-	void
-LOD_ExternNormalEditor::
-RemoveVertexNormals(
-	std::vector<LOD_VertexInd> &sorted_verts
-){
-
-	float * vertex_normals = m_extern_info->vertex_normal_buffer;
-
-	// assumption here that the vertexs normal number corresponds with 
-	// the number of vertices !
-
-	int vertex_normal_num = m_extern_info->vertex_num; 
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (vertex_normal_num > 0) {
-			float * vertex_normal = vertex_normals + int(*it_start)*3;
-			float * last_vertex = vertex_normals + ((vertex_normal_num-1)*3);
-
-			MT_Vector3 last_v(last_vertex);
-			last_v.getValue(vertex_normal);
-			vertex_normal_num--;
-		}
-
-		// FIXME - through exception
-	}
-};
-
-
-
-	void
-LOD_ExternNormalEditor::
-UpdateVertexNormals(
-	std::vector<LOD_VertexInd> &sorted_verts
-){
-	float * vertex_normals = m_extern_info->vertex_normal_buffer;
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
-	for (; it_start != it_end; ++it_start) {		
-		MT_Vector3 temp = ComputeVertexNormal(*it_start);		
-		float * vertex_normal = vertex_normals + int(*it_start)*3;
-		temp.getValue(vertex_normal);
-	}
-}
-
-// Editor specific methods
-//////////////////////////
-
-	void
-LOD_ExternNormalEditor::
-BuildNormals(
-) {
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	int face_num = faces.size();
-	int cur_face = 0;
-
-	for (; cur_face < face_num; ++cur_face) {
-
-		MT_Vector3 new_normal = ComputeNormal(faces[cur_face]);	
-		normals.push_back(new_normal); 
-	}
-}
-
-const 
-	MT_Vector3 
-LOD_ExternNormalEditor::
-ComputeNormal(
-	const LOD_TriFace &face
-) const {
-
-	const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
-	MT_Vector3 vec1 = 
-		verts[face.m_verts[1]].pos - 
-		verts[face.m_verts[0]].pos;
-
-	MT_Vector3 vec2 = 
-		verts[face.m_verts[2]].pos - 
-		verts[face.m_verts[1]].pos;
-
-	vec1 = vec1.cross(vec2);
-
-	if (!vec1.fuzzyZero()) {
-		vec1.normalize();
-		return (vec1);
-	} else {		
-		return (MT_Vector3(1.0,0,0));
-	}		
-}
-
-const 
-	MT_Vector3 
-LOD_ExternNormalEditor::
-ComputeVertexNormal(
-	const LOD_VertexInd v
-) const {
-
-	// average the face normals surrounding this
-	// vertex and normalize
-	// vector<LOD_Vertex> &verts = m_mesh.VertexSet(); /*unused*/
-	const vector<MT_Vector3> & face_normals = m_normals.Ref();
-
-	vector<LOD_FaceInd> vertex_faces;
-	vertex_faces.reserve(32);
-	
-	m_mesh.VertexFaces(v,vertex_faces);
-	
-	MT_Vector3 normal(0,0,0);
-
-	vector<LOD_FaceInd>::const_iterator face_it = vertex_faces.begin();
-	vector<LOD_FaceInd>::const_iterator face_end = vertex_faces.end();
-
-	for (; face_it != face_end; ++face_it) {
-		normal += face_normals[*face_it];
-	}
-	
-	if (!normal.fuzzyZero()) {
-		normal.normalize();
-		return (normal);
-	} else {		
-		return (MT_Vector3(1.0,0,0));
-	}		
-}
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.h b/intern/decimation/intern/LOD_ExternNormalEditor.h
deleted file mode 100644
index 5213519..0000000
--- a/intern/decimation/intern/LOD_ExternNormalEditor.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternNormalEditor.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_EXTERNNORMALEDITOR_H__
-#define __LOD_EXTERNNORMALEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "../extern/LOD_decimation.h"
-
-class LOD_ExternNormalEditor : public MEM_NonCopyable
-{
-
-public : 
-
-	// Creation
-	///////////
-
-	static
-		LOD_ExternNormalEditor *
-	New(
-		LOD_Decimation_InfoPtr,
-		LOD_ManMesh2 &mesh
-	); 
-
-	// Property editor interface
-	////////////////////////////
-
-
-	// Faces
-	////////
-		void
-	Remove(
-		std::vector<LOD_FaceInd> &sorted_faces
-	);
-
-		void
-	Add(
-	); 	
-
-		void
-	Update(
-		std::vector<LOD_FaceInd> &sorted_faces
-	);
-
-	const 
-		std::vector<MT_Vector3> &
-	Normals(
-	) const {
-		return m_normals.Ref();
-	};
-	
-
-	// vertex normals
-	/////////////////
-
-		void
-	RemoveVertexNormals(
-		std::vector<LOD_VertexInd> &sorted_verts
-	);
-
-
-		void
-	UpdateVertexNormals(
-		std::vector<LOD_VertexInd> &sorted_verts
-	);
-
-	// Editor specific methods
-	//////////////////////////
-
-		void
-	BuildNormals(
-	);	
-
-
-private :
-
-	MEM_SmartPtr<std::vector<MT_Vector3> > m_normals;
-
-	LOD_ManMesh2 &m_mesh;
-	LOD_Decimation_InfoPtr m_extern_info;
-
-private :
-	
-		
-	LOD_ExternNormalEditor(
-		LOD_Decimation_InfoPtr extern_info,
-		LOD_ManMesh2 &mesh
-	);
-
-	const 
-		MT_Vector3 
-	ComputeNormal(
-		const LOD_TriFace &face
-	) const;
-
-	const 
-		MT_Vector3
-	ComputeVertexNormal (
-		const LOD_VertexInd vi
-	) const;
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.cpp b/intern/decimation/intern/LOD_FaceNormalEditor.cpp
deleted file mode 100644
index 430406a..0000000
--- a/intern/decimation/intern/LOD_FaceNormalEditor.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_FaceNormalEditor.cpp
- *  \ingroup decimation
- */
-
-
-// implementation of LOD_FaceNormalEditor.h
-
-///////////////////////////////////////
-#include "LOD_FaceNormalEditor.h"
-
-using namespace std;
-
-LOD_FaceNormalEditor::
-LOD_FaceNormalEditor(
-	LOD_ManMesh2 & mesh
-) : m_mesh(mesh) {
-};
-
-	LOD_FaceNormalEditor *
-LOD_FaceNormalEditor::
-New(
-	LOD_ManMesh2 &mesh
-){
-	// build a set of normals of the same size
-	// as the number of polys in the mesh
-
-	MEM_SmartPtr<LOD_FaceNormalEditor> output(new LOD_FaceNormalEditor(mesh));
-
-	int face_num = mesh.FaceSet().size();
-
-	MEM_SmartPtr<vector<MT_Vector3> > normals(new vector<MT_Vector3>);
-	MEM_SmartPtr<vector<MT_Vector3> > vertex_normals(new vector<MT_Vector3>);
-
-	if (output == NULL ||
-		normals == NULL
-	) {
-		return NULL;
-	}	
-
-	normals->reserve(face_num);
-	vertex_normals->reserve(mesh.VertexSet().size());
-	output->m_normals = normals.Release();
-	output->m_vertex_normals = vertex_normals.Release();
-
-	return output.Release();
-};
-
-
-// Property editor interface
-////////////////////////////
-
-	void
-LOD_FaceNormalEditor::
-Remove(
-	std::vector<LOD_FaceInd> &sorted_faces
-){
-	
-	// assumes a collection of faces sorted in descending order .
-	
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
-	vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (normals.size() > 0) {
-			MT_Vector3 temp = normals[*it_start];
-		
-			normals[*it_start] = normals.back();
-			normals.back() = temp;
-
-			normals.pop_back();
-		}
-
-		// FIXME - through exception
-	}
-}
-
-
-	void
-LOD_FaceNormalEditor::
-Add(
-){
-	MT_Vector3 zero(0.0f,0.0f,0.0f);
-	m_normals->push_back(zero);
-}
-
-	void
-LOD_FaceNormalEditor::
-Update(
-	std::vector<LOD_FaceInd> &sorted_faces
-){
-
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
-	vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-
-	for (; it_start != it_end; ++it_start) {		
-		normals[*it_start] = ComputeNormal(faces[*it_start]);		
-	}	
-};
-
-// vertex normals
-/////////////////
-
-
-	void
-LOD_FaceNormalEditor::
-RemoveVertexNormals(
-	vector<LOD_VertexInd> &sorted_verts
-){
-	vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (vertex_normals.size() > 0) {
-			MT_Vector3 temp = vertex_normals[*it_start];
-		
-			vertex_normals[*it_start] = vertex_normals.back();
-			vertex_normals.back() = temp;
-
-			vertex_normals.pop_back();
-		}
-
-		// FIXME - through exception
-	}
-};
-
-	void
-LOD_FaceNormalEditor::
-UpdateVertexNormals(
-	vector<LOD_VertexInd> &sorted_verts
-){
-	vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
-	for (; it_start != it_end; ++it_start) {		
-		vertex_normals[*it_start] = ComputeVertexNormal(*it_start);		
-	}	
-}
-
-
-
-// Editor specific methods
-//////////////////////////
-
-	void
-LOD_FaceNormalEditor::
-BuildNormals(
-){
-
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-	vector<MT_Vector3> & normals = m_normals.Ref();
-
-	int face_num = faces.size();
-	int cur_face = 0;
-
-	for (; cur_face < face_num; ++cur_face) {
-
-		MT_Vector3 new_normal = ComputeNormal(faces[cur_face]);	
-		normals.push_back(new_normal); 
-	}
-	// now build the vertex normals
-
-	vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
-	const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
-	int vertex_num = verts.size();
-	int cur_vertex = 0;
-
-	for (; cur_vertex < vertex_num; ++cur_vertex) {
-		MT_Vector3 new_normal = ComputeVertexNormal(cur_vertex);
-		vertex_normals.push_back(new_normal);
-	}
-}
-
-const 
-	MT_Vector3 
-LOD_FaceNormalEditor::
-ComputeNormal(
-	const LOD_TriFace &face
-) const {
-
-	const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
-	MT_Vector3 vec1 = 
-		verts[face.m_verts[1]].pos - 
-		verts[face.m_verts[0]].pos;
-
-	MT_Vector3 vec2 = 
-		verts[face.m_verts[2]].pos - 
-		verts[face.m_verts[1]].pos;
-
-	vec1 = vec1.cross(vec2);
-
-	if (!vec1.fuzzyZero()) {
-		vec1.normalize();
-		return (vec1);
-	} else {		
-		return (MT_Vector3(1.0,0,0));
-	}		
-}
-
-const 
-	MT_Vector3 
-LOD_FaceNormalEditor::
-ComputeVertexNormal(
-	const LOD_VertexInd v
-) const {
-
-	// average the face normals surrounding this
-	// vertex and normalize
-	const vector<MT_Vector3> & face_normals = m_normals.Ref();
-
-	vector<LOD_FaceInd> vertex_faces;
-	vertex_faces.reserve(32);
-	
-	m_mesh.VertexFaces(v,vertex_faces);
-	
-	MT_Vector3 normal(0,0,0);
-
-	vector<LOD_FaceInd>::const_iterator face_it = vertex_faces.begin();
-	vector<LOD_FaceInd>::const_iterator face_end = vertex_faces.end();
-
-	for (; face_it != face_end; ++face_it) {
-		normal += face_normals[*face_it];
-	}
-	
-	if (!normal.fuzzyZero()) {
-		normal.normalize();
-		return (normal);
-	} else {		
-		return (MT_Vector3(1.0,0,0));
-	}		
-}
-
-
-
-
-
-
-
-
-
-
-	
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.h b/intern/decimation/intern/LOD_FaceNormalEditor.h
deleted file mode 100644
index a221ab0..0000000
--- a/intern/decimation/intern/LOD_FaceNormalEditor.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_FaceNormalEditor.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_FACENORMALEDITOR_H__
-#define __LOD_FACENORMALEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-
-
-class LOD_FaceNormalEditor : public MEM_NonCopyable
-{
-
-public : 
-
-	// Creation
-	///////////
-
-	static
-		LOD_FaceNormalEditor *
-	New(
-		LOD_ManMesh2 &mesh
-	); 
-
-	// Property editor interface
-	////////////////////////////
-
-
-	// Faces
-	////////
-		void
-	Remove(
-		std::vector<LOD_FaceInd> &sorted_faces
-	);
-
-		void
-	Add(
-	); 	
-
-		void
-	Update(
-		std::vector<LOD_FaceInd> &sorted_faces
-	);
-
-	
-	// vertex normals
-	/////////////////
-
-		void
-	RemoveVertexNormals(
-		std::vector<LOD_VertexInd> &sorted_verts
-	);
-
-
-		void
-	UpdateVertexNormals(
-		std::vector<LOD_VertexInd> &sorted_verts
-	);
-
-
-
-	const 
-		std::vector<MT_Vector3> &
-	Normals(
-	) const {
-		return m_normals.Ref();
-	};
-
-
-	const 
-		std::vector<MT_Vector3> &
-	VertexNormals(
-	) const {
-		return m_vertex_normals.Ref();
-	};
-
-	// Editor specific methods
-	//////////////////////////
-
-		void
-	BuildNormals(
-	);	
-
-
-private :
-
-	MEM_SmartPtr<std::vector<MT_Vector3> > m_normals;
-	MEM_SmartPtr<std::vector<MT_Vector3> > m_vertex_normals;
-
-	LOD_ManMesh2 &m_mesh;
-
-private :
-	
-		
-	LOD_FaceNormalEditor(LOD_ManMesh2 &mesh);
-
-	const 
-		MT_Vector3 
-	ComputeNormal(
-		const LOD_TriFace &face
-	) const;
-
-	const 
-		MT_Vector3
-	ComputeVertexNormal (
-		const LOD_VertexInd vi
-	) const;
-
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ManMesh2.cpp b/intern/decimation/intern/LOD_ManMesh2.cpp
deleted file mode 100644
index c618944..0000000
--- a/intern/decimation/intern/LOD_ManMesh2.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ManMesh2.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_ManMesh2.h"
-
-#include "MT_assert.h"
-#include <algorithm>
-#include "LOD_MeshException.h"
-#include "CTR_TaggedSetOps.h"
-#include "CTR_UHeap.h"
-#include "LOD_ExternBufferEditor.h"
-
-
-using namespace std;
-
-LOD_ManMesh2::
-LOD_ManMesh2(
-) :
-	m_bbox_min(0,0,0),
-	m_bbox_max(0,0,0)
-{
-}
-	
-
-	LOD_ManMesh2 *
-LOD_ManMesh2::
-New(
-){
-	MEM_SmartPtr<LOD_ManMesh2> output(new LOD_ManMesh2());
-	if (output == NULL) return NULL;
-
-	// build the vertex, edge and face sets.
-
-	MEM_SmartPtr<vector<LOD_Vertex> > verts(new vector<LOD_Vertex>);
-	MEM_SmartPtr<vector<LOD_TriFace> > faces(new vector<LOD_TriFace>);
-	MEM_SmartPtr<vector<LOD_Edge> > edges(new vector<LOD_Edge>);
-	
-	if ((faces == NULL) || (edges == NULL) || (verts == NULL)) {
-		return NULL;
-	}
-	
-	output->m_verts = verts.Release();
-	output->m_faces = faces.Release();
-	output->m_edges = edges.Release();
-
-	return output.Release();
-}	
-
-// take ownership of the vertices.
-
-	bool	
-LOD_ManMesh2::
-SetVertices(
-	MEM_SmartPtr<vector<LOD_Vertex> > verts
-){
-
-
-	// take ownership of vertices
-	m_verts = verts;
-
-	// create a polygon and edge buffer of half the size 
-	// and just use the automatic resizing feature of vector<>
-	// to worry about the dynamic array resizing
-	
-	m_faces->clear();
-	m_edges->clear();
-
-	m_faces->reserve(m_verts->size()/2);
-	m_edges->reserve(m_verts->size()/2);
-
-	return true;	
-
-}
-
-	
-// add a triangle to the mesh
-
-	void
-LOD_ManMesh2::
-AddTriangle(
-	int verts[3]
-) {
-
-	MT_assert(verts[0] < int(m_verts->size()));
-	MT_assert(verts[1] < int(m_verts->size()));
-	MT_assert(verts[2] < int(m_verts->size()));
-
-	LOD_TriFace face;
-	face.m_verts[0] = verts[0];
-	face.m_verts[1] = verts[1];
-	face.m_verts[2] = verts[2];
-
-	LOD_FaceInd face_index = m_faces->size();
-
-	m_faces->push_back(face);	
-
-	// now work out if any of the directed edges or their
-	// companion edges exist already.
-	// We go through the edges associated with each of the given vertices 
-
-	// the safest thing to do is iterate through each of the edge sets
-	// check against each of the 2 other triangle edges to see if they are there
-	
-	vector<LOD_EdgeInd> new_edges;
-	new_edges.reserve(3);
-
-	InsertEdge(verts[0],verts[1],face_index,new_edges);
-	InsertEdge(verts[1],verts[2],face_index,new_edges);
-	InsertEdge(verts[2],verts[0],face_index,new_edges);
-
-}
-	
-// Adds the index of any created edges to new_edges
-
-	bool
-LOD_ManMesh2::
-InsertEdge(
-	const LOD_VertexInd v1,
-	const LOD_VertexInd v2,
-	const LOD_FaceInd f,
-	vector<LOD_EdgeInd> &new_edges
-){
-	
-	MT_assert(!v1.IsEmpty());
-	MT_assert(!v2.IsEmpty());
-	MT_assert(!f.IsEmpty());
-
-	vector<LOD_Vertex> &verts = VertexSet();
-	vector<LOD_Edge> &edges = EdgeSet();
-	
-	LOD_EdgeInd e;
-
-	e = FindEdge(v1,v2);
-
-	if (e.IsEmpty()) {
-		// This edge does not exist -- make a new one 
-
-		LOD_Edge temp_e;
-		temp_e.m_verts[0] = v1;
-		temp_e.m_verts[1] = v2;
-
-		e = m_edges->size();
-
-		// set the face ptr for this half-edge
-		temp_e.m_faces[0] = f;
-
-		m_edges->push_back(temp_e);
-
-		// add the edge index to it's vertices 
-
-		verts[v1].AddEdge(e);
-		verts[v2].AddEdge(e);
-
-		new_edges.push_back(e);
-
-	} else {
-
-		// edge already exists
-		// insure that there is no polygon already
-		// attached to the other side of this edge
-
-		// swap the empty face pointer in edge with f
-
-		LOD_Edge &edge = edges[e];
-
-		edge.SwapFace(LOD_FaceInd::Empty(),f);
-	}
-		
-
-	return true;
-
-}
-
-	void
-LOD_ManMesh2::
-ConnectTriangle(
-	LOD_FaceInd fi,
-	std::vector<LOD_EdgeInd> & new_edges
-){
-
-	vector<LOD_TriFace> &faces = FaceSet();
-
-	MT_assert(!faces[fi].Degenerate());
-
-	LOD_TriFace & face = faces[fi];
-
-	InsertEdge(face.m_verts[0],face.m_verts[1],fi,new_edges);
-	InsertEdge(face.m_verts[1],face.m_verts[2],fi,new_edges);
-	InsertEdge(face.m_verts[2],face.m_verts[0],fi,new_edges);
-};
-
-
-
-
-// geometry access
-//////////////////
-
-	vector<LOD_Vertex> &
-LOD_ManMesh2::
-VertexSet(
-) const {
-	return m_verts.Ref();
-}		
-
-	vector<LOD_TriFace> &
-LOD_ManMesh2::
-FaceSet(
-) const {
-	return m_faces.Ref();
-}
-
-	vector<LOD_Edge> &
-LOD_ManMesh2::
-EdgeSet(
-) const {
-	return m_edges.Ref();
-};
-
-LOD_ManMesh2::
-~LOD_ManMesh2(
-){
-	//auto ptr takes care of vertex arrays etc.
-}
-
-	LOD_EdgeInd
-LOD_ManMesh2::
-FindEdge(
-	const LOD_VertexInd v1,
-	const LOD_VertexInd v2
-) {
-
-	vector<LOD_Vertex> &verts = VertexSet();
-	vector<LOD_Edge> &edges = EdgeSet();
-
-	LOD_Edge e;
-	e.m_verts[0] = v1;
-	e.m_verts[1] = v2;
-	
-	vector<LOD_EdgeInd> &v1_edges = verts[v1].m_edges;
-	vector<LOD_EdgeInd>::const_iterator v1_end = v1_edges.end();
-	vector<LOD_EdgeInd>::iterator v1_begin = v1_edges.begin();
-
-	for (; v1_begin != v1_end; ++v1_begin) {
-		if (edges[*v1_begin] == e) return *v1_begin;
-	}
-	
-	return LOD_EdgeInd::Empty();
-}
-
-// face queries
-///////////////
-
-	void
-LOD_ManMesh2::
-FaceVertices(
-	LOD_FaceInd fi,
-	vector<LOD_VertexInd> &output
-){	
-	const vector<LOD_TriFace> &faces = FaceSet();
-	const LOD_TriFace & f = faces[fi];
-
-	output.push_back(f.m_verts[0]);
-	output.push_back(f.m_verts[1]);
-	output.push_back(f.m_verts[2]);
-}
-	
-	void
-LOD_ManMesh2::
-FaceEdges(
-	LOD_FaceInd fi,
-	vector<LOD_EdgeInd> &output
-){
-	const vector<LOD_TriFace> &faces = FaceSet();
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_Vertex> &verts = VertexSet();	
-
-	const LOD_TriFace & f = faces[fi];
-	// intersect vertex edges
-
-	vector<LOD_EdgeInd> & v0_edges = verts[f.m_verts[0]].m_edges;
-	vector<LOD_EdgeInd> & v1_edges = verts[f.m_verts[1]].m_edges;
-	vector<LOD_EdgeInd> & v2_edges = verts[f.m_verts[2]].m_edges;
-
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v0_edges,v1_edges,edges,output);
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v1_edges,v2_edges,edges,output);
-	CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v2_edges,v0_edges,edges,output);
-
-	MT_assert(output.size() == 3);
-	if (output.size() != 3) {
-		LOD_MeshException e(LOD_MeshException::e_non_manifold);
-		throw(e);	
-	}
-}
-	
-
-// edge queries
-///////////////
-
-	void
-LOD_ManMesh2::
-EdgeVertices(
-	LOD_EdgeInd ei,
-	vector<LOD_VertexInd> &output
-){
-	const vector<LOD_Edge> &edges = EdgeSet();
-	const LOD_Edge & e = edges[ei];
-
-	output.push_back(e.m_verts[0]);
-	output.push_back(e.m_verts[1]);
-}
-
-	void
-LOD_ManMesh2::
-EdgeFaces(
-	LOD_EdgeInd ei,
-	vector<LOD_FaceInd> &output
-){
-	const vector<LOD_Edge> &edges = EdgeSet();
-	const LOD_Edge & e = edges[ei];
-
-	if (!e.m_faces[0].IsEmpty()) {
-		output.push_back(e.m_faces[0]);
-	}
-	if (!e.m_faces[1].IsEmpty()) {
-		output.push_back(e.m_faces[1]);
-	}
-}	
-
-// vertex queries
-/////////////////
-
-	void
-LOD_ManMesh2::
-VertexEdges(
-	LOD_VertexInd vi,
-	vector<LOD_EdgeInd> &output
-){
-	// iterate through the edges of v and push them onto the 
-	// output
-	
-	vector<LOD_Vertex> &verts = VertexSet();
-
-	vector<LOD_EdgeInd> & v_edges = verts[vi].m_edges;
-	vector<LOD_EdgeInd>::iterator v_it = v_edges.begin();
-
-	for (; v_it != v_edges.end(); ++v_it) {
-		output.push_back(*v_it);
-	}	
-}
-
-	void
-LOD_ManMesh2::
-VertexFaces(
-	LOD_VertexInd vi,
-	vector<LOD_FaceInd> &output
-){
-	const vector<LOD_Vertex> &verts = VertexSet();
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_TriFace> &faces = FaceSet();
-
-	const vector<LOD_EdgeInd> &v_edges = verts[vi].m_edges;
-	vector<LOD_EdgeInd>::const_iterator e_it = v_edges.begin();
-
-	for (; e_it != v_edges.end(); ++e_it) {
-
-		LOD_Edge &e = edges[*e_it]; 
-
-		if ((!e.m_faces[0].IsEmpty()) && (!faces[e.m_faces[0]].SelectTag())) {
-			output.push_back(e.m_faces[0]);
-			faces[e.m_faces[0]].SetSelectTag(true);
-		}
-
-		if ((!e.m_faces[1].IsEmpty()) && (!faces[e.m_faces[1]].SelectTag())) {
-			output.push_back(e.m_faces[1]);
-			faces[e.m_faces[1]].SetSelectTag(true);
-		}
-	}
-
-	vector<LOD_FaceInd>::iterator f_it = output.begin();
-
-	for (; f_it != output.end(); ++f_it) {
-		faces[*f_it].SetSelectTag(false);
-	}
-};
-		
-	void
-LOD_ManMesh2::
-SetBBox(
-	MT_Vector3 bbox_min,
-	MT_Vector3 bbox_max
-){
-	m_bbox_min = bbox_min;
-	m_bbox_max = bbox_max;
-};
-
-	void
-LOD_ManMesh2::
-SC_TriFace(
-	LOD_FaceInd f
-){
-	LOD_TriFace face = (*m_faces)[f];
-	
-	// check for unique vertices
-
-	if (
-		(face.m_verts[0] == face.m_verts[1]) ||
-		(face.m_verts[1] == face.m_verts[2]) ||
-		(face.m_verts[2] == face.m_verts[0])
-	) {
-		MT_assert(false);
-	}	
-
-}
-
-
-	void
-LOD_ManMesh2::
-SC_EdgeList(
-	LOD_VertexInd v
-){
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_Vertex> &verts = VertexSet();
-
-	vector<LOD_EdgeInd>::iterator e_it = verts[v].m_edges.begin();
-
-	for (;e_it != verts[v].m_edges.end(); ++e_it) {
-		MT_assert( (edges[*e_it].m_verts[0] == v) || (edges[*e_it].m_verts[1] == v));
-	}				
-
-};
-	
-	void
-LOD_ManMesh2::
-DeleteVertex(
-	LOD_ExternBufferEditor & extern_editor,
-	LOD_VertexInd v
-){
-
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_Vertex> &verts = VertexSet();
-	vector<LOD_TriFace> &faces = FaceSet();
-
-	// need to update all the edge and polygons pointing to 
-	// the last vertex in m_verts
-
-	if (verts.size() == 1) {
-		verts.clear();
-		return;
-	}
-
-	LOD_VertexInd last = LOD_VertexInd(size_t(verts.end() - verts.begin() - 1));
-
-	if (!(last == v)) {
-
-		// we asume that v is already disconnected
-
-		vector<LOD_FaceInd> v_faces;
-		vector<LOD_EdgeInd> v_edges;
-
-		v_faces.reserve(64);
-		v_edges.reserve(64);
-
-		VertexFaces(last,v_faces);
-		VertexEdges(last,v_edges);
-
-		// map the faces and edges to look at v	
-
-		vector<LOD_FaceInd>::iterator face_it = v_faces.begin();
-
-		for(; face_it != v_faces.end(); ++face_it) {
-			faces[*face_it].SwapVertex(last,v);
-		}
-		vector<LOD_EdgeInd>::iterator edge_it = v_edges.begin();
-
-		for (; edge_it != v_edges.end(); ++edge_it) {
-			edges[*edge_it].SwapVertex(last,v);
-		}
-
-		// copy the last vertex onto v and pop off the back.
-
-		verts[v] = verts[last];
-
-		// tidy external buffer
-		extern_editor.CopyModifiedFaces(*this,v_faces);
-	}
-
-	verts.pop_back();	
-	extern_editor.CopyBackVertex(v);
-
-
-};		
-
-	void
-LOD_ManMesh2::
-DeleteEdge(
-	LOD_EdgeInd e,
-	CTR_UHeap<LOD_Edge> * heap
-){
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_Vertex> &verts = VertexSet();
-
-	if (edges.size() == 1) {
-		edges.clear();
-		return;
-	}
-
-	LOD_EdgeInd last = LOD_EdgeInd(size_t(edges.end() - edges.begin() - 1));
-
-	if (!(last == e)) {
-		vector<LOD_EdgeInd> e_verts;
-		e_verts.reserve(2);
-		EdgeVertices(last,e_verts);
-		// something is wrong if there arent two!
-
-		verts[e_verts[0]].SwapEdge(last,e);
-		verts[e_verts[1]].SwapEdge(last,e);
-
-		// edges[e] should already have been removed from the heap
-
-		MT_assert(edges[e].HeapPos() == -1);
-
-		edges[e] = edges[last];
-		// also have to swap there heap positions.!!!!!
-
-		heap->HeapVector()[edges[e].HeapPos()] = e;
-
-
-	}
-	edges.pop_back();
-};
-	
-	void
-LOD_ManMesh2::
-DeleteFace(
-	LOD_ExternBufferEditor & extern_editor,
-	LOD_FaceInd f
-){
-
-	vector<LOD_Edge> &edges = EdgeSet();
-	vector<LOD_TriFace> &faces = FaceSet();
-
-	if (faces.size() == 1) {
-		faces.clear();
-		return;
-	}
-
-	LOD_FaceInd last = LOD_FaceInd(size_t (faces.end() - faces.begin() - 1));
-
-	if (!(last == f)) {
-		
-		// we have to update the edges which point to the last 
-		// face 
-
-		vector<LOD_EdgeInd> f_edges;
-		f_edges.reserve(3);
-
-		FaceEdges(last,f_edges);
-
-		vector<LOD_EdgeInd>::iterator edge_it = f_edges.begin();
-		vector<LOD_EdgeInd>::const_iterator edge_end = f_edges.end();
-	
-		for (; edge_it != edge_end; ++edge_it) {
-			edges[*edge_it].SwapFace(last,f);
-		}
-
-		faces[f] = faces[last];
-
-	}
-	faces.pop_back();
-
-	// tidy external buffers
-	extern_editor.CopyBackFace(f);
-};	
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_ManMesh2.h b/intern/decimation/intern/LOD_ManMesh2.h
deleted file mode 100644
index 5d4e1af..0000000
--- a/intern/decimation/intern/LOD_ManMesh2.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ManMesh2.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_MANMESH2_H__
-#define __LOD_MANMESH2_H__
-
-#include "LOD_MeshPrimitives.h"
-#include "MEM_SmartPtr.h"
-#include <vector>
-
-template <class HeapType> class CTR_UHeap;
-
-class LOD_ExternBufferEditor;
-
-class LOD_ManMesh2 // Manifold 2 dimensional mesh
-{
-
-public:
-
-	static
-		LOD_ManMesh2 *
-	New(
-	);
-
-	// take ownership of the vertices.
-
-		bool	
-	SetVertices(
-		MEM_SmartPtr<std::vector<LOD_Vertex> > verts
-	);	
-		
-	// Add a triangle to the mesh
-
-		void
-	AddTriangle(
-		int verts[3]
-	);	
-
-		void
-	ConnectTriangle(
-		LOD_FaceInd fi,
-		std::vector<LOD_EdgeInd> & new_edges
-	);
-	
-	// geometry access
-	//////////////////
-
-		std::vector<LOD_Vertex> &
-	VertexSet(
-	) const;
-
-		std::vector<LOD_TriFace> &
-	FaceSet(
-	) const;
-
-		std::vector<LOD_Edge> &
-	EdgeSet(
-	) const;
-
-	~LOD_ManMesh2(
-	);
-
-	// local geometry queries
-	/////////////////////////
-
-	// face queries
-	///////////////
-
-		void
-	FaceVertices(
-		LOD_FaceInd f,
-		std::vector<LOD_VertexInd> &output
-	);
-	
-		void
-	FaceEdges(
-		LOD_FaceInd f,
-		std::vector<LOD_EdgeInd> &output
-	);	
-
-	// edge queries
-	///////////////
-
-		void
-	EdgeVertices(
-		LOD_EdgeInd e,
-		std::vector<LOD_VertexInd> &output
-	);
-
-		void
-	EdgeFaces(
-		LOD_EdgeInd e,
-		std::vector<LOD_FaceInd> &output
-	);
-
-	// vertex queries
-	/////////////////
-
-		void
-	VertexEdges(
-		LOD_VertexInd v,
-		std::vector<LOD_EdgeInd> &output
-	);
-	
-		void
-	VertexFaces(
-		LOD_VertexInd v,
-		std::vector<LOD_FaceInd> &output
-	);
-
-		void
-	SetBBox(
-		MT_Vector3 bbox_min,
-		MT_Vector3 bbox_max
-	);
-
-		MT_Vector3
-	BBoxMin(
-	) const {
-		return m_bbox_min;
-	};
- 
-		MT_Vector3
-	BBoxMax(
-	) const {
-		return m_bbox_max;
-	};
-
-	// Remove a primitive from the mesh
-	///////////////////////////////////
-
-	// These methods assume you have correctly
-	// tidied up the index pointers in other primitives,
-	// so that nothing refers to this object any more
-
-	// These methods exchange the primitive with the 
-	// last primitive in the vector. It modifies everything 
-	// pointing to the last primitive correctly.
-
-	// FIXME refactor extern editor out of primitive deletion
-	// insead return a vector of primitives that need to be
-	// modified and do this externally
-
-		void
-	DeleteVertex(
-		LOD_ExternBufferEditor & extern_editor,
-		LOD_VertexInd v
-	);
-
-		void
-	DeleteEdge(
-		LOD_EdgeInd e,
-		CTR_UHeap<LOD_Edge> *heap
-	);
-
-		void
-	DeleteFace(
-		LOD_ExternBufferEditor & extern_editor,
-		LOD_FaceInd f
-	);
-
-	// Sanity Check routines
-	////////////////////////
-
-	// Make sure the edge sets and the vertex sets are
-	// consistent
-
-		void
-	SC_TriFace(
-		LOD_FaceInd f
-	);
-
-	// basic sanity checking of an edge list bails out if there are more than 1024
-	// edges
-	
-		void
-	SC_EdgeList(
-		LOD_EdgeInd e
-	);
-
-
-	// Check to see that the edges of v1 and v2 are unique.
-
-		bool
-	SC_UniqueEdge(
-		LOD_EdgeInd e
-	);
-
-
-private :
-
-
-	// Returns the edge index of the edge from v1 to v2. 
-	// Does this by searching the edge sets of v1 - but not v2.
-	// If you are paranoid you should check both and make sure the 
-	// indices are the same. If the edge doe not exist edgeInd is empty.
-
-		LOD_EdgeInd
-	FindEdge(
-		const LOD_VertexInd v1,
-		const LOD_VertexInd v2
-	);
-
-	// Insert an edge into the mesh
-	// Tie up the ptrs and create space for the edge
-	// returns manifold errors - need to sort out memory edges
-
-		bool
-	InsertEdge(
-		const LOD_VertexInd v1,
-		const LOD_VertexInd v2,
-		const LOD_FaceInd f,
-		std::vector<LOD_EdgeInd> &new_edges
-	);
-
-
-private :
-
-	LOD_ManMesh2(
-	);
-
-	MEM_SmartPtr< std::vector<LOD_Vertex> > m_verts;
-	MEM_SmartPtr< std::vector<LOD_TriFace> > m_faces;
-	MEM_SmartPtr< std::vector<LOD_Edge> > m_edges;
-
-	// not sure of these descrtiptions of the mesh should
-	// reside in this class coz may lead to very bloated interface.
-
-	MT_Vector3 m_bbox_min;
-	MT_Vector3 m_bbox_max;
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_MeshBounds.h b/intern/decimation/intern/LOD_MeshBounds.h
deleted file mode 100644
index c95e6c7..0000000
--- a/intern/decimation/intern/LOD_MeshBounds.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshBounds.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_MESHBOUNDS_H__
-#define __LOD_MESHBOUNDS_H__
-
-#include "MEM_SmartPtr.h"
-#include "LOD_MeshPrimitives.h"
-#include "LOD_ManMesh2.h"
-#include "MT_assert.h"
-
-// simple class to compute the mesh bounds of a manifold mesh,
-
-class LOD_MeshBounds {
-
-public :
-	static
-		LOD_MeshBounds *
-	New(
-	){
-
-		MEM_SmartPtr<LOD_MeshBounds> output(new LOD_MeshBounds());		
-		return output.Release();
-	}
-
-		void
-	ComputeBounds(
-		const LOD_ManMesh2 * mesh
-	){
-		MT_assert(mesh!=NULL);
-		MT_assert(mesh->VertexSet().size() > 0);
-
-		const std::vector<LOD_Vertex> &verts = mesh->VertexSet(); 
-		
-		m_min = verts[0].pos;
-		m_max = verts[0].pos;
-
-		// iterate through the verts
-
-		int t;
-		const int size = verts.size();
-
-		for (t=1; t< size ; ++t) {
-
-			UpdateBounds(verts[t].pos,m_min,m_max);
-		}
-	}
-				
-		MT_Vector3
-	Min(
-	) const {
-		return m_min;
-	}
-
-		MT_Vector3
-	Max(
-	) const {
-		return m_max;
-	}
-
-private :
-
-		void
-	UpdateBounds(
-		MT_Vector3 vertex,
-		MT_Vector3& min,
-		MT_Vector3& max
-	) {
-		if (vertex.x() < min.x()) {
-			min.x() = vertex.x();
-		} else
-		if (vertex.x() > max.x()) {
-			max.x()= vertex.x();
-		}
-
-		if (vertex.y() < min.y()) {
-			min.y() = vertex.y();
-		} else
-		if (vertex.y() > max.y()) {
-			max.y()= vertex.y();
-		}
-
-		if (vertex.z() < min.z()) {
-			min.z() = vertex.z();
-		} else
-		if (vertex.z() > max.z()) {
-			max.z()= vertex.z();
-		}
-	}
-
-	LOD_MeshBounds(
-	) :
-		m_min(0,0,0),
-		m_max(0,0,0)
-	{
-	};
-			
-	MT_Vector3 m_min;
-	MT_Vector3 m_max;
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_MeshException.h b/intern/decimation/intern/LOD_MeshException.h
deleted file mode 100644
index 67bd818..0000000
--- a/intern/decimation/intern/LOD_MeshException.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshException.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_MESHEXCEPTION_H__
-#define __LOD_MESHEXCEPTION_H__
-
-class LOD_MeshException {
-
-public :
-
-	// stick in more error types as you think of them
-
-	enum ExceptionType{
-		e_non_manifold,
-		e_search_error
-	} m_e_type;
-
-	LOD_MeshException (
-		ExceptionType type
-	) : m_e_type (type)
-	{
-	}
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.cpp b/intern/decimation/intern/LOD_MeshPrimitives.cpp
deleted file mode 100644
index ee4e4c1..0000000
--- a/intern/decimation/intern/LOD_MeshPrimitives.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshPrimitives.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_MeshPrimitives.h"
-
-#include "MT_assert.h"
-#include "LOD_MeshException.h"
-#include <algorithm>
-
-using namespace std;
-
-// Vertex Methods
-/////////////////
-
-LOD_Vertex::
-LOD_Vertex(
-) :
-	pos (MT_Vector3()),
-	m_select_tag(false)
-{
-};
-
-	bool
-LOD_Vertex::
-RemoveEdge(
-	LOD_EdgeInd e
-){
-
-	vector<LOD_EdgeInd>::iterator result = find(m_edges.begin(),m_edges.end(),e);
-	if (result == m_edges.end()) {
-		return false;
-	}
-
-	std::swap(*result, m_edges.back());
-	m_edges.pop_back();
-	return true;	
-};	
-
-	void
-LOD_Vertex::
-AddEdge(
-	LOD_EdgeInd e
-){
-	m_edges.push_back(e);
-};
-
-	void
-LOD_Vertex::
-SwapEdge(
-	LOD_EdgeInd e_old,
-	LOD_EdgeInd e_new
-){
-
-	vector<LOD_EdgeInd>::iterator result = 
-		find(m_edges.begin(),m_edges.end(),e_old);
-	if (result == m_edges.end()) {
-		MT_assert(false);
-		LOD_MeshException e(LOD_MeshException::e_search_error);
-		throw(e);	
-	}
-	
-	*result = e_new;
-};
-
-	bool
-LOD_Vertex::
-SelectTag(
-) const {
-	return m_select_tag;
-};
-
-	void
-LOD_Vertex::
-SetSelectTag(
-	bool tag	
-){
-	m_select_tag = tag;
-};
-
-	bool
-LOD_Vertex::
-Degenerate(
-){
-	return m_edges.empty();
-}
-
-	void
-LOD_Vertex::
-CopyPosition(
-	float *float_ptr
-){
-	pos.getValue(float_ptr);
-}
-
-
-
-// Edge Methods
-///////////////
-
-LOD_Edge::
-LOD_Edge (
-) {
-	m_verts[0] = m_verts[1] = LOD_VertexInd::Empty();
-	m_faces[0] = m_faces[1] = LOD_FaceInd::Empty();
-}
-		
-	bool 
-LOD_Edge::
-operator == (
-	LOD_Edge & rhs
-) {
-	// edges are the same if their vertex indices are the 
-	// same!!! Other properties are not checked 
-
-	int matches = 0;
-
-	if (this->m_verts[0] == rhs.m_verts[0]) {
-		++matches;
-	}
-	if (this->m_verts[1] == rhs.m_verts[0]) {
-		++matches;
-	}
-	if (this->m_verts[0] == rhs.m_verts[1]) {
-		++matches;
-	}
-	if (this->m_verts[1] == rhs.m_verts[1]) {
-		++matches;
-	}
-	
-	if (matches >= 2) {
-		return true;
-	}
-	return false;
-}
-
-// Elementary helper methods
-////////////////////////////
-
-	LOD_FaceInd
-LOD_Edge::
-OpFace(
-	LOD_FaceInd f
-) const {
-	if (f == m_faces[0]) {
-		return m_faces[1];
-	} else 
-	if (f == m_faces[1]) {
-		return m_faces[0];
-	} else {
-		MT_assert(false);
-		LOD_MeshException e(LOD_MeshException::e_search_error);
-		throw(e);	
-
-		return LOD_FaceInd::Empty();
-	}
-}	
-
-	void
-LOD_Edge::
-SwapFace(
-	LOD_FaceInd old_f,
-	LOD_FaceInd new_f
-) {
-	if (old_f == m_faces[0]) {
-		m_faces[0] = new_f;
-	} else 
-	if (old_f == m_faces[1]) {
-		m_faces[1] = new_f;
-	} else {
-		LOD_MeshException e(LOD_MeshException::e_search_error);
-		throw(e);	
-	}
-}
-
-
-// return the half edge face - the half edge is defined
-// by the {vertex,edge} tuple. 
-
-	LOD_FaceInd
-LOD_Edge::
-HalfEdgeFace(
-	LOD_VertexInd vi
-){
-	if (vi == m_verts[0]) return m_faces[0];
-	if (vi == m_verts[1]) return m_faces[1];
-	MT_assert(false);
-	
-	LOD_MeshException e(LOD_MeshException::e_search_error);
-	throw(e);	
-
-	return LOD_FaceInd::Empty();
-}	
-
-
-	LOD_VertexInd
-LOD_Edge::
-OpVertex(
-	LOD_VertexInd vi
-) {
-	if (vi == m_verts[0]) return m_verts[1];
-	if (vi == m_verts[1]) return m_verts[0];
-	MT_assert(false);
-
-	LOD_MeshException e(LOD_MeshException::e_search_error);
-	throw(e);	
-
-	return LOD_VertexInd::Empty();
-}
-
-// replace the vertex v_old with vertex v_new
-// error if v_old is not one of the original vertices
-
-	void
-LOD_Edge::
-SwapVertex(
-	LOD_VertexInd v_old,
-	LOD_VertexInd v_new
-) {
-	if (v_old == m_verts[0]) {
-		m_verts[0] = v_new;
-	} else
-	if (v_old == m_verts[1]) {
-		m_verts[1] = v_new;
-	} else {
-
-		MT_assert(false);
-
-		LOD_MeshException e(LOD_MeshException::e_search_error);
-		throw(e);	
-	}
-	if(m_verts[0] == m_verts[1]) {
-		MT_assert(false);
-
-		LOD_MeshException e(LOD_MeshException::e_non_manifold);
-		throw(e);	
-	}
-
-}			
-
-	bool
-LOD_Edge::
-SelectTag(
-) const {
-	return bool(m_verts[1].Tag() & 0x1);
-};
-
-	void
-LOD_Edge::
-SetSelectTag(
-	bool tag
-) {
-	m_verts[1].SetTag(int(tag));
-};
-
-	int
-LOD_Edge::
-OpenTag(
-) const {
-	return m_faces[0].Tag();
-}
-
-	void
-LOD_Edge::
-SetOpenTag(
-	int tag
-) {
-	m_faces[0].SetTag(tag);
-}
-
-	bool
-LOD_Edge::
-Degenerate(
-) const {
-	return (
-		(m_faces[0].IsEmpty() && m_faces[1].IsEmpty()) ||
-		(m_verts[0] == m_verts[1])
-	);
-};
-
-// TriFace Methods
-//////////////////
-
-LOD_TriFace::
-LOD_TriFace(
-) {
-	m_verts[0] = m_verts[1] = m_verts[2] = LOD_VertexInd::Empty();
-}
-
-// Elementary helper methods
-////////////////////////////
-
-	void
-LOD_TriFace::
-SwapVertex(
-	LOD_VertexInd old_v,
-	LOD_VertexInd new_v
-) {
-	// could save branching here...
-
-	if (m_verts[0] == old_v) {
-		m_verts[0] = new_v;
-	} else 
-	if (m_verts[1] == old_v) {
-		m_verts[1] = new_v;
-	} else 
-	if (m_verts[2] == old_v) {
-		m_verts[2] = new_v;
-	} else {
-		MT_assert(false);
-
-		LOD_MeshException excep(LOD_MeshException::e_search_error);
-		throw(excep);	
-	}
-}
-
-	bool
-LOD_TriFace::
-SelectTag(
-) const {
-	return bool(m_verts[1].Tag() & 0x1);
-};
-
-	void
-LOD_TriFace::
-SetSelectTag(
-	bool tag
-) {
-	m_verts[1].SetTag(int(tag));
-};
-
-	int
-LOD_TriFace::
-OpenTag(
-) {
-	return m_verts[2].Tag();
-}
-
-	void
-LOD_TriFace::
-SetOpenTag(
-	int tag
-) {
-	m_verts[2].SetTag(tag);
-}
-
-	bool
-LOD_TriFace::
-Degenerate(
-) {
-
-	return (
-		(m_verts[0] == m_verts[1]) ||
-		(m_verts[1] == m_verts[2]) ||
-		(m_verts[2] == m_verts[0]) 
-	);
-}
-
-	void
-LOD_TriFace::
-CopyVerts(
-	int * index_ptr
-){
-	index_ptr[0] = m_verts[0];
-	index_ptr[1] = m_verts[1];
-	index_ptr[2] = m_verts[2];
-};
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.h b/intern/decimation/intern/LOD_MeshPrimitives.h
deleted file mode 100644
index ea2d157..0000000
--- a/intern/decimation/intern/LOD_MeshPrimitives.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshPrimitives.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_MESHPRIMITIVES_H__
-#define __LOD_MESHPRIMITIVES_H__
-
-#include "MT_Vector3.h"
-#include "CTR_TaggedIndex.h"
-#include "CTR_UHeap.h"
-#include <vector>
-
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_VertexInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_EdgeInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_FaceInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_HeapInd;
-
-class LOD_Vertex {
-public :
-	MT_Vector3 pos;
-	std::vector<LOD_EdgeInd> m_edges;
-	bool m_select_tag;
-
-	LOD_Vertex(
-	);
-
-		bool
-	RemoveEdge(
-		LOD_EdgeInd e
-	);	
-
-		void
-	AddEdge(
-		LOD_EdgeInd e
-	);
-
-		void
-	SwapEdge(
-		LOD_EdgeInd e_old,
-		LOD_EdgeInd e_new
-	);
-
-		bool
-	SelectTag(
-	) const; 
-
-		void
-	SetSelectTag(
-		bool tag	
-	);
-
-		bool
-	Degenerate(
-	);
-
-		void
-	CopyPosition(
-		float *float_ptr
-	);
-
-private :
-
-
-};
-
-class LOD_Edge : public CTR_UHeapable  {
-public :
-	LOD_VertexInd	m_verts[2];
-	LOD_FaceInd		m_faces[2];
-
-	LOD_Edge (
-	);
-			
-	bool operator == (
-		LOD_Edge & rhs
-	);
-
-	// Elementary helper methods
-	////////////////////////////
-
-		LOD_FaceInd
-	OpFace(
-		LOD_FaceInd f
-	) const;
-
-		void
-	SwapFace(
-		LOD_FaceInd old_f,
-		LOD_FaceInd new_f
-	);
-
-
-	// return the half edge face - the half edge is defined
-	// by the {vertex,edge} tuple. 
-
-		LOD_FaceInd
-	HalfEdgeFace(
-		LOD_VertexInd vi
-	);	
-	
-
-		LOD_VertexInd
-	OpVertex(
-		LOD_VertexInd vi
-	);
-
-	// replace the vertex v_old with vertex v_new
-	// error if v_old is not one of the original vertices
-
-		void
-	SwapVertex(
-		LOD_VertexInd v_old,
-		LOD_VertexInd v_new
-	);
-
-		bool
-	SelectTag(
-	) const;
-
-		void
-	SetSelectTag(
-		bool tag
-	);
-	
-		int
-	OpenTag(
-	) const;
-
-		void
-	SetOpenTag(
-		int tag
-	);
-
-		bool
-	Degenerate(
-	) const;
-
-		bool
-	BoundaryEdge(
-	) const {
-		return (m_faces[0].IsEmpty() || m_faces[1].IsEmpty());
-	};
-	
-
-};
-
-class LOD_TriFace {
-public:
-
-	LOD_VertexInd m_verts[3];
-
-	LOD_TriFace(
-	);
-
-	// Elementary helper methods
-	////////////////////////////
-
-		void
-	SwapVertex(
-		LOD_VertexInd old_v,
-		LOD_VertexInd new_v
-	);
-
-		bool
-	SelectTag(
-	) const;
-
-		void
-	SetSelectTag(
-		bool tag
-	);
-
-		int
-	OpenTag(
-	);
-		void
-	SetOpenTag(
-		int tag
-	);
-
-		bool
-	Degenerate(
-	);
-
-		void
-	CopyVerts(
-		int * index_ptr
-	);
-
-};
-	
-#endif
-
diff --git a/intern/decimation/intern/LOD_QSDecimator.cpp b/intern/decimation/intern/LOD_QSDecimator.cpp
deleted file mode 100644
index bdcf795..0000000
--- a/intern/decimation/intern/LOD_QSDecimator.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QSDecimator.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_QSDecimator.h"
-
-#include "LOD_ExternBufferEditor.h"
-
-using namespace std;
-
-	LOD_QSDecimator *
-LOD_QSDecimator::
-New(
-	LOD_ManMesh2 &mesh,
-	LOD_ExternNormalEditor &face_editor,
-	LOD_ExternBufferEditor &extern_editor
-){
-
-	MEM_SmartPtr<LOD_QSDecimator> output 
-		= new LOD_QSDecimator(mesh,face_editor,extern_editor);
-
-	MEM_SmartPtr<LOD_EdgeCollapser > collapser(LOD_EdgeCollapser::New());
-	MEM_SmartPtr<LOD_QuadricEditor> q_editor(LOD_QuadricEditor::New(mesh));
-
-	if (
-		output == NULL ||
-		collapser == NULL ||
-		q_editor == NULL 
-	) {
-		return NULL;
-	}
-	output->m_collapser = collapser.Release();
-	output->m_quadric_editor = q_editor.Release();
-	return output.Release();
-}	
-
-
-
-	bool
-LOD_QSDecimator::
-Arm(
-){
-	MT_assert(!m_is_armed);
-	bool heap_result = BuildHeap();
-	if (!heap_result) {
-		return false;
-	}
-	m_is_armed = true;
-	return true;
-}
-	
-	bool
-LOD_QSDecimator::
-Step(
-){
-	return CollapseEdge();
-}
-
-
-LOD_QSDecimator::
-LOD_QSDecimator(
-	LOD_ManMesh2 &mesh,
-	LOD_ExternNormalEditor &face_editor,
-	LOD_ExternBufferEditor &extern_editor
-) :
-	m_is_armed (false),
-	m_mesh(mesh),
-	m_face_editor(face_editor),
-	m_extern_editor(extern_editor)
-{	
-	m_deg_edges.reserve(32);
-	m_deg_faces.reserve(32);
-	m_deg_vertices.reserve(32);
-	m_update_faces.reserve(32);
-	m_new_edges.reserve(32);
-	m_update_vertices.reserve(32);
-};
-
-	bool
-LOD_QSDecimator::
-CollapseEdge(
-){
-	
-	// find an edge to collapse
-	
-	// FIXME force an edge collapse
-	// or return false
-
-	std::vector<LOD_Edge> & edges = m_mesh.EdgeSet();
-	std::vector<LOD_Vertex> & verts = m_mesh.VertexSet();
-	std::vector<LOD_Quadric> & quadrics = m_quadric_editor->Quadrics();
-	int size = edges.size();
-
-	if (size == 0) return false;
-
-	const int heap_top = m_heap->Top();
-
-	if (heap_top == -1 || edges[heap_top].HeapKey() <= -MT_INFINITY) {
-		return false;
-	}
-	
-	// compute the target position
-	MT_Vector3 new_vertex = m_quadric_editor->TargetVertex(edges[heap_top]);
-	LOD_Quadric & q0 = quadrics[edges[heap_top].m_verts[0]];
-	LOD_Quadric & q1 = quadrics[edges[heap_top].m_verts[1]];
-
-	LOD_Vertex &v0 = verts[edges[heap_top].m_verts[0]];
-	LOD_Vertex &v1 = verts[edges[heap_top].m_verts[1]];
-
-	LOD_Quadric sum = q0;
-	sum += q1;
-
-
-	if (m_collapser->CollapseEdge(
-			heap_top,
-			m_mesh,
-			m_deg_edges,
-			m_deg_faces,
-			m_deg_vertices,
-			m_new_edges,
-			m_update_faces,
-			m_update_vertices
-	)) {
-
-		// assign new vertex position
-
-		v0.pos = new_vertex;
-		v1.pos = new_vertex;
-
-		// sum the quadrics of v0 and v1
-		q0 = sum;
-		q1 = sum;
-
-		// ok update the primitive properties
-
-		m_face_editor.Update(m_update_faces);	
-		m_face_editor.UpdateVertexNormals(m_update_vertices);
-
-		// update the external vertex buffer 
-		m_extern_editor.CopyModifiedVerts(m_mesh,m_update_vertices);
-
-		// update the external face buffer
-		m_extern_editor.CopyModifiedFaces(m_mesh,m_update_faces);
-
-		// update the edge heap
-		UpdateHeap(m_deg_edges,m_new_edges);
-
-		m_quadric_editor->Remove(m_deg_vertices);
-		m_face_editor.Remove(m_deg_faces);
-		m_face_editor.RemoveVertexNormals(m_deg_vertices);		
-				
-		// delete the primitives
-
-		DeletePrimitives(m_deg_edges,m_deg_faces,m_deg_vertices);
-
-	} else {
-		// the edge could not be collapsed at the moment - so
-		// we adjust it's priority and add it back to the heap.
-		m_heap->Remove(&edges[0],0);
-		edges[heap_top].HeapKey() = - MT_INFINITY;
-		m_heap->Insert(&edges[0],heap_top);
-	}
-
-	//clear all the temporary buffers
-
-	m_deg_faces.clear();
-	m_deg_edges.clear();
-	m_deg_vertices.clear();
-	
-	m_update_faces.clear();
-	m_update_vertices.clear();
-	m_new_edges.clear();
-
-	return true;
-
-}	
-
-	void
-LOD_QSDecimator::
-DeletePrimitives(
-	const vector<LOD_EdgeInd> & degenerate_edges,
-	const vector<LOD_FaceInd> & degenerate_faces,
-	const vector<LOD_VertexInd> & degenerate_vertices
-) {
-
-	// assumes that the 3 vectors are sorted in descending order.
-
-	// Delete Degnerate primitives
-	//////////////////////////////
-
-
-	// delete the old edges - we have to be very careful here
-	// mesh.delete() swaps edges to be deleted with the last edge in 
-	// the edge buffer. However the next edge to be deleted may have
-	// been the last edge in the buffer!
-
-	// One way to solve this is to sort degenerate_edges in descending order.
-	// And then delete them in that order.
-	
-	// it is also vital that degenerate_edges contains no duplicates
-
-	vector<LOD_EdgeInd>::const_iterator edge_it = degenerate_edges.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = degenerate_edges.end();
-
-	for (; edge_it != edge_end; ++edge_it) {
-		m_mesh.DeleteEdge(*edge_it,m_heap);
-	}
-
-
-
-	vector<LOD_FaceInd>::const_iterator face_it = degenerate_faces.begin();
-	vector<LOD_FaceInd>::const_iterator face_end = degenerate_faces.end();
-	
-	for (;face_it != face_end; ++face_it) {
-		m_mesh.DeleteFace(m_extern_editor,*face_it);
-	}
-
-	vector<LOD_VertexInd>::const_iterator vertex_it = degenerate_vertices.begin();
-	vector<LOD_VertexInd>::const_iterator vertex_end = degenerate_vertices.end();
-	
-	for (;vertex_it != vertex_end; ++vertex_it) {
-		m_mesh.DeleteVertex(m_extern_editor,*vertex_it);
-	}
-}
-
-
-	bool
-LOD_QSDecimator::
-BuildHeap(
-){
-	// build the quadrics 
-
-	if (m_quadric_editor->BuildQuadrics(m_face_editor,true) == false) return false;
-
-
-	m_heap = CTR_UHeap<LOD_Edge>::New();
-	// load in edge pointers to the heap
-
-	std::vector<LOD_Edge> & edge_set= m_mesh.EdgeSet();
-
-	// UNUSED
-	// std::vector<LOD_Edge>::const_iterator edge_end = edge_set.end();
-	// std::vector<LOD_Edge>::iterator edge_start = edge_set.begin();
-
-	std::vector<int> & heap_vector = m_heap->HeapVector();
-
-	for (unsigned int i = 0; i < edge_set.size(); ++i) {
-		edge_set[i].HeapPos() = i;
-		heap_vector.push_back(i);
-	}
-	
-	m_heap->MakeHeap(&edge_set[0]);
-
-	return true;
-}
-
-	void
-LOD_QSDecimator::
-UpdateHeap(
-	std::vector<LOD_EdgeInd> &deg_edges,
-	std::vector<LOD_EdgeInd> &new_edges
-){
-	// first of all compute values for the new edges 
-	// and bung them on the heap.
-
-	std::vector<LOD_Edge>  & edge_set= m_mesh.EdgeSet();
-
-	std::vector<LOD_EdgeInd>::const_iterator edge_it = new_edges.begin();
-	std::vector<LOD_EdgeInd>::const_iterator end_it = new_edges.end();
-
-
-	// insert all the new edges		
-	///////////////////////////
-
-	// compute edge costs ffor the new edges
-
-	m_quadric_editor->ComputeEdgeCosts(new_edges);
-
-	// inser the new elements into the heap
-
-	for (; edge_it != end_it; ++edge_it) {		
-		m_heap->Insert(&edge_set[0],*edge_it);
-	}
-
-
-	// remove all the old values from the heap
-
-	edge_it = deg_edges.begin();
-	end_it = deg_edges.end();
-
-	for (; edge_it != end_it; ++edge_it) {
-		LOD_Edge &e = edge_set[*edge_it];
-		m_heap->Remove(&edge_set[0],e.HeapPos());
-
-		e.HeapPos() = -1;
-
-	}
-}
-	
diff --git a/intern/decimation/intern/LOD_QSDecimator.h b/intern/decimation/intern/LOD_QSDecimator.h
deleted file mode 100644
index 2ac2239..0000000
--- a/intern/decimation/intern/LOD_QSDecimator.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QSDecimator.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_QSDECIMATOR_H__
-#define __LOD_QSDECIMATOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "LOD_ExternNormalEditor.h"
-#include "LOD_EdgeCollapser.h"
-#include "LOD_QuadricEditor.h"
-
-class LOD_ExternBufferEditor;
-
-class LOD_QSDecimator : public MEM_NonCopyable {
-
-public :
-
-	static
-		LOD_QSDecimator *
-	New(
-		LOD_ManMesh2 &mesh,
-		LOD_ExternNormalEditor &face_editor,
-		LOD_ExternBufferEditor &extern_editor
-	);
-
-
-		bool
-	Arm(
-	);
-
-
-		bool
-	Step(
-	);
-
-private :
-
-	LOD_QSDecimator(
-		LOD_ManMesh2 &mesh,
-		LOD_ExternNormalEditor &face_editor,
-		LOD_ExternBufferEditor &extern_editor
-	);
-
-		bool
-	CollapseEdge(
-	);
-
-		bool
-	BuildHeap(
-	);
-
-		void
-	UpdateHeap(
-		std::vector<LOD_EdgeInd> &deg_edges,
-		std::vector<LOD_EdgeInd> &new_edges
-	);	
-
-		void
-	DeletePrimitives(
-		const std::vector<LOD_EdgeInd> & degenerate_edges,
-		const std::vector<LOD_FaceInd> & degenerate_faces,
-		const std::vector<LOD_VertexInd> & degenerate_vertices
-	);
-
-
-private :	
-
-	// owned by this class
-	//////////////////////
-
-	MEM_SmartPtr<LOD_EdgeCollapser> m_collapser;
-	MEM_SmartPtr<CTR_UHeap<LOD_Edge> > m_heap;
-	MEM_SmartPtr<LOD_QuadricEditor> m_quadric_editor;
-
-	bool m_is_armed;
-
-	// arguments to New(...)
-	////////////////////////
-
-	LOD_ManMesh2 & m_mesh;
-	LOD_ExternNormalEditor &m_face_editor;
-	LOD_ExternBufferEditor & m_extern_editor;	
-
-	// temporary buffers
-	////////////////////
-
-	std::vector<LOD_FaceInd> m_deg_faces;
-	std::vector<LOD_EdgeInd> m_deg_edges;
-	std::vector<LOD_VertexInd> m_deg_vertices;
-
-	std::vector<LOD_FaceInd> m_update_faces;
-	std::vector<LOD_EdgeInd> m_new_edges;
-	std::vector<LOD_VertexInd> m_update_vertices;
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_Quadric.h b/intern/decimation/intern/LOD_Quadric.h
deleted file mode 100644
index 9dde050..0000000
--- a/intern/decimation/intern/LOD_Quadric.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_Quadric.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_QUADRIC_H__
-#define __LOD_QUADRIC_H__
-
-#include "MT_Vector3.h"
-#include "MT_Matrix3x3.h"
-
-
-class LOD_Quadric {
-
-private:
-    MT_Scalar a2, ab, ac, ad;
-    MT_Scalar     b2, bc, bd;
-    MT_Scalar         c2, cd;
-    MT_Scalar             d2;
-
-    void init(MT_Scalar a, MT_Scalar b, MT_Scalar c, MT_Scalar d);
-
-public:
-
-    LOD_Quadric(
-	) {
-		Clear();
-	};
-
-    LOD_Quadric(
-		const MT_Vector3 & vec,
-		const MT_Scalar & offset
-	) {
-		a2 = vec[0] *vec[0];
-		b2 = vec[1] *vec[1];
-		c2 = vec[2] *vec[2];
-
-		ab = vec[0]*vec[1];
-		ac = vec[0]*vec[2];
-		bc = vec[1]*vec[2];
-
-		MT_Vector3 temp = vec*offset;
-		ad = temp[0];
-		bd = temp[1];
-		cd = temp[2];
-
-		d2 = offset*offset;
-	};
-
-		MT_Matrix3x3 
-	Tensor(
-	) const {
-		// return a symmetric matrix 
-
-		return MT_Matrix3x3(
-			a2,ab,ac,
-			ab,b2,bc,
-			ac,bc,c2
-		);
-	};
-
-
-		MT_Vector3
-	Vector(
-	) const {
-		return MT_Vector3(ad, bd, cd);
-	};
-
-		void 
-	Clear(
-		MT_Scalar val=0.0
-	) {
-		a2=ab=ac=ad=b2=bc=bd=c2=cd=d2=val;
-	};
-
-		LOD_Quadric & 
-	operator=(
-		const LOD_Quadric& Q
-	) {
-
-		a2 = Q.a2;  ab = Q.ab;  ac = Q.ac;  ad = Q.ad;
-					b2 = Q.b2;  bc = Q.bc;  bd = Q.bd;
-								c2 = Q.c2;  cd = Q.cd;  
-											d2 = Q.d2;
-		return *this;
-	};
-		
-		LOD_Quadric& 
-	operator+=(
-		const LOD_Quadric& Q
-	) {
-		a2 += Q.a2; ab += Q.ab;  ac += Q.ac;  ad += Q.ad;
-					b2 += Q.b2;  bc += Q.bc;  bd += Q.bd;
-								 c2 += Q.c2;  cd += Q.cd;  
-											  d2 += Q.d2;
-		return *this;
-	};
-
-		LOD_Quadric& 
-	operator*=(
-		const MT_Scalar & s
-	) {
-		a2 *= s; ab *= s;  ac *= s;  ad *= s;
-					b2 *= s;  bc *= s;  bd *= s;
-								 c2 *= s;  cd *= s;  
-											  d2 *= s;
-		return *this;
-	};
-
-
-		MT_Scalar 
-	Evaluate(
-		const MT_Vector3 &v
-	) const {
-		// compute the LOD_Quadric error
-
-		return v[0]*v[0]*a2 + 2*v[0]*v[1]*ab + 2*v[0]*v[2]*ac + 2*v[0]*ad
-	          +v[1]*v[1]*b2 + 2*v[1]*v[2]*bc + 2*v[1]*bd
-	          +v[2]*v[2]*c2   + 2*v[2]*cd
-	          + d2;
-	};
-		
-		bool 
-	Optimize(
-		MT_Vector3& v
-	) const {
-		
-		MT_Scalar det = Tensor().determinant();
-		if (MT_fuzzyZero(det)) {
-			return false;
-		}
-		
-		v = -((Tensor().inverse()) * Vector());
-		return true;
-	}; 
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_QuadricEditor.cpp b/intern/decimation/intern/LOD_QuadricEditor.cpp
deleted file mode 100644
index fbaf0c1..0000000
--- a/intern/decimation/intern/LOD_QuadricEditor.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QuadricEditor.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_QuadricEditor.h"
-#include "LOD_ExternNormalEditor.h"
-
-// Creation
-///////////
-
-using namespace std;
-
-
-LOD_QuadricEditor::
-LOD_QuadricEditor(
-	LOD_ManMesh2 &mesh
-) :
-	m_quadrics(NULL),
-	m_mesh(mesh)
-{
-};
-
-	LOD_QuadricEditor *
-LOD_QuadricEditor::
-New(
-	LOD_ManMesh2 &mesh
-){
-	//same number of quadrics as vertices in the mesh
-
-	MEM_SmartPtr<LOD_QuadricEditor> output(new LOD_QuadricEditor(mesh));
-
-	if (output == NULL) {
-		return NULL;
-	}
-	return output.Release();
-}
-
-
-// Property editor interface
-////////////////////////////
-
-	void
-LOD_QuadricEditor::
-Remove(
-	std::vector<LOD_VertexInd> &sorted_vertices
-){
-	vector<LOD_Quadric> & quadrics = *m_quadrics;
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_vertices.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_vertices.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (quadrics.size() > 0) {
-			LOD_Quadric temp = quadrics[*it_start];
-		
-			quadrics[*it_start] = quadrics.back();
-			quadrics.back() = temp;
-
-			quadrics.pop_back();
-		}
-	}
-};
-
-
-// Editor specific methods
-//////////////////////////
-
-	bool
-LOD_QuadricEditor::
-BuildQuadrics(
-	LOD_ExternNormalEditor& normal_editor,
-	bool preserve_boundaries
-){
-	if (m_quadrics != NULL) delete(m_quadrics);		
-
-	m_quadrics =new vector<LOD_Quadric> (m_mesh.VertexSet().size());
-	if (m_quadrics == NULL) return false;
-
-	// iterate through the face set of the mesh
-	// compute a quadric based upon that face and 
-	// add it to each of it's vertices quadrics.
-
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-	const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-	vector<LOD_Edge> &edges = m_mesh.EdgeSet();	
-
-	const vector<MT_Vector3> &normals = normal_editor.Normals();
-	vector<MT_Vector3>::const_iterator normal_it = normals.begin();
-	
-	vector<LOD_TriFace>::const_iterator face_it = faces.begin();
-	vector<LOD_TriFace>::const_iterator face_end = faces.end();
-
-	vector<LOD_Quadric> & quadrics = *m_quadrics;
-
-
-	for (; face_it != face_end; ++face_it, ++normal_it) {
-				
-		MT_Vector3 normal = *normal_it;
-		MT_Scalar offset = -normal.dot(verts[face_it->m_verts[0]].pos);	
-
-		LOD_Quadric q(normal,offset);
-
-		quadrics[face_it->m_verts[0]] += q;
-		quadrics[face_it->m_verts[1]] += q;
-		quadrics[face_it->m_verts[2]] += q;
-	}
-
-	if (preserve_boundaries) {
-
-		// iterate through the edge set and add a boundary quadric to 
-		// each of the boundary edges vertices.
-	
-		vector<LOD_Edge>::const_iterator edge_it = edges.begin();
-		vector<LOD_Edge>::const_iterator edge_end = edges.end();	
-
-		for (; edge_it != edge_end; ++edge_it) {
-			if (edge_it->BoundaryEdge()) {
-
-				// compute a plane perpendicular to the edge and the normal
-				// of the edges single polygon.
-				const MT_Vector3 & v0 = verts[edge_it->m_verts[0]].pos;
-				const MT_Vector3 & v1 = verts[edge_it->m_verts[1]].pos;
-	
-				MT_Vector3 edge_vector = v1 - v0;
-
-				LOD_FaceInd edge_face = edge_it->OpFace(LOD_EdgeInd::Empty());
-				edge_vector = edge_vector.cross(normals[edge_face]);
-
-				if (!edge_vector.fuzzyZero()) {
-					edge_vector.normalize();
-				
-					LOD_Quadric boundary_q(edge_vector, - edge_vector.dot(v0));	
-					boundary_q *= 100;				
-
-					quadrics[edge_it->m_verts[0]] += boundary_q;
-					quadrics[edge_it->m_verts[1]] += boundary_q;
-				}
-			}
-		}
-	}
-
-
-	// initiate the heap keys of the edges by computing the edge costs.
-
-	vector<LOD_Edge>::iterator edge_it = edges.begin();
-	vector<LOD_Edge>::const_iterator edge_end = edges.end();
-
-	for (; edge_it != edge_end; ++edge_it) {
-		
-		MT_Vector3 target = TargetVertex(*edge_it);
-
-		LOD_Edge &e = *edge_it;
-		LOD_Quadric q0 = quadrics[e.m_verts[0]];
-		const LOD_Quadric &q1 = quadrics[e.m_verts[1]];
-		
-		e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
-	}
-
-	return true;
-
-};
-
-	MT_Vector3 
-LOD_QuadricEditor::
-TargetVertex(
-	LOD_Edge & e
-){
-
-	// compute an edge contration target for edge ei
-	// this is computed by summing it's vertices quadrics and 
-	// optimizing the result.
-	vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
-	vector<LOD_Quadric> &quadrics = *m_quadrics;
-
-	LOD_VertexInd v0 = e.m_verts[0];
-	LOD_VertexInd v1 = e.m_verts[1];
-
-	LOD_Quadric q0 = quadrics[v0];
-	q0 += quadrics[v1];
-
-	MT_Vector3 result;
-
-	if (q0.Optimize(result)) {
-		return result;
-	} else {
-		// the quadric was degenerate -> just take the average of 
-		// v0 and v1
-
-		return ((verts[v0].pos + verts[v1].pos) * 0.5);
-	}
-};
-
-	void
-LOD_QuadricEditor::
-ComputeEdgeCosts(
-	vector<LOD_EdgeInd> &edges
-){ 	
-	
-	// for each we compute the target vertex and then compute
-	// the quadric error e = Q1(v') + Q2(v')
-	vector<LOD_Edge> &edge_set = m_mesh.EdgeSet();
-
-	vector<LOD_Quadric> &quadrics = *m_quadrics;
-
-	vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = edges.end();
-
-	for (; edge_it != edge_end; ++edge_it) {
-		
-		MT_Vector3 target = TargetVertex(edge_set[*edge_it]);
-
-		LOD_Edge &e = edge_set[*edge_it];
-		LOD_Quadric q0 = quadrics[e.m_verts[0]];
-		const LOD_Quadric &q1 = quadrics[e.m_verts[1]];
-		
-		e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
-	}
-};
-	
-		
-
-
-		
-
-
-
-
-
-	
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_QuadricEditor.h b/intern/decimation/intern/LOD_QuadricEditor.h
deleted file mode 100644
index 0a66d29..0000000
--- a/intern/decimation/intern/LOD_QuadricEditor.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QuadricEditor.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_QUADRICEDITOR_H__
-#define __LOD_QUADRICEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "LOD_Quadric.h"
-
-class LOD_ExternNormalEditor;
-
-
-class LOD_QuadricEditor : public MEM_NonCopyable
-{
-
-public : 
-
-	// Creation
-	///////////
-
-	static
-		LOD_QuadricEditor *
-	New(
-		LOD_ManMesh2 &mesh
-	); 
-
-	// Property editor interface
-	////////////////////////////
-
-		void
-	Remove(
-		std::vector<LOD_VertexInd> &sorted_vertices
-	);
-
-		void
-	Update(
-		std::vector<LOD_FaceInd> &sorted_vertices
-	);
-
-
-		std::vector<LOD_Quadric> &
-	Quadrics(
-	) const {
-		return *m_quadrics;
-	};
-
-
-	// Editor specific methods
-	//////////////////////////
-
-		bool
-	BuildQuadrics(
-		LOD_ExternNormalEditor& normal_editor,
-		bool preserve_boundaries
-	);	
-
-
-		void
-	ComputeEdgeCosts(
-		std::vector<LOD_EdgeInd> &edges
-	); 	
-
-		MT_Vector3 
-	TargetVertex(
-		LOD_Edge &e
-	);
-
-	~LOD_QuadricEditor(
-	 ){
-		delete(m_quadrics);
-	};
-
-		
-private :
-
-	std::vector<LOD_Quadric> * m_quadrics;
-
-	LOD_ManMesh2 &m_mesh;
-
-private :
-	
-	LOD_QuadricEditor(LOD_ManMesh2 &mesh);
-
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_decimation.cpp b/intern/decimation/intern/LOD_decimation.cpp
deleted file mode 100644
index 4903393..0000000
--- a/intern/decimation/intern/LOD_decimation.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_decimation.cpp
- *  \ingroup decimation
- */
-
-
-// implementation of external c api
-#include "../extern/LOD_decimation.h"
-#include "LOD_DecimationClass.h"
-
-using namespace std;
-
-	int 
-LOD_LoadMesh(
-	LOD_Decimation_InfoPtr info
-) {
-	if (info == NULL) return 0;
-	if (
-		info->vertex_buffer == NULL ||
-		info->vertex_normal_buffer == NULL ||
-		info->triangle_index_buffer == NULL
-	) {
-		return 0;
-	}
-
-
-	// create the intern object to hold all 
-	// the decimation classes
-
-	MEM_SmartPtr<LOD_DecimationClass> intern(LOD_DecimationClass::New(info));
-
-	if (intern == NULL) return 0;
-
-	MEM_SmartPtr<vector<LOD_Vertex> > intern_vertex_buffer(new vector<LOD_Vertex>(info->vertex_num));
-	if (intern_vertex_buffer == NULL) return 0;
-
-	vector<LOD_Vertex>::iterator intern_vertex_it(intern_vertex_buffer->begin());
-
-	// now load in the vertices to the mesh
-
-	const int vertex_stride = 3;
-
-	float * vertex_ptr = info->vertex_buffer;
-	const float * vertex_end = vertex_ptr + info->vertex_num*vertex_stride;
-	
-	LOD_ManMesh2 &mesh = intern->Mesh();
-
-	for (;vertex_ptr < vertex_end; vertex_ptr += vertex_stride,++intern_vertex_it) {
-		intern_vertex_it->pos = MT_Vector3(vertex_ptr);
-	}
-	
-	mesh.SetVertices(intern_vertex_buffer);
-
-	// load in the triangles
-	
-	const int triangle_stride = 3;
-
-	int * triangle_ptr = info->triangle_index_buffer;
-	const int * triangle_end = triangle_ptr + info->face_num*triangle_stride;
-
-	try {
-
-		for (;triangle_ptr < triangle_end; triangle_ptr += triangle_stride) {
-			mesh.AddTriangle(triangle_ptr);
-		}
-	}
-
-	catch (...) {
-		return 0;
-	}
-
-	// ok we have built the mesh 
-
-	intern->m_e_decimation_state = LOD_DecimationClass::e_loaded;
-
-	info->intern = (void *) (intern.Release());	
-
-	return 1;
-}
-
-	int 
-LOD_PreprocessMesh(
-	LOD_Decimation_InfoPtr info
-) {
-	if (info == NULL) return 0;
-	if (info->intern == NULL) return 0;
-
-	LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
-	if (intern->m_e_decimation_state != LOD_DecimationClass::e_loaded) return 0;	
-
-	// arm the various internal classes so that we are ready to step
-	// through decimation
-
-	intern->FaceEditor().BuildNormals();
-	if (intern->Decimator().Arm() == false) return 0;
-
-	// ok preprocessing done 
-	intern->m_e_decimation_state = LOD_DecimationClass::e_preprocessed;
-
-	return 1;
-}
-
-	int 
-LOD_CollapseEdge(
-	LOD_Decimation_InfoPtr info
-){
-	if (info == NULL) return 0;
-	if (info->intern == NULL) return 0;
-	LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
-	if (intern->m_e_decimation_state != LOD_DecimationClass::e_preprocessed) return 0;	
-
-	bool step_result = intern->Decimator().Step();
-
-	return step_result == true ? 1 : 0;
-}	
-
-	
-	int
-LOD_FreeDecimationData(
-	LOD_Decimation_InfoPtr info
-){
-	if (info == NULL) return 0;
-	if (info->intern == NULL) return 0;
-	LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
-	delete(intern);
-	info->intern = NULL;
-	return 1;
-}
-
diff --git a/intern/decimation/intern/future/LOD_ExternVColorEditor.cpp b/intern/decimation/intern/future/LOD_ExternVColorEditor.cpp
deleted file mode 100644
index 9bcf234..0000000
--- a/intern/decimation/intern/future/LOD_ExternVColorEditor.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_ExternVColorEditor.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_ExternVColorEditor.h"
-
-#include <vector>
-
-using namespace std;
-
-
-LOD_ExternVColorEditor::
-LOD_ExternVColorEditor(
-	LOD_Decimation_InfoPtr extern_info
-) :
-	m_extern_info (extern_info)
-{
-}
-
-	LOD_ExternVColorEditor *
-LOD_ExternVColorEditor::
-New(
-	LOD_Decimation_InfoPtr extern_info
-){
-	if (extern_info == NULL) return NULL;
-	
-	NanPtr<LOD_ExternVColorEditor> output(new LOD_ExternVColorEditor(extern_info));
-
-	return output.Release();
-};
-	
-
-// vertex normals
-/////////////////
-
-	void
-LOD_ExternVColorEditor::
-RemoveVertexColors(
-	const vector<LOD_VertexInd> &sorted_verts
-){
-
-	float * vertex_colors = m_extern_info->vertex_color_buffer;
-
-	// assumption here that the vertexs normal number corresponds with 
-	// the number of vertices !
-
-	int vertex_color_num = m_extern_info->vertex_num; 
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (vertex_color_num > 0) {
-
-			float * vertex_color = vertex_colors + int(*it_start)*3;
-			float * last_color = vertex_colors + ((vertex_color_num-1)*3);
-
-			MT_Vector3 last_c(last_color);
-			last_c.getValue(vertex_color);
-
-			vertex_color_num--;
-		}
-
-		// FIXME - throw exception
-	}
-};
-
-// Return the color for vertex v
-
-	MT_Vector3
-LOD_ExternVColorEditor::
-IndexColor(
-	const LOD_VertexInd &v
-) const {
-	return MT_Vector3(m_extern_info->vertex_color_buffer + int(v)*3);
-}
-
-
-// Set the color for vertex v
-
-	void
-LOD_ExternVColorEditor::
-SetColor(
-	MT_Vector3 c,
-	const LOD_VertexInd &v
-) {
-	c.getValue(m_extern_info->vertex_color_buffer + int(v)*3);
-}
-
-
-
-
-
diff --git a/intern/decimation/intern/future/LOD_ExternVColorEditor.h b/intern/decimation/intern/future/LOD_ExternVColorEditor.h
deleted file mode 100644
index e409e0d..0000000
--- a/intern/decimation/intern/future/LOD_ExternVColorEditor.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_ExternVColorEditor.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_EXTERNVCOLOREDITOR_H__
-#define __LOD_EXTERNVCOLOREDITOR_H__
-
-#include "common/NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "../extern/LOD_decimation.h"
-
-class LOD_ExternVColorEditor : public NonCopyable
-{
-
-public : 
-
-	// Creation
-	///////////
-
-	static
-		LOD_ExternVColorEditor *
-	New(
-		LOD_Decimation_InfoPtr
-	); 	
-
-	// vertex colors
-	/////////////////
-
-		void
-	RemoveVertexColors(
-		const std::vector<LOD_VertexInd> &sorted_verts
-	);
-
-	// Return the color for vertex v
-
-		MT_Vector3
-	IndexColor(
-		const LOD_VertexInd &v
-	) const;
-
-	// Set the color for vertex v
-
-		void
-	SetColor(
-		MT_Vector3 c,
-		const LOD_VertexInd &v
-	);
-		
-
-private :
-
-	LOD_Decimation_InfoPtr m_extern_info;
-
-private :
-	
-		
-	LOD_ExternVColorEditor(
-		LOD_Decimation_InfoPtr extern_info
-	);
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/future/LOD_NdQSDecimator.cpp b/intern/decimation/intern/future/LOD_NdQSDecimator.cpp
deleted file mode 100644
index 3541f10..0000000
--- a/intern/decimation/intern/future/LOD_NdQSDecimator.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQSDecimator.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_NdQSDecimator.h"
-
-#include "LOD_ExternBufferEditor.h"
-#include "LOD_ExternNormalEditor.h"
-#include "LOD_ExternVColorEditor.h"
-#include "TNT/lu.h"
-
-#include <iostream>
-
-using namespace std;
-
-	LOD_NdQSDecimator *
-LOD_NdQSDecimator::
-New(
-	LOD_ManMesh2 &mesh,
-	LOD_ExternNormalEditor &face_editor,
-	LOD_ExternVColorEditor &color_editor,
-	LOD_ExternBufferEditor &extern_editor
-){
-
-	NanPtr<LOD_NdQSDecimator> output 
-		= new LOD_NdQSDecimator(mesh,face_editor,color_editor,extern_editor);
-
-	NanPtr<LOD_EdgeCollapser > collapser(LOD_EdgeCollapser::New());
-	NanPtr<LOD_NdQuadricEditor> q_editor(LOD_NdQuadricEditor::New(mesh));
-
-	if (
-		output == NULL ||
-		collapser == NULL ||
-		q_editor == NULL 
-	) {
-		return NULL;
-	}
-	output->m_collapser = collapser.Release();
-	output->m_quadric_editor = q_editor.Release();
-	return output.Release();
-}	
-
-
-
-	bool
-LOD_NdQSDecimator::
-Arm(
-){
-	MT_assert(!m_is_armed);
-	bool heap_result = BuildHeap();
-	if (!heap_result) {
-		return false;
-	}
-	m_is_armed = true;
-	return true;
-}
-	
-	bool
-LOD_NdQSDecimator::
-Step(
-){
-	return CollapseEdge();
-}
-
-
-LOD_NdQSDecimator::
-LOD_NdQSDecimator(
-	LOD_ManMesh2 &mesh,
-	LOD_ExternNormalEditor &face_editor,
-	LOD_ExternVColorEditor &color_editor,
-	LOD_ExternBufferEditor &extern_editor
-) :
-	m_mesh(mesh),
-	m_face_editor(face_editor),
-	m_color_editor(color_editor),
-	m_extern_editor(extern_editor),
-	m_is_armed (false)
-{	
-	m_deg_edges.reserve(32);
-	m_deg_faces.reserve(32);
-	m_deg_vertices.reserve(32);
-	m_update_faces.reserve(32);
-	m_new_edges.reserve(32);
-	m_update_vertices.reserve(32);
-};
-
-	bool
-LOD_NdQSDecimator::
-CollapseEdge(
-){
-	
-	// find an edge to collapse
-	
-	// FIXME force an edge collapse
-	// or return false
-
-	vector<LOD_Edge> & edges = m_mesh.EdgeSet();
-	vector<LOD_Vertex> & verts = m_mesh.VertexSet();
-	vector<LOD_NdQuadric> & quadrics = m_quadric_editor->Quadrics();
-	int size = edges.size();
-
-	if (size == 0) return false;
-
-	const int heap_top = m_heap->Top();
-
-	if (heap_top == -1 || edges[heap_top].HeapKey() <= -MT_INFINITY) {
-		return false;
-	}
-	
-	// compute the target position
-
-	TNT::Vector<MT_Scalar> new_vector(6,MT_Scalar(0)); 
-
-	m_quadric_editor->TargetVertex(edges[heap_top],new_vector,m_color_editor);
-
-
-	MT_Vector3 new_vertex(
-		new_vector[0],
-		new_vector[1],
-		new_vector[2]
-	);
-	for (int i = 3; i < 6;i++) {
-		if (new_vector[i] > MT_Scalar(1)) {
-			new_vector[i] = MT_Scalar(1);
-		} else 
-		if (new_vector[i] < MT_Scalar(0)) {
-			new_vector[i] = MT_Scalar(0);
-		}
-	}
-	MT_Vector3 new_color(
-		new_vector[3],
-		new_vector[4],
-		new_vector[5]
-	);
-
-	// bounds check?
-
-		
-	LOD_NdQuadric & q0 = quadrics[edges[heap_top].m_verts[0]];
-	LOD_NdQuadric & q1 = quadrics[edges[heap_top].m_verts[1]];
-
-	const LOD_VertexInd v0ind = edges[heap_top].m_verts[0];
-	const LOD_VertexInd v1ind = edges[heap_top].m_verts[1];
-
-	LOD_Vertex &v0 = verts[v0ind];
-	LOD_Vertex &v1 = verts[v1ind];
-
-	LOD_NdQuadric sum = q0;
-	sum += q1;
-
-
-	if (m_collapser->CollapseEdge(
-			heap_top,
-			m_mesh,
-			m_deg_edges,
-			m_deg_faces,
-			m_deg_vertices,
-			m_new_edges,
-			m_update_faces,
-			m_update_vertices
-	)) {
-
-		// assign new vertex position
-
-		v0.pos = new_vertex;
-		v1.pos = new_vertex;
-
-		// assign the new vertex color
-			
-		m_color_editor.SetColor(new_color,v0ind);
-		m_color_editor.SetColor(new_color,v1ind);
-
-		// sum the quadrics of v0 and v1
-		q0 = sum;
-		q1 = sum;
-
-		// ok update the primitive properties
-
-		m_face_editor.Update(m_update_faces);	
-		m_face_editor.UpdateVertexNormals(m_update_vertices);
-
-		// update the external vertex buffer 
-		m_extern_editor.CopyModifiedVerts(m_mesh,m_update_vertices);
-
-		// update the external face buffer
-		m_extern_editor.CopyModifiedFaces(m_mesh,m_update_faces);
-
-		// update the edge heap
-		UpdateHeap(m_deg_edges,m_new_edges);
-
-		m_quadric_editor->Remove(m_deg_vertices);
-		m_face_editor.Remove(m_deg_faces);
-		m_face_editor.RemoveVertexNormals(m_deg_vertices);		
-		m_color_editor.RemoveVertexColors(m_deg_vertices);
-				
-		// delete the primitives
-
-		DeletePrimitives(m_deg_edges,m_deg_faces,m_deg_vertices);
-
-	} else {
-		// the edge could not be collapsed at the moment - so
-		// we adjust it's priority and add it back to the heap.
-		m_heap->Remove(edges.begin(),0);
-		edges[heap_top].HeapKey() = - MT_INFINITY;
-		m_heap->Insert(edges.begin(),heap_top);
-	}
-
-	//clear all the temporary buffers
-
-	m_deg_faces.clear();
-	m_deg_edges.clear();
-	m_deg_vertices.clear();
-	
-	m_update_faces.clear();
-	m_update_vertices.clear();
-	m_new_edges.clear();
-
-	return true;
-
-}	
-
-	void
-LOD_NdQSDecimator::
-DeletePrimitives(
-	const vector<LOD_EdgeInd> & degenerate_edges,
-	const vector<LOD_FaceInd> & degenerate_faces,
-	const vector<LOD_VertexInd> & degenerate_vertices
-) {
-
-	// assumes that the 3 vectors are sorted in descending order.
-
-	// Delete Degnerate primitives
-	//////////////////////////////
-
-
-	// delete the old edges - we have to be very careful here
-	// mesh.delete() swaps edges to be deleted with the last edge in 
-	// the edge buffer. However the next edge to be deleted may have
-	// been the last edge in the buffer!
-
-	// One way to solve this is to sort degenerate_edges in descending order.
-	// And then delete them in that order.
-	
-	// it is also vital that degenerate_edges contains no duplicates
-
-	vector<LOD_EdgeInd>::const_iterator edge_it = degenerate_edges.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = degenerate_edges.end();
-
-	for (; edge_it != edge_end; ++edge_it) {
-		m_mesh.DeleteEdge(*edge_it,m_heap);
-	}
-
-
-
-	vector<LOD_FaceInd>::const_iterator face_it = degenerate_faces.begin();
-	vector<LOD_FaceInd>::const_iterator face_end = degenerate_faces.end();
-	
-	for (;face_it != face_end; ++face_it) {
-		m_mesh.DeleteFace(m_extern_editor,*face_it);
-	}
-
-	vector<LOD_VertexInd>::const_iterator vertex_it = degenerate_vertices.begin();
-	vector<LOD_VertexInd>::const_iterator vertex_end = degenerate_vertices.end();
-	
-	for (;vertex_it != vertex_end; ++vertex_it) {
-		m_mesh.DeleteVertex(m_extern_editor,*vertex_it);
-	}
-}
-
-
-	bool
-LOD_NdQSDecimator::
-BuildHeap(
-){
-	// build the geometric quadrics 
-
-	if (m_quadric_editor->BuildQuadrics(m_face_editor,true) == false) return false;
-
-	// add in the property quadrics.
-	ComputePropertyQuadrics();
-
-	m_quadric_editor->InitializeHeapKeys(m_color_editor);
-
-	m_heap = Heap<LOD_Edge>::New();
-	// load in edge pointers to the heap
-
-	vector<LOD_Edge> & edge_set= m_mesh.EdgeSet();
-	vector<LOD_Edge>::const_iterator edge_end = edge_set.end();
-	vector<LOD_Edge>::iterator edge_start = edge_set.begin();
-
-	vector<int> & heap_vector = m_heap->HeapVector();
-
-	for (int i = 0; i < edge_set.size(); ++i) {
-		edge_set[i].HeapPos() = i;
-		heap_vector.push_back(i);
-	}
-	
-	m_heap->MakeHeap(edge_set.begin());
-
-	return true;
-}
-
-	void
-LOD_NdQSDecimator::
-UpdateHeap(
-	vector<LOD_EdgeInd> &deg_edges,
-	vector<LOD_EdgeInd> &new_edges
-){
-	// first of all compute values for the new edges 
-	// and bung them on the heap.
-
-	vector<LOD_Edge>  & edge_set= m_mesh.EdgeSet();
-
-	vector<LOD_EdgeInd>::const_iterator edge_it = new_edges.begin();
-	vector<LOD_EdgeInd>::const_iterator end_it = new_edges.end();
-
-
-	// insert all the new edges		
-	///////////////////////////
-
-	// compute edge costs ffor the new edges
-
-	m_quadric_editor->ComputeEdgeCosts(new_edges,m_color_editor);
-
-	// inser the new elements into the heap
-
-	for (; edge_it != end_it; ++edge_it) {		
-		m_heap->Insert(edge_set.begin(),*edge_it);
-	}
-
-
-	// remove all the old values from the heap
-
-	edge_it = deg_edges.begin();
-	end_it = deg_edges.end();
-
-	for (; edge_it != end_it; ++edge_it) {
-		LOD_Edge &e = edge_set[*edge_it];
-		m_heap->Remove(edge_set.begin(),e.HeapPos());
-
-		e.HeapPos() = 0xffffffff;
-
-	}
-}
-	
-	void
-LOD_NdQSDecimator::
-ComputePropertyQuadrics(
-){
-
-	vector<LOD_TriFace> & faces = m_mesh.FaceSet();
-	vector<LOD_Vertex> & verts = m_mesh.VertexSet();
-	vector<LOD_NdQuadric> & quadrics = m_quadric_editor->Quadrics();
-	const vector<MT_Vector3> &face_normals = m_face_editor.Normals();
-
-	// compute the linear functionals for each face
-
-	// For each property associated with that face we compute
-	// a property gradient, construct a quadric based on this and add
-	// it to each of the face's vertex quadrics.
-
-	vector<LOD_TriFace>::const_iterator f_start = faces.begin();
-	vector<LOD_TriFace>::const_iterator f_end = faces.end();
-	vector<LOD_TriFace>::iterator f = faces.begin();
-
-	// we need a little matrix space to help us with the
-	// linear functional computation.
-
-	TNT::Matrix<MT_Scalar> mat(4,4,MT_Scalar(0));
-	TNT::Vector<MT_Scalar> vec(4,MT_Scalar(1));
-
-	// some pivots.
-
-	TNT::Vector<TNT::Subscript> pivots(4,int(0));
-
-	// Quadrics now consume heap memory so let's
-	// reuse one in the following loop rather than 
-	// making one each iteration.
-
-	LOD_NdQuadric qp;
-
-
-	for (;f != f_end; ++f) {
-		
-		// collect the coordinates of the face
-		// and the normal into a matrix
-	
-		const LOD_VertexInd * f_verts= f->m_verts;
-
-		const MT_Vector3 & p0 = verts[f_verts[0]].pos;
-		const MT_Vector3 & p1 = verts[f_verts[1]].pos;
-		const MT_Vector3 & p2 = verts[f_verts[2]].pos;
-	
-		const MT_Vector3 c0 = m_color_editor.IndexColor(f_verts[0]);
-		const MT_Vector3 c1 = m_color_editor.IndexColor(f_verts[1]);
-		const MT_Vector3 c2 = m_color_editor.IndexColor(f_verts[2]);
-
-		// get the face normal	
-
-		const MT_Vector3 & fn = face_normals[int(f - f_start)];
-
-		// load into mat
-
-		int i;
-		for (i = 0; i < 3; i++) {
-			mat[0][i] = p0[i];
-			mat[1][i] = p1[i];
-			mat[2][i] = p2[i];
-			mat[3][i] = fn[i];
-		}
-		mat[0][3] = MT_Scalar(1);
-		mat[1][3] = MT_Scalar(1);
-		mat[2][3] = MT_Scalar(1);
-		mat[3][3] = MT_Scalar(0);
-
-		// Compute the pivots
-
-		if (TNT::LU_factor(mat,pivots)) {
-			// bad face!
-			continue;
-		}	
-
-		// compute red linear functional
-
-		vec[0] = c0[0];				
-		vec[1] = c1[0];
-		vec[2] = c2[0];
-		vec[3] = MT_Scalar(0);
-
-		TNT::LU_solve(mat,pivots,vec);
-
-		// construct a quadric based on this functional
-
-		qp = LOD_NdQuadric(
-			MT_Vector3(vec[0],vec[1],vec[2]),
-			vec[3],
-			0
-		);			
-		// compute green functional
-
-		vec[0] = c0[1];				
-		vec[1] = c1[1];
-		vec[2] = c2[1];
-		vec[3] = MT_Scalar(0);
-
-		TNT::LU_solve(mat,pivots,vec);
-
-		// construct a quadric based on this functional
-
-		qp += LOD_NdQuadric(
-			MT_Vector3(vec[0],vec[1],vec[2]),
-			vec[3],
-			1
-		);			
-		
-		// compute blue functional
-
-		vec[0] = c0[2];				
-		vec[1] = c1[2];
-		vec[2] = c2[2];
-		vec[3] = MT_Scalar(0);
-
-		TNT::LU_solve(mat,pivots,vec);
-
-		// construct a quadric based on this functional
-
-		qp += LOD_NdQuadric(
-			MT_Vector3(vec[0],vec[1],vec[2]),
-			vec[3],
-			2
-		);			
-	
-		// add to the geometric quadrics of each of the 
-		// vertices of f
-		
-		qp *= MT_Scalar(50);	
-
-
-		quadrics[f_verts[0]] += qp;
-		quadrics[f_verts[1]] += qp;
-		quadrics[f_verts[2]] += qp;
-	
-		qp.Clear();
-
-	}
-}
-
-
-
diff --git a/intern/decimation/intern/future/LOD_NdQSDecimator.h b/intern/decimation/intern/future/LOD_NdQSDecimator.h
deleted file mode 100644
index e7defac..0000000
--- a/intern/decimation/intern/future/LOD_NdQSDecimator.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQSDecimator.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_NDQSDECIMATOR_H__
-#define __LOD_NDQSDECIMATOR_H__
-
-#include "common/NonCopyable.h"
-#include "LOD_ManMesh2.h"
-
-#include "LOD_EdgeCollapser.h"
-#include "LOD_NdQuadricEditor.h"
-
-class LOD_ExternBufferEditor;
-class LOD_ExternVColorEditor;
-class LOD_ExternNormalEditor;
-
-class LOD_NdQSDecimator : public NonCopyable {
-
-public :
-
-	static
-		LOD_NdQSDecimator *
-	New(
-		LOD_ManMesh2 &mesh,
-		LOD_ExternNormalEditor &face_editor,
-		LOD_ExternVColorEditor &color_editor,
-		LOD_ExternBufferEditor &extern_editor
-	);
-
-
-		bool
-	Arm(
-	);
-
-
-		bool
-	Step(
-	);
-
-private :
-
-	LOD_NdQSDecimator(
-		LOD_ManMesh2 &mesh,
-		LOD_ExternNormalEditor &face_editor,
-		LOD_ExternVColorEditor &color_editor,
-		LOD_ExternBufferEditor &extern_editor
-	);
-
-		bool
-	CollapseEdge(
-	);
-
-		bool
-	BuildHeap(
-	);
-
-		void
-	UpdateHeap(
-		std::vector<LOD_EdgeInd> &deg_edges,
-		std::vector<LOD_EdgeInd> &new_edges
-	);	
-
-		void
-	DeletePrimitives(
-		const std::vector<LOD_EdgeInd> & degenerate_edges,
-		const std::vector<LOD_FaceInd> & degenerate_faces,
-		const std::vector<LOD_VertexInd> & degenerate_vertices
-	);
-
-	// Iterate through the face set 
-	// for each property of the face vertices 
-	// compute a quadric for that property.
-	// Add it to the quadric array.	
-	
-		void
-	ComputePropertyQuadrics(
-	);
-
-
-private :	
-
-		
-	// owned by this class
-	//////////////////////
-
-	NanPtr<LOD_EdgeCollapser> m_collapser;
-	NanPtr<Heap<LOD_Edge> > m_heap;
-	NanPtr<LOD_NdQuadricEditor> m_quadric_editor;
-
-	bool m_is_armed;
-
-	// arguments to New(...)
-	////////////////////////
-
-	LOD_ManMesh2 & m_mesh;
-	LOD_ExternNormalEditor & m_face_editor;
-	LOD_ExternBufferEditor & m_extern_editor;
-	LOD_ExternVColorEditor & m_color_editor;	
-
-	// temporary buffers
-	////////////////////
-
-	std::vector<LOD_FaceInd> m_deg_faces;
-	std::vector<LOD_EdgeInd> m_deg_edges;
-	std::vector<LOD_VertexInd> m_deg_vertices;
-
-	std::vector<LOD_FaceInd> m_update_faces;
-	std::vector<LOD_EdgeInd> m_new_edges;
-	std::vector<LOD_VertexInd> m_update_vertices;
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/future/LOD_NdQuadric.cpp b/intern/decimation/intern/future/LOD_NdQuadric.cpp
deleted file mode 100644
index e21408d..0000000
--- a/intern/decimation/intern/future/LOD_NdQuadric.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQuadric.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_NdQuadric.h"
-
-#include <iostream>
-
-// for Lower Upper decompostion code.
-#include "TNT/lu.h"
-
-//soon to be template parameter.
-#define MAT_SIZE 3
-
-LOD_NdQuadric::
-LOD_NdQuadric(
-	const MT_Vector3 & vec,
-	const MT_Scalar & offset
-):
-	m_q(vec,offset),
-	m_prop_grad1(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad2(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad3(int(MAT_SIZE),MT_Scalar(0)),
-	m_bbottom(int(MAT_SIZE),MT_Scalar(0)),
-	m_diag (int(MAT_SIZE),MT_Scalar(0))
-{
-	// nothing to do
-}
-// Initialize a quadric from a linear functional describing
-// the property gradient.pos is the position where this
-// functional is placed in the array.
-
-LOD_NdQuadric::
-LOD_NdQuadric(
-	const MT_Vector3 & vec,
-	const MT_Scalar & offset,
-	int pos
-):
-	m_q(vec,offset),
-	m_prop_grad1(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad2(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad3(int(MAT_SIZE),MT_Scalar(0)),
-	m_bbottom(int(MAT_SIZE),MT_Scalar(0)),
-	m_diag (int(MAT_SIZE),MT_Scalar(0))
-{
-	m_prop_grad1[pos] = -vec[0];
-	m_prop_grad2[pos] = -vec[1];
-	m_prop_grad3[pos] = -vec[2];
-	
-	m_bbottom[pos] = -offset;
-	m_diag[pos] = MT_Scalar(1);
-}
-
-
-LOD_NdQuadric::
-LOD_NdQuadric(
-):
-	m_prop_grad1(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad2(int(MAT_SIZE),MT_Scalar(0)),
-	m_prop_grad3(int(MAT_SIZE),MT_Scalar(0)),
-	m_bbottom(int(MAT_SIZE),MT_Scalar(0)),
-	m_diag (int(MAT_SIZE),MT_Scalar(0)),
-	m_q()
-{
-}
-
-
-
-// This class also has the default copy constructors
-// available.
-
-	void
-LOD_NdQuadric::
-Tensor(
-	TNT::Matrix<MT_Scalar> &tensor 		
-) const {
-	
-	// Set the matrix to zero
-	tensor = 0;
-	
-	// Fill in the matrix values from d variables.
-
-	MT_Matrix3x3 tensor3x3 = m_q.Tensor();
-	int i,j;
-
-	for (j=0; j<=2; j++) {
-		for (i=0; i<=2; i++) {
-			tensor[j][i] = tensor3x3[j][i];
-		}
-	}
-
-	// now the diagonal entry.
-
-	for (i=3;i <3+MAT_SIZE;++i) {
-		tensor[i][i] = m_diag[i-3];
-	}
-
-	// now the property gradients rows and symmetrical columns
-
-	for (i=3; i < 3+MAT_SIZE; i++) {
-		tensor[0][i] = m_prop_grad1[i-3];
-		tensor[i][0] = m_prop_grad1[i-3];
-
-		tensor[1][i] = m_prop_grad2[i-3];
-		tensor[i][1] = m_prop_grad2[i-3];
-
-		tensor[2][i] = m_prop_grad3[i-3];
-		tensor[i][2] = m_prop_grad3[i-3];
-	}
-
-
-}
-		
-	void
-LOD_NdQuadric::
-Vector(
-	TNT::Vector<MT_Scalar> &vector
-) const {
-	int i;
-
-	MT_Vector3 q_vec = m_q.Vector();
-
-	vector[0] = q_vec[0];	
-	vector[1] = q_vec[1];
-	vector[2] = q_vec[2];
-
-	for (i = 3; i < 3 + MAT_SIZE; ++i) {
-		vector[i] = m_bbottom[i-3];
-	}
-}		 
-
-	void 
-LOD_NdQuadric::
-Clear(
-	MT_Scalar val
-) {
-	m_q.Clear(val);
-	m_prop_grad1 = val;
-	m_prop_grad2 = val;
-	m_prop_grad3 = val;
-	m_bbottom = val;
-	m_diag = val;
-};
-
-	LOD_NdQuadric & 
-LOD_NdQuadric::
-operator=(
-	const LOD_NdQuadric& Q
-){
-
-	m_q = Q.m_q;
-	m_prop_grad1 = Q.m_prop_grad1;
-	m_prop_grad2 = Q.m_prop_grad2;
-	m_prop_grad3 = Q.m_prop_grad3;
-	m_bbottom = Q.m_bbottom;
-	m_diag = Q.m_diag;
-
-	return (*this);
-}
-	
-	LOD_NdQuadric& 
-LOD_NdQuadric::
-operator+=(
-	const LOD_NdQuadric& Q
-){	
-	m_q += Q.m_q;
-	TNT::vectoradd(m_prop_grad1,Q.m_prop_grad1);
-	TNT::vectoradd(m_prop_grad2,Q.m_prop_grad2);
-	TNT::vectoradd(m_prop_grad3,Q.m_prop_grad3);
-	TNT::vectoradd(m_bbottom,Q.m_bbottom);
-	TNT::vectoradd(m_diag,Q.m_diag);
-
-	return (*this);
-}
-
-	LOD_NdQuadric& 
-LOD_NdQuadric::
-operator*=(
-	const MT_Scalar & s
-){
-	// multiply everything by s
-
-	m_q *= s;
-	TNT::vectorscale(m_prop_grad1,s);
-	TNT::vectorscale(m_prop_grad2,s);
-	TNT::vectorscale(m_prop_grad3,s);
-	TNT::vectorscale(m_bbottom,s);
-	TNT::vectorscale(m_diag,s);
-
-	return (*this);
-}
-
-	MT_Scalar 
-LOD_NdQuadric::
-Evaluate(
-	const TNT::Vector<MT_Scalar> & vec
-) const {
-	// compute the quadric error cost for the vector.
-
-	//FIXME very inefficient memory usage here 
-	//Way to many computations-these are symmetric!
-
-	TNT::Matrix<MT_Scalar> 	Atensor(3+MAT_SIZE,3+MAT_SIZE,MT_Scalar(0));
-	Tensor(Atensor);
-	
-	TNT::Vector<MT_Scalar>	Bvector(3+MAT_SIZE);
-	Vector(Bvector);
-
-	TNT::Vector<MT_Scalar> temp1(3+MAT_SIZE);
-
-	TNT::matmult(temp1,Atensor,vec);
-
-	return TNT::dot_prod(vec,temp1) + 2*TNT::dot_prod(Bvector,vec) + m_q.Scalar();
-} 	
-
-
-	bool 
-LOD_NdQuadric::
-Optimize(
-	TNT::Vector<MT_Scalar> & vec
-) const {
-	
-	// Return the solution to Tensor().invers() * Vector();
-	// Use lower upper decomposition --again we're creating
-	// heap memory for this function.
-	
-	TNT::Vector<TNT::Subscript> pivots(3+MAT_SIZE,0);
-	TNT::Matrix<MT_Scalar> Atensor(3+MAT_SIZE,3+MAT_SIZE,MT_Scalar(0));
-	
-	Tensor(Atensor);
-	Vector(vec);
-
-	// Find the decomposition of the matrix. If none available 
-	// matrix is singular return false.
-
-	if (TNT::LU_factor(Atensor,pivots)) {
-		return false;
-	}
-
-	if (TNT::LU_solve(Atensor,pivots,vec)) {
-		return false;
-	}
-	
-	// Now we should return -Ainv(B)!
-	
-	TNT::Vector<MT_Scalar>::iterator start = vec.begin();
-	TNT::Vector<MT_Scalar>::const_iterator end = vec.end();
-
-	while (start != end) {
-		*start = -(*start);
-		++start;
-	}
-
-#if 0
-	std::cout << vec << "\n";
-#endif
-	return true;
-};
-
-
-#undef MAT_SIZE
diff --git a/intern/decimation/intern/future/LOD_NdQuadric.h b/intern/decimation/intern/future/LOD_NdQuadric.h
deleted file mode 100644
index f9f03bb..0000000
--- a/intern/decimation/intern/future/LOD_NdQuadric.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQuadric.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_NDQUADRIC_H__
-#define __LOD_NDQUADRIC_H__
-
-// An N dimensional quadric form.
-///////////////////////////////////
-
-#include "TNT/cmat.h"
-#include "TNT/vec.h"
-#include "MT_Matrix3x3.h"
-#include "LOD_Quadric.h"
-
-
-class LOD_NdQuadric {
-
-private :
-
-	LOD_Quadric m_q;
-
-	// For space efficiency we should not use
-	// TNT matrices to hold variables in. Use
-	// fixed sized arrays based on template size
-	// and load them into the quadric only when
-	// needed for computation.
-
-	TNT::Vector<MT_Scalar> m_prop_grad1;
-	TNT::Vector<MT_Scalar> m_prop_grad2;
-	TNT::Vector<MT_Scalar> m_prop_grad3;
-	TNT::Vector<MT_Scalar> m_bbottom;
-
-	// Not essential but makes it easier to debug if keep an
-	// explicit version of the diagonal.
-#if 1
-	TNT::Vector<MT_Scalar> m_diag;
-#else
-	MT_Scalar m_diag;
-#endif
-public :
-
-	// The general idea of these 2 constructors
-	// is that first you build a quadric Qg from the
-	// geometric properties of a vertex v. Then for
-	// each of the properties i construct a property
-	// quadric Qpi. Then sum them altogether to get
-	// the final combined geomeetry and property quadric
-	// Qv = Qg + Qpi
-
-	// Initialize a quadric with a default geometric plane
-
-    LOD_NdQuadric(
-		const MT_Vector3 & vec,
-		const MT_Scalar & offset
-	); 
-
-	// Initialize a quadric from a linear functional describing
-	// the property gradient.pos is the position where this
-	// functional is placed in the array.
-
-	LOD_NdQuadric(
-		const MT_Vector3 & vec,
-		const MT_Scalar & offset,
-		int pos
-	);
-
-	// Make sure the internal vectors are of the correct size.
-
-	LOD_NdQuadric(
-	);
-
-	// This class also has the default copy constructors
-	// available.
-
-	~LOD_NdQuadric(
-	){
-		//nothing to do
-	};
-
-		void
-	Tensor(
-		TNT::Matrix<MT_Scalar> & 		
-	) const; 
-
-		void
-	Vector(
-		TNT::Vector<MT_Scalar> &
-	) const; 
-
-		void 
-	Clear(
-		MT_Scalar val=0.0
-	);
-
-		LOD_NdQuadric & 
-	operator=(
-		const LOD_NdQuadric& Q
-	); 
-		
-		LOD_NdQuadric& 
-	operator+=(
-		const LOD_NdQuadric& Q
-	);
-
-	// You can increase or decrease the relative importance
-	// of a quadric prior the summation by multiplying it
-	// with a scalar value s.
-
-		LOD_NdQuadric& 
-	operator*=(
-		const MT_Scalar & s
-	); 
-
-		MT_Scalar 
-	Evaluate(
-		const TNT::Vector<MT_Scalar> & vec
-	) const;
- 
-		bool 
-	Optimize(
-		TNT::Vector<MT_Scalar> & vec
-	) const;
-
-	
-};
-
-#endif
-
diff --git a/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp b/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp
deleted file mode 100644
index 5cacca7..0000000
--- a/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQuadricEditor.cpp
- *  \ingroup decimation
- */
-
-
-#include "LOD_NdQuadricEditor.h"
-#include "LOD_ExternNormalEditor.h"
-#include "LOD_ExternVColorEditor.h"
-
-// Creation
-///////////
-
-using namespace std;
-
-
-LOD_NdQuadricEditor::
-LOD_NdQuadricEditor(
-	LOD_ManMesh2 &mesh
-) :
-	m_quadrics(NULL),
-	m_mesh(mesh)
-{
-};
-
-	LOD_NdQuadricEditor *
-LOD_NdQuadricEditor::
-New(
-	LOD_ManMesh2 &mesh
-){
-	//same number of quadrics as vertices in the mesh
-
-	NanPtr<LOD_NdQuadricEditor> output(new LOD_NdQuadricEditor(mesh));
-
-	if (output == NULL) {
-		return NULL;
-	}
-	return output.Release();
-}
-
-
-// Property editor interface
-////////////////////////////
-
-	void
-LOD_NdQuadricEditor::
-Remove(
-	const std::vector<LOD_VertexInd> &sorted_vertices
-){
-	vector<LOD_NdQuadric> & quadrics = *m_quadrics;
-
-	vector<LOD_VertexInd>::const_iterator it_start = sorted_vertices.begin();
-	vector<LOD_VertexInd>::const_iterator it_end = sorted_vertices.end();
-
-	for (; it_start != it_end; ++it_start) {
-
-		if (quadrics.size() > 0) {
-			LOD_NdQuadric temp = quadrics[*it_start];
-		
-			quadrics[*it_start] = quadrics.back();
-			quadrics.back() = temp;
-
-			quadrics.pop_back();
-		}
-	}
-};
-
-
-// Editor specific methods
-//////////////////////////
-
-	bool
-LOD_NdQuadricEditor::
-BuildQuadrics(
-	const LOD_ExternNormalEditor& normal_editor,
-	bool preserve_boundaries
-){
-	if (m_quadrics != NULL) delete(m_quadrics);		
-
-	m_quadrics =new vector<LOD_NdQuadric> (m_mesh.VertexSet().size());
-	if (m_quadrics == NULL) return false;
-
-	// iterate through the face set of the mesh
-	// compute a quadric based upon that face and 
-	// add it to each of it's vertices quadrics.
-
-	const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-	const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-	vector<LOD_Edge> &edges = m_mesh.EdgeSet();	
-
-	const vector<MT_Vector3> &normals = normal_editor.Normals();
-	vector<MT_Vector3>::const_iterator normal_it = normals.begin();
-	
-	vector<LOD_TriFace>::const_iterator face_it = faces.begin();
-	vector<LOD_TriFace>::const_iterator face_end = faces.end();
-
-	vector<LOD_NdQuadric> & quadrics = *m_quadrics;
-
-
-	for (; face_it != face_end; ++face_it, ++normal_it) {
-				
-		MT_Vector3 normal = *normal_it;
-		MT_Scalar offset = -normal.dot(verts[face_it->m_verts[0]].pos);	
-
-		LOD_NdQuadric q(normal,offset);
-
-#if 0
-		// try something with the size of the face.
-
-		MT_Vector3 vec1 = 
-			verts[face_it->m_verts[1]].pos - 
-			verts[face_it->m_verts[0]].pos;
-
-		MT_Vector3 vec2 = 
-			verts[face_it->m_verts[2]].pos - 
-			verts[face_it->m_verts[1]].pos;
-
-		vec1 = vec1.cross(vec2);
-
-		q *= vec1.length();
-#endif
-		quadrics[face_it->m_verts[0]] += q;
-		quadrics[face_it->m_verts[1]] += q;
-		quadrics[face_it->m_verts[2]] += q;
-	}
-
-	if (preserve_boundaries) {
-
-		// iterate through the edge set and add a boundary quadric to 
-		// each of the boundary edges vertices.
-	
-		vector<LOD_Edge>::const_iterator edge_it = edges.begin();
-		vector<LOD_Edge>::const_iterator edge_end = edges.end();	
-
-		for (; edge_it != edge_end; ++edge_it) {
-			if (edge_it->BoundaryEdge()) {
-
-				// compute a plane perpendicular to the edge and the normal
-				// of the edges single polygon.
-				const MT_Vector3 & v0 = verts[edge_it->m_verts[0]].pos;
-				const MT_Vector3 & v1 = verts[edge_it->m_verts[1]].pos;
-	
-				MT_Vector3 edge_vector = v1 - v0;
-
-				LOD_FaceInd edge_face = edge_it->OpFace(LOD_EdgeInd::Empty());
-				edge_vector = edge_vector.cross(normals[edge_face]);
-
-				if (!edge_vector.fuzzyZero()) {
-					edge_vector.normalize();
-				
-					LOD_NdQuadric boundary_q(edge_vector, - edge_vector.dot(v0));	
-					boundary_q *= 100;				
-
-					quadrics[edge_it->m_verts[0]] += boundary_q;
-					quadrics[edge_it->m_verts[1]] += boundary_q;
-				}
-			}
-		}
-	}
-
-	return true;
-
-};
-
-	void
-LOD_NdQuadricEditor::
-InitializeHeapKeys(
-	const LOD_ExternVColorEditor & color_editor
-){
-	// initiate the heap keys of the edges by computing the edge costs.
-
-	vector<LOD_Edge> &edges = m_mesh.EdgeSet();	
-	vector<LOD_NdQuadric> & quadrics = *m_quadrics;
-
-	vector<LOD_Edge>::iterator edge_it = edges.begin();
-	vector<LOD_Edge>::const_iterator edge_end = edges.end();
-
-	
-	TNT::Vector<MT_Scalar> target(6,MT_Scalar(0));
-
-	for (; edge_it != edge_end; ++edge_it) {
-		
-		TargetVertex(*edge_it,target,color_editor);
-		LOD_Edge &e = *edge_it;
-		const LOD_NdQuadric &q0 = quadrics[e.m_verts[0]];
-		const LOD_NdQuadric &q1 = quadrics[e.m_verts[1]];
-
-#if 0
-		// testing print out target colors.
-		
-		std::cout << color_editor.IndexColor(e.m_verts[0]) << "\n";
-		std::cout << color_editor.IndexColor(e.m_verts[1]) << "\n";
-
-		MT_Vector3 target_color(target[3],target[4],target[5]);
-
-		std::cout << target_color << "\n\n";
-#endif
-
-		
-		e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
-	}
-}
-
-
-
-
-
-
-	void 
-LOD_NdQuadricEditor::
-TargetVertex(
-	const LOD_Edge & e,
-	TNT::Vector<MT_Scalar> &result,
-	const LOD_ExternVColorEditor & color_editor
-) const {
-
-	// compute an edge contration target for edge ei
-	// this is computed by summing it's vertices quadrics and 
-	// optimizing the result.
-	vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-	vector<LOD_NdQuadric> &quadrics = *m_quadrics;
-
-	LOD_VertexInd v0 = e.m_verts[0];
-	LOD_VertexInd v1 = e.m_verts[1];
-
-	LOD_NdQuadric q0 = quadrics[v0];
-	q0 += quadrics[v1];
-
-	if (q0.Optimize(result)) {
-		return;
-	} else {
-		// the quadric was degenerate -> just take the average of 
-		// v0 and v1
-
-		MT_Vector3 t_result = ((verts[v0].pos + verts[v1].pos) * 0.5);
-		result[0] = t_result[0];
-		result[1] = t_result[1];
-		result[2] = t_result[2];
-		
-		// do the same for the colors
-
-		MT_Vector3 c0 = color_editor.IndexColor(v0);
-		MT_Vector3 c1 = color_editor.IndexColor(v0);
-
-		c0 = (c0 + c1) *0.5;
-		result[3] = c0[0];
-		result[4] = c0[1];
-		result[5] = c0[2];
-
-		return;
-	}
-};
-
-	void
-LOD_NdQuadricEditor::
-ComputeEdgeCosts(
-	const vector<LOD_EdgeInd> &edges,
-	const LOD_ExternVColorEditor & color_editor
-){ 	
-	
-	// for each we compute the target vertex and then compute
-	// the quadric error e = Q1(v') + Q2(v')
-	vector<LOD_Edge> &edge_set = m_mesh.EdgeSet();
-
-	vector<LOD_NdQuadric> &quadrics = *m_quadrics;
-
-	vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin();
-	vector<LOD_EdgeInd>::const_iterator edge_end = edges.end();
-
-	TNT::Vector<MT_Scalar> target(6,MT_Scalar(0));
-
-	for (; edge_it != edge_end; ++edge_it) {
-		
-		TargetVertex(edge_set[*edge_it],target,color_editor);
-
-		LOD_Edge &e = edge_set[*edge_it];
-		const LOD_NdQuadric &q0 = quadrics[e.m_verts[0]];
-		const LOD_NdQuadric &q1 = quadrics[e.m_verts[1]];
-		
-		e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
-	}
-};
-	
-		
-
-
-		
-
-
-
-
-
-	
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/future/LOD_NdQuadricEditor.h b/intern/decimation/intern/future/LOD_NdQuadricEditor.h
deleted file mode 100644
index 7e05fd5..0000000
--- a/intern/decimation/intern/future/LOD_NdQuadricEditor.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/future/LOD_NdQuadricEditor.h
- *  \ingroup decimation
- */
-
-
-#ifndef __LOD_NDQUADRICEDITOR_H__
-#define __LOD_NDQUADRICEDITOR_H__
-
-#include "common/NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "LOD_NdQuadric.h"
-
-class LOD_ExternNormalEditor;
-class LOD_ExternVColorEditor;
-
-
-class LOD_NdQuadricEditor
-{
-
-public : 
-
-	// Creation
-	///////////
-
-	static
-		LOD_NdQuadricEditor *
-	New(
-		LOD_ManMesh2 &mesh
-	); 
-
-	// Property editor interface
-	////////////////////////////
-
-		void
-	Remove(
-		const std::vector<LOD_VertexInd> &sorted_vertices
-	);
-
-		std::vector<LOD_NdQuadric> &
-	Quadrics(
-	) const {
-		return *m_quadrics;
-	};
-
-
-	// Editor specific methods
-	//////////////////////////
-
-		bool
-	BuildQuadrics(
-		const LOD_ExternNormalEditor& normal_editor,
-		bool preserve_boundaries
-	);	
-
-		void
-	InitializeHeapKeys(
-		const LOD_ExternVColorEditor & color_editor
-	);
-
-
-		void
-	ComputeEdgeCosts(
-		const std::vector<LOD_EdgeInd> &edges,
-		const LOD_ExternVColorEditor & color_editor
-	); 	
-
-		void 
-	TargetVertex(
-		const LOD_Edge & e,
-		TNT::Vector<MT_Scalar> &result,
-		const LOD_ExternVColorEditor & color_editor
-	) const;
-
-	~LOD_NdQuadricEditor(
-	 ){
-		delete(m_quadrics);
-	};
-
-		
-private :
-
-	std::vector<LOD_NdQuadric> * m_quadrics;
-
-	LOD_ManMesh2 &m_mesh;
-
-private :
-	
-	LOD_NdQuadricEditor(LOD_ManMesh2 &mesh);
-
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/beethoven.ply b/intern/decimation/test/decimate_glut_test/beethoven.ply
deleted file mode 100644
index 889e3df..0000000
--- a/intern/decimation/test/decimate_glut_test/beethoven.ply
+++ /dev/null
@@ -1,7560 +0,0 @@
-ply
-format ascii 1.0
-element vertex 2521
-property float x
-property float y
-property float z
-element face 5030
-property list uchar int vertex_indices
-end_header
--0.093362 -0.478222 0.606843 
--0.096537 -0.571215 0.609019 
-0 -0.557739 0.616228 
-0 -0.471817 0.617078 
--0.224965 -0.434611 0.626931 
--1.19966 0.612319 -0.11444 
--1.23796 0.865933 -0.239116 
--1.31316 0.598818 -0.121402 
--1.26539 0.325109 -0.014263 
--1.1421 0.357713 0.080797 
--1.17217 0.003799 0.288578 
--0.99264 0.08779 0.368875 
--1.03891 -0.054216 0.599331 
--0.958007 0.004663 0.540421 
--1.26926 1.2552 -0.337076 
--1.30361 1.16541 -0.035682 
--1.25673 0.831771 0.001709 
--1.24666 0.626933 0.095034 
--1.1813 0.382558 0.276478 
--0.997234 0.135594 0.524613 
--0.968603 0.04749 0.672441 
--1.36037 1.12934 0.147805 
--1.31317 0.827262 0.178592 
--1.32188 0.686917 0.300153 
--1.237 0.437886 0.578947 
--1.12969 0.202209 0.82517 
--1.07181 0.081753 0.940408 
--0.864304 -0.095589 1.08681 
--0.808878 -0.108006 0.862693 
--0.785511 -0.113481 0.744561 
--1.30133 1.30903 -0.013709 
--1.28815 1.33112 -0.224217 
--1.40378 1.25315 0.12468 
--1.41714 1.19959 0.285955 
--1.37215 1.07701 0.29865 
--1.42851 1.24986 0.363487 
--1.35164 0.73068 0.417285 
--1.24432 0.569741 0.680281 
--1.37109 0.959788 0.536405 
--1.36065 1.21984 0.665852 
--1.14461 0.348289 0.821948 
--1.0651 0.150062 0.951618 
--0.886429 -0.041894 1.13485 
--0.951259 0.096646 1.22069 
--1.07768 0.29395 1.02055 
--1.26092 0.785572 0.842069 
--1.20598 0.682387 0.998162 
--1.17568 0.520922 0.896839 
--1.08251 0.41625 1.08209 
--1.08601 0.590441 1.15726 
--0.941793 0.371891 1.29654 
--0.964148 0.504018 1.38958 
--0.949137 0.239988 1.24238 
--1.28681 1.01372 0.965487 
--1.22543 0.911496 1.11728 
--1.13018 0.804388 1.26372 
--0.997671 0.714594 1.46985 
--1.35283 1.41507 0.76269 
--1.38406 1.43823 0.638337 
--1.29641 1.28984 1.08212 
--1.25788 1.18168 1.26751 
--1.1587 1.08166 1.42142 
--1.01955 0.988808 1.65043 
--1.34119 1.65633 0.806411 
--1.38958 1.76066 0.867844 
--1.48425 1.63208 0.642222 
--1.34749 1.61612 0.871266 
--1.3836 1.80876 1.02587 
--1.30342 1.44982 1.14884 
--1.25624 1.37225 1.34042 
--1.19687 1.30399 1.5246 
--1.0659 1.20865 1.71303 
--0.844796 0.640292 1.68219 
--1.14621 1.4615 1.74629 
--1.06797 1.42393 1.77231 
--1.21904 1.50742 1.66165 
--1.29148 1.58495 1.51498 
--1.34795 1.67516 1.34008 
--1.29202 2.29351 1.74208 
--1.42038 2.45347 1.47512 
--1.40021 2.17374 1.27659 
--1.30041 2.06651 1.59589 
--1.39207 1.99493 1.17958 
--1.35371 1.8873 1.4759 
--1.16107 1.93441 1.775 
--1.15743 2.09869 1.98279 
--1.2504 1.79407 1.69251 
--1.1553 1.72621 1.77839 
--1.03268 1.65597 1.83579 
--1.08228 1.85761 1.86166 
--0.991261 1.74717 1.86272 
--0.66883 -0.133086 1.38482 
--0.605833 -0.237692 1.3316 
--0.696418 -0.024416 1.42338 
--0.679076 -0.223769 1.08672 
--0.681201 -0.189988 0.897274 
--0.517345 -0.29906 1.42263 
--0.47636 -0.318326 1.24449 
--0.472171 -0.319164 1.08452 
--0.475894 -0.29839 0.931689 
--0.6181 -0.168267 1.43931 
--0.532043 -0.188259 1.56374 
--0.416522 -0.315333 1.58362 
--0.385661 -0.338703 1.48631 
--0.297379 -0.368494 1.45997 
--0.314927 -0.362307 1.35231 
--0.310459 -0.370836 1.19103 
--0.325354 -0.3705 1.07187 
--0.290747 -0.351774 0.892697 
--0.282196 -0.332769 1.65678 
--0.259483 -0.362621 1.54581 
--0.096673 -0.315136 1.71702 
--0.07776 -0.351505 1.5989 
-0 -0.307163 1.71678 
-0 -0.337078 1.60398 
--0.11417 -0.383655 1.53716 
-0 -0.375667 1.54744 
-0 -0.391969 1.43852 
--0.122677 -0.386415 1.44104 
-0 -0.391004 1.31519 
--0.135317 -0.392239 1.31028 
--0.132397 -0.409716 1.15829 
-0 -0.4073 1.14026 
--0.145465 -0.408123 1.02854 
-0 -0.409347 0.992633 
--0.152053 -0.370044 0.86114 
-0 -0.371925 0.821067 
--0.143397 -0.343689 0.728104 
-0 -0.357342 0.720637 
--0.276279 -0.316745 0.701162 
--0.412154 -0.205409 1.68394 
--0.291315 -0.209898 1.76757 
--0.082305 -0.23669 1.77027 
-0 -0.220695 1.76488 
--0.133829 -0.186136 1.77357 
--0.065653 -0.117723 1.80772 
--0.070935 -0.066474 1.82545 
-0 -0.045579 1.86247 
-0 -0.084188 1.83263 
--0.257796 -0.128864 1.75262 
--0.238682 -0.059001 1.75553 
--0.404022 -0.057416 1.67429 
--0.476644 -0.050701 1.59478 
--0.552883 -0.047095 1.53638 
--0.72068 0.102483 1.44324 
--0.607757 0.091845 1.51309 
--0.439127 0.053185 1.61893 
--0.35772 0.05727 1.69059 
--0.226956 0.072274 1.80652 
--0.060318 0.07373 1.86736 
-0 0.080414 1.9033 
--0.324676 0.127456 1.72334 
--0.386141 0.220323 1.7223 
--0.320505 0.141799 1.73579 
--0.313339 0.209882 1.78101 
--0.471391 0.225149 1.66446 
--0.575916 0.238576 1.58005 
--0.762829 0.246984 1.49524 
-0 0.170935 1.88076 
--0.069361 0.164459 1.85226 
--0.228307 0.154997 1.81236 
--0.232922 0.168293 1.81618 
--0.20816 0.220833 1.85825 
--0.071777 0.180417 1.85789 
--0.086023 0.243535 1.9378 
-0 0.186778 1.88407 
-0 0.248996 1.94903 
-0 0.284272 2.00052 
--0.07365 0.277933 1.97274 
--0.193681 0.263527 1.9144 
--0.291142 0.266477 1.83264 
--0.385333 0.280193 1.7673 
--0.469844 0.312862 1.70004 
-0 -0.158265 1.77312 
--0.561159 0.337266 1.69072 
--0.58434 0.353769 1.68961 
--0.636702 0.376537 1.67182 
--0.790274 0.394847 1.58418 
--0.449321 0.382192 1.73856 
--0.343124 0.350456 1.82089 
--0.266822 0.342211 1.91151 
--0.158775 0.331242 1.97493 
--0.0486 0.326522 1.98769 
-0 0.329461 2.02069 
-0 0.360331 2.0133 
--0.043045 0.36448 1.99338 
--0.158212 0.381306 1.95139 
--0.245268 0.380848 1.90076 
--0.323899 0.382911 1.81341 
--0.460064 0.430666 1.71922 
--0.344289 0.406637 1.83835 
--0.255007 0.404932 1.88885 
--0.163628 0.40845 1.94775 
--0.055541 0.40733 1.96575 
-0 0.397424 1.97967 
--0.341215 0.414218 1.84225 
--0.23862 0.413229 1.88099 
--0.145206 0.414588 1.94708 
--0.044394 0.411907 1.96716 
-0 0.40589 1.97504 
--0.041735 0.456187 2.01406 
-0 0.449223 2.04636 
--0.14716 0.464641 2.00163 
--0.239029 0.456758 1.9165 
-0 0.468383 2.07879 
--0.03677 0.483633 2.0776 
--0.143092 0.491804 2.0499 
--0.245183 0.479875 2.00913 
--0.336416 0.460032 1.91926 
--0.355035 0.52823 1.9758 
--0.258464 0.547844 2.04155 
--0.142186 0.547709 2.09155 
--0.050051 0.532402 2.1442 
-0 0.543088 2.14874 
--0.439771 0.529104 1.8763 
--0.512286 0.50057 1.83043 
--0.568693 0.448882 1.7899 
--0.671436 0.503081 1.74506 
--0.682462 0.624455 1.81073 
--0.507632 0.602478 1.87439 
--0.444401 0.608461 1.91491 
--0.340154 0.602725 2.00063 
--0.24088 0.683499 2.07051 
--0.325949 0.684599 2.02664 
--0.108692 0.664232 2.09868 
--0.027575 0.656342 2.1501 
-0 0.645054 2.15622 
--0.438461 0.691844 1.98387 
--0.511163 0.702227 1.93283 
--0.689729 0.709366 1.86079 
--0.891639 0.946287 1.84611 
--0.716621 0.885393 1.91495 
--0.498711 0.814368 1.963 
--0.389916 0.804071 1.97121 
--0.315485 0.79891 2.04016 
--0.202297 0.784284 2.08174 
--0.101304 0.756621 2.10268 
-0 0.733657 2.14121 
--0.900515 1.16806 1.85528 
--0.744744 1.11177 1.9377 
--0.55736 1.06015 1.99937 
--0.384455 1.03698 2.01796 
--0.380896 0.915372 1.96048 
--0.350573 0.859098 1.97207 
--0.353165 0.939698 1.9879 
--0.367133 0.88501 2.00986 
--0.301454 0.849319 2.01693 
--0.199972 0.853192 2.03151 
--0.082569 0.79351 2.12234 
-0 0.780302 2.16455 
--0.358499 1.13587 2.03762 
--0.313961 1.1035 2.1243 
--0.251755 1.12825 2.25079 
--0.250109 1.20826 2.22981 
--0.323421 1.22979 2.15258 
--0.212153 1.25309 2.31031 
--0.214941 1.11343 2.31677 
--0.357993 0.947133 2.0097 
--0.308167 0.891267 2.09958 
--0.247574 0.867584 2.07451 
--0.291854 0.903935 2.12686 
--0.308845 0.977413 2.14564 
--0.574497 1.28293 1.94031 
--0.724999 1.31976 1.88919 
--0.908878 1.38587 1.83602 
--0.326531 1.42844 2.16467 
--0.577303 1.44231 2.0132 
--0.726249 1.45289 1.93077 
--0.900317 1.60521 1.87022 
--0.257015 0.962623 2.21996 
--0.250845 0.89254 2.22711 
--0.182226 0.953741 2.37137 
--0.208692 0.93333 2.28578 
--0.195555 0.856733 2.34328 
--0.17111 1.09616 2.40578 
--0.139966 1.25039 2.41784 
--0.051121 1.07132 2.46941 
--0.071682 0.913681 2.4866 
--0.100151 0.855922 2.44462 
--0.102183 0.818842 2.43327 
-0 0.792142 2.44991 
-0 0.840963 2.49267 
--0.059178 1.24613 2.4637 
-0 0.886066 2.49886 
--0.121931 0.787974 2.31402 
-0 0.766279 2.36721 
--0.174241 0.798512 2.30395 
--0.213937 0.842269 2.21559 
--0.229106 0.881785 2.14673 
--0.093307 0.808868 2.22829 
-0 0.786166 2.26468 
-0 1.05357 2.46826 
-0 1.22967 2.47725 
--0.042104 1.464 2.47399 
-0 1.45802 2.48713 
--0.115906 1.45399 2.40313 
--0.185694 1.45113 2.33933 
--0.106878 1.64371 2.41996 
--0.164299 1.64827 2.35718 
--0.037208 1.62841 2.47879 
-0 1.63259 2.49339 
--0.24043 1.44397 2.25574 
--0.202382 1.66246 2.25116 
--0.332835 1.57299 2.174 
--0.25313 1.69794 2.1967 
--0.037269 1.73782 2.43803 
-0 1.73663 2.45711 
--0.105125 1.74445 2.38554 
--0.158929 1.75398 2.33187 
--0.190782 1.75425 2.26133 
-0 1.79882 2.48198 
--0.041248 1.80665 2.45209 
--0.097157 1.82292 2.41696 
--0.172705 1.81171 2.35628 
--0.21669 1.80113 2.30218 
-0 1.8778 2.55249 
--0.072641 1.87762 2.53715 
--0.141212 1.89106 2.46315 
--0.175663 1.86447 2.4192 
--0.089632 1.95109 2.57513 
-0 1.95043 2.57796 
--0.205103 1.93606 2.50167 
--0.115729 2.03689 2.6108 
-0 2.03621 2.62214 
--0.252663 1.98971 2.53937 
--0.085173 2.16728 2.64738 
--0.252006 2.12434 2.62606 
-0 2.15948 2.64098 
--0.091552 2.28404 2.65281 
-0 2.29324 2.63998 
--0.122377 2.44925 2.67143 
-0 2.46433 2.68067 
--0.256576 2.24265 2.65933 
--0.277904 2.35228 2.63833 
--0.280946 2.48356 2.69042 
--1.33881 2.72968 1.68696 
--1.16074 2.63157 2.02808 
--1.06575 2.24078 2.27664 
--1.29554 2.97586 1.87609 
--1.15418 2.99513 2.18852 
--1.24917 3.13003 2.06285 
--1.01787 2.80159 2.30795 
--1.01522 2.53592 2.28015 
--0.790139 2.24204 2.55146 
--0.780496 2.40331 2.56065 
--0.791082 2.61956 2.55187 
--0.800991 2.7573 2.60927 
--1.02772 2.97115 2.35895 
--1.10956 3.17923 2.32438 
--1.22871 3.22082 2.19659 
--1.04343 3.13633 2.44158 
--0.78191 3.12277 2.65059 
--0.789318 2.95937 2.65788 
--0.446992 2.3155 2.66702 
--0.568644 2.18558 2.6076 
--0.522196 2.51712 2.68231 
--0.586157 2.74311 2.69268 
--0.602808 2.91916 2.69357 
--0.60362 3.1509 2.68875 
--0.799644 3.34926 2.56425 
--0.585669 3.34991 2.6497 
--1.06235 3.34983 2.39193 
--0.422407 2.21643 2.6125 
--0.391108 2.07932 2.55952 
--0.346132 2.72844 2.67542 
--0.18079 2.72313 2.7286 
-0 2.71017 2.72739 
--0.389971 2.93471 2.67012 
--0.405038 3.15928 2.71148 
--0.384682 3.35613 2.68916 
--0.814242 3.41664 2.46057 
--0.605427 3.43673 2.6254 
--0.377767 3.41668 2.69948 
--0.211126 2.91988 2.74086 
-0 2.91091 2.7679 
--0.197682 3.16269 2.77402 
-0 3.14418 2.75277 
--0.200928 3.32556 2.70873 
-0 3.32677 2.7139 
--0.191664 3.35213 2.74218 
-0 3.40189 2.67704 
--0.208998 1.85424 2.36698 
--0.229374 1.75978 2.20476 
--0.246421 1.80144 2.22994 
--0.241221 1.86071 2.36154 
--0.231208 1.9082 2.47048 
--0.290521 1.94855 2.54259 
--0.302358 1.89607 2.41618 
--0.407271 1.99189 2.51572 
--0.599913 2.0669 2.56194 
--0.818046 2.1024 2.49198 
--1.0702 2.13112 2.23178 
--1.12645 2.07156 1.96811 
--0.307572 1.87232 2.36167 
--0.475958 1.93065 2.42688 
--0.446881 1.90596 2.50628 
--0.780522 2.03302 2.33935 
--0.807406 2.02769 2.42203 
--1.01558 2.067 2.21593 
--0.641413 1.97545 2.47929 
--0.620493 2.01165 2.39459 
--0.629815 1.95698 2.3956 
--0.760623 1.98149 2.32984 
--0.944004 1.96518 2.20341 
--1.0949 2.04101 1.98076 
--1.04067 1.9453 2.02694 
--0.463554 1.89702 2.39654 
--0.609915 1.90172 2.35804 
--0.726872 1.91296 2.33728 
--0.9074 1.88305 2.19846 
--1.00443 1.87095 2.02264 
--1.00585 1.8185 1.89824 
--0.285824 1.74761 2.2144 
--0.328278 1.86398 2.30102 
--0.333298 1.80098 2.19662 
--0.83178 1.66618 1.95878 
--0.898667 1.79549 1.9431 
--0.703251 1.60455 2.01335 
--0.564198 1.58256 2.06426 
--0.383179 1.64027 2.16866 
--0.915714 1.83715 1.96828 
--0.89338 1.85076 1.99117 
--0.86685 1.87544 2.16058 
--0.708905 1.89169 2.27666 
--0.592987 1.89901 2.29146 
--0.463218 1.89306 2.31285 
--0.377943 1.84138 2.22156 
--0.514841 1.86491 2.23481 
--0.580052 1.86372 2.23314 
--0.675458 1.86244 2.22329 
--0.784839 1.84839 2.14763 
--0.853135 1.81502 1.98791 
--0.723749 1.74229 2.0685 
--0.576331 1.71873 2.13213 
--0.426383 1.72486 2.15067 
--1.51668 1.23253 0.172 
--1.55522 1.27752 0.221274 
--1.68012 1.4207 0.135408 
--1.69772 1.39136 0.061103 
--1.76508 1.56761 0.096612 
--1.77047 1.54758 0.014896 
--1.6834 1.62278 0.120248 
--1.76354 1.69084 0.209278 
--1.62339 1.50022 0.141284 
--1.54001 1.37985 0.211439 
--1.42687 1.33361 0.370559 
--1.59558 1.5336 0.190428 
--1.66735 1.63944 0.175785 
--1.52143 1.46109 0.243872 
--1.47007 1.49324 0.36938 
--1.65351 1.65796 0.26981 
--1.70217 1.69121 0.287679 
--1.60008 1.57741 0.262643 
--1.53974 1.55742 0.265791 
--1.53022 1.5766 0.297969 
--1.62093 1.64777 0.357712 
--1.60482 1.69202 0.267614 
--1.58426 1.54614 -0.121393 
--1.56812 1.45231 -0.160167 
--1.34718 1.43508 -0.164662 
--1.42274 1.57302 -0.136412 
--1.40844 1.43859 -0.048195 
--1.39182 1.30176 0.001039 
--1.44699 1.30625 0.057701 
--1.418 1.56494 -0.075583 
--0.111949 0.905611 2.24548 
--0.13401 0.910055 2.24123 
--0.095349 0.907946 2.16464 
--0.099877 0.914423 2.20932 
--0.144862 0.933115 2.12633 
--0.164937 0.939185 2.14447 
--0.150751 0.928509 2.20397 
--0.157148 0.945174 2.17493 
-0.096537 -0.571215 0.609019 
-0.093362 -0.478222 0.606843 
-0.224965 -0.434611 0.626931 
-1.31316 0.598818 -0.121402 
-1.23796 0.865933 -0.239116 
-1.19966 0.612319 -0.11444 
-1.1421 0.357713 0.080797 
-1.26539 0.325109 -0.014263 
-0.99264 0.08779 0.368875 
-1.17217 0.003799 0.288578 
-0.958007 0.004663 0.540421 
-1.03891 -0.054216 0.599331 
-1.30361 1.16541 -0.035682 
-1.26926 1.2552 -0.337076 
-1.25673 0.831771 0.001709 
-1.24666 0.626933 0.095034 
-1.1813 0.382558 0.276478 
-0.997234 0.135594 0.524613 
-0.968603 0.04749 0.672441 
-1.31317 0.827262 0.178592 
-1.36037 1.12934 0.147805 
-1.32188 0.686917 0.300153 
-1.237 0.437886 0.578947 
-1.12969 0.202209 0.82517 
-1.07181 0.081753 0.940408 
-0.808878 -0.108006 0.862693 
-0.864304 -0.095589 1.08681 
-0.785511 -0.113481 0.744561 
-1.28815 1.33112 -0.224217 
-1.30133 1.30903 -0.013709 
-1.40378 1.25315 0.12468 
-1.37215 1.07701 0.29865 
-1.41714 1.19959 0.285955 
-1.42851 1.24986 0.363487 
-1.35164 0.73068 0.417285 
-1.24432 0.569741 0.680281 
-1.37109 0.959788 0.536405 
-1.36065 1.21984 0.665852 
-1.14461 0.348289 0.821948 
-1.0651 0.150062 0.951618 
-0.886429 -0.041894 1.13485 
-0.951259 0.096646 1.22069 
-1.07768 0.29395 1.02055 
-1.26092 0.785572 0.842069 
-1.17568 0.520922 0.896839 
-1.20598 0.682387 0.998162 
-1.08251 0.41625 1.08209 
-1.08601 0.590441 1.15726 
-0.964148 0.504018 1.38958 
-0.941793 0.371891 1.29654 
-0.949137 0.239988 1.24238 
-1.28681 1.01372 0.965487 
-1.22543 0.911496 1.11728 
-1.13018 0.804388 1.26372 
-0.997671 0.714594 1.46985 
-1.38406 1.43823 0.638337 
-1.35283 1.41507 0.76269 
-1.29641 1.28984 1.08212 
-1.25788 1.18168 1.26751 
-1.1587 1.08166 1.42142 
-1.01955 0.988808 1.65043 
-1.48425 1.63208 0.642222 
-1.38958 1.76066 0.867844 
-1.34119 1.65633 0.806411 
-1.34749 1.61612 0.871266 
-1.3836 1.80876 1.02587 
-1.30342 1.44982 1.14884 
-1.25624 1.37225 1.34042 
-1.19687 1.30399 1.5246 
-1.0659 1.20865 1.71303 
-0.844796 0.640292 1.68219 
-1.06797 1.42393 1.77231 
-1.14621 1.4615 1.74629 
-1.21904 1.50742 1.66165 
-1.29148 1.58495 1.51498 
-1.34795 1.67516 1.34008 
-1.30041 2.06651 1.59589 
-1.40021 2.17374 1.27659 
-1.42038 2.45347 1.47512 
-1.29202 2.29351 1.74208 
-1.35371 1.8873 1.4759 
-1.39207 1.99493 1.17958 
-1.16107 1.93441 1.775 
-1.15743 2.09869 1.98279 
-1.2504 1.79407 1.69251 
-1.1553 1.72621 1.77839 
-1.03268 1.65597 1.83579 
-1.08228 1.85761 1.86166 
-0.991261 1.74717 1.86272 
-0.605833 -0.237692 1.3316 
-0.66883 -0.133086 1.38482 
-0.696418 -0.024416 1.42338 
-0.679076 -0.223769 1.08672 
-0.681201 -0.189988 0.897274 
-0.47636 -0.318326 1.24449 
-0.517345 -0.29906 1.42263 
-0.472171 -0.319164 1.08452 
-0.475894 -0.29839 0.931689 
-0.6181 -0.168267 1.43931 
-0.532043 -0.188259 1.56374 
-0.385661 -0.338703 1.48631 
-0.416522 -0.315333 1.58362 
-0.314927 -0.362307 1.35231 
-0.297379 -0.368494 1.45997 
-0.310459 -0.370836 1.19103 
-0.325354 -0.3705 1.07187 
-0.290747 -0.351774 0.892697 
-0.259483 -0.362621 1.54581 
-0.282196 -0.332769 1.65678 
-0.07776 -0.351505 1.5989 
-0.096673 -0.315136 1.71702 
-0.11417 -0.383655 1.53716 
-0.122677 -0.386415 1.44104 
-0.135317 -0.392239 1.31028 
-0.132397 -0.409716 1.15829 
-0.145465 -0.408123 1.02854 
-0.152053 -0.370044 0.86114 
-0.143397 -0.343689 0.728104 
-0.276279 -0.316745 0.701162 
-0.412154 -0.205409 1.68394 
-0.291315 -0.209898 1.76757 
-0.133829 -0.186136 1.77357 
-0.082305 -0.23669 1.77027 
-0.257796 -0.128864 1.75262 
-0.065653 -0.117723 1.80772 
-0.070935 -0.066474 1.82545 
-0.238682 -0.059001 1.75553 
-0.404022 -0.057416 1.67429 
-0.476644 -0.050701 1.59478 
-0.552883 -0.047095 1.53638 
-0.72068 0.102483 1.44324 
-0.607757 0.091845 1.51309 
-0.439127 0.053185 1.61893 
-0.35772 0.05727 1.69059 
-0.226956 0.072274 1.80652 
-0.060318 0.07373 1.86736 
-0.324676 0.127456 1.72334 
-0.313339 0.209882 1.78101 
-0.320505 0.141799 1.73579 
-0.386141 0.220323 1.7223 
-0.471391 0.225149 1.66446 
-0.575916 0.238576 1.58005 
-0.762829 0.246984 1.49524 
-0.069361 0.164459 1.85226 
-0.228307 0.154997 1.81236 
-0.20816 0.220833 1.85825 
-0.232922 0.168293 1.81618 
-0.086023 0.243535 1.9378 
-0.071777 0.180417 1.85789 
-0.07365 0.277933 1.97274 
-0.193681 0.263527 1.9144 
-0.291142 0.266477 1.83264 
-0.385333 0.280193 1.7673 
-0.469844 0.312862 1.70004 
-0.561159 0.337266 1.69072 
-0.636702 0.376537 1.67182 
-0.58434 0.353769 1.68961 
-0.790274 0.394847 1.58418 
-0.343124 0.350456 1.82089 
-0.449321 0.382192 1.73856 
-0.266822 0.342211 1.91151 
-0.158775 0.331242 1.97493 
-0.0486 0.326522 1.98769 
-0.043045 0.36448 1.99338 
-0.158212 0.381306 1.95139 
-0.245268 0.380848 1.90076 
-0.323899 0.382911 1.81341 
-0.460064 0.430666 1.71922 
-0.344289 0.406637 1.83835 
-0.255007 0.404932 1.88885 
-0.163628 0.40845 1.94775 
-0.055541 0.40733 1.96575 
-0.341215 0.414218 1.84225 
-0.23862 0.413229 1.88099 
-0.145206 0.414588 1.94708 
-0.044394 0.411907 1.96716 
-0.041735 0.456187 2.01406 
-0.14716 0.464641 2.00163 
-0.239029 0.456758 1.9165 
-0.03677 0.483633 2.0776 
-0.143092 0.491804 2.0499 
-0.245183 0.479875 2.00913 
-0.336416 0.460032 1.91926 
-0.355035 0.52823 1.9758 
-0.258464 0.547844 2.04155 
-0.142186 0.547709 2.09155 
-0.050051 0.532402 2.1442 
-0.439771 0.529104 1.8763 
-0.512286 0.50057 1.83043 
-0.568693 0.448882 1.7899 
-0.671436 0.503081 1.74506 
-0.682462 0.624455 1.81073 
-0.507632 0.602478 1.87439 
-0.444401 0.608461 1.91491 
-0.340154 0.602725 2.00063 
-0.325949 0.684599 2.02664 
-0.24088 0.683499 2.07051 
-0.108692 0.664232 2.09868 
-0.027575 0.656342 2.1501 
-0.438461 0.691844 1.98387 
-0.511163 0.702227 1.93283 
-0.689729 0.709366 1.86079 
-0.891639 0.946287 1.84611 
-0.716621 0.885393 1.91495 
-0.498711 0.814368 1.963 
-0.389916 0.804071 1.97121 
-0.315485 0.79891 2.04016 
-0.202297 0.784284 2.08174 
-0.101304 0.756621 2.10268 
-0.900515 1.16806 1.85528 
-0.744744 1.11177 1.9377 
-0.55736 1.06015 1.99937 
-0.380896 0.915372 1.96048 
-0.384455 1.03698 2.01796 
-0.350573 0.859098 1.97207 
-0.367133 0.88501 2.00986 
-0.353165 0.939698 1.9879 
-0.301454 0.849319 2.01693 
-0.199972 0.853192 2.03151 
-0.082569 0.79351 2.12234 
-0.313961 1.1035 2.1243 
-0.358499 1.13587 2.03762 
-0.250109 1.20826 2.22981 
-0.251755 1.12825 2.25079 
-0.323421 1.22979 2.15258 
-0.212153 1.25309 2.31031 
-0.214941 1.11343 2.31677 
-0.357993 0.947133 2.0097 
-0.308167 0.891267 2.09958 
-0.247574 0.867584 2.07451 
-0.308845 0.977413 2.14564 
-0.291854 0.903935 2.12686 
-0.574497 1.28293 1.94031 
-0.724999 1.31976 1.88919 
-0.908878 1.38587 1.83602 
-0.577303 1.44231 2.0132 
-0.326531 1.42844 2.16467 
-0.726249 1.45289 1.93077 
-0.900317 1.60521 1.87022 
-0.257015 0.962623 2.21996 
-0.250845 0.89254 2.22711 
-0.195555 0.856733 2.34328 
-0.208692 0.93333 2.28578 
-0.182226 0.953741 2.37137 
-0.17111 1.09616 2.40578 
-0.139966 1.25039 2.41784 
-0.071682 0.913681 2.4866 
-0.051121 1.07132 2.46941 
-0.100151 0.855922 2.44462 
-0.102183 0.818842 2.43327 
-0.059178 1.24613 2.4637 
-0.121931 0.787974 2.31402 
-0.174241 0.798512 2.30395 
-0.213937 0.842269 2.21559 
-0.229106 0.881785 2.14673 
-0.093307 0.808868 2.22829 
-0.042104 1.464 2.47399 
-0.115906 1.45399 2.40313 
-0.185694 1.45113 2.33933 
-0.164299 1.64827 2.35718 
-0.106878 1.64371 2.41996 
-0.037208 1.62841 2.47879 
-0.24043 1.44397 2.25574 
-0.202382 1.66246 2.25116 
-0.332835 1.57299 2.174 
-0.25313 1.69794 2.1967 
-0.037269 1.73782 2.43803 
-0.105125 1.74445 2.38554 
-0.158929 1.75398 2.33187 
-0.190782 1.75425 2.26133 
-0.041248 1.80665 2.45209 
-0.097157 1.82292 2.41696 
-0.172705 1.81171 2.35628 
-0.21669 1.80113 2.30218 
-0.072641 1.87762 2.53715 
-0.141212 1.89106 2.46315 
-0.175663 1.86447 2.4192 
-0.089632 1.95109 2.57513 
-0.205103 1.93606 2.50167 
-0.115729 2.03689 2.6108 
-0.252006 2.12434 2.62606 
-0.085173 2.16728 2.64738 
-0.252663 1.98971 2.53937 
-0.091552 2.28404 2.65281 
-0.122377 2.44925 2.67143 
-0.256576 2.24265 2.65933 
-0.277904 2.35228 2.63833 
-0.280946 2.48356 2.69042 
-1.33881 2.72968 1.68696 
-1.16074 2.63157 2.02808 
-1.06575 2.24078 2.27664 
-1.29554 2.97586 1.87609 
-1.24917 3.13003 2.06285 
-1.15418 2.99513 2.18852 
-1.01522 2.53592 2.28015 
-1.01787 2.80159 2.30795 
-0.780496 2.40331 2.56065 
-0.790139 2.24204 2.55146 
-0.791082 2.61956 2.55187 
-0.800991 2.7573 2.60927 
-1.02772 2.97115 2.35895 
-1.22871 3.22082 2.19659 
-1.10956 3.17923 2.32438 
-1.04343 3.13633 2.44158 
-0.789318 2.95937 2.65788 
-0.78191 3.12277 2.65059 
-0.568644 2.18558 2.6076 
-0.446992 2.3155 2.66702 
-0.522196 2.51712 2.68231 
-0.586157 2.74311 2.69268 
-0.602808 2.91916 2.69357 
-0.60362 3.1509 2.68875 
-0.585669 3.34991 2.6497 
-0.799644 3.34926 2.56425 
-1.06235 3.34983 2.39193 
-0.422407 2.21643 2.6125 
-0.391108 2.07932 2.55952 
-0.346132 2.72844 2.67542 
-0.18079 2.72313 2.7286 
-0.389971 2.93471 2.67012 
-0.405038 3.15928 2.71148 
-0.384682 3.35613 2.68916 
-0.814242 3.41664 2.46057 
-0.605427 3.43673 2.6254 
-0.377767 3.41668 2.69948 
-0.211126 2.91988 2.74086 
-0.197682 3.16269 2.77402 
-0.200928 3.32556 2.70873 
-0.191664 3.35213 2.74218 
-0.208998 1.85424 2.36698 
-0.229374 1.75978 2.20476 
-0.246421 1.80144 2.22994 
-0.241221 1.86071 2.36154 
-0.231208 1.9082 2.47048 
-0.290521 1.94855 2.54259 
-0.302358 1.89607 2.41618 
-0.407271 1.99189 2.51572 
-0.599913 2.0669 2.56194 
-0.818046 2.1024 2.49198 
-1.0702 2.13112 2.23178 
-1.12645 2.07156 1.96811 
-0.307572 1.87232 2.36167 
-0.475958 1.93065 2.42688 
-0.446881 1.90596 2.50628 
-1.01558 2.067 2.21593 
-0.807406 2.02769 2.42203 
-0.780522 2.03302 2.33935 
-0.620493 2.01165 2.39459 
-0.641413 1.97545 2.47929 
-0.629815 1.95698 2.3956 
-0.760623 1.98149 2.32984 
-0.944004 1.96518 2.20341 
-1.04067 1.9453 2.02694 
-1.0949 2.04101 1.98076 
-0.609915 1.90172 2.35804 
-0.463554 1.89702 2.39654 
-0.726872 1.91296 2.33728 
-0.9074 1.88305 2.19846 
-1.00443 1.87095 2.02264 
-1.00585 1.8185 1.89824 
-0.285824 1.74761 2.2144 
-0.328278 1.86398 2.30102 
-0.333298 1.80098 2.19662 
-0.898667 1.79549 1.9431 
-0.83178 1.66618 1.95878 
-0.703251 1.60455 2.01335 
-0.564198 1.58256 2.06426 
-0.383179 1.64027 2.16866 
-0.915714 1.83715 1.96828 
-0.89338 1.85076 1.99117 
-0.86685 1.87544 2.16058 
-0.708905 1.89169 2.27666 
-0.592987 1.89901 2.29146 
-0.463218 1.89306 2.31285 
-0.377943 1.84138 2.22156 
-0.514841 1.86491 2.23481 
-0.580052 1.86372 2.23314 
-0.675458 1.86244 2.22329 
-0.784839 1.84839 2.14763 
-0.853135 1.81502 1.98791 
-0.723749 1.74229 2.0685 
-0.576331 1.71873 2.13213 
-0.426383 1.72486 2.15067 
-1.55522 1.27752 0.221274 
-1.51668 1.23253 0.172 
-1.69772 1.39136 0.061103 
-1.68012 1.4207 0.135408 
-1.77047 1.54758 0.014896 
-1.76508 1.56761 0.096612 
-1.76354 1.69084 0.209278 
-1.6834 1.62278 0.120248 
-1.62339 1.50022 0.141284 
-1.54001 1.37985 0.211439 
-1.42687 1.33361 0.370559 
-1.66735 1.63944 0.175785 
-1.59558 1.5336 0.190428 
-1.52143 1.46109 0.243872 
-1.47007 1.49324 0.36938 
-1.70217 1.69121 0.287679 
-1.65351 1.65796 0.26981 
-1.60008 1.57741 0.262643 
-1.53974 1.55742 0.265791 
-1.53022 1.5766 0.297969 
-1.62093 1.64777 0.357712 
-1.60482 1.69202 0.267614 
-1.56812 1.45231 -0.160167 
-1.58426 1.54614 -0.121393 
-1.42274 1.57302 -0.136412 
-1.34718 1.43508 -0.164662 
-1.39182 1.30176 0.001039 
-1.40844 1.43859 -0.048195 
-1.44699 1.30625 0.057701 
-1.418 1.56494 -0.075583 
-0.157148 0.945174 2.17493 
-0.150751 0.928509 2.20397 
-0.144862 0.933115 2.12633 
-0.164937 0.939185 2.14447 
-0.095349 0.907946 2.16464 
-0.099877 0.914423 2.20932 
-0.111949 0.905611 2.24548 
-0.13401 0.910055 2.24123 
-1.41794 -2.54119 1.49378 
-1.25933 -2.426 1.56334 
-1.23612 -2.71117 1.68612 
-1.40939 -2.86533 1.61363 
-1.22499 -2.93859 1.77651 
-1.39955 -3.10569 1.68505 
-1.20229 -3.14527 1.83335 
-1.37998 -3.36611 1.73877 
-1.10631 -3.59068 1.97424 
-1.33427 -3.71645 1.83982 
-1.00277 -4.05768 2.05247 
-1.23217 -4.12133 1.91564 
-0.921851 -4.499 2.10201 
-1.14948 -4.5219 1.94974 
-0.821686 -4.94865 2.10992 
-1.05567 -4.96905 1.93454 
-0.749451 -5.28247 2.10193 
-0.942787 -5.31055 1.94435 
-0.665033 -4.94927 2.06783 
-0.606929 -5.25841 2.04422 
-0.790397 -4.47157 2.07039 
-0.871066 -4.03022 2.02068 
-1.01133 -3.54846 1.93214 
-1.15558 -3.10934 1.81447 
-1.17524 -2.84886 1.70508 
-1.17032 -2.68354 1.62535 
-1.64917 -3.1536 1.4251 
-1.72545 -2.90186 1.2981 
-1.9159 -3.34091 1.32934 
-1.97488 -3.12689 1.26117 
-2.24666 -3.43634 1.32377 
-2.29049 -3.3403 1.27963 
-2.53499 -3.50239 1.34751 
-2.14061 -3.7279 1.47283 
-2.31725 -3.85704 1.49727 
-1.83559 -3.58952 1.43531 
-2.01305 -3.66831 1.42843 
-1.58407 -3.39449 1.52363 
-1.68245 -3.49069 1.45163 
-1.52912 -3.61163 1.61282 
-1.5482 -3.50073 1.58131 
-2.12238 -3.82396 1.50638 
-2.06016 -3.90976 1.53897 
-2.23169 -4.0151 1.56226 
-2.01025 -3.71714 1.44944 
-2.07678 -3.80439 1.49576 
-1.96121 -3.86446 1.53128 
-1.98634 -3.83265 1.51437 
-1.6089 -3.66178 1.55122 
-1.66833 -3.51508 1.4673 
-1.59724 -3.53477 1.528 
-1.61788 -3.61387 1.53435 
-1.98803 -3.76716 1.48513 
-1.65515 -3.55615 1.49146 
-1.81218 -3.62655 1.4343 
-1.7985 -3.64352 1.451 
-1.79041 -3.66886 1.47105 
-1.7871 -3.69388 1.48456 
-1.76308 -3.74205 1.50974 
-1.87368 -4.20204 1.61451 
-2.04568 -4.33921 1.64411 
-1.65937 -4.02769 1.6147 
-1.50273 -3.88256 1.68855 
-1.42288 -4.1948 1.75181 
-1.33883 -4.5861 1.77642 
-1.21936 -5.0014 1.76541 
-1.10419 -5.30578 1.7864 
-1.2238 -5.32761 1.72705 
-1.32124 -5.03707 1.70172 
-1.48136 -4.6141 1.69494 
-1.58681 -4.32605 1.6843 
-1.7707 -4.44099 1.6597 
-1.95785 -4.53521 1.64845 
-1.65283 -4.68421 1.68483 
-1.85086 -4.73928 1.66662 
-1.46059 -5.0784 1.6634 
-1.63156 -5.1244 1.64583 
-1.38763 -5.35259 1.66987 
-1.49974 -5.39231 1.63134 
-1.32626 -2.15509 1.41326 
-1.48577 -2.25112 1.37387 
-1.88052 -2.5696 1.1125 
-1.71036 -2.03576 1.11349 
-1.54532 -1.78182 1.1274 
-1.36292 -1.93139 1.2288 
-1.08267 -2.15916 1.20988 
-1.11518 -2.21954 1.30011 
-2.05093 -1.83166 0.82876 
-1.70297 -1.47887 0.875829 
-1.76486 -1.36183 0.781579 
-2.28863 -1.64599 0.611225 
-1.8831 -1.37439 0.712727 
-2.03531 -1.27227 0.521232 
-2.39541 -1.41406 0.447712 
-2.50985 -0.986878 0.206504 
-2.20863 -0.922418 0.257252 
-2.63986 -2.43832 0.958418 
-2.72573 -1.88675 0.497114 
-2.76451 -1.59014 0.284429 
-2.83174 -1.09889 0.044976 
-1.77547 -2.80676 1.2581 
-1.65553 -2.68236 1.29957 
-2.03363 -2.70392 1.07411 
-1.8396 -2.21885 1.04494 
-2.05629 -3.00126 1.20877 
-2.38479 -3.21257 1.26392 
-2.35695 -4.12036 1.54487 
-2.4598 -3.95588 1.4832 
-2.17801 -4.43026 1.63294 
-2.07584 -4.61886 1.6468 
-1.97144 -4.81331 1.64909 
-1.78291 -5.17906 1.64209 
-1.66282 -5.42445 1.62869 
-2.72247 -3.52185 1.29753 
-2.32052 -0.635532 0.13977 
-2.57215 -0.716555 0.062678 
-2.86631 -0.799157 -0.133476 
-2.29246 -0.14507 -0.109027 
-2.44317 -0.179462 -0.31526 
-2.7309 -0.264831 -0.543768 
-2.45884 0.001204 -0.795894 
-2.29206 0.126813 -0.573476 
-2.19215 0.196353 -0.366311 
-2.32133 0.143332 -0.986568 
-2.20423 0.285265 -0.793519 
-2.08651 0.412325 -0.602341 
-1.9795 0.526511 -1.05294 
-1.90133 0.677905 -0.887785 
-2.11928 0.374709 -1.29634 
-2.4044 0.114204 -1.03476 
-2.18231 0.325784 -1.35978 
-2.48932 -0.022626 -0.860502 
-2.73506 -0.303741 -0.600112 
-2.97215 -1.12136 -0.018465 
-2.97992 -0.812304 -0.19607 
-2.92242 -1.64167 0.25741 
-2.8735 -1.93057 0.473403 
-2.37513 0.046336 -1.14444 
-2.17234 0.226998 -1.42252 
-2.49116 -0.102854 -1.00592 
-2.79651 -0.410669 -0.688888 
-2.99026 -0.891358 -0.298409 
-3.00345 -1.20847 -0.126238 
-2.62674 -0.141303 -1.17623 
-3.30573 -0.660061 -1.10624 
-3.18975 -0.546391 -1.21141 
-3.49815 -0.805415 -0.915226 
-3.5983 -1.11135 -0.58061 
-3.59493 -1.30943 -0.426668 
-2.9606 -1.71862 0.127997 
-2.89283 -2.04019 0.309357 
-3.56163 -1.80325 -0.127527 
-3.57252 -2.19329 0.073111 
-2.72394 -2.59392 0.991446 
-2.10163 -2.77656 0.955989 
-1.95277 -2.425 0.870612 
-1.81081 -2.78696 1.09906 
-2.07927 -2.97559 1.06956 
-2.41962 -3.20046 1.0484 
-2.75858 -3.52641 1.03498 
-2.41467 -4.0115 1.17844 
-2.32445 -4.1816 1.22048 
-2.17363 -4.47798 1.31084 
-2.08824 -4.63231 1.34862 
-1.97125 -4.8604 1.37583 
-1.80733 -5.20182 1.40658 
-1.70521 -5.42966 1.42574 
-3.03291 -4.27476 0.871277 
-3.22189 -3.68525 0.761669 
-3.38411 -3.15746 0.609178 
-3.00685 -3.15998 0.786586 
-2.76108 -3.34313 0.934009 
-2.98986 -4.35962 0.888982 
-2.83755 -4.57595 0.958111 
-2.74362 -4.77077 1.01378 
-2.64726 -5.00696 1.03606 
-2.54368 -5.32838 1.06365 
-2.42854 -5.59728 1.10672 
-2.63671 -2.71934 0.706883 
-2.67514 -2.78464 0.772986 
-3.02201 -2.93567 0.71722 
-3.48874 -2.8214 0.417224 
-2.40827 -2.93159 0.890975 
-2.48162 -3.1579 0.992837 
-4.31396 -1.23372 -1.11322 
-4.33061 -1.41192 -0.776805 
-4.32417 -1.48549 -0.686738 
-4.24834 -1.9029 -0.36286 
-4.63485 -1.56537 -0.797032 
-4.62483 -1.45521 -1.03393 
-4.56678 -1.9257 -0.443689 
-4.18889 -2.33727 -0.205079 
-4.13786 -2.70301 -0.100062 
-4.02287 -3.36961 0.0339 
-3.76429 -3.90937 0.369424 
-4.45635 -2.39893 -0.204624 
-4.35957 -2.78467 -0.104717 
-4.12501 -3.39416 -0.000466 
-3.89848 -4.08853 -0.065554 
-4.24174 -3.46507 -0.094279 
-4.4799 -2.86612 -0.178521 
-4.57688 -2.43744 -0.255504 
-4.64855 -1.97738 -0.494981 
-3.51314 -4.43512 0.544512 
-3.49772 -4.48206 0.557091 
-3.3791 -4.70096 0.630729 
-3.3248 -4.79291 0.64954 
-3.16611 -5.04753 0.719668 
-2.97441 -5.39482 0.804852 
-2.81696 -5.69819 0.778881 
-3.67099 -4.56932 0.278001 
-3.52966 -4.81012 0.407969 
-3.32822 -5.10642 0.51918 
-3.04855 -5.43287 0.657509 
-0.919514 -3.59924 1.89223 
-0.787973 -3.57208 1.80514 
-0.81157 -3.53526 1.63975 
-0.735525 -3.89385 1.70108 
-0.766932 -3.93384 1.81114 
-0.728226 -4.16362 1.81763 
-0.6726 -4.21102 1.73788 
-0.642157 -4.51041 1.85469 
-0.58714 -4.5504 1.7207 
-0.572488 -4.94837 1.87507 
-0.508878 -5.27324 1.85564 
-0.520362 -4.93184 1.77664 
-0.45984 -5.25057 1.76865 
-3.74177 -4.17182 -0.347126 
-4.04361 -3.57504 -0.555009 
-4.22395 -3.06147 -0.724218 
-4.40301 -2.6061 -0.807085 
-4.50954 -2.16501 -0.978357 
-4.64434 -1.74196 -1.08547 
-4.07458 -2.73713 -1.28481 
-4.24748 -2.277 -1.45485 
-3.94058 -3.14108 -1.09184 
-3.74956 -3.68957 -0.831686 
-3.50322 -4.20336 -0.577819 
-3.51173 -4.55241 -0.171128 
-3.29843 -4.83566 -0.094779 
-3.06951 -5.12662 -0.010901 
-2.85651 -5.3667 0.088825 
-2.65623 -5.60517 0.169326 
-2.50028 -5.52378 -0.077034 
-2.68242 -5.30658 -0.162887 
-2.86541 -5.07454 -0.246702 
-3.11501 -4.82719 -0.302164 
-3.33706 -4.54269 -0.391358 
-1.71649 0.726429 -1.38844 
-1.61273 0.873944 -1.29687 
-1.88475 0.517371 -1.56263 
-1.96082 0.442513 -1.61059 
-1.94291 0.314387 -1.68162 
-1.42999 0.889587 -1.61421 
-1.50552 0.653872 -1.83569 
-0.931704 0.787899 -2.06613 
-0.917302 1.01955 -1.95127 
-0 0.904195 -2.21486 
-0 1.03054 -2.17848 
-0.951775 0.729199 -2.15072 
-0 0.845559 -2.29762 
-1.55521 0.591727 -1.90989 
-0.916245 0.591191 -2.19758 
-0 0.707846 -2.34443 
-1.51684 0.444141 -1.94103 
-2.89416 -0.293492 -1.69366 
-2.20873 -0.084916 -2.25201 
-1.64363 0.058334 -2.43844 
-0.948287 0.148704 -2.63546 
-0 0.168425 -2.85332 
-4.31184 -1.20063 -1.18539 
-4.28121 -1.23602 -1.86668 
-4.41342 -1.36602 -1.81725 
-4.07592 -1.65577 -2.42746 
-3.18982 -1.09823 -2.69034 
-2.38693 -0.750937 -2.862 
-1.7195 -0.583459 -3.01385 
-0.992348 -0.495836 -3.17746 
-0 -0.488963 -3.31909 
-0.917138 -0.807683 -3.2316 
-0 -0.804943 -3.30298 
-1.66854 -0.878633 -3.08697 
-2.29817 -1.04051 -2.95999 
-3.11579 -1.32048 -2.78117 
-4.38354 -1.80351 -1.70446 
-3.74264 -2.35777 -2.27938 
-3.67798 -2.90606 -1.68305 
-3.63881 -3.24171 -1.35384 
-3.51253 -3.72645 -0.968948 
-3.28763 -4.20136 -0.669328 
-3.10444 -4.54345 -0.512972 
-2.88229 -4.75316 -0.407417 
-2.63698 -4.99993 -0.302704 
-2.49222 -5.23389 -0.221049 
-2.3512 -5.43541 -0.151886 
-0.681818 -1.56571 -2.71684 
-0 -1.51473 -2.80997 
-1.35017 -1.67514 -2.53973 
-1.84782 -1.74594 -2.45708 
-2.75622 -1.99017 -2.29626 
-0.518024 -2.10815 -2.28922 
-0 -2.05635 -2.35199 
-1.08679 -2.19117 -2.14977 
-1.53827 -2.28906 -2.0182 
-1.96407 -2.352 -1.90948 
-2.64002 -2.51801 -1.71451 
-0.44787 -2.51034 -2.13596 
-0 -2.39456 -2.20933 
-0.983234 -2.5831 -1.99972 
-1.46665 -2.7101 -1.83974 
-2.07379 -2.82287 -1.61253 
-2.70589 -3.01017 -1.35665 
-0.342392 -3.01133 -2.03468 
-0 -2.93399 -2.08282 
-0.865371 -3.1137 -1.90068 
-1.35565 -3.23425 -1.73538 
-1.78257 -3.38436 -1.49597 
-2.21345 -3.53735 -1.17981 
-2.64201 -3.59015 -0.976034 
-0.208197 -3.46217 -2.00383 
-0 -3.38957 -2.04132 
-0.730909 -3.56852 -1.8981 
-1.24398 -3.66319 -1.70561 
-1.65856 -3.76853 -1.45129 
-2.09688 -3.93888 -1.01188 
-2.55587 -3.97232 -0.738809 
-0.090155 -3.81937 -2.04535 
-0 -3.75251 -2.0784 
-0.670606 -3.91565 -1.92693 
-1.15938 -3.98773 -1.72075 
-1.55232 -4.10324 -1.43629 
-2.01066 -4.25018 -0.897486 
-2.46865 -4.33771 -0.565898 
-0.097358 -4.2071 -2.08748 
-0 -4.2023 -2.12078 
-0.635255 -4.23469 -1.94546 
-1.12077 -4.32377 -1.72459 
-1.50273 -4.48221 -1.40554 
-1.88257 -4.59567 -0.852173 
-2.41234 -4.64447 -0.439763 
-0.110803 -4.44991 -2.12065 
-0 -4.44233 -2.16627 
-0.124695 -4.68502 -2.15276 
-0 -4.70272 -2.23182 
-0.115238 -4.99269 -2.20753 
-0 -4.96804 -2.25774 
-0.620858 -4.48334 -1.97961 
-0.611104 -4.72398 -2.01892 
-0.595195 -5.03812 -2.07909 
-1.0865 -4.58847 -1.74618 
-1.06436 -4.82352 -1.7657 
-1.03139 -5.10085 -1.80622 
-1.46917 -4.72807 -1.39675 
-1.41586 -4.95443 -1.40899 
-1.3765 -5.23486 -1.42648 
-1.79033 -4.90605 -0.797175 
-1.68622 -5.16383 -0.782295 
-1.59625 -5.43677 -0.777835 
-2.26091 -4.95199 -0.323219 
-2.1214 -5.16678 -0.272905 
-2.01533 -5.38751 -0.191249 
-0 -6.03088 -2.40814 
-0.102551 -6.03088 -2.35592 
-0.529666 -6.03088 -2.22234 
-0.91784 -6.03088 -1.93854 
-1.22495 -6.03088 -1.54361 
-1.42051 -6.03088 -0.868995 
-0.409214 -6.03088 1.77943 
-0.173271 -6.03088 1.84868 
-0 -6.03088 1.93473 
-0.452853 -6.03088 1.86989 
-0.540109 -6.03088 2.06603 
-0.66694 -6.03088 2.12605 
-0.83899 -6.03088 1.96215 
-0.982628 -6.03088 1.79789 
-1.08906 -6.03088 1.73616 
-1.23486 -6.03088 1.67669 
-1.33463 -6.03088 1.63662 
-1.47975 -6.03088 1.63387 
-1.51747 -6.03088 1.42279 
-2.16117 -6.03088 1.091 
-2.50683 -6.03088 0.750036 
-2.36379 -6.03088 0.116081 
-2.22501 -6.03088 -0.140141 
-2.09234 -6.03088 -0.21799 
-1.79345 -6.03088 -0.258928 
--1.40939 -2.86533 1.61363 
--1.23612 -2.71117 1.68612 
--1.25933 -2.426 1.56334 
--1.41794 -2.54119 1.49378 
--1.39955 -3.10569 1.68505 
--1.22499 -2.93859 1.77651 
--1.37998 -3.36611 1.73877 
--1.20229 -3.14527 1.83335 
--1.33427 -3.71645 1.83982 
--1.10631 -3.59068 1.97424 
--1.23217 -4.12133 1.91564 
--1.00277 -4.05768 2.05247 
--1.14948 -4.5219 1.94974 
--0.921851 -4.499 2.10201 
--1.05567 -4.96905 1.93454 
--0.821686 -4.94865 2.10992 
--0.942787 -5.31055 1.94435 
--0.749451 -5.28247 2.10193 
--0.606929 -5.25841 2.04422 
--0.665033 -4.94927 2.06783 
--0.790397 -4.47157 2.07039 
--0.871066 -4.03022 2.02068 
--1.01133 -3.54846 1.93214 
--1.15558 -3.10934 1.81447 
--1.17524 -2.84886 1.70508 
--1.17032 -2.68354 1.62535 
--1.72545 -2.90186 1.2981 
--1.64917 -3.1536 1.4251 
--1.97488 -3.12689 1.26117 
--1.9159 -3.34091 1.32934 
--2.29049 -3.3403 1.27963 
--2.24666 -3.43634 1.32377 
--2.53499 -3.50239 1.34751 
--2.31725 -3.85704 1.49727 
--2.14061 -3.7279 1.47283 
--2.01305 -3.66831 1.42843 
--1.83559 -3.58952 1.43531 
--1.68245 -3.49069 1.45163 
--1.58407 -3.39449 1.52363 
--1.5482 -3.50073 1.58131 
--1.52912 -3.61163 1.61282 
--2.23169 -4.0151 1.56226 
--2.06016 -3.90976 1.53897 
--2.12238 -3.82396 1.50638 
--2.07678 -3.80439 1.49576 
--2.01025 -3.71714 1.44944 
--1.96121 -3.86446 1.53128 
--1.98634 -3.83265 1.51437 
--1.6089 -3.66178 1.55122 
--1.59724 -3.53477 1.528 
--1.66833 -3.51508 1.4673 
--1.61788 -3.61387 1.53435 
--1.98803 -3.76716 1.48513 
--1.65515 -3.55615 1.49146 
--1.81218 -3.62655 1.4343 
--1.7985 -3.64352 1.451 
--1.7871 -3.69388 1.48456 
--1.79041 -3.66886 1.47105 
--1.76308 -3.74205 1.50974 
--2.04568 -4.33921 1.64411 
--1.87368 -4.20204 1.61451 
--1.65937 -4.02769 1.6147 
--1.50273 -3.88256 1.68855 
--1.42288 -4.1948 1.75181 
--1.33883 -4.5861 1.77642 
--1.21936 -5.0014 1.76541 
--1.10419 -5.30578 1.7864 
--1.32124 -5.03707 1.70172 
--1.2238 -5.32761 1.72705 
--1.48136 -4.6141 1.69494 
--1.58681 -4.32605 1.6843 
--1.7707 -4.44099 1.6597 
--1.95785 -4.53521 1.64845 
--1.85086 -4.73928 1.66662 
--1.65283 -4.68421 1.68483 
--1.63156 -5.1244 1.64583 
--1.46059 -5.0784 1.6634 
--1.49974 -5.39231 1.63134 
--1.38763 -5.35259 1.66987 
--1.48577 -2.25112 1.37387 
--1.32626 -2.15509 1.41326 
--1.88052 -2.5696 1.1125 
--1.71036 -2.03576 1.11349 
--1.36292 -1.93139 1.2288 
--1.54532 -1.78182 1.1274 
--1.08267 -2.15916 1.20988 
--1.11518 -2.21954 1.30011 
--1.70297 -1.47887 0.875829 
--2.05093 -1.83166 0.82876 
--1.8831 -1.37439 0.712727 
--2.28863 -1.64599 0.611225 
--1.76486 -1.36183 0.781579 
--2.39541 -1.41406 0.447712 
--2.03531 -1.27227 0.521232 
--2.20863 -0.922418 0.257252 
--2.50985 -0.986878 0.206504 
--2.63986 -2.43832 0.958418 
--2.72573 -1.88675 0.497114 
--2.76451 -1.59014 0.284429 
--2.83174 -1.09889 0.044976 
--1.65553 -2.68236 1.29957 
--1.77547 -2.80676 1.2581 
--2.03363 -2.70392 1.07411 
--1.8396 -2.21885 1.04494 
--2.05629 -3.00126 1.20877 
--2.38479 -3.21257 1.26392 
--2.4598 -3.95588 1.4832 
--2.35695 -4.12036 1.54487 
--2.17801 -4.43026 1.63294 
--2.07584 -4.61886 1.6468 
--1.97144 -4.81331 1.64909 
--1.78291 -5.17906 1.64209 
--1.66282 -5.42445 1.62869 
--2.72247 -3.52185 1.29753 
--2.57215 -0.716555 0.062678 
--2.32052 -0.635532 0.13977 
--2.86631 -0.799157 -0.133476 
--2.44317 -0.179462 -0.31526 
--2.29246 -0.14507 -0.109027 
--2.7309 -0.264831 -0.543768 
--2.29206 0.126813 -0.573476 
--2.45884 0.001204 -0.795894 
--2.19215 0.196353 -0.366311 
--2.20423 0.285265 -0.793519 
--2.32133 0.143332 -0.986568 
--2.08651 0.412325 -0.602341 
--1.90133 0.677905 -0.887785 
--1.9795 0.526511 -1.05294 
--2.11928 0.374709 -1.29634 
--2.18231 0.325784 -1.35978 
--2.4044 0.114204 -1.03476 
--2.48932 -0.022626 -0.860502 
--2.73506 -0.303741 -0.600112 
--2.97992 -0.812304 -0.19607 
--2.97215 -1.12136 -0.018465 
--2.92242 -1.64167 0.25741 
--2.8735 -1.93057 0.473403 
--2.17234 0.226998 -1.42252 
--2.37513 0.046336 -1.14444 
--2.49116 -0.102854 -1.00592 
--2.79651 -0.410669 -0.688888 
--2.99026 -0.891358 -0.298409 
--3.00345 -1.20847 -0.126238 
--2.62674 -0.141303 -1.17623 
--3.18975 -0.546391 -1.21141 
--3.30573 -0.660061 -1.10624 
--3.49815 -0.805415 -0.915226 
--3.5983 -1.11135 -0.58061 
--3.59493 -1.30943 -0.426668 
--2.9606 -1.71862 0.127997 
--2.89283 -2.04019 0.309357 
--3.56163 -1.80325 -0.127527 
--3.57252 -2.19329 0.073111 
--2.72394 -2.59392 0.991446 
--1.95277 -2.425 0.870612 
--2.10163 -2.77656 0.955989 
--1.81081 -2.78696 1.09906 
--2.07927 -2.97559 1.06956 
--2.41962 -3.20046 1.0484 
--2.75858 -3.52641 1.03498 
--2.41467 -4.0115 1.17844 
--2.32445 -4.1816 1.22048 
--2.17363 -4.47798 1.31084 
--2.08824 -4.63231 1.34862 
--1.97125 -4.8604 1.37583 
--1.80733 -5.20182 1.40658 
--1.70521 -5.42966 1.42574 
--3.22189 -3.68525 0.761669 
--3.03291 -4.27476 0.871277 
--2.76108 -3.34313 0.934009 
--3.00685 -3.15998 0.786586 
--3.38411 -3.15746 0.609178 
--2.98986 -4.35962 0.888982 
--2.83755 -4.57595 0.958111 
--2.74362 -4.77077 1.01378 
--2.64726 -5.00696 1.03606 
--2.54368 -5.32838 1.06365 
--2.42854 -5.59728 1.10672 
--2.63671 -2.71934 0.706883 
--3.48874 -2.8214 0.417224 
--3.02201 -2.93567 0.71722 
--2.67514 -2.78464 0.772986 
--2.40827 -2.93159 0.890975 
--2.48162 -3.1579 0.992837 
--4.31396 -1.23372 -1.11322 
--4.33061 -1.41192 -0.776805 
--4.32417 -1.48549 -0.686738 
--4.24834 -1.9029 -0.36286 
--4.62483 -1.45521 -1.03393 
--4.63485 -1.56537 -0.797032 
--4.56678 -1.9257 -0.443689 
--4.18889 -2.33727 -0.205079 
--4.13786 -2.70301 -0.100062 
--4.02287 -3.36961 0.0339 
--3.76429 -3.90937 0.369424 
--4.45635 -2.39893 -0.204624 
--4.35957 -2.78467 -0.104717 
--4.12501 -3.39416 -0.000466 
--3.89848 -4.08853 -0.065554 
--4.24174 -3.46507 -0.094279 
--4.4799 -2.86612 -0.178521 
--4.57688 -2.43744 -0.255504 
--4.64855 -1.97738 -0.494981 
--3.51314 -4.43512 0.544512 
--3.49772 -4.48206 0.557091 
--3.3791 -4.70096 0.630729 
--3.3248 -4.79291 0.64954 
--3.16611 -5.04753 0.719668 
--2.97441 -5.39482 0.804852 
--2.81696 -5.69819 0.778881 
--3.67099 -4.56932 0.278001 
--3.52966 -4.81012 0.407969 
--3.32822 -5.10642 0.51918 
--3.04855 -5.43287 0.657509 
--0.919514 -3.59924 1.89223 
--0.766932 -3.93384 1.81114 
--0.735525 -3.89385 1.70108 
--0.81157 -3.53526 1.63975 
--0.787973 -3.57208 1.80514 
--0.728226 -4.16362 1.81763 
--0.6726 -4.21102 1.73788 
--0.642157 -4.51041 1.85469 
--0.58714 -4.5504 1.7207 
--0.572488 -4.94837 1.87507 
--0.508878 -5.27324 1.85564 
--0.45984 -5.25057 1.76865 
--0.520362 -4.93184 1.77664 
--4.04361 -3.57504 -0.555009 
--3.74177 -4.17182 -0.347126 
--4.22395 -3.06147 -0.724218 
--4.40301 -2.6061 -0.807085 
--4.50954 -2.16501 -0.978357 
--4.64434 -1.74196 -1.08547 
--4.24748 -2.277 -1.45485 
--4.07458 -2.73713 -1.28481 
--3.94058 -3.14108 -1.09184 
--3.74956 -3.68957 -0.831686 
--3.50322 -4.20336 -0.577819 
--3.51173 -4.55241 -0.171128 
--3.29843 -4.83566 -0.094779 
--3.06951 -5.12662 -0.010901 
--2.85651 -5.3667 0.088825 
--2.65623 -5.60517 0.169326 
--2.68242 -5.30658 -0.162887 
--2.50028 -5.52378 -0.077034 
--2.86541 -5.07454 -0.246702 
--3.11501 -4.82719 -0.302164 
--3.33706 -4.54269 -0.391358 
--1.61273 0.873944 -1.29687 
--1.71649 0.726429 -1.38844 
--1.88475 0.517371 -1.56263 
--1.96082 0.442513 -1.61059 
--1.94291 0.314387 -1.68162 
--1.42999 0.889587 -1.61421 
--1.50552 0.653872 -1.83569 
--0.917302 1.01955 -1.95127 
--0.931704 0.787899 -2.06613 
--0.951775 0.729199 -2.15072 
--1.55521 0.591727 -1.90989 
--0.916245 0.591191 -2.19758 
--1.51684 0.444141 -1.94103 
--2.89416 -0.293492 -1.69366 
--2.20873 -0.084916 -2.25201 
--1.64363 0.058334 -2.43844 
--0.948287 0.148704 -2.63546 
--4.28121 -1.23602 -1.86668 
--4.31184 -1.20063 -1.18539 
--4.41342 -1.36602 -1.81725 
--3.18982 -1.09823 -2.69034 
--4.07592 -1.65577 -2.42746 
--2.38693 -0.750937 -2.862 
--1.7195 -0.583459 -3.01385 
--0.992348 -0.495836 -3.17746 
--0.917138 -0.807683 -3.2316 
--1.66854 -0.878633 -3.08697 
--2.29817 -1.04051 -2.95999 
--3.11579 -1.32048 -2.78117 
--4.38354 -1.80351 -1.70446 
--3.74264 -2.35777 -2.27938 
--3.67798 -2.90606 -1.68305 
--3.63881 -3.24171 -1.35384 
--3.51253 -3.72645 -0.968948 
--3.28763 -4.20136 -0.669328 
--3.10444 -4.54345 -0.512972 
--2.88229 -4.75316 -0.407417 
--2.63698 -4.99993 -0.302704 
--2.49222 -5.23389 -0.221049 
--2.3512 -5.43541 -0.151886 
--0.681818 -1.56571 -2.71684 
--1.35017 -1.67514 -2.53973 
--1.84782 -1.74594 -2.45708 
--2.75622 -1.99017 -2.29626 
--0.518024 -2.10815 -2.28922 
--1.08679 -2.19117 -2.14977 
--1.53827 -2.28906 -2.0182 
--1.96407 -2.352 -1.90948 
--2.64002 -2.51801 -1.71451 
--0.44787 -2.51034 -2.13596 
--0.983234 -2.5831 -1.99972 
--1.46665 -2.7101 -1.83974 
--2.07379 -2.82287 -1.61253 
--2.70589 -3.01017 -1.35665 
--0.342392 -3.01133 -2.03468 
--0.865371 -3.1137 -1.90068 
--1.35565 -3.23425 -1.73538 
--1.78257 -3.38436 -1.49597 
--2.21345 -3.53735 -1.17981 
--2.64201 -3.59015 -0.976034 
--0.208197 -3.46217 -2.00383 
--0.730909 -3.56852 -1.8981 
--1.24398 -3.66319 -1.70561 
--1.65856 -3.76853 -1.45129 
--2.09688 -3.93888 -1.01188 
--2.55587 -3.97232 -0.738809 
--0.090155 -3.81937 -2.04535 
--0.670606 -3.91565 -1.92693 
--1.15938 -3.98773 -1.72075 
--1.55232 -4.10324 -1.43629 
--2.01066 -4.25018 -0.897486 
--2.46865 -4.33771 -0.565898 
--0.097358 -4.2071 -2.08748 
--0.635255 -4.23469 -1.94546 
--1.12077 -4.32377 -1.72459 
--1.50273 -4.48221 -1.40554 
--1.88257 -4.59567 -0.852173 
--2.41234 -4.64447 -0.439763 
--0.110803 -4.44991 -2.12065 
--0.124695 -4.68502 -2.15276 
--0.115238 -4.99269 -2.20753 
--0.620858 -4.48334 -1.97961 
--0.611104 -4.72398 -2.01892 
--0.595195 -5.03812 -2.07909 
--1.0865 -4.58847 -1.74618 
--1.06436 -4.82352 -1.7657 
--1.03139 -5.10085 -1.80622 
--1.46917 -4.72807 -1.39675 
--1.41586 -4.95443 -1.40899 
--1.3765 -5.23486 -1.42648 
--1.79033 -4.90605 -0.797175 
--1.68622 -5.16383 -0.782295 
--1.59625 -5.43677 -0.777835 
--2.26091 -4.95199 -0.323219 
--2.1214 -5.16678 -0.272905 
--2.01533 -5.38751 -0.191249 
--0.173271 -6.03088 1.84868 
--0.409214 -6.03088 1.77943 
--1.42051 -6.03088 -0.868995 
--1.22495 -6.03088 -1.54361 
--0.91784 -6.03088 -1.93854 
--0.529666 -6.03088 -2.22234 
--0.102551 -6.03088 -2.35592 
--0.452853 -6.03088 1.86989 
--0.540109 -6.03088 2.06603 
--0.66694 -6.03088 2.12605 
--0.83899 -6.03088 1.96215 
--0.982628 -6.03088 1.79789 
--1.08906 -6.03088 1.73616 
--1.23486 -6.03088 1.67669 
--1.33463 -6.03088 1.63662 
--1.47975 -6.03088 1.63387 
--1.51747 -6.03088 1.42279 
--2.16117 -6.03088 1.091 
--2.50683 -6.03088 0.750036 
--2.36379 -6.03088 0.116081 
--2.22501 -6.03088 -0.140141 
--2.09234 -6.03088 -0.21799 
--1.79345 -6.03088 -0.258928 
-1.64433 -1.32705 0.804401 
-1.8745 0.840434 -0.825335 
-1.65319 0.929418 -0.708563 
-1.78991 0.559574 -0.484963 
-2.02225 0.544661 -0.586962 
-1.61955 1.08566 -0.484865 
-1.70934 0.70881 -0.303075 
-1.49406 1.26558 -0.28435 
-1.60859 0.873861 -0.115187 
-1.67916 0.633915 0.029714 
-1.77839 0.482136 -0.139324 
-1.87246 0.346143 -0.310705 
-2.14529 0.339204 -0.375192 
-1.91572 0.040941 -0.014837 
-2.20123 0.000293 -0.064496 
-1.76452 0.177998 0.117671 
-1.67603 0.329475 0.229159 
-1.55578 0.021224 0.505726 
-1.71896 -0.160742 0.469903 
-1.27039 -0.147104 0.784968 
-1.52673 -0.330392 0.664287 
-1.39474 -0.413036 0.760716 
-0.965119 -0.260672 0.95435 
-1.13358 -0.529377 0.87648 
-0.660852 -0.430087 1.02641 
-0.890434 -0.667131 1.03014 
-1.0839 -0.908114 0.962937 
-1.2921 -0.754556 0.823783 
-1.49741 -0.724919 0.744497 
-1.77403 -0.55782 0.533113 
-1.91887 -0.33156 0.339632 
-2.29322 -0.484214 0.339257 
-1.87045 -0.652197 0.450844 
-2.20463 -0.76189 0.492489 
-1.92056 -0.911602 0.635633 
-2.15001 -1.07767 0.738764 
-1.17333 -0.937966 0.974752 
-1.35925 -0.802611 0.864891 
-1.56481 -0.797042 0.792898 
-1.86334 -0.977168 0.91409 
-2.10774 -1.14322 0.953456 
-1.71582 -0.929656 0.966024 
-1.61838 -0.925175 1.02969 
-1.36961 -1.01534 1.11968 
-1.83285 -1.02053 1.18526 
-1.62604 -1.07674 1.28861 
-1.7141 -1.0936 1.31899 
-1.84871 -1.143 1.3415 
-1.98353 -1.1571 1.2747 
-2.04525 -1.15372 1.16885 
-1.9296 0.766195 -0.868969 
-2.11674 0.495058 -0.601314 
-2.25591 0.276612 -0.416612 
-2.28126 -0.081355 -0.119904 
-2.3606 -0.599489 0.198334 
-2.29063 -0.891433 0.390191 
-2.14954 -1.23485 0.593719 
-2.05049 -1.36673 0.809457 
-1.94786 -1.38145 0.959888 
-1.77285 -1.32838 1.09563 
-1.56498 -1.26152 1.03431 
-1.53591 -1.29811 0.807226 
-1.49729 -1.33913 0.841721 
-1.40243 -1.22617 0.788059 
-1.36458 -1.18079 0.924075 
-0.979704 -2.07131 1.34242 
-1.00292 -2.14432 1.41597 
-1.28868 -1.81886 1.33745 
-1.1848 -2.36009 1.6206 
-1.49933 -1.6199 1.25979 
-1.15066 -2.57788 1.70571 
-1.13857 -2.3557 1.60807 
-1.0761 -2.44146 1.6405 
-0.986579 -2.34427 1.58893 
-0.946039 -2.13957 1.40532 
-0.911458 -2.00659 1.29308 
-1.22679 -1.75878 1.26394 
-1.43033 -1.6059 1.24214 
-1.18529 -1.49444 1.03959 
-1.10621 -1.68525 1.17028 
-1.00321 -1.85319 1.20418 
-1.06246 -1.71022 1.14746 
-0.987919 -1.57773 0.943063 
-1.01149 -1.46615 0.849459 
-1.41255 -1.26547 0.846861 
-1.16317 -1.08363 0.749894 
-1.21502 -1.13988 0.631844 
-1.09044 -1.02351 0.678469 
-1.14006 -1.08562 0.548845 
-1.32274 -1.28229 0.839324 
-1.1259 -1.24788 0.726983 
-0.97596 -1.25364 0.439031 
-0.95107 -1.49034 0.657946 
-0.923414 -1.56325 0.752181 
-1.05316 -0.94726 0.364276 
-1.03187 -0.910848 0.501241 
-0.972473 -0.904372 0.702188 
-0.953346 -0.798897 0.56064 
-0.945703 -0.793197 0.352311 
-0.881827 -0.723916 0.435746 
-0.723647 -0.597074 0.645566 
-0.75786 -0.781188 0.456694 
-0.776626 -0.858709 0.397058 
-0.882614 -0.775412 0.755154 
-0.666779 -0.552895 0.796182 
-0.611036 -0.525612 0.788876 
-0.562304 -0.41658 0.969606 
-0.876471 -0.148345 0.90486 
-1.1381 -0.091895 0.774442 
-1.48518 0.079724 0.500447 
-1.59616 0.37936 0.235293 
-1.56667 0.634397 0.073622 
-1.51245 0.897163 -0.076482 
-1.41237 1.28183 -0.310801 
-0.525206 -0.699021 0.685298 
-0.542374 -0.8423 0.544174 
-0.552893 -0.992161 0.508997 
-0.503536 -0.631044 0.70522 
-0.501866 -0.586513 0.662164 
-0.455321 -0.546323 0.782268 
-0.37912 -0.50701 0.863837 
-0.304694 -0.630063 0.726692 
-0.299927 -0.673631 0.76545 
-0.325211 -0.748447 0.738581 
-0.21535 -0.596543 0.743346 
-0.127284 -0.76445 0.76849 
-0.113276 -0.678553 0.767337 
-0 -0.689031 0.749186 
-0 -0.768149 0.766285 
-0.137651 -0.62293 0.687754 
-0 -0.629419 0.700115 
-0.322935 -0.90035 0.611039 
-0.344751 -1.11014 0.559124 
-0.108917 -0.939211 0.646315 
-0.123685 -1.15918 0.616287 
-0.016477 -0.926391 0.649357 
-0 -0.921285 0.65134 
-0 -1.14395 0.667317 
--0.000578 -1.14941 0.652702 
-0.654987 -3.82329 1.727 
-0.570267 -4.18679 1.77245 
-0.503207 -4.13847 1.78681 
-0.442477 -4.48928 1.78502 
-0.317156 -4.42333 1.86337 
-0.271754 -4.84092 1.83781 
-0.194708 -5.18279 1.83524 
-0.087132 -4.77266 1.92221 
-0 -5.1192 1.91797 
-0.275138 -1.98927 0.980982 
-0.302674 -1.92534 0.896202 
-0.228664 -1.93878 0.914844 
-0.185271 -2.03647 1.14215 
-0.085459 -1.9889 0.95337 
-0 -1.9889 0.95337 
-0 -2.03647 1.14215 
-0 -2.07786 1.22995 
-0.159347 -2.07786 1.22995 
-0 -2.18685 1.38489 
-0.081716 -2.18685 1.38489 
-0 -2.2839 1.48675 
-0.056561 -2.2839 1.48675 
-0 -2.41992 1.57493 
-0.068819 -2.41992 1.57493 
-0 -2.65466 1.791 
-0.142751 -2.65466 1.791 
-0 -2.826 1.88339 
-0.216434 -2.826 1.88339 
-0 -3.21457 1.963 
-0.357668 -3.21457 1.963 
-0 -3.42835 1.7993 
-0.582558 -3.42835 1.7993 
-0 -3.57208 1.80514 
-0 -3.82329 1.727 
-0 -4.13847 1.78681 
-0 -4.42333 1.86337 
-0 -4.77266 1.92221 
--1.64433 -1.32705 0.804401 
--2.02225 0.544661 -0.586962 
--1.78991 0.559574 -0.484963 
--1.65319 0.929418 -0.708563 
--1.8745 0.840434 -0.825335 
--1.70934 0.70881 -0.303075 
--1.61955 1.08566 -0.484865 
--1.60859 0.873861 -0.115187 
--1.49406 1.26558 -0.28435 
--1.77839 0.482136 -0.139324 
--1.67916 0.633915 0.029714 
--1.87246 0.346143 -0.310705 
--2.14529 0.339204 -0.375192 
--2.20123 0.000293 -0.064496 
--1.91572 0.040941 -0.014837 
--1.76452 0.177998 0.117671 
--1.67603 0.329475 0.229159 
--1.71896 -0.160742 0.469903 
--1.55578 0.021224 0.505726 
--1.52673 -0.330392 0.664287 
--1.27039 -0.147104 0.784968 
--1.39474 -0.413036 0.760716 
--1.13358 -0.529377 0.87648 
--0.965119 -0.260672 0.95435 
--0.890434 -0.667131 1.03014 
--0.660852 -0.430087 1.02641 
--1.2921 -0.754556 0.823783 
--1.0839 -0.908114 0.962937 
--1.49741 -0.724919 0.744497 
--1.77403 -0.55782 0.533113 
--1.91887 -0.33156 0.339632 
--2.29322 -0.484214 0.339257 
--2.20463 -0.76189 0.492489 
--1.87045 -0.652197 0.450844 
--1.92056 -0.911602 0.635633 
--2.15001 -1.07767 0.738764 
--1.35925 -0.802611 0.864891 
--1.17333 -0.937966 0.974752 
--1.56481 -0.797042 0.792898 
--2.10774 -1.14322 0.953456 
--1.86334 -0.977168 0.91409 
--1.71582 -0.929656 0.966024 
--1.61838 -0.925175 1.02969 
--1.36961 -1.01534 1.11968 
--1.83285 -1.02053 1.18526 
--1.62604 -1.07674 1.28861 
--1.7141 -1.0936 1.31899 
--1.84871 -1.143 1.3415 
--1.98353 -1.1571 1.2747 
--2.04525 -1.15372 1.16885 
--2.11674 0.495058 -0.601314 
--1.9296 0.766195 -0.868969 
--2.25591 0.276612 -0.416612 
--2.28126 -0.081355 -0.119904 
--2.3606 -0.599489 0.198334 
--2.29063 -0.891433 0.390191 
--2.14954 -1.23485 0.593719 
--1.94786 -1.38145 0.959888 
--2.05049 -1.36673 0.809457 
--1.77285 -1.32838 1.09563 
--1.53591 -1.29811 0.807226 
--1.56498 -1.26152 1.03431 
--1.49729 -1.33913 0.841721 
--1.40243 -1.22617 0.788059 
--1.36458 -1.18079 0.924075 
--1.00292 -2.14432 1.41597 
--0.979704 -2.07131 1.34242 
--1.28868 -1.81886 1.33745 
--1.1848 -2.36009 1.6206 
--1.49933 -1.6199 1.25979 
--1.15066 -2.57788 1.70571 
--1.0761 -2.44146 1.6405 
--1.13857 -2.3557 1.60807 
--0.986579 -2.34427 1.58893 
--0.946039 -2.13957 1.40532 
--0.911458 -2.00659 1.29308 
--1.22679 -1.75878 1.26394 
--1.43033 -1.6059 1.24214 
--1.10621 -1.68525 1.17028 
--1.18529 -1.49444 1.03959 
--1.00321 -1.85319 1.20418 
--1.06246 -1.71022 1.14746 
--0.987919 -1.57773 0.943063 
--1.01149 -1.46615 0.849459 
--1.41255 -1.26547 0.846861 
--1.21502 -1.13988 0.631844 
--1.16317 -1.08363 0.749894 
--1.14006 -1.08562 0.548845 
--1.09044 -1.02351 0.678469 
--1.32274 -1.28229 0.839324 
--1.1259 -1.24788 0.726983 
--0.97596 -1.25364 0.439031 
--0.95107 -1.49034 0.657946 
--0.923414 -1.56325 0.752181 
--1.05316 -0.94726 0.364276 
--1.03187 -0.910848 0.501241 
--0.972473 -0.904372 0.702188 
--0.945703 -0.793197 0.352311 
--0.953346 -0.798897 0.56064 
--0.881827 -0.723916 0.435746 
--0.723647 -0.597074 0.645566 
--0.75786 -0.781188 0.456694 
--0.776626 -0.858709 0.397058 
--0.882614 -0.775412 0.755154 
--0.666779 -0.552895 0.796182 
--0.611036 -0.525612 0.788876 
--0.562304 -0.41658 0.969606 
--0.876471 -0.148345 0.90486 
--1.1381 -0.091895 0.774442 
--1.48518 0.079724 0.500447 
--1.59616 0.37936 0.235293 
--1.56667 0.634397 0.073622 
--1.51245 0.897163 -0.076482 
--1.41237 1.28183 -0.310801 
--0.542374 -0.8423 0.544174 
--0.525206 -0.699021 0.685298 
--0.552893 -0.992161 0.508997 
--0.503536 -0.631044 0.70522 
--0.501866 -0.586513 0.662164 
--0.455321 -0.546323 0.782268 
--0.37912 -0.50701 0.863837 
--0.299927 -0.673631 0.76545 
--0.304694 -0.630063 0.726692 
--0.325211 -0.748447 0.738581 
--0.21535 -0.596543 0.743346 
--0.113276 -0.678553 0.767337 
--0.127284 -0.76445 0.76849 
--0.137651 -0.62293 0.687754 
--0.322935 -0.90035 0.611039 
--0.344751 -1.11014 0.559124 
--0.123685 -1.15918 0.616287 
--0.108917 -0.939211 0.646315 
--0.016477 -0.926391 0.649357 
-0.000578 -1.14941 0.652702 
--0.654987 -3.82329 1.727 
--0.570267 -4.18679 1.77245 
--0.503207 -4.13847 1.78681 
--0.442477 -4.48928 1.78502 
--0.317156 -4.42333 1.86337 
--0.271754 -4.84092 1.83781 
--0.194708 -5.18279 1.83524 
--0.087132 -4.77266 1.92221 
--0.228664 -1.93878 0.914844 
--0.302674 -1.92534 0.896202 
--0.275138 -1.98927 0.980982 
--0.085459 -1.9889 0.95337 
--0.185271 -2.03647 1.14215 
--0.159347 -2.07786 1.22995 
--0.081716 -2.18685 1.38489 
--0.056561 -2.2839 1.48675 
--0.068819 -2.41992 1.57493 
--0.142751 -2.65466 1.791 
--0.216434 -2.826 1.88339 
--0.357668 -3.21457 1.963 
--0.582558 -3.42835 1.7993 
-2.53621 -2.94821 0.958051 
-2.66358 -2.83469 0.861852 
-2.88217 -2.93735 0.843545 
-2.92534 -3.10088 0.894157 
-2.75687 -3.22978 1.00708 
-2.55549 -3.08917 1.02227 
-2.67439 -2.93762 0.933123 
-2.78041 -2.97245 0.918971 
-2.627 -2.98733 0.979362 
-2.62952 -3.05221 1.00242 
-2.75097 -3.11111 0.986978 
-2.80791 -3.0451 0.930632 
-2.7177 -3.03012 0.972204 
--2.66358 -2.83469 0.861852 
--2.53621 -2.94821 0.958051 
--2.88217 -2.93735 0.843545 
--2.92534 -3.10088 0.894157 
--2.75687 -3.22978 1.00708 
--2.55549 -3.08917 1.02227 
--2.78041 -2.97245 0.918971 
--2.67439 -2.93762 0.933123 
--2.627 -2.98733 0.979362 
--2.62952 -3.05221 1.00242 
--2.75097 -3.11111 0.986978 
--2.80791 -3.0451 0.930632 
--2.7177 -3.03012 0.972204 
-0.83162 -1.50774 0.611914 
-0.772368 -1.36333 0.594727 
-0.706202 -1.44575 0.661758 
-0.899215 -1.07984 0.440476 
-0.696132 -1.18218 0.597604 
-0.541634 -1.35772 0.706386 
-0.840242 -0.927747 0.424596 
-0.620113 -1.06801 0.584601 
-0.40603 -1.18137 0.658817 
-0.588595 -1.03178 0.557169 
-0.372288 -1.14357 0.620912 
-0.223761 -1.18566 0.654281 
-0.250869 -1.22652 0.715051 
-0.306132 -1.32829 0.761379 
-0.139737 -1.17161 0.699986 
--0.004388 -1.17417 0.722007 
-0 -1.17053 0.755149 
-0 -1.19524 0.832548 
--0.007583 -1.1912 0.792125 
-0.127929 -1.19389 0.754604 
-0.24136 -1.27816 0.814638 
-0.13037 -1.25481 0.861437 
-0.03309 -1.25403 0.896798 
-0 -1.25558 0.924864 
-0.274387 -1.43739 0.895555 
-0.260266 -1.42941 0.950578 
-0.166855 -1.399 0.996518 
-0 -1.38662 1.03901 
-0.490997 -1.45208 1.07906 
-0.672423 -1.32111 1.05825 
-0.733092 -1.44684 0.88367 
-0.777042 -1.37449 1.17979 
-0.852626 -1.50031 1.05254 
-0.806198 -1.46826 0.783523 
-0.957618 -1.55018 0.980468 
-1.06125 -1.69358 1.24992 
-0.991865 -1.64375 1.30948 
-0.918461 -1.55902 1.39703 
-0.600731 -1.52927 1.20176 
-1.04367 -1.73899 1.30745 
-0.961809 -1.79336 1.51481 
-0.871396 -1.70736 1.60036 
-0.643279 -1.59742 1.34435 
-0.616929 -1.64779 1.44168 
-0.803006 -1.78821 1.65691 
-0.729624 -1.99923 1.4288 
-0.923605 -2.04724 1.52876 
-0.887021 -2.08962 1.74012 
-0.908608 -2.26812 1.57088 
-0.80478 -2.01798 1.53363 
-0.752157 -2.0405 1.66239 
-0.544718 -2.04448 1.66841 
-0.628571 -2.05058 1.84526 
-0.697121 -2.14715 1.90116 
-0.550252 -1.90705 1.78728 
-0.487346 -1.72454 1.54944 
-0.395899 -1.82525 1.64042 
-0.25085 -1.63798 1.01585 
-0.244374 -1.65823 0.946017 
-0.123817 -1.64274 1.10777 
-0 -1.61284 1.11706 
-0 -1.83829 1.09017 
-0.075363 -1.84282 1.07142 
-0.245409 -1.81066 0.985872 
-0.304946 -1.8052 0.97447 
-0 -2.00002 0.997148 
-0.296986 -1.69917 1.05187 
-0.439278 -1.77072 1.22379 
-0.314085 -1.88332 1.37137 
-0.179735 -1.98447 1.4948 
-0.32483 -1.84137 1.00366 
-0.222738 -1.89441 1.15533 
-0.172525 -1.97874 1.23104 
-0.114834 -2.16285 1.42051 
-0.093712 -2.25552 1.48858 
-0.112533 -2.12555 1.54308 
-0.12404 -2.38326 1.61881 
-0.150668 -2.03918 1.68102 
-0.190912 -2.60781 1.82126 
-0.240723 -2.60203 1.8119 
-0.306947 -2.58209 1.86217 
-0.405686 -2.47487 1.99099 
-0.226778 -2.09017 1.90755 
-0.3484 -2.0023 1.88429 
-0.42988 -2.10529 1.81344 
-0.510107 -2.12067 1.94444 
-0.581623 -2.18791 2.00863 
-0.478191 -2.1571 2.00102 
-0.940866 -2.32846 1.66095 
-1.01587 -2.42197 1.74924 
-1.13026 -2.6722 1.89534 
-1.13301 -3.05626 1.99846 
-0.829619 -3.39583 1.96193 
-0.886282 -2.90006 1.864 
-0.973873 -2.6651 1.90958 
-0.872574 -2.48038 1.7292 
-0.924078 -2.53985 1.80479 
-0.850053 -2.39968 1.65688 
-0.773483 -3.52545 1.92006 
-0.677365 -3.39553 1.91346 
-0.490297 -3.08107 2.0017 
-0.442003 -3.1814 2.02379 
-0.371433 -2.70644 1.89706 
-0.289637 -2.71713 1.95657 
-0.833722 -2.31991 1.58869 
-0.723318 -2.27754 1.88769 
-0.833002 -2.32345 1.83779 
-0.692294 -2.37174 1.91305 
-0.838047 -2.45322 1.88392 
-0.641657 -2.58822 1.9404 
-0.83545 -2.39253 1.6662 
-0.863047 -2.46492 1.73332 
-0.611144 -2.55097 2.00412 
-0.586612 -2.67634 1.97396 
-0.69244 -3.06073 1.99367 
--0.772368 -1.36333 0.594727 
--0.83162 -1.50774 0.611914 
--0.706202 -1.44575 0.661758 
--0.899215 -1.07984 0.440476 
--0.696132 -1.18218 0.597604 
--0.541634 -1.35772 0.706386 
--0.840242 -0.927747 0.424596 
--0.620113 -1.06801 0.584601 
--0.40603 -1.18137 0.658817 
--0.588595 -1.03178 0.557169 
--0.372288 -1.14357 0.620912 
--0.250869 -1.22652 0.715051 
--0.223761 -1.18566 0.654281 
--0.306132 -1.32829 0.761379 
-0.004388 -1.17417 0.722007 
--0.139737 -1.17161 0.699986 
-0.007583 -1.1912 0.792125 
--0.127929 -1.19389 0.754604 
--0.24136 -1.27816 0.814638 
--0.13037 -1.25481 0.861437 
--0.03309 -1.25403 0.896798 
--0.274387 -1.43739 0.895555 
--0.260266 -1.42941 0.950578 
--0.166855 -1.399 0.996518 
--0.672423 -1.32111 1.05825 
--0.490997 -1.45208 1.07906 
--0.733092 -1.44684 0.88367 
--0.852626 -1.50031 1.05254 
--0.777042 -1.37449 1.17979 
--0.806198 -1.46826 0.783523 
--0.957618 -1.55018 0.980468 
--1.06125 -1.69358 1.24992 
--0.991865 -1.64375 1.30948 
--0.918461 -1.55902 1.39703 
--0.600731 -1.52927 1.20176 
--1.04367 -1.73899 1.30745 
--0.961809 -1.79336 1.51481 
--0.871396 -1.70736 1.60036 
--0.643279 -1.59742 1.34435 
--0.616929 -1.64779 1.44168 
--0.803006 -1.78821 1.65691 
--0.729624 -1.99923 1.4288 
--0.923605 -2.04724 1.52876 
--0.908608 -2.26812 1.57088 
--0.887021 -2.08962 1.74012 
--0.80478 -2.01798 1.53363 
--0.752157 -2.0405 1.66239 
--0.628571 -2.05058 1.84526 
--0.544718 -2.04448 1.66841 
--0.697121 -2.14715 1.90116 
--0.550252 -1.90705 1.78728 
--0.487346 -1.72454 1.54944 
--0.395899 -1.82525 1.64042 
--0.244374 -1.65823 0.946017 
--0.25085 -1.63798 1.01585 
--0.123817 -1.64274 1.10777 
--0.075363 -1.84282 1.07142 
--0.245409 -1.81066 0.985872 
--0.304946 -1.8052 0.97447 
--0.296986 -1.69917 1.05187 
--0.439278 -1.77072 1.22379 
--0.314085 -1.88332 1.37137 
--0.179735 -1.98447 1.4948 
--0.32483 -1.84137 1.00366 
--0.222738 -1.89441 1.15533 
--0.172525 -1.97874 1.23104 
--0.114834 -2.16285 1.42051 
--0.112533 -2.12555 1.54308 
--0.093712 -2.25552 1.48858 
--0.12404 -2.38326 1.61881 
--0.150668 -2.03918 1.68102 
--0.190912 -2.60781 1.82126 
--0.240723 -2.60203 1.8119 
--0.306947 -2.58209 1.86217 
--0.226778 -2.09017 1.90755 
--0.405686 -2.47487 1.99099 
--0.3484 -2.0023 1.88429 
--0.42988 -2.10529 1.81344 
--0.510107 -2.12067 1.94444 
--0.581623 -2.18791 2.00863 
--0.478191 -2.1571 2.00102 
--0.940866 -2.32846 1.66095 
--1.01587 -2.42197 1.74924 
--1.13026 -2.6722 1.89534 
--1.13301 -3.05626 1.99846 
--0.829619 -3.39583 1.96193 
--0.886282 -2.90006 1.864 
--0.973873 -2.6651 1.90958 
--0.924078 -2.53985 1.80479 
--0.872574 -2.48038 1.7292 
--0.850053 -2.39968 1.65688 
--0.773483 -3.52545 1.92006 
--0.677365 -3.39553 1.91346 
--0.442003 -3.1814 2.02379 
--0.490297 -3.08107 2.0017 
--0.289637 -2.71713 1.95657 
--0.371433 -2.70644 1.89706 
--0.833722 -2.31991 1.58869 
--0.723318 -2.27754 1.88769 
--0.833002 -2.32345 1.83779 
--0.838047 -2.45322 1.88392 
--0.692294 -2.37174 1.91305 
--0.641657 -2.58822 1.9404 
--0.83545 -2.39253 1.6662 
--0.863047 -2.46492 1.73332 
--0.611144 -2.55097 2.00412 
--0.586612 -2.67634 1.97396 
--0.69244 -3.06073 1.99367 
-1.45086 1.45705 0.528348 
-1.59426 1.55834 0.626987 
-1.65043 1.61724 0.680182 
-1.54526 1.74215 0.824324 
-1.65576 1.8259 0.954174 
-1.59715 1.91464 1.00631 
-1.7627 1.65599 0.631224 
-1.76299 1.80572 0.775415 
-1.9495 1.84984 0.823902 
-1.76077 1.85065 1.0654 
-1.74362 1.99795 1.23462 
-1.49747 2.13374 1.1911 
-1.7561 2.21664 1.31992 
-0.327215 3.61761 3.16596 
-0 3.45546 3.19725 
-0 3.83536 3.34742 
-0.49034 3.72708 3.0289 
-0.833423 3.57912 2.95228 
-1.18657 3.53715 2.88378 
-1.27451 3.42949 2.34081 
-1.51539 3.46293 2.4993 
-1.72966 2.98573 2.12696 
-1.58733 3.27325 2.27988 
-1.80259 2.67303 2.07179 
-1.8835 2.4212 1.85278 
-1.78981 1.74517 0.195716 
-1.6524 1.6352 0.100315 
-1.61621 1.63182 0.140151 
-2.02491 1.6849 0.590685 
-2.08124 1.73977 0.560523 
-2.10169 1.84193 0.704701 
-2.312 1.66706 0.54433 
-2.13922 1.49363 0.307465 
-1.84743 1.19231 -0.235521 
-2.03996 1.26356 -0.10667 
-2.00178 1.17893 -0.53887 
-2.12027 1.18143 -0.439203 
-1.95567 1.11205 -0.65084 
-2.0352 1.05821 -0.740662 
-2.50667 1.35421 -0.177264 
-2.5568 1.42584 0.234125 
-2.62558 1.66785 0.406381 
-2.57219 1.66594 0.610608 
-2.314 1.93712 1.04395 
-2.37056 2.18864 1.31994 
-1.79536 2.31226 1.4486 
-2.2988 2.37833 1.4841 
-2.43192 2.42086 1.79186 
-2.27483 2.70837 1.95329 
-2.1274 2.76378 2.17293 
-2.02782 3.05747 2.20769 
-2.21127 3.15136 2.17553 
-2.07758 3.59379 2.54406 
-2.2058 3.05323 1.99568 
-2.23458 2.85369 1.92147 
-2.49222 2.76375 1.68146 
-1.68272 3.87279 2.69984 
-1.59127 3.68753 2.79531 
-1.46979 4.22697 3.12591 
-1.41931 4.08523 3.11477 
-0.969239 4.03284 3.23762 
-0.44624 4.02519 3.17591 
-0 4.23455 3.30164 
-0.29338 4.20284 3.12617 
-0.507507 4.74909 2.92783 
-0.273753 4.90292 2.63511 
-0 4.87944 2.66216 
-0.855572 4.44395 3.26479 
-1.00122 4.43322 3.1689 
-2.63476 2.91711 1.57146 
-2.37344 3.23013 1.70144 
-2.24501 3.76286 1.97126 
-2.175 3.97464 1.86115 
-1.77247 3.91719 2.56174 
-1.69615 3.98836 2.58149 
-2.02053 4.12619 2.05733 
-1.72097 4.40171 2.02821 
-1.41798 4.55433 2.44709 
-1.3504 4.34724 2.80628 
-1.20015 4.61336 3.06319 
-1.30446 4.99702 2.24644 
-0.873342 4.70963 3.17356 
-0.69617 4.78404 2.81913 
-0.424844 4.97854 2.24606 
-0.696076 5.19322 2.02619 
-0.635427 5.51565 1.33174 
-0 5.54417 1.14183 
-0 5.22257 1.99659 
-0 5.08592 2.30915 
-1.51174 4.93809 1.52149 
-1.90679 4.42285 1.79598 
-2.35455 3.70565 1.67022 
-2.64494 3.81463 1.42574 
-2.42155 3.77924 0.825727 
-2.20304 4.21662 1.15412 
-2.2517 4.26915 0.470671 
-1.78853 4.80961 0.096426 
-1.60139 4.89572 0.83814 
-2.54302 3.22818 1.36369 
-2.58833 3.23654 1.22854 
-2.62956 3.16481 0.666688 
-2.33697 3.75401 -0.076831 
-2.69544 2.59419 0.979715 
-2.70344 2.832 0.591982 
-2.43001 2.81146 0.125791 
-2.20714 3.07876 -0.379399 
-2.90404 2.24721 0.893879 
-2.66632 2.01022 0.643661 
-2.56923 2.36897 0.316299 
-2.56093 2.35942 -0.171605 
-2.26532 2.57683 -0.675925 
-2.33665 2.02939 -0.421402 
-2.28442 2.02263 -0.855935 
-2.15045 1.47684 -0.584277 
-2.16779 1.51462 -0.809225 
-2.64345 1.92542 -0.01895 
-2.07938 1.11058 -1.19582 
-0.894334 1.45868 -2.05369 
-1.63915 1.53068 -1.82524 
-0 1.41121 -2.3773 
-0 2.15047 -2.4464 
-1.02946 2.24387 -2.27344 
-1.68425 2.19638 -1.81278 
-1.69538 2.76301 -1.39814 
-1.87691 2.72828 -1.16657 
-0 3.00778 -2.13808 
-0.875196 3.02126 -1.97871 
-1.78215 3.54208 -0.994194 
-2.10716 3.38469 -0.769274 
-0.844364 4.03324 -1.65079 
-0 4.16032 -1.99261 
-1.79631 4.11807 -0.761666 
-0.742722 4.66367 -1.20484 
-0 4.68586 -1.43263 
-0 5.23261 -0.488459 
-0.846059 5.2651 -0.35371 
-0.689895 5.51242 0.378273 
-0 5.53068 0.336697 
-2.17394 1.46651 -1.02251 
--1.45086 1.45705 0.528348 
--1.59426 1.55834 0.626987 
--1.65043 1.61724 0.680182 
--1.54526 1.74215 0.824324 
--1.65576 1.8259 0.954174 
--1.59715 1.91464 1.00631 
--1.76299 1.80572 0.775415 
--1.7627 1.65599 0.631224 
--1.76077 1.85065 1.0654 
--1.9495 1.84984 0.823902 
--1.49747 2.13374 1.1911 
--1.74362 1.99795 1.23462 
--1.7561 2.21664 1.31992 
--0.327215 3.61761 3.16596 
--0.49034 3.72708 3.0289 
--0.833423 3.57912 2.95228 
--1.18657 3.53715 2.88378 
--1.51539 3.46293 2.4993 
--1.27451 3.42949 2.34081 
--1.58733 3.27325 2.27988 
--1.72966 2.98573 2.12696 
--1.80259 2.67303 2.07179 
--1.8835 2.4212 1.85278 
--1.61621 1.63182 0.140151 
--1.6524 1.6352 0.100315 
--1.78981 1.74517 0.195716 
--2.02491 1.6849 0.590685 
--2.08124 1.73977 0.560523 
--2.10169 1.84193 0.704701 
--2.312 1.66706 0.54433 
--2.13922 1.49363 0.307465 
--2.03996 1.26356 -0.10667 
--1.84743 1.19231 -0.235521 
--2.12027 1.18143 -0.439203 
--2.00178 1.17893 -0.53887 
--1.95567 1.11205 -0.65084 
--2.0352 1.05821 -0.740662 
--2.50667 1.35421 -0.177264 
--2.5568 1.42584 0.234125 
--2.57219 1.66594 0.610608 
--2.62558 1.66785 0.406381 
--2.314 1.93712 1.04395 
--2.37056 2.18864 1.31994 
--1.79536 2.31226 1.4486 
--2.2988 2.37833 1.4841 
--2.43192 2.42086 1.79186 
--2.27483 2.70837 1.95329 
--2.1274 2.76378 2.17293 
--2.02782 3.05747 2.20769 
--2.07758 3.59379 2.54406 
--2.21127 3.15136 2.17553 
--2.2058 3.05323 1.99568 
--2.23458 2.85369 1.92147 
--2.49222 2.76375 1.68146 
--1.68272 3.87279 2.69984 
--1.59127 3.68753 2.79531 
--1.41931 4.08523 3.11477 
--1.46979 4.22697 3.12591 
--0.969239 4.03284 3.23762 
--0.44624 4.02519 3.17591 
--0.29338 4.20284 3.12617 
--0.273753 4.90292 2.63511 
--0.507507 4.74909 2.92783 
--0.855572 4.44395 3.26479 
--1.00122 4.43322 3.1689 
--2.63476 2.91711 1.57146 
--2.24501 3.76286 1.97126 
--2.37344 3.23013 1.70144 
--1.77247 3.91719 2.56174 
--2.175 3.97464 1.86115 
--1.69615 3.98836 2.58149 
--2.02053 4.12619 2.05733 
--1.72097 4.40171 2.02821 
--1.3504 4.34724 2.80628 
--1.41798 4.55433 2.44709 
--1.20015 4.61336 3.06319 
--1.30446 4.99702 2.24644 
--0.873342 4.70963 3.17356 
--0.69617 4.78404 2.81913 
--0.424844 4.97854 2.24606 
--0.635427 5.51565 1.33174 
--0.696076 5.19322 2.02619 
--1.51174 4.93809 1.52149 
--1.90679 4.42285 1.79598 
--2.35455 3.70565 1.67022 
--2.64494 3.81463 1.42574 
--2.20304 4.21662 1.15412 
--2.42155 3.77924 0.825727 
--2.2517 4.26915 0.470671 
--1.60139 4.89572 0.83814 
--1.78853 4.80961 0.096426 
--2.54302 3.22818 1.36369 
--2.58833 3.23654 1.22854 
--2.62956 3.16481 0.666688 
--2.33697 3.75401 -0.076831 
--2.69544 2.59419 0.979715 
--2.70344 2.832 0.591982 
--2.43001 2.81146 0.125791 
--2.20714 3.07876 -0.379399 
--2.90404 2.24721 0.893879 
--2.66632 2.01022 0.643661 
--2.56923 2.36897 0.316299 
--2.56093 2.35942 -0.171605 
--2.26532 2.57683 -0.675925 
--2.28442 2.02263 -0.855935 
--2.33665 2.02939 -0.421402 
--2.16779 1.51462 -0.809225 
--2.15045 1.47684 -0.584277 
--2.64345 1.92542 -0.01895 
--2.07938 1.11058 -1.19582 
--1.63915 1.53068 -1.82524 
--0.894334 1.45868 -2.05369 
--1.02946 2.24387 -2.27344 
--1.68425 2.19638 -1.81278 
--1.87691 2.72828 -1.16657 
--1.69538 2.76301 -1.39814 
--0.875196 3.02126 -1.97871 
--2.10716 3.38469 -0.769274 
--1.78215 3.54208 -0.994194 
--0.844364 4.03324 -1.65079 
--1.79631 4.11807 -0.761666 
--0.742722 4.66367 -1.20484 
--0.846059 5.2651 -0.35371 
--0.689895 5.51242 0.378273 
--2.17394 1.46651 -1.02251 
--0.315073 1.89817 2.50814 
--0.439859 1.93127 2.55024 
--0.626491 2.01093 2.56512 
--0.817392 2.05174 2.46799 
--1.0461 2.08268 2.20149 
-0.315073 1.89817 2.50814 
-0.439859 1.93127 2.55024 
-0.626491 2.01093 2.56512 
-0.817392 2.05174 2.46799 
-1.0461 2.08268 2.20149 
--0.399649 1.81259 2.19676 
--0.463364 1.74361 2.16862 
--0.714552 1.7651 2.12931 
--0.755854 1.82343 2.13551 
-0.399649 1.81259 2.19676 
-0.463364 1.74361 2.16862 
-0.714552 1.7651 2.12931 
-0.755854 1.82343 2.13551 
--0.502009 1.82758 2.21231 
--0.654012 1.81986 2.20449 
--0.634942 1.79791 2.19715 
--0.574174 1.7953 2.1939 
--0.534733 1.80621 2.18627 
-0.502009 1.82758 2.21231 
-0.654012 1.81986 2.20449 
-0.634942 1.79791 2.19715 
-0.574174 1.7953 2.1939 
-0.534733 1.80621 2.18627 
--0.571565 1.82473 2.22142 
-0.571565 1.82473 2.22142 
-3 0 1 2 
-3 0 2 3 
-3 0 4 1 
-3 5 6 7 
-3 5 7 8 
-3 5 8 9 
-3 9 8 10 
-3 9 10 11 
-3 11 10 12 
-3 11 12 13 
-3 14 6 15 
-3 16 15 6 
-3 16 6 5 
-3 16 5 17 
-3 17 5 9 
-3 17 9 18 
-3 19 18 9 
-3 19 9 11 
-3 19 11 13 
-3 19 13 20 
-3 21 15 16 
-3 21 16 22 
-3 22 16 17 
-3 22 17 23 
-3 23 17 18 
-3 23 18 24 
-3 24 18 19 
-3 24 19 25 
-3 25 19 20 
-3 25 20 26 
-3 27 26 28 
-3 29 28 26 
-3 29 26 20 
-3 30 31 14 
-3 30 14 15 
-3 32 30 15 
-3 32 15 21 
-3 33 32 21 
-3 33 21 34 
-3 22 34 21 
-3 35 33 34 
-3 36 34 22 
-3 36 22 23 
-3 36 23 24 
-3 36 24 37 
-3 38 34 36 
-3 34 38 39 
-3 34 39 35 
-3 40 24 25 
-3 41 25 26 
-3 42 26 27 
-3 26 42 43 
-3 26 43 41 
-3 25 41 44 
-3 25 44 40 
-3 36 37 45 
-3 36 45 38 
-3 46 45 37 
-3 46 37 47 
-3 24 40 47 
-3 24 47 37 
-3 48 47 40 
-3 48 40 44 
-3 46 47 48 
-3 46 48 49 
-3 49 48 50 
-3 49 50 51 
-3 52 50 48 
-3 52 48 44 
-3 41 43 52 
-3 41 52 44 
-3 53 39 38 
-3 53 38 45 
-3 54 53 45 
-3 54 45 46 
-3 55 54 46 
-3 55 46 49 
-3 56 55 49 
-3 56 49 51 
-3 57 58 39 
-3 59 57 39 
-3 59 39 53 
-3 60 59 53 
-3 60 53 54 
-3 61 60 54 
-3 61 54 55 
-3 62 61 55 
-3 62 55 56 
-3 63 64 65 
-3 63 65 58 
-3 63 58 57 
-3 63 57 66 
-3 64 63 66 
-3 64 66 67 
-3 68 66 57 
-3 68 57 59 
-3 69 68 59 
-3 69 59 60 
-3 70 69 60 
-3 70 60 61 
-3 62 71 70 
-3 62 70 61 
-3 72 62 56 
-3 73 71 74 
-3 71 73 75 
-3 71 75 70 
-3 70 75 76 
-3 70 76 69 
-3 69 76 77 
-3 69 77 68 
-3 68 77 67 
-3 68 67 66 
-3 78 79 80 
-3 78 80 81 
-3 81 80 82 
-3 81 82 83 
-3 83 82 67 
-3 83 67 77 
-3 84 78 81 
-3 85 78 84 
-3 86 84 81 
-3 86 81 83 
-3 76 86 83 
-3 76 83 77 
-3 87 84 86 
-3 87 86 76 
-3 87 76 75 
-3 73 87 75 
-3 88 87 73 
-3 88 73 74 
-3 84 87 89 
-3 90 89 87 
-3 90 87 88 
-3 91 42 27 
-3 91 27 92 
-3 43 42 91 
-3 43 91 93 
-3 92 27 94 
-3 95 94 27 
-3 95 27 28 
-3 96 92 97 
-3 98 97 92 
-3 98 92 94 
-3 99 98 94 
-3 99 94 95 
-3 91 92 100 
-3 101 100 92 
-3 101 92 96 
-3 102 96 103 
-3 104 103 96 
-3 104 96 105 
-3 105 96 97 
-3 105 97 106 
-3 107 106 97 
-3 107 97 98 
-3 107 98 99 
-3 107 99 108 
-3 109 102 103 
-3 109 103 110 
-3 111 109 110 
-3 111 110 112 
-3 113 111 112 
-3 113 112 114 
-3 114 112 115 
-3 114 115 116 
-3 110 115 112 
-3 104 110 103 
-3 117 116 115 
-3 117 115 118 
-3 118 115 110 
-3 118 110 104 
-3 119 117 118 
-3 119 118 120 
-3 120 118 104 
-3 120 104 105 
-3 120 105 106 
-3 120 106 121 
-3 119 120 121 
-3 119 121 122 
-3 121 123 124 
-3 121 124 122 
-3 123 121 106 
-3 123 106 107 
-3 107 108 125 
-3 107 125 123 
-3 123 125 126 
-3 123 126 124 
-3 126 125 127 
-3 126 127 128 
-3 127 125 108 
-3 127 108 129 
-3 127 129 4 
-3 127 4 0 
-3 128 127 0 
-3 128 0 3 
-3 130 101 96 
-3 130 96 102 
-3 131 130 102 
-3 131 102 109 
-3 109 111 132 
-3 133 132 111 
-3 133 111 113 
-3 134 135 136 
-3 137 136 135 
-3 137 135 138 
-3 139 136 140 
-3 139 140 141 
-3 139 141 130 
-3 131 139 130 
-3 130 141 142 
-3 130 142 101 
-3 101 142 143 
-3 101 143 100 
-3 100 143 93 
-3 100 93 91 
-3 52 43 93 
-3 52 93 144 
-3 144 93 143 
-3 144 143 145 
-3 145 143 146 
-3 143 142 146 
-3 146 142 141 
-3 146 141 147 
-3 147 141 140 
-3 147 140 148 
-3 148 140 136 
-3 148 136 149 
-3 149 136 137 
-3 149 137 150 
-3 147 151 146 
-3 152 153 154 
-3 155 146 152 
-3 146 155 156 
-3 146 156 145 
-3 145 156 157 
-3 145 157 144 
-3 144 157 50 
-3 144 50 52 
-3 149 150 158 
-3 149 158 159 
-3 149 159 160 
-3 149 160 148 
-3 148 160 151 
-3 148 151 147 
-3 154 153 161 
-3 154 161 162 
-3 162 161 163 
-3 162 163 164 
-3 164 163 165 
-3 164 165 166 
-3 166 167 168 
-3 166 168 164 
-3 164 168 169 
-3 164 169 162 
-3 162 169 170 
-3 162 170 154 
-3 154 170 171 
-3 154 171 152 
-3 152 171 172 
-3 152 172 155 
-3 135 134 173 
-3 135 173 138 
-3 133 173 134 
-3 133 134 132 
-3 155 172 174 
-3 155 174 156 
-3 156 174 175 
-3 156 175 176 
-3 156 176 177 
-3 156 177 157 
-3 157 177 51 
-3 157 51 50 
-3 177 72 56 
-3 177 56 51 
-3 178 172 171 
-3 178 171 179 
-3 179 171 170 
-3 179 170 180 
-3 180 170 169 
-3 180 169 181 
-3 181 169 168 
-3 181 168 182 
-3 182 168 167 
-3 182 167 183 
-3 183 184 185 
-3 183 185 182 
-3 182 185 186 
-3 182 186 181 
-3 181 186 187 
-3 181 187 180 
-3 180 187 188 
-3 180 188 179 
-3 188 178 179 
-3 178 189 172 
-3 190 189 178 
-3 190 178 188 
-3 191 190 188 
-3 191 188 187 
-3 192 191 187 
-3 192 187 186 
-3 193 192 186 
-3 193 186 185 
-3 194 193 185 
-3 194 185 184 
-3 195 189 190 
-3 196 195 190 
-3 196 190 191 
-3 197 196 191 
-3 197 191 192 
-3 198 197 192 
-3 198 192 193 
-3 199 198 193 
-3 199 193 194 
-3 200 198 199 
-3 200 199 201 
-3 198 200 202 
-3 198 202 197 
-3 196 197 202 
-3 196 202 203 
-3 203 195 196 
-3 200 201 204 
-3 200 204 205 
-3 200 205 206 
-3 200 206 202 
-3 202 206 207 
-3 202 207 203 
-3 203 207 208 
-3 203 208 195 
-3 195 208 189 
-3 209 189 208 
-3 209 208 207 
-3 209 207 210 
-3 210 207 206 
-3 210 206 211 
-3 211 206 205 
-3 211 205 212 
-3 212 205 204 
-3 212 204 213 
-3 214 189 209 
-3 215 189 214 
-3 216 189 215 
-3 175 189 216 
-3 174 189 175 
-3 172 189 174 
-3 177 176 217 
-3 177 217 72 
-3 216 217 176 
-3 216 176 175 
-3 218 72 217 
-3 217 216 215 
-3 219 215 214 
-3 219 214 220 
-3 220 214 209 
-3 220 209 221 
-3 210 221 209 
-3 221 210 222 
-3 221 222 223 
-3 224 222 210 
-3 224 210 211 
-3 225 224 211 
-3 225 211 212 
-3 226 225 212 
-3 226 212 213 
-3 221 223 227 
-3 221 227 220 
-3 220 227 228 
-3 220 228 219 
-3 219 228 229 
-3 219 229 218 
-3 218 229 72 
-3 62 72 230 
-3 231 230 72 
-3 231 72 229 
-3 231 229 232 
-3 228 232 229 
-3 233 232 228 
-3 233 228 227 
-3 234 233 227 
-3 234 227 223 
-3 235 234 223 
-3 235 223 222 
-3 236 235 222 
-3 236 222 224 
-3 237 236 224 
-3 237 224 225 
-3 226 237 225 
-3 62 230 238 
-3 62 238 71 
-3 239 238 230 
-3 239 230 231 
-3 240 239 231 
-3 240 231 232 
-3 241 240 232 
-3 241 232 242 
-3 242 232 233 
-3 242 233 243 
-3 234 243 233 
-3 244 242 243 
-3 244 243 245 
-3 246 245 243 
-3 246 243 234 
-3 244 241 242 
-3 246 234 235 
-3 246 235 247 
-3 247 235 236 
-3 247 236 248 
-3 248 236 237 
-3 248 237 249 
-3 250 241 251 
-3 250 251 252 
-3 250 252 253 
-3 254 250 253 
-3 255 254 253 
-3 255 253 256 
-3 257 241 244 
-3 256 253 252 
-3 245 257 244 
-3 258 257 245 
-3 258 245 246 
-3 259 258 246 
-3 259 246 247 
-3 257 258 260 
-3 257 260 261 
-3 251 241 257 
-3 251 257 261 
-3 262 250 254 
-3 240 262 263 
-3 240 263 239 
-3 239 263 264 
-3 239 264 238 
-3 238 264 74 
-3 238 74 71 
-3 262 254 265 
-3 262 265 266 
-3 262 266 267 
-3 262 267 263 
-3 263 267 268 
-3 263 268 264 
-3 264 268 88 
-3 264 88 74 
-3 269 252 251 
-3 269 251 261 
-3 269 261 260 
-3 269 260 270 
-3 271 272 273 
-3 269 272 256 
-3 269 256 252 
-3 272 271 274 
-3 272 274 256 
-3 255 256 274 
-3 255 274 275 
-3 276 274 271 
-3 276 271 277 
-3 277 271 273 
-3 277 273 278 
-3 278 273 279 
-3 278 279 280 
-3 278 280 281 
-3 282 275 274 
-3 282 274 276 
-3 269 270 273 
-3 269 273 272 
-3 277 278 281 
-3 277 281 283 
-3 280 279 284 
-3 280 284 285 
-3 279 273 286 
-3 279 286 284 
-3 286 273 270 
-3 286 270 287 
-3 287 270 260 
-3 287 260 288 
-3 260 258 259 
-3 260 259 288 
-3 285 284 289 
-3 285 289 290 
-3 276 277 283 
-3 276 283 291 
-3 282 276 291 
-3 282 291 292 
-3 293 282 292 
-3 293 292 294 
-3 282 293 295 
-3 282 295 275 
-3 255 275 295 
-3 255 295 296 
-3 296 295 297 
-3 296 297 298 
-3 299 297 295 
-3 299 295 293 
-3 300 299 293 
-3 300 293 294 
-3 301 254 255 
-3 301 255 296 
-3 265 254 301 
-3 302 301 296 
-3 302 296 298 
-3 303 265 301 
-3 303 301 302 
-3 303 302 304 
-3 265 303 266 
-3 305 299 300 
-3 305 300 306 
-3 299 305 307 
-3 299 307 297 
-3 297 307 308 
-3 297 308 298 
-3 298 308 309 
-3 298 309 302 
-3 306 310 311 
-3 306 311 305 
-3 305 311 312 
-3 305 312 307 
-3 307 312 313 
-3 307 313 308 
-3 308 313 314 
-3 308 314 309 
-3 310 315 316 
-3 310 316 311 
-3 311 316 317 
-3 311 317 312 
-3 312 317 318 
-3 312 318 313 
-3 319 316 315 
-3 319 315 320 
-3 319 321 317 
-3 319 317 316 
-3 322 321 319 
-3 322 319 320 
-3 322 320 323 
-3 324 322 325 
-3 324 325 326 
-3 321 322 324 
-3 325 322 323 
-3 325 323 327 
-3 328 325 327 
-3 328 327 329 
-3 330 328 329 
-3 330 329 331 
-3 328 332 326 
-3 328 326 325 
-3 328 333 332 
-3 334 333 328 
-3 334 328 330 
-3 79 78 335 
-3 85 335 78 
-3 336 335 85 
-3 337 336 85 
-3 338 335 336 
-3 338 336 339 
-3 338 339 340 
-3 341 339 336 
-3 341 336 342 
-3 342 336 337 
-3 342 337 343 
-3 342 343 344 
-3 341 342 344 
-3 341 344 345 
-3 346 341 345 
-3 347 339 341 
-3 340 339 348 
-3 340 348 349 
-3 350 348 339 
-3 350 339 347 
-3 351 350 347 
-3 351 347 352 
-3 352 347 341 
-3 352 341 346 
-3 353 344 343 
-3 353 343 354 
-3 345 344 353 
-3 345 353 355 
-3 346 345 355 
-3 346 355 356 
-3 352 346 356 
-3 352 356 357 
-3 351 352 357 
-3 351 357 358 
-3 359 351 358 
-3 359 358 360 
-3 351 359 361 
-3 351 361 350 
-3 350 361 348 
-3 348 361 349 
-3 333 353 362 
-3 333 362 332 
-3 354 362 353 
-3 362 354 363 
-3 362 363 326 
-3 362 326 332 
-3 324 326 363 
-3 355 353 333 
-3 355 333 334 
-3 356 355 334 
-3 356 334 364 
-3 364 334 330 
-3 364 330 365 
-3 365 330 331 
-3 365 331 366 
-3 357 356 364 
-3 357 364 367 
-3 358 357 367 
-3 358 367 368 
-3 360 358 368 
-3 360 368 369 
-3 370 361 359 
-3 371 370 359 
-3 371 359 360 
-3 372 371 360 
-3 372 360 369 
-3 373 367 364 
-3 373 364 365 
-3 374 373 365 
-3 374 365 366 
-3 375 368 367 
-3 375 367 373 
-3 376 375 373 
-3 376 373 374 
-3 377 369 368 
-3 377 368 375 
-3 378 377 375 
-3 378 375 376 
-3 379 372 369 
-3 379 369 377 
-3 380 379 377 
-3 380 377 378 
-3 381 313 318 
-3 304 302 309 
-3 304 309 382 
-3 314 383 382 
-3 314 382 309 
-3 313 381 384 
-3 313 384 314 
-3 314 384 383 
-3 318 317 321 
-3 318 321 385 
-3 386 321 324 
-3 318 385 387 
-3 318 387 381 
-3 381 387 384 
-3 386 324 363 
-3 386 363 388 
-3 388 363 354 
-3 388 354 389 
-3 389 354 343 
-3 389 343 390 
-3 390 343 337 
-3 390 337 391 
-3 391 337 85 
-3 391 85 392 
-3 392 85 84 
-3 393 383 384 
-3 393 384 387 
-3 394 393 387 
-3 394 387 395 
-3 396 397 398 
-3 394 395 399 
-3 394 399 400 
-3 400 399 397 
-3 400 397 396 
-3 401 394 400 
-3 401 400 396 
-3 401 396 402 
-3 402 396 398 
-3 402 398 403 
-3 403 398 404 
-3 403 404 405 
-3 406 394 401 
-3 406 401 407 
-3 407 401 402 
-3 407 402 408 
-3 408 402 403 
-3 408 403 409 
-3 409 403 405 
-3 409 405 410 
-3 411 410 405 
-3 411 405 89 
-3 405 404 84 
-3 405 84 89 
-3 411 89 90 
-3 382 383 412 
-3 413 383 393 
-3 413 393 394 
-3 413 394 406 
-3 414 412 383 
-3 382 412 304 
-3 268 90 88 
-3 90 268 415 
-3 90 415 416 
-3 417 415 268 
-3 417 268 267 
-3 418 417 267 
-3 418 267 266 
-3 419 418 266 
-3 419 266 303 
-3 412 419 303 
-3 412 303 304 
-3 420 411 90 
-3 420 90 416 
-3 421 410 411 
-3 421 411 420 
-3 410 421 422 
-3 410 422 409 
-3 409 422 423 
-3 409 423 408 
-3 408 423 424 
-3 408 424 407 
-3 407 424 425 
-3 407 425 406 
-3 413 406 425 
-3 383 413 426 
-3 383 426 414 
-3 426 413 425 
-3 426 425 427 
-3 427 425 424 
-3 427 424 428 
-3 429 428 424 
-3 429 424 423 
-3 429 423 422 
-3 429 422 430 
-3 430 422 421 
-3 430 421 431 
-3 432 431 416 
-3 432 416 415 
-3 417 432 415 
-3 433 432 417 
-3 433 417 418 
-3 434 433 418 
-3 434 418 419 
-3 412 414 434 
-3 412 434 419 
-3 431 421 420 
-3 431 420 416 
-3 435 33 35 
-3 435 35 436 
-3 435 436 437 
-3 435 437 438 
-3 438 437 439 
-3 438 439 440 
-3 440 439 441 
-3 440 441 442 
-3 441 439 437 
-3 441 437 443 
-3 444 443 437 
-3 444 437 436 
-3 445 444 436 
-3 445 436 35 
-3 446 447 441 
-3 446 441 443 
-3 448 446 443 
-3 448 443 444 
-3 449 448 444 
-3 449 444 445 
-3 447 442 441 
-3 450 451 442 
-3 450 442 447 
-3 452 450 447 
-3 452 447 446 
-3 453 452 446 
-3 453 446 448 
-3 454 453 448 
-3 454 448 449 
-3 455 454 449 
-3 451 456 455 
-3 455 456 454 
-3 454 456 453 
-3 453 456 452 
-3 452 456 450 
-3 450 456 451 
-3 457 440 458 
-3 457 458 459 
-3 457 459 460 
-3 461 460 459 
-3 461 459 462 
-3 462 459 31 
-3 462 31 30 
-3 32 33 435 
-3 32 435 463 
-3 463 462 30 
-3 463 30 32 
-3 440 464 438 
-3 435 438 464 
-3 461 464 460 
-3 435 464 463 
-3 463 464 461 
-3 463 461 462 
-3 464 440 457 
-3 464 457 460 
-3 465 466 467 
-3 465 467 468 
-3 13 12 29 
-3 13 29 20 
-3 289 248 249 
-3 289 249 290 
-3 259 247 469 
-3 259 469 470 
-3 247 248 467 
-3 247 467 469 
-3 248 289 468 
-3 248 468 467 
-3 289 284 465 
-3 289 465 468 
-3 284 286 466 
-3 284 466 465 
-3 286 287 471 
-3 286 471 466 
-3 287 288 472 
-3 287 472 471 
-3 288 259 470 
-3 288 470 472 
-3 159 158 165 
-3 159 165 163 
-3 160 159 163 
-3 160 163 161 
-3 151 160 161 
-3 151 161 153 
-3 153 146 151 
-3 262 240 241 
-3 262 241 250 
-3 153 152 146 
-3 3 2 473 
-3 3 473 474 
-3 473 475 474 
-3 476 477 478 
-3 479 480 476 
-3 479 476 478 
-3 481 482 480 
-3 481 480 479 
-3 483 484 482 
-3 483 482 481 
-3 485 477 486 
-3 477 485 487 
-3 488 478 477 
-3 488 477 487 
-3 489 479 478 
-3 489 478 488 
-3 481 479 489 
-3 481 489 490 
-3 491 483 481 
-3 491 481 490 
-3 492 487 485 
-3 492 485 493 
-3 494 488 487 
-3 494 487 492 
-3 495 489 488 
-3 495 488 494 
-3 496 490 489 
-3 496 489 495 
-3 497 491 490 
-3 497 490 496 
-3 498 497 499 
-3 491 497 498 
-3 491 498 500 
-3 485 486 501 
-3 485 501 502 
-3 493 485 502 
-3 493 502 503 
-3 504 493 503 
-3 504 503 505 
-3 493 504 492 
-3 504 505 506 
-3 492 504 507 
-3 494 492 507 
-3 495 494 507 
-3 508 495 507 
-3 507 504 509 
-3 506 510 509 
-3 506 509 504 
-3 496 495 511 
-3 497 496 512 
-3 499 497 513 
-3 512 514 513 
-3 512 513 497 
-3 511 515 512 
-3 511 512 496 
-3 509 516 508 
-3 509 508 507 
-3 517 508 516 
-3 517 516 518 
-3 508 517 511 
-3 508 511 495 
-3 515 511 517 
-3 515 517 519 
-3 520 519 517 
-3 520 517 518 
-3 521 522 519 
-3 521 519 520 
-3 515 519 522 
-3 515 522 523 
-3 515 523 514 
-3 515 514 512 
-3 516 509 510 
-3 516 510 524 
-3 518 516 524 
-3 518 524 525 
-3 520 518 525 
-3 520 525 526 
-3 521 520 526 
-3 521 526 527 
-3 510 528 529 
-3 524 510 529 
-3 524 529 530 
-3 525 524 530 
-3 525 530 531 
-3 526 525 531 
-3 526 531 532 
-3 527 526 532 
-3 527 532 533 
-3 534 535 536 
-3 528 534 536 
-3 537 529 528 
-3 537 528 536 
-3 538 537 536 
-3 538 536 535 
-3 530 529 537 
-3 530 537 539 
-3 531 530 539 
-3 531 539 540 
-3 532 531 540 
-3 532 540 541 
-3 532 541 542 
-3 532 542 533 
-3 527 533 543 
-3 544 542 545 
-3 541 546 545 
-3 541 545 542 
-3 540 547 546 
-3 540 546 541 
-3 539 548 547 
-3 539 547 540 
-3 537 538 548 
-3 537 548 539 
-3 549 550 551 
-3 549 551 552 
-3 553 554 550 
-3 553 550 549 
-3 548 538 554 
-3 548 554 553 
-3 549 552 555 
-3 555 552 556 
-3 553 549 555 
-3 553 555 557 
-3 548 553 557 
-3 548 557 547 
-3 557 555 558 
-3 546 547 557 
-3 546 557 558 
-3 546 558 545 
-3 544 545 558 
-3 544 558 559 
-3 560 558 555 
-3 559 558 560 
-3 559 560 561 
-3 562 499 513 
-3 562 513 563 
-3 564 563 513 
-3 564 513 514 
-3 565 499 562 
-3 498 499 565 
-3 498 565 566 
-3 567 562 568 
-3 565 562 567 
-3 565 567 569 
-3 566 565 569 
-3 566 569 570 
-3 571 562 563 
-3 568 562 571 
-3 568 571 572 
-3 573 568 574 
-3 575 568 573 
-3 575 573 576 
-3 577 567 568 
-3 577 568 575 
-3 569 567 577 
-3 569 577 578 
-3 579 570 569 
-3 579 569 578 
-3 580 573 574 
-3 580 574 581 
-3 582 580 581 
-3 582 581 583 
-3 114 582 583 
-3 114 583 113 
-3 116 584 582 
-3 116 582 114 
-3 582 584 580 
-3 573 580 576 
-3 585 584 116 
-3 585 116 117 
-3 576 580 584 
-3 576 584 585 
-3 586 585 117 
-3 586 117 119 
-3 575 576 585 
-3 575 585 586 
-3 587 577 575 
-3 587 575 586 
-3 122 587 586 
-3 122 586 119 
-3 122 124 588 
-3 122 588 587 
-3 578 577 587 
-3 578 587 588 
-3 588 589 579 
-3 588 579 578 
-3 124 126 589 
-3 124 589 588 
-3 128 590 589 
-3 128 589 126 
-3 591 579 589 
-3 591 589 590 
-3 474 475 591 
-3 474 591 590 
-3 3 474 590 
-3 3 590 128 
-3 574 568 572 
-3 574 572 592 
-3 581 574 592 
-3 581 592 593 
-3 581 593 594 
-3 113 583 595 
-3 113 595 133 
-3 594 593 596 
-3 138 597 598 
-3 138 598 137 
-3 599 598 596 
-3 592 600 599 
-3 592 599 596 
-3 592 596 593 
-3 572 601 600 
-3 572 600 592 
-3 571 602 601 
-3 571 601 572 
-3 563 564 602 
-3 563 602 571 
-3 603 564 514 
-3 603 514 523 
-3 604 602 564 
-3 604 564 603 
-3 605 602 604 
-3 605 601 602 
-3 606 600 601 
-3 606 601 605 
-3 607 599 600 
-3 607 600 606 
-3 608 598 599 
-3 608 599 607 
-3 150 137 598 
-3 150 598 608 
-3 605 609 606 
-3 610 611 612 
-3 612 605 613 
-3 604 614 613 
-3 604 613 605 
-3 603 615 614 
-3 603 614 604 
-3 523 522 615 
-3 523 615 603 
-3 616 158 150 
-3 616 150 608 
-3 607 617 616 
-3 607 616 608 
-3 606 609 617 
-3 606 617 607 
-3 618 619 611 
-3 618 611 610 
-3 620 621 619 
-3 620 619 618 
-3 166 165 621 
-3 166 621 620 
-3 620 622 167 
-3 620 167 166 
-3 618 623 622 
-3 618 622 620 
-3 610 624 623 
-3 610 623 618 
-3 612 625 624 
-3 612 624 610 
-3 613 626 625 
-3 613 625 612 
-3 138 173 594 
-3 138 594 597 
-3 595 594 173 
-3 595 173 133 
-3 614 627 626 
-3 614 626 613 
-3 628 629 627 
-3 628 627 614 
-3 615 630 628 
-3 615 628 614 
-3 522 521 630 
-3 522 630 615 
-3 521 527 543 
-3 521 543 630 
-3 631 625 626 
-3 631 626 632 
-3 633 624 625 
-3 633 625 631 
-3 634 623 624 
-3 634 624 633 
-3 635 622 623 
-3 635 623 634 
-3 183 167 622 
-3 183 622 635 
-3 635 636 184 
-3 635 184 183 
-3 634 637 636 
-3 634 636 635 
-3 633 638 637 
-3 633 637 634 
-3 631 639 638 
-3 631 638 633 
-3 631 632 639 
-3 626 640 632 
-3 639 632 640 
-3 639 640 641 
-3 638 639 641 
-3 638 641 642 
-3 637 638 642 
-3 637 642 643 
-3 636 637 643 
-3 636 643 644 
-3 184 636 644 
-3 184 644 194 
-3 641 640 645 
-3 642 641 645 
-3 642 645 646 
-3 643 642 646 
-3 643 646 647 
-3 644 643 647 
-3 644 647 648 
-3 194 644 648 
-3 194 648 199 
-3 201 199 648 
-3 201 648 649 
-3 647 650 649 
-3 647 649 648 
-3 651 650 647 
-3 651 647 646 
-3 646 645 651 
-3 652 204 201 
-3 652 201 649 
-3 650 653 652 
-3 650 652 649 
-3 651 654 653 
-3 651 653 650 
-3 645 655 654 
-3 645 654 651 
-3 640 655 645 
-3 655 640 656 
-3 657 654 655 
-3 657 655 656 
-3 658 653 654 
-3 658 654 657 
-3 659 652 653 
-3 659 653 658 
-3 213 204 652 
-3 213 652 659 
-3 656 640 660 
-3 660 640 661 
-3 661 640 662 
-3 662 640 629 
-3 629 640 627 
-3 627 640 626 
-3 543 663 628 
-3 543 628 630 
-3 629 628 663 
-3 629 663 662 
-3 663 543 664 
-3 663 664 665 
-3 666 660 661 
-3 666 661 665 
-3 667 656 660 
-3 667 660 666 
-3 656 667 657 
-3 668 669 657 
-3 668 657 667 
-3 658 657 669 
-3 658 669 670 
-3 659 658 670 
-3 659 670 671 
-3 213 659 671 
-3 213 671 226 
-3 666 672 668 
-3 666 668 667 
-3 665 673 672 
-3 665 672 666 
-3 664 674 673 
-3 664 673 665 
-3 543 674 664 
-3 675 543 533 
-3 674 543 675 
-3 674 675 676 
-3 677 674 676 
-3 674 677 673 
-3 672 673 677 
-3 672 677 678 
-3 668 672 678 
-3 668 678 679 
-3 669 668 679 
-3 669 679 680 
-3 670 669 680 
-3 670 680 681 
-3 671 670 681 
-3 671 681 237 
-3 671 237 226 
-3 542 682 675 
-3 542 675 533 
-3 676 675 682 
-3 676 682 683 
-3 677 676 683 
-3 677 683 684 
-3 685 677 684 
-3 685 684 686 
-3 687 678 677 
-3 687 677 685 
-3 678 687 679 
-3 688 687 685 
-3 688 685 689 
-3 679 687 688 
-3 679 688 690 
-3 685 686 689 
-3 691 680 679 
-3 691 679 690 
-3 692 681 680 
-3 692 680 691 
-3 249 237 681 
-3 249 681 692 
-3 693 686 694 
-3 695 696 693 
-3 695 693 694 
-3 695 694 697 
-3 695 697 698 
-3 699 695 698 
-3 689 686 700 
-3 696 695 699 
-3 689 700 688 
-3 690 688 700 
-3 690 700 701 
-3 691 690 701 
-3 691 701 702 
-3 703 704 701 
-3 703 701 700 
-3 703 700 686 
-3 703 686 693 
-3 697 694 705 
-3 683 706 705 
-3 683 705 684 
-3 682 707 706 
-3 682 706 683 
-3 542 544 707 
-3 542 707 682 
-3 708 709 697 
-3 708 697 705 
-3 706 710 708 
-3 706 708 705 
-3 707 711 710 
-3 707 710 706 
-3 544 559 711 
-3 544 711 707 
-3 703 693 696 
-3 703 696 712 
-3 713 704 703 
-3 713 703 712 
-3 714 715 716 
-3 696 699 715 
-3 696 715 712 
-3 699 717 716 
-3 699 716 715 
-3 718 717 699 
-3 718 699 698 
-3 719 716 717 
-3 719 717 720 
-3 721 714 716 
-3 721 716 719 
-3 722 714 721 
-3 281 280 722 
-3 281 722 721 
-3 720 717 718 
-3 720 718 723 
-3 715 714 713 
-3 715 713 712 
-3 283 281 721 
-3 283 721 719 
-3 285 724 722 
-3 285 722 280 
-3 724 725 714 
-3 724 714 722 
-3 726 713 714 
-3 726 714 725 
-3 727 704 713 
-3 727 713 726 
-3 727 702 701 
-3 727 701 704 
-3 290 728 724 
-3 290 724 285 
-3 291 283 719 
-3 291 719 720 
-3 292 291 720 
-3 292 720 723 
-3 294 292 723 
-3 294 723 729 
-3 718 730 729 
-3 718 729 723 
-3 731 730 718 
-3 731 718 698 
-3 732 733 730 
-3 732 730 731 
-3 729 730 733 
-3 729 733 734 
-3 294 729 734 
-3 294 734 300 
-3 731 698 697 
-3 731 697 735 
-3 735 697 709 
-3 732 731 735 
-3 732 735 736 
-3 735 709 737 
-3 738 736 735 
-3 738 735 737 
-3 708 737 709 
-3 306 300 734 
-3 306 734 739 
-3 733 740 739 
-3 733 739 734 
-3 732 741 740 
-3 732 740 733 
-3 736 742 741 
-3 736 741 732 
-3 739 743 310 
-3 739 310 306 
-3 740 744 743 
-3 740 743 739 
-3 741 745 744 
-3 741 744 740 
-3 742 746 745 
-3 742 745 741 
-3 743 747 315 
-3 743 315 310 
-3 744 748 747 
-3 744 747 743 
-3 745 749 748 
-3 745 748 744 
-3 320 315 747 
-3 320 747 750 
-3 747 748 751 
-3 747 751 750 
-3 750 751 752 
-3 323 320 750 
-3 323 750 752 
-3 753 754 752 
-3 753 752 755 
-3 755 752 751 
-3 327 323 752 
-3 327 752 754 
-3 329 327 754 
-3 329 754 756 
-3 331 329 756 
-3 331 756 757 
-3 754 753 758 
-3 754 758 756 
-3 758 759 756 
-3 757 756 759 
-3 757 759 760 
-3 761 552 551 
-3 552 761 556 
-3 556 761 762 
-3 556 762 763 
-3 762 761 764 
-3 765 766 762 
-3 765 762 764 
-3 767 762 766 
-3 767 766 768 
-3 763 762 767 
-3 769 770 763 
-3 769 763 767 
-3 771 769 767 
-3 771 767 768 
-3 771 768 772 
-3 768 766 773 
-3 774 775 766 
-3 774 766 765 
-3 773 766 775 
-3 773 775 776 
-3 777 773 776 
-3 777 776 778 
-3 772 768 773 
-3 772 773 777 
-3 779 770 769 
-3 779 769 780 
-3 781 780 769 
-3 781 769 771 
-3 782 781 771 
-3 782 771 772 
-3 783 782 772 
-3 783 772 777 
-3 784 783 777 
-3 784 777 778 
-3 785 784 778 
-3 785 778 786 
-3 776 787 786 
-3 776 786 778 
-3 775 787 776 
-3 774 787 775 
-3 758 788 780 
-3 758 780 759 
-3 780 788 779 
-3 789 779 788 
-3 758 753 789 
-3 758 789 788 
-3 789 753 755 
-3 760 759 780 
-3 760 780 781 
-3 790 760 781 
-3 790 781 782 
-3 791 757 760 
-3 791 760 790 
-3 366 331 757 
-3 366 757 791 
-3 792 790 782 
-3 792 782 783 
-3 793 792 783 
-3 793 783 784 
-3 794 793 784 
-3 794 784 785 
-3 786 787 795 
-3 785 786 795 
-3 785 795 796 
-3 794 785 796 
-3 794 796 797 
-3 791 790 792 
-3 791 792 798 
-3 366 791 798 
-3 366 798 374 
-3 798 792 793 
-3 798 793 799 
-3 374 798 799 
-3 374 799 376 
-3 799 793 794 
-3 799 794 800 
-3 376 799 800 
-3 376 800 378 
-3 800 794 797 
-3 800 797 801 
-3 378 800 801 
-3 378 801 380 
-3 749 745 802 
-3 803 742 736 
-3 803 736 738 
-3 742 803 804 
-3 742 804 746 
-3 746 805 802 
-3 746 802 745 
-3 804 805 746 
-3 806 751 748 
-3 806 748 749 
-3 755 751 807 
-3 802 808 806 
-3 802 806 749 
-3 805 808 802 
-3 809 789 755 
-3 809 755 807 
-3 810 779 789 
-3 810 789 809 
-3 811 770 779 
-3 811 779 810 
-3 812 763 770 
-3 812 770 811 
-3 813 556 763 
-3 813 763 812 
-3 555 556 813 
-3 808 805 804 
-3 808 804 814 
-3 808 814 815 
-3 816 808 815 
-3 817 818 819 
-3 820 821 816 
-3 820 816 815 
-3 819 818 821 
-3 819 821 820 
-3 820 815 822 
-3 823 819 820 
-3 823 820 822 
-3 824 817 819 
-3 824 819 823 
-3 825 826 817 
-3 825 817 824 
-3 827 822 815 
-3 827 815 828 
-3 829 823 822 
-3 829 822 827 
-3 830 824 823 
-3 830 823 829 
-3 831 825 824 
-3 831 824 830 
-3 560 825 831 
-3 560 831 832 
-3 560 555 826 
-3 560 826 825 
-3 561 560 832 
-3 833 804 803 
-3 814 804 834 
-3 828 815 814 
-3 828 814 834 
-3 804 833 835 
-3 738 833 803 
-3 559 561 711 
-3 836 837 711 
-3 836 711 561 
-3 710 711 837 
-3 710 837 838 
-3 708 710 838 
-3 708 838 839 
-3 737 708 839 
-3 737 839 840 
-3 738 737 840 
-3 738 840 833 
-3 836 561 832 
-3 836 832 841 
-3 841 832 831 
-3 841 831 842 
-3 830 843 842 
-3 830 842 831 
-3 829 844 843 
-3 829 843 830 
-3 827 845 844 
-3 827 844 829 
-3 828 846 845 
-3 828 845 827 
-3 846 828 834 
-3 835 847 834 
-3 835 834 804 
-3 848 846 834 
-3 848 834 847 
-3 849 845 846 
-3 849 846 848 
-3 844 845 849 
-3 844 849 850 
-3 851 843 844 
-3 851 844 850 
-3 852 842 843 
-3 852 843 851 
-3 837 836 852 
-3 837 852 853 
-3 837 853 838 
-3 839 838 853 
-3 839 853 854 
-3 840 839 854 
-3 840 854 855 
-3 840 855 835 
-3 840 835 833 
-3 841 842 852 
-3 836 841 852 
-3 856 506 505 
-3 856 505 857 
-3 858 859 856 
-3 858 856 857 
-3 860 861 859 
-3 860 859 858 
-3 862 863 861 
-3 862 861 860 
-3 864 859 861 
-3 864 861 863 
-3 856 859 864 
-3 856 864 865 
-3 506 856 865 
-3 506 865 866 
-3 864 863 867 
-3 864 867 868 
-3 865 864 868 
-3 865 868 869 
-3 866 865 869 
-3 866 869 870 
-3 863 862 867 
-3 867 862 871 
-3 867 871 872 
-3 868 867 872 
-3 868 872 873 
-3 869 868 873 
-3 869 873 874 
-3 870 869 874 
-3 870 874 875 
-3 870 875 876 
-3 876 877 871 
-3 875 877 876 
-3 874 877 875 
-3 873 877 874 
-3 872 877 873 
-3 871 877 872 
-3 878 860 879 
-3 880 881 878 
-3 880 878 879 
-3 882 881 880 
-3 882 880 883 
-3 502 501 881 
-3 502 881 882 
-3 884 857 505 
-3 884 505 503 
-3 503 502 882 
-3 503 882 884 
-3 858 885 860 
-3 885 858 857 
-3 880 885 883 
-3 884 885 857 
-3 882 883 885 
-3 882 885 884 
-3 880 879 860 
-3 880 860 885 
-3 886 887 888 
-3 886 888 889 
-3 491 500 484 
-3 491 484 483 
-3 290 249 692 
-3 290 692 728 
-3 889 888 691 
-3 889 691 702 
-3 888 890 692 
-3 888 692 691 
-3 890 891 728 
-3 890 728 692 
-3 891 892 724 
-3 891 724 728 
-3 892 893 725 
-3 892 725 724 
-3 893 887 726 
-3 893 726 725 
-3 887 886 727 
-3 887 727 726 
-3 886 889 702 
-3 886 702 727 
-3 621 165 158 
-3 621 158 616 
-3 619 621 616 
-3 619 616 617 
-3 611 619 617 
-3 611 617 609 
-3 609 605 611 
-3 694 686 684 
-3 694 684 705 
-3 605 612 611 
-3 131 109 132 
-3 131 132 134 
-3 131 134 136 
-3 131 136 139 
-3 218 217 215 
-3 218 215 219 
-3 472 470 466 
-3 472 466 471 
-3 469 467 466 
-3 469 466 470 
-3 583 581 594 
-3 583 594 595 
-3 597 594 596 
-3 597 596 598 
-3 662 663 665 
-3 662 665 661 
-3 892 891 887 
-3 892 887 893 
-3 890 888 887 
-3 890 887 891 
-3 894 895 896 
-3 894 896 897 
-3 897 896 898 
-3 897 898 899 
-3 899 898 900 
-3 899 900 901 
-3 901 900 902 
-3 901 902 903 
-3 903 902 904 
-3 903 904 905 
-3 905 904 906 
-3 905 906 907 
-3 907 906 908 
-3 907 908 909 
-3 909 908 910 
-3 909 910 911 
-3 908 912 913 
-3 908 913 910 
-3 906 914 912 
-3 906 912 908 
-3 904 915 914 
-3 904 914 906 
-3 902 916 915 
-3 902 915 904 
-3 900 917 916 
-3 900 916 902 
-3 898 918 917 
-3 898 917 900 
-3 896 919 918 
-3 896 918 898 
-3 895 919 896 
-3 894 897 920 
-3 894 920 921 
-3 921 920 922 
-3 921 922 923 
-3 923 922 924 
-3 923 924 925 
-3 925 924 926 
-3 926 924 927 
-3 926 927 928 
-3 924 922 929 
-3 924 929 930 
-3 924 930 927 
-3 922 920 931 
-3 922 931 932 
-3 922 932 929 
-3 920 897 899 
-3 920 899 931 
-3 931 899 901 
-3 931 901 933 
-3 931 933 934 
-3 928 927 935 
-3 928 935 936 
-3 928 936 937 
-3 930 935 927 
-3 930 938 939 
-3 930 939 935 
-3 935 940 936 
-3 939 941 940 
-3 939 940 935 
-3 932 931 934 
-3 934 933 942 
-3 943 932 934 
-3 943 934 944 
-3 944 934 942 
-3 944 942 945 
-3 946 939 938 
-3 946 941 939 
-3 947 943 944 
-3 947 944 945 
-3 930 929 948 
-3 930 948 938 
-3 929 932 943 
-3 929 943 948 
-3 946 938 948 
-3 946 948 949 
-3 949 948 943 
-3 949 943 947 
-3 946 950 951 
-3 946 951 941 
-3 950 947 945 
-3 950 945 951 
-3 945 942 952 
-3 945 952 951 
-3 951 952 940 
-3 951 940 941 
-3 946 949 947 
-3 946 947 950 
-3 937 936 953 
-3 937 953 954 
-3 936 940 952 
-3 936 952 955 
-3 936 955 953 
-3 952 942 933 
-3 952 933 956 
-3 952 956 955 
-3 933 901 903 
-3 933 903 956 
-3 956 903 905 
-3 956 905 957 
-3 957 905 907 
-3 957 907 958 
-3 958 907 909 
-3 958 909 959 
-3 959 909 911 
-3 959 911 960 
-3 960 961 962 
-3 960 962 959 
-3 959 962 963 
-3 959 963 958 
-3 958 963 964 
-3 958 964 957 
-3 957 964 955 
-3 957 955 956 
-3 955 964 965 
-3 955 965 953 
-3 953 965 966 
-3 953 966 954 
-3 966 965 967 
-3 966 967 968 
-3 968 967 969 
-3 968 969 970 
-3 970 969 971 
-3 970 971 972 
-3 969 962 961 
-3 969 961 971 
-3 967 963 962 
-3 967 962 969 
-3 965 964 963 
-3 965 963 967 
-3 973 895 894 
-3 973 894 974 
-3 974 894 975 
-3 975 976 974 
-3 974 976 977 
-3 974 977 978 
-3 974 978 973 
-3 973 978 979 
-3 979 980 973 
-3 973 980 895 
-3 977 976 981 
-3 977 981 982 
-3 983 982 981 
-3 983 981 984 
-3 983 984 985 
-3 986 985 984 
-3 986 984 987 
-3 987 988 989 
-3 987 989 986 
-3 981 976 990 
-3 990 991 984 
-3 990 984 981 
-3 992 987 984 
-3 992 984 991 
-3 993 988 987 
-3 993 987 992 
-3 894 921 994 
-3 894 994 995 
-3 995 996 975 
-3 995 975 894 
-3 975 996 997 
-3 975 997 976 
-3 994 921 923 
-3 994 923 998 
-3 998 923 925 
-3 998 925 999 
-3 928 937 1000 
-3 928 1000 1001 
-3 937 954 1002 
-3 937 1002 1000 
-3 954 966 1003 
-3 954 1003 1002 
-3 966 968 1004 
-3 966 1004 1003 
-3 968 970 1005 
-3 968 1005 1004 
-3 970 972 1006 
-3 970 1006 1005 
-3 999 925 926 
-3 999 926 1007 
-3 1007 926 928 
-3 1007 928 1001 
-3 1008 989 988 
-3 1008 988 1009 
-3 1009 988 993 
-3 1009 993 1010 
-3 1011 1008 1009 
-3 1011 1009 1012 
-3 1012 1009 1010 
-3 1012 1010 1013 
-3 1013 1014 1015 
-3 1013 1015 1012 
-3 1015 1016 1011 
-3 1015 1011 1012 
-3 1017 1018 1015 
-3 1017 1015 1014 
-3 1018 1019 1016 
-3 1018 1016 1015 
-3 1018 1020 1021 
-3 1018 1021 1019 
-3 1022 1020 1018 
-3 1022 1018 1017 
-3 1022 1017 1023 
-3 1022 1023 1024 
-3 1017 1014 1025 
-3 1017 1025 1023 
-3 1014 1013 1026 
-3 1014 1026 1025 
-3 1010 993 1027 
-3 1010 1027 1028 
-3 993 992 1029 
-3 993 1029 1027 
-3 992 991 1030 
-3 992 1030 1029 
-3 1026 1013 1010 
-3 1026 1010 1028 
-3 1024 1023 1031 
-3 1024 1031 1032 
-3 1023 1025 1033 
-3 1023 1033 1031 
-3 1025 1026 1034 
-3 1025 1034 1033 
-3 1026 1028 1035 
-3 1026 1035 1034 
-3 1028 1027 1036 
-3 1028 1036 1035 
-3 1031 1033 1037 
-3 1037 1033 1038 
-3 1037 1038 1039 
-3 1038 1033 1034 
-3 1038 1034 1040 
-3 1040 1034 1035 
-3 1040 1035 1041 
-3 1041 1035 1036 
-3 1041 1036 1042 
-3 1027 1029 1043 
-3 1027 1043 1036 
-3 1029 1030 1044 
-3 1029 1044 1043 
-3 1036 1043 1045 
-3 1036 1045 1042 
-3 1043 1044 1046 
-3 1043 1046 1045 
-3 990 976 997 
-3 990 997 1047 
-3 990 1047 1030 
-3 990 1030 991 
-3 997 996 1048 
-3 997 1048 1049 
-3 996 995 1050 
-3 996 1050 1048 
-3 1050 995 994 
-3 1050 994 998 
-3 1050 998 1051 
-3 1051 998 999 
-3 1051 999 1052 
-3 1052 999 1007 
-3 1052 1007 1053 
-3 1007 1001 1054 
-3 1007 1054 1053 
-3 1001 1000 1055 
-3 1001 1055 1054 
-3 1000 1002 1056 
-3 1000 1056 1055 
-3 1002 1003 1057 
-3 1002 1057 1056 
-3 1003 1004 1058 
-3 1003 1058 1057 
-3 1004 1005 1059 
-3 1004 1059 1058 
-3 1005 1006 1060 
-3 1005 1060 1059 
-3 1053 1054 1061 
-3 1053 1061 1062 
-3 1062 1063 1064 
-3 1062 1064 1065 
-3 1062 1065 1053 
-3 1054 1055 1066 
-3 1054 1066 1061 
-3 1055 1056 1067 
-3 1055 1067 1066 
-3 1056 1057 1068 
-3 1056 1068 1067 
-3 1057 1058 1069 
-3 1057 1069 1068 
-3 1058 1059 1070 
-3 1058 1070 1069 
-3 1070 1059 1060 
-3 1070 1060 1071 
-3 1047 997 1049 
-3 1047 1049 1072 
-3 1030 1047 1072 
-3 1030 1072 1044 
-3 1044 1072 1073 
-3 1044 1073 1074 
-3 1044 1074 1075 
-3 1044 1075 1046 
-3 1049 1048 1072 
-3 1072 1048 1076 
-3 1072 1076 1073 
-3 1048 1050 1051 
-3 1048 1051 1052 
-3 1048 1052 1077 
-3 1048 1077 1076 
-3 1065 1077 1052 
-3 1065 1052 1053 
-3 1074 1064 1063 
-3 1074 1063 1075 
-3 1038 1040 1078 
-3 1040 1041 1079 
-3 1040 1079 1078 
-3 1079 1041 1042 
-3 1079 1042 1080 
-3 1080 1042 1045 
-3 1080 1045 1081 
-3 1078 1079 1082 
-3 1078 1082 1083 
-3 1079 1080 1082 
-3 1080 1081 1084 
-3 1080 1084 1082 
-3 1045 1046 1085 
-3 1045 1085 1081 
-3 1085 1046 1075 
-3 1085 1075 1086 
-3 1086 1075 1063 
-3 1086 1063 1087 
-3 1087 1063 1062 
-3 1087 1062 1088 
-3 1081 1085 1089 
-3 1081 1089 1084 
-3 1089 1085 1086 
-3 1089 1086 1090 
-3 1090 1086 1087 
-3 1090 1087 1091 
-3 1091 1087 1092 
-3 1087 1088 1092 
-3 1092 1093 1091 
-3 1091 1093 1094 
-3 1091 1094 1090 
-3 1090 1094 1095 
-3 1090 1095 1089 
-3 1089 1095 1096 
-3 1089 1096 1084 
-3 1084 1096 1082 
-3 1088 1062 1061 
-3 1088 1061 1097 
-3 1097 1061 1066 
-3 1097 1066 1098 
-3 1098 1066 1067 
-3 1098 1067 1099 
-3 1099 1067 1068 
-3 1099 1068 1100 
-3 1100 1068 1069 
-3 1100 1069 1101 
-3 1101 1069 1070 
-3 1101 1070 1102 
-3 1102 1070 1071 
-3 1102 1071 1103 
-3 1088 1097 1104 
-3 1088 1104 1092 
-3 1097 1098 1104 
-3 1098 1099 1105 
-3 1098 1105 1104 
-3 1099 1100 1105 
-3 1100 1101 1106 
-3 1100 1106 1105 
-3 1101 1102 1107 
-3 1101 1107 1106 
-3 1102 1103 1107 
-3 916 1108 915 
-3 1109 1110 1111 
-3 1109 1111 1112 
-3 915 1112 1113 
-3 1112 1111 1114 
-3 1112 1114 1113 
-3 915 1113 1115 
-3 915 1115 914 
-3 1113 1114 1116 
-3 1113 1116 1115 
-3 914 1115 1117 
-3 914 1117 912 
-3 912 1117 1118 
-3 912 1118 913 
-3 1118 1117 1119 
-3 1118 1119 1120 
-3 1115 1116 1119 
-3 1115 1119 1117 
-3 1093 1092 1121 
-3 1093 1121 1122 
-3 1094 1093 1122 
-3 1094 1122 1123 
-3 1095 1094 1123 
-3 1095 1123 1124 
-3 1096 1095 1124 
-3 1096 1124 1125 
-3 1082 1096 1125 
-3 1082 1125 1126 
-3 1083 1082 1126 
-3 1125 1124 1127 
-3 1125 1127 1128 
-3 1124 1123 1129 
-3 1124 1129 1127 
-3 1123 1122 1130 
-3 1123 1130 1129 
-3 1122 1121 1131 
-3 1122 1131 1130 
-3 1092 1104 1132 
-3 1092 1132 1121 
-3 1104 1105 1133 
-3 1104 1133 1132 
-3 1105 1106 1134 
-3 1105 1134 1133 
-3 1106 1107 1135 
-3 1106 1135 1134 
-3 1107 1103 1136 
-3 1107 1136 1135 
-3 1135 1136 1137 
-3 1135 1137 1138 
-3 1135 1138 1139 
-3 1135 1139 1134 
-3 1134 1139 1140 
-3 1134 1140 1133 
-3 1133 1140 1141 
-3 1133 1141 1132 
-3 1132 1141 1131 
-3 1132 1131 1121 
-3 1021 1020 1142 
-3 1021 1142 1143 
-3 1142 1020 1022 
-3 1142 1022 1144 
-3 1144 1022 1024 
-3 1144 1024 1145 
-3 1146 1145 1024 
-3 1146 1024 1032 
-3 1147 1143 1142 
-3 1142 1144 1148 
-3 1142 1148 1147 
-3 1147 1148 1149 
-3 1147 1149 1150 
-3 1150 1149 1151 
-3 1150 1151 1152 
-3 1151 1149 1153 
-3 1151 1153 1154 
-3 1149 1148 1155 
-3 1149 1155 1153 
-3 1148 1144 1145 
-3 1148 1145 1155 
-3 1154 1153 1156 
-3 1154 1156 1157 
-3 1156 1153 1155 
-3 1156 1155 1158 
-3 1158 1155 1145 
-3 1158 1145 1146 
-3 1031 1037 1159 
-3 1031 1159 1032 
-3 1032 1159 1160 
-3 1032 1160 1146 
-3 1146 1160 1161 
-3 1146 1161 1158 
-3 1158 1161 1162 
-3 1158 1162 1156 
-3 1156 1162 1163 
-3 1156 1163 1157 
-3 1037 1039 1159 
-3 1159 1039 1164 
-3 1159 1164 1165 
-3 1165 1164 1083 
-3 1165 1083 1166 
-3 1039 1038 1078 
-3 1039 1078 1164 
-3 1159 1165 1167 
-3 1159 1167 1168 
-3 1165 1166 1167 
-3 1159 1168 1169 
-3 1159 1169 1160 
-3 1160 1169 1170 
-3 1160 1170 1161 
-3 1161 1170 1171 
-3 1161 1171 1162 
-3 1162 1171 1172 
-3 1162 1172 1163 
-3 1172 1171 1173 
-3 1172 1173 1174 
-3 1171 1170 1175 
-3 1171 1175 1173 
-3 1170 1169 1176 
-3 1170 1176 1175 
-3 1169 1168 1177 
-3 1169 1177 1176 
-3 1168 1167 1177 
-3 1083 1126 1178 
-3 1083 1178 1166 
-3 1126 1125 1128 
-3 1126 1128 1178 
-3 1178 1167 1166 
-3 1178 1128 1179 
-3 1178 1179 1167 
-3 1128 1127 1180 
-3 1128 1180 1179 
-3 1129 1181 1180 
-3 1129 1180 1127 
-3 1129 1130 1182 
-3 1129 1182 1181 
-3 1130 1131 1183 
-3 1130 1183 1182 
-3 1131 1141 1184 
-3 1131 1184 1183 
-3 1141 1140 1185 
-3 1141 1185 1184 
-3 1140 1139 1186 
-3 1140 1186 1185 
-3 1138 1187 1186 
-3 1138 1186 1139 
-3 1138 1137 1188 
-3 1138 1188 1187 
-3 1174 1173 1189 
-3 1174 1189 1190 
-3 1173 1175 1191 
-3 1173 1191 1189 
-3 1175 1176 1192 
-3 1175 1192 1191 
-3 1176 1177 1193 
-3 1176 1193 1192 
-3 1177 1167 1179 
-3 1177 1179 1193 
-3 1190 1189 1194 
-3 1190 1194 1195 
-3 1189 1191 1196 
-3 1189 1196 1194 
-3 1191 1192 1197 
-3 1191 1197 1196 
-3 1192 1198 1197 
-3 1192 1193 1199 
-3 1192 1199 1198 
-3 1193 1179 1180 
-3 1193 1180 1199 
-3 1195 1194 1200 
-3 1195 1200 1201 
-3 1194 1196 1202 
-3 1194 1202 1200 
-3 1196 1197 1203 
-3 1196 1203 1202 
-3 1197 1198 1204 
-3 1197 1204 1203 
-3 1198 1199 1205 
-3 1198 1205 1204 
-3 1201 1200 1206 
-3 1201 1206 1207 
-3 1200 1202 1208 
-3 1200 1208 1206 
-3 1202 1203 1209 
-3 1202 1209 1208 
-3 1203 1204 1210 
-3 1203 1210 1209 
-3 1204 1211 1210 
-3 1204 1205 1212 
-3 1204 1212 1211 
-3 1207 1206 1213 
-3 1207 1213 1214 
-3 1206 1208 1215 
-3 1206 1215 1213 
-3 1208 1209 1216 
-3 1208 1216 1215 
-3 1209 1210 1217 
-3 1209 1217 1216 
-3 1210 1211 1218 
-3 1210 1218 1217 
-3 1211 1212 1219 
-3 1211 1219 1218 
-3 1214 1213 1220 
-3 1214 1220 1221 
-3 1213 1215 1222 
-3 1213 1222 1220 
-3 1215 1216 1223 
-3 1215 1223 1222 
-3 1216 1217 1224 
-3 1216 1224 1223 
-3 1217 1218 1225 
-3 1217 1225 1224 
-3 1218 1219 1226 
-3 1218 1226 1225 
-3 1221 1220 1227 
-3 1221 1227 1228 
-3 1220 1222 1229 
-3 1220 1229 1227 
-3 1222 1223 1230 
-3 1222 1230 1229 
-3 1223 1224 1231 
-3 1223 1231 1230 
-3 1224 1225 1232 
-3 1224 1232 1231 
-3 1225 1226 1233 
-3 1225 1233 1232 
-3 1228 1227 1234 
-3 1228 1234 1235 
-3 1235 1234 1236 
-3 1235 1236 1237 
-3 1237 1236 1238 
-3 1237 1238 1239 
-3 1227 1229 1240 
-3 1227 1240 1234 
-3 1234 1240 1241 
-3 1234 1241 1236 
-3 1236 1241 1242 
-3 1236 1242 1238 
-3 1229 1230 1243 
-3 1229 1243 1240 
-3 1240 1243 1244 
-3 1240 1244 1241 
-3 1241 1244 1245 
-3 1241 1245 1242 
-3 1230 1231 1246 
-3 1230 1246 1243 
-3 1243 1246 1247 
-3 1243 1247 1244 
-3 1244 1247 1248 
-3 1244 1248 1245 
-3 1231 1232 1249 
-3 1231 1249 1246 
-3 1246 1249 1250 
-3 1246 1250 1247 
-3 1247 1250 1251 
-3 1247 1251 1248 
-3 1232 1233 1252 
-3 1232 1252 1249 
-3 1249 1252 1253 
-3 1249 1253 1250 
-3 1250 1253 1254 
-3 1250 1254 1251 
-3 1199 1180 1181 
-3 1199 1181 1205 
-3 1205 1181 1182 
-3 1205 1182 1212 
-3 1212 1182 1183 
-3 1212 1183 1219 
-3 1219 1183 1184 
-3 1219 1184 1226 
-3 1226 1184 1185 
-3 1226 1185 1233 
-3 1233 1185 1186 
-3 1233 1186 1252 
-3 1252 1186 1187 
-3 1252 1187 1253 
-3 1253 1187 1188 
-3 1253 1188 1254 
-3 1164 1078 1083 
-3 1108 1109 1112 
-3 1108 1112 915 
-3 1255 1256 1257 
-3 1255 1257 1258 
-3 1255 1258 1259 
-3 1255 1259 1260 
-3 1255 1260 1261 
-3 1255 1261 1262 
-3 1255 1262 1263 
-3 1120 1261 1264 
-3 1120 1264 1118 
-3 1118 1264 1265 
-3 1118 1265 913 
-3 913 1265 1266 
-3 913 1266 910 
-3 910 1266 1267 
-3 910 1267 911 
-3 911 1267 1268 
-3 911 1268 960 
-3 960 1268 1269 
-3 960 1269 961 
-3 961 1269 1270 
-3 961 1270 971 
-3 971 1270 1271 
-3 971 1271 972 
-3 972 1271 1272 
-3 972 1272 1006 
-3 1006 1272 1273 
-3 1006 1273 1060 
-3 1060 1273 1274 
-3 1060 1274 1071 
-3 1071 1274 1275 
-3 1071 1275 1103 
-3 1103 1275 1276 
-3 1103 1276 1136 
-3 1136 1276 1277 
-3 1136 1277 1137 
-3 1137 1277 1278 
-3 1137 1278 1188 
-3 1188 1278 1279 
-3 1188 1279 1254 
-3 1254 1279 1260 
-3 1254 1260 1251 
-3 1251 1260 1259 
-3 1251 1259 1248 
-3 1248 1259 1258 
-3 1248 1258 1245 
-3 1245 1258 1257 
-3 1245 1257 1242 
-3 1242 1257 1256 
-3 1242 1256 1238 
-3 1238 1256 1255 
-3 1238 1255 1239 
-3 1279 1278 1277 
-3 1279 1277 1276 
-3 1279 1276 1275 
-3 1279 1275 1274 
-3 1279 1274 1273 
-3 1260 1279 1273 
-3 1260 1273 1272 
-3 1260 1272 1271 
-3 1260 1271 1270 
-3 1260 1270 1269 
-3 1260 1269 1268 
-3 1260 1268 1267 
-3 1260 1267 1266 
-3 1260 1266 1265 
-3 1260 1265 1264 
-3 1260 1264 1261 
-3 1280 1281 1282 
-3 1280 1282 1283 
-3 1284 1285 1281 
-3 1284 1281 1280 
-3 1286 1287 1285 
-3 1286 1285 1284 
-3 1288 1289 1287 
-3 1288 1287 1286 
-3 1290 1291 1289 
-3 1290 1289 1288 
-3 1292 1293 1291 
-3 1292 1291 1290 
-3 1294 1295 1293 
-3 1294 1293 1292 
-3 1296 1297 1295 
-3 1296 1295 1294 
-3 1297 1298 1299 
-3 1297 1299 1295 
-3 1295 1299 1300 
-3 1295 1300 1293 
-3 1293 1300 1301 
-3 1293 1301 1291 
-3 1291 1301 1302 
-3 1291 1302 1289 
-3 1289 1302 1303 
-3 1289 1303 1287 
-3 1287 1303 1304 
-3 1287 1304 1285 
-3 1285 1304 1305 
-3 1285 1305 1281 
-3 1281 1305 1282 
-3 1306 1307 1280 
-3 1306 1280 1283 
-3 1308 1309 1307 
-3 1308 1307 1306 
-3 1310 1311 1309 
-3 1310 1309 1308 
-3 1312 1311 1310 
-3 1313 1314 1311 
-3 1313 1311 1312 
-3 1314 1315 1316 
-3 1314 1316 1309 
-3 1314 1309 1311 
-3 1316 1317 1318 
-3 1316 1318 1307 
-3 1316 1307 1309 
-3 1318 1284 1280 
-3 1318 1280 1307 
-3 1319 1320 1286 
-3 1319 1286 1284 
-3 1319 1284 1318 
-3 1321 1322 1323 
-3 1321 1323 1314 
-3 1321 1314 1313 
-3 1314 1323 1315 
-3 1323 1324 1325 
-3 1323 1325 1315 
-3 1322 1326 1323 
-3 1323 1326 1327 
-3 1323 1327 1324 
-3 1319 1318 1317 
-3 1328 1320 1319 
-3 1329 1319 1317 
-3 1329 1317 1330 
-3 1331 1328 1319 
-3 1331 1319 1329 
-3 1325 1324 1332 
-3 1324 1327 1332 
-3 1329 1330 1333 
-3 1331 1329 1333 
-3 1325 1334 1316 
-3 1325 1316 1315 
-3 1334 1330 1317 
-3 1334 1317 1316 
-3 1335 1334 1325 
-3 1335 1325 1332 
-3 1333 1330 1334 
-3 1333 1334 1335 
-3 1327 1336 1337 
-3 1327 1337 1332 
-3 1336 1331 1333 
-3 1336 1333 1337 
-3 1336 1338 1328 
-3 1336 1328 1331 
-3 1327 1326 1338 
-3 1327 1338 1336 
-3 1337 1333 1335 
-3 1337 1335 1332 
-3 1339 1340 1322 
-3 1339 1322 1321 
-3 1340 1341 1338 
-3 1340 1338 1326 
-3 1340 1326 1322 
-3 1341 1342 1320 
-3 1341 1320 1328 
-3 1341 1328 1338 
-3 1342 1288 1286 
-3 1342 1286 1320 
-3 1343 1290 1288 
-3 1343 1288 1342 
-3 1344 1292 1290 
-3 1344 1290 1343 
-3 1345 1294 1292 
-3 1345 1292 1344 
-3 1346 1296 1294 
-3 1346 1294 1345 
-3 1345 1347 1348 
-3 1345 1348 1346 
-3 1344 1349 1347 
-3 1344 1347 1345 
-3 1343 1350 1349 
-3 1343 1349 1344 
-3 1342 1341 1350 
-3 1342 1350 1343 
-3 1340 1351 1350 
-3 1340 1350 1341 
-3 1339 1352 1351 
-3 1339 1351 1340 
-3 1353 1354 1351 
-3 1353 1351 1352 
-3 1355 1356 1354 
-3 1355 1354 1353 
-3 1357 1358 1356 
-3 1357 1356 1355 
-3 1358 1348 1347 
-3 1358 1347 1356 
-3 1356 1347 1349 
-3 1356 1349 1354 
-3 1354 1349 1350 
-3 1354 1350 1351 
-3 1359 1283 1282 
-3 1359 1282 1360 
-3 1361 1283 1359 
-3 1359 1362 1361 
-3 1360 1363 1364 
-3 1360 1364 1362 
-3 1360 1362 1359 
-3 1365 1363 1360 
-3 1360 1366 1365 
-3 1282 1366 1360 
-3 1367 1368 1362 
-3 1367 1362 1364 
-3 1369 1370 1368 
-3 1369 1368 1367 
-3 1369 1367 1371 
-3 1372 1370 1369 
-3 1372 1369 1373 
-3 1373 1374 1375 
-3 1373 1375 1372 
-3 1376 1362 1368 
-3 1368 1370 1377 
-3 1368 1377 1376 
-3 1377 1370 1372 
-3 1377 1372 1378 
-3 1378 1372 1375 
-3 1378 1375 1379 
-3 1380 1381 1306 
-3 1380 1306 1283 
-3 1283 1361 1382 
-3 1283 1382 1380 
-3 1362 1383 1382 
-3 1362 1382 1361 
-3 1384 1308 1306 
-3 1384 1306 1381 
-3 1385 1310 1308 
-3 1385 1308 1384 
-3 1386 1387 1321 
-3 1386 1321 1313 
-3 1387 1388 1339 
-3 1387 1339 1321 
-3 1388 1389 1352 
-3 1388 1352 1339 
-3 1389 1390 1353 
-3 1389 1353 1352 
-3 1390 1391 1355 
-3 1390 1355 1353 
-3 1391 1392 1357 
-3 1391 1357 1355 
-3 1393 1312 1310 
-3 1393 1310 1385 
-3 1386 1313 1312 
-3 1386 1312 1393 
-3 1394 1375 1374 
-3 1394 1374 1395 
-3 1396 1379 1375 
-3 1396 1375 1394 
-3 1397 1394 1395 
-3 1397 1395 1398 
-3 1399 1396 1394 
-3 1399 1394 1397 
-3 1397 1400 1401 
-3 1397 1401 1399 
-3 1397 1398 1402 
-3 1397 1402 1400 
-3 1401 1400 1403 
-3 1401 1403 1404 
-3 1400 1402 1405 
-3 1400 1405 1403 
-3 1405 1406 1407 
-3 1405 1407 1403 
-3 1404 1403 1407 
-3 1404 1407 1408 
-3 1409 1410 1404 
-3 1409 1404 1408 
-3 1410 1411 1401 
-3 1410 1401 1404 
-3 1411 1412 1399 
-3 1411 1399 1401 
-3 1413 1414 1379 
-3 1413 1379 1396 
-3 1414 1415 1378 
-3 1414 1378 1379 
-3 1415 1416 1377 
-3 1415 1377 1378 
-3 1413 1396 1399 
-3 1413 1399 1412 
-3 1417 1418 1410 
-3 1417 1410 1409 
-3 1418 1419 1411 
-3 1418 1411 1410 
-3 1419 1420 1412 
-3 1419 1412 1411 
-3 1420 1421 1413 
-3 1420 1413 1412 
-3 1421 1422 1414 
-3 1421 1414 1413 
-3 1423 1419 1418 
-3 1424 1425 1419 
-3 1424 1419 1423 
-3 1426 1420 1419 
-3 1426 1419 1425 
-3 1427 1421 1420 
-3 1427 1420 1426 
-3 1428 1422 1421 
-3 1428 1421 1427 
-3 1422 1429 1415 
-3 1422 1415 1414 
-3 1429 1430 1416 
-3 1429 1416 1415 
-3 1428 1431 1429 
-3 1428 1429 1422 
-3 1431 1432 1430 
-3 1431 1430 1429 
-3 1433 1383 1362 
-3 1433 1362 1376 
-3 1377 1416 1433 
-3 1377 1433 1376 
-3 1434 1435 1382 
-3 1434 1382 1383 
-3 1435 1436 1380 
-3 1435 1380 1382 
-3 1381 1380 1436 
-3 1437 1384 1381 
-3 1437 1381 1436 
-3 1438 1385 1384 
-3 1438 1384 1437 
-3 1439 1393 1385 
-3 1439 1385 1438 
-3 1439 1440 1386 
-3 1439 1386 1393 
-3 1440 1441 1387 
-3 1440 1387 1386 
-3 1441 1442 1388 
-3 1441 1388 1387 
-3 1442 1443 1389 
-3 1442 1389 1388 
-3 1443 1444 1390 
-3 1443 1390 1389 
-3 1444 1445 1391 
-3 1444 1391 1390 
-3 1445 1446 1392 
-3 1445 1392 1391 
-3 1447 1448 1440 
-3 1447 1440 1439 
-3 1439 1449 1450 
-3 1439 1450 1451 
-3 1439 1451 1447 
-3 1448 1452 1441 
-3 1448 1441 1440 
-3 1452 1453 1442 
-3 1452 1442 1441 
-3 1453 1454 1443 
-3 1453 1443 1442 
-3 1454 1455 1444 
-3 1454 1444 1443 
-3 1455 1456 1445 
-3 1455 1445 1444 
-3 1457 1446 1445 
-3 1457 1445 1456 
-3 1458 1434 1383 
-3 1458 1383 1433 
-3 1430 1458 1433 
-3 1430 1433 1416 
-3 1432 1459 1460 
-3 1432 1460 1461 
-3 1432 1461 1458 
-3 1432 1458 1430 
-3 1458 1435 1434 
-3 1461 1462 1435 
-3 1461 1435 1458 
-3 1437 1436 1435 
-3 1438 1437 1435 
-3 1462 1463 1438 
-3 1462 1438 1435 
-3 1439 1438 1463 
-3 1439 1463 1449 
-3 1459 1451 1450 
-3 1459 1450 1460 
-3 1464 1426 1425 
-3 1464 1465 1427 
-3 1464 1427 1426 
-3 1466 1428 1427 
-3 1466 1427 1465 
-3 1467 1431 1428 
-3 1467 1428 1466 
-3 1468 1469 1465 
-3 1468 1465 1464 
-3 1469 1466 1465 
-3 1469 1470 1467 
-3 1469 1467 1466 
-3 1467 1471 1432 
-3 1467 1432 1431 
-3 1472 1459 1432 
-3 1472 1432 1471 
-3 1473 1451 1459 
-3 1473 1459 1472 
-3 1474 1447 1451 
-3 1474 1451 1473 
-3 1470 1475 1471 
-3 1470 1471 1467 
-3 1476 1472 1471 
-3 1476 1471 1475 
-3 1477 1473 1472 
-3 1477 1472 1476 
-3 1478 1473 1477 
-3 1478 1474 1473 
-3 1477 1479 1478 
-3 1476 1480 1479 
-3 1476 1479 1477 
-3 1475 1481 1480 
-3 1475 1480 1476 
-3 1470 1482 1481 
-3 1470 1481 1475 
-3 1469 1482 1470 
-3 1483 1448 1447 
-3 1483 1447 1474 
-3 1484 1452 1448 
-3 1484 1448 1483 
-3 1485 1453 1452 
-3 1485 1452 1484 
-3 1486 1454 1453 
-3 1486 1453 1485 
-3 1487 1455 1454 
-3 1487 1454 1486 
-3 1488 1456 1455 
-3 1488 1455 1487 
-3 1489 1457 1456 
-3 1489 1456 1488 
-3 1478 1490 1483 
-3 1478 1483 1474 
-3 1490 1484 1483 
-3 1490 1491 1485 
-3 1490 1485 1484 
-3 1491 1486 1485 
-3 1491 1492 1487 
-3 1491 1487 1486 
-3 1492 1493 1488 
-3 1492 1488 1487 
-3 1493 1489 1488 
-3 1301 1494 1302 
-3 1495 1496 1497 
-3 1495 1497 1498 
-3 1499 1495 1301 
-3 1499 1500 1496 
-3 1499 1496 1495 
-3 1300 1501 1499 
-3 1300 1499 1301 
-3 1501 1502 1500 
-3 1501 1500 1499 
-3 1299 1503 1501 
-3 1299 1501 1300 
-3 1298 1504 1503 
-3 1298 1503 1299 
-3 1505 1506 1503 
-3 1505 1503 1504 
-3 1503 1506 1502 
-3 1503 1502 1501 
-3 1507 1508 1478 
-3 1507 1478 1479 
-3 1509 1507 1479 
-3 1509 1479 1480 
-3 1510 1509 1480 
-3 1510 1480 1481 
-3 1511 1510 1481 
-3 1511 1481 1482 
-3 1512 1511 1482 
-3 1512 1482 1469 
-3 1512 1469 1468 
-3 1513 1514 1510 
-3 1513 1510 1511 
-3 1514 1515 1509 
-3 1514 1509 1510 
-3 1515 1516 1507 
-3 1515 1507 1509 
-3 1516 1517 1508 
-3 1516 1508 1507 
-3 1508 1518 1490 
-3 1508 1490 1478 
-3 1518 1519 1491 
-3 1518 1491 1490 
-3 1519 1520 1492 
-3 1519 1492 1491 
-3 1520 1521 1493 
-3 1520 1493 1492 
-3 1521 1522 1489 
-3 1521 1489 1493 
-3 1523 1524 1522 
-3 1523 1522 1521 
-3 1520 1525 1523 
-3 1520 1523 1521 
-3 1519 1526 1525 
-3 1519 1525 1520 
-3 1518 1527 1526 
-3 1518 1526 1519 
-3 1508 1517 1527 
-3 1508 1527 1518 
-3 1528 1529 1407 
-3 1528 1407 1406 
-3 1530 1408 1407 
-3 1530 1407 1529 
-3 1531 1409 1408 
-3 1531 1408 1530 
-3 1417 1409 1531 
-3 1417 1531 1532 
-3 1529 1528 1533 
-3 1533 1534 1530 
-3 1533 1530 1529 
-3 1535 1536 1534 
-3 1535 1534 1533 
-3 1152 1151 1536 
-3 1152 1536 1535 
-3 1154 1537 1536 
-3 1154 1536 1151 
-3 1537 1538 1534 
-3 1537 1534 1536 
-3 1538 1531 1530 
-3 1538 1530 1534 
-3 1157 1539 1537 
-3 1157 1537 1154 
-3 1540 1538 1537 
-3 1540 1537 1539 
-3 1532 1531 1538 
-3 1532 1538 1540 
-3 1417 1541 1423 
-3 1417 1423 1418 
-3 1532 1542 1541 
-3 1532 1541 1417 
-3 1540 1543 1542 
-3 1540 1542 1532 
-3 1539 1544 1543 
-3 1539 1543 1540 
-3 1157 1163 1544 
-3 1157 1544 1539 
-3 1541 1424 1423 
-3 1545 1546 1424 
-3 1545 1424 1541 
-3 1547 1468 1546 
-3 1547 1546 1545 
-3 1546 1464 1425 
-3 1546 1425 1424 
-3 1548 1549 1545 
-3 1548 1545 1541 
-3 1549 1547 1545 
-3 1542 1550 1548 
-3 1542 1548 1541 
-3 1543 1551 1550 
-3 1543 1550 1542 
-3 1544 1552 1551 
-3 1544 1551 1543 
-3 1163 1172 1552 
-3 1163 1552 1544 
-3 1174 1553 1552 
-3 1174 1552 1172 
-3 1553 1554 1551 
-3 1553 1551 1552 
-3 1554 1555 1550 
-3 1554 1550 1551 
-3 1555 1556 1548 
-3 1555 1548 1550 
-3 1556 1549 1548 
-3 1547 1557 1512 
-3 1547 1512 1468 
-3 1557 1513 1511 
-3 1557 1511 1512 
-3 1547 1549 1557 
-3 1549 1558 1513 
-3 1549 1513 1557 
-3 1558 1559 1514 
-3 1558 1514 1513 
-3 1514 1559 1560 
-3 1514 1560 1515 
-3 1560 1561 1516 
-3 1560 1516 1515 
-3 1561 1562 1517 
-3 1561 1517 1516 
-3 1562 1563 1527 
-3 1562 1527 1517 
-3 1563 1564 1526 
-3 1563 1526 1527 
-3 1564 1565 1525 
-3 1564 1525 1526 
-3 1525 1565 1566 
-3 1525 1566 1523 
-3 1566 1567 1524 
-3 1566 1524 1523 
-3 1190 1568 1553 
-3 1190 1553 1174 
-3 1568 1569 1554 
-3 1568 1554 1553 
-3 1569 1570 1555 
-3 1569 1555 1554 
-3 1570 1571 1556 
-3 1570 1556 1555 
-3 1571 1558 1549 
-3 1571 1549 1556 
-3 1195 1572 1568 
-3 1195 1568 1190 
-3 1572 1573 1569 
-3 1572 1569 1568 
-3 1573 1574 1570 
-3 1573 1570 1569 
-3 1574 1575 1570 
-3 1575 1576 1571 
-3 1575 1571 1570 
-3 1576 1559 1558 
-3 1576 1558 1571 
-3 1201 1577 1572 
-3 1201 1572 1195 
-3 1577 1578 1573 
-3 1577 1573 1572 
-3 1578 1579 1574 
-3 1578 1574 1573 
-3 1579 1580 1575 
-3 1579 1575 1574 
-3 1580 1581 1576 
-3 1580 1576 1575 
-3 1207 1582 1577 
-3 1207 1577 1201 
-3 1582 1583 1578 
-3 1582 1578 1577 
-3 1583 1584 1579 
-3 1583 1579 1578 
-3 1584 1585 1580 
-3 1584 1580 1579 
-3 1585 1586 1580 
-3 1586 1587 1581 
-3 1586 1581 1580 
-3 1214 1588 1582 
-3 1214 1582 1207 
-3 1588 1589 1583 
-3 1588 1583 1582 
-3 1589 1590 1584 
-3 1589 1584 1583 
-3 1590 1591 1585 
-3 1590 1585 1584 
-3 1591 1592 1586 
-3 1591 1586 1585 
-3 1592 1593 1587 
-3 1592 1587 1586 
-3 1221 1594 1588 
-3 1221 1588 1214 
-3 1594 1595 1589 
-3 1594 1589 1588 
-3 1595 1596 1590 
-3 1595 1590 1589 
-3 1596 1597 1591 
-3 1596 1591 1590 
-3 1597 1598 1592 
-3 1597 1592 1591 
-3 1598 1599 1593 
-3 1598 1593 1592 
-3 1228 1600 1594 
-3 1228 1594 1221 
-3 1600 1601 1595 
-3 1600 1595 1594 
-3 1601 1602 1596 
-3 1601 1596 1595 
-3 1602 1603 1597 
-3 1602 1597 1596 
-3 1603 1604 1598 
-3 1603 1598 1597 
-3 1604 1605 1599 
-3 1604 1599 1598 
-3 1235 1606 1600 
-3 1235 1600 1228 
-3 1237 1607 1606 
-3 1237 1606 1235 
-3 1239 1608 1607 
-3 1239 1607 1237 
-3 1606 1609 1601 
-3 1606 1601 1600 
-3 1607 1610 1609 
-3 1607 1609 1606 
-3 1608 1611 1610 
-3 1608 1610 1607 
-3 1609 1612 1602 
-3 1609 1602 1601 
-3 1610 1613 1612 
-3 1610 1612 1609 
-3 1611 1614 1613 
-3 1611 1613 1610 
-3 1612 1615 1603 
-3 1612 1603 1602 
-3 1613 1616 1615 
-3 1613 1615 1612 
-3 1614 1617 1616 
-3 1614 1616 1613 
-3 1615 1618 1604 
-3 1615 1604 1603 
-3 1616 1619 1618 
-3 1616 1618 1615 
-3 1617 1620 1619 
-3 1617 1619 1616 
-3 1618 1621 1605 
-3 1618 1605 1604 
-3 1619 1622 1621 
-3 1619 1621 1618 
-3 1620 1623 1622 
-3 1620 1622 1619 
-3 1581 1560 1559 
-3 1581 1559 1576 
-3 1587 1561 1560 
-3 1587 1560 1581 
-3 1593 1562 1561 
-3 1593 1561 1587 
-3 1599 1563 1562 
-3 1599 1562 1593 
-3 1605 1564 1563 
-3 1605 1563 1599 
-3 1621 1565 1564 
-3 1621 1564 1605 
-3 1622 1566 1565 
-3 1622 1565 1621 
-3 1623 1567 1566 
-3 1623 1566 1622 
-3 1468 1464 1546 
-3 1301 1495 1498 
-3 1301 1498 1494 
-3 1263 1624 1625 
-3 1263 1625 1626 
-3 1263 1626 1627 
-3 1263 1627 1628 
-3 1263 1628 1629 
-3 1263 1629 1630 
-3 1263 1630 1255 
-3 1504 1631 1625 
-3 1504 1625 1505 
-3 1298 1632 1631 
-3 1298 1631 1504 
-3 1297 1633 1632 
-3 1297 1632 1298 
-3 1296 1634 1633 
-3 1296 1633 1297 
-3 1346 1635 1634 
-3 1346 1634 1296 
-3 1348 1636 1635 
-3 1348 1635 1346 
-3 1358 1637 1636 
-3 1358 1636 1348 
-3 1357 1638 1637 
-3 1357 1637 1358 
-3 1392 1639 1638 
-3 1392 1638 1357 
-3 1446 1640 1639 
-3 1446 1639 1392 
-3 1457 1641 1640 
-3 1457 1640 1446 
-3 1489 1642 1641 
-3 1489 1641 1457 
-3 1522 1643 1642 
-3 1522 1642 1489 
-3 1524 1644 1643 
-3 1524 1643 1522 
-3 1567 1645 1644 
-3 1567 1644 1524 
-3 1623 1646 1645 
-3 1623 1645 1567 
-3 1620 1626 1646 
-3 1620 1646 1623 
-3 1617 1627 1626 
-3 1617 1626 1620 
-3 1614 1628 1627 
-3 1614 1627 1617 
-3 1611 1629 1628 
-3 1611 1628 1614 
-3 1608 1630 1629 
-3 1608 1629 1611 
-3 1239 1255 1630 
-3 1239 1630 1608 
-3 1640 1641 1642 
-3 1640 1642 1643 
-3 1640 1643 1644 
-3 1640 1644 1645 
-3 1640 1645 1646 
-3 1625 1631 1632 
-3 1625 1632 1633 
-3 1625 1633 1634 
-3 1625 1634 1635 
-3 1625 1635 1636 
-3 1625 1636 1637 
-3 1625 1637 1638 
-3 1625 1638 1639 
-3 1625 1639 1640 
-3 1625 1640 1646 
-3 1625 1646 1626 
-3 1647 982 983 
-3 1648 1649 1650 
-3 1648 1650 1651 
-3 1649 1652 1653 
-3 1649 1653 1650 
-3 1654 1655 1653 
-3 1654 1653 1652 
-3 1655 1656 1657 
-3 1655 1657 1653 
-3 1653 1657 1658 
-3 1653 1658 1650 
-3 1650 1658 1659 
-3 1650 1659 1651 
-3 1659 1658 1660 
-3 1659 1660 1661 
-3 1658 1657 1662 
-3 1658 1662 1660 
-3 1657 1656 1663 
-3 1657 1663 1662 
-3 1662 1663 1664 
-3 1662 1664 1665 
-3 1665 1664 1666 
-3 1665 1666 1667 
-3 1667 1666 1668 
-3 1668 1666 1669 
-3 1668 1669 1670 
-3 1670 1669 1671 
-3 1670 1671 1672 
-3 1670 1672 1673 
-3 1670 1673 1674 
-3 1674 1675 1668 
-3 1674 1668 1670 
-3 1668 1675 1676 
-3 1668 1676 1667 
-3 1665 1677 1660 
-3 1665 1660 1662 
-3 1665 1667 1676 
-3 1665 1676 1677 
-3 1660 1677 1678 
-3 1660 1678 1661 
-3 1678 1677 1679 
-3 1678 1679 1680 
-3 1679 1677 1676 
-3 1676 1675 1681 
-3 1676 1681 1679 
-3 1679 1681 1682 
-3 1679 1682 1680 
-3 1674 1673 1683 
-3 1674 1683 1684 
-3 1684 1685 1675 
-3 1684 1675 1674 
-3 1675 1685 1681 
-3 1681 1686 1687 
-3 1681 1687 1682 
-3 1681 1685 1688 
-3 1681 1688 1686 
-3 1688 1685 1684 
-3 1688 1684 1689 
-3 1689 1684 1683 
-3 1689 1683 1690 
-3 1689 1691 1688 
-3 1688 1691 1686 
-3 1691 1689 1690 
-3 1691 1690 1692 
-3 1692 1693 1691 
-3 1691 1693 1694 
-3 1694 1695 1691 
-3 1691 1695 1696 
-3 1696 1687 1686 
-3 1696 1686 1691 
-3 1019 1021 1697 
-3 1019 1697 1698 
-3 1697 1648 1651 
-3 1697 1651 1698 
-3 1651 1659 1699 
-3 1651 1699 1698 
-3 1698 1699 1016 
-3 1698 1016 1019 
-3 1659 1661 1700 
-3 1659 1700 1699 
-3 1699 1700 1011 
-3 1699 1011 1016 
-3 1661 1678 1701 
-3 1661 1701 1700 
-3 1700 1701 1008 
-3 1700 1008 1011 
-3 1680 1702 1701 
-3 1680 1701 1678 
-3 1680 1682 1703 
-3 1680 1703 1702 
-3 1008 1701 1702 
-3 1008 1702 989 
-3 1702 1703 986 
-3 1702 986 989 
-3 985 1704 1705 
-3 985 1705 983 
-3 983 1705 1706 
-3 983 1706 1647 
-3 1647 1706 1707 
-3 1647 1707 1708 
-3 982 1647 1708 
-3 982 1708 1709 
-3 1709 1708 1710 
-3 1709 977 982 
-3 1710 1708 1707 
-3 1710 1707 1711 
-3 1707 1692 1690 
-3 1707 1690 1711 
-3 1692 1707 1706 
-3 1692 1706 1693 
-3 1693 1706 1694 
-3 1706 1695 1694 
-3 1706 1705 1696 
-3 1706 1696 1695 
-3 1705 1704 1687 
-3 1705 1687 1696 
-3 1704 1703 1682 
-3 1704 1682 1687 
-3 979 1712 1713 
-3 979 1713 980 
-3 979 978 1714 
-3 979 1714 1712 
-3 1713 1715 895 
-3 1713 895 980 
-3 1714 978 977 
-3 1714 977 1716 
-3 1715 1717 919 
-3 1715 919 895 
-3 1718 1719 1717 
-3 1718 1717 1715 
-3 1718 1720 1719 
-3 1718 1715 1713 
-3 1718 1713 1721 
-3 1721 1720 1718 
-3 1712 1722 1721 
-3 1712 1721 1713 
-3 1722 1712 1714 
-3 1722 1714 1723 
-3 1723 1714 1716 
-3 1723 1716 1724 
-3 1724 1725 1726 
-3 1724 1726 1723 
-3 1723 1726 1727 
-3 1723 1727 1722 
-3 1727 1726 1728 
-3 1729 1728 1726 
-3 1729 1726 1725 
-3 1729 1725 1730 
-3 1716 977 1709 
-3 1716 1709 1731 
-3 1709 1710 1731 
-3 1710 1711 1732 
-3 1710 1732 1733 
-3 1690 1683 1732 
-3 1690 1732 1711 
-3 1732 1734 1735 
-3 1732 1735 1733 
-3 1732 1683 1673 
-3 1732 1673 1734 
-3 1724 1716 1731 
-3 1724 1731 1736 
-3 1736 1725 1724 
-3 1736 1737 1730 
-3 1736 1730 1725 
-3 1710 1733 1736 
-3 1710 1736 1731 
-3 1733 1735 1737 
-3 1733 1737 1736 
-3 1735 1738 1737 
-3 1737 1738 1739 
-3 1737 1739 1730 
-3 1739 1740 1729 
-3 1739 1729 1730 
-3 1738 1735 1741 
-3 1741 1735 1742 
-3 1742 1735 1734 
-3 1742 1734 1743 
-3 1743 1734 1673 
-3 1741 1742 1744 
-3 1741 1744 1745 
-3 1744 1746 1745 
-3 1746 1744 1747 
-3 1747 1748 1746 
-3 1746 1748 1749 
-3 1746 1749 1745 
-3 1744 1742 1743 
-3 1744 1743 1750 
-3 1747 1744 1750 
-3 1747 1750 1751 
-3 1751 1752 1747 
-3 1751 1750 1672 
-3 1751 1672 1671 
-3 1672 1750 1743 
-3 1672 1743 1673 
-3 1752 1751 1671 
-3 1752 1671 1753 
-3 1669 1754 1753 
-3 1669 1753 1671 
-3 1755 1754 1669 
-3 1755 1669 1666 
-3 1666 1664 1756 
-3 1666 1756 1755 
-3 1756 1664 1663 
-3 1756 1663 1757 
-3 1757 1663 1656 
-3 1757 1656 1758 
-3 1758 1656 1655 
-3 1758 1655 1759 
-3 1759 1655 1654 
-3 1759 1654 1760 
-3 1759 477 476 
-3 1759 476 1758 
-3 1758 476 480 
-3 1758 480 1757 
-3 1757 480 482 
-3 1757 482 1756 
-3 1756 482 484 
-3 1756 484 1755 
-3 1747 1761 1762 
-3 1747 1762 1748 
-3 1748 1762 1763 
-3 1748 1763 1749 
-3 1747 1764 1761 
-3 1747 1765 1764 
-3 1747 1752 1766 
-3 1747 1766 1765 
-3 1752 1753 1767 
-3 1752 1767 1766 
-3 1764 1765 1768 
-3 1764 1768 1769 
-3 1769 1770 1761 
-3 1769 1761 1764 
-3 1766 1768 1765 
-3 1767 475 1771 
-3 1771 1768 1766 
-3 1771 1766 1767 
-3 1772 1770 1769 
-3 1772 1769 1773 
-3 1773 1774 1775 
-3 1773 1775 1772 
-3 1769 1768 1776 
-3 1769 1776 1773 
-3 1771 1776 1768 
-3 475 473 1776 
-3 475 1776 1771 
-3 1776 1777 1774 
-3 1776 1774 1773 
-3 1761 1770 1778 
-3 1761 1778 1762 
-3 1762 1778 1779 
-3 1762 1779 1763 
-3 1779 1778 1780 
-3 1779 1780 1781 
-3 1778 1770 1772 
-3 1778 1772 1780 
-3 1780 1772 1782 
-3 1782 1772 1775 
-3 1782 1775 1783 
-3 1783 1784 1785 
-3 1783 1785 1782 
-3 1782 1785 1781 
-3 1782 1781 1780 
-3 473 2 1777 
-3 473 1777 1776 
-3 1110 1786 1111 
-3 1111 1786 1787 
-3 1111 1787 1114 
-3 1786 1788 1787 
-3 1114 1787 1789 
-3 1114 1789 1116 
-3 1787 1788 1790 
-3 1787 1790 1789 
-3 1116 1789 1791 
-3 1116 1791 1119 
-3 1119 1791 1792 
-3 1119 1792 1120 
-3 1789 1790 1793 
-3 1789 1793 1791 
-3 1791 1793 1794 
-3 1791 1794 1792 
-3 1760 486 477 
-3 1760 477 1759 
-3 1143 1648 1697 
-3 1143 1697 1021 
-3 1703 1704 985 
-3 1703 985 986 
-3 591 475 1767 
-3 591 1767 579 
-3 1754 1755 484 
-3 1754 484 500 
-3 1754 500 498 
-3 1767 1753 579 
-3 498 566 570 
-3 498 570 579 
-3 498 579 1753 
-3 1753 1754 498 
-3 1795 1796 1797 
-3 1798 1795 1797 
-3 1798 1797 1799 
-3 1786 1110 1109 
-3 1799 1800 1801 
-3 1799 1801 1798 
-3 1798 1801 1802 
-3 1798 1802 1803 
-3 1803 1802 1804 
-3 1803 1804 1805 
-3 1805 1804 1806 
-3 1805 1806 1807 
-3 1807 1806 1808 
-3 1807 1808 1809 
-3 1809 1808 1810 
-3 1809 1810 1811 
-3 1811 1810 1812 
-3 1811 1812 1813 
-3 1813 1812 1814 
-3 1813 1814 1815 
-3 1815 1814 1816 
-3 1815 1816 1817 
-3 1817 1816 1818 
-3 1817 1818 1109 
-3 1109 1818 1819 
-3 1109 1819 1786 
-3 1786 1819 1820 
-3 1786 1820 1788 
-3 1788 1820 1821 
-3 1788 1821 1790 
-3 1790 1821 1822 
-3 1790 1822 1793 
-3 1794 1263 1262 
-3 1794 1262 1792 
-3 1792 1262 1261 
-3 1792 1261 1120 
-3 1794 1793 1822 
-3 1371 1367 1823 
-3 1824 1825 1826 
-3 1824 1826 1827 
-3 1825 1828 1829 
-3 1825 1829 1826 
-3 1829 1828 1830 
-3 1829 1830 1831 
-3 1828 1832 1833 
-3 1828 1833 1830 
-3 1825 1834 1832 
-3 1825 1832 1828 
-3 1824 1835 1834 
-3 1824 1834 1825 
-3 1836 1837 1834 
-3 1836 1834 1835 
-3 1837 1838 1832 
-3 1837 1832 1834 
-3 1838 1839 1833 
-3 1838 1833 1832 
-3 1840 1841 1839 
-3 1840 1839 1838 
-3 1842 1843 1841 
-3 1842 1841 1840 
-3 1844 1843 1842 
-3 1845 1846 1843 
-3 1845 1843 1844 
-3 1847 1848 1846 
-3 1847 1846 1845 
-3 1849 1850 1847 
-3 1849 1847 1845 
-3 1845 1844 1851 
-3 1845 1851 1849 
-3 1842 1852 1851 
-3 1842 1851 1844 
-3 1838 1837 1853 
-3 1838 1853 1840 
-3 1853 1852 1842 
-3 1853 1842 1840 
-3 1836 1854 1853 
-3 1836 1853 1837 
-3 1855 1856 1853 
-3 1855 1853 1854 
-3 1852 1853 1856 
-3 1856 1857 1851 
-3 1856 1851 1852 
-3 1855 1858 1857 
-3 1855 1857 1856 
-3 1859 1860 1850 
-3 1859 1850 1849 
-3 1849 1851 1861 
-3 1849 1861 1859 
-3 1857 1861 1851 
-3 1858 1862 1863 
-3 1858 1863 1857 
-3 1863 1864 1861 
-3 1863 1861 1857 
-3 1865 1859 1861 
-3 1865 1861 1864 
-3 1866 1860 1859 
-3 1866 1859 1865 
-3 1864 1867 1865 
-3 1863 1867 1864 
-3 1868 1866 1865 
-3 1868 1865 1867 
-3 1867 1869 1868 
-3 1870 1869 1867 
-3 1867 1871 1870 
-3 1872 1871 1867 
-3 1867 1863 1862 
-3 1867 1862 1872 
-3 1873 1874 1406 
-3 1873 1406 1405 
-3 1873 1824 1827 
-3 1873 1827 1874 
-3 1873 1875 1835 
-3 1873 1835 1824 
-3 1405 1402 1875 
-3 1405 1875 1873 
-3 1875 1876 1836 
-3 1875 1836 1835 
-3 1402 1398 1876 
-3 1402 1876 1875 
-3 1876 1877 1854 
-3 1876 1854 1836 
-3 1398 1395 1877 
-3 1398 1877 1876 
-3 1854 1877 1878 
-3 1854 1878 1855 
-3 1878 1879 1858 
-3 1878 1858 1855 
-3 1374 1878 1877 
-3 1374 1877 1395 
-3 1374 1373 1879 
-3 1374 1879 1878 
-3 1371 1880 1881 
-3 1371 1881 1369 
-3 1823 1882 1880 
-3 1823 1880 1371 
-3 1883 1884 1882 
-3 1883 1882 1823 
-3 1885 1883 1823 
-3 1885 1823 1367 
-3 1886 1883 1885 
-3 1367 1364 1885 
-3 1887 1884 1883 
-3 1887 1883 1886 
-3 1887 1866 1868 
-3 1887 1868 1884 
-3 1869 1882 1884 
-3 1869 1884 1868 
-3 1870 1882 1869 
-3 1870 1871 1882 
-3 1871 1872 1880 
-3 1871 1880 1882 
-3 1872 1862 1881 
-3 1872 1881 1880 
-3 1862 1858 1879 
-3 1862 1879 1881 
-3 1366 1888 1889 
-3 1366 1889 1365 
-3 1889 1890 1363 
-3 1889 1363 1365 
-3 1366 1282 1891 
-3 1366 1891 1888 
-3 1892 1364 1363 
-3 1892 1363 1890 
-3 1282 1305 1893 
-3 1282 1893 1891 
-3 1891 1893 1894 
-3 1891 1894 1895 
-3 1894 1896 1895 
-3 1897 1888 1891 
-3 1897 1891 1895 
-3 1895 1896 1897 
-3 1888 1897 1898 
-3 1888 1898 1889 
-3 1899 1890 1889 
-3 1899 1889 1898 
-3 1900 1892 1890 
-3 1900 1890 1899 
-3 1899 1901 1902 
-3 1899 1902 1900 
-3 1898 1903 1901 
-3 1898 1901 1899 
-3 1904 1901 1903 
-3 1901 1904 1905 
-3 1906 1902 1901 
-3 1906 1901 1905 
-3 1907 1885 1364 
-3 1907 1364 1892 
-3 1907 1886 1885 
-3 1908 1909 1887 
-3 1908 1887 1886 
-3 1887 1909 1860 
-3 1887 1860 1866 
-3 1908 1910 1911 
-3 1908 1911 1909 
-3 1911 1850 1860 
-3 1911 1860 1909 
-3 1912 1907 1892 
-3 1912 1892 1900 
-3 1900 1902 1912 
-3 1902 1906 1913 
-3 1902 1913 1912 
-3 1907 1912 1908 
-3 1907 1908 1886 
-3 1912 1913 1910 
-3 1912 1910 1908 
-3 1913 1914 1910 
-3 1906 1915 1914 
-3 1906 1914 1913 
-3 1906 1905 1916 
-3 1906 1916 1915 
-3 1917 1910 1914 
-3 1918 1910 1917 
-3 1919 1911 1910 
-3 1919 1910 1918 
-3 1850 1911 1919 
-3 1920 1921 1918 
-3 1920 1918 1917 
-3 1920 1922 1921 
-3 1923 1921 1922 
-3 1922 1924 1923 
-3 1920 1925 1924 
-3 1920 1924 1922 
-3 1926 1919 1918 
-3 1926 1918 1921 
-3 1927 1926 1921 
-3 1927 1921 1923 
-3 1923 1928 1927 
-3 1848 1847 1926 
-3 1848 1926 1927 
-3 1850 1919 1926 
-3 1850 1926 1847 
-3 1929 1848 1927 
-3 1929 1927 1928 
-3 1848 1929 1930 
-3 1848 1930 1846 
-3 1843 1846 1930 
-3 1843 1930 1931 
-3 1931 1932 1841 
-3 1931 1841 1843 
-3 1933 1839 1841 
-3 1933 1841 1932 
-3 1934 1833 1839 
-3 1934 1839 1933 
-3 1935 1830 1833 
-3 1935 1833 1934 
-3 1936 1831 1830 
-3 1936 1830 1935 
-3 1934 7 6 
-3 1934 6 1935 
-3 1933 8 7 
-3 1933 7 1934 
-3 1932 10 8 
-3 1932 8 1933 
-3 1931 12 10 
-3 1931 10 1932 
-3 1924 1937 1938 
-3 1924 1938 1923 
-3 1925 1939 1937 
-3 1925 1937 1924 
-3 1938 1940 1923 
-3 1940 1941 1923 
-3 1941 1942 1928 
-3 1941 1928 1923 
-3 1942 1943 1929 
-3 1942 1929 1928 
-3 1944 1945 1941 
-3 1944 1941 1940 
-3 1940 1938 1946 
-3 1940 1946 1944 
-3 1941 1945 1942 
-3 1947 4 1943 
-3 1943 1942 1945 
-3 1943 1945 1947 
-3 1948 1944 1946 
-3 1948 1946 1949 
-3 1949 1775 1774 
-3 1949 1774 1948 
-3 1948 1950 1945 
-3 1948 1945 1944 
-3 1945 1950 1947 
-3 1947 1950 1 
-3 1947 1 4 
-3 1948 1774 1777 
-3 1948 1777 1950 
-3 1937 1951 1946 
-3 1937 1946 1938 
-3 1939 1952 1951 
-3 1939 1951 1937 
-3 1953 1954 1951 
-3 1953 1951 1952 
-3 1954 1949 1946 
-3 1954 1946 1951 
-3 1955 1949 1954 
-3 1783 1775 1949 
-3 1783 1949 1955 
-3 1955 1956 1784 
-3 1955 1784 1783 
-3 1954 1953 1956 
-3 1954 1956 1955 
-3 1950 1777 2 
-3 1950 2 1 
-3 1496 1957 1497 
-3 1500 1958 1957 
-3 1500 1957 1496 
-3 1958 1959 1957 
-3 1502 1960 1958 
-3 1502 1958 1500 
-3 1960 1961 1959 
-3 1960 1959 1958 
-3 1506 1962 1960 
-3 1506 1960 1502 
-3 1505 1963 1962 
-3 1505 1962 1506 
-3 1962 1964 1961 
-3 1962 1961 1960 
-3 1963 1794 1964 
-3 1963 1964 1962 
-3 1935 6 14 
-3 1935 14 1936 
-3 1406 1874 1827 
-3 1406 1827 1528 
-3 1373 1369 1881 
-3 1373 1881 1879 
-3 108 1943 4 
-3 108 4 129 
-3 29 12 1931 
-3 29 1931 1930 
-3 28 29 1930 
-3 108 1929 1943 
-3 1929 108 99 
-3 1929 99 95 
-3 1929 95 28 
-3 28 1930 1929 
-3 1965 1966 1967 
-3 1968 1965 1967 
-3 1968 1967 1969 
-3 1498 1497 1957 
-3 1969 1801 1800 
-3 1969 1800 1968 
-3 1970 1802 1801 
-3 1970 1801 1969 
-3 1971 1804 1802 
-3 1971 1802 1970 
-3 1972 1806 1804 
-3 1972 1804 1971 
-3 1973 1808 1806 
-3 1973 1806 1972 
-3 1974 1810 1808 
-3 1974 1808 1973 
-3 1975 1812 1810 
-3 1975 1810 1974 
-3 1976 1814 1812 
-3 1976 1812 1975 
-3 1977 1816 1814 
-3 1977 1814 1976 
-3 1498 1818 1816 
-3 1498 1816 1977 
-3 1957 1819 1818 
-3 1957 1818 1498 
-3 1959 1820 1819 
-3 1959 1819 1957 
-3 1961 1821 1820 
-3 1961 1820 1959 
-3 1964 1822 1821 
-3 1964 1821 1961 
-3 1963 1624 1263 
-3 1963 1263 1794 
-3 1505 1625 1624 
-3 1505 1624 1963 
-3 1822 1964 1794 
-3 1073 1076 1978 
-3 1073 1978 1979 
-3 1073 1979 1980 
-3 1073 1980 1074 
-3 1074 1980 1981 
-3 1074 1981 1064 
-3 1981 1982 1065 
-3 1981 1065 1064 
-3 1982 1983 1077 
-3 1982 1077 1065 
-3 1978 1076 1077 
-3 1978 1077 1983 
-3 1984 1985 1980 
-3 1984 1980 1979 
-3 1979 1978 1986 
-3 1979 1986 1984 
-3 1986 1978 1983 
-3 1986 1983 1987 
-3 1987 1983 1982 
-3 1987 1982 1988 
-3 1988 1982 1981 
-3 1988 1981 1989 
-3 1989 1981 1980 
-3 1989 1980 1985 
-3 1990 1985 1984 
-3 1990 1984 1986 
-3 1990 1986 1987 
-3 1990 1987 1988 
-3 1990 1988 1989 
-3 1990 1989 1985 
-3 1991 1992 1462 
-3 1991 1462 1461 
-3 1460 1993 1991 
-3 1460 1991 1461 
-3 1450 1994 1993 
-3 1450 1993 1460 
-3 1450 1449 1995 
-3 1450 1995 1994 
-3 1449 1463 1996 
-3 1449 1996 1995 
-3 1996 1463 1462 
-3 1996 1462 1992 
-3 1991 1993 1997 
-3 1991 1997 1998 
-3 1998 1999 1992 
-3 1998 1992 1991 
-3 2000 1996 1992 
-3 2000 1992 1999 
-3 2001 1995 1996 
-3 2001 1996 2000 
-3 2002 1994 1995 
-3 2002 1995 2001 
-3 1997 1993 1994 
-3 1997 1994 2002 
-3 1998 1997 2003 
-3 1999 1998 2003 
-3 2000 1999 2003 
-3 2001 2000 2003 
-3 2002 2001 2003 
-3 1997 2002 2003 
-3 2004 1738 2005 
-3 2004 2005 2006 
-3 2004 1740 1739 
-3 2004 1739 1738 
-3 1741 2007 1738 
-3 2007 2008 2005 
-3 2007 2005 1738 
-3 2008 2009 2006 
-3 2008 2006 2005 
-3 1745 2010 2007 
-3 1745 2007 1741 
-3 2010 2011 2008 
-3 2010 2008 2007 
-3 2011 2012 2009 
-3 2011 2009 2008 
-3 1745 1749 2010 
-3 1749 2013 2011 
-3 1749 2011 2010 
-3 1749 1763 2013 
-3 2013 2014 2012 
-3 2013 2012 2011 
-3 1763 1779 2014 
-3 1763 2014 2013 
-3 2014 2015 2016 
-3 2014 2016 2012 
-3 1779 1781 2015 
-3 1779 2015 2014 
-3 2012 2016 2017 
-3 2012 2017 2009 
-3 2018 1781 1785 
-3 2018 1785 2019 
-3 2019 1785 1784 
-3 2019 1784 2020 
-3 2020 2021 2022 
-3 2020 2022 2019 
-3 2019 2022 2023 
-3 2019 2023 2018 
-3 2018 2023 2016 
-3 2018 2016 2015 
-3 2016 2024 2017 
-3 2016 2023 2025 
-3 2016 2025 2024 
-3 2023 2022 2026 
-3 2023 2026 2025 
-3 2022 2021 2027 
-3 2022 2027 2026 
-3 2024 2028 2017 
-3 2024 2025 2029 
-3 2024 2029 2028 
-3 2025 2026 2030 
-3 2025 2030 2029 
-3 2026 2027 2031 
-3 2026 2031 2030 
-3 2017 2028 2032 
-3 2017 2032 2033 
-3 2017 2033 2034 
-3 2017 2034 2009 
-3 2033 2035 2036 
-3 2033 2036 2034 
-3 2006 2009 2034 
-3 2006 2034 2037 
-3 1740 2037 2038 
-3 1740 2038 1729 
-3 1740 2004 2006 
-3 1740 2006 2037 
-3 2037 2034 2036 
-3 2037 2036 2038 
-3 2038 2039 1728 
-3 2038 1728 1729 
-3 2036 2040 2039 
-3 2036 2039 2038 
-3 2035 2041 2040 
-3 2035 2040 2036 
-3 2033 2032 2042 
-3 2033 2042 2035 
-3 1728 2039 2043 
-3 1728 2043 1727 
-3 2040 2043 2039 
-3 2043 2044 1722 
-3 2043 1722 1727 
-3 2040 2045 2044 
-3 2040 2044 2043 
-3 2040 2041 2045 
-3 2035 2042 2046 
-3 2035 2046 2041 
-3 2041 2046 2047 
-3 2041 2047 2045 
-3 2045 2048 2044 
-3 1722 2044 2048 
-3 1722 2048 2049 
-3 1722 2050 1721 
-3 2050 2051 2052 
-3 2050 2052 1721 
-3 1722 2053 2050 
-3 1722 2049 2053 
-3 2053 2054 2051 
-3 2053 2051 2050 
-3 2053 2049 2054 
-3 2049 2055 2056 
-3 2049 2056 2054 
-3 2054 2056 2057 
-3 2054 2057 2051 
-3 2049 2048 2058 
-3 2049 2058 2055 
-3 2045 2047 2059 
-3 2045 2059 2048 
-3 2048 2059 2060 
-3 2048 2060 2058 
-3 2028 2029 2061 
-3 2028 2061 2062 
-3 2029 2030 2063 
-3 2029 2063 2061 
-3 2030 2031 2064 
-3 2030 2064 2063 
-3 2063 2064 2065 
-3 2063 2065 2066 
-3 2063 2066 2067 
-3 2063 2067 2061 
-3 2061 2067 2068 
-3 2061 2068 2062 
-3 1799 2066 2065 
-3 1799 2065 2069 
-3 1799 1797 2067 
-3 1799 2067 2066 
-3 2067 1797 1796 
-3 2067 1796 2068 
-3 2028 2062 2070 
-3 2028 2070 2032 
-3 2032 2070 2071 
-3 2032 2071 2042 
-3 2042 2071 2046 
-3 2046 2071 2047 
-3 2047 2071 2072 
-3 2047 2072 2059 
-3 2059 2072 2073 
-3 2059 2073 2060 
-3 2062 2068 2074 
-3 2062 2074 2070 
-3 2070 2074 2075 
-3 2070 2075 2071 
-3 2071 2075 2076 
-3 2071 2076 2072 
-3 2068 1796 1795 
-3 2068 1795 2074 
-3 2074 1795 1798 
-3 2074 1798 2075 
-3 2075 1798 1803 
-3 2075 1803 2076 
-3 2076 1803 1805 
-3 2076 1805 2077 
-3 2072 2076 2077 
-3 2072 2077 2073 
-3 2073 2077 2078 
-3 2073 2078 2079 
-3 2077 1805 1807 
-3 2077 1807 2078 
-3 2078 1807 1809 
-3 2078 1809 2080 
-3 2080 2081 2079 
-3 2079 2078 2080 
-3 2081 2060 2073 
-3 2081 2073 2079 
-3 2080 1809 1811 
-3 2080 1811 2082 
-3 2080 2082 2083 
-3 2083 2084 2081 
-3 2083 2081 2080 
-3 2081 2084 2085 
-3 2081 2085 2086 
-3 2081 2086 2087 
-3 2087 2058 2060 
-3 2087 2060 2081 
-3 2058 2087 2088 
-3 2058 2088 2055 
-3 2055 2088 2089 
-3 2055 2089 2056 
-3 2056 2089 2090 
-3 2056 2090 2057 
-3 2090 2089 2091 
-3 1721 2052 2092 
-3 1721 2092 1720 
-3 1720 2092 2093 
-3 1720 2093 1719 
-3 1719 2093 1717 
-3 2093 2094 918 
-3 2093 918 919 
-3 2093 919 1717 
-3 2094 2095 917 
-3 2094 917 918 
-3 2095 916 917 
-3 2096 1108 916 
-3 2096 916 2095 
-3 2096 2095 2097 
-3 2097 2095 2098 
-3 2098 2095 2094 
-3 2093 2098 2094 
-3 2093 2099 2100 
-3 2093 2100 2098 
-3 2092 2101 2099 
-3 2092 2099 2093 
-3 2096 2102 1108 
-3 2096 2103 2102 
-3 2096 2104 2105 
-3 2096 2105 2103 
-3 2104 2106 2107 
-3 2104 2107 2105 
-3 2051 2108 2052 
-3 2052 2108 2101 
-3 2052 2101 2092 
-3 2051 2057 2109 
-3 2109 2110 2051 
-3 2109 2111 2112 
-3 2109 2112 2110 
-3 2111 2113 2112 
-3 2112 2113 2097 
-3 2112 2097 2098 
-3 2051 2110 2114 
-3 2051 2114 2108 
-3 2110 2112 2115 
-3 2110 2115 2114 
-3 2112 2098 2100 
-3 2112 2100 2115 
-3 2108 2114 2115 
-3 2108 2115 2100 
-3 2108 2100 2099 
-3 2108 2099 2101 
-3 2057 2090 2109 
-3 2109 2090 2111 
-3 2111 2090 2116 
-3 2111 2116 2113 
-3 2090 2085 2116 
-3 2116 2117 2113 
-3 2113 2117 2097 
-3 2117 2106 2104 
-3 2117 2104 2118 
-3 2118 2097 2117 
-3 2118 2104 2096 
-3 2096 2097 2118 
-3 2084 2083 2106 
-3 2084 2106 2117 
-3 2117 2085 2084 
-3 2085 2117 2116 
-3 2083 2082 2107 
-3 2083 2107 2106 
-3 1811 1813 2107 
-3 1811 2107 2082 
-3 2107 1813 1815 
-3 2107 1815 2105 
-3 1815 1817 2103 
-3 1815 2103 2105 
-3 2102 2103 1817 
-3 2102 1817 1109 
-3 2085 2091 2088 
-3 2085 2088 2086 
-3 2091 2089 2088 
-3 2085 2090 2091 
-3 2088 2087 2086 
-3 2018 2015 1781 
-3 1108 2102 1109 
-3 2069 1800 1799 
-3 2119 1914 2120 
-3 2121 2119 2120 
-3 1915 1916 2120 
-3 1914 1915 2120 
-3 1914 2122 1917 
-3 1914 2119 2123 
-3 1914 2123 2122 
-3 2119 2121 2124 
-3 2119 2124 2123 
-3 1917 2122 2125 
-3 1917 2125 1920 
-3 2122 2123 2126 
-3 2122 2126 2125 
-3 2123 2124 2127 
-3 2123 2127 2126 
-3 2125 1925 1920 
-3 2125 2126 2128 
-3 2125 2128 1925 
-3 2128 1939 1925 
-3 2126 2127 2129 
-3 2126 2129 2128 
-3 2128 2129 1952 
-3 2128 1952 1939 
-3 2127 2130 2131 
-3 2127 2131 2129 
-3 2129 2131 1953 
-3 2129 1953 1952 
-3 2124 2132 2130 
-3 2124 2130 2127 
-3 2133 1956 1953 
-3 2133 1953 2134 
-3 2020 1784 1956 
-3 2020 1956 2133 
-3 2133 2135 2021 
-3 2133 2021 2020 
-3 2134 2136 2135 
-3 2134 2135 2133 
-3 2131 2130 2136 
-3 2131 2136 2134 
-3 2132 2137 2130 
-3 2137 2138 2136 
-3 2137 2136 2130 
-3 2138 2139 2135 
-3 2138 2135 2136 
-3 2139 2027 2021 
-3 2139 2021 2135 
-3 2132 2140 2137 
-3 2140 2141 2138 
-3 2140 2138 2137 
-3 2141 2142 2139 
-3 2141 2139 2138 
-3 2142 2031 2027 
-3 2142 2027 2139 
-3 2143 2144 2140 
-3 2143 2140 2132 
-3 2124 2145 2143 
-3 2124 2143 2132 
-3 2145 2146 2147 
-3 2145 2147 2143 
-3 2148 2145 2124 
-3 2148 2124 2121 
-3 1905 2149 2148 
-3 1905 2148 1916 
-3 2148 2121 2120 
-3 2148 2120 1916 
-3 2149 2146 2145 
-3 2149 2145 2148 
-3 1905 1904 2150 
-3 1905 2150 2149 
-3 2149 2150 2151 
-3 2149 2151 2146 
-3 2146 2151 2152 
-3 2146 2152 2147 
-3 2147 2153 2144 
-3 2147 2144 2143 
-3 1903 2154 2150 
-3 1903 2150 1904 
-3 2150 2154 2151 
-3 1903 1898 2155 
-3 1903 2155 2154 
-3 2154 2155 2156 
-3 2154 2156 2151 
-3 2156 2152 2151 
-3 2152 2157 2153 
-3 2152 2153 2147 
-3 2156 2158 2157 
-3 2156 2157 2152 
-3 2155 2159 2156 
-3 2160 2159 2155 
-3 2160 2155 1898 
-3 1897 2161 1898 
-3 1897 2162 2163 
-3 1897 2163 2161 
-3 2161 2164 1898 
-3 2164 2160 1898 
-3 2161 2163 2165 
-3 2161 2165 2164 
-3 2165 2160 2164 
-3 2165 2166 2167 
-3 2165 2167 2160 
-3 2163 2168 2166 
-3 2163 2166 2165 
-3 2167 2169 2159 
-3 2167 2159 2160 
-3 2159 2170 2158 
-3 2159 2158 2156 
-3 2169 2171 2170 
-3 2169 2170 2159 
-3 2172 2173 2141 
-3 2172 2141 2140 
-3 2173 2174 2142 
-3 2173 2142 2141 
-3 2174 2064 2031 
-3 2174 2031 2142 
-3 2175 2065 2064 
-3 2175 2064 2174 
-3 2173 2176 2175 
-3 2173 2175 2174 
-3 2172 2177 2176 
-3 2172 2176 2173 
-3 2069 2065 2175 
-3 2069 2175 1968 
-3 2175 2176 1965 
-3 2175 1965 1968 
-3 2177 1966 1965 
-3 2177 1965 2176 
-3 2144 2178 2172 
-3 2144 2172 2140 
-3 2153 2179 2178 
-3 2153 2178 2144 
-3 2157 2179 2153 
-3 2158 2179 2157 
-3 2170 2180 2179 
-3 2170 2179 2158 
-3 2171 2181 2180 
-3 2171 2180 2170 
-3 2178 2182 2177 
-3 2178 2177 2172 
-3 2179 2183 2182 
-3 2179 2182 2178 
-3 2180 2184 2183 
-3 2180 2183 2179 
-3 2182 1967 1966 
-3 2182 1966 2177 
-3 2183 1969 1967 
-3 2183 1967 2182 
-3 2184 1970 1969 
-3 2184 1969 2183 
-3 2185 1971 1970 
-3 2185 1970 2184 
-3 2181 2185 2184 
-3 2181 2184 2180 
-3 2186 2187 2185 
-3 2186 2185 2181 
-3 2187 1972 1971 
-3 2187 1971 2185 
-3 2188 1973 1972 
-3 2188 1972 2187 
-3 2186 2189 2188 
-3 2188 2187 2186 
-3 2186 2181 2171 
-3 2186 2171 2189 
-3 2190 1974 1973 
-3 2190 1973 2188 
-3 2191 2190 2188 
-3 2188 2189 2192 
-3 2188 2192 2191 
-3 2193 2194 2192 
-3 2193 2192 2189 
-3 2195 2193 2189 
-3 2189 2171 2169 
-3 2189 2169 2195 
-3 2167 2196 2195 
-3 2167 2195 2169 
-3 2166 2197 2196 
-3 2166 2196 2167 
-3 2168 2198 2197 
-3 2168 2197 2166 
-3 2199 2197 2198 
-3 1896 2200 2162 
-3 1896 2162 1897 
-3 1894 2201 2200 
-3 1894 2200 1896 
-3 1893 2201 1894 
-3 1893 1305 1304 
-3 1893 1304 2202 
-3 1893 2202 2201 
-3 1304 1303 2203 
-3 1304 2203 2202 
-3 1303 1302 2203 
-3 1302 1494 2204 
-3 2205 2203 1302 
-3 2205 1302 2204 
-3 2206 2203 2205 
-3 2202 2203 2206 
-3 2202 2206 2201 
-3 2206 2207 2208 
-3 2206 2208 2201 
-3 2201 2208 2209 
-3 2201 2209 2200 
-3 1494 2210 2204 
-3 2210 2211 2204 
-3 2211 2212 2213 
-3 2211 2213 2204 
-3 2212 2214 2215 
-3 2212 2215 2213 
-3 2162 2216 2163 
-3 2200 2209 2216 
-3 2200 2216 2162 
-3 2217 2168 2163 
-3 2163 2218 2217 
-3 2218 2219 2220 
-3 2218 2220 2217 
-3 2219 2221 2220 
-3 2206 2205 2221 
-3 2206 2221 2219 
-3 2216 2222 2218 
-3 2216 2218 2163 
-3 2222 2223 2219 
-3 2222 2219 2218 
-3 2223 2207 2206 
-3 2223 2206 2219 
-3 2209 2208 2207 
-3 2209 2207 2223 
-3 2209 2223 2222 
-3 2209 2222 2216 
-3 2217 2198 2168 
-3 2220 2198 2217 
-3 2221 2224 2198 
-3 2221 2198 2220 
-3 2224 2194 2198 
-3 2221 2225 2224 
-3 2205 2225 2221 
-3 2213 2215 2225 
-3 2226 2213 2225 
-3 2225 2205 2226 
-3 2204 2213 2226 
-3 2226 2205 2204 
-3 2225 2215 2191 
-3 2225 2191 2192 
-3 2192 2194 2225 
-3 2224 2225 2194 
-3 2215 2214 2190 
-3 2215 2190 2191 
-3 2190 2214 1975 
-3 2190 1975 1974 
-3 2212 1976 1975 
-3 2212 1975 2214 
-3 2212 2211 1977 
-3 2212 1977 1976 
-3 1498 1977 2211 
-3 1498 2211 2210 
-3 2193 2196 2199 
-3 2193 2199 2194 
-3 2196 2197 2199 
-3 2199 2198 2194 
-3 2193 2195 2196 
-3 1953 2131 2134 
-3 1498 2210 1494 
-3 1968 1800 2069 
-3 506 866 2227 
-3 506 2227 510 
-3 510 2227 528 
-3 2227 866 870 
-3 528 2227 2228 
-3 528 2228 534 
-3 2228 2227 870 
-3 2228 870 876 
-3 2228 2229 534 
-3 534 2229 2230 
-3 534 2230 535 
-3 2230 538 535 
-3 538 2230 2231 
-3 2231 2232 554 
-3 2231 554 538 
-3 2230 2229 2233 
-3 2230 2233 2234 
-3 2234 2231 2230 
-3 2231 2234 2235 
-3 2231 2235 2236 
-3 2236 2232 2231 
-3 2236 2237 2238 
-3 2236 2238 2232 
-3 2232 2238 550 
-3 2232 550 554 
-3 2237 2239 551 
-3 2237 551 2238 
-3 2238 551 550 
-3 380 801 2240 
-3 380 2240 2241 
-3 2241 2240 2242 
-3 2240 801 797 
-3 2240 797 2243 
-3 2243 797 796 
-3 2243 796 2244 
-3 2244 796 795 
-3 2244 795 2245 
-3 2245 795 787 
-3 2245 787 2246 
-3 2245 2246 2247 
-3 2246 787 774 
-3 774 765 2248 
-3 774 2248 2249 
-3 2249 2247 2246 
-3 2249 2246 774 
-3 764 2248 765 
-3 764 761 2250 
-3 764 2250 2248 
-3 761 2251 2250 
-3 2252 2253 2254 
-3 2229 2228 876 
-3 2229 876 2233 
-3 2233 876 871 
-3 2233 871 2255 
-3 2255 871 862 
-3 2255 862 2256 
-3 2256 2257 2235 
-3 2256 2235 2234 
-3 2256 2234 2255 
-3 2234 2233 2255 
-3 2257 2256 2258 
-3 2258 2256 862 
-3 2258 862 2259 
-3 2259 862 860 
-3 878 2260 2261 
-3 878 2261 860 
-3 2259 860 2261 
-3 878 1654 1652 
-3 878 1652 2260 
-3 1652 2262 2263 
-3 1652 2263 2260 
-3 1652 1649 2264 
-3 1652 2264 2262 
-3 2264 1649 1648 
-3 2264 1648 2265 
-3 2261 2260 2263 
-3 2261 2263 2266 
-3 2261 2266 2267 
-3 2261 2267 2259 
-3 2259 2267 2268 
-3 2259 2268 2269 
-3 2259 2269 2258 
-3 2258 2269 2270 
-3 2258 2270 2235 
-3 2258 2235 2257 
-3 2237 2236 2235 
-3 2237 2235 2270 
-3 2270 2271 2239 
-3 2270 2239 2237 
-3 551 2239 2272 
-3 2272 2251 761 
-3 2272 761 551 
-3 2239 2271 2273 
-3 2239 2273 2272 
-3 2272 2273 2274 
-3 2272 2274 2251 
-3 2251 2274 2275 
-3 2275 2276 2250 
-3 2275 2250 2251 
-3 2250 2276 2277 
-3 2250 2277 2248 
-3 2248 2278 2279 
-3 2248 2279 2249 
-3 2277 2280 2278 
-3 2276 2275 2281 
-3 2280 2277 2276 
-3 2280 2276 2281 
-3 2281 2275 2274 
-3 2281 2274 2282 
-3 2249 2279 2283 
-3 2249 2283 2247 
-3 2247 2283 2284 
-3 2284 2245 2247 
-3 2283 2285 2286 
-3 2283 2286 2284 
-3 2284 2286 2245 
-3 2245 2286 2287 
-3 2245 2287 2244 
-3 2244 2287 2288 
-3 2244 2288 2243 
-3 2243 2289 2242 
-3 2243 2242 2240 
-3 2243 2288 2290 
-3 2243 2290 2289 
-3 2289 2290 2291 
-3 2289 2291 2292 
-3 2289 2292 2293 
-3 2291 2290 2288 
-3 2291 2288 2294 
-3 2295 2294 2288 
-3 2295 2288 2287 
-3 2295 2287 2286 
-3 2295 2286 2285 
-3 2281 2282 2296 
-3 2281 2296 2280 
-3 2280 2297 2298 
-3 2280 2298 2278 
-3 2280 2296 2297 
-3 2278 2298 2299 
-3 2278 2299 2300 
-3 2278 2300 2279 
-3 2300 2301 2283 
-3 2300 2299 2302 
-3 2300 2302 2301 
-3 2301 2302 2303 
-3 2303 2304 2305 
-3 2303 2305 2301 
-3 2305 2306 2295 
-3 2305 2295 2285 
-3 2305 2304 2307 
-3 2305 2307 2306 
-3 2307 2308 2306 
-3 2279 2300 2283 
-3 2291 2294 2308 
-3 2291 2308 2309 
-3 2306 2308 2294 
-3 2306 2294 2295 
-3 2291 2309 2310 
-3 2291 2310 2292 
-3 2310 2311 2312 
-3 2310 2312 2313 
-3 2310 2313 2314 
-3 2310 2314 2315 
-3 2310 2309 2307 
-3 2310 2307 2311 
-3 2307 2309 2308 
-3 2312 2311 2307 
-3 2312 2307 2316 
-3 2316 2307 2303 
-3 2316 2303 2317 
-3 2317 2302 2299 
-3 2303 2307 2304 
-3 2317 2303 2302 
-3 2298 2318 2299 
-3 2299 2318 2319 
-3 2299 2319 2320 
-3 2299 2320 2321 
-3 2321 2320 2322 
-3 2321 2322 2323 
-3 2321 2323 2324 
-3 2321 2324 2316 
-3 2321 2316 2317 
-3 2321 2317 2299 
-3 2318 2298 2297 
-3 2318 2297 2325 
-3 2318 2325 2319 
-3 2319 2325 2326 
-3 2319 2326 2320 
-3 2320 2326 2327 
-3 2327 2328 2322 
-3 2327 2322 2320 
-3 2297 2296 2329 
-3 2297 2329 2325 
-3 2326 2329 2330 
-3 2326 2330 2327 
-3 2327 2330 2331 
-3 2331 2332 2328 
-3 2331 2328 2327 
-3 2296 2282 2273 
-3 2296 2273 2271 
-3 2296 2271 2329 
-3 2333 2329 2271 
-3 2271 2270 2334 
-3 2271 2334 2333 
-3 2335 2331 2330 
-3 2330 2329 2333 
-3 2330 2333 2335 
-3 2335 2336 2331 
-3 2331 2336 2337 
-3 2331 2337 2332 
-3 2326 2325 2329 
-3 2337 2336 2338 
-3 2337 2338 2339 
-3 2339 2338 2340 
-3 2339 2340 2341 
-3 2340 2342 2266 
-3 2340 2266 2263 
-3 2341 2340 2264 
-3 2341 2264 2265 
-3 2340 2262 2264 
-3 2340 2263 2262 
-3 2266 2342 2268 
-3 2266 2268 2267 
-3 2268 2342 2335 
-3 2268 2335 2334 
-3 2335 2333 2334 
-3 2335 2342 2336 
-3 2336 2342 2338 
-3 2334 2270 2269 
-3 2334 2269 2268 
-3 2342 2340 2338 
-3 2282 2274 2273 
-3 2265 1648 1143 
-3 2265 1143 2343 
-3 1147 1150 2344 
-3 1147 2344 2345 
-3 1150 1152 2346 
-3 1150 2346 2344 
-3 2346 2347 2348 
-3 2346 2348 2344 
-3 2344 2348 2349 
-3 2344 2349 2345 
-3 2339 2349 2350 
-3 2339 2350 2351 
-3 2351 2337 2339 
-3 2347 2352 2353 
-3 2347 2353 2348 
-3 2348 2353 2350 
-3 2348 2350 2349 
-3 2350 2354 2355 
-3 2350 2355 2351 
-3 2351 2355 2332 
-3 2351 2332 2337 
-3 2354 2350 2353 
-3 2354 2353 2356 
-3 2352 2357 2356 
-3 2352 2356 2353 
-3 2328 2332 2355 
-3 2355 2354 2358 
-3 2355 2358 2328 
-3 2358 2354 2356 
-3 2358 2356 2359 
-3 2360 2359 2356 
-3 2360 2356 2357 
-3 2360 2361 2362 
-3 2360 2362 2359 
-3 2359 2362 2323 
-3 2359 2323 2358 
-3 2358 2323 2322 
-3 2358 2322 2328 
-3 2323 2362 2363 
-3 2323 2363 2324 
-3 2363 2362 2361 
-3 2363 2361 2364 
-3 2364 2313 2312 
-3 2364 2312 2363 
-3 2363 2312 2316 
-3 2363 2316 2324 
-3 1147 2345 2365 
-3 1147 2365 2343 
-3 1147 2343 1143 
-3 2365 2341 2265 
-3 2365 2265 2343 
-3 2349 2339 2341 
-3 2349 2341 2365 
-3 2349 2365 2345 
-3 2310 2315 2293 
-3 2310 2293 2292 
-3 2305 2285 2283 
-3 2305 2283 2301 
-3 2248 2277 2278 
-3 501 486 1760 
-3 2252 2254 2253 
-3 881 501 1760 
-3 881 1760 1654 
-3 881 1654 878 
-3 39 2366 445 
-3 39 445 35 
-3 58 2366 39 
-3 449 445 2366 
-3 65 2367 2366 
-3 65 2366 58 
-3 455 449 2366 
-3 455 2366 2367 
-3 65 2368 2367 
-3 64 2369 2368 
-3 64 2368 65 
-3 64 67 2369 
-3 2370 2369 67 
-3 67 82 2371 
-3 67 2371 2370 
-3 2372 2373 2368 
-3 2372 2368 2369 
-3 2369 2370 2372 
-3 2374 2375 2372 
-3 2374 2372 2370 
-3 2370 2371 2374 
-3 2371 2376 2377 
-3 2371 2377 2374 
-3 82 80 2376 
-3 82 2376 2371 
-3 2376 79 2378 
-3 2376 2378 2377 
-3 80 79 2376 
-3 2241 2379 379 
-3 2241 379 380 
-3 2242 2379 2241 
-3 2380 372 379 
-3 2380 379 2379 
-3 2381 371 372 
-3 2381 372 2380 
-3 2382 370 371 
-3 2382 371 2381 
-3 2383 2384 361 
-3 2383 361 370 
-3 2383 370 2382 
-3 349 361 2384 
-3 2385 2386 340 
-3 2385 340 349 
-3 349 2384 2383 
-3 349 2383 2385 
-3 340 2386 338 
-3 2386 2387 335 
-3 2386 335 338 
-3 2387 2388 335 
-3 2389 2390 2391 
-3 2373 455 2367 
-3 2373 2367 2368 
-3 2392 451 455 
-3 2392 455 2373 
-3 2393 442 451 
-3 2393 451 2392 
-3 2392 2372 2375 
-3 2392 2375 2394 
-3 2392 2394 2393 
-3 2392 2373 2372 
-3 2395 2393 2394 
-3 2396 442 2393 
-3 2396 2393 2395 
-3 440 442 2396 
-3 440 2397 2398 
-3 440 2398 458 
-3 2397 440 2396 
-3 2398 1829 1831 
-3 2398 1831 458 
-3 2398 2399 2400 
-3 2398 2400 1829 
-3 2400 2401 1826 
-3 2400 1826 1829 
-3 2402 1827 1826 
-3 2402 1826 2401 
-3 2403 2399 2398 
-3 2403 2398 2397 
-3 2396 2404 2403 
-3 2396 2403 2397 
-3 2395 2405 2406 
-3 2395 2406 2404 
-3 2395 2404 2396 
-3 2394 2375 2407 
-3 2394 2407 2405 
-3 2394 2405 2395 
-3 2407 2375 2374 
-3 2407 2374 2377 
-3 2377 2378 2408 
-3 2377 2408 2407 
-3 2409 2378 79 
-3 79 335 2388 
-3 79 2388 2409 
-3 2409 2410 2408 
-3 2409 2408 2378 
-3 2388 2411 2410 
-3 2388 2410 2409 
-3 2412 2411 2388 
-3 2388 2387 2413 
-3 2388 2413 2412 
-3 2386 2414 2413 
-3 2386 2413 2387 
-3 2385 2415 2416 
-3 2385 2416 2386 
-3 2416 2417 2414 
-3 2418 2412 2413 
-3 2418 2413 2414 
-3 2418 2414 2417 
-3 2419 2411 2412 
-3 2419 2412 2418 
-3 2383 2420 2415 
-3 2383 2415 2385 
-3 2421 2420 2383 
-3 2383 2382 2421 
-3 2421 2422 2423 
-3 2421 2423 2420 
-3 2382 2422 2421 
-3 2381 2424 2422 
-3 2381 2422 2382 
-3 2380 2425 2424 
-3 2380 2424 2381 
-3 2379 2242 2289 
-3 2379 2289 2380 
-3 2289 2426 2425 
-3 2289 2425 2380 
-3 2293 2427 2428 
-3 2293 2428 2426 
-3 2293 2426 2289 
-3 2429 2425 2426 
-3 2429 2426 2428 
-3 2424 2425 2429 
-3 2424 2429 2430 
-3 2423 2422 2424 
-3 2423 2424 2430 
-3 2417 2431 2419 
-3 2417 2419 2418 
-3 2416 2432 2433 
-3 2416 2433 2417 
-3 2433 2431 2417 
-3 2415 2434 2435 
-3 2415 2435 2432 
-3 2415 2432 2416 
-3 2420 2436 2434 
-3 2436 2437 2435 
-3 2436 2435 2434 
-3 2438 2437 2436 
-3 2436 2439 2440 
-3 2436 2440 2438 
-3 2423 2430 2441 
-3 2423 2441 2439 
-3 2441 2442 2440 
-3 2441 2440 2439 
-3 2441 2443 2442 
-3 2420 2434 2415 
-3 2444 2443 2429 
-3 2444 2429 2428 
-3 2430 2429 2443 
-3 2430 2443 2441 
-3 2427 2445 2444 
-3 2427 2444 2428 
-3 2446 2447 2445 
-3 2315 2314 2313 
-3 2315 2313 2446 
-3 2315 2446 2445 
-3 2447 2442 2444 
-3 2447 2444 2445 
-3 2443 2444 2442 
-3 2448 2442 2447 
-3 2448 2447 2446 
-3 2449 2438 2442 
-3 2449 2442 2448 
-3 2435 2437 2449 
-3 2440 2442 2438 
-3 2437 2438 2449 
-3 2435 2450 2432 
-3 2451 2450 2435 
-3 2452 2453 2451 
-3 2452 2451 2435 
-3 2454 2453 2452 
-3 2455 2456 2454 
-3 2455 2454 2452 
-3 2435 2449 2448 
-3 2435 2448 2455 
-3 2435 2455 2452 
-3 2433 2432 2450 
-3 2451 2457 2433 
-3 2451 2433 2450 
-3 2453 2458 2457 
-3 2453 2457 2451 
-3 2459 2458 2453 
-3 2453 2454 2460 
-3 2453 2460 2459 
-3 2457 2461 2431 
-3 2457 2431 2433 
-3 2459 2462 2461 
-3 2459 2461 2458 
-3 2463 2462 2459 
-3 2459 2460 2464 
-3 2459 2464 2463 
-3 2410 2419 2431 
-3 2461 2408 2410 
-3 2461 2410 2431 
-3 2408 2461 2465 
-3 2465 2466 2407 
-3 2465 2407 2408 
-3 2462 2463 2467 
-3 2467 2465 2461 
-3 2467 2461 2462 
-3 2463 2468 2467 
-3 2464 2469 2468 
-3 2464 2468 2463 
-3 2461 2457 2458 
-3 2470 2471 2468 
-3 2470 2468 2469 
-3 2472 2473 2471 
-3 2472 2471 2470 
-3 2399 2403 2474 
-3 2399 2474 2473 
-3 2402 2401 2473 
-3 2402 2473 2472 
-3 2401 2400 2473 
-3 2400 2399 2473 
-3 2404 2406 2474 
-3 2404 2474 2403 
-3 2466 2467 2474 
-3 2466 2474 2406 
-3 2466 2465 2467 
-3 2468 2474 2467 
-3 2471 2474 2468 
-3 2406 2405 2407 
-3 2406 2407 2466 
-3 2471 2473 2474 
-3 2410 2411 2419 
-3 2475 1528 1827 
-3 2475 1827 2402 
-3 2476 2477 1535 
-3 2476 1535 1533 
-3 2477 2346 1152 
-3 2477 1152 1535 
-3 2477 2478 2347 
-3 2477 2347 2346 
-3 2476 2479 2478 
-3 2476 2478 2477 
-3 2480 2481 2479 
-3 2480 2479 2470 
-3 2470 2469 2480 
-3 2478 2482 2352 
-3 2478 2352 2347 
-3 2479 2481 2482 
-3 2479 2482 2478 
-3 2480 2483 2484 
-3 2480 2484 2481 
-3 2469 2464 2483 
-3 2469 2483 2480 
-3 2485 2482 2481 
-3 2485 2481 2484 
-3 2482 2485 2357 
-3 2482 2357 2352 
-3 2483 2464 2460 
-3 2460 2486 2484 
-3 2460 2484 2483 
-3 2487 2485 2484 
-3 2487 2484 2486 
-3 2357 2485 2487 
-3 2357 2487 2360 
-3 2487 2488 2361 
-3 2487 2361 2360 
-3 2486 2456 2488 
-3 2486 2488 2487 
-3 2460 2454 2456 
-3 2460 2456 2486 
-3 2455 2489 2488 
-3 2455 2488 2456 
-3 2364 2361 2488 
-3 2364 2488 2489 
-3 2489 2446 2313 
-3 2489 2313 2364 
-3 2455 2448 2446 
-3 2455 2446 2489 
-3 1528 2475 2490 
-3 1528 2490 2476 
-3 1528 2476 1533 
-3 2475 2402 2472 
-3 2475 2472 2490 
-3 2476 2490 2472 
-3 2476 2472 2470 
-3 2476 2470 2479 
-3 2427 2293 2315 
-3 2427 2315 2445 
-3 2436 2420 2423 
-3 2436 2423 2439 
-3 2416 2414 2386 
-3 1936 14 31 
-3 2390 2389 2391 
-3 458 1831 1936 
-3 458 1936 31 
-3 458 31 459 
-3 321 386 2491 
-3 321 2491 385 
-3 385 2491 387 
-3 2491 386 388 
-3 2491 388 2492 
-3 2492 388 389 
-3 2492 389 2493 
-3 2493 389 390 
-3 2493 390 2494 
-3 2495 391 392 
-3 2495 392 404 
-3 2494 390 391 
-3 2494 391 2495 
-3 404 392 84 
-3 395 387 2491 
-3 395 2491 2492 
-3 395 2492 2493 
-3 395 2493 399 
-3 399 2493 2494 
-3 399 2494 397 
-3 397 2494 2495 
-3 397 2495 398 
-3 398 2495 404 
-3 806 2496 807 
-3 806 807 751 
-3 808 2496 806 
-3 2497 809 807 
-3 2497 807 2496 
-3 2498 810 809 
-3 2498 809 2497 
-3 2499 811 810 
-3 2499 810 2498 
-3 826 813 812 
-3 826 812 2500 
-3 2500 812 811 
-3 2500 811 2499 
-3 555 813 826 
-3 2497 2496 808 
-3 2497 808 816 
-3 821 2498 2497 
-3 821 2497 816 
-3 818 2499 2498 
-3 818 2498 821 
-3 817 2500 2499 
-3 817 2499 818 
-3 826 2500 817 
-3 2501 414 426 
-3 414 2501 2502 
-3 414 2502 434 
-3 434 2502 433 
-3 432 433 2503 
-3 432 2503 2504 
-3 432 2504 431 
-3 2504 430 431 
-3 847 835 2505 
-3 855 2506 2505 
-3 855 2505 835 
-3 854 2506 855 
-3 2507 854 853 
-3 852 2508 2507 
-3 852 2507 853 
-3 852 851 2508 
-3 2501 426 427 
-3 2501 427 2509 
-3 429 430 2504 
-3 429 2504 2510 
-3 2511 2510 2504 
-3 2511 2504 2503 
-3 2512 2511 2503 
-3 2512 2503 433 
-3 2513 2512 433 
-3 2513 433 2502 
-3 2509 2513 2502 
-3 2509 2502 2501 
-3 2514 848 847 
-3 2514 847 2505 
-3 2515 2508 851 
-3 2515 851 850 
-3 2507 2508 2515 
-3 2507 2515 2516 
-3 854 2507 2516 
-3 854 2516 2517 
-3 2506 854 2517 
-3 2506 2517 2518 
-3 2505 2506 2518 
-3 2505 2518 2514 
-3 429 2519 428 
-3 428 2519 427 
-3 427 2519 2509 
-3 2509 2519 2513 
-3 2513 2519 2512 
-3 2512 2519 2511 
-3 2511 2519 2510 
-3 2510 2519 429 
-3 849 2520 850 
-3 848 2520 849 
-3 2514 2520 848 
-3 2518 2520 2514 
-3 2517 2520 2518 
-3 2516 2520 2517 
-3 2515 2520 2516 
-3 850 2520 2515 
diff --git a/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h b/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h
deleted file mode 100644
index 0a01c49..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __GLUTMESHDRAWER_H__
-#define __GLUTMESHDRAWER_H__
-
-#include "common/GlutDrawer.h"
-#include "LOD_decimation.h"
-#include "MyGlutMouseHandler.h"
-#include <math.h>
-#include <iostream>
-#include <iterator>
-#if defined(WIN32) || defined(__APPLE__)
-#ifdef WIN32
-#include <windows.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-#else // WIN32
-// __APPLE__ is defined
-#include <AGL/gl.h>
-#endif // WIN32
-#else // defined(WIN32) || defined(__APPLE__)
-#include <GL/gl.h>
-#include <GL/glu.h>
-#endif // defined(WIN32) || defined(__APPLE__)
-#include <vector>
-// a concrete mesh drawer
-
-class GlutMeshDrawer : public GlutDrawer
-{
-public :
-	static
-		GlutMeshDrawer *
-	New(
-	) {
-		return new GlutMeshDrawer();
-	}
-
-	// set the mesh to draw
-
-		void
-	SetLODInfo( 
-		LOD_Decimation_InfoPtr info
-	){
-		m_info = info;
-	}
-	
-		void
-	SetMouseHandler(
-		MyGlutMouseHandler *mouse_handler
-	) {
-		m_mouse_handler = mouse_handler;
-	}
-
-
-	// inherited from GlutDrawer
-		void
-	Draw(
-	) {
-	  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-		  glPopMatrix();
-		  glPushMatrix();
-		  glRotatef(m_mouse_handler->AngleX(), 0.0, 1.0, 0.0);
-		  glRotatef(m_mouse_handler->AngleY(), 1.0, 0.0, 0.0);
-			
-	  DrawScene();
-	}
-
-	~GlutMeshDrawer(
-	){
-		// nothing to do
-	};		
-	
-private :
-
-		void
-	DrawScene(
-	){
-		
-		float * verts = m_info->vertex_buffer;
-		const int num_verts = m_info->vertex_num;
-
-		float * vertex_normals = m_info->vertex_normal_buffer;
-
-
-		int * index = m_info->triangle_index_buffer;
-		const int num_faces = m_info->face_num;
-
-		glBegin(GL_TRIANGLES);
-
-		float mat_spec1[] = {1.0,1.0,1.0,1.0};
-		float mat_spec2[] = {1.0,0.0,1.0,1.0};
-		float mat_spec3[] = {1.0,1.0,0.0,1.0};
-		float mat_spec4[] = {0.0,0.0,1.0,1.0};
-
-	
-
-		int i;
-		for (i= 0; i < num_faces; i++) {
-#if 0
-			int col = i%4;
-			if (col == 0) {
-				glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spec1);
-			} else 
-			if (col == 1) {
-				glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spec2);
-			} else 
-			if (col == 2) {
-				glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spec3);
-			} else 
-			if (col == 3) {
-				glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spec4);
-			}
-#endif
-			glNormal3fv(vertex_normals + 3*index[3*i]);		
-			glVertex3fv(verts + 3*index[3*i]);
-
-			glNormal3fv(vertex_normals + 3*index[3*i + 1]);
-			glVertex3fv(verts + 3*index[3*i + 1]);
-
-			glNormal3fv(vertex_normals + 3*index[3*i + 2]);
-			glVertex3fv(verts + 3*index[3*i + 2]);
-
-		}
-		glEnd();
-
-
-	};
-
-
-
-private :
-
-	LOD_Decimation_InfoPtr m_info;
-
-	MyGlutMouseHandler * m_mouse_handler;
-
-	GlutMeshDrawer (
-	) : m_info (NULL) {
-	};
-	
-};
-
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.cpp b/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.cpp
deleted file mode 100644
index 318d5fb..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#define TRUE 1
-#define FALSE 0
-
-#include "LOD_GhostTestApp.h"
-
-#include "GHOST_ISystem.h"
-#include "GHOST_IWindow.h"
-#include "common/GlutDrawer.h"
-#include "common/GlutKeyboardManager.h"
-#include "common/GlutMouseManager.h"
-
-using namespace std;
-
-LOD_GhostTestApp::
-LOD_GhostTestApp(
-):
-	m_window(NULL),
-	m_system(NULL),
-	m_finish_me_off (false)
-{
-}
-
-// initialize the applicaton
-
-	bool
-LOD_GhostTestApp::
-InitApp(
-){
-
-	// create a system and window with opengl
-	// rendering context.
-
-	GHOST_TSuccess success = GHOST_ISystem::createSystem();
-	if (success == GHOST_kFailure) return false;
-
-	m_system = GHOST_ISystem::getSystem();
-	if (m_system == NULL) return false;
-
-	m_system->addEventConsumer(this);
-	
-	m_window = m_system->createWindow(
-		"GHOST crud!",
-		100,100,640,480,GHOST_kWindowStateNormal,
-		GHOST_kDrawingContextTypeOpenGL,
-		FALSE
-	);
-
-	if (
-		m_window == NULL
-	) {
-		m_system = NULL;
-		GHOST_ISystem::disposeSystem();
-		return false;
-	}
-
-	return true;
-}
-
-// Run the application untill internal return.
-	void
-LOD_GhostTestApp::
-Run(
-){
-	if (m_system == NULL) {
-		return;
-	}
-
-	while (!m_finish_me_off) {
-		m_system->processEvents(TRUE);
-		m_system->dispatchEvents();
-	};
-}
-
-LOD_GhostTestApp::
-~LOD_GhostTestApp(
-){
-	if (m_window) {
-		m_system->disposeWindow(m_window);
-		m_window = NULL;
-		GHOST_ISystem::disposeSystem();
-		m_system = NULL;
-	}
-};
-
-
-	bool 
-LOD_GhostTestApp::
-processEvent(
-	GHOST_IEvent* event
-){
-
-	// map ghost events to the glut schmuk handlers.
-	bool handled = false;
-
-	switch(event->getType()) {
-		case GHOST_kEventWindowSize:
-		case GHOST_kEventWindowActivate:
-		case GHOST_kEventWindowUpdate:
-			GlutDrawManager::Draw();
-			static_cast<GHOST_TEventWindowData *>(event->getData())->window->swapBuffers();
-
-			handled = true;
-			break;
-		case GHOST_kEventButtonDown:
-		{
-			int x,y;
-			m_system->getCursorPosition(x,y);
-	
-			int wx,wy;
-			m_window->screenToClient(x,y,wx,wy);
-
-			GHOST_TButtonMask button = 
-				static_cast<GHOST_TEventButtonData *>(event->getData())->button;
-			GlutMouseManager::ButtonDown(m_window,button,wx,wy);
-		}
-		handled = true;
-		break;
-
-		case GHOST_kEventButtonUp:
-		{
-			int x,y;
-			m_system->getCursorPosition(x,y);
-	
-			int wx,wy;
-			m_window->screenToClient(x,y,wx,wy);
-
-			GHOST_TButtonMask button = 
-				static_cast<GHOST_TEventButtonData *>(event->getData())->button;
-			GlutMouseManager::ButtonUp(m_window,button,wx,wy);
-		}
-		handled = true;
-		break;
-
-		case GHOST_kEventCursorMove:
-		{	
-			int x,y;
-			m_system->getCursorPosition(x,y);
-	
-			int wx,wy;
-			m_window->screenToClient(x,y,wx,wy);
-
-			GlutMouseManager::Motion(m_window,wx,wy);
-	
-		}	
-		handled = true;
-		break;
-
-		case GHOST_kEventKeyDown :
-		{
-			GHOST_TEventKeyData *kd = 
-				static_cast<GHOST_TEventKeyData *>(event->getData());
-
-			int x,y;
-			m_system->getCursorPosition(x,y);
-	
-			int wx,wy;
-			m_window->screenToClient(x,y,wx,wy);
-
-			GlutKeyboardManager::HandleKeyboard(kd->key,wx,wy);
-		}		
-		handled = true;
-		break;
-	
-		default :
-			break;
-	}
-
-	return handled;
-}
diff --git a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h b/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h
deleted file mode 100644
index e58bfec..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __LOD_GHOSTTESTAPP_H__
-#define __LOD_GHOSTTESTAPP_H__
-
-#include "GHOST_IEventConsumer.h"
-#include "MT_Vector3.h"
-#include <vector>
-
-class GHOST_IWindow;
-class GHOST_ISystem;
-
-
-class LOD_GhostTestApp :
-public GHOST_IEventConsumer
-{
-public :
-	// Construct an instance of the application;
-
-	LOD_GhostTestApp(
-	);
-
-	// initialize the applicaton
-
-		bool
-	InitApp(
-	);
-
-	// Run the application untill internal return.
-		void
-	Run(
-	);
-	
-	~LOD_GhostTestApp(
-	);
-	
-private :
-
-		void
-	UpdateFrame(
-	);
-	
-	// inherited from GHOST_IEventConsumer
-	// maps events to GlutXXXHandlers()
-
-		bool 
-	processEvent(
-		GHOST_IEvent* event
-	);
-
-	GHOST_IWindow *m_window;
-	GHOST_ISystem *m_system;
-
-	bool m_finish_me_off;
-};
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h b/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h
deleted file mode 100644
index 950a173..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __MYGLUTKEYHANDLER_H__
-#define __MYGLUTKEYHANDLER_H__
-
-#include "common/GlutKeyboardManager.h"
-#include "LOD_decimation.h"
-
-class MyGlutKeyHandler : public GlutKeyboardHandler
-{
-public :
-	static
-		MyGlutKeyHandler *
-	New(
-		LOD_Decimation_InfoPtr info
-	) {
-		return new MyGlutKeyHandler(info);
-	}	
-
-		void
-	HandleKeyboard(
-		GHOST_TKey key,
-		int x,
-		int y
-	){
-		int steps = 0;
-
-		switch (key) {
-			case GHOST_kKeyD :
-
-				while (steps < 100 && LOD_CollapseEdge(m_info)) {
-					steps ++;
-				}
-
-				break;
-
-			case GHOST_kKeyEsc :
-
-				// release all the handlers!				
-				exit(0);
-		}
-		
-	}
-		
-	~MyGlutKeyHandler(
-	) {
-	};
-
-private :
-
-	MyGlutKeyHandler(
-		LOD_Decimation_InfoPtr info
-	):
-		m_info (info)
-	{
-	}
-
-
-	LOD_Decimation_InfoPtr m_info;
-};
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h b/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h
deleted file mode 100644
index df7da2e..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __MYGLUTMOUSEHANDLER_H__
-#define __MYGLUTMOUSEHANDLER_H__
-
-#include "common/GlutMouseManager.h"
-#include "GHOST_IWindow.h"
-
-class MyGlutMouseHandler : public GlutMouseHandler
-{
-
-public :
- 
-	static 
-		MyGlutMouseHandler *
-	New(
-	) {
-		return new MyGlutMouseHandler();
-	}
-
-		void
-	ButtonDown(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	){
-		if (button_mask == GHOST_kButtonMaskLeft) {
-			m_moving = true;
-			m_begin_x = x;
-			m_begin_y = y;	
-		}
-		window->invalidate();
-	}
-
-		void
-	ButtonUp(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	) {
-		if (button_mask == GHOST_kButtonMaskLeft) {
-			m_moving = false;
-		}
-		window->invalidate();
-	}
-
-		void
-	Motion(
-		GHOST_IWindow * window,
-		int x,
-		int y
-	){
-		if (m_moving) {
-			m_angle_x = m_angle_x + (x - m_begin_x);
-			m_begin_x = x;
-
-			m_angle_y = m_angle_y + (y - m_begin_y);
-			m_begin_y = y;
-		}
-		window->invalidate();
-	}
-
-	const 
-		float
-	AngleX(
-	) const {
-		return m_angle_x;
-	}
-
-	const 
-		float
-	AngleY(
-	) const {
-		return m_angle_y;
-	}
-
-	
-private :
-
-	MyGlutMouseHandler (
-	) :  
-		m_angle_x(0),
-		m_angle_y(0),
-		m_begin_x(0),
-		m_begin_y(0),
-		m_moving (false)
-	{
-	};
-		
-	float m_angle_x;
-	float m_angle_y;
-	float m_begin_x;
-	float m_begin_y;
-
-	bool m_moving;
-	
-};
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.cpp b/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.cpp
deleted file mode 100644
index 0575aef..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "GlutDrawer.h"
-#include "MT_assert.h"
-
-MEM_SmartPtr<GlutDrawManager> GlutDrawManager::m_s_instance = MEM_SmartPtr<GlutDrawManager>();
-
-	GlutDrawManager *
-GlutDrawManager::
-Instance(
-){
-	if (m_s_instance == NULL) {
-		m_s_instance = new GlutDrawManager();
-	}
-
-	return m_s_instance;
-}
-
-
-// this is the function you should pass to glut
-
-	void
-GlutDrawManager::
-Draw(
-){
-	GlutDrawManager *manager = GlutDrawManager::Instance();
-
-	if (manager->m_drawer != NULL) {
-		manager->m_drawer->Draw();
-	}
-}
-
-	void
-GlutDrawManager::
-InstallDrawer(
-	GlutDrawer * drawer
-){
-
-	MT_assert(m_drawer == NULL);
-	m_drawer = drawer;
-}
-
-	void
-GlutDrawManager::
-ReleaseDrawer(
-){
-	m_drawer = NULL;
-}
-
-
-GlutDrawManager::
-~GlutDrawManager(
-){
-
-	delete(m_drawer);
-}
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h
deleted file mode 100644
index c7fc187..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __GLUTDRAWER_H__
-#define __GLUTDRAWER_H__
-
-#include "MEM_NonCopyable.h"
-#include "MEM_SmartPtr.h"
-
-// So pissed off with Glut callback stuff
-// that is impossible to call objects unless they are global
-
-// inherit from GlutDrawer and installl the drawer in the singleton
-// class GlutDrawManager.
-
-class GlutDrawer {
-public :
-
-	virtual 
-		void
-	Draw(
-	)= 0;
-
-	virtual 
-	~GlutDrawer(
-	){};		
-};
-
-class GlutDrawManager : public MEM_NonCopyable{
-
-public :
-
-	static
-		GlutDrawManager *
-	Instance(
-	);
-
-	// this is the function you should pass to glut
-
-	static
-		void
-	Draw(
-	);
-
-		void
-	InstallDrawer(
-		GlutDrawer *
-	);
-
-		void
-	ReleaseDrawer(
-	);
-
-	~GlutDrawManager(
-	);
-
-private :
-
-	GlutDrawManager (
-	) :
-		m_drawer (0)
-	{
-	};
-	
-	GlutDrawer * m_drawer;
-
-	static MEM_SmartPtr<GlutDrawManager> m_s_instance;
-};	
-
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.cpp b/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.cpp
deleted file mode 100644
index 9fb260a..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "GlutKeyboardManager.h"
-#include "MT_assert.h"
-
-MEM_SmartPtr<GlutKeyboardManager> GlutKeyboardManager::m_s_instance = MEM_SmartPtr<GlutKeyboardManager>();
-
-	GlutKeyboardManager *
-GlutKeyboardManager::
-Instance(
-){
-	if (m_s_instance == NULL) {
-		m_s_instance = new GlutKeyboardManager();
-	}
-
-	return m_s_instance;
-}
-
-
-// this is the function you should pass to glut
-
-	void
-GlutKeyboardManager::
-HandleKeyboard(
-	GHOST_TKey key,
-	int x,
-	int y
-){
-	GlutKeyboardManager *manager = GlutKeyboardManager::Instance();
-
-	if (manager->m_handler != NULL) {
-		manager->m_handler->HandleKeyboard(key,x,y);
-	}
-}
-
-	void
-GlutKeyboardManager::
-InstallHandler(
-	GlutKeyboardHandler * handler
-){
-
-	MT_assert(m_handler == NULL);
-	m_handler = handler;
-}
-
-	void
-GlutKeyboardManager::
-ReleaseHandler(
-){
-	m_handler = NULL;
-}
-
-
-GlutKeyboardManager::
-~GlutKeyboardManager(
-){
-
-	delete(m_handler);
-}
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h
deleted file mode 100644
index 0c400dd..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __GLUTKEYBOARDMANAGER_H__
-#define __GLUTKEYBOARDMANAGER_H__
-
-#include "MEM_NonCopyable.h"
-#include "MEM_SmartPtr.h"
-#include "GHOST_Types.h"
-
-// inherit from GlutKeyboardHandler and installl the drawer in the singleton
-// class GlutKeyboardManager.
-
-class GlutKeyboardHandler : public MEM_NonCopyable {
-public :
-
-	virtual 
-		void
-	HandleKeyboard(
-		GHOST_TKey key,
-		int x,
-		int y
-	)= 0;
-
-	virtual 
-	~GlutKeyboardHandler(
-	){};		
-};
-
-class GlutKeyboardManager : public MEM_NonCopyable{
-
-public :
-
-	static
-		GlutKeyboardManager *
-	Instance(
-	);
-
-	static
-		void
-	HandleKeyboard(
-		GHOST_TKey key,
-		int x,
-		int y
-	);
-
-		void
-	InstallHandler(
-		GlutKeyboardHandler *
-	);
-
-		void
-	ReleaseHandler(
-	);
-
-	~GlutKeyboardManager(
-	);
-
-private :
-
-	GlutKeyboardManager (
-	) :
-		m_handler (0)
-	{
-	};
-	
-	GlutKeyboardHandler * m_handler;
-
-	static MEM_SmartPtr<GlutKeyboardManager> m_s_instance;
-};	
-
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.cpp b/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.cpp
deleted file mode 100644
index 543c70f..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "GlutMouseManager.h"
-#include "MT_assert.h"
-
-MEM_SmartPtr<GlutMouseManager> GlutMouseManager::m_s_instance = MEM_SmartPtr<GlutMouseManager>();
-
-
-	GlutMouseManager *
-GlutMouseManager::
-Instance(
-){
-	if (m_s_instance == NULL) {
-		m_s_instance = new GlutMouseManager();
-	}
-
-	return m_s_instance;
-}	
-
-// these are the functions you should pass to GLUT	
-
-	void
-GlutMouseManager::
-ButtonUp(
-	GHOST_IWindow * window,
-	GHOST_TButtonMask button_mask,
-	int x,
-	int y
-){
-	GlutMouseManager *manager = GlutMouseManager::Instance();
-
-	if (manager->m_handler != NULL) {
-		manager->m_handler->ButtonUp(window,button_mask,x,y);
-	}
-}
-
-	void
-GlutMouseManager::
-ButtonDown(
-	GHOST_IWindow * window,
-	GHOST_TButtonMask button_mask,
-	int x,
-	int y
-){
-	GlutMouseManager *manager = GlutMouseManager::Instance();
-
-	if (manager->m_handler != NULL) {
-		manager->m_handler->ButtonDown(window,button_mask,x,y);
-	}
-}
-
-
-
-	void
-GlutMouseManager::
-Motion(
-	GHOST_IWindow * window,
-	int x,
-	int y
-){
-	GlutMouseManager *manager = GlutMouseManager::Instance();
-
-	if (manager->m_handler != NULL) {
-		manager->m_handler->Motion(window,x,y);
-	}
-}
-
-	void
-GlutMouseManager::
-InstallHandler(
-	GlutMouseHandler *handler
-){
-
-	MT_assert(m_handler == NULL);
-	m_handler = handler;
-}
-
-	void
-GlutMouseManager::
-ReleaseHandler(
-){
-	m_handler = NULL;
-}
-
-GlutMouseManager::
-~GlutMouseManager(
-){
-
-	delete(m_handler);
-}
-
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h
deleted file mode 100644
index ce91708..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __GLUTMOUSEMANAGER_H__
-#define __GLUTMOUSEMANAGER_H__
-
-#include "MEM_NonCopyable.h"
-#include "MEM_SmartPtr.h"
-#include "GHOST_Types.h"
-
-class GHOST_IWindow;
-
-class GlutMouseHandler {
-public :
-
-	virtual		
-		void
-	ButtonUp(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	) = 0;
-
-	virtual		
-		void
-	ButtonDown(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	) = 0;
-
-
-	virtual
-		void
-	Motion(
-		GHOST_IWindow * window,
-		int x,
-		int y
-	) = 0;
-
-	virtual 
-	~GlutMouseHandler(
-	){};		
-};
-
-class GlutMouseManager : public MEM_NonCopyable{
-
-public :
-
-	static
-		GlutMouseManager *
-	Instance(
-	);
-
-	static
-		void
-	ButtonUp(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	);
-
-	static
-		void
-	ButtonDown(
-		GHOST_IWindow * window,
-		GHOST_TButtonMask button_mask,
-		int x,
-		int y
-	);
-
-	static
-		void
-	Motion(
-		GHOST_IWindow * window,
-		int x,
-		int y
-	);
-
-		void
-	InstallHandler(
-		GlutMouseHandler *
-	);
-
-		void
-	ReleaseHandler(
-	);
-
-	~GlutMouseManager(
-	);
-
-private :
-
-	GlutMouseManager (
-	) :
-		m_handler (0)
-	{
-	};
-	
-	GlutMouseHandler * m_handler;
-
-	static MEM_SmartPtr<GlutMouseManager> m_s_instance;
-};	
-
-
-#endif
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/main.cpp b/intern/decimation/test/decimate_glut_test/intern/main.cpp
deleted file mode 100644
index 6061da1..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/main.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "LOD_decimation.h"
-#include "ply/ply.h"
-#include "MEM_SmartPtr.h"
-#include "common/GlutDrawer.h"
-#include "GlutMeshDrawer.h"
-#include "MyGlutKeyHandler.h"
-#include "MyGlutMouseHandler.h"
-#include "MT_Vector3.h"
-#include "LOD_GhostTestApp.h"
-
-#include <memory>
-
-#define DEBUG_PRINT 0
-
-struct LoadVertex {
-  float x,y,z;             /* the usual 3-space position of a vertex */
-};
-
-struct LoadFace {
-  unsigned char intensity; /* this user attaches intensity to faces */
-  unsigned char nverts;    /* number of vertex indices in list */
-  int *verts;              /* vertex index list */
-};
-
- 
-	 LOD_Decimation_InfoPtr 
-NewVertsFromFile(
-	char * file_name,
-	MT_Vector3 &min,
-	MT_Vector3 &max
-) {
-
-	min = MT_Vector3(MT_INFINITY,MT_INFINITY,MT_INFINITY);
-	max = MT_Vector3(-MT_INFINITY,-MT_INFINITY,-MT_INFINITY);
-
-	
-	PlyProperty vert_props[] = { /* list of property information for a vertex */
-	  {"x", PLY_FLOAT, PLY_FLOAT, offsetof(LoadVertex,x), 0, 0, 0, 0},
-	  {"y", PLY_FLOAT, PLY_FLOAT, offsetof(LoadVertex,y), 0, 0, 0, 0},
-	  {"z", PLY_FLOAT, PLY_FLOAT, offsetof(LoadVertex,z), 0, 0, 0, 0},
-	};
-
-	PlyProperty face_props[] = { /* list of property information for a vertex */
-	  {"intensity", PLY_UCHAR, PLY_UCHAR, offsetof(LoadFace,intensity), 0, 0, 0, 0},
-	  {"vertex_indices", PLY_INT, PLY_INT, offsetof(LoadFace,verts),
-	   1, PLY_UCHAR, PLY_UCHAR, offsetof(LoadFace,nverts)},
-	};
-#if 0
-	MEM_SmartPtr<std::vector<float> > verts = new std::vector<float>;
-	MEM_SmartPtr<std::vector<float> > vertex_normals = new std::vector<float>;
-
-	MEM_SmartPtr<std::vector<int> > faces = new std::vector<int>;
-#else
-	std::vector<float>* verts = new std::vector<float>;
-	std::vector<float>*  vertex_normals = new std::vector<float>;
-
-	std::vector<int> * faces = new std::vector<int>;
-#endif
-
-  int i,j;
-  PlyFile *ply;
-  int nelems;
-  char **elist;
-  int file_type;
-  float version;
-  int nprops;
-  int num_elems;
-  PlyProperty **plist;
-
-  char *elem_name;
-
-	LoadVertex load_vertex;
-	LoadFace load_face;
-
-  /* open a PLY file for reading */
-  ply = ply_open_for_reading(file_name, &nelems, &elist, &file_type, &version);
-
- if (ply == NULL) return NULL;
-  /* go through each kind of element that we learned is in the file */
-  /* and read them */
-
-  for (i = 0; i < nelems; i++) {
-
-    /* get the description of the first element */
-
-    elem_name = elist[i];
-    plist = ply_get_element_description (ply, elem_name, &num_elems, &nprops);
-
-    /* print the name of the element, for debugging */
-
-    /* if we're on vertex elements, read them in */
-    if (equal_strings ("vertex", elem_name)) {
-
-      /* set up for getting vertex elements */
-
-      ply_get_property (ply, elem_name, &vert_props[0]);
-      ply_get_property (ply, elem_name, &vert_props[1]);
-      ply_get_property (ply, elem_name, &vert_props[2]);
-
-		// make some memory for the vertices		
-  		verts->reserve(num_elems);
-
-      /* grab all the vertex elements */
-      for (j = 0; j < num_elems; j++) {
-
-        /* grab and element from the file */
-        ply_get_element (ply, (void *)&load_vertex);
-		// pass the vertex into the mesh builder.
-			
-	
-		if (load_vertex.x < min.x()) {
-			min.x() = load_vertex.x;
-		} else
-		if (load_vertex.x > max.x()) {
-			max.x()= load_vertex.x;
-		}
-
-		if (load_vertex.y < min.y()) {
-			min.y() = load_vertex.y;
-		} else
-		if (load_vertex.y > max.y()) {
-			max.y()= load_vertex.y;
-		}
-
-		if (load_vertex.z < min.z()) {
-			min.z() = load_vertex.z;
-		} else
-		if (load_vertex.z > max.z()) {
-			max.z()= load_vertex.z;
-		}
-
-		verts->push_back(load_vertex.x);
-		verts->push_back(load_vertex.y);
-		verts->push_back(load_vertex.z);
-
-		vertex_normals->push_back(1.0f);
-		vertex_normals->push_back(0.0f);
-		vertex_normals->push_back(0.0f);
-
-
-      }
-    }
-
-    /* if we're on face elements, read them in */
-    if (equal_strings ("face", elem_name)) {
-
-      /* set up for getting face elements */
-
- //     ply_get_property (ply, elem_name, &face_props[0]);
-      ply_get_property (ply, elem_name, &face_props[1]);
-
-      /* grab all the face elements */
-      for (j = 0; j < num_elems; j++) {
-
-        ply_get_element (ply, (void *)&load_face);
-
-		faces->push_back(load_face.verts[0]);
-		faces->push_back(load_face.verts[1]);
-		faces->push_back(load_face.verts[2]);
-
-		// free up the memory this pile of shit used to allocate the polygon's vertices
-
-		free (load_face.verts);
-      }
-
-    }
-  }
-  /* close the PLY file */
-  ply_close (ply);
-
-  LOD_Decimation_InfoPtr output = new LOD_Decimation_Info;
-
-  output->vertex_buffer = verts->begin();
-  output->vertex_num = verts->size()/3;
-
-  output->triangle_index_buffer = faces->begin();
-  output->face_num = faces->size()/3;
-  output->intern = NULL;
-  output->vertex_normal_buffer = vertex_normals->begin();
-
-  // memory leaks 'r' us	
-#if 0
-  verts.Release();
-  vertex_normals.Release();
-  faces.Release();
-#endif
-  return output;
-}
-	
-
-void
-init(MT_Vector3 min,MT_Vector3 max)
-{
- 
-	GLfloat light_diffuse0[] = {1.0, 0.0, 0.0, 0.5};  /* Red diffuse light. */
-	GLfloat light_position0[] = {1.0, 1.0, 1.0, 0.0};  /* Infinite light location. */
-
-	GLfloat light_diffuse1[] = {1.0, 1.0, 1.0, 0.5};  /* Red diffuse light. */
-	GLfloat light_position1[] = {1.0, 0, 0, 0.0};  /* Infinite light location. */
-
-  /* Enable a single OpenGL light. */
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse0);
-  glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
-
-  glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
-  glLightfv(GL_LIGHT1, GL_POSITION, light_position1);
-
-  glEnable(GL_LIGHT0);
-//  glEnable(GL_LIGHT1);
-  glEnable(GL_LIGHTING);
-
-	// use two sided lighting model
-	
-	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
-
-  /* Use depth buffering for hidden surface elimination. */
-  glEnable(GL_DEPTH_TEST);
-
-  /* Setup the view of the cube. */
-  glMatrixMode(GL_PROJECTION);
-
-	// center of the box + 3* depth of box
-
-  MT_Vector3 center = (min + max) * 0.5;
-  MT_Vector3 diag = max - min;
-
-	float depth = diag.length();
-	float distance = 2;
-
-  gluPerspective( 
-	/* field of view in degree */ 40.0,
-    /* aspect ratio */ 1.0,
-    /* Z near */ 1.0, 
-	/* Z far */ distance * depth * 2
-  );
-  glMatrixMode(GL_MODELVIEW);	
-
-
-  gluLookAt(
-	center.x(), center.y(), center.z() + distance*depth,  /* eye is at (0,0,5) */
-    center.x(), center.y(), center.z(),      /* center is at (0,0,0) */
-    0.0, 1.0, 0.);      /* up is in positive Y direction */
-
-  glPushMatrix();	
-
-
-}
-
-int
-main(int argc, char **argv)
-{
-
-// load in the mesh
-
-	MT_Vector3 mesh_min,mesh_max;
-
-	LOD_Decimation_InfoPtr LOD_info = NewVertsFromFile("beethoven.ply",mesh_min,mesh_max);
-
-	// load the mesh data 
-
-	int load_result = LOD_LoadMesh(LOD_info);
-	int preprocess_result = LOD_PreprocessMesh(LOD_info);
-
-	if (!(load_result && preprocess_result)) {
-		cout << " could not load mesh! \n";
-		return 0;
-	}
-
-	// make and install a mouse handler
-
-	MEM_SmartPtr<MyGlutMouseHandler> mouse_handler(MyGlutMouseHandler::New());
-	GlutMouseManager::Instance()->InstallHandler(mouse_handler);
-
-	// instantiate the drawing class	
-
-	MEM_SmartPtr<GlutMeshDrawer> drawer(GlutMeshDrawer::New());
-	GlutDrawManager::Instance()->InstallDrawer(drawer);
-	drawer->SetLODInfo(LOD_info);	
-	drawer->SetMouseHandler(mouse_handler);
-
-	// make and install a keyhandler
-
-	MEM_SmartPtr<MyGlutKeyHandler> key_handler(MyGlutKeyHandler::New(LOD_info));
-	GlutKeyboardManager::Instance()->InstallHandler(key_handler);
-
-
-	LOD_GhostTestApp LOD_app;
-
-	LOD_app.InitApp();
-	init(mesh_min,mesh_max);
-
-	LOD_app.Run();
-
-
-	return 0;             /* ANSI C requires main to return int. */
-}
diff --git a/intern/decimation/test/decimate_glut_test/intern/ply/ply.h b/intern/decimation/test/decimate_glut_test/intern/ply/ply.h
deleted file mode 100644
index 12425de..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/ply/ply.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/*
-
-Header for PLY polygon files.
-
-- Greg Turk, March 1994
-
-A PLY file contains a single polygonal _object_.
-
-An object is composed of lists of _elements_.  Typical elements are
-vertices, faces, edges and materials.
-
-Each type of element for a given object has one or more _properties_
-associated with the element type.  For instance, a vertex element may
-have as properties three floating-point values x,y,z and three unsigned
-chars for red, green and blue.
-
----------------------------------------------------------------
-
-Copyright (c) 1994 The Board of Trustees of The Leland Stanford
-Junior University.  All rights reserved.   
-  
-Permission to use, copy, modify and distribute this software and its   
-documentation for any purpose is hereby granted without fee, provided   
-that the above copyright notice and this permission notice appear in   
-all copies of this software and that you do not sell the software.   
-  
-THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,   
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY   
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   
-
-*/
-
-#ifndef __PLY_H__
-#define __PLY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <stddef.h>
-
-#define PLY_ASCII      1        /* ascii PLY file */
-#define PLY_BINARY_BE  2        /* binary PLY file, big endian */
-#define PLY_BINARY_LE  3        /* binary PLY file, little endian */
-
-#define PLY_OKAY    0           /* ply routine worked okay */
-#define PLY_ERROR  -1           /* error in ply routine */
-
-/* scalar data types supported by PLY format */
-
-#define PLY_START_TYPE 0
-#define PLY_CHAR       1
-#define PLY_SHORT      2
-#define PLY_INT        3
-#define PLY_UCHAR      4
-#define PLY_USHORT     5
-#define PLY_UINT       6
-#define PLY_FLOAT      7
-#define PLY_DOUBLE     8
-#define PLY_END_TYPE   9
-
-#define  PLY_SCALAR  0
-#define  PLY_LIST    1
-
-
-typedef struct PlyProperty {    /* description of a property */
-
-  char *name;                           /* property name */
-  int external_type;                    /* file's data type */
-  int internal_type;                    /* program's data type */
-  int offset;                           /* offset bytes of prop in a struct */
-
-  int is_list;                          /* 1 = list, 0 = scalar */
-  int count_external;                   /* file's count type */
-  int count_internal;                   /* program's count type */
-  int count_offset;                     /* offset byte for list count */
-
-} PlyProperty;
-
-typedef struct PlyElement {     /* description of an element */
-  char *name;                   /* element name */
-  int num;                      /* number of elements in this object */
-  int size;                     /* size of element (bytes) or -1 if variable */
-  int nprops;                   /* number of properties for this element */
-  PlyProperty **props;          /* list of properties in the file */
-  char *store_prop;             /* flags: property wanted by user? */
-  int other_offset;             /* offset to un-asked-for props, or -1 if none*/
-  int other_size;               /* size of other_props structure */
-} PlyElement;
-
-typedef struct PlyOtherProp {   /* describes other properties in an element */
-  char *name;                   /* element name */
-  int size;                     /* size of other_props */
-  int nprops;                   /* number of properties in other_props */
-  PlyProperty **props;          /* list of properties in other_props */
-} PlyOtherProp;
-
-typedef struct OtherData { /* for storing other_props for an other element */
-  void *other_props;
-} OtherData;
-
-typedef struct OtherElem {     /* data for one "other" element */
-  char *elem_name;             /* names of other elements */
-  int elem_count;              /* count of instances of each element */
-  OtherData **other_data;      /* actual property data for the elements */
-  PlyOtherProp *other_props;   /* description of the property data */
-} OtherElem;
-
-typedef struct PlyOtherElems {  /* "other" elements, not interpreted by user */
-  int num_elems;                /* number of other elements */
-  OtherElem *other_list;        /* list of data for other elements */
-} PlyOtherElems;
-
-typedef struct PlyFile {        /* description of PLY file */
-  FILE *fp;                     /* file pointer */
-  int file_type;                /* ascii or binary */
-  float version;                /* version number of file */
-  int nelems;                   /* number of elements of object */
-  PlyElement **elems;           /* list of elements */
-  int num_comments;             /* number of comments */
-  char **comments;              /* list of comments */
-  int num_obj_info;             /* number of items of object information */
-  char **obj_info;              /* list of object info items */
-  PlyElement *which_elem;       /* which element we're currently writing */
-  PlyOtherElems *other_elems;   /* "other" elements from a PLY file */
-} PlyFile;
-
-/* memory allocation */
-static char *my_alloc();
-#define myalloc(mem_size) my_alloc((mem_size), __LINE__, __FILE__)
-
-
-/*** delcaration of routines ***/
-
-extern PlyFile *ply_write(FILE *, int, char **, int);
-extern PlyFile *ply_open_for_writing(char *, int, char **, int, float *);
-extern void ply_describe_element(PlyFile *, char *, int, int, PlyProperty *);
-extern void ply_describe_property(PlyFile *, char *, PlyProperty *);
-extern void ply_element_count(PlyFile *, char *, int);
-extern void ply_header_complete(PlyFile *);
-extern void ply_put_element_setup(PlyFile *, char *);
-extern void ply_put_element(PlyFile *, void *);
-extern void ply_put_comment(PlyFile *, char *);
-extern void ply_put_obj_info(PlyFile *, char *);
-extern PlyFile *ply_read(FILE *, int *, char ***);
-extern PlyFile *ply_open_for_reading( char *, int *, char ***, int *, float *);
-extern PlyProperty **ply_get_element_description(PlyFile *, char *, int*, int*);
-extern void ply_get_element_setup( PlyFile *, char *, int, PlyProperty *);
-extern void ply_get_property(PlyFile *, char *, PlyProperty *);
-extern PlyOtherProp *ply_get_other_properties(PlyFile *, char *, int);
-extern void ply_get_element(PlyFile *, void *);
-extern char **ply_get_comments(PlyFile *, int *);
-extern char **ply_get_obj_info(PlyFile *, int *);
-extern void ply_close(PlyFile *);
-extern void ply_get_info(PlyFile *, float *, int *);
-extern PlyOtherElems *ply_get_other_element (PlyFile *, char *, int);
-extern void ply_describe_other_elements ( PlyFile *, PlyOtherElems *);
-extern void ply_put_other_elements (PlyFile *);
-extern void ply_free_other_elements (PlyOtherElems *);
-
-extern int equal_strings(char *, char *);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !__PLY_H__ */
-
diff --git a/intern/decimation/test/decimate_glut_test/intern/ply/plyfile.c b/intern/decimation/test/decimate_glut_test/intern/ply/plyfile.c
deleted file mode 100644
index 9cb9d81..0000000
--- a/intern/decimation/test/decimate_glut_test/intern/ply/plyfile.c
+++ /dev/null
@@ -1,2544 +0,0 @@
-/**
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/*
-
-
-The interface routines for reading and writing PLY polygon files.
-
-Greg Turk, February 1994
-
----------------------------------------------------------------
-
-A PLY file contains a single polygonal _object_.
-
-An object is composed of lists of _elements_.  Typical elements are
-vertices, faces, edges and materials.
-
-Each type of element for a given object has one or more _properties_
-associated with the element type.  For instance, a vertex element may
-have as properties the floating-point values x,y,z and the three unsigned
-chars representing red, green and blue.
-
----------------------------------------------------------------
-
-Copyright (c) 1994 The Board of Trustees of The Leland Stanford
-Junior University.  All rights reserved.   
-  
-Permission to use, copy, modify and distribute this software and its   
-documentation for any purpose is hereby granted without fee, provided   
-that the above copyright notice and this permission notice appear in   
-all copies of this software and that you do not sell the software.   
-  
-THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,   
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY   
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   
-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include "ply.h"
-
-char *type_names[] = {
-"invalid",
-"char", "short", "int",
-"uchar", "ushort", "uint",
-"float", "double",
-};
-
-int ply_type_size[] = {
-  0, 1, 2, 4, 1, 2, 4, 4, 8
-};
-
-#define NO_OTHER_PROPS  -1
-
-#define DONT_STORE_PROP  0
-#define STORE_PROP       1
-
-#define OTHER_PROP       0
-#define NAMED_PROP       1
-
-
-/* returns 1 if strings are equal, 0 if not */
-int equal_strings(char *, char *);
-
-/* find an element in a plyfile's list */
-PlyElement *find_element(PlyFile *, char *);
-
-/* find a property in an element's list */
-PlyProperty *find_property(PlyElement *, char *, int *);
-
-/* write to a file the word describing a PLY file data type */
-void write_scalar_type (FILE *, int);
-
-/* read a line from a file and break it up into separate words */
-char **get_words(FILE *, int *, char **);
-char **old_get_words(FILE *, int *);
-
-/* write an item to a file */
-void write_binary_item(FILE *, int, unsigned int, double, int);
-void write_ascii_item(FILE *, int, unsigned int, double, int);
-double old_write_ascii_item(FILE *, char *, int);
-
-/* add information to a PLY file descriptor */
-void add_element(PlyFile *, char **);
-void add_property(PlyFile *, char **);
-void add_comment(PlyFile *, char *);
-void add_obj_info(PlyFile *, char *);
-
-/* copy a property */
-void copy_property(PlyProperty *, PlyProperty *);
-
-/* store a value into where a pointer and a type specify */
-void store_item(char *, int, int, unsigned int, double);
-
-/* return the value of a stored item */
-void get_stored_item( void *, int, int *, unsigned int *, double *);
-
-/* return the value stored in an item, given ptr to it and its type */
-double get_item_value(char *, int);
-
-/* get binary or ascii item and store it according to ptr and type */
-void get_ascii_item(char *, int, int *, unsigned int *, double *);
-void get_binary_item(FILE *, int, int *, unsigned int *, double *);
-
-/* get a bunch of elements from a file */
-void ascii_get_element(PlyFile *, char *);
-void binary_get_element(PlyFile *, char *);
-
-/* memory allocation */
-char *my_alloc(int, int, char *);
-
-
-/*************/
-/*  Writing  */
-/*************/
-
-
-/******************************************************************************
-Given a file pointer, get ready to write PLY data to the file.
-
-Entry:
-  fp         - the given file pointer
-  nelems     - number of elements in object
-  elem_names - list of element names
-  file_type  - file type, either ascii or binary
-
-Exit:
-  returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_write(
-  FILE *fp,
-  int nelems,
-  char **elem_names,
-  int file_type
-)
-{
-  int i;
-  PlyFile *plyfile;
-  PlyElement *elem;
-
-  /* check for NULL file pointer */
-  if (fp == NULL)
-    return (NULL);
-
-  /* create a record for this object */
-
-  plyfile = (PlyFile *) myalloc (sizeof (PlyFile));
-  plyfile->file_type = file_type;
-  plyfile->num_comments = 0;
-  plyfile->num_obj_info = 0;
-  plyfile->nelems = nelems;
-  plyfile->version = 1.0;
-  plyfile->fp = fp;
-  plyfile->other_elems = NULL;
-
-  /* tuck aside the names of the elements */
-
-  plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *) * nelems);
-  for (i = 0; i < nelems; i++) {
-    elem = (PlyElement *) myalloc (sizeof (PlyElement));
-    plyfile->elems[i] = elem;
-    elem->name = strdup (elem_names[i]);
-    elem->num = 0;
-    elem->nprops = 0;
-  }
-
-  /* return pointer to the file descriptor */
-  return (plyfile);
-}
-
-
-/******************************************************************************
-Open a polygon file for writing.
-
-Entry:
-  filename   - name of file to read from
-  nelems     - number of elements in object
-  elem_names - list of element names
-  file_type  - file type, either ascii or binary
-
-Exit:
-  version - version number of PLY file
-  returns a file identifier, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_open_for_writing(
-  char *filename,
-  int nelems,
-  char **elem_names,
-  int file_type,
-  float *version
-)
-{
-  PlyFile *plyfile;
-  char *name;
-  FILE *fp;
-
-  /* tack on the extension .ply, if necessary */
-
-  name = (char *) myalloc (sizeof (char) * (strlen (filename) + 5));
-  strcpy (name, filename);
-  if (strlen (name) < 4 ||
-      strcmp (name + strlen (name) - 4, ".ply") != 0)
-      strcat (name, ".ply");
-
-  /* open the file for writing */
-
-  fp = fopen (name, "w");
-  if (fp == NULL) {
-    return (NULL);
-  }
-
-  /* create the actual PlyFile structure */
-
-  plyfile = ply_write (fp, nelems, elem_names, file_type);
-  if (plyfile == NULL)
-    return (NULL);
-
-  /* say what PLY file version number we're writing */
-  *version = plyfile->version;
-
-  /* return pointer to the file descriptor */
-  return (plyfile);
-}
-
-
-/******************************************************************************
-Describe an element, including its properties and how many will be written
-to the file.
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element that information is being specified about
-  nelems    - number of elements of this type to be written
-  nprops    - number of properties contained in the element
-  prop_list - list of properties
-******************************************************************************/
-
-void ply_describe_element(
-  PlyFile *plyfile,
-  char *elem_name,
-  int nelems,
-  int nprops,
-  PlyProperty *prop_list
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyProperty *prop;
-
-  /* look for appropriate element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf(stderr,"ply_describe_element: can't find element '%s'\n",elem_name);
-    exit (-1);
-  }
-
-  elem->num = nelems;
-
-  /* copy the list of properties */
-
-  elem->nprops = nprops;
-  elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *) * nprops);
-  elem->store_prop = (char *) myalloc (sizeof (char) * nprops);
-
-  for (i = 0; i < nprops; i++) {
-    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-    elem->props[i] = prop;
-    elem->store_prop[i] = NAMED_PROP;
-    copy_property (prop, &prop_list[i]);
-  }
-}
-
-
-/******************************************************************************
-Describe a property of an element.
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element that information is being specified about
-  prop      - the new property
-******************************************************************************/
-
-void ply_describe_property(
-  PlyFile *plyfile,
-  char *elem_name,
-  PlyProperty *prop
-)
-{
-  PlyElement *elem;
-  PlyProperty *elem_prop;
-
-  /* look for appropriate element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf(stderr, "ply_describe_property: can't find element '%s'\n",
-            elem_name);
-    return;
-  }
-
-  /* create room for new property */
-
-  if (elem->nprops == 0) {
-    elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *));
-    elem->store_prop = (char *) myalloc (sizeof (char));
-    elem->nprops = 1;
-  }
-  else {
-    elem->nprops++;
-    elem->props = (PlyProperty **)
-                  realloc (elem->props, sizeof (PlyProperty *) * elem->nprops);
-    elem->store_prop = (char *)
-                  realloc (elem->store_prop, sizeof (char) * elem->nprops);
-  }
-
-  /* copy the new property */
-
-  elem_prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-  elem->props[elem->nprops - 1] = elem_prop;
-  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
-  copy_property (elem_prop, prop);
-}
-
-
-/******************************************************************************
-Describe what the "other" properties are that are to be stored, and where
-they are in an element.
-******************************************************************************/
-
-void ply_describe_other_properties(
-  PlyFile *plyfile,
-  PlyOtherProp *other,
-  int offset
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyProperty *prop;
-
-  /* look for appropriate element */
-  elem = find_element (plyfile, other->name);
-  if (elem == NULL) {
-    fprintf(stderr, "ply_describe_other_properties: can't find element '%s'\n",
-            other->name);
-    return;
-  }
-
-  /* create room for other properties */
-
-  if (elem->nprops == 0) {
-    elem->props = (PlyProperty **)
-                  myalloc (sizeof (PlyProperty *) * other->nprops);
-    elem->store_prop = (char *) myalloc (sizeof (char) * other->nprops);
-    elem->nprops = 0;
-  }
-  else {
-    int newsize;
-    newsize = elem->nprops + other->nprops;
-    elem->props = (PlyProperty **)
-                  realloc (elem->props, sizeof (PlyProperty *) * newsize);
-    elem->store_prop = (char *)
-                  realloc (elem->store_prop, sizeof (char) * newsize);
-  }
-
-  /* copy the other properties */
-
-  for (i = 0; i < other->nprops; i++) {
-    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-    copy_property (prop, other->props[i]);
-    elem->props[elem->nprops] = prop;
-    elem->store_prop[elem->nprops] = OTHER_PROP;
-    elem->nprops++;
-  }
-
-  /* save other info about other properties */
-  elem->other_size = other->size;
-  elem->other_offset = offset;
-}
-
-
-/******************************************************************************
-State how many of a given element will be written.
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element that information is being specified about
-  nelems    - number of elements of this type to be written
-******************************************************************************/
-
-void ply_element_count(
-  PlyFile *plyfile,
-  char *elem_name,
-  int nelems
-)
-{
-  PlyElement *elem;
-
-  /* look for appropriate element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf(stderr,"ply_element_count: can't find element '%s'\n",elem_name);
-    exit (-1);
-  }
-
-  elem->num = nelems;
-}
-
-
-/******************************************************************************
-Signal that we've described everything a PLY file's header and that the
-header should be written to the file.
-
-Entry:
-  plyfile - file identifier
-******************************************************************************/
-
-void ply_header_complete(PlyFile *plyfile)
-{
-  int i,j;
-  FILE *fp = plyfile->fp;
-  PlyElement *elem;
-  PlyProperty *prop;
-
-  fprintf (fp, "ply\n");
-
-  switch (plyfile->file_type) {
-    case PLY_ASCII:
-      fprintf (fp, "format ascii 1.0\n");
-      break;
-    case PLY_BINARY_BE:
-      fprintf (fp, "format binary_big_endian 1.0\n");
-      break;
-    case PLY_BINARY_LE:
-      fprintf (fp, "format binary_little_endian 1.0\n");
-      break;
-    default:
-      fprintf (stderr, "ply_header_complete: bad file type = %d\n",
-               plyfile->file_type);
-      exit (-1);
-  }
-
-  /* write out the comments */
-
-  for (i = 0; i < plyfile->num_comments; i++)
-    fprintf (fp, "comment %s\n", plyfile->comments[i]);
-
-  /* write out object information */
-
-  for (i = 0; i < plyfile->num_obj_info; i++)
-    fprintf (fp, "obj_info %s\n", plyfile->obj_info[i]);
-
-  /* write out information about each element */
-
-  for (i = 0; i < plyfile->nelems; i++) {
-
-    elem = plyfile->elems[i];
-    fprintf (fp, "element %s %d\n", elem->name, elem->num);
-
-    /* write out each property */
-    for (j = 0; j < elem->nprops; j++) {
-      prop = elem->props[j];
-      if (prop->is_list) {
-        fprintf (fp, "property list ");
-        write_scalar_type (fp, prop->count_external);
-        fprintf (fp, " ");
-        write_scalar_type (fp, prop->external_type);
-        fprintf (fp, " %s\n", prop->name);
-      }
-      else {
-        fprintf (fp, "property ");
-        write_scalar_type (fp, prop->external_type);
-        fprintf (fp, " %s\n", prop->name);
-      }
-    }
-  }
-
-  fprintf (fp, "end_header\n");
-}
-
-
-/******************************************************************************
-Specify which elements are going to be written.  This should be called
-before a call to the routine ply_put_element().
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element we're talking about
-******************************************************************************/
-
-void ply_put_element_setup(PlyFile *plyfile, char *elem_name)
-{
-  PlyElement *elem;
-
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf(stderr, "ply_elements_setup: can't find element '%s'\n", elem_name);
-    exit (-1);
-  }
-
-  plyfile->which_elem = elem;
-}
-
-
-/******************************************************************************
-Write an element to the file.  This routine assumes that we're
-writing the type of element specified in the last call to the routine
-ply_put_element_setup().
-
-Entry:
-  plyfile  - file identifier
-  elem_ptr - pointer to the element
-******************************************************************************/
-
-void ply_put_element(PlyFile *plyfile, void *elem_ptr)
-{
-  int j,k;
-  FILE *fp = plyfile->fp;
-  PlyElement *elem;
-  PlyProperty *prop;
-  char *elem_data,*item;
-  char **item_ptr;
-  int list_count;
-  int item_size;
-  int int_val;
-  unsigned int uint_val;
-  double double_val;
-  char **other_ptr;
-
-  elem = plyfile->which_elem;
-  elem_data = elem_ptr;
-  other_ptr = (char **) (((char *) elem_ptr) + elem->other_offset);
-
-  /* write out either to an ascii or binary file */
-
-  if (plyfile->file_type == PLY_ASCII) {
-
-    /* write an ascii file */
-
-    /* write out each property of the element */
-    for (j = 0; j < elem->nprops; j++) {
-      prop = elem->props[j];
-      if (elem->store_prop[j] == OTHER_PROP)
-        elem_data = *other_ptr;
-      else
-        elem_data = elem_ptr;
-      if (prop->is_list) {
-        item = elem_data + prop->count_offset;
-        get_stored_item ((void *) item, prop->count_internal,
-                         &int_val, &uint_val, &double_val);
-        write_ascii_item (fp, int_val, uint_val, double_val,
-                          prop->count_external);
-        list_count = uint_val;
-        item_ptr = (char **) (elem_data + prop->offset);
-        item = item_ptr[0];
-       item_size = ply_type_size[prop->internal_type];
-        for (k = 0; k < list_count; k++) {
-          get_stored_item ((void *) item, prop->internal_type,
-                           &int_val, &uint_val, &double_val);
-          write_ascii_item (fp, int_val, uint_val, double_val,
-                            prop->external_type);
-          item += item_size;
-        }
-      }
-      else {
-        item = elem_data + prop->offset;
-        get_stored_item ((void *) item, prop->internal_type,
-                         &int_val, &uint_val, &double_val);
-        write_ascii_item (fp, int_val, uint_val, double_val,
-                          prop->external_type);
-      }
-    }
-
-    fprintf (fp, "\n");
-  }
-  else {
-
-    /* write a binary file */
-
-    /* write out each property of the element */
-    for (j = 0; j < elem->nprops; j++) {
-      prop = elem->props[j];
-      if (elem->store_prop[j] == OTHER_PROP)
-        elem_data = *other_ptr;
-      else
-        elem_data = elem_ptr;
-      if (prop->is_list) {
-        item = elem_data + prop->count_offset;
-        item_size = ply_type_size[prop->count_internal];
-        get_stored_item ((void *) item, prop->count_internal,
-                         &int_val, &uint_val, &double_val);
-        write_binary_item (fp, int_val, uint_val, double_val,
-                           prop->count_external);
-        list_count = uint_val;
-        item_ptr = (char **) (elem_data + prop->offset);
-        item = item_ptr[0];
-        item_size = ply_type_size[prop->internal_type];
-        for (k = 0; k < list_count; k++) {
-          get_stored_item ((void *) item, prop->internal_type,
-                           &int_val, &uint_val, &double_val);
-          write_binary_item (fp, int_val, uint_val, double_val,
-                             prop->external_type);
-          item += item_size;
-        }
-      }
-      else {
-        item = elem_data + prop->offset;
-        item_size = ply_type_size[prop->internal_type];
-        get_stored_item ((void *) item, prop->internal_type,
-                         &int_val, &uint_val, &double_val);
-        write_binary_item (fp, int_val, uint_val, double_val,
-                           prop->external_type);
-      }
-    }
-
-  }
-}
-
-
-/******************************************************************************
-Specify a comment that will be written in the header.
-
-Entry:
-  plyfile - file identifier
-  comment - the comment to be written
-******************************************************************************/
-
-void ply_put_comment(PlyFile *plyfile, char *comment)
-{
-  /* (re)allocate space for new comment */
-  if (plyfile->num_comments == 0)
-    plyfile->comments = (char **) myalloc (sizeof (char *));
-  else
-    plyfile->comments = (char **) realloc (plyfile->comments,
-                         sizeof (char *) * (plyfile->num_comments + 1));
-
-  /* add comment to list */
-  plyfile->comments[plyfile->num_comments] = strdup (comment);
-  plyfile->num_comments++;
-}
-
-
-/******************************************************************************
-Specify a piece of object information (arbitrary text) that will be written
-in the header.
-
-Entry:
-  plyfile  - file identifier
-  obj_info - the text information to be written
-******************************************************************************/
-
-void ply_put_obj_info(PlyFile *plyfile, char *obj_info)
-{
-  /* (re)allocate space for new info */
-  if (plyfile->num_obj_info == 0)
-    plyfile->obj_info = (char **) myalloc (sizeof (char *));
-  else
-    plyfile->obj_info = (char **) realloc (plyfile->obj_info,
-                         sizeof (char *) * (plyfile->num_obj_info + 1));
-
-  /* add info to list */
-  plyfile->obj_info[plyfile->num_obj_info] = strdup (obj_info);
-  plyfile->num_obj_info++;
-}
-
-
-
-
-
-
-
-/*************/
-/*  Reading  */
-/*************/
-
-
-
-/******************************************************************************
-Given a file pointer, get ready to read PLY data from the file.
-
-Entry:
-  fp - the given file pointer
-
-Exit:
-  nelems     - number of elements in object
-  elem_names - list of element names
-  returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names)
-{
-  int i,j;
-  PlyFile *plyfile;
-  int nwords;
-  char **words;
-  int found_format = 0;
-  char **elist;
-  PlyElement *elem;
-  char *orig_line;
-
-  /* check for NULL file pointer */
-  if (fp == NULL)
-    return (NULL);
-
-  /* create record for this object */
-
-  plyfile = (PlyFile *) myalloc (sizeof (PlyFile));
-  plyfile->nelems = 0;
-  plyfile->comments = NULL;
-  plyfile->num_comments = 0;
-  plyfile->obj_info = NULL;
-  plyfile->num_obj_info = 0;
-  plyfile->fp = fp;
-  plyfile->other_elems = NULL;
-
-  /* read and parse the file's header */
-
-  words = get_words (plyfile->fp, &nwords, &orig_line);
-  if (!words || !equal_strings (words[0], "ply"))
-    return (NULL);
-
-  while (words) {
-
-    /* parse words */
-
-    if (equal_strings (words[0], "format")) {
-      if (nwords != 3)
-        return (NULL);
-      if (equal_strings (words[1], "ascii"))
-        plyfile->file_type = PLY_ASCII;
-      else if (equal_strings (words[1], "binary_big_endian"))
-        plyfile->file_type = PLY_BINARY_BE;
-      else if (equal_strings (words[1], "binary_little_endian"))
-        plyfile->file_type = PLY_BINARY_LE;
-      else
-        return (NULL);
-      plyfile->version = (float)atof (words[2]);
-      found_format = 1;
-    }
-    else if (equal_strings (words[0], "element"))
-      add_element (plyfile, words);
-    else if (equal_strings (words[0], "property"))
-      add_property (plyfile, words);
-    else if (equal_strings (words[0], "comment"))
-      add_comment (plyfile, orig_line);
-    else if (equal_strings (words[0], "obj_info"))
-      add_obj_info (plyfile, orig_line);
-    else if (equal_strings (words[0], "end_header"))
-      break;
-
-    /* free up words space */
-    free (words);
-
-    words = get_words (plyfile->fp, &nwords, &orig_line);
-  }
-
-  /* create tags for each property of each element, to be used */
-  /* later to say whether or not to store each property for the user */
-
-  for (i = 0; i < plyfile->nelems; i++) {
-    elem = plyfile->elems[i];
-    elem->store_prop = (char *) myalloc (sizeof (char) * elem->nprops);
-    for (j = 0; j < elem->nprops; j++)
-      elem->store_prop[j] = DONT_STORE_PROP;
-    elem->other_offset = NO_OTHER_PROPS; /* no "other" props by default */
-  }
-
-  /* set return values about the elements */
-
-  elist = (char **) myalloc (sizeof (char *) * plyfile->nelems);
-  for (i = 0; i < plyfile->nelems; i++)
-    elist[i] = strdup (plyfile->elems[i]->name);
-
-  *elem_names = elist;
-  *nelems = plyfile->nelems;
-
-  /* return a pointer to the file's information */
-
-  return (plyfile);
-}
-
-
-/******************************************************************************
-Open a polygon file for reading.
-
-Entry:
-  filename - name of file to read from
-
-Exit:
-  nelems     - number of elements in object
-  elem_names - list of element names
-  file_type  - file type, either ascii or binary
-  version    - version number of PLY file
-  returns a file identifier, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_open_for_reading(
-  char *filename,
-  int *nelems,
-  char ***elem_names,
-  int *file_type,
-  float *version
-)
-{
-  FILE *fp;
-  PlyFile *plyfile;
-  char *name;
-
-  /* tack on the extension .ply, if necessary */
-
-  name = (char *) myalloc (sizeof (char) * (strlen (filename) + 5));
-  strcpy (name, filename);
-  if (strlen (name) < 4 ||
-      strcmp (name + strlen (name) - 4, ".ply") != 0)
-      strcat (name, ".ply");
-
-  /* open the file for reading */
-
-  fp = fopen (name, "r");
-  if (fp == NULL)
-    return (NULL);
-
-  /* create the PlyFile data structure */
-
-  plyfile = ply_read (fp, nelems, elem_names);
-
-  /* determine the file type and version */
-
-  *file_type = plyfile->file_type;
-  *version = plyfile->version;
-
-  /* return a pointer to the file's information */
-
-  return (plyfile);
-}
-
-
-/******************************************************************************
-Get information about a particular element.
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element to get information about
-
-Exit:
-  nelems   - number of elements of this type in the file
-  nprops   - number of properties
-  returns a list of properties, or NULL if the file doesn't contain that elem
-******************************************************************************/
-
-PlyProperty **ply_get_element_description(
-  PlyFile *plyfile,
-  char *elem_name,
-  int *nelems,
-  int *nprops
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyProperty *prop;
-  PlyProperty **prop_list;
-
-  /* find information about the element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL)
-    return (NULL);
-
-  *nelems = elem->num;
-  *nprops = elem->nprops;
-
-  /* make a copy of the element's property list */
-  prop_list = (PlyProperty **) myalloc (sizeof (PlyProperty *) * elem->nprops);
-  for (i = 0; i < elem->nprops; i++) {
-    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-    copy_property (prop, elem->props[i]);
-    prop_list[i] = prop;
-  }
-
-  /* return this duplicate property list */
-  return (prop_list);
-}
-
-
-/******************************************************************************
-Specify which properties of an element are to be returned.  This should be
-called before a call to the routine ply_get_element().
-
-Entry:
-  plyfile   - file identifier
-  elem_name - which element we're talking about
-  nprops    - number of properties
-  prop_list - list of properties
-******************************************************************************/
-
-void ply_get_element_setup(
-  PlyFile *plyfile,
-  char *elem_name,
-  int nprops,
-  PlyProperty *prop_list
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyProperty *prop;
-  int index;
-
-  /* find information about the element */
-  elem = find_element (plyfile, elem_name);
-  plyfile->which_elem = elem;
-
-  /* deposit the property information into the element's description */
-  for (i = 0; i < nprops; i++) {
-
-    /* look for actual property */
-    prop = find_property (elem, prop_list[i].name, &index);
-    if (prop == NULL) {
-      fprintf (stderr, "Warning:  Can't find property '%s' in element '%s'\n",
-               prop_list[i].name, elem_name);
-      continue;
-    }
-
-    /* store its description */
-    prop->internal_type = prop_list[i].internal_type;
-    prop->offset = prop_list[i].offset;
-    prop->count_internal = prop_list[i].count_internal;
-    prop->count_offset = prop_list[i].count_offset;
-
-    /* specify that the user wants this property */
-    elem->store_prop[index] = STORE_PROP;
-  }
-}
-
-
-/******************************************************************************
-Specify a property of an element that is to be returned.  This should be
-called (usually multiple times) before a call to the routine ply_get_element().
-This routine should be used in preference to the less flexible old routine
-called ply_get_element_setup().
-
-Entry:
-  plyfile   - file identifier
-  elem_name - which element we're talking about
-  prop      - property to add to those that will be returned
-******************************************************************************/
-
-void ply_get_property(
-  PlyFile *plyfile,
-  char *elem_name,
-  PlyProperty *prop
-)
-{
-  PlyElement *elem;
-  PlyProperty *prop_ptr;
-  int index;
-
-  /* find information about the element */
-  elem = find_element (plyfile, elem_name);
-  plyfile->which_elem = elem;
-
-  /* deposit the property information into the element's description */
-
-  prop_ptr = find_property (elem, prop->name, &index);
-  if (prop_ptr == NULL) {
-    fprintf (stderr, "Warning:  Can't find property '%s' in element '%s'\n",
-             prop->name, elem_name);
-    return;
-  }
-  prop_ptr->internal_type  = prop->internal_type;
-  prop_ptr->offset         = prop->offset;
-  prop_ptr->count_internal = prop->count_internal;
-  prop_ptr->count_offset   = prop->count_offset;
-
-  /* specify that the user wants this property */
-  elem->store_prop[index] = STORE_PROP;
-}
-
-
-/******************************************************************************
-Read one element from the file.  This routine assumes that we're reading
-the type of element specified in the last call to the routine
-ply_get_element_setup().
-
-Entry:
-  plyfile  - file identifier
-  elem_ptr - pointer to location where the element information should be put
-******************************************************************************/
-
-void ply_get_element(PlyFile *plyfile, void *elem_ptr)
-{
-  if (plyfile->file_type == PLY_ASCII)
-    ascii_get_element (plyfile, (char *) elem_ptr);
-  else
-    binary_get_element (plyfile, (char *) elem_ptr);
-}
-
-
-/******************************************************************************
-Extract the comments from the header information of a PLY file.
-
-Entry:
-  plyfile - file identifier
-
-Exit:
-  num_comments - number of comments returned
-  returns a pointer to a list of comments
-******************************************************************************/
-
-char **ply_get_comments(PlyFile *plyfile, int *num_comments)
-{
-  *num_comments = plyfile->num_comments;
-  return (plyfile->comments);
-}
-
-
-/******************************************************************************
-Extract the object information (arbitrary text) from the header information
-of a PLY file.
-
-Entry:
-  plyfile - file identifier
-
-Exit:
-  num_obj_info - number of lines of text information returned
-  returns a pointer to a list of object info lines
-******************************************************************************/
-
-char **ply_get_obj_info(PlyFile *plyfile, int *num_obj_info)
-{
-  *num_obj_info = plyfile->num_obj_info;
-  return (plyfile->obj_info);
-}
-
-
-/******************************************************************************
-Make ready for "other" properties of an element-- those properties that
-the user has not explicitly asked for, but that are to be stashed away
-in a special structure to be carried along with the element's other
-information.
-
-Entry:
-  plyfile - file identifier
-  elem    - element for which we want to save away other properties
-******************************************************************************/
-
-void setup_other_props(PlyElement *elem)
-{
-  int i;
-  PlyProperty *prop;
-  int size = 0;
-  int type_size;
-
-  /* Examine each property in decreasing order of size. */
-  /* We do this so that all data types will be aligned by */
-  /* word, half-word, or whatever within the structure. */
-
-  for (type_size = 8; type_size > 0; type_size /= 2) {
-
-    /* add up the space taken by each property, and save this information */
-    /* away in the property descriptor */
-
-    for (i = 0; i < elem->nprops; i++) {
-
-      /* don't bother with properties we've been asked to store explicitly */
-      if (elem->store_prop[i])
-        continue;
-
-      prop = elem->props[i];
-
-      /* internal types will be same as external */
-      prop->internal_type = prop->external_type;
-      prop->count_internal = prop->count_external;
-
-      /* check list case */
-      if (prop->is_list) {
-
-        /* pointer to list */
-        if (type_size == sizeof (void *)) {
-          prop->offset = size;
-          size += sizeof (void *);    /* always use size of a pointer here */
-        }
-
-        /* count of number of list elements */
-        if (type_size == ply_type_size[prop->count_external]) {
-          prop->count_offset = size;
-          size += ply_type_size[prop->count_external];
-        }
-      }
-      /* not list */
-      else if (type_size == ply_type_size[prop->external_type]) {
-        prop->offset = size;
-        size += ply_type_size[prop->external_type];
-      }
-    }
-
-  }
-
-  /* save the size for the other_props structure */
-  elem->other_size = size;
-}
-
-
-/******************************************************************************
-Specify that we want the "other" properties of an element to be tucked
-away within the user's structure.  The user needn't be concerned for how
-these properties are stored.
-
-Entry:
-  plyfile   - file identifier
-  elem_name - name of element that we want to store other_props in
-  offset    - offset to where other_props will be stored inside user's structure
-
-Exit:
-  returns pointer to structure containing description of other_props
-******************************************************************************/
-
-PlyOtherProp *ply_get_other_properties(
-  PlyFile *plyfile,
-  char *elem_name,
-  int offset
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyOtherProp *other;
-  PlyProperty *prop;
-  int nprops;
-
-  /* find information about the element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf (stderr, "ply_get_other_properties: Can't find element '%s'\n",
-             elem_name);
-    return (NULL);
-  }
-
-  /* remember that this is the "current" element */
-  plyfile->which_elem = elem;
-
-  /* save the offset to where to store the other_props */
-  elem->other_offset = offset;
-
-  /* place the appropriate pointers, etc. in the element's property list */
-  setup_other_props (elem);
-
-  /* create structure for describing other_props */
-  other = (PlyOtherProp *) myalloc (sizeof (PlyOtherProp));
-  other->name = strdup (elem_name);
-#if 0
-  if (elem->other_offset == NO_OTHER_PROPS) {
-    other->size = 0;
-    other->props = NULL;
-    other->nprops = 0;
-    return (other);
-  }
-#endif
-  other->size = elem->other_size;
-  other->props = (PlyProperty **) myalloc (sizeof(PlyProperty) * elem->nprops);
-  
-  /* save descriptions of each "other" property */
-  nprops = 0;
-  for (i = 0; i < elem->nprops; i++) {
-    if (elem->store_prop[i])
-      continue;
-    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-    copy_property (prop, elem->props[i]);
-    other->props[nprops] = prop;
-    nprops++;
-  }
-  other->nprops = nprops;
-
-#if 1
-  /* set other_offset pointer appropriately if there are NO other properties */
-  if (other->nprops == 0) {
-    elem->other_offset = NO_OTHER_PROPS;
-  }
-#endif
-  
-  /* return structure */
-  return (other);
-}
-
-
-
-
-/*************************/
-/*  Other Element Stuff  */
-/*************************/
-
-
-
-
-/******************************************************************************
-Grab all the data for an element that a user does not want to explicitly
-read in.
-
-Entry:
-  plyfile    - pointer to file
-  elem_name  - name of element whose data is to be read in
-  elem_count - number of instances of this element stored in the file
-
-Exit:
-  returns pointer to ALL the "other" element data for this PLY file
-******************************************************************************/
-
-PlyOtherElems *ply_get_other_element (
-  PlyFile *plyfile,
-  char *elem_name,
-  int elem_count
-)
-{
-  int i;
-  PlyElement *elem;
-  PlyOtherElems *other_elems;
-  OtherElem *other;
-
-  /* look for appropriate element */
-  elem = find_element (plyfile, elem_name);
-  if (elem == NULL) {
-    fprintf (stderr,
-             "ply_get_other_element: can't find element '%s'\n", elem_name);
-    exit (-1);
-  }
-
-  /* create room for the new "other" element, initializing the */
-  /* other data structure if necessary */
-
-  if (plyfile->other_elems == NULL) {
-    plyfile->other_elems = (PlyOtherElems *) myalloc (sizeof (PlyOtherElems));
-    other_elems = plyfile->other_elems;
-    other_elems->other_list = (OtherElem *) myalloc (sizeof (OtherElem));
-    other = &(other_elems->other_list[0]);
-    other_elems->num_elems = 1;
-  }
-  else {
-    other_elems = plyfile->other_elems;
-    other_elems->other_list = (OtherElem *) realloc (other_elems->other_list,
-                              sizeof (OtherElem) * other_elems->num_elems + 1);
-    other = &(other_elems->other_list[other_elems->num_elems]);
-    other_elems->num_elems++;
-  }
-
-  /* count of element instances in file */
-  other->elem_count = elem_count;
-
-  /* save name of element */
-  other->elem_name = strdup (elem_name);
-
-  /* create a list to hold all the current elements */
-  other->other_data = (OtherData **)
-                  malloc (sizeof (OtherData *) * other->elem_count);
-
-  /* set up for getting elements */
-  other->other_props = ply_get_other_properties (plyfile, elem_name,
-                         offsetof(OtherData,other_props));
-
-  /* grab all these elements */
-  for (i = 0; i < other->elem_count; i++) {
-    /* grab and element from the file */
-    other->other_data[i] = (OtherData *) malloc (sizeof (OtherData));
-    ply_get_element (plyfile, (void *) other->other_data[i]);
-  }
-
-  /* return pointer to the other elements data */
-  return (other_elems);
-}
-
-
-/******************************************************************************
-Pass along a pointer to "other" elements that we want to save in a given
-PLY file.  These other elements were presumably read from another PLY file.
-
-Entry:
-  plyfile     - file pointer in which to store this other element info
-  other_elems - info about other elements that we want to store
-******************************************************************************/
-
-void ply_describe_other_elements (
-  PlyFile *plyfile,
-  PlyOtherElems *other_elems
-)
-{
-  int i;
-  OtherElem *other;
-
-  /* ignore this call if there is no other element */
-  if (other_elems == NULL)
-    return;
-
-  /* save pointer to this information */
-  plyfile->other_elems = other_elems;
-
-  /* describe the other properties of this element */
-
-  for (i = 0; i < other_elems->num_elems; i++) {
-    other = &(other_elems->other_list[i]);
-    ply_element_count (plyfile, other->elem_name, other->elem_count);
-    ply_describe_other_properties (plyfile, other->other_props,
-                                   offsetof(OtherData,other_props));
-  }
-}
-
-
-/******************************************************************************
-Write out the "other" elements specified for this PLY file.
-
-Entry:
-  plyfile - pointer to PLY file to write out other elements for
-******************************************************************************/
-
-void ply_put_other_elements (PlyFile *plyfile)
-{
-  int i,j;
-  OtherElem *other;
-
-  /* make sure we have other elements to write */
-  if (plyfile->other_elems == NULL)
-    return;
-
-  /* write out the data for each "other" element */
-
-  for (i = 0; i < plyfile->other_elems->num_elems; i++) {
-
-    other = &(plyfile->other_elems->other_list[i]);
-    ply_put_element_setup (plyfile, other->elem_name);
-
-    /* write out each instance of the current element */
-    for (j = 0; j < other->elem_count; j++)
-      ply_put_element (plyfile, (void *) other->other_data[j]);
-  }
-}
-
-
-/******************************************************************************
-Free up storage used by an "other" elements data structure.
-
-Entry:
-  other_elems - data structure to free up
-******************************************************************************/
-
-
-
-
-/*******************/
-/*  Miscellaneous  */
-/*******************/
-
-
-
-/******************************************************************************
-Close a PLY file.
-
-Entry:
-  plyfile - identifier of file to close
-******************************************************************************/
-
-void ply_close(PlyFile *plyfile)
-{
-  fclose (plyfile->fp);
-
-  /* free up memory associated with the PLY file */
-  free (plyfile);
-}
-
-
-/******************************************************************************
-Get version number and file type of a PlyFile.
-
-Entry:
-  ply - pointer to PLY file
-
-Exit:
-  version - version of the file
-  file_type - PLY_ASCII, PLY_BINARY_BE, or PLY_BINARY_LE
-******************************************************************************/
-
-void ply_get_info(PlyFile *ply, float *version, int *file_type)
-{
-  if (ply == NULL)
-    return;
-
-  *version = ply->version;
-  *file_type = ply->file_type;
-}
-
-
-/******************************************************************************
-Compare two strings.  Returns 1 if they are the same, 0 if not.
-******************************************************************************/
-
-int equal_strings(char *s1, char *s2)
-{
-
-  while (*s1 && *s2)
-    if (*s1++ != *s2++)
-      return (0);
-
-  if (*s1 != *s2)
-    return (0);
-  else
-    return (1);
-}
-
-
-/******************************************************************************
-Find an element from the element list of a given PLY object.
-
-Entry:
-  plyfile - file id for PLY file
-  element - name of element we're looking for
-
-Exit:
-  returns the element, or NULL if not found
-******************************************************************************/
-
-PlyElement *find_element(PlyFile *plyfile, char *element)
-{
-  int i;
-
-  for (i = 0; i < plyfile->nelems; i++)
-    if (equal_strings (element, plyfile->elems[i]->name))
-      return (plyfile->elems[i]);
-
-  return (NULL);
-}
-
-
-/******************************************************************************
-Find a property in the list of properties of a given element.
-
-Entry:
-  elem      - pointer to element in which we want to find the property
-  prop_name - name of property to find
-
-Exit:
-  index - index to position in list
-  returns a pointer to the property, or NULL if not found
-******************************************************************************/
-
-PlyProperty *find_property(PlyElement *elem, char *prop_name, int *index)
-{
-  int i;
-
-  for (i = 0; i < elem->nprops; i++)
-    if (equal_strings (prop_name, elem->props[i]->name)) {
-      *index = i;
-      return (elem->props[i]);
-    }
-
-  *index = -1;
-  return (NULL);
-}
-
-
-/******************************************************************************
-Read an element from an ascii file.
-
-Entry:
-  plyfile  - file identifier
-  elem_ptr - pointer to element
-******************************************************************************/
-
-void ascii_get_element(PlyFile *plyfile, char *elem_ptr)
-{
-  int j,k;
-  PlyElement *elem;
-  PlyProperty *prop;
-  char **words;
-  int nwords;
-  int which_word;
-  char *elem_data,*item;
-  char *item_ptr;
-  int item_size;
-  int int_val;
-  unsigned int uint_val;
-  double double_val;
-  int list_count;
-  int store_it;
-  char **store_array;
-  char *orig_line;
-  char *other_data;
-  int other_flag;
-
-    other_flag = 0;
-	other_data = NULL;
-	item = NULL;
-	item_size = 0;
-
-  /* the kind of element we're reading currently */
-  elem = plyfile->which_elem;
-
-  /* do we need to setup for other_props? */
-
-  if (elem->other_offset != NO_OTHER_PROPS) {
-    char **ptr;
-    other_flag = 1;
-    /* make room for other_props */
-    other_data = (char *) myalloc (elem->other_size);
-    /* store pointer in user's structure to the other_props */
-    ptr = (char **) (elem_ptr + elem->other_offset);
-    *ptr = other_data;
-  } else {
-    other_flag = 0;
-	other_data = NULL;
-	item = NULL;
-	item_size = 0;
-  }
-
-  /* read in the element */
-
-  words = get_words (plyfile->fp, &nwords, &orig_line);
-  if (words == NULL) {
-    fprintf (stderr, "ply_get_element: unexpected end of file\n");
-    exit (-1);
-  }
-
-  which_word = 0;
-
-  for (j = 0; j < elem->nprops; j++) {
-
-    prop = elem->props[j];
-    store_it = (elem->store_prop[j] | other_flag);
-
-    /* store either in the user's structure or in other_props */
-    if (elem->store_prop[j])
-      elem_data = elem_ptr;
-    else
-      elem_data = other_data;
-
-    if (prop->is_list) {       /* a list */
-
-      /* get and store the number of items in the list */
-      get_ascii_item (words[which_word++], prop->count_external,
-                      &int_val, &uint_val, &double_val);
-      if (store_it) {
-        item = elem_data + prop->count_offset;
-        store_item(item, prop->count_internal, int_val, uint_val, double_val);
-      }
-
-      /* allocate space for an array of items and store a ptr to the array */
-      list_count = int_val;
-      item_size = ply_type_size[prop->internal_type];
-      store_array = (char **) (elem_data + prop->offset);
-
-      if (list_count == 0) {
-        if (store_it)
-          *store_array = NULL;
-      }
-      else {
-        if (store_it) {
-          item_ptr = (char *) myalloc (sizeof (char) * item_size * list_count);
-          item = item_ptr;
-          *store_array = item_ptr;
-        }
-
-        /* read items and store them into the array */
-        for (k = 0; k < list_count; k++) {
-          get_ascii_item (words[which_word++], prop->external_type,
-                          &int_val, &uint_val, &double_val);
-          if (store_it) {
-            store_item (item, prop->internal_type,
-                        int_val, uint_val, double_val);
-            item += item_size;
-          }
-        }
-      }
-
-    }
-    else {                     /* not a list */
-      get_ascii_item (words[which_word++], prop->external_type,
-                      &int_val, &uint_val, &double_val);
-      if (store_it) {
-        item = elem_data + prop->offset;
-        store_item (item, prop->internal_type, int_val, uint_val, double_val);
-      }
-    }
-
-  }
-
-  free (words);
-}
-
-
-/******************************************************************************
-Read an element from a binary file.
-
-Entry:
-  plyfile  - file identifier
-  elem_ptr - pointer to an element
-******************************************************************************/
-
-void binary_get_element(PlyFile *plyfile, char *elem_ptr)
-{
-  int j,k;
-  PlyElement *elem;
-  PlyProperty *prop;
-  FILE *fp = plyfile->fp;
-  char *elem_data,*item;
-  char *item_ptr;
-  int item_size;
-  int int_val;
-  unsigned int uint_val;
-  double double_val;
-  int list_count;
-  int store_it;
-  char **store_array;
-  char *other_data;
-  int other_flag;
-
-
-  other_flag = 0;
-  other_data = NULL;
-  item = NULL;
-  item_size = 0;
-
-  /* the kind of element we're reading currently */
-  elem = plyfile->which_elem;
-
-  /* do we need to setup for other_props? */
-
-  if (elem->other_offset != NO_OTHER_PROPS) {
-    char **ptr;
-    other_flag = 1;
-    /* make room for other_props */
-    other_data = (char *) myalloc (elem->other_size);
-    /* store pointer in user's structure to the other_props */
-    ptr = (char **) (elem_ptr + elem->other_offset);
-    *ptr = other_data;
-  }
-  else {
-    other_flag = 0;
-	other_data = NULL;
-	item = NULL;
-	item_size = 0;
-  }
-  /* read in a number of elements */
-
-  for (j = 0; j < elem->nprops; j++) {
-
-    prop = elem->props[j];
-    store_it = (elem->store_prop[j] | other_flag);
-
-    /* store either in the user's structure or in other_props */
-    if (elem->store_prop[j])
-      elem_data = elem_ptr;
-    else
-      elem_data = other_data;
-
-    if (prop->is_list) {       /* a list */
-
-      /* get and store the number of items in the list */
-      get_binary_item (fp, prop->count_external,
-                      &int_val, &uint_val, &double_val);
-      if (store_it) {
-        item = elem_data + prop->count_offset;
-        store_item(item, prop->count_internal, int_val, uint_val, double_val);
-      }
-
-      /* allocate space for an array of items and store a ptr to the array */
-      list_count = int_val;
-      /* The "if" was added by Afra Zomorodian 8/22/95
-       * so that zipper won't crash reading plies that have additional
-       * properties.
-       */ 
-      if (store_it) {
-	item_size = ply_type_size[prop->internal_type];
-      }
-      store_array = (char **) (elem_data + prop->offset);
-      if (list_count == 0) {
-        if (store_it)
-          *store_array = NULL;
-      }
-      else {
-        if (store_it) {
-          item_ptr = (char *) myalloc (sizeof (char) * item_size * list_count);
-          item = item_ptr;
-          *store_array = item_ptr;
-        }
-
-        /* read items and store them into the array */
-        for (k = 0; k < list_count; k++) {
-          get_binary_item (fp, prop->external_type,
-                          &int_val, &uint_val, &double_val);
-          if (store_it) {
-            store_item (item, prop->internal_type,
-                        int_val, uint_val, double_val);
-            item += item_size;
-          }
-        }
-      }
-
-    }
-    else {                     /* not a list */
-      get_binary_item (fp, prop->external_type,
-                      &int_val, &uint_val, &double_val);
-      if (store_it) {
-        item = elem_data + prop->offset;
-        store_item (item, prop->internal_type, int_val, uint_val, double_val);
-      }
-    }
-
-  }
-}
-
-
-/******************************************************************************
-Write to a file the word that represents a PLY data type.
-
-Entry:
-  fp   - file pointer
-  code - code for type
-******************************************************************************/
-
-void write_scalar_type (FILE *fp, int code)
-{
-  /* make sure this is a valid code */
-
-  if (code <= PLY_START_TYPE || code >= PLY_END_TYPE) {
-    fprintf (stderr, "write_scalar_type: bad data code = %d\n", code);
-    exit (-1);
-  }
-
-  /* write the code to a file */
-
-  fprintf (fp, "%s", type_names[code]);
-}
-
-
-/******************************************************************************
-Get a text line from a file and break it up into words.
-
-IMPORTANT: The calling routine call "free" on the returned pointer once
-finished with it.
-
-Entry:
-  fp - file to read from
-
-Exit:
-  nwords    - number of words returned
-  orig_line - the original line of characters
-  returns a list of words from the line, or NULL if end-of-file
-******************************************************************************/
-
-char **get_words(FILE *fp, int *nwords, char **orig_line)
-{
-#define BIG_STRING 4096
-  static char str[BIG_STRING];
-  static char str_copy[BIG_STRING];
-  char **words;
-  int max_words = 10;
-  int num_words = 0;
-  char *ptr,*ptr2;
-  char *result;
-
-  words = (char **) myalloc (sizeof (char *) * max_words);
-
-  /* read in a line */
-  result = fgets (str, BIG_STRING, fp);
-  if (result == NULL) {
-    *nwords = 0;
-    *orig_line = NULL;
-    return (NULL);
-  }
-
-  /* convert line-feed and tabs into spaces */
-  /* (this guarentees that there will be a space before the */
-  /*  null character at the end of the string) */
-
-  str[BIG_STRING-2] = ' ';
-  str[BIG_STRING-1] = '\0';
-
-  for (ptr = str, ptr2 = str_copy; *ptr != '\0'; ptr++, ptr2++) {
-    *ptr2 = *ptr;
-    if (*ptr == '\t') {
-      *ptr = ' ';
-      *ptr2 = ' ';
-    }
-    else if (*ptr == '\n') {
-      *ptr = ' ';
-      *ptr2 = '\0';
-      break;
-    }
-  }
-
-  /* find the words in the line */
-
-  ptr = str;
-  while (*ptr != '\0') {
-
-    /* jump over leading spaces */
-    while (*ptr == ' ')
-      ptr++;
-
-    /* break if we reach the end */
-    if (*ptr == '\0')
-      break;
-
-    /* save pointer to beginning of word */
-    if (num_words >= max_words) {
-      max_words += 10;
-      words = (char **) realloc (words, sizeof (char *) * max_words);
-    }
-    words[num_words++] = ptr;
-
-    /* jump over non-spaces */
-    while (*ptr != ' ')
-      ptr++;
-
-    /* place a null character here to mark the end of the word */
-    *ptr++ = '\0';
-  }
-
-  /* return the list of words */
-  *nwords = num_words;
-  *orig_line = str_copy;
-  return (words);
-}
-
-
-/******************************************************************************
-Return the value of an item, given a pointer to it and its type.
-
-Entry:
-  item - pointer to item
-  type - data type that "item" points to
-
-Exit:
-  returns a double-precision float that contains the value of the item
-******************************************************************************/
-
-double get_item_value(char *item, int type)
-{
-  unsigned char *puchar;
-  char *pchar;
-  short int *pshort;
-  unsigned short int *pushort;
-  int *pint;
-  unsigned int *puint;
-  float *pfloat;
-  double *pdouble;
-  int int_value;
-  unsigned int uint_value;
-  double double_value;
-
-  switch (type) {
-    case PLY_CHAR:
-      pchar = (char *) item;
-      int_value = *pchar;
-      return ((double) int_value);
-    case PLY_UCHAR:
-      puchar = (unsigned char *) item;
-      int_value = *puchar;
-      return ((double) int_value);
-    case PLY_SHORT:
-      pshort = (short int *) item;
-      int_value = *pshort;
-      return ((double) int_value);
-    case PLY_USHORT:
-      pushort = (unsigned short int *) item;
-      int_value = *pushort;
-      return ((double) int_value);
-    case PLY_INT:
-      pint = (int *) item;
-      int_value = *pint;
-      return ((double) int_value);
-    case PLY_UINT:
-      puint = (unsigned int *) item;
-      uint_value = *puint;
-      return ((double) uint_value);
-    case PLY_FLOAT:
-      pfloat = (float *) item;
-      double_value = *pfloat;
-      return (double_value);
-    case PLY_DOUBLE:
-      pdouble = (double *) item;
-      double_value = *pdouble;
-      return (double_value);
-    default:
-      fprintf (stderr, "get_item_value: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Write out an item to a file as raw binary bytes.
-
-Entry:
-  fp         - file to write to
-  int_val    - integer version of item
-  uint_val   - unsigned integer version of item
-  double_val - double-precision float version of item
-  type       - data type to write out
-******************************************************************************/
-
-void write_binary_item(
-  FILE *fp,
-  int int_val,
-  unsigned int uint_val,
-  double double_val,
-  int type
-)
-{
-  unsigned char uchar_val;
-  char char_val;
-  unsigned short ushort_val;
-  short short_val;
-  float float_val;
-
-  switch (type) {
-    case PLY_CHAR:
-      char_val = (char)int_val;
-      fwrite (&char_val, 1, 1, fp);
-      break;
-    case PLY_SHORT:
-      short_val = (short)int_val;
-      fwrite (&short_val, 2, 1, fp);
-      break;
-    case PLY_INT:
-      fwrite (&int_val, 4, 1, fp);
-      break;
-    case PLY_UCHAR:
-      uchar_val = (unsigned char) uint_val;
-      fwrite (&uchar_val, 1, 1, fp);
-      break;
-    case PLY_USHORT:
-      ushort_val = (unsigned short)uint_val;
-      fwrite (&ushort_val, 2, 1, fp);
-      break;
-    case PLY_UINT:
-      fwrite (&uint_val, 4, 1, fp);
-      break;
-    case PLY_FLOAT:
-      float_val = (float) double_val;
-      fwrite (&float_val, 4, 1, fp);
-      break;
-    case PLY_DOUBLE:
-      fwrite (&double_val, 8, 1, fp);
-      break;
-    default:
-      fprintf (stderr, "write_binary_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Write out an item to a file as ascii characters.
-
-Entry:
-  fp         - file to write to
-  int_val    - integer version of item
-  uint_val   - unsigned integer version of item
-  double_val - double-precision float version of item
-  type       - data type to write out
-******************************************************************************/
-
-void write_ascii_item(
-  FILE *fp,
-  int int_val,
-  unsigned int uint_val,
-  double double_val,
-  int type
-)
-{
-  switch (type) {
-    case PLY_CHAR:
-    case PLY_SHORT:
-    case PLY_INT:
-      fprintf (fp, "%d ", int_val);
-      break;
-    case PLY_UCHAR:
-    case PLY_USHORT:
-    case PLY_UINT:
-      fprintf (fp, "%u ", uint_val);
-      break;
-    case PLY_FLOAT:
-    case PLY_DOUBLE:
-      fprintf (fp, "%g ", double_val);
-      break;
-    default:
-      fprintf (stderr, "write_ascii_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Write out an item to a file as ascii characters.
-
-Entry:
-  fp   - file to write to
-  item - pointer to item to write
-  type - data type that "item" points to
-
-Exit:
-  returns a double-precision float that contains the value of the written item
-******************************************************************************/
-
-double old_write_ascii_item(FILE *fp, char *item, int type)
-{
-  unsigned char *puchar;
-  char *pchar;
-  short int *pshort;
-  unsigned short int *pushort;
-  int *pint;
-  unsigned int *puint;
-  float *pfloat;
-  double *pdouble;
-  int int_value;
-  unsigned int uint_value;
-  double double_value;
-
-  switch (type) {
-    case PLY_CHAR:
-      pchar = (char *) item;
-      int_value = *pchar;
-      fprintf (fp, "%d ", int_value);
-      return ((double) int_value);
-    case PLY_UCHAR:
-      puchar = (unsigned char *) item;
-      int_value = *puchar;
-      fprintf (fp, "%d ", int_value);
-      return ((double) int_value);
-    case PLY_SHORT:
-      pshort = (short int *) item;
-      int_value = *pshort;
-      fprintf (fp, "%d ", int_value);
-      return ((double) int_value);
-    case PLY_USHORT:
-      pushort = (unsigned short int *) item;
-      int_value = *pushort;
-      fprintf (fp, "%d ", int_value);
-      return ((double) int_value);
-    case PLY_INT:
-      pint = (int *) item;
-      int_value = *pint;
-      fprintf (fp, "%d ", int_value);
-      return ((double) int_value);
-    case PLY_UINT:
-      puint = (unsigned int *) item;
-      uint_value = *puint;
-      fprintf (fp, "%u ", uint_value);
-      return ((double) uint_value);
-    case PLY_FLOAT:
-      pfloat = (float *) item;
-      double_value = *pfloat;
-      fprintf (fp, "%g ", double_value);
-      return (double_value);
-    case PLY_DOUBLE:
-      pdouble = (double *) item;
-      double_value = *pdouble;
-      fprintf (fp, "%g ", double_value);
-      return (double_value);
-    default:
-      fprintf (stderr, "old_write_ascii_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Get the value of an item that is in memory, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-  ptr  - pointer to the item
-  type - data type supposedly in the item
-
-Exit:
-  int_val    - integer value
-  uint_val   - unsigned integer value
-  double_val - double-precision floating point value
-******************************************************************************/
-
-void get_stored_item(
-  void *ptr,
-  int type,
-  int *int_val,
-  unsigned int *uint_val,
-  double *double_val
-)
-{
-  switch (type) {
-    case PLY_CHAR:
-      *int_val = *((char *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_UCHAR:
-      *uint_val = *((unsigned char *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_SHORT:
-      *int_val = *((short int *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_USHORT:
-      *uint_val = *((unsigned short int *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_INT:
-      *int_val = *((int *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_UINT:
-      *uint_val = *((unsigned int *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_FLOAT:
-      *double_val = *((float *) ptr);
-      *int_val = (int)*double_val;
-      *uint_val = (unsigned int)*double_val;
-      break;
-    case PLY_DOUBLE:
-      *double_val = *((double *) ptr);
-      *int_val = (int)*double_val;
-      *uint_val =(unsigned int) *double_val;
-      break;
-    default:
-      fprintf (stderr, "get_stored_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Get the value of an item from a binary file, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-  fp   - file to get item from
-  type - data type supposedly in the word
-
-Exit:
-  int_val    - integer value
-  uint_val   - unsigned integer value
-  double_val - double-precision floating point value
-******************************************************************************/
-
-void get_binary_item(
-  FILE *fp,
-  int type,
-  int *int_val,
-  unsigned int *uint_val,
-  double *double_val
-)
-{
-  char c[8];
-  void *ptr;
-
-  ptr = (void *) c;
-
-  switch (type) {
-    case PLY_CHAR:
-      fread (ptr, 1, 1, fp);
-      *int_val = *((char *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_UCHAR:
-      fread (ptr, 1, 1, fp);
-      *uint_val = *((unsigned char *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_SHORT:
-      fread (ptr, 2, 1, fp);
-      *int_val = *((short int *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_USHORT:
-      fread (ptr, 2, 1, fp);
-      *uint_val = *((unsigned short int *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_INT:
-      fread (ptr, 4, 1, fp);
-      *int_val = *((int *) ptr);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case PLY_UINT:
-      fread (ptr, 4, 1, fp);
-      *uint_val = *((unsigned int *) ptr);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case PLY_FLOAT:
-      fread (ptr, 4, 1, fp);
-      *double_val = *((float *) ptr);
-      *int_val = (int)*double_val;
-      *uint_val =(unsigned int) *double_val;
-      break;
-    case PLY_DOUBLE:
-      fread (ptr, 8, 1, fp);
-      *double_val = *((double *) ptr);
-      *int_val = (int)*double_val;
-      *uint_val = (unsigned int)*double_val;
-      break;
-    default:
-      fprintf (stderr, "get_binary_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Extract the value of an item from an ascii word, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-  word - word to extract value from
-  type - data type supposedly in the word
-
-Exit:
-  int_val    - integer value
-  uint_val   - unsigned integer value
-  double_val - double-precision floating point value
-******************************************************************************/
-
-void get_ascii_item(
-  char *word,
-  int type,
-  int *int_val,
-  unsigned int *uint_val,
-  double *double_val
-)
-{
-  switch (type) {
-    case PLY_CHAR:
-    case PLY_UCHAR:
-    case PLY_SHORT:
-    case PLY_USHORT:
-    case PLY_INT:
-      *int_val = atoi (word);
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-
-    case PLY_UINT:
-      *uint_val = strtoul (word, (char **) NULL, 10);
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-
-    case PLY_FLOAT:
-    case PLY_DOUBLE:
-      *double_val = atof (word);
-      *int_val = (int) *double_val;
-      *uint_val = (unsigned int) *double_val;
-      break;
-
-    default:
-      fprintf (stderr, "get_ascii_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Store a value into a place being pointed to, guided by a data type.
-
-Entry:
-  item       - place to store value
-  type       - data type
-  int_val    - integer version of value
-  uint_val   - unsigned integer version of value
-  double_val - double version of value
-
-Exit:
-  item - pointer to stored value
-******************************************************************************/
-
-void store_item (
-  char *item,
-  int type,
-  int int_val,
-  unsigned int uint_val,
-  double double_val
-)
-{
-  unsigned char *puchar;
-  short int *pshort;
-  unsigned short int *pushort;
-  int *pint;
-  unsigned int *puint;
-  float *pfloat;
-  double *pdouble;
-
-  switch (type) {
-    case PLY_CHAR:
-      *item = (char) int_val;
-      break;
-    case PLY_UCHAR:
-      puchar = (unsigned char *) item;
-      *puchar = (unsigned char)uint_val;
-      break;
-    case PLY_SHORT:
-      pshort = (short *) item;
-      *pshort = (short)int_val;
-      break;
-    case PLY_USHORT:
-      pushort = (unsigned short *) item;
-      *pushort = (unsigned short)uint_val;
-      break;
-    case PLY_INT:
-      pint = (int *) item;
-      *pint = int_val;
-      break;
-    case PLY_UINT:
-      puint = (unsigned int *) item;
-      *puint = uint_val;
-      break;
-    case PLY_FLOAT:
-      pfloat = (float *) item;
-      *pfloat = (float)double_val;
-      break;
-    case PLY_DOUBLE:
-      pdouble = (double *) item;
-      *pdouble = double_val;
-      break;
-    default:
-      fprintf (stderr, "store_item: bad type = %d\n", type);
-      exit (-1);
-  }
-}
-
-
-/******************************************************************************
-Add an element to a PLY file descriptor.
-
-Entry:
-  plyfile - PLY file descriptor
-  words   - list of words describing the element
-  nwords  - number of words in the list
-******************************************************************************/
-
-void add_element (PlyFile *plyfile, char **words)
-{
-  PlyElement *elem;
-
-  /* create the new element */
-  elem = (PlyElement *) myalloc (sizeof (PlyElement));
-  elem->name = strdup (words[1]);
-  elem->num = atoi (words[2]);
-  elem->nprops = 0;
-
-  /* make room for new element in the object's list of elements */
-  if (plyfile->nelems == 0)
-    plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *));
-  else
-    plyfile->elems = (PlyElement **) realloc (plyfile->elems,
-                     sizeof (PlyElement *) * (plyfile->nelems + 1));
-
-  /* add the new element to the object's list */
-  plyfile->elems[plyfile->nelems] = elem;
-  plyfile->nelems++;
-}
-
-
-/******************************************************************************
-Return the type of a property, given the name of the property.
-
-Entry:
-  name - name of property type
-
-Exit:
-  returns integer code for property, or 0 if not found
-******************************************************************************/
-
-int get_prop_type(char *type_name)
-{
-  int i;
-
-  for (i = PLY_START_TYPE + 1; i < PLY_END_TYPE; i++)
-    if (equal_strings (type_name, type_names[i]))
-      return (i);
-
-  /* if we get here, we didn't find the type */
-  return (0);
-}
-
-
-/******************************************************************************
-Add a property to a PLY file descriptor.
-
-Entry:
-  plyfile - PLY file descriptor
-  words   - list of words describing the property
-  nwords  - number of words in the list
-******************************************************************************/
-
-void add_property (PlyFile *plyfile, char **words)
-{
-  PlyProperty *prop;
-  PlyElement *elem;
-
-  /* create the new property */
-
-  prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
-
-  if (equal_strings (words[1], "list")) {       /* is a list */
-    prop->count_external = get_prop_type (words[2]);
-    prop->external_type = get_prop_type (words[3]);
-    prop->name = strdup (words[4]);
-    prop->is_list = 1;
-  }
-  else {                                        /* not a list */
-    prop->external_type = get_prop_type (words[1]);
-    prop->name = strdup (words[2]);
-    prop->is_list = 0;
-  }
-
-  /* add this property to the list of properties of the current element */
-
-  elem = plyfile->elems[plyfile->nelems - 1];
-
-  if (elem->nprops == 0)
-    elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *));
-  else
-    elem->props = (PlyProperty **) realloc (elem->props,
-                  sizeof (PlyProperty *) * (elem->nprops + 1));
-
-  elem->props[elem->nprops] = prop;
-  elem->nprops++;
-}
-
-
-/******************************************************************************
-Add a comment to a PLY file descriptor.
-
-Entry:
-  plyfile - PLY file descriptor
-  line    - line containing comment
-******************************************************************************/
-
-void add_comment (PlyFile *plyfile, char *line)
-{
-  int i;
-
-  /* skip over "comment" and leading spaces and tabs */
-  i = 7;
-  while (line[i] == ' ' || line[i] == '\t')
-    i++;
-
-  ply_put_comment (plyfile, &line[i]);
-}
-
-
-/******************************************************************************
-Add a some object information to a PLY file descriptor.
-
-Entry:
-  plyfile - PLY file descriptor
-  line    - line containing text info
-******************************************************************************/
-
-void add_obj_info (PlyFile *plyfile, char *line)
-{
-  int i;
-
-  /* skip over "obj_info" and leading spaces and tabs */
-  i = 8;
-  while (line[i] == ' ' || line[i] == '\t')
-    i++;
-
-  ply_put_obj_info (plyfile, &line[i]);
-}
-
-
-/******************************************************************************
-Copy a property.
-******************************************************************************/
-
-void copy_property(PlyProperty *dest, PlyProperty *src)
-{
-  dest->name = strdup (src->name);
-  dest->external_type = src->external_type;
-  dest->internal_type = src->internal_type;
-  dest->offset = src->offset;
-
-  dest->is_list = src->is_list;
-  dest->count_external = src->count_external;
-  dest->count_internal = src->count_internal;
-  dest->count_offset = src->count_offset;
-}
-
-
-/******************************************************************************
-Allocate some memory.
-
-Entry:
-  size  - amount of memory requested (in bytes)
-  lnum  - line number from which memory was requested
-  fname - file name from which memory was requested
-******************************************************************************/
-
-static char *my_alloc(int size, int lnum, char *fname)
-{
-  char *ptr;
-
-  ptr = (char *) malloc (size);
-
-  if (ptr == 0) {
-    fprintf(stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname);
-  }
-
-  return (ptr);
-}
-
diff --git a/intern/dualcon/CMakeLists.txt b/intern/dualcon/CMakeLists.txt
index caa1ea0..da5e10f 100644
--- a/intern/dualcon/CMakeLists.txt
+++ b/intern/dualcon/CMakeLists.txt
@@ -19,6 +19,9 @@
 set(INC
 	.
 	intern
+)
+
+set(INC_SYS
 	../../extern/Eigen3
 )
 
@@ -42,5 +45,5 @@ set(SRC
 	dualcon.h
 )
 
-blender_add_lib(bf_intern_dualcon "${SRC}" "${INC}" "")
+blender_add_lib(bf_intern_dualcon "${SRC}" "${INC}" "${INC_SYS}")
 
diff --git a/intern/elbeem/intern/ntl_geometryobject.cpp b/intern/elbeem/intern/ntl_geometryobject.cpp
index 4f64025..1e08cb9 100644
--- a/intern/elbeem/intern/ntl_geometryobject.cpp
+++ b/intern/elbeem/intern/ntl_geometryobject.cpp
@@ -787,7 +787,7 @@ ntlVec3Gfx ntlGeometryObject::getTranslation(double t) {
 }
 /*! get active flag time t*/
 float ntlGeometryObject::getGeoActive(double t) {
-	float act = mcGeoActive.get(t); // if <= 0.0 -> off
+	float act = (mcGeoActive.get(t) >= 1.) ? 1.0 : 0.0; 
 	return act;
 }
 
diff --git a/intern/elbeem/intern/ntl_geometryshader.h b/intern/elbeem/intern/ntl_geometryshader.h
index 6159855..f43df65 100644
--- a/intern/elbeem/intern/ntl_geometryshader.h
+++ b/intern/elbeem/intern/ntl_geometryshader.h
@@ -46,7 +46,7 @@ class ntlGeometryShader :
 		/*! notify object that dump is in progress (e.g. for field dump) */
 		virtual void notifyShaderOfDump(int dumptype, int frameNr,char *frameNrStr,string outfilename) = 0;
 
-		/*! get ouput filename, returns global render outfile if empty */
+		/*! get output filename, returns global render outfile if empty */
 		string getOutFilename( void ) { return mOutFilename; }
 
 	protected:
diff --git a/intern/elbeem/intern/ntl_world.cpp b/intern/elbeem/intern/ntl_world.cpp
index 0b36f72..dcc81db 100644
--- a/intern/elbeem/intern/ntl_world.cpp
+++ b/intern/elbeem/intern/ntl_world.cpp
@@ -143,6 +143,7 @@ void ntlWorld::initDefaults()
 	mFirstSim = 1;
 	mSingleStepDebug =  false;
 	mFrameCnt = 0;
+	mSimFrameCnt = 0;
 	mpOpenGLRenderer = NULL;
 
   /* create scene storage */
@@ -406,7 +407,6 @@ int ntlWorld::advanceSims(int framenum)
 	}
 
 	for(size_t i=0;i<mpSims->size();i++) { (*mpSims)[i]->setFrameNum(framenum); }
-	double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
 
 	// time stopped? nothing else to do...
 	if( (*mpSims)[mFirstSim]->getFrameTime(framenum) <= 0.0 ){ 
@@ -416,6 +416,13 @@ int ntlWorld::advanceSims(int framenum)
 		(*mpSims)[mFirstSim]->checkCallerStatus(FLUIDSIM_CBSTATUS_STEP, 0);
 	}
 
+	// Prevent bug [#29186] Object contribute to fluid sim animation start earlier than keyframe
+	// Was: double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); - DG
+	double totalTime = 0.0, targetTime = 0.0;
+	for(size_t i = 0; i < mSimFrameCnt; i++)
+		totalTime += (*mpSims)[mFirstSim]->getFrameTime(framenum);
+	targetTime = totalTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
+
 	int gstate = 0;
 	myTime_t advsstart = getTime();
 
@@ -461,6 +468,8 @@ int ntlWorld::advanceSims(int framenum)
 		sim->prepareVisualization();
 	}
 
+	mSimFrameCnt++;
+
 	return 0;
 }
 
diff --git a/intern/elbeem/intern/ntl_world.h b/intern/elbeem/intern/ntl_world.h
index 3c59584..c207904 100644
--- a/intern/elbeem/intern/ntl_world.h
+++ b/intern/elbeem/intern/ntl_world.h
@@ -115,6 +115,9 @@ class ntlWorld
 
 		/*! count no. of frame for viz render */
 		int mFrameCnt;
+
+		/*! count no. of frame for correct sim time */
+		int mSimFrameCnt;
 };
 
 
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 2fd6157..37cde2c 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -110,7 +110,7 @@ void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
 #endif
 
 /* there are some version inbetween, which have avio_... functions but no
-   AVIO_FLAG_... */
+ * AVIO_FLAG_... */
 #ifndef AVIO_FLAG_WRITE
 #define AVIO_FLAG_WRITE URL_WRONLY
 #endif
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index e52ac0a..ea09987 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -189,7 +189,6 @@ elseif(APPLE)
 		if(WITH_INPUT_NDOF)
 			list(APPEND SRC
 				intern/GHOST_NDOFManagerCocoa.mm
-
 				intern/GHOST_NDOFManagerCocoa.h
 			)
 		endif()
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 87ab3c0..f886dfd 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -120,7 +120,7 @@ extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
 /**
  * Removes a timer.
  * \param systemhandle The handle to the system
- * \param timerTask Timer task to be removed.
+ * \param timertaskhandle Timer task to be removed.
  * \return Indication of success.
  */
 extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
@@ -185,7 +185,7 @@ extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandl
 /**
  * Changes the window user data.
  * \param windowhandle The handle to the window
- * \param data The window user data.
+ * \param userdata The window user data.
  */
 extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, 
                                     GHOST_TUserDataPtr userdata);
@@ -212,6 +212,7 @@ extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
  * Begins full screen mode.
  * \param systemhandle The handle to the system
  * \param setting The new setting of the display.
+ * \param stereoVisual Option for stereo display.
  * \return A handle to the window displayed in full screen.
  *         This window is invalid after full screen has been ended.
  */
@@ -302,7 +303,7 @@ extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandl
 /**
  * Set the shape of the cursor.
  * \param windowhandle The handle to the window
- * \param cursor The new cursor shape type id.
+ * \param cursorshape The new cursor shape type id.
  * \return Indication of success.
  */
 extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
@@ -484,10 +485,10 @@ extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timer
 /**
  * Changes the time user data.
  * \param timertaskhandle The handle to the timertask
- * \param data The timer user data.
+ * \param userdata The timer user data.
  */
 extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
-                                       GHOST_TUserDataPtr userData);
+                                       GHOST_TUserDataPtr userdata);
 
 /**
  * Returns indication as to whether the window is valid.
@@ -825,7 +826,8 @@ extern GHOST_TUns8 *GHOST_getClipboard(int selection);
 
 /**
  * Put data to the Clipboard
- * \param set the selection instead, X11 only feature
+ * \param buffer the string buffer to set.
+ * \param selection Set the selection instead, X11 only feature.
  */
 extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
 
diff --git a/intern/ghost/GHOST_IEventConsumer.h b/intern/ghost/GHOST_IEventConsumer.h
index 5682d04..5b6fa7b 100644
--- a/intern/ghost/GHOST_IEventConsumer.h
+++ b/intern/ghost/GHOST_IEventConsumer.h
@@ -42,8 +42,8 @@
  * they want to receive events. The system will call the processEvent() method
  * for every installed event consumer to pass events.
  * \see GHOST_ISystem#addEventConsumer
- * \author	Maarten Gribnau
- * \date	May 14, 2001
+ * \author  Maarten Gribnau
+ * \date    May 14, 2001
  */
 class GHOST_IEventConsumer
 {
@@ -58,15 +58,14 @@ public:
 	/**
 	 * This method is called by the system when it has events to dispatch.
 	 * \see GHOST_ISystem#dispatchEvents
-	 * \param	event	The event that can be handled or ignored.
-	 * \return	Indication as to whether the event was handled.
+	 * \param   event   The event that can be handled or ignored.
+	 * \return  Indication as to whether the event was handled.
 	 */
 	virtual bool processEvent(GHOST_IEvent *event) = 0;
-	
+
 #ifdef WITH_CXX_GUARDEDALLOC
 	MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IEventConsumer")
 #endif
 };
 
-#endif // _GHOST_EVENT_CONSUMER_H_
-
+#endif  /* __GHOST_IEVENTCONSUMER_H__ */
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 8aef81b..ad5d237 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -47,14 +47,14 @@ class GHOST_IEventConsumer;
  * \section intro Introduction
  *
  * GHOST is yet another acronym. It stands for "Generic Handy Operating System
- * Toolkit". It has been created to replace the OpenGL utility tool kit  
+ * Toolkit". It has been created to replace the OpenGL utility tool kit
  * <a href="http://www.opengl.org/developers/documentation/glut.html">GLUT</a>.
  * GLUT was used in <a href="http://www.blender3d.com">Blender</a> until the
  * point that Blender needed to be ported to Apple's Mac OSX. Blender needed a
  * number of modifications in GLUT to work but the GLUT sources for OSX were
  * unavailable at the time. The decision was made to build our own replacement
- * for GLUT. In those days, NaN Technologies BV was the company that developed 
- * Blender. 
+ * for GLUT. In those days, NaN Technologies BV was the company that developed
+ * Blender.
  * <br><br>
  * Enough history. What does GHOST have to offer?<br>
  * In short: everything that Blender needed from GLUT to run on all it's supported
@@ -96,7 +96,7 @@ class GHOST_IEventConsumer;
  * <li>The C-API. For programs written in C.</li>
  * <li>The C++-API. For programs written in C++.</li>
  * </ul>
- * GHOST itself is writtem in C++ and the C-API is a wrapper around the C++ 
+ * GHOST itself is writtem in C++ and the C-API is a wrapper around the C++
  * API.
  *
  * \subsection cplusplus_api The C++ API consists of the following files:
@@ -113,7 +113,7 @@ class GHOST_IEventConsumer;
  * program in the ?/ghost/test/gears/ directory.
  *
  * \subsection c_api The C-API
- * To use GHOST in programs written in C, include the file GHOST_C-API.h in 
+ * To use GHOST in programs written in C, include the file GHOST_C-API.h in
  * your program. This file includes the GHOST_Types.h file for all GHOST types
  * and defines functions that give you access to the same functionality present
  * in the C++ API.<br>
@@ -123,7 +123,7 @@ class GHOST_IEventConsumer;
  * \section work Work in progress
  * \todo write WIP section
  */
- 
+
 /** \interface GHOST_ISystem
  * Interface for classes that provide access to the operating system.
  * There should be only one system class in an application.
@@ -136,8 +136,8 @@ class GHOST_IEventConsumer;
  *  -# Access to the state of the mouse buttons and the keyboard.
  *  -# Menus for windows with events generated when they are accessed (this is
  *     work in progress).
- * \author	Maarten Gribnau
- * \date	May 30, 2001
+ * \author  Maarten Gribnau
+ * \date    May 30, 2001
  */
 class GHOST_ISystem
 {
@@ -190,12 +190,12 @@ public:
 
 	/**
 	 * Installs a timer.
-	 * Note that, on most operating systems, messages need to be processed in order 
+	 * Note that, on most operating systems, messages need to be processed in order
 	 * for the timer callbacks to be invoked.
-	 * \param delay		The time to wait for the first call to the timerProc (in milliseconds)
-	 * \param interval	The interval between calls to the timerProc (in milliseconds)
-	 * \param timerProc	The callback invoked when the interval expires,
-	 * \param userData	Placeholder for user data.
+	 * \param delay     The time to wait for the first call to the timerProc (in milliseconds)
+	 * \param interval  The interval between calls to the timerProc (in milliseconds)
+	 * \param timerProc The callback invoked when the interval expires,
+	 * \param userData  Placeholder for user data.
 	 * \return A timer task (0 if timer task installation failed).
 	 */
 	virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
@@ -225,22 +225,22 @@ public:
 	 * \return The dimension of the main display.
 	 */
 	virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
-	
+
 	/**
 	 * Create a new window.
-	 * The new window is added to the list of windows managed. 
+	 * The new window is added to the list of windows managed.
 	 * Never explicitly delete the window, use disposeWindow() instead.
-	 * \param	title			The name of the window (displayed in the title bar of the window if the OS supports it).
-	 * \param	left			The coordinate of the left edge of the window.
-	 * \param	top				The coordinate of the top edge of the window.
-	 * \param	width			The width the window.
-	 * \param	height			The height the window.
-	 * \param	state			The state of the window when opened.
-	 * \param	type			The type of drawing context installed in this window.
-	 * \param	stereoVisual	Create a stereo visual for quad buffered stereo.
-	 * \param	numOfAASamples	Number of samples used for AA (zero if no AA)
-	 * \param	parentWindow    Parent (embedder) window
-	 * \return	The new window (or 0 if creation failed).
+	 * \param   title           The name of the window (displayed in the title bar of the window if the OS supports it).
+	 * \param   left            The coordinate of the left edge of the window.
+	 * \param   top             The coordinate of the top edge of the window.
+	 * \param   width           The width the window.
+	 * \param   height          The height the window.
+	 * \param   state           The state of the window when opened.
+	 * \param   type            The type of drawing context installed in this window.
+	 * \param   stereoVisual    Create a stereo visual for quad buffered stereo.
+	 * \param   numOfAASamples  Number of samples used for AA (zero if no AA)
+	 * \param   parentWindow    Parent (embedder) window
+	 * \return  The new window (or 0 if creation failed).
 	 */
 	virtual GHOST_IWindow *createWindow(
 	    const STR_String& title,
@@ -252,40 +252,40 @@ public:
 
 	/**
 	 * Dispose a window.
-	 * \param	window Pointer to the window to be disposed.
-	 * \return	Indication of success.
+	 * \param   window Pointer to the window to be disposed.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window) = 0;
 
 	/**
 	 * Returns whether a window is valid.
-	 * \param	window Pointer to the window to be checked.
-	 * \return	Indication of validity.
+	 * \param   window Pointer to the window to be checked.
+	 * \return  Indication of validity.
 	 */
 	virtual bool validWindow(GHOST_IWindow *window) = 0;
 
 	/**
 	 * Begins full screen mode.
-	 * \param setting	The new setting of the display.
-	 * \param window	Window displayed in full screen.
-	 *					This window is invalid after full screen has been ended.
-	 * \return	Indication of success.
+	 * \param setting   The new setting of the display.
+	 * \param window    Window displayed in full screen.
+	 *                  This window is invalid after full screen has been ended.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
 	                                       const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0;
-	
+
 	/**
 	 * Updates the resolution while in fullscreen mode.
-	 * \param setting	The new setting of the display.
-	 * \param window	Window displayed in full screen.
+	 * \param setting   The new setting of the display.
+	 * \param window    Window displayed in full screen.
 	 *
-	 * \return	Indication of success.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window) = 0;
 
 	/**
 	 * Ends full screen mode.
-	 * \return	Indication of success.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess endFullScreen(void) = 0;
 
@@ -305,7 +305,7 @@ public:
 	 * \return Indication of the presence of events.
 	 */
 	virtual bool processEvents(bool waitForEvent) = 0;
-	
+
 	/**
 	 * Retrieves events from the queue and send them to the event consumers.
 	 * \return Indication of the presence of events.
@@ -332,18 +332,18 @@ public:
 
 	/**
 	 * Returns the current location of the cursor (location in screen coordinates)
-	 * \param x			The x-coordinate of the cursor.
-	 * \param y			The y-coordinate of the cursor.
-	 * \return			Indication of success.
+	 * \param x         The x-coordinate of the cursor.
+	 * \param y         The y-coordinate of the cursor.
+	 * \return          Indication of success.
 	 */
 	virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
 
 	/**
 	 * Updates the location of the cursor (location in screen coordinates).
 	 * Not all operating systems allow the cursor to be moved (without the input device being moved).
-	 * \param x			The x-coordinate of the cursor.
-	 * \param y			The y-coordinate of the cursor.
-	 * \return			Indication of success.
+	 * \param x         The x-coordinate of the cursor.
+	 * \param y         The y-coordinate of the cursor.
+	 * \return          Indication of success.
 	 */
 	virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
 
@@ -353,17 +353,17 @@ public:
 
 	/**
 	 * Returns the state of a modifier key (ouside the message queue).
-	 * \param mask		The modifier key state to retrieve.
-	 * \param isDown	The state of a modifier key (true == pressed).
-	 * \return			Indication of success.
+	 * \param mask      The modifier key state to retrieve.
+	 * \param isDown    The state of a modifier key (true == pressed).
+	 * \return          Indication of success.
 	 */
 	virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const = 0;
 
 	/**
 	 * Returns the state of a mouse button (ouside the message queue).
-	 * \param mask		The button state to retrieve.
-	 * \param isDown	Button state.
-	 * \return			Indication of success.
+	 * \param mask      The button state to retrieve.
+	 * \param isDown    Button state.
+	 * \return          Indication of success.
 	 */
 	virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
 
@@ -378,11 +378,11 @@ public:
 	 * \return current status (1 -visible, 0 - hidden)
 	 */
 	virtual int toggleConsole(int action) = 0;
-	
+
 	/***************************************************************************************
 	 * Access to clipboard.
 	 ***************************************************************************************/
-	
+
 	/**
 	 * Returns the selection buffer
 	 * \return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 7ec6417..88f130a 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -41,20 +41,20 @@
 /**
  * Interface for GHOST windows.
  *
- * You can create a window with the system's GHOST_ISystem::createWindow 
+ * You can create a window with the system's GHOST_ISystem::createWindow
  * method.
  * \see GHOST_ISystem#createWindow
  *
  * There are two coordinate systems:
  * <ul>
  * <li>The screen coordinate system. The origin of the screen is located in the
- * upper left corner of the screen.</li> 
+ * upper left corner of the screen.</li>
  * <li>The client rectangle coordinate system. The client rectangle of a window
  * is the area that is drawable by the application (excluding title bars etc.).
- * </li> 
+ * </li>
  * </ul>
- * \author	Maarten Gribnau
- * \date	May 31, 2001
+ * \author  Maarten Gribnau
+ * \date    May 31, 2001
  */
 class GHOST_IWindow
 {
@@ -86,20 +86,20 @@ public:
 
 	/**
 	 * Tries to install a rendering context in this window.
-	 * \param type	The type of rendering context installed.
+	 * \param type  The type of rendering context installed.
 	 * \return Indication as to whether installation has succeeded.
 	 */
 	virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) = 0;
 
 	/**
 	 * Sets the title displayed in the title bar.
-	 * \param title	The title to display in the title bar.
+	 * \param title The title to display in the title bar.
 	 */
 	virtual void setTitle(const STR_String& title) = 0;
 
 	/**
 	 * Returns the title displayed in the title bar.
-	 * \param title	The title displayed in the title bar.
+	 * \param title The title displayed in the title bar.
 	 */
 	virtual void getTitle(STR_String& title) const = 0;
 
@@ -109,7 +109,7 @@ public:
 	 * \param bounds The bounding rectangle of the window.
 	 */
 	virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
-	
+
 	/**
 	 * Returns the client rectangle dimensions.
 	 * The left and top members of the rectangle are always zero.
@@ -131,26 +131,26 @@ public:
 
 	/**
 	 * Resizes client rectangle.
-	 * \param width		The new width of the client area of the window.
-	 * \param height	The new height of the client area of the window.
+	 * \param width     The new width of the client area of the window.
+	 * \param height    The new height of the client area of the window.
 	 */
 	virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
 
 	/**
 	 * Converts a point in screen coordinates to client rectangle coordinates
-	 * \param inX	The x-coordinate on the screen.
-	 * \param inY	The y-coordinate on the screen.
-	 * \param outX	The x-coordinate in the client rectangle.
-	 * \param outY	The y-coordinate in the client rectangle.
+	 * \param inX   The x-coordinate on the screen.
+	 * \param inY   The y-coordinate on the screen.
+	 * \param outX  The x-coordinate in the client rectangle.
+	 * \param outY  The y-coordinate in the client rectangle.
 	 */
 	virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
 
 	/**
 	 * Converts a point in screen coordinates to client rectangle coordinates
-	 * \param inX	The x-coordinate in the client rectangle.
-	 * \param inY	The y-coordinate in the client rectangle.
-	 * \param outX	The x-coordinate on the screen.
-	 * \param outY	The y-coordinate on the screen.
+	 * \param inX   The x-coordinate in the client rectangle.
+	 * \param inY   The y-coordinate in the client rectangle.
+	 * \param outX  The x-coordinate on the screen.
+	 * \param outY  The y-coordinate on the screen.
 	 */
 	virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
 
@@ -158,13 +158,13 @@ public:
 	 * Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
 	 */
 	virtual void setAcceptDragOperation(bool canAccept) = 0;
-	
+
 	/**
 	 * Returns acceptance of the dropped object
 	 * Usually called by the "object dropped" event handling function
 	 */
 	virtual bool canAcceptDragOperation() const = 0;
-	
+
 	/**
 	 * Returns the state of the window (normal, minimized, maximized).
 	 * \return The state of the window.
@@ -184,13 +184,13 @@ public:
 	 * \return Indication of success.
 	 */
 	virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges) = 0;
-	
+
 	/**
 	 * Gets the window "modified" status, indicating unsaved changes
 	 * \return True if there are unsaved changes
 	 */
 	virtual bool getModifiedState() = 0;
-	
+
 	/**
 	 * Sets the order of the window (bottom, top).
 	 * \param order The order of the window.
@@ -200,13 +200,13 @@ public:
 
 	/**
 	 * Swaps front and back buffers of a window.
-	 * \return	A boolean success indicator.
+	 * \return  A boolean success indicator.
 	 */
 	virtual GHOST_TSuccess swapBuffers() = 0;
 
 	/**
 	 * Activates the drawing context of this window.
-	 * \return	A boolean success indicator.
+	 * \return  A boolean success indicator.
 	 */
 	virtual GHOST_TSuccess activateDrawingContext() = 0;
 
@@ -215,71 +215,71 @@ public:
 	 * \return Indication of success.
 	 */
 	virtual GHOST_TSuccess invalidate() = 0;
-	
+
 	/**
 	 * Returns the window user data.
 	 * \return The window user data.
 	 */
 	virtual GHOST_TUserDataPtr getUserData() const = 0;
-	
+
 	/**
 	 * Changes the window user data.
 	 * \param data The window user data.
 	 */
 	virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
-	
+
 	/**
 	 * Returns the tablet data (pressure etc).
 	 * \return The tablet data (pressure etc).
 	 */
 	virtual const GHOST_TabletData *GetTabletData() = 0;
-	
+
 	/***************************************************************************************
 	 * Progress bar functionality
 	 ***************************************************************************************/
-	
+
 	/**
 	 * Sets the progress bar value displayed in the window/application icon
 	 * \param progress The progress %
 	 */
 	virtual GHOST_TSuccess setProgressBar(float progress) = 0;
-	
+
 	/**
 	 * Hides the progress bar in the icon
 	 */
 	virtual GHOST_TSuccess endProgressBar() = 0;
-	
+
 	/***************************************************************************************
 	 * Cursor management functionality
 	 ***************************************************************************************/
 
 	/**
 	 * Returns the current cursor shape.
-	 * \return	The current cursor shape.
+	 * \return  The current cursor shape.
 	 */
 	virtual GHOST_TStandardCursor getCursorShape() const = 0;
 
 	/**
 	 * Set the shape of the cursor.
-	 * \param	cursor	The new cursor shape type id.
-	 * \return	Indication of success.
+	 * \param   cursor  The new cursor shape type id.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
 
 	/**
 	 * Set the shape of the cursor to a custom cursor.
-	 * \param	bitmap	The bitmap data for the cursor.
-	 * \param	mask	The mask data for the cursor.
-	 * \param	hotX	The X coordinate of the cursor hotspot.
-	 * \param	hotY	The Y coordinate of the cursor hotspot.
-	 * \return	Indication of success.
+	 * \param   bitmap  The bitmap data for the cursor.
+	 * \param   mask    The mask data for the cursor.
+	 * \param   hotX    The X coordinate of the cursor hotspot.
+	 * \param   hotY    The Y coordinate of the cursor hotspot.
+	 * \return  Indication of success.
 	 */
-	virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2], 
+	virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
 	                                            GHOST_TUns8 mask[16][2],
 	                                            int hotX,
 	                                            int hotY) = 0;
 
-	virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, 
+	virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
 	                                            GHOST_TUns8 *mask,
 	                                            int sizex, int sizey,
 	                                            int hotX, int hotY,
@@ -287,21 +287,21 @@ public:
 
 	/**
 	 * Returns the visibility state of the cursor.
-	 * \return	The visibility state of the cursor.
+	 * \return  The visibility state of the cursor.
 	 */
 	virtual bool getCursorVisibility() const = 0;
 
 	/**
 	 * Shows or hides the cursor.
-	 * \param	visible The new visibility state of the cursor.
-	 * \return	Indication of success.
+	 * \param   visible The new visibility state of the cursor.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess setCursorVisibility(bool visible) = 0;
 
 	/**
 	 * Grabs the cursor for a modal operation.
-	 * \param	grab The new grab state of the cursor.
-	 * \return	Indication of success.
+	 * \param   grab The new grab state of the cursor.
+	 * \return  Indication of success.
 	 */
 	virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds, GHOST_TInt32 mouse_ungrab_xy[2]) { return GHOST_kSuccess; }
 
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index aa7969d..a055b6f 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -41,8 +41,8 @@
  * The four extreme coordinates are stored as left, top, right and bottom.
  * To be valid, a rectangle should have a left coordinate smaller than or equal to right.
  * To be valid, a rectangle should have a top coordinate smaller than or equal to bottom.
- * \author	Maarten Gribnau
- * \date	May 10, 2001
+ * \author  Maarten Gribnau
+ * \date    May 10, 2001
  */
 
 class GHOST_Rect {
@@ -50,10 +50,10 @@ public:
 
 	/**
 	 * Constructs a rectangle with the given values.
-	 * \param	l	requested left coordinate of the rectangle
-	 * \param	t	requested top coordinate of the rectangle
-	 * \param	r	requested right coordinate of the rectangle
-	 * \param	b	requested bottom coordinate of the rectangle
+	 * \param l requested left coordinate of the rectangle
+	 * \param t requested top coordinate of the rectangle
+	 * \param r requested right coordinate of the rectangle
+	 * \param b requested bottom coordinate of the rectangle
 	 */
 	GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
 		: m_l(l), m_t(t), m_r(r), m_b(b)
@@ -61,12 +61,12 @@ public:
 
 	/**
 	 * Copy constructor.
-	 * \param	r	rectangle to copy
+	 * \param   r   rectangle to copy
 	 */
 	GHOST_Rect(const GHOST_Rect& r)
 		: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b)
 	{}
-	
+
 	/**
 	 * Destructor.
 	 */
@@ -74,71 +74,71 @@ public:
 
 	/**
 	 * Access to rectangle width.
-	 * \return	width of the rectangle
+	 * \return  width of the rectangle
 	 */
 	virtual inline GHOST_TInt32 getWidth() const;
 
 	/**
 	 * Access to rectangle height.
-	 * \return	height of the rectangle
+	 * \return  height of the rectangle
 	 */
 	virtual inline GHOST_TInt32 getHeight() const;
 
 	/**
 	 * Sets all members of the rectangle.
-	 * \param	l	requested left coordinate of the rectangle
-	 * \param	t	requested top coordinate of the rectangle
-	 * \param	r	requested right coordinate of the rectangle
-	 * \param	b	requested bottom coordinate of the rectangle
+	 * \param   l   requested left coordinate of the rectangle
+	 * \param   t   requested top coordinate of the rectangle
+	 * \param   r   requested right coordinate of the rectangle
+	 * \param   b   requested bottom coordinate of the rectangle
 	 */
 	virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
 
 	/**
 	 * Returns whether this rectangle is empty.
 	 * Empty rectangles are rectangles that have width==0 and/or height==0.
-	 * \return	boolean value (true==empty rectangle)
+	 * \return  boolean value (true==empty rectangle)
 	 */
 	virtual inline bool isEmpty() const;
 
 	/**
 	 * Returns whether this rectangle is valid.
 	 * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.
-	 * \return	boolean value (true==valid rectangle)
+	 * \return  boolean value (true==valid rectangle)
 	 */
 	virtual inline bool isValid() const;
 
 	/**
 	 * Grows (or shrinks the rectangle).
 	 * The method avoids negative insets making the rectangle invalid
-	 * \param	i	The amount of offset given to each extreme (negative values shrink the rectangle).
+	 * \param   i   The amount of offset given to each extreme (negative values shrink the rectangle).
 	 */
 	virtual void inset(GHOST_TInt32 i);
 
 	/**
 	 * Does a union of the rectangle given and this rectangle.
 	 * The result is stored in this rectangle.
-	 * \param	r	The rectangle that is input for the union operation.
+	 * \param   r   The rectangle that is input for the union operation.
 	 */
 	virtual inline void unionRect(const GHOST_Rect& r);
 
 	/**
 	 * Grows the rectangle to included a point.
-	 * \param	x	The x-coordinate of the point.
-	 * \param	y	The y-coordinate of the point.
+	 * \param   x   The x-coordinate of the point.
+	 * \param   y   The y-coordinate of the point.
 	 */
 	virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
 
 	/**
 	 * Grows the rectangle to included a point.
-	 * \param	x	The x-coordinate of the point.
-	 * \param	y	The y-coordinate of the point.
+	 * \param   x   The x-coordinate of the point.
+	 * \param   y   The y-coordinate of the point.
 	 */
 	virtual inline void wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs);
 
 	/**
 	 * Returns whether the point is inside this rectangle.
 	 * Point on the boundary is considered inside.
-	 * \param x	x-coordinate of point to test.
+	 * \param x x-coordinate of point to test.
 	 * \param y y-coordinate of point to test.
 	 * \return boolean value (true if point is inside).
 	 */
@@ -146,16 +146,16 @@ public:
 
 	/**
 	 * Returns whether the rectangle is inside this rectangle.
-	 * \param	r	rectangle to test.
-	 * \return	visibility (not, partially or fully visible).
+	 * \param   r   rectangle to test.
+	 * \return  visibility (not, partially or fully visible).
 	 */
 	virtual GHOST_TVisibility getVisibility(GHOST_Rect& r) const;
 
 	/**
 	 * Sets rectangle members.
 	 * Sets rectangle members such that it is centered at the given location.
-	 * \param	cx	requested center x-coordinate of the rectangle
-	 * \param	cy	requested center y-coordinate of the rectangle
+	 * \param   cx  requested center x-coordinate of the rectangle
+	 * \param   cy  requested center y-coordinate of the rectangle
 	 */
 	virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
 
@@ -163,10 +163,10 @@ public:
 	 * Sets rectangle members.
 	 * Sets rectangle members such that it is centered at the given location,
 	 * with the width requested.
-	 * \param	cx	requested center x-coordinate of the rectangle
-	 * \param	cy	requested center y-coordinate of the rectangle
-	 * \param	w	requested width of the rectangle
-	 * \param	h	requested height of the rectangle
+	 * \param   cx  requested center x-coordinate of the rectangle
+	 * \param   cy  requested center y-coordinate of the rectangle
+	 * \param   w   requested width of the rectangle
+	 * \param   h   requested height of the rectangle
 	 */
 	virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
 
@@ -174,8 +174,8 @@ public:
 	 * Clips a rectangle.
 	 * Updates the rectangle given such that it will fit within this one.
 	 * This can result in an empty rectangle.
-	 * \param	r	the rectangle to clip
-	 * \return	whether clipping has occurred
+	 * \param   r   the rectangle to clip
+	 * \return  whether clipping has occurred
 	 */
 	virtual bool clip(GHOST_Rect& r) const;
 
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index c6d364c..868d787 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -50,7 +50,7 @@ typedef unsigned short GHOST_TUns16;
 typedef int GHOST_TInt32;
 typedef unsigned int GHOST_TUns32;
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
+#ifdef _MSC_VER
 typedef __int64 GHOST_TInt64;
 typedef unsigned __int64 GHOST_TUns64;
 #else
@@ -388,7 +388,7 @@ typedef struct {
 
 typedef struct {
 	/** Displacement of a mouse wheel. */
-	GHOST_TInt32 z;	
+	GHOST_TInt32 z;
 } GHOST_TEventWheelData;
 
 typedef enum {
diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h
index c364f1d..f0db1b3 100644
--- a/intern/ghost/intern/GHOST_Debug.h
+++ b/intern/ghost/intern/GHOST_Debug.h
@@ -33,12 +33,12 @@
 #ifndef __GHOST_DEBUG_H__
 #define __GHOST_DEBUG_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
+#ifdef _MSC_VER
 #  ifdef DEBUG
 #    pragma warning (disable:4786) // suppress stl-MSVC debug info warning
      // #define GHOST_DEBUG
 #  endif // DEBUG
-#endif // WIN32
+#endif // _MSC_VER
 
 #ifdef WITH_GHOST_DEBUG 
 #  define GHOST_DEBUG // spit ghost events to stdout
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
index c5a2fec..555f883 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
@@ -102,7 +102,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(GHOST_TUns8 d
 	
 	GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(): only main display is supported");
 
-	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];	
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
 	if (display == kMainDisplay) //Screen #0 may not be the main one
 		askedDisplay = [NSScreen mainScreen];
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index 0bd9085..7542181 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -88,8 +88,8 @@ getNumDisplaySettings(
 
 #else
 	/* We only have one X11 setting at the moment. */
-	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");	
-	numSettings = GHOST_TInt32(1);
+	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
+	numSettings = 1;
 #endif
 
 	return GHOST_kSuccess;
@@ -130,8 +130,8 @@ getDisplaySetting(
 	setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
 
 #else
-	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");	
-	GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");	
+	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
+	GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
 	
 	Display *x_display = m_system->getXDisplay();
 
@@ -160,7 +160,7 @@ getCurrentDisplaySetting(
 	/* According to the xf86vidmodegetallmodelines man page,
 	 * "The first element of the array corresponds to the current video mode."
 	 */
-	return getDisplaySetting(display, GHOST_TInt32(0), setting);
+	return getDisplaySetting(display, 0, setting);
 }
 
 
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index cef9bb0..c51f956 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -72,13 +72,13 @@ class GHOST_EventDragnDrop : public GHOST_Event
 public:
 	/**
 	 * Constructor.
-	 * \param time		The time this event was generated.
-	 * \param type		The type of this event.
-	 * \param dataType	The type of the drop candidate object
-	 * \param window	The window where the event occurred
-	 * \param x			The x-coordinate of the location the cursor was at at the time of the event.
-	 * \param y			The y-coordinate of the location the cursor was at at the time of the event.
-	 * \param data		The "content" dropped in the window
+	 * \param time      The time this event was generated.
+	 * \param type      The type of this event.
+	 * \param dataType  The type of the drop candidate object
+	 * \param window    The window where the event occurred
+	 * \param x         The x-coordinate of the location the cursor was at at the time of the event.
+	 * \param y         The y-coordinate of the location the cursor was at at the time of the event.
+	 * \param data      The "content" dropped in the window
 	 */
 	GHOST_EventDragnDrop(GHOST_TUns64 time,
 	                     GHOST_TEventType type,
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
index 49e7def..468a37d 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
@@ -90,8 +90,8 @@ bool GHOST_NDOFManagerX11::processEvents()
 				case SPNAV_EVENT_MOTION:
 				{
 					/* convert to blender view coords */
-					short t[3] = {e.motion.x, e.motion.y, -e.motion.z};
-					short r[3] = {-e.motion.rx, -e.motion.ry, e.motion.rz};
+					short t[3] = {(short)e.motion.x, (short)e.motion.y, (short)-e.motion.z};
+					short r[3] = {(short)-e.motion.rx, (short)-e.motion.ry, (short)e.motion.rz};
 
 					updateTranslation(t, now);
 					updateRotation(r, now);
diff --git a/intern/ghost/intern/GHOST_Rect.cpp b/intern/ghost/intern/GHOST_Rect.cpp
index dc30b3e..9af4f30 100644
--- a/intern/ghost/intern/GHOST_Rect.cpp
+++ b/intern/ghost/intern/GHOST_Rect.cpp
@@ -75,7 +75,7 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect& r) const
 	GHOST_TVisibility v;
 	if (lt && rt && lb && rb) {
 		// All points inside, rectangle is inside this
-		v = GHOST_kFullyVisible;		
+		v = GHOST_kFullyVisible;
 	}
 	else if (!(lt || rt || lb || rb)) {
 		// None of the points inside
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 070bf91..d2e3377 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -206,7 +206,7 @@ public:
 	 ***************************************************************************************/
 
 	/** Inherited from GHOST_ISystem but left pure virtual
-	 *	GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;	
+	 *	GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
 	 *  GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
 	 */
 
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index bb68ce8..f5784c7 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -126,7 +126,7 @@ static GHOST_TKey convertKey(int rawCode)
 	 */
 	static UInt32 dummy = 0;
 	Handle transData = (Handle) GetScriptManagerVariable(smKCHRCache);
-	unsigned char vk = KeyTranslate(transData, rawCode, &dummy);	
+	unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
 	/* Map numpad based on rawcodes first, otherwise they
 	 * look like non-numpad events.
 	 * Added too: mapping the number keys, for french keyboards etc (ton)
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 08f982f..9162b7c 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -282,9 +282,6 @@ protected:
 	/** Raised window is not yet known by the window manager, so delay application become active event handling */
 	bool m_needDelayedApplicationBecomeActiveEventProcessing;
 	
-	/** Mouse buttons state */
-	GHOST_TUns32 m_pressedMouseButtons;
-	
 	/** State of the modifiers. */
 	GHOST_TUns32 m_modifierMask;
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index fed3bdb..16edb4a 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -423,7 +423,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
 
 
 #pragma mark defines for 10.6 api not documented in 10.5
-#ifndef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
 enum {
 	/* The following event types are available on some hardware on 10.5.2 and later */
 	NSEventTypeGesture          = 29,
@@ -435,12 +435,10 @@ enum {
 };
 
 @interface NSEvent(GestureEvents)
-/* This message is valid for events of type NSEventTypeMagnify, on 10.5.2 or later */
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
 - (float)magnification;       // change in magnification.
 #else
-- (CGFloat)magnification;       // change in magnification.
-#endif
+ at interface NSEvent(GestureEvents)
+- (CGFloat)magnification;       // change in magnification on 10.5.2 or later.
 @end 
 
 #endif
@@ -553,7 +551,6 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
 	char *rstring = NULL;
 	
 	m_modifierMask =0;
-	m_pressedMouseButtons =0;
 	m_isGestureInProgress = false;
 	m_cursorDelta_x=0;
 	m_cursorDelta_y=0;
@@ -579,8 +576,10 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
 	sysctl( mib, 2, rstring, &len, NULL, 0 );
 	
 	//Hack on MacBook revision, as multitouch avail. function missing
+	//MacbookAir or MacBook version >= 5 (retina is MacBookPro10,1)
 	if (strstr(rstring,"MacBookAir") ||
-		(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')))
+		(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')) ||
+		(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-4]>='1') && (rstring[strlen(rstring)-4]<='9')))
 		m_hasMultiTouchTrackpad = true;
 	else m_hasMultiTouchTrackpad = false;
 	
@@ -850,12 +849,14 @@ GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) cons
 
 GHOST_TSuccess GHOST_SystemCocoa::getButtons(GHOST_Buttons& buttons) const
 {
+	UInt32 button_state = GetCurrentEventButtonState();
+
 	buttons.clear();
-	buttons.set(GHOST_kButtonMaskLeft, m_pressedMouseButtons & GHOST_kButtonMaskLeft);
-	buttons.set(GHOST_kButtonMaskRight, m_pressedMouseButtons & GHOST_kButtonMaskRight);
-	buttons.set(GHOST_kButtonMaskMiddle, m_pressedMouseButtons & GHOST_kButtonMaskMiddle);
-	buttons.set(GHOST_kButtonMaskButton4, m_pressedMouseButtons & GHOST_kButtonMaskButton4);
-	buttons.set(GHOST_kButtonMaskButton5, m_pressedMouseButtons & GHOST_kButtonMaskButton5);
+	buttons.set(GHOST_kButtonMaskLeft, button_state & (1 << 0));
+	buttons.set(GHOST_kButtonMaskRight, button_state & (1 << 1));
+	buttons.set(GHOST_kButtonMaskMiddle, button_state & (1 << 2));
+	buttons.set(GHOST_kButtonMaskButton4, button_state & (1 << 3));
+	buttons.set(GHOST_kButtonMaskButton5, button_state & (1 << 4));
 	return GHOST_kSuccess;
 }
 
@@ -966,7 +967,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
 			//Resend event to NSApp to ensure Mac wide events are handled
 			[NSApp sendEvent:event];
 			[pool drain];
-		} while (event!= nil);		
+		} while (event != nil);
 #if 0
 	} while (waitForEvent && !anyProcessed); // Needed only for timer implementation
 #endif
@@ -1000,16 +1001,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
 	modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags];
 	
 	if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
-		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
+		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift));
 	}
 	if ((modifiers & NSControlKeyMask) != (m_modifierMask & NSControlKeyMask)) {
-		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSControlKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
+		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSControlKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl));
 	}
 	if ((modifiers & NSAlternateKeyMask) != (m_modifierMask & NSAlternateKeyMask)) {
-		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
+		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt));
 	}
 	if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
-		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
+		pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS));
 	}
 	
 	m_modifierMask = modifiers;
@@ -1052,7 +1053,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
 			case GHOST_kEventWindowSize:
 				if (!m_ignoreWindowSizedMessages)
 				{
-					//Enforce only one resize message per event loop (coalescing all the live resize messages)					
+					//Enforce only one resize message per event loop (coalescing all the live resize messages)
 					window->updateDrawingContext();
 					pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
 					//Mouse up event is trapped by the resizing event loop, so send it anyway to the window manager
@@ -1089,7 +1090,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
 			GHOST_TUns8 * temp_buff;
 			GHOST_TStringArray *strArray;
 			NSArray *droppedArray;
-			size_t pastedTextSize;	
+			size_t pastedTextSize;
 			NSString *droppedStr;
 			GHOST_TEventDataPtr eventData;
 			int i;
@@ -1126,7 +1127,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
 						strArray->strings[i] = temp_buff;
 					}
 
-					eventData = (GHOST_TEventDataPtr) strArray;	
+					eventData = (GHOST_TEventDataPtr) strArray;
 					break;
 					
 				case GHOST_kDragnDropTypeString:
@@ -1159,7 +1160,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
 					NSEnumerator *enumerator;
 					NSImageRep *representation;
 					
-					ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect);
+					ibuf = IMB_allocImBuf (imgSize.width, imgSize.height, 32, IB_rect);
 					if (!ibuf) {
 						[droppedImg release];
 						return GHOST_kFailure;
@@ -1326,7 +1327,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
 	int confirmOpen = NSAlertAlternateReturn;
 	NSArray *windowsList;
 	char * temp_buff;
-	size_t filenameTextSize;	
+	size_t filenameTextSize;
 	GHOST_Window* window= (GHOST_Window*)m_windowManager->getActiveWindow();
 	
 	if (!window) {
@@ -1460,7 +1461,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 		case NSLeftMouseDown:
 		case NSRightMouseDown:
 		case NSOtherMouseDown:
-			pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
+			pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
 			//Handle tablet events combined with mouse events
 			handleTabletEvent(event);
 			break;
@@ -1468,14 +1469,14 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 		case NSLeftMouseUp:
 		case NSRightMouseUp:
 		case NSOtherMouseUp:
-			pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
+			pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
 			//Handle tablet events combined with mouse events
 			handleTabletEvent(event);
 			break;
 			
 		case NSLeftMouseDragged:
 		case NSRightMouseDragged:
-		case NSOtherMouseDragged:				
+		case NSOtherMouseDragged:
 			//Handle tablet events combined with mouse events
 			handleTabletEvent(event);
 			
@@ -1503,7 +1504,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 						window->setCursorGrabAccum(x_accum, y_accum);
 						
 						window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y);
-						pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+						pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
 					}
 						break;
 					case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
@@ -1548,7 +1549,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 						//Post event
 						window->getCursorGrabInitPos(x_cur, y_cur);
 						window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
-						pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+						pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
 					}
 						break;
 					default:
@@ -1558,7 +1559,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 						GHOST_TInt32 x, y;
 
 						window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
-						pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+						pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
 
 						m_cursorDelta_x=0;
 						m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
@@ -1580,7 +1581,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 					if (deltaF == 0.0) break; //discard trackpad delta=0 events
 					
 					delta = deltaF > 0.0 ? 1 : -1;
-					pushEvent(new GHOST_EventWheel([event timestamp]*1000, window, delta));
+					pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta));
 				}
 				else {
 					NSPoint mousePos = [event locationInWindow];
@@ -1593,18 +1594,22 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 					if ((dx == 0) && (dy == 0)) break;
 					
 					/* Quadratic acceleration */
-					dx = dx*(fabs(dx)+0.5);
-					if (dx<0.0) dx-=0.5; else dx+=0.5;
-					if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
+					dx = dx*(fabs(dx) + 0.5);
+					if (dx < 0.0) dx -= 0.5;
+					else          dx += 0.5;
+					if      (dx < -deltaMax) dx = -deltaMax;
+					else if (dx >  deltaMax) dx =  deltaMax;
 					
-					dy = dy*(fabs(dy)+0.5);
-					if (dy<0.0) dy-=0.5; else dy+=0.5;
-					if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
+					dy = dy*(fabs(dy) + 0.5);
+					if (dy < 0.0) dy -= 0.5;
+					else          dy += 0.5;
+					if      (dy < -deltaMax) dy= -deltaMax;
+					else if (dy >  deltaMax) dy=  deltaMax;
 
 					window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
 					dy = -dy;
 
-					pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
+					pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
 				}
 			}
 			break;
@@ -1614,8 +1619,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 				NSPoint mousePos = [event locationInWindow];
 				GHOST_TInt32 x, y;
 				window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
-				pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, x, y,
-												  [event magnification]*125.0 + 0.1, 0));
+				pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventMagnify, x, y,
+				                                  [event magnification] * 125.0 + 0.1, 0));
 			}
 			break;
 
@@ -1624,8 +1629,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
 				NSPoint mousePos = [event locationInWindow];
 				GHOST_TInt32 x, y;
 				window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
-				pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, x, y,
-												  -[event rotation] * 5.0, 0));
+				pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventRotate, x, y,
+				                                  -[event rotation] * 5.0, 0));
 			}
 		case NSEventTypeBeginGesture:
 			m_isGestureInProgress = true;
@@ -1700,11 +1705,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
 				break; //Cmd-Q is directly handled by Cocoa
 
 			if ([event type] == NSKeyDown) {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
+				pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
 				//printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
 			}
 			else {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') );
+				pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') );
 				//printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
 			}
 			break;
@@ -1713,16 +1718,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
 			modifiers = [event modifierFlags];
 			
 			if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
+				pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSShiftKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift));
 			}
 			if ((modifiers & NSControlKeyMask) != (m_modifierMask & NSControlKeyMask)) {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSControlKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
+				pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSControlKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl));
 			}
 			if ((modifiers & NSAlternateKeyMask) != (m_modifierMask & NSAlternateKeyMask)) {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
+				pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSAlternateKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt));
 			}
 			if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
-				pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
+				pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS));
 			}
 			
 			m_modifierMask = modifiers;
@@ -1743,7 +1748,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
 GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
 {
 	GHOST_TUns8 * temp_buff;
-	size_t pastedTextSize;	
+	size_t pastedTextSize;
 	
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 237d4c0..fdc4f33 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -73,7 +73,7 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
 {
 	GHOST_WindowSDL *window = NULL;
 
-	window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
+	window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, numOfAASamples);
 
 	if (window) {
 		if (GHOST_kWindowStateFullScreen == state) {
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 52ebaf0..46c71f5 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -742,8 +742,6 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
 			ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0];
 		}
 
-		if (0x80 & state[VK_MENU]) utf8_char[0] = '\0';
-
 		event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, key, ascii, utf8_char);
 		
 #ifdef GHOST_DEBUG
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 232bea6..2d3cc4f 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -256,7 +256,7 @@ createWindow(
 
 	window = new GHOST_WindowX11(this, m_display, title,
 	                             left, top, width, height,
-	                             state, parentWindow, type, stereoVisual);
+	                             state, parentWindow, type, stereoVisual, numOfAASamples);
 
 	if (window) {
 		/* Both are now handle in GHOST_WindowX11.cpp
@@ -858,7 +858,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
 		}
 		
 		case DestroyNotify:
-			::exit(-1);	
+			::exit(-1);
 		/* We're not interested in the following things.(yet...) */
 		case NoExpose:
 		case GraphicsExpose:
@@ -1171,7 +1171,7 @@ generateWindowExposeEvents()
 		    *w_start
 		    );
 
-		(*w_start)->validate();	
+		(*w_start)->validate();
 		
 		if (g_event) {
 			pushEvent(g_event);
@@ -1456,7 +1456,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
 			/* check size and format of the property */
 			XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
 			                   AnyPropertyType, &pty_type, &pty_format,
-			                   &pty_items, &pty_size, (unsigned char **) &buffer);
+			                   &pty_items, &pty_size, &buffer);
 
 			if (pty_format != 8) {
 				/* property does not contain text, delete it
@@ -1484,7 +1484,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
 			 * text, we know the size. */
 			XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
 			                   False, AnyPropertyType, &pty_type, &pty_format,
-			                   &pty_items, &pty_size, (unsigned char **) &buffer);
+			                   &pty_items, &pty_size, &buffer);
 
 			/* allocate memory to accommodate data in *txt */
 			if (*len == 0) {
@@ -1538,12 +1538,12 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
 		if (sseln == m_clipboard) {
 			sel_buf = (unsigned char *)malloc(strlen(txt_cut_buffer) + 1);
 			strcpy((char *)sel_buf, txt_cut_buffer);
-			return((GHOST_TUns8 *)sel_buf);
+			return sel_buf;
 		}
 		else {
 			sel_buf = (unsigned char *)malloc(strlen(txt_select_buffer) + 1);
 			strcpy((char *)sel_buf, txt_select_buffer);
-			return((GHOST_TUns8 *)sel_buf);
+			return sel_buf;
 		}
 	}
 	else if (owner == None)
@@ -1594,7 +1594,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
 		else
 			free(sel_buf);
 		
-		return (GHOST_TUns8 *)tmp_data;
+		return tmp_data;
 	}
 	return(NULL);
 }
@@ -1603,7 +1603,7 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
 	Window m_window, owner;
 
-	vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();	
+	vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
 	vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
 	GHOST_WindowX11 *window = static_cast<GHOST_WindowX11 *>(*win_it);
 	m_window = window->getXWindow();
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index bc55649..02c0109 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -230,7 +230,7 @@ public:
 	
 	/**
 	 * Puts buffer to system clipboard
-	 * \param buffer	The buffer to copy to the clipboard	
+	 * \param buffer	The buffer to copy to the clipboard
 	 * \param selection	Set the selection into the clipboard, X11 only feature
 	 */
 	void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index dc05fe4..7a5bb8a 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -28,7 +28,7 @@
 
 #include <Cocoa/Cocoa.h>
 
-#ifndef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
 //Use of the SetSystemUIMode function (64bit compatible)
 #include <Carbon/Carbon.h>
 #endif
@@ -58,7 +58,7 @@ extern "C" {
 	extern void wm_draw_update(bContext *C);
 };*/
 @interface CocoaWindowDelegate : NSObject
-#ifdef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 <NSWindowDelegate>
 #endif
 {
@@ -115,12 +115,12 @@ extern "C" {
 
 - (void)windowDidResize:(NSNotification *)notification
 {
-#ifdef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 	//if (![[notification object] inLiveResize]) {
 		//Send event only once, at end of resize operation (when user has released mouse button)
 #endif
 		systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
-#ifdef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 	//}
 #endif
 	/* Live resize ugly patch. Needed because live resize runs in a modal loop, not letting main loop run
@@ -187,7 +187,7 @@ extern "C" {
 	NSPoint mouseLocation = [sender draggingLocation];
 	
 	systemCocoa->handleDraggingEvent(GHOST_kEventDraggingUpdated, m_draggedObjectType, associatedWindow, mouseLocation.x, mouseLocation.y, nil);
-	return associatedWindow->canAcceptDragOperation()?NSDragOperationCopy:NSDragOperationNone;
+	return associatedWindow->canAcceptDragOperation() ? NSDragOperationCopy : NSDragOperationNone;
 }
 
 - (void)draggingExited:(id < NSDraggingInfo >)sender
@@ -368,7 +368,7 @@ extern "C" {
 
 - (BOOL)hasMarkedText
 {
-	return (composing)? YES: NO;
+	return (composing) ? YES : NO;
 }
 
 - (void)doCommandBySelector:(SEL)selector
@@ -392,7 +392,7 @@ extern "C" {
 
 - (NSRange)markedRange
 {
-	unsigned int length = (composing_text)? [composing_text length]: 0;
+	unsigned int length = (composing_text) ? [composing_text length] : 0;
 
 	if (composing)
 		return NSMakeRange(0, length);
@@ -402,7 +402,7 @@ extern "C" {
 
 - (NSRange)selectedRange
 {
-	unsigned int length = (composing_text)? [composing_text length]: 0;
+	unsigned int length = (composing_text) ? [composing_text length] : 0;
 	return NSMakeRange(0, length);
 }
 
@@ -609,9 +609,12 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
 	[m_openGLView release];
 	
 	if (m_window) {
+		// previously we called [m_window release], but on 10.8 this does not
+		// remove the window from [NSApp orderedWindows] and perhaps other
+		// places, leading to crashes. so instead we set setReleasedWhenClosed
+		// back to YES right before closing
+		[m_window setReleasedWhenClosed:YES];
 		[m_window close];
-		[[m_window delegate] release];
-		[m_window release];
 		m_window = nil;
 	}
 	
@@ -637,7 +640,7 @@ void* GHOST_WindowCocoa::getOSWindow() const
 
 void GHOST_WindowCocoa::setTitle(const STR_String& title)
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
 	NSString *windowTitle = [[NSString alloc] initWithCString:title encoding:NSUTF8StringEncoding];
@@ -684,7 +687,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String& title)
 
 void GHOST_WindowCocoa::getTitle(STR_String& title) const
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getTitle(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getTitle(): window invalid");
 
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
@@ -701,7 +704,7 @@ void GHOST_WindowCocoa::getTitle(STR_String& title) const
 void GHOST_WindowCocoa::getWindowBounds(GHOST_Rect& bounds) const
 {
 	NSRect rect;
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getWindowBounds(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getWindowBounds(): window invalid");
 
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	
@@ -721,7 +724,7 @@ void GHOST_WindowCocoa::getWindowBounds(GHOST_Rect& bounds) const
 void GHOST_WindowCocoa::getClientBounds(GHOST_Rect& bounds) const
 {
 	NSRect rect;
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getClientBounds(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getClientBounds(): window invalid");
 	
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	
@@ -753,7 +756,7 @@ void GHOST_WindowCocoa::getClientBounds(GHOST_Rect& bounds) const
 
 GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
@@ -770,7 +773,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
 
 GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
@@ -787,7 +790,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
 
 GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
@@ -806,7 +809,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32
 
 GHOST_TWindowState GHOST_WindowCocoa::getState() const
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getState(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getState(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_TWindowState state;
 	if (m_fullScreen) {
@@ -828,7 +831,7 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const
 
 void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid");
 
 	screenToClientIntern(inX, inY, outX, outY);
 
@@ -841,7 +844,7 @@ void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
 
 void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid");
 
 	/* switch y to match ghost convention */
 	GHOST_Rect cBnds;
@@ -895,7 +898,7 @@ NSScreen* GHOST_WindowCocoa::getScreen()
  */
 GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setState(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setState(): window invalid");
 	switch (state) {
 		case GHOST_kWindowStateMinimized:
 			[m_window miniaturize:nil];
@@ -913,7 +916,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
 				 * doesn't know view/window difference. */
 				m_fullScreen = true;
 
-#ifdef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 				//10.6 provides Cocoa functions to autoshow menu bar, and to change a window style
 				//Hide menu & dock if needed
 				if ([[m_window screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) {
@@ -972,7 +975,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
 				m_fullScreen = false;
 
 				//Exit fullscreen
-#ifdef MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 				//Show again menu & dock if needed
 				if ([[m_window screen] isEqual:[NSScreen mainScreen]]) {
 					[NSApp setPresentationOptions:NSApplicationPresentationDefault];
@@ -1049,7 +1052,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
 {
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setOrder(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setOrder(): window invalid");
 	if (order == GHOST_kWindowOrderTop) {
 		[m_window makeKeyAndOrderFront:nil];
 	}
@@ -1199,7 +1202,7 @@ GHOST_TSuccess GHOST_WindowCocoa::removeDrawingContext()
 
 GHOST_TSuccess GHOST_WindowCocoa::invalidate()
 {
-	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::invalidate(): window invalid")
+	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::invalidate(): window invalid");
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	[m_openGLView setNeedsDisplay:YES];
 	[pool drain];
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 369fc4a..6641b28 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -26,6 +26,7 @@
 
 #include "GHOST_WindowSDL.h"
 #include "SDL_mouse.h"
+#include <GL/glew.h>
 #include <assert.h>
 
 static SDL_GLContext s_firstContext = NULL;
@@ -48,6 +49,20 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
 	m_invalid_window(false),
 	m_sdl_custom_cursor(NULL)
 {
+	SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
+	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
+	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+
+	if (numOfAASamples) {
+		SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+		SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, numOfAASamples);
+	}
+
+	/* creating the window _must_ come after setting attributes */
 	m_sdl_win = SDL_CreateWindow(title,
 	                             left,
 	                             top,
@@ -55,14 +70,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
 	                             height,
 	                             SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
 
-	//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
-	//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
-	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
-	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
-	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
-	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
-	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+
 
 	m_sdl_glcontext = SDL_GL_CreateContext(m_sdl_win);
 
@@ -164,6 +172,10 @@ GHOST_WindowSDL::activateDrawingContext()
 	if (m_sdl_glcontext != NULL) {
 		int status = SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext);
 		(void)status;
+		/* Disable AA by default */
+		if (m_numOfAASamples > 0) {
+			glDisable(GL_MULTISAMPLE_ARB);
+		}
 		return GHOST_kSuccess;
 	}
 	return GHOST_kFailure;
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index c9c902f..fead188 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -720,7 +720,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
 	};
 
 	// Get the function
-	PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");	
+	PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
 
 	if (!wglChoosePixelFormatARB)
 	{
@@ -868,7 +868,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
 				}
 
 				// Attempt to enable multisample
-				if (m_multisample && WGL_ARB_multisample && !m_multisampleEnabled)
+				if (m_multisample && WGL_ARB_multisample && !m_multisampleEnabled && !is_crappy_intel_card())
 				{
 					success = initMultisample(preferredFormat);
 
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index dd1930a..156bc86 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1265,6 +1265,10 @@ activateDrawingContext()
 {
 	if (m_context != NULL) {
 		glXMakeCurrent(m_display, m_window, m_context);
+		/* Disable AA by default */
+		if (m_numOfAASamples > 0) {
+			glDisable(GL_MULTISAMPLE_ARB);
+		}
 		return GHOST_kSuccess;
 	} 
 	return GHOST_kFailure;
diff --git a/intern/ghost/test/multitest/EventToBuf.c b/intern/ghost/test/multitest/EventToBuf.c
index aba8078..49255de 100644
--- a/intern/ghost/test/multitest/EventToBuf.c
+++ b/intern/ghost/test/multitest/EventToBuf.c
@@ -197,15 +197,15 @@ static char *keytype_to_string(GHOST_TKey key)
 
 void event_to_buf(GHOST_EventHandle evt, char buf[128])
 {
-	GHOST_TEventType type= GHOST_GetEventType(evt);
-	double time= (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
-	GHOST_WindowHandle win= GHOST_GetEventWindow(evt);
-	void *data= GHOST_GetEventData(evt);
-	char *pos= buf;
+	GHOST_TEventType type = GHOST_GetEventType(evt);
+	double time = (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
+	GHOST_WindowHandle win = GHOST_GetEventWindow(evt);
+	void *data = GHOST_GetEventData(evt);
+	char *pos = buf;
 
 	pos += sprintf(pos, "event: %6.2f, %16s", time, eventtype_to_string(type));
 	if (win) {
-		char *s= GHOST_GetTitle(win);
+		char *s = GHOST_GetTitle(win);
 		pos += sprintf(pos, " - win: %s", s);
 		free(s);
 	}
@@ -215,14 +215,14 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
 	switch (type) {
 		case GHOST_kEventCursorMove:
 		{
-			GHOST_TEventCursorData *cd= data;
+			GHOST_TEventCursorData *cd = data;
 			pos += sprintf(pos, " - pos: (%d, %d)", cd->x, cd->y);
 			break;
 		}
 		case GHOST_kEventButtonDown:
 		case GHOST_kEventButtonUp:
 		{
-			GHOST_TEventButtonData *bd= data;
+			GHOST_TEventButtonData *bd = data;
 			pos += sprintf(pos, " - but: %d", bd->button);
 			break;
 		}
@@ -230,7 +230,7 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
 		case GHOST_kEventKeyDown:
 		case GHOST_kEventKeyUp:
 		{
-			GHOST_TEventKeyData *kd= data;
+			GHOST_TEventKeyData *kd = data;
 			pos += sprintf(pos, " - key: %s (%d)", keytype_to_string(kd->key), kd->key);
 			if (kd->ascii) pos+= sprintf(pos, " ascii: '%c' (%d)", kd->ascii, kd->ascii);
 			break;
diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c
index 5d207da..2d0afcf 100644
--- a/intern/ghost/test/multitest/MultiTest.c
+++ b/intern/ghost/test/multitest/MultiTest.c
@@ -26,9 +26,8 @@
  */
 #define FALSE 0
 
-#ifdef WIN32
-
-#pragma warning(disable: 4244 4305)
+#ifdef _MSC_VER
+#  pragma warning(disable: 4244 4305)
 #endif
 
 #include <stdlib.h>
diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp
index da77f0e..8b05d25 100644
--- a/intern/guardedalloc/cpp/mallocn.cpp
+++ b/intern/guardedalloc/cpp/mallocn.cpp
@@ -28,6 +28,9 @@
 #include <new>
 #include "../MEM_guardedalloc.h"
 
+void *operator new(size_t size, const char *str) throw(std::bad_alloc);
+void *operator new[](size_t size, const char *str) throw(std::bad_alloc);
+
 /* not default but can be used when needing to set a string */
 void *operator new(size_t size, const char *str) throw(std::bad_alloc)
 {
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index a65871f..4a79f5d 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -58,7 +58,7 @@
  * store original buffer's name when doing MEM_dupallocN
  * helpful to profile issues with non-freed "dup_alloc" buffers,
  * but this introduces some overhead to memory header and makes
- * things slower a bit, so betterto keep disabled by default
+ * things slower a bit, so better to keep disabled by default
  */
 //#define DEBUG_MEMDUPLINAME
 
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.cpp b/intern/iksolver/intern/IK_QJacobianSolver.cpp
index 43d177d..75f51f5 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.cpp
+++ b/intern/iksolver/intern/IK_QJacobianSolver.cpp
@@ -377,7 +377,7 @@ bool IK_QJacobianSolver::Solve(
 			norm = maxnorm;
 
 		// check for convergence
-		if (norm < 1e-3) {
+		if (norm < 1e-3 && iterations > 10) {
 			solved = true;
 			break;
 		}
diff --git a/intern/itasc/CMakeLists.txt b/intern/itasc/CMakeLists.txt
index f4bc032..bc3ea0c 100644
--- a/intern/itasc/CMakeLists.txt
+++ b/intern/itasc/CMakeLists.txt
@@ -22,13 +22,13 @@
 # Contributor(s): Jacques Beaurain.
 #
 # ***** END GPL LICENSE BLOCK *****
-
+remove_strict_flags()
 set(INC
-	../../extern/Eigen3
+
 )
 
 set(INC_SYS
-	
+	../../extern/Eigen3
 )
 
 set(SRC
@@ -121,201 +121,235 @@ set(SRC
 	kdl/framevel.inl
 
 	# until we have another user...
-	../../extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
-	../../extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h
-	../../extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
-	../../extern/Eigen3/Eigen/src/plugins/BlockMethods.h
-	../../extern/Eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h
-	../../extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
-	../../extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h
-	../../extern/Eigen3/Eigen/src/misc/Kernel.h
-	../../extern/Eigen3/Eigen/src/misc/Image.h
-	../../extern/Eigen3/Eigen/src/misc/Solve.h
-	../../extern/Eigen3/Eigen/src/QR/HouseholderQR.h
-	../../extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
-	../../extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
-	../../extern/Eigen3/Eigen/src/StlSupport/details.h
-	../../extern/Eigen3/Eigen/src/StlSupport/StdList.h
-	../../extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
-	../../extern/Eigen3/Eigen/src/StlSupport/StdVector.h
-	../../extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h
-	../../extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/EigenvaluesCommon.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
-	../../extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
-	../../extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
-	../../extern/Eigen3/Eigen/src/Householder/Householder.h
-	../../extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
-	../../extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h
-	../../extern/Eigen3/Eigen/src/Geometry/RotationBase.h
-	../../extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
-	../../extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
-	../../extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
-	../../extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
-	../../extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h
-	../../extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h
-	../../extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h
-	../../extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
-	../../extern/Eigen3/Eigen/src/Geometry/Umeyama.h
-	../../extern/Eigen3/Eigen/src/Geometry/Scaling.h
-	../../extern/Eigen3/Eigen/src/Geometry/Translation.h
-	../../extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
-	../../extern/Eigen3/Eigen/src/Geometry/Transform.h
-	../../extern/Eigen3/Eigen/src/Geometry/Quaternion.h
-	../../extern/Eigen3/Eigen/src/LU/PartialPivLU.h
-	../../extern/Eigen3/Eigen/src/LU/Determinant.h
-	../../extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h
-	../../extern/Eigen3/Eigen/src/LU/FullPivLU.h
-	../../extern/Eigen3/Eigen/src/LU/Inverse.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseMatrixBase.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseSelfAdjointView.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseVector.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseDiagonalProduct.h
-	../../extern/Eigen3/Eigen/src/Sparse/TriangularSolver.h
-	../../extern/Eigen3/Eigen/src/Sparse/AmbiVector.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseDenseProduct.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseBlock.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseTriangularView.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseCwiseBinaryOp.h
-	../../extern/Eigen3/Eigen/src/Sparse/CoreIterators.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseMatrix.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseAssign.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseSparseProduct.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseDot.h
-	../../extern/Eigen3/Eigen/src/Sparse/DynamicSparseMatrix.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseRedux.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseFuzzy.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseCwiseUnaryOp.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseView.h
-	../../extern/Eigen3/Eigen/src/Sparse/MappedSparseMatrix.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseUtil.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseTranspose.h
-	../../extern/Eigen3/Eigen/src/Sparse/SparseProduct.h
-	../../extern/Eigen3/Eigen/src/Sparse/CompressedStorage.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/QR.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Memory.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/SVD.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Meta.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Macros.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/LU.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Block.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/Minor.h
-	../../extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h
-	../../extern/Eigen3/Eigen/src/Core/SelfAdjointView.h
-	../../extern/Eigen3/Eigen/src/Core/MatrixBase.h
-	../../extern/Eigen3/Eigen/src/Core/Swap.h
-	../../extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h
-	../../extern/Eigen3/Eigen/src/Core/DenseBase.h
-	../../extern/Eigen3/Eigen/src/Core/GlobalFunctions.h
-	../../extern/Eigen3/Eigen/src/Core/ProductBase.h
-	../../extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
-	../../extern/Eigen3/Eigen/src/Core/Stride.h
-	../../extern/Eigen3/Eigen/src/Core/Matrix.h
-	../../extern/Eigen3/Eigen/src/Core/Visitor.h
+	../../extern/Eigen3/Eigen/src/Cholesky/LDLT.h
+	../../extern/Eigen3/Eigen/src/Cholesky/LLT.h
+	../../extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
+	../../extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
 	../../extern/Eigen3/Eigen/src/Core/Array.h
-	../../extern/Eigen3/Eigen/src/Core/ReturnByValue.h
-	../../extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
-	../../extern/Eigen3/Eigen/src/Core/EigenBase.h
-	../../extern/Eigen3/Eigen/src/Core/Random.h
-	../../extern/Eigen3/Eigen/src/Core/Redux.h
-	../../extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
-	../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
-	../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
-	../../extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
-	../../extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
-	../../extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
-	../../extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h
-	../../extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
-	../../extern/Eigen3/Eigen/src/Core/BooleanRedux.h
-	../../extern/Eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h
-	../../extern/Eigen3/Eigen/src/Core/util/BlasUtil.h
-	../../extern/Eigen3/Eigen/src/Core/util/Memory.h
-	../../extern/Eigen3/Eigen/src/Core/util/Meta.h
-	../../extern/Eigen3/Eigen/src/Core/util/Constants.h
-	../../extern/Eigen3/Eigen/src/Core/util/Macros.h
-	../../extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
-	../../extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
-	../../extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h
-	../../extern/Eigen3/Eigen/src/Core/util/XprHelper.h
-	../../extern/Eigen3/Eigen/src/Core/VectorBlock.h
-	../../extern/Eigen3/Eigen/src/Core/Transpositions.h
-	../../extern/Eigen3/Eigen/src/Core/Select.h
+	../../extern/Eigen3/Eigen/src/Core/ArrayBase.h
+	../../extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
+	../../extern/Eigen3/Eigen/src/Core/Assign.h
+	../../extern/Eigen3/Eigen/src/Core/Assign_MKL.h
 	../../extern/Eigen3/Eigen/src/Core/BandMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/Block.h
+	../../extern/Eigen3/Eigen/src/Core/BooleanRedux.h
+	../../extern/Eigen3/Eigen/src/Core/CommaInitializer.h
+	../../extern/Eigen3/Eigen/src/Core/CwiseBinaryOp.h
+	../../extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h
+	../../extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
 	../../extern/Eigen3/Eigen/src/Core/CwiseUnaryView.h
+	../../extern/Eigen3/Eigen/src/Core/DenseBase.h
+	../../extern/Eigen3/Eigen/src/Core/DenseCoeffsBase.h
+	../../extern/Eigen3/Eigen/src/Core/DenseStorage.h
+	../../extern/Eigen3/Eigen/src/Core/Diagonal.h
+	../../extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
 	../../extern/Eigen3/Eigen/src/Core/Dot.h
+	../../extern/Eigen3/Eigen/src/Core/EigenBase.h
+	../../extern/Eigen3/Eigen/src/Core/Flagged.h
+	../../extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h
+	../../extern/Eigen3/Eigen/src/Core/Functors.h
+	../../extern/Eigen3/Eigen/src/Core/Fuzzy.h
+	../../extern/Eigen3/Eigen/src/Core/GeneralProduct.h
 	../../extern/Eigen3/Eigen/src/Core/GenericPacketMath.h
-	../../extern/Eigen3/Eigen/src/Core/Product.h
-	../../extern/Eigen3/Eigen/src/Core/Transpose.h
-	../../extern/Eigen3/Eigen/src/Core/Block.h
-	../../extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
+	../../extern/Eigen3/Eigen/src/Core/GlobalFunctions.h
+	../../extern/Eigen3/Eigen/src/Core/IO.h
+	../../extern/Eigen3/Eigen/src/Core/Map.h
 	../../extern/Eigen3/Eigen/src/Core/MapBase.h
+	../../extern/Eigen3/Eigen/src/Core/MathFunctions.h
+	../../extern/Eigen3/Eigen/src/Core/Matrix.h
+	../../extern/Eigen3/Eigen/src/Core/MatrixBase.h
+	../../extern/Eigen3/Eigen/src/Core/NestByValue.h
 	../../extern/Eigen3/Eigen/src/Core/NoAlias.h
-	../../extern/Eigen3/Eigen/src/Core/ForceAlignedAccess.h
-	../../extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
-	../../extern/Eigen3/Eigen/src/Core/IO.h
-	../../extern/Eigen3/Eigen/src/Core/DiagonalMatrix.h
-	../../extern/Eigen3/Eigen/src/Core/CwiseUnaryOp.h
-	../../extern/Eigen3/Eigen/src/Core/Reverse.h
-	../../extern/Eigen3/Eigen/src/Core/Fuzzy.h
-	../../extern/Eigen3/Eigen/src/Core/DenseStorage.h
-	../../extern/Eigen3/Eigen/src/Core/StableNorm.h
 	../../extern/Eigen3/Eigen/src/Core/NumTraits.h
-	../../extern/Eigen3/Eigen/src/Core/Map.h
-	../../extern/Eigen3/Eigen/src/Core/Functors.h
 	../../extern/Eigen3/Eigen/src/Core/PermutationMatrix.h
-	../../extern/Eigen3/Eigen/src/Core/ArrayBase.h
-	../../extern/Eigen3/Eigen/src/Core/CwiseNullaryOp.h
-	../../extern/Eigen3/Eigen/src/Core/SolveTriangular.h
-	../../extern/Eigen3/Eigen/src/Core/NestByValue.h
-	../../extern/Eigen3/Eigen/src/Core/DiagonalProduct.h
-	../../extern/Eigen3/Eigen/src/Core/CommaInitializer.h
-	../../extern/Eigen3/Eigen/src/Core/MathFunctions.h
-	../../extern/Eigen3/Eigen/src/Core/Diagonal.h
+	../../extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
+	../../extern/Eigen3/Eigen/src/Core/Product.h
+	../../extern/Eigen3/Eigen/src/Core/ProductBase.h
+	../../extern/Eigen3/Eigen/src/Core/Random.h
+	../../extern/Eigen3/Eigen/src/Core/Redux.h
 	../../extern/Eigen3/Eigen/src/Core/Replicate.h
-	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h
-	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h
-	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h
+	../../extern/Eigen3/Eigen/src/Core/ReturnByValue.h
+	../../extern/Eigen3/Eigen/src/Core/Reverse.h
+	../../extern/Eigen3/Eigen/src/Core/Select.h
+	../../extern/Eigen3/Eigen/src/Core/SelfAdjointView.h
+	../../extern/Eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h
+	../../extern/Eigen3/Eigen/src/Core/SolveTriangular.h
+	../../extern/Eigen3/Eigen/src/Core/StableNorm.h
+	../../extern/Eigen3/Eigen/src/Core/Stride.h
+	../../extern/Eigen3/Eigen/src/Core/Swap.h
+	../../extern/Eigen3/Eigen/src/Core/Transpose.h
+	../../extern/Eigen3/Eigen/src/Core/Transpositions.h
+	../../extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/VectorBlock.h
+	../../extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
+	../../extern/Eigen3/Eigen/src/Core/Visitor.h
+	../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
+	../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
+	../../extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
+	../../extern/Eigen3/Eigen/src/Core/arch/NEON/Complex.h
+	../../extern/Eigen3/Eigen/src/Core/arch/NEON/PacketMath.h
+	../../extern/Eigen3/Eigen/src/Core/arch/SSE/Complex.h
+	../../extern/Eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h
+	../../extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
 	../../extern/Eigen3/Eigen/src/Core/products/CoeffBasedProduct.h
-	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h
-	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
-	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h
 	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h
-	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector.h
+	../../extern/Eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h
 	../../extern/Eigen3/Eigen/src/Core/products/Parallelizer.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointProduct.h
+	../../extern/Eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
+	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
+	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h
+	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h
 	../../extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h
+	../../extern/Eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h
 	../../extern/Eigen3/Eigen/src/Core/products/TriangularSolverVector.h
-	../../extern/Eigen3/Eigen/src/Core/products/TriangularMatrixVector.h
-	../../extern/Eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h
-	../../extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
-	../../extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
-	../../extern/Eigen3/Eigen/src/Core/Assign.h
-	../../extern/Eigen3/Eigen/src/Core/Flagged.h
-	../../extern/Eigen3/Eigen/src/Cholesky/LDLT.h
-	../../extern/Eigen3/Eigen/src/Cholesky/LLT.h
+	../../extern/Eigen3/Eigen/src/Core/util/BlasUtil.h
+	../../extern/Eigen3/Eigen/src/Core/util/Constants.h
+	../../extern/Eigen3/Eigen/src/Core/util/DisableStupidWarnings.h
+	../../extern/Eigen3/Eigen/src/Core/util/ForwardDeclarations.h
+	../../extern/Eigen3/Eigen/src/Core/util/Macros.h
+	../../extern/Eigen3/Eigen/src/Core/util/Memory.h
+	../../extern/Eigen3/Eigen/src/Core/util/Meta.h
+	../../extern/Eigen3/Eigen/src/Core/util/MKL_support.h
+	../../extern/Eigen3/Eigen/src/Core/util/NonMPL2.h
+	../../extern/Eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h
+	../../extern/Eigen3/Eigen/src/Core/util/StaticAssert.h
+	../../extern/Eigen3/Eigen/src/Core/util/XprHelper.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Block.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/LU.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Macros.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/MathFunctions.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Memory.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Meta.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Minor.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/QR.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/SVD.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/TriangularSolver.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/VectorBlock.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/All.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h
+	../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/EigenSolver.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/RealSchur.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h
+	../../extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
+	../../extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
+	../../extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
+	../../extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
+	../../extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
+	../../extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
+	../../extern/Eigen3/Eigen/src/Geometry/OrthoMethods.h
+	../../extern/Eigen3/Eigen/src/Geometry/ParametrizedLine.h
+	../../extern/Eigen3/Eigen/src/Geometry/Quaternion.h
+	../../extern/Eigen3/Eigen/src/Geometry/Rotation2D.h
+	../../extern/Eigen3/Eigen/src/Geometry/RotationBase.h
+	../../extern/Eigen3/Eigen/src/Geometry/Scaling.h
+	../../extern/Eigen3/Eigen/src/Geometry/Transform.h
+	../../extern/Eigen3/Eigen/src/Geometry/Translation.h
+	../../extern/Eigen3/Eigen/src/Geometry/Umeyama.h
+	../../extern/Eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h
+	../../extern/Eigen3/Eigen/src/Householder/BlockHouseholder.h
+	../../extern/Eigen3/Eigen/src/Householder/Householder.h
+	../../extern/Eigen3/Eigen/src/Householder/HouseholderSequence.h
+	../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
+	../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h
+	../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
+	../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
+	../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
+	../../extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
+	../../extern/Eigen3/Eigen/src/LU/Determinant.h
+	../../extern/Eigen3/Eigen/src/LU/FullPivLU.h
+	../../extern/Eigen3/Eigen/src/LU/Inverse.h
+	../../extern/Eigen3/Eigen/src/LU/PartialPivLU.h
+	../../extern/Eigen3/Eigen/src/LU/PartialPivLU_MKL.h
+	../../extern/Eigen3/Eigen/src/LU/arch/Inverse_SSE.h
+	../../extern/Eigen3/Eigen/src/misc/blas.h
+	../../extern/Eigen3/Eigen/src/misc/Image.h
+	../../extern/Eigen3/Eigen/src/misc/Kernel.h
+	../../extern/Eigen3/Eigen/src/misc/Solve.h
+	../../extern/Eigen3/Eigen/src/misc/SparseSolve.h
+	../../extern/Eigen3/Eigen/src/OrderingMethods/Amd.h
+	../../extern/Eigen3/Eigen/src/PardisoSupport/PardisoSupport.h
+	../../extern/Eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h
+	../../extern/Eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h
+	../../extern/Eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h
+	../../extern/Eigen3/Eigen/src/plugins/BlockMethods.h
+	../../extern/Eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h
+	../../extern/Eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h
+	../../extern/Eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h
+	../../extern/Eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h
+	../../extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR.h
+	../../extern/Eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h
+	../../extern/Eigen3/Eigen/src/QR/FullPivHouseholderQR.h
+	../../extern/Eigen3/Eigen/src/QR/HouseholderQR.h
+	../../extern/Eigen3/Eigen/src/QR/HouseholderQR_MKL.h
+	../../extern/Eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h
+	../../extern/Eigen3/Eigen/src/SparseCore/AmbiVector.h
+	../../extern/Eigen3/Eigen/src/SparseCore/CompressedStorage.h
+	../../extern/Eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h
+	../../extern/Eigen3/Eigen/src/SparseCore/CoreIterators.h
+	../../extern/Eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseAssign.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseBlock.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseDenseProduct.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseDot.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseFuzzy.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseMatrix.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparsePermutation.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseProduct.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseRedux.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseTranspose.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseTriangularView.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseUtil.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseVector.h
+	../../extern/Eigen3/Eigen/src/SparseCore/SparseView.h
+	../../extern/Eigen3/Eigen/src/SparseCore/TriangularSolver.h
+	../../extern/Eigen3/Eigen/src/StlSupport/details.h
+	../../extern/Eigen3/Eigen/src/StlSupport/StdDeque.h
+	../../extern/Eigen3/Eigen/src/StlSupport/StdList.h
+	../../extern/Eigen3/Eigen/src/StlSupport/StdVector.h
+	../../extern/Eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h
+	../../extern/Eigen3/Eigen/src/SVD/JacobiSVD.h
+	../../extern/Eigen3/Eigen/src/SVD/JacobiSVD_MKL.h
+	../../extern/Eigen3/Eigen/src/SVD/UpperBidiagonalization.h
+	../../extern/Eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h
 )
 
 
diff --git a/intern/itasc/Scene.cpp b/intern/itasc/Scene.cpp
index 7a83f82..7ed8fc4 100644
--- a/intern/itasc/Scene.cpp
+++ b/intern/itasc/Scene.cpp
@@ -40,7 +40,7 @@ public:
 	{
 		q_nr += m_qrange.start;
 		project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero();
-		// update the ouput vector so that the movement of this joint will be
+		// update the output vector so that the movement of this joint will be
 		// taken into account and we can put the joint back in its initial position
 		// which means that the jacobian doesn't need to be changed
 		for (unsigned int i=0 ;i<ndof ; ++i, ++q_nr) {
diff --git a/intern/itasc/kdl/chain.hpp b/intern/itasc/kdl/chain.hpp
index 773f472..fde9d4e 100644
--- a/intern/itasc/kdl/chain.hpp
+++ b/intern/itasc/kdl/chain.hpp
@@ -35,11 +35,16 @@ namespace KDL {
      */
     class Chain {
     private:
-#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5)
+#if defined(__APPLE__)
+#  if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
+		std::vector<Segment> segments;
+#  else
         // Eigen allocator is needed for alignment of Eigen data types
         std::vector<Segment, Eigen::aligned_allocator<Segment> > segments;
+#  endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
 #else
-        std::vector<Segment> segments;
+        // Eigen allocator is needed for alignment of Eigen data types
+        std::vector<Segment, Eigen::aligned_allocator<Segment> > segments;
 #endif
         unsigned int nrOfJoints;
         unsigned int nrOfSegments;
diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp
index 08c1aad..a020c6c 100644
--- a/intern/itasc/kdl/tree.hpp
+++ b/intern/itasc/kdl/tree.hpp
@@ -27,19 +27,30 @@
 
 #include <string>
 #include <map>
-#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5)
-#include <Eigen/Core>
+#if defined(__APPLE__)
+#  if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
+    //no include
+#  else
+#    include <Eigen/Core>
+#  endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#else
+#  include <Eigen/Core>
 #endif
 
 namespace KDL
 {
     //Forward declaration
     class TreeElement;
-#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5)
+#if defined(__APPLE__)
+#  if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
+    typedef std::map<std::string,TreeElement> SegmentMap;
+#  else
     // Eigen allocator is needed for alignment of Eigen data types
     typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
+#  endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
 #else
-    typedef std::map<std::string,TreeElement> SegmentMap;
+    // Eigen allocator is needed for alignment of Eigen data types
+    typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
 #endif
     class TreeElement
     {
diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt
new file mode 100644
index 0000000..1f14a0e
--- /dev/null
+++ b/intern/locale/CMakeLists.txt
@@ -0,0 +1,47 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2012, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Bastien Montagne.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+	.
+)
+
+set(INC_SYS
+)
+
+set(SRC
+	boost_locale_wrapper.cpp
+
+	boost_locale_wrapper.h
+)
+
+if(WITH_INTERNATIONAL)
+	list(APPEND INC_SYS
+		${BOOST_INCLUDE_DIR}
+	)
+	add_definitions(-DWITH_INTERNATIONAL)
+	add_definitions(${BOOST_DEFINITIONS})
+endif()
+
+blender_add_lib(bf_intern_locale "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/locale/SConscript b/intern/locale/SConscript
new file mode 100644
index 0000000..df745f0
--- /dev/null
+++ b/intern/locale/SConscript
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+Import('env')
+
+sources = env.Glob('*.cpp')
+
+incs = '.'
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+    incs += ' ' + env['BF_BOOST_INC']
+
+env.BlenderLib( 'bf_intern_locale', sources, Split(incs), defs, libtype=['intern','player'], priority=[10, 185])
diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp
new file mode 100644
index 0000000..939c66b
--- /dev/null
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -0,0 +1,114 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012, Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Bastien Montagne.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+#include <stdio.h>
+#include <boost/locale.hpp>
+
+#include "boost_locale_wrapper.h"
+
+static std::string messages_path;
+static std::string default_domain;
+
+void bl_locale_init(const char *_messages_path, const char *_default_domain)
+{
+	// Avoid using ICU backend, we do not need its power and it's rather heavy!
+	boost::locale::localization_backend_manager lman = boost::locale::localization_backend_manager::global(); 
+#if defined (_WIN32)
+	lman.select("winapi");
+#else
+	lman.select("posix");
+#endif
+	boost::locale::localization_backend_manager::global(lman);
+
+	messages_path = _messages_path;
+	default_domain = _default_domain;
+}
+
+void bl_locale_set(const char *locale)
+{
+	boost::locale::generator gen;
+	// Specify location of dictionaries.
+	gen.add_messages_path(messages_path);
+	gen.add_messages_domain(default_domain);
+	//gen.set_default_messages_domain(default_domain);	
+
+	if (locale && locale[0]) {
+		std::locale::global(gen(locale));
+	}
+	else {
+#if defined (__APPLE__)
+		// workaround to get osx system locale from user defaults
+		FILE* fp;
+		std::string locale_osx = "";
+		char result[16];
+		int result_len = 0;
+
+		fp = popen("defaults read .GlobalPreferences AppleLocale", "r");
+
+		if(fp) {
+			result_len = fread(result, 1, sizeof(result) - 1, fp);
+
+			if(result_len > 0) {
+				result[result_len-1] = '\0'; // \0 terminate and remove \n
+				locale_osx = std::string(result) + std::string(".UTF-8");
+			}
+
+			pclose(fp);
+		}
+
+		if(locale_osx == "")
+			fprintf(stderr, "Locale set: failed to read AppleLocale read from defaults\n");
+
+		std::locale::global(gen(locale_osx.c_str()));
+#else
+		std::locale::global(gen(""));
+#endif
+	}
+	// Note: boost always uses "C" LC_NUMERIC by default!
+}
+
+const char* bl_locale_pgettext(const char *msgctxt, const char *msgid)
+{
+	// Note: We cannot use short stuff like boost::locale::gettext, because those return
+	//       std::basic_string objects, which c_ptr()-returned char* is no more valid
+	//       once deleted (which happens as soons they are out of scope of this func).
+	typedef boost::locale::message_format<char> char_message_facet;
+	try {
+		std::locale l;
+		char_message_facet const &facet = std::use_facet<char_message_facet>(l);
+		char const *r = facet.get(0, msgctxt, msgid);
+		if(r)
+			return r;
+		return msgid;
+	}
+	catch(std::exception const &e) {
+//		std::cout << "boost_locale_pgettext: " << e.what() << " \n";
+		return msgid;
+	}
+}
+
diff --git a/intern/locale/boost_locale_wrapper.h b/intern/locale/boost_locale_wrapper.h
new file mode 100644
index 0000000..e7956d2
--- /dev/null
+++ b/intern/locale/boost_locale_wrapper.h
@@ -0,0 +1,49 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012, Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Bastien Montagne.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file locale/boost_locale_wrapper.h
+ *  \ingroup locale
+ *  A thin C wrapper around boost::locale...
+ */
+
+#ifndef __BOOST_LOCALE_WRAPPER_H__
+#define __BOOST_LOCALE_WRAPPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void bl_locale_init(const char *messages_path, const char *default_domain);
+void bl_locale_set(const char *locale);
+const char* bl_locale_pgettext(const char *msgctxt, const char *msgid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOOST_LOCALE_WRAPPER_H__ */
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index cfff5d1..daf66dc 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -247,8 +247,10 @@ private:
 			if (!elem->can_destroy())
 				continue;
 
-			/* by default 0 means higherst priority element */
-			int priority = -(queue.size() - i - 1);
+			/* by default 0 means highest priority element */
+			/* casting a size type to int is questionable,
+			   but unlikely to cause problems */
+			int priority = -((int)(queue.size()) - i - 1);
 			priority = getItemPriority(elem->get()->get_data(), priority);
 
 			if (priority < best_match_priority || best_match_elem == NULL) {
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h
index 1ae5e9d..c05c9d6 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -80,7 +80,7 @@ void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
  * @return CacheLimiterHandle to ref, unref, touch the managed object
  */
 
-MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC * This, void * data);
+MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *data);
 
 /**
  * Free objects until memory constraints are satisfied
@@ -140,7 +140,7 @@ int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle);
  * @param handle of object
  */
 
-void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
+void *MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
 
 void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This,
                                             MEM_CacheLimiter_ItemPriority_Func item_priority_func);
diff --git a/intern/memutil/MEM_SmartPtr.h b/intern/memutil/MEM_SmartPtr.h
index 09cf5c9..dd19aae 100644
--- a/intern/memutil/MEM_SmartPtr.h
+++ b/intern/memutil/MEM_SmartPtr.h
@@ -170,7 +170,7 @@ public :
 	}
 
 	/** 
-	 * Assignment operator - ownership is transfered from rhs to lhs. 
+	 * Assignment operator - ownership is transferred from rhs to lhs.
 	 * There is an intenional side-effect of function of transferring
 	 * ownership from the const parameter rhs. This is to insure 
 	 * the 1-1 relationship.
diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
index 81a1ce6..7a19543 100644
--- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
+++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
@@ -59,9 +59,9 @@ public:
 	}
 	~MEM_CacheLimiterCClass();
 
-	handle_t * insert(void * data);
+	handle_t * insert(void *data);
 
-	void destruct(void * data, list_t::iterator it);
+	void destruct(void *data, list_t::iterator it);
 
 	cache_t * get_cache() {
 		return &cache;
@@ -76,7 +76,7 @@ private:
 
 class MEM_CacheLimiterHandleCClass {
 public:
-	MEM_CacheLimiterHandleCClass(void * data_, MEM_CacheLimiterCClass * parent_) :
+	MEM_CacheLimiterHandleCClass(void *data_, MEM_CacheLimiterCClass *parent_) :
 		data(data_),
 		parent(parent_)
 	{ }
@@ -87,7 +87,7 @@ public:
 		it = it_;
 	}
 
-	void set_data(void * data_) {
+	void set_data(void *data_) {
 		data = data_;
 	}
 
@@ -101,7 +101,7 @@ private:
 	list_t::iterator it;
 };
 
-handle_t *MEM_CacheLimiterCClass::insert(void * data)
+handle_t *MEM_CacheLimiterCClass::insert(void *data)
 {
 	cclass_list.push_back(new MEM_CacheLimiterHandleCClass(data, this));
 	list_t::iterator it = cclass_list.end();
@@ -111,7 +111,7 @@ handle_t *MEM_CacheLimiterCClass::insert(void * data)
 	return cache.insert(cclass_list.back());
 }
 
-void MEM_CacheLimiterCClass::destruct(void * data, list_t::iterator it)
+void MEM_CacheLimiterCClass::destruct(void *data, list_t::iterator it)
 {
 	data_destructor(data);
 	cclass_list.erase(it);
diff --git a/intern/opencolorio/CMakeLists.txt b/intern/opencolorio/CMakeLists.txt
index d46b09c..c281a6e 100644
--- a/intern/opencolorio/CMakeLists.txt
+++ b/intern/opencolorio/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
 )
 
 set(INC_SYS
+
 )
 
 set(SRC
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 49fc44d..2d73d2f 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -48,7 +48,7 @@ using namespace OCIO_NAMESPACE;
 #endif
 
 #define MEM_NEW(type) new(MEM_mallocN(sizeof(type), __func__)) type()
-#define MEM_DELETE(what, type) if(what) { (what)->~type(); MEM_freeN(what); } (void)0
+#define MEM_DELETE(what, type) if(what) { ((type*)(what))->~type(); MEM_freeN(what); } (void)0
 
 static void OCIO_reportError(const char *err)
 {
@@ -421,8 +421,7 @@ void OCIOImpl::processorApplyRGBA_predivide(OCIO_ConstProcessorRcPtr *processor,
 
 void OCIOImpl::processorRelease(OCIO_ConstProcessorRcPtr *p)
 {
-	p->~OCIO_ConstProcessorRcPtr();
-	MEM_freeN(p);
+	MEM_DELETE(p, ConstProcessorRcPtr);
 }
 
 const char *OCIOImpl::colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
diff --git a/intern/opennl/CMakeLists.txt b/intern/opennl/CMakeLists.txt
index 3224283..754036d 100644
--- a/intern/opennl/CMakeLists.txt
+++ b/intern/opennl/CMakeLists.txt
@@ -28,7 +28,11 @@ remove_strict_flags()
 
 # remove debug flag here since this is not a blender maintained library
 # and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
-add_definitions(-UDEBUG)
+if(MSVC)
+	remove_definitions(-DDEBUG)
+else()
+	add_definitions(-UDEBUG)
+endif()
 
 
 # quiet compiler warnings about undefined defines
@@ -40,11 +44,10 @@ add_definitions(
 set(INC
 	extern
 	superlu
-	../../extern/colamd/Include
 )
 
 set(INC_SYS
-
+	../../extern/colamd/Include
 )
 
 set(SRC
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript
index 711955c..a0f0273 100644
--- a/intern/opennl/SConscript
+++ b/intern/opennl/SConscript
@@ -5,8 +5,5 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c')
 
 incs = 'extern superlu ../../extern/colamd/Include'
 
-if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')):
-    env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] )
-else:
-    env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core'], priority=[55] )
+env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
 
diff --git a/intern/raskter/raskter.c b/intern/raskter/raskter.c
index c79bcc4..2115308 100644
--- a/intern/raskter/raskter.c
+++ b/intern/raskter/raskter.c
@@ -113,7 +113,7 @@ static void preprocess_all_edges(struct r_FillContext *ctx,
 			ctx->rb.xmin = xbeg;
 		}
 		if (ybeg >= ctx->rb.ymax) {
-			ctx->rb.ymax= ybeg;
+			ctx->rb.ymax = ybeg;
 		}
 		else if (ybeg <= ctx->rb.ymin) {
 			ctx->rb.ymin=ybeg;
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 9524f7b..3b8a4c0 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -26,10 +26,10 @@
 set(INC
 	intern
 	../memutil
-	../../extern/bullet2/src
 )
 
 set(INC_SYS
+	../../extern/bullet2/src
 	${PNG_INCLUDE_DIR}
 	${ZLIB_INCLUDE_DIRS}
 )
@@ -40,6 +40,7 @@ set(SRC
 	intern/FLUID_3D_SOLVERS.cpp
 	intern/FLUID_3D_STATIC.cpp
 	intern/LU_HELPER.cpp
+	intern/spectrum.cpp
 	intern/SPHERE.cpp
 	intern/WTURBULENCE.cpp
 	intern/smoke_API.cpp
@@ -53,6 +54,7 @@ set(SRC
 	intern/LU_HELPER.h
 	intern/MERSENNETWISTER.h
 	intern/OBSTACLE.h
+	intern/spectrum.h
 	intern/SPHERE.h
 	intern/VEC3.h
 	intern/WAVELET_NOISE.h
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index a0eb1bf..98c63f0 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -37,17 +37,23 @@ extern "C" {
 
 struct FLUID_3D;
 
-// export
-void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles);
-
 // low res
-struct FLUID_3D *smoke_init(int *res, float *p0, float dtdef);
+struct FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors);
 void smoke_free(struct FLUID_3D *fluid);
 
-void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
-void smoke_step(struct FLUID_3D *fluid, float dtSubdiv);
+void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
+						  float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp);
+void smoke_step(struct FLUID_3D *fluid, float gravity[3], float dtSubdiv);
 
 float *smoke_get_density(struct FLUID_3D *fluid);
+float *smoke_get_flame(struct FLUID_3D *fluid);
+float *smoke_get_fuel(struct FLUID_3D *fluid);
+float *smoke_get_react(struct FLUID_3D *fluid);
+float *smoke_get_color_r(struct FLUID_3D *fluid);
+float *smoke_get_color_g(struct FLUID_3D *fluid);
+float *smoke_get_color_b(struct FLUID_3D *fluid);
+void smoke_get_rgba(struct FLUID_3D *fluid, float *data, int sequential);
+void smoke_get_rgba_from_density(struct FLUID_3D *fluid, float color[3], float *data, int sequential);
 float *smoke_get_heat(struct FLUID_3D *fluid);
 float *smoke_get_velocity_x(struct FLUID_3D *fluid);
 float *smoke_get_velocity_y(struct FLUID_3D *fluid);
@@ -68,19 +74,44 @@ size_t smoke_get_index2d(int x, int max_x, int y);
 void smoke_dissolve(struct FLUID_3D *fluid, int speed, int log);
 
 // wavelet turbulence functions
-struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype);
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, int use_fire, int use_colors);
 void smoke_turbulence_free(struct WTURBULENCE *wt);
 void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
 
 float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
+float *smoke_turbulence_get_color_r(struct WTURBULENCE *wt);
+float *smoke_turbulence_get_color_g(struct WTURBULENCE *wt);
+float *smoke_turbulence_get_color_b(struct WTURBULENCE *wt);
+void smoke_turbulence_get_rgba(struct WTURBULENCE *wt, float *data, int sequential);
+void smoke_turbulence_get_rgba_from_density(struct WTURBULENCE *wt, float color[3], float *data, int sequential);
+float *smoke_turbulence_get_flame(struct WTURBULENCE *wt);
+float *smoke_turbulence_get_fuel(struct WTURBULENCE *wt);
+float *smoke_turbulence_get_react(struct WTURBULENCE *wt);
 void smoke_turbulence_get_res(struct WTURBULENCE *wt, int *res);
+int smoke_turbulence_get_cells(struct WTURBULENCE *wt);
 void smoke_turbulence_set_noise(struct WTURBULENCE *wt, int type);
 void smoke_initWaveletBlenderRNA(struct WTURBULENCE *wt, float *strength);
-
 void smoke_dissolve_wavelet(struct WTURBULENCE *wt, int speed, int log);
 
-// export
-void smoke_turbulence_export(struct WTURBULENCE *wt, float **dens, float **densold, float **tcu, float **tcv, float **tcw);
+/* export */
+void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **heatold,
+				  float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles);
+void smoke_turbulence_export(struct WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
+							 float **r, float **g, float **b, float **tcu, float **tcv, float **tcw);
+
+/* flame spectrum */
+void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2);
+
+/* data fields */
+int smoke_has_heat(struct FLUID_3D *fluid);
+int smoke_has_fuel(struct FLUID_3D *fluid);
+int smoke_has_colors(struct FLUID_3D *fluid);
+int smoke_turbulence_has_fuel(struct WTURBULENCE *wt);
+int smoke_turbulence_has_colors(struct WTURBULENCE *wt);
+
+void smoke_ensure_heat(struct FLUID_3D *fluid);
+void smoke_ensure_fire(struct FLUID_3D *fluid, struct WTURBULENCE *wt);
+void smoke_ensure_colors(struct FLUID_3D *fluid, struct WTURBULENCE *wt, float init_r, float init_g, float init_b);
 
 #ifdef __cplusplus
 }
diff --git a/intern/smoke/intern/FFT_NOISE.h b/intern/smoke/intern/FFT_NOISE.h
index a087b4e..8b7e4f2 100644
--- a/intern/smoke/intern/FFT_NOISE.h
+++ b/intern/smoke/intern/FFT_NOISE.h
@@ -167,6 +167,8 @@ static void generatTile_FFT(float* const noiseTileData, std::string filename)
 			for (int x = 0; x < xRes; x++, index++)
 				noise[index] -= forward[index][0] / totalCells;
 
+	// fill noiseTileData
+	memcpy(noiseTileData, noise, sizeof(float) * totalCells);
 	// save out the noise tile
 	saveTile(noise, filename);
 	
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index e006132..4eb11a4 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -44,16 +44,11 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
+FLUID_3D::FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors) :
 	_xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
 {
 	// set simulation consts
 	_dt = dtdef;	// just in case. set in step from a RNA factor
-	
-	// start point of array
-	_p0[0] = p0[0];
-	_p0[1] = p0[1];
-	_p0[2] = p0[2];
 
 	_iterations = 100;
 	_tempAmb = 0; 
@@ -72,7 +67,10 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 	*/
 	
 	// scale the constants according to the refinement of the grid
-	_dx = 1.0f / (float)_maxRes;
+	if (!dx)
+		_dx = 1.0f / (float)_maxRes;
+	else
+		_dx = dx;
 	_constantScaling = 64.0f / _maxRes;
 	_constantScaling = (_constantScaling < 1.0f) ? 1.0f : _constantScaling;
 	_vorticityEps = 2.0f / _constantScaling; // Just in case set a default value
@@ -94,8 +92,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 	_zForce       = new float[_totalCells];
 	_density      = new float[_totalCells];
 	_densityOld   = new float[_totalCells];
-	_heat         = new float[_totalCells];
-	_heatOld      = new float[_totalCells];
 	_obstacles    = new unsigned char[_totalCells]; // set 0 at end of step
 
 	// For threaded version:
@@ -103,7 +99,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 	_yVelocityTemp = new float[_totalCells];
 	_zVelocityTemp = new float[_totalCells];
 	_densityTemp   = new float[_totalCells];
-	_heatTemp      = new float[_totalCells];
 
 	// DG TODO: check if alloc went fine
 
@@ -111,8 +106,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 	{
 		_density[x]      = 0.0f;
 		_densityOld[x]   = 0.0f;
-		_heat[x]         = 0.0f;
-		_heatOld[x]      = 0.0f;
 		_xVelocity[x]    = 0.0f;
 		_yVelocity[x]    = 0.0f;
 		_zVelocity[x]    = 0.0f;
@@ -128,6 +121,25 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 		_obstacles[x]    = false;
 	}
 
+	/* heat */
+	_heat = _heatOld = _heatTemp = NULL;
+	if (init_heat) {
+		initHeat();
+	}
+	// Fire simulation
+	_flame = _fuel = _fuelTemp = _fuelOld = NULL;
+	_react = _reactTemp = _reactOld = NULL;
+	if (init_fire) {
+		initFire();
+	}
+	// Smoke color
+	_color_r = _color_rOld = _color_rTemp = NULL;
+	_color_g = _color_gOld = _color_gTemp = NULL;
+	_color_b = _color_bOld = _color_bTemp = NULL;
+	if (init_colors) {
+		initColors(0.0f, 0.0f, 0.0f);
+	}
+
 	// boundary conditions of the fluid domain
 	// set default values -> vertically non-colliding
 	_domainBcFront = true;
@@ -138,9 +150,70 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
 	_domainBcRight	= _domainBcLeft;
 
 	_colloPrev = 1;	// default value
+}
 
-	setBorderObstacles(); // walls
+void FLUID_3D::initHeat()
+{
+	if (!_heat) {
+		_heat         = new float[_totalCells];
+		_heatOld      = new float[_totalCells];
+		_heatTemp      = new float[_totalCells];
 
+		for (int x = 0; x < _totalCells; x++)
+		{
+			_heat[x]         = 0.0f;
+			_heatOld[x]      = 0.0f;
+		}
+	}
+}
+
+void FLUID_3D::initFire()
+{
+	if (!_flame) {
+		_flame		= new float[_totalCells];
+		_fuel		= new float[_totalCells];
+		_fuelTemp	= new float[_totalCells];
+		_fuelOld	= new float[_totalCells];
+		_react		= new float[_totalCells];
+		_reactTemp	= new float[_totalCells];
+		_reactOld	= new float[_totalCells];
+
+		for (int x = 0; x < _totalCells; x++)
+		{
+			_flame[x]		= 0.0f;
+			_fuel[x]		= 0.0f;
+			_fuelTemp[x]	= 0.0f;
+			_fuelOld[x]		= 0.0f;
+			_react[x]		= 0.0f;
+			_reactTemp[x]	= 0.0f;
+			_reactOld[x]	= 0.0f;
+		}
+	}
+}
+
+void FLUID_3D::initColors(float init_r, float init_g, float init_b)
+{
+	if (!_color_r) {
+		_color_r		= new float[_totalCells];
+		_color_rOld		= new float[_totalCells];
+		_color_rTemp	= new float[_totalCells];
+		_color_g		= new float[_totalCells];
+		_color_gOld		= new float[_totalCells];
+		_color_gTemp	= new float[_totalCells];
+		_color_b		= new float[_totalCells];
+		_color_bOld		= new float[_totalCells];
+		_color_bTemp	= new float[_totalCells];
+
+		for (int x = 0; x < _totalCells; x++)
+		{
+			_color_r[x]		= _density[x] * init_r;
+			_color_rOld[x]	= 0.0f;
+			_color_g[x]		= _density[x] * init_g;
+			_color_gOld[x]	= 0.0f;
+			_color_b[x]		= _density[x] * init_b;
+			_color_bOld[x]	= 0.0f;
+		}
+	}
 }
 
 void FLUID_3D::setBorderObstacles()
@@ -204,7 +277,6 @@ FLUID_3D::~FLUID_3D()
 	if (_heat) delete[] _heat;
 	if (_heatOld) delete[] _heatOld;
 	if (_obstacles) delete[] _obstacles;
-    // if (_wTurbulence) delete _wTurbulence;
 
 	if (_xVelocityTemp) delete[] _xVelocityTemp;
 	if (_yVelocityTemp) delete[] _yVelocityTemp;
@@ -212,23 +284,48 @@ FLUID_3D::~FLUID_3D()
 	if (_densityTemp) delete[] _densityTemp;
 	if (_heatTemp) delete[] _heatTemp;
 
+	if (_flame) delete[] _flame;
+	if (_fuel) delete[] _fuel;
+	if (_fuelTemp) delete[] _fuelTemp;
+	if (_fuelOld) delete[] _fuelOld;
+	if (_react) delete[] _react;
+	if (_reactTemp) delete[] _reactTemp;
+	if (_reactOld) delete[] _reactOld;
+
+	if (_color_r) delete[] _color_r;
+	if (_color_rOld) delete[] _color_rOld;
+	if (_color_rTemp) delete[] _color_rTemp;
+	if (_color_g) delete[] _color_g;
+	if (_color_gOld) delete[] _color_gOld;
+	if (_color_gTemp) delete[] _color_gTemp;
+	if (_color_b) delete[] _color_b;
+	if (_color_bOld) delete[] _color_bOld;
+	if (_color_bTemp) delete[] _color_bTemp;
+
     // printf("deleted fluid\n");
 }
 
 // init direct access functions from blender
-void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *borderCollision)
+void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *borderCollision, float *burning_rate,
+							  float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp)
 {
 	_alpha = alpha;
 	_beta = beta;
 	_dtFactor = dt_factor;
 	_vorticityRNA = vorticity;
 	_borderColli = borderCollision;
+	_burning_rate = burning_rate;
+	_flame_smoke = flame_smoke;
+	_flame_smoke_color = flame_smoke_color;
+	_flame_vorticity = flame_vorticity;
+	_ignition_temp = flame_ignition_temp;
+	_max_temp = flame_max_temp;
 }
 
 //////////////////////////////////////////////////////////////////////
 // step simulation once
 //////////////////////////////////////////////////////////////////////
-void FLUID_3D::step(float dt)
+void FLUID_3D::step(float dt, float gravity[3])
 {
 #if 0
 	// If border rules have been changed
@@ -281,7 +378,7 @@ void FLUID_3D::step(float dt)
 
 		wipeBoundariesSL(zBegin, zEnd);
 		addVorticity(zBegin, zEnd);
-		addBuoyancy(_heat, _density, zBegin, zEnd);
+		addBuoyancy(_heat, _density, gravity, zBegin, zEnd);
 		addForce(zBegin, zEnd);
 
 #if PARALLEL==1
@@ -312,13 +409,15 @@ void FLUID_3D::step(float dt)
 		if (i==0)
 		{
 #endif
-		project();
+			project();
 #if PARALLEL==1
 		}
-		else
+		else if (i==1)
 		{
 #endif
-		diffuseHeat();
+			if (_heat) {
+				diffuseHeat();
+			}
 #if PARALLEL==1
 		}
 	}
@@ -338,6 +437,13 @@ void FLUID_3D::step(float dt)
 	SWAP_POINTERS(_density, _densityOld);
 	SWAP_POINTERS(_heat, _heatOld);
 
+	SWAP_POINTERS(_fuel, _fuelOld);
+	SWAP_POINTERS(_react, _reactOld);
+
+	SWAP_POINTERS(_color_r, _color_rOld);
+	SWAP_POINTERS(_color_g, _color_gOld);
+	SWAP_POINTERS(_color_b, _color_bOld);
+
 	advectMacCormackBegin(0, _zRes);
 
 #if PARALLEL==1
@@ -398,11 +504,8 @@ void FLUID_3D::step(float dt)
 	SWAP_POINTERS(_yVelocity, _yForce);
 	SWAP_POINTERS(_zVelocity, _zForce);
 
-
-
-
 	_totalTime += _dt;
-	_totalSteps++;		
+	_totalSteps++;
 
 	for (int i = 0; i < _totalCells; i++)
 	{
@@ -643,6 +746,15 @@ void FLUID_3D::wipeBoundaries(int zBegin, int zEnd)
 	setZeroBorder(_yVelocity, _res, zBegin, zEnd);
 	setZeroBorder(_zVelocity, _res, zBegin, zEnd);
 	setZeroBorder(_density, _res, zBegin, zEnd);
+	if (_fuel) {
+		setZeroBorder(_fuel, _res, zBegin, zEnd);
+		setZeroBorder(_react, _res, zBegin, zEnd);
+	}
+	if (_color_r) {
+		setZeroBorder(_color_r, _res, zBegin, zEnd);
+		setZeroBorder(_color_g, _res, zBegin, zEnd);
+		setZeroBorder(_color_b, _res, zBegin, zEnd);
+	}
 }
 
 void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
@@ -668,6 +780,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 			_yVelocity[index] = 0.0f;
 			_zVelocity[index] = 0.0f;
 			_density[index] = 0.0f;
+			if (_fuel) {
+				_fuel[index] = 0.0f;
+				_react[index] = 0.0f;
+			}
+			if (_color_r) {
+				_color_r[index] = 0.0f;
+				_color_g[index] = 0.0f;
+				_color_b[index] = 0.0f;
+			}
 
 			// right slab
 			index += _xRes - 1;
@@ -675,6 +796,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 			_yVelocity[index] = 0.0f;
 			_zVelocity[index] = 0.0f;
 			_density[index] = 0.0f;
+			if (_fuel) {
+				_fuel[index] = 0.0f;
+				_react[index] = 0.0f;
+			}
+			if (_color_r) {
+				_color_r[index] = 0.0f;
+				_color_g[index] = 0.0f;
+				_color_b[index] = 0.0f;
+			}
 		}
 
 	/////////////////////////////////////
@@ -690,6 +820,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 			_yVelocity[index] = 0.0f;
 			_zVelocity[index] = 0.0f;
 			_density[index] = 0.0f;
+			if (_fuel) {
+				_fuel[index] = 0.0f;
+				_react[index] = 0.0f;
+			}
+			if (_color_r) {
+				_color_r[index] = 0.0f;
+				_color_g[index] = 0.0f;
+				_color_b[index] = 0.0f;
+			}
 
 			// top slab
 			index += slabSize - _xRes;
@@ -697,6 +836,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 			_yVelocity[index] = 0.0f;
 			_zVelocity[index] = 0.0f;
 			_density[index] = 0.0f;
+			if (_fuel) {
+				_fuel[index] = 0.0f;
+				_react[index] = 0.0f;
+			}
+			if (_color_r) {
+				_color_r[index] = 0.0f;
+				_color_g[index] = 0.0f;
+				_color_b[index] = 0.0f;
+			}
 
 		}
 
@@ -717,6 +865,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 			_yVelocity[index] = 0.0f;
 			_zVelocity[index] = 0.0f;
 			_density[index] = 0.0f;
+			if (_fuel) {
+				_fuel[index] = 0.0f;
+				_react[index] = 0.0f;
+			}
+			if (_color_r) {
+				_color_r[index] = 0.0f;
+				_color_g[index] = 0.0f;
+				_color_b[index] = 0.0f;
+			}
     }
 
 	if (zEnd == _zRes)
@@ -735,6 +892,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
 				_yVelocity[indexx] = 0.0f;
 				_zVelocity[indexx] = 0.0f;
 				_density[indexx] = 0.0f;
+				if (_fuel) {
+					_fuel[index] = 0.0f;
+					_react[index] = 0.0f;
+				}
+				if (_color_r) {
+					_color_r[index] = 0.0f;
+					_color_g[index] = 0.0f;
+					_color_b[index] = 0.0f;
+				}
 			}
 	}
 
@@ -781,35 +947,6 @@ void FLUID_3D::project()
 	if(!_domainBcTop) setNeumannZ(_zVelocity, _res, 0, _zRes);
 	else setZeroZ(_zVelocity, _res, 0, _zRes);
 
-	/*
-	{
-		float maxx = 0, maxy = 0, maxz = 0;
-		for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
-		{
-			if(_xVelocity[i] > maxx)
-				maxx = _xVelocity[i];
-			if(_yVelocity[i] > maxy)
-				maxy = _yVelocity[i];
-			if(_zVelocity[i] > maxz)
-				maxz = _zVelocity[i];
-		}
-		printf("Max velx: %f, vely: %f, velz: %f\n", maxx, maxy, maxz);
-	}
-	*/
-
-	/*
-	{
-		float maxvalue = 0;
-		for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
-		{
-			if(_heat[i] > maxvalue)
-				maxvalue = _heat[i];
-
-		}
-		printf("Max heat: %f\n", maxvalue);
-	}
-	*/
-
 	// calculate divergence
 	index = _slabSize + _xRes + 1;
 	for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
@@ -910,21 +1047,52 @@ void FLUID_3D::project()
 	setObstaclePressure(_pressure, 0, _zRes);
 
 	// project out solution
+	// New idea for code from NVIDIA graphic gems 3 - DG
 	float invDx = 1.0f / _dx;
 	index = _slabSize + _xRes + 1;
 	for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
 		for (y = 1; y < _yRes - 1; y++, index += 2)
 			for (x = 1; x < _xRes - 1; x++, index++)
 			{
+				float vMask[3] = {1.0f, 1.0f, 1.0f}, vObst[3] = {0, 0, 0};
+				float vR = 0.0f, vL = 0.0f, vT = 0.0f, vB = 0.0f, vD = 0.0f, vU = 0.0f;
+
+				float pC = _pressure[index]; // center
+				float pR = _pressure[index + 1]; // right
+				float pL = _pressure[index - 1]; // left
+				float pU = _pressure[index + _xRes]; // Up
+				float pD = _pressure[index - _xRes]; // Down
+				float pT = _pressure[index + _slabSize]; // top
+				float pB = _pressure[index - _slabSize]; // bottom
+
 				if(!_obstacles[index])
 				{
-					_xVelocity[index] -= 0.5f * (_pressure[index + 1]     - _pressure[index - 1]) * invDx;
-					_yVelocity[index] -= 0.5f * (_pressure[index + _xRes]  - _pressure[index - _xRes]) * invDx;
-					_zVelocity[index] -= 0.5f * (_pressure[index + _slabSize] - _pressure[index - _slabSize]) * invDx;
+					// DG TODO: What if obstacle is left + right and one of them is moving?
+					if(_obstacles[index+1])			{ pR = pC; vObst[0] = _xVelocityOb[index + 1];			vMask[0] = 0; }
+					if(_obstacles[index-1])			{ pL = pC; vObst[0]	= _xVelocityOb[index - 1];			vMask[0] = 0; }
+					if(_obstacles[index+_xRes])		{ pU = pC; vObst[1]	= _yVelocityOb[index + _xRes];		vMask[1] = 0; }
+					if(_obstacles[index-_xRes])		{ pD = pC; vObst[1]	= _yVelocityOb[index - _xRes];		vMask[1] = 0; }
+					if(_obstacles[index+_slabSize]) { pT = pC; vObst[2] = _zVelocityOb[index + _slabSize];	vMask[2] = 0; }
+					if(_obstacles[index-_slabSize]) { pB = pC; vObst[2]	= _zVelocityOb[index - _slabSize];	vMask[2] = 0; }
+
+					_xVelocity[index] -= 0.5f * (pR - pL) * invDx;
+					_yVelocity[index] -= 0.5f * (pU - pD) * invDx;
+					_zVelocity[index] -= 0.5f * (pT - pB) * invDx;
+
+					_xVelocity[index] = (vMask[0] * _xVelocity[index]) + vObst[0];
+					_yVelocity[index] = (vMask[1] * _yVelocity[index]) + vObst[1];
+					_zVelocity[index] = (vMask[2] * _zVelocity[index]) + vObst[2];
+				}
+				else
+				{
+					_xVelocity[index] = _xVelocityOb[index];
+					_yVelocity[index] = _yVelocityOb[index];
+					_zVelocity[index] = _zVelocityOb[index];
 				}
 			}
 
-	setObstacleVelocity(0, _zRes);
+	// DG: was enabled in original code but now we do this later
+	// setObstacleVelocity(0, _zRes);
 
 	if (_pressure) delete[] _pressure;
 	if (_divergence) delete[] _divergence;
@@ -1007,7 +1175,6 @@ void FLUID_3D::diffuseHeat()
 	for (int x = 0; x < _totalCells; x++)
 		if (_obstacles[x])
 			_heat[x] = 0.0f;
-
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -1175,7 +1342,7 @@ void FLUID_3D::setObstacleBoundaries(float *_pressure, int zBegin, int zEnd)
 //////////////////////////////////////////////////////////////////////
 // add buoyancy forces
 //////////////////////////////////////////////////////////////////////
-void FLUID_3D::addBuoyancy(float *heat, float *density, int zBegin, int zEnd)
+void FLUID_3D::addBuoyancy(float *heat, float *density, float gravity[3], int zBegin, int zEnd)
 {
 	int index = zBegin*_slabSize;
 
@@ -1183,17 +1350,26 @@ void FLUID_3D::addBuoyancy(float *heat, float *density, int zBegin, int zEnd)
 		for (int y = 0; y < _yRes; y++)
 			for (int x = 0; x < _xRes; x++, index++)
 			{
-				_zForce[index] += *_alpha * density[index] + (*_beta * (heat[index] - _tempAmb)); // DG: was _yForce, changed for Blender
+				float buoyancy = *_alpha * density[index] + (*_beta * (((heat) ? heat[index] : 0.0f) - _tempAmb));
+				_xForce[index] -= gravity[0] * buoyancy;
+				_yForce[index] -= gravity[1] * buoyancy;
+				_zForce[index] -= gravity[2] * buoyancy;
 			}
 }
 
+
 //////////////////////////////////////////////////////////////////////
 // add vorticity to the force field
 //////////////////////////////////////////////////////////////////////
+#define VORT_VEL(i, j) \
+	((_obstacles[obpos[(i)]] & 8) ? ((abs(objvelocity[(j)][obpos[(i)]]) > FLT_EPSILON) ? objvelocity[(j)][obpos[(i)]] : velocity[(j)][index]) : velocity[(j)][obpos[(i)]])
+
 void FLUID_3D::addVorticity(int zBegin, int zEnd)
 {
+	// set flame vorticity from RNA value
+	float flame_vorticity = (*_flame_vorticity)/_constantScaling;
 	//int x,y,z,index;
-	if(_vorticityEps<=0.) return;
+	if(_vorticityEps+flame_vorticity<=0.) return;
 
 	int _blockSize=zEnd-zBegin;
 	int _blockTotalCells = _slabSize * (_blockSize+2);
@@ -1225,9 +1401,18 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 	float gridSize = 0.5f / _dx;
 	//index = _slabSize + _xRes + 1;
 
+	float *velocity[3];
+	float *objvelocity[3];
 
-	size_t vIndex=_xRes + 1;
+	velocity[0] = _xVelocity;
+	velocity[1] = _yVelocity;
+	velocity[2] = _zVelocity;
+
+	objvelocity[0] = _xVelocityOb;
+	objvelocity[1] = _yVelocityOb;
+	objvelocity[2] = _zVelocityOb;
 
+	size_t vIndex=_xRes + 1;
 	for (int z = zBegin + bb1; z < (zEnd - bt1); z++)
 	{
 		size_t index = index_ +(z-1)*_slabSize;
@@ -1237,25 +1422,47 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 		{
 			for (int x = 1; x < _xRes - 1; x++, index++)
 			{
+				if (!_obstacles[index])
+				{
+					int obpos[6];
+
+					obpos[0] = (_obstacles[index + _xRes] == 1) ? index : index + _xRes; // up
+					obpos[1] = (_obstacles[index - _xRes] == 1) ? index : index - _xRes; // down
+					float dy = (obpos[0] == index || obpos[1] == index) ? 1.0f / _dx : gridSize;
+
+					obpos[2]  = (_obstacles[index + _slabSize] == 1) ? index : index + _slabSize; // out
+					obpos[3]  = (_obstacles[index - _slabSize] == 1) ? index : index - _slabSize; // in
+					float dz  = (obpos[2] == index || obpos[3] == index) ? 1.0f / _dx : gridSize;
+
+					obpos[4] = (_obstacles[index + 1] == 1) ? index : index + 1; // right
+					obpos[5] = (_obstacles[index - 1] == 1) ? index : index - 1; // left
+					float dx = (obpos[4] == index || obpos[5] == index) ? 1.0f / _dx : gridSize;
+
+					float xV[2], yV[2], zV[2];
+
+					zV[1] = VORT_VEL(0, 2);
+					zV[0] = VORT_VEL(1, 2);
+					yV[1] = VORT_VEL(2, 1);
+					yV[0] = VORT_VEL(3, 1);
+					_xVorticity[vIndex] = (zV[1] - zV[0]) * dy + (-yV[1] + yV[0]) * dz;
+
+					xV[1] = VORT_VEL(2, 0);
+					xV[0] = VORT_VEL(3, 0);
+					zV[1] = VORT_VEL(4, 2);
+					zV[0] = VORT_VEL(5, 2);
+					_yVorticity[vIndex] = (xV[1] - xV[0]) * dz + (-zV[1] + zV[0]) * dx;
+
+					yV[1] = VORT_VEL(4, 1);
+					yV[0] = VORT_VEL(5, 1);
+					xV[1] = VORT_VEL(0, 0);
+					xV[0] = VORT_VEL(1, 0);
+					_zVorticity[vIndex] = (yV[1] - yV[0]) * dx + (-xV[1] + xV[0])* dy;
 
-				int up    = _obstacles[index + _xRes] ? index : index + _xRes;
-				int down  = _obstacles[index - _xRes] ? index : index - _xRes;
-				float dy  = (up == index || down == index) ? 1.0f / _dx : gridSize;
-				int out   = _obstacles[index + _slabSize] ? index : index + _slabSize;
-				int in    = _obstacles[index - _slabSize] ? index : index - _slabSize;
-				float dz  = (out == index || in == index) ? 1.0f / _dx : gridSize;
-				int right = _obstacles[index + 1] ? index : index + 1;
-				int left  = _obstacles[index - 1] ? index : index - 1;
-				float dx  = (right == index || left == index) ? 1.0f / _dx : gridSize;
-
-				_xVorticity[vIndex] = (_zVelocity[up] - _zVelocity[down]) * dy + (-_yVelocity[out] + _yVelocity[in]) * dz;
-				_yVorticity[vIndex] = (_xVelocity[out] - _xVelocity[in]) * dz + (-_zVelocity[right] + _zVelocity[left]) * dx;
-				_zVorticity[vIndex] = (_yVelocity[right] - _yVelocity[left]) * dx + (-_xVelocity[up] + _xVelocity[down])* dy;
-
-				_vorticity[vIndex] = sqrtf(_xVorticity[vIndex] * _xVorticity[vIndex] +
+					_vorticity[vIndex] = sqrtf(_xVorticity[vIndex] * _xVorticity[vIndex] +
 						_yVorticity[vIndex] * _yVorticity[vIndex] +
 						_zVorticity[vIndex] * _zVorticity[vIndex]);
 
+				}
 				vIndex++;
 			}
 			vIndex+=2;
@@ -1284,15 +1491,18 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 				{
 					float N[3];
 
-					int up    = _obstacles[index + _xRes] ? vIndex : vIndex + _xRes;
-					int down  = _obstacles[index - _xRes] ? vIndex : vIndex - _xRes;
+					int up    = (_obstacles[index + _xRes] == 1) ? vIndex : vIndex + _xRes;
+					int down  = (_obstacles[index - _xRes] == 1) ? vIndex : vIndex - _xRes;
 					float dy  = (up == vIndex || down == vIndex) ? 1.0f / _dx : gridSize;
-					int out   = _obstacles[index + _slabSize] ? vIndex : vIndex + _slabSize;
-					int in    = _obstacles[index - _slabSize] ? vIndex : vIndex - _slabSize;
+
+					int out   = (_obstacles[index + _slabSize] == 1) ? vIndex : vIndex + _slabSize;
+					int in    = (_obstacles[index - _slabSize] == 1) ? vIndex : vIndex - _slabSize;
 					float dz  = (out == vIndex || in == vIndex) ? 1.0f / _dx : gridSize;
-					int right = _obstacles[index + 1] ? vIndex : vIndex + 1;
-					int left  = _obstacles[index - 1] ? vIndex : vIndex - 1;
+
+					int right = (_obstacles[index + 1] == 1) ? vIndex : vIndex + 1;
+					int left  = (_obstacles[index - 1] == 1) ? vIndex : vIndex - 1;
 					float dx  = (right == vIndex || left == vIndex) ? 1.0f / _dx : gridSize;
+
 					N[0] = (_vorticity[right] - _vorticity[left]) * dx;
 					N[1] = (_vorticity[up] - _vorticity[down]) * dy;
 					N[2] = (_vorticity[out] - _vorticity[in]) * dz;
@@ -1300,14 +1510,15 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 					float magnitude = sqrtf(N[0] * N[0] + N[1] * N[1] + N[2] * N[2]);
 					if (magnitude > FLT_EPSILON)
 					{
+						float flame_vort = (_fuel) ? _fuel[index]*flame_vorticity : 0.0f;
 						magnitude = 1.0f / magnitude;
 						N[0] *= magnitude;
 						N[1] *= magnitude;
 						N[2] *= magnitude;
 
-						_xForce[index] += (N[1] * _zVorticity[vIndex] - N[2] * _yVorticity[vIndex]) * _dx * eps;
-						_yForce[index] += (N[2] * _xVorticity[vIndex] - N[0] * _zVorticity[vIndex]) * _dx * eps;
-						_zForce[index] += (N[0] * _yVorticity[vIndex] - N[1] * _xVorticity[vIndex]) * _dx * eps;
+						_xForce[index] += (N[1] * _zVorticity[vIndex] - N[2] * _yVorticity[vIndex]) * _dx * (eps + flame_vort);
+						_yForce[index] += (N[2] * _xVorticity[vIndex] - N[0] * _zVorticity[vIndex]) * _dx * (eps + flame_vort);
+						_zForce[index] += (N[0] * _yVorticity[vIndex] - N[1] * _xVorticity[vIndex]) * _dx * (eps + flame_vort);
 					}
 					}	// if
 					vIndex++;
@@ -1328,14 +1539,9 @@ void FLUID_3D::advectMacCormackBegin(int zBegin, int zEnd)
 {
 	Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
 
-	if(!_domainBcLeft) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
-	else setZeroX(_xVelocityOld, res, zBegin, zEnd);
-
-	if(!_domainBcFront) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
-	else setZeroY(_yVelocityOld, res, zBegin, zEnd); 
-
-	if(!_domainBcTop) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
-	else setZeroZ(_zVelocityOld, res, zBegin, zEnd);
+	setZeroX(_xVelocityOld, res, zBegin, zEnd);
+	setZeroY(_yVelocityOld, res, zBegin, zEnd);
+	setZeroZ(_zVelocityOld, res, zBegin, zEnd);
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -1355,7 +1561,18 @@ void FLUID_3D::advectMacCormackEnd1(int zBegin, int zEnd)
 	// advectFieldMacCormack1(dt, xVelocity, yVelocity, zVelocity, oldField, newField, res)
 
 	advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _densityOld, _densityTemp, res, zBegin, zEnd);
-	advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heatTemp, res, zBegin, zEnd);
+	if (_heat) {
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heatTemp, res, zBegin, zEnd);
+	}
+	if (_fuel) {
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _fuelOld, _fuelTemp, res, zBegin, zEnd);
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _reactOld, _reactTemp, res, zBegin, zEnd);
+	}
+	if (_color_r) {
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_rOld, _color_rTemp, res, zBegin, zEnd);
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_gOld, _color_gTemp, res, zBegin, zEnd);
+		advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_bOld, _color_bTemp, res, zBegin, zEnd);
+	}
 	advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _xVelocityOld, _xVelocity, res, zBegin, zEnd);
 	advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocity, res, zBegin, zEnd);
 	advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocity, res, zBegin, zEnd);
@@ -1371,17 +1588,30 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
 	const float dt0 = _dt / _dx;
 	Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
 
-	// use force array as temp arrays
+	// use force array as temp array
 	float* t1 = _xForce;
 
 	// advectFieldMacCormack2(dt, xVelocity, yVelocity, zVelocity, oldField, newField, tempfield, temp, res, obstacles)
 
+	/* finish advection */
 	advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _densityOld, _density, _densityTemp, t1, res, _obstacles, zBegin, zEnd);
-	advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heat, _heatTemp, t1, res, _obstacles, zBegin, zEnd);
+	if (_heat) {
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heat, _heatTemp, t1, res, _obstacles, zBegin, zEnd);
+	}
+	if (_fuel) {
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _fuelOld, _fuel, _fuelTemp, t1, res, _obstacles, zBegin, zEnd);
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _reactOld, _react, _reactTemp, t1, res, _obstacles, zBegin, zEnd);
+	}
+	if (_color_r) {
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_rOld, _color_r, _color_rTemp, t1, res, _obstacles, zBegin, zEnd);
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_gOld, _color_g, _color_gTemp, t1, res, _obstacles, zBegin, zEnd);
+		advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_bOld, _color_b, _color_bTemp, t1, res, _obstacles, zBegin, zEnd);
+	}
 	advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _xVelocityOld, _xVelocityTemp, _xVelocity, t1, res, _obstacles, zBegin, zEnd);
 	advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocityTemp, _yVelocity, t1, res, _obstacles, zBegin, zEnd);
 	advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocityTemp, _zVelocity, t1, res, _obstacles, zBegin, zEnd);
 
+	/* set boundary conditions for velocity */
 	if(!_domainBcLeft) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
 	else setZeroX(_xVelocityTemp, res, zBegin, zEnd);				
 
@@ -1391,40 +1621,71 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
 	if(!_domainBcTop) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
 	else setZeroZ(_zVelocityTemp, res, zBegin, zEnd);
 
+	/* clear data boundaries */
 	setZeroBorder(_density, res, zBegin, zEnd);
-	setZeroBorder(_heat, res, zBegin, zEnd);
-#if 0
-	{
-	const size_t index_ = _slabSize + _xRes + 1;
-	int bb=0;
-	int bt=0;
+	if (_fuel) {
+		setZeroBorder(_fuel, res, zBegin, zEnd);
+		setZeroBorder(_react, res, zBegin, zEnd);
+	}
+	if (_color_r) {
+		setZeroBorder(_color_r, res, zBegin, zEnd);
+		setZeroBorder(_color_g, res, zBegin, zEnd);
+		setZeroBorder(_color_b, res, zBegin, zEnd);
+	}
+}
 
-	if (zBegin == 0) {bb = 1;}
-	if (zEnd == _zRes) {bt = 1;}
-	
-	for (int z = zBegin + bb; z < zEnd - bt; z++)
+
+void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
+						   float *r, float *g, float *b, int total_cells, float dt)
+{
+	float burning_rate = *_burning_rate;
+	float flame_smoke = *_flame_smoke;
+	float ignition_point = *_ignition_temp;
+	float temp_max = *_max_temp;
+
+	for (int index = 0; index < total_cells; index++)
 	{
-		size_t index = index_ +(z-1)*_slabSize;
+		float orig_fuel = fuel[index];
+		float orig_smoke = smoke[index];
+		float smoke_emit = 0.0f;
+		float react_coord = 0.0f;
+
+		/* process fuel */
+		fuel[index] -= burning_rate * dt;
+		if (fuel[index] < 0.0f) fuel[index] = 0.0f;
+		/* process reaction coordinate */
+		if (orig_fuel) {
+			react[index] *= fuel[index]/orig_fuel;
+			react_coord = react[index];
+		}
+		else {
+			react[index] = 0.0f;
+		}
 
-		for (int y = 1; y < _yRes - 1; y++, index += 2)
-		{
-			for (int x = 1; x < _xRes - 1; x++, index++)
-			{
-				// clean custom velocities from moving obstacles again
-				if (_obstacles[index])
-				{
-					_xVelocity[index] =
-					_yVelocity[index] =
-					_zVelocity[index] = 0.0f;
-				}
-			}
+		/* emit smoke based on fuel burn rate and "flame_smoke" factor */
+		smoke_emit = (orig_fuel < 1.0f) ? (1.0f - orig_fuel)*0.5f : 0.0f;
+		smoke_emit = (smoke_emit + 0.5f) * (orig_fuel-fuel[index]) * 0.1f * flame_smoke;
+		smoke[index] += smoke_emit;
+		CLAMP(smoke[index], 0.0f, 1.0f);
+
+		/* model flame temperature curve from the reaction coordinate (fuel) */
+		if (react_coord>0.0f) {
+			/* do a smooth falloff for rest of the values */
+			flame[index] = pow(react_coord, 0.5f);
+		}
+		else
+			flame[index] = 0.0f;
+
+		/* set fluid temperature from the flame temperature profile */
+		if (heat && flame[index])
+			heat[index] = (1.0f-flame[index])*ignition_point + flame[index]*temp_max;
+
+		/* mix new color */
+		if (r && smoke_emit) {
+			float smoke_factor = smoke[index]/(orig_smoke+smoke_emit);
+			r[index] = (r[index] + _flame_smoke_color[0] * smoke_emit) * smoke_factor;
+			g[index] = (g[index] + _flame_smoke_color[1] * smoke_emit) * smoke_factor;
+			b[index] = (b[index] + _flame_smoke_color[2] * smoke_emit) * smoke_factor;
 		}
 	}
-	}
-#endif
-
-	/*int begin=zBegin * _slabSize;
-	int end=begin + (zEnd - zBegin) * _slabSize;
-  for (int x = begin; x < end; x++)
-    _xForce[x] = _yForce[x] = 0.0f;*/
 }
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index ac77148..8cadf3b 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -46,11 +46,16 @@ class WTURBULENCE;
 class FLUID_3D  
 {
 	public:
-		FLUID_3D(int *res, /* int amplify, */ float *p0, float dtdef);
+		FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors);
 		FLUID_3D() {};
 		virtual ~FLUID_3D();
 
-		void initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
+		void initHeat();
+		void initFire();
+		void initColors(float init_r, float init_g, float init_b);
+
+		void initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
+							float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *ignition_temp, float *max_temp);
 		
 		// create & allocate vector noise advection 
 		void initVectorNoise(int amplify);
@@ -58,7 +63,7 @@ class FLUID_3D
 		void addSmokeColumn();
 		static void addSmokeTestCase(float* field, Vec3Int res);
 
-		void step(float dt);
+		void step(float dt, float gravity[3]);
 		void addObstacle(OBSTACLE* obstacle);
 
 		const float* xVelocity() { return _xVelocity; }; 
@@ -115,6 +120,27 @@ class FLUID_3D
 		float* _heatTemp;
 		float* _densityTemp;
 
+		// fire simulation
+		float *_flame;
+		float *_fuel;
+		float *_fuelTemp;
+		float *_fuelOld;
+		float *_react;
+		float *_reactTemp;
+		float *_reactOld;
+
+		// smoke color
+		float *_color_r;
+		float *_color_rOld;
+		float *_color_rTemp;
+		float *_color_g;
+		float *_color_gOld;
+		float *_color_gTemp;
+		float *_color_b;
+		float *_color_bOld;
+		float *_color_bTemp;
+
+
 		// CG fields
 		int _iterations;
 
@@ -153,14 +179,16 @@ class FLUID_3D
 		void wipeBoundariesSL(int zBegin, int zEnd);
 		void addForce(int zBegin, int zEnd);
 		void addVorticity(int zBegin, int zEnd);
-		void addBuoyancy(float *heat, float *density, int zBegin, int zEnd);
+		void addBuoyancy(float *heat, float *density, float gravity[3], int zBegin, int zEnd);
 
 		// solver stuff
 		void project();
 		void diffuseHeat();
+		void diffuseColor();
 		void solvePressure(float* field, float* b, unsigned char* skip);
 		void solvePressurePre(float* field, float* b, unsigned char* skip);
 		void solveHeat(float* field, float* b, unsigned char* skip);
+		void solveDiffusion(float* field, float* b, float* factor);
 
 
 		// handle obstacle boundaries
@@ -174,6 +202,16 @@ class FLUID_3D
 		void advectMacCormackEnd1(int zBegin, int zEnd);
 		void advectMacCormackEnd2(int zBegin, int zEnd);
 
+		/* burning */
+		float *_burning_rate; // RNA pointer
+		float *_flame_smoke; // RNA pointer
+		float *_flame_smoke_color; // RNA pointer
+		float *_flame_vorticity; // RNA pointer
+		float *_ignition_temp; // RNA pointer
+		float *_max_temp; // RNA pointer
+		void processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
+						 float *r, float *g, float *b, int total_cells, float dt);
+
 		// boundary setting functions
 		static void copyBorderX(float* field, Vec3Int res, int zBegin, int zEnd);
 		static void copyBorderY(float* field, Vec3Int res, int zBegin, int zEnd);
diff --git a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
index 3cf94eb..42a8b2d 100644
--- a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
+++ b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
@@ -165,7 +165,6 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip)
 	if (_Acenter)  delete[] _Acenter;
 }
 
-
 void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
 {
 	int x, y, z;
diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp
index c7a0ddc..ac485ad 100644
--- a/intern/smoke/intern/FLUID_3D_STATIC.cpp
+++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp
@@ -92,18 +92,10 @@ void FLUID_3D::setNeumannX(float* field, Vec3Int res, int zBegin, int zEnd)
 			// left slab
 			index = y * res[0] + z * slabSize;
 			field[index] = field[index + 2];
-			/* only allow outwards flux */
-			if(field[index]>0.) field[index] = 0.;
-			index += 1;
-			if(field[index]>0.) field[index] = 0.;
 
 			// right slab
 			index = y * res[0] + z * slabSize + res[0] - 1;
 			field[index] = field[index - 2];
-			/* only allow outwards flux */
-			if(field[index]<0.) field[index] = 0.;
-			index -= 1;
-			if(field[index]<0.) field[index] = 0.;
 		}
  }
 
@@ -120,18 +112,10 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res, int zBegin, int zEnd)
 			// front slab
 			index = x + z * slabSize;
 			field[index] = field[index + 2 * res[0]];
-			/* only allow outwards flux */
-			if(field[index]>0.) field[index] = 0.;
-			index += res[0];
-			if(field[index]>0.) field[index] = 0.;
 
 			// back slab
 			index = x + z * slabSize + slabSize - res[0];
 			field[index] = field[index - 2 * res[0]];
-			/* only allow outwards flux */
-			if(field[index]<0.) field[index] = 0.;
-			index -= res[0];
-			if(field[index]<0.) field[index] = 0.;
 		}
 }
 
@@ -152,14 +136,6 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
 				// front slab
 				index = x + y * res[0];
 				field[index] = field[index + 2 * slabSize];
-				/* only allow outwards flux */
-
-				// DG: Disable this for z-axis.
-				// The problem is that smoke somehow gets sucked in again
-				// from the TOP slab when this is enabled
-				// if(field[index]>0.) field[index] = 0.;
-				// index += slabSize;
-				// if(field[index]>0.) field[index] = 0.;
 			}
 	}
 
@@ -170,10 +146,6 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
 				// back slab
 				index = x + y * res[0] + cellsslab;
 				field[index] = field[index - 2 * slabSize];
-				/* only allow outwards flux */
-				if(field[index]<0.) field[index] = 0.;
-				index -= slabSize;
-				if(field[index]<0.) field[index] = 0.;
 			}
 	}
 		
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index 6711980..5b6509a 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -51,7 +51,7 @@ static const float persistence = 0.56123f;
 //////////////////////////////////////////////////////////////////////
 // constructor
 //////////////////////////////////////////////////////////////////////
-WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype)
+WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, int init_fire, int init_colors)
 {
 	// if noise magnitude is below this threshold, its contribution
 	// is negilgible, so stop evaluating new octaves
@@ -87,12 +87,26 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
 	// allocate high resolution density field
 	_totalStepsBig = 0;
 	_densityBig = new float[_totalCellsBig];
-	_densityBigOld = new float[_totalCellsBig]; 
+	_densityBigOld = new float[_totalCellsBig];
 	
 	for(int i = 0; i < _totalCellsBig; i++) {
 		_densityBig[i] = 
 		_densityBigOld[i] = 0.;
 	}
+
+	/* fire */
+	_flameBig = _fuelBig = _fuelBigOld = NULL;
+	_reactBig = _reactBigOld = NULL;
+	if (init_fire) {
+		initFire();
+	}
+	/* colors */
+	_color_rBig = _color_rBigOld = NULL;
+	_color_gBig = _color_gBigOld = NULL;
+	_color_bBig = _color_bBigOld = NULL;
+	if (init_colors) {
+		initColors(0.0f, 0.0f, 0.0f);
+	}
 	
 	// allocate & init texture coordinates
 	_tcU = new float[_totalCellsSm];
@@ -128,12 +142,64 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
 	*/
 }
 
+void WTURBULENCE::initFire()
+{
+	if (!_fuelBig) {
+		_flameBig = new float[_totalCellsBig];
+		_fuelBig = new float[_totalCellsBig];
+		_fuelBigOld = new float[_totalCellsBig];
+		_reactBig = new float[_totalCellsBig];
+		_reactBigOld = new float[_totalCellsBig];
+
+		for(int i = 0; i < _totalCellsBig; i++) {
+			_flameBig[i] = 
+			_fuelBig[i] = 
+			_fuelBigOld[i] = 0.;
+			_reactBig[i] = 
+			_reactBigOld[i] = 0.;
+		}
+	}
+}
+
+void WTURBULENCE::initColors(float init_r, float init_g, float init_b)
+{
+	if (!_color_rBig) {
+		_color_rBig = new float[_totalCellsBig];
+		_color_rBigOld = new float[_totalCellsBig];
+		_color_gBig = new float[_totalCellsBig];
+		_color_gBigOld = new float[_totalCellsBig];
+		_color_bBig = new float[_totalCellsBig];
+		_color_bBigOld = new float[_totalCellsBig];
+
+		for(int i = 0; i < _totalCellsBig; i++) {
+			_color_rBig[i] = _densityBig[i] * init_r;
+			_color_rBigOld[i] = 0.0f;
+			_color_gBig[i] = _densityBig[i] * init_g;
+			_color_gBigOld[i] = 0.0f;
+			_color_bBig[i] = _densityBig[i] * init_b;
+			_color_bBigOld[i] = 0.0f;
+		}
+	}
+}
+
 //////////////////////////////////////////////////////////////////////
 // destructor
 //////////////////////////////////////////////////////////////////////
 WTURBULENCE::~WTURBULENCE() {
   delete[] _densityBig;
   delete[] _densityBigOld;
+  if (_flameBig) delete[] _flameBig;
+  if (_fuelBig) delete[] _fuelBig;
+  if (_fuelBigOld) delete[] _fuelBigOld;
+  if (_reactBig) delete[] _reactBig;
+  if (_reactBigOld) delete[] _reactBigOld;
+
+  if (_color_rBig) delete[] _color_rBig;
+  if (_color_rBigOld) delete[] _color_rBigOld;
+  if (_color_gBig) delete[] _color_gBig;
+  if (_color_gBigOld) delete[] _color_gBigOld;
+  if (_color_bBig) delete[] _color_bBig;
+  if (_color_bBigOld) delete[] _color_bBigOld;
 
   delete[] _tcU;
   delete[] _tcV;
@@ -154,21 +220,25 @@ void WTURBULENCE::setNoise(int type)
 {
 	if(type == (1<<1)) // FFT
 	{
+#ifdef WITH_FFTW3
 		// needs fft
-		#ifdef WITH_FFTW3
 		std::string noiseTileFilename = std::string("noise.fft");
 		generatTile_FFT(_noiseTile, noiseTileFilename);
-		#endif
+		return;
+#else
+		fprintf(stderr, "FFTW not enabled, falling back to wavelet noise.\n");
+#endif
 	}
-	else if(type == (1<<2)) // curl
+#if 0
+	if(type == (1<<2)) // curl
 	{
 		// TODO: not supported yet
+		return;
 	}
-	else // standard - wavelet
-	{
-		std::string noiseTileFilename = std::string("noise.wavelets");
-		generateTile_WAVELET(_noiseTile, noiseTileFilename);
-	}
+#endif
+
+	std::string noiseTileFilename = std::string("noise.wavelets");
+	generateTile_WAVELET(_noiseTile, noiseTileFilename);
 }
 
 // init direct access functions from blender
@@ -757,8 +827,10 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 	// enlarge timestep to match grid
 	const float dt = dtOrg * _amplify;
 	const float invAmp = 1.0f / _amplify;
-	float *tempBig1 = (float *)calloc(_totalCellsBig, sizeof(float));
-	float *tempBig2 = (float *)calloc(_totalCellsBig, sizeof(float));
+	float *tempFuelBig = NULL, *tempReactBig = NULL;
+	float *tempColor_rBig = NULL, *tempColor_gBig = NULL, *tempColor_bBig = NULL;
+	float *tempDensityBig = (float *)calloc(_totalCellsBig, sizeof(float));
+	float *tempBig = (float *)calloc(_totalCellsBig, sizeof(float));
 	float *bigUx = (float *)calloc(_totalCellsBig, sizeof(float));
 	float *bigUy = (float *)calloc(_totalCellsBig, sizeof(float));
 	float *bigUz = (float *)calloc(_totalCellsBig, sizeof(float)); 
@@ -767,11 +839,21 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 	float *eigMin  = (float *)calloc(_totalCellsSm, sizeof(float));
 	float *eigMax  = (float *)calloc(_totalCellsSm, sizeof(float));
 
+	if (_fuelBig) {
+		tempFuelBig = (float *)calloc(_totalCellsBig, sizeof(float));
+		tempReactBig = (float *)calloc(_totalCellsBig, sizeof(float));
+	}
+	if (_color_rBig) {
+		tempColor_rBig = (float *)calloc(_totalCellsBig, sizeof(float));
+		tempColor_gBig = (float *)calloc(_totalCellsBig, sizeof(float));
+		tempColor_bBig = (float *)calloc(_totalCellsBig, sizeof(float));
+	}
+
 	memset(_tcTemp, 0, sizeof(float)*_totalCellsSm);
 
 
 	// prepare textures
-	advectTextureCoordinates(dtOrg, xvel,yvel,zvel, tempBig1, tempBig2);
+	advectTextureCoordinates(dtOrg, xvel,yvel,zvel, tempDensityBig, tempBig);
 
 	// do wavelet decomposition of energy
 	computeEnergy(_energy, xvel, yvel, zvel, obstacles);
@@ -972,6 +1054,11 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 
   // prepare density for an advection
   SWAP_POINTERS(_densityBig, _densityBigOld);
+  SWAP_POINTERS(_fuelBig, _fuelBigOld);
+  SWAP_POINTERS(_reactBig, _reactBigOld);
+  SWAP_POINTERS(_color_rBig, _color_rBigOld);
+  SWAP_POINTERS(_color_gBig, _color_gBigOld);
+  SWAP_POINTERS(_color_bBig, _color_bBigOld);
 
   // based on the maximum velocity present, see if we need to substep,
   // but cap the maximum number of substeps to 5
@@ -1017,7 +1104,21 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 		int zEnd = (int)((float)(i+1)*partSize + 0.5f);
 #endif
 		FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
-		    _densityBigOld, tempBig1, _resBig, zBegin, zEnd);
+		    _densityBigOld, tempDensityBig, _resBig, zBegin, zEnd);
+		if (_fuelBig) {
+			FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
+				_fuelBigOld, tempFuelBig, _resBig, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
+				_reactBigOld, tempReactBig, _resBig, zBegin, zEnd);
+		}
+		if (_color_rBig) {
+			FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_rBigOld, tempColor_rBig, _resBig, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_gBigOld, tempColor_gBig, _resBig, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_bBigOld, tempColor_bBig, _resBig, zBegin, zEnd);
+		}
 #if PARALLEL==1
 	}
 
@@ -1030,18 +1131,43 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 		int zEnd = (int)((float)(i+1)*partSize + 0.5f);
 #endif
 		FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
-		    _densityBigOld, _densityBig, tempBig1, tempBig2, _resBig, NULL, zBegin, zEnd);
+		    _densityBigOld, _densityBig, tempDensityBig, tempBig, _resBig, NULL, zBegin, zEnd);
+		if (_fuelBig) {
+			FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
+				_fuelBigOld, _fuelBig, tempFuelBig, tempBig, _resBig, NULL, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
+				_reactBigOld, _reactBig, tempReactBig, tempBig, _resBig, NULL, zBegin, zEnd);
+		}
+		if (_color_rBig) {
+			FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_rBigOld, _color_rBig, tempColor_rBig, tempBig, _resBig, NULL, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_gBigOld, _color_gBig, tempColor_gBig, tempBig, _resBig, NULL, zBegin, zEnd);
+			FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz, 
+				_color_bBigOld, _color_bBig, tempColor_bBig, tempBig, _resBig, NULL, zBegin, zEnd);
+		}
 #if PARALLEL==1
 	}
 	}
 #endif
 
-    if (substep < totalSubsteps - 1) 
+	if (substep < totalSubsteps - 1) {
       SWAP_POINTERS(_densityBig, _densityBigOld);
+	  SWAP_POINTERS(_fuelBig, _fuelBigOld);
+	  SWAP_POINTERS(_reactBig, _reactBigOld);
+	  SWAP_POINTERS(_color_rBig, _color_rBigOld);
+	  SWAP_POINTERS(_color_gBig, _color_gBigOld);
+	  SWAP_POINTERS(_color_bBig, _color_bBigOld);
+	}
   } // substep
 
-  free(tempBig1);
-  free(tempBig2);
+  free(tempDensityBig);
+  if (tempFuelBig) free(tempFuelBig);
+  if (tempReactBig) free(tempReactBig);
+  if (tempColor_rBig) free(tempColor_rBig);
+  if (tempColor_gBig) free(tempColor_gBig);
+  if (tempColor_bBig) free(tempColor_bBig);
+  free(tempBig);
   free(bigUx);
   free(bigUy);
   free(bigUz);
@@ -1050,6 +1176,15 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
   
   // wipe the density borders
   FLUID_3D::setZeroBorder(_densityBig, _resBig, 0 , _resBig[2]);
+  if (_fuelBig) {
+	FLUID_3D::setZeroBorder(_fuelBig, _resBig, 0 , _resBig[2]);
+	FLUID_3D::setZeroBorder(_reactBig, _resBig, 0 , _resBig[2]);
+  }
+  if (_color_rBig) {
+	  FLUID_3D::setZeroBorder(_color_rBig, _resBig, 0 , _resBig[2]);
+	  FLUID_3D::setZeroBorder(_color_gBig, _resBig, 0 , _resBig[2]);
+	  FLUID_3D::setZeroBorder(_color_bBig, _resBig, 0 , _resBig[2]);
+  }
     
   // reset texture coordinates now in preparation for next timestep
   // Shouldn't do this before generating the noise because then the 
diff --git a/intern/smoke/intern/WTURBULENCE.h b/intern/smoke/intern/WTURBULENCE.h
index f31ca10..1655bd9 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -36,10 +36,13 @@ class WTURBULENCE
 {
 	public:
 		// both config files can be NULL, altCfg might override values from noiseCfg
-		WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype);
+		WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, int init_fire, int init_colors);
 
 		/// destructor
 		virtual ~WTURBULENCE();
+
+		void initFire();
+		void initColors(float init_r, float init_g, float init_b);
 		
 		void setNoise(int type);
 		void initBlenderRNA(float *strength);
@@ -63,6 +66,8 @@ class WTURBULENCE
 
 		// access functions
 		inline float* getDensityBig() { return _densityBig; }
+		inline float* getFlameBig() { return _flameBig; }
+		inline float* getFuelBig() { return _fuelBig; }
 		inline float* getArrayTcU() { return _tcU; }
 		inline float* getArrayTcV() { return _tcV; }
 		inline float* getArrayTcW() { return _tcW; }
@@ -111,6 +116,18 @@ class WTURBULENCE
 
 		float* _densityBig;
 		float* _densityBigOld;
+		float* _flameBig;
+		float* _fuelBig;
+		float* _fuelBigOld;
+		float* _reactBig;
+		float* _reactBigOld;
+
+		float* _color_rBig;
+		float* _color_rBigOld;
+		float* _color_gBig;
+		float* _color_gBigOld;
+		float* _color_bBig;
+		float* _color_bBigOld;
 
 		// texture coordinates for noise
 		float* _tcU;
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 4bbf8e0..6011de0 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -30,6 +30,7 @@
 
 #include "FLUID_3D.h"
 #include "WTURBULENCE.h"
+#include "spectrum.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -37,22 +38,16 @@
 
 #include "../extern/smoke_API.h"  /* to ensure valid prototypes */
 
-// y in smoke is z in blender
-extern "C" FLUID_3D *smoke_init(int *res, float *p0, float dtdef)
+extern "C" FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors)
 {
-	// smoke lib uses y as top-bottom/vertical axis where blender uses z
-	FLUID_3D *fluid = new FLUID_3D(res, p0, dtdef);
-
-	// printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]);
-
+	FLUID_3D *fluid = new FLUID_3D(res, dx, dtdef, use_heat, use_fire, use_colors);
 	return fluid;
 }
 
-extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype)
+extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, int use_fire, int use_colors)
 {
-	// initialize wavelet turbulence
-	if(amplify)
-		return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype);
+	if (amplify)
+		return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype, use_fire, use_colors);
 	else 
 		return NULL;
 }
@@ -71,7 +66,6 @@ extern "C" void smoke_turbulence_free(WTURBULENCE *wt)
 
 extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */)
 {
-	// // const int index = x + y * smd->res[0] + z * smd->res[0]*smd->res[1];
 	return x + y * max_x + z * max_x*max_y;
 }
 
@@ -80,137 +74,133 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
 	return x + y * max_x;
 }
 
-extern "C" void smoke_step(FLUID_3D *fluid, float dtSubdiv)
+extern "C" void smoke_step(FLUID_3D *fluid, float gravity[3], float dtSubdiv)
 {
-	fluid->step(dtSubdiv);
+	if (fluid->_fuel) {
+		fluid->processBurn(fluid->_fuel, fluid->_density, fluid->_react, fluid->_flame, fluid->_heat,
+						   fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_totalCells, (*fluid->_dtFactor)*dtSubdiv);
+	}
+	fluid->step(dtSubdiv, gravity);
 }
 
 extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
 {
+	if (wt->_fuelBig) {
+		fluid->processBurn(wt->_fuelBig, wt->_densityBig, wt->_reactBig, wt->_flameBig, 0,
+						   wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_totalCellsBig, fluid->_dt);
+	}
 	wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles); 
 }
 
-extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli)
+extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
+									 float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp)
 {
-	fluid->initBlenderRNA(alpha, beta, dt_factor, vorticity, border_colli);
+	fluid->initBlenderRNA(alpha, beta, dt_factor, vorticity, border_colli, burning_rate, flame_smoke, flame_smoke_color, flame_vorticity, flame_ignition_temp, flame_max_temp);
 }
 
-extern "C" void smoke_dissolve(FLUID_3D *fluid, int speed, int log)
+extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
 {
-	float *density = fluid->_density;
-	//float *densityOld = fluid->_densityOld;
-	float *heat = fluid->_heat;
-
-	if(log)
-	{
-		/* max density/speed = dydx */
-		float dydx = 1.0 / (float)speed;
-		size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
-
-		for(size_t i = 0; i < size; i++)
-		{
-			density[i] *= (1.0 - dydx);
-
-			if(density[i] < 0.0f)
-				density[i] = 0.0f;
-
-			heat[i] *= (1.0 - dydx);
-
-			/*if(heat[i] < 0.0f)
-				heat[i] = 0.0f;*/
-		}
-	}
-	else // linear falloff
-	{
-		/* max density/speed = dydx */
-		float dydx = 1.0 / (float)speed;
-		size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
-
-		for(size_t i = 0; i < size; i++)
-		{
-			density[i] -= dydx;
-
-			if(density[i] < 0.0f)
-				density[i] = 0.0f;
-
-			if(abs(heat[i]) < dydx) heat[i] = 0.0f;
-			else if (heat[i]>0.0f) heat[i] -= dydx;
-			else if (heat[i]<0.0f) heat[i] += dydx;
-				
-		}
-	}
+	wt->initBlenderRNA(strength);
 }
 
-extern "C" void smoke_dissolve_wavelet(WTURBULENCE *wt, int speed, int log)
+static void data_dissolve(float *density, float *heat, float *r, float *g, float *b, int total_cells, int speed, int log)
 {
-	float *density = wt->getDensityBig();
-	Vec3Int r = wt->getResBig();
-
-	if(log)
-	{
+	if (log) {
 		/* max density/speed = dydx */
-		float dydx = 1.0 / (float)speed;
-		size_t size= r[0] * r[1] * r[2];
+		float fac = 1.0f - (1.0f / (float)speed);
 
-		for(size_t i = 0; i < size; i++)
+		for(size_t i = 0; i < total_cells; i++)
 		{
-			density[i] *= (1.0 - dydx);
-
-			if(density[i] < 0.0f)
-				density[i] = 0.0f;
+			/* density */
+			density[i] *= fac;
+
+			/* heat */
+			if (heat) {
+				heat[i] *= fac;
+			}
+
+			/* color */
+			if (r) {
+				r[i] *= fac;
+				g[i] *= fac;
+				b[i] *= fac;
+			}
 		}
 	}
 	else // linear falloff
 	{
 		/* max density/speed = dydx */
-		float dydx = 1.0 / (float)speed;
-		size_t size= r[0] * r[1] * r[2];
+		float dydx = 1.0f / (float)speed;
 
-		for(size_t i = 0; i < size; i++)
+		for(size_t i = 0; i < total_cells; i++)
 		{
+			float d = density[i];
+			/* density */
 			density[i] -= dydx;
+			if (density[i] < 0.0f)
+				density[i] = 0.0f;
 
-			if(density[i] < 0.0f)
-				density[i] = 0.0f;				
+			/* heat */
+			if (heat) {
+				if      (abs(heat[i]) < dydx) heat[i] = 0.0f;
+				else if (heat[i] > 0.0f) heat[i] -= dydx;
+				else if (heat[i] < 0.0f) heat[i] += dydx;
+			}
+
+			/* color */
+			if (r && d) {
+				r[i] *= (density[i]/d);
+				g[i] *= (density[i]/d);
+				b[i] *= (density[i]/d);
+			}
+				
 		}
 	}
 }
 
-extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
+extern "C" void smoke_dissolve(FLUID_3D *fluid, int speed, int log)
 {
-	wt->initBlenderRNA(strength);
+	data_dissolve(fluid->_density, fluid->_heat, fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_totalCells, speed, log);
 }
 
-template < class T > inline T ABS( T a )
+extern "C" void smoke_dissolve_wavelet(WTURBULENCE *wt, int speed, int log)
 {
-	return (0 < a) ? a : -a ;
+	data_dissolve(wt->_densityBig, 0, wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_totalCellsBig, speed, log);
 }
 
-extern "C" void smoke_export(FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles)
+extern "C" void smoke_export(FLUID_3D *fluid, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, 
+							 float **heatold, float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles)
 {
 	*dens = fluid->_density;
-	*densold = fluid->_densityOld;
+	*fuel = fluid->_fuel;
+	*react = fluid->_react;
+	*flame = fluid->_flame;
 	*heat = fluid->_heat;
 	*heatold = fluid->_heatOld;
 	*vx = fluid->_xVelocity;
 	*vy = fluid->_yVelocity;
 	*vz = fluid->_zVelocity;
-	*vxold = fluid->_xVelocityOld;
-	*vyold = fluid->_yVelocityOld;
-	*vzold = fluid->_zVelocityOld;
+	*r = fluid->_color_r;
+	*g = fluid->_color_g;
+	*b = fluid->_color_b;
 	*obstacles = fluid->_obstacles;
 	*dt = fluid->_dt;
 	*dx = fluid->_dx;
-
 }
 
-extern "C" void smoke_turbulence_export(WTURBULENCE *wt, float **dens, float **densold, float **tcu, float **tcv, float **tcw)
+extern "C" void smoke_turbulence_export(WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
+                                        float **r, float **g, float **b , float **tcu, float **tcv, float **tcw)
 {
-	if(!wt)
+	if (!wt)
 		return;
 
 	*dens = wt->_densityBig;
-	*densold = wt->_densityBigOld;
+	*fuel = wt->_fuelBig;
+	*react = wt->_reactBig;
+	*flame = wt->_flameBig;
+	*r = wt->_color_rBig;
+	*g = wt->_color_gBig;
+	*b = wt->_color_bBig;
 	*tcu = wt->_tcU;
 	*tcv = wt->_tcV;
 	*tcw = wt->_tcW;
@@ -221,6 +211,16 @@ extern "C" float *smoke_get_density(FLUID_3D *fluid)
 	return fluid->_density;
 }
 
+extern "C" float *smoke_get_fuel(FLUID_3D *fluid)
+{
+	return fluid->_fuel;
+}
+
+extern "C" float *smoke_get_react(FLUID_3D *fluid)
+{
+	return fluid->_react;
+}
+
 extern "C" float *smoke_get_heat(FLUID_3D *fluid)
 {
 	return fluid->_heat;
@@ -256,15 +256,137 @@ extern "C" float *smoke_get_force_z(FLUID_3D *fluid)
 	return fluid->_zForce;
 }
 
+extern "C" float *smoke_get_flame(FLUID_3D *fluid)
+{
+	return fluid->_flame;
+}
+
+extern "C" float *smoke_get_color_r(FLUID_3D *fluid)
+{
+	return fluid->_color_r;
+}
+
+extern "C" float *smoke_get_color_g(FLUID_3D *fluid)
+{
+	return fluid->_color_g;
+}
+
+extern "C" float *smoke_get_color_b(FLUID_3D *fluid)
+{
+	return fluid->_color_b;
+}
+
+static void get_rgba(float *r, float *g, float *b, float *a, int total_cells, float *data, int sequential)
+{
+	int i;
+	int m = 4, i_g = 1, i_b = 2, i_a = 3;
+	/* sequential data */
+	if (sequential) {
+		m = 1;
+		i_g *= total_cells;
+		i_b *= total_cells;
+		i_a *= total_cells;
+	}
+
+	for (i=0; i<total_cells; i++) {
+		float alpha = a[i];
+		if (alpha) {
+			data[i*m  ] = r[i];
+			data[i*m+i_g] = g[i];
+			data[i*m+i_b] = b[i];
+		}
+		else {
+			data[i*m  ] = data[i*m+i_g] = data[i*m+i_b] = 0.0f;
+		}
+		data[i*m+i_a] = alpha;
+	}
+}
+
+extern "C" void smoke_get_rgba(FLUID_3D *fluid, float *data, int sequential)
+{
+	get_rgba(fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_density, fluid->_totalCells, data, sequential);
+}
+
+extern "C" void smoke_turbulence_get_rgba(WTURBULENCE *wt, float *data, int sequential)
+{
+	get_rgba(wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_densityBig, wt->_totalCellsBig, data, sequential);
+}
+
+/* get a single color premultiplied voxel grid */
+static void get_rgba_from_density(float color[3], float *a, int total_cells, float *data, int sequential)
+{
+	int i;
+	int m = 4, i_g = 1, i_b = 2, i_a = 3;
+	/* sequential data */
+	if (sequential) {
+		m = 1;
+		i_g *= total_cells;
+		i_b *= total_cells;
+		i_a *= total_cells;
+	}
+
+	for (i=0; i<total_cells; i++) {
+		float alpha = a[i];
+		if (alpha) {
+			data[i*m  ] = color[0] * alpha;
+			data[i*m+i_g] = color[1] * alpha;
+			data[i*m+i_b] = color[2] * alpha;
+		}
+		else {
+			data[i*m  ] = data[i*m+i_g] = data[i*m+i_b] = 0.0f;
+		}
+		data[i*m+i_a] = alpha;
+	}
+}
+
+extern "C" void smoke_get_rgba_from_density(FLUID_3D *fluid, float color[3], float *data, int sequential)
+{
+	get_rgba_from_density(color, fluid->_density, fluid->_totalCells, data, sequential);
+}
+
+extern "C" void smoke_turbulence_get_rgba_from_density(WTURBULENCE *wt, float color[3], float *data, int sequential)
+{
+	get_rgba_from_density(color, wt->_densityBig, wt->_totalCellsBig, data, sequential);
+}
+
 extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
 {
 	return wt ? wt->getDensityBig() : NULL;
 }
 
+extern "C" float *smoke_turbulence_get_fuel(WTURBULENCE *wt)
+{
+	return wt ? wt->getFuelBig() : NULL;
+}
+
+extern "C" float *smoke_turbulence_get_react(WTURBULENCE *wt)
+{
+	return wt ? wt->_reactBig : NULL;
+}
+
+extern "C" float *smoke_turbulence_get_color_r(WTURBULENCE *wt)
+{
+	return wt ? wt->_color_rBig : NULL;
+}
+
+extern "C" float *smoke_turbulence_get_color_g(WTURBULENCE *wt)
+{
+	return wt ? wt->_color_gBig : NULL;
+}
+
+extern "C" float *smoke_turbulence_get_color_b(WTURBULENCE *wt)
+{
+	return wt ? wt->_color_bBig : NULL;
+}
+
+extern "C" float *smoke_turbulence_get_flame(WTURBULENCE *wt)
+{
+	return wt ? wt->getFlameBig() : NULL;
+}
+
 extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
 {
-	if(wt)
-	{
+	if (wt) {
 		Vec3Int r = wt->getResBig();
 		res[0] = r[0];
 		res[1] = r[1];
@@ -272,6 +394,15 @@ extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
 	}
 }
 
+extern "C" int smoke_turbulence_get_cells(WTURBULENCE *wt)
+{
+	if (wt) {
+		Vec3Int r = wt->getResBig();
+		return r[0] * r[1] * r[2];
+	}
+	return 0;
+}
+
 extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid)
 {
 	return fluid->_obstacles;
@@ -295,3 +426,61 @@ extern "C" void smoke_turbulence_set_noise(WTURBULENCE *wt, int type)
 {
 	wt->setNoise(type);
 }
+
+extern "C" void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2)
+{
+	spectrum(t1, t2, width, spec);
+}
+
+extern "C" int smoke_has_heat(FLUID_3D *fluid)
+{
+	return (fluid->_heat) ? 1 : 0;
+}
+
+extern "C" int smoke_has_fuel(FLUID_3D *fluid)
+{
+	return (fluid->_fuel) ? 1 : 0;
+}
+
+extern "C" int smoke_has_colors(FLUID_3D *fluid)
+{
+	return (fluid->_color_r && fluid->_color_g && fluid->_color_b) ? 1 : 0;
+}
+
+extern "C" int smoke_turbulence_has_fuel(WTURBULENCE *wt)
+{
+	return (wt->_fuelBig) ? 1 : 0;
+}
+
+extern "C" int smoke_turbulence_has_colors(WTURBULENCE *wt)
+{
+	return (wt->_color_rBig && wt->_color_gBig && wt->_color_bBig) ? 1 : 0;
+}
+
+/* additional field initialization */
+extern "C" void smoke_ensure_heat(FLUID_3D *fluid)
+{
+	if (fluid) {
+		fluid->initHeat();
+	}
+}
+
+extern "C" void smoke_ensure_fire(FLUID_3D *fluid, WTURBULENCE *wt)
+{
+	if (fluid) {
+		fluid->initFire();
+	}
+	if (wt) {
+		wt->initFire();
+	}
+}
+
+extern "C" void smoke_ensure_colors(FLUID_3D *fluid, WTURBULENCE *wt, float init_r, float init_g, float init_b)
+{
+	if (fluid) {
+		fluid->initColors(init_r, init_g, init_b);
+	}
+	if (wt) {
+		wt->initColors(init_r, init_g, init_b);
+	}
+}
diff --git a/intern/smoke/intern/spectrum.cpp b/intern/smoke/intern/spectrum.cpp
new file mode 100644
index 0000000..3043345
--- /dev/null
+++ b/intern/smoke/intern/spectrum.cpp
@@ -0,0 +1,426 @@
+/*
+                Colour Rendering of Spectra
+
+                       by John Walker
+                  http://www.fourmilab.ch/
+		  
+		 Last updated: March 9, 2003
+
+           This program is in the public domain.
+
+    For complete information about the techniques employed in
+    this program, see the World-Wide Web document:
+
+             http://www.fourmilab.ch/documents/specrend/
+	     
+    The xyz_to_rgb() function, which was wrong in the original
+    version of this program, was corrected by:
+    
+	    Andrew J. S. Hamilton 21 May 1999
+	    Andrew.Hamilton at Colorado.EDU
+	    http://casa.colorado.edu/~ajsh/
+
+    who also added the gamma correction facilities and
+    modified constrain_rgb() to work by desaturating the
+    colour by adding white.
+    
+    A program which uses these functions to plot CIE
+    "tongue" diagrams called "ppmcie" is included in
+    the Netpbm graphics toolkit:
+    	http://netpbm.sourceforge.net/
+    (The program was called cietoppm in earlier
+    versions of Netpbm.)
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "spectrum.h"
+
+/* A colour system is defined by the CIE x and y coordinates of
+   its three primary illuminants and the x and y coordinates of
+   the white point. */
+
+struct colourSystem {
+    const char *name;        	    /* Colour system name */
+    double xRed, yRed,	    	    /* Red x, y */
+           xGreen, yGreen,  	    /* Green x, y */
+           xBlue, yBlue,    	    /* Blue x, y */
+           xWhite, yWhite,  	    /* White point x, y */
+	   gamma;   	    	    /* Gamma correction for system */
+};
+
+/* White point chromaticities. */
+
+#define IlluminantC     0.3101, 0.3162	    	/* For NTSC television */
+#define IlluminantD65   0.3127, 0.3291	    	/* For EBU and SMPTE */
+#define IlluminantE 	0.33333333, 0.33333333  /* CIE equal-energy illuminant */
+
+/*  Gamma of nonlinear correction.
+
+    See Charles Poynton's ColorFAQ Item 45 and GammaFAQ Item 6 at:
+    
+       http://www.poynton.com/ColorFAQ.html
+       http://www.poynton.com/GammaFAQ.html
+ 
+*/
+
+#define GAMMA_REC709	0		/* Rec. 709 */
+
+static struct colourSystem
+                  /* Name                  xRed    yRed    xGreen  yGreen  xBlue  yBlue    White point        Gamma   */
+#if 0 /* UNUSED */
+    NTSCsystem  =  { "NTSC",               0.67,   0.33,   0.21,   0.71,   0.14,   0.08,   IlluminantC,    GAMMA_REC709 },
+    EBUsystem   =  { "EBU (PAL/SECAM)",    0.64,   0.33,   0.29,   0.60,   0.15,   0.06,   IlluminantD65,  GAMMA_REC709 },
+    SMPTEsystem =  { "SMPTE",              0.630,  0.340,  0.310,  0.595,  0.155,  0.070,  IlluminantD65,  GAMMA_REC709 },
+    HDTVsystem  =  { "HDTV",               0.670,  0.330,  0.210,  0.710,  0.150,  0.060,  IlluminantD65,  GAMMA_REC709 },
+#endif
+
+    CIEsystem   =  { "CIE",                0.7355, 0.2645, 0.2658, 0.7243, 0.1669, 0.0085, IlluminantE,    GAMMA_REC709 };
+
+#if 0 /* UNUSED */
+    Rec709system = { "CIE REC 709",        0.64,   0.33,   0.30,   0.60,   0.15,   0.06,   IlluminantD65,  GAMMA_REC709 };
+#endif
+
+/*  	    	    	    UPVP_TO_XY
+
+    Given 1976 coordinates u', v', determine 1931 chromaticities x, y
+    
+*/
+
+#if 0 /* UNUSED */
+static void upvp_to_xy(double up, double vp, double *xc, double *yc)
+{
+    *xc = (9 * up) / ((6 * up) - (16 * vp) + 12);
+    *yc = (4 * vp) / ((6 * up) - (16 * vp) + 12);
+}
+#endif
+
+/*  	    	    	    XY_TO_UPVP
+
+    Given 1931 chromaticities x, y, determine 1976 coordinates u', v'
+    
+*/
+
+#if 0 /* UNUSED */
+static void xy_to_upvp(double xc, double yc, double *up, double *vp)
+{
+    *up = (4 * xc) / ((-2 * xc) + (12 * yc) + 3);
+    *vp = (9 * yc) / ((-2 * xc) + (12 * yc) + 3);
+}
+#endif
+
+/*                             XYZ_TO_RGB
+
+    Given an additive tricolour system CS, defined by the CIE x
+    and y chromaticities of its three primaries (z is derived
+    trivially as 1-(x+y)), and a desired chromaticity (XC, YC,
+    ZC) in CIE space, determine the contribution of each
+    primary in a linear combination which sums to the desired
+    chromaticity.  If the  requested chromaticity falls outside
+    the Maxwell  triangle (colour gamut) formed by the three
+    primaries, one of the r, g, or b weights will be negative. 
+
+    Caller can use constrain_rgb() to desaturate an
+    outside-gamut colour to the closest representation within
+    the available gamut and/or norm_rgb to normalise the RGB
+    components so the largest nonzero component has value 1.
+    
+*/
+
+static void xyz_to_rgb(struct colourSystem *cs,
+                       double xc, double yc, double zc,
+                       double *r, double *g, double *b)
+{
+    double xr, yr, zr, xg, yg, zg, xb, yb, zb;
+    double xw, yw, zw;
+    double rx, ry, rz, gx, gy, gz, bx, by, bz;
+    double rw, gw, bw;
+
+    xr = cs->xRed;    yr = cs->yRed;    zr = 1 - (xr + yr);
+    xg = cs->xGreen;  yg = cs->yGreen;  zg = 1 - (xg + yg);
+    xb = cs->xBlue;   yb = cs->yBlue;   zb = 1 - (xb + yb);
+
+    xw = cs->xWhite;  yw = cs->yWhite;  zw = 1 - (xw + yw);
+
+    /* xyz -> rgb matrix, before scaling to white. */
+    
+    rx = (yg * zb) - (yb * zg);  ry = (xb * zg) - (xg * zb);  rz = (xg * yb) - (xb * yg);
+    gx = (yb * zr) - (yr * zb);  gy = (xr * zb) - (xb * zr);  gz = (xb * yr) - (xr * yb);
+    bx = (yr * zg) - (yg * zr);  by = (xg * zr) - (xr * zg);  bz = (xr * yg) - (xg * yr);
+
+    /* White scaling factors.
+       Dividing by yw scales the white luminance to unity, as conventional. */
+       
+    rw = ((rx * xw) + (ry * yw) + (rz * zw)) / yw;
+    gw = ((gx * xw) + (gy * yw) + (gz * zw)) / yw;
+    bw = ((bx * xw) + (by * yw) + (bz * zw)) / yw;
+
+    /* xyz -> rgb matrix, correctly scaled to white. */
+    
+    rx = rx / rw;  ry = ry / rw;  rz = rz / rw;
+    gx = gx / gw;  gy = gy / gw;  gz = gz / gw;
+    bx = bx / bw;  by = by / bw;  bz = bz / bw;
+
+    /* rgb of the desired point */
+
+    *r = (rx * xc) + (ry * yc) + (rz * zc);
+    *g = (gx * xc) + (gy * yc) + (gz * zc);
+    *b = (bx * xc) + (by * yc) + (bz * zc);
+}
+
+/*                            INSIDE_GAMUT
+
+     Test whether a requested colour is within the gamut
+     achievable with the primaries of the current colour
+     system.  This amounts simply to testing whether all the
+     primary weights are non-negative. */
+
+#if 0 /* UNUSED */
+static int inside_gamut(double r, double g, double b)
+{
+    return (r >= 0) && (g >= 0) && (b >= 0);
+}
+#endif
+
+/*                          CONSTRAIN_RGB
+
+    If the requested RGB shade contains a negative weight for
+    one of the primaries, it lies outside the colour gamut 
+    accessible from the given triple of primaries.  Desaturate
+    it by adding white, equal quantities of R, G, and B, enough
+    to make RGB all positive.  The function returns 1 if the
+    components were modified, zero otherwise.
+    
+*/
+
+static int constrain_rgb(double *r, double *g, double *b)
+{
+    double w;
+
+    /* Amount of white needed is w = - min(0, *r, *g, *b) */
+    
+    w = (0 < *r) ? 0 : *r;
+    w = (w < *g) ? w : *g;
+    w = (w < *b) ? w : *b;
+    w = -w;
+
+    /* Add just enough white to make r, g, b all positive. */
+    
+    if (w > 0) {
+        *r += w;  *g += w; *b += w;
+        return 1;                     /* Colour modified to fit RGB gamut */
+    }
+
+    return 0;                         /* Colour within RGB gamut */
+}
+
+/*                          GAMMA_CORRECT_RGB
+
+    Transform linear RGB values to nonlinear RGB values. Rec.
+    709 is ITU-R Recommendation BT. 709 (1990) ``Basic
+    Parameter Values for the HDTV Standard for the Studio and
+    for International Programme Exchange'', formerly CCIR Rec.
+    709. For details see
+    
+       http://www.poynton.com/ColorFAQ.html
+       http://www.poynton.com/GammaFAQ.html
+*/
+
+#if 0 /* UNUSED */
+static void gamma_correct(const struct colourSystem *cs, double *c)
+{
+    double gamma;
+
+    gamma = cs->gamma;
+
+    if (gamma == GAMMA_REC709) {
+	/* Rec. 709 gamma correction. */
+	double cc = 0.018;
+	
+	if (*c < cc) {
+	    *c *= ((1.099 * pow(cc, 0.45)) - 0.099) / cc;
+	} else {
+	    *c = (1.099 * pow(*c, 0.45)) - 0.099;
+	}
+    } else {
+	/* Nonlinear colour = (Linear colour)^(1/gamma) */
+	*c = pow(*c, 1.0 / gamma);
+    }
+}
+
+static void gamma_correct_rgb(const struct colourSystem *cs, double *r, double *g, double *b)
+{
+    gamma_correct(cs, r);
+    gamma_correct(cs, g);
+    gamma_correct(cs, b);
+}
+#endif
+
+/*  	    	    	    NORM_RGB
+
+    Normalise RGB components so the most intense (unless all
+    are zero) has a value of 1.
+    
+*/
+
+static void norm_rgb(double *r, double *g, double *b)
+{
+#define Max(a, b)   (((a) > (b)) ? (a) : (b))
+    double greatest = Max(*r, Max(*g, *b));
+
+    if (greatest > 0) {
+    	*r /= greatest;
+	*g /= greatest;
+	*b /= greatest;
+    }
+#undef Max
+}
+
+/*                          SPECTRUM_TO_XYZ
+
+    Calculate the CIE X, Y, and Z coordinates corresponding to
+    a light source with spectral distribution given by  the
+    function SPEC_INTENS, which is called with a series of
+    wavelengths between 380 and 780 nm (the argument is 
+    expressed in meters), which returns emittance at  that
+    wavelength in arbitrary units.  The chromaticity
+    coordinates of the spectrum are returned in the x, y, and z
+    arguments which respect the identity:
+
+            x + y + z = 1.
+*/
+
+static void spectrum_to_xyz(double (*spec_intens)(double wavelength),
+                            double *x, double *y, double *z)
+{
+    int i;
+    double lambda, X = 0, Y = 0, Z = 0, XYZ;
+
+    /* CIE colour matching functions xBar, yBar, and zBar for
+       wavelengths from 380 through 780 nanometers, every 5
+       nanometers.  For a wavelength lambda in this range:
+
+            cie_colour_match[(lambda - 380) / 5][0] = xBar
+            cie_colour_match[(lambda - 380) / 5][1] = yBar
+            cie_colour_match[(lambda - 380) / 5][2] = zBar
+
+	To save memory, this table can be declared as floats
+	rather than doubles; (IEEE) float has enough 
+	significant bits to represent the values. It's declared
+	as a double here to avoid warnings about "conversion
+	between floating-point types" from certain persnickety
+	compilers. */
+
+    static double cie_colour_match[81][3] = {
+        {0.0014,0.0000,0.0065}, {0.0022,0.0001,0.0105}, {0.0042,0.0001,0.0201},
+        {0.0076,0.0002,0.0362}, {0.0143,0.0004,0.0679}, {0.0232,0.0006,0.1102},
+        {0.0435,0.0012,0.2074}, {0.0776,0.0022,0.3713}, {0.1344,0.0040,0.6456},
+        {0.2148,0.0073,1.0391}, {0.2839,0.0116,1.3856}, {0.3285,0.0168,1.6230},
+        {0.3483,0.0230,1.7471}, {0.3481,0.0298,1.7826}, {0.3362,0.0380,1.7721},
+        {0.3187,0.0480,1.7441}, {0.2908,0.0600,1.6692}, {0.2511,0.0739,1.5281},
+        {0.1954,0.0910,1.2876}, {0.1421,0.1126,1.0419}, {0.0956,0.1390,0.8130},
+        {0.0580,0.1693,0.6162}, {0.0320,0.2080,0.4652}, {0.0147,0.2586,0.3533},
+        {0.0049,0.3230,0.2720}, {0.0024,0.4073,0.2123}, {0.0093,0.5030,0.1582},
+        {0.0291,0.6082,0.1117}, {0.0633,0.7100,0.0782}, {0.1096,0.7932,0.0573},
+        {0.1655,0.8620,0.0422}, {0.2257,0.9149,0.0298}, {0.2904,0.9540,0.0203},
+        {0.3597,0.9803,0.0134}, {0.4334,0.9950,0.0087}, {0.5121,1.0000,0.0057},
+        {0.5945,0.9950,0.0039}, {0.6784,0.9786,0.0027}, {0.7621,0.9520,0.0021},
+        {0.8425,0.9154,0.0018}, {0.9163,0.8700,0.0017}, {0.9786,0.8163,0.0014},
+        {1.0263,0.7570,0.0011}, {1.0567,0.6949,0.0010}, {1.0622,0.6310,0.0008},
+        {1.0456,0.5668,0.0006}, {1.0026,0.5030,0.0003}, {0.9384,0.4412,0.0002},
+        {0.8544,0.3810,0.0002}, {0.7514,0.3210,0.0001}, {0.6424,0.2650,0.0000},
+        {0.5419,0.2170,0.0000}, {0.4479,0.1750,0.0000}, {0.3608,0.1382,0.0000},
+        {0.2835,0.1070,0.0000}, {0.2187,0.0816,0.0000}, {0.1649,0.0610,0.0000},
+        {0.1212,0.0446,0.0000}, {0.0874,0.0320,0.0000}, {0.0636,0.0232,0.0000},
+        {0.0468,0.0170,0.0000}, {0.0329,0.0119,0.0000}, {0.0227,0.0082,0.0000},
+        {0.0158,0.0057,0.0000}, {0.0114,0.0041,0.0000}, {0.0081,0.0029,0.0000},
+        {0.0058,0.0021,0.0000}, {0.0041,0.0015,0.0000}, {0.0029,0.0010,0.0000},
+        {0.0020,0.0007,0.0000}, {0.0014,0.0005,0.0000}, {0.0010,0.0004,0.0000},
+        {0.0007,0.0002,0.0000}, {0.0005,0.0002,0.0000}, {0.0003,0.0001,0.0000},
+        {0.0002,0.0001,0.0000}, {0.0002,0.0001,0.0000}, {0.0001,0.0000,0.0000},
+        {0.0001,0.0000,0.0000}, {0.0001,0.0000,0.0000}, {0.0000,0.0000,0.0000}
+    };
+
+    for (i = 0, lambda = 380; lambda < 780.1; i++, lambda += 5) {
+        double Me;
+
+        Me = (*spec_intens)(lambda);
+        X += Me * cie_colour_match[i][0];
+        Y += Me * cie_colour_match[i][1];
+        Z += Me * cie_colour_match[i][2];
+    }
+    XYZ = (X + Y + Z);
+    *x = X / XYZ;
+    *y = Y / XYZ;
+    *z = Z / XYZ;
+}
+
+/*                            BB_SPECTRUM
+
+    Calculate, by Planck's radiation law, the emittance of a black body
+    of temperature bbTemp at the given wavelength (in metres).  */
+
+double bbTemp = 5000;                 /* Hidden temperature argument
+                                         to BB_SPECTRUM. */
+static double bb_spectrum(double wavelength)
+{
+    double wlm = wavelength * 1e-9;   /* Wavelength in meters */
+
+    return (3.74183e-16 * pow(wlm, -5.0)) /
+           (exp(1.4388e-2 / (wlm * bbTemp)) - 1.0);
+}
+
+static void xyz_to_lms(double x, double y, double z, double* l, double* m, double* s)
+{
+	*l =  0.3897*x + 0.6890*y - 0.0787*z;
+	*m = -0.2298*x + 1.1834*y + 0.0464*z;
+	*s = z;
+}
+
+static void lms_to_xyz(double l, double m, double s, double* x, double *y, double* z)
+{
+	*x =  1.9102*l - 1.1121*m + 0.2019*s;
+	*y =  0.3709*l + 0.6290*m + 0.0000*s;
+	*z = s;
+}
+
+void spectrum(double t1, double t2, int N, unsigned char *d)
+{
+	int i,j,dj;
+	double X,Y,Z,R,G,B,L,M,S, Lw, Mw, Sw;
+	struct colourSystem *cs = &CIEsystem;
+
+	j = 0; dj = 1;
+	if (t1<t2) {
+		double t = t1;
+		t1 = t2;
+		t2 = t;
+		j = N-1; dj=-1;
+	}
+
+	for (i=0; i<N; i++) {
+		bbTemp = t1 + (t2-t1)/N*i;
+
+			// integrate blackbody radiation spectrum to XYZ
+		spectrum_to_xyz(bb_spectrum, &X, &Y, &Z);
+
+			// normalize highest temperature to white (in LMS system)
+		xyz_to_lms(X,Y,Z,&L,&M,&S);
+		if (i==0) {
+			Lw=1/L; Mw=1/M; Sw=1/S;
+		}
+		L *= Lw; M *= Mw; S *= Sw;
+		lms_to_xyz(L,M,S,&X,&Y,&Z);
+
+			// convert to RGB
+		xyz_to_rgb(cs, X, Y, Z, &R, &G, &B);
+		constrain_rgb(&R, &G, &B);
+		norm_rgb(&R, &G, &B);
+		d[(j<<2)] = (unsigned char) ((double)R*255);
+		d[(j<<2)+1] = (unsigned char) ((double)G*255);
+		d[(j<<2)+2] = (unsigned char) ((double)B*255);
+		d[(j<<2)+3] = (B>0.1)? B*255 : 0;
+		j += dj;
+	}
+}
diff --git a/intern/smoke/intern/spectrum.h b/intern/smoke/intern/spectrum.h
new file mode 100644
index 0000000..3ffd41f
--- /dev/null
+++ b/intern/smoke/intern/spectrum.h
@@ -0,0 +1,6 @@
+#ifndef __SPECTRUM_H
+#define __SPECTRUM_H
+
+void spectrum(double t1, double t2, int n, unsigned char *d);
+
+#endif
diff --git a/intern/tools/bpy_introspect_ui.py b/intern/tools/bpy_introspect_ui.py
index ed4a418..6fc22e8 100644
--- a/intern/tools/bpy_introspect_ui.py
+++ b/intern/tools/bpy_introspect_ui.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/intern/tools/credits_svn_gen.py b/intern/tools/credits_svn_gen.py
index fb6d046..b64cb5d 100755
--- a/intern/tools/credits_svn_gen.py
+++ b/intern/tools/credits_svn_gen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ##### BEGIN GPL LICENSE BLOCK #####
 #
@@ -51,7 +51,7 @@ Example execution commands:
 
    svn log https://svn.blender.org/svnroot/bf-blender/trunk/blender -v --xml > ~/svn_log_bfb.xml
    svn log https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons -v --xml > ~/svn_log_ext.xml
-   python3.2 intern/tools/credits_svn_gen.py --svn_log_bfb=~/svn_log.xml --svn_log_ext=~/svn_log_ext.xml --tracker_csv=~/tracker_report-2012-10-03.csv
+   python3 intern/tools/credits_svn_gen.py --svn_log_bfb=~/svn_log.xml --svn_log_ext=~/svn_log_ext.xml --tracker_csv=~/tracker_report-2012-10-03.csv
 """
 
 # -----------------------------------------------------------------------------
diff --git a/intern/tools/dump_rna2xml.py b/intern/tools/dump_rna2xml.py
index cc9028e..c8ba00e 100644
--- a/intern/tools/dump_rna2xml.py
+++ b/intern/tools/dump_rna2xml.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
diff --git a/intern/tools/pydna.py b/intern/tools/pydna.py
index 497dc07..9f4d8e5 100644
--- a/intern/tools/pydna.py
+++ b/intern/tools/pydna.py
@@ -139,80 +139,103 @@ def _api():
 
         return blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs
 
-    def create_dna_structs(blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs):
+    def _create_dna_structs__recursive(ctypes_basic, ctypes_structs, blend_sdna_structs_dict, struct_name, stack):
+        ctype_struct = ctypes_structs[struct_name]
+        if hasattr(ctype_struct, "_fields_"):
+            return
 
-        # create all subclasses of ctypes.Structure
-        ctypes_structs = {name: type(name.decode(), (ctypes.Structure, MixIn), {}) for name in blend_sdna_types}
-        ctypes_basic = {b"float": ctypes.c_float, b"double": ctypes.c_double, b"int": ctypes.c_int, b"short": ctypes.c_short, b"char": ctypes.c_char, b"void": ctypes.c_void_p}
-        ctypes_fields = {}
+        stack.append(struct_name)
+        
+        struct_type_name_pairs = blend_sdna_structs_dict[struct_name]
+        fields = []
+        fields_orig = []
 
-        # collect fields
-        for struct_id, struct_type_name_pairs in blend_sdna_structs:
-            struct_name = blend_sdna_types[struct_id]
-            ctype_struct = ctypes_structs[struct_name]
-            fields = []
+        for stype, sname in struct_type_name_pairs:
+            name_string = blend_sdna_names[sname]
+            type_string = blend_sdna_types[stype]
+            type_py = ctypes_basic.get(type_string)
+            type_py_orig = None
+            if type_py is None:
+                type_py = type_py_orig = ctypes_structs.get(type_string)
+
+            # todo, these might need to be changed
+            name_string = name_string.replace(b"(", b"")
+            name_string = name_string.replace(b")", b"")
+
+            # * First parse the pointer *
+            pointer_count = 0
+            while name_string[0] == 42:  # '*'
+                pointer_count += 1
+                name_string = name_string[1:]
+
+            # alredy a pointer
+            if type_py is ctypes.c_void_p:
+                pointer_count -= 1
+            elif type_py is ctypes.c_char and pointer_count == 1:
+                type_py = ctypes.c_char_p
+                pointer_count = 0
 
-            for stype, sname in struct_type_name_pairs:
-                name_string = blend_sdna_names[sname]
-                type_string = blend_sdna_types[stype]
-                type_py = ctypes_basic.get(type_string)
-                if type_py is None:
-                    type_py = ctypes_structs.get(type_string)
+            if pointer_count < 0:
+                Exception("error parsing pointer")
 
-                # todo, these might need to be changed
-                name_string = name_string.replace(b"(", b"")
-                name_string = name_string.replace(b")", b"")
+            for i in range(pointer_count):
+                type_py = ctypes.POINTER(type_py)
 
-                # * First parse the pointer *
-                pointer_count = 0
-                while name_string[0] == 42:  # '*'
-                    pointer_count += 1
-                    name_string = name_string[1:]
+            # ---
+            # Ensure we have the members initialized!
+            if type_py is type_py_orig:
+                if type_py_orig.orig_name not in stack:
+                    _create_dna_structs__recursive(ctypes_basic, ctypes_structs, blend_sdna_structs_dict, type_py_orig.orig_name, stack)
+            # ---
 
-                # alredy a pointer
-                if type_py is ctypes.c_void_p:
-                    pointer_count -= 1
-                elif type_py is ctypes.c_char and pointer_count == 1:
-                    type_py = ctypes.c_char_p
-                    pointer_count = 0
+            # * Now parse the array [] *
+            if b'[' in name_string:
+                name_string = name_string.replace(b'[', b' ')
+                name_string = name_string.replace(b']', b' ')
+                name_split = name_string.split()
+                name_string = name_split[0]
+                for array_dim in reversed(name_split[1:]):
+                    type_py = type_py * int(array_dim)
 
-                if pointer_count < 0:
-                    Exception("error parsing pointer")
+            fields.append((name_string.decode(), type_py))
+        stack.pop()
 
-                for i in range(pointer_count):
-                    type_py = ctypes.POINTER(type_py)
+        ctype_struct._fields_ = fields
+        del fields
 
-                # * Now parse the array [] *
-                if b'[' in name_string:
-                    name_string = name_string.replace(b'[', b' ')
-                    name_string = name_string.replace(b']', b' ')
-                    name_split = name_string.split()
-                    name_string = name_split[0]
-                    for array_dim in reversed(name_split[1:]):
-                        type_py = type_py * int(array_dim)
-
-                fields.append((name_string.decode(), type_py))
+    def create_dna_structs(blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs):
 
-            ctypes_fields[struct_name] = fields
+        # create all subclasses of ctypes.Structure
+        ctypes_structs = {name: type(name.decode(), (ctypes.Structure, MixIn), {"orig_name": name}) for name in blend_sdna_types}
+        ctypes_basic = {
+            b"float": ctypes.c_float,
+            b"double": ctypes.c_double,
+            b"int": ctypes.c_int,
+            b"uint64_t": ctypes.c_uint64,
+            b"short": ctypes.c_short,
+            b"char": ctypes.c_char,
+            b"void": ctypes.c_void_p,
+        }
+        ctypes_fields = {}
 
         # apply fields all in one go!
+        blend_sdna_structs_dict = {
+            blend_sdna_types[struct_id]: struct_type_name_pairs
+            for struct_id, struct_type_name_pairs in blend_sdna_structs}
+
         for struct_id, struct_type_name_pairs in blend_sdna_structs:
             struct_name = blend_sdna_types[struct_id]
-            ctype_struct = ctypes_structs[struct_name]
-            try:
-                ctype_struct._fields_ = ctypes_fields[struct_name]
-            except:
-                print("Error:", struct_name)
-                import traceback
-                traceback.print_exc()
-                # print(fields)
+            _create_dna_structs__recursive(ctypes_basic, ctypes_structs, blend_sdna_structs_dict, struct_name, [struct_name])
+
 
         # test fields
+        error = 0
         for struct_id, struct_type_name_pairs in blend_sdna_structs:
             ctype_struct = ctypes_structs[blend_sdna_types[struct_id]]
             if blend_sdna_typelens[struct_id] != ctypes.sizeof(ctype_struct):
                 print("Size Mismatch for %r blender:%d vs python:%d" % (blend_sdna_types[struct_id], blend_sdna_typelens[struct_id], ctypes.sizeof(ctype_struct)))
-
+                error += 1
+        print("Size Mismatch errors (total): %d!" % error)
         return ctypes_structs
 
     def decorate_api(struct_dict):
@@ -287,7 +310,7 @@ def _api():
     _lb = struct_dict[b"ListBase"]
     Main._fields_ = [("next", ctypes.POINTER(Main)),
                      ("prev", ctypes.POINTER(Main)),
-                     ("name", ctypes.c_char * 240),
+                     ("name", ctypes.c_char * 1024),
                      ("versionfile", ctypes.c_short),
                      ("subversionfile", ctypes.c_short),
                      ("minversionfile", ctypes.c_short),
@@ -322,6 +345,8 @@ def _api():
                      ("particle", _lb),
                      ("wm", _lb),
                      ("gpencil", _lb),
+                     ("movieclip", _lb),
+                     ("mask", _lb),
                      ]
     del _lb
 
diff --git a/intern/utfconv/utfconv.h b/intern/utfconv/utfconv.h
index 3bfd277..ada85e2 100644
--- a/intern/utfconv/utfconv.h
+++ b/intern/utfconv/utfconv.h
@@ -57,18 +57,18 @@ size_t count_utf_16_from_8(const char *string8);
 
 /**
  * Converts utf-16 string to allocated utf-8 string
- * @params in16 utf-16 string to convert
- * @params out8 utf-8 string to string the conversion
- * @params size8 the allocated size in bytes of out8
+ * @param in16 utf-16 string to convert
+ * @param out8 utf-8 string to string the conversion
+ * @param size8 the allocated size in bytes of out8
  * @return Returns any errors occured during conversion. See the block above,
  */
 int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8);
 
 /**
  * Converts utf-8 string to allocated utf-16 string
- * @params in8 utf-8 string to convert
- * @params out16 utf-16 string to string the conversion
- * @params size16 the allocated size in wchar_t (two byte) of out16
+ * @param in8 utf-8 string to convert
+ * @param out16 utf-16 string to string the conversion
+ * @param size16 the allocated size in wchar_t (two byte) of out16
  * @return Returns any errors occured during conversion. See the block above,
  */
 int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16);
@@ -76,16 +76,16 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16);
 
 /**
  * Allocates and converts the utf-8 string from utf-16
- * @params in16 utf-16 string to convert
- * @params add any additional size which will be allocated for new utf-8 string in bytes
+ * @param in16 utf-16 string to convert
+ * @param add any additional size which will be allocated for new utf-8 string in bytes
  * @return New allocated and converted utf-8 string or NULL if in16 is 0.
  */
 char *alloc_utf_8_from_16(const wchar_t *in16, size_t add);
 
 /**
  * Allocates and converts the utf-16 string from utf-8
- * @params in8 utf-8 string to convert
- * @params add any additional size which will be allocated for new utf-16 string in wchar_t (two bytes)
+ * @param in8 utf-8 string to convert
+ * @param add any additional size which will be allocated for new utf-16 string in wchar_t (two bytes)
  * @return New allocated and converted utf-16 string or NULL if in8 is 0.
  */
 wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
@@ -95,7 +95,7 @@ wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
 		wchar_t *in8str ## _16 = alloc_utf16_from_8((char *)in8str, 0)
 
 #define UTF16_UN_ENCODE(in8str) \
-    free(in8str ## _16); } (void)0
+	free(in8str ## _16); } (void)0
 
 #ifdef __cplusplus 
 }
diff --git a/source/darwin/blender.app/Contents/Info.plist b/release/darwin/blender.app/Contents/Info.plist
similarity index 100%
rename from source/darwin/blender.app/Contents/Info.plist
rename to release/darwin/blender.app/Contents/Info.plist
diff --git a/source/darwin/blender.app/Contents/MacOS/blender b/release/darwin/blender.app/Contents/MacOS/blender
similarity index 100%
rename from source/darwin/blender.app/Contents/MacOS/blender
rename to release/darwin/blender.app/Contents/MacOS/blender
diff --git a/source/darwin/blender.app/Contents/PkgInfo b/release/darwin/blender.app/Contents/PkgInfo
similarity index 100%
rename from source/darwin/blender.app/Contents/PkgInfo
rename to release/darwin/blender.app/Contents/PkgInfo
diff --git a/source/darwin/blender.app/Contents/Resources/blender file icon.icns b/release/darwin/blender.app/Contents/Resources/blender file icon.icns
similarity index 100%
rename from source/darwin/blender.app/Contents/Resources/blender file icon.icns
rename to release/darwin/blender.app/Contents/Resources/blender file icon.icns
diff --git a/source/darwin/blender.app/Contents/Resources/blender icon.icns b/release/darwin/blender.app/Contents/Resources/blender icon.icns
similarity index 100%
rename from source/darwin/blender.app/Contents/Resources/blender icon.icns
rename to release/darwin/blender.app/Contents/Resources/blender icon.icns
diff --git a/source/darwin/blenderplayer.app/Contents/Info.plist b/release/darwin/blenderplayer.app/Contents/Info.plist
similarity index 100%
rename from source/darwin/blenderplayer.app/Contents/Info.plist
rename to release/darwin/blenderplayer.app/Contents/Info.plist
diff --git a/source/darwin/blenderplayer.app/Contents/MacOS/blenderplayer b/release/darwin/blenderplayer.app/Contents/MacOS/blenderplayer
similarity index 100%
rename from source/darwin/blenderplayer.app/Contents/MacOS/blenderplayer
rename to release/darwin/blenderplayer.app/Contents/MacOS/blenderplayer
diff --git a/source/darwin/blenderplayer.app/Contents/PkgInfo b/release/darwin/blenderplayer.app/Contents/PkgInfo
similarity index 100%
rename from source/darwin/blenderplayer.app/Contents/PkgInfo
rename to release/darwin/blenderplayer.app/Contents/PkgInfo
diff --git a/source/darwin/blenderplayer.app/Contents/Resources/blender file icon.icns b/release/darwin/blenderplayer.app/Contents/Resources/blender file icon.icns
similarity index 100%
rename from source/darwin/blenderplayer.app/Contents/Resources/blender file icon.icns
rename to release/darwin/blenderplayer.app/Contents/Resources/blender file icon.icns
diff --git a/source/darwin/blenderplayer.app/Contents/Resources/blender player icon.icns b/release/darwin/blenderplayer.app/Contents/Resources/blender player icon.icns
similarity index 100%
rename from source/darwin/blenderplayer.app/Contents/Resources/blender player icon.icns
rename to release/darwin/blenderplayer.app/Contents/Resources/blender player icon.icns
diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/release/darwin/set_simulation_threads.app/Contents/Info.plist
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/Info.plist
rename to release/darwin/set_simulation_threads.app/Contents/Info.plist
diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/release/darwin/set_simulation_threads.app/Contents/MacOS/applet
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/MacOS/applet
rename to release/darwin/set_simulation_threads.app/Contents/MacOS/applet
diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/release/darwin/set_simulation_threads.app/Contents/PkgInfo
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/PkgInfo
rename to release/darwin/set_simulation_threads.app/Contents/PkgInfo
diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/release/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt
rename to release/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt
diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/release/darwin/set_simulation_threads.app/Contents/Resources/applet.icns
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns
rename to release/darwin/set_simulation_threads.app/Contents/Resources/applet.icns
diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/release/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc
rename to release/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc
diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/release/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf
similarity index 100%
rename from source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf
rename to release/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf
diff --git a/release/datafiles/blender_icons.png b/release/datafiles/blender_icons.png
index a0d460b..b0d5e82 100644
Binary files a/release/datafiles/blender_icons.png and b/release/datafiles/blender_icons.png differ
diff --git a/release/datafiles/locale/ar/LC_MESSAGES/blender.mo b/release/datafiles/locale/ar/LC_MESSAGES/blender.mo
index 5a30f0e..079ca25 100644
Binary files a/release/datafiles/locale/ar/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ar/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/bg/LC_MESSAGES/blender.mo b/release/datafiles/locale/bg/LC_MESSAGES/blender.mo
deleted file mode 100644
index b9362a7..0000000
Binary files a/release/datafiles/locale/bg/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/ca/LC_MESSAGES/blender.mo b/release/datafiles/locale/ca/LC_MESSAGES/blender.mo
deleted file mode 100644
index 6a61774..0000000
Binary files a/release/datafiles/locale/ca/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/cs/LC_MESSAGES/blender.mo b/release/datafiles/locale/cs/LC_MESSAGES/blender.mo
index f8927d5..6e8e44b 100644
Binary files a/release/datafiles/locale/cs/LC_MESSAGES/blender.mo and b/release/datafiles/locale/cs/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/de/LC_MESSAGES/blender.mo b/release/datafiles/locale/de/LC_MESSAGES/blender.mo
index b03dd08..39a45db 100644
Binary files a/release/datafiles/locale/de/LC_MESSAGES/blender.mo and b/release/datafiles/locale/de/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/el/LC_MESSAGES/blender.mo b/release/datafiles/locale/el/LC_MESSAGES/blender.mo
deleted file mode 100644
index e644672..0000000
Binary files a/release/datafiles/locale/el/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/eo/LC_MESSAGES/blender.mo b/release/datafiles/locale/eo/LC_MESSAGES/blender.mo
new file mode 100644
index 0000000..3bc9b4b
Binary files /dev/null and b/release/datafiles/locale/eo/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/es/LC_MESSAGES/blender.mo b/release/datafiles/locale/es/LC_MESSAGES/blender.mo
index dbfb0f7..1404ed5 100644
Binary files a/release/datafiles/locale/es/LC_MESSAGES/blender.mo and b/release/datafiles/locale/es/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/es_ES/LC_MESSAGES/blender.mo b/release/datafiles/locale/es_ES/LC_MESSAGES/blender.mo
index 625769d..206aff7 100644
Binary files a/release/datafiles/locale/es_ES/LC_MESSAGES/blender.mo and b/release/datafiles/locale/es_ES/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/fa/LC_MESSAGES/blender.mo b/release/datafiles/locale/fa/LC_MESSAGES/blender.mo
index 5e3e1c0..1416ba0 100644
Binary files a/release/datafiles/locale/fa/LC_MESSAGES/blender.mo and b/release/datafiles/locale/fa/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/fi/LC_MESSAGES/blender.mo b/release/datafiles/locale/fi/LC_MESSAGES/blender.mo
deleted file mode 100644
index 2a3003c..0000000
Binary files a/release/datafiles/locale/fi/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/fr/LC_MESSAGES/blender.mo b/release/datafiles/locale/fr/LC_MESSAGES/blender.mo
index a7de552..215551e 100644
Binary files a/release/datafiles/locale/fr/LC_MESSAGES/blender.mo and b/release/datafiles/locale/fr/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/he/LC_MESSAGES/blender.mo b/release/datafiles/locale/he/LC_MESSAGES/blender.mo
index 9bd3453..18d72c4 100644
Binary files a/release/datafiles/locale/he/LC_MESSAGES/blender.mo and b/release/datafiles/locale/he/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/hr/LC_MESSAGES/blender.mo b/release/datafiles/locale/hr/LC_MESSAGES/blender.mo
index efc974a..309a781 100644
Binary files a/release/datafiles/locale/hr/LC_MESSAGES/blender.mo and b/release/datafiles/locale/hr/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/hu/LC_MESSAGES/blender.mo b/release/datafiles/locale/hu/LC_MESSAGES/blender.mo
index 90c2fd5..0492225 100644
Binary files a/release/datafiles/locale/hu/LC_MESSAGES/blender.mo and b/release/datafiles/locale/hu/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/id/LC_MESSAGES/blender.mo b/release/datafiles/locale/id/LC_MESSAGES/blender.mo
index cf4ee12..6b49cb9 100644
Binary files a/release/datafiles/locale/id/LC_MESSAGES/blender.mo and b/release/datafiles/locale/id/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/it/LC_MESSAGES/blender.mo b/release/datafiles/locale/it/LC_MESSAGES/blender.mo
index 4349c27..ca73236 100644
Binary files a/release/datafiles/locale/it/LC_MESSAGES/blender.mo and b/release/datafiles/locale/it/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/ja/LC_MESSAGES/blender.mo b/release/datafiles/locale/ja/LC_MESSAGES/blender.mo
index 0e0aa70..b9f1bbb 100644
Binary files a/release/datafiles/locale/ja/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ja/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/ky/LC_MESSAGES/blender.mo b/release/datafiles/locale/ky/LC_MESSAGES/blender.mo
index 288647a..0ecc4de 100644
Binary files a/release/datafiles/locale/ky/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ky/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/languages b/release/datafiles/locale/languages
new file mode 100644
index 0000000..5e69a2f
--- /dev/null
+++ b/release/datafiles/locale/languages
@@ -0,0 +1,53 @@
+# File used by Blender to know which languages (translations) are available, 
+# and to generate translation menu.
+#
+# File format:
+# ID:MENULABEL:ISOCODE
+# ID must be unique, except for 0 value (marks categories for menu).
+# Line starting with a # are comments!
+#
+# Automatically generated by bl_i18n_utils/update_languages_menu.py script.
+# Highest ID currently in use: 36
+#
+0:Complete::
+0:Default (Default):DEFAULT
+1:English (English):en_US
+9:Spanish (Español):es
+8:French (Français):fr_FR
+32:Brazilian Portuguese (Português do Brasil):pt_BR
+12:Portuguese (Português):pt_PT
+15:Russian (Русский):ru_RU
+18:Ukrainian (Український):uk_UA
+#
+0:In Progress::
+21:Arabic (ﺔﻴﺑﺮﻌﻟﺍ):ar_EG
+5:German (Deutsch):de_DE
+4:Italian (Italiano):it_IT
+2:Japanese (日本語):ja_JP
+13:Simplified Chinese (简体中文):zh_CN
+14:Traditional Chinese (繁體中文):zh_TW
+#
+0:Starting::
+# No translation yet! #22:Bulgarian (Български):bg_BG
+# No translation yet! #10:Catalan (Català):ca_AD
+11:Czech (Český):cs_CZ
+# No translation yet! #23:Greek (Ελληνικά):el_GR
+35:Esperanto (Esperanto):eo
+36:Spanish from Spain (Español de España):es_ES
+34:Estonian (Eestlane):et_EE
+26:Persian (ﯽﺳﺭﺎﻓ):fa_IR
+# No translation yet! #6:Finnish (Suomi):fi_FI
+33:Hebrew (תירִבְעִ):he_IL
+16:Croatian (Hrvatski):hr_HR
+31:Hungarian (Magyar):hu_HU
+27:Indonesian (Bahasa indonesia):id_ID
+# No translation yet! #24:Korean (한국 언어):ko_KR
+29:Kyrgyz (Кыргыз тили):ky_KG
+# No translation yet! #25:Nepali (नेपाली):ne_NP
+3:Dutch (Nederlandse taal):nl_NL
+# No translation yet! #19:Polish (Polski):pl_PL
+# No translation yet! #20:Romanian (Român):ro_RO
+17:Serbian (Српски):sr_RS
+28:Serbian Latin (Srpski latinica):sr_RS at latin
+7:Swedish (Svenska):sv_SE
+30:Turkish (Türkçe):tr_TR
diff --git a/release/datafiles/locale/ne/LC_MESSAGES/blender.mo b/release/datafiles/locale/ne/LC_MESSAGES/blender.mo
deleted file mode 100644
index b74767e..0000000
Binary files a/release/datafiles/locale/ne/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/nl/LC_MESSAGES/blender.mo b/release/datafiles/locale/nl/LC_MESSAGES/blender.mo
index 4b00931..667c254 100644
Binary files a/release/datafiles/locale/nl/LC_MESSAGES/blender.mo and b/release/datafiles/locale/nl/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/pl/LC_MESSAGES/blender.mo b/release/datafiles/locale/pl/LC_MESSAGES/blender.mo
deleted file mode 100644
index 43fa346..0000000
Binary files a/release/datafiles/locale/pl/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/pt/LC_MESSAGES/blender.mo b/release/datafiles/locale/pt/LC_MESSAGES/blender.mo
index 38d5480..4c58467 100644
Binary files a/release/datafiles/locale/pt/LC_MESSAGES/blender.mo and b/release/datafiles/locale/pt/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/pt_BR/LC_MESSAGES/blender.mo b/release/datafiles/locale/pt_BR/LC_MESSAGES/blender.mo
index e9b96cd..91e0620 100644
Binary files a/release/datafiles/locale/pt_BR/LC_MESSAGES/blender.mo and b/release/datafiles/locale/pt_BR/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/ru/LC_MESSAGES/blender.mo b/release/datafiles/locale/ru/LC_MESSAGES/blender.mo
index e1c0415..67ba4c4 100644
Binary files a/release/datafiles/locale/ru/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ru/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/sr/LC_MESSAGES/blender.mo b/release/datafiles/locale/sr/LC_MESSAGES/blender.mo
index f098136..f2ee55e 100644
Binary files a/release/datafiles/locale/sr/LC_MESSAGES/blender.mo and b/release/datafiles/locale/sr/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/sr at latin/LC_MESSAGES/blender.mo b/release/datafiles/locale/sr at latin/LC_MESSAGES/blender.mo
index b25fdef..c5ab15d 100644
Binary files a/release/datafiles/locale/sr at latin/LC_MESSAGES/blender.mo and b/release/datafiles/locale/sr at latin/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/sv/LC_MESSAGES/blender.mo b/release/datafiles/locale/sv/LC_MESSAGES/blender.mo
index 5df9f85..a4dedbb 100644
Binary files a/release/datafiles/locale/sv/LC_MESSAGES/blender.mo and b/release/datafiles/locale/sv/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/tr/LC_MESSAGES/blender.mo b/release/datafiles/locale/tr/LC_MESSAGES/blender.mo
index 438b407..c30888b 100644
Binary files a/release/datafiles/locale/tr/LC_MESSAGES/blender.mo and b/release/datafiles/locale/tr/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/uk/LC_MESSAGES/blender.mo b/release/datafiles/locale/uk/LC_MESSAGES/blender.mo
index bed0a73..005d6ea 100644
Binary files a/release/datafiles/locale/uk/LC_MESSAGES/blender.mo and b/release/datafiles/locale/uk/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/zh_CN/LC_MESSAGES/blender.mo b/release/datafiles/locale/zh_CN/LC_MESSAGES/blender.mo
index 8d487f6..fe01566 100644
Binary files a/release/datafiles/locale/zh_CN/LC_MESSAGES/blender.mo and b/release/datafiles/locale/zh_CN/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/zh_TW/LC_MESSAGES/blender.mo b/release/datafiles/locale/zh_TW/LC_MESSAGES/blender.mo
index 7a425b7..3354d6a 100644
Binary files a/release/datafiles/locale/zh_TW/LC_MESSAGES/blender.mo and b/release/datafiles/locale/zh_TW/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/prvicons.png b/release/datafiles/prvicons.png
index 364d967..1636e64 100644
Binary files a/release/datafiles/prvicons.png and b/release/datafiles/prvicons.png differ
diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png
index 7f40ead..41284ef 100644
Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ
diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index 8b0e052..cdd43c7 100644
Binary files a/release/datafiles/startup.blend and b/release/datafiles/startup.blend differ
diff --git a/release/scripts/addons/add_curve_sapling/__init__.py b/release/scripts/addons/add_curve_sapling/__init__.py
index e4f5b9c..2440516 100644
--- a/release/scripts/addons/add_curve_sapling/__init__.py
+++ b/release/scripts/addons/add_curve_sapling/__init__.py
@@ -378,7 +378,7 @@ class AddTree(bpy.types.Operator):
     presetName = StringProperty(name='Preset Name',
         description='The name of the preset to be saved',
         default='',
-        subtype='FILENAME', update=no_update_tree)
+        subtype='FILE_NAME', update=no_update_tree)
     limitImport = BoolProperty(name='Limit Import',
         description='Limited imported tree to 2 levels & no leaves for speed',
         default=True, update=no_update_tree)
diff --git a/release/scripts/addons/add_curve_sapling/utils.py b/release/scripts/addons/add_curve_sapling/utils.py
index 2aae8a6..cba70ab 100644
--- a/release/scripts/addons/add_curve_sapling/utils.py
+++ b/release/scripts/addons/add_curve_sapling/utils.py
@@ -761,15 +761,19 @@ def addTree(props):
             bpy.context.scene.objects.link(leafObj)
             leafObj.parent = treeOb
             leafMesh.from_pydata(leafVerts,(),leafFaces)
-            leafMesh.validate()
 
-            '''
-            # TODO: Broken after Bmesh merger, disable for now since default uvs are OK
             if leafShape == 'rect':
-                uv = leafMesh.uv_textures.new("leafUV")
-                for tf in uv.data:
-                    tf.uv1, tf.uv2, tf.uv3, tf.uv4 = Vector((1, 0)), Vector((1, 1)), Vector((1 - leafScaleX, 1)), Vector((1 - leafScaleX, 0))
-            '''
+                leafMesh.uv_textures.new("leafUV")
+                uvlayer = leafMesh.uv_layers.active.data
+
+                for i in range(0, len(leafFaces)):
+                    uvlayer[i*4 + 0].uv = Vector((1, 0))
+                    uvlayer[i*4 + 1].uv = Vector((1, 1))
+                    uvlayer[i*4 + 2].uv = Vector((1 - leafScaleX, 1))
+                    uvlayer[i*4 + 3].uv = Vector((1 - leafScaleX, 0))
+
+            leafMesh.validate()
+
 # This can be used if we need particle leaves
 #            if (storeN == levels-1) and leaves:
 #                normalList = []
diff --git a/release/scripts/addons/add_mesh_ant_landscape.py b/release/scripts/addons/add_mesh_ant_landscape.py
index c3aeb86..52c2856 100644
--- a/release/scripts/addons/add_mesh_ant_landscape.py
+++ b/release/scripts/addons/add_mesh_ant_landscape.py
@@ -781,7 +781,7 @@ class landscape_add(bpy.types.Operator):
             # sphere, remove doubles
             if self.SphereMesh !=0:
                 bpy.ops.object.mode_set(mode='EDIT')
-                bpy.ops.mesh.remove_doubles(mergedist=0.0001)
+                bpy.ops.mesh.remove_doubles(threshold=0.0001)
                 bpy.ops.object.mode_set(mode='OBJECT')
 
             # Shade smooth
diff --git a/release/scripts/addons/animation_animall.py b/release/scripts/addons/animation_animall.py
index e291799..c20f64b 100644
--- a/release/scripts/addons/animation_animall.py
+++ b/release/scripts/addons/animation_animall.py
@@ -198,10 +198,18 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
                 bpy.ops.object.editmode_toggle()
         
         if Obj.type == 'LATTICE':
+            Mode = False
+            if context.mode != 'OBJECT':
+                Mode = not Mode
+                bpy.ops.object.editmode_toggle()
+            
             if context.window_manager.key_shape:
                 if Obj.active_shape_key:
                     for Point in Obj.active_shape_key.data:
                         Point.keyframe_insert('co')
+            
+            if Mode:
+                bpy.ops.object.editmode_toggle()
         
         if Obj.type == 'CURVE':
             Mode = False
diff --git a/release/scripts/addons/compositing_film_response/__init__.py b/release/scripts/addons/compositing_film_response/__init__.py
new file mode 100644
index 0000000..b480c4b
--- /dev/null
+++ b/release/scripts/addons/compositing_film_response/__init__.py
@@ -0,0 +1,199 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+bl_info = {
+    "name": "Film Response Curves",
+    "author": "Brecht Van Lommel",
+    "version": (0, 1),
+    "blender": (2, 6, 3),
+    "location": "Node Editor > Panels > Film Response",
+    "description": "Apply film response preset to RGB Curves node",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts/Render/Film_Response",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=33246",
+    "support": 'OFFICIAL',
+    "category": "Compositing"}
+
+import bpy
+import math
+
+def srgb_to_linearrgb(c):
+    if c < 0.04045:
+        if c < 0.0:
+            return 0.0
+        else:
+            return c * (1.0 / 12.92)
+    else:
+        return math.pow((c + 0.055) * (1.0 / 1.055), 2.4)
+
+def apply_curve_table(curve, table):
+    num = len(table)
+    
+    while len(curve.points) > 2:
+        curve.points.remove(curve.points[0])
+    
+    curve.points[0].location = (0.0, srgb_to_linearrgb(table[0]))
+    curve.points[-1].location = (1.0, srgb_to_linearrgb(table[-1]))
+    
+    for i in range(1, num-1, 5):
+        x = i/(num-1)
+        y = srgb_to_linearrgb(table[i])
+        
+        curve.points.new(x, y)        
+
+def apply_curvemapping(node, response_name):
+    from . import film_response_curves
+    
+    Rcurve, Gcurve, Bcurve = node.mapping.curves[0:3]
+    
+    for FR in film_response_curves.FILM_RESPONSE:
+        brand, name, log, isrgb, I_R, B_R, I_G, B_G, I_B, B_B = FR
+        
+        if name == response_name:            
+            apply_curve_table(Rcurve, B_R)
+            
+            if isrgb:
+                apply_curve_table(Gcurve, B_G)
+                apply_curve_table(Bcurve, B_B)
+            else:
+                apply_curve_table(Gcurve, B_R)
+                apply_curve_table(Bcurve, B_R)
+            
+            node.mapping.update()
+            node.inputs[0].default_value = node.inputs[0].default_value
+        
+#ntree = bpy.context.scene.node_tree
+#node = ntree.nodes["RGB Curves"]
+
+response_curve_items = (
+("", "Agfa", ""),
+("Agfacolor Futura 100", "Futura 100", ""),
+("Agfacolor Futura 200", "Futura 200", ""),
+("Agfacolor Futura 400", "Futura 400", ""),
+("Agfacolor Futura II 100", "Futura II 100", ""),
+("Agfacolor Futura II 200", "Futura II 200", ""),
+("Agfacolor Futura II 400", "Futura II 400", ""),
+("Agfacolor HDC 100 plus", "HDC 100 plus", ""),
+("Agfacolor HDC 400 plus", "HDC 400 plus", ""),
+("Agfacolor HDC 200 plus", "HDC 200 plus", ""),
+("Agfacolor Optima II 100", "Optima II 100", ""),
+("Agfacolor Optima II 200", "Optima II 200", ""),
+("Agfacolor Ultra 050", "Ultra 050", ""),
+("", "Agfa", ""),
+("Agfacolor Vista 100", "Vista 100", ""),
+("Agfacolor Vista 200", "Vista 200", ""),
+("Agfacolor Vista 400", "Vista 400", ""),
+("Agfacolor Vista 800", "Vista 800", ""),
+("Agfachrome CT Precisa 100", "CT Precisa 100", ""),
+("Agfachrome CT Precisa 200", "CT Precisa 200", ""),
+("Agfachrome RSX2 050", "Agfachrome RSX2 050", ""),
+("Agfachrome RSX2 100", "Agfachrome RSX2 100", ""),
+("Agfachrome RSX2 200", "Agfachrome RSX2 200", ""),
+("Advantix 100", "Advantix 100", ""),
+("Advantix 200", "Advantix 200", ""),
+("Advantix 400", "Advantix 400", ""),
+("", "Kodak", ""),
+("Gold 100", "Gold 100", ""),
+("Gold 200", "Gold 200", ""),
+("Max Zoom 800", "Max Zoom 800", ""),
+("Portra 100T", "Portra 100T", ""),
+("Portra 160NC", "Portra 160NC", ""),
+("Portra 160VC", "Portra 160VC", ""),
+("Portra 800", "Portra 800", ""),
+("Portra 400VC", "Portra 400VC", ""),
+("Portra 400NC", "Portra 400NC", ""),
+("", "Kodak", ""),
+("Ektachrome 100 plus", "Ektachrome 100 plus", ""),
+("Ektachrome 320T", "Ektachrome 320T", ""),
+("Ektachrome 400X", "Ektachrome 400X", ""),
+("Ektachrome 64", "Ektachrome 64", ""),
+("Ektachrome 64T", "Ektachrome 64T", ""),
+("Ektachrome E100S", "Ektachrome E100S", ""),
+("Ektachrome 100", "Ektachrome 100", ""),
+("Kodachrome 200", "Kodachrome 200", ""),
+("Kodachrome 25", "Kodachrome 25", ""),
+("Kodachrome 64", "Kodachrome 64", ""),
+("", "Fujifilm", ""),
+("F-125", "F-125", ""),
+("F-250", "F-250", ""),
+("F-400", "F-400", ""),
+("FCI", "FCI", ""),
+("FP2900Z", "FP2900Z", ""),
+("", "Eastman", ""),
+("Double X Neg 12min", "Double X Neg 12min", ""),
+("Double X Neg 6min", "Double X Neg 6min", ""),
+("Double X Neg 5min", "Double X Neg 5min", ""),
+("Double X Neg 4min", "Double X Neg 4min", ""),
+("", "Canon", ""),
+("Optura 981111", "Optura 981111", ""),
+("Optura 981113", "Optura 981113", ""),
+("Optura 981114", "Optura 981114", ""),
+("Optura 981111.SLRR", "Optura 981111.SLRR", "")
+)
+
+def film_response_update(self, context):
+    bpy.ops.node.film_response()
+
+bpy.types.Scene.mango_response_curve = bpy.props.EnumProperty(name="Response Curve", description="Measured camera film response",
+        items=response_curve_items, default="Advantix 400", update=film_response_update)
+
+class FilmResponseOperator(bpy.types.Operator):
+    '''Set film response preset on active RGB Curves node'''
+    bl_idname = "node.film_response"
+    bl_label = "Set Film Response"
+
+    @classmethod
+    def poll(cls, context):
+        node = context.active_node
+        return node and node.type == 'CURVE_RGB'
+
+    def execute(self, context):
+        node = context.active_node
+        apply_curvemapping(node, context.scene.mango_response_curve)
+        return {'FINISHED'}
+
+class NODE_PT_film_response(bpy.types.Panel):
+    bl_space_type = 'NODE_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Film Response"
+
+    @classmethod
+    def poll(cls, context):
+        node = context.active_node
+        return node and node.type == 'CURVE_RGB'
+
+    def draw(self, context):
+        layout = self.layout
+        
+        layout.prop(context.scene, "mango_response_curve", text="")
+
+def register():
+    bpy.utils.register_class(FilmResponseOperator)
+    bpy.utils.register_class(NODE_PT_film_response)
+
+def unregister():
+    bpy.utils.unregister_class(FilmResponseOperator)
+    bpy.utils.unregister_class(NODE_PT_film_response)
+
+if __name__ == "__main__":
+    register()
+    
diff --git a/release/scripts/addons/compositing_film_response/film_response_curves.py b/release/scripts/addons/compositing_film_response/film_response_curves.py
new file mode 100644
index 0000000..60858b3
--- /dev/null
+++ b/release/scripts/addons/compositing_film_response/film_response_curves.py
@@ -0,0 +1,36129 @@
+#
+# "What is the Space of Camera Response Functions?," 
+# M.D. Grossberg and S.K. Nayar, 
+# IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 
+# Vol.II, pp.602-609, Jun, 2003.
+#
+# http://www.cs.columbia.edu/CAVE/software/softlib/dorf.php
+#
+
+FILM_RESPONSE = (
+("Agfa", "Agfacolor Futura 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.874143e-002, 3.302222e-002, 4.495423e-002, 5.564009e-002, 6.549130e-002, 7.477075e-002, 8.363063e-002, 9.216746e-002, 1.004453e-001,
+1.085428e-001, 1.164768e-001, 1.242111e-001, 1.316561e-001, 1.387570e-001, 1.455107e-001, 1.519546e-001, 1.581332e-001, 1.640817e-001, 1.698216e-001,
+1.753643e-001, 1.807105e-001, 1.858937e-001, 1.909191e-001, 1.958167e-001, 2.005814e-001, 2.052128e-001, 2.097522e-001, 2.141970e-001, 2.185295e-001,
+2.227485e-001, 2.268646e-001, 2.308859e-001, 2.348421e-001, 2.387397e-001, 2.425788e-001, 2.463495e-001, 2.500706e-001, 2.537480e-001, 2.573781e-001,
+2.609572e-001, 2.644815e-001, 2.679471e-001, 2.713502e-001, 2.746953e-001, 2.779826e-001, 2.812090e-001, 2.843786e-001, 2.875038e-001, 2.905904e-001,
+2.936390e-001, 2.966530e-001, 2.996253e-001, 3.025568e-001, 3.054537e-001, 3.083193e-001, 3.111566e-001, 3.139680e-001, 3.167570e-001, 3.195263e-001,
+3.222786e-001, 3.250167e-001, 3.277422e-001, 3.304488e-001, 3.331305e-001, 3.357871e-001, 3.384202e-001, 3.410324e-001, 3.436256e-001, 3.462015e-001,
+3.487611e-001, 3.513004e-001, 3.538152e-001, 3.563049e-001, 3.587694e-001, 3.612132e-001, 3.636367e-001, 3.660412e-001, 3.684293e-001, 3.708002e-001,
+3.731576e-001, 3.754999e-001, 3.778310e-001, 3.801496e-001, 3.824588e-001, 3.847584e-001, 3.870503e-001, 3.893357e-001, 3.916150e-001, 3.938865e-001,
+3.961476e-001, 3.983986e-001, 4.006390e-001, 4.028655e-001, 4.050789e-001, 4.072808e-001, 4.094718e-001, 4.116508e-001, 4.138200e-001, 4.159774e-001,
+4.181219e-001, 4.202522e-001, 4.223701e-001, 4.244759e-001, 4.265704e-001, 4.286542e-001, 4.307269e-001, 4.327894e-001, 4.348412e-001, 4.368841e-001,
+4.389176e-001, 4.409426e-001, 4.429590e-001, 4.449672e-001, 4.469677e-001, 4.489580e-001, 4.509371e-001, 4.529056e-001, 4.548639e-001, 4.568126e-001,
+4.587524e-001, 4.606837e-001, 4.626070e-001, 4.645206e-001, 4.664235e-001, 4.683177e-001, 4.702026e-001, 4.720798e-001, 4.739468e-001, 4.758001e-001,
+4.776405e-001, 4.794681e-001, 4.812826e-001, 4.830833e-001, 4.848700e-001, 4.866447e-001, 4.884060e-001, 4.901560e-001, 4.918906e-001, 4.936126e-001,
+4.953205e-001, 4.970145e-001, 4.986953e-001, 5.003637e-001, 5.020196e-001, 5.036631e-001, 5.052949e-001, 5.069148e-001, 5.085230e-001, 5.101200e-001,
+5.117021e-001, 5.132743e-001, 5.148365e-001, 5.163901e-001, 5.179367e-001, 5.194708e-001, 5.209967e-001, 5.225142e-001, 5.240232e-001, 5.255233e-001,
+5.270152e-001, 5.284978e-001, 5.299712e-001, 5.314347e-001, 5.328864e-001, 5.343297e-001, 5.357652e-001, 5.371924e-001, 5.386118e-001, 5.400265e-001,
+5.414370e-001, 5.428368e-001, 5.442284e-001, 5.456126e-001, 5.469890e-001, 5.483578e-001, 5.497221e-001, 5.510821e-001, 5.524330e-001, 5.537773e-001,
+5.551131e-001, 5.564406e-001, 5.577619e-001, 5.590746e-001, 5.603765e-001, 5.616723e-001, 5.629597e-001, 5.642386e-001, 5.655132e-001, 5.667813e-001,
+5.680419e-001, 5.692980e-001, 5.705439e-001, 5.717847e-001, 5.730206e-001, 5.742480e-001, 5.754718e-001, 5.766893e-001, 5.778992e-001, 5.791049e-001,
+5.802995e-001, 5.814914e-001, 5.826792e-001, 5.838587e-001, 5.850345e-001, 5.861984e-001, 5.873591e-001, 5.885141e-001, 5.896620e-001, 5.908060e-001,
+5.919440e-001, 5.930796e-001, 5.942065e-001, 5.953297e-001, 5.964481e-001, 5.975626e-001, 5.986750e-001, 5.997777e-001, 6.008783e-001, 6.019700e-001,
+6.030591e-001, 6.041416e-001, 6.052210e-001, 6.062966e-001, 6.073693e-001, 6.084403e-001, 6.095040e-001, 6.105655e-001, 6.116195e-001, 6.126726e-001,
+6.137180e-001, 6.147624e-001, 6.157986e-001, 6.168331e-001, 6.178601e-001, 6.188860e-001, 6.199087e-001, 6.209291e-001, 6.219440e-001, 6.229551e-001,
+6.239586e-001, 6.249598e-001, 6.259567e-001, 6.269508e-001, 6.279395e-001, 6.289267e-001, 6.299109e-001, 6.308935e-001, 6.318725e-001, 6.328494e-001,
+6.338199e-001, 6.347896e-001, 6.357562e-001, 6.367221e-001, 6.376814e-001, 6.386406e-001, 6.395892e-001, 6.405378e-001, 6.414811e-001, 6.424237e-001,
+6.433592e-001, 6.442923e-001, 6.452214e-001, 6.461476e-001, 6.470721e-001, 6.479939e-001, 6.489133e-001, 6.498241e-001, 6.507347e-001, 6.516370e-001,
+6.525393e-001, 6.534369e-001, 6.543331e-001, 6.552256e-001, 6.561150e-001, 6.570025e-001, 6.578855e-001, 6.587684e-001, 6.596441e-001, 6.605198e-001,
+6.613911e-001, 6.622604e-001, 6.631279e-001, 6.639923e-001, 6.648563e-001, 6.657120e-001, 6.665678e-001, 6.674182e-001, 6.682662e-001, 6.691122e-001,
+6.699538e-001, 6.707954e-001, 6.716330e-001, 6.724701e-001, 6.733045e-001, 6.741360e-001, 6.749671e-001, 6.757914e-001, 6.766156e-001, 6.774366e-001,
+6.782554e-001, 6.790735e-001, 6.798857e-001, 6.806980e-001, 6.815052e-001, 6.823093e-001, 6.831128e-001, 6.839105e-001, 6.847082e-001, 6.855019e-001,
+6.862922e-001, 6.870825e-001, 6.878691e-001, 6.886556e-001, 6.894405e-001, 6.902231e-001, 6.910058e-001, 6.917820e-001, 6.925567e-001, 6.933307e-001,
+6.941011e-001, 6.948715e-001, 6.956395e-001, 6.964055e-001, 6.971715e-001, 6.979303e-001, 6.986879e-001, 6.994447e-001, 7.001975e-001, 7.009503e-001,
+7.017009e-001, 7.024488e-001, 7.031968e-001, 7.039384e-001, 7.046775e-001, 7.054166e-001, 7.061507e-001, 7.068846e-001, 7.076175e-001, 7.083460e-001,
+7.090746e-001, 7.098006e-001, 7.105225e-001, 7.112444e-001, 7.119640e-001, 7.126818e-001, 7.133996e-001, 7.141136e-001, 7.148258e-001, 7.155380e-001,
+7.162465e-001, 7.169542e-001, 7.176619e-001, 7.183669e-001, 7.190717e-001, 7.197766e-001, 7.204758e-001, 7.211749e-001, 7.218739e-001, 7.225684e-001,
+7.232629e-001, 7.239572e-001, 7.246487e-001, 7.253403e-001, 7.260314e-001, 7.267172e-001, 7.274029e-001, 7.280884e-001, 7.287695e-001, 7.294505e-001,
+7.301315e-001, 7.308094e-001, 7.314874e-001, 7.321653e-001, 7.328377e-001, 7.335098e-001, 7.341818e-001, 7.348498e-001, 7.355170e-001, 7.361841e-001,
+7.368490e-001, 7.375129e-001, 7.381768e-001, 7.388374e-001, 7.394953e-001, 7.401532e-001, 7.408087e-001, 7.414602e-001, 7.421118e-001, 7.427624e-001,
+7.434084e-001, 7.440543e-001, 7.447003e-001, 7.453430e-001, 7.459854e-001, 7.466279e-001, 7.472671e-001, 7.479049e-001, 7.485427e-001, 7.491783e-001,
+7.498108e-001, 7.504434e-001, 7.510756e-001, 7.517048e-001, 7.523341e-001, 7.529633e-001, 7.535892e-001, 7.542141e-001, 7.548390e-001, 7.554619e-001,
+7.560819e-001, 7.567018e-001, 7.573217e-001, 7.579385e-001, 7.585554e-001, 7.591722e-001, 7.597867e-001, 7.603995e-001, 7.610123e-001, 7.616243e-001,
+7.622311e-001, 7.628380e-001, 7.634449e-001, 7.640486e-001, 7.646508e-001, 7.652529e-001, 7.658545e-001, 7.664529e-001, 7.670514e-001, 7.676498e-001,
+7.682449e-001, 7.688378e-001, 7.694307e-001, 7.700235e-001, 7.706120e-001, 7.712005e-001, 7.717891e-001, 7.723761e-001, 7.729613e-001, 7.735465e-001,
+7.741318e-001, 7.747127e-001, 7.752927e-001, 7.758728e-001, 7.764521e-001, 7.770282e-001, 7.776042e-001, 7.781802e-001, 7.787548e-001, 7.793279e-001,
+7.799009e-001, 7.804740e-001, 7.810425e-001, 7.816096e-001, 7.821767e-001, 7.827437e-001, 7.833052e-001, 7.838668e-001, 7.844284e-001, 7.849893e-001,
+7.855485e-001, 7.861077e-001, 7.866668e-001, 7.872236e-001, 7.877774e-001, 7.883312e-001, 7.888850e-001, 7.894352e-001, 7.899830e-001, 7.905307e-001,
+7.910785e-001, 7.916235e-001, 7.921676e-001, 7.927117e-001, 7.932558e-001, 7.937961e-001, 7.943355e-001, 7.948749e-001, 7.954143e-001, 7.959490e-001,
+7.964831e-001, 7.970171e-001, 7.975512e-001, 7.980825e-001, 7.986135e-001, 7.991445e-001, 7.996755e-001, 8.002029e-001, 8.007300e-001, 8.012570e-001,
+8.017841e-001, 8.023071e-001, 8.028294e-001, 8.033518e-001, 8.038742e-001, 8.043946e-001, 8.049146e-001, 8.054345e-001, 8.059545e-001, 8.064722e-001,
+8.069889e-001, 8.075056e-001, 8.080223e-001, 8.085361e-001, 8.090477e-001, 8.095593e-001, 8.100709e-001, 8.105811e-001, 8.110891e-001, 8.115971e-001,
+8.121052e-001, 8.126128e-001, 8.131184e-001, 8.136240e-001, 8.141296e-001, 8.146352e-001, 8.151368e-001, 8.156381e-001, 8.161394e-001, 8.166407e-001,
+8.171395e-001, 8.176370e-001, 8.181345e-001, 8.186320e-001, 8.191283e-001, 8.196224e-001, 8.201166e-001, 8.206107e-001, 8.211048e-001, 8.215956e-001,
+8.220864e-001, 8.225772e-001, 8.230679e-001, 8.235569e-001, 8.240448e-001, 8.245326e-001, 8.250205e-001, 8.255078e-001, 8.259932e-001, 8.264786e-001,
+8.269640e-001, 8.274494e-001, 8.279316e-001, 8.284127e-001, 8.288938e-001, 8.293749e-001, 8.298550e-001, 8.303318e-001, 8.308086e-001, 8.312854e-001,
+8.317622e-001, 8.322366e-001, 8.327100e-001, 8.331834e-001, 8.336568e-001, 8.341297e-001, 8.345997e-001, 8.350697e-001, 8.355397e-001, 8.360097e-001,
+8.364779e-001, 8.369446e-001, 8.374112e-001, 8.378779e-001, 8.383445e-001, 8.388080e-001, 8.392712e-001, 8.397343e-001, 8.401975e-001, 8.406597e-001,
+8.411187e-001, 8.415778e-001, 8.420368e-001, 8.424958e-001, 8.429537e-001, 8.434104e-001, 8.438671e-001, 8.443238e-001, 8.447804e-001, 8.452353e-001,
+8.456894e-001, 8.461435e-001, 8.465977e-001, 8.470518e-001, 8.475030e-001, 8.479540e-001, 8.484050e-001, 8.488560e-001, 8.493067e-001, 8.497546e-001,
+8.502025e-001, 8.506504e-001, 8.510983e-001, 8.515454e-001, 8.519896e-001, 8.524339e-001, 8.528781e-001, 8.533224e-001, 8.537652e-001, 8.542046e-001,
+8.546440e-001, 8.550834e-001, 8.555228e-001, 8.559611e-001, 8.563969e-001, 8.568327e-001, 8.572685e-001, 8.577043e-001, 8.581393e-001, 8.585725e-001,
+8.590057e-001, 8.594390e-001, 8.598722e-001, 8.603044e-001, 8.607339e-001, 8.611634e-001, 8.615929e-001, 8.620224e-001, 8.624515e-001, 8.628784e-001,
+8.633053e-001, 8.637322e-001, 8.641591e-001, 8.645860e-001, 8.650114e-001, 8.654368e-001, 8.658622e-001, 8.662877e-001, 8.667131e-001, 8.671353e-001,
+8.675571e-001, 8.679789e-001, 8.684007e-001, 8.688225e-001, 8.692412e-001, 8.696582e-001, 8.700753e-001, 8.704924e-001, 8.709095e-001, 8.713259e-001,
+8.717416e-001, 8.721573e-001, 8.725730e-001, 8.729887e-001, 8.734041e-001, 8.738173e-001, 8.742304e-001, 8.746436e-001, 8.750568e-001, 8.754699e-001,
+8.758796e-001, 8.762882e-001, 8.766967e-001, 8.771053e-001, 8.775139e-001, 8.779212e-001, 8.783264e-001, 8.787316e-001, 8.791368e-001, 8.795420e-001,
+8.799472e-001, 8.803502e-001, 8.807530e-001, 8.811559e-001, 8.815587e-001, 8.819616e-001, 8.823628e-001, 8.827621e-001, 8.831614e-001, 8.835607e-001,
+8.839600e-001, 8.843594e-001, 8.847564e-001, 8.851533e-001, 8.855502e-001, 8.859471e-001, 8.863440e-001, 8.867404e-001, 8.871359e-001, 8.875315e-001,
+8.879270e-001, 8.883225e-001, 8.887181e-001, 8.891111e-001, 8.895033e-001, 8.898954e-001, 8.902876e-001, 8.906797e-001, 8.910716e-001, 8.914600e-001,
+8.918484e-001, 8.922368e-001, 8.926252e-001, 8.930136e-001, 8.934014e-001, 8.937881e-001, 8.941749e-001, 8.945616e-001, 8.949483e-001, 8.953351e-001,
+8.957205e-001, 8.961051e-001, 8.964897e-001, 8.968743e-001, 8.972589e-001, 8.976435e-001, 8.980248e-001, 8.984054e-001, 8.987859e-001, 8.991664e-001,
+8.995470e-001, 8.999275e-001, 9.003066e-001, 9.006856e-001, 9.010646e-001, 9.014436e-001, 9.018227e-001, 9.022016e-001, 9.025796e-001, 9.029576e-001,
+9.033356e-001, 9.037136e-001, 9.040916e-001, 9.044692e-001, 9.048433e-001, 9.052175e-001, 9.055917e-001, 9.059658e-001, 9.063400e-001, 9.067137e-001,
+9.070837e-001, 9.074538e-001, 9.078238e-001, 9.081938e-001, 9.085638e-001, 9.089337e-001, 9.093016e-001, 9.096695e-001, 9.100374e-001, 9.104053e-001,
+9.107732e-001, 9.111410e-001, 9.115065e-001, 9.118717e-001, 9.122370e-001, 9.126023e-001, 9.129676e-001, 9.133329e-001, 9.136958e-001, 9.140580e-001,
+9.144203e-001, 9.147826e-001, 9.151449e-001, 9.155072e-001, 9.158688e-001, 9.162301e-001, 9.165913e-001, 9.169526e-001, 9.173138e-001, 9.176751e-001,
+9.180358e-001, 9.183957e-001, 9.187555e-001, 9.191153e-001, 9.194751e-001, 9.198349e-001, 9.201946e-001, 9.205503e-001, 9.209061e-001, 9.212618e-001,
+9.216175e-001, 9.219732e-001, 9.223289e-001, 9.226826e-001, 9.230353e-001, 9.233880e-001, 9.237407e-001, 9.240934e-001, 9.244461e-001, 9.247984e-001,
+9.251496e-001, 9.255007e-001, 9.258518e-001, 9.262030e-001, 9.265541e-001, 9.269053e-001, 9.272541e-001, 9.276024e-001, 9.279508e-001, 9.282991e-001,
+9.286474e-001, 9.289957e-001, 9.293431e-001, 9.296882e-001, 9.300334e-001, 9.303785e-001, 9.307237e-001, 9.310688e-001, 9.314139e-001, 9.317582e-001,
+9.321020e-001, 9.324458e-001, 9.327897e-001, 9.331335e-001, 9.334774e-001, 9.338211e-001, 9.341632e-001, 9.345054e-001, 9.348475e-001, 9.351897e-001,
+9.355319e-001, 9.358740e-001, 9.362150e-001, 9.365543e-001, 9.368936e-001, 9.372329e-001, 9.375721e-001, 9.379114e-001, 9.382507e-001, 9.385885e-001,
+9.389254e-001, 9.392624e-001, 9.395994e-001, 9.399364e-001, 9.402733e-001, 9.406103e-001, 9.409458e-001, 9.412811e-001, 9.416163e-001, 9.419516e-001,
+9.422868e-001, 9.426221e-001, 9.429573e-001, 9.432896e-001, 9.436219e-001, 9.439543e-001, 9.442866e-001, 9.446190e-001, 9.449513e-001, 9.452833e-001,
+9.456124e-001, 9.459415e-001, 9.462706e-001, 9.465998e-001, 9.469289e-001, 9.472580e-001, 9.475869e-001, 9.479146e-001, 9.482423e-001, 9.485700e-001,
+9.488977e-001, 9.492254e-001, 9.495530e-001, 9.498805e-001, 9.502064e-001, 9.505323e-001, 9.508582e-001, 9.511840e-001, 9.515099e-001, 9.518358e-001,
+9.521615e-001, 9.524835e-001, 9.528055e-001, 9.531275e-001, 9.534494e-001, 9.537714e-001, 9.540934e-001, 9.544153e-001, 9.547338e-001, 9.550519e-001,
+9.553700e-001, 9.556880e-001, 9.560061e-001, 9.563242e-001, 9.566423e-001, 9.569590e-001, 9.572751e-001, 9.575913e-001, 9.579074e-001, 9.582235e-001,
+9.585396e-001, 9.588558e-001, 9.591705e-001, 9.594833e-001, 9.597962e-001, 9.601091e-001, 9.604219e-001, 9.607348e-001, 9.610477e-001, 9.613603e-001,
+9.616711e-001, 9.619820e-001, 9.622929e-001, 9.626037e-001, 9.629146e-001, 9.632255e-001, 9.635364e-001, 9.638459e-001, 9.641550e-001, 9.644640e-001,
+9.647731e-001, 9.650822e-001, 9.653913e-001, 9.657003e-001, 9.660085e-001, 9.663147e-001, 9.666209e-001, 9.669271e-001, 9.672332e-001, 9.675394e-001,
+9.678456e-001, 9.681518e-001, 9.684558e-001, 9.687593e-001, 9.690628e-001, 9.693662e-001, 9.696697e-001, 9.699732e-001, 9.702767e-001, 9.705796e-001,
+9.708810e-001, 9.711824e-001, 9.714838e-001, 9.717851e-001, 9.720865e-001, 9.723879e-001, 9.726893e-001, 9.729892e-001, 9.732881e-001, 9.735870e-001,
+9.738860e-001, 9.741849e-001, 9.744839e-001, 9.747828e-001, 9.750817e-001, 9.753785e-001, 9.756751e-001, 9.759717e-001, 9.762683e-001, 9.765649e-001,
+9.768614e-001, 9.771580e-001, 9.774542e-001, 9.777484e-001, 9.780427e-001, 9.783369e-001, 9.786311e-001, 9.789253e-001, 9.792196e-001, 9.795138e-001,
+9.798069e-001, 9.800981e-001, 9.803892e-001, 9.806804e-001, 9.809715e-001, 9.812627e-001, 9.815538e-001, 9.818450e-001, 9.821347e-001, 9.824227e-001,
+9.827107e-001, 9.829987e-001, 9.832867e-001, 9.835747e-001, 9.838627e-001, 9.841507e-001, 9.844373e-001, 9.847225e-001, 9.850078e-001, 9.852931e-001,
+9.855784e-001, 9.858637e-001, 9.861490e-001, 9.864342e-001, 9.867179e-001, 9.870000e-001, 9.872820e-001, 9.875641e-001, 9.878462e-001, 9.881282e-001,
+9.884103e-001, 9.886924e-001, 9.889731e-001, 9.892522e-001, 9.895312e-001, 9.898102e-001, 9.900892e-001, 9.903682e-001, 9.906473e-001, 9.909263e-001,
+9.912045e-001, 9.914805e-001, 9.917564e-001, 9.920324e-001, 9.923084e-001, 9.925844e-001, 9.928604e-001, 9.931364e-001, 9.934120e-001, 9.936821e-001,
+9.939521e-001, 9.942222e-001, 9.944922e-001, 9.947623e-001, 9.950323e-001, 9.953024e-001, 9.955724e-001, 9.958366e-001, 9.960990e-001, 9.963615e-001,
+9.966239e-001, 9.968864e-001, 9.971489e-001, 9.974113e-001, 9.976738e-001, 9.979344e-001, 9.981926e-001, 9.984508e-001, 9.987090e-001, 9.989672e-001,
+9.992254e-001, 9.994836e-001, 9.997418e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.994159e-002, 3.465245e-002, 4.726317e-002, 5.857987e-002, 6.899968e-002, 7.875792e-002, 8.797532e-002, 9.676183e-002, 1.051590e-001,
+1.132052e-001, 1.209280e-001, 1.283498e-001, 1.354517e-001, 1.422474e-001, 1.487720e-001, 1.550467e-001, 1.611181e-001, 1.669937e-001, 1.726771e-001,
+1.782053e-001, 1.835689e-001, 1.887871e-001, 1.938628e-001, 1.988143e-001, 2.036329e-001, 2.083510e-001, 2.129526e-001, 2.174570e-001, 2.218813e-001,
+2.262318e-001, 2.304810e-001, 2.346275e-001, 2.386895e-001, 2.426761e-001, 2.466065e-001, 2.504898e-001, 2.543140e-001, 2.580660e-001, 2.617496e-001,
+2.653857e-001, 2.689718e-001, 2.725044e-001, 2.759803e-001, 2.793953e-001, 2.827471e-001, 2.860387e-001, 2.892819e-001, 2.924897e-001, 2.956647e-001,
+2.988076e-001, 3.019191e-001, 3.050012e-001, 3.080531e-001, 3.110767e-001, 3.140729e-001, 3.170423e-001, 3.199853e-001, 3.229024e-001, 3.257946e-001,
+3.286627e-001, 3.315044e-001, 3.343143e-001, 3.370939e-001, 3.398444e-001, 3.425665e-001, 3.452623e-001, 3.479284e-001, 3.505630e-001, 3.531687e-001,
+3.557462e-001, 3.582992e-001, 3.608301e-001, 3.633398e-001, 3.658295e-001, 3.682994e-001, 3.707448e-001, 3.731693e-001, 3.755751e-001, 3.779631e-001,
+3.803366e-001, 3.826907e-001, 3.850284e-001, 3.873494e-001, 3.896577e-001, 3.919535e-001, 3.942336e-001, 3.965000e-001, 3.987482e-001, 4.009808e-001,
+4.031978e-001, 4.054017e-001, 4.075945e-001, 4.097733e-001, 4.119321e-001, 4.140745e-001, 4.162018e-001, 4.183139e-001, 4.204132e-001, 4.225000e-001,
+4.245726e-001, 4.266325e-001, 4.286798e-001, 4.307179e-001, 4.327477e-001, 4.347654e-001, 4.367690e-001, 4.387587e-001, 4.407366e-001, 4.427039e-001,
+4.446618e-001, 4.466081e-001, 4.485443e-001, 4.504688e-001, 4.523818e-001, 4.542838e-001, 4.561767e-001, 4.580585e-001, 4.599294e-001, 4.617907e-001,
+4.636437e-001, 4.654872e-001, 4.673208e-001, 4.691432e-001, 4.709551e-001, 4.727577e-001, 4.745521e-001, 4.763393e-001, 4.781185e-001, 4.798890e-001,
+4.816486e-001, 4.833956e-001, 4.851314e-001, 4.868572e-001, 4.885736e-001, 4.902822e-001, 4.919806e-001, 4.936690e-001, 4.953498e-001, 4.970211e-001,
+4.986830e-001, 5.003349e-001, 5.019772e-001, 5.036126e-001, 5.052386e-001, 5.068595e-001, 5.084728e-001, 5.100776e-001, 5.116733e-001, 5.132597e-001,
+5.148343e-001, 5.164015e-001, 5.179617e-001, 5.195158e-001, 5.210650e-001, 5.226017e-001, 5.241310e-001, 5.256524e-001, 5.271655e-001, 5.286697e-001,
+5.301664e-001, 5.316577e-001, 5.331443e-001, 5.346261e-001, 5.360970e-001, 5.375598e-001, 5.390149e-001, 5.404617e-001, 5.419016e-001, 5.433355e-001,
+5.447630e-001, 5.461803e-001, 5.475915e-001, 5.489967e-001, 5.503936e-001, 5.517834e-001, 5.531684e-001, 5.545488e-001, 5.559221e-001, 5.572903e-001,
+5.586516e-001, 5.600049e-001, 5.613522e-001, 5.626906e-001, 5.640223e-001, 5.653495e-001, 5.666700e-001, 5.679866e-001, 5.692998e-001, 5.706049e-001,
+5.719022e-001, 5.731946e-001, 5.744787e-001, 5.757588e-001, 5.770345e-001, 5.783056e-001, 5.795727e-001, 5.808309e-001, 5.820825e-001, 5.833304e-001,
+5.845700e-001, 5.858065e-001, 5.870374e-001, 5.882629e-001, 5.894859e-001, 5.906990e-001, 5.919093e-001, 5.931132e-001, 5.943116e-001, 5.955064e-001,
+5.966913e-001, 5.978733e-001, 5.990452e-001, 6.002144e-001, 6.013794e-001, 6.025397e-001, 6.036971e-001, 6.048493e-001, 6.060000e-001, 6.071418e-001,
+6.082808e-001, 6.094110e-001, 6.105382e-001, 6.116612e-001, 6.127800e-001, 6.138955e-001, 6.150088e-001, 6.161212e-001, 6.172275e-001, 6.183327e-001,
+6.194270e-001, 6.205206e-001, 6.216076e-001, 6.226932e-001, 6.237693e-001, 6.248437e-001, 6.259111e-001, 6.269769e-001, 6.280378e-001, 6.290961e-001,
+6.301478e-001, 6.311973e-001, 6.322420e-001, 6.332837e-001, 6.343186e-001, 6.353514e-001, 6.363787e-001, 6.374047e-001, 6.384266e-001, 6.394465e-001,
+6.404585e-001, 6.414692e-001, 6.424723e-001, 6.434749e-001, 6.444697e-001, 6.454645e-001, 6.464500e-001, 6.474352e-001, 6.484122e-001, 6.493877e-001,
+6.503597e-001, 6.513301e-001, 6.522970e-001, 6.532609e-001, 6.542214e-001, 6.551764e-001, 6.561301e-001, 6.570778e-001, 6.580254e-001, 6.589659e-001,
+6.599062e-001, 6.608444e-001, 6.617819e-001, 6.627163e-001, 6.636476e-001, 6.645767e-001, 6.654986e-001, 6.664206e-001, 6.673379e-001, 6.682550e-001,
+6.691666e-001, 6.700755e-001, 6.709814e-001, 6.718817e-001, 6.727818e-001, 6.736768e-001, 6.745718e-001, 6.754603e-001, 6.763453e-001, 6.772282e-001,
+6.781056e-001, 6.789830e-001, 6.798559e-001, 6.807281e-001, 6.815952e-001, 6.824559e-001, 6.833165e-001, 6.841681e-001, 6.850197e-001, 6.858676e-001,
+6.867125e-001, 6.875569e-001, 6.883959e-001, 6.892348e-001, 6.900711e-001, 6.909055e-001, 6.917394e-001, 6.925656e-001, 6.933919e-001, 6.942143e-001,
+6.950333e-001, 6.958522e-001, 6.966655e-001, 6.974785e-001, 6.982900e-001, 6.990989e-001, 6.999078e-001, 7.007127e-001, 7.015164e-001, 7.023192e-001,
+7.031160e-001, 7.039129e-001, 7.047072e-001, 7.054990e-001, 7.062908e-001, 7.070775e-001, 7.078631e-001, 7.086477e-001, 7.094257e-001, 7.102036e-001,
+7.109790e-001, 7.117509e-001, 7.125229e-001, 7.132900e-001, 7.140549e-001, 7.148198e-001, 7.155793e-001, 7.163383e-001, 7.170966e-001, 7.178505e-001,
+7.186044e-001, 7.193557e-001, 7.201020e-001, 7.208483e-001, 7.215924e-001, 7.223345e-001, 7.230767e-001, 7.238160e-001, 7.245539e-001, 7.252917e-001,
+7.260233e-001, 7.267531e-001, 7.274829e-001, 7.282087e-001, 7.289339e-001, 7.296590e-001, 7.303797e-001, 7.311002e-001, 7.318206e-001, 7.325311e-001,
+7.332416e-001, 7.339518e-001, 7.346548e-001, 7.353578e-001, 7.360606e-001, 7.367588e-001, 7.374569e-001, 7.381549e-001, 7.388454e-001, 7.395359e-001,
+7.402264e-001, 7.409111e-001, 7.415956e-001, 7.422801e-001, 7.429602e-001, 7.436398e-001, 7.443195e-001, 7.449948e-001, 7.456692e-001, 7.463435e-001,
+7.470148e-001, 7.476846e-001, 7.483544e-001, 7.490217e-001, 7.496867e-001, 7.503517e-001, 7.510150e-001, 7.516748e-001, 7.523347e-001, 7.529938e-001,
+7.536480e-001, 7.543023e-001, 7.549565e-001, 7.556046e-001, 7.562520e-001, 7.568995e-001, 7.575437e-001, 7.581863e-001, 7.588289e-001, 7.594694e-001,
+7.601066e-001, 7.607437e-001, 7.613804e-001, 7.620110e-001, 7.626415e-001, 7.632720e-001, 7.638991e-001, 7.645249e-001, 7.651507e-001, 7.657745e-001,
+7.663951e-001, 7.670156e-001, 7.676362e-001, 7.682504e-001, 7.688644e-001, 7.694784e-001, 7.700900e-001, 7.706995e-001, 7.713090e-001, 7.719179e-001,
+7.725211e-001, 7.731243e-001, 7.737274e-001, 7.743269e-001, 7.749242e-001, 7.755215e-001, 7.761185e-001, 7.767132e-001, 7.773080e-001, 7.779027e-001,
+7.784941e-001, 7.790831e-001, 7.796722e-001, 7.802611e-001, 7.808436e-001, 7.814262e-001, 7.820088e-001, 7.825898e-001, 7.831685e-001, 7.837472e-001,
+7.843259e-001, 7.849006e-001, 7.854743e-001, 7.860481e-001, 7.866210e-001, 7.871890e-001, 7.877570e-001, 7.883250e-001, 7.888916e-001, 7.894564e-001,
+7.900212e-001, 7.905860e-001, 7.911476e-001, 7.917082e-001, 7.922688e-001, 7.928294e-001, 7.933838e-001, 7.939382e-001, 7.944926e-001, 7.950458e-001,
+7.955945e-001, 7.961433e-001, 7.966921e-001, 7.972388e-001, 7.977825e-001, 7.983262e-001, 7.988699e-001, 7.994106e-001, 7.999492e-001, 8.004878e-001,
+8.010263e-001, 8.015617e-001, 8.020956e-001, 8.026296e-001, 8.031635e-001, 8.036942e-001, 8.042241e-001, 8.047539e-001, 8.052838e-001, 8.058102e-001,
+8.063359e-001, 8.068617e-001, 8.073875e-001, 8.079090e-001, 8.084300e-001, 8.089510e-001, 8.094719e-001, 8.099885e-001, 8.105045e-001, 8.110204e-001,
+8.115364e-001, 8.120500e-001, 8.125631e-001, 8.130762e-001, 8.135893e-001, 8.140997e-001, 8.146092e-001, 8.151188e-001, 8.156284e-001, 8.161346e-001,
+8.166393e-001, 8.171440e-001, 8.176487e-001, 8.181504e-001, 8.186496e-001, 8.191488e-001, 8.196480e-001, 8.201459e-001, 8.206415e-001, 8.211371e-001,
+8.216327e-001, 8.221275e-001, 8.226182e-001, 8.231089e-001, 8.235996e-001, 8.240903e-001, 8.245752e-001, 8.250597e-001, 8.255442e-001, 8.260286e-001,
+8.265116e-001, 8.269937e-001, 8.274759e-001, 8.279580e-001, 8.284390e-001, 8.289175e-001, 8.293960e-001, 8.298745e-001, 8.303530e-001, 8.308256e-001,
+8.312981e-001, 8.317706e-001, 8.322431e-001, 8.327139e-001, 8.331836e-001, 8.336532e-001, 8.341229e-001, 8.345921e-001, 8.350595e-001, 8.355268e-001,
+8.359942e-001, 8.364615e-001, 8.369247e-001, 8.373864e-001, 8.378480e-001, 8.383096e-001, 8.387700e-001, 8.392266e-001, 8.396832e-001, 8.401398e-001,
+8.405964e-001, 8.410516e-001, 8.415062e-001, 8.419608e-001, 8.424154e-001, 8.428695e-001, 8.433198e-001, 8.437701e-001, 8.442203e-001, 8.446706e-001,
+8.451184e-001, 8.455640e-001, 8.460095e-001, 8.464551e-001, 8.469007e-001, 8.473442e-001, 8.477874e-001, 8.482306e-001, 8.486739e-001, 8.491165e-001,
+8.495569e-001, 8.499972e-001, 8.504376e-001, 8.508779e-001, 8.513162e-001, 8.517523e-001, 8.521883e-001, 8.526243e-001, 8.530603e-001, 8.534938e-001,
+8.539262e-001, 8.543587e-001, 8.547911e-001, 8.552236e-001, 8.556535e-001, 8.560831e-001, 8.565127e-001, 8.569423e-001, 8.573716e-001, 8.577967e-001,
+8.582219e-001, 8.586470e-001, 8.590722e-001, 8.594968e-001, 8.599188e-001, 8.603409e-001, 8.607629e-001, 8.611850e-001, 8.616067e-001, 8.620273e-001,
+8.624479e-001, 8.628685e-001, 8.632891e-001, 8.637089e-001, 8.641266e-001, 8.645443e-001, 8.649620e-001, 8.653797e-001, 8.657961e-001, 8.662096e-001,
+8.666230e-001, 8.670365e-001, 8.674499e-001, 8.678625e-001, 8.682723e-001, 8.686822e-001, 8.690921e-001, 8.695020e-001, 8.699114e-001, 8.703184e-001,
+8.707254e-001, 8.711323e-001, 8.715393e-001, 8.719462e-001, 8.723505e-001, 8.727548e-001, 8.731591e-001, 8.735634e-001, 8.739677e-001, 8.743694e-001,
+8.747707e-001, 8.751720e-001, 8.755733e-001, 8.759746e-001, 8.763734e-001, 8.767709e-001, 8.771684e-001, 8.775659e-001, 8.779633e-001, 8.783592e-001,
+8.787526e-001, 8.791460e-001, 8.795394e-001, 8.799328e-001, 8.803259e-001, 8.807155e-001, 8.811051e-001, 8.814948e-001, 8.818844e-001, 8.822740e-001,
+8.826613e-001, 8.830478e-001, 8.834342e-001, 8.838207e-001, 8.842072e-001, 8.845928e-001, 8.849767e-001, 8.853606e-001, 8.857445e-001, 8.861285e-001,
+8.865124e-001, 8.868943e-001, 8.872760e-001, 8.876577e-001, 8.880394e-001, 8.884211e-001, 8.888017e-001, 8.891808e-001, 8.895600e-001, 8.899391e-001,
+8.903183e-001, 8.906974e-001, 8.910734e-001, 8.914492e-001, 8.918249e-001, 8.922006e-001, 8.925763e-001, 8.929508e-001, 8.933229e-001, 8.936950e-001,
+8.940670e-001, 8.944391e-001, 8.948112e-001, 8.951819e-001, 8.955522e-001, 8.959224e-001, 8.962927e-001, 8.966629e-001, 8.970330e-001, 8.974005e-001,
+8.977681e-001, 8.981356e-001, 8.985031e-001, 8.988707e-001, 8.992366e-001, 8.995998e-001, 8.999629e-001, 9.003261e-001, 9.006892e-001, 9.010523e-001,
+9.014137e-001, 9.017738e-001, 9.021339e-001, 9.024941e-001, 9.028542e-001, 9.032143e-001, 9.035730e-001, 9.039313e-001, 9.042896e-001, 9.046479e-001,
+9.050062e-001, 9.053645e-001, 9.057203e-001, 9.060759e-001, 9.064316e-001, 9.067872e-001, 9.071428e-001, 9.074983e-001, 9.078510e-001, 9.082037e-001,
+9.085563e-001, 9.089090e-001, 9.092617e-001, 9.096143e-001, 9.099658e-001, 9.103173e-001, 9.106688e-001, 9.110203e-001, 9.113719e-001, 9.117232e-001,
+9.120728e-001, 9.124223e-001, 9.127718e-001, 9.131214e-001, 9.134709e-001, 9.138203e-001, 9.141662e-001, 9.145121e-001, 9.148580e-001, 9.152039e-001,
+9.155497e-001, 9.158956e-001, 9.162393e-001, 9.165828e-001, 9.169263e-001, 9.172698e-001, 9.176133e-001, 9.179568e-001, 9.182994e-001, 9.186418e-001,
+9.189841e-001, 9.193265e-001, 9.196688e-001, 9.200112e-001, 9.203519e-001, 9.206914e-001, 9.210309e-001, 9.213704e-001, 9.217099e-001, 9.220494e-001,
+9.223874e-001, 9.227225e-001, 9.230575e-001, 9.233926e-001, 9.237276e-001, 9.240627e-001, 9.243977e-001, 9.247310e-001, 9.250643e-001, 9.253976e-001,
+9.257309e-001, 9.260642e-001, 9.263975e-001, 9.267301e-001, 9.270623e-001, 9.273945e-001, 9.277268e-001, 9.280590e-001, 9.283912e-001, 9.287227e-001,
+9.290522e-001, 9.293817e-001, 9.297111e-001, 9.300406e-001, 9.303700e-001, 9.306995e-001, 9.310278e-001, 9.313557e-001, 9.316836e-001, 9.320115e-001,
+9.323393e-001, 9.326672e-001, 9.329951e-001, 9.333226e-001, 9.336501e-001, 9.339777e-001, 9.343052e-001, 9.346328e-001, 9.349603e-001, 9.352865e-001,
+9.356121e-001, 9.359377e-001, 9.362632e-001, 9.365888e-001, 9.369144e-001, 9.372398e-001, 9.375618e-001, 9.378839e-001, 9.382059e-001, 9.385280e-001,
+9.388500e-001, 9.391721e-001, 9.394932e-001, 9.398130e-001, 9.401327e-001, 9.404524e-001, 9.407721e-001, 9.410919e-001, 9.414116e-001, 9.417305e-001,
+9.420491e-001, 9.423676e-001, 9.426862e-001, 9.430047e-001, 9.433232e-001, 9.436418e-001, 9.439580e-001, 9.442737e-001, 9.445895e-001, 9.449053e-001,
+9.452211e-001, 9.455368e-001, 9.458526e-001, 9.461655e-001, 9.464783e-001, 9.467912e-001, 9.471040e-001, 9.474169e-001, 9.477298e-001, 9.480425e-001,
+9.483545e-001, 9.486665e-001, 9.489785e-001, 9.492905e-001, 9.496025e-001, 9.499145e-001, 9.502264e-001, 9.505374e-001, 9.508484e-001, 9.511593e-001,
+9.514703e-001, 9.517813e-001, 9.520922e-001, 9.524029e-001, 9.527113e-001, 9.530197e-001, 9.533281e-001, 9.536365e-001, 9.539449e-001, 9.542534e-001,
+9.545617e-001, 9.548670e-001, 9.551724e-001, 9.554778e-001, 9.557832e-001, 9.560886e-001, 9.563940e-001, 9.566993e-001, 9.570021e-001, 9.573045e-001,
+9.576069e-001, 9.579093e-001, 9.582117e-001, 9.585141e-001, 9.588165e-001, 9.591178e-001, 9.594185e-001, 9.597193e-001, 9.600200e-001, 9.603208e-001,
+9.606215e-001, 9.609223e-001, 9.612217e-001, 9.615196e-001, 9.618174e-001, 9.621153e-001, 9.624131e-001, 9.627110e-001, 9.630088e-001, 9.633063e-001,
+9.636015e-001, 9.638966e-001, 9.641917e-001, 9.644868e-001, 9.647820e-001, 9.650771e-001, 9.653722e-001, 9.656659e-001, 9.659591e-001, 9.662524e-001,
+9.665456e-001, 9.668388e-001, 9.671320e-001, 9.674252e-001, 9.677178e-001, 9.680087e-001, 9.682997e-001, 9.685907e-001, 9.688816e-001, 9.691726e-001,
+9.694635e-001, 9.697545e-001, 9.700438e-001, 9.703326e-001, 9.706214e-001, 9.709103e-001, 9.711991e-001, 9.714880e-001, 9.717768e-001, 9.720652e-001,
+9.723524e-001, 9.726396e-001, 9.729268e-001, 9.732140e-001, 9.735012e-001, 9.737884e-001, 9.740756e-001, 9.743615e-001, 9.746464e-001, 9.749314e-001,
+9.752163e-001, 9.755013e-001, 9.757863e-001, 9.760712e-001, 9.763562e-001, 9.766385e-001, 9.769206e-001, 9.772026e-001, 9.774847e-001, 9.777667e-001,
+9.780488e-001, 9.783308e-001, 9.786124e-001, 9.788917e-001, 9.791711e-001, 9.794504e-001, 9.797297e-001, 9.800090e-001, 9.802883e-001, 9.805676e-001,
+9.808459e-001, 9.811222e-001, 9.813986e-001, 9.816750e-001, 9.819513e-001, 9.822277e-001, 9.825041e-001, 9.827804e-001, 9.830551e-001, 9.833278e-001,
+9.836006e-001, 9.838733e-001, 9.841461e-001, 9.844188e-001, 9.846916e-001, 9.849643e-001, 9.852354e-001, 9.855050e-001, 9.857745e-001, 9.860441e-001,
+9.863136e-001, 9.865832e-001, 9.868527e-001, 9.871223e-001, 9.873906e-001, 9.876576e-001, 9.879246e-001, 9.881917e-001, 9.884587e-001, 9.887257e-001,
+9.889927e-001, 9.892598e-001, 9.895254e-001, 9.897892e-001, 9.900530e-001, 9.903168e-001, 9.905806e-001, 9.908443e-001, 9.911081e-001, 9.913719e-001,
+9.916349e-001, 9.918960e-001, 9.921571e-001, 9.924181e-001, 9.926792e-001, 9.929403e-001, 9.932013e-001, 9.934624e-001, 9.937233e-001, 9.939818e-001,
+9.942402e-001, 9.944987e-001, 9.947572e-001, 9.950156e-001, 9.952741e-001, 9.955326e-001, 9.957910e-001, 9.960444e-001, 9.962963e-001, 9.965483e-001,
+9.968002e-001, 9.970521e-001, 9.973040e-001, 9.975559e-001, 9.978078e-001, 9.980560e-001, 9.982990e-001, 9.985420e-001, 9.987850e-001, 9.990280e-001,
+9.992710e-001, 9.995140e-001, 9.997570e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.388411e-002, 2.557662e-002, 3.576973e-002, 4.504138e-002, 5.365070e-002, 6.172585e-002, 6.934771e-002, 7.662330e-002, 8.359883e-002,
+9.024850e-002, 9.662493e-002, 1.027312e-001, 1.085847e-001, 1.142328e-001, 1.196969e-001, 1.249830e-001, 1.301162e-001, 1.350999e-001, 1.399576e-001,
+1.447027e-001, 1.493282e-001, 1.538430e-001, 1.582643e-001, 1.625948e-001, 1.668374e-001, 1.709936e-001, 1.750803e-001, 1.790976e-001, 1.830429e-001,
+1.869215e-001, 1.907352e-001, 1.944852e-001, 1.981808e-001, 2.018260e-001, 2.054218e-001, 2.089663e-001, 2.124686e-001, 2.159261e-001, 2.193453e-001,
+2.227172e-001, 2.260479e-001, 2.293381e-001, 2.325895e-001, 2.358045e-001, 2.389749e-001, 2.421179e-001, 2.452265e-001, 2.482995e-001, 2.513419e-001,
+2.543503e-001, 2.573288e-001, 2.602812e-001, 2.632032e-001, 2.660993e-001, 2.689617e-001, 2.717953e-001, 2.746086e-001, 2.773949e-001, 2.801467e-001,
+2.828756e-001, 2.855885e-001, 2.882773e-001, 2.909384e-001, 2.935771e-001, 2.961899e-001, 2.987827e-001, 3.013578e-001, 3.039125e-001, 3.064479e-001,
+3.089592e-001, 3.114419e-001, 3.139019e-001, 3.163512e-001, 3.187870e-001, 3.212068e-001, 3.236056e-001, 3.259813e-001, 3.283393e-001, 3.306787e-001,
+3.330000e-001, 3.352981e-001, 3.375810e-001, 3.398480e-001, 3.421056e-001, 3.443532e-001, 3.465891e-001, 3.488120e-001, 3.510179e-001, 3.532077e-001,
+3.553779e-001, 3.575283e-001, 3.596654e-001, 3.617888e-001, 3.638971e-001, 3.659908e-001, 3.680689e-001, 3.701283e-001, 3.721699e-001, 3.741934e-001,
+3.761980e-001, 3.781863e-001, 3.801618e-001, 3.821251e-001, 3.840760e-001, 3.860142e-001, 3.879393e-001, 3.898505e-001, 3.917473e-001, 3.936303e-001,
+3.954991e-001, 3.973536e-001, 3.991936e-001, 4.010189e-001, 4.028322e-001, 4.046369e-001, 4.064338e-001, 4.082230e-001, 4.100045e-001, 4.117786e-001,
+4.135452e-001, 4.153045e-001, 4.170565e-001, 4.188014e-001, 4.205392e-001, 4.222700e-001, 4.239939e-001, 4.257110e-001, 4.274214e-001, 4.291251e-001,
+4.308224e-001, 4.325131e-001, 4.341975e-001, 4.358756e-001, 4.375470e-001, 4.392102e-001, 4.408646e-001, 4.425104e-001, 4.441475e-001, 4.457771e-001,
+4.473989e-001, 4.490133e-001, 4.506206e-001, 4.522204e-001, 4.538132e-001, 4.553957e-001, 4.569694e-001, 4.585345e-001, 4.600914e-001, 4.616405e-001,
+4.631803e-001, 4.647123e-001, 4.662374e-001, 4.677560e-001, 4.692681e-001, 4.707723e-001, 4.722703e-001, 4.737617e-001, 4.752462e-001, 4.767219e-001,
+4.781899e-001, 4.796513e-001, 4.811065e-001, 4.825553e-001, 4.839964e-001, 4.854325e-001, 4.868635e-001, 4.882859e-001, 4.897008e-001, 4.911101e-001,
+4.925137e-001, 4.939091e-001, 4.952998e-001, 4.966861e-001, 4.980661e-001, 4.994400e-001, 5.008089e-001, 5.021710e-001, 5.035273e-001, 5.048795e-001,
+5.062263e-001, 5.075680e-001, 5.089065e-001, 5.102407e-001, 5.115708e-001, 5.128980e-001, 5.142201e-001, 5.155371e-001, 5.168507e-001, 5.181574e-001,
+5.194594e-001, 5.207583e-001, 5.220487e-001, 5.233348e-001, 5.246167e-001, 5.258915e-001, 5.271635e-001, 5.284306e-001, 5.296934e-001, 5.309540e-001,
+5.322073e-001, 5.334577e-001, 5.347032e-001, 5.359425e-001, 5.371791e-001, 5.384079e-001, 5.396337e-001, 5.408535e-001, 5.420675e-001, 5.432780e-001,
+5.444820e-001, 5.456840e-001, 5.468796e-001, 5.480729e-001, 5.492629e-001, 5.504479e-001, 5.516302e-001, 5.528065e-001, 5.539814e-001, 5.551494e-001,
+5.563148e-001, 5.574723e-001, 5.586268e-001, 5.597772e-001, 5.609225e-001, 5.620643e-001, 5.632021e-001, 5.643385e-001, 5.654676e-001, 5.665956e-001,
+5.677174e-001, 5.688384e-001, 5.699522e-001, 5.710645e-001, 5.721685e-001, 5.732709e-001, 5.743673e-001, 5.754617e-001, 5.765504e-001, 5.776374e-001,
+5.787205e-001, 5.798012e-001, 5.808769e-001, 5.819506e-001, 5.830200e-001, 5.840865e-001, 5.851466e-001, 5.862044e-001, 5.872562e-001, 5.883064e-001,
+5.893510e-001, 5.903947e-001, 5.914333e-001, 5.924714e-001, 5.935050e-001, 5.945385e-001, 5.955651e-001, 5.965916e-001, 5.976113e-001, 5.986299e-001,
+5.996432e-001, 6.006545e-001, 6.016617e-001, 6.026659e-001, 6.036680e-001, 6.046672e-001, 6.056650e-001, 6.066577e-001, 6.076505e-001, 6.086355e-001,
+6.096205e-001, 6.106000e-001, 6.115780e-001, 6.125519e-001, 6.135221e-001, 6.144911e-001, 6.154568e-001, 6.164225e-001, 6.173814e-001, 6.183401e-001,
+6.192940e-001, 6.202455e-001, 6.211943e-001, 6.221385e-001, 6.230824e-001, 6.240196e-001, 6.249567e-001, 6.258906e-001, 6.268229e-001, 6.277528e-001,
+6.286767e-001, 6.296005e-001, 6.305189e-001, 6.314365e-001, 6.323507e-001, 6.332612e-001, 6.341714e-001, 6.350760e-001, 6.359806e-001, 6.368827e-001,
+6.377828e-001, 6.386821e-001, 6.395737e-001, 6.404653e-001, 6.413521e-001, 6.422357e-001, 6.431187e-001, 6.439943e-001, 6.448698e-001, 6.457418e-001,
+6.466107e-001, 6.474797e-001, 6.483433e-001, 6.492069e-001, 6.500678e-001, 6.509246e-001, 6.517814e-001, 6.526326e-001, 6.534823e-001, 6.543310e-001,
+6.551744e-001, 6.560177e-001, 6.568581e-001, 6.576957e-001, 6.585333e-001, 6.593660e-001, 6.601978e-001, 6.610285e-001, 6.618532e-001, 6.626778e-001,
+6.634992e-001, 6.643164e-001, 6.651336e-001, 6.659478e-001, 6.667607e-001, 6.675737e-001, 6.683798e-001, 6.691856e-001, 6.699900e-001, 6.707877e-001,
+6.715854e-001, 6.723811e-001, 6.731733e-001, 6.739654e-001, 6.747538e-001, 6.755388e-001, 6.763238e-001, 6.771062e-001, 6.778873e-001, 6.786684e-001,
+6.794441e-001, 6.802183e-001, 6.809926e-001, 6.817621e-001, 6.825310e-001, 6.832999e-001, 6.840653e-001, 6.848305e-001, 6.855955e-001, 6.863517e-001,
+6.871078e-001, 6.878636e-001, 6.886121e-001, 6.893607e-001, 6.901090e-001, 6.908517e-001, 6.915943e-001, 6.923368e-001, 6.930751e-001, 6.938134e-001,
+6.945516e-001, 6.952871e-001, 6.960226e-001, 6.967580e-001, 6.974879e-001, 6.982172e-001, 6.989466e-001, 6.996716e-001, 7.003956e-001, 7.011196e-001,
+7.018402e-001, 7.025593e-001, 7.032784e-001, 7.039943e-001, 7.047075e-001, 7.054206e-001, 7.061316e-001, 7.068389e-001, 7.075461e-001, 7.082526e-001,
+7.089550e-001, 7.096575e-001, 7.103600e-001, 7.110564e-001, 7.117525e-001, 7.124485e-001, 7.131393e-001, 7.138278e-001, 7.145162e-001, 7.152029e-001,
+7.158870e-001, 7.165712e-001, 7.172548e-001, 7.179336e-001, 7.186123e-001, 7.192910e-001, 7.199659e-001, 7.206395e-001, 7.213132e-001, 7.219850e-001,
+7.226539e-001, 7.233228e-001, 7.239917e-001, 7.246548e-001, 7.253179e-001, 7.259809e-001, 7.266424e-001, 7.273028e-001, 7.279632e-001, 7.286230e-001,
+7.292784e-001, 7.299338e-001, 7.305892e-001, 7.312399e-001, 7.318880e-001, 7.325361e-001, 7.331836e-001, 7.338276e-001, 7.344716e-001, 7.351156e-001,
+7.357557e-001, 7.363932e-001, 7.370308e-001, 7.376681e-001, 7.383010e-001, 7.389338e-001, 7.395666e-001, 7.401981e-001, 7.408280e-001, 7.414578e-001,
+7.420876e-001, 7.427113e-001, 7.433336e-001, 7.439559e-001, 7.445773e-001, 7.451938e-001, 7.458103e-001, 7.464267e-001, 7.470413e-001, 7.476536e-001,
+7.482660e-001, 7.488783e-001, 7.494871e-001, 7.500948e-001, 7.507024e-001, 7.513100e-001, 7.519133e-001, 7.525165e-001, 7.531198e-001, 7.537219e-001,
+7.543202e-001, 7.549185e-001, 7.555169e-001, 7.561128e-001, 7.567057e-001, 7.572985e-001, 7.578914e-001, 7.584812e-001, 7.590688e-001, 7.596565e-001,
+7.602442e-001, 7.608278e-001, 7.614097e-001, 7.619917e-001, 7.625736e-001, 7.631514e-001, 7.637282e-001, 7.643050e-001, 7.648818e-001, 7.654550e-001,
+7.660276e-001, 7.666002e-001, 7.671728e-001, 7.677428e-001, 7.683125e-001, 7.688822e-001, 7.694519e-001, 7.700184e-001, 7.705844e-001, 7.711504e-001,
+7.717165e-001, 7.722783e-001, 7.728395e-001, 7.734007e-001, 7.739619e-001, 7.745203e-001, 7.750779e-001, 7.756355e-001, 7.761932e-001, 7.767478e-001,
+7.773011e-001, 7.778544e-001, 7.784077e-001, 7.789580e-001, 7.795059e-001, 7.800537e-001, 7.806016e-001, 7.811479e-001, 7.816915e-001, 7.822352e-001,
+7.827789e-001, 7.833217e-001, 7.838604e-001, 7.843991e-001, 7.849379e-001, 7.854766e-001, 7.860131e-001, 7.865494e-001, 7.870856e-001, 7.876219e-001,
+7.881566e-001, 7.886903e-001, 7.892241e-001, 7.897579e-001, 7.902898e-001, 7.908183e-001, 7.913469e-001, 7.918754e-001, 7.924039e-001, 7.929296e-001,
+7.934553e-001, 7.939809e-001, 7.945066e-001, 7.950306e-001, 7.955534e-001, 7.960762e-001, 7.965990e-001, 7.971210e-001, 7.976392e-001, 7.981575e-001,
+7.986757e-001, 7.991940e-001, 7.997112e-001, 8.002279e-001, 8.007447e-001, 8.012614e-001, 8.017773e-001, 8.022908e-001, 8.028042e-001, 8.033176e-001,
+8.038310e-001, 8.043409e-001, 8.048493e-001, 8.053577e-001, 8.058661e-001, 8.063743e-001, 8.068807e-001, 8.073871e-001, 8.078935e-001, 8.083999e-001,
+8.089043e-001, 8.094069e-001, 8.099095e-001, 8.104121e-001, 8.109147e-001, 8.114140e-001, 8.119128e-001, 8.124117e-001, 8.129106e-001, 8.134091e-001,
+8.139066e-001, 8.144040e-001, 8.149015e-001, 8.153989e-001, 8.158944e-001, 8.163877e-001, 8.168810e-001, 8.173743e-001, 8.178676e-001, 8.183591e-001,
+8.188499e-001, 8.193408e-001, 8.198316e-001, 8.203225e-001, 8.208127e-001, 8.213028e-001, 8.217929e-001, 8.222831e-001, 8.227729e-001, 8.232587e-001,
+8.237445e-001, 8.242303e-001, 8.247161e-001, 8.252014e-001, 8.256845e-001, 8.261677e-001, 8.266509e-001, 8.271341e-001, 8.276170e-001, 8.280992e-001,
+8.285814e-001, 8.290637e-001, 8.295459e-001, 8.300267e-001, 8.305045e-001, 8.309822e-001, 8.314599e-001, 8.319377e-001, 8.324145e-001, 8.328895e-001,
+8.333644e-001, 8.338394e-001, 8.343143e-001, 8.347889e-001, 8.352627e-001, 8.357365e-001, 8.362103e-001, 8.366840e-001, 8.371570e-001, 8.376261e-001,
+8.380952e-001, 8.385643e-001, 8.390334e-001, 8.395024e-001, 8.399685e-001, 8.404347e-001, 8.409008e-001, 8.413670e-001, 8.418331e-001, 8.422980e-001,
+8.427627e-001, 8.432275e-001, 8.436922e-001, 8.441569e-001, 8.446185e-001, 8.450784e-001, 8.455383e-001, 8.459982e-001, 8.464581e-001, 8.469167e-001,
+8.473734e-001, 8.478302e-001, 8.482869e-001, 8.487436e-001, 8.492001e-001, 8.496552e-001, 8.501103e-001, 8.505654e-001, 8.510204e-001, 8.514755e-001,
+8.519274e-001, 8.523783e-001, 8.528292e-001, 8.532801e-001, 8.537310e-001, 8.541812e-001, 8.546300e-001, 8.550789e-001, 8.555277e-001, 8.559766e-001,
+8.564254e-001, 8.568724e-001, 8.573193e-001, 8.577662e-001, 8.582130e-001, 8.586599e-001, 8.591055e-001, 8.595495e-001, 8.599935e-001, 8.604375e-001,
+8.608815e-001, 8.613255e-001, 8.617683e-001, 8.622109e-001, 8.626536e-001, 8.630963e-001, 8.635390e-001, 8.639809e-001, 8.644214e-001, 8.648619e-001,
+8.653024e-001, 8.657429e-001, 8.661834e-001, 8.666223e-001, 8.670606e-001, 8.674989e-001, 8.679373e-001, 8.683756e-001, 8.688139e-001, 8.692521e-001,
+8.696903e-001, 8.701285e-001, 8.705667e-001, 8.710049e-001, 8.714422e-001, 8.718780e-001, 8.723137e-001, 8.727494e-001, 8.731852e-001, 8.736209e-001,
+8.740552e-001, 8.744884e-001, 8.749217e-001, 8.753550e-001, 8.757883e-001, 8.762216e-001, 8.766545e-001, 8.770873e-001, 8.775202e-001, 8.779530e-001,
+8.783858e-001, 8.788186e-001, 8.792489e-001, 8.796789e-001, 8.801090e-001, 8.805390e-001, 8.809691e-001, 8.813990e-001, 8.818263e-001, 8.822537e-001,
+8.826810e-001, 8.831083e-001, 8.835356e-001, 8.839628e-001, 8.843894e-001, 8.848159e-001, 8.852424e-001, 8.856689e-001, 8.860954e-001, 8.865217e-001,
+8.869451e-001, 8.873686e-001, 8.877920e-001, 8.882155e-001, 8.886390e-001, 8.890623e-001, 8.894827e-001, 8.899031e-001, 8.903235e-001, 8.907439e-001,
+8.911643e-001, 8.915847e-001, 8.920041e-001, 8.924234e-001, 8.928427e-001, 8.932620e-001, 8.936812e-001, 8.941005e-001, 8.945178e-001, 8.949345e-001,
+8.953512e-001, 8.957680e-001, 8.961847e-001, 8.966014e-001, 8.970177e-001, 8.974337e-001, 8.978498e-001, 8.982658e-001, 8.986819e-001, 8.990979e-001,
+8.995137e-001, 8.999291e-001, 9.003445e-001, 9.007599e-001, 9.011753e-001, 9.015907e-001, 9.020061e-001, 9.024195e-001, 9.028329e-001, 9.032463e-001,
+9.036596e-001, 9.040730e-001, 9.044864e-001, 9.049000e-001, 9.053137e-001, 9.057274e-001, 9.061412e-001, 9.065549e-001, 9.069686e-001, 9.073821e-001,
+9.077947e-001, 9.082073e-001, 9.086200e-001, 9.090326e-001, 9.094453e-001, 9.098579e-001, 9.102687e-001, 9.106789e-001, 9.110891e-001, 9.114993e-001,
+9.119095e-001, 9.123197e-001, 9.127299e-001, 9.131400e-001, 9.135501e-001, 9.139602e-001, 9.143703e-001, 9.147804e-001, 9.151905e-001, 9.155996e-001,
+9.160082e-001, 9.164168e-001, 9.168255e-001, 9.172341e-001, 9.176427e-001, 9.180511e-001, 9.184570e-001, 9.188628e-001, 9.192686e-001, 9.196744e-001,
+9.200802e-001, 9.204860e-001, 9.208916e-001, 9.212969e-001, 9.217022e-001, 9.221074e-001, 9.225127e-001, 9.229180e-001, 9.233233e-001, 9.237279e-001,
+9.241321e-001, 9.245362e-001, 9.249404e-001, 9.253446e-001, 9.257488e-001, 9.261529e-001, 9.265554e-001, 9.269576e-001, 9.273598e-001, 9.277620e-001,
+9.281642e-001, 9.285664e-001, 9.289686e-001, 9.293698e-001, 9.297710e-001, 9.301721e-001, 9.305733e-001, 9.309745e-001, 9.313757e-001, 9.317768e-001,
+9.321772e-001, 9.325776e-001, 9.329779e-001, 9.333783e-001, 9.337787e-001, 9.341790e-001, 9.345792e-001, 9.349784e-001, 9.353775e-001, 9.357767e-001,
+9.361758e-001, 9.365750e-001, 9.369741e-001, 9.373731e-001, 9.377706e-001, 9.381682e-001, 9.385657e-001, 9.389633e-001, 9.393608e-001, 9.397584e-001,
+9.401558e-001, 9.405504e-001, 9.409449e-001, 9.413395e-001, 9.417340e-001, 9.421286e-001, 9.425231e-001, 9.429177e-001, 9.433082e-001, 9.436983e-001,
+9.440884e-001, 9.444785e-001, 9.448686e-001, 9.452587e-001, 9.456488e-001, 9.460378e-001, 9.464262e-001, 9.468146e-001, 9.472031e-001, 9.475915e-001,
+9.479799e-001, 9.483684e-001, 9.487561e-001, 9.491428e-001, 9.495296e-001, 9.499164e-001, 9.503031e-001, 9.506899e-001, 9.510767e-001, 9.514631e-001,
+9.518468e-001, 9.522306e-001, 9.526143e-001, 9.529980e-001, 9.533818e-001, 9.537655e-001, 9.541492e-001, 9.545315e-001, 9.549132e-001, 9.552949e-001,
+9.556766e-001, 9.560583e-001, 9.564400e-001, 9.568218e-001, 9.572029e-001, 9.575826e-001, 9.579623e-001, 9.583420e-001, 9.587218e-001, 9.591015e-001,
+9.594812e-001, 9.598609e-001, 9.602389e-001, 9.606165e-001, 9.609941e-001, 9.613717e-001, 9.617493e-001, 9.621269e-001, 9.625045e-001, 9.628816e-001,
+9.632574e-001, 9.636332e-001, 9.640089e-001, 9.643847e-001, 9.647604e-001, 9.651362e-001, 9.655119e-001, 9.658863e-001, 9.662597e-001, 9.666332e-001,
+9.670066e-001, 9.673801e-001, 9.677535e-001, 9.681270e-001, 9.685004e-001, 9.688717e-001, 9.692429e-001, 9.696140e-001, 9.699852e-001, 9.703563e-001,
+9.707275e-001, 9.710986e-001, 9.714694e-001, 9.718384e-001, 9.722074e-001, 9.725764e-001, 9.729454e-001, 9.733144e-001, 9.736833e-001, 9.740523e-001,
+9.744206e-001, 9.747873e-001, 9.751541e-001, 9.755209e-001, 9.758877e-001, 9.762545e-001, 9.766213e-001, 9.769881e-001, 9.773538e-001, 9.777181e-001,
+9.780825e-001, 9.784469e-001, 9.788112e-001, 9.791756e-001, 9.795400e-001, 9.799043e-001, 9.802669e-001, 9.806277e-001, 9.809886e-001, 9.813495e-001,
+9.817103e-001, 9.820712e-001, 9.824320e-001, 9.827929e-001, 9.831523e-001, 9.835103e-001, 9.838682e-001, 9.842262e-001, 9.845842e-001, 9.849421e-001,
+9.853001e-001, 9.856580e-001, 9.860142e-001, 9.863679e-001, 9.867216e-001, 9.870752e-001, 9.874289e-001, 9.877826e-001, 9.881363e-001, 9.884899e-001,
+9.888419e-001, 9.891892e-001, 9.895365e-001, 9.898839e-001, 9.902312e-001, 9.905785e-001, 9.909258e-001, 9.912732e-001, 9.916203e-001, 9.919636e-001,
+9.923069e-001, 9.926503e-001, 9.929936e-001, 9.933370e-001, 9.936803e-001, 9.940236e-001, 9.943670e-001, 9.947049e-001, 9.950412e-001, 9.953776e-001,
+9.957139e-001, 9.960502e-001, 9.963866e-001, 9.967229e-001, 9.970592e-001, 9.973912e-001, 9.977173e-001, 9.980434e-001, 9.983695e-001, 9.986956e-001,
+9.990217e-001, 9.993478e-001, 9.996739e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Futura 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.907593e-002, 3.354918e-002, 4.562849e-002, 5.643056e-002, 6.640905e-002, 7.578380e-002, 8.473318e-002, 9.336081e-002, 1.017176e-001,
+1.099016e-001, 1.179270e-001, 1.257235e-001, 1.332069e-001, 1.403386e-001, 1.471385e-001, 1.536355e-001, 1.598660e-001, 1.658526e-001, 1.715987e-001,
+1.771457e-001, 1.825121e-001, 1.877037e-001, 1.927497e-001, 1.976590e-001, 2.024217e-001, 2.070800e-001, 2.116314e-001, 2.160694e-001, 2.203908e-001,
+2.246263e-001, 2.287762e-001, 2.328652e-001, 2.368913e-001, 2.408396e-001, 2.446998e-001, 2.484991e-001, 2.522394e-001, 2.559157e-001, 2.595243e-001,
+2.630607e-001, 2.665265e-001, 2.699350e-001, 2.732954e-001, 2.766173e-001, 2.799010e-001, 2.831491e-001, 2.863624e-001, 2.895405e-001, 2.926771e-001,
+2.957694e-001, 2.988216e-001, 3.018361e-001, 3.048140e-001, 3.077591e-001, 3.106677e-001, 3.135369e-001, 3.163697e-001, 3.191707e-001, 3.219430e-001,
+3.246893e-001, 3.274120e-001, 3.301134e-001, 3.327958e-001, 3.354613e-001, 3.381123e-001, 3.407450e-001, 3.433604e-001, 3.459552e-001, 3.485282e-001,
+3.510804e-001, 3.536134e-001, 3.561300e-001, 3.586291e-001, 3.611053e-001, 3.635633e-001, 3.660041e-001, 3.684246e-001, 3.708260e-001, 3.732076e-001,
+3.755734e-001, 3.779214e-001, 3.802561e-001, 3.825756e-001, 3.848834e-001, 3.871787e-001, 3.894637e-001, 3.917393e-001, 3.940058e-001, 3.962654e-001,
+3.985183e-001, 4.007658e-001, 4.030055e-001, 4.052354e-001, 4.074553e-001, 4.096669e-001, 4.118707e-001, 4.140651e-001, 4.162524e-001, 4.184326e-001,
+4.206057e-001, 4.227721e-001, 4.249304e-001, 4.270784e-001, 4.292162e-001, 4.313440e-001, 4.334618e-001, 4.355662e-001, 4.376563e-001, 4.397337e-001,
+4.417981e-001, 4.438503e-001, 4.458903e-001, 4.479185e-001, 4.499353e-001, 4.519383e-001, 4.539266e-001, 4.559009e-001, 4.578617e-001, 4.598096e-001,
+4.617453e-001, 4.636694e-001, 4.655824e-001, 4.674822e-001, 4.693683e-001, 4.712423e-001, 4.731037e-001, 4.749541e-001, 4.767911e-001, 4.786146e-001,
+4.804255e-001, 4.822245e-001, 4.840112e-001, 4.857848e-001, 4.875458e-001, 4.892955e-001, 4.910339e-001, 4.927618e-001, 4.944768e-001, 4.961804e-001,
+4.978720e-001, 4.995515e-001, 5.012196e-001, 5.028778e-001, 5.045251e-001, 5.061632e-001, 5.077913e-001, 5.094099e-001, 5.110193e-001, 5.126188e-001,
+5.142037e-001, 5.157784e-001, 5.173432e-001, 5.188995e-001, 5.204483e-001, 5.219827e-001, 5.235060e-001, 5.250202e-001, 5.265260e-001, 5.280232e-001,
+5.295123e-001, 5.309924e-001, 5.324634e-001, 5.339248e-001, 5.353744e-001, 5.368158e-001, 5.382497e-001, 5.396753e-001, 5.410915e-001, 5.425013e-001,
+5.439049e-001, 5.452982e-001, 5.466838e-001, 5.480626e-001, 5.494338e-001, 5.507963e-001, 5.521531e-001, 5.535034e-001, 5.548454e-001, 5.561815e-001,
+5.575097e-001, 5.588302e-001, 5.601449e-001, 5.614514e-001, 5.627482e-001, 5.640394e-001, 5.653226e-001, 5.665982e-001, 5.678697e-001, 5.691354e-001,
+5.703940e-001, 5.716483e-001, 5.728936e-001, 5.741340e-001, 5.753699e-001, 5.765981e-001, 5.778230e-001, 5.790421e-001, 5.802538e-001, 5.814616e-001,
+5.826593e-001, 5.838544e-001, 5.850455e-001, 5.862290e-001, 5.874090e-001, 5.885780e-001, 5.897440e-001, 5.909047e-001, 5.920588e-001, 5.932094e-001,
+5.943544e-001, 5.954970e-001, 5.966315e-001, 5.977626e-001, 5.988892e-001, 6.000123e-001, 6.011335e-001, 6.022430e-001, 6.033499e-001, 6.044468e-001,
+6.055412e-001, 6.066294e-001, 6.077128e-001, 6.087905e-001, 6.098622e-001, 6.109300e-001, 6.119914e-001, 6.130507e-001, 6.141038e-001, 6.151559e-001,
+6.162015e-001, 6.172462e-001, 6.182832e-001, 6.193188e-001, 6.203480e-001, 6.213756e-001, 6.223982e-001, 6.234181e-001, 6.244315e-001, 6.254416e-001,
+6.264447e-001, 6.274457e-001, 6.284427e-001, 6.294365e-001, 6.304243e-001, 6.314088e-001, 6.323868e-001, 6.333630e-001, 6.343346e-001, 6.353040e-001,
+6.362663e-001, 6.372276e-001, 6.381839e-001, 6.391396e-001, 6.400895e-001, 6.410394e-001, 6.419799e-001, 6.429203e-001, 6.438560e-001, 6.447910e-001,
+6.457198e-001, 6.466463e-001, 6.475693e-001, 6.484899e-001, 6.494090e-001, 6.503261e-001, 6.512409e-001, 6.521478e-001, 6.530546e-001, 6.539540e-001,
+6.548533e-001, 6.557485e-001, 6.566427e-001, 6.575334e-001, 6.584213e-001, 6.593077e-001, 6.601902e-001, 6.610728e-001, 6.619490e-001, 6.628252e-001,
+6.636962e-001, 6.645649e-001, 6.654312e-001, 6.662934e-001, 6.671554e-001, 6.680101e-001, 6.688649e-001, 6.697138e-001, 6.705600e-001, 6.714038e-001,
+6.722424e-001, 6.730809e-001, 6.739164e-001, 6.747515e-001, 6.755838e-001, 6.764130e-001, 6.772418e-001, 6.780628e-001, 6.788837e-001, 6.797022e-001,
+6.805190e-001, 6.813352e-001, 6.821470e-001, 6.829589e-001, 6.837666e-001, 6.845718e-001, 6.853765e-001, 6.861766e-001, 6.869766e-001, 6.877734e-001,
+6.885675e-001, 6.893617e-001, 6.901483e-001, 6.909349e-001, 6.917190e-001, 6.924995e-001, 6.932801e-001, 6.940551e-001, 6.948289e-001, 6.956020e-001,
+6.963723e-001, 6.971425e-001, 6.979110e-001, 6.986779e-001, 6.994447e-001, 7.002053e-001, 7.009650e-001, 7.017239e-001, 7.024795e-001, 7.032351e-001,
+7.039889e-001, 7.047406e-001, 7.054923e-001, 7.062384e-001, 7.069824e-001, 7.077264e-001, 7.084660e-001, 7.092055e-001, 7.099442e-001, 7.106793e-001,
+7.114143e-001, 7.121458e-001, 7.128711e-001, 7.135964e-001, 7.143178e-001, 7.150359e-001, 7.157540e-001, 7.164689e-001, 7.171824e-001, 7.178958e-001,
+7.186032e-001, 7.193091e-001, 7.200150e-001, 7.207157e-001, 7.214159e-001, 7.221161e-001, 7.228117e-001, 7.235072e-001, 7.242026e-001, 7.248928e-001,
+7.255830e-001, 7.262729e-001, 7.269590e-001, 7.276451e-001, 7.283308e-001, 7.290124e-001, 7.296939e-001, 7.303752e-001, 7.310516e-001, 7.317279e-001,
+7.324043e-001, 7.330767e-001, 7.337491e-001, 7.344215e-001, 7.350897e-001, 7.357577e-001, 7.364256e-001, 7.370893e-001, 7.377522e-001, 7.384151e-001,
+7.390752e-001, 7.397343e-001, 7.403933e-001, 7.410498e-001, 7.417044e-001, 7.423590e-001, 7.430117e-001, 7.436613e-001, 7.443109e-001, 7.449596e-001,
+7.456041e-001, 7.462486e-001, 7.468931e-001, 7.475315e-001, 7.481697e-001, 7.488078e-001, 7.494427e-001, 7.500761e-001, 7.507096e-001, 7.513409e-001,
+7.519694e-001, 7.525979e-001, 7.532257e-001, 7.538480e-001, 7.544703e-001, 7.550926e-001, 7.557114e-001, 7.563292e-001, 7.569469e-001, 7.575628e-001,
+7.581758e-001, 7.587887e-001, 7.594017e-001, 7.600087e-001, 7.606157e-001, 7.612227e-001, 7.618272e-001, 7.624299e-001, 7.630326e-001, 7.636347e-001,
+7.642328e-001, 7.648310e-001, 7.654291e-001, 7.660249e-001, 7.666196e-001, 7.672142e-001, 7.678085e-001, 7.684006e-001, 7.689928e-001, 7.695849e-001,
+7.701737e-001, 7.707604e-001, 7.713471e-001, 7.719335e-001, 7.725153e-001, 7.730970e-001, 7.736787e-001, 7.742595e-001, 7.748393e-001, 7.754191e-001,
+7.759988e-001, 7.765746e-001, 7.771495e-001, 7.777244e-001, 7.782985e-001, 7.788690e-001, 7.794395e-001, 7.800099e-001, 7.805797e-001, 7.811488e-001,
+7.817178e-001, 7.822869e-001, 7.828526e-001, 7.834174e-001, 7.839821e-001, 7.845467e-001, 7.851064e-001, 7.856660e-001, 7.862256e-001, 7.867846e-001,
+7.873415e-001, 7.878985e-001, 7.884554e-001, 7.890108e-001, 7.895641e-001, 7.901175e-001, 7.906708e-001, 7.912215e-001, 7.917704e-001, 7.923193e-001,
+7.928682e-001, 7.934157e-001, 7.939625e-001, 7.945094e-001, 7.950562e-001, 7.956007e-001, 7.961447e-001, 7.966886e-001, 7.972326e-001, 7.977704e-001,
+7.983075e-001, 7.988446e-001, 7.993817e-001, 7.999146e-001, 8.004472e-001, 8.009797e-001, 8.015123e-001, 8.020428e-001, 8.025731e-001, 8.031035e-001,
+8.036338e-001, 8.041588e-001, 8.046830e-001, 8.052072e-001, 8.057315e-001, 8.062517e-001, 8.067709e-001, 8.072902e-001, 8.078094e-001, 8.083264e-001,
+8.088425e-001, 8.093586e-001, 8.098746e-001, 8.103877e-001, 8.108985e-001, 8.114092e-001, 8.119200e-001, 8.124292e-001, 8.129357e-001, 8.134423e-001,
+8.139489e-001, 8.144550e-001, 8.149591e-001, 8.154632e-001, 8.159674e-001, 8.164715e-001, 8.169714e-001, 8.174710e-001, 8.179706e-001, 8.184703e-001,
+8.189676e-001, 8.194638e-001, 8.199600e-001, 8.204562e-001, 8.209517e-001, 8.214462e-001, 8.219406e-001, 8.224350e-001, 8.229294e-001, 8.234202e-001,
+8.239109e-001, 8.244017e-001, 8.248924e-001, 8.253807e-001, 8.258677e-001, 8.263546e-001, 8.268415e-001, 8.273276e-001, 8.278108e-001, 8.282940e-001,
+8.287772e-001, 8.292604e-001, 8.297403e-001, 8.302192e-001, 8.306980e-001, 8.311769e-001, 8.316546e-001, 8.321290e-001, 8.326034e-001, 8.330778e-001,
+8.335522e-001, 8.340238e-001, 8.344942e-001, 8.349647e-001, 8.354352e-001, 8.359051e-001, 8.363722e-001, 8.368392e-001, 8.373062e-001, 8.377732e-001,
+8.382383e-001, 8.387018e-001, 8.391654e-001, 8.396289e-001, 8.400924e-001, 8.405531e-001, 8.410136e-001, 8.414740e-001, 8.419345e-001, 8.423944e-001,
+8.428522e-001, 8.433101e-001, 8.437680e-001, 8.442259e-001, 8.446824e-001, 8.451377e-001, 8.455929e-001, 8.460482e-001, 8.465034e-001, 8.469562e-001,
+8.474082e-001, 8.478601e-001, 8.483120e-001, 8.487640e-001, 8.492119e-001, 8.496595e-001, 8.501072e-001, 8.505548e-001, 8.510021e-001, 8.514466e-001,
+8.518910e-001, 8.523355e-001, 8.527799e-001, 8.532239e-001, 8.536662e-001, 8.541085e-001, 8.545508e-001, 8.549930e-001, 8.554344e-001, 8.558735e-001,
+8.563125e-001, 8.567516e-001, 8.571907e-001, 8.576286e-001, 8.580639e-001, 8.584993e-001, 8.589347e-001, 8.593700e-001, 8.598046e-001, 8.602377e-001,
+8.606708e-001, 8.611039e-001, 8.615370e-001, 8.619692e-001, 8.623990e-001, 8.628288e-001, 8.632586e-001, 8.636884e-001, 8.641174e-001, 8.645430e-001,
+8.649685e-001, 8.653941e-001, 8.658196e-001, 8.662451e-001, 8.666694e-001, 8.670938e-001, 8.675182e-001, 8.679425e-001, 8.683669e-001, 8.687893e-001,
+8.692115e-001, 8.696337e-001, 8.700559e-001, 8.704781e-001, 8.708974e-001, 8.713154e-001, 8.717335e-001, 8.721515e-001, 8.725695e-001, 8.729862e-001,
+8.734011e-001, 8.738160e-001, 8.742309e-001, 8.746458e-001, 8.750605e-001, 8.754733e-001, 8.758860e-001, 8.762988e-001, 8.767116e-001, 8.771244e-001,
+8.775348e-001, 8.779444e-001, 8.783541e-001, 8.787637e-001, 8.791734e-001, 8.795822e-001, 8.799897e-001, 8.803973e-001, 8.808048e-001, 8.812123e-001,
+8.816198e-001, 8.820263e-001, 8.824327e-001, 8.828391e-001, 8.832455e-001, 8.836519e-001, 8.840569e-001, 8.844602e-001, 8.848636e-001, 8.852669e-001,
+8.856703e-001, 8.860736e-001, 8.864723e-001, 8.868706e-001, 8.872690e-001, 8.876674e-001, 8.880657e-001, 8.884632e-001, 8.888591e-001, 8.892550e-001,
+8.896509e-001, 8.900469e-001, 8.904428e-001, 8.908372e-001, 8.912312e-001, 8.916252e-001, 8.920192e-001, 8.924132e-001, 8.928069e-001, 8.931970e-001,
+8.935871e-001, 8.939773e-001, 8.943674e-001, 8.947576e-001, 8.951466e-001, 8.955339e-001, 8.959212e-001, 8.963085e-001, 8.966959e-001, 8.970832e-001,
+8.974693e-001, 8.978548e-001, 8.982402e-001, 8.986256e-001, 8.990111e-001, 8.993965e-001, 8.997789e-001, 9.001606e-001, 9.005422e-001, 9.009239e-001,
+9.013055e-001, 9.016872e-001, 9.020649e-001, 9.024425e-001, 9.028201e-001, 9.031976e-001, 9.035752e-001, 9.039526e-001, 9.043281e-001, 9.047036e-001,
+9.050791e-001, 9.054546e-001, 9.058301e-001, 9.062054e-001, 9.065783e-001, 9.069512e-001, 9.073242e-001, 9.076971e-001, 9.080701e-001, 9.084428e-001,
+9.088128e-001, 9.091828e-001, 9.095528e-001, 9.099228e-001, 9.102928e-001, 9.106627e-001, 9.110318e-001, 9.114008e-001, 9.117698e-001, 9.121389e-001,
+9.125079e-001, 9.128769e-001, 9.132447e-001, 9.136124e-001, 9.139801e-001, 9.143477e-001, 9.147154e-001, 9.150831e-001, 9.154475e-001, 9.158111e-001,
+9.161747e-001, 9.165383e-001, 9.169019e-001, 9.172655e-001, 9.176265e-001, 9.179858e-001, 9.183450e-001, 9.187042e-001, 9.190635e-001, 9.194227e-001,
+9.197812e-001, 9.201380e-001, 9.204949e-001, 9.208517e-001, 9.212086e-001, 9.215654e-001, 9.219222e-001, 9.222761e-001, 9.226301e-001, 9.229841e-001,
+9.233380e-001, 9.236920e-001, 9.240460e-001, 9.243978e-001, 9.247485e-001, 9.250993e-001, 9.254500e-001, 9.258008e-001, 9.261515e-001, 9.265019e-001,
+9.268513e-001, 9.272008e-001, 9.275502e-001, 9.278996e-001, 9.282490e-001, 9.285985e-001, 9.289465e-001, 9.292942e-001, 9.296419e-001, 9.299896e-001,
+9.303374e-001, 9.306851e-001, 9.310320e-001, 9.313767e-001, 9.317214e-001, 9.320661e-001, 9.324108e-001, 9.327555e-001, 9.331002e-001, 9.334433e-001,
+9.337857e-001, 9.341281e-001, 9.344705e-001, 9.348128e-001, 9.351552e-001, 9.354975e-001, 9.358382e-001, 9.361788e-001, 9.365195e-001, 9.368602e-001,
+9.372009e-001, 9.375416e-001, 9.378811e-001, 9.382189e-001, 9.385566e-001, 9.388943e-001, 9.392320e-001, 9.395697e-001, 9.399075e-001, 9.402431e-001,
+9.405775e-001, 9.409120e-001, 9.412464e-001, 9.415809e-001, 9.419153e-001, 9.422498e-001, 9.425830e-001, 9.429160e-001, 9.432490e-001, 9.435820e-001,
+9.439150e-001, 9.442480e-001, 9.445810e-001, 9.449121e-001, 9.452433e-001, 9.455745e-001, 9.459056e-001, 9.462368e-001, 9.465680e-001, 9.468988e-001,
+9.472269e-001, 9.475550e-001, 9.478832e-001, 9.482113e-001, 9.485394e-001, 9.488675e-001, 9.491953e-001, 9.495210e-001, 9.498467e-001, 9.501724e-001,
+9.504981e-001, 9.508238e-001, 9.511495e-001, 9.514749e-001, 9.517981e-001, 9.521212e-001, 9.524443e-001, 9.527674e-001, 9.530906e-001, 9.534137e-001,
+9.537366e-001, 9.540543e-001, 9.543720e-001, 9.546897e-001, 9.550074e-001, 9.553251e-001, 9.556429e-001, 9.559606e-001, 9.562745e-001, 9.565881e-001,
+9.569017e-001, 9.572152e-001, 9.575288e-001, 9.578424e-001, 9.581559e-001, 9.584684e-001, 9.587804e-001, 9.590925e-001, 9.594045e-001, 9.597165e-001,
+9.600286e-001, 9.603406e-001, 9.606513e-001, 9.609604e-001, 9.612696e-001, 9.615787e-001, 9.618878e-001, 9.621970e-001, 9.625061e-001, 9.628148e-001,
+9.631211e-001, 9.634273e-001, 9.637335e-001, 9.640397e-001, 9.643459e-001, 9.646521e-001, 9.649583e-001, 9.652629e-001, 9.655669e-001, 9.658709e-001,
+9.661749e-001, 9.664788e-001, 9.667828e-001, 9.670868e-001, 9.673900e-001, 9.676913e-001, 9.679926e-001, 9.682939e-001, 9.685953e-001, 9.688966e-001,
+9.691979e-001, 9.694992e-001, 9.697984e-001, 9.700970e-001, 9.703956e-001, 9.706942e-001, 9.709929e-001, 9.712915e-001, 9.715901e-001, 9.718882e-001,
+9.721845e-001, 9.724807e-001, 9.727770e-001, 9.730733e-001, 9.733695e-001, 9.736658e-001, 9.739621e-001, 9.742565e-001, 9.745498e-001, 9.748430e-001,
+9.751363e-001, 9.754295e-001, 9.757228e-001, 9.760160e-001, 9.763093e-001, 9.765991e-001, 9.768886e-001, 9.771782e-001, 9.774677e-001, 9.777573e-001,
+9.780468e-001, 9.783364e-001, 9.786253e-001, 9.789114e-001, 9.791974e-001, 9.794835e-001, 9.797695e-001, 9.800555e-001, 9.803416e-001, 9.806276e-001,
+9.809124e-001, 9.811949e-001, 9.814774e-001, 9.817599e-001, 9.820424e-001, 9.823249e-001, 9.826074e-001, 9.828899e-001, 9.831706e-001, 9.834493e-001,
+9.837280e-001, 9.840067e-001, 9.842855e-001, 9.845642e-001, 9.848429e-001, 9.851216e-001, 9.853983e-001, 9.856731e-001, 9.859479e-001, 9.862228e-001,
+9.864976e-001, 9.867724e-001, 9.870472e-001, 9.873221e-001, 9.875941e-001, 9.878635e-001, 9.881329e-001, 9.884023e-001, 9.886716e-001, 9.889410e-001,
+9.892104e-001, 9.894798e-001, 9.897462e-001, 9.900088e-001, 9.902713e-001, 9.905338e-001, 9.907963e-001, 9.910588e-001, 9.913214e-001, 9.915839e-001,
+9.918449e-001, 9.921018e-001, 9.923588e-001, 9.926157e-001, 9.928726e-001, 9.931296e-001, 9.933865e-001, 9.936434e-001, 9.939001e-001, 9.941519e-001,
+9.944038e-001, 9.946557e-001, 9.949075e-001, 9.951594e-001, 9.954112e-001, 9.956631e-001, 9.959150e-001, 9.961607e-001, 9.964046e-001, 9.966485e-001,
+9.968924e-001, 9.971364e-001, 9.973803e-001, 9.976242e-001, 9.978681e-001, 9.981089e-001, 9.983453e-001, 9.985817e-001, 9.988180e-001, 9.990544e-001,
+9.992908e-001, 9.995272e-001, 9.997636e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.027654e-002, 3.520485e-002, 4.794106e-002, 5.937913e-002, 6.989355e-002, 7.973640e-002, 8.904761e-002, 9.790824e-002, 1.063619e-001,
+1.144785e-001, 1.222776e-001, 1.297329e-001, 1.368501e-001, 1.436758e-001, 1.502327e-001, 1.565580e-001, 1.626631e-001, 1.685642e-001, 1.742689e-001,
+1.798012e-001, 1.851902e-001, 1.904155e-001, 1.955112e-001, 2.004681e-001, 2.053216e-001, 2.100496e-001, 2.146542e-001, 2.191716e-001, 2.236115e-001,
+2.279453e-001, 2.321790e-001, 2.363519e-001, 2.404531e-001, 2.444870e-001, 2.484597e-001, 2.523579e-001, 2.561707e-001, 2.599091e-001, 2.635894e-001,
+2.672078e-001, 2.707605e-001, 2.742443e-001, 2.776701e-001, 2.810554e-001, 2.844128e-001, 2.877435e-001, 2.910458e-001, 2.943179e-001, 2.975486e-001,
+3.007348e-001, 3.038784e-001, 3.069827e-001, 3.100474e-001, 3.130752e-001, 3.160669e-001, 3.190228e-001, 3.219431e-001, 3.248273e-001, 3.276774e-001,
+3.305041e-001, 3.333109e-001, 3.360994e-001, 3.388687e-001, 3.416138e-001, 3.443362e-001, 3.470380e-001, 3.497211e-001, 3.523826e-001, 3.550177e-001,
+3.576204e-001, 3.601946e-001, 3.627431e-001, 3.652669e-001, 3.677677e-001, 3.702488e-001, 3.727083e-001, 3.751435e-001, 3.775567e-001, 3.799485e-001,
+3.823226e-001, 3.846783e-001, 3.870178e-001, 3.893365e-001, 3.916387e-001, 3.939254e-001, 3.961988e-001, 3.984618e-001, 4.007128e-001, 4.029492e-001,
+4.051673e-001, 4.073693e-001, 4.095578e-001, 4.117331e-001, 4.138962e-001, 4.160451e-001, 4.181814e-001, 4.203011e-001, 4.224059e-001, 4.244979e-001,
+4.265782e-001, 4.286450e-001, 4.306966e-001, 4.327369e-001, 4.347666e-001, 4.367871e-001, 4.388002e-001, 4.407989e-001, 4.427833e-001, 4.447550e-001,
+4.467160e-001, 4.486671e-001, 4.506083e-001, 4.525383e-001, 4.544585e-001, 4.563669e-001, 4.582643e-001, 4.601487e-001, 4.620201e-001, 4.638801e-001,
+4.657298e-001, 4.675683e-001, 4.693951e-001, 4.712128e-001, 4.730215e-001, 4.748198e-001, 4.766085e-001, 4.783887e-001, 4.801595e-001, 4.819204e-001,
+4.836716e-001, 4.854124e-001, 4.871423e-001, 4.888613e-001, 4.905700e-001, 4.922698e-001, 4.939587e-001, 4.956364e-001, 4.973057e-001, 4.989678e-001,
+5.006221e-001, 5.022669e-001, 5.039017e-001, 5.055288e-001, 5.071460e-001, 5.087574e-001, 5.103608e-001, 5.119572e-001, 5.135468e-001, 5.151287e-001,
+5.166986e-001, 5.182607e-001, 5.198156e-001, 5.213642e-001, 5.229078e-001, 5.244424e-001, 5.259713e-001, 5.274928e-001, 5.290061e-001, 5.305104e-001,
+5.320072e-001, 5.334974e-001, 5.349810e-001, 5.364567e-001, 5.379219e-001, 5.393792e-001, 5.408291e-001, 5.422708e-001, 5.437060e-001, 5.451354e-001,
+5.465585e-001, 5.479697e-001, 5.493731e-001, 5.507693e-001, 5.521574e-001, 5.535388e-001, 5.549158e-001, 5.562885e-001, 5.576546e-001, 5.590159e-001,
+5.603707e-001, 5.617178e-001, 5.630593e-001, 5.643923e-001, 5.657189e-001, 5.670407e-001, 5.683545e-001, 5.696624e-001, 5.709664e-001, 5.722628e-001,
+5.735522e-001, 5.748370e-001, 5.761142e-001, 5.773867e-001, 5.786543e-001, 5.799150e-001, 5.811718e-001, 5.824205e-001, 5.836634e-001, 5.849029e-001,
+5.861351e-001, 5.873641e-001, 5.885868e-001, 5.898030e-001, 5.910161e-001, 5.922205e-001, 5.934226e-001, 5.946191e-001, 5.958110e-001, 5.969996e-001,
+5.981795e-001, 5.993567e-001, 6.005251e-001, 6.016913e-001, 6.028537e-001, 6.040124e-001, 6.051688e-001, 6.063209e-001, 6.074719e-001, 6.086150e-001,
+6.097557e-001, 6.108885e-001, 6.120189e-001, 6.131458e-001, 6.142670e-001, 6.153838e-001, 6.164928e-001, 6.175985e-001, 6.186978e-001, 6.197957e-001,
+6.208844e-001, 6.219724e-001, 6.230551e-001, 6.241365e-001, 6.252097e-001, 6.262814e-001, 6.273472e-001, 6.284117e-001, 6.294724e-001, 6.305295e-001,
+6.315775e-001, 6.326225e-001, 6.336600e-001, 6.346952e-001, 6.357245e-001, 6.367521e-001, 6.377754e-001, 6.387977e-001, 6.398170e-001, 6.408346e-001,
+6.418454e-001, 6.428552e-001, 6.438587e-001, 6.448619e-001, 6.458585e-001, 6.468552e-001, 6.478438e-001, 6.488321e-001, 6.498137e-001, 6.507939e-001,
+6.517695e-001, 6.527430e-001, 6.537116e-001, 6.546761e-001, 6.556368e-001, 6.565909e-001, 6.575439e-001, 6.584920e-001, 6.594400e-001, 6.603808e-001,
+6.613214e-001, 6.622567e-001, 6.631903e-001, 6.641205e-001, 6.650474e-001, 6.659724e-001, 6.668913e-001, 6.678102e-001, 6.687255e-001, 6.696406e-001,
+6.705511e-001, 6.714593e-001, 6.723641e-001, 6.732623e-001, 6.741605e-001, 6.750528e-001, 6.759452e-001, 6.768318e-001, 6.777152e-001, 6.785969e-001,
+6.794738e-001, 6.803507e-001, 6.812240e-001, 6.820967e-001, 6.829648e-001, 6.838271e-001, 6.846893e-001, 6.855435e-001, 6.863978e-001, 6.872488e-001,
+6.880973e-001, 6.889454e-001, 6.897872e-001, 6.906291e-001, 6.914675e-001, 6.923034e-001, 6.931389e-001, 6.939679e-001, 6.947970e-001, 6.956221e-001,
+6.964434e-001, 6.972647e-001, 6.980793e-001, 6.988936e-001, 6.997050e-001, 7.005113e-001, 7.013177e-001, 7.021173e-001, 7.029149e-001, 7.037114e-001,
+7.045008e-001, 7.052903e-001, 7.060779e-001, 7.068635e-001, 7.076490e-001, 7.084294e-001, 7.092086e-001, 7.099867e-001, 7.107572e-001, 7.115277e-001,
+7.122963e-001, 7.130622e-001, 7.138281e-001, 7.145892e-001, 7.153481e-001, 7.161070e-001, 7.168573e-001, 7.176068e-001, 7.183556e-001, 7.190998e-001,
+7.198440e-001, 7.205856e-001, 7.213222e-001, 7.220587e-001, 7.227927e-001, 7.235242e-001, 7.242556e-001, 7.249854e-001, 7.257142e-001, 7.264430e-001,
+7.271657e-001, 7.278866e-001, 7.286075e-001, 7.293237e-001, 7.300392e-001, 7.307547e-001, 7.314674e-001, 7.321799e-001, 7.328924e-001, 7.335967e-001,
+7.343011e-001, 7.350053e-001, 7.357040e-001, 7.364027e-001, 7.371012e-001, 7.377966e-001, 7.384920e-001, 7.391872e-001, 7.398742e-001, 7.405612e-001,
+7.412482e-001, 7.419282e-001, 7.426079e-001, 7.432876e-001, 7.439623e-001, 7.446364e-001, 7.453106e-001, 7.459799e-001, 7.466480e-001, 7.473161e-001,
+7.479804e-001, 7.486427e-001, 7.493051e-001, 7.499646e-001, 7.506215e-001, 7.512784e-001, 7.519340e-001, 7.525871e-001, 7.532402e-001, 7.538928e-001,
+7.545417e-001, 7.551906e-001, 7.558395e-001, 7.564836e-001, 7.571273e-001, 7.577710e-001, 7.584123e-001, 7.590525e-001, 7.596926e-001, 7.603307e-001,
+7.609655e-001, 7.616002e-001, 7.622345e-001, 7.628622e-001, 7.634899e-001, 7.641176e-001, 7.647430e-001, 7.653677e-001, 7.659923e-001, 7.666151e-001,
+7.672348e-001, 7.678545e-001, 7.684742e-001, 7.690863e-001, 7.696982e-001, 7.703102e-001, 7.709196e-001, 7.715269e-001, 7.721343e-001, 7.727413e-001,
+7.733444e-001, 7.739474e-001, 7.745505e-001, 7.751491e-001, 7.757450e-001, 7.763409e-001, 7.769364e-001, 7.775283e-001, 7.781202e-001, 7.787121e-001,
+7.793019e-001, 7.798901e-001, 7.804783e-001, 7.810665e-001, 7.816481e-001, 7.822298e-001, 7.828114e-001, 7.833916e-001, 7.839699e-001, 7.845481e-001,
+7.851263e-001, 7.857020e-001, 7.862772e-001, 7.868523e-001, 7.874264e-001, 7.879943e-001, 7.885621e-001, 7.891300e-001, 7.896951e-001, 7.902569e-001,
+7.908187e-001, 7.913805e-001, 7.919393e-001, 7.924970e-001, 7.930547e-001, 7.936124e-001, 7.941638e-001, 7.947151e-001, 7.952665e-001, 7.958168e-001,
+7.963630e-001, 7.969093e-001, 7.974555e-001, 7.980004e-001, 7.985433e-001, 7.990863e-001, 7.996292e-001, 8.001691e-001, 8.007066e-001, 8.012442e-001,
+8.017817e-001, 8.023154e-001, 8.028475e-001, 8.033795e-001, 8.039115e-001, 8.044401e-001, 8.049678e-001, 8.054954e-001, 8.060231e-001, 8.065471e-001,
+8.070704e-001, 8.075938e-001, 8.081171e-001, 8.086366e-001, 8.091554e-001, 8.096743e-001, 8.101932e-001, 8.107082e-001, 8.112226e-001, 8.117371e-001,
+8.122515e-001, 8.127616e-001, 8.132709e-001, 8.137802e-001, 8.142895e-001, 8.147963e-001, 8.153023e-001, 8.158083e-001, 8.163143e-001, 8.168173e-001,
+8.173187e-001, 8.178202e-001, 8.183216e-001, 8.188200e-001, 8.193156e-001, 8.198113e-001, 8.203069e-001, 8.208018e-001, 8.212954e-001, 8.217890e-001,
+8.222827e-001, 8.227758e-001, 8.232661e-001, 8.237565e-001, 8.242468e-001, 8.247372e-001, 8.252224e-001, 8.257071e-001, 8.261918e-001, 8.266765e-001,
+8.271585e-001, 8.276389e-001, 8.281194e-001, 8.285998e-001, 8.290792e-001, 8.295565e-001, 8.300338e-001, 8.305111e-001, 8.309884e-001, 8.314603e-001,
+8.319321e-001, 8.324039e-001, 8.328756e-001, 8.333446e-001, 8.338115e-001, 8.342785e-001, 8.347455e-001, 8.352121e-001, 8.356773e-001, 8.361425e-001,
+8.366077e-001, 8.370729e-001, 8.375352e-001, 8.379962e-001, 8.384573e-001, 8.389184e-001, 8.393785e-001, 8.398350e-001, 8.402916e-001, 8.407481e-001,
+8.412047e-001, 8.416598e-001, 8.421143e-001, 8.425687e-001, 8.430232e-001, 8.434774e-001, 8.439292e-001, 8.443810e-001, 8.448329e-001, 8.452847e-001,
+8.457334e-001, 8.461793e-001, 8.466251e-001, 8.470709e-001, 8.475168e-001, 8.479586e-001, 8.483999e-001, 8.488412e-001, 8.492824e-001, 8.497232e-001,
+8.501617e-001, 8.506002e-001, 8.510387e-001, 8.514773e-001, 8.519137e-001, 8.523478e-001, 8.527819e-001, 8.532160e-001, 8.536501e-001, 8.540809e-001,
+8.545102e-001, 8.549396e-001, 8.553690e-001, 8.557983e-001, 8.562255e-001, 8.566524e-001, 8.570794e-001, 8.575063e-001, 8.579330e-001, 8.583570e-001,
+8.587810e-001, 8.592050e-001, 8.596290e-001, 8.600522e-001, 8.604718e-001, 8.608914e-001, 8.613110e-001, 8.617306e-001, 8.621493e-001, 8.625653e-001,
+8.629813e-001, 8.633973e-001, 8.638133e-001, 8.642285e-001, 8.646416e-001, 8.650546e-001, 8.654677e-001, 8.658808e-001, 8.662931e-001, 8.667034e-001,
+8.671137e-001, 8.675241e-001, 8.679344e-001, 8.683442e-001, 8.687525e-001, 8.691607e-001, 8.695690e-001, 8.699772e-001, 8.703853e-001, 8.707921e-001,
+8.711990e-001, 8.716059e-001, 8.720128e-001, 8.724195e-001, 8.728236e-001, 8.732277e-001, 8.736318e-001, 8.740359e-001, 8.744400e-001, 8.748406e-001,
+8.752405e-001, 8.756405e-001, 8.760404e-001, 8.764404e-001, 8.768381e-001, 8.772346e-001, 8.776311e-001, 8.780276e-001, 8.784241e-001, 8.788195e-001,
+8.792132e-001, 8.796069e-001, 8.800007e-001, 8.803944e-001, 8.807878e-001, 8.811790e-001, 8.815701e-001, 8.819612e-001, 8.823524e-001, 8.827435e-001,
+8.831324e-001, 8.835206e-001, 8.839088e-001, 8.842970e-001, 8.846852e-001, 8.850721e-001, 8.854566e-001, 8.858411e-001, 8.862256e-001, 8.866102e-001,
+8.869947e-001, 8.873756e-001, 8.877562e-001, 8.881369e-001, 8.885175e-001, 8.888981e-001, 8.892777e-001, 8.896562e-001, 8.900346e-001, 8.904130e-001,
+8.907914e-001, 8.911698e-001, 8.915463e-001, 8.919227e-001, 8.922990e-001, 8.926754e-001, 8.930518e-001, 8.934273e-001, 8.938014e-001, 8.941754e-001,
+8.945494e-001, 8.949235e-001, 8.952975e-001, 8.956700e-001, 8.960420e-001, 8.964139e-001, 8.967859e-001, 8.971578e-001, 8.975296e-001, 8.978991e-001,
+8.982687e-001, 8.986382e-001, 8.990077e-001, 8.993772e-001, 8.997456e-001, 9.001120e-001, 9.004784e-001, 9.008447e-001, 9.012111e-001, 9.015774e-001,
+9.019418e-001, 9.023047e-001, 9.026677e-001, 9.030306e-001, 9.033935e-001, 9.037565e-001, 9.041181e-001, 9.044793e-001, 9.048405e-001, 9.052017e-001,
+9.055629e-001, 9.059241e-001, 9.062829e-001, 9.066416e-001, 9.070003e-001, 9.073589e-001, 9.077176e-001, 9.080762e-001, 9.084307e-001, 9.087853e-001,
+9.091399e-001, 9.094944e-001, 9.098490e-001, 9.102033e-001, 9.105550e-001, 9.109067e-001, 9.112585e-001, 9.116102e-001, 9.119619e-001, 9.123135e-001,
+9.126635e-001, 9.130135e-001, 9.133635e-001, 9.137135e-001, 9.140635e-001, 9.144134e-001, 9.147610e-001, 9.151085e-001, 9.154561e-001, 9.158036e-001,
+9.161511e-001, 9.164987e-001, 9.168429e-001, 9.171868e-001, 9.175308e-001, 9.178748e-001, 9.182187e-001, 9.185627e-001, 9.189048e-001, 9.192464e-001,
+9.195880e-001, 9.199296e-001, 9.202712e-001, 9.206128e-001, 9.209534e-001, 9.212933e-001, 9.216331e-001, 9.219730e-001, 9.223129e-001, 9.226528e-001,
+9.229916e-001, 9.233281e-001, 9.236647e-001, 9.240012e-001, 9.243378e-001, 9.246744e-001, 9.250109e-001, 9.253453e-001, 9.256798e-001, 9.260142e-001,
+9.263487e-001, 9.266831e-001, 9.270175e-001, 9.273513e-001, 9.276848e-001, 9.280183e-001, 9.283518e-001, 9.286853e-001, 9.290187e-001, 9.293516e-001,
+9.296825e-001, 9.300134e-001, 9.303443e-001, 9.306753e-001, 9.310062e-001, 9.313371e-001, 9.316648e-001, 9.319916e-001, 9.323184e-001, 9.326452e-001,
+9.329721e-001, 9.332989e-001, 9.336249e-001, 9.339489e-001, 9.342728e-001, 9.345968e-001, 9.349208e-001, 9.352447e-001, 9.355687e-001, 9.358914e-001,
+9.362136e-001, 9.365358e-001, 9.368580e-001, 9.371802e-001, 9.375024e-001, 9.378244e-001, 9.381432e-001, 9.384621e-001, 9.387809e-001, 9.390997e-001,
+9.394186e-001, 9.397374e-001, 9.400549e-001, 9.403703e-001, 9.406857e-001, 9.410011e-001, 9.413165e-001, 9.416319e-001, 9.419473e-001, 9.422618e-001,
+9.425758e-001, 9.428898e-001, 9.432038e-001, 9.435179e-001, 9.438319e-001, 9.441459e-001, 9.444586e-001, 9.447710e-001, 9.450835e-001, 9.453959e-001,
+9.457084e-001, 9.460208e-001, 9.463333e-001, 9.466426e-001, 9.469520e-001, 9.472613e-001, 9.475707e-001, 9.478800e-001, 9.481894e-001, 9.484986e-001,
+9.488060e-001, 9.491134e-001, 9.494208e-001, 9.497282e-001, 9.500356e-001, 9.503430e-001, 9.506503e-001, 9.509568e-001, 9.512634e-001, 9.515700e-001,
+9.518765e-001, 9.521831e-001, 9.524897e-001, 9.527960e-001, 9.531002e-001, 9.534044e-001, 9.537086e-001, 9.540127e-001, 9.543169e-001, 9.546211e-001,
+9.549252e-001, 9.552259e-001, 9.555266e-001, 9.558274e-001, 9.561281e-001, 9.564288e-001, 9.567295e-001, 9.570302e-001, 9.573287e-001, 9.576270e-001,
+9.579253e-001, 9.582236e-001, 9.585218e-001, 9.588201e-001, 9.591184e-001, 9.594157e-001, 9.597127e-001, 9.600096e-001, 9.603065e-001, 9.606035e-001,
+9.609004e-001, 9.611973e-001, 9.614931e-001, 9.617875e-001, 9.620819e-001, 9.623763e-001, 9.626707e-001, 9.629651e-001, 9.632595e-001, 9.635536e-001,
+9.638456e-001, 9.641376e-001, 9.644295e-001, 9.647215e-001, 9.650135e-001, 9.653054e-001, 9.655974e-001, 9.658881e-001, 9.661785e-001, 9.664688e-001,
+9.667591e-001, 9.670494e-001, 9.673397e-001, 9.676300e-001, 9.679197e-001, 9.682080e-001, 9.684962e-001, 9.687844e-001, 9.690727e-001, 9.693609e-001,
+9.696491e-001, 9.699374e-001, 9.702233e-001, 9.705085e-001, 9.707938e-001, 9.710791e-001, 9.713644e-001, 9.716497e-001, 9.719350e-001, 9.722197e-001,
+9.725024e-001, 9.727851e-001, 9.730678e-001, 9.733504e-001, 9.736331e-001, 9.739158e-001, 9.741985e-001, 9.744800e-001, 9.747607e-001, 9.750415e-001,
+9.753222e-001, 9.756029e-001, 9.758836e-001, 9.761644e-001, 9.764451e-001, 9.767239e-001, 9.770026e-001, 9.772812e-001, 9.775598e-001, 9.778385e-001,
+9.781171e-001, 9.783958e-001, 9.786741e-001, 9.789509e-001, 9.792277e-001, 9.795044e-001, 9.797812e-001, 9.800580e-001, 9.803347e-001, 9.806115e-001,
+9.808876e-001, 9.811623e-001, 9.814370e-001, 9.817117e-001, 9.819864e-001, 9.822611e-001, 9.825358e-001, 9.828105e-001, 9.830839e-001, 9.833558e-001,
+9.836277e-001, 9.838996e-001, 9.841714e-001, 9.844433e-001, 9.847152e-001, 9.849871e-001, 9.852576e-001, 9.855268e-001, 9.857960e-001, 9.860652e-001,
+9.863345e-001, 9.866037e-001, 9.868729e-001, 9.871421e-001, 9.874102e-001, 9.876770e-001, 9.879438e-001, 9.882107e-001, 9.884775e-001, 9.887443e-001,
+9.890111e-001, 9.892780e-001, 9.895431e-001, 9.898059e-001, 9.900687e-001, 9.903315e-001, 9.905943e-001, 9.908571e-001, 9.911199e-001, 9.913827e-001,
+9.916441e-001, 9.919017e-001, 9.921593e-001, 9.924170e-001, 9.926746e-001, 9.929322e-001, 9.931899e-001, 9.934475e-001, 9.937050e-001, 9.939597e-001,
+9.942144e-001, 9.944692e-001, 9.947239e-001, 9.949786e-001, 9.952334e-001, 9.954881e-001, 9.957428e-001, 9.959962e-001, 9.962492e-001, 9.965021e-001,
+9.967551e-001, 9.970080e-001, 9.972610e-001, 9.975139e-001, 9.977669e-001, 9.980177e-001, 9.982655e-001, 9.985133e-001, 9.987610e-001, 9.990088e-001,
+9.992566e-001, 9.995044e-001, 9.997522e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.411225e-002, 2.598715e-002, 3.631612e-002, 4.568905e-002, 5.437961e-002, 6.253709e-002, 7.022396e-002, 7.755747e-002, 8.459223e-002,
+9.129670e-002, 9.771323e-002, 1.038620e-001, 1.097527e-001, 1.154338e-001, 1.209276e-001, 1.262387e-001, 1.313958e-001, 1.363987e-001, 1.412739e-001,
+1.460294e-001, 1.506732e-001, 1.552059e-001, 1.596465e-001, 1.639927e-001, 1.682489e-001, 1.724233e-001, 1.765284e-001, 1.805596e-001, 1.845163e-001,
+1.884079e-001, 1.922432e-001, 1.960131e-001, 1.997288e-001, 2.033922e-001, 2.069972e-001, 2.105585e-001, 2.140690e-001, 2.175384e-001, 2.209592e-001,
+2.243333e-001, 2.276653e-001, 2.309532e-001, 2.342132e-001, 2.374294e-001, 2.406121e-001, 2.437625e-001, 2.468759e-001, 2.499559e-001, 2.530025e-001,
+2.560171e-001, 2.590035e-001, 2.619607e-001, 2.648897e-001, 2.677848e-001, 2.706494e-001, 2.734930e-001, 2.763096e-001, 2.790903e-001, 2.818470e-001,
+2.845871e-001, 2.873024e-001, 2.899893e-001, 2.926527e-001, 2.952903e-001, 2.979075e-001, 3.005059e-001, 3.030832e-001, 3.056401e-001, 3.081726e-001,
+3.106765e-001, 3.131647e-001, 3.156423e-001, 3.181055e-001, 3.205489e-001, 3.229710e-001, 3.253683e-001, 3.277473e-001, 3.301079e-001, 3.324498e-001,
+3.347747e-001, 3.370811e-001, 3.393734e-001, 3.416541e-001, 3.439235e-001, 3.461783e-001, 3.484173e-001, 3.506392e-001, 3.528397e-001, 3.550203e-001,
+3.571820e-001, 3.593286e-001, 3.614608e-001, 3.635764e-001, 3.656741e-001, 3.677546e-001, 3.698170e-001, 3.718581e-001, 3.738801e-001, 3.758884e-001,
+3.778843e-001, 3.798669e-001, 3.818354e-001, 3.837905e-001, 3.857320e-001, 3.876594e-001, 3.895726e-001, 3.914705e-001, 3.933527e-001, 3.952197e-001,
+3.970731e-001, 3.989152e-001, 4.007459e-001, 4.025673e-001, 4.043807e-001, 4.061862e-001, 4.079839e-001, 4.097738e-001, 4.115561e-001, 4.133308e-001,
+4.150981e-001, 4.168580e-001, 4.186107e-001, 4.203561e-001, 4.220944e-001, 4.238258e-001, 4.255502e-001, 4.272677e-001, 4.289786e-001, 4.306828e-001,
+4.323804e-001, 4.340715e-001, 4.357562e-001, 4.374346e-001, 4.391068e-001, 4.407729e-001, 4.424329e-001, 4.440840e-001, 4.457262e-001, 4.473607e-001,
+4.489873e-001, 4.506062e-001, 4.522179e-001, 4.538219e-001, 4.554185e-001, 4.570069e-001, 4.585888e-001, 4.601628e-001, 4.617281e-001, 4.632850e-001,
+4.648320e-001, 4.663707e-001, 4.679019e-001, 4.694260e-001, 4.709433e-001, 4.724520e-001, 4.739540e-001, 4.754490e-001, 4.769366e-001, 4.784151e-001,
+4.798853e-001, 4.813486e-001, 4.828055e-001, 4.842553e-001, 4.856971e-001, 4.871336e-001, 4.885647e-001, 4.899865e-001, 4.914005e-001, 4.928086e-001,
+4.942107e-001, 4.956040e-001, 4.969925e-001, 4.983762e-001, 4.997531e-001, 5.011236e-001, 5.024888e-001, 5.038468e-001, 5.051985e-001, 5.065459e-001,
+5.078875e-001, 5.092236e-001, 5.105562e-001, 5.118841e-001, 5.132076e-001, 5.145277e-001, 5.158424e-001, 5.171518e-001, 5.184581e-001, 5.197597e-001,
+5.210576e-001, 5.223529e-001, 5.236395e-001, 5.249217e-001, 5.261995e-001, 5.274701e-001, 5.287378e-001, 5.300002e-001, 5.312584e-001, 5.325141e-001,
+5.337622e-001, 5.350074e-001, 5.362475e-001, 5.374835e-001, 5.387175e-001, 5.399456e-001, 5.411707e-001, 5.423897e-001, 5.436031e-001, 5.448130e-001,
+5.460162e-001, 5.472175e-001, 5.484124e-001, 5.496051e-001, 5.507942e-001, 5.519784e-001, 5.531599e-001, 5.543354e-001, 5.555096e-001, 5.566766e-001,
+5.578411e-001, 5.589980e-001, 5.601517e-001, 5.613012e-001, 5.624457e-001, 5.635868e-001, 5.647238e-001, 5.658593e-001, 5.669876e-001, 5.681148e-001,
+5.692356e-001, 5.703558e-001, 5.714686e-001, 5.725800e-001, 5.736833e-001, 5.747849e-001, 5.758804e-001, 5.769739e-001, 5.780618e-001, 5.791480e-001,
+5.802302e-001, 5.813100e-001, 5.823848e-001, 5.834575e-001, 5.845260e-001, 5.855917e-001, 5.866508e-001, 5.877078e-001, 5.887587e-001, 5.898080e-001,
+5.908517e-001, 5.918945e-001, 5.929322e-001, 5.939694e-001, 5.950021e-001, 5.960347e-001, 5.970602e-001, 5.980855e-001, 5.991043e-001, 6.001220e-001,
+6.011344e-001, 6.021447e-001, 6.031510e-001, 6.041542e-001, 6.051554e-001, 6.061536e-001, 6.071501e-001, 6.081402e-001, 6.091303e-001, 6.101106e-001,
+6.110908e-001, 6.120656e-001, 6.130388e-001, 6.140081e-001, 6.149740e-001, 6.159386e-001, 6.168998e-001, 6.178610e-001, 6.188142e-001, 6.197673e-001,
+6.207141e-001, 6.216580e-001, 6.225993e-001, 6.235359e-001, 6.244725e-001, 6.254026e-001, 6.263327e-001, 6.272597e-001, 6.281853e-001, 6.291081e-001,
+6.300242e-001, 6.309403e-001, 6.318492e-001, 6.327571e-001, 6.336620e-001, 6.345633e-001, 6.354645e-001, 6.363605e-001, 6.372565e-001, 6.381503e-001,
+6.390424e-001, 6.399337e-001, 6.408177e-001, 6.417017e-001, 6.425812e-001, 6.434578e-001, 6.443339e-001, 6.452031e-001, 6.460722e-001, 6.469382e-001,
+6.478013e-001, 6.486644e-001, 6.495230e-001, 6.503814e-001, 6.512373e-001, 6.520893e-001, 6.529413e-001, 6.537884e-001, 6.546340e-001, 6.554788e-001,
+6.563187e-001, 6.571586e-001, 6.579943e-001, 6.588262e-001, 6.596580e-001, 6.604820e-001, 6.613045e-001, 6.621260e-001, 6.629421e-001, 6.637582e-001,
+6.645716e-001, 6.653813e-001, 6.661911e-001, 6.669985e-001, 6.678047e-001, 6.686110e-001, 6.694114e-001, 6.702114e-001, 6.710103e-001, 6.718034e-001,
+6.725964e-001, 6.733878e-001, 6.741761e-001, 6.749645e-001, 6.757489e-001, 6.765299e-001, 6.773108e-001, 6.780883e-001, 6.788641e-001, 6.796398e-001,
+6.804110e-001, 6.811809e-001, 6.819508e-001, 6.827170e-001, 6.834827e-001, 6.842484e-001, 6.850115e-001, 6.857745e-001, 6.865373e-001, 6.872922e-001,
+6.880471e-001, 6.888017e-001, 6.895500e-001, 6.902984e-001, 6.910465e-001, 6.917898e-001, 6.925332e-001, 6.932764e-001, 6.940136e-001, 6.947508e-001,
+6.954880e-001, 6.962195e-001, 6.969510e-001, 6.976824e-001, 6.984076e-001, 6.991322e-001, 6.998567e-001, 7.005770e-001, 7.012962e-001, 7.020155e-001,
+7.027321e-001, 7.034475e-001, 7.041630e-001, 7.048757e-001, 7.055862e-001, 7.062966e-001, 7.070054e-001, 7.077113e-001, 7.084172e-001, 7.091222e-001,
+7.098223e-001, 7.105225e-001, 7.112227e-001, 7.119165e-001, 7.126099e-001, 7.133032e-001, 7.139922e-001, 7.146791e-001, 7.153660e-001, 7.160516e-001,
+7.167350e-001, 7.174183e-001, 7.181012e-001, 7.187789e-001, 7.194565e-001, 7.201342e-001, 7.208059e-001, 7.214756e-001, 7.221454e-001, 7.228132e-001,
+7.234779e-001, 7.241426e-001, 7.248072e-001, 7.254648e-001, 7.261223e-001, 7.267798e-001, 7.274342e-001, 7.280862e-001, 7.287383e-001, 7.293899e-001,
+7.300383e-001, 7.306867e-001, 7.313351e-001, 7.319790e-001, 7.326203e-001, 7.332617e-001, 7.339024e-001, 7.345391e-001, 7.351757e-001, 7.358123e-001,
+7.364459e-001, 7.370774e-001, 7.377090e-001, 7.383405e-001, 7.389687e-001, 7.395969e-001, 7.402252e-001, 7.408527e-001, 7.414793e-001, 7.421059e-001,
+7.427326e-001, 7.433542e-001, 7.439746e-001, 7.445951e-001, 7.452148e-001, 7.458308e-001, 7.464468e-001, 7.470628e-001, 7.476774e-001, 7.482906e-001,
+7.489038e-001, 7.495170e-001, 7.501247e-001, 7.507307e-001, 7.513366e-001, 7.519425e-001, 7.525429e-001, 7.531433e-001, 7.537437e-001, 7.543431e-001,
+7.549396e-001, 7.555360e-001, 7.561325e-001, 7.567270e-001, 7.573188e-001, 7.579106e-001, 7.585025e-001, 7.590919e-001, 7.596798e-001, 7.602676e-001,
+7.608554e-001, 7.614399e-001, 7.620230e-001, 7.626061e-001, 7.631892e-001, 7.637679e-001, 7.643456e-001, 7.649233e-001, 7.655010e-001, 7.660745e-001,
+7.666474e-001, 7.672202e-001, 7.677931e-001, 7.683627e-001, 7.689320e-001, 7.695012e-001, 7.700705e-001, 7.706354e-001, 7.711998e-001, 7.717642e-001,
+7.723286e-001, 7.728883e-001, 7.734474e-001, 7.740064e-001, 7.745654e-001, 7.751224e-001, 7.756788e-001, 7.762353e-001, 7.767917e-001, 7.773453e-001,
+7.778975e-001, 7.784497e-001, 7.790020e-001, 7.795510e-001, 7.800974e-001, 7.806438e-001, 7.811902e-001, 7.817354e-001, 7.822787e-001, 7.828220e-001,
+7.833654e-001, 7.839079e-001, 7.844465e-001, 7.849851e-001, 7.855238e-001, 7.860624e-001, 7.865952e-001, 7.871276e-001, 7.876599e-001, 7.881923e-001,
+7.887223e-001, 7.892511e-001, 7.897799e-001, 7.903087e-001, 7.908357e-001, 7.913593e-001, 7.918830e-001, 7.924066e-001, 7.929303e-001, 7.934506e-001,
+7.939709e-001, 7.944912e-001, 7.950115e-001, 7.955308e-001, 7.960495e-001, 7.965682e-001, 7.970869e-001, 7.976048e-001, 7.981192e-001, 7.986336e-001,
+7.991481e-001, 7.996625e-001, 8.001754e-001, 8.006877e-001, 8.012001e-001, 8.017124e-001, 8.022243e-001, 8.027346e-001, 8.032449e-001, 8.037553e-001,
+8.042656e-001, 8.047727e-001, 8.052784e-001, 8.057842e-001, 8.062899e-001, 8.067953e-001, 8.072986e-001, 8.078019e-001, 8.083051e-001, 8.088084e-001,
+8.093104e-001, 8.098113e-001, 8.103123e-001, 8.108132e-001, 8.113141e-001, 8.118107e-001, 8.123067e-001, 8.128027e-001, 8.132987e-001, 8.137941e-001,
+8.142873e-001, 8.147806e-001, 8.152738e-001, 8.157670e-001, 8.162589e-001, 8.167495e-001, 8.172400e-001, 8.177305e-001, 8.182211e-001, 8.187079e-001,
+8.191933e-001, 8.196786e-001, 8.201640e-001, 8.206493e-001, 8.211319e-001, 8.216142e-001, 8.220965e-001, 8.225788e-001, 8.230608e-001, 8.235401e-001,
+8.240195e-001, 8.244988e-001, 8.249781e-001, 8.254567e-001, 8.259321e-001, 8.264076e-001, 8.268830e-001, 8.273585e-001, 8.278334e-001, 8.283066e-001,
+8.287798e-001, 8.292530e-001, 8.297263e-001, 8.301985e-001, 8.306686e-001, 8.311387e-001, 8.316087e-001, 8.320788e-001, 8.325484e-001, 8.330169e-001,
+8.334854e-001, 8.339539e-001, 8.344224e-001, 8.348909e-001, 8.353595e-001, 8.358281e-001, 8.362966e-001, 8.367652e-001, 8.372332e-001, 8.376984e-001,
+8.381635e-001, 8.386287e-001, 8.390939e-001, 8.395590e-001, 8.400223e-001, 8.404857e-001, 8.409490e-001, 8.414124e-001, 8.418757e-001, 8.423389e-001,
+8.428020e-001, 8.432652e-001, 8.437283e-001, 8.441914e-001, 8.446522e-001, 8.451117e-001, 8.455712e-001, 8.460308e-001, 8.464903e-001, 8.469490e-001,
+8.474064e-001, 8.478639e-001, 8.483214e-001, 8.487788e-001, 8.492362e-001, 8.496933e-001, 8.501503e-001, 8.506073e-001, 8.510643e-001, 8.515213e-001,
+8.519754e-001, 8.524286e-001, 8.528818e-001, 8.533350e-001, 8.537882e-001, 8.542406e-001, 8.546915e-001, 8.551425e-001, 8.555934e-001, 8.560443e-001,
+8.564953e-001, 8.569456e-001, 8.573959e-001, 8.578462e-001, 8.582964e-001, 8.587467e-001, 8.591952e-001, 8.596415e-001, 8.600878e-001, 8.605341e-001,
+8.609803e-001, 8.614266e-001, 8.618707e-001, 8.623146e-001, 8.627585e-001, 8.632023e-001, 8.636462e-001, 8.640898e-001, 8.645328e-001, 8.649758e-001,
+8.654188e-001, 8.658618e-001, 8.663048e-001, 8.667447e-001, 8.671836e-001, 8.676225e-001, 8.680614e-001, 8.685002e-001, 8.689389e-001, 8.693752e-001,
+8.698115e-001, 8.702478e-001, 8.706841e-001, 8.711204e-001, 8.715563e-001, 8.719915e-001, 8.724268e-001, 8.728620e-001, 8.732972e-001, 8.737324e-001,
+8.741656e-001, 8.745974e-001, 8.750292e-001, 8.754611e-001, 8.758929e-001, 8.763247e-001, 8.767553e-001, 8.771856e-001, 8.776159e-001, 8.780462e-001,
+8.784765e-001, 8.789068e-001, 8.793358e-001, 8.797646e-001, 8.801935e-001, 8.806224e-001, 8.810513e-001, 8.814800e-001, 8.819061e-001, 8.823322e-001,
+8.827583e-001, 8.831844e-001, 8.836104e-001, 8.840365e-001, 8.844620e-001, 8.848875e-001, 8.853129e-001, 8.857384e-001, 8.861639e-001, 8.865892e-001,
+8.870129e-001, 8.874365e-001, 8.878602e-001, 8.882838e-001, 8.887075e-001, 8.891310e-001, 8.895515e-001, 8.899719e-001, 8.903924e-001, 8.908129e-001,
+8.912333e-001, 8.916538e-001, 8.920733e-001, 8.924927e-001, 8.929122e-001, 8.933316e-001, 8.937511e-001, 8.941705e-001, 8.945882e-001, 8.950055e-001,
+8.954227e-001, 8.958399e-001, 8.962571e-001, 8.966744e-001, 8.970903e-001, 8.975053e-001, 8.979204e-001, 8.983354e-001, 8.987504e-001, 8.991655e-001,
+8.995803e-001, 8.999949e-001, 9.004095e-001, 9.008241e-001, 9.012387e-001, 9.016533e-001, 9.020678e-001, 9.024799e-001, 9.028919e-001, 9.033040e-001,
+9.037161e-001, 9.041282e-001, 9.045402e-001, 9.049507e-001, 9.053602e-001, 9.057698e-001, 9.061794e-001, 9.065890e-001, 9.069986e-001, 9.074080e-001,
+9.078168e-001, 9.082257e-001, 9.086345e-001, 9.090433e-001, 9.094522e-001, 9.098610e-001, 9.102689e-001, 9.106766e-001, 9.110843e-001, 9.114920e-001,
+9.118997e-001, 9.123074e-001, 9.127150e-001, 9.131223e-001, 9.135296e-001, 9.139369e-001, 9.143442e-001, 9.147515e-001, 9.151587e-001, 9.155652e-001,
+9.159712e-001, 9.163772e-001, 9.167832e-001, 9.171893e-001, 9.175953e-001, 9.180012e-001, 9.184056e-001, 9.188100e-001, 9.192144e-001, 9.196188e-001,
+9.200232e-001, 9.204276e-001, 9.208316e-001, 9.212351e-001, 9.216386e-001, 9.220421e-001, 9.224455e-001, 9.228490e-001, 9.232525e-001, 9.236548e-001,
+9.240566e-001, 9.244583e-001, 9.248600e-001, 9.252617e-001, 9.256634e-001, 9.260651e-001, 9.264651e-001, 9.268647e-001, 9.272643e-001, 9.276639e-001,
+9.280635e-001, 9.284631e-001, 9.288626e-001, 9.292608e-001, 9.296590e-001, 9.300572e-001, 9.304554e-001, 9.308536e-001, 9.312518e-001, 9.316499e-001,
+9.320475e-001, 9.324450e-001, 9.328426e-001, 9.332401e-001, 9.336376e-001, 9.340352e-001, 9.344327e-001, 9.348299e-001, 9.352270e-001, 9.356242e-001,
+9.360214e-001, 9.364186e-001, 9.368158e-001, 9.372128e-001, 9.376080e-001, 9.380033e-001, 9.383986e-001, 9.387938e-001, 9.391891e-001, 9.395844e-001,
+9.399795e-001, 9.403715e-001, 9.407636e-001, 9.411556e-001, 9.415476e-001, 9.419396e-001, 9.423317e-001, 9.427237e-001, 9.431132e-001, 9.435023e-001,
+9.438915e-001, 9.442806e-001, 9.446698e-001, 9.450589e-001, 9.454481e-001, 9.458365e-001, 9.462246e-001, 9.466127e-001, 9.470008e-001, 9.473889e-001,
+9.477770e-001, 9.481651e-001, 9.485528e-001, 9.489400e-001, 9.493272e-001, 9.497145e-001, 9.501017e-001, 9.504889e-001, 9.508761e-001, 9.512630e-001,
+9.516480e-001, 9.520330e-001, 9.524180e-001, 9.528030e-001, 9.531880e-001, 9.535730e-001, 9.539579e-001, 9.543419e-001, 9.547254e-001, 9.551090e-001,
+9.554926e-001, 9.558761e-001, 9.562597e-001, 9.566433e-001, 9.570264e-001, 9.574085e-001, 9.577906e-001, 9.581727e-001, 9.585548e-001, 9.589369e-001,
+9.593191e-001, 9.597012e-001, 9.600812e-001, 9.604608e-001, 9.608403e-001, 9.612198e-001, 9.615994e-001, 9.619789e-001, 9.623584e-001, 9.627375e-001,
+9.631150e-001, 9.634925e-001, 9.638700e-001, 9.642475e-001, 9.646250e-001, 9.650025e-001, 9.653799e-001, 9.657560e-001, 9.661311e-001, 9.665063e-001,
+9.668814e-001, 9.672565e-001, 9.676317e-001, 9.680068e-001, 9.683819e-001, 9.687543e-001, 9.691264e-001, 9.694986e-001, 9.698707e-001, 9.702428e-001,
+9.706150e-001, 9.709871e-001, 9.713588e-001, 9.717281e-001, 9.720974e-001, 9.724667e-001, 9.728360e-001, 9.732053e-001, 9.735747e-001, 9.739440e-001,
+9.743121e-001, 9.746780e-001, 9.750439e-001, 9.754099e-001, 9.757758e-001, 9.761417e-001, 9.765076e-001, 9.768735e-001, 9.772381e-001, 9.776011e-001,
+9.779641e-001, 9.783271e-001, 9.786900e-001, 9.790530e-001, 9.794160e-001, 9.797790e-001, 9.801405e-001, 9.805006e-001, 9.808607e-001, 9.812209e-001,
+9.815810e-001, 9.819411e-001, 9.823012e-001, 9.826613e-001, 9.830198e-001, 9.833767e-001, 9.837337e-001, 9.840906e-001, 9.844475e-001, 9.848044e-001,
+9.851613e-001, 9.855182e-001, 9.858740e-001, 9.862282e-001, 9.865824e-001, 9.869366e-001, 9.872907e-001, 9.876449e-001, 9.879991e-001, 9.883533e-001,
+9.887064e-001, 9.890566e-001, 9.894067e-001, 9.897569e-001, 9.901071e-001, 9.904573e-001, 9.908074e-001, 9.911576e-001, 9.915076e-001, 9.918552e-001,
+9.922027e-001, 9.925502e-001, 9.928978e-001, 9.932453e-001, 9.935928e-001, 9.939404e-001, 9.942879e-001, 9.946307e-001, 9.949722e-001, 9.953136e-001,
+9.956551e-001, 9.959966e-001, 9.963380e-001, 9.966795e-001, 9.970210e-001, 9.973577e-001, 9.976880e-001, 9.980183e-001, 9.983486e-001, 9.986789e-001,
+9.990091e-001, 9.993394e-001, 9.996697e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Futura 400", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.898043e-002, 3.341783e-002, 4.547683e-002, 5.626018e-002, 6.620306e-002, 7.556580e-002, 8.449664e-002, 9.308580e-002, 1.014241e-001,
+1.095661e-001, 1.175451e-001, 1.253250e-001, 1.328340e-001, 1.399984e-001, 1.468110e-001, 1.533182e-001, 1.595372e-001, 1.655109e-001, 1.712646e-001,
+1.768249e-001, 1.822118e-001, 1.874232e-001, 1.924865e-001, 1.974117e-001, 2.021996e-001, 2.068602e-001, 2.114142e-001, 2.158669e-001, 2.202159e-001,
+2.244572e-001, 2.285913e-001, 2.326337e-001, 2.366017e-001, 2.405178e-001, 2.443760e-001, 2.481773e-001, 2.519231e-001, 2.556205e-001, 2.592709e-001,
+2.628699e-001, 2.664136e-001, 2.698990e-001, 2.733238e-001, 2.766858e-001, 2.799930e-001, 2.832501e-001, 2.864542e-001, 2.896078e-001, 2.927065e-001,
+2.957525e-001, 2.987527e-001, 3.017116e-001, 3.046319e-001, 3.075190e-001, 3.103762e-001, 3.132067e-001, 3.160126e-001, 3.187976e-001, 3.215645e-001,
+3.243157e-001, 3.270539e-001, 3.297814e-001, 3.325004e-001, 3.352132e-001, 3.379162e-001, 3.405977e-001, 3.432567e-001, 3.458822e-001, 3.484756e-001,
+3.510380e-001, 3.535714e-001, 3.560792e-001, 3.585632e-001, 3.610231e-001, 3.634632e-001, 3.658836e-001, 3.682858e-001, 3.706724e-001, 3.730427e-001,
+3.754004e-001, 3.777440e-001, 3.800773e-001, 3.823992e-001, 3.847126e-001, 3.870174e-001, 3.893153e-001, 3.916072e-001, 3.938936e-001, 3.961761e-001,
+3.984551e-001, 4.007292e-001, 4.029959e-001, 4.052544e-001, 4.075043e-001, 4.097426e-001, 4.119692e-001, 4.141839e-001, 4.163868e-001, 4.185790e-001,
+4.207612e-001, 4.229308e-001, 4.250904e-001, 4.272392e-001, 4.293778e-001, 4.315068e-001, 4.336227e-001, 4.357246e-001, 4.378121e-001, 4.398863e-001,
+4.419437e-001, 4.439850e-001, 4.460109e-001, 4.480218e-001, 4.500185e-001, 4.520016e-001, 4.539716e-001, 4.559291e-001, 4.578746e-001, 4.598088e-001,
+4.617321e-001, 4.636450e-001, 4.655455e-001, 4.674327e-001, 4.693085e-001, 4.711722e-001, 4.730256e-001, 4.748683e-001, 4.766997e-001, 4.785183e-001,
+4.803260e-001, 4.821228e-001, 4.839097e-001, 4.856867e-001, 4.874519e-001, 4.892069e-001, 4.909515e-001, 4.926868e-001, 4.944102e-001, 4.961232e-001,
+4.978268e-001, 4.995206e-001, 5.012041e-001, 5.028778e-001, 5.045427e-001, 5.061982e-001, 5.078454e-001, 5.094836e-001, 5.111127e-001, 5.127327e-001,
+5.143399e-001, 5.159364e-001, 5.175242e-001, 5.191027e-001, 5.206708e-001, 5.222259e-001, 5.237668e-001, 5.252965e-001, 5.268158e-001, 5.283230e-001,
+5.298195e-001, 5.313064e-001, 5.327834e-001, 5.342487e-001, 5.357008e-001, 5.371451e-001, 5.385818e-001, 5.400090e-001, 5.414276e-001, 5.428384e-001,
+5.442407e-001, 5.456291e-001, 5.470102e-001, 5.483845e-001, 5.497499e-001, 5.511074e-001, 5.524583e-001, 5.538002e-001, 5.551335e-001, 5.564608e-001,
+5.577800e-001, 5.590916e-001, 5.603980e-001, 5.616976e-001, 5.629880e-001, 5.642736e-001, 5.655526e-001, 5.668238e-001, 5.680910e-001, 5.693522e-001,
+5.706079e-001, 5.718599e-001, 5.731037e-001, 5.743419e-001, 5.755750e-001, 5.768012e-001, 5.780242e-001, 5.792414e-001, 5.804504e-001, 5.816553e-001,
+5.828510e-001, 5.840438e-001, 5.852320e-001, 5.864149e-001, 5.875951e-001, 5.887642e-001, 5.899303e-001, 5.910912e-001, 5.922474e-001, 5.934010e-001,
+5.945464e-001, 5.956893e-001, 5.968241e-001, 5.979556e-001, 5.990828e-001, 6.002064e-001, 6.013283e-001, 6.024429e-001, 6.035555e-001, 6.046581e-001,
+6.057583e-001, 6.068523e-001, 6.079434e-001, 6.090310e-001, 6.101150e-001, 6.111966e-001, 6.122708e-001, 6.133425e-001, 6.144059e-001, 6.154682e-001,
+6.165215e-001, 6.175739e-001, 6.186175e-001, 6.196598e-001, 6.206961e-001, 6.217305e-001, 6.227589e-001, 6.237845e-001, 6.248035e-001, 6.258192e-001,
+6.268282e-001, 6.278347e-001, 6.288362e-001, 6.298360e-001, 6.308324e-001, 6.318263e-001, 6.328150e-001, 6.338009e-001, 6.347797e-001, 6.357567e-001,
+6.367280e-001, 6.376979e-001, 6.386622e-001, 6.396257e-001, 6.405827e-001, 6.415396e-001, 6.424886e-001, 6.434377e-001, 6.443789e-001, 6.453190e-001,
+6.462523e-001, 6.471832e-001, 6.481101e-001, 6.490341e-001, 6.499557e-001, 6.508738e-001, 6.517899e-001, 6.526990e-001, 6.536079e-001, 6.545088e-001,
+6.554096e-001, 6.563046e-001, 6.571980e-001, 6.580873e-001, 6.589732e-001, 6.598568e-001, 6.607351e-001, 6.616132e-001, 6.624846e-001, 6.633559e-001,
+6.642241e-001, 6.650910e-001, 6.659564e-001, 6.668195e-001, 6.676823e-001, 6.685386e-001, 6.693950e-001, 6.702474e-001, 6.710978e-001, 6.719467e-001,
+6.727919e-001, 6.736372e-001, 6.744776e-001, 6.753175e-001, 6.761548e-001, 6.769894e-001, 6.778236e-001, 6.786518e-001, 6.794800e-001, 6.803044e-001,
+6.811261e-001, 6.819474e-001, 6.827652e-001, 6.835830e-001, 6.843972e-001, 6.852093e-001, 6.860206e-001, 6.868253e-001, 6.876300e-001, 6.884320e-001,
+6.892318e-001, 6.900315e-001, 6.908273e-001, 6.916230e-001, 6.924161e-001, 6.932054e-001, 6.939946e-001, 6.947794e-001, 6.955630e-001, 6.963458e-001,
+6.971247e-001, 6.979035e-001, 6.986787e-001, 6.994505e-001, 7.002223e-001, 7.009886e-001, 7.017541e-001, 7.025186e-001, 7.032787e-001, 7.040387e-001,
+7.047964e-001, 7.055511e-001, 7.063059e-001, 7.070568e-001, 7.078062e-001, 7.085557e-001, 7.092994e-001, 7.100430e-001, 7.107855e-001, 7.115232e-001,
+7.122610e-001, 7.129975e-001, 7.137318e-001, 7.144662e-001, 7.151980e-001, 7.159276e-001, 7.166573e-001, 7.173828e-001, 7.181064e-001, 7.188300e-001,
+7.195505e-001, 7.202704e-001, 7.209903e-001, 7.217057e-001, 7.224206e-001, 7.231355e-001, 7.238442e-001, 7.245527e-001, 7.252612e-001, 7.259657e-001,
+7.266703e-001, 7.273745e-001, 7.280739e-001, 7.287733e-001, 7.294721e-001, 7.301635e-001, 7.308549e-001, 7.315460e-001, 7.322311e-001, 7.329163e-001,
+7.336013e-001, 7.342812e-001, 7.349610e-001, 7.356408e-001, 7.363131e-001, 7.369849e-001, 7.376567e-001, 7.383231e-001, 7.389885e-001, 7.396538e-001,
+7.403154e-001, 7.409754e-001, 7.416354e-001, 7.422909e-001, 7.429429e-001, 7.435948e-001, 7.442438e-001, 7.448878e-001, 7.455319e-001, 7.461751e-001,
+7.468138e-001, 7.474525e-001, 7.480912e-001, 7.487259e-001, 7.493604e-001, 7.499949e-001, 7.506252e-001, 7.512538e-001, 7.518823e-001, 7.525088e-001,
+7.531324e-001, 7.537561e-001, 7.543793e-001, 7.549992e-001, 7.556190e-001, 7.562389e-001, 7.568545e-001, 7.574689e-001, 7.580833e-001, 7.586959e-001,
+7.593058e-001, 7.599158e-001, 7.605257e-001, 7.611323e-001, 7.617388e-001, 7.623454e-001, 7.629490e-001, 7.635506e-001, 7.641521e-001, 7.647531e-001,
+7.653507e-001, 7.659482e-001, 7.665458e-001, 7.671413e-001, 7.677359e-001, 7.683304e-001, 7.689243e-001, 7.695142e-001, 7.701042e-001, 7.706942e-001,
+7.712819e-001, 7.718682e-001, 7.724546e-001, 7.730408e-001, 7.736245e-001, 7.742082e-001, 7.747919e-001, 7.753731e-001, 7.759514e-001, 7.765296e-001,
+7.771079e-001, 7.776819e-001, 7.782551e-001, 7.788282e-001, 7.794010e-001, 7.799721e-001, 7.805431e-001, 7.811141e-001, 7.816828e-001, 7.822489e-001,
+7.828150e-001, 7.833812e-001, 7.839429e-001, 7.845032e-001, 7.850636e-001, 7.856239e-001, 7.861808e-001, 7.867378e-001, 7.872947e-001, 7.878506e-001,
+7.884033e-001, 7.889561e-001, 7.895088e-001, 7.900593e-001, 7.906070e-001, 7.911547e-001, 7.917025e-001, 7.922485e-001, 7.927935e-001, 7.933384e-001,
+7.938834e-001, 7.944258e-001, 7.949672e-001, 7.955087e-001, 7.960501e-001, 7.965880e-001, 7.971251e-001, 7.976623e-001, 7.981994e-001, 7.987347e-001,
+7.992697e-001, 7.998047e-001, 8.003398e-001, 8.008722e-001, 8.014043e-001, 8.019365e-001, 8.024686e-001, 8.029965e-001, 8.035239e-001, 8.040512e-001,
+8.045786e-001, 8.051033e-001, 8.056275e-001, 8.061518e-001, 8.066760e-001, 8.071986e-001, 8.077207e-001, 8.082428e-001, 8.087649e-001, 8.092843e-001,
+8.098025e-001, 8.103206e-001, 8.108388e-001, 8.113550e-001, 8.118696e-001, 8.123842e-001, 8.128988e-001, 8.134122e-001, 8.139238e-001, 8.144353e-001,
+8.149468e-001, 8.154575e-001, 8.159641e-001, 8.164708e-001, 8.169775e-001, 8.174842e-001, 8.179872e-001, 8.184900e-001, 8.189928e-001, 8.194957e-001,
+8.199970e-001, 8.204975e-001, 8.209980e-001, 8.214986e-001, 8.219977e-001, 8.224941e-001, 8.229906e-001, 8.234871e-001, 8.239835e-001, 8.244759e-001,
+8.249682e-001, 8.254605e-001, 8.259529e-001, 8.264433e-001, 8.269325e-001, 8.274217e-001, 8.279109e-001, 8.283994e-001, 8.288855e-001, 8.293715e-001,
+8.298576e-001, 8.303436e-001, 8.308259e-001, 8.313069e-001, 8.317879e-001, 8.322690e-001, 8.327488e-001, 8.332253e-001, 8.337018e-001, 8.341782e-001,
+8.346547e-001, 8.351282e-001, 8.356007e-001, 8.360731e-001, 8.365455e-001, 8.370173e-001, 8.374856e-001, 8.379540e-001, 8.384223e-001, 8.388906e-001,
+8.393570e-001, 8.398216e-001, 8.402863e-001, 8.407510e-001, 8.412157e-001, 8.416776e-001, 8.421391e-001, 8.426007e-001, 8.430622e-001, 8.435231e-001,
+8.439814e-001, 8.444397e-001, 8.448980e-001, 8.453563e-001, 8.458128e-001, 8.462673e-001, 8.467219e-001, 8.471764e-001, 8.476309e-001, 8.480827e-001,
+8.485334e-001, 8.489841e-001, 8.494348e-001, 8.498855e-001, 8.503341e-001, 8.507825e-001, 8.512310e-001, 8.516794e-001, 8.521276e-001, 8.525733e-001,
+8.530189e-001, 8.534645e-001, 8.539102e-001, 8.543550e-001, 8.547968e-001, 8.552385e-001, 8.556803e-001, 8.561220e-001, 8.565630e-001, 8.570019e-001,
+8.574408e-001, 8.578798e-001, 8.583187e-001, 8.587571e-001, 8.591943e-001, 8.596315e-001, 8.600687e-001, 8.605059e-001, 8.609419e-001, 8.613753e-001,
+8.618087e-001, 8.622421e-001, 8.626756e-001, 8.631077e-001, 8.635363e-001, 8.639649e-001, 8.643936e-001, 8.648222e-001, 8.652505e-001, 8.656775e-001,
+8.661045e-001, 8.665314e-001, 8.669584e-001, 8.673852e-001, 8.678095e-001, 8.682337e-001, 8.686580e-001, 8.690822e-001, 8.695065e-001, 8.699274e-001,
+8.703480e-001, 8.707685e-001, 8.711890e-001, 8.716096e-001, 8.720286e-001, 8.724469e-001, 8.728652e-001, 8.732835e-001, 8.737017e-001, 8.741189e-001,
+8.745344e-001, 8.749499e-001, 8.753654e-001, 8.757809e-001, 8.761960e-001, 8.766077e-001, 8.770195e-001, 8.774313e-001, 8.778430e-001, 8.782548e-001,
+8.786644e-001, 8.790734e-001, 8.794824e-001, 8.798914e-001, 8.803004e-001, 8.807088e-001, 8.811160e-001, 8.815233e-001, 8.819305e-001, 8.823377e-001,
+8.827450e-001, 8.831488e-001, 8.835524e-001, 8.839560e-001, 8.843595e-001, 8.847631e-001, 8.851653e-001, 8.855657e-001, 8.859662e-001, 8.863667e-001,
+8.867671e-001, 8.871676e-001, 8.875674e-001, 8.879672e-001, 8.883670e-001, 8.887669e-001, 8.891667e-001, 8.895655e-001, 8.899628e-001, 8.903600e-001,
+8.907573e-001, 8.911546e-001, 8.915518e-001, 8.919458e-001, 8.923386e-001, 8.927314e-001, 8.931243e-001, 8.935171e-001, 8.939098e-001, 8.943006e-001,
+8.946915e-001, 8.950823e-001, 8.954732e-001, 8.958641e-001, 8.962544e-001, 8.966438e-001, 8.970331e-001, 8.974225e-001, 8.978119e-001, 8.982013e-001,
+8.985881e-001, 8.989733e-001, 8.993585e-001, 8.997437e-001, 9.001290e-001, 9.005142e-001, 9.008964e-001, 9.012779e-001, 9.016594e-001, 9.020409e-001,
+9.024224e-001, 9.028040e-001, 9.031842e-001, 9.035644e-001, 9.039446e-001, 9.043249e-001, 9.047051e-001, 9.050851e-001, 9.054622e-001, 9.058393e-001,
+9.062164e-001, 9.065935e-001, 9.069706e-001, 9.073474e-001, 9.077210e-001, 9.080946e-001, 9.084683e-001, 9.088419e-001, 9.092155e-001, 9.095890e-001,
+9.099610e-001, 9.103330e-001, 9.107051e-001, 9.110771e-001, 9.114491e-001, 9.118210e-001, 9.121911e-001, 9.125612e-001, 9.129313e-001, 9.133014e-001,
+9.136715e-001, 9.140416e-001, 9.144074e-001, 9.147729e-001, 9.151384e-001, 9.155040e-001, 9.158695e-001, 9.162351e-001, 9.165985e-001, 9.169613e-001,
+9.173242e-001, 9.176871e-001, 9.180499e-001, 9.184128e-001, 9.187752e-001, 9.191373e-001, 9.194993e-001, 9.198614e-001, 9.202234e-001, 9.205855e-001,
+9.209464e-001, 9.213050e-001, 9.216637e-001, 9.220224e-001, 9.223810e-001, 9.227397e-001, 9.230982e-001, 9.234531e-001, 9.238080e-001, 9.241629e-001,
+9.245178e-001, 9.248726e-001, 9.252275e-001, 9.255811e-001, 9.259340e-001, 9.262869e-001, 9.266399e-001, 9.269928e-001, 9.273457e-001, 9.276981e-001,
+9.280487e-001, 9.283994e-001, 9.287500e-001, 9.291007e-001, 9.294514e-001, 9.298020e-001, 9.301500e-001, 9.304972e-001, 9.308444e-001, 9.311916e-001,
+9.315388e-001, 9.318860e-001, 9.322327e-001, 9.325779e-001, 9.329230e-001, 9.332682e-001, 9.336133e-001, 9.339585e-001, 9.343037e-001, 9.346481e-001,
+9.349921e-001, 9.353362e-001, 9.356803e-001, 9.360243e-001, 9.363684e-001, 9.367122e-001, 9.370527e-001, 9.373932e-001, 9.377337e-001, 9.380742e-001,
+9.384147e-001, 9.387552e-001, 9.390947e-001, 9.394326e-001, 9.397705e-001, 9.401084e-001, 9.404463e-001, 9.407843e-001, 9.411222e-001, 9.414593e-001,
+9.417959e-001, 9.421326e-001, 9.424693e-001, 9.428059e-001, 9.431426e-001, 9.434793e-001, 9.438139e-001, 9.441482e-001, 9.444825e-001, 9.448167e-001,
+9.451510e-001, 9.454853e-001, 9.458196e-001, 9.461503e-001, 9.464811e-001, 9.468119e-001, 9.471427e-001, 9.474734e-001, 9.478042e-001, 9.481347e-001,
+9.484633e-001, 9.487919e-001, 9.491205e-001, 9.494491e-001, 9.497776e-001, 9.501062e-001, 9.504346e-001, 9.507620e-001, 9.510893e-001, 9.514167e-001,
+9.517440e-001, 9.520713e-001, 9.523987e-001, 9.527256e-001, 9.530493e-001, 9.533731e-001, 9.536968e-001, 9.540205e-001, 9.543443e-001, 9.546680e-001,
+9.549915e-001, 9.553105e-001, 9.556294e-001, 9.559483e-001, 9.562672e-001, 9.565861e-001, 9.569051e-001, 9.572240e-001, 9.575373e-001, 9.578501e-001,
+9.581628e-001, 9.584755e-001, 9.587882e-001, 9.591010e-001, 9.594137e-001, 9.597231e-001, 9.600311e-001, 9.603391e-001, 9.606471e-001, 9.609551e-001,
+9.612631e-001, 9.615712e-001, 9.618783e-001, 9.621844e-001, 9.624905e-001, 9.627966e-001, 9.631027e-001, 9.634088e-001, 9.637149e-001, 9.640208e-001,
+9.643251e-001, 9.646294e-001, 9.649337e-001, 9.652380e-001, 9.655423e-001, 9.658466e-001, 9.661509e-001, 9.664529e-001, 9.667542e-001, 9.670554e-001,
+9.673567e-001, 9.676579e-001, 9.679592e-001, 9.682604e-001, 9.685607e-001, 9.688588e-001, 9.691568e-001, 9.694549e-001, 9.697530e-001, 9.700510e-001,
+9.703491e-001, 9.706472e-001, 9.709430e-001, 9.712384e-001, 9.715337e-001, 9.718290e-001, 9.721244e-001, 9.724197e-001, 9.727150e-001, 9.730096e-001,
+9.733016e-001, 9.735936e-001, 9.738856e-001, 9.741776e-001, 9.744696e-001, 9.747616e-001, 9.750537e-001, 9.753432e-001, 9.756311e-001, 9.759190e-001,
+9.762069e-001, 9.764948e-001, 9.767828e-001, 9.770707e-001, 9.773586e-001, 9.776432e-001, 9.779276e-001, 9.782119e-001, 9.784963e-001, 9.787806e-001,
+9.790650e-001, 9.793493e-001, 9.796330e-001, 9.799133e-001, 9.801936e-001, 9.804739e-001, 9.807542e-001, 9.810346e-001, 9.813149e-001, 9.815952e-001,
+9.818738e-001, 9.821494e-001, 9.824249e-001, 9.827005e-001, 9.829761e-001, 9.832516e-001, 9.835272e-001, 9.838028e-001, 9.840760e-001, 9.843467e-001,
+9.846174e-001, 9.848881e-001, 9.851588e-001, 9.854295e-001, 9.857002e-001, 9.859709e-001, 9.862386e-001, 9.865036e-001, 9.867686e-001, 9.870337e-001,
+9.872987e-001, 9.875637e-001, 9.878287e-001, 9.880937e-001, 9.883553e-001, 9.886137e-001, 9.888721e-001, 9.891305e-001, 9.893889e-001, 9.896472e-001,
+9.899056e-001, 9.901640e-001, 9.904199e-001, 9.906726e-001, 9.909252e-001, 9.911778e-001, 9.914304e-001, 9.916830e-001, 9.919356e-001, 9.921882e-001,
+9.924387e-001, 9.926838e-001, 9.929288e-001, 9.931739e-001, 9.934190e-001, 9.936640e-001, 9.939091e-001, 9.941541e-001, 9.943985e-001, 9.946328e-001,
+9.948671e-001, 9.951014e-001, 9.953357e-001, 9.955700e-001, 9.958043e-001, 9.960386e-001, 9.962729e-001, 9.964994e-001, 9.967237e-001, 9.969479e-001,
+9.971722e-001, 9.973964e-001, 9.976207e-001, 9.978449e-001, 9.980692e-001, 9.982891e-001, 9.985029e-001, 9.987168e-001, 9.989307e-001, 9.991445e-001,
+9.993584e-001, 9.995723e-001, 9.997861e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.022033e-002, 3.510216e-002, 4.785493e-002, 5.928302e-002, 6.979681e-002, 7.966777e-002, 8.897487e-002, 9.781655e-002, 1.062682e-001,
+1.143971e-001, 1.221865e-001, 1.296441e-001, 1.367834e-001, 1.436240e-001, 1.502085e-001, 1.565481e-001, 1.626640e-001, 1.685764e-001, 1.742939e-001,
+1.798333e-001, 1.852240e-001, 1.904760e-001, 1.955907e-001, 2.005727e-001, 2.054261e-001, 2.101703e-001, 2.148003e-001, 2.193187e-001, 2.237484e-001,
+2.280993e-001, 2.323631e-001, 2.365343e-001, 2.406189e-001, 2.446301e-001, 2.485862e-001, 2.524933e-001, 2.563455e-001, 2.601292e-001, 2.638447e-001,
+2.674998e-001, 2.711038e-001, 2.746542e-001, 2.781483e-001, 2.815822e-001, 2.849548e-001, 2.882681e-001, 2.915302e-001, 2.947527e-001, 2.979423e-001,
+3.010992e-001, 3.042245e-001, 3.073200e-001, 3.103853e-001, 3.134222e-001, 3.164314e-001, 3.194135e-001, 3.223692e-001, 3.252984e-001, 3.282027e-001,
+3.310827e-001, 3.339388e-001, 3.367715e-001, 3.395748e-001, 3.423477e-001, 3.450842e-001, 3.477847e-001, 3.504518e-001, 3.530882e-001, 3.556962e-001,
+3.582765e-001, 3.608322e-001, 3.633659e-001, 3.658784e-001, 3.683710e-001, 3.708466e-001, 3.732995e-001, 3.757316e-001, 3.781447e-001, 3.805387e-001,
+3.829127e-001, 3.852662e-001, 3.876036e-001, 3.899244e-001, 3.922333e-001, 3.945315e-001, 3.968203e-001, 3.991019e-001, 4.013710e-001, 4.036258e-001,
+4.058660e-001, 4.080863e-001, 4.102860e-001, 4.124661e-001, 4.146255e-001, 4.167692e-001, 4.188988e-001, 4.210127e-001, 4.231150e-001, 4.252065e-001,
+4.272862e-001, 4.293535e-001, 4.314082e-001, 4.334529e-001, 4.354852e-001, 4.375068e-001, 4.395155e-001, 4.415122e-001, 4.434967e-001, 4.454724e-001,
+4.474395e-001, 4.493968e-001, 4.513400e-001, 4.532704e-001, 4.551894e-001, 4.570956e-001, 4.589888e-001, 4.608703e-001, 4.627414e-001, 4.646035e-001,
+4.664578e-001, 4.683054e-001, 4.701451e-001, 4.719766e-001, 4.737985e-001, 4.756115e-001, 4.774145e-001, 4.792072e-001, 4.809884e-001, 4.827585e-001,
+4.845188e-001, 4.862687e-001, 4.880078e-001, 4.897368e-001, 4.914573e-001, 4.931693e-001, 4.948728e-001, 4.965651e-001, 4.982515e-001, 4.999290e-001,
+5.015965e-001, 5.032546e-001, 5.049040e-001, 5.065457e-001, 5.081775e-001, 5.097963e-001, 5.114062e-001, 5.130059e-001, 5.145952e-001, 5.161757e-001,
+5.177452e-001, 5.193078e-001, 5.208639e-001, 5.224146e-001, 5.239610e-001, 5.254994e-001, 5.270284e-001, 5.285491e-001, 5.300624e-001, 5.315675e-001,
+5.330659e-001, 5.345565e-001, 5.360388e-001, 5.375119e-001, 5.389771e-001, 5.404357e-001, 5.418878e-001, 5.433311e-001, 5.447693e-001, 5.462032e-001,
+5.476329e-001, 5.490534e-001, 5.504672e-001, 5.518745e-001, 5.532733e-001, 5.546666e-001, 5.560551e-001, 5.574359e-001, 5.588095e-001, 5.601774e-001,
+5.615365e-001, 5.628885e-001, 5.642360e-001, 5.655778e-001, 5.669124e-001, 5.682426e-001, 5.695661e-001, 5.708815e-001, 5.721923e-001, 5.734962e-001,
+5.747933e-001, 5.760861e-001, 5.773721e-001, 5.786537e-001, 5.799306e-001, 5.811965e-001, 5.824582e-001, 5.837122e-001, 5.849607e-001, 5.862061e-001,
+5.874449e-001, 5.886800e-001, 5.899084e-001, 5.911297e-001, 5.923475e-001, 5.935558e-001, 5.947612e-001, 5.959598e-001, 5.971538e-001, 5.983447e-001,
+5.995286e-001, 6.007102e-001, 6.018840e-001, 6.030550e-001, 6.042217e-001, 6.053854e-001, 6.065472e-001, 6.077021e-001, 6.088552e-001, 6.099977e-001,
+6.111380e-001, 6.122714e-001, 6.134018e-001, 6.145281e-001, 6.156514e-001, 6.167726e-001, 6.178880e-001, 6.190009e-001, 6.201071e-001, 6.212120e-001,
+6.223102e-001, 6.234076e-001, 6.244967e-001, 6.255845e-001, 6.266639e-001, 6.277419e-001, 6.288138e-001, 6.298843e-001, 6.309510e-001, 6.320159e-001,
+6.330764e-001, 6.341345e-001, 6.351872e-001, 6.362372e-001, 6.372812e-001, 6.383233e-001, 6.393606e-001, 6.403964e-001, 6.414276e-001, 6.424568e-001,
+6.434782e-001, 6.444982e-001, 6.455101e-001, 6.465215e-001, 6.475261e-001, 6.485307e-001, 6.495286e-001, 6.505261e-001, 6.515173e-001, 6.525072e-001,
+6.534915e-001, 6.544733e-001, 6.554508e-001, 6.564248e-001, 6.573961e-001, 6.583627e-001, 6.593278e-001, 6.602864e-001, 6.612450e-001, 6.621980e-001,
+6.631508e-001, 6.640975e-001, 6.650423e-001, 6.659818e-001, 6.669162e-001, 6.678487e-001, 6.687750e-001, 6.697013e-001, 6.706204e-001, 6.715393e-001,
+6.724529e-001, 6.733640e-001, 6.742721e-001, 6.751748e-001, 6.760774e-001, 6.769708e-001, 6.778642e-001, 6.787514e-001, 6.796351e-001, 6.805169e-001,
+6.813933e-001, 6.822697e-001, 6.831405e-001, 6.840105e-001, 6.848769e-001, 6.857391e-001, 6.866012e-001, 6.874572e-001, 6.883132e-001, 6.891655e-001,
+6.900150e-001, 6.908641e-001, 6.917093e-001, 6.925546e-001, 6.933963e-001, 6.942355e-001, 6.950742e-001, 6.959054e-001, 6.967366e-001, 6.975648e-001,
+6.983902e-001, 6.992156e-001, 7.000363e-001, 7.008567e-001, 7.016751e-001, 7.024903e-001, 7.033056e-001, 7.041168e-001, 7.049267e-001, 7.057358e-001,
+7.065397e-001, 7.073435e-001, 7.081443e-001, 7.089419e-001, 7.097394e-001, 7.105318e-001, 7.113231e-001, 7.121134e-001, 7.128975e-001, 7.136816e-001,
+7.144627e-001, 7.152395e-001, 7.160162e-001, 7.167897e-001, 7.175615e-001, 7.183333e-001, 7.191014e-001, 7.198692e-001, 7.206360e-001, 7.213974e-001,
+7.221587e-001, 7.229182e-001, 7.236739e-001, 7.244296e-001, 7.251829e-001, 7.259338e-001, 7.266848e-001, 7.274303e-001, 7.281728e-001, 7.289154e-001,
+7.296514e-001, 7.303856e-001, 7.311198e-001, 7.318494e-001, 7.325784e-001, 7.333073e-001, 7.340301e-001, 7.347526e-001, 7.354750e-001, 7.361903e-001,
+7.369055e-001, 7.376206e-001, 7.383303e-001, 7.390400e-001, 7.397494e-001, 7.404523e-001, 7.411552e-001, 7.418580e-001, 7.425542e-001, 7.432504e-001,
+7.439466e-001, 7.446366e-001, 7.453264e-001, 7.460162e-001, 7.467001e-001, 7.473832e-001, 7.480663e-001, 7.487442e-001, 7.494208e-001, 7.500974e-001,
+7.507699e-001, 7.514403e-001, 7.521107e-001, 7.527777e-001, 7.534415e-001, 7.541054e-001, 7.547671e-001, 7.554246e-001, 7.560821e-001, 7.567387e-001,
+7.573903e-001, 7.580418e-001, 7.586934e-001, 7.593390e-001, 7.599841e-001, 7.606292e-001, 7.612702e-001, 7.619091e-001, 7.625480e-001, 7.631847e-001,
+7.638178e-001, 7.644509e-001, 7.650835e-001, 7.657103e-001, 7.663370e-001, 7.669637e-001, 7.675851e-001, 7.682044e-001, 7.688237e-001, 7.694403e-001,
+7.700520e-001, 7.706636e-001, 7.712753e-001, 7.718833e-001, 7.724912e-001, 7.730990e-001, 7.737038e-001, 7.743062e-001, 7.749085e-001, 7.755102e-001,
+7.761060e-001, 7.767019e-001, 7.772977e-001, 7.778911e-001, 7.784829e-001, 7.790748e-001, 7.796661e-001, 7.802532e-001, 7.808402e-001, 7.814273e-001,
+7.820111e-001, 7.825925e-001, 7.831739e-001, 7.837553e-001, 7.843334e-001, 7.849116e-001, 7.854898e-001, 7.860662e-001, 7.866403e-001, 7.872144e-001,
+7.877886e-001, 7.883578e-001, 7.889257e-001, 7.894937e-001, 7.900611e-001, 7.906247e-001, 7.911883e-001, 7.917519e-001, 7.923140e-001, 7.928744e-001,
+7.934348e-001, 7.939952e-001, 7.945517e-001, 7.951068e-001, 7.956620e-001, 7.962171e-001, 7.967675e-001, 7.973179e-001, 7.978683e-001, 7.984177e-001,
+7.989639e-001, 7.995100e-001, 8.000562e-001, 8.006006e-001, 8.011425e-001, 8.016845e-001, 8.022264e-001, 8.027655e-001, 8.033026e-001, 8.038396e-001,
+8.043767e-001, 8.049103e-001, 8.054424e-001, 8.059744e-001, 8.065065e-001, 8.070362e-001, 8.075652e-001, 8.080941e-001, 8.086231e-001, 8.091489e-001,
+8.096741e-001, 8.101993e-001, 8.107245e-001, 8.112463e-001, 8.117676e-001, 8.122890e-001, 8.128103e-001, 8.133283e-001, 8.138457e-001, 8.143632e-001,
+8.148807e-001, 8.153948e-001, 8.159083e-001, 8.164218e-001, 8.169354e-001, 8.174457e-001, 8.179552e-001, 8.184647e-001, 8.189741e-001, 8.194805e-001,
+8.199854e-001, 8.204902e-001, 8.209951e-001, 8.214984e-001, 8.220004e-001, 8.225024e-001, 8.230045e-001, 8.235050e-001, 8.240030e-001, 8.245010e-001,
+8.249989e-001, 8.254961e-001, 8.259889e-001, 8.264817e-001, 8.269745e-001, 8.274673e-001, 8.279569e-001, 8.284462e-001, 8.289356e-001, 8.294249e-001,
+8.299116e-001, 8.303968e-001, 8.308820e-001, 8.313672e-001, 8.318507e-001, 8.323307e-001, 8.328107e-001, 8.332907e-001, 8.337707e-001, 8.342466e-001,
+8.347225e-001, 8.351984e-001, 8.356743e-001, 8.361485e-001, 8.366215e-001, 8.370945e-001, 8.375675e-001, 8.380397e-001, 8.385076e-001, 8.389755e-001,
+8.394434e-001, 8.399114e-001, 8.403761e-001, 8.408395e-001, 8.413030e-001, 8.417664e-001, 8.422295e-001, 8.426914e-001, 8.431532e-001, 8.436151e-001,
+8.440769e-001, 8.445362e-001, 8.449943e-001, 8.454524e-001, 8.459105e-001, 8.463679e-001, 8.468207e-001, 8.472735e-001, 8.477263e-001, 8.481791e-001,
+8.486302e-001, 8.490795e-001, 8.495288e-001, 8.499781e-001, 8.504275e-001, 8.508748e-001, 8.513219e-001, 8.517690e-001, 8.522161e-001, 8.526622e-001,
+8.531039e-001, 8.535456e-001, 8.539873e-001, 8.544290e-001, 8.548687e-001, 8.553062e-001, 8.557437e-001, 8.561813e-001, 8.566188e-001, 8.570546e-001,
+8.574896e-001, 8.579247e-001, 8.583598e-001, 8.587948e-001, 8.592264e-001, 8.596577e-001, 8.600889e-001, 8.605202e-001, 8.609511e-001, 8.613770e-001,
+8.618030e-001, 8.622289e-001, 8.626548e-001, 8.630801e-001, 8.635025e-001, 8.639248e-001, 8.643472e-001, 8.647695e-001, 8.651912e-001, 8.656112e-001,
+8.660312e-001, 8.664512e-001, 8.668713e-001, 8.672901e-001, 8.677063e-001, 8.681225e-001, 8.685387e-001, 8.689549e-001, 8.693702e-001, 8.697833e-001,
+8.701964e-001, 8.706095e-001, 8.710225e-001, 8.714350e-001, 8.718457e-001, 8.722564e-001, 8.726670e-001, 8.730777e-001, 8.734877e-001, 8.738946e-001,
+8.743015e-001, 8.747084e-001, 8.751153e-001, 8.755220e-001, 8.759253e-001, 8.763286e-001, 8.767319e-001, 8.771352e-001, 8.775385e-001, 8.779397e-001,
+8.783406e-001, 8.787414e-001, 8.791423e-001, 8.795432e-001, 8.799426e-001, 8.803412e-001, 8.807398e-001, 8.811385e-001, 8.815371e-001, 8.819343e-001,
+8.823293e-001, 8.827242e-001, 8.831192e-001, 8.835142e-001, 8.839088e-001, 8.842998e-001, 8.846908e-001, 8.850819e-001, 8.854729e-001, 8.858640e-001,
+8.862522e-001, 8.866395e-001, 8.870269e-001, 8.874142e-001, 8.878015e-001, 8.881876e-001, 8.885714e-001, 8.889552e-001, 8.893390e-001, 8.897229e-001,
+8.901067e-001, 8.904875e-001, 8.908680e-001, 8.912485e-001, 8.916290e-001, 8.920095e-001, 8.923886e-001, 8.927660e-001, 8.931434e-001, 8.935208e-001,
+8.938982e-001, 8.942756e-001, 8.946498e-001, 8.950238e-001, 8.953978e-001, 8.957718e-001, 8.961458e-001, 8.965192e-001, 8.968914e-001, 8.972637e-001,
+8.976360e-001, 8.980083e-001, 8.983806e-001, 8.987511e-001, 8.991209e-001, 8.994907e-001, 8.998606e-001, 9.002304e-001, 9.006000e-001, 9.009667e-001,
+9.013333e-001, 9.017000e-001, 9.020666e-001, 9.024333e-001, 9.027994e-001, 9.031645e-001, 9.035296e-001, 9.038947e-001, 9.042598e-001, 9.046250e-001,
+9.049890e-001, 9.053523e-001, 9.057156e-001, 9.060789e-001, 9.064422e-001, 9.068055e-001, 9.071661e-001, 9.075260e-001, 9.078859e-001, 9.082458e-001,
+9.086056e-001, 9.089655e-001, 9.093215e-001, 9.096773e-001, 9.100331e-001, 9.103888e-001, 9.107446e-001, 9.111003e-001, 9.114550e-001, 9.118097e-001,
+9.121644e-001, 9.125191e-001, 9.128738e-001, 9.132284e-001, 9.135813e-001, 9.139342e-001, 9.142871e-001, 9.146400e-001, 9.149929e-001, 9.153456e-001,
+9.156951e-001, 9.160447e-001, 9.163942e-001, 9.167438e-001, 9.170933e-001, 9.174428e-001, 9.177901e-001, 9.181375e-001, 9.184848e-001, 9.188321e-001,
+9.191795e-001, 9.195268e-001, 9.198732e-001, 9.202195e-001, 9.205658e-001, 9.209120e-001, 9.212583e-001, 9.216046e-001, 9.219489e-001, 9.222925e-001,
+9.226362e-001, 9.229799e-001, 9.233235e-001, 9.236672e-001, 9.240090e-001, 9.243493e-001, 9.246897e-001, 9.250301e-001, 9.253705e-001, 9.257108e-001,
+9.260511e-001, 9.263911e-001, 9.267311e-001, 9.270711e-001, 9.274111e-001, 9.277511e-001, 9.280911e-001, 9.284301e-001, 9.287690e-001, 9.291079e-001,
+9.294469e-001, 9.297858e-001, 9.301248e-001, 9.304615e-001, 9.307970e-001, 9.311325e-001, 9.314680e-001, 9.318036e-001, 9.321391e-001, 9.324736e-001,
+9.328051e-001, 9.331366e-001, 9.334680e-001, 9.337995e-001, 9.341309e-001, 9.344624e-001, 9.347929e-001, 9.351232e-001, 9.354535e-001, 9.357837e-001,
+9.361140e-001, 9.364443e-001, 9.367740e-001, 9.371024e-001, 9.374308e-001, 9.377592e-001, 9.380876e-001, 9.384160e-001, 9.387444e-001, 9.390699e-001,
+9.393942e-001, 9.397184e-001, 9.400427e-001, 9.403669e-001, 9.406911e-001, 9.410152e-001, 9.413359e-001, 9.416566e-001, 9.419774e-001, 9.422981e-001,
+9.426189e-001, 9.429396e-001, 9.432600e-001, 9.435796e-001, 9.438993e-001, 9.442189e-001, 9.445386e-001, 9.448582e-001, 9.451779e-001, 9.454959e-001,
+9.458130e-001, 9.461301e-001, 9.464472e-001, 9.467643e-001, 9.470815e-001, 9.473986e-001, 9.477123e-001, 9.480254e-001, 9.483386e-001, 9.486517e-001,
+9.489648e-001, 9.492780e-001, 9.495911e-001, 9.499026e-001, 9.502142e-001, 9.505257e-001, 9.508372e-001, 9.511487e-001, 9.514602e-001, 9.517717e-001,
+9.520822e-001, 9.523928e-001, 9.527034e-001, 9.530139e-001, 9.533245e-001, 9.536350e-001, 9.539452e-001, 9.542526e-001, 9.545600e-001, 9.548674e-001,
+9.551748e-001, 9.554821e-001, 9.557895e-001, 9.560966e-001, 9.564007e-001, 9.567048e-001, 9.570089e-001, 9.573130e-001, 9.576171e-001, 9.579212e-001,
+9.582252e-001, 9.585260e-001, 9.588268e-001, 9.591276e-001, 9.594284e-001, 9.597291e-001, 9.600299e-001, 9.603307e-001, 9.606264e-001, 9.609215e-001,
+9.612166e-001, 9.615117e-001, 9.618068e-001, 9.621019e-001, 9.623971e-001, 9.626887e-001, 9.629789e-001, 9.632690e-001, 9.635592e-001, 9.638493e-001,
+9.641395e-001, 9.644297e-001, 9.647190e-001, 9.650072e-001, 9.652955e-001, 9.655837e-001, 9.658720e-001, 9.661602e-001, 9.664485e-001, 9.667365e-001,
+9.670230e-001, 9.673094e-001, 9.675959e-001, 9.678823e-001, 9.681688e-001, 9.684552e-001, 9.687417e-001, 9.690259e-001, 9.693092e-001, 9.695926e-001,
+9.698759e-001, 9.701593e-001, 9.704426e-001, 9.707260e-001, 9.710081e-001, 9.712873e-001, 9.715665e-001, 9.718457e-001, 9.721249e-001, 9.724041e-001,
+9.726833e-001, 9.729625e-001, 9.732391e-001, 9.735151e-001, 9.737911e-001, 9.740670e-001, 9.743430e-001, 9.746190e-001, 9.748950e-001, 9.751702e-001,
+9.754429e-001, 9.757156e-001, 9.759883e-001, 9.762610e-001, 9.765337e-001, 9.768065e-001, 9.770792e-001, 9.773493e-001, 9.776179e-001, 9.778864e-001,
+9.781550e-001, 9.784235e-001, 9.786920e-001, 9.789606e-001, 9.792291e-001, 9.794938e-001, 9.797581e-001, 9.800225e-001, 9.802868e-001, 9.805511e-001,
+9.808154e-001, 9.810798e-001, 9.813434e-001, 9.816035e-001, 9.818636e-001, 9.821237e-001, 9.823838e-001, 9.826439e-001, 9.829040e-001, 9.831641e-001,
+9.834225e-001, 9.836777e-001, 9.839329e-001, 9.841881e-001, 9.844433e-001, 9.846985e-001, 9.849537e-001, 9.852089e-001, 9.854618e-001, 9.857121e-001,
+9.859623e-001, 9.862126e-001, 9.864628e-001, 9.867131e-001, 9.869633e-001, 9.872136e-001, 9.874610e-001, 9.877058e-001, 9.879505e-001, 9.881952e-001,
+9.884400e-001, 9.886847e-001, 9.889294e-001, 9.891742e-001, 9.894152e-001, 9.896526e-001, 9.898899e-001, 9.901272e-001, 9.903646e-001, 9.906019e-001,
+9.908393e-001, 9.910766e-001, 9.913106e-001, 9.915400e-001, 9.917695e-001, 9.919989e-001, 9.922283e-001, 9.924577e-001, 9.926871e-001, 9.929165e-001,
+9.931442e-001, 9.933673e-001, 9.935904e-001, 9.938135e-001, 9.940366e-001, 9.942597e-001, 9.944828e-001, 9.947060e-001, 9.949286e-001, 9.951432e-001,
+9.953578e-001, 9.955724e-001, 9.957871e-001, 9.960017e-001, 9.962163e-001, 9.964309e-001, 9.966455e-001, 9.968507e-001, 9.970531e-001, 9.972555e-001,
+9.974579e-001, 9.976603e-001, 9.978627e-001, 9.980651e-001, 9.982675e-001, 9.984655e-001, 9.986573e-001, 9.988491e-001, 9.990409e-001, 9.992327e-001,
+9.994246e-001, 9.996164e-001, 9.998082e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.417426e-002, 2.609347e-002, 3.646664e-002, 4.589583e-002, 5.462990e-002, 6.282225e-002, 7.055317e-002, 7.792827e-002, 8.496991e-002,
+9.168695e-002, 9.814425e-002, 1.043419e-001, 1.102855e-001, 1.160039e-001, 1.215291e-001, 1.268732e-001, 1.320544e-001, 1.370813e-001, 1.419793e-001,
+1.467564e-001, 1.514313e-001, 1.559926e-001, 1.604603e-001, 1.648356e-001, 1.691133e-001, 1.733085e-001, 1.774341e-001, 1.814931e-001, 1.854856e-001,
+1.894099e-001, 1.932737e-001, 1.970842e-001, 2.008335e-001, 2.045322e-001, 2.081629e-001, 2.117401e-001, 2.152681e-001, 2.187465e-001, 2.221814e-001,
+2.255706e-001, 2.289170e-001, 2.322204e-001, 2.354856e-001, 2.387185e-001, 2.419217e-001, 2.450877e-001, 2.482272e-001, 2.513332e-001, 2.543988e-001,
+2.574330e-001, 2.604371e-001, 2.634117e-001, 2.663584e-001, 2.692733e-001, 2.721604e-001, 2.750196e-001, 2.778514e-001, 2.806542e-001, 2.834335e-001,
+2.861856e-001, 2.889157e-001, 2.916231e-001, 2.943059e-001, 2.969624e-001, 2.995971e-001, 3.022121e-001, 3.048097e-001, 3.073848e-001, 3.099358e-001,
+3.124624e-001, 3.149713e-001, 3.174607e-001, 3.199287e-001, 3.223791e-001, 3.248122e-001, 3.272255e-001, 3.296201e-001, 3.319935e-001, 3.343470e-001,
+3.366862e-001, 3.390058e-001, 3.413096e-001, 3.435959e-001, 3.458689e-001, 3.481297e-001, 3.503779e-001, 3.526121e-001, 3.548285e-001, 3.570280e-001,
+3.592115e-001, 3.613777e-001, 3.635273e-001, 3.656621e-001, 3.677803e-001, 3.698835e-001, 3.719711e-001, 3.740385e-001, 3.760900e-001, 3.781271e-001,
+3.801491e-001, 3.821552e-001, 3.841435e-001, 3.861172e-001, 3.880780e-001, 3.900259e-001, 3.919605e-001, 3.938810e-001, 3.957869e-001, 3.976789e-001,
+3.995567e-001, 4.014220e-001, 4.032763e-001, 4.051196e-001, 4.069515e-001, 4.087724e-001, 4.105816e-001, 4.123833e-001, 4.141763e-001, 4.159628e-001,
+4.177407e-001, 4.195122e-001, 4.212754e-001, 4.230324e-001, 4.247812e-001, 4.265239e-001, 4.282588e-001, 4.299876e-001, 4.317089e-001, 4.334240e-001,
+4.351322e-001, 4.368341e-001, 4.385295e-001, 4.402183e-001, 4.419008e-001, 4.435743e-001, 4.452398e-001, 4.468954e-001, 4.485433e-001, 4.501811e-001,
+4.518087e-001, 4.534264e-001, 4.550347e-001, 4.566338e-001, 4.582231e-001, 4.598028e-001, 4.613744e-001, 4.629382e-001, 4.644944e-001, 4.660434e-001,
+4.675837e-001, 4.691170e-001, 4.706438e-001, 4.721644e-001, 4.736791e-001, 4.751864e-001, 4.766879e-001, 4.781832e-001, 4.796719e-001, 4.811523e-001,
+4.826253e-001, 4.840922e-001, 4.855529e-001, 4.870058e-001, 4.884487e-001, 4.898858e-001, 4.913172e-001, 4.927396e-001, 4.941565e-001, 4.955681e-001,
+4.969740e-001, 4.983738e-001, 4.997689e-001, 5.011598e-001, 5.025462e-001, 5.039263e-001, 5.053020e-001, 5.066724e-001, 5.080368e-001, 5.093978e-001,
+5.107549e-001, 5.121051e-001, 5.134514e-001, 5.147926e-001, 5.161284e-001, 5.174612e-001, 5.187899e-001, 5.201147e-001, 5.214366e-001, 5.227527e-001,
+5.240651e-001, 5.253748e-001, 5.266772e-001, 5.279759e-001, 5.292711e-001, 5.305575e-001, 5.318407e-001, 5.331183e-001, 5.343890e-001, 5.356560e-001,
+5.369137e-001, 5.381682e-001, 5.394172e-001, 5.406592e-001, 5.418982e-001, 5.431274e-001, 5.443540e-001, 5.455751e-001, 5.467912e-001, 5.480041e-001,
+5.492113e-001, 5.504168e-001, 5.516167e-001, 5.528140e-001, 5.540074e-001, 5.551960e-001, 5.563817e-001, 5.575635e-001, 5.587442e-001, 5.599179e-001,
+5.610896e-001, 5.622551e-001, 5.634174e-001, 5.645756e-001, 5.657301e-001, 5.668820e-001, 5.680285e-001, 5.691731e-001, 5.703091e-001, 5.714436e-001,
+5.725712e-001, 5.736980e-001, 5.748155e-001, 5.759319e-001, 5.770417e-001, 5.781497e-001, 5.792517e-001, 5.803521e-001, 5.814482e-001, 5.825421e-001,
+5.836308e-001, 5.847169e-001, 5.857975e-001, 5.868756e-001, 5.879486e-001, 5.890189e-001, 5.900836e-001, 5.911463e-001, 5.922038e-001, 5.932599e-001,
+5.943114e-001, 5.953620e-001, 5.964085e-001, 5.974544e-001, 5.984926e-001, 5.995308e-001, 6.005603e-001, 6.015897e-001, 6.026117e-001, 6.036325e-001,
+6.046487e-001, 6.056631e-001, 6.066739e-001, 6.076821e-001, 6.086880e-001, 6.096904e-001, 6.106912e-001, 6.116858e-001, 6.126803e-001, 6.136668e-001,
+6.146532e-001, 6.156343e-001, 6.166138e-001, 6.175904e-001, 6.185643e-001, 6.195366e-001, 6.205044e-001, 6.214723e-001, 6.224306e-001, 6.233887e-001,
+6.243418e-001, 6.252926e-001, 6.262407e-001, 6.271844e-001, 6.281279e-001, 6.290644e-001, 6.300008e-001, 6.309322e-001, 6.318610e-001, 6.327874e-001,
+6.337075e-001, 6.346277e-001, 6.355415e-001, 6.364545e-001, 6.373647e-001, 6.382718e-001, 6.391788e-001, 6.400815e-001, 6.409841e-001, 6.418827e-001,
+6.427783e-001, 6.436732e-001, 6.445615e-001, 6.454499e-001, 6.463343e-001, 6.472161e-001, 6.480974e-001, 6.489726e-001, 6.498478e-001, 6.507201e-001,
+6.515900e-001, 6.524600e-001, 6.533246e-001, 6.541891e-001, 6.550511e-001, 6.559094e-001, 6.567676e-001, 6.576202e-001, 6.584713e-001, 6.593216e-001,
+6.601678e-001, 6.610140e-001, 6.618572e-001, 6.626977e-001, 6.635381e-001, 6.643719e-001, 6.652045e-001, 6.660360e-001, 6.668620e-001, 6.676881e-001,
+6.685119e-001, 6.693330e-001, 6.701540e-001, 6.709716e-001, 6.717877e-001, 6.726038e-001, 6.734124e-001, 6.742205e-001, 6.750274e-001, 6.758279e-001,
+6.766283e-001, 6.774265e-001, 6.782207e-001, 6.790148e-001, 6.798057e-001, 6.805936e-001, 6.813816e-001, 6.821650e-001, 6.829462e-001, 6.837274e-001,
+6.845043e-001, 6.852802e-001, 6.860561e-001, 6.868287e-001, 6.876010e-001, 6.883733e-001, 6.891400e-001, 6.899066e-001, 6.906730e-001, 6.914320e-001,
+6.921910e-001, 6.929497e-001, 6.937027e-001, 6.944558e-001, 6.952087e-001, 6.959573e-001, 6.967060e-001, 6.974545e-001, 6.981991e-001, 6.989436e-001,
+6.996882e-001, 7.004261e-001, 7.011638e-001, 7.019016e-001, 7.026334e-001, 7.033647e-001, 7.040959e-001, 7.048221e-001, 7.055472e-001, 7.062722e-001,
+7.069927e-001, 7.077111e-001, 7.084295e-001, 7.091451e-001, 7.098585e-001, 7.105719e-001, 7.112828e-001, 7.119894e-001, 7.126961e-001, 7.134014e-001,
+7.140998e-001, 7.147981e-001, 7.154964e-001, 7.161884e-001, 7.168800e-001, 7.175716e-001, 7.182598e-001, 7.189464e-001, 7.196329e-001, 7.203182e-001,
+7.210014e-001, 7.216846e-001, 7.223674e-001, 7.230455e-001, 7.237236e-001, 7.244017e-001, 7.250748e-001, 7.257462e-001, 7.264177e-001, 7.270872e-001,
+7.277535e-001, 7.284199e-001, 7.290863e-001, 7.297480e-001, 7.304097e-001, 7.310714e-001, 7.317304e-001, 7.323872e-001, 7.330440e-001, 7.337001e-001,
+7.343517e-001, 7.350032e-001, 7.356547e-001, 7.363025e-001, 7.369480e-001, 7.375936e-001, 7.382384e-001, 7.388777e-001, 7.395171e-001, 7.401564e-001,
+7.407931e-001, 7.414279e-001, 7.420627e-001, 7.426973e-001, 7.433282e-001, 7.439591e-001, 7.445900e-001, 7.452182e-001, 7.458430e-001, 7.464678e-001,
+7.470927e-001, 7.477130e-001, 7.483323e-001, 7.489516e-001, 7.495701e-001, 7.501845e-001, 7.507988e-001, 7.514132e-001, 7.520252e-001, 7.526345e-001,
+7.532438e-001, 7.538531e-001, 7.544585e-001, 7.550627e-001, 7.556669e-001, 7.562711e-001, 7.568696e-001, 7.574681e-001, 7.580666e-001, 7.586637e-001,
+7.592564e-001, 7.598490e-001, 7.604417e-001, 7.610327e-001, 7.616213e-001, 7.622099e-001, 7.627985e-001, 7.633847e-001, 7.639692e-001, 7.645537e-001,
+7.651382e-001, 7.657201e-001, 7.663010e-001, 7.668819e-001, 7.674627e-001, 7.680411e-001, 7.686188e-001, 7.691965e-001, 7.697743e-001, 7.703492e-001,
+7.709237e-001, 7.714982e-001, 7.720728e-001, 7.726444e-001, 7.732156e-001, 7.737869e-001, 7.743582e-001, 7.749259e-001, 7.754932e-001, 7.760605e-001,
+7.766279e-001, 7.771917e-001, 7.777550e-001, 7.783183e-001, 7.788816e-001, 7.794431e-001, 7.800041e-001, 7.805652e-001, 7.811262e-001, 7.816848e-001,
+7.822423e-001, 7.827997e-001, 7.833572e-001, 7.839122e-001, 7.844650e-001, 7.850178e-001, 7.855707e-001, 7.861224e-001, 7.866722e-001, 7.872221e-001,
+7.877720e-001, 7.883215e-001, 7.888690e-001, 7.894165e-001, 7.899640e-001, 7.905115e-001, 7.910552e-001, 7.915987e-001, 7.921422e-001, 7.926856e-001,
+7.932268e-001, 7.937668e-001, 7.943069e-001, 7.948469e-001, 7.953859e-001, 7.959230e-001, 7.964602e-001, 7.969973e-001, 7.975344e-001, 7.980671e-001,
+7.985997e-001, 7.991324e-001, 7.996650e-001, 8.001953e-001, 8.007240e-001, 8.012526e-001, 8.017813e-001, 8.023094e-001, 8.028347e-001, 8.033601e-001,
+8.038854e-001, 8.044108e-001, 8.049325e-001, 8.054529e-001, 8.059733e-001, 8.064937e-001, 8.070131e-001, 8.075291e-001, 8.080451e-001, 8.085611e-001,
+8.090771e-001, 8.095904e-001, 8.101025e-001, 8.106147e-001, 8.111269e-001, 8.116386e-001, 8.121471e-001, 8.126556e-001, 8.131640e-001, 8.136725e-001,
+8.141799e-001, 8.146863e-001, 8.151927e-001, 8.156991e-001, 8.162055e-001, 8.167093e-001, 8.172127e-001, 8.177161e-001, 8.182195e-001, 8.187221e-001,
+8.192217e-001, 8.197212e-001, 8.202207e-001, 8.207202e-001, 8.212186e-001, 8.217158e-001, 8.222130e-001, 8.227102e-001, 8.232074e-001, 8.237023e-001,
+8.241964e-001, 8.246904e-001, 8.251844e-001, 8.256785e-001, 8.261687e-001, 8.266587e-001, 8.271486e-001, 8.276385e-001, 8.281282e-001, 8.286157e-001,
+8.291031e-001, 8.295905e-001, 8.300779e-001, 8.305646e-001, 8.310487e-001, 8.315328e-001, 8.320168e-001, 8.325009e-001, 8.329837e-001, 8.334635e-001,
+8.339433e-001, 8.344230e-001, 8.349028e-001, 8.353817e-001, 8.358588e-001, 8.363358e-001, 8.368129e-001, 8.372899e-001, 8.377659e-001, 8.382394e-001,
+8.387129e-001, 8.391864e-001, 8.396600e-001, 8.401323e-001, 8.406014e-001, 8.410704e-001, 8.415395e-001, 8.420085e-001, 8.424771e-001, 8.429432e-001,
+8.434094e-001, 8.438755e-001, 8.443417e-001, 8.448077e-001, 8.452701e-001, 8.457326e-001, 8.461951e-001, 8.466575e-001, 8.471200e-001, 8.475784e-001,
+8.480362e-001, 8.484940e-001, 8.489519e-001, 8.494097e-001, 8.498655e-001, 8.503203e-001, 8.507750e-001, 8.512298e-001, 8.516845e-001, 8.521381e-001,
+8.525899e-001, 8.530418e-001, 8.534937e-001, 8.539455e-001, 8.543971e-001, 8.548465e-001, 8.552959e-001, 8.557452e-001, 8.561946e-001, 8.566440e-001,
+8.570918e-001, 8.575391e-001, 8.579865e-001, 8.584338e-001, 8.588811e-001, 8.593278e-001, 8.597732e-001, 8.602187e-001, 8.606641e-001, 8.611095e-001,
+8.615550e-001, 8.620001e-001, 8.624451e-001, 8.628901e-001, 8.633352e-001, 8.637802e-001, 8.642247e-001, 8.646684e-001, 8.651122e-001, 8.655559e-001,
+8.659996e-001, 8.664433e-001, 8.668851e-001, 8.673268e-001, 8.677684e-001, 8.682100e-001, 8.686517e-001, 8.690931e-001, 8.695341e-001, 8.699751e-001,
+8.704161e-001, 8.708571e-001, 8.712981e-001, 8.717380e-001, 8.721775e-001, 8.726169e-001, 8.730564e-001, 8.734959e-001, 8.739352e-001, 8.743724e-001,
+8.748096e-001, 8.752468e-001, 8.756840e-001, 8.761211e-001, 8.765580e-001, 8.769944e-001, 8.774307e-001, 8.778670e-001, 8.783034e-001, 8.787397e-001,
+8.791750e-001, 8.796096e-001, 8.800442e-001, 8.804788e-001, 8.809134e-001, 8.813480e-001, 8.817807e-001, 8.822128e-001, 8.826449e-001, 8.830771e-001,
+8.835092e-001, 8.839413e-001, 8.843724e-001, 8.848035e-001, 8.852345e-001, 8.856656e-001, 8.860967e-001, 8.865276e-001, 8.869568e-001, 8.873859e-001,
+8.878151e-001, 8.882442e-001, 8.886734e-001, 8.891023e-001, 8.895288e-001, 8.899552e-001, 8.903817e-001, 8.908082e-001, 8.912347e-001, 8.916611e-001,
+8.920863e-001, 8.925115e-001, 8.929367e-001, 8.933618e-001, 8.937870e-001, 8.942122e-001, 8.946361e-001, 8.950601e-001, 8.954841e-001, 8.959080e-001,
+8.963320e-001, 8.967559e-001, 8.971792e-001, 8.976024e-001, 8.980256e-001, 8.984489e-001, 8.988721e-001, 8.992953e-001, 8.997182e-001, 9.001411e-001,
+9.005639e-001, 9.009868e-001, 9.014097e-001, 9.018325e-001, 9.022544e-001, 9.026756e-001, 9.030968e-001, 9.035180e-001, 9.039392e-001, 9.043604e-001,
+9.047812e-001, 9.052013e-001, 9.056213e-001, 9.060413e-001, 9.064614e-001, 9.068814e-001, 9.073014e-001, 9.077207e-001, 9.081399e-001, 9.085592e-001,
+9.089784e-001, 9.093977e-001, 9.098170e-001, 9.102349e-001, 9.106521e-001, 9.110693e-001, 9.114865e-001, 9.119037e-001, 9.123209e-001, 9.127377e-001,
+9.131533e-001, 9.135689e-001, 9.139845e-001, 9.144001e-001, 9.148158e-001, 9.152314e-001, 9.156461e-001, 9.160605e-001, 9.164750e-001, 9.168894e-001,
+9.173039e-001, 9.177183e-001, 9.181321e-001, 9.185441e-001, 9.189561e-001, 9.193681e-001, 9.197801e-001, 9.201922e-001, 9.206042e-001, 9.210148e-001,
+9.214248e-001, 9.218348e-001, 9.222449e-001, 9.226549e-001, 9.230649e-001, 9.234749e-001, 9.238841e-001, 9.242934e-001, 9.247027e-001, 9.251120e-001,
+9.255212e-001, 9.259305e-001, 9.263395e-001, 9.267479e-001, 9.271564e-001, 9.275648e-001, 9.279733e-001, 9.283817e-001, 9.287902e-001, 9.291978e-001,
+9.296049e-001, 9.300120e-001, 9.304192e-001, 9.308263e-001, 9.312335e-001, 9.316406e-001, 9.320466e-001, 9.324524e-001, 9.328582e-001, 9.332640e-001,
+9.336698e-001, 9.340756e-001, 9.344813e-001, 9.348857e-001, 9.352901e-001, 9.356945e-001, 9.360988e-001, 9.365032e-001, 9.369076e-001, 9.373118e-001,
+9.377142e-001, 9.381167e-001, 9.385192e-001, 9.389217e-001, 9.393242e-001, 9.397267e-001, 9.401287e-001, 9.405274e-001, 9.409262e-001, 9.413250e-001,
+9.417237e-001, 9.421225e-001, 9.425212e-001, 9.429192e-001, 9.433112e-001, 9.437033e-001, 9.440953e-001, 9.444873e-001, 9.448793e-001, 9.452713e-001,
+9.456631e-001, 9.460487e-001, 9.464343e-001, 9.468199e-001, 9.472055e-001, 9.475911e-001, 9.479767e-001, 9.483623e-001, 9.487442e-001, 9.491256e-001,
+9.495071e-001, 9.498886e-001, 9.502701e-001, 9.506515e-001, 9.510330e-001, 9.514124e-001, 9.517909e-001, 9.521693e-001, 9.525478e-001, 9.529263e-001,
+9.533047e-001, 9.536832e-001, 9.540601e-001, 9.544352e-001, 9.548102e-001, 9.551853e-001, 9.555603e-001, 9.559353e-001, 9.563104e-001, 9.566850e-001,
+9.570570e-001, 9.574290e-001, 9.578010e-001, 9.581730e-001, 9.585450e-001, 9.589170e-001, 9.592890e-001, 9.596590e-001, 9.600283e-001, 9.603976e-001,
+9.607669e-001, 9.611362e-001, 9.615055e-001, 9.618748e-001, 9.622433e-001, 9.626101e-001, 9.629768e-001, 9.633435e-001, 9.637103e-001, 9.640770e-001,
+9.644438e-001, 9.648105e-001, 9.651746e-001, 9.655379e-001, 9.659013e-001, 9.662647e-001, 9.666281e-001, 9.669915e-001, 9.673549e-001, 9.677174e-001,
+9.680770e-001, 9.684366e-001, 9.687962e-001, 9.691558e-001, 9.695154e-001, 9.698749e-001, 9.702345e-001, 9.705916e-001, 9.709471e-001, 9.713026e-001,
+9.716581e-001, 9.720136e-001, 9.723691e-001, 9.727246e-001, 9.730801e-001, 9.734310e-001, 9.737815e-001, 9.741320e-001, 9.744825e-001, 9.748330e-001,
+9.751835e-001, 9.755340e-001, 9.758836e-001, 9.762285e-001, 9.765734e-001, 9.769183e-001, 9.772632e-001, 9.776080e-001, 9.779529e-001, 9.782978e-001,
+9.786404e-001, 9.789786e-001, 9.793168e-001, 9.796550e-001, 9.799933e-001, 9.803315e-001, 9.806697e-001, 9.810079e-001, 9.813425e-001, 9.816730e-001,
+9.820034e-001, 9.823339e-001, 9.826643e-001, 9.829947e-001, 9.833252e-001, 9.836556e-001, 9.839816e-001, 9.843035e-001, 9.846253e-001, 9.849471e-001,
+9.852690e-001, 9.855908e-001, 9.859126e-001, 9.862344e-001, 9.865508e-001, 9.868618e-001, 9.871728e-001, 9.874838e-001, 9.877948e-001, 9.881057e-001,
+9.884167e-001, 9.887277e-001, 9.890335e-001, 9.893323e-001, 9.896311e-001, 9.899299e-001, 9.902286e-001, 9.905274e-001, 9.908262e-001, 9.911250e-001,
+9.914202e-001, 9.917060e-001, 9.919918e-001, 9.922776e-001, 9.925634e-001, 9.928492e-001, 9.931350e-001, 9.934207e-001, 9.937056e-001, 9.939747e-001,
+9.942438e-001, 9.945129e-001, 9.947820e-001, 9.950512e-001, 9.953203e-001, 9.955894e-001, 9.958585e-001, 9.961140e-001, 9.963654e-001, 9.966169e-001,
+9.968684e-001, 9.971199e-001, 9.973714e-001, 9.976228e-001, 9.978743e-001, 9.981189e-001, 9.983540e-001, 9.985892e-001, 9.988243e-001, 9.990594e-001,
+9.992946e-001, 9.995297e-001, 9.997649e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Futura II 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.991874e-003, 1.716550e-002, 2.429815e-002, 3.080588e-002, 3.682279e-002, 4.245884e-002, 4.776014e-002, 5.279381e-002, 5.758329e-002,
+6.222477e-002, 6.681612e-002, 7.138879e-002, 7.592829e-002, 8.043201e-002, 8.488052e-002, 8.929147e-002, 9.365866e-002, 9.797553e-002, 1.022336e-001,
+1.064320e-001, 1.105559e-001, 1.146130e-001, 1.185964e-001, 1.225241e-001, 1.263934e-001, 1.301935e-001, 1.339210e-001, 1.375811e-001, 1.411648e-001,
+1.446769e-001, 1.481269e-001, 1.515026e-001, 1.548156e-001, 1.580781e-001, 1.612832e-001, 1.644275e-001, 1.675149e-001, 1.705511e-001, 1.735346e-001,
+1.764682e-001, 1.793412e-001, 1.821643e-001, 1.849397e-001, 1.876723e-001, 1.903574e-001, 1.929987e-001, 1.956040e-001, 1.981741e-001, 2.007141e-001,
+2.032240e-001, 2.057045e-001, 2.081624e-001, 2.106029e-001, 2.130292e-001, 2.154412e-001, 2.178472e-001, 2.202418e-001, 2.226282e-001, 2.250116e-001,
+2.273911e-001, 2.297632e-001, 2.321317e-001, 2.344924e-001, 2.368433e-001, 2.391863e-001, 2.415206e-001, 2.438464e-001, 2.461618e-001, 2.484731e-001,
+2.507739e-001, 2.530598e-001, 2.553377e-001, 2.576030e-001, 2.598524e-001, 2.620919e-001, 2.643215e-001, 2.665402e-001, 2.687490e-001, 2.709451e-001,
+2.731317e-001, 2.753098e-001, 2.774744e-001, 2.796307e-001, 2.817796e-001, 2.839166e-001, 2.860453e-001, 2.881660e-001, 2.902777e-001, 2.923803e-001,
+2.944733e-001, 2.965568e-001, 2.986293e-001, 3.006939e-001, 3.027509e-001, 3.047966e-001, 3.068325e-001, 3.088631e-001, 3.108849e-001, 3.128945e-001,
+3.148934e-001, 3.168858e-001, 3.188689e-001, 3.208412e-001, 3.228051e-001, 3.247617e-001, 3.267089e-001, 3.286511e-001, 3.305901e-001, 3.325230e-001,
+3.344469e-001, 3.363627e-001, 3.382742e-001, 3.401804e-001, 3.420786e-001, 3.439662e-001, 3.458459e-001, 3.477212e-001, 3.495896e-001, 3.514491e-001,
+3.533000e-001, 3.551431e-001, 3.569792e-001, 3.588086e-001, 3.606315e-001, 3.624485e-001, 3.642578e-001, 3.660600e-001, 3.678554e-001, 3.696443e-001,
+3.714274e-001, 3.732032e-001, 3.749722e-001, 3.767345e-001, 3.784905e-001, 3.802404e-001, 3.819843e-001, 3.837208e-001, 3.854481e-001, 3.871636e-001,
+3.888713e-001, 3.905733e-001, 3.922694e-001, 3.939584e-001, 3.956395e-001, 3.973124e-001, 3.989774e-001, 4.006345e-001, 4.022842e-001, 4.039269e-001,
+4.055628e-001, 4.071915e-001, 4.088128e-001, 4.104265e-001, 4.120319e-001, 4.136282e-001, 4.152133e-001, 4.167910e-001, 4.183610e-001, 4.199231e-001,
+4.214732e-001, 4.230127e-001, 4.245433e-001, 4.260652e-001, 4.275765e-001, 4.290785e-001, 4.305722e-001, 4.320571e-001, 4.335276e-001, 4.349886e-001,
+4.364406e-001, 4.378808e-001, 4.393114e-001, 4.407345e-001, 4.421486e-001, 4.435502e-001, 4.449435e-001, 4.463287e-001, 4.477010e-001, 4.490672e-001,
+4.504273e-001, 4.517762e-001, 4.531183e-001, 4.544541e-001, 4.557776e-001, 4.570953e-001, 4.584075e-001, 4.597109e-001, 4.610100e-001, 4.623035e-001,
+4.635887e-001, 4.648695e-001, 4.661431e-001, 4.674094e-001, 4.686715e-001, 4.699238e-001, 4.711719e-001, 4.724156e-001, 4.736534e-001, 4.748887e-001,
+4.761190e-001, 4.773452e-001, 4.785684e-001, 4.797854e-001, 4.810002e-001, 4.822093e-001, 4.834148e-001, 4.846169e-001, 4.858147e-001, 4.870111e-001,
+4.882034e-001, 4.893937e-001, 4.905807e-001, 4.917649e-001, 4.929473e-001, 4.941254e-001, 4.953023e-001, 4.964750e-001, 4.976463e-001, 4.988138e-001,
+4.999792e-001, 5.011422e-001, 5.023020e-001, 5.034599e-001, 5.046143e-001, 5.057677e-001, 5.069164e-001, 5.080644e-001, 5.092084e-001, 5.103514e-001,
+5.114903e-001, 5.126280e-001, 5.137625e-001, 5.148952e-001, 5.160247e-001, 5.171523e-001, 5.182775e-001, 5.194003e-001, 5.205205e-001, 5.216385e-001,
+5.227544e-001, 5.238677e-001, 5.249786e-001, 5.260874e-001, 5.271940e-001, 5.282983e-001, 5.294001e-001, 5.304999e-001, 5.315974e-001, 5.326929e-001,
+5.337856e-001, 5.348769e-001, 5.359654e-001, 5.370526e-001, 5.381363e-001, 5.392193e-001, 5.402988e-001, 5.413781e-001, 5.424529e-001, 5.435277e-001,
+5.445987e-001, 5.456693e-001, 5.467364e-001, 5.478023e-001, 5.488658e-001, 5.499276e-001, 5.509875e-001, 5.520447e-001, 5.531010e-001, 5.541541e-001,
+5.552071e-001, 5.562557e-001, 5.573041e-001, 5.583497e-001, 5.593940e-001, 5.604363e-001, 5.614761e-001, 5.625152e-001, 5.635510e-001, 5.645867e-001,
+5.656185e-001, 5.666497e-001, 5.676787e-001, 5.687060e-001, 5.697323e-001, 5.707550e-001, 5.717777e-001, 5.727970e-001, 5.738158e-001, 5.748324e-001,
+5.758467e-001, 5.768607e-001, 5.778711e-001, 5.788814e-001, 5.798889e-001, 5.808948e-001, 5.818999e-001, 5.829019e-001, 5.839039e-001, 5.849026e-001,
+5.859003e-001, 5.868968e-001, 5.878906e-001, 5.888844e-001, 5.898747e-001, 5.908641e-001, 5.918525e-001, 5.928381e-001, 5.938237e-001, 5.948062e-001,
+5.957874e-001, 5.967681e-001, 5.977456e-001, 5.987230e-001, 5.996980e-001, 6.006712e-001, 6.016443e-001, 6.026139e-001, 6.035833e-001, 6.045512e-001,
+6.055164e-001, 6.064815e-001, 6.074441e-001, 6.084055e-001, 6.093668e-001, 6.103240e-001, 6.112812e-001, 6.122371e-001, 6.131906e-001, 6.141441e-001,
+6.150950e-001, 6.160443e-001, 6.169936e-001, 6.179397e-001, 6.188853e-001, 6.198305e-001, 6.207720e-001, 6.217134e-001, 6.226537e-001, 6.235915e-001,
+6.245294e-001, 6.254650e-001, 6.263987e-001, 6.273324e-001, 6.282636e-001, 6.291937e-001, 6.301239e-001, 6.310505e-001, 6.319765e-001, 6.329025e-001,
+6.338251e-001, 6.347475e-001, 6.356697e-001, 6.365881e-001, 6.375064e-001, 6.384243e-001, 6.393392e-001, 6.402540e-001, 6.411681e-001, 6.420789e-001,
+6.429897e-001, 6.438997e-001, 6.448070e-001, 6.457143e-001, 6.466207e-001, 6.475240e-001, 6.484273e-001, 6.493299e-001, 6.502298e-001, 6.511296e-001,
+6.520288e-001, 6.529247e-001, 6.538205e-001, 6.547161e-001, 6.556085e-001, 6.565009e-001, 6.573933e-001, 6.582819e-001, 6.591703e-001, 6.600588e-001,
+6.609443e-001, 6.618294e-001, 6.627144e-001, 6.635968e-001, 6.644779e-001, 6.653590e-001, 6.662384e-001, 6.671161e-001, 6.679939e-001, 6.688704e-001,
+6.697443e-001, 6.706182e-001, 6.714917e-001, 6.723623e-001, 6.732328e-001, 6.741033e-001, 6.749706e-001, 6.758373e-001, 6.767039e-001, 6.775688e-001,
+6.784321e-001, 6.792955e-001, 6.801579e-001, 6.810174e-001, 6.818770e-001, 6.827365e-001, 6.835916e-001, 6.844463e-001, 6.853010e-001, 6.861530e-001,
+6.870027e-001, 6.878524e-001, 6.887014e-001, 6.895464e-001, 6.903914e-001, 6.912364e-001, 6.920779e-001, 6.929180e-001, 6.937582e-001, 6.945971e-001,
+6.954327e-001, 6.962683e-001, 6.971039e-001, 6.979358e-001, 6.987668e-001, 6.995977e-001, 7.004269e-001, 7.012518e-001, 7.020767e-001, 7.029017e-001,
+7.037222e-001, 7.045413e-001, 7.053604e-001, 7.061784e-001, 7.069919e-001, 7.078053e-001, 7.086187e-001, 7.094289e-001, 7.102369e-001, 7.110448e-001,
+7.118528e-001, 7.126556e-001, 7.134583e-001, 7.142609e-001, 7.150620e-001, 7.158595e-001, 7.166571e-001, 7.174546e-001, 7.182491e-001, 7.190417e-001,
+7.198343e-001, 7.206269e-001, 7.214152e-001, 7.222030e-001, 7.229908e-001, 7.237780e-001, 7.245612e-001, 7.253445e-001, 7.261277e-001, 7.269088e-001,
+7.276861e-001, 7.284635e-001, 7.292408e-001, 7.300151e-001, 7.307870e-001, 7.315589e-001, 7.323308e-001, 7.330988e-001, 7.338652e-001, 7.346317e-001,
+7.353981e-001, 7.361604e-001, 7.369218e-001, 7.376832e-001, 7.384447e-001, 7.392014e-001, 7.399578e-001, 7.407142e-001, 7.414706e-001, 7.422225e-001,
+7.429743e-001, 7.437261e-001, 7.444778e-001, 7.452235e-001, 7.459693e-001, 7.467150e-001, 7.474606e-001, 7.482010e-001, 7.489414e-001, 7.496818e-001,
+7.504223e-001, 7.511573e-001, 7.518922e-001, 7.526271e-001, 7.533621e-001, 7.540927e-001, 7.548229e-001, 7.555532e-001, 7.562834e-001, 7.570097e-001,
+7.577351e-001, 7.584605e-001, 7.591858e-001, 7.599075e-001, 7.606273e-001, 7.613471e-001, 7.620670e-001, 7.627841e-001, 7.634985e-001, 7.642129e-001,
+7.649274e-001, 7.656403e-001, 7.663499e-001, 7.670595e-001, 7.677690e-001, 7.684783e-001, 7.691832e-001, 7.698880e-001, 7.705928e-001, 7.712977e-001,
+7.719981e-001, 7.726973e-001, 7.733965e-001, 7.740957e-001, 7.747925e-001, 7.754864e-001, 7.761804e-001, 7.768744e-001, 7.775678e-001, 7.782570e-001,
+7.789463e-001, 7.796355e-001, 7.803247e-001, 7.810097e-001, 7.816932e-001, 7.823767e-001, 7.830602e-001, 7.837421e-001, 7.844206e-001, 7.850991e-001,
+7.857775e-001, 7.864560e-001, 7.871304e-001, 7.878041e-001, 7.884778e-001, 7.891515e-001, 7.898237e-001, 7.904932e-001, 7.911628e-001, 7.918324e-001,
+7.925019e-001, 7.931671e-001, 7.938314e-001, 7.944956e-001, 7.951598e-001, 7.958227e-001, 7.964813e-001, 7.971399e-001, 7.977986e-001, 7.984572e-001,
+7.991124e-001, 7.997658e-001, 8.004191e-001, 8.010725e-001, 8.017258e-001, 8.023747e-001, 8.030235e-001, 8.036724e-001, 8.043212e-001, 8.049684e-001,
+8.056119e-001, 8.062555e-001, 8.068990e-001, 8.075426e-001, 8.081833e-001, 8.088220e-001, 8.094608e-001, 8.100996e-001, 8.107383e-001, 8.113725e-001,
+8.120058e-001, 8.126390e-001, 8.132723e-001, 8.139054e-001, 8.145325e-001, 8.151596e-001, 8.157867e-001, 8.164138e-001, 8.170399e-001, 8.176615e-001,
+8.182831e-001, 8.189047e-001, 8.195264e-001, 8.201465e-001, 8.207633e-001, 8.213801e-001, 8.219968e-001, 8.226136e-001, 8.232283e-001, 8.238397e-001,
+8.244510e-001, 8.250624e-001, 8.256737e-001, 8.262824e-001, 8.268875e-001, 8.274925e-001, 8.280975e-001, 8.287026e-001, 8.293049e-001, 8.299033e-001,
+8.305016e-001, 8.311000e-001, 8.316984e-001, 8.322945e-001, 8.328867e-001, 8.334789e-001, 8.340711e-001, 8.346633e-001, 8.352540e-001, 8.358410e-001,
+8.364279e-001, 8.370148e-001, 8.376017e-001, 8.381877e-001, 8.387685e-001, 8.393492e-001, 8.399300e-001, 8.405107e-001, 8.410914e-001, 8.416661e-001,
+8.422406e-001, 8.428151e-001, 8.433897e-001, 8.439642e-001, 8.445344e-001, 8.451033e-001, 8.456722e-001, 8.462411e-001, 8.468100e-001, 8.473766e-001,
+8.479408e-001, 8.485050e-001, 8.490693e-001, 8.496335e-001, 8.501965e-001, 8.507545e-001, 8.513124e-001, 8.518704e-001, 8.524283e-001, 8.529863e-001,
+8.535386e-001, 8.540899e-001, 8.546412e-001, 8.551925e-001, 8.557438e-001, 8.562925e-001, 8.568380e-001, 8.573835e-001, 8.579290e-001, 8.584745e-001,
+8.590199e-001, 8.595605e-001, 8.601011e-001, 8.606416e-001, 8.611822e-001, 8.617228e-001, 8.622605e-001, 8.627956e-001, 8.633308e-001, 8.638659e-001,
+8.644011e-001, 8.649361e-001, 8.654658e-001, 8.659955e-001, 8.665252e-001, 8.670549e-001, 8.675846e-001, 8.681117e-001, 8.686357e-001, 8.691598e-001,
+8.696838e-001, 8.702078e-001, 8.707318e-001, 8.712516e-001, 8.717706e-001, 8.722896e-001, 8.728086e-001, 8.733276e-001, 8.738457e-001, 8.743596e-001,
+8.748735e-001, 8.753873e-001, 8.759012e-001, 8.764151e-001, 8.769265e-001, 8.774348e-001, 8.779432e-001, 8.784516e-001, 8.789599e-001, 8.794683e-001,
+8.799737e-001, 8.804777e-001, 8.809818e-001, 8.814858e-001, 8.819898e-001, 8.824939e-001, 8.829929e-001, 8.834912e-001, 8.839896e-001, 8.844879e-001,
+8.849862e-001, 8.854844e-001, 8.859770e-001, 8.864695e-001, 8.869621e-001, 8.874546e-001, 8.879472e-001, 8.884391e-001, 8.889269e-001, 8.894146e-001,
+8.899024e-001, 8.903901e-001, 8.908779e-001, 8.913648e-001, 8.918477e-001, 8.923306e-001, 8.928135e-001, 8.932964e-001, 8.937793e-001, 8.942612e-001,
+8.947381e-001, 8.952149e-001, 8.956918e-001, 8.961687e-001, 8.966455e-001, 8.971219e-001, 8.975936e-001, 8.980653e-001, 8.985370e-001, 8.990087e-001,
+8.994804e-001, 8.999521e-001, 9.004189e-001, 9.008856e-001, 9.013523e-001, 9.018190e-001, 9.022857e-001, 9.027525e-001, 9.032139e-001, 9.036745e-001,
+9.041351e-001, 9.045957e-001, 9.050562e-001, 9.055168e-001, 9.059741e-001, 9.064297e-001, 9.068853e-001, 9.073409e-001, 9.077964e-001, 9.082520e-001,
+9.087056e-001, 9.091561e-001, 9.096067e-001, 9.100572e-001, 9.105078e-001, 9.109583e-001, 9.114085e-001, 9.118541e-001, 9.122998e-001, 9.127454e-001,
+9.131911e-001, 9.136367e-001, 9.140823e-001, 9.145245e-001, 9.149653e-001, 9.154061e-001, 9.158469e-001, 9.162878e-001, 9.167286e-001, 9.171675e-001,
+9.176025e-001, 9.180374e-001, 9.184723e-001, 9.189073e-001, 9.193422e-001, 9.197771e-001, 9.202072e-001, 9.206364e-001, 9.210656e-001, 9.214947e-001,
+9.219239e-001, 9.223531e-001, 9.227808e-001, 9.232054e-001, 9.236299e-001, 9.240545e-001, 9.244791e-001, 9.249036e-001, 9.253282e-001, 9.257494e-001,
+9.261695e-001, 9.265896e-001, 9.270097e-001, 9.274298e-001, 9.278499e-001, 9.282693e-001, 9.286841e-001, 9.290989e-001, 9.295136e-001, 9.299284e-001,
+9.303432e-001, 9.307580e-001, 9.311706e-001, 9.315806e-001, 9.319906e-001, 9.324006e-001, 9.328106e-001, 9.332206e-001, 9.336306e-001, 9.340372e-001,
+9.344423e-001, 9.348474e-001, 9.352525e-001, 9.356576e-001, 9.360627e-001, 9.364678e-001, 9.368677e-001, 9.372671e-001, 9.376664e-001, 9.380658e-001,
+9.384652e-001, 9.388645e-001, 9.392636e-001, 9.396575e-001, 9.400514e-001, 9.404454e-001, 9.408393e-001, 9.412332e-001, 9.416271e-001, 9.420205e-001,
+9.424102e-001, 9.428000e-001, 9.431898e-001, 9.435796e-001, 9.439694e-001, 9.443592e-001, 9.447481e-001, 9.451332e-001, 9.455184e-001, 9.459035e-001,
+9.462886e-001, 9.466737e-001, 9.470589e-001, 9.474430e-001, 9.478217e-001, 9.482004e-001, 9.485791e-001, 9.489578e-001, 9.493365e-001, 9.497152e-001,
+9.500933e-001, 9.504646e-001, 9.508358e-001, 9.512070e-001, 9.515783e-001, 9.519495e-001, 9.523207e-001, 9.526920e-001, 9.530566e-001, 9.534208e-001,
+9.537849e-001, 9.541491e-001, 9.545133e-001, 9.548774e-001, 9.552416e-001, 9.556018e-001, 9.559605e-001, 9.563192e-001, 9.566779e-001, 9.570367e-001,
+9.573954e-001, 9.577541e-001, 9.581106e-001, 9.584644e-001, 9.588183e-001, 9.591721e-001, 9.595260e-001, 9.598799e-001, 9.602337e-001, 9.605869e-001,
+9.609360e-001, 9.612851e-001, 9.616342e-001, 9.619834e-001, 9.623325e-001, 9.626816e-001, 9.630307e-001, 9.633762e-001, 9.637207e-001, 9.640651e-001,
+9.644096e-001, 9.647540e-001, 9.650985e-001, 9.654429e-001, 9.657856e-001, 9.661248e-001, 9.664641e-001, 9.668033e-001, 9.671425e-001, 9.674817e-001,
+9.678210e-001, 9.681602e-001, 9.684945e-001, 9.688279e-001, 9.691612e-001, 9.694945e-001, 9.698279e-001, 9.701612e-001, 9.704945e-001, 9.708264e-001,
+9.711540e-001, 9.714816e-001, 9.718093e-001, 9.721369e-001, 9.724645e-001, 9.727921e-001, 9.731198e-001, 9.734438e-001, 9.737657e-001, 9.740876e-001,
+9.744096e-001, 9.747315e-001, 9.750534e-001, 9.753754e-001, 9.756973e-001, 9.760133e-001, 9.763289e-001, 9.766446e-001, 9.769602e-001, 9.772758e-001,
+9.775915e-001, 9.779071e-001, 9.782215e-001, 9.785307e-001, 9.788398e-001, 9.791489e-001, 9.794580e-001, 9.797672e-001, 9.800763e-001, 9.803854e-001,
+9.806922e-001, 9.809947e-001, 9.812973e-001, 9.815999e-001, 9.819025e-001, 9.822050e-001, 9.825076e-001, 9.828102e-001, 9.831093e-001, 9.834047e-001,
+9.837002e-001, 9.839956e-001, 9.842910e-001, 9.845864e-001, 9.848818e-001, 9.851772e-001, 9.854683e-001, 9.857557e-001, 9.860430e-001, 9.863304e-001,
+9.866177e-001, 9.869051e-001, 9.871924e-001, 9.874798e-001, 9.877628e-001, 9.880418e-001, 9.883208e-001, 9.885998e-001, 9.888788e-001, 9.891578e-001,
+9.894368e-001, 9.897158e-001, 9.899905e-001, 9.902597e-001, 9.905289e-001, 9.907981e-001, 9.910673e-001, 9.913365e-001, 9.916057e-001, 9.918749e-001,
+9.921409e-001, 9.923989e-001, 9.926569e-001, 9.929149e-001, 9.931729e-001, 9.934309e-001, 9.936889e-001, 9.939469e-001, 9.942042e-001, 9.944510e-001,
+9.946978e-001, 9.949446e-001, 9.951914e-001, 9.954382e-001, 9.956850e-001, 9.959318e-001, 9.961787e-001, 9.964145e-001, 9.966473e-001, 9.968800e-001,
+9.971128e-001, 9.973455e-001, 9.975783e-001, 9.978110e-001, 9.980438e-001, 9.982696e-001, 9.984859e-001, 9.987022e-001, 9.989185e-001, 9.991348e-001,
+9.993511e-001, 9.995674e-001, 9.997837e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.811227e-003, 1.671620e-002, 2.352436e-002, 2.973585e-002, 3.559870e-002, 4.122454e-002, 4.666486e-002, 5.195509e-002, 5.716247e-002,
+6.230875e-002, 6.734685e-002, 7.224172e-002, 7.698786e-002, 8.160732e-002, 8.608678e-002, 9.043968e-002, 9.467990e-002, 9.882097e-002, 1.028661e-001,
+1.068392e-001, 1.107355e-001, 1.145423e-001, 1.182734e-001, 1.219325e-001, 1.255292e-001, 1.290597e-001, 1.325257e-001, 1.359412e-001, 1.393029e-001,
+1.426129e-001, 1.458766e-001, 1.490920e-001, 1.522623e-001, 1.553831e-001, 1.584684e-001, 1.615206e-001, 1.645297e-001, 1.675007e-001, 1.704356e-001,
+1.733425e-001, 1.762109e-001, 1.790487e-001, 1.818662e-001, 1.846543e-001, 1.874138e-001, 1.901446e-001, 1.928485e-001, 1.955289e-001, 1.981831e-001,
+2.008189e-001, 2.034270e-001, 2.060122e-001, 2.085774e-001, 2.111182e-001, 2.136392e-001, 2.161431e-001, 2.186270e-001, 2.210905e-001, 2.235328e-001,
+2.259615e-001, 2.283712e-001, 2.307611e-001, 2.331354e-001, 2.354862e-001, 2.378193e-001, 2.401355e-001, 2.424366e-001, 2.447226e-001, 2.469924e-001,
+2.492519e-001, 2.514968e-001, 2.537238e-001, 2.559402e-001, 2.581428e-001, 2.603318e-001, 2.625106e-001, 2.646790e-001, 2.668366e-001, 2.689833e-001,
+2.711197e-001, 2.732460e-001, 2.753611e-001, 2.774659e-001, 2.795613e-001, 2.816452e-001, 2.837196e-001, 2.857830e-001, 2.878372e-001, 2.898777e-001,
+2.919049e-001, 2.939238e-001, 2.959322e-001, 2.979266e-001, 2.999105e-001, 3.018867e-001, 3.038512e-001, 3.058032e-001, 3.077457e-001, 3.096817e-001,
+3.116079e-001, 3.135225e-001, 3.154281e-001, 3.173281e-001, 3.192209e-001, 3.211036e-001, 3.229758e-001, 3.248390e-001, 3.266923e-001, 3.285366e-001,
+3.303725e-001, 3.322010e-001, 3.340212e-001, 3.358336e-001, 3.376361e-001, 3.394296e-001, 3.412174e-001, 3.429980e-001, 3.447696e-001, 3.465311e-001,
+3.482857e-001, 3.500340e-001, 3.517753e-001, 3.535098e-001, 3.552360e-001, 3.569523e-001, 3.586594e-001, 3.603613e-001, 3.620558e-001, 3.637424e-001,
+3.654215e-001, 3.670936e-001, 3.687597e-001, 3.704194e-001, 3.720717e-001, 3.737153e-001, 3.753502e-001, 3.769771e-001, 3.785960e-001, 3.802081e-001,
+3.818150e-001, 3.834157e-001, 3.850093e-001, 3.865958e-001, 3.881760e-001, 3.897528e-001, 3.913241e-001, 3.928903e-001, 3.944504e-001, 3.960037e-001,
+3.975501e-001, 3.990883e-001, 4.006206e-001, 4.021480e-001, 4.036706e-001, 4.051879e-001, 4.066969e-001, 4.081991e-001, 4.096961e-001, 4.111889e-001,
+4.126753e-001, 4.141557e-001, 4.156310e-001, 4.171016e-001, 4.185652e-001, 4.200241e-001, 4.214783e-001, 4.229276e-001, 4.243702e-001, 4.258085e-001,
+4.272428e-001, 4.286721e-001, 4.300973e-001, 4.315194e-001, 4.329378e-001, 4.343497e-001, 4.357574e-001, 4.371611e-001, 4.385577e-001, 4.399507e-001,
+4.413403e-001, 4.427214e-001, 4.440990e-001, 4.454735e-001, 4.468428e-001, 4.482090e-001, 4.495721e-001, 4.509283e-001, 4.522810e-001, 4.536292e-001,
+4.549719e-001, 4.563121e-001, 4.576482e-001, 4.589804e-001, 4.603103e-001, 4.616335e-001, 4.629541e-001, 4.642721e-001, 4.655845e-001, 4.668945e-001,
+4.681994e-001, 4.694998e-001, 4.707968e-001, 4.720881e-001, 4.733774e-001, 4.746615e-001, 4.759417e-001, 4.772185e-001, 4.784907e-001, 4.797612e-001,
+4.810256e-001, 4.822881e-001, 4.835474e-001, 4.848032e-001, 4.860568e-001, 4.873050e-001, 4.885519e-001, 4.897923e-001, 4.910313e-001, 4.922665e-001,
+4.934988e-001, 4.947275e-001, 4.959533e-001, 4.971774e-001, 4.983973e-001, 4.996160e-001, 5.008294e-001, 5.020419e-001, 5.032485e-001, 5.044538e-001,
+5.056534e-001, 5.068515e-001, 5.080454e-001, 5.092372e-001, 5.104254e-001, 5.116108e-001, 5.127923e-001, 5.139707e-001, 5.151455e-001, 5.163174e-001,
+5.174864e-001, 5.186527e-001, 5.198166e-001, 5.209770e-001, 5.221342e-001, 5.232885e-001, 5.244399e-001, 5.255879e-001, 5.267319e-001, 5.278733e-001,
+5.290108e-001, 5.301455e-001, 5.312751e-001, 5.324027e-001, 5.335251e-001, 5.346460e-001, 5.357597e-001, 5.368732e-001, 5.379807e-001, 5.390881e-001,
+5.401891e-001, 5.412895e-001, 5.423848e-001, 5.434783e-001, 5.445675e-001, 5.456534e-001, 5.467372e-001, 5.478175e-001, 5.488968e-001, 5.499713e-001,
+5.510458e-001, 5.521146e-001, 5.531832e-001, 5.542474e-001, 5.553099e-001, 5.563696e-001, 5.574259e-001, 5.584811e-001, 5.595310e-001, 5.605809e-001,
+5.616252e-001, 5.626686e-001, 5.637084e-001, 5.647452e-001, 5.657806e-001, 5.668106e-001, 5.678407e-001, 5.688649e-001, 5.698880e-001, 5.709079e-001,
+5.719240e-001, 5.729397e-001, 5.739501e-001, 5.749606e-001, 5.759675e-001, 5.769727e-001, 5.779766e-001, 5.789758e-001, 5.799751e-001, 5.809703e-001,
+5.819641e-001, 5.829563e-001, 5.839441e-001, 5.849320e-001, 5.859154e-001, 5.868976e-001, 5.878787e-001, 5.888564e-001, 5.898340e-001, 5.908092e-001,
+5.917833e-001, 5.927567e-001, 5.937263e-001, 5.946959e-001, 5.956636e-001, 5.966296e-001, 5.975957e-001, 5.985575e-001, 5.995191e-001, 6.004796e-001,
+6.014377e-001, 6.023958e-001, 6.033509e-001, 6.043046e-001, 6.052582e-001, 6.062085e-001, 6.071587e-001, 6.081075e-001, 6.090533e-001, 6.099992e-001,
+6.109429e-001, 6.118853e-001, 6.128277e-001, 6.137663e-001, 6.147043e-001, 6.156420e-001, 6.165766e-001, 6.175112e-001, 6.184444e-001, 6.193747e-001,
+6.203050e-001, 6.212336e-001, 6.221605e-001, 6.230874e-001, 6.240114e-001, 6.249340e-001, 6.258567e-001, 6.267765e-001, 6.276958e-001, 6.286151e-001,
+6.295302e-001, 6.304453e-001, 6.313601e-001, 6.322718e-001, 6.331835e-001, 6.340946e-001, 6.350021e-001, 6.359096e-001, 6.368162e-001, 6.377186e-001,
+6.386211e-001, 6.395225e-001, 6.404195e-001, 6.413166e-001, 6.422127e-001, 6.431049e-001, 6.439972e-001, 6.448885e-001, 6.457755e-001, 6.466625e-001,
+6.475486e-001, 6.484292e-001, 6.493097e-001, 6.501898e-001, 6.510640e-001, 6.519382e-001, 6.528124e-001, 6.536806e-001, 6.545486e-001, 6.554166e-001,
+6.562796e-001, 6.571417e-001, 6.580038e-001, 6.588618e-001, 6.597181e-001, 6.605744e-001, 6.614278e-001, 6.622785e-001, 6.631292e-001, 6.639782e-001,
+6.648235e-001, 6.656688e-001, 6.665136e-001, 6.673537e-001, 6.681938e-001, 6.690339e-001, 6.698697e-001, 6.707048e-001, 6.715398e-001, 6.723722e-001,
+6.732023e-001, 6.740325e-001, 6.748616e-001, 6.756870e-001, 6.765125e-001, 6.773380e-001, 6.781579e-001, 6.789773e-001, 6.797966e-001, 6.806130e-001,
+6.814268e-001, 6.822406e-001, 6.830536e-001, 6.838617e-001, 6.846699e-001, 6.854780e-001, 6.862824e-001, 6.870855e-001, 6.878886e-001, 6.886902e-001,
+6.894880e-001, 6.902858e-001, 6.910836e-001, 6.918777e-001, 6.926709e-001, 6.934641e-001, 6.942555e-001, 6.950422e-001, 6.958290e-001, 6.966157e-001,
+6.973985e-001, 6.981800e-001, 6.989614e-001, 6.997418e-001, 7.005175e-001, 7.012931e-001, 7.020687e-001, 7.028417e-001, 7.036127e-001, 7.043837e-001,
+7.051547e-001, 7.059207e-001, 7.066865e-001, 7.074524e-001, 7.082165e-001, 7.089767e-001, 7.097369e-001, 7.104971e-001, 7.112538e-001, 7.120084e-001,
+7.127629e-001, 7.135175e-001, 7.142676e-001, 7.150173e-001, 7.157669e-001, 7.165158e-001, 7.172605e-001, 7.180053e-001, 7.187500e-001, 7.194931e-001,
+7.202336e-001, 7.209741e-001, 7.217147e-001, 7.224528e-001, 7.231891e-001, 7.239254e-001, 7.246617e-001, 7.253944e-001, 7.261256e-001, 7.268568e-001,
+7.275880e-001, 7.283154e-001, 7.290420e-001, 7.297686e-001, 7.304952e-001, 7.312179e-001, 7.319403e-001, 7.326627e-001, 7.333851e-001, 7.341023e-001,
+7.348195e-001, 7.355366e-001, 7.362537e-001, 7.369665e-001, 7.376793e-001, 7.383921e-001, 7.391047e-001, 7.398132e-001, 7.405217e-001, 7.412303e-001,
+7.419388e-001, 7.426439e-001, 7.433489e-001, 7.440540e-001, 7.447591e-001, 7.454611e-001, 7.461628e-001, 7.468645e-001, 7.475662e-001, 7.482659e-001,
+7.489652e-001, 7.496644e-001, 7.503636e-001, 7.510594e-001, 7.517535e-001, 7.524476e-001, 7.531417e-001, 7.538337e-001, 7.545236e-001, 7.552135e-001,
+7.559034e-001, 7.565920e-001, 7.572778e-001, 7.579636e-001, 7.586494e-001, 7.593350e-001, 7.600161e-001, 7.606972e-001, 7.613783e-001, 7.620594e-001,
+7.627364e-001, 7.634122e-001, 7.640880e-001, 7.647637e-001, 7.654371e-001, 7.661076e-001, 7.667781e-001, 7.674486e-001, 7.681186e-001, 7.687847e-001,
+7.694507e-001, 7.701168e-001, 7.707829e-001, 7.714447e-001, 7.721049e-001, 7.727652e-001, 7.734254e-001, 7.740842e-001, 7.747399e-001, 7.753956e-001,
+7.760513e-001, 7.767070e-001, 7.773586e-001, 7.780096e-001, 7.786605e-001, 7.793114e-001, 7.799606e-001, 7.806067e-001, 7.812528e-001, 7.818988e-001,
+7.825449e-001, 7.831871e-001, 7.838285e-001, 7.844698e-001, 7.851112e-001, 7.857516e-001, 7.863893e-001, 7.870269e-001, 7.876645e-001, 7.883022e-001,
+7.889375e-001, 7.895716e-001, 7.902057e-001, 7.908398e-001, 7.914739e-001, 7.921039e-001, 7.927339e-001, 7.933639e-001, 7.939940e-001, 7.946221e-001,
+7.952463e-001, 7.958705e-001, 7.964947e-001, 7.971189e-001, 7.977400e-001, 7.983589e-001, 7.989779e-001, 7.995969e-001, 8.002159e-001, 8.008310e-001,
+8.014454e-001, 8.020598e-001, 8.026742e-001, 8.032884e-001, 8.038988e-001, 8.045093e-001, 8.051197e-001, 8.057301e-001, 8.063399e-001, 8.069469e-001,
+8.075540e-001, 8.081610e-001, 8.087680e-001, 8.093743e-001, 8.099786e-001, 8.105829e-001, 8.111872e-001, 8.117915e-001, 8.123940e-001, 8.129937e-001,
+8.135934e-001, 8.141930e-001, 8.147927e-001, 8.153901e-001, 8.159844e-001, 8.165788e-001, 8.171731e-001, 8.177674e-001, 8.183600e-001, 8.189500e-001,
+8.195400e-001, 8.201300e-001, 8.207200e-001, 8.213085e-001, 8.218945e-001, 8.224805e-001, 8.230665e-001, 8.236525e-001, 8.242376e-001, 8.248206e-001,
+8.254036e-001, 8.259866e-001, 8.265695e-001, 8.271518e-001, 8.277296e-001, 8.283075e-001, 8.288854e-001, 8.294633e-001, 8.300412e-001, 8.306139e-001,
+8.311864e-001, 8.317590e-001, 8.323315e-001, 8.329041e-001, 8.334731e-001, 8.340410e-001, 8.346089e-001, 8.351768e-001, 8.357447e-001, 8.363107e-001,
+8.368747e-001, 8.374386e-001, 8.380026e-001, 8.385666e-001, 8.391300e-001, 8.396907e-001, 8.402515e-001, 8.408122e-001, 8.413730e-001, 8.419337e-001,
+8.424912e-001, 8.430480e-001, 8.436049e-001, 8.441618e-001, 8.447187e-001, 8.452732e-001, 8.458250e-001, 8.463768e-001, 8.469286e-001, 8.474804e-001,
+8.480321e-001, 8.485792e-001, 8.491264e-001, 8.496735e-001, 8.502206e-001, 8.507678e-001, 8.513129e-001, 8.518565e-001, 8.524000e-001, 8.529436e-001,
+8.534871e-001, 8.540306e-001, 8.545700e-001, 8.551094e-001, 8.556488e-001, 8.561882e-001, 8.567275e-001, 8.572648e-001, 8.577995e-001, 8.583341e-001,
+8.588688e-001, 8.594035e-001, 8.599381e-001, 8.604687e-001, 8.609984e-001, 8.615282e-001, 8.620579e-001, 8.625877e-001, 8.631167e-001, 8.636424e-001,
+8.641680e-001, 8.646936e-001, 8.652193e-001, 8.657449e-001, 8.662691e-001, 8.667913e-001, 8.673136e-001, 8.678359e-001, 8.683582e-001, 8.688805e-001,
+8.694002e-001, 8.699188e-001, 8.704373e-001, 8.709559e-001, 8.714744e-001, 8.719930e-001, 8.725072e-001, 8.730208e-001, 8.735345e-001, 8.740481e-001,
+8.745617e-001, 8.750753e-001, 8.755845e-001, 8.760938e-001, 8.766030e-001, 8.771122e-001, 8.776215e-001, 8.781303e-001, 8.786363e-001, 8.791423e-001,
+8.796483e-001, 8.801543e-001, 8.806602e-001, 8.811656e-001, 8.816679e-001, 8.821702e-001, 8.826724e-001, 8.831747e-001, 8.836770e-001, 8.841786e-001,
+8.846768e-001, 8.851750e-001, 8.856732e-001, 8.861714e-001, 8.866696e-001, 8.871674e-001, 8.876613e-001, 8.881553e-001, 8.886492e-001, 8.891432e-001,
+8.896371e-001, 8.901311e-001, 8.906217e-001, 8.911123e-001, 8.916029e-001, 8.920935e-001, 8.925841e-001, 8.930747e-001, 8.935613e-001, 8.940473e-001,
+8.945332e-001, 8.950192e-001, 8.955052e-001, 8.959911e-001, 8.964738e-001, 8.969547e-001, 8.974357e-001, 8.979166e-001, 8.983975e-001, 8.988784e-001,
+8.993578e-001, 8.998349e-001, 9.003120e-001, 9.007890e-001, 9.012661e-001, 9.017432e-001, 9.022199e-001, 9.026929e-001, 9.031658e-001, 9.036388e-001,
+9.041117e-001, 9.045847e-001, 9.050576e-001, 9.055282e-001, 9.059979e-001, 9.064676e-001, 9.069373e-001, 9.074069e-001, 9.078766e-001, 9.083452e-001,
+9.088113e-001, 9.092774e-001, 9.097435e-001, 9.102095e-001, 9.106756e-001, 9.111417e-001, 9.116048e-001, 9.120673e-001, 9.125298e-001, 9.129923e-001,
+9.134547e-001, 9.139172e-001, 9.143786e-001, 9.148374e-001, 9.152963e-001, 9.157551e-001, 9.162140e-001, 9.166729e-001, 9.171317e-001, 9.175868e-001,
+9.180406e-001, 9.184945e-001, 9.189483e-001, 9.194022e-001, 9.198560e-001, 9.203092e-001, 9.207581e-001, 9.212069e-001, 9.216557e-001, 9.221045e-001,
+9.225534e-001, 9.230022e-001, 9.234492e-001, 9.238939e-001, 9.243386e-001, 9.247833e-001, 9.252280e-001, 9.256727e-001, 9.261174e-001, 9.265592e-001,
+9.269996e-001, 9.274401e-001, 9.278805e-001, 9.283210e-001, 9.287614e-001, 9.292019e-001, 9.296385e-001, 9.300747e-001, 9.305109e-001, 9.309471e-001,
+9.313833e-001, 9.318195e-001, 9.322556e-001, 9.326886e-001, 9.331216e-001, 9.335546e-001, 9.339876e-001, 9.344206e-001, 9.348536e-001, 9.352860e-001,
+9.357148e-001, 9.361436e-001, 9.365725e-001, 9.370013e-001, 9.374301e-001, 9.378590e-001, 9.382869e-001, 9.387105e-001, 9.391341e-001, 9.395577e-001,
+9.399812e-001, 9.404048e-001, 9.408284e-001, 9.412512e-001, 9.416697e-001, 9.420882e-001, 9.425067e-001, 9.429252e-001, 9.433437e-001, 9.437622e-001,
+9.441802e-001, 9.445917e-001, 9.450031e-001, 9.454146e-001, 9.458261e-001, 9.462375e-001, 9.466490e-001, 9.470605e-001, 9.474643e-001, 9.478675e-001,
+9.482708e-001, 9.486741e-001, 9.490773e-001, 9.494806e-001, 9.498839e-001, 9.502829e-001, 9.506805e-001, 9.510780e-001, 9.514756e-001, 9.518731e-001,
+9.522707e-001, 9.526682e-001, 9.530637e-001, 9.534568e-001, 9.538499e-001, 9.542430e-001, 9.546362e-001, 9.550293e-001, 9.554224e-001, 9.558149e-001,
+9.562035e-001, 9.565922e-001, 9.569808e-001, 9.573695e-001, 9.577582e-001, 9.581468e-001, 9.585355e-001, 9.589206e-001, 9.593047e-001, 9.596888e-001,
+9.600729e-001, 9.604570e-001, 9.608411e-001, 9.612252e-001, 9.616078e-001, 9.619873e-001, 9.623668e-001, 9.627463e-001, 9.631258e-001, 9.635053e-001,
+9.638847e-001, 9.642642e-001, 9.646392e-001, 9.650132e-001, 9.653872e-001, 9.657612e-001, 9.661352e-001, 9.665092e-001, 9.668832e-001, 9.672556e-001,
+9.676234e-001, 9.679911e-001, 9.683589e-001, 9.687266e-001, 9.690944e-001, 9.694622e-001, 9.698299e-001, 9.701938e-001, 9.705553e-001, 9.709169e-001,
+9.712784e-001, 9.716400e-001, 9.720015e-001, 9.723631e-001, 9.727246e-001, 9.730801e-001, 9.734352e-001, 9.737904e-001, 9.741455e-001, 9.745006e-001,
+9.748557e-001, 9.752108e-001, 9.755647e-001, 9.759128e-001, 9.762609e-001, 9.766091e-001, 9.769572e-001, 9.773054e-001, 9.776535e-001, 9.780016e-001,
+9.783469e-001, 9.786871e-001, 9.790272e-001, 9.793674e-001, 9.797076e-001, 9.800478e-001, 9.803880e-001, 9.807282e-001, 9.810643e-001, 9.813960e-001,
+9.817278e-001, 9.820596e-001, 9.823913e-001, 9.827231e-001, 9.830548e-001, 9.833866e-001, 9.837135e-001, 9.840362e-001, 9.843589e-001, 9.846815e-001,
+9.850042e-001, 9.853269e-001, 9.856495e-001, 9.859722e-001, 9.862895e-001, 9.866018e-001, 9.869141e-001, 9.872264e-001, 9.875387e-001, 9.878510e-001,
+9.881633e-001, 9.884756e-001, 9.887828e-001, 9.890834e-001, 9.893840e-001, 9.896846e-001, 9.899852e-001, 9.902858e-001, 9.905864e-001, 9.908870e-001,
+9.911843e-001, 9.914735e-001, 9.917626e-001, 9.920518e-001, 9.923410e-001, 9.926301e-001, 9.929193e-001, 9.932084e-001, 9.934968e-001, 9.937735e-001,
+9.940503e-001, 9.943270e-001, 9.946038e-001, 9.948805e-001, 9.951573e-001, 9.954340e-001, 9.957108e-001, 9.959758e-001, 9.962376e-001, 9.964993e-001,
+9.967610e-001, 9.970228e-001, 9.972845e-001, 9.975462e-001, 9.978079e-001, 9.980614e-001, 9.983038e-001, 9.985461e-001, 9.987884e-001, 9.990307e-001,
+9.992730e-001, 9.995154e-001, 9.997577e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.740941e-003, 1.313481e-002, 1.878779e-002, 2.395187e-002, 2.881436e-002, 3.343901e-002, 3.787853e-002, 4.216762e-002, 4.634367e-002,
+5.043180e-002, 5.442794e-002, 5.834366e-002, 6.219810e-002, 6.599579e-002, 6.974945e-002, 7.346073e-002, 7.712528e-002, 8.074789e-002, 8.433027e-002,
+8.787012e-002, 9.137159e-002, 9.483814e-002, 9.825832e-002, 1.016350e-001, 1.049720e-001, 1.082688e-001, 1.115282e-001, 1.147559e-001, 1.179407e-001,
+1.210892e-001, 1.242010e-001, 1.272724e-001, 1.303057e-001, 1.333058e-001, 1.362699e-001, 1.391921e-001, 1.420772e-001, 1.449284e-001, 1.477468e-001,
+1.505275e-001, 1.532688e-001, 1.559778e-001, 1.586565e-001, 1.613045e-001, 1.639243e-001, 1.665160e-001, 1.690804e-001, 1.716224e-001, 1.741401e-001,
+1.766291e-001, 1.790864e-001, 1.815200e-001, 1.839299e-001, 1.863144e-001, 1.886769e-001, 1.910152e-001, 1.933257e-001, 1.956082e-001, 1.978694e-001,
+2.001122e-001, 2.023327e-001, 2.045315e-001, 2.067105e-001, 2.088732e-001, 2.110181e-001, 2.131436e-001, 2.152540e-001, 2.173457e-001, 2.194203e-001,
+2.214789e-001, 2.235200e-001, 2.255467e-001, 2.275560e-001, 2.295472e-001, 2.315239e-001, 2.334857e-001, 2.354328e-001, 2.373681e-001, 2.392894e-001,
+2.411931e-001, 2.430836e-001, 2.449620e-001, 2.468271e-001, 2.486820e-001, 2.505276e-001, 2.523605e-001, 2.541793e-001, 2.559899e-001, 2.577918e-001,
+2.595866e-001, 2.613757e-001, 2.631561e-001, 2.649283e-001, 2.666937e-001, 2.684526e-001, 2.702022e-001, 2.719438e-001, 2.736783e-001, 2.754063e-001,
+2.771282e-001, 2.788480e-001, 2.805649e-001, 2.822759e-001, 2.839804e-001, 2.856812e-001, 2.873789e-001, 2.890718e-001, 2.907603e-001, 2.924446e-001,
+2.941254e-001, 2.958012e-001, 2.974715e-001, 2.991387e-001, 3.008036e-001, 3.024663e-001, 3.041245e-001, 3.057766e-001, 3.074248e-001, 3.090695e-001,
+3.107110e-001, 3.123489e-001, 3.139819e-001, 3.156123e-001, 3.172419e-001, 3.188686e-001, 3.204928e-001, 3.221143e-001, 3.237331e-001, 3.253496e-001,
+3.269616e-001, 3.285693e-001, 3.301743e-001, 3.317769e-001, 3.333773e-001, 3.349755e-001, 3.365707e-001, 3.381619e-001, 3.397506e-001, 3.413364e-001,
+3.429176e-001, 3.444959e-001, 3.460717e-001, 3.476449e-001, 3.492156e-001, 3.507838e-001, 3.523464e-001, 3.539064e-001, 3.554648e-001, 3.570212e-001,
+3.585750e-001, 3.601273e-001, 3.616780e-001, 3.632258e-001, 3.647711e-001, 3.663146e-001, 3.678534e-001, 3.693885e-001, 3.709209e-001, 3.724510e-001,
+3.739764e-001, 3.754991e-001, 3.770196e-001, 3.785376e-001, 3.800503e-001, 3.815600e-001, 3.830671e-001, 3.845714e-001, 3.860713e-001, 3.875695e-001,
+3.890654e-001, 3.905575e-001, 3.920452e-001, 3.935315e-001, 3.950170e-001, 3.964990e-001, 3.979789e-001, 3.994568e-001, 4.009310e-001, 4.024015e-001,
+4.038689e-001, 4.053324e-001, 4.067930e-001, 4.082512e-001, 4.097049e-001, 4.111567e-001, 4.126070e-001, 4.140539e-001, 4.154989e-001, 4.169419e-001,
+4.183813e-001, 4.198183e-001, 4.212512e-001, 4.226809e-001, 4.241089e-001, 4.255332e-001, 4.269538e-001, 4.283714e-001, 4.297845e-001, 4.311958e-001,
+4.326033e-001, 4.340074e-001, 4.354094e-001, 4.368061e-001, 4.382003e-001, 4.395891e-001, 4.409743e-001, 4.423571e-001, 4.437364e-001, 4.451142e-001,
+4.464867e-001, 4.478575e-001, 4.492257e-001, 4.505923e-001, 4.519579e-001, 4.533195e-001, 4.546800e-001, 4.560364e-001, 4.573906e-001, 4.587404e-001,
+4.600867e-001, 4.614297e-001, 4.627694e-001, 4.641076e-001, 4.654399e-001, 4.667711e-001, 4.680955e-001, 4.694189e-001, 4.707361e-001, 4.720517e-001,
+4.733620e-001, 4.746706e-001, 4.759757e-001, 4.772787e-001, 4.785787e-001, 4.798755e-001, 4.811686e-001, 4.824582e-001, 4.837445e-001, 4.850262e-001,
+4.863041e-001, 4.875772e-001, 4.888467e-001, 4.901135e-001, 4.913784e-001, 4.926397e-001, 4.938982e-001, 4.951525e-001, 4.964029e-001, 4.976497e-001,
+4.988923e-001, 5.001319e-001, 5.013671e-001, 5.025999e-001, 5.038275e-001, 5.050537e-001, 5.062743e-001, 5.074943e-001, 5.087080e-001, 5.099217e-001,
+5.111290e-001, 5.123361e-001, 5.135380e-001, 5.147388e-001, 5.159347e-001, 5.171278e-001, 5.183177e-001, 5.195038e-001, 5.206878e-001, 5.218652e-001,
+5.230425e-001, 5.242116e-001, 5.253807e-001, 5.265438e-001, 5.277051e-001, 5.288619e-001, 5.300141e-001, 5.311649e-001, 5.323101e-001, 5.334553e-001,
+5.345946e-001, 5.357334e-001, 5.368677e-001, 5.379990e-001, 5.391280e-001, 5.402506e-001, 5.413732e-001, 5.424871e-001, 5.435999e-001, 5.447079e-001,
+5.458114e-001, 5.469142e-001, 5.480110e-001, 5.491078e-001, 5.501992e-001, 5.512882e-001, 5.523753e-001, 5.534571e-001, 5.545389e-001, 5.556156e-001,
+5.566910e-001, 5.577640e-001, 5.588322e-001, 5.599003e-001, 5.609617e-001, 5.620217e-001, 5.630790e-001, 5.641300e-001, 5.651810e-001, 5.662257e-001,
+5.672683e-001, 5.683095e-001, 5.693449e-001, 5.703803e-001, 5.714108e-001, 5.724382e-001, 5.734654e-001, 5.744841e-001, 5.755029e-001, 5.765180e-001,
+5.775272e-001, 5.785365e-001, 5.795395e-001, 5.805403e-001, 5.815406e-001, 5.825339e-001, 5.835272e-001, 5.845176e-001, 5.855030e-001, 5.864885e-001,
+5.874684e-001, 5.884453e-001, 5.894222e-001, 5.903909e-001, 5.913589e-001, 5.923254e-001, 5.932838e-001, 5.942422e-001, 5.951976e-001, 5.961477e-001,
+5.970979e-001, 5.980440e-001, 5.989869e-001, 5.999299e-001, 6.008662e-001, 6.018002e-001, 6.027342e-001, 6.036600e-001, 6.045848e-001, 6.055094e-001,
+6.064245e-001, 6.073396e-001, 6.082539e-001, 6.091608e-001, 6.100676e-001, 6.109727e-001, 6.118695e-001, 6.127663e-001, 6.136608e-001, 6.145475e-001,
+6.154342e-001, 6.163187e-001, 6.171966e-001, 6.180745e-001, 6.189502e-001, 6.198194e-001, 6.206886e-001, 6.215558e-001, 6.224161e-001, 6.232765e-001,
+6.241352e-001, 6.249868e-001, 6.258384e-001, 6.266891e-001, 6.275334e-001, 6.283778e-001, 6.292220e-001, 6.300593e-001, 6.308966e-001, 6.317339e-001,
+6.325649e-001, 6.333951e-001, 6.342253e-001, 6.350504e-001, 6.358737e-001, 6.366970e-001, 6.375164e-001, 6.383328e-001, 6.391491e-001, 6.399635e-001,
+6.407744e-001, 6.415853e-001, 6.423955e-001, 6.432009e-001, 6.440064e-001, 6.448118e-001, 6.456126e-001, 6.464127e-001, 6.472128e-001, 6.480098e-001,
+6.488046e-001, 6.495994e-001, 6.503927e-001, 6.511823e-001, 6.519718e-001, 6.527614e-001, 6.535461e-001, 6.543304e-001, 6.551148e-001, 6.558971e-001,
+6.566780e-001, 6.574588e-001, 6.582391e-001, 6.590166e-001, 6.597941e-001, 6.605717e-001, 6.613467e-001, 6.621211e-001, 6.628954e-001, 6.636688e-001,
+6.644401e-001, 6.652114e-001, 6.659826e-001, 6.667515e-001, 6.675199e-001, 6.682883e-001, 6.690558e-001, 6.698214e-001, 6.705870e-001, 6.713527e-001,
+6.721163e-001, 6.728793e-001, 6.736423e-001, 6.744048e-001, 6.751654e-001, 6.759259e-001, 6.766865e-001, 6.774456e-001, 6.782039e-001, 6.789621e-001,
+6.797204e-001, 6.804765e-001, 6.812326e-001, 6.819887e-001, 6.827441e-001, 6.834982e-001, 6.842523e-001, 6.850064e-001, 6.857592e-001, 6.865115e-001,
+6.872637e-001, 6.880159e-001, 6.887665e-001, 6.895171e-001, 6.902676e-001, 6.910178e-001, 6.917668e-001, 6.925157e-001, 6.932647e-001, 6.940131e-001,
+6.947606e-001, 6.955082e-001, 6.962557e-001, 6.970025e-001, 6.977488e-001, 6.984951e-001, 6.992414e-001, 6.999868e-001, 7.007320e-001, 7.014772e-001,
+7.022224e-001, 7.029679e-001, 7.037135e-001, 7.044591e-001, 7.052048e-001, 7.059508e-001, 7.066968e-001, 7.074428e-001, 7.081889e-001, 7.089355e-001,
+7.096820e-001, 7.104286e-001, 7.111751e-001, 7.119208e-001, 7.126665e-001, 7.134122e-001, 7.141578e-001, 7.149026e-001, 7.156473e-001, 7.163921e-001,
+7.171369e-001, 7.178807e-001, 7.186246e-001, 7.193684e-001, 7.201123e-001, 7.208564e-001, 7.216006e-001, 7.223448e-001, 7.230889e-001, 7.238322e-001,
+7.245753e-001, 7.253184e-001, 7.260615e-001, 7.268038e-001, 7.275457e-001, 7.282876e-001, 7.290295e-001, 7.297708e-001, 7.305114e-001, 7.312521e-001,
+7.319927e-001, 7.327329e-001, 7.334721e-001, 7.342114e-001, 7.349506e-001, 7.356897e-001, 7.364275e-001, 7.371652e-001, 7.379029e-001, 7.386407e-001,
+7.393771e-001, 7.401133e-001, 7.408494e-001, 7.415855e-001, 7.423208e-001, 7.430553e-001, 7.437897e-001, 7.445241e-001, 7.452583e-001, 7.459909e-001,
+7.467235e-001, 7.474561e-001, 7.481887e-001, 7.489198e-001, 7.496505e-001, 7.503812e-001, 7.511119e-001, 7.518419e-001, 7.525705e-001, 7.532991e-001,
+7.540278e-001, 7.547564e-001, 7.554832e-001, 7.562097e-001, 7.569362e-001, 7.576626e-001, 7.583883e-001, 7.591125e-001, 7.598367e-001, 7.605609e-001,
+7.612852e-001, 7.620074e-001, 7.627292e-001, 7.634511e-001, 7.641729e-001, 7.648941e-001, 7.656134e-001, 7.663328e-001, 7.670521e-001, 7.677715e-001,
+7.684891e-001, 7.692058e-001, 7.699226e-001, 7.706393e-001, 7.713560e-001, 7.720700e-001, 7.727841e-001, 7.734981e-001, 7.742121e-001, 7.749251e-001,
+7.756363e-001, 7.763475e-001, 7.770587e-001, 7.777698e-001, 7.784792e-001, 7.791874e-001, 7.798956e-001, 7.806038e-001, 7.813121e-001, 7.820176e-001,
+7.827228e-001, 7.834279e-001, 7.841331e-001, 7.848380e-001, 7.855400e-001, 7.862420e-001, 7.869439e-001, 7.876459e-001, 7.883471e-001, 7.890458e-001,
+7.897445e-001, 7.904431e-001, 7.911418e-001, 7.918393e-001, 7.925346e-001, 7.932299e-001, 7.939251e-001, 7.946204e-001, 7.953142e-001, 7.960060e-001,
+7.966977e-001, 7.973895e-001, 7.980813e-001, 7.987714e-001, 7.994596e-001, 8.001477e-001, 8.008359e-001, 8.015240e-001, 8.022106e-001, 8.028950e-001,
+8.035795e-001, 8.042639e-001, 8.049484e-001, 8.056313e-001, 8.063120e-001, 8.069926e-001, 8.076733e-001, 8.083540e-001, 8.090334e-001, 8.097102e-001,
+8.103870e-001, 8.110637e-001, 8.117405e-001, 8.124166e-001, 8.130894e-001, 8.137622e-001, 8.144350e-001, 8.151078e-001, 8.157806e-001, 8.164493e-001,
+8.171180e-001, 8.177868e-001, 8.184555e-001, 8.191242e-001, 8.197888e-001, 8.204523e-001, 8.211158e-001, 8.217793e-001, 8.224428e-001, 8.231035e-001,
+8.237618e-001, 8.244200e-001, 8.250783e-001, 8.257365e-001, 8.263936e-001, 8.270465e-001, 8.276994e-001, 8.283523e-001, 8.290052e-001, 8.296582e-001,
+8.303064e-001, 8.309540e-001, 8.316016e-001, 8.322492e-001, 8.328968e-001, 8.335418e-001, 8.341840e-001, 8.348262e-001, 8.354684e-001, 8.361106e-001,
+8.367526e-001, 8.373905e-001, 8.380283e-001, 8.386662e-001, 8.393041e-001, 8.399420e-001, 8.405768e-001, 8.412091e-001, 8.418415e-001, 8.424739e-001,
+8.431062e-001, 8.437384e-001, 8.443654e-001, 8.449924e-001, 8.456194e-001, 8.462464e-001, 8.468734e-001, 8.474979e-001, 8.481195e-001, 8.487411e-001,
+8.493628e-001, 8.499844e-001, 8.506060e-001, 8.512224e-001, 8.518378e-001, 8.524531e-001, 8.530685e-001, 8.536839e-001, 8.542981e-001, 8.549073e-001,
+8.555165e-001, 8.561257e-001, 8.567349e-001, 8.573441e-001, 8.579511e-001, 8.585554e-001, 8.591597e-001, 8.597640e-001, 8.603684e-001, 8.609727e-001,
+8.615737e-001, 8.621734e-001, 8.627730e-001, 8.633727e-001, 8.639724e-001, 8.645720e-001, 8.651665e-001, 8.657605e-001, 8.663544e-001, 8.669483e-001,
+8.675422e-001, 8.681359e-001, 8.687235e-001, 8.693110e-001, 8.698986e-001, 8.704862e-001, 8.710737e-001, 8.716604e-001, 8.722419e-001, 8.728233e-001,
+8.734048e-001, 8.739862e-001, 8.745677e-001, 8.751480e-001, 8.757237e-001, 8.762993e-001, 8.768750e-001, 8.774506e-001, 8.780263e-001, 8.786009e-001,
+8.791710e-001, 8.797411e-001, 8.803112e-001, 8.808813e-001, 8.814514e-001, 8.820207e-001, 8.825844e-001, 8.831480e-001, 8.837117e-001, 8.842754e-001,
+8.848391e-001, 8.854026e-001, 8.859593e-001, 8.865160e-001, 8.870726e-001, 8.876293e-001, 8.881860e-001, 8.887427e-001, 8.892937e-001, 8.898439e-001,
+8.903940e-001, 8.909442e-001, 8.914943e-001, 8.920445e-001, 8.925905e-001, 8.931344e-001, 8.936784e-001, 8.942223e-001, 8.947663e-001, 8.953102e-001,
+8.958515e-001, 8.963887e-001, 8.969260e-001, 8.974633e-001, 8.980005e-001, 8.985378e-001, 8.990743e-001, 8.996041e-001, 9.001339e-001, 9.006637e-001,
+9.011935e-001, 9.017233e-001, 9.022531e-001, 9.027778e-001, 9.033007e-001, 9.038236e-001, 9.043465e-001, 9.048694e-001, 9.053923e-001, 9.059128e-001,
+9.064284e-001, 9.069439e-001, 9.074595e-001, 9.079750e-001, 9.084906e-001, 9.090061e-001, 9.095148e-001, 9.100225e-001, 9.105301e-001, 9.110377e-001,
+9.115453e-001, 9.120529e-001, 9.125580e-001, 9.130583e-001, 9.135585e-001, 9.140588e-001, 9.145590e-001, 9.150593e-001, 9.155595e-001, 9.160539e-001,
+9.165466e-001, 9.170392e-001, 9.175319e-001, 9.180245e-001, 9.185171e-001, 9.190088e-001, 9.194944e-001, 9.199801e-001, 9.204657e-001, 9.209513e-001,
+9.214370e-001, 9.219226e-001, 9.224053e-001, 9.228845e-001, 9.233637e-001, 9.238429e-001, 9.243221e-001, 9.248013e-001, 9.252805e-001, 9.257541e-001,
+9.262255e-001, 9.266969e-001, 9.271683e-001, 9.276397e-001, 9.281111e-001, 9.285825e-001, 9.290475e-001, 9.295118e-001, 9.299762e-001, 9.304406e-001,
+9.309050e-001, 9.313693e-001, 9.318333e-001, 9.322912e-001, 9.327492e-001, 9.332071e-001, 9.336651e-001, 9.341231e-001, 9.345810e-001, 9.350378e-001,
+9.354882e-001, 9.359385e-001, 9.363889e-001, 9.368392e-001, 9.372896e-001, 9.377400e-001, 9.381887e-001, 9.386303e-001, 9.390719e-001, 9.395135e-001,
+9.399551e-001, 9.403967e-001, 9.408383e-001, 9.412782e-001, 9.417101e-001, 9.421419e-001, 9.425738e-001, 9.430057e-001, 9.434375e-001, 9.438694e-001,
+9.443005e-001, 9.447229e-001, 9.451454e-001, 9.455678e-001, 9.459903e-001, 9.464128e-001, 9.468352e-001, 9.472577e-001, 9.476737e-001, 9.480893e-001,
+9.485050e-001, 9.489206e-001, 9.493362e-001, 9.497518e-001, 9.501674e-001, 9.505790e-001, 9.509891e-001, 9.513992e-001, 9.518093e-001, 9.522194e-001,
+9.526295e-001, 9.530396e-001, 9.534469e-001, 9.538511e-001, 9.542553e-001, 9.546596e-001, 9.550638e-001, 9.554680e-001, 9.558723e-001, 9.562754e-001,
+9.566728e-001, 9.570701e-001, 9.574675e-001, 9.578649e-001, 9.582623e-001, 9.586596e-001, 9.590570e-001, 9.594490e-001, 9.598394e-001, 9.602298e-001,
+9.606203e-001, 9.610107e-001, 9.614012e-001, 9.617916e-001, 9.621797e-001, 9.625632e-001, 9.629466e-001, 9.633301e-001, 9.637135e-001, 9.640970e-001,
+9.644804e-001, 9.648639e-001, 9.652414e-001, 9.656178e-001, 9.659942e-001, 9.663706e-001, 9.667470e-001, 9.671234e-001, 9.674998e-001, 9.678742e-001,
+9.682434e-001, 9.686125e-001, 9.689817e-001, 9.693508e-001, 9.697200e-001, 9.700892e-001, 9.704583e-001, 9.708226e-001, 9.711841e-001, 9.715457e-001,
+9.719072e-001, 9.722688e-001, 9.726303e-001, 9.729919e-001, 9.733534e-001, 9.737071e-001, 9.740604e-001, 9.744137e-001, 9.747670e-001, 9.751202e-001,
+9.754735e-001, 9.758268e-001, 9.761784e-001, 9.765232e-001, 9.768681e-001, 9.772129e-001, 9.775577e-001, 9.779025e-001, 9.782473e-001, 9.785921e-001,
+9.789336e-001, 9.792693e-001, 9.796050e-001, 9.799408e-001, 9.802765e-001, 9.806122e-001, 9.809479e-001, 9.812836e-001, 9.816149e-001, 9.819414e-001,
+9.822679e-001, 9.825944e-001, 9.829209e-001, 9.832475e-001, 9.835740e-001, 9.839005e-001, 9.842218e-001, 9.845385e-001, 9.848553e-001, 9.851720e-001,
+9.854888e-001, 9.858055e-001, 9.861223e-001, 9.864390e-001, 9.867502e-001, 9.870561e-001, 9.873620e-001, 9.876679e-001, 9.879738e-001, 9.882797e-001,
+9.885856e-001, 9.888915e-001, 9.891916e-001, 9.894842e-001, 9.897768e-001, 9.900694e-001, 9.903620e-001, 9.906546e-001, 9.909472e-001, 9.912399e-001,
+9.915285e-001, 9.918072e-001, 9.920859e-001, 9.923646e-001, 9.926434e-001, 9.929221e-001, 9.932008e-001, 9.934795e-001, 9.937573e-001, 9.940231e-001,
+9.942888e-001, 9.945546e-001, 9.948203e-001, 9.950861e-001, 9.953518e-001, 9.956176e-001, 9.958834e-001, 9.961376e-001, 9.963885e-001, 9.966395e-001,
+9.968904e-001, 9.971414e-001, 9.973923e-001, 9.976433e-001, 9.978942e-001, 9.981375e-001, 9.983703e-001, 9.986031e-001, 9.988359e-001, 9.990687e-001,
+9.993016e-001, 9.995344e-001, 9.997672e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Futura II 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.752202e-002, 3.023156e-002, 4.073305e-002, 5.010340e-002, 5.872838e-002, 6.687266e-002, 7.462550e-002, 8.211372e-002, 8.936525e-002,
+9.646660e-002, 1.034415e-001, 1.102956e-001, 1.170141e-001, 1.235917e-001, 1.299463e-001, 1.360912e-001, 1.420111e-001, 1.477488e-001, 1.533298e-001,
+1.587764e-001, 1.640834e-001, 1.692634e-001, 1.743295e-001, 1.792752e-001, 1.841227e-001, 1.888727e-001, 1.935238e-001, 1.980873e-001, 2.025565e-001,
+2.069394e-001, 2.112462e-001, 2.154687e-001, 2.196133e-001, 2.236950e-001, 2.277056e-001, 2.316591e-001, 2.355517e-001, 2.393919e-001, 2.431806e-001,
+2.469168e-001, 2.505996e-001, 2.542275e-001, 2.578185e-001, 2.613572e-001, 2.648551e-001, 2.683110e-001, 2.717254e-001, 2.750980e-001, 2.784221e-001,
+2.817072e-001, 2.849533e-001, 2.881663e-001, 2.913444e-001, 2.944832e-001, 2.975896e-001, 3.006661e-001, 3.037150e-001, 3.067281e-001, 3.097102e-001,
+3.126625e-001, 3.155855e-001, 3.184789e-001, 3.213432e-001, 3.241869e-001, 3.270075e-001, 3.298006e-001, 3.325677e-001, 3.353078e-001, 3.380178e-001,
+3.406990e-001, 3.433554e-001, 3.459920e-001, 3.486099e-001, 3.512118e-001, 3.537960e-001, 3.563597e-001, 3.589065e-001, 3.614340e-001, 3.639450e-001,
+3.664398e-001, 3.689151e-001, 3.713718e-001, 3.738072e-001, 3.762201e-001, 3.786139e-001, 3.809884e-001, 3.833450e-001, 3.856789e-001, 3.879950e-001,
+3.902960e-001, 3.925784e-001, 3.948448e-001, 3.970948e-001, 3.993253e-001, 4.015383e-001, 4.037338e-001, 4.059111e-001, 4.080676e-001, 4.102075e-001,
+4.123331e-001, 4.144445e-001, 4.165401e-001, 4.186260e-001, 4.207012e-001, 4.227670e-001, 4.248233e-001, 4.268694e-001, 4.289071e-001, 4.309336e-001,
+4.329520e-001, 4.349603e-001, 4.369597e-001, 4.389463e-001, 4.409210e-001, 4.428839e-001, 4.448338e-001, 4.467688e-001, 4.486895e-001, 4.505964e-001,
+4.524901e-001, 4.543711e-001, 4.562399e-001, 4.580955e-001, 4.599368e-001, 4.617645e-001, 4.635792e-001, 4.653802e-001, 4.671662e-001, 4.689377e-001,
+4.706963e-001, 4.724415e-001, 4.741756e-001, 4.758950e-001, 4.776011e-001, 4.792935e-001, 4.809749e-001, 4.826434e-001, 4.842990e-001, 4.859427e-001,
+4.875749e-001, 4.891947e-001, 4.908008e-001, 4.923956e-001, 4.939800e-001, 4.955543e-001, 4.971172e-001, 4.986675e-001, 5.002060e-001, 5.017322e-001,
+5.032499e-001, 5.047596e-001, 5.062616e-001, 5.077569e-001, 5.092430e-001, 5.107212e-001, 5.121917e-001, 5.136547e-001, 5.151066e-001, 5.165514e-001,
+5.179893e-001, 5.194200e-001, 5.208391e-001, 5.222476e-001, 5.236480e-001, 5.250410e-001, 5.264230e-001, 5.277984e-001, 5.291667e-001, 5.305247e-001,
+5.318742e-001, 5.332178e-001, 5.345558e-001, 5.358840e-001, 5.372062e-001, 5.385223e-001, 5.398282e-001, 5.411274e-001, 5.424209e-001, 5.437052e-001,
+5.449834e-001, 5.462569e-001, 5.475227e-001, 5.487811e-001, 5.500348e-001, 5.512812e-001, 5.525211e-001, 5.537570e-001, 5.549865e-001, 5.562116e-001,
+5.574334e-001, 5.586464e-001, 5.598551e-001, 5.610579e-001, 5.622550e-001, 5.634492e-001, 5.646370e-001, 5.658181e-001, 5.669948e-001, 5.681625e-001,
+5.693277e-001, 5.704881e-001, 5.716452e-001, 5.728005e-001, 5.739479e-001, 5.750918e-001, 5.762278e-001, 5.773584e-001, 5.784851e-001, 5.796057e-001,
+5.807245e-001, 5.818372e-001, 5.829468e-001, 5.840515e-001, 5.851527e-001, 5.862518e-001, 5.873453e-001, 5.884373e-001, 5.895215e-001, 5.906036e-001,
+5.916786e-001, 5.927507e-001, 5.938187e-001, 5.948840e-001, 5.959472e-001, 5.970050e-001, 5.980607e-001, 5.991076e-001, 6.001530e-001, 6.011908e-001,
+6.022279e-001, 6.032595e-001, 6.042903e-001, 6.053166e-001, 6.063409e-001, 6.073580e-001, 6.083727e-001, 6.093810e-001, 6.103867e-001, 6.113868e-001,
+6.123839e-001, 6.133750e-001, 6.143638e-001, 6.153482e-001, 6.163303e-001, 6.173073e-001, 6.182823e-001, 6.192524e-001, 6.202210e-001, 6.211846e-001,
+6.221469e-001, 6.231033e-001, 6.240592e-001, 6.250107e-001, 6.259622e-001, 6.269065e-001, 6.278507e-001, 6.287866e-001, 6.297214e-001, 6.306507e-001,
+6.315781e-001, 6.325017e-001, 6.334225e-001, 6.343404e-001, 6.352542e-001, 6.361663e-001, 6.370725e-001, 6.379785e-001, 6.388779e-001, 6.397773e-001,
+6.406729e-001, 6.415677e-001, 6.424600e-001, 6.433506e-001, 6.442389e-001, 6.451223e-001, 6.460055e-001, 6.468822e-001, 6.477588e-001, 6.486310e-001,
+6.495016e-001, 6.503694e-001, 6.512335e-001, 6.520972e-001, 6.529569e-001, 6.538167e-001, 6.546721e-001, 6.555258e-001, 6.563768e-001, 6.572224e-001,
+6.580681e-001, 6.589082e-001, 6.597481e-001, 6.605853e-001, 6.614202e-001, 6.622544e-001, 6.630814e-001, 6.639085e-001, 6.647310e-001, 6.655509e-001,
+6.663698e-001, 6.671835e-001, 6.679971e-001, 6.688065e-001, 6.696136e-001, 6.704198e-001, 6.712203e-001, 6.720208e-001, 6.728178e-001, 6.736124e-001,
+6.744069e-001, 6.751978e-001, 6.759888e-001, 6.767783e-001, 6.775662e-001, 6.783542e-001, 6.791372e-001, 6.799193e-001, 6.807003e-001, 6.814774e-001,
+6.822545e-001, 6.830291e-001, 6.838019e-001, 6.845747e-001, 6.853434e-001, 6.861117e-001, 6.868790e-001, 6.876427e-001, 6.884064e-001, 6.891673e-001,
+6.899256e-001, 6.906839e-001, 6.914379e-001, 6.921907e-001, 6.929434e-001, 6.936905e-001, 6.944376e-001, 6.951832e-001, 6.959239e-001, 6.966646e-001,
+6.974025e-001, 6.981367e-001, 6.988709e-001, 6.996024e-001, 7.003323e-001, 7.010622e-001, 7.017894e-001, 7.025159e-001, 7.032423e-001, 7.039637e-001,
+7.046843e-001, 7.054050e-001, 7.061207e-001, 7.068364e-001, 7.075519e-001, 7.082635e-001, 7.089750e-001, 7.096859e-001, 7.103911e-001, 7.110964e-001,
+7.118008e-001, 7.125004e-001, 7.132000e-001, 7.138990e-001, 7.145938e-001, 7.152887e-001, 7.159828e-001, 7.166707e-001, 7.173587e-001, 7.180462e-001,
+7.187279e-001, 7.194096e-001, 7.200913e-001, 7.207677e-001, 7.214441e-001, 7.221205e-001, 7.227922e-001, 7.234633e-001, 7.241344e-001, 7.248032e-001,
+7.254712e-001, 7.261392e-001, 7.268046e-001, 7.274683e-001, 7.281321e-001, 7.287933e-001, 7.294515e-001, 7.301098e-001, 7.307671e-001, 7.314220e-001,
+7.320768e-001, 7.327316e-001, 7.333819e-001, 7.340322e-001, 7.346825e-001, 7.353284e-001, 7.359729e-001, 7.366175e-001, 7.372603e-001, 7.379011e-001,
+7.385420e-001, 7.391821e-001, 7.398182e-001, 7.404544e-001, 7.410905e-001, 7.417216e-001, 7.423517e-001, 7.429818e-001, 7.436101e-001, 7.442363e-001,
+7.448625e-001, 7.454884e-001, 7.461096e-001, 7.467309e-001, 7.473521e-001, 7.479693e-001, 7.485843e-001, 7.491993e-001, 7.498135e-001, 7.504243e-001,
+7.510352e-001, 7.516460e-001, 7.522531e-001, 7.528588e-001, 7.534645e-001, 7.540688e-001, 7.546680e-001, 7.552672e-001, 7.558664e-001, 7.564627e-001,
+7.570575e-001, 7.576523e-001, 7.582468e-001, 7.588382e-001, 7.594296e-001, 7.600210e-001, 7.606108e-001, 7.611989e-001, 7.617871e-001, 7.623752e-001,
+7.629606e-001, 7.635457e-001, 7.641307e-001, 7.647150e-001, 7.652967e-001, 7.658784e-001, 7.664601e-001, 7.670400e-001, 7.676185e-001, 7.681970e-001,
+7.687754e-001, 7.693514e-001, 7.699269e-001, 7.705023e-001, 7.710775e-001, 7.716496e-001, 7.722217e-001, 7.727938e-001, 7.733650e-001, 7.739340e-001,
+7.745029e-001, 7.750719e-001, 7.756394e-001, 7.762054e-001, 7.767714e-001, 7.773373e-001, 7.779012e-001, 7.784639e-001, 7.790266e-001, 7.795893e-001,
+7.801497e-001, 7.807093e-001, 7.812689e-001, 7.818285e-001, 7.823856e-001, 7.829422e-001, 7.834989e-001, 7.840555e-001, 7.846093e-001, 7.851627e-001,
+7.857162e-001, 7.862696e-001, 7.868202e-001, 7.873706e-001, 7.879210e-001, 7.884714e-001, 7.890191e-001, 7.895666e-001, 7.901141e-001, 7.906616e-001,
+7.912062e-001, 7.917506e-001, 7.922949e-001, 7.928393e-001, 7.933812e-001, 7.939225e-001, 7.944639e-001, 7.950052e-001, 7.955445e-001, 7.960830e-001,
+7.966215e-001, 7.971600e-001, 7.976967e-001, 7.982321e-001, 7.987675e-001, 7.993029e-001, 7.998371e-001, 8.003696e-001, 8.009020e-001, 8.014344e-001,
+8.019663e-001, 8.024960e-001, 8.030256e-001, 8.035553e-001, 8.040849e-001, 8.046117e-001, 8.051383e-001, 8.056648e-001, 8.061914e-001, 8.067161e-001,
+8.072398e-001, 8.077635e-001, 8.082872e-001, 8.088099e-001, 8.093308e-001, 8.098517e-001, 8.103727e-001, 8.108936e-001, 8.114115e-001, 8.119295e-001,
+8.124474e-001, 8.129653e-001, 8.134815e-001, 8.139966e-001, 8.145117e-001, 8.150267e-001, 8.155413e-001, 8.160537e-001, 8.165660e-001, 8.170784e-001,
+8.175908e-001, 8.181010e-001, 8.186104e-001, 8.191198e-001, 8.196292e-001, 8.201378e-001, 8.206434e-001, 8.211490e-001, 8.216546e-001, 8.221603e-001,
+8.226630e-001, 8.231644e-001, 8.236658e-001, 8.241672e-001, 8.246682e-001, 8.251668e-001, 8.256655e-001, 8.261641e-001, 8.266627e-001, 8.271595e-001,
+8.276545e-001, 8.281495e-001, 8.286445e-001, 8.291396e-001, 8.296311e-001, 8.301221e-001, 8.306131e-001, 8.311040e-001, 8.315946e-001, 8.320829e-001,
+8.325713e-001, 8.330597e-001, 8.335480e-001, 8.340349e-001, 8.345198e-001, 8.350048e-001, 8.354897e-001, 8.359746e-001, 8.364563e-001, 8.369364e-001,
+8.374165e-001, 8.378965e-001, 8.383766e-001, 8.388532e-001, 8.393293e-001, 8.398053e-001, 8.402814e-001, 8.407574e-001, 8.412303e-001, 8.417033e-001,
+8.421762e-001, 8.426492e-001, 8.431215e-001, 8.435900e-001, 8.440584e-001, 8.445269e-001, 8.449953e-001, 8.454631e-001, 8.459278e-001, 8.463926e-001,
+8.468574e-001, 8.473222e-001, 8.477864e-001, 8.482484e-001, 8.487104e-001, 8.491724e-001, 8.496344e-001, 8.500954e-001, 8.505533e-001, 8.510112e-001,
+8.514691e-001, 8.519270e-001, 8.523843e-001, 8.528388e-001, 8.532934e-001, 8.537480e-001, 8.542025e-001, 8.546569e-001, 8.551090e-001, 8.555610e-001,
+8.560131e-001, 8.564652e-001, 8.569173e-001, 8.573658e-001, 8.578141e-001, 8.582624e-001, 8.587107e-001, 8.591590e-001, 8.596050e-001, 8.600503e-001,
+8.604956e-001, 8.609409e-001, 8.613862e-001, 8.618303e-001, 8.622734e-001, 8.627165e-001, 8.631596e-001, 8.636027e-001, 8.640448e-001, 8.644845e-001,
+8.649241e-001, 8.653637e-001, 8.658034e-001, 8.662430e-001, 8.666800e-001, 8.671170e-001, 8.675539e-001, 8.679908e-001, 8.684278e-001, 8.688635e-001,
+8.692985e-001, 8.697335e-001, 8.701685e-001, 8.706035e-001, 8.710376e-001, 8.714686e-001, 8.718995e-001, 8.723304e-001, 8.727613e-001, 8.731923e-001,
+8.736203e-001, 8.740473e-001, 8.744744e-001, 8.749015e-001, 8.753286e-001, 8.757552e-001, 8.761808e-001, 8.766063e-001, 8.770318e-001, 8.774573e-001,
+8.778829e-001, 8.783057e-001, 8.787276e-001, 8.791494e-001, 8.795713e-001, 8.799932e-001, 8.804144e-001, 8.808319e-001, 8.812495e-001, 8.816671e-001,
+8.820847e-001, 8.825022e-001, 8.829184e-001, 8.833334e-001, 8.837484e-001, 8.841634e-001, 8.845784e-001, 8.849934e-001, 8.854057e-001, 8.858175e-001,
+8.862294e-001, 8.866413e-001, 8.870531e-001, 8.874645e-001, 8.878726e-001, 8.882807e-001, 8.886888e-001, 8.890969e-001, 8.895050e-001, 8.899124e-001,
+8.903184e-001, 8.907245e-001, 8.911305e-001, 8.915366e-001, 8.919426e-001, 8.923472e-001, 8.927506e-001, 8.931541e-001, 8.935575e-001, 8.939609e-001,
+8.943643e-001, 8.947655e-001, 8.951657e-001, 8.955659e-001, 8.959661e-001, 8.963663e-001, 8.967665e-001, 8.971655e-001, 8.975642e-001, 8.979628e-001,
+8.983614e-001, 8.987601e-001, 8.991587e-001, 8.995556e-001, 8.999521e-001, 9.003486e-001, 9.007451e-001, 9.011416e-001, 9.015381e-001, 9.019324e-001,
+9.023262e-001, 9.027199e-001, 9.031137e-001, 9.035075e-001, 9.039013e-001, 9.042942e-001, 9.046869e-001, 9.050796e-001, 9.054723e-001, 9.058650e-001,
+9.062577e-001, 9.066494e-001, 9.070404e-001, 9.074314e-001, 9.078224e-001, 9.082134e-001, 9.086044e-001, 9.089940e-001, 9.093820e-001, 9.097699e-001,
+9.101579e-001, 9.105459e-001, 9.109339e-001, 9.113214e-001, 9.117074e-001, 9.120935e-001, 9.124796e-001, 9.128656e-001, 9.132517e-001, 9.136377e-001,
+9.140227e-001, 9.144076e-001, 9.147925e-001, 9.151775e-001, 9.155624e-001, 9.159473e-001, 9.163297e-001, 9.167107e-001, 9.170918e-001, 9.174729e-001,
+9.178540e-001, 9.182350e-001, 9.186152e-001, 9.189932e-001, 9.193712e-001, 9.197492e-001, 9.201272e-001, 9.205052e-001, 9.208832e-001, 9.212595e-001,
+9.216355e-001, 9.220116e-001, 9.223876e-001, 9.227636e-001, 9.231396e-001, 9.235144e-001, 9.238872e-001, 9.242599e-001, 9.246327e-001, 9.250055e-001,
+9.253782e-001, 9.257510e-001, 9.261216e-001, 9.264919e-001, 9.268622e-001, 9.272325e-001, 9.276028e-001, 9.279730e-001, 9.283430e-001, 9.287118e-001,
+9.290807e-001, 9.294496e-001, 9.298185e-001, 9.301874e-001, 9.305562e-001, 9.309234e-001, 9.312896e-001, 9.316558e-001, 9.320220e-001, 9.323882e-001,
+9.327544e-001, 9.331206e-001, 9.334838e-001, 9.338467e-001, 9.342097e-001, 9.345726e-001, 9.349356e-001, 9.352985e-001, 9.356612e-001, 9.360224e-001,
+9.363836e-001, 9.367448e-001, 9.371060e-001, 9.374673e-001, 9.378285e-001, 9.381889e-001, 9.385479e-001, 9.389069e-001, 9.392658e-001, 9.396248e-001,
+9.399838e-001, 9.403428e-001, 9.407004e-001, 9.410565e-001, 9.414127e-001, 9.417689e-001, 9.421251e-001, 9.424813e-001, 9.428375e-001, 9.431930e-001,
+9.435479e-001, 9.439028e-001, 9.442577e-001, 9.446126e-001, 9.449675e-001, 9.453224e-001, 9.456762e-001, 9.460293e-001, 9.463824e-001, 9.467355e-001,
+9.470886e-001, 9.474417e-001, 9.477948e-001, 9.481452e-001, 9.484937e-001, 9.488422e-001, 9.491906e-001, 9.495391e-001, 9.498875e-001, 9.502360e-001,
+9.505816e-001, 9.509239e-001, 9.512662e-001, 9.516085e-001, 9.519508e-001, 9.522932e-001, 9.526355e-001, 9.529765e-001, 9.533149e-001, 9.536532e-001,
+9.539915e-001, 9.543299e-001, 9.546682e-001, 9.550065e-001, 9.553446e-001, 9.556806e-001, 9.560165e-001, 9.563525e-001, 9.566884e-001, 9.570244e-001,
+9.573603e-001, 9.576963e-001, 9.580307e-001, 9.583647e-001, 9.586988e-001, 9.590329e-001, 9.593669e-001, 9.597010e-001, 9.600351e-001, 9.603679e-001,
+9.606995e-001, 9.610311e-001, 9.613626e-001, 9.616942e-001, 9.620258e-001, 9.623573e-001, 9.626887e-001, 9.630176e-001, 9.633465e-001, 9.636754e-001,
+9.640043e-001, 9.643332e-001, 9.646621e-001, 9.649910e-001, 9.653184e-001, 9.656450e-001, 9.659715e-001, 9.662981e-001, 9.666246e-001, 9.669512e-001,
+9.672777e-001, 9.676039e-001, 9.679274e-001, 9.682508e-001, 9.685743e-001, 9.688977e-001, 9.692212e-001, 9.695447e-001, 9.698681e-001, 9.701895e-001,
+9.705089e-001, 9.708284e-001, 9.711479e-001, 9.714673e-001, 9.717868e-001, 9.721062e-001, 9.724257e-001, 9.727420e-001, 9.730579e-001, 9.733738e-001,
+9.736896e-001, 9.740055e-001, 9.743214e-001, 9.746373e-001, 9.749524e-001, 9.752641e-001, 9.755758e-001, 9.758875e-001, 9.761992e-001, 9.765109e-001,
+9.768225e-001, 9.771342e-001, 9.774440e-001, 9.777508e-001, 9.780576e-001, 9.783643e-001, 9.786711e-001, 9.789779e-001, 9.792847e-001, 9.795915e-001,
+9.798955e-001, 9.801974e-001, 9.804993e-001, 9.808012e-001, 9.811030e-001, 9.814049e-001, 9.817068e-001, 9.820087e-001, 9.823070e-001, 9.826035e-001,
+9.828999e-001, 9.831964e-001, 9.834929e-001, 9.837893e-001, 9.840858e-001, 9.843823e-001, 9.846749e-001, 9.849657e-001, 9.852566e-001, 9.855474e-001,
+9.858382e-001, 9.861291e-001, 9.864199e-001, 9.867107e-001, 9.869980e-001, 9.872834e-001, 9.875687e-001, 9.878541e-001, 9.881394e-001, 9.884248e-001,
+9.887101e-001, 9.889955e-001, 9.892771e-001, 9.895554e-001, 9.898338e-001, 9.901122e-001, 9.903906e-001, 9.906689e-001, 9.909473e-001, 9.912257e-001,
+9.915014e-001, 9.917727e-001, 9.920440e-001, 9.923153e-001, 9.925866e-001, 9.928579e-001, 9.931292e-001, 9.934004e-001, 9.936708e-001, 9.939351e-001,
+9.941995e-001, 9.944638e-001, 9.947281e-001, 9.949924e-001, 9.952567e-001, 9.955210e-001, 9.957853e-001, 9.960408e-001, 9.962944e-001, 9.965479e-001,
+9.968015e-001, 9.970551e-001, 9.973086e-001, 9.975622e-001, 9.978158e-001, 9.980642e-001, 9.983061e-001, 9.985481e-001, 9.987901e-001, 9.990321e-001,
+9.992741e-001, 9.995160e-001, 9.997580e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.592018e-002, 2.800314e-002, 3.853101e-002, 4.808921e-002, 5.699487e-002, 6.545325e-002, 7.346577e-002, 8.112663e-002, 8.853409e-002,
+9.568190e-002, 1.026157e-001, 1.093306e-001, 1.157636e-001, 1.219805e-001, 1.280033e-001, 1.338655e-001, 1.395676e-001, 1.450990e-001, 1.504812e-001,
+1.557295e-001, 1.608278e-001, 1.657994e-001, 1.706517e-001, 1.754034e-001, 1.800454e-001, 1.845912e-001, 1.890433e-001, 1.934228e-001, 1.977252e-001,
+2.019387e-001, 2.060764e-001, 2.101364e-001, 2.141312e-001, 2.180649e-001, 2.219256e-001, 2.257197e-001, 2.294515e-001, 2.331304e-001, 2.367579e-001,
+2.403406e-001, 2.438685e-001, 2.473488e-001, 2.507810e-001, 2.541684e-001, 2.575107e-001, 2.608149e-001, 2.640858e-001, 2.673158e-001, 2.705043e-001,
+2.736573e-001, 2.767716e-001, 2.798541e-001, 2.829042e-001, 2.859223e-001, 2.889142e-001, 2.918728e-001, 2.947993e-001, 2.976974e-001, 3.005683e-001,
+3.034103e-001, 3.062279e-001, 3.090203e-001, 3.117857e-001, 3.145250e-001, 3.172332e-001, 3.199187e-001, 3.225826e-001, 3.252245e-001, 3.278487e-001,
+3.304544e-001, 3.330390e-001, 3.356044e-001, 3.381498e-001, 3.406724e-001, 3.431720e-001, 3.456500e-001, 3.481074e-001, 3.505432e-001, 3.529601e-001,
+3.553603e-001, 3.577441e-001, 3.601130e-001, 3.624684e-001, 3.648113e-001, 3.671433e-001, 3.694634e-001, 3.717713e-001, 3.740626e-001, 3.763391e-001,
+3.786001e-001, 3.808402e-001, 3.830653e-001, 3.852767e-001, 3.874705e-001, 3.896510e-001, 3.918202e-001, 3.939774e-001, 3.961208e-001, 3.982516e-001,
+4.003695e-001, 4.024741e-001, 4.045643e-001, 4.066396e-001, 4.087007e-001, 4.107474e-001, 4.127795e-001, 4.147967e-001, 4.167988e-001, 4.187848e-001,
+4.207593e-001, 4.227213e-001, 4.246718e-001, 4.266100e-001, 4.285362e-001, 4.304524e-001, 4.323602e-001, 4.342601e-001, 4.361515e-001, 4.380354e-001,
+4.399109e-001, 4.417791e-001, 4.436391e-001, 4.454919e-001, 4.473369e-001, 4.491747e-001, 4.510050e-001, 4.528282e-001, 4.546443e-001, 4.564531e-001,
+4.582554e-001, 4.600502e-001, 4.618388e-001, 4.636174e-001, 4.653870e-001, 4.671464e-001, 4.688977e-001, 4.706400e-001, 4.723741e-001, 4.740992e-001,
+4.758137e-001, 4.775180e-001, 4.792114e-001, 4.808943e-001, 4.825681e-001, 4.842331e-001, 4.858896e-001, 4.875381e-001, 4.891777e-001, 4.908088e-001,
+4.924312e-001, 4.940447e-001, 4.956492e-001, 4.972448e-001, 4.988302e-001, 5.004084e-001, 5.019795e-001, 5.035431e-001, 5.050962e-001, 5.066398e-001,
+5.081758e-001, 5.097053e-001, 5.112238e-001, 5.127363e-001, 5.142417e-001, 5.157391e-001, 5.172263e-001, 5.187063e-001, 5.201800e-001, 5.216470e-001,
+5.231057e-001, 5.245596e-001, 5.260090e-001, 5.274483e-001, 5.288821e-001, 5.303106e-001, 5.317319e-001, 5.331465e-001, 5.345558e-001, 5.359573e-001,
+5.373531e-001, 5.387449e-001, 5.401305e-001, 5.415119e-001, 5.428903e-001, 5.442639e-001, 5.456310e-001, 5.469938e-001, 5.483482e-001, 5.496984e-001,
+5.510453e-001, 5.523828e-001, 5.537165e-001, 5.550454e-001, 5.563680e-001, 5.576872e-001, 5.589987e-001, 5.603044e-001, 5.616064e-001, 5.628958e-001,
+5.641814e-001, 5.654600e-001, 5.667316e-001, 5.679996e-001, 5.692597e-001, 5.705173e-001, 5.717690e-001, 5.730173e-001, 5.742632e-001, 5.755023e-001,
+5.767389e-001, 5.779655e-001, 5.791882e-001, 5.804046e-001, 5.816155e-001, 5.828229e-001, 5.840239e-001, 5.852234e-001, 5.864149e-001, 5.876041e-001,
+5.887857e-001, 5.899625e-001, 5.911326e-001, 5.922975e-001, 5.934586e-001, 5.946133e-001, 5.957655e-001, 5.969123e-001, 5.980582e-001, 5.991981e-001,
+6.003371e-001, 6.014684e-001, 6.025982e-001, 6.037194e-001, 6.048388e-001, 6.059515e-001, 6.070623e-001, 6.081679e-001, 6.092718e-001, 6.103717e-001,
+6.114696e-001, 6.125635e-001, 6.136540e-001, 6.147374e-001, 6.158184e-001, 6.168941e-001, 6.179678e-001, 6.190361e-001, 6.201023e-001, 6.211615e-001,
+6.222188e-001, 6.232675e-001, 6.243154e-001, 6.253551e-001, 6.263948e-001, 6.274272e-001, 6.284596e-001, 6.294868e-001, 6.305134e-001, 6.315356e-001,
+6.325564e-001, 6.335714e-001, 6.345824e-001, 6.355903e-001, 6.365942e-001, 6.375966e-001, 6.385941e-001, 6.395912e-001, 6.405805e-001, 6.415698e-001,
+6.425516e-001, 6.435317e-001, 6.445076e-001, 6.454803e-001, 6.464513e-001, 6.474184e-001, 6.483853e-001, 6.493441e-001, 6.503030e-001, 6.512539e-001,
+6.522020e-001, 6.531463e-001, 6.540852e-001, 6.550236e-001, 6.559552e-001, 6.568868e-001, 6.578143e-001, 6.587403e-001, 6.596643e-001, 6.605847e-001,
+6.615051e-001, 6.624196e-001, 6.633337e-001, 6.642440e-001, 6.651509e-001, 6.660569e-001, 6.669554e-001, 6.678539e-001, 6.687465e-001, 6.696357e-001,
+6.705237e-001, 6.714056e-001, 6.722874e-001, 6.731655e-001, 6.740418e-001, 6.749172e-001, 6.757870e-001, 6.766569e-001, 6.775222e-001, 6.783844e-001,
+6.792463e-001, 6.801002e-001, 6.809540e-001, 6.818048e-001, 6.826521e-001, 6.834994e-001, 6.843413e-001, 6.851824e-001, 6.860218e-001, 6.868561e-001,
+6.876903e-001, 6.885217e-001, 6.893511e-001, 6.901805e-001, 6.910036e-001, 6.918261e-001, 6.926467e-001, 6.934604e-001, 6.942742e-001, 6.950844e-001,
+6.958913e-001, 6.966982e-001, 6.975012e-001, 6.983032e-001, 6.991050e-001, 6.999026e-001, 7.007001e-001, 7.014959e-001, 7.022861e-001, 7.030763e-001,
+7.038637e-001, 7.046473e-001, 7.054308e-001, 7.062115e-001, 7.069903e-001, 7.077691e-001, 7.085446e-001, 7.093191e-001, 7.100936e-001, 7.108620e-001,
+7.116296e-001, 7.123971e-001, 7.131582e-001, 7.139192e-001, 7.146799e-001, 7.154349e-001, 7.161899e-001, 7.169442e-001, 7.176928e-001, 7.184415e-001,
+7.191895e-001, 7.199338e-001, 7.206780e-001, 7.214214e-001, 7.221598e-001, 7.228981e-001, 7.236355e-001, 7.243662e-001, 7.250969e-001, 7.258272e-001,
+7.265521e-001, 7.272771e-001, 7.280020e-001, 7.287220e-001, 7.294420e-001, 7.301620e-001, 7.308752e-001, 7.315877e-001, 7.323002e-001, 7.330073e-001,
+7.337129e-001, 7.344185e-001, 7.351202e-001, 7.358197e-001, 7.365191e-001, 7.372158e-001, 7.379089e-001, 7.386021e-001, 7.392936e-001, 7.399804e-001,
+7.406671e-001, 7.413537e-001, 7.420335e-001, 7.427132e-001, 7.433929e-001, 7.440671e-001, 7.447396e-001, 7.454121e-001, 7.460821e-001, 7.467494e-001,
+7.474168e-001, 7.480833e-001, 7.487463e-001, 7.494093e-001, 7.500723e-001, 7.507300e-001, 7.513866e-001, 7.520431e-001, 7.526970e-001, 7.533478e-001,
+7.539987e-001, 7.546491e-001, 7.552950e-001, 7.559409e-001, 7.565869e-001, 7.572283e-001, 7.578673e-001, 7.585063e-001, 7.591440e-001, 7.597767e-001,
+7.604094e-001, 7.610421e-001, 7.616709e-001, 7.622982e-001, 7.629255e-001, 7.635516e-001, 7.641734e-001, 7.647953e-001, 7.654171e-001, 7.660367e-001,
+7.666552e-001, 7.672737e-001, 7.678917e-001, 7.685058e-001, 7.691199e-001, 7.697339e-001, 7.703451e-001, 7.709535e-001, 7.715620e-001, 7.721704e-001,
+7.727757e-001, 7.733805e-001, 7.739853e-001, 7.745891e-001, 7.751893e-001, 7.757895e-001, 7.763897e-001, 7.769868e-001, 7.775811e-001, 7.781755e-001,
+7.787699e-001, 7.793611e-001, 7.799517e-001, 7.805422e-001, 7.811324e-001, 7.817181e-001, 7.823038e-001, 7.828895e-001, 7.834735e-001, 7.840531e-001,
+7.846328e-001, 7.852125e-001, 7.857902e-001, 7.863658e-001, 7.869415e-001, 7.875171e-001, 7.880907e-001, 7.886632e-001, 7.892357e-001, 7.898082e-001,
+7.903760e-001, 7.909424e-001, 7.915088e-001, 7.920752e-001, 7.926365e-001, 7.931970e-001, 7.937575e-001, 7.943180e-001, 7.948756e-001, 7.954330e-001,
+7.959904e-001, 7.965478e-001, 7.971014e-001, 7.976547e-001, 7.982081e-001, 7.987615e-001, 7.993095e-001, 7.998572e-001, 8.004049e-001, 8.009526e-001,
+8.014961e-001, 8.020390e-001, 8.025820e-001, 8.031250e-001, 8.036649e-001, 8.042042e-001, 8.047436e-001, 8.052829e-001, 8.058184e-001, 8.063524e-001,
+8.068865e-001, 8.074206e-001, 8.079521e-001, 8.084818e-001, 8.090116e-001, 8.095413e-001, 8.100697e-001, 8.105961e-001, 8.111225e-001, 8.116489e-001,
+8.121744e-001, 8.126960e-001, 8.132176e-001, 8.137392e-001, 8.142607e-001, 8.147786e-001, 8.152962e-001, 8.158139e-001, 8.163315e-001, 8.168472e-001,
+8.173618e-001, 8.178765e-001, 8.183912e-001, 8.189039e-001, 8.194131e-001, 8.199223e-001, 8.204316e-001, 8.209408e-001, 8.214447e-001, 8.219487e-001,
+8.224527e-001, 8.229567e-001, 8.234592e-001, 8.239607e-001, 8.244621e-001, 8.249636e-001, 8.254641e-001, 8.259607e-001, 8.264572e-001, 8.269537e-001,
+8.274502e-001, 8.279432e-001, 8.284350e-001, 8.289268e-001, 8.294186e-001, 8.299099e-001, 8.303996e-001, 8.308893e-001, 8.313790e-001, 8.318687e-001,
+8.323553e-001, 8.328405e-001, 8.333258e-001, 8.338110e-001, 8.342956e-001, 8.347756e-001, 8.352555e-001, 8.357355e-001, 8.362155e-001, 8.366938e-001,
+8.371705e-001, 8.376472e-001, 8.381239e-001, 8.386007e-001, 8.390741e-001, 8.395470e-001, 8.400198e-001, 8.404927e-001, 8.409648e-001, 8.414331e-001,
+8.419014e-001, 8.423696e-001, 8.428379e-001, 8.433050e-001, 8.437707e-001, 8.442363e-001, 8.447020e-001, 8.451676e-001, 8.456311e-001, 8.460935e-001,
+8.465559e-001, 8.470183e-001, 8.474807e-001, 8.479388e-001, 8.483963e-001, 8.488537e-001, 8.493112e-001, 8.497685e-001, 8.502224e-001, 8.506762e-001,
+8.511301e-001, 8.515839e-001, 8.520374e-001, 8.524887e-001, 8.529400e-001, 8.533913e-001, 8.538426e-001, 8.542930e-001, 8.547401e-001, 8.551871e-001,
+8.556342e-001, 8.560812e-001, 8.565274e-001, 8.569706e-001, 8.574137e-001, 8.578569e-001, 8.583001e-001, 8.587426e-001, 8.591823e-001, 8.596221e-001,
+8.600618e-001, 8.605016e-001, 8.609408e-001, 8.613771e-001, 8.618135e-001, 8.622499e-001, 8.626863e-001, 8.631223e-001, 8.635548e-001, 8.639872e-001,
+8.644196e-001, 8.648521e-001, 8.652845e-001, 8.657131e-001, 8.661415e-001, 8.665699e-001, 8.669982e-001, 8.674266e-001, 8.678531e-001, 8.682790e-001,
+8.687049e-001, 8.691308e-001, 8.695568e-001, 8.699810e-001, 8.704040e-001, 8.708269e-001, 8.712498e-001, 8.716727e-001, 8.720947e-001, 8.725145e-001,
+8.729342e-001, 8.733540e-001, 8.737737e-001, 8.741935e-001, 8.746117e-001, 8.750299e-001, 8.754481e-001, 8.758663e-001, 8.762845e-001, 8.767014e-001,
+8.771174e-001, 8.775335e-001, 8.779496e-001, 8.783657e-001, 8.787811e-001, 8.791939e-001, 8.796068e-001, 8.800197e-001, 8.804326e-001, 8.808454e-001,
+8.812555e-001, 8.816647e-001, 8.820739e-001, 8.824831e-001, 8.828923e-001, 8.833009e-001, 8.837080e-001, 8.841151e-001, 8.845222e-001, 8.849293e-001,
+8.853363e-001, 8.857411e-001, 8.861450e-001, 8.865489e-001, 8.869529e-001, 8.873568e-001, 8.877601e-001, 8.881598e-001, 8.885596e-001, 8.889593e-001,
+8.893591e-001, 8.897589e-001, 8.901572e-001, 8.905543e-001, 8.909514e-001, 8.913484e-001, 8.917455e-001, 8.921426e-001, 8.925369e-001, 8.929308e-001,
+8.933247e-001, 8.937187e-001, 8.941126e-001, 8.945059e-001, 8.948956e-001, 8.952853e-001, 8.956750e-001, 8.960648e-001, 8.964545e-001, 8.968430e-001,
+8.972295e-001, 8.976161e-001, 8.980026e-001, 8.983891e-001, 8.987756e-001, 8.991609e-001, 8.995452e-001, 8.999295e-001, 9.003138e-001, 9.006982e-001,
+9.010825e-001, 9.014646e-001, 9.018457e-001, 9.022269e-001, 9.026080e-001, 9.029892e-001, 9.033703e-001, 9.037498e-001, 9.041287e-001, 9.045076e-001,
+9.048866e-001, 9.052655e-001, 9.056444e-001, 9.060223e-001, 9.064000e-001, 9.067777e-001, 9.071553e-001, 9.075330e-001, 9.079107e-001, 9.082859e-001,
+9.086605e-001, 9.090351e-001, 9.094097e-001, 9.097843e-001, 9.101589e-001, 9.105305e-001, 9.109010e-001, 9.112716e-001, 9.116422e-001, 9.120127e-001,
+9.123833e-001, 9.127531e-001, 9.131225e-001, 9.134919e-001, 9.138613e-001, 9.142307e-001, 9.146000e-001, 9.149684e-001, 9.153357e-001, 9.157029e-001,
+9.160702e-001, 9.164374e-001, 9.168047e-001, 9.171709e-001, 9.175343e-001, 9.178976e-001, 9.182609e-001, 9.186243e-001, 9.189876e-001, 9.193509e-001,
+9.197127e-001, 9.200745e-001, 9.204362e-001, 9.207980e-001, 9.211597e-001, 9.215215e-001, 9.218824e-001, 9.222430e-001, 9.226036e-001, 9.229642e-001,
+9.233248e-001, 9.236854e-001, 9.240450e-001, 9.244019e-001, 9.247588e-001, 9.251158e-001, 9.254727e-001, 9.258296e-001, 9.261866e-001, 9.265407e-001,
+9.268943e-001, 9.272480e-001, 9.276017e-001, 9.279554e-001, 9.283091e-001, 9.286624e-001, 9.290151e-001, 9.293678e-001, 9.297205e-001, 9.300732e-001,
+9.304259e-001, 9.307786e-001, 9.311290e-001, 9.314790e-001, 9.318290e-001, 9.321791e-001, 9.325291e-001, 9.328791e-001, 9.332283e-001, 9.335753e-001,
+9.339223e-001, 9.342694e-001, 9.346164e-001, 9.349634e-001, 9.353104e-001, 9.356566e-001, 9.360024e-001, 9.363481e-001, 9.366938e-001, 9.370396e-001,
+9.373853e-001, 9.377311e-001, 9.380753e-001, 9.384195e-001, 9.387636e-001, 9.391078e-001, 9.394519e-001, 9.397960e-001, 9.401395e-001, 9.404796e-001,
+9.408197e-001, 9.411598e-001, 9.414999e-001, 9.418400e-001, 9.421801e-001, 9.425194e-001, 9.428572e-001, 9.431951e-001, 9.435329e-001, 9.438707e-001,
+9.442085e-001, 9.445464e-001, 9.448839e-001, 9.452212e-001, 9.455584e-001, 9.458957e-001, 9.462329e-001, 9.465702e-001, 9.469074e-001, 9.472429e-001,
+9.475772e-001, 9.479115e-001, 9.482458e-001, 9.485801e-001, 9.489144e-001, 9.492487e-001, 9.495814e-001, 9.499132e-001, 9.502449e-001, 9.505766e-001,
+9.509083e-001, 9.512400e-001, 9.515718e-001, 9.519032e-001, 9.522345e-001, 9.525658e-001, 9.528971e-001, 9.532284e-001, 9.535597e-001, 9.538910e-001,
+9.542206e-001, 9.545482e-001, 9.548758e-001, 9.552034e-001, 9.555310e-001, 9.558586e-001, 9.561862e-001, 9.565112e-001, 9.568306e-001, 9.571500e-001,
+9.574694e-001, 9.577888e-001, 9.581082e-001, 9.584276e-001, 9.587466e-001, 9.590610e-001, 9.593754e-001, 9.596898e-001, 9.600043e-001, 9.603187e-001,
+9.606331e-001, 9.609475e-001, 9.612603e-001, 9.615727e-001, 9.618852e-001, 9.621976e-001, 9.625100e-001, 9.628224e-001, 9.631348e-001, 9.634457e-001,
+9.637547e-001, 9.640638e-001, 9.643729e-001, 9.646820e-001, 9.649911e-001, 9.653001e-001, 9.656090e-001, 9.659157e-001, 9.662224e-001, 9.665291e-001,
+9.668358e-001, 9.671425e-001, 9.674492e-001, 9.677559e-001, 9.680611e-001, 9.683654e-001, 9.686697e-001, 9.689740e-001, 9.692783e-001, 9.695825e-001,
+9.698868e-001, 9.701907e-001, 9.704914e-001, 9.707920e-001, 9.710927e-001, 9.713934e-001, 9.716940e-001, 9.719947e-001, 9.722954e-001, 9.725941e-001,
+9.728910e-001, 9.731879e-001, 9.734848e-001, 9.737817e-001, 9.740786e-001, 9.743755e-001, 9.746724e-001, 9.749661e-001, 9.752594e-001, 9.755527e-001,
+9.758460e-001, 9.761393e-001, 9.764326e-001, 9.767259e-001, 9.770185e-001, 9.773075e-001, 9.775965e-001, 9.778855e-001, 9.781745e-001, 9.784635e-001,
+9.787525e-001, 9.790415e-001, 9.793286e-001, 9.796128e-001, 9.798970e-001, 9.801811e-001, 9.804653e-001, 9.807495e-001, 9.810337e-001, 9.813179e-001,
+9.815995e-001, 9.818790e-001, 9.821584e-001, 9.824379e-001, 9.827174e-001, 9.829969e-001, 9.832764e-001, 9.835559e-001, 9.838317e-001, 9.841056e-001,
+9.843795e-001, 9.846534e-001, 9.849273e-001, 9.852012e-001, 9.854751e-001, 9.857489e-001, 9.860188e-001, 9.862868e-001, 9.865549e-001, 9.868229e-001,
+9.870909e-001, 9.873589e-001, 9.876269e-001, 9.878949e-001, 9.881592e-001, 9.884214e-001, 9.886837e-001, 9.889459e-001, 9.892082e-001, 9.894704e-001,
+9.897327e-001, 9.899949e-001, 9.902534e-001, 9.905088e-001, 9.907642e-001, 9.910196e-001, 9.912750e-001, 9.915304e-001, 9.917857e-001, 9.920411e-001,
+9.922939e-001, 9.925421e-001, 9.927903e-001, 9.930384e-001, 9.932866e-001, 9.935348e-001, 9.937830e-001, 9.940312e-001, 9.942784e-001, 9.945192e-001,
+9.947599e-001, 9.950006e-001, 9.952414e-001, 9.954821e-001, 9.957228e-001, 9.959635e-001, 9.962043e-001, 9.964359e-001, 9.966656e-001, 9.968952e-001,
+9.971249e-001, 9.973546e-001, 9.975842e-001, 9.978139e-001, 9.980436e-001, 9.982674e-001, 9.984840e-001, 9.987005e-001, 9.989171e-001, 9.991337e-001,
+9.993503e-001, 9.995668e-001, 9.997834e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.128299e-002, 2.084801e-002, 2.914868e-002, 3.669739e-002, 4.371967e-002, 5.034524e-002, 5.667537e-002, 6.275935e-002, 6.863443e-002,
+7.432535e-002, 7.985351e-002, 8.522003e-002, 9.042160e-002, 9.547083e-002, 1.003969e-001, 1.052051e-001, 1.098947e-001, 1.144764e-001, 1.189826e-001,
+1.233961e-001, 1.277330e-001, 1.319945e-001, 1.361728e-001, 1.402668e-001, 1.442913e-001, 1.482614e-001, 1.521810e-001, 1.560502e-001, 1.598621e-001,
+1.636209e-001, 1.673310e-001, 1.709981e-001, 1.746174e-001, 1.781916e-001, 1.817202e-001, 1.852061e-001, 1.886554e-001, 1.920740e-001, 1.954560e-001,
+1.987928e-001, 2.020908e-001, 2.053565e-001, 2.085937e-001, 2.117980e-001, 2.149728e-001, 2.181186e-001, 2.212392e-001, 2.243301e-001, 2.273902e-001,
+2.304215e-001, 2.334305e-001, 2.364110e-001, 2.393692e-001, 2.423065e-001, 2.452153e-001, 2.480937e-001, 2.509461e-001, 2.537801e-001, 2.565921e-001,
+2.593840e-001, 2.621519e-001, 2.648904e-001, 2.676063e-001, 2.703030e-001, 2.729845e-001, 2.756457e-001, 2.782875e-001, 2.809073e-001, 2.835057e-001,
+2.860868e-001, 2.886513e-001, 2.911956e-001, 2.937204e-001, 2.962253e-001, 2.987119e-001, 3.011857e-001, 3.036413e-001, 3.060743e-001, 3.084880e-001,
+3.108876e-001, 3.132723e-001, 3.156407e-001, 3.179928e-001, 3.203321e-001, 3.226552e-001, 3.249565e-001, 3.272385e-001, 3.295019e-001, 3.317487e-001,
+3.339833e-001, 3.362009e-001, 3.384016e-001, 3.405882e-001, 3.427592e-001, 3.449179e-001, 3.470610e-001, 3.491885e-001, 3.513004e-001, 3.533968e-001,
+3.554782e-001, 3.575447e-001, 3.595973e-001, 3.616338e-001, 3.636533e-001, 3.656555e-001, 3.676426e-001, 3.696162e-001, 3.715760e-001, 3.735185e-001,
+3.754445e-001, 3.773565e-001, 3.792560e-001, 3.811441e-001, 3.830194e-001, 3.848828e-001, 3.867362e-001, 3.885800e-001, 3.904126e-001, 3.922336e-001,
+3.940415e-001, 3.958359e-001, 3.976180e-001, 3.993879e-001, 4.011451e-001, 4.028909e-001, 4.046253e-001, 4.063491e-001, 4.080632e-001, 4.097685e-001,
+4.114661e-001, 4.131550e-001, 4.148359e-001, 4.165103e-001, 4.181793e-001, 4.198432e-001, 4.215009e-001, 4.231526e-001, 4.247975e-001, 4.264370e-001,
+4.280720e-001, 4.297009e-001, 4.313251e-001, 4.329413e-001, 4.345523e-001, 4.361563e-001, 4.377535e-001, 4.393445e-001, 4.409264e-001, 4.425007e-001,
+4.440688e-001, 4.456312e-001, 4.471881e-001, 4.487377e-001, 4.502801e-001, 4.518157e-001, 4.533448e-001, 4.548680e-001, 4.563846e-001, 4.578959e-001,
+4.594022e-001, 4.609036e-001, 4.623981e-001, 4.638866e-001, 4.653700e-001, 4.668483e-001, 4.683186e-001, 4.697834e-001, 4.712428e-001, 4.726961e-001,
+4.741415e-001, 4.755817e-001, 4.770166e-001, 4.784427e-001, 4.798631e-001, 4.812782e-001, 4.826854e-001, 4.840855e-001, 4.854811e-001, 4.868715e-001,
+4.882542e-001, 4.896319e-001, 4.910023e-001, 4.923650e-001, 4.937228e-001, 4.950732e-001, 4.964150e-001, 4.977517e-001, 4.990804e-001, 5.004033e-001,
+5.017221e-001, 5.030321e-001, 5.043380e-001, 5.056392e-001, 5.069329e-001, 5.082233e-001, 5.095075e-001, 5.107867e-001, 5.120629e-001, 5.133314e-001,
+5.145973e-001, 5.158583e-001, 5.171144e-001, 5.183682e-001, 5.196151e-001, 5.208599e-001, 5.221001e-001, 5.233365e-001, 5.245703e-001, 5.257987e-001,
+5.270252e-001, 5.282453e-001, 5.294621e-001, 5.306738e-001, 5.318812e-001, 5.330861e-001, 5.342843e-001, 5.354810e-001, 5.366704e-001, 5.378573e-001,
+5.390371e-001, 5.402138e-001, 5.413867e-001, 5.425545e-001, 5.437187e-001, 5.448786e-001, 5.460369e-001, 5.471885e-001, 5.483391e-001, 5.494848e-001,
+5.506297e-001, 5.517670e-001, 5.529032e-001, 5.540339e-001, 5.551629e-001, 5.562864e-001, 5.574083e-001, 5.585263e-001, 5.596422e-001, 5.607541e-001,
+5.618644e-001, 5.629719e-001, 5.640769e-001, 5.651778e-001, 5.662765e-001, 5.673714e-001, 5.684646e-001, 5.695542e-001, 5.706426e-001, 5.717275e-001,
+5.728116e-001, 5.738926e-001, 5.749726e-001, 5.760461e-001, 5.771194e-001, 5.781860e-001, 5.792527e-001, 5.803137e-001, 5.813742e-001, 5.824303e-001,
+5.834852e-001, 5.845344e-001, 5.855802e-001, 5.866221e-001, 5.876594e-001, 5.886946e-001, 5.897240e-001, 5.907529e-001, 5.917738e-001, 5.927946e-001,
+5.938080e-001, 5.948200e-001, 5.958277e-001, 5.968324e-001, 5.978347e-001, 5.988320e-001, 5.998289e-001, 6.008190e-001, 6.018090e-001, 6.027926e-001,
+6.037742e-001, 6.047533e-001, 6.057292e-001, 6.067043e-001, 6.076721e-001, 6.086398e-001, 6.096030e-001, 6.105645e-001, 6.115236e-001, 6.124787e-001,
+6.134338e-001, 6.143844e-001, 6.153350e-001, 6.162821e-001, 6.172265e-001, 6.181699e-001, 6.191054e-001, 6.200409e-001, 6.209712e-001, 6.218989e-001,
+6.228252e-001, 6.237459e-001, 6.246667e-001, 6.255833e-001, 6.264980e-001, 6.274115e-001, 6.283188e-001, 6.292260e-001, 6.301296e-001, 6.310311e-001,
+6.319321e-001, 6.328264e-001, 6.337207e-001, 6.346113e-001, 6.354981e-001, 6.363848e-001, 6.372650e-001, 6.381442e-001, 6.390221e-001, 6.398959e-001,
+6.407696e-001, 6.416400e-001, 6.425084e-001, 6.433767e-001, 6.442383e-001, 6.450996e-001, 6.459587e-001, 6.468116e-001, 6.476645e-001, 6.485136e-001,
+6.493594e-001, 6.502051e-001, 6.510460e-001, 6.518857e-001, 6.527251e-001, 6.535598e-001, 6.543945e-001, 6.552277e-001, 6.560571e-001, 6.568865e-001,
+6.577120e-001, 6.585327e-001, 6.593535e-001, 6.601702e-001, 6.609845e-001, 6.617988e-001, 6.626083e-001, 6.634163e-001, 6.642243e-001, 6.650285e-001,
+6.658324e-001, 6.666362e-001, 6.674347e-001, 6.682332e-001, 6.690312e-001, 6.698222e-001, 6.706133e-001, 6.714035e-001, 6.721884e-001, 6.729733e-001,
+6.737574e-001, 6.745372e-001, 6.753170e-001, 6.760962e-001, 6.768722e-001, 6.776482e-001, 6.784234e-001, 6.791932e-001, 6.799631e-001, 6.807324e-001,
+6.814961e-001, 6.822598e-001, 6.830234e-001, 6.837814e-001, 6.845394e-001, 6.852974e-001, 6.860502e-001, 6.868025e-001, 6.875548e-001, 6.883025e-001,
+6.890491e-001, 6.897957e-001, 6.905381e-001, 6.912782e-001, 6.920183e-001, 6.927559e-001, 6.934907e-001, 6.942256e-001, 6.949588e-001, 6.956875e-001,
+6.964163e-001, 6.971448e-001, 6.978684e-001, 6.985919e-001, 6.993154e-001, 7.000336e-001, 7.007503e-001, 7.014671e-001, 7.021806e-001, 7.028909e-001,
+7.036011e-001, 7.043104e-001, 7.050154e-001, 7.057204e-001, 7.064254e-001, 7.071260e-001, 7.078259e-001, 7.085258e-001, 7.092230e-001, 7.099172e-001,
+7.106114e-001, 7.113050e-001, 7.119927e-001, 7.126804e-001, 7.133682e-001, 7.140518e-001, 7.147333e-001, 7.154149e-001, 7.160954e-001, 7.167720e-001,
+7.174486e-001, 7.181252e-001, 7.187982e-001, 7.194700e-001, 7.201418e-001, 7.208123e-001, 7.214787e-001, 7.221451e-001, 7.228114e-001, 7.234750e-001,
+7.241373e-001, 7.247996e-001, 7.254614e-001, 7.261200e-001, 7.267785e-001, 7.274370e-001, 7.280923e-001, 7.287446e-001, 7.293970e-001, 7.300493e-001,
+7.306963e-001, 7.313427e-001, 7.319891e-001, 7.326344e-001, 7.332763e-001, 7.339182e-001, 7.345601e-001, 7.352003e-001, 7.358390e-001, 7.364777e-001,
+7.371164e-001, 7.377526e-001, 7.383884e-001, 7.390242e-001, 7.396595e-001, 7.402899e-001, 7.409204e-001, 7.415509e-001, 7.421798e-001, 7.428052e-001,
+7.434307e-001, 7.440561e-001, 7.446792e-001, 7.452999e-001, 7.459207e-001, 7.465414e-001, 7.471587e-001, 7.477742e-001, 7.483898e-001, 7.490053e-001,
+7.496180e-001, 7.502298e-001, 7.508416e-001, 7.514534e-001, 7.520615e-001, 7.526692e-001, 7.532769e-001, 7.538845e-001, 7.544875e-001, 7.550903e-001,
+7.556930e-001, 7.562957e-001, 7.568932e-001, 7.574906e-001, 7.580879e-001, 7.586853e-001, 7.592789e-001, 7.598724e-001, 7.604658e-001, 7.610593e-001,
+7.616505e-001, 7.622414e-001, 7.628324e-001, 7.634234e-001, 7.640111e-001, 7.645981e-001, 7.651851e-001, 7.657721e-001, 7.663552e-001, 7.669369e-001,
+7.675186e-001, 7.681002e-001, 7.686796e-001, 7.692573e-001, 7.698350e-001, 7.704127e-001, 7.709889e-001, 7.715630e-001, 7.721372e-001, 7.727113e-001,
+7.732846e-001, 7.738549e-001, 7.744253e-001, 7.749956e-001, 7.755660e-001, 7.761323e-001, 7.766984e-001, 7.772646e-001, 7.778308e-001, 7.783944e-001,
+7.789569e-001, 7.795193e-001, 7.800818e-001, 7.806433e-001, 7.812034e-001, 7.817635e-001, 7.823236e-001, 7.828836e-001, 7.834416e-001, 7.839996e-001,
+7.845576e-001, 7.851157e-001, 7.856712e-001, 7.862252e-001, 7.867793e-001, 7.873333e-001, 7.878866e-001, 7.884370e-001, 7.889873e-001, 7.895377e-001,
+7.900881e-001, 7.906360e-001, 7.911830e-001, 7.917301e-001, 7.922771e-001, 7.928233e-001, 7.933669e-001, 7.939104e-001, 7.944540e-001, 7.949975e-001,
+7.955383e-001, 7.960780e-001, 7.966177e-001, 7.971573e-001, 7.976964e-001, 7.982317e-001, 7.987670e-001, 7.993022e-001, 7.998375e-001, 8.003704e-001,
+8.009010e-001, 8.014316e-001, 8.019623e-001, 8.024929e-001, 8.030207e-001, 8.035481e-001, 8.040754e-001, 8.046028e-001, 8.051295e-001, 8.056535e-001,
+8.061775e-001, 8.067014e-001, 8.072254e-001, 8.077479e-001, 8.082688e-001, 8.087896e-001, 8.093104e-001, 8.098313e-001, 8.103502e-001, 8.108682e-001,
+8.113862e-001, 8.119042e-001, 8.124222e-001, 8.129376e-001, 8.134527e-001, 8.139677e-001, 8.144827e-001, 8.149977e-001, 8.155111e-001, 8.160244e-001,
+8.165378e-001, 8.170511e-001, 8.175641e-001, 8.180746e-001, 8.185852e-001, 8.190957e-001, 8.196063e-001, 8.201160e-001, 8.206226e-001, 8.211292e-001,
+8.216358e-001, 8.221425e-001, 8.226484e-001, 8.231524e-001, 8.236564e-001, 8.241604e-001, 8.246644e-001, 8.251677e-001, 8.256689e-001, 8.261701e-001,
+8.266713e-001, 8.271725e-001, 8.276733e-001, 8.281720e-001, 8.286707e-001, 8.291695e-001, 8.296682e-001, 8.301667e-001, 8.306632e-001, 8.311597e-001,
+8.316562e-001, 8.321527e-001, 8.326492e-001, 8.331434e-001, 8.336375e-001, 8.341316e-001, 8.346258e-001, 8.351199e-001, 8.356131e-001, 8.361061e-001,
+8.365991e-001, 8.370921e-001, 8.375851e-001, 8.380768e-001, 8.385676e-001, 8.390583e-001, 8.395491e-001, 8.400399e-001, 8.405297e-001, 8.410171e-001,
+8.415046e-001, 8.419920e-001, 8.424795e-001, 8.429669e-001, 8.434524e-001, 8.439378e-001, 8.444232e-001, 8.449086e-001, 8.453940e-001, 8.458780e-001,
+8.463612e-001, 8.468443e-001, 8.473275e-001, 8.478107e-001, 8.482932e-001, 8.487736e-001, 8.492540e-001, 8.497344e-001, 8.502148e-001, 8.506952e-001,
+8.511731e-001, 8.516505e-001, 8.521278e-001, 8.526051e-001, 8.530824e-001, 8.535592e-001, 8.540348e-001, 8.545104e-001, 8.549860e-001, 8.554616e-001,
+8.559372e-001, 8.564113e-001, 8.568849e-001, 8.573585e-001, 8.578321e-001, 8.583057e-001, 8.587789e-001, 8.592500e-001, 8.597210e-001, 8.601921e-001,
+8.606631e-001, 8.611342e-001, 8.616038e-001, 8.620721e-001, 8.625405e-001, 8.630088e-001, 8.634772e-001, 8.639456e-001, 8.644126e-001, 8.648794e-001,
+8.653463e-001, 8.658131e-001, 8.662800e-001, 8.667466e-001, 8.672117e-001, 8.676768e-001, 8.681420e-001, 8.686071e-001, 8.690722e-001, 8.695368e-001,
+8.700006e-001, 8.704643e-001, 8.709280e-001, 8.713917e-001, 8.718555e-001, 8.723185e-001, 8.727810e-001, 8.732436e-001, 8.737061e-001, 8.741687e-001,
+8.746312e-001, 8.750918e-001, 8.755515e-001, 8.760113e-001, 8.764711e-001, 8.769309e-001, 8.773906e-001, 8.778484e-001, 8.783057e-001, 8.787629e-001,
+8.792202e-001, 8.796775e-001, 8.801347e-001, 8.805908e-001, 8.810467e-001, 8.815026e-001, 8.819584e-001, 8.824143e-001, 8.828701e-001, 8.833251e-001,
+8.837799e-001, 8.842347e-001, 8.846895e-001, 8.851444e-001, 8.855992e-001, 8.860530e-001, 8.865064e-001, 8.869599e-001, 8.874133e-001, 8.878668e-001,
+8.883202e-001, 8.887727e-001, 8.892245e-001, 8.896764e-001, 8.901283e-001, 8.905802e-001, 8.910321e-001, 8.914834e-001, 8.919340e-001, 8.923847e-001,
+8.928353e-001, 8.932859e-001, 8.937366e-001, 8.941872e-001, 8.946376e-001, 8.950880e-001, 8.955384e-001, 8.959888e-001, 8.964392e-001, 8.968897e-001,
+8.973388e-001, 8.977879e-001, 8.982371e-001, 8.986862e-001, 8.991353e-001, 8.995844e-001, 9.000320e-001, 9.004787e-001, 9.009254e-001, 9.013721e-001,
+9.018188e-001, 9.022655e-001, 9.027118e-001, 9.031571e-001, 9.036025e-001, 9.040478e-001, 9.044931e-001, 9.049385e-001, 9.053838e-001, 9.058277e-001,
+9.062714e-001, 9.067150e-001, 9.071587e-001, 9.076024e-001, 9.080460e-001, 9.084891e-001, 9.089312e-001, 9.093734e-001, 9.098155e-001, 9.102577e-001,
+9.106998e-001, 9.111420e-001, 9.115830e-001, 9.120238e-001, 9.124646e-001, 9.129055e-001, 9.133463e-001, 9.137871e-001, 9.142275e-001, 9.146667e-001,
+9.151059e-001, 9.155451e-001, 9.159843e-001, 9.164235e-001, 9.168627e-001, 9.173015e-001, 9.177401e-001, 9.181786e-001, 9.186172e-001, 9.190558e-001,
+9.194944e-001, 9.199329e-001, 9.203706e-001, 9.208082e-001, 9.212459e-001, 9.216835e-001, 9.221211e-001, 9.225587e-001, 9.229962e-001, 9.234330e-001,
+9.238699e-001, 9.243067e-001, 9.247436e-001, 9.251804e-001, 9.256173e-001, 9.260539e-001, 9.264902e-001, 9.269265e-001, 9.273627e-001, 9.277990e-001,
+9.282352e-001, 9.286715e-001, 9.291066e-001, 9.295406e-001, 9.299747e-001, 9.304087e-001, 9.308427e-001, 9.312767e-001, 9.317108e-001, 9.321432e-001,
+9.325744e-001, 9.330057e-001, 9.334370e-001, 9.338682e-001, 9.342995e-001, 9.347308e-001, 9.351599e-001, 9.355877e-001, 9.360155e-001, 9.364433e-001,
+9.368711e-001, 9.372989e-001, 9.377266e-001, 9.381519e-001, 9.385753e-001, 9.389987e-001, 9.394221e-001, 9.398454e-001, 9.402688e-001, 9.406922e-001,
+9.411130e-001, 9.415309e-001, 9.419489e-001, 9.423668e-001, 9.427847e-001, 9.432026e-001, 9.436205e-001, 9.440370e-001, 9.444505e-001, 9.448639e-001,
+9.452774e-001, 9.456908e-001, 9.461043e-001, 9.465177e-001, 9.469309e-001, 9.473422e-001, 9.477534e-001, 9.481647e-001, 9.485760e-001, 9.489872e-001,
+9.493985e-001, 9.498097e-001, 9.502192e-001, 9.506283e-001, 9.510374e-001, 9.514465e-001, 9.518556e-001, 9.522647e-001, 9.526738e-001, 9.530814e-001,
+9.534873e-001, 9.538932e-001, 9.542991e-001, 9.547050e-001, 9.551109e-001, 9.555168e-001, 9.559224e-001, 9.563246e-001, 9.567268e-001, 9.571290e-001,
+9.575312e-001, 9.579333e-001, 9.583355e-001, 9.587377e-001, 9.591376e-001, 9.595360e-001, 9.599345e-001, 9.603330e-001, 9.607315e-001, 9.611299e-001,
+9.615284e-001, 9.619265e-001, 9.623210e-001, 9.627156e-001, 9.631102e-001, 9.635048e-001, 9.638994e-001, 9.642940e-001, 9.646885e-001, 9.650805e-001,
+9.654702e-001, 9.658598e-001, 9.662495e-001, 9.666391e-001, 9.670288e-001, 9.674184e-001, 9.678081e-001, 9.681930e-001, 9.685772e-001, 9.689615e-001,
+9.693457e-001, 9.697300e-001, 9.701142e-001, 9.704985e-001, 9.708817e-001, 9.712603e-001, 9.716388e-001, 9.720173e-001, 9.723958e-001, 9.727743e-001,
+9.731528e-001, 9.735313e-001, 9.739073e-001, 9.742793e-001, 9.746512e-001, 9.750232e-001, 9.753952e-001, 9.757672e-001, 9.761391e-001, 9.765111e-001,
+9.768790e-001, 9.772435e-001, 9.776081e-001, 9.779726e-001, 9.783372e-001, 9.787018e-001, 9.790663e-001, 9.794309e-001, 9.797904e-001, 9.801472e-001,
+9.805041e-001, 9.808609e-001, 9.812177e-001, 9.815746e-001, 9.819314e-001, 9.822882e-001, 9.826393e-001, 9.829876e-001, 9.833360e-001, 9.836843e-001,
+9.840326e-001, 9.843810e-001, 9.847293e-001, 9.850776e-001, 9.854195e-001, 9.857577e-001, 9.860960e-001, 9.864342e-001, 9.867724e-001, 9.871107e-001,
+9.874489e-001, 9.877872e-001, 9.881183e-001, 9.884435e-001, 9.887686e-001, 9.890937e-001, 9.894189e-001, 9.897440e-001, 9.900691e-001, 9.903943e-001,
+9.907139e-001, 9.910243e-001, 9.913347e-001, 9.916451e-001, 9.919555e-001, 9.922659e-001, 9.925763e-001, 9.928867e-001, 9.931951e-001, 9.934899e-001,
+9.937847e-001, 9.940794e-001, 9.943742e-001, 9.946690e-001, 9.949638e-001, 9.952586e-001, 9.955534e-001, 9.958318e-001, 9.961067e-001, 9.963817e-001,
+9.966566e-001, 9.969315e-001, 9.972064e-001, 9.974814e-001, 9.977563e-001, 9.980190e-001, 9.982666e-001, 9.985143e-001, 9.987619e-001, 9.990095e-001,
+9.992571e-001, 9.995048e-001, 9.997524e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Futura II 400", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.710046e-002, 2.964231e-002, 4.000878e-002, 4.924788e-002, 5.776918e-002, 6.580485e-002, 7.346954e-002, 8.084409e-002, 8.799251e-002,
+9.495572e-002, 1.018247e-001, 1.086273e-001, 1.152981e-001, 1.217758e-001, 1.280754e-001, 1.341704e-001, 1.400842e-001, 1.458258e-001, 1.513952e-001,
+1.568222e-001, 1.621166e-001, 1.672839e-001, 1.723344e-001, 1.772560e-001, 1.820692e-001, 1.867854e-001, 1.914004e-001, 1.959277e-001, 2.003668e-001,
+2.047297e-001, 2.090198e-001, 2.132407e-001, 2.173903e-001, 2.214687e-001, 2.254847e-001, 2.294347e-001, 2.333287e-001, 2.371630e-001, 2.409425e-001,
+2.446698e-001, 2.483462e-001, 2.519712e-001, 2.555448e-001, 2.590777e-001, 2.625568e-001, 2.659950e-001, 2.693926e-001, 2.727515e-001, 2.760718e-001,
+2.793445e-001, 2.825835e-001, 2.857859e-001, 2.889565e-001, 2.920954e-001, 2.951973e-001, 2.982689e-001, 3.013125e-001, 3.043303e-001, 3.073144e-001,
+3.102651e-001, 3.131818e-001, 3.160701e-001, 3.189300e-001, 3.217679e-001, 3.245872e-001, 3.273836e-001, 3.301528e-001, 3.328959e-001, 3.356124e-001,
+3.382978e-001, 3.409597e-001, 3.436001e-001, 3.462189e-001, 3.488170e-001, 3.513996e-001, 3.539630e-001, 3.565055e-001, 3.590308e-001, 3.615352e-001,
+3.640230e-001, 3.664915e-001, 3.689433e-001, 3.713740e-001, 3.737848e-001, 3.761711e-001, 3.785370e-001, 3.808848e-001, 3.832106e-001, 3.855204e-001,
+3.878141e-001, 3.900911e-001, 3.923526e-001, 3.945968e-001, 3.968230e-001, 3.990325e-001, 4.012251e-001, 4.033976e-001, 4.055522e-001, 4.076915e-001,
+4.098166e-001, 4.119274e-001, 4.140225e-001, 4.161037e-001, 4.181733e-001, 4.202328e-001, 4.222836e-001, 4.243231e-001, 4.263542e-001, 4.283750e-001,
+4.303873e-001, 4.323904e-001, 4.343845e-001, 4.363701e-001, 4.383464e-001, 4.403150e-001, 4.422721e-001, 4.442182e-001, 4.461521e-001, 4.480755e-001,
+4.499850e-001, 4.518805e-001, 4.537624e-001, 4.556313e-001, 4.574877e-001, 4.593302e-001, 4.611577e-001, 4.629719e-001, 4.647724e-001, 4.665606e-001,
+4.683365e-001, 4.700996e-001, 4.718487e-001, 4.735843e-001, 4.753075e-001, 4.770157e-001, 4.787110e-001, 4.803912e-001, 4.820597e-001, 4.837144e-001,
+4.853559e-001, 4.869850e-001, 4.886021e-001, 4.902065e-001, 4.917967e-001, 4.933750e-001, 4.949424e-001, 4.964992e-001, 4.980452e-001, 4.995797e-001,
+5.011046e-001, 5.026171e-001, 5.041204e-001, 5.056150e-001, 5.071011e-001, 5.085788e-001, 5.100476e-001, 5.115081e-001, 5.129604e-001, 5.144031e-001,
+5.158382e-001, 5.172676e-001, 5.186912e-001, 5.201077e-001, 5.215175e-001, 5.229221e-001, 5.243213e-001, 5.257117e-001, 5.270926e-001, 5.284672e-001,
+5.298362e-001, 5.311961e-001, 5.325514e-001, 5.339015e-001, 5.352419e-001, 5.365741e-001, 5.379003e-001, 5.392192e-001, 5.405316e-001, 5.418396e-001,
+5.431419e-001, 5.444355e-001, 5.457248e-001, 5.470087e-001, 5.482844e-001, 5.495557e-001, 5.508213e-001, 5.520780e-001, 5.533294e-001, 5.545720e-001,
+5.558082e-001, 5.570405e-001, 5.582659e-001, 5.594873e-001, 5.607051e-001, 5.619114e-001, 5.631139e-001, 5.643099e-001, 5.655002e-001, 5.666873e-001,
+5.678644e-001, 5.690370e-001, 5.702024e-001, 5.713610e-001, 5.725167e-001, 5.736652e-001, 5.748101e-001, 5.759480e-001, 5.770794e-001, 5.782069e-001,
+5.793257e-001, 5.804419e-001, 5.815506e-001, 5.826562e-001, 5.837576e-001, 5.848544e-001, 5.859488e-001, 5.870362e-001, 5.881219e-001, 5.891991e-001,
+5.902740e-001, 5.913425e-001, 5.924072e-001, 5.934672e-001, 5.945214e-001, 5.955718e-001, 5.966168e-001, 5.976600e-001, 5.986986e-001, 5.997366e-001,
+6.007700e-001, 6.018026e-001, 6.028274e-001, 6.038508e-001, 6.048674e-001, 6.058822e-001, 6.068913e-001, 6.078980e-001, 6.088987e-001, 6.098975e-001,
+6.108922e-001, 6.118846e-001, 6.128725e-001, 6.138583e-001, 6.148399e-001, 6.158197e-001, 6.167955e-001, 6.177694e-001, 6.187387e-001, 6.197069e-001,
+6.206719e-001, 6.216357e-001, 6.225941e-001, 6.235517e-001, 6.245011e-001, 6.254506e-001, 6.263934e-001, 6.273362e-001, 6.282751e-001, 6.292135e-001,
+6.301470e-001, 6.310787e-001, 6.320053e-001, 6.329280e-001, 6.338480e-001, 6.347641e-001, 6.356791e-001, 6.365907e-001, 6.375023e-001, 6.384099e-001,
+6.393176e-001, 6.402198e-001, 6.411203e-001, 6.420174e-001, 6.429114e-001, 6.438037e-001, 6.446919e-001, 6.455800e-001, 6.464618e-001, 6.473436e-001,
+6.482206e-001, 6.490955e-001, 6.499674e-001, 6.508346e-001, 6.517016e-001, 6.525606e-001, 6.534197e-001, 6.542748e-001, 6.551280e-001, 6.559793e-001,
+6.568263e-001, 6.576733e-001, 6.585139e-001, 6.593538e-001, 6.601900e-001, 6.610223e-001, 6.618544e-001, 6.626814e-001, 6.635085e-001, 6.643338e-001,
+6.651578e-001, 6.659813e-001, 6.668004e-001, 6.676196e-001, 6.684346e-001, 6.692470e-001, 6.700590e-001, 6.708669e-001, 6.716747e-001, 6.724805e-001,
+6.732845e-001, 6.740886e-001, 6.748862e-001, 6.756836e-001, 6.764787e-001, 6.772702e-001, 6.780618e-001, 6.788493e-001, 6.796358e-001, 6.804214e-001,
+6.812026e-001, 6.819838e-001, 6.827621e-001, 6.835377e-001, 6.843134e-001, 6.850838e-001, 6.858534e-001, 6.866219e-001, 6.873851e-001, 6.881483e-001,
+6.889086e-001, 6.896653e-001, 6.904220e-001, 6.911736e-001, 6.919231e-001, 6.926727e-001, 6.934152e-001, 6.941574e-001, 6.948988e-001, 6.956359e-001,
+6.963730e-001, 6.971086e-001, 6.978415e-001, 6.985744e-001, 6.993039e-001, 7.000302e-001, 7.007566e-001, 7.014790e-001, 7.021996e-001, 7.029201e-001,
+7.036369e-001, 7.043527e-001, 7.050685e-001, 7.057778e-001, 7.064864e-001, 7.071951e-001, 7.078975e-001, 7.085998e-001, 7.093019e-001, 7.100001e-001,
+7.106983e-001, 7.113964e-001, 7.120926e-001, 7.127889e-001, 7.134850e-001, 7.141777e-001, 7.148703e-001, 7.155628e-001, 7.162506e-001, 7.169384e-001,
+7.176261e-001, 7.183111e-001, 7.189961e-001, 7.196810e-001, 7.203641e-001, 7.210471e-001, 7.217300e-001, 7.224094e-001, 7.230881e-001, 7.237667e-001,
+7.244430e-001, 7.251182e-001, 7.257934e-001, 7.264671e-001, 7.271397e-001, 7.278122e-001, 7.284829e-001, 7.291506e-001, 7.298182e-001, 7.304852e-001,
+7.311488e-001, 7.318123e-001, 7.324759e-001, 7.331363e-001, 7.337966e-001, 7.344569e-001, 7.351134e-001, 7.357682e-001, 7.364230e-001, 7.370759e-001,
+7.377260e-001, 7.383761e-001, 7.390259e-001, 7.396721e-001, 7.403183e-001, 7.409645e-001, 7.416078e-001, 7.422502e-001, 7.428925e-001, 7.435334e-001,
+7.441718e-001, 7.448102e-001, 7.454486e-001, 7.460827e-001, 7.467168e-001, 7.473509e-001, 7.479826e-001, 7.486125e-001, 7.492423e-001, 7.498719e-001,
+7.504996e-001, 7.511272e-001, 7.517548e-001, 7.523803e-001, 7.530045e-001, 7.536288e-001, 7.542524e-001, 7.548721e-001, 7.554919e-001, 7.561116e-001,
+7.567298e-001, 7.573470e-001, 7.579642e-001, 7.585813e-001, 7.591949e-001, 7.598085e-001, 7.604220e-001, 7.610335e-001, 7.616423e-001, 7.622512e-001,
+7.628600e-001, 7.634665e-001, 7.640725e-001, 7.646785e-001, 7.652839e-001, 7.658861e-001, 7.664882e-001, 7.670904e-001, 7.676901e-001, 7.682873e-001,
+7.688844e-001, 7.694816e-001, 7.700764e-001, 7.706705e-001, 7.712646e-001, 7.718586e-001, 7.724486e-001, 7.730386e-001, 7.736286e-001, 7.742174e-001,
+7.748021e-001, 7.753869e-001, 7.759717e-001, 7.765550e-001, 7.771365e-001, 7.777179e-001, 7.782994e-001, 7.788783e-001, 7.794555e-001, 7.800327e-001,
+7.806098e-001, 7.811824e-001, 7.817530e-001, 7.823237e-001, 7.828944e-001, 7.834608e-001, 7.840262e-001, 7.845916e-001, 7.851570e-001, 7.857185e-001,
+7.862795e-001, 7.868405e-001, 7.874015e-001, 7.879566e-001, 7.885111e-001, 7.890655e-001, 7.896200e-001, 7.901696e-001, 7.907187e-001, 7.912678e-001,
+7.918168e-001, 7.923621e-001, 7.929067e-001, 7.934514e-001, 7.939961e-001, 7.945355e-001, 7.950735e-001, 7.956116e-001, 7.961497e-001, 7.966832e-001,
+7.972148e-001, 7.977464e-001, 7.982780e-001, 7.988071e-001, 7.993343e-001, 7.998614e-001, 8.003886e-001, 8.009144e-001, 8.014381e-001, 8.019619e-001,
+8.024856e-001, 8.030085e-001, 8.035272e-001, 8.040460e-001, 8.045647e-001, 8.050835e-001, 8.055984e-001, 8.061131e-001, 8.066278e-001, 8.071425e-001,
+8.076552e-001, 8.081669e-001, 8.086786e-001, 8.091902e-001, 8.097003e-001, 8.102073e-001, 8.107144e-001, 8.112215e-001, 8.117285e-001, 8.122319e-001,
+8.127353e-001, 8.132387e-001, 8.137421e-001, 8.142439e-001, 8.147446e-001, 8.152453e-001, 8.157460e-001, 8.162458e-001, 8.167423e-001, 8.172388e-001,
+8.177353e-001, 8.182318e-001, 8.187258e-001, 8.192190e-001, 8.197121e-001, 8.202053e-001, 8.206979e-001, 8.211887e-001, 8.216795e-001, 8.221703e-001,
+8.226610e-001, 8.231491e-001, 8.236360e-001, 8.241229e-001, 8.246098e-001, 8.250963e-001, 8.255803e-001, 8.260642e-001, 8.265481e-001, 8.270321e-001,
+8.275149e-001, 8.279967e-001, 8.284786e-001, 8.289604e-001, 8.294422e-001, 8.299209e-001, 8.303992e-001, 8.308775e-001, 8.313558e-001, 8.318336e-001,
+8.323092e-001, 8.327848e-001, 8.332604e-001, 8.337361e-001, 8.342108e-001, 8.346846e-001, 8.351584e-001, 8.356322e-001, 8.361061e-001, 8.365775e-001,
+8.370481e-001, 8.375187e-001, 8.379892e-001, 8.384598e-001, 8.389282e-001, 8.393964e-001, 8.398646e-001, 8.403327e-001, 8.408008e-001, 8.412675e-001,
+8.417341e-001, 8.422008e-001, 8.426674e-001, 8.431333e-001, 8.435961e-001, 8.440589e-001, 8.445217e-001, 8.449845e-001, 8.454463e-001, 8.459054e-001,
+8.463646e-001, 8.468238e-001, 8.472829e-001, 8.477417e-001, 8.481998e-001, 8.486578e-001, 8.491159e-001, 8.495739e-001, 8.500309e-001, 8.504856e-001,
+8.509402e-001, 8.513948e-001, 8.518495e-001, 8.523032e-001, 8.527547e-001, 8.532062e-001, 8.536576e-001, 8.541091e-001, 8.545604e-001, 8.550112e-001,
+8.554619e-001, 8.559127e-001, 8.563634e-001, 8.568140e-001, 8.572618e-001, 8.577095e-001, 8.581573e-001, 8.586050e-001, 8.590528e-001, 8.594974e-001,
+8.599415e-001, 8.603856e-001, 8.608297e-001, 8.612739e-001, 8.617168e-001, 8.621591e-001, 8.626013e-001, 8.630436e-001, 8.634859e-001, 8.639272e-001,
+8.643670e-001, 8.648068e-001, 8.652466e-001, 8.656864e-001, 8.661259e-001, 8.665626e-001, 8.669993e-001, 8.674361e-001, 8.678728e-001, 8.683095e-001,
+8.687452e-001, 8.691806e-001, 8.696160e-001, 8.700514e-001, 8.704868e-001, 8.709214e-001, 8.713548e-001, 8.717882e-001, 8.722217e-001, 8.726551e-001,
+8.730885e-001, 8.735180e-001, 8.739473e-001, 8.743765e-001, 8.748058e-001, 8.752350e-001, 8.756635e-001, 8.760909e-001, 8.765184e-001, 8.769458e-001,
+8.773733e-001, 8.778008e-001, 8.782267e-001, 8.786526e-001, 8.790785e-001, 8.795043e-001, 8.799302e-001, 8.803547e-001, 8.807769e-001, 8.811990e-001,
+8.816212e-001, 8.820433e-001, 8.824655e-001, 8.828866e-001, 8.833073e-001, 8.837281e-001, 8.841488e-001, 8.845695e-001, 8.849902e-001, 8.854097e-001,
+8.858292e-001, 8.862488e-001, 8.866683e-001, 8.870878e-001, 8.875058e-001, 8.879212e-001, 8.883366e-001, 8.887521e-001, 8.891675e-001, 8.895829e-001,
+8.899958e-001, 8.904073e-001, 8.908187e-001, 8.912302e-001, 8.916416e-001, 8.920531e-001, 8.924632e-001, 8.928730e-001, 8.932827e-001, 8.936925e-001,
+8.941023e-001, 8.945121e-001, 8.949183e-001, 8.953243e-001, 8.957304e-001, 8.961364e-001, 8.965425e-001, 8.969484e-001, 8.973509e-001, 8.977534e-001,
+8.981559e-001, 8.985583e-001, 8.989608e-001, 8.993632e-001, 8.997644e-001, 9.001656e-001, 9.005668e-001, 9.009679e-001, 9.013691e-001, 9.017700e-001,
+9.021678e-001, 9.025657e-001, 9.029635e-001, 9.033614e-001, 9.037592e-001, 9.041569e-001, 9.045508e-001, 9.049447e-001, 9.053386e-001, 9.057325e-001,
+9.061264e-001, 9.065202e-001, 9.069120e-001, 9.073035e-001, 9.076951e-001, 9.080867e-001, 9.084782e-001, 9.088698e-001, 9.092592e-001, 9.096479e-001,
+9.100366e-001, 9.104254e-001, 9.108141e-001, 9.112028e-001, 9.115895e-001, 9.119748e-001, 9.123601e-001, 9.127454e-001, 9.131307e-001, 9.135160e-001,
+9.139007e-001, 9.142842e-001, 9.146677e-001, 9.150511e-001, 9.154346e-001, 9.158181e-001, 9.162015e-001, 9.165826e-001, 9.169637e-001, 9.173448e-001,
+9.177259e-001, 9.181071e-001, 9.184882e-001, 9.188673e-001, 9.192455e-001, 9.196236e-001, 9.200018e-001, 9.203800e-001, 9.207581e-001, 9.211360e-001,
+9.215128e-001, 9.218896e-001, 9.222664e-001, 9.226432e-001, 9.230201e-001, 9.233969e-001, 9.237722e-001, 9.241471e-001, 9.245220e-001, 9.248969e-001,
+9.252718e-001, 9.256467e-001, 9.260207e-001, 9.263924e-001, 9.267641e-001, 9.271358e-001, 9.275075e-001, 9.278791e-001, 9.282508e-001, 9.286210e-001,
+9.289905e-001, 9.293600e-001, 9.297295e-001, 9.300991e-001, 9.304686e-001, 9.308380e-001, 9.312061e-001, 9.315742e-001, 9.319424e-001, 9.323105e-001,
+9.326787e-001, 9.330468e-001, 9.334139e-001, 9.337794e-001, 9.341449e-001, 9.345104e-001, 9.348759e-001, 9.352414e-001, 9.356069e-001, 9.359714e-001,
+9.363352e-001, 9.366991e-001, 9.370630e-001, 9.374268e-001, 9.377907e-001, 9.381546e-001, 9.385177e-001, 9.388807e-001, 9.392437e-001, 9.396067e-001,
+9.399698e-001, 9.403328e-001, 9.406958e-001, 9.410553e-001, 9.414149e-001, 9.417745e-001, 9.421341e-001, 9.424936e-001, 9.428532e-001, 9.432125e-001,
+9.435694e-001, 9.439263e-001, 9.442832e-001, 9.446401e-001, 9.449970e-001, 9.453540e-001, 9.457106e-001, 9.460659e-001, 9.464211e-001, 9.467763e-001,
+9.471315e-001, 9.474868e-001, 9.478420e-001, 9.481969e-001, 9.485492e-001, 9.489016e-001, 9.492539e-001, 9.496063e-001, 9.499586e-001, 9.503110e-001,
+9.506632e-001, 9.510115e-001, 9.513597e-001, 9.517080e-001, 9.520562e-001, 9.524045e-001, 9.527528e-001, 9.531010e-001, 9.534440e-001, 9.537863e-001,
+9.541286e-001, 9.544709e-001, 9.548132e-001, 9.551555e-001, 9.554979e-001, 9.558369e-001, 9.561746e-001, 9.565123e-001, 9.568500e-001, 9.571877e-001,
+9.575254e-001, 9.578631e-001, 9.581995e-001, 9.585341e-001, 9.588688e-001, 9.592035e-001, 9.595381e-001, 9.598728e-001, 9.602074e-001, 9.605418e-001,
+9.608738e-001, 9.612058e-001, 9.615379e-001, 9.618699e-001, 9.622019e-001, 9.625340e-001, 9.628660e-001, 9.631955e-001, 9.635243e-001, 9.638530e-001,
+9.641817e-001, 9.645104e-001, 9.648391e-001, 9.651678e-001, 9.654955e-001, 9.658207e-001, 9.661459e-001, 9.664711e-001, 9.667963e-001, 9.671215e-001,
+9.674468e-001, 9.677720e-001, 9.680947e-001, 9.684168e-001, 9.687389e-001, 9.690610e-001, 9.693831e-001, 9.697053e-001, 9.700274e-001, 9.703486e-001,
+9.706671e-001, 9.709855e-001, 9.713039e-001, 9.716224e-001, 9.719408e-001, 9.722593e-001, 9.725777e-001, 9.728939e-001, 9.732085e-001, 9.735232e-001,
+9.738378e-001, 9.741525e-001, 9.744671e-001, 9.747818e-001, 9.750964e-001, 9.754077e-001, 9.757186e-001, 9.760296e-001, 9.763405e-001, 9.766515e-001,
+9.769624e-001, 9.772734e-001, 9.775836e-001, 9.778903e-001, 9.781970e-001, 9.785036e-001, 9.788103e-001, 9.791170e-001, 9.794237e-001, 9.797304e-001,
+9.800354e-001, 9.803376e-001, 9.806397e-001, 9.809418e-001, 9.812439e-001, 9.815461e-001, 9.818482e-001, 9.821503e-001, 9.824500e-001, 9.827468e-001,
+9.830437e-001, 9.833405e-001, 9.836374e-001, 9.839342e-001, 9.842311e-001, 9.845279e-001, 9.848216e-001, 9.851122e-001, 9.854028e-001, 9.856935e-001,
+9.859841e-001, 9.862747e-001, 9.865653e-001, 9.868560e-001, 9.871437e-001, 9.874286e-001, 9.877135e-001, 9.879983e-001, 9.882832e-001, 9.885681e-001,
+9.888530e-001, 9.891379e-001, 9.894198e-001, 9.896977e-001, 9.899755e-001, 9.902534e-001, 9.905313e-001, 9.908092e-001, 9.910870e-001, 9.913649e-001,
+9.916403e-001, 9.919093e-001, 9.921782e-001, 9.924471e-001, 9.927160e-001, 9.929850e-001, 9.932539e-001, 9.935228e-001, 9.937913e-001, 9.940528e-001,
+9.943143e-001, 9.945757e-001, 9.948372e-001, 9.950987e-001, 9.953602e-001, 9.956216e-001, 9.958831e-001, 9.961358e-001, 9.963859e-001, 9.966360e-001,
+9.968861e-001, 9.971362e-001, 9.973863e-001, 9.976364e-001, 9.978865e-001, 9.981298e-001, 9.983635e-001, 9.985973e-001, 9.988311e-001, 9.990649e-001,
+9.992987e-001, 9.995324e-001, 9.997662e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.560149e-002, 2.750586e-002, 3.789168e-002, 4.734877e-002, 5.619849e-002, 6.449334e-002, 7.241524e-002, 8.003665e-002, 8.734617e-002,
+9.443253e-002, 1.012880e-001, 1.079067e-001, 1.143304e-001, 1.205367e-001, 1.265350e-001, 1.323579e-001, 1.380201e-001, 1.435257e-001, 1.488673e-001,
+1.540704e-001, 1.591501e-001, 1.641123e-001, 1.689572e-001, 1.737031e-001, 1.783441e-001, 1.828868e-001, 1.873380e-001, 1.917000e-001, 1.959740e-001,
+2.001685e-001, 2.042849e-001, 2.083213e-001, 2.122910e-001, 2.161972e-001, 2.200367e-001, 2.238189e-001, 2.275475e-001, 2.312256e-001, 2.348574e-001,
+2.384261e-001, 2.419455e-001, 2.454174e-001, 2.488500e-001, 2.522298e-001, 2.555680e-001, 2.588673e-001, 2.621266e-001, 2.653498e-001, 2.685380e-001,
+2.716935e-001, 2.748126e-001, 2.778982e-001, 2.809518e-001, 2.839731e-001, 2.869610e-001, 2.899155e-001, 2.928346e-001, 2.957250e-001, 2.985872e-001,
+3.014270e-001, 3.042409e-001, 3.070298e-001, 3.097898e-001, 3.125233e-001, 3.152285e-001, 3.179100e-001, 3.205696e-001, 3.232056e-001, 3.258267e-001,
+3.284305e-001, 3.310135e-001, 3.335743e-001, 3.361157e-001, 3.386341e-001, 3.411293e-001, 3.436001e-001, 3.460494e-001, 3.484822e-001, 3.508950e-001,
+3.532889e-001, 3.556645e-001, 3.580289e-001, 3.603789e-001, 3.627199e-001, 3.650497e-001, 3.673666e-001, 3.696696e-001, 3.719571e-001, 3.742293e-001,
+3.764826e-001, 3.787195e-001, 3.809431e-001, 3.831508e-001, 3.853424e-001, 3.875182e-001, 3.896811e-001, 3.918299e-001, 3.939659e-001, 3.960889e-001,
+3.981985e-001, 4.002933e-001, 4.023733e-001, 4.044389e-001, 4.064900e-001, 4.085263e-001, 4.105475e-001, 4.125526e-001, 4.145422e-001, 4.165203e-001,
+4.184862e-001, 4.204401e-001, 4.223817e-001, 4.243109e-001, 4.262313e-001, 4.281424e-001, 4.300463e-001, 4.319409e-001, 4.338287e-001, 4.357072e-001,
+4.375792e-001, 4.394420e-001, 4.412986e-001, 4.431461e-001, 4.449876e-001, 4.468203e-001, 4.486470e-001, 4.504653e-001, 4.522775e-001, 4.540819e-001,
+4.558799e-001, 4.576708e-001, 4.594549e-001, 4.612327e-001, 4.630033e-001, 4.647684e-001, 4.665257e-001, 4.682777e-001, 4.700197e-001, 4.717537e-001,
+4.734789e-001, 4.751960e-001, 4.769047e-001, 4.786029e-001, 4.802902e-001, 4.819664e-001, 4.836333e-001, 4.852911e-001, 4.869402e-001, 4.885810e-001,
+4.902120e-001, 4.918345e-001, 4.934496e-001, 4.950575e-001, 4.966586e-001, 4.982511e-001, 4.998352e-001, 5.014110e-001, 5.029789e-001, 5.045388e-001,
+5.060890e-001, 5.076316e-001, 5.091663e-001, 5.106902e-001, 5.122056e-001, 5.137132e-001, 5.152136e-001, 5.167068e-001, 5.181898e-001, 5.196657e-001,
+5.211350e-001, 5.225929e-001, 5.240452e-001, 5.254918e-001, 5.269279e-001, 5.283559e-001, 5.297779e-001, 5.311922e-001, 5.325988e-001, 5.340007e-001,
+5.353968e-001, 5.367846e-001, 5.381673e-001, 5.395434e-001, 5.409130e-001, 5.422786e-001, 5.436386e-001, 5.449924e-001, 5.463422e-001, 5.476845e-001,
+5.490230e-001, 5.503588e-001, 5.516861e-001, 5.530082e-001, 5.543255e-001, 5.556346e-001, 5.569405e-001, 5.582409e-001, 5.595367e-001, 5.608299e-001,
+5.621141e-001, 5.633950e-001, 5.646705e-001, 5.659371e-001, 5.671999e-001, 5.684533e-001, 5.697033e-001, 5.709467e-001, 5.721855e-001, 5.734215e-001,
+5.746489e-001, 5.758740e-001, 5.770923e-001, 5.783078e-001, 5.795192e-001, 5.807258e-001, 5.819299e-001, 5.831275e-001, 5.843237e-001, 5.855126e-001,
+5.866998e-001, 5.878822e-001, 5.890614e-001, 5.902367e-001, 5.914066e-001, 5.925731e-001, 5.937318e-001, 5.948878e-001, 5.960369e-001, 5.971851e-001,
+5.983255e-001, 5.994653e-001, 6.005987e-001, 6.017305e-001, 6.028542e-001, 6.039756e-001, 6.050894e-001, 6.062009e-001, 6.073063e-001, 6.084094e-001,
+6.095078e-001, 6.106038e-001, 6.116949e-001, 6.127820e-001, 6.138613e-001, 6.149377e-001, 6.160081e-001, 6.170759e-001, 6.181376e-001, 6.191978e-001,
+6.202535e-001, 6.213079e-001, 6.223562e-001, 6.234036e-001, 6.244416e-001, 6.254797e-001, 6.265093e-001, 6.275388e-001, 6.285621e-001, 6.295846e-001,
+6.306030e-001, 6.316200e-001, 6.326320e-001, 6.336405e-001, 6.346455e-001, 6.356455e-001, 6.366437e-001, 6.376357e-001, 6.386275e-001, 6.396116e-001,
+6.405956e-001, 6.415735e-001, 6.425496e-001, 6.435209e-001, 6.444881e-001, 6.454532e-001, 6.464131e-001, 6.473729e-001, 6.483272e-001, 6.492815e-001,
+6.502331e-001, 6.511835e-001, 6.521315e-001, 6.530754e-001, 6.540190e-001, 6.549540e-001, 6.558890e-001, 6.568190e-001, 6.577466e-001, 6.586722e-001,
+6.595928e-001, 6.605134e-001, 6.614270e-001, 6.623397e-001, 6.632481e-001, 6.641519e-001, 6.650554e-001, 6.659534e-001, 6.668513e-001, 6.677461e-001,
+6.686387e-001, 6.695306e-001, 6.704167e-001, 6.713029e-001, 6.721845e-001, 6.730634e-001, 6.739417e-001, 6.748150e-001, 6.756882e-001, 6.765587e-001,
+6.774269e-001, 6.782951e-001, 6.791550e-001, 6.800148e-001, 6.808714e-001, 6.817232e-001, 6.825750e-001, 6.834219e-001, 6.842676e-001, 6.851122e-001,
+6.859521e-001, 6.867920e-001, 6.876285e-001, 6.884619e-001, 6.892954e-001, 6.901228e-001, 6.909493e-001, 6.917747e-001, 6.925947e-001, 6.934146e-001,
+6.942318e-001, 6.950456e-001, 6.958594e-001, 6.966684e-001, 6.974755e-001, 6.982826e-001, 6.990850e-001, 6.998872e-001, 7.006883e-001, 7.014837e-001,
+7.022791e-001, 7.030713e-001, 7.038580e-001, 7.046448e-001, 7.054278e-001, 7.062077e-001, 7.069876e-001, 7.077632e-001, 7.085369e-001, 7.093106e-001,
+7.100790e-001, 7.108461e-001, 7.116132e-001, 7.123738e-001, 7.131338e-001, 7.138937e-001, 7.146461e-001, 7.153983e-001, 7.161503e-001, 7.168944e-001,
+7.176385e-001, 7.183823e-001, 7.191202e-001, 7.198581e-001, 7.205957e-001, 7.213283e-001, 7.220609e-001, 7.227932e-001, 7.235178e-001, 7.242423e-001,
+7.249669e-001, 7.256841e-001, 7.264014e-001, 7.271186e-001, 7.278298e-001, 7.285405e-001, 7.292512e-001, 7.299574e-001, 7.306627e-001, 7.313679e-001,
+7.320698e-001, 7.327703e-001, 7.334708e-001, 7.341671e-001, 7.348600e-001, 7.355528e-001, 7.362432e-001, 7.369295e-001, 7.376158e-001, 7.383014e-001,
+7.389840e-001, 7.396667e-001, 7.403493e-001, 7.410271e-001, 7.417047e-001, 7.423822e-001, 7.430556e-001, 7.437271e-001, 7.443987e-001, 7.450684e-001,
+7.457355e-001, 7.464025e-001, 7.470691e-001, 7.477304e-001, 7.483917e-001, 7.490529e-001, 7.497091e-001, 7.503637e-001, 7.510183e-001, 7.516708e-001,
+7.523203e-001, 7.529697e-001, 7.536192e-001, 7.542621e-001, 7.549051e-001, 7.555481e-001, 7.561880e-001, 7.568256e-001, 7.574633e-001, 7.581006e-001,
+7.587359e-001, 7.593712e-001, 7.600065e-001, 7.606381e-001, 7.612677e-001, 7.618974e-001, 7.625262e-001, 7.631501e-001, 7.637741e-001, 7.643980e-001,
+7.650203e-001, 7.656415e-001, 7.662626e-001, 7.668836e-001, 7.674987e-001, 7.681139e-001, 7.687291e-001, 7.693410e-001, 7.699489e-001, 7.705568e-001,
+7.711647e-001, 7.717683e-001, 7.723710e-001, 7.729737e-001, 7.735757e-001, 7.741743e-001, 7.747729e-001, 7.753715e-001, 7.759671e-001, 7.765595e-001,
+7.771518e-001, 7.777442e-001, 7.783326e-001, 7.789197e-001, 7.795069e-001, 7.800940e-001, 7.806769e-001, 7.812599e-001, 7.818429e-001, 7.824249e-001,
+7.830037e-001, 7.835826e-001, 7.841614e-001, 7.847386e-001, 7.853135e-001, 7.858884e-001, 7.864633e-001, 7.870357e-001, 7.876066e-001, 7.881774e-001,
+7.887482e-001, 7.893161e-001, 7.898829e-001, 7.904497e-001, 7.910165e-001, 7.915802e-001, 7.921432e-001, 7.927061e-001, 7.932691e-001, 7.938285e-001,
+7.943874e-001, 7.949463e-001, 7.955053e-001, 7.960606e-001, 7.966156e-001, 7.971707e-001, 7.977257e-001, 7.982773e-001, 7.988285e-001, 7.993797e-001,
+7.999310e-001, 8.004787e-001, 8.010259e-001, 8.015732e-001, 8.021204e-001, 8.026637e-001, 8.032061e-001, 8.037484e-001, 8.042908e-001, 8.048293e-001,
+8.053662e-001, 8.059031e-001, 8.064400e-001, 8.069747e-001, 8.075077e-001, 8.080407e-001, 8.085737e-001, 8.091049e-001, 8.096332e-001, 8.101615e-001,
+8.106899e-001, 8.112172e-001, 8.117403e-001, 8.122633e-001, 8.127863e-001, 8.133093e-001, 8.138289e-001, 8.143482e-001, 8.148675e-001, 8.153868e-001,
+8.159032e-001, 8.164180e-001, 8.169328e-001, 8.174476e-001, 8.179603e-001, 8.184690e-001, 8.189777e-001, 8.194865e-001, 8.199952e-001, 8.205006e-001,
+8.210061e-001, 8.215116e-001, 8.220170e-001, 8.225207e-001, 8.230231e-001, 8.235256e-001, 8.240281e-001, 8.245295e-001, 8.250265e-001, 8.255234e-001,
+8.260204e-001, 8.265173e-001, 8.270122e-001, 8.275064e-001, 8.280006e-001, 8.284948e-001, 8.289883e-001, 8.294800e-001, 8.299717e-001, 8.304634e-001,
+8.309550e-001, 8.314424e-001, 8.319282e-001, 8.324139e-001, 8.328996e-001, 8.333847e-001, 8.338665e-001, 8.343483e-001, 8.348300e-001, 8.353118e-001,
+8.357925e-001, 8.362724e-001, 8.367522e-001, 8.372321e-001, 8.377119e-001, 8.381870e-001, 8.386615e-001, 8.391360e-001, 8.396105e-001, 8.400841e-001,
+8.405543e-001, 8.410244e-001, 8.414946e-001, 8.419648e-001, 8.424335e-001, 8.429006e-001, 8.433678e-001, 8.438349e-001, 8.443020e-001, 8.447658e-001,
+8.452284e-001, 8.456910e-001, 8.461535e-001, 8.466161e-001, 8.470754e-001, 8.475344e-001, 8.479934e-001, 8.484524e-001, 8.489112e-001, 8.493679e-001,
+8.498246e-001, 8.502813e-001, 8.507381e-001, 8.511940e-001, 8.516469e-001, 8.520998e-001, 8.525527e-001, 8.530056e-001, 8.534574e-001, 8.539065e-001,
+8.543557e-001, 8.548049e-001, 8.552540e-001, 8.557022e-001, 8.561482e-001, 8.565942e-001, 8.570402e-001, 8.574863e-001, 8.579314e-001, 8.583744e-001,
+8.588174e-001, 8.592605e-001, 8.597035e-001, 8.601453e-001, 8.605837e-001, 8.610221e-001, 8.614605e-001, 8.618989e-001, 8.623365e-001, 8.627707e-001,
+8.632048e-001, 8.636389e-001, 8.640730e-001, 8.645070e-001, 8.649372e-001, 8.653675e-001, 8.657977e-001, 8.662280e-001, 8.666582e-001, 8.670851e-001,
+8.675116e-001, 8.679380e-001, 8.683645e-001, 8.687909e-001, 8.692151e-001, 8.696381e-001, 8.700612e-001, 8.704842e-001, 8.709072e-001, 8.713290e-001,
+8.717490e-001, 8.721689e-001, 8.725889e-001, 8.730089e-001, 8.734286e-001, 8.738455e-001, 8.742625e-001, 8.746795e-001, 8.750965e-001, 8.755134e-001,
+8.759278e-001, 8.763412e-001, 8.767547e-001, 8.771682e-001, 8.775817e-001, 8.779937e-001, 8.784035e-001, 8.788132e-001, 8.792229e-001, 8.796326e-001,
+8.800424e-001, 8.804501e-001, 8.808577e-001, 8.812653e-001, 8.816729e-001, 8.820805e-001, 8.824870e-001, 8.828920e-001, 8.832970e-001, 8.837020e-001,
+8.841070e-001, 8.845119e-001, 8.849135e-001, 8.853148e-001, 8.857160e-001, 8.861173e-001, 8.865186e-001, 8.869189e-001, 8.873175e-001, 8.877161e-001,
+8.881147e-001, 8.885133e-001, 8.889119e-001, 8.893093e-001, 8.897062e-001, 8.901032e-001, 8.905002e-001, 8.908971e-001, 8.912938e-001, 8.916873e-001,
+8.920807e-001, 8.924741e-001, 8.928675e-001, 8.932609e-001, 8.936527e-001, 8.940415e-001, 8.944303e-001, 8.948191e-001, 8.952078e-001, 8.955966e-001,
+8.959845e-001, 8.963718e-001, 8.967591e-001, 8.971464e-001, 8.975337e-001, 8.979210e-001, 8.983063e-001, 8.986910e-001, 8.990757e-001, 8.994605e-001,
+8.998452e-001, 9.002299e-001, 9.006112e-001, 9.009923e-001, 9.013733e-001, 9.017544e-001, 9.021355e-001, 9.025166e-001, 9.028971e-001, 9.032776e-001,
+9.036581e-001, 9.040386e-001, 9.044192e-001, 9.047995e-001, 9.051784e-001, 9.055573e-001, 9.059361e-001, 9.063150e-001, 9.066939e-001, 9.070724e-001,
+9.074478e-001, 9.078232e-001, 9.081986e-001, 9.085740e-001, 9.089493e-001, 9.093246e-001, 9.096975e-001, 9.100704e-001, 9.104432e-001, 9.108161e-001,
+9.111890e-001, 9.115619e-001, 9.119333e-001, 9.123046e-001, 9.126760e-001, 9.130473e-001, 9.134187e-001, 9.137900e-001, 9.141587e-001, 9.145267e-001,
+9.148947e-001, 9.152627e-001, 9.156307e-001, 9.159987e-001, 9.163650e-001, 9.167301e-001, 9.170952e-001, 9.174603e-001, 9.178254e-001, 9.181905e-001,
+9.185554e-001, 9.189200e-001, 9.192845e-001, 9.196491e-001, 9.200137e-001, 9.203782e-001, 9.207428e-001, 9.211050e-001, 9.214672e-001, 9.218295e-001,
+9.221917e-001, 9.225540e-001, 9.229162e-001, 9.232757e-001, 9.236339e-001, 9.239920e-001, 9.243502e-001, 9.247083e-001, 9.250665e-001, 9.254242e-001,
+9.257806e-001, 9.261370e-001, 9.264934e-001, 9.268498e-001, 9.272062e-001, 9.275626e-001, 9.279180e-001, 9.282731e-001, 9.286281e-001, 9.289832e-001,
+9.293383e-001, 9.296934e-001, 9.300474e-001, 9.303987e-001, 9.307499e-001, 9.311012e-001, 9.314524e-001, 9.318037e-001, 9.321550e-001, 9.325038e-001,
+9.328516e-001, 9.331995e-001, 9.335473e-001, 9.338951e-001, 9.342429e-001, 9.345907e-001, 9.349374e-001, 9.352841e-001, 9.356308e-001, 9.359775e-001,
+9.363242e-001, 9.366709e-001, 9.370165e-001, 9.373604e-001, 9.377043e-001, 9.380481e-001, 9.383920e-001, 9.387359e-001, 9.390798e-001, 9.394216e-001,
+9.397623e-001, 9.401030e-001, 9.404437e-001, 9.407844e-001, 9.411250e-001, 9.414657e-001, 9.418052e-001, 9.421444e-001, 9.424837e-001, 9.428229e-001,
+9.431622e-001, 9.435014e-001, 9.438407e-001, 9.441781e-001, 9.445156e-001, 9.448531e-001, 9.451906e-001, 9.455281e-001, 9.458656e-001, 9.462027e-001,
+9.465367e-001, 9.468708e-001, 9.472048e-001, 9.475389e-001, 9.478730e-001, 9.482070e-001, 9.485409e-001, 9.488738e-001, 9.492066e-001, 9.495395e-001,
+9.498723e-001, 9.502052e-001, 9.505380e-001, 9.508708e-001, 9.512028e-001, 9.515348e-001, 9.518669e-001, 9.521989e-001, 9.525309e-001, 9.528629e-001,
+9.531948e-001, 9.535222e-001, 9.538497e-001, 9.541772e-001, 9.545047e-001, 9.548321e-001, 9.551596e-001, 9.554871e-001, 9.558085e-001, 9.561292e-001,
+9.564499e-001, 9.567706e-001, 9.570914e-001, 9.574121e-001, 9.577328e-001, 9.580510e-001, 9.583681e-001, 9.586851e-001, 9.590022e-001, 9.593193e-001,
+9.596364e-001, 9.599535e-001, 9.602695e-001, 9.605841e-001, 9.608987e-001, 9.612134e-001, 9.615280e-001, 9.618426e-001, 9.621572e-001, 9.624715e-001,
+9.627836e-001, 9.630956e-001, 9.634076e-001, 9.637196e-001, 9.640316e-001, 9.643437e-001, 9.646557e-001, 9.649662e-001, 9.652761e-001, 9.655861e-001,
+9.658960e-001, 9.662060e-001, 9.665159e-001, 9.668259e-001, 9.671350e-001, 9.674422e-001, 9.677494e-001, 9.680567e-001, 9.683639e-001, 9.686711e-001,
+9.689784e-001, 9.692856e-001, 9.695898e-001, 9.698933e-001, 9.701967e-001, 9.705002e-001, 9.708037e-001, 9.711071e-001, 9.714106e-001, 9.717134e-001,
+9.720139e-001, 9.723145e-001, 9.726150e-001, 9.729156e-001, 9.732162e-001, 9.735167e-001, 9.738173e-001, 9.741159e-001, 9.744133e-001, 9.747106e-001,
+9.750080e-001, 9.753054e-001, 9.756028e-001, 9.759001e-001, 9.761975e-001, 9.764911e-001, 9.767844e-001, 9.770777e-001, 9.773710e-001, 9.776642e-001,
+9.779575e-001, 9.782508e-001, 9.785434e-001, 9.788325e-001, 9.791216e-001, 9.794107e-001, 9.796998e-001, 9.799889e-001, 9.802780e-001, 9.805672e-001,
+9.808547e-001, 9.811395e-001, 9.814242e-001, 9.817090e-001, 9.819937e-001, 9.822785e-001, 9.825632e-001, 9.828480e-001, 9.831304e-001, 9.834102e-001,
+9.836900e-001, 9.839698e-001, 9.842495e-001, 9.845293e-001, 9.848091e-001, 9.850889e-001, 9.853663e-001, 9.856416e-001, 9.859169e-001, 9.861922e-001,
+9.864675e-001, 9.867428e-001, 9.870181e-001, 9.872933e-001, 9.875662e-001, 9.878366e-001, 9.881070e-001, 9.883774e-001, 9.886478e-001, 9.889182e-001,
+9.891886e-001, 9.894590e-001, 9.897269e-001, 9.899914e-001, 9.902558e-001, 9.905202e-001, 9.907847e-001, 9.910491e-001, 9.913136e-001, 9.915780e-001,
+9.918412e-001, 9.921012e-001, 9.923612e-001, 9.926212e-001, 9.928812e-001, 9.931412e-001, 9.934012e-001, 9.936612e-001, 9.939208e-001, 9.941739e-001,
+9.944270e-001, 9.946801e-001, 9.949333e-001, 9.951864e-001, 9.954395e-001, 9.956926e-001, 9.959457e-001, 9.961908e-001, 9.964336e-001, 9.966763e-001,
+9.969191e-001, 9.971618e-001, 9.974046e-001, 9.976473e-001, 9.978901e-001, 9.981291e-001, 9.983630e-001, 9.985968e-001, 9.988307e-001, 9.990645e-001,
+9.992984e-001, 9.995323e-001, 9.997661e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.102147e-002, 2.043701e-002, 2.861953e-002, 3.606900e-002, 4.299621e-002, 4.955287e-002, 5.580672e-002, 6.181912e-002, 6.762630e-002,
+7.326979e-002, 7.874531e-002, 8.405073e-002, 8.920191e-002, 9.422217e-002, 9.910791e-002, 1.038789e-001, 1.085413e-001, 1.130929e-001, 1.175399e-001,
+1.219095e-001, 1.262044e-001, 1.304340e-001, 1.346047e-001, 1.387116e-001, 1.427484e-001, 1.467115e-001, 1.506100e-001, 1.544382e-001, 1.582106e-001,
+1.619343e-001, 1.656127e-001, 1.692394e-001, 1.728218e-001, 1.763650e-001, 1.798642e-001, 1.833273e-001, 1.867598e-001, 1.901571e-001, 1.935155e-001,
+1.968335e-001, 2.001167e-001, 2.033713e-001, 2.066029e-001, 2.098037e-001, 2.129680e-001, 2.161033e-001, 2.192151e-001, 2.222974e-001, 2.253467e-001,
+2.283667e-001, 2.313647e-001, 2.343385e-001, 2.372840e-001, 2.402049e-001, 2.431025e-001, 2.459677e-001, 2.488069e-001, 2.516252e-001, 2.544236e-001,
+2.572004e-001, 2.599579e-001, 2.626876e-001, 2.653909e-001, 2.680733e-001, 2.707414e-001, 2.733910e-001, 2.760204e-001, 2.786308e-001, 2.812187e-001,
+2.837874e-001, 2.863405e-001, 2.888756e-001, 2.913907e-001, 2.938865e-001, 2.963630e-001, 2.988243e-001, 3.012715e-001, 3.036991e-001, 3.061035e-001,
+3.084930e-001, 3.108676e-001, 3.132285e-001, 3.155709e-001, 3.179005e-001, 3.202157e-001, 3.225138e-001, 3.247898e-001, 3.270478e-001, 3.292933e-001,
+3.315246e-001, 3.337423e-001, 3.359439e-001, 3.381271e-001, 3.402962e-001, 3.424524e-001, 3.445951e-001, 3.467191e-001, 3.488298e-001, 3.509295e-001,
+3.530152e-001, 3.550836e-001, 3.571368e-001, 3.591760e-001, 3.611990e-001, 3.632034e-001, 3.651931e-001, 3.671698e-001, 3.691324e-001, 3.710797e-001,
+3.730099e-001, 3.749247e-001, 3.768285e-001, 3.787208e-001, 3.806005e-001, 3.824656e-001, 3.843190e-001, 3.861612e-001, 3.879928e-001, 3.898115e-001,
+3.916177e-001, 3.934090e-001, 3.951861e-001, 3.969503e-001, 3.987066e-001, 4.004545e-001, 4.021934e-001, 4.039224e-001, 4.056410e-001, 4.073484e-001,
+4.090481e-001, 4.107409e-001, 4.124263e-001, 4.141052e-001, 4.157784e-001, 4.174447e-001, 4.191048e-001, 4.207562e-001, 4.224034e-001, 4.240437e-001,
+4.256787e-001, 4.273072e-001, 4.289288e-001, 4.305444e-001, 4.321512e-001, 4.337507e-001, 4.353413e-001, 4.369244e-001, 4.385007e-001, 4.400705e-001,
+4.416334e-001, 4.431882e-001, 4.447365e-001, 4.462780e-001, 4.478122e-001, 4.493380e-001, 4.508579e-001, 4.523723e-001, 4.538813e-001, 4.553842e-001,
+4.568797e-001, 4.583696e-001, 4.598539e-001, 4.613319e-001, 4.628019e-001, 4.642662e-001, 4.657248e-001, 4.671760e-001, 4.686198e-001, 4.700577e-001,
+4.714900e-001, 4.729128e-001, 4.743296e-001, 4.757412e-001, 4.771471e-001, 4.785468e-001, 4.799422e-001, 4.813325e-001, 4.827157e-001, 4.840947e-001,
+4.854689e-001, 4.868355e-001, 4.881993e-001, 4.895604e-001, 4.909155e-001, 4.922683e-001, 4.936183e-001, 4.949627e-001, 4.963046e-001, 4.976435e-001,
+4.989765e-001, 5.003060e-001, 5.016295e-001, 5.029485e-001, 5.042637e-001, 5.055727e-001, 5.068781e-001, 5.081769e-001, 5.094692e-001, 5.107580e-001,
+5.120383e-001, 5.133149e-001, 5.145862e-001, 5.158512e-001, 5.171135e-001, 5.183679e-001, 5.196194e-001, 5.208658e-001, 5.221070e-001, 5.233457e-001,
+5.245773e-001, 5.258070e-001, 5.270309e-001, 5.282518e-001, 5.294687e-001, 5.306801e-001, 5.318888e-001, 5.330894e-001, 5.342882e-001, 5.354802e-001,
+5.366698e-001, 5.378534e-001, 5.390338e-001, 5.402105e-001, 5.413823e-001, 5.425513e-001, 5.437142e-001, 5.448754e-001, 5.460279e-001, 5.471792e-001,
+5.483239e-001, 5.494676e-001, 5.506034e-001, 5.517382e-001, 5.528683e-001, 5.539959e-001, 5.551166e-001, 5.562351e-001, 5.573483e-001, 5.584587e-001,
+5.595637e-001, 5.606665e-001, 5.617650e-001, 5.628611e-001, 5.639526e-001, 5.650422e-001, 5.661283e-001, 5.672121e-001, 5.682907e-001, 5.693675e-001,
+5.704392e-001, 5.715098e-001, 5.725753e-001, 5.736400e-001, 5.746986e-001, 5.757570e-001, 5.768082e-001, 5.778594e-001, 5.789057e-001, 5.799514e-001,
+5.809926e-001, 5.820324e-001, 5.830697e-001, 5.841054e-001, 5.851392e-001, 5.861704e-001, 5.871999e-001, 5.882244e-001, 5.892486e-001, 5.902659e-001,
+5.912833e-001, 5.922964e-001, 5.933085e-001, 5.943167e-001, 5.953218e-001, 5.963243e-001, 5.973206e-001, 5.983168e-001, 5.993061e-001, 6.002953e-001,
+6.012793e-001, 6.022612e-001, 6.032402e-001, 6.042151e-001, 6.051894e-001, 6.061557e-001, 6.071221e-001, 6.080847e-001, 6.090456e-001, 6.100040e-001,
+6.109568e-001, 6.119096e-001, 6.128568e-001, 6.138035e-001, 6.147469e-001, 6.156873e-001, 6.166273e-001, 6.175632e-001, 6.184991e-001, 6.194313e-001,
+6.203612e-001, 6.212899e-001, 6.222110e-001, 6.231321e-001, 6.240483e-001, 6.249616e-001, 6.258742e-001, 6.267807e-001, 6.276871e-001, 6.285903e-001,
+6.294908e-001, 6.303914e-001, 6.312856e-001, 6.321799e-001, 6.330709e-001, 6.339576e-001, 6.348443e-001, 6.357238e-001, 6.366016e-001, 6.374781e-001,
+6.383491e-001, 6.392201e-001, 6.400873e-001, 6.409514e-001, 6.418155e-001, 6.426754e-001, 6.435347e-001, 6.443930e-001, 6.452474e-001, 6.461017e-001,
+6.469531e-001, 6.478010e-001, 6.486490e-001, 6.494913e-001, 6.503316e-001, 6.511718e-001, 6.520057e-001, 6.528394e-001, 6.536721e-001, 6.545003e-001,
+6.553285e-001, 6.561551e-001, 6.569788e-001, 6.578026e-001, 6.586239e-001, 6.594430e-001, 6.602622e-001, 6.610757e-001, 6.618868e-001, 6.626979e-001,
+6.635042e-001, 6.643094e-001, 6.651147e-001, 6.659146e-001, 6.667141e-001, 6.675135e-001, 6.683061e-001, 6.690986e-001, 6.698907e-001, 6.706752e-001,
+6.714597e-001, 6.722436e-001, 6.730212e-001, 6.737989e-001, 6.745760e-001, 6.753480e-001, 6.761199e-001, 6.768916e-001, 6.776591e-001, 6.784266e-001,
+6.791940e-001, 6.799571e-001, 6.807202e-001, 6.814832e-001, 6.822392e-001, 6.829947e-001, 6.837502e-001, 6.845012e-001, 6.852513e-001, 6.860014e-001,
+6.867479e-001, 6.874929e-001, 6.882380e-001, 6.889796e-001, 6.897184e-001, 6.904573e-001, 6.911934e-001, 6.919253e-001, 6.926571e-001, 6.933879e-001,
+6.941142e-001, 6.948404e-001, 6.955666e-001, 6.962887e-001, 6.970106e-001, 6.977325e-001, 6.984499e-001, 6.991655e-001, 6.998810e-001, 7.005940e-001,
+7.013035e-001, 7.020129e-001, 7.027217e-001, 7.034254e-001, 7.041290e-001, 7.048327e-001, 7.055321e-001, 7.062303e-001, 7.069285e-001, 7.076250e-001,
+7.083189e-001, 7.090129e-001, 7.097068e-001, 7.103967e-001, 7.110865e-001, 7.117764e-001, 7.124635e-001, 7.131487e-001, 7.138339e-001, 7.145183e-001,
+7.151980e-001, 7.158777e-001, 7.165574e-001, 7.172330e-001, 7.179064e-001, 7.185799e-001, 7.192523e-001, 7.199188e-001, 7.205854e-001, 7.212520e-001,
+7.219150e-001, 7.225760e-001, 7.232370e-001, 7.238978e-001, 7.245547e-001, 7.252116e-001, 7.258685e-001, 7.265231e-001, 7.271751e-001, 7.278272e-001,
+7.284792e-001, 7.291265e-001, 7.297729e-001, 7.304193e-001, 7.310645e-001, 7.317046e-001, 7.323447e-001, 7.329848e-001, 7.336225e-001, 7.342576e-001,
+7.348928e-001, 7.355280e-001, 7.361595e-001, 7.367901e-001, 7.374207e-001, 7.380510e-001, 7.386765e-001, 7.393020e-001, 7.399275e-001, 7.405520e-001,
+7.411739e-001, 7.417957e-001, 7.424175e-001, 7.430375e-001, 7.436553e-001, 7.442730e-001, 7.448908e-001, 7.455062e-001, 7.461202e-001, 7.467341e-001,
+7.473481e-001, 7.479595e-001, 7.485699e-001, 7.491804e-001, 7.497909e-001, 7.503980e-001, 7.510045e-001, 7.516110e-001, 7.522175e-001, 7.528217e-001,
+7.534257e-001, 7.540297e-001, 7.546337e-001, 7.552339e-001, 7.558339e-001, 7.564339e-001, 7.570338e-001, 7.576288e-001, 7.582233e-001, 7.588178e-001,
+7.594123e-001, 7.600033e-001, 7.605938e-001, 7.611843e-001, 7.617747e-001, 7.623631e-001, 7.629509e-001, 7.635388e-001, 7.641267e-001, 7.647117e-001,
+7.652955e-001, 7.658794e-001, 7.664633e-001, 7.670440e-001, 7.676223e-001, 7.682007e-001, 7.687790e-001, 7.693558e-001, 7.699301e-001, 7.705044e-001,
+7.710787e-001, 7.716525e-001, 7.722241e-001, 7.727958e-001, 7.733674e-001, 7.739390e-001, 7.745085e-001, 7.750778e-001, 7.756472e-001, 7.762165e-001,
+7.767829e-001, 7.773480e-001, 7.779130e-001, 7.784780e-001, 7.790415e-001, 7.796026e-001, 7.801636e-001, 7.807246e-001, 7.812856e-001, 7.818430e-001,
+7.824005e-001, 7.829580e-001, 7.835154e-001, 7.840705e-001, 7.846242e-001, 7.851778e-001, 7.857315e-001, 7.862842e-001, 7.868337e-001, 7.873831e-001,
+7.879326e-001, 7.884820e-001, 7.890286e-001, 7.895743e-001, 7.901200e-001, 7.906656e-001, 7.912105e-001, 7.917528e-001, 7.922951e-001, 7.928374e-001,
+7.933797e-001, 7.939193e-001, 7.944579e-001, 7.949965e-001, 7.955352e-001, 7.960732e-001, 7.966079e-001, 7.971427e-001, 7.976774e-001, 7.982121e-001,
+7.987449e-001, 7.992761e-001, 7.998073e-001, 8.003385e-001, 8.008696e-001, 8.013979e-001, 8.019259e-001, 8.024539e-001, 8.029819e-001, 8.035091e-001,
+8.040337e-001, 8.045583e-001, 8.050829e-001, 8.056075e-001, 8.061311e-001, 8.066536e-001, 8.071761e-001, 8.076986e-001, 8.082212e-001, 8.087413e-001,
+8.092607e-001, 8.097800e-001, 8.102993e-001, 8.108187e-001, 8.113339e-001, 8.118489e-001, 8.123638e-001, 8.128788e-001, 8.133935e-001, 8.139054e-001,
+8.144173e-001, 8.149293e-001, 8.154412e-001, 8.159524e-001, 8.164612e-001, 8.169699e-001, 8.174786e-001, 8.179873e-001, 8.184951e-001, 8.190009e-001,
+8.195067e-001, 8.200125e-001, 8.205183e-001, 8.210233e-001, 8.215265e-001, 8.220297e-001, 8.225329e-001, 8.230361e-001, 8.235384e-001, 8.240389e-001,
+8.245393e-001, 8.250397e-001, 8.255402e-001, 8.260402e-001, 8.265391e-001, 8.270381e-001, 8.275370e-001, 8.280360e-001, 8.285344e-001, 8.290308e-001,
+8.295272e-001, 8.300235e-001, 8.305199e-001, 8.310160e-001, 8.315086e-001, 8.320013e-001, 8.324939e-001, 8.329866e-001, 8.334792e-001, 8.339697e-001,
+8.344600e-001, 8.349502e-001, 8.354404e-001, 8.359307e-001, 8.364191e-001, 8.369067e-001, 8.373944e-001, 8.378820e-001, 8.383696e-001, 8.388563e-001,
+8.393416e-001, 8.398269e-001, 8.403123e-001, 8.407976e-001, 8.412827e-001, 8.417660e-001, 8.422494e-001, 8.427327e-001, 8.432160e-001, 8.436993e-001,
+8.441810e-001, 8.446621e-001, 8.451433e-001, 8.456244e-001, 8.461055e-001, 8.465863e-001, 8.470665e-001, 8.475467e-001, 8.480269e-001, 8.485071e-001,
+8.489872e-001, 8.494655e-001, 8.499436e-001, 8.504217e-001, 8.508999e-001, 8.513780e-001, 8.518547e-001, 8.523297e-001, 8.528047e-001, 8.532798e-001,
+8.537548e-001, 8.542299e-001, 8.547031e-001, 8.551763e-001, 8.556495e-001, 8.561226e-001, 8.565958e-001, 8.570682e-001, 8.575393e-001, 8.580104e-001,
+8.584814e-001, 8.589525e-001, 8.594236e-001, 8.598934e-001, 8.603627e-001, 8.608321e-001, 8.613014e-001, 8.617707e-001, 8.622399e-001, 8.627078e-001,
+8.631756e-001, 8.636435e-001, 8.641113e-001, 8.645792e-001, 8.650464e-001, 8.655126e-001, 8.659787e-001, 8.664449e-001, 8.669111e-001, 8.673773e-001,
+8.678423e-001, 8.683065e-001, 8.687708e-001, 8.692350e-001, 8.696992e-001, 8.701635e-001, 8.706264e-001, 8.710890e-001, 8.715516e-001, 8.720142e-001,
+8.724769e-001, 8.729395e-001, 8.734009e-001, 8.738622e-001, 8.743236e-001, 8.747850e-001, 8.752463e-001, 8.757076e-001, 8.761674e-001, 8.766271e-001,
+8.770869e-001, 8.775466e-001, 8.780064e-001, 8.784659e-001, 8.789239e-001, 8.793818e-001, 8.798397e-001, 8.802977e-001, 8.807556e-001, 8.812134e-001,
+8.816698e-001, 8.821263e-001, 8.825827e-001, 8.830392e-001, 8.834956e-001, 8.839521e-001, 8.844081e-001, 8.848641e-001, 8.853201e-001, 8.857762e-001,
+8.862322e-001, 8.866882e-001, 8.871428e-001, 8.875973e-001, 8.880518e-001, 8.885064e-001, 8.889609e-001, 8.894154e-001, 8.898678e-001, 8.903196e-001,
+8.907714e-001, 8.912233e-001, 8.916751e-001, 8.921269e-001, 8.925778e-001, 8.930280e-001, 8.934783e-001, 8.939285e-001, 8.943787e-001, 8.948290e-001,
+8.952790e-001, 8.957288e-001, 8.961785e-001, 8.966283e-001, 8.970780e-001, 8.975277e-001, 8.979774e-001, 8.984263e-001, 8.988752e-001, 8.993240e-001,
+8.997729e-001, 9.002218e-001, 9.006706e-001, 9.011186e-001, 9.015660e-001, 9.020135e-001, 9.024610e-001, 9.029084e-001, 9.033559e-001, 9.038029e-001,
+9.042486e-001, 9.046943e-001, 9.051400e-001, 9.055857e-001, 9.060314e-001, 9.064772e-001, 9.069223e-001, 9.073673e-001, 9.078123e-001, 9.082573e-001,
+9.087022e-001, 9.091472e-001, 9.095919e-001, 9.100358e-001, 9.104797e-001, 9.109236e-001, 9.113675e-001, 9.118114e-001, 9.122553e-001, 9.126986e-001,
+9.131416e-001, 9.135846e-001, 9.140276e-001, 9.144707e-001, 9.149137e-001, 9.153566e-001, 9.157990e-001, 9.162414e-001, 9.166837e-001, 9.171261e-001,
+9.175685e-001, 9.180108e-001, 9.184523e-001, 9.188922e-001, 9.193322e-001, 9.197722e-001, 9.202122e-001, 9.206521e-001, 9.210921e-001, 9.215306e-001,
+9.219684e-001, 9.224062e-001, 9.228440e-001, 9.232818e-001, 9.237196e-001, 9.241574e-001, 9.245941e-001, 9.250306e-001, 9.254672e-001, 9.259037e-001,
+9.263402e-001, 9.267767e-001, 9.272132e-001, 9.276494e-001, 9.280856e-001, 9.285218e-001, 9.289580e-001, 9.293941e-001, 9.298303e-001, 9.302665e-001,
+9.307025e-001, 9.311386e-001, 9.315746e-001, 9.320107e-001, 9.324467e-001, 9.328828e-001, 9.333184e-001, 9.337515e-001, 9.341846e-001, 9.346178e-001,
+9.350509e-001, 9.354840e-001, 9.359172e-001, 9.363496e-001, 9.367772e-001, 9.372049e-001, 9.376325e-001, 9.380601e-001, 9.384877e-001, 9.389154e-001,
+9.393427e-001, 9.397647e-001, 9.401867e-001, 9.406087e-001, 9.410307e-001, 9.414526e-001, 9.418746e-001, 9.422966e-001, 9.427150e-001, 9.431330e-001,
+9.435510e-001, 9.439690e-001, 9.443870e-001, 9.448050e-001, 9.452230e-001, 9.456392e-001, 9.460545e-001, 9.464698e-001, 9.468852e-001, 9.473005e-001,
+9.477159e-001, 9.481312e-001, 9.485455e-001, 9.489584e-001, 9.493713e-001, 9.497842e-001, 9.501971e-001, 9.506099e-001, 9.510228e-001, 9.514354e-001,
+9.518461e-001, 9.522567e-001, 9.526674e-001, 9.530780e-001, 9.534886e-001, 9.538993e-001, 9.543099e-001, 9.547189e-001, 9.551272e-001, 9.555356e-001,
+9.559440e-001, 9.563524e-001, 9.567608e-001, 9.571692e-001, 9.575766e-001, 9.579817e-001, 9.583868e-001, 9.587919e-001, 9.591971e-001, 9.596022e-001,
+9.600073e-001, 9.604124e-001, 9.608145e-001, 9.612158e-001, 9.616172e-001, 9.620185e-001, 9.624199e-001, 9.628212e-001, 9.632225e-001, 9.636229e-001,
+9.640202e-001, 9.644175e-001, 9.648149e-001, 9.652122e-001, 9.656095e-001, 9.660068e-001, 9.664041e-001, 9.667985e-001, 9.671909e-001, 9.675834e-001,
+9.679758e-001, 9.683683e-001, 9.687608e-001, 9.691532e-001, 9.695457e-001, 9.699334e-001, 9.703207e-001, 9.707080e-001, 9.710952e-001, 9.714825e-001,
+9.718698e-001, 9.722571e-001, 9.726435e-001, 9.730254e-001, 9.734074e-001, 9.737893e-001, 9.741712e-001, 9.745532e-001, 9.749351e-001, 9.753171e-001,
+9.756969e-001, 9.760728e-001, 9.764487e-001, 9.768247e-001, 9.772006e-001, 9.775765e-001, 9.779525e-001, 9.783284e-001, 9.787008e-001, 9.790693e-001,
+9.794378e-001, 9.798063e-001, 9.801748e-001, 9.805433e-001, 9.809118e-001, 9.812803e-001, 9.816444e-001, 9.820045e-001, 9.823645e-001, 9.827246e-001,
+9.830847e-001, 9.834447e-001, 9.838048e-001, 9.841648e-001, 9.845203e-001, 9.848714e-001, 9.852225e-001, 9.855735e-001, 9.859246e-001, 9.862757e-001,
+9.866267e-001, 9.869778e-001, 9.873242e-001, 9.876643e-001, 9.880045e-001, 9.883446e-001, 9.886847e-001, 9.890248e-001, 9.893650e-001, 9.897051e-001,
+9.900412e-001, 9.903668e-001, 9.906923e-001, 9.910179e-001, 9.913434e-001, 9.916690e-001, 9.919946e-001, 9.923201e-001, 9.926448e-001, 9.929555e-001,
+9.932662e-001, 9.935769e-001, 9.938876e-001, 9.941983e-001, 9.945090e-001, 9.948197e-001, 9.951305e-001, 9.954293e-001, 9.957247e-001, 9.960201e-001,
+9.963155e-001, 9.966109e-001, 9.969063e-001, 9.972017e-001, 9.974971e-001, 9.977847e-001, 9.980616e-001, 9.983385e-001, 9.986154e-001, 9.988924e-001,
+9.991693e-001, 9.994462e-001, 9.997231e-001, 1.000000e+000)),
+("Agfa", "Agfacolor HDC 100 plus", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.181631e-003, 1.515003e-002, 2.240171e-002, 2.906855e-002, 3.529588e-002, 4.116694e-002, 4.672814e-002, 5.204555e-002, 5.714112e-002,
+6.203206e-002, 6.673564e-002, 7.129656e-002, 7.573854e-002, 8.007643e-002, 8.431472e-002, 8.845484e-002, 9.251325e-002, 9.648987e-002, 1.003945e-001,
+1.042160e-001, 1.079747e-001, 1.116577e-001, 1.152792e-001, 1.188424e-001, 1.223476e-001, 1.257934e-001, 1.291857e-001, 1.325112e-001, 1.357868e-001,
+1.390142e-001, 1.421942e-001, 1.453282e-001, 1.484291e-001, 1.514863e-001, 1.545145e-001, 1.575087e-001, 1.604655e-001, 1.633878e-001, 1.662712e-001,
+1.691236e-001, 1.719462e-001, 1.747328e-001, 1.774906e-001, 1.802142e-001, 1.829040e-001, 1.855682e-001, 1.881996e-001, 1.908040e-001, 1.933835e-001,
+1.959408e-001, 1.984723e-001, 2.009815e-001, 2.034648e-001, 2.059251e-001, 2.083660e-001, 2.107863e-001, 2.131928e-001, 2.155798e-001, 2.179521e-001,
+2.203089e-001, 2.226428e-001, 2.249637e-001, 2.272658e-001, 2.295507e-001, 2.318233e-001, 2.340773e-001, 2.363186e-001, 2.385478e-001, 2.407572e-001,
+2.429529e-001, 2.451368e-001, 2.473031e-001, 2.494541e-001, 2.515928e-001, 2.537161e-001, 2.558267e-001, 2.579267e-001, 2.600139e-001, 2.620905e-001,
+2.641523e-001, 2.661997e-001, 2.682359e-001, 2.702636e-001, 2.722779e-001, 2.742807e-001, 2.762736e-001, 2.782566e-001, 2.802279e-001, 2.821829e-001,
+2.841286e-001, 2.860676e-001, 2.879949e-001, 2.899109e-001, 2.918199e-001, 2.937203e-001, 2.956118e-001, 2.974927e-001, 2.993623e-001, 3.012244e-001,
+3.030806e-001, 3.049292e-001, 3.067674e-001, 3.085951e-001, 3.104136e-001, 3.122237e-001, 3.140270e-001, 3.158224e-001, 3.176110e-001, 3.193928e-001,
+3.211658e-001, 3.229303e-001, 3.246853e-001, 3.264289e-001, 3.281643e-001, 3.298931e-001, 3.316138e-001, 3.333250e-001, 3.350282e-001, 3.367245e-001,
+3.384152e-001, 3.401009e-001, 3.417800e-001, 3.434512e-001, 3.451135e-001, 3.467680e-001, 3.484159e-001, 3.500582e-001, 3.516959e-001, 3.533272e-001,
+3.549514e-001, 3.565693e-001, 3.581800e-001, 3.597827e-001, 3.613792e-001, 3.629701e-001, 3.645545e-001, 3.661319e-001, 3.677033e-001, 3.692692e-001,
+3.708306e-001, 3.723872e-001, 3.739395e-001, 3.754873e-001, 3.770300e-001, 3.785668e-001, 3.800952e-001, 3.816176e-001, 3.831364e-001, 3.846519e-001,
+3.861636e-001, 3.876700e-001, 3.891700e-001, 3.906654e-001, 3.921560e-001, 3.936414e-001, 3.951213e-001, 3.965955e-001, 3.980642e-001, 3.995279e-001,
+4.009876e-001, 4.024423e-001, 4.038925e-001, 4.053379e-001, 4.067766e-001, 4.082115e-001, 4.096431e-001, 4.110711e-001, 4.124928e-001, 4.139108e-001,
+4.153253e-001, 4.167350e-001, 4.181383e-001, 4.195369e-001, 4.209308e-001, 4.223197e-001, 4.237054e-001, 4.250878e-001, 4.264640e-001, 4.278368e-001,
+4.292070e-001, 4.305736e-001, 4.319369e-001, 4.332975e-001, 4.346529e-001, 4.360040e-001, 4.373517e-001, 4.386920e-001, 4.400289e-001, 4.413626e-001,
+4.426892e-001, 4.440131e-001, 4.453332e-001, 4.466494e-001, 4.479634e-001, 4.492729e-001, 4.505785e-001, 4.518813e-001, 4.531791e-001, 4.544754e-001,
+4.557689e-001, 4.570592e-001, 4.583479e-001, 4.596311e-001, 4.609122e-001, 4.621889e-001, 4.634611e-001, 4.647307e-001, 4.659950e-001, 4.672574e-001,
+4.685146e-001, 4.697686e-001, 4.710185e-001, 4.722629e-001, 4.735049e-001, 4.747409e-001, 4.759757e-001, 4.772061e-001, 4.784345e-001, 4.796592e-001,
+4.808803e-001, 4.820986e-001, 4.833118e-001, 4.845230e-001, 4.857310e-001, 4.869384e-001, 4.881415e-001, 4.893438e-001, 4.905418e-001, 4.917384e-001,
+4.929306e-001, 4.941214e-001, 4.953093e-001, 4.964951e-001, 4.976781e-001, 4.988584e-001, 5.000360e-001, 5.012102e-001, 5.023818e-001, 5.035496e-001,
+5.047146e-001, 5.058754e-001, 5.070334e-001, 5.081869e-001, 5.093373e-001, 5.104841e-001, 5.116283e-001, 5.127689e-001, 5.139064e-001, 5.150404e-001,
+5.161709e-001, 5.172980e-001, 5.184209e-001, 5.195423e-001, 5.206610e-001, 5.217785e-001, 5.228925e-001, 5.240059e-001, 5.251149e-001, 5.262239e-001,
+5.273274e-001, 5.284309e-001, 5.295295e-001, 5.306271e-001, 5.317205e-001, 5.328117e-001, 5.339007e-001, 5.349870e-001, 5.360724e-001, 5.371551e-001,
+5.382376e-001, 5.393162e-001, 5.403949e-001, 5.414699e-001, 5.425440e-001, 5.436155e-001, 5.446846e-001, 5.457529e-001, 5.468186e-001, 5.478843e-001,
+5.489464e-001, 5.500083e-001, 5.510676e-001, 5.521253e-001, 5.531818e-001, 5.542350e-001, 5.552883e-001, 5.563371e-001, 5.573856e-001, 5.584312e-001,
+5.594745e-001, 5.605170e-001, 5.615549e-001, 5.625928e-001, 5.636265e-001, 5.646586e-001, 5.656889e-001, 5.667149e-001, 5.677410e-001, 5.687616e-001,
+5.697812e-001, 5.707985e-001, 5.718114e-001, 5.728244e-001, 5.738328e-001, 5.748404e-001, 5.758462e-001, 5.768484e-001, 5.778505e-001, 5.788481e-001,
+5.798445e-001, 5.808395e-001, 5.818299e-001, 5.828203e-001, 5.838078e-001, 5.847937e-001, 5.857795e-001, 5.867608e-001, 5.877421e-001, 5.887214e-001,
+5.896979e-001, 5.906744e-001, 5.916472e-001, 5.926188e-001, 5.935899e-001, 5.945564e-001, 5.955229e-001, 5.964874e-001, 5.974487e-001, 5.984100e-001,
+5.993677e-001, 6.003237e-001, 6.012797e-001, 6.022305e-001, 6.031810e-001, 6.041305e-001, 6.050755e-001, 6.060204e-001, 6.069630e-001, 6.079023e-001,
+6.088415e-001, 6.097773e-001, 6.107107e-001, 6.116441e-001, 6.125729e-001, 6.135004e-001, 6.144278e-001, 6.153497e-001, 6.162711e-001, 6.171923e-001,
+6.181075e-001, 6.190227e-001, 6.199370e-001, 6.208459e-001, 6.217548e-001, 6.226627e-001, 6.235667e-001, 6.244707e-001, 6.253734e-001, 6.262724e-001,
+6.271714e-001, 6.280690e-001, 6.289630e-001, 6.298570e-001, 6.307495e-001, 6.316384e-001, 6.325273e-001, 6.334148e-001, 6.342985e-001, 6.351823e-001,
+6.360648e-001, 6.369433e-001, 6.378218e-001, 6.386997e-001, 6.395746e-001, 6.404494e-001, 6.413241e-001, 6.421938e-001, 6.430636e-001, 6.439334e-001,
+6.447986e-001, 6.456634e-001, 6.465282e-001, 6.473893e-001, 6.482492e-001, 6.491091e-001, 6.499661e-001, 6.508212e-001, 6.516763e-001, 6.525289e-001,
+6.533777e-001, 6.542265e-001, 6.550743e-001, 6.559170e-001, 6.567597e-001, 6.576023e-001, 6.584396e-001, 6.592763e-001, 6.601130e-001, 6.609461e-001,
+6.617771e-001, 6.626080e-001, 6.634372e-001, 6.642625e-001, 6.650879e-001, 6.659132e-001, 6.667333e-001, 6.675532e-001, 6.683731e-001, 6.691899e-001,
+6.700046e-001, 6.708193e-001, 6.716329e-001, 6.724425e-001, 6.732522e-001, 6.740618e-001, 6.748676e-001, 6.756724e-001, 6.764772e-001, 6.772803e-001,
+6.780804e-001, 6.788805e-001, 6.796805e-001, 6.804767e-001, 6.812722e-001, 6.820678e-001, 6.828618e-001, 6.836529e-001, 6.844441e-001, 6.852353e-001,
+6.860230e-001, 6.868100e-001, 6.875970e-001, 6.883826e-001, 6.891641e-001, 6.899457e-001, 6.907272e-001, 6.915054e-001, 6.922817e-001, 6.930580e-001,
+6.938342e-001, 6.946055e-001, 6.953768e-001, 6.961481e-001, 6.969177e-001, 6.976842e-001, 6.984508e-001, 6.992173e-001, 6.999807e-001, 7.007427e-001,
+7.015047e-001, 7.022667e-001, 7.030245e-001, 7.037821e-001, 7.045397e-001, 7.052962e-001, 7.060483e-001, 7.068005e-001, 7.075526e-001, 7.083025e-001,
+7.090494e-001, 7.097964e-001, 7.105433e-001, 7.112872e-001, 7.120292e-001, 7.127713e-001, 7.135133e-001, 7.142517e-001, 7.149892e-001, 7.157266e-001,
+7.164640e-001, 7.171976e-001, 7.179308e-001, 7.186639e-001, 7.193971e-001, 7.201262e-001, 7.208554e-001, 7.215845e-001, 7.223134e-001, 7.230388e-001,
+7.237643e-001, 7.244897e-001, 7.252147e-001, 7.259354e-001, 7.266561e-001, 7.273768e-001, 7.280971e-001, 7.288134e-001, 7.295297e-001, 7.302460e-001,
+7.309621e-001, 7.316743e-001, 7.323865e-001, 7.330987e-001, 7.338109e-001, 7.345195e-001, 7.352281e-001, 7.359366e-001, 7.366451e-001, 7.373495e-001,
+7.380533e-001, 7.387571e-001, 7.394609e-001, 7.401615e-001, 7.408610e-001, 7.415605e-001, 7.422600e-001, 7.429573e-001, 7.436529e-001, 7.443485e-001,
+7.450441e-001, 7.457385e-001, 7.464306e-001, 7.471227e-001, 7.478149e-001, 7.485067e-001, 7.491957e-001, 7.498848e-001, 7.505739e-001, 7.512630e-001,
+7.519488e-001, 7.526340e-001, 7.533192e-001, 7.540044e-001, 7.546878e-001, 7.553695e-001, 7.560512e-001, 7.567330e-001, 7.574139e-001, 7.580913e-001,
+7.587687e-001, 7.594461e-001, 7.601235e-001, 7.607979e-001, 7.614713e-001, 7.621448e-001, 7.628183e-001, 7.634900e-001, 7.641587e-001, 7.648273e-001,
+7.654959e-001, 7.661646e-001, 7.668293e-001, 7.674936e-001, 7.681579e-001, 7.688221e-001, 7.694843e-001, 7.701434e-001, 7.708024e-001, 7.714615e-001,
+7.721206e-001, 7.727754e-001, 7.734297e-001, 7.740840e-001, 7.747382e-001, 7.753911e-001, 7.760410e-001, 7.766909e-001, 7.773407e-001, 7.779906e-001,
+7.786368e-001, 7.792814e-001, 7.799261e-001, 7.805707e-001, 7.812151e-001, 7.818549e-001, 7.824948e-001, 7.831346e-001, 7.837745e-001, 7.844127e-001,
+7.850482e-001, 7.856837e-001, 7.863192e-001, 7.869547e-001, 7.875876e-001, 7.882192e-001, 7.888507e-001, 7.894823e-001, 7.901139e-001, 7.907413e-001,
+7.913681e-001, 7.919950e-001, 7.926219e-001, 7.932484e-001, 7.938710e-001, 7.944937e-001, 7.951163e-001, 7.957390e-001, 7.963608e-001, 7.969797e-001,
+7.975987e-001, 7.982177e-001, 7.988366e-001, 7.994541e-001, 8.000687e-001, 8.006833e-001, 8.012979e-001, 8.019125e-001, 8.025255e-001, 8.031363e-001,
+8.037471e-001, 8.043579e-001, 8.049687e-001, 8.055780e-001, 8.061855e-001, 8.067930e-001, 8.074006e-001, 8.080081e-001, 8.086138e-001, 8.092174e-001,
+8.098209e-001, 8.104245e-001, 8.110281e-001, 8.116298e-001, 8.122287e-001, 8.128276e-001, 8.134266e-001, 8.140255e-001, 8.146228e-001, 8.152165e-001,
+8.158102e-001, 8.164039e-001, 8.169976e-001, 8.175905e-001, 8.181796e-001, 8.187687e-001, 8.193578e-001, 8.199469e-001, 8.205359e-001, 8.211210e-001,
+8.217060e-001, 8.222911e-001, 8.228762e-001, 8.234612e-001, 8.240436e-001, 8.246252e-001, 8.252068e-001, 8.257885e-001, 8.263701e-001, 8.269496e-001,
+8.275271e-001, 8.281046e-001, 8.286822e-001, 8.292597e-001, 8.298364e-001, 8.304104e-001, 8.309844e-001, 8.315584e-001, 8.321324e-001, 8.327064e-001,
+8.332767e-001, 8.338465e-001, 8.344164e-001, 8.349862e-001, 8.355560e-001, 8.361235e-001, 8.366886e-001, 8.372538e-001, 8.378189e-001, 8.383840e-001,
+8.389489e-001, 8.395100e-001, 8.400711e-001, 8.406322e-001, 8.411933e-001, 8.417543e-001, 8.423134e-001, 8.428711e-001, 8.434288e-001, 8.439865e-001,
+8.445441e-001, 8.451016e-001, 8.456565e-001, 8.462114e-001, 8.467663e-001, 8.473211e-001, 8.478760e-001, 8.484287e-001, 8.489792e-001, 8.495296e-001,
+8.500800e-001, 8.506304e-001, 8.511808e-001, 8.517271e-001, 8.522726e-001, 8.528182e-001, 8.533637e-001, 8.539093e-001, 8.544540e-001, 8.549953e-001,
+8.555367e-001, 8.560781e-001, 8.566194e-001, 8.571608e-001, 8.577004e-001, 8.582383e-001, 8.587761e-001, 8.593140e-001, 8.598518e-001, 8.603896e-001,
+8.609246e-001, 8.614584e-001, 8.619922e-001, 8.625261e-001, 8.630599e-001, 8.635937e-001, 8.641244e-001, 8.646548e-001, 8.651853e-001, 8.657157e-001,
+8.662461e-001, 8.667764e-001, 8.673040e-001, 8.678316e-001, 8.683593e-001, 8.688869e-001, 8.694145e-001, 8.699416e-001, 8.704660e-001, 8.709904e-001,
+8.715147e-001, 8.720391e-001, 8.725635e-001, 8.730871e-001, 8.736078e-001, 8.741285e-001, 8.746492e-001, 8.751698e-001, 8.756905e-001, 8.762104e-001,
+8.767271e-001, 8.772437e-001, 8.777604e-001, 8.782770e-001, 8.787937e-001, 8.793098e-001, 8.798231e-001, 8.803363e-001, 8.808496e-001, 8.813629e-001,
+8.818761e-001, 8.823893e-001, 8.828998e-001, 8.834104e-001, 8.839209e-001, 8.844314e-001, 8.849419e-001, 8.854525e-001, 8.859602e-001, 8.864676e-001,
+8.869750e-001, 8.874824e-001, 8.879898e-001, 8.884971e-001, 8.890014e-001, 8.895041e-001, 8.900068e-001, 8.905096e-001, 8.910123e-001, 8.915150e-001,
+8.920161e-001, 8.925150e-001, 8.930138e-001, 8.935126e-001, 8.940115e-001, 8.945103e-001, 8.950087e-001, 8.955043e-001, 8.959999e-001, 8.964955e-001,
+8.969911e-001, 8.974866e-001, 8.979822e-001, 8.984759e-001, 8.989690e-001, 8.994620e-001, 8.999551e-001, 9.004481e-001, 9.009412e-001, 9.014333e-001,
+9.019234e-001, 9.024136e-001, 9.029037e-001, 9.033939e-001, 9.038840e-001, 9.043742e-001, 9.048606e-001, 9.053465e-001, 9.058324e-001, 9.063184e-001,
+9.068043e-001, 9.072902e-001, 9.077749e-001, 9.082573e-001, 9.087397e-001, 9.092222e-001, 9.097046e-001, 9.101871e-001, 9.106695e-001, 9.111498e-001,
+9.116294e-001, 9.121091e-001, 9.125887e-001, 9.130684e-001, 9.135480e-001, 9.140272e-001, 9.145039e-001, 9.149805e-001, 9.154572e-001, 9.159338e-001,
+9.164105e-001, 9.168871e-001, 9.173617e-001, 9.178340e-001, 9.183063e-001, 9.187786e-001, 9.192509e-001, 9.197231e-001, 9.201954e-001, 9.206651e-001,
+9.211338e-001, 9.216025e-001, 9.220712e-001, 9.225398e-001, 9.230085e-001, 9.234772e-001, 9.239433e-001, 9.244091e-001, 9.248750e-001, 9.253408e-001,
+9.258067e-001, 9.262725e-001, 9.267381e-001, 9.272008e-001, 9.276636e-001, 9.281263e-001, 9.285890e-001, 9.290517e-001, 9.295145e-001, 9.299766e-001,
+9.304360e-001, 9.308954e-001, 9.313548e-001, 9.318142e-001, 9.322736e-001, 9.327329e-001, 9.331911e-001, 9.336445e-001, 9.340979e-001, 9.345512e-001,
+9.350046e-001, 9.354580e-001, 9.359113e-001, 9.363634e-001, 9.368094e-001, 9.372554e-001, 9.377014e-001, 9.381475e-001, 9.385935e-001, 9.390395e-001,
+9.394849e-001, 9.399246e-001, 9.403643e-001, 9.408039e-001, 9.412436e-001, 9.416833e-001, 9.421230e-001, 9.425627e-001, 9.429976e-001, 9.434322e-001,
+9.438669e-001, 9.443015e-001, 9.447362e-001, 9.451708e-001, 9.456055e-001, 9.460370e-001, 9.464674e-001, 9.468979e-001, 9.473284e-001, 9.477588e-001,
+9.481893e-001, 9.486197e-001, 9.490481e-001, 9.494743e-001, 9.499005e-001, 9.503267e-001, 9.507529e-001, 9.511791e-001, 9.516053e-001, 9.520308e-001,
+9.524527e-001, 9.528746e-001, 9.532965e-001, 9.537184e-001, 9.541404e-001, 9.545623e-001, 9.549842e-001, 9.554026e-001, 9.558201e-001, 9.562376e-001,
+9.566550e-001, 9.570725e-001, 9.574900e-001, 9.579075e-001, 9.583234e-001, 9.587361e-001, 9.591489e-001, 9.595617e-001, 9.599744e-001, 9.603872e-001,
+9.608000e-001, 9.612128e-001, 9.616207e-001, 9.620277e-001, 9.624347e-001, 9.628417e-001, 9.632487e-001, 9.636557e-001, 9.640627e-001, 9.644679e-001,
+9.648685e-001, 9.652690e-001, 9.656695e-001, 9.660701e-001, 9.664706e-001, 9.668712e-001, 9.672717e-001, 9.676679e-001, 9.680617e-001, 9.684556e-001,
+9.688494e-001, 9.692432e-001, 9.696371e-001, 9.700309e-001, 9.704248e-001, 9.708117e-001, 9.711983e-001, 9.715849e-001, 9.719715e-001, 9.723581e-001,
+9.727448e-001, 9.731314e-001, 9.735164e-001, 9.738948e-001, 9.742732e-001, 9.746516e-001, 9.750299e-001, 9.754083e-001, 9.757867e-001, 9.761651e-001,
+9.765401e-001, 9.769094e-001, 9.772787e-001, 9.776480e-001, 9.780174e-001, 9.783867e-001, 9.787560e-001, 9.791253e-001, 9.794902e-001, 9.798504e-001,
+9.802107e-001, 9.805709e-001, 9.809311e-001, 9.812914e-001, 9.816516e-001, 9.820119e-001, 9.823671e-001, 9.827179e-001, 9.830688e-001, 9.834197e-001,
+9.837705e-001, 9.841214e-001, 9.844723e-001, 9.848231e-001, 9.851688e-001, 9.855098e-001, 9.858507e-001, 9.861916e-001, 9.865326e-001, 9.868735e-001,
+9.872145e-001, 9.875554e-001, 9.878914e-001, 9.882211e-001, 9.885507e-001, 9.888804e-001, 9.892101e-001, 9.895397e-001, 9.898694e-001, 9.901990e-001,
+9.905248e-001, 9.908408e-001, 9.911568e-001, 9.914728e-001, 9.917888e-001, 9.921048e-001, 9.924208e-001, 9.927368e-001, 9.930516e-001, 9.933491e-001,
+9.936467e-001, 9.939443e-001, 9.942419e-001, 9.945395e-001, 9.948371e-001, 9.951347e-001, 9.954322e-001, 9.957144e-001, 9.959922e-001, 9.962701e-001,
+9.965479e-001, 9.968257e-001, 9.971036e-001, 9.973814e-001, 9.976593e-001, 9.979290e-001, 9.981879e-001, 9.984468e-001, 9.987056e-001, 9.989645e-001,
+9.992234e-001, 9.994823e-001, 9.997411e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.240911e-003, 1.684592e-002, 2.475170e-002, 3.198803e-002, 3.867514e-002, 4.489770e-002, 5.075216e-002, 5.627803e-002, 6.151475e-002,
+6.650914e-002, 7.130896e-002, 7.598034e-002, 8.054229e-002, 8.502137e-002, 8.942459e-002, 9.375598e-002, 9.802217e-002, 1.022290e-001, 1.063620e-001,
+1.104390e-001, 1.144634e-001, 1.184230e-001, 1.223274e-001, 1.261755e-001, 1.299650e-001, 1.337056e-001, 1.373963e-001, 1.410335e-001, 1.446186e-001,
+1.481585e-001, 1.516451e-001, 1.550759e-001, 1.584609e-001, 1.617928e-001, 1.650731e-001, 1.683045e-001, 1.714911e-001, 1.746436e-001, 1.777535e-001,
+1.808203e-001, 1.838432e-001, 1.868294e-001, 1.897847e-001, 1.927071e-001, 1.955924e-001, 1.984508e-001, 2.012735e-001, 2.040609e-001, 2.068152e-001,
+2.095429e-001, 2.122360e-001, 2.149037e-001, 2.175482e-001, 2.201592e-001, 2.227439e-001, 2.253007e-001, 2.278293e-001, 2.303357e-001, 2.328161e-001,
+2.352698e-001, 2.377053e-001, 2.401221e-001, 2.425126e-001, 2.448851e-001, 2.472408e-001, 2.495730e-001, 2.518831e-001, 2.541756e-001, 2.564487e-001,
+2.587058e-001, 2.609439e-001, 2.631632e-001, 2.653681e-001, 2.675604e-001, 2.697343e-001, 2.718897e-001, 2.740308e-001, 2.761551e-001, 2.782636e-001,
+2.803571e-001, 2.824396e-001, 2.845089e-001, 2.865653e-001, 2.886032e-001, 2.906293e-001, 2.926450e-001, 2.946475e-001, 2.966375e-001, 2.986126e-001,
+3.005768e-001, 3.025309e-001, 3.044740e-001, 3.064060e-001, 3.083246e-001, 3.102299e-001, 3.121253e-001, 3.140129e-001, 3.158907e-001, 3.177559e-001,
+3.196083e-001, 3.214525e-001, 3.232868e-001, 3.251120e-001, 3.269274e-001, 3.287312e-001, 3.305267e-001, 3.323149e-001, 3.340945e-001, 3.358643e-001,
+3.376251e-001, 3.393789e-001, 3.411253e-001, 3.428628e-001, 3.445931e-001, 3.463182e-001, 3.480369e-001, 3.497483e-001, 3.514512e-001, 3.531454e-001,
+3.548327e-001, 3.565143e-001, 3.581890e-001, 3.598567e-001, 3.615189e-001, 3.631770e-001, 3.648300e-001, 3.664769e-001, 3.681172e-001, 3.697522e-001,
+3.713811e-001, 3.730033e-001, 3.746203e-001, 3.762315e-001, 3.778362e-001, 3.794350e-001, 3.810292e-001, 3.826195e-001, 3.842052e-001, 3.857854e-001,
+3.873588e-001, 3.889274e-001, 3.904911e-001, 3.920491e-001, 3.936017e-001, 3.951498e-001, 3.966916e-001, 3.982271e-001, 3.997577e-001, 4.012834e-001,
+4.028038e-001, 4.043180e-001, 4.058267e-001, 4.073303e-001, 4.088296e-001, 4.103250e-001, 4.118150e-001, 4.132993e-001, 4.147784e-001, 4.162525e-001,
+4.177218e-001, 4.191872e-001, 4.206492e-001, 4.221077e-001, 4.235614e-001, 4.250094e-001, 4.264527e-001, 4.278913e-001, 4.293223e-001, 4.307503e-001,
+4.321753e-001, 4.335968e-001, 4.350129e-001, 4.364252e-001, 4.378338e-001, 4.392374e-001, 4.406376e-001, 4.420346e-001, 4.434260e-001, 4.448128e-001,
+4.461959e-001, 4.475725e-001, 4.489450e-001, 4.503144e-001, 4.516781e-001, 4.530383e-001, 4.543960e-001, 4.557483e-001, 4.570982e-001, 4.584461e-001,
+4.597888e-001, 4.611299e-001, 4.624690e-001, 4.638045e-001, 4.651381e-001, 4.664680e-001, 4.677945e-001, 4.691189e-001, 4.704372e-001, 4.717531e-001,
+4.730647e-001, 4.743712e-001, 4.756752e-001, 4.769738e-001, 4.782701e-001, 4.795624e-001, 4.808516e-001, 4.821393e-001, 4.834219e-001, 4.847030e-001,
+4.859795e-001, 4.872528e-001, 4.885228e-001, 4.897892e-001, 4.910542e-001, 4.923141e-001, 4.935730e-001, 4.948288e-001, 4.960829e-001, 4.973343e-001,
+4.985828e-001, 4.998292e-001, 5.010714e-001, 5.023122e-001, 5.035474e-001, 5.047818e-001, 5.060117e-001, 5.072408e-001, 5.084657e-001, 5.096889e-001,
+5.109082e-001, 5.121251e-001, 5.133383e-001, 5.145484e-001, 5.157550e-001, 5.169578e-001, 5.181573e-001, 5.193537e-001, 5.205478e-001, 5.217383e-001,
+5.229266e-001, 5.241109e-001, 5.252930e-001, 5.264709e-001, 5.276464e-001, 5.288176e-001, 5.299862e-001, 5.311506e-001, 5.323119e-001, 5.334691e-001,
+5.346228e-001, 5.357729e-001, 5.369186e-001, 5.380612e-001, 5.391986e-001, 5.403343e-001, 5.414650e-001, 5.425949e-001, 5.437206e-001, 5.448462e-001,
+5.459664e-001, 5.470866e-001, 5.482018e-001, 5.493162e-001, 5.504278e-001, 5.515381e-001, 5.526462e-001, 5.537520e-001, 5.548565e-001, 5.559578e-001,
+5.570588e-001, 5.581569e-001, 5.592550e-001, 5.603503e-001, 5.614450e-001, 5.625376e-001, 5.636285e-001, 5.647183e-001, 5.658050e-001, 5.668918e-001,
+5.679742e-001, 5.690564e-001, 5.701355e-001, 5.712130e-001, 5.722888e-001, 5.733610e-001, 5.744333e-001, 5.755002e-001, 5.765670e-001, 5.776314e-001,
+5.786941e-001, 5.797561e-001, 5.808146e-001, 5.818731e-001, 5.829283e-001, 5.839823e-001, 5.850348e-001, 5.860841e-001, 5.871334e-001, 5.881785e-001,
+5.892228e-001, 5.902652e-001, 5.913044e-001, 5.923436e-001, 5.933796e-001, 5.944152e-001, 5.954494e-001, 5.964813e-001, 5.975131e-001, 5.985417e-001,
+5.995696e-001, 6.005965e-001, 6.016203e-001, 6.026441e-001, 6.036651e-001, 6.046846e-001, 6.057039e-001, 6.067190e-001, 6.077341e-001, 6.087473e-001,
+6.097578e-001, 6.107683e-001, 6.117751e-001, 6.127809e-001, 6.137860e-001, 6.147853e-001, 6.157847e-001, 6.167813e-001, 6.177741e-001, 6.187668e-001,
+6.197549e-001, 6.207411e-001, 6.217273e-001, 6.227069e-001, 6.236863e-001, 6.246639e-001, 6.256347e-001, 6.266055e-001, 6.275726e-001, 6.285349e-001,
+6.294971e-001, 6.304540e-001, 6.314078e-001, 6.323615e-001, 6.333086e-001, 6.342539e-001, 6.351992e-001, 6.361368e-001, 6.370738e-001, 6.380103e-001,
+6.389391e-001, 6.398678e-001, 6.407953e-001, 6.417160e-001, 6.426366e-001, 6.435554e-001, 6.444680e-001, 6.453806e-001, 6.462909e-001, 6.471955e-001,
+6.481001e-001, 6.490028e-001, 6.499010e-001, 6.507992e-001, 6.516955e-001, 6.525874e-001, 6.534793e-001, 6.543694e-001, 6.552551e-001, 6.561407e-001,
+6.570249e-001, 6.579044e-001, 6.587839e-001, 6.596624e-001, 6.605358e-001, 6.614092e-001, 6.622822e-001, 6.631496e-001, 6.640170e-001, 6.648844e-001,
+6.657464e-001, 6.666081e-001, 6.674698e-001, 6.683271e-001, 6.691833e-001, 6.700395e-001, 6.708926e-001, 6.717436e-001, 6.725946e-001, 6.734435e-001,
+6.742895e-001, 6.751355e-001, 6.759807e-001, 6.768220e-001, 6.776633e-001, 6.785046e-001, 6.793417e-001, 6.801785e-001, 6.810153e-001, 6.818485e-001,
+6.826795e-001, 6.835106e-001, 6.843398e-001, 6.851654e-001, 6.859910e-001, 6.868166e-001, 6.876372e-001, 6.884577e-001, 6.892783e-001, 6.900958e-001,
+6.909115e-001, 6.917272e-001, 6.925419e-001, 6.933532e-001, 6.941645e-001, 6.949758e-001, 6.957838e-001, 6.965909e-001, 6.973981e-001, 6.982039e-001,
+6.990072e-001, 6.998106e-001, 7.006139e-001, 7.014130e-001, 7.022114e-001, 7.030098e-001, 7.038065e-001, 7.046003e-001, 7.053942e-001, 7.061881e-001,
+7.069784e-001, 7.077681e-001, 7.085578e-001, 7.093464e-001, 7.101323e-001, 7.109182e-001, 7.117041e-001, 7.124867e-001, 7.132676e-001, 7.140485e-001,
+7.148293e-001, 7.156058e-001, 7.163822e-001, 7.171587e-001, 7.179336e-001, 7.187061e-001, 7.194785e-001, 7.202510e-001, 7.210200e-001, 7.217876e-001,
+7.225551e-001, 7.233227e-001, 7.240859e-001, 7.248490e-001, 7.256121e-001, 7.263739e-001, 7.271317e-001, 7.278894e-001, 7.286471e-001, 7.294025e-001,
+7.301553e-001, 7.309081e-001, 7.316608e-001, 7.324107e-001, 7.331590e-001, 7.339072e-001, 7.346555e-001, 7.354005e-001, 7.361447e-001, 7.368889e-001,
+7.376331e-001, 7.383713e-001, 7.391089e-001, 7.398466e-001, 7.405841e-001, 7.413143e-001, 7.420445e-001, 7.427748e-001, 7.435045e-001, 7.442278e-001,
+7.449511e-001, 7.456745e-001, 7.463971e-001, 7.471140e-001, 7.478310e-001, 7.485479e-001, 7.492642e-001, 7.499753e-001, 7.506863e-001, 7.513973e-001,
+7.521080e-001, 7.528136e-001, 7.535193e-001, 7.542249e-001, 7.549306e-001, 7.556313e-001, 7.563320e-001, 7.570327e-001, 7.577335e-001, 7.584290e-001,
+7.591239e-001, 7.598189e-001, 7.605138e-001, 7.612038e-001, 7.618922e-001, 7.625806e-001, 7.632690e-001, 7.639540e-001, 7.646365e-001, 7.653190e-001,
+7.660015e-001, 7.666820e-001, 7.673592e-001, 7.680364e-001, 7.687136e-001, 7.693903e-001, 7.700628e-001, 7.707354e-001, 7.714080e-001, 7.720805e-001,
+7.727485e-001, 7.734156e-001, 7.740827e-001, 7.747499e-001, 7.754138e-001, 7.760749e-001, 7.767361e-001, 7.773972e-001, 7.780574e-001, 7.787132e-001,
+7.793691e-001, 7.800250e-001, 7.806809e-001, 7.813321e-001, 7.819822e-001, 7.826322e-001, 7.832823e-001, 7.839304e-001, 7.845754e-001, 7.852203e-001,
+7.858652e-001, 7.865102e-001, 7.871510e-001, 7.877915e-001, 7.884320e-001, 7.890725e-001, 7.897108e-001, 7.903463e-001, 7.909818e-001, 7.916173e-001,
+7.922527e-001, 7.928832e-001, 7.935130e-001, 7.941429e-001, 7.947727e-001, 7.954010e-001, 7.960260e-001, 7.966510e-001, 7.972760e-001, 7.979010e-001,
+7.985222e-001, 7.991417e-001, 7.997613e-001, 8.003809e-001, 8.010002e-001, 8.016150e-001, 8.022299e-001, 8.028448e-001, 8.034597e-001, 8.040725e-001,
+8.046822e-001, 8.052919e-001, 8.059015e-001, 8.065112e-001, 8.071171e-001, 8.077210e-001, 8.083250e-001, 8.089289e-001, 8.095329e-001, 8.101324e-001,
+8.107314e-001, 8.113304e-001, 8.119294e-001, 8.125281e-001, 8.131231e-001, 8.137180e-001, 8.143130e-001, 8.149080e-001, 8.155021e-001, 8.160938e-001,
+8.166856e-001, 8.172773e-001, 8.178690e-001, 8.184589e-001, 8.190458e-001, 8.196326e-001, 8.202195e-001, 8.208063e-001, 8.213908e-001, 8.219724e-001,
+8.225539e-001, 8.231355e-001, 8.237170e-001, 8.242964e-001, 8.248735e-001, 8.254506e-001, 8.260277e-001, 8.266048e-001, 8.271802e-001, 8.277538e-001,
+8.283274e-001, 8.289009e-001, 8.294745e-001, 8.300458e-001, 8.306141e-001, 8.311824e-001, 8.317507e-001, 8.323189e-001, 8.328854e-001, 8.334481e-001,
+8.340109e-001, 8.345736e-001, 8.351363e-001, 8.356981e-001, 8.362563e-001, 8.368144e-001, 8.373725e-001, 8.379307e-001, 8.384887e-001, 8.390419e-001,
+8.395951e-001, 8.401484e-001, 8.407016e-001, 8.412548e-001, 8.418038e-001, 8.423519e-001, 8.429000e-001, 8.434481e-001, 8.439962e-001, 8.445412e-001,
+8.450838e-001, 8.456264e-001, 8.461690e-001, 8.467116e-001, 8.472530e-001, 8.477911e-001, 8.483291e-001, 8.488672e-001, 8.494052e-001, 8.499433e-001,
+8.504771e-001, 8.510105e-001, 8.515439e-001, 8.520773e-001, 8.526107e-001, 8.531416e-001, 8.536701e-001, 8.541986e-001, 8.547271e-001, 8.552556e-001,
+8.557837e-001, 8.563071e-001, 8.568305e-001, 8.573539e-001, 8.578773e-001, 8.584007e-001, 8.589210e-001, 8.594392e-001, 8.599574e-001, 8.604756e-001,
+8.609937e-001, 8.615116e-001, 8.620255e-001, 8.625394e-001, 8.630533e-001, 8.635672e-001, 8.640811e-001, 8.645929e-001, 8.651023e-001, 8.656118e-001,
+8.661212e-001, 8.666307e-001, 8.671402e-001, 8.676456e-001, 8.681504e-001, 8.686553e-001, 8.691601e-001, 8.696649e-001, 8.701690e-001, 8.706703e-001,
+8.711715e-001, 8.716727e-001, 8.721739e-001, 8.726752e-001, 8.731746e-001, 8.736722e-001, 8.741699e-001, 8.746675e-001, 8.751651e-001, 8.756627e-001,
+8.761567e-001, 8.766494e-001, 8.771420e-001, 8.776347e-001, 8.781274e-001, 8.786200e-001, 8.791081e-001, 8.795957e-001, 8.800834e-001, 8.805711e-001,
+8.810587e-001, 8.815461e-001, 8.820288e-001, 8.825114e-001, 8.829941e-001, 8.834768e-001, 8.839595e-001, 8.844414e-001, 8.849190e-001, 8.853966e-001,
+8.858741e-001, 8.863517e-001, 8.868293e-001, 8.873061e-001, 8.877797e-001, 8.882533e-001, 8.887269e-001, 8.892006e-001, 8.896742e-001, 8.901468e-001,
+8.906153e-001, 8.910838e-001, 8.915524e-001, 8.920209e-001, 8.924894e-001, 8.929570e-001, 8.934193e-001, 8.938816e-001, 8.943439e-001, 8.948062e-001,
+8.952685e-001, 8.957306e-001, 8.961878e-001, 8.966450e-001, 8.971022e-001, 8.975594e-001, 8.980166e-001, 8.984738e-001, 8.989266e-001, 8.993788e-001,
+8.998310e-001, 9.002832e-001, 9.007354e-001, 9.011876e-001, 9.016364e-001, 9.020837e-001, 9.025309e-001, 9.029781e-001, 9.034254e-001, 9.038726e-001,
+9.043182e-001, 9.047616e-001, 9.052050e-001, 9.056484e-001, 9.060918e-001, 9.065353e-001, 9.069781e-001, 9.074169e-001, 9.078557e-001, 9.082945e-001,
+9.087332e-001, 9.091720e-001, 9.096108e-001, 9.100461e-001, 9.104802e-001, 9.109144e-001, 9.113485e-001, 9.117827e-001, 9.122168e-001, 9.126497e-001,
+9.130803e-001, 9.135109e-001, 9.139415e-001, 9.143721e-001, 9.148027e-001, 9.152333e-001, 9.156600e-001, 9.160861e-001, 9.165123e-001, 9.169384e-001,
+9.173645e-001, 9.177907e-001, 9.182156e-001, 9.186385e-001, 9.190613e-001, 9.194841e-001, 9.199069e-001, 9.203298e-001, 9.207526e-001, 9.211730e-001,
+9.215927e-001, 9.220124e-001, 9.224321e-001, 9.228518e-001, 9.232715e-001, 9.236904e-001, 9.241051e-001, 9.245197e-001, 9.249343e-001, 9.253489e-001,
+9.257636e-001, 9.261782e-001, 9.265910e-001, 9.270016e-001, 9.274123e-001, 9.278230e-001, 9.282337e-001, 9.286444e-001, 9.290550e-001, 9.294637e-001,
+9.298717e-001, 9.302796e-001, 9.306876e-001, 9.310955e-001, 9.315034e-001, 9.319114e-001, 9.323160e-001, 9.327204e-001, 9.331247e-001, 9.335291e-001,
+9.339334e-001, 9.343378e-001, 9.347419e-001, 9.351429e-001, 9.355439e-001, 9.359450e-001, 9.363460e-001, 9.367470e-001, 9.371481e-001, 9.375486e-001,
+9.379464e-001, 9.383443e-001, 9.387422e-001, 9.391401e-001, 9.395379e-001, 9.399358e-001, 9.403328e-001, 9.407267e-001, 9.411206e-001, 9.415145e-001,
+9.419083e-001, 9.423022e-001, 9.426961e-001, 9.430891e-001, 9.434780e-001, 9.438670e-001, 9.442559e-001, 9.446449e-001, 9.450338e-001, 9.454228e-001,
+9.458110e-001, 9.461930e-001, 9.465749e-001, 9.469569e-001, 9.473388e-001, 9.477208e-001, 9.481027e-001, 9.484847e-001, 9.488611e-001, 9.492372e-001,
+9.496133e-001, 9.499894e-001, 9.503655e-001, 9.507416e-001, 9.511177e-001, 9.514915e-001, 9.518645e-001, 9.522374e-001, 9.526104e-001, 9.529834e-001,
+9.533564e-001, 9.537294e-001, 9.541009e-001, 9.544709e-001, 9.548410e-001, 9.552110e-001, 9.555810e-001, 9.559511e-001, 9.563211e-001, 9.566905e-001,
+9.570569e-001, 9.574234e-001, 9.577898e-001, 9.581563e-001, 9.585227e-001, 9.588891e-001, 9.592556e-001, 9.596187e-001, 9.599809e-001, 9.603432e-001,
+9.607055e-001, 9.610677e-001, 9.614300e-001, 9.617922e-001, 9.621531e-001, 9.625114e-001, 9.628697e-001, 9.632280e-001, 9.635864e-001, 9.639447e-001,
+9.643030e-001, 9.646613e-001, 9.650159e-001, 9.653699e-001, 9.657238e-001, 9.660778e-001, 9.664317e-001, 9.667857e-001, 9.671396e-001, 9.674923e-001,
+9.678416e-001, 9.681910e-001, 9.685403e-001, 9.688897e-001, 9.692390e-001, 9.695883e-001, 9.699377e-001, 9.702843e-001, 9.706295e-001, 9.709746e-001,
+9.713198e-001, 9.716649e-001, 9.720101e-001, 9.723552e-001, 9.727004e-001, 9.730417e-001, 9.733829e-001, 9.737240e-001, 9.740652e-001, 9.744063e-001,
+9.747475e-001, 9.750886e-001, 9.754289e-001, 9.757658e-001, 9.761027e-001, 9.764395e-001, 9.767764e-001, 9.771133e-001, 9.774502e-001, 9.777870e-001,
+9.781220e-001, 9.784540e-001, 9.787859e-001, 9.791178e-001, 9.794497e-001, 9.797817e-001, 9.801136e-001, 9.804455e-001, 9.807748e-001, 9.811015e-001,
+9.814282e-001, 9.817548e-001, 9.820815e-001, 9.824081e-001, 9.827348e-001, 9.830614e-001, 9.833847e-001, 9.837050e-001, 9.840254e-001, 9.843457e-001,
+9.846661e-001, 9.849864e-001, 9.853067e-001, 9.856271e-001, 9.859436e-001, 9.862567e-001, 9.865697e-001, 9.868828e-001, 9.871958e-001, 9.875089e-001,
+9.878219e-001, 9.881350e-001, 9.884447e-001, 9.887502e-001, 9.890556e-001, 9.893611e-001, 9.896665e-001, 9.899720e-001, 9.902774e-001, 9.905829e-001,
+9.908855e-001, 9.911810e-001, 9.914764e-001, 9.917719e-001, 9.920673e-001, 9.923628e-001, 9.926583e-001, 9.929537e-001, 9.932484e-001, 9.935322e-001,
+9.938160e-001, 9.940997e-001, 9.943835e-001, 9.946673e-001, 9.949511e-001, 9.952348e-001, 9.955186e-001, 9.957930e-001, 9.960648e-001, 9.963366e-001,
+9.966084e-001, 9.968802e-001, 9.971520e-001, 9.974238e-001, 9.976956e-001, 9.979603e-001, 9.982152e-001, 9.984702e-001, 9.987252e-001, 9.989801e-001,
+9.992351e-001, 9.994901e-001, 9.997450e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.181631e-003, 1.515003e-002, 2.240171e-002, 2.906855e-002, 3.529588e-002, 4.116694e-002, 4.672814e-002, 5.204555e-002, 5.714112e-002,
+6.203206e-002, 6.673564e-002, 7.129656e-002, 7.573854e-002, 8.007643e-002, 8.431472e-002, 8.845484e-002, 9.251325e-002, 9.648987e-002, 1.003945e-001,
+1.042160e-001, 1.079747e-001, 1.116577e-001, 1.152792e-001, 1.188424e-001, 1.223476e-001, 1.257934e-001, 1.291857e-001, 1.325112e-001, 1.357868e-001,
+1.390142e-001, 1.421942e-001, 1.453282e-001, 1.484291e-001, 1.514863e-001, 1.545145e-001, 1.575087e-001, 1.604655e-001, 1.633878e-001, 1.662712e-001,
+1.691236e-001, 1.719462e-001, 1.747328e-001, 1.774906e-001, 1.802142e-001, 1.829040e-001, 1.855682e-001, 1.881996e-001, 1.908040e-001, 1.933835e-001,
+1.959408e-001, 1.984723e-001, 2.009815e-001, 2.034648e-001, 2.059251e-001, 2.083660e-001, 2.107863e-001, 2.131928e-001, 2.155798e-001, 2.179521e-001,
+2.203089e-001, 2.226428e-001, 2.249637e-001, 2.272658e-001, 2.295507e-001, 2.318233e-001, 2.340773e-001, 2.363186e-001, 2.385478e-001, 2.407572e-001,
+2.429529e-001, 2.451368e-001, 2.473031e-001, 2.494541e-001, 2.515928e-001, 2.537161e-001, 2.558267e-001, 2.579267e-001, 2.600139e-001, 2.620905e-001,
+2.641523e-001, 2.661997e-001, 2.682359e-001, 2.702636e-001, 2.722779e-001, 2.742807e-001, 2.762736e-001, 2.782566e-001, 2.802279e-001, 2.821829e-001,
+2.841286e-001, 2.860676e-001, 2.879949e-001, 2.899109e-001, 2.918199e-001, 2.937203e-001, 2.956118e-001, 2.974927e-001, 2.993623e-001, 3.012244e-001,
+3.030806e-001, 3.049292e-001, 3.067674e-001, 3.085951e-001, 3.104136e-001, 3.122237e-001, 3.140270e-001, 3.158224e-001, 3.176110e-001, 3.193928e-001,
+3.211658e-001, 3.229303e-001, 3.246853e-001, 3.264289e-001, 3.281643e-001, 3.298931e-001, 3.316138e-001, 3.333250e-001, 3.350282e-001, 3.367245e-001,
+3.384152e-001, 3.401009e-001, 3.417800e-001, 3.434512e-001, 3.451135e-001, 3.467680e-001, 3.484159e-001, 3.500582e-001, 3.516959e-001, 3.533272e-001,
+3.549514e-001, 3.565693e-001, 3.581800e-001, 3.597827e-001, 3.613792e-001, 3.629701e-001, 3.645545e-001, 3.661319e-001, 3.677033e-001, 3.692692e-001,
+3.708306e-001, 3.723872e-001, 3.739395e-001, 3.754873e-001, 3.770300e-001, 3.785668e-001, 3.800952e-001, 3.816176e-001, 3.831364e-001, 3.846519e-001,
+3.861636e-001, 3.876700e-001, 3.891700e-001, 3.906654e-001, 3.921560e-001, 3.936414e-001, 3.951213e-001, 3.965955e-001, 3.980642e-001, 3.995279e-001,
+4.009876e-001, 4.024423e-001, 4.038925e-001, 4.053379e-001, 4.067766e-001, 4.082115e-001, 4.096431e-001, 4.110711e-001, 4.124928e-001, 4.139108e-001,
+4.153253e-001, 4.167350e-001, 4.181383e-001, 4.195369e-001, 4.209308e-001, 4.223197e-001, 4.237054e-001, 4.250878e-001, 4.264640e-001, 4.278368e-001,
+4.292070e-001, 4.305736e-001, 4.319369e-001, 4.332975e-001, 4.346529e-001, 4.360040e-001, 4.373517e-001, 4.386920e-001, 4.400289e-001, 4.413626e-001,
+4.426892e-001, 4.440131e-001, 4.453332e-001, 4.466494e-001, 4.479634e-001, 4.492729e-001, 4.505785e-001, 4.518813e-001, 4.531791e-001, 4.544754e-001,
+4.557689e-001, 4.570592e-001, 4.583479e-001, 4.596311e-001, 4.609122e-001, 4.621889e-001, 4.634611e-001, 4.647307e-001, 4.659950e-001, 4.672574e-001,
+4.685146e-001, 4.697686e-001, 4.710185e-001, 4.722629e-001, 4.735049e-001, 4.747409e-001, 4.759757e-001, 4.772061e-001, 4.784345e-001, 4.796592e-001,
+4.808803e-001, 4.820986e-001, 4.833118e-001, 4.845230e-001, 4.857310e-001, 4.869384e-001, 4.881415e-001, 4.893438e-001, 4.905418e-001, 4.917384e-001,
+4.929306e-001, 4.941214e-001, 4.953093e-001, 4.964951e-001, 4.976781e-001, 4.988584e-001, 5.000360e-001, 5.012102e-001, 5.023818e-001, 5.035496e-001,
+5.047146e-001, 5.058754e-001, 5.070334e-001, 5.081869e-001, 5.093373e-001, 5.104841e-001, 5.116283e-001, 5.127689e-001, 5.139064e-001, 5.150404e-001,
+5.161709e-001, 5.172980e-001, 5.184209e-001, 5.195423e-001, 5.206610e-001, 5.217785e-001, 5.228925e-001, 5.240059e-001, 5.251149e-001, 5.262239e-001,
+5.273274e-001, 5.284309e-001, 5.295295e-001, 5.306271e-001, 5.317205e-001, 5.328117e-001, 5.339007e-001, 5.349870e-001, 5.360724e-001, 5.371551e-001,
+5.382376e-001, 5.393162e-001, 5.403949e-001, 5.414699e-001, 5.425440e-001, 5.436155e-001, 5.446846e-001, 5.457529e-001, 5.468186e-001, 5.478843e-001,
+5.489464e-001, 5.500083e-001, 5.510676e-001, 5.521253e-001, 5.531818e-001, 5.542350e-001, 5.552883e-001, 5.563371e-001, 5.573856e-001, 5.584312e-001,
+5.594745e-001, 5.605170e-001, 5.615549e-001, 5.625928e-001, 5.636265e-001, 5.646586e-001, 5.656889e-001, 5.667149e-001, 5.677410e-001, 5.687616e-001,
+5.697812e-001, 5.707985e-001, 5.718114e-001, 5.728244e-001, 5.738328e-001, 5.748404e-001, 5.758462e-001, 5.768484e-001, 5.778505e-001, 5.788481e-001,
+5.798445e-001, 5.808395e-001, 5.818299e-001, 5.828203e-001, 5.838078e-001, 5.847937e-001, 5.857795e-001, 5.867608e-001, 5.877421e-001, 5.887214e-001,
+5.896979e-001, 5.906744e-001, 5.916472e-001, 5.926188e-001, 5.935899e-001, 5.945564e-001, 5.955229e-001, 5.964874e-001, 5.974487e-001, 5.984100e-001,
+5.993677e-001, 6.003237e-001, 6.012797e-001, 6.022305e-001, 6.031810e-001, 6.041305e-001, 6.050755e-001, 6.060204e-001, 6.069630e-001, 6.079023e-001,
+6.088415e-001, 6.097773e-001, 6.107107e-001, 6.116441e-001, 6.125729e-001, 6.135004e-001, 6.144278e-001, 6.153497e-001, 6.162711e-001, 6.171923e-001,
+6.181075e-001, 6.190227e-001, 6.199370e-001, 6.208459e-001, 6.217548e-001, 6.226627e-001, 6.235667e-001, 6.244707e-001, 6.253734e-001, 6.262724e-001,
+6.271714e-001, 6.280690e-001, 6.289630e-001, 6.298570e-001, 6.307495e-001, 6.316384e-001, 6.325273e-001, 6.334148e-001, 6.342985e-001, 6.351823e-001,
+6.360648e-001, 6.369433e-001, 6.378218e-001, 6.386997e-001, 6.395746e-001, 6.404494e-001, 6.413241e-001, 6.421938e-001, 6.430636e-001, 6.439334e-001,
+6.447986e-001, 6.456634e-001, 6.465282e-001, 6.473893e-001, 6.482492e-001, 6.491091e-001, 6.499661e-001, 6.508212e-001, 6.516763e-001, 6.525289e-001,
+6.533777e-001, 6.542265e-001, 6.550743e-001, 6.559170e-001, 6.567597e-001, 6.576023e-001, 6.584396e-001, 6.592763e-001, 6.601130e-001, 6.609461e-001,
+6.617771e-001, 6.626080e-001, 6.634372e-001, 6.642625e-001, 6.650879e-001, 6.659132e-001, 6.667333e-001, 6.675532e-001, 6.683731e-001, 6.691899e-001,
+6.700046e-001, 6.708193e-001, 6.716329e-001, 6.724425e-001, 6.732522e-001, 6.740618e-001, 6.748676e-001, 6.756724e-001, 6.764772e-001, 6.772803e-001,
+6.780804e-001, 6.788805e-001, 6.796805e-001, 6.804767e-001, 6.812722e-001, 6.820678e-001, 6.828618e-001, 6.836529e-001, 6.844441e-001, 6.852353e-001,
+6.860230e-001, 6.868100e-001, 6.875970e-001, 6.883826e-001, 6.891641e-001, 6.899457e-001, 6.907272e-001, 6.915054e-001, 6.922817e-001, 6.930580e-001,
+6.938342e-001, 6.946055e-001, 6.953768e-001, 6.961481e-001, 6.969177e-001, 6.976842e-001, 6.984508e-001, 6.992173e-001, 6.999807e-001, 7.007427e-001,
+7.015047e-001, 7.022667e-001, 7.030245e-001, 7.037821e-001, 7.045397e-001, 7.052962e-001, 7.060483e-001, 7.068005e-001, 7.075526e-001, 7.083025e-001,
+7.090494e-001, 7.097964e-001, 7.105433e-001, 7.112872e-001, 7.120292e-001, 7.127713e-001, 7.135133e-001, 7.142517e-001, 7.149892e-001, 7.157266e-001,
+7.164640e-001, 7.171976e-001, 7.179308e-001, 7.186639e-001, 7.193971e-001, 7.201262e-001, 7.208554e-001, 7.215845e-001, 7.223134e-001, 7.230388e-001,
+7.237643e-001, 7.244897e-001, 7.252147e-001, 7.259354e-001, 7.266561e-001, 7.273768e-001, 7.280971e-001, 7.288134e-001, 7.295297e-001, 7.302460e-001,
+7.309621e-001, 7.316743e-001, 7.323865e-001, 7.330987e-001, 7.338109e-001, 7.345195e-001, 7.352281e-001, 7.359366e-001, 7.366451e-001, 7.373495e-001,
+7.380533e-001, 7.387571e-001, 7.394609e-001, 7.401615e-001, 7.408610e-001, 7.415605e-001, 7.422600e-001, 7.429573e-001, 7.436529e-001, 7.443485e-001,
+7.450441e-001, 7.457385e-001, 7.464306e-001, 7.471227e-001, 7.478149e-001, 7.485067e-001, 7.491957e-001, 7.498848e-001, 7.505739e-001, 7.512630e-001,
+7.519488e-001, 7.526340e-001, 7.533192e-001, 7.540044e-001, 7.546878e-001, 7.553695e-001, 7.560512e-001, 7.567330e-001, 7.574139e-001, 7.580913e-001,
+7.587687e-001, 7.594461e-001, 7.601235e-001, 7.607979e-001, 7.614713e-001, 7.621448e-001, 7.628183e-001, 7.634900e-001, 7.641587e-001, 7.648273e-001,
+7.654959e-001, 7.661646e-001, 7.668293e-001, 7.674936e-001, 7.681579e-001, 7.688221e-001, 7.694843e-001, 7.701434e-001, 7.708024e-001, 7.714615e-001,
+7.721206e-001, 7.727754e-001, 7.734297e-001, 7.740840e-001, 7.747382e-001, 7.753911e-001, 7.760410e-001, 7.766909e-001, 7.773407e-001, 7.779906e-001,
+7.786368e-001, 7.792814e-001, 7.799261e-001, 7.805707e-001, 7.812151e-001, 7.818549e-001, 7.824948e-001, 7.831346e-001, 7.837745e-001, 7.844127e-001,
+7.850482e-001, 7.856837e-001, 7.863192e-001, 7.869547e-001, 7.875876e-001, 7.882192e-001, 7.888507e-001, 7.894823e-001, 7.901139e-001, 7.907413e-001,
+7.913681e-001, 7.919950e-001, 7.926219e-001, 7.932484e-001, 7.938710e-001, 7.944937e-001, 7.951163e-001, 7.957390e-001, 7.963608e-001, 7.969797e-001,
+7.975987e-001, 7.982177e-001, 7.988366e-001, 7.994541e-001, 8.000687e-001, 8.006833e-001, 8.012979e-001, 8.019125e-001, 8.025255e-001, 8.031363e-001,
+8.037471e-001, 8.043579e-001, 8.049687e-001, 8.055780e-001, 8.061855e-001, 8.067930e-001, 8.074006e-001, 8.080081e-001, 8.086138e-001, 8.092174e-001,
+8.098209e-001, 8.104245e-001, 8.110281e-001, 8.116298e-001, 8.122287e-001, 8.128276e-001, 8.134266e-001, 8.140255e-001, 8.146228e-001, 8.152165e-001,
+8.158102e-001, 8.164039e-001, 8.169976e-001, 8.175905e-001, 8.181796e-001, 8.187687e-001, 8.193578e-001, 8.199469e-001, 8.205359e-001, 8.211210e-001,
+8.217060e-001, 8.222911e-001, 8.228762e-001, 8.234612e-001, 8.240436e-001, 8.246252e-001, 8.252068e-001, 8.257885e-001, 8.263701e-001, 8.269496e-001,
+8.275271e-001, 8.281046e-001, 8.286822e-001, 8.292597e-001, 8.298364e-001, 8.304104e-001, 8.309844e-001, 8.315584e-001, 8.321324e-001, 8.327064e-001,
+8.332767e-001, 8.338465e-001, 8.344164e-001, 8.349862e-001, 8.355560e-001, 8.361235e-001, 8.366886e-001, 8.372538e-001, 8.378189e-001, 8.383840e-001,
+8.389489e-001, 8.395100e-001, 8.400711e-001, 8.406322e-001, 8.411933e-001, 8.417543e-001, 8.423134e-001, 8.428711e-001, 8.434288e-001, 8.439865e-001,
+8.445441e-001, 8.451016e-001, 8.456565e-001, 8.462114e-001, 8.467663e-001, 8.473211e-001, 8.478760e-001, 8.484287e-001, 8.489792e-001, 8.495296e-001,
+8.500800e-001, 8.506304e-001, 8.511808e-001, 8.517271e-001, 8.522726e-001, 8.528182e-001, 8.533637e-001, 8.539093e-001, 8.544540e-001, 8.549953e-001,
+8.555367e-001, 8.560781e-001, 8.566194e-001, 8.571608e-001, 8.577004e-001, 8.582383e-001, 8.587761e-001, 8.593140e-001, 8.598518e-001, 8.603896e-001,
+8.609246e-001, 8.614584e-001, 8.619922e-001, 8.625261e-001, 8.630599e-001, 8.635937e-001, 8.641244e-001, 8.646548e-001, 8.651853e-001, 8.657157e-001,
+8.662461e-001, 8.667764e-001, 8.673040e-001, 8.678316e-001, 8.683593e-001, 8.688869e-001, 8.694145e-001, 8.699416e-001, 8.704660e-001, 8.709904e-001,
+8.715147e-001, 8.720391e-001, 8.725635e-001, 8.730871e-001, 8.736078e-001, 8.741285e-001, 8.746492e-001, 8.751698e-001, 8.756905e-001, 8.762104e-001,
+8.767271e-001, 8.772437e-001, 8.777604e-001, 8.782770e-001, 8.787937e-001, 8.793098e-001, 8.798231e-001, 8.803363e-001, 8.808496e-001, 8.813629e-001,
+8.818761e-001, 8.823893e-001, 8.828998e-001, 8.834104e-001, 8.839209e-001, 8.844314e-001, 8.849419e-001, 8.854525e-001, 8.859602e-001, 8.864676e-001,
+8.869750e-001, 8.874824e-001, 8.879898e-001, 8.884971e-001, 8.890014e-001, 8.895041e-001, 8.900068e-001, 8.905096e-001, 8.910123e-001, 8.915150e-001,
+8.920161e-001, 8.925150e-001, 8.930138e-001, 8.935126e-001, 8.940115e-001, 8.945103e-001, 8.950087e-001, 8.955043e-001, 8.959999e-001, 8.964955e-001,
+8.969911e-001, 8.974866e-001, 8.979822e-001, 8.984759e-001, 8.989690e-001, 8.994620e-001, 8.999551e-001, 9.004481e-001, 9.009412e-001, 9.014333e-001,
+9.019234e-001, 9.024136e-001, 9.029037e-001, 9.033939e-001, 9.038840e-001, 9.043742e-001, 9.048606e-001, 9.053465e-001, 9.058324e-001, 9.063184e-001,
+9.068043e-001, 9.072902e-001, 9.077749e-001, 9.082573e-001, 9.087397e-001, 9.092222e-001, 9.097046e-001, 9.101871e-001, 9.106695e-001, 9.111498e-001,
+9.116294e-001, 9.121091e-001, 9.125887e-001, 9.130684e-001, 9.135480e-001, 9.140272e-001, 9.145039e-001, 9.149805e-001, 9.154572e-001, 9.159338e-001,
+9.164105e-001, 9.168871e-001, 9.173617e-001, 9.178340e-001, 9.183063e-001, 9.187786e-001, 9.192509e-001, 9.197231e-001, 9.201954e-001, 9.206651e-001,
+9.211338e-001, 9.216025e-001, 9.220712e-001, 9.225398e-001, 9.230085e-001, 9.234772e-001, 9.239433e-001, 9.244091e-001, 9.248750e-001, 9.253408e-001,
+9.258067e-001, 9.262725e-001, 9.267381e-001, 9.272008e-001, 9.276636e-001, 9.281263e-001, 9.285890e-001, 9.290517e-001, 9.295145e-001, 9.299766e-001,
+9.304360e-001, 9.308954e-001, 9.313548e-001, 9.318142e-001, 9.322736e-001, 9.327329e-001, 9.331911e-001, 9.336445e-001, 9.340979e-001, 9.345512e-001,
+9.350046e-001, 9.354580e-001, 9.359113e-001, 9.363634e-001, 9.368094e-001, 9.372554e-001, 9.377014e-001, 9.381475e-001, 9.385935e-001, 9.390395e-001,
+9.394849e-001, 9.399246e-001, 9.403643e-001, 9.408039e-001, 9.412436e-001, 9.416833e-001, 9.421230e-001, 9.425627e-001, 9.429976e-001, 9.434322e-001,
+9.438669e-001, 9.443015e-001, 9.447362e-001, 9.451708e-001, 9.456055e-001, 9.460370e-001, 9.464674e-001, 9.468979e-001, 9.473284e-001, 9.477588e-001,
+9.481893e-001, 9.486197e-001, 9.490481e-001, 9.494743e-001, 9.499005e-001, 9.503267e-001, 9.507529e-001, 9.511791e-001, 9.516053e-001, 9.520308e-001,
+9.524527e-001, 9.528746e-001, 9.532965e-001, 9.537184e-001, 9.541404e-001, 9.545623e-001, 9.549842e-001, 9.554026e-001, 9.558201e-001, 9.562376e-001,
+9.566550e-001, 9.570725e-001, 9.574900e-001, 9.579075e-001, 9.583234e-001, 9.587361e-001, 9.591489e-001, 9.595617e-001, 9.599744e-001, 9.603872e-001,
+9.608000e-001, 9.612128e-001, 9.616207e-001, 9.620277e-001, 9.624347e-001, 9.628417e-001, 9.632487e-001, 9.636557e-001, 9.640627e-001, 9.644679e-001,
+9.648685e-001, 9.652690e-001, 9.656695e-001, 9.660701e-001, 9.664706e-001, 9.668712e-001, 9.672717e-001, 9.676679e-001, 9.680617e-001, 9.684556e-001,
+9.688494e-001, 9.692432e-001, 9.696371e-001, 9.700309e-001, 9.704248e-001, 9.708117e-001, 9.711983e-001, 9.715849e-001, 9.719715e-001, 9.723581e-001,
+9.727448e-001, 9.731314e-001, 9.735164e-001, 9.738948e-001, 9.742732e-001, 9.746516e-001, 9.750299e-001, 9.754083e-001, 9.757867e-001, 9.761651e-001,
+9.765401e-001, 9.769094e-001, 9.772787e-001, 9.776480e-001, 9.780174e-001, 9.783867e-001, 9.787560e-001, 9.791253e-001, 9.794902e-001, 9.798504e-001,
+9.802107e-001, 9.805709e-001, 9.809311e-001, 9.812914e-001, 9.816516e-001, 9.820119e-001, 9.823671e-001, 9.827179e-001, 9.830688e-001, 9.834197e-001,
+9.837705e-001, 9.841214e-001, 9.844723e-001, 9.848231e-001, 9.851688e-001, 9.855098e-001, 9.858507e-001, 9.861916e-001, 9.865326e-001, 9.868735e-001,
+9.872145e-001, 9.875554e-001, 9.878914e-001, 9.882211e-001, 9.885507e-001, 9.888804e-001, 9.892101e-001, 9.895397e-001, 9.898694e-001, 9.901990e-001,
+9.905248e-001, 9.908408e-001, 9.911568e-001, 9.914728e-001, 9.917888e-001, 9.921048e-001, 9.924208e-001, 9.927368e-001, 9.930516e-001, 9.933491e-001,
+9.936467e-001, 9.939443e-001, 9.942419e-001, 9.945395e-001, 9.948371e-001, 9.951347e-001, 9.954322e-001, 9.957144e-001, 9.959922e-001, 9.962701e-001,
+9.965479e-001, 9.968257e-001, 9.971036e-001, 9.973814e-001, 9.976593e-001, 9.979290e-001, 9.981879e-001, 9.984468e-001, 9.987056e-001, 9.989645e-001,
+9.992234e-001, 9.994823e-001, 9.997411e-001, 1.000000e+000)),
+("Agfa", "Agfacolor HDC 400 plus", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.885450e-002, 3.325249e-002, 4.525987e-002, 5.597874e-002, 6.588307e-002, 7.521119e-002, 8.410121e-002, 9.266219e-002, 1.009651e-001,
+1.090590e-001, 1.170131e-001, 1.247943e-001, 1.323173e-001, 1.394851e-001, 1.463093e-001, 1.528205e-001, 1.590683e-001, 1.650578e-001, 1.708183e-001,
+1.763903e-001, 1.817798e-001, 1.870086e-001, 1.920844e-001, 1.970220e-001, 2.018329e-001, 2.065093e-001, 2.110690e-001, 2.155349e-001, 2.198981e-001,
+2.241635e-001, 2.283228e-001, 2.323802e-001, 2.363558e-001, 2.402615e-001, 2.441187e-001, 2.479201e-001, 2.516668e-001, 2.553598e-001, 2.590074e-001,
+2.626096e-001, 2.661621e-001, 2.696613e-001, 2.731045e-001, 2.764895e-001, 2.798126e-001, 2.830833e-001, 2.863064e-001, 2.894839e-001, 2.926195e-001,
+2.957077e-001, 2.987435e-001, 3.017310e-001, 3.046731e-001, 3.075759e-001, 3.104431e-001, 3.132778e-001, 3.160825e-001, 3.188612e-001, 3.216166e-001,
+3.243513e-001, 3.270678e-001, 3.297684e-001, 3.324557e-001, 3.351316e-001, 3.377984e-001, 3.404580e-001, 3.431123e-001, 3.457568e-001, 3.483870e-001,
+3.509952e-001, 3.535764e-001, 3.561269e-001, 3.586478e-001, 3.611387e-001, 3.636046e-001, 3.660457e-001, 3.684635e-001, 3.708611e-001, 3.732374e-001,
+3.755971e-001, 3.779378e-001, 3.802644e-001, 3.825748e-001, 3.848729e-001, 3.871578e-001, 3.894317e-001, 3.916954e-001, 3.939491e-001, 3.961951e-001,
+3.984332e-001, 4.006647e-001, 4.028909e-001, 4.051120e-001, 4.073290e-001, 4.095428e-001, 4.117542e-001, 4.139571e-001, 4.161538e-001, 4.183440e-001,
+4.205238e-001, 4.226935e-001, 4.248510e-001, 4.269989e-001, 4.291365e-001, 4.312636e-001, 4.333818e-001, 4.354880e-001, 4.375857e-001, 4.396727e-001,
+4.417509e-001, 4.438195e-001, 4.458774e-001, 4.479228e-001, 4.499554e-001, 4.519763e-001, 4.539847e-001, 4.559823e-001, 4.579656e-001, 4.599343e-001,
+4.618889e-001, 4.638301e-001, 4.657584e-001, 4.676744e-001, 4.695785e-001, 4.714692e-001, 4.733454e-001, 4.752089e-001, 4.770592e-001, 4.788978e-001,
+4.807247e-001, 4.825394e-001, 4.843406e-001, 4.861288e-001, 4.879052e-001, 4.896670e-001, 4.914163e-001, 4.931512e-001, 4.948748e-001, 4.965869e-001,
+4.982893e-001, 4.999811e-001, 5.016608e-001, 5.033278e-001, 5.049810e-001, 5.066221e-001, 5.082524e-001, 5.098735e-001, 5.114861e-001, 5.130901e-001,
+5.146844e-001, 5.162659e-001, 5.178381e-001, 5.194015e-001, 5.209562e-001, 5.225027e-001, 5.240399e-001, 5.255667e-001, 5.270826e-001, 5.285871e-001,
+5.300802e-001, 5.315656e-001, 5.330439e-001, 5.345148e-001, 5.359786e-001, 5.374346e-001, 5.388824e-001, 5.403190e-001, 5.417452e-001, 5.431645e-001,
+5.445778e-001, 5.459791e-001, 5.473732e-001, 5.487601e-001, 5.501369e-001, 5.515048e-001, 5.528664e-001, 5.542203e-001, 5.555656e-001, 5.569046e-001,
+5.582354e-001, 5.595572e-001, 5.608744e-001, 5.621863e-001, 5.634893e-001, 5.647879e-001, 5.660806e-001, 5.673638e-001, 5.686416e-001, 5.699104e-001,
+5.711725e-001, 5.724303e-001, 5.736793e-001, 5.749223e-001, 5.761599e-001, 5.773892e-001, 5.786157e-001, 5.798376e-001, 5.810524e-001, 5.822634e-001,
+5.834617e-001, 5.846555e-001, 5.858426e-001, 5.870231e-001, 5.882007e-001, 5.893699e-001, 5.905356e-001, 5.916949e-001, 5.928495e-001, 5.940015e-001,
+5.951455e-001, 5.962870e-001, 5.974203e-001, 5.985488e-001, 5.996711e-001, 6.007874e-001, 6.019008e-001, 6.030085e-001, 6.041146e-001, 6.052120e-001,
+6.063060e-001, 6.073912e-001, 6.084720e-001, 6.095473e-001, 6.106180e-001, 6.116858e-001, 6.127483e-001, 6.138090e-001, 6.148628e-001, 6.159157e-001,
+6.169633e-001, 6.180101e-001, 6.190497e-001, 6.200875e-001, 6.211167e-001, 6.221440e-001, 6.231652e-001, 6.241848e-001, 6.252005e-001, 6.262137e-001,
+6.272215e-001, 6.282256e-001, 6.292230e-001, 6.302175e-001, 6.312069e-001, 6.321944e-001, 6.331782e-001, 6.341605e-001, 6.351393e-001, 6.361160e-001,
+6.370865e-001, 6.380555e-001, 6.390181e-001, 6.399800e-001, 6.409356e-001, 6.418911e-001, 6.428391e-001, 6.437871e-001, 6.447305e-001, 6.456734e-001,
+6.466109e-001, 6.475467e-001, 6.484770e-001, 6.494036e-001, 6.503273e-001, 6.512470e-001, 6.521654e-001, 6.530793e-001, 6.539931e-001, 6.548979e-001,
+6.558027e-001, 6.567010e-001, 6.575976e-001, 6.584902e-001, 6.593795e-001, 6.602667e-001, 6.611485e-001, 6.620302e-001, 6.629042e-001, 6.637783e-001,
+6.646464e-001, 6.655121e-001, 6.663750e-001, 6.672336e-001, 6.680920e-001, 6.689471e-001, 6.698023e-001, 6.706528e-001, 6.715014e-001, 6.723481e-001,
+6.731910e-001, 6.740338e-001, 6.748723e-001, 6.757103e-001, 6.765458e-001, 6.773787e-001, 6.782113e-001, 6.790390e-001, 6.798667e-001, 6.806908e-001,
+6.815125e-001, 6.823334e-001, 6.831489e-001, 6.839644e-001, 6.847775e-001, 6.855893e-001, 6.864005e-001, 6.872067e-001, 6.880130e-001, 6.888152e-001,
+6.896143e-001, 6.904134e-001, 6.912078e-001, 6.920023e-001, 6.927951e-001, 6.935858e-001, 6.943765e-001, 6.951621e-001, 6.959465e-001, 6.967298e-001,
+6.975088e-001, 6.982877e-001, 6.990643e-001, 6.998388e-001, 7.006133e-001, 7.013818e-001, 7.021493e-001, 7.029158e-001, 7.036772e-001, 7.044386e-001,
+7.051977e-001, 7.059540e-001, 7.067103e-001, 7.074630e-001, 7.082142e-001, 7.089655e-001, 7.097117e-001, 7.104577e-001, 7.112027e-001, 7.119431e-001,
+7.126836e-001, 7.134215e-001, 7.141551e-001, 7.148887e-001, 7.156194e-001, 7.163476e-001, 7.170758e-001, 7.178010e-001, 7.185250e-001, 7.192489e-001,
+7.199671e-001, 7.206841e-001, 7.214010e-001, 7.221129e-001, 7.228243e-001, 7.235357e-001, 7.242427e-001, 7.249497e-001, 7.256564e-001, 7.263563e-001,
+7.270562e-001, 7.277556e-001, 7.284499e-001, 7.291441e-001, 7.298380e-001, 7.305276e-001, 7.312173e-001, 7.319066e-001, 7.325891e-001, 7.332716e-001,
+7.339540e-001, 7.346294e-001, 7.353048e-001, 7.359801e-001, 7.366491e-001, 7.373176e-001, 7.379861e-001, 7.386488e-001, 7.393102e-001, 7.399717e-001,
+7.406283e-001, 7.412828e-001, 7.419374e-001, 7.425882e-001, 7.432362e-001, 7.438841e-001, 7.445294e-001, 7.451705e-001, 7.458115e-001, 7.464513e-001,
+7.470857e-001, 7.477200e-001, 7.483543e-001, 7.489826e-001, 7.496105e-001, 7.502384e-001, 7.508633e-001, 7.514869e-001, 7.521104e-001, 7.527319e-001,
+7.533504e-001, 7.539689e-001, 7.545870e-001, 7.552015e-001, 7.558160e-001, 7.564306e-001, 7.570430e-001, 7.576547e-001, 7.582664e-001, 7.588763e-001,
+7.594833e-001, 7.600904e-001, 7.606974e-001, 7.613009e-001, 7.619044e-001, 7.625079e-001, 7.631100e-001, 7.637110e-001, 7.643121e-001, 7.649124e-001,
+7.655080e-001, 7.661035e-001, 7.666991e-001, 7.672913e-001, 7.678817e-001, 7.684721e-001, 7.690622e-001, 7.696507e-001, 7.702391e-001, 7.708276e-001,
+7.714131e-001, 7.719967e-001, 7.725803e-001, 7.731636e-001, 7.737426e-001, 7.743215e-001, 7.749005e-001, 7.754788e-001, 7.760564e-001, 7.766340e-001,
+7.772115e-001, 7.777855e-001, 7.783587e-001, 7.789319e-001, 7.795042e-001, 7.800723e-001, 7.806403e-001, 7.812083e-001, 7.817750e-001, 7.823402e-001,
+7.829054e-001, 7.834705e-001, 7.840329e-001, 7.845945e-001, 7.851560e-001, 7.857174e-001, 7.862745e-001, 7.868316e-001, 7.873887e-001, 7.879452e-001,
+7.885002e-001, 7.890551e-001, 7.896100e-001, 7.901637e-001, 7.907156e-001, 7.912676e-001, 7.918195e-001, 7.923693e-001, 7.929175e-001, 7.934657e-001,
+7.940139e-001, 7.945610e-001, 7.951077e-001, 7.956544e-001, 7.962012e-001, 7.967459e-001, 7.972903e-001, 7.978347e-001, 7.983791e-001, 7.989180e-001,
+7.994562e-001, 7.999945e-001, 8.005327e-001, 8.010673e-001, 8.016016e-001, 8.021359e-001, 8.026702e-001, 8.032030e-001, 8.037356e-001, 8.042682e-001,
+8.048008e-001, 8.053286e-001, 8.058557e-001, 8.063828e-001, 8.069099e-001, 8.074336e-001, 8.079563e-001, 8.084791e-001, 8.090019e-001, 8.095226e-001,
+8.100424e-001, 8.105623e-001, 8.110821e-001, 8.115993e-001, 8.121145e-001, 8.126297e-001, 8.131450e-001, 8.136588e-001, 8.141705e-001, 8.146821e-001,
+8.151938e-001, 8.157051e-001, 8.162147e-001, 8.167243e-001, 8.172338e-001, 8.177434e-001, 8.182494e-001, 8.187551e-001, 8.192609e-001, 8.197666e-001,
+8.202686e-001, 8.207687e-001, 8.212688e-001, 8.217689e-001, 8.222675e-001, 8.227634e-001, 8.232593e-001, 8.237551e-001, 8.242510e-001, 8.247438e-001,
+8.252366e-001, 8.257294e-001, 8.262222e-001, 8.267119e-001, 8.271999e-001, 8.276878e-001, 8.281758e-001, 8.286628e-001, 8.291462e-001, 8.296297e-001,
+8.301131e-001, 8.305966e-001, 8.310770e-001, 8.315564e-001, 8.320358e-001, 8.325152e-001, 8.329936e-001, 8.334691e-001, 8.339445e-001, 8.344200e-001,
+8.348954e-001, 8.353683e-001, 8.358402e-001, 8.363121e-001, 8.367841e-001, 8.372555e-001, 8.377242e-001, 8.381930e-001, 8.386618e-001, 8.391305e-001,
+8.395976e-001, 8.400633e-001, 8.405290e-001, 8.409947e-001, 8.414604e-001, 8.419228e-001, 8.423849e-001, 8.428470e-001, 8.433091e-001, 8.437703e-001,
+8.442285e-001, 8.446866e-001, 8.451448e-001, 8.456030e-001, 8.460601e-001, 8.465162e-001, 8.469723e-001, 8.474284e-001, 8.478844e-001, 8.483386e-001,
+8.487920e-001, 8.492454e-001, 8.496989e-001, 8.501523e-001, 8.506021e-001, 8.510516e-001, 8.515011e-001, 8.519507e-001, 8.523998e-001, 8.528449e-001,
+8.532899e-001, 8.537350e-001, 8.541801e-001, 8.546246e-001, 8.550671e-001, 8.555096e-001, 8.559520e-001, 8.563945e-001, 8.568361e-001, 8.572757e-001,
+8.577153e-001, 8.581548e-001, 8.585944e-001, 8.590329e-001, 8.594690e-001, 8.599051e-001, 8.603413e-001, 8.607774e-001, 8.612130e-001, 8.616475e-001,
+8.620819e-001, 8.625164e-001, 8.629509e-001, 8.633845e-001, 8.638161e-001, 8.642477e-001, 8.646793e-001, 8.651109e-001, 8.655417e-001, 8.659693e-001,
+8.663968e-001, 8.668244e-001, 8.672519e-001, 8.676794e-001, 8.681046e-001, 8.685298e-001, 8.689550e-001, 8.693802e-001, 8.698054e-001, 8.702281e-001,
+8.706504e-001, 8.710728e-001, 8.714951e-001, 8.719175e-001, 8.723371e-001, 8.727555e-001, 8.731738e-001, 8.735921e-001, 8.740105e-001, 8.744276e-001,
+8.748430e-001, 8.752584e-001, 8.756738e-001, 8.760892e-001, 8.765044e-001, 8.769180e-001, 8.773316e-001, 8.777452e-001, 8.781588e-001, 8.785724e-001,
+8.789830e-001, 8.793928e-001, 8.798025e-001, 8.802123e-001, 8.806220e-001, 8.810305e-001, 8.814369e-001, 8.818433e-001, 8.822498e-001, 8.826562e-001,
+8.830626e-001, 8.834683e-001, 8.838740e-001, 8.842797e-001, 8.846854e-001, 8.850911e-001, 8.854956e-001, 8.858985e-001, 8.863015e-001, 8.867045e-001,
+8.871075e-001, 8.875105e-001, 8.879091e-001, 8.883074e-001, 8.887058e-001, 8.891041e-001, 8.895024e-001, 8.899000e-001, 8.902962e-001, 8.906925e-001,
+8.910887e-001, 8.914849e-001, 8.918812e-001, 8.922762e-001, 8.926709e-001, 8.930655e-001, 8.934602e-001, 8.938548e-001, 8.942492e-001, 8.946403e-001,
+8.950314e-001, 8.954226e-001, 8.958137e-001, 8.962048e-001, 8.965950e-001, 8.969836e-001, 8.973723e-001, 8.977609e-001, 8.981495e-001, 8.985381e-001,
+8.989258e-001, 8.993130e-001, 8.997001e-001, 9.000872e-001, 9.004744e-001, 9.008615e-001, 9.012459e-001, 9.016297e-001, 9.020134e-001, 9.023972e-001,
+9.027810e-001, 9.031647e-001, 9.035457e-001, 9.039265e-001, 9.043073e-001, 9.046882e-001, 9.050690e-001, 9.054498e-001, 9.058302e-001, 9.062106e-001,
+9.065909e-001, 9.069713e-001, 9.073517e-001, 9.077319e-001, 9.081099e-001, 9.084880e-001, 9.088661e-001, 9.092441e-001, 9.096222e-001, 9.099998e-001,
+9.103738e-001, 9.107477e-001, 9.111216e-001, 9.114955e-001, 9.118694e-001, 9.122432e-001, 9.126154e-001, 9.129876e-001, 9.133598e-001, 9.137320e-001,
+9.141042e-001, 9.144764e-001, 9.148474e-001, 9.152183e-001, 9.155892e-001, 9.159601e-001, 9.163310e-001, 9.167020e-001, 9.170698e-001, 9.174368e-001,
+9.178039e-001, 9.181709e-001, 9.185379e-001, 9.189050e-001, 9.192699e-001, 9.196335e-001, 9.199970e-001, 9.203606e-001, 9.207241e-001, 9.210876e-001,
+9.214508e-001, 9.218133e-001, 9.221758e-001, 9.225382e-001, 9.229007e-001, 9.232632e-001, 9.236256e-001, 9.239852e-001, 9.243448e-001, 9.247044e-001,
+9.250640e-001, 9.254236e-001, 9.257832e-001, 9.261407e-001, 9.264971e-001, 9.268535e-001, 9.272099e-001, 9.275663e-001, 9.279227e-001, 9.282787e-001,
+9.286337e-001, 9.289887e-001, 9.293437e-001, 9.296986e-001, 9.300536e-001, 9.304086e-001, 9.307622e-001, 9.311155e-001, 9.314687e-001, 9.318219e-001,
+9.321752e-001, 9.325284e-001, 9.328805e-001, 9.332295e-001, 9.335785e-001, 9.339275e-001, 9.342765e-001, 9.346254e-001, 9.349744e-001, 9.353217e-001,
+9.356682e-001, 9.360148e-001, 9.363613e-001, 9.367079e-001, 9.370544e-001, 9.374009e-001, 9.377468e-001, 9.380926e-001, 9.384385e-001, 9.387843e-001,
+9.391302e-001, 9.394761e-001, 9.398207e-001, 9.401634e-001, 9.405061e-001, 9.408488e-001, 9.411916e-001, 9.415343e-001, 9.418770e-001, 9.422174e-001,
+9.425566e-001, 9.428958e-001, 9.432350e-001, 9.435742e-001, 9.439134e-001, 9.442526e-001, 9.445903e-001, 9.449278e-001, 9.452652e-001, 9.456027e-001,
+9.459401e-001, 9.462776e-001, 9.466150e-001, 9.469504e-001, 9.472857e-001, 9.476211e-001, 9.479565e-001, 9.482919e-001, 9.486273e-001, 9.489623e-001,
+9.492946e-001, 9.496268e-001, 9.499591e-001, 9.502913e-001, 9.506236e-001, 9.509558e-001, 9.512878e-001, 9.516181e-001, 9.519485e-001, 9.522788e-001,
+9.526091e-001, 9.529394e-001, 9.532698e-001, 9.535999e-001, 9.539286e-001, 9.542574e-001, 9.545861e-001, 9.549148e-001, 9.552436e-001, 9.555723e-001,
+9.559008e-001, 9.562236e-001, 9.565463e-001, 9.568691e-001, 9.571919e-001, 9.575146e-001, 9.578374e-001, 9.581602e-001, 9.584769e-001, 9.587929e-001,
+9.591090e-001, 9.594250e-001, 9.597410e-001, 9.600571e-001, 9.603731e-001, 9.606860e-001, 9.609975e-001, 9.613090e-001, 9.616205e-001, 9.619320e-001,
+9.622435e-001, 9.625550e-001, 9.628652e-001, 9.631738e-001, 9.634823e-001, 9.637909e-001, 9.640994e-001, 9.644080e-001, 9.647165e-001, 9.650247e-001,
+9.653299e-001, 9.656352e-001, 9.659405e-001, 9.662458e-001, 9.665510e-001, 9.668563e-001, 9.671616e-001, 9.674647e-001, 9.677671e-001, 9.680694e-001,
+9.683718e-001, 9.686742e-001, 9.689765e-001, 9.692789e-001, 9.695802e-001, 9.698789e-001, 9.701776e-001, 9.704764e-001, 9.707751e-001, 9.710738e-001,
+9.713726e-001, 9.716713e-001, 9.719662e-001, 9.722601e-001, 9.725541e-001, 9.728481e-001, 9.731420e-001, 9.734360e-001, 9.737300e-001, 9.740230e-001,
+9.743129e-001, 9.746028e-001, 9.748928e-001, 9.751827e-001, 9.754727e-001, 9.757626e-001, 9.760526e-001, 9.763398e-001, 9.766254e-001, 9.769109e-001,
+9.771965e-001, 9.774820e-001, 9.777676e-001, 9.780532e-001, 9.783387e-001, 9.786193e-001, 9.788996e-001, 9.791798e-001, 9.794600e-001, 9.797403e-001,
+9.800205e-001, 9.803007e-001, 9.805800e-001, 9.808548e-001, 9.811296e-001, 9.814044e-001, 9.816792e-001, 9.819540e-001, 9.822289e-001, 9.825037e-001,
+9.827765e-001, 9.830457e-001, 9.833149e-001, 9.835842e-001, 9.838534e-001, 9.841226e-001, 9.843918e-001, 9.846610e-001, 9.849274e-001, 9.851906e-001,
+9.854537e-001, 9.857169e-001, 9.859800e-001, 9.862432e-001, 9.865063e-001, 9.867695e-001, 9.870293e-001, 9.872861e-001, 9.875429e-001, 9.877997e-001,
+9.880565e-001, 9.883133e-001, 9.885701e-001, 9.888269e-001, 9.890798e-001, 9.893288e-001, 9.895779e-001, 9.898269e-001, 9.900760e-001, 9.903250e-001,
+9.905740e-001, 9.908231e-001, 9.910683e-001, 9.913084e-001, 9.915485e-001, 9.917885e-001, 9.920286e-001, 9.922686e-001, 9.925087e-001, 9.927488e-001,
+9.929867e-001, 9.932189e-001, 9.934511e-001, 9.936833e-001, 9.939156e-001, 9.941478e-001, 9.943800e-001, 9.946122e-001, 9.948438e-001, 9.950651e-001,
+9.952864e-001, 9.955077e-001, 9.957290e-001, 9.959503e-001, 9.961716e-001, 9.963929e-001, 9.966142e-001, 9.968238e-001, 9.970299e-001, 9.972361e-001,
+9.974422e-001, 9.976484e-001, 9.978545e-001, 9.980607e-001, 9.982668e-001, 9.984668e-001, 9.986585e-001, 9.988501e-001, 9.990418e-001, 9.992334e-001,
+9.994251e-001, 9.996167e-001, 9.998084e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.004093e-002, 3.487405e-002, 4.756153e-002, 5.894706e-002, 6.944927e-002, 7.921946e-002, 8.844077e-002, 9.722591e-002, 1.056031e-001,
+1.136254e-001, 1.213366e-001, 1.287464e-001, 1.358782e-001, 1.427361e-001, 1.493203e-001, 1.556663e-001, 1.617785e-001, 1.676822e-001, 1.734001e-001,
+1.789601e-001, 1.843534e-001, 1.895904e-001, 1.946923e-001, 1.996601e-001, 2.045013e-001, 2.092239e-001, 2.138543e-001, 2.183913e-001, 2.228228e-001,
+2.271593e-001, 2.314176e-001, 2.355986e-001, 2.396992e-001, 2.437128e-001, 2.476393e-001, 2.514924e-001, 2.552962e-001, 2.590640e-001, 2.627837e-001,
+2.664473e-001, 2.700595e-001, 2.736193e-001, 2.771342e-001, 2.806042e-001, 2.840266e-001, 2.873997e-001, 2.907201e-001, 2.939863e-001, 2.971969e-001,
+3.003590e-001, 3.034782e-001, 3.065664e-001, 3.096239e-001, 3.126528e-001, 3.156542e-001, 3.186287e-001, 3.215769e-001, 3.244989e-001, 3.273961e-001,
+3.302688e-001, 3.331152e-001, 3.359293e-001, 3.387105e-001, 3.414531e-001, 3.441590e-001, 3.468318e-001, 3.494742e-001, 3.520886e-001, 3.546773e-001,
+3.572409e-001, 3.597825e-001, 3.623044e-001, 3.648074e-001, 3.672929e-001, 3.697636e-001, 3.722182e-001, 3.746535e-001, 3.770718e-001, 3.794744e-001,
+3.818623e-001, 3.842301e-001, 3.865833e-001, 3.889225e-001, 3.912503e-001, 3.935667e-001, 3.958694e-001, 3.981604e-001, 4.004369e-001, 4.026972e-001,
+4.049367e-001, 4.071569e-001, 4.093607e-001, 4.115476e-001, 4.137150e-001, 4.158645e-001, 4.179973e-001, 4.201148e-001, 4.222175e-001, 4.243086e-001,
+4.263896e-001, 4.284595e-001, 4.305212e-001, 4.325712e-001, 4.346115e-001, 4.366434e-001, 4.386653e-001, 4.406722e-001, 4.426657e-001, 4.446469e-001,
+4.466181e-001, 4.485799e-001, 4.505314e-001, 4.524719e-001, 4.544002e-001, 4.563159e-001, 4.582194e-001, 4.601128e-001, 4.619938e-001, 4.638627e-001,
+4.657209e-001, 4.675695e-001, 4.694098e-001, 4.712430e-001, 4.730700e-001, 4.748863e-001, 4.766918e-001, 4.784876e-001, 4.802749e-001, 4.820529e-001,
+4.838209e-001, 4.855782e-001, 4.873236e-001, 4.890566e-001, 4.907775e-001, 4.924885e-001, 4.941891e-001, 4.958810e-001, 4.975647e-001, 4.992408e-001,
+5.009080e-001, 5.025680e-001, 5.042218e-001, 5.058667e-001, 5.075010e-001, 5.091262e-001, 5.107441e-001, 5.123544e-001, 5.139558e-001, 5.155460e-001,
+5.171271e-001, 5.186968e-001, 5.202579e-001, 5.218108e-001, 5.233557e-001, 5.248928e-001, 5.264221e-001, 5.279446e-001, 5.294610e-001, 5.309713e-001,
+5.324716e-001, 5.339646e-001, 5.354511e-001, 5.369304e-001, 5.384037e-001, 5.398699e-001, 5.413285e-001, 5.427761e-001, 5.442144e-001, 5.456464e-001,
+5.470724e-001, 5.484897e-001, 5.499022e-001, 5.513098e-001, 5.527071e-001, 5.540965e-001, 5.554799e-001, 5.568555e-001, 5.582248e-001, 5.595904e-001,
+5.609513e-001, 5.623037e-001, 5.636506e-001, 5.649901e-001, 5.663209e-001, 5.676467e-001, 5.689647e-001, 5.702759e-001, 5.715830e-001, 5.728827e-001,
+5.741753e-001, 5.754633e-001, 5.767428e-001, 5.780189e-001, 5.792913e-001, 5.805559e-001, 5.818174e-001, 5.830736e-001, 5.843229e-001, 5.855685e-001,
+5.868036e-001, 5.880358e-001, 5.892625e-001, 5.904847e-001, 5.917048e-001, 5.929184e-001, 5.941284e-001, 5.953303e-001, 5.965275e-001, 5.977214e-001,
+5.989087e-001, 6.000938e-001, 6.012709e-001, 6.024439e-001, 6.036102e-001, 6.047713e-001, 6.059292e-001, 6.070817e-001, 6.082328e-001, 6.093747e-001,
+6.105144e-001, 6.116470e-001, 6.127761e-001, 6.139001e-001, 6.150193e-001, 6.161350e-001, 6.172463e-001, 6.183557e-001, 6.194601e-001, 6.205636e-001,
+6.216604e-001, 6.227564e-001, 6.238447e-001, 6.249316e-001, 6.260104e-001, 6.270870e-001, 6.281552e-001, 6.292213e-001, 6.302811e-001, 6.313391e-001,
+6.323928e-001, 6.334443e-001, 6.344907e-001, 6.355344e-001, 6.365722e-001, 6.376072e-001, 6.386353e-001, 6.396615e-001, 6.406822e-001, 6.417014e-001,
+6.427151e-001, 6.437278e-001, 6.447338e-001, 6.457393e-001, 6.467369e-001, 6.477345e-001, 6.487230e-001, 6.497110e-001, 6.506904e-001, 6.516681e-001,
+6.526402e-001, 6.536098e-001, 6.545764e-001, 6.555403e-001, 6.565019e-001, 6.574596e-001, 6.584159e-001, 6.593660e-001, 6.603162e-001, 6.612583e-001,
+6.622002e-001, 6.631376e-001, 6.640735e-001, 6.650068e-001, 6.659374e-001, 6.668659e-001, 6.677879e-001, 6.687099e-001, 6.696241e-001, 6.705380e-001,
+6.714470e-001, 6.723536e-001, 6.732575e-001, 6.741562e-001, 6.750550e-001, 6.759482e-001, 6.768414e-001, 6.777299e-001, 6.786159e-001, 6.794993e-001,
+6.803759e-001, 6.812524e-001, 6.821228e-001, 6.829923e-001, 6.838590e-001, 6.847224e-001, 6.855857e-001, 6.864398e-001, 6.872939e-001, 6.881433e-001,
+6.889890e-001, 6.898341e-001, 6.906723e-001, 6.915106e-001, 6.923443e-001, 6.931748e-001, 6.940048e-001, 6.948273e-001, 6.956499e-001, 6.964680e-001,
+6.972820e-001, 6.980959e-001, 6.989029e-001, 6.997096e-001, 7.005148e-001, 7.013175e-001, 7.021203e-001, 7.029188e-001, 7.037160e-001, 7.045123e-001,
+7.053028e-001, 7.060933e-001, 7.068814e-001, 7.076671e-001, 7.084527e-001, 7.092331e-001, 7.100123e-001, 7.107906e-001, 7.115623e-001, 7.123340e-001,
+7.131033e-001, 7.138692e-001, 7.146352e-001, 7.153963e-001, 7.161550e-001, 7.169137e-001, 7.176670e-001, 7.184198e-001, 7.191723e-001, 7.199227e-001,
+7.206731e-001, 7.214214e-001, 7.221655e-001, 7.229096e-001, 7.236498e-001, 7.243861e-001, 7.251224e-001, 7.258552e-001, 7.265861e-001, 7.273171e-001,
+7.280430e-001, 7.287674e-001, 7.294919e-001, 7.302093e-001, 7.309257e-001, 7.316422e-001, 7.323533e-001, 7.330642e-001, 7.337751e-001, 7.344793e-001,
+7.351835e-001, 7.358874e-001, 7.365834e-001, 7.372794e-001, 7.379752e-001, 7.386654e-001, 7.393557e-001, 7.400458e-001, 7.407315e-001, 7.414172e-001,
+7.421028e-001, 7.427842e-001, 7.434653e-001, 7.441465e-001, 7.448238e-001, 7.455007e-001, 7.461775e-001, 7.468508e-001, 7.475232e-001, 7.481956e-001,
+7.488650e-001, 7.495330e-001, 7.502010e-001, 7.508668e-001, 7.515306e-001, 7.521943e-001, 7.528566e-001, 7.535159e-001, 7.541753e-001, 7.548338e-001,
+7.554877e-001, 7.561415e-001, 7.567954e-001, 7.574435e-001, 7.580911e-001, 7.587388e-001, 7.593836e-001, 7.600270e-001, 7.606704e-001, 7.613118e-001,
+7.619500e-001, 7.625881e-001, 7.632259e-001, 7.638580e-001, 7.644902e-001, 7.651224e-001, 7.657516e-001, 7.663798e-001, 7.670079e-001, 7.676342e-001,
+7.682573e-001, 7.688804e-001, 7.695035e-001, 7.701198e-001, 7.707360e-001, 7.713522e-001, 7.719651e-001, 7.725753e-001, 7.731856e-001, 7.737953e-001,
+7.744010e-001, 7.750066e-001, 7.756122e-001, 7.762138e-001, 7.768129e-001, 7.774121e-001, 7.780106e-001, 7.786043e-001, 7.791980e-001, 7.797916e-001,
+7.803829e-001, 7.809723e-001, 7.815618e-001, 7.821511e-001, 7.827334e-001, 7.833157e-001, 7.838980e-001, 7.844783e-001, 7.850559e-001, 7.856335e-001,
+7.862111e-001, 7.867868e-001, 7.873621e-001, 7.879373e-001, 7.885117e-001, 7.890805e-001, 7.896494e-001, 7.902182e-001, 7.907847e-001, 7.913484e-001,
+7.919120e-001, 7.924757e-001, 7.930367e-001, 7.935967e-001, 7.941567e-001, 7.947167e-001, 7.952712e-001, 7.958258e-001, 7.963803e-001, 7.969337e-001,
+7.974828e-001, 7.980320e-001, 7.985811e-001, 7.991284e-001, 7.996730e-001, 8.002175e-001, 8.007620e-001, 8.013040e-001, 8.018441e-001, 8.023842e-001,
+8.029243e-001, 8.034614e-001, 8.039971e-001, 8.045328e-001, 8.050686e-001, 8.056015e-001, 8.061336e-001, 8.066657e-001, 8.071978e-001, 8.077270e-001,
+8.082557e-001, 8.087844e-001, 8.093131e-001, 8.098370e-001, 8.103603e-001, 8.108836e-001, 8.114069e-001, 8.119258e-001, 8.124441e-001, 8.129623e-001,
+8.134806e-001, 8.139952e-001, 8.145090e-001, 8.150228e-001, 8.155366e-001, 8.160470e-001, 8.165564e-001, 8.170659e-001, 8.175753e-001, 8.180813e-001,
+8.185857e-001, 8.190901e-001, 8.195945e-001, 8.200961e-001, 8.205952e-001, 8.210943e-001, 8.215934e-001, 8.220913e-001, 8.225871e-001, 8.230829e-001,
+8.235787e-001, 8.240739e-001, 8.245658e-001, 8.250577e-001, 8.255496e-001, 8.260415e-001, 8.265285e-001, 8.270152e-001, 8.275018e-001, 8.279885e-001,
+8.284725e-001, 8.289551e-001, 8.294378e-001, 8.299204e-001, 8.304021e-001, 8.308821e-001, 8.313620e-001, 8.318419e-001, 8.323219e-001, 8.327969e-001,
+8.332718e-001, 8.337467e-001, 8.342216e-001, 8.346939e-001, 8.351643e-001, 8.356347e-001, 8.361051e-001, 8.365753e-001, 8.370444e-001, 8.375134e-001,
+8.379824e-001, 8.384515e-001, 8.389179e-001, 8.393832e-001, 8.398486e-001, 8.403139e-001, 8.407779e-001, 8.412373e-001, 8.416966e-001, 8.421560e-001,
+8.426154e-001, 8.430727e-001, 8.435291e-001, 8.439856e-001, 8.444420e-001, 8.448981e-001, 8.453522e-001, 8.458062e-001, 8.462603e-001, 8.467144e-001,
+8.471655e-001, 8.476140e-001, 8.480624e-001, 8.485109e-001, 8.489594e-001, 8.494049e-001, 8.498501e-001, 8.502953e-001, 8.507405e-001, 8.511855e-001,
+8.516297e-001, 8.520739e-001, 8.525181e-001, 8.529623e-001, 8.534045e-001, 8.538445e-001, 8.542845e-001, 8.547246e-001, 8.551646e-001, 8.556007e-001,
+8.560351e-001, 8.564695e-001, 8.569040e-001, 8.573384e-001, 8.577692e-001, 8.581997e-001, 8.586302e-001, 8.590606e-001, 8.594909e-001, 8.599187e-001,
+8.603465e-001, 8.607743e-001, 8.612021e-001, 8.616291e-001, 8.620529e-001, 8.624767e-001, 8.629005e-001, 8.633242e-001, 8.637471e-001, 8.641674e-001,
+8.645878e-001, 8.650081e-001, 8.654284e-001, 8.658479e-001, 8.662654e-001, 8.666829e-001, 8.671004e-001, 8.675179e-001, 8.679342e-001, 8.683476e-001,
+8.687611e-001, 8.691745e-001, 8.695879e-001, 8.700003e-001, 8.704100e-001, 8.708197e-001, 8.712294e-001, 8.716391e-001, 8.720482e-001, 8.724551e-001,
+8.728619e-001, 8.732687e-001, 8.736755e-001, 8.740822e-001, 8.744865e-001, 8.748908e-001, 8.752951e-001, 8.756993e-001, 8.761036e-001, 8.765046e-001,
+8.769050e-001, 8.773054e-001, 8.777058e-001, 8.781062e-001, 8.785045e-001, 8.789016e-001, 8.792987e-001, 8.796958e-001, 8.800930e-001, 8.804891e-001,
+8.808836e-001, 8.812780e-001, 8.816725e-001, 8.820670e-001, 8.824611e-001, 8.828517e-001, 8.832423e-001, 8.836329e-001, 8.840234e-001, 8.844140e-001,
+8.848019e-001, 8.851889e-001, 8.855759e-001, 8.859630e-001, 8.863500e-001, 8.867360e-001, 8.871203e-001, 8.875045e-001, 8.878888e-001, 8.882731e-001,
+8.886574e-001, 8.890394e-001, 8.894213e-001, 8.898032e-001, 8.901851e-001, 8.905669e-001, 8.909479e-001, 8.913277e-001, 8.917075e-001, 8.920873e-001,
+8.924671e-001, 8.928470e-001, 8.932240e-001, 8.936009e-001, 8.939777e-001, 8.943546e-001, 8.947314e-001, 8.951069e-001, 8.954799e-001, 8.958530e-001,
+8.962260e-001, 8.965990e-001, 8.969720e-001, 8.973435e-001, 8.977146e-001, 8.980856e-001, 8.984567e-001, 8.988277e-001, 8.991986e-001, 8.995674e-001,
+8.999362e-001, 9.003050e-001, 9.006738e-001, 9.010426e-001, 9.014103e-001, 9.017760e-001, 9.021417e-001, 9.025074e-001, 9.028731e-001, 9.032388e-001,
+9.036025e-001, 9.039648e-001, 9.043271e-001, 9.046894e-001, 9.050518e-001, 9.054141e-001, 9.057752e-001, 9.061360e-001, 9.064969e-001, 9.068577e-001,
+9.072185e-001, 9.075793e-001, 9.079379e-001, 9.082963e-001, 9.086548e-001, 9.090132e-001, 9.093717e-001, 9.097300e-001, 9.100852e-001, 9.104404e-001,
+9.107956e-001, 9.111509e-001, 9.115061e-001, 9.118612e-001, 9.122150e-001, 9.125688e-001, 9.129226e-001, 9.132764e-001, 9.136302e-001, 9.139838e-001,
+9.143360e-001, 9.146881e-001, 9.150402e-001, 9.153923e-001, 9.157444e-001, 9.160964e-001, 9.164452e-001, 9.167940e-001, 9.171428e-001, 9.174916e-001,
+9.178404e-001, 9.181892e-001, 9.185342e-001, 9.188788e-001, 9.192235e-001, 9.195681e-001, 9.199128e-001, 9.202574e-001, 9.206014e-001, 9.209452e-001,
+9.212889e-001, 9.216327e-001, 9.219765e-001, 9.223202e-001, 9.226630e-001, 9.230050e-001, 9.233471e-001, 9.236891e-001, 9.240311e-001, 9.243732e-001,
+9.247142e-001, 9.250529e-001, 9.253916e-001, 9.257303e-001, 9.260690e-001, 9.264077e-001, 9.267463e-001, 9.270829e-001, 9.274195e-001, 9.277560e-001,
+9.280926e-001, 9.284292e-001, 9.287657e-001, 9.291017e-001, 9.294373e-001, 9.297729e-001, 9.301085e-001, 9.304441e-001, 9.307797e-001, 9.311147e-001,
+9.314478e-001, 9.317809e-001, 9.321139e-001, 9.324470e-001, 9.327801e-001, 9.331132e-001, 9.334436e-001, 9.337734e-001, 9.341031e-001, 9.344329e-001,
+9.347626e-001, 9.350924e-001, 9.354220e-001, 9.357516e-001, 9.360811e-001, 9.364106e-001, 9.367401e-001, 9.370697e-001, 9.373992e-001, 9.377280e-001,
+9.380565e-001, 9.383850e-001, 9.387135e-001, 9.390420e-001, 9.393705e-001, 9.396988e-001, 9.400240e-001, 9.403492e-001, 9.406743e-001, 9.409995e-001,
+9.413247e-001, 9.416499e-001, 9.419735e-001, 9.422946e-001, 9.426157e-001, 9.429368e-001, 9.432580e-001, 9.435791e-001, 9.439002e-001, 9.442206e-001,
+9.445407e-001, 9.448608e-001, 9.451809e-001, 9.455009e-001, 9.458210e-001, 9.461411e-001, 9.464596e-001, 9.467779e-001, 9.470962e-001, 9.474144e-001,
+9.477327e-001, 9.480510e-001, 9.483692e-001, 9.486842e-001, 9.489991e-001, 9.493141e-001, 9.496291e-001, 9.499440e-001, 9.502590e-001, 9.505737e-001,
+9.508865e-001, 9.511992e-001, 9.515120e-001, 9.518248e-001, 9.521375e-001, 9.524503e-001, 9.527629e-001, 9.530745e-001, 9.533862e-001, 9.536978e-001,
+9.540095e-001, 9.543211e-001, 9.546328e-001, 9.549442e-001, 9.552533e-001, 9.555623e-001, 9.558714e-001, 9.561805e-001, 9.564896e-001, 9.567987e-001,
+9.571076e-001, 9.574113e-001, 9.577150e-001, 9.580188e-001, 9.583225e-001, 9.586262e-001, 9.589299e-001, 9.592336e-001, 9.595325e-001, 9.598309e-001,
+9.601292e-001, 9.604276e-001, 9.607260e-001, 9.610243e-001, 9.613227e-001, 9.616187e-001, 9.619138e-001, 9.622088e-001, 9.625038e-001, 9.627989e-001,
+9.630939e-001, 9.633889e-001, 9.636828e-001, 9.639752e-001, 9.642676e-001, 9.645599e-001, 9.648523e-001, 9.651447e-001, 9.654371e-001, 9.657291e-001,
+9.660188e-001, 9.663084e-001, 9.665981e-001, 9.668878e-001, 9.671774e-001, 9.674671e-001, 9.677568e-001, 9.680449e-001, 9.683324e-001, 9.686200e-001,
+9.689075e-001, 9.691951e-001, 9.694827e-001, 9.697702e-001, 9.700570e-001, 9.703419e-001, 9.706268e-001, 9.709117e-001, 9.711966e-001, 9.714814e-001,
+9.717663e-001, 9.720512e-001, 9.723332e-001, 9.726145e-001, 9.728958e-001, 9.731771e-001, 9.734583e-001, 9.737396e-001, 9.740209e-001, 9.743015e-001,
+9.745800e-001, 9.748586e-001, 9.751371e-001, 9.754156e-001, 9.756941e-001, 9.759727e-001, 9.762512e-001, 9.765279e-001, 9.768033e-001, 9.770788e-001,
+9.773542e-001, 9.776297e-001, 9.779051e-001, 9.781806e-001, 9.784560e-001, 9.787277e-001, 9.789991e-001, 9.792704e-001, 9.795418e-001, 9.798131e-001,
+9.800845e-001, 9.803558e-001, 9.806264e-001, 9.808933e-001, 9.811602e-001, 9.814271e-001, 9.816940e-001, 9.819609e-001, 9.822278e-001, 9.824947e-001,
+9.827602e-001, 9.830228e-001, 9.832855e-001, 9.835482e-001, 9.838109e-001, 9.840735e-001, 9.843362e-001, 9.845989e-001, 9.848592e-001, 9.851168e-001,
+9.853744e-001, 9.856320e-001, 9.858896e-001, 9.861472e-001, 9.864049e-001, 9.866625e-001, 9.869173e-001, 9.871696e-001, 9.874219e-001, 9.876742e-001,
+9.879265e-001, 9.881788e-001, 9.884311e-001, 9.886834e-001, 9.889330e-001, 9.891800e-001, 9.894269e-001, 9.896739e-001, 9.899208e-001, 9.901677e-001,
+9.904147e-001, 9.906616e-001, 9.909056e-001, 9.911455e-001, 9.913855e-001, 9.916254e-001, 9.918653e-001, 9.921053e-001, 9.923452e-001, 9.925852e-001,
+9.928229e-001, 9.930546e-001, 9.932864e-001, 9.935181e-001, 9.937499e-001, 9.939817e-001, 9.942134e-001, 9.944452e-001, 9.946766e-001, 9.949021e-001,
+9.951275e-001, 9.953530e-001, 9.955784e-001, 9.958039e-001, 9.960294e-001, 9.962548e-001, 9.964803e-001, 9.966976e-001, 9.969126e-001, 9.971276e-001,
+9.973426e-001, 9.975575e-001, 9.977725e-001, 9.979875e-001, 9.982025e-001, 9.984106e-001, 9.986093e-001, 9.988079e-001, 9.990066e-001, 9.992053e-001,
+9.994040e-001, 9.996026e-001, 9.998013e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.400673e-002, 2.587493e-002, 3.621518e-002, 4.561099e-002, 5.432366e-002, 6.250151e-002, 7.022297e-002, 7.757194e-002, 8.460387e-002,
+9.130835e-002, 9.774279e-002, 1.039230e-001, 1.098599e-001, 1.155802e-001, 1.211000e-001, 1.264265e-001, 1.315815e-001, 1.365823e-001, 1.414559e-001,
+1.462169e-001, 1.508775e-001, 1.554277e-001, 1.598817e-001, 1.642391e-001, 1.684960e-001, 1.726709e-001, 1.767773e-001, 1.808128e-001, 1.847777e-001,
+1.886794e-001, 1.925253e-001, 1.963074e-001, 2.000353e-001, 2.036948e-001, 2.072976e-001, 2.108584e-001, 2.143703e-001, 2.178401e-001, 2.212640e-001,
+2.246435e-001, 2.279828e-001, 2.312769e-001, 2.345380e-001, 2.377575e-001, 2.409394e-001, 2.440892e-001, 2.471970e-001, 2.502730e-001, 2.533178e-001,
+2.563329e-001, 2.593178e-001, 2.622712e-001, 2.652003e-001, 2.681050e-001, 2.709784e-001, 2.738296e-001, 2.766566e-001, 2.794563e-001, 2.822302e-001,
+2.849779e-001, 2.877022e-001, 2.903992e-001, 2.930696e-001, 2.957195e-001, 2.983431e-001, 3.009460e-001, 3.035287e-001, 3.060950e-001, 3.086442e-001,
+3.111701e-001, 3.136737e-001, 3.161569e-001, 3.186242e-001, 3.210709e-001, 3.234997e-001, 3.259126e-001, 3.283079e-001, 3.306862e-001, 3.330460e-001,
+3.353869e-001, 3.377087e-001, 3.400175e-001, 3.423081e-001, 3.445838e-001, 3.468438e-001, 3.490907e-001, 3.513232e-001, 3.535391e-001, 3.557423e-001,
+3.579296e-001, 3.600992e-001, 3.622540e-001, 3.643928e-001, 3.665145e-001, 3.686215e-001, 3.707145e-001, 3.727920e-001, 3.748529e-001, 3.768979e-001,
+3.789266e-001, 3.809397e-001, 3.829381e-001, 3.849215e-001, 3.868897e-001, 3.888422e-001, 3.907818e-001, 3.927083e-001, 3.946214e-001, 3.965216e-001,
+3.984086e-001, 4.002823e-001, 4.021425e-001, 4.039890e-001, 4.058243e-001, 4.076485e-001, 4.094625e-001, 4.112652e-001, 4.130575e-001, 4.148383e-001,
+4.166126e-001, 4.183782e-001, 4.201379e-001, 4.218889e-001, 4.236342e-001, 4.253711e-001, 4.271023e-001, 4.288256e-001, 4.305430e-001, 4.322530e-001,
+4.339570e-001, 4.356541e-001, 4.373449e-001, 4.390296e-001, 4.407074e-001, 4.423801e-001, 4.440453e-001, 4.457054e-001, 4.473579e-001, 4.490056e-001,
+4.506457e-001, 4.522779e-001, 4.539025e-001, 4.555190e-001, 4.571281e-001, 4.587262e-001, 4.603150e-001, 4.618948e-001, 4.634658e-001, 4.650284e-001,
+4.665810e-001, 4.681252e-001, 4.696618e-001, 4.711912e-001, 4.727137e-001, 4.742274e-001, 4.757342e-001, 4.772349e-001, 4.787296e-001, 4.802175e-001,
+4.816986e-001, 4.831735e-001, 4.846417e-001, 4.861015e-001, 4.875538e-001, 4.889999e-001, 4.904399e-001, 4.918714e-001, 4.932935e-001, 4.947095e-001,
+4.961201e-001, 4.975199e-001, 4.989153e-001, 5.003060e-001, 5.016881e-001, 5.030658e-001, 5.044390e-001, 5.058041e-001, 5.071627e-001, 5.085165e-001,
+5.098641e-001, 5.112057e-001, 5.125435e-001, 5.138760e-001, 5.152037e-001, 5.165278e-001, 5.178461e-001, 5.191585e-001, 5.204677e-001, 5.217715e-001,
+5.230713e-001, 5.243686e-001, 5.256612e-001, 5.269506e-001, 5.282369e-001, 5.295171e-001, 5.307944e-001, 5.320663e-001, 5.333335e-001, 5.345983e-001,
+5.358552e-001, 5.371090e-001, 5.383574e-001, 5.395993e-001, 5.408381e-001, 5.420668e-001, 5.432921e-001, 5.445101e-001, 5.457228e-001, 5.469322e-001,
+5.481335e-001, 5.493328e-001, 5.505263e-001, 5.517168e-001, 5.529029e-001, 5.540846e-001, 5.552638e-001, 5.564357e-001, 5.576060e-001, 5.587717e-001,
+5.599353e-001, 5.610928e-001, 5.622478e-001, 5.633995e-001, 5.645475e-001, 5.656931e-001, 5.668336e-001, 5.679724e-001, 5.691047e-001, 5.702360e-001,
+5.713597e-001, 5.724829e-001, 5.736011e-001, 5.747177e-001, 5.758257e-001, 5.769320e-001, 5.780322e-001, 5.791301e-001, 5.802221e-001, 5.813123e-001,
+5.823985e-001, 5.834822e-001, 5.845606e-001, 5.856365e-001, 5.867068e-001, 5.877747e-001, 5.888371e-001, 5.898971e-001, 5.909510e-001, 5.920032e-001,
+5.930498e-001, 5.940951e-001, 5.951338e-001, 5.961719e-001, 5.972028e-001, 5.982337e-001, 5.992593e-001, 6.002849e-001, 6.013045e-001, 6.023232e-001,
+6.033358e-001, 6.043461e-001, 6.053529e-001, 6.063571e-001, 6.073590e-001, 6.083571e-001, 6.093542e-001, 6.103471e-001, 6.113400e-001, 6.123252e-001,
+6.133104e-001, 6.142895e-001, 6.152668e-001, 6.162406e-001, 6.172113e-001, 6.181805e-001, 6.191458e-001, 6.201111e-001, 6.210708e-001, 6.220305e-001,
+6.229835e-001, 6.239335e-001, 6.248810e-001, 6.258240e-001, 6.267668e-001, 6.277028e-001, 6.286388e-001, 6.295702e-001, 6.304992e-001, 6.314261e-001,
+6.323479e-001, 6.332696e-001, 6.341839e-001, 6.350972e-001, 6.360073e-001, 6.369137e-001, 6.378198e-001, 6.387205e-001, 6.396213e-001, 6.405188e-001,
+6.414140e-001, 6.423082e-001, 6.431942e-001, 6.440802e-001, 6.449622e-001, 6.458414e-001, 6.467202e-001, 6.475932e-001, 6.484662e-001, 6.493358e-001,
+6.502026e-001, 6.510693e-001, 6.519300e-001, 6.527906e-001, 6.536483e-001, 6.545017e-001, 6.553551e-001, 6.562040e-001, 6.570516e-001, 6.578982e-001,
+6.587392e-001, 6.595802e-001, 6.604183e-001, 6.612537e-001, 6.620890e-001, 6.629181e-001, 6.637460e-001, 6.645728e-001, 6.653936e-001, 6.662143e-001,
+6.670326e-001, 6.678476e-001, 6.686627e-001, 6.694739e-001, 6.702835e-001, 6.710931e-001, 6.718968e-001, 6.727002e-001, 6.735024e-001, 6.742987e-001,
+6.750949e-001, 6.758888e-001, 6.766783e-001, 6.774678e-001, 6.782538e-001, 6.790367e-001, 6.798196e-001, 6.805975e-001, 6.813730e-001, 6.821485e-001,
+6.829196e-001, 6.836894e-001, 6.844593e-001, 6.852233e-001, 6.859867e-001, 6.867500e-001, 6.875083e-001, 6.882664e-001, 6.890244e-001, 6.897757e-001,
+6.905270e-001, 6.912780e-001, 6.920228e-001, 6.927676e-001, 6.935121e-001, 6.942509e-001, 6.949897e-001, 6.957282e-001, 6.964604e-001, 6.971926e-001,
+6.979247e-001, 6.986520e-001, 6.993792e-001, 7.001065e-001, 7.008287e-001, 7.015504e-001, 7.022721e-001, 7.029897e-001, 7.037063e-001, 7.044230e-001,
+7.051363e-001, 7.058482e-001, 7.065600e-001, 7.072690e-001, 7.079756e-001, 7.086822e-001, 7.093874e-001, 7.100904e-001, 7.107934e-001, 7.114954e-001,
+7.121930e-001, 7.128906e-001, 7.135882e-001, 7.142793e-001, 7.149698e-001, 7.156604e-001, 7.163474e-001, 7.170326e-001, 7.177178e-001, 7.184011e-001,
+7.190815e-001, 7.197619e-001, 7.204418e-001, 7.211170e-001, 7.217923e-001, 7.224675e-001, 7.231384e-001, 7.238080e-001, 7.244775e-001, 7.251447e-001,
+7.258081e-001, 7.264715e-001, 7.271348e-001, 7.277917e-001, 7.284486e-001, 7.291054e-001, 7.297595e-001, 7.304114e-001, 7.310634e-001, 7.317148e-001,
+7.323617e-001, 7.330087e-001, 7.336557e-001, 7.342997e-001, 7.349420e-001, 7.355844e-001, 7.362261e-001, 7.368643e-001, 7.375025e-001, 7.381407e-001,
+7.387762e-001, 7.394099e-001, 7.400436e-001, 7.406772e-001, 7.413081e-001, 7.419390e-001, 7.425699e-001, 7.431990e-001, 7.438257e-001, 7.444525e-001,
+7.450792e-001, 7.457014e-001, 7.463225e-001, 7.469436e-001, 7.475641e-001, 7.481813e-001, 7.487985e-001, 7.494156e-001, 7.500312e-001, 7.506451e-001,
+7.512589e-001, 7.518728e-001, 7.524825e-001, 7.530908e-001, 7.536991e-001, 7.543073e-001, 7.549107e-001, 7.555141e-001, 7.561174e-001, 7.567198e-001,
+7.573189e-001, 7.579179e-001, 7.585170e-001, 7.591142e-001, 7.597088e-001, 7.603034e-001, 7.608979e-001, 7.614898e-001, 7.620798e-001, 7.626697e-001,
+7.632596e-001, 7.638460e-001, 7.644308e-001, 7.650157e-001, 7.656006e-001, 7.661812e-001, 7.667608e-001, 7.673404e-001, 7.679200e-001, 7.684965e-001,
+7.690726e-001, 7.696486e-001, 7.702247e-001, 7.707966e-001, 7.713679e-001, 7.719393e-001, 7.725106e-001, 7.730767e-001, 7.736421e-001, 7.742076e-001,
+7.747730e-001, 7.753349e-001, 7.758961e-001, 7.764574e-001, 7.770186e-001, 7.775772e-001, 7.781350e-001, 7.786928e-001, 7.792506e-001, 7.798048e-001,
+7.803573e-001, 7.809099e-001, 7.814624e-001, 7.820123e-001, 7.825602e-001, 7.831080e-001, 7.836558e-001, 7.842022e-001, 7.847461e-001, 7.852900e-001,
+7.858339e-001, 7.863768e-001, 7.869150e-001, 7.874531e-001, 7.879913e-001, 7.885295e-001, 7.890629e-001, 7.895959e-001, 7.901289e-001, 7.906619e-001,
+7.911921e-001, 7.917207e-001, 7.922493e-001, 7.927779e-001, 7.933051e-001, 7.938293e-001, 7.943535e-001, 7.948777e-001, 7.954019e-001, 7.959235e-001,
+7.964450e-001, 7.969665e-001, 7.974881e-001, 7.980074e-001, 7.985253e-001, 7.990433e-001, 7.995612e-001, 8.000785e-001, 8.005927e-001, 8.011070e-001,
+8.016213e-001, 8.021356e-001, 8.026489e-001, 8.031619e-001, 8.036749e-001, 8.041879e-001, 8.047002e-001, 8.052102e-001, 8.057203e-001, 8.062303e-001,
+8.067403e-001, 8.072487e-001, 8.077564e-001, 8.082641e-001, 8.087717e-001, 8.092792e-001, 8.097851e-001, 8.102910e-001, 8.107969e-001, 8.113028e-001,
+8.118069e-001, 8.123093e-001, 8.128118e-001, 8.133143e-001, 8.138168e-001, 8.143168e-001, 8.148164e-001, 8.153160e-001, 8.158157e-001, 8.163149e-001,
+8.168123e-001, 8.173096e-001, 8.178070e-001, 8.183044e-001, 8.187999e-001, 8.192934e-001, 8.197870e-001, 8.202805e-001, 8.207740e-001, 8.212651e-001,
+8.217553e-001, 8.222455e-001, 8.227357e-001, 8.232259e-001, 8.237136e-001, 8.242010e-001, 8.246885e-001, 8.251760e-001, 8.256632e-001, 8.261480e-001,
+8.266328e-001, 8.271176e-001, 8.276024e-001, 8.280870e-001, 8.285708e-001, 8.290545e-001, 8.295382e-001, 8.300219e-001, 8.305051e-001, 8.309868e-001,
+8.314685e-001, 8.319502e-001, 8.324319e-001, 8.329127e-001, 8.333915e-001, 8.338704e-001, 8.343492e-001, 8.348280e-001, 8.353064e-001, 8.357839e-001,
+8.362614e-001, 8.367389e-001, 8.372164e-001, 8.376933e-001, 8.381686e-001, 8.386438e-001, 8.391191e-001, 8.395944e-001, 8.400691e-001, 8.405413e-001,
+8.410135e-001, 8.414857e-001, 8.419578e-001, 8.424300e-001, 8.429006e-001, 8.433712e-001, 8.438418e-001, 8.443125e-001, 8.447831e-001, 8.452516e-001,
+8.457198e-001, 8.461880e-001, 8.466562e-001, 8.471244e-001, 8.475905e-001, 8.480554e-001, 8.485203e-001, 8.489853e-001, 8.494502e-001, 8.499144e-001,
+8.503776e-001, 8.508408e-001, 8.513039e-001, 8.517671e-001, 8.522300e-001, 8.526905e-001, 8.531511e-001, 8.536116e-001, 8.540722e-001, 8.545327e-001,
+8.549907e-001, 8.554478e-001, 8.559049e-001, 8.563620e-001, 8.568191e-001, 8.572754e-001, 8.577305e-001, 8.581857e-001, 8.586408e-001, 8.590959e-001,
+8.595510e-001, 8.600043e-001, 8.604575e-001, 8.609106e-001, 8.613638e-001, 8.618170e-001, 8.622695e-001, 8.627213e-001, 8.631731e-001, 8.636249e-001,
+8.640767e-001, 8.645285e-001, 8.649795e-001, 8.654304e-001, 8.658813e-001, 8.663322e-001, 8.667832e-001, 8.672332e-001, 8.676818e-001, 8.681303e-001,
+8.685788e-001, 8.690273e-001, 8.694759e-001, 8.699231e-001, 8.703698e-001, 8.708165e-001, 8.712632e-001, 8.717099e-001, 8.721565e-001, 8.726019e-001,
+8.730472e-001, 8.734926e-001, 8.739380e-001, 8.743834e-001, 8.748277e-001, 8.752703e-001, 8.757129e-001, 8.761555e-001, 8.765981e-001, 8.770406e-001,
+8.774818e-001, 8.779222e-001, 8.783625e-001, 8.788028e-001, 8.792431e-001, 8.796834e-001, 8.801223e-001, 8.805609e-001, 8.809995e-001, 8.814380e-001,
+8.818766e-001, 8.823152e-001, 8.827507e-001, 8.831861e-001, 8.836215e-001, 8.840568e-001, 8.844922e-001, 8.849275e-001, 8.853602e-001, 8.857929e-001,
+8.862256e-001, 8.866582e-001, 8.870909e-001, 8.875234e-001, 8.879540e-001, 8.883845e-001, 8.888150e-001, 8.892456e-001, 8.896761e-001, 8.901063e-001,
+8.905333e-001, 8.909603e-001, 8.913873e-001, 8.918142e-001, 8.922412e-001, 8.926680e-001, 8.930919e-001, 8.935158e-001, 8.939397e-001, 8.943636e-001,
+8.947875e-001, 8.952114e-001, 8.956336e-001, 8.960558e-001, 8.964779e-001, 8.969001e-001, 8.973222e-001, 8.977444e-001, 8.981651e-001, 8.985854e-001,
+8.990057e-001, 8.994260e-001, 8.998464e-001, 9.002667e-001, 9.006865e-001, 9.011060e-001, 9.015254e-001, 9.019449e-001, 9.023644e-001, 9.027838e-001,
+9.032028e-001, 9.036208e-001, 9.040387e-001, 9.044567e-001, 9.048747e-001, 9.052926e-001, 9.057106e-001, 9.061276e-001, 9.065447e-001, 9.069617e-001,
+9.073788e-001, 9.077958e-001, 9.082128e-001, 9.086295e-001, 9.090461e-001, 9.094626e-001, 9.098792e-001, 9.102957e-001, 9.107123e-001, 9.111283e-001,
+9.115430e-001, 9.119576e-001, 9.123723e-001, 9.127869e-001, 9.132016e-001, 9.136162e-001, 9.140298e-001, 9.144431e-001, 9.148564e-001, 9.152697e-001,
+9.156830e-001, 9.160963e-001, 9.165095e-001, 9.169227e-001, 9.173358e-001, 9.177490e-001, 9.181622e-001, 9.185753e-001, 9.189885e-001, 9.194010e-001,
+9.198131e-001, 9.202253e-001, 9.206375e-001, 9.210496e-001, 9.214618e-001, 9.218738e-001, 9.222841e-001, 9.226944e-001, 9.231047e-001, 9.235150e-001,
+9.239253e-001, 9.243356e-001, 9.247456e-001, 9.251552e-001, 9.255649e-001, 9.259745e-001, 9.263841e-001, 9.267938e-001, 9.272034e-001, 9.276125e-001,
+9.280213e-001, 9.284301e-001, 9.288390e-001, 9.292478e-001, 9.296566e-001, 9.300655e-001, 9.304733e-001, 9.308810e-001, 9.312887e-001, 9.316964e-001,
+9.321041e-001, 9.325118e-001, 9.329195e-001, 9.333260e-001, 9.337324e-001, 9.341389e-001, 9.345453e-001, 9.349518e-001, 9.353582e-001, 9.357645e-001,
+9.361696e-001, 9.365746e-001, 9.369797e-001, 9.373848e-001, 9.377898e-001, 9.381949e-001, 9.385995e-001, 9.390019e-001, 9.394042e-001, 9.398065e-001,
+9.402088e-001, 9.406112e-001, 9.410135e-001, 9.414152e-001, 9.418126e-001, 9.422100e-001, 9.426074e-001, 9.430048e-001, 9.434022e-001, 9.437995e-001,
+9.441967e-001, 9.445887e-001, 9.449806e-001, 9.453725e-001, 9.457644e-001, 9.461563e-001, 9.465482e-001, 9.469401e-001, 9.473283e-001, 9.477160e-001,
+9.481037e-001, 9.484915e-001, 9.488792e-001, 9.492670e-001, 9.496547e-001, 9.500410e-001, 9.504267e-001, 9.508125e-001, 9.511982e-001, 9.515839e-001,
+9.519696e-001, 9.523554e-001, 9.527398e-001, 9.531226e-001, 9.535054e-001, 9.538881e-001, 9.542709e-001, 9.546537e-001, 9.550365e-001, 9.554189e-001,
+9.557983e-001, 9.561778e-001, 9.565573e-001, 9.569367e-001, 9.573162e-001, 9.576957e-001, 9.580751e-001, 9.584523e-001, 9.588287e-001, 9.592051e-001,
+9.595815e-001, 9.599579e-001, 9.603342e-001, 9.607106e-001, 9.610859e-001, 9.614585e-001, 9.618311e-001, 9.622037e-001, 9.625763e-001, 9.629489e-001,
+9.633215e-001, 9.636941e-001, 9.640635e-001, 9.644322e-001, 9.648009e-001, 9.651695e-001, 9.655382e-001, 9.659068e-001, 9.662755e-001, 9.666433e-001,
+9.670084e-001, 9.673734e-001, 9.677385e-001, 9.681035e-001, 9.684686e-001, 9.688336e-001, 9.691987e-001, 9.695615e-001, 9.699230e-001, 9.702845e-001,
+9.706460e-001, 9.710075e-001, 9.713690e-001, 9.717305e-001, 9.720919e-001, 9.724497e-001, 9.728072e-001, 9.731647e-001, 9.735221e-001, 9.738796e-001,
+9.742371e-001, 9.745945e-001, 9.749512e-001, 9.753037e-001, 9.756563e-001, 9.760089e-001, 9.763615e-001, 9.767140e-001, 9.770666e-001, 9.774192e-001,
+9.777698e-001, 9.781169e-001, 9.784640e-001, 9.788110e-001, 9.791581e-001, 9.795052e-001, 9.798522e-001, 9.801993e-001, 9.805431e-001, 9.808833e-001,
+9.812235e-001, 9.815636e-001, 9.819038e-001, 9.822440e-001, 9.825841e-001, 9.829243e-001, 9.832603e-001, 9.835925e-001, 9.839247e-001, 9.842569e-001,
+9.845891e-001, 9.849213e-001, 9.852535e-001, 9.855857e-001, 9.859134e-001, 9.862367e-001, 9.865600e-001, 9.868833e-001, 9.872066e-001, 9.875299e-001,
+9.878532e-001, 9.881765e-001, 9.884948e-001, 9.888063e-001, 9.891179e-001, 9.894294e-001, 9.897409e-001, 9.900524e-001, 9.903639e-001, 9.906755e-001,
+9.909834e-001, 9.912818e-001, 9.915802e-001, 9.918787e-001, 9.921771e-001, 9.924755e-001, 9.927739e-001, 9.930724e-001, 9.933700e-001, 9.936544e-001,
+9.939388e-001, 9.942231e-001, 9.945075e-001, 9.947919e-001, 9.950763e-001, 9.953607e-001, 9.956451e-001, 9.959149e-001, 9.961805e-001, 9.964461e-001,
+9.967116e-001, 9.969772e-001, 9.972428e-001, 9.975084e-001, 9.977739e-001, 9.980313e-001, 9.982774e-001, 9.985235e-001, 9.987696e-001, 9.990156e-001,
+9.992617e-001, 9.995078e-001, 9.997539e-001, 1.000000e+000)),
+("Agfa", "Agfacolor HDC 200 plus", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.270442e-002, 2.380811e-002, 3.346076e-002, 4.215235e-002, 5.015461e-002, 5.761523e-002, 6.463896e-002, 7.130311e-002, 7.764534e-002,
+8.370185e-002, 8.950458e-002, 9.507319e-002, 1.004388e-001, 1.056184e-001, 1.106418e-001, 1.155220e-001, 1.202522e-001, 1.248438e-001, 1.292978e-001,
+1.336304e-001, 1.378560e-001, 1.419791e-001, 1.460126e-001, 1.499603e-001, 1.538154e-001, 1.575874e-001, 1.612810e-001, 1.648989e-001, 1.684425e-001,
+1.719216e-001, 1.753377e-001, 1.787010e-001, 1.820088e-001, 1.852704e-001, 1.884782e-001, 1.916348e-001, 1.947418e-001, 1.978073e-001, 2.008366e-001,
+2.038186e-001, 2.067597e-001, 2.096651e-001, 2.125399e-001, 2.153765e-001, 2.181748e-001, 2.209407e-001, 2.236783e-001, 2.263896e-001, 2.290693e-001,
+2.317135e-001, 2.343313e-001, 2.369203e-001, 2.394884e-001, 2.420338e-001, 2.445555e-001, 2.470511e-001, 2.495238e-001, 2.519746e-001, 2.544065e-001,
+2.568238e-001, 2.592223e-001, 2.615980e-001, 2.639488e-001, 2.662820e-001, 2.685964e-001, 2.708937e-001, 2.731779e-001, 2.754474e-001, 2.776994e-001,
+2.799315e-001, 2.821440e-001, 2.843374e-001, 2.865156e-001, 2.886820e-001, 2.908359e-001, 2.929799e-001, 2.951103e-001, 2.972273e-001, 2.993307e-001,
+3.014215e-001, 3.034971e-001, 3.055574e-001, 3.076025e-001, 3.096376e-001, 3.116613e-001, 3.136739e-001, 3.156761e-001, 3.176679e-001, 3.196500e-001,
+3.216224e-001, 3.235848e-001, 3.255361e-001, 3.274742e-001, 3.294024e-001, 3.313204e-001, 3.332281e-001, 3.351263e-001, 3.370158e-001, 3.388954e-001,
+3.407635e-001, 3.426196e-001, 3.444670e-001, 3.463075e-001, 3.481401e-001, 3.499645e-001, 3.517807e-001, 3.535911e-001, 3.553932e-001, 3.571879e-001,
+3.589738e-001, 3.607505e-001, 3.625178e-001, 3.642743e-001, 3.660208e-001, 3.677581e-001, 3.694872e-001, 3.712059e-001, 3.729172e-001, 3.746242e-001,
+3.763248e-001, 3.780200e-001, 3.797098e-001, 3.813967e-001, 3.830771e-001, 3.847537e-001, 3.864230e-001, 3.880874e-001, 3.897439e-001, 3.913945e-001,
+3.930368e-001, 3.946720e-001, 3.962987e-001, 3.979171e-001, 3.995271e-001, 4.011280e-001, 4.027225e-001, 4.043093e-001, 4.058885e-001, 4.074593e-001,
+4.090228e-001, 4.105781e-001, 4.121261e-001, 4.136680e-001, 4.152038e-001, 4.167322e-001, 4.182568e-001, 4.197765e-001, 4.212918e-001, 4.228026e-001,
+4.243075e-001, 4.258069e-001, 4.273006e-001, 4.287903e-001, 4.302770e-001, 4.317578e-001, 4.332347e-001, 4.347065e-001, 4.361734e-001, 4.376365e-001,
+4.390909e-001, 4.405422e-001, 4.419898e-001, 4.434332e-001, 4.448714e-001, 4.463052e-001, 4.477353e-001, 4.491625e-001, 4.505859e-001, 4.520067e-001,
+4.534247e-001, 4.548385e-001, 4.562490e-001, 4.576566e-001, 4.590603e-001, 4.604597e-001, 4.618561e-001, 4.632490e-001, 4.646366e-001, 4.660210e-001,
+4.674021e-001, 4.687772e-001, 4.701491e-001, 4.715175e-001, 4.728797e-001, 4.742386e-001, 4.755935e-001, 4.769422e-001, 4.782876e-001, 4.796283e-001,
+4.809632e-001, 4.822949e-001, 4.836206e-001, 4.849415e-001, 4.862594e-001, 4.875694e-001, 4.888762e-001, 4.901782e-001, 4.914738e-001, 4.927663e-001,
+4.940517e-001, 4.953329e-001, 4.966097e-001, 4.978793e-001, 4.991464e-001, 5.004070e-001, 5.016649e-001, 5.029193e-001, 5.041681e-001, 5.054149e-001,
+5.066552e-001, 5.078934e-001, 5.091259e-001, 5.103550e-001, 5.115809e-001, 5.128020e-001, 5.140216e-001, 5.152375e-001, 5.164521e-001, 5.176616e-001,
+5.188698e-001, 5.200755e-001, 5.212779e-001, 5.224775e-001, 5.236744e-001, 5.248702e-001, 5.260608e-001, 5.272505e-001, 5.284341e-001, 5.296169e-001,
+5.307930e-001, 5.319679e-001, 5.331380e-001, 5.343062e-001, 5.354691e-001, 5.366293e-001, 5.377837e-001, 5.389350e-001, 5.400811e-001, 5.412240e-001,
+5.423621e-001, 5.434969e-001, 5.446272e-001, 5.457543e-001, 5.468771e-001, 5.479969e-001, 5.491124e-001, 5.502252e-001, 5.513336e-001, 5.524397e-001,
+5.535413e-001, 5.546412e-001, 5.557362e-001, 5.568301e-001, 5.579187e-001, 5.590069e-001, 5.600894e-001, 5.611719e-001, 5.622487e-001, 5.633254e-001,
+5.643973e-001, 5.654682e-001, 5.665354e-001, 5.676008e-001, 5.686636e-001, 5.697238e-001, 5.707824e-001, 5.718375e-001, 5.728921e-001, 5.739423e-001,
+5.749925e-001, 5.760387e-001, 5.770842e-001, 5.781269e-001, 5.791680e-001, 5.802067e-001, 5.812411e-001, 5.822751e-001, 5.833042e-001, 5.843334e-001,
+5.853578e-001, 5.863808e-001, 5.874018e-001, 5.884202e-001, 5.894376e-001, 5.904482e-001, 5.914588e-001, 5.924654e-001, 5.934707e-001, 5.944733e-001,
+5.954716e-001, 5.964698e-001, 5.974636e-001, 5.984574e-001, 5.994476e-001, 6.004351e-001, 6.014221e-001, 6.024059e-001, 6.033896e-001, 6.043697e-001,
+6.053479e-001, 6.063256e-001, 6.073009e-001, 6.082761e-001, 6.092480e-001, 6.102185e-001, 6.111886e-001, 6.121569e-001, 6.131251e-001, 6.140908e-001,
+6.150550e-001, 6.160189e-001, 6.169794e-001, 6.179399e-001, 6.188982e-001, 6.198543e-001, 6.208104e-001, 6.217639e-001, 6.227171e-001, 6.236690e-001,
+6.246174e-001, 6.255657e-001, 6.265100e-001, 6.274516e-001, 6.283933e-001, 6.293300e-001, 6.302665e-001, 6.312015e-001, 6.321322e-001, 6.330628e-001,
+6.339905e-001, 6.349157e-001, 6.358408e-001, 6.367602e-001, 6.376782e-001, 6.385960e-001, 6.395091e-001, 6.404222e-001, 6.413338e-001, 6.422404e-001,
+6.431471e-001, 6.440511e-001, 6.449515e-001, 6.458520e-001, 6.467483e-001, 6.476420e-001, 6.485357e-001, 6.494253e-001, 6.503136e-001, 6.512019e-001,
+6.520849e-001, 6.529673e-001, 6.538497e-001, 6.547254e-001, 6.556011e-001, 6.564764e-001, 6.573459e-001, 6.582155e-001, 6.590843e-001, 6.599482e-001,
+6.608121e-001, 6.616753e-001, 6.625340e-001, 6.633928e-001, 6.642509e-001, 6.651050e-001, 6.659592e-001, 6.668126e-001, 6.676606e-001, 6.685086e-001,
+6.693563e-001, 6.701997e-001, 6.710431e-001, 6.718865e-001, 6.727249e-001, 6.735633e-001, 6.744016e-001, 6.752369e-001, 6.760717e-001, 6.769066e-001,
+6.777368e-001, 6.785657e-001, 6.793946e-001, 6.802213e-001, 6.810468e-001, 6.818722e-001, 6.826950e-001, 6.835147e-001, 6.843343e-001, 6.851524e-001,
+6.859659e-001, 6.867794e-001, 6.875927e-001, 6.884006e-001, 6.892085e-001, 6.900163e-001, 6.908204e-001, 6.916233e-001, 6.924263e-001, 6.932265e-001,
+6.940239e-001, 6.948214e-001, 6.956178e-001, 6.964093e-001, 6.972008e-001, 6.979924e-001, 6.987802e-001, 6.995673e-001, 7.003544e-001, 7.011384e-001,
+7.019188e-001, 7.026991e-001, 7.034790e-001, 7.042532e-001, 7.050274e-001, 7.058015e-001, 7.065715e-001, 7.073393e-001, 7.081070e-001, 7.088738e-001,
+7.096367e-001, 7.103996e-001, 7.111625e-001, 7.119218e-001, 7.126796e-001, 7.134375e-001, 7.141942e-001, 7.149465e-001, 7.156989e-001, 7.164513e-001,
+7.172006e-001, 7.179483e-001, 7.186960e-001, 7.194433e-001, 7.201871e-001, 7.209309e-001, 7.216747e-001, 7.224154e-001, 7.231532e-001, 7.238910e-001,
+7.246287e-001, 7.253618e-001, 7.260943e-001, 7.268268e-001, 7.275583e-001, 7.282862e-001, 7.290141e-001, 7.297420e-001, 7.304679e-001, 7.311920e-001,
+7.319161e-001, 7.326402e-001, 7.333593e-001, 7.340773e-001, 7.347954e-001, 7.355128e-001, 7.362237e-001, 7.369347e-001, 7.376456e-001, 7.383548e-001,
+7.390603e-001, 7.397658e-001, 7.404712e-001, 7.411739e-001, 7.418738e-001, 7.425738e-001, 7.432737e-001, 7.439711e-001, 7.446671e-001, 7.453631e-001,
+7.460591e-001, 7.467520e-001, 7.474440e-001, 7.481361e-001, 7.488281e-001, 7.495165e-001, 7.502045e-001, 7.508924e-001, 7.515803e-001, 7.522625e-001,
+7.529443e-001, 7.536261e-001, 7.543080e-001, 7.549847e-001, 7.556613e-001, 7.563379e-001, 7.570146e-001, 7.576869e-001, 7.583591e-001, 7.590313e-001,
+7.597035e-001, 7.603724e-001, 7.610410e-001, 7.617096e-001, 7.623783e-001, 7.630437e-001, 7.637085e-001, 7.643734e-001, 7.650382e-001, 7.656989e-001,
+7.663581e-001, 7.670173e-001, 7.676766e-001, 7.683328e-001, 7.689872e-001, 7.696416e-001, 7.702960e-001, 7.709482e-001, 7.715978e-001, 7.722474e-001,
+7.728970e-001, 7.735458e-001, 7.741923e-001, 7.748388e-001, 7.754853e-001, 7.761318e-001, 7.767726e-001, 7.774135e-001, 7.780543e-001, 7.786952e-001,
+7.793319e-001, 7.799670e-001, 7.806021e-001, 7.812373e-001, 7.818704e-001, 7.825008e-001, 7.831311e-001, 7.837614e-001, 7.843915e-001, 7.850180e-001,
+7.856444e-001, 7.862709e-001, 7.868974e-001, 7.875212e-001, 7.881437e-001, 7.887662e-001, 7.893888e-001, 7.900099e-001, 7.906270e-001, 7.912440e-001,
+7.918611e-001, 7.924781e-001, 7.930914e-001, 7.937037e-001, 7.943160e-001, 7.949283e-001, 7.955389e-001, 7.961458e-001, 7.967526e-001, 7.973595e-001,
+7.979663e-001, 7.985697e-001, 7.991721e-001, 7.997745e-001, 8.003768e-001, 8.009781e-001, 8.015752e-001, 8.021722e-001, 8.027692e-001, 8.033663e-001,
+8.039602e-001, 8.045522e-001, 8.051441e-001, 8.057360e-001, 8.063279e-001, 8.069159e-001, 8.075037e-001, 8.080914e-001, 8.086792e-001, 8.092661e-001,
+8.098508e-001, 8.104355e-001, 8.110201e-001, 8.116048e-001, 8.121870e-001, 8.127671e-001, 8.133472e-001, 8.139273e-001, 8.145074e-001, 8.150827e-001,
+8.156566e-001, 8.162305e-001, 8.168044e-001, 8.173784e-001, 8.179473e-001, 8.185162e-001, 8.190850e-001, 8.196539e-001, 8.202222e-001, 8.207869e-001,
+8.213516e-001, 8.219163e-001, 8.224811e-001, 8.230450e-001, 8.236066e-001, 8.241683e-001, 8.247299e-001, 8.252915e-001, 8.258516e-001, 8.264086e-001,
+8.269656e-001, 8.275226e-001, 8.280796e-001, 8.286347e-001, 8.291864e-001, 8.297382e-001, 8.302899e-001, 8.308416e-001, 8.313921e-001, 8.319404e-001,
+8.324886e-001, 8.330369e-001, 8.335851e-001, 8.341316e-001, 8.346744e-001, 8.352171e-001, 8.357598e-001, 8.363026e-001, 8.368440e-001, 8.373814e-001,
+8.379188e-001, 8.384562e-001, 8.389936e-001, 8.395305e-001, 8.400636e-001, 8.405967e-001, 8.411298e-001, 8.416628e-001, 8.421959e-001, 8.427261e-001,
+8.432560e-001, 8.437859e-001, 8.443158e-001, 8.448457e-001, 8.453723e-001, 8.458976e-001, 8.464229e-001, 8.469482e-001, 8.474735e-001, 8.479961e-001,
+8.485156e-001, 8.490351e-001, 8.495545e-001, 8.500740e-001, 8.505927e-001, 8.511075e-001, 8.516222e-001, 8.521370e-001, 8.526518e-001, 8.531665e-001,
+8.536783e-001, 8.541893e-001, 8.547004e-001, 8.552114e-001, 8.557224e-001, 8.562318e-001, 8.567387e-001, 8.572457e-001, 8.577527e-001, 8.582597e-001,
+8.587666e-001, 8.592698e-001, 8.597729e-001, 8.602761e-001, 8.607792e-001, 8.612823e-001, 8.617837e-001, 8.622833e-001, 8.627830e-001, 8.632826e-001,
+8.637822e-001, 8.642819e-001, 8.647763e-001, 8.652707e-001, 8.657650e-001, 8.662594e-001, 8.667537e-001, 8.672460e-001, 8.677352e-001, 8.682244e-001,
+8.687136e-001, 8.692028e-001, 8.696920e-001, 8.701782e-001, 8.706634e-001, 8.711487e-001, 8.716340e-001, 8.721193e-001, 8.726041e-001, 8.730852e-001,
+8.735662e-001, 8.740473e-001, 8.745284e-001, 8.750095e-001, 8.754890e-001, 8.759662e-001, 8.764434e-001, 8.769206e-001, 8.773979e-001, 8.778751e-001,
+8.783500e-001, 8.788238e-001, 8.792976e-001, 8.797713e-001, 8.802451e-001, 8.807188e-001, 8.811894e-001, 8.816594e-001, 8.821293e-001, 8.825993e-001,
+8.830693e-001, 8.835392e-001, 8.840066e-001, 8.844739e-001, 8.849413e-001, 8.854086e-001, 8.858759e-001, 8.863430e-001, 8.868073e-001, 8.872717e-001,
+8.877360e-001, 8.882004e-001, 8.886647e-001, 8.891287e-001, 8.895897e-001, 8.900507e-001, 8.905117e-001, 8.909727e-001, 8.914337e-001, 8.918943e-001,
+8.923516e-001, 8.928090e-001, 8.932664e-001, 8.937238e-001, 8.941811e-001, 8.946382e-001, 8.950916e-001, 8.955450e-001, 8.959984e-001, 8.964518e-001,
+8.969052e-001, 8.973586e-001, 8.978086e-001, 8.982584e-001, 8.987083e-001, 8.991581e-001, 8.996080e-001, 9.000578e-001, 9.005057e-001, 9.009531e-001,
+9.014005e-001, 9.018480e-001, 9.022954e-001, 9.027428e-001, 9.031882e-001, 9.036323e-001, 9.040764e-001, 9.045205e-001, 9.049645e-001, 9.054086e-001,
+9.058512e-001, 9.062910e-001, 9.067307e-001, 9.071705e-001, 9.076103e-001, 9.080501e-001, 9.084897e-001, 9.089263e-001, 9.093629e-001, 9.097994e-001,
+9.102360e-001, 9.106726e-001, 9.111092e-001, 9.115434e-001, 9.119767e-001, 9.124100e-001, 9.128433e-001, 9.132765e-001, 9.137098e-001, 9.141420e-001,
+9.145716e-001, 9.150012e-001, 9.154308e-001, 9.158604e-001, 9.162899e-001, 9.167195e-001, 9.171459e-001, 9.175716e-001, 9.179974e-001, 9.184231e-001,
+9.188488e-001, 9.192745e-001, 9.196990e-001, 9.201208e-001, 9.205425e-001, 9.209643e-001, 9.213860e-001, 9.218078e-001, 9.222296e-001, 9.226487e-001,
+9.230669e-001, 9.234851e-001, 9.239033e-001, 9.243215e-001, 9.247396e-001, 9.251575e-001, 9.255726e-001, 9.259878e-001, 9.264029e-001, 9.268180e-001,
+9.272332e-001, 9.276483e-001, 9.280616e-001, 9.284723e-001, 9.288829e-001, 9.292936e-001, 9.297043e-001, 9.301150e-001, 9.305256e-001, 9.309335e-001,
+9.313401e-001, 9.317467e-001, 9.321533e-001, 9.325598e-001, 9.329664e-001, 9.333730e-001, 9.337770e-001, 9.341808e-001, 9.345845e-001, 9.349882e-001,
+9.353919e-001, 9.357956e-001, 9.361993e-001, 9.366001e-001, 9.370009e-001, 9.374017e-001, 9.378025e-001, 9.382033e-001, 9.386042e-001, 9.390046e-001,
+9.394023e-001, 9.397999e-001, 9.401976e-001, 9.405953e-001, 9.409930e-001, 9.413907e-001, 9.417878e-001, 9.421823e-001, 9.425769e-001, 9.429714e-001,
+9.433659e-001, 9.437604e-001, 9.441549e-001, 9.445487e-001, 9.449382e-001, 9.453277e-001, 9.457172e-001, 9.461068e-001, 9.464963e-001, 9.468858e-001,
+9.472748e-001, 9.476566e-001, 9.480384e-001, 9.484201e-001, 9.488019e-001, 9.491836e-001, 9.495654e-001, 9.499472e-001, 9.503229e-001, 9.506982e-001,
+9.510734e-001, 9.514486e-001, 9.518238e-001, 9.521991e-001, 9.525743e-001, 9.529467e-001, 9.533181e-001, 9.536895e-001, 9.540608e-001, 9.544322e-001,
+9.548036e-001, 9.551749e-001, 9.555448e-001, 9.559131e-001, 9.562813e-001, 9.566496e-001, 9.570178e-001, 9.573861e-001, 9.577543e-001, 9.581220e-001,
+9.584865e-001, 9.588510e-001, 9.592155e-001, 9.595801e-001, 9.599446e-001, 9.603091e-001, 9.606736e-001, 9.610345e-001, 9.613944e-001, 9.617542e-001,
+9.621141e-001, 9.624739e-001, 9.628337e-001, 9.631936e-001, 9.635520e-001, 9.639074e-001, 9.642628e-001, 9.646183e-001, 9.649737e-001, 9.653291e-001,
+9.656845e-001, 9.660399e-001, 9.663917e-001, 9.667427e-001, 9.670937e-001, 9.674447e-001, 9.677956e-001, 9.681466e-001, 9.684976e-001, 9.688473e-001,
+9.691933e-001, 9.695393e-001, 9.698853e-001, 9.702313e-001, 9.705773e-001, 9.709233e-001, 9.712692e-001, 9.716116e-001, 9.719518e-001, 9.722920e-001,
+9.726322e-001, 9.729724e-001, 9.733125e-001, 9.736527e-001, 9.739929e-001, 9.743274e-001, 9.746615e-001, 9.749957e-001, 9.753298e-001, 9.756639e-001,
+9.759980e-001, 9.763321e-001, 9.766650e-001, 9.769923e-001, 9.773196e-001, 9.776469e-001, 9.779742e-001, 9.783016e-001, 9.786289e-001, 9.789562e-001,
+9.792809e-001, 9.796009e-001, 9.799209e-001, 9.802409e-001, 9.805610e-001, 9.808810e-001, 9.812010e-001, 9.815210e-001, 9.818373e-001, 9.821496e-001,
+9.824618e-001, 9.827741e-001, 9.830863e-001, 9.833986e-001, 9.837108e-001, 9.840231e-001, 9.843309e-001, 9.846347e-001, 9.849384e-001, 9.852422e-001,
+9.855460e-001, 9.858498e-001, 9.861536e-001, 9.864573e-001, 9.867571e-001, 9.870530e-001, 9.873489e-001, 9.876448e-001, 9.879406e-001, 9.882365e-001,
+9.885324e-001, 9.888283e-001, 9.891208e-001, 9.894089e-001, 9.896969e-001, 9.899850e-001, 9.902730e-001, 9.905611e-001, 9.908491e-001, 9.911371e-001,
+9.914227e-001, 9.917018e-001, 9.919809e-001, 9.922600e-001, 9.925391e-001, 9.928182e-001, 9.930973e-001, 9.933764e-001, 9.936548e-001, 9.939226e-001,
+9.941904e-001, 9.944582e-001, 9.947260e-001, 9.949938e-001, 9.952616e-001, 9.955294e-001, 9.957973e-001, 9.960541e-001, 9.963079e-001, 9.965616e-001,
+9.968154e-001, 9.970691e-001, 9.973229e-001, 9.975766e-001, 9.978304e-001, 9.980784e-001, 9.983186e-001, 9.985588e-001, 9.987990e-001, 9.990392e-001,
+9.992794e-001, 9.995196e-001, 9.997598e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.410232e-002, 2.597458e-002, 3.647495e-002, 4.589386e-002, 5.446664e-002, 6.234330e-002, 6.965277e-002, 7.645472e-002, 8.284727e-002,
+8.891107e-002, 9.467823e-002, 1.001902e-001, 1.054987e-001, 1.106514e-001, 1.156637e-001, 1.205495e-001, 1.252955e-001, 1.299131e-001, 1.344144e-001,
+1.388116e-001, 1.431177e-001, 1.473421e-001, 1.514800e-001, 1.555261e-001, 1.594948e-001, 1.633806e-001, 1.671909e-001, 1.709319e-001, 1.746093e-001,
+1.782347e-001, 1.818005e-001, 1.853079e-001, 1.887629e-001, 1.921591e-001, 1.955104e-001, 1.988155e-001, 2.020708e-001, 2.052816e-001, 2.084514e-001,
+2.115817e-001, 2.146739e-001, 2.177292e-001, 2.207520e-001, 2.237413e-001, 2.266952e-001, 2.296195e-001, 2.325070e-001, 2.353624e-001, 2.381869e-001,
+2.409814e-001, 2.437490e-001, 2.464885e-001, 2.492032e-001, 2.518972e-001, 2.545694e-001, 2.572140e-001, 2.598383e-001, 2.624386e-001, 2.650177e-001,
+2.675767e-001, 2.701159e-001, 2.726358e-001, 2.751354e-001, 2.776152e-001, 2.800753e-001, 2.825163e-001, 2.849401e-001, 2.873477e-001, 2.897374e-001,
+2.921099e-001, 2.944638e-001, 2.968018e-001, 2.991257e-001, 3.014313e-001, 3.037212e-001, 3.059999e-001, 3.082641e-001, 3.105159e-001, 3.127524e-001,
+3.149785e-001, 3.171897e-001, 3.193879e-001, 3.215714e-001, 3.237440e-001, 3.259028e-001, 3.280479e-001, 3.301831e-001, 3.323085e-001, 3.344236e-001,
+3.365249e-001, 3.386120e-001, 3.406879e-001, 3.427499e-001, 3.448010e-001, 3.468417e-001, 3.488731e-001, 3.508966e-001, 3.529113e-001, 3.549159e-001,
+3.569114e-001, 3.588971e-001, 3.608723e-001, 3.628364e-001, 3.647881e-001, 3.667265e-001, 3.686559e-001, 3.705761e-001, 3.724865e-001, 3.743884e-001,
+3.762854e-001, 3.781767e-001, 3.800613e-001, 3.819382e-001, 3.838065e-001, 3.856653e-001, 3.875138e-001, 3.893511e-001, 3.911784e-001, 3.929969e-001,
+3.948045e-001, 3.966019e-001, 3.983893e-001, 4.001693e-001, 4.019419e-001, 4.037080e-001, 4.054659e-001, 4.072161e-001, 4.089570e-001, 4.106892e-001,
+4.124136e-001, 4.141317e-001, 4.158441e-001, 4.175505e-001, 4.192501e-001, 4.209433e-001, 4.226306e-001, 4.243137e-001, 4.259892e-001, 4.276597e-001,
+4.293232e-001, 4.309803e-001, 4.326307e-001, 4.342732e-001, 4.359092e-001, 4.375347e-001, 4.391531e-001, 4.407627e-001, 4.423646e-001, 4.439603e-001,
+4.455478e-001, 4.471279e-001, 4.487006e-001, 4.502669e-001, 4.518280e-001, 4.533826e-001, 4.549310e-001, 4.564738e-001, 4.580112e-001, 4.595425e-001,
+4.610662e-001, 4.625842e-001, 4.640966e-001, 4.656026e-001, 4.671006e-001, 4.685928e-001, 4.700792e-001, 4.715583e-001, 4.730297e-001, 4.744954e-001,
+4.759553e-001, 4.774057e-001, 4.788501e-001, 4.802890e-001, 4.817212e-001, 4.831479e-001, 4.845703e-001, 4.859867e-001, 4.873969e-001, 4.888026e-001,
+4.902028e-001, 4.915963e-001, 4.929861e-001, 4.943716e-001, 4.957532e-001, 4.971318e-001, 4.985060e-001, 4.998765e-001, 5.012443e-001, 5.026070e-001,
+5.039667e-001, 5.053242e-001, 5.066757e-001, 5.080249e-001, 5.093721e-001, 5.107128e-001, 5.120517e-001, 5.133879e-001, 5.147191e-001, 5.160482e-001,
+5.173733e-001, 5.186955e-001, 5.200140e-001, 5.213292e-001, 5.226428e-001, 5.239504e-001, 5.252563e-001, 5.265597e-001, 5.278586e-001, 5.291554e-001,
+5.304456e-001, 5.317338e-001, 5.330158e-001, 5.342947e-001, 5.355700e-001, 5.368400e-001, 5.381076e-001, 5.393668e-001, 5.406240e-001, 5.418734e-001,
+5.431200e-001, 5.443606e-001, 5.455970e-001, 5.468291e-001, 5.480559e-001, 5.492797e-001, 5.504973e-001, 5.517131e-001, 5.529219e-001, 5.541299e-001,
+5.553306e-001, 5.565304e-001, 5.577240e-001, 5.589161e-001, 5.601027e-001, 5.612874e-001, 5.624673e-001, 5.636452e-001, 5.648186e-001, 5.659899e-001,
+5.671571e-001, 5.683212e-001, 5.694799e-001, 5.706359e-001, 5.717875e-001, 5.729362e-001, 5.740799e-001, 5.752214e-001, 5.763586e-001, 5.774930e-001,
+5.786203e-001, 5.797460e-001, 5.808661e-001, 5.819850e-001, 5.830960e-001, 5.842069e-001, 5.853117e-001, 5.864164e-001, 5.875138e-001, 5.886104e-001,
+5.897029e-001, 5.907940e-001, 5.918808e-001, 5.929647e-001, 5.940455e-001, 5.951224e-001, 5.961973e-001, 5.972665e-001, 5.983355e-001, 5.993986e-001,
+6.004617e-001, 6.015193e-001, 6.025758e-001, 6.036278e-001, 6.046767e-001, 6.057234e-001, 6.067652e-001, 6.078069e-001, 6.088424e-001, 6.098779e-001,
+6.109093e-001, 6.119390e-001, 6.129667e-001, 6.139913e-001, 6.150155e-001, 6.160332e-001, 6.170510e-001, 6.180650e-001, 6.190776e-001, 6.200882e-001,
+6.210952e-001, 6.221022e-001, 6.231055e-001, 6.241086e-001, 6.251075e-001, 6.261024e-001, 6.270969e-001, 6.280855e-001, 6.290741e-001, 6.300586e-001,
+6.310406e-001, 6.320215e-001, 6.329963e-001, 6.339711e-001, 6.349408e-001, 6.359076e-001, 6.368735e-001, 6.378320e-001, 6.387906e-001, 6.397454e-001,
+6.406973e-001, 6.416491e-001, 6.425917e-001, 6.435343e-001, 6.444741e-001, 6.454102e-001, 6.463463e-001, 6.472759e-001, 6.482042e-001, 6.491310e-001,
+6.500521e-001, 6.509732e-001, 6.518902e-001, 6.528038e-001, 6.537175e-001, 6.546261e-001, 6.555341e-001, 6.564410e-001, 6.573432e-001, 6.582454e-001,
+6.591446e-001, 6.600405e-001, 6.609363e-001, 6.618282e-001, 6.627187e-001, 6.636092e-001, 6.644953e-001, 6.653813e-001, 6.662659e-001, 6.671449e-001,
+6.680239e-001, 6.689004e-001, 6.697733e-001, 6.706462e-001, 6.715160e-001, 6.723836e-001, 6.732511e-001, 6.741155e-001, 6.749787e-001, 6.758419e-001,
+6.766991e-001, 6.775552e-001, 6.784113e-001, 6.792596e-001, 6.801074e-001, 6.809551e-001, 6.817965e-001, 6.826378e-001, 6.834788e-001, 6.843137e-001,
+6.851487e-001, 6.859832e-001, 6.868136e-001, 6.876440e-001, 6.884738e-001, 6.892975e-001, 6.901212e-001, 6.909445e-001, 6.917623e-001, 6.925802e-001,
+6.933979e-001, 6.942088e-001, 6.950196e-001, 6.958305e-001, 6.966358e-001, 6.974408e-001, 6.982459e-001, 6.990466e-001, 6.998467e-001, 7.006468e-001,
+7.014424e-001, 7.022365e-001, 7.030305e-001, 7.038203e-001, 7.046071e-001, 7.053938e-001, 7.061776e-001, 7.069572e-001, 7.077368e-001, 7.085153e-001,
+7.092896e-001, 7.100640e-001, 7.108384e-001, 7.116078e-001, 7.123772e-001, 7.131465e-001, 7.139121e-001, 7.146762e-001, 7.154403e-001, 7.162014e-001,
+7.169584e-001, 7.177153e-001, 7.184716e-001, 7.192226e-001, 7.199735e-001, 7.207245e-001, 7.214716e-001, 7.222176e-001, 7.229637e-001, 7.237073e-001,
+7.244477e-001, 7.251881e-001, 7.259283e-001, 7.266617e-001, 7.273951e-001, 7.281285e-001, 7.288579e-001, 7.295846e-001, 7.303114e-001, 7.310375e-001,
+7.317596e-001, 7.324818e-001, 7.332040e-001, 7.339224e-001, 7.346392e-001, 7.353559e-001, 7.360716e-001, 7.367822e-001, 7.374928e-001, 7.382034e-001,
+7.389101e-001, 7.396145e-001, 7.403189e-001, 7.410229e-001, 7.417224e-001, 7.424219e-001, 7.431214e-001, 7.438186e-001, 7.445131e-001, 7.452077e-001,
+7.459023e-001, 7.465913e-001, 7.472793e-001, 7.479674e-001, 7.486543e-001, 7.493368e-001, 7.500194e-001, 7.507019e-001, 7.513812e-001, 7.520576e-001,
+7.527340e-001, 7.534103e-001, 7.540828e-001, 7.547543e-001, 7.554258e-001, 7.560970e-001, 7.567629e-001, 7.574289e-001, 7.580948e-001, 7.587593e-001,
+7.594198e-001, 7.600804e-001, 7.607409e-001, 7.613991e-001, 7.620544e-001, 7.627097e-001, 7.633651e-001, 7.640164e-001, 7.646652e-001, 7.653140e-001,
+7.659628e-001, 7.666075e-001, 7.672507e-001, 7.678940e-001, 7.685372e-001, 7.691755e-001, 7.698127e-001, 7.704499e-001, 7.710872e-001, 7.717202e-001,
+7.723528e-001, 7.729854e-001, 7.736180e-001, 7.742474e-001, 7.748766e-001, 7.755058e-001, 7.761349e-001, 7.767605e-001, 7.773858e-001, 7.780112e-001,
+7.786365e-001, 7.792576e-001, 7.798782e-001, 7.804989e-001, 7.811195e-001, 7.817358e-001, 7.823513e-001, 7.829668e-001, 7.835822e-001, 7.841937e-001,
+7.848037e-001, 7.854136e-001, 7.860235e-001, 7.866304e-001, 7.872350e-001, 7.878396e-001, 7.884442e-001, 7.890473e-001, 7.896480e-001, 7.902487e-001,
+7.908495e-001, 7.914491e-001, 7.920446e-001, 7.926401e-001, 7.932356e-001, 7.938311e-001, 7.944201e-001, 7.950088e-001, 7.955976e-001, 7.961864e-001,
+7.967715e-001, 7.973550e-001, 7.979385e-001, 7.985220e-001, 7.991035e-001, 7.996814e-001, 8.002593e-001, 8.008373e-001, 8.014151e-001, 8.019879e-001,
+8.025606e-001, 8.031334e-001, 8.037062e-001, 8.042759e-001, 8.048439e-001, 8.054119e-001, 8.059799e-001, 8.065465e-001, 8.071078e-001, 8.076692e-001,
+8.082306e-001, 8.087919e-001, 8.093485e-001, 8.099037e-001, 8.104588e-001, 8.110139e-001, 8.115677e-001, 8.121181e-001, 8.126684e-001, 8.132187e-001,
+8.137690e-001, 8.143169e-001, 8.148640e-001, 8.154110e-001, 8.159581e-001, 8.165046e-001, 8.170487e-001, 8.175928e-001, 8.181369e-001, 8.186810e-001,
+8.192223e-001, 8.197616e-001, 8.203008e-001, 8.208400e-001, 8.213792e-001, 8.219144e-001, 8.224493e-001, 8.229841e-001, 8.235190e-001, 8.240531e-001,
+8.245849e-001, 8.251167e-001, 8.256485e-001, 8.261803e-001, 8.267101e-001, 8.272378e-001, 8.277655e-001, 8.282932e-001, 8.288209e-001, 8.293446e-001,
+8.298670e-001, 8.303894e-001, 8.309119e-001, 8.314343e-001, 8.319529e-001, 8.324714e-001, 8.329898e-001, 8.335083e-001, 8.340263e-001, 8.345406e-001,
+8.350550e-001, 8.355694e-001, 8.360837e-001, 8.365973e-001, 8.371081e-001, 8.376188e-001, 8.381296e-001, 8.386404e-001, 8.391502e-001, 8.396579e-001,
+8.401657e-001, 8.406734e-001, 8.411811e-001, 8.416873e-001, 8.421903e-001, 8.426933e-001, 8.431963e-001, 8.436994e-001, 8.442009e-001, 8.446997e-001,
+8.451984e-001, 8.456972e-001, 8.461959e-001, 8.466939e-001, 8.471899e-001, 8.476859e-001, 8.481818e-001, 8.486778e-001, 8.491731e-001, 8.496653e-001,
+8.501575e-001, 8.506498e-001, 8.511420e-001, 8.516339e-001, 8.521213e-001, 8.526087e-001, 8.530961e-001, 8.535835e-001, 8.540710e-001, 8.545554e-001,
+8.550395e-001, 8.555236e-001, 8.560077e-001, 8.564918e-001, 8.569736e-001, 8.574544e-001, 8.579351e-001, 8.584159e-001, 8.588967e-001, 8.593758e-001,
+8.598529e-001, 8.603300e-001, 8.608071e-001, 8.612842e-001, 8.617608e-001, 8.622342e-001, 8.627076e-001, 8.631809e-001, 8.636543e-001, 8.641277e-001,
+8.645981e-001, 8.650677e-001, 8.655373e-001, 8.660069e-001, 8.664765e-001, 8.669446e-001, 8.674101e-001, 8.678757e-001, 8.683413e-001, 8.688068e-001,
+8.692724e-001, 8.697341e-001, 8.701955e-001, 8.706570e-001, 8.711185e-001, 8.715799e-001, 8.720394e-001, 8.724968e-001, 8.729541e-001, 8.734114e-001,
+8.738687e-001, 8.743260e-001, 8.747800e-001, 8.752337e-001, 8.756875e-001, 8.761413e-001, 8.765950e-001, 8.770480e-001, 8.774997e-001, 8.779514e-001,
+8.784031e-001, 8.788548e-001, 8.793065e-001, 8.797560e-001, 8.802048e-001, 8.806536e-001, 8.811024e-001, 8.815513e-001, 8.819996e-001, 8.824434e-001,
+8.828872e-001, 8.833310e-001, 8.837748e-001, 8.842185e-001, 8.846612e-001, 8.851020e-001, 8.855428e-001, 8.859836e-001, 8.864244e-001, 8.868652e-001,
+8.873041e-001, 8.877420e-001, 8.881798e-001, 8.886177e-001, 8.890555e-001, 8.894934e-001, 8.899270e-001, 8.903598e-001, 8.907926e-001, 8.912253e-001,
+8.916581e-001, 8.920909e-001, 8.925206e-001, 8.929503e-001, 8.933800e-001, 8.938097e-001, 8.942393e-001, 8.946688e-001, 8.950955e-001, 8.955222e-001,
+8.959489e-001, 8.963755e-001, 8.968022e-001, 8.972283e-001, 8.976499e-001, 8.980714e-001, 8.984930e-001, 8.989145e-001, 8.993361e-001, 8.997571e-001,
+9.001741e-001, 9.005911e-001, 9.010080e-001, 9.014250e-001, 9.018420e-001, 9.022588e-001, 9.026720e-001, 9.030852e-001, 9.034984e-001, 9.039116e-001,
+9.043248e-001, 9.047380e-001, 9.051465e-001, 9.055547e-001, 9.059629e-001, 9.063711e-001, 9.067793e-001, 9.071875e-001, 9.075922e-001, 9.079960e-001,
+9.083997e-001, 9.088035e-001, 9.092073e-001, 9.096111e-001, 9.100126e-001, 9.104128e-001, 9.108129e-001, 9.112131e-001, 9.116132e-001, 9.120134e-001,
+9.124118e-001, 9.128071e-001, 9.132024e-001, 9.135976e-001, 9.139929e-001, 9.143881e-001, 9.147832e-001, 9.151742e-001, 9.155651e-001, 9.159561e-001,
+9.163470e-001, 9.167380e-001, 9.171289e-001, 9.175180e-001, 9.179061e-001, 9.182943e-001, 9.186825e-001, 9.190706e-001, 9.194588e-001, 9.198463e-001,
+9.202318e-001, 9.206173e-001, 9.210028e-001, 9.213883e-001, 9.217738e-001, 9.221593e-001, 9.225427e-001, 9.229256e-001, 9.233084e-001, 9.236912e-001,
+9.240741e-001, 9.244569e-001, 9.248391e-001, 9.252194e-001, 9.255997e-001, 9.259801e-001, 9.263604e-001, 9.267407e-001, 9.271210e-001, 9.274996e-001,
+9.278776e-001, 9.282555e-001, 9.286334e-001, 9.290113e-001, 9.293892e-001, 9.297669e-001, 9.301424e-001, 9.305179e-001, 9.308934e-001, 9.312689e-001,
+9.316445e-001, 9.320200e-001, 9.323946e-001, 9.327678e-001, 9.331410e-001, 9.335142e-001, 9.338875e-001, 9.342607e-001, 9.346339e-001, 9.350057e-001,
+9.353767e-001, 9.357478e-001, 9.361188e-001, 9.364898e-001, 9.368609e-001, 9.372319e-001, 9.376000e-001, 9.379676e-001, 9.383352e-001, 9.387028e-001,
+9.390705e-001, 9.394381e-001, 9.398057e-001, 9.401706e-001, 9.405355e-001, 9.409004e-001, 9.412653e-001, 9.416302e-001, 9.419951e-001, 9.423598e-001,
+9.427228e-001, 9.430859e-001, 9.434489e-001, 9.438120e-001, 9.441750e-001, 9.445381e-001, 9.449007e-001, 9.452607e-001, 9.456206e-001, 9.459806e-001,
+9.463406e-001, 9.467006e-001, 9.470605e-001, 9.474199e-001, 9.477747e-001, 9.481295e-001, 9.484843e-001, 9.488391e-001, 9.491939e-001, 9.495488e-001,
+9.499033e-001, 9.502521e-001, 9.506009e-001, 9.509496e-001, 9.512984e-001, 9.516472e-001, 9.519960e-001, 9.523447e-001, 9.526900e-001, 9.530350e-001,
+9.533799e-001, 9.537248e-001, 9.540697e-001, 9.544147e-001, 9.547596e-001, 9.551024e-001, 9.554444e-001, 9.557864e-001, 9.561284e-001, 9.564704e-001,
+9.568124e-001, 9.571544e-001, 9.574953e-001, 9.578348e-001, 9.581743e-001, 9.585138e-001, 9.588533e-001, 9.591928e-001, 9.595323e-001, 9.598714e-001,
+9.602083e-001, 9.605451e-001, 9.608819e-001, 9.612188e-001, 9.615556e-001, 9.618925e-001, 9.622293e-001, 9.625637e-001, 9.628973e-001, 9.632309e-001,
+9.635645e-001, 9.638981e-001, 9.642317e-001, 9.645653e-001, 9.648981e-001, 9.652289e-001, 9.655597e-001, 9.658905e-001, 9.662213e-001, 9.665521e-001,
+9.668829e-001, 9.672137e-001, 9.675421e-001, 9.678699e-001, 9.681977e-001, 9.685255e-001, 9.688534e-001, 9.691812e-001, 9.695090e-001, 9.698360e-001,
+9.701604e-001, 9.704848e-001, 9.708092e-001, 9.711336e-001, 9.714580e-001, 9.717824e-001, 9.721068e-001, 9.724292e-001, 9.727504e-001, 9.730715e-001,
+9.733927e-001, 9.737138e-001, 9.740350e-001, 9.743562e-001, 9.746773e-001, 9.749951e-001, 9.753126e-001, 9.756301e-001, 9.759476e-001, 9.762651e-001,
+9.765826e-001, 9.769001e-001, 9.772170e-001, 9.775304e-001, 9.778439e-001, 9.781573e-001, 9.784708e-001, 9.787843e-001, 9.790977e-001, 9.794112e-001,
+9.797230e-001, 9.800319e-001, 9.803408e-001, 9.806496e-001, 9.809585e-001, 9.812674e-001, 9.815762e-001, 9.818851e-001, 9.821913e-001, 9.824944e-001,
+9.827976e-001, 9.831007e-001, 9.834039e-001, 9.837070e-001, 9.840102e-001, 9.843133e-001, 9.846135e-001, 9.849109e-001, 9.852083e-001, 9.855058e-001,
+9.858032e-001, 9.861006e-001, 9.863980e-001, 9.866954e-001, 9.869899e-001, 9.872815e-001, 9.875731e-001, 9.878647e-001, 9.881564e-001, 9.884480e-001,
+9.887396e-001, 9.890312e-001, 9.893191e-001, 9.896019e-001, 9.898847e-001, 9.901676e-001, 9.904504e-001, 9.907332e-001, 9.910161e-001, 9.912989e-001,
+9.915795e-001, 9.918541e-001, 9.921287e-001, 9.924033e-001, 9.926780e-001, 9.929526e-001, 9.932272e-001, 9.935019e-001, 9.937759e-001, 9.940415e-001,
+9.943070e-001, 9.945726e-001, 9.948381e-001, 9.951037e-001, 9.953692e-001, 9.956347e-001, 9.959003e-001, 9.961531e-001, 9.964022e-001, 9.966513e-001,
+9.969004e-001, 9.971495e-001, 9.973986e-001, 9.976477e-001, 9.978968e-001, 9.981389e-001, 9.983715e-001, 9.986042e-001, 9.988368e-001, 9.990694e-001,
+9.993021e-001, 9.995347e-001, 9.997674e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.647753e-003, 1.760704e-002, 2.467243e-002, 3.117511e-002, 3.724298e-002, 4.298104e-002, 4.844091e-002, 5.367910e-002, 5.871623e-002,
+6.357921e-002, 6.830032e-002, 7.287914e-002, 7.733953e-002, 8.166632e-002, 8.589419e-002, 9.002476e-002, 9.408082e-002, 9.805864e-002, 1.019453e-001,
+1.057269e-001, 1.094207e-001, 1.130444e-001, 1.166007e-001, 1.200910e-001, 1.235229e-001, 1.269005e-001, 1.302188e-001, 1.334830e-001, 1.366928e-001,
+1.398549e-001, 1.429745e-001, 1.460446e-001, 1.490731e-001, 1.520526e-001, 1.549959e-001, 1.578975e-001, 1.607636e-001, 1.635924e-001, 1.663881e-001,
+1.691492e-001, 1.718768e-001, 1.745763e-001, 1.772499e-001, 1.798919e-001, 1.825039e-001, 1.850909e-001, 1.876517e-001, 1.901891e-001, 1.927061e-001,
+1.951995e-001, 1.976689e-001, 2.001181e-001, 2.025482e-001, 2.049553e-001, 2.073439e-001, 2.097100e-001, 2.120580e-001, 2.143891e-001, 2.167063e-001,
+2.190068e-001, 2.212958e-001, 2.235657e-001, 2.258212e-001, 2.280610e-001, 2.302847e-001, 2.324968e-001, 2.346934e-001, 2.368790e-001, 2.390515e-001,
+2.412095e-001, 2.433556e-001, 2.454878e-001, 2.476056e-001, 2.497113e-001, 2.518029e-001, 2.538797e-001, 2.559437e-001, 2.579966e-001, 2.600373e-001,
+2.620668e-001, 2.640840e-001, 2.660910e-001, 2.680850e-001, 2.700705e-001, 2.720480e-001, 2.740156e-001, 2.759724e-001, 2.779216e-001, 2.798639e-001,
+2.817943e-001, 2.837162e-001, 2.856322e-001, 2.875392e-001, 2.894362e-001, 2.913257e-001, 2.932092e-001, 2.950841e-001, 2.969497e-001, 2.988081e-001,
+3.006611e-001, 3.025060e-001, 3.043418e-001, 3.061706e-001, 3.079940e-001, 3.098114e-001, 3.116198e-001, 3.134202e-001, 3.152152e-001, 3.170051e-001,
+3.187877e-001, 3.205623e-001, 3.223307e-001, 3.240945e-001, 3.258526e-001, 3.276030e-001, 3.293436e-001, 3.310768e-001, 3.328061e-001, 3.345299e-001,
+3.362461e-001, 3.379529e-001, 3.396535e-001, 3.413508e-001, 3.430430e-001, 3.447283e-001, 3.464051e-001, 3.480730e-001, 3.497362e-001, 3.513950e-001,
+3.530482e-001, 3.546942e-001, 3.563325e-001, 3.579638e-001, 3.595893e-001, 3.612098e-001, 3.628252e-001, 3.644339e-001, 3.660350e-001, 3.676308e-001,
+3.692201e-001, 3.708020e-001, 3.723767e-001, 3.739451e-001, 3.755084e-001, 3.770667e-001, 3.786197e-001, 3.801665e-001, 3.817075e-001, 3.832431e-001,
+3.847720e-001, 3.862960e-001, 3.878161e-001, 3.893317e-001, 3.908423e-001, 3.923459e-001, 3.938424e-001, 3.953358e-001, 3.968258e-001, 3.983113e-001,
+3.997905e-001, 4.012655e-001, 4.027357e-001, 4.042006e-001, 4.056580e-001, 4.071115e-001, 4.085614e-001, 4.100078e-001, 4.114479e-001, 4.128835e-001,
+4.143149e-001, 4.157410e-001, 4.171645e-001, 4.185852e-001, 4.200018e-001, 4.214130e-001, 4.228211e-001, 4.242259e-001, 4.256238e-001, 4.270183e-001,
+4.284091e-001, 4.297944e-001, 4.311767e-001, 4.325558e-001, 4.339298e-001, 4.353007e-001, 4.366676e-001, 4.380275e-001, 4.393840e-001, 4.407354e-001,
+4.420842e-001, 4.434313e-001, 4.447738e-001, 4.461131e-001, 4.474501e-001, 4.487795e-001, 4.501058e-001, 4.514275e-001, 4.527436e-001, 4.540571e-001,
+4.553644e-001, 4.566692e-001, 4.579711e-001, 4.592679e-001, 4.605629e-001, 4.618536e-001, 4.631414e-001, 4.644251e-001, 4.657050e-001, 4.669833e-001,
+4.682553e-001, 4.695255e-001, 4.707902e-001, 4.720516e-001, 4.733095e-001, 4.745627e-001, 4.758142e-001, 4.770599e-001, 4.783042e-001, 4.795426e-001,
+4.807788e-001, 4.820107e-001, 4.832395e-001, 4.844653e-001, 4.856874e-001, 4.869077e-001, 4.881237e-001, 4.893389e-001, 4.905494e-001, 4.917592e-001,
+4.929627e-001, 4.941651e-001, 4.953621e-001, 4.965574e-001, 4.977474e-001, 4.989356e-001, 5.001201e-001, 5.013016e-001, 5.024777e-001, 5.036516e-001,
+5.048222e-001, 5.059907e-001, 5.071563e-001, 5.083196e-001, 5.094795e-001, 5.106369e-001, 5.117905e-001, 5.129419e-001, 5.140898e-001, 5.152367e-001,
+5.163817e-001, 5.175253e-001, 5.186646e-001, 5.198031e-001, 5.209382e-001, 5.220728e-001, 5.232008e-001, 5.243288e-001, 5.254527e-001, 5.265763e-001,
+5.276951e-001, 5.288128e-001, 5.299269e-001, 5.310390e-001, 5.321476e-001, 5.332526e-001, 5.343559e-001, 5.354554e-001, 5.365544e-001, 5.376481e-001,
+5.387417e-001, 5.398298e-001, 5.409171e-001, 5.420001e-001, 5.430804e-001, 5.441582e-001, 5.452313e-001, 5.463038e-001, 5.473703e-001, 5.484367e-001,
+5.494986e-001, 5.505590e-001, 5.516162e-001, 5.526692e-001, 5.537215e-001, 5.547677e-001, 5.558139e-001, 5.568549e-001, 5.578942e-001, 5.589315e-001,
+5.599655e-001, 5.609995e-001, 5.620262e-001, 5.630527e-001, 5.640759e-001, 5.650966e-001, 5.661163e-001, 5.671288e-001, 5.681413e-001, 5.691496e-001,
+5.701558e-001, 5.711603e-001, 5.721578e-001, 5.731553e-001, 5.741488e-001, 5.751404e-001, 5.761309e-001, 5.771155e-001, 5.781001e-001, 5.790807e-001,
+5.800590e-001, 5.810368e-001, 5.820075e-001, 5.829782e-001, 5.839463e-001, 5.849115e-001, 5.858767e-001, 5.868370e-001, 5.877965e-001, 5.887547e-001,
+5.897085e-001, 5.906623e-001, 5.916126e-001, 5.925605e-001, 5.935084e-001, 5.944507e-001, 5.953926e-001, 5.963331e-001, 5.972689e-001, 5.982046e-001,
+5.991371e-001, 6.000667e-001, 6.009962e-001, 6.019207e-001, 6.028438e-001, 6.037668e-001, 6.046834e-001, 6.056001e-001, 6.065153e-001, 6.074264e-001,
+6.083375e-001, 6.092465e-001, 6.101529e-001, 6.110592e-001, 6.119621e-001, 6.128628e-001, 6.137634e-001, 6.146604e-001, 6.155562e-001, 6.164520e-001,
+6.173437e-001, 6.182349e-001, 6.191261e-001, 6.200146e-001, 6.209030e-001, 6.217911e-001, 6.226750e-001, 6.235588e-001, 6.244423e-001, 6.253234e-001,
+6.262045e-001, 6.270850e-001, 6.279615e-001, 6.288381e-001, 6.297143e-001, 6.305881e-001, 6.314619e-001, 6.323352e-001, 6.332046e-001, 6.340739e-001,
+6.349430e-001, 6.358096e-001, 6.366763e-001, 6.375429e-001, 6.384051e-001, 6.392672e-001, 6.401294e-001, 6.409892e-001, 6.418486e-001, 6.427081e-001,
+6.435642e-001, 6.444192e-001, 6.452743e-001, 6.461277e-001, 6.469801e-001, 6.478325e-001, 6.486829e-001, 6.495309e-001, 6.503789e-001, 6.512263e-001,
+6.520717e-001, 6.529170e-001, 6.537624e-001, 6.546034e-001, 6.554444e-001, 6.562854e-001, 6.571244e-001, 6.579628e-001, 6.588012e-001, 6.596376e-001,
+6.604717e-001, 6.613057e-001, 6.621391e-001, 6.629688e-001, 6.637986e-001, 6.646283e-001, 6.654538e-001, 6.662783e-001, 6.671029e-001, 6.679255e-001,
+6.687459e-001, 6.695662e-001, 6.703862e-001, 6.712016e-001, 6.720169e-001, 6.728322e-001, 6.736438e-001, 6.744531e-001, 6.752625e-001, 6.760708e-001,
+6.768744e-001, 6.776780e-001, 6.784815e-001, 6.792811e-001, 6.800791e-001, 6.808770e-001, 6.816738e-001, 6.824663e-001, 6.832588e-001, 6.840513e-001,
+6.848403e-001, 6.856274e-001, 6.864146e-001, 6.872013e-001, 6.879834e-001, 6.887655e-001, 6.895476e-001, 6.903271e-001, 6.911042e-001, 6.918814e-001,
+6.926585e-001, 6.934314e-001, 6.942037e-001, 6.949761e-001, 6.957474e-001, 6.965151e-001, 6.972828e-001, 6.980505e-001, 6.988149e-001, 6.995765e-001,
+7.003381e-001, 7.010997e-001, 7.018570e-001, 7.026134e-001, 7.033698e-001, 7.041258e-001, 7.048765e-001, 7.056272e-001, 7.063779e-001, 7.071272e-001,
+7.078732e-001, 7.086191e-001, 7.093651e-001, 7.101075e-001, 7.108464e-001, 7.115852e-001, 7.123241e-001, 7.130596e-001, 7.137932e-001, 7.145269e-001,
+7.152605e-001, 7.159892e-001, 7.167164e-001, 7.174435e-001, 7.181707e-001, 7.188939e-001, 7.196165e-001, 7.203391e-001, 7.210617e-001, 7.217788e-001,
+7.224955e-001, 7.232123e-001, 7.239290e-001, 7.246403e-001, 7.253514e-001, 7.260625e-001, 7.267736e-001, 7.274788e-001, 7.281838e-001, 7.288888e-001,
+7.295937e-001, 7.302941e-001, 7.309941e-001, 7.316941e-001, 7.323941e-001, 7.330894e-001, 7.337840e-001, 7.344785e-001, 7.351731e-001, 7.358644e-001,
+7.365546e-001, 7.372448e-001, 7.379350e-001, 7.386223e-001, 7.393077e-001, 7.399932e-001, 7.406786e-001, 7.413617e-001, 7.420418e-001, 7.427219e-001,
+7.434019e-001, 7.440809e-001, 7.447561e-001, 7.454312e-001, 7.461064e-001, 7.467816e-001, 7.474523e-001, 7.481229e-001, 7.487936e-001, 7.494642e-001,
+7.501308e-001, 7.507957e-001, 7.514607e-001, 7.521257e-001, 7.527888e-001, 7.534492e-001, 7.541097e-001, 7.547701e-001, 7.554303e-001, 7.560859e-001,
+7.567415e-001, 7.573971e-001, 7.580528e-001, 7.587060e-001, 7.593580e-001, 7.600100e-001, 7.606620e-001, 7.613126e-001, 7.619590e-001, 7.626055e-001,
+7.632519e-001, 7.638983e-001, 7.645419e-001, 7.651848e-001, 7.658277e-001, 7.664706e-001, 7.671122e-001, 7.677505e-001, 7.683889e-001, 7.690273e-001,
+7.696656e-001, 7.703021e-001, 7.709379e-001, 7.715738e-001, 7.722096e-001, 7.728448e-001, 7.734772e-001, 7.741095e-001, 7.747419e-001, 7.753743e-001,
+7.760048e-001, 7.766341e-001, 7.772634e-001, 7.778927e-001, 7.785220e-001, 7.791474e-001, 7.797725e-001, 7.803977e-001, 7.810228e-001, 7.816470e-001,
+7.822686e-001, 7.828901e-001, 7.835116e-001, 7.841331e-001, 7.847530e-001, 7.853714e-001, 7.859897e-001, 7.866081e-001, 7.872265e-001, 7.878416e-001,
+7.884557e-001, 7.890699e-001, 7.896840e-001, 7.902982e-001, 7.909086e-001, 7.915189e-001, 7.921292e-001, 7.927395e-001, 7.933492e-001, 7.939548e-001,
+7.945603e-001, 7.951658e-001, 7.957714e-001, 7.963758e-001, 7.969770e-001, 7.975782e-001, 7.981793e-001, 7.987805e-001, 7.993802e-001, 7.999768e-001,
+8.005735e-001, 8.011701e-001, 8.017667e-001, 8.023621e-001, 8.029554e-001, 8.035488e-001, 8.041421e-001, 8.047354e-001, 8.053274e-001, 8.059173e-001,
+8.065071e-001, 8.070969e-001, 8.076868e-001, 8.082754e-001, 8.088615e-001, 8.094475e-001, 8.100336e-001, 8.106197e-001, 8.112050e-001, 8.117879e-001,
+8.123708e-001, 8.129537e-001, 8.135366e-001, 8.141192e-001, 8.146996e-001, 8.152799e-001, 8.158602e-001, 8.164405e-001, 8.170208e-001, 8.175972e-001,
+8.181733e-001, 8.187493e-001, 8.193254e-001, 8.199014e-001, 8.204749e-001, 8.210472e-001, 8.216196e-001, 8.221920e-001, 8.227643e-001, 8.233353e-001,
+8.239045e-001, 8.244737e-001, 8.250429e-001, 8.256122e-001, 8.261810e-001, 8.267477e-001, 8.273143e-001, 8.278810e-001, 8.284476e-001, 8.290143e-001,
+8.295775e-001, 8.301398e-001, 8.307022e-001, 8.312645e-001, 8.318268e-001, 8.323877e-001, 8.329463e-001, 8.335049e-001, 8.340635e-001, 8.346221e-001,
+8.351807e-001, 8.357362e-001, 8.362917e-001, 8.368471e-001, 8.374026e-001, 8.379581e-001, 8.385115e-001, 8.390630e-001, 8.396145e-001, 8.401659e-001,
+8.407174e-001, 8.412688e-001, 8.418177e-001, 8.423664e-001, 8.429151e-001, 8.434639e-001, 8.440126e-001, 8.445599e-001, 8.451051e-001, 8.456502e-001,
+8.461954e-001, 8.467405e-001, 8.472856e-001, 8.478285e-001, 8.483706e-001, 8.489128e-001, 8.494549e-001, 8.499971e-001, 8.505388e-001, 8.510770e-001,
+8.516153e-001, 8.521535e-001, 8.526918e-001, 8.532300e-001, 8.537667e-001, 8.543010e-001, 8.548353e-001, 8.553696e-001, 8.559039e-001, 8.564382e-001,
+8.569704e-001, 8.575013e-001, 8.580323e-001, 8.585632e-001, 8.590942e-001, 8.596251e-001, 8.601538e-001, 8.606821e-001, 8.612103e-001, 8.617386e-001,
+8.622668e-001, 8.627951e-001, 8.633205e-001, 8.638459e-001, 8.643713e-001, 8.648967e-001, 8.654221e-001, 8.659473e-001, 8.664698e-001, 8.669922e-001,
+8.675147e-001, 8.680372e-001, 8.685597e-001, 8.690820e-001, 8.696027e-001, 8.701235e-001, 8.706443e-001, 8.711651e-001, 8.716859e-001, 8.722062e-001,
+8.727232e-001, 8.732401e-001, 8.737571e-001, 8.742740e-001, 8.747909e-001, 8.753076e-001, 8.758206e-001, 8.763336e-001, 8.768467e-001, 8.773597e-001,
+8.778727e-001, 8.783857e-001, 8.788955e-001, 8.794052e-001, 8.799149e-001, 8.804246e-001, 8.809342e-001, 8.814439e-001, 8.819514e-001, 8.824584e-001,
+8.829654e-001, 8.834724e-001, 8.839794e-001, 8.844863e-001, 8.849916e-001, 8.854957e-001, 8.859999e-001, 8.865040e-001, 8.870081e-001, 8.875123e-001,
+8.880149e-001, 8.885148e-001, 8.890147e-001, 8.895145e-001, 8.900144e-001, 8.905143e-001, 8.910141e-001, 8.915116e-001, 8.920091e-001, 8.925067e-001,
+8.930042e-001, 8.935017e-001, 8.939992e-001, 8.944947e-001, 8.949893e-001, 8.954838e-001, 8.959784e-001, 8.964729e-001, 8.969675e-001, 8.974613e-001,
+8.979535e-001, 8.984456e-001, 8.989377e-001, 8.994298e-001, 8.999219e-001, 9.004141e-001, 9.009036e-001, 9.013927e-001, 9.018817e-001, 9.023707e-001,
+9.028597e-001, 9.033487e-001, 9.038369e-001, 9.043234e-001, 9.048099e-001, 9.052964e-001, 9.057829e-001, 9.062694e-001, 9.067559e-001, 9.072410e-001,
+9.077256e-001, 9.082101e-001, 9.086947e-001, 9.091793e-001, 9.096639e-001, 9.101482e-001, 9.106302e-001, 9.111121e-001, 9.115941e-001, 9.120761e-001,
+9.125580e-001, 9.130400e-001, 9.135211e-001, 9.140010e-001, 9.144809e-001, 9.149607e-001, 9.154406e-001, 9.159205e-001, 9.164004e-001, 9.168785e-001,
+9.173557e-001, 9.178329e-001, 9.183101e-001, 9.187873e-001, 9.192645e-001, 9.197417e-001, 9.202170e-001, 9.206920e-001, 9.211671e-001, 9.216421e-001,
+9.221172e-001, 9.225922e-001, 9.230672e-001, 9.235394e-001, 9.240116e-001, 9.244838e-001, 9.249560e-001, 9.254282e-001, 9.259004e-001, 9.263724e-001,
+9.268423e-001, 9.273123e-001, 9.277823e-001, 9.282522e-001, 9.287222e-001, 9.291922e-001, 9.296613e-001, 9.301262e-001, 9.305911e-001, 9.310560e-001,
+9.315209e-001, 9.319857e-001, 9.324506e-001, 9.329145e-001, 9.333721e-001, 9.338297e-001, 9.342873e-001, 9.347449e-001, 9.352025e-001, 9.356601e-001,
+9.361174e-001, 9.365685e-001, 9.370197e-001, 9.374709e-001, 9.379221e-001, 9.383733e-001, 9.388244e-001, 9.392756e-001, 9.397230e-001, 9.401701e-001,
+9.406172e-001, 9.410643e-001, 9.415113e-001, 9.419584e-001, 9.424055e-001, 9.428507e-001, 9.432952e-001, 9.437396e-001, 9.441841e-001, 9.446286e-001,
+9.450731e-001, 9.455175e-001, 9.459603e-001, 9.464009e-001, 9.468416e-001, 9.472823e-001, 9.477229e-001, 9.481636e-001, 9.486043e-001, 9.490444e-001,
+9.494813e-001, 9.499182e-001, 9.503551e-001, 9.507919e-001, 9.512288e-001, 9.516657e-001, 9.521026e-001, 9.525366e-001, 9.529696e-001, 9.534026e-001,
+9.538357e-001, 9.542687e-001, 9.547018e-001, 9.551348e-001, 9.555666e-001, 9.559957e-001, 9.564248e-001, 9.568538e-001, 9.572829e-001, 9.577120e-001,
+9.581411e-001, 9.585701e-001, 9.589954e-001, 9.594198e-001, 9.598443e-001, 9.602687e-001, 9.606931e-001, 9.611175e-001, 9.615419e-001, 9.619651e-001,
+9.623844e-001, 9.628037e-001, 9.632230e-001, 9.636424e-001, 9.640617e-001, 9.644810e-001, 9.649003e-001, 9.653163e-001, 9.657304e-001, 9.661444e-001,
+9.665584e-001, 9.669724e-001, 9.673864e-001, 9.678004e-001, 9.682144e-001, 9.686228e-001, 9.690307e-001, 9.694387e-001, 9.698466e-001, 9.702546e-001,
+9.706625e-001, 9.710705e-001, 9.714773e-001, 9.718787e-001, 9.722801e-001, 9.726816e-001, 9.730830e-001, 9.734844e-001, 9.738859e-001, 9.742873e-001,
+9.746861e-001, 9.750802e-001, 9.754743e-001, 9.758684e-001, 9.762625e-001, 9.766566e-001, 9.770507e-001, 9.774448e-001, 9.778347e-001, 9.782199e-001,
+9.786051e-001, 9.789903e-001, 9.793756e-001, 9.797608e-001, 9.801460e-001, 9.805312e-001, 9.809110e-001, 9.812859e-001, 9.816609e-001, 9.820358e-001,
+9.824107e-001, 9.827856e-001, 9.831605e-001, 9.835355e-001, 9.839053e-001, 9.842701e-001, 9.846350e-001, 9.849998e-001, 9.853647e-001, 9.857295e-001,
+9.860944e-001, 9.864593e-001, 9.868194e-001, 9.871732e-001, 9.875269e-001, 9.878807e-001, 9.882345e-001, 9.885883e-001, 9.889420e-001, 9.892958e-001,
+9.896462e-001, 9.899877e-001, 9.903292e-001, 9.906707e-001, 9.910122e-001, 9.913538e-001, 9.916953e-001, 9.920368e-001, 9.923774e-001, 9.927039e-001,
+9.930304e-001, 9.933570e-001, 9.936835e-001, 9.940100e-001, 9.943366e-001, 9.946631e-001, 9.949896e-001, 9.953015e-001, 9.956092e-001, 9.959169e-001,
+9.962245e-001, 9.965322e-001, 9.968399e-001, 9.971476e-001, 9.974552e-001, 9.977517e-001, 9.980327e-001, 9.983137e-001, 9.985948e-001, 9.988758e-001,
+9.991569e-001, 9.994379e-001, 9.997190e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Optima II 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.666176e-003, 1.582627e-002, 2.324118e-002, 3.004895e-002, 3.638528e-002, 4.234607e-002, 4.799330e-002, 5.338343e-002, 5.853626e-002,
+6.348275e-002, 6.824765e-002, 7.286437e-002, 7.734985e-002, 8.172489e-002, 8.600226e-002, 9.018769e-002, 9.428382e-002, 9.830112e-002, 1.022288e-001,
+1.060905e-001, 1.098807e-001, 1.136024e-001, 1.172552e-001, 1.208416e-001, 1.243668e-001, 1.278327e-001, 1.312370e-001, 1.345919e-001, 1.379000e-001,
+1.411582e-001, 1.443776e-001, 1.475483e-001, 1.506752e-001, 1.537552e-001, 1.567965e-001, 1.598031e-001, 1.627652e-001, 1.656908e-001, 1.685829e-001,
+1.714360e-001, 1.742601e-001, 1.770537e-001, 1.798166e-001, 1.825579e-001, 1.852674e-001, 1.879525e-001, 1.906043e-001, 1.932312e-001, 1.958319e-001,
+1.984056e-001, 2.009532e-001, 2.034747e-001, 2.059706e-001, 2.084430e-001, 2.108965e-001, 2.133263e-001, 2.157394e-001, 2.181292e-001, 2.205027e-001,
+2.228585e-001, 2.251935e-001, 2.275122e-001, 2.298127e-001, 2.320973e-001, 2.343687e-001, 2.366248e-001, 2.388661e-001, 2.410929e-001, 2.433025e-001,
+2.454963e-001, 2.476740e-001, 2.498373e-001, 2.519872e-001, 2.541208e-001, 2.562352e-001, 2.583389e-001, 2.604310e-001, 2.625060e-001, 2.645739e-001,
+2.666332e-001, 2.686808e-001, 2.707110e-001, 2.727305e-001, 2.747409e-001, 2.767409e-001, 2.787257e-001, 2.807008e-001, 2.826664e-001, 2.846208e-001,
+2.865644e-001, 2.884986e-001, 2.904250e-001, 2.923448e-001, 2.942551e-001, 2.961547e-001, 2.980457e-001, 2.999280e-001, 3.018029e-001, 3.036679e-001,
+3.055250e-001, 3.073747e-001, 3.092148e-001, 3.110458e-001, 3.128678e-001, 3.146800e-001, 3.164839e-001, 3.182796e-001, 3.200652e-001, 3.218409e-001,
+3.236100e-001, 3.253748e-001, 3.271336e-001, 3.288846e-001, 3.306264e-001, 3.323578e-001, 3.340801e-001, 3.357945e-001, 3.375024e-001, 3.392042e-001,
+3.408982e-001, 3.425840e-001, 3.442628e-001, 3.459351e-001, 3.476001e-001, 3.492591e-001, 3.509126e-001, 3.525592e-001, 3.541981e-001, 3.558302e-001,
+3.574566e-001, 3.590759e-001, 3.606899e-001, 3.622974e-001, 3.638975e-001, 3.654907e-001, 3.670779e-001, 3.686599e-001, 3.702372e-001, 3.718093e-001,
+3.733767e-001, 3.749383e-001, 3.764937e-001, 3.780421e-001, 3.795836e-001, 3.811195e-001, 3.826522e-001, 3.841798e-001, 3.857025e-001, 3.872197e-001,
+3.887315e-001, 3.902386e-001, 3.917382e-001, 3.932329e-001, 3.947236e-001, 3.962103e-001, 3.976925e-001, 3.991701e-001, 4.006436e-001, 4.021127e-001,
+4.035769e-001, 4.050330e-001, 4.064843e-001, 4.079307e-001, 4.093720e-001, 4.108068e-001, 4.122381e-001, 4.136659e-001, 4.150889e-001, 4.165056e-001,
+4.179175e-001, 4.193248e-001, 4.207272e-001, 4.221263e-001, 4.235220e-001, 4.249121e-001, 4.262983e-001, 4.276815e-001, 4.290600e-001, 4.304330e-001,
+4.318027e-001, 4.331686e-001, 4.345290e-001, 4.358858e-001, 4.372373e-001, 4.385837e-001, 4.399270e-001, 4.412652e-001, 4.425976e-001, 4.439268e-001,
+4.452504e-001, 4.465710e-001, 4.478894e-001, 4.492019e-001, 4.505116e-001, 4.518171e-001, 4.531183e-001, 4.544177e-001, 4.557137e-001, 4.570072e-001,
+4.582982e-001, 4.595845e-001, 4.608688e-001, 4.621477e-001, 4.634241e-001, 4.646979e-001, 4.659670e-001, 4.672344e-001, 4.684959e-001, 4.697547e-001,
+4.710090e-001, 4.722595e-001, 4.735080e-001, 4.747509e-001, 4.759922e-001, 4.772274e-001, 4.784608e-001, 4.796907e-001, 4.809171e-001, 4.821407e-001,
+4.833608e-001, 4.845796e-001, 4.857936e-001, 4.870069e-001, 4.882165e-001, 4.894252e-001, 4.906301e-001, 4.918332e-001, 4.930330e-001, 4.942300e-001,
+4.954236e-001, 4.966148e-001, 4.978039e-001, 4.989897e-001, 5.001737e-001, 5.013538e-001, 5.025321e-001, 5.037058e-001, 5.048780e-001, 5.060449e-001,
+5.072103e-001, 5.083714e-001, 5.095314e-001, 5.106869e-001, 5.118412e-001, 5.129907e-001, 5.141387e-001, 5.152818e-001, 5.164233e-001, 5.175597e-001,
+5.186939e-001, 5.198234e-001, 5.209501e-001, 5.220734e-001, 5.231939e-001, 5.243116e-001, 5.254258e-001, 5.265378e-001, 5.276451e-001, 5.287511e-001,
+5.298516e-001, 5.309518e-001, 5.320447e-001, 5.331376e-001, 5.342239e-001, 5.353094e-001, 5.363905e-001, 5.374696e-001, 5.385464e-001, 5.396207e-001,
+5.406937e-001, 5.417629e-001, 5.428320e-001, 5.438956e-001, 5.449593e-001, 5.460200e-001, 5.470796e-001, 5.481380e-001, 5.491948e-001, 5.502512e-001,
+5.513053e-001, 5.523593e-001, 5.534104e-001, 5.544610e-001, 5.555099e-001, 5.565570e-001, 5.576035e-001, 5.586465e-001, 5.596894e-001, 5.607293e-001,
+5.617681e-001, 5.628053e-001, 5.638393e-001, 5.648734e-001, 5.659030e-001, 5.669323e-001, 5.679588e-001, 5.689827e-001, 5.700063e-001, 5.710248e-001,
+5.720432e-001, 5.730582e-001, 5.740706e-001, 5.750827e-001, 5.760907e-001, 5.770988e-001, 5.781042e-001, 5.791074e-001, 5.801107e-001, 5.811091e-001,
+5.821076e-001, 5.831037e-001, 5.840969e-001, 5.850901e-001, 5.860803e-001, 5.870699e-001, 5.880585e-001, 5.890444e-001, 5.900302e-001, 5.910136e-001,
+5.919955e-001, 5.929774e-001, 5.939553e-001, 5.949331e-001, 5.959096e-001, 5.968832e-001, 5.978568e-001, 5.988277e-001, 5.997969e-001, 6.007661e-001,
+6.017311e-001, 6.026958e-001, 6.036597e-001, 6.046196e-001, 6.055796e-001, 6.065376e-001, 6.074927e-001, 6.084479e-001, 6.093999e-001, 6.103501e-001,
+6.113002e-001, 6.122449e-001, 6.131884e-001, 6.141320e-001, 6.150689e-001, 6.160059e-001, 6.169418e-001, 6.178719e-001, 6.188020e-001, 6.197304e-001,
+6.206537e-001, 6.215771e-001, 6.224973e-001, 6.234119e-001, 6.243265e-001, 6.252374e-001, 6.261437e-001, 6.270500e-001, 6.279520e-001, 6.288497e-001,
+6.297473e-001, 6.306408e-001, 6.315302e-001, 6.324197e-001, 6.333048e-001, 6.341858e-001, 6.350668e-001, 6.359439e-001, 6.368169e-001, 6.376898e-001,
+6.385591e-001, 6.394238e-001, 6.402885e-001, 6.411507e-001, 6.420088e-001, 6.428670e-001, 6.437233e-001, 6.445748e-001, 6.454263e-001, 6.462769e-001,
+6.471220e-001, 6.479671e-001, 6.488122e-001, 6.496509e-001, 6.504895e-001, 6.513282e-001, 6.521630e-001, 6.529971e-001, 6.538311e-001, 6.546624e-001,
+6.554920e-001, 6.563216e-001, 6.571496e-001, 6.579749e-001, 6.588003e-001, 6.596251e-001, 6.604463e-001, 6.612676e-001, 6.620888e-001, 6.629067e-001,
+6.637240e-001, 6.645414e-001, 6.653566e-001, 6.661702e-001, 6.669837e-001, 6.677965e-001, 6.686064e-001, 6.694163e-001, 6.702262e-001, 6.710332e-001,
+6.718396e-001, 6.726461e-001, 6.734504e-001, 6.742520e-001, 6.750536e-001, 6.758551e-001, 6.766522e-001, 6.774494e-001, 6.782465e-001, 6.790412e-001,
+6.798340e-001, 6.806267e-001, 6.814192e-001, 6.822079e-001, 6.829967e-001, 6.837855e-001, 6.845712e-001, 6.853545e-001, 6.861379e-001, 6.869211e-001,
+6.876997e-001, 6.884783e-001, 6.892568e-001, 6.900331e-001, 6.908069e-001, 6.915807e-001, 6.923545e-001, 6.931246e-001, 6.938942e-001, 6.946637e-001,
+6.954323e-001, 6.961977e-001, 6.969630e-001, 6.977284e-001, 6.984917e-001, 6.992535e-001, 7.000153e-001, 7.007771e-001, 7.015356e-001, 7.022938e-001,
+7.030520e-001, 7.038097e-001, 7.045649e-001, 7.053201e-001, 7.060752e-001, 7.068291e-001, 7.075813e-001, 7.083335e-001, 7.090857e-001, 7.098354e-001,
+7.105838e-001, 7.113321e-001, 7.120805e-001, 7.128258e-001, 7.135706e-001, 7.143153e-001, 7.150601e-001, 7.158017e-001, 7.165433e-001, 7.172849e-001,
+7.180262e-001, 7.187648e-001, 7.195035e-001, 7.202422e-001, 7.209800e-001, 7.217147e-001, 7.224494e-001, 7.231841e-001, 7.239175e-001, 7.246473e-001,
+7.253772e-001, 7.261071e-001, 7.268355e-001, 7.275608e-001, 7.282860e-001, 7.290112e-001, 7.297352e-001, 7.304564e-001, 7.311775e-001, 7.318987e-001,
+7.326188e-001, 7.333360e-001, 7.340533e-001, 7.347706e-001, 7.354867e-001, 7.361979e-001, 7.369092e-001, 7.376204e-001, 7.383311e-001, 7.390366e-001,
+7.397420e-001, 7.404474e-001, 7.411528e-001, 7.418531e-001, 7.425532e-001, 7.432533e-001, 7.439533e-001, 7.446493e-001, 7.453442e-001, 7.460391e-001,
+7.467340e-001, 7.474263e-001, 7.481165e-001, 7.488067e-001, 7.494969e-001, 7.501856e-001, 7.508713e-001, 7.515570e-001, 7.522428e-001, 7.529282e-001,
+7.536085e-001, 7.542889e-001, 7.549692e-001, 7.556495e-001, 7.563262e-001, 7.570016e-001, 7.576769e-001, 7.583523e-001, 7.590259e-001, 7.596967e-001,
+7.603675e-001, 7.610384e-001, 7.617092e-001, 7.623745e-001, 7.630399e-001, 7.637053e-001, 7.643706e-001, 7.650332e-001, 7.656937e-001, 7.663542e-001,
+7.670148e-001, 7.676747e-001, 7.683307e-001, 7.689867e-001, 7.696426e-001, 7.702986e-001, 7.709521e-001, 7.716042e-001, 7.722562e-001, 7.729082e-001,
+7.735598e-001, 7.742068e-001, 7.748538e-001, 7.755009e-001, 7.761479e-001, 7.767928e-001, 7.774356e-001, 7.780784e-001, 7.787213e-001, 7.793641e-001,
+7.800034e-001, 7.806423e-001, 7.812812e-001, 7.819201e-001, 7.825579e-001, 7.831924e-001, 7.838269e-001, 7.844615e-001, 7.850960e-001, 7.857282e-001,
+7.863587e-001, 7.869893e-001, 7.876198e-001, 7.882504e-001, 7.888781e-001, 7.895054e-001, 7.901326e-001, 7.907598e-001, 7.913867e-001, 7.920100e-001,
+7.926332e-001, 7.932564e-001, 7.938796e-001, 7.945018e-001, 7.951214e-001, 7.957411e-001, 7.963608e-001, 7.969804e-001, 7.975988e-001, 7.982154e-001,
+7.988320e-001, 7.994486e-001, 8.000653e-001, 8.006798e-001, 8.012926e-001, 8.019054e-001, 8.025182e-001, 8.031310e-001, 8.037403e-001, 8.043475e-001,
+8.049547e-001, 8.055619e-001, 8.061691e-001, 8.067730e-001, 8.073750e-001, 8.079771e-001, 8.085792e-001, 8.091813e-001, 8.097804e-001, 8.103780e-001,
+8.109756e-001, 8.115732e-001, 8.121708e-001, 8.127659e-001, 8.133595e-001, 8.139530e-001, 8.145466e-001, 8.151401e-001, 8.157312e-001, 8.163201e-001,
+8.169090e-001, 8.174979e-001, 8.180868e-001, 8.186741e-001, 8.192589e-001, 8.198438e-001, 8.204286e-001, 8.210135e-001, 8.215976e-001, 8.221790e-001,
+8.227605e-001, 8.233419e-001, 8.239233e-001, 8.245047e-001, 8.250822e-001, 8.256596e-001, 8.262370e-001, 8.268144e-001, 8.273919e-001, 8.279669e-001,
+8.285411e-001, 8.291153e-001, 8.296894e-001, 8.302636e-001, 8.308362e-001, 8.314065e-001, 8.319768e-001, 8.325471e-001, 8.331175e-001, 8.336875e-001,
+8.342546e-001, 8.348217e-001, 8.353888e-001, 8.359558e-001, 8.365229e-001, 8.370873e-001, 8.376505e-001, 8.382137e-001, 8.387768e-001, 8.393400e-001,
+8.399021e-001, 8.404610e-001, 8.410199e-001, 8.415788e-001, 8.421378e-001, 8.426967e-001, 8.432520e-001, 8.438061e-001, 8.443603e-001, 8.449145e-001,
+8.454686e-001, 8.460218e-001, 8.465717e-001, 8.471217e-001, 8.476716e-001, 8.482215e-001, 8.487715e-001, 8.493191e-001, 8.498655e-001, 8.504120e-001,
+8.509584e-001, 8.515049e-001, 8.520512e-001, 8.525947e-001, 8.531381e-001, 8.536815e-001, 8.542250e-001, 8.547684e-001, 8.553110e-001, 8.558522e-001,
+8.563934e-001, 8.569346e-001, 8.574758e-001, 8.580170e-001, 8.585556e-001, 8.590928e-001, 8.596300e-001, 8.601672e-001, 8.607044e-001, 8.612417e-001,
+8.617750e-001, 8.623078e-001, 8.628407e-001, 8.633736e-001, 8.639064e-001, 8.644390e-001, 8.649681e-001, 8.654973e-001, 8.660264e-001, 8.665556e-001,
+8.670848e-001, 8.676132e-001, 8.681394e-001, 8.686655e-001, 8.691916e-001, 8.697177e-001, 8.702438e-001, 8.707692e-001, 8.712929e-001, 8.718167e-001,
+8.723404e-001, 8.728641e-001, 8.733879e-001, 8.739106e-001, 8.744314e-001, 8.749523e-001, 8.754731e-001, 8.759940e-001, 8.765148e-001, 8.770342e-001,
+8.775508e-001, 8.780674e-001, 8.785841e-001, 8.791007e-001, 8.796173e-001, 8.801329e-001, 8.806459e-001, 8.811589e-001, 8.816719e-001, 8.821849e-001,
+8.826979e-001, 8.832104e-001, 8.837205e-001, 8.842307e-001, 8.847409e-001, 8.852511e-001, 8.857613e-001, 8.862714e-001, 8.867783e-001, 8.872852e-001,
+8.877921e-001, 8.882990e-001, 8.888060e-001, 8.893129e-001, 8.898167e-001, 8.903199e-001, 8.908231e-001, 8.913263e-001, 8.918295e-001, 8.923327e-001,
+8.928336e-001, 8.933328e-001, 8.938320e-001, 8.943311e-001, 8.948303e-001, 8.953295e-001, 8.958279e-001, 8.963238e-001, 8.968197e-001, 8.973157e-001,
+8.978116e-001, 8.983076e-001, 8.988035e-001, 8.992963e-001, 8.997886e-001, 9.002810e-001, 9.007734e-001, 9.012657e-001, 9.017581e-001, 9.022490e-001,
+9.027384e-001, 9.032277e-001, 9.037171e-001, 9.042065e-001, 9.046958e-001, 9.051852e-001, 9.056712e-001, 9.061573e-001, 9.066433e-001, 9.071293e-001,
+9.076154e-001, 9.081014e-001, 9.085853e-001, 9.090667e-001, 9.095481e-001, 9.100296e-001, 9.105110e-001, 9.109924e-001, 9.114739e-001, 9.119518e-001,
+9.124294e-001, 9.129070e-001, 9.133846e-001, 9.138621e-001, 9.143397e-001, 9.148164e-001, 9.152908e-001, 9.157652e-001, 9.162396e-001, 9.167140e-001,
+9.171885e-001, 9.176629e-001, 9.181353e-001, 9.186062e-001, 9.190772e-001, 9.195482e-001, 9.200191e-001, 9.204901e-001, 9.209611e-001, 9.214289e-001,
+9.218962e-001, 9.223635e-001, 9.228308e-001, 9.232981e-001, 9.237653e-001, 9.242325e-001, 9.246969e-001, 9.251613e-001, 9.256257e-001, 9.260901e-001,
+9.265545e-001, 9.270189e-001, 9.274828e-001, 9.279441e-001, 9.284055e-001, 9.288668e-001, 9.293281e-001, 9.297895e-001, 9.302508e-001, 9.307110e-001,
+9.311681e-001, 9.316251e-001, 9.320822e-001, 9.325393e-001, 9.329963e-001, 9.334534e-001, 9.339086e-001, 9.343594e-001, 9.348102e-001, 9.352610e-001,
+9.357118e-001, 9.361626e-001, 9.366134e-001, 9.370620e-001, 9.375048e-001, 9.379476e-001, 9.383904e-001, 9.388332e-001, 9.392760e-001, 9.397188e-001,
+9.401605e-001, 9.405970e-001, 9.410336e-001, 9.414702e-001, 9.419068e-001, 9.423433e-001, 9.427799e-001, 9.432163e-001, 9.436482e-001, 9.440802e-001,
+9.445121e-001, 9.449441e-001, 9.453760e-001, 9.458079e-001, 9.462399e-001, 9.466684e-001, 9.470963e-001, 9.475241e-001, 9.479520e-001, 9.483798e-001,
+9.488077e-001, 9.492355e-001, 9.496610e-001, 9.500847e-001, 9.505084e-001, 9.509321e-001, 9.513558e-001, 9.517795e-001, 9.522032e-001, 9.526257e-001,
+9.530443e-001, 9.534629e-001, 9.538815e-001, 9.543001e-001, 9.547187e-001, 9.551373e-001, 9.555559e-001, 9.559701e-001, 9.563836e-001, 9.567971e-001,
+9.572105e-001, 9.576240e-001, 9.580375e-001, 9.584510e-001, 9.588623e-001, 9.592704e-001, 9.596786e-001, 9.600868e-001, 9.604950e-001, 9.609032e-001,
+9.613114e-001, 9.617196e-001, 9.621226e-001, 9.625252e-001, 9.629278e-001, 9.633303e-001, 9.637329e-001, 9.641355e-001, 9.645380e-001, 9.649384e-001,
+9.653344e-001, 9.657305e-001, 9.661265e-001, 9.665225e-001, 9.669185e-001, 9.673146e-001, 9.677106e-001, 9.681017e-001, 9.684907e-001, 9.688798e-001,
+9.692688e-001, 9.696579e-001, 9.700469e-001, 9.704359e-001, 9.708249e-001, 9.712070e-001, 9.715890e-001, 9.719711e-001, 9.723531e-001, 9.727351e-001,
+9.731172e-001, 9.734992e-001, 9.738795e-001, 9.742544e-001, 9.746293e-001, 9.750042e-001, 9.753791e-001, 9.757540e-001, 9.761289e-001, 9.765038e-001,
+9.768755e-001, 9.772428e-001, 9.776101e-001, 9.779774e-001, 9.783447e-001, 9.787119e-001, 9.790792e-001, 9.794465e-001, 9.798092e-001, 9.801679e-001,
+9.805266e-001, 9.808852e-001, 9.812439e-001, 9.816026e-001, 9.819613e-001, 9.823199e-001, 9.826725e-001, 9.830206e-001, 9.833687e-001, 9.837167e-001,
+9.840648e-001, 9.844129e-001, 9.847609e-001, 9.851090e-001, 9.854506e-001, 9.857869e-001, 9.861232e-001, 9.864595e-001, 9.867958e-001, 9.871321e-001,
+9.874684e-001, 9.878047e-001, 9.881357e-001, 9.884604e-001, 9.887851e-001, 9.891097e-001, 9.894344e-001, 9.897591e-001, 9.900838e-001, 9.904085e-001,
+9.907291e-001, 9.910403e-001, 9.913515e-001, 9.916628e-001, 9.919740e-001, 9.922852e-001, 9.925965e-001, 9.929077e-001, 9.932176e-001, 9.935123e-001,
+9.938071e-001, 9.941018e-001, 9.943966e-001, 9.946913e-001, 9.949861e-001, 9.952808e-001, 9.955756e-001, 9.958525e-001, 9.961247e-001, 9.963968e-001,
+9.966690e-001, 9.969412e-001, 9.972134e-001, 9.974856e-001, 9.977577e-001, 9.980193e-001, 9.982669e-001, 9.985145e-001, 9.987621e-001, 9.990097e-001,
+9.992572e-001, 9.995048e-001, 9.997524e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.326850e-003, 1.704178e-002, 2.503225e-002, 3.232814e-002, 3.906354e-002, 4.534250e-002, 5.123491e-002, 5.678686e-002, 6.204526e-002,
+6.706643e-002, 7.190862e-002, 7.661092e-002, 8.121858e-002, 8.573668e-002, 9.018166e-002, 9.454591e-002, 9.884293e-002, 1.030736e-001, 1.072389e-001,
+1.113395e-001, 1.153889e-001, 1.193717e-001, 1.232964e-001, 1.271591e-001, 1.309626e-001, 1.347210e-001, 1.384247e-001, 1.420658e-001, 1.456594e-001,
+1.492090e-001, 1.527009e-001, 1.561467e-001, 1.595403e-001, 1.628802e-001, 1.661710e-001, 1.694163e-001, 1.726270e-001, 1.757915e-001, 1.789051e-001,
+1.819735e-001, 1.850047e-001, 1.879997e-001, 1.909551e-001, 1.938707e-001, 1.967559e-001, 1.996031e-001, 2.024183e-001, 2.052014e-001, 2.079581e-001,
+2.106811e-001, 2.133825e-001, 2.160582e-001, 2.187005e-001, 2.213201e-001, 2.239086e-001, 2.264758e-001, 2.290169e-001, 2.315328e-001, 2.340239e-001,
+2.364936e-001, 2.389386e-001, 2.413555e-001, 2.437552e-001, 2.461319e-001, 2.484831e-001, 2.508153e-001, 2.531289e-001, 2.554251e-001, 2.577020e-001,
+2.599579e-001, 2.621992e-001, 2.644275e-001, 2.666364e-001, 2.688264e-001, 2.710014e-001, 2.731583e-001, 2.752990e-001, 2.774248e-001, 2.795382e-001,
+2.816390e-001, 2.837244e-001, 2.857917e-001, 2.878477e-001, 2.898918e-001, 2.919229e-001, 2.939389e-001, 2.959418e-001, 2.979333e-001, 2.999133e-001,
+3.018836e-001, 3.038400e-001, 3.057815e-001, 3.077118e-001, 3.096336e-001, 3.115449e-001, 3.134449e-001, 3.153319e-001, 3.172087e-001, 3.190751e-001,
+3.209313e-001, 3.227780e-001, 3.246139e-001, 3.264398e-001, 3.282575e-001, 3.300666e-001, 3.318658e-001, 3.336553e-001, 3.354373e-001, 3.372117e-001,
+3.389772e-001, 3.407320e-001, 3.424785e-001, 3.442191e-001, 3.459519e-001, 3.476763e-001, 3.493919e-001, 3.511009e-001, 3.528040e-001, 3.545002e-001,
+3.561894e-001, 3.578725e-001, 3.595486e-001, 3.612181e-001, 3.628816e-001, 3.645391e-001, 3.661914e-001, 3.678378e-001, 3.694777e-001, 3.711101e-001,
+3.727348e-001, 3.743531e-001, 3.759661e-001, 3.775736e-001, 3.791749e-001, 3.807714e-001, 3.823625e-001, 3.839489e-001, 3.855311e-001, 3.871084e-001,
+3.886805e-001, 3.902453e-001, 3.918036e-001, 3.933547e-001, 3.948993e-001, 3.964387e-001, 3.979739e-001, 3.995030e-001, 4.010265e-001, 4.025440e-001,
+4.040570e-001, 4.055673e-001, 4.070734e-001, 4.085751e-001, 4.100723e-001, 4.115647e-001, 4.130523e-001, 4.145321e-001, 4.160075e-001, 4.174784e-001,
+4.189446e-001, 4.204040e-001, 4.218592e-001, 4.233103e-001, 4.247572e-001, 4.261993e-001, 4.276376e-001, 4.290730e-001, 4.305058e-001, 4.319340e-001,
+4.333589e-001, 4.347806e-001, 4.361965e-001, 4.376091e-001, 4.390188e-001, 4.404246e-001, 4.418255e-001, 4.432229e-001, 4.446160e-001, 4.460027e-001,
+4.473863e-001, 4.487665e-001, 4.501408e-001, 4.515125e-001, 4.528812e-001, 4.542450e-001, 4.556061e-001, 4.569629e-001, 4.583144e-001, 4.596637e-001,
+4.610107e-001, 4.623552e-001, 4.636983e-001, 4.650373e-001, 4.663740e-001, 4.677081e-001, 4.690375e-001, 4.703648e-001, 4.716872e-001, 4.730058e-001,
+4.743215e-001, 4.756304e-001, 4.769367e-001, 4.782372e-001, 4.795338e-001, 4.808278e-001, 4.821158e-001, 4.834017e-001, 4.846814e-001, 4.859576e-001,
+4.872295e-001, 4.884984e-001, 4.897660e-001, 4.910294e-001, 4.922915e-001, 4.935493e-001, 4.948049e-001, 4.960573e-001, 4.973073e-001, 4.985556e-001,
+4.998003e-001, 5.010440e-001, 5.022827e-001, 5.035204e-001, 5.047531e-001, 5.059841e-001, 5.072105e-001, 5.084348e-001, 5.096562e-001, 5.108749e-001,
+5.120911e-001, 5.133035e-001, 5.145137e-001, 5.157195e-001, 5.169236e-001, 5.181237e-001, 5.193228e-001, 5.205179e-001, 5.217122e-001, 5.229015e-001,
+5.240900e-001, 5.252737e-001, 5.264567e-001, 5.276340e-001, 5.288106e-001, 5.299818e-001, 5.311521e-001, 5.323164e-001, 5.334796e-001, 5.346373e-001,
+5.357935e-001, 5.369442e-001, 5.380925e-001, 5.392372e-001, 5.403798e-001, 5.415190e-001, 5.426552e-001, 5.437888e-001, 5.449187e-001, 5.460467e-001,
+5.471696e-001, 5.482918e-001, 5.494079e-001, 5.505240e-001, 5.516330e-001, 5.527416e-001, 5.538460e-001, 5.549491e-001, 5.560490e-001, 5.571463e-001,
+5.582417e-001, 5.593331e-001, 5.604241e-001, 5.615095e-001, 5.625948e-001, 5.636752e-001, 5.647544e-001, 5.658313e-001, 5.669061e-001, 5.679799e-001,
+5.690499e-001, 5.701199e-001, 5.711856e-001, 5.722508e-001, 5.733130e-001, 5.743729e-001, 5.754317e-001, 5.764863e-001, 5.775409e-001, 5.785907e-001,
+5.796395e-001, 5.806865e-001, 5.817313e-001, 5.827760e-001, 5.838159e-001, 5.848558e-001, 5.858928e-001, 5.869278e-001, 5.879621e-001, 5.889920e-001,
+5.900218e-001, 5.910484e-001, 5.920731e-001, 5.930970e-001, 5.941163e-001, 5.951357e-001, 5.961516e-001, 5.971654e-001, 5.981787e-001, 5.991875e-001,
+6.001963e-001, 6.012021e-001, 6.022053e-001, 6.032085e-001, 6.042071e-001, 6.052053e-001, 6.062016e-001, 6.071943e-001, 6.081869e-001, 6.091760e-001,
+6.101637e-001, 6.111511e-001, 6.121332e-001, 6.131153e-001, 6.140955e-001, 6.150727e-001, 6.160499e-001, 6.170232e-001, 6.179949e-001, 6.189666e-001,
+6.199334e-001, 6.209002e-001, 6.218656e-001, 6.228269e-001, 6.237882e-001, 6.247472e-001, 6.257036e-001, 6.266600e-001, 6.276127e-001, 6.285637e-001,
+6.295147e-001, 6.304615e-001, 6.314077e-001, 6.323535e-001, 6.332944e-001, 6.342352e-001, 6.351751e-001, 6.361112e-001, 6.370473e-001, 6.379816e-001,
+6.389124e-001, 6.398432e-001, 6.407720e-001, 6.416980e-001, 6.426241e-001, 6.435476e-001, 6.444684e-001, 6.453893e-001, 6.463076e-001, 6.472238e-001,
+6.481400e-001, 6.490532e-001, 6.499642e-001, 6.508752e-001, 6.517836e-001, 6.526900e-001, 6.535964e-001, 6.545000e-001, 6.554013e-001, 6.563026e-001,
+6.572016e-001, 6.580983e-001, 6.589951e-001, 6.598896e-001, 6.607813e-001, 6.616729e-001, 6.625625e-001, 6.634480e-001, 6.643334e-001, 6.652175e-001,
+6.660966e-001, 6.669757e-001, 6.678544e-001, 6.687275e-001, 6.696006e-001, 6.704737e-001, 6.713413e-001, 6.722082e-001, 6.730751e-001, 6.739378e-001,
+6.747987e-001, 6.756595e-001, 6.765179e-001, 6.773732e-001, 6.782285e-001, 6.790827e-001, 6.799325e-001, 6.807822e-001, 6.816320e-001, 6.824772e-001,
+6.833220e-001, 6.841667e-001, 6.850084e-001, 6.858482e-001, 6.866879e-001, 6.875264e-001, 6.883616e-001, 6.891968e-001, 6.900320e-001, 6.908645e-001,
+6.916966e-001, 6.925287e-001, 6.933589e-001, 6.941872e-001, 6.950154e-001, 6.958434e-001, 6.966665e-001, 6.974896e-001, 6.983127e-001, 6.991328e-001,
+6.999511e-001, 7.007693e-001, 7.015869e-001, 7.024006e-001, 7.032143e-001, 7.040280e-001, 7.048390e-001, 7.056484e-001, 7.064578e-001, 7.072668e-001,
+7.080709e-001, 7.088749e-001, 7.096790e-001, 7.104794e-001, 7.112765e-001, 7.120736e-001, 7.128707e-001, 7.136621e-001, 7.144530e-001, 7.152440e-001,
+7.160330e-001, 7.168176e-001, 7.176023e-001, 7.183870e-001, 7.191671e-001, 7.199448e-001, 7.207225e-001, 7.215002e-001, 7.222713e-001, 7.230421e-001,
+7.238130e-001, 7.245823e-001, 7.253469e-001, 7.261116e-001, 7.268762e-001, 7.276378e-001, 7.283964e-001, 7.291549e-001, 7.299135e-001, 7.306681e-001,
+7.314211e-001, 7.321742e-001, 7.329273e-001, 7.336755e-001, 7.344233e-001, 7.351710e-001, 7.359183e-001, 7.366598e-001, 7.374012e-001, 7.381426e-001,
+7.388827e-001, 7.396168e-001, 7.403510e-001, 7.410852e-001, 7.418175e-001, 7.425451e-001, 7.432727e-001, 7.440003e-001, 7.447258e-001, 7.454472e-001,
+7.461685e-001, 7.468899e-001, 7.476092e-001, 7.483250e-001, 7.490409e-001, 7.497567e-001, 7.504706e-001, 7.511812e-001, 7.518918e-001, 7.526023e-001,
+7.533114e-001, 7.540175e-001, 7.547235e-001, 7.554296e-001, 7.561342e-001, 7.568344e-001, 7.575347e-001, 7.582349e-001, 7.589343e-001, 7.596284e-001,
+7.603225e-001, 7.610166e-001, 7.617106e-001, 7.623990e-001, 7.630873e-001, 7.637757e-001, 7.644640e-001, 7.651483e-001, 7.658317e-001, 7.665151e-001,
+7.671986e-001, 7.678792e-001, 7.685581e-001, 7.692371e-001, 7.699160e-001, 7.705929e-001, 7.712667e-001, 7.719404e-001, 7.726142e-001, 7.732873e-001,
+7.739552e-001, 7.746231e-001, 7.752910e-001, 7.759589e-001, 7.766230e-001, 7.772860e-001, 7.779490e-001, 7.786121e-001, 7.792727e-001, 7.799301e-001,
+7.805876e-001, 7.812450e-001, 7.819022e-001, 7.825548e-001, 7.832074e-001, 7.838600e-001, 7.845125e-001, 7.851625e-001, 7.858108e-001, 7.864592e-001,
+7.871076e-001, 7.877553e-001, 7.884002e-001, 7.890450e-001, 7.896899e-001, 7.903347e-001, 7.909758e-001, 7.916151e-001, 7.922543e-001, 7.928935e-001,
+7.935319e-001, 7.941649e-001, 7.947978e-001, 7.954308e-001, 7.960638e-001, 7.966937e-001, 7.973213e-001, 7.979490e-001, 7.985766e-001, 7.992042e-001,
+7.998272e-001, 8.004500e-001, 8.010728e-001, 8.016955e-001, 8.023167e-001, 8.029343e-001, 8.035518e-001, 8.041694e-001, 8.047869e-001, 8.054008e-001,
+8.060125e-001, 8.066242e-001, 8.072359e-001, 8.078476e-001, 8.084549e-001, 8.090618e-001, 8.096686e-001, 8.102755e-001, 8.108817e-001, 8.114831e-001,
+8.120846e-001, 8.126861e-001, 8.132876e-001, 8.138876e-001, 8.144845e-001, 8.150814e-001, 8.156783e-001, 8.162752e-001, 8.168697e-001, 8.174615e-001,
+8.180533e-001, 8.186451e-001, 8.192369e-001, 8.198254e-001, 8.204118e-001, 8.209981e-001, 8.215845e-001, 8.221708e-001, 8.227541e-001, 8.233358e-001,
+8.239176e-001, 8.244994e-001, 8.250811e-001, 8.256603e-001, 8.262383e-001, 8.268164e-001, 8.273945e-001, 8.279725e-001, 8.285468e-001, 8.291194e-001,
+8.296921e-001, 8.302647e-001, 8.308374e-001, 8.314062e-001, 8.319731e-001, 8.325399e-001, 8.331068e-001, 8.336737e-001, 8.342379e-001, 8.348001e-001,
+8.353623e-001, 8.359245e-001, 8.364867e-001, 8.370468e-001, 8.376039e-001, 8.381611e-001, 8.387182e-001, 8.392754e-001, 8.398312e-001, 8.403829e-001,
+8.409347e-001, 8.414865e-001, 8.420382e-001, 8.425898e-001, 8.431359e-001, 8.436820e-001, 8.442281e-001, 8.447742e-001, 8.453204e-001, 8.458629e-001,
+8.464043e-001, 8.469458e-001, 8.474872e-001, 8.480286e-001, 8.485684e-001, 8.491061e-001, 8.496438e-001, 8.501815e-001, 8.507192e-001, 8.512565e-001,
+8.517902e-001, 8.523238e-001, 8.528575e-001, 8.533911e-001, 8.539248e-001, 8.544546e-001, 8.549831e-001, 8.555115e-001, 8.560399e-001, 8.565683e-001,
+8.570952e-001, 8.576182e-001, 8.581411e-001, 8.586641e-001, 8.591871e-001, 8.597100e-001, 8.602294e-001, 8.607479e-001, 8.612663e-001, 8.617848e-001,
+8.623032e-001, 8.628204e-001, 8.633341e-001, 8.638478e-001, 8.643614e-001, 8.648751e-001, 8.653888e-001, 8.658991e-001, 8.664079e-001, 8.669168e-001,
+8.674256e-001, 8.679344e-001, 8.684429e-001, 8.689479e-001, 8.694529e-001, 8.699579e-001, 8.704628e-001, 8.709678e-001, 8.714712e-001, 8.719722e-001,
+8.724732e-001, 8.729743e-001, 8.734753e-001, 8.739763e-001, 8.744739e-001, 8.749698e-001, 8.754657e-001, 8.759617e-001, 8.764576e-001, 8.769536e-001,
+8.774447e-001, 8.779354e-001, 8.784261e-001, 8.789168e-001, 8.794075e-001, 8.798976e-001, 8.803830e-001, 8.808684e-001, 8.813538e-001, 8.818392e-001,
+8.823246e-001, 8.828087e-001, 8.832887e-001, 8.837688e-001, 8.842489e-001, 8.847289e-001, 8.852090e-001, 8.856876e-001, 8.861635e-001, 8.866394e-001,
+8.871152e-001, 8.875911e-001, 8.880670e-001, 8.885408e-001, 8.890114e-001, 8.894819e-001, 8.899525e-001, 8.904231e-001, 8.908936e-001, 8.913617e-001,
+8.918259e-001, 8.922900e-001, 8.927541e-001, 8.932182e-001, 8.936823e-001, 8.941447e-001, 8.946035e-001, 8.950623e-001, 8.955211e-001, 8.959800e-001,
+8.964388e-001, 8.968967e-001, 8.973513e-001, 8.978059e-001, 8.982605e-001, 8.987151e-001, 8.991697e-001, 8.996242e-001, 9.000757e-001, 9.005272e-001,
+9.009787e-001, 9.014302e-001, 9.018817e-001, 9.023333e-001, 9.027821e-001, 9.032304e-001, 9.036787e-001, 9.041271e-001, 9.045754e-001, 9.050237e-001,
+9.054703e-001, 9.059156e-001, 9.063610e-001, 9.068063e-001, 9.072516e-001, 9.076969e-001, 9.081415e-001, 9.085839e-001, 9.090263e-001, 9.094687e-001,
+9.099111e-001, 9.103535e-001, 9.107959e-001, 9.112346e-001, 9.116730e-001, 9.121113e-001, 9.125497e-001, 9.129880e-001, 9.134263e-001, 9.138627e-001,
+9.142972e-001, 9.147317e-001, 9.151661e-001, 9.156006e-001, 9.160350e-001, 9.164694e-001, 9.169011e-001, 9.173327e-001, 9.177644e-001, 9.181961e-001,
+9.186278e-001, 9.190594e-001, 9.194893e-001, 9.199173e-001, 9.203454e-001, 9.207734e-001, 9.212014e-001, 9.216295e-001, 9.220575e-001, 9.224803e-001,
+9.229027e-001, 9.233251e-001, 9.237475e-001, 9.241698e-001, 9.245922e-001, 9.250133e-001, 9.254313e-001, 9.258493e-001, 9.262673e-001, 9.266854e-001,
+9.271034e-001, 9.275214e-001, 9.279374e-001, 9.283521e-001, 9.287667e-001, 9.291814e-001, 9.295961e-001, 9.300108e-001, 9.304254e-001, 9.308365e-001,
+9.312470e-001, 9.316575e-001, 9.320680e-001, 9.324785e-001, 9.328890e-001, 9.332993e-001, 9.337061e-001, 9.341129e-001, 9.345198e-001, 9.349266e-001,
+9.353334e-001, 9.357402e-001, 9.361463e-001, 9.365494e-001, 9.369524e-001, 9.373555e-001, 9.377586e-001, 9.381616e-001, 9.385647e-001, 9.389664e-001,
+9.393649e-001, 9.397633e-001, 9.401618e-001, 9.405603e-001, 9.409587e-001, 9.413572e-001, 9.417546e-001, 9.421499e-001, 9.425452e-001, 9.429405e-001,
+9.433358e-001, 9.437311e-001, 9.441264e-001, 9.445208e-001, 9.449130e-001, 9.453052e-001, 9.456974e-001, 9.460896e-001, 9.464818e-001, 9.468740e-001,
+9.472648e-001, 9.476502e-001, 9.480356e-001, 9.484211e-001, 9.488065e-001, 9.491919e-001, 9.495773e-001, 9.499623e-001, 9.503391e-001, 9.507159e-001,
+9.510927e-001, 9.514695e-001, 9.518463e-001, 9.522231e-001, 9.526000e-001, 9.529723e-001, 9.533438e-001, 9.537154e-001, 9.540869e-001, 9.544584e-001,
+9.548300e-001, 9.552015e-001, 9.555712e-001, 9.559395e-001, 9.563078e-001, 9.566761e-001, 9.570444e-001, 9.574127e-001, 9.577810e-001, 9.581483e-001,
+9.585124e-001, 9.588766e-001, 9.592408e-001, 9.596049e-001, 9.599691e-001, 9.603332e-001, 9.606974e-001, 9.610581e-001, 9.614182e-001, 9.617784e-001,
+9.621385e-001, 9.624987e-001, 9.628589e-001, 9.632190e-001, 9.635775e-001, 9.639339e-001, 9.642902e-001, 9.646465e-001, 9.650028e-001, 9.653592e-001,
+9.657155e-001, 9.660718e-001, 9.664240e-001, 9.667758e-001, 9.671275e-001, 9.674793e-001, 9.678311e-001, 9.681829e-001, 9.685347e-001, 9.688847e-001,
+9.692314e-001, 9.695781e-001, 9.699247e-001, 9.702714e-001, 9.706181e-001, 9.709648e-001, 9.713115e-001, 9.716546e-001, 9.719963e-001, 9.723380e-001,
+9.726797e-001, 9.730214e-001, 9.733630e-001, 9.737047e-001, 9.740463e-001, 9.743828e-001, 9.747193e-001, 9.750557e-001, 9.753922e-001, 9.757286e-001,
+9.760651e-001, 9.764015e-001, 9.767364e-001, 9.770668e-001, 9.773972e-001, 9.777276e-001, 9.780580e-001, 9.783885e-001, 9.787189e-001, 9.790493e-001,
+9.793768e-001, 9.797004e-001, 9.800241e-001, 9.803477e-001, 9.806714e-001, 9.809950e-001, 9.813187e-001, 9.816424e-001, 9.819620e-001, 9.822781e-001,
+9.825942e-001, 9.829103e-001, 9.832264e-001, 9.835425e-001, 9.838586e-001, 9.841747e-001, 9.844858e-001, 9.847932e-001, 9.851007e-001, 9.854081e-001,
+9.857155e-001, 9.860229e-001, 9.863304e-001, 9.866378e-001, 9.869401e-001, 9.872382e-001, 9.875364e-001, 9.878345e-001, 9.881327e-001, 9.884308e-001,
+9.887290e-001, 9.890271e-001, 9.893202e-001, 9.896075e-001, 9.898949e-001, 9.901822e-001, 9.904695e-001, 9.907568e-001, 9.910441e-001, 9.913314e-001,
+9.916149e-001, 9.918899e-001, 9.921648e-001, 9.924398e-001, 9.927147e-001, 9.929897e-001, 9.932647e-001, 9.935396e-001, 9.938135e-001, 9.940761e-001,
+9.943387e-001, 9.946013e-001, 9.948639e-001, 9.951265e-001, 9.953891e-001, 9.956517e-001, 9.959143e-001, 9.961654e-001, 9.964134e-001, 9.966615e-001,
+9.969095e-001, 9.971575e-001, 9.974056e-001, 9.976536e-001, 9.979016e-001, 9.981428e-001, 9.983749e-001, 9.986071e-001, 9.988392e-001, 9.990714e-001,
+9.993035e-001, 9.995357e-001, 9.997678e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.844080e-003, 1.315091e-002, 1.900045e-002, 2.444500e-002, 2.955833e-002, 3.437721e-002, 3.894310e-002, 4.328978e-002, 4.745479e-002,
+5.143799e-002, 5.526227e-002, 5.900226e-002, 6.266296e-002, 6.622657e-002, 6.968310e-002, 7.305671e-002, 7.637888e-002, 7.965988e-002, 8.289028e-002,
+8.606343e-002, 8.917315e-002, 9.221777e-002, 9.520642e-002, 9.815515e-002, 1.010732e-001, 1.039592e-001, 1.068119e-001, 1.096345e-001, 1.124314e-001,
+1.151997e-001, 1.179367e-001, 1.206402e-001, 1.233117e-001, 1.259557e-001, 1.285720e-001, 1.311602e-001, 1.337203e-001, 1.362521e-001, 1.387566e-001,
+1.412399e-001, 1.437026e-001, 1.461456e-001, 1.485693e-001, 1.509743e-001, 1.533615e-001, 1.557314e-001, 1.580838e-001, 1.604201e-001, 1.627393e-001,
+1.650432e-001, 1.673322e-001, 1.696034e-001, 1.718567e-001, 1.740910e-001, 1.763089e-001, 1.785116e-001, 1.806991e-001, 1.828715e-001, 1.850311e-001,
+1.871782e-001, 1.893118e-001, 1.914347e-001, 1.935469e-001, 1.956477e-001, 1.977396e-001, 1.998216e-001, 2.018946e-001, 2.039603e-001, 2.060161e-001,
+2.080631e-001, 2.100999e-001, 2.121268e-001, 2.141438e-001, 2.161485e-001, 2.181436e-001, 2.201272e-001, 2.221024e-001, 2.240664e-001, 2.260231e-001,
+2.279690e-001, 2.299083e-001, 2.318374e-001, 2.337606e-001, 2.356743e-001, 2.375826e-001, 2.394822e-001, 2.413767e-001, 2.432633e-001, 2.451453e-001,
+2.470199e-001, 2.488903e-001, 2.507541e-001, 2.526114e-001, 2.544620e-001, 2.563054e-001, 2.581431e-001, 2.599739e-001, 2.617989e-001, 2.636144e-001,
+2.654234e-001, 2.672255e-001, 2.690200e-001, 2.708096e-001, 2.725907e-001, 2.743658e-001, 2.761324e-001, 2.778904e-001, 2.796433e-001, 2.813873e-001,
+2.831257e-001, 2.848586e-001, 2.865826e-001, 2.883007e-001, 2.900109e-001, 2.917132e-001, 2.934105e-001, 2.951011e-001, 2.967850e-001, 2.984646e-001,
+3.001383e-001, 3.018057e-001, 3.034671e-001, 3.051222e-001, 3.067720e-001, 3.084170e-001, 3.100564e-001, 3.116889e-001, 3.133163e-001, 3.149393e-001,
+3.165563e-001, 3.181676e-001, 3.197732e-001, 3.213738e-001, 3.229695e-001, 3.245606e-001, 3.261463e-001, 3.277262e-001, 3.293008e-001, 3.308695e-001,
+3.324310e-001, 3.339885e-001, 3.355415e-001, 3.370898e-001, 3.386338e-001, 3.401749e-001, 3.417123e-001, 3.432453e-001, 3.447737e-001, 3.462958e-001,
+3.478113e-001, 3.493227e-001, 3.508295e-001, 3.523304e-001, 3.538273e-001, 3.553215e-001, 3.568126e-001, 3.582983e-001, 3.597794e-001, 3.612557e-001,
+3.627254e-001, 3.641890e-001, 3.656494e-001, 3.671061e-001, 3.685575e-001, 3.700046e-001, 3.714494e-001, 3.728920e-001, 3.743301e-001, 3.757639e-001,
+3.771939e-001, 3.786192e-001, 3.800375e-001, 3.814533e-001, 3.828669e-001, 3.842755e-001, 3.856792e-001, 3.870786e-001, 3.884717e-001, 3.898598e-001,
+3.912445e-001, 3.926243e-001, 3.940002e-001, 3.953734e-001, 3.967425e-001, 3.981088e-001, 3.994732e-001, 4.008344e-001, 4.021924e-001, 4.035479e-001,
+4.048978e-001, 4.062456e-001, 4.075909e-001, 4.089311e-001, 4.102692e-001, 4.116034e-001, 4.129329e-001, 4.142598e-001, 4.155795e-001, 4.168973e-001,
+4.182123e-001, 4.195237e-001, 4.208334e-001, 4.221384e-001, 4.234415e-001, 4.247420e-001, 4.260380e-001, 4.273321e-001, 4.286206e-001, 4.299075e-001,
+4.311902e-001, 4.324695e-001, 4.337459e-001, 4.350179e-001, 4.362886e-001, 4.375523e-001, 4.388142e-001, 4.400706e-001, 4.413250e-001, 4.425771e-001,
+4.438263e-001, 4.450738e-001, 4.463164e-001, 4.475578e-001, 4.487919e-001, 4.500248e-001, 4.512509e-001, 4.524758e-001, 4.536971e-001, 4.549165e-001,
+4.561328e-001, 4.573467e-001, 4.585579e-001, 4.597668e-001, 4.609736e-001, 4.621770e-001, 4.633781e-001, 4.645760e-001, 4.657721e-001, 4.669648e-001,
+4.681559e-001, 4.693434e-001, 4.705293e-001, 4.717121e-001, 4.728936e-001, 4.740711e-001, 4.752468e-001, 4.764178e-001, 4.775865e-001, 4.787499e-001,
+4.799102e-001, 4.810669e-001, 4.822208e-001, 4.833728e-001, 4.845225e-001, 4.856701e-001, 4.868143e-001, 4.879572e-001, 4.890959e-001, 4.902341e-001,
+4.913682e-001, 4.925023e-001, 4.936309e-001, 4.947592e-001, 4.958822e-001, 4.970037e-001, 4.981216e-001, 4.992372e-001, 5.003510e-001, 5.014620e-001,
+5.025723e-001, 5.036796e-001, 5.047869e-001, 5.058897e-001, 5.069922e-001, 5.080907e-001, 5.091872e-001, 5.102818e-001, 5.113733e-001, 5.124643e-001,
+5.135501e-001, 5.146359e-001, 5.157187e-001, 5.168005e-001, 5.178807e-001, 5.189586e-001, 5.200363e-001, 5.211094e-001, 5.221825e-001, 5.232515e-001,
+5.243185e-001, 5.253840e-001, 5.264452e-001, 5.275065e-001, 5.285636e-001, 5.296201e-001, 5.306741e-001, 5.317249e-001, 5.327756e-001, 5.338218e-001,
+5.348678e-001, 5.359107e-001, 5.369504e-001, 5.379901e-001, 5.390231e-001, 5.400561e-001, 5.410866e-001, 5.421144e-001, 5.431422e-001, 5.441660e-001,
+5.451896e-001, 5.462112e-001, 5.472296e-001, 5.482479e-001, 5.492616e-001, 5.502739e-001, 5.512850e-001, 5.522903e-001, 5.532957e-001, 5.542974e-001,
+5.552962e-001, 5.562951e-001, 5.572907e-001, 5.582859e-001, 5.592799e-001, 5.602701e-001, 5.612603e-001, 5.622477e-001, 5.632326e-001, 5.642176e-001,
+5.651970e-001, 5.661753e-001, 5.671531e-001, 5.681259e-001, 5.690986e-001, 5.700702e-001, 5.710396e-001, 5.720090e-001, 5.729762e-001, 5.739416e-001,
+5.749070e-001, 5.758688e-001, 5.768294e-001, 5.777900e-001, 5.787457e-001, 5.797008e-001, 5.806556e-001, 5.816045e-001, 5.825534e-001, 5.835011e-001,
+5.844431e-001, 5.853852e-001, 5.863259e-001, 5.872634e-001, 5.882009e-001, 5.891369e-001, 5.900704e-001, 5.910038e-001, 5.919355e-001, 5.928649e-001,
+5.937942e-001, 5.947211e-001, 5.956451e-001, 5.965691e-001, 5.974907e-001, 5.984092e-001, 5.993278e-001, 6.002436e-001, 6.011556e-001, 6.020676e-001,
+6.029771e-001, 6.038824e-001, 6.047877e-001, 6.056910e-001, 6.065898e-001, 6.074885e-001, 6.083863e-001, 6.092801e-001, 6.101740e-001, 6.110676e-001,
+6.119573e-001, 6.128469e-001, 6.137366e-001, 6.146218e-001, 6.155067e-001, 6.163916e-001, 6.172725e-001, 6.181520e-001, 6.190316e-001, 6.199086e-001,
+6.207835e-001, 6.216584e-001, 6.225319e-001, 6.234023e-001, 6.242726e-001, 6.251427e-001, 6.260075e-001, 6.268723e-001, 6.277372e-001, 6.286000e-001,
+6.294622e-001, 6.303244e-001, 6.311849e-001, 6.320434e-001, 6.329019e-001, 6.337600e-001, 6.346150e-001, 6.354699e-001, 6.363249e-001, 6.371763e-001,
+6.380266e-001, 6.388770e-001, 6.397256e-001, 6.405715e-001, 6.414173e-001, 6.422631e-001, 6.431037e-001, 6.439439e-001, 6.447842e-001, 6.456224e-001,
+6.464584e-001, 6.472944e-001, 6.481303e-001, 6.489617e-001, 6.497931e-001, 6.506244e-001, 6.514533e-001, 6.522796e-001, 6.531060e-001, 6.539324e-001,
+6.547546e-001, 6.555766e-001, 6.563987e-001, 6.572191e-001, 6.580371e-001, 6.588551e-001, 6.596731e-001, 6.604871e-001, 6.613002e-001, 6.621132e-001,
+6.629254e-001, 6.637338e-001, 6.645421e-001, 6.653505e-001, 6.661559e-001, 6.669586e-001, 6.677614e-001, 6.685642e-001, 6.693624e-001, 6.701598e-001,
+6.709572e-001, 6.717540e-001, 6.725464e-001, 6.733387e-001, 6.741310e-001, 6.749218e-001, 6.757098e-001, 6.764979e-001, 6.772860e-001, 6.780708e-001,
+6.788533e-001, 6.796359e-001, 6.804184e-001, 6.811973e-001, 6.819751e-001, 6.827530e-001, 6.835308e-001, 6.843031e-001, 6.850750e-001, 6.858468e-001,
+6.866185e-001, 6.873862e-001, 6.881540e-001, 6.889218e-001, 6.896888e-001, 6.904517e-001, 6.912146e-001, 6.919776e-001, 6.927395e-001, 6.934980e-001,
+6.942565e-001, 6.950149e-001, 6.957721e-001, 6.965254e-001, 6.972787e-001, 6.980319e-001, 6.987840e-001, 6.995325e-001, 7.002809e-001, 7.010293e-001,
+7.017766e-001, 7.025195e-001, 7.032624e-001, 7.040053e-001, 7.047476e-001, 7.054864e-001, 7.062252e-001, 7.069640e-001, 7.077026e-001, 7.084372e-001,
+7.091718e-001, 7.099063e-001, 7.106409e-001, 7.113716e-001, 7.121019e-001, 7.128322e-001, 7.135625e-001, 7.142896e-001, 7.150154e-001, 7.157413e-001,
+7.164672e-001, 7.171908e-001, 7.179122e-001, 7.186336e-001, 7.193550e-001, 7.200751e-001, 7.207919e-001, 7.215088e-001, 7.222256e-001, 7.229424e-001,
+7.236546e-001, 7.243667e-001, 7.250789e-001, 7.257911e-001, 7.265000e-001, 7.272074e-001, 7.279147e-001, 7.286221e-001, 7.293279e-001, 7.300305e-001,
+7.307330e-001, 7.314355e-001, 7.321381e-001, 7.328368e-001, 7.335353e-001, 7.342339e-001, 7.349324e-001, 7.356290e-001, 7.363240e-001, 7.370189e-001,
+7.377139e-001, 7.384086e-001, 7.390994e-001, 7.397902e-001, 7.404811e-001, 7.411719e-001, 7.418606e-001, 7.425477e-001, 7.432349e-001, 7.439220e-001,
+7.446090e-001, 7.452919e-001, 7.459748e-001, 7.466577e-001, 7.473406e-001, 7.480218e-001, 7.487009e-001, 7.493800e-001, 7.500591e-001, 7.507382e-001,
+7.514145e-001, 7.520903e-001, 7.527661e-001, 7.534419e-001, 7.541172e-001, 7.547907e-001, 7.554642e-001, 7.561377e-001, 7.568112e-001, 7.574830e-001,
+7.581532e-001, 7.588235e-001, 7.594937e-001, 7.601639e-001, 7.608323e-001, 7.615003e-001, 7.621682e-001, 7.628362e-001, 7.635040e-001, 7.641687e-001,
+7.648334e-001, 7.654981e-001, 7.661628e-001, 7.668270e-001, 7.674894e-001, 7.681518e-001, 7.688142e-001, 7.694767e-001, 7.701378e-001, 7.707971e-001,
+7.714563e-001, 7.721155e-001, 7.727747e-001, 7.734328e-001, 7.740897e-001, 7.747467e-001, 7.754037e-001, 7.760606e-001, 7.767157e-001, 7.773695e-001,
+7.780233e-001, 7.786770e-001, 7.793308e-001, 7.799832e-001, 7.806347e-001, 7.812863e-001, 7.819378e-001, 7.825893e-001, 7.832390e-001, 7.838873e-001,
+7.845357e-001, 7.851841e-001, 7.858325e-001, 7.864796e-001, 7.871257e-001, 7.877719e-001, 7.884181e-001, 7.890642e-001, 7.897089e-001, 7.903519e-001,
+7.909949e-001, 7.916380e-001, 7.922810e-001, 7.929233e-001, 7.935641e-001, 7.942049e-001, 7.948457e-001, 7.954866e-001, 7.961269e-001, 7.967646e-001,
+7.974023e-001, 7.980400e-001, 7.986777e-001, 7.993155e-001, 7.999499e-001, 8.005842e-001, 8.012184e-001, 8.018527e-001, 8.024870e-001, 8.031186e-001,
+8.037490e-001, 8.043794e-001, 8.050099e-001, 8.056403e-001, 8.062694e-001, 8.068965e-001, 8.075236e-001, 8.081507e-001, 8.087778e-001, 8.094047e-001,
+8.100281e-001, 8.106514e-001, 8.112748e-001, 8.118981e-001, 8.125215e-001, 8.131419e-001, 8.137607e-001, 8.143794e-001, 8.149982e-001, 8.156170e-001,
+8.162349e-001, 8.168492e-001, 8.174635e-001, 8.180779e-001, 8.186922e-001, 8.193065e-001, 8.199178e-001, 8.205278e-001, 8.211378e-001, 8.217478e-001,
+8.223578e-001, 8.229670e-001, 8.235728e-001, 8.241787e-001, 8.247845e-001, 8.253903e-001, 8.259961e-001, 8.265995e-001, 8.272012e-001, 8.278030e-001,
+8.284047e-001, 8.290065e-001, 8.296083e-001, 8.302061e-001, 8.308040e-001, 8.314018e-001, 8.319996e-001, 8.325975e-001, 8.331941e-001, 8.337881e-001,
+8.343821e-001, 8.349762e-001, 8.355702e-001, 8.361643e-001, 8.367560e-001, 8.373464e-001, 8.379368e-001, 8.385272e-001, 8.391175e-001, 8.397079e-001,
+8.402953e-001, 8.408821e-001, 8.414689e-001, 8.420557e-001, 8.426426e-001, 8.432292e-001, 8.438127e-001, 8.443961e-001, 8.449795e-001, 8.455629e-001,
+8.461463e-001, 8.467291e-001, 8.473092e-001, 8.478893e-001, 8.484695e-001, 8.490496e-001, 8.496297e-001, 8.502089e-001, 8.507859e-001, 8.513628e-001,
+8.519397e-001, 8.525167e-001, 8.530936e-001, 8.536696e-001, 8.542435e-001, 8.548173e-001, 8.553912e-001, 8.559651e-001, 8.565390e-001, 8.571119e-001,
+8.576829e-001, 8.582538e-001, 8.588248e-001, 8.593957e-001, 8.599666e-001, 8.605368e-001, 8.611049e-001, 8.616731e-001, 8.622412e-001, 8.628093e-001,
+8.633774e-001, 8.639450e-001, 8.645104e-001, 8.650758e-001, 8.656412e-001, 8.662066e-001, 8.667720e-001, 8.673374e-001, 8.679001e-001, 8.684629e-001,
+8.690257e-001, 8.695885e-001, 8.701512e-001, 8.707140e-001, 8.712748e-001, 8.718351e-001, 8.723953e-001, 8.729556e-001, 8.735159e-001, 8.740761e-001,
+8.746351e-001, 8.751930e-001, 8.757508e-001, 8.763087e-001, 8.768666e-001, 8.774245e-001, 8.779818e-001, 8.785374e-001, 8.790929e-001, 8.796485e-001,
+8.802041e-001, 8.807597e-001, 8.813152e-001, 8.818689e-001, 8.824223e-001, 8.829757e-001, 8.835291e-001, 8.840825e-001, 8.846358e-001, 8.851883e-001,
+8.857396e-001, 8.862909e-001, 8.868422e-001, 8.873935e-001, 8.879448e-001, 8.884961e-001, 8.890454e-001, 8.895947e-001, 8.901440e-001, 8.906934e-001,
+8.912427e-001, 8.917920e-001, 8.923399e-001, 8.928862e-001, 8.934324e-001, 8.939787e-001, 8.945250e-001, 8.950712e-001, 8.956175e-001, 8.961616e-001,
+8.967054e-001, 8.972491e-001, 8.977929e-001, 8.983367e-001, 8.988805e-001, 8.994236e-001, 8.999647e-001, 9.005057e-001, 9.010468e-001, 9.015879e-001,
+9.021289e-001, 9.026700e-001, 9.032099e-001, 9.037488e-001, 9.042877e-001, 9.048266e-001, 9.053655e-001, 9.059044e-001, 9.064433e-001, 9.069793e-001,
+9.075147e-001, 9.080500e-001, 9.085853e-001, 9.091207e-001, 9.096560e-001, 9.101913e-001, 9.107241e-001, 9.112569e-001, 9.117897e-001, 9.123224e-001,
+9.128552e-001, 9.133880e-001, 9.139202e-001, 9.144499e-001, 9.149795e-001, 9.155091e-001, 9.160387e-001, 9.165683e-001, 9.170979e-001, 9.176267e-001,
+9.181531e-001, 9.186795e-001, 9.192059e-001, 9.197323e-001, 9.202587e-001, 9.207851e-001, 9.213101e-001, 9.218313e-001, 9.223526e-001, 9.228739e-001,
+9.233952e-001, 9.239164e-001, 9.244377e-001, 9.249574e-001, 9.254726e-001, 9.259878e-001, 9.265030e-001, 9.270182e-001, 9.275334e-001, 9.280486e-001,
+9.285627e-001, 9.290715e-001, 9.295802e-001, 9.300890e-001, 9.305977e-001, 9.311064e-001, 9.316152e-001, 9.321238e-001, 9.326291e-001, 9.331344e-001,
+9.336397e-001, 9.341449e-001, 9.346502e-001, 9.351555e-001, 9.356608e-001, 9.361641e-001, 9.366669e-001, 9.371698e-001, 9.376726e-001, 9.381754e-001,
+9.386783e-001, 9.391811e-001, 9.396826e-001, 9.401828e-001, 9.406831e-001, 9.411834e-001, 9.416837e-001, 9.421840e-001, 9.426842e-001, 9.431836e-001,
+9.436798e-001, 9.441761e-001, 9.446723e-001, 9.451685e-001, 9.456648e-001, 9.461610e-001, 9.466572e-001, 9.471497e-001, 9.476414e-001, 9.481332e-001,
+9.486249e-001, 9.491167e-001, 9.496085e-001, 9.501002e-001, 9.505899e-001, 9.510767e-001, 9.515634e-001, 9.520501e-001, 9.525368e-001, 9.530236e-001,
+9.535103e-001, 9.539970e-001, 9.544786e-001, 9.549597e-001, 9.554407e-001, 9.559217e-001, 9.564027e-001, 9.568837e-001, 9.573648e-001, 9.578435e-001,
+9.583177e-001, 9.587918e-001, 9.592659e-001, 9.597400e-001, 9.602142e-001, 9.606883e-001, 9.611624e-001, 9.616313e-001, 9.620978e-001, 9.625643e-001,
+9.630308e-001, 9.634973e-001, 9.639638e-001, 9.644303e-001, 9.648968e-001, 9.653551e-001, 9.658133e-001, 9.662716e-001, 9.667299e-001, 9.671881e-001,
+9.676464e-001, 9.681046e-001, 9.685608e-001, 9.690101e-001, 9.694594e-001, 9.699087e-001, 9.703580e-001, 9.708073e-001, 9.712566e-001, 9.717059e-001,
+9.721511e-001, 9.725904e-001, 9.730297e-001, 9.734691e-001, 9.739084e-001, 9.743478e-001, 9.747871e-001, 9.752265e-001, 9.756602e-001, 9.760889e-001,
+9.765176e-001, 9.769462e-001, 9.773749e-001, 9.778036e-001, 9.782322e-001, 9.786609e-001, 9.790827e-001, 9.794991e-001, 9.799156e-001, 9.803321e-001,
+9.807486e-001, 9.811650e-001, 9.815815e-001, 9.819980e-001, 9.824074e-001, 9.828110e-001, 9.832146e-001, 9.836182e-001, 9.840217e-001, 9.844253e-001,
+9.848289e-001, 9.852325e-001, 9.856291e-001, 9.860175e-001, 9.864059e-001, 9.867943e-001, 9.871827e-001, 9.875711e-001, 9.879595e-001, 9.883479e-001,
+9.887315e-001, 9.891041e-001, 9.894766e-001, 9.898492e-001, 9.902217e-001, 9.905943e-001, 9.909668e-001, 9.913394e-001, 9.917104e-001, 9.920637e-001,
+9.924170e-001, 9.927703e-001, 9.931236e-001, 9.934769e-001, 9.938303e-001, 9.941836e-001, 9.945369e-001, 9.948745e-001, 9.952080e-001, 9.955414e-001,
+9.958749e-001, 9.962083e-001, 9.965418e-001, 9.968752e-001, 9.972087e-001, 9.975315e-001, 9.978400e-001, 9.981486e-001, 9.984572e-001, 9.987657e-001,
+9.990743e-001, 9.993829e-001, 9.996914e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Optima II 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.111211e-002, 2.173118e-002, 3.103093e-002, 3.944279e-002, 4.721723e-002, 5.448958e-002, 6.135392e-002, 6.786108e-002, 7.405888e-002,
+7.999227e-002, 8.569267e-002, 9.119449e-002, 9.650850e-002, 1.016505e-001, 1.066409e-001, 1.114827e-001, 1.161810e-001, 1.207584e-001, 1.252015e-001,
+1.295239e-001, 1.337441e-001, 1.378667e-001, 1.418836e-001, 1.458136e-001, 1.496558e-001, 1.534211e-001, 1.571090e-001, 1.607229e-001, 1.642648e-001,
+1.677455e-001, 1.711609e-001, 1.745131e-001, 1.778111e-001, 1.810567e-001, 1.842480e-001, 1.873923e-001, 1.904911e-001, 1.935475e-001, 1.965657e-001,
+1.995461e-001, 2.024825e-001, 2.053820e-001, 2.082440e-001, 2.110688e-001, 2.138602e-001, 2.166165e-001, 2.193438e-001, 2.220394e-001, 2.247070e-001,
+2.273449e-001, 2.299581e-001, 2.325425e-001, 2.350990e-001, 2.376336e-001, 2.401454e-001, 2.426388e-001, 2.451129e-001, 2.475619e-001, 2.499863e-001,
+2.523909e-001, 2.547743e-001, 2.571433e-001, 2.594946e-001, 2.618247e-001, 2.641352e-001, 2.664259e-001, 2.686997e-001, 2.709574e-001, 2.731973e-001,
+2.754216e-001, 2.776325e-001, 2.798276e-001, 2.820054e-001, 2.841629e-001, 2.863053e-001, 2.884349e-001, 2.905501e-001, 2.926584e-001, 2.947569e-001,
+2.968437e-001, 2.989166e-001, 3.009737e-001, 3.030147e-001, 3.050421e-001, 3.070568e-001, 3.090624e-001, 3.110578e-001, 3.130468e-001, 3.150279e-001,
+3.169982e-001, 3.189577e-001, 3.209047e-001, 3.228406e-001, 3.247657e-001, 3.266790e-001, 3.285810e-001, 3.304736e-001, 3.323584e-001, 3.342367e-001,
+3.361083e-001, 3.379718e-001, 3.398267e-001, 3.416718e-001, 3.435060e-001, 3.453315e-001, 3.471464e-001, 3.489514e-001, 3.507473e-001, 3.525383e-001,
+3.543234e-001, 3.561017e-001, 3.578726e-001, 3.596351e-001, 3.613911e-001, 3.631403e-001, 3.648819e-001, 3.666148e-001, 3.683386e-001, 3.700559e-001,
+3.717652e-001, 3.734667e-001, 3.751592e-001, 3.768460e-001, 3.785250e-001, 3.801975e-001, 3.818611e-001, 3.835193e-001, 3.851708e-001, 3.868160e-001,
+3.884536e-001, 3.900853e-001, 3.917113e-001, 3.933308e-001, 3.949448e-001, 3.965539e-001, 3.981574e-001, 3.997553e-001, 4.013461e-001, 4.029329e-001,
+4.045143e-001, 4.060910e-001, 4.076623e-001, 4.092278e-001, 4.107879e-001, 4.123404e-001, 4.138863e-001, 4.154250e-001, 4.169568e-001, 4.184819e-001,
+4.199990e-001, 4.215070e-001, 4.230087e-001, 4.245057e-001, 4.259984e-001, 4.274864e-001, 4.289681e-001, 4.304447e-001, 4.319162e-001, 4.333826e-001,
+4.348441e-001, 4.363027e-001, 4.377590e-001, 4.392132e-001, 4.406625e-001, 4.421091e-001, 4.435526e-001, 4.449920e-001, 4.464268e-001, 4.478575e-001,
+4.492842e-001, 4.507060e-001, 4.521221e-001, 4.535341e-001, 4.549414e-001, 4.563411e-001, 4.577365e-001, 4.591276e-001, 4.605122e-001, 4.618935e-001,
+4.632715e-001, 4.646423e-001, 4.660095e-001, 4.673734e-001, 4.687320e-001, 4.700881e-001, 4.714414e-001, 4.727893e-001, 4.741346e-001, 4.754764e-001,
+4.768131e-001, 4.781472e-001, 4.794767e-001, 4.808017e-001, 4.821242e-001, 4.834405e-001, 4.847536e-001, 4.860630e-001, 4.873665e-001, 4.886674e-001,
+4.899625e-001, 4.912536e-001, 4.925413e-001, 4.938223e-001, 4.951009e-001, 4.963733e-001, 4.976417e-001, 4.989061e-001, 5.001641e-001, 5.014199e-001,
+5.026680e-001, 5.039133e-001, 5.051530e-001, 5.063877e-001, 5.076187e-001, 5.088447e-001, 5.100693e-001, 5.112870e-001, 5.125031e-001, 5.137143e-001,
+5.149224e-001, 5.161264e-001, 5.173263e-001, 5.185235e-001, 5.197151e-001, 5.209048e-001, 5.220908e-001, 5.232761e-001, 5.244561e-001, 5.256355e-001,
+5.268112e-001, 5.279857e-001, 5.291559e-001, 5.303248e-001, 5.314909e-001, 5.326549e-001, 5.338155e-001, 5.349743e-001, 5.361308e-001, 5.372847e-001,
+5.384358e-001, 5.395848e-001, 5.407318e-001, 5.418761e-001, 5.430177e-001, 5.441574e-001, 5.452949e-001, 5.464300e-001, 5.475622e-001, 5.486928e-001,
+5.498210e-001, 5.509474e-001, 5.520703e-001, 5.531922e-001, 5.543110e-001, 5.554292e-001, 5.565428e-001, 5.576563e-001, 5.587659e-001, 5.598756e-001,
+5.609806e-001, 5.620850e-001, 5.631866e-001, 5.642871e-001, 5.653848e-001, 5.664801e-001, 5.675740e-001, 5.686654e-001, 5.697558e-001, 5.708406e-001,
+5.719254e-001, 5.730047e-001, 5.740836e-001, 5.751580e-001, 5.762305e-001, 5.773005e-001, 5.783672e-001, 5.794331e-001, 5.804936e-001, 5.815541e-001,
+5.826099e-001, 5.836649e-001, 5.847159e-001, 5.857632e-001, 5.868093e-001, 5.878491e-001, 5.888889e-001, 5.899229e-001, 5.909555e-001, 5.919851e-001,
+5.930107e-001, 5.940360e-001, 5.950549e-001, 5.960737e-001, 5.970885e-001, 5.981008e-001, 5.991120e-001, 6.001180e-001, 6.011241e-001, 6.021257e-001,
+6.031256e-001, 6.041241e-001, 6.051182e-001, 6.061123e-001, 6.071022e-001, 6.080907e-001, 6.090780e-001, 6.100610e-001, 6.110440e-001, 6.120235e-001,
+6.130014e-001, 6.139786e-001, 6.149514e-001, 6.159242e-001, 6.168936e-001, 6.178601e-001, 6.188267e-001, 6.197870e-001, 6.207470e-001, 6.217052e-001,
+6.226594e-001, 6.236135e-001, 6.245638e-001, 6.255119e-001, 6.264601e-001, 6.274017e-001, 6.283431e-001, 6.292824e-001, 6.302165e-001, 6.311505e-001,
+6.320812e-001, 6.330093e-001, 6.339375e-001, 6.348600e-001, 6.357815e-001, 6.367026e-001, 6.376189e-001, 6.385352e-001, 6.394498e-001, 6.403602e-001,
+6.412706e-001, 6.421789e-001, 6.430849e-001, 6.439908e-001, 6.448925e-001, 6.457919e-001, 6.466914e-001, 6.475863e-001, 6.484802e-001, 6.493741e-001,
+6.502627e-001, 6.511509e-001, 6.520389e-001, 6.529224e-001, 6.538059e-001, 6.546889e-001, 6.555676e-001, 6.564462e-001, 6.573243e-001, 6.581991e-001,
+6.590739e-001, 6.599478e-001, 6.608172e-001, 6.616867e-001, 6.625552e-001, 6.634198e-001, 6.642844e-001, 6.651483e-001, 6.660086e-001, 6.668688e-001,
+6.677287e-001, 6.685851e-001, 6.694416e-001, 6.702979e-001, 6.711510e-001, 6.720041e-001, 6.728573e-001, 6.737047e-001, 6.745518e-001, 6.753989e-001,
+6.762414e-001, 6.770829e-001, 6.779245e-001, 6.787627e-001, 6.795991e-001, 6.804356e-001, 6.812699e-001, 6.821018e-001, 6.829338e-001, 6.837641e-001,
+6.845906e-001, 6.854171e-001, 6.862433e-001, 6.870644e-001, 6.878856e-001, 6.887067e-001, 6.895229e-001, 6.903379e-001, 6.911529e-001, 6.919643e-001,
+6.927723e-001, 6.935804e-001, 6.943870e-001, 6.951882e-001, 6.959894e-001, 6.967906e-001, 6.975868e-001, 6.983822e-001, 6.991776e-001, 6.999700e-001,
+7.007597e-001, 7.015494e-001, 7.023385e-001, 7.031234e-001, 7.039084e-001, 7.046934e-001, 7.054751e-001, 7.062554e-001, 7.070357e-001, 7.078148e-001,
+7.085903e-001, 7.093657e-001, 7.101411e-001, 7.109115e-001, 7.116805e-001, 7.124494e-001, 7.132170e-001, 7.139807e-001, 7.147444e-001, 7.155081e-001,
+7.162681e-001, 7.170267e-001, 7.177853e-001, 7.185433e-001, 7.192980e-001, 7.200527e-001, 7.208075e-001, 7.215601e-001, 7.223111e-001, 7.230621e-001,
+7.238131e-001, 7.245601e-001, 7.253068e-001, 7.260535e-001, 7.267988e-001, 7.275406e-001, 7.282823e-001, 7.290241e-001, 7.297623e-001, 7.304982e-001,
+7.312340e-001, 7.319698e-001, 7.327011e-001, 7.334318e-001, 7.341625e-001, 7.348924e-001, 7.356168e-001, 7.363413e-001, 7.370657e-001, 7.377884e-001,
+7.385078e-001, 7.392272e-001, 7.399466e-001, 7.406627e-001, 7.413760e-001, 7.420893e-001, 7.428025e-001, 7.435113e-001, 7.442180e-001, 7.449247e-001,
+7.456315e-001, 7.463331e-001, 7.470337e-001, 7.477343e-001, 7.484349e-001, 7.491310e-001, 7.498267e-001, 7.505224e-001, 7.512181e-001, 7.519093e-001,
+7.526004e-001, 7.532915e-001, 7.539826e-001, 7.546688e-001, 7.553549e-001, 7.560411e-001, 7.567273e-001, 7.574092e-001, 7.580911e-001, 7.587731e-001,
+7.594550e-001, 7.601324e-001, 7.608097e-001, 7.614869e-001, 7.621641e-001, 7.628364e-001, 7.635082e-001, 7.641799e-001, 7.648516e-001, 7.655197e-001,
+7.661868e-001, 7.668539e-001, 7.675210e-001, 7.681856e-001, 7.688489e-001, 7.695122e-001, 7.701754e-001, 7.708365e-001, 7.714951e-001, 7.721538e-001,
+7.728124e-001, 7.734698e-001, 7.741238e-001, 7.747778e-001, 7.754318e-001, 7.760857e-001, 7.767339e-001, 7.773821e-001, 7.780304e-001, 7.786786e-001,
+7.793236e-001, 7.799674e-001, 7.806113e-001, 7.812551e-001, 7.818972e-001, 7.825371e-001, 7.831770e-001, 7.838169e-001, 7.844563e-001, 7.850909e-001,
+7.857255e-001, 7.863601e-001, 7.869947e-001, 7.876251e-001, 7.882538e-001, 7.888824e-001, 7.895110e-001, 7.901382e-001, 7.907618e-001, 7.913854e-001,
+7.920089e-001, 7.926325e-001, 7.932527e-001, 7.938722e-001, 7.944917e-001, 7.951112e-001, 7.957290e-001, 7.963437e-001, 7.969584e-001, 7.975731e-001,
+7.981877e-001, 7.987987e-001, 7.994089e-001, 8.000190e-001, 8.006291e-001, 8.012379e-001, 8.018424e-001, 8.024469e-001, 8.030515e-001, 8.036560e-001,
+8.042569e-001, 8.048557e-001, 8.054545e-001, 8.060533e-001, 8.066521e-001, 8.072462e-001, 8.078403e-001, 8.084343e-001, 8.090283e-001, 8.096209e-001,
+8.102099e-001, 8.107990e-001, 8.113880e-001, 8.119771e-001, 8.125630e-001, 8.131466e-001, 8.137302e-001, 8.143139e-001, 8.148975e-001, 8.154776e-001,
+8.160568e-001, 8.166361e-001, 8.172153e-001, 8.177946e-001, 8.183705e-001, 8.189464e-001, 8.195223e-001, 8.200982e-001, 8.206733e-001, 8.212443e-001,
+8.218153e-001, 8.223863e-001, 8.229574e-001, 8.235266e-001, 8.240912e-001, 8.246558e-001, 8.252205e-001, 8.257851e-001, 8.263477e-001, 8.269070e-001,
+8.274662e-001, 8.280254e-001, 8.285846e-001, 8.291421e-001, 8.296970e-001, 8.302518e-001, 8.308067e-001, 8.313615e-001, 8.319147e-001, 8.324651e-001,
+8.330155e-001, 8.335660e-001, 8.341164e-001, 8.346651e-001, 8.352108e-001, 8.357565e-001, 8.363021e-001, 8.368478e-001, 8.373925e-001, 8.379346e-001,
+8.384767e-001, 8.390188e-001, 8.395608e-001, 8.401024e-001, 8.406404e-001, 8.411785e-001, 8.417165e-001, 8.422546e-001, 8.427926e-001, 8.433259e-001,
+8.438590e-001, 8.443921e-001, 8.449252e-001, 8.454583e-001, 8.459874e-001, 8.465152e-001, 8.470429e-001, 8.475707e-001, 8.480984e-001, 8.486241e-001,
+8.491476e-001, 8.496711e-001, 8.501946e-001, 8.507181e-001, 8.512408e-001, 8.517602e-001, 8.522796e-001, 8.527990e-001, 8.533184e-001, 8.538378e-001,
+8.543523e-001, 8.548658e-001, 8.553793e-001, 8.558929e-001, 8.564064e-001, 8.569174e-001, 8.574251e-001, 8.579329e-001, 8.584407e-001, 8.589485e-001,
+8.594563e-001, 8.599595e-001, 8.604626e-001, 8.609658e-001, 8.614690e-001, 8.619722e-001, 8.624735e-001, 8.629732e-001, 8.634728e-001, 8.639724e-001,
+8.644721e-001, 8.649717e-001, 8.654679e-001, 8.659641e-001, 8.664603e-001, 8.669564e-001, 8.674526e-001, 8.679472e-001, 8.684397e-001, 8.689323e-001,
+8.694248e-001, 8.699173e-001, 8.704098e-001, 8.709002e-001, 8.713902e-001, 8.718802e-001, 8.723702e-001, 8.728602e-001, 8.733496e-001, 8.738359e-001,
+8.743222e-001, 8.748084e-001, 8.752947e-001, 8.757809e-001, 8.762651e-001, 8.767465e-001, 8.772279e-001, 8.777093e-001, 8.781907e-001, 8.786721e-001,
+8.791510e-001, 8.796287e-001, 8.801063e-001, 8.805840e-001, 8.810617e-001, 8.815393e-001, 8.820140e-001, 8.824882e-001, 8.829623e-001, 8.834365e-001,
+8.839107e-001, 8.843848e-001, 8.848554e-001, 8.853260e-001, 8.857965e-001, 8.862671e-001, 8.867377e-001, 8.872079e-001, 8.876747e-001, 8.881414e-001,
+8.886082e-001, 8.890750e-001, 8.895418e-001, 8.900079e-001, 8.904703e-001, 8.909326e-001, 8.913950e-001, 8.918574e-001, 8.923197e-001, 8.927814e-001,
+8.932392e-001, 8.936970e-001, 8.941549e-001, 8.946127e-001, 8.950705e-001, 8.955280e-001, 8.959824e-001, 8.964369e-001, 8.968913e-001, 8.973458e-001,
+8.978002e-001, 8.982546e-001, 8.987049e-001, 8.991551e-001, 8.996053e-001, 9.000555e-001, 9.005057e-001, 9.009559e-001, 9.014016e-001, 9.018465e-001,
+9.022914e-001, 9.027363e-001, 9.031811e-001, 9.036260e-001, 9.040682e-001, 9.045090e-001, 9.049497e-001, 9.053904e-001, 9.058312e-001, 9.062719e-001,
+9.067112e-001, 9.071482e-001, 9.075852e-001, 9.080221e-001, 9.084591e-001, 9.088961e-001, 9.093328e-001, 9.097660e-001, 9.101991e-001, 9.106323e-001,
+9.110654e-001, 9.114986e-001, 9.119318e-001, 9.123622e-001, 9.127916e-001, 9.132210e-001, 9.136504e-001, 9.140798e-001, 9.145092e-001, 9.149373e-001,
+9.153624e-001, 9.157875e-001, 9.162126e-001, 9.166377e-001, 9.170628e-001, 9.174879e-001, 9.179093e-001, 9.183301e-001, 9.187508e-001, 9.191716e-001,
+9.195923e-001, 9.200131e-001, 9.204329e-001, 9.208505e-001, 9.212682e-001, 9.216859e-001, 9.221036e-001, 9.225213e-001, 9.229389e-001, 9.233537e-001,
+9.237674e-001, 9.241812e-001, 9.245949e-001, 9.250087e-001, 9.254224e-001, 9.258356e-001, 9.262446e-001, 9.266535e-001, 9.270625e-001, 9.274715e-001,
+9.278804e-001, 9.282894e-001, 9.286968e-001, 9.291023e-001, 9.295077e-001, 9.299131e-001, 9.303185e-001, 9.307240e-001, 9.311294e-001, 9.315327e-001,
+9.319350e-001, 9.323373e-001, 9.327396e-001, 9.331419e-001, 9.335443e-001, 9.339466e-001, 9.343459e-001, 9.347449e-001, 9.351439e-001, 9.355429e-001,
+9.359419e-001, 9.363409e-001, 9.367398e-001, 9.371360e-001, 9.375322e-001, 9.379285e-001, 9.383247e-001, 9.387210e-001, 9.391172e-001, 9.395130e-001,
+9.399057e-001, 9.402983e-001, 9.406910e-001, 9.410837e-001, 9.414764e-001, 9.418690e-001, 9.422610e-001, 9.426497e-001, 9.430383e-001, 9.434270e-001,
+9.438156e-001, 9.442043e-001, 9.445929e-001, 9.449806e-001, 9.453630e-001, 9.457453e-001, 9.461276e-001, 9.465099e-001, 9.468922e-001, 9.472745e-001,
+9.476563e-001, 9.480309e-001, 9.484055e-001, 9.487801e-001, 9.491548e-001, 9.495294e-001, 9.499040e-001, 9.502786e-001, 9.506484e-001, 9.510179e-001,
+9.513873e-001, 9.517567e-001, 9.521262e-001, 9.524956e-001, 9.528651e-001, 9.532323e-001, 9.535987e-001, 9.539651e-001, 9.543314e-001, 9.546978e-001,
+9.550642e-001, 9.554306e-001, 9.557952e-001, 9.561577e-001, 9.565202e-001, 9.568827e-001, 9.572452e-001, 9.576077e-001, 9.579702e-001, 9.583321e-001,
+9.586902e-001, 9.590483e-001, 9.594063e-001, 9.597644e-001, 9.601225e-001, 9.604806e-001, 9.608387e-001, 9.611936e-001, 9.615475e-001, 9.619014e-001,
+9.622553e-001, 9.626092e-001, 9.629632e-001, 9.633171e-001, 9.636694e-001, 9.640186e-001, 9.643678e-001, 9.647170e-001, 9.650662e-001, 9.654154e-001,
+9.657646e-001, 9.661138e-001, 9.664590e-001, 9.668033e-001, 9.671476e-001, 9.674918e-001, 9.678361e-001, 9.681804e-001, 9.685247e-001, 9.688678e-001,
+9.692076e-001, 9.695475e-001, 9.698873e-001, 9.702271e-001, 9.705669e-001, 9.709067e-001, 9.712465e-001, 9.715837e-001, 9.719192e-001, 9.722548e-001,
+9.725904e-001, 9.729259e-001, 9.732615e-001, 9.735971e-001, 9.739326e-001, 9.742640e-001, 9.745951e-001, 9.749262e-001, 9.752573e-001, 9.755884e-001,
+9.759195e-001, 9.762506e-001, 9.765808e-001, 9.769068e-001, 9.772328e-001, 9.775589e-001, 9.778849e-001, 9.782109e-001, 9.785370e-001, 9.788630e-001,
+9.791871e-001, 9.795077e-001, 9.798284e-001, 9.801491e-001, 9.804697e-001, 9.807904e-001, 9.811111e-001, 9.814317e-001, 9.817494e-001, 9.820638e-001,
+9.823782e-001, 9.826926e-001, 9.830070e-001, 9.833214e-001, 9.836357e-001, 9.839501e-001, 9.842608e-001, 9.845682e-001, 9.848756e-001, 9.851830e-001,
+9.854904e-001, 9.857978e-001, 9.861052e-001, 9.864126e-001, 9.867163e-001, 9.870164e-001, 9.873165e-001, 9.876166e-001, 9.879167e-001, 9.882168e-001,
+9.885169e-001, 9.888170e-001, 9.891131e-001, 9.894037e-001, 9.896944e-001, 9.899850e-001, 9.902757e-001, 9.905663e-001, 9.908569e-001, 9.911476e-001,
+9.914353e-001, 9.917154e-001, 9.919955e-001, 9.922757e-001, 9.925558e-001, 9.928359e-001, 9.931161e-001, 9.933962e-001, 9.936756e-001, 9.939449e-001,
+9.942141e-001, 9.944833e-001, 9.947525e-001, 9.950217e-001, 9.952910e-001, 9.955602e-001, 9.958294e-001, 9.960866e-001, 9.963404e-001, 9.965942e-001,
+9.968479e-001, 9.971017e-001, 9.973555e-001, 9.976093e-001, 9.978630e-001, 9.981094e-001, 9.983457e-001, 9.985821e-001, 9.988184e-001, 9.990547e-001,
+9.992910e-001, 9.995274e-001, 9.997637e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.215095e-002, 2.348464e-002, 3.359138e-002, 4.270720e-002, 5.102509e-002, 5.870310e-002, 6.582734e-002, 7.249578e-002, 7.877535e-002,
+8.470343e-002, 9.034056e-002, 9.577257e-002, 1.010297e-001, 1.061295e-001, 1.110760e-001, 1.158965e-001, 1.205943e-001, 1.251748e-001, 1.296517e-001,
+1.340275e-001, 1.383040e-001, 1.424948e-001, 1.466038e-001, 1.506411e-001, 1.545946e-001, 1.584779e-001, 1.622925e-001, 1.660465e-001, 1.697326e-001,
+1.733641e-001, 1.769355e-001, 1.804487e-001, 1.839038e-001, 1.873079e-001, 1.906577e-001, 1.939612e-001, 1.972207e-001, 2.004391e-001, 2.036168e-001,
+2.067523e-001, 2.098508e-001, 2.129166e-001, 2.159480e-001, 2.189517e-001, 2.219190e-001, 2.248522e-001, 2.277561e-001, 2.306238e-001, 2.334605e-001,
+2.362726e-001, 2.390560e-001, 2.418100e-001, 2.445426e-001, 2.472528e-001, 2.499340e-001, 2.525875e-001, 2.552197e-001, 2.578315e-001, 2.604233e-001,
+2.629945e-001, 2.655487e-001, 2.680801e-001, 2.705904e-001, 2.730822e-001, 2.755583e-001, 2.780191e-001, 2.804581e-001, 2.828805e-001, 2.852869e-001,
+2.876778e-001, 2.900504e-001, 2.924055e-001, 2.947434e-001, 2.970635e-001, 2.993713e-001, 3.016661e-001, 3.039462e-001, 3.062120e-001, 3.084635e-001,
+3.106997e-001, 3.129228e-001, 3.151350e-001, 3.173327e-001, 3.195173e-001, 3.216913e-001, 3.238545e-001, 3.260024e-001, 3.281404e-001, 3.302693e-001,
+3.323846e-001, 3.344885e-001, 3.365833e-001, 3.386683e-001, 3.407420e-001, 3.428056e-001, 3.448581e-001, 3.468985e-001, 3.489290e-001, 3.509479e-001,
+3.529567e-001, 3.549567e-001, 3.569483e-001, 3.589294e-001, 3.609010e-001, 3.628634e-001, 3.648137e-001, 3.667524e-001, 3.686821e-001, 3.706042e-001,
+3.725176e-001, 3.744211e-001, 3.763136e-001, 3.781942e-001, 3.800665e-001, 3.819315e-001, 3.837873e-001, 3.856337e-001, 3.874723e-001, 3.893026e-001,
+3.911237e-001, 3.929348e-001, 3.947355e-001, 3.965282e-001, 3.983116e-001, 4.000879e-001, 4.018566e-001, 4.036169e-001, 4.053681e-001, 4.071126e-001,
+4.088493e-001, 4.105801e-001, 4.123050e-001, 4.140235e-001, 4.157349e-001, 4.174388e-001, 4.191351e-001, 4.208256e-001, 4.225084e-001, 4.241840e-001,
+4.258518e-001, 4.275138e-001, 4.291699e-001, 4.308196e-001, 4.324635e-001, 4.340988e-001, 4.357272e-001, 4.373479e-001, 4.389612e-001, 4.405670e-001,
+4.421641e-001, 4.437515e-001, 4.453322e-001, 4.469064e-001, 4.484743e-001, 4.500342e-001, 4.515858e-001, 4.531300e-001, 4.546671e-001, 4.561973e-001,
+4.577196e-001, 4.592362e-001, 4.607473e-001, 4.622529e-001, 4.637500e-001, 4.652412e-001, 4.667269e-001, 4.682061e-001, 4.696769e-001, 4.711420e-001,
+4.726015e-001, 4.740525e-001, 4.754966e-001, 4.769351e-001, 4.783663e-001, 4.797913e-001, 4.812120e-001, 4.826277e-001, 4.840363e-001, 4.854405e-001,
+4.868402e-001, 4.882322e-001, 4.896200e-001, 4.910031e-001, 4.923816e-001, 4.937570e-001, 4.951288e-001, 4.964961e-001, 4.978607e-001, 4.992212e-001,
+5.005778e-001, 5.019320e-001, 5.032813e-001, 5.046276e-001, 5.059718e-001, 5.073100e-001, 5.086461e-001, 5.099795e-001, 5.113079e-001, 5.126343e-001,
+5.139568e-001, 5.152761e-001, 5.165923e-001, 5.179046e-001, 5.192151e-001, 5.205205e-001, 5.218238e-001, 5.231245e-001, 5.244206e-001, 5.257151e-001,
+5.270052e-001, 5.282934e-001, 5.295774e-001, 5.308589e-001, 5.321383e-001, 5.334130e-001, 5.346865e-001, 5.359553e-001, 5.372230e-001, 5.384859e-001,
+5.397471e-001, 5.410055e-001, 5.422606e-001, 5.435131e-001, 5.447624e-001, 5.460105e-001, 5.472520e-001, 5.484924e-001, 5.497261e-001, 5.509590e-001,
+5.521854e-001, 5.534103e-001, 5.546302e-001, 5.558479e-001, 5.570606e-001, 5.582710e-001, 5.594774e-001, 5.606803e-001, 5.618779e-001, 5.630717e-001,
+5.642608e-001, 5.654461e-001, 5.666270e-001, 5.678041e-001, 5.689769e-001, 5.701464e-001, 5.713114e-001, 5.724735e-001, 5.736311e-001, 5.747861e-001,
+5.759365e-001, 5.770849e-001, 5.782284e-001, 5.793705e-001, 5.805072e-001, 5.816432e-001, 5.827718e-001, 5.839004e-001, 5.850208e-001, 5.861410e-001,
+5.872549e-001, 5.883676e-001, 5.894749e-001, 5.905798e-001, 5.916802e-001, 5.927765e-001, 5.938697e-001, 5.949565e-001, 5.960424e-001, 5.971216e-001,
+5.982008e-001, 5.992723e-001, 6.003430e-001, 6.014092e-001, 6.024731e-001, 6.035333e-001, 6.045880e-001, 6.056418e-001, 6.066884e-001, 6.077350e-001,
+6.087749e-001, 6.098133e-001, 6.108482e-001, 6.118796e-001, 6.129098e-001, 6.139339e-001, 6.149580e-001, 6.159774e-001, 6.169954e-001, 6.180102e-001,
+6.190204e-001, 6.200305e-001, 6.210335e-001, 6.220365e-001, 6.230355e-001, 6.240319e-001, 6.250271e-001, 6.260160e-001, 6.270048e-001, 6.279885e-001,
+6.289699e-001, 6.299499e-001, 6.309252e-001, 6.319004e-001, 6.328712e-001, 6.338404e-001, 6.348082e-001, 6.357709e-001, 6.367336e-001, 6.376917e-001,
+6.386475e-001, 6.396029e-001, 6.405538e-001, 6.415047e-001, 6.424522e-001, 6.433963e-001, 6.443404e-001, 6.452777e-001, 6.462143e-001, 6.471491e-001,
+6.480789e-001, 6.490087e-001, 6.499348e-001, 6.508586e-001, 6.517825e-001, 6.527013e-001, 6.536199e-001, 6.545372e-001, 6.554513e-001, 6.563654e-001,
+6.572766e-001, 6.581853e-001, 6.590941e-001, 6.599958e-001, 6.608958e-001, 6.617955e-001, 6.626883e-001, 6.635811e-001, 6.644719e-001, 6.653576e-001,
+6.662433e-001, 6.671264e-001, 6.680065e-001, 6.688866e-001, 6.697622e-001, 6.706354e-001, 6.715085e-001, 6.723758e-001, 6.732415e-001, 6.741072e-001,
+6.749666e-001, 6.758253e-001, 6.766840e-001, 6.775373e-001, 6.783906e-001, 6.792434e-001, 6.800917e-001, 6.809399e-001, 6.817874e-001, 6.826301e-001,
+6.834728e-001, 6.843147e-001, 6.851527e-001, 6.859907e-001, 6.868279e-001, 6.876607e-001, 6.884934e-001, 6.893253e-001, 6.901518e-001, 6.909784e-001,
+6.918042e-001, 6.926235e-001, 6.934428e-001, 6.942619e-001, 6.950754e-001, 6.958889e-001, 6.967023e-001, 6.975109e-001, 6.983190e-001, 6.991271e-001,
+6.999309e-001, 7.007337e-001, 7.015365e-001, 7.023349e-001, 7.031309e-001, 7.039269e-001, 7.047196e-001, 7.055087e-001, 7.062977e-001, 7.070851e-001,
+7.078681e-001, 7.086512e-001, 7.094340e-001, 7.102120e-001, 7.109900e-001, 7.117681e-001, 7.125419e-001, 7.133145e-001, 7.140871e-001, 7.148566e-001,
+7.156231e-001, 7.163895e-001, 7.171550e-001, 7.179165e-001, 7.186780e-001, 7.194394e-001, 7.201959e-001, 7.209516e-001, 7.217072e-001, 7.224601e-001,
+7.232103e-001, 7.239604e-001, 7.247099e-001, 7.254532e-001, 7.261965e-001, 7.269399e-001, 7.276785e-001, 7.284149e-001, 7.291513e-001, 7.298863e-001,
+7.306169e-001, 7.313475e-001, 7.320780e-001, 7.328051e-001, 7.335310e-001, 7.342568e-001, 7.349815e-001, 7.357025e-001, 7.364236e-001, 7.371446e-001,
+7.378604e-001, 7.385740e-001, 7.392876e-001, 7.400004e-001, 7.407082e-001, 7.414161e-001, 7.421239e-001, 7.428290e-001, 7.435317e-001, 7.442344e-001,
+7.449372e-001, 7.456340e-001, 7.463302e-001, 7.470265e-001, 7.477209e-001, 7.484100e-001, 7.490992e-001, 7.497884e-001, 7.504742e-001, 7.511576e-001,
+7.518410e-001, 7.525244e-001, 7.532038e-001, 7.538826e-001, 7.545615e-001, 7.552398e-001, 7.559140e-001, 7.565883e-001, 7.572625e-001, 7.579351e-001,
+7.586043e-001, 7.592735e-001, 7.599428e-001, 7.606091e-001, 7.612728e-001, 7.619364e-001, 7.626001e-001, 7.632592e-001, 7.639162e-001, 7.645732e-001,
+7.652302e-001, 7.658815e-001, 7.665314e-001, 7.671813e-001, 7.678311e-001, 7.684758e-001, 7.691198e-001, 7.697638e-001, 7.704078e-001, 7.710476e-001,
+7.716872e-001, 7.723268e-001, 7.729664e-001, 7.736010e-001, 7.742356e-001, 7.748702e-001, 7.755048e-001, 7.761335e-001, 7.767620e-001, 7.773906e-001,
+7.780191e-001, 7.786415e-001, 7.792635e-001, 7.798856e-001, 7.805076e-001, 7.811251e-001, 7.817419e-001, 7.823588e-001, 7.829756e-001, 7.835885e-001,
+7.842003e-001, 7.848121e-001, 7.854239e-001, 7.860323e-001, 7.866387e-001, 7.872452e-001, 7.878516e-001, 7.884562e-001, 7.890587e-001, 7.896612e-001,
+7.902637e-001, 7.908648e-001, 7.914619e-001, 7.920590e-001, 7.926562e-001, 7.932532e-001, 7.938435e-001, 7.944339e-001, 7.950242e-001, 7.956146e-001,
+7.962009e-001, 7.967859e-001, 7.973708e-001, 7.979558e-001, 7.985386e-001, 7.991185e-001, 7.996984e-001, 8.002783e-001, 8.008578e-001, 8.014324e-001,
+8.020071e-001, 8.025818e-001, 8.031564e-001, 8.037273e-001, 8.042966e-001, 8.048658e-001, 8.054350e-001, 8.060028e-001, 8.065670e-001, 8.071311e-001,
+8.076952e-001, 8.082594e-001, 8.088205e-001, 8.093809e-001, 8.099413e-001, 8.105017e-001, 8.110610e-001, 8.116179e-001, 8.121749e-001, 8.127318e-001,
+8.132887e-001, 8.138428e-001, 8.143961e-001, 8.149495e-001, 8.155028e-001, 8.160553e-001, 8.166048e-001, 8.171543e-001, 8.177038e-001, 8.182533e-001,
+8.188000e-001, 8.193449e-001, 8.198898e-001, 8.204347e-001, 8.209796e-001, 8.215199e-001, 8.220600e-001, 8.226002e-001, 8.231403e-001, 8.236796e-001,
+8.242164e-001, 8.247532e-001, 8.252901e-001, 8.258269e-001, 8.263613e-001, 8.268937e-001, 8.274262e-001, 8.279586e-001, 8.284910e-001, 8.290189e-001,
+8.295457e-001, 8.300724e-001, 8.305992e-001, 8.311259e-001, 8.316484e-001, 8.321709e-001, 8.326934e-001, 8.332159e-001, 8.337378e-001, 8.342564e-001,
+8.347750e-001, 8.352936e-001, 8.358123e-001, 8.363299e-001, 8.368446e-001, 8.373593e-001, 8.378741e-001, 8.383888e-001, 8.389022e-001, 8.394131e-001,
+8.399240e-001, 8.404349e-001, 8.409458e-001, 8.414549e-001, 8.419613e-001, 8.424677e-001, 8.429740e-001, 8.434804e-001, 8.439850e-001, 8.444868e-001,
+8.449886e-001, 8.454904e-001, 8.459923e-001, 8.464931e-001, 8.469918e-001, 8.474906e-001, 8.479894e-001, 8.484881e-001, 8.489859e-001, 8.494806e-001,
+8.499753e-001, 8.504700e-001, 8.509647e-001, 8.514588e-001, 8.519485e-001, 8.524381e-001, 8.529277e-001, 8.534173e-001, 8.539069e-001, 8.543931e-001,
+8.548791e-001, 8.553650e-001, 8.558510e-001, 8.563370e-001, 8.568208e-001, 8.573036e-001, 8.577865e-001, 8.582694e-001, 8.587523e-001, 8.592330e-001,
+8.597115e-001, 8.601899e-001, 8.606684e-001, 8.611468e-001, 8.616246e-001, 8.620990e-001, 8.625734e-001, 8.630478e-001, 8.635222e-001, 8.639966e-001,
+8.644681e-001, 8.649390e-001, 8.654098e-001, 8.658807e-001, 8.663516e-001, 8.668204e-001, 8.672864e-001, 8.677525e-001, 8.682186e-001, 8.686846e-001,
+8.691507e-001, 8.696124e-001, 8.700740e-001, 8.705356e-001, 8.709973e-001, 8.714589e-001, 8.719185e-001, 8.723762e-001, 8.728339e-001, 8.732916e-001,
+8.737492e-001, 8.742069e-001, 8.746609e-001, 8.751148e-001, 8.755686e-001, 8.760225e-001, 8.764764e-001, 8.769293e-001, 8.773809e-001, 8.778325e-001,
+8.782840e-001, 8.787356e-001, 8.791871e-001, 8.796362e-001, 8.800847e-001, 8.805331e-001, 8.809816e-001, 8.814301e-001, 8.818780e-001, 8.823225e-001,
+8.827670e-001, 8.832115e-001, 8.836559e-001, 8.841004e-001, 8.845439e-001, 8.849858e-001, 8.854278e-001, 8.858698e-001, 8.863118e-001, 8.867537e-001,
+8.871935e-001, 8.876323e-001, 8.880710e-001, 8.885097e-001, 8.889484e-001, 8.893871e-001, 8.898223e-001, 8.902569e-001, 8.906915e-001, 8.911260e-001,
+8.915606e-001, 8.919952e-001, 8.924271e-001, 8.928590e-001, 8.932909e-001, 8.937228e-001, 8.941547e-001, 8.945863e-001, 8.950147e-001, 8.954432e-001,
+8.958717e-001, 8.963002e-001, 8.967287e-001, 8.971565e-001, 8.975807e-001, 8.980049e-001, 8.984291e-001, 8.988533e-001, 8.992775e-001, 8.997013e-001,
+9.001227e-001, 9.005440e-001, 9.009654e-001, 9.013867e-001, 9.018081e-001, 9.022291e-001, 9.026469e-001, 9.030647e-001, 9.034825e-001, 9.039003e-001,
+9.043181e-001, 9.047358e-001, 9.051484e-001, 9.055609e-001, 9.059733e-001, 9.063858e-001, 9.067983e-001, 9.072108e-001, 9.076198e-001, 9.080280e-001,
+9.084363e-001, 9.088446e-001, 9.092529e-001, 9.096612e-001, 9.100680e-001, 9.104740e-001, 9.108799e-001, 9.112859e-001, 9.116918e-001, 9.120978e-001,
+9.125026e-001, 9.129055e-001, 9.133084e-001, 9.137113e-001, 9.141143e-001, 9.145172e-001, 9.149199e-001, 9.153188e-001, 9.157177e-001, 9.161166e-001,
+9.165155e-001, 9.169144e-001, 9.173133e-001, 9.177098e-001, 9.181053e-001, 9.185008e-001, 9.188963e-001, 9.192918e-001, 9.196873e-001, 9.200820e-001,
+9.204747e-001, 9.208674e-001, 9.212602e-001, 9.216529e-001, 9.220456e-001, 9.224384e-001, 9.228280e-001, 9.232170e-001, 9.236061e-001, 9.239951e-001,
+9.243841e-001, 9.247731e-001, 9.251612e-001, 9.255470e-001, 9.259329e-001, 9.263188e-001, 9.267047e-001, 9.270906e-001, 9.274765e-001, 9.278605e-001,
+9.282439e-001, 9.286273e-001, 9.290107e-001, 9.293940e-001, 9.297774e-001, 9.301604e-001, 9.305404e-001, 9.309204e-001, 9.313003e-001, 9.316803e-001,
+9.320603e-001, 9.324402e-001, 9.328190e-001, 9.331961e-001, 9.335732e-001, 9.339503e-001, 9.343274e-001, 9.347046e-001, 9.350817e-001, 9.354572e-001,
+9.358321e-001, 9.362070e-001, 9.365818e-001, 9.369567e-001, 9.373315e-001, 9.377064e-001, 9.380785e-001, 9.384502e-001, 9.388219e-001, 9.391937e-001,
+9.395654e-001, 9.399371e-001, 9.403087e-001, 9.406779e-001, 9.410470e-001, 9.414162e-001, 9.417853e-001, 9.421545e-001, 9.425236e-001, 9.428925e-001,
+9.432596e-001, 9.436268e-001, 9.439939e-001, 9.443610e-001, 9.447281e-001, 9.450953e-001, 9.454617e-001, 9.458244e-001, 9.461872e-001, 9.465500e-001,
+9.469127e-001, 9.472755e-001, 9.476383e-001, 9.480001e-001, 9.483563e-001, 9.487125e-001, 9.490686e-001, 9.494248e-001, 9.497810e-001, 9.501372e-001,
+9.504930e-001, 9.508437e-001, 9.511944e-001, 9.515451e-001, 9.518958e-001, 9.522465e-001, 9.525972e-001, 9.529479e-001, 9.532949e-001, 9.536416e-001,
+9.539884e-001, 9.543351e-001, 9.546818e-001, 9.550286e-001, 9.553753e-001, 9.557195e-001, 9.560628e-001, 9.564061e-001, 9.567494e-001, 9.570927e-001,
+9.574360e-001, 9.577793e-001, 9.581212e-001, 9.584614e-001, 9.588016e-001, 9.591418e-001, 9.594820e-001, 9.598221e-001, 9.601623e-001, 9.605020e-001,
+9.608385e-001, 9.611749e-001, 9.615114e-001, 9.618479e-001, 9.621844e-001, 9.625208e-001, 9.628573e-001, 9.631907e-001, 9.635231e-001, 9.638555e-001,
+9.641879e-001, 9.645203e-001, 9.648527e-001, 9.651851e-001, 9.655163e-001, 9.658449e-001, 9.661736e-001, 9.665022e-001, 9.668309e-001, 9.671595e-001,
+9.674882e-001, 9.678168e-001, 9.681419e-001, 9.684663e-001, 9.687907e-001, 9.691151e-001, 9.694394e-001, 9.697638e-001, 9.700882e-001, 9.704114e-001,
+9.707313e-001, 9.710512e-001, 9.713711e-001, 9.716910e-001, 9.720108e-001, 9.723307e-001, 9.726506e-001, 9.729677e-001, 9.732832e-001, 9.735987e-001,
+9.739142e-001, 9.742297e-001, 9.745452e-001, 9.748606e-001, 9.751761e-001, 9.754871e-001, 9.757978e-001, 9.761085e-001, 9.764191e-001, 9.767298e-001,
+9.770405e-001, 9.773511e-001, 9.776609e-001, 9.779667e-001, 9.782725e-001, 9.785783e-001, 9.788841e-001, 9.791899e-001, 9.794957e-001, 9.798014e-001,
+9.801053e-001, 9.804059e-001, 9.807065e-001, 9.810070e-001, 9.813076e-001, 9.816082e-001, 9.819088e-001, 9.822093e-001, 9.825073e-001, 9.828023e-001,
+9.830973e-001, 9.833923e-001, 9.836874e-001, 9.839824e-001, 9.842774e-001, 9.845724e-001, 9.848646e-001, 9.851542e-001, 9.854438e-001, 9.857334e-001,
+9.860230e-001, 9.863127e-001, 9.866023e-001, 9.868919e-001, 9.871781e-001, 9.874611e-001, 9.877441e-001, 9.880272e-001, 9.883102e-001, 9.885932e-001,
+9.888762e-001, 9.891592e-001, 9.894392e-001, 9.897153e-001, 9.899914e-001, 9.902674e-001, 9.905435e-001, 9.908196e-001, 9.910956e-001, 9.913717e-001,
+9.916459e-001, 9.919152e-001, 9.921845e-001, 9.924538e-001, 9.927231e-001, 9.929924e-001, 9.932618e-001, 9.935311e-001, 9.937998e-001, 9.940592e-001,
+9.943186e-001, 9.945781e-001, 9.948375e-001, 9.950970e-001, 9.953564e-001, 9.956159e-001, 9.958753e-001, 9.961262e-001, 9.963746e-001, 9.966230e-001,
+9.968714e-001, 9.971198e-001, 9.973682e-001, 9.976166e-001, 9.978650e-001, 9.981083e-001, 9.983448e-001, 9.985813e-001, 9.988177e-001, 9.990542e-001,
+9.992906e-001, 9.995271e-001, 9.997635e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.215095e-002, 2.348464e-002, 3.359138e-002, 4.270720e-002, 5.102509e-002, 5.870310e-002, 6.582734e-002, 7.249578e-002, 7.877535e-002,
+8.470343e-002, 9.034056e-002, 9.577257e-002, 1.010297e-001, 1.061295e-001, 1.110760e-001, 1.158965e-001, 1.205943e-001, 1.251748e-001, 1.296517e-001,
+1.340275e-001, 1.383040e-001, 1.424948e-001, 1.466038e-001, 1.506411e-001, 1.545946e-001, 1.584779e-001, 1.622925e-001, 1.660465e-001, 1.697326e-001,
+1.733641e-001, 1.769355e-001, 1.804487e-001, 1.839038e-001, 1.873079e-001, 1.906577e-001, 1.939612e-001, 1.972207e-001, 2.004391e-001, 2.036168e-001,
+2.067523e-001, 2.098508e-001, 2.129166e-001, 2.159480e-001, 2.189517e-001, 2.219190e-001, 2.248522e-001, 2.277561e-001, 2.306238e-001, 2.334605e-001,
+2.362726e-001, 2.390560e-001, 2.418100e-001, 2.445426e-001, 2.472528e-001, 2.499340e-001, 2.525875e-001, 2.552197e-001, 2.578315e-001, 2.604233e-001,
+2.629945e-001, 2.655487e-001, 2.680801e-001, 2.705904e-001, 2.730822e-001, 2.755583e-001, 2.780191e-001, 2.804581e-001, 2.828805e-001, 2.852869e-001,
+2.876778e-001, 2.900504e-001, 2.924055e-001, 2.947434e-001, 2.970635e-001, 2.993713e-001, 3.016661e-001, 3.039462e-001, 3.062120e-001, 3.084635e-001,
+3.106997e-001, 3.129228e-001, 3.151350e-001, 3.173327e-001, 3.195173e-001, 3.216913e-001, 3.238545e-001, 3.260024e-001, 3.281404e-001, 3.302693e-001,
+3.323846e-001, 3.344885e-001, 3.365833e-001, 3.386683e-001, 3.407420e-001, 3.428056e-001, 3.448581e-001, 3.468985e-001, 3.489290e-001, 3.509479e-001,
+3.529567e-001, 3.549567e-001, 3.569483e-001, 3.589294e-001, 3.609010e-001, 3.628634e-001, 3.648137e-001, 3.667524e-001, 3.686821e-001, 3.706042e-001,
+3.725176e-001, 3.744211e-001, 3.763136e-001, 3.781942e-001, 3.800665e-001, 3.819315e-001, 3.837873e-001, 3.856337e-001, 3.874723e-001, 3.893026e-001,
+3.911237e-001, 3.929348e-001, 3.947355e-001, 3.965282e-001, 3.983116e-001, 4.000879e-001, 4.018566e-001, 4.036169e-001, 4.053681e-001, 4.071126e-001,
+4.088493e-001, 4.105801e-001, 4.123050e-001, 4.140235e-001, 4.157349e-001, 4.174388e-001, 4.191351e-001, 4.208256e-001, 4.225084e-001, 4.241840e-001,
+4.258518e-001, 4.275138e-001, 4.291699e-001, 4.308196e-001, 4.324635e-001, 4.340988e-001, 4.357272e-001, 4.373479e-001, 4.389612e-001, 4.405670e-001,
+4.421641e-001, 4.437515e-001, 4.453322e-001, 4.469064e-001, 4.484743e-001, 4.500342e-001, 4.515858e-001, 4.531300e-001, 4.546671e-001, 4.561973e-001,
+4.577196e-001, 4.592362e-001, 4.607473e-001, 4.622529e-001, 4.637500e-001, 4.652412e-001, 4.667269e-001, 4.682061e-001, 4.696769e-001, 4.711420e-001,
+4.726015e-001, 4.740525e-001, 4.754966e-001, 4.769351e-001, 4.783663e-001, 4.797913e-001, 4.812120e-001, 4.826277e-001, 4.840363e-001, 4.854405e-001,
+4.868402e-001, 4.882322e-001, 4.896200e-001, 4.910031e-001, 4.923816e-001, 4.937570e-001, 4.951288e-001, 4.964961e-001, 4.978607e-001, 4.992212e-001,
+5.005778e-001, 5.019320e-001, 5.032813e-001, 5.046276e-001, 5.059718e-001, 5.073100e-001, 5.086461e-001, 5.099795e-001, 5.113079e-001, 5.126343e-001,
+5.139568e-001, 5.152761e-001, 5.165923e-001, 5.179046e-001, 5.192151e-001, 5.205205e-001, 5.218238e-001, 5.231245e-001, 5.244206e-001, 5.257151e-001,
+5.270052e-001, 5.282934e-001, 5.295774e-001, 5.308589e-001, 5.321383e-001, 5.334130e-001, 5.346865e-001, 5.359553e-001, 5.372230e-001, 5.384859e-001,
+5.397471e-001, 5.410055e-001, 5.422606e-001, 5.435131e-001, 5.447624e-001, 5.460105e-001, 5.472520e-001, 5.484924e-001, 5.497261e-001, 5.509590e-001,
+5.521854e-001, 5.534103e-001, 5.546302e-001, 5.558479e-001, 5.570606e-001, 5.582710e-001, 5.594774e-001, 5.606803e-001, 5.618779e-001, 5.630717e-001,
+5.642608e-001, 5.654461e-001, 5.666270e-001, 5.678041e-001, 5.689769e-001, 5.701464e-001, 5.713114e-001, 5.724735e-001, 5.736311e-001, 5.747861e-001,
+5.759365e-001, 5.770849e-001, 5.782284e-001, 5.793705e-001, 5.805072e-001, 5.816432e-001, 5.827718e-001, 5.839004e-001, 5.850208e-001, 5.861410e-001,
+5.872549e-001, 5.883676e-001, 5.894749e-001, 5.905798e-001, 5.916802e-001, 5.927765e-001, 5.938697e-001, 5.949565e-001, 5.960424e-001, 5.971216e-001,
+5.982008e-001, 5.992723e-001, 6.003430e-001, 6.014092e-001, 6.024731e-001, 6.035333e-001, 6.045880e-001, 6.056418e-001, 6.066884e-001, 6.077350e-001,
+6.087749e-001, 6.098133e-001, 6.108482e-001, 6.118796e-001, 6.129098e-001, 6.139339e-001, 6.149580e-001, 6.159774e-001, 6.169954e-001, 6.180102e-001,
+6.190204e-001, 6.200305e-001, 6.210335e-001, 6.220365e-001, 6.230355e-001, 6.240319e-001, 6.250271e-001, 6.260160e-001, 6.270048e-001, 6.279885e-001,
+6.289699e-001, 6.299499e-001, 6.309252e-001, 6.319004e-001, 6.328712e-001, 6.338404e-001, 6.348082e-001, 6.357709e-001, 6.367336e-001, 6.376917e-001,
+6.386475e-001, 6.396029e-001, 6.405538e-001, 6.415047e-001, 6.424522e-001, 6.433963e-001, 6.443404e-001, 6.452777e-001, 6.462143e-001, 6.471491e-001,
+6.480789e-001, 6.490087e-001, 6.499348e-001, 6.508586e-001, 6.517825e-001, 6.527013e-001, 6.536199e-001, 6.545372e-001, 6.554513e-001, 6.563654e-001,
+6.572766e-001, 6.581853e-001, 6.590941e-001, 6.599958e-001, 6.608958e-001, 6.617955e-001, 6.626883e-001, 6.635811e-001, 6.644719e-001, 6.653576e-001,
+6.662433e-001, 6.671264e-001, 6.680065e-001, 6.688866e-001, 6.697622e-001, 6.706354e-001, 6.715085e-001, 6.723758e-001, 6.732415e-001, 6.741072e-001,
+6.749666e-001, 6.758253e-001, 6.766840e-001, 6.775373e-001, 6.783906e-001, 6.792434e-001, 6.800917e-001, 6.809399e-001, 6.817874e-001, 6.826301e-001,
+6.834728e-001, 6.843147e-001, 6.851527e-001, 6.859907e-001, 6.868279e-001, 6.876607e-001, 6.884934e-001, 6.893253e-001, 6.901518e-001, 6.909784e-001,
+6.918042e-001, 6.926235e-001, 6.934428e-001, 6.942619e-001, 6.950754e-001, 6.958889e-001, 6.967023e-001, 6.975109e-001, 6.983190e-001, 6.991271e-001,
+6.999309e-001, 7.007337e-001, 7.015365e-001, 7.023349e-001, 7.031309e-001, 7.039269e-001, 7.047196e-001, 7.055087e-001, 7.062977e-001, 7.070851e-001,
+7.078681e-001, 7.086512e-001, 7.094340e-001, 7.102120e-001, 7.109900e-001, 7.117681e-001, 7.125419e-001, 7.133145e-001, 7.140871e-001, 7.148566e-001,
+7.156231e-001, 7.163895e-001, 7.171550e-001, 7.179165e-001, 7.186780e-001, 7.194394e-001, 7.201959e-001, 7.209516e-001, 7.217072e-001, 7.224601e-001,
+7.232103e-001, 7.239604e-001, 7.247099e-001, 7.254532e-001, 7.261965e-001, 7.269399e-001, 7.276785e-001, 7.284149e-001, 7.291513e-001, 7.298863e-001,
+7.306169e-001, 7.313475e-001, 7.320780e-001, 7.328051e-001, 7.335310e-001, 7.342568e-001, 7.349815e-001, 7.357025e-001, 7.364236e-001, 7.371446e-001,
+7.378604e-001, 7.385740e-001, 7.392876e-001, 7.400004e-001, 7.407082e-001, 7.414161e-001, 7.421239e-001, 7.428290e-001, 7.435317e-001, 7.442344e-001,
+7.449372e-001, 7.456340e-001, 7.463302e-001, 7.470265e-001, 7.477209e-001, 7.484100e-001, 7.490992e-001, 7.497884e-001, 7.504742e-001, 7.511576e-001,
+7.518410e-001, 7.525244e-001, 7.532038e-001, 7.538826e-001, 7.545615e-001, 7.552398e-001, 7.559140e-001, 7.565883e-001, 7.572625e-001, 7.579351e-001,
+7.586043e-001, 7.592735e-001, 7.599428e-001, 7.606091e-001, 7.612728e-001, 7.619364e-001, 7.626001e-001, 7.632592e-001, 7.639162e-001, 7.645732e-001,
+7.652302e-001, 7.658815e-001, 7.665314e-001, 7.671813e-001, 7.678311e-001, 7.684758e-001, 7.691198e-001, 7.697638e-001, 7.704078e-001, 7.710476e-001,
+7.716872e-001, 7.723268e-001, 7.729664e-001, 7.736010e-001, 7.742356e-001, 7.748702e-001, 7.755048e-001, 7.761335e-001, 7.767620e-001, 7.773906e-001,
+7.780191e-001, 7.786415e-001, 7.792635e-001, 7.798856e-001, 7.805076e-001, 7.811251e-001, 7.817419e-001, 7.823588e-001, 7.829756e-001, 7.835885e-001,
+7.842003e-001, 7.848121e-001, 7.854239e-001, 7.860323e-001, 7.866387e-001, 7.872452e-001, 7.878516e-001, 7.884562e-001, 7.890587e-001, 7.896612e-001,
+7.902637e-001, 7.908648e-001, 7.914619e-001, 7.920590e-001, 7.926562e-001, 7.932532e-001, 7.938435e-001, 7.944339e-001, 7.950242e-001, 7.956146e-001,
+7.962009e-001, 7.967859e-001, 7.973708e-001, 7.979558e-001, 7.985386e-001, 7.991185e-001, 7.996984e-001, 8.002783e-001, 8.008578e-001, 8.014324e-001,
+8.020071e-001, 8.025818e-001, 8.031564e-001, 8.037273e-001, 8.042966e-001, 8.048658e-001, 8.054350e-001, 8.060028e-001, 8.065670e-001, 8.071311e-001,
+8.076952e-001, 8.082594e-001, 8.088205e-001, 8.093809e-001, 8.099413e-001, 8.105017e-001, 8.110610e-001, 8.116179e-001, 8.121749e-001, 8.127318e-001,
+8.132887e-001, 8.138428e-001, 8.143961e-001, 8.149495e-001, 8.155028e-001, 8.160553e-001, 8.166048e-001, 8.171543e-001, 8.177038e-001, 8.182533e-001,
+8.188000e-001, 8.193449e-001, 8.198898e-001, 8.204347e-001, 8.209796e-001, 8.215199e-001, 8.220600e-001, 8.226002e-001, 8.231403e-001, 8.236796e-001,
+8.242164e-001, 8.247532e-001, 8.252901e-001, 8.258269e-001, 8.263613e-001, 8.268937e-001, 8.274262e-001, 8.279586e-001, 8.284910e-001, 8.290189e-001,
+8.295457e-001, 8.300724e-001, 8.305992e-001, 8.311259e-001, 8.316484e-001, 8.321709e-001, 8.326934e-001, 8.332159e-001, 8.337378e-001, 8.342564e-001,
+8.347750e-001, 8.352936e-001, 8.358123e-001, 8.363299e-001, 8.368446e-001, 8.373593e-001, 8.378741e-001, 8.383888e-001, 8.389022e-001, 8.394131e-001,
+8.399240e-001, 8.404349e-001, 8.409458e-001, 8.414549e-001, 8.419613e-001, 8.424677e-001, 8.429740e-001, 8.434804e-001, 8.439850e-001, 8.444868e-001,
+8.449886e-001, 8.454904e-001, 8.459923e-001, 8.464931e-001, 8.469918e-001, 8.474906e-001, 8.479894e-001, 8.484881e-001, 8.489859e-001, 8.494806e-001,
+8.499753e-001, 8.504700e-001, 8.509647e-001, 8.514588e-001, 8.519485e-001, 8.524381e-001, 8.529277e-001, 8.534173e-001, 8.539069e-001, 8.543931e-001,
+8.548791e-001, 8.553650e-001, 8.558510e-001, 8.563370e-001, 8.568208e-001, 8.573036e-001, 8.577865e-001, 8.582694e-001, 8.587523e-001, 8.592330e-001,
+8.597115e-001, 8.601899e-001, 8.606684e-001, 8.611468e-001, 8.616246e-001, 8.620990e-001, 8.625734e-001, 8.630478e-001, 8.635222e-001, 8.639966e-001,
+8.644681e-001, 8.649390e-001, 8.654098e-001, 8.658807e-001, 8.663516e-001, 8.668204e-001, 8.672864e-001, 8.677525e-001, 8.682186e-001, 8.686846e-001,
+8.691507e-001, 8.696124e-001, 8.700740e-001, 8.705356e-001, 8.709973e-001, 8.714589e-001, 8.719185e-001, 8.723762e-001, 8.728339e-001, 8.732916e-001,
+8.737492e-001, 8.742069e-001, 8.746609e-001, 8.751148e-001, 8.755686e-001, 8.760225e-001, 8.764764e-001, 8.769293e-001, 8.773809e-001, 8.778325e-001,
+8.782840e-001, 8.787356e-001, 8.791871e-001, 8.796362e-001, 8.800847e-001, 8.805331e-001, 8.809816e-001, 8.814301e-001, 8.818780e-001, 8.823225e-001,
+8.827670e-001, 8.832115e-001, 8.836559e-001, 8.841004e-001, 8.845439e-001, 8.849858e-001, 8.854278e-001, 8.858698e-001, 8.863118e-001, 8.867537e-001,
+8.871935e-001, 8.876323e-001, 8.880710e-001, 8.885097e-001, 8.889484e-001, 8.893871e-001, 8.898223e-001, 8.902569e-001, 8.906915e-001, 8.911260e-001,
+8.915606e-001, 8.919952e-001, 8.924271e-001, 8.928590e-001, 8.932909e-001, 8.937228e-001, 8.941547e-001, 8.945863e-001, 8.950147e-001, 8.954432e-001,
+8.958717e-001, 8.963002e-001, 8.967287e-001, 8.971565e-001, 8.975807e-001, 8.980049e-001, 8.984291e-001, 8.988533e-001, 8.992775e-001, 8.997013e-001,
+9.001227e-001, 9.005440e-001, 9.009654e-001, 9.013867e-001, 9.018081e-001, 9.022291e-001, 9.026469e-001, 9.030647e-001, 9.034825e-001, 9.039003e-001,
+9.043181e-001, 9.047358e-001, 9.051484e-001, 9.055609e-001, 9.059733e-001, 9.063858e-001, 9.067983e-001, 9.072108e-001, 9.076198e-001, 9.080280e-001,
+9.084363e-001, 9.088446e-001, 9.092529e-001, 9.096612e-001, 9.100680e-001, 9.104740e-001, 9.108799e-001, 9.112859e-001, 9.116918e-001, 9.120978e-001,
+9.125026e-001, 9.129055e-001, 9.133084e-001, 9.137113e-001, 9.141143e-001, 9.145172e-001, 9.149199e-001, 9.153188e-001, 9.157177e-001, 9.161166e-001,
+9.165155e-001, 9.169144e-001, 9.173133e-001, 9.177098e-001, 9.181053e-001, 9.185008e-001, 9.188963e-001, 9.192918e-001, 9.196873e-001, 9.200820e-001,
+9.204747e-001, 9.208674e-001, 9.212602e-001, 9.216529e-001, 9.220456e-001, 9.224384e-001, 9.228280e-001, 9.232170e-001, 9.236061e-001, 9.239951e-001,
+9.243841e-001, 9.247731e-001, 9.251612e-001, 9.255470e-001, 9.259329e-001, 9.263188e-001, 9.267047e-001, 9.270906e-001, 9.274765e-001, 9.278605e-001,
+9.282439e-001, 9.286273e-001, 9.290107e-001, 9.293940e-001, 9.297774e-001, 9.301604e-001, 9.305404e-001, 9.309204e-001, 9.313003e-001, 9.316803e-001,
+9.320603e-001, 9.324402e-001, 9.328190e-001, 9.331961e-001, 9.335732e-001, 9.339503e-001, 9.343274e-001, 9.347046e-001, 9.350817e-001, 9.354572e-001,
+9.358321e-001, 9.362070e-001, 9.365818e-001, 9.369567e-001, 9.373315e-001, 9.377064e-001, 9.380785e-001, 9.384502e-001, 9.388219e-001, 9.391937e-001,
+9.395654e-001, 9.399371e-001, 9.403087e-001, 9.406779e-001, 9.410470e-001, 9.414162e-001, 9.417853e-001, 9.421545e-001, 9.425236e-001, 9.428925e-001,
+9.432596e-001, 9.436268e-001, 9.439939e-001, 9.443610e-001, 9.447281e-001, 9.450953e-001, 9.454617e-001, 9.458244e-001, 9.461872e-001, 9.465500e-001,
+9.469127e-001, 9.472755e-001, 9.476383e-001, 9.480001e-001, 9.483563e-001, 9.487125e-001, 9.490686e-001, 9.494248e-001, 9.497810e-001, 9.501372e-001,
+9.504930e-001, 9.508437e-001, 9.511944e-001, 9.515451e-001, 9.518958e-001, 9.522465e-001, 9.525972e-001, 9.529479e-001, 9.532949e-001, 9.536416e-001,
+9.539884e-001, 9.543351e-001, 9.546818e-001, 9.550286e-001, 9.553753e-001, 9.557195e-001, 9.560628e-001, 9.564061e-001, 9.567494e-001, 9.570927e-001,
+9.574360e-001, 9.577793e-001, 9.581212e-001, 9.584614e-001, 9.588016e-001, 9.591418e-001, 9.594820e-001, 9.598221e-001, 9.601623e-001, 9.605020e-001,
+9.608385e-001, 9.611749e-001, 9.615114e-001, 9.618479e-001, 9.621844e-001, 9.625208e-001, 9.628573e-001, 9.631907e-001, 9.635231e-001, 9.638555e-001,
+9.641879e-001, 9.645203e-001, 9.648527e-001, 9.651851e-001, 9.655163e-001, 9.658449e-001, 9.661736e-001, 9.665022e-001, 9.668309e-001, 9.671595e-001,
+9.674882e-001, 9.678168e-001, 9.681419e-001, 9.684663e-001, 9.687907e-001, 9.691151e-001, 9.694394e-001, 9.697638e-001, 9.700882e-001, 9.704114e-001,
+9.707313e-001, 9.710512e-001, 9.713711e-001, 9.716910e-001, 9.720108e-001, 9.723307e-001, 9.726506e-001, 9.729677e-001, 9.732832e-001, 9.735987e-001,
+9.739142e-001, 9.742297e-001, 9.745452e-001, 9.748606e-001, 9.751761e-001, 9.754871e-001, 9.757978e-001, 9.761085e-001, 9.764191e-001, 9.767298e-001,
+9.770405e-001, 9.773511e-001, 9.776609e-001, 9.779667e-001, 9.782725e-001, 9.785783e-001, 9.788841e-001, 9.791899e-001, 9.794957e-001, 9.798014e-001,
+9.801053e-001, 9.804059e-001, 9.807065e-001, 9.810070e-001, 9.813076e-001, 9.816082e-001, 9.819088e-001, 9.822093e-001, 9.825073e-001, 9.828023e-001,
+9.830973e-001, 9.833923e-001, 9.836874e-001, 9.839824e-001, 9.842774e-001, 9.845724e-001, 9.848646e-001, 9.851542e-001, 9.854438e-001, 9.857334e-001,
+9.860230e-001, 9.863127e-001, 9.866023e-001, 9.868919e-001, 9.871781e-001, 9.874611e-001, 9.877441e-001, 9.880272e-001, 9.883102e-001, 9.885932e-001,
+9.888762e-001, 9.891592e-001, 9.894392e-001, 9.897153e-001, 9.899914e-001, 9.902674e-001, 9.905435e-001, 9.908196e-001, 9.910956e-001, 9.913717e-001,
+9.916459e-001, 9.919152e-001, 9.921845e-001, 9.924538e-001, 9.927231e-001, 9.929924e-001, 9.932618e-001, 9.935311e-001, 9.937998e-001, 9.940592e-001,
+9.943186e-001, 9.945781e-001, 9.948375e-001, 9.950970e-001, 9.953564e-001, 9.956159e-001, 9.958753e-001, 9.961262e-001, 9.963746e-001, 9.966230e-001,
+9.968714e-001, 9.971198e-001, 9.973682e-001, 9.976166e-001, 9.978650e-001, 9.981083e-001, 9.983448e-001, 9.985813e-001, 9.988177e-001, 9.990542e-001,
+9.992906e-001, 9.995271e-001, 9.997635e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Ultra 050", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.612960e-002, 4.368141e-002, 5.811572e-002, 7.078841e-002, 8.226837e-002, 9.285231e-002, 1.027420e-001, 1.121006e-001, 1.209674e-001,
+1.293300e-001, 1.372125e-001, 1.446518e-001, 1.517110e-001, 1.584471e-001, 1.648890e-001, 1.710645e-001, 1.769893e-001, 1.826932e-001, 1.881921e-001,
+1.935152e-001, 1.986733e-001, 2.036796e-001, 2.085504e-001, 2.132863e-001, 2.178915e-001, 2.223861e-001, 2.267823e-001, 2.310760e-001, 2.352629e-001,
+2.393414e-001, 2.433320e-001, 2.472561e-001, 2.511122e-001, 2.549034e-001, 2.586241e-001, 2.622673e-001, 2.658410e-001, 2.693549e-001, 2.728112e-001,
+2.762080e-001, 2.795440e-001, 2.828185e-001, 2.860270e-001, 2.891789e-001, 2.922790e-001, 2.953407e-001, 2.983652e-001, 3.013558e-001, 3.043131e-001,
+3.072336e-001, 3.101126e-001, 3.129474e-001, 3.157351e-001, 3.184794e-001, 3.211834e-001, 3.238504e-001, 3.264834e-001, 3.290852e-001, 3.316573e-001,
+3.341959e-001, 3.367032e-001, 3.391803e-001, 3.416262e-001, 3.440424e-001, 3.464321e-001, 3.487968e-001, 3.511417e-001, 3.534660e-001, 3.557670e-001,
+3.580502e-001, 3.603110e-001, 3.625531e-001, 3.647740e-001, 3.669760e-001, 3.691574e-001, 3.713135e-001, 3.734453e-001, 3.755546e-001, 3.776373e-001,
+3.797005e-001, 3.817447e-001, 3.837673e-001, 3.857728e-001, 3.877621e-001, 3.897323e-001, 3.916867e-001, 3.936245e-001, 3.955442e-001, 3.974477e-001,
+3.993370e-001, 4.012120e-001, 4.030662e-001, 4.049043e-001, 4.067262e-001, 4.085323e-001, 4.103250e-001, 4.121057e-001, 4.138724e-001, 4.156246e-001,
+4.173629e-001, 4.190871e-001, 4.207981e-001, 4.224953e-001, 4.241782e-001, 4.258452e-001, 4.274976e-001, 4.291372e-001, 4.307665e-001, 4.323847e-001,
+4.339929e-001, 4.355897e-001, 4.371742e-001, 4.387459e-001, 4.403051e-001, 4.418541e-001, 4.433917e-001, 4.449174e-001, 4.464309e-001, 4.479325e-001,
+4.494239e-001, 4.509056e-001, 4.523761e-001, 4.538336e-001, 4.552781e-001, 4.567125e-001, 4.581381e-001, 4.595550e-001, 4.609611e-001, 4.623561e-001,
+4.637417e-001, 4.651191e-001, 4.664887e-001, 4.678489e-001, 4.691990e-001, 4.705402e-001, 4.718737e-001, 4.731975e-001, 4.745135e-001, 4.758218e-001,
+4.771225e-001, 4.784156e-001, 4.796993e-001, 4.809752e-001, 4.822460e-001, 4.835121e-001, 4.847721e-001, 4.860243e-001, 4.872705e-001, 4.885112e-001,
+4.897464e-001, 4.909758e-001, 4.922002e-001, 4.934197e-001, 4.946335e-001, 4.958421e-001, 4.970463e-001, 4.982448e-001, 4.994386e-001, 5.006300e-001,
+5.018193e-001, 5.030052e-001, 5.041871e-001, 5.053647e-001, 5.065345e-001, 5.077012e-001, 5.088650e-001, 5.100249e-001, 5.111827e-001, 5.123386e-001,
+5.134864e-001, 5.146305e-001, 5.157699e-001, 5.169038e-001, 5.180357e-001, 5.191645e-001, 5.202902e-001, 5.214136e-001, 5.225296e-001, 5.236413e-001,
+5.247489e-001, 5.258507e-001, 5.269507e-001, 5.280470e-001, 5.291407e-001, 5.302323e-001, 5.313162e-001, 5.323974e-001, 5.334717e-001, 5.345427e-001,
+5.356102e-001, 5.366739e-001, 5.377363e-001, 5.387937e-001, 5.398488e-001, 5.408974e-001, 5.419415e-001, 5.429813e-001, 5.440160e-001, 5.450487e-001,
+5.460765e-001, 5.471035e-001, 5.481255e-001, 5.491452e-001, 5.501583e-001, 5.511676e-001, 5.521716e-001, 5.531717e-001, 5.541684e-001, 5.551615e-001,
+5.561527e-001, 5.571410e-001, 5.581284e-001, 5.591105e-001, 5.600914e-001, 5.610645e-001, 5.620365e-001, 5.630018e-001, 5.639666e-001, 5.649260e-001,
+5.658853e-001, 5.668407e-001, 5.677961e-001, 5.687469e-001, 5.696975e-001, 5.706423e-001, 5.715867e-001, 5.725248e-001, 5.734622e-001, 5.743951e-001,
+5.753270e-001, 5.762561e-001, 5.771843e-001, 5.781095e-001, 5.790331e-001, 5.799536e-001, 5.808710e-001, 5.817860e-001, 5.826967e-001, 5.836062e-001,
+5.845116e-001, 5.854169e-001, 5.863186e-001, 5.872203e-001, 5.881203e-001, 5.890198e-001, 5.899166e-001, 5.908117e-001, 5.917043e-001, 5.925925e-001,
+5.934802e-001, 5.943631e-001, 5.952460e-001, 5.961258e-001, 5.970050e-001, 5.978830e-001, 5.987599e-001, 5.996359e-001, 6.005082e-001, 6.013806e-001,
+6.022472e-001, 6.031127e-001, 6.039757e-001, 6.048358e-001, 6.056957e-001, 6.065520e-001, 6.074083e-001, 6.082631e-001, 6.091170e-001, 6.099704e-001,
+6.108219e-001, 6.116735e-001, 6.125208e-001, 6.133668e-001, 6.142112e-001, 6.150517e-001, 6.158922e-001, 6.167294e-001, 6.175658e-001, 6.184015e-001,
+6.192352e-001, 6.200688e-001, 6.209006e-001, 6.217316e-001, 6.225617e-001, 6.233869e-001, 6.242122e-001, 6.250342e-001, 6.258537e-001, 6.266732e-001,
+6.274886e-001, 6.283037e-001, 6.291179e-001, 6.299301e-001, 6.307423e-001, 6.315526e-001, 6.323618e-001, 6.331710e-001, 6.339745e-001, 6.347778e-001,
+6.355797e-001, 6.363770e-001, 6.371744e-001, 6.379694e-001, 6.387622e-001, 6.395550e-001, 6.403455e-001, 6.411351e-001, 6.419247e-001, 6.427112e-001,
+6.434976e-001, 6.442832e-001, 6.450635e-001, 6.458438e-001, 6.466222e-001, 6.473965e-001, 6.481707e-001, 6.489429e-001, 6.497124e-001, 6.504819e-001,
+6.512495e-001, 6.520156e-001, 6.527817e-001, 6.535456e-001, 6.543082e-001, 6.550709e-001, 6.558292e-001, 6.565856e-001, 6.573420e-001, 6.580940e-001,
+6.588441e-001, 6.595943e-001, 6.603410e-001, 6.610863e-001, 6.618315e-001, 6.625743e-001, 6.633159e-001, 6.640575e-001, 6.647968e-001, 6.655348e-001,
+6.662727e-001, 6.670071e-001, 6.677386e-001, 6.684702e-001, 6.691989e-001, 6.699241e-001, 6.706493e-001, 6.713730e-001, 6.720931e-001, 6.728132e-001,
+6.735328e-001, 6.742490e-001, 6.749653e-001, 6.756815e-001, 6.763954e-001, 6.771090e-001, 6.778227e-001, 6.785331e-001, 6.792423e-001, 6.799514e-001,
+6.806577e-001, 6.813606e-001, 6.820635e-001, 6.827655e-001, 6.834632e-001, 6.841610e-001, 6.848588e-001, 6.855532e-001, 6.862471e-001, 6.869410e-001,
+6.876335e-001, 6.883248e-001, 6.890160e-001, 6.897066e-001, 6.903933e-001, 6.910801e-001, 6.917668e-001, 6.924490e-001, 6.931295e-001, 6.938100e-001,
+6.944890e-001, 6.951644e-001, 6.958398e-001, 6.965152e-001, 6.971874e-001, 6.978590e-001, 6.985305e-001, 6.992011e-001, 6.998699e-001, 7.005387e-001,
+7.012075e-001, 7.018737e-001, 7.025392e-001, 7.032047e-001, 7.038692e-001, 7.045303e-001, 7.051914e-001, 7.058525e-001, 7.065105e-001, 7.071667e-001,
+7.078229e-001, 7.084791e-001, 7.091315e-001, 7.097838e-001, 7.104362e-001, 7.110877e-001, 7.117375e-001, 7.123872e-001, 7.130370e-001, 7.136847e-001,
+7.143312e-001, 7.149778e-001, 7.156243e-001, 7.162670e-001, 7.169093e-001, 7.175516e-001, 7.181931e-001, 7.188306e-001, 7.194681e-001, 7.201056e-001,
+7.207418e-001, 7.213757e-001, 7.220095e-001, 7.226433e-001, 7.232758e-001, 7.239070e-001, 7.245383e-001, 7.251695e-001, 7.257998e-001, 7.264295e-001,
+7.270592e-001, 7.276890e-001, 7.283164e-001, 7.289429e-001, 7.295695e-001, 7.301961e-001, 7.308188e-001, 7.314406e-001, 7.320624e-001, 7.326842e-001,
+7.333029e-001, 7.339210e-001, 7.345390e-001, 7.351571e-001, 7.357731e-001, 7.363885e-001, 7.370040e-001, 7.376194e-001, 7.382337e-001, 7.388475e-001,
+7.394614e-001, 7.400752e-001, 7.406880e-001, 7.413003e-001, 7.419126e-001, 7.425248e-001, 7.431350e-001, 7.437434e-001, 7.443519e-001, 7.449604e-001,
+7.455673e-001, 7.461719e-001, 7.467764e-001, 7.473810e-001, 7.479851e-001, 7.485868e-001, 7.491886e-001, 7.497904e-001, 7.503921e-001, 7.509921e-001,
+7.515921e-001, 7.521920e-001, 7.527919e-001, 7.533906e-001, 7.539888e-001, 7.545869e-001, 7.551851e-001, 7.557817e-001, 7.563759e-001, 7.569700e-001,
+7.575641e-001, 7.581582e-001, 7.587483e-001, 7.593384e-001, 7.599286e-001, 7.605187e-001, 7.611069e-001, 7.616940e-001, 7.622811e-001, 7.628683e-001,
+7.634550e-001, 7.640401e-001, 7.646252e-001, 7.652102e-001, 7.657953e-001, 7.663790e-001, 7.669621e-001, 7.675452e-001, 7.681282e-001, 7.687105e-001,
+7.692894e-001, 7.698683e-001, 7.704473e-001, 7.710262e-001, 7.716024e-001, 7.721772e-001, 7.727520e-001, 7.733268e-001, 7.739014e-001, 7.744730e-001,
+7.750446e-001, 7.756163e-001, 7.761879e-001, 7.767586e-001, 7.773280e-001, 7.778974e-001, 7.784668e-001, 7.790363e-001, 7.796041e-001, 7.801713e-001,
+7.807386e-001, 7.813058e-001, 7.818730e-001, 7.824359e-001, 7.829989e-001, 7.835618e-001, 7.841248e-001, 7.846867e-001, 7.852454e-001, 7.858041e-001,
+7.863628e-001, 7.869215e-001, 7.874788e-001, 7.880342e-001, 7.885896e-001, 7.891450e-001, 7.897003e-001, 7.902544e-001, 7.908074e-001, 7.913605e-001,
+7.919135e-001, 7.924665e-001, 7.930180e-001, 7.935686e-001, 7.941193e-001, 7.946700e-001, 7.952207e-001, 7.957681e-001, 7.963144e-001, 7.968607e-001,
+7.974070e-001, 7.979532e-001, 7.984963e-001, 7.990382e-001, 7.995802e-001, 8.001221e-001, 8.006640e-001, 8.012035e-001, 8.017420e-001, 8.022805e-001,
+8.028190e-001, 8.033575e-001, 8.038944e-001, 8.044304e-001, 8.049664e-001, 8.055024e-001, 8.060384e-001, 8.065731e-001, 8.071065e-001, 8.076400e-001,
+8.081734e-001, 8.087069e-001, 8.092389e-001, 8.097679e-001, 8.102968e-001, 8.108258e-001, 8.113547e-001, 8.118832e-001, 8.124077e-001, 8.129323e-001,
+8.134568e-001, 8.139813e-001, 8.145058e-001, 8.150273e-001, 8.155483e-001, 8.160692e-001, 8.165902e-001, 8.171111e-001, 8.176307e-001, 8.181490e-001,
+8.186673e-001, 8.191856e-001, 8.197039e-001, 8.202218e-001, 8.207373e-001, 8.212529e-001, 8.217685e-001, 8.222841e-001, 8.227997e-001, 8.233129e-001,
+8.238252e-001, 8.243375e-001, 8.248498e-001, 8.253621e-001, 8.258734e-001, 8.263819e-001, 8.268905e-001, 8.273990e-001, 8.279076e-001, 8.284161e-001,
+8.289219e-001, 8.294266e-001, 8.299314e-001, 8.304362e-001, 8.309410e-001, 8.314452e-001, 8.319471e-001, 8.324490e-001, 8.329508e-001, 8.334527e-001,
+8.339546e-001, 8.344553e-001, 8.349552e-001, 8.354550e-001, 8.359549e-001, 8.364547e-001, 8.369546e-001, 8.374525e-001, 8.379503e-001, 8.384481e-001,
+8.389458e-001, 8.394436e-001, 8.399409e-001, 8.404362e-001, 8.409314e-001, 8.414267e-001, 8.419219e-001, 8.424171e-001, 8.429111e-001, 8.434033e-001,
+8.438954e-001, 8.443876e-001, 8.448797e-001, 8.453719e-001, 8.458622e-001, 8.463512e-001, 8.468402e-001, 8.473293e-001, 8.478183e-001, 8.483073e-001,
+8.487947e-001, 8.492815e-001, 8.497682e-001, 8.502549e-001, 8.507417e-001, 8.512284e-001, 8.517140e-001, 8.521993e-001, 8.526845e-001, 8.531698e-001,
+8.536551e-001, 8.541403e-001, 8.546244e-001, 8.551082e-001, 8.555921e-001, 8.560759e-001, 8.565597e-001, 8.570435e-001, 8.575249e-001, 8.580054e-001,
+8.584860e-001, 8.589666e-001, 8.594471e-001, 8.599277e-001, 8.604061e-001, 8.608835e-001, 8.613608e-001, 8.618381e-001, 8.623154e-001, 8.627928e-001,
+8.632688e-001, 8.637437e-001, 8.642186e-001, 8.646935e-001, 8.651684e-001, 8.656433e-001, 8.661177e-001, 8.665909e-001, 8.670642e-001, 8.675374e-001,
+8.680107e-001, 8.684839e-001, 8.689571e-001, 8.694287e-001, 8.699004e-001, 8.703720e-001, 8.708436e-001, 8.713153e-001, 8.717869e-001, 8.722561e-001,
+8.727244e-001, 8.731926e-001, 8.736609e-001, 8.741292e-001, 8.745975e-001, 8.750646e-001, 8.755295e-001, 8.759944e-001, 8.764593e-001, 8.769242e-001,
+8.773892e-001, 8.778541e-001, 8.783167e-001, 8.787790e-001, 8.792414e-001, 8.797037e-001, 8.801661e-001, 8.806284e-001, 8.810901e-001, 8.815506e-001,
+8.820112e-001, 8.824718e-001, 8.829324e-001, 8.833929e-001, 8.838535e-001, 8.843126e-001, 8.847714e-001, 8.852302e-001, 8.856890e-001, 8.861478e-001,
+8.866066e-001, 8.870646e-001, 8.875199e-001, 8.879753e-001, 8.884306e-001, 8.888859e-001, 8.893413e-001, 8.897966e-001, 8.902500e-001, 8.907019e-001,
+8.911538e-001, 8.916057e-001, 8.920576e-001, 8.925095e-001, 8.929614e-001, 8.934111e-001, 8.938603e-001, 8.943095e-001, 8.947588e-001, 8.952080e-001,
+8.956572e-001, 8.961064e-001, 8.965537e-001, 8.970010e-001, 8.974484e-001, 8.978957e-001, 8.983430e-001, 8.987903e-001, 8.992373e-001, 8.996827e-001,
+9.001281e-001, 9.005735e-001, 9.010190e-001, 9.014644e-001, 9.019098e-001, 9.023546e-001, 9.027976e-001, 9.032405e-001, 9.036835e-001, 9.041265e-001,
+9.045695e-001, 9.050125e-001, 9.054550e-001, 9.058962e-001, 9.063375e-001, 9.067788e-001, 9.072200e-001, 9.076613e-001, 9.081026e-001, 9.085433e-001,
+9.089824e-001, 9.094215e-001, 9.098605e-001, 9.102996e-001, 9.107387e-001, 9.111778e-001, 9.116166e-001, 9.120534e-001, 9.124903e-001, 9.129271e-001,
+9.133640e-001, 9.138008e-001, 9.142377e-001, 9.146745e-001, 9.151093e-001, 9.155439e-001, 9.159785e-001, 9.164131e-001, 9.168477e-001, 9.172823e-001,
+9.177170e-001, 9.181497e-001, 9.185816e-001, 9.190135e-001, 9.194453e-001, 9.198772e-001, 9.203091e-001, 9.207410e-001, 9.211721e-001, 9.216020e-001,
+9.220318e-001, 9.224616e-001, 9.228915e-001, 9.233213e-001, 9.237512e-001, 9.241810e-001, 9.246084e-001, 9.250357e-001, 9.254631e-001, 9.258904e-001,
+9.263178e-001, 9.267451e-001, 9.271725e-001, 9.275984e-001, 9.280233e-001, 9.284481e-001, 9.288729e-001, 9.292978e-001, 9.297226e-001, 9.301474e-001,
+9.305721e-001, 9.309926e-001, 9.314130e-001, 9.318335e-001, 9.322540e-001, 9.326745e-001, 9.330949e-001, 9.335154e-001, 9.339327e-001, 9.343464e-001,
+9.347601e-001, 9.351738e-001, 9.355874e-001, 9.360011e-001, 9.364148e-001, 9.368285e-001, 9.372366e-001, 9.376435e-001, 9.380504e-001, 9.384573e-001,
+9.388641e-001, 9.392710e-001, 9.396779e-001, 9.400844e-001, 9.404869e-001, 9.408895e-001, 9.412920e-001, 9.416946e-001, 9.420972e-001, 9.424997e-001,
+9.429023e-001, 9.433040e-001, 9.437038e-001, 9.441037e-001, 9.445035e-001, 9.449033e-001, 9.453032e-001, 9.457030e-001, 9.461029e-001, 9.465015e-001,
+9.468986e-001, 9.472957e-001, 9.476929e-001, 9.480900e-001, 9.484871e-001, 9.488843e-001, 9.492814e-001, 9.496768e-001, 9.500707e-001, 9.504645e-001,
+9.508583e-001, 9.512521e-001, 9.516459e-001, 9.520398e-001, 9.524336e-001, 9.528253e-001, 9.532151e-001, 9.536048e-001, 9.539945e-001, 9.543843e-001,
+9.547740e-001, 9.551637e-001, 9.555535e-001, 9.559415e-001, 9.563273e-001, 9.567130e-001, 9.570988e-001, 9.574846e-001, 9.578703e-001, 9.582561e-001,
+9.586419e-001, 9.590266e-001, 9.594085e-001, 9.597904e-001, 9.601723e-001, 9.605542e-001, 9.609361e-001, 9.613180e-001, 9.616999e-001, 9.620817e-001,
+9.624596e-001, 9.628376e-001, 9.632156e-001, 9.635935e-001, 9.639715e-001, 9.643494e-001, 9.647274e-001, 9.651054e-001, 9.654802e-001, 9.658539e-001,
+9.662275e-001, 9.666012e-001, 9.669749e-001, 9.673486e-001, 9.677223e-001, 9.680960e-001, 9.684678e-001, 9.688365e-001, 9.692051e-001, 9.695737e-001,
+9.699424e-001, 9.703110e-001, 9.706796e-001, 9.710483e-001, 9.714169e-001, 9.717805e-001, 9.721437e-001, 9.725068e-001, 9.728700e-001, 9.732331e-001,
+9.735962e-001, 9.739594e-001, 9.743225e-001, 9.746835e-001, 9.750408e-001, 9.753981e-001, 9.757554e-001, 9.761127e-001, 9.764701e-001, 9.768274e-001,
+9.771847e-001, 9.775420e-001, 9.778943e-001, 9.782450e-001, 9.785958e-001, 9.789465e-001, 9.792973e-001, 9.796480e-001, 9.799987e-001, 9.803495e-001,
+9.806996e-001, 9.810422e-001, 9.813848e-001, 9.817274e-001, 9.820700e-001, 9.824126e-001, 9.827551e-001, 9.830977e-001, 9.834403e-001, 9.837800e-001,
+9.841131e-001, 9.844462e-001, 9.847793e-001, 9.851124e-001, 9.854455e-001, 9.857786e-001, 9.861117e-001, 9.864448e-001, 9.867735e-001, 9.870971e-001,
+9.874208e-001, 9.877445e-001, 9.880681e-001, 9.883918e-001, 9.887155e-001, 9.890391e-001, 9.893628e-001, 9.896805e-001, 9.899930e-001, 9.903056e-001,
+9.906181e-001, 9.909307e-001, 9.912433e-001, 9.915558e-001, 9.918684e-001, 9.921809e-001, 9.924862e-001, 9.927851e-001, 9.930839e-001, 9.933827e-001,
+9.936815e-001, 9.939803e-001, 9.942791e-001, 9.945780e-001, 9.948768e-001, 9.951674e-001, 9.954472e-001, 9.957271e-001, 9.960069e-001, 9.962868e-001,
+9.965666e-001, 9.968465e-001, 9.971263e-001, 9.974062e-001, 9.976803e-001, 9.979381e-001, 9.981958e-001, 9.984536e-001, 9.987113e-001, 9.989690e-001,
+9.992268e-001, 9.994845e-001, 9.997423e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.752829e-002, 4.634444e-002, 6.240091e-002, 7.677843e-002, 9.001876e-002, 1.023627e-001, 1.139827e-001, 1.249417e-001, 1.352714e-001,
+1.450501e-001, 1.543604e-001, 1.632550e-001, 1.717394e-001, 1.798606e-001, 1.876539e-001, 1.951582e-001, 2.024000e-001, 2.093926e-001, 2.161575e-001,
+2.226887e-001, 2.290195e-001, 2.351579e-001, 2.411173e-001, 2.469058e-001, 2.525431e-001, 2.580389e-001, 2.634047e-001, 2.686296e-001, 2.737228e-001,
+2.787045e-001, 2.835778e-001, 2.883430e-001, 2.930105e-001, 2.975909e-001, 3.020789e-001, 3.064748e-001, 3.107773e-001, 3.150070e-001, 3.191769e-001,
+3.232814e-001, 3.273218e-001, 3.312951e-001, 3.351996e-001, 3.390446e-001, 3.428248e-001, 3.465405e-001, 3.501958e-001, 3.538023e-001, 3.573650e-001,
+3.608898e-001, 3.643819e-001, 3.678375e-001, 3.712525e-001, 3.746287e-001, 3.779700e-001, 3.812798e-001, 3.845624e-001, 3.878164e-001, 3.910406e-001,
+3.942339e-001, 3.973953e-001, 4.005222e-001, 4.036156e-001, 4.066752e-001, 4.097004e-001, 4.126879e-001, 4.156408e-001, 4.185581e-001, 4.214420e-001,
+4.243034e-001, 4.271419e-001, 4.299592e-001, 4.327593e-001, 4.355489e-001, 4.383288e-001, 4.410988e-001, 4.438571e-001, 4.466049e-001, 4.493391e-001,
+4.520614e-001, 4.547703e-001, 4.574646e-001, 4.601453e-001, 4.628107e-001, 4.654598e-001, 4.680936e-001, 4.707117e-001, 4.733099e-001, 4.758863e-001,
+4.784411e-001, 4.809745e-001, 4.834777e-001, 4.859540e-001, 4.884033e-001, 4.908268e-001, 4.932255e-001, 4.955983e-001, 4.979467e-001, 5.002683e-001,
+5.025631e-001, 5.048316e-001, 5.070780e-001, 5.093029e-001, 5.115068e-001, 5.136872e-001, 5.158441e-001, 5.179804e-001, 5.200970e-001, 5.221934e-001,
+5.242718e-001, 5.263324e-001, 5.283774e-001, 5.304070e-001, 5.324196e-001, 5.344129e-001, 5.363882e-001, 5.383464e-001, 5.402891e-001, 5.422176e-001,
+5.441330e-001, 5.460358e-001, 5.479231e-001, 5.497955e-001, 5.516522e-001, 5.534964e-001, 5.553289e-001, 5.571492e-001, 5.589545e-001, 5.607442e-001,
+5.625196e-001, 5.642817e-001, 5.660303e-001, 5.677668e-001, 5.694890e-001, 5.711964e-001, 5.728896e-001, 5.745667e-001, 5.762310e-001, 5.778844e-001,
+5.795272e-001, 5.811590e-001, 5.827752e-001, 5.843808e-001, 5.859762e-001, 5.875608e-001, 5.891315e-001, 5.906872e-001, 5.922328e-001, 5.937691e-001,
+5.952951e-001, 5.968127e-001, 5.983219e-001, 5.998220e-001, 6.013069e-001, 6.027837e-001, 6.042529e-001, 6.057119e-001, 6.071583e-001, 6.085961e-001,
+6.100247e-001, 6.114413e-001, 6.128523e-001, 6.142579e-001, 6.156520e-001, 6.170391e-001, 6.184194e-001, 6.197852e-001, 6.211448e-001, 6.224984e-001,
+6.238390e-001, 6.251735e-001, 6.265006e-001, 6.278185e-001, 6.291318e-001, 6.304373e-001, 6.317333e-001, 6.330241e-001, 6.343023e-001, 6.355733e-001,
+6.368369e-001, 6.380882e-001, 6.393351e-001, 6.405732e-001, 6.418052e-001, 6.430324e-001, 6.442492e-001, 6.454624e-001, 6.466656e-001, 6.478631e-001,
+6.490543e-001, 6.502388e-001, 6.514208e-001, 6.525935e-001, 6.537633e-001, 6.549250e-001, 6.560811e-001, 6.572314e-001, 6.583733e-001, 6.595116e-001,
+6.606398e-001, 6.617662e-001, 6.628851e-001, 6.640012e-001, 6.651096e-001, 6.662128e-001, 6.673082e-001, 6.683982e-001, 6.694835e-001, 6.705622e-001,
+6.716373e-001, 6.727038e-001, 6.737674e-001, 6.748214e-001, 6.758733e-001, 6.769148e-001, 6.779550e-001, 6.789850e-001, 6.800143e-001, 6.810361e-001,
+6.820576e-001, 6.830697e-001, 6.840815e-001, 6.850818e-001, 6.860816e-001, 6.870732e-001, 6.880642e-001, 6.890474e-001, 6.900296e-001, 6.910040e-001,
+6.919766e-001, 6.929424e-001, 6.939055e-001, 6.948626e-001, 6.958161e-001, 6.967655e-001, 6.977107e-001, 6.986533e-001, 6.995912e-001, 7.005272e-001,
+7.014549e-001, 7.023826e-001, 7.033015e-001, 7.042204e-001, 7.051344e-001, 7.060474e-001, 7.069560e-001, 7.078615e-001, 7.087629e-001, 7.096566e-001,
+7.105496e-001, 7.114355e-001, 7.123214e-001, 7.132012e-001, 7.140796e-001, 7.149520e-001, 7.158185e-001, 7.166832e-001, 7.175390e-001, 7.183947e-001,
+7.192429e-001, 7.200896e-001, 7.209309e-001, 7.217660e-001, 7.226004e-001, 7.234250e-001, 7.242496e-001, 7.250695e-001, 7.258870e-001, 7.267029e-001,
+7.275135e-001, 7.283242e-001, 7.291294e-001, 7.299331e-001, 7.307348e-001, 7.315318e-001, 7.323289e-001, 7.331210e-001, 7.339118e-001, 7.347002e-001,
+7.354821e-001, 7.362640e-001, 7.370405e-001, 7.378150e-001, 7.385885e-001, 7.393574e-001, 7.401263e-001, 7.408907e-001, 7.416515e-001, 7.424122e-001,
+7.431642e-001, 7.439157e-001, 7.446653e-001, 7.454105e-001, 7.461557e-001, 7.468963e-001, 7.476344e-001, 7.483725e-001, 7.491027e-001, 7.498326e-001,
+7.505612e-001, 7.512857e-001, 7.520103e-001, 7.527318e-001, 7.534502e-001, 7.541685e-001, 7.548799e-001, 7.555886e-001, 7.562974e-001, 7.570007e-001,
+7.577037e-001, 7.584060e-001, 7.591039e-001, 7.598018e-001, 7.604973e-001, 7.611867e-001, 7.618761e-001, 7.625625e-001, 7.632448e-001, 7.639272e-001,
+7.646067e-001, 7.652836e-001, 7.659605e-001, 7.666331e-001, 7.673028e-001, 7.679726e-001, 7.686370e-001, 7.692988e-001, 7.699605e-001, 7.706185e-001,
+7.712748e-001, 7.719311e-001, 7.725834e-001, 7.732340e-001, 7.738846e-001, 7.745307e-001, 7.751747e-001, 7.758187e-001, 7.764588e-001, 7.770964e-001,
+7.777340e-001, 7.783686e-001, 7.790006e-001, 7.796326e-001, 7.802624e-001, 7.808894e-001, 7.815165e-001, 7.821415e-001, 7.827615e-001, 7.833816e-001,
+7.840010e-001, 7.846158e-001, 7.852305e-001, 7.858453e-001, 7.864570e-001, 7.870684e-001, 7.876799e-001, 7.882876e-001, 7.888938e-001, 7.895000e-001,
+7.901020e-001, 7.906989e-001, 7.912957e-001, 7.918916e-001, 7.924821e-001, 7.930727e-001, 7.936632e-001, 7.942508e-001, 7.948379e-001, 7.954250e-001,
+7.960084e-001, 7.965881e-001, 7.971678e-001, 7.977465e-001, 7.983182e-001, 7.988898e-001, 7.994615e-001, 8.000294e-001, 8.005959e-001, 8.011624e-001,
+8.017273e-001, 8.022882e-001, 8.028491e-001, 8.034101e-001, 8.039644e-001, 8.045171e-001, 8.050699e-001, 8.056213e-001, 8.061696e-001, 8.067178e-001,
+8.072661e-001, 8.078115e-001, 8.083561e-001, 8.089007e-001, 8.094440e-001, 8.099824e-001, 8.105208e-001, 8.110592e-001, 8.115935e-001, 8.121252e-001,
+8.126570e-001, 8.131888e-001, 8.137165e-001, 8.142442e-001, 8.147719e-001, 8.152979e-001, 8.158203e-001, 8.163427e-001, 8.168652e-001, 8.173835e-001,
+8.178995e-001, 8.184155e-001, 8.189315e-001, 8.194421e-001, 8.199521e-001, 8.204621e-001, 8.209713e-001, 8.214758e-001, 8.219804e-001, 8.224849e-001,
+8.229876e-001, 8.234868e-001, 8.239859e-001, 8.244851e-001, 8.249812e-001, 8.254746e-001, 8.259679e-001, 8.264612e-001, 8.269500e-001, 8.274361e-001,
+8.279223e-001, 8.284085e-001, 8.288907e-001, 8.293714e-001, 8.298521e-001, 8.303329e-001, 8.308109e-001, 8.312882e-001, 8.317656e-001, 8.322429e-001,
+8.327163e-001, 8.331889e-001, 8.336615e-001, 8.341341e-001, 8.346002e-001, 8.350649e-001, 8.355295e-001, 8.359941e-001, 8.364549e-001, 8.369144e-001,
+8.373740e-001, 8.378335e-001, 8.382915e-001, 8.387488e-001, 8.392061e-001, 8.396634e-001, 8.401177e-001, 8.405695e-001, 8.410213e-001, 8.414732e-001,
+8.419228e-001, 8.423690e-001, 8.428152e-001, 8.432614e-001, 8.437071e-001, 8.441503e-001, 8.445936e-001, 8.450369e-001, 8.454802e-001, 8.459206e-001,
+8.463609e-001, 8.468011e-001, 8.472414e-001, 8.476775e-001, 8.481117e-001, 8.485458e-001, 8.489800e-001, 8.494123e-001, 8.498413e-001, 8.502703e-001,
+8.506993e-001, 8.511283e-001, 8.515556e-001, 8.519830e-001, 8.524103e-001, 8.528376e-001, 8.532627e-001, 8.536864e-001, 8.541101e-001, 8.545338e-001,
+8.549564e-001, 8.553746e-001, 8.557928e-001, 8.562110e-001, 8.566292e-001, 8.570434e-001, 8.574561e-001, 8.578687e-001, 8.582813e-001, 8.586933e-001,
+8.591028e-001, 8.595123e-001, 8.599218e-001, 8.603313e-001, 8.607383e-001, 8.611438e-001, 8.615494e-001, 8.619550e-001, 8.623604e-001, 8.627613e-001,
+8.631622e-001, 8.635632e-001, 8.639641e-001, 8.643634e-001, 8.647604e-001, 8.651574e-001, 8.655544e-001, 8.659514e-001, 8.663460e-001, 8.667396e-001,
+8.671333e-001, 8.675270e-001, 8.679207e-001, 8.683103e-001, 8.686999e-001, 8.690895e-001, 8.694791e-001, 8.698676e-001, 8.702525e-001, 8.706374e-001,
+8.710222e-001, 8.714071e-001, 8.717903e-001, 8.721710e-001, 8.725518e-001, 8.729326e-001, 8.733134e-001, 8.736922e-001, 8.740696e-001, 8.744469e-001,
+8.748242e-001, 8.752016e-001, 8.755768e-001, 8.759509e-001, 8.763251e-001, 8.766993e-001, 8.770734e-001, 8.774453e-001, 8.778162e-001, 8.781872e-001,
+8.785582e-001, 8.789291e-001, 8.792971e-001, 8.796639e-001, 8.800308e-001, 8.803977e-001, 8.807645e-001, 8.811290e-001, 8.814923e-001, 8.818557e-001,
+8.822191e-001, 8.825825e-001, 8.829445e-001, 8.833058e-001, 8.836670e-001, 8.840282e-001, 8.843894e-001, 8.847499e-001, 8.851096e-001, 8.854692e-001,
+8.858289e-001, 8.861885e-001, 8.865470e-001, 8.869026e-001, 8.872583e-001, 8.876140e-001, 8.879697e-001, 8.883250e-001, 8.886773e-001, 8.890296e-001,
+8.893819e-001, 8.897342e-001, 8.900866e-001, 8.904372e-001, 8.907874e-001, 8.911376e-001, 8.914878e-001, 8.918380e-001, 8.921875e-001, 8.925362e-001,
+8.928849e-001, 8.932336e-001, 8.935823e-001, 8.939305e-001, 8.942753e-001, 8.946202e-001, 8.949650e-001, 8.953098e-001, 8.956546e-001, 8.959961e-001,
+8.963362e-001, 8.966763e-001, 8.970165e-001, 8.973566e-001, 8.976960e-001, 8.980333e-001, 8.983706e-001, 8.987079e-001, 8.990453e-001, 8.993826e-001,
+8.997189e-001, 9.000548e-001, 9.003908e-001, 9.007267e-001, 9.010627e-001, 9.013980e-001, 9.017303e-001, 9.020626e-001, 9.023949e-001, 9.027272e-001,
+9.030595e-001, 9.033885e-001, 9.037149e-001, 9.040413e-001, 9.043677e-001, 9.046941e-001, 9.050205e-001, 9.053438e-001, 9.056668e-001, 9.059898e-001,
+9.063128e-001, 9.066357e-001, 9.069585e-001, 9.072805e-001, 9.076024e-001, 9.079243e-001, 9.082462e-001, 9.085682e-001, 9.088888e-001, 9.092074e-001,
+9.095260e-001, 9.098447e-001, 9.101633e-001, 9.104820e-001, 9.107974e-001, 9.111106e-001, 9.114238e-001, 9.117369e-001, 9.120501e-001, 9.123633e-001,
+9.126743e-001, 9.129844e-001, 9.132945e-001, 9.136046e-001, 9.139147e-001, 9.142248e-001, 9.145343e-001, 9.148437e-001, 9.151530e-001, 9.154624e-001,
+9.157717e-001, 9.160810e-001, 9.163881e-001, 9.166945e-001, 9.170009e-001, 9.173073e-001, 9.176137e-001, 9.179201e-001, 9.182233e-001, 9.185255e-001,
+9.188277e-001, 9.191299e-001, 9.194321e-001, 9.197343e-001, 9.200347e-001, 9.203342e-001, 9.206338e-001, 9.209333e-001, 9.212328e-001, 9.215324e-001,
+9.218313e-001, 9.221297e-001, 9.224280e-001, 9.227264e-001, 9.230248e-001, 9.233232e-001, 9.236208e-001, 9.239168e-001, 9.242127e-001, 9.245087e-001,
+9.248046e-001, 9.251006e-001, 9.253964e-001, 9.256886e-001, 9.259809e-001, 9.262732e-001, 9.265655e-001, 9.268577e-001, 9.271500e-001, 9.274398e-001,
+9.277286e-001, 9.280173e-001, 9.283061e-001, 9.285949e-001, 9.288837e-001, 9.291719e-001, 9.294593e-001, 9.297466e-001, 9.300339e-001, 9.303212e-001,
+9.306085e-001, 9.308958e-001, 9.311815e-001, 9.314670e-001, 9.317525e-001, 9.320380e-001, 9.323235e-001, 9.326090e-001, 9.328929e-001, 9.331745e-001,
+9.334562e-001, 9.337378e-001, 9.340194e-001, 9.343011e-001, 9.345827e-001, 9.348607e-001, 9.351381e-001, 9.354155e-001, 9.356929e-001, 9.359703e-001,
+9.362477e-001, 9.365243e-001, 9.367982e-001, 9.370721e-001, 9.373460e-001, 9.376199e-001, 9.378938e-001, 9.381677e-001, 9.384400e-001, 9.387111e-001,
+9.389823e-001, 9.392534e-001, 9.395245e-001, 9.397956e-001, 9.400668e-001, 9.403353e-001, 9.406033e-001, 9.408713e-001, 9.411393e-001, 9.414073e-001,
+9.416753e-001, 9.419432e-001, 9.422078e-001, 9.424723e-001, 9.427369e-001, 9.430014e-001, 9.432659e-001, 9.435305e-001, 9.437945e-001, 9.440563e-001,
+9.443180e-001, 9.445798e-001, 9.448416e-001, 9.451033e-001, 9.453651e-001, 9.456260e-001, 9.458845e-001, 9.461430e-001, 9.464015e-001, 9.466600e-001,
+9.469185e-001, 9.471770e-001, 9.474347e-001, 9.476901e-001, 9.479455e-001, 9.482009e-001, 9.484563e-001, 9.487116e-001, 9.489670e-001, 9.492218e-001,
+9.494745e-001, 9.497272e-001, 9.499800e-001, 9.502327e-001, 9.504854e-001, 9.507381e-001, 9.509906e-001, 9.512413e-001, 9.514919e-001, 9.517426e-001,
+9.519933e-001, 9.522440e-001, 9.524947e-001, 9.527454e-001, 9.529927e-001, 9.532396e-001, 9.534866e-001, 9.537336e-001, 9.539806e-001, 9.542276e-001,
+9.544746e-001, 9.547195e-001, 9.549634e-001, 9.552074e-001, 9.554513e-001, 9.556953e-001, 9.559392e-001, 9.561832e-001, 9.564264e-001, 9.566686e-001,
+9.569107e-001, 9.571528e-001, 9.573949e-001, 9.576370e-001, 9.578792e-001, 9.581213e-001, 9.583622e-001, 9.586032e-001, 9.588441e-001, 9.590850e-001,
+9.593259e-001, 9.595669e-001, 9.598078e-001, 9.600472e-001, 9.602853e-001, 9.605233e-001, 9.607614e-001, 9.609995e-001, 9.612376e-001, 9.614757e-001,
+9.617136e-001, 9.619484e-001, 9.621831e-001, 9.624179e-001, 9.626526e-001, 9.628874e-001, 9.631221e-001, 9.633569e-001, 9.635908e-001, 9.638239e-001,
+9.640570e-001, 9.642900e-001, 9.645231e-001, 9.647561e-001, 9.649892e-001, 9.652222e-001, 9.654536e-001, 9.656845e-001, 9.659153e-001, 9.661462e-001,
+9.663771e-001, 9.666080e-001, 9.668389e-001, 9.670694e-001, 9.672951e-001, 9.675208e-001, 9.677465e-001, 9.679722e-001, 9.681979e-001, 9.684236e-001,
+9.686493e-001, 9.688738e-001, 9.690953e-001, 9.693169e-001, 9.695385e-001, 9.697600e-001, 9.699816e-001, 9.702031e-001, 9.704247e-001, 9.706450e-001,
+9.708637e-001, 9.710823e-001, 9.713010e-001, 9.715197e-001, 9.717383e-001, 9.719570e-001, 9.721757e-001, 9.723933e-001, 9.726098e-001, 9.728264e-001,
+9.730429e-001, 9.732595e-001, 9.734760e-001, 9.736926e-001, 9.739091e-001, 9.741246e-001, 9.743391e-001, 9.745535e-001, 9.747680e-001, 9.749824e-001,
+9.751968e-001, 9.754113e-001, 9.756257e-001, 9.758389e-001, 9.760503e-001, 9.762618e-001, 9.764732e-001, 9.766846e-001, 9.768960e-001, 9.771075e-001,
+9.773189e-001, 9.775293e-001, 9.777370e-001, 9.779448e-001, 9.781525e-001, 9.783602e-001, 9.785679e-001, 9.787757e-001, 9.789834e-001, 9.791910e-001,
+9.793955e-001, 9.796001e-001, 9.798047e-001, 9.800092e-001, 9.802138e-001, 9.804184e-001, 9.806229e-001, 9.808275e-001, 9.810302e-001, 9.812323e-001,
+9.814344e-001, 9.816365e-001, 9.818386e-001, 9.820407e-001, 9.822428e-001, 9.824449e-001, 9.826459e-001, 9.828448e-001, 9.830437e-001, 9.832427e-001,
+9.834416e-001, 9.836406e-001, 9.838395e-001, 9.840384e-001, 9.842374e-001, 9.844333e-001, 9.846289e-001, 9.848245e-001, 9.850201e-001, 9.852156e-001,
+9.854112e-001, 9.856068e-001, 9.858024e-001, 9.859969e-001, 9.861896e-001, 9.863823e-001, 9.865750e-001, 9.867678e-001, 9.869605e-001, 9.871532e-001,
+9.873459e-001, 9.875386e-001, 9.877287e-001, 9.879180e-001, 9.881073e-001, 9.882966e-001, 9.884860e-001, 9.886753e-001, 9.888646e-001, 9.890539e-001,
+9.892429e-001, 9.894282e-001, 9.896134e-001, 9.897987e-001, 9.899839e-001, 9.901692e-001, 9.903544e-001, 9.905397e-001, 9.907249e-001, 9.909089e-001,
+9.910903e-001, 9.912716e-001, 9.914530e-001, 9.916343e-001, 9.918156e-001, 9.919970e-001, 9.921783e-001, 9.923597e-001, 9.925395e-001, 9.927175e-001,
+9.928955e-001, 9.930735e-001, 9.932515e-001, 9.934295e-001, 9.936075e-001, 9.937855e-001, 9.939635e-001, 9.941389e-001, 9.943121e-001, 9.944853e-001,
+9.946585e-001, 9.948317e-001, 9.950048e-001, 9.951780e-001, 9.953512e-001, 9.955244e-001, 9.956938e-001, 9.958598e-001, 9.960258e-001, 9.961918e-001,
+9.963578e-001, 9.965238e-001, 9.966899e-001, 9.968559e-001, 9.970219e-001, 9.971848e-001, 9.973436e-001, 9.975024e-001, 9.976612e-001, 9.978200e-001,
+9.979788e-001, 9.981376e-001, 9.982964e-001, 9.984552e-001, 9.986127e-001, 9.987669e-001, 9.989210e-001, 9.990752e-001, 9.992293e-001, 9.993834e-001,
+9.995376e-001, 9.996917e-001, 9.998459e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.937128e-002, 3.341311e-002, 4.599935e-002, 5.748801e-002, 6.809244e-002, 7.799870e-002, 8.732597e-002, 9.625126e-002, 1.049458e-001,
+1.134937e-001, 1.219278e-001, 1.302695e-001, 1.385126e-001, 1.466525e-001, 1.546880e-001, 1.626233e-001, 1.704642e-001, 1.781909e-001, 1.858116e-001,
+1.933328e-001, 2.007412e-001, 2.080102e-001, 2.151511e-001, 2.221754e-001, 2.290547e-001, 2.357912e-001, 2.423840e-001, 2.488332e-001, 2.551516e-001,
+2.613374e-001, 2.673675e-001, 2.732524e-001, 2.790116e-001, 2.846450e-001, 2.901516e-001, 2.955359e-001, 3.008054e-001, 3.059558e-001, 3.109906e-001,
+3.159134e-001, 3.207265e-001, 3.254382e-001, 3.300523e-001, 3.345699e-001, 3.389828e-001, 3.433067e-001, 3.475451e-001, 3.517045e-001, 3.557837e-001,
+3.597821e-001, 3.637022e-001, 3.675519e-001, 3.713383e-001, 3.750616e-001, 3.787160e-001, 3.823012e-001, 3.858229e-001, 3.892803e-001, 3.926732e-001,
+3.960165e-001, 3.993082e-001, 4.025487e-001, 4.057468e-001, 4.088996e-001, 4.120031e-001, 4.150582e-001, 4.180706e-001, 4.210395e-001, 4.239598e-001,
+4.268441e-001, 4.296903e-001, 4.325061e-001, 4.352907e-001, 4.380439e-001, 4.407683e-001, 4.434654e-001, 4.461325e-001, 4.487736e-001, 4.513855e-001,
+4.539699e-001, 4.565226e-001, 4.590450e-001, 4.615412e-001, 4.640046e-001, 4.664372e-001, 4.688445e-001, 4.712260e-001, 4.735804e-001, 4.759103e-001,
+4.782153e-001, 4.804974e-001, 4.827564e-001, 4.849967e-001, 4.872167e-001, 4.894093e-001, 4.915755e-001, 4.937164e-001, 4.958331e-001, 4.979225e-001,
+4.999859e-001, 5.020250e-001, 5.040426e-001, 5.060408e-001, 5.080218e-001, 5.099847e-001, 5.119276e-001, 5.138526e-001, 5.157613e-001, 5.176572e-001,
+5.195353e-001, 5.213940e-001, 5.232351e-001, 5.250612e-001, 5.268712e-001, 5.286646e-001, 5.304409e-001, 5.322009e-001, 5.339470e-001, 5.356794e-001,
+5.373972e-001, 5.391006e-001, 5.407894e-001, 5.424654e-001, 5.441266e-001, 5.457724e-001, 5.474044e-001, 5.490233e-001, 5.506296e-001, 5.522220e-001,
+5.537992e-001, 5.553634e-001, 5.569143e-001, 5.584531e-001, 5.599805e-001, 5.614979e-001, 5.630067e-001, 5.645062e-001, 5.659910e-001, 5.674639e-001,
+5.689263e-001, 5.703797e-001, 5.718244e-001, 5.732577e-001, 5.746795e-001, 5.760903e-001, 5.774901e-001, 5.788799e-001, 5.802617e-001, 5.816357e-001,
+5.830007e-001, 5.843585e-001, 5.857096e-001, 5.870533e-001, 5.883836e-001, 5.897060e-001, 5.910214e-001, 5.923282e-001, 5.936253e-001, 5.949164e-001,
+5.962015e-001, 5.974759e-001, 5.987440e-001, 6.000061e-001, 6.012579e-001, 6.025044e-001, 6.037460e-001, 6.049779e-001, 6.062040e-001, 6.074249e-001,
+6.086358e-001, 6.098436e-001, 6.110476e-001, 6.122431e-001, 6.134337e-001, 6.146163e-001, 6.157922e-001, 6.169644e-001, 6.181288e-001, 6.192878e-001,
+6.204417e-001, 6.215860e-001, 6.227265e-001, 6.238588e-001, 6.249853e-001, 6.261077e-001, 6.272221e-001, 6.283331e-001, 6.294346e-001, 6.305303e-001,
+6.316205e-001, 6.327044e-001, 6.337861e-001, 6.348582e-001, 6.359266e-001, 6.369863e-001, 6.380412e-001, 6.390918e-001, 6.401356e-001, 6.411771e-001,
+6.422093e-001, 6.432398e-001, 6.442615e-001, 6.452805e-001, 6.462923e-001, 6.473004e-001, 6.483036e-001, 6.493026e-001, 6.502984e-001, 6.512871e-001,
+6.522723e-001, 6.532505e-001, 6.542266e-001, 6.551975e-001, 6.561676e-001, 6.571306e-001, 6.580930e-001, 6.590463e-001, 6.599992e-001, 6.609458e-001,
+6.618923e-001, 6.628310e-001, 6.637696e-001, 6.646987e-001, 6.656275e-001, 6.665500e-001, 6.674722e-001, 6.683869e-001, 6.693009e-001, 6.702065e-001,
+6.711106e-001, 6.720093e-001, 6.729063e-001, 6.737989e-001, 6.746892e-001, 6.755757e-001, 6.764587e-001, 6.773390e-001, 6.782149e-001, 6.790892e-001,
+6.799583e-001, 6.808271e-001, 6.816880e-001, 6.825489e-001, 6.834050e-001, 6.842602e-001, 6.851115e-001, 6.859602e-001, 6.868060e-001, 6.876470e-001,
+6.884873e-001, 6.893229e-001, 6.901584e-001, 6.909889e-001, 6.918183e-001, 6.926438e-001, 6.934657e-001, 6.942861e-001, 6.951002e-001, 6.959143e-001,
+6.967222e-001, 6.975290e-001, 6.983324e-001, 6.991323e-001, 6.999315e-001, 7.007243e-001, 7.015170e-001, 7.023051e-001, 7.030911e-001, 7.038756e-001,
+7.046553e-001, 7.054349e-001, 7.062094e-001, 7.069825e-001, 7.077537e-001, 7.085208e-001, 7.092878e-001, 7.100501e-001, 7.108113e-001, 7.115700e-001,
+7.123228e-001, 7.130756e-001, 7.138232e-001, 7.145690e-001, 7.153140e-001, 7.160547e-001, 7.167954e-001, 7.175316e-001, 7.182647e-001, 7.189978e-001,
+7.197248e-001, 7.204516e-001, 7.211769e-001, 7.218993e-001, 7.226216e-001, 7.233394e-001, 7.240548e-001, 7.247703e-001, 7.254780e-001, 7.261854e-001,
+7.268916e-001, 7.275939e-001, 7.282963e-001, 7.289955e-001, 7.296919e-001, 7.303882e-001, 7.310792e-001, 7.317686e-001, 7.324579e-001, 7.331432e-001,
+7.338283e-001, 7.345126e-001, 7.351926e-001, 7.358726e-001, 7.365499e-001, 7.372215e-001, 7.378931e-001, 7.385626e-001, 7.392295e-001, 7.398964e-001,
+7.405610e-001, 7.412237e-001, 7.418865e-001, 7.425446e-001, 7.432000e-001, 7.438554e-001, 7.445067e-001, 7.451562e-001, 7.458057e-001, 7.464520e-001,
+7.470970e-001, 7.477421e-001, 7.483827e-001, 7.490216e-001, 7.496606e-001, 7.502962e-001, 7.509305e-001, 7.515647e-001, 7.521968e-001, 7.528278e-001,
+7.534587e-001, 7.540869e-001, 7.547129e-001, 7.553389e-001, 7.559623e-001, 7.565827e-001, 7.572030e-001, 7.578223e-001, 7.584392e-001, 7.590561e-001,
+7.596723e-001, 7.602842e-001, 7.608961e-001, 7.615080e-001, 7.621136e-001, 7.627189e-001, 7.633241e-001, 7.639262e-001, 7.645270e-001, 7.651278e-001,
+7.657262e-001, 7.663219e-001, 7.669176e-001, 7.675123e-001, 7.681027e-001, 7.686931e-001, 7.692835e-001, 7.698694e-001, 7.704546e-001, 7.710398e-001,
+7.716225e-001, 7.722027e-001, 7.727829e-001, 7.733624e-001, 7.739374e-001, 7.745124e-001, 7.750874e-001, 7.756579e-001, 7.762269e-001, 7.767959e-001,
+7.773638e-001, 7.779290e-001, 7.784943e-001, 7.790595e-001, 7.796214e-001, 7.801826e-001, 7.807438e-001, 7.813033e-001, 7.818598e-001, 7.824163e-001,
+7.829727e-001, 7.835255e-001, 7.840774e-001, 7.846293e-001, 7.851803e-001, 7.857282e-001, 7.862762e-001, 7.868241e-001, 7.873699e-001, 7.879144e-001,
+7.884590e-001, 7.890035e-001, 7.895429e-001, 7.900824e-001, 7.906218e-001, 7.911595e-001, 7.916940e-001, 7.922285e-001, 7.927630e-001, 7.932949e-001,
+7.938255e-001, 7.943560e-001, 7.948866e-001, 7.954136e-001, 7.959403e-001, 7.964671e-001, 7.969929e-001, 7.975142e-001, 7.980354e-001, 7.985566e-001,
+7.990765e-001, 7.995940e-001, 8.001115e-001, 8.006290e-001, 8.011452e-001, 8.016603e-001, 8.021754e-001, 8.026905e-001, 8.032017e-001, 8.037109e-001,
+8.042201e-001, 8.047293e-001, 8.052351e-001, 8.057398e-001, 8.062444e-001, 8.067491e-001, 8.072515e-001, 8.077533e-001, 8.082551e-001, 8.087569e-001,
+8.092550e-001, 8.097523e-001, 8.102497e-001, 8.107470e-001, 8.112403e-001, 8.117327e-001, 8.122250e-001, 8.127174e-001, 8.132079e-001, 8.136978e-001,
+8.141876e-001, 8.146775e-001, 8.151653e-001, 8.156523e-001, 8.161392e-001, 8.166261e-001, 8.171094e-001, 8.175901e-001, 8.180707e-001, 8.185513e-001,
+8.190304e-001, 8.195071e-001, 8.199839e-001, 8.204607e-001, 8.209371e-001, 8.214123e-001, 8.218876e-001, 8.223628e-001, 8.228381e-001, 8.233087e-001,
+8.237791e-001, 8.242496e-001, 8.247200e-001, 8.251868e-001, 8.256520e-001, 8.261172e-001, 8.265824e-001, 8.270465e-001, 8.275087e-001, 8.279710e-001,
+8.284332e-001, 8.288953e-001, 8.293543e-001, 8.298132e-001, 8.302721e-001, 8.307310e-001, 8.311864e-001, 8.316399e-001, 8.320934e-001, 8.325469e-001,
+8.329999e-001, 8.334509e-001, 8.339020e-001, 8.343530e-001, 8.348040e-001, 8.352537e-001, 8.357029e-001, 8.361521e-001, 8.366013e-001, 8.370495e-001,
+8.374937e-001, 8.379380e-001, 8.383822e-001, 8.388265e-001, 8.392679e-001, 8.397078e-001, 8.401477e-001, 8.405877e-001, 8.410275e-001, 8.414660e-001,
+8.419045e-001, 8.423431e-001, 8.427816e-001, 8.432186e-001, 8.436537e-001, 8.440888e-001, 8.445239e-001, 8.449590e-001, 8.453900e-001, 8.458197e-001,
+8.462493e-001, 8.466790e-001, 8.471086e-001, 8.475356e-001, 8.479627e-001, 8.483897e-001, 8.488167e-001, 8.492433e-001, 8.496683e-001, 8.500934e-001,
+8.505184e-001, 8.509434e-001, 8.513663e-001, 8.517864e-001, 8.522065e-001, 8.526266e-001, 8.530467e-001, 8.534634e-001, 8.538776e-001, 8.542918e-001,
+8.547060e-001, 8.551203e-001, 8.555328e-001, 8.559446e-001, 8.563564e-001, 8.567681e-001, 8.571799e-001, 8.575892e-001, 8.579976e-001, 8.584060e-001,
+8.588144e-001, 8.592228e-001, 8.596280e-001, 8.600321e-001, 8.604362e-001, 8.608403e-001, 8.612445e-001, 8.616468e-001, 8.620484e-001, 8.624501e-001,
+8.628517e-001, 8.632534e-001, 8.636533e-001, 8.640522e-001, 8.644511e-001, 8.648500e-001, 8.652489e-001, 8.656460e-001, 8.660413e-001, 8.664366e-001,
+8.668319e-001, 8.672272e-001, 8.676213e-001, 8.680127e-001, 8.684041e-001, 8.687955e-001, 8.691869e-001, 8.695781e-001, 8.699674e-001, 8.703567e-001,
+8.707460e-001, 8.711354e-001, 8.715247e-001, 8.719115e-001, 8.722979e-001, 8.726843e-001, 8.730706e-001, 8.734570e-001, 8.738413e-001, 8.742239e-001,
+8.746064e-001, 8.749889e-001, 8.753714e-001, 8.757534e-001, 8.761324e-001, 8.765114e-001, 8.768904e-001, 8.772694e-001, 8.776484e-001, 8.780251e-001,
+8.784010e-001, 8.787769e-001, 8.791527e-001, 8.795286e-001, 8.799036e-001, 8.802764e-001, 8.806491e-001, 8.810219e-001, 8.813947e-001, 8.817674e-001,
+8.821376e-001, 8.825070e-001, 8.828764e-001, 8.832458e-001, 8.836152e-001, 8.839840e-001, 8.843503e-001, 8.847166e-001, 8.850830e-001, 8.854493e-001,
+8.858157e-001, 8.861801e-001, 8.865432e-001, 8.869063e-001, 8.872694e-001, 8.876324e-001, 8.879955e-001, 8.883557e-001, 8.887156e-001, 8.890755e-001,
+8.894353e-001, 8.897952e-001, 8.901546e-001, 8.905116e-001, 8.908686e-001, 8.912256e-001, 8.915826e-001, 8.919396e-001, 8.922955e-001, 8.926500e-001,
+8.930045e-001, 8.933590e-001, 8.937134e-001, 8.940679e-001, 8.944209e-001, 8.947728e-001, 8.951248e-001, 8.954768e-001, 8.958287e-001, 8.961807e-001,
+8.965307e-001, 8.968799e-001, 8.972290e-001, 8.975782e-001, 8.979274e-001, 8.982766e-001, 8.986228e-001, 8.989683e-001, 8.993137e-001, 8.996591e-001,
+9.000046e-001, 9.003500e-001, 9.006927e-001, 9.010347e-001, 9.013767e-001, 9.017187e-001, 9.020607e-001, 9.024027e-001, 9.027428e-001, 9.030823e-001,
+9.034218e-001, 9.037613e-001, 9.041008e-001, 9.044403e-001, 9.047783e-001, 9.051156e-001, 9.054529e-001, 9.057902e-001, 9.061275e-001, 9.064648e-001,
+9.068005e-001, 9.071346e-001, 9.074687e-001, 9.078028e-001, 9.081369e-001, 9.084710e-001, 9.088043e-001, 9.091359e-001, 9.094674e-001, 9.097989e-001,
+9.101304e-001, 9.104620e-001, 9.107934e-001, 9.111229e-001, 9.114524e-001, 9.117819e-001, 9.121115e-001, 9.124410e-001, 9.127705e-001, 9.130979e-001,
+9.134244e-001, 9.137510e-001, 9.140775e-001, 9.144041e-001, 9.147307e-001, 9.150563e-001, 9.153802e-001, 9.157041e-001, 9.160281e-001, 9.163520e-001,
+9.166759e-001, 9.169998e-001, 9.173221e-001, 9.176442e-001, 9.179663e-001, 9.182885e-001, 9.186106e-001, 9.189327e-001, 9.192542e-001, 9.195749e-001,
+9.198955e-001, 9.202161e-001, 9.205368e-001, 9.208574e-001, 9.211781e-001, 9.214955e-001, 9.218125e-001, 9.221295e-001, 9.224464e-001, 9.227634e-001,
+9.230804e-001, 9.233967e-001, 9.237111e-001, 9.240255e-001, 9.243399e-001, 9.246544e-001, 9.249688e-001, 9.252832e-001, 9.255969e-001, 9.259101e-001,
+9.262233e-001, 9.265365e-001, 9.268497e-001, 9.271629e-001, 9.274761e-001, 9.277875e-001, 9.280986e-001, 9.284097e-001, 9.287207e-001, 9.290318e-001,
+9.293429e-001, 9.296538e-001, 9.299619e-001, 9.302699e-001, 9.305779e-001, 9.308859e-001, 9.311940e-001, 9.315020e-001, 9.318097e-001, 9.321160e-001,
+9.324223e-001, 9.327287e-001, 9.330350e-001, 9.333413e-001, 9.336476e-001, 9.339538e-001, 9.342594e-001, 9.345651e-001, 9.348708e-001, 9.351764e-001,
+9.354821e-001, 9.357877e-001, 9.360926e-001, 9.363956e-001, 9.366985e-001, 9.370014e-001, 9.373043e-001, 9.376072e-001, 9.379102e-001, 9.382125e-001,
+9.385130e-001, 9.388134e-001, 9.391139e-001, 9.394144e-001, 9.397148e-001, 9.400153e-001, 9.403156e-001, 9.406144e-001, 9.409132e-001, 9.412120e-001,
+9.415108e-001, 9.418096e-001, 9.421084e-001, 9.424072e-001, 9.427047e-001, 9.430022e-001, 9.432996e-001, 9.435970e-001, 9.438944e-001, 9.441918e-001,
+9.444893e-001, 9.447843e-001, 9.450784e-001, 9.453724e-001, 9.456664e-001, 9.459604e-001, 9.462545e-001, 9.465485e-001, 9.468416e-001, 9.471332e-001,
+9.474249e-001, 9.477165e-001, 9.480082e-001, 9.482998e-001, 9.485915e-001, 9.488831e-001, 9.491736e-001, 9.494642e-001, 9.497547e-001, 9.500452e-001,
+9.503357e-001, 9.506263e-001, 9.509168e-001, 9.512062e-001, 9.514948e-001, 9.517833e-001, 9.520719e-001, 9.523604e-001, 9.526490e-001, 9.529375e-001,
+9.532259e-001, 9.535105e-001, 9.537951e-001, 9.540797e-001, 9.543643e-001, 9.546489e-001, 9.549336e-001, 9.552182e-001, 9.555018e-001, 9.557842e-001,
+9.560666e-001, 9.563490e-001, 9.566314e-001, 9.569138e-001, 9.571962e-001, 9.574786e-001, 9.577592e-001, 9.580393e-001, 9.583194e-001, 9.585996e-001,
+9.588797e-001, 9.591598e-001, 9.594400e-001, 9.597196e-001, 9.599939e-001, 9.602683e-001, 9.605426e-001, 9.608170e-001, 9.610914e-001, 9.613657e-001,
+9.616401e-001, 9.619130e-001, 9.621827e-001, 9.624525e-001, 9.627222e-001, 9.629919e-001, 9.632616e-001, 9.635313e-001, 9.638010e-001, 9.640696e-001,
+9.643366e-001, 9.646036e-001, 9.648707e-001, 9.651377e-001, 9.654048e-001, 9.656718e-001, 9.659388e-001, 9.662050e-001, 9.664703e-001, 9.667355e-001,
+9.670008e-001, 9.672661e-001, 9.675314e-001, 9.677966e-001, 9.680619e-001, 9.683257e-001, 9.685881e-001, 9.688505e-001, 9.691129e-001, 9.693753e-001,
+9.696377e-001, 9.699001e-001, 9.701625e-001, 9.704235e-001, 9.706826e-001, 9.709417e-001, 9.712008e-001, 9.714600e-001, 9.717191e-001, 9.719782e-001,
+9.722373e-001, 9.724957e-001, 9.727520e-001, 9.730083e-001, 9.732646e-001, 9.735209e-001, 9.737772e-001, 9.740335e-001, 9.742898e-001, 9.745460e-001,
+9.747993e-001, 9.750527e-001, 9.753060e-001, 9.755593e-001, 9.758126e-001, 9.760660e-001, 9.763193e-001, 9.765726e-001, 9.768231e-001, 9.770727e-001,
+9.773222e-001, 9.775718e-001, 9.778214e-001, 9.780709e-001, 9.783205e-001, 9.785700e-001, 9.788183e-001, 9.790642e-001, 9.793102e-001, 9.795561e-001,
+9.798021e-001, 9.800480e-001, 9.802940e-001, 9.805399e-001, 9.807859e-001, 9.810284e-001, 9.812706e-001, 9.815129e-001, 9.817551e-001, 9.819974e-001,
+9.822396e-001, 9.824818e-001, 9.827241e-001, 9.829645e-001, 9.832021e-001, 9.834397e-001, 9.836772e-001, 9.839148e-001, 9.841524e-001, 9.843899e-001,
+9.846275e-001, 9.848651e-001, 9.850989e-001, 9.853316e-001, 9.855643e-001, 9.857969e-001, 9.860296e-001, 9.862623e-001, 9.864950e-001, 9.867277e-001,
+9.869600e-001, 9.871880e-001, 9.874159e-001, 9.876438e-001, 9.878718e-001, 9.880997e-001, 9.883277e-001, 9.885556e-001, 9.887836e-001, 9.890096e-001,
+9.892314e-001, 9.894532e-001, 9.896751e-001, 9.898969e-001, 9.901187e-001, 9.903405e-001, 9.905623e-001, 9.907841e-001, 9.910030e-001, 9.912184e-001,
+9.914339e-001, 9.916493e-001, 9.918648e-001, 9.920802e-001, 9.922957e-001, 9.925111e-001, 9.927266e-001, 9.929388e-001, 9.931482e-001, 9.933576e-001,
+9.935670e-001, 9.937765e-001, 9.939859e-001, 9.941953e-001, 9.944047e-001, 9.946141e-001, 9.948195e-001, 9.950211e-001, 9.952228e-001, 9.954244e-001,
+9.956261e-001, 9.958278e-001, 9.960294e-001, 9.962311e-001, 9.964327e-001, 9.966300e-001, 9.968215e-001, 9.970130e-001, 9.972046e-001, 9.973961e-001,
+9.975876e-001, 9.977791e-001, 9.979707e-001, 9.981622e-001, 9.983515e-001, 9.985347e-001, 9.987179e-001, 9.989010e-001, 9.990842e-001, 9.992674e-001,
+9.994505e-001, 9.996337e-001, 9.998168e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Vista 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.024854e-003, 1.721502e-002, 2.437478e-002, 3.088764e-002, 3.691803e-002, 4.254583e-002, 4.785292e-002, 5.289109e-002, 5.768659e-002,
+6.235132e-002, 6.697686e-002, 7.155676e-002, 7.608560e-002, 8.057413e-002, 8.503075e-002, 8.945478e-002, 9.382973e-002, 9.815396e-002, 1.024200e-001,
+1.066195e-001, 1.107435e-001, 1.148013e-001, 1.187836e-001, 1.227073e-001, 1.265697e-001, 1.303701e-001, 1.340971e-001, 1.377590e-001, 1.413496e-001,
+1.448680e-001, 1.483225e-001, 1.516994e-001, 1.550140e-001, 1.582762e-001, 1.614780e-001, 1.646182e-001, 1.676994e-001, 1.707276e-001, 1.737034e-001,
+1.766317e-001, 1.795026e-001, 1.823239e-001, 1.850988e-001, 1.878297e-001, 1.905122e-001, 1.931523e-001, 1.957569e-001, 1.983253e-001, 2.008654e-001,
+2.033737e-001, 2.058540e-001, 2.083115e-001, 2.107529e-001, 2.131795e-001, 2.155989e-001, 2.180117e-001, 2.204127e-001, 2.228053e-001, 2.251947e-001,
+2.275790e-001, 2.299547e-001, 2.323269e-001, 2.346891e-001, 2.370417e-001, 2.393850e-001, 2.417194e-001, 2.440441e-001, 2.463590e-001, 2.486687e-001,
+2.509658e-001, 2.532486e-001, 2.555231e-001, 2.577825e-001, 2.600267e-001, 2.622608e-001, 2.644845e-001, 2.667022e-001, 2.689101e-001, 2.711063e-001,
+2.732927e-001, 2.754708e-001, 2.776343e-001, 2.797912e-001, 2.819392e-001, 2.840761e-001, 2.862044e-001, 2.883251e-001, 2.904368e-001, 2.925383e-001,
+2.946313e-001, 2.967144e-001, 2.987858e-001, 3.008505e-001, 3.029072e-001, 3.049512e-001, 3.069873e-001, 3.090177e-001, 3.110390e-001, 3.130499e-001,
+3.150540e-001, 3.170512e-001, 3.190402e-001, 3.210212e-001, 3.229937e-001, 3.249579e-001, 3.269130e-001, 3.288631e-001, 3.308089e-001, 3.327477e-001,
+3.346763e-001, 3.365968e-001, 3.385130e-001, 3.404223e-001, 3.423224e-001, 3.442116e-001, 3.460934e-001, 3.479698e-001, 3.498383e-001, 3.516974e-001,
+3.535484e-001, 3.553938e-001, 3.572332e-001, 3.590650e-001, 3.608898e-001, 3.627075e-001, 3.645171e-001, 3.663190e-001, 3.681136e-001, 3.699010e-001,
+3.716816e-001, 3.734537e-001, 3.752183e-001, 3.769756e-001, 3.787258e-001, 3.804695e-001, 3.822060e-001, 3.839340e-001, 3.856526e-001, 3.873623e-001,
+3.890653e-001, 3.907627e-001, 3.924534e-001, 3.941374e-001, 3.958151e-001, 3.974870e-001, 3.991512e-001, 4.008058e-001, 4.024530e-001, 4.040931e-001,
+4.057265e-001, 4.073539e-001, 4.089718e-001, 4.105816e-001, 4.121826e-001, 4.137747e-001, 4.153573e-001, 4.169302e-001, 4.184952e-001, 4.200516e-001,
+4.215987e-001, 4.231321e-001, 4.246564e-001, 4.261723e-001, 4.276799e-001, 4.291754e-001, 4.306622e-001, 4.321403e-001, 4.336063e-001, 4.350614e-001,
+4.365089e-001, 4.379491e-001, 4.393771e-001, 4.407972e-001, 4.422096e-001, 4.436098e-001, 4.449998e-001, 4.463822e-001, 4.477544e-001, 4.491180e-001,
+4.504755e-001, 4.518244e-001, 4.531636e-001, 4.544965e-001, 4.558199e-001, 4.571351e-001, 4.584454e-001, 4.597485e-001, 4.610453e-001, 4.623378e-001,
+4.636217e-001, 4.649001e-001, 4.661736e-001, 4.674374e-001, 4.686970e-001, 4.699492e-001, 4.711952e-001, 4.724381e-001, 4.736748e-001, 4.749085e-001,
+4.761387e-001, 4.773631e-001, 4.785852e-001, 4.798015e-001, 4.810144e-001, 4.822235e-001, 4.834271e-001, 4.846288e-001, 4.858255e-001, 4.870207e-001,
+4.882128e-001, 4.894017e-001, 4.905885e-001, 4.917715e-001, 4.929533e-001, 4.941304e-001, 4.953060e-001, 4.964785e-001, 4.976484e-001, 4.988157e-001,
+4.999799e-001, 5.011427e-001, 5.023011e-001, 5.034586e-001, 5.046118e-001, 5.057642e-001, 5.069123e-001, 5.080591e-001, 5.092028e-001, 5.103444e-001,
+5.114830e-001, 5.126194e-001, 5.137537e-001, 5.148849e-001, 5.160142e-001, 5.171405e-001, 5.182654e-001, 5.193868e-001, 5.205067e-001, 5.216234e-001,
+5.227390e-001, 5.238509e-001, 5.249616e-001, 5.260690e-001, 5.271754e-001, 5.282781e-001, 5.293796e-001, 5.304781e-001, 5.315754e-001, 5.326694e-001,
+5.337619e-001, 5.348517e-001, 5.359400e-001, 5.370257e-001, 5.381091e-001, 5.391908e-001, 5.402700e-001, 5.413478e-001, 5.424223e-001, 5.434961e-001,
+5.445664e-001, 5.456367e-001, 5.467023e-001, 5.477678e-001, 5.488300e-001, 5.498915e-001, 5.509499e-001, 5.520067e-001, 5.530617e-001, 5.541145e-001,
+5.551662e-001, 5.562143e-001, 5.572623e-001, 5.583065e-001, 5.593506e-001, 5.603913e-001, 5.614307e-001, 5.624685e-001, 5.635039e-001, 5.645387e-001,
+5.655696e-001, 5.666004e-001, 5.676281e-001, 5.686550e-001, 5.696797e-001, 5.707020e-001, 5.717240e-001, 5.727424e-001, 5.737608e-001, 5.747759e-001,
+5.757898e-001, 5.768024e-001, 5.778124e-001, 5.788224e-001, 5.798283e-001, 5.808338e-001, 5.818375e-001, 5.828392e-001, 5.838407e-001, 5.848380e-001,
+5.858352e-001, 5.868304e-001, 5.878237e-001, 5.888170e-001, 5.898060e-001, 5.907950e-001, 5.917820e-001, 5.927672e-001, 5.937524e-001, 5.947333e-001,
+5.957141e-001, 5.966934e-001, 5.976704e-001, 5.986475e-001, 5.996210e-001, 6.005937e-001, 6.015656e-001, 6.025346e-001, 6.035036e-001, 6.044700e-001,
+6.054347e-001, 6.063994e-001, 6.073606e-001, 6.083216e-001, 6.092813e-001, 6.102381e-001, 6.111948e-001, 6.121494e-001, 6.131025e-001, 6.140555e-001,
+6.150049e-001, 6.159537e-001, 6.169021e-001, 6.178473e-001, 6.187925e-001, 6.197361e-001, 6.206771e-001, 6.216181e-001, 6.225570e-001, 6.234944e-001,
+6.244318e-001, 6.253659e-001, 6.262991e-001, 6.272324e-001, 6.281622e-001, 6.290918e-001, 6.300210e-001, 6.309466e-001, 6.318721e-001, 6.327968e-001,
+6.337188e-001, 6.346408e-001, 6.355614e-001, 6.364793e-001, 6.373972e-001, 6.383137e-001, 6.392281e-001, 6.401425e-001, 6.410550e-001, 6.419653e-001,
+6.428756e-001, 6.437843e-001, 6.446911e-001, 6.455979e-001, 6.465028e-001, 6.474056e-001, 6.483084e-001, 6.492096e-001, 6.501090e-001, 6.510083e-001,
+6.519060e-001, 6.528014e-001, 6.536967e-001, 6.545909e-001, 6.554828e-001, 6.563747e-001, 6.572657e-001, 6.581537e-001, 6.590416e-001, 6.599292e-001,
+6.608137e-001, 6.616983e-001, 6.625829e-001, 6.634636e-001, 6.643443e-001, 6.652249e-001, 6.661029e-001, 6.669801e-001, 6.678574e-001, 6.687323e-001,
+6.696057e-001, 6.704791e-001, 6.713513e-001, 6.722213e-001, 6.730913e-001, 6.739609e-001, 6.748271e-001, 6.756932e-001, 6.765594e-001, 6.774228e-001,
+6.782856e-001, 6.791485e-001, 6.800094e-001, 6.808684e-001, 6.817274e-001, 6.825858e-001, 6.834416e-001, 6.842973e-001, 6.851530e-001, 6.860056e-001,
+6.868576e-001, 6.877095e-001, 6.885594e-001, 6.894066e-001, 6.902537e-001, 6.911008e-001, 6.919430e-001, 6.927852e-001, 6.936273e-001, 6.944670e-001,
+6.953045e-001, 6.961420e-001, 6.969792e-001, 6.978119e-001, 6.986446e-001, 6.994773e-001, 7.003066e-001, 7.011331e-001, 7.019597e-001, 7.027862e-001,
+7.036068e-001, 7.044274e-001, 7.052480e-001, 7.060660e-001, 7.068808e-001, 7.076956e-001, 7.085104e-001, 7.093205e-001, 7.101297e-001, 7.109389e-001,
+7.117469e-001, 7.125506e-001, 7.133544e-001, 7.141581e-001, 7.149589e-001, 7.157574e-001, 7.165559e-001, 7.173544e-001, 7.181484e-001, 7.189418e-001,
+7.197352e-001, 7.205278e-001, 7.213163e-001, 7.221048e-001, 7.228933e-001, 7.236798e-001, 7.244636e-001, 7.252473e-001, 7.260311e-001, 7.268119e-001,
+7.275911e-001, 7.283703e-001, 7.291494e-001, 7.299250e-001, 7.306997e-001, 7.314745e-001, 7.322493e-001, 7.330184e-001, 7.337875e-001, 7.345565e-001,
+7.353250e-001, 7.360888e-001, 7.368526e-001, 7.376164e-001, 7.383791e-001, 7.391376e-001, 7.398961e-001, 7.406546e-001, 7.414119e-001, 7.421655e-001,
+7.429192e-001, 7.436728e-001, 7.444246e-001, 7.451719e-001, 7.459192e-001, 7.466665e-001, 7.474122e-001, 7.481539e-001, 7.488956e-001, 7.496372e-001,
+7.503775e-001, 7.511134e-001, 7.518494e-001, 7.525853e-001, 7.533204e-001, 7.540513e-001, 7.547823e-001, 7.555132e-001, 7.562438e-001, 7.569696e-001,
+7.576954e-001, 7.584212e-001, 7.591470e-001, 7.598674e-001, 7.605875e-001, 7.613075e-001, 7.620275e-001, 7.627432e-001, 7.634575e-001, 7.641719e-001,
+7.648862e-001, 7.655977e-001, 7.663069e-001, 7.670162e-001, 7.677254e-001, 7.684331e-001, 7.691373e-001, 7.698415e-001, 7.705457e-001, 7.712498e-001,
+7.719481e-001, 7.726464e-001, 7.733447e-001, 7.740430e-001, 7.747374e-001, 7.754303e-001, 7.761231e-001, 7.768160e-001, 7.775070e-001, 7.781948e-001,
+7.788826e-001, 7.795704e-001, 7.802582e-001, 7.809401e-001, 7.816220e-001, 7.823038e-001, 7.829857e-001, 7.836646e-001, 7.843411e-001, 7.850177e-001,
+7.856942e-001, 7.863703e-001, 7.870418e-001, 7.877133e-001, 7.883848e-001, 7.890563e-001, 7.897252e-001, 7.903924e-001, 7.910595e-001, 7.917266e-001,
+7.923934e-001, 7.930549e-001, 7.937165e-001, 7.943781e-001, 7.950396e-001, 7.956983e-001, 7.963540e-001, 7.970097e-001, 7.976654e-001, 7.983211e-001,
+7.989719e-001, 7.996220e-001, 8.002722e-001, 8.009224e-001, 8.015714e-001, 8.022169e-001, 8.028623e-001, 8.035078e-001, 8.041532e-001, 8.047962e-001,
+8.054372e-001, 8.060783e-001, 8.067193e-001, 8.073604e-001, 8.079984e-001, 8.086359e-001, 8.092733e-001, 8.099107e-001, 8.105478e-001, 8.111796e-001,
+8.118113e-001, 8.124431e-001, 8.130749e-001, 8.137050e-001, 8.143306e-001, 8.149561e-001, 8.155816e-001, 8.162071e-001, 8.168303e-001, 8.174502e-001,
+8.180701e-001, 8.186900e-001, 8.193099e-001, 8.199271e-001, 8.205421e-001, 8.211571e-001, 8.217720e-001, 8.223870e-001, 8.229985e-001, 8.236080e-001,
+8.242174e-001, 8.248268e-001, 8.254362e-001, 8.260415e-001, 8.266445e-001, 8.272475e-001, 8.278505e-001, 8.284535e-001, 8.290522e-001, 8.296484e-001,
+8.302447e-001, 8.308409e-001, 8.314371e-001, 8.320297e-001, 8.326196e-001, 8.332096e-001, 8.337996e-001, 8.343895e-001, 8.349768e-001, 8.355614e-001,
+8.361460e-001, 8.367306e-001, 8.373152e-001, 8.378980e-001, 8.384777e-001, 8.390574e-001, 8.396371e-001, 8.402168e-001, 8.407955e-001, 8.413700e-001,
+8.419444e-001, 8.425189e-001, 8.430933e-001, 8.436678e-001, 8.442365e-001, 8.448051e-001, 8.453737e-001, 8.459423e-001, 8.465108e-001, 8.470759e-001,
+8.476397e-001, 8.482034e-001, 8.487671e-001, 8.493308e-001, 8.498923e-001, 8.504505e-001, 8.510087e-001, 8.515670e-001, 8.521252e-001, 8.526831e-001,
+8.532357e-001, 8.537884e-001, 8.543410e-001, 8.548936e-001, 8.554462e-001, 8.559949e-001, 8.565415e-001, 8.570882e-001, 8.576349e-001, 8.581815e-001,
+8.587270e-001, 8.592686e-001, 8.598103e-001, 8.603519e-001, 8.608935e-001, 8.614351e-001, 8.619735e-001, 8.625109e-001, 8.630483e-001, 8.635856e-001,
+8.641230e-001, 8.646594e-001, 8.651922e-001, 8.657250e-001, 8.662578e-001, 8.667906e-001, 8.673234e-001, 8.678524e-001, 8.683792e-001, 8.689060e-001,
+8.694328e-001, 8.699597e-001, 8.704864e-001, 8.710079e-001, 8.715295e-001, 8.720510e-001, 8.725726e-001, 8.730941e-001, 8.736138e-001, 8.741300e-001,
+8.746462e-001, 8.751623e-001, 8.756785e-001, 8.761947e-001, 8.767072e-001, 8.772177e-001, 8.777281e-001, 8.782385e-001, 8.787490e-001, 8.792594e-001,
+8.797658e-001, 8.802717e-001, 8.807775e-001, 8.812834e-001, 8.817893e-001, 8.822947e-001, 8.827947e-001, 8.832946e-001, 8.837945e-001, 8.842945e-001,
+8.847944e-001, 8.852931e-001, 8.857870e-001, 8.862809e-001, 8.867748e-001, 8.872687e-001, 8.877626e-001, 8.882550e-001, 8.887439e-001, 8.892328e-001,
+8.897216e-001, 8.902105e-001, 8.906994e-001, 8.911865e-001, 8.916703e-001, 8.921542e-001, 8.926380e-001, 8.931218e-001, 8.936056e-001, 8.940873e-001,
+8.945649e-001, 8.950425e-001, 8.955201e-001, 8.959977e-001, 8.964753e-001, 8.969513e-001, 8.974236e-001, 8.978958e-001, 8.983680e-001, 8.988403e-001,
+8.993125e-001, 8.997838e-001, 9.002509e-001, 9.007179e-001, 9.011850e-001, 9.016520e-001, 9.021190e-001, 9.025860e-001, 9.030467e-001, 9.035073e-001,
+9.039680e-001, 9.044287e-001, 9.048894e-001, 9.053501e-001, 9.058066e-001, 9.062621e-001, 9.067176e-001, 9.071731e-001, 9.076286e-001, 9.080841e-001,
+9.085367e-001, 9.089870e-001, 9.094373e-001, 9.098876e-001, 9.103379e-001, 9.107882e-001, 9.112373e-001, 9.116825e-001, 9.121277e-001, 9.125729e-001,
+9.130182e-001, 9.134634e-001, 9.139086e-001, 9.143494e-001, 9.147896e-001, 9.152298e-001, 9.156700e-001, 9.161102e-001, 9.165504e-001, 9.169877e-001,
+9.174218e-001, 9.178560e-001, 9.182901e-001, 9.187242e-001, 9.191583e-001, 9.195924e-001, 9.200206e-001, 9.204488e-001, 9.208770e-001, 9.213052e-001,
+9.217334e-001, 9.221615e-001, 9.225875e-001, 9.230108e-001, 9.234342e-001, 9.238576e-001, 9.242809e-001, 9.247043e-001, 9.251277e-001, 9.255469e-001,
+9.259656e-001, 9.263843e-001, 9.268030e-001, 9.272217e-001, 9.276404e-001, 9.280577e-001, 9.284709e-001, 9.288841e-001, 9.292973e-001, 9.297105e-001,
+9.301237e-001, 9.305369e-001, 9.309472e-001, 9.313555e-001, 9.317637e-001, 9.321720e-001, 9.325802e-001, 9.329885e-001, 9.333967e-001, 9.338007e-001,
+9.342038e-001, 9.346070e-001, 9.350101e-001, 9.354133e-001, 9.358164e-001, 9.362193e-001, 9.366165e-001, 9.370137e-001, 9.374109e-001, 9.378081e-001,
+9.382053e-001, 9.386025e-001, 9.389989e-001, 9.393916e-001, 9.397843e-001, 9.401771e-001, 9.405698e-001, 9.409625e-001, 9.413552e-001, 9.417470e-001,
+9.421362e-001, 9.425255e-001, 9.429147e-001, 9.433040e-001, 9.436932e-001, 9.440825e-001, 9.444703e-001, 9.448545e-001, 9.452388e-001, 9.456231e-001,
+9.460073e-001, 9.463916e-001, 9.467759e-001, 9.471583e-001, 9.475358e-001, 9.479133e-001, 9.482908e-001, 9.486683e-001, 9.490458e-001, 9.494233e-001,
+9.497994e-001, 9.501691e-001, 9.505387e-001, 9.509084e-001, 9.512781e-001, 9.516478e-001, 9.520175e-001, 9.523869e-001, 9.527492e-001, 9.531115e-001,
+9.534738e-001, 9.538361e-001, 9.541984e-001, 9.545607e-001, 9.549230e-001, 9.552814e-001, 9.556391e-001, 9.559967e-001, 9.563543e-001, 9.567119e-001,
+9.570695e-001, 9.574272e-001, 9.577826e-001, 9.581363e-001, 9.584901e-001, 9.588438e-001, 9.591976e-001, 9.595513e-001, 9.599051e-001, 9.602577e-001,
+9.606066e-001, 9.609556e-001, 9.613046e-001, 9.616535e-001, 9.620025e-001, 9.623514e-001, 9.627004e-001, 9.630453e-001, 9.633896e-001, 9.637339e-001,
+9.640782e-001, 9.644225e-001, 9.647668e-001, 9.651110e-001, 9.654532e-001, 9.657923e-001, 9.661315e-001, 9.664706e-001, 9.668097e-001, 9.671489e-001,
+9.674880e-001, 9.678271e-001, 9.681611e-001, 9.684946e-001, 9.688280e-001, 9.691614e-001, 9.694949e-001, 9.698283e-001, 9.701617e-001, 9.704934e-001,
+9.708214e-001, 9.711495e-001, 9.714776e-001, 9.718057e-001, 9.721337e-001, 9.724618e-001, 9.727899e-001, 9.731143e-001, 9.734373e-001, 9.737602e-001,
+9.740832e-001, 9.744061e-001, 9.747291e-001, 9.750520e-001, 9.753750e-001, 9.756927e-001, 9.760104e-001, 9.763281e-001, 9.766458e-001, 9.769635e-001,
+9.772812e-001, 9.775989e-001, 9.779152e-001, 9.782271e-001, 9.785389e-001, 9.788508e-001, 9.791626e-001, 9.794744e-001, 9.797863e-001, 9.800981e-001,
+9.804073e-001, 9.807129e-001, 9.810184e-001, 9.813239e-001, 9.816295e-001, 9.819350e-001, 9.822405e-001, 9.825461e-001, 9.828479e-001, 9.831465e-001,
+9.834451e-001, 9.837437e-001, 9.840423e-001, 9.843410e-001, 9.846396e-001, 9.849382e-001, 9.852323e-001, 9.855231e-001, 9.858139e-001, 9.861047e-001,
+9.863955e-001, 9.866863e-001, 9.869771e-001, 9.872679e-001, 9.875542e-001, 9.878369e-001, 9.881196e-001, 9.884023e-001, 9.886850e-001, 9.889677e-001,
+9.892504e-001, 9.895331e-001, 9.898114e-001, 9.900846e-001, 9.903577e-001, 9.906309e-001, 9.909040e-001, 9.911772e-001, 9.914503e-001, 9.917235e-001,
+9.919933e-001, 9.922555e-001, 9.925177e-001, 9.927799e-001, 9.930421e-001, 9.933043e-001, 9.935665e-001, 9.938287e-001, 9.940900e-001, 9.943412e-001,
+9.945925e-001, 9.948437e-001, 9.950950e-001, 9.953462e-001, 9.955974e-001, 9.958487e-001, 9.960999e-001, 9.963402e-001, 9.965775e-001, 9.968149e-001,
+9.970522e-001, 9.972896e-001, 9.975269e-001, 9.977643e-001, 9.980016e-001, 9.982319e-001, 9.984529e-001, 9.986740e-001, 9.988950e-001, 9.991160e-001,
+9.993370e-001, 9.995580e-001, 9.997790e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.812529e-003, 1.671761e-002, 2.352084e-002, 2.973620e-002, 3.558908e-002, 4.119485e-002, 4.662557e-002, 5.191926e-002, 5.712913e-002,
+6.226287e-002, 6.729204e-002, 7.218246e-002, 7.691876e-002, 8.152023e-002, 8.598364e-002, 9.032531e-002, 9.456123e-002, 9.869361e-002, 1.027287e-001,
+1.066883e-001, 1.105668e-001, 1.143578e-001, 1.180787e-001, 1.217279e-001, 1.253149e-001, 1.288353e-001, 1.322915e-001, 1.356991e-001, 1.390592e-001,
+1.423661e-001, 1.456252e-001, 1.488344e-001, 1.519986e-001, 1.551182e-001, 1.581997e-001, 1.612505e-001, 1.642564e-001, 1.672242e-001, 1.701562e-001,
+1.730598e-001, 1.759244e-001, 1.787561e-001, 1.815646e-001, 1.843390e-001, 1.870823e-001, 1.898011e-001, 1.924956e-001, 1.951647e-001, 1.978062e-001,
+2.004275e-001, 2.030244e-001, 2.055976e-001, 2.081507e-001, 2.106831e-001, 2.131962e-001, 2.156914e-001, 2.181655e-001, 2.206185e-001, 2.230494e-001,
+2.254670e-001, 2.278636e-001, 2.302405e-001, 2.326006e-001, 2.349402e-001, 2.372657e-001, 2.395751e-001, 2.418743e-001, 2.441594e-001, 2.464270e-001,
+2.486841e-001, 2.509253e-001, 2.531494e-001, 2.553616e-001, 2.575597e-001, 2.597442e-001, 2.619175e-001, 2.640810e-001, 2.662318e-001, 2.683725e-001,
+2.705015e-001, 2.726207e-001, 2.747272e-001, 2.768242e-001, 2.789102e-001, 2.809853e-001, 2.830494e-001, 2.851034e-001, 2.871474e-001, 2.891792e-001,
+2.912011e-001, 2.932142e-001, 2.952139e-001, 2.972015e-001, 2.991822e-001, 3.011547e-001, 3.031156e-001, 3.050638e-001, 3.070029e-001, 3.089343e-001,
+3.108555e-001, 3.127650e-001, 3.146661e-001, 3.165612e-001, 3.184479e-001, 3.203235e-001, 3.221895e-001, 3.240458e-001, 3.258921e-001, 3.277291e-001,
+3.295576e-001, 3.313786e-001, 3.331907e-001, 3.349941e-001, 3.367873e-001, 3.385719e-001, 3.403506e-001, 3.421216e-001, 3.438830e-001, 3.456346e-001,
+3.473793e-001, 3.491172e-001, 3.508478e-001, 3.525711e-001, 3.542862e-001, 3.559937e-001, 3.576950e-001, 3.593909e-001, 3.610796e-001, 3.627604e-001,
+3.644333e-001, 3.660991e-001, 3.677594e-001, 3.694129e-001, 3.710587e-001, 3.726957e-001, 3.743240e-001, 3.759444e-001, 3.775575e-001, 3.791647e-001,
+3.807658e-001, 3.823603e-001, 3.839475e-001, 3.855277e-001, 3.871026e-001, 3.886740e-001, 3.902403e-001, 3.918005e-001, 3.933543e-001, 3.949012e-001,
+3.964413e-001, 3.979749e-001, 3.995011e-001, 4.010228e-001, 4.025394e-001, 4.040511e-001, 4.055580e-001, 4.070582e-001, 4.085539e-001, 4.100450e-001,
+4.115311e-001, 4.130091e-001, 4.144822e-001, 4.159504e-001, 4.174130e-001, 4.188692e-001, 4.203204e-001, 4.217669e-001, 4.232077e-001, 4.246426e-001,
+4.260735e-001, 4.275006e-001, 4.289224e-001, 4.303408e-001, 4.317557e-001, 4.331642e-001, 4.345675e-001, 4.359666e-001, 4.373601e-001, 4.387484e-001,
+4.401332e-001, 4.415132e-001, 4.428895e-001, 4.442632e-001, 4.456325e-001, 4.469971e-001, 4.483584e-001, 4.497137e-001, 4.510636e-001, 4.524100e-001,
+4.537502e-001, 4.550873e-001, 4.564215e-001, 4.577501e-001, 4.590757e-001, 4.603962e-001, 4.617126e-001, 4.630268e-001, 4.643348e-001, 4.656395e-001,
+4.669405e-001, 4.682347e-001, 4.695264e-001, 4.708125e-001, 4.720954e-001, 4.733743e-001, 4.746474e-001, 4.759184e-001, 4.771836e-001, 4.784464e-001,
+4.797044e-001, 4.809592e-001, 4.822116e-001, 4.834590e-001, 4.847050e-001, 4.859469e-001, 4.871871e-001, 4.884233e-001, 4.896576e-001, 4.908898e-001,
+4.921190e-001, 4.933467e-001, 4.945700e-001, 4.957925e-001, 4.970095e-001, 4.982254e-001, 4.994362e-001, 5.006449e-001, 5.018490e-001, 5.030499e-001,
+5.042467e-001, 5.054403e-001, 5.066309e-001, 5.078179e-001, 5.090024e-001, 5.101822e-001, 5.113597e-001, 5.125322e-001, 5.137026e-001, 5.148684e-001,
+5.160327e-001, 5.171926e-001, 5.183512e-001, 5.195046e-001, 5.206564e-001, 5.218035e-001, 5.229489e-001, 5.240890e-001, 5.252269e-001, 5.263601e-001,
+5.274911e-001, 5.286171e-001, 5.297398e-001, 5.308595e-001, 5.319763e-001, 5.330903e-001, 5.342004e-001, 5.353086e-001, 5.364123e-001, 5.375147e-001,
+5.386112e-001, 5.397076e-001, 5.407970e-001, 5.418864e-001, 5.429693e-001, 5.440510e-001, 5.451289e-001, 5.462048e-001, 5.472781e-001, 5.483480e-001,
+5.494166e-001, 5.504804e-001, 5.515442e-001, 5.526020e-001, 5.536596e-001, 5.547126e-001, 5.557638e-001, 5.568123e-001, 5.578569e-001, 5.589008e-001,
+5.599388e-001, 5.609768e-001, 5.620094e-001, 5.630406e-001, 5.640686e-001, 5.650928e-001, 5.661164e-001, 5.671336e-001, 5.681508e-001, 5.691627e-001,
+5.701727e-001, 5.711808e-001, 5.721849e-001, 5.731890e-001, 5.741881e-001, 5.751867e-001, 5.761825e-001, 5.771751e-001, 5.781676e-001, 5.791545e-001,
+5.801414e-001, 5.811259e-001, 5.821083e-001, 5.830906e-001, 5.840694e-001, 5.850482e-001, 5.860246e-001, 5.869989e-001, 5.879733e-001, 5.889440e-001,
+5.899147e-001, 5.908836e-001, 5.918499e-001, 5.928161e-001, 5.937794e-001, 5.947421e-001, 5.957038e-001, 5.966621e-001, 5.976204e-001, 5.985765e-001,
+5.995313e-001, 6.004860e-001, 6.014366e-001, 6.023870e-001, 6.033364e-001, 6.042832e-001, 6.052301e-001, 6.061744e-001, 6.071169e-001, 6.080595e-001,
+6.089989e-001, 6.099380e-001, 6.108764e-001, 6.118112e-001, 6.127460e-001, 6.136794e-001, 6.146107e-001, 6.155420e-001, 6.164707e-001, 6.173978e-001,
+6.183248e-001, 6.192492e-001, 6.201727e-001, 6.210963e-001, 6.220159e-001, 6.229353e-001, 6.238543e-001, 6.247703e-001, 6.256863e-001, 6.266013e-001,
+6.275131e-001, 6.284249e-001, 6.293356e-001, 6.302440e-001, 6.311524e-001, 6.320592e-001, 6.329634e-001, 6.338677e-001, 6.347705e-001, 6.356714e-001,
+6.365723e-001, 6.374712e-001, 6.383680e-001, 6.392649e-001, 6.401593e-001, 6.410511e-001, 6.419429e-001, 6.428323e-001, 6.437188e-001, 6.446054e-001,
+6.454899e-001, 6.463716e-001, 6.472533e-001, 6.481333e-001, 6.490099e-001, 6.498864e-001, 6.507615e-001, 6.516316e-001, 6.525018e-001, 6.533712e-001,
+6.542350e-001, 6.550989e-001, 6.559628e-001, 6.568208e-001, 6.576786e-001, 6.585363e-001, 6.593895e-001, 6.602413e-001, 6.610932e-001, 6.619417e-001,
+6.627879e-001, 6.636340e-001, 6.644782e-001, 6.653188e-001, 6.661595e-001, 6.669995e-001, 6.678348e-001, 6.686701e-001, 6.695053e-001, 6.703364e-001,
+6.711665e-001, 6.719966e-001, 6.728242e-001, 6.736493e-001, 6.744744e-001, 6.752987e-001, 6.761190e-001, 6.769393e-001, 6.777596e-001, 6.785761e-001,
+6.793918e-001, 6.802074e-001, 6.810206e-001, 6.818302e-001, 6.826398e-001, 6.834495e-001, 6.842536e-001, 6.850578e-001, 6.858619e-001, 6.866630e-001,
+6.874615e-001, 6.882600e-001, 6.890582e-001, 6.898517e-001, 6.906451e-001, 6.914386e-001, 6.922283e-001, 6.930150e-001, 6.938016e-001, 6.945882e-001,
+6.953691e-001, 6.961500e-001, 6.969308e-001, 6.977090e-001, 6.984837e-001, 6.992584e-001, 7.000332e-001, 7.008035e-001, 7.015731e-001, 7.023427e-001,
+7.031110e-001, 7.038751e-001, 7.046392e-001, 7.054032e-001, 7.061648e-001, 7.069243e-001, 7.076838e-001, 7.084434e-001, 7.091986e-001, 7.099533e-001,
+7.107080e-001, 7.114617e-001, 7.122109e-001, 7.129601e-001, 7.137093e-001, 7.144563e-001, 7.152001e-001, 7.159439e-001, 7.166876e-001, 7.174284e-001,
+7.181674e-001, 7.189065e-001, 7.196455e-001, 7.203806e-001, 7.211149e-001, 7.218492e-001, 7.225835e-001, 7.233123e-001, 7.240410e-001, 7.247697e-001,
+7.254979e-001, 7.262215e-001, 7.269450e-001, 7.276686e-001, 7.283912e-001, 7.291100e-001, 7.298289e-001, 7.305477e-001, 7.312654e-001, 7.319800e-001,
+7.326945e-001, 7.334091e-001, 7.341225e-001, 7.348332e-001, 7.355439e-001, 7.362546e-001, 7.369639e-001, 7.376697e-001, 7.383756e-001, 7.390814e-001,
+7.397862e-001, 7.404879e-001, 7.411896e-001, 7.418913e-001, 7.425923e-001, 7.432901e-001, 7.439879e-001, 7.446856e-001, 7.453832e-001, 7.460778e-001,
+7.467724e-001, 7.474670e-001, 7.481616e-001, 7.488520e-001, 7.495421e-001, 7.502321e-001, 7.509222e-001, 7.516098e-001, 7.522965e-001, 7.529832e-001,
+7.536700e-001, 7.543542e-001, 7.550363e-001, 7.557184e-001, 7.564005e-001, 7.570811e-001, 7.577580e-001, 7.584350e-001, 7.591119e-001, 7.597887e-001,
+7.604610e-001, 7.611332e-001, 7.618055e-001, 7.624777e-001, 7.631471e-001, 7.638152e-001, 7.644833e-001, 7.651514e-001, 7.658178e-001, 7.664811e-001,
+7.671444e-001, 7.678076e-001, 7.684709e-001, 7.691282e-001, 7.697854e-001, 7.704425e-001, 7.710997e-001, 7.717540e-001, 7.724062e-001, 7.730583e-001,
+7.737105e-001, 7.743622e-001, 7.750093e-001, 7.756564e-001, 7.763035e-001, 7.769506e-001, 7.775946e-001, 7.782364e-001, 7.788783e-001, 7.795201e-001,
+7.801616e-001, 7.807984e-001, 7.814353e-001, 7.820721e-001, 7.827090e-001, 7.833437e-001, 7.839764e-001, 7.846091e-001, 7.852418e-001, 7.858745e-001,
+7.865038e-001, 7.871326e-001, 7.877614e-001, 7.883902e-001, 7.890180e-001, 7.896424e-001, 7.902668e-001, 7.908912e-001, 7.915156e-001, 7.921379e-001,
+7.927586e-001, 7.933792e-001, 7.939998e-001, 7.946205e-001, 7.952385e-001, 7.958560e-001, 7.964735e-001, 7.970910e-001, 7.977082e-001, 7.983208e-001,
+7.989333e-001, 7.995459e-001, 8.001585e-001, 8.007699e-001, 8.013782e-001, 8.019865e-001, 8.025948e-001, 8.032031e-001, 8.038098e-001, 8.044144e-001,
+8.050190e-001, 8.056235e-001, 8.062281e-001, 8.068311e-001, 8.074326e-001, 8.080341e-001, 8.086356e-001, 8.092371e-001, 8.098356e-001, 8.104322e-001,
+8.110287e-001, 8.116252e-001, 8.122218e-001, 8.128147e-001, 8.134056e-001, 8.139965e-001, 8.145875e-001, 8.151784e-001, 8.157663e-001, 8.163525e-001,
+8.169388e-001, 8.175250e-001, 8.181112e-001, 8.186949e-001, 8.192769e-001, 8.198588e-001, 8.204407e-001, 8.210227e-001, 8.216029e-001, 8.221815e-001,
+8.227600e-001, 8.233386e-001, 8.239171e-001, 8.244941e-001, 8.250683e-001, 8.256426e-001, 8.262168e-001, 8.267911e-001, 8.273645e-001, 8.279344e-001,
+8.285044e-001, 8.290743e-001, 8.296442e-001, 8.302142e-001, 8.307794e-001, 8.313445e-001, 8.319096e-001, 8.324747e-001, 8.330397e-001, 8.336019e-001,
+8.341628e-001, 8.347238e-001, 8.352848e-001, 8.358457e-001, 8.364053e-001, 8.369628e-001, 8.375203e-001, 8.380778e-001, 8.386353e-001, 8.391926e-001,
+8.397460e-001, 8.402995e-001, 8.408529e-001, 8.414064e-001, 8.419599e-001, 8.425098e-001, 8.430579e-001, 8.436061e-001, 8.441542e-001, 8.447024e-001,
+8.452494e-001, 8.457928e-001, 8.463361e-001, 8.468794e-001, 8.474227e-001, 8.479660e-001, 8.485065e-001, 8.490460e-001, 8.495855e-001, 8.501250e-001,
+8.506645e-001, 8.512032e-001, 8.517394e-001, 8.522755e-001, 8.528117e-001, 8.533478e-001, 8.538840e-001, 8.544178e-001, 8.549503e-001, 8.554828e-001,
+8.560153e-001, 8.565479e-001, 8.570803e-001, 8.576078e-001, 8.581353e-001, 8.586628e-001, 8.591903e-001, 8.597178e-001, 8.602438e-001, 8.607671e-001,
+8.612904e-001, 8.618137e-001, 8.623370e-001, 8.628603e-001, 8.633814e-001, 8.639012e-001, 8.644211e-001, 8.649409e-001, 8.654607e-001, 8.659806e-001,
+8.664971e-001, 8.670131e-001, 8.675292e-001, 8.680452e-001, 8.685612e-001, 8.690769e-001, 8.695879e-001, 8.700989e-001, 8.706099e-001, 8.711209e-001,
+8.716319e-001, 8.721420e-001, 8.726485e-001, 8.731550e-001, 8.736615e-001, 8.741680e-001, 8.746745e-001, 8.751800e-001, 8.756831e-001, 8.761863e-001,
+8.766894e-001, 8.771925e-001, 8.776956e-001, 8.781974e-001, 8.786968e-001, 8.791961e-001, 8.796954e-001, 8.801947e-001, 8.806941e-001, 8.811920e-001,
+8.816872e-001, 8.821823e-001, 8.826775e-001, 8.831727e-001, 8.836679e-001, 8.841619e-001, 8.846527e-001, 8.851436e-001, 8.856344e-001, 8.861253e-001,
+8.866161e-001, 8.871064e-001, 8.875938e-001, 8.880812e-001, 8.885686e-001, 8.890560e-001, 8.895434e-001, 8.900307e-001, 8.905134e-001, 8.909961e-001,
+8.914787e-001, 8.919614e-001, 8.924441e-001, 8.929268e-001, 8.934053e-001, 8.938829e-001, 8.943605e-001, 8.948380e-001, 8.953156e-001, 8.957932e-001,
+8.962686e-001, 8.967422e-001, 8.972158e-001, 8.976894e-001, 8.981630e-001, 8.986367e-001, 8.991093e-001, 8.995787e-001, 9.000481e-001, 9.005175e-001,
+9.009870e-001, 9.014564e-001, 9.019258e-001, 9.023923e-001, 9.028584e-001, 9.033245e-001, 9.037906e-001, 9.042567e-001, 9.047227e-001, 9.051872e-001,
+9.056496e-001, 9.061121e-001, 9.065745e-001, 9.070370e-001, 9.074994e-001, 9.079619e-001, 9.084207e-001, 9.088795e-001, 9.093383e-001, 9.097971e-001,
+9.102559e-001, 9.107146e-001, 9.111717e-001, 9.116267e-001, 9.120818e-001, 9.125369e-001, 9.129919e-001, 9.134470e-001, 9.139020e-001, 9.143534e-001,
+9.148043e-001, 9.152552e-001, 9.157061e-001, 9.161570e-001, 9.166079e-001, 9.170578e-001, 9.175047e-001, 9.179517e-001, 9.183986e-001, 9.188456e-001,
+9.192925e-001, 9.197395e-001, 9.201841e-001, 9.206269e-001, 9.210698e-001, 9.215126e-001, 9.219554e-001, 9.223983e-001, 9.228411e-001, 9.232805e-001,
+9.237191e-001, 9.241577e-001, 9.245964e-001, 9.250350e-001, 9.254736e-001, 9.259121e-001, 9.263465e-001, 9.267809e-001, 9.272153e-001, 9.276497e-001,
+9.280841e-001, 9.285185e-001, 9.289523e-001, 9.293835e-001, 9.298147e-001, 9.302459e-001, 9.306771e-001, 9.311083e-001, 9.315396e-001, 9.319697e-001,
+9.323967e-001, 9.328237e-001, 9.332508e-001, 9.336778e-001, 9.341048e-001, 9.345319e-001, 9.349574e-001, 9.353792e-001, 9.358010e-001, 9.362229e-001,
+9.366447e-001, 9.370665e-001, 9.374883e-001, 9.379090e-001, 9.383267e-001, 9.387443e-001, 9.391620e-001, 9.395796e-001, 9.399973e-001, 9.404149e-001,
+9.408315e-001, 9.412431e-001, 9.416547e-001, 9.420663e-001, 9.424779e-001, 9.428895e-001, 9.433011e-001, 9.437125e-001, 9.441194e-001, 9.445263e-001,
+9.449332e-001, 9.453401e-001, 9.457470e-001, 9.461539e-001, 9.465608e-001, 9.469651e-001, 9.473688e-001, 9.477726e-001, 9.481763e-001, 9.485801e-001,
+9.489838e-001, 9.493876e-001, 9.497890e-001, 9.501886e-001, 9.505882e-001, 9.509878e-001, 9.513874e-001, 9.517870e-001, 9.521866e-001, 9.525852e-001,
+9.529808e-001, 9.533764e-001, 9.537721e-001, 9.541677e-001, 9.545633e-001, 9.549590e-001, 9.553546e-001, 9.557469e-001, 9.561387e-001, 9.565305e-001,
+9.569223e-001, 9.573141e-001, 9.577058e-001, 9.580976e-001, 9.584879e-001, 9.588759e-001, 9.592640e-001, 9.596521e-001, 9.600401e-001, 9.604282e-001,
+9.608163e-001, 9.612043e-001, 9.615884e-001, 9.619721e-001, 9.623558e-001, 9.627394e-001, 9.631231e-001, 9.635068e-001, 9.638904e-001, 9.642725e-001,
+9.646512e-001, 9.650299e-001, 9.654087e-001, 9.657874e-001, 9.661662e-001, 9.665449e-001, 9.669237e-001, 9.672991e-001, 9.676732e-001, 9.680472e-001,
+9.684213e-001, 9.687953e-001, 9.691694e-001, 9.695434e-001, 9.699175e-001, 9.702869e-001, 9.706563e-001, 9.710256e-001, 9.713950e-001, 9.717644e-001,
+9.721338e-001, 9.725032e-001, 9.728714e-001, 9.732358e-001, 9.736002e-001, 9.739646e-001, 9.743290e-001, 9.746935e-001, 9.750579e-001, 9.754223e-001,
+9.757844e-001, 9.761432e-001, 9.765020e-001, 9.768608e-001, 9.772196e-001, 9.775784e-001, 9.779372e-001, 9.782960e-001, 9.786517e-001, 9.790048e-001,
+9.793579e-001, 9.797110e-001, 9.800641e-001, 9.804172e-001, 9.807703e-001, 9.811234e-001, 9.814731e-001, 9.818202e-001, 9.821674e-001, 9.825145e-001,
+9.828616e-001, 9.832088e-001, 9.835559e-001, 9.839030e-001, 9.842464e-001, 9.845867e-001, 9.849270e-001, 9.852673e-001, 9.856076e-001, 9.859479e-001,
+9.862882e-001, 9.866285e-001, 9.869654e-001, 9.872982e-001, 9.876311e-001, 9.879639e-001, 9.882967e-001, 9.886296e-001, 9.889624e-001, 9.892953e-001,
+9.896262e-001, 9.899527e-001, 9.902791e-001, 9.906056e-001, 9.909321e-001, 9.912585e-001, 9.915850e-001, 9.919115e-001, 9.922374e-001, 9.925573e-001,
+9.928773e-001, 9.931972e-001, 9.935171e-001, 9.938370e-001, 9.941570e-001, 9.944769e-001, 9.947968e-001, 9.951103e-001, 9.954220e-001, 9.957338e-001,
+9.960456e-001, 9.963573e-001, 9.966691e-001, 9.969809e-001, 9.972926e-001, 9.975994e-001, 9.978995e-001, 9.981995e-001, 9.984996e-001, 9.987997e-001,
+9.990998e-001, 9.993998e-001, 9.996999e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.725881e-003, 1.310988e-002, 1.875234e-002, 2.390697e-002, 2.875677e-002, 3.337722e-002, 3.780361e-002, 4.209327e-002, 4.625201e-002,
+5.031206e-002, 5.429539e-002, 5.820906e-002, 6.205706e-002, 6.584723e-002, 6.958052e-002, 7.327293e-002, 7.691760e-002, 8.051806e-002, 8.408073e-002,
+8.760465e-002, 9.108887e-002, 9.453251e-002, 9.793599e-002, 1.012984e-001, 1.046219e-001, 1.078997e-001, 1.111387e-001, 1.143450e-001, 1.175180e-001,
+1.206526e-001, 1.237441e-001, 1.267928e-001, 1.298023e-001, 1.327775e-001, 1.357243e-001, 1.386376e-001, 1.415114e-001, 1.443508e-001, 1.471656e-001,
+1.499509e-001, 1.527041e-001, 1.554243e-001, 1.581098e-001, 1.607619e-001, 1.633783e-001, 1.659625e-001, 1.685173e-001, 1.710430e-001, 1.735426e-001,
+1.760166e-001, 1.784628e-001, 1.808815e-001, 1.832715e-001, 1.856443e-001, 1.879992e-001, 1.903317e-001, 1.926411e-001, 1.949305e-001, 1.971997e-001,
+1.994490e-001, 2.016751e-001, 2.038797e-001, 2.060653e-001, 2.082332e-001, 2.103781e-001, 2.125052e-001, 2.146157e-001, 2.167120e-001, 2.187922e-001,
+2.208545e-001, 2.229007e-001, 2.249286e-001, 2.269378e-001, 2.289337e-001, 2.309127e-001, 2.328775e-001, 2.348312e-001, 2.367679e-001, 2.386890e-001,
+2.405951e-001, 2.424882e-001, 2.443652e-001, 2.462335e-001, 2.480896e-001, 2.499316e-001, 2.517591e-001, 2.535771e-001, 2.553841e-001, 2.571800e-001,
+2.589675e-001, 2.607443e-001, 2.625100e-001, 2.642693e-001, 2.660228e-001, 2.677706e-001, 2.695144e-001, 2.712531e-001, 2.729857e-001, 2.747122e-001,
+2.764343e-001, 2.781511e-001, 2.798615e-001, 2.815661e-001, 2.832651e-001, 2.849591e-001, 2.866473e-001, 2.883332e-001, 2.900171e-001, 2.916966e-001,
+2.933689e-001, 2.950362e-001, 2.967015e-001, 2.983629e-001, 3.000209e-001, 3.016755e-001, 3.033276e-001, 3.049787e-001, 3.066262e-001, 3.082688e-001,
+3.099067e-001, 3.115408e-001, 3.131730e-001, 3.148024e-001, 3.164278e-001, 3.180497e-001, 3.196698e-001, 3.212881e-001, 3.229044e-001, 3.245167e-001,
+3.261251e-001, 3.277315e-001, 3.293342e-001, 3.309333e-001, 3.325303e-001, 3.341257e-001, 3.357196e-001, 3.373118e-001, 3.389019e-001, 3.404884e-001,
+3.420729e-001, 3.436553e-001, 3.452340e-001, 3.468090e-001, 3.483793e-001, 3.499443e-001, 3.515053e-001, 3.530634e-001, 3.546175e-001, 3.561686e-001,
+3.577178e-001, 3.592661e-001, 3.608109e-001, 3.623530e-001, 3.638921e-001, 3.654283e-001, 3.669611e-001, 3.684918e-001, 3.700192e-001, 3.715432e-001,
+3.730638e-001, 3.745815e-001, 3.760956e-001, 3.776069e-001, 3.791160e-001, 3.806218e-001, 3.821238e-001, 3.836226e-001, 3.851186e-001, 3.866108e-001,
+3.881004e-001, 3.895873e-001, 3.910716e-001, 3.925528e-001, 3.940311e-001, 3.955051e-001, 3.969768e-001, 3.984460e-001, 3.999112e-001, 4.013736e-001,
+4.028340e-001, 4.042920e-001, 4.057450e-001, 4.071955e-001, 4.086432e-001, 4.100873e-001, 4.115292e-001, 4.129675e-001, 4.144037e-001, 4.158385e-001,
+4.172705e-001, 4.187004e-001, 4.201288e-001, 4.215534e-001, 4.229757e-001, 4.243944e-001, 4.258099e-001, 4.272239e-001, 4.286344e-001, 4.300416e-001,
+4.314456e-001, 4.328456e-001, 4.342440e-001, 4.356384e-001, 4.370301e-001, 4.384193e-001, 4.398040e-001, 4.411870e-001, 4.425633e-001, 4.439374e-001,
+4.453080e-001, 4.466761e-001, 4.480429e-001, 4.494044e-001, 4.507644e-001, 4.521193e-001, 4.534728e-001, 4.548236e-001, 4.561721e-001, 4.575187e-001,
+4.588621e-001, 4.602044e-001, 4.615410e-001, 4.628766e-001, 4.642063e-001, 4.655351e-001, 4.668604e-001, 4.681833e-001, 4.695021e-001, 4.708178e-001,
+4.721299e-001, 4.734383e-001, 4.747439e-001, 4.760440e-001, 4.773412e-001, 4.786339e-001, 4.799247e-001, 4.812121e-001, 4.824983e-001, 4.837796e-001,
+4.850595e-001, 4.863343e-001, 4.876080e-001, 4.888751e-001, 4.901409e-001, 4.914004e-001, 4.926583e-001, 4.939117e-001, 4.951637e-001, 4.964102e-001,
+4.976546e-001, 4.988939e-001, 5.001305e-001, 5.013630e-001, 5.025923e-001, 5.038174e-001, 5.050378e-001, 5.062551e-001, 5.074667e-001, 5.086769e-001,
+5.098821e-001, 5.110869e-001, 5.122859e-001, 5.134848e-001, 5.146783e-001, 5.158712e-001, 5.170600e-001, 5.182472e-001, 5.194310e-001, 5.206112e-001,
+5.217892e-001, 5.229611e-001, 5.241327e-001, 5.252950e-001, 5.264572e-001, 5.276137e-001, 5.287684e-001, 5.299198e-001, 5.310675e-001, 5.322137e-001,
+5.333532e-001, 5.344926e-001, 5.356253e-001, 5.367569e-001, 5.378847e-001, 5.390092e-001, 5.401323e-001, 5.412485e-001, 5.423646e-001, 5.434735e-001,
+5.445804e-001, 5.456839e-001, 5.467820e-001, 5.478801e-001, 5.489701e-001, 5.500598e-001, 5.511455e-001, 5.522277e-001, 5.533092e-001, 5.543829e-001,
+5.554566e-001, 5.565248e-001, 5.575890e-001, 5.586525e-001, 5.597083e-001, 5.607640e-001, 5.618163e-001, 5.628660e-001, 5.639155e-001, 5.649582e-001,
+5.660010e-001, 5.670401e-001, 5.680750e-001, 5.691100e-001, 5.701386e-001, 5.711664e-001, 5.721925e-001, 5.732141e-001, 5.742358e-001, 5.752530e-001,
+5.762678e-001, 5.772826e-001, 5.782899e-001, 5.792972e-001, 5.803018e-001, 5.813008e-001, 5.822998e-001, 5.832932e-001, 5.842833e-001, 5.852734e-001,
+5.862563e-001, 5.872385e-001, 5.882192e-001, 5.891932e-001, 5.901671e-001, 5.911373e-001, 5.921025e-001, 5.930677e-001, 5.940269e-001, 5.949828e-001,
+5.959387e-001, 5.968865e-001, 5.978327e-001, 5.987788e-001, 5.997148e-001, 6.006507e-001, 6.015853e-001, 6.025123e-001, 6.034394e-001, 6.043639e-001,
+6.052819e-001, 6.061998e-001, 6.071143e-001, 6.080229e-001, 6.089316e-001, 6.098360e-001, 6.107352e-001, 6.116344e-001, 6.125288e-001, 6.134184e-001,
+6.143080e-001, 6.151924e-001, 6.160722e-001, 6.169519e-001, 6.178273e-001, 6.186988e-001, 6.195703e-001, 6.204383e-001, 6.213029e-001, 6.221675e-001,
+6.230289e-001, 6.238866e-001, 6.247443e-001, 6.255992e-001, 6.264499e-001, 6.273005e-001, 6.281492e-001, 6.289928e-001, 6.298365e-001, 6.306790e-001,
+6.315155e-001, 6.323520e-001, 6.331884e-001, 6.340178e-001, 6.348472e-001, 6.356766e-001, 6.365012e-001, 6.373250e-001, 6.381488e-001, 6.389691e-001,
+6.397874e-001, 6.406057e-001, 6.414218e-001, 6.422346e-001, 6.430474e-001, 6.438594e-001, 6.446668e-001, 6.454742e-001, 6.462816e-001, 6.470843e-001,
+6.478862e-001, 6.486881e-001, 6.494871e-001, 6.502836e-001, 6.510802e-001, 6.518756e-001, 6.526667e-001, 6.534578e-001, 6.542489e-001, 6.550366e-001,
+6.558237e-001, 6.566109e-001, 6.573962e-001, 6.581793e-001, 6.589624e-001, 6.597453e-001, 6.605246e-001, 6.613038e-001, 6.620831e-001, 6.628601e-001,
+6.636354e-001, 6.644108e-001, 6.651858e-001, 6.659575e-001, 6.667291e-001, 6.675008e-001, 6.682702e-001, 6.690382e-001, 6.698062e-001, 6.705740e-001,
+6.713399e-001, 6.721059e-001, 6.728718e-001, 6.736368e-001, 6.744008e-001, 6.751648e-001, 6.759288e-001, 6.766913e-001, 6.774536e-001, 6.782159e-001,
+6.789778e-001, 6.797384e-001, 6.804991e-001, 6.812598e-001, 6.820197e-001, 6.827789e-001, 6.835382e-001, 6.842974e-001, 6.850555e-001, 6.858135e-001,
+6.865715e-001, 6.873292e-001, 6.880861e-001, 6.888429e-001, 6.895998e-001, 6.903562e-001, 6.911120e-001, 6.918679e-001, 6.926237e-001, 6.933790e-001,
+6.941340e-001, 6.948890e-001, 6.956440e-001, 6.963984e-001, 6.971526e-001, 6.979069e-001, 6.986611e-001, 6.994134e-001, 7.001657e-001, 7.009179e-001,
+7.016699e-001, 7.024202e-001, 7.031704e-001, 7.039207e-001, 7.046705e-001, 7.054188e-001, 7.061672e-001, 7.069156e-001, 7.076634e-001, 7.084098e-001,
+7.091563e-001, 7.099028e-001, 7.106483e-001, 7.113917e-001, 7.121352e-001, 7.128786e-001, 7.136210e-001, 7.143614e-001, 7.151017e-001, 7.158420e-001,
+7.165814e-001, 7.173188e-001, 7.180561e-001, 7.187934e-001, 7.195300e-001, 7.202642e-001, 7.209984e-001, 7.217326e-001, 7.224665e-001, 7.231977e-001,
+7.239290e-001, 7.246602e-001, 7.253914e-001, 7.261209e-001, 7.268504e-001, 7.275799e-001, 7.283094e-001, 7.290376e-001, 7.297653e-001, 7.304931e-001,
+7.312208e-001, 7.319475e-001, 7.326734e-001, 7.333993e-001, 7.341252e-001, 7.348505e-001, 7.355745e-001, 7.362985e-001, 7.370226e-001, 7.377465e-001,
+7.384685e-001, 7.391905e-001, 7.399126e-001, 7.406346e-001, 7.413551e-001, 7.420752e-001, 7.427952e-001, 7.435152e-001, 7.442349e-001, 7.449540e-001,
+7.456731e-001, 7.463922e-001, 7.471113e-001, 7.478294e-001, 7.485475e-001, 7.492656e-001, 7.499837e-001, 7.507011e-001, 7.514180e-001, 7.521350e-001,
+7.528519e-001, 7.535687e-001, 7.542844e-001, 7.550001e-001, 7.557158e-001, 7.564315e-001, 7.571463e-001, 7.578606e-001, 7.585750e-001, 7.592893e-001,
+7.600035e-001, 7.607164e-001, 7.614293e-001, 7.621422e-001, 7.628551e-001, 7.635671e-001, 7.642785e-001, 7.649898e-001, 7.657011e-001, 7.664125e-001,
+7.671223e-001, 7.678320e-001, 7.685416e-001, 7.692513e-001, 7.699605e-001, 7.706684e-001, 7.713763e-001, 7.720842e-001, 7.727922e-001, 7.734990e-001,
+7.742050e-001, 7.749111e-001, 7.756171e-001, 7.763232e-001, 7.770275e-001, 7.777316e-001, 7.784357e-001, 7.791397e-001, 7.798436e-001, 7.805456e-001,
+7.812476e-001, 7.819496e-001, 7.826516e-001, 7.833529e-001, 7.840527e-001, 7.847525e-001, 7.854523e-001, 7.861521e-001, 7.868509e-001, 7.875484e-001,
+7.882459e-001, 7.889434e-001, 7.896409e-001, 7.903370e-001, 7.910321e-001, 7.917272e-001, 7.924223e-001, 7.931174e-001, 7.938109e-001, 7.945034e-001,
+7.951960e-001, 7.958885e-001, 7.965811e-001, 7.972719e-001, 7.979618e-001, 7.986517e-001, 7.993416e-001, 8.000316e-001, 8.007196e-001, 8.014068e-001,
+8.020940e-001, 8.027811e-001, 8.034683e-001, 8.041537e-001, 8.048380e-001, 8.055223e-001, 8.062066e-001, 8.068909e-001, 8.075737e-001, 8.082550e-001,
+8.089363e-001, 8.096177e-001, 8.102990e-001, 8.109787e-001, 8.116559e-001, 8.123331e-001, 8.130102e-001, 8.136874e-001, 8.143637e-001, 8.150367e-001,
+8.157097e-001, 8.163827e-001, 8.170557e-001, 8.177287e-001, 8.183974e-001, 8.190662e-001, 8.197349e-001, 8.204036e-001, 8.210723e-001, 8.217379e-001,
+8.224023e-001, 8.230667e-001, 8.237311e-001, 8.243955e-001, 8.250575e-001, 8.257162e-001, 8.263750e-001, 8.270337e-001, 8.276925e-001, 8.283507e-001,
+8.290039e-001, 8.296571e-001, 8.303104e-001, 8.309636e-001, 8.316168e-001, 8.322661e-001, 8.329137e-001, 8.335613e-001, 8.342089e-001, 8.348565e-001,
+8.355027e-001, 8.361449e-001, 8.367870e-001, 8.374292e-001, 8.380714e-001, 8.387135e-001, 8.393514e-001, 8.399881e-001, 8.406247e-001, 8.412614e-001,
+8.418981e-001, 8.425334e-001, 8.431647e-001, 8.437961e-001, 8.444274e-001, 8.450587e-001, 8.456900e-001, 8.463178e-001, 8.469437e-001, 8.475697e-001,
+8.481956e-001, 8.488216e-001, 8.494472e-001, 8.500669e-001, 8.506866e-001, 8.513063e-001, 8.519260e-001, 8.525457e-001, 8.531630e-001, 8.537764e-001,
+8.543899e-001, 8.550033e-001, 8.556168e-001, 8.562303e-001, 8.568397e-001, 8.574470e-001, 8.580544e-001, 8.586617e-001, 8.592691e-001, 8.598764e-001,
+8.604783e-001, 8.610796e-001, 8.616809e-001, 8.622822e-001, 8.628834e-001, 8.634842e-001, 8.640793e-001, 8.646745e-001, 8.652696e-001, 8.658648e-001,
+8.664600e-001, 8.670535e-001, 8.676418e-001, 8.682301e-001, 8.688184e-001, 8.694066e-001, 8.699949e-001, 8.705810e-001, 8.711626e-001, 8.717442e-001,
+8.723258e-001, 8.729074e-001, 8.734890e-001, 8.740683e-001, 8.746434e-001, 8.752185e-001, 8.757936e-001, 8.763688e-001, 8.769439e-001, 8.775168e-001,
+8.780856e-001, 8.786545e-001, 8.792233e-001, 8.797922e-001, 8.803611e-001, 8.809277e-001, 8.814893e-001, 8.820509e-001, 8.826125e-001, 8.831742e-001,
+8.837358e-001, 8.842961e-001, 8.848510e-001, 8.854060e-001, 8.859609e-001, 8.865159e-001, 8.870708e-001, 8.876255e-001, 8.881743e-001, 8.887230e-001,
+8.892717e-001, 8.898204e-001, 8.903692e-001, 8.909179e-001, 8.914617e-001, 8.920045e-001, 8.925474e-001, 8.930902e-001, 8.936330e-001, 8.941759e-001,
+8.947150e-001, 8.952515e-001, 8.957879e-001, 8.963244e-001, 8.968608e-001, 8.973972e-001, 8.979318e-001, 8.984611e-001, 8.989904e-001, 8.995197e-001,
+9.000490e-001, 9.005783e-001, 9.011075e-001, 9.016309e-001, 9.021536e-001, 9.026763e-001, 9.031989e-001, 9.037216e-001, 9.042443e-001, 9.047640e-001,
+9.052805e-001, 9.057971e-001, 9.063136e-001, 9.068301e-001, 9.073466e-001, 9.078631e-001, 9.083728e-001, 9.088826e-001, 9.093923e-001, 9.099021e-001,
+9.104118e-001, 9.109215e-001, 9.114278e-001, 9.119304e-001, 9.124331e-001, 9.129357e-001, 9.134383e-001, 9.139409e-001, 9.144436e-001, 9.149403e-001,
+9.154364e-001, 9.159326e-001, 9.164287e-001, 9.169249e-001, 9.174210e-001, 9.179155e-001, 9.184057e-001, 9.188959e-001, 9.193861e-001, 9.198763e-001,
+9.203665e-001, 9.208567e-001, 9.213432e-001, 9.218272e-001, 9.223111e-001, 9.227951e-001, 9.232790e-001, 9.237630e-001, 9.242469e-001, 9.247245e-001,
+9.252008e-001, 9.256771e-001, 9.261535e-001, 9.266298e-001, 9.271062e-001, 9.275822e-001, 9.280517e-001, 9.285211e-001, 9.289906e-001, 9.294601e-001,
+9.299296e-001, 9.303991e-001, 9.308673e-001, 9.313306e-001, 9.317938e-001, 9.322570e-001, 9.327202e-001, 9.331834e-001, 9.336466e-001, 9.341077e-001,
+9.345635e-001, 9.350193e-001, 9.354750e-001, 9.359308e-001, 9.363865e-001, 9.368423e-001, 9.372960e-001, 9.377451e-001, 9.381942e-001, 9.386432e-001,
+9.390923e-001, 9.395414e-001, 9.399905e-001, 9.404377e-001, 9.408801e-001, 9.413226e-001, 9.417650e-001, 9.422074e-001, 9.426498e-001, 9.430923e-001,
+9.435329e-001, 9.439660e-001, 9.443990e-001, 9.448321e-001, 9.452652e-001, 9.456983e-001, 9.461313e-001, 9.465639e-001, 9.469869e-001, 9.474099e-001,
+9.478329e-001, 9.482559e-001, 9.486789e-001, 9.491018e-001, 9.495248e-001, 9.499412e-001, 9.503563e-001, 9.507714e-001, 9.511866e-001, 9.516017e-001,
+9.520168e-001, 9.524320e-001, 9.528438e-001, 9.532533e-001, 9.536628e-001, 9.540723e-001, 9.544818e-001, 9.548913e-001, 9.553007e-001, 9.557087e-001,
+9.561120e-001, 9.565154e-001, 9.569187e-001, 9.573221e-001, 9.577255e-001, 9.581288e-001, 9.585322e-001, 9.589299e-001, 9.593268e-001, 9.597237e-001,
+9.601205e-001, 9.605174e-001, 9.609143e-001, 9.613112e-001, 9.617048e-001, 9.620940e-001, 9.624832e-001, 9.628724e-001, 9.632616e-001, 9.636509e-001,
+9.640401e-001, 9.644293e-001, 9.648113e-001, 9.651927e-001, 9.655741e-001, 9.659555e-001, 9.663369e-001, 9.667183e-001, 9.670996e-001, 9.674783e-001,
+9.678518e-001, 9.682253e-001, 9.685988e-001, 9.689723e-001, 9.693458e-001, 9.697192e-001, 9.700927e-001, 9.704606e-001, 9.708261e-001, 9.711916e-001,
+9.715571e-001, 9.719227e-001, 9.722882e-001, 9.726537e-001, 9.730191e-001, 9.733765e-001, 9.737339e-001, 9.740913e-001, 9.744487e-001, 9.748061e-001,
+9.751635e-001, 9.755209e-001, 9.758762e-001, 9.762253e-001, 9.765743e-001, 9.769234e-001, 9.772724e-001, 9.776215e-001, 9.779705e-001, 9.783196e-001,
+9.786649e-001, 9.790050e-001, 9.793451e-001, 9.796852e-001, 9.800254e-001, 9.803655e-001, 9.807056e-001, 9.810457e-001, 9.813809e-001, 9.817117e-001,
+9.820425e-001, 9.823733e-001, 9.827041e-001, 9.830349e-001, 9.833657e-001, 9.836965e-001, 9.840217e-001, 9.843426e-001, 9.846635e-001, 9.849844e-001,
+9.853054e-001, 9.856263e-001, 9.859472e-001, 9.862681e-001, 9.865830e-001, 9.868930e-001, 9.872030e-001, 9.875130e-001, 9.878229e-001, 9.881329e-001,
+9.884429e-001, 9.887529e-001, 9.890568e-001, 9.893537e-001, 9.896506e-001, 9.899475e-001, 9.902444e-001, 9.905413e-001, 9.908382e-001, 9.911351e-001,
+9.914277e-001, 9.917106e-001, 9.919934e-001, 9.922763e-001, 9.925592e-001, 9.928421e-001, 9.931250e-001, 9.934079e-001, 9.936896e-001, 9.939588e-001,
+9.942279e-001, 9.944971e-001, 9.947662e-001, 9.950354e-001, 9.953046e-001, 9.955737e-001, 9.958429e-001, 9.960997e-001, 9.963533e-001, 9.966069e-001,
+9.968605e-001, 9.971140e-001, 9.973676e-001, 9.976212e-001, 9.978748e-001, 9.981204e-001, 9.983553e-001, 9.985903e-001, 9.988252e-001, 9.990602e-001,
+9.992951e-001, 9.995301e-001, 9.997650e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Vista 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.821015e-002, 3.216497e-002, 4.353278e-002, 5.356165e-002, 6.276196e-002, 7.138072e-002, 7.958894e-002, 8.747495e-002, 9.513983e-002,
+1.026330e-001, 1.098784e-001, 1.168457e-001, 1.235098e-001, 1.299059e-001, 1.360471e-001, 1.419680e-001, 1.476962e-001, 1.532528e-001, 1.586500e-001,
+1.639095e-001, 1.690365e-001, 1.740324e-001, 1.789165e-001, 1.836924e-001, 1.883690e-001, 1.929446e-001, 1.974375e-001, 2.018468e-001, 2.061870e-001,
+2.104455e-001, 2.146379e-001, 2.187690e-001, 2.228458e-001, 2.268676e-001, 2.308367e-001, 2.347574e-001, 2.386283e-001, 2.424549e-001, 2.462375e-001,
+2.499750e-001, 2.536738e-001, 2.573331e-001, 2.609580e-001, 2.645516e-001, 2.681076e-001, 2.716294e-001, 2.751240e-001, 2.785834e-001, 2.820093e-001,
+2.854062e-001, 2.887754e-001, 2.921055e-001, 2.953915e-001, 2.986360e-001, 3.018450e-001, 3.050136e-001, 3.081485e-001, 3.112492e-001, 3.143157e-001,
+3.173457e-001, 3.203402e-001, 3.232953e-001, 3.262135e-001, 3.290932e-001, 3.319376e-001, 3.347463e-001, 3.375193e-001, 3.402612e-001, 3.429714e-001,
+3.456539e-001, 3.483097e-001, 3.509394e-001, 3.535420e-001, 3.561150e-001, 3.586608e-001, 3.611788e-001, 3.636739e-001, 3.661472e-001, 3.686018e-001,
+3.710422e-001, 3.734661e-001, 3.758764e-001, 3.782708e-001, 3.806519e-001, 3.830182e-001, 3.853709e-001, 3.877105e-001, 3.900357e-001, 3.923486e-001,
+3.946483e-001, 3.969349e-001, 3.992097e-001, 4.014719e-001, 4.037215e-001, 4.059597e-001, 4.081868e-001, 4.103969e-001, 4.125917e-001, 4.147718e-001,
+4.169346e-001, 4.190779e-001, 4.212022e-001, 4.233099e-001, 4.254015e-001, 4.274777e-001, 4.295392e-001, 4.315859e-001, 4.336147e-001, 4.356272e-001,
+4.376242e-001, 4.396048e-001, 4.415675e-001, 4.435133e-001, 4.454412e-001, 4.473509e-001, 4.492435e-001, 4.511202e-001, 4.529820e-001, 4.548301e-001,
+4.566623e-001, 4.584765e-001, 4.602738e-001, 4.620555e-001, 4.638230e-001, 4.655745e-001, 4.673085e-001, 4.690262e-001, 4.707291e-001, 4.724188e-001,
+4.740945e-001, 4.757551e-001, 4.774011e-001, 4.790341e-001, 4.806557e-001, 4.822665e-001, 4.838630e-001, 4.854428e-001, 4.870089e-001, 4.885636e-001,
+4.901061e-001, 4.916355e-001, 4.931512e-001, 4.946528e-001, 4.961409e-001, 4.976170e-001, 4.990841e-001, 5.005418e-001, 5.019898e-001, 5.034281e-001,
+5.048564e-001, 5.062754e-001, 5.076872e-001, 5.090919e-001, 5.104893e-001, 5.118766e-001, 5.132549e-001, 5.146262e-001, 5.159910e-001, 5.173476e-001,
+5.186926e-001, 5.200299e-001, 5.213603e-001, 5.226839e-001, 5.240020e-001, 5.253159e-001, 5.266253e-001, 5.279287e-001, 5.292261e-001, 5.305186e-001,
+5.318061e-001, 5.330879e-001, 5.343660e-001, 5.356403e-001, 5.369089e-001, 5.381723e-001, 5.394317e-001, 5.406854e-001, 5.419326e-001, 5.431753e-001,
+5.444123e-001, 5.456442e-001, 5.468729e-001, 5.480973e-001, 5.493161e-001, 5.505314e-001, 5.517416e-001, 5.529458e-001, 5.541469e-001, 5.553440e-001,
+5.565373e-001, 5.577278e-001, 5.589103e-001, 5.600882e-001, 5.612616e-001, 5.624287e-001, 5.635940e-001, 5.647562e-001, 5.659151e-001, 5.670722e-001,
+5.682216e-001, 5.693680e-001, 5.705093e-001, 5.716464e-001, 5.727817e-001, 5.739136e-001, 5.750434e-001, 5.761688e-001, 5.772884e-001, 5.784045e-001,
+5.795143e-001, 5.806227e-001, 5.817271e-001, 5.828295e-001, 5.839291e-001, 5.850237e-001, 5.861157e-001, 5.872008e-001, 5.882845e-001, 5.893630e-001,
+5.904406e-001, 5.915157e-001, 5.925881e-001, 5.936570e-001, 5.947207e-001, 5.957809e-001, 5.968361e-001, 5.978895e-001, 5.989391e-001, 5.999881e-001,
+6.010324e-001, 6.020760e-001, 6.031130e-001, 6.041488e-001, 6.051783e-001, 6.062066e-001, 6.072308e-001, 6.082535e-001, 6.092722e-001, 6.102892e-001,
+6.113023e-001, 6.123135e-001, 6.133209e-001, 6.143263e-001, 6.153278e-001, 6.163274e-001, 6.173228e-001, 6.183164e-001, 6.193057e-001, 6.202934e-001,
+6.212764e-001, 6.222583e-001, 6.232348e-001, 6.242107e-001, 6.251806e-001, 6.261505e-001, 6.271139e-001, 6.280771e-001, 6.290365e-001, 6.299953e-001,
+6.309507e-001, 6.319050e-001, 6.328564e-001, 6.338058e-001, 6.347532e-001, 6.356977e-001, 6.366410e-001, 6.375805e-001, 6.385199e-001, 6.394542e-001,
+6.403885e-001, 6.413171e-001, 6.422441e-001, 6.431670e-001, 6.440865e-001, 6.450045e-001, 6.459187e-001, 6.468328e-001, 6.477437e-001, 6.486547e-001,
+6.495618e-001, 6.504673e-001, 6.513700e-001, 6.522680e-001, 6.531658e-001, 6.540583e-001, 6.549509e-001, 6.558412e-001, 6.567304e-001, 6.576180e-001,
+6.585017e-001, 6.593855e-001, 6.602624e-001, 6.611386e-001, 6.620121e-001, 6.628827e-001, 6.637531e-001, 6.646183e-001, 6.654835e-001, 6.663444e-001,
+6.672022e-001, 6.680592e-001, 6.689095e-001, 6.697599e-001, 6.706070e-001, 6.714520e-001, 6.722967e-001, 6.731383e-001, 6.739799e-001, 6.748196e-001,
+6.756578e-001, 6.764960e-001, 6.773291e-001, 6.781620e-001, 6.789928e-001, 6.798205e-001, 6.806482e-001, 6.814717e-001, 6.822942e-001, 6.831157e-001,
+6.839331e-001, 6.847505e-001, 6.855652e-001, 6.863775e-001, 6.871898e-001, 6.879963e-001, 6.888018e-001, 6.896062e-001, 6.904050e-001, 6.912038e-001,
+6.920004e-001, 6.927945e-001, 6.935886e-001, 6.943795e-001, 6.951691e-001, 6.959588e-001, 6.967442e-001, 6.975293e-001, 6.983138e-001, 6.990945e-001,
+6.998751e-001, 7.006543e-001, 7.014307e-001, 7.022071e-001, 7.029812e-001, 7.037534e-001, 7.045255e-001, 7.052935e-001, 7.060596e-001, 7.068256e-001,
+7.075870e-001, 7.083472e-001, 7.091074e-001, 7.098641e-001, 7.106204e-001, 7.113767e-001, 7.121276e-001, 7.128784e-001, 7.136289e-001, 7.143725e-001,
+7.151161e-001, 7.158594e-001, 7.165976e-001, 7.173359e-001, 7.180739e-001, 7.188073e-001, 7.195406e-001, 7.202738e-001, 7.210024e-001, 7.217310e-001,
+7.224596e-001, 7.231837e-001, 7.239078e-001, 7.246319e-001, 7.253506e-001, 7.260688e-001, 7.267870e-001, 7.275005e-001, 7.282129e-001, 7.289254e-001,
+7.296341e-001, 7.303412e-001, 7.310483e-001, 7.317517e-001, 7.324520e-001, 7.331522e-001, 7.338507e-001, 7.345461e-001, 7.352415e-001, 7.359364e-001,
+7.366289e-001, 7.373213e-001, 7.380138e-001, 7.387021e-001, 7.393901e-001, 7.400781e-001, 7.407632e-001, 7.414470e-001, 7.421307e-001, 7.428128e-001,
+7.434925e-001, 7.441722e-001, 7.448516e-001, 7.455275e-001, 7.462034e-001, 7.468794e-001, 7.475526e-001, 7.482251e-001, 7.488975e-001, 7.495680e-001,
+7.502355e-001, 7.509030e-001, 7.515705e-001, 7.522333e-001, 7.528960e-001, 7.535588e-001, 7.542191e-001, 7.548775e-001, 7.555359e-001, 7.561936e-001,
+7.568461e-001, 7.574987e-001, 7.581513e-001, 7.588003e-001, 7.594473e-001, 7.600943e-001, 7.607408e-001, 7.613841e-001, 7.620275e-001, 7.626709e-001,
+7.633123e-001, 7.639524e-001, 7.645925e-001, 7.652325e-001, 7.658681e-001, 7.665036e-001, 7.671392e-001, 7.677729e-001, 7.684043e-001, 7.690357e-001,
+7.696671e-001, 7.702954e-001, 7.709229e-001, 7.715505e-001, 7.721772e-001, 7.727997e-001, 7.734222e-001, 7.740447e-001, 7.746650e-001, 7.752827e-001,
+7.759005e-001, 7.765183e-001, 7.771327e-001, 7.777461e-001, 7.783595e-001, 7.789728e-001, 7.795792e-001, 7.801856e-001, 7.807920e-001, 7.813968e-001,
+7.819966e-001, 7.825964e-001, 7.831961e-001, 7.837939e-001, 7.843888e-001, 7.849838e-001, 7.855788e-001, 7.861705e-001, 7.867597e-001, 7.873489e-001,
+7.879382e-001, 7.885247e-001, 7.891102e-001, 7.896956e-001, 7.902810e-001, 7.908638e-001, 7.914459e-001, 7.920280e-001, 7.926100e-001, 7.931870e-001,
+7.937633e-001, 7.943395e-001, 7.949158e-001, 7.954885e-001, 7.960608e-001, 7.966331e-001, 7.972054e-001, 7.977746e-001, 7.983435e-001, 7.989124e-001,
+7.994813e-001, 8.000450e-001, 8.006080e-001, 8.011709e-001, 8.017339e-001, 8.022924e-001, 8.028498e-001, 8.034073e-001, 8.039647e-001, 8.045187e-001,
+8.050712e-001, 8.056237e-001, 8.061762e-001, 8.067255e-001, 8.072722e-001, 8.078189e-001, 8.083656e-001, 8.089102e-001, 8.094516e-001, 8.099929e-001,
+8.105342e-001, 8.110747e-001, 8.116113e-001, 8.121479e-001, 8.126845e-001, 8.132211e-001, 8.137524e-001, 8.142833e-001, 8.148142e-001, 8.153451e-001,
+8.158726e-001, 8.163983e-001, 8.169240e-001, 8.174497e-001, 8.179738e-001, 8.184949e-001, 8.190160e-001, 8.195371e-001, 8.200583e-001, 8.205738e-001,
+8.210893e-001, 8.216049e-001, 8.221204e-001, 8.226320e-001, 8.231411e-001, 8.236501e-001, 8.241592e-001, 8.246672e-001, 8.251705e-001, 8.256738e-001,
+8.261770e-001, 8.266803e-001, 8.271808e-001, 8.276803e-001, 8.281797e-001, 8.286792e-001, 8.291776e-001, 8.296724e-001, 8.301672e-001, 8.306620e-001,
+8.311568e-001, 8.316488e-001, 8.321395e-001, 8.326303e-001, 8.331211e-001, 8.336115e-001, 8.341002e-001, 8.345889e-001, 8.350775e-001, 8.355662e-001,
+8.360526e-001, 8.365371e-001, 8.370215e-001, 8.375060e-001, 8.379905e-001, 8.384706e-001, 8.389502e-001, 8.394297e-001, 8.399093e-001, 8.403882e-001,
+8.408649e-001, 8.413415e-001, 8.418181e-001, 8.422947e-001, 8.427696e-001, 8.432426e-001, 8.437157e-001, 8.441887e-001, 8.446618e-001, 8.451317e-001,
+8.456005e-001, 8.460692e-001, 8.465380e-001, 8.470067e-001, 8.474733e-001, 8.479397e-001, 8.484061e-001, 8.488725e-001, 8.493387e-001, 8.498021e-001,
+8.502655e-001, 8.507289e-001, 8.511923e-001, 8.516547e-001, 8.521132e-001, 8.525716e-001, 8.530301e-001, 8.534886e-001, 8.539462e-001, 8.544016e-001,
+8.548571e-001, 8.553126e-001, 8.557680e-001, 8.562228e-001, 8.566759e-001, 8.571290e-001, 8.575822e-001, 8.580353e-001, 8.584871e-001, 8.589360e-001,
+8.593849e-001, 8.598338e-001, 8.602827e-001, 8.607307e-001, 8.611760e-001, 8.616213e-001, 8.620667e-001, 8.625120e-001, 8.629568e-001, 8.633992e-001,
+8.638417e-001, 8.642841e-001, 8.647266e-001, 8.651688e-001, 8.656079e-001, 8.660469e-001, 8.664859e-001, 8.669250e-001, 8.673640e-001, 8.677996e-001,
+8.682347e-001, 8.686698e-001, 8.691048e-001, 8.695399e-001, 8.699729e-001, 8.704048e-001, 8.708366e-001, 8.712685e-001, 8.717003e-001, 8.721307e-001,
+8.725587e-001, 8.729868e-001, 8.734149e-001, 8.738429e-001, 8.742705e-001, 8.746943e-001, 8.751180e-001, 8.755417e-001, 8.759655e-001, 8.763892e-001,
+8.768101e-001, 8.772302e-001, 8.776502e-001, 8.780703e-001, 8.784903e-001, 8.789088e-001, 8.793247e-001, 8.797406e-001, 8.801565e-001, 8.805723e-001,
+8.809882e-001, 8.814009e-001, 8.818134e-001, 8.822259e-001, 8.826383e-001, 8.830508e-001, 8.834620e-001, 8.838718e-001, 8.842815e-001, 8.846912e-001,
+8.851009e-001, 8.855107e-001, 8.859174e-001, 8.863239e-001, 8.867304e-001, 8.871370e-001, 8.875435e-001, 8.879491e-001, 8.883531e-001, 8.887570e-001,
+8.891610e-001, 8.895650e-001, 8.899690e-001, 8.903708e-001, 8.907717e-001, 8.911727e-001, 8.915737e-001, 8.919747e-001, 8.923754e-001, 8.927730e-001,
+8.931706e-001, 8.935681e-001, 8.939657e-001, 8.943632e-001, 8.947598e-001, 8.951545e-001, 8.955492e-001, 8.959440e-001, 8.963387e-001, 8.967334e-001,
+8.971261e-001, 8.975175e-001, 8.979090e-001, 8.983004e-001, 8.986918e-001, 8.990832e-001, 8.994716e-001, 8.998593e-001, 9.002470e-001, 9.006347e-001,
+9.010224e-001, 9.014101e-001, 9.017949e-001, 9.021795e-001, 9.025642e-001, 9.029488e-001, 9.033335e-001, 9.037180e-001, 9.041003e-001, 9.044826e-001,
+9.048648e-001, 9.052471e-001, 9.056294e-001, 9.060113e-001, 9.063897e-001, 9.067682e-001, 9.071466e-001, 9.075250e-001, 9.079035e-001, 9.082816e-001,
+9.086569e-001, 9.090322e-001, 9.094075e-001, 9.097827e-001, 9.101580e-001, 9.105333e-001, 9.109072e-001, 9.112812e-001, 9.116551e-001, 9.120291e-001,
+9.124030e-001, 9.127770e-001, 9.131483e-001, 9.135194e-001, 9.138906e-001, 9.142617e-001, 9.146328e-001, 9.150040e-001, 9.153717e-001, 9.157385e-001,
+9.161053e-001, 9.164721e-001, 9.168389e-001, 9.172058e-001, 9.175711e-001, 9.179354e-001, 9.182997e-001, 9.186640e-001, 9.190283e-001, 9.193926e-001,
+9.197563e-001, 9.201188e-001, 9.204813e-001, 9.208438e-001, 9.212063e-001, 9.215688e-001, 9.219312e-001, 9.222894e-001, 9.226476e-001, 9.230058e-001,
+9.233640e-001, 9.237222e-001, 9.240803e-001, 9.244369e-001, 9.247925e-001, 9.251482e-001, 9.255039e-001, 9.258596e-001, 9.262153e-001, 9.265708e-001,
+9.269257e-001, 9.272807e-001, 9.276356e-001, 9.279906e-001, 9.283455e-001, 9.287005e-001, 9.290529e-001, 9.294047e-001, 9.297564e-001, 9.301082e-001,
+9.304599e-001, 9.308117e-001, 9.311625e-001, 9.315107e-001, 9.318588e-001, 9.322070e-001, 9.325552e-001, 9.329034e-001, 9.332516e-001, 9.335985e-001,
+9.339449e-001, 9.342912e-001, 9.346376e-001, 9.349840e-001, 9.353304e-001, 9.356766e-001, 9.360208e-001, 9.363651e-001, 9.367093e-001, 9.370536e-001,
+9.373978e-001, 9.377421e-001, 9.380850e-001, 9.384258e-001, 9.387665e-001, 9.391073e-001, 9.394481e-001, 9.397889e-001, 9.401297e-001, 9.404694e-001,
+9.408085e-001, 9.411476e-001, 9.414866e-001, 9.418257e-001, 9.421648e-001, 9.425039e-001, 9.428421e-001, 9.431802e-001, 9.435183e-001, 9.438564e-001,
+9.441945e-001, 9.445326e-001, 9.448707e-001, 9.452054e-001, 9.455402e-001, 9.458749e-001, 9.462096e-001, 9.465444e-001, 9.468791e-001, 9.472136e-001,
+9.475457e-001, 9.478777e-001, 9.482098e-001, 9.485419e-001, 9.488740e-001, 9.492060e-001, 9.495380e-001, 9.498691e-001, 9.502003e-001, 9.505314e-001,
+9.508626e-001, 9.511937e-001, 9.515248e-001, 9.518557e-001, 9.521846e-001, 9.525136e-001, 9.528425e-001, 9.531714e-001, 9.535003e-001, 9.538292e-001,
+9.541580e-001, 9.544816e-001, 9.548052e-001, 9.551288e-001, 9.554524e-001, 9.557759e-001, 9.560995e-001, 9.564231e-001, 9.567416e-001, 9.570595e-001,
+9.573773e-001, 9.576952e-001, 9.580131e-001, 9.583310e-001, 9.586488e-001, 9.589643e-001, 9.592787e-001, 9.595931e-001, 9.599076e-001, 9.602220e-001,
+9.605364e-001, 9.608508e-001, 9.611637e-001, 9.614748e-001, 9.617858e-001, 9.620968e-001, 9.624078e-001, 9.627188e-001, 9.630298e-001, 9.633405e-001,
+9.636486e-001, 9.639568e-001, 9.642650e-001, 9.645731e-001, 9.648813e-001, 9.651894e-001, 9.654976e-001, 9.658040e-001, 9.661098e-001, 9.664155e-001,
+9.667213e-001, 9.670271e-001, 9.673329e-001, 9.676386e-001, 9.679433e-001, 9.682455e-001, 9.685477e-001, 9.688499e-001, 9.691521e-001, 9.694543e-001,
+9.697565e-001, 9.700587e-001, 9.703578e-001, 9.706562e-001, 9.709546e-001, 9.712529e-001, 9.715513e-001, 9.718497e-001, 9.721480e-001, 9.724456e-001,
+9.727406e-001, 9.730356e-001, 9.733307e-001, 9.736257e-001, 9.739207e-001, 9.742157e-001, 9.745107e-001, 9.748036e-001, 9.750950e-001, 9.753864e-001,
+9.756778e-001, 9.759692e-001, 9.762606e-001, 9.765521e-001, 9.768435e-001, 9.771314e-001, 9.774191e-001, 9.777067e-001, 9.779943e-001, 9.782820e-001,
+9.785696e-001, 9.788573e-001, 9.791443e-001, 9.794282e-001, 9.797121e-001, 9.799959e-001, 9.802798e-001, 9.805637e-001, 9.808476e-001, 9.811315e-001,
+9.814138e-001, 9.816933e-001, 9.819728e-001, 9.822523e-001, 9.825318e-001, 9.828113e-001, 9.830908e-001, 9.833703e-001, 9.836477e-001, 9.839227e-001,
+9.841977e-001, 9.844727e-001, 9.847477e-001, 9.850227e-001, 9.852976e-001, 9.855726e-001, 9.858452e-001, 9.861155e-001, 9.863858e-001, 9.866562e-001,
+9.869265e-001, 9.871968e-001, 9.874671e-001, 9.877374e-001, 9.880046e-001, 9.882686e-001, 9.885327e-001, 9.887967e-001, 9.890608e-001, 9.893248e-001,
+9.895889e-001, 9.898529e-001, 9.901142e-001, 9.903719e-001, 9.906295e-001, 9.908872e-001, 9.911448e-001, 9.914024e-001, 9.916601e-001, 9.919177e-001,
+9.921736e-001, 9.924249e-001, 9.926763e-001, 9.929276e-001, 9.931789e-001, 9.934303e-001, 9.936816e-001, 9.939329e-001, 9.941837e-001, 9.944264e-001,
+9.946690e-001, 9.949116e-001, 9.951542e-001, 9.953969e-001, 9.956395e-001, 9.958821e-001, 9.961247e-001, 9.963589e-001, 9.965907e-001, 9.968225e-001,
+9.970543e-001, 9.972860e-001, 9.975178e-001, 9.977496e-001, 9.979814e-001, 9.982098e-001, 9.984335e-001, 9.986573e-001, 9.988811e-001, 9.991049e-001,
+9.993287e-001, 9.995524e-001, 9.997762e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.790959e-002, 3.267138e-002, 4.454005e-002, 5.491069e-002, 6.431094e-002, 7.305277e-002, 8.126630e-002, 8.906298e-002, 9.653530e-002,
+1.037215e-001, 1.106367e-001, 1.172993e-001, 1.237140e-001, 1.299184e-001, 1.359219e-001, 1.417498e-001, 1.474112e-001, 1.529219e-001, 1.582891e-001,
+1.635248e-001, 1.686292e-001, 1.736202e-001, 1.784921e-001, 1.832599e-001, 1.879282e-001, 1.924999e-001, 1.969809e-001, 2.013725e-001, 2.056811e-001,
+2.099132e-001, 2.140665e-001, 2.181412e-001, 2.221458e-001, 2.260930e-001, 2.299744e-001, 2.337979e-001, 2.375611e-001, 2.412584e-001, 2.449043e-001,
+2.485097e-001, 2.520638e-001, 2.555653e-001, 2.590113e-001, 2.624117e-001, 2.657626e-001, 2.690761e-001, 2.723546e-001, 2.755966e-001, 2.787989e-001,
+2.819636e-001, 2.850887e-001, 2.881691e-001, 2.912029e-001, 2.941967e-001, 2.971539e-001, 3.000778e-001, 3.029662e-001, 3.058190e-001, 3.086351e-001,
+3.114137e-001, 3.141574e-001, 3.168714e-001, 3.195553e-001, 3.222120e-001, 3.248480e-001, 3.274634e-001, 3.300593e-001, 3.326362e-001, 3.351946e-001,
+3.377344e-001, 3.402554e-001, 3.427593e-001, 3.452465e-001, 3.477157e-001, 3.501691e-001, 3.526061e-001, 3.550267e-001, 3.574325e-001, 3.598220e-001,
+3.621950e-001, 3.645453e-001, 3.668780e-001, 3.691842e-001, 3.714687e-001, 3.737291e-001, 3.759690e-001, 3.781891e-001, 3.803892e-001, 3.825727e-001,
+3.847386e-001, 3.868887e-001, 3.890220e-001, 3.911360e-001, 3.932319e-001, 3.953123e-001, 3.973783e-001, 3.994235e-001, 4.014526e-001, 4.034663e-001,
+4.054656e-001, 4.074514e-001, 4.094235e-001, 4.113812e-001, 4.133257e-001, 4.152583e-001, 4.171769e-001, 4.190814e-001, 4.209739e-001, 4.228564e-001,
+4.247288e-001, 4.265901e-001, 4.284402e-001, 4.302783e-001, 4.321058e-001, 4.339240e-001, 4.357284e-001, 4.375185e-001, 4.392957e-001, 4.410579e-001,
+4.428067e-001, 4.445428e-001, 4.462682e-001, 4.479799e-001, 4.496807e-001, 4.513706e-001, 4.530492e-001, 4.547171e-001, 4.563762e-001, 4.580254e-001,
+4.596652e-001, 4.612968e-001, 4.629196e-001, 4.645323e-001, 4.661348e-001, 4.677280e-001, 4.693110e-001, 4.708837e-001, 4.724482e-001, 4.740058e-001,
+4.755556e-001, 4.770967e-001, 4.786293e-001, 4.801545e-001, 4.816706e-001, 4.831783e-001, 4.846773e-001, 4.861674e-001, 4.876480e-001, 4.891190e-001,
+4.905794e-001, 4.920318e-001, 4.934778e-001, 4.949184e-001, 4.963541e-001, 4.977798e-001, 4.991960e-001, 5.006047e-001, 5.020067e-001, 5.034022e-001,
+5.047917e-001, 5.061760e-001, 5.075541e-001, 5.089236e-001, 5.102842e-001, 5.116396e-001, 5.129901e-001, 5.143332e-001, 5.156681e-001, 5.169964e-001,
+5.183183e-001, 5.196315e-001, 5.209390e-001, 5.222412e-001, 5.235363e-001, 5.248249e-001, 5.261075e-001, 5.273812e-001, 5.286463e-001, 5.299065e-001,
+5.311611e-001, 5.324099e-001, 5.336548e-001, 5.348948e-001, 5.361279e-001, 5.373570e-001, 5.385805e-001, 5.397964e-001, 5.410084e-001, 5.422149e-001,
+5.434154e-001, 5.446121e-001, 5.458010e-001, 5.469863e-001, 5.481684e-001, 5.493460e-001, 5.505208e-001, 5.516902e-001, 5.528520e-001, 5.540100e-001,
+5.551596e-001, 5.563063e-001, 5.574490e-001, 5.585880e-001, 5.597252e-001, 5.608549e-001, 5.619807e-001, 5.630995e-001, 5.642124e-001, 5.653223e-001,
+5.664257e-001, 5.675272e-001, 5.686224e-001, 5.697142e-001, 5.708016e-001, 5.718853e-001, 5.729673e-001, 5.740441e-001, 5.751196e-001, 5.761870e-001,
+5.772519e-001, 5.783104e-001, 5.793657e-001, 5.804173e-001, 5.814661e-001, 5.825131e-001, 5.835544e-001, 5.845939e-001, 5.856246e-001, 5.866542e-001,
+5.876761e-001, 5.886974e-001, 5.897136e-001, 5.907286e-001, 5.917387e-001, 5.927468e-001, 5.937488e-001, 5.947482e-001, 5.957416e-001, 5.967329e-001,
+5.977199e-001, 5.987045e-001, 5.996845e-001, 6.006622e-001, 6.016356e-001, 6.026067e-001, 6.035735e-001, 6.045382e-001, 6.054980e-001, 6.064559e-001,
+6.074083e-001, 6.083594e-001, 6.093046e-001, 6.102493e-001, 6.111895e-001, 6.121297e-001, 6.130650e-001, 6.140003e-001, 6.149288e-001, 6.158563e-001,
+6.167783e-001, 6.176984e-001, 6.186152e-001, 6.195300e-001, 6.204434e-001, 6.213549e-001, 6.222651e-001, 6.231712e-001, 6.240771e-001, 6.249756e-001,
+6.258741e-001, 6.267683e-001, 6.276613e-001, 6.285513e-001, 6.294387e-001, 6.303241e-001, 6.312044e-001, 6.320846e-001, 6.329575e-001, 6.338304e-001,
+6.346996e-001, 6.355672e-001, 6.364326e-001, 6.372947e-001, 6.381565e-001, 6.390134e-001, 6.398702e-001, 6.407238e-001, 6.415759e-001, 6.424264e-001,
+6.432735e-001, 6.441206e-001, 6.449629e-001, 6.458048e-001, 6.466443e-001, 6.474814e-001, 6.483182e-001, 6.491507e-001, 6.499833e-001, 6.508117e-001,
+6.516374e-001, 6.524623e-001, 6.532815e-001, 6.541007e-001, 6.549172e-001, 6.557320e-001, 6.565462e-001, 6.573549e-001, 6.581636e-001, 6.589679e-001,
+6.597688e-001, 6.605696e-001, 6.613647e-001, 6.621597e-001, 6.629532e-001, 6.637446e-001, 6.645359e-001, 6.653245e-001, 6.661125e-001, 6.668994e-001,
+6.676817e-001, 6.684640e-001, 6.692435e-001, 6.700205e-001, 6.707976e-001, 6.715717e-001, 6.723455e-001, 6.731184e-001, 6.738872e-001, 6.746561e-001,
+6.754218e-001, 6.761841e-001, 6.769463e-001, 6.777051e-001, 6.784627e-001, 6.792202e-001, 6.799734e-001, 6.807263e-001, 6.814782e-001, 6.822254e-001,
+6.829725e-001, 6.837175e-001, 6.844588e-001, 6.852000e-001, 6.859382e-001, 6.866738e-001, 6.874093e-001, 6.881412e-001, 6.888714e-001, 6.896017e-001,
+6.903280e-001, 6.910534e-001, 6.917788e-001, 6.924982e-001, 6.932170e-001, 6.939358e-001, 6.946483e-001, 6.953608e-001, 6.960731e-001, 6.967815e-001,
+6.974899e-001, 6.981981e-001, 6.989028e-001, 6.996076e-001, 7.003121e-001, 7.010132e-001, 7.017143e-001, 7.024151e-001, 7.031126e-001, 7.038100e-001,
+7.045074e-001, 7.052017e-001, 7.058959e-001, 7.065901e-001, 7.072818e-001, 7.079733e-001, 7.086648e-001, 7.093525e-001, 7.100394e-001, 7.107263e-001,
+7.114103e-001, 7.120930e-001, 7.127758e-001, 7.134565e-001, 7.141356e-001, 7.148147e-001, 7.154917e-001, 7.161653e-001, 7.168390e-001, 7.175116e-001,
+7.181802e-001, 7.188488e-001, 7.195173e-001, 7.201829e-001, 7.208484e-001, 7.215139e-001, 7.221763e-001, 7.228374e-001, 7.234985e-001, 7.241571e-001,
+7.248124e-001, 7.254677e-001, 7.261225e-001, 7.267740e-001, 7.274255e-001, 7.280769e-001, 7.287256e-001, 7.293734e-001, 7.300212e-001, 7.306672e-001,
+7.313105e-001, 7.319537e-001, 7.325969e-001, 7.332358e-001, 7.338747e-001, 7.345136e-001, 7.351500e-001, 7.357847e-001, 7.364194e-001, 7.370533e-001,
+7.376829e-001, 7.383125e-001, 7.389421e-001, 7.395685e-001, 7.401931e-001, 7.408178e-001, 7.414418e-001, 7.420617e-001, 7.426816e-001, 7.433015e-001,
+7.439180e-001, 7.445324e-001, 7.451467e-001, 7.457608e-001, 7.463697e-001, 7.469786e-001, 7.475875e-001, 7.481940e-001, 7.487976e-001, 7.494012e-001,
+7.500049e-001, 7.506046e-001, 7.512035e-001, 7.518025e-001, 7.524009e-001, 7.529972e-001, 7.535934e-001, 7.541896e-001, 7.547839e-001, 7.553763e-001,
+7.559687e-001, 7.565611e-001, 7.571497e-001, 7.577373e-001, 7.583248e-001, 7.589122e-001, 7.594967e-001, 7.600812e-001, 7.606657e-001, 7.612492e-001,
+7.618297e-001, 7.624102e-001, 7.629907e-001, 7.635690e-001, 7.641444e-001, 7.647198e-001, 7.652952e-001, 7.658686e-001, 7.664408e-001, 7.670129e-001,
+7.675851e-001, 7.681542e-001, 7.687221e-001, 7.692901e-001, 7.698580e-001, 7.704229e-001, 7.709871e-001, 7.715514e-001, 7.721156e-001, 7.726777e-001,
+7.732397e-001, 7.738016e-001, 7.743635e-001, 7.749227e-001, 7.754816e-001, 7.760406e-001, 7.765996e-001, 7.771559e-001, 7.777120e-001, 7.782681e-001,
+7.788242e-001, 7.793778e-001, 7.799311e-001, 7.804843e-001, 7.810376e-001, 7.815881e-001, 7.821379e-001, 7.826877e-001, 7.832376e-001, 7.837850e-001,
+7.843314e-001, 7.848779e-001, 7.854243e-001, 7.859688e-001, 7.865119e-001, 7.870550e-001, 7.875981e-001, 7.881402e-001, 7.886806e-001, 7.892210e-001,
+7.897614e-001, 7.903017e-001, 7.908411e-001, 7.913806e-001, 7.919200e-001, 7.924595e-001, 7.929970e-001, 7.935344e-001, 7.940719e-001, 7.946093e-001,
+7.951448e-001, 7.956793e-001, 7.962138e-001, 7.967482e-001, 7.972823e-001, 7.978156e-001, 7.983488e-001, 7.988821e-001, 7.994153e-001, 7.999464e-001,
+8.004774e-001, 8.010084e-001, 8.015394e-001, 8.020684e-001, 8.025963e-001, 8.031241e-001, 8.036519e-001, 8.041795e-001, 8.047058e-001, 8.052322e-001,
+8.057585e-001, 8.062849e-001, 8.068094e-001, 8.073333e-001, 8.078572e-001, 8.083811e-001, 8.089041e-001, 8.094246e-001, 8.099450e-001, 8.104655e-001,
+8.109860e-001, 8.115053e-001, 8.120240e-001, 8.125428e-001, 8.130616e-001, 8.135799e-001, 8.140960e-001, 8.146121e-001, 8.151282e-001, 8.156443e-001,
+8.161584e-001, 8.166709e-001, 8.171833e-001, 8.176958e-001, 8.182083e-001, 8.187190e-001, 8.192296e-001, 8.197401e-001, 8.202506e-001, 8.207605e-001,
+8.212682e-001, 8.217758e-001, 8.222835e-001, 8.227912e-001, 8.232969e-001, 8.238008e-001, 8.243046e-001, 8.248085e-001, 8.253124e-001, 8.258146e-001,
+8.263163e-001, 8.268180e-001, 8.273197e-001, 8.278214e-001, 8.283202e-001, 8.288188e-001, 8.293174e-001, 8.298161e-001, 8.303143e-001, 8.308089e-001,
+8.313036e-001, 8.317982e-001, 8.322929e-001, 8.327870e-001, 8.332792e-001, 8.337715e-001, 8.342637e-001, 8.347560e-001, 8.352473e-001, 8.357363e-001,
+8.362253e-001, 8.367143e-001, 8.372033e-001, 8.376909e-001, 8.381757e-001, 8.386606e-001, 8.391454e-001, 8.396302e-001, 8.401142e-001, 8.405965e-001,
+8.410787e-001, 8.415609e-001, 8.420432e-001, 8.425244e-001, 8.430032e-001, 8.434820e-001, 8.439609e-001, 8.444397e-001, 8.449176e-001, 8.453921e-001,
+8.458666e-001, 8.463410e-001, 8.468155e-001, 8.472898e-001, 8.477615e-001, 8.482331e-001, 8.487048e-001, 8.491765e-001, 8.496481e-001, 8.501166e-001,
+8.505846e-001, 8.510527e-001, 8.515208e-001, 8.519888e-001, 8.524538e-001, 8.529174e-001, 8.533809e-001, 8.538445e-001, 8.543081e-001, 8.547704e-001,
+8.552309e-001, 8.556915e-001, 8.561520e-001, 8.566126e-001, 8.570727e-001, 8.575295e-001, 8.579863e-001, 8.584431e-001, 8.588999e-001, 8.593567e-001,
+8.598099e-001, 8.602620e-001, 8.607141e-001, 8.611663e-001, 8.616184e-001, 8.620693e-001, 8.625183e-001, 8.629672e-001, 8.634162e-001, 8.638651e-001,
+8.643141e-001, 8.647593e-001, 8.652044e-001, 8.656494e-001, 8.660945e-001, 8.665395e-001, 8.669828e-001, 8.674242e-001, 8.678655e-001, 8.683069e-001,
+8.687482e-001, 8.691896e-001, 8.696291e-001, 8.700686e-001, 8.705080e-001, 8.709475e-001, 8.713869e-001, 8.718253e-001, 8.722618e-001, 8.726983e-001,
+8.731348e-001, 8.735714e-001, 8.740079e-001, 8.744426e-001, 8.748767e-001, 8.753108e-001, 8.757450e-001, 8.761791e-001, 8.766130e-001, 8.770453e-001,
+8.774775e-001, 8.779097e-001, 8.783420e-001, 8.787742e-001, 8.792054e-001, 8.796347e-001, 8.800641e-001, 8.804934e-001, 8.809228e-001, 8.813522e-001,
+8.817801e-001, 8.822071e-001, 8.826341e-001, 8.830611e-001, 8.834881e-001, 8.839151e-001, 8.843406e-001, 8.847657e-001, 8.851909e-001, 8.856160e-001,
+8.860412e-001, 8.864663e-001, 8.868888e-001, 8.873111e-001, 8.877334e-001, 8.881557e-001, 8.885780e-001, 8.890002e-001, 8.894202e-001, 8.898402e-001,
+8.902602e-001, 8.906802e-001, 8.911002e-001, 8.915200e-001, 8.919382e-001, 8.923564e-001, 8.927746e-001, 8.931927e-001, 8.936109e-001, 8.940288e-001,
+8.944442e-001, 8.948596e-001, 8.952750e-001, 8.956904e-001, 8.961058e-001, 8.965211e-001, 8.969342e-001, 8.973473e-001, 8.977604e-001, 8.981735e-001,
+8.985866e-001, 8.989997e-001, 8.994112e-001, 8.998225e-001, 9.002338e-001, 9.006451e-001, 9.010564e-001, 9.014678e-001, 9.018769e-001, 9.022855e-001,
+9.026941e-001, 9.031027e-001, 9.035112e-001, 9.039198e-001, 9.043271e-001, 9.047334e-001, 9.051397e-001, 9.055461e-001, 9.059524e-001, 9.063588e-001,
+9.067645e-001, 9.071691e-001, 9.075737e-001, 9.079782e-001, 9.083828e-001, 9.087874e-001, 9.091919e-001, 9.095938e-001, 9.099956e-001, 9.103975e-001,
+9.107994e-001, 9.112013e-001, 9.116032e-001, 9.120036e-001, 9.124032e-001, 9.128029e-001, 9.132026e-001, 9.136023e-001, 9.140019e-001, 9.144012e-001,
+9.147991e-001, 9.151970e-001, 9.155950e-001, 9.159929e-001, 9.163909e-001, 9.167888e-001, 9.171856e-001, 9.175821e-001, 9.179785e-001, 9.183750e-001,
+9.187715e-001, 9.191679e-001, 9.195644e-001, 9.199606e-001, 9.203569e-001, 9.207532e-001, 9.211495e-001, 9.215457e-001, 9.219420e-001, 9.223376e-001,
+9.227329e-001, 9.231281e-001, 9.235234e-001, 9.239187e-001, 9.243140e-001, 9.247091e-001, 9.251027e-001, 9.254963e-001, 9.258899e-001, 9.262836e-001,
+9.266772e-001, 9.270708e-001, 9.274642e-001, 9.278574e-001, 9.282507e-001, 9.286439e-001, 9.290371e-001, 9.294303e-001, 9.298235e-001, 9.302159e-001,
+9.306079e-001, 9.309999e-001, 9.313920e-001, 9.317840e-001, 9.321760e-001, 9.325680e-001, 9.329585e-001, 9.333486e-001, 9.337388e-001, 9.341290e-001,
+9.345191e-001, 9.349093e-001, 9.352995e-001, 9.356891e-001, 9.360786e-001, 9.364682e-001, 9.368578e-001, 9.372474e-001, 9.376369e-001, 9.380264e-001,
+9.384146e-001, 9.388028e-001, 9.391910e-001, 9.395792e-001, 9.399674e-001, 9.403556e-001, 9.407432e-001, 9.411267e-001, 9.415103e-001, 9.418939e-001,
+9.422775e-001, 9.426611e-001, 9.430447e-001, 9.434276e-001, 9.438056e-001, 9.441836e-001, 9.445616e-001, 9.449396e-001, 9.453176e-001, 9.456955e-001,
+9.460734e-001, 9.464469e-001, 9.468204e-001, 9.471940e-001, 9.475675e-001, 9.479411e-001, 9.483146e-001, 9.486881e-001, 9.490590e-001, 9.494296e-001,
+9.498002e-001, 9.501708e-001, 9.505414e-001, 9.509120e-001, 9.512825e-001, 9.516519e-001, 9.520208e-001, 9.523896e-001, 9.527584e-001, 9.531273e-001,
+9.534961e-001, 9.538650e-001, 9.542329e-001, 9.545995e-001, 9.549662e-001, 9.553329e-001, 9.556996e-001, 9.560663e-001, 9.564330e-001, 9.567993e-001,
+9.571634e-001, 9.575274e-001, 9.578914e-001, 9.582554e-001, 9.586194e-001, 9.589835e-001, 9.593475e-001, 9.597097e-001, 9.600714e-001, 9.604331e-001,
+9.607948e-001, 9.611565e-001, 9.615182e-001, 9.618799e-001, 9.622407e-001, 9.625996e-001, 9.629586e-001, 9.633175e-001, 9.636764e-001, 9.640354e-001,
+9.643943e-001, 9.647533e-001, 9.651096e-001, 9.654654e-001, 9.658211e-001, 9.661768e-001, 9.665326e-001, 9.668883e-001, 9.672440e-001, 9.675990e-001,
+9.679516e-001, 9.683042e-001, 9.686568e-001, 9.690095e-001, 9.693621e-001, 9.697147e-001, 9.700673e-001, 9.704176e-001, 9.707666e-001, 9.711155e-001,
+9.714645e-001, 9.718134e-001, 9.721624e-001, 9.725113e-001, 9.728602e-001, 9.732054e-001, 9.735503e-001, 9.738952e-001, 9.742401e-001, 9.745850e-001,
+9.749299e-001, 9.752748e-001, 9.756189e-001, 9.759592e-001, 9.762996e-001, 9.766400e-001, 9.769804e-001, 9.773207e-001, 9.776611e-001, 9.780015e-001,
+9.783400e-001, 9.786750e-001, 9.790101e-001, 9.793451e-001, 9.796802e-001, 9.800152e-001, 9.803503e-001, 9.806853e-001, 9.810177e-001, 9.813471e-001,
+9.816765e-001, 9.820058e-001, 9.823352e-001, 9.826645e-001, 9.829939e-001, 9.833233e-001, 9.836489e-001, 9.839712e-001, 9.842935e-001, 9.846158e-001,
+9.849381e-001, 9.852603e-001, 9.855826e-001, 9.859049e-001, 9.862229e-001, 9.865366e-001, 9.868504e-001, 9.871641e-001, 9.874779e-001, 9.877916e-001,
+9.881054e-001, 9.884191e-001, 9.887291e-001, 9.890339e-001, 9.893387e-001, 9.896435e-001, 9.899484e-001, 9.902532e-001, 9.905580e-001, 9.908628e-001,
+9.911643e-001, 9.914570e-001, 9.917497e-001, 9.920424e-001, 9.923352e-001, 9.926279e-001, 9.929206e-001, 9.932134e-001, 9.935052e-001, 9.937830e-001,
+9.940607e-001, 9.943385e-001, 9.946163e-001, 9.948941e-001, 9.951718e-001, 9.954496e-001, 9.957274e-001, 9.959930e-001, 9.962551e-001, 9.965172e-001,
+9.967793e-001, 9.970414e-001, 9.973035e-001, 9.975656e-001, 9.978277e-001, 9.980805e-001, 9.983204e-001, 9.985604e-001, 9.988003e-001, 9.990402e-001,
+9.992802e-001, 9.995201e-001, 9.997601e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.334771e-002, 2.454289e-002, 3.397628e-002, 4.243652e-002, 5.025616e-002, 5.760053e-002, 6.460790e-002, 7.131900e-002, 7.780237e-002,
+8.408784e-002, 9.016228e-002, 9.602285e-002, 1.016970e-001, 1.071914e-001, 1.125032e-001, 1.176473e-001, 1.226311e-001, 1.274779e-001, 1.321874e-001,
+1.367732e-001, 1.412428e-001, 1.455995e-001, 1.498488e-001, 1.539964e-001, 1.580595e-001, 1.620312e-001, 1.659149e-001, 1.697211e-001, 1.734540e-001,
+1.771209e-001, 1.807265e-001, 1.842700e-001, 1.877449e-001, 1.911672e-001, 1.945340e-001, 1.978532e-001, 2.011177e-001, 2.043330e-001, 2.075065e-001,
+2.106339e-001, 2.137186e-001, 2.167687e-001, 2.197788e-001, 2.227549e-001, 2.257010e-001, 2.286102e-001, 2.314919e-001, 2.343432e-001, 2.371643e-001,
+2.399580e-001, 2.427307e-001, 2.454747e-001, 2.481937e-001, 2.508893e-001, 2.535605e-001, 2.562063e-001, 2.588257e-001, 2.614241e-001, 2.640033e-001,
+2.665628e-001, 2.691007e-001, 2.716197e-001, 2.741247e-001, 2.766117e-001, 2.790770e-001, 2.815261e-001, 2.839563e-001, 2.863682e-001, 2.887654e-001,
+2.911457e-001, 2.935140e-001, 2.958687e-001, 2.982083e-001, 3.005364e-001, 3.028526e-001, 3.051569e-001, 3.074470e-001, 3.097250e-001, 3.119906e-001,
+3.142440e-001, 3.164835e-001, 3.187100e-001, 3.209230e-001, 3.231270e-001, 3.253178e-001, 3.274958e-001, 3.296645e-001, 3.318221e-001, 3.339679e-001,
+3.360985e-001, 3.382170e-001, 3.403256e-001, 3.424213e-001, 3.445019e-001, 3.465686e-001, 3.486247e-001, 3.506676e-001, 3.526985e-001, 3.547206e-001,
+3.567343e-001, 3.587370e-001, 3.607280e-001, 3.627093e-001, 3.646797e-001, 3.666377e-001, 3.685849e-001, 3.705237e-001, 3.724532e-001, 3.743727e-001,
+3.762833e-001, 3.781885e-001, 3.800869e-001, 3.819774e-001, 3.838589e-001, 3.857303e-001, 3.875931e-001, 3.894471e-001, 3.912916e-001, 3.931256e-001,
+3.949485e-001, 3.967649e-001, 3.985747e-001, 4.003769e-001, 4.021708e-001, 4.039582e-001, 4.057385e-001, 4.075132e-001, 4.092823e-001, 4.110449e-001,
+4.128004e-001, 4.145482e-001, 4.162878e-001, 4.180184e-001, 4.197404e-001, 4.214551e-001, 4.231620e-001, 4.248597e-001, 4.265482e-001, 4.282296e-001,
+4.299039e-001, 4.315709e-001, 4.332302e-001, 4.348820e-001, 4.365274e-001, 4.381655e-001, 4.397968e-001, 4.414211e-001, 4.430381e-001, 4.446476e-001,
+4.462502e-001, 4.478481e-001, 4.494414e-001, 4.510300e-001, 4.526137e-001, 4.541929e-001, 4.557681e-001, 4.573394e-001, 4.589067e-001, 4.604691e-001,
+4.620255e-001, 4.635772e-001, 4.651241e-001, 4.666650e-001, 4.681989e-001, 4.697273e-001, 4.712502e-001, 4.727657e-001, 4.742736e-001, 4.757766e-001,
+4.772752e-001, 4.787661e-001, 4.802524e-001, 4.817340e-001, 4.832084e-001, 4.846785e-001, 4.861451e-001, 4.876071e-001, 4.890637e-001, 4.905168e-001,
+4.919654e-001, 4.934079e-001, 4.948468e-001, 4.962811e-001, 4.977090e-001, 4.991333e-001, 5.005524e-001, 5.019653e-001, 5.033746e-001, 5.047778e-001,
+5.061754e-001, 5.075694e-001, 5.089559e-001, 5.103380e-001, 5.117159e-001, 5.130858e-001, 5.144522e-001, 5.158124e-001, 5.171664e-001, 5.185170e-001,
+5.198565e-001, 5.211924e-001, 5.225226e-001, 5.238461e-001, 5.251666e-001, 5.264781e-001, 5.277864e-001, 5.290887e-001, 5.303849e-001, 5.316778e-001,
+5.329599e-001, 5.342394e-001, 5.355115e-001, 5.367797e-001, 5.380430e-001, 5.393006e-001, 5.405554e-001, 5.418028e-001, 5.430487e-001, 5.442872e-001,
+5.455237e-001, 5.467545e-001, 5.479821e-001, 5.492056e-001, 5.504247e-001, 5.516411e-001, 5.528522e-001, 5.540617e-001, 5.552654e-001, 5.564682e-001,
+5.576648e-001, 5.588607e-001, 5.600511e-001, 5.612401e-001, 5.624224e-001, 5.636029e-001, 5.647776e-001, 5.659501e-001, 5.671174e-001, 5.682825e-001,
+5.694428e-001, 5.706002e-001, 5.717516e-001, 5.729002e-001, 5.740434e-001, 5.751840e-001, 5.763192e-001, 5.774522e-001, 5.785801e-001, 5.797063e-001,
+5.808271e-001, 5.819468e-001, 5.830612e-001, 5.841750e-001, 5.852832e-001, 5.863914e-001, 5.874921e-001, 5.885927e-001, 5.896871e-001, 5.907805e-001,
+5.918692e-001, 5.929561e-001, 5.940395e-001, 5.951203e-001, 5.961988e-001, 5.972741e-001, 5.983482e-001, 5.994184e-001, 6.004886e-001, 6.015522e-001,
+6.026159e-001, 6.036749e-001, 6.047326e-001, 6.057875e-001, 6.068399e-001, 6.078910e-001, 6.089388e-001, 6.099866e-001, 6.110303e-001, 6.120741e-001,
+6.131126e-001, 6.141490e-001, 6.151828e-001, 6.162124e-001, 6.172417e-001, 6.182652e-001, 6.192886e-001, 6.203083e-001, 6.213262e-001, 6.223419e-001,
+6.233528e-001, 6.243637e-001, 6.253690e-001, 6.263738e-001, 6.273748e-001, 6.283721e-001, 6.293689e-001, 6.303574e-001, 6.313458e-001, 6.323296e-001,
+6.333101e-001, 6.342897e-001, 6.352628e-001, 6.362359e-001, 6.372049e-001, 6.381713e-001, 6.391372e-001, 6.400975e-001, 6.410579e-001, 6.420152e-001,
+6.429703e-001, 6.439253e-001, 6.448737e-001, 6.458221e-001, 6.467681e-001, 6.477108e-001, 6.486534e-001, 6.495920e-001, 6.505295e-001, 6.514660e-001,
+6.523976e-001, 6.533291e-001, 6.542579e-001, 6.551842e-001, 6.561106e-001, 6.570331e-001, 6.579551e-001, 6.588761e-001, 6.597927e-001, 6.607092e-001,
+6.616228e-001, 6.625328e-001, 6.634428e-001, 6.643488e-001, 6.652531e-001, 6.661575e-001, 6.670573e-001, 6.679568e-001, 6.688551e-001, 6.697470e-001,
+6.706390e-001, 6.715285e-001, 6.724137e-001, 6.732989e-001, 6.741808e-001, 6.750600e-001, 6.759392e-001, 6.768148e-001, 6.776888e-001, 6.785628e-001,
+6.794318e-001, 6.802996e-001, 6.811674e-001, 6.820289e-001, 6.828898e-001, 6.837507e-001, 6.846057e-001, 6.854607e-001, 6.863154e-001, 6.871636e-001,
+6.880119e-001, 6.888597e-001, 6.897021e-001, 6.905445e-001, 6.913864e-001, 6.922220e-001, 6.930576e-001, 6.938929e-001, 6.947228e-001, 6.955527e-001,
+6.963826e-001, 6.972076e-001, 6.980327e-001, 6.988577e-001, 6.996777e-001, 7.004973e-001, 7.013169e-001, 7.021314e-001, 7.029448e-001, 7.037582e-001,
+7.045679e-001, 7.053759e-001, 7.061840e-001, 7.069896e-001, 7.077933e-001, 7.085970e-001, 7.093988e-001, 7.101973e-001, 7.109957e-001, 7.117932e-001,
+7.125861e-001, 7.133789e-001, 7.141718e-001, 7.149586e-001, 7.157452e-001, 7.165318e-001, 7.173146e-001, 7.180959e-001, 7.188771e-001, 7.196566e-001,
+7.204335e-001, 7.212104e-001, 7.219869e-001, 7.227588e-001, 7.235307e-001, 7.243026e-001, 7.250691e-001, 7.258338e-001, 7.265986e-001, 7.273609e-001,
+7.281196e-001, 7.288782e-001, 7.296368e-001, 7.303904e-001, 7.311440e-001, 7.318976e-001, 7.326479e-001, 7.333959e-001, 7.341439e-001, 7.348910e-001,
+7.356327e-001, 7.363744e-001, 7.371161e-001, 7.378535e-001, 7.385885e-001, 7.393235e-001, 7.400577e-001, 7.407871e-001, 7.415166e-001, 7.422460e-001,
+7.429727e-001, 7.436977e-001, 7.444226e-001, 7.451473e-001, 7.458673e-001, 7.465874e-001, 7.473074e-001, 7.480244e-001, 7.487376e-001, 7.494507e-001,
+7.501639e-001, 7.508723e-001, 7.515797e-001, 7.522870e-001, 7.529936e-001, 7.536964e-001, 7.543992e-001, 7.551021e-001, 7.558024e-001, 7.565002e-001,
+7.571980e-001, 7.578958e-001, 7.585895e-001, 7.592820e-001, 7.599744e-001, 7.606667e-001, 7.613534e-001, 7.620400e-001, 7.627267e-001, 7.634123e-001,
+7.640944e-001, 7.647765e-001, 7.654587e-001, 7.661380e-001, 7.668138e-001, 7.674897e-001, 7.681655e-001, 7.688373e-001, 7.695064e-001, 7.701755e-001,
+7.708446e-001, 7.715099e-001, 7.721736e-001, 7.728373e-001, 7.735011e-001, 7.741602e-001, 7.748184e-001, 7.754765e-001, 7.761346e-001, 7.767889e-001,
+7.774426e-001, 7.780963e-001, 7.787501e-001, 7.793995e-001, 7.800486e-001, 7.806976e-001, 7.813467e-001, 7.819913e-001, 7.826355e-001, 7.832797e-001,
+7.839238e-001, 7.845636e-001, 7.852027e-001, 7.858418e-001, 7.864809e-001, 7.871146e-001, 7.877471e-001, 7.883795e-001, 7.890119e-001, 7.896396e-001,
+7.902652e-001, 7.908908e-001, 7.915164e-001, 7.921389e-001, 7.927589e-001, 7.933789e-001, 7.939989e-001, 7.946167e-001, 7.952311e-001, 7.958455e-001,
+7.964599e-001, 7.970730e-001, 7.976802e-001, 7.982874e-001, 7.988946e-001, 7.995018e-001, 8.001034e-001, 8.007047e-001, 8.013060e-001, 8.019073e-001,
+8.025055e-001, 8.031023e-001, 8.036991e-001, 8.042959e-001, 8.048911e-001, 8.054833e-001, 8.060755e-001, 8.066677e-001, 8.072599e-001, 8.078474e-001,
+8.084350e-001, 8.090225e-001, 8.096100e-001, 8.101946e-001, 8.107774e-001, 8.113602e-001, 8.119430e-001, 8.125251e-001, 8.131045e-001, 8.136839e-001,
+8.142634e-001, 8.148428e-001, 8.154187e-001, 8.159933e-001, 8.165680e-001, 8.171426e-001, 8.177158e-001, 8.182843e-001, 8.188528e-001, 8.194214e-001,
+8.199899e-001, 8.205550e-001, 8.211188e-001, 8.216826e-001, 8.222464e-001, 8.228094e-001, 8.233685e-001, 8.239275e-001, 8.244866e-001, 8.250456e-001,
+8.256022e-001, 8.261566e-001, 8.267110e-001, 8.272655e-001, 8.278199e-001, 8.283702e-001, 8.289201e-001, 8.294699e-001, 8.300197e-001, 8.305683e-001,
+8.311124e-001, 8.316564e-001, 8.322004e-001, 8.327445e-001, 8.332857e-001, 8.338240e-001, 8.343623e-001, 8.349007e-001, 8.354390e-001, 8.359742e-001,
+8.365082e-001, 8.370422e-001, 8.375762e-001, 8.381102e-001, 8.386404e-001, 8.391704e-001, 8.397003e-001, 8.402303e-001, 8.407598e-001, 8.412844e-001,
+8.418091e-001, 8.423338e-001, 8.428585e-001, 8.433821e-001, 8.439016e-001, 8.444212e-001, 8.449407e-001, 8.454603e-001, 8.459784e-001, 8.464931e-001,
+8.470077e-001, 8.475223e-001, 8.480370e-001, 8.485501e-001, 8.490600e-001, 8.495699e-001, 8.500798e-001, 8.505897e-001, 8.510982e-001, 8.516037e-001,
+8.521091e-001, 8.526146e-001, 8.531200e-001, 8.536240e-001, 8.541239e-001, 8.546238e-001, 8.551237e-001, 8.556236e-001, 8.561225e-001, 8.566171e-001,
+8.571116e-001, 8.576061e-001, 8.581007e-001, 8.585950e-001, 8.590856e-001, 8.595763e-001, 8.600669e-001, 8.605576e-001, 8.610482e-001, 8.615357e-001,
+8.620227e-001, 8.625098e-001, 8.629969e-001, 8.634839e-001, 8.639679e-001, 8.644505e-001, 8.649331e-001, 8.654157e-001, 8.658982e-001, 8.663790e-001,
+8.668573e-001, 8.673356e-001, 8.678139e-001, 8.682922e-001, 8.687700e-001, 8.692443e-001, 8.697186e-001, 8.701929e-001, 8.706671e-001, 8.711414e-001,
+8.716111e-001, 8.720794e-001, 8.725477e-001, 8.730160e-001, 8.734843e-001, 8.739505e-001, 8.744130e-001, 8.748756e-001, 8.753382e-001, 8.758008e-001,
+8.762634e-001, 8.767219e-001, 8.771802e-001, 8.776385e-001, 8.780967e-001, 8.785550e-001, 8.790109e-001, 8.794641e-001, 8.799173e-001, 8.803704e-001,
+8.808236e-001, 8.812768e-001, 8.817255e-001, 8.821739e-001, 8.826223e-001, 8.830707e-001, 8.835191e-001, 8.839659e-001, 8.844101e-001, 8.848543e-001,
+8.852984e-001, 8.857426e-001, 8.861867e-001, 8.866272e-001, 8.870663e-001, 8.875055e-001, 8.879446e-001, 8.883838e-001, 8.888226e-001, 8.892571e-001,
+8.896916e-001, 8.901261e-001, 8.905606e-001, 8.909951e-001, 8.914281e-001, 8.918585e-001, 8.922889e-001, 8.927193e-001, 8.931497e-001, 8.935801e-001,
+8.940076e-001, 8.944331e-001, 8.948586e-001, 8.952841e-001, 8.957096e-001, 8.961351e-001, 8.965570e-001, 8.969780e-001, 8.973989e-001, 8.978199e-001,
+8.982409e-001, 8.986619e-001, 8.990791e-001, 8.994961e-001, 8.999132e-001, 9.003302e-001, 9.007472e-001, 9.011640e-001, 9.015762e-001, 9.019884e-001,
+9.024006e-001, 9.028129e-001, 9.032251e-001, 9.036368e-001, 9.040435e-001, 9.044502e-001, 9.048569e-001, 9.052636e-001, 9.056703e-001, 9.060766e-001,
+9.064795e-001, 9.068824e-001, 9.072853e-001, 9.076882e-001, 9.080911e-001, 9.084939e-001, 9.088945e-001, 9.092950e-001, 9.096956e-001, 9.100962e-001,
+9.104968e-001, 9.108974e-001, 9.112942e-001, 9.116909e-001, 9.120875e-001, 9.124842e-001, 9.128808e-001, 9.132774e-001, 9.136705e-001, 9.140626e-001,
+9.144546e-001, 9.148467e-001, 9.152388e-001, 9.156309e-001, 9.160212e-001, 9.164103e-001, 9.167994e-001, 9.171886e-001, 9.175777e-001, 9.179668e-001,
+9.183548e-001, 9.187405e-001, 9.191262e-001, 9.195119e-001, 9.198976e-001, 9.202833e-001, 9.206688e-001, 9.210494e-001, 9.214301e-001, 9.218107e-001,
+9.221913e-001, 9.225719e-001, 9.229526e-001, 9.233309e-001, 9.237081e-001, 9.240854e-001, 9.244626e-001, 9.248398e-001, 9.252170e-001, 9.255935e-001,
+9.259679e-001, 9.263422e-001, 9.267166e-001, 9.270910e-001, 9.274654e-001, 9.278397e-001, 9.282106e-001, 9.285805e-001, 9.289504e-001, 9.293203e-001,
+9.296902e-001, 9.300601e-001, 9.304289e-001, 9.307949e-001, 9.311608e-001, 9.315268e-001, 9.318928e-001, 9.322588e-001, 9.326247e-001, 9.329884e-001,
+9.333512e-001, 9.337139e-001, 9.340766e-001, 9.344394e-001, 9.348021e-001, 9.351645e-001, 9.355235e-001, 9.358825e-001, 9.362415e-001, 9.366004e-001,
+9.369594e-001, 9.373184e-001, 9.376757e-001, 9.380305e-001, 9.383852e-001, 9.387400e-001, 9.390947e-001, 9.394495e-001, 9.398042e-001, 9.401567e-001,
+9.405080e-001, 9.408593e-001, 9.412106e-001, 9.415619e-001, 9.419132e-001, 9.422645e-001, 9.426132e-001, 9.429615e-001, 9.433098e-001, 9.436581e-001,
+9.440064e-001, 9.443547e-001, 9.447030e-001, 9.450478e-001, 9.453927e-001, 9.457375e-001, 9.460824e-001, 9.464272e-001, 9.467721e-001, 9.471165e-001,
+9.474576e-001, 9.477987e-001, 9.481398e-001, 9.484809e-001, 9.488220e-001, 9.491631e-001, 9.495038e-001, 9.498417e-001, 9.501796e-001, 9.505176e-001,
+9.508555e-001, 9.511934e-001, 9.515313e-001, 9.518690e-001, 9.522043e-001, 9.525396e-001, 9.528750e-001, 9.532103e-001, 9.535457e-001, 9.538810e-001,
+9.542161e-001, 9.545456e-001, 9.548751e-001, 9.552046e-001, 9.555341e-001, 9.558636e-001, 9.561931e-001, 9.565226e-001, 9.568458e-001, 9.571682e-001,
+9.574906e-001, 9.578130e-001, 9.581354e-001, 9.584578e-001, 9.587802e-001, 9.591000e-001, 9.594187e-001, 9.597374e-001, 9.600561e-001, 9.603749e-001,
+9.606936e-001, 9.610123e-001, 9.613298e-001, 9.616457e-001, 9.619617e-001, 9.622776e-001, 9.625936e-001, 9.629095e-001, 9.632255e-001, 9.635410e-001,
+9.638536e-001, 9.641663e-001, 9.644789e-001, 9.647915e-001, 9.651042e-001, 9.654168e-001, 9.657294e-001, 9.660399e-001, 9.663495e-001, 9.666592e-001,
+9.669689e-001, 9.672785e-001, 9.675882e-001, 9.678979e-001, 9.682065e-001, 9.685127e-001, 9.688190e-001, 9.691252e-001, 9.694314e-001, 9.697376e-001,
+9.700439e-001, 9.703501e-001, 9.706526e-001, 9.709543e-001, 9.712559e-001, 9.715575e-001, 9.718591e-001, 9.721608e-001, 9.724624e-001, 9.727630e-001,
+9.730604e-001, 9.733578e-001, 9.736552e-001, 9.739526e-001, 9.742500e-001, 9.745474e-001, 9.748447e-001, 9.751395e-001, 9.754327e-001, 9.757258e-001,
+9.760190e-001, 9.763122e-001, 9.766053e-001, 9.768985e-001, 9.771916e-001, 9.774800e-001, 9.777679e-001, 9.780559e-001, 9.783438e-001, 9.786318e-001,
+9.789197e-001, 9.792077e-001, 9.794947e-001, 9.797773e-001, 9.800599e-001, 9.803425e-001, 9.806251e-001, 9.809078e-001, 9.811904e-001, 9.814730e-001,
+9.817537e-001, 9.820310e-001, 9.823082e-001, 9.825855e-001, 9.828627e-001, 9.831400e-001, 9.834173e-001, 9.836945e-001, 9.839691e-001, 9.842408e-001,
+9.845124e-001, 9.847840e-001, 9.850556e-001, 9.853272e-001, 9.855988e-001, 9.858704e-001, 9.861392e-001, 9.864053e-001, 9.866713e-001, 9.869374e-001,
+9.872035e-001, 9.874696e-001, 9.877356e-001, 9.880017e-001, 9.882647e-001, 9.885246e-001, 9.887845e-001, 9.890445e-001, 9.893044e-001, 9.895643e-001,
+9.898242e-001, 9.900842e-001, 9.903412e-001, 9.905944e-001, 9.908475e-001, 9.911007e-001, 9.913538e-001, 9.916070e-001, 9.918601e-001, 9.921132e-001,
+9.923646e-001, 9.926110e-001, 9.928574e-001, 9.931039e-001, 9.933503e-001, 9.935968e-001, 9.938432e-001, 9.940897e-001, 9.943356e-001, 9.945728e-001,
+9.948101e-001, 9.950474e-001, 9.952846e-001, 9.955219e-001, 9.957592e-001, 9.959965e-001, 9.962337e-001, 9.964621e-001, 9.966878e-001, 9.969136e-001,
+9.971393e-001, 9.973651e-001, 9.975908e-001, 9.978166e-001, 9.980423e-001, 9.982644e-001, 9.984813e-001, 9.986983e-001, 9.989152e-001, 9.991322e-001,
+9.993491e-001, 9.995661e-001, 9.997830e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Vista 400", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.767178e-002, 3.048535e-002, 4.107338e-002, 5.051164e-002, 5.920695e-002, 6.738516e-002, 7.517565e-002, 8.266975e-002, 8.997007e-002,
+9.711271e-002, 1.040615e-001, 1.108868e-001, 1.175593e-001, 1.240770e-001, 1.304064e-001, 1.365357e-001, 1.425069e-001, 1.483052e-001, 1.539329e-001,
+1.594131e-001, 1.647385e-001, 1.699229e-001, 1.749855e-001, 1.799377e-001, 1.847759e-001, 1.895147e-001, 1.941531e-001, 1.987002e-001, 2.031593e-001,
+2.075426e-001, 2.118436e-001, 2.160741e-001, 2.202394e-001, 2.243398e-001, 2.283758e-001, 2.323485e-001, 2.362572e-001, 2.401061e-001, 2.438924e-001,
+2.476288e-001, 2.513083e-001, 2.549472e-001, 2.585381e-001, 2.620711e-001, 2.655649e-001, 2.690165e-001, 2.724194e-001, 2.757751e-001, 2.791010e-001,
+2.823888e-001, 2.856282e-001, 2.888260e-001, 2.919923e-001, 2.951227e-001, 2.982216e-001, 3.012860e-001, 3.043090e-001, 3.073102e-001, 3.102935e-001,
+3.132513e-001, 3.161766e-001, 3.190675e-001, 3.219313e-001, 3.247652e-001, 3.275650e-001, 3.303398e-001, 3.330947e-001, 3.358343e-001, 3.385555e-001,
+3.412532e-001, 3.439249e-001, 3.465683e-001, 3.491815e-001, 3.517725e-001, 3.543427e-001, 3.568890e-001, 3.594170e-001, 3.619238e-001, 3.644066e-001,
+3.668681e-001, 3.693179e-001, 3.717588e-001, 3.741885e-001, 3.766060e-001, 3.790099e-001, 3.813976e-001, 3.837701e-001, 3.861232e-001, 3.884578e-001,
+3.907733e-001, 3.930663e-001, 3.953462e-001, 3.976148e-001, 3.998697e-001, 4.021121e-001, 4.043419e-001, 4.065585e-001, 4.087597e-001, 4.109471e-001,
+4.131202e-001, 4.152786e-001, 4.174210e-001, 4.195466e-001, 4.216562e-001, 4.237482e-001, 4.258198e-001, 4.278750e-001, 4.299133e-001, 4.319362e-001,
+4.339421e-001, 4.359338e-001, 4.379098e-001, 4.398722e-001, 4.418199e-001, 4.437534e-001, 4.456734e-001, 4.475805e-001, 4.494753e-001, 4.513584e-001,
+4.532304e-001, 4.550901e-001, 4.569362e-001, 4.587699e-001, 4.605912e-001, 4.624013e-001, 4.641988e-001, 4.659828e-001, 4.677541e-001, 4.695135e-001,
+4.712609e-001, 4.729955e-001, 4.747171e-001, 4.764277e-001, 4.781259e-001, 4.798142e-001, 4.814905e-001, 4.831554e-001, 4.848085e-001, 4.864496e-001,
+4.880792e-001, 4.896989e-001, 4.913075e-001, 4.929073e-001, 4.944973e-001, 4.960778e-001, 4.976491e-001, 4.992105e-001, 5.007578e-001, 5.022948e-001,
+5.038218e-001, 5.053405e-001, 5.068517e-001, 5.083519e-001, 5.098430e-001, 5.113254e-001, 5.127994e-001, 5.142660e-001, 5.157235e-001, 5.171709e-001,
+5.186092e-001, 5.200391e-001, 5.214568e-001, 5.228652e-001, 5.242664e-001, 5.256614e-001, 5.270468e-001, 5.284280e-001, 5.298041e-001, 5.311722e-001,
+5.325286e-001, 5.338789e-001, 5.352239e-001, 5.365588e-001, 5.378903e-001, 5.392178e-001, 5.405359e-001, 5.418452e-001, 5.431485e-001, 5.444443e-001,
+5.457334e-001, 5.470187e-001, 5.482995e-001, 5.495708e-001, 5.508364e-001, 5.520933e-001, 5.533440e-001, 5.545909e-001, 5.558316e-001, 5.570693e-001,
+5.583047e-001, 5.595293e-001, 5.607495e-001, 5.619640e-001, 5.631701e-001, 5.643717e-001, 5.655640e-001, 5.667487e-001, 5.679284e-001, 5.691005e-001,
+5.702697e-001, 5.714333e-001, 5.725922e-001, 5.737486e-001, 5.748950e-001, 5.760377e-001, 5.771714e-001, 5.783005e-001, 5.794264e-001, 5.805452e-001,
+5.816623e-001, 5.827761e-001, 5.838869e-001, 5.849927e-001, 5.860930e-001, 5.871898e-001, 5.882819e-001, 5.893726e-001, 5.904522e-001, 5.915297e-001,
+5.926000e-001, 5.936675e-001, 5.947308e-001, 5.957895e-001, 5.968446e-001, 5.978963e-001, 5.989466e-001, 5.999880e-001, 6.010278e-001, 6.020595e-001,
+6.030905e-001, 6.041158e-001, 6.051399e-001, 6.061576e-001, 6.071736e-001, 6.081838e-001, 6.091916e-001, 6.101929e-001, 6.111916e-001, 6.121846e-001,
+6.131751e-001, 6.141607e-001, 6.151444e-001, 6.161243e-001, 6.171023e-001, 6.180764e-001, 6.190484e-001, 6.200155e-001, 6.209805e-001, 6.219392e-001,
+6.228964e-001, 6.238467e-001, 6.247967e-001, 6.257433e-001, 6.266898e-001, 6.276293e-001, 6.285687e-001, 6.294990e-001, 6.304280e-001, 6.313526e-001,
+6.322757e-001, 6.331944e-001, 6.341100e-001, 6.350240e-001, 6.359356e-001, 6.368461e-001, 6.377531e-001, 6.386599e-001, 6.395592e-001, 6.404585e-001,
+6.413551e-001, 6.422510e-001, 6.431432e-001, 6.440325e-001, 6.449189e-001, 6.457985e-001, 6.466779e-001, 6.475522e-001, 6.484264e-001, 6.492944e-001,
+6.501601e-001, 6.510232e-001, 6.518826e-001, 6.527418e-001, 6.535974e-001, 6.544529e-001, 6.553013e-001, 6.561468e-001, 6.569897e-001, 6.578275e-001,
+6.586653e-001, 6.594979e-001, 6.603303e-001, 6.611602e-001, 6.619879e-001, 6.628153e-001, 6.636397e-001, 6.644641e-001, 6.652842e-001, 6.661019e-001,
+6.669186e-001, 6.677302e-001, 6.685419e-001, 6.693504e-001, 6.701575e-001, 6.709633e-001, 6.717623e-001, 6.725612e-001, 6.733566e-001, 6.741497e-001,
+6.749426e-001, 6.757321e-001, 6.765216e-001, 6.773091e-001, 6.780942e-001, 6.788793e-001, 6.796609e-001, 6.804420e-001, 6.812220e-001, 6.819984e-001,
+6.827748e-001, 6.835479e-001, 6.843188e-001, 6.850897e-001, 6.858560e-001, 6.866218e-001, 6.873863e-001, 6.881463e-001, 6.889063e-001, 6.896630e-001,
+6.904165e-001, 6.911700e-001, 6.919188e-001, 6.926661e-001, 6.934134e-001, 6.941565e-001, 6.948996e-001, 6.956413e-001, 6.963785e-001, 6.971156e-001,
+6.978498e-001, 6.985801e-001, 6.993104e-001, 7.000390e-001, 7.007665e-001, 7.014940e-001, 7.022176e-001, 7.029400e-001, 7.036623e-001, 7.043780e-001,
+7.050929e-001, 7.058077e-001, 7.065191e-001, 7.072305e-001, 7.079416e-001, 7.086471e-001, 7.093527e-001, 7.100574e-001, 7.107549e-001, 7.114523e-001,
+7.121492e-001, 7.128426e-001, 7.135359e-001, 7.142283e-001, 7.149153e-001, 7.156022e-001, 7.162884e-001, 7.169690e-001, 7.176496e-001, 7.183300e-001,
+7.190074e-001, 7.196848e-001, 7.203623e-001, 7.210342e-001, 7.217061e-001, 7.223780e-001, 7.230477e-001, 7.237172e-001, 7.243867e-001, 7.250542e-001,
+7.257213e-001, 7.263883e-001, 7.270516e-001, 7.277127e-001, 7.283738e-001, 7.290335e-001, 7.296916e-001, 7.303498e-001, 7.310072e-001, 7.316624e-001,
+7.323176e-001, 7.329727e-001, 7.336216e-001, 7.342704e-001, 7.349192e-001, 7.355654e-001, 7.362109e-001, 7.368563e-001, 7.375001e-001, 7.381422e-001,
+7.387843e-001, 7.394252e-001, 7.400605e-001, 7.406958e-001, 7.413311e-001, 7.419633e-001, 7.425948e-001, 7.432263e-001, 7.438561e-001, 7.444839e-001,
+7.451116e-001, 7.457391e-001, 7.463619e-001, 7.469847e-001, 7.476075e-001, 7.482285e-001, 7.488485e-001, 7.494685e-001, 7.500877e-001, 7.507038e-001,
+7.513198e-001, 7.519358e-001, 7.525481e-001, 7.531589e-001, 7.537698e-001, 7.543800e-001, 7.549878e-001, 7.555956e-001, 7.562034e-001, 7.568084e-001,
+7.574119e-001, 7.580155e-001, 7.586186e-001, 7.592174e-001, 7.598163e-001, 7.604151e-001, 7.610119e-001, 7.616067e-001, 7.622015e-001, 7.627963e-001,
+7.633875e-001, 7.639781e-001, 7.645688e-001, 7.651584e-001, 7.657444e-001, 7.663305e-001, 7.669166e-001, 7.675006e-001, 7.680827e-001, 7.686649e-001,
+7.692471e-001, 7.698259e-001, 7.704041e-001, 7.709822e-001, 7.715601e-001, 7.721338e-001, 7.727075e-001, 7.732813e-001, 7.738539e-001, 7.744239e-001,
+7.749939e-001, 7.755639e-001, 7.761321e-001, 7.766981e-001, 7.772642e-001, 7.778303e-001, 7.783936e-001, 7.789554e-001, 7.795172e-001, 7.800790e-001,
+7.806381e-001, 7.811963e-001, 7.817545e-001, 7.823127e-001, 7.828676e-001, 7.834219e-001, 7.839762e-001, 7.845305e-001, 7.850810e-001, 7.856311e-001,
+7.861813e-001, 7.867314e-001, 7.872782e-001, 7.878248e-001, 7.883714e-001, 7.889180e-001, 7.894610e-001, 7.900037e-001, 7.905464e-001, 7.910891e-001,
+7.916281e-001, 7.921667e-001, 7.927053e-001, 7.932439e-001, 7.937796e-001, 7.943147e-001, 7.948498e-001, 7.953849e-001, 7.959171e-001, 7.964483e-001,
+7.969795e-001, 7.975106e-001, 7.980394e-001, 7.985665e-001, 7.990936e-001, 7.996206e-001, 8.001463e-001, 8.006699e-001, 8.011934e-001, 8.017170e-001,
+8.022398e-001, 8.027595e-001, 8.032791e-001, 8.037987e-001, 8.043184e-001, 8.048342e-001, 8.053497e-001, 8.058653e-001, 8.063809e-001, 8.068936e-001,
+8.074047e-001, 8.079158e-001, 8.084270e-001, 8.089369e-001, 8.094445e-001, 8.099521e-001, 8.104597e-001, 8.109674e-001, 8.114724e-001, 8.119774e-001,
+8.124825e-001, 8.129875e-001, 8.134901e-001, 8.139910e-001, 8.144919e-001, 8.149928e-001, 8.154932e-001, 8.159909e-001, 8.164886e-001, 8.169864e-001,
+8.174841e-001, 8.179802e-001, 8.184756e-001, 8.189711e-001, 8.194665e-001, 8.199611e-001, 8.204528e-001, 8.209444e-001, 8.214361e-001, 8.219278e-001,
+8.224174e-001, 8.229062e-001, 8.233950e-001, 8.238838e-001, 8.243723e-001, 8.248591e-001, 8.253459e-001, 8.258327e-001, 8.263195e-001, 8.268045e-001,
+8.272879e-001, 8.277712e-001, 8.282545e-001, 8.287379e-001, 8.292190e-001, 8.296997e-001, 8.301805e-001, 8.306613e-001, 8.311417e-001, 8.316208e-001,
+8.320998e-001, 8.325789e-001, 8.330579e-001, 8.335352e-001, 8.340101e-001, 8.344850e-001, 8.349598e-001, 8.354347e-001, 8.359070e-001, 8.363780e-001,
+8.368490e-001, 8.373200e-001, 8.377910e-001, 8.382608e-001, 8.387305e-001, 8.392002e-001, 8.396699e-001, 8.401396e-001, 8.406055e-001, 8.410715e-001,
+8.415375e-001, 8.420035e-001, 8.424690e-001, 8.429316e-001, 8.433941e-001, 8.438567e-001, 8.443192e-001, 8.447816e-001, 8.452433e-001, 8.457050e-001,
+8.461666e-001, 8.466283e-001, 8.470893e-001, 8.475477e-001, 8.480062e-001, 8.484646e-001, 8.489231e-001, 8.493805e-001, 8.498344e-001, 8.502883e-001,
+8.507422e-001, 8.511961e-001, 8.516497e-001, 8.521021e-001, 8.525546e-001, 8.530070e-001, 8.534594e-001, 8.539116e-001, 8.543611e-001, 8.548106e-001,
+8.552601e-001, 8.557096e-001, 8.561591e-001, 8.566038e-001, 8.570482e-001, 8.574925e-001, 8.579369e-001, 8.583812e-001, 8.588235e-001, 8.592652e-001,
+8.597068e-001, 8.601485e-001, 8.605902e-001, 8.610305e-001, 8.614697e-001, 8.619089e-001, 8.623481e-001, 8.627873e-001, 8.632252e-001, 8.636596e-001,
+8.640941e-001, 8.645286e-001, 8.649630e-001, 8.653975e-001, 8.658297e-001, 8.662619e-001, 8.666941e-001, 8.671262e-001, 8.675584e-001, 8.679893e-001,
+8.684194e-001, 8.688495e-001, 8.692796e-001, 8.697097e-001, 8.701389e-001, 8.705647e-001, 8.709904e-001, 8.714162e-001, 8.718420e-001, 8.722678e-001,
+8.726921e-001, 8.731160e-001, 8.735398e-001, 8.739637e-001, 8.743875e-001, 8.748109e-001, 8.752331e-001, 8.756553e-001, 8.760775e-001, 8.764997e-001,
+8.769219e-001, 8.773405e-001, 8.777579e-001, 8.781753e-001, 8.785927e-001, 8.790101e-001, 8.794271e-001, 8.798415e-001, 8.802560e-001, 8.806704e-001,
+8.810849e-001, 8.814993e-001, 8.819132e-001, 8.823265e-001, 8.827397e-001, 8.831530e-001, 8.835663e-001, 8.839796e-001, 8.843893e-001, 8.847984e-001,
+8.852074e-001, 8.856165e-001, 8.860256e-001, 8.864343e-001, 8.868410e-001, 8.872476e-001, 8.876542e-001, 8.880609e-001, 8.884675e-001, 8.888739e-001,
+8.892799e-001, 8.896859e-001, 8.900918e-001, 8.904978e-001, 8.909038e-001, 8.913077e-001, 8.917100e-001, 8.921123e-001, 8.925146e-001, 8.929169e-001,
+8.933191e-001, 8.937195e-001, 8.941191e-001, 8.945186e-001, 8.949181e-001, 8.953177e-001, 8.957172e-001, 8.961155e-001, 8.965135e-001, 8.969115e-001,
+8.973095e-001, 8.977075e-001, 8.981055e-001, 8.985010e-001, 8.988960e-001, 8.992909e-001, 8.996858e-001, 9.000808e-001, 9.004757e-001, 9.008677e-001,
+9.012590e-001, 9.016503e-001, 9.020416e-001, 9.024330e-001, 9.028243e-001, 9.032142e-001, 9.036036e-001, 9.039930e-001, 9.043824e-001, 9.047718e-001,
+9.051612e-001, 9.055490e-001, 9.059358e-001, 9.063226e-001, 9.067095e-001, 9.070963e-001, 9.074832e-001, 9.078686e-001, 9.082523e-001, 9.086360e-001,
+9.090197e-001, 9.094034e-001, 9.097871e-001, 9.101705e-001, 9.105527e-001, 9.109350e-001, 9.113172e-001, 9.116995e-001, 9.120817e-001, 9.124640e-001,
+9.128442e-001, 9.132244e-001, 9.136046e-001, 9.139848e-001, 9.143650e-001, 9.147452e-001, 9.151231e-001, 9.154999e-001, 9.158766e-001, 9.162533e-001,
+9.166301e-001, 9.170068e-001, 9.173829e-001, 9.177573e-001, 9.181317e-001, 9.185061e-001, 9.188805e-001, 9.192549e-001, 9.196294e-001, 9.200025e-001,
+9.203755e-001, 9.207484e-001, 9.211214e-001, 9.214943e-001, 9.218673e-001, 9.222391e-001, 9.226092e-001, 9.229793e-001, 9.233493e-001, 9.237194e-001,
+9.240895e-001, 9.244596e-001, 9.248281e-001, 9.251965e-001, 9.255648e-001, 9.259331e-001, 9.263015e-001, 9.266698e-001, 9.270379e-001, 9.274053e-001,
+9.277727e-001, 9.281402e-001, 9.285076e-001, 9.288750e-001, 9.292424e-001, 9.296076e-001, 9.299713e-001, 9.303351e-001, 9.306988e-001, 9.310626e-001,
+9.314264e-001, 9.317901e-001, 9.321512e-001, 9.325122e-001, 9.328731e-001, 9.332340e-001, 9.335949e-001, 9.339559e-001, 9.343165e-001, 9.346757e-001,
+9.350349e-001, 9.353941e-001, 9.357533e-001, 9.361125e-001, 9.364717e-001, 9.368298e-001, 9.371859e-001, 9.375420e-001, 9.378981e-001, 9.382543e-001,
+9.386104e-001, 9.389665e-001, 9.393215e-001, 9.396753e-001, 9.400291e-001, 9.403830e-001, 9.407368e-001, 9.410906e-001, 9.414445e-001, 9.417976e-001,
+9.421503e-001, 9.425029e-001, 9.428555e-001, 9.432082e-001, 9.435608e-001, 9.439134e-001, 9.442646e-001, 9.446147e-001, 9.449648e-001, 9.453149e-001,
+9.456650e-001, 9.460151e-001, 9.463652e-001, 9.467138e-001, 9.470613e-001, 9.474088e-001, 9.477562e-001, 9.481037e-001, 9.484512e-001, 9.487986e-001,
+9.491446e-001, 9.494889e-001, 9.498332e-001, 9.501775e-001, 9.505218e-001, 9.508661e-001, 9.512103e-001, 9.515535e-001, 9.518942e-001, 9.522349e-001,
+9.525757e-001, 9.529164e-001, 9.532571e-001, 9.535978e-001, 9.539382e-001, 9.542763e-001, 9.546143e-001, 9.549523e-001, 9.552904e-001, 9.556284e-001,
+9.559665e-001, 9.563045e-001, 9.566409e-001, 9.569769e-001, 9.573129e-001, 9.576489e-001, 9.579848e-001, 9.583208e-001, 9.586568e-001, 9.589916e-001,
+9.593249e-001, 9.596583e-001, 9.599917e-001, 9.603250e-001, 9.606584e-001, 9.609918e-001, 9.613249e-001, 9.616556e-001, 9.619864e-001, 9.623171e-001,
+9.626479e-001, 9.629786e-001, 9.633094e-001, 9.636401e-001, 9.639695e-001, 9.642981e-001, 9.646268e-001, 9.649554e-001, 9.652840e-001, 9.656126e-001,
+9.659413e-001, 9.662696e-001, 9.665956e-001, 9.669216e-001, 9.672476e-001, 9.675736e-001, 9.678997e-001, 9.682257e-001, 9.685517e-001, 9.688763e-001,
+9.691996e-001, 9.695230e-001, 9.698463e-001, 9.701697e-001, 9.704930e-001, 9.708164e-001, 9.711397e-001, 9.714608e-001, 9.717815e-001, 9.721023e-001,
+9.724230e-001, 9.727438e-001, 9.730645e-001, 9.733853e-001, 9.737055e-001, 9.740230e-001, 9.743405e-001, 9.746581e-001, 9.749756e-001, 9.752931e-001,
+9.756106e-001, 9.759281e-001, 9.762443e-001, 9.765584e-001, 9.768725e-001, 9.771867e-001, 9.775008e-001, 9.778149e-001, 9.781290e-001, 9.784432e-001,
+9.787555e-001, 9.790663e-001, 9.793771e-001, 9.796880e-001, 9.799988e-001, 9.803097e-001, 9.806205e-001, 9.809313e-001, 9.812395e-001, 9.815463e-001,
+9.818530e-001, 9.821598e-001, 9.824666e-001, 9.827733e-001, 9.830801e-001, 9.833869e-001, 9.836913e-001, 9.839947e-001, 9.842982e-001, 9.846016e-001,
+9.849050e-001, 9.852084e-001, 9.855118e-001, 9.858152e-001, 9.861157e-001, 9.864145e-001, 9.867134e-001, 9.870122e-001, 9.873110e-001, 9.876099e-001,
+9.879087e-001, 9.882076e-001, 9.885028e-001, 9.887949e-001, 9.890870e-001, 9.893791e-001, 9.896711e-001, 9.899632e-001, 9.902553e-001, 9.905474e-001,
+9.908376e-001, 9.911244e-001, 9.914113e-001, 9.916981e-001, 9.919849e-001, 9.922718e-001, 9.925586e-001, 9.928454e-001, 9.931317e-001, 9.934137e-001,
+9.936958e-001, 9.939778e-001, 9.942599e-001, 9.945419e-001, 9.948240e-001, 9.951061e-001, 9.953881e-001, 9.956638e-001, 9.959380e-001, 9.962123e-001,
+9.964866e-001, 9.967609e-001, 9.970351e-001, 9.973094e-001, 9.975837e-001, 9.978552e-001, 9.981233e-001, 9.983914e-001, 9.986595e-001, 9.989276e-001,
+9.991957e-001, 9.994638e-001, 9.997319e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.597934e-002, 2.816508e-002, 3.875314e-002, 4.839088e-002, 5.733001e-002, 6.578159e-002, 7.385949e-002, 8.152916e-002, 8.895723e-002,
+9.611956e-002, 1.030589e-001, 1.097961e-001, 1.162500e-001, 1.224390e-001, 1.284389e-001, 1.342712e-001, 1.399544e-001, 1.454843e-001, 1.508464e-001,
+1.560681e-001, 1.611503e-001, 1.660998e-001, 1.709351e-001, 1.756565e-001, 1.802780e-001, 1.848101e-001, 1.892485e-001, 1.936013e-001, 1.978709e-001,
+2.020537e-001, 2.061594e-001, 2.101962e-001, 2.141589e-001, 2.180613e-001, 2.218960e-001, 2.256778e-001, 2.294042e-001, 2.330840e-001, 2.367097e-001,
+2.402736e-001, 2.437945e-001, 2.472652e-001, 2.506807e-001, 2.540545e-001, 2.573910e-001, 2.606758e-001, 2.639169e-001, 2.671265e-001, 2.702954e-001,
+2.734270e-001, 2.765175e-001, 2.795749e-001, 2.826111e-001, 2.856204e-001, 2.885941e-001, 2.915267e-001, 2.944279e-001, 2.973093e-001, 3.001667e-001,
+3.029935e-001, 3.057951e-001, 3.085729e-001, 3.113224e-001, 3.140394e-001, 3.167184e-001, 3.193724e-001, 3.220146e-001, 3.246418e-001, 3.272505e-001,
+3.298356e-001, 3.323947e-001, 3.349306e-001, 3.374487e-001, 3.399476e-001, 3.424271e-001, 3.448829e-001, 3.473187e-001, 3.497350e-001, 3.521294e-001,
+3.545057e-001, 3.568738e-001, 3.592340e-001, 3.615839e-001, 3.639226e-001, 3.662487e-001, 3.685598e-001, 3.708567e-001, 3.731353e-001, 3.753966e-001,
+3.776401e-001, 3.798611e-001, 3.820647e-001, 3.842560e-001, 3.864341e-001, 3.886001e-001, 3.907540e-001, 3.928949e-001, 3.950211e-001, 3.971338e-001,
+3.992327e-001, 4.013175e-001, 4.033867e-001, 4.054398e-001, 4.074775e-001, 4.094995e-001, 4.115055e-001, 4.134953e-001, 4.154728e-001, 4.174366e-001,
+4.193887e-001, 4.213280e-001, 4.232570e-001, 4.251774e-001, 4.270893e-001, 4.289929e-001, 4.308882e-001, 4.327754e-001, 4.346545e-001, 4.365256e-001,
+4.383888e-001, 4.402443e-001, 4.420921e-001, 4.439323e-001, 4.457650e-001, 4.475904e-001, 4.494084e-001, 4.512192e-001, 4.530229e-001, 4.548196e-001,
+4.566094e-001, 4.583923e-001, 4.601685e-001, 4.619381e-001, 4.637006e-001, 4.654562e-001, 4.672055e-001, 4.689484e-001, 4.706839e-001, 4.724109e-001,
+4.741292e-001, 4.758399e-001, 4.775410e-001, 4.792342e-001, 4.809193e-001, 4.825971e-001, 4.842678e-001, 4.859309e-001, 4.875870e-001, 4.892325e-001,
+4.908691e-001, 4.924972e-001, 4.941171e-001, 4.957280e-001, 4.973297e-001, 4.989242e-001, 5.005111e-001, 5.020899e-001, 5.036565e-001, 5.052154e-001,
+5.067668e-001, 5.083104e-001, 5.098451e-001, 5.113719e-001, 5.128925e-001, 5.144074e-001, 5.159106e-001, 5.174064e-001, 5.188954e-001, 5.203765e-001,
+5.218490e-001, 5.233149e-001, 5.247744e-001, 5.262219e-001, 5.276636e-001, 5.290997e-001, 5.305266e-001, 5.319476e-001, 5.333635e-001, 5.347705e-001,
+5.361696e-001, 5.375637e-001, 5.389505e-001, 5.403308e-001, 5.417067e-001, 5.430750e-001, 5.444362e-001, 5.457931e-001, 5.471433e-001, 5.484885e-001,
+5.498302e-001, 5.511658e-001, 5.524978e-001, 5.538250e-001, 5.551432e-001, 5.564572e-001, 5.577635e-001, 5.590627e-001, 5.603571e-001, 5.616439e-001,
+5.629272e-001, 5.642039e-001, 5.654767e-001, 5.667475e-001, 5.680089e-001, 5.692681e-001, 5.705222e-001, 5.717713e-001, 5.730166e-001, 5.742524e-001,
+5.754857e-001, 5.767115e-001, 5.779340e-001, 5.791510e-001, 5.803643e-001, 5.815750e-001, 5.827775e-001, 5.839779e-001, 5.851688e-001, 5.863572e-001,
+5.875378e-001, 5.887146e-001, 5.898860e-001, 5.910529e-001, 5.922165e-001, 5.933740e-001, 5.945292e-001, 5.956772e-001, 5.968239e-001, 5.979636e-001,
+5.991024e-001, 6.002334e-001, 6.013632e-001, 6.024865e-001, 6.036077e-001, 6.047217e-001, 6.058334e-001, 6.069394e-001, 6.080428e-001, 6.091407e-001,
+6.102351e-001, 6.113222e-001, 6.124071e-001, 6.134875e-001, 6.145649e-001, 6.156356e-001, 6.167044e-001, 6.177682e-001, 6.188302e-001, 6.198860e-001,
+6.209400e-001, 6.219862e-001, 6.230317e-001, 6.240709e-001, 6.251101e-001, 6.261411e-001, 6.271720e-001, 6.281969e-001, 6.292210e-001, 6.302380e-001,
+6.312527e-001, 6.322626e-001, 6.332694e-001, 6.342734e-001, 6.352738e-001, 6.362722e-001, 6.372647e-001, 6.382569e-001, 6.392408e-001, 6.402247e-001,
+6.412026e-001, 6.421791e-001, 6.431517e-001, 6.441212e-001, 6.450885e-001, 6.460511e-001, 6.470135e-001, 6.479677e-001, 6.489219e-001, 6.498695e-001,
+6.508147e-001, 6.517579e-001, 6.526981e-001, 6.536376e-001, 6.545693e-001, 6.555009e-001, 6.564256e-001, 6.573477e-001, 6.582675e-001, 6.591829e-001,
+6.600984e-001, 6.610057e-001, 6.619125e-001, 6.628168e-001, 6.637190e-001, 6.646204e-001, 6.655144e-001, 6.664084e-001, 6.672983e-001, 6.681859e-001,
+6.690727e-001, 6.699558e-001, 6.708389e-001, 6.717148e-001, 6.725872e-001, 6.734582e-001, 6.743216e-001, 6.751849e-001, 6.760440e-001, 6.769003e-001,
+6.777564e-001, 6.786073e-001, 6.794583e-001, 6.803077e-001, 6.811552e-001, 6.820027e-001, 6.828440e-001, 6.836843e-001, 6.845230e-001, 6.853569e-001,
+6.861907e-001, 6.870211e-001, 6.878491e-001, 6.886770e-001, 6.894986e-001, 6.903196e-001, 6.911390e-001, 6.919528e-001, 6.927667e-001, 6.935776e-001,
+6.943858e-001, 6.951940e-001, 6.959963e-001, 6.967968e-001, 6.975972e-001, 6.983887e-001, 6.991801e-001, 6.999704e-001, 7.007569e-001, 7.015433e-001,
+7.023270e-001, 7.031069e-001, 7.038868e-001, 7.046631e-001, 7.054370e-001, 7.062109e-001, 7.069805e-001, 7.077488e-001, 7.085171e-001, 7.092792e-001,
+7.100404e-001, 7.108017e-001, 7.115599e-001, 7.123181e-001, 7.130759e-001, 7.138281e-001, 7.145804e-001, 7.153319e-001, 7.160777e-001, 7.168235e-001,
+7.175689e-001, 7.183113e-001, 7.190537e-001, 7.197950e-001, 7.205299e-001, 7.212649e-001, 7.219992e-001, 7.227286e-001, 7.234581e-001, 7.241873e-001,
+7.249133e-001, 7.256393e-001, 7.263653e-001, 7.270826e-001, 7.277999e-001, 7.285172e-001, 7.292284e-001, 7.299389e-001, 7.306494e-001, 7.313563e-001,
+7.320620e-001, 7.327678e-001, 7.334702e-001, 7.341706e-001, 7.348710e-001, 7.355691e-001, 7.362643e-001, 7.369595e-001, 7.376533e-001, 7.383428e-001,
+7.390323e-001, 7.397217e-001, 7.404049e-001, 7.410882e-001, 7.417714e-001, 7.424500e-001, 7.431272e-001, 7.438043e-001, 7.444783e-001, 7.451489e-001,
+7.458194e-001, 7.464888e-001, 7.471522e-001, 7.478156e-001, 7.484790e-001, 7.491366e-001, 7.497931e-001, 7.504495e-001, 7.511045e-001, 7.517579e-001,
+7.524113e-001, 7.530643e-001, 7.537124e-001, 7.543605e-001, 7.550086e-001, 7.556518e-001, 7.562924e-001, 7.569330e-001, 7.575728e-001, 7.582098e-001,
+7.588467e-001, 7.594836e-001, 7.601164e-001, 7.607475e-001, 7.613786e-001, 7.620080e-001, 7.626310e-001, 7.632541e-001, 7.638771e-001, 7.644973e-001,
+7.651162e-001, 7.657350e-001, 7.663531e-001, 7.669656e-001, 7.675780e-001, 7.681905e-001, 7.688007e-001, 7.694089e-001, 7.700171e-001, 7.706252e-001,
+7.712315e-001, 7.718374e-001, 7.724434e-001, 7.730479e-001, 7.736473e-001, 7.742466e-001, 7.748460e-001, 7.754429e-001, 7.760378e-001, 7.766327e-001,
+7.772275e-001, 7.778203e-001, 7.784127e-001, 7.790051e-001, 7.795969e-001, 7.801825e-001, 7.807680e-001, 7.813536e-001, 7.819375e-001, 7.825172e-001,
+7.830970e-001, 7.836768e-001, 7.842544e-001, 7.848296e-001, 7.854048e-001, 7.859801e-001, 7.865509e-001, 7.871193e-001, 7.876876e-001, 7.882560e-001,
+7.888198e-001, 7.893823e-001, 7.899448e-001, 7.905073e-001, 7.910657e-001, 7.916236e-001, 7.921814e-001, 7.927392e-001, 7.932926e-001, 7.938457e-001,
+7.943987e-001, 7.949518e-001, 7.955004e-001, 7.960488e-001, 7.965972e-001, 7.971456e-001, 7.976897e-001, 7.982336e-001, 7.987774e-001, 7.993213e-001,
+7.998626e-001, 8.004036e-001, 8.009446e-001, 8.014857e-001, 8.020229e-001, 8.025594e-001, 8.030959e-001, 8.036323e-001, 8.041643e-001, 8.046946e-001,
+8.052249e-001, 8.057552e-001, 8.062841e-001, 8.068119e-001, 8.073398e-001, 8.078677e-001, 8.083938e-001, 8.089175e-001, 8.094412e-001, 8.099649e-001,
+8.104875e-001, 8.110054e-001, 8.115234e-001, 8.120413e-001, 8.125593e-001, 8.130753e-001, 8.135912e-001, 8.141071e-001, 8.146230e-001, 8.151364e-001,
+8.156485e-001, 8.161607e-001, 8.166728e-001, 8.171827e-001, 8.176885e-001, 8.181944e-001, 8.187002e-001, 8.192060e-001, 8.197085e-001, 8.202109e-001,
+8.207133e-001, 8.212158e-001, 8.217162e-001, 8.222154e-001, 8.227146e-001, 8.232137e-001, 8.237118e-001, 8.242052e-001, 8.246986e-001, 8.251919e-001,
+8.256853e-001, 8.261765e-001, 8.266669e-001, 8.271574e-001, 8.276478e-001, 8.281375e-001, 8.286252e-001, 8.291128e-001, 8.296005e-001, 8.300881e-001,
+8.305714e-001, 8.310527e-001, 8.315340e-001, 8.320154e-001, 8.324962e-001, 8.329733e-001, 8.334504e-001, 8.339275e-001, 8.344046e-001, 8.348806e-001,
+8.353556e-001, 8.358306e-001, 8.363055e-001, 8.367805e-001, 8.372507e-001, 8.377200e-001, 8.381894e-001, 8.386587e-001, 8.391273e-001, 8.395921e-001,
+8.400569e-001, 8.405218e-001, 8.409866e-001, 8.414501e-001, 8.419118e-001, 8.423735e-001, 8.428352e-001, 8.432969e-001, 8.437553e-001, 8.442122e-001,
+8.446690e-001, 8.451258e-001, 8.455827e-001, 8.460362e-001, 8.464892e-001, 8.469423e-001, 8.473953e-001, 8.478483e-001, 8.482989e-001, 8.487494e-001,
+8.492000e-001, 8.496506e-001, 8.501006e-001, 8.505470e-001, 8.509934e-001, 8.514399e-001, 8.518863e-001, 8.523321e-001, 8.527754e-001, 8.532187e-001,
+8.536620e-001, 8.541053e-001, 8.545482e-001, 8.549897e-001, 8.554312e-001, 8.558727e-001, 8.563142e-001, 8.567549e-001, 8.571930e-001, 8.576310e-001,
+8.580691e-001, 8.585072e-001, 8.589447e-001, 8.593794e-001, 8.598141e-001, 8.602489e-001, 8.606836e-001, 8.611180e-001, 8.615492e-001, 8.619803e-001,
+8.624115e-001, 8.628426e-001, 8.632738e-001, 8.637010e-001, 8.641281e-001, 8.645551e-001, 8.649821e-001, 8.654092e-001, 8.658344e-001, 8.662590e-001,
+8.666837e-001, 8.671083e-001, 8.675329e-001, 8.679561e-001, 8.683781e-001, 8.688000e-001, 8.692220e-001, 8.696440e-001, 8.700650e-001, 8.704838e-001,
+8.709025e-001, 8.713212e-001, 8.717400e-001, 8.721587e-001, 8.725745e-001, 8.729902e-001, 8.734059e-001, 8.738215e-001, 8.742372e-001, 8.746507e-001,
+8.750627e-001, 8.754748e-001, 8.758868e-001, 8.762988e-001, 8.767100e-001, 8.771181e-001, 8.775262e-001, 8.779343e-001, 8.783424e-001, 8.787505e-001,
+8.791569e-001, 8.795629e-001, 8.799688e-001, 8.803748e-001, 8.807808e-001, 8.811860e-001, 8.815892e-001, 8.819925e-001, 8.823957e-001, 8.827990e-001,
+8.832022e-001, 8.836026e-001, 8.840020e-001, 8.844014e-001, 8.848008e-001, 8.852002e-001, 8.855991e-001, 8.859958e-001, 8.863924e-001, 8.867891e-001,
+8.871858e-001, 8.875824e-001, 8.879782e-001, 8.883731e-001, 8.887681e-001, 8.891630e-001, 8.895580e-001, 8.899530e-001, 8.903455e-001, 8.907376e-001,
+8.911297e-001, 8.915218e-001, 8.919139e-001, 8.923055e-001, 8.926943e-001, 8.930830e-001, 8.934718e-001, 8.938605e-001, 8.942492e-001, 8.946374e-001,
+8.950244e-001, 8.954115e-001, 8.957985e-001, 8.961856e-001, 8.965726e-001, 8.969581e-001, 8.973423e-001, 8.977265e-001, 8.981108e-001, 8.984950e-001,
+8.988792e-001, 8.992601e-001, 8.996396e-001, 9.000191e-001, 9.003986e-001, 9.007781e-001, 9.011576e-001, 9.015354e-001, 9.019128e-001, 9.022902e-001,
+9.026676e-001, 9.030450e-001, 9.034224e-001, 9.037983e-001, 9.041740e-001, 9.045496e-001, 9.049253e-001, 9.053009e-001, 9.056766e-001, 9.060493e-001,
+9.064213e-001, 9.067933e-001, 9.071653e-001, 9.075373e-001, 9.079093e-001, 9.082794e-001, 9.086488e-001, 9.090182e-001, 9.093876e-001, 9.097570e-001,
+9.101264e-001, 9.104949e-001, 9.108627e-001, 9.112305e-001, 9.115984e-001, 9.119662e-001, 9.123341e-001, 9.127003e-001, 9.130646e-001, 9.134290e-001,
+9.137933e-001, 9.141577e-001, 9.145220e-001, 9.148856e-001, 9.152469e-001, 9.156082e-001, 9.159695e-001, 9.163308e-001, 9.166920e-001, 9.170533e-001,
+9.174141e-001, 9.177749e-001, 9.181356e-001, 9.184964e-001, 9.188571e-001, 9.192179e-001, 9.195770e-001, 9.199353e-001, 9.202937e-001, 9.206520e-001,
+9.210103e-001, 9.213687e-001, 9.217258e-001, 9.220798e-001, 9.224339e-001, 9.227880e-001, 9.231420e-001, 9.234961e-001, 9.238502e-001, 9.242027e-001,
+9.245550e-001, 9.249072e-001, 9.252595e-001, 9.256118e-001, 9.259641e-001, 9.263158e-001, 9.266667e-001, 9.270175e-001, 9.273684e-001, 9.277193e-001,
+9.280701e-001, 9.284210e-001, 9.287691e-001, 9.291167e-001, 9.294643e-001, 9.298120e-001, 9.301596e-001, 9.305072e-001, 9.308542e-001, 9.311996e-001,
+9.315450e-001, 9.318904e-001, 9.322357e-001, 9.325811e-001, 9.329265e-001, 9.332711e-001, 9.336152e-001, 9.339594e-001, 9.343035e-001, 9.346476e-001,
+9.349918e-001, 9.353359e-001, 9.356772e-001, 9.360182e-001, 9.363593e-001, 9.367004e-001, 9.370414e-001, 9.373825e-001, 9.377230e-001, 9.380606e-001,
+9.383983e-001, 9.387360e-001, 9.390736e-001, 9.394113e-001, 9.397490e-001, 9.400861e-001, 9.404222e-001, 9.407583e-001, 9.410944e-001, 9.414305e-001,
+9.417666e-001, 9.421028e-001, 9.424379e-001, 9.427720e-001, 9.431062e-001, 9.434403e-001, 9.437745e-001, 9.441086e-001, 9.444427e-001, 9.447755e-001,
+9.451073e-001, 9.454391e-001, 9.457709e-001, 9.461027e-001, 9.464344e-001, 9.467662e-001, 9.470977e-001, 9.474289e-001, 9.477601e-001, 9.480913e-001,
+9.484225e-001, 9.487537e-001, 9.490849e-001, 9.494156e-001, 9.497459e-001, 9.500762e-001, 9.504065e-001, 9.507368e-001, 9.510671e-001, 9.513974e-001,
+9.517257e-001, 9.520517e-001, 9.523778e-001, 9.527038e-001, 9.530298e-001, 9.533559e-001, 9.536819e-001, 9.540063e-001, 9.543273e-001, 9.546483e-001,
+9.549693e-001, 9.552902e-001, 9.556112e-001, 9.559322e-001, 9.562530e-001, 9.565722e-001, 9.568914e-001, 9.572107e-001, 9.575299e-001, 9.578491e-001,
+9.581684e-001, 9.584876e-001, 9.588049e-001, 9.591218e-001, 9.594387e-001, 9.597555e-001, 9.600724e-001, 9.603893e-001, 9.607062e-001, 9.610219e-001,
+9.613365e-001, 9.616511e-001, 9.619656e-001, 9.622802e-001, 9.625947e-001, 9.629093e-001, 9.632237e-001, 9.635366e-001, 9.638495e-001, 9.641624e-001,
+9.644753e-001, 9.647882e-001, 9.651012e-001, 9.654141e-001, 9.657256e-001, 9.660363e-001, 9.663470e-001, 9.666577e-001, 9.669683e-001, 9.672790e-001,
+9.675897e-001, 9.679001e-001, 9.682076e-001, 9.685152e-001, 9.688227e-001, 9.691302e-001, 9.694378e-001, 9.697453e-001, 9.700529e-001, 9.703593e-001,
+9.706647e-001, 9.709701e-001, 9.712755e-001, 9.715809e-001, 9.718863e-001, 9.721917e-001, 9.724971e-001, 9.728005e-001, 9.731037e-001, 9.734068e-001,
+9.737099e-001, 9.740130e-001, 9.743162e-001, 9.746193e-001, 9.749219e-001, 9.752221e-001, 9.755223e-001, 9.758224e-001, 9.761226e-001, 9.764227e-001,
+9.767229e-001, 9.770230e-001, 9.773221e-001, 9.776195e-001, 9.779169e-001, 9.782143e-001, 9.785117e-001, 9.788092e-001, 9.791066e-001, 9.794040e-001,
+9.796999e-001, 9.799946e-001, 9.802893e-001, 9.805839e-001, 9.808786e-001, 9.811733e-001, 9.814680e-001, 9.817627e-001, 9.820555e-001, 9.823472e-001,
+9.826390e-001, 9.829307e-001, 9.832225e-001, 9.835142e-001, 9.838059e-001, 9.840977e-001, 9.843874e-001, 9.846761e-001, 9.849648e-001, 9.852535e-001,
+9.855422e-001, 9.858309e-001, 9.861196e-001, 9.864083e-001, 9.866941e-001, 9.869784e-001, 9.872627e-001, 9.875470e-001, 9.878313e-001, 9.881156e-001,
+9.883999e-001, 9.886842e-001, 9.889654e-001, 9.892442e-001, 9.895229e-001, 9.898016e-001, 9.900803e-001, 9.903590e-001, 9.906377e-001, 9.909164e-001,
+9.911935e-001, 9.914678e-001, 9.917421e-001, 9.920164e-001, 9.922907e-001, 9.925650e-001, 9.928394e-001, 9.931137e-001, 9.933875e-001, 9.936579e-001,
+9.939283e-001, 9.941987e-001, 9.944691e-001, 9.947395e-001, 9.950099e-001, 9.952804e-001, 9.955508e-001, 9.958161e-001, 9.960803e-001, 9.963445e-001,
+9.966087e-001, 9.968729e-001, 9.971370e-001, 9.974012e-001, 9.976654e-001, 9.979274e-001, 9.981864e-001, 9.984455e-001, 9.987046e-001, 9.989637e-001,
+9.992228e-001, 9.994818e-001, 9.997409e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.128752e-002, 2.085943e-002, 2.915006e-002, 3.668224e-002, 4.368843e-002, 5.030079e-002, 5.659732e-002, 6.265890e-002, 6.851129e-002,
+7.418663e-002, 7.969450e-002, 8.503487e-002, 9.022342e-002, 9.526063e-002, 1.001623e-001, 1.049378e-001, 1.096133e-001, 1.141887e-001, 1.186479e-001,
+1.230128e-001, 1.272865e-001, 1.315001e-001, 1.356705e-001, 1.397946e-001, 1.438630e-001, 1.478591e-001, 1.517767e-001, 1.556076e-001, 1.593558e-001,
+1.630499e-001, 1.667019e-001, 1.703170e-001, 1.739034e-001, 1.774580e-001, 1.809788e-001, 1.844572e-001, 1.878991e-001, 1.913043e-001, 1.946663e-001,
+1.979884e-001, 2.012689e-001, 2.045136e-001, 2.077264e-001, 2.109076e-001, 2.140624e-001, 2.171907e-001, 2.202926e-001, 2.233645e-001, 2.264123e-001,
+2.294276e-001, 2.324117e-001, 2.353697e-001, 2.383049e-001, 2.412147e-001, 2.441016e-001, 2.469658e-001, 2.498014e-001, 2.526110e-001, 2.553978e-001,
+2.581652e-001, 2.609098e-001, 2.636330e-001, 2.663359e-001, 2.690129e-001, 2.716696e-001, 2.743076e-001, 2.769277e-001, 2.795312e-001, 2.821189e-001,
+2.846880e-001, 2.872358e-001, 2.897650e-001, 2.922780e-001, 2.947723e-001, 2.972482e-001, 2.997062e-001, 3.021450e-001, 3.045690e-001, 3.069755e-001,
+3.093620e-001, 3.117317e-001, 3.140854e-001, 3.164220e-001, 3.187407e-001, 3.210409e-001, 3.233255e-001, 3.255949e-001, 3.278453e-001, 3.300753e-001,
+3.322862e-001, 3.344800e-001, 3.366614e-001, 3.388288e-001, 3.409801e-001, 3.431150e-001, 3.452383e-001, 3.473502e-001, 3.494506e-001, 3.515371e-001,
+3.536098e-001, 3.556677e-001, 3.577110e-001, 3.597369e-001, 3.617466e-001, 3.637400e-001, 3.657153e-001, 3.676727e-001, 3.696179e-001, 3.715523e-001,
+3.734750e-001, 3.753845e-001, 3.772805e-001, 3.791654e-001, 3.810393e-001, 3.829012e-001, 3.847497e-001, 3.865840e-001, 3.884027e-001, 3.902073e-001,
+3.920000e-001, 3.937805e-001, 3.955484e-001, 3.973042e-001, 3.990490e-001, 4.007814e-001, 4.025042e-001, 4.042208e-001, 4.059314e-001, 4.076353e-001,
+4.093318e-001, 4.110204e-001, 4.127005e-001, 4.143716e-001, 4.160361e-001, 4.176951e-001, 4.193487e-001, 4.209964e-001, 4.226379e-001, 4.242731e-001,
+4.259015e-001, 4.275228e-001, 4.291365e-001, 4.307413e-001, 4.323381e-001, 4.339267e-001, 4.355069e-001, 4.370786e-001, 4.386404e-001, 4.401915e-001,
+4.417356e-001, 4.432739e-001, 4.448068e-001, 4.463338e-001, 4.478540e-001, 4.493685e-001, 4.508774e-001, 4.523807e-001, 4.538763e-001, 4.553655e-001,
+4.568488e-001, 4.583263e-001, 4.597958e-001, 4.612583e-001, 4.627147e-001, 4.641651e-001, 4.656063e-001, 4.670408e-001, 4.684692e-001, 4.698904e-001,
+4.713025e-001, 4.727083e-001, 4.741083e-001, 4.755015e-001, 4.768893e-001, 4.782725e-001, 4.796496e-001, 4.810226e-001, 4.823926e-001, 4.837583e-001,
+4.851197e-001, 4.864782e-001, 4.878326e-001, 4.891827e-001, 4.905301e-001, 4.918732e-001, 4.932124e-001, 4.945488e-001, 4.958792e-001, 4.972046e-001,
+4.985264e-001, 4.998417e-001, 5.011533e-001, 5.024605e-001, 5.037620e-001, 5.050605e-001, 5.063533e-001, 5.076420e-001, 5.089283e-001, 5.102070e-001,
+5.114836e-001, 5.127562e-001, 5.140226e-001, 5.152860e-001, 5.165406e-001, 5.177926e-001, 5.190387e-001, 5.202798e-001, 5.215176e-001, 5.227485e-001,
+5.239773e-001, 5.251996e-001, 5.264190e-001, 5.276340e-001, 5.288446e-001, 5.300526e-001, 5.312535e-001, 5.324526e-001, 5.336432e-001, 5.348318e-001,
+5.360147e-001, 5.371940e-001, 5.383686e-001, 5.395389e-001, 5.407065e-001, 5.418683e-001, 5.430282e-001, 5.441825e-001, 5.453361e-001, 5.464810e-001,
+5.476251e-001, 5.487617e-001, 5.498969e-001, 5.510259e-001, 5.521530e-001, 5.532746e-001, 5.543937e-001, 5.555071e-001, 5.566176e-001, 5.577221e-001,
+5.588241e-001, 5.599215e-001, 5.610161e-001, 5.621057e-001, 5.631932e-001, 5.642766e-001, 5.653580e-001, 5.664347e-001, 5.675101e-001, 5.685818e-001,
+5.696520e-001, 5.707165e-001, 5.717801e-001, 5.728380e-001, 5.738958e-001, 5.749465e-001, 5.759971e-001, 5.770409e-001, 5.780839e-001, 5.791225e-001,
+5.801597e-001, 5.811930e-001, 5.822239e-001, 5.832517e-001, 5.842757e-001, 5.852975e-001, 5.863136e-001, 5.873292e-001, 5.883370e-001, 5.893448e-001,
+5.903473e-001, 5.913487e-001, 5.923462e-001, 5.933410e-001, 5.943337e-001, 5.953222e-001, 5.963104e-001, 5.972914e-001, 5.982724e-001, 5.992499e-001,
+6.002262e-001, 6.011999e-001, 6.021703e-001, 6.031401e-001, 6.041048e-001, 6.050694e-001, 6.060275e-001, 6.069834e-001, 6.079360e-001, 6.088829e-001,
+6.098298e-001, 6.107699e-001, 6.117098e-001, 6.126457e-001, 6.135783e-001, 6.145103e-001, 6.154376e-001, 6.163650e-001, 6.172877e-001, 6.182081e-001,
+6.191274e-001, 6.200418e-001, 6.209562e-001, 6.218647e-001, 6.227705e-001, 6.236750e-001, 6.245732e-001, 6.254714e-001, 6.263654e-001, 6.272569e-001,
+6.281480e-001, 6.290338e-001, 6.299195e-001, 6.308029e-001, 6.316838e-001, 6.325647e-001, 6.334398e-001, 6.343143e-001, 6.351868e-001, 6.360538e-001,
+6.369209e-001, 6.377838e-001, 6.386440e-001, 6.395043e-001, 6.403582e-001, 6.412117e-001, 6.420641e-001, 6.429128e-001, 6.437615e-001, 6.446070e-001,
+6.454497e-001, 6.462923e-001, 6.471292e-001, 6.479646e-001, 6.487998e-001, 6.496288e-001, 6.504579e-001, 6.512850e-001, 6.521068e-001, 6.529285e-001,
+6.537483e-001, 6.545658e-001, 6.553832e-001, 6.561966e-001, 6.570076e-001, 6.578186e-001, 6.586262e-001, 6.594328e-001, 6.602394e-001, 6.610412e-001,
+6.618425e-001, 6.626437e-001, 6.634386e-001, 6.642334e-001, 6.650279e-001, 6.658184e-001, 6.666089e-001, 6.673982e-001, 6.681799e-001, 6.689617e-001,
+6.697422e-001, 6.705164e-001, 6.712906e-001, 6.720638e-001, 6.728317e-001, 6.735996e-001, 6.743668e-001, 6.751295e-001, 6.758922e-001, 6.766545e-001,
+6.774132e-001, 6.781719e-001, 6.789305e-001, 6.796818e-001, 6.804330e-001, 6.811843e-001, 6.819290e-001, 6.826732e-001, 6.834173e-001, 6.841576e-001,
+6.848968e-001, 6.856360e-001, 6.863722e-001, 6.871068e-001, 6.878414e-001, 6.885738e-001, 6.893038e-001, 6.900338e-001, 6.907623e-001, 6.914865e-001,
+6.922108e-001, 6.929348e-001, 6.936529e-001, 6.943709e-001, 6.950890e-001, 6.958045e-001, 6.965194e-001, 6.972343e-001, 6.979462e-001, 6.986552e-001,
+6.993641e-001, 7.000715e-001, 7.007719e-001, 7.014722e-001, 7.021726e-001, 7.028683e-001, 7.035631e-001, 7.042579e-001, 7.049499e-001, 7.056387e-001,
+7.063275e-001, 7.070160e-001, 7.077018e-001, 7.083876e-001, 7.090734e-001, 7.097554e-001, 7.104355e-001, 7.111155e-001, 7.117942e-001, 7.124679e-001,
+7.131415e-001, 7.138151e-001, 7.144856e-001, 7.151550e-001, 7.158244e-001, 7.164922e-001, 7.171549e-001, 7.178175e-001, 7.184802e-001, 7.191397e-001,
+7.197977e-001, 7.204558e-001, 7.211132e-001, 7.217659e-001, 7.224187e-001, 7.230715e-001, 7.237222e-001, 7.243710e-001, 7.250199e-001, 7.256687e-001,
+7.263153e-001, 7.269615e-001, 7.276078e-001, 7.282524e-001, 7.288915e-001, 7.295306e-001, 7.301696e-001, 7.308055e-001, 7.314387e-001, 7.320719e-001,
+7.327052e-001, 7.333346e-001, 7.339634e-001, 7.345921e-001, 7.352204e-001, 7.358439e-001, 7.364673e-001, 7.370908e-001, 7.377125e-001, 7.383305e-001,
+7.389486e-001, 7.395666e-001, 7.401825e-001, 7.407962e-001, 7.414099e-001, 7.420237e-001, 7.426350e-001, 7.432450e-001, 7.438551e-001, 7.444651e-001,
+7.450725e-001, 7.456792e-001, 7.462859e-001, 7.468926e-001, 7.474957e-001, 7.480982e-001, 7.487008e-001, 7.493033e-001, 7.499019e-001, 7.505001e-001,
+7.510984e-001, 7.516967e-001, 7.522919e-001, 7.528869e-001, 7.534820e-001, 7.540771e-001, 7.546678e-001, 7.552582e-001, 7.558486e-001, 7.564391e-001,
+7.570242e-001, 7.576089e-001, 7.581936e-001, 7.587783e-001, 7.593607e-001, 7.599426e-001, 7.605245e-001, 7.611064e-001, 7.616854e-001, 7.622634e-001,
+7.628415e-001, 7.634195e-001, 7.639943e-001, 7.645670e-001, 7.651397e-001, 7.657124e-001, 7.662833e-001, 7.668518e-001, 7.674203e-001, 7.679887e-001,
+7.685562e-001, 7.691203e-001, 7.696844e-001, 7.702485e-001, 7.708125e-001, 7.713752e-001, 7.719377e-001, 7.725003e-001, 7.730629e-001, 7.736230e-001,
+7.741820e-001, 7.747410e-001, 7.753000e-001, 7.758569e-001, 7.764102e-001, 7.769635e-001, 7.775169e-001, 7.780702e-001, 7.786207e-001, 7.791713e-001,
+7.797218e-001, 7.802724e-001, 7.808199e-001, 7.813656e-001, 7.819113e-001, 7.824570e-001, 7.830020e-001, 7.835443e-001, 7.840867e-001, 7.846290e-001,
+7.851714e-001, 7.857123e-001, 7.862527e-001, 7.867931e-001, 7.873336e-001, 7.878730e-001, 7.884095e-001, 7.889460e-001, 7.894825e-001, 7.900190e-001,
+7.905547e-001, 7.910900e-001, 7.916254e-001, 7.921607e-001, 7.926956e-001, 7.932278e-001, 7.937599e-001, 7.942921e-001, 7.948243e-001, 7.953537e-001,
+7.958807e-001, 7.964078e-001, 7.969348e-001, 7.974618e-001, 7.979867e-001, 7.985112e-001, 7.990358e-001, 7.995604e-001, 8.000842e-001, 8.006044e-001,
+8.011246e-001, 8.016448e-001, 8.021650e-001, 8.026838e-001, 8.032011e-001, 8.037183e-001, 8.042355e-001, 8.047528e-001, 8.052689e-001, 8.057846e-001,
+8.063002e-001, 8.068159e-001, 8.073315e-001, 8.078433e-001, 8.083545e-001, 8.088657e-001, 8.093769e-001, 8.098881e-001, 8.103969e-001, 8.109058e-001,
+8.114146e-001, 8.119235e-001, 8.124319e-001, 8.129381e-001, 8.134443e-001, 8.139504e-001, 8.144566e-001, 8.149621e-001, 8.154654e-001, 8.159686e-001,
+8.164719e-001, 8.169751e-001, 8.174781e-001, 8.179804e-001, 8.184827e-001, 8.189850e-001, 8.194873e-001, 8.199887e-001, 8.204873e-001, 8.209858e-001,
+8.214844e-001, 8.219830e-001, 8.224811e-001, 8.229773e-001, 8.234735e-001, 8.239697e-001, 8.244659e-001, 8.249620e-001, 8.254572e-001, 8.259524e-001,
+8.264475e-001, 8.269427e-001, 8.274379e-001, 8.279286e-001, 8.284192e-001, 8.289097e-001, 8.294003e-001, 8.298908e-001, 8.303788e-001, 8.308661e-001,
+8.313534e-001, 8.318406e-001, 8.323279e-001, 8.328141e-001, 8.332994e-001, 8.337847e-001, 8.342700e-001, 8.347553e-001, 8.352395e-001, 8.357211e-001,
+8.362026e-001, 8.366841e-001, 8.371656e-001, 8.376471e-001, 8.381274e-001, 8.386076e-001, 8.390878e-001, 8.395681e-001, 8.400483e-001, 8.405266e-001,
+8.410038e-001, 8.414809e-001, 8.419580e-001, 8.424352e-001, 8.429119e-001, 8.433872e-001, 8.438626e-001, 8.443379e-001, 8.448132e-001, 8.452885e-001,
+8.457635e-001, 8.462383e-001, 8.467131e-001, 8.471879e-001, 8.476627e-001, 8.481363e-001, 8.486071e-001, 8.490780e-001, 8.495488e-001, 8.500196e-001,
+8.504905e-001, 8.509593e-001, 8.514274e-001, 8.518955e-001, 8.523637e-001, 8.528318e-001, 8.532997e-001, 8.537664e-001, 8.542332e-001, 8.546999e-001,
+8.551666e-001, 8.556333e-001, 8.560983e-001, 8.565618e-001, 8.570253e-001, 8.574888e-001, 8.579523e-001, 8.584158e-001, 8.588787e-001, 8.593414e-001,
+8.598041e-001, 8.602668e-001, 8.607296e-001, 8.611919e-001, 8.616521e-001, 8.621123e-001, 8.625725e-001, 8.630327e-001, 8.634929e-001, 8.639521e-001,
+8.644095e-001, 8.648669e-001, 8.653244e-001, 8.657818e-001, 8.662392e-001, 8.666961e-001, 8.671525e-001, 8.676090e-001, 8.680654e-001, 8.685219e-001,
+8.689783e-001, 8.694334e-001, 8.698879e-001, 8.703425e-001, 8.707970e-001, 8.712515e-001, 8.717060e-001, 8.721609e-001, 8.726158e-001, 8.730708e-001,
+8.735257e-001, 8.739807e-001, 8.744356e-001, 8.748895e-001, 8.753431e-001, 8.757968e-001, 8.762505e-001, 8.767041e-001, 8.771578e-001, 8.776090e-001,
+8.780597e-001, 8.785104e-001, 8.789611e-001, 8.794118e-001, 8.798625e-001, 8.803127e-001, 8.807627e-001, 8.812127e-001, 8.816627e-001, 8.821127e-001,
+8.825628e-001, 8.830113e-001, 8.834590e-001, 8.839067e-001, 8.843544e-001, 8.848021e-001, 8.852498e-001, 8.856956e-001, 8.861393e-001, 8.865830e-001,
+8.870267e-001, 8.874704e-001, 8.879141e-001, 8.883573e-001, 8.887993e-001, 8.892413e-001, 8.896833e-001, 8.901253e-001, 8.905673e-001, 8.910093e-001,
+8.914495e-001, 8.918896e-001, 8.923298e-001, 8.927699e-001, 8.932100e-001, 8.936502e-001, 8.940906e-001, 8.945312e-001, 8.949717e-001, 8.954123e-001,
+8.958528e-001, 8.962934e-001, 8.967335e-001, 8.971729e-001, 8.976122e-001, 8.980515e-001, 8.984909e-001, 8.989302e-001, 8.993695e-001, 8.998064e-001,
+9.002429e-001, 9.006794e-001, 9.011158e-001, 9.015523e-001, 9.019888e-001, 9.024250e-001, 9.028609e-001, 9.032967e-001, 9.037326e-001, 9.041685e-001,
+9.046043e-001, 9.050402e-001, 9.054753e-001, 9.059104e-001, 9.063455e-001, 9.067806e-001, 9.072157e-001, 9.076508e-001, 9.080855e-001, 9.085192e-001,
+9.089530e-001, 9.093868e-001, 9.098205e-001, 9.102543e-001, 9.106880e-001, 9.111206e-001, 9.115526e-001, 9.119845e-001, 9.124164e-001, 9.128483e-001,
+9.132803e-001, 9.137122e-001, 9.141423e-001, 9.145722e-001, 9.150022e-001, 9.154322e-001, 9.158621e-001, 9.162921e-001, 9.167218e-001, 9.171506e-001,
+9.175793e-001, 9.180081e-001, 9.184369e-001, 9.188656e-001, 9.192944e-001, 9.197228e-001, 9.201507e-001, 9.205787e-001, 9.210066e-001, 9.214346e-001,
+9.218625e-001, 9.222904e-001, 9.227181e-001, 9.231454e-001, 9.235727e-001, 9.240001e-001, 9.244274e-001, 9.248547e-001, 9.252821e-001, 9.257092e-001,
+9.261361e-001, 9.265631e-001, 9.269900e-001, 9.274170e-001, 9.278439e-001, 9.282709e-001, 9.286978e-001, 9.291248e-001, 9.295518e-001, 9.299787e-001,
+9.304057e-001, 9.308327e-001, 9.312596e-001, 9.316855e-001, 9.321106e-001, 9.325357e-001, 9.329607e-001, 9.333858e-001, 9.338109e-001, 9.342359e-001,
+9.346598e-001, 9.350822e-001, 9.355047e-001, 9.359272e-001, 9.363497e-001, 9.367721e-001, 9.371946e-001, 9.376161e-001, 9.380356e-001, 9.384550e-001,
+9.388745e-001, 9.392940e-001, 9.397134e-001, 9.401329e-001, 9.405520e-001, 9.409686e-001, 9.413852e-001, 9.418018e-001, 9.422184e-001, 9.426350e-001,
+9.430516e-001, 9.434682e-001, 9.438833e-001, 9.442980e-001, 9.447128e-001, 9.451275e-001, 9.455423e-001, 9.459570e-001, 9.463718e-001, 9.467856e-001,
+9.471985e-001, 9.476114e-001, 9.480243e-001, 9.484372e-001, 9.488501e-001, 9.492629e-001, 9.496757e-001, 9.500876e-001, 9.504996e-001, 9.509115e-001,
+9.513234e-001, 9.517353e-001, 9.521472e-001, 9.525591e-001, 9.529703e-001, 9.533810e-001, 9.537917e-001, 9.542024e-001, 9.546131e-001, 9.550238e-001,
+9.554345e-001, 9.558450e-001, 9.562533e-001, 9.566616e-001, 9.570699e-001, 9.574782e-001, 9.578865e-001, 9.582948e-001, 9.587031e-001, 9.591104e-001,
+9.595170e-001, 9.599235e-001, 9.603301e-001, 9.607366e-001, 9.611432e-001, 9.615497e-001, 9.619563e-001, 9.623610e-001, 9.627655e-001, 9.631700e-001,
+9.635746e-001, 9.639791e-001, 9.643836e-001, 9.647881e-001, 9.651921e-001, 9.655940e-001, 9.659960e-001, 9.663979e-001, 9.667998e-001, 9.672017e-001,
+9.676036e-001, 9.680055e-001, 9.684067e-001, 9.688067e-001, 9.692067e-001, 9.696067e-001, 9.700067e-001, 9.704067e-001, 9.708068e-001, 9.712068e-001,
+9.716058e-001, 9.720042e-001, 9.724025e-001, 9.728008e-001, 9.731991e-001, 9.735975e-001, 9.739958e-001, 9.743941e-001, 9.747913e-001, 9.751878e-001,
+9.755843e-001, 9.759808e-001, 9.763773e-001, 9.767738e-001, 9.771704e-001, 9.775669e-001, 9.779617e-001, 9.783557e-001, 9.787497e-001, 9.791437e-001,
+9.795376e-001, 9.799316e-001, 9.803256e-001, 9.807196e-001, 9.811128e-001, 9.815055e-001, 9.818982e-001, 9.822909e-001, 9.826836e-001, 9.830764e-001,
+9.834691e-001, 9.838618e-001, 9.842537e-001, 9.846450e-001, 9.850362e-001, 9.854275e-001, 9.858188e-001, 9.862100e-001, 9.866013e-001, 9.869925e-001,
+9.873834e-001, 9.877734e-001, 9.881635e-001, 9.885535e-001, 9.889436e-001, 9.893336e-001, 9.897237e-001, 9.901137e-001, 9.905033e-001, 9.908893e-001,
+9.912753e-001, 9.916613e-001, 9.920473e-001, 9.924332e-001, 9.928192e-001, 9.932052e-001, 9.935912e-001, 9.939712e-001, 9.943499e-001, 9.947286e-001,
+9.951073e-001, 9.954860e-001, 9.958647e-001, 9.962433e-001, 9.966220e-001, 9.969991e-001, 9.973742e-001, 9.977493e-001, 9.981244e-001, 9.984996e-001,
+9.988747e-001, 9.992498e-001, 9.996249e-001, 1.000000e+000)),
+("Agfa", "Agfacolor Vista 800", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.851000e-002, 3.119508e-002, 4.177977e-002, 5.125320e-002, 6.004187e-002, 6.833602e-002, 7.625019e-002, 8.386618e-002, 9.131669e-002,
+9.860842e-002, 1.057450e-001, 1.127896e-001, 1.197260e-001, 1.265024e-001, 1.330948e-001, 1.394810e-001, 1.456708e-001, 1.516747e-001, 1.575196e-001,
+1.632244e-001, 1.688113e-001, 1.742866e-001, 1.796313e-001, 1.848537e-001, 1.899530e-001, 1.949339e-001, 1.998193e-001, 2.046056e-001, 2.093107e-001,
+2.139423e-001, 2.184966e-001, 2.229669e-001, 2.273671e-001, 2.316878e-001, 2.359404e-001, 2.401208e-001, 2.442405e-001, 2.482960e-001, 2.522906e-001,
+2.562406e-001, 2.601419e-001, 2.639908e-001, 2.677909e-001, 2.715433e-001, 2.752491e-001, 2.789068e-001, 2.825185e-001, 2.860871e-001, 2.896127e-001,
+2.930984e-001, 2.965483e-001, 2.999581e-001, 3.033217e-001, 3.066503e-001, 3.099427e-001, 3.132070e-001, 3.164420e-001, 3.196372e-001, 3.228017e-001,
+3.259348e-001, 3.290333e-001, 3.321030e-001, 3.351434e-001, 3.381536e-001, 3.411369e-001, 3.440905e-001, 3.470190e-001, 3.499220e-001, 3.528008e-001,
+3.556518e-001, 3.584778e-001, 3.612777e-001, 3.640502e-001, 3.667985e-001, 3.695279e-001, 3.722385e-001, 3.749296e-001, 3.776003e-001, 3.802514e-001,
+3.828812e-001, 3.854868e-001, 3.880729e-001, 3.906361e-001, 3.931770e-001, 3.956986e-001, 3.982034e-001, 4.006922e-001, 4.031598e-001, 4.056158e-001,
+4.080604e-001, 4.104911e-001, 4.129078e-001, 4.153085e-001, 4.176962e-001, 4.200707e-001, 4.224311e-001, 4.247764e-001, 4.271036e-001, 4.294144e-001,
+4.317080e-001, 4.339860e-001, 4.362483e-001, 4.384947e-001, 4.407279e-001, 4.429493e-001, 4.451586e-001, 4.473554e-001, 4.495383e-001, 4.517079e-001,
+4.538641e-001, 4.560067e-001, 4.581355e-001, 4.602502e-001, 4.623506e-001, 4.644348e-001, 4.665005e-001, 4.685484e-001, 4.705810e-001, 4.725970e-001,
+4.745943e-001, 4.765746e-001, 4.785370e-001, 4.804831e-001, 4.824161e-001, 4.843369e-001, 4.862442e-001, 4.881369e-001, 4.900162e-001, 4.918822e-001,
+4.937360e-001, 4.955778e-001, 4.974072e-001, 4.992233e-001, 5.010253e-001, 5.028162e-001, 5.045911e-001, 5.063520e-001, 5.080994e-001, 5.098353e-001,
+5.115584e-001, 5.132682e-001, 5.149655e-001, 5.166511e-001, 5.183221e-001, 5.199795e-001, 5.216262e-001, 5.232623e-001, 5.248879e-001, 5.265035e-001,
+5.281016e-001, 5.296890e-001, 5.312657e-001, 5.328325e-001, 5.343910e-001, 5.359357e-001, 5.374701e-001, 5.389944e-001, 5.405091e-001, 5.420141e-001,
+5.435105e-001, 5.449982e-001, 5.464765e-001, 5.479414e-001, 5.493954e-001, 5.508414e-001, 5.522798e-001, 5.537052e-001, 5.551214e-001, 5.565287e-001,
+5.579245e-001, 5.593087e-001, 5.606855e-001, 5.620553e-001, 5.634168e-001, 5.647714e-001, 5.661194e-001, 5.674556e-001, 5.687829e-001, 5.701043e-001,
+5.714180e-001, 5.727239e-001, 5.740242e-001, 5.753161e-001, 5.766008e-001, 5.778805e-001, 5.791520e-001, 5.804169e-001, 5.816771e-001, 5.829272e-001,
+5.841702e-001, 5.854084e-001, 5.866374e-001, 5.878624e-001, 5.890823e-001, 5.902937e-001, 5.915008e-001, 5.926989e-001, 5.938925e-001, 5.950832e-001,
+5.962653e-001, 5.974434e-001, 5.986136e-001, 5.997778e-001, 6.009388e-001, 6.020932e-001, 6.032456e-001, 6.043936e-001, 6.055356e-001, 6.066730e-001,
+6.078019e-001, 6.089282e-001, 6.100460e-001, 6.111603e-001, 6.122679e-001, 6.133709e-001, 6.144707e-001, 6.155622e-001, 6.166515e-001, 6.177281e-001,
+6.188026e-001, 6.198687e-001, 6.209320e-001, 6.219904e-001, 6.230461e-001, 6.240994e-001, 6.251473e-001, 6.261926e-001, 6.272297e-001, 6.282648e-001,
+6.292926e-001, 6.303197e-001, 6.313399e-001, 6.323593e-001, 6.333720e-001, 6.343832e-001, 6.353876e-001, 6.363900e-001, 6.373852e-001, 6.383781e-001,
+6.393638e-001, 6.403476e-001, 6.413263e-001, 6.423033e-001, 6.432761e-001, 6.442464e-001, 6.452097e-001, 6.461710e-001, 6.471257e-001, 6.480792e-001,
+6.490264e-001, 6.499728e-001, 6.509123e-001, 6.518515e-001, 6.527829e-001, 6.537143e-001, 6.546377e-001, 6.555604e-001, 6.564759e-001, 6.573897e-001,
+6.582992e-001, 6.592067e-001, 6.601100e-001, 6.610093e-001, 6.619053e-001, 6.627947e-001, 6.636829e-001, 6.645650e-001, 6.654471e-001, 6.663235e-001,
+6.671995e-001, 6.680691e-001, 6.689362e-001, 6.697994e-001, 6.706585e-001, 6.715161e-001, 6.723683e-001, 6.732206e-001, 6.740665e-001, 6.749119e-001,
+6.757529e-001, 6.765913e-001, 6.774273e-001, 6.782583e-001, 6.790893e-001, 6.799132e-001, 6.807368e-001, 6.815575e-001, 6.823765e-001, 6.831940e-001,
+6.840069e-001, 6.848198e-001, 6.856262e-001, 6.864315e-001, 6.872346e-001, 6.880348e-001, 6.888350e-001, 6.896290e-001, 6.904229e-001, 6.912126e-001,
+6.919985e-001, 6.927842e-001, 6.935648e-001, 6.943454e-001, 6.951224e-001, 6.958964e-001, 6.966702e-001, 6.974359e-001, 6.982017e-001, 6.989647e-001,
+6.997249e-001, 7.004850e-001, 7.012412e-001, 7.019971e-001, 7.027515e-001, 7.035032e-001, 7.042549e-001, 7.050037e-001, 7.057514e-001, 7.064986e-001,
+7.072421e-001, 7.079855e-001, 7.087271e-001, 7.094665e-001, 7.102058e-001, 7.109421e-001, 7.116775e-001, 7.124125e-001, 7.131438e-001, 7.138750e-001,
+7.146042e-001, 7.153301e-001, 7.160560e-001, 7.167779e-001, 7.174976e-001, 7.182173e-001, 7.189335e-001, 7.196493e-001, 7.203645e-001, 7.210752e-001,
+7.217859e-001, 7.224943e-001, 7.231977e-001, 7.239011e-001, 7.246015e-001, 7.252988e-001, 7.259961e-001, 7.266905e-001, 7.273832e-001, 7.280758e-001,
+7.287634e-001, 7.294492e-001, 7.301351e-001, 7.308162e-001, 7.314966e-001, 7.321769e-001, 7.328533e-001, 7.335294e-001, 7.342055e-001, 7.348755e-001,
+7.355454e-001, 7.362152e-001, 7.368800e-001, 7.375448e-001, 7.382096e-001, 7.388706e-001, 7.395317e-001, 7.401927e-001, 7.408468e-001, 7.415009e-001,
+7.421549e-001, 7.428026e-001, 7.434499e-001, 7.440972e-001, 7.447417e-001, 7.453858e-001, 7.460299e-001, 7.466691e-001, 7.473069e-001, 7.479446e-001,
+7.485784e-001, 7.492100e-001, 7.498416e-001, 7.504719e-001, 7.511010e-001, 7.517300e-001, 7.523571e-001, 7.529804e-001, 7.536037e-001, 7.542262e-001,
+7.548427e-001, 7.554592e-001, 7.560757e-001, 7.566885e-001, 7.573008e-001, 7.579132e-001, 7.585224e-001, 7.591298e-001, 7.597372e-001, 7.603426e-001,
+7.609441e-001, 7.615456e-001, 7.621469e-001, 7.627451e-001, 7.633432e-001, 7.639414e-001, 7.645366e-001, 7.651306e-001, 7.657246e-001, 7.663164e-001,
+7.669041e-001, 7.674917e-001, 7.680794e-001, 7.686626e-001, 7.692456e-001, 7.698286e-001, 7.704099e-001, 7.709896e-001, 7.715693e-001, 7.721486e-001,
+7.727230e-001, 7.732973e-001, 7.738716e-001, 7.744430e-001, 7.750124e-001, 7.755817e-001, 7.761507e-001, 7.767156e-001, 7.772805e-001, 7.778455e-001,
+7.784080e-001, 7.789686e-001, 7.795292e-001, 7.800899e-001, 7.806467e-001, 7.812034e-001, 7.817602e-001, 7.823156e-001, 7.828690e-001, 7.834224e-001,
+7.839757e-001, 7.845266e-001, 7.850767e-001, 7.856268e-001, 7.861765e-001, 7.867226e-001, 7.872688e-001, 7.878149e-001, 7.883592e-001, 7.889011e-001,
+7.894430e-001, 7.899848e-001, 7.905252e-001, 7.910649e-001, 7.916047e-001, 7.921444e-001, 7.926815e-001, 7.932184e-001, 7.937554e-001, 7.942915e-001,
+7.948241e-001, 7.953568e-001, 7.958895e-001, 7.964202e-001, 7.969479e-001, 7.974756e-001, 7.980033e-001, 7.985295e-001, 7.990544e-001, 7.995794e-001,
+8.001043e-001, 8.006264e-001, 8.011472e-001, 8.016679e-001, 8.021887e-001, 8.027051e-001, 8.032203e-001, 8.037354e-001, 8.042506e-001, 8.047628e-001,
+8.052744e-001, 8.057860e-001, 8.062975e-001, 8.068055e-001, 8.073129e-001, 8.078203e-001, 8.083278e-001, 8.088304e-001, 8.093322e-001, 8.098341e-001,
+8.103359e-001, 8.108343e-001, 8.113318e-001, 8.118294e-001, 8.123269e-001, 8.128223e-001, 8.133169e-001, 8.138115e-001, 8.143061e-001, 8.147980e-001,
+8.152884e-001, 8.157787e-001, 8.162691e-001, 8.167579e-001, 8.172453e-001, 8.177326e-001, 8.182200e-001, 8.187068e-001, 8.191924e-001, 8.196780e-001,
+8.201637e-001, 8.206488e-001, 8.211303e-001, 8.216119e-001, 8.220934e-001, 8.225750e-001, 8.230517e-001, 8.235279e-001, 8.240040e-001, 8.244801e-001,
+8.249553e-001, 8.254299e-001, 8.259045e-001, 8.263791e-001, 8.268528e-001, 8.273245e-001, 8.277962e-001, 8.282679e-001, 8.287396e-001, 8.292063e-001,
+8.296728e-001, 8.301393e-001, 8.306058e-001, 8.310711e-001, 8.315354e-001, 8.319998e-001, 8.324642e-001, 8.329283e-001, 8.333911e-001, 8.338539e-001,
+8.343166e-001, 8.347794e-001, 8.352388e-001, 8.356967e-001, 8.361547e-001, 8.366126e-001, 8.370696e-001, 8.375232e-001, 8.379768e-001, 8.384304e-001,
+8.388839e-001, 8.393366e-001, 8.397888e-001, 8.402411e-001, 8.406933e-001, 8.411452e-001, 8.415938e-001, 8.420425e-001, 8.424912e-001, 8.429399e-001,
+8.433865e-001, 8.438312e-001, 8.442758e-001, 8.447205e-001, 8.451652e-001, 8.456083e-001, 8.460512e-001, 8.464941e-001, 8.469370e-001, 8.473795e-001,
+8.478203e-001, 8.482610e-001, 8.487017e-001, 8.491424e-001, 8.495807e-001, 8.500162e-001, 8.504516e-001, 8.508870e-001, 8.513224e-001, 8.517557e-001,
+8.521881e-001, 8.526205e-001, 8.530528e-001, 8.534852e-001, 8.539168e-001, 8.543483e-001, 8.547798e-001, 8.552113e-001, 8.556427e-001, 8.560703e-001,
+8.564978e-001, 8.569254e-001, 8.573530e-001, 8.577799e-001, 8.582031e-001, 8.586263e-001, 8.590495e-001, 8.594727e-001, 8.598954e-001, 8.603164e-001,
+8.607374e-001, 8.611585e-001, 8.615795e-001, 8.619998e-001, 8.624182e-001, 8.628366e-001, 8.632551e-001, 8.636735e-001, 8.640908e-001, 8.645054e-001,
+8.649199e-001, 8.653344e-001, 8.657490e-001, 8.661630e-001, 8.665751e-001, 8.669872e-001, 8.673993e-001, 8.678115e-001, 8.682234e-001, 8.686344e-001,
+8.690453e-001, 8.694563e-001, 8.698672e-001, 8.702781e-001, 8.706849e-001, 8.710918e-001, 8.714986e-001, 8.719054e-001, 8.723123e-001, 8.727166e-001,
+8.731205e-001, 8.735244e-001, 8.739284e-001, 8.743323e-001, 8.747353e-001, 8.751378e-001, 8.755402e-001, 8.759427e-001, 8.763452e-001, 8.767466e-001,
+8.771464e-001, 8.775461e-001, 8.779459e-001, 8.783457e-001, 8.787451e-001, 8.791409e-001, 8.795366e-001, 8.799324e-001, 8.803282e-001, 8.807239e-001,
+8.811178e-001, 8.815110e-001, 8.819042e-001, 8.822974e-001, 8.826907e-001, 8.830834e-001, 8.834752e-001, 8.838671e-001, 8.842590e-001, 8.846508e-001,
+8.850427e-001, 8.854307e-001, 8.858184e-001, 8.862061e-001, 8.865937e-001, 8.869814e-001, 8.873678e-001, 8.877525e-001, 8.881371e-001, 8.885218e-001,
+8.889065e-001, 8.892911e-001, 8.896743e-001, 8.900574e-001, 8.904405e-001, 8.908236e-001, 8.912066e-001, 8.915888e-001, 8.919690e-001, 8.923493e-001,
+8.927295e-001, 8.931098e-001, 8.934900e-001, 8.938674e-001, 8.942435e-001, 8.946197e-001, 8.949959e-001, 8.953721e-001, 8.957481e-001, 8.961216e-001,
+8.964951e-001, 8.968686e-001, 8.972421e-001, 8.976156e-001, 8.979886e-001, 8.983605e-001, 8.987325e-001, 8.991045e-001, 8.994765e-001, 8.998485e-001,
+9.002189e-001, 9.005881e-001, 9.009574e-001, 9.013267e-001, 9.016959e-001, 9.020652e-001, 9.024327e-001, 9.027998e-001, 9.031669e-001, 9.035340e-001,
+9.039011e-001, 9.042682e-001, 9.046338e-001, 9.049992e-001, 9.053647e-001, 9.057301e-001, 9.060956e-001, 9.064609e-001, 9.068236e-001, 9.071862e-001,
+9.075488e-001, 9.079115e-001, 9.082741e-001, 9.086365e-001, 9.089967e-001, 9.093568e-001, 9.097169e-001, 9.100770e-001, 9.104372e-001, 9.107972e-001,
+9.111555e-001, 9.115139e-001, 9.118723e-001, 9.122306e-001, 9.125890e-001, 9.129473e-001, 9.133043e-001, 9.136612e-001, 9.140181e-001, 9.143750e-001,
+9.147319e-001, 9.150888e-001, 9.154434e-001, 9.157977e-001, 9.161520e-001, 9.165063e-001, 9.168606e-001, 9.172149e-001, 9.175676e-001, 9.179198e-001,
+9.182720e-001, 9.186242e-001, 9.189765e-001, 9.193287e-001, 9.196800e-001, 9.200307e-001, 9.203813e-001, 9.207320e-001, 9.210826e-001, 9.214332e-001,
+9.217831e-001, 9.221310e-001, 9.224789e-001, 9.228269e-001, 9.231748e-001, 9.235228e-001, 9.238707e-001, 9.242162e-001, 9.245618e-001, 9.249073e-001,
+9.252528e-001, 9.255984e-001, 9.259439e-001, 9.262884e-001, 9.266322e-001, 9.269761e-001, 9.273199e-001, 9.276638e-001, 9.280076e-001, 9.283512e-001,
+9.286936e-001, 9.290361e-001, 9.293785e-001, 9.297210e-001, 9.300634e-001, 9.304059e-001, 9.307464e-001, 9.310864e-001, 9.314263e-001, 9.317663e-001,
+9.321063e-001, 9.324462e-001, 9.327857e-001, 9.331236e-001, 9.334616e-001, 9.337995e-001, 9.341375e-001, 9.344754e-001, 9.348134e-001, 9.351503e-001,
+9.354867e-001, 9.358232e-001, 9.361596e-001, 9.364961e-001, 9.368325e-001, 9.371688e-001, 9.375027e-001, 9.378365e-001, 9.381704e-001, 9.385042e-001,
+9.388381e-001, 9.391719e-001, 9.395049e-001, 9.398364e-001, 9.401680e-001, 9.404995e-001, 9.408311e-001, 9.411626e-001, 9.414941e-001, 9.418247e-001,
+9.421546e-001, 9.424845e-001, 9.428144e-001, 9.431444e-001, 9.434743e-001, 9.438042e-001, 9.441330e-001, 9.444616e-001, 9.447902e-001, 9.451188e-001,
+9.454474e-001, 9.457759e-001, 9.461045e-001, 9.464307e-001, 9.467569e-001, 9.470831e-001, 9.474093e-001, 9.477355e-001, 9.480617e-001, 9.483877e-001,
+9.487119e-001, 9.490362e-001, 9.493605e-001, 9.496847e-001, 9.500090e-001, 9.503333e-001, 9.506573e-001, 9.509802e-001, 9.513030e-001, 9.516258e-001,
+9.519486e-001, 9.522714e-001, 9.525942e-001, 9.529168e-001, 9.532371e-001, 9.535575e-001, 9.538778e-001, 9.541981e-001, 9.545184e-001, 9.548388e-001,
+9.551590e-001, 9.554758e-001, 9.557926e-001, 9.561094e-001, 9.564262e-001, 9.567429e-001, 9.570597e-001, 9.573765e-001, 9.576883e-001, 9.579993e-001,
+9.583104e-001, 9.586215e-001, 9.589326e-001, 9.592437e-001, 9.595548e-001, 9.598626e-001, 9.601691e-001, 9.604755e-001, 9.607819e-001, 9.610883e-001,
+9.613947e-001, 9.617011e-001, 9.620065e-001, 9.623105e-001, 9.626145e-001, 9.629185e-001, 9.632224e-001, 9.635264e-001, 9.638304e-001, 9.641342e-001,
+9.644363e-001, 9.647383e-001, 9.650404e-001, 9.653425e-001, 9.656446e-001, 9.659467e-001, 9.662488e-001, 9.665490e-001, 9.668485e-001, 9.671481e-001,
+9.674476e-001, 9.677472e-001, 9.680467e-001, 9.683463e-001, 9.686447e-001, 9.689406e-001, 9.692365e-001, 9.695324e-001, 9.698283e-001, 9.701242e-001,
+9.704202e-001, 9.707161e-001, 9.710099e-001, 9.713031e-001, 9.715964e-001, 9.718896e-001, 9.721829e-001, 9.724761e-001, 9.727694e-001, 9.730620e-001,
+9.733524e-001, 9.736429e-001, 9.739333e-001, 9.742237e-001, 9.745142e-001, 9.748046e-001, 9.750951e-001, 9.753833e-001, 9.756699e-001, 9.759566e-001,
+9.762432e-001, 9.765299e-001, 9.768166e-001, 9.771032e-001, 9.773899e-001, 9.776730e-001, 9.779558e-001, 9.782386e-001, 9.785215e-001, 9.788043e-001,
+9.790871e-001, 9.793699e-001, 9.796521e-001, 9.799310e-001, 9.802099e-001, 9.804888e-001, 9.807677e-001, 9.810467e-001, 9.813256e-001, 9.816045e-001,
+9.818818e-001, 9.821562e-001, 9.824305e-001, 9.827048e-001, 9.829792e-001, 9.832535e-001, 9.835279e-001, 9.838022e-001, 9.840744e-001, 9.843440e-001,
+9.846137e-001, 9.848834e-001, 9.851531e-001, 9.854228e-001, 9.856924e-001, 9.859621e-001, 9.862292e-001, 9.864938e-001, 9.867584e-001, 9.870230e-001,
+9.872876e-001, 9.875522e-001, 9.878168e-001, 9.880814e-001, 9.883427e-001, 9.886008e-001, 9.888589e-001, 9.891169e-001, 9.893750e-001, 9.896331e-001,
+9.898911e-001, 9.901492e-001, 9.904045e-001, 9.906560e-001, 9.909075e-001, 9.911590e-001, 9.914105e-001, 9.916621e-001, 9.919136e-001, 9.921651e-001,
+9.924147e-001, 9.926594e-001, 9.929041e-001, 9.931489e-001, 9.933936e-001, 9.936383e-001, 9.938830e-001, 9.941277e-001, 9.943718e-001, 9.946070e-001,
+9.948422e-001, 9.950774e-001, 9.953126e-001, 9.955478e-001, 9.957830e-001, 9.960182e-001, 9.962534e-001, 9.964800e-001, 9.967042e-001, 9.969283e-001,
+9.971525e-001, 9.973766e-001, 9.976007e-001, 9.978249e-001, 9.980490e-001, 9.982699e-001, 9.984861e-001, 9.987024e-001, 9.989187e-001, 9.991349e-001,
+9.993512e-001, 9.995675e-001, 9.997837e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.643192e-002, 2.766859e-002, 3.722330e-002, 4.584454e-002, 5.384783e-002, 6.142364e-002, 6.868394e-002, 7.568448e-002, 8.249760e-002,
+8.920316e-002, 9.582650e-002, 1.024202e-001, 1.089596e-001, 1.154130e-001, 1.217322e-001, 1.279037e-001, 1.339248e-001, 1.397917e-001, 1.455152e-001,
+1.510862e-001, 1.565373e-001, 1.618628e-001, 1.670635e-001, 1.721492e-001, 1.771178e-001, 1.819809e-001, 1.867359e-001, 1.913896e-001, 1.959586e-001,
+2.004474e-001, 2.048527e-001, 2.091724e-001, 2.134198e-001, 2.175989e-001, 2.217055e-001, 2.257482e-001, 2.297321e-001, 2.336589e-001, 2.375232e-001,
+2.413285e-001, 2.450881e-001, 2.487992e-001, 2.524616e-001, 2.560824e-001, 2.596504e-001, 2.631703e-001, 2.666491e-001, 2.700852e-001, 2.734857e-001,
+2.768476e-001, 2.801684e-001, 2.834582e-001, 2.867042e-001, 2.899151e-001, 2.930944e-001, 2.962363e-001, 2.993450e-001, 3.024171e-001, 3.054632e-001,
+3.084770e-001, 3.114668e-001, 3.144360e-001, 3.173774e-001, 3.202837e-001, 3.231654e-001, 3.260202e-001, 3.288543e-001, 3.316699e-001, 3.344615e-001,
+3.372255e-001, 3.399675e-001, 3.426899e-001, 3.453918e-001, 3.480694e-001, 3.507239e-001, 3.533582e-001, 3.559763e-001, 3.585733e-001, 3.611461e-001,
+3.637026e-001, 3.662397e-001, 3.687601e-001, 3.712593e-001, 3.737433e-001, 3.762117e-001, 3.786646e-001, 3.811041e-001, 3.835237e-001, 3.859252e-001,
+3.883083e-001, 3.906768e-001, 3.930304e-001, 3.953729e-001, 3.977056e-001, 4.000267e-001, 4.023346e-001, 4.046273e-001, 4.069069e-001, 4.091729e-001,
+4.114242e-001, 4.136590e-001, 4.158794e-001, 4.180857e-001, 4.202806e-001, 4.224628e-001, 4.246312e-001, 4.267887e-001, 4.289326e-001, 4.310676e-001,
+4.331924e-001, 4.353079e-001, 4.374152e-001, 4.395133e-001, 4.416011e-001, 4.436782e-001, 4.457430e-001, 4.477992e-001, 4.498447e-001, 4.518814e-001,
+4.539059e-001, 4.559206e-001, 4.579219e-001, 4.599123e-001, 4.618885e-001, 4.638526e-001, 4.658051e-001, 4.677474e-001, 4.696780e-001, 4.715974e-001,
+4.735073e-001, 4.754084e-001, 4.772998e-001, 4.791796e-001, 4.810472e-001, 4.829035e-001, 4.847469e-001, 4.865756e-001, 4.883880e-001, 4.901870e-001,
+4.919714e-001, 4.937417e-001, 4.954992e-001, 4.972419e-001, 4.989712e-001, 5.006884e-001, 5.023960e-001, 5.040933e-001, 5.057805e-001, 5.074588e-001,
+5.091218e-001, 5.107734e-001, 5.124161e-001, 5.140507e-001, 5.156768e-001, 5.172935e-001, 5.189024e-001, 5.205038e-001, 5.220975e-001, 5.236792e-001,
+5.252535e-001, 5.268201e-001, 5.283791e-001, 5.299316e-001, 5.314735e-001, 5.330084e-001, 5.345366e-001, 5.360545e-001, 5.375661e-001, 5.390714e-001,
+5.405686e-001, 5.420556e-001, 5.435367e-001, 5.450119e-001, 5.464771e-001, 5.479346e-001, 5.493863e-001, 5.508308e-001, 5.522681e-001, 5.537011e-001,
+5.551289e-001, 5.565507e-001, 5.579689e-001, 5.593820e-001, 5.607866e-001, 5.621856e-001, 5.635760e-001, 5.649588e-001, 5.663369e-001, 5.677073e-001,
+5.690726e-001, 5.704343e-001, 5.717855e-001, 5.731320e-001, 5.744731e-001, 5.758020e-001, 5.771261e-001, 5.784418e-001, 5.797502e-001, 5.810542e-001,
+5.823497e-001, 5.836413e-001, 5.849255e-001, 5.862021e-001, 5.874748e-001, 5.887363e-001, 5.899951e-001, 5.912478e-001, 5.924956e-001, 5.937397e-001,
+5.949762e-001, 5.962103e-001, 5.974361e-001, 5.986578e-001, 5.998724e-001, 6.010811e-001, 6.022859e-001, 6.034840e-001, 6.046806e-001, 6.058706e-001,
+6.070585e-001, 6.082383e-001, 6.094141e-001, 6.105835e-001, 6.117473e-001, 6.129063e-001, 6.140604e-001, 6.152123e-001, 6.163584e-001, 6.175032e-001,
+6.186399e-001, 6.197757e-001, 6.209014e-001, 6.220262e-001, 6.231432e-001, 6.242590e-001, 6.253691e-001, 6.264769e-001, 6.275768e-001, 6.286740e-001,
+6.297637e-001, 6.308507e-001, 6.319306e-001, 6.330079e-001, 6.340783e-001, 6.351463e-001, 6.362073e-001, 6.372658e-001, 6.383161e-001, 6.393648e-001,
+6.404062e-001, 6.414468e-001, 6.424813e-001, 6.435156e-001, 6.445450e-001, 6.455744e-001, 6.465964e-001, 6.476179e-001, 6.486307e-001, 6.496415e-001,
+6.506463e-001, 6.516482e-001, 6.526457e-001, 6.536392e-001, 6.546294e-001, 6.556134e-001, 6.565962e-001, 6.575726e-001, 6.585491e-001, 6.595204e-001,
+6.604915e-001, 6.614579e-001, 6.624225e-001, 6.633834e-001, 6.643403e-001, 6.652954e-001, 6.662438e-001, 6.671922e-001, 6.681343e-001, 6.690760e-001,
+6.700139e-001, 6.709496e-001, 6.718821e-001, 6.728079e-001, 6.737337e-001, 6.746503e-001, 6.755668e-001, 6.764778e-001, 6.773855e-001, 6.782909e-001,
+6.791892e-001, 6.800874e-001, 6.809794e-001, 6.818702e-001, 6.827588e-001, 6.836444e-001, 6.845300e-001, 6.854098e-001, 6.862895e-001, 6.871656e-001,
+6.880385e-001, 6.889110e-001, 6.897763e-001, 6.906416e-001, 6.915039e-001, 6.923637e-001, 6.932234e-001, 6.940784e-001, 6.949334e-001, 6.957844e-001,
+6.966314e-001, 6.974785e-001, 6.983185e-001, 6.991581e-001, 6.999953e-001, 7.008282e-001, 7.016611e-001, 7.024886e-001, 7.033143e-001, 7.041394e-001,
+7.049600e-001, 7.057806e-001, 7.065981e-001, 7.074120e-001, 7.082259e-001, 7.090329e-001, 7.098382e-001, 7.106427e-001, 7.114415e-001, 7.122403e-001,
+7.130369e-001, 7.138301e-001, 7.146234e-001, 7.154110e-001, 7.161956e-001, 7.169803e-001, 7.177580e-001, 7.185349e-001, 7.193110e-001, 7.200811e-001,
+7.208512e-001, 7.216190e-001, 7.223820e-001, 7.231450e-001, 7.239044e-001, 7.246600e-001, 7.254156e-001, 7.261663e-001, 7.269141e-001, 7.276619e-001,
+7.284036e-001, 7.291433e-001, 7.298830e-001, 7.306177e-001, 7.313515e-001, 7.320853e-001, 7.328147e-001, 7.335437e-001, 7.342727e-001, 7.349945e-001,
+7.357162e-001, 7.364378e-001, 7.371529e-001, 7.378681e-001, 7.385832e-001, 7.392929e-001, 7.400026e-001, 7.407123e-001, 7.414142e-001, 7.421160e-001,
+7.428178e-001, 7.435129e-001, 7.442076e-001, 7.449023e-001, 7.455918e-001, 7.462804e-001, 7.469691e-001, 7.476530e-001, 7.483355e-001, 7.490180e-001,
+7.496981e-001, 7.503767e-001, 7.510554e-001, 7.517315e-001, 7.524052e-001, 7.530788e-001, 7.537504e-001, 7.544177e-001, 7.550849e-001, 7.557517e-001,
+7.564148e-001, 7.570780e-001, 7.577411e-001, 7.583995e-001, 7.590574e-001, 7.597153e-001, 7.603682e-001, 7.610183e-001, 7.616684e-001, 7.623162e-001,
+7.629599e-001, 7.636035e-001, 7.642469e-001, 7.648852e-001, 7.655235e-001, 7.661618e-001, 7.667945e-001, 7.674250e-001, 7.680555e-001, 7.686837e-001,
+7.693077e-001, 7.699316e-001, 7.705556e-001, 7.711765e-001, 7.717972e-001, 7.724180e-001, 7.730364e-001, 7.736529e-001, 7.742694e-001, 7.748854e-001,
+7.754956e-001, 7.761058e-001, 7.767160e-001, 7.773232e-001, 7.779283e-001, 7.785334e-001, 7.791381e-001, 7.797393e-001, 7.803406e-001, 7.809418e-001,
+7.815398e-001, 7.821353e-001, 7.827307e-001, 7.833262e-001, 7.839170e-001, 7.845077e-001, 7.850985e-001, 7.856879e-001, 7.862753e-001, 7.868626e-001,
+7.874500e-001, 7.880332e-001, 7.886152e-001, 7.891972e-001, 7.897787e-001, 7.903565e-001, 7.909343e-001, 7.915121e-001, 7.920885e-001, 7.926633e-001,
+7.932380e-001, 7.938128e-001, 7.943832e-001, 7.949520e-001, 7.955207e-001, 7.960895e-001, 7.966527e-001, 7.972157e-001, 7.977787e-001, 7.983412e-001,
+7.989016e-001, 7.994621e-001, 8.000226e-001, 8.005809e-001, 8.011360e-001, 8.016910e-001, 8.022461e-001, 8.027977e-001, 8.033464e-001, 8.038952e-001,
+8.044440e-001, 8.049900e-001, 8.055347e-001, 8.060795e-001, 8.066242e-001, 8.071654e-001, 8.077054e-001, 8.082455e-001, 8.087856e-001, 8.093202e-001,
+8.098537e-001, 8.103872e-001, 8.109207e-001, 8.114497e-001, 8.119781e-001, 8.125065e-001, 8.130348e-001, 8.135599e-001, 8.140844e-001, 8.146089e-001,
+8.151334e-001, 8.156532e-001, 8.161720e-001, 8.166908e-001, 8.172097e-001, 8.177252e-001, 8.182397e-001, 8.187541e-001, 8.192686e-001, 8.197811e-001,
+8.202925e-001, 8.208040e-001, 8.213154e-001, 8.218243e-001, 8.223308e-001, 8.228374e-001, 8.233439e-001, 8.238489e-001, 8.243509e-001, 8.248529e-001,
+8.253549e-001, 8.258564e-001, 8.263542e-001, 8.268521e-001, 8.273500e-001, 8.278479e-001, 8.283423e-001, 8.288363e-001, 8.293302e-001, 8.298242e-001,
+8.303153e-001, 8.308048e-001, 8.312942e-001, 8.317837e-001, 8.322716e-001, 8.327561e-001, 8.332406e-001, 8.337251e-001, 8.342096e-001, 8.346913e-001,
+8.351729e-001, 8.356546e-001, 8.361362e-001, 8.366158e-001, 8.370940e-001, 8.375722e-001, 8.380503e-001, 8.385277e-001, 8.390010e-001, 8.394743e-001,
+8.399476e-001, 8.404209e-001, 8.408916e-001, 8.413613e-001, 8.418310e-001, 8.423007e-001, 8.427699e-001, 8.432373e-001, 8.437047e-001, 8.441720e-001,
+8.446394e-001, 8.451037e-001, 8.455665e-001, 8.460292e-001, 8.464920e-001, 8.469541e-001, 8.474110e-001, 8.478678e-001, 8.483247e-001, 8.487815e-001,
+8.492373e-001, 8.496921e-001, 8.501469e-001, 8.506017e-001, 8.510564e-001, 8.515083e-001, 8.519596e-001, 8.524109e-001, 8.528623e-001, 8.533126e-001,
+8.537583e-001, 8.542039e-001, 8.546496e-001, 8.550952e-001, 8.555397e-001, 8.559827e-001, 8.564257e-001, 8.568686e-001, 8.573116e-001, 8.577531e-001,
+8.581940e-001, 8.586348e-001, 8.590756e-001, 8.595165e-001, 8.599526e-001, 8.603882e-001, 8.608238e-001, 8.612593e-001, 8.616947e-001, 8.621254e-001,
+8.625561e-001, 8.629868e-001, 8.634175e-001, 8.638479e-001, 8.642767e-001, 8.647056e-001, 8.651344e-001, 8.655632e-001, 8.659911e-001, 8.664159e-001,
+8.668407e-001, 8.672655e-001, 8.676903e-001, 8.681136e-001, 8.685330e-001, 8.689525e-001, 8.693720e-001, 8.697914e-001, 8.702098e-001, 8.706253e-001,
+8.710409e-001, 8.714564e-001, 8.718720e-001, 8.722870e-001, 8.727000e-001, 8.731130e-001, 8.735260e-001, 8.739390e-001, 8.743514e-001, 8.747605e-001,
+8.751697e-001, 8.755788e-001, 8.759880e-001, 8.763970e-001, 8.768029e-001, 8.772087e-001, 8.776145e-001, 8.780203e-001, 8.784262e-001, 8.788296e-001,
+8.792327e-001, 8.796357e-001, 8.800388e-001, 8.804419e-001, 8.808424e-001, 8.812415e-001, 8.816406e-001, 8.820397e-001, 8.824388e-001, 8.828366e-001,
+8.832321e-001, 8.836277e-001, 8.840233e-001, 8.844188e-001, 8.848142e-001, 8.852069e-001, 8.855996e-001, 8.859923e-001, 8.863850e-001, 8.867778e-001,
+8.871687e-001, 8.875590e-001, 8.879493e-001, 8.883396e-001, 8.887299e-001, 8.891189e-001, 8.895054e-001, 8.898920e-001, 8.902786e-001, 8.906652e-001,
+8.910517e-001, 8.914347e-001, 8.918173e-001, 8.921999e-001, 8.925825e-001, 8.929651e-001, 8.933459e-001, 8.937244e-001, 8.941029e-001, 8.944814e-001,
+8.948599e-001, 8.952384e-001, 8.956135e-001, 8.959884e-001, 8.963632e-001, 8.967380e-001, 8.971129e-001, 8.974866e-001, 8.978582e-001, 8.982298e-001,
+8.986013e-001, 8.989729e-001, 8.993445e-001, 8.997136e-001, 9.000818e-001, 9.004499e-001, 9.008181e-001, 9.011863e-001, 9.015542e-001, 9.019187e-001,
+9.022832e-001, 9.026477e-001, 9.030122e-001, 9.033767e-001, 9.037406e-001, 9.041035e-001, 9.044663e-001, 9.048291e-001, 9.051919e-001, 9.055548e-001,
+9.059161e-001, 9.062763e-001, 9.066365e-001, 9.069967e-001, 9.073569e-001, 9.077171e-001, 9.080746e-001, 9.084313e-001, 9.087879e-001, 9.091446e-001,
+9.095013e-001, 9.098580e-001, 9.102131e-001, 9.105682e-001, 9.109232e-001, 9.112783e-001, 9.116334e-001, 9.119884e-001, 9.123415e-001, 9.126947e-001,
+9.130478e-001, 9.134010e-001, 9.137542e-001, 9.141071e-001, 9.144567e-001, 9.148062e-001, 9.151558e-001, 9.155054e-001, 9.158550e-001, 9.162043e-001,
+9.165494e-001, 9.168946e-001, 9.172397e-001, 9.175849e-001, 9.179300e-001, 9.182751e-001, 9.186192e-001, 9.189633e-001, 9.193074e-001, 9.196515e-001,
+9.199956e-001, 9.203397e-001, 9.206820e-001, 9.210242e-001, 9.213663e-001, 9.217085e-001, 9.220507e-001, 9.223928e-001, 9.227316e-001, 9.230694e-001,
+9.234072e-001, 9.237451e-001, 9.240829e-001, 9.244207e-001, 9.247564e-001, 9.250904e-001, 9.254245e-001, 9.257585e-001, 9.260926e-001, 9.264267e-001,
+9.267604e-001, 9.270934e-001, 9.274264e-001, 9.277595e-001, 9.280925e-001, 9.284255e-001, 9.287585e-001, 9.290889e-001, 9.294193e-001, 9.297497e-001,
+9.300800e-001, 9.304104e-001, 9.307408e-001, 9.310684e-001, 9.313945e-001, 9.317207e-001, 9.320468e-001, 9.323729e-001, 9.326990e-001, 9.330248e-001,
+9.333493e-001, 9.336738e-001, 9.339984e-001, 9.343229e-001, 9.346475e-001, 9.349720e-001, 9.352958e-001, 9.356193e-001, 9.359429e-001, 9.362664e-001,
+9.365899e-001, 9.369135e-001, 9.372362e-001, 9.375564e-001, 9.378766e-001, 9.381969e-001, 9.385171e-001, 9.388374e-001, 9.391576e-001, 9.394760e-001,
+9.397935e-001, 9.401110e-001, 9.404285e-001, 9.407460e-001, 9.410635e-001, 9.413810e-001, 9.416983e-001, 9.420157e-001, 9.423331e-001, 9.426504e-001,
+9.429678e-001, 9.432851e-001, 9.436019e-001, 9.439175e-001, 9.442332e-001, 9.445489e-001, 9.448645e-001, 9.451802e-001, 9.454958e-001, 9.458090e-001,
+9.461207e-001, 9.464324e-001, 9.467441e-001, 9.470558e-001, 9.473675e-001, 9.476793e-001, 9.479893e-001, 9.482990e-001, 9.486087e-001, 9.489185e-001,
+9.492282e-001, 9.495379e-001, 9.498477e-001, 9.501573e-001, 9.504670e-001, 9.507767e-001, 9.510864e-001, 9.513961e-001, 9.517058e-001, 9.520153e-001,
+9.523227e-001, 9.526301e-001, 9.529375e-001, 9.532449e-001, 9.535524e-001, 9.538598e-001, 9.541666e-001, 9.544696e-001, 9.547726e-001, 9.550755e-001,
+9.553785e-001, 9.556815e-001, 9.559844e-001, 9.562871e-001, 9.565876e-001, 9.568880e-001, 9.571885e-001, 9.574889e-001, 9.577893e-001, 9.580898e-001,
+9.583902e-001, 9.586885e-001, 9.589869e-001, 9.592853e-001, 9.595836e-001, 9.598820e-001, 9.601804e-001, 9.604788e-001, 9.607712e-001, 9.610629e-001,
+9.613546e-001, 9.616462e-001, 9.619379e-001, 9.622296e-001, 9.625213e-001, 9.628093e-001, 9.630957e-001, 9.633821e-001, 9.636685e-001, 9.639549e-001,
+9.642413e-001, 9.645277e-001, 9.648134e-001, 9.650981e-001, 9.653828e-001, 9.656675e-001, 9.659522e-001, 9.662369e-001, 9.665215e-001, 9.668060e-001,
+9.670883e-001, 9.673706e-001, 9.676529e-001, 9.679353e-001, 9.682176e-001, 9.684999e-001, 9.687822e-001, 9.690620e-001, 9.693408e-001, 9.696196e-001,
+9.698984e-001, 9.701771e-001, 9.704559e-001, 9.707347e-001, 9.710128e-001, 9.712892e-001, 9.715657e-001, 9.718421e-001, 9.721185e-001, 9.723949e-001,
+9.726713e-001, 9.729477e-001, 9.732222e-001, 9.734961e-001, 9.737700e-001, 9.740439e-001, 9.743178e-001, 9.745917e-001, 9.748657e-001, 9.751387e-001,
+9.754090e-001, 9.756793e-001, 9.759496e-001, 9.762199e-001, 9.764902e-001, 9.767605e-001, 9.770308e-001, 9.772985e-001, 9.775645e-001, 9.778305e-001,
+9.780965e-001, 9.783625e-001, 9.786285e-001, 9.788945e-001, 9.791605e-001, 9.794233e-001, 9.796857e-001, 9.799482e-001, 9.802107e-001, 9.804731e-001,
+9.807356e-001, 9.809980e-001, 9.812599e-001, 9.815184e-001, 9.817769e-001, 9.820354e-001, 9.822939e-001, 9.825525e-001, 9.828110e-001, 9.830695e-001,
+9.833265e-001, 9.835805e-001, 9.838346e-001, 9.840886e-001, 9.843427e-001, 9.845967e-001, 9.848508e-001, 9.851048e-001, 9.853568e-001, 9.856064e-001,
+9.858560e-001, 9.861056e-001, 9.863552e-001, 9.866049e-001, 9.868545e-001, 9.871041e-001, 9.873511e-001, 9.875955e-001, 9.878400e-001, 9.880845e-001,
+9.883290e-001, 9.885735e-001, 9.888180e-001, 9.890625e-001, 9.893040e-001, 9.895425e-001, 9.897811e-001, 9.900196e-001, 9.902582e-001, 9.904968e-001,
+9.907353e-001, 9.909739e-001, 9.912103e-001, 9.914438e-001, 9.916772e-001, 9.919107e-001, 9.921442e-001, 9.923776e-001, 9.926111e-001, 9.928446e-001,
+9.930760e-001, 9.933021e-001, 9.935282e-001, 9.937543e-001, 9.939803e-001, 9.942064e-001, 9.944325e-001, 9.946586e-001, 9.948840e-001, 9.950992e-001,
+9.953144e-001, 9.955295e-001, 9.957447e-001, 9.959598e-001, 9.961750e-001, 9.963901e-001, 9.966053e-001, 9.968116e-001, 9.970153e-001, 9.972191e-001,
+9.974228e-001, 9.976265e-001, 9.978302e-001, 9.980339e-001, 9.982377e-001, 9.984378e-001, 9.986331e-001, 9.988284e-001, 9.990236e-001, 9.992189e-001,
+9.994142e-001, 9.996095e-001, 9.998047e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.260067e-002, 2.211157e-002, 3.030797e-002, 3.774873e-002, 4.467563e-002, 5.122255e-002, 5.749309e-002, 6.352282e-002, 6.935783e-002,
+7.501388e-002, 8.052207e-002, 8.591344e-002, 9.118778e-002, 9.634276e-002, 1.013798e-001, 1.063026e-001, 1.111141e-001, 1.158171e-001, 1.204319e-001,
+1.249562e-001, 1.294070e-001, 1.337792e-001, 1.380856e-001, 1.423334e-001, 1.465034e-001, 1.506060e-001, 1.546512e-001, 1.586489e-001, 1.626014e-001,
+1.665008e-001, 1.703406e-001, 1.741352e-001, 1.778850e-001, 1.815871e-001, 1.852402e-001, 1.888413e-001, 1.923972e-001, 1.959189e-001, 1.994098e-001,
+2.028711e-001, 2.062991e-001, 2.096917e-001, 2.130512e-001, 2.163791e-001, 2.196783e-001, 2.229490e-001, 2.261861e-001, 2.293914e-001, 2.325629e-001,
+2.357041e-001, 2.388191e-001, 2.419067e-001, 2.449615e-001, 2.479872e-001, 2.509889e-001, 2.539706e-001, 2.569276e-001, 2.598539e-001, 2.627541e-001,
+2.656318e-001, 2.684908e-001, 2.713276e-001, 2.741436e-001, 2.769415e-001, 2.797216e-001, 2.824832e-001, 2.852220e-001, 2.879402e-001, 2.906357e-001,
+2.933071e-001, 2.959616e-001, 2.985952e-001, 3.012052e-001, 3.037928e-001, 3.063583e-001, 3.089060e-001, 3.114355e-001, 3.139465e-001, 3.164430e-001,
+3.189219e-001, 3.213780e-001, 3.238114e-001, 3.262238e-001, 3.286206e-001, 3.310021e-001, 3.333650e-001, 3.357118e-001, 3.380422e-001, 3.403577e-001,
+3.426570e-001, 3.449402e-001, 3.472093e-001, 3.494598e-001, 3.516952e-001, 3.539174e-001, 3.561233e-001, 3.583107e-001, 3.604839e-001, 3.626427e-001,
+3.647844e-001, 3.669062e-001, 3.690075e-001, 3.710917e-001, 3.731572e-001, 3.752072e-001, 3.772436e-001, 3.792652e-001, 3.812715e-001, 3.832644e-001,
+3.852454e-001, 3.872154e-001, 3.891725e-001, 3.911152e-001, 3.930422e-001, 3.949519e-001, 3.968465e-001, 3.987270e-001, 4.005941e-001, 4.024456e-001,
+4.042817e-001, 4.061039e-001, 4.079152e-001, 4.097140e-001, 4.115009e-001, 4.132742e-001, 4.150344e-001, 4.167799e-001, 4.185154e-001, 4.202413e-001,
+4.219577e-001, 4.236656e-001, 4.253664e-001, 4.270611e-001, 4.287498e-001, 4.304315e-001, 4.321100e-001, 4.337812e-001, 4.354483e-001, 4.371086e-001,
+4.387633e-001, 4.404116e-001, 4.420526e-001, 4.436878e-001, 4.453130e-001, 4.469314e-001, 4.485434e-001, 4.501497e-001, 4.517503e-001, 4.533443e-001,
+4.549309e-001, 4.565131e-001, 4.580908e-001, 4.596639e-001, 4.612325e-001, 4.627946e-001, 4.643518e-001, 4.659040e-001, 4.674513e-001, 4.689923e-001,
+4.705272e-001, 4.720568e-001, 4.735812e-001, 4.750990e-001, 4.766101e-001, 4.781157e-001, 4.796160e-001, 4.811086e-001, 4.825948e-001, 4.840749e-001,
+4.855479e-001, 4.870094e-001, 4.884645e-001, 4.899130e-001, 4.913503e-001, 4.927790e-001, 4.941999e-001, 4.956082e-001, 4.970069e-001, 4.983989e-001,
+4.997818e-001, 5.011561e-001, 5.025245e-001, 5.038843e-001, 5.052358e-001, 5.065828e-001, 5.079236e-001, 5.092585e-001, 5.105897e-001, 5.119146e-001,
+5.132347e-001, 5.145517e-001, 5.158618e-001, 5.171686e-001, 5.184716e-001, 5.197689e-001, 5.210636e-001, 5.223535e-001, 5.236395e-001, 5.249232e-001,
+5.262010e-001, 5.274763e-001, 5.287467e-001, 5.300115e-001, 5.312736e-001, 5.325291e-001, 5.337823e-001, 5.350302e-001, 5.362746e-001, 5.375165e-001,
+5.387526e-001, 5.399869e-001, 5.412152e-001, 5.424403e-001, 5.436597e-001, 5.448756e-001, 5.460892e-001, 5.472963e-001, 5.485018e-001, 5.497026e-001,
+5.509019e-001, 5.520958e-001, 5.532882e-001, 5.544781e-001, 5.556639e-001, 5.568464e-001, 5.580249e-001, 5.592017e-001, 5.603732e-001, 5.615437e-001,
+5.627098e-001, 5.638755e-001, 5.650361e-001, 5.661964e-001, 5.673535e-001, 5.685096e-001, 5.696610e-001, 5.708105e-001, 5.719539e-001, 5.730956e-001,
+5.742329e-001, 5.753682e-001, 5.764987e-001, 5.776278e-001, 5.787534e-001, 5.798763e-001, 5.809920e-001, 5.821057e-001, 5.832133e-001, 5.843192e-001,
+5.854180e-001, 5.865159e-001, 5.876077e-001, 5.886991e-001, 5.897816e-001, 5.908641e-001, 5.919385e-001, 5.930124e-001, 5.940799e-001, 5.951459e-001,
+5.962070e-001, 5.972658e-001, 5.983212e-001, 5.993734e-001, 6.004230e-001, 6.014679e-001, 6.025115e-001, 6.035487e-001, 6.045858e-001, 6.056173e-001,
+6.066485e-001, 6.076751e-001, 6.087000e-001, 6.097220e-001, 6.107410e-001, 6.117583e-001, 6.127699e-001, 6.137815e-001, 6.147891e-001, 6.157965e-001,
+6.167992e-001, 6.177995e-001, 6.187973e-001, 6.197900e-001, 6.207827e-001, 6.217687e-001, 6.227546e-001, 6.237367e-001, 6.247165e-001, 6.256947e-001,
+6.266680e-001, 6.276412e-001, 6.286086e-001, 6.295750e-001, 6.305392e-001, 6.315008e-001, 6.324624e-001, 6.334151e-001, 6.343677e-001, 6.353166e-001,
+6.362623e-001, 6.372076e-001, 6.381461e-001, 6.390846e-001, 6.400201e-001, 6.409534e-001, 6.418864e-001, 6.428129e-001, 6.437393e-001, 6.446622e-001,
+6.455815e-001, 6.465009e-001, 6.474135e-001, 6.483257e-001, 6.492353e-001, 6.501401e-001, 6.510448e-001, 6.519447e-001, 6.528430e-001, 6.537404e-001,
+6.546318e-001, 6.555232e-001, 6.564106e-001, 6.572938e-001, 6.581770e-001, 6.590546e-001, 6.599308e-001, 6.608063e-001, 6.616767e-001, 6.625470e-001,
+6.634144e-001, 6.642775e-001, 6.651405e-001, 6.660001e-001, 6.668580e-001, 6.677159e-001, 6.685679e-001, 6.694193e-001, 6.702698e-001, 6.711146e-001,
+6.719594e-001, 6.728020e-001, 6.736403e-001, 6.744785e-001, 6.753134e-001, 6.761451e-001, 6.769768e-001, 6.778049e-001, 6.786310e-001, 6.794571e-001,
+6.802789e-001, 6.810994e-001, 6.819198e-001, 6.827345e-001, 6.835482e-001, 6.843620e-001, 6.851683e-001, 6.859741e-001, 6.867799e-001, 6.875800e-001,
+6.883801e-001, 6.891801e-001, 6.899746e-001, 6.907691e-001, 6.915635e-001, 6.923534e-001, 6.931432e-001, 6.939331e-001, 6.947163e-001, 6.954996e-001,
+6.962828e-001, 6.970598e-001, 6.978365e-001, 6.986131e-001, 6.993851e-001, 7.001565e-001, 7.009278e-001, 7.016950e-001, 7.024609e-001, 7.032269e-001,
+7.039887e-001, 7.047484e-001, 7.055081e-001, 7.062642e-001, 7.070169e-001, 7.077696e-001, 7.085206e-001, 7.092684e-001, 7.100161e-001, 7.107633e-001,
+7.115065e-001, 7.122498e-001, 7.129930e-001, 7.137312e-001, 7.144688e-001, 7.152063e-001, 7.159397e-001, 7.166707e-001, 7.174018e-001, 7.181309e-001,
+7.188568e-001, 7.195827e-001, 7.203084e-001, 7.210305e-001, 7.217525e-001, 7.224746e-001, 7.231924e-001, 7.239086e-001, 7.246248e-001, 7.253389e-001,
+7.260494e-001, 7.267599e-001, 7.274704e-001, 7.281759e-001, 7.288811e-001, 7.295863e-001, 7.302888e-001, 7.309890e-001, 7.316892e-001, 7.323890e-001,
+7.330843e-001, 7.337795e-001, 7.344748e-001, 7.351666e-001, 7.358563e-001, 7.365460e-001, 7.372353e-001, 7.379209e-001, 7.386066e-001, 7.392922e-001,
+7.399751e-001, 7.406559e-001, 7.413367e-001, 7.420175e-001, 7.426926e-001, 7.433678e-001, 7.440429e-001, 7.447155e-001, 7.453843e-001, 7.460532e-001,
+7.467220e-001, 7.473869e-001, 7.480508e-001, 7.487146e-001, 7.493779e-001, 7.500372e-001, 7.506965e-001, 7.513558e-001, 7.520119e-001, 7.526640e-001,
+7.533161e-001, 7.539682e-001, 7.546153e-001, 7.552606e-001, 7.559058e-001, 7.565511e-001, 7.571910e-001, 7.578308e-001, 7.584706e-001, 7.591093e-001,
+7.597439e-001, 7.603785e-001, 7.610131e-001, 7.616455e-001, 7.622744e-001, 7.629034e-001, 7.635323e-001, 7.641590e-001, 7.647839e-001, 7.654088e-001,
+7.660337e-001, 7.666554e-001, 7.672758e-001, 7.678962e-001, 7.685165e-001, 7.691327e-001, 7.697478e-001, 7.703629e-001, 7.709779e-001, 7.715882e-001,
+7.721975e-001, 7.728068e-001, 7.734162e-001, 7.740217e-001, 7.746267e-001, 7.752317e-001, 7.758368e-001, 7.764384e-001, 7.770396e-001, 7.776407e-001,
+7.782419e-001, 7.788381e-001, 7.794333e-001, 7.800284e-001, 7.806236e-001, 7.812145e-001, 7.818040e-001, 7.823935e-001, 7.829831e-001, 7.835692e-001,
+7.841536e-001, 7.847380e-001, 7.853223e-001, 7.859039e-001, 7.864828e-001, 7.870617e-001, 7.876406e-001, 7.882181e-001, 7.887930e-001, 7.893680e-001,
+7.899429e-001, 7.905170e-001, 7.910869e-001, 7.916567e-001, 7.922265e-001, 7.927964e-001, 7.933603e-001, 7.939237e-001, 7.944871e-001, 7.950504e-001,
+7.956107e-001, 7.961691e-001, 7.967275e-001, 7.972859e-001, 7.978432e-001, 7.983982e-001, 7.989533e-001, 7.995083e-001, 8.000634e-001, 8.006147e-001,
+8.011660e-001, 8.017173e-001, 8.022685e-001, 8.028173e-001, 8.033643e-001, 8.039114e-001, 8.044584e-001, 8.050046e-001, 8.055471e-001, 8.060896e-001,
+8.066321e-001, 8.071746e-001, 8.077149e-001, 8.082543e-001, 8.087938e-001, 8.093332e-001, 8.098721e-001, 8.104090e-001, 8.109459e-001, 8.114828e-001,
+8.120197e-001, 8.125535e-001, 8.130859e-001, 8.136183e-001, 8.141508e-001, 8.146827e-001, 8.152112e-001, 8.157397e-001, 8.162681e-001, 8.167966e-001,
+8.173234e-001, 8.178485e-001, 8.183735e-001, 8.188986e-001, 8.194237e-001, 8.199457e-001, 8.204672e-001, 8.209888e-001, 8.215103e-001, 8.220311e-001,
+8.225490e-001, 8.230668e-001, 8.235846e-001, 8.241025e-001, 8.246184e-001, 8.251322e-001, 8.256459e-001, 8.261596e-001, 8.266734e-001, 8.271841e-001,
+8.276936e-001, 8.282031e-001, 8.287126e-001, 8.292221e-001, 8.297291e-001, 8.302359e-001, 8.307427e-001, 8.312495e-001, 8.317560e-001, 8.322590e-001,
+8.327620e-001, 8.332650e-001, 8.337680e-001, 8.342701e-001, 8.347683e-001, 8.352665e-001, 8.357647e-001, 8.362629e-001, 8.367602e-001, 8.372551e-001,
+8.377499e-001, 8.382448e-001, 8.387397e-001, 8.392338e-001, 8.397260e-001, 8.402182e-001, 8.407104e-001, 8.412027e-001, 8.416936e-001, 8.421815e-001,
+8.426694e-001, 8.431573e-001, 8.436452e-001, 8.441322e-001, 8.446164e-001, 8.451005e-001, 8.455847e-001, 8.460688e-001, 8.465525e-001, 8.470336e-001,
+8.475147e-001, 8.479957e-001, 8.484768e-001, 8.489577e-001, 8.494341e-001, 8.499105e-001, 8.503869e-001, 8.508632e-001, 8.513396e-001, 8.518124e-001,
+8.522846e-001, 8.527569e-001, 8.532291e-001, 8.537013e-001, 8.541713e-001, 8.546400e-001, 8.551087e-001, 8.555774e-001, 8.560461e-001, 8.565135e-001,
+8.569787e-001, 8.574439e-001, 8.579091e-001, 8.583743e-001, 8.588392e-001, 8.593008e-001, 8.597624e-001, 8.602240e-001, 8.606856e-001, 8.611472e-001,
+8.616060e-001, 8.620637e-001, 8.625215e-001, 8.629793e-001, 8.634371e-001, 8.638935e-001, 8.643475e-001, 8.648015e-001, 8.652554e-001, 8.657094e-001,
+8.661634e-001, 8.666152e-001, 8.670668e-001, 8.675185e-001, 8.679701e-001, 8.684218e-001, 8.688720e-001, 8.693206e-001, 8.697691e-001, 8.702176e-001,
+8.706661e-001, 8.711147e-001, 8.715596e-001, 8.720041e-001, 8.724487e-001, 8.728932e-001, 8.733377e-001, 8.737814e-001, 8.742234e-001, 8.746655e-001,
+8.751075e-001, 8.755495e-001, 8.759916e-001, 8.764312e-001, 8.768700e-001, 8.773087e-001, 8.777475e-001, 8.781863e-001, 8.786248e-001, 8.790594e-001,
+8.794940e-001, 8.799286e-001, 8.803632e-001, 8.807978e-001, 8.812315e-001, 8.816634e-001, 8.820953e-001, 8.825272e-001, 8.829591e-001, 8.833911e-001,
+8.838210e-001, 8.842495e-001, 8.846780e-001, 8.851064e-001, 8.855349e-001, 8.859634e-001, 8.863886e-001, 8.868127e-001, 8.872369e-001, 8.876611e-001,
+8.880853e-001, 8.885095e-001, 8.889310e-001, 8.893524e-001, 8.897737e-001, 8.901951e-001, 8.906164e-001, 8.910376e-001, 8.914554e-001, 8.918732e-001,
+8.922909e-001, 8.927087e-001, 8.931264e-001, 8.935439e-001, 8.939572e-001, 8.943705e-001, 8.947838e-001, 8.951971e-001, 8.956104e-001, 8.960235e-001,
+8.964338e-001, 8.968441e-001, 8.972544e-001, 8.976647e-001, 8.980750e-001, 8.984852e-001, 8.988932e-001, 8.993012e-001, 8.997092e-001, 9.001171e-001,
+9.005251e-001, 9.009331e-001, 9.013390e-001, 9.017447e-001, 9.021504e-001, 9.025562e-001, 9.029619e-001, 9.033676e-001, 9.037717e-001, 9.041753e-001,
+9.045788e-001, 9.049824e-001, 9.053860e-001, 9.057895e-001, 9.061918e-001, 9.065931e-001, 9.069944e-001, 9.073956e-001, 9.077969e-001, 9.081982e-001,
+9.085988e-001, 9.089979e-001, 9.093969e-001, 9.097960e-001, 9.101951e-001, 9.105942e-001, 9.109932e-001, 9.113902e-001, 9.117871e-001, 9.121840e-001,
+9.125810e-001, 9.129779e-001, 9.133749e-001, 9.137704e-001, 9.141651e-001, 9.145598e-001, 9.149545e-001, 9.153492e-001, 9.157439e-001, 9.161380e-001,
+9.165306e-001, 9.169231e-001, 9.173156e-001, 9.177081e-001, 9.181007e-001, 9.184932e-001, 9.188841e-001, 9.192745e-001, 9.196650e-001, 9.200554e-001,
+9.204458e-001, 9.208363e-001, 9.212262e-001, 9.216144e-001, 9.220026e-001, 9.223908e-001, 9.227790e-001, 9.231673e-001, 9.235555e-001, 9.239422e-001,
+9.243283e-001, 9.247144e-001, 9.251005e-001, 9.254866e-001, 9.258727e-001, 9.262586e-001, 9.266427e-001, 9.270267e-001, 9.274107e-001, 9.277948e-001,
+9.281788e-001, 9.285628e-001, 9.289460e-001, 9.293279e-001, 9.297097e-001, 9.300916e-001, 9.304735e-001, 9.308553e-001, 9.312372e-001, 9.316177e-001,
+9.319974e-001, 9.323772e-001, 9.327569e-001, 9.331367e-001, 9.335164e-001, 9.338962e-001, 9.342742e-001, 9.346520e-001, 9.350297e-001, 9.354074e-001,
+9.357852e-001, 9.361629e-001, 9.365406e-001, 9.369169e-001, 9.372933e-001, 9.376696e-001, 9.380459e-001, 9.384223e-001, 9.387986e-001, 9.391749e-001,
+9.395511e-001, 9.399274e-001, 9.403036e-001, 9.406798e-001, 9.410560e-001, 9.414322e-001, 9.418083e-001, 9.421829e-001, 9.425576e-001, 9.429323e-001,
+9.433069e-001, 9.436816e-001, 9.440563e-001, 9.444304e-001, 9.448001e-001, 9.451699e-001, 9.455396e-001, 9.459094e-001, 9.462791e-001, 9.466488e-001,
+9.470184e-001, 9.473824e-001, 9.477464e-001, 9.481103e-001, 9.484743e-001, 9.488383e-001, 9.492022e-001, 9.495662e-001, 9.499267e-001, 9.502867e-001,
+9.506467e-001, 9.510068e-001, 9.513668e-001, 9.517268e-001, 9.520869e-001, 9.524452e-001, 9.528028e-001, 9.531604e-001, 9.535180e-001, 9.538757e-001,
+9.542333e-001, 9.545909e-001, 9.549476e-001, 9.553032e-001, 9.556588e-001, 9.560144e-001, 9.563700e-001, 9.567256e-001, 9.570812e-001, 9.574365e-001,
+9.577893e-001, 9.581422e-001, 9.584951e-001, 9.588480e-001, 9.592008e-001, 9.595537e-001, 9.599066e-001, 9.602573e-001, 9.606073e-001, 9.609573e-001,
+9.613073e-001, 9.616572e-001, 9.620072e-001, 9.623572e-001, 9.627064e-001, 9.630538e-001, 9.634012e-001, 9.637486e-001, 9.640960e-001, 9.644434e-001,
+9.647908e-001, 9.651382e-001, 9.654831e-001, 9.658273e-001, 9.661715e-001, 9.665157e-001, 9.668599e-001, 9.672041e-001, 9.675483e-001, 9.678918e-001,
+9.682326e-001, 9.685735e-001, 9.689143e-001, 9.692552e-001, 9.695961e-001, 9.699369e-001, 9.702778e-001, 9.706166e-001, 9.709542e-001, 9.712917e-001,
+9.716293e-001, 9.719668e-001, 9.723044e-001, 9.726419e-001, 9.729795e-001, 9.733135e-001, 9.736472e-001, 9.739809e-001, 9.743146e-001, 9.746483e-001,
+9.749820e-001, 9.753157e-001, 9.756488e-001, 9.759785e-001, 9.763082e-001, 9.766379e-001, 9.769676e-001, 9.772973e-001, 9.776270e-001, 9.779567e-001,
+9.782848e-001, 9.786100e-001, 9.789352e-001, 9.792604e-001, 9.795857e-001, 9.799109e-001, 9.802361e-001, 9.805613e-001, 9.808842e-001, 9.812044e-001,
+9.815247e-001, 9.818449e-001, 9.821652e-001, 9.824854e-001, 9.828057e-001, 9.831259e-001, 9.834435e-001, 9.837587e-001, 9.840738e-001, 9.843889e-001,
+9.847040e-001, 9.850191e-001, 9.853342e-001, 9.856493e-001, 9.859612e-001, 9.862697e-001, 9.865782e-001, 9.868867e-001, 9.871953e-001, 9.875038e-001,
+9.878123e-001, 9.881208e-001, 9.884264e-001, 9.887280e-001, 9.890295e-001, 9.893310e-001, 9.896326e-001, 9.899341e-001, 9.902356e-001, 9.905372e-001,
+9.908367e-001, 9.911310e-001, 9.914252e-001, 9.917195e-001, 9.920137e-001, 9.923080e-001, 9.926022e-001, 9.928965e-001, 9.931902e-001, 9.934739e-001,
+9.937577e-001, 9.940414e-001, 9.943252e-001, 9.946089e-001, 9.948927e-001, 9.951764e-001, 9.954602e-001, 9.957353e-001, 9.960080e-001, 9.962807e-001,
+9.965534e-001, 9.968260e-001, 9.970987e-001, 9.973714e-001, 9.976441e-001, 9.979118e-001, 9.981728e-001, 9.984339e-001, 9.986949e-001, 9.989559e-001,
+9.992169e-001, 9.994780e-001, 9.997390e-001, 1.000000e+000)),
+("Agfa", "Agfachrome CT Precisa 100", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.381406e-004, 1.181142e-003, 1.877674e-003, 2.602344e-003, 3.360289e-003, 4.164441e-003, 5.021771e-003, 5.933367e-003, 6.904819e-003,
+7.944170e-003, 9.061808e-003, 1.026589e-002, 1.155840e-002, 1.292916e-002, 1.436611e-002, 1.585173e-002, 1.737965e-002, 1.895310e-002, 2.058100e-002,
+2.227875e-002, 2.406158e-002, 2.594512e-002, 2.793771e-002, 3.004856e-002, 3.227537e-002, 3.461457e-002, 3.706229e-002, 3.961225e-002, 4.225806e-002,
+4.498945e-002, 4.779320e-002, 5.065957e-002, 5.357673e-002, 5.653050e-002, 5.950840e-002, 6.249929e-002, 6.549543e-002, 6.848954e-002, 7.147725e-002,
+7.445433e-002, 7.741531e-002, 8.036059e-002, 8.329051e-002, 8.620745e-002, 8.911136e-002, 9.199993e-002, 9.487310e-002, 9.773290e-002, 1.005818e-001,
+1.034189e-001, 1.062425e-001, 1.090549e-001, 1.118552e-001, 1.146425e-001, 1.174187e-001, 1.201833e-001, 1.229388e-001, 1.256875e-001, 1.284302e-001,
+1.311667e-001, 1.338986e-001, 1.366282e-001, 1.393582e-001, 1.420905e-001, 1.448286e-001, 1.475745e-001, 1.503286e-001, 1.530917e-001, 1.558625e-001,
+1.586424e-001, 1.614303e-001, 1.642321e-001, 1.670461e-001, 1.698731e-001, 1.727123e-001, 1.755630e-001, 1.784220e-001, 1.812903e-001, 1.841648e-001,
+1.870469e-001, 1.899344e-001, 1.928229e-001, 1.957140e-001, 1.986058e-001, 2.014966e-001, 2.043850e-001, 2.072687e-001, 2.101464e-001, 2.130182e-001,
+2.158843e-001, 2.187420e-001, 2.215912e-001, 2.244297e-001, 2.272590e-001, 2.300810e-001, 2.328950e-001, 2.356989e-001, 2.384911e-001, 2.412709e-001,
+2.440379e-001, 2.467942e-001, 2.495391e-001, 2.522702e-001, 2.549884e-001, 2.576947e-001, 2.603886e-001, 2.630694e-001, 2.657378e-001, 2.683930e-001,
+2.710329e-001, 2.736579e-001, 2.762689e-001, 2.788654e-001, 2.814470e-001, 2.840158e-001, 2.865726e-001, 2.891159e-001, 2.916450e-001, 2.941609e-001,
+2.966658e-001, 2.991599e-001, 3.016422e-001, 3.041135e-001, 3.065750e-001, 3.090234e-001, 3.114587e-001, 3.138816e-001, 3.162932e-001, 3.186948e-001,
+3.210870e-001, 3.234695e-001, 3.258418e-001, 3.282004e-001, 3.305430e-001, 3.328739e-001, 3.351962e-001, 3.375113e-001, 3.398195e-001, 3.421205e-001,
+3.444134e-001, 3.466998e-001, 3.489798e-001, 3.512540e-001, 3.535235e-001, 3.557898e-001, 3.580540e-001, 3.603162e-001, 3.625768e-001, 3.648356e-001,
+3.670929e-001, 3.693491e-001, 3.716045e-001, 3.738592e-001, 3.761132e-001, 3.783670e-001, 3.806207e-001, 3.828744e-001, 3.851285e-001, 3.873830e-001,
+3.896381e-001, 3.918942e-001, 3.941515e-001, 3.964099e-001, 3.986697e-001, 4.009317e-001, 4.031954e-001, 4.054607e-001, 4.077295e-001, 4.100005e-001,
+4.122736e-001, 4.145509e-001, 4.168312e-001, 4.191139e-001, 4.213996e-001, 4.236867e-001, 4.259750e-001, 4.282661e-001, 4.305580e-001, 4.328507e-001,
+4.351427e-001, 4.374347e-001, 4.397264e-001, 4.420182e-001, 4.443093e-001, 4.465989e-001, 4.488859e-001, 4.511715e-001, 4.534544e-001, 4.557343e-001,
+4.580109e-001, 4.602797e-001, 4.625452e-001, 4.648034e-001, 4.670571e-001, 4.693069e-001, 4.715498e-001, 4.737903e-001, 4.760245e-001, 4.782535e-001,
+4.804762e-001, 4.826883e-001, 4.848967e-001, 4.870918e-001, 4.892837e-001, 4.914664e-001, 4.936434e-001, 4.958146e-001, 4.979769e-001, 5.001357e-001,
+5.022799e-001, 5.044209e-001, 5.065476e-001, 5.086697e-001, 5.107814e-001, 5.128857e-001, 5.149818e-001, 5.170682e-001, 5.191486e-001, 5.212162e-001,
+5.232796e-001, 5.253279e-001, 5.273739e-001, 5.294031e-001, 5.314308e-001, 5.334423e-001, 5.354516e-001, 5.374450e-001, 5.394350e-001, 5.414086e-001,
+5.433782e-001, 5.453328e-001, 5.472834e-001, 5.492210e-001, 5.511540e-001, 5.530724e-001, 5.549862e-001, 5.568844e-001, 5.587790e-001, 5.606595e-001,
+5.625374e-001, 5.644009e-001, 5.662628e-001, 5.681079e-001, 5.699527e-001, 5.717802e-001, 5.736077e-001, 5.754188e-001, 5.772284e-001, 5.790213e-001,
+5.808100e-001, 5.825856e-001, 5.843548e-001, 5.861146e-001, 5.878657e-001, 5.896102e-001, 5.913426e-001, 5.930718e-001, 5.947853e-001, 5.964988e-001,
+5.981938e-001, 5.998881e-001, 6.015682e-001, 6.032433e-001, 6.049086e-001, 6.065642e-001, 6.082149e-001, 6.098506e-001, 6.114862e-001, 6.131017e-001,
+6.147163e-001, 6.163177e-001, 6.179123e-001, 6.195004e-001, 6.210765e-001, 6.226523e-001, 6.242104e-001, 6.257685e-001, 6.273151e-001, 6.288558e-001,
+6.303917e-001, 6.319160e-001, 6.334402e-001, 6.349475e-001, 6.364528e-001, 6.379474e-001, 6.394303e-001, 6.409125e-001, 6.423766e-001, 6.438408e-001,
+6.452941e-001, 6.467398e-001, 6.481837e-001, 6.496129e-001, 6.510421e-001, 6.524607e-001, 6.538728e-001, 6.552829e-001, 6.566761e-001, 6.580693e-001,
+6.594510e-001, 6.608237e-001, 6.621963e-001, 6.635506e-001, 6.649050e-001, 6.662515e-001, 6.675874e-001, 6.689232e-001, 6.702444e-001, 6.715624e-001,
+6.728768e-001, 6.741766e-001, 6.754763e-001, 6.767659e-001, 6.780475e-001, 6.793290e-001, 6.805944e-001, 6.818579e-001, 6.831180e-001, 6.843644e-001,
+6.856109e-001, 6.868490e-001, 6.880783e-001, 6.893077e-001, 6.905233e-001, 6.917345e-001, 6.929457e-001, 6.941389e-001, 6.953321e-001, 6.965217e-001,
+6.976983e-001, 6.988749e-001, 7.000443e-001, 7.012037e-001, 7.023630e-001, 7.035112e-001, 7.046518e-001, 7.057924e-001, 7.069210e-001, 7.080454e-001,
+7.091699e-001, 7.102797e-001, 7.113873e-001, 7.124949e-001, 7.135863e-001, 7.146772e-001, 7.157673e-001, 7.168418e-001, 7.179162e-001, 7.189890e-001,
+7.200478e-001, 7.211065e-001, 7.221631e-001, 7.232058e-001, 7.242485e-001, 7.252890e-001, 7.263166e-001, 7.273442e-001, 7.283703e-001, 7.293847e-001,
+7.303992e-001, 7.314125e-001, 7.324116e-001, 7.334107e-001, 7.344097e-001, 7.353923e-001, 7.363749e-001, 7.373575e-001, 7.383250e-001, 7.392911e-001,
+7.402572e-001, 7.412113e-001, 7.421622e-001, 7.431130e-001, 7.440556e-001, 7.449935e-001, 7.459315e-001, 7.468625e-001, 7.477857e-001, 7.487088e-001,
+7.496278e-001, 7.505353e-001, 7.514428e-001, 7.523497e-001, 7.532437e-001, 7.541377e-001, 7.550317e-001, 7.559168e-001, 7.567996e-001, 7.576824e-001,
+7.585588e-001, 7.594292e-001, 7.602995e-001, 7.611671e-001, 7.620239e-001, 7.628808e-001, 7.637376e-001, 7.645833e-001, 7.654272e-001, 7.662712e-001,
+7.671090e-001, 7.679409e-001, 7.687727e-001, 7.696030e-001, 7.704212e-001, 7.712394e-001, 7.720576e-001, 7.728674e-001, 7.736734e-001, 7.744794e-001,
+7.752828e-001, 7.760780e-001, 7.768732e-001, 7.776685e-001, 7.784558e-001, 7.792407e-001, 7.800256e-001, 7.808078e-001, 7.815822e-001, 7.823565e-001,
+7.831308e-001, 7.838967e-001, 7.846595e-001, 7.854222e-001, 7.861833e-001, 7.869360e-001, 7.876887e-001, 7.884414e-001, 7.891888e-001, 7.899321e-001,
+7.906754e-001, 7.914187e-001, 7.921545e-001, 7.928900e-001, 7.936254e-001, 7.943582e-001, 7.950846e-001, 7.958110e-001, 7.965374e-001, 7.972584e-001,
+7.979759e-001, 7.986935e-001, 7.994110e-001, 8.001213e-001, 8.008308e-001, 8.015402e-001, 8.022487e-001, 8.029517e-001, 8.036547e-001, 8.043577e-001,
+8.050580e-001, 8.057534e-001, 8.064489e-001, 8.071444e-001, 8.078359e-001, 8.085243e-001, 8.092127e-001, 8.099011e-001, 8.105851e-001, 8.112673e-001,
+8.119495e-001, 8.126318e-001, 8.133102e-001, 8.139880e-001, 8.146658e-001, 8.153436e-001, 8.160151e-001, 8.166864e-001, 8.173576e-001, 8.180288e-001,
+8.186935e-001, 8.193582e-001, 8.200229e-001, 8.206875e-001, 8.213470e-001, 8.220065e-001, 8.226660e-001, 8.233253e-001, 8.239794e-001, 8.246335e-001,
+8.252876e-001, 8.259417e-001, 8.265890e-001, 8.272364e-001, 8.278837e-001, 8.285311e-001, 8.291730e-001, 8.298146e-001, 8.304562e-001, 8.310978e-001,
+8.317348e-001, 8.323709e-001, 8.330071e-001, 8.336432e-001, 8.342744e-001, 8.349035e-001, 8.355325e-001, 8.361616e-001, 8.367878e-001, 8.374114e-001,
+8.380349e-001, 8.386585e-001, 8.392807e-001, 8.399002e-001, 8.405197e-001, 8.411392e-001, 8.417585e-001, 8.423753e-001, 8.429922e-001, 8.436090e-001,
+8.442259e-001, 8.448395e-001, 8.454523e-001, 8.460650e-001, 8.466778e-001, 8.472879e-001, 8.478951e-001, 8.485023e-001, 8.491095e-001, 8.497162e-001,
+8.503192e-001, 8.509223e-001, 8.515254e-001, 8.521285e-001, 8.527284e-001, 8.533272e-001, 8.539260e-001, 8.545249e-001, 8.551219e-001, 8.557152e-001,
+8.563086e-001, 8.569019e-001, 8.574953e-001, 8.580845e-001, 8.586730e-001, 8.592616e-001, 8.598501e-001, 8.604367e-001, 8.610199e-001, 8.616031e-001,
+8.621864e-001, 8.627696e-001, 8.633473e-001, 8.639241e-001, 8.645008e-001, 8.650775e-001, 8.656530e-001, 8.662251e-001, 8.667972e-001, 8.673693e-001,
+8.679414e-001, 8.685104e-001, 8.690779e-001, 8.696454e-001, 8.702129e-001, 8.707803e-001, 8.713405e-001, 8.719006e-001, 8.724608e-001, 8.730209e-001,
+8.735787e-001, 8.741318e-001, 8.746848e-001, 8.752379e-001, 8.757909e-001, 8.763407e-001, 8.768884e-001, 8.774360e-001, 8.779837e-001, 8.785313e-001,
+8.790736e-001, 8.796148e-001, 8.801560e-001, 8.806972e-001, 8.812381e-001, 8.817704e-001, 8.823026e-001, 8.828349e-001, 8.833671e-001, 8.838980e-001,
+8.844234e-001, 8.849488e-001, 8.854741e-001, 8.859995e-001, 8.865231e-001, 8.870428e-001, 8.875625e-001, 8.880822e-001, 8.886019e-001, 8.891187e-001,
+8.896308e-001, 8.901429e-001, 8.906550e-001, 8.911671e-001, 8.916762e-001, 8.921812e-001, 8.926862e-001, 8.931912e-001, 8.936962e-001, 8.941987e-001,
+8.946978e-001, 8.951969e-001, 8.956960e-001, 8.961951e-001, 8.966917e-001, 8.971841e-001, 8.976764e-001, 8.981688e-001, 8.986611e-001, 8.991514e-001,
+8.996361e-001, 9.001209e-001, 9.006056e-001, 9.010904e-001, 9.015742e-001, 9.020526e-001, 9.025310e-001, 9.030094e-001, 9.034878e-001, 9.039662e-001,
+9.044384e-001, 9.049104e-001, 9.053823e-001, 9.058543e-001, 9.063263e-001, 9.067928e-001, 9.072575e-001, 9.077222e-001, 9.081869e-001, 9.086516e-001,
+9.091124e-001, 9.095693e-001, 9.100261e-001, 9.104830e-001, 9.109398e-001, 9.113955e-001, 9.118455e-001, 9.122956e-001, 9.127457e-001, 9.131958e-001,
+9.136459e-001, 9.140904e-001, 9.145338e-001, 9.149773e-001, 9.154207e-001, 9.158641e-001, 9.163044e-001, 9.167406e-001, 9.171768e-001, 9.176130e-001,
+9.180492e-001, 9.184855e-001, 9.189139e-001, 9.193423e-001, 9.197708e-001, 9.201992e-001, 9.206276e-001, 9.210522e-001, 9.214731e-001, 9.218940e-001,
+9.223149e-001, 9.227359e-001, 9.231568e-001, 9.235707e-001, 9.239846e-001, 9.243984e-001, 9.248123e-001, 9.252261e-001, 9.256373e-001, 9.260444e-001,
+9.264515e-001, 9.268587e-001, 9.272658e-001, 9.276730e-001, 9.280739e-001, 9.284730e-001, 9.288722e-001, 9.292714e-001, 9.296706e-001, 9.300687e-001,
+9.304582e-001, 9.308476e-001, 9.312371e-001, 9.316265e-001, 9.320160e-001, 9.324021e-001, 9.327831e-001, 9.331640e-001, 9.335450e-001, 9.339260e-001,
+9.343069e-001, 9.346833e-001, 9.350570e-001, 9.354307e-001, 9.358044e-001, 9.361781e-001, 9.365519e-001, 9.369189e-001, 9.372844e-001, 9.376500e-001,
+9.380156e-001, 9.383811e-001, 9.387467e-001, 9.391041e-001, 9.394612e-001, 9.398183e-001, 9.401754e-001, 9.405325e-001, 9.408892e-001, 9.412378e-001,
+9.415864e-001, 9.419351e-001, 9.422837e-001, 9.426323e-001, 9.429801e-001, 9.433202e-001, 9.436603e-001, 9.440004e-001, 9.443404e-001, 9.446805e-001,
+9.450199e-001, 9.453522e-001, 9.456846e-001, 9.460169e-001, 9.463492e-001, 9.466815e-001, 9.470136e-001, 9.473391e-001, 9.476645e-001, 9.479899e-001,
+9.483153e-001, 9.486407e-001, 9.489661e-001, 9.492859e-001, 9.496051e-001, 9.499244e-001, 9.502437e-001, 9.505629e-001, 9.508822e-001, 9.511962e-001,
+9.515085e-001, 9.518209e-001, 9.521333e-001, 9.524456e-001, 9.527580e-001, 9.530654e-001, 9.533688e-001, 9.536722e-001, 9.539756e-001, 9.542790e-001,
+9.545823e-001, 9.548831e-001, 9.551774e-001, 9.554717e-001, 9.557660e-001, 9.560603e-001, 9.563546e-001, 9.566489e-001, 9.569364e-001, 9.572236e-001,
+9.575109e-001, 9.577982e-001, 9.580854e-001, 9.583727e-001, 9.586552e-001, 9.589346e-001, 9.592140e-001, 9.594934e-001, 9.597727e-001, 9.600521e-001,
+9.603300e-001, 9.606015e-001, 9.608730e-001, 9.611444e-001, 9.614159e-001, 9.616873e-001, 9.619588e-001, 9.622258e-001, 9.624909e-001, 9.627561e-001,
+9.630213e-001, 9.632865e-001, 9.635517e-001, 9.638155e-001, 9.640734e-001, 9.643313e-001, 9.645892e-001, 9.648472e-001, 9.651051e-001, 9.653630e-001,
+9.656159e-001, 9.658656e-001, 9.661153e-001, 9.663649e-001, 9.666146e-001, 9.668643e-001, 9.671139e-001, 9.673559e-001, 9.675977e-001, 9.678394e-001,
+9.680812e-001, 9.683229e-001, 9.685647e-001, 9.688042e-001, 9.690379e-001, 9.692716e-001, 9.695052e-001, 9.697389e-001, 9.699726e-001, 9.702062e-001,
+9.704348e-001, 9.706589e-001, 9.708830e-001, 9.711070e-001, 9.713311e-001, 9.715552e-001, 9.717792e-001, 9.719976e-001, 9.722137e-001, 9.724299e-001,
+9.726460e-001, 9.728622e-001, 9.730783e-001, 9.732945e-001, 9.735054e-001, 9.737156e-001, 9.739257e-001, 9.741358e-001, 9.743460e-001, 9.745561e-001,
+9.747662e-001, 9.749692e-001, 9.751719e-001, 9.753745e-001, 9.755771e-001, 9.757798e-001, 9.759824e-001, 9.761850e-001, 9.763807e-001, 9.765762e-001,
+9.767717e-001, 9.769671e-001, 9.771626e-001, 9.773581e-001, 9.775536e-001, 9.777433e-001, 9.779327e-001, 9.781220e-001, 9.783114e-001, 9.785007e-001,
+9.786901e-001, 9.788795e-001, 9.790634e-001, 9.792463e-001, 9.794292e-001, 9.796122e-001, 9.797951e-001, 9.799781e-001, 9.801610e-001, 9.803391e-001,
+9.805151e-001, 9.806912e-001, 9.808672e-001, 9.810432e-001, 9.812192e-001, 9.813953e-001, 9.815682e-001, 9.817378e-001, 9.819074e-001, 9.820770e-001,
+9.822466e-001, 9.824163e-001, 9.825859e-001, 9.827543e-001, 9.829187e-001, 9.830831e-001, 9.832474e-001, 9.834118e-001, 9.835762e-001, 9.837405e-001,
+9.839049e-001, 9.840625e-001, 9.842192e-001, 9.843759e-001, 9.845327e-001, 9.846894e-001, 9.848462e-001, 9.850029e-001, 9.851562e-001, 9.853060e-001,
+9.854558e-001, 9.856056e-001, 9.857554e-001, 9.859052e-001, 9.860550e-001, 9.862046e-001, 9.863499e-001, 9.864953e-001, 9.866407e-001, 9.867861e-001,
+9.869315e-001, 9.870769e-001, 9.872222e-001, 9.873658e-001, 9.875077e-001, 9.876495e-001, 9.877914e-001, 9.879333e-001, 9.880752e-001, 9.882171e-001,
+9.883590e-001, 9.884965e-001, 9.886338e-001, 9.887710e-001, 9.889083e-001, 9.890456e-001, 9.891829e-001, 9.893202e-001, 9.894558e-001, 9.895876e-001,
+9.897194e-001, 9.898513e-001, 9.899831e-001, 9.901149e-001, 9.902468e-001, 9.903786e-001, 9.905072e-001, 9.906337e-001, 9.907602e-001, 9.908868e-001,
+9.910133e-001, 9.911398e-001, 9.912663e-001, 9.913928e-001, 9.915156e-001, 9.916377e-001, 9.917598e-001, 9.918819e-001, 9.920039e-001, 9.921260e-001,
+9.922481e-001, 9.923701e-001, 9.924876e-001, 9.926050e-001, 9.927225e-001, 9.928400e-001, 9.929574e-001, 9.930749e-001, 9.931924e-001, 9.933093e-001,
+9.934215e-001, 9.935337e-001, 9.936459e-001, 9.937581e-001, 9.938703e-001, 9.939825e-001, 9.940948e-001, 9.942062e-001, 9.943130e-001, 9.944198e-001,
+9.945265e-001, 9.946333e-001, 9.947401e-001, 9.948469e-001, 9.949537e-001, 9.950599e-001, 9.951618e-001, 9.952636e-001, 9.953655e-001, 9.954673e-001,
+9.955692e-001, 9.956710e-001, 9.957729e-001, 9.958746e-001, 9.959716e-001, 9.960686e-001, 9.961656e-001, 9.962626e-001, 9.963596e-001, 9.964566e-001,
+9.965536e-001, 9.966506e-001, 9.967427e-001, 9.968339e-001, 9.969252e-001, 9.970164e-001, 9.971077e-001, 9.971989e-001, 9.972902e-001, 9.973814e-001,
+9.974687e-001, 9.975536e-001, 9.976384e-001, 9.977233e-001, 9.978081e-001, 9.978930e-001, 9.979778e-001, 9.980627e-001, 9.981455e-001, 9.982241e-001,
+9.983026e-001, 9.983812e-001, 9.984597e-001, 9.985383e-001, 9.986168e-001, 9.986954e-001, 9.987739e-001, 9.988479e-001, 9.989217e-001, 9.989954e-001,
+9.990692e-001, 9.991430e-001, 9.992167e-001, 9.992905e-001, 9.993643e-001, 9.994364e-001, 9.995068e-001, 9.995773e-001, 9.996477e-001, 9.997182e-001,
+9.997886e-001, 9.998591e-001, 9.999295e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.651573e-004, 5.488236e-004, 8.598516e-004, 1.207489e-003, 1.599157e-003, 2.036594e-003, 2.516341e-003, 3.030006e-003, 3.567642e-003,
+4.119174e-003, 4.677831e-003, 5.241194e-003, 5.810282e-003, 6.387471e-003, 6.976211e-003, 7.579733e-003, 8.201656e-003, 8.843183e-003, 9.506729e-003,
+1.019260e-002, 1.090117e-002, 1.163258e-002, 1.238441e-002, 1.315734e-002, 1.395121e-002, 1.476484e-002, 1.559859e-002, 1.645216e-002, 1.732630e-002,
+1.821920e-002, 1.913009e-002, 2.006002e-002, 2.100821e-002, 2.197497e-002, 2.295922e-002, 2.396221e-002, 2.498283e-002, 2.601999e-002, 2.707222e-002,
+2.814060e-002, 2.922403e-002, 3.032112e-002, 3.143167e-002, 3.255581e-002, 3.369360e-002, 3.484461e-002, 3.600878e-002, 3.718542e-002, 3.837352e-002,
+3.957414e-002, 4.078665e-002, 4.201088e-002, 4.324581e-002, 4.449076e-002, 4.574571e-002, 4.701013e-002, 4.828500e-002, 4.956959e-002, 5.086224e-002,
+5.216236e-002, 5.346984e-002, 5.478485e-002, 5.610868e-002, 5.743979e-002, 5.877810e-002, 6.012342e-002, 6.147609e-002, 6.283496e-002, 6.420085e-002,
+6.557145e-002, 6.694775e-002, 6.832941e-002, 6.971808e-002, 7.111199e-002, 7.251022e-002, 7.391434e-002, 7.532307e-002, 7.673542e-002, 7.815248e-002,
+7.957281e-002, 8.099544e-002, 8.242129e-002, 8.385133e-002, 8.528488e-002, 8.672181e-002, 8.816163e-002, 8.960412e-002, 9.104920e-002, 9.249702e-002,
+9.394737e-002, 9.539991e-002, 9.685507e-002, 9.831130e-002, 9.976812e-002, 1.012267e-001, 1.026866e-001, 1.041481e-001, 1.056121e-001, 1.070774e-001,
+1.085444e-001, 1.100130e-001, 1.114827e-001, 1.129538e-001, 1.144248e-001, 1.158970e-001, 1.173701e-001, 1.188449e-001, 1.203223e-001, 1.218005e-001,
+1.232802e-001, 1.247610e-001, 1.262426e-001, 1.277255e-001, 1.292095e-001, 1.306941e-001, 1.321795e-001, 1.336652e-001, 1.351507e-001, 1.366363e-001,
+1.381221e-001, 1.396085e-001, 1.410956e-001, 1.425838e-001, 1.440731e-001, 1.455630e-001, 1.470534e-001, 1.485445e-001, 1.500364e-001, 1.515290e-001,
+1.530222e-001, 1.545169e-001, 1.560124e-001, 1.575090e-001, 1.590068e-001, 1.605063e-001, 1.620069e-001, 1.635068e-001, 1.650067e-001, 1.665070e-001,
+1.680079e-001, 1.695086e-001, 1.710103e-001, 1.725132e-001, 1.740172e-001, 1.755215e-001, 1.770250e-001, 1.785289e-001, 1.800336e-001, 1.815388e-001,
+1.830437e-001, 1.845479e-001, 1.860512e-001, 1.875542e-001, 1.890579e-001, 1.905619e-001, 1.920656e-001, 1.935692e-001, 1.950727e-001, 1.965762e-001,
+1.980797e-001, 1.995833e-001, 2.010867e-001, 2.025887e-001, 2.040903e-001, 2.055918e-001, 2.070933e-001, 2.085942e-001, 2.100945e-001, 2.115939e-001,
+2.130924e-001, 2.145905e-001, 2.160880e-001, 2.175852e-001, 2.190823e-001, 2.205786e-001, 2.220752e-001, 2.235720e-001, 2.250702e-001, 2.265687e-001,
+2.280677e-001, 2.295664e-001, 2.310650e-001, 2.325633e-001, 2.340616e-001, 2.355600e-001, 2.370589e-001, 2.385578e-001, 2.400566e-001, 2.415552e-001,
+2.430536e-001, 2.445523e-001, 2.460512e-001, 2.475510e-001, 2.490515e-001, 2.505529e-001, 2.520550e-001, 2.535574e-001, 2.550599e-001, 2.565626e-001,
+2.580656e-001, 2.595696e-001, 2.610749e-001, 2.625810e-001, 2.640874e-001, 2.655943e-001, 2.671013e-001, 2.686109e-001, 2.701209e-001, 2.716321e-001,
+2.731436e-001, 2.746557e-001, 2.761683e-001, 2.776814e-001, 2.791966e-001, 2.807131e-001, 2.822310e-001, 2.837496e-001, 2.852682e-001, 2.867869e-001,
+2.883065e-001, 2.898262e-001, 2.913483e-001, 2.928705e-001, 2.943948e-001, 2.959192e-001, 2.974444e-001, 2.989696e-001, 3.004953e-001, 3.020209e-001,
+3.035480e-001, 3.050751e-001, 3.066017e-001, 3.081283e-001, 3.096539e-001, 3.111794e-001, 3.127050e-001, 3.142306e-001, 3.157571e-001, 3.172838e-001,
+3.188111e-001, 3.203385e-001, 3.218651e-001, 3.233913e-001, 3.249165e-001, 3.264404e-001, 3.279637e-001, 3.294859e-001, 3.310079e-001, 3.325292e-001,
+3.340505e-001, 3.355714e-001, 3.370924e-001, 3.386130e-001, 3.401335e-001, 3.416540e-001, 3.431745e-001, 3.446949e-001, 3.462151e-001, 3.477351e-001,
+3.492533e-001, 3.507715e-001, 3.522873e-001, 3.538026e-001, 3.553164e-001, 3.568288e-001, 3.583407e-001, 3.598510e-001, 3.613612e-001, 3.628712e-001,
+3.643811e-001, 3.658905e-001, 3.673992e-001, 3.689077e-001, 3.704145e-001, 3.719212e-001, 3.734270e-001, 3.749325e-001, 3.764375e-001, 3.779416e-001,
+3.794458e-001, 3.809471e-001, 3.824483e-001, 3.839478e-001, 3.854454e-001, 3.869430e-001, 3.884388e-001, 3.899345e-001, 3.914294e-001, 3.929235e-001,
+3.944176e-001, 3.959100e-001, 3.974024e-001, 3.988932e-001, 4.003824e-001, 4.018716e-001, 4.033573e-001, 4.048428e-001, 4.063271e-001, 4.078091e-001,
+4.092912e-001, 4.107703e-001, 4.122484e-001, 4.137261e-001, 4.152004e-001, 4.166748e-001, 4.181471e-001, 4.196173e-001, 4.210875e-001, 4.225546e-001,
+4.240212e-001, 4.254870e-001, 4.269488e-001, 4.284106e-001, 4.298702e-001, 4.313270e-001, 4.327838e-001, 4.342373e-001, 4.356895e-001, 4.371416e-001,
+4.385891e-001, 4.400365e-001, 4.414830e-001, 4.429263e-001, 4.443696e-001, 4.458108e-001, 4.472492e-001, 4.486875e-001, 4.501225e-001, 4.515552e-001,
+4.529878e-001, 4.544156e-001, 4.558417e-001, 4.572679e-001, 4.586882e-001, 4.601078e-001, 4.615274e-001, 4.629419e-001, 4.643563e-001, 4.657704e-001,
+4.671807e-001, 4.685910e-001, 4.700006e-001, 4.714062e-001, 4.728118e-001, 4.742165e-001, 4.756168e-001, 4.770171e-001, 4.784163e-001, 4.798108e-001,
+4.812052e-001, 4.825986e-001, 4.839866e-001, 4.853747e-001, 4.867617e-001, 4.881420e-001, 4.895224e-001, 4.909023e-001, 4.922760e-001, 4.936497e-001,
+4.950234e-001, 4.963918e-001, 4.977601e-001, 4.991284e-001, 5.004917e-001, 5.018543e-001, 5.032168e-001, 5.045749e-001, 5.059313e-001, 5.072877e-001,
+5.086405e-001, 5.099905e-001, 5.113405e-001, 5.126873e-001, 5.140289e-001, 5.153704e-001, 5.167104e-001, 5.180424e-001, 5.193743e-001, 5.207062e-001,
+5.220302e-001, 5.233533e-001, 5.246765e-001, 5.259948e-001, 5.273104e-001, 5.286259e-001, 5.299392e-001, 5.312479e-001, 5.325566e-001, 5.338653e-001,
+5.351672e-001, 5.364691e-001, 5.377710e-001, 5.390685e-001, 5.403637e-001, 5.416589e-001, 5.429524e-001, 5.442410e-001, 5.455295e-001, 5.468181e-001,
+5.481012e-001, 5.493832e-001, 5.506652e-001, 5.519440e-001, 5.532179e-001, 5.544919e-001, 5.557658e-001, 5.570312e-001, 5.582960e-001, 5.595609e-001,
+5.608223e-001, 5.620794e-001, 5.633366e-001, 5.645937e-001, 5.658442e-001, 5.670942e-001, 5.683441e-001, 5.695917e-001, 5.708350e-001, 5.720782e-001,
+5.733215e-001, 5.745600e-001, 5.757972e-001, 5.770343e-001, 5.782706e-001, 5.795021e-001, 5.807337e-001, 5.819652e-001, 5.831942e-001, 5.844207e-001,
+5.856472e-001, 5.868737e-001, 5.880940e-001, 5.893130e-001, 5.905321e-001, 5.917500e-001, 5.929607e-001, 5.941714e-001, 5.953820e-001, 5.965897e-001,
+5.977927e-001, 5.989957e-001, 6.001987e-001, 6.013975e-001, 6.025936e-001, 6.037898e-001, 6.049859e-001, 6.061771e-001, 6.073671e-001, 6.085572e-001,
+6.097473e-001, 6.109320e-001, 6.121168e-001, 6.133015e-001, 6.144853e-001, 6.156625e-001, 6.168397e-001, 6.180169e-001, 6.191921e-001, 6.203611e-001,
+6.215300e-001, 6.226990e-001, 6.238657e-001, 6.250273e-001, 6.261890e-001, 6.273506e-001, 6.285101e-001, 6.296655e-001, 6.308208e-001, 6.319762e-001,
+6.331296e-001, 6.342797e-001, 6.354297e-001, 6.365797e-001, 6.377279e-001, 6.388722e-001, 6.400165e-001, 6.411608e-001, 6.423033e-001, 6.434405e-001,
+6.445778e-001, 6.457151e-001, 6.468512e-001, 6.479817e-001, 6.491122e-001, 6.502428e-001, 6.513730e-001, 6.524980e-001, 6.536230e-001, 6.547480e-001,
+6.558730e-001, 6.569942e-001, 6.581149e-001, 6.592355e-001, 6.603562e-001, 6.614738e-001, 6.625901e-001, 6.637063e-001, 6.648225e-001, 6.659369e-001,
+6.670492e-001, 6.681614e-001, 6.692736e-001, 6.703849e-001, 6.714921e-001, 6.725993e-001, 6.737065e-001, 6.748137e-001, 6.759157e-001, 6.770169e-001,
+6.781182e-001, 6.792195e-001, 6.803182e-001, 6.814149e-001, 6.825116e-001, 6.836083e-001, 6.847042e-001, 6.857963e-001, 6.868884e-001, 6.879805e-001,
+6.890726e-001, 6.901617e-001, 6.912498e-001, 6.923378e-001, 6.934259e-001, 6.945127e-001, 6.955967e-001, 6.966806e-001, 6.977646e-001, 6.988485e-001,
+6.999289e-001, 7.010085e-001, 7.020881e-001, 7.031678e-001, 7.042457e-001, 7.053195e-001, 7.063934e-001, 7.074673e-001, 7.085412e-001, 7.096114e-001,
+7.106803e-001, 7.117492e-001, 7.128180e-001, 7.138860e-001, 7.149490e-001, 7.160121e-001, 7.170751e-001, 7.181381e-001, 7.191971e-001, 7.202523e-001,
+7.213075e-001, 7.223627e-001, 7.234179e-001, 7.244673e-001, 7.255155e-001, 7.265638e-001, 7.276120e-001, 7.286596e-001, 7.297024e-001, 7.307453e-001,
+7.317881e-001, 7.328310e-001, 7.338718e-001, 7.349093e-001, 7.359468e-001, 7.369843e-001, 7.380217e-001, 7.390559e-001, 7.400876e-001, 7.411194e-001,
+7.421511e-001, 7.431828e-001, 7.442104e-001, 7.452366e-001, 7.462628e-001, 7.472890e-001, 7.483152e-001, 7.493350e-001, 7.503538e-001, 7.513727e-001,
+7.523915e-001, 7.534104e-001, 7.544204e-001, 7.554300e-001, 7.564396e-001, 7.574492e-001, 7.584587e-001, 7.594599e-001, 7.604611e-001, 7.614623e-001,
+7.624635e-001, 7.634646e-001, 7.644580e-001, 7.654514e-001, 7.664448e-001, 7.674382e-001, 7.684317e-001, 7.694170e-001, 7.704022e-001, 7.713874e-001,
+7.723725e-001, 7.733577e-001, 7.743354e-001, 7.753123e-001, 7.762892e-001, 7.772661e-001, 7.782430e-001, 7.792145e-001, 7.801844e-001, 7.811543e-001,
+7.821243e-001, 7.830942e-001, 7.840591e-001, 7.850209e-001, 7.859826e-001, 7.869444e-001, 7.879061e-001, 7.888635e-001, 7.898143e-001, 7.907652e-001,
+7.917160e-001, 7.926669e-001, 7.936160e-001, 7.945556e-001, 7.954953e-001, 7.964349e-001, 7.973746e-001, 7.983142e-001, 7.992444e-001, 8.001731e-001,
+8.011018e-001, 8.020305e-001, 8.029591e-001, 8.038829e-001, 8.048022e-001, 8.057215e-001, 8.066408e-001, 8.075601e-001, 8.084780e-001, 8.093874e-001,
+8.102968e-001, 8.112063e-001, 8.121157e-001, 8.130251e-001, 8.139270e-001, 8.148259e-001, 8.157247e-001, 8.166236e-001, 8.175224e-001, 8.184180e-001,
+8.193031e-001, 8.201882e-001, 8.210734e-001, 8.219585e-001, 8.228436e-001, 8.237194e-001, 8.245917e-001, 8.254640e-001, 8.263362e-001, 8.272085e-001,
+8.280786e-001, 8.289378e-001, 8.297969e-001, 8.306560e-001, 8.315151e-001, 8.323743e-001, 8.332263e-001, 8.340724e-001, 8.349186e-001, 8.357648e-001,
+8.366110e-001, 8.374571e-001, 8.382914e-001, 8.391243e-001, 8.399572e-001, 8.407901e-001, 8.416229e-001, 8.424531e-001, 8.432716e-001, 8.440901e-001,
+8.449086e-001, 8.457271e-001, 8.465457e-001, 8.473573e-001, 8.481602e-001, 8.489631e-001, 8.497660e-001, 8.505689e-001, 8.513718e-001, 8.521641e-001,
+8.529504e-001, 8.537368e-001, 8.545232e-001, 8.553095e-001, 8.560959e-001, 8.568697e-001, 8.576403e-001, 8.584109e-001, 8.591815e-001, 8.599521e-001,
+8.607226e-001, 8.614792e-001, 8.622341e-001, 8.629890e-001, 8.637439e-001, 8.644988e-001, 8.652538e-001, 8.659942e-001, 8.667339e-001, 8.674736e-001,
+8.682133e-001, 8.689529e-001, 8.696926e-001, 8.704178e-001, 8.711423e-001, 8.718668e-001, 8.725913e-001, 8.733158e-001, 8.740403e-001, 8.747491e-001,
+8.754563e-001, 8.761636e-001, 8.768708e-001, 8.775781e-001, 8.782854e-001, 8.789795e-001, 8.796707e-001, 8.803619e-001, 8.810532e-001, 8.817444e-001,
+8.824356e-001, 8.831164e-001, 8.837922e-001, 8.844680e-001, 8.851438e-001, 8.858197e-001, 8.864955e-001, 8.871643e-001, 8.878256e-001, 8.884869e-001,
+8.891481e-001, 8.898094e-001, 8.904707e-001, 8.911285e-001, 8.917748e-001, 8.924211e-001, 8.930674e-001, 8.937138e-001, 8.943601e-001, 8.950064e-001,
+8.956375e-001, 8.962675e-001, 8.968975e-001, 8.975275e-001, 8.981575e-001, 8.987876e-001, 8.994090e-001, 9.000242e-001, 9.006393e-001, 9.012545e-001,
+9.018696e-001, 9.024848e-001, 9.030974e-001, 9.036975e-001, 9.042976e-001, 9.048978e-001, 9.054979e-001, 9.060980e-001, 9.066982e-001, 9.072868e-001,
+9.078708e-001, 9.084548e-001, 9.090389e-001, 9.096229e-001, 9.102069e-001, 9.107877e-001, 9.113559e-001, 9.119240e-001, 9.124921e-001, 9.130602e-001,
+9.136284e-001, 9.141965e-001, 9.147549e-001, 9.153077e-001, 9.158604e-001, 9.164132e-001, 9.169659e-001, 9.175187e-001, 9.180713e-001, 9.186088e-001,
+9.191463e-001, 9.196838e-001, 9.202213e-001, 9.207588e-001, 9.212963e-001, 9.218287e-001, 9.223511e-001, 9.228736e-001, 9.233960e-001, 9.239185e-001,
+9.244409e-001, 9.249634e-001, 9.254769e-001, 9.259846e-001, 9.264923e-001, 9.270000e-001, 9.275077e-001, 9.280154e-001, 9.285231e-001, 9.290190e-001,
+9.295124e-001, 9.300057e-001, 9.304990e-001, 9.309923e-001, 9.314856e-001, 9.319790e-001, 9.324583e-001, 9.329372e-001, 9.334161e-001, 9.338951e-001,
+9.343740e-001, 9.348529e-001, 9.353309e-001, 9.357969e-001, 9.362628e-001, 9.367287e-001, 9.371946e-001, 9.376606e-001, 9.381265e-001, 9.385910e-001,
+9.390441e-001, 9.394973e-001, 9.399505e-001, 9.404036e-001, 9.408568e-001, 9.413099e-001, 9.417619e-001, 9.422025e-001, 9.426430e-001, 9.430836e-001,
+9.435242e-001, 9.439647e-001, 9.444053e-001, 9.448456e-001, 9.452726e-001, 9.456996e-001, 9.461266e-001, 9.465536e-001, 9.469807e-001, 9.474077e-001,
+9.478347e-001, 9.482500e-001, 9.486637e-001, 9.490775e-001, 9.494913e-001, 9.499050e-001, 9.503188e-001, 9.507326e-001, 9.511371e-001, 9.515375e-001,
+9.519380e-001, 9.523384e-001, 9.527388e-001, 9.531392e-001, 9.535397e-001, 9.539345e-001, 9.543223e-001, 9.547100e-001, 9.550977e-001, 9.554854e-001,
+9.558732e-001, 9.562609e-001, 9.566474e-001, 9.570254e-001, 9.574033e-001, 9.577813e-001, 9.581593e-001, 9.585372e-001, 9.589152e-001, 9.592932e-001,
+9.596646e-001, 9.600340e-001, 9.604033e-001, 9.607726e-001, 9.611419e-001, 9.615113e-001, 9.618806e-001, 9.622469e-001, 9.626068e-001, 9.629666e-001,
+9.633265e-001, 9.636863e-001, 9.640462e-001, 9.644060e-001, 9.647659e-001, 9.651184e-001, 9.654694e-001, 9.658203e-001, 9.661713e-001, 9.665222e-001,
+9.668732e-001, 9.672241e-001, 9.675728e-001, 9.679150e-001, 9.682573e-001, 9.685995e-001, 9.689417e-001, 9.692840e-001, 9.696262e-001, 9.699684e-001,
+9.703048e-001, 9.706378e-001, 9.709707e-001, 9.713037e-001, 9.716366e-001, 9.719696e-001, 9.723025e-001, 9.726355e-001, 9.729599e-001, 9.732838e-001,
+9.736077e-001, 9.739316e-001, 9.742555e-001, 9.745794e-001, 9.749033e-001, 9.752253e-001, 9.755398e-001, 9.758542e-001, 9.761686e-001, 9.764831e-001,
+9.767975e-001, 9.771119e-001, 9.774263e-001, 9.777372e-001, 9.780421e-001, 9.783470e-001, 9.786519e-001, 9.789569e-001, 9.792618e-001, 9.795667e-001,
+9.798717e-001, 9.801716e-001, 9.804665e-001, 9.807614e-001, 9.810563e-001, 9.813512e-001, 9.816461e-001, 9.819410e-001, 9.822359e-001, 9.825251e-001,
+9.828099e-001, 9.830946e-001, 9.833794e-001, 9.836641e-001, 9.839489e-001, 9.842336e-001, 9.845184e-001, 9.847974e-001, 9.850716e-001, 9.853458e-001,
+9.856201e-001, 9.858943e-001, 9.861685e-001, 9.864427e-001, 9.867169e-001, 9.869858e-001, 9.872485e-001, 9.875112e-001, 9.877739e-001, 9.880367e-001,
+9.882994e-001, 9.885621e-001, 9.888248e-001, 9.890836e-001, 9.893341e-001, 9.895847e-001, 9.898352e-001, 9.900857e-001, 9.903362e-001, 9.905868e-001,
+9.908373e-001, 9.910866e-001, 9.913257e-001, 9.915647e-001, 9.918038e-001, 9.920429e-001, 9.922819e-001, 9.925210e-001, 9.927601e-001, 9.929992e-001,
+9.932284e-001, 9.934555e-001, 9.936827e-001, 9.939098e-001, 9.941370e-001, 9.943641e-001, 9.945912e-001, 9.948184e-001, 9.950396e-001, 9.952541e-001,
+9.954687e-001, 9.956832e-001, 9.958978e-001, 9.961123e-001, 9.963269e-001, 9.965414e-001, 9.967552e-001, 9.969543e-001, 9.971534e-001, 9.973524e-001,
+9.975515e-001, 9.977506e-001, 9.979497e-001, 9.981488e-001, 9.983479e-001, 9.985378e-001, 9.987206e-001, 9.989034e-001, 9.990861e-001, 9.992689e-001,
+9.994517e-001, 9.996345e-001, 9.998172e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.448886e-004, 1.123649e-003, 1.756121e-003, 2.457265e-003, 3.218599e-003, 4.028424e-003, 4.890279e-003, 5.821413e-003, 6.837263e-003,
+7.947755e-003, 9.158340e-003, 1.046632e-002, 1.186619e-002, 1.335332e-002, 1.492566e-002, 1.657880e-002, 1.830574e-002, 2.009763e-002, 2.194223e-002,
+2.383280e-002, 2.576118e-002, 2.772152e-002, 2.971721e-002, 3.174826e-002, 3.381728e-002, 3.593074e-002, 3.808842e-002, 4.029553e-002, 4.255955e-002,
+4.487400e-002, 4.724895e-002, 4.968539e-002, 5.218299e-002, 5.474076e-002, 5.735740e-002, 6.002968e-002, 6.275127e-002, 6.551231e-002, 6.830110e-002,
+7.110850e-002, 7.392319e-002, 7.673564e-002, 7.954550e-002, 8.234798e-002, 8.513103e-002, 8.789513e-002, 9.064175e-002, 9.337192e-002, 9.608130e-002,
+9.877116e-002, 1.014439e-001, 1.041020e-001, 1.067483e-001, 1.093854e-001, 1.120164e-001, 1.146424e-001, 1.172647e-001, 1.198822e-001, 1.224959e-001,
+1.251044e-001, 1.277082e-001, 1.303080e-001, 1.329074e-001, 1.355096e-001, 1.381138e-001, 1.407177e-001, 1.433235e-001, 1.459300e-001, 1.485394e-001,
+1.511545e-001, 1.537750e-001, 1.563980e-001, 1.590255e-001, 1.616582e-001, 1.642965e-001, 1.669409e-001, 1.695917e-001, 1.722506e-001, 1.749189e-001,
+1.775977e-001, 1.802870e-001, 1.829871e-001, 1.856993e-001, 1.884211e-001, 1.911549e-001, 1.939021e-001, 1.966607e-001, 1.994311e-001, 2.022143e-001,
+2.050091e-001, 2.078166e-001, 2.106340e-001, 2.134619e-001, 2.162988e-001, 2.191400e-001, 2.219882e-001, 2.248431e-001, 2.277006e-001, 2.305589e-001,
+2.334149e-001, 2.362656e-001, 2.391108e-001, 2.419497e-001, 2.447792e-001, 2.475973e-001, 2.504028e-001, 2.531930e-001, 2.559669e-001, 2.587236e-001,
+2.614610e-001, 2.641792e-001, 2.668775e-001, 2.695546e-001, 2.722115e-001, 2.748483e-001, 2.774636e-001, 2.800571e-001, 2.826283e-001, 2.851763e-001,
+2.877006e-001, 2.902010e-001, 2.926792e-001, 2.951336e-001, 2.975631e-001, 2.999700e-001, 3.023561e-001, 3.047227e-001, 3.070712e-001, 3.094023e-001,
+3.117176e-001, 3.140189e-001, 3.163051e-001, 3.185761e-001, 3.208333e-001, 3.230776e-001, 3.253093e-001, 3.275284e-001, 3.297385e-001, 3.319406e-001,
+3.341340e-001, 3.363187e-001, 3.384950e-001, 3.406594e-001, 3.428128e-001, 3.449562e-001, 3.470907e-001, 3.492175e-001, 3.513374e-001, 3.534527e-001,
+3.555640e-001, 3.576712e-001, 3.597705e-001, 3.618609e-001, 3.639445e-001, 3.660219e-001, 3.680921e-001, 3.701566e-001, 3.722172e-001, 3.742742e-001,
+3.763269e-001, 3.783759e-001, 3.804208e-001, 3.824599e-001, 3.844921e-001, 3.865206e-001, 3.885455e-001, 3.905645e-001, 3.925797e-001, 3.945915e-001,
+3.965988e-001, 3.986021e-001, 4.006024e-001, 4.025978e-001, 4.045889e-001, 4.065766e-001, 4.085580e-001, 4.105338e-001, 4.125058e-001, 4.144718e-001,
+4.164348e-001, 4.183955e-001, 4.203528e-001, 4.223093e-001, 4.242647e-001, 4.262181e-001, 4.281706e-001, 4.301217e-001, 4.320701e-001, 4.340169e-001,
+4.359581e-001, 4.378975e-001, 4.398346e-001, 4.417699e-001, 4.437047e-001, 4.456392e-001, 4.475743e-001, 4.495103e-001, 4.514477e-001, 4.533854e-001,
+4.553222e-001, 4.572581e-001, 4.591920e-001, 4.611236e-001, 4.630536e-001, 4.649798e-001, 4.669052e-001, 4.688282e-001, 4.707511e-001, 4.726734e-001,
+4.745965e-001, 4.765201e-001, 4.784459e-001, 4.803726e-001, 4.822997e-001, 4.842267e-001, 4.861503e-001, 4.880726e-001, 4.899900e-001, 4.919059e-001,
+4.938190e-001, 4.957309e-001, 4.976414e-001, 4.995503e-001, 5.014581e-001, 5.033628e-001, 5.052658e-001, 5.071659e-001, 5.090648e-001, 5.109594e-001,
+5.128529e-001, 5.147393e-001, 5.166243e-001, 5.185018e-001, 5.203778e-001, 5.222444e-001, 5.241092e-001, 5.259639e-001, 5.278167e-001, 5.296615e-001,
+5.315044e-001, 5.333401e-001, 5.351736e-001, 5.369982e-001, 5.388191e-001, 5.406310e-001, 5.424375e-001, 5.442360e-001, 5.460273e-001, 5.478109e-001,
+5.495835e-001, 5.513506e-001, 5.531037e-001, 5.548540e-001, 5.565863e-001, 5.583185e-001, 5.600316e-001, 5.617441e-001, 5.634423e-001, 5.651365e-001,
+5.668197e-001, 5.684949e-001, 5.701625e-001, 5.718169e-001, 5.734683e-001, 5.750987e-001, 5.767290e-001, 5.783388e-001, 5.799455e-001, 5.815385e-001,
+5.831219e-001, 5.846983e-001, 5.862581e-001, 5.878178e-001, 5.893549e-001, 5.908914e-001, 5.924148e-001, 5.939309e-001, 5.954414e-001, 5.969383e-001,
+5.984352e-001, 5.999152e-001, 6.013937e-001, 6.028618e-001, 6.043204e-001, 6.057765e-001, 6.072123e-001, 6.086481e-001, 6.100676e-001, 6.114793e-001,
+6.128859e-001, 6.142745e-001, 6.156632e-001, 6.170371e-001, 6.184060e-001, 6.197704e-001, 6.211217e-001, 6.224729e-001, 6.238121e-001, 6.251469e-001,
+6.264787e-001, 6.277984e-001, 6.291180e-001, 6.304269e-001, 6.317300e-001, 6.330316e-001, 6.343148e-001, 6.355979e-001, 6.368724e-001, 6.381373e-001,
+6.394021e-001, 6.406546e-001, 6.419049e-001, 6.431525e-001, 6.443893e-001, 6.456261e-001, 6.468564e-001, 6.480810e-001, 6.493057e-001, 6.505179e-001,
+6.517280e-001, 6.529360e-001, 6.541315e-001, 6.553270e-001, 6.565174e-001, 6.577004e-001, 6.588834e-001, 6.600583e-001, 6.612291e-001, 6.623998e-001,
+6.635617e-001, 6.647223e-001, 6.658821e-001, 6.670322e-001, 6.681822e-001, 6.693290e-001, 6.704663e-001, 6.716037e-001, 6.727369e-001, 6.738639e-001,
+6.749910e-001, 6.761143e-001, 6.772344e-001, 6.783545e-001, 6.794690e-001, 6.805803e-001, 6.816917e-001, 6.827974e-001, 6.839009e-001, 6.850043e-001,
+6.861021e-001, 6.871982e-001, 6.882944e-001, 6.893844e-001, 6.904730e-001, 6.915616e-001, 6.926428e-001, 6.937222e-001, 6.948017e-001, 6.958738e-001,
+6.969440e-001, 6.980141e-001, 6.990771e-001, 7.001376e-001, 7.011982e-001, 7.022536e-001, 7.033065e-001, 7.043594e-001, 7.054071e-001, 7.064511e-001,
+7.074951e-001, 7.085349e-001, 7.095699e-001, 7.106049e-001, 7.116366e-001, 7.126612e-001, 7.136859e-001, 7.147092e-001, 7.157247e-001, 7.167402e-001,
+7.177556e-001, 7.187632e-001, 7.197703e-001, 7.207775e-001, 7.217787e-001, 7.227776e-001, 7.237766e-001, 7.247711e-001, 7.257606e-001, 7.267501e-001,
+7.277382e-001, 7.287199e-001, 7.297016e-001, 7.306834e-001, 7.316589e-001, 7.326336e-001, 7.336083e-001, 7.345784e-001, 7.355447e-001, 7.365109e-001,
+7.374755e-001, 7.384330e-001, 7.393904e-001, 7.403479e-001, 7.412981e-001, 7.422464e-001, 7.431948e-001, 7.441395e-001, 7.450784e-001, 7.460173e-001,
+7.469562e-001, 7.478840e-001, 7.488111e-001, 7.497382e-001, 7.506607e-001, 7.515779e-001, 7.524952e-001, 7.534124e-001, 7.543212e-001, 7.552297e-001,
+7.561381e-001, 7.570431e-001, 7.579434e-001, 7.588437e-001, 7.597440e-001, 7.606366e-001, 7.615281e-001, 7.624196e-001, 7.633083e-001, 7.641899e-001,
+7.650715e-001, 7.659531e-001, 7.668282e-001, 7.676999e-001, 7.685715e-001, 7.694431e-001, 7.703048e-001, 7.711665e-001, 7.720282e-001, 7.728872e-001,
+7.737403e-001, 7.745935e-001, 7.754466e-001, 7.762938e-001, 7.771372e-001, 7.779806e-001, 7.788239e-001, 7.796578e-001, 7.804902e-001, 7.813225e-001,
+7.821539e-001, 7.829760e-001, 7.837981e-001, 7.846202e-001, 7.854394e-001, 7.862510e-001, 7.870626e-001, 7.878742e-001, 7.886820e-001, 7.894850e-001,
+7.902881e-001, 7.910911e-001, 7.918883e-001, 7.926810e-001, 7.934738e-001, 7.942666e-001, 7.950522e-001, 7.958343e-001, 7.966164e-001, 7.973985e-001,
+7.981729e-001, 7.989446e-001, 7.997163e-001, 8.004880e-001, 8.012521e-001, 8.020139e-001, 8.027758e-001, 8.035376e-001, 8.042909e-001, 8.050417e-001,
+8.057924e-001, 8.065432e-001, 8.072862e-001, 8.080264e-001, 8.087667e-001, 8.095069e-001, 8.102410e-001, 8.109721e-001, 8.117031e-001, 8.124342e-001,
+8.131593e-001, 8.138797e-001, 8.146002e-001, 8.153206e-001, 8.160365e-001, 8.167463e-001, 8.174561e-001, 8.181659e-001, 8.188730e-001, 8.195725e-001,
+8.202719e-001, 8.209714e-001, 8.216704e-001, 8.223609e-001, 8.230514e-001, 8.237419e-001, 8.244324e-001, 8.251158e-001, 8.257977e-001, 8.264795e-001,
+8.271614e-001, 8.278385e-001, 8.285115e-001, 8.291845e-001, 8.298574e-001, 8.305279e-001, 8.311897e-001, 8.318514e-001, 8.325132e-001, 8.331749e-001,
+8.338286e-001, 8.344811e-001, 8.351337e-001, 8.357863e-001, 8.364342e-001, 8.370774e-001, 8.377206e-001, 8.383639e-001, 8.390063e-001, 8.396390e-001,
+8.402718e-001, 8.409045e-001, 8.415373e-001, 8.421642e-001, 8.427875e-001, 8.434109e-001, 8.440342e-001, 8.446565e-001, 8.452716e-001, 8.458867e-001,
+8.465017e-001, 8.471168e-001, 8.477256e-001, 8.483303e-001, 8.489350e-001, 8.495396e-001, 8.501440e-001, 8.507388e-001, 8.513335e-001, 8.519283e-001,
+8.525231e-001, 8.531140e-001, 8.536998e-001, 8.542856e-001, 8.548713e-001, 8.554571e-001, 8.560362e-001, 8.566133e-001, 8.571905e-001, 8.577676e-001,
+8.583437e-001, 8.589095e-001, 8.594753e-001, 8.600411e-001, 8.606069e-001, 8.611692e-001, 8.617258e-001, 8.622823e-001, 8.628388e-001, 8.633953e-001,
+8.639467e-001, 8.644947e-001, 8.650428e-001, 8.655908e-001, 8.661388e-001, 8.666792e-001, 8.672177e-001, 8.677562e-001, 8.682947e-001, 8.688332e-001,
+8.693615e-001, 8.698895e-001, 8.704176e-001, 8.709456e-001, 8.714727e-001, 8.719914e-001, 8.725100e-001, 8.730287e-001, 8.735474e-001, 8.740645e-001,
+8.745745e-001, 8.750844e-001, 8.755943e-001, 8.761043e-001, 8.766121e-001, 8.771118e-001, 8.776115e-001, 8.781113e-001, 8.786110e-001, 8.791092e-001,
+8.796014e-001, 8.800936e-001, 8.805858e-001, 8.810780e-001, 8.815690e-001, 8.820533e-001, 8.825377e-001, 8.830221e-001, 8.835064e-001, 8.839902e-001,
+8.844660e-001, 8.849417e-001, 8.854175e-001, 8.858932e-001, 8.863690e-001, 8.868359e-001, 8.873022e-001, 8.877685e-001, 8.882348e-001, 8.887011e-001,
+8.891620e-001, 8.896213e-001, 8.900806e-001, 8.905399e-001, 8.909992e-001, 8.914547e-001, 8.919071e-001, 8.923595e-001, 8.928119e-001, 8.932643e-001,
+8.937140e-001, 8.941573e-001, 8.946007e-001, 8.950440e-001, 8.954873e-001, 8.959306e-001, 8.963645e-001, 8.967983e-001, 8.972321e-001, 8.976659e-001,
+8.980997e-001, 8.985281e-001, 8.989534e-001, 8.993787e-001, 8.998040e-001, 9.002294e-001, 9.006530e-001, 9.010718e-001, 9.014906e-001, 9.019094e-001,
+9.023282e-001, 9.027470e-001, 9.031598e-001, 9.035712e-001, 9.039826e-001, 9.043940e-001, 9.048055e-001, 9.052138e-001, 9.056160e-001, 9.060182e-001,
+9.064204e-001, 9.068226e-001, 9.072248e-001, 9.076195e-001, 9.080122e-001, 9.084050e-001, 9.087977e-001, 9.091905e-001, 9.095817e-001, 9.099675e-001,
+9.103533e-001, 9.107392e-001, 9.111250e-001, 9.115108e-001, 9.118929e-001, 9.122727e-001, 9.126524e-001, 9.130321e-001, 9.134118e-001, 9.137916e-001,
+9.141638e-001, 9.145356e-001, 9.149074e-001, 9.152792e-001, 9.156510e-001, 9.160209e-001, 9.163845e-001, 9.167480e-001, 9.171115e-001, 9.174751e-001,
+9.178386e-001, 9.181992e-001, 9.185563e-001, 9.189135e-001, 9.192707e-001, 9.196279e-001, 9.199851e-001, 9.203381e-001, 9.206891e-001, 9.210400e-001,
+9.213909e-001, 9.217418e-001, 9.220928e-001, 9.224384e-001, 9.227827e-001, 9.231270e-001, 9.234713e-001, 9.238156e-001, 9.241599e-001, 9.244983e-001,
+9.248360e-001, 9.251736e-001, 9.255113e-001, 9.258490e-001, 9.261867e-001, 9.265180e-001, 9.268490e-001, 9.271799e-001, 9.275109e-001, 9.278418e-001,
+9.281728e-001, 9.284993e-001, 9.288255e-001, 9.291517e-001, 9.294779e-001, 9.298041e-001, 9.301303e-001, 9.304519e-001, 9.307729e-001, 9.310939e-001,
+9.314149e-001, 9.317359e-001, 9.320568e-001, 9.323734e-001, 9.326886e-001, 9.330039e-001, 9.333191e-001, 9.336344e-001, 9.339496e-001, 9.342616e-001,
+9.345716e-001, 9.348815e-001, 9.351915e-001, 9.355015e-001, 9.358114e-001, 9.361190e-001, 9.364230e-001, 9.367270e-001, 9.370310e-001, 9.373351e-001,
+9.376391e-001, 9.379425e-001, 9.382423e-001, 9.385421e-001, 9.388419e-001, 9.391417e-001, 9.394415e-001, 9.397413e-001, 9.400387e-001, 9.403356e-001,
+9.406325e-001, 9.409294e-001, 9.412263e-001, 9.415232e-001, 9.418178e-001, 9.421097e-001, 9.424016e-001, 9.426936e-001, 9.429855e-001, 9.432775e-001,
+9.435690e-001, 9.438548e-001, 9.441405e-001, 9.444262e-001, 9.447119e-001, 9.449977e-001, 9.452834e-001, 9.455663e-001, 9.458473e-001, 9.461283e-001,
+9.464092e-001, 9.466902e-001, 9.469712e-001, 9.472520e-001, 9.475297e-001, 9.478075e-001, 9.480852e-001, 9.483630e-001, 9.486407e-001, 9.489185e-001,
+9.491941e-001, 9.494674e-001, 9.497408e-001, 9.500141e-001, 9.502874e-001, 9.505608e-001, 9.508341e-001, 9.511034e-001, 9.513721e-001, 9.516407e-001,
+9.519094e-001, 9.521780e-001, 9.524467e-001, 9.527146e-001, 9.529792e-001, 9.532438e-001, 9.535084e-001, 9.537730e-001, 9.540376e-001, 9.543022e-001,
+9.545649e-001, 9.548250e-001, 9.550850e-001, 9.553451e-001, 9.556052e-001, 9.558652e-001, 9.561253e-001, 9.563831e-001, 9.566396e-001, 9.568961e-001,
+9.571526e-001, 9.574091e-001, 9.576656e-001, 9.579221e-001, 9.581765e-001, 9.584304e-001, 9.586842e-001, 9.589381e-001, 9.591919e-001, 9.594458e-001,
+9.596996e-001, 9.599508e-001, 9.602015e-001, 9.604522e-001, 9.607029e-001, 9.609536e-001, 9.612043e-001, 9.614550e-001, 9.617014e-001, 9.619473e-001,
+9.621931e-001, 9.624389e-001, 9.626847e-001, 9.629306e-001, 9.631764e-001, 9.634191e-001, 9.636612e-001, 9.639033e-001, 9.641454e-001, 9.643875e-001,
+9.646296e-001, 9.648717e-001, 9.651131e-001, 9.653542e-001, 9.655953e-001, 9.658364e-001, 9.660774e-001, 9.663185e-001, 9.665596e-001, 9.667995e-001,
+9.670387e-001, 9.672778e-001, 9.675169e-001, 9.677561e-001, 9.679952e-001, 9.682343e-001, 9.684709e-001, 9.687037e-001, 9.689365e-001, 9.691692e-001,
+9.694020e-001, 9.696348e-001, 9.698676e-001, 9.700998e-001, 9.703280e-001, 9.705563e-001, 9.707846e-001, 9.710128e-001, 9.712411e-001, 9.714694e-001,
+9.716976e-001, 9.719249e-001, 9.721521e-001, 9.723792e-001, 9.726063e-001, 9.728334e-001, 9.730605e-001, 9.732876e-001, 9.735138e-001, 9.737386e-001,
+9.739634e-001, 9.741883e-001, 9.744131e-001, 9.746379e-001, 9.748628e-001, 9.750876e-001, 9.753092e-001, 9.755307e-001, 9.757523e-001, 9.759738e-001,
+9.761953e-001, 9.764169e-001, 9.766384e-001, 9.768583e-001, 9.770764e-001, 9.772945e-001, 9.775127e-001, 9.777308e-001, 9.779489e-001, 9.781670e-001,
+9.783851e-001, 9.786008e-001, 9.788163e-001, 9.790318e-001, 9.792473e-001, 9.794627e-001, 9.796782e-001, 9.798937e-001, 9.801085e-001, 9.803212e-001,
+9.805339e-001, 9.807467e-001, 9.809594e-001, 9.811722e-001, 9.813849e-001, 9.815976e-001, 9.818084e-001, 9.820176e-001, 9.822268e-001, 9.824360e-001,
+9.826453e-001, 9.828545e-001, 9.830637e-001, 9.832729e-001, 9.834790e-001, 9.836843e-001, 9.838896e-001, 9.840950e-001, 9.843003e-001, 9.845056e-001,
+9.847109e-001, 9.849162e-001, 9.851184e-001, 9.853205e-001, 9.855225e-001, 9.857246e-001, 9.859266e-001, 9.861287e-001, 9.863307e-001, 9.865326e-001,
+9.867315e-001, 9.869304e-001, 9.871294e-001, 9.873283e-001, 9.875272e-001, 9.877261e-001, 9.879251e-001, 9.881236e-001, 9.883189e-001, 9.885141e-001,
+9.887094e-001, 9.889047e-001, 9.890999e-001, 9.892952e-001, 9.894905e-001, 9.896855e-001, 9.898774e-001, 9.900693e-001, 9.902613e-001, 9.904532e-001,
+9.906451e-001, 9.908370e-001, 9.910290e-001, 9.912209e-001, 9.914098e-001, 9.915987e-001, 9.917875e-001, 9.919764e-001, 9.921653e-001, 9.923541e-001,
+9.925430e-001, 9.927319e-001, 9.929165e-001, 9.931002e-001, 9.932839e-001, 9.934676e-001, 9.936513e-001, 9.938350e-001, 9.940187e-001, 9.942024e-001,
+9.943823e-001, 9.945598e-001, 9.947373e-001, 9.949148e-001, 9.950923e-001, 9.952698e-001, 9.954473e-001, 9.956248e-001, 9.958004e-001, 9.959719e-001,
+9.961433e-001, 9.963148e-001, 9.964862e-001, 9.966577e-001, 9.968291e-001, 9.970006e-001, 9.971720e-001, 9.973402e-001, 9.975082e-001, 9.976762e-001,
+9.978441e-001, 9.980121e-001, 9.981801e-001, 9.983481e-001, 9.985160e-001, 9.986824e-001, 9.988471e-001, 9.990118e-001, 9.991765e-001, 9.993412e-001,
+9.995059e-001, 9.996706e-001, 9.998353e-001, 1.000000e+000)),
+("Agfa", "Agfachrome CT Precisa 200", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.699328e-004, 5.516693e-004, 8.440902e-004, 1.147099e-003, 1.459733e-003, 1.781373e-003, 2.112688e-003, 2.453103e-003, 2.803165e-003,
+3.163841e-003, 3.537265e-003, 3.925732e-003, 4.331218e-003, 4.756354e-003, 5.201705e-003, 5.666778e-003, 6.150672e-003, 6.651178e-003, 7.167408e-003,
+7.697697e-003, 8.241186e-003, 8.797321e-003, 9.366002e-003, 9.947358e-003, 1.054169e-002, 1.114802e-002, 1.176681e-002, 1.239773e-002, 1.304048e-002,
+1.369512e-002, 1.436170e-002, 1.504012e-002, 1.573006e-002, 1.643184e-002, 1.714491e-002, 1.786894e-002, 1.860509e-002, 1.935276e-002, 2.011265e-002,
+2.088393e-002, 2.166708e-002, 2.246153e-002, 2.326771e-002, 2.408522e-002, 2.491370e-002, 2.575281e-002, 2.660247e-002, 2.746285e-002, 2.833442e-002,
+2.921660e-002, 3.010918e-002, 3.101206e-002, 3.192448e-002, 3.284754e-002, 3.378084e-002, 3.472469e-002, 3.567887e-002, 3.664265e-002, 3.761646e-002,
+3.860014e-002, 3.959451e-002, 4.059884e-002, 4.161268e-002, 4.263584e-002, 4.366939e-002, 4.471179e-002, 4.576487e-002, 4.682599e-002, 4.789703e-002,
+4.897640e-002, 5.006553e-002, 5.116284e-002, 5.226999e-002, 5.338507e-002, 5.450962e-002, 5.564243e-002, 5.678371e-002, 5.793371e-002, 5.909069e-002,
+6.025741e-002, 6.143340e-002, 6.261709e-002, 6.381065e-002, 6.501184e-002, 6.622134e-002, 6.743796e-002, 6.866319e-002, 6.989764e-002, 7.114040e-002,
+7.239147e-002, 7.365185e-002, 7.492015e-002, 7.619693e-002, 7.748131e-002, 7.877312e-002, 8.007404e-002, 8.138310e-002, 8.270069e-002, 8.402707e-002,
+8.536073e-002, 8.670234e-002, 8.805310e-002, 8.941210e-002, 9.077921e-002, 9.215511e-002, 9.353856e-002, 9.492993e-002, 9.632968e-002, 9.773640e-002,
+9.915071e-002, 1.005733e-001, 1.020033e-001, 1.034408e-001, 1.048861e-001, 1.063387e-001, 1.077983e-001, 1.092655e-001, 1.107405e-001, 1.122227e-001,
+1.137126e-001, 1.152107e-001, 1.167162e-001, 1.182283e-001, 1.197487e-001, 1.212769e-001, 1.228116e-001, 1.243539e-001, 1.259036e-001, 1.274602e-001,
+1.290240e-001, 1.305951e-001, 1.321730e-001, 1.337588e-001, 1.353519e-001, 1.369515e-001, 1.385576e-001, 1.401696e-001, 1.417877e-001, 1.434136e-001,
+1.450463e-001, 1.466851e-001, 1.483296e-001, 1.499803e-001, 1.516396e-001, 1.533044e-001, 1.549747e-001, 1.566507e-001, 1.583354e-001, 1.600270e-001,
+1.617242e-001, 1.634270e-001, 1.651382e-001, 1.668565e-001, 1.685802e-001, 1.703091e-001, 1.720459e-001, 1.737887e-001, 1.755366e-001, 1.772905e-001,
+1.790521e-001, 1.808188e-001, 1.825905e-001, 1.843690e-001, 1.861528e-001, 1.879408e-001, 1.897340e-001, 1.915319e-001, 1.933335e-001, 1.951407e-001,
+1.969527e-001, 1.987676e-001, 2.005868e-001, 2.024097e-001, 2.042354e-001, 2.060656e-001, 2.078991e-001, 2.097346e-001, 2.115736e-001, 2.134156e-001,
+2.152598e-001, 2.171060e-001, 2.189533e-001, 2.208018e-001, 2.226526e-001, 2.245037e-001, 2.263543e-001, 2.282047e-001, 2.300550e-001, 2.319053e-001,
+2.337548e-001, 2.356023e-001, 2.374480e-001, 2.392929e-001, 2.411360e-001, 2.429781e-001, 2.448176e-001, 2.466559e-001, 2.484932e-001, 2.503274e-001,
+2.521604e-001, 2.539891e-001, 2.558168e-001, 2.576423e-001, 2.594660e-001, 2.612883e-001, 2.631082e-001, 2.649275e-001, 2.667451e-001, 2.685622e-001,
+2.703767e-001, 2.721900e-001, 2.740012e-001, 2.758115e-001, 2.776210e-001, 2.794296e-001, 2.812377e-001, 2.830450e-001, 2.848520e-001, 2.866581e-001,
+2.884641e-001, 2.902691e-001, 2.920740e-001, 2.938778e-001, 2.956817e-001, 2.974856e-001, 2.992898e-001, 3.010957e-001, 3.029016e-001, 3.047079e-001,
+3.065149e-001, 3.083241e-001, 3.101342e-001, 3.119469e-001, 3.137602e-001, 3.155752e-001, 3.173910e-001, 3.192102e-001, 3.210298e-001, 3.228525e-001,
+3.246755e-001, 3.265027e-001, 3.283299e-001, 3.301619e-001, 3.319939e-001, 3.338311e-001, 3.356689e-001, 3.375114e-001, 3.393552e-001, 3.412028e-001,
+3.430524e-001, 3.449052e-001, 3.467617e-001, 3.486201e-001, 3.504831e-001, 3.523468e-001, 3.542162e-001, 3.560856e-001, 3.579611e-001, 3.598373e-001,
+3.617184e-001, 3.636019e-001, 3.654885e-001, 3.673791e-001, 3.692706e-001, 3.711664e-001, 3.730623e-001, 3.749630e-001, 3.768645e-001, 3.787691e-001,
+3.806760e-001, 3.825838e-001, 3.844942e-001, 3.864046e-001, 3.883186e-001, 3.902329e-001, 3.921491e-001, 3.940671e-001, 3.959853e-001, 3.979055e-001,
+3.998257e-001, 4.017481e-001, 4.036712e-001, 4.055954e-001, 4.075217e-001, 4.094480e-001, 4.113750e-001, 4.133020e-001, 4.152296e-001, 4.171579e-001,
+4.190863e-001, 4.210153e-001, 4.229443e-001, 4.248732e-001, 4.268017e-001, 4.287302e-001, 4.306586e-001, 4.325870e-001, 4.345157e-001, 4.364448e-001,
+4.383739e-001, 4.403016e-001, 4.422291e-001, 4.441559e-001, 4.460807e-001, 4.480055e-001, 4.499279e-001, 4.518489e-001, 4.537699e-001, 4.556884e-001,
+4.576068e-001, 4.595240e-001, 4.614389e-001, 4.633539e-001, 4.652644e-001, 4.671730e-001, 4.690816e-001, 4.709845e-001, 4.728875e-001, 4.747887e-001,
+4.766855e-001, 4.785823e-001, 4.804755e-001, 4.823657e-001, 4.842558e-001, 4.861414e-001, 4.880257e-001, 4.899099e-001, 4.917872e-001, 4.936643e-001,
+4.955403e-001, 4.974110e-001, 4.992816e-001, 5.011493e-001, 5.030111e-001, 5.048729e-001, 5.067304e-001, 5.085832e-001, 5.104360e-001, 5.122830e-001,
+5.141262e-001, 5.159694e-001, 5.178056e-001, 5.196388e-001, 5.214719e-001, 5.232948e-001, 5.251146e-001, 5.269344e-001, 5.287426e-001, 5.305481e-001,
+5.323537e-001, 5.341475e-001, 5.359391e-001, 5.377307e-001, 5.395105e-001, 5.412879e-001, 5.430654e-001, 5.448314e-001, 5.465947e-001, 5.483581e-001,
+5.501095e-001, 5.518571e-001, 5.536047e-001, 5.553417e-001, 5.570737e-001, 5.588057e-001, 5.605282e-001, 5.622439e-001, 5.639595e-001, 5.656673e-001,
+5.673655e-001, 5.690636e-001, 5.707573e-001, 5.724400e-001, 5.741227e-001, 5.758036e-001, 5.774692e-001, 5.791348e-001, 5.808005e-001, 5.824471e-001,
+5.840917e-001, 5.857363e-001, 5.873677e-001, 5.889925e-001, 5.906173e-001, 5.922336e-001, 5.938375e-001, 5.954413e-001, 5.970428e-001, 5.986260e-001,
+6.002093e-001, 6.017925e-001, 6.033606e-001, 6.049250e-001, 6.064894e-001, 6.080434e-001, 6.095850e-001, 6.111266e-001, 6.126661e-001, 6.141832e-001,
+6.157003e-001, 6.172174e-001, 6.187193e-001, 6.202140e-001, 6.217088e-001, 6.231974e-001, 6.246680e-001, 6.261385e-001, 6.276091e-001, 6.290595e-001,
+6.305048e-001, 6.319501e-001, 6.333882e-001, 6.348105e-001, 6.362328e-001, 6.376552e-001, 6.390563e-001, 6.404522e-001, 6.418481e-001, 6.432371e-001,
+6.446062e-001, 6.459753e-001, 6.473444e-001, 6.486950e-001, 6.500369e-001, 6.513789e-001, 6.527189e-001, 6.540355e-001, 6.553521e-001, 6.566688e-001,
+6.579745e-001, 6.592666e-001, 6.605587e-001, 6.618508e-001, 6.631216e-001, 6.643864e-001, 6.656513e-001, 6.669138e-001, 6.681522e-001, 6.693907e-001,
+6.706291e-001, 6.718585e-001, 6.730720e-001, 6.742856e-001, 6.754991e-001, 6.766976e-001, 6.778864e-001, 6.790752e-001, 6.802640e-001, 6.814342e-001,
+6.826003e-001, 6.837665e-001, 6.849325e-001, 6.860751e-001, 6.872177e-001, 6.883602e-001, 6.894992e-001, 6.906188e-001, 6.917384e-001, 6.928581e-001,
+6.939715e-001, 6.950684e-001, 6.961654e-001, 6.972624e-001, 6.983523e-001, 6.994296e-001, 7.005070e-001, 7.015844e-001, 7.026545e-001, 7.037144e-001,
+7.047743e-001, 7.058342e-001, 7.068859e-001, 7.079268e-001, 7.089678e-001, 7.100088e-001, 7.110424e-001, 7.120658e-001, 7.130892e-001, 7.141126e-001,
+7.151290e-001, 7.161336e-001, 7.171382e-001, 7.181428e-001, 7.191424e-001, 7.201298e-001, 7.211172e-001, 7.221046e-001, 7.230894e-001, 7.240619e-001,
+7.250345e-001, 7.260071e-001, 7.269791e-001, 7.279345e-001, 7.288899e-001, 7.298454e-001, 7.308008e-001, 7.317431e-001, 7.326831e-001, 7.336231e-001,
+7.345631e-001, 7.354929e-001, 7.364168e-001, 7.373406e-001, 7.382645e-001, 7.391830e-001, 7.400927e-001, 7.410024e-001, 7.419122e-001, 7.428205e-001,
+7.437157e-001, 7.446109e-001, 7.455060e-001, 7.464012e-001, 7.472869e-001, 7.481698e-001, 7.490527e-001, 7.499356e-001, 7.508132e-001, 7.516832e-001,
+7.525532e-001, 7.534232e-001, 7.542931e-001, 7.551512e-001, 7.560093e-001, 7.568673e-001, 7.577254e-001, 7.585778e-001, 7.594260e-001, 7.602742e-001,
+7.611225e-001, 7.619697e-001, 7.628093e-001, 7.636489e-001, 7.644885e-001, 7.653280e-001, 7.661626e-001, 7.669939e-001, 7.678251e-001, 7.686564e-001,
+7.694870e-001, 7.703075e-001, 7.711279e-001, 7.719484e-001, 7.727688e-001, 7.735849e-001, 7.743962e-001, 7.752075e-001, 7.760188e-001, 7.768301e-001,
+7.776348e-001, 7.784384e-001, 7.792421e-001, 7.800457e-001, 7.808480e-001, 7.816453e-001, 7.824425e-001, 7.832398e-001, 7.840370e-001, 7.848306e-001,
+7.856207e-001, 7.864107e-001, 7.872008e-001, 7.879908e-001, 7.887749e-001, 7.895571e-001, 7.903393e-001, 7.911216e-001, 7.919038e-001, 7.926782e-001,
+7.934526e-001, 7.942269e-001, 7.950013e-001, 7.957745e-001, 7.965422e-001, 7.973100e-001, 7.980777e-001, 7.988454e-001, 7.996108e-001, 8.003711e-001,
+8.011315e-001, 8.018918e-001, 8.026521e-001, 8.034094e-001, 8.041627e-001, 8.049159e-001, 8.056692e-001, 8.064224e-001, 8.071725e-001, 8.079192e-001,
+8.086659e-001, 8.094126e-001, 8.101593e-001, 8.109019e-001, 8.116407e-001, 8.123794e-001, 8.131181e-001, 8.138569e-001, 8.145922e-001, 8.153241e-001,
+8.160559e-001, 8.167878e-001, 8.175196e-001, 8.182483e-001, 8.189728e-001, 8.196973e-001, 8.204219e-001, 8.211464e-001, 8.218686e-001, 8.225861e-001,
+8.233035e-001, 8.240209e-001, 8.247384e-001, 8.254544e-001, 8.261637e-001, 8.268730e-001, 8.275823e-001, 8.282917e-001, 8.290010e-001, 8.297007e-001,
+8.304003e-001, 8.310999e-001, 8.317995e-001, 8.324991e-001, 8.331922e-001, 8.338833e-001, 8.345744e-001, 8.352655e-001, 8.359566e-001, 8.366435e-001,
+8.373259e-001, 8.380083e-001, 8.386908e-001, 8.393732e-001, 8.400543e-001, 8.407285e-001, 8.414027e-001, 8.420768e-001, 8.427510e-001, 8.434252e-001,
+8.440937e-001, 8.447609e-001, 8.454280e-001, 8.460951e-001, 8.467622e-001, 8.474255e-001, 8.480827e-001, 8.487400e-001, 8.493973e-001, 8.500545e-001,
+8.507118e-001, 8.513604e-001, 8.520085e-001, 8.526566e-001, 8.533047e-001, 8.539528e-001, 8.545969e-001, 8.552359e-001, 8.558749e-001, 8.565139e-001,
+8.571530e-001, 8.577920e-001, 8.584234e-001, 8.590539e-001, 8.596845e-001, 8.603151e-001, 8.609456e-001, 8.615740e-001, 8.621975e-001, 8.628210e-001,
+8.634445e-001, 8.640679e-001, 8.646914e-001, 8.653084e-001, 8.659223e-001, 8.665362e-001, 8.671500e-001, 8.677639e-001, 8.683777e-001, 8.689825e-001,
+8.695871e-001, 8.701918e-001, 8.707964e-001, 8.714011e-001, 8.720032e-001, 8.725979e-001, 8.731927e-001, 8.737874e-001, 8.743821e-001, 8.749769e-001,
+8.755673e-001, 8.761531e-001, 8.767388e-001, 8.773246e-001, 8.779104e-001, 8.784961e-001, 8.790776e-001, 8.796569e-001, 8.802361e-001, 8.808153e-001,
+8.813946e-001, 8.819738e-001, 8.825465e-001, 8.831173e-001, 8.836882e-001, 8.842590e-001, 8.848298e-001, 8.854007e-001, 8.859638e-001, 8.865256e-001,
+8.870874e-001, 8.876492e-001, 8.882110e-001, 8.887729e-001, 8.893270e-001, 8.898801e-001, 8.904332e-001, 8.909863e-001, 8.915394e-001, 8.920925e-001,
+8.926386e-001, 8.931834e-001, 8.937283e-001, 8.942731e-001, 8.948179e-001, 8.953628e-001, 8.958991e-001, 8.964329e-001, 8.969668e-001, 8.975007e-001,
+8.980345e-001, 8.985684e-001, 8.990968e-001, 8.996223e-001, 9.001478e-001, 9.006733e-001, 9.011988e-001, 9.017243e-001, 9.022450e-001, 9.027605e-001,
+9.032761e-001, 9.037916e-001, 9.043071e-001, 9.048226e-001, 9.053356e-001, 9.058414e-001, 9.063471e-001, 9.068529e-001, 9.073586e-001, 9.078644e-001,
+9.083701e-001, 9.088682e-001, 9.093661e-001, 9.098640e-001, 9.103619e-001, 9.108597e-001, 9.113576e-001, 9.118501e-001, 9.123396e-001, 9.128291e-001,
+9.133186e-001, 9.138082e-001, 9.142977e-001, 9.147847e-001, 9.152647e-001, 9.157448e-001, 9.162248e-001, 9.167049e-001, 9.171849e-001, 9.176650e-001,
+9.181361e-001, 9.186053e-001, 9.190745e-001, 9.195437e-001, 9.200129e-001, 9.204821e-001, 9.209484e-001, 9.214089e-001, 9.218694e-001, 9.223300e-001,
+9.227905e-001, 9.232510e-001, 9.237115e-001, 9.241649e-001, 9.246164e-001, 9.250679e-001, 9.255194e-001, 9.259709e-001, 9.264224e-001, 9.268720e-001,
+9.273137e-001, 9.277553e-001, 9.281969e-001, 9.286386e-001, 9.290802e-001, 9.295219e-001, 9.299585e-001, 9.303909e-001, 9.308233e-001, 9.312557e-001,
+9.316881e-001, 9.321205e-001, 9.325529e-001, 9.329784e-001, 9.334025e-001, 9.338267e-001, 9.342508e-001, 9.346749e-001, 9.350991e-001, 9.355226e-001,
+9.359377e-001, 9.363528e-001, 9.367680e-001, 9.371831e-001, 9.375982e-001, 9.380134e-001, 9.384261e-001, 9.388316e-001, 9.392371e-001, 9.396426e-001,
+9.400481e-001, 9.404536e-001, 9.408591e-001, 9.412613e-001, 9.416580e-001, 9.420546e-001, 9.424513e-001, 9.428480e-001, 9.432447e-001, 9.436413e-001,
+9.440347e-001, 9.444237e-001, 9.448127e-001, 9.452018e-001, 9.455908e-001, 9.459798e-001, 9.463688e-001, 9.467542e-001, 9.471351e-001, 9.475159e-001,
+9.478968e-001, 9.482776e-001, 9.486585e-001, 9.490393e-001, 9.494168e-001, 9.497890e-001, 9.501613e-001, 9.505335e-001, 9.509057e-001, 9.512779e-001,
+9.516502e-001, 9.520197e-001, 9.523826e-001, 9.527455e-001, 9.531084e-001, 9.534713e-001, 9.538342e-001, 9.541971e-001, 9.545591e-001, 9.549141e-001,
+9.552692e-001, 9.556242e-001, 9.559793e-001, 9.563344e-001, 9.566894e-001, 9.570445e-001, 9.573910e-001, 9.577364e-001, 9.580819e-001, 9.584273e-001,
+9.587728e-001, 9.591182e-001, 9.594637e-001, 9.598046e-001, 9.601426e-001, 9.604807e-001, 9.608187e-001, 9.611567e-001, 9.614947e-001, 9.618327e-001,
+9.621691e-001, 9.625009e-001, 9.628327e-001, 9.631645e-001, 9.634963e-001, 9.638280e-001, 9.641598e-001, 9.644916e-001, 9.648177e-001, 9.651428e-001,
+9.654679e-001, 9.657930e-001, 9.661181e-001, 9.664432e-001, 9.667683e-001, 9.670909e-001, 9.674094e-001, 9.677279e-001, 9.680464e-001, 9.683649e-001,
+9.686834e-001, 9.690019e-001, 9.693204e-001, 9.696332e-001, 9.699449e-001, 9.702566e-001, 9.705683e-001, 9.708800e-001, 9.711917e-001, 9.715034e-001,
+9.718134e-001, 9.721180e-001, 9.724227e-001, 9.727274e-001, 9.730321e-001, 9.733367e-001, 9.736414e-001, 9.739461e-001, 9.742461e-001, 9.745428e-001,
+9.748394e-001, 9.751361e-001, 9.754328e-001, 9.757294e-001, 9.760261e-001, 9.763227e-001, 9.766126e-001, 9.769014e-001, 9.771902e-001, 9.774789e-001,
+9.777677e-001, 9.780564e-001, 9.783452e-001, 9.786334e-001, 9.789145e-001, 9.791956e-001, 9.794767e-001, 9.797578e-001, 9.800389e-001, 9.803200e-001,
+9.806011e-001, 9.808805e-001, 9.811538e-001, 9.814271e-001, 9.817004e-001, 9.819737e-001, 9.822470e-001, 9.825203e-001, 9.827936e-001, 9.830645e-001,
+9.833295e-001, 9.835946e-001, 9.838597e-001, 9.841247e-001, 9.843898e-001, 9.846549e-001, 9.849199e-001, 9.851824e-001, 9.854390e-001, 9.856956e-001,
+9.859522e-001, 9.862088e-001, 9.864654e-001, 9.867220e-001, 9.869786e-001, 9.872330e-001, 9.874813e-001, 9.877295e-001, 9.879777e-001, 9.882259e-001,
+9.884741e-001, 9.887223e-001, 9.889706e-001, 9.892175e-001, 9.894571e-001, 9.896967e-001, 9.899363e-001, 9.901759e-001, 9.904154e-001, 9.906550e-001,
+9.908946e-001, 9.911342e-001, 9.913661e-001, 9.915976e-001, 9.918292e-001, 9.920608e-001, 9.922923e-001, 9.925239e-001, 9.927555e-001, 9.929870e-001,
+9.932110e-001, 9.934319e-001, 9.936528e-001, 9.938737e-001, 9.940946e-001, 9.943154e-001, 9.945363e-001, 9.947572e-001, 9.949743e-001, 9.951855e-001,
+9.953967e-001, 9.956079e-001, 9.958191e-001, 9.960303e-001, 9.962415e-001, 9.964527e-001, 9.966639e-001, 9.968671e-001, 9.970703e-001, 9.972734e-001,
+9.974766e-001, 9.976797e-001, 9.978829e-001, 9.980861e-001, 9.982892e-001, 9.984850e-001, 9.986744e-001, 9.988638e-001, 9.990532e-001, 9.992425e-001,
+9.994319e-001, 9.996213e-001, 9.998106e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.753761e-004, 3.570581e-004, 5.450998e-004, 7.395549e-004, 9.404911e-004, 1.147685e-003, 1.361273e-003, 1.581559e-003, 1.808809e-003,
+2.042770e-003, 2.283692e-003, 2.531681e-003, 2.786794e-003, 3.048986e-003, 3.318113e-003, 3.594431e-003, 3.878224e-003, 4.169494e-003, 4.468861e-003,
+4.776076e-003, 5.091020e-003, 5.413646e-003, 5.744051e-003, 6.082402e-003, 6.428622e-003, 6.782468e-003, 7.144084e-003, 7.513301e-003, 7.890196e-003,
+8.274411e-003, 8.666040e-003, 9.065009e-003, 9.471674e-003, 9.885598e-003, 1.030722e-002, 1.073602e-002, 1.117259e-002, 1.161621e-002, 1.206754e-002,
+1.252661e-002, 1.299280e-002, 1.346676e-002, 1.394794e-002, 1.443638e-002, 1.493273e-002, 1.543704e-002, 1.594863e-002, 1.646758e-002, 1.699433e-002,
+1.752882e-002, 1.807007e-002, 1.861870e-002, 1.917507e-002, 1.973902e-002, 2.031021e-002, 2.088854e-002, 2.147456e-002, 2.206748e-002, 2.266824e-002,
+2.327670e-002, 2.389179e-002, 2.451540e-002, 2.514627e-002, 2.578495e-002, 2.643028e-002, 2.708446e-002, 2.774550e-002, 2.841400e-002, 2.908955e-002,
+2.977218e-002, 3.046326e-002, 3.116172e-002, 3.186793e-002, 3.258232e-002, 3.330431e-002, 3.403427e-002, 3.477183e-002, 3.551601e-002, 3.626690e-002,
+3.702581e-002, 3.779274e-002, 3.856736e-002, 3.934976e-002, 4.014038e-002, 4.093976e-002, 4.174711e-002, 4.256189e-002, 4.338348e-002, 4.421187e-002,
+4.504744e-002, 4.589114e-002, 4.674271e-002, 4.760174e-002, 4.846856e-002, 4.934341e-002, 5.022621e-002, 5.111689e-002, 5.201577e-002, 5.292313e-002,
+5.383914e-002, 5.476354e-002, 5.569635e-002, 5.663731e-002, 5.758623e-002, 5.854273e-002, 5.950688e-002, 6.047889e-002, 6.145895e-002, 6.244728e-002,
+6.344408e-002, 6.444957e-002, 6.546386e-002, 6.648671e-002, 6.751785e-002, 6.855711e-002, 6.960413e-002, 7.065899e-002, 7.172246e-002, 7.279450e-002,
+7.387480e-002, 7.496345e-002, 7.606055e-002, 7.716617e-002, 7.828040e-002, 7.940333e-002, 8.053750e-002, 8.168169e-002, 8.283607e-002, 8.400037e-002,
+8.517412e-002, 8.635685e-002, 8.755124e-002, 8.875466e-002, 8.996704e-002, 9.118830e-002, 9.241837e-002, 9.366052e-002, 9.491149e-002, 9.617119e-002,
+9.743952e-002, 9.871847e-002, 1.000078e-001, 1.013055e-001, 1.026117e-001, 1.039282e-001, 1.052553e-001, 1.065906e-001, 1.079339e-001, 1.092885e-001,
+1.106527e-001, 1.120247e-001, 1.134048e-001, 1.147963e-001, 1.161948e-001, 1.176001e-001, 1.190158e-001, 1.204396e-001, 1.218703e-001, 1.233104e-001,
+1.247609e-001, 1.262182e-001, 1.276842e-001, 1.291611e-001, 1.306444e-001, 1.321359e-001, 1.336382e-001, 1.351462e-001, 1.366621e-001, 1.381860e-001,
+1.397146e-001, 1.412507e-001, 1.427936e-001, 1.443407e-001, 1.458964e-001, 1.474573e-001, 1.490226e-001, 1.505971e-001, 1.521753e-001, 1.537598e-001,
+1.553504e-001, 1.569440e-001, 1.585452e-001, 1.601499e-001, 1.617595e-001, 1.633763e-001, 1.649962e-001, 1.666252e-001, 1.682582e-001, 1.698972e-001,
+1.715423e-001, 1.731901e-001, 1.748462e-001, 1.765046e-001, 1.781698e-001, 1.798389e-001, 1.815121e-001, 1.831911e-001, 1.848724e-001, 1.865603e-001,
+1.882494e-001, 1.899436e-001, 1.916399e-001, 1.933401e-001, 1.950432e-001, 1.967489e-001, 1.984583e-001, 2.001696e-001, 2.018845e-001, 2.036002e-001,
+2.053194e-001, 2.070390e-001, 2.087622e-001, 2.104858e-001, 2.122110e-001, 2.139367e-001, 2.156637e-001, 2.173917e-001, 2.191213e-001, 2.208512e-001,
+2.225817e-001, 2.243125e-001, 2.260437e-001, 2.277747e-001, 2.295052e-001, 2.312354e-001, 2.329653e-001, 2.346949e-001, 2.364242e-001, 2.381531e-001,
+2.398814e-001, 2.416098e-001, 2.433384e-001, 2.450670e-001, 2.467954e-001, 2.485237e-001, 2.502520e-001, 2.519802e-001, 2.537079e-001, 2.554357e-001,
+2.571633e-001, 2.588909e-001, 2.606169e-001, 2.623427e-001, 2.640665e-001, 2.657896e-001, 2.675100e-001, 2.692282e-001, 2.709451e-001, 2.726596e-001,
+2.743734e-001, 2.760833e-001, 2.777931e-001, 2.795000e-001, 2.812066e-001, 2.829106e-001, 2.846132e-001, 2.863144e-001, 2.880135e-001, 2.897121e-001,
+2.914076e-001, 2.931032e-001, 2.947954e-001, 2.964871e-001, 2.981764e-001, 2.998636e-001, 3.015499e-001, 3.032327e-001, 3.049155e-001, 3.065958e-001,
+3.082755e-001, 3.099536e-001, 3.116297e-001, 3.133056e-001, 3.149786e-001, 3.166515e-001, 3.183215e-001, 3.199898e-001, 3.216570e-001, 3.233199e-001,
+3.249828e-001, 3.266434e-001, 3.283032e-001, 3.299619e-001, 3.316178e-001, 3.332736e-001, 3.349259e-001, 3.365770e-001, 3.382271e-001, 3.398743e-001,
+3.415214e-001, 3.431651e-001, 3.448076e-001, 3.464493e-001, 3.480867e-001, 3.497240e-001, 3.513589e-001, 3.529918e-001, 3.546248e-001, 3.562547e-001,
+3.578846e-001, 3.595128e-001, 3.611381e-001, 3.627633e-001, 3.643858e-001, 3.660072e-001, 3.676284e-001, 3.692459e-001, 3.708635e-001, 3.724792e-001,
+3.740915e-001, 3.757037e-001, 3.773144e-001, 3.789240e-001, 3.805336e-001, 3.821412e-001, 3.837484e-001, 3.853550e-001, 3.869574e-001, 3.885597e-001,
+3.901604e-001, 3.917577e-001, 3.933550e-001, 3.949500e-001, 3.965431e-001, 3.981361e-001, 3.997270e-001, 4.013171e-001, 4.029072e-001, 4.044939e-001,
+4.060801e-001, 4.076662e-001, 4.092474e-001, 4.108286e-001, 4.124092e-001, 4.139845e-001, 4.155598e-001, 4.171343e-001, 4.187047e-001, 4.202751e-001,
+4.218446e-001, 4.234112e-001, 4.249777e-001, 4.265432e-001, 4.281054e-001, 4.296675e-001, 4.312283e-001, 4.327852e-001, 4.343420e-001, 4.358971e-001,
+4.374468e-001, 4.389964e-001, 4.405453e-001, 4.420902e-001, 4.436351e-001, 4.451795e-001, 4.467185e-001, 4.482575e-001, 4.497965e-001, 4.513302e-001,
+4.528640e-001, 4.543978e-001, 4.559255e-001, 4.574524e-001, 4.589793e-001, 4.605018e-001, 4.620227e-001, 4.635436e-001, 4.650601e-001, 4.665732e-001,
+4.680863e-001, 4.695966e-001, 4.711020e-001, 4.726073e-001, 4.741116e-001, 4.756089e-001, 4.771062e-001, 4.786034e-001, 4.800953e-001, 4.815863e-001,
+4.830773e-001, 4.845639e-001, 4.860475e-001, 4.875311e-001, 4.890126e-001, 4.904885e-001, 4.919645e-001, 4.934404e-001, 4.949091e-001, 4.963773e-001,
+4.978454e-001, 4.993087e-001, 5.007682e-001, 5.022277e-001, 5.036859e-001, 5.051381e-001, 5.065904e-001, 5.080426e-001, 5.094881e-001, 5.109315e-001,
+5.123748e-001, 5.138152e-001, 5.152489e-001, 5.166826e-001, 5.181163e-001, 5.195433e-001, 5.209691e-001, 5.223948e-001, 5.238175e-001, 5.252338e-001,
+5.266501e-001, 5.280664e-001, 5.294750e-001, 5.308814e-001, 5.322877e-001, 5.336924e-001, 5.350908e-001, 5.364892e-001, 5.378876e-001, 5.392803e-001,
+5.406694e-001, 5.420586e-001, 5.434477e-001, 5.448270e-001, 5.462062e-001, 5.475855e-001, 5.489618e-001, 5.503323e-001, 5.517029e-001, 5.530735e-001,
+5.544377e-001, 5.557986e-001, 5.571594e-001, 5.585203e-001, 5.598712e-001, 5.612215e-001, 5.625717e-001, 5.639198e-001, 5.652583e-001, 5.665968e-001,
+5.679353e-001, 5.692687e-001, 5.705946e-001, 5.719206e-001, 5.732465e-001, 5.745657e-001, 5.758803e-001, 5.771949e-001, 5.785095e-001, 5.798168e-001,
+5.811215e-001, 5.824263e-001, 5.837310e-001, 5.850258e-001, 5.863191e-001, 5.876124e-001, 5.889057e-001, 5.901871e-001, 5.914681e-001, 5.927491e-001,
+5.940297e-001, 5.952989e-001, 5.965680e-001, 5.978371e-001, 5.991058e-001, 6.003660e-001, 6.016263e-001, 6.028865e-001, 6.041462e-001, 6.053941e-001,
+6.066419e-001, 6.078897e-001, 6.091375e-001, 6.103719e-001, 6.116062e-001, 6.128406e-001, 6.140750e-001, 6.152967e-001, 6.165175e-001, 6.177383e-001,
+6.189591e-001, 6.201690e-001, 6.213768e-001, 6.225845e-001, 6.237922e-001, 6.249904e-001, 6.261843e-001, 6.273781e-001, 6.285720e-001, 6.297591e-001,
+6.309399e-001, 6.321207e-001, 6.333014e-001, 6.344783e-001, 6.356463e-001, 6.368142e-001, 6.379822e-001, 6.391494e-001, 6.403048e-001, 6.414603e-001,
+6.426157e-001, 6.437711e-001, 6.449149e-001, 6.460554e-001, 6.471958e-001, 6.483363e-001, 6.494706e-001, 6.505979e-001, 6.517251e-001, 6.528524e-001,
+6.539783e-001, 6.550931e-001, 6.562079e-001, 6.573228e-001, 6.584376e-001, 6.595440e-001, 6.606471e-001, 6.617503e-001, 6.628534e-001, 6.639523e-001,
+6.650412e-001, 6.661300e-001, 6.672189e-001, 6.683077e-001, 6.693846e-001, 6.704591e-001, 6.715336e-001, 6.726081e-001, 6.736781e-001, 6.747391e-001,
+6.758001e-001, 6.768611e-001, 6.779222e-001, 6.789721e-001, 6.800192e-001, 6.810663e-001, 6.821134e-001, 6.831572e-001, 6.841894e-001, 6.852217e-001,
+6.862540e-001, 6.872862e-001, 6.883111e-001, 6.893314e-001, 6.903517e-001, 6.913720e-001, 6.923923e-001, 6.934010e-001, 6.944094e-001, 6.954177e-001,
+6.964260e-001, 6.974308e-001, 6.984261e-001, 6.994215e-001, 7.004168e-001, 7.014121e-001, 7.024009e-001, 7.033843e-001, 7.043676e-001, 7.053509e-001,
+7.063343e-001, 7.073085e-001, 7.082800e-001, 7.092516e-001, 7.102232e-001, 7.111947e-001, 7.121540e-001, 7.131130e-001, 7.140720e-001, 7.150310e-001,
+7.159885e-001, 7.169361e-001, 7.178837e-001, 7.188313e-001, 7.197789e-001, 7.207238e-001, 7.216604e-001, 7.225970e-001, 7.235336e-001, 7.244702e-001,
+7.254032e-001, 7.263282e-001, 7.272532e-001, 7.281782e-001, 7.291032e-001, 7.300242e-001, 7.309377e-001, 7.318512e-001, 7.327647e-001, 7.336782e-001,
+7.345883e-001, 7.354918e-001, 7.363953e-001, 7.372987e-001, 7.382022e-001, 7.391029e-001, 7.399964e-001, 7.408899e-001, 7.417834e-001, 7.426769e-001,
+7.435686e-001, 7.444525e-001, 7.453363e-001, 7.462201e-001, 7.471039e-001, 7.479873e-001, 7.488632e-001, 7.497390e-001, 7.506148e-001, 7.514907e-001,
+7.523665e-001, 7.532342e-001, 7.541007e-001, 7.549671e-001, 7.558336e-001, 7.567001e-001, 7.575605e-001, 7.584175e-001, 7.592746e-001, 7.601317e-001,
+7.609888e-001, 7.618423e-001, 7.626898e-001, 7.635374e-001, 7.643850e-001, 7.652326e-001, 7.660794e-001, 7.669160e-001, 7.677527e-001, 7.685894e-001,
+7.694260e-001, 7.702627e-001, 7.710929e-001, 7.719206e-001, 7.727482e-001, 7.735759e-001, 7.744036e-001, 7.752281e-001, 7.760460e-001, 7.768639e-001,
+7.776817e-001, 7.784996e-001, 7.793175e-001, 7.801279e-001, 7.809371e-001, 7.817464e-001, 7.825556e-001, 7.833649e-001, 7.841701e-001, 7.849688e-001,
+7.857674e-001, 7.865661e-001, 7.873647e-001, 7.881634e-001, 7.889545e-001, 7.897443e-001, 7.905340e-001, 7.913238e-001, 7.921136e-001, 7.929016e-001,
+7.936851e-001, 7.944686e-001, 7.952521e-001, 7.960356e-001, 7.968191e-001, 7.975977e-001, 7.983735e-001, 7.991494e-001, 7.999252e-001, 8.007011e-001,
+8.014769e-001, 8.022441e-001, 8.030110e-001, 8.037780e-001, 8.045449e-001, 8.053118e-001, 8.060764e-001, 8.068339e-001, 8.075915e-001, 8.083490e-001,
+8.091065e-001, 8.098640e-001, 8.106180e-001, 8.113680e-001, 8.121181e-001, 8.128681e-001, 8.136182e-001, 8.143682e-001, 8.151125e-001, 8.158539e-001,
+8.165953e-001, 8.173367e-001, 8.180781e-001, 8.188195e-001, 8.195532e-001, 8.202848e-001, 8.210165e-001, 8.217482e-001, 8.224798e-001, 8.232115e-001,
+8.239343e-001, 8.246560e-001, 8.253776e-001, 8.260993e-001, 8.268209e-001, 8.275426e-001, 8.282570e-001, 8.289707e-001, 8.296845e-001, 8.303982e-001,
+8.311120e-001, 8.318257e-001, 8.325314e-001, 8.332363e-001, 8.339412e-001, 8.346461e-001, 8.353510e-001, 8.360558e-001, 8.367524e-001, 8.374476e-001,
+8.381427e-001, 8.388378e-001, 8.395329e-001, 8.402280e-001, 8.409171e-001, 8.416041e-001, 8.422911e-001, 8.429781e-001, 8.436651e-001, 8.443520e-001,
+8.450349e-001, 8.457147e-001, 8.463944e-001, 8.470742e-001, 8.477539e-001, 8.484337e-001, 8.491110e-001, 8.497840e-001, 8.504569e-001, 8.511299e-001,
+8.518028e-001, 8.524758e-001, 8.531480e-001, 8.538121e-001, 8.544761e-001, 8.551402e-001, 8.558042e-001, 8.564683e-001, 8.571323e-001, 8.577906e-001,
+8.584471e-001, 8.591036e-001, 8.597600e-001, 8.604165e-001, 8.610730e-001, 8.617268e-001, 8.623764e-001, 8.630260e-001, 8.636757e-001, 8.643253e-001,
+8.649749e-001, 8.656246e-001, 8.662685e-001, 8.669123e-001, 8.675561e-001, 8.681999e-001, 8.688437e-001, 8.694875e-001, 8.701276e-001, 8.707640e-001,
+8.714004e-001, 8.720368e-001, 8.726732e-001, 8.733096e-001, 8.739460e-001, 8.745773e-001, 8.752084e-001, 8.758394e-001, 8.764705e-001, 8.771016e-001,
+8.777327e-001, 8.783612e-001, 8.789854e-001, 8.796096e-001, 8.802338e-001, 8.808580e-001, 8.814823e-001, 8.821065e-001, 8.827262e-001, 8.833443e-001,
+8.839624e-001, 8.845806e-001, 8.851987e-001, 8.858168e-001, 8.864347e-001, 8.870466e-001, 8.876585e-001, 8.882704e-001, 8.888824e-001, 8.894943e-001,
+8.901062e-001, 8.907166e-001, 8.913231e-001, 8.919296e-001, 8.925361e-001, 8.931425e-001, 8.937490e-001, 8.943555e-001, 8.949588e-001, 8.955585e-001,
+8.961581e-001, 8.967578e-001, 8.973575e-001, 8.979572e-001, 8.985569e-001, 8.991538e-001, 8.997489e-001, 9.003439e-001, 9.009390e-001, 9.015341e-001,
+9.021292e-001, 9.027243e-001, 9.033153e-001, 9.039044e-001, 9.044935e-001, 9.050826e-001, 9.056717e-001, 9.062608e-001, 9.068499e-001, 9.074342e-001,
+9.080166e-001, 9.085990e-001, 9.091813e-001, 9.097637e-001, 9.103460e-001, 9.109284e-001, 9.115050e-001, 9.120786e-001, 9.126523e-001, 9.132260e-001,
+9.137996e-001, 9.143733e-001, 9.149470e-001, 9.155157e-001, 9.160808e-001, 9.166459e-001, 9.172110e-001, 9.177760e-001, 9.183411e-001, 9.189062e-001,
+9.194673e-001, 9.200228e-001, 9.205783e-001, 9.211338e-001, 9.216893e-001, 9.222448e-001, 9.228003e-001, 9.233545e-001, 9.239031e-001, 9.244517e-001,
+9.250003e-001, 9.255489e-001, 9.260975e-001, 9.266461e-001, 9.271947e-001, 9.277391e-001, 9.282830e-001, 9.288270e-001, 9.293710e-001, 9.299150e-001,
+9.304590e-001, 9.310030e-001, 9.315435e-001, 9.320816e-001, 9.326196e-001, 9.331577e-001, 9.336957e-001, 9.342338e-001, 9.347718e-001, 9.353089e-001,
+9.358416e-001, 9.363743e-001, 9.369070e-001, 9.374397e-001, 9.379724e-001, 9.385051e-001, 9.390377e-001, 9.395660e-001, 9.400927e-001, 9.406193e-001,
+9.411459e-001, 9.416726e-001, 9.421992e-001, 9.427259e-001, 9.432512e-001, 9.437718e-001, 9.442923e-001, 9.448128e-001, 9.453333e-001, 9.458538e-001,
+9.463744e-001, 9.468949e-001, 9.474116e-001, 9.479261e-001, 9.484406e-001, 9.489551e-001, 9.494696e-001, 9.499840e-001, 9.504985e-001, 9.510130e-001,
+9.515205e-001, 9.520278e-001, 9.525352e-001, 9.530425e-001, 9.535499e-001, 9.540572e-001, 9.545645e-001, 9.550700e-001, 9.555702e-001, 9.560704e-001,
+9.565707e-001, 9.570709e-001, 9.575711e-001, 9.580713e-001, 9.585716e-001, 9.590680e-001, 9.595607e-001, 9.600534e-001, 9.605460e-001, 9.610387e-001,
+9.615313e-001, 9.620240e-001, 9.625167e-001, 9.630044e-001, 9.634896e-001, 9.639747e-001, 9.644599e-001, 9.649451e-001, 9.654303e-001, 9.659154e-001,
+9.664006e-001, 9.668791e-001, 9.673555e-001, 9.678319e-001, 9.683082e-001, 9.687846e-001, 9.692609e-001, 9.697373e-001, 9.702136e-001, 9.706823e-001,
+9.711489e-001, 9.716155e-001, 9.720821e-001, 9.725487e-001, 9.730152e-001, 9.734818e-001, 9.739484e-001, 9.744059e-001, 9.748603e-001, 9.753147e-001,
+9.757690e-001, 9.762234e-001, 9.766778e-001, 9.771322e-001, 9.775866e-001, 9.780326e-001, 9.784741e-001, 9.789155e-001, 9.793569e-001, 9.797983e-001,
+9.802397e-001, 9.806811e-001, 9.811225e-001, 9.815560e-001, 9.819805e-001, 9.824051e-001, 9.828296e-001, 9.832542e-001, 9.836787e-001, 9.841033e-001,
+9.845278e-001, 9.849483e-001, 9.853557e-001, 9.857630e-001, 9.861703e-001, 9.865777e-001, 9.869850e-001, 9.873923e-001, 9.877997e-001, 9.882070e-001,
+9.885931e-001, 9.889775e-001, 9.893618e-001, 9.897462e-001, 9.901306e-001, 9.905150e-001, 9.908994e-001, 9.912838e-001, 9.916560e-001, 9.920184e-001,
+9.923808e-001, 9.927431e-001, 9.931055e-001, 9.934678e-001, 9.938302e-001, 9.941925e-001, 9.945518e-001, 9.948848e-001, 9.952177e-001, 9.955507e-001,
+9.958836e-001, 9.962166e-001, 9.965495e-001, 9.968825e-001, 9.972154e-001, 9.975339e-001, 9.978421e-001, 9.981504e-001, 9.984587e-001, 9.987669e-001,
+9.990752e-001, 9.993835e-001, 9.996917e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.523783e-004, 5.202319e-004, 8.039851e-004, 1.102614e-003, 1.415695e-003, 1.742119e-003, 2.080501e-003, 2.429423e-003, 2.788412e-003,
+3.157912e-003, 3.539382e-003, 3.934626e-003, 4.346550e-003, 4.776661e-003, 5.226209e-003, 5.695651e-003, 6.184300e-003, 6.692027e-003, 7.218185e-003,
+7.762222e-003, 8.324269e-003, 8.905886e-003, 9.506574e-003, 1.012796e-002, 1.076960e-002, 1.143143e-002, 1.211410e-002, 1.281589e-002, 1.353757e-002,
+1.427855e-002, 1.503736e-002, 1.581403e-002, 1.660733e-002, 1.741608e-002, 1.824159e-002, 1.908218e-002, 1.993797e-002, 2.080863e-002, 2.169458e-002,
+2.259582e-002, 2.351185e-002, 2.444358e-002, 2.539022e-002, 2.635079e-002, 2.732685e-002, 2.831824e-002, 2.932401e-002, 3.034318e-002, 3.137618e-002,
+3.242205e-002, 3.347942e-002, 3.454638e-002, 3.562257e-002, 3.670732e-002, 3.779872e-002, 3.889452e-002, 3.999412e-002, 4.109794e-002, 4.220522e-002,
+4.331417e-002, 4.442528e-002, 4.553898e-002, 4.665584e-002, 4.777516e-002, 4.889594e-002, 5.001855e-002, 5.114387e-002, 5.227332e-002, 5.340736e-002,
+5.454529e-002, 5.568710e-002, 5.683464e-002, 5.798840e-002, 5.914848e-002, 6.031411e-002, 6.148490e-002, 6.266294e-002, 6.384787e-002, 6.503851e-002,
+6.623594e-002, 6.743909e-002, 6.864854e-002, 6.986419e-002, 7.108620e-002, 7.231347e-002, 7.354694e-002, 7.478598e-002, 7.603074e-002, 7.728040e-002,
+7.853489e-002, 7.979487e-002, 8.106017e-002, 8.233240e-002, 8.360963e-002, 8.489243e-002, 8.618017e-002, 8.747297e-002, 8.877026e-002, 9.007179e-002,
+9.137781e-002, 9.268763e-002, 9.400166e-002, 9.531952e-002, 9.664074e-002, 9.796496e-002, 9.929236e-002, 1.006235e-001, 1.019583e-001, 1.032962e-001,
+1.046370e-001, 1.059795e-001, 1.073247e-001, 1.086726e-001, 1.100225e-001, 1.113744e-001, 1.127282e-001, 1.140839e-001, 1.154411e-001, 1.168002e-001,
+1.181621e-001, 1.195268e-001, 1.208942e-001, 1.222644e-001, 1.236374e-001, 1.250137e-001, 1.263938e-001, 1.277773e-001, 1.291648e-001, 1.305565e-001,
+1.319530e-001, 1.333541e-001, 1.347597e-001, 1.361703e-001, 1.375873e-001, 1.390097e-001, 1.404386e-001, 1.418738e-001, 1.433148e-001, 1.447638e-001,
+1.462194e-001, 1.476816e-001, 1.491505e-001, 1.506260e-001, 1.521109e-001, 1.536029e-001, 1.551018e-001, 1.566076e-001, 1.581221e-001, 1.596441e-001,
+1.611728e-001, 1.627079e-001, 1.642510e-001, 1.658020e-001, 1.673591e-001, 1.689218e-001, 1.704942e-001, 1.720734e-001, 1.736586e-001, 1.752517e-001,
+1.768528e-001, 1.784589e-001, 1.800702e-001, 1.816917e-001, 1.833178e-001, 1.849483e-001, 1.865873e-001, 1.882307e-001, 1.898781e-001, 1.915331e-001,
+1.931923e-001, 1.948551e-001, 1.965251e-001, 1.981987e-001, 1.998754e-001, 2.015592e-001, 2.032459e-001, 2.049357e-001, 2.066316e-001, 2.083299e-001,
+2.100317e-001, 2.117380e-001, 2.134468e-001, 2.151607e-001, 2.168777e-001, 2.185974e-001, 2.203237e-001, 2.220526e-001, 2.237870e-001, 2.255263e-001,
+2.272689e-001, 2.290179e-001, 2.307692e-001, 2.325261e-001, 2.342864e-001, 2.360495e-001, 2.378189e-001, 2.395902e-001, 2.413679e-001, 2.431481e-001,
+2.449326e-001, 2.467212e-001, 2.485123e-001, 2.503088e-001, 2.521066e-001, 2.539105e-001, 2.557164e-001, 2.575276e-001, 2.593416e-001, 2.611588e-001,
+2.629804e-001, 2.648044e-001, 2.666332e-001, 2.684633e-001, 2.703008e-001, 2.721393e-001, 2.739846e-001, 2.758312e-001, 2.776846e-001, 2.795401e-001,
+2.814018e-001, 2.832662e-001, 2.851360e-001, 2.870089e-001, 2.888865e-001, 2.907677e-001, 2.926534e-001, 2.945432e-001, 2.964378e-001, 2.983361e-001,
+3.002382e-001, 3.021445e-001, 3.040551e-001, 3.059693e-001, 3.078877e-001, 3.098102e-001, 3.117382e-001, 3.136690e-001, 3.156045e-001, 3.175427e-001,
+3.194876e-001, 3.214339e-001, 3.233857e-001, 3.253385e-001, 3.272994e-001, 3.292602e-001, 3.312292e-001, 3.331983e-001, 3.351752e-001, 3.371535e-001,
+3.391371e-001, 3.411232e-001, 3.431136e-001, 3.451084e-001, 3.471060e-001, 3.491097e-001, 3.511143e-001, 3.531267e-001, 3.551391e-001, 3.571587e-001,
+3.591795e-001, 3.612056e-001, 3.632350e-001, 3.652678e-001, 3.673069e-001, 3.693464e-001, 3.713943e-001, 3.734421e-001, 3.754970e-001, 3.775541e-001,
+3.796147e-001, 3.816798e-001, 3.837456e-001, 3.858198e-001, 3.878939e-001, 3.899737e-001, 3.920556e-001, 3.941405e-001, 3.962311e-001, 3.983218e-001,
+4.004194e-001, 4.025175e-001, 4.046191e-001, 4.067240e-001, 4.088292e-001, 4.109374e-001, 4.130456e-001, 4.151562e-001, 4.172684e-001, 4.193809e-001,
+4.214955e-001, 4.236101e-001, 4.257257e-001, 4.278419e-001, 4.299579e-001, 4.320721e-001, 4.341863e-001, 4.362999e-001, 4.384129e-001, 4.405260e-001,
+4.426352e-001, 4.447444e-001, 4.468516e-001, 4.489555e-001, 4.510595e-001, 4.531569e-001, 4.552523e-001, 4.573469e-001, 4.594366e-001, 4.615262e-001,
+4.636127e-001, 4.656956e-001, 4.677784e-001, 4.698548e-001, 4.719296e-001, 4.740035e-001, 4.760693e-001, 4.781351e-001, 4.801965e-001, 4.822504e-001,
+4.843044e-001, 4.863505e-001, 4.883921e-001, 4.904336e-001, 4.924622e-001, 4.944887e-001, 4.965141e-001, 4.985253e-001, 5.005366e-001, 5.025439e-001,
+5.045402e-001, 5.065365e-001, 5.085269e-001, 5.105090e-001, 5.124911e-001, 5.144640e-001, 5.164295e-001, 5.183951e-001, 5.203496e-001, 5.222988e-001,
+5.242480e-001, 5.261831e-001, 5.281138e-001, 5.300445e-001, 5.319602e-001, 5.338729e-001, 5.357855e-001, 5.376809e-001, 5.395737e-001, 5.414665e-001,
+5.433426e-001, 5.452168e-001, 5.470909e-001, 5.489477e-001, 5.508023e-001, 5.526569e-001, 5.544949e-001, 5.563301e-001, 5.581652e-001, 5.599844e-001,
+5.617994e-001, 5.636145e-001, 5.654161e-001, 5.672123e-001, 5.690084e-001, 5.707933e-001, 5.725707e-001, 5.743482e-001, 5.761160e-001, 5.778731e-001,
+5.796302e-001, 5.813814e-001, 5.831197e-001, 5.848580e-001, 5.865939e-001, 5.883124e-001, 5.900310e-001, 5.917496e-001, 5.934520e-001, 5.951528e-001,
+5.968536e-001, 5.985417e-001, 6.002235e-001, 6.019053e-001, 6.035785e-001, 6.052388e-001, 6.068991e-001, 6.085570e-001, 6.101953e-001, 6.118335e-001,
+6.134717e-001, 6.150943e-001, 6.167126e-001, 6.183309e-001, 6.199414e-001, 6.215418e-001, 6.231423e-001, 6.247417e-001, 6.263245e-001, 6.279073e-001,
+6.294901e-001, 6.310621e-001, 6.326284e-001, 6.341948e-001, 6.357573e-001, 6.373064e-001, 6.388555e-001, 6.404047e-001, 6.419380e-001, 6.434664e-001,
+6.449948e-001, 6.465179e-001, 6.480270e-001, 6.495360e-001, 6.510450e-001, 6.525406e-001, 6.540317e-001, 6.555228e-001, 6.570095e-001, 6.584786e-001,
+6.599478e-001, 6.614169e-001, 6.628722e-001, 6.643190e-001, 6.657658e-001, 6.672123e-001, 6.686396e-001, 6.700670e-001, 6.714943e-001, 6.729141e-001,
+6.743213e-001, 6.757285e-001, 6.771356e-001, 6.785268e-001, 6.799111e-001, 6.812955e-001, 6.826798e-001, 6.840426e-001, 6.854055e-001, 6.867683e-001,
+6.881262e-001, 6.894711e-001, 6.908161e-001, 6.921610e-001, 6.934956e-001, 6.948205e-001, 6.961454e-001, 6.974702e-001, 6.987801e-001, 7.000842e-001,
+7.013883e-001, 7.026924e-001, 7.039761e-001, 7.052576e-001, 7.065390e-001, 7.078195e-001, 7.090789e-001, 7.103384e-001, 7.115979e-001, 7.128541e-001,
+7.140920e-001, 7.153299e-001, 7.165678e-001, 7.178003e-001, 7.190150e-001, 7.202297e-001, 7.214444e-001, 7.226527e-001, 7.238447e-001, 7.250367e-001,
+7.262287e-001, 7.274145e-001, 7.285852e-001, 7.297559e-001, 7.309267e-001, 7.320916e-001, 7.332413e-001, 7.343910e-001, 7.355408e-001, 7.366862e-001,
+7.378168e-001, 7.389474e-001, 7.400779e-001, 7.412057e-001, 7.423155e-001, 7.434253e-001, 7.445352e-001, 7.456447e-001, 7.467350e-001, 7.478252e-001,
+7.489155e-001, 7.500058e-001, 7.510781e-001, 7.521475e-001, 7.532169e-001, 7.542862e-001, 7.553425e-001, 7.563925e-001, 7.574424e-001, 7.584924e-001,
+7.595331e-001, 7.605625e-001, 7.615919e-001, 7.626213e-001, 7.636471e-001, 7.646576e-001, 7.656682e-001, 7.666787e-001, 7.676893e-001, 7.686822e-001,
+7.696730e-001, 7.706639e-001, 7.716547e-001, 7.726355e-001, 7.736086e-001, 7.745817e-001, 7.755547e-001, 7.765241e-001, 7.774783e-001, 7.784325e-001,
+7.793867e-001, 7.803409e-001, 7.812797e-001, 7.822145e-001, 7.831493e-001, 7.840841e-001, 7.850121e-001, 7.859280e-001, 7.868439e-001, 7.877598e-001,
+7.886756e-001, 7.895762e-001, 7.904746e-001, 7.913730e-001, 7.922714e-001, 7.931638e-001, 7.940455e-001, 7.949273e-001, 7.958091e-001, 7.966909e-001,
+7.975585e-001, 7.984230e-001, 7.992875e-001, 8.001520e-001, 8.010129e-001, 8.018617e-001, 8.027105e-001, 8.035593e-001, 8.044081e-001, 8.052454e-001,
+8.060749e-001, 8.069044e-001, 8.077339e-001, 8.085635e-001, 8.093764e-001, 8.101881e-001, 8.109998e-001, 8.118115e-001, 8.126195e-001, 8.134147e-001,
+8.142098e-001, 8.150050e-001, 8.158002e-001, 8.165881e-001, 8.173684e-001, 8.181487e-001, 8.189290e-001, 8.197093e-001, 8.204782e-001, 8.212424e-001,
+8.220066e-001, 8.227707e-001, 8.235349e-001, 8.242857e-001, 8.250346e-001, 8.257835e-001, 8.265325e-001, 8.272812e-001, 8.280162e-001, 8.287512e-001,
+8.294863e-001, 8.302213e-001, 8.309546e-001, 8.316740e-001, 8.323933e-001, 8.331127e-001, 8.338321e-001, 8.345489e-001, 8.352529e-001, 8.359569e-001,
+8.366609e-001, 8.373649e-001, 8.380663e-001, 8.387560e-001, 8.394458e-001, 8.401355e-001, 8.408252e-001, 8.415125e-001, 8.421864e-001, 8.428603e-001,
+8.435342e-001, 8.442082e-001, 8.448809e-001, 8.455417e-001, 8.462025e-001, 8.468633e-001, 8.475240e-001, 8.481848e-001, 8.488331e-001, 8.494811e-001,
+8.501291e-001, 8.507772e-001, 8.514252e-001, 8.520623e-001, 8.526971e-001, 8.533320e-001, 8.539668e-001, 8.546016e-001, 8.552286e-001, 8.558510e-001,
+8.564733e-001, 8.570957e-001, 8.577180e-001, 8.583358e-001, 8.589463e-001, 8.595568e-001, 8.601673e-001, 8.607778e-001, 8.613869e-001, 8.619840e-001,
+8.625810e-001, 8.631781e-001, 8.637752e-001, 8.643722e-001, 8.649600e-001, 8.655450e-001, 8.661300e-001, 8.667150e-001, 8.673000e-001, 8.678801e-001,
+8.684527e-001, 8.690253e-001, 8.695979e-001, 8.701706e-001, 8.707432e-001, 8.713021e-001, 8.718607e-001, 8.724194e-001, 8.729781e-001, 8.735368e-001,
+8.740890e-001, 8.746354e-001, 8.751818e-001, 8.757282e-001, 8.762746e-001, 8.768208e-001, 8.773563e-001, 8.778918e-001, 8.784273e-001, 8.789628e-001,
+8.794983e-001, 8.800282e-001, 8.805518e-001, 8.810754e-001, 8.815989e-001, 8.821225e-001, 8.826461e-001, 8.831596e-001, 8.836715e-001, 8.841834e-001,
+8.846953e-001, 8.852072e-001, 8.857168e-001, 8.862179e-001, 8.867190e-001, 8.872202e-001, 8.877213e-001, 8.882224e-001, 8.887180e-001, 8.892087e-001,
+8.896993e-001, 8.901900e-001, 8.906806e-001, 8.911713e-001, 8.916537e-001, 8.921338e-001, 8.926139e-001, 8.930941e-001, 8.935742e-001, 8.940543e-001,
+8.945251e-001, 8.949958e-001, 8.954666e-001, 8.959373e-001, 8.964080e-001, 8.968774e-001, 8.973398e-001, 8.978023e-001, 8.982647e-001, 8.987272e-001,
+8.991896e-001, 8.996491e-001, 9.001011e-001, 9.005531e-001, 9.010051e-001, 9.014571e-001, 9.019092e-001, 9.023581e-001, 9.028013e-001, 9.032444e-001,
+9.036876e-001, 9.041308e-001, 9.045739e-001, 9.050140e-001, 9.054487e-001, 9.058834e-001, 9.063181e-001, 9.067528e-001, 9.071875e-001, 9.076196e-001,
+9.080467e-001, 9.084737e-001, 9.089007e-001, 9.093278e-001, 9.097548e-001, 9.101795e-001, 9.105970e-001, 9.110144e-001, 9.114319e-001, 9.118494e-001,
+9.122668e-001, 9.126836e-001, 9.130951e-001, 9.135065e-001, 9.139180e-001, 9.143294e-001, 9.147409e-001, 9.151523e-001, 9.155570e-001, 9.159611e-001,
+9.163653e-001, 9.167694e-001, 9.171736e-001, 9.175777e-001, 9.179765e-001, 9.183728e-001, 9.187692e-001, 9.191656e-001, 9.195619e-001, 9.199583e-001,
+9.203512e-001, 9.207389e-001, 9.211267e-001, 9.215145e-001, 9.219023e-001, 9.222900e-001, 9.226774e-001, 9.230594e-001, 9.234413e-001, 9.238232e-001,
+9.242052e-001, 9.245871e-001, 9.249691e-001, 9.253469e-001, 9.257227e-001, 9.260985e-001, 9.264743e-001, 9.268501e-001, 9.272258e-001, 9.275999e-001,
+9.279679e-001, 9.283359e-001, 9.287039e-001, 9.290718e-001, 9.294398e-001, 9.298078e-001, 9.301706e-001, 9.305314e-001, 9.308922e-001, 9.312530e-001,
+9.316139e-001, 9.319747e-001, 9.323344e-001, 9.326892e-001, 9.330439e-001, 9.333986e-001, 9.337534e-001, 9.341081e-001, 9.344628e-001, 9.348146e-001,
+9.351639e-001, 9.355133e-001, 9.358627e-001, 9.362121e-001, 9.365615e-001, 9.369109e-001, 9.372549e-001, 9.375984e-001, 9.379419e-001, 9.382853e-001,
+9.386288e-001, 9.389723e-001, 9.393148e-001, 9.396532e-001, 9.399915e-001, 9.403298e-001, 9.406682e-001, 9.410065e-001, 9.413448e-001, 9.416811e-001,
+9.420145e-001, 9.423479e-001, 9.426813e-001, 9.430147e-001, 9.433481e-001, 9.436815e-001, 9.440121e-001, 9.443405e-001, 9.446689e-001, 9.449973e-001,
+9.453258e-001, 9.456542e-001, 9.459826e-001, 9.463075e-001, 9.466308e-001, 9.469541e-001, 9.472774e-001, 9.476007e-001, 9.479240e-001, 9.482473e-001,
+9.485683e-001, 9.488885e-001, 9.492087e-001, 9.495289e-001, 9.498491e-001, 9.501693e-001, 9.504894e-001, 9.508067e-001, 9.511229e-001, 9.514391e-001,
+9.517553e-001, 9.520715e-001, 9.523877e-001, 9.527039e-001, 9.530173e-001, 9.533293e-001, 9.536414e-001, 9.539534e-001, 9.542655e-001, 9.545776e-001,
+9.548896e-001, 9.551992e-001, 9.555068e-001, 9.558145e-001, 9.561221e-001, 9.564297e-001, 9.567373e-001, 9.570449e-001, 9.573509e-001, 9.576540e-001,
+9.579571e-001, 9.582602e-001, 9.585633e-001, 9.588664e-001, 9.591695e-001, 9.594716e-001, 9.597676e-001, 9.600636e-001, 9.603596e-001, 9.606556e-001,
+9.609517e-001, 9.612477e-001, 9.615437e-001, 9.618366e-001, 9.621290e-001, 9.624214e-001, 9.627138e-001, 9.630061e-001, 9.632985e-001, 9.635909e-001,
+9.638821e-001, 9.641720e-001, 9.644619e-001, 9.647518e-001, 9.650417e-001, 9.653316e-001, 9.656216e-001, 9.659113e-001, 9.661974e-001, 9.664835e-001,
+9.667696e-001, 9.670557e-001, 9.673418e-001, 9.676279e-001, 9.679140e-001, 9.681978e-001, 9.684798e-001, 9.687617e-001, 9.690437e-001, 9.693257e-001,
+9.696077e-001, 9.698897e-001, 9.701716e-001, 9.704507e-001, 9.707298e-001, 9.710089e-001, 9.712880e-001, 9.715671e-001, 9.718461e-001, 9.721252e-001,
+9.724027e-001, 9.726777e-001, 9.729528e-001, 9.732279e-001, 9.735030e-001, 9.737780e-001, 9.740531e-001, 9.743282e-001, 9.745999e-001, 9.748704e-001,
+9.751409e-001, 9.754115e-001, 9.756820e-001, 9.759525e-001, 9.762231e-001, 9.764936e-001, 9.767600e-001, 9.770264e-001, 9.772929e-001, 9.775593e-001,
+9.778257e-001, 9.780921e-001, 9.783586e-001, 9.786242e-001, 9.788866e-001, 9.791490e-001, 9.794114e-001, 9.796738e-001, 9.799362e-001, 9.801986e-001,
+9.804610e-001, 9.807219e-001, 9.809800e-001, 9.812381e-001, 9.814963e-001, 9.817544e-001, 9.820125e-001, 9.822706e-001, 9.825287e-001, 9.827851e-001,
+9.830391e-001, 9.832930e-001, 9.835470e-001, 9.838010e-001, 9.840549e-001, 9.843089e-001, 9.845628e-001, 9.848149e-001, 9.850642e-001, 9.853135e-001,
+9.855628e-001, 9.858121e-001, 9.860615e-001, 9.863108e-001, 9.865601e-001, 9.868078e-001, 9.870524e-001, 9.872971e-001, 9.875417e-001, 9.877864e-001,
+9.880310e-001, 9.882757e-001, 9.885203e-001, 9.887641e-001, 9.890047e-001, 9.892452e-001, 9.894858e-001, 9.897264e-001, 9.899670e-001, 9.902076e-001,
+9.904482e-001, 9.906886e-001, 9.909231e-001, 9.911576e-001, 9.913921e-001, 9.916266e-001, 9.918611e-001, 9.920956e-001, 9.923301e-001, 9.925646e-001,
+9.927944e-001, 9.930228e-001, 9.932511e-001, 9.934795e-001, 9.937079e-001, 9.939362e-001, 9.941646e-001, 9.943929e-001, 9.946192e-001, 9.948425e-001,
+9.950658e-001, 9.952891e-001, 9.955124e-001, 9.957357e-001, 9.959590e-001, 9.961823e-001, 9.964055e-001, 9.966221e-001, 9.968386e-001, 9.970552e-001,
+9.972717e-001, 9.974883e-001, 9.977048e-001, 9.979214e-001, 9.981380e-001, 9.983490e-001, 9.985553e-001, 9.987617e-001, 9.989681e-001, 9.991745e-001,
+9.993809e-001, 9.995872e-001, 9.997936e-001, 1.000000e+000)),
+("Agfa", "Agfachrome RSX2 050", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.079330e-003, 2.318791e-003, 3.693138e-003, 5.245641e-003, 7.008193e-003, 9.055170e-003, 1.140117e-002, 1.396784e-002, 1.668695e-002,
+1.959897e-002, 2.280067e-002, 2.637562e-002, 3.035841e-002, 3.471595e-002, 3.939883e-002, 4.433773e-002, 4.945630e-002, 5.466952e-002, 5.991178e-002,
+6.514468e-002, 7.034250e-002, 7.549357e-002, 8.060274e-002, 8.567163e-002, 9.070138e-002, 9.568655e-002, 1.006257e-001, 1.055175e-001, 1.103760e-001,
+1.152204e-001, 1.200543e-001, 1.248872e-001, 1.297339e-001, 1.346121e-001, 1.395314e-001, 1.444950e-001, 1.495019e-001, 1.545559e-001, 1.596434e-001,
+1.647536e-001, 1.698786e-001, 1.750122e-001, 1.801481e-001, 1.852790e-001, 1.903970e-001, 1.954903e-001, 2.005587e-001, 2.055946e-001, 2.105983e-001,
+2.155727e-001, 2.205153e-001, 2.254346e-001, 2.303334e-001, 2.352053e-001, 2.400625e-001, 2.449066e-001, 2.497356e-001, 2.545414e-001, 2.593365e-001,
+2.641317e-001, 2.689233e-001, 2.737050e-001, 2.784807e-001, 2.832559e-001, 2.880278e-001, 2.927958e-001, 2.975590e-001, 3.023168e-001, 3.070589e-001,
+3.117863e-001, 3.165079e-001, 3.212227e-001, 3.259241e-001, 3.306060e-001, 3.352773e-001, 3.399353e-001, 3.445749e-001, 3.491898e-001, 3.537843e-001,
+3.583636e-001, 3.629280e-001, 3.674630e-001, 3.719677e-001, 3.764385e-001, 3.808834e-001, 3.853051e-001, 3.896935e-001, 3.940488e-001, 3.983698e-001,
+4.026510e-001, 4.068989e-001, 4.111186e-001, 4.153114e-001, 4.194692e-001, 4.235900e-001, 4.276777e-001, 4.317341e-001, 4.357564e-001, 4.397394e-001,
+4.436829e-001, 4.475947e-001, 4.514736e-001, 4.553223e-001, 4.591388e-001, 4.629190e-001, 4.666629e-001, 4.703747e-001, 4.740516e-001, 4.776928e-001,
+4.813020e-001, 4.848793e-001, 4.884205e-001, 4.919296e-001, 4.954057e-001, 4.988467e-001, 5.022569e-001, 5.056318e-001, 5.089687e-001, 5.122700e-001,
+5.155355e-001, 5.187672e-001, 5.219681e-001, 5.251352e-001, 5.282660e-001, 5.313646e-001, 5.344318e-001, 5.374667e-001, 5.404701e-001, 5.434369e-001,
+5.463718e-001, 5.492841e-001, 5.521712e-001, 5.550354e-001, 5.578735e-001, 5.606823e-001, 5.634636e-001, 5.662226e-001, 5.689582e-001, 5.716740e-001,
+5.743726e-001, 5.770526e-001, 5.797128e-001, 5.823538e-001, 5.849739e-001, 5.875732e-001, 5.901582e-001, 5.927312e-001, 5.952929e-001, 5.978370e-001,
+6.003630e-001, 6.028746e-001, 6.053730e-001, 6.078592e-001, 6.103302e-001, 6.127893e-001, 6.152379e-001, 6.176774e-001, 6.201044e-001, 6.225174e-001,
+6.249200e-001, 6.273151e-001, 6.296957e-001, 6.320651e-001, 6.344232e-001, 6.367668e-001, 6.390995e-001, 6.414197e-001, 6.437256e-001, 6.460139e-001,
+6.482884e-001, 6.505498e-001, 6.527923e-001, 6.550190e-001, 6.572331e-001, 6.594276e-001, 6.616021e-001, 6.637636e-001, 6.659076e-001, 6.680328e-001,
+6.701456e-001, 6.722385e-001, 6.743145e-001, 6.763778e-001, 6.784113e-001, 6.804268e-001, 6.824293e-001, 6.844048e-001, 6.863657e-001, 6.883091e-001,
+6.902278e-001, 6.921337e-001, 6.940144e-001, 6.958735e-001, 6.977202e-001, 6.995370e-001, 7.013438e-001, 7.031324e-001, 7.048979e-001, 7.066526e-001,
+7.083770e-001, 7.100898e-001, 7.117801e-001, 7.134491e-001, 7.151061e-001, 7.167317e-001, 7.183484e-001, 7.199389e-001, 7.215156e-001, 7.230751e-001,
+7.246131e-001, 7.261415e-001, 7.276426e-001, 7.291371e-001, 7.306034e-001, 7.320588e-001, 7.334914e-001, 7.349092e-001, 7.363126e-001, 7.376976e-001,
+7.390736e-001, 7.404264e-001, 7.417743e-001, 7.430985e-001, 7.444195e-001, 7.457147e-001, 7.470050e-001, 7.482747e-001, 7.495391e-001, 7.507901e-001,
+7.520324e-001, 7.532587e-001, 7.544769e-001, 7.556836e-001, 7.568811e-001, 7.580674e-001, 7.592449e-001, 7.604127e-001, 7.615684e-001, 7.627115e-001,
+7.638475e-001, 7.649760e-001, 7.660958e-001, 7.672053e-001, 7.683075e-001, 7.693994e-001, 7.704841e-001, 7.715560e-001, 7.726234e-001, 7.736794e-001,
+7.747321e-001, 7.757707e-001, 7.768080e-001, 7.778319e-001, 7.788557e-001, 7.798685e-001, 7.808807e-001, 7.818832e-001, 7.828834e-001, 7.838740e-001,
+7.848594e-001, 7.858390e-001, 7.868121e-001, 7.877819e-001, 7.887431e-001, 7.897035e-001, 7.906509e-001, 7.915984e-001, 7.925338e-001, 7.934665e-001,
+7.943944e-001, 7.953185e-001, 7.962389e-001, 7.971504e-001, 7.980619e-001, 7.989598e-001, 7.998578e-001, 8.007482e-001, 8.016351e-001, 8.025193e-001,
+8.033988e-001, 8.042781e-001, 8.051458e-001, 8.060136e-001, 8.068729e-001, 8.077276e-001, 8.085806e-001, 8.094289e-001, 8.102772e-001, 8.111171e-001,
+8.119554e-001, 8.127891e-001, 8.136163e-001, 8.144435e-001, 8.152586e-001, 8.160733e-001, 8.168834e-001, 8.176890e-001, 8.184944e-001, 8.192910e-001,
+8.200876e-001, 8.208791e-001, 8.216655e-001, 8.224520e-001, 8.232242e-001, 8.239961e-001, 8.247646e-001, 8.255286e-001, 8.262927e-001, 8.270504e-001,
+8.278069e-001, 8.285604e-001, 8.293051e-001, 8.300497e-001, 8.307862e-001, 8.315182e-001, 8.322502e-001, 8.329762e-001, 8.337022e-001, 8.344251e-001,
+8.351423e-001, 8.358595e-001, 8.365702e-001, 8.372778e-001, 8.379854e-001, 8.386829e-001, 8.393801e-001, 8.400757e-001, 8.407659e-001, 8.414562e-001,
+8.421434e-001, 8.428275e-001, 8.435116e-001, 8.441905e-001, 8.448676e-001, 8.455446e-001, 8.462109e-001, 8.468765e-001, 8.475412e-001, 8.481993e-001,
+8.488574e-001, 8.495146e-001, 8.501692e-001, 8.508237e-001, 8.514751e-001, 8.521217e-001, 8.527683e-001, 8.534089e-001, 8.540438e-001, 8.546788e-001,
+8.553087e-001, 8.559353e-001, 8.565620e-001, 8.571853e-001, 8.578071e-001, 8.584288e-001, 8.590450e-001, 8.596588e-001, 8.602727e-001, 8.608807e-001,
+8.614865e-001, 8.620923e-001, 8.626919e-001, 8.632892e-001, 8.638865e-001, 8.644778e-001, 8.650663e-001, 8.656549e-001, 8.662387e-001, 8.668196e-001,
+8.674006e-001, 8.679792e-001, 8.685559e-001, 8.691326e-001, 8.697058e-001, 8.702744e-001, 8.708430e-001, 8.714082e-001, 8.719650e-001, 8.725219e-001,
+8.730773e-001, 8.736236e-001, 8.741698e-001, 8.747161e-001, 8.752585e-001, 8.758007e-001, 8.763429e-001, 8.768798e-001, 8.774149e-001, 8.779499e-001,
+8.784800e-001, 8.790048e-001, 8.795297e-001, 8.800523e-001, 8.805671e-001, 8.810819e-001, 8.815967e-001, 8.821054e-001, 8.826136e-001, 8.831218e-001,
+8.836262e-001, 8.841280e-001, 8.846298e-001, 8.851296e-001, 8.856233e-001, 8.861170e-001, 8.866107e-001, 8.870999e-001, 8.875884e-001, 8.880769e-001,
+8.885615e-001, 8.890416e-001, 8.895218e-001, 8.900016e-001, 8.904702e-001, 8.909388e-001, 8.914074e-001, 8.918704e-001, 8.923290e-001, 8.927876e-001,
+8.932460e-001, 8.937011e-001, 8.941562e-001, 8.946113e-001, 8.950630e-001, 8.955120e-001, 8.959610e-001, 8.964100e-001, 8.968499e-001, 8.972897e-001,
+8.977296e-001, 8.981648e-001, 8.985937e-001, 8.990226e-001, 8.994514e-001, 8.998740e-001, 9.002951e-001, 9.007161e-001, 9.011360e-001, 9.015498e-001,
+9.019636e-001, 9.023774e-001, 9.027865e-001, 9.031909e-001, 9.035953e-001, 9.039997e-001, 9.043973e-001, 9.047932e-001, 9.051891e-001, 9.055846e-001,
+9.059757e-001, 9.063668e-001, 9.067578e-001, 9.071466e-001, 9.075302e-001, 9.079139e-001, 9.082975e-001, 9.086759e-001, 9.090495e-001, 9.094231e-001,
+9.097967e-001, 9.101624e-001, 9.105246e-001, 9.108868e-001, 9.112489e-001, 9.116070e-001, 9.119641e-001, 9.123213e-001, 9.126785e-001, 9.130293e-001,
+9.133797e-001, 9.137301e-001, 9.140803e-001, 9.144240e-001, 9.147678e-001, 9.151115e-001, 9.154547e-001, 9.157909e-001, 9.161271e-001, 9.164632e-001,
+9.167991e-001, 9.171310e-001, 9.174629e-001, 9.177948e-001, 9.181263e-001, 9.184518e-001, 9.187773e-001, 9.191028e-001, 9.194281e-001, 9.197450e-001,
+9.200619e-001, 9.203788e-001, 9.206957e-001, 9.210032e-001, 9.213100e-001, 9.216168e-001, 9.219236e-001, 9.222257e-001, 9.225267e-001, 9.228277e-001,
+9.231288e-001, 9.234267e-001, 9.237230e-001, 9.240193e-001, 9.243156e-001, 9.246088e-001, 9.248985e-001, 9.251881e-001, 9.254777e-001, 9.257659e-001,
+9.260492e-001, 9.263326e-001, 9.266159e-001, 9.268993e-001, 9.271755e-001, 9.274516e-001, 9.277276e-001, 9.280037e-001, 9.282758e-001, 9.285461e-001,
+9.288163e-001, 9.290866e-001, 9.293550e-001, 9.296201e-001, 9.298851e-001, 9.301502e-001, 9.304152e-001, 9.306733e-001, 9.309315e-001, 9.311896e-001,
+9.314477e-001, 9.317022e-001, 9.319543e-001, 9.322064e-001, 9.324585e-001, 9.327095e-001, 9.329549e-001, 9.332002e-001, 9.334455e-001, 9.336908e-001,
+9.339326e-001, 9.341727e-001, 9.344127e-001, 9.346528e-001, 9.348925e-001, 9.351304e-001, 9.353683e-001, 9.356062e-001, 9.358440e-001, 9.360798e-001,
+9.363143e-001, 9.365487e-001, 9.367832e-001, 9.370174e-001, 9.372468e-001, 9.374761e-001, 9.377055e-001, 9.379348e-001, 9.381616e-001, 9.383847e-001,
+9.386078e-001, 9.388310e-001, 9.390541e-001, 9.392737e-001, 9.394921e-001, 9.397105e-001, 9.399290e-001, 9.401472e-001, 9.403619e-001, 9.405765e-001,
+9.407911e-001, 9.410057e-001, 9.412195e-001, 9.414315e-001, 9.416434e-001, 9.418553e-001, 9.420672e-001, 9.422772e-001, 9.424854e-001, 9.426936e-001,
+9.429018e-001, 9.431100e-001, 9.433146e-001, 9.435176e-001, 9.437207e-001, 9.439237e-001, 9.441267e-001, 9.443246e-001, 9.445216e-001, 9.447185e-001,
+9.449155e-001, 9.451124e-001, 9.453072e-001, 9.455018e-001, 9.456965e-001, 9.458911e-001, 9.460857e-001, 9.462794e-001, 9.464730e-001, 9.466666e-001,
+9.468602e-001, 9.470538e-001, 9.472450e-001, 9.474363e-001, 9.476275e-001, 9.478188e-001, 9.480101e-001, 9.481977e-001, 9.483853e-001, 9.485729e-001,
+9.487605e-001, 9.489481e-001, 9.491311e-001, 9.493138e-001, 9.494964e-001, 9.496791e-001, 9.498617e-001, 9.500397e-001, 9.502166e-001, 9.503935e-001,
+9.505705e-001, 9.507474e-001, 9.509228e-001, 9.510974e-001, 9.512721e-001, 9.514467e-001, 9.516214e-001, 9.517948e-001, 9.519669e-001, 9.521389e-001,
+9.523110e-001, 9.524831e-001, 9.526548e-001, 9.528252e-001, 9.529957e-001, 9.531662e-001, 9.533366e-001, 9.535071e-001, 9.536750e-001, 9.538427e-001,
+9.540105e-001, 9.541782e-001, 9.543460e-001, 9.545126e-001, 9.546785e-001, 9.548445e-001, 9.550104e-001, 9.551764e-001, 9.553417e-001, 9.555050e-001,
+9.556684e-001, 9.558317e-001, 9.559950e-001, 9.561584e-001, 9.563188e-001, 9.564788e-001, 9.566387e-001, 9.567987e-001, 9.569586e-001, 9.571177e-001,
+9.572753e-001, 9.574329e-001, 9.575906e-001, 9.577482e-001, 9.579058e-001, 9.580608e-001, 9.582155e-001, 9.583702e-001, 9.585249e-001, 9.586796e-001,
+9.588337e-001, 9.589865e-001, 9.591394e-001, 9.592922e-001, 9.594451e-001, 9.595979e-001, 9.597502e-001, 9.599023e-001, 9.600545e-001, 9.602066e-001,
+9.603587e-001, 9.605106e-001, 9.606613e-001, 9.608120e-001, 9.609627e-001, 9.611135e-001, 9.612642e-001, 9.614138e-001, 9.615621e-001, 9.617103e-001,
+9.618586e-001, 9.620069e-001, 9.621551e-001, 9.623023e-001, 9.624491e-001, 9.625958e-001, 9.627425e-001, 9.628893e-001, 9.630360e-001, 9.631811e-001,
+9.633259e-001, 9.634708e-001, 9.636157e-001, 9.637606e-001, 9.639054e-001, 9.640494e-001, 9.641934e-001, 9.643375e-001, 9.644815e-001, 9.646255e-001,
+9.647692e-001, 9.649113e-001, 9.650535e-001, 9.651957e-001, 9.653379e-001, 9.654800e-001, 9.656215e-001, 9.657613e-001, 9.659010e-001, 9.660407e-001,
+9.661805e-001, 9.663202e-001, 9.664595e-001, 9.665977e-001, 9.667360e-001, 9.668742e-001, 9.670125e-001, 9.671507e-001, 9.672883e-001, 9.674242e-001,
+9.675601e-001, 9.676959e-001, 9.678318e-001, 9.679677e-001, 9.681033e-001, 9.682378e-001, 9.683723e-001, 9.685068e-001, 9.686413e-001, 9.687758e-001,
+9.689102e-001, 9.690427e-001, 9.691753e-001, 9.693078e-001, 9.694404e-001, 9.695729e-001, 9.697054e-001, 9.698357e-001, 9.699657e-001, 9.700957e-001,
+9.702258e-001, 9.703558e-001, 9.704858e-001, 9.706160e-001, 9.707464e-001, 9.708768e-001, 9.710071e-001, 9.711375e-001, 9.712679e-001, 9.713981e-001,
+9.715283e-001, 9.716584e-001, 9.717885e-001, 9.719186e-001, 9.720488e-001, 9.721788e-001, 9.723081e-001, 9.724375e-001, 9.725668e-001, 9.726961e-001,
+9.728254e-001, 9.729547e-001, 9.730841e-001, 9.732135e-001, 9.733429e-001, 9.734724e-001, 9.736018e-001, 9.737312e-001, 9.738605e-001, 9.739892e-001,
+9.741179e-001, 9.742466e-001, 9.743753e-001, 9.745040e-001, 9.746327e-001, 9.747602e-001, 9.748873e-001, 9.750145e-001, 9.751416e-001, 9.752687e-001,
+9.753959e-001, 9.755228e-001, 9.756493e-001, 9.757757e-001, 9.759022e-001, 9.760286e-001, 9.761551e-001, 9.762815e-001, 9.764072e-001, 9.765324e-001,
+9.766576e-001, 9.767829e-001, 9.769081e-001, 9.770333e-001, 9.771585e-001, 9.772820e-001, 9.774055e-001, 9.775289e-001, 9.776524e-001, 9.777758e-001,
+9.778992e-001, 9.780225e-001, 9.781451e-001, 9.782678e-001, 9.783904e-001, 9.785130e-001, 9.786357e-001, 9.787583e-001, 9.788810e-001, 9.790038e-001,
+9.791265e-001, 9.792492e-001, 9.793720e-001, 9.794947e-001, 9.796175e-001, 9.797399e-001, 9.798623e-001, 9.799846e-001, 9.801069e-001, 9.802292e-001,
+9.803515e-001, 9.804738e-001, 9.805954e-001, 9.807168e-001, 9.808381e-001, 9.809595e-001, 9.810808e-001, 9.812022e-001, 9.813235e-001, 9.814448e-001,
+9.815660e-001, 9.816873e-001, 9.818086e-001, 9.819298e-001, 9.820511e-001, 9.821723e-001, 9.822928e-001, 9.824132e-001, 9.825335e-001, 9.826539e-001,
+9.827742e-001, 9.828946e-001, 9.830150e-001, 9.831340e-001, 9.832527e-001, 9.833713e-001, 9.834900e-001, 9.836087e-001, 9.837274e-001, 9.838461e-001,
+9.839642e-001, 9.840821e-001, 9.841999e-001, 9.843178e-001, 9.844357e-001, 9.845536e-001, 9.846714e-001, 9.847886e-001, 9.849051e-001, 9.850217e-001,
+9.851382e-001, 9.852548e-001, 9.853713e-001, 9.854879e-001, 9.856039e-001, 9.857186e-001, 9.858333e-001, 9.859480e-001, 9.860628e-001, 9.861775e-001,
+9.862922e-001, 9.864069e-001, 9.865176e-001, 9.866283e-001, 9.867389e-001, 9.868496e-001, 9.869603e-001, 9.870710e-001, 9.871817e-001, 9.872914e-001,
+9.874006e-001, 9.875099e-001, 9.876191e-001, 9.877284e-001, 9.878376e-001, 9.879468e-001, 9.880558e-001, 9.881638e-001, 9.882717e-001, 9.883797e-001,
+9.884877e-001, 9.885957e-001, 9.887037e-001, 9.888117e-001, 9.889186e-001, 9.890252e-001, 9.891318e-001, 9.892384e-001, 9.893450e-001, 9.894515e-001,
+9.895581e-001, 9.896646e-001, 9.897707e-001, 9.898768e-001, 9.899830e-001, 9.900891e-001, 9.901952e-001, 9.903013e-001, 9.904074e-001, 9.905129e-001,
+9.906180e-001, 9.907230e-001, 9.908281e-001, 9.909332e-001, 9.910383e-001, 9.911434e-001, 9.912484e-001, 9.913520e-001, 9.914555e-001, 9.915590e-001,
+9.916625e-001, 9.917660e-001, 9.918695e-001, 9.919730e-001, 9.920759e-001, 9.921774e-001, 9.922789e-001, 9.923804e-001, 9.924819e-001, 9.925834e-001,
+9.926849e-001, 9.927864e-001, 9.928867e-001, 9.929860e-001, 9.930852e-001, 9.931844e-001, 9.932836e-001, 9.933828e-001, 9.934821e-001, 9.935813e-001,
+9.936792e-001, 9.937763e-001, 9.938734e-001, 9.939706e-001, 9.940677e-001, 9.941648e-001, 9.942620e-001, 9.943591e-001, 9.944551e-001, 9.945507e-001,
+9.946463e-001, 9.947419e-001, 9.948375e-001, 9.949331e-001, 9.950286e-001, 9.951242e-001, 9.952185e-001, 9.953124e-001, 9.954062e-001, 9.955000e-001,
+9.955939e-001, 9.956877e-001, 9.957815e-001, 9.958754e-001, 9.959680e-001, 9.960601e-001, 9.961523e-001, 9.962444e-001, 9.963365e-001, 9.964286e-001,
+9.965208e-001, 9.966129e-001, 9.967035e-001, 9.967931e-001, 9.968827e-001, 9.969724e-001, 9.970620e-001, 9.971516e-001, 9.972412e-001, 9.973308e-001,
+9.974189e-001, 9.975049e-001, 9.975909e-001, 9.976769e-001, 9.977629e-001, 9.978489e-001, 9.979349e-001, 9.980209e-001, 9.981061e-001, 9.981874e-001,
+9.982688e-001, 9.983501e-001, 9.984314e-001, 9.985127e-001, 9.985940e-001, 9.986754e-001, 9.987567e-001, 9.988334e-001, 9.989093e-001, 9.989851e-001,
+9.990610e-001, 9.991368e-001, 9.992127e-001, 9.992886e-001, 9.993644e-001, 9.994377e-001, 9.995080e-001, 9.995783e-001, 9.996486e-001, 9.997189e-001,
+9.997892e-001, 9.998594e-001, 9.999297e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.914269e-004, 1.080293e-003, 1.807263e-003, 2.666269e-003, 3.606757e-003, 4.578547e-003, 5.569110e-003, 6.590545e-003, 7.662756e-003,
+8.800440e-003, 1.000805e-002, 1.128805e-002, 1.264013e-002, 1.406363e-002, 1.555406e-002, 1.710716e-002, 1.871856e-002, 2.038714e-002, 2.211287e-002,
+2.389241e-002, 2.572535e-002, 2.761350e-002, 2.955110e-002, 3.153406e-002, 3.356227e-002, 3.562925e-002, 3.773419e-002, 3.987730e-002, 4.205437e-002,
+4.426501e-002, 4.650727e-002, 4.877573e-002, 5.107170e-002, 5.339532e-002, 5.574262e-002, 5.811459e-002, 6.050661e-002, 6.291759e-002, 6.534834e-002,
+6.779597e-002, 7.026035e-002, 7.273845e-002, 7.523337e-002, 7.774119e-002, 8.026246e-002, 8.279643e-002, 8.534141e-002, 8.789667e-002, 9.046168e-002,
+9.303579e-002, 9.561838e-002, 9.820992e-002, 1.008105e-001, 1.034199e-001, 1.060380e-001, 1.086636e-001, 1.112939e-001, 1.139284e-001, 1.165692e-001,
+1.192143e-001, 1.218616e-001, 1.245130e-001, 1.271679e-001, 1.298251e-001, 1.324839e-001, 1.351447e-001, 1.378072e-001, 1.404704e-001, 1.431360e-001,
+1.458034e-001, 1.484731e-001, 1.511427e-001, 1.538105e-001, 1.564782e-001, 1.591459e-001, 1.618132e-001, 1.644779e-001, 1.671431e-001, 1.698082e-001,
+1.724765e-001, 1.751464e-001, 1.778157e-001, 1.804865e-001, 1.831578e-001, 1.858279e-001, 1.885013e-001, 1.911746e-001, 1.938498e-001, 1.965275e-001,
+1.992076e-001, 2.018888e-001, 2.045747e-001, 2.072621e-001, 2.099499e-001, 2.126414e-001, 2.153348e-001, 2.180286e-001, 2.207238e-001, 2.234222e-001,
+2.261236e-001, 2.288268e-001, 2.315322e-001, 2.342423e-001, 2.369553e-001, 2.396684e-001, 2.423832e-001, 2.451013e-001, 2.478201e-001, 2.505406e-001,
+2.532636e-001, 2.559861e-001, 2.587075e-001, 2.614302e-001, 2.641544e-001, 2.668787e-001, 2.696047e-001, 2.723301e-001, 2.750516e-001, 2.777693e-001,
+2.804855e-001, 2.832009e-001, 2.859141e-001, 2.886243e-001, 2.913316e-001, 2.940350e-001, 2.967323e-001, 2.994226e-001, 3.021079e-001, 3.047889e-001,
+3.074640e-001, 3.101322e-001, 3.127948e-001, 3.154520e-001, 3.181015e-001, 3.207401e-001, 3.233641e-001, 3.259784e-001, 3.285819e-001, 3.311731e-001,
+3.337512e-001, 3.363159e-001, 3.388672e-001, 3.414067e-001, 3.439316e-001, 3.464402e-001, 3.489316e-001, 3.514033e-001, 3.538617e-001, 3.563054e-001,
+3.587335e-001, 3.611413e-001, 3.635333e-001, 3.659127e-001, 3.682800e-001, 3.706313e-001, 3.729674e-001, 3.752928e-001, 3.776083e-001, 3.799093e-001,
+3.821945e-001, 3.844665e-001, 3.867239e-001, 3.889623e-001, 3.911906e-001, 3.934093e-001, 3.956130e-001, 3.978063e-001, 3.999901e-001, 4.021591e-001,
+4.043118e-001, 4.064540e-001, 4.085830e-001, 4.106990e-001, 4.128079e-001, 4.149077e-001, 4.169962e-001, 4.190777e-001, 4.211487e-001, 4.232075e-001,
+4.252587e-001, 4.272964e-001, 4.293248e-001, 4.313467e-001, 4.333540e-001, 4.353561e-001, 4.373524e-001, 4.393377e-001, 4.413184e-001, 4.432905e-001,
+4.452567e-001, 4.472194e-001, 4.491714e-001, 4.511190e-001, 4.530585e-001, 4.549887e-001, 4.569144e-001, 4.588278e-001, 4.607373e-001, 4.626380e-001,
+4.645320e-001, 4.664215e-001, 4.683004e-001, 4.701760e-001, 4.720404e-001, 4.739002e-001, 4.757528e-001, 4.775974e-001, 4.794372e-001, 4.812654e-001,
+4.830908e-001, 4.849025e-001, 4.867110e-001, 4.885096e-001, 4.903028e-001, 4.920883e-001, 4.938660e-001, 4.956379e-001, 4.973996e-001, 4.991573e-001,
+5.009050e-001, 5.026509e-001, 5.043883e-001, 5.061247e-001, 5.078502e-001, 5.095743e-001, 5.112900e-001, 5.130041e-001, 5.147119e-001, 5.164154e-001,
+5.181065e-001, 5.197933e-001, 5.214696e-001, 5.231423e-001, 5.248072e-001, 5.264677e-001, 5.281187e-001, 5.297662e-001, 5.314055e-001, 5.330425e-001,
+5.346732e-001, 5.363015e-001, 5.379211e-001, 5.395384e-001, 5.411433e-001, 5.427473e-001, 5.443403e-001, 5.459334e-001, 5.475160e-001, 5.490984e-001,
+5.506709e-001, 5.522418e-001, 5.538048e-001, 5.553649e-001, 5.569190e-001, 5.584687e-001, 5.600129e-001, 5.615490e-001, 5.630829e-001, 5.646088e-001,
+5.661345e-001, 5.676508e-001, 5.691672e-001, 5.706742e-001, 5.721786e-001, 5.736781e-001, 5.751734e-001, 5.766647e-001, 5.781458e-001, 5.796270e-001,
+5.810970e-001, 5.825670e-001, 5.840301e-001, 5.854902e-001, 5.869456e-001, 5.883936e-001, 5.898412e-001, 5.912801e-001, 5.927190e-001, 5.941507e-001,
+5.955792e-001, 5.970046e-001, 5.984227e-001, 5.998409e-001, 6.012484e-001, 6.026549e-001, 6.040555e-001, 6.054503e-001, 6.068443e-001, 6.082275e-001,
+6.096107e-001, 6.109866e-001, 6.123578e-001, 6.137276e-001, 6.150876e-001, 6.164476e-001, 6.178010e-001, 6.191506e-001, 6.204991e-001, 6.218384e-001,
+6.231778e-001, 6.245109e-001, 6.258393e-001, 6.271675e-001, 6.284863e-001, 6.298051e-001, 6.311200e-001, 6.324296e-001, 6.337393e-001, 6.350398e-001,
+6.363383e-001, 6.376343e-001, 6.389204e-001, 6.402065e-001, 6.414867e-001, 6.427623e-001, 6.440379e-001, 6.453067e-001, 6.465747e-001, 6.478405e-001,
+6.490974e-001, 6.503544e-001, 6.516068e-001, 6.528545e-001, 6.541022e-001, 6.553430e-001, 6.565815e-001, 6.578201e-001, 6.590460e-001, 6.602718e-001,
+6.614953e-001, 6.627100e-001, 6.639246e-001, 6.651350e-001, 6.663392e-001, 6.675434e-001, 6.687409e-001, 6.699336e-001, 6.711263e-001, 6.723106e-001,
+6.734917e-001, 6.746728e-001, 6.758468e-001, 6.770196e-001, 6.781924e-001, 6.793541e-001, 6.805154e-001, 6.816764e-001, 6.828272e-001, 6.839781e-001,
+6.851280e-001, 6.862680e-001, 6.874079e-001, 6.885467e-001, 6.896767e-001, 6.908067e-001, 6.919351e-001, 6.930524e-001, 6.941698e-001, 6.952862e-001,
+6.963944e-001, 6.975027e-001, 6.986103e-001, 6.997067e-001, 7.008031e-001, 7.018995e-001, 7.029855e-001, 7.040715e-001, 7.051574e-001, 7.062338e-001,
+7.073091e-001, 7.083844e-001, 7.094525e-001, 7.105184e-001, 7.115843e-001, 7.126430e-001, 7.136972e-001, 7.147515e-001, 7.158019e-001, 7.168476e-001,
+7.178933e-001, 7.189357e-001, 7.199682e-001, 7.210007e-001, 7.220329e-001, 7.230560e-001, 7.240791e-001, 7.251022e-001, 7.261162e-001, 7.271276e-001,
+7.281390e-001, 7.291454e-001, 7.301467e-001, 7.311479e-001, 7.321474e-001, 7.331387e-001, 7.341300e-001, 7.351213e-001, 7.361055e-001, 7.370884e-001,
+7.380714e-001, 7.390490e-001, 7.400210e-001, 7.409930e-001, 7.419641e-001, 7.429268e-001, 7.438895e-001, 7.448523e-001, 7.458073e-001, 7.467587e-001,
+7.477100e-001, 7.486597e-001, 7.496037e-001, 7.505478e-001, 7.514918e-001, 7.524288e-001, 7.533635e-001, 7.542982e-001, 7.552309e-001, 7.561576e-001,
+7.570843e-001, 7.580109e-001, 7.589310e-001, 7.598484e-001, 7.607658e-001, 7.616820e-001, 7.625918e-001, 7.635017e-001, 7.644115e-001, 7.653169e-001,
+7.662187e-001, 7.671205e-001, 7.680223e-001, 7.689168e-001, 7.698107e-001, 7.707046e-001, 7.715962e-001, 7.724819e-001, 7.733675e-001, 7.742531e-001,
+7.751324e-001, 7.760073e-001, 7.768822e-001, 7.777572e-001, 7.786241e-001, 7.794899e-001, 7.803558e-001, 7.812202e-001, 7.820760e-001, 7.829318e-001,
+7.837876e-001, 7.846405e-001, 7.854884e-001, 7.863362e-001, 7.871841e-001, 7.880274e-001, 7.888672e-001, 7.897069e-001, 7.905467e-001, 7.913809e-001,
+7.922129e-001, 7.930449e-001, 7.938770e-001, 7.947024e-001, 7.955265e-001, 7.963507e-001, 7.971749e-001, 7.979897e-001, 7.988039e-001, 7.996182e-001,
+8.004323e-001, 8.012365e-001, 8.020407e-001, 8.028448e-001, 8.036486e-001, 8.044435e-001, 8.052385e-001, 8.060334e-001, 8.068280e-001, 8.076160e-001,
+8.084039e-001, 8.091919e-001, 8.099798e-001, 8.107593e-001, 8.115388e-001, 8.123183e-001, 8.130978e-001, 8.138713e-001, 8.146446e-001, 8.154178e-001,
+8.161910e-001, 8.169561e-001, 8.177196e-001, 8.184832e-001, 8.192468e-001, 8.200044e-001, 8.207595e-001, 8.215147e-001, 8.222698e-001, 8.230199e-001,
+8.237658e-001, 8.245116e-001, 8.252574e-001, 8.260008e-001, 8.267393e-001, 8.274778e-001, 8.282163e-001, 8.289538e-001, 8.296816e-001, 8.304093e-001,
+8.311371e-001, 8.318649e-001, 8.325856e-001, 8.333047e-001, 8.340238e-001, 8.347429e-001, 8.354570e-001, 8.361662e-001, 8.368755e-001, 8.375848e-001,
+8.382928e-001, 8.389947e-001, 8.396966e-001, 8.403985e-001, 8.411003e-001, 8.417940e-001, 8.424854e-001, 8.431769e-001, 8.438683e-001, 8.445565e-001,
+8.452390e-001, 8.459215e-001, 8.466041e-001, 8.472866e-001, 8.479604e-001, 8.486334e-001, 8.493063e-001, 8.499793e-001, 8.506484e-001, 8.513122e-001,
+8.519760e-001, 8.526397e-001, 8.533035e-001, 8.539576e-001, 8.546106e-001, 8.552636e-001, 8.559166e-001, 8.565670e-001, 8.572119e-001, 8.578568e-001,
+8.585018e-001, 8.591467e-001, 8.597838e-001, 8.604179e-001, 8.610521e-001, 8.616863e-001, 8.623197e-001, 8.629448e-001, 8.635699e-001, 8.641950e-001,
+8.648201e-001, 8.654414e-001, 8.660572e-001, 8.666729e-001, 8.672886e-001, 8.679043e-001, 8.685140e-001, 8.691210e-001, 8.697279e-001, 8.703348e-001,
+8.709418e-001, 8.715393e-001, 8.721362e-001, 8.727331e-001, 8.733299e-001, 8.739258e-001, 8.745155e-001, 8.751052e-001, 8.756948e-001, 8.762845e-001,
+8.768713e-001, 8.774514e-001, 8.780315e-001, 8.786115e-001, 8.791916e-001, 8.797678e-001, 8.803385e-001, 8.809092e-001, 8.814799e-001, 8.820506e-001,
+8.826172e-001, 8.831797e-001, 8.837422e-001, 8.843047e-001, 8.848672e-001, 8.854260e-001, 8.859816e-001, 8.865372e-001, 8.870928e-001, 8.876484e-001,
+8.881986e-001, 8.887440e-001, 8.892895e-001, 8.898350e-001, 8.903805e-001, 8.909213e-001, 8.914575e-001, 8.919936e-001, 8.925298e-001, 8.930659e-001,
+8.935988e-001, 8.941271e-001, 8.946554e-001, 8.951837e-001, 8.957120e-001, 8.962380e-001, 8.967581e-001, 8.972783e-001, 8.977984e-001, 8.983185e-001,
+8.988376e-001, 8.993478e-001, 8.998581e-001, 9.003684e-001, 9.008787e-001, 9.013890e-001, 9.018916e-001, 9.023934e-001, 9.028953e-001, 9.033971e-001,
+9.038989e-001, 9.043962e-001, 9.048910e-001, 9.053859e-001, 9.058807e-001, 9.063755e-001, 9.068669e-001, 9.073519e-001, 9.078369e-001, 9.083219e-001,
+9.088069e-001, 9.092918e-001, 9.097664e-001, 9.102410e-001, 9.107156e-001, 9.111902e-001, 9.116648e-001, 9.121346e-001, 9.126017e-001, 9.130687e-001,
+9.135357e-001, 9.140027e-001, 9.144683e-001, 9.149282e-001, 9.153881e-001, 9.158479e-001, 9.163078e-001, 9.167676e-001, 9.172213e-001, 9.176726e-001,
+9.181238e-001, 9.185751e-001, 9.190263e-001, 9.194754e-001, 9.199154e-001, 9.203555e-001, 9.207956e-001, 9.212356e-001, 9.216757e-001, 9.221099e-001,
+9.225407e-001, 9.229714e-001, 9.234022e-001, 9.238329e-001, 9.242636e-001, 9.246863e-001, 9.251089e-001, 9.255316e-001, 9.259543e-001, 9.263769e-001,
+9.267968e-001, 9.272115e-001, 9.276262e-001, 9.280409e-001, 9.284555e-001, 9.288702e-001, 9.292794e-001, 9.296854e-001, 9.300914e-001, 9.304975e-001,
+9.309035e-001, 9.313096e-001, 9.317074e-001, 9.321042e-001, 9.325010e-001, 9.328979e-001, 9.332947e-001, 9.336907e-001, 9.340783e-001, 9.344660e-001,
+9.348536e-001, 9.352413e-001, 9.356290e-001, 9.360148e-001, 9.363947e-001, 9.367746e-001, 9.371546e-001, 9.375345e-001, 9.379144e-001, 9.382918e-001,
+9.386643e-001, 9.390369e-001, 9.394094e-001, 9.397819e-001, 9.401544e-001, 9.405236e-001, 9.408878e-001, 9.412519e-001, 9.416161e-001, 9.419802e-001,
+9.423443e-001, 9.427044e-001, 9.430582e-001, 9.434120e-001, 9.437658e-001, 9.441196e-001, 9.444734e-001, 9.448244e-001, 9.451701e-001, 9.455157e-001,
+9.458614e-001, 9.462071e-001, 9.465527e-001, 9.468964e-001, 9.472342e-001, 9.475719e-001, 9.479096e-001, 9.482473e-001, 9.485851e-001, 9.489221e-001,
+9.492531e-001, 9.495840e-001, 9.499150e-001, 9.502460e-001, 9.505769e-001, 9.509079e-001, 9.512315e-001, 9.515543e-001, 9.518771e-001, 9.521999e-001,
+9.525227e-001, 9.528455e-001, 9.531628e-001, 9.534772e-001, 9.537917e-001, 9.541061e-001, 9.544205e-001, 9.547349e-001, 9.550464e-001, 9.553524e-001,
+9.556583e-001, 9.559643e-001, 9.562703e-001, 9.565762e-001, 9.568822e-001, 9.571802e-001, 9.574782e-001, 9.577761e-001, 9.580741e-001, 9.583721e-001,
+9.586700e-001, 9.589635e-001, 9.592538e-001, 9.595441e-001, 9.598344e-001, 9.601247e-001, 9.604150e-001, 9.607044e-001, 9.609870e-001, 9.612697e-001,
+9.615523e-001, 9.618350e-001, 9.621176e-001, 9.624003e-001, 9.626782e-001, 9.629531e-001, 9.632280e-001, 9.635029e-001, 9.637779e-001, 9.640528e-001,
+9.643274e-001, 9.645949e-001, 9.648625e-001, 9.651300e-001, 9.653976e-001, 9.656651e-001, 9.659326e-001, 9.661972e-001, 9.664575e-001, 9.667178e-001,
+9.669781e-001, 9.672384e-001, 9.674988e-001, 9.677591e-001, 9.680131e-001, 9.682649e-001, 9.685167e-001, 9.687685e-001, 9.690203e-001, 9.692722e-001,
+9.695239e-001, 9.697674e-001, 9.700109e-001, 9.702544e-001, 9.704979e-001, 9.707414e-001, 9.709848e-001, 9.712266e-001, 9.714621e-001, 9.716977e-001,
+9.719332e-001, 9.721687e-001, 9.724042e-001, 9.726398e-001, 9.728725e-001, 9.731005e-001, 9.733285e-001, 9.735565e-001, 9.737845e-001, 9.740126e-001,
+9.742406e-001, 9.744649e-001, 9.746852e-001, 9.749055e-001, 9.751257e-001, 9.753460e-001, 9.755662e-001, 9.757865e-001, 9.760036e-001, 9.762178e-001,
+9.764320e-001, 9.766462e-001, 9.768604e-001, 9.770746e-001, 9.772887e-001, 9.774992e-001, 9.777060e-001, 9.779127e-001, 9.781194e-001, 9.783261e-001,
+9.785328e-001, 9.787396e-001, 9.789427e-001, 9.791410e-001, 9.793392e-001, 9.795374e-001, 9.797357e-001, 9.799339e-001, 9.801321e-001, 9.803281e-001,
+9.805182e-001, 9.807084e-001, 9.808985e-001, 9.810887e-001, 9.812788e-001, 9.814690e-001, 9.816585e-001, 9.818411e-001, 9.820238e-001, 9.822065e-001,
+9.823891e-001, 9.825718e-001, 9.827544e-001, 9.829371e-001, 9.831125e-001, 9.832866e-001, 9.834606e-001, 9.836346e-001, 9.838086e-001, 9.839826e-001,
+9.841566e-001, 9.843259e-001, 9.844910e-001, 9.846560e-001, 9.848211e-001, 9.849861e-001, 9.851512e-001, 9.853162e-001, 9.854802e-001, 9.856383e-001,
+9.857964e-001, 9.859545e-001, 9.861126e-001, 9.862707e-001, 9.864288e-001, 9.865869e-001, 9.867393e-001, 9.868895e-001, 9.870397e-001, 9.871899e-001,
+9.873401e-001, 9.874903e-001, 9.876404e-001, 9.877887e-001, 9.879300e-001, 9.880714e-001, 9.882127e-001, 9.883541e-001, 9.884954e-001, 9.886368e-001,
+9.887781e-001, 9.889159e-001, 9.890518e-001, 9.891877e-001, 9.893235e-001, 9.894594e-001, 9.895953e-001, 9.897312e-001, 9.898670e-001, 9.899997e-001,
+9.901323e-001, 9.902650e-001, 9.903977e-001, 9.905303e-001, 9.906630e-001, 9.907957e-001, 9.909267e-001, 9.910547e-001, 9.911827e-001, 9.913107e-001,
+9.914388e-001, 9.915668e-001, 9.916948e-001, 9.918228e-001, 9.919473e-001, 9.920694e-001, 9.921916e-001, 9.923137e-001, 9.924359e-001, 9.925580e-001,
+9.926802e-001, 9.928023e-001, 9.929195e-001, 9.930353e-001, 9.931510e-001, 9.932668e-001, 9.933826e-001, 9.934984e-001, 9.936142e-001, 9.937299e-001,
+9.938407e-001, 9.939511e-001, 9.940614e-001, 9.941717e-001, 9.942820e-001, 9.943924e-001, 9.945027e-001, 9.946130e-001, 9.947180e-001, 9.948229e-001,
+9.949277e-001, 9.950326e-001, 9.951374e-001, 9.952423e-001, 9.953472e-001, 9.954520e-001, 9.955508e-001, 9.956493e-001, 9.957479e-001, 9.958464e-001,
+9.959449e-001, 9.960435e-001, 9.961420e-001, 9.962405e-001, 9.963330e-001, 9.964247e-001, 9.965164e-001, 9.966082e-001, 9.966999e-001, 9.967916e-001,
+9.968833e-001, 9.969750e-001, 9.970618e-001, 9.971468e-001, 9.972319e-001, 9.973170e-001, 9.974020e-001, 9.974871e-001, 9.975721e-001, 9.976572e-001,
+9.977390e-001, 9.978180e-001, 9.978969e-001, 9.979758e-001, 9.980547e-001, 9.981337e-001, 9.982126e-001, 9.982915e-001, 9.983688e-001, 9.984411e-001,
+9.985135e-001, 9.985858e-001, 9.986582e-001, 9.987305e-001, 9.988029e-001, 9.988752e-001, 9.989476e-001, 9.990135e-001, 9.990788e-001, 9.991441e-001,
+9.992093e-001, 9.992746e-001, 9.993399e-001, 9.994051e-001, 9.994704e-001, 9.995324e-001, 9.995908e-001, 9.996493e-001, 9.997077e-001, 9.997662e-001,
+9.998246e-001, 9.998831e-001, 9.999415e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.736730e-004, 2.135488e-003, 3.493881e-003, 5.041171e-003, 6.864161e-003, 9.009941e-003, 1.145479e-002, 1.416834e-002, 1.711856e-002,
+2.025850e-002, 2.354862e-002, 2.697600e-002, 3.054339e-002, 3.427553e-002, 3.819537e-002, 4.232452e-002, 4.667083e-002, 5.120995e-002, 5.590657e-002,
+6.070126e-002, 6.552296e-002, 7.032993e-002, 7.508544e-002, 7.978314e-002, 8.442184e-002, 8.900359e-002, 9.353016e-002, 9.802340e-002, 1.024932e-001,
+1.069511e-001, 1.114013e-001, 1.158443e-001, 1.202881e-001, 1.247390e-001, 1.292017e-001, 1.336800e-001, 1.381774e-001, 1.426994e-001, 1.472472e-001,
+1.518260e-001, 1.564404e-001, 1.610952e-001, 1.657952e-001, 1.705430e-001, 1.753393e-001, 1.801754e-001, 1.850488e-001, 1.899594e-001, 1.949049e-001,
+1.998750e-001, 2.048488e-001, 2.098221e-001, 2.147811e-001, 2.197101e-001, 2.246035e-001, 2.294572e-001, 2.342610e-001, 2.390077e-001, 2.436913e-001,
+2.483088e-001, 2.528624e-001, 2.573608e-001, 2.618095e-001, 2.662059e-001, 2.705568e-001, 2.748656e-001, 2.791440e-001, 2.833940e-001, 2.876233e-001,
+2.918379e-001, 2.960408e-001, 3.002306e-001, 3.044033e-001, 3.085659e-001, 3.127257e-001, 3.168802e-001, 3.210279e-001, 3.251654e-001, 3.292971e-001,
+3.334252e-001, 3.375486e-001, 3.416658e-001, 3.457754e-001, 3.498773e-001, 3.539677e-001, 3.580412e-001, 3.620964e-001, 3.661319e-001, 3.701558e-001,
+3.741641e-001, 3.781497e-001, 3.821138e-001, 3.860581e-001, 3.899830e-001, 3.938888e-001, 3.977788e-001, 4.016534e-001, 4.055138e-001, 4.093612e-001,
+4.131960e-001, 4.170177e-001, 4.208178e-001, 4.245958e-001, 4.283537e-001, 4.320934e-001, 4.358171e-001, 4.395225e-001, 4.432025e-001, 4.468583e-001,
+4.504924e-001, 4.541030e-001, 4.576902e-001, 4.612515e-001, 4.647877e-001, 4.682984e-001, 4.717861e-001, 4.752514e-001, 4.786920e-001, 4.821072e-001,
+4.855001e-001, 4.888701e-001, 4.922115e-001, 4.955233e-001, 4.988075e-001, 5.020602e-001, 5.052835e-001, 5.084816e-001, 5.116459e-001, 5.147755e-001,
+5.178749e-001, 5.209412e-001, 5.239753e-001, 5.269788e-001, 5.299521e-001, 5.328952e-001, 5.358104e-001, 5.386914e-001, 5.415413e-001, 5.443619e-001,
+5.471564e-001, 5.499270e-001, 5.526748e-001, 5.553983e-001, 5.580946e-001, 5.607616e-001, 5.634018e-001, 5.660176e-001, 5.686089e-001, 5.711728e-001,
+5.737163e-001, 5.762403e-001, 5.787448e-001, 5.812224e-001, 5.836719e-001, 5.861017e-001, 5.885128e-001, 5.909011e-001, 5.932655e-001, 5.956128e-001,
+5.979433e-001, 6.002512e-001, 6.025369e-001, 6.048056e-001, 6.070577e-001, 6.092873e-001, 6.115017e-001, 6.137034e-001, 6.158903e-001, 6.180560e-001,
+6.202107e-001, 6.223551e-001, 6.244797e-001, 6.265920e-001, 6.286922e-001, 6.307720e-001, 6.328415e-001, 6.349012e-001, 6.369373e-001, 6.389624e-001,
+6.409782e-001, 6.429752e-001, 6.449600e-001, 6.469345e-001, 6.488882e-001, 6.508328e-001, 6.527666e-001, 6.546780e-001, 6.565800e-001, 6.584674e-001,
+6.603386e-001, 6.622004e-001, 6.640379e-001, 6.658636e-001, 6.676772e-001, 6.694694e-001, 6.712528e-001, 6.730165e-001, 6.747667e-001, 6.765061e-001,
+6.782281e-001, 6.799430e-001, 6.816384e-001, 6.833207e-001, 6.849897e-001, 6.866384e-001, 6.882800e-001, 6.898953e-001, 6.915026e-001, 6.930922e-001,
+6.946684e-001, 6.962334e-001, 6.977773e-001, 6.993149e-001, 7.008235e-001, 7.023267e-001, 7.038078e-001, 7.052788e-001, 7.067327e-001, 7.081739e-001,
+7.096043e-001, 7.110185e-001, 7.124254e-001, 7.138101e-001, 7.151902e-001, 7.165504e-001, 7.179082e-001, 7.192432e-001, 7.205743e-001, 7.218820e-001,
+7.231846e-001, 7.244688e-001, 7.257465e-001, 7.270068e-001, 7.282581e-001, 7.294903e-001, 7.307135e-001, 7.319199e-001, 7.331191e-001, 7.343054e-001,
+7.354832e-001, 7.366452e-001, 7.378004e-001, 7.389415e-001, 7.400769e-001, 7.411974e-001, 7.423136e-001, 7.434150e-001, 7.445134e-001, 7.455939e-001,
+7.466736e-001, 7.477391e-001, 7.488046e-001, 7.498522e-001, 7.508988e-001, 7.519304e-001, 7.529588e-001, 7.539767e-001, 7.549896e-001, 7.559961e-001,
+7.569966e-001, 7.579910e-001, 7.589733e-001, 7.599535e-001, 7.609199e-001, 7.618863e-001, 7.628408e-001, 7.637942e-001, 7.647388e-001, 7.656794e-001,
+7.666130e-001, 7.675376e-001, 7.684599e-001, 7.693706e-001, 7.702813e-001, 7.711808e-001, 7.720787e-001, 7.729684e-001, 7.738517e-001, 7.747314e-001,
+7.755992e-001, 7.764671e-001, 7.773266e-001, 7.781849e-001, 7.790384e-001, 7.798874e-001, 7.807346e-001, 7.815697e-001, 7.824047e-001, 7.832311e-001,
+7.840542e-001, 7.848746e-001, 7.856889e-001, 7.865031e-001, 7.873069e-001, 7.881089e-001, 7.889057e-001, 7.896942e-001, 7.904826e-001, 7.912638e-001,
+7.920442e-001, 7.928205e-001, 7.935903e-001, 7.943601e-001, 7.951199e-001, 7.958779e-001, 7.966323e-001, 7.973783e-001, 7.981242e-001, 7.988657e-001,
+7.996055e-001, 8.003446e-001, 8.010788e-001, 8.018130e-001, 8.025422e-001, 8.032669e-001, 8.039916e-001, 8.047072e-001, 8.054216e-001, 8.061350e-001,
+8.068445e-001, 8.075541e-001, 8.082595e-001, 8.089614e-001, 8.096633e-001, 8.103563e-001, 8.110478e-001, 8.117381e-001, 8.124209e-001, 8.131037e-001,
+8.137840e-001, 8.144602e-001, 8.151364e-001, 8.158075e-001, 8.164752e-001, 8.171430e-001, 8.178033e-001, 8.184620e-001, 8.191206e-001, 8.197691e-001,
+8.204176e-001, 8.210650e-001, 8.217063e-001, 8.223475e-001, 8.229871e-001, 8.236224e-001, 8.242578e-001, 8.248904e-001, 8.255188e-001, 8.261472e-001,
+8.267705e-001, 8.273886e-001, 8.280068e-001, 8.286191e-001, 8.292268e-001, 8.298345e-001, 8.304392e-001, 8.310419e-001, 8.316445e-001, 8.322427e-001,
+8.328380e-001, 8.334333e-001, 8.340229e-001, 8.346087e-001, 8.351945e-001, 8.357761e-001, 8.363545e-001, 8.369329e-001, 8.375086e-001, 8.380818e-001,
+8.386550e-001, 8.392254e-001, 8.397921e-001, 8.403588e-001, 8.409234e-001, 8.414833e-001, 8.420433e-001, 8.426019e-001, 8.431546e-001, 8.437072e-001,
+8.442596e-001, 8.448042e-001, 8.453488e-001, 8.458935e-001, 8.464329e-001, 8.469712e-001, 8.475095e-001, 8.480458e-001, 8.485808e-001, 8.491157e-001,
+8.496480e-001, 8.501760e-001, 8.507040e-001, 8.512308e-001, 8.517483e-001, 8.522658e-001, 8.527832e-001, 8.532954e-001, 8.538062e-001, 8.543171e-001,
+8.548266e-001, 8.553347e-001, 8.558428e-001, 8.563500e-001, 8.568517e-001, 8.573534e-001, 8.578552e-001, 8.583501e-001, 8.588429e-001, 8.593356e-001,
+8.598263e-001, 8.603130e-001, 8.607998e-001, 8.612866e-001, 8.617707e-001, 8.622545e-001, 8.627384e-001, 8.632198e-001, 8.636982e-001, 8.641766e-001,
+8.646550e-001, 8.651265e-001, 8.655977e-001, 8.660690e-001, 8.665380e-001, 8.670044e-001, 8.674707e-001, 8.679371e-001, 8.683987e-001, 8.688599e-001,
+8.693211e-001, 8.697806e-001, 8.702369e-001, 8.706931e-001, 8.711493e-001, 8.716015e-001, 8.720520e-001, 8.725025e-001, 8.729527e-001, 8.733996e-001,
+8.738465e-001, 8.742935e-001, 8.747377e-001, 8.751781e-001, 8.756185e-001, 8.760588e-001, 8.764962e-001, 8.769323e-001, 8.773684e-001, 8.778045e-001,
+8.782366e-001, 8.786685e-001, 8.791004e-001, 8.795318e-001, 8.799616e-001, 8.803914e-001, 8.808211e-001, 8.812488e-001, 8.816736e-001, 8.820983e-001,
+8.825231e-001, 8.829431e-001, 8.833600e-001, 8.837769e-001, 8.841938e-001, 8.846076e-001, 8.850204e-001, 8.854332e-001, 8.858460e-001, 8.862585e-001,
+8.866708e-001, 8.870832e-001, 8.874956e-001, 8.879050e-001, 8.883141e-001, 8.887232e-001, 8.891323e-001, 8.895355e-001, 8.899385e-001, 8.903416e-001,
+8.907446e-001, 8.911405e-001, 8.915363e-001, 8.919321e-001, 8.923279e-001, 8.927236e-001, 8.931194e-001, 8.935151e-001, 8.939108e-001, 8.943054e-001,
+8.946999e-001, 8.950943e-001, 8.954888e-001, 8.958798e-001, 8.962703e-001, 8.966607e-001, 8.970511e-001, 8.974366e-001, 8.978203e-001, 8.982040e-001,
+8.985876e-001, 8.989668e-001, 8.993426e-001, 8.997183e-001, 9.000941e-001, 9.004687e-001, 9.008413e-001, 9.012139e-001, 9.015865e-001, 9.019587e-001,
+9.023287e-001, 9.026986e-001, 9.030685e-001, 9.034384e-001, 9.038041e-001, 9.041694e-001, 9.045347e-001, 9.048999e-001, 9.052617e-001, 9.056212e-001,
+9.059806e-001, 9.063401e-001, 9.066986e-001, 9.070546e-001, 9.074106e-001, 9.077665e-001, 9.081225e-001, 9.084753e-001, 9.088278e-001, 9.091802e-001,
+9.095327e-001, 9.098836e-001, 9.102330e-001, 9.105823e-001, 9.109317e-001, 9.112808e-001, 9.116260e-001, 9.119713e-001, 9.123165e-001, 9.126617e-001,
+9.130048e-001, 9.133464e-001, 9.136881e-001, 9.140298e-001, 9.143711e-001, 9.147091e-001, 9.150471e-001, 9.153851e-001, 9.157231e-001, 9.160579e-001,
+9.163900e-001, 9.167221e-001, 9.170542e-001, 9.173863e-001, 9.177129e-001, 9.180392e-001, 9.183655e-001, 9.186918e-001, 9.190168e-001, 9.193391e-001,
+9.196614e-001, 9.199838e-001, 9.203061e-001, 9.206276e-001, 9.209488e-001, 9.212699e-001, 9.215910e-001, 9.219121e-001, 9.222300e-001, 9.225477e-001,
+9.228654e-001, 9.231832e-001, 9.234996e-001, 9.238118e-001, 9.241240e-001, 9.244362e-001, 9.247483e-001, 9.250574e-001, 9.253627e-001, 9.256679e-001,
+9.259731e-001, 9.262783e-001, 9.265811e-001, 9.268824e-001, 9.271837e-001, 9.274850e-001, 9.277863e-001, 9.280867e-001, 9.283868e-001, 9.286869e-001,
+9.289870e-001, 9.292871e-001, 9.295849e-001, 9.298823e-001, 9.301797e-001, 9.304771e-001, 9.307745e-001, 9.310675e-001, 9.313602e-001, 9.316528e-001,
+9.319455e-001, 9.322381e-001, 9.325250e-001, 9.328115e-001, 9.330980e-001, 9.333846e-001, 9.336711e-001, 9.339528e-001, 9.342340e-001, 9.345153e-001,
+9.347965e-001, 9.350778e-001, 9.353564e-001, 9.356347e-001, 9.359129e-001, 9.361911e-001, 9.364693e-001, 9.367458e-001, 9.370217e-001, 9.372975e-001,
+9.375734e-001, 9.378493e-001, 9.381230e-001, 9.383951e-001, 9.386673e-001, 9.389394e-001, 9.392116e-001, 9.394819e-001, 9.397496e-001, 9.400172e-001,
+9.402849e-001, 9.405526e-001, 9.408199e-001, 9.410853e-001, 9.413506e-001, 9.416160e-001, 9.418813e-001, 9.421467e-001, 9.424085e-001, 9.426698e-001,
+9.429311e-001, 9.431924e-001, 9.434537e-001, 9.437129e-001, 9.439705e-001, 9.442281e-001, 9.444857e-001, 9.447432e-001, 9.449998e-001, 9.452525e-001,
+9.455052e-001, 9.457579e-001, 9.460106e-001, 9.462632e-001, 9.465130e-001, 9.467620e-001, 9.470111e-001, 9.472601e-001, 9.475091e-001, 9.477578e-001,
+9.480059e-001, 9.482540e-001, 9.485020e-001, 9.487501e-001, 9.489981e-001, 9.492439e-001, 9.494893e-001, 9.497347e-001, 9.499801e-001, 9.502255e-001,
+9.504696e-001, 9.507107e-001, 9.509518e-001, 9.511928e-001, 9.514339e-001, 9.516750e-001, 9.519119e-001, 9.521470e-001, 9.523821e-001, 9.526172e-001,
+9.528523e-001, 9.530870e-001, 9.533158e-001, 9.535445e-001, 9.537733e-001, 9.540020e-001, 9.542308e-001, 9.544587e-001, 9.546854e-001, 9.549120e-001,
+9.551386e-001, 9.553652e-001, 9.555919e-001, 9.558166e-001, 9.560402e-001, 9.562638e-001, 9.564875e-001, 9.567111e-001, 9.569347e-001, 9.571559e-001,
+9.573767e-001, 9.575975e-001, 9.578183e-001, 9.580391e-001, 9.582598e-001, 9.584767e-001, 9.586937e-001, 9.589106e-001, 9.591275e-001, 9.593444e-001,
+9.595606e-001, 9.597727e-001, 9.599848e-001, 9.601968e-001, 9.604089e-001, 9.606210e-001, 9.608322e-001, 9.610405e-001, 9.612487e-001, 9.614569e-001,
+9.616652e-001, 9.618734e-001, 9.620808e-001, 9.622855e-001, 9.624903e-001, 9.626950e-001, 9.628997e-001, 9.631045e-001, 9.633081e-001, 9.635080e-001,
+9.637080e-001, 9.639079e-001, 9.641078e-001, 9.643077e-001, 9.645070e-001, 9.647027e-001, 9.648983e-001, 9.650940e-001, 9.652896e-001, 9.654853e-001,
+9.656808e-001, 9.658719e-001, 9.660631e-001, 9.662542e-001, 9.664454e-001, 9.666365e-001, 9.668277e-001, 9.670159e-001, 9.672036e-001, 9.673914e-001,
+9.675791e-001, 9.677668e-001, 9.679545e-001, 9.681414e-001, 9.683276e-001, 9.685139e-001, 9.687002e-001, 9.688865e-001, 9.690728e-001, 9.692583e-001,
+9.694423e-001, 9.696264e-001, 9.698104e-001, 9.699945e-001, 9.701785e-001, 9.703625e-001, 9.705431e-001, 9.707237e-001, 9.709042e-001, 9.710848e-001,
+9.712654e-001, 9.714459e-001, 9.716235e-001, 9.717993e-001, 9.719752e-001, 9.721510e-001, 9.723268e-001, 9.725026e-001, 9.726774e-001, 9.728479e-001,
+9.730183e-001, 9.731887e-001, 9.733592e-001, 9.735296e-001, 9.737001e-001, 9.738675e-001, 9.740337e-001, 9.742000e-001, 9.743662e-001, 9.745324e-001,
+9.746986e-001, 9.748642e-001, 9.750267e-001, 9.751893e-001, 9.753518e-001, 9.755143e-001, 9.756768e-001, 9.758394e-001, 9.760002e-001, 9.761597e-001,
+9.763193e-001, 9.764788e-001, 9.766384e-001, 9.767979e-001, 9.769575e-001, 9.771137e-001, 9.772697e-001, 9.774257e-001, 9.775817e-001, 9.777377e-001,
+9.778936e-001, 9.780487e-001, 9.782000e-001, 9.783513e-001, 9.785026e-001, 9.786539e-001, 9.788052e-001, 9.789566e-001, 9.791056e-001, 9.792517e-001,
+9.793979e-001, 9.795440e-001, 9.796901e-001, 9.798362e-001, 9.799824e-001, 9.801261e-001, 9.802683e-001, 9.804104e-001, 9.805526e-001, 9.806948e-001,
+9.808370e-001, 9.809792e-001, 9.811189e-001, 9.812577e-001, 9.813965e-001, 9.815353e-001, 9.816741e-001, 9.818129e-001, 9.819517e-001, 9.820871e-001,
+9.822216e-001, 9.823561e-001, 9.824907e-001, 9.826252e-001, 9.827598e-001, 9.828943e-001, 9.830258e-001, 9.831566e-001, 9.832874e-001, 9.834182e-001,
+9.835490e-001, 9.836798e-001, 9.838105e-001, 9.839381e-001, 9.840647e-001, 9.841912e-001, 9.843178e-001, 9.844444e-001, 9.845709e-001, 9.846975e-001,
+9.848210e-001, 9.849430e-001, 9.850650e-001, 9.851870e-001, 9.853090e-001, 9.854310e-001, 9.855529e-001, 9.856733e-001, 9.857919e-001, 9.859106e-001,
+9.860293e-001, 9.861480e-001, 9.862666e-001, 9.863853e-001, 9.865033e-001, 9.866193e-001, 9.867353e-001, 9.868513e-001, 9.869673e-001, 9.870833e-001,
+9.871993e-001, 9.873153e-001, 9.874280e-001, 9.875406e-001, 9.876532e-001, 9.877659e-001, 9.878785e-001, 9.879911e-001, 9.881037e-001, 9.882148e-001,
+9.883250e-001, 9.884351e-001, 9.885453e-001, 9.886554e-001, 9.887656e-001, 9.888757e-001, 9.889852e-001, 9.890925e-001, 9.891998e-001, 9.893071e-001,
+9.894144e-001, 9.895216e-001, 9.896289e-001, 9.897362e-001, 9.898411e-001, 9.899452e-001, 9.900494e-001, 9.901535e-001, 9.902577e-001, 9.903618e-001,
+9.904660e-001, 9.905696e-001, 9.906715e-001, 9.907734e-001, 9.908754e-001, 9.909773e-001, 9.910792e-001, 9.911812e-001, 9.912831e-001, 9.913835e-001,
+9.914831e-001, 9.915827e-001, 9.916823e-001, 9.917819e-001, 9.918815e-001, 9.919811e-001, 9.920807e-001, 9.921786e-001, 9.922764e-001, 9.923742e-001,
+9.924721e-001, 9.925699e-001, 9.926677e-001, 9.927656e-001, 9.928627e-001, 9.929582e-001, 9.930536e-001, 9.931490e-001, 9.932444e-001, 9.933398e-001,
+9.934352e-001, 9.935306e-001, 9.936246e-001, 9.937170e-001, 9.938094e-001, 9.939018e-001, 9.939942e-001, 9.940867e-001, 9.941791e-001, 9.942715e-001,
+9.943618e-001, 9.944508e-001, 9.945398e-001, 9.946289e-001, 9.947179e-001, 9.948070e-001, 9.948960e-001, 9.949850e-001, 9.950716e-001, 9.951572e-001,
+9.952428e-001, 9.953284e-001, 9.954140e-001, 9.954996e-001, 9.955852e-001, 9.956708e-001, 9.957543e-001, 9.958370e-001, 9.959197e-001, 9.960024e-001,
+9.960850e-001, 9.961677e-001, 9.962504e-001, 9.963331e-001, 9.964142e-001, 9.964946e-001, 9.965749e-001, 9.966553e-001, 9.967357e-001, 9.968160e-001,
+9.968964e-001, 9.969768e-001, 9.970559e-001, 9.971341e-001, 9.972123e-001, 9.972905e-001, 9.973688e-001, 9.974470e-001, 9.975252e-001, 9.976034e-001,
+9.976805e-001, 9.977560e-001, 9.978315e-001, 9.979069e-001, 9.979824e-001, 9.980579e-001, 9.981334e-001, 9.982088e-001, 9.982838e-001, 9.983559e-001,
+9.984280e-001, 9.985002e-001, 9.985723e-001, 9.986444e-001, 9.987165e-001, 9.987886e-001, 9.988608e-001, 9.989299e-001, 9.989984e-001, 9.990669e-001,
+9.991355e-001, 9.992040e-001, 9.992725e-001, 9.993411e-001, 9.994096e-001, 9.994767e-001, 9.995421e-001, 9.996075e-001, 9.996729e-001, 9.997383e-001,
+9.998038e-001, 9.998692e-001, 9.999346e-001, 1.000000e+000)),
+("Agfa", "Agfachrome RSX2 100", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.538157e-004, 1.209664e-003, 1.914098e-003, 2.646020e-003, 3.415791e-003, 4.239341e-003, 5.122353e-003, 6.067354e-003, 7.081762e-003,
+8.176160e-003, 9.359313e-003, 1.063414e-002, 1.199615e-002, 1.343479e-002, 1.493790e-002, 1.649537e-002, 1.810453e-002, 1.977607e-002, 2.152262e-002,
+2.336058e-002, 2.530096e-002, 2.735664e-002, 2.953764e-002, 3.184433e-002, 3.427355e-002, 3.681627e-002, 3.946320e-002, 4.220219e-002, 4.502410e-002,
+4.791825e-002, 5.086955e-002, 5.386710e-002, 5.690390e-002, 5.996534e-002, 6.304415e-002, 6.613318e-002, 6.922355e-002, 7.231310e-002, 7.539635e-002,
+7.847000e-002, 8.152943e-002, 8.457464e-002, 8.760725e-002, 9.062346e-002, 9.362409e-002, 9.660999e-002, 9.957469e-002, 1.025210e-001, 1.054514e-001,
+1.083656e-001, 1.112613e-001, 1.141443e-001, 1.170163e-001, 1.198786e-001, 1.227298e-001, 1.255752e-001, 1.284184e-001, 1.312607e-001, 1.341049e-001,
+1.369510e-001, 1.398000e-001, 1.426570e-001, 1.455242e-001, 1.484020e-001, 1.512925e-001, 1.541954e-001, 1.571147e-001, 1.600484e-001, 1.629952e-001,
+1.659574e-001, 1.689333e-001, 1.719211e-001, 1.749180e-001, 1.779257e-001, 1.809400e-001, 1.839602e-001, 1.869864e-001, 1.900131e-001, 1.930415e-001,
+1.960688e-001, 1.990925e-001, 2.021105e-001, 2.051244e-001, 2.081329e-001, 2.111341e-001, 2.141272e-001, 2.171119e-001, 2.200874e-001, 2.230526e-001,
+2.260070e-001, 2.289530e-001, 2.318878e-001, 2.348102e-001, 2.377181e-001, 2.406145e-001, 2.435015e-001, 2.463798e-001, 2.492484e-001, 2.521043e-001,
+2.549489e-001, 2.577804e-001, 2.605998e-001, 2.634068e-001, 2.662003e-001, 2.689800e-001, 2.717454e-001, 2.744967e-001, 2.772314e-001, 2.799472e-001,
+2.826447e-001, 2.853255e-001, 2.879889e-001, 2.906337e-001, 2.932612e-001, 2.958734e-001, 2.984700e-001, 3.010497e-001, 3.036122e-001, 3.061597e-001,
+3.086944e-001, 3.112166e-001, 3.137254e-001, 3.162208e-001, 3.187038e-001, 3.211765e-001, 3.236395e-001, 3.260941e-001, 3.285395e-001, 3.309770e-001,
+3.334092e-001, 3.358364e-001, 3.382585e-001, 3.406754e-001, 3.430869e-001, 3.454923e-001, 3.478922e-001, 3.502902e-001, 3.526883e-001, 3.550875e-001,
+3.574880e-001, 3.598900e-001, 3.622937e-001, 3.646991e-001, 3.671063e-001, 3.695153e-001, 3.719267e-001, 3.743407e-001, 3.767571e-001, 3.791759e-001,
+3.815972e-001, 3.840225e-001, 3.864507e-001, 3.888814e-001, 3.913142e-001, 3.937469e-001, 3.961796e-001, 3.986124e-001, 4.010451e-001, 4.034779e-001,
+4.059106e-001, 4.083434e-001, 4.107761e-001, 4.132089e-001, 4.156417e-001, 4.180745e-001, 4.205072e-001, 4.229400e-001, 4.253725e-001, 4.278021e-001,
+4.302272e-001, 4.326484e-001, 4.350630e-001, 4.374726e-001, 4.398784e-001, 4.422785e-001, 4.446739e-001, 4.470662e-001, 4.494530e-001, 4.518360e-001,
+4.542163e-001, 4.565913e-001, 4.589623e-001, 4.613293e-001, 4.636883e-001, 4.660438e-001, 4.683940e-001, 4.707358e-001, 4.730732e-001, 4.754005e-001,
+4.777208e-001, 4.800348e-001, 4.823366e-001, 4.846339e-001, 4.869212e-001, 4.892016e-001, 4.914767e-001, 4.937387e-001, 4.959958e-001, 4.982388e-001,
+5.004736e-001, 5.026996e-001, 5.049134e-001, 5.071231e-001, 5.093186e-001, 5.115088e-001, 5.136851e-001, 5.158513e-001, 5.180078e-001, 5.201510e-001,
+5.222894e-001, 5.244101e-001, 5.265269e-001, 5.286250e-001, 5.307168e-001, 5.327941e-001, 5.348628e-001, 5.369216e-001, 5.389689e-001, 5.410090e-001,
+5.430335e-001, 5.450526e-001, 5.470547e-001, 5.490541e-001, 5.510348e-001, 5.530140e-001, 5.549760e-001, 5.569361e-001, 5.588795e-001, 5.608198e-001,
+5.627439e-001, 5.646646e-001, 5.665714e-001, 5.684739e-001, 5.703608e-001, 5.722436e-001, 5.741116e-001, 5.759765e-001, 5.778291e-001, 5.796784e-001,
+5.815119e-001, 5.833427e-001, 5.851540e-001, 5.869636e-001, 5.887479e-001, 5.905322e-001, 5.922917e-001, 5.940505e-001, 5.957904e-001, 5.975276e-001,
+5.992470e-001, 6.009607e-001, 6.026609e-001, 6.043530e-001, 6.060341e-001, 6.077031e-001, 6.093657e-001, 6.110139e-001, 6.126598e-001, 6.142886e-001,
+6.159174e-001, 6.175266e-001, 6.191339e-001, 6.207273e-001, 6.223143e-001, 6.238920e-001, 6.254580e-001, 6.270202e-001, 6.285655e-001, 6.301108e-001,
+6.316359e-001, 6.331589e-001, 6.346689e-001, 6.361703e-001, 6.376655e-001, 6.391451e-001, 6.406247e-001, 6.420868e-001, 6.435479e-001, 6.449993e-001,
+6.464440e-001, 6.478845e-001, 6.493096e-001, 6.507347e-001, 6.521434e-001, 6.535485e-001, 6.549462e-001, 6.563328e-001, 6.577194e-001, 6.590903e-001,
+6.604607e-001, 6.618214e-001, 6.631729e-001, 6.645237e-001, 6.658544e-001, 6.671850e-001, 6.685047e-001, 6.698150e-001, 6.711250e-001, 6.724180e-001,
+6.737111e-001, 6.749945e-001, 6.762676e-001, 6.775407e-001, 6.787930e-001, 6.800436e-001, 6.812877e-001, 6.825190e-001, 6.837503e-001, 6.849685e-001,
+6.861821e-001, 6.873937e-001, 6.885895e-001, 6.897852e-001, 6.909723e-001, 6.921495e-001, 6.933267e-001, 6.944912e-001, 6.956524e-001, 6.968116e-001,
+6.979552e-001, 6.990987e-001, 7.002366e-001, 7.013661e-001, 7.024956e-001, 7.036142e-001, 7.047272e-001, 7.058402e-001, 7.069379e-001, 7.080340e-001,
+7.091283e-001, 7.102094e-001, 7.112904e-001, 7.123653e-001, 7.134272e-001, 7.144890e-001, 7.155439e-001, 7.165916e-001, 7.176394e-001, 7.186780e-001,
+7.197117e-001, 7.207454e-001, 7.217659e-001, 7.227825e-001, 7.237992e-001, 7.248028e-001, 7.258046e-001, 7.268064e-001, 7.277903e-001, 7.287734e-001,
+7.297564e-001, 7.307262e-001, 7.316960e-001, 7.326653e-001, 7.336221e-001, 7.345790e-001, 7.355352e-001, 7.364767e-001, 7.374181e-001, 7.383593e-001,
+7.392876e-001, 7.402159e-001, 7.411443e-001, 7.420564e-001, 7.429682e-001, 7.438799e-001, 7.447810e-001, 7.456810e-001, 7.465809e-001, 7.474709e-001,
+7.483584e-001, 7.492460e-001, 7.501245e-001, 7.509990e-001, 7.518734e-001, 7.527414e-001, 7.536039e-001, 7.544664e-001, 7.553242e-001, 7.561737e-001,
+7.570233e-001, 7.578713e-001, 7.587117e-001, 7.595521e-001, 7.603925e-001, 7.612222e-001, 7.620512e-001, 7.628801e-001, 7.637022e-001, 7.645211e-001,
+7.653401e-001, 7.661546e-001, 7.669629e-001, 7.677712e-001, 7.685786e-001, 7.693775e-001, 7.701764e-001, 7.709753e-001, 7.717691e-001, 7.725614e-001,
+7.733536e-001, 7.741430e-001, 7.749280e-001, 7.757130e-001, 7.764979e-001, 7.772737e-001, 7.780495e-001, 7.788253e-001, 7.795972e-001, 7.803664e-001,
+7.811355e-001, 7.819035e-001, 7.826650e-001, 7.834265e-001, 7.841880e-001, 7.849436e-001, 7.856963e-001, 7.864489e-001, 7.872005e-001, 7.879470e-001,
+7.886935e-001, 7.894401e-001, 7.901812e-001, 7.909191e-001, 7.916571e-001, 7.923948e-001, 7.931283e-001, 7.938618e-001, 7.945952e-001, 7.953254e-001,
+7.960519e-001, 7.967784e-001, 7.975050e-001, 7.982238e-001, 7.989413e-001, 7.996589e-001, 8.003752e-001, 8.010866e-001, 8.017980e-001, 8.025094e-001,
+8.032176e-001, 8.039227e-001, 8.046278e-001, 8.053329e-001, 8.060317e-001, 8.067289e-001, 8.074262e-001, 8.081231e-001, 8.088152e-001, 8.095073e-001,
+8.101994e-001, 8.108898e-001, 8.115760e-001, 8.122623e-001, 8.129485e-001, 8.136305e-001, 8.143079e-001, 8.149853e-001, 8.156628e-001, 8.163372e-001,
+8.170101e-001, 8.176829e-001, 8.183557e-001, 8.190233e-001, 8.196895e-001, 8.203556e-001, 8.210218e-001, 8.216827e-001, 8.223429e-001, 8.230030e-001,
+8.236632e-001, 8.243182e-001, 8.249730e-001, 8.256277e-001, 8.262825e-001, 8.269300e-001, 8.275773e-001, 8.282247e-001, 8.288720e-001, 8.295141e-001,
+8.301561e-001, 8.307981e-001, 8.314401e-001, 8.320764e-001, 8.327124e-001, 8.333483e-001, 8.339843e-001, 8.346143e-001, 8.352434e-001, 8.358725e-001,
+8.365016e-001, 8.371256e-001, 8.377480e-001, 8.383705e-001, 8.389930e-001, 8.396113e-001, 8.402273e-001, 8.408433e-001, 8.414593e-001, 8.420726e-001,
+8.426828e-001, 8.432930e-001, 8.439032e-001, 8.445109e-001, 8.451119e-001, 8.457129e-001, 8.463139e-001, 8.469148e-001, 8.475095e-001, 8.481042e-001,
+8.486989e-001, 8.492936e-001, 8.498833e-001, 8.504715e-001, 8.510596e-001, 8.516477e-001, 8.522318e-001, 8.528108e-001, 8.533899e-001, 8.539690e-001,
+8.545476e-001, 8.551219e-001, 8.556962e-001, 8.562704e-001, 8.568447e-001, 8.574144e-001, 8.579822e-001, 8.585501e-001, 8.591179e-001, 8.596834e-001,
+8.602436e-001, 8.608037e-001, 8.613638e-001, 8.619240e-001, 8.624796e-001, 8.630344e-001, 8.635892e-001, 8.641440e-001, 8.646966e-001, 8.652453e-001,
+8.657941e-001, 8.663428e-001, 8.668915e-001, 8.674352e-001, 8.679779e-001, 8.685207e-001, 8.690634e-001, 8.696043e-001, 8.701402e-001, 8.706761e-001,
+8.712120e-001, 8.717479e-001, 8.722803e-001, 8.728110e-001, 8.733417e-001, 8.738723e-001, 8.744028e-001, 8.749273e-001, 8.754518e-001, 8.759763e-001,
+8.765008e-001, 8.770225e-001, 8.775387e-001, 8.780550e-001, 8.785712e-001, 8.790875e-001, 8.796002e-001, 8.801108e-001, 8.806214e-001, 8.811320e-001,
+8.816426e-001, 8.821475e-001, 8.826515e-001, 8.831555e-001, 8.836596e-001, 8.841630e-001, 8.846591e-001, 8.851552e-001, 8.856513e-001, 8.861474e-001,
+8.866417e-001, 8.871303e-001, 8.876189e-001, 8.881075e-001, 8.885962e-001, 8.890825e-001, 8.895649e-001, 8.900472e-001, 8.905296e-001, 8.910119e-001,
+8.914918e-001, 8.919685e-001, 8.924452e-001, 8.929218e-001, 8.933985e-001, 8.938719e-001, 8.943416e-001, 8.948114e-001, 8.952811e-001, 8.957508e-001,
+8.962174e-001, 8.966804e-001, 8.971435e-001, 8.976066e-001, 8.980696e-001, 8.985311e-001, 8.989905e-001, 8.994498e-001, 8.999092e-001, 9.003686e-001,
+9.008258e-001, 9.012790e-001, 9.017321e-001, 9.021853e-001, 9.026385e-001, 9.030898e-001, 9.035350e-001, 9.039803e-001, 9.044255e-001, 9.048708e-001,
+9.053157e-001, 9.057557e-001, 9.061956e-001, 9.066356e-001, 9.070756e-001, 9.075156e-001, 9.079491e-001, 9.083816e-001, 9.088141e-001, 9.092466e-001,
+9.096791e-001, 9.101070e-001, 9.105320e-001, 9.109569e-001, 9.113819e-001, 9.118068e-001, 9.122299e-001, 9.126487e-001, 9.130674e-001, 9.134862e-001,
+9.139049e-001, 9.143236e-001, 9.147337e-001, 9.151434e-001, 9.155530e-001, 9.159627e-001, 9.163724e-001, 9.167772e-001, 9.171784e-001, 9.175796e-001,
+9.179808e-001, 9.183819e-001, 9.187824e-001, 9.191781e-001, 9.195739e-001, 9.199697e-001, 9.203655e-001, 9.207612e-001, 9.211525e-001, 9.215414e-001,
+9.219304e-001, 9.223194e-001, 9.227083e-001, 9.230963e-001, 9.234783e-001, 9.238604e-001, 9.242424e-001, 9.246245e-001, 9.250065e-001, 9.253851e-001,
+9.257611e-001, 9.261372e-001, 9.265132e-001, 9.268892e-001, 9.272653e-001, 9.276344e-001, 9.280034e-001, 9.283723e-001, 9.287413e-001, 9.291102e-001,
+9.294774e-001, 9.298407e-001, 9.302040e-001, 9.305674e-001, 9.309307e-001, 9.312940e-001, 9.316537e-001, 9.320111e-001, 9.323684e-001, 9.327258e-001,
+9.330831e-001, 9.334405e-001, 9.337913e-001, 9.341410e-001, 9.344906e-001, 9.348403e-001, 9.351899e-001, 9.355393e-001, 9.358833e-001, 9.362273e-001,
+9.365713e-001, 9.369152e-001, 9.372592e-001, 9.376020e-001, 9.379402e-001, 9.382784e-001, 9.386166e-001, 9.389548e-001, 9.392930e-001, 9.396293e-001,
+9.399608e-001, 9.402924e-001, 9.406240e-001, 9.409556e-001, 9.412871e-001, 9.416162e-001, 9.419407e-001, 9.422652e-001, 9.425897e-001, 9.429141e-001,
+9.432386e-001, 9.435609e-001, 9.438794e-001, 9.441978e-001, 9.445162e-001, 9.448347e-001, 9.451531e-001, 9.454690e-001, 9.457793e-001, 9.460895e-001,
+9.463998e-001, 9.467100e-001, 9.470203e-001, 9.473290e-001, 9.476321e-001, 9.479352e-001, 9.482382e-001, 9.485413e-001, 9.488443e-001, 9.491471e-001,
+9.494448e-001, 9.497426e-001, 9.500403e-001, 9.503381e-001, 9.506358e-001, 9.509336e-001, 9.512250e-001, 9.515154e-001, 9.518059e-001, 9.520963e-001,
+9.523867e-001, 9.526771e-001, 9.529634e-001, 9.532472e-001, 9.535309e-001, 9.538146e-001, 9.540983e-001, 9.543820e-001, 9.546642e-001, 9.549429e-001,
+9.552217e-001, 9.555005e-001, 9.557793e-001, 9.560581e-001, 9.563369e-001, 9.566091e-001, 9.568811e-001, 9.571531e-001, 9.574251e-001, 9.576971e-001,
+9.579691e-001, 9.582367e-001, 9.585008e-001, 9.587648e-001, 9.590289e-001, 9.592929e-001, 9.595570e-001, 9.598206e-001, 9.600791e-001, 9.603376e-001,
+9.605961e-001, 9.608545e-001, 9.611130e-001, 9.613715e-001, 9.616270e-001, 9.618802e-001, 9.621335e-001, 9.623867e-001, 9.626400e-001, 9.628932e-001,
+9.631464e-001, 9.633926e-001, 9.636389e-001, 9.638851e-001, 9.641314e-001, 9.643776e-001, 9.646239e-001, 9.648675e-001, 9.651070e-001, 9.653465e-001,
+9.655861e-001, 9.658256e-001, 9.660651e-001, 9.663046e-001, 9.665402e-001, 9.667741e-001, 9.670081e-001, 9.672421e-001, 9.674760e-001, 9.677100e-001,
+9.679439e-001, 9.681722e-001, 9.684003e-001, 9.686284e-001, 9.688565e-001, 9.690846e-001, 9.693127e-001, 9.695394e-001, 9.697601e-001, 9.699808e-001,
+9.702015e-001, 9.704222e-001, 9.706429e-001, 9.708636e-001, 9.710816e-001, 9.712945e-001, 9.715075e-001, 9.717204e-001, 9.719334e-001, 9.721463e-001,
+9.723593e-001, 9.725702e-001, 9.727787e-001, 9.729871e-001, 9.731955e-001, 9.734040e-001, 9.736124e-001, 9.738209e-001, 9.740267e-001, 9.742298e-001,
+9.744328e-001, 9.746359e-001, 9.748390e-001, 9.750420e-001, 9.752451e-001, 9.754453e-001, 9.756422e-001, 9.758391e-001, 9.760360e-001, 9.762329e-001,
+9.764298e-001, 9.766267e-001, 9.768215e-001, 9.770131e-001, 9.772046e-001, 9.773962e-001, 9.775878e-001, 9.777794e-001, 9.779709e-001, 9.781611e-001,
+9.783474e-001, 9.785337e-001, 9.787199e-001, 9.789062e-001, 9.790924e-001, 9.792787e-001, 9.794645e-001, 9.796442e-001, 9.798239e-001, 9.800036e-001,
+9.801833e-001, 9.803630e-001, 9.805427e-001, 9.807224e-001, 9.808963e-001, 9.810688e-001, 9.812414e-001, 9.814139e-001, 9.815865e-001, 9.817590e-001,
+9.819316e-001, 9.821008e-001, 9.822667e-001, 9.824326e-001, 9.825986e-001, 9.827645e-001, 9.829304e-001, 9.830964e-001, 9.832617e-001, 9.834233e-001,
+9.835848e-001, 9.837464e-001, 9.839079e-001, 9.840695e-001, 9.842310e-001, 9.843926e-001, 9.845516e-001, 9.847096e-001, 9.848675e-001, 9.850255e-001,
+9.851834e-001, 9.853413e-001, 9.854993e-001, 9.856563e-001, 9.858093e-001, 9.859624e-001, 9.861154e-001, 9.862685e-001, 9.864215e-001, 9.865746e-001,
+9.867276e-001, 9.868773e-001, 9.870250e-001, 9.871728e-001, 9.873206e-001, 9.874683e-001, 9.876161e-001, 9.877638e-001, 9.879115e-001, 9.880550e-001,
+9.881984e-001, 9.883419e-001, 9.884854e-001, 9.886289e-001, 9.887724e-001, 9.889158e-001, 9.890579e-001, 9.891973e-001, 9.893366e-001, 9.894760e-001,
+9.896153e-001, 9.897547e-001, 9.898940e-001, 9.900334e-001, 9.901698e-001, 9.903043e-001, 9.904388e-001, 9.905733e-001, 9.907078e-001, 9.908423e-001,
+9.909768e-001, 9.911113e-001, 9.912420e-001, 9.913716e-001, 9.915011e-001, 9.916307e-001, 9.917603e-001, 9.918899e-001, 9.920195e-001, 9.921491e-001,
+9.922748e-001, 9.923999e-001, 9.925251e-001, 9.926503e-001, 9.927755e-001, 9.929007e-001, 9.930259e-001, 9.931511e-001, 9.932720e-001, 9.933926e-001,
+9.935133e-001, 9.936340e-001, 9.937547e-001, 9.938753e-001, 9.939960e-001, 9.941167e-001, 9.942330e-001, 9.943491e-001, 9.944653e-001, 9.945814e-001,
+9.946975e-001, 9.948136e-001, 9.949298e-001, 9.950459e-001, 9.951579e-001, 9.952693e-001, 9.953807e-001, 9.954922e-001, 9.956036e-001, 9.957150e-001,
+9.958264e-001, 9.959378e-001, 9.960461e-001, 9.961532e-001, 9.962603e-001, 9.963674e-001, 9.964745e-001, 9.965816e-001, 9.966887e-001, 9.967959e-001,
+9.969006e-001, 9.970031e-001, 9.971057e-001, 9.972082e-001, 9.973108e-001, 9.974134e-001, 9.975159e-001, 9.976185e-001, 9.977199e-001, 9.978177e-001,
+9.979155e-001, 9.980133e-001, 9.981111e-001, 9.982090e-001, 9.983068e-001, 9.984046e-001, 9.985024e-001, 9.985945e-001, 9.986860e-001, 9.987774e-001,
+9.988689e-001, 9.989603e-001, 9.990518e-001, 9.991432e-001, 9.992347e-001, 9.993228e-001, 9.994075e-001, 9.994921e-001, 9.995768e-001, 9.996614e-001,
+9.997461e-001, 9.998307e-001, 9.999154e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.576292e-004, 5.333599e-004, 8.360103e-004, 1.174013e-003, 1.554124e-003, 1.979319e-003, 2.446385e-003, 2.947556e-003, 3.473080e-003,
+4.013871e-003, 4.563927e-003, 5.119163e-003, 5.680190e-003, 6.247994e-003, 6.826391e-003, 7.419537e-003, 8.030724e-003, 8.663383e-003, 9.317868e-003,
+9.994719e-003, 1.069528e-002, 1.141828e-002, 1.216261e-002, 1.292880e-002, 1.371565e-002, 1.452252e-002, 1.534920e-002, 1.619425e-002, 1.705779e-002,
+1.793914e-002, 1.883688e-002, 1.975154e-002, 2.068361e-002, 2.163310e-002, 2.260113e-002, 2.358730e-002, 2.459077e-002, 2.561216e-002, 2.665146e-002,
+2.770842e-002, 2.878220e-002, 2.987258e-002, 3.098035e-002, 3.210537e-002, 3.324510e-002, 3.439897e-002, 3.556782e-002, 3.675078e-002, 3.794555e-002,
+3.915186e-002, 4.036956e-002, 4.159820e-002, 4.283731e-002, 4.408760e-002, 4.534833e-002, 4.661965e-002, 4.790204e-002, 4.919293e-002, 5.049315e-002,
+5.180337e-002, 5.312282e-002, 5.445159e-002, 5.578794e-002, 5.713046e-002, 5.847983e-002, 5.983626e-002, 6.120121e-002, 6.257316e-002, 6.395222e-002,
+6.533704e-002, 6.672865e-002, 6.812720e-002, 6.953176e-002, 7.094333e-002, 7.236031e-002, 7.378291e-002, 7.521076e-002, 7.664451e-002, 7.808340e-002,
+7.952663e-002, 8.097394e-002, 8.242647e-002, 8.388341e-002, 8.534424e-002, 8.680886e-002, 8.827687e-002, 8.974747e-002, 9.122101e-002, 9.269792e-002,
+9.417692e-002, 9.565798e-002, 9.714129e-002, 9.862683e-002, 1.001135e-001, 1.016011e-001, 1.030899e-001, 1.045792e-001, 1.060695e-001, 1.075616e-001,
+1.090552e-001, 1.105502e-001, 1.120469e-001, 1.135446e-001, 1.150436e-001, 1.165441e-001, 1.180454e-001, 1.195472e-001, 1.210499e-001, 1.225533e-001,
+1.240586e-001, 1.255661e-001, 1.270742e-001, 1.285830e-001, 1.300924e-001, 1.316034e-001, 1.331169e-001, 1.346320e-001, 1.361478e-001, 1.376652e-001,
+1.391836e-001, 1.407035e-001, 1.422257e-001, 1.437489e-001, 1.452740e-001, 1.468011e-001, 1.483293e-001, 1.498586e-001, 1.513892e-001, 1.529218e-001,
+1.544555e-001, 1.559904e-001, 1.575259e-001, 1.590621e-001, 1.606001e-001, 1.621384e-001, 1.636777e-001, 1.652178e-001, 1.667584e-001, 1.682991e-001,
+1.698389e-001, 1.713790e-001, 1.729196e-001, 1.744605e-001, 1.760010e-001, 1.775424e-001, 1.790847e-001, 1.806278e-001, 1.821713e-001, 1.837140e-001,
+1.852564e-001, 1.867990e-001, 1.883427e-001, 1.898857e-001, 1.914276e-001, 1.929681e-001, 1.945083e-001, 1.960480e-001, 1.975871e-001, 1.991254e-001,
+2.006641e-001, 2.022033e-001, 2.037440e-001, 2.052842e-001, 2.068234e-001, 2.083609e-001, 2.098990e-001, 2.114374e-001, 2.129762e-001, 2.145155e-001,
+2.160546e-001, 2.175924e-001, 2.191301e-001, 2.206679e-001, 2.222069e-001, 2.237455e-001, 2.252838e-001, 2.268212e-001, 2.283590e-001, 2.298975e-001,
+2.314367e-001, 2.329763e-001, 2.345170e-001, 2.360570e-001, 2.375967e-001, 2.391357e-001, 2.406755e-001, 2.422166e-001, 2.437584e-001, 2.453004e-001,
+2.468426e-001, 2.483848e-001, 2.499270e-001, 2.514703e-001, 2.530144e-001, 2.545600e-001, 2.561057e-001, 2.576514e-001, 2.591978e-001, 2.607449e-001,
+2.622940e-001, 2.638441e-001, 2.653952e-001, 2.669465e-001, 2.684978e-001, 2.700499e-001, 2.716039e-001, 2.731583e-001, 2.747133e-001, 2.762693e-001,
+2.778258e-001, 2.793847e-001, 2.809443e-001, 2.825048e-001, 2.840653e-001, 2.856263e-001, 2.871874e-001, 2.887484e-001, 2.903097e-001, 2.918718e-001,
+2.934342e-001, 2.949969e-001, 2.965593e-001, 2.981210e-001, 2.996826e-001, 3.012440e-001, 3.028059e-001, 3.043687e-001, 3.059312e-001, 3.074933e-001,
+3.090555e-001, 3.106176e-001, 3.121804e-001, 3.137443e-001, 3.153087e-001, 3.168741e-001, 3.184395e-001, 3.200050e-001, 3.215704e-001, 3.231351e-001,
+3.246999e-001, 3.262652e-001, 3.278305e-001, 3.293960e-001, 3.309615e-001, 3.325260e-001, 3.340903e-001, 3.356544e-001, 3.372184e-001, 3.387834e-001,
+3.403492e-001, 3.419149e-001, 3.434805e-001, 3.450458e-001, 3.466094e-001, 3.481730e-001, 3.497355e-001, 3.512979e-001, 3.528621e-001, 3.544271e-001,
+3.559926e-001, 3.575590e-001, 3.591252e-001, 3.606910e-001, 3.622567e-001, 3.638209e-001, 3.653848e-001, 3.669481e-001, 3.685107e-001, 3.700730e-001,
+3.716342e-001, 3.731954e-001, 3.747553e-001, 3.763150e-001, 3.778745e-001, 3.794337e-001, 3.809930e-001, 3.825530e-001, 3.841129e-001, 3.856733e-001,
+3.872339e-001, 3.887941e-001, 3.903536e-001, 3.919130e-001, 3.934706e-001, 3.950278e-001, 3.965846e-001, 3.981403e-001, 3.996961e-001, 4.012507e-001,
+4.028051e-001, 4.043591e-001, 4.059124e-001, 4.074656e-001, 4.090178e-001, 4.105696e-001, 4.121212e-001, 4.136718e-001, 4.152224e-001, 4.167717e-001,
+4.183203e-001, 4.198687e-001, 4.214154e-001, 4.229621e-001, 4.245073e-001, 4.260506e-001, 4.275940e-001, 4.291339e-001, 4.306731e-001, 4.322117e-001,
+4.337471e-001, 4.352825e-001, 4.368156e-001, 4.383459e-001, 4.398763e-001, 4.414024e-001, 4.429270e-001, 4.444515e-001, 4.459707e-001, 4.474898e-001,
+4.490074e-001, 4.505205e-001, 4.520335e-001, 4.535440e-001, 4.550517e-001, 4.565594e-001, 4.580628e-001, 4.595641e-001, 4.610654e-001, 4.625609e-001,
+4.640553e-001, 4.655497e-001, 4.670378e-001, 4.685259e-001, 4.700130e-001, 4.714944e-001, 4.729758e-001, 4.744558e-001, 4.759314e-001, 4.774071e-001,
+4.788806e-001, 4.803498e-001, 4.818191e-001, 4.832854e-001, 4.847474e-001, 4.862093e-001, 4.876681e-001, 4.891225e-001, 4.905770e-001, 4.920284e-001,
+4.934760e-001, 4.949236e-001, 4.963682e-001, 4.978089e-001, 4.992495e-001, 5.006874e-001, 5.021209e-001, 5.035544e-001, 5.049852e-001, 5.064105e-001,
+5.078357e-001, 5.092589e-001, 5.106753e-001, 5.120916e-001, 5.135069e-001, 5.149143e-001, 5.163217e-001, 5.177291e-001, 5.191294e-001, 5.205295e-001,
+5.219296e-001, 5.233250e-001, 5.247194e-001, 5.261137e-001, 5.275032e-001, 5.288895e-001, 5.302759e-001, 5.316587e-001, 5.330362e-001, 5.344136e-001,
+5.357897e-001, 5.371582e-001, 5.385266e-001, 5.398950e-001, 5.412555e-001, 5.426148e-001, 5.439741e-001, 5.453277e-001, 5.466769e-001, 5.480261e-001,
+5.493734e-001, 5.507145e-001, 5.520556e-001, 5.533967e-001, 5.547322e-001, 5.560668e-001, 5.574015e-001, 5.587330e-001, 5.600613e-001, 5.613896e-001,
+5.627174e-001, 5.640394e-001, 5.653615e-001, 5.666835e-001, 5.680016e-001, 5.693175e-001, 5.706333e-001, 5.719478e-001, 5.732557e-001, 5.745636e-001,
+5.758715e-001, 5.771727e-001, 5.784706e-001, 5.797686e-001, 5.810652e-001, 5.823537e-001, 5.836422e-001, 5.849307e-001, 5.862151e-001, 5.874966e-001,
+5.887780e-001, 5.900595e-001, 5.913344e-001, 5.926094e-001, 5.938844e-001, 5.951570e-001, 5.964260e-001, 5.976950e-001, 5.989640e-001, 6.002289e-001,
+6.014925e-001, 6.027561e-001, 6.040193e-001, 6.052780e-001, 6.065367e-001, 6.077953e-001, 6.090512e-001, 6.103022e-001, 6.115531e-001, 6.128041e-001,
+6.140498e-001, 6.152925e-001, 6.165352e-001, 6.177778e-001, 6.190141e-001, 6.202492e-001, 6.214844e-001, 6.227191e-001, 6.239476e-001, 6.251760e-001,
+6.264044e-001, 6.276315e-001, 6.288539e-001, 6.300764e-001, 6.312988e-001, 6.325194e-001, 6.337367e-001, 6.349539e-001, 6.361712e-001, 6.373848e-001,
+6.385943e-001, 6.398037e-001, 6.410131e-001, 6.422181e-001, 6.434194e-001, 6.446207e-001, 6.458219e-001, 6.470191e-001, 6.482132e-001, 6.494073e-001,
+6.506014e-001, 6.517919e-001, 6.529798e-001, 6.541677e-001, 6.553557e-001, 6.565407e-001, 6.577235e-001, 6.589062e-001, 6.600890e-001, 6.612689e-001,
+6.624459e-001, 6.636229e-001, 6.647999e-001, 6.659740e-001, 6.671438e-001, 6.683137e-001, 6.694836e-001, 6.706516e-001, 6.718149e-001, 6.729781e-001,
+6.741414e-001, 6.753040e-001, 6.764619e-001, 6.776198e-001, 6.787777e-001, 6.799355e-001, 6.810882e-001, 6.822404e-001, 6.833926e-001, 6.845448e-001,
+6.856936e-001, 6.868408e-001, 6.879880e-001, 6.891352e-001, 6.902798e-001, 6.914209e-001, 6.925619e-001, 6.937030e-001, 6.948432e-001, 6.959772e-001,
+6.971112e-001, 6.982452e-001, 6.993792e-001, 7.005076e-001, 7.016344e-001, 7.027613e-001, 7.038881e-001, 7.050123e-001, 7.061329e-001, 7.072534e-001,
+7.083739e-001, 7.094944e-001, 7.106081e-001, 7.117217e-001, 7.128354e-001, 7.139491e-001, 7.150587e-001, 7.161651e-001, 7.172715e-001, 7.183778e-001,
+7.194837e-001, 7.205831e-001, 7.216826e-001, 7.227820e-001, 7.238814e-001, 7.249768e-001, 7.260689e-001, 7.271611e-001, 7.282532e-001, 7.293453e-001,
+7.304284e-001, 7.315115e-001, 7.325945e-001, 7.336776e-001, 7.347572e-001, 7.358316e-001, 7.369060e-001, 7.379804e-001, 7.390548e-001, 7.401225e-001,
+7.411880e-001, 7.422536e-001, 7.433191e-001, 7.443836e-001, 7.454380e-001, 7.464923e-001, 7.475467e-001, 7.486011e-001, 7.496516e-001, 7.506958e-001,
+7.517401e-001, 7.527843e-001, 7.538286e-001, 7.548668e-001, 7.559014e-001, 7.569361e-001, 7.579708e-001, 7.590055e-001, 7.600315e-001, 7.610560e-001,
+7.620805e-001, 7.631049e-001, 7.641292e-001, 7.651436e-001, 7.661579e-001, 7.671723e-001, 7.681866e-001, 7.691996e-001, 7.702046e-001, 7.712097e-001,
+7.722148e-001, 7.732198e-001, 7.742218e-001, 7.752139e-001, 7.762061e-001, 7.771982e-001, 7.781904e-001, 7.791786e-001, 7.801573e-001, 7.811361e-001,
+7.821148e-001, 7.830935e-001, 7.840679e-001, 7.850320e-001, 7.859962e-001, 7.869604e-001, 7.879246e-001, 7.888852e-001, 7.898358e-001, 7.907865e-001,
+7.917372e-001, 7.926879e-001, 7.936358e-001, 7.945720e-001, 7.955083e-001, 7.964446e-001, 7.973809e-001, 7.983162e-001, 7.992393e-001, 8.001624e-001,
+8.010856e-001, 8.020087e-001, 8.029319e-001, 8.038424e-001, 8.047517e-001, 8.056610e-001, 8.065704e-001, 8.074797e-001, 8.083794e-001, 8.092753e-001,
+8.101712e-001, 8.110671e-001, 8.119630e-001, 8.128509e-001, 8.137296e-001, 8.146084e-001, 8.154872e-001, 8.163659e-001, 8.172419e-001, 8.181051e-001,
+8.189684e-001, 8.198316e-001, 8.206949e-001, 8.215581e-001, 8.224078e-001, 8.232552e-001, 8.241025e-001, 8.249498e-001, 8.257971e-001, 8.266378e-001,
+8.274710e-001, 8.283042e-001, 8.291374e-001, 8.299707e-001, 8.308032e-001, 8.316221e-001, 8.324410e-001, 8.332600e-001, 8.340789e-001, 8.348979e-001,
+8.357084e-001, 8.365128e-001, 8.373173e-001, 8.381218e-001, 8.389262e-001, 8.397294e-001, 8.405168e-001, 8.413041e-001, 8.420915e-001, 8.428788e-001,
+8.436662e-001, 8.444454e-001, 8.452169e-001, 8.459884e-001, 8.467600e-001, 8.475315e-001, 8.483031e-001, 8.490608e-001, 8.498173e-001, 8.505737e-001,
+8.513301e-001, 8.520866e-001, 8.528389e-001, 8.535797e-001, 8.543204e-001, 8.550612e-001, 8.558019e-001, 8.565427e-001, 8.572752e-001, 8.580013e-001,
+8.587273e-001, 8.594534e-001, 8.601795e-001, 8.609056e-001, 8.616190e-001, 8.623296e-001, 8.630402e-001, 8.637509e-001, 8.644615e-001, 8.651717e-001,
+8.658667e-001, 8.665616e-001, 8.672566e-001, 8.679515e-001, 8.686465e-001, 8.693385e-001, 8.700178e-001, 8.706971e-001, 8.713764e-001, 8.720557e-001,
+8.727350e-001, 8.734096e-001, 8.740734e-001, 8.747371e-001, 8.754009e-001, 8.760647e-001, 8.767284e-001, 8.773869e-001, 8.780362e-001, 8.786854e-001,
+8.793347e-001, 8.799839e-001, 8.806332e-001, 8.812769e-001, 8.819114e-001, 8.825458e-001, 8.831803e-001, 8.838148e-001, 8.844493e-001, 8.850783e-001,
+8.856968e-001, 8.863153e-001, 8.869338e-001, 8.875523e-001, 8.881707e-001, 8.887856e-001, 8.893900e-001, 8.899944e-001, 8.905988e-001, 8.912032e-001,
+8.918076e-001, 8.924103e-001, 8.930001e-001, 8.935900e-001, 8.941798e-001, 8.947697e-001, 8.953595e-001, 8.959493e-001, 8.965261e-001, 8.971018e-001,
+8.976775e-001, 8.982532e-001, 8.988290e-001, 8.994047e-001, 8.999707e-001, 9.005324e-001, 9.010941e-001, 9.016558e-001, 9.022175e-001, 9.027792e-001,
+9.033352e-001, 9.038825e-001, 9.044299e-001, 9.049773e-001, 9.055247e-001, 9.060721e-001, 9.066187e-001, 9.071521e-001, 9.076855e-001, 9.082189e-001,
+9.087523e-001, 9.092857e-001, 9.098191e-001, 9.103448e-001, 9.108664e-001, 9.113881e-001, 9.119098e-001, 9.124315e-001, 9.129532e-001, 9.134721e-001,
+9.139804e-001, 9.144888e-001, 9.149972e-001, 9.155055e-001, 9.160139e-001, 9.165222e-001, 9.170212e-001, 9.175164e-001, 9.180115e-001, 9.185066e-001,
+9.190018e-001, 9.194969e-001, 9.199900e-001, 9.204719e-001, 9.209538e-001, 9.214357e-001, 9.219176e-001, 9.223995e-001, 9.228814e-001, 9.233567e-001,
+9.238265e-001, 9.242962e-001, 9.247659e-001, 9.252357e-001, 9.257054e-001, 9.261752e-001, 9.266351e-001, 9.270937e-001, 9.275522e-001, 9.280108e-001,
+9.284693e-001, 9.289279e-001, 9.293845e-001, 9.298309e-001, 9.302773e-001, 9.307237e-001, 9.311701e-001, 9.316165e-001, 9.320629e-001, 9.325053e-001,
+9.329410e-001, 9.333768e-001, 9.338126e-001, 9.342483e-001, 9.346841e-001, 9.351198e-001, 9.355502e-001, 9.359761e-001, 9.364020e-001, 9.368280e-001,
+9.372539e-001, 9.376798e-001, 9.381058e-001, 9.385252e-001, 9.389412e-001, 9.393572e-001, 9.397732e-001, 9.401893e-001, 9.406053e-001, 9.410213e-001,
+9.414290e-001, 9.418334e-001, 9.422377e-001, 9.426420e-001, 9.430464e-001, 9.434507e-001, 9.438550e-001, 9.442532e-001, 9.446488e-001, 9.450444e-001,
+9.454400e-001, 9.458356e-001, 9.462312e-001, 9.466268e-001, 9.470163e-001, 9.474024e-001, 9.477885e-001, 9.481746e-001, 9.485608e-001, 9.489469e-001,
+9.493330e-001, 9.497143e-001, 9.500910e-001, 9.504678e-001, 9.508446e-001, 9.512214e-001, 9.515982e-001, 9.519749e-001, 9.523479e-001, 9.527138e-001,
+9.530796e-001, 9.534454e-001, 9.538113e-001, 9.541771e-001, 9.545429e-001, 9.549077e-001, 9.552629e-001, 9.556182e-001, 9.559734e-001, 9.563287e-001,
+9.566839e-001, 9.570392e-001, 9.573945e-001, 9.577432e-001, 9.580902e-001, 9.584373e-001, 9.587844e-001, 9.591315e-001, 9.594786e-001, 9.598257e-001,
+9.601700e-001, 9.605106e-001, 9.608513e-001, 9.611920e-001, 9.615327e-001, 9.618733e-001, 9.622140e-001, 9.625545e-001, 9.628877e-001, 9.632208e-001,
+9.635540e-001, 9.638871e-001, 9.642202e-001, 9.645534e-001, 9.648865e-001, 9.652161e-001, 9.655425e-001, 9.658689e-001, 9.661953e-001, 9.665217e-001,
+9.668481e-001, 9.671745e-001, 9.675009e-001, 9.678199e-001, 9.681389e-001, 9.684579e-001, 9.687769e-001, 9.690959e-001, 9.694148e-001, 9.697338e-001,
+9.700503e-001, 9.703627e-001, 9.706752e-001, 9.709876e-001, 9.713000e-001, 9.716125e-001, 9.719249e-001, 9.722373e-001, 9.725446e-001, 9.728497e-001,
+9.731548e-001, 9.734600e-001, 9.737651e-001, 9.740702e-001, 9.743754e-001, 9.746805e-001, 9.749789e-001, 9.752772e-001, 9.755755e-001, 9.758738e-001,
+9.761721e-001, 9.764703e-001, 9.767686e-001, 9.770657e-001, 9.773573e-001, 9.776489e-001, 9.779405e-001, 9.782321e-001, 9.785237e-001, 9.788153e-001,
+9.791069e-001, 9.793964e-001, 9.796814e-001, 9.799663e-001, 9.802513e-001, 9.805363e-001, 9.808213e-001, 9.811063e-001, 9.813912e-001, 9.816735e-001,
+9.819515e-001, 9.822295e-001, 9.825075e-001, 9.827854e-001, 9.830634e-001, 9.833414e-001, 9.836194e-001, 9.838947e-001, 9.841658e-001, 9.844368e-001,
+9.847079e-001, 9.849790e-001, 9.852501e-001, 9.855212e-001, 9.857922e-001, 9.860611e-001, 9.863254e-001, 9.865897e-001, 9.868540e-001, 9.871183e-001,
+9.873827e-001, 9.876470e-001, 9.879113e-001, 9.881742e-001, 9.884314e-001, 9.886886e-001, 9.889458e-001, 9.892030e-001, 9.894602e-001, 9.897174e-001,
+9.899746e-001, 9.902317e-001, 9.904809e-001, 9.907300e-001, 9.909792e-001, 9.912283e-001, 9.914775e-001, 9.917267e-001, 9.919758e-001, 9.922250e-001,
+9.924687e-001, 9.927105e-001, 9.929522e-001, 9.931940e-001, 9.934358e-001, 9.936776e-001, 9.939194e-001, 9.941612e-001, 9.943996e-001, 9.946331e-001,
+9.948667e-001, 9.951003e-001, 9.953339e-001, 9.955674e-001, 9.958010e-001, 9.960346e-001, 9.962680e-001, 9.964916e-001, 9.967152e-001, 9.969389e-001,
+9.971625e-001, 9.973861e-001, 9.976097e-001, 9.978333e-001, 9.980569e-001, 9.982761e-001, 9.984916e-001, 9.987071e-001, 9.989226e-001, 9.991381e-001,
+9.993535e-001, 9.995690e-001, 9.997845e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.585101e-004, 1.160455e-003, 1.832391e-003, 2.579915e-003, 3.387723e-003, 4.250591e-003, 5.180587e-003, 6.199937e-003, 7.325649e-003,
+8.563333e-003, 9.910666e-003, 1.135914e-002, 1.290202e-002, 1.453612e-002, 1.625819e-002, 1.805977e-002, 1.993360e-002, 2.186898e-002, 2.385738e-002,
+2.589266e-002, 2.797225e-002, 3.009746e-002, 3.226766e-002, 3.448660e-002, 3.676201e-002, 3.909813e-002, 4.149605e-002, 4.396623e-002, 4.651243e-002,
+4.913129e-002, 5.182584e-002, 5.459288e-002, 5.742166e-002, 6.030500e-002, 6.323091e-002, 6.618245e-002, 6.915147e-002, 7.213085e-002, 7.510679e-002,
+7.806983e-002, 8.101271e-002, 8.393870e-002, 8.684894e-002, 8.973427e-002, 9.259567e-002, 9.544375e-002, 9.827647e-002, 1.010929e-001, 1.038966e-001,
+1.066885e-001, 1.094719e-001, 1.122470e-001, 1.150158e-001, 1.177795e-001, 1.205397e-001, 1.232987e-001, 1.260581e-001, 1.288186e-001, 1.315810e-001,
+1.343458e-001, 1.371128e-001, 1.398843e-001, 1.426624e-001, 1.454473e-001, 1.482388e-001, 1.510369e-001, 1.538417e-001, 1.566565e-001, 1.594797e-001,
+1.623144e-001, 1.651575e-001, 1.680109e-001, 1.708731e-001, 1.737474e-001, 1.766321e-001, 1.795291e-001, 1.824384e-001, 1.853631e-001, 1.883014e-001,
+1.912554e-001, 1.942231e-001, 1.972044e-001, 2.002002e-001, 2.032063e-001, 2.062258e-001, 2.092571e-001, 2.122993e-001, 2.153486e-001, 2.184023e-001,
+2.214572e-001, 2.245126e-001, 2.275669e-001, 2.306148e-001, 2.336524e-001, 2.366762e-001, 2.396847e-001, 2.426740e-001, 2.456423e-001, 2.485860e-001,
+2.515047e-001, 2.543984e-001, 2.572654e-001, 2.601054e-001, 2.629188e-001, 2.657041e-001, 2.684626e-001, 2.711947e-001, 2.738989e-001, 2.765769e-001,
+2.792299e-001, 2.818577e-001, 2.844642e-001, 2.870490e-001, 2.896149e-001, 2.921622e-001, 2.946906e-001, 2.972029e-001, 2.996974e-001, 3.021731e-001,
+3.046326e-001, 3.070755e-001, 3.095064e-001, 3.119274e-001, 3.143394e-001, 3.167424e-001, 3.191360e-001, 3.215201e-001, 3.238948e-001, 3.262607e-001,
+3.286187e-001, 3.309695e-001, 3.333118e-001, 3.356468e-001, 3.379753e-001, 3.402976e-001, 3.426141e-001, 3.449253e-001, 3.472314e-001, 3.495286e-001,
+3.518163e-001, 3.540945e-001, 3.563636e-001, 3.586244e-001, 3.608760e-001, 3.631196e-001, 3.653568e-001, 3.675884e-001, 3.698144e-001, 3.720313e-001,
+3.742408e-001, 3.764428e-001, 3.786371e-001, 3.808222e-001, 3.829993e-001, 3.851706e-001, 3.873368e-001, 3.894971e-001, 3.916528e-001, 3.938056e-001,
+3.959556e-001, 3.981000e-001, 4.002406e-001, 4.023783e-001, 4.045134e-001, 4.066438e-001, 4.087715e-001, 4.108967e-001, 4.130182e-001, 4.151367e-001,
+4.172527e-001, 4.193655e-001, 4.214770e-001, 4.235876e-001, 4.256979e-001, 4.278069e-001, 4.299151e-001, 4.320223e-001, 4.341273e-001, 4.362305e-001,
+4.383284e-001, 4.404241e-001, 4.425180e-001, 4.446097e-001, 4.467012e-001, 4.487925e-001, 4.508842e-001, 4.529756e-001, 4.550662e-001, 4.571552e-001,
+4.592432e-001, 4.613265e-001, 4.634083e-001, 4.654878e-001, 4.675660e-001, 4.696436e-001, 4.717212e-001, 4.737992e-001, 4.758778e-001, 4.779537e-001,
+4.800283e-001, 4.820937e-001, 4.841566e-001, 4.862132e-001, 4.882663e-001, 4.903163e-001, 4.923604e-001, 4.944028e-001, 4.964390e-001, 4.984741e-001,
+5.005058e-001, 5.025345e-001, 5.045596e-001, 5.065775e-001, 5.085913e-001, 5.105963e-001, 5.125993e-001, 5.145885e-001, 5.165753e-001, 5.185479e-001,
+5.205166e-001, 5.224739e-001, 5.244258e-001, 5.263681e-001, 5.283024e-001, 5.302276e-001, 5.321443e-001, 5.340541e-001, 5.359539e-001, 5.378477e-001,
+5.397274e-001, 5.416002e-001, 5.434592e-001, 5.453127e-001, 5.471492e-001, 5.489794e-001, 5.507919e-001, 5.525978e-001, 5.543872e-001, 5.561701e-001,
+5.579362e-001, 5.596947e-001, 5.614393e-001, 5.631761e-001, 5.649012e-001, 5.666179e-001, 5.683241e-001, 5.700199e-001, 5.717072e-001, 5.733818e-001,
+5.750491e-001, 5.766983e-001, 5.783440e-001, 5.799702e-001, 5.815963e-001, 5.831990e-001, 5.848018e-001, 5.863847e-001, 5.879638e-001, 5.895281e-001,
+5.910843e-001, 5.926306e-001, 5.941642e-001, 5.956931e-001, 5.972054e-001, 5.987178e-001, 6.002131e-001, 6.017081e-001, 6.031908e-001, 6.046688e-001,
+6.061379e-001, 6.075956e-001, 6.090502e-001, 6.104861e-001, 6.119219e-001, 6.133409e-001, 6.147564e-001, 6.161623e-001, 6.175583e-001, 6.189520e-001,
+6.203304e-001, 6.217089e-001, 6.230769e-001, 6.244417e-001, 6.258000e-001, 6.271471e-001, 6.284943e-001, 6.298247e-001, 6.311543e-001, 6.324747e-001,
+6.337866e-001, 6.350975e-001, 6.363948e-001, 6.376920e-001, 6.389808e-001, 6.402636e-001, 6.415453e-001, 6.428160e-001, 6.440867e-001, 6.453511e-001,
+6.466107e-001, 6.478699e-001, 6.491171e-001, 6.503642e-001, 6.516051e-001, 6.528393e-001, 6.540735e-001, 6.552977e-001, 6.565207e-001, 6.577410e-001,
+6.589548e-001, 6.601686e-001, 6.613742e-001, 6.625760e-001, 6.637776e-001, 6.649710e-001, 6.661644e-001, 6.673537e-001, 6.685359e-001, 6.697182e-001,
+6.708937e-001, 6.720661e-001, 6.732385e-001, 6.744014e-001, 6.755639e-001, 6.767244e-001, 6.778781e-001, 6.790319e-001, 6.801805e-001, 6.813233e-001,
+6.824662e-001, 6.836034e-001, 6.847383e-001, 6.858731e-001, 6.869966e-001, 6.881188e-001, 6.892404e-001, 6.903538e-001, 6.914672e-001, 6.925780e-001,
+6.936802e-001, 6.947824e-001, 6.958813e-001, 6.969740e-001, 6.980667e-001, 6.991551e-001, 7.002386e-001, 7.013221e-001, 7.024013e-001, 7.034770e-001,
+7.045526e-001, 7.056221e-001, 7.066874e-001, 7.077527e-001, 7.088125e-001, 7.098689e-001, 7.109253e-001, 7.119750e-001, 7.130207e-001, 7.140665e-001,
+7.151081e-001, 7.161473e-001, 7.171864e-001, 7.182206e-001, 7.192510e-001, 7.202814e-001, 7.213070e-001, 7.223277e-001, 7.233484e-001, 7.243651e-001,
+7.253757e-001, 7.263864e-001, 7.273940e-001, 7.283943e-001, 7.293945e-001, 7.303934e-001, 7.313838e-001, 7.323742e-001, 7.333646e-001, 7.343452e-001,
+7.353254e-001, 7.363057e-001, 7.372794e-001, 7.382512e-001, 7.392229e-001, 7.401891e-001, 7.411507e-001, 7.421123e-001, 7.430707e-001, 7.440215e-001,
+7.449724e-001, 7.459230e-001, 7.468630e-001, 7.478029e-001, 7.487429e-001, 7.496752e-001, 7.506043e-001, 7.515335e-001, 7.524588e-001, 7.533780e-001,
+7.542971e-001, 7.552161e-001, 7.561245e-001, 7.570330e-001, 7.579414e-001, 7.588420e-001, 7.597381e-001, 7.606341e-001, 7.615278e-001, 7.624131e-001,
+7.632984e-001, 7.641837e-001, 7.650599e-001, 7.659334e-001, 7.668068e-001, 7.676775e-001, 7.685416e-001, 7.694056e-001, 7.702697e-001, 7.711244e-001,
+7.719767e-001, 7.728291e-001, 7.736784e-001, 7.745192e-001, 7.753601e-001, 7.762010e-001, 7.770338e-001, 7.778633e-001, 7.786927e-001, 7.795210e-001,
+7.803398e-001, 7.811587e-001, 7.819776e-001, 7.827903e-001, 7.835966e-001, 7.844029e-001, 7.852092e-001, 7.860054e-001, 7.867997e-001, 7.875940e-001,
+7.883868e-001, 7.891717e-001, 7.899566e-001, 7.907415e-001, 7.915207e-001, 7.922931e-001, 7.930656e-001, 7.938380e-001, 7.946025e-001, 7.953638e-001,
+7.961250e-001, 7.968863e-001, 7.976367e-001, 7.983864e-001, 7.991361e-001, 7.998843e-001, 8.006227e-001, 8.013610e-001, 8.020994e-001, 8.028340e-001,
+8.035594e-001, 8.042848e-001, 8.050102e-001, 8.057313e-001, 8.064466e-001, 8.071619e-001, 8.078772e-001, 8.085857e-001, 8.092882e-001, 8.099907e-001,
+8.106932e-001, 8.113890e-001, 8.120804e-001, 8.127717e-001, 8.134630e-001, 8.141471e-001, 8.148271e-001, 8.155071e-001, 8.161871e-001, 8.168602e-001,
+8.175294e-001, 8.181986e-001, 8.188679e-001, 8.195297e-001, 8.201869e-001, 8.208440e-001, 8.215012e-001, 8.221534e-001, 8.228015e-001, 8.234496e-001,
+8.240977e-001, 8.247407e-001, 8.253773e-001, 8.260140e-001, 8.266506e-001, 8.272843e-001, 8.279115e-001, 8.285386e-001, 8.291658e-001, 8.297916e-001,
+8.304093e-001, 8.310270e-001, 8.316446e-001, 8.322623e-001, 8.328718e-001, 8.334809e-001, 8.340899e-001, 8.346989e-001, 8.353011e-001, 8.359006e-001,
+8.365000e-001, 8.370994e-001, 8.376960e-001, 8.382890e-001, 8.388819e-001, 8.394749e-001, 8.400666e-001, 8.406504e-001, 8.412342e-001, 8.418179e-001,
+8.424017e-001, 8.429775e-001, 8.435511e-001, 8.441247e-001, 8.446984e-001, 8.452690e-001, 8.458353e-001, 8.464016e-001, 8.469679e-001, 8.475341e-001,
+8.480934e-001, 8.486527e-001, 8.492120e-001, 8.497712e-001, 8.503255e-001, 8.508758e-001, 8.514261e-001, 8.519763e-001, 8.525259e-001, 8.530646e-001,
+8.536034e-001, 8.541422e-001, 8.546810e-001, 8.552161e-001, 8.557480e-001, 8.562799e-001, 8.568119e-001, 8.573438e-001, 8.578673e-001, 8.583906e-001,
+8.589140e-001, 8.594373e-001, 8.599571e-001, 8.604711e-001, 8.609851e-001, 8.614991e-001, 8.620131e-001, 8.625209e-001, 8.630264e-001, 8.635319e-001,
+8.640374e-001, 8.645426e-001, 8.650418e-001, 8.655411e-001, 8.660403e-001, 8.665395e-001, 8.670363e-001, 8.675284e-001, 8.680204e-001, 8.685125e-001,
+8.690046e-001, 8.694908e-001, 8.699729e-001, 8.704550e-001, 8.709372e-001, 8.714193e-001, 8.718963e-001, 8.723720e-001, 8.728476e-001, 8.733233e-001,
+8.737990e-001, 8.742687e-001, 8.747382e-001, 8.752077e-001, 8.756773e-001, 8.761462e-001, 8.766090e-001, 8.770719e-001, 8.775347e-001, 8.779976e-001,
+8.784591e-001, 8.789140e-001, 8.793689e-001, 8.798238e-001, 8.802787e-001, 8.807322e-001, 8.811805e-001, 8.816288e-001, 8.820771e-001, 8.825255e-001,
+8.829725e-001, 8.834150e-001, 8.838575e-001, 8.843001e-001, 8.847426e-001, 8.851839e-001, 8.856200e-001, 8.860560e-001, 8.864921e-001, 8.869281e-001,
+8.873634e-001, 8.877922e-001, 8.882209e-001, 8.886497e-001, 8.890784e-001, 8.895071e-001, 8.899302e-001, 8.903532e-001, 8.907762e-001, 8.911991e-001,
+8.916221e-001, 8.920408e-001, 8.924585e-001, 8.928763e-001, 8.932940e-001, 8.937117e-001, 8.941258e-001, 8.945375e-001, 8.949492e-001, 8.953608e-001,
+8.957725e-001, 8.961813e-001, 8.965847e-001, 8.969882e-001, 8.973916e-001, 8.977950e-001, 8.981982e-001, 8.985966e-001, 8.989951e-001, 8.993936e-001,
+8.997920e-001, 9.001905e-001, 9.005856e-001, 9.009795e-001, 9.013734e-001, 9.017672e-001, 9.021611e-001, 9.025527e-001, 9.029398e-001, 9.033269e-001,
+9.037140e-001, 9.041011e-001, 9.044882e-001, 9.048687e-001, 9.052486e-001, 9.056286e-001, 9.060085e-001, 9.063884e-001, 9.067658e-001, 9.071399e-001,
+9.075141e-001, 9.078882e-001, 9.082624e-001, 9.086365e-001, 9.090055e-001, 9.093741e-001, 9.097427e-001, 9.101112e-001, 9.104798e-001, 9.108464e-001,
+9.112095e-001, 9.115726e-001, 9.119357e-001, 9.122989e-001, 9.126620e-001, 9.130206e-001, 9.133777e-001, 9.137349e-001, 9.140920e-001, 9.144491e-001,
+9.148055e-001, 9.151548e-001, 9.155041e-001, 9.158534e-001, 9.162026e-001, 9.165519e-001, 9.168994e-001, 9.172442e-001, 9.175890e-001, 9.179338e-001,
+9.182785e-001, 9.186233e-001, 9.189656e-001, 9.193064e-001, 9.196472e-001, 9.199881e-001, 9.203289e-001, 9.206698e-001, 9.210057e-001, 9.213408e-001,
+9.216758e-001, 9.220109e-001, 9.223459e-001, 9.226810e-001, 9.230101e-001, 9.233392e-001, 9.236684e-001, 9.239975e-001, 9.243266e-001, 9.246553e-001,
+9.249799e-001, 9.253046e-001, 9.256293e-001, 9.259539e-001, 9.262786e-001, 9.266026e-001, 9.269233e-001, 9.272439e-001, 9.275646e-001, 9.278852e-001,
+9.282059e-001, 9.285259e-001, 9.288429e-001, 9.291599e-001, 9.294769e-001, 9.297939e-001, 9.301109e-001, 9.304274e-001, 9.307404e-001, 9.310533e-001,
+9.313663e-001, 9.316793e-001, 9.319923e-001, 9.323050e-001, 9.326119e-001, 9.329188e-001, 9.332257e-001, 9.335325e-001, 9.338394e-001, 9.341463e-001,
+9.344498e-001, 9.347529e-001, 9.350560e-001, 9.353591e-001, 9.356622e-001, 9.359653e-001, 9.362673e-001, 9.365688e-001, 9.368703e-001, 9.371719e-001,
+9.374734e-001, 9.377749e-001, 9.380748e-001, 9.383727e-001, 9.386706e-001, 9.389685e-001, 9.392664e-001, 9.395643e-001, 9.398614e-001, 9.401536e-001,
+9.404458e-001, 9.407381e-001, 9.410303e-001, 9.413226e-001, 9.416148e-001, 9.419017e-001, 9.421873e-001, 9.424729e-001, 9.427586e-001, 9.430442e-001,
+9.433298e-001, 9.436146e-001, 9.438981e-001, 9.441817e-001, 9.444652e-001, 9.447487e-001, 9.450323e-001, 9.453158e-001, 9.455965e-001, 9.458770e-001,
+9.461575e-001, 9.464380e-001, 9.467185e-001, 9.469990e-001, 9.472776e-001, 9.475535e-001, 9.478294e-001, 9.481053e-001, 9.483813e-001, 9.486572e-001,
+9.489331e-001, 9.492051e-001, 9.494765e-001, 9.497480e-001, 9.500194e-001, 9.502908e-001, 9.505622e-001, 9.508329e-001, 9.511013e-001, 9.513697e-001,
+9.516382e-001, 9.519066e-001, 9.521750e-001, 9.524434e-001, 9.527102e-001, 9.529757e-001, 9.532412e-001, 9.535068e-001, 9.537723e-001, 9.540378e-001,
+9.543034e-001, 9.545660e-001, 9.548282e-001, 9.550904e-001, 9.553526e-001, 9.556147e-001, 9.558769e-001, 9.561389e-001, 9.563991e-001, 9.566592e-001,
+9.569193e-001, 9.571794e-001, 9.574395e-001, 9.576996e-001, 9.579588e-001, 9.582151e-001, 9.584714e-001, 9.587278e-001, 9.589841e-001, 9.592404e-001,
+9.594967e-001, 9.597517e-001, 9.600040e-001, 9.602564e-001, 9.605087e-001, 9.607610e-001, 9.610134e-001, 9.612657e-001, 9.615170e-001, 9.617665e-001,
+9.620160e-001, 9.622654e-001, 9.625149e-001, 9.627644e-001, 9.630139e-001, 9.632629e-001, 9.635113e-001, 9.637596e-001, 9.640080e-001, 9.642563e-001,
+9.645047e-001, 9.647530e-001, 9.650006e-001, 9.652461e-001, 9.654916e-001, 9.657371e-001, 9.659826e-001, 9.662281e-001, 9.664736e-001, 9.667182e-001,
+9.669580e-001, 9.671978e-001, 9.674377e-001, 9.676775e-001, 9.679173e-001, 9.681571e-001, 9.683969e-001, 9.686304e-001, 9.688637e-001, 9.690970e-001,
+9.693303e-001, 9.695636e-001, 9.697969e-001, 9.700302e-001, 9.702622e-001, 9.704936e-001, 9.707251e-001, 9.709565e-001, 9.711880e-001, 9.714194e-001,
+9.716509e-001, 9.718814e-001, 9.721107e-001, 9.723400e-001, 9.725693e-001, 9.727986e-001, 9.730279e-001, 9.732572e-001, 9.734864e-001, 9.737125e-001,
+9.739386e-001, 9.741647e-001, 9.743908e-001, 9.746169e-001, 9.748430e-001, 9.750691e-001, 9.752932e-001, 9.755161e-001, 9.757389e-001, 9.759618e-001,
+9.761847e-001, 9.764076e-001, 9.766304e-001, 9.768531e-001, 9.770743e-001, 9.772955e-001, 9.775168e-001, 9.777380e-001, 9.779592e-001, 9.781805e-001,
+9.784017e-001, 9.786214e-001, 9.788400e-001, 9.790586e-001, 9.792771e-001, 9.794957e-001, 9.797143e-001, 9.799329e-001, 9.801514e-001, 9.803667e-001,
+9.805818e-001, 9.807969e-001, 9.810120e-001, 9.812271e-001, 9.814422e-001, 9.816573e-001, 9.818714e-001, 9.820829e-001, 9.822943e-001, 9.825058e-001,
+9.827172e-001, 9.829287e-001, 9.831401e-001, 9.833516e-001, 9.835613e-001, 9.837696e-001, 9.839779e-001, 9.841862e-001, 9.843945e-001, 9.846028e-001,
+9.848111e-001, 9.850194e-001, 9.852252e-001, 9.854300e-001, 9.856348e-001, 9.858396e-001, 9.860445e-001, 9.862493e-001, 9.864541e-001, 9.866589e-001,
+9.868602e-001, 9.870608e-001, 9.872614e-001, 9.874620e-001, 9.876627e-001, 9.878633e-001, 9.880639e-001, 9.882645e-001, 9.884613e-001, 9.886577e-001,
+9.888541e-001, 9.890506e-001, 9.892470e-001, 9.894434e-001, 9.896398e-001, 9.898362e-001, 9.900294e-001, 9.902222e-001, 9.904150e-001, 9.906079e-001,
+9.908007e-001, 9.909935e-001, 9.911864e-001, 9.913792e-001, 9.915676e-001, 9.917552e-001, 9.919428e-001, 9.921304e-001, 9.923180e-001, 9.925056e-001,
+9.926932e-001, 9.928808e-001, 9.930642e-001, 9.932457e-001, 9.934273e-001, 9.936088e-001, 9.937903e-001, 9.939719e-001, 9.941534e-001, 9.943350e-001,
+9.945137e-001, 9.946896e-001, 9.948655e-001, 9.950414e-001, 9.952173e-001, 9.953931e-001, 9.955690e-001, 9.957449e-001, 9.959198e-001, 9.960914e-001,
+9.962631e-001, 9.964347e-001, 9.966063e-001, 9.967779e-001, 9.969495e-001, 9.971211e-001, 9.972927e-001, 9.974583e-001, 9.976231e-001, 9.977879e-001,
+9.979527e-001, 9.981175e-001, 9.982822e-001, 9.984470e-001, 9.986118e-001, 9.987712e-001, 9.989248e-001, 9.990784e-001, 9.992320e-001, 9.993856e-001,
+9.995392e-001, 9.996928e-001, 9.998464e-001, 1.000000e+000)),
+("Agfa", "Agfachrome RSX2 200", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.336452e-004, 4.746285e-004, 7.228691e-004, 9.798091e-004, 1.245891e-003, 1.521525e-003, 1.807448e-003, 2.104474e-003, 2.412372e-003,
+2.731643e-003, 3.062876e-003, 3.406846e-003, 3.763182e-003, 4.131931e-003, 4.513374e-003, 4.907914e-003, 5.314926e-003, 5.735160e-003, 6.168186e-003,
+6.613938e-003, 7.073028e-003, 7.545758e-003, 8.031872e-003, 8.530723e-003, 9.042606e-003, 9.567876e-003, 1.010603e-002, 1.065660e-002, 1.121964e-002,
+1.179510e-002, 1.238306e-002, 1.298280e-002, 1.359386e-002, 1.421630e-002, 1.485052e-002, 1.549600e-002, 1.615259e-002, 1.681971e-002, 1.749756e-002,
+1.818588e-002, 1.888533e-002, 1.959572e-002, 2.031670e-002, 2.104794e-002, 2.178939e-002, 2.254108e-002, 2.330311e-002, 2.407528e-002, 2.485745e-002,
+2.564898e-002, 2.645053e-002, 2.726137e-002, 2.808193e-002, 2.891161e-002, 2.975068e-002, 3.059879e-002, 3.145619e-002, 3.232305e-002, 3.319849e-002,
+3.408288e-002, 3.497643e-002, 3.587873e-002, 3.679006e-002, 3.771067e-002, 3.863877e-002, 3.957605e-002, 4.052128e-002, 4.147497e-002, 4.243715e-002,
+4.340692e-002, 4.438480e-002, 4.537072e-002, 4.636340e-002, 4.736545e-002, 4.837372e-002, 4.938973e-002, 5.041291e-002, 5.144237e-002, 5.248030e-002,
+5.352545e-002, 5.457729e-002, 5.563618e-002, 5.670250e-002, 5.777508e-002, 5.885358e-002, 5.994004e-002, 6.103318e-002, 6.213257e-002, 6.323962e-002,
+6.435349e-002, 6.547458e-002, 6.660321e-002, 6.773863e-002, 6.888090e-002, 7.003040e-002, 7.118642e-002, 7.234883e-002, 7.351963e-002, 7.469750e-002,
+7.588227e-002, 7.707417e-002, 7.827305e-002, 7.947895e-002, 8.069138e-002, 8.191042e-002, 8.313657e-002, 8.437022e-002, 8.561131e-002, 8.685991e-002,
+8.811589e-002, 8.937879e-002, 9.064862e-002, 9.192531e-002, 9.320838e-002, 9.449805e-002, 9.579524e-002, 9.709963e-002, 9.841000e-002, 9.972722e-002,
+1.010518e-001, 1.023815e-001, 1.037182e-001, 1.050620e-001, 1.064110e-001, 1.077655e-001, 1.091264e-001, 1.104935e-001, 1.118659e-001, 1.132437e-001,
+1.146290e-001, 1.160207e-001, 1.174174e-001, 1.188201e-001, 1.202287e-001, 1.216426e-001, 1.230618e-001, 1.244878e-001, 1.259192e-001, 1.273558e-001,
+1.287976e-001, 1.302458e-001, 1.317004e-001, 1.331606e-001, 1.346260e-001, 1.360958e-001, 1.375722e-001, 1.390544e-001, 1.405413e-001, 1.420325e-001,
+1.435298e-001, 1.450331e-001, 1.465408e-001, 1.480525e-001, 1.495707e-001, 1.510938e-001, 1.526214e-001, 1.541542e-001, 1.556929e-001, 1.572360e-001,
+1.587836e-001, 1.603382e-001, 1.618964e-001, 1.634582e-001, 1.650261e-001, 1.665999e-001, 1.681773e-001, 1.697591e-001, 1.713462e-001, 1.729368e-001,
+1.745319e-001, 1.761320e-001, 1.777353e-001, 1.793437e-001, 1.809576e-001, 1.825744e-001, 1.841952e-001, 1.858201e-001, 1.874478e-001, 1.890821e-001,
+1.907190e-001, 1.923579e-001, 1.940029e-001, 1.956506e-001, 1.973027e-001, 1.989585e-001, 2.006161e-001, 2.022790e-001, 2.039446e-001, 2.056135e-001,
+2.072867e-001, 2.089618e-001, 2.106418e-001, 2.123246e-001, 2.140112e-001, 2.157006e-001, 2.173912e-001, 2.190875e-001, 2.207852e-001, 2.224867e-001,
+2.241905e-001, 2.258962e-001, 2.276054e-001, 2.293157e-001, 2.310317e-001, 2.327484e-001, 2.344674e-001, 2.361884e-001, 2.379123e-001, 2.396382e-001,
+2.413653e-001, 2.430955e-001, 2.448267e-001, 2.465613e-001, 2.482965e-001, 2.500359e-001, 2.517758e-001, 2.535183e-001, 2.552622e-001, 2.570099e-001,
+2.587590e-001, 2.605103e-001, 2.622631e-001, 2.640174e-001, 2.657731e-001, 2.675299e-001, 2.692880e-001, 2.710471e-001, 2.728082e-001, 2.745707e-001,
+2.763351e-001, 2.781008e-001, 2.798673e-001, 2.816343e-001, 2.834018e-001, 2.851698e-001, 2.869389e-001, 2.887092e-001, 2.904804e-001, 2.922525e-001,
+2.940254e-001, 2.957995e-001, 2.975737e-001, 2.993480e-001, 3.011222e-001, 3.028964e-001, 3.046707e-001, 3.064466e-001, 3.082225e-001, 3.099983e-001,
+3.117742e-001, 3.135501e-001, 3.153259e-001, 3.171016e-001, 3.188770e-001, 3.206519e-001, 3.224261e-001, 3.241998e-001, 3.259718e-001, 3.277439e-001,
+3.295131e-001, 3.312823e-001, 3.330504e-001, 3.348180e-001, 3.365844e-001, 3.383489e-001, 3.401132e-001, 3.418753e-001, 3.436373e-001, 3.453963e-001,
+3.471545e-001, 3.489104e-001, 3.506639e-001, 3.524167e-001, 3.541651e-001, 3.559136e-001, 3.576561e-001, 3.593969e-001, 3.611347e-001, 3.628677e-001,
+3.646007e-001, 3.663268e-001, 3.680529e-001, 3.697755e-001, 3.714955e-001, 3.732145e-001, 3.749260e-001, 3.766376e-001, 3.783438e-001, 3.800471e-001,
+3.817487e-001, 3.834415e-001, 3.851344e-001, 3.868206e-001, 3.885033e-001, 3.901846e-001, 3.918553e-001, 3.935259e-001, 3.951900e-001, 3.968491e-001,
+3.985082e-001, 4.001541e-001, 4.017999e-001, 4.034417e-001, 4.050775e-001, 4.067132e-001, 4.083410e-001, 4.099667e-001, 4.115909e-001, 4.132077e-001,
+4.148244e-001, 4.164359e-001, 4.180422e-001, 4.196485e-001, 4.212471e-001, 4.228440e-001, 4.244396e-001, 4.260254e-001, 4.276112e-001, 4.291928e-001,
+4.307680e-001, 4.323433e-001, 4.339113e-001, 4.354756e-001, 4.370399e-001, 4.385951e-001, 4.401491e-001, 4.417022e-001, 4.432458e-001, 4.447894e-001,
+4.463304e-001, 4.478641e-001, 4.493979e-001, 4.509268e-001, 4.524493e-001, 4.539718e-001, 4.554879e-001, 4.569991e-001, 4.585104e-001, 4.600146e-001,
+4.615157e-001, 4.630168e-001, 4.645102e-001, 4.660014e-001, 4.674926e-001, 4.689763e-001, 4.704585e-001, 4.719408e-001, 4.734141e-001, 4.748863e-001,
+4.763585e-001, 4.778222e-001, 4.792849e-001, 4.807476e-001, 4.822028e-001, 4.836570e-001, 4.851113e-001, 4.865578e-001, 4.880031e-001, 4.894484e-001,
+4.908878e-001, 4.923257e-001, 4.937637e-001, 4.951958e-001, 4.966256e-001, 4.980555e-001, 4.994794e-001, 5.008996e-001, 5.023198e-001, 5.037352e-001,
+5.051453e-001, 5.065555e-001, 5.079630e-001, 5.093650e-001, 5.107669e-001, 5.121679e-001, 5.135624e-001, 5.149569e-001, 5.163514e-001, 5.177389e-001,
+5.191257e-001, 5.205125e-001, 5.218952e-001, 5.232759e-001, 5.246566e-001, 5.260347e-001, 5.274088e-001, 5.287830e-001, 5.301563e-001, 5.315235e-001,
+5.328906e-001, 5.342578e-001, 5.356180e-001, 5.369765e-001, 5.383349e-001, 5.396882e-001, 5.410351e-001, 5.423819e-001, 5.437279e-001, 5.450633e-001,
+5.463986e-001, 5.477339e-001, 5.490639e-001, 5.503912e-001, 5.517184e-001, 5.530438e-001, 5.543630e-001, 5.556822e-001, 5.570014e-001, 5.583145e-001,
+5.596257e-001, 5.609369e-001, 5.622456e-001, 5.635476e-001, 5.648496e-001, 5.661517e-001, 5.674465e-001, 5.687390e-001, 5.700315e-001, 5.713216e-001,
+5.726024e-001, 5.738832e-001, 5.751640e-001, 5.764372e-001, 5.777060e-001, 5.789748e-001, 5.802434e-001, 5.815006e-001, 5.827578e-001, 5.840151e-001,
+5.852678e-001, 5.865132e-001, 5.877586e-001, 5.890040e-001, 5.902428e-001, 5.914789e-001, 5.927150e-001, 5.939510e-001, 5.951773e-001, 5.964037e-001,
+5.976300e-001, 5.988536e-001, 6.000704e-001, 6.012872e-001, 6.025039e-001, 6.037155e-001, 6.049223e-001, 6.061292e-001, 6.073360e-001, 6.085358e-001,
+6.097332e-001, 6.109305e-001, 6.121278e-001, 6.133172e-001, 6.145057e-001, 6.156943e-001, 6.168823e-001, 6.180606e-001, 6.192390e-001, 6.204174e-001,
+6.215938e-001, 6.227612e-001, 6.239285e-001, 6.250959e-001, 6.262605e-001, 6.274175e-001, 6.285745e-001, 6.297315e-001, 6.308856e-001, 6.320332e-001,
+6.331808e-001, 6.343284e-001, 6.354722e-001, 6.366079e-001, 6.377437e-001, 6.388794e-001, 6.400116e-001, 6.411357e-001, 6.422598e-001, 6.433839e-001,
+6.445053e-001, 6.456190e-001, 6.467326e-001, 6.478463e-001, 6.489578e-001, 6.500587e-001, 6.511597e-001, 6.522606e-001, 6.533609e-001, 6.544496e-001,
+6.555382e-001, 6.566268e-001, 6.577155e-001, 6.587943e-001, 6.598721e-001, 6.609499e-001, 6.620277e-001, 6.630987e-001, 6.641670e-001, 6.652354e-001,
+6.663037e-001, 6.673663e-001, 6.684231e-001, 6.694800e-001, 6.705368e-001, 6.715910e-001, 6.726369e-001, 6.736827e-001, 6.747286e-001, 6.757745e-001,
+6.768104e-001, 6.778457e-001, 6.788811e-001, 6.799164e-001, 6.809443e-001, 6.819676e-001, 6.829909e-001, 6.840142e-001, 6.850344e-001, 6.860457e-001,
+6.870569e-001, 6.880681e-001, 6.890793e-001, 6.900807e-001, 6.910804e-001, 6.920801e-001, 6.930799e-001, 6.940744e-001, 6.950619e-001, 6.960493e-001,
+6.970368e-001, 6.980242e-001, 6.990014e-001, 6.999780e-001, 7.009547e-001, 7.019313e-001, 7.029025e-001, 7.038669e-001, 7.048313e-001, 7.057957e-001,
+7.067601e-001, 7.077147e-001, 7.086681e-001, 7.096215e-001, 7.105750e-001, 7.115258e-001, 7.124706e-001, 7.134154e-001, 7.143603e-001, 7.153051e-001,
+7.162432e-001, 7.171782e-001, 7.181132e-001, 7.190482e-001, 7.199830e-001, 7.209094e-001, 7.218357e-001, 7.227620e-001, 7.236883e-001, 7.246116e-001,
+7.255286e-001, 7.264455e-001, 7.273624e-001, 7.282793e-001, 7.291894e-001, 7.300945e-001, 7.309996e-001, 7.319047e-001, 7.328098e-001, 7.337059e-001,
+7.345998e-001, 7.354937e-001, 7.363876e-001, 7.372814e-001, 7.381641e-001, 7.390466e-001, 7.399292e-001, 7.408117e-001, 7.416930e-001, 7.425663e-001,
+7.434395e-001, 7.443128e-001, 7.451860e-001, 7.460574e-001, 7.469224e-001, 7.477873e-001, 7.486523e-001, 7.495173e-001, 7.503795e-001, 7.512350e-001,
+7.520906e-001, 7.529461e-001, 7.538017e-001, 7.546544e-001, 7.555009e-001, 7.563473e-001, 7.571938e-001, 7.580403e-001, 7.588835e-001, 7.597190e-001,
+7.605544e-001, 7.613899e-001, 7.622253e-001, 7.630585e-001, 7.638840e-001, 7.647094e-001, 7.655349e-001, 7.663604e-001, 7.671846e-001, 7.680001e-001,
+7.688155e-001, 7.696310e-001, 7.704464e-001, 7.712618e-001, 7.720687e-001, 7.728753e-001, 7.736819e-001, 7.744885e-001, 7.752951e-001, 7.760956e-001,
+7.768944e-001, 7.776932e-001, 7.784921e-001, 7.792909e-001, 7.800845e-001, 7.808739e-001, 7.816632e-001, 7.824526e-001, 7.832420e-001, 7.840290e-001,
+7.848097e-001, 7.855904e-001, 7.863711e-001, 7.871518e-001, 7.879325e-001, 7.887043e-001, 7.894757e-001, 7.902470e-001, 7.910184e-001, 7.917898e-001,
+7.925563e-001, 7.933196e-001, 7.940829e-001, 7.948462e-001, 7.956094e-001, 7.963713e-001, 7.971267e-001, 7.978821e-001, 7.986375e-001, 7.993929e-001,
+8.001483e-001, 8.008972e-001, 8.016437e-001, 8.023902e-001, 8.031367e-001, 8.038832e-001, 8.046275e-001, 8.053646e-001, 8.061017e-001, 8.068388e-001,
+8.075759e-001, 8.083130e-001, 8.090446e-001, 8.097738e-001, 8.105030e-001, 8.112321e-001, 8.119613e-001, 8.126897e-001, 8.134109e-001, 8.141322e-001,
+8.148534e-001, 8.155747e-001, 8.162959e-001, 8.170127e-001, 8.177244e-001, 8.184360e-001, 8.191476e-001, 8.198593e-001, 8.205709e-001, 8.212758e-001,
+8.219788e-001, 8.226818e-001, 8.233848e-001, 8.240878e-001, 8.247904e-001, 8.254855e-001, 8.261805e-001, 8.268756e-001, 8.275706e-001, 8.282657e-001,
+8.289581e-001, 8.296430e-001, 8.303279e-001, 8.310129e-001, 8.316978e-001, 8.323827e-001, 8.330640e-001, 8.337404e-001, 8.344169e-001, 8.350933e-001,
+8.357698e-001, 8.364462e-001, 8.371186e-001, 8.377877e-001, 8.384569e-001, 8.391260e-001, 8.397952e-001, 8.404643e-001, 8.411294e-001, 8.417921e-001,
+8.424548e-001, 8.431176e-001, 8.437803e-001, 8.444430e-001, 8.451002e-001, 8.457545e-001, 8.464089e-001, 8.470632e-001, 8.477176e-001, 8.483719e-001,
+8.490218e-001, 8.496691e-001, 8.503165e-001, 8.509639e-001, 8.516113e-001, 8.522587e-001, 8.529011e-001, 8.535399e-001, 8.541787e-001, 8.548175e-001,
+8.554563e-001, 8.560951e-001, 8.567304e-001, 8.573614e-001, 8.579923e-001, 8.586232e-001, 8.592542e-001, 8.598851e-001, 8.605140e-001, 8.611372e-001,
+8.617605e-001, 8.623838e-001, 8.630070e-001, 8.636303e-001, 8.642532e-001, 8.648698e-001, 8.654864e-001, 8.661029e-001, 8.667195e-001, 8.673361e-001,
+8.679526e-001, 8.685630e-001, 8.691716e-001, 8.697802e-001, 8.703888e-001, 8.709974e-001, 8.716060e-001, 8.722119e-001, 8.728144e-001, 8.734169e-001,
+8.740194e-001, 8.746219e-001, 8.752244e-001, 8.758263e-001, 8.764202e-001, 8.770140e-001, 8.776079e-001, 8.782018e-001, 8.787957e-001, 8.793895e-001,
+8.799786e-001, 8.805650e-001, 8.811513e-001, 8.817376e-001, 8.823239e-001, 8.829102e-001, 8.834956e-001, 8.840756e-001, 8.846556e-001, 8.852356e-001,
+8.858155e-001, 8.863955e-001, 8.869755e-001, 8.875501e-001, 8.881211e-001, 8.886921e-001, 8.892631e-001, 8.898340e-001, 8.904050e-001, 8.909760e-001,
+8.915406e-001, 8.921051e-001, 8.926697e-001, 8.932343e-001, 8.937988e-001, 8.943634e-001, 8.949253e-001, 8.954826e-001, 8.960399e-001, 8.965971e-001,
+8.971544e-001, 8.977116e-001, 8.982689e-001, 8.988219e-001, 8.993727e-001, 8.999235e-001, 9.004742e-001, 9.010250e-001, 9.015758e-001, 9.021266e-001,
+9.026709e-001, 9.032144e-001, 9.037579e-001, 9.043013e-001, 9.048448e-001, 9.053883e-001, 9.059312e-001, 9.064669e-001, 9.070025e-001, 9.075381e-001,
+9.080738e-001, 9.086094e-001, 9.091450e-001, 9.096795e-001, 9.102092e-001, 9.107388e-001, 9.112685e-001, 9.117982e-001, 9.123279e-001, 9.128575e-001,
+9.133857e-001, 9.139096e-001, 9.144335e-001, 9.149574e-001, 9.154813e-001, 9.160053e-001, 9.165292e-001, 9.170515e-001, 9.175698e-001, 9.180881e-001,
+9.186064e-001, 9.191247e-001, 9.196430e-001, 9.201613e-001, 9.206780e-001, 9.211896e-001, 9.217012e-001, 9.222128e-001, 9.227244e-001, 9.232361e-001,
+9.237477e-001, 9.242583e-001, 9.247623e-001, 9.252662e-001, 9.257702e-001, 9.262742e-001, 9.267781e-001, 9.272821e-001, 9.277861e-001, 9.282818e-001,
+9.287772e-001, 9.292726e-001, 9.297680e-001, 9.302634e-001, 9.307588e-001, 9.312543e-001, 9.317452e-001, 9.322346e-001, 9.327240e-001, 9.332135e-001,
+9.337029e-001, 9.341923e-001, 9.346817e-001, 9.351692e-001, 9.356545e-001, 9.361398e-001, 9.366251e-001, 9.371104e-001, 9.375957e-001, 9.380810e-001,
+9.385658e-001, 9.390467e-001, 9.395277e-001, 9.400086e-001, 9.404895e-001, 9.409705e-001, 9.414514e-001, 9.419323e-001, 9.424098e-001, 9.428860e-001,
+9.433621e-001, 9.438382e-001, 9.443143e-001, 9.447905e-001, 9.452666e-001, 9.457415e-001, 9.462127e-001, 9.466839e-001, 9.471551e-001, 9.476263e-001,
+9.480975e-001, 9.485687e-001, 9.490399e-001, 9.495073e-001, 9.499732e-001, 9.504391e-001, 9.509051e-001, 9.513710e-001, 9.518369e-001, 9.523028e-001,
+9.527681e-001, 9.532286e-001, 9.536892e-001, 9.541498e-001, 9.546103e-001, 9.550709e-001, 9.555314e-001, 9.559920e-001, 9.564499e-001, 9.569048e-001,
+9.573597e-001, 9.578147e-001, 9.582696e-001, 9.587245e-001, 9.591794e-001, 9.596344e-001, 9.600850e-001, 9.605342e-001, 9.609833e-001, 9.614325e-001,
+9.618817e-001, 9.623309e-001, 9.627801e-001, 9.632293e-001, 9.636727e-001, 9.641160e-001, 9.645593e-001, 9.650025e-001, 9.654458e-001, 9.658890e-001,
+9.663323e-001, 9.667748e-001, 9.672120e-001, 9.676492e-001, 9.680864e-001, 9.685236e-001, 9.689608e-001, 9.693980e-001, 9.698352e-001, 9.702710e-001,
+9.707020e-001, 9.711331e-001, 9.715641e-001, 9.719951e-001, 9.724261e-001, 9.728571e-001, 9.732881e-001, 9.737176e-001, 9.741422e-001, 9.745668e-001,
+9.749915e-001, 9.754161e-001, 9.758407e-001, 9.762653e-001, 9.766900e-001, 9.771133e-001, 9.775315e-001, 9.779497e-001, 9.783678e-001, 9.787860e-001,
+9.792042e-001, 9.796224e-001, 9.800405e-001, 9.804581e-001, 9.808695e-001, 9.812808e-001, 9.816922e-001, 9.821036e-001, 9.825149e-001, 9.829263e-001,
+9.833377e-001, 9.837490e-001, 9.841541e-001, 9.845586e-001, 9.849630e-001, 9.853675e-001, 9.857719e-001, 9.861764e-001, 9.865808e-001, 9.869853e-001,
+9.873846e-001, 9.877814e-001, 9.881782e-001, 9.885750e-001, 9.889718e-001, 9.893686e-001, 9.897654e-001, 9.901621e-001, 9.905560e-001, 9.909447e-001,
+9.913333e-001, 9.917219e-001, 9.921105e-001, 9.924992e-001, 9.928878e-001, 9.932764e-001, 9.936650e-001, 9.940439e-001, 9.944225e-001, 9.948012e-001,
+9.951798e-001, 9.955584e-001, 9.959370e-001, 9.963156e-001, 9.966943e-001, 9.970667e-001, 9.974333e-001, 9.978000e-001, 9.981667e-001, 9.985333e-001,
+9.989000e-001, 9.992667e-001, 9.996333e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.066142e-004, 6.284252e-004, 9.574692e-004, 1.292698e-003, 1.634825e-003, 1.985453e-003, 2.345883e-003, 2.717990e-003, 3.104465e-003,
+3.508017e-003, 3.931228e-003, 4.376770e-003, 4.845205e-003, 5.337713e-003, 5.853078e-003, 6.388821e-003, 6.942224e-003, 7.510838e-003, 8.092247e-003,
+8.684748e-003, 9.287708e-003, 9.900396e-003, 1.052313e-002, 1.115640e-002, 1.180059e-002, 1.245721e-002, 1.312619e-002, 1.380819e-002, 1.450263e-002,
+1.520969e-002, 1.592967e-002, 1.666169e-002, 1.740615e-002, 1.816329e-002, 1.893263e-002, 1.971458e-002, 2.050793e-002, 2.131351e-002, 2.212966e-002,
+2.295721e-002, 2.379584e-002, 2.464691e-002, 2.550847e-002, 2.638056e-002, 2.726266e-002, 2.815560e-002, 2.905950e-002, 2.997433e-002, 3.089892e-002,
+3.183395e-002, 3.278005e-002, 3.373775e-002, 3.470757e-002, 3.568893e-002, 3.668220e-002, 3.768750e-002, 3.870531e-002, 3.973501e-002, 4.077533e-002,
+4.182743e-002, 4.289185e-002, 4.396876e-002, 4.505733e-002, 4.615917e-002, 4.727158e-002, 4.839477e-002, 4.952916e-002, 5.067467e-002, 5.183234e-002,
+5.300079e-002, 5.418070e-002, 5.537078e-002, 5.657195e-002, 5.778270e-002, 5.900489e-002, 6.023661e-002, 6.147940e-002, 6.273316e-002, 6.399747e-002,
+6.527409e-002, 6.656224e-002, 6.786064e-002, 6.917168e-002, 7.049343e-002, 7.182525e-002, 7.316830e-002, 7.452195e-002, 7.588635e-002, 7.726139e-002,
+7.864591e-002, 8.004277e-002, 8.145178e-002, 8.287050e-002, 8.430030e-002, 8.573968e-002, 8.718831e-002, 8.864811e-002, 9.011573e-002, 9.159236e-002,
+9.307887e-002, 9.457379e-002, 9.607735e-002, 9.758963e-002, 9.910917e-002, 1.006360e-001, 1.021702e-001, 1.037116e-001, 1.052598e-001, 1.068147e-001,
+1.083774e-001, 1.099461e-001, 1.115210e-001, 1.131021e-001, 1.146881e-001, 1.162793e-001, 1.178763e-001, 1.194793e-001, 1.210875e-001, 1.226998e-001,
+1.243165e-001, 1.259384e-001, 1.275652e-001, 1.291960e-001, 1.308314e-001, 1.324711e-001, 1.341143e-001, 1.357624e-001, 1.374144e-001, 1.390711e-001,
+1.407307e-001, 1.423933e-001, 1.440594e-001, 1.457290e-001, 1.474036e-001, 1.490815e-001, 1.507632e-001, 1.524487e-001, 1.541378e-001, 1.558294e-001,
+1.575267e-001, 1.592279e-001, 1.609318e-001, 1.626382e-001, 1.643475e-001, 1.660613e-001, 1.677769e-001, 1.694949e-001, 1.712158e-001, 1.729404e-001,
+1.746672e-001, 1.763962e-001, 1.781274e-001, 1.798599e-001, 1.815944e-001, 1.833306e-001, 1.850684e-001, 1.868094e-001, 1.885518e-001, 1.902959e-001,
+1.920423e-001, 1.937912e-001, 1.955418e-001, 1.972939e-001, 1.990482e-001, 2.008041e-001, 2.025613e-001, 2.043205e-001, 2.060810e-001, 2.078423e-001,
+2.096050e-001, 2.113689e-001, 2.131335e-001, 2.148993e-001, 2.166654e-001, 2.184320e-001, 2.201997e-001, 2.219685e-001, 2.237379e-001, 2.255075e-001,
+2.272780e-001, 2.290490e-001, 2.308211e-001, 2.325939e-001, 2.343678e-001, 2.361426e-001, 2.379178e-001, 2.396938e-001, 2.414696e-001, 2.432451e-001,
+2.450219e-001, 2.467985e-001, 2.485741e-001, 2.503491e-001, 2.521236e-001, 2.538985e-001, 2.556734e-001, 2.574481e-001, 2.592218e-001, 2.609946e-001,
+2.627679e-001, 2.645413e-001, 2.663162e-001, 2.680906e-001, 2.698637e-001, 2.716364e-001, 2.734088e-001, 2.751808e-001, 2.769527e-001, 2.787235e-001,
+2.804942e-001, 2.822644e-001, 2.840347e-001, 2.858053e-001, 2.875757e-001, 2.893457e-001, 2.911149e-001, 2.928835e-001, 2.946513e-001, 2.964187e-001,
+2.981836e-001, 2.999480e-001, 3.017111e-001, 3.034741e-001, 3.052338e-001, 3.069935e-001, 3.087524e-001, 3.105110e-001, 3.122670e-001, 3.140225e-001,
+3.157749e-001, 3.175269e-001, 3.192762e-001, 3.210250e-001, 3.227711e-001, 3.245170e-001, 3.262612e-001, 3.280052e-001, 3.297473e-001, 3.314893e-001,
+3.332268e-001, 3.349643e-001, 3.366967e-001, 3.384288e-001, 3.401574e-001, 3.418854e-001, 3.436118e-001, 3.453376e-001, 3.470620e-001, 3.487857e-001,
+3.505072e-001, 3.522264e-001, 3.539440e-001, 3.556582e-001, 3.573715e-001, 3.590804e-001, 3.607893e-001, 3.624914e-001, 3.641934e-001, 3.658940e-001,
+3.675941e-001, 3.692927e-001, 3.709901e-001, 3.726865e-001, 3.743806e-001, 3.760747e-001, 3.777656e-001, 3.794565e-001, 3.811436e-001, 3.828294e-001,
+3.845128e-001, 3.861933e-001, 3.878732e-001, 3.895485e-001, 3.912238e-001, 3.928935e-001, 3.945615e-001, 3.962262e-001, 3.978858e-001, 3.995453e-001,
+4.011984e-001, 4.028515e-001, 4.045008e-001, 4.061478e-001, 4.077934e-001, 4.094338e-001, 4.110741e-001, 4.127109e-001, 4.143466e-001, 4.159803e-001,
+4.176094e-001, 4.192385e-001, 4.208612e-001, 4.224825e-001, 4.241017e-001, 4.257162e-001, 4.273307e-001, 4.289398e-001, 4.305475e-001, 4.321533e-001,
+4.337531e-001, 4.353529e-001, 4.369483e-001, 4.385415e-001, 4.401342e-001, 4.417211e-001, 4.433080e-001, 4.448912e-001, 4.464703e-001, 4.480495e-001,
+4.496214e-001, 4.511920e-001, 4.527612e-001, 4.543245e-001, 4.558878e-001, 4.574449e-001, 4.589963e-001, 4.605477e-001, 4.620890e-001, 4.636281e-001,
+4.651658e-001, 4.666923e-001, 4.682187e-001, 4.697411e-001, 4.712564e-001, 4.727717e-001, 4.742800e-001, 4.757837e-001, 4.772874e-001, 4.787816e-001,
+4.802735e-001, 4.817655e-001, 4.832465e-001, 4.847275e-001, 4.862066e-001, 4.876767e-001, 4.891467e-001, 4.906135e-001, 4.920732e-001, 4.935330e-001,
+4.949879e-001, 4.964365e-001, 4.978851e-001, 4.993263e-001, 5.007607e-001, 5.021952e-001, 5.036209e-001, 5.050408e-001, 5.064607e-001, 5.078724e-001,
+5.092796e-001, 5.106869e-001, 5.120873e-001, 5.134844e-001, 5.148816e-001, 5.162712e-001, 5.176570e-001, 5.190428e-001, 5.204212e-001, 5.217953e-001,
+5.231695e-001, 5.245353e-001, 5.258952e-001, 5.272551e-001, 5.286077e-001, 5.299531e-001, 5.312984e-001, 5.326380e-001, 5.339689e-001, 5.352999e-001,
+5.366279e-001, 5.379484e-001, 5.392689e-001, 5.405881e-001, 5.418985e-001, 5.432089e-001, 5.445193e-001, 5.458185e-001, 5.471169e-001, 5.484153e-001,
+5.497051e-001, 5.509917e-001, 5.522783e-001, 5.535587e-001, 5.548329e-001, 5.561071e-001, 5.573784e-001, 5.586405e-001, 5.599025e-001, 5.611645e-001,
+5.624133e-001, 5.636614e-001, 5.649095e-001, 5.661481e-001, 5.673811e-001, 5.686142e-001, 5.698431e-001, 5.710616e-001, 5.722801e-001, 5.734986e-001,
+5.747051e-001, 5.759106e-001, 5.771160e-001, 5.783154e-001, 5.795092e-001, 5.807030e-001, 5.818957e-001, 5.830773e-001, 5.842589e-001, 5.854404e-001,
+5.866149e-001, 5.877853e-001, 5.889558e-001, 5.901247e-001, 5.912854e-001, 5.924461e-001, 5.936068e-001, 5.947598e-001, 5.959085e-001, 5.970572e-001,
+5.982047e-001, 5.993420e-001, 6.004794e-001, 6.016167e-001, 6.027489e-001, 6.038766e-001, 6.050042e-001, 6.061319e-001, 6.072487e-001, 6.083646e-001,
+6.094806e-001, 6.105933e-001, 6.116985e-001, 6.128036e-001, 6.139087e-001, 6.150082e-001, 6.161045e-001, 6.172007e-001, 6.182970e-001, 6.193832e-001,
+6.204688e-001, 6.215543e-001, 6.226378e-001, 6.237139e-001, 6.247900e-001, 6.258660e-001, 6.269382e-001, 6.280059e-001, 6.290737e-001, 6.301414e-001,
+6.311997e-001, 6.322536e-001, 6.333074e-001, 6.343613e-001, 6.354042e-001, 6.364453e-001, 6.374865e-001, 6.385275e-001, 6.395581e-001, 6.405887e-001,
+6.416193e-001, 6.426482e-001, 6.436667e-001, 6.446852e-001, 6.457036e-001, 6.467196e-001, 6.477273e-001, 6.487351e-001, 6.497428e-001, 6.507481e-001,
+6.517474e-001, 6.527467e-001, 6.537461e-001, 6.547424e-001, 6.557320e-001, 6.567216e-001, 6.577112e-001, 6.586982e-001, 6.596793e-001, 6.606604e-001,
+6.616415e-001, 6.626203e-001, 6.635925e-001, 6.645648e-001, 6.655370e-001, 6.665075e-001, 6.674702e-001, 6.684329e-001, 6.693956e-001, 6.703576e-001,
+6.713106e-001, 6.722635e-001, 6.732165e-001, 6.741694e-001, 6.751123e-001, 6.760544e-001, 6.769965e-001, 6.779386e-001, 6.788739e-001, 6.798070e-001,
+6.807401e-001, 6.816732e-001, 6.826019e-001, 6.835270e-001, 6.844520e-001, 6.853770e-001, 6.862993e-001, 6.872150e-001, 6.881306e-001, 6.890463e-001,
+6.899619e-001, 6.908700e-001, 6.917781e-001, 6.926862e-001, 6.935943e-001, 6.944952e-001, 6.953927e-001, 6.962901e-001, 6.971876e-001, 6.980822e-001,
+6.989708e-001, 6.998594e-001, 7.007479e-001, 7.016365e-001, 7.025168e-001, 7.033965e-001, 7.042762e-001, 7.051559e-001, 7.060313e-001, 7.069025e-001,
+7.077737e-001, 7.086450e-001, 7.095158e-001, 7.103792e-001, 7.112425e-001, 7.121058e-001, 7.129691e-001, 7.138272e-001, 7.146809e-001, 7.155347e-001,
+7.163884e-001, 7.172421e-001, 7.180885e-001, 7.189350e-001, 7.197814e-001, 7.206279e-001, 7.214712e-001, 7.223105e-001, 7.231497e-001, 7.239890e-001,
+7.248282e-001, 7.256617e-001, 7.264939e-001, 7.273261e-001, 7.281582e-001, 7.289890e-001, 7.298128e-001, 7.306366e-001, 7.314603e-001, 7.322841e-001,
+7.331035e-001, 7.339181e-001, 7.347327e-001, 7.355474e-001, 7.363620e-001, 7.371708e-001, 7.379775e-001, 7.387843e-001, 7.395910e-001, 7.403978e-001,
+7.411972e-001, 7.419964e-001, 7.427956e-001, 7.435948e-001, 7.443926e-001, 7.451831e-001, 7.459737e-001, 7.467643e-001, 7.475549e-001, 7.483426e-001,
+7.491240e-001, 7.499054e-001, 7.506868e-001, 7.514681e-001, 7.522463e-001, 7.530200e-001, 7.537937e-001, 7.545674e-001, 7.553411e-001, 7.561120e-001,
+7.568801e-001, 7.576481e-001, 7.584162e-001, 7.591843e-001, 7.599484e-001, 7.607088e-001, 7.614692e-001, 7.622297e-001, 7.629901e-001, 7.637474e-001,
+7.645016e-001, 7.652558e-001, 7.660100e-001, 7.667642e-001, 7.675157e-001, 7.682639e-001, 7.690121e-001, 7.697603e-001, 7.705085e-001, 7.712538e-001,
+7.719941e-001, 7.727344e-001, 7.734746e-001, 7.742149e-001, 7.749537e-001, 7.756871e-001, 7.764206e-001, 7.771540e-001, 7.778875e-001, 7.786207e-001,
+7.793481e-001, 7.800754e-001, 7.808028e-001, 7.815301e-001, 7.822575e-001, 7.829780e-001, 7.836970e-001, 7.844161e-001, 7.851351e-001, 7.858542e-001,
+7.865695e-001, 7.872818e-001, 7.879942e-001, 7.887065e-001, 7.894188e-001, 7.901296e-001, 7.908357e-001, 7.915417e-001, 7.922477e-001, 7.929538e-001,
+7.936598e-001, 7.943587e-001, 7.950568e-001, 7.957548e-001, 7.964528e-001, 7.971509e-001, 7.978456e-001, 7.985369e-001, 7.992283e-001, 7.999196e-001,
+8.006109e-001, 8.013020e-001, 8.019875e-001, 8.026731e-001, 8.033586e-001, 8.040441e-001, 8.047297e-001, 8.054109e-001, 8.060886e-001, 8.067663e-001,
+8.074441e-001, 8.081218e-001, 8.087994e-001, 8.094711e-001, 8.101429e-001, 8.108146e-001, 8.114864e-001, 8.121581e-001, 8.128275e-001, 8.134938e-001,
+8.141601e-001, 8.148265e-001, 8.154928e-001, 8.161592e-001, 8.168199e-001, 8.174793e-001, 8.181388e-001, 8.187982e-001, 8.194577e-001, 8.201163e-001,
+8.207699e-001, 8.214236e-001, 8.220772e-001, 8.227309e-001, 8.233845e-001, 8.240357e-001, 8.246836e-001, 8.253314e-001, 8.259793e-001, 8.266271e-001,
+8.272750e-001, 8.279188e-001, 8.285605e-001, 8.292022e-001, 8.298440e-001, 8.304857e-001, 8.311274e-001, 8.317649e-001, 8.324015e-001, 8.330382e-001,
+8.336749e-001, 8.343115e-001, 8.349482e-001, 8.355782e-001, 8.362080e-001, 8.368378e-001, 8.374677e-001, 8.380975e-001, 8.387270e-001, 8.393515e-001,
+8.399760e-001, 8.406005e-001, 8.412251e-001, 8.418496e-001, 8.424736e-001, 8.430926e-001, 8.437115e-001, 8.443305e-001, 8.449495e-001, 8.455685e-001,
+8.461870e-001, 8.468005e-001, 8.474140e-001, 8.480276e-001, 8.486411e-001, 8.492546e-001, 8.498680e-001, 8.504769e-001, 8.510858e-001, 8.516947e-001,
+8.523036e-001, 8.529124e-001, 8.535213e-001, 8.541247e-001, 8.547276e-001, 8.553304e-001, 8.559333e-001, 8.565362e-001, 8.571390e-001, 8.577384e-001,
+8.583366e-001, 8.589348e-001, 8.595330e-001, 8.601312e-001, 8.607294e-001, 8.613251e-001, 8.619187e-001, 8.625123e-001, 8.631059e-001, 8.636995e-001,
+8.642931e-001, 8.648849e-001, 8.654722e-001, 8.660594e-001, 8.666466e-001, 8.672338e-001, 8.678211e-001, 8.684083e-001, 8.689905e-001, 8.695725e-001,
+8.701544e-001, 8.707364e-001, 8.713183e-001, 8.719003e-001, 8.724785e-001, 8.730542e-001, 8.736298e-001, 8.742055e-001, 8.747811e-001, 8.753567e-001,
+8.759318e-001, 8.765037e-001, 8.770757e-001, 8.776476e-001, 8.782195e-001, 8.787915e-001, 8.793634e-001, 8.799321e-001, 8.804993e-001, 8.810665e-001,
+8.816337e-001, 8.822009e-001, 8.827681e-001, 8.833346e-001, 8.838980e-001, 8.844614e-001, 8.850247e-001, 8.855881e-001, 8.861515e-001, 8.867148e-001,
+8.872754e-001, 8.878340e-001, 8.883925e-001, 8.889510e-001, 8.895096e-001, 8.900681e-001, 8.906266e-001, 8.911815e-001, 8.917361e-001, 8.922907e-001,
+8.928453e-001, 8.933999e-001, 8.939546e-001, 8.945080e-001, 8.950577e-001, 8.956074e-001, 8.961571e-001, 8.967069e-001, 8.972566e-001, 8.978063e-001,
+8.983541e-001, 8.988998e-001, 8.994456e-001, 8.999913e-001, 9.005371e-001, 9.010829e-001, 9.016286e-001, 9.021710e-001, 9.027118e-001, 9.032527e-001,
+9.037935e-001, 9.043343e-001, 9.048752e-001, 9.054160e-001, 9.059523e-001, 9.064876e-001, 9.070229e-001, 9.075582e-001, 9.080935e-001, 9.086288e-001,
+9.091640e-001, 9.096950e-001, 9.102254e-001, 9.107559e-001, 9.112864e-001, 9.118169e-001, 9.123474e-001, 9.128779e-001, 9.134052e-001, 9.139323e-001,
+9.144593e-001, 9.149864e-001, 9.155134e-001, 9.160405e-001, 9.165676e-001, 9.170906e-001, 9.176132e-001, 9.181359e-001, 9.186585e-001, 9.191811e-001,
+9.197037e-001, 9.202263e-001, 9.207436e-001, 9.212597e-001, 9.217758e-001, 9.222919e-001, 9.228080e-001, 9.233241e-001, 9.238402e-001, 9.243530e-001,
+9.248641e-001, 9.253753e-001, 9.258864e-001, 9.263976e-001, 9.269087e-001, 9.274199e-001, 9.279295e-001, 9.284373e-001, 9.289451e-001, 9.294529e-001,
+9.299607e-001, 9.304685e-001, 9.309764e-001, 9.314835e-001, 9.319880e-001, 9.324924e-001, 9.329968e-001, 9.335012e-001, 9.340056e-001, 9.345100e-001,
+9.350144e-001, 9.355158e-001, 9.360166e-001, 9.365174e-001, 9.370182e-001, 9.375191e-001, 9.380199e-001, 9.385207e-001, 9.390197e-001, 9.395166e-001,
+9.400135e-001, 9.405104e-001, 9.410074e-001, 9.415043e-001, 9.420012e-001, 9.424981e-001, 9.429909e-001, 9.434838e-001, 9.439766e-001, 9.444695e-001,
+9.449623e-001, 9.454552e-001, 9.459481e-001, 9.464388e-001, 9.469273e-001, 9.474158e-001, 9.479044e-001, 9.483929e-001, 9.488814e-001, 9.493700e-001,
+9.498585e-001, 9.503429e-001, 9.508270e-001, 9.513110e-001, 9.517951e-001, 9.522791e-001, 9.527632e-001, 9.532472e-001, 9.537299e-001, 9.542092e-001,
+9.546885e-001, 9.551679e-001, 9.556472e-001, 9.561265e-001, 9.566058e-001, 9.570851e-001, 9.575615e-001, 9.580359e-001, 9.585103e-001, 9.589846e-001,
+9.594590e-001, 9.599334e-001, 9.604077e-001, 9.608821e-001, 9.613522e-001, 9.618214e-001, 9.622906e-001, 9.627597e-001, 9.632289e-001, 9.636981e-001,
+9.641672e-001, 9.646364e-001, 9.651002e-001, 9.655639e-001, 9.660276e-001, 9.664913e-001, 9.669550e-001, 9.674186e-001, 9.678823e-001, 9.683456e-001,
+9.688035e-001, 9.692615e-001, 9.697194e-001, 9.701773e-001, 9.706353e-001, 9.710932e-001, 9.715512e-001, 9.720084e-001, 9.724602e-001, 9.729120e-001,
+9.733638e-001, 9.738156e-001, 9.742674e-001, 9.747193e-001, 9.751711e-001, 9.756223e-001, 9.760677e-001, 9.765131e-001, 9.769584e-001, 9.774038e-001,
+9.778492e-001, 9.782946e-001, 9.787400e-001, 9.791854e-001, 9.796237e-001, 9.800621e-001, 9.805004e-001, 9.809388e-001, 9.813771e-001, 9.818154e-001,
+9.822538e-001, 9.826921e-001, 9.831243e-001, 9.835553e-001, 9.839862e-001, 9.844172e-001, 9.848481e-001, 9.852791e-001, 9.857100e-001, 9.861410e-001,
+9.865669e-001, 9.869894e-001, 9.874120e-001, 9.878345e-001, 9.882571e-001, 9.886797e-001, 9.891022e-001, 9.895248e-001, 9.899446e-001, 9.903582e-001,
+9.907718e-001, 9.911854e-001, 9.915990e-001, 9.920125e-001, 9.924261e-001, 9.928397e-001, 9.932533e-001, 9.936568e-001, 9.940596e-001, 9.944625e-001,
+9.948653e-001, 9.952681e-001, 9.956709e-001, 9.960738e-001, 9.964766e-001, 9.968734e-001, 9.972642e-001, 9.976550e-001, 9.980459e-001, 9.984367e-001,
+9.988275e-001, 9.992183e-001, 9.996092e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.923408e-004, 3.908366e-004, 5.960183e-004, 8.084249e-004, 1.028678e-003, 1.257289e-003, 1.494876e-003, 1.741884e-003, 1.998710e-003,
+2.266293e-003, 2.544858e-003, 2.834813e-003, 3.137000e-003, 3.451925e-003, 3.780289e-003, 4.121815e-003, 4.476303e-003, 4.843612e-003, 5.223383e-003,
+5.615842e-003, 6.020667e-003, 6.437253e-003, 6.865290e-003, 7.305244e-003, 7.756449e-003, 8.219523e-003, 8.693808e-003, 9.179771e-003, 9.677543e-003,
+1.018591e-002, 1.070571e-002, 1.123747e-002, 1.178016e-002, 1.233382e-002, 1.289911e-002, 1.347597e-002, 1.406514e-002, 1.466549e-002, 1.527697e-002,
+1.590031e-002, 1.653520e-002, 1.718223e-002, 1.784198e-002, 1.851291e-002, 1.919529e-002, 1.989001e-002, 2.059743e-002, 2.131656e-002, 2.204772e-002,
+2.279145e-002, 2.354886e-002, 2.431924e-002, 2.510182e-002, 2.589647e-002, 2.670389e-002, 2.752485e-002, 2.835880e-002, 2.920574e-002, 3.006641e-002,
+3.093935e-002, 3.182493e-002, 3.272272e-002, 3.363252e-002, 3.455536e-002, 3.549001e-002, 3.643815e-002, 3.739850e-002, 3.837322e-002, 3.936151e-002,
+4.036365e-002, 4.138011e-002, 4.240918e-002, 4.345328e-002, 4.451018e-002, 4.557984e-002, 4.666516e-002, 4.776403e-002, 4.887681e-002, 5.000624e-002,
+5.115021e-002, 5.230830e-002, 5.348058e-002, 5.466868e-002, 5.587037e-002, 5.708547e-002, 5.831381e-002, 5.955574e-002, 6.081142e-002, 6.207877e-002,
+6.335734e-002, 6.464686e-002, 6.594708e-002, 6.725771e-002, 6.857877e-002, 6.990999e-002, 7.124890e-002, 7.259468e-002, 7.394712e-002, 7.530603e-002,
+7.667107e-002, 7.804229e-002, 7.941992e-002, 8.080364e-002, 8.219298e-002, 8.358756e-002, 8.498736e-002, 8.639181e-002, 8.780002e-002, 8.921158e-002,
+9.062658e-002, 9.204471e-002, 9.346532e-002, 9.488842e-002, 9.631449e-002, 9.774350e-002, 9.917488e-002, 1.006093e-001, 1.020476e-001, 1.034904e-001,
+1.049364e-001, 1.063855e-001, 1.078382e-001, 1.092941e-001, 1.107527e-001, 1.122143e-001, 1.136795e-001, 1.151480e-001, 1.166194e-001, 1.180944e-001,
+1.195726e-001, 1.210534e-001, 1.225366e-001, 1.240229e-001, 1.255117e-001, 1.270033e-001, 1.284980e-001, 1.299961e-001, 1.314983e-001, 1.330049e-001,
+1.345155e-001, 1.360293e-001, 1.375455e-001, 1.390648e-001, 1.405864e-001, 1.421105e-001, 1.436380e-001, 1.451703e-001, 1.467056e-001, 1.482436e-001,
+1.497847e-001, 1.513287e-001, 1.528748e-001, 1.544230e-001, 1.559746e-001, 1.575296e-001, 1.590875e-001, 1.606485e-001, 1.622128e-001, 1.637788e-001,
+1.653466e-001, 1.669193e-001, 1.684943e-001, 1.700717e-001, 1.716526e-001, 1.732359e-001, 1.748213e-001, 1.764108e-001, 1.780031e-001, 1.795974e-001,
+1.811944e-001, 1.827941e-001, 1.843960e-001, 1.860031e-001, 1.876127e-001, 1.892255e-001, 1.908413e-001, 1.924592e-001, 1.940807e-001, 1.957053e-001,
+1.973316e-001, 1.989613e-001, 2.005929e-001, 2.022266e-001, 2.038644e-001, 2.055035e-001, 2.071448e-001, 2.087885e-001, 2.104345e-001, 2.120838e-001,
+2.137343e-001, 2.153877e-001, 2.170426e-001, 2.186994e-001, 2.203589e-001, 2.220195e-001, 2.236841e-001, 2.253499e-001, 2.270196e-001, 2.286914e-001,
+2.303658e-001, 2.320433e-001, 2.337223e-001, 2.354063e-001, 2.370913e-001, 2.387810e-001, 2.404720e-001, 2.421665e-001, 2.438629e-001, 2.455617e-001,
+2.472632e-001, 2.489665e-001, 2.506738e-001, 2.523826e-001, 2.540958e-001, 2.558099e-001, 2.575285e-001, 2.592475e-001, 2.609697e-001, 2.626922e-001,
+2.644180e-001, 2.661443e-001, 2.678735e-001, 2.696035e-001, 2.713380e-001, 2.730732e-001, 2.748119e-001, 2.765515e-001, 2.782952e-001, 2.800396e-001,
+2.817871e-001, 2.835354e-001, 2.852882e-001, 2.870416e-001, 2.887995e-001, 2.905577e-001, 2.923207e-001, 2.940837e-001, 2.958521e-001, 2.976206e-001,
+2.993935e-001, 3.011670e-001, 3.029441e-001, 3.047225e-001, 3.065038e-001, 3.082870e-001, 3.100728e-001, 3.118614e-001, 3.136520e-001, 3.154470e-001,
+3.172427e-001, 3.190433e-001, 3.208439e-001, 3.226490e-001, 3.244545e-001, 3.262635e-001, 3.280741e-001, 3.298870e-001, 3.317027e-001, 3.335192e-001,
+3.353388e-001, 3.371585e-001, 3.389824e-001, 3.408068e-001, 3.426337e-001, 3.444622e-001, 3.462922e-001, 3.481257e-001, 3.499592e-001, 3.517968e-001,
+3.536346e-001, 3.554756e-001, 3.573187e-001, 3.591624e-001, 3.610085e-001, 3.628545e-001, 3.647046e-001, 3.665556e-001, 3.684080e-001, 3.702623e-001,
+3.721166e-001, 3.739753e-001, 3.758341e-001, 3.776954e-001, 3.795589e-001, 3.814227e-001, 3.832913e-001, 3.851599e-001, 3.870307e-001, 3.889033e-001,
+3.907762e-001, 3.926539e-001, 3.945317e-001, 3.964118e-001, 3.982942e-001, 4.001766e-001, 4.020617e-001, 4.039470e-001, 4.058333e-001, 4.077214e-001,
+4.096096e-001, 4.114991e-001, 4.133891e-001, 4.152794e-001, 4.171708e-001, 4.190623e-001, 4.209538e-001, 4.228455e-001, 4.247372e-001, 4.266293e-001,
+4.285216e-001, 4.304137e-001, 4.323050e-001, 4.341963e-001, 4.360860e-001, 4.379738e-001, 4.398615e-001, 4.417463e-001, 4.436299e-001, 4.455134e-001,
+4.473906e-001, 4.492675e-001, 4.511435e-001, 4.530153e-001, 4.548871e-001, 4.567565e-001, 4.586217e-001, 4.604870e-001, 4.623487e-001, 4.642076e-001,
+4.660665e-001, 4.679197e-001, 4.697704e-001, 4.716211e-001, 4.734648e-001, 4.753070e-001, 4.771491e-001, 4.789815e-001, 4.808132e-001, 4.826447e-001,
+4.844657e-001, 4.862867e-001, 4.881069e-001, 4.899150e-001, 4.917230e-001, 4.935298e-001, 4.953246e-001, 4.971194e-001, 4.989126e-001, 5.006925e-001,
+5.024725e-001, 5.042511e-001, 5.060156e-001, 5.077802e-001, 5.095440e-001, 5.112924e-001, 5.130407e-001, 5.147891e-001, 5.165217e-001, 5.182538e-001,
+5.199860e-001, 5.217026e-001, 5.234172e-001, 5.251318e-001, 5.268320e-001, 5.285277e-001, 5.302235e-001, 5.319082e-001, 5.335861e-001, 5.352639e-001,
+5.369332e-001, 5.385919e-001, 5.402506e-001, 5.419047e-001, 5.435451e-001, 5.451855e-001, 5.468253e-001, 5.484473e-001, 5.500693e-001, 5.516913e-001,
+5.532999e-001, 5.549046e-001, 5.565094e-001, 5.581052e-001, 5.596920e-001, 5.612788e-001, 5.628618e-001, 5.644289e-001, 5.659959e-001, 5.675629e-001,
+5.691116e-001, 5.706572e-001, 5.722029e-001, 5.737379e-001, 5.752622e-001, 5.767865e-001, 5.783087e-001, 5.798140e-001, 5.813194e-001, 5.828247e-001,
+5.843166e-001, 5.858027e-001, 5.872888e-001, 5.887704e-001, 5.902383e-001, 5.917063e-001, 5.931742e-001, 5.946283e-001, 5.960785e-001, 5.975286e-001,
+5.989736e-001, 6.004050e-001, 6.018365e-001, 6.032679e-001, 6.046855e-001, 6.060983e-001, 6.075112e-001, 6.089212e-001, 6.103188e-001, 6.117164e-001,
+6.131140e-001, 6.145018e-001, 6.158829e-001, 6.172640e-001, 6.186451e-001, 6.200103e-001, 6.213750e-001, 6.227398e-001, 6.240993e-001, 6.254477e-001,
+6.267962e-001, 6.281446e-001, 6.294825e-001, 6.308146e-001, 6.321466e-001, 6.334787e-001, 6.347957e-001, 6.361116e-001, 6.374276e-001, 6.387405e-001,
+6.400409e-001, 6.413414e-001, 6.426418e-001, 6.439359e-001, 6.452213e-001, 6.465067e-001, 6.477921e-001, 6.490674e-001, 6.503365e-001, 6.516057e-001,
+6.528748e-001, 6.541313e-001, 6.553845e-001, 6.566376e-001, 6.578907e-001, 6.591297e-001, 6.603674e-001, 6.616052e-001, 6.628426e-001, 6.640645e-001,
+6.652863e-001, 6.665082e-001, 6.677288e-001, 6.689363e-001, 6.701438e-001, 6.713513e-001, 6.725572e-001, 6.737517e-001, 6.749462e-001, 6.761407e-001,
+6.773336e-001, 6.785153e-001, 6.796969e-001, 6.808786e-001, 6.820590e-001, 6.832273e-001, 6.843956e-001, 6.855639e-001, 6.867318e-001, 6.878878e-001,
+6.890437e-001, 6.901997e-001, 6.913556e-001, 6.925013e-001, 6.936463e-001, 6.947912e-001, 6.959362e-001, 6.970708e-001, 6.982029e-001, 6.993350e-001,
+7.004671e-001, 7.015910e-001, 7.027104e-001, 7.038298e-001, 7.049492e-001, 7.060629e-001, 7.071695e-001, 7.082761e-001, 7.093827e-001, 7.104862e-001,
+7.115778e-001, 7.126694e-001, 7.137609e-001, 7.148525e-001, 7.159309e-001, 7.170084e-001, 7.180858e-001, 7.191633e-001, 7.202311e-001, 7.212931e-001,
+7.223552e-001, 7.234172e-001, 7.244750e-001, 7.255223e-001, 7.265697e-001, 7.276170e-001, 7.286643e-001, 7.296993e-001, 7.307330e-001, 7.317667e-001,
+7.328004e-001, 7.338271e-001, 7.348466e-001, 7.358661e-001, 7.368856e-001, 7.379045e-001, 7.389113e-001, 7.399181e-001, 7.409248e-001, 7.419316e-001,
+7.429320e-001, 7.439273e-001, 7.449226e-001, 7.459179e-001, 7.469128e-001, 7.478964e-001, 7.488800e-001, 7.498636e-001, 7.508472e-001, 7.518255e-001,
+7.527979e-001, 7.537703e-001, 7.547428e-001, 7.557152e-001, 7.566774e-001, 7.576381e-001, 7.585988e-001, 7.595595e-001, 7.605171e-001, 7.614649e-001,
+7.624126e-001, 7.633604e-001, 7.643082e-001, 7.652475e-001, 7.661802e-001, 7.671129e-001, 7.680456e-001, 7.689782e-001, 7.698999e-001, 7.708195e-001,
+7.717392e-001, 7.726588e-001, 7.735774e-001, 7.744857e-001, 7.753940e-001, 7.763023e-001, 7.772105e-001, 7.781155e-001, 7.790127e-001, 7.799099e-001,
+7.808071e-001, 7.817043e-001, 7.825965e-001, 7.834831e-001, 7.843697e-001, 7.852563e-001, 7.861428e-001, 7.870228e-001, 7.878980e-001, 7.887733e-001,
+7.896486e-001, 7.905239e-001, 7.913917e-001, 7.922560e-001, 7.931203e-001, 7.939847e-001, 7.948490e-001, 7.957043e-001, 7.965561e-001, 7.974079e-001,
+7.982597e-001, 7.991115e-001, 7.999551e-001, 8.007956e-001, 8.016362e-001, 8.024767e-001, 8.033173e-001, 8.041502e-001, 8.049797e-001, 8.058091e-001,
+8.066386e-001, 8.074680e-001, 8.082910e-001, 8.091096e-001, 8.099282e-001, 8.107469e-001, 8.115655e-001, 8.123789e-001, 8.131868e-001, 8.139946e-001,
+8.148024e-001, 8.156103e-001, 8.164145e-001, 8.172110e-001, 8.180075e-001, 8.188040e-001, 8.196005e-001, 8.203956e-001, 8.211801e-001, 8.219646e-001,
+8.227491e-001, 8.235336e-001, 8.243181e-001, 8.250932e-001, 8.258667e-001, 8.266402e-001, 8.274137e-001, 8.281872e-001, 8.289542e-001, 8.297163e-001,
+8.304784e-001, 8.312405e-001, 8.320026e-001, 8.327620e-001, 8.335125e-001, 8.342630e-001, 8.350134e-001, 8.357639e-001, 8.365143e-001, 8.372543e-001,
+8.379925e-001, 8.387307e-001, 8.394689e-001, 8.402071e-001, 8.409411e-001, 8.416695e-001, 8.423978e-001, 8.431261e-001, 8.438544e-001, 8.445828e-001,
+8.453016e-001, 8.460199e-001, 8.467383e-001, 8.474566e-001, 8.481749e-001, 8.488876e-001, 8.495930e-001, 8.502983e-001, 8.510036e-001, 8.517089e-001,
+8.524143e-001, 8.531095e-001, 8.538033e-001, 8.544971e-001, 8.551909e-001, 8.558847e-001, 8.565755e-001, 8.572578e-001, 8.579401e-001, 8.586224e-001,
+8.593047e-001, 8.599871e-001, 8.606625e-001, 8.613335e-001, 8.620046e-001, 8.626756e-001, 8.633466e-001, 8.640176e-001, 8.646782e-001, 8.653378e-001,
+8.659973e-001, 8.666568e-001, 8.673163e-001, 8.679741e-001, 8.686219e-001, 8.692697e-001, 8.699175e-001, 8.705654e-001, 8.712132e-001, 8.718574e-001,
+8.724952e-001, 8.731331e-001, 8.737709e-001, 8.744087e-001, 8.750465e-001, 8.756782e-001, 8.763042e-001, 8.769301e-001, 8.775560e-001, 8.781820e-001,
+8.788079e-001, 8.794274e-001, 8.800430e-001, 8.806586e-001, 8.812742e-001, 8.818897e-001, 8.825053e-001, 8.831139e-001, 8.837190e-001, 8.843242e-001,
+8.849294e-001, 8.855345e-001, 8.861397e-001, 8.867368e-001, 8.873301e-001, 8.879234e-001, 8.885167e-001, 8.891100e-001, 8.897034e-001, 8.902897e-001,
+8.908721e-001, 8.914545e-001, 8.920369e-001, 8.926193e-001, 8.932017e-001, 8.937775e-001, 8.943479e-001, 8.949182e-001, 8.954886e-001, 8.960590e-001,
+8.966293e-001, 8.971949e-001, 8.977534e-001, 8.983119e-001, 8.988704e-001, 8.994289e-001, 8.999875e-001, 9.005436e-001, 9.010909e-001, 9.016382e-001,
+9.021855e-001, 9.027328e-001, 9.032801e-001, 9.038274e-001, 9.043640e-001, 9.049003e-001, 9.054365e-001, 9.059727e-001, 9.065090e-001, 9.070452e-001,
+9.075743e-001, 9.080998e-001, 9.086254e-001, 9.091509e-001, 9.096764e-001, 9.102020e-001, 9.107244e-001, 9.112400e-001, 9.117556e-001, 9.122712e-001,
+9.127868e-001, 9.133024e-001, 9.138180e-001, 9.143245e-001, 9.148302e-001, 9.153359e-001, 9.158416e-001, 9.163473e-001, 9.168530e-001, 9.173537e-001,
+9.178488e-001, 9.183438e-001, 9.188389e-001, 9.193339e-001, 9.198290e-001, 9.203240e-001, 9.208073e-001, 9.212901e-001, 9.217728e-001, 9.222556e-001,
+9.227383e-001, 9.232211e-001, 9.236994e-001, 9.241709e-001, 9.246425e-001, 9.251140e-001, 9.255855e-001, 9.260570e-001, 9.265285e-001, 9.269910e-001,
+9.274509e-001, 9.279108e-001, 9.283707e-001, 9.288306e-001, 9.292905e-001, 9.297493e-001, 9.301988e-001, 9.306483e-001, 9.310978e-001, 9.315473e-001,
+9.319968e-001, 9.324463e-001, 9.328917e-001, 9.333304e-001, 9.337691e-001, 9.342078e-001, 9.346465e-001, 9.350852e-001, 9.355239e-001, 9.359566e-001,
+9.363853e-001, 9.368139e-001, 9.372426e-001, 9.376713e-001, 9.380999e-001, 9.385286e-001, 9.389498e-001, 9.393685e-001, 9.397872e-001, 9.402060e-001,
+9.406247e-001, 9.410434e-001, 9.414622e-001, 9.418721e-001, 9.422805e-001, 9.426889e-001, 9.430974e-001, 9.435058e-001, 9.439142e-001, 9.443227e-001,
+9.447217e-001, 9.451196e-001, 9.455176e-001, 9.459156e-001, 9.463135e-001, 9.467115e-001, 9.471095e-001, 9.474972e-001, 9.478837e-001, 9.482702e-001,
+9.486567e-001, 9.490432e-001, 9.494297e-001, 9.498162e-001, 9.501946e-001, 9.505712e-001, 9.509479e-001, 9.513245e-001, 9.517011e-001, 9.520777e-001,
+9.524544e-001, 9.528240e-001, 9.531905e-001, 9.535571e-001, 9.539236e-001, 9.542901e-001, 9.546567e-001, 9.550232e-001, 9.553845e-001, 9.557406e-001,
+9.560966e-001, 9.564527e-001, 9.568088e-001, 9.571649e-001, 9.575210e-001, 9.578741e-001, 9.582189e-001, 9.585636e-001, 9.589084e-001, 9.592532e-001,
+9.595979e-001, 9.599427e-001, 9.602874e-001, 9.606251e-001, 9.609625e-001, 9.612999e-001, 9.616372e-001, 9.619746e-001, 9.623119e-001, 9.626493e-001,
+9.629825e-001, 9.633127e-001, 9.636429e-001, 9.639731e-001, 9.643033e-001, 9.646335e-001, 9.649638e-001, 9.652929e-001, 9.656162e-001, 9.659395e-001,
+9.662629e-001, 9.665862e-001, 9.669095e-001, 9.672328e-001, 9.675561e-001, 9.678743e-001, 9.681898e-001, 9.685053e-001, 9.688207e-001, 9.691362e-001,
+9.694517e-001, 9.697672e-001, 9.700819e-001, 9.703902e-001, 9.706984e-001, 9.710067e-001, 9.713149e-001, 9.716232e-001, 9.719315e-001, 9.722397e-001,
+9.725441e-001, 9.728444e-001, 9.731448e-001, 9.734451e-001, 9.737455e-001, 9.740459e-001, 9.743462e-001, 9.746466e-001, 9.749408e-001, 9.752338e-001,
+9.755267e-001, 9.758196e-001, 9.761125e-001, 9.764054e-001, 9.766983e-001, 9.769906e-001, 9.772747e-001, 9.775588e-001, 9.778429e-001, 9.781271e-001,
+9.784112e-001, 9.786953e-001, 9.789794e-001, 9.792611e-001, 9.795363e-001, 9.798115e-001, 9.800866e-001, 9.803618e-001, 9.806370e-001, 9.809121e-001,
+9.811873e-001, 9.814591e-001, 9.817259e-001, 9.819926e-001, 9.822593e-001, 9.825260e-001, 9.827928e-001, 9.830595e-001, 9.833262e-001, 9.835890e-001,
+9.838471e-001, 9.841053e-001, 9.843634e-001, 9.846215e-001, 9.848797e-001, 9.851378e-001, 9.853959e-001, 9.856500e-001, 9.858992e-001, 9.861484e-001,
+9.863975e-001, 9.866467e-001, 9.868959e-001, 9.871451e-001, 9.873943e-001, 9.876399e-001, 9.878799e-001, 9.881199e-001, 9.883599e-001, 9.885999e-001,
+9.888399e-001, 9.890799e-001, 9.893199e-001, 9.895578e-001, 9.897894e-001, 9.900209e-001, 9.902525e-001, 9.904841e-001, 9.907157e-001, 9.909472e-001,
+9.911788e-001, 9.914099e-001, 9.916323e-001, 9.918547e-001, 9.920772e-001, 9.922996e-001, 9.925220e-001, 9.927444e-001, 9.929668e-001, 9.931892e-001,
+9.934051e-001, 9.936192e-001, 9.938333e-001, 9.940474e-001, 9.942615e-001, 9.944755e-001, 9.946896e-001, 9.949037e-001, 9.951136e-001, 9.953181e-001,
+9.955227e-001, 9.957272e-001, 9.959317e-001, 9.961362e-001, 9.963408e-001, 9.965453e-001, 9.967495e-001, 9.969443e-001, 9.971391e-001, 9.973340e-001,
+9.975288e-001, 9.977236e-001, 9.979184e-001, 9.981132e-001, 9.983080e-001, 9.984989e-001, 9.986865e-001, 9.988742e-001, 9.990618e-001, 9.992494e-001,
+9.994371e-001, 9.996247e-001, 9.998124e-001, 1.000000e+000)),
+("Agfa", "Advantix 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.975920e-003, 1.959039e-002, 2.818739e-002, 3.594004e-002, 4.299869e-002, 4.956996e-002, 5.568998e-002, 6.147352e-002, 6.696605e-002,
+7.222205e-002, 7.722558e-002, 8.208267e-002, 8.674737e-002, 9.117959e-002, 9.548543e-002, 9.968267e-002, 1.037981e-001, 1.078191e-001, 1.117319e-001,
+1.155694e-001, 1.193092e-001, 1.229985e-001, 1.266298e-001, 1.301828e-001, 1.336571e-001, 1.370529e-001, 1.403682e-001, 1.436406e-001, 1.468633e-001,
+1.500498e-001, 1.531880e-001, 1.562645e-001, 1.593037e-001, 1.623244e-001, 1.653180e-001, 1.682834e-001, 1.712214e-001, 1.741255e-001, 1.769879e-001,
+1.798096e-001, 1.825928e-001, 1.853370e-001, 1.880521e-001, 1.907549e-001, 1.934437e-001, 1.961089e-001, 1.987465e-001, 2.013591e-001, 2.039510e-001,
+2.065189e-001, 2.090531e-001, 2.115565e-001, 2.140269e-001, 2.164652e-001, 2.188751e-001, 2.212729e-001, 2.236527e-001, 2.260090e-001, 2.283486e-001,
+2.306748e-001, 2.329775e-001, 2.352634e-001, 2.375381e-001, 2.398074e-001, 2.420688e-001, 2.443215e-001, 2.465686e-001, 2.488050e-001, 2.510259e-001,
+2.532329e-001, 2.554255e-001, 2.576034e-001, 2.597729e-001, 2.619242e-001, 2.640654e-001, 2.661896e-001, 2.682917e-001, 2.703784e-001, 2.724464e-001,
+2.745001e-001, 2.765473e-001, 2.785852e-001, 2.806180e-001, 2.826407e-001, 2.846565e-001, 2.866633e-001, 2.886620e-001, 2.906560e-001, 2.926403e-001,
+2.946188e-001, 2.965883e-001, 2.985542e-001, 3.005167e-001, 3.024732e-001, 3.044192e-001, 3.063542e-001, 3.082850e-001, 3.102098e-001, 3.121251e-001,
+3.140304e-001, 3.159317e-001, 3.178149e-001, 3.196888e-001, 3.215618e-001, 3.234334e-001, 3.252998e-001, 3.271591e-001, 3.290081e-001, 3.308455e-001,
+3.326750e-001, 3.345032e-001, 3.363313e-001, 3.381510e-001, 3.399673e-001, 3.417668e-001, 3.435564e-001, 3.453372e-001, 3.471119e-001, 3.488827e-001,
+3.506491e-001, 3.524068e-001, 3.541551e-001, 3.558938e-001, 3.576247e-001, 3.593503e-001, 3.610683e-001, 3.627772e-001, 3.644764e-001, 3.661649e-001,
+3.678395e-001, 3.695081e-001, 3.711709e-001, 3.728272e-001, 3.744740e-001, 3.761177e-001, 3.777533e-001, 3.793805e-001, 3.810013e-001, 3.826154e-001,
+3.842233e-001, 3.858231e-001, 3.874185e-001, 3.890103e-001, 3.905987e-001, 3.921895e-001, 3.937751e-001, 3.953565e-001, 3.969357e-001, 3.985070e-001,
+4.000719e-001, 4.016300e-001, 4.031784e-001, 4.047181e-001, 4.062579e-001, 4.077931e-001, 4.093224e-001, 4.108480e-001, 4.123689e-001, 4.138790e-001,
+4.153836e-001, 4.168850e-001, 4.183782e-001, 4.198675e-001, 4.213511e-001, 4.228255e-001, 4.242957e-001, 4.257540e-001, 4.272057e-001, 4.286472e-001,
+4.300780e-001, 4.315038e-001, 4.329301e-001, 4.343522e-001, 4.357595e-001, 4.371611e-001, 4.385560e-001, 4.399373e-001, 4.413124e-001, 4.426823e-001,
+4.440505e-001, 4.454061e-001, 4.467601e-001, 4.481091e-001, 4.494558e-001, 4.507993e-001, 4.521392e-001, 4.534762e-001, 4.548082e-001, 4.561376e-001,
+4.574612e-001, 4.587827e-001, 4.600966e-001, 4.614087e-001, 4.627130e-001, 4.640162e-001, 4.653095e-001, 4.666017e-001, 4.678847e-001, 4.691669e-001,
+4.704379e-001, 4.717079e-001, 4.729768e-001, 4.742455e-001, 4.755127e-001, 4.767797e-001, 4.780431e-001, 4.793055e-001, 4.805589e-001, 4.818084e-001,
+4.830556e-001, 4.843012e-001, 4.855448e-001, 4.867861e-001, 4.880253e-001, 4.892594e-001, 4.904917e-001, 4.917112e-001, 4.929307e-001, 4.941438e-001,
+4.953565e-001, 4.965641e-001, 4.977697e-001, 4.989754e-001, 5.001812e-001, 5.013839e-001, 5.025753e-001, 5.037667e-001, 5.049498e-001, 5.061323e-001,
+5.073093e-001, 5.084830e-001, 5.096563e-001, 5.108285e-001, 5.120007e-001, 5.131582e-001, 5.143145e-001, 5.154706e-001, 5.166264e-001, 5.177810e-001,
+5.189288e-001, 5.200766e-001, 5.212227e-001, 5.223680e-001, 5.235089e-001, 5.246379e-001, 5.257669e-001, 5.268948e-001, 5.280223e-001, 5.291474e-001,
+5.302666e-001, 5.313858e-001, 5.325025e-001, 5.336184e-001, 5.347308e-001, 5.358300e-001, 5.369292e-001, 5.380264e-001, 5.391223e-001, 5.402179e-001,
+5.412973e-001, 5.423767e-001, 5.434549e-001, 5.445311e-001, 5.456073e-001, 5.466776e-001, 5.477457e-001, 5.488138e-001, 5.498805e-001, 5.509472e-001,
+5.520087e-001, 5.530598e-001, 5.541110e-001, 5.551608e-001, 5.562096e-001, 5.572584e-001, 5.583011e-001, 5.593425e-001, 5.603839e-001, 5.614248e-001,
+5.624656e-001, 5.635035e-001, 5.645299e-001, 5.655563e-001, 5.665822e-001, 5.676073e-001, 5.686323e-001, 5.696543e-001, 5.706727e-001, 5.716911e-001,
+5.727098e-001, 5.737286e-001, 5.747474e-001, 5.757571e-001, 5.767612e-001, 5.777652e-001, 5.787636e-001, 5.797588e-001, 5.807541e-001, 5.817455e-001,
+5.827348e-001, 5.837240e-001, 5.847098e-001, 5.856932e-001, 5.866767e-001, 5.876535e-001, 5.886247e-001, 5.895960e-001, 5.905645e-001, 5.915299e-001,
+5.924953e-001, 5.934592e-001, 5.944201e-001, 5.953810e-001, 5.963402e-001, 5.972915e-001, 5.982427e-001, 5.991940e-001, 6.001345e-001, 6.010749e-001,
+6.020154e-001, 6.029484e-001, 6.038793e-001, 6.048102e-001, 6.057402e-001, 6.066695e-001, 6.075987e-001, 6.085264e-001, 6.094488e-001, 6.103713e-001,
+6.112937e-001, 6.122088e-001, 6.131232e-001, 6.140376e-001, 6.149482e-001, 6.158558e-001, 6.167634e-001, 6.176699e-001, 6.185710e-001, 6.194721e-001,
+6.203732e-001, 6.212695e-001, 6.221641e-001, 6.230588e-001, 6.239500e-001, 6.248330e-001, 6.257160e-001, 6.265990e-001, 6.274775e-001, 6.283550e-001,
+6.292325e-001, 6.301056e-001, 6.309672e-001, 6.318287e-001, 6.326903e-001, 6.335497e-001, 6.344081e-001, 6.352665e-001, 6.361234e-001, 6.369685e-001,
+6.378136e-001, 6.386587e-001, 6.395034e-001, 6.403478e-001, 6.411922e-001, 6.420365e-001, 6.428722e-001, 6.437057e-001, 6.445393e-001, 6.453730e-001,
+6.462083e-001, 6.470436e-001, 6.478789e-001, 6.487108e-001, 6.495367e-001, 6.503625e-001, 6.511884e-001, 6.520127e-001, 6.528358e-001, 6.536588e-001,
+6.544819e-001, 6.552997e-001, 6.561157e-001, 6.569317e-001, 6.577478e-001, 6.585526e-001, 6.593560e-001, 6.601594e-001, 6.609628e-001, 6.617612e-001,
+6.625594e-001, 6.633576e-001, 6.641555e-001, 6.649441e-001, 6.657327e-001, 6.665213e-001, 6.673098e-001, 6.680960e-001, 6.688821e-001, 6.696683e-001,
+6.704541e-001, 6.712336e-001, 6.720131e-001, 6.727925e-001, 6.735720e-001, 6.743517e-001, 6.751314e-001, 6.759110e-001, 6.766907e-001, 6.774598e-001,
+6.782273e-001, 6.789948e-001, 6.797623e-001, 6.805222e-001, 6.812793e-001, 6.820364e-001, 6.827935e-001, 6.835458e-001, 6.842943e-001, 6.850427e-001,
+6.857911e-001, 6.865373e-001, 6.872786e-001, 6.880200e-001, 6.887614e-001, 6.895025e-001, 6.902387e-001, 6.909749e-001, 6.917111e-001, 6.924473e-001,
+6.931800e-001, 6.939115e-001, 6.946430e-001, 6.953745e-001, 6.961030e-001, 6.968263e-001, 6.975496e-001, 6.982729e-001, 6.989962e-001, 6.997180e-001,
+7.004398e-001, 7.011616e-001, 7.018834e-001, 7.026002e-001, 7.033124e-001, 7.040245e-001, 7.047367e-001, 7.054488e-001, 7.061572e-001, 7.068657e-001,
+7.075742e-001, 7.082826e-001, 7.089877e-001, 7.096893e-001, 7.103909e-001, 7.110924e-001, 7.117940e-001, 7.124900e-001, 7.131855e-001, 7.138809e-001,
+7.145763e-001, 7.152706e-001, 7.159615e-001, 7.166524e-001, 7.173434e-001, 7.180343e-001, 7.187236e-001, 7.194116e-001, 7.200997e-001, 7.207878e-001,
+7.214758e-001, 7.221613e-001, 7.228463e-001, 7.235314e-001, 7.242164e-001, 7.249004e-001, 7.255745e-001, 7.262486e-001, 7.269227e-001, 7.275968e-001,
+7.282712e-001, 7.289464e-001, 7.296216e-001, 7.302968e-001, 7.309720e-001, 7.316445e-001, 7.323129e-001, 7.329814e-001, 7.336499e-001, 7.343183e-001,
+7.349863e-001, 7.356538e-001, 7.363213e-001, 7.369888e-001, 7.376563e-001, 7.383213e-001, 7.389840e-001, 7.396466e-001, 7.403092e-001, 7.409719e-001,
+7.416301e-001, 7.422839e-001, 7.429378e-001, 7.435916e-001, 7.442454e-001, 7.448980e-001, 7.455489e-001, 7.461998e-001, 7.468508e-001, 7.475017e-001,
+7.481494e-001, 7.487898e-001, 7.494303e-001, 7.500707e-001, 7.507111e-001, 7.513517e-001, 7.519932e-001, 7.526347e-001, 7.532762e-001, 7.539177e-001,
+7.545592e-001, 7.551949e-001, 7.558299e-001, 7.564650e-001, 7.571000e-001, 7.577351e-001, 7.583732e-001, 7.590132e-001, 7.596532e-001, 7.602931e-001,
+7.609331e-001, 7.615719e-001, 7.622077e-001, 7.628436e-001, 7.634794e-001, 7.641153e-001, 7.647511e-001, 7.653751e-001, 7.659978e-001, 7.666205e-001,
+7.672433e-001, 7.678660e-001, 7.684879e-001, 7.691088e-001, 7.697297e-001, 7.703506e-001, 7.709715e-001, 7.715924e-001, 7.722045e-001, 7.728162e-001,
+7.734280e-001, 7.740397e-001, 7.746515e-001, 7.752641e-001, 7.758778e-001, 7.764916e-001, 7.771054e-001, 7.777192e-001, 7.783329e-001, 7.789419e-001,
+7.795497e-001, 7.801574e-001, 7.807652e-001, 7.813730e-001, 7.819800e-001, 7.825826e-001, 7.831852e-001, 7.837878e-001, 7.843904e-001, 7.849930e-001,
+7.855939e-001, 7.861925e-001, 7.867911e-001, 7.873897e-001, 7.879884e-001, 7.885870e-001, 7.891781e-001, 7.897650e-001, 7.903518e-001, 7.909386e-001,
+7.915255e-001, 7.921123e-001, 7.926985e-001, 7.932846e-001, 7.938707e-001, 7.944568e-001, 7.950429e-001, 7.956290e-001, 7.962081e-001, 7.967863e-001,
+7.973646e-001, 7.979429e-001, 7.985212e-001, 7.990994e-001, 7.996806e-001, 8.002619e-001, 8.008432e-001, 8.014245e-001, 8.020058e-001, 8.025872e-001,
+8.031633e-001, 8.037390e-001, 8.043146e-001, 8.048903e-001, 8.054660e-001, 8.060416e-001, 8.066141e-001, 8.071860e-001, 8.077578e-001, 8.083297e-001,
+8.089016e-001, 8.094734e-001, 8.100446e-001, 8.106154e-001, 8.111862e-001, 8.117570e-001, 8.123278e-001, 8.128987e-001, 8.134649e-001, 8.140263e-001,
+8.145877e-001, 8.151491e-001, 8.157104e-001, 8.162718e-001, 8.168335e-001, 8.173961e-001, 8.179587e-001, 8.185213e-001, 8.190839e-001, 8.196464e-001,
+8.202090e-001, 8.207657e-001, 8.213217e-001, 8.218778e-001, 8.224338e-001, 8.229898e-001, 8.235458e-001, 8.241016e-001, 8.246574e-001, 8.252131e-001,
+8.257688e-001, 8.263245e-001, 8.268802e-001, 8.274358e-001, 8.279883e-001, 8.285408e-001, 8.290932e-001, 8.296457e-001, 8.301981e-001, 8.307506e-001,
+8.312999e-001, 8.318462e-001, 8.323925e-001, 8.329388e-001, 8.334850e-001, 8.340313e-001, 8.345776e-001, 8.351239e-001, 8.356702e-001, 8.362164e-001,
+8.367627e-001, 8.373090e-001, 8.378553e-001, 8.383994e-001, 8.389375e-001, 8.394755e-001, 8.400135e-001, 8.405516e-001, 8.410896e-001, 8.416277e-001,
+8.421647e-001, 8.427007e-001, 8.432368e-001, 8.437729e-001, 8.443089e-001, 8.448450e-001, 8.453811e-001, 8.459135e-001, 8.464447e-001, 8.469758e-001,
+8.475070e-001, 8.480381e-001, 8.485693e-001, 8.491005e-001, 8.496297e-001, 8.501587e-001, 8.506876e-001, 8.512166e-001, 8.517455e-001, 8.522745e-001,
+8.528034e-001, 8.533318e-001, 8.538601e-001, 8.543884e-001, 8.549166e-001, 8.554449e-001, 8.559732e-001, 8.565015e-001, 8.570211e-001, 8.575401e-001,
+8.580591e-001, 8.585781e-001, 8.590971e-001, 8.596161e-001, 8.601351e-001, 8.606512e-001, 8.611670e-001, 8.616828e-001, 8.621985e-001, 8.627143e-001,
+8.632301e-001, 8.637458e-001, 8.642572e-001, 8.647669e-001, 8.652766e-001, 8.657862e-001, 8.662959e-001, 8.668056e-001, 8.673153e-001, 8.678232e-001,
+8.683293e-001, 8.688354e-001, 8.693415e-001, 8.698476e-001, 8.703537e-001, 8.708598e-001, 8.713655e-001, 8.718695e-001, 8.723735e-001, 8.728775e-001,
+8.733815e-001, 8.738855e-001, 8.743895e-001, 8.748935e-001, 8.753938e-001, 8.758934e-001, 8.763929e-001, 8.768925e-001, 8.773921e-001, 8.778917e-001,
+8.783912e-001, 8.788912e-001, 8.793918e-001, 8.798923e-001, 8.803929e-001, 8.808934e-001, 8.813939e-001, 8.818945e-001, 8.823950e-001, 8.828894e-001,
+8.833831e-001, 8.838767e-001, 8.843704e-001, 8.848640e-001, 8.853577e-001, 8.858513e-001, 8.863435e-001, 8.868324e-001, 8.873212e-001, 8.878101e-001,
+8.882989e-001, 8.887878e-001, 8.892766e-001, 8.897655e-001, 8.902525e-001, 8.907384e-001, 8.912243e-001, 8.917102e-001, 8.921962e-001, 8.926821e-001,
+8.931680e-001, 8.936539e-001, 8.941389e-001, 8.946238e-001, 8.951087e-001, 8.955936e-001, 8.960784e-001, 8.965633e-001, 8.970482e-001, 8.975331e-001,
+8.980189e-001, 8.985048e-001, 8.989906e-001, 8.994764e-001, 8.999622e-001, 9.004480e-001, 9.009338e-001, 9.014185e-001, 9.018970e-001, 9.023755e-001,
+9.028541e-001, 9.033326e-001, 9.038111e-001, 9.042896e-001, 9.047682e-001, 9.052457e-001, 9.057186e-001, 9.061915e-001, 9.066644e-001, 9.071373e-001,
+9.076102e-001, 9.080831e-001, 9.085560e-001, 9.090285e-001, 9.094980e-001, 9.099675e-001, 9.104370e-001, 9.109065e-001, 9.113759e-001, 9.118454e-001,
+9.123149e-001, 9.127844e-001, 9.132521e-001, 9.137197e-001, 9.141873e-001, 9.146549e-001, 9.151225e-001, 9.155901e-001, 9.160577e-001, 9.165253e-001,
+9.169932e-001, 9.174611e-001, 9.179290e-001, 9.183970e-001, 9.188649e-001, 9.193328e-001, 9.198008e-001, 9.202687e-001, 9.207351e-001, 9.211995e-001,
+9.216639e-001, 9.221282e-001, 9.225926e-001, 9.230570e-001, 9.235214e-001, 9.239858e-001, 9.244500e-001, 9.249091e-001, 9.253681e-001, 9.258272e-001,
+9.262863e-001, 9.267453e-001, 9.272044e-001, 9.276635e-001, 9.281225e-001, 9.285796e-001, 9.290350e-001, 9.294903e-001, 9.299457e-001, 9.304011e-001,
+9.308564e-001, 9.313118e-001, 9.317672e-001, 9.322225e-001, 9.326752e-001, 9.331278e-001, 9.335803e-001, 9.340329e-001, 9.344855e-001, 9.349381e-001,
+9.353907e-001, 9.358432e-001, 9.362944e-001, 9.367427e-001, 9.371910e-001, 9.376393e-001, 9.380875e-001, 9.385358e-001, 9.389841e-001, 9.394323e-001,
+9.398806e-001, 9.403270e-001, 9.407719e-001, 9.412168e-001, 9.416617e-001, 9.421066e-001, 9.425515e-001, 9.429964e-001, 9.434413e-001, 9.438862e-001,
+9.443271e-001, 9.447666e-001, 9.452061e-001, 9.456456e-001, 9.460851e-001, 9.465246e-001, 9.469641e-001, 9.474036e-001, 9.478431e-001, 9.482764e-001,
+9.487083e-001, 9.491403e-001, 9.495722e-001, 9.500042e-001, 9.504361e-001, 9.508681e-001, 9.513000e-001, 9.517319e-001, 9.521591e-001, 9.525852e-001,
+9.530112e-001, 9.534373e-001, 9.538634e-001, 9.542895e-001, 9.547155e-001, 9.551416e-001, 9.555677e-001, 9.559905e-001, 9.564120e-001, 9.568335e-001,
+9.572550e-001, 9.576765e-001, 9.580980e-001, 9.585195e-001, 9.589411e-001, 9.593626e-001, 9.597812e-001, 9.601971e-001, 9.606130e-001, 9.610289e-001,
+9.614448e-001, 9.618607e-001, 9.622766e-001, 9.626925e-001, 9.631084e-001, 9.635231e-001, 9.639336e-001, 9.643441e-001, 9.647546e-001, 9.651651e-001,
+9.655757e-001, 9.659862e-001, 9.663967e-001, 9.668072e-001, 9.672178e-001, 9.676215e-001, 9.680241e-001, 9.684266e-001, 9.688292e-001, 9.692317e-001,
+9.696342e-001, 9.700368e-001, 9.704393e-001, 9.708419e-001, 9.712425e-001, 9.716397e-001, 9.720370e-001, 9.724342e-001, 9.728315e-001, 9.732288e-001,
+9.736260e-001, 9.740233e-001, 9.744205e-001, 9.748178e-001, 9.752098e-001, 9.756003e-001, 9.759909e-001, 9.763815e-001, 9.767721e-001, 9.771627e-001,
+9.775532e-001, 9.779438e-001, 9.783344e-001, 9.787241e-001, 9.791072e-001, 9.794904e-001, 9.798735e-001, 9.802567e-001, 9.806398e-001, 9.810230e-001,
+9.814061e-001, 9.817893e-001, 9.821724e-001, 9.825516e-001, 9.829235e-001, 9.832954e-001, 9.836673e-001, 9.840392e-001, 9.844111e-001, 9.847830e-001,
+9.851549e-001, 9.855268e-001, 9.858987e-001, 9.862666e-001, 9.866302e-001, 9.869938e-001, 9.873574e-001, 9.877210e-001, 9.880846e-001, 9.884482e-001,
+9.888118e-001, 9.891754e-001, 9.895390e-001, 9.898962e-001, 9.902472e-001, 9.905983e-001, 9.909494e-001, 9.913004e-001, 9.916515e-001, 9.920025e-001,
+9.923536e-001, 9.927046e-001, 9.930557e-001, 9.934035e-001, 9.937472e-001, 9.940909e-001, 9.944346e-001, 9.947783e-001, 9.951220e-001, 9.954657e-001,
+9.958094e-001, 9.961531e-001, 9.964968e-001, 9.968331e-001, 9.971498e-001, 9.974665e-001, 9.977832e-001, 9.980999e-001, 9.984165e-001, 9.987332e-001,
+9.990499e-001, 9.993666e-001, 9.996833e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.423060e-003, 1.654829e-002, 2.393865e-002, 3.064911e-002, 3.684823e-002, 4.262286e-002, 4.799977e-002, 5.313513e-002, 5.801306e-002,
+6.276814e-002, 6.728290e-002, 7.159296e-002, 7.581154e-002, 7.994731e-002, 8.395237e-002, 8.784311e-002, 9.163020e-002, 9.532929e-002, 9.893967e-002,
+1.024465e-001, 1.058896e-001, 1.092770e-001, 1.126256e-001, 1.159031e-001, 1.191100e-001, 1.222644e-001, 1.253843e-001, 1.284482e-001, 1.314789e-001,
+1.344655e-001, 1.374221e-001, 1.403358e-001, 1.431988e-001, 1.460404e-001, 1.488438e-001, 1.516060e-001, 1.543526e-001, 1.570729e-001, 1.597576e-001,
+1.624283e-001, 1.650680e-001, 1.676720e-001, 1.702331e-001, 1.727773e-001, 1.753048e-001, 1.777950e-001, 1.802502e-001, 1.826943e-001, 1.851214e-001,
+1.875294e-001, 1.899122e-001, 1.922918e-001, 1.946634e-001, 1.970132e-001, 1.993432e-001, 2.016437e-001, 2.039305e-001, 2.062092e-001, 2.084756e-001,
+2.107182e-001, 2.129396e-001, 2.151476e-001, 2.173521e-001, 2.195435e-001, 2.217238e-001, 2.238845e-001, 2.260321e-001, 2.281742e-001, 2.303087e-001,
+2.324285e-001, 2.345478e-001, 2.366596e-001, 2.387540e-001, 2.408431e-001, 2.429352e-001, 2.450206e-001, 2.470879e-001, 2.491298e-001, 2.511505e-001,
+2.531621e-001, 2.551639e-001, 2.571550e-001, 2.591302e-001, 2.611007e-001, 2.630642e-001, 2.650121e-001, 2.669440e-001, 2.688711e-001, 2.707966e-001,
+2.727139e-001, 2.746171e-001, 2.765101e-001, 2.783927e-001, 2.802629e-001, 2.821266e-001, 2.839806e-001, 2.858334e-001, 2.876933e-001, 2.895553e-001,
+2.914139e-001, 2.932643e-001, 2.951014e-001, 2.969211e-001, 2.987316e-001, 3.005412e-001, 3.023457e-001, 3.041404e-001, 3.059215e-001, 3.076926e-001,
+3.094542e-001, 3.112052e-001, 3.129466e-001, 3.146811e-001, 3.164061e-001, 3.181275e-001, 3.198528e-001, 3.215795e-001, 3.233040e-001, 3.250232e-001,
+3.267351e-001, 3.284330e-001, 3.301151e-001, 3.317880e-001, 3.334558e-001, 3.351209e-001, 3.367798e-001, 3.384373e-001, 3.400929e-001, 3.417460e-001,
+3.433952e-001, 3.450439e-001, 3.466848e-001, 3.483185e-001, 3.499466e-001, 3.515641e-001, 3.531783e-001, 3.547909e-001, 3.564053e-001, 3.580116e-001,
+3.596133e-001, 3.612110e-001, 3.627917e-001, 3.643645e-001, 3.659299e-001, 3.674802e-001, 3.690252e-001, 3.705663e-001, 3.721058e-001, 3.736424e-001,
+3.751771e-001, 3.767110e-001, 3.782438e-001, 3.797756e-001, 3.813019e-001, 3.828236e-001, 3.843406e-001, 3.858481e-001, 3.873529e-001, 3.888537e-001,
+3.903481e-001, 3.918396e-001, 3.933278e-001, 3.948137e-001, 3.962967e-001, 3.977732e-001, 3.992464e-001, 4.007086e-001, 4.021649e-001, 4.036137e-001,
+4.050632e-001, 4.065129e-001, 4.079528e-001, 4.093911e-001, 4.108251e-001, 4.122550e-001, 4.136811e-001, 4.150993e-001, 4.165147e-001, 4.179250e-001,
+4.193333e-001, 4.207300e-001, 4.221264e-001, 4.235223e-001, 4.249135e-001, 4.262989e-001, 4.276803e-001, 4.290586e-001, 4.304304e-001, 4.317994e-001,
+4.331590e-001, 4.345162e-001, 4.358676e-001, 4.372181e-001, 4.385639e-001, 4.399093e-001, 4.412535e-001, 4.425977e-001, 4.439316e-001, 4.452650e-001,
+4.465924e-001, 4.479196e-001, 4.492314e-001, 4.505421e-001, 4.518439e-001, 4.531445e-001, 4.544411e-001, 4.557370e-001, 4.570290e-001, 4.583195e-001,
+4.596051e-001, 4.608877e-001, 4.621654e-001, 4.634382e-001, 4.647068e-001, 4.659674e-001, 4.672257e-001, 4.684732e-001, 4.697207e-001, 4.709604e-001,
+4.722000e-001, 4.734327e-001, 4.746632e-001, 4.758923e-001, 4.771201e-001, 4.783450e-001, 4.795616e-001, 4.807781e-001, 4.819893e-001, 4.832003e-001,
+4.844069e-001, 4.856112e-001, 4.868122e-001, 4.880064e-001, 4.892007e-001, 4.903839e-001, 4.915669e-001, 4.927466e-001, 4.939243e-001, 4.951009e-001,
+4.962731e-001, 4.974453e-001, 4.986134e-001, 4.997802e-001, 5.009468e-001, 5.021128e-001, 5.032788e-001, 5.044375e-001, 5.055948e-001, 5.067505e-001,
+5.079033e-001, 5.090560e-001, 5.101991e-001, 5.113398e-001, 5.124808e-001, 5.136230e-001, 5.147653e-001, 5.159035e-001, 5.170397e-001, 5.181757e-001,
+5.193090e-001, 5.204423e-001, 5.215685e-001, 5.226852e-001, 5.238018e-001, 5.249151e-001, 5.260274e-001, 5.271393e-001, 5.282472e-001, 5.293550e-001,
+5.304607e-001, 5.315629e-001, 5.326650e-001, 5.337625e-001, 5.348573e-001, 5.359521e-001, 5.370397e-001, 5.381263e-001, 5.392122e-001, 5.402884e-001,
+5.413645e-001, 5.424380e-001, 5.435034e-001, 5.445688e-001, 5.456322e-001, 5.466927e-001, 5.477532e-001, 5.488079e-001, 5.498570e-001, 5.509062e-001,
+5.519514e-001, 5.529940e-001, 5.540365e-001, 5.550706e-001, 5.561003e-001, 5.571299e-001, 5.581539e-001, 5.591754e-001, 5.601969e-001, 5.612133e-001,
+5.622273e-001, 5.632413e-001, 5.642499e-001, 5.652556e-001, 5.662613e-001, 5.672616e-001, 5.682581e-001, 5.692546e-001, 5.702463e-001, 5.712331e-001,
+5.722199e-001, 5.732025e-001, 5.741783e-001, 5.751540e-001, 5.761274e-001, 5.770921e-001, 5.780568e-001, 5.790213e-001, 5.799819e-001, 5.809425e-001,
+5.819031e-001, 5.828554e-001, 5.838057e-001, 5.847560e-001, 5.857037e-001, 5.866494e-001, 5.875951e-001, 5.885379e-001, 5.894731e-001, 5.904083e-001,
+5.913434e-001, 5.922747e-001, 5.932056e-001, 5.941366e-001, 5.950687e-001, 5.960016e-001, 5.969345e-001, 5.978664e-001, 5.987946e-001, 5.997229e-001,
+6.006512e-001, 6.015707e-001, 6.024879e-001, 6.034051e-001, 6.043200e-001, 6.052304e-001, 6.061407e-001, 6.070510e-001, 6.079521e-001, 6.088514e-001,
+6.097507e-001, 6.106486e-001, 6.115433e-001, 6.124380e-001, 6.133326e-001, 6.142239e-001, 6.151140e-001, 6.160040e-001, 6.168933e-001, 6.177780e-001,
+6.186627e-001, 6.195474e-001, 6.204267e-001, 6.213008e-001, 6.221749e-001, 6.230490e-001, 6.239190e-001, 6.247883e-001, 6.256575e-001, 6.265254e-001,
+6.273845e-001, 6.282437e-001, 6.291028e-001, 6.299603e-001, 6.308152e-001, 6.316700e-001, 6.325249e-001, 6.333741e-001, 6.342193e-001, 6.350646e-001,
+6.359099e-001, 6.367524e-001, 6.375942e-001, 6.384360e-001, 6.392777e-001, 6.401113e-001, 6.409441e-001, 6.417768e-001, 6.426096e-001, 6.434396e-001,
+6.442696e-001, 6.450997e-001, 6.459291e-001, 6.467508e-001, 6.475725e-001, 6.483941e-001, 6.492156e-001, 6.500353e-001, 6.508549e-001, 6.516745e-001,
+6.524935e-001, 6.533044e-001, 6.541154e-001, 6.549263e-001, 6.557372e-001, 6.565401e-001, 6.573430e-001, 6.581459e-001, 6.589488e-001, 6.597451e-001,
+6.605407e-001, 6.613362e-001, 6.621318e-001, 6.629224e-001, 6.637114e-001, 6.645004e-001, 6.652893e-001, 6.660748e-001, 6.668576e-001, 6.676404e-001,
+6.684232e-001, 6.692042e-001, 6.699816e-001, 6.707590e-001, 6.715364e-001, 6.723133e-001, 6.730848e-001, 6.738562e-001, 6.746276e-001, 6.753990e-001,
+6.761629e-001, 6.769244e-001, 6.776859e-001, 6.784474e-001, 6.792098e-001, 6.799734e-001, 6.807371e-001, 6.815007e-001, 6.822644e-001, 6.830213e-001,
+6.837782e-001, 6.845351e-001, 6.852920e-001, 6.860478e-001, 6.868026e-001, 6.875574e-001, 6.883122e-001, 6.890667e-001, 6.898154e-001, 6.905640e-001,
+6.913127e-001, 6.920614e-001, 6.928065e-001, 6.935483e-001, 6.942901e-001, 6.950319e-001, 6.957737e-001, 6.965092e-001, 6.972442e-001, 6.979792e-001,
+6.987142e-001, 6.994476e-001, 7.001775e-001, 7.009073e-001, 7.016372e-001, 7.023670e-001, 7.030939e-001, 7.038190e-001, 7.045442e-001, 7.052693e-001,
+7.059944e-001, 7.067067e-001, 7.074177e-001, 7.081286e-001, 7.088395e-001, 7.095499e-001, 7.102572e-001, 7.109644e-001, 7.116716e-001, 7.123788e-001,
+7.130823e-001, 7.137774e-001, 7.144724e-001, 7.151675e-001, 7.158626e-001, 7.165569e-001, 7.172503e-001, 7.179437e-001, 7.186371e-001, 7.193305e-001,
+7.200188e-001, 7.207022e-001, 7.213857e-001, 7.220691e-001, 7.227526e-001, 7.234363e-001, 7.241201e-001, 7.248040e-001, 7.254879e-001, 7.261718e-001,
+7.268511e-001, 7.275264e-001, 7.282017e-001, 7.288769e-001, 7.295522e-001, 7.302260e-001, 7.308981e-001, 7.315703e-001, 7.322424e-001, 7.329145e-001,
+7.335844e-001, 7.342496e-001, 7.349149e-001, 7.355802e-001, 7.362454e-001, 7.369098e-001, 7.375694e-001, 7.382289e-001, 7.388885e-001, 7.395481e-001,
+7.402076e-001, 7.408636e-001, 7.415193e-001, 7.421751e-001, 7.428308e-001, 7.434865e-001, 7.441367e-001, 7.447839e-001, 7.454311e-001, 7.460783e-001,
+7.467255e-001, 7.473719e-001, 7.480166e-001, 7.486614e-001, 7.493061e-001, 7.499509e-001, 7.505957e-001, 7.512348e-001, 7.518735e-001, 7.525122e-001,
+7.531509e-001, 7.537896e-001, 7.544282e-001, 7.550667e-001, 7.557052e-001, 7.563437e-001, 7.569822e-001, 7.576207e-001, 7.582558e-001, 7.588909e-001,
+7.595259e-001, 7.601609e-001, 7.607960e-001, 7.614320e-001, 7.620692e-001, 7.627064e-001, 7.633437e-001, 7.639809e-001, 7.646181e-001, 7.652487e-001,
+7.658780e-001, 7.665072e-001, 7.671365e-001, 7.677657e-001, 7.683939e-001, 7.690164e-001, 7.696390e-001, 7.702615e-001, 7.708840e-001, 7.715066e-001,
+7.721268e-001, 7.727442e-001, 7.733615e-001, 7.739789e-001, 7.745962e-001, 7.752136e-001, 7.758283e-001, 7.764416e-001, 7.770550e-001, 7.776683e-001,
+7.782816e-001, 7.788950e-001, 7.795063e-001, 7.801172e-001, 7.807281e-001, 7.813389e-001, 7.819498e-001, 7.825607e-001, 7.831704e-001, 7.837799e-001,
+7.843894e-001, 7.849990e-001, 7.856085e-001, 7.862181e-001, 7.868278e-001, 7.874376e-001, 7.880474e-001, 7.886572e-001, 7.892670e-001, 7.898767e-001,
+7.904823e-001, 7.910876e-001, 7.916929e-001, 7.922982e-001, 7.929035e-001, 7.935088e-001, 7.941112e-001, 7.947132e-001, 7.953152e-001, 7.959172e-001,
+7.965192e-001, 7.971212e-001, 7.977177e-001, 7.983120e-001, 7.989064e-001, 7.995008e-001, 8.000951e-001, 8.006895e-001, 8.012806e-001, 8.018686e-001,
+8.024566e-001, 8.030446e-001, 8.036326e-001, 8.042206e-001, 8.048074e-001, 8.053905e-001, 8.059735e-001, 8.065566e-001, 8.071396e-001, 8.077227e-001,
+8.083057e-001, 8.088854e-001, 8.094648e-001, 8.100442e-001, 8.106236e-001, 8.112030e-001, 8.117823e-001, 8.123605e-001, 8.129375e-001, 8.135145e-001,
+8.140915e-001, 8.146685e-001, 8.152455e-001, 8.158224e-001, 8.163984e-001, 8.169744e-001, 8.175503e-001, 8.181263e-001, 8.187023e-001, 8.192782e-001,
+8.198543e-001, 8.204304e-001, 8.210066e-001, 8.215827e-001, 8.221589e-001, 8.227350e-001, 8.233111e-001, 8.238832e-001, 8.244549e-001, 8.250267e-001,
+8.255985e-001, 8.261703e-001, 8.267420e-001, 8.273130e-001, 8.278818e-001, 8.284506e-001, 8.290194e-001, 8.295883e-001, 8.301571e-001, 8.307259e-001,
+8.312906e-001, 8.318520e-001, 8.324134e-001, 8.329748e-001, 8.335362e-001, 8.340976e-001, 8.346589e-001, 8.352158e-001, 8.357713e-001, 8.363267e-001,
+8.368822e-001, 8.374376e-001, 8.379931e-001, 8.385485e-001, 8.390996e-001, 8.396501e-001, 8.402007e-001, 8.407512e-001, 8.413018e-001, 8.418524e-001,
+8.424029e-001, 8.429502e-001, 8.434973e-001, 8.440444e-001, 8.445915e-001, 8.451387e-001, 8.456858e-001, 8.462329e-001, 8.467778e-001, 8.473225e-001,
+8.478673e-001, 8.484121e-001, 8.489568e-001, 8.495016e-001, 8.500463e-001, 8.505902e-001, 8.511340e-001, 8.516778e-001, 8.522216e-001, 8.527654e-001,
+8.533092e-001, 8.538529e-001, 8.543968e-001, 8.549408e-001, 8.554847e-001, 8.560286e-001, 8.565725e-001, 8.571164e-001, 8.576604e-001, 8.582047e-001,
+8.587493e-001, 8.592940e-001, 8.598386e-001, 8.603832e-001, 8.609279e-001, 8.614725e-001, 8.620168e-001, 8.625596e-001, 8.631024e-001, 8.636453e-001,
+8.641881e-001, 8.647310e-001, 8.652738e-001, 8.658166e-001, 8.663538e-001, 8.668901e-001, 8.674264e-001, 8.679627e-001, 8.684990e-001, 8.690353e-001,
+8.695716e-001, 8.701057e-001, 8.706367e-001, 8.711677e-001, 8.716986e-001, 8.722296e-001, 8.727606e-001, 8.732916e-001, 8.738226e-001, 8.743498e-001,
+8.748767e-001, 8.754035e-001, 8.759304e-001, 8.764573e-001, 8.769841e-001, 8.775110e-001, 8.780369e-001, 8.785608e-001, 8.790847e-001, 8.796086e-001,
+8.801325e-001, 8.806564e-001, 8.811803e-001, 8.817042e-001, 8.822269e-001, 8.827491e-001, 8.832712e-001, 8.837933e-001, 8.843154e-001, 8.848375e-001,
+8.853596e-001, 8.858817e-001, 8.864021e-001, 8.869223e-001, 8.874425e-001, 8.879627e-001, 8.884829e-001, 8.890031e-001, 8.895233e-001, 8.900429e-001,
+8.905554e-001, 8.910679e-001, 8.915804e-001, 8.920929e-001, 8.926054e-001, 8.931179e-001, 8.936304e-001, 8.941423e-001, 8.946514e-001, 8.951605e-001,
+8.956696e-001, 8.961787e-001, 8.966878e-001, 8.971969e-001, 8.977060e-001, 8.982140e-001, 8.987173e-001, 8.992206e-001, 8.997240e-001, 9.002273e-001,
+9.007306e-001, 9.012340e-001, 9.017373e-001, 9.022400e-001, 9.027382e-001, 9.032364e-001, 9.037346e-001, 9.042328e-001, 9.047310e-001, 9.052292e-001,
+9.057274e-001, 9.062256e-001, 9.067198e-001, 9.072140e-001, 9.077082e-001, 9.082024e-001, 9.086965e-001, 9.091907e-001, 9.096849e-001, 9.101791e-001,
+9.106712e-001, 9.111627e-001, 9.116541e-001, 9.121456e-001, 9.126371e-001, 9.131285e-001, 9.136200e-001, 9.141114e-001, 9.146016e-001, 9.150901e-001,
+9.155786e-001, 9.160671e-001, 9.165556e-001, 9.170441e-001, 9.175326e-001, 9.180211e-001, 9.185094e-001, 9.189893e-001, 9.194692e-001, 9.199491e-001,
+9.204290e-001, 9.209089e-001, 9.213888e-001, 9.218687e-001, 9.223487e-001, 9.228286e-001, 9.233085e-001, 9.237885e-001, 9.242684e-001, 9.247484e-001,
+9.252283e-001, 9.257082e-001, 9.261882e-001, 9.266681e-001, 9.271426e-001, 9.276170e-001, 9.280914e-001, 9.285659e-001, 9.290403e-001, 9.295147e-001,
+9.299891e-001, 9.304635e-001, 9.309374e-001, 9.314104e-001, 9.318833e-001, 9.323562e-001, 9.328291e-001, 9.333021e-001, 9.337750e-001, 9.342479e-001,
+9.347209e-001, 9.351913e-001, 9.356600e-001, 9.361287e-001, 9.365974e-001, 9.370660e-001, 9.375347e-001, 9.380034e-001, 9.384721e-001, 9.389408e-001,
+9.394043e-001, 9.398661e-001, 9.403278e-001, 9.407896e-001, 9.412514e-001, 9.417132e-001, 9.421750e-001, 9.426368e-001, 9.430986e-001, 9.435577e-001,
+9.440164e-001, 9.444751e-001, 9.449337e-001, 9.453924e-001, 9.458510e-001, 9.463097e-001, 9.467684e-001, 9.472270e-001, 9.476766e-001, 9.481242e-001,
+9.485718e-001, 9.490194e-001, 9.494670e-001, 9.499146e-001, 9.503622e-001, 9.508098e-001, 9.512574e-001, 9.517037e-001, 9.521496e-001, 9.525955e-001,
+9.530413e-001, 9.534872e-001, 9.539331e-001, 9.543790e-001, 9.548248e-001, 9.552707e-001, 9.557142e-001, 9.561555e-001, 9.565968e-001, 9.570381e-001,
+9.574795e-001, 9.579208e-001, 9.583621e-001, 9.588034e-001, 9.592447e-001, 9.596858e-001, 9.601259e-001, 9.605661e-001, 9.610063e-001, 9.614465e-001,
+9.618866e-001, 9.623268e-001, 9.627670e-001, 9.632071e-001, 9.636473e-001, 9.640841e-001, 9.645203e-001, 9.649565e-001, 9.653928e-001, 9.658290e-001,
+9.662652e-001, 9.667014e-001, 9.671376e-001, 9.675738e-001, 9.680084e-001, 9.684402e-001, 9.688721e-001, 9.693039e-001, 9.697357e-001, 9.701675e-001,
+9.705993e-001, 9.710311e-001, 9.714629e-001, 9.718947e-001, 9.723226e-001, 9.727494e-001, 9.731763e-001, 9.736031e-001, 9.740299e-001, 9.744567e-001,
+9.748836e-001, 9.753104e-001, 9.757372e-001, 9.761634e-001, 9.765845e-001, 9.770057e-001, 9.774269e-001, 9.778481e-001, 9.782692e-001, 9.786904e-001,
+9.791116e-001, 9.795328e-001, 9.799539e-001, 9.803730e-001, 9.807883e-001, 9.812036e-001, 9.816189e-001, 9.820342e-001, 9.824495e-001, 9.828648e-001,
+9.832801e-001, 9.836954e-001, 9.841107e-001, 9.845234e-001, 9.849332e-001, 9.853430e-001, 9.857528e-001, 9.861627e-001, 9.865725e-001, 9.869823e-001,
+9.873921e-001, 9.878020e-001, 9.882118e-001, 9.886144e-001, 9.890103e-001, 9.894062e-001, 9.898021e-001, 9.901981e-001, 9.905940e-001, 9.909899e-001,
+9.913858e-001, 9.917817e-001, 9.921776e-001, 9.925646e-001, 9.929406e-001, 9.933165e-001, 9.936925e-001, 9.940684e-001, 9.944444e-001, 9.948204e-001,
+9.951963e-001, 9.955723e-001, 9.959482e-001, 9.963219e-001, 9.966898e-001, 9.970576e-001, 9.974254e-001, 9.977932e-001, 9.981610e-001, 9.985288e-001,
+9.988966e-001, 9.992644e-001, 9.996322e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.372150e-003, 1.261597e-002, 1.836141e-002, 2.367313e-002, 2.868206e-002, 3.338079e-002, 3.788088e-002, 4.211441e-002, 4.619656e-002,
+5.017931e-002, 5.400684e-002, 5.766502e-002, 6.122684e-002, 6.470462e-002, 6.812250e-002, 7.149344e-002, 7.477768e-002, 7.795528e-002, 8.105539e-002,
+8.413333e-002, 8.718906e-002, 9.020541e-002, 9.316997e-002, 9.607796e-002, 9.892908e-002, 1.017358e-001, 1.045102e-001, 1.072590e-001, 1.099924e-001,
+1.126932e-001, 1.153720e-001, 1.180130e-001, 1.206170e-001, 1.231862e-001, 1.257254e-001, 1.282379e-001, 1.307227e-001, 1.331889e-001, 1.356364e-001,
+1.380719e-001, 1.404998e-001, 1.429185e-001, 1.453086e-001, 1.476782e-001, 1.500300e-001, 1.523581e-001, 1.546710e-001, 1.569592e-001, 1.592251e-001,
+1.614682e-001, 1.636908e-001, 1.659017e-001, 1.680952e-001, 1.702757e-001, 1.724484e-001, 1.746093e-001, 1.767640e-001, 1.789054e-001, 1.810387e-001,
+1.831597e-001, 1.852662e-001, 1.873624e-001, 1.894448e-001, 1.915136e-001, 1.935654e-001, 1.956079e-001, 1.976383e-001, 1.996645e-001, 2.016757e-001,
+2.036696e-001, 2.056520e-001, 2.076213e-001, 2.095845e-001, 2.115366e-001, 2.134786e-001, 2.154117e-001, 2.173403e-001, 2.192643e-001, 2.211791e-001,
+2.230885e-001, 2.249957e-001, 2.268918e-001, 2.287833e-001, 2.306707e-001, 2.325449e-001, 2.344118e-001, 2.362739e-001, 2.381277e-001, 2.399803e-001,
+2.418286e-001, 2.436630e-001, 2.454881e-001, 2.473085e-001, 2.491196e-001, 2.509352e-001, 2.527474e-001, 2.545492e-001, 2.563391e-001, 2.581260e-001,
+2.599045e-001, 2.616701e-001, 2.634266e-001, 2.651784e-001, 2.669197e-001, 2.686526e-001, 2.703749e-001, 2.720900e-001, 2.738001e-001, 2.755038e-001,
+2.772029e-001, 2.788943e-001, 2.805776e-001, 2.822565e-001, 2.839331e-001, 2.856018e-001, 2.872671e-001, 2.889324e-001, 2.905948e-001, 2.922507e-001,
+2.938999e-001, 2.955498e-001, 2.971961e-001, 2.988429e-001, 3.004920e-001, 3.021434e-001, 3.037939e-001, 3.054369e-001, 3.070758e-001, 3.087132e-001,
+3.103515e-001, 3.119843e-001, 3.136083e-001, 3.152262e-001, 3.168403e-001, 3.184513e-001, 3.200559e-001, 3.216532e-001, 3.232400e-001, 3.248241e-001,
+3.264040e-001, 3.279787e-001, 3.295400e-001, 3.310950e-001, 3.326451e-001, 3.341902e-001, 3.357275e-001, 3.372594e-001, 3.387842e-001, 3.403008e-001,
+3.418123e-001, 3.433168e-001, 3.448176e-001, 3.463155e-001, 3.478058e-001, 3.492931e-001, 3.507779e-001, 3.522605e-001, 3.537409e-001, 3.552181e-001,
+3.566935e-001, 3.581684e-001, 3.596439e-001, 3.611176e-001, 3.625897e-001, 3.640539e-001, 3.655145e-001, 3.669649e-001, 3.684151e-001, 3.698649e-001,
+3.713107e-001, 3.727547e-001, 3.741906e-001, 3.756246e-001, 3.770547e-001, 3.784829e-001, 3.799099e-001, 3.813312e-001, 3.827509e-001, 3.841583e-001,
+3.855641e-001, 3.869630e-001, 3.883577e-001, 3.897453e-001, 3.911296e-001, 3.925110e-001, 3.938844e-001, 3.952536e-001, 3.966164e-001, 3.979771e-001,
+3.993297e-001, 4.006810e-001, 4.020248e-001, 4.033681e-001, 4.046999e-001, 4.060314e-001, 4.073561e-001, 4.086807e-001, 4.100016e-001, 4.113223e-001,
+4.126364e-001, 4.139506e-001, 4.152606e-001, 4.165706e-001, 4.178736e-001, 4.191764e-001, 4.204704e-001, 4.217636e-001, 4.230574e-001, 4.243515e-001,
+4.256448e-001, 4.269378e-001, 4.282276e-001, 4.295151e-001, 4.307982e-001, 4.320754e-001, 4.333496e-001, 4.346149e-001, 4.358800e-001, 4.371437e-001,
+4.384073e-001, 4.396675e-001, 4.409271e-001, 4.421825e-001, 4.434352e-001, 4.446886e-001, 4.459435e-001, 4.471982e-001, 4.484477e-001, 4.496972e-001,
+4.509449e-001, 4.521920e-001, 4.534366e-001, 4.546774e-001, 4.559177e-001, 4.571488e-001, 4.583799e-001, 4.596010e-001, 4.608171e-001, 4.620309e-001,
+4.632384e-001, 4.644458e-001, 4.656499e-001, 4.668533e-001, 4.680535e-001, 4.692485e-001, 4.704435e-001, 4.716281e-001, 4.728116e-001, 4.739918e-001,
+4.751671e-001, 4.763424e-001, 4.775088e-001, 4.786739e-001, 4.798346e-001, 4.809860e-001, 4.821374e-001, 4.832834e-001, 4.844275e-001, 4.855713e-001,
+4.867131e-001, 4.878548e-001, 4.889939e-001, 4.901303e-001, 4.912667e-001, 4.923954e-001, 4.935226e-001, 4.946480e-001, 4.957635e-001, 4.968789e-001,
+4.979912e-001, 4.990995e-001, 5.002077e-001, 5.013095e-001, 5.024084e-001, 5.035073e-001, 5.045971e-001, 5.056863e-001, 5.067745e-001, 5.078564e-001,
+5.089382e-001, 5.100174e-001, 5.110904e-001, 5.121634e-001, 5.132341e-001, 5.143021e-001, 5.153702e-001, 5.164344e-001, 5.174958e-001, 5.185572e-001,
+5.196129e-001, 5.206657e-001, 5.217186e-001, 5.227681e-001, 5.238164e-001, 5.248647e-001, 5.259052e-001, 5.269432e-001, 5.279811e-001, 5.290176e-001,
+5.300536e-001, 5.310897e-001, 5.321198e-001, 5.331475e-001, 5.341753e-001, 5.351999e-001, 5.362228e-001, 5.372457e-001, 5.382615e-001, 5.392718e-001,
+5.402820e-001, 5.412889e-001, 5.422913e-001, 5.432938e-001, 5.442952e-001, 5.452940e-001, 5.462927e-001, 5.472911e-001, 5.482859e-001, 5.492806e-001,
+5.502753e-001, 5.512647e-001, 5.522533e-001, 5.532418e-001, 5.542264e-001, 5.552084e-001, 5.561903e-001, 5.571714e-001, 5.581505e-001, 5.591297e-001,
+5.601087e-001, 5.610770e-001, 5.620453e-001, 5.630136e-001, 5.639782e-001, 5.649409e-001, 5.659035e-001, 5.668659e-001, 5.678273e-001, 5.687887e-001,
+5.697501e-001, 5.707089e-001, 5.716671e-001, 5.726254e-001, 5.735798e-001, 5.745281e-001, 5.754765e-001, 5.764249e-001, 5.773686e-001, 5.783117e-001,
+5.792549e-001, 5.801956e-001, 5.811320e-001, 5.820685e-001, 5.830049e-001, 5.839343e-001, 5.848620e-001, 5.857897e-001, 5.867152e-001, 5.876328e-001,
+5.885503e-001, 5.894679e-001, 5.903825e-001, 5.912950e-001, 5.922074e-001, 5.931199e-001, 5.940276e-001, 5.949348e-001, 5.958420e-001, 5.967482e-001,
+5.976504e-001, 5.985526e-001, 5.994548e-001, 6.003562e-001, 6.012568e-001, 6.021573e-001, 6.030578e-001, 6.039532e-001, 6.048460e-001, 6.057388e-001,
+6.066315e-001, 6.075203e-001, 6.084082e-001, 6.092961e-001, 6.101841e-001, 6.110618e-001, 6.119392e-001, 6.128166e-001, 6.136940e-001, 6.145706e-001,
+6.154471e-001, 6.163237e-001, 6.171987e-001, 6.180636e-001, 6.189286e-001, 6.197935e-001, 6.206580e-001, 6.215201e-001, 6.223822e-001, 6.232443e-001,
+6.241046e-001, 6.249533e-001, 6.258019e-001, 6.266506e-001, 6.274989e-001, 6.283429e-001, 6.291870e-001, 6.300310e-001, 6.308750e-001, 6.317095e-001,
+6.325437e-001, 6.333778e-001, 6.342120e-001, 6.350418e-001, 6.358707e-001, 6.366995e-001, 6.375284e-001, 6.383499e-001, 6.391671e-001, 6.399844e-001,
+6.408016e-001, 6.416165e-001, 6.424280e-001, 6.432395e-001, 6.440510e-001, 6.448624e-001, 6.456730e-001, 6.464836e-001, 6.472943e-001, 6.481049e-001,
+6.489097e-001, 6.497133e-001, 6.505168e-001, 6.513203e-001, 6.521202e-001, 6.529156e-001, 6.537111e-001, 6.545065e-001, 6.553019e-001, 6.560960e-001,
+6.568901e-001, 6.576842e-001, 6.584784e-001, 6.592714e-001, 6.600636e-001, 6.608559e-001, 6.616481e-001, 6.624394e-001, 6.632228e-001, 6.640062e-001,
+6.647896e-001, 6.655731e-001, 6.663510e-001, 6.671250e-001, 6.678989e-001, 6.686729e-001, 6.694468e-001, 6.702173e-001, 6.709877e-001, 6.717582e-001,
+6.725287e-001, 6.732978e-001, 6.740645e-001, 6.748312e-001, 6.755979e-001, 6.763646e-001, 6.771286e-001, 6.778912e-001, 6.786539e-001, 6.794166e-001,
+6.801793e-001, 6.809418e-001, 6.817043e-001, 6.824668e-001, 6.832294e-001, 6.839908e-001, 6.847469e-001, 6.855030e-001, 6.862591e-001, 6.870153e-001,
+6.877691e-001, 6.885187e-001, 6.892683e-001, 6.900179e-001, 6.907675e-001, 6.915169e-001, 6.922663e-001, 6.930156e-001, 6.937650e-001, 6.945143e-001,
+6.952630e-001, 6.960112e-001, 6.967594e-001, 6.975076e-001, 6.982559e-001, 6.990030e-001, 6.997493e-001, 7.004957e-001, 7.012420e-001, 7.019884e-001,
+7.027307e-001, 7.034699e-001, 7.042092e-001, 7.049485e-001, 7.056878e-001, 7.064262e-001, 7.071639e-001, 7.079015e-001, 7.086392e-001, 7.093768e-001,
+7.101136e-001, 7.108489e-001, 7.115842e-001, 7.123195e-001, 7.130548e-001, 7.137894e-001, 7.145213e-001, 7.152532e-001, 7.159852e-001, 7.167171e-001,
+7.174490e-001, 7.181727e-001, 7.188962e-001, 7.196196e-001, 7.203431e-001, 7.210666e-001, 7.217879e-001, 7.225084e-001, 7.232288e-001, 7.239493e-001,
+7.246697e-001, 7.253889e-001, 7.261058e-001, 7.268227e-001, 7.275396e-001, 7.282565e-001, 7.289734e-001, 7.296857e-001, 7.303979e-001, 7.311101e-001,
+7.318223e-001, 7.325345e-001, 7.332416e-001, 7.339442e-001, 7.346469e-001, 7.353496e-001, 7.360522e-001, 7.367547e-001, 7.374517e-001, 7.381488e-001,
+7.388459e-001, 7.395429e-001, 7.402400e-001, 7.409329e-001, 7.416214e-001, 7.423098e-001, 7.429983e-001, 7.436867e-001, 7.443752e-001, 7.450602e-001,
+7.457447e-001, 7.464292e-001, 7.471137e-001, 7.477982e-001, 7.484809e-001, 7.491563e-001, 7.498318e-001, 7.505073e-001, 7.511828e-001, 7.518583e-001,
+7.525312e-001, 7.532013e-001, 7.538714e-001, 7.545415e-001, 7.552116e-001, 7.558817e-001, 7.565455e-001, 7.572067e-001, 7.578678e-001, 7.585290e-001,
+7.591902e-001, 7.598513e-001, 7.605092e-001, 7.611665e-001, 7.618238e-001, 7.624811e-001, 7.631384e-001, 7.637957e-001, 7.644450e-001, 7.650939e-001,
+7.657429e-001, 7.663918e-001, 7.670407e-001, 7.676897e-001, 7.683332e-001, 7.689768e-001, 7.696204e-001, 7.702640e-001, 7.709075e-001, 7.715511e-001,
+7.721858e-001, 7.728203e-001, 7.734548e-001, 7.740893e-001, 7.747238e-001, 7.753583e-001, 7.759895e-001, 7.766203e-001, 7.772511e-001, 7.778819e-001,
+7.785127e-001, 7.791435e-001, 7.797755e-001, 7.804080e-001, 7.810404e-001, 7.816728e-001, 7.823052e-001, 7.829377e-001, 7.835683e-001, 7.841975e-001,
+7.848266e-001, 7.854558e-001, 7.860850e-001, 7.867142e-001, 7.873411e-001, 7.879622e-001, 7.885833e-001, 7.892044e-001, 7.898255e-001, 7.904466e-001,
+7.910677e-001, 7.916854e-001, 7.923029e-001, 7.929205e-001, 7.935380e-001, 7.941556e-001, 7.947731e-001, 7.953893e-001, 7.960044e-001, 7.966196e-001,
+7.972347e-001, 7.978498e-001, 7.984649e-001, 7.990798e-001, 7.996929e-001, 8.003060e-001, 8.009191e-001, 8.015322e-001, 8.021453e-001, 8.027585e-001,
+8.033678e-001, 8.039744e-001, 8.045809e-001, 8.051874e-001, 8.057940e-001, 8.064005e-001, 8.070070e-001, 8.076115e-001, 8.082158e-001, 8.088202e-001,
+8.094245e-001, 8.100289e-001, 8.106333e-001, 8.112372e-001, 8.118402e-001, 8.124432e-001, 8.130462e-001, 8.136493e-001, 8.142523e-001, 8.148553e-001,
+8.154579e-001, 8.160601e-001, 8.166624e-001, 8.172647e-001, 8.178669e-001, 8.184692e-001, 8.190715e-001, 8.196697e-001, 8.202668e-001, 8.208639e-001,
+8.214611e-001, 8.220582e-001, 8.226553e-001, 8.232525e-001, 8.238488e-001, 8.244450e-001, 8.250412e-001, 8.256375e-001, 8.262337e-001, 8.268299e-001,
+8.274262e-001, 8.280221e-001, 8.286180e-001, 8.292139e-001, 8.298098e-001, 8.304056e-001, 8.310015e-001, 8.315974e-001, 8.321937e-001, 8.327900e-001,
+8.333863e-001, 8.339826e-001, 8.345789e-001, 8.351752e-001, 8.357715e-001, 8.363643e-001, 8.369568e-001, 8.375492e-001, 8.381417e-001, 8.387341e-001,
+8.393266e-001, 8.399190e-001, 8.405117e-001, 8.411043e-001, 8.416970e-001, 8.422897e-001, 8.428824e-001, 8.434751e-001, 8.440678e-001, 8.446561e-001,
+8.452409e-001, 8.458257e-001, 8.464105e-001, 8.469954e-001, 8.475802e-001, 8.481650e-001, 8.487497e-001, 8.493342e-001, 8.499186e-001, 8.505031e-001,
+8.510875e-001, 8.516720e-001, 8.522564e-001, 8.528409e-001, 8.534224e-001, 8.540035e-001, 8.545846e-001, 8.551658e-001, 8.557469e-001, 8.563281e-001,
+8.569092e-001, 8.574906e-001, 8.580724e-001, 8.586542e-001, 8.592360e-001, 8.598178e-001, 8.603996e-001, 8.609814e-001, 8.615632e-001, 8.621374e-001,
+8.627110e-001, 8.632846e-001, 8.638583e-001, 8.644319e-001, 8.650055e-001, 8.655792e-001, 8.661512e-001, 8.667201e-001, 8.672890e-001, 8.678579e-001,
+8.684269e-001, 8.689958e-001, 8.695647e-001, 8.701336e-001, 8.707011e-001, 8.712678e-001, 8.718345e-001, 8.724012e-001, 8.729679e-001, 8.735347e-001,
+8.741014e-001, 8.746681e-001, 8.752362e-001, 8.758044e-001, 8.763726e-001, 8.769407e-001, 8.775089e-001, 8.780771e-001, 8.786453e-001, 8.792128e-001,
+8.797737e-001, 8.803347e-001, 8.808956e-001, 8.814566e-001, 8.820175e-001, 8.825785e-001, 8.831394e-001, 8.836997e-001, 8.842570e-001, 8.848144e-001,
+8.853718e-001, 8.859291e-001, 8.864865e-001, 8.870439e-001, 8.876012e-001, 8.881582e-001, 8.887139e-001, 8.892695e-001, 8.898251e-001, 8.903807e-001,
+8.909364e-001, 8.914920e-001, 8.920476e-001, 8.926030e-001, 8.931568e-001, 8.937106e-001, 8.942644e-001, 8.948182e-001, 8.953720e-001, 8.959259e-001,
+8.964797e-001, 8.970335e-001, 8.975815e-001, 8.981294e-001, 8.986774e-001, 8.992254e-001, 8.997734e-001, 9.003213e-001, 9.008693e-001, 9.014173e-001,
+9.019637e-001, 9.025097e-001, 9.030556e-001, 9.036016e-001, 9.041476e-001, 9.046935e-001, 9.052395e-001, 9.057855e-001, 9.063287e-001, 9.068686e-001,
+9.074086e-001, 9.079485e-001, 9.084884e-001, 9.090284e-001, 9.095683e-001, 9.101082e-001, 9.106479e-001, 9.111826e-001, 9.117174e-001, 9.122521e-001,
+9.127868e-001, 9.133216e-001, 9.138563e-001, 9.143911e-001, 9.149258e-001, 9.154574e-001, 9.159867e-001, 9.165160e-001, 9.170453e-001, 9.175746e-001,
+9.181039e-001, 9.186331e-001, 9.191624e-001, 9.196917e-001, 9.202163e-001, 9.207410e-001, 9.212656e-001, 9.217903e-001, 9.223149e-001, 9.228395e-001,
+9.233642e-001, 9.238888e-001, 9.244118e-001, 9.249316e-001, 9.254514e-001, 9.259712e-001, 9.264910e-001, 9.270108e-001, 9.275306e-001, 9.280504e-001,
+9.285702e-001, 9.290875e-001, 9.296032e-001, 9.301189e-001, 9.306346e-001, 9.311503e-001, 9.316661e-001, 9.321818e-001, 9.326975e-001, 9.332132e-001,
+9.337258e-001, 9.342374e-001, 9.347491e-001, 9.352607e-001, 9.357724e-001, 9.362840e-001, 9.367957e-001, 9.373073e-001, 9.378190e-001, 9.383267e-001,
+9.388336e-001, 9.393406e-001, 9.398475e-001, 9.403545e-001, 9.408614e-001, 9.413684e-001, 9.418753e-001, 9.423823e-001, 9.428793e-001, 9.433744e-001,
+9.438694e-001, 9.443645e-001, 9.448595e-001, 9.453546e-001, 9.458496e-001, 9.463447e-001, 9.468397e-001, 9.473327e-001, 9.478249e-001, 9.483171e-001,
+9.488093e-001, 9.493015e-001, 9.497937e-001, 9.502858e-001, 9.507780e-001, 9.512702e-001, 9.517591e-001, 9.522450e-001, 9.527309e-001, 9.532168e-001,
+9.537026e-001, 9.541885e-001, 9.546744e-001, 9.551603e-001, 9.556462e-001, 9.561312e-001, 9.566132e-001, 9.570953e-001, 9.575773e-001, 9.580594e-001,
+9.585415e-001, 9.590235e-001, 9.595056e-001, 9.599876e-001, 9.604697e-001, 9.609463e-001, 9.614219e-001, 9.618975e-001, 9.623732e-001, 9.628488e-001,
+9.633244e-001, 9.638001e-001, 9.642757e-001, 9.647514e-001, 9.652252e-001, 9.656959e-001, 9.661666e-001, 9.666374e-001, 9.671081e-001, 9.675788e-001,
+9.680496e-001, 9.685203e-001, 9.689910e-001, 9.694618e-001, 9.699271e-001, 9.703911e-001, 9.708551e-001, 9.713191e-001, 9.717831e-001, 9.722472e-001,
+9.727112e-001, 9.731752e-001, 9.736392e-001, 9.741022e-001, 9.745586e-001, 9.750150e-001, 9.754713e-001, 9.759277e-001, 9.763841e-001, 9.768405e-001,
+9.772969e-001, 9.777532e-001, 9.782096e-001, 9.786626e-001, 9.791095e-001, 9.795563e-001, 9.800032e-001, 9.804501e-001, 9.808969e-001, 9.813438e-001,
+9.817907e-001, 9.822375e-001, 9.826844e-001, 9.831274e-001, 9.835664e-001, 9.840054e-001, 9.844444e-001, 9.848833e-001, 9.853223e-001, 9.857613e-001,
+9.862003e-001, 9.866393e-001, 9.870783e-001, 9.875145e-001, 9.879483e-001, 9.883821e-001, 9.888159e-001, 9.892497e-001, 9.896834e-001, 9.901172e-001,
+9.905510e-001, 9.909848e-001, 9.914186e-001, 9.918448e-001, 9.922619e-001, 9.926789e-001, 9.930959e-001, 9.935130e-001, 9.939300e-001, 9.943470e-001,
+9.947640e-001, 9.951811e-001, 9.955981e-001, 9.960102e-001, 9.964091e-001, 9.968081e-001, 9.972071e-001, 9.976061e-001, 9.980051e-001, 9.984041e-001,
+9.988030e-001, 9.992020e-001, 9.996010e-001, 1.000000e+000)),
+("Agfa", "Advantix 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.094531e-002, 2.053933e-002, 2.906900e-002, 3.650580e-002, 4.313977e-002, 4.934695e-002, 5.531210e-002, 6.100610e-002, 6.645966e-002,
+7.172974e-002, 7.678870e-002, 8.159752e-002, 8.620756e-002, 9.071167e-002, 9.509560e-002, 9.933745e-002, 1.034375e-001, 1.073297e-001, 1.110907e-001,
+1.147644e-001, 1.184094e-001, 1.220393e-001, 1.255874e-001, 1.290600e-001, 1.324646e-001, 1.358134e-001, 1.391504e-001, 1.424382e-001, 1.457036e-001,
+1.489387e-001, 1.521473e-001, 1.553370e-001, 1.584854e-001, 1.615827e-001, 1.646398e-001, 1.676366e-001, 1.705628e-001, 1.734507e-001, 1.762888e-001,
+1.791007e-001, 1.818983e-001, 1.846773e-001, 1.874344e-001, 1.901604e-001, 1.928523e-001, 1.955167e-001, 1.981183e-001, 2.006929e-001, 2.032331e-001,
+2.057420e-001, 2.082347e-001, 2.106984e-001, 2.131627e-001, 2.156358e-001, 2.180998e-001, 2.205528e-001, 2.229814e-001, 2.253869e-001, 2.277887e-001,
+2.301834e-001, 2.325473e-001, 2.348768e-001, 2.371929e-001, 2.394970e-001, 2.417782e-001, 2.440517e-001, 2.463242e-001, 2.485779e-001, 2.508258e-001,
+2.530737e-001, 2.553016e-001, 2.575268e-001, 2.597568e-001, 2.619835e-001, 2.641938e-001, 2.663999e-001, 2.686053e-001, 2.708081e-001, 2.730023e-001,
+2.751887e-001, 2.773591e-001, 2.795172e-001, 2.816727e-001, 2.838137e-001, 2.859255e-001, 2.880169e-001, 2.901125e-001, 2.922055e-001, 2.942928e-001,
+2.963638e-001, 2.984222e-001, 3.004607e-001, 3.024761e-001, 3.044943e-001, 3.065182e-001, 3.085377e-001, 3.105515e-001, 3.125489e-001, 3.145506e-001,
+3.165509e-001, 3.185442e-001, 3.205362e-001, 3.225252e-001, 3.245143e-001, 3.265058e-001, 3.284948e-001, 3.304775e-001, 3.324613e-001, 3.344405e-001,
+3.364038e-001, 3.383481e-001, 3.402775e-001, 3.422004e-001, 3.441283e-001, 3.460585e-001, 3.479808e-001, 3.498909e-001, 3.517874e-001, 3.536739e-001,
+3.555469e-001, 3.574047e-001, 3.592504e-001, 3.610936e-001, 3.629258e-001, 3.647487e-001, 3.665608e-001, 3.683532e-001, 3.701290e-001, 3.719004e-001,
+3.736708e-001, 3.754306e-001, 3.771796e-001, 3.789180e-001, 3.806398e-001, 3.823508e-001, 3.840553e-001, 3.857526e-001, 3.874310e-001, 3.890962e-001,
+3.907422e-001, 3.923804e-001, 3.940139e-001, 3.956401e-001, 3.972538e-001, 3.988598e-001, 4.004508e-001, 4.020317e-001, 4.036058e-001, 4.051836e-001,
+4.067602e-001, 4.083349e-001, 4.099013e-001, 4.114633e-001, 4.130124e-001, 4.145576e-001, 4.160980e-001, 4.176266e-001, 4.191510e-001, 4.206665e-001,
+4.221807e-001, 4.236926e-001, 4.251953e-001, 4.266925e-001, 4.281755e-001, 4.296550e-001, 4.311213e-001, 4.325863e-001, 4.340479e-001, 4.355045e-001,
+4.369558e-001, 4.384001e-001, 4.398407e-001, 4.412649e-001, 4.426849e-001, 4.440922e-001, 4.454985e-001, 4.469017e-001, 4.483038e-001, 4.496976e-001,
+4.510863e-001, 4.524526e-001, 4.538141e-001, 4.551595e-001, 4.565045e-001, 4.578481e-001, 4.591887e-001, 4.605211e-001, 4.618496e-001, 4.631653e-001,
+4.644770e-001, 4.657724e-001, 4.670655e-001, 4.683431e-001, 4.696203e-001, 4.708896e-001, 4.721588e-001, 4.734267e-001, 4.746944e-001, 4.759571e-001,
+4.772185e-001, 4.784703e-001, 4.797169e-001, 4.809588e-001, 4.821955e-001, 4.834313e-001, 4.846647e-001, 4.858981e-001, 4.871314e-001, 4.883647e-001,
+4.895891e-001, 4.908112e-001, 4.920256e-001, 4.932330e-001, 4.944369e-001, 4.956291e-001, 4.968214e-001, 4.980075e-001, 4.991930e-001, 5.003730e-001,
+5.015486e-001, 5.027217e-001, 5.038836e-001, 5.050455e-001, 5.061965e-001, 5.073444e-001, 5.084874e-001, 5.096217e-001, 5.107561e-001, 5.118848e-001,
+5.130129e-001, 5.141406e-001, 5.152677e-001, 5.163948e-001, 5.175107e-001, 5.186256e-001, 5.197320e-001, 5.208250e-001, 5.219179e-001, 5.230033e-001,
+5.240870e-001, 5.251714e-001, 5.262576e-001, 5.273438e-001, 5.284274e-001, 5.295094e-001, 5.305913e-001, 5.316657e-001, 5.327398e-001, 5.338105e-001,
+5.348731e-001, 5.359357e-001, 5.369876e-001, 5.380325e-001, 5.390774e-001, 5.401139e-001, 5.411492e-001, 5.421839e-001, 5.432151e-001, 5.442463e-001,
+5.452745e-001, 5.462963e-001, 5.473181e-001, 5.483338e-001, 5.493434e-001, 5.503531e-001, 5.513597e-001, 5.523648e-001, 5.533698e-001, 5.543758e-001,
+5.553821e-001, 5.563883e-001, 5.573911e-001, 5.583933e-001, 5.593955e-001, 5.603915e-001, 5.613868e-001, 5.623821e-001, 5.633685e-001, 5.643542e-001,
+5.653399e-001, 5.663122e-001, 5.672834e-001, 5.682545e-001, 5.692140e-001, 5.701719e-001, 5.711298e-001, 5.720816e-001, 5.730318e-001, 5.739821e-001,
+5.749322e-001, 5.758822e-001, 5.768322e-001, 5.777808e-001, 5.787283e-001, 5.796758e-001, 5.806187e-001, 5.815542e-001, 5.824897e-001, 5.834231e-001,
+5.843461e-001, 5.852691e-001, 5.861921e-001, 5.871120e-001, 5.880316e-001, 5.889511e-001, 5.898649e-001, 5.907755e-001, 5.916861e-001, 5.925920e-001,
+5.934881e-001, 5.943842e-001, 5.952802e-001, 5.961638e-001, 5.970470e-001, 5.979302e-001, 5.988096e-001, 5.996861e-001, 6.005627e-001, 6.014385e-001,
+6.023103e-001, 6.031821e-001, 6.040539e-001, 6.049264e-001, 6.057993e-001, 6.066721e-001, 6.075447e-001, 6.084158e-001, 6.092870e-001, 6.101581e-001,
+6.110234e-001, 6.118857e-001, 6.127480e-001, 6.136097e-001, 6.144647e-001, 6.153196e-001, 6.161745e-001, 6.170253e-001, 6.178714e-001, 6.187175e-001,
+6.195636e-001, 6.203994e-001, 6.212329e-001, 6.220664e-001, 6.228990e-001, 6.237252e-001, 6.245513e-001, 6.253775e-001, 6.262026e-001, 6.270262e-001,
+6.278497e-001, 6.286732e-001, 6.294926e-001, 6.303093e-001, 6.311260e-001, 6.319426e-001, 6.327559e-001, 6.335682e-001, 6.343806e-001, 6.351929e-001,
+6.360029e-001, 6.368128e-001, 6.376226e-001, 6.384324e-001, 6.392395e-001, 6.400465e-001, 6.408536e-001, 6.416608e-001, 6.424686e-001, 6.432764e-001,
+6.440843e-001, 6.448921e-001, 6.456991e-001, 6.465061e-001, 6.473132e-001, 6.481201e-001, 6.489260e-001, 6.497319e-001, 6.505379e-001, 6.513439e-001,
+6.521543e-001, 6.529647e-001, 6.537752e-001, 6.545856e-001, 6.553974e-001, 6.562092e-001, 6.570211e-001, 6.578329e-001, 6.586399e-001, 6.594451e-001,
+6.602504e-001, 6.610557e-001, 6.618577e-001, 6.626570e-001, 6.634563e-001, 6.642555e-001, 6.650529e-001, 6.658458e-001, 6.666386e-001, 6.674315e-001,
+6.682243e-001, 6.690135e-001, 6.698028e-001, 6.705920e-001, 6.713813e-001, 6.721656e-001, 6.729473e-001, 6.737290e-001, 6.745107e-001, 6.752900e-001,
+6.760625e-001, 6.768351e-001, 6.776077e-001, 6.783802e-001, 6.791487e-001, 6.799163e-001, 6.806840e-001, 6.814516e-001, 6.822187e-001, 6.829848e-001,
+6.837509e-001, 6.845171e-001, 6.852832e-001, 6.860461e-001, 6.868083e-001, 6.875705e-001, 6.883327e-001, 6.890929e-001, 6.898465e-001, 6.906000e-001,
+6.913535e-001, 6.921071e-001, 6.928570e-001, 6.936046e-001, 6.943521e-001, 6.950996e-001, 6.958471e-001, 6.965920e-001, 6.973365e-001, 6.980811e-001,
+6.988256e-001, 6.995683e-001, 7.003021e-001, 7.010359e-001, 7.017697e-001, 7.025035e-001, 7.032323e-001, 7.039532e-001, 7.046742e-001, 7.053951e-001,
+7.061160e-001, 7.068320e-001, 7.075439e-001, 7.082559e-001, 7.089678e-001, 7.096798e-001, 7.103823e-001, 7.110799e-001, 7.117774e-001, 7.124750e-001,
+7.131726e-001, 7.138615e-001, 7.145470e-001, 7.152325e-001, 7.159180e-001, 7.166035e-001, 7.172851e-001, 7.179652e-001, 7.186452e-001, 7.193253e-001,
+7.200054e-001, 7.206829e-001, 7.213590e-001, 7.220352e-001, 7.227114e-001, 7.233876e-001, 7.240636e-001, 7.247394e-001, 7.254153e-001, 7.260912e-001,
+7.267671e-001, 7.274427e-001, 7.281179e-001, 7.287931e-001, 7.294683e-001, 7.301435e-001, 7.308181e-001, 7.314904e-001, 7.321627e-001, 7.328350e-001,
+7.335072e-001, 7.341795e-001, 7.348482e-001, 7.355166e-001, 7.361850e-001, 7.368534e-001, 7.375218e-001, 7.381890e-001, 7.388554e-001, 7.395219e-001,
+7.401883e-001, 7.408547e-001, 7.415206e-001, 7.421840e-001, 7.428474e-001, 7.435108e-001, 7.441742e-001, 7.448376e-001, 7.454971e-001, 7.461552e-001,
+7.468133e-001, 7.474714e-001, 7.481295e-001, 7.487858e-001, 7.494364e-001, 7.500869e-001, 7.507375e-001, 7.513881e-001, 7.520386e-001, 7.526834e-001,
+7.533256e-001, 7.539677e-001, 7.546099e-001, 7.552520e-001, 7.558939e-001, 7.565318e-001, 7.571697e-001, 7.578076e-001, 7.584454e-001, 7.590833e-001,
+7.597208e-001, 7.603575e-001, 7.609942e-001, 7.616309e-001, 7.622676e-001, 7.629043e-001, 7.635388e-001, 7.641719e-001, 7.648050e-001, 7.654382e-001,
+7.660713e-001, 7.667045e-001, 7.673383e-001, 7.679722e-001, 7.686061e-001, 7.692400e-001, 7.698740e-001, 7.705079e-001, 7.711389e-001, 7.717696e-001,
+7.724004e-001, 7.730311e-001, 7.736619e-001, 7.742926e-001, 7.749173e-001, 7.755420e-001, 7.761668e-001, 7.767915e-001, 7.774162e-001, 7.780409e-001,
+7.786604e-001, 7.792798e-001, 7.798993e-001, 7.805187e-001, 7.811382e-001, 7.817576e-001, 7.823737e-001, 7.829896e-001, 7.836055e-001, 7.842214e-001,
+7.848373e-001, 7.854532e-001, 7.860642e-001, 7.866740e-001, 7.872838e-001, 7.878936e-001, 7.885034e-001, 7.891132e-001, 7.897166e-001, 7.903157e-001,
+7.909149e-001, 7.915140e-001, 7.921132e-001, 7.927123e-001, 7.933096e-001, 7.939033e-001, 7.944970e-001, 7.950906e-001, 7.956843e-001, 7.962779e-001,
+7.968716e-001, 7.974595e-001, 7.980473e-001, 7.986352e-001, 7.992231e-001, 7.998109e-001, 8.003988e-001, 8.009813e-001, 8.015602e-001, 8.021391e-001,
+8.027181e-001, 8.032970e-001, 8.038759e-001, 8.044546e-001, 8.050319e-001, 8.056092e-001, 8.061864e-001, 8.067637e-001, 8.073409e-001, 8.079182e-001,
+8.084933e-001, 8.090669e-001, 8.096404e-001, 8.102140e-001, 8.107876e-001, 8.113611e-001, 8.119347e-001, 8.125055e-001, 8.130763e-001, 8.136470e-001,
+8.142177e-001, 8.147884e-001, 8.153592e-001, 8.159290e-001, 8.164965e-001, 8.170641e-001, 8.176316e-001, 8.181991e-001, 8.187667e-001, 8.193342e-001,
+8.198990e-001, 8.204612e-001, 8.210235e-001, 8.215858e-001, 8.221481e-001, 8.227103e-001, 8.232726e-001, 8.238356e-001, 8.243988e-001, 8.249621e-001,
+8.255254e-001, 8.260886e-001, 8.266519e-001, 8.272152e-001, 8.277787e-001, 8.283423e-001, 8.289058e-001, 8.294694e-001, 8.300330e-001, 8.305966e-001,
+8.311602e-001, 8.317218e-001, 8.322829e-001, 8.328440e-001, 8.334052e-001, 8.339663e-001, 8.345275e-001, 8.350886e-001, 8.356445e-001, 8.361988e-001,
+8.367531e-001, 8.373073e-001, 8.378616e-001, 8.384159e-001, 8.389701e-001, 8.395189e-001, 8.400645e-001, 8.406100e-001, 8.411555e-001, 8.417010e-001,
+8.422466e-001, 8.427921e-001, 8.433354e-001, 8.438756e-001, 8.444157e-001, 8.449559e-001, 8.454961e-001, 8.460362e-001, 8.465764e-001, 8.471156e-001,
+8.476483e-001, 8.481810e-001, 8.487137e-001, 8.492464e-001, 8.497790e-001, 8.503117e-001, 8.508444e-001, 8.513738e-001, 8.519021e-001, 8.524304e-001,
+8.529588e-001, 8.534871e-001, 8.540154e-001, 8.545438e-001, 8.550699e-001, 8.555914e-001, 8.561129e-001, 8.566344e-001, 8.571558e-001, 8.576773e-001,
+8.581988e-001, 8.587203e-001, 8.592393e-001, 8.597578e-001, 8.602762e-001, 8.607946e-001, 8.613131e-001, 8.618315e-001, 8.623499e-001, 8.628677e-001,
+8.633821e-001, 8.638965e-001, 8.644109e-001, 8.649253e-001, 8.654397e-001, 8.659541e-001, 8.664685e-001, 8.669799e-001, 8.674882e-001, 8.679965e-001,
+8.685047e-001, 8.690130e-001, 8.695213e-001, 8.700296e-001, 8.705379e-001, 8.710487e-001, 8.715605e-001, 8.720723e-001, 8.725841e-001, 8.730960e-001,
+8.736078e-001, 8.741196e-001, 8.746314e-001, 8.751449e-001, 8.756587e-001, 8.761725e-001, 8.766863e-001, 8.772001e-001, 8.777138e-001, 8.782276e-001,
+8.787414e-001, 8.792528e-001, 8.797639e-001, 8.802750e-001, 8.807861e-001, 8.812972e-001, 8.818083e-001, 8.823194e-001, 8.828305e-001, 8.833350e-001,
+8.838387e-001, 8.843424e-001, 8.848460e-001, 8.853497e-001, 8.858534e-001, 8.863570e-001, 8.868607e-001, 8.873575e-001, 8.878521e-001, 8.883468e-001,
+8.888415e-001, 8.893362e-001, 8.898309e-001, 8.903255e-001, 8.908202e-001, 8.913139e-001, 8.918069e-001, 8.922999e-001, 8.927929e-001, 8.932859e-001,
+8.937789e-001, 8.942718e-001, 8.947648e-001, 8.952566e-001, 8.957449e-001, 8.962332e-001, 8.967215e-001, 8.972098e-001, 8.976982e-001, 8.981865e-001,
+8.986748e-001, 8.991631e-001, 8.996483e-001, 9.001330e-001, 9.006177e-001, 9.011025e-001, 9.015872e-001, 9.020720e-001, 9.025567e-001, 9.030414e-001,
+9.035236e-001, 9.040021e-001, 9.044805e-001, 9.049589e-001, 9.054374e-001, 9.059158e-001, 9.063943e-001, 9.068727e-001, 9.073511e-001, 9.078237e-001,
+9.082951e-001, 9.087665e-001, 9.092380e-001, 9.097094e-001, 9.101808e-001, 9.106522e-001, 9.111236e-001, 9.115946e-001, 9.120635e-001, 9.125325e-001,
+9.130014e-001, 9.134704e-001, 9.139393e-001, 9.144083e-001, 9.148772e-001, 9.153461e-001, 9.158136e-001, 9.162790e-001, 9.167445e-001, 9.172099e-001,
+9.176753e-001, 9.181408e-001, 9.186062e-001, 9.190717e-001, 9.195371e-001, 9.200031e-001, 9.204695e-001, 9.209359e-001, 9.214023e-001, 9.218687e-001,
+9.223351e-001, 9.228015e-001, 9.232679e-001, 9.237343e-001, 9.242020e-001, 9.246705e-001, 9.251390e-001, 9.256075e-001, 9.260761e-001, 9.265446e-001,
+9.270131e-001, 9.274816e-001, 9.279501e-001, 9.284178e-001, 9.288849e-001, 9.293520e-001, 9.298191e-001, 9.302863e-001, 9.307534e-001, 9.312205e-001,
+9.316876e-001, 9.321547e-001, 9.326195e-001, 9.330815e-001, 9.335434e-001, 9.340054e-001, 9.344674e-001, 9.349293e-001, 9.353913e-001, 9.358532e-001,
+9.363152e-001, 9.367759e-001, 9.372318e-001, 9.376877e-001, 9.381437e-001, 9.385996e-001, 9.390555e-001, 9.395114e-001, 9.399674e-001, 9.404233e-001,
+9.408792e-001, 9.413327e-001, 9.417858e-001, 9.422390e-001, 9.426921e-001, 9.431452e-001, 9.435984e-001, 9.440515e-001, 9.445046e-001, 9.449577e-001,
+9.454092e-001, 9.458585e-001, 9.463078e-001, 9.467570e-001, 9.472063e-001, 9.476556e-001, 9.481049e-001, 9.485542e-001, 9.490035e-001, 9.494527e-001,
+9.498932e-001, 9.503325e-001, 9.507718e-001, 9.512112e-001, 9.516505e-001, 9.520899e-001, 9.525292e-001, 9.529685e-001, 9.534079e-001, 9.538437e-001,
+9.542688e-001, 9.546939e-001, 9.551190e-001, 9.555441e-001, 9.559692e-001, 9.563943e-001, 9.568195e-001, 9.572446e-001, 9.576697e-001, 9.580900e-001,
+9.585055e-001, 9.589209e-001, 9.593364e-001, 9.597519e-001, 9.601673e-001, 9.605828e-001, 9.609983e-001, 9.614137e-001, 9.618292e-001, 9.622409e-001,
+9.626506e-001, 9.630602e-001, 9.634698e-001, 9.638794e-001, 9.642891e-001, 9.646987e-001, 9.651083e-001, 9.655179e-001, 9.659275e-001, 9.663330e-001,
+9.667365e-001, 9.671400e-001, 9.675435e-001, 9.679470e-001, 9.683504e-001, 9.687539e-001, 9.691574e-001, 9.695609e-001, 9.699644e-001, 9.703654e-001,
+9.707647e-001, 9.711640e-001, 9.715633e-001, 9.719627e-001, 9.723620e-001, 9.727613e-001, 9.731607e-001, 9.735600e-001, 9.739593e-001, 9.743570e-001,
+9.747526e-001, 9.751481e-001, 9.755437e-001, 9.759392e-001, 9.763348e-001, 9.767303e-001, 9.771258e-001, 9.775214e-001, 9.779169e-001, 9.783114e-001,
+9.786989e-001, 9.790864e-001, 9.794739e-001, 9.798615e-001, 9.802490e-001, 9.806365e-001, 9.810240e-001, 9.814115e-001, 9.817990e-001, 9.821865e-001,
+9.825656e-001, 9.829416e-001, 9.833175e-001, 9.836935e-001, 9.840694e-001, 9.844454e-001, 9.848213e-001, 9.851973e-001, 9.855732e-001, 9.859492e-001,
+9.863222e-001, 9.866844e-001, 9.870467e-001, 9.874089e-001, 9.877712e-001, 9.881334e-001, 9.884957e-001, 9.888579e-001, 9.892202e-001, 9.895824e-001,
+9.899447e-001, 9.902952e-001, 9.906374e-001, 9.909796e-001, 9.913218e-001, 9.916640e-001, 9.920062e-001, 9.923484e-001, 9.926906e-001, 9.930328e-001,
+9.933750e-001, 9.937172e-001, 9.940318e-001, 9.943411e-001, 9.946505e-001, 9.949598e-001, 9.952692e-001, 9.955785e-001, 9.958878e-001, 9.961972e-001,
+9.965065e-001, 9.968159e-001, 9.971252e-001, 9.973875e-001, 9.976487e-001, 9.979100e-001, 9.981712e-001, 9.984325e-001, 9.986937e-001, 9.989550e-001,
+9.992162e-001, 9.994775e-001, 9.997387e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.555032e-003, 1.809887e-002, 2.559307e-002, 3.246028e-002, 3.890926e-002, 4.487222e-002, 5.042923e-002, 5.560446e-002, 6.047892e-002,
+6.517009e-002, 6.971736e-002, 7.401367e-002, 7.818429e-002, 8.229098e-002, 8.632378e-002, 9.020621e-002, 9.401944e-002, 9.774839e-002, 1.014209e-001,
+1.050138e-001, 1.085262e-001, 1.120131e-001, 1.154666e-001, 1.188692e-001, 1.222467e-001, 1.256064e-001, 1.289401e-001, 1.322278e-001, 1.354802e-001,
+1.386919e-001, 1.418766e-001, 1.450258e-001, 1.481392e-001, 1.512456e-001, 1.543206e-001, 1.573433e-001, 1.603267e-001, 1.632660e-001, 1.661476e-001,
+1.689998e-001, 1.718226e-001, 1.746128e-001, 1.773594e-001, 1.800665e-001, 1.827679e-001, 1.854267e-001, 1.880469e-001, 1.906184e-001, 1.931631e-001,
+1.956868e-001, 1.981968e-001, 2.006848e-001, 2.031618e-001, 2.056335e-001, 2.080969e-001, 2.105541e-001, 2.129820e-001, 2.154052e-001, 2.178180e-001,
+2.201987e-001, 2.225521e-001, 2.248626e-001, 2.271340e-001, 2.293829e-001, 2.316153e-001, 2.338471e-001, 2.360680e-001, 2.382649e-001, 2.404525e-001,
+2.426279e-001, 2.447896e-001, 2.469552e-001, 2.491304e-001, 2.513049e-001, 2.534686e-001, 2.556252e-001, 2.577697e-001, 2.599022e-001, 2.620307e-001,
+2.641497e-001, 2.662425e-001, 2.683148e-001, 2.703753e-001, 2.724194e-001, 2.744518e-001, 2.764849e-001, 2.785145e-001, 2.805335e-001, 2.825406e-001,
+2.845480e-001, 2.865387e-001, 2.885078e-001, 2.904665e-001, 2.924237e-001, 2.943877e-001, 2.963529e-001, 2.983131e-001, 3.002620e-001, 3.021940e-001,
+3.041042e-001, 3.060003e-001, 3.078897e-001, 3.097808e-001, 3.116735e-001, 3.135591e-001, 3.154322e-001, 3.173009e-001, 3.191636e-001, 3.210157e-001,
+3.228532e-001, 3.246807e-001, 3.265039e-001, 3.283265e-001, 3.301435e-001, 3.319504e-001, 3.337504e-001, 3.355465e-001, 3.373400e-001, 3.391256e-001,
+3.408976e-001, 3.426569e-001, 3.444056e-001, 3.461483e-001, 3.478848e-001, 3.496142e-001, 3.513361e-001, 3.530487e-001, 3.547559e-001, 3.564562e-001,
+3.581486e-001, 3.598242e-001, 3.614910e-001, 3.631506e-001, 3.648028e-001, 3.664542e-001, 3.680999e-001, 3.697326e-001, 3.713548e-001, 3.729732e-001,
+3.745887e-001, 3.761973e-001, 3.778008e-001, 3.793951e-001, 3.809766e-001, 3.825521e-001, 3.841213e-001, 3.856911e-001, 3.872612e-001, 3.888236e-001,
+3.903798e-001, 3.919270e-001, 3.934661e-001, 3.950021e-001, 3.965331e-001, 3.980643e-001, 3.995955e-001, 4.011205e-001, 4.026428e-001, 4.041538e-001,
+4.056634e-001, 4.071705e-001, 4.086725e-001, 4.101716e-001, 4.116599e-001, 4.131459e-001, 4.146251e-001, 4.161024e-001, 4.175755e-001, 4.190462e-001,
+4.205146e-001, 4.219823e-001, 4.234496e-001, 4.249095e-001, 4.263676e-001, 4.278148e-001, 4.292608e-001, 4.306947e-001, 4.321266e-001, 4.335467e-001,
+4.349649e-001, 4.363756e-001, 4.377841e-001, 4.391864e-001, 4.405857e-001, 4.419768e-001, 4.433654e-001, 4.447469e-001, 4.461271e-001, 4.475036e-001,
+4.488789e-001, 4.502497e-001, 4.516188e-001, 4.529779e-001, 4.543360e-001, 4.556787e-001, 4.570213e-001, 4.583550e-001, 4.596883e-001, 4.610117e-001,
+4.623329e-001, 4.636422e-001, 4.649455e-001, 4.662468e-001, 4.675458e-001, 4.688419e-001, 4.701308e-001, 4.714190e-001, 4.726983e-001, 4.739777e-001,
+4.752514e-001, 4.765238e-001, 4.777913e-001, 4.790548e-001, 4.803157e-001, 4.815687e-001, 4.828216e-001, 4.840665e-001, 4.853108e-001, 4.865507e-001,
+4.877873e-001, 4.890220e-001, 4.902491e-001, 4.914762e-001, 4.927015e-001, 4.939265e-001, 4.951480e-001, 4.963640e-001, 4.975799e-001, 4.987801e-001,
+4.999789e-001, 5.011754e-001, 5.023689e-001, 5.035624e-001, 5.047491e-001, 5.059354e-001, 5.071170e-001, 5.082917e-001, 5.094663e-001, 5.106361e-001,
+5.118050e-001, 5.129720e-001, 5.141334e-001, 5.152949e-001, 5.164547e-001, 5.176135e-001, 5.187724e-001, 5.199284e-001, 5.210845e-001, 5.222364e-001,
+5.233796e-001, 5.245228e-001, 5.256589e-001, 5.267905e-001, 5.279221e-001, 5.290479e-001, 5.301730e-001, 5.312972e-001, 5.324152e-001, 5.335333e-001,
+5.346456e-001, 5.357465e-001, 5.368474e-001, 5.379434e-001, 5.390350e-001, 5.401265e-001, 5.412139e-001, 5.422992e-001, 5.433845e-001, 5.444643e-001,
+5.455427e-001, 5.466210e-001, 5.476927e-001, 5.487634e-001, 5.498342e-001, 5.508939e-001, 5.519528e-001, 5.530116e-001, 5.540567e-001, 5.551009e-001,
+5.561452e-001, 5.571808e-001, 5.582158e-001, 5.592507e-001, 5.602828e-001, 5.613144e-001, 5.623461e-001, 5.633695e-001, 5.643910e-001, 5.654126e-001,
+5.664226e-001, 5.674280e-001, 5.684334e-001, 5.694365e-001, 5.704377e-001, 5.714389e-001, 5.724375e-001, 5.734321e-001, 5.744267e-001, 5.754205e-001,
+5.764103e-001, 5.774001e-001, 5.783899e-001, 5.793785e-001, 5.803670e-001, 5.813555e-001, 5.823364e-001, 5.833132e-001, 5.842901e-001, 5.852632e-001,
+5.862288e-001, 5.871945e-001, 5.881602e-001, 5.891244e-001, 5.900886e-001, 5.910527e-001, 5.920161e-001, 5.929789e-001, 5.939417e-001, 5.949037e-001,
+5.958617e-001, 5.968198e-001, 5.977778e-001, 5.987269e-001, 5.996723e-001, 6.006177e-001, 6.015614e-001, 6.024988e-001, 6.034363e-001, 6.043737e-001,
+6.053066e-001, 6.062374e-001, 6.071681e-001, 6.080988e-001, 6.090288e-001, 6.099588e-001, 6.108887e-001, 6.118140e-001, 6.127342e-001, 6.136544e-001,
+6.145746e-001, 6.154836e-001, 6.163904e-001, 6.172972e-001, 6.182032e-001, 6.191044e-001, 6.200055e-001, 6.209066e-001, 6.218064e-001, 6.227044e-001,
+6.236024e-001, 6.245003e-001, 6.253931e-001, 6.262827e-001, 6.271723e-001, 6.280620e-001, 6.289453e-001, 6.298272e-001, 6.307090e-001, 6.315909e-001,
+6.324611e-001, 6.333307e-001, 6.342004e-001, 6.350695e-001, 6.359295e-001, 6.367895e-001, 6.376496e-001, 6.385089e-001, 6.393631e-001, 6.402173e-001,
+6.410715e-001, 6.419251e-001, 6.427741e-001, 6.436231e-001, 6.444721e-001, 6.453202e-001, 6.461594e-001, 6.469987e-001, 6.478379e-001, 6.486769e-001,
+6.495089e-001, 6.503409e-001, 6.511729e-001, 6.520049e-001, 6.528309e-001, 6.536563e-001, 6.544817e-001, 6.553071e-001, 6.561267e-001, 6.569445e-001,
+6.577623e-001, 6.585801e-001, 6.593969e-001, 6.602130e-001, 6.610292e-001, 6.618453e-001, 6.626602e-001, 6.634724e-001, 6.642846e-001, 6.650968e-001,
+6.659089e-001, 6.667076e-001, 6.675064e-001, 6.683051e-001, 6.691039e-001, 6.698979e-001, 6.706896e-001, 6.714812e-001, 6.722728e-001, 6.730641e-001,
+6.738545e-001, 6.746450e-001, 6.754354e-001, 6.762258e-001, 6.770143e-001, 6.778024e-001, 6.785905e-001, 6.793786e-001, 6.801651e-001, 6.809487e-001,
+6.817323e-001, 6.825159e-001, 6.832996e-001, 6.840778e-001, 6.848548e-001, 6.856319e-001, 6.864089e-001, 6.871842e-001, 6.879536e-001, 6.887230e-001,
+6.894924e-001, 6.902618e-001, 6.910268e-001, 6.917888e-001, 6.925509e-001, 6.933129e-001, 6.940750e-001, 6.948327e-001, 6.955900e-001, 6.963473e-001,
+6.971045e-001, 6.978611e-001, 6.986146e-001, 6.993680e-001, 7.001215e-001, 7.008749e-001, 7.016248e-001, 7.023694e-001, 7.031140e-001, 7.038586e-001,
+7.046032e-001, 7.053433e-001, 7.060800e-001, 7.068166e-001, 7.075533e-001, 7.082899e-001, 7.090214e-001, 7.097504e-001, 7.104795e-001, 7.112085e-001,
+7.119375e-001, 7.126597e-001, 7.133795e-001, 7.140993e-001, 7.148190e-001, 7.155388e-001, 7.162549e-001, 7.169696e-001, 7.176843e-001, 7.183991e-001,
+7.191138e-001, 7.198268e-001, 7.205390e-001, 7.212512e-001, 7.219635e-001, 7.226757e-001, 7.233845e-001, 7.240908e-001, 7.247970e-001, 7.255033e-001,
+7.262096e-001, 7.269139e-001, 7.276155e-001, 7.283170e-001, 7.290186e-001, 7.297201e-001, 7.304204e-001, 7.311159e-001, 7.318114e-001, 7.325068e-001,
+7.332023e-001, 7.338978e-001, 7.345873e-001, 7.352764e-001, 7.359655e-001, 7.366546e-001, 7.373437e-001, 7.380310e-001, 7.387169e-001, 7.394029e-001,
+7.400888e-001, 7.407748e-001, 7.414585e-001, 7.421337e-001, 7.428089e-001, 7.434841e-001, 7.441593e-001, 7.448345e-001, 7.455040e-001, 7.461716e-001,
+7.468393e-001, 7.475070e-001, 7.481747e-001, 7.488410e-001, 7.495034e-001, 7.501659e-001, 7.508284e-001, 7.514908e-001, 7.521533e-001, 7.528086e-001,
+7.534606e-001, 7.541127e-001, 7.547648e-001, 7.554169e-001, 7.560683e-001, 7.567109e-001, 7.573534e-001, 7.579960e-001, 7.586385e-001, 7.592811e-001,
+7.599217e-001, 7.605591e-001, 7.611966e-001, 7.618340e-001, 7.624714e-001, 7.631089e-001, 7.637442e-001, 7.643783e-001, 7.650124e-001, 7.656465e-001,
+7.662806e-001, 7.669147e-001, 7.675453e-001, 7.681750e-001, 7.688047e-001, 7.694345e-001, 7.700642e-001, 7.706940e-001, 7.713199e-001, 7.719455e-001,
+7.725712e-001, 7.731968e-001, 7.738225e-001, 7.744481e-001, 7.750693e-001, 7.756904e-001, 7.763116e-001, 7.769328e-001, 7.775539e-001, 7.781750e-001,
+7.787934e-001, 7.794118e-001, 7.800302e-001, 7.806486e-001, 7.812670e-001, 7.818854e-001, 7.824989e-001, 7.831121e-001, 7.837253e-001, 7.843386e-001,
+7.849518e-001, 7.855650e-001, 7.861744e-001, 7.867829e-001, 7.873914e-001, 7.880000e-001, 7.886085e-001, 7.892170e-001, 7.898226e-001, 7.904264e-001,
+7.910302e-001, 7.916340e-001, 7.922377e-001, 7.928415e-001, 7.934436e-001, 7.940425e-001, 7.946414e-001, 7.952403e-001, 7.958392e-001, 7.964380e-001,
+7.970369e-001, 7.976314e-001, 7.982259e-001, 7.988205e-001, 7.994150e-001, 8.000095e-001, 8.006040e-001, 8.011957e-001, 8.017855e-001, 8.023753e-001,
+8.029651e-001, 8.035550e-001, 8.041448e-001, 8.047344e-001, 8.053227e-001, 8.059110e-001, 8.064993e-001, 8.070875e-001, 8.076758e-001, 8.082641e-001,
+8.088515e-001, 8.094381e-001, 8.100248e-001, 8.106115e-001, 8.111982e-001, 8.117849e-001, 8.123715e-001, 8.129529e-001, 8.135341e-001, 8.141154e-001,
+8.146966e-001, 8.152779e-001, 8.158591e-001, 8.164387e-001, 8.170143e-001, 8.175900e-001, 8.181656e-001, 8.187412e-001, 8.193169e-001, 8.198925e-001,
+8.204676e-001, 8.210422e-001, 8.216167e-001, 8.221913e-001, 8.227659e-001, 8.233405e-001, 8.239151e-001, 8.244883e-001, 8.250608e-001, 8.256334e-001,
+8.262060e-001, 8.267786e-001, 8.273512e-001, 8.279238e-001, 8.284942e-001, 8.290641e-001, 8.296340e-001, 8.302039e-001, 8.307738e-001, 8.313437e-001,
+8.319136e-001, 8.324814e-001, 8.330487e-001, 8.336161e-001, 8.341834e-001, 8.347507e-001, 8.353181e-001, 8.358854e-001, 8.364486e-001, 8.370106e-001,
+8.375726e-001, 8.381346e-001, 8.386966e-001, 8.392586e-001, 8.398206e-001, 8.403777e-001, 8.409321e-001, 8.414864e-001, 8.420407e-001, 8.425950e-001,
+8.431493e-001, 8.437036e-001, 8.442539e-001, 8.447986e-001, 8.453433e-001, 8.458880e-001, 8.464328e-001, 8.469775e-001, 8.475222e-001, 8.480662e-001,
+8.486050e-001, 8.491439e-001, 8.496827e-001, 8.502216e-001, 8.507604e-001, 8.512993e-001, 8.518381e-001, 8.523708e-001, 8.529015e-001, 8.534323e-001,
+8.539630e-001, 8.544938e-001, 8.550246e-001, 8.555553e-001, 8.560834e-001, 8.566060e-001, 8.571285e-001, 8.576511e-001, 8.581736e-001, 8.586962e-001,
+8.592187e-001, 8.597413e-001, 8.602583e-001, 8.607740e-001, 8.612897e-001, 8.618053e-001, 8.623210e-001, 8.628366e-001, 8.633523e-001, 8.638666e-001,
+8.643747e-001, 8.648829e-001, 8.653911e-001, 8.658993e-001, 8.664075e-001, 8.669157e-001, 8.674238e-001, 8.679284e-001, 8.684292e-001, 8.689300e-001,
+8.694308e-001, 8.699316e-001, 8.704325e-001, 8.709333e-001, 8.714341e-001, 8.719300e-001, 8.724239e-001, 8.729179e-001, 8.734119e-001, 8.739059e-001,
+8.743998e-001, 8.748938e-001, 8.753878e-001, 8.758807e-001, 8.763734e-001, 8.768661e-001, 8.773588e-001, 8.778516e-001, 8.783443e-001, 8.788370e-001,
+8.793297e-001, 8.798215e-001, 8.803131e-001, 8.808048e-001, 8.812964e-001, 8.817880e-001, 8.822797e-001, 8.827713e-001, 8.832630e-001, 8.837480e-001,
+8.842323e-001, 8.847165e-001, 8.852008e-001, 8.856851e-001, 8.861693e-001, 8.866536e-001, 8.871378e-001, 8.876165e-001, 8.880936e-001, 8.885707e-001,
+8.890478e-001, 8.895249e-001, 8.900020e-001, 8.904791e-001, 8.909561e-001, 8.914326e-001, 8.919086e-001, 8.923845e-001, 8.928605e-001, 8.933365e-001,
+8.938125e-001, 8.942884e-001, 8.947644e-001, 8.952397e-001, 8.957131e-001, 8.961865e-001, 8.966599e-001, 8.971333e-001, 8.976067e-001, 8.980801e-001,
+8.985535e-001, 8.990269e-001, 8.994984e-001, 8.999695e-001, 9.004407e-001, 9.009119e-001, 9.013830e-001, 9.018542e-001, 9.023254e-001, 9.027965e-001,
+9.032671e-001, 9.037369e-001, 9.042066e-001, 9.046763e-001, 9.051461e-001, 9.056158e-001, 9.060856e-001, 9.065553e-001, 9.070250e-001, 9.074894e-001,
+9.079527e-001, 9.084161e-001, 9.088794e-001, 9.093427e-001, 9.098061e-001, 9.102694e-001, 9.107328e-001, 9.111946e-001, 9.116499e-001, 9.121053e-001,
+9.125606e-001, 9.130159e-001, 9.134712e-001, 9.139265e-001, 9.143819e-001, 9.148372e-001, 9.152906e-001, 9.157414e-001, 9.161922e-001, 9.166430e-001,
+9.170938e-001, 9.175446e-001, 9.179954e-001, 9.184462e-001, 9.188970e-001, 9.193476e-001, 9.197980e-001, 9.202484e-001, 9.206988e-001, 9.211492e-001,
+9.215996e-001, 9.220500e-001, 9.225004e-001, 9.229508e-001, 9.234022e-001, 9.238543e-001, 9.243064e-001, 9.247585e-001, 9.252106e-001, 9.256627e-001,
+9.261148e-001, 9.265669e-001, 9.270189e-001, 9.274703e-001, 9.279212e-001, 9.283721e-001, 9.288230e-001, 9.292739e-001, 9.297247e-001, 9.301756e-001,
+9.306265e-001, 9.310774e-001, 9.315286e-001, 9.319802e-001, 9.324319e-001, 9.328835e-001, 9.333351e-001, 9.337867e-001, 9.342383e-001, 9.346900e-001,
+9.351416e-001, 9.355927e-001, 9.360417e-001, 9.364908e-001, 9.369399e-001, 9.373890e-001, 9.378381e-001, 9.382872e-001, 9.387362e-001, 9.391853e-001,
+9.396344e-001, 9.400802e-001, 9.405255e-001, 9.409708e-001, 9.414162e-001, 9.418615e-001, 9.423068e-001, 9.427521e-001, 9.431974e-001, 9.436428e-001,
+9.440872e-001, 9.445305e-001, 9.449739e-001, 9.454172e-001, 9.458606e-001, 9.463039e-001, 9.467472e-001, 9.471906e-001, 9.476339e-001, 9.480772e-001,
+9.485140e-001, 9.489501e-001, 9.493861e-001, 9.498222e-001, 9.502582e-001, 9.506943e-001, 9.511303e-001, 9.515664e-001, 9.520024e-001, 9.524362e-001,
+9.528629e-001, 9.532896e-001, 9.537162e-001, 9.541429e-001, 9.545696e-001, 9.549963e-001, 9.554230e-001, 9.558497e-001, 9.562764e-001, 9.567002e-001,
+9.571211e-001, 9.575420e-001, 9.579628e-001, 9.583837e-001, 9.588046e-001, 9.592255e-001, 9.596463e-001, 9.600672e-001, 9.604881e-001, 9.609054e-001,
+9.613207e-001, 9.617360e-001, 9.621512e-001, 9.625665e-001, 9.629818e-001, 9.633971e-001, 9.638124e-001, 9.642276e-001, 9.646429e-001, 9.650546e-001,
+9.654645e-001, 9.658745e-001, 9.662844e-001, 9.666943e-001, 9.671043e-001, 9.675142e-001, 9.679242e-001, 9.683341e-001, 9.687441e-001, 9.691501e-001,
+9.695535e-001, 9.699569e-001, 9.703603e-001, 9.707638e-001, 9.711672e-001, 9.715706e-001, 9.719741e-001, 9.723775e-001, 9.727809e-001, 9.731824e-001,
+9.735813e-001, 9.739802e-001, 9.743791e-001, 9.747780e-001, 9.751769e-001, 9.755758e-001, 9.759747e-001, 9.763737e-001, 9.767726e-001, 9.771707e-001,
+9.775643e-001, 9.779578e-001, 9.783513e-001, 9.787448e-001, 9.791383e-001, 9.795318e-001, 9.799253e-001, 9.803189e-001, 9.807124e-001, 9.811059e-001,
+9.814932e-001, 9.818782e-001, 9.822633e-001, 9.826483e-001, 9.830333e-001, 9.834184e-001, 9.838034e-001, 9.841884e-001, 9.845734e-001, 9.849585e-001,
+9.853414e-001, 9.857169e-001, 9.860923e-001, 9.864677e-001, 9.868432e-001, 9.872186e-001, 9.875940e-001, 9.879695e-001, 9.883449e-001, 9.887203e-001,
+9.890957e-001, 9.894628e-001, 9.898240e-001, 9.901852e-001, 9.905464e-001, 9.909076e-001, 9.912688e-001, 9.916299e-001, 9.919911e-001, 9.923523e-001,
+9.927135e-001, 9.930747e-001, 9.934130e-001, 9.937470e-001, 9.940810e-001, 9.944151e-001, 9.947491e-001, 9.950831e-001, 9.954171e-001, 9.957511e-001,
+9.960851e-001, 9.964191e-001, 9.967531e-001, 9.970491e-001, 9.973442e-001, 9.976392e-001, 9.979343e-001, 9.982294e-001, 9.985245e-001, 9.988196e-001,
+9.991147e-001, 9.994098e-001, 9.997049e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.612927e-003, 1.468260e-002, 2.105637e-002, 2.673424e-002, 3.192257e-002, 3.680338e-002, 4.158787e-002, 4.632911e-002, 5.085047e-002,
+5.517536e-002, 5.940773e-002, 6.353642e-002, 6.755805e-002, 7.138161e-002, 7.432378e-002, 7.739417e-002, 8.112152e-002, 8.529489e-002, 8.936278e-002,
+9.267840e-002, 9.589510e-002, 9.904287e-002, 1.021655e-001, 1.052715e-001, 1.083574e-001, 1.113879e-001, 1.143847e-001, 1.173340e-001, 1.201965e-001,
+1.230241e-001, 1.258170e-001, 1.285797e-001, 1.313089e-001, 1.340118e-001, 1.366994e-001, 1.393682e-001, 1.420212e-001, 1.446440e-001, 1.472648e-001,
+1.498612e-001, 1.524338e-001, 1.549834e-001, 1.575089e-001, 1.600168e-001, 1.625131e-001, 1.649871e-001, 1.674250e-001, 1.698421e-001, 1.722378e-001,
+1.746356e-001, 1.770364e-001, 1.794322e-001, 1.818125e-001, 1.841809e-001, 1.865283e-001, 1.888633e-001, 1.911773e-001, 1.934748e-001, 1.957782e-001,
+1.980752e-001, 2.003641e-001, 2.026430e-001, 2.049132e-001, 2.071807e-001, 2.094416e-001, 2.117109e-001, 2.139747e-001, 2.162467e-001, 2.185127e-001,
+2.207740e-001, 2.230271e-001, 2.252775e-001, 2.275131e-001, 2.297355e-001, 2.319503e-001, 2.341518e-001, 2.363480e-001, 2.385403e-001, 2.407181e-001,
+2.428913e-001, 2.450590e-001, 2.472173e-001, 2.493721e-001, 2.515230e-001, 2.536628e-001, 2.557986e-001, 2.579297e-001, 2.600535e-001, 2.621644e-001,
+2.642524e-001, 2.663209e-001, 2.683752e-001, 2.704193e-001, 2.724545e-001, 2.744721e-001, 2.764638e-001, 2.784410e-001, 2.804195e-001, 2.823942e-001,
+2.843523e-001, 2.863052e-001, 2.882539e-001, 2.901890e-001, 2.921113e-001, 2.940279e-001, 2.959429e-001, 2.978522e-001, 2.997469e-001, 3.016290e-001,
+3.035013e-001, 3.053659e-001, 3.072257e-001, 3.090836e-001, 3.109402e-001, 3.128000e-001, 3.146592e-001, 3.165098e-001, 3.183468e-001, 3.201711e-001,
+3.219871e-001, 3.237961e-001, 3.255975e-001, 3.273891e-001, 3.291663e-001, 3.309337e-001, 3.326914e-001, 3.344373e-001, 3.361792e-001, 3.379172e-001,
+3.396506e-001, 3.413728e-001, 3.430914e-001, 3.448043e-001, 3.465046e-001, 3.481892e-001, 3.498644e-001, 3.515288e-001, 3.531870e-001, 3.548410e-001,
+3.564892e-001, 3.581175e-001, 3.597349e-001, 3.613365e-001, 3.629319e-001, 3.645235e-001, 3.661076e-001, 3.676817e-001, 3.692494e-001, 3.708040e-001,
+3.723561e-001, 3.739052e-001, 3.754433e-001, 3.769757e-001, 3.784922e-001, 3.800048e-001, 3.815136e-001, 3.830150e-001, 3.845133e-001, 3.859997e-001,
+3.874786e-001, 3.889463e-001, 3.904061e-001, 3.918620e-001, 3.933145e-001, 3.947650e-001, 3.962041e-001, 3.976392e-001, 3.990664e-001, 4.004911e-001,
+4.019137e-001, 4.033333e-001, 4.047516e-001, 4.061658e-001, 4.075791e-001, 4.089759e-001, 4.103710e-001, 4.117515e-001, 4.131310e-001, 4.145058e-001,
+4.158784e-001, 4.172433e-001, 4.186028e-001, 4.199479e-001, 4.212877e-001, 4.226151e-001, 4.239404e-001, 4.252607e-001, 4.265793e-001, 4.278937e-001,
+4.292060e-001, 4.305118e-001, 4.318156e-001, 4.331101e-001, 4.344034e-001, 4.356841e-001, 4.369647e-001, 4.382334e-001, 4.395018e-001, 4.407595e-001,
+4.420154e-001, 4.432603e-001, 4.445005e-001, 4.457360e-001, 4.469672e-001, 4.481968e-001, 4.494229e-001, 4.506484e-001, 4.518673e-001, 4.530863e-001,
+4.542965e-001, 4.555051e-001, 4.567083e-001, 4.579074e-001, 4.591038e-001, 4.602928e-001, 4.614818e-001, 4.626607e-001, 4.638391e-001, 4.650115e-001,
+4.661797e-001, 4.673461e-001, 4.685059e-001, 4.696658e-001, 4.708236e-001, 4.719809e-001, 4.731355e-001, 4.742859e-001, 4.754364e-001, 4.765752e-001,
+4.777133e-001, 4.788497e-001, 4.799841e-001, 4.811184e-001, 4.822545e-001, 4.833907e-001, 4.845213e-001, 4.856444e-001, 4.867675e-001, 4.878783e-001,
+4.889873e-001, 4.900953e-001, 4.912009e-001, 4.923065e-001, 4.934087e-001, 4.945092e-001, 4.956095e-001, 4.966977e-001, 4.977859e-001, 4.988708e-001,
+4.999495e-001, 5.010283e-001, 5.021041e-001, 5.031781e-001, 5.042522e-001, 5.053207e-001, 5.063885e-001, 5.074563e-001, 5.085229e-001, 5.095896e-001,
+5.106531e-001, 5.117110e-001, 5.127688e-001, 5.138181e-001, 5.148601e-001, 5.159021e-001, 5.169411e-001, 5.179787e-001, 5.190163e-001, 5.200525e-001,
+5.210883e-001, 5.221242e-001, 5.231578e-001, 5.241911e-001, 5.252244e-001, 5.262518e-001, 5.272789e-001, 5.283061e-001, 5.293181e-001, 5.303297e-001,
+5.313413e-001, 5.323447e-001, 5.333477e-001, 5.343508e-001, 5.353486e-001, 5.363459e-001, 5.373433e-001, 5.383352e-001, 5.393261e-001, 5.403170e-001,
+5.413028e-001, 5.422867e-001, 5.432707e-001, 5.442500e-001, 5.452261e-001, 5.462023e-001, 5.471750e-001, 5.481428e-001, 5.491107e-001, 5.500766e-001,
+5.510353e-001, 5.519940e-001, 5.529527e-001, 5.539078e-001, 5.548628e-001, 5.558178e-001, 5.567662e-001, 5.577116e-001, 5.586569e-001, 5.595967e-001,
+5.605269e-001, 5.614571e-001, 5.623872e-001, 5.633127e-001, 5.642382e-001, 5.651638e-001, 5.660884e-001, 5.670126e-001, 5.679368e-001, 5.688589e-001,
+5.697726e-001, 5.706862e-001, 5.715999e-001, 5.725021e-001, 5.734001e-001, 5.742981e-001, 5.751949e-001, 5.760879e-001, 5.769809e-001, 5.778739e-001,
+5.787656e-001, 5.796566e-001, 5.805477e-001, 5.814385e-001, 5.823276e-001, 5.832166e-001, 5.841057e-001, 5.849938e-001, 5.858810e-001, 5.867682e-001,
+5.876554e-001, 5.885332e-001, 5.894093e-001, 5.902854e-001, 5.911598e-001, 5.920251e-001, 5.928904e-001, 5.937557e-001, 5.946201e-001, 5.954833e-001,
+5.963465e-001, 5.972098e-001, 5.980717e-001, 5.989330e-001, 5.997943e-001, 6.006556e-001, 6.015127e-001, 6.023689e-001, 6.032252e-001, 6.040814e-001,
+6.049261e-001, 6.057704e-001, 6.066148e-001, 6.074588e-001, 6.082984e-001, 6.091381e-001, 6.099777e-001, 6.108171e-001, 6.116549e-001, 6.124927e-001,
+6.133305e-001, 6.141680e-001, 6.150038e-001, 6.158395e-001, 6.166753e-001, 6.175108e-001, 6.183446e-001, 6.191785e-001, 6.200123e-001, 6.208460e-001,
+6.216778e-001, 6.225096e-001, 6.233413e-001, 6.241731e-001, 6.250031e-001, 6.258329e-001, 6.266628e-001, 6.274926e-001, 6.283209e-001, 6.291488e-001,
+6.299767e-001, 6.308045e-001, 6.316314e-001, 6.324574e-001, 6.332835e-001, 6.341096e-001, 6.349342e-001, 6.357557e-001, 6.365773e-001, 6.373989e-001,
+6.382201e-001, 6.390304e-001, 6.398407e-001, 6.406510e-001, 6.414613e-001, 6.422684e-001, 6.430740e-001, 6.438795e-001, 6.446851e-001, 6.454901e-001,
+6.462939e-001, 6.470977e-001, 6.479014e-001, 6.487052e-001, 6.495074e-001, 6.503092e-001, 6.511111e-001, 6.519130e-001, 6.527123e-001, 6.535074e-001,
+6.543025e-001, 6.550976e-001, 6.558926e-001, 6.566833e-001, 6.574732e-001, 6.582631e-001, 6.590530e-001, 6.598422e-001, 6.606297e-001, 6.614172e-001,
+6.622047e-001, 6.629922e-001, 6.637782e-001, 6.645632e-001, 6.653483e-001, 6.661333e-001, 6.669184e-001, 6.677012e-001, 6.684839e-001, 6.692666e-001,
+6.700494e-001, 6.708311e-001, 6.716089e-001, 6.723867e-001, 6.731645e-001, 6.739424e-001, 6.747155e-001, 6.754821e-001, 6.762487e-001, 6.770153e-001,
+6.777819e-001, 6.785456e-001, 6.793071e-001, 6.800687e-001, 6.808303e-001, 6.815918e-001, 6.823518e-001, 6.831110e-001, 6.838702e-001, 6.846294e-001,
+6.853885e-001, 6.861459e-001, 6.869027e-001, 6.876594e-001, 6.884162e-001, 6.891729e-001, 6.899224e-001, 6.906695e-001, 6.914165e-001, 6.921636e-001,
+6.929106e-001, 6.936490e-001, 6.943837e-001, 6.951184e-001, 6.958531e-001, 6.965877e-001, 6.973187e-001, 6.980472e-001, 6.987757e-001, 6.995042e-001,
+7.002327e-001, 7.009604e-001, 7.016872e-001, 7.024140e-001, 7.031408e-001, 7.038676e-001, 7.045934e-001, 7.053160e-001, 7.060385e-001, 7.067610e-001,
+7.074835e-001, 7.082060e-001, 7.089206e-001, 7.096347e-001, 7.103488e-001, 7.110629e-001, 7.117770e-001, 7.124880e-001, 7.131970e-001, 7.139061e-001,
+7.146151e-001, 7.153242e-001, 7.160325e-001, 7.167384e-001, 7.174442e-001, 7.181501e-001, 7.188560e-001, 7.195619e-001, 7.202641e-001, 7.209653e-001,
+7.216665e-001, 7.223677e-001, 7.230689e-001, 7.237701e-001, 7.244712e-001, 7.251723e-001, 7.258734e-001, 7.265746e-001, 7.272757e-001, 7.279723e-001,
+7.286671e-001, 7.293618e-001, 7.300566e-001, 7.307514e-001, 7.314454e-001, 7.321309e-001, 7.328165e-001, 7.335020e-001, 7.341875e-001, 7.348731e-001,
+7.355561e-001, 7.362353e-001, 7.369145e-001, 7.375937e-001, 7.382730e-001, 7.389522e-001, 7.396276e-001, 7.403010e-001, 7.409744e-001, 7.416478e-001,
+7.423212e-001, 7.429946e-001, 7.436638e-001, 7.443320e-001, 7.450003e-001, 7.456686e-001, 7.463369e-001, 7.470052e-001, 7.476691e-001, 7.483328e-001,
+7.489964e-001, 7.496601e-001, 7.503238e-001, 7.509874e-001, 7.516471e-001, 7.523069e-001, 7.529666e-001, 7.536263e-001, 7.542861e-001, 7.549457e-001,
+7.556020e-001, 7.562583e-001, 7.569146e-001, 7.575709e-001, 7.582271e-001, 7.588834e-001, 7.595390e-001, 7.601946e-001, 7.608502e-001, 7.615058e-001,
+7.621614e-001, 7.628171e-001, 7.634736e-001, 7.641304e-001, 7.647871e-001, 7.654439e-001, 7.661007e-001, 7.667574e-001, 7.674102e-001, 7.680607e-001,
+7.687112e-001, 7.693617e-001, 7.700122e-001, 7.706627e-001, 7.713115e-001, 7.719576e-001, 7.726036e-001, 7.732496e-001, 7.738957e-001, 7.745417e-001,
+7.751877e-001, 7.758299e-001, 7.764721e-001, 7.771143e-001, 7.777565e-001, 7.783988e-001, 7.790410e-001, 7.796803e-001, 7.803178e-001, 7.809553e-001,
+7.815927e-001, 7.822302e-001, 7.828677e-001, 7.835052e-001, 7.841426e-001, 7.847801e-001, 7.854175e-001, 7.860549e-001, 7.866923e-001, 7.873298e-001,
+7.879633e-001, 7.885943e-001, 7.892253e-001, 7.898563e-001, 7.904873e-001, 7.911183e-001, 7.917493e-001, 7.923682e-001, 7.929870e-001, 7.936058e-001,
+7.942246e-001, 7.948434e-001, 7.954622e-001, 7.960788e-001, 7.966904e-001, 7.973020e-001, 7.979136e-001, 7.985252e-001, 7.991368e-001, 7.997484e-001,
+8.003579e-001, 8.009656e-001, 8.015733e-001, 8.021810e-001, 8.027887e-001, 8.033963e-001, 8.040040e-001, 8.046082e-001, 8.052109e-001, 8.058137e-001,
+8.064164e-001, 8.070191e-001, 8.076219e-001, 8.082246e-001, 8.088231e-001, 8.094206e-001, 8.100181e-001, 8.106156e-001, 8.112131e-001, 8.118106e-001,
+8.124081e-001, 8.130018e-001, 8.135947e-001, 8.141876e-001, 8.147806e-001, 8.153735e-001, 8.159664e-001, 8.165594e-001, 8.171482e-001, 8.177358e-001,
+8.183235e-001, 8.189111e-001, 8.194987e-001, 8.200864e-001, 8.206740e-001, 8.212597e-001, 8.218444e-001, 8.224290e-001, 8.230137e-001, 8.235983e-001,
+8.241830e-001, 8.247676e-001, 8.253524e-001, 8.259375e-001, 8.265225e-001, 8.271076e-001, 8.276926e-001, 8.282776e-001, 8.288627e-001, 8.294473e-001,
+8.300295e-001, 8.306117e-001, 8.311940e-001, 8.317762e-001, 8.323584e-001, 8.329407e-001, 8.335229e-001, 8.341017e-001, 8.346795e-001, 8.352573e-001,
+8.358352e-001, 8.364130e-001, 8.369908e-001, 8.375687e-001, 8.381444e-001, 8.387161e-001, 8.392877e-001, 8.398594e-001, 8.404311e-001, 8.410027e-001,
+8.415744e-001, 8.421460e-001, 8.427105e-001, 8.432731e-001, 8.438358e-001, 8.443985e-001, 8.449612e-001, 8.455239e-001, 8.460866e-001, 8.466476e-001,
+8.472021e-001, 8.477566e-001, 8.483110e-001, 8.488655e-001, 8.494200e-001, 8.499745e-001, 8.505289e-001, 8.510809e-001, 8.516304e-001, 8.521799e-001,
+8.527295e-001, 8.532790e-001, 8.538285e-001, 8.543781e-001, 8.549276e-001, 8.554750e-001, 8.560217e-001, 8.565684e-001, 8.571151e-001, 8.576618e-001,
+8.582085e-001, 8.587552e-001, 8.593019e-001, 8.598422e-001, 8.603816e-001, 8.609210e-001, 8.614604e-001, 8.619998e-001, 8.625392e-001, 8.630786e-001,
+8.636180e-001, 8.641535e-001, 8.646888e-001, 8.652241e-001, 8.657594e-001, 8.662947e-001, 8.668300e-001, 8.673652e-001, 8.679005e-001, 8.684350e-001,
+8.689694e-001, 8.695038e-001, 8.700382e-001, 8.705726e-001, 8.711070e-001, 8.716414e-001, 8.721758e-001, 8.727089e-001, 8.732416e-001, 8.737743e-001,
+8.743070e-001, 8.748397e-001, 8.753723e-001, 8.759050e-001, 8.764377e-001, 8.769699e-001, 8.775018e-001, 8.780337e-001, 8.785656e-001, 8.790975e-001,
+8.796294e-001, 8.801612e-001, 8.806931e-001, 8.812241e-001, 8.817528e-001, 8.822814e-001, 8.828101e-001, 8.833387e-001, 8.838674e-001, 8.843961e-001,
+8.849247e-001, 8.854534e-001, 8.859790e-001, 8.865043e-001, 8.870296e-001, 8.875548e-001, 8.880801e-001, 8.886054e-001, 8.891307e-001, 8.896560e-001,
+8.901806e-001, 8.907042e-001, 8.912279e-001, 8.917515e-001, 8.922752e-001, 8.927989e-001, 8.933225e-001, 8.938462e-001, 8.943698e-001, 8.948928e-001,
+8.954156e-001, 8.959384e-001, 8.964612e-001, 8.969840e-001, 8.975068e-001, 8.980296e-001, 8.985524e-001, 8.990745e-001, 8.995932e-001, 9.001119e-001,
+9.006306e-001, 9.011493e-001, 9.016681e-001, 9.021868e-001, 9.027055e-001, 9.032242e-001, 9.037397e-001, 9.042512e-001, 9.047626e-001, 9.052740e-001,
+9.057854e-001, 9.062968e-001, 9.068082e-001, 9.073196e-001, 9.078310e-001, 9.083388e-001, 9.088441e-001, 9.093493e-001, 9.098546e-001, 9.103598e-001,
+9.108651e-001, 9.113703e-001, 9.118756e-001, 9.123808e-001, 9.128849e-001, 9.133883e-001, 9.138917e-001, 9.143950e-001, 9.148984e-001, 9.154018e-001,
+9.159052e-001, 9.164086e-001, 9.169120e-001, 9.174153e-001, 9.179184e-001, 9.184216e-001, 9.189247e-001, 9.194278e-001, 9.199310e-001, 9.204341e-001,
+9.209373e-001, 9.214404e-001, 9.219435e-001, 9.224465e-001, 9.229495e-001, 9.234525e-001, 9.239555e-001, 9.244585e-001, 9.249615e-001, 9.254645e-001,
+9.259675e-001, 9.264700e-001, 9.269705e-001, 9.274709e-001, 9.279714e-001, 9.284719e-001, 9.289724e-001, 9.294728e-001, 9.299733e-001, 9.304738e-001,
+9.309743e-001, 9.314734e-001, 9.319723e-001, 9.324712e-001, 9.329702e-001, 9.334691e-001, 9.339680e-001, 9.344670e-001, 9.349659e-001, 9.354648e-001,
+9.359622e-001, 9.364576e-001, 9.369530e-001, 9.374484e-001, 9.379438e-001, 9.384391e-001, 9.389345e-001, 9.394299e-001, 9.399253e-001, 9.404207e-001,
+9.409107e-001, 9.414000e-001, 9.418894e-001, 9.423787e-001, 9.428680e-001, 9.433574e-001, 9.438467e-001, 9.443361e-001, 9.448254e-001, 9.453141e-001,
+9.458007e-001, 9.462873e-001, 9.467739e-001, 9.472606e-001, 9.477472e-001, 9.482338e-001, 9.487204e-001, 9.492071e-001, 9.496937e-001, 9.501781e-001,
+9.506604e-001, 9.511427e-001, 9.516250e-001, 9.521073e-001, 9.525896e-001, 9.530718e-001, 9.535541e-001, 9.540364e-001, 9.545187e-001, 9.549967e-001,
+9.554722e-001, 9.559477e-001, 9.564233e-001, 9.568988e-001, 9.573744e-001, 9.578499e-001, 9.583255e-001, 9.588010e-001, 9.592765e-001, 9.597475e-001,
+9.602164e-001, 9.606852e-001, 9.611540e-001, 9.616229e-001, 9.620917e-001, 9.625606e-001, 9.630294e-001, 9.634982e-001, 9.639671e-001, 9.644326e-001,
+9.648959e-001, 9.653593e-001, 9.658226e-001, 9.662859e-001, 9.667493e-001, 9.672126e-001, 9.676760e-001, 9.681393e-001, 9.686026e-001, 9.690621e-001,
+9.695165e-001, 9.699708e-001, 9.704251e-001, 9.708795e-001, 9.713338e-001, 9.717881e-001, 9.722425e-001, 9.726968e-001, 9.731512e-001, 9.736040e-001,
+9.740475e-001, 9.744911e-001, 9.749346e-001, 9.753781e-001, 9.758216e-001, 9.762651e-001, 9.767086e-001, 9.771521e-001, 9.775956e-001, 9.780392e-001,
+9.784761e-001, 9.789105e-001, 9.793450e-001, 9.797795e-001, 9.802139e-001, 9.806484e-001, 9.810829e-001, 9.815173e-001, 9.819518e-001, 9.823863e-001,
+9.828186e-001, 9.832430e-001, 9.836675e-001, 9.840920e-001, 9.845165e-001, 9.849410e-001, 9.853654e-001, 9.857899e-001, 9.862144e-001, 9.866389e-001,
+9.870633e-001, 9.874807e-001, 9.878932e-001, 9.883056e-001, 9.887180e-001, 9.891304e-001, 9.895428e-001, 9.899552e-001, 9.903676e-001, 9.907801e-001,
+9.911925e-001, 9.916049e-001, 9.920030e-001, 9.923985e-001, 9.927939e-001, 9.931893e-001, 9.935848e-001, 9.939802e-001, 9.943757e-001, 9.947711e-001,
+9.951665e-001, 9.955620e-001, 9.959574e-001, 9.963254e-001, 9.966929e-001, 9.970603e-001, 9.974278e-001, 9.977953e-001, 9.981627e-001, 9.985302e-001,
+9.988976e-001, 9.992651e-001, 9.996325e-001, 1.000000e+000)),
+("Agfa", "Advantix 400", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.710601e-003, 1.471110e-002, 2.098140e-002, 2.666686e-002, 3.188321e-002, 3.671984e-002, 4.120610e-002, 4.541870e-002, 4.951442e-002,
+5.348970e-002, 5.721701e-002, 6.075063e-002, 6.420509e-002, 6.762490e-002, 7.097925e-002, 7.426669e-002, 7.743002e-002, 8.051510e-002, 8.352101e-002,
+8.648187e-002, 8.942137e-002, 9.231961e-002, 9.513131e-002, 9.787396e-002, 1.005604e-001, 1.032032e-001, 1.058200e-001, 1.084190e-001, 1.110042e-001,
+1.135606e-001, 1.160767e-001, 1.185398e-001, 1.209602e-001, 1.233263e-001, 1.256540e-001, 1.279318e-001, 1.301839e-001, 1.324170e-001, 1.346450e-001,
+1.368439e-001, 1.390297e-001, 1.412141e-001, 1.433851e-001, 1.455493e-001, 1.476996e-001, 1.498260e-001, 1.519211e-001, 1.539844e-001, 1.560284e-001,
+1.580577e-001, 1.600771e-001, 1.620801e-001, 1.640496e-001, 1.659898e-001, 1.679139e-001, 1.698164e-001, 1.716932e-001, 1.735652e-001, 1.754257e-001,
+1.772600e-001, 1.790852e-001, 1.808963e-001, 1.826874e-001, 1.844759e-001, 1.862520e-001, 1.880111e-001, 1.897682e-001, 1.915334e-001, 1.933026e-001,
+1.950711e-001, 1.968318e-001, 1.985856e-001, 2.003341e-001, 2.020726e-001, 2.038006e-001, 2.055212e-001, 2.072315e-001, 2.089259e-001, 2.106073e-001,
+2.122825e-001, 2.139520e-001, 2.156112e-001, 2.172587e-001, 2.189002e-001, 2.205414e-001, 2.221654e-001, 2.237753e-001, 2.253734e-001, 2.269579e-001,
+2.285311e-001, 2.301028e-001, 2.316679e-001, 2.332273e-001, 2.347782e-001, 2.363210e-001, 2.378584e-001, 2.393900e-001, 2.409214e-001, 2.424533e-001,
+2.439857e-001, 2.455042e-001, 2.470150e-001, 2.485187e-001, 2.500135e-001, 2.515036e-001, 2.529887e-001, 2.544669e-001, 2.559421e-001, 2.574182e-001,
+2.588958e-001, 2.603702e-001, 2.618410e-001, 2.633078e-001, 2.647667e-001, 2.662198e-001, 2.676648e-001, 2.690947e-001, 2.705187e-001, 2.719336e-001,
+2.733450e-001, 2.747542e-001, 2.761536e-001, 2.775474e-001, 2.789311e-001, 2.803081e-001, 2.816820e-001, 2.830529e-001, 2.844219e-001, 2.857857e-001,
+2.871482e-001, 2.885095e-001, 2.898695e-001, 2.912289e-001, 2.925895e-001, 2.939480e-001, 2.952953e-001, 2.966384e-001, 2.979728e-001, 2.993056e-001,
+3.006363e-001, 3.019703e-001, 3.033066e-001, 3.046468e-001, 3.059892e-001, 3.073258e-001, 3.086602e-001, 3.099907e-001, 3.113199e-001, 3.126456e-001,
+3.139702e-001, 3.152805e-001, 3.165856e-001, 3.178818e-001, 3.191738e-001, 3.204654e-001, 3.217567e-001, 3.230504e-001, 3.243465e-001, 3.256357e-001,
+3.269130e-001, 3.281877e-001, 3.294523e-001, 3.307168e-001, 3.319742e-001, 3.332316e-001, 3.344799e-001, 3.357258e-001, 3.369633e-001, 3.381935e-001,
+3.394211e-001, 3.406410e-001, 3.418609e-001, 3.430763e-001, 3.442914e-001, 3.455014e-001, 3.467079e-001, 3.479114e-001, 3.491044e-001, 3.502975e-001,
+3.514812e-001, 3.526628e-001, 3.538405e-001, 3.550119e-001, 3.561832e-001, 3.573499e-001, 3.585162e-001, 3.596820e-001, 3.608472e-001, 3.620124e-001,
+3.631744e-001, 3.643359e-001, 3.654957e-001, 3.666515e-001, 3.678072e-001, 3.689568e-001, 3.701033e-001, 3.712497e-001, 3.723874e-001, 3.735251e-001,
+3.746606e-001, 3.757919e-001, 3.769231e-001, 3.780478e-001, 3.791684e-001, 3.802890e-001, 3.814115e-001, 3.825342e-001, 3.836568e-001, 3.847779e-001,
+3.858990e-001, 3.870203e-001, 3.881419e-001, 3.892636e-001, 3.903855e-001, 3.915078e-001, 3.926302e-001, 3.937474e-001, 3.948588e-001, 3.959702e-001,
+3.970787e-001, 3.981843e-001, 3.992900e-001, 4.003951e-001, 4.014997e-001, 4.026043e-001, 4.037061e-001, 4.048052e-001, 4.059043e-001, 4.069996e-001,
+4.080899e-001, 4.091801e-001, 4.102692e-001, 4.113558e-001, 4.124423e-001, 4.135289e-001, 4.146164e-001, 4.157038e-001, 4.167913e-001, 4.178684e-001,
+4.189451e-001, 4.200219e-001, 4.210911e-001, 4.221576e-001, 4.232240e-001, 4.242892e-001, 4.253528e-001, 4.264164e-001, 4.274802e-001, 4.285459e-001,
+4.296115e-001, 4.306772e-001, 4.317357e-001, 4.327918e-001, 4.338479e-001, 4.349011e-001, 4.359481e-001, 4.369951e-001, 4.380421e-001, 4.390831e-001,
+4.401232e-001, 4.411633e-001, 4.421999e-001, 4.432298e-001, 4.442596e-001, 4.452895e-001, 4.463082e-001, 4.473239e-001, 4.483395e-001, 4.493535e-001,
+4.503594e-001, 4.513653e-001, 4.523712e-001, 4.533744e-001, 4.543753e-001, 4.553762e-001, 4.563771e-001, 4.573712e-001, 4.583637e-001, 4.593562e-001,
+4.603484e-001, 4.613364e-001, 4.623243e-001, 4.633123e-001, 4.642987e-001, 4.652802e-001, 4.662617e-001, 4.672433e-001, 4.682215e-001, 4.691946e-001,
+4.701678e-001, 4.711409e-001, 4.721118e-001, 4.730802e-001, 4.740486e-001, 4.750169e-001, 4.759813e-001, 4.769418e-001, 4.779023e-001, 4.788628e-001,
+4.798217e-001, 4.807789e-001, 4.817361e-001, 4.826933e-001, 4.836510e-001, 4.846091e-001, 4.855673e-001, 4.865255e-001, 4.874828e-001, 4.884382e-001,
+4.893935e-001, 4.903488e-001, 4.913036e-001, 4.922530e-001, 4.932023e-001, 4.941517e-001, 4.951011e-001, 4.960470e-001, 4.969923e-001, 4.979376e-001,
+4.988829e-001, 4.998262e-001, 5.007679e-001, 5.017096e-001, 5.026512e-001, 5.035929e-001, 5.045345e-001, 5.054762e-001, 5.064178e-001, 5.073594e-001,
+5.082986e-001, 5.092371e-001, 5.101755e-001, 5.111140e-001, 5.120513e-001, 5.129862e-001, 5.139210e-001, 5.148558e-001, 5.157907e-001, 5.167201e-001,
+5.176479e-001, 5.185757e-001, 5.195035e-001, 5.204296e-001, 5.213473e-001, 5.222651e-001, 5.231828e-001, 5.241005e-001, 5.250152e-001, 5.259271e-001,
+5.268389e-001, 5.277507e-001, 5.286625e-001, 5.295729e-001, 5.304829e-001, 5.313929e-001, 5.323029e-001, 5.332129e-001, 5.341181e-001, 5.350233e-001,
+5.359284e-001, 5.368336e-001, 5.377376e-001, 5.386345e-001, 5.395315e-001, 5.404284e-001, 5.413253e-001, 5.422213e-001, 5.431140e-001, 5.440066e-001,
+5.448993e-001, 5.457919e-001, 5.466845e-001, 5.475770e-001, 5.484695e-001, 5.493621e-001, 5.502546e-001, 5.511454e-001, 5.520284e-001, 5.529114e-001,
+5.537943e-001, 5.546773e-001, 5.555598e-001, 5.564334e-001, 5.573070e-001, 5.581806e-001, 5.590542e-001, 5.599278e-001, 5.607948e-001, 5.616607e-001,
+5.625266e-001, 5.633925e-001, 5.642585e-001, 5.651181e-001, 5.659736e-001, 5.668290e-001, 5.676844e-001, 5.685399e-001, 5.693952e-001, 5.702501e-001,
+5.711050e-001, 5.719599e-001, 5.728148e-001, 5.736697e-001, 5.745213e-001, 5.753723e-001, 5.762234e-001, 5.770744e-001, 5.779255e-001, 5.787749e-001,
+5.796217e-001, 5.804685e-001, 5.813154e-001, 5.821622e-001, 5.830090e-001, 5.838500e-001, 5.846897e-001, 5.855294e-001, 5.863691e-001, 5.872088e-001,
+5.880478e-001, 5.888837e-001, 5.897196e-001, 5.905555e-001, 5.913913e-001, 5.922272e-001, 5.930605e-001, 5.938909e-001, 5.947213e-001, 5.955516e-001,
+5.963820e-001, 5.972124e-001, 5.980379e-001, 5.988611e-001, 5.996843e-001, 6.005076e-001, 6.013308e-001, 6.021541e-001, 6.029742e-001, 6.037937e-001,
+6.046133e-001, 6.054328e-001, 6.062523e-001, 6.070719e-001, 6.078854e-001, 6.086981e-001, 6.095108e-001, 6.103236e-001, 6.111363e-001, 6.119490e-001,
+6.127572e-001, 6.135646e-001, 6.143720e-001, 6.151794e-001, 6.159867e-001, 6.167941e-001, 6.175979e-001, 6.184005e-001, 6.192031e-001, 6.200057e-001,
+6.208083e-001, 6.216109e-001, 6.224128e-001, 6.232140e-001, 6.240153e-001, 6.248165e-001, 6.256178e-001, 6.264191e-001, 6.272190e-001, 6.280160e-001,
+6.288131e-001, 6.296101e-001, 6.304071e-001, 6.312041e-001, 6.320011e-001, 6.327958e-001, 6.335904e-001, 6.343850e-001, 6.351795e-001, 6.359741e-001,
+6.367687e-001, 6.375622e-001, 6.383546e-001, 6.391470e-001, 6.399395e-001, 6.407319e-001, 6.415244e-001, 6.423168e-001, 6.431099e-001, 6.439031e-001,
+6.446963e-001, 6.454894e-001, 6.462826e-001, 6.470757e-001, 6.478682e-001, 6.486594e-001, 6.494506e-001, 6.502418e-001, 6.510330e-001, 6.518242e-001,
+6.526154e-001, 6.534075e-001, 6.542003e-001, 6.549930e-001, 6.557857e-001, 6.565784e-001, 6.573712e-001, 6.581639e-001, 6.589609e-001, 6.597586e-001,
+6.605563e-001, 6.613541e-001, 6.621518e-001, 6.629495e-001, 6.637473e-001, 6.645363e-001, 6.653249e-001, 6.661135e-001, 6.669020e-001, 6.676906e-001,
+6.684792e-001, 6.692678e-001, 6.700508e-001, 6.708337e-001, 6.716166e-001, 6.723995e-001, 6.731824e-001, 6.739652e-001, 6.747481e-001, 6.755290e-001,
+6.763096e-001, 6.770902e-001, 6.778709e-001, 6.786515e-001, 6.794321e-001, 6.802127e-001, 6.809899e-001, 6.817655e-001, 6.825412e-001, 6.833169e-001,
+6.840926e-001, 6.848683e-001, 6.856440e-001, 6.864164e-001, 6.871845e-001, 6.879526e-001, 6.887208e-001, 6.894889e-001, 6.902570e-001, 6.910252e-001,
+6.917930e-001, 6.925570e-001, 6.933210e-001, 6.940849e-001, 6.948489e-001, 6.956128e-001, 6.963768e-001, 6.971408e-001, 6.979043e-001, 6.986675e-001,
+6.994307e-001, 7.001939e-001, 7.009570e-001, 7.017202e-001, 7.024834e-001, 7.032465e-001, 7.040007e-001, 7.047549e-001, 7.055091e-001, 7.062633e-001,
+7.070175e-001, 7.077717e-001, 7.085259e-001, 7.092772e-001, 7.100226e-001, 7.107681e-001, 7.115136e-001, 7.122590e-001, 7.130045e-001, 7.137500e-001,
+7.144954e-001, 7.152379e-001, 7.159780e-001, 7.167181e-001, 7.174582e-001, 7.181982e-001, 7.189383e-001, 7.196784e-001, 7.204185e-001, 7.211552e-001,
+7.218902e-001, 7.226252e-001, 7.233602e-001, 7.240952e-001, 7.248302e-001, 7.255653e-001, 7.263003e-001, 7.270305e-001, 7.277583e-001, 7.284862e-001,
+7.292141e-001, 7.299419e-001, 7.306698e-001, 7.313977e-001, 7.321256e-001, 7.328495e-001, 7.335706e-001, 7.342917e-001, 7.350128e-001, 7.357339e-001,
+7.364550e-001, 7.371760e-001, 7.378971e-001, 7.386169e-001, 7.393341e-001, 7.400514e-001, 7.407687e-001, 7.414860e-001, 7.422033e-001, 7.429206e-001,
+7.436379e-001, 7.443552e-001, 7.450709e-001, 7.457867e-001, 7.465025e-001, 7.472183e-001, 7.479341e-001, 7.486498e-001, 7.493656e-001, 7.500814e-001,
+7.507966e-001, 7.515114e-001, 7.522262e-001, 7.529410e-001, 7.536558e-001, 7.543706e-001, 7.550854e-001, 7.558002e-001, 7.565147e-001, 7.572231e-001,
+7.579315e-001, 7.586400e-001, 7.593484e-001, 7.600568e-001, 7.607652e-001, 7.614736e-001, 7.621820e-001, 7.628899e-001, 7.635970e-001, 7.643041e-001,
+7.650111e-001, 7.657182e-001, 7.664252e-001, 7.671323e-001, 7.678393e-001, 7.685464e-001, 7.692546e-001, 7.699635e-001, 7.706725e-001, 7.713814e-001,
+7.720903e-001, 7.727993e-001, 7.735082e-001, 7.742172e-001, 7.749261e-001, 7.756347e-001, 7.763432e-001, 7.770516e-001, 7.777601e-001, 7.784685e-001,
+7.791770e-001, 7.798855e-001, 7.805939e-001, 7.813024e-001, 7.820088e-001, 7.827143e-001, 7.834197e-001, 7.841252e-001, 7.848306e-001, 7.855361e-001,
+7.862415e-001, 7.869470e-001, 7.876524e-001, 7.883579e-001, 7.890635e-001, 7.897690e-001, 7.904745e-001, 7.911800e-001, 7.918856e-001, 7.925911e-001,
+7.932966e-001, 7.940022e-001, 7.947085e-001, 7.954171e-001, 7.961258e-001, 7.968344e-001, 7.975430e-001, 7.982517e-001, 7.989603e-001, 7.996690e-001,
+8.003776e-001, 8.010862e-001, 8.017869e-001, 8.024862e-001, 8.031854e-001, 8.038846e-001, 8.045839e-001, 8.052831e-001, 8.059823e-001, 8.066816e-001,
+8.073808e-001, 8.080780e-001, 8.087709e-001, 8.094639e-001, 8.101568e-001, 8.108497e-001, 8.115426e-001, 8.122355e-001, 8.129285e-001, 8.136214e-001,
+8.143143e-001, 8.150073e-001, 8.157003e-001, 8.163932e-001, 8.170862e-001, 8.177792e-001, 8.184722e-001, 8.191652e-001, 8.198581e-001, 8.205511e-001,
+8.212441e-001, 8.219397e-001, 8.226357e-001, 8.233316e-001, 8.240276e-001, 8.247236e-001, 8.254195e-001, 8.261155e-001, 8.268114e-001, 8.275074e-001,
+8.282034e-001, 8.288904e-001, 8.295771e-001, 8.302638e-001, 8.309505e-001, 8.316372e-001, 8.323239e-001, 8.330107e-001, 8.336974e-001, 8.343841e-001,
+8.350708e-001, 8.357519e-001, 8.364324e-001, 8.371130e-001, 8.377935e-001, 8.384741e-001, 8.391546e-001, 8.398352e-001, 8.405157e-001, 8.411963e-001,
+8.418768e-001, 8.425562e-001, 8.432352e-001, 8.439141e-001, 8.445931e-001, 8.452720e-001, 8.459510e-001, 8.466299e-001, 8.473089e-001, 8.479879e-001,
+8.486668e-001, 8.493433e-001, 8.500159e-001, 8.506884e-001, 8.513610e-001, 8.520336e-001, 8.527062e-001, 8.533788e-001, 8.540514e-001, 8.547240e-001,
+8.553965e-001, 8.560691e-001, 8.567319e-001, 8.573938e-001, 8.580557e-001, 8.587176e-001, 8.593796e-001, 8.600415e-001, 8.607034e-001, 8.613653e-001,
+8.620273e-001, 8.626892e-001, 8.633492e-001, 8.640050e-001, 8.646608e-001, 8.653166e-001, 8.659724e-001, 8.666282e-001, 8.672840e-001, 8.679398e-001,
+8.685956e-001, 8.692514e-001, 8.699072e-001, 8.705630e-001, 8.712187e-001, 8.718745e-001, 8.725302e-001, 8.731860e-001, 8.738417e-001, 8.744975e-001,
+8.751532e-001, 8.758090e-001, 8.764648e-001, 8.771205e-001, 8.777772e-001, 8.784345e-001, 8.790917e-001, 8.797490e-001, 8.804062e-001, 8.810635e-001,
+8.817207e-001, 8.823779e-001, 8.830352e-001, 8.836924e-001, 8.843497e-001, 8.850082e-001, 8.856676e-001, 8.863270e-001, 8.869864e-001, 8.876458e-001,
+8.883051e-001, 8.889645e-001, 8.896239e-001, 8.902833e-001, 8.909427e-001, 8.916020e-001, 8.922592e-001, 8.929132e-001, 8.935672e-001, 8.942213e-001,
+8.948753e-001, 8.955293e-001, 8.961833e-001, 8.968374e-001, 8.974914e-001, 8.981454e-001, 8.987994e-001, 8.994534e-001, 9.001064e-001, 9.007594e-001,
+9.014124e-001, 9.020654e-001, 9.027184e-001, 9.033715e-001, 9.040245e-001, 9.046775e-001, 9.053305e-001, 9.059835e-001, 9.066365e-001, 9.072906e-001,
+9.079454e-001, 9.086003e-001, 9.092551e-001, 9.099100e-001, 9.105648e-001, 9.112197e-001, 9.118746e-001, 9.125294e-001, 9.131843e-001, 9.138391e-001,
+9.144940e-001, 9.151384e-001, 9.157817e-001, 9.164250e-001, 9.170683e-001, 9.177115e-001, 9.183548e-001, 9.189981e-001, 9.196414e-001, 9.202847e-001,
+9.209279e-001, 9.215712e-001, 9.222134e-001, 9.228429e-001, 9.234725e-001, 9.241020e-001, 9.247316e-001, 9.253611e-001, 9.259907e-001, 9.266202e-001,
+9.272498e-001, 9.278794e-001, 9.285089e-001, 9.291385e-001, 9.297673e-001, 9.303903e-001, 9.310132e-001, 9.316362e-001, 9.322591e-001, 9.328821e-001,
+9.335051e-001, 9.341280e-001, 9.347510e-001, 9.353739e-001, 9.359969e-001, 9.366198e-001, 9.372428e-001, 9.378637e-001, 9.384845e-001, 9.391053e-001,
+9.397261e-001, 9.403469e-001, 9.409677e-001, 9.415885e-001, 9.422093e-001, 9.428302e-001, 9.434510e-001, 9.440718e-001, 9.446926e-001, 9.453074e-001,
+9.459191e-001, 9.465308e-001, 9.471425e-001, 9.477542e-001, 9.483659e-001, 9.489776e-001, 9.495893e-001, 9.502010e-001, 9.508127e-001, 9.514244e-001,
+9.520361e-001, 9.526459e-001, 9.532474e-001, 9.538489e-001, 9.544504e-001, 9.550519e-001, 9.556534e-001, 9.562549e-001, 9.568564e-001, 9.574579e-001,
+9.580595e-001, 9.586610e-001, 9.592625e-001, 9.598640e-001, 9.604597e-001, 9.610504e-001, 9.616412e-001, 9.622320e-001, 9.628228e-001, 9.634135e-001,
+9.640043e-001, 9.645951e-001, 9.651858e-001, 9.657766e-001, 9.663674e-001, 9.669582e-001, 9.675489e-001, 9.681263e-001, 9.686986e-001, 9.692708e-001,
+9.698431e-001, 9.704154e-001, 9.709877e-001, 9.715599e-001, 9.721322e-001, 9.727045e-001, 9.732768e-001, 9.738491e-001, 9.744213e-001, 9.749936e-001,
+9.755455e-001, 9.760901e-001, 9.766348e-001, 9.771794e-001, 9.777241e-001, 9.782687e-001, 9.788134e-001, 9.793580e-001, 9.799026e-001, 9.804473e-001,
+9.809919e-001, 9.815366e-001, 9.820812e-001, 9.826056e-001, 9.831151e-001, 9.836246e-001, 9.841340e-001, 9.846435e-001, 9.851529e-001, 9.856624e-001,
+9.861719e-001, 9.866813e-001, 9.871908e-001, 9.877002e-001, 9.882097e-001, 9.887192e-001, 9.892141e-001, 9.896610e-001, 9.901078e-001, 9.905546e-001,
+9.910014e-001, 9.914483e-001, 9.918951e-001, 9.923419e-001, 9.927888e-001, 9.932356e-001, 9.936824e-001, 9.941292e-001, 9.945761e-001, 9.950229e-001,
+9.954037e-001, 9.957573e-001, 9.961109e-001, 9.964644e-001, 9.968180e-001, 9.971715e-001, 9.975251e-001, 9.978786e-001, 9.982322e-001, 9.985858e-001,
+9.989393e-001, 9.992929e-001, 9.996464e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.029820e-003, 1.332442e-002, 1.903511e-002, 2.420171e-002, 2.898595e-002, 3.347066e-002, 3.770718e-002, 4.176037e-002, 4.567828e-002,
+4.943002e-002, 5.302488e-002, 5.646293e-002, 5.978905e-002, 6.307826e-002, 6.634339e-002, 6.950553e-002, 7.253340e-002, 7.547407e-002, 7.833501e-002,
+8.115794e-002, 8.396376e-002, 8.671407e-002, 8.943013e-002, 9.210172e-002, 9.471714e-002, 9.729089e-002, 9.982202e-002, 1.023030e-001, 1.047497e-001,
+1.071518e-001, 1.095222e-001, 1.118748e-001, 1.141935e-001, 1.164946e-001, 1.187560e-001, 1.210196e-001, 1.232483e-001, 1.254475e-001, 1.275982e-001,
+1.297465e-001, 1.318780e-001, 1.339951e-001, 1.361036e-001, 1.381817e-001, 1.402492e-001, 1.422760e-001, 1.442877e-001, 1.462760e-001, 1.482368e-001,
+1.501838e-001, 1.520957e-001, 1.539966e-001, 1.559010e-001, 1.577883e-001, 1.596692e-001, 1.615532e-001, 1.634092e-001, 1.652537e-001, 1.670916e-001,
+1.689037e-001, 1.707046e-001, 1.724977e-001, 1.742754e-001, 1.760345e-001, 1.777956e-001, 1.795549e-001, 1.812912e-001, 1.830189e-001, 1.847521e-001,
+1.864724e-001, 1.881736e-001, 1.898707e-001, 1.915745e-001, 1.932611e-001, 1.949309e-001, 1.965950e-001, 1.982465e-001, 1.998753e-001, 2.014865e-001,
+2.030903e-001, 2.046859e-001, 2.062691e-001, 2.078414e-001, 2.094068e-001, 2.109739e-001, 2.125507e-001, 2.141104e-001, 2.156585e-001, 2.172029e-001,
+2.187507e-001, 2.203053e-001, 2.218398e-001, 2.233646e-001, 2.248875e-001, 2.264140e-001, 2.279502e-001, 2.294773e-001, 2.309952e-001, 2.325080e-001,
+2.340212e-001, 2.355341e-001, 2.370382e-001, 2.385328e-001, 2.400145e-001, 2.414942e-001, 2.429734e-001, 2.444527e-001, 2.459247e-001, 2.473871e-001,
+2.488388e-001, 2.502842e-001, 2.517312e-001, 2.531800e-001, 2.546123e-001, 2.560353e-001, 2.574463e-001, 2.588512e-001, 2.602563e-001, 2.616656e-001,
+2.630712e-001, 2.644746e-001, 2.658650e-001, 2.672511e-001, 2.686301e-001, 2.700101e-001, 2.713906e-001, 2.727720e-001, 2.741498e-001, 2.755184e-001,
+2.768801e-001, 2.782357e-001, 2.795908e-001, 2.809457e-001, 2.822989e-001, 2.836497e-001, 2.849884e-001, 2.863220e-001, 2.876453e-001, 2.889670e-001,
+2.902868e-001, 2.916113e-001, 2.929392e-001, 2.942663e-001, 2.955930e-001, 2.969134e-001, 2.982315e-001, 2.995442e-001, 3.008552e-001, 3.021624e-001,
+3.034685e-001, 3.047659e-001, 3.060602e-001, 3.073394e-001, 3.086117e-001, 3.098777e-001, 3.111397e-001, 3.124024e-001, 3.136657e-001, 3.149283e-001,
+3.161900e-001, 3.174473e-001, 3.186891e-001, 3.199306e-001, 3.211612e-001, 3.223917e-001, 3.236225e-001, 3.248534e-001, 3.260853e-001, 3.273182e-001,
+3.285505e-001, 3.297813e-001, 3.310122e-001, 3.322376e-001, 3.334628e-001, 3.346854e-001, 3.359063e-001, 3.371267e-001, 3.383456e-001, 3.395645e-001,
+3.407759e-001, 3.419859e-001, 3.431888e-001, 3.443804e-001, 3.455720e-001, 3.467568e-001, 3.479409e-001, 3.491263e-001, 3.503137e-001, 3.515010e-001,
+3.526913e-001, 3.538821e-001, 3.550710e-001, 3.562553e-001, 3.574397e-001, 3.586226e-001, 3.598050e-001, 3.609873e-001, 3.621699e-001, 3.633526e-001,
+3.645330e-001, 3.657092e-001, 3.668855e-001, 3.680586e-001, 3.692297e-001, 3.704009e-001, 3.715662e-001, 3.727307e-001, 3.738948e-001, 3.750544e-001,
+3.762140e-001, 3.773707e-001, 3.785191e-001, 3.796674e-001, 3.808118e-001, 3.819499e-001, 3.830880e-001, 3.842205e-001, 3.853466e-001, 3.864727e-001,
+3.875937e-001, 3.887100e-001, 3.898263e-001, 3.909427e-001, 3.920594e-001, 3.931761e-001, 3.942928e-001, 3.954096e-001, 3.965265e-001, 3.976393e-001,
+3.987472e-001, 3.998550e-001, 4.009612e-001, 4.020644e-001, 4.031675e-001, 4.042702e-001, 4.053708e-001, 4.064713e-001, 4.075718e-001, 4.086636e-001,
+4.097551e-001, 4.108466e-001, 4.119308e-001, 4.130123e-001, 4.140938e-001, 4.151681e-001, 4.162336e-001, 4.172991e-001, 4.183638e-001, 4.194228e-001,
+4.204818e-001, 4.215408e-001, 4.225961e-001, 4.236501e-001, 4.247042e-001, 4.257572e-001, 4.268083e-001, 4.278594e-001, 4.289105e-001, 4.299480e-001,
+4.309834e-001, 4.320187e-001, 4.330512e-001, 4.340782e-001, 4.351053e-001, 4.361324e-001, 4.371604e-001, 4.381886e-001, 4.392169e-001, 4.402457e-001,
+4.412771e-001, 4.423085e-001, 4.433399e-001, 4.443712e-001, 4.454025e-001, 4.464337e-001, 4.474649e-001, 4.484929e-001, 4.495203e-001, 4.505476e-001,
+4.515748e-001, 4.525993e-001, 4.536238e-001, 4.546484e-001, 4.556727e-001, 4.566963e-001, 4.577200e-001, 4.587437e-001, 4.597648e-001, 4.607819e-001,
+4.617990e-001, 4.628162e-001, 4.638265e-001, 4.648295e-001, 4.658325e-001, 4.668355e-001, 4.678359e-001, 4.688339e-001, 4.698318e-001, 4.708298e-001,
+4.718261e-001, 4.728206e-001, 4.738150e-001, 4.748095e-001, 4.758031e-001, 4.767954e-001, 4.777877e-001, 4.787800e-001, 4.797682e-001, 4.807467e-001,
+4.817251e-001, 4.827036e-001, 4.836813e-001, 4.846527e-001, 4.856242e-001, 4.865956e-001, 4.875671e-001, 4.885401e-001, 4.895133e-001, 4.904865e-001,
+4.914597e-001, 4.924297e-001, 4.933972e-001, 4.943646e-001, 4.953321e-001, 4.962972e-001, 4.972536e-001, 4.982099e-001, 4.991663e-001, 5.001226e-001,
+5.010714e-001, 5.020182e-001, 5.029650e-001, 5.039118e-001, 5.048583e-001, 5.058042e-001, 5.067501e-001, 5.076961e-001, 5.086420e-001, 5.095836e-001,
+5.105239e-001, 5.114642e-001, 5.124045e-001, 5.133436e-001, 5.142773e-001, 5.152109e-001, 5.161445e-001, 5.170782e-001, 5.180053e-001, 5.189262e-001,
+5.198470e-001, 5.207679e-001, 5.216888e-001, 5.226063e-001, 5.235229e-001, 5.244395e-001, 5.253561e-001, 5.262727e-001, 5.271935e-001, 5.281143e-001,
+5.290350e-001, 5.299558e-001, 5.308769e-001, 5.318001e-001, 5.327232e-001, 5.336464e-001, 5.345695e-001, 5.354901e-001, 5.364020e-001, 5.373139e-001,
+5.382258e-001, 5.391377e-001, 5.400485e-001, 5.409557e-001, 5.418628e-001, 5.427699e-001, 5.436771e-001, 5.445849e-001, 5.454957e-001, 5.464066e-001,
+5.473175e-001, 5.482283e-001, 5.491390e-001, 5.500462e-001, 5.509535e-001, 5.518608e-001, 5.527680e-001, 5.536753e-001, 5.545750e-001, 5.554735e-001,
+5.563721e-001, 5.572706e-001, 5.581691e-001, 5.590635e-001, 5.599551e-001, 5.608466e-001, 5.617382e-001, 5.626297e-001, 5.635217e-001, 5.644145e-001,
+5.653074e-001, 5.662003e-001, 5.670932e-001, 5.679861e-001, 5.688736e-001, 5.697603e-001, 5.706470e-001, 5.715337e-001, 5.724204e-001, 5.733030e-001,
+5.741787e-001, 5.750545e-001, 5.759303e-001, 5.768060e-001, 5.776818e-001, 5.785498e-001, 5.794163e-001, 5.802827e-001, 5.811491e-001, 5.820155e-001,
+5.828816e-001, 5.837466e-001, 5.846115e-001, 5.854765e-001, 5.863415e-001, 5.872064e-001, 5.880705e-001, 5.889336e-001, 5.897968e-001, 5.906599e-001,
+5.915231e-001, 5.923862e-001, 5.932421e-001, 5.940948e-001, 5.949474e-001, 5.958001e-001, 5.966528e-001, 5.975055e-001, 5.983492e-001, 5.991912e-001,
+6.000332e-001, 6.008752e-001, 6.017171e-001, 6.025591e-001, 6.033985e-001, 6.042375e-001, 6.050766e-001, 6.059157e-001, 6.067547e-001, 6.075938e-001,
+6.084339e-001, 6.092742e-001, 6.101144e-001, 6.109547e-001, 6.117950e-001, 6.126352e-001, 6.134643e-001, 6.142899e-001, 6.151156e-001, 6.159412e-001,
+6.167668e-001, 6.175925e-001, 6.184120e-001, 6.192271e-001, 6.200422e-001, 6.208573e-001, 6.216725e-001, 6.224876e-001, 6.233018e-001, 6.241140e-001,
+6.249262e-001, 6.257384e-001, 6.265506e-001, 6.273628e-001, 6.281750e-001, 6.289899e-001, 6.298049e-001, 6.306200e-001, 6.314350e-001, 6.322501e-001,
+6.330651e-001, 6.338756e-001, 6.346815e-001, 6.354874e-001, 6.362933e-001, 6.370993e-001, 6.379052e-001, 6.387111e-001, 6.395063e-001, 6.403012e-001,
+6.410961e-001, 6.418910e-001, 6.426859e-001, 6.434809e-001, 6.442745e-001, 6.450660e-001, 6.458574e-001, 6.466488e-001, 6.474402e-001, 6.482317e-001,
+6.490231e-001, 6.498171e-001, 6.506125e-001, 6.514078e-001, 6.522032e-001, 6.529986e-001, 6.537940e-001, 6.545893e-001, 6.553863e-001, 6.561836e-001,
+6.569808e-001, 6.577781e-001, 6.585754e-001, 6.593727e-001, 6.601699e-001, 6.609578e-001, 6.617453e-001, 6.625327e-001, 6.633201e-001, 6.641076e-001,
+6.648950e-001, 6.656825e-001, 6.664659e-001, 6.672493e-001, 6.680326e-001, 6.688159e-001, 6.695993e-001, 6.703826e-001, 6.711659e-001, 6.719505e-001,
+6.727352e-001, 6.735200e-001, 6.743047e-001, 6.750894e-001, 6.758741e-001, 6.766588e-001, 6.774402e-001, 6.782203e-001, 6.790003e-001, 6.797804e-001,
+6.805605e-001, 6.813405e-001, 6.821206e-001, 6.828963e-001, 6.836666e-001, 6.844369e-001, 6.852072e-001, 6.859775e-001, 6.867478e-001, 6.875181e-001,
+6.882881e-001, 6.890543e-001, 6.898205e-001, 6.905867e-001, 6.913528e-001, 6.921190e-001, 6.928852e-001, 6.936514e-001, 6.944183e-001, 6.951859e-001,
+6.959534e-001, 6.967209e-001, 6.974884e-001, 6.982559e-001, 6.990235e-001, 6.997909e-001, 7.005546e-001, 7.013184e-001, 7.020821e-001, 7.028458e-001,
+7.036095e-001, 7.043732e-001, 7.051369e-001, 7.058975e-001, 7.066521e-001, 7.074067e-001, 7.081613e-001, 7.089159e-001, 7.096705e-001, 7.104251e-001,
+7.111797e-001, 7.119320e-001, 7.126826e-001, 7.134332e-001, 7.141839e-001, 7.149345e-001, 7.156851e-001, 7.164357e-001, 7.171863e-001, 7.179378e-001,
+7.186898e-001, 7.194417e-001, 7.201937e-001, 7.209457e-001, 7.216976e-001, 7.224496e-001, 7.232016e-001, 7.239469e-001, 7.246891e-001, 7.254313e-001,
+7.261735e-001, 7.269157e-001, 7.276579e-001, 7.284002e-001, 7.291424e-001, 7.298779e-001, 7.306084e-001, 7.313390e-001, 7.320696e-001, 7.328002e-001,
+7.335308e-001, 7.342613e-001, 7.349919e-001, 7.357207e-001, 7.364464e-001, 7.371721e-001, 7.378979e-001, 7.386236e-001, 7.393493e-001, 7.400750e-001,
+7.408007e-001, 7.415264e-001, 7.422525e-001, 7.429786e-001, 7.437047e-001, 7.444308e-001, 7.451569e-001, 7.458830e-001, 7.466091e-001, 7.473352e-001,
+7.480586e-001, 7.487803e-001, 7.495019e-001, 7.502236e-001, 7.509452e-001, 7.516668e-001, 7.523885e-001, 7.531101e-001, 7.538313e-001, 7.545434e-001,
+7.552555e-001, 7.559677e-001, 7.566798e-001, 7.573919e-001, 7.581040e-001, 7.588162e-001, 7.595283e-001, 7.602388e-001, 7.609465e-001, 7.616543e-001,
+7.623620e-001, 7.630698e-001, 7.637775e-001, 7.644853e-001, 7.651931e-001, 7.659008e-001, 7.666099e-001, 7.673200e-001, 7.680300e-001, 7.687400e-001,
+7.694501e-001, 7.701601e-001, 7.708701e-001, 7.715802e-001, 7.722902e-001, 7.730041e-001, 7.737196e-001, 7.744352e-001, 7.751507e-001, 7.758663e-001,
+7.765818e-001, 7.772974e-001, 7.780129e-001, 7.787285e-001, 7.794387e-001, 7.801463e-001, 7.808538e-001, 7.815613e-001, 7.822689e-001, 7.829764e-001,
+7.836840e-001, 7.843915e-001, 7.850990e-001, 7.858043e-001, 7.865074e-001, 7.872106e-001, 7.879137e-001, 7.886169e-001, 7.893200e-001, 7.900232e-001,
+7.907263e-001, 7.914295e-001, 7.921327e-001, 7.928364e-001, 7.935400e-001, 7.942436e-001, 7.949472e-001, 7.956509e-001, 7.963545e-001, 7.970581e-001,
+7.977617e-001, 7.984653e-001, 7.991653e-001, 7.998645e-001, 8.005638e-001, 8.012631e-001, 8.019624e-001, 8.026616e-001, 8.033609e-001, 8.040602e-001,
+8.047594e-001, 8.054556e-001, 8.061455e-001, 8.068354e-001, 8.075252e-001, 8.082151e-001, 8.089050e-001, 8.095948e-001, 8.102847e-001, 8.109745e-001,
+8.116644e-001, 8.123514e-001, 8.130369e-001, 8.137225e-001, 8.144080e-001, 8.150935e-001, 8.157791e-001, 8.164646e-001, 8.171501e-001, 8.178357e-001,
+8.185212e-001, 8.192059e-001, 8.198904e-001, 8.205749e-001, 8.212595e-001, 8.219440e-001, 8.226286e-001, 8.233131e-001, 8.239976e-001, 8.246822e-001,
+8.253667e-001, 8.260425e-001, 8.267179e-001, 8.273934e-001, 8.280689e-001, 8.287443e-001, 8.294198e-001, 8.300952e-001, 8.307707e-001, 8.314462e-001,
+8.321216e-001, 8.327894e-001, 8.334565e-001, 8.341235e-001, 8.347906e-001, 8.354576e-001, 8.361247e-001, 8.367917e-001, 8.374588e-001, 8.381258e-001,
+8.387929e-001, 8.394574e-001, 8.401210e-001, 8.407846e-001, 8.414482e-001, 8.421118e-001, 8.427755e-001, 8.434391e-001, 8.441027e-001, 8.447663e-001,
+8.454299e-001, 8.460934e-001, 8.467570e-001, 8.474205e-001, 8.480840e-001, 8.487475e-001, 8.494110e-001, 8.500745e-001, 8.507381e-001, 8.514016e-001,
+8.520651e-001, 8.527286e-001, 8.533846e-001, 8.540399e-001, 8.546953e-001, 8.553506e-001, 8.560060e-001, 8.566613e-001, 8.573167e-001, 8.579720e-001,
+8.586274e-001, 8.592827e-001, 8.599356e-001, 8.605830e-001, 8.612305e-001, 8.618780e-001, 8.625254e-001, 8.631729e-001, 8.638204e-001, 8.644678e-001,
+8.651153e-001, 8.657627e-001, 8.664102e-001, 8.670559e-001, 8.677003e-001, 8.683447e-001, 8.689891e-001, 8.696335e-001, 8.702778e-001, 8.709222e-001,
+8.715666e-001, 8.722110e-001, 8.728554e-001, 8.734998e-001, 8.741462e-001, 8.747938e-001, 8.754413e-001, 8.760888e-001, 8.767364e-001, 8.773839e-001,
+8.780314e-001, 8.786790e-001, 8.793265e-001, 8.799740e-001, 8.806216e-001, 8.812701e-001, 8.819192e-001, 8.825684e-001, 8.832175e-001, 8.838667e-001,
+8.845158e-001, 8.851649e-001, 8.858141e-001, 8.864632e-001, 8.871124e-001, 8.877615e-001, 8.884072e-001, 8.890481e-001, 8.896891e-001, 8.903300e-001,
+8.909709e-001, 8.916118e-001, 8.922527e-001, 8.928936e-001, 8.935345e-001, 8.941755e-001, 8.948164e-001, 8.954571e-001, 8.960944e-001, 8.967317e-001,
+8.973690e-001, 8.980063e-001, 8.986436e-001, 8.992809e-001, 8.999182e-001, 9.005555e-001, 9.011928e-001, 9.018301e-001, 9.024674e-001, 9.031061e-001,
+9.037460e-001, 9.043858e-001, 9.050256e-001, 9.056654e-001, 9.063052e-001, 9.069450e-001, 9.075848e-001, 9.082246e-001, 9.088645e-001, 9.095043e-001,
+9.101441e-001, 9.107883e-001, 9.114330e-001, 9.120777e-001, 9.127225e-001, 9.133672e-001, 9.140119e-001, 9.146566e-001, 9.153013e-001, 9.159461e-001,
+9.165908e-001, 9.172355e-001, 9.178793e-001, 9.185126e-001, 9.191460e-001, 9.197793e-001, 9.204127e-001, 9.210460e-001, 9.216794e-001, 9.223127e-001,
+9.229461e-001, 9.235794e-001, 9.242128e-001, 9.248462e-001, 9.254785e-001, 9.261021e-001, 9.267257e-001, 9.273493e-001, 9.279729e-001, 9.285965e-001,
+9.292202e-001, 9.298438e-001, 9.304674e-001, 9.310910e-001, 9.317146e-001, 9.323382e-001, 9.329618e-001, 9.335851e-001, 9.342085e-001, 9.348318e-001,
+9.354551e-001, 9.360784e-001, 9.367017e-001, 9.373250e-001, 9.379483e-001, 9.385717e-001, 9.391950e-001, 9.398183e-001, 9.404416e-001, 9.410626e-001,
+9.416825e-001, 9.423023e-001, 9.429222e-001, 9.435420e-001, 9.441618e-001, 9.447817e-001, 9.454015e-001, 9.460214e-001, 9.466412e-001, 9.472611e-001,
+9.478809e-001, 9.484994e-001, 9.491122e-001, 9.497249e-001, 9.503376e-001, 9.509503e-001, 9.515630e-001, 9.521758e-001, 9.527885e-001, 9.534012e-001,
+9.540139e-001, 9.546267e-001, 9.552394e-001, 9.558521e-001, 9.564607e-001, 9.570658e-001, 9.576709e-001, 9.582760e-001, 9.588811e-001, 9.594862e-001,
+9.600913e-001, 9.606964e-001, 9.613015e-001, 9.619066e-001, 9.625117e-001, 9.631168e-001, 9.637220e-001, 9.643182e-001, 9.649111e-001, 9.655040e-001,
+9.660970e-001, 9.666899e-001, 9.672828e-001, 9.678757e-001, 9.684687e-001, 9.690616e-001, 9.696545e-001, 9.702474e-001, 9.708404e-001, 9.714333e-001,
+9.720123e-001, 9.725864e-001, 9.731606e-001, 9.737347e-001, 9.743088e-001, 9.748830e-001, 9.754571e-001, 9.760312e-001, 9.766053e-001, 9.771795e-001,
+9.777536e-001, 9.783277e-001, 9.789019e-001, 9.794645e-001, 9.800187e-001, 9.805728e-001, 9.811270e-001, 9.816811e-001, 9.822353e-001, 9.827894e-001,
+9.833436e-001, 9.838977e-001, 9.844519e-001, 9.850060e-001, 9.855602e-001, 9.861143e-001, 9.866619e-001, 9.871875e-001, 9.877132e-001, 9.882388e-001,
+9.887645e-001, 9.892901e-001, 9.898158e-001, 9.903414e-001, 9.908671e-001, 9.913927e-001, 9.919184e-001, 9.924440e-001, 9.929697e-001, 9.934953e-001,
+9.939769e-001, 9.944402e-001, 9.949035e-001, 9.953668e-001, 9.958301e-001, 9.962934e-001, 9.967568e-001, 9.972201e-001, 9.976834e-001, 9.981467e-001,
+9.986100e-001, 9.990734e-001, 9.995367e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.955924e-003, 9.543855e-003, 1.379576e-002, 1.777288e-002, 2.153001e-002, 2.513657e-002, 2.856604e-002, 3.182400e-002, 3.497234e-002,
+3.805990e-002, 4.103339e-002, 4.385792e-002, 4.661506e-002, 4.932071e-002, 5.198265e-002, 5.456492e-002, 5.708650e-002, 5.953240e-002, 6.191453e-002,
+6.426166e-002, 6.658791e-002, 6.890354e-002, 7.121086e-002, 7.348413e-002, 7.570396e-002, 7.787915e-002, 8.003945e-002, 8.216146e-002, 8.425503e-002,
+8.632654e-002, 8.836736e-002, 9.038178e-002, 9.236869e-002, 9.432819e-002, 9.627888e-002, 9.821891e-002, 1.001423e-001, 1.020568e-001, 1.039576e-001,
+1.058445e-001, 1.077137e-001, 1.095665e-001, 1.114090e-001, 1.132375e-001, 1.150472e-001, 1.168476e-001, 1.186361e-001, 1.204114e-001, 1.221595e-001,
+1.238817e-001, 1.255871e-001, 1.272871e-001, 1.289671e-001, 1.306213e-001, 1.322596e-001, 1.338987e-001, 1.355329e-001, 1.371469e-001, 1.387544e-001,
+1.403618e-001, 1.419777e-001, 1.435961e-001, 1.452053e-001, 1.468038e-001, 1.483946e-001, 1.499822e-001, 1.515644e-001, 1.531336e-001, 1.546927e-001,
+1.562454e-001, 1.577880e-001, 1.593212e-001, 1.608412e-001, 1.623476e-001, 1.638498e-001, 1.653402e-001, 1.668277e-001, 1.683100e-001, 1.697766e-001,
+1.712322e-001, 1.726851e-001, 1.741385e-001, 1.755896e-001, 1.770340e-001, 1.784697e-001, 1.799007e-001, 1.813267e-001, 1.827555e-001, 1.841822e-001,
+1.856049e-001, 1.870243e-001, 1.884412e-001, 1.898476e-001, 1.912508e-001, 1.926520e-001, 1.940511e-001, 1.954436e-001, 1.968320e-001, 1.982161e-001,
+1.995960e-001, 2.009744e-001, 2.023516e-001, 2.037251e-001, 2.050912e-001, 2.064489e-001, 2.078043e-001, 2.091581e-001, 2.105103e-001, 2.118567e-001,
+2.131977e-001, 2.145290e-001, 2.158572e-001, 2.171828e-001, 2.185022e-001, 2.198203e-001, 2.211371e-001, 2.224554e-001, 2.237728e-001, 2.250885e-001,
+2.264020e-001, 2.277133e-001, 2.290149e-001, 2.303118e-001, 2.316036e-001, 2.328925e-001, 2.341805e-001, 2.354661e-001, 2.367486e-001, 2.380258e-001,
+2.393009e-001, 2.405749e-001, 2.418427e-001, 2.431090e-001, 2.443676e-001, 2.456243e-001, 2.468755e-001, 2.481231e-001, 2.493657e-001, 2.506079e-001,
+2.518497e-001, 2.530943e-001, 2.543403e-001, 2.555768e-001, 2.568103e-001, 2.580340e-001, 2.592557e-001, 2.604723e-001, 2.616880e-001, 2.629039e-001,
+2.641198e-001, 2.653390e-001, 2.665589e-001, 2.677815e-001, 2.690047e-001, 2.702281e-001, 2.714515e-001, 2.726681e-001, 2.738803e-001, 2.750888e-001,
+2.762930e-001, 2.774965e-001, 2.786985e-001, 2.799009e-001, 2.811063e-001, 2.823117e-001, 2.835228e-001, 2.847346e-001, 2.859403e-001, 2.871427e-001,
+2.883438e-001, 2.895428e-001, 2.907412e-001, 2.919302e-001, 2.931192e-001, 2.943034e-001, 2.954856e-001, 2.966674e-001, 2.978483e-001, 2.990293e-001,
+3.002047e-001, 3.013798e-001, 3.025488e-001, 3.037114e-001, 3.048739e-001, 3.060263e-001, 3.071787e-001, 3.083276e-001, 3.094731e-001, 3.106186e-001,
+3.117532e-001, 3.128874e-001, 3.140193e-001, 3.151476e-001, 3.162759e-001, 3.174038e-001, 3.185315e-001, 3.196596e-001, 3.207899e-001, 3.219203e-001,
+3.230482e-001, 3.241730e-001, 3.252978e-001, 3.264196e-001, 3.275402e-001, 3.286608e-001, 3.297695e-001, 3.308778e-001, 3.319845e-001, 3.330836e-001,
+3.341826e-001, 3.352804e-001, 3.363755e-001, 3.374706e-001, 3.385663e-001, 3.396627e-001, 3.407590e-001, 3.418578e-001, 3.429583e-001, 3.440589e-001,
+3.451572e-001, 3.462542e-001, 3.473512e-001, 3.484469e-001, 3.495419e-001, 3.506369e-001, 3.517260e-001, 3.528110e-001, 3.538960e-001, 3.549772e-001,
+3.560550e-001, 3.571328e-001, 3.582097e-001, 3.592854e-001, 3.603610e-001, 3.614374e-001, 3.625160e-001, 3.635946e-001, 3.646731e-001, 3.657506e-001,
+3.668282e-001, 3.679057e-001, 3.689739e-001, 3.700402e-001, 3.711064e-001, 3.721705e-001, 3.732328e-001, 3.742951e-001, 3.753553e-001, 3.764078e-001,
+3.774604e-001, 3.785130e-001, 3.795597e-001, 3.806053e-001, 3.816510e-001, 3.826957e-001, 3.837393e-001, 3.847829e-001, 3.858265e-001, 3.868728e-001,
+3.879192e-001, 3.889656e-001, 3.900117e-001, 3.910572e-001, 3.921027e-001, 3.931482e-001, 3.941898e-001, 3.952310e-001, 3.962721e-001, 3.973117e-001,
+3.983472e-001, 3.993827e-001, 4.004181e-001, 4.014501e-001, 4.024800e-001, 4.035098e-001, 4.045396e-001, 4.055626e-001, 4.065849e-001, 4.076072e-001,
+4.086291e-001, 4.096486e-001, 4.106681e-001, 4.116876e-001, 4.127077e-001, 4.137292e-001, 4.147507e-001, 4.157722e-001, 4.167939e-001, 4.178157e-001,
+4.188375e-001, 4.198593e-001, 4.208815e-001, 4.219040e-001, 4.229265e-001, 4.239491e-001, 4.249673e-001, 4.259825e-001, 4.269978e-001, 4.280131e-001,
+4.290243e-001, 4.300325e-001, 4.310407e-001, 4.320488e-001, 4.330526e-001, 4.340521e-001, 4.350515e-001, 4.360510e-001, 4.370489e-001, 4.380442e-001,
+4.390395e-001, 4.400348e-001, 4.410301e-001, 4.420258e-001, 4.430215e-001, 4.440171e-001, 4.450128e-001, 4.460073e-001, 4.470018e-001, 4.479963e-001,
+4.489907e-001, 4.499833e-001, 4.509748e-001, 4.519664e-001, 4.529579e-001, 4.539454e-001, 4.549228e-001, 4.559002e-001, 4.568776e-001, 4.578550e-001,
+4.588258e-001, 4.597955e-001, 4.607652e-001, 4.617349e-001, 4.627009e-001, 4.636612e-001, 4.646215e-001, 4.655818e-001, 4.665421e-001, 4.674983e-001,
+4.684537e-001, 4.694092e-001, 4.703646e-001, 4.713195e-001, 4.722726e-001, 4.732257e-001, 4.741788e-001, 4.751319e-001, 4.760792e-001, 4.770226e-001,
+4.779661e-001, 4.789095e-001, 4.798529e-001, 4.807907e-001, 4.817276e-001, 4.826646e-001, 4.836015e-001, 4.845382e-001, 4.854718e-001, 4.864053e-001,
+4.873388e-001, 4.882724e-001, 4.892037e-001, 4.901269e-001, 4.910501e-001, 4.919733e-001, 4.928966e-001, 4.938174e-001, 4.947328e-001, 4.956482e-001,
+4.965636e-001, 4.974789e-001, 4.983932e-001, 4.993051e-001, 5.002170e-001, 5.011289e-001, 5.020408e-001, 5.029530e-001, 5.038658e-001, 5.047786e-001,
+5.056914e-001, 5.066043e-001, 5.075178e-001, 5.084359e-001, 5.093541e-001, 5.102722e-001, 5.111904e-001, 5.121085e-001, 5.130287e-001, 5.139491e-001,
+5.148694e-001, 5.157897e-001, 5.167100e-001, 5.176302e-001, 5.185502e-001, 5.194702e-001, 5.203902e-001, 5.213103e-001, 5.222290e-001, 5.231454e-001,
+5.240617e-001, 5.249780e-001, 5.258943e-001, 5.268107e-001, 5.277203e-001, 5.286294e-001, 5.295385e-001, 5.304475e-001, 5.313566e-001, 5.322644e-001,
+5.331705e-001, 5.340766e-001, 5.349827e-001, 5.358888e-001, 5.367949e-001, 5.377020e-001, 5.386093e-001, 5.395165e-001, 5.404237e-001, 5.413310e-001,
+5.422391e-001, 5.431496e-001, 5.440601e-001, 5.449706e-001, 5.458811e-001, 5.467916e-001, 5.476972e-001, 5.485989e-001, 5.495005e-001, 5.504022e-001,
+5.513038e-001, 5.522055e-001, 5.531040e-001, 5.540016e-001, 5.548992e-001, 5.557969e-001, 5.566945e-001, 5.575921e-001, 5.584819e-001, 5.593710e-001,
+5.602600e-001, 5.611490e-001, 5.620381e-001, 5.629271e-001, 5.638100e-001, 5.646927e-001, 5.655754e-001, 5.664582e-001, 5.673409e-001, 5.682236e-001,
+5.691042e-001, 5.699848e-001, 5.708653e-001, 5.717459e-001, 5.726264e-001, 5.735070e-001, 5.743842e-001, 5.752607e-001, 5.761372e-001, 5.770137e-001,
+5.778902e-001, 5.787667e-001, 5.796405e-001, 5.805128e-001, 5.813851e-001, 5.822574e-001, 5.831297e-001, 5.840020e-001, 5.848723e-001, 5.857393e-001,
+5.866062e-001, 5.874732e-001, 5.883401e-001, 5.892071e-001, 5.900739e-001, 5.909329e-001, 5.917918e-001, 5.926508e-001, 5.935098e-001, 5.943687e-001,
+5.952277e-001, 5.960803e-001, 5.969282e-001, 5.977761e-001, 5.986240e-001, 5.994718e-001, 6.003197e-001, 6.011673e-001, 6.020082e-001, 6.028491e-001,
+6.036899e-001, 6.045308e-001, 6.053716e-001, 6.062125e-001, 6.070521e-001, 6.078900e-001, 6.087278e-001, 6.095657e-001, 6.104036e-001, 6.112414e-001,
+6.120793e-001, 6.129179e-001, 6.137568e-001, 6.145956e-001, 6.154345e-001, 6.162734e-001, 6.171123e-001, 6.179511e-001, 6.187929e-001, 6.196351e-001,
+6.204772e-001, 6.213193e-001, 6.221614e-001, 6.230035e-001, 6.238456e-001, 6.246850e-001, 6.255244e-001, 6.263638e-001, 6.272032e-001, 6.280426e-001,
+6.288820e-001, 6.297214e-001, 6.305593e-001, 6.313972e-001, 6.322351e-001, 6.330730e-001, 6.339109e-001, 6.347488e-001, 6.355867e-001, 6.364174e-001,
+6.372476e-001, 6.380779e-001, 6.389081e-001, 6.397384e-001, 6.405686e-001, 6.413989e-001, 6.422249e-001, 6.430497e-001, 6.438744e-001, 6.446992e-001,
+6.455240e-001, 6.463487e-001, 6.471735e-001, 6.479975e-001, 6.488206e-001, 6.496438e-001, 6.504669e-001, 6.512901e-001, 6.521132e-001, 6.529364e-001,
+6.537596e-001, 6.545833e-001, 6.554070e-001, 6.562307e-001, 6.570544e-001, 6.578781e-001, 6.587018e-001, 6.595255e-001, 6.603467e-001, 6.611665e-001,
+6.619863e-001, 6.628061e-001, 6.636259e-001, 6.644457e-001, 6.652655e-001, 6.660854e-001, 6.669069e-001, 6.677285e-001, 6.685500e-001, 6.693716e-001,
+6.701931e-001, 6.710147e-001, 6.718362e-001, 6.726554e-001, 6.734708e-001, 6.742863e-001, 6.751017e-001, 6.759172e-001, 6.767326e-001, 6.775481e-001,
+6.783635e-001, 6.791734e-001, 6.799798e-001, 6.807862e-001, 6.815926e-001, 6.823990e-001, 6.832054e-001, 6.840117e-001, 6.848181e-001, 6.856207e-001,
+6.864218e-001, 6.872229e-001, 6.880240e-001, 6.888251e-001, 6.896262e-001, 6.904273e-001, 6.912284e-001, 6.920284e-001, 6.928279e-001, 6.936275e-001,
+6.944270e-001, 6.952266e-001, 6.960262e-001, 6.968257e-001, 6.976253e-001, 6.984262e-001, 6.992280e-001, 7.000298e-001, 7.008315e-001, 7.016333e-001,
+7.024351e-001, 7.032368e-001, 7.040386e-001, 7.048401e-001, 7.056412e-001, 7.064423e-001, 7.072434e-001, 7.080445e-001, 7.088456e-001, 7.096467e-001,
+7.104478e-001, 7.112485e-001, 7.120447e-001, 7.128409e-001, 7.136371e-001, 7.144334e-001, 7.152296e-001, 7.160258e-001, 7.168220e-001, 7.176182e-001,
+7.184088e-001, 7.191962e-001, 7.199837e-001, 7.207712e-001, 7.215586e-001, 7.223461e-001, 7.231336e-001, 7.239210e-001, 7.247082e-001, 7.254921e-001,
+7.262760e-001, 7.270599e-001, 7.278439e-001, 7.286278e-001, 7.294117e-001, 7.301957e-001, 7.309796e-001, 7.317613e-001, 7.325401e-001, 7.333188e-001,
+7.340976e-001, 7.348763e-001, 7.356551e-001, 7.364339e-001, 7.372126e-001, 7.379914e-001, 7.387692e-001, 7.395464e-001, 7.403236e-001, 7.411009e-001,
+7.418781e-001, 7.426553e-001, 7.434326e-001, 7.442098e-001, 7.449870e-001, 7.457646e-001, 7.465424e-001, 7.473201e-001, 7.480979e-001, 7.488756e-001,
+7.496533e-001, 7.504311e-001, 7.512088e-001, 7.519865e-001, 7.527606e-001, 7.535331e-001, 7.543057e-001, 7.550783e-001, 7.558508e-001, 7.566234e-001,
+7.573959e-001, 7.581685e-001, 7.589410e-001, 7.597122e-001, 7.604822e-001, 7.612522e-001, 7.620223e-001, 7.627923e-001, 7.635624e-001, 7.643324e-001,
+7.651025e-001, 7.658725e-001, 7.666411e-001, 7.674060e-001, 7.681709e-001, 7.689358e-001, 7.697008e-001, 7.704657e-001, 7.712306e-001, 7.719955e-001,
+7.727604e-001, 7.735253e-001, 7.742832e-001, 7.750402e-001, 7.757971e-001, 7.765541e-001, 7.773110e-001, 7.780680e-001, 7.788250e-001, 7.795819e-001,
+7.803389e-001, 7.810942e-001, 7.818467e-001, 7.825993e-001, 7.833518e-001, 7.841043e-001, 7.848568e-001, 7.856093e-001, 7.863618e-001, 7.871143e-001,
+7.878668e-001, 7.886187e-001, 7.893703e-001, 7.901219e-001, 7.908735e-001, 7.916250e-001, 7.923766e-001, 7.931282e-001, 7.938798e-001, 7.946314e-001,
+7.953830e-001, 7.961322e-001, 7.968812e-001, 7.976302e-001, 7.983792e-001, 7.991282e-001, 7.998772e-001, 8.006262e-001, 8.013753e-001, 8.021243e-001,
+8.028733e-001, 8.036263e-001, 8.043793e-001, 8.051323e-001, 8.058853e-001, 8.066383e-001, 8.073913e-001, 8.081443e-001, 8.088973e-001, 8.096503e-001,
+8.104033e-001, 8.111593e-001, 8.119156e-001, 8.126718e-001, 8.134280e-001, 8.141843e-001, 8.149405e-001, 8.156968e-001, 8.164530e-001, 8.172092e-001,
+8.179655e-001, 8.187176e-001, 8.194685e-001, 8.202193e-001, 8.209701e-001, 8.217209e-001, 8.224718e-001, 8.232226e-001, 8.239734e-001, 8.247242e-001,
+8.254751e-001, 8.262231e-001, 8.269673e-001, 8.277115e-001, 8.284557e-001, 8.291999e-001, 8.299441e-001, 8.306883e-001, 8.314326e-001, 8.321768e-001,
+8.329210e-001, 8.336652e-001, 8.344091e-001, 8.351529e-001, 8.358968e-001, 8.366406e-001, 8.373845e-001, 8.381284e-001, 8.388722e-001, 8.396161e-001,
+8.403599e-001, 8.411038e-001, 8.418469e-001, 8.425887e-001, 8.433305e-001, 8.440723e-001, 8.448141e-001, 8.455559e-001, 8.462977e-001, 8.470395e-001,
+8.477812e-001, 8.485230e-001, 8.492648e-001, 8.500074e-001, 8.507504e-001, 8.514935e-001, 8.522366e-001, 8.529797e-001, 8.537227e-001, 8.544658e-001,
+8.552089e-001, 8.559520e-001, 8.566950e-001, 8.574381e-001, 8.581804e-001, 8.589222e-001, 8.596641e-001, 8.604059e-001, 8.611478e-001, 8.618897e-001,
+8.626315e-001, 8.633734e-001, 8.641153e-001, 8.648571e-001, 8.655990e-001, 8.663363e-001, 8.670711e-001, 8.678059e-001, 8.685407e-001, 8.692755e-001,
+8.700103e-001, 8.707451e-001, 8.714798e-001, 8.722146e-001, 8.729494e-001, 8.736842e-001, 8.744200e-001, 8.751570e-001, 8.758940e-001, 8.766311e-001,
+8.773681e-001, 8.781051e-001, 8.788422e-001, 8.795792e-001, 8.803162e-001, 8.810533e-001, 8.817903e-001, 8.825270e-001, 8.832603e-001, 8.839937e-001,
+8.847270e-001, 8.854603e-001, 8.861936e-001, 8.869269e-001, 8.876603e-001, 8.883936e-001, 8.891269e-001, 8.898602e-001, 8.905935e-001, 8.913232e-001,
+8.920502e-001, 8.927773e-001, 8.935043e-001, 8.942314e-001, 8.949584e-001, 8.956854e-001, 8.964125e-001, 8.971395e-001, 8.978665e-001, 8.985936e-001,
+8.993206e-001, 9.000440e-001, 9.007671e-001, 9.014902e-001, 9.022133e-001, 9.029363e-001, 9.036594e-001, 9.043825e-001, 9.051056e-001, 9.058287e-001,
+9.065518e-001, 9.072748e-001, 9.079969e-001, 9.087103e-001, 9.094237e-001, 9.101370e-001, 9.108504e-001, 9.115637e-001, 9.122771e-001, 9.129905e-001,
+9.137038e-001, 9.144172e-001, 9.151305e-001, 9.158439e-001, 9.165560e-001, 9.172585e-001, 9.179610e-001, 9.186636e-001, 9.193661e-001, 9.200686e-001,
+9.207712e-001, 9.214737e-001, 9.221762e-001, 9.228788e-001, 9.235813e-001, 9.242838e-001, 9.249864e-001, 9.256831e-001, 9.263798e-001, 9.270764e-001,
+9.277731e-001, 9.284697e-001, 9.291663e-001, 9.298630e-001, 9.305596e-001, 9.312563e-001, 9.319529e-001, 9.326495e-001, 9.333462e-001, 9.340358e-001,
+9.347219e-001, 9.354081e-001, 9.360942e-001, 9.367804e-001, 9.374665e-001, 9.381527e-001, 9.388388e-001, 9.395250e-001, 9.402111e-001, 9.408973e-001,
+9.415834e-001, 9.422674e-001, 9.429422e-001, 9.436171e-001, 9.442920e-001, 9.449669e-001, 9.456418e-001, 9.463167e-001, 9.469915e-001, 9.476664e-001,
+9.483413e-001, 9.490162e-001, 9.496911e-001, 9.503659e-001, 9.510351e-001, 9.516997e-001, 9.523642e-001, 9.530287e-001, 9.536932e-001, 9.543578e-001,
+9.550223e-001, 9.556868e-001, 9.563513e-001, 9.570159e-001, 9.576804e-001, 9.583449e-001, 9.590094e-001, 9.596667e-001, 9.603213e-001, 9.609760e-001,
+9.616306e-001, 9.622852e-001, 9.629399e-001, 9.635945e-001, 9.642491e-001, 9.649038e-001, 9.655584e-001, 9.662130e-001, 9.668677e-001, 9.675223e-001,
+9.681680e-001, 9.688106e-001, 9.694532e-001, 9.700959e-001, 9.707385e-001, 9.713811e-001, 9.720237e-001, 9.726664e-001, 9.733090e-001, 9.739516e-001,
+9.745942e-001, 9.752369e-001, 9.758795e-001, 9.765092e-001, 9.771294e-001, 9.777497e-001, 9.783700e-001, 9.789903e-001, 9.796106e-001, 9.802309e-001,
+9.808511e-001, 9.814714e-001, 9.820917e-001, 9.827120e-001, 9.833323e-001, 9.839525e-001, 9.845648e-001, 9.851509e-001, 9.857371e-001, 9.863232e-001,
+9.869093e-001, 9.874954e-001, 9.880815e-001, 9.886677e-001, 9.892538e-001, 9.898399e-001, 9.904260e-001, 9.910122e-001, 9.915983e-001, 9.921844e-001,
+9.927504e-001, 9.933080e-001, 9.938657e-001, 9.944234e-001, 9.949810e-001, 9.955387e-001, 9.960963e-001, 9.966540e-001, 9.972117e-001, 9.977693e-001,
+9.983270e-001, 9.988847e-001, 9.994423e-001, 1.000000e+000)),
+("Kodak", "Gold 100", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.551271e-003, 1.662117e-002, 2.392172e-002, 3.059709e-002, 3.675983e-002, 4.258679e-002, 4.812296e-002, 5.336159e-002, 5.839256e-002,
+6.320386e-002, 6.784581e-002, 7.236635e-002, 7.674368e-002, 8.094087e-002, 8.502478e-002, 8.902025e-002, 9.290835e-002, 9.675492e-002, 1.004967e-001,
+1.041401e-001, 1.076879e-001, 1.111321e-001, 1.145434e-001, 1.179337e-001, 1.213003e-001, 1.246235e-001, 1.278907e-001, 1.311020e-001, 1.342176e-001,
+1.372643e-001, 1.402869e-001, 1.433072e-001, 1.463229e-001, 1.493196e-001, 1.522929e-001, 1.552488e-001, 1.581514e-001, 1.609746e-001, 1.637528e-001,
+1.664922e-001, 1.691894e-001, 1.718754e-001, 1.745573e-001, 1.772463e-001, 1.799204e-001, 1.825827e-001, 1.852307e-001, 1.878415e-001, 1.904178e-001,
+1.929836e-001, 1.955551e-001, 1.980940e-001, 2.005961e-001, 2.030780e-001, 2.055499e-001, 2.080249e-001, 2.104937e-001, 2.129533e-001, 2.153918e-001,
+2.178139e-001, 2.202032e-001, 2.225545e-001, 2.248750e-001, 2.271793e-001, 2.294784e-001, 2.317693e-001, 2.340329e-001, 2.362952e-001, 2.385397e-001,
+2.407683e-001, 2.429841e-001, 2.451926e-001, 2.473980e-001, 2.495967e-001, 2.518012e-001, 2.540043e-001, 2.561991e-001, 2.583767e-001, 2.605303e-001,
+2.626619e-001, 2.647795e-001, 2.668897e-001, 2.689956e-001, 2.710914e-001, 2.731707e-001, 2.752295e-001, 2.772876e-001, 2.793471e-001, 2.813899e-001,
+2.834161e-001, 2.854353e-001, 2.874429e-001, 2.894397e-001, 2.914343e-001, 2.934267e-001, 2.954251e-001, 2.974229e-001, 2.994060e-001, 3.013805e-001,
+3.033459e-001, 3.052975e-001, 3.072321e-001, 3.091601e-001, 3.110799e-001, 3.129976e-001, 3.149157e-001, 3.168310e-001, 3.187419e-001, 3.206558e-001,
+3.225586e-001, 3.244570e-001, 3.263501e-001, 3.282351e-001, 3.301093e-001, 3.319671e-001, 3.338209e-001, 3.356688e-001, 3.375090e-001, 3.393396e-001,
+3.411692e-001, 3.429956e-001, 3.448180e-001, 3.466367e-001, 3.484556e-001, 3.502711e-001, 3.520781e-001, 3.538729e-001, 3.556573e-001, 3.574327e-001,
+3.591986e-001, 3.609503e-001, 3.626966e-001, 3.644376e-001, 3.661717e-001, 3.679068e-001, 3.696404e-001, 3.713722e-001, 3.730971e-001, 3.748180e-001,
+3.765349e-001, 3.782504e-001, 3.799590e-001, 3.816598e-001, 3.833527e-001, 3.850415e-001, 3.867243e-001, 3.883965e-001, 3.900655e-001, 3.917333e-001,
+3.933978e-001, 3.950598e-001, 3.967128e-001, 3.983623e-001, 4.000048e-001, 4.016446e-001, 4.032828e-001, 4.049166e-001, 4.065478e-001, 4.081723e-001,
+4.097916e-001, 4.114066e-001, 4.130186e-001, 4.146289e-001, 4.162240e-001, 4.178164e-001, 4.194016e-001, 4.209814e-001, 4.225557e-001, 4.241304e-001,
+4.257053e-001, 4.272772e-001, 4.288484e-001, 4.304056e-001, 4.319624e-001, 4.335189e-001, 4.350733e-001, 4.366205e-001, 4.381665e-001, 4.397100e-001,
+4.412517e-001, 4.427906e-001, 4.443262e-001, 4.458573e-001, 4.473834e-001, 4.489030e-001, 4.504176e-001, 4.519257e-001, 4.534310e-001, 4.549324e-001,
+4.564325e-001, 4.579306e-001, 4.594289e-001, 4.609279e-001, 4.624247e-001, 4.639142e-001, 4.654031e-001, 4.668875e-001, 4.683718e-001, 4.698402e-001,
+4.713083e-001, 4.727698e-001, 4.742300e-001, 4.756909e-001, 4.771522e-001, 4.786089e-001, 4.800599e-001, 4.815098e-001, 4.829556e-001, 4.844014e-001,
+4.858315e-001, 4.872612e-001, 4.886828e-001, 4.901009e-001, 4.915114e-001, 4.929109e-001, 4.943102e-001, 4.957074e-001, 4.971046e-001, 4.984934e-001,
+4.998792e-001, 5.012618e-001, 5.026388e-001, 5.040158e-001, 5.053875e-001, 5.067589e-001, 5.081269e-001, 5.094919e-001, 5.108559e-001, 5.122083e-001,
+5.135608e-001, 5.149066e-001, 5.162480e-001, 5.175889e-001, 5.189248e-001, 5.202607e-001, 5.215886e-001, 5.229104e-001, 5.242322e-001, 5.255555e-001,
+5.268788e-001, 5.281957e-001, 5.295035e-001, 5.308112e-001, 5.321190e-001, 5.334268e-001, 5.347333e-001, 5.360326e-001, 5.373320e-001, 5.386299e-001,
+5.399260e-001, 5.412221e-001, 5.425089e-001, 5.437931e-001, 5.450770e-001, 5.463546e-001, 5.476322e-001, 5.489054e-001, 5.501675e-001, 5.514295e-001,
+5.526881e-001, 5.539432e-001, 5.551984e-001, 5.564481e-001, 5.576952e-001, 5.589423e-001, 5.601819e-001, 5.614199e-001, 5.626579e-001, 5.638862e-001,
+5.651138e-001, 5.663412e-001, 5.675578e-001, 5.687745e-001, 5.699902e-001, 5.711944e-001, 5.723987e-001, 5.736017e-001, 5.747934e-001, 5.759850e-001,
+5.771754e-001, 5.783530e-001, 5.795306e-001, 5.807075e-001, 5.818708e-001, 5.830342e-001, 5.841976e-001, 5.853507e-001, 5.865036e-001, 5.876565e-001,
+5.888124e-001, 5.899687e-001, 5.911251e-001, 5.922722e-001, 5.934157e-001, 5.945592e-001, 5.956989e-001, 5.968355e-001, 5.979720e-001, 5.991039e-001,
+6.002264e-001, 6.013489e-001, 6.024706e-001, 6.035846e-001, 6.046986e-001, 6.058125e-001, 6.069167e-001, 6.080184e-001, 6.091202e-001, 6.102225e-001,
+6.113256e-001, 6.124286e-001, 6.135301e-001, 6.146210e-001, 6.157119e-001, 6.168029e-001, 6.178948e-001, 6.189870e-001, 6.200792e-001, 6.211677e-001,
+6.222479e-001, 6.233282e-001, 6.244084e-001, 6.254897e-001, 6.265713e-001, 6.276528e-001, 6.287301e-001, 6.297998e-001, 6.308694e-001, 6.319391e-001,
+6.330033e-001, 6.340664e-001, 6.351294e-001, 6.361893e-001, 6.372389e-001, 6.382886e-001, 6.393382e-001, 6.403783e-001, 6.414124e-001, 6.424465e-001,
+6.434807e-001, 6.445011e-001, 6.455210e-001, 6.465409e-001, 6.475573e-001, 6.485638e-001, 6.495704e-001, 6.505770e-001, 6.515772e-001, 6.525719e-001,
+6.535666e-001, 6.545614e-001, 6.555477e-001, 6.565314e-001, 6.575151e-001, 6.584988e-001, 6.594734e-001, 6.604475e-001, 6.614216e-001, 6.623949e-001,
+6.633602e-001, 6.643255e-001, 6.652907e-001, 6.662546e-001, 6.672123e-001, 6.681699e-001, 6.691276e-001, 6.700836e-001, 6.710344e-001, 6.719852e-001,
+6.729360e-001, 6.738810e-001, 6.748094e-001, 6.757378e-001, 6.766662e-001, 6.775927e-001, 6.785131e-001, 6.794336e-001, 6.803540e-001, 6.812714e-001,
+6.821734e-001, 6.830754e-001, 6.839774e-001, 6.848791e-001, 6.857769e-001, 6.866746e-001, 6.875724e-001, 6.884701e-001, 6.893549e-001, 6.902379e-001,
+6.911210e-001, 6.920040e-001, 6.928866e-001, 6.937690e-001, 6.946514e-001, 6.955338e-001, 6.964114e-001, 6.972828e-001, 6.981541e-001, 6.990255e-001,
+6.998962e-001, 7.007628e-001, 7.016295e-001, 7.024961e-001, 7.033627e-001, 7.042225e-001, 7.050804e-001, 7.059383e-001, 7.067963e-001, 7.076509e-001,
+7.085005e-001, 7.093501e-001, 7.101997e-001, 7.110493e-001, 7.118934e-001, 7.127372e-001, 7.135811e-001, 7.144250e-001, 7.152673e-001, 7.161080e-001,
+7.169487e-001, 7.177893e-001, 7.186300e-001, 7.194681e-001, 7.203061e-001, 7.211441e-001, 7.219821e-001, 7.228179e-001, 7.236497e-001, 7.244816e-001,
+7.253135e-001, 7.261453e-001, 7.269656e-001, 7.277815e-001, 7.285973e-001, 7.294131e-001, 7.302285e-001, 7.310313e-001, 7.318341e-001, 7.326369e-001,
+7.334398e-001, 7.342394e-001, 7.350317e-001, 7.358240e-001, 7.366163e-001, 7.374085e-001, 7.381968e-001, 7.389813e-001, 7.397658e-001, 7.405504e-001,
+7.413349e-001, 7.421158e-001, 7.428950e-001, 7.436742e-001, 7.444534e-001, 7.452326e-001, 7.460039e-001, 7.467732e-001, 7.475424e-001, 7.483116e-001,
+7.490808e-001, 7.498486e-001, 7.506162e-001, 7.513838e-001, 7.521514e-001, 7.529190e-001, 7.536766e-001, 7.544324e-001, 7.551883e-001, 7.559441e-001,
+7.567000e-001, 7.574528e-001, 7.582048e-001, 7.589568e-001, 7.597088e-001, 7.604608e-001, 7.612053e-001, 7.619464e-001, 7.626876e-001, 7.634288e-001,
+7.641699e-001, 7.649001e-001, 7.656204e-001, 7.663406e-001, 7.670609e-001, 7.677812e-001, 7.684996e-001, 7.692136e-001, 7.699276e-001, 7.706416e-001,
+7.713556e-001, 7.720691e-001, 7.727693e-001, 7.734695e-001, 7.741697e-001, 7.748699e-001, 7.755701e-001, 7.762656e-001, 7.769592e-001, 7.776529e-001,
+7.783465e-001, 7.790401e-001, 7.797310e-001, 7.804161e-001, 7.811012e-001, 7.817863e-001, 7.824714e-001, 7.831565e-001, 7.838355e-001, 7.845136e-001,
+7.851916e-001, 7.858697e-001, 7.865478e-001, 7.872190e-001, 7.878778e-001, 7.885367e-001, 7.891956e-001, 7.898544e-001, 7.905133e-001, 7.911656e-001,
+7.918162e-001, 7.924668e-001, 7.931174e-001, 7.937680e-001, 7.944167e-001, 7.950556e-001, 7.956946e-001, 7.963336e-001, 7.969726e-001, 7.976116e-001,
+7.982402e-001, 7.988577e-001, 7.994753e-001, 8.000928e-001, 8.007103e-001, 8.013278e-001, 8.019409e-001, 8.025524e-001, 8.031639e-001, 8.037754e-001,
+8.043869e-001, 8.049984e-001, 8.055992e-001, 8.061989e-001, 8.067987e-001, 8.073985e-001, 8.079983e-001, 8.085979e-001, 8.091944e-001, 8.097909e-001,
+8.103873e-001, 8.109838e-001, 8.115803e-001, 8.121759e-001, 8.127642e-001, 8.133525e-001, 8.139408e-001, 8.145290e-001, 8.151173e-001, 8.157040e-001,
+8.162763e-001, 8.168487e-001, 8.174211e-001, 8.179934e-001, 8.185658e-001, 8.191381e-001, 8.197093e-001, 8.202805e-001, 8.208517e-001, 8.214229e-001,
+8.219941e-001, 8.225653e-001, 8.231305e-001, 8.236950e-001, 8.242594e-001, 8.248239e-001, 8.253884e-001, 8.259529e-001, 8.265138e-001, 8.270732e-001,
+8.276326e-001, 8.281920e-001, 8.287514e-001, 8.293108e-001, 8.298666e-001, 8.304177e-001, 8.309688e-001, 8.315199e-001, 8.320710e-001, 8.326221e-001,
+8.331729e-001, 8.337209e-001, 8.342689e-001, 8.348168e-001, 8.353648e-001, 8.359127e-001, 8.364607e-001, 8.370041e-001, 8.375454e-001, 8.380867e-001,
+8.386281e-001, 8.391694e-001, 8.397107e-001, 8.402514e-001, 8.407894e-001, 8.413274e-001, 8.418655e-001, 8.424035e-001, 8.429415e-001, 8.434796e-001,
+8.440155e-001, 8.445504e-001, 8.450853e-001, 8.456202e-001, 8.461551e-001, 8.466900e-001, 8.472244e-001, 8.477507e-001, 8.482770e-001, 8.488033e-001,
+8.493296e-001, 8.498558e-001, 8.503821e-001, 8.509024e-001, 8.514126e-001, 8.519228e-001, 8.524330e-001, 8.529431e-001, 8.534533e-001, 8.539635e-001,
+8.544732e-001, 8.549826e-001, 8.554920e-001, 8.560013e-001, 8.565107e-001, 8.570201e-001, 8.575295e-001, 8.580337e-001, 8.585366e-001, 8.590394e-001,
+8.595423e-001, 8.600451e-001, 8.605480e-001, 8.610509e-001, 8.615514e-001, 8.620515e-001, 8.625517e-001, 8.630519e-001, 8.635521e-001, 8.640523e-001,
+8.645524e-001, 8.650535e-001, 8.655548e-001, 8.660560e-001, 8.665572e-001, 8.670584e-001, 8.675597e-001, 8.680609e-001, 8.685552e-001, 8.690483e-001,
+8.695413e-001, 8.700344e-001, 8.705274e-001, 8.710204e-001, 8.715135e-001, 8.719957e-001, 8.724733e-001, 8.729510e-001, 8.734286e-001, 8.739063e-001,
+8.743839e-001, 8.748616e-001, 8.753389e-001, 8.758158e-001, 8.762927e-001, 8.767696e-001, 8.772465e-001, 8.777234e-001, 8.782003e-001, 8.786756e-001,
+8.791445e-001, 8.796134e-001, 8.800823e-001, 8.805512e-001, 8.810201e-001, 8.814890e-001, 8.819579e-001, 8.824142e-001, 8.828680e-001, 8.833217e-001,
+8.837755e-001, 8.842293e-001, 8.846831e-001, 8.851369e-001, 8.855882e-001, 8.860356e-001, 8.864830e-001, 8.869304e-001, 8.873777e-001, 8.878251e-001,
+8.882725e-001, 8.887199e-001, 8.891612e-001, 8.896014e-001, 8.900417e-001, 8.904820e-001, 8.909222e-001, 8.913625e-001, 8.918027e-001, 8.922412e-001,
+8.926743e-001, 8.931074e-001, 8.935404e-001, 8.939735e-001, 8.944066e-001, 8.948397e-001, 8.952728e-001, 8.957030e-001, 8.961309e-001, 8.965588e-001,
+8.969867e-001, 8.974147e-001, 8.978426e-001, 8.982705e-001, 8.986984e-001, 8.991193e-001, 8.995382e-001, 8.999571e-001, 9.003760e-001, 9.007949e-001,
+9.012138e-001, 9.016327e-001, 9.020516e-001, 9.024695e-001, 9.028873e-001, 9.033052e-001, 9.037230e-001, 9.041408e-001, 9.045586e-001, 9.049765e-001,
+9.053943e-001, 9.058038e-001, 9.062130e-001, 9.066223e-001, 9.070316e-001, 9.074408e-001, 9.078501e-001, 9.082594e-001, 9.086687e-001, 9.090744e-001,
+9.094800e-001, 9.098856e-001, 9.102912e-001, 9.106968e-001, 9.111024e-001, 9.115080e-001, 9.119136e-001, 9.123173e-001, 9.127207e-001, 9.131241e-001,
+9.135274e-001, 9.139308e-001, 9.143342e-001, 9.147376e-001, 9.151409e-001, 9.155405e-001, 9.159377e-001, 9.163349e-001, 9.167322e-001, 9.171294e-001,
+9.175266e-001, 9.179238e-001, 9.183210e-001, 9.187164e-001, 9.191078e-001, 9.194992e-001, 9.198907e-001, 9.202821e-001, 9.206735e-001, 9.210649e-001,
+9.214564e-001, 9.218478e-001, 9.222431e-001, 9.226387e-001, 9.230343e-001, 9.234299e-001, 9.238255e-001, 9.242212e-001, 9.246168e-001, 9.250124e-001,
+9.254067e-001, 9.257994e-001, 9.261922e-001, 9.265850e-001, 9.269778e-001, 9.273705e-001, 9.277633e-001, 9.281561e-001, 9.285488e-001, 9.289314e-001,
+9.293128e-001, 9.296941e-001, 9.300754e-001, 9.304568e-001, 9.308381e-001, 9.312195e-001, 9.316008e-001, 9.319808e-001, 9.323564e-001, 9.327320e-001,
+9.331076e-001, 9.334832e-001, 9.338588e-001, 9.342344e-001, 9.346100e-001, 9.349856e-001, 9.353610e-001, 9.357362e-001, 9.361115e-001, 9.364867e-001,
+9.368620e-001, 9.372372e-001, 9.376125e-001, 9.379877e-001, 9.383630e-001, 9.387337e-001, 9.391017e-001, 9.394698e-001, 9.398378e-001, 9.402058e-001,
+9.405738e-001, 9.409418e-001, 9.413098e-001, 9.416779e-001, 9.420405e-001, 9.424006e-001, 9.427607e-001, 9.431207e-001, 9.434808e-001, 9.438409e-001,
+9.442010e-001, 9.445611e-001, 9.449211e-001, 9.452818e-001, 9.456428e-001, 9.460037e-001, 9.463647e-001, 9.467257e-001, 9.470867e-001, 9.474476e-001,
+9.478086e-001, 9.481696e-001, 9.485284e-001, 9.488850e-001, 9.492416e-001, 9.495982e-001, 9.499548e-001, 9.503114e-001, 9.506680e-001, 9.510246e-001,
+9.513812e-001, 9.517354e-001, 9.520827e-001, 9.524299e-001, 9.527771e-001, 9.531244e-001, 9.534716e-001, 9.538188e-001, 9.541660e-001, 9.545133e-001,
+9.548605e-001, 9.552074e-001, 9.555542e-001, 9.559010e-001, 9.562478e-001, 9.565946e-001, 9.569414e-001, 9.572882e-001, 9.576350e-001, 9.579818e-001,
+9.583277e-001, 9.586725e-001, 9.590172e-001, 9.593620e-001, 9.597067e-001, 9.600515e-001, 9.603963e-001, 9.607410e-001, 9.610858e-001, 9.614306e-001,
+9.617655e-001, 9.620997e-001, 9.624338e-001, 9.627679e-001, 9.631021e-001, 9.634362e-001, 9.637704e-001, 9.641045e-001, 9.644386e-001, 9.647707e-001,
+9.650973e-001, 9.654239e-001, 9.657505e-001, 9.660771e-001, 9.664037e-001, 9.667303e-001, 9.670569e-001, 9.673835e-001, 9.677101e-001, 9.680344e-001,
+9.683567e-001, 9.686790e-001, 9.690013e-001, 9.693235e-001, 9.696458e-001, 9.699681e-001, 9.702903e-001, 9.706126e-001, 9.709349e-001, 9.712525e-001,
+9.715678e-001, 9.718831e-001, 9.721983e-001, 9.725136e-001, 9.728289e-001, 9.731442e-001, 9.734594e-001, 9.737747e-001, 9.740900e-001, 9.744007e-001,
+9.747095e-001, 9.750183e-001, 9.753271e-001, 9.756358e-001, 9.759446e-001, 9.762534e-001, 9.765622e-001, 9.768709e-001, 9.771797e-001, 9.774832e-001,
+9.777835e-001, 9.780838e-001, 9.783841e-001, 9.786844e-001, 9.789847e-001, 9.792850e-001, 9.795853e-001, 9.798856e-001, 9.801859e-001, 9.804825e-001,
+9.807746e-001, 9.810666e-001, 9.813587e-001, 9.816508e-001, 9.819428e-001, 9.822349e-001, 9.825269e-001, 9.828190e-001, 9.831110e-001, 9.834021e-001,
+9.836878e-001, 9.839735e-001, 9.842592e-001, 9.845449e-001, 9.848306e-001, 9.851163e-001, 9.854020e-001, 9.856876e-001, 9.859733e-001, 9.862590e-001,
+9.865384e-001, 9.868157e-001, 9.870929e-001, 9.873702e-001, 9.876474e-001, 9.879246e-001, 9.882019e-001, 9.884791e-001, 9.887564e-001, 9.890336e-001,
+9.893083e-001, 9.895743e-001, 9.898403e-001, 9.901063e-001, 9.903723e-001, 9.906383e-001, 9.909042e-001, 9.911702e-001, 9.914362e-001, 9.917022e-001,
+9.919682e-001, 9.922304e-001, 9.924901e-001, 9.927497e-001, 9.930093e-001, 9.932690e-001, 9.935286e-001, 9.937882e-001, 9.940478e-001, 9.943075e-001,
+9.945671e-001, 9.948267e-001, 9.950770e-001, 9.953256e-001, 9.955741e-001, 9.958227e-001, 9.960712e-001, 9.963198e-001, 9.965683e-001, 9.968169e-001,
+9.970654e-001, 9.973140e-001, 9.975625e-001, 9.977846e-001, 9.980061e-001, 9.982277e-001, 9.984492e-001, 9.986708e-001, 9.988923e-001, 9.991138e-001,
+9.993354e-001, 9.995569e-001, 9.997785e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.551271e-003, 1.662117e-002, 2.392172e-002, 3.059709e-002, 3.675983e-002, 4.258679e-002, 4.812296e-002, 5.336159e-002, 5.839256e-002,
+6.320386e-002, 6.784581e-002, 7.236635e-002, 7.674368e-002, 8.094087e-002, 8.502478e-002, 8.902025e-002, 9.290835e-002, 9.675492e-002, 1.004967e-001,
+1.041401e-001, 1.076879e-001, 1.111321e-001, 1.145434e-001, 1.179337e-001, 1.213003e-001, 1.246235e-001, 1.278907e-001, 1.311020e-001, 1.342176e-001,
+1.372643e-001, 1.402869e-001, 1.433072e-001, 1.463229e-001, 1.493196e-001, 1.522929e-001, 1.552488e-001, 1.581514e-001, 1.609746e-001, 1.637528e-001,
+1.664922e-001, 1.691894e-001, 1.718754e-001, 1.745573e-001, 1.772463e-001, 1.799204e-001, 1.825827e-001, 1.852307e-001, 1.878415e-001, 1.904178e-001,
+1.929836e-001, 1.955551e-001, 1.980940e-001, 2.005961e-001, 2.030780e-001, 2.055499e-001, 2.080249e-001, 2.104937e-001, 2.129533e-001, 2.153918e-001,
+2.178139e-001, 2.202032e-001, 2.225545e-001, 2.248750e-001, 2.271793e-001, 2.294784e-001, 2.317693e-001, 2.340329e-001, 2.362952e-001, 2.385397e-001,
+2.407683e-001, 2.429841e-001, 2.451926e-001, 2.473980e-001, 2.495967e-001, 2.518012e-001, 2.540043e-001, 2.561991e-001, 2.583767e-001, 2.605303e-001,
+2.626619e-001, 2.647795e-001, 2.668897e-001, 2.689956e-001, 2.710914e-001, 2.731707e-001, 2.752295e-001, 2.772876e-001, 2.793471e-001, 2.813899e-001,
+2.834161e-001, 2.854353e-001, 2.874429e-001, 2.894397e-001, 2.914343e-001, 2.934267e-001, 2.954251e-001, 2.974229e-001, 2.994060e-001, 3.013805e-001,
+3.033459e-001, 3.052975e-001, 3.072321e-001, 3.091601e-001, 3.110799e-001, 3.129976e-001, 3.149157e-001, 3.168310e-001, 3.187419e-001, 3.206558e-001,
+3.225586e-001, 3.244570e-001, 3.263501e-001, 3.282351e-001, 3.301093e-001, 3.319671e-001, 3.338209e-001, 3.356688e-001, 3.375090e-001, 3.393396e-001,
+3.411692e-001, 3.429956e-001, 3.448180e-001, 3.466367e-001, 3.484556e-001, 3.502711e-001, 3.520781e-001, 3.538729e-001, 3.556573e-001, 3.574327e-001,
+3.591986e-001, 3.609503e-001, 3.626966e-001, 3.644376e-001, 3.661717e-001, 3.679068e-001, 3.696404e-001, 3.713722e-001, 3.730971e-001, 3.748180e-001,
+3.765349e-001, 3.782504e-001, 3.799590e-001, 3.816598e-001, 3.833527e-001, 3.850415e-001, 3.867243e-001, 3.883965e-001, 3.900655e-001, 3.917333e-001,
+3.933978e-001, 3.950598e-001, 3.967128e-001, 3.983623e-001, 4.000048e-001, 4.016446e-001, 4.032828e-001, 4.049166e-001, 4.065478e-001, 4.081723e-001,
+4.097916e-001, 4.114066e-001, 4.130186e-001, 4.146289e-001, 4.162240e-001, 4.178164e-001, 4.194016e-001, 4.209814e-001, 4.225557e-001, 4.241304e-001,
+4.257053e-001, 4.272772e-001, 4.288484e-001, 4.304056e-001, 4.319624e-001, 4.335189e-001, 4.350733e-001, 4.366205e-001, 4.381665e-001, 4.397100e-001,
+4.412517e-001, 4.427906e-001, 4.443262e-001, 4.458573e-001, 4.473834e-001, 4.489030e-001, 4.504176e-001, 4.519257e-001, 4.534310e-001, 4.549324e-001,
+4.564325e-001, 4.579306e-001, 4.594289e-001, 4.609279e-001, 4.624247e-001, 4.639142e-001, 4.654031e-001, 4.668875e-001, 4.683718e-001, 4.698402e-001,
+4.713083e-001, 4.727698e-001, 4.742300e-001, 4.756909e-001, 4.771522e-001, 4.786089e-001, 4.800599e-001, 4.815098e-001, 4.829556e-001, 4.844014e-001,
+4.858315e-001, 4.872612e-001, 4.886828e-001, 4.901009e-001, 4.915114e-001, 4.929109e-001, 4.943102e-001, 4.957074e-001, 4.971046e-001, 4.984934e-001,
+4.998792e-001, 5.012618e-001, 5.026388e-001, 5.040158e-001, 5.053875e-001, 5.067589e-001, 5.081269e-001, 5.094919e-001, 5.108559e-001, 5.122083e-001,
+5.135608e-001, 5.149066e-001, 5.162480e-001, 5.175889e-001, 5.189248e-001, 5.202607e-001, 5.215886e-001, 5.229104e-001, 5.242322e-001, 5.255555e-001,
+5.268788e-001, 5.281957e-001, 5.295035e-001, 5.308112e-001, 5.321190e-001, 5.334268e-001, 5.347333e-001, 5.360326e-001, 5.373320e-001, 5.386299e-001,
+5.399260e-001, 5.412221e-001, 5.425089e-001, 5.437931e-001, 5.450770e-001, 5.463546e-001, 5.476322e-001, 5.489054e-001, 5.501675e-001, 5.514295e-001,
+5.526881e-001, 5.539432e-001, 5.551984e-001, 5.564481e-001, 5.576952e-001, 5.589423e-001, 5.601819e-001, 5.614199e-001, 5.626579e-001, 5.638862e-001,
+5.651138e-001, 5.663412e-001, 5.675578e-001, 5.687745e-001, 5.699902e-001, 5.711944e-001, 5.723987e-001, 5.736017e-001, 5.747934e-001, 5.759850e-001,
+5.771754e-001, 5.783530e-001, 5.795306e-001, 5.807075e-001, 5.818708e-001, 5.830342e-001, 5.841976e-001, 5.853507e-001, 5.865036e-001, 5.876565e-001,
+5.888124e-001, 5.899687e-001, 5.911251e-001, 5.922722e-001, 5.934157e-001, 5.945592e-001, 5.956989e-001, 5.968355e-001, 5.979720e-001, 5.991039e-001,
+6.002264e-001, 6.013489e-001, 6.024706e-001, 6.035846e-001, 6.046986e-001, 6.058125e-001, 6.069167e-001, 6.080184e-001, 6.091202e-001, 6.102225e-001,
+6.113256e-001, 6.124286e-001, 6.135301e-001, 6.146210e-001, 6.157119e-001, 6.168029e-001, 6.178948e-001, 6.189870e-001, 6.200792e-001, 6.211677e-001,
+6.222479e-001, 6.233282e-001, 6.244084e-001, 6.254897e-001, 6.265713e-001, 6.276528e-001, 6.287301e-001, 6.297998e-001, 6.308694e-001, 6.319391e-001,
+6.330033e-001, 6.340664e-001, 6.351294e-001, 6.361893e-001, 6.372389e-001, 6.382886e-001, 6.393382e-001, 6.403783e-001, 6.414124e-001, 6.424465e-001,
+6.434807e-001, 6.445011e-001, 6.455210e-001, 6.465409e-001, 6.475573e-001, 6.485638e-001, 6.495704e-001, 6.505770e-001, 6.515772e-001, 6.525719e-001,
+6.535666e-001, 6.545614e-001, 6.555477e-001, 6.565314e-001, 6.575151e-001, 6.584988e-001, 6.594734e-001, 6.604475e-001, 6.614216e-001, 6.623949e-001,
+6.633602e-001, 6.643255e-001, 6.652907e-001, 6.662546e-001, 6.672123e-001, 6.681699e-001, 6.691276e-001, 6.700836e-001, 6.710344e-001, 6.719852e-001,
+6.729360e-001, 6.738810e-001, 6.748094e-001, 6.757378e-001, 6.766662e-001, 6.775927e-001, 6.785131e-001, 6.794336e-001, 6.803540e-001, 6.812714e-001,
+6.821734e-001, 6.830754e-001, 6.839774e-001, 6.848791e-001, 6.857769e-001, 6.866746e-001, 6.875724e-001, 6.884701e-001, 6.893549e-001, 6.902379e-001,
+6.911210e-001, 6.920040e-001, 6.928866e-001, 6.937690e-001, 6.946514e-001, 6.955338e-001, 6.964114e-001, 6.972828e-001, 6.981541e-001, 6.990255e-001,
+6.998962e-001, 7.007628e-001, 7.016295e-001, 7.024961e-001, 7.033627e-001, 7.042225e-001, 7.050804e-001, 7.059383e-001, 7.067963e-001, 7.076509e-001,
+7.085005e-001, 7.093501e-001, 7.101997e-001, 7.110493e-001, 7.118934e-001, 7.127372e-001, 7.135811e-001, 7.144250e-001, 7.152673e-001, 7.161080e-001,
+7.169487e-001, 7.177893e-001, 7.186300e-001, 7.194681e-001, 7.203061e-001, 7.211441e-001, 7.219821e-001, 7.228179e-001, 7.236497e-001, 7.244816e-001,
+7.253135e-001, 7.261453e-001, 7.269656e-001, 7.277815e-001, 7.285973e-001, 7.294131e-001, 7.302285e-001, 7.310313e-001, 7.318341e-001, 7.326369e-001,
+7.334398e-001, 7.342394e-001, 7.350317e-001, 7.358240e-001, 7.366163e-001, 7.374085e-001, 7.381968e-001, 7.389813e-001, 7.397658e-001, 7.405504e-001,
+7.413349e-001, 7.421158e-001, 7.428950e-001, 7.436742e-001, 7.444534e-001, 7.452326e-001, 7.460039e-001, 7.467732e-001, 7.475424e-001, 7.483116e-001,
+7.490808e-001, 7.498486e-001, 7.506162e-001, 7.513838e-001, 7.521514e-001, 7.529190e-001, 7.536766e-001, 7.544324e-001, 7.551883e-001, 7.559441e-001,
+7.567000e-001, 7.574528e-001, 7.582048e-001, 7.589568e-001, 7.597088e-001, 7.604608e-001, 7.612053e-001, 7.619464e-001, 7.626876e-001, 7.634288e-001,
+7.641699e-001, 7.649001e-001, 7.656204e-001, 7.663406e-001, 7.670609e-001, 7.677812e-001, 7.684996e-001, 7.692136e-001, 7.699276e-001, 7.706416e-001,
+7.713556e-001, 7.720691e-001, 7.727693e-001, 7.734695e-001, 7.741697e-001, 7.748699e-001, 7.755701e-001, 7.762656e-001, 7.769592e-001, 7.776529e-001,
+7.783465e-001, 7.790401e-001, 7.797310e-001, 7.804161e-001, 7.811012e-001, 7.817863e-001, 7.824714e-001, 7.831565e-001, 7.838355e-001, 7.845136e-001,
+7.851916e-001, 7.858697e-001, 7.865478e-001, 7.872190e-001, 7.878778e-001, 7.885367e-001, 7.891956e-001, 7.898544e-001, 7.905133e-001, 7.911656e-001,
+7.918162e-001, 7.924668e-001, 7.931174e-001, 7.937680e-001, 7.944167e-001, 7.950556e-001, 7.956946e-001, 7.963336e-001, 7.969726e-001, 7.976116e-001,
+7.982402e-001, 7.988577e-001, 7.994753e-001, 8.000928e-001, 8.007103e-001, 8.013278e-001, 8.019409e-001, 8.025524e-001, 8.031639e-001, 8.037754e-001,
+8.043869e-001, 8.049984e-001, 8.055992e-001, 8.061989e-001, 8.067987e-001, 8.073985e-001, 8.079983e-001, 8.085979e-001, 8.091944e-001, 8.097909e-001,
+8.103873e-001, 8.109838e-001, 8.115803e-001, 8.121759e-001, 8.127642e-001, 8.133525e-001, 8.139408e-001, 8.145290e-001, 8.151173e-001, 8.157040e-001,
+8.162763e-001, 8.168487e-001, 8.174211e-001, 8.179934e-001, 8.185658e-001, 8.191381e-001, 8.197093e-001, 8.202805e-001, 8.208517e-001, 8.214229e-001,
+8.219941e-001, 8.225653e-001, 8.231305e-001, 8.236950e-001, 8.242594e-001, 8.248239e-001, 8.253884e-001, 8.259529e-001, 8.265138e-001, 8.270732e-001,
+8.276326e-001, 8.281920e-001, 8.287514e-001, 8.293108e-001, 8.298666e-001, 8.304177e-001, 8.309688e-001, 8.315199e-001, 8.320710e-001, 8.326221e-001,
+8.331729e-001, 8.337209e-001, 8.342689e-001, 8.348168e-001, 8.353648e-001, 8.359127e-001, 8.364607e-001, 8.370041e-001, 8.375454e-001, 8.380867e-001,
+8.386281e-001, 8.391694e-001, 8.397107e-001, 8.402514e-001, 8.407894e-001, 8.413274e-001, 8.418655e-001, 8.424035e-001, 8.429415e-001, 8.434796e-001,
+8.440155e-001, 8.445504e-001, 8.450853e-001, 8.456202e-001, 8.461551e-001, 8.466900e-001, 8.472244e-001, 8.477507e-001, 8.482770e-001, 8.488033e-001,
+8.493296e-001, 8.498558e-001, 8.503821e-001, 8.509024e-001, 8.514126e-001, 8.519228e-001, 8.524330e-001, 8.529431e-001, 8.534533e-001, 8.539635e-001,
+8.544732e-001, 8.549826e-001, 8.554920e-001, 8.560013e-001, 8.565107e-001, 8.570201e-001, 8.575295e-001, 8.580337e-001, 8.585366e-001, 8.590394e-001,
+8.595423e-001, 8.600451e-001, 8.605480e-001, 8.610509e-001, 8.615514e-001, 8.620515e-001, 8.625517e-001, 8.630519e-001, 8.635521e-001, 8.640523e-001,
+8.645524e-001, 8.650535e-001, 8.655548e-001, 8.660560e-001, 8.665572e-001, 8.670584e-001, 8.675597e-001, 8.680609e-001, 8.685552e-001, 8.690483e-001,
+8.695413e-001, 8.700344e-001, 8.705274e-001, 8.710204e-001, 8.715135e-001, 8.719957e-001, 8.724733e-001, 8.729510e-001, 8.734286e-001, 8.739063e-001,
+8.743839e-001, 8.748616e-001, 8.753389e-001, 8.758158e-001, 8.762927e-001, 8.767696e-001, 8.772465e-001, 8.777234e-001, 8.782003e-001, 8.786756e-001,
+8.791445e-001, 8.796134e-001, 8.800823e-001, 8.805512e-001, 8.810201e-001, 8.814890e-001, 8.819579e-001, 8.824142e-001, 8.828680e-001, 8.833217e-001,
+8.837755e-001, 8.842293e-001, 8.846831e-001, 8.851369e-001, 8.855882e-001, 8.860356e-001, 8.864830e-001, 8.869304e-001, 8.873777e-001, 8.878251e-001,
+8.882725e-001, 8.887199e-001, 8.891612e-001, 8.896014e-001, 8.900417e-001, 8.904820e-001, 8.909222e-001, 8.913625e-001, 8.918027e-001, 8.922412e-001,
+8.926743e-001, 8.931074e-001, 8.935404e-001, 8.939735e-001, 8.944066e-001, 8.948397e-001, 8.952728e-001, 8.957030e-001, 8.961309e-001, 8.965588e-001,
+8.969867e-001, 8.974147e-001, 8.978426e-001, 8.982705e-001, 8.986984e-001, 8.991193e-001, 8.995382e-001, 8.999571e-001, 9.003760e-001, 9.007949e-001,
+9.012138e-001, 9.016327e-001, 9.020516e-001, 9.024695e-001, 9.028873e-001, 9.033052e-001, 9.037230e-001, 9.041408e-001, 9.045586e-001, 9.049765e-001,
+9.053943e-001, 9.058038e-001, 9.062130e-001, 9.066223e-001, 9.070316e-001, 9.074408e-001, 9.078501e-001, 9.082594e-001, 9.086687e-001, 9.090744e-001,
+9.094800e-001, 9.098856e-001, 9.102912e-001, 9.106968e-001, 9.111024e-001, 9.115080e-001, 9.119136e-001, 9.123173e-001, 9.127207e-001, 9.131241e-001,
+9.135274e-001, 9.139308e-001, 9.143342e-001, 9.147376e-001, 9.151409e-001, 9.155405e-001, 9.159377e-001, 9.163349e-001, 9.167322e-001, 9.171294e-001,
+9.175266e-001, 9.179238e-001, 9.183210e-001, 9.187164e-001, 9.191078e-001, 9.194992e-001, 9.198907e-001, 9.202821e-001, 9.206735e-001, 9.210649e-001,
+9.214564e-001, 9.218478e-001, 9.222431e-001, 9.226387e-001, 9.230343e-001, 9.234299e-001, 9.238255e-001, 9.242212e-001, 9.246168e-001, 9.250124e-001,
+9.254067e-001, 9.257994e-001, 9.261922e-001, 9.265850e-001, 9.269778e-001, 9.273705e-001, 9.277633e-001, 9.281561e-001, 9.285488e-001, 9.289314e-001,
+9.293128e-001, 9.296941e-001, 9.300754e-001, 9.304568e-001, 9.308381e-001, 9.312195e-001, 9.316008e-001, 9.319808e-001, 9.323564e-001, 9.327320e-001,
+9.331076e-001, 9.334832e-001, 9.338588e-001, 9.342344e-001, 9.346100e-001, 9.349856e-001, 9.353610e-001, 9.357362e-001, 9.361115e-001, 9.364867e-001,
+9.368620e-001, 9.372372e-001, 9.376125e-001, 9.379877e-001, 9.383630e-001, 9.387337e-001, 9.391017e-001, 9.394698e-001, 9.398378e-001, 9.402058e-001,
+9.405738e-001, 9.409418e-001, 9.413098e-001, 9.416779e-001, 9.420405e-001, 9.424006e-001, 9.427607e-001, 9.431207e-001, 9.434808e-001, 9.438409e-001,
+9.442010e-001, 9.445611e-001, 9.449211e-001, 9.452818e-001, 9.456428e-001, 9.460037e-001, 9.463647e-001, 9.467257e-001, 9.470867e-001, 9.474476e-001,
+9.478086e-001, 9.481696e-001, 9.485284e-001, 9.488850e-001, 9.492416e-001, 9.495982e-001, 9.499548e-001, 9.503114e-001, 9.506680e-001, 9.510246e-001,
+9.513812e-001, 9.517354e-001, 9.520827e-001, 9.524299e-001, 9.527771e-001, 9.531244e-001, 9.534716e-001, 9.538188e-001, 9.541660e-001, 9.545133e-001,
+9.548605e-001, 9.552074e-001, 9.555542e-001, 9.559010e-001, 9.562478e-001, 9.565946e-001, 9.569414e-001, 9.572882e-001, 9.576350e-001, 9.579818e-001,
+9.583277e-001, 9.586725e-001, 9.590172e-001, 9.593620e-001, 9.597067e-001, 9.600515e-001, 9.603963e-001, 9.607410e-001, 9.610858e-001, 9.614306e-001,
+9.617655e-001, 9.620997e-001, 9.624338e-001, 9.627679e-001, 9.631021e-001, 9.634362e-001, 9.637704e-001, 9.641045e-001, 9.644386e-001, 9.647707e-001,
+9.650973e-001, 9.654239e-001, 9.657505e-001, 9.660771e-001, 9.664037e-001, 9.667303e-001, 9.670569e-001, 9.673835e-001, 9.677101e-001, 9.680344e-001,
+9.683567e-001, 9.686790e-001, 9.690013e-001, 9.693235e-001, 9.696458e-001, 9.699681e-001, 9.702903e-001, 9.706126e-001, 9.709349e-001, 9.712525e-001,
+9.715678e-001, 9.718831e-001, 9.721983e-001, 9.725136e-001, 9.728289e-001, 9.731442e-001, 9.734594e-001, 9.737747e-001, 9.740900e-001, 9.744007e-001,
+9.747095e-001, 9.750183e-001, 9.753271e-001, 9.756358e-001, 9.759446e-001, 9.762534e-001, 9.765622e-001, 9.768709e-001, 9.771797e-001, 9.774832e-001,
+9.777835e-001, 9.780838e-001, 9.783841e-001, 9.786844e-001, 9.789847e-001, 9.792850e-001, 9.795853e-001, 9.798856e-001, 9.801859e-001, 9.804825e-001,
+9.807746e-001, 9.810666e-001, 9.813587e-001, 9.816508e-001, 9.819428e-001, 9.822349e-001, 9.825269e-001, 9.828190e-001, 9.831110e-001, 9.834021e-001,
+9.836878e-001, 9.839735e-001, 9.842592e-001, 9.845449e-001, 9.848306e-001, 9.851163e-001, 9.854020e-001, 9.856876e-001, 9.859733e-001, 9.862590e-001,
+9.865384e-001, 9.868157e-001, 9.870929e-001, 9.873702e-001, 9.876474e-001, 9.879246e-001, 9.882019e-001, 9.884791e-001, 9.887564e-001, 9.890336e-001,
+9.893083e-001, 9.895743e-001, 9.898403e-001, 9.901063e-001, 9.903723e-001, 9.906383e-001, 9.909042e-001, 9.911702e-001, 9.914362e-001, 9.917022e-001,
+9.919682e-001, 9.922304e-001, 9.924901e-001, 9.927497e-001, 9.930093e-001, 9.932690e-001, 9.935286e-001, 9.937882e-001, 9.940478e-001, 9.943075e-001,
+9.945671e-001, 9.948267e-001, 9.950770e-001, 9.953256e-001, 9.955741e-001, 9.958227e-001, 9.960712e-001, 9.963198e-001, 9.965683e-001, 9.968169e-001,
+9.970654e-001, 9.973140e-001, 9.975625e-001, 9.977846e-001, 9.980061e-001, 9.982277e-001, 9.984492e-001, 9.986708e-001, 9.988923e-001, 9.991138e-001,
+9.993354e-001, 9.995569e-001, 9.997785e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.038809e-003, 7.886972e-003, 1.158893e-002, 1.518354e-002, 1.867856e-002, 2.204632e-002, 2.531702e-002, 2.850463e-002, 3.163706e-002,
+3.469240e-002, 3.769511e-002, 4.062546e-002, 4.349996e-002, 4.634990e-002, 4.915192e-002, 5.189543e-002, 5.459837e-002, 5.726278e-002, 5.989456e-002,
+6.248868e-002, 6.505983e-002, 6.760034e-002, 7.008814e-002, 7.255326e-002, 7.499636e-002, 7.741109e-002, 7.980686e-002, 8.219532e-002, 8.455823e-002,
+8.689367e-002, 8.919886e-002, 9.149486e-002, 9.376920e-002, 9.602610e-002, 9.827037e-002, 1.005069e-001, 1.027444e-001, 1.049713e-001, 1.071827e-001,
+1.093685e-001, 1.115407e-001, 1.136909e-001, 1.158115e-001, 1.179216e-001, 1.200228e-001, 1.221132e-001, 1.241904e-001, 1.262645e-001, 1.283269e-001,
+1.303768e-001, 1.324192e-001, 1.344536e-001, 1.364852e-001, 1.385065e-001, 1.404986e-001, 1.424852e-001, 1.444735e-001, 1.464570e-001, 1.484331e-001,
+1.504010e-001, 1.523739e-001, 1.543436e-001, 1.563022e-001, 1.582522e-001, 1.601931e-001, 1.621182e-001, 1.640346e-001, 1.659478e-001, 1.678593e-001,
+1.697596e-001, 1.716435e-001, 1.735229e-001, 1.754002e-001, 1.772678e-001, 1.791308e-001, 1.809883e-001, 1.828392e-001, 1.846980e-001, 1.865592e-001,
+1.884169e-001, 1.902666e-001, 1.921051e-001, 1.939378e-001, 1.957681e-001, 1.975924e-001, 1.994120e-001, 2.012309e-001, 2.030454e-001, 2.048554e-001,
+2.066581e-001, 2.084507e-001, 2.102349e-001, 2.120145e-001, 2.137901e-001, 2.155578e-001, 2.173161e-001, 2.190670e-001, 2.208127e-001, 2.225556e-001,
+2.242987e-001, 2.260435e-001, 2.277885e-001, 2.295302e-001, 2.312686e-001, 2.329937e-001, 2.347085e-001, 2.364156e-001, 2.381126e-001, 2.397992e-001,
+2.414821e-001, 2.431667e-001, 2.448463e-001, 2.465201e-001, 2.481864e-001, 2.498457e-001, 2.515039e-001, 2.531545e-001, 2.548001e-001, 2.564424e-001,
+2.580820e-001, 2.597126e-001, 2.613438e-001, 2.629727e-001, 2.645977e-001, 2.662195e-001, 2.678410e-001, 2.694599e-001, 2.710745e-001, 2.726924e-001,
+2.743097e-001, 2.759279e-001, 2.775535e-001, 2.791811e-001, 2.808075e-001, 2.824283e-001, 2.840457e-001, 2.856619e-001, 2.872773e-001, 2.888830e-001,
+2.904839e-001, 2.920790e-001, 2.936723e-001, 2.952640e-001, 2.968523e-001, 2.984321e-001, 3.000073e-001, 3.015750e-001, 3.031345e-001, 3.046869e-001,
+3.062342e-001, 3.077784e-001, 3.093161e-001, 3.108539e-001, 3.123919e-001, 3.139242e-001, 3.154525e-001, 3.169720e-001, 3.184897e-001, 3.200064e-001,
+3.215180e-001, 3.230281e-001, 3.245337e-001, 3.260376e-001, 3.275387e-001, 3.290353e-001, 3.305289e-001, 3.320242e-001, 3.335199e-001, 3.350136e-001,
+3.365071e-001, 3.379994e-001, 3.394888e-001, 3.409719e-001, 3.424526e-001, 3.439301e-001, 3.454063e-001, 3.468815e-001, 3.483560e-001, 3.498301e-001,
+3.513007e-001, 3.527698e-001, 3.542423e-001, 3.557160e-001, 3.571884e-001, 3.586605e-001, 3.601266e-001, 3.615907e-001, 3.630562e-001, 3.645220e-001,
+3.659847e-001, 3.674460e-001, 3.689005e-001, 3.703510e-001, 3.718010e-001, 3.732504e-001, 3.746977e-001, 3.761423e-001, 3.775857e-001, 3.790262e-001,
+3.804648e-001, 3.818929e-001, 3.833210e-001, 3.847408e-001, 3.861603e-001, 3.875763e-001, 3.889911e-001, 3.904036e-001, 3.918143e-001, 3.932228e-001,
+3.946261e-001, 3.960293e-001, 3.974261e-001, 3.988228e-001, 4.002168e-001, 4.016099e-001, 4.030029e-001, 4.043960e-001, 4.057887e-001, 4.071743e-001,
+4.085599e-001, 4.099406e-001, 4.113187e-001, 4.126942e-001, 4.140626e-001, 4.154310e-001, 4.167916e-001, 4.181507e-001, 4.195038e-001, 4.208474e-001,
+4.221910e-001, 4.235304e-001, 4.248695e-001, 4.262058e-001, 4.275381e-001, 4.288704e-001, 4.302047e-001, 4.315394e-001, 4.328734e-001, 4.342061e-001,
+4.355389e-001, 4.368668e-001, 4.381929e-001, 4.395191e-001, 4.408475e-001, 4.421759e-001, 4.435034e-001, 4.448300e-001, 4.461565e-001, 4.474779e-001,
+4.487978e-001, 4.501173e-001, 4.514313e-001, 4.527453e-001, 4.540582e-001, 4.553689e-001, 4.566796e-001, 4.579857e-001, 4.592884e-001, 4.605912e-001,
+4.618828e-001, 4.631715e-001, 4.644602e-001, 4.657383e-001, 4.670161e-001, 4.682930e-001, 4.695635e-001, 4.708339e-001, 4.721035e-001, 4.733701e-001,
+4.746366e-001, 4.759002e-001, 4.771573e-001, 4.784145e-001, 4.796695e-001, 4.809209e-001, 4.821724e-001, 4.834230e-001, 4.846725e-001, 4.859219e-001,
+4.871684e-001, 4.884100e-001, 4.896516e-001, 4.908894e-001, 4.921192e-001, 4.933490e-001, 4.945765e-001, 4.957974e-001, 4.970183e-001, 4.982382e-001,
+4.994524e-001, 5.006666e-001, 5.018808e-001, 5.030846e-001, 5.042885e-001, 5.054923e-001, 5.066840e-001, 5.078731e-001, 5.090622e-001, 5.102485e-001,
+5.114330e-001, 5.126175e-001, 5.138002e-001, 5.149796e-001, 5.161591e-001, 5.173383e-001, 5.185146e-001, 5.196908e-001, 5.208671e-001, 5.220368e-001,
+5.232045e-001, 5.243722e-001, 5.255355e-001, 5.266925e-001, 5.278496e-001, 5.290066e-001, 5.301630e-001, 5.313195e-001, 5.324760e-001, 5.336307e-001,
+5.347842e-001, 5.359376e-001, 5.370901e-001, 5.382356e-001, 5.393812e-001, 5.405267e-001, 5.416650e-001, 5.427990e-001, 5.439329e-001, 5.450662e-001,
+5.461930e-001, 5.473198e-001, 5.484465e-001, 5.495710e-001, 5.506932e-001, 5.518154e-001, 5.529377e-001, 5.540470e-001, 5.551547e-001, 5.562625e-001,
+5.573676e-001, 5.584642e-001, 5.595608e-001, 5.606574e-001, 5.617505e-001, 5.628406e-001, 5.639306e-001, 5.650207e-001, 5.661026e-001, 5.671824e-001,
+5.682622e-001, 5.693419e-001, 5.704170e-001, 5.714920e-001, 5.725671e-001, 5.736409e-001, 5.747093e-001, 5.757777e-001, 5.768461e-001, 5.779128e-001,
+5.789762e-001, 5.800395e-001, 5.811028e-001, 5.821601e-001, 5.832096e-001, 5.842591e-001, 5.853086e-001, 5.863517e-001, 5.873885e-001, 5.884253e-001,
+5.894620e-001, 5.904929e-001, 5.915180e-001, 5.925431e-001, 5.935683e-001, 5.945896e-001, 5.956068e-001, 5.966240e-001, 5.976412e-001, 5.986567e-001,
+5.996696e-001, 6.006825e-001, 6.016955e-001, 6.027053e-001, 6.037078e-001, 6.047102e-001, 6.057127e-001, 6.067149e-001, 6.077160e-001, 6.087170e-001,
+6.097180e-001, 6.107190e-001, 6.117115e-001, 6.127033e-001, 6.136951e-001, 6.146869e-001, 6.156742e-001, 6.166592e-001, 6.176442e-001, 6.186292e-001,
+6.196087e-001, 6.205787e-001, 6.215487e-001, 6.225187e-001, 6.234885e-001, 6.244486e-001, 6.254087e-001, 6.263688e-001, 6.273289e-001, 6.282865e-001,
+6.292428e-001, 6.301991e-001, 6.311554e-001, 6.321105e-001, 6.330612e-001, 6.340118e-001, 6.349624e-001, 6.359131e-001, 6.368628e-001, 6.378121e-001,
+6.387614e-001, 6.397107e-001, 6.406585e-001, 6.415983e-001, 6.425382e-001, 6.434780e-001, 6.444179e-001, 6.453550e-001, 6.462903e-001, 6.472255e-001,
+6.481607e-001, 6.490960e-001, 6.500247e-001, 6.509530e-001, 6.518814e-001, 6.528098e-001, 6.537358e-001, 6.546552e-001, 6.555745e-001, 6.564939e-001,
+6.574133e-001, 6.583278e-001, 6.592379e-001, 6.601479e-001, 6.610580e-001, 6.619681e-001, 6.628734e-001, 6.637770e-001, 6.646806e-001, 6.655843e-001,
+6.664879e-001, 6.673875e-001, 6.682866e-001, 6.691858e-001, 6.700849e-001, 6.709841e-001, 6.718818e-001, 6.727795e-001, 6.736772e-001, 6.745750e-001,
+6.754718e-001, 6.763552e-001, 6.772385e-001, 6.781218e-001, 6.790052e-001, 6.798881e-001, 6.807653e-001, 6.816424e-001, 6.825196e-001, 6.833967e-001,
+6.842737e-001, 6.851337e-001, 6.859938e-001, 6.868538e-001, 6.877138e-001, 6.885738e-001, 6.894274e-001, 6.902802e-001, 6.911331e-001, 6.919859e-001,
+6.928387e-001, 6.936817e-001, 6.945212e-001, 6.953607e-001, 6.962002e-001, 6.970396e-001, 6.978752e-001, 6.987071e-001, 6.995389e-001, 7.003708e-001,
+7.012027e-001, 7.020341e-001, 7.028639e-001, 7.036937e-001, 7.045235e-001, 7.053534e-001, 7.061832e-001, 7.070058e-001, 7.078278e-001, 7.086497e-001,
+7.094716e-001, 7.102935e-001, 7.111133e-001, 7.119310e-001, 7.127488e-001, 7.135666e-001, 7.143843e-001, 7.152015e-001, 7.160099e-001, 7.168182e-001,
+7.176266e-001, 7.184349e-001, 7.192433e-001, 7.200449e-001, 7.208411e-001, 7.216373e-001, 7.224334e-001, 7.232296e-001, 7.240258e-001, 7.248097e-001,
+7.255934e-001, 7.263771e-001, 7.271608e-001, 7.279445e-001, 7.287240e-001, 7.294961e-001, 7.302681e-001, 7.310402e-001, 7.318122e-001, 7.325843e-001,
+7.333511e-001, 7.341153e-001, 7.348795e-001, 7.356437e-001, 7.364079e-001, 7.371721e-001, 7.379267e-001, 7.386805e-001, 7.394343e-001, 7.401881e-001,
+7.409418e-001, 7.416955e-001, 7.424480e-001, 7.432005e-001, 7.439530e-001, 7.447055e-001, 7.454580e-001, 7.462082e-001, 7.469504e-001, 7.476926e-001,
+7.484348e-001, 7.491770e-001, 7.499192e-001, 7.506611e-001, 7.514021e-001, 7.521431e-001, 7.528841e-001, 7.536251e-001, 7.543661e-001, 7.551042e-001,
+7.558351e-001, 7.565659e-001, 7.572967e-001, 7.580275e-001, 7.587584e-001, 7.594878e-001, 7.602121e-001, 7.609364e-001, 7.616606e-001, 7.623849e-001,
+7.631092e-001, 7.638326e-001, 7.645457e-001, 7.652588e-001, 7.659718e-001, 7.666849e-001, 7.673980e-001, 7.681111e-001, 7.688197e-001, 7.695277e-001,
+7.702357e-001, 7.709437e-001, 7.716517e-001, 7.723596e-001, 7.730653e-001, 7.737695e-001, 7.744737e-001, 7.751779e-001, 7.758821e-001, 7.765863e-001,
+7.772877e-001, 7.779810e-001, 7.786744e-001, 7.793678e-001, 7.800612e-001, 7.807545e-001, 7.814479e-001, 7.821326e-001, 7.828158e-001, 7.834990e-001,
+7.841823e-001, 7.848655e-001, 7.855487e-001, 7.862283e-001, 7.869021e-001, 7.875759e-001, 7.882496e-001, 7.889234e-001, 7.895972e-001, 7.902709e-001,
+7.909373e-001, 7.916023e-001, 7.922673e-001, 7.929322e-001, 7.935972e-001, 7.942621e-001, 7.949253e-001, 7.955822e-001, 7.962390e-001, 7.968958e-001,
+7.975527e-001, 7.982095e-001, 7.988664e-001, 7.995193e-001, 8.001687e-001, 8.008181e-001, 8.014675e-001, 8.021170e-001, 8.027664e-001, 8.034158e-001,
+8.040614e-001, 8.047059e-001, 8.053503e-001, 8.059947e-001, 8.066392e-001, 8.072836e-001, 8.079280e-001, 8.085677e-001, 8.092071e-001, 8.098465e-001,
+8.104858e-001, 8.111252e-001, 8.117645e-001, 8.124038e-001, 8.130391e-001, 8.136744e-001, 8.143097e-001, 8.149451e-001, 8.155804e-001, 8.162157e-001,
+8.168507e-001, 8.174775e-001, 8.181044e-001, 8.187312e-001, 8.193581e-001, 8.199849e-001, 8.206118e-001, 8.212386e-001, 8.218612e-001, 8.224837e-001,
+8.231062e-001, 8.237286e-001, 8.243511e-001, 8.249736e-001, 8.255961e-001, 8.262089e-001, 8.268200e-001, 8.274311e-001, 8.280421e-001, 8.286532e-001,
+8.292643e-001, 8.298754e-001, 8.304854e-001, 8.310947e-001, 8.317041e-001, 8.323135e-001, 8.329228e-001, 8.335322e-001, 8.341416e-001, 8.347480e-001,
+8.353486e-001, 8.359493e-001, 8.365499e-001, 8.371506e-001, 8.377512e-001, 8.383519e-001, 8.389525e-001, 8.395484e-001, 8.401441e-001, 8.407398e-001,
+8.413354e-001, 8.419311e-001, 8.425268e-001, 8.431225e-001, 8.437145e-001, 8.443030e-001, 8.448915e-001, 8.454801e-001, 8.460686e-001, 8.466571e-001,
+8.472456e-001, 8.478341e-001, 8.484159e-001, 8.489975e-001, 8.495792e-001, 8.501608e-001, 8.507425e-001, 8.513241e-001, 8.519057e-001, 8.524855e-001,
+8.530621e-001, 8.536388e-001, 8.542154e-001, 8.547920e-001, 8.553686e-001, 8.559453e-001, 8.565219e-001, 8.570964e-001, 8.576698e-001, 8.582433e-001,
+8.588168e-001, 8.593902e-001, 8.599637e-001, 8.605372e-001, 8.611107e-001, 8.616771e-001, 8.622428e-001, 8.628084e-001, 8.633741e-001, 8.639398e-001,
+8.645054e-001, 8.650711e-001, 8.656365e-001, 8.661962e-001, 8.667558e-001, 8.673154e-001, 8.678751e-001, 8.684347e-001, 8.689943e-001, 8.695539e-001,
+8.701127e-001, 8.706625e-001, 8.712123e-001, 8.717621e-001, 8.723119e-001, 8.728617e-001, 8.734114e-001, 8.739612e-001, 8.745108e-001, 8.750564e-001,
+8.756021e-001, 8.761477e-001, 8.766933e-001, 8.772389e-001, 8.777846e-001, 8.783302e-001, 8.788758e-001, 8.794146e-001, 8.799529e-001, 8.804912e-001,
+8.810295e-001, 8.815678e-001, 8.821061e-001, 8.826443e-001, 8.831826e-001, 8.837169e-001, 8.842496e-001, 8.847822e-001, 8.853149e-001, 8.858476e-001,
+8.863803e-001, 8.869130e-001, 8.874457e-001, 8.879768e-001, 8.885057e-001, 8.890347e-001, 8.895636e-001, 8.900926e-001, 8.906215e-001, 8.911505e-001,
+8.916794e-001, 8.922080e-001, 8.927248e-001, 8.932416e-001, 8.937584e-001, 8.942751e-001, 8.947919e-001, 8.953087e-001, 8.958255e-001, 8.963422e-001,
+8.968578e-001, 8.973724e-001, 8.978870e-001, 8.984017e-001, 8.989163e-001, 8.994309e-001, 8.999455e-001, 9.004601e-001, 9.009747e-001, 9.014821e-001,
+9.019892e-001, 9.024964e-001, 9.030035e-001, 9.035107e-001, 9.040178e-001, 9.045250e-001, 9.050321e-001, 9.055400e-001, 9.060496e-001, 9.065591e-001,
+9.070687e-001, 9.075782e-001, 9.080878e-001, 9.085973e-001, 9.091069e-001, 9.096164e-001, 9.101236e-001, 9.106288e-001, 9.111341e-001, 9.116393e-001,
+9.121445e-001, 9.126498e-001, 9.131550e-001, 9.136603e-001, 9.141655e-001, 9.146683e-001, 9.151701e-001, 9.156719e-001, 9.161737e-001, 9.166755e-001,
+9.171772e-001, 9.176790e-001, 9.181808e-001, 9.186826e-001, 9.191823e-001, 9.196813e-001, 9.201804e-001, 9.206794e-001, 9.211784e-001, 9.216774e-001,
+9.221765e-001, 9.226755e-001, 9.231745e-001, 9.236670e-001, 9.241566e-001, 9.246463e-001, 9.251359e-001, 9.256255e-001, 9.261152e-001, 9.266048e-001,
+9.270945e-001, 9.275841e-001, 9.280739e-001, 9.285637e-001, 9.290536e-001, 9.295434e-001, 9.300333e-001, 9.305232e-001, 9.310130e-001, 9.315029e-001,
+9.319928e-001, 9.324811e-001, 9.329660e-001, 9.334509e-001, 9.339358e-001, 9.344208e-001, 9.349057e-001, 9.353906e-001, 9.358755e-001, 9.363605e-001,
+9.368454e-001, 9.373252e-001, 9.378049e-001, 9.382846e-001, 9.387642e-001, 9.392439e-001, 9.397236e-001, 9.402033e-001, 9.406829e-001, 9.411626e-001,
+9.416404e-001, 9.421163e-001, 9.425923e-001, 9.430683e-001, 9.435443e-001, 9.440203e-001, 9.444962e-001, 9.449722e-001, 9.454482e-001, 9.459242e-001,
+9.463955e-001, 9.468666e-001, 9.473378e-001, 9.478089e-001, 9.482801e-001, 9.487512e-001, 9.492224e-001, 9.496935e-001, 9.501647e-001, 9.506316e-001,
+9.510896e-001, 9.515477e-001, 9.520057e-001, 9.524638e-001, 9.529218e-001, 9.533798e-001, 9.538379e-001, 9.542959e-001, 9.547540e-001, 9.552072e-001,
+9.556567e-001, 9.561062e-001, 9.565556e-001, 9.570051e-001, 9.574546e-001, 9.579041e-001, 9.583536e-001, 9.588031e-001, 9.592526e-001, 9.596999e-001,
+9.601463e-001, 9.605926e-001, 9.610390e-001, 9.614854e-001, 9.619318e-001, 9.623782e-001, 9.628245e-001, 9.632709e-001, 9.637173e-001, 9.641577e-001,
+9.645960e-001, 9.650343e-001, 9.654725e-001, 9.659108e-001, 9.663491e-001, 9.667873e-001, 9.672256e-001, 9.676638e-001, 9.681021e-001, 9.685349e-001,
+9.689649e-001, 9.693949e-001, 9.698249e-001, 9.702549e-001, 9.706848e-001, 9.711148e-001, 9.715448e-001, 9.719748e-001, 9.724048e-001, 9.728298e-001,
+9.732492e-001, 9.736687e-001, 9.740881e-001, 9.745075e-001, 9.749270e-001, 9.753464e-001, 9.757658e-001, 9.761853e-001, 9.766047e-001, 9.770221e-001,
+9.774296e-001, 9.778371e-001, 9.782447e-001, 9.786522e-001, 9.790597e-001, 9.794672e-001, 9.798748e-001, 9.802823e-001, 9.806898e-001, 9.810973e-001,
+9.814953e-001, 9.818902e-001, 9.822852e-001, 9.826802e-001, 9.830751e-001, 9.834701e-001, 9.838651e-001, 9.842600e-001, 9.846550e-001, 9.850500e-001,
+9.854415e-001, 9.858223e-001, 9.862032e-001, 9.865840e-001, 9.869648e-001, 9.873456e-001, 9.877265e-001, 9.881073e-001, 9.884881e-001, 9.888689e-001,
+9.892497e-001, 9.896146e-001, 9.899690e-001, 9.903233e-001, 9.906777e-001, 9.910321e-001, 9.913864e-001, 9.917408e-001, 9.920952e-001, 9.924495e-001,
+9.928039e-001, 9.931583e-001, 9.934853e-001, 9.938077e-001, 9.941301e-001, 9.944524e-001, 9.947748e-001, 9.950972e-001, 9.954195e-001, 9.957419e-001,
+9.960643e-001, 9.963866e-001, 9.967090e-001, 9.970085e-001, 9.973076e-001, 9.976068e-001, 9.979059e-001, 9.982051e-001, 9.985042e-001, 9.988034e-001,
+9.991025e-001, 9.994017e-001, 9.997008e-001, 1.000000e+000)),
+("Kodak", "Gold 200", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.957646e-003, 1.413649e-002, 2.071840e-002, 2.679890e-002, 3.247189e-002, 3.781650e-002, 4.288693e-002, 4.772589e-002, 5.239085e-002,
+5.686101e-002, 6.112756e-002, 6.530169e-002, 6.937445e-002, 7.335731e-002, 7.717744e-002, 8.091653e-002, 8.455685e-002, 8.813532e-002, 9.164199e-002,
+9.507665e-002, 9.843798e-002, 1.017495e-001, 1.049599e-001, 1.081261e-001, 1.112463e-001, 1.143177e-001, 1.173488e-001, 1.203667e-001, 1.233123e-001,
+1.262119e-001, 1.290675e-001, 1.318753e-001, 1.346522e-001, 1.373953e-001, 1.401219e-001, 1.428176e-001, 1.454751e-001, 1.481045e-001, 1.507305e-001,
+1.533289e-001, 1.558901e-001, 1.584241e-001, 1.609432e-001, 1.634578e-001, 1.659422e-001, 1.683879e-001, 1.708077e-001, 1.732032e-001, 1.755876e-001,
+1.779661e-001, 1.803373e-001, 1.826853e-001, 1.850019e-001, 1.873046e-001, 1.896051e-001, 1.918939e-001, 1.941769e-001, 1.964391e-001, 1.986718e-001,
+2.008888e-001, 2.030901e-001, 2.052837e-001, 2.074694e-001, 2.096378e-001, 2.117997e-001, 2.139513e-001, 2.160806e-001, 2.181894e-001, 2.202866e-001,
+2.223830e-001, 2.244744e-001, 2.265537e-001, 2.286141e-001, 2.306681e-001, 2.327179e-001, 2.347581e-001, 2.367895e-001, 2.388225e-001, 2.408446e-001,
+2.428612e-001, 2.448751e-001, 2.468797e-001, 2.488764e-001, 2.508633e-001, 2.528335e-001, 2.547827e-001, 2.567098e-001, 2.586240e-001, 2.605265e-001,
+2.624251e-001, 2.643153e-001, 2.661928e-001, 2.680534e-001, 2.698996e-001, 2.717376e-001, 2.735639e-001, 2.753802e-001, 2.771907e-001, 2.789969e-001,
+2.808092e-001, 2.826234e-001, 2.844350e-001, 2.862409e-001, 2.880495e-001, 2.898606e-001, 2.916709e-001, 2.934773e-001, 2.952775e-001, 2.970678e-001,
+2.988429e-001, 3.006019e-001, 3.023516e-001, 3.040931e-001, 3.058268e-001, 3.075600e-001, 3.092888e-001, 3.110117e-001, 3.127268e-001, 3.144324e-001,
+3.161235e-001, 3.178110e-001, 3.194932e-001, 3.211687e-001, 3.228329e-001, 3.244825e-001, 3.261260e-001, 3.277656e-001, 3.293996e-001, 3.310334e-001,
+3.326670e-001, 3.343002e-001, 3.359292e-001, 3.375552e-001, 3.391783e-001, 3.408017e-001, 3.424184e-001, 3.440292e-001, 3.456344e-001, 3.472355e-001,
+3.488337e-001, 3.504330e-001, 3.520257e-001, 3.536129e-001, 3.551953e-001, 3.567740e-001, 3.583479e-001, 3.599141e-001, 3.614780e-001, 3.630394e-001,
+3.645979e-001, 3.661546e-001, 3.677041e-001, 3.692492e-001, 3.707874e-001, 3.723173e-001, 3.738437e-001, 3.753637e-001, 3.768812e-001, 3.783939e-001,
+3.798998e-001, 3.814016e-001, 3.829031e-001, 3.844041e-001, 3.859014e-001, 3.873962e-001, 3.888866e-001, 3.903724e-001, 3.918546e-001, 3.933347e-001,
+3.948142e-001, 3.962810e-001, 3.977459e-001, 3.992025e-001, 4.006575e-001, 4.021052e-001, 4.035490e-001, 4.049837e-001, 4.064175e-001, 4.078499e-001,
+4.092807e-001, 4.107098e-001, 4.121399e-001, 4.135712e-001, 4.149980e-001, 4.164206e-001, 4.178412e-001, 4.192601e-001, 4.206769e-001, 4.220918e-001,
+4.235030e-001, 4.249099e-001, 4.263136e-001, 4.277123e-001, 4.291100e-001, 4.305054e-001, 4.319001e-001, 4.332916e-001, 4.346828e-001, 4.360675e-001,
+4.374522e-001, 4.388274e-001, 4.402016e-001, 4.415683e-001, 4.429321e-001, 4.442929e-001, 4.456508e-001, 4.470078e-001, 4.483624e-001, 4.497171e-001,
+4.510730e-001, 4.524288e-001, 4.537775e-001, 4.551242e-001, 4.564689e-001, 4.578114e-001, 4.591517e-001, 4.604796e-001, 4.618076e-001, 4.631280e-001,
+4.644466e-001, 4.657609e-001, 4.670695e-001, 4.683778e-001, 4.696763e-001, 4.709749e-001, 4.722696e-001, 4.735618e-001, 4.748536e-001, 4.761428e-001,
+4.774321e-001, 4.787221e-001, 4.800124e-001, 4.813013e-001, 4.825832e-001, 4.838651e-001, 4.851444e-001, 4.864222e-001, 4.876996e-001, 4.889726e-001,
+4.902457e-001, 4.915165e-001, 4.927849e-001, 4.940532e-001, 4.953213e-001, 4.965893e-001, 4.978552e-001, 4.991137e-001, 5.003722e-001, 5.016277e-001,
+5.028807e-001, 5.041337e-001, 5.053766e-001, 5.066177e-001, 5.078587e-001, 5.090987e-001, 5.103386e-001, 5.115761e-001, 5.128089e-001, 5.140416e-001,
+5.152726e-001, 5.165021e-001, 5.177316e-001, 5.189522e-001, 5.201696e-001, 5.213870e-001, 5.225998e-001, 5.238119e-001, 5.250240e-001, 5.262380e-001,
+5.274520e-001, 5.286653e-001, 5.298719e-001, 5.310785e-001, 5.322846e-001, 5.334877e-001, 5.346908e-001, 5.358919e-001, 5.370827e-001, 5.382735e-001,
+5.394630e-001, 5.406449e-001, 5.418269e-001, 5.430072e-001, 5.441748e-001, 5.453424e-001, 5.465098e-001, 5.476737e-001, 5.488376e-001, 5.500016e-001,
+5.511488e-001, 5.522947e-001, 5.534405e-001, 5.545827e-001, 5.557237e-001, 5.568648e-001, 5.579982e-001, 5.591267e-001, 5.602552e-001, 5.613806e-001,
+5.625013e-001, 5.636220e-001, 5.647404e-001, 5.658452e-001, 5.669501e-001, 5.680549e-001, 5.691527e-001, 5.702495e-001, 5.713462e-001, 5.724427e-001,
+5.735388e-001, 5.746350e-001, 5.757296e-001, 5.768179e-001, 5.779062e-001, 5.789946e-001, 5.800735e-001, 5.811502e-001, 5.822269e-001, 5.832991e-001,
+5.843637e-001, 5.854284e-001, 5.864931e-001, 5.875535e-001, 5.886135e-001, 5.896736e-001, 5.907286e-001, 5.917764e-001, 5.928243e-001, 5.938722e-001,
+5.949155e-001, 5.959582e-001, 5.970008e-001, 5.980415e-001, 5.990775e-001, 6.001135e-001, 6.011496e-001, 6.021805e-001, 6.032092e-001, 6.042378e-001,
+6.052662e-001, 6.062860e-001, 6.073058e-001, 6.083257e-001, 6.093433e-001, 6.103564e-001, 6.113695e-001, 6.123826e-001, 6.133952e-001, 6.144076e-001,
+6.154199e-001, 6.164322e-001, 6.174444e-001, 6.184564e-001, 6.194685e-001, 6.204806e-001, 6.214926e-001, 6.225046e-001, 6.235166e-001, 6.245273e-001,
+6.255301e-001, 6.265330e-001, 6.275359e-001, 6.285379e-001, 6.295374e-001, 6.305369e-001, 6.315364e-001, 6.325309e-001, 6.335137e-001, 6.344965e-001,
+6.354793e-001, 6.364601e-001, 6.374369e-001, 6.384136e-001, 6.393904e-001, 6.403621e-001, 6.413216e-001, 6.422811e-001, 6.432405e-001, 6.441985e-001,
+6.451514e-001, 6.461043e-001, 6.470572e-001, 6.480083e-001, 6.489438e-001, 6.498792e-001, 6.508147e-001, 6.517502e-001, 6.526796e-001, 6.536087e-001,
+6.545378e-001, 6.554668e-001, 6.563835e-001, 6.572958e-001, 6.582080e-001, 6.591202e-001, 6.600306e-001, 6.609391e-001, 6.618476e-001, 6.627561e-001,
+6.636629e-001, 6.645622e-001, 6.654615e-001, 6.663608e-001, 6.672601e-001, 6.681555e-001, 6.690502e-001, 6.699449e-001, 6.708396e-001, 6.717276e-001,
+6.726074e-001, 6.734872e-001, 6.743670e-001, 6.752468e-001, 6.761245e-001, 6.770022e-001, 6.778799e-001, 6.787576e-001, 6.796311e-001, 6.805010e-001,
+6.813709e-001, 6.822407e-001, 6.831106e-001, 6.839791e-001, 6.848476e-001, 6.857161e-001, 6.865845e-001, 6.874502e-001, 6.883116e-001, 6.891731e-001,
+6.900346e-001, 6.908960e-001, 6.917509e-001, 6.926039e-001, 6.934569e-001, 6.943099e-001, 6.951623e-001, 6.960077e-001, 6.968531e-001, 6.976985e-001,
+6.985439e-001, 6.993871e-001, 7.002262e-001, 7.010654e-001, 7.019045e-001, 7.027436e-001, 7.035796e-001, 7.044132e-001, 7.052468e-001, 7.060804e-001,
+7.069140e-001, 7.077405e-001, 7.085643e-001, 7.093881e-001, 7.102119e-001, 7.110358e-001, 7.118616e-001, 7.126878e-001, 7.135140e-001, 7.143402e-001,
+7.151665e-001, 7.159852e-001, 7.168029e-001, 7.176207e-001, 7.184385e-001, 7.192563e-001, 7.200725e-001, 7.208885e-001, 7.217045e-001, 7.225204e-001,
+7.233364e-001, 7.241454e-001, 7.249531e-001, 7.257609e-001, 7.265686e-001, 7.273763e-001, 7.281740e-001, 7.289680e-001, 7.297621e-001, 7.305561e-001,
+7.313501e-001, 7.321395e-001, 7.329255e-001, 7.337115e-001, 7.344975e-001, 7.352835e-001, 7.360627e-001, 7.368297e-001, 7.375967e-001, 7.383637e-001,
+7.391307e-001, 7.398971e-001, 7.406572e-001, 7.414172e-001, 7.421773e-001, 7.429374e-001, 7.436974e-001, 7.444459e-001, 7.451906e-001, 7.459353e-001,
+7.466799e-001, 7.474246e-001, 7.481680e-001, 7.489093e-001, 7.496505e-001, 7.503917e-001, 7.511329e-001, 7.518741e-001, 7.526044e-001, 7.533337e-001,
+7.540629e-001, 7.547922e-001, 7.555214e-001, 7.562506e-001, 7.569795e-001, 7.577085e-001, 7.584375e-001, 7.591665e-001, 7.598955e-001, 7.606170e-001,
+7.613371e-001, 7.620572e-001, 7.627773e-001, 7.634974e-001, 7.642152e-001, 7.649244e-001, 7.656336e-001, 7.663429e-001, 7.670521e-001, 7.677613e-001,
+7.684661e-001, 7.691670e-001, 7.698679e-001, 7.705687e-001, 7.712696e-001, 7.719705e-001, 7.726666e-001, 7.733613e-001, 7.740560e-001, 7.747508e-001,
+7.754455e-001, 7.761402e-001, 7.768255e-001, 7.775105e-001, 7.781955e-001, 7.788804e-001, 7.795654e-001, 7.802501e-001, 7.809323e-001, 7.816145e-001,
+7.822967e-001, 7.829789e-001, 7.836611e-001, 7.843413e-001, 7.850098e-001, 7.856782e-001, 7.863467e-001, 7.870152e-001, 7.876836e-001, 7.883511e-001,
+7.890128e-001, 7.896746e-001, 7.903363e-001, 7.909980e-001, 7.916597e-001, 7.923208e-001, 7.929739e-001, 7.936270e-001, 7.942801e-001, 7.949333e-001,
+7.955864e-001, 7.962395e-001, 7.968861e-001, 7.975323e-001, 7.981785e-001, 7.988247e-001, 7.994709e-001, 8.001171e-001, 8.007585e-001, 8.013982e-001,
+8.020378e-001, 8.026775e-001, 8.033172e-001, 8.039568e-001, 8.045894e-001, 8.052138e-001, 8.058383e-001, 8.064628e-001, 8.070873e-001, 8.077118e-001,
+8.083352e-001, 8.089513e-001, 8.095673e-001, 8.101834e-001, 8.107995e-001, 8.114156e-001, 8.120317e-001, 8.126401e-001, 8.132457e-001, 8.138512e-001,
+8.144568e-001, 8.150624e-001, 8.156680e-001, 8.162712e-001, 8.168675e-001, 8.174637e-001, 8.180600e-001, 8.186563e-001, 8.192526e-001, 8.198488e-001,
+8.204403e-001, 8.210297e-001, 8.216191e-001, 8.222086e-001, 8.227980e-001, 8.233875e-001, 8.239762e-001, 8.245581e-001, 8.251399e-001, 8.257218e-001,
+8.263037e-001, 8.268855e-001, 8.274674e-001, 8.280459e-001, 8.286195e-001, 8.291931e-001, 8.297667e-001, 8.303403e-001, 8.309139e-001, 8.314875e-001,
+8.320548e-001, 8.326187e-001, 8.331827e-001, 8.337466e-001, 8.343106e-001, 8.348746e-001, 8.354385e-001, 8.359956e-001, 8.365512e-001, 8.371068e-001,
+8.376625e-001, 8.382181e-001, 8.387737e-001, 8.393293e-001, 8.398807e-001, 8.404317e-001, 8.409827e-001, 8.415337e-001, 8.420847e-001, 8.426357e-001,
+8.431867e-001, 8.437363e-001, 8.442858e-001, 8.448353e-001, 8.453848e-001, 8.459344e-001, 8.464839e-001, 8.470334e-001, 8.475741e-001, 8.481135e-001,
+8.486529e-001, 8.491923e-001, 8.497317e-001, 8.502712e-001, 8.508106e-001, 8.513523e-001, 8.518949e-001, 8.524376e-001, 8.529802e-001, 8.535228e-001,
+8.540654e-001, 8.546080e-001, 8.551478e-001, 8.556851e-001, 8.562223e-001, 8.567596e-001, 8.572968e-001, 8.578341e-001, 8.583713e-001, 8.589067e-001,
+8.594360e-001, 8.599653e-001, 8.604946e-001, 8.610238e-001, 8.615531e-001, 8.620824e-001, 8.626117e-001, 8.631412e-001, 8.636707e-001, 8.642002e-001,
+8.647297e-001, 8.652592e-001, 8.657887e-001, 8.663182e-001, 8.668443e-001, 8.673656e-001, 8.678870e-001, 8.684083e-001, 8.689297e-001, 8.694510e-001,
+8.699724e-001, 8.704937e-001, 8.710049e-001, 8.715148e-001, 8.720247e-001, 8.725347e-001, 8.730446e-001, 8.735545e-001, 8.740644e-001, 8.745730e-001,
+8.750782e-001, 8.755834e-001, 8.760886e-001, 8.765938e-001, 8.770990e-001, 8.776042e-001, 8.781094e-001, 8.786090e-001, 8.791048e-001, 8.796005e-001,
+8.800962e-001, 8.805920e-001, 8.810877e-001, 8.815835e-001, 8.820792e-001, 8.825731e-001, 8.830665e-001, 8.835599e-001, 8.840534e-001, 8.845468e-001,
+8.850402e-001, 8.855337e-001, 8.860271e-001, 8.865162e-001, 8.870050e-001, 8.874938e-001, 8.879825e-001, 8.884713e-001, 8.889601e-001, 8.894489e-001,
+8.899377e-001, 8.904203e-001, 8.909028e-001, 8.913854e-001, 8.918680e-001, 8.923505e-001, 8.928331e-001, 8.933156e-001, 8.937982e-001, 8.942810e-001,
+8.947638e-001, 8.952467e-001, 8.957295e-001, 8.962124e-001, 8.966952e-001, 8.971780e-001, 8.976609e-001, 8.981388e-001, 8.986159e-001, 8.990930e-001,
+8.995701e-001, 9.000471e-001, 9.005242e-001, 9.010013e-001, 9.014783e-001, 9.019499e-001, 9.024183e-001, 9.028868e-001, 9.033552e-001, 9.038237e-001,
+9.042921e-001, 9.047605e-001, 9.052290e-001, 9.056965e-001, 9.061623e-001, 9.066282e-001, 9.070940e-001, 9.075598e-001, 9.080256e-001, 9.084915e-001,
+9.089573e-001, 9.094231e-001, 9.098821e-001, 9.103408e-001, 9.107996e-001, 9.112583e-001, 9.117170e-001, 9.121757e-001, 9.126344e-001, 9.130931e-001,
+9.135513e-001, 9.140091e-001, 9.144668e-001, 9.149245e-001, 9.153823e-001, 9.158400e-001, 9.162977e-001, 9.167555e-001, 9.172132e-001, 9.176644e-001,
+9.181149e-001, 9.185655e-001, 9.190160e-001, 9.194665e-001, 9.199171e-001, 9.203676e-001, 9.208182e-001, 9.212675e-001, 9.217132e-001, 9.221590e-001,
+9.226047e-001, 9.230504e-001, 9.234961e-001, 9.239419e-001, 9.243876e-001, 9.248333e-001, 9.252752e-001, 9.257131e-001, 9.261510e-001, 9.265889e-001,
+9.270267e-001, 9.274646e-001, 9.279025e-001, 9.283404e-001, 9.287783e-001, 9.292140e-001, 9.296484e-001, 9.300829e-001, 9.305173e-001, 9.309518e-001,
+9.313862e-001, 9.318207e-001, 9.322551e-001, 9.326896e-001, 9.331244e-001, 9.335594e-001, 9.339944e-001, 9.344294e-001, 9.348644e-001, 9.352994e-001,
+9.357344e-001, 9.361694e-001, 9.366045e-001, 9.370371e-001, 9.374685e-001, 9.378999e-001, 9.383313e-001, 9.387627e-001, 9.391941e-001, 9.396255e-001,
+9.400569e-001, 9.404883e-001, 9.409155e-001, 9.413387e-001, 9.417620e-001, 9.421852e-001, 9.426084e-001, 9.430316e-001, 9.434548e-001, 9.438781e-001,
+9.443013e-001, 9.447239e-001, 9.451450e-001, 9.455661e-001, 9.459871e-001, 9.464082e-001, 9.468292e-001, 9.472503e-001, 9.476714e-001, 9.480924e-001,
+9.485135e-001, 9.489266e-001, 9.493391e-001, 9.497516e-001, 9.501641e-001, 9.505766e-001, 9.509891e-001, 9.514015e-001, 9.518140e-001, 9.522265e-001,
+9.526366e-001, 9.530442e-001, 9.534518e-001, 9.538594e-001, 9.542670e-001, 9.546746e-001, 9.550822e-001, 9.554898e-001, 9.558973e-001, 9.563049e-001,
+9.567066e-001, 9.571079e-001, 9.575092e-001, 9.579104e-001, 9.583117e-001, 9.587130e-001, 9.591142e-001, 9.595155e-001, 9.599168e-001, 9.603135e-001,
+9.606987e-001, 9.610838e-001, 9.614690e-001, 9.618542e-001, 9.622393e-001, 9.626245e-001, 9.630097e-001, 9.633949e-001, 9.637800e-001, 9.641589e-001,
+9.645323e-001, 9.649056e-001, 9.652790e-001, 9.656523e-001, 9.660257e-001, 9.663990e-001, 9.667724e-001, 9.671457e-001, 9.675191e-001, 9.678882e-001,
+9.682552e-001, 9.686222e-001, 9.689893e-001, 9.693563e-001, 9.697233e-001, 9.700903e-001, 9.704574e-001, 9.708244e-001, 9.711914e-001, 9.715512e-001,
+9.719079e-001, 9.722645e-001, 9.726212e-001, 9.729779e-001, 9.733346e-001, 9.736913e-001, 9.740480e-001, 9.744046e-001, 9.747613e-001, 9.751122e-001,
+9.754596e-001, 9.758070e-001, 9.761544e-001, 9.765018e-001, 9.768492e-001, 9.771965e-001, 9.775439e-001, 9.778913e-001, 9.782387e-001, 9.785814e-001,
+9.789180e-001, 9.792547e-001, 9.795914e-001, 9.799281e-001, 9.802648e-001, 9.806015e-001, 9.809381e-001, 9.812748e-001, 9.816115e-001, 9.819465e-001,
+9.822719e-001, 9.825972e-001, 9.829226e-001, 9.832480e-001, 9.835733e-001, 9.838987e-001, 9.842241e-001, 9.845495e-001, 9.848748e-001, 9.852002e-001,
+9.855154e-001, 9.858270e-001, 9.861387e-001, 9.864504e-001, 9.867621e-001, 9.870738e-001, 9.873855e-001, 9.876971e-001, 9.880088e-001, 9.883205e-001,
+9.886283e-001, 9.889228e-001, 9.892173e-001, 9.895118e-001, 9.898063e-001, 9.901008e-001, 9.903953e-001, 9.906898e-001, 9.909843e-001, 9.912788e-001,
+9.915733e-001, 9.918602e-001, 9.921419e-001, 9.924237e-001, 9.927054e-001, 9.929871e-001, 9.932689e-001, 9.935506e-001, 9.938323e-001, 9.941141e-001,
+9.943958e-001, 9.946775e-001, 9.949371e-001, 9.951926e-001, 9.954481e-001, 9.957036e-001, 9.959591e-001, 9.962146e-001, 9.964702e-001, 9.967257e-001,
+9.969812e-001, 9.972367e-001, 9.974922e-001, 9.977207e-001, 9.979486e-001, 9.981765e-001, 9.984045e-001, 9.986324e-001, 9.988603e-001, 9.990883e-001,
+9.993162e-001, 9.995441e-001, 9.997721e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.292562e-003, 1.075510e-002, 1.594950e-002, 2.086141e-002, 2.545263e-002, 2.992017e-002, 3.410882e-002, 3.817222e-002, 4.208604e-002,
+4.588726e-002, 4.959005e-002, 5.319452e-002, 5.673650e-002, 6.020959e-002, 6.359167e-002, 6.688767e-002, 7.012698e-002, 7.331234e-002, 7.644258e-002,
+7.951465e-002, 8.253315e-002, 8.551737e-002, 8.844454e-002, 9.131170e-002, 9.412956e-002, 9.689016e-002, 9.961708e-002, 1.023124e-001, 1.049759e-001,
+1.076004e-001, 1.101883e-001, 1.127378e-001, 1.152801e-001, 1.178082e-001, 1.203087e-001, 1.227945e-001, 1.252800e-001, 1.277427e-001, 1.301932e-001,
+1.326095e-001, 1.350027e-001, 1.373653e-001, 1.397028e-001, 1.420170e-001, 1.442992e-001, 1.465637e-001, 1.488012e-001, 1.510327e-001, 1.532424e-001,
+1.554350e-001, 1.576205e-001, 1.597834e-001, 1.619350e-001, 1.640776e-001, 1.661971e-001, 1.682944e-001, 1.703854e-001, 1.724754e-001, 1.745598e-001,
+1.766364e-001, 1.787001e-001, 1.807560e-001, 1.827982e-001, 1.848138e-001, 1.868076e-001, 1.887951e-001, 1.907596e-001, 1.927050e-001, 1.946384e-001,
+1.965694e-001, 1.984919e-001, 2.003978e-001, 2.022927e-001, 2.041870e-001, 2.060836e-001, 2.079713e-001, 2.098497e-001, 2.117147e-001, 2.135721e-001,
+2.154268e-001, 2.172741e-001, 2.191030e-001, 2.209150e-001, 2.227170e-001, 2.245124e-001, 2.263000e-001, 2.280700e-001, 2.298292e-001, 2.315825e-001,
+2.333338e-001, 2.350837e-001, 2.368272e-001, 2.385642e-001, 2.402986e-001, 2.420333e-001, 2.437696e-001, 2.455032e-001, 2.472324e-001, 2.489608e-001,
+2.506855e-001, 2.524011e-001, 2.541045e-001, 2.558019e-001, 2.574988e-001, 2.591859e-001, 2.608619e-001, 2.625282e-001, 2.641865e-001, 2.658401e-001,
+2.674838e-001, 2.691145e-001, 2.707369e-001, 2.723526e-001, 2.739634e-001, 2.755722e-001, 2.771736e-001, 2.787660e-001, 2.803518e-001, 2.819328e-001,
+2.835094e-001, 2.850858e-001, 2.866651e-001, 2.882451e-001, 2.898192e-001, 2.913887e-001, 2.929498e-001, 2.945040e-001, 2.960574e-001, 2.976092e-001,
+2.991578e-001, 3.007018e-001, 3.022337e-001, 3.037580e-001, 3.052761e-001, 3.067946e-001, 3.083078e-001, 3.098174e-001, 3.113241e-001, 3.128254e-001,
+3.143222e-001, 3.158084e-001, 3.172896e-001, 3.187674e-001, 3.202396e-001, 3.217111e-001, 3.231821e-001, 3.246476e-001, 3.261093e-001, 3.275643e-001,
+3.290149e-001, 3.304625e-001, 3.318978e-001, 3.333328e-001, 3.347673e-001, 3.362007e-001, 3.376332e-001, 3.390626e-001, 3.404957e-001, 3.419339e-001,
+3.433656e-001, 3.447945e-001, 3.462236e-001, 3.476490e-001, 3.490603e-001, 3.504692e-001, 3.518751e-001, 3.532765e-001, 3.546754e-001, 3.560654e-001,
+3.574534e-001, 3.588357e-001, 3.602160e-001, 3.615839e-001, 3.629512e-001, 3.643172e-001, 3.656820e-001, 3.670450e-001, 3.684047e-001, 3.697603e-001,
+3.711144e-001, 3.724671e-001, 3.738192e-001, 3.751708e-001, 3.765240e-001, 3.778783e-001, 3.792269e-001, 3.805715e-001, 3.819120e-001, 3.832496e-001,
+3.845825e-001, 3.859113e-001, 3.872357e-001, 3.885548e-001, 3.898749e-001, 3.911964e-001, 3.925140e-001, 3.938207e-001, 3.951270e-001, 3.964309e-001,
+3.977347e-001, 3.990345e-001, 4.003342e-001, 4.016295e-001, 4.029237e-001, 4.042161e-001, 4.055074e-001, 4.067941e-001, 4.080730e-001, 4.093519e-001,
+4.106302e-001, 4.119085e-001, 4.131798e-001, 4.144499e-001, 4.157177e-001, 4.169836e-001, 4.182476e-001, 4.195051e-001, 4.207625e-001, 4.220119e-001,
+4.232602e-001, 4.245094e-001, 4.257597e-001, 4.270094e-001, 4.282544e-001, 4.294994e-001, 4.307435e-001, 4.319872e-001, 4.332297e-001, 4.344684e-001,
+4.357071e-001, 4.369412e-001, 4.381737e-001, 4.394079e-001, 4.406480e-001, 4.418881e-001, 4.431279e-001, 4.443677e-001, 4.456072e-001, 4.468455e-001,
+4.480837e-001, 4.493125e-001, 4.505337e-001, 4.517548e-001, 4.529699e-001, 4.541845e-001, 4.553967e-001, 4.566032e-001, 4.578096e-001, 4.590105e-001,
+4.602080e-001, 4.614056e-001, 4.626048e-001, 4.638043e-001, 4.650029e-001, 4.661978e-001, 4.673928e-001, 4.685872e-001, 4.697812e-001, 4.709751e-001,
+4.721660e-001, 4.733553e-001, 4.745445e-001, 4.757270e-001, 4.769080e-001, 4.780889e-001, 4.792578e-001, 4.804260e-001, 4.815933e-001, 4.827487e-001,
+4.839041e-001, 4.850594e-001, 4.862148e-001, 4.873702e-001, 4.885238e-001, 4.896707e-001, 4.908175e-001, 4.919629e-001, 4.931035e-001, 4.942441e-001,
+4.953830e-001, 4.965159e-001, 4.976488e-001, 4.987802e-001, 4.999047e-001, 5.010292e-001, 5.021534e-001, 5.032743e-001, 5.043952e-001, 5.055162e-001,
+5.066318e-001, 5.077473e-001, 5.088629e-001, 5.099776e-001, 5.110921e-001, 5.122066e-001, 5.133147e-001, 5.144196e-001, 5.155246e-001, 5.166273e-001,
+5.177275e-001, 5.188277e-001, 5.199280e-001, 5.210285e-001, 5.221291e-001, 5.232296e-001, 5.243227e-001, 5.254152e-001, 5.265077e-001, 5.276014e-001,
+5.286958e-001, 5.297902e-001, 5.308814e-001, 5.319637e-001, 5.330459e-001, 5.341281e-001, 5.352012e-001, 5.362729e-001, 5.373446e-001, 5.384107e-001,
+5.394697e-001, 5.405287e-001, 5.415876e-001, 5.426416e-001, 5.436955e-001, 5.447493e-001, 5.458041e-001, 5.468600e-001, 5.479158e-001, 5.489716e-001,
+5.500274e-001, 5.510831e-001, 5.521388e-001, 5.531934e-001, 5.542459e-001, 5.552983e-001, 5.563508e-001, 5.573994e-001, 5.584467e-001, 5.594939e-001,
+5.605404e-001, 5.615794e-001, 5.626183e-001, 5.636573e-001, 5.646921e-001, 5.657205e-001, 5.667489e-001, 5.677774e-001, 5.688035e-001, 5.698283e-001,
+5.708532e-001, 5.718781e-001, 5.728979e-001, 5.739171e-001, 5.749363e-001, 5.759550e-001, 5.769659e-001, 5.779769e-001, 5.789878e-001, 5.799971e-001,
+5.809997e-001, 5.820024e-001, 5.830050e-001, 5.840061e-001, 5.850034e-001, 5.860008e-001, 5.869981e-001, 5.879935e-001, 5.889853e-001, 5.899771e-001,
+5.909689e-001, 5.919577e-001, 5.929412e-001, 5.939248e-001, 5.949084e-001, 5.958869e-001, 5.968556e-001, 5.978244e-001, 5.987931e-001, 5.997601e-001,
+6.007227e-001, 6.016852e-001, 6.026477e-001, 6.036084e-001, 6.045598e-001, 6.055112e-001, 6.064626e-001, 6.074140e-001, 6.083597e-001, 6.093054e-001,
+6.102510e-001, 6.111966e-001, 6.121419e-001, 6.130870e-001, 6.140322e-001, 6.149773e-001, 6.159196e-001, 6.168593e-001, 6.177990e-001, 6.187388e-001,
+6.196793e-001, 6.206221e-001, 6.215649e-001, 6.225078e-001, 6.234506e-001, 6.243840e-001, 6.253164e-001, 6.262488e-001, 6.271812e-001, 6.281096e-001,
+6.290342e-001, 6.299588e-001, 6.308834e-001, 6.318072e-001, 6.327197e-001, 6.336323e-001, 6.345448e-001, 6.354574e-001, 6.363690e-001, 6.372799e-001,
+6.381908e-001, 6.391018e-001, 6.400124e-001, 6.409157e-001, 6.418190e-001, 6.427223e-001, 6.436257e-001, 6.445272e-001, 6.454267e-001, 6.463262e-001,
+6.472257e-001, 6.481252e-001, 6.490164e-001, 6.499059e-001, 6.507953e-001, 6.516848e-001, 6.525734e-001, 6.534568e-001, 6.543401e-001, 6.552235e-001,
+6.561068e-001, 6.569851e-001, 6.578559e-001, 6.587266e-001, 6.595974e-001, 6.604681e-001, 6.613350e-001, 6.621995e-001, 6.630640e-001, 6.639284e-001,
+6.647929e-001, 6.656517e-001, 6.665088e-001, 6.673660e-001, 6.682231e-001, 6.690803e-001, 6.699307e-001, 6.707803e-001, 6.716299e-001, 6.724795e-001,
+6.733291e-001, 6.741707e-001, 6.750117e-001, 6.758528e-001, 6.766939e-001, 6.775349e-001, 6.783678e-001, 6.792002e-001, 6.800325e-001, 6.808649e-001,
+6.816973e-001, 6.825289e-001, 6.833605e-001, 6.841921e-001, 6.850237e-001, 6.858553e-001, 6.866854e-001, 6.875151e-001, 6.883448e-001, 6.891745e-001,
+6.900042e-001, 6.908270e-001, 6.916458e-001, 6.924645e-001, 6.932832e-001, 6.941020e-001, 6.949160e-001, 6.957230e-001, 6.965300e-001, 6.973371e-001,
+6.981441e-001, 6.989498e-001, 6.997462e-001, 7.005427e-001, 7.013391e-001, 7.021355e-001, 7.029320e-001, 7.037230e-001, 7.045127e-001, 7.053024e-001,
+7.060920e-001, 7.068817e-001, 7.076676e-001, 7.084480e-001, 7.092283e-001, 7.100087e-001, 7.107891e-001, 7.115694e-001, 7.123499e-001, 7.131304e-001,
+7.139109e-001, 7.146914e-001, 7.154719e-001, 7.162483e-001, 7.170195e-001, 7.177908e-001, 7.185620e-001, 7.193333e-001, 7.201045e-001, 7.208759e-001,
+7.216472e-001, 7.224185e-001, 7.231899e-001, 7.239612e-001, 7.247302e-001, 7.254924e-001, 7.262545e-001, 7.270167e-001, 7.277788e-001, 7.285410e-001,
+7.293032e-001, 7.300654e-001, 7.308276e-001, 7.315898e-001, 7.323520e-001, 7.331142e-001, 7.338690e-001, 7.346221e-001, 7.353752e-001, 7.361283e-001,
+7.368814e-001, 7.376345e-001, 7.383876e-001, 7.391408e-001, 7.398939e-001, 7.406471e-001, 7.414002e-001, 7.421522e-001, 7.428963e-001, 7.436405e-001,
+7.443846e-001, 7.451288e-001, 7.458729e-001, 7.466160e-001, 7.473546e-001, 7.480933e-001, 7.488319e-001, 7.495706e-001, 7.503092e-001, 7.510460e-001,
+7.517745e-001, 7.525031e-001, 7.532316e-001, 7.539602e-001, 7.546887e-001, 7.554166e-001, 7.561393e-001, 7.568620e-001, 7.575847e-001, 7.583074e-001,
+7.590301e-001, 7.597528e-001, 7.604665e-001, 7.611799e-001, 7.618934e-001, 7.626068e-001, 7.633203e-001, 7.640338e-001, 7.647391e-001, 7.654420e-001,
+7.661450e-001, 7.668480e-001, 7.675510e-001, 7.682540e-001, 7.689521e-001, 7.696457e-001, 7.703393e-001, 7.710329e-001, 7.717265e-001, 7.724201e-001,
+7.731121e-001, 7.737968e-001, 7.744816e-001, 7.751663e-001, 7.758511e-001, 7.765358e-001, 7.772205e-001, 7.778991e-001, 7.785759e-001, 7.792527e-001,
+7.799294e-001, 7.806062e-001, 7.812829e-001, 7.819581e-001, 7.826292e-001, 7.833004e-001, 7.839716e-001, 7.846428e-001, 7.853139e-001, 7.859851e-001,
+7.866561e-001, 7.873270e-001, 7.879980e-001, 7.886689e-001, 7.893398e-001, 7.900107e-001, 7.906810e-001, 7.913464e-001, 7.920119e-001, 7.926774e-001,
+7.933428e-001, 7.940083e-001, 7.946738e-001, 7.953347e-001, 7.959898e-001, 7.966450e-001, 7.973002e-001, 7.979553e-001, 7.986105e-001, 7.992657e-001,
+7.999172e-001, 8.005671e-001, 8.012170e-001, 8.018668e-001, 8.025167e-001, 8.031666e-001, 8.038164e-001, 8.044541e-001, 8.050896e-001, 8.057252e-001,
+8.063607e-001, 8.069962e-001, 8.076317e-001, 8.082673e-001, 8.088986e-001, 8.095297e-001, 8.101608e-001, 8.107919e-001, 8.114230e-001, 8.120541e-001,
+8.126852e-001, 8.133052e-001, 8.139247e-001, 8.145442e-001, 8.151638e-001, 8.157833e-001, 8.164028e-001, 8.170223e-001, 8.176347e-001, 8.182463e-001,
+8.188579e-001, 8.194695e-001, 8.200811e-001, 8.206927e-001, 8.213043e-001, 8.219084e-001, 8.225101e-001, 8.231119e-001, 8.237137e-001, 8.243154e-001,
+8.249172e-001, 8.255189e-001, 8.261185e-001, 8.267164e-001, 8.273143e-001, 8.279122e-001, 8.285101e-001, 8.291080e-001, 8.297059e-001, 8.303020e-001,
+8.308932e-001, 8.314845e-001, 8.320757e-001, 8.326670e-001, 8.332582e-001, 8.338494e-001, 8.344407e-001, 8.350261e-001, 8.356109e-001, 8.361956e-001,
+8.367804e-001, 8.373651e-001, 8.379498e-001, 8.385346e-001, 8.391173e-001, 8.396976e-001, 8.402778e-001, 8.408580e-001, 8.414383e-001, 8.420185e-001,
+8.425987e-001, 8.431789e-001, 8.437567e-001, 8.443342e-001, 8.449116e-001, 8.454891e-001, 8.460666e-001, 8.466441e-001, 8.472216e-001, 8.477984e-001,
+8.483736e-001, 8.489489e-001, 8.495241e-001, 8.500993e-001, 8.506745e-001, 8.512498e-001, 8.518250e-001, 8.523975e-001, 8.529683e-001, 8.535390e-001,
+8.541098e-001, 8.546806e-001, 8.552514e-001, 8.558221e-001, 8.563929e-001, 8.569598e-001, 8.575260e-001, 8.580921e-001, 8.586583e-001, 8.592244e-001,
+8.597906e-001, 8.603568e-001, 8.609229e-001, 8.614862e-001, 8.620493e-001, 8.626125e-001, 8.631757e-001, 8.637388e-001, 8.643020e-001, 8.648651e-001,
+8.654281e-001, 8.659835e-001, 8.665388e-001, 8.670941e-001, 8.676495e-001, 8.682048e-001, 8.687602e-001, 8.693155e-001, 8.698708e-001, 8.704200e-001,
+8.709690e-001, 8.715181e-001, 8.720671e-001, 8.726162e-001, 8.731653e-001, 8.737143e-001, 8.742634e-001, 8.748088e-001, 8.753536e-001, 8.758984e-001,
+8.764432e-001, 8.769881e-001, 8.775329e-001, 8.780777e-001, 8.786226e-001, 8.791624e-001, 8.796998e-001, 8.802371e-001, 8.807745e-001, 8.813119e-001,
+8.818492e-001, 8.823866e-001, 8.829239e-001, 8.834607e-001, 8.839965e-001, 8.845322e-001, 8.850680e-001, 8.856038e-001, 8.861395e-001, 8.866753e-001,
+8.872110e-001, 8.877468e-001, 8.882741e-001, 8.888013e-001, 8.893284e-001, 8.898556e-001, 8.903827e-001, 8.909099e-001, 8.914370e-001, 8.919642e-001,
+8.924919e-001, 8.930203e-001, 8.935487e-001, 8.940771e-001, 8.946055e-001, 8.951339e-001, 8.956622e-001, 8.961906e-001, 8.967190e-001, 8.972421e-001,
+8.977648e-001, 8.982875e-001, 8.988103e-001, 8.993330e-001, 8.998557e-001, 9.003784e-001, 9.009011e-001, 9.014239e-001, 9.019468e-001, 9.024697e-001,
+9.029926e-001, 9.035155e-001, 9.040384e-001, 9.045613e-001, 9.050842e-001, 9.056071e-001, 9.061285e-001, 9.066483e-001, 9.071682e-001, 9.076881e-001,
+9.082080e-001, 9.087278e-001, 9.092477e-001, 9.097676e-001, 9.102875e-001, 9.108000e-001, 9.113087e-001, 9.118173e-001, 9.123260e-001, 9.128346e-001,
+9.133433e-001, 9.138519e-001, 9.143606e-001, 9.148693e-001, 9.153769e-001, 9.158841e-001, 9.163913e-001, 9.168984e-001, 9.174056e-001, 9.179128e-001,
+9.184200e-001, 9.189272e-001, 9.194344e-001, 9.199361e-001, 9.204352e-001, 9.209342e-001, 9.214332e-001, 9.219322e-001, 9.224312e-001, 9.229302e-001,
+9.234292e-001, 9.239282e-001, 9.244257e-001, 9.249218e-001, 9.254179e-001, 9.259140e-001, 9.264101e-001, 9.269062e-001, 9.274023e-001, 9.278984e-001,
+9.283945e-001, 9.288894e-001, 9.293813e-001, 9.298732e-001, 9.303651e-001, 9.308570e-001, 9.313489e-001, 9.318408e-001, 9.323327e-001, 9.328246e-001,
+9.333165e-001, 9.338007e-001, 9.342844e-001, 9.347681e-001, 9.352518e-001, 9.357356e-001, 9.362193e-001, 9.367030e-001, 9.371867e-001, 9.376704e-001,
+9.381523e-001, 9.386325e-001, 9.391127e-001, 9.395928e-001, 9.400730e-001, 9.405531e-001, 9.410333e-001, 9.415134e-001, 9.419936e-001, 9.424737e-001,
+9.429458e-001, 9.434174e-001, 9.438890e-001, 9.443606e-001, 9.448322e-001, 9.453038e-001, 9.457754e-001, 9.462471e-001, 9.467187e-001, 9.471882e-001,
+9.476526e-001, 9.481170e-001, 9.485814e-001, 9.490459e-001, 9.495103e-001, 9.499747e-001, 9.504391e-001, 9.509036e-001, 9.513680e-001, 9.518291e-001,
+9.522875e-001, 9.527458e-001, 9.532042e-001, 9.536625e-001, 9.541209e-001, 9.545792e-001, 9.550375e-001, 9.554959e-001, 9.559542e-001, 9.564118e-001,
+9.568691e-001, 9.573263e-001, 9.577836e-001, 9.582408e-001, 9.586981e-001, 9.591553e-001, 9.596126e-001, 9.600698e-001, 9.605271e-001, 9.609805e-001,
+9.614324e-001, 9.618843e-001, 9.623361e-001, 9.627880e-001, 9.632399e-001, 9.636918e-001, 9.641437e-001, 9.645955e-001, 9.650474e-001, 9.654958e-001,
+9.659423e-001, 9.663887e-001, 9.668352e-001, 9.672816e-001, 9.677281e-001, 9.681745e-001, 9.686209e-001, 9.690674e-001, 9.695138e-001, 9.699571e-001,
+9.703967e-001, 9.708362e-001, 9.712757e-001, 9.717152e-001, 9.721548e-001, 9.725943e-001, 9.730338e-001, 9.734733e-001, 9.739129e-001, 9.743511e-001,
+9.747827e-001, 9.752143e-001, 9.756459e-001, 9.760775e-001, 9.765090e-001, 9.769406e-001, 9.773722e-001, 9.778038e-001, 9.782354e-001, 9.786669e-001,
+9.790913e-001, 9.795132e-001, 9.799351e-001, 9.803571e-001, 9.807790e-001, 9.812009e-001, 9.816229e-001, 9.820448e-001, 9.824667e-001, 9.828887e-001,
+9.833080e-001, 9.837186e-001, 9.841292e-001, 9.845399e-001, 9.849505e-001, 9.853611e-001, 9.857717e-001, 9.861823e-001, 9.865929e-001, 9.870036e-001,
+9.874142e-001, 9.878158e-001, 9.882115e-001, 9.886071e-001, 9.890027e-001, 9.893983e-001, 9.897939e-001, 9.901895e-001, 9.905851e-001, 9.909807e-001,
+9.913763e-001, 9.917720e-001, 9.921514e-001, 9.925280e-001, 9.929047e-001, 9.932813e-001, 9.936579e-001, 9.940345e-001, 9.944111e-001, 9.947877e-001,
+9.951643e-001, 9.955409e-001, 9.959175e-001, 9.962887e-001, 9.966599e-001, 9.970310e-001, 9.974021e-001, 9.977732e-001, 9.981444e-001, 9.985155e-001,
+9.988866e-001, 9.992577e-001, 9.996289e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.347683e-003, 6.751414e-003, 1.011334e-002, 1.337425e-002, 1.652579e-002, 1.961326e-002, 2.259499e-002, 2.551318e-002, 2.838946e-002,
+3.119396e-002, 3.396267e-002, 3.670484e-002, 3.938220e-002, 4.200813e-002, 4.459351e-002, 4.713747e-002, 4.964892e-002, 5.214280e-002, 5.460660e-002,
+5.700849e-002, 5.937610e-002, 6.171475e-002, 6.403444e-002, 6.632721e-002, 6.860262e-002, 7.084573e-002, 7.306426e-002, 7.527201e-002, 7.747573e-002,
+7.965069e-002, 8.179819e-002, 8.392708e-002, 8.604725e-002, 8.814961e-002, 9.022556e-002, 9.228227e-002, 9.433312e-002, 9.636951e-002, 9.839080e-002,
+1.003959e-001, 1.023878e-001, 1.043626e-001, 1.063341e-001, 1.083092e-001, 1.102795e-001, 1.122396e-001, 1.141990e-001, 1.161565e-001, 1.181035e-001,
+1.200400e-001, 1.219607e-001, 1.238710e-001, 1.257670e-001, 1.276451e-001, 1.295011e-001, 1.313542e-001, 1.332029e-001, 1.350437e-001, 1.368710e-001,
+1.386904e-001, 1.405091e-001, 1.423261e-001, 1.441356e-001, 1.459415e-001, 1.477414e-001, 1.495409e-001, 1.513372e-001, 1.531285e-001, 1.549128e-001,
+1.566944e-001, 1.584592e-001, 1.602202e-001, 1.619769e-001, 1.637236e-001, 1.654656e-001, 1.672007e-001, 1.689288e-001, 1.706545e-001, 1.723744e-001,
+1.740882e-001, 1.757903e-001, 1.774810e-001, 1.791640e-001, 1.808430e-001, 1.825205e-001, 1.841987e-001, 1.858744e-001, 1.875447e-001, 1.892118e-001,
+1.908793e-001, 1.925470e-001, 1.942108e-001, 1.958704e-001, 1.975175e-001, 1.991518e-001, 2.007770e-001, 2.023956e-001, 2.040095e-001, 2.056213e-001,
+2.072338e-001, 2.088443e-001, 2.104482e-001, 2.120479e-001, 2.136454e-001, 2.152310e-001, 2.168078e-001, 2.183786e-001, 2.199451e-001, 2.215091e-001,
+2.230720e-001, 2.246361e-001, 2.262040e-001, 2.277674e-001, 2.293279e-001, 2.308869e-001, 2.324458e-001, 2.339976e-001, 2.355510e-001, 2.371080e-001,
+2.386678e-001, 2.402258e-001, 2.417753e-001, 2.433187e-001, 2.448568e-001, 2.463895e-001, 2.479178e-001, 2.494444e-001, 2.509701e-001, 2.524967e-001,
+2.540231e-001, 2.555484e-001, 2.570703e-001, 2.585889e-001, 2.601051e-001, 2.616184e-001, 2.631228e-001, 2.646224e-001, 2.661171e-001, 2.675963e-001,
+2.690718e-001, 2.705436e-001, 2.720069e-001, 2.734695e-001, 2.749321e-001, 2.763895e-001, 2.778449e-001, 2.792976e-001, 2.807495e-001, 2.822005e-001,
+2.836418e-001, 2.850797e-001, 2.865127e-001, 2.879436e-001, 2.893735e-001, 2.908020e-001, 2.922300e-001, 2.936573e-001, 2.950794e-001, 2.964995e-001,
+2.979145e-001, 2.993289e-001, 3.007413e-001, 3.021497e-001, 3.035539e-001, 3.049588e-001, 3.063641e-001, 3.077668e-001, 3.091700e-001, 3.105788e-001,
+3.119878e-001, 3.133974e-001, 3.148044e-001, 3.162082e-001, 3.176137e-001, 3.190205e-001, 3.204261e-001, 3.218309e-001, 3.232277e-001, 3.246218e-001,
+3.260088e-001, 3.273942e-001, 3.287747e-001, 3.301543e-001, 3.315236e-001, 3.328914e-001, 3.342565e-001, 3.356212e-001, 3.369806e-001, 3.383393e-001,
+3.396935e-001, 3.410468e-001, 3.423964e-001, 3.437449e-001, 3.450933e-001, 3.464417e-001, 3.477912e-001, 3.491415e-001, 3.504894e-001, 3.518337e-001,
+3.531750e-001, 3.545077e-001, 3.558402e-001, 3.571698e-001, 3.584994e-001, 3.598237e-001, 3.611472e-001, 3.624672e-001, 3.637854e-001, 3.651016e-001,
+3.664150e-001, 3.677274e-001, 3.690330e-001, 3.703387e-001, 3.716449e-001, 3.729512e-001, 3.742562e-001, 3.755599e-001, 3.768633e-001, 3.781649e-001,
+3.794665e-001, 3.807672e-001, 3.820676e-001, 3.833664e-001, 3.846625e-001, 3.859587e-001, 3.872512e-001, 3.885435e-001, 3.898344e-001, 3.911239e-001,
+3.924133e-001, 3.936967e-001, 3.949802e-001, 3.962610e-001, 3.975391e-001, 3.988172e-001, 4.000911e-001, 4.013648e-001, 4.026385e-001, 4.039122e-001,
+4.051858e-001, 4.064609e-001, 4.077362e-001, 4.090103e-001, 4.102798e-001, 4.115493e-001, 4.128125e-001, 4.140707e-001, 4.153289e-001, 4.165868e-001,
+4.178446e-001, 4.191029e-001, 4.203637e-001, 4.216246e-001, 4.228836e-001, 4.241402e-001, 4.253969e-001, 4.266511e-001, 4.279041e-001, 4.291572e-001,
+4.304041e-001, 4.316503e-001, 4.328961e-001, 4.341362e-001, 4.353762e-001, 4.366151e-001, 4.378498e-001, 4.390844e-001, 4.403163e-001, 4.415428e-001,
+4.427693e-001, 4.439926e-001, 4.452114e-001, 4.464302e-001, 4.476468e-001, 4.488608e-001, 4.500748e-001, 4.512878e-001, 4.524998e-001, 4.537117e-001,
+4.549198e-001, 4.561235e-001, 4.573272e-001, 4.585285e-001, 4.597266e-001, 4.609247e-001, 4.621219e-001, 4.633173e-001, 4.645128e-001, 4.657061e-001,
+4.668928e-001, 4.680794e-001, 4.692655e-001, 4.704455e-001, 4.716256e-001, 4.728056e-001, 4.739825e-001, 4.751592e-001, 4.763358e-001, 4.775057e-001,
+4.786727e-001, 4.798397e-001, 4.809997e-001, 4.821513e-001, 4.833030e-001, 4.844540e-001, 4.856021e-001, 4.867501e-001, 4.878982e-001, 4.890470e-001,
+4.901959e-001, 4.913449e-001, 4.924909e-001, 4.936340e-001, 4.947771e-001, 4.959191e-001, 4.970516e-001, 4.981842e-001, 4.993167e-001, 5.004443e-001,
+5.015697e-001, 5.026950e-001, 5.038194e-001, 5.049406e-001, 5.060617e-001, 5.071829e-001, 5.082974e-001, 5.094092e-001, 5.105210e-001, 5.116317e-001,
+5.127376e-001, 5.138435e-001, 5.149494e-001, 5.160538e-001, 5.171572e-001, 5.182605e-001, 5.193639e-001, 5.204595e-001, 5.215549e-001, 5.226503e-001,
+5.237421e-001, 5.248263e-001, 5.259105e-001, 5.269946e-001, 5.280733e-001, 5.291488e-001, 5.302242e-001, 5.312996e-001, 5.323688e-001, 5.334371e-001,
+5.345055e-001, 5.355729e-001, 5.366334e-001, 5.376938e-001, 5.387542e-001, 5.398129e-001, 5.408675e-001, 5.419221e-001, 5.429767e-001, 5.440296e-001,
+5.450802e-001, 5.461307e-001, 5.471813e-001, 5.482295e-001, 5.492755e-001, 5.503216e-001, 5.513677e-001, 5.524120e-001, 5.534553e-001, 5.544985e-001,
+5.555417e-001, 5.565804e-001, 5.576160e-001, 5.586516e-001, 5.596872e-001, 5.607174e-001, 5.617435e-001, 5.627696e-001, 5.637957e-001, 5.648216e-001,
+5.658473e-001, 5.668729e-001, 5.678986e-001, 5.689232e-001, 5.699462e-001, 5.709691e-001, 5.719921e-001, 5.730135e-001, 5.740294e-001, 5.750454e-001,
+5.760613e-001, 5.770772e-001, 5.780895e-001, 5.791018e-001, 5.801141e-001, 5.811264e-001, 5.821348e-001, 5.831419e-001, 5.841491e-001, 5.851562e-001,
+5.861612e-001, 5.871635e-001, 5.881659e-001, 5.891682e-001, 5.901698e-001, 5.911646e-001, 5.921594e-001, 5.931542e-001, 5.941490e-001, 5.951371e-001,
+5.961227e-001, 5.971082e-001, 5.980938e-001, 5.990792e-001, 6.000642e-001, 6.010492e-001, 6.020342e-001, 6.030193e-001, 6.039972e-001, 6.049731e-001,
+6.059491e-001, 6.069251e-001, 6.078995e-001, 6.088692e-001, 6.098389e-001, 6.108087e-001, 6.117784e-001, 6.127467e-001, 6.137143e-001, 6.146819e-001,
+6.156495e-001, 6.166170e-001, 6.175795e-001, 6.185420e-001, 6.195045e-001, 6.204670e-001, 6.214286e-001, 6.223886e-001, 6.233486e-001, 6.243086e-001,
+6.252686e-001, 6.262217e-001, 6.271704e-001, 6.281190e-001, 6.290677e-001, 6.300163e-001, 6.309583e-001, 6.318989e-001, 6.328394e-001, 6.337800e-001,
+6.347205e-001, 6.356572e-001, 6.365938e-001, 6.375304e-001, 6.384670e-001, 6.394030e-001, 6.403322e-001, 6.412614e-001, 6.421906e-001, 6.431198e-001,
+6.440478e-001, 6.449678e-001, 6.458878e-001, 6.468078e-001, 6.477278e-001, 6.486470e-001, 6.495617e-001, 6.504763e-001, 6.513909e-001, 6.523056e-001,
+6.532200e-001, 6.541327e-001, 6.550455e-001, 6.559582e-001, 6.568709e-001, 6.577836e-001, 6.586870e-001, 6.595901e-001, 6.604932e-001, 6.613964e-001,
+6.622995e-001, 6.631955e-001, 6.640898e-001, 6.649841e-001, 6.658785e-001, 6.667728e-001, 6.676589e-001, 6.685394e-001, 6.694199e-001, 6.703003e-001,
+6.711808e-001, 6.720594e-001, 6.729338e-001, 6.738083e-001, 6.746827e-001, 6.755571e-001, 6.764316e-001, 6.772987e-001, 6.781657e-001, 6.790326e-001,
+6.798996e-001, 6.807666e-001, 6.816290e-001, 6.824882e-001, 6.833475e-001, 6.842067e-001, 6.850660e-001, 6.859252e-001, 6.867847e-001, 6.876442e-001,
+6.885036e-001, 6.893631e-001, 6.902225e-001, 6.910751e-001, 6.919236e-001, 6.927720e-001, 6.936205e-001, 6.944690e-001, 6.953169e-001, 6.961556e-001,
+6.969943e-001, 6.978331e-001, 6.986718e-001, 6.995105e-001, 7.003444e-001, 7.011717e-001, 7.019990e-001, 7.028263e-001, 7.036536e-001, 7.044810e-001,
+7.053044e-001, 7.061263e-001, 7.069483e-001, 7.077703e-001, 7.085923e-001, 7.094143e-001, 7.102291e-001, 7.110438e-001, 7.118585e-001, 7.126732e-001,
+7.134879e-001, 7.143010e-001, 7.151066e-001, 7.159122e-001, 7.167178e-001, 7.175235e-001, 7.183291e-001, 7.191319e-001, 7.199281e-001, 7.207243e-001,
+7.215204e-001, 7.223166e-001, 7.231128e-001, 7.239064e-001, 7.246955e-001, 7.254845e-001, 7.262735e-001, 7.270625e-001, 7.278516e-001, 7.286369e-001,
+7.294150e-001, 7.301931e-001, 7.309712e-001, 7.317493e-001, 7.325274e-001, 7.333045e-001, 7.340789e-001, 7.348533e-001, 7.356276e-001, 7.364020e-001,
+7.371764e-001, 7.379498e-001, 7.387167e-001, 7.394835e-001, 7.402504e-001, 7.410173e-001, 7.417842e-001, 7.425511e-001, 7.433150e-001, 7.440786e-001,
+7.448423e-001, 7.456059e-001, 7.463695e-001, 7.471332e-001, 7.478901e-001, 7.486435e-001, 7.493969e-001, 7.501504e-001, 7.509038e-001, 7.516572e-001,
+7.524084e-001, 7.531549e-001, 7.539014e-001, 7.546479e-001, 7.553944e-001, 7.561409e-001, 7.568874e-001, 7.576225e-001, 7.583565e-001, 7.590904e-001,
+7.598244e-001, 7.605584e-001, 7.612924e-001, 7.620232e-001, 7.627500e-001, 7.634768e-001, 7.642035e-001, 7.649303e-001, 7.656571e-001, 7.663839e-001,
+7.671036e-001, 7.678225e-001, 7.685414e-001, 7.692603e-001, 7.699792e-001, 7.706981e-001, 7.714147e-001, 7.721254e-001, 7.728360e-001, 7.735466e-001,
+7.742572e-001, 7.749678e-001, 7.756784e-001, 7.763838e-001, 7.770855e-001, 7.777872e-001, 7.784889e-001, 7.791905e-001, 7.798922e-001, 7.805939e-001,
+7.812880e-001, 7.819804e-001, 7.826729e-001, 7.833653e-001, 7.840578e-001, 7.847502e-001, 7.854426e-001, 7.861268e-001, 7.868108e-001, 7.874948e-001,
+7.881788e-001, 7.888628e-001, 7.895468e-001, 7.902304e-001, 7.909095e-001, 7.915886e-001, 7.922676e-001, 7.929467e-001, 7.936258e-001, 7.943048e-001,
+7.949832e-001, 7.956549e-001, 7.963266e-001, 7.969984e-001, 7.976701e-001, 7.983418e-001, 7.990135e-001, 7.996852e-001, 8.003576e-001, 8.010300e-001,
+8.017025e-001, 8.023749e-001, 8.030473e-001, 8.037198e-001, 8.043922e-001, 8.050566e-001, 8.057201e-001, 8.063836e-001, 8.070471e-001, 8.077105e-001,
+8.083740e-001, 8.090375e-001, 8.096970e-001, 8.103548e-001, 8.110125e-001, 8.116702e-001, 8.123279e-001, 8.129856e-001, 8.136433e-001, 8.142980e-001,
+8.149478e-001, 8.155977e-001, 8.162475e-001, 8.168974e-001, 8.175472e-001, 8.181971e-001, 8.188469e-001, 8.194969e-001, 8.201468e-001, 8.207968e-001,
+8.214468e-001, 8.220967e-001, 8.227467e-001, 8.233966e-001, 8.240422e-001, 8.246844e-001, 8.253266e-001, 8.259688e-001, 8.266110e-001, 8.272532e-001,
+8.278954e-001, 8.285376e-001, 8.291799e-001, 8.298223e-001, 8.304646e-001, 8.311069e-001, 8.317492e-001, 8.323916e-001, 8.330339e-001, 8.336730e-001,
+8.343077e-001, 8.349423e-001, 8.355769e-001, 8.362116e-001, 8.368462e-001, 8.374808e-001, 8.381155e-001, 8.387502e-001, 8.393849e-001, 8.400196e-001,
+8.406544e-001, 8.412891e-001, 8.419239e-001, 8.425586e-001, 8.431933e-001, 8.438208e-001, 8.444479e-001, 8.450749e-001, 8.457020e-001, 8.463290e-001,
+8.469560e-001, 8.475831e-001, 8.482098e-001, 8.488330e-001, 8.494561e-001, 8.500792e-001, 8.507024e-001, 8.513255e-001, 8.519486e-001, 8.525718e-001,
+8.531946e-001, 8.538154e-001, 8.544362e-001, 8.550570e-001, 8.556778e-001, 8.562985e-001, 8.569193e-001, 8.575401e-001, 8.581606e-001, 8.587781e-001,
+8.593956e-001, 8.600132e-001, 8.606307e-001, 8.612482e-001, 8.618657e-001, 8.624832e-001, 8.631008e-001, 8.637113e-001, 8.643216e-001, 8.649319e-001,
+8.655421e-001, 8.661524e-001, 8.667627e-001, 8.673730e-001, 8.679833e-001, 8.685910e-001, 8.691979e-001, 8.698048e-001, 8.704117e-001, 8.710185e-001,
+8.716254e-001, 8.722323e-001, 8.728392e-001, 8.734431e-001, 8.740433e-001, 8.746436e-001, 8.752438e-001, 8.758441e-001, 8.764443e-001, 8.770446e-001,
+8.776448e-001, 8.782446e-001, 8.788375e-001, 8.794304e-001, 8.800233e-001, 8.806161e-001, 8.812090e-001, 8.818019e-001, 8.823948e-001, 8.829876e-001,
+8.835765e-001, 8.841624e-001, 8.847483e-001, 8.853343e-001, 8.859202e-001, 8.865061e-001, 8.870920e-001, 8.876780e-001, 8.882638e-001, 8.888435e-001,
+8.894231e-001, 8.900028e-001, 8.905824e-001, 8.911621e-001, 8.917417e-001, 8.923214e-001, 8.929010e-001, 8.934787e-001, 8.940525e-001, 8.946262e-001,
+8.952000e-001, 8.957738e-001, 8.963476e-001, 8.969213e-001, 8.974951e-001, 8.980689e-001, 8.986397e-001, 8.992083e-001, 8.997768e-001, 9.003454e-001,
+9.009140e-001, 9.014826e-001, 9.020512e-001, 9.026198e-001, 9.031883e-001, 9.037535e-001, 9.043173e-001, 9.048812e-001, 9.054450e-001, 9.060089e-001,
+9.065728e-001, 9.071366e-001, 9.077005e-001, 9.082643e-001, 9.088250e-001, 9.093848e-001, 9.099446e-001, 9.105043e-001, 9.110641e-001, 9.116239e-001,
+9.121837e-001, 9.127434e-001, 9.133032e-001, 9.138604e-001, 9.144167e-001, 9.149729e-001, 9.155291e-001, 9.160854e-001, 9.166416e-001, 9.171979e-001,
+9.177541e-001, 9.183103e-001, 9.188649e-001, 9.194182e-001, 9.199715e-001, 9.205248e-001, 9.210781e-001, 9.216314e-001, 9.221848e-001, 9.227381e-001,
+9.232914e-001, 9.238408e-001, 9.243822e-001, 9.249237e-001, 9.254652e-001, 9.260067e-001, 9.265482e-001, 9.270897e-001, 9.276312e-001, 9.281727e-001,
+9.287142e-001, 9.292521e-001, 9.297899e-001, 9.303278e-001, 9.308656e-001, 9.314035e-001, 9.319413e-001, 9.324791e-001, 9.330170e-001, 9.335548e-001,
+9.340875e-001, 9.346157e-001, 9.351440e-001, 9.356722e-001, 9.362004e-001, 9.367287e-001, 9.372569e-001, 9.377852e-001, 9.383134e-001, 9.388416e-001,
+9.393644e-001, 9.398870e-001, 9.404097e-001, 9.409323e-001, 9.414550e-001, 9.419777e-001, 9.425003e-001, 9.430230e-001, 9.435456e-001, 9.440639e-001,
+9.445734e-001, 9.450829e-001, 9.455924e-001, 9.461019e-001, 9.466114e-001, 9.471209e-001, 9.476304e-001, 9.481399e-001, 9.486494e-001, 9.491566e-001,
+9.496620e-001, 9.501674e-001, 9.506728e-001, 9.511782e-001, 9.516836e-001, 9.521890e-001, 9.526944e-001, 9.531999e-001, 9.537053e-001, 9.542062e-001,
+9.547054e-001, 9.552046e-001, 9.557038e-001, 9.562030e-001, 9.567022e-001, 9.572014e-001, 9.577006e-001, 9.581998e-001, 9.586990e-001, 9.591948e-001,
+9.596895e-001, 9.601842e-001, 9.606789e-001, 9.611736e-001, 9.616683e-001, 9.621630e-001, 9.626577e-001, 9.631524e-001, 9.636471e-001, 9.641353e-001,
+9.646202e-001, 9.651051e-001, 9.655900e-001, 9.660750e-001, 9.665599e-001, 9.670448e-001, 9.675297e-001, 9.680147e-001, 9.684996e-001, 9.689793e-001,
+9.694533e-001, 9.699273e-001, 9.704013e-001, 9.708753e-001, 9.713493e-001, 9.718233e-001, 9.722973e-001, 9.727713e-001, 9.732454e-001, 9.737173e-001,
+9.741798e-001, 9.746424e-001, 9.751049e-001, 9.755674e-001, 9.760300e-001, 9.764925e-001, 9.769550e-001, 9.774175e-001, 9.778801e-001, 9.783426e-001,
+9.787946e-001, 9.792435e-001, 9.796924e-001, 9.801412e-001, 9.805901e-001, 9.810390e-001, 9.814879e-001, 9.819367e-001, 9.823856e-001, 9.828345e-001,
+9.832789e-001, 9.837100e-001, 9.841410e-001, 9.845720e-001, 9.850030e-001, 9.854340e-001, 9.858650e-001, 9.862960e-001, 9.867270e-001, 9.871580e-001,
+9.875890e-001, 9.880053e-001, 9.884121e-001, 9.888189e-001, 9.892257e-001, 9.896325e-001, 9.900393e-001, 9.904461e-001, 9.908529e-001, 9.912597e-001,
+9.916665e-001, 9.920733e-001, 9.924513e-001, 9.928246e-001, 9.931978e-001, 9.935710e-001, 9.939442e-001, 9.943174e-001, 9.946906e-001, 9.950639e-001,
+9.954371e-001, 9.958103e-001, 9.961835e-001, 9.965308e-001, 9.968777e-001, 9.972246e-001, 9.975715e-001, 9.979185e-001, 9.982654e-001, 9.986123e-001,
+9.989592e-001, 9.993062e-001, 9.996531e-001, 1.000000e+000)),
+("Kodak", "Max Zoom 800", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.439110e-003, 1.698923e-002, 2.468185e-002, 3.176616e-002, 3.823252e-002, 4.411724e-002, 4.968619e-002, 5.505860e-002, 6.012231e-002,
+6.496423e-002, 6.958514e-002, 7.400949e-002, 7.831472e-002, 8.253063e-002, 8.666084e-002, 9.070572e-002, 9.463635e-002, 9.840901e-002, 1.020662e-001,
+1.056471e-001, 1.091898e-001, 1.126779e-001, 1.161488e-001, 1.195472e-001, 1.229045e-001, 1.262067e-001, 1.294586e-001, 1.326504e-001, 1.357606e-001,
+1.388241e-001, 1.418274e-001, 1.447373e-001, 1.476097e-001, 1.504617e-001, 1.533035e-001, 1.561179e-001, 1.589270e-001, 1.617162e-001, 1.644722e-001,
+1.672010e-001, 1.699149e-001, 1.725971e-001, 1.752271e-001, 1.778231e-001, 1.803787e-001, 1.828950e-001, 1.853982e-001, 1.878786e-001, 1.903572e-001,
+1.928332e-001, 1.952916e-001, 1.977208e-001, 2.001152e-001, 2.025077e-001, 2.049014e-001, 2.072763e-001, 2.096344e-001, 2.119597e-001, 2.142513e-001,
+2.165052e-001, 2.187243e-001, 2.209310e-001, 2.231298e-001, 2.253059e-001, 2.274694e-001, 2.296334e-001, 2.317735e-001, 2.338978e-001, 2.360041e-001,
+2.380760e-001, 2.401296e-001, 2.421853e-001, 2.442210e-001, 2.462366e-001, 2.482511e-001, 2.502494e-001, 2.522227e-001, 2.541834e-001, 2.561318e-001,
+2.580587e-001, 2.599674e-001, 2.618735e-001, 2.637856e-001, 2.656947e-001, 2.675924e-001, 2.694917e-001, 2.713840e-001, 2.732623e-001, 2.751279e-001,
+2.769822e-001, 2.788152e-001, 2.806367e-001, 2.824515e-001, 2.842658e-001, 2.860780e-001, 2.878657e-001, 2.896395e-001, 2.914095e-001, 2.931736e-001,
+2.949215e-001, 2.966548e-001, 2.983818e-001, 3.001015e-001, 3.017993e-001, 3.034815e-001, 3.051558e-001, 3.068262e-001, 3.085028e-001, 3.101766e-001,
+3.118444e-001, 3.135068e-001, 3.151695e-001, 3.168336e-001, 3.184847e-001, 3.201305e-001, 3.217692e-001, 3.234056e-001, 3.250352e-001, 3.266385e-001,
+3.282344e-001, 3.298249e-001, 3.314053e-001, 3.329855e-001, 3.345663e-001, 3.361379e-001, 3.377039e-001, 3.392635e-001, 3.408218e-001, 3.423773e-001,
+3.439237e-001, 3.454602e-001, 3.469889e-001, 3.485143e-001, 3.500324e-001, 3.515474e-001, 3.530418e-001, 3.545320e-001, 3.560110e-001, 3.574849e-001,
+3.589515e-001, 3.604163e-001, 3.618794e-001, 3.633391e-001, 3.647965e-001, 3.662521e-001, 3.677067e-001, 3.691572e-001, 3.706059e-001, 3.720483e-001,
+3.734880e-001, 3.749237e-001, 3.763575e-001, 3.777864e-001, 3.792123e-001, 3.806299e-001, 3.820405e-001, 3.834430e-001, 3.848352e-001, 3.862208e-001,
+3.875918e-001, 3.889612e-001, 3.903223e-001, 3.916834e-001, 3.930289e-001, 3.943737e-001, 3.957100e-001, 3.970431e-001, 3.983732e-001, 3.997000e-001,
+4.010235e-001, 4.023340e-001, 4.036446e-001, 4.049448e-001, 4.062437e-001, 4.075376e-001, 4.088272e-001, 4.101123e-001, 4.113763e-001, 4.126402e-001,
+4.138969e-001, 4.151514e-001, 4.164058e-001, 4.176602e-001, 4.189146e-001, 4.201653e-001, 4.214153e-001, 4.226615e-001, 4.239003e-001, 4.251391e-001,
+4.263816e-001, 4.276249e-001, 4.288657e-001, 4.300981e-001, 4.313304e-001, 4.325572e-001, 4.337803e-001, 4.350035e-001, 4.362299e-001, 4.374563e-001,
+4.386776e-001, 4.398861e-001, 4.410946e-001, 4.422995e-001, 4.435017e-001, 4.447039e-001, 4.459021e-001, 4.470992e-001, 4.482961e-001, 4.494735e-001,
+4.506510e-001, 4.518276e-001, 4.530000e-001, 4.541725e-001, 4.553438e-001, 4.565127e-001, 4.576815e-001, 4.588430e-001, 4.599938e-001, 4.611447e-001,
+4.622925e-001, 4.634367e-001, 4.645808e-001, 4.657213e-001, 4.668577e-001, 4.679941e-001, 4.691272e-001, 4.702562e-001, 4.713852e-001, 4.725121e-001,
+4.736359e-001, 4.747596e-001, 4.758782e-001, 4.769828e-001, 4.780874e-001, 4.791901e-001, 4.802770e-001, 4.813640e-001, 4.824509e-001, 4.835344e-001,
+4.846176e-001, 4.857008e-001, 4.867847e-001, 4.878690e-001, 4.889533e-001, 4.900343e-001, 4.911103e-001, 4.921863e-001, 4.932623e-001, 4.943381e-001,
+4.954138e-001, 4.964896e-001, 4.975619e-001, 4.986326e-001, 4.997034e-001, 5.007710e-001, 5.018302e-001, 5.028893e-001, 5.039485e-001, 5.050030e-001,
+5.060563e-001, 5.071097e-001, 5.081600e-001, 5.092030e-001, 5.102460e-001, 5.112890e-001, 5.123234e-001, 5.133546e-001, 5.143859e-001, 5.154163e-001,
+5.164411e-001, 5.174659e-001, 5.184907e-001, 5.195080e-001, 5.205168e-001, 5.215256e-001, 5.225344e-001, 5.235392e-001, 5.245428e-001, 5.255465e-001,
+5.265501e-001, 5.275590e-001, 5.285679e-001, 5.295767e-001, 5.305829e-001, 5.315781e-001, 5.325733e-001, 5.335685e-001, 5.345617e-001, 5.355508e-001,
+5.365399e-001, 5.375291e-001, 5.385141e-001, 5.394937e-001, 5.404733e-001, 5.414529e-001, 5.424301e-001, 5.434045e-001, 5.443788e-001, 5.453532e-001,
+5.463276e-001, 5.473020e-001, 5.482764e-001, 5.492508e-001, 5.502228e-001, 5.511909e-001, 5.521589e-001, 5.531269e-001, 5.540925e-001, 5.550502e-001,
+5.560080e-001, 5.569657e-001, 5.579233e-001, 5.588781e-001, 5.598329e-001, 5.607877e-001, 5.617425e-001, 5.626881e-001, 5.636314e-001, 5.645748e-001,
+5.655181e-001, 5.664567e-001, 5.673908e-001, 5.683248e-001, 5.692589e-001, 5.701920e-001, 5.711195e-001, 5.720471e-001, 5.729747e-001, 5.739022e-001,
+5.748243e-001, 5.757444e-001, 5.766644e-001, 5.775845e-001, 5.785032e-001, 5.794179e-001, 5.803325e-001, 5.812472e-001, 5.821619e-001, 5.830688e-001,
+5.839727e-001, 5.848766e-001, 5.857805e-001, 5.866836e-001, 5.875809e-001, 5.884782e-001, 5.893755e-001, 5.902727e-001, 5.911680e-001, 5.920607e-001,
+5.929535e-001, 5.938463e-001, 5.947391e-001, 5.956213e-001, 5.964996e-001, 5.973780e-001, 5.982564e-001, 5.991347e-001, 6.000013e-001, 6.008672e-001,
+6.017332e-001, 6.025991e-001, 6.034640e-001, 6.043194e-001, 6.051747e-001, 6.060300e-001, 6.068853e-001, 6.077398e-001, 6.085902e-001, 6.094405e-001,
+6.102908e-001, 6.111412e-001, 6.119889e-001, 6.128252e-001, 6.136614e-001, 6.144977e-001, 6.153339e-001, 6.161686e-001, 6.169930e-001, 6.178174e-001,
+6.186417e-001, 6.194661e-001, 6.202905e-001, 6.211114e-001, 6.219323e-001, 6.227532e-001, 6.235741e-001, 6.243951e-001, 6.252128e-001, 6.260298e-001,
+6.268467e-001, 6.276637e-001, 6.284807e-001, 6.292940e-001, 6.301044e-001, 6.309147e-001, 6.317251e-001, 6.325354e-001, 6.333455e-001, 6.341545e-001,
+6.349634e-001, 6.357724e-001, 6.365814e-001, 6.373903e-001, 6.381942e-001, 6.389969e-001, 6.397995e-001, 6.406022e-001, 6.414049e-001, 6.422066e-001,
+6.430063e-001, 6.438060e-001, 6.446057e-001, 6.454054e-001, 6.462052e-001, 6.469958e-001, 6.477838e-001, 6.485717e-001, 6.493597e-001, 6.501477e-001,
+6.509343e-001, 6.517131e-001, 6.524918e-001, 6.532706e-001, 6.540493e-001, 6.548281e-001, 6.556052e-001, 6.563801e-001, 6.571550e-001, 6.579299e-001,
+6.587048e-001, 6.594797e-001, 6.602490e-001, 6.610153e-001, 6.617817e-001, 6.625480e-001, 6.633144e-001, 6.640807e-001, 6.648426e-001, 6.656034e-001,
+6.663641e-001, 6.671249e-001, 6.678856e-001, 6.686463e-001, 6.694011e-001, 6.701549e-001, 6.709086e-001, 6.716624e-001, 6.724161e-001, 6.731699e-001,
+6.739165e-001, 6.746616e-001, 6.754067e-001, 6.761518e-001, 6.768970e-001, 6.776421e-001, 6.783867e-001, 6.791310e-001, 6.798754e-001, 6.806198e-001,
+6.813642e-001, 6.821085e-001, 6.828458e-001, 6.835769e-001, 6.843081e-001, 6.850392e-001, 6.857703e-001, 6.865015e-001, 6.872311e-001, 6.879568e-001,
+6.886826e-001, 6.894083e-001, 6.901340e-001, 6.908597e-001, 6.915854e-001, 6.923051e-001, 6.930243e-001, 6.937434e-001, 6.944626e-001, 6.951817e-001,
+6.959009e-001, 6.966162e-001, 6.973274e-001, 6.980385e-001, 6.987496e-001, 6.994607e-001, 7.001718e-001, 7.008829e-001, 7.015896e-001, 7.022961e-001,
+7.030025e-001, 7.037090e-001, 7.044154e-001, 7.051218e-001, 7.058251e-001, 7.065217e-001, 7.072183e-001, 7.079149e-001, 7.086114e-001, 7.093080e-001,
+7.100046e-001, 7.106981e-001, 7.113897e-001, 7.120812e-001, 7.127728e-001, 7.134644e-001, 7.141560e-001, 7.148475e-001, 7.155427e-001, 7.162387e-001,
+7.169347e-001, 7.176308e-001, 7.183268e-001, 7.190228e-001, 7.197188e-001, 7.204080e-001, 7.210965e-001, 7.217851e-001, 7.224736e-001, 7.231622e-001,
+7.238507e-001, 7.245393e-001, 7.252277e-001, 7.259160e-001, 7.266044e-001, 7.272927e-001, 7.279811e-001, 7.286694e-001, 7.293578e-001, 7.300446e-001,
+7.307312e-001, 7.314178e-001, 7.321043e-001, 7.327909e-001, 7.334775e-001, 7.341641e-001, 7.348475e-001, 7.355295e-001, 7.362115e-001, 7.368934e-001,
+7.375754e-001, 7.382574e-001, 7.389393e-001, 7.396183e-001, 7.402927e-001, 7.409671e-001, 7.416416e-001, 7.423160e-001, 7.429904e-001, 7.436649e-001,
+7.443390e-001, 7.450043e-001, 7.456695e-001, 7.463347e-001, 7.470000e-001, 7.476652e-001, 7.483305e-001, 7.489957e-001, 7.496609e-001, 7.503259e-001,
+7.509910e-001, 7.516561e-001, 7.523211e-001, 7.529862e-001, 7.536513e-001, 7.543163e-001, 7.549796e-001, 7.556428e-001, 7.563060e-001, 7.569693e-001,
+7.576325e-001, 7.582957e-001, 7.589589e-001, 7.596207e-001, 7.602792e-001, 7.609377e-001, 7.615962e-001, 7.622547e-001, 7.629132e-001, 7.635717e-001,
+7.642302e-001, 7.648858e-001, 7.655387e-001, 7.661917e-001, 7.668446e-001, 7.674976e-001, 7.681505e-001, 7.688035e-001, 7.694564e-001, 7.701070e-001,
+7.707563e-001, 7.714056e-001, 7.720549e-001, 7.727042e-001, 7.733534e-001, 7.740027e-001, 7.746520e-001, 7.752994e-001, 7.759457e-001, 7.765920e-001,
+7.772383e-001, 7.778846e-001, 7.785309e-001, 7.791772e-001, 7.798236e-001, 7.804623e-001, 7.810947e-001, 7.817271e-001, 7.823594e-001, 7.829918e-001,
+7.836242e-001, 7.842566e-001, 7.848890e-001, 7.855191e-001, 7.861445e-001, 7.867699e-001, 7.873954e-001, 7.880208e-001, 7.886462e-001, 7.892716e-001,
+7.898971e-001, 7.905224e-001, 7.911402e-001, 7.917579e-001, 7.923757e-001, 7.929935e-001, 7.936112e-001, 7.942290e-001, 7.948467e-001, 7.954645e-001,
+7.960770e-001, 7.966857e-001, 7.972944e-001, 7.979031e-001, 7.985118e-001, 7.991205e-001, 7.997291e-001, 8.003378e-001, 8.009465e-001, 8.015543e-001,
+8.021621e-001, 8.027699e-001, 8.033777e-001, 8.039856e-001, 8.045934e-001, 8.052012e-001, 8.058090e-001, 8.064160e-001, 8.070215e-001, 8.076270e-001,
+8.082325e-001, 8.088380e-001, 8.094435e-001, 8.100490e-001, 8.106545e-001, 8.112600e-001, 8.118627e-001, 8.124632e-001, 8.130637e-001, 8.136642e-001,
+8.142647e-001, 8.148652e-001, 8.154657e-001, 8.160662e-001, 8.166667e-001, 8.172660e-001, 8.178647e-001, 8.184634e-001, 8.190621e-001, 8.196608e-001,
+8.202595e-001, 8.208582e-001, 8.214569e-001, 8.220556e-001, 8.226491e-001, 8.232396e-001, 8.238302e-001, 8.244208e-001, 8.250114e-001, 8.256020e-001,
+8.261926e-001, 8.267832e-001, 8.273738e-001, 8.279619e-001, 8.285476e-001, 8.291332e-001, 8.297189e-001, 8.303046e-001, 8.308902e-001, 8.314759e-001,
+8.320616e-001, 8.326472e-001, 8.332327e-001, 8.338174e-001, 8.344022e-001, 8.349869e-001, 8.355717e-001, 8.361564e-001, 8.367411e-001, 8.373259e-001,
+8.379106e-001, 8.384954e-001, 8.390773e-001, 8.396586e-001, 8.402400e-001, 8.408213e-001, 8.414027e-001, 8.419840e-001, 8.425654e-001, 8.431467e-001,
+8.437281e-001, 8.443076e-001, 8.448830e-001, 8.454584e-001, 8.460338e-001, 8.466092e-001, 8.471846e-001, 8.477599e-001, 8.483353e-001, 8.489107e-001,
+8.494861e-001, 8.500558e-001, 8.506223e-001, 8.511889e-001, 8.517554e-001, 8.523219e-001, 8.528885e-001, 8.534550e-001, 8.540216e-001, 8.545881e-001,
+8.551547e-001, 8.557176e-001, 8.562799e-001, 8.568423e-001, 8.574046e-001, 8.579670e-001, 8.585293e-001, 8.590916e-001, 8.596540e-001, 8.602163e-001,
+8.607787e-001, 8.613409e-001, 8.619031e-001, 8.624654e-001, 8.630276e-001, 8.635898e-001, 8.641521e-001, 8.647143e-001, 8.652765e-001, 8.658387e-001,
+8.664010e-001, 8.669610e-001, 8.675208e-001, 8.680805e-001, 8.686403e-001, 8.692000e-001, 8.697598e-001, 8.703196e-001, 8.708793e-001, 8.714391e-001,
+8.719988e-001, 8.725550e-001, 8.731097e-001, 8.736643e-001, 8.742190e-001, 8.747736e-001, 8.753283e-001, 8.758829e-001, 8.764376e-001, 8.769922e-001,
+8.775469e-001, 8.781004e-001, 8.786520e-001, 8.792036e-001, 8.797552e-001, 8.803068e-001, 8.808584e-001, 8.814099e-001, 8.819615e-001, 8.825131e-001,
+8.830647e-001, 8.836163e-001, 8.841653e-001, 8.847140e-001, 8.852627e-001, 8.858114e-001, 8.863601e-001, 8.869088e-001, 8.874575e-001, 8.880062e-001,
+8.885549e-001, 8.891036e-001, 8.896498e-001, 8.901898e-001, 8.907298e-001, 8.912699e-001, 8.918099e-001, 8.923500e-001, 8.928900e-001, 8.934300e-001,
+8.939701e-001, 8.945101e-001, 8.950502e-001, 8.955878e-001, 8.961235e-001, 8.966591e-001, 8.971948e-001, 8.977304e-001, 8.982661e-001, 8.988017e-001,
+8.993373e-001, 8.998730e-001, 9.004086e-001, 9.009443e-001, 9.014745e-001, 9.020018e-001, 9.025292e-001, 9.030565e-001, 9.035838e-001, 9.041111e-001,
+9.046384e-001, 9.051657e-001, 9.056930e-001, 9.062203e-001, 9.067476e-001, 9.072715e-001, 9.077931e-001, 9.083147e-001, 9.088363e-001, 9.093579e-001,
+9.098795e-001, 9.104011e-001, 9.109227e-001, 9.114443e-001, 9.119659e-001, 9.124875e-001, 9.130079e-001, 9.135266e-001, 9.140453e-001, 9.145639e-001,
+9.150826e-001, 9.156013e-001, 9.161200e-001, 9.166387e-001, 9.171573e-001, 9.176760e-001, 9.181947e-001, 9.187132e-001, 9.192286e-001, 9.197440e-001,
+9.202594e-001, 9.207748e-001, 9.212902e-001, 9.218056e-001, 9.223210e-001, 9.228364e-001, 9.233518e-001, 9.238672e-001, 9.243826e-001, 9.248953e-001,
+9.254056e-001, 9.259160e-001, 9.264264e-001, 9.269367e-001, 9.274471e-001, 9.279575e-001, 9.284678e-001, 9.289782e-001, 9.294886e-001, 9.299989e-001,
+9.305093e-001, 9.310135e-001, 9.315169e-001, 9.320203e-001, 9.325238e-001, 9.330272e-001, 9.335306e-001, 9.340341e-001, 9.345375e-001, 9.350409e-001,
+9.355443e-001, 9.360478e-001, 9.365505e-001, 9.370447e-001, 9.375388e-001, 9.380330e-001, 9.385271e-001, 9.390213e-001, 9.395154e-001, 9.400096e-001,
+9.405037e-001, 9.409979e-001, 9.414920e-001, 9.419862e-001, 9.424793e-001, 9.429621e-001, 9.434450e-001, 9.439279e-001, 9.444107e-001, 9.448936e-001,
+9.453764e-001, 9.458593e-001, 9.463421e-001, 9.468250e-001, 9.473079e-001, 9.477907e-001, 9.482736e-001, 9.487515e-001, 9.492292e-001, 9.497069e-001,
+9.501846e-001, 9.506623e-001, 9.511400e-001, 9.516176e-001, 9.520953e-001, 9.525730e-001, 9.530507e-001, 9.535284e-001, 9.540061e-001, 9.544799e-001,
+9.549517e-001, 9.554235e-001, 9.558952e-001, 9.563670e-001, 9.568387e-001, 9.573105e-001, 9.577823e-001, 9.582540e-001, 9.587258e-001, 9.591975e-001,
+9.596693e-001, 9.601397e-001, 9.606036e-001, 9.610675e-001, 9.615314e-001, 9.619953e-001, 9.624592e-001, 9.629231e-001, 9.633870e-001, 9.638509e-001,
+9.643148e-001, 9.647788e-001, 9.652427e-001, 9.657066e-001, 9.661655e-001, 9.666201e-001, 9.670746e-001, 9.675292e-001, 9.679838e-001, 9.684384e-001,
+9.688929e-001, 9.693475e-001, 9.698021e-001, 9.702567e-001, 9.707112e-001, 9.711658e-001, 9.716204e-001, 9.720691e-001, 9.725155e-001, 9.729619e-001,
+9.734084e-001, 9.738548e-001, 9.743012e-001, 9.747477e-001, 9.751941e-001, 9.756406e-001, 9.760870e-001, 9.765334e-001, 9.769799e-001, 9.774263e-001,
+9.778676e-001, 9.783070e-001, 9.787464e-001, 9.791858e-001, 9.796252e-001, 9.800646e-001, 9.805040e-001, 9.809434e-001, 9.813829e-001, 9.818223e-001,
+9.822617e-001, 9.827011e-001, 9.831405e-001, 9.835739e-001, 9.840028e-001, 9.844316e-001, 9.848605e-001, 9.852894e-001, 9.857182e-001, 9.861471e-001,
+9.865760e-001, 9.870048e-001, 9.874337e-001, 9.878626e-001, 9.882914e-001, 9.887203e-001, 9.891455e-001, 9.895584e-001, 9.899713e-001, 9.903843e-001,
+9.907972e-001, 9.912101e-001, 9.916231e-001, 9.920360e-001, 9.924489e-001, 9.928618e-001, 9.932748e-001, 9.936877e-001, 9.941006e-001, 9.945135e-001,
+9.949113e-001, 9.953027e-001, 9.956942e-001, 9.960856e-001, 9.964770e-001, 9.968685e-001, 9.972599e-001, 9.976514e-001, 9.980428e-001, 9.984342e-001,
+9.988257e-001, 9.992171e-001, 9.996086e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.576310e-003, 1.512531e-002, 2.199312e-002, 2.829400e-002, 3.400485e-002, 3.934865e-002, 4.450016e-002, 4.931959e-002, 5.392805e-002,
+5.837572e-002, 6.264277e-002, 6.677990e-002, 7.078526e-002, 7.470591e-002, 7.850238e-002, 8.220775e-002, 8.582385e-002, 8.936223e-002, 9.286080e-002,
+9.630463e-002, 9.966903e-002, 1.029520e-001, 1.061682e-001, 1.093337e-001, 1.124324e-001, 1.155048e-001, 1.185454e-001, 1.215456e-001, 1.245017e-001,
+1.273858e-001, 1.302534e-001, 1.330838e-001, 1.358838e-001, 1.386433e-001, 1.413915e-001, 1.440996e-001, 1.467884e-001, 1.494297e-001, 1.520594e-001,
+1.546592e-001, 1.572350e-001, 1.597743e-001, 1.622852e-001, 1.647903e-001, 1.672618e-001, 1.697238e-001, 1.721519e-001, 1.745535e-001, 1.769459e-001,
+1.793050e-001, 1.816422e-001, 1.839872e-001, 1.863050e-001, 1.886060e-001, 1.908763e-001, 1.931105e-001, 1.953329e-001, 1.975608e-001, 1.997732e-001,
+2.019651e-001, 2.041545e-001, 2.063178e-001, 2.084506e-001, 2.105777e-001, 2.127069e-001, 2.148050e-001, 2.168878e-001, 2.189736e-001, 2.210466e-001,
+2.230933e-001, 2.251245e-001, 2.271171e-001, 2.290780e-001, 2.310226e-001, 2.329606e-001, 2.348947e-001, 2.368202e-001, 2.387333e-001, 2.406368e-001,
+2.425451e-001, 2.444513e-001, 2.463417e-001, 2.482246e-001, 2.501087e-001, 2.519942e-001, 2.538610e-001, 2.557184e-001, 2.575724e-001, 2.594227e-001,
+2.612658e-001, 2.630968e-001, 2.649214e-001, 2.667476e-001, 2.685596e-001, 2.703500e-001, 2.721207e-001, 2.738778e-001, 2.756209e-001, 2.773512e-001,
+2.790702e-001, 2.807764e-001, 2.824759e-001, 2.841669e-001, 2.858343e-001, 2.875004e-001, 2.891633e-001, 2.908204e-001, 2.924638e-001, 2.941014e-001,
+2.957335e-001, 2.973627e-001, 2.989873e-001, 3.006061e-001, 3.022069e-001, 3.038053e-001, 3.054030e-001, 3.069913e-001, 3.085735e-001, 3.101415e-001,
+3.117022e-001, 3.132582e-001, 3.148200e-001, 3.163795e-001, 3.179340e-001, 3.194748e-001, 3.210083e-001, 3.225388e-001, 3.240654e-001, 3.255798e-001,
+3.270798e-001, 3.285648e-001, 3.300415e-001, 3.315150e-001, 3.329942e-001, 3.344734e-001, 3.359495e-001, 3.374227e-001, 3.388883e-001, 3.403522e-001,
+3.418137e-001, 3.432742e-001, 3.447339e-001, 3.461845e-001, 3.476295e-001, 3.490661e-001, 3.504986e-001, 3.519344e-001, 3.533715e-001, 3.548054e-001,
+3.562380e-001, 3.576631e-001, 3.590848e-001, 3.605031e-001, 3.619194e-001, 3.633339e-001, 3.647470e-001, 3.661528e-001, 3.675504e-001, 3.689434e-001,
+3.703271e-001, 3.717108e-001, 3.730943e-001, 3.744777e-001, 3.758435e-001, 3.772088e-001, 3.785588e-001, 3.799039e-001, 3.812474e-001, 3.825892e-001,
+3.839282e-001, 3.852579e-001, 3.865875e-001, 3.878998e-001, 3.892105e-001, 3.905137e-001, 3.918113e-001, 3.931081e-001, 3.944021e-001, 3.956961e-001,
+3.969768e-001, 3.982539e-001, 3.995263e-001, 4.007899e-001, 4.020535e-001, 4.033162e-001, 4.045789e-001, 4.058408e-001, 4.071016e-001, 4.083623e-001,
+4.096068e-001, 4.108477e-001, 4.120868e-001, 4.133199e-001, 4.145531e-001, 4.157874e-001, 4.170223e-001, 4.182572e-001, 4.194814e-001, 4.207053e-001,
+4.219269e-001, 4.231427e-001, 4.243586e-001, 4.255750e-001, 4.267918e-001, 4.280085e-001, 4.292203e-001, 4.304311e-001, 4.316414e-001, 4.328394e-001,
+4.340375e-001, 4.352347e-001, 4.364288e-001, 4.376228e-001, 4.388134e-001, 4.399972e-001, 4.411810e-001, 4.423574e-001, 4.435240e-001, 4.446906e-001,
+4.458532e-001, 4.470113e-001, 4.481694e-001, 4.493248e-001, 4.504772e-001, 4.516297e-001, 4.527780e-001, 4.539215e-001, 4.550649e-001, 4.562053e-001,
+4.573408e-001, 4.584764e-001, 4.596097e-001, 4.607373e-001, 4.618649e-001, 4.629900e-001, 4.640981e-001, 4.652062e-001, 4.663143e-001, 4.674096e-001,
+4.685041e-001, 4.695985e-001, 4.706852e-001, 4.717685e-001, 4.728518e-001, 4.739332e-001, 4.750120e-001, 4.760907e-001, 4.771689e-001, 4.782414e-001,
+4.793138e-001, 4.803863e-001, 4.814558e-001, 4.825242e-001, 4.835925e-001, 4.846590e-001, 4.857207e-001, 4.867825e-001, 4.878443e-001, 4.888986e-001,
+4.899514e-001, 4.910042e-001, 4.920548e-001, 4.931008e-001, 4.941467e-001, 4.951926e-001, 4.962321e-001, 4.972695e-001, 4.983069e-001, 4.993440e-001,
+5.003792e-001, 5.014144e-001, 5.024496e-001, 5.034835e-001, 5.045161e-001, 5.055488e-001, 5.065814e-001, 5.076125e-001, 5.086431e-001, 5.096738e-001,
+5.107043e-001, 5.117308e-001, 5.127573e-001, 5.137839e-001, 5.148089e-001, 5.158286e-001, 5.168482e-001, 5.178679e-001, 5.188836e-001, 5.198921e-001,
+5.209006e-001, 5.219092e-001, 5.229143e-001, 5.239153e-001, 5.249162e-001, 5.259172e-001, 5.269112e-001, 5.278977e-001, 5.288842e-001, 5.298707e-001,
+5.308518e-001, 5.318266e-001, 5.328013e-001, 5.337760e-001, 5.347478e-001, 5.357149e-001, 5.366820e-001, 5.376490e-001, 5.386124e-001, 5.395649e-001,
+5.405174e-001, 5.414698e-001, 5.424215e-001, 5.433624e-001, 5.443032e-001, 5.452441e-001, 5.461850e-001, 5.471224e-001, 5.480590e-001, 5.489957e-001,
+5.499323e-001, 5.508654e-001, 5.517954e-001, 5.527254e-001, 5.536554e-001, 5.545833e-001, 5.555014e-001, 5.564194e-001, 5.573375e-001, 5.582555e-001,
+5.591752e-001, 5.600954e-001, 5.610156e-001, 5.619358e-001, 5.628547e-001, 5.637700e-001, 5.646853e-001, 5.656006e-001, 5.665159e-001, 5.674223e-001,
+5.683257e-001, 5.692290e-001, 5.701323e-001, 5.710356e-001, 5.719386e-001, 5.728415e-001, 5.737445e-001, 5.746474e-001, 5.755449e-001, 5.764363e-001,
+5.773277e-001, 5.782190e-001, 5.791104e-001, 5.799939e-001, 5.808747e-001, 5.817556e-001, 5.826364e-001, 5.835173e-001, 5.843989e-001, 5.852806e-001,
+5.861622e-001, 5.870439e-001, 5.879252e-001, 5.888039e-001, 5.896825e-001, 5.905611e-001, 5.914397e-001, 5.923171e-001, 5.931893e-001, 5.940615e-001,
+5.949337e-001, 5.958060e-001, 5.966782e-001, 5.975505e-001, 5.984228e-001, 5.992950e-001, 6.001673e-001, 6.010374e-001, 6.018946e-001, 6.027517e-001,
+6.036089e-001, 6.044661e-001, 6.053231e-001, 6.061737e-001, 6.070242e-001, 6.078748e-001, 6.087254e-001, 6.095759e-001, 6.104241e-001, 6.112718e-001,
+6.121195e-001, 6.129672e-001, 6.138149e-001, 6.146571e-001, 6.154951e-001, 6.163331e-001, 6.171712e-001, 6.180092e-001, 6.188457e-001, 6.196774e-001,
+6.205092e-001, 6.213409e-001, 6.221726e-001, 6.230043e-001, 6.238339e-001, 6.246630e-001, 6.254922e-001, 6.263213e-001, 6.271504e-001, 6.279763e-001,
+6.287960e-001, 6.296158e-001, 6.304355e-001, 6.312552e-001, 6.320749e-001, 6.328898e-001, 6.337034e-001, 6.345171e-001, 6.353307e-001, 6.361443e-001,
+6.369586e-001, 6.377763e-001, 6.385940e-001, 6.394117e-001, 6.402294e-001, 6.410471e-001, 6.418619e-001, 6.426734e-001, 6.434848e-001, 6.442962e-001,
+6.451076e-001, 6.459190e-001, 6.467270e-001, 6.475333e-001, 6.483396e-001, 6.491458e-001, 6.499521e-001, 6.507584e-001, 6.515670e-001, 6.523761e-001,
+6.531852e-001, 6.539943e-001, 6.548035e-001, 6.556126e-001, 6.564119e-001, 6.572097e-001, 6.580076e-001, 6.588054e-001, 6.596032e-001, 6.604010e-001,
+6.611962e-001, 6.619908e-001, 6.627854e-001, 6.635800e-001, 6.643746e-001, 6.651692e-001, 6.659620e-001, 6.667542e-001, 6.675464e-001, 6.683386e-001,
+6.691308e-001, 6.699230e-001, 6.707085e-001, 6.714885e-001, 6.722685e-001, 6.730485e-001, 6.738285e-001, 6.746084e-001, 6.753873e-001, 6.761631e-001,
+6.769389e-001, 6.777147e-001, 6.784905e-001, 6.792663e-001, 6.800421e-001, 6.808115e-001, 6.815804e-001, 6.823492e-001, 6.831181e-001, 6.838870e-001,
+6.846559e-001, 6.854198e-001, 6.861784e-001, 6.869370e-001, 6.876956e-001, 6.884542e-001, 6.892128e-001, 6.899714e-001, 6.907256e-001, 6.914795e-001,
+6.922335e-001, 6.929875e-001, 6.937414e-001, 6.944954e-001, 6.952433e-001, 6.959792e-001, 6.967151e-001, 6.974510e-001, 6.981869e-001, 6.989227e-001,
+6.996586e-001, 7.003878e-001, 7.011129e-001, 7.018380e-001, 7.025631e-001, 7.032881e-001, 7.040132e-001, 7.047383e-001, 7.054607e-001, 7.061825e-001,
+7.069043e-001, 7.076261e-001, 7.083479e-001, 7.090697e-001, 7.097915e-001, 7.105046e-001, 7.112171e-001, 7.119296e-001, 7.126420e-001, 7.133545e-001,
+7.140670e-001, 7.147795e-001, 7.154845e-001, 7.161890e-001, 7.168935e-001, 7.175981e-001, 7.183026e-001, 7.190071e-001, 7.197117e-001, 7.204123e-001,
+7.211123e-001, 7.218122e-001, 7.225122e-001, 7.232122e-001, 7.239122e-001, 7.246122e-001, 7.253113e-001, 7.260101e-001, 7.267090e-001, 7.274078e-001,
+7.281066e-001, 7.288054e-001, 7.295042e-001, 7.302009e-001, 7.308946e-001, 7.315883e-001, 7.322820e-001, 7.329757e-001, 7.336694e-001, 7.343632e-001,
+7.350567e-001, 7.357468e-001, 7.364368e-001, 7.371269e-001, 7.378169e-001, 7.385070e-001, 7.391970e-001, 7.398871e-001, 7.405749e-001, 7.412611e-001,
+7.419473e-001, 7.426335e-001, 7.433197e-001, 7.440059e-001, 7.446921e-001, 7.453783e-001, 7.460604e-001, 7.467426e-001, 7.474247e-001, 7.481068e-001,
+7.487889e-001, 7.494711e-001, 7.501532e-001, 7.508333e-001, 7.515090e-001, 7.521848e-001, 7.528605e-001, 7.535362e-001, 7.542120e-001, 7.548877e-001,
+7.555634e-001, 7.562360e-001, 7.569059e-001, 7.575758e-001, 7.582457e-001, 7.589156e-001, 7.595855e-001, 7.602554e-001, 7.609253e-001, 7.615933e-001,
+7.622604e-001, 7.629275e-001, 7.635946e-001, 7.642617e-001, 7.649288e-001, 7.655959e-001, 7.662630e-001, 7.669282e-001, 7.675923e-001, 7.682564e-001,
+7.689205e-001, 7.695846e-001, 7.702487e-001, 7.709128e-001, 7.715769e-001, 7.722385e-001, 7.728980e-001, 7.735575e-001, 7.742169e-001, 7.748764e-001,
+7.755359e-001, 7.761954e-001, 7.768549e-001, 7.775127e-001, 7.781673e-001, 7.788219e-001, 7.794766e-001, 7.801312e-001, 7.807858e-001, 7.814404e-001,
+7.820950e-001, 7.827495e-001, 7.833991e-001, 7.840487e-001, 7.846983e-001, 7.853479e-001, 7.859974e-001, 7.866470e-001, 7.872966e-001, 7.879462e-001,
+7.885927e-001, 7.892370e-001, 7.898813e-001, 7.905256e-001, 7.911699e-001, 7.918142e-001, 7.924585e-001, 7.931028e-001, 7.937468e-001, 7.943842e-001,
+7.950216e-001, 7.956590e-001, 7.962964e-001, 7.969338e-001, 7.975712e-001, 7.982086e-001, 7.988460e-001, 7.994801e-001, 8.001087e-001, 8.007372e-001,
+8.013657e-001, 8.019942e-001, 8.026228e-001, 8.032513e-001, 8.038798e-001, 8.045083e-001, 8.051316e-001, 8.057510e-001, 8.063704e-001, 8.069898e-001,
+8.076092e-001, 8.082286e-001, 8.088480e-001, 8.094674e-001, 8.100868e-001, 8.107039e-001, 8.113199e-001, 8.119359e-001, 8.125519e-001, 8.131679e-001,
+8.137839e-001, 8.143999e-001, 8.150159e-001, 8.156319e-001, 8.162443e-001, 8.168547e-001, 8.174652e-001, 8.180756e-001, 8.186861e-001, 8.192965e-001,
+8.199069e-001, 8.205174e-001, 8.211278e-001, 8.217354e-001, 8.223400e-001, 8.229447e-001, 8.235493e-001, 8.241540e-001, 8.247586e-001, 8.253633e-001,
+8.259679e-001, 8.265726e-001, 8.271761e-001, 8.277756e-001, 8.283752e-001, 8.289748e-001, 8.295743e-001, 8.301739e-001, 8.307734e-001, 8.313730e-001,
+8.319726e-001, 8.325721e-001, 8.331714e-001, 8.337706e-001, 8.343698e-001, 8.349689e-001, 8.355681e-001, 8.361673e-001, 8.367665e-001, 8.373657e-001,
+8.379649e-001, 8.385624e-001, 8.391563e-001, 8.397502e-001, 8.403440e-001, 8.409379e-001, 8.415317e-001, 8.421256e-001, 8.427194e-001, 8.433133e-001,
+8.439071e-001, 8.444991e-001, 8.450900e-001, 8.456809e-001, 8.462718e-001, 8.468627e-001, 8.474537e-001, 8.480446e-001, 8.486355e-001, 8.492264e-001,
+8.498173e-001, 8.504028e-001, 8.509874e-001, 8.515720e-001, 8.521566e-001, 8.527412e-001, 8.533258e-001, 8.539104e-001, 8.544950e-001, 8.550797e-001,
+8.556643e-001, 8.562449e-001, 8.568253e-001, 8.574056e-001, 8.579860e-001, 8.585664e-001, 8.591468e-001, 8.597272e-001, 8.603076e-001, 8.608880e-001,
+8.614684e-001, 8.620395e-001, 8.626096e-001, 8.631796e-001, 8.637497e-001, 8.643197e-001, 8.648898e-001, 8.654598e-001, 8.660299e-001, 8.665999e-001,
+8.671700e-001, 8.677338e-001, 8.682952e-001, 8.688565e-001, 8.694179e-001, 8.699792e-001, 8.705405e-001, 8.711019e-001, 8.716632e-001, 8.722246e-001,
+8.727859e-001, 8.733474e-001, 8.739092e-001, 8.744710e-001, 8.750328e-001, 8.755947e-001, 8.761565e-001, 8.767183e-001, 8.772801e-001, 8.778419e-001,
+8.784037e-001, 8.789655e-001, 8.795219e-001, 8.800778e-001, 8.806338e-001, 8.811897e-001, 8.817456e-001, 8.823016e-001, 8.828575e-001, 8.834134e-001,
+8.839693e-001, 8.845253e-001, 8.850800e-001, 8.856321e-001, 8.861841e-001, 8.867361e-001, 8.872882e-001, 8.878402e-001, 8.883923e-001, 8.889443e-001,
+8.894964e-001, 8.900484e-001, 8.906005e-001, 8.911524e-001, 8.917043e-001, 8.922562e-001, 8.928080e-001, 8.933599e-001, 8.939118e-001, 8.944637e-001,
+8.950156e-001, 8.955674e-001, 8.961193e-001, 8.966712e-001, 8.972207e-001, 8.977689e-001, 8.983171e-001, 8.988653e-001, 8.994135e-001, 8.999617e-001,
+9.005098e-001, 9.010580e-001, 9.016062e-001, 9.021544e-001, 9.027026e-001, 9.032500e-001, 9.037967e-001, 9.043435e-001, 9.048902e-001, 9.054370e-001,
+9.059837e-001, 9.065305e-001, 9.070772e-001, 9.076240e-001, 9.081707e-001, 9.087175e-001, 9.092611e-001, 9.098003e-001, 9.103395e-001, 9.108787e-001,
+9.114179e-001, 9.119571e-001, 9.124963e-001, 9.130355e-001, 9.135747e-001, 9.141139e-001, 9.146531e-001, 9.151920e-001, 9.157255e-001, 9.162590e-001,
+9.167926e-001, 9.173261e-001, 9.178597e-001, 9.183932e-001, 9.189267e-001, 9.194603e-001, 9.199938e-001, 9.205273e-001, 9.210609e-001, 9.215934e-001,
+9.221250e-001, 9.226566e-001, 9.231882e-001, 9.237199e-001, 9.242515e-001, 9.247831e-001, 9.253148e-001, 9.258464e-001, 9.263780e-001, 9.269096e-001,
+9.274413e-001, 9.279669e-001, 9.284919e-001, 9.290169e-001, 9.295418e-001, 9.300668e-001, 9.305917e-001, 9.311167e-001, 9.316417e-001, 9.321666e-001,
+9.326916e-001, 9.332166e-001, 9.337409e-001, 9.342573e-001, 9.347737e-001, 9.352902e-001, 9.358066e-001, 9.363230e-001, 9.368394e-001, 9.373559e-001,
+9.378723e-001, 9.383887e-001, 9.389051e-001, 9.394216e-001, 9.399372e-001, 9.404459e-001, 9.409546e-001, 9.414632e-001, 9.419719e-001, 9.424806e-001,
+9.429892e-001, 9.434979e-001, 9.440066e-001, 9.445152e-001, 9.450239e-001, 9.455326e-001, 9.460412e-001, 9.465460e-001, 9.470506e-001, 9.475552e-001,
+9.480598e-001, 9.485644e-001, 9.490690e-001, 9.495735e-001, 9.500781e-001, 9.505827e-001, 9.510873e-001, 9.515919e-001, 9.520965e-001, 9.525997e-001,
+9.531021e-001, 9.536045e-001, 9.541069e-001, 9.546093e-001, 9.551117e-001, 9.556141e-001, 9.561165e-001, 9.566189e-001, 9.571214e-001, 9.576238e-001,
+9.581262e-001, 9.586273e-001, 9.591223e-001, 9.596173e-001, 9.601123e-001, 9.606073e-001, 9.611024e-001, 9.615974e-001, 9.620924e-001, 9.625874e-001,
+9.630825e-001, 9.635775e-001, 9.640725e-001, 9.645675e-001, 9.650583e-001, 9.655455e-001, 9.660326e-001, 9.665198e-001, 9.670069e-001, 9.674941e-001,
+9.679812e-001, 9.684684e-001, 9.689556e-001, 9.694427e-001, 9.699299e-001, 9.704170e-001, 9.709042e-001, 9.713830e-001, 9.718586e-001, 9.723342e-001,
+9.728098e-001, 9.732854e-001, 9.737610e-001, 9.742366e-001, 9.747122e-001, 9.751878e-001, 9.756634e-001, 9.761390e-001, 9.766146e-001, 9.770902e-001,
+9.775533e-001, 9.780119e-001, 9.784705e-001, 9.789291e-001, 9.793877e-001, 9.798463e-001, 9.803049e-001, 9.807635e-001, 9.812220e-001, 9.816806e-001,
+9.821392e-001, 9.825978e-001, 9.830564e-001, 9.835022e-001, 9.839385e-001, 9.843747e-001, 9.848110e-001, 9.852473e-001, 9.856835e-001, 9.861198e-001,
+9.865561e-001, 9.869923e-001, 9.874286e-001, 9.878648e-001, 9.883011e-001, 9.887374e-001, 9.891687e-001, 9.895836e-001, 9.899986e-001, 9.904135e-001,
+9.908285e-001, 9.912434e-001, 9.916583e-001, 9.920733e-001, 9.924882e-001, 9.929031e-001, 9.933181e-001, 9.937330e-001, 9.941480e-001, 9.945629e-001,
+9.949586e-001, 9.953464e-001, 9.957342e-001, 9.961220e-001, 9.965098e-001, 9.968976e-001, 9.972854e-001, 9.976732e-001, 9.980610e-001, 9.984488e-001,
+9.988366e-001, 9.992244e-001, 9.996122e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.580352e-003, 1.105539e-002, 1.609104e-002, 2.081013e-002, 2.519410e-002, 2.935686e-002, 3.335899e-002, 3.717921e-002, 4.087268e-002,
+4.444364e-002, 4.794319e-002, 5.133597e-002, 5.463981e-002, 5.787732e-002, 6.105990e-002, 6.416416e-002, 6.723220e-002, 7.025274e-002, 7.320088e-002,
+7.609661e-002, 7.895779e-002, 8.178044e-002, 8.457612e-002, 8.731357e-002, 9.001950e-002, 9.268945e-002, 9.533145e-002, 9.795235e-002, 1.005545e-001,
+1.031209e-001, 1.056765e-001, 1.081990e-001, 1.106970e-001, 1.131802e-001, 1.156401e-001, 1.180798e-001, 1.204817e-001, 1.228762e-001, 1.252496e-001,
+1.275875e-001, 1.299160e-001, 1.322304e-001, 1.345029e-001, 1.367423e-001, 1.389641e-001, 1.411608e-001, 1.433495e-001, 1.455026e-001, 1.476328e-001,
+1.497653e-001, 1.519078e-001, 1.540308e-001, 1.561508e-001, 1.582663e-001, 1.603844e-001, 1.624784e-001, 1.645596e-001, 1.666203e-001, 1.686652e-001,
+1.706996e-001, 1.727279e-001, 1.747494e-001, 1.767428e-001, 1.787130e-001, 1.806746e-001, 1.826315e-001, 1.845801e-001, 1.865083e-001, 1.884185e-001,
+1.903172e-001, 1.922023e-001, 1.940843e-001, 1.959476e-001, 1.977925e-001, 1.996293e-001, 2.014591e-001, 2.032801e-001, 2.050863e-001, 2.068803e-001,
+2.086674e-001, 2.104519e-001, 2.122324e-001, 2.140040e-001, 2.157680e-001, 2.175332e-001, 2.192888e-001, 2.210365e-001, 2.227812e-001, 2.245233e-001,
+2.262615e-001, 2.279943e-001, 2.297101e-001, 2.314117e-001, 2.331091e-001, 2.348041e-001, 2.364936e-001, 2.381703e-001, 2.398330e-001, 2.414874e-001,
+2.431396e-001, 2.447883e-001, 2.464287e-001, 2.480624e-001, 2.496916e-001, 2.513076e-001, 2.529130e-001, 2.545063e-001, 2.560915e-001, 2.576715e-001,
+2.592465e-001, 2.608287e-001, 2.624095e-001, 2.639889e-001, 2.655548e-001, 2.671144e-001, 2.686660e-001, 2.702148e-001, 2.717639e-001, 2.733153e-001,
+2.748562e-001, 2.763911e-001, 2.779105e-001, 2.794237e-001, 2.809271e-001, 2.824263e-001, 2.839239e-001, 2.854253e-001, 2.869232e-001, 2.884125e-001,
+2.898919e-001, 2.913635e-001, 2.928243e-001, 2.942823e-001, 2.957330e-001, 2.971836e-001, 2.986335e-001, 3.000814e-001, 3.015252e-001, 3.029659e-001,
+3.044033e-001, 3.058296e-001, 3.072483e-001, 3.086609e-001, 3.100705e-001, 3.114804e-001, 3.128905e-001, 3.143031e-001, 3.157165e-001, 3.171201e-001,
+3.185209e-001, 3.199111e-001, 3.212977e-001, 3.226789e-001, 3.240577e-001, 3.254355e-001, 3.268128e-001, 3.281848e-001, 3.295520e-001, 3.309171e-001,
+3.322787e-001, 3.336371e-001, 3.349849e-001, 3.363323e-001, 3.376723e-001, 3.390123e-001, 3.403487e-001, 3.416842e-001, 3.430136e-001, 3.443384e-001,
+3.456582e-001, 3.469654e-001, 3.482726e-001, 3.495656e-001, 3.508581e-001, 3.521454e-001, 3.534296e-001, 3.547121e-001, 3.559896e-001, 3.572671e-001,
+3.585371e-001, 3.598057e-001, 3.610734e-001, 3.623399e-001, 3.636064e-001, 3.648683e-001, 3.661298e-001, 3.673880e-001, 3.686418e-001, 3.698956e-001,
+3.711367e-001, 3.723761e-001, 3.736143e-001, 3.748500e-001, 3.760858e-001, 3.773152e-001, 3.785418e-001, 3.797681e-001, 3.809859e-001, 3.822037e-001,
+3.834176e-001, 3.846245e-001, 3.858315e-001, 3.870329e-001, 3.882313e-001, 3.894298e-001, 3.906226e-001, 3.918148e-001, 3.930067e-001, 3.941971e-001,
+3.953875e-001, 3.965759e-001, 3.977586e-001, 3.989412e-001, 4.001224e-001, 4.013011e-001, 4.024798e-001, 4.036576e-001, 4.048345e-001, 4.060113e-001,
+4.071837e-001, 4.083524e-001, 4.095211e-001, 4.106840e-001, 4.118421e-001, 4.130003e-001, 4.141499e-001, 4.152917e-001, 4.164334e-001, 4.175725e-001,
+4.187081e-001, 4.198437e-001, 4.209781e-001, 4.221100e-001, 4.232420e-001, 4.243740e-001, 4.255063e-001, 4.266387e-001, 4.277710e-001, 4.288952e-001,
+4.300193e-001, 4.311434e-001, 4.322607e-001, 4.333757e-001, 4.344907e-001, 4.356062e-001, 4.367220e-001, 4.378379e-001, 4.389532e-001, 4.400649e-001,
+4.411765e-001, 4.422882e-001, 4.433947e-001, 4.444997e-001, 4.456046e-001, 4.467051e-001, 4.477971e-001, 4.488891e-001, 4.499810e-001, 4.510705e-001,
+4.521595e-001, 4.532486e-001, 4.543374e-001, 4.554259e-001, 4.565144e-001, 4.576029e-001, 4.586855e-001, 4.597668e-001, 4.608480e-001, 4.619262e-001,
+4.629919e-001, 4.640576e-001, 4.651233e-001, 4.661860e-001, 4.672460e-001, 4.683061e-001, 4.693661e-001, 4.704234e-001, 4.714801e-001, 4.725369e-001,
+4.735935e-001, 4.746482e-001, 4.757030e-001, 4.767577e-001, 4.778087e-001, 4.788492e-001, 4.798897e-001, 4.809303e-001, 4.819678e-001, 4.830011e-001,
+4.840343e-001, 4.850675e-001, 4.861019e-001, 4.871374e-001, 4.881728e-001, 4.892083e-001, 4.902406e-001, 4.912701e-001, 4.922996e-001, 4.933290e-001,
+4.943523e-001, 4.953694e-001, 4.963866e-001, 4.974038e-001, 4.984166e-001, 4.994237e-001, 5.004309e-001, 5.014380e-001, 5.024443e-001, 5.034484e-001,
+5.044525e-001, 5.054566e-001, 5.064596e-001, 5.074541e-001, 5.084485e-001, 5.094430e-001, 5.104375e-001, 5.114172e-001, 5.123948e-001, 5.133725e-001,
+5.143501e-001, 5.153220e-001, 5.162898e-001, 5.172576e-001, 5.182254e-001, 5.191931e-001, 5.201604e-001, 5.211277e-001, 5.220949e-001, 5.230622e-001,
+5.240323e-001, 5.250032e-001, 5.259740e-001, 5.269449e-001, 5.279112e-001, 5.288679e-001, 5.298247e-001, 5.307815e-001, 5.317382e-001, 5.326875e-001,
+5.336347e-001, 5.345819e-001, 5.355292e-001, 5.364758e-001, 5.374201e-001, 5.383644e-001, 5.393087e-001, 5.402530e-001, 5.411960e-001, 5.421379e-001,
+5.430797e-001, 5.440215e-001, 5.449634e-001, 5.458949e-001, 5.468239e-001, 5.477528e-001, 5.486818e-001, 5.496106e-001, 5.505310e-001, 5.514513e-001,
+5.523717e-001, 5.532920e-001, 5.542124e-001, 5.551329e-001, 5.560534e-001, 5.569740e-001, 5.578945e-001, 5.588161e-001, 5.597411e-001, 5.606660e-001,
+5.615910e-001, 5.625159e-001, 5.634377e-001, 5.643500e-001, 5.652622e-001, 5.661745e-001, 5.670867e-001, 5.679974e-001, 5.689010e-001, 5.698046e-001,
+5.707082e-001, 5.716119e-001, 5.725152e-001, 5.734145e-001, 5.743138e-001, 5.752131e-001, 5.761124e-001, 5.770117e-001, 5.779047e-001, 5.787969e-001,
+5.796890e-001, 5.805811e-001, 5.814733e-001, 5.823629e-001, 5.832508e-001, 5.841388e-001, 5.850268e-001, 5.859147e-001, 5.868017e-001, 5.876859e-001,
+5.885702e-001, 5.894545e-001, 5.903387e-001, 5.912230e-001, 5.921057e-001, 5.929882e-001, 5.938707e-001, 5.947532e-001, 5.956356e-001, 5.965138e-001,
+5.973853e-001, 5.982567e-001, 5.991281e-001, 5.999996e-001, 6.008710e-001, 6.017335e-001, 6.025941e-001, 6.034547e-001, 6.043154e-001, 6.051760e-001,
+6.060352e-001, 6.068888e-001, 6.077424e-001, 6.085960e-001, 6.094496e-001, 6.103032e-001, 6.111536e-001, 6.120008e-001, 6.128481e-001, 6.136953e-001,
+6.145425e-001, 6.153897e-001, 6.162346e-001, 6.170787e-001, 6.179228e-001, 6.187668e-001, 6.196109e-001, 6.204549e-001, 6.212937e-001, 6.221314e-001,
+6.229692e-001, 6.238070e-001, 6.246448e-001, 6.254826e-001, 6.263144e-001, 6.271456e-001, 6.279768e-001, 6.288080e-001, 6.296392e-001, 6.304704e-001,
+6.312931e-001, 6.321147e-001, 6.329363e-001, 6.337578e-001, 6.345794e-001, 6.354010e-001, 6.362180e-001, 6.370336e-001, 6.378493e-001, 6.386650e-001,
+6.394807e-001, 6.402963e-001, 6.411076e-001, 6.419158e-001, 6.427240e-001, 6.435321e-001, 6.443403e-001, 6.451485e-001, 6.459537e-001, 6.467526e-001,
+6.475514e-001, 6.483503e-001, 6.491491e-001, 6.499480e-001, 6.507468e-001, 6.515397e-001, 6.523323e-001, 6.531249e-001, 6.539175e-001, 6.547101e-001,
+6.555027e-001, 6.562970e-001, 6.570927e-001, 6.578885e-001, 6.586842e-001, 6.594800e-001, 6.602758e-001, 6.610715e-001, 6.618656e-001, 6.626598e-001,
+6.634539e-001, 6.642480e-001, 6.650421e-001, 6.658362e-001, 6.666283e-001, 6.674169e-001, 6.682055e-001, 6.689941e-001, 6.697827e-001, 6.705713e-001,
+6.713599e-001, 6.721470e-001, 6.729334e-001, 6.737198e-001, 6.745061e-001, 6.752925e-001, 6.760789e-001, 6.768652e-001, 6.776457e-001, 6.784252e-001,
+6.792047e-001, 6.799843e-001, 6.807638e-001, 6.815433e-001, 6.823228e-001, 6.830922e-001, 6.838612e-001, 6.846303e-001, 6.853993e-001, 6.861683e-001,
+6.869374e-001, 6.877064e-001, 6.884680e-001, 6.892295e-001, 6.899910e-001, 6.907524e-001, 6.915139e-001, 6.922754e-001, 6.930368e-001, 6.937998e-001,
+6.945629e-001, 6.953260e-001, 6.960891e-001, 6.968522e-001, 6.976153e-001, 6.983784e-001, 6.991379e-001, 6.998960e-001, 7.006540e-001, 7.014121e-001,
+7.021702e-001, 7.029282e-001, 7.036863e-001, 7.044391e-001, 7.051852e-001, 7.059314e-001, 7.066775e-001, 7.074237e-001, 7.081698e-001, 7.089160e-001,
+7.096619e-001, 7.104053e-001, 7.111487e-001, 7.118921e-001, 7.126354e-001, 7.133788e-001, 7.141222e-001, 7.148655e-001, 7.156080e-001, 7.163498e-001,
+7.170916e-001, 7.178335e-001, 7.185753e-001, 7.193171e-001, 7.200589e-001, 7.208006e-001, 7.215342e-001, 7.222678e-001, 7.230014e-001, 7.237350e-001,
+7.244686e-001, 7.252022e-001, 7.259358e-001, 7.266669e-001, 7.273934e-001, 7.281198e-001, 7.288463e-001, 7.295727e-001, 7.302991e-001, 7.310256e-001,
+7.317520e-001, 7.324794e-001, 7.332076e-001, 7.339358e-001, 7.346640e-001, 7.353921e-001, 7.361203e-001, 7.368485e-001, 7.375766e-001, 7.383014e-001,
+7.390246e-001, 7.397478e-001, 7.404710e-001, 7.411942e-001, 7.419174e-001, 7.426406e-001, 7.433638e-001, 7.440792e-001, 7.447910e-001, 7.455028e-001,
+7.462146e-001, 7.469264e-001, 7.476382e-001, 7.483499e-001, 7.490617e-001, 7.497719e-001, 7.504810e-001, 7.511901e-001, 7.518991e-001, 7.526082e-001,
+7.533172e-001, 7.540263e-001, 7.547354e-001, 7.554432e-001, 7.561489e-001, 7.568546e-001, 7.575603e-001, 7.582660e-001, 7.589716e-001, 7.596773e-001,
+7.603830e-001, 7.610881e-001, 7.617811e-001, 7.624740e-001, 7.631670e-001, 7.638600e-001, 7.645529e-001, 7.652459e-001, 7.659388e-001, 7.666318e-001,
+7.673209e-001, 7.680077e-001, 7.686944e-001, 7.693811e-001, 7.700678e-001, 7.707546e-001, 7.714413e-001, 7.721280e-001, 7.728148e-001, 7.735019e-001,
+7.741890e-001, 7.748762e-001, 7.755633e-001, 7.762505e-001, 7.769376e-001, 7.776248e-001, 7.783119e-001, 7.789977e-001, 7.796815e-001, 7.803653e-001,
+7.810490e-001, 7.817328e-001, 7.824165e-001, 7.831003e-001, 7.837841e-001, 7.844678e-001, 7.851473e-001, 7.858239e-001, 7.865006e-001, 7.871773e-001,
+7.878539e-001, 7.885306e-001, 7.892072e-001, 7.898839e-001, 7.905605e-001, 7.912367e-001, 7.919128e-001, 7.925888e-001, 7.932648e-001, 7.939408e-001,
+7.946168e-001, 7.952928e-001, 7.959688e-001, 7.966448e-001, 7.973200e-001, 7.979947e-001, 7.986695e-001, 7.993443e-001, 8.000190e-001, 8.006938e-001,
+8.013686e-001, 8.020433e-001, 8.027181e-001, 8.033875e-001, 8.040520e-001, 8.047166e-001, 8.053812e-001, 8.060457e-001, 8.067103e-001, 8.073749e-001,
+8.080395e-001, 8.087040e-001, 8.093676e-001, 8.100282e-001, 8.106889e-001, 8.113495e-001, 8.120101e-001, 8.126708e-001, 8.133314e-001, 8.139921e-001,
+8.146527e-001, 8.153133e-001, 8.159745e-001, 8.166357e-001, 8.172969e-001, 8.179581e-001, 8.186193e-001, 8.192806e-001, 8.199418e-001, 8.206030e-001,
+8.212642e-001, 8.219218e-001, 8.225721e-001, 8.232224e-001, 8.238726e-001, 8.245229e-001, 8.251732e-001, 8.258235e-001, 8.264737e-001, 8.271240e-001,
+8.277743e-001, 8.284201e-001, 8.290639e-001, 8.297077e-001, 8.303515e-001, 8.309952e-001, 8.316390e-001, 8.322828e-001, 8.329265e-001, 8.335703e-001,
+8.342141e-001, 8.348590e-001, 8.355042e-001, 8.361493e-001, 8.367944e-001, 8.374395e-001, 8.380846e-001, 8.387297e-001, 8.393749e-001, 8.400200e-001,
+8.406651e-001, 8.413108e-001, 8.419565e-001, 8.426023e-001, 8.432480e-001, 8.438937e-001, 8.445394e-001, 8.451852e-001, 8.458309e-001, 8.464766e-001,
+8.471223e-001, 8.477608e-001, 8.483986e-001, 8.490364e-001, 8.496742e-001, 8.503120e-001, 8.509499e-001, 8.515877e-001, 8.522255e-001, 8.528633e-001,
+8.535011e-001, 8.541375e-001, 8.547734e-001, 8.554093e-001, 8.560452e-001, 8.566811e-001, 8.573170e-001, 8.579529e-001, 8.585888e-001, 8.592246e-001,
+8.598605e-001, 8.604974e-001, 8.611357e-001, 8.617741e-001, 8.624124e-001, 8.630507e-001, 8.636891e-001, 8.643274e-001, 8.649657e-001, 8.656041e-001,
+8.662424e-001, 8.668807e-001, 8.675111e-001, 8.681410e-001, 8.687708e-001, 8.694006e-001, 8.700305e-001, 8.706603e-001, 8.712901e-001, 8.719199e-001,
+8.725498e-001, 8.731796e-001, 8.738080e-001, 8.744335e-001, 8.750590e-001, 8.756845e-001, 8.763100e-001, 8.769355e-001, 8.775610e-001, 8.781865e-001,
+8.788120e-001, 8.794375e-001, 8.800630e-001, 8.806903e-001, 8.813189e-001, 8.819475e-001, 8.825762e-001, 8.832048e-001, 8.838335e-001, 8.844621e-001,
+8.850907e-001, 8.857194e-001, 8.863480e-001, 8.869767e-001, 8.876036e-001, 8.882298e-001, 8.888559e-001, 8.894820e-001, 8.901082e-001, 8.907343e-001,
+8.913604e-001, 8.919866e-001, 8.926127e-001, 8.932388e-001, 8.938650e-001, 8.944862e-001, 8.951045e-001, 8.957228e-001, 8.963411e-001, 8.969594e-001,
+8.975777e-001, 8.981959e-001, 8.988142e-001, 8.994325e-001, 9.000508e-001, 9.006691e-001, 9.012865e-001, 9.019028e-001, 9.025191e-001, 9.031354e-001,
+9.037517e-001, 9.043680e-001, 9.049842e-001, 9.056005e-001, 9.062168e-001, 9.068331e-001, 9.074494e-001, 9.080653e-001, 9.086764e-001, 9.092875e-001,
+9.098986e-001, 9.105097e-001, 9.111208e-001, 9.117319e-001, 9.123430e-001, 9.129541e-001, 9.135652e-001, 9.141763e-001, 9.147874e-001, 9.153928e-001,
+9.159939e-001, 9.165950e-001, 9.171960e-001, 9.177971e-001, 9.183982e-001, 9.189993e-001, 9.196004e-001, 9.202014e-001, 9.208025e-001, 9.214036e-001,
+9.220047e-001, 9.225972e-001, 9.231889e-001, 9.237805e-001, 9.243722e-001, 9.249638e-001, 9.255555e-001, 9.261471e-001, 9.267388e-001, 9.273304e-001,
+9.279221e-001, 9.285137e-001, 9.291048e-001, 9.296893e-001, 9.302739e-001, 9.308585e-001, 9.314430e-001, 9.320276e-001, 9.326122e-001, 9.331967e-001,
+9.337813e-001, 9.343659e-001, 9.349504e-001, 9.355350e-001, 9.361184e-001, 9.366926e-001, 9.372667e-001, 9.378408e-001, 9.384149e-001, 9.389890e-001,
+9.395631e-001, 9.401373e-001, 9.407114e-001, 9.412855e-001, 9.418596e-001, 9.424337e-001, 9.430078e-001, 9.435729e-001, 9.441376e-001, 9.447023e-001,
+9.452671e-001, 9.458318e-001, 9.463965e-001, 9.469612e-001, 9.475260e-001, 9.480907e-001, 9.486554e-001, 9.492201e-001, 9.497849e-001, 9.503433e-001,
+9.508985e-001, 9.514538e-001, 9.520090e-001, 9.525642e-001, 9.531194e-001, 9.536747e-001, 9.542299e-001, 9.547851e-001, 9.553403e-001, 9.558955e-001,
+9.564508e-001, 9.570031e-001, 9.575428e-001, 9.580824e-001, 9.586221e-001, 9.591618e-001, 9.597014e-001, 9.602411e-001, 9.607808e-001, 9.613204e-001,
+9.618601e-001, 9.623998e-001, 9.629394e-001, 9.634791e-001, 9.640105e-001, 9.645350e-001, 9.650595e-001, 9.655840e-001, 9.661085e-001, 9.666330e-001,
+9.671575e-001, 9.676819e-001, 9.682064e-001, 9.687309e-001, 9.692554e-001, 9.697799e-001, 9.703044e-001, 9.708178e-001, 9.713272e-001, 9.718365e-001,
+9.723458e-001, 9.728551e-001, 9.733645e-001, 9.738738e-001, 9.743831e-001, 9.748925e-001, 9.754018e-001, 9.759111e-001, 9.764205e-001, 9.769298e-001,
+9.774207e-001, 9.779050e-001, 9.783894e-001, 9.788738e-001, 9.793582e-001, 9.798425e-001, 9.803269e-001, 9.808113e-001, 9.812957e-001, 9.817801e-001,
+9.822644e-001, 9.827488e-001, 9.832332e-001, 9.837002e-001, 9.841543e-001, 9.846085e-001, 9.850626e-001, 9.855168e-001, 9.859709e-001, 9.864251e-001,
+9.868792e-001, 9.873334e-001, 9.877875e-001, 9.882417e-001, 9.886958e-001, 9.891500e-001, 9.895962e-001, 9.900164e-001, 9.904366e-001, 9.908568e-001,
+9.912770e-001, 9.916971e-001, 9.921173e-001, 9.925375e-001, 9.929577e-001, 9.933779e-001, 9.937981e-001, 9.942183e-001, 9.946384e-001, 9.950586e-001,
+9.954302e-001, 9.957817e-001, 9.961332e-001, 9.964848e-001, 9.968363e-001, 9.971878e-001, 9.975393e-001, 9.978909e-001, 9.982424e-001, 9.985939e-001,
+9.989454e-001, 9.992970e-001, 9.996485e-001, 1.000000e+000)),
+("Kodak", "Portra 100T", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.888989e-003, 1.552804e-002, 2.232596e-002, 2.828479e-002, 3.380224e-002, 3.874094e-002, 4.348680e-002, 4.793486e-002, 5.212500e-002,
+5.609299e-002, 5.990006e-002, 6.363959e-002, 6.730734e-002, 7.086746e-002, 7.429417e-002, 7.761541e-002, 8.085183e-002, 8.401196e-002, 8.706101e-002,
+9.003574e-002, 9.295803e-002, 9.583469e-002, 9.865438e-002, 1.014281e-001, 1.041440e-001, 1.068262e-001, 1.094704e-001, 1.121027e-001, 1.147301e-001,
+1.173269e-001, 1.198855e-001, 1.224001e-001, 1.248695e-001, 1.273150e-001, 1.297476e-001, 1.321359e-001, 1.344796e-001, 1.368042e-001, 1.391020e-001,
+1.413698e-001, 1.435929e-001, 1.457893e-001, 1.479541e-001, 1.501048e-001, 1.522225e-001, 1.543389e-001, 1.564363e-001, 1.585175e-001, 1.605857e-001,
+1.626347e-001, 1.646862e-001, 1.667336e-001, 1.687652e-001, 1.707781e-001, 1.727760e-001, 1.747659e-001, 1.767491e-001, 1.787373e-001, 1.807080e-001,
+1.826651e-001, 1.846059e-001, 1.865196e-001, 1.884177e-001, 1.903073e-001, 1.921797e-001, 1.940303e-001, 1.958549e-001, 1.976683e-001, 1.994696e-001,
+2.012577e-001, 2.030259e-001, 2.047819e-001, 2.065177e-001, 2.082249e-001, 2.099236e-001, 2.116315e-001, 2.133347e-001, 2.150184e-001, 2.167020e-001,
+2.183800e-001, 2.200523e-001, 2.217144e-001, 2.233763e-001, 2.250375e-001, 2.266879e-001, 2.283223e-001, 2.299541e-001, 2.315769e-001, 2.331924e-001,
+2.347973e-001, 2.363963e-001, 2.379969e-001, 2.395913e-001, 2.411746e-001, 2.427513e-001, 2.443211e-001, 2.458810e-001, 2.474321e-001, 2.489771e-001,
+2.505179e-001, 2.520565e-001, 2.535842e-001, 2.551011e-001, 2.566075e-001, 2.581019e-001, 2.595994e-001, 2.610980e-001, 2.625960e-001, 2.640934e-001,
+2.655884e-001, 2.670783e-001, 2.685579e-001, 2.700324e-001, 2.715004e-001, 2.729619e-001, 2.744210e-001, 2.758784e-001, 2.773306e-001, 2.787795e-001,
+2.802198e-001, 2.816554e-001, 2.830832e-001, 2.845052e-001, 2.859246e-001, 2.873364e-001, 2.887467e-001, 2.901544e-001, 2.915566e-001, 2.929558e-001,
+2.943512e-001, 2.957447e-001, 2.971296e-001, 2.985080e-001, 2.998743e-001, 3.012338e-001, 3.025875e-001, 3.039327e-001, 3.052745e-001, 3.066090e-001,
+3.079421e-001, 3.092617e-001, 3.105808e-001, 3.119010e-001, 3.132201e-001, 3.145304e-001, 3.158377e-001, 3.171265e-001, 3.184145e-001, 3.196973e-001,
+3.209799e-001, 3.222614e-001, 3.235424e-001, 3.248171e-001, 3.260918e-001, 3.273518e-001, 3.286118e-001, 3.298719e-001, 3.311320e-001, 3.323861e-001,
+3.336384e-001, 3.348826e-001, 3.361216e-001, 3.373571e-001, 3.385878e-001, 3.398197e-001, 3.410564e-001, 3.422931e-001, 3.435252e-001, 3.447571e-001,
+3.459788e-001, 3.471955e-001, 3.484120e-001, 3.496277e-001, 3.508433e-001, 3.520530e-001, 3.532628e-001, 3.544704e-001, 3.556770e-001, 3.568830e-001,
+3.580872e-001, 3.592914e-001, 3.604977e-001, 3.617045e-001, 3.629098e-001, 3.641118e-001, 3.653139e-001, 3.665079e-001, 3.677002e-001, 3.688908e-001,
+3.700769e-001, 3.712631e-001, 3.724423e-001, 3.736186e-001, 3.747946e-001, 3.759673e-001, 3.771401e-001, 3.783135e-001, 3.794879e-001, 3.806622e-001,
+3.818334e-001, 3.830037e-001, 3.841735e-001, 3.853363e-001, 3.864991e-001, 3.876604e-001, 3.888185e-001, 3.899766e-001, 3.911325e-001, 3.922863e-001,
+3.934401e-001, 3.945881e-001, 3.957334e-001, 3.968786e-001, 3.980174e-001, 3.991548e-001, 4.002922e-001, 4.014248e-001, 4.025570e-001, 4.036893e-001,
+4.048125e-001, 4.059354e-001, 4.070583e-001, 4.081676e-001, 4.092766e-001, 4.103857e-001, 4.114841e-001, 4.125821e-001, 4.136800e-001, 4.147689e-001,
+4.158566e-001, 4.169443e-001, 4.180272e-001, 4.191087e-001, 4.201902e-001, 4.212688e-001, 4.223457e-001, 4.234225e-001, 4.244935e-001, 4.255565e-001,
+4.266195e-001, 4.276801e-001, 4.287302e-001, 4.297803e-001, 4.308304e-001, 4.318736e-001, 4.329162e-001, 4.339587e-001, 4.349972e-001, 4.360328e-001,
+4.370685e-001, 4.381031e-001, 4.391340e-001, 4.401649e-001, 4.411959e-001, 4.422194e-001, 4.432411e-001, 4.442627e-001, 4.452854e-001, 4.463103e-001,
+4.473351e-001, 4.483599e-001, 4.493798e-001, 4.503986e-001, 4.514174e-001, 4.524324e-001, 4.534362e-001, 4.544400e-001, 4.554438e-001, 4.564459e-001,
+4.574469e-001, 4.584480e-001, 4.594491e-001, 4.604510e-001, 4.614530e-001, 4.624550e-001, 4.634560e-001, 4.644544e-001, 4.654527e-001, 4.664511e-001,
+4.674444e-001, 4.684333e-001, 4.694221e-001, 4.704109e-001, 4.714014e-001, 4.723926e-001, 4.733838e-001, 4.743750e-001, 4.753604e-001, 4.763449e-001,
+4.773294e-001, 4.783139e-001, 4.792842e-001, 4.802537e-001, 4.812233e-001, 4.821928e-001, 4.831588e-001, 4.841247e-001, 4.850907e-001, 4.860566e-001,
+4.870224e-001, 4.879881e-001, 4.889539e-001, 4.899196e-001, 4.908815e-001, 4.918430e-001, 4.928044e-001, 4.937659e-001, 4.947195e-001, 4.956708e-001,
+4.966220e-001, 4.975733e-001, 4.985211e-001, 4.994663e-001, 5.004115e-001, 5.013567e-001, 5.022984e-001, 5.032334e-001, 5.041683e-001, 5.051033e-001,
+5.060375e-001, 5.069562e-001, 5.078749e-001, 5.087935e-001, 5.097122e-001, 5.106272e-001, 5.115405e-001, 5.124537e-001, 5.133670e-001, 5.142818e-001,
+5.152005e-001, 5.161192e-001, 5.170379e-001, 5.179566e-001, 5.188749e-001, 5.197930e-001, 5.207112e-001, 5.216294e-001, 5.225464e-001, 5.234599e-001,
+5.243734e-001, 5.252868e-001, 5.262003e-001, 5.271134e-001, 5.280262e-001, 5.289389e-001, 5.298517e-001, 5.307645e-001, 5.316732e-001, 5.325819e-001,
+5.334906e-001, 5.343993e-001, 5.353069e-001, 5.362116e-001, 5.371163e-001, 5.380210e-001, 5.389257e-001, 5.398266e-001, 5.407235e-001, 5.416203e-001,
+5.425171e-001, 5.434140e-001, 5.443124e-001, 5.452118e-001, 5.461112e-001, 5.470106e-001, 5.479101e-001, 5.488090e-001, 5.497077e-001, 5.506065e-001,
+5.515052e-001, 5.524039e-001, 5.533022e-001, 5.542002e-001, 5.550983e-001, 5.559964e-001, 5.568944e-001, 5.577897e-001, 5.586835e-001, 5.595773e-001,
+5.604711e-001, 5.613649e-001, 5.622547e-001, 5.631410e-001, 5.640273e-001, 5.649136e-001, 5.657998e-001, 5.666836e-001, 5.675624e-001, 5.684413e-001,
+5.693201e-001, 5.701989e-001, 5.710769e-001, 5.719450e-001, 5.728131e-001, 5.736812e-001, 5.745493e-001, 5.754174e-001, 5.762851e-001, 5.771527e-001,
+5.780203e-001, 5.788879e-001, 5.797555e-001, 5.806218e-001, 5.814854e-001, 5.823489e-001, 5.832125e-001, 5.840761e-001, 5.849397e-001, 5.858016e-001,
+5.866631e-001, 5.875247e-001, 5.883862e-001, 5.892478e-001, 5.901088e-001, 5.909687e-001, 5.918287e-001, 5.926886e-001, 5.935485e-001, 5.944084e-001,
+5.952607e-001, 5.961092e-001, 5.969577e-001, 5.978062e-001, 5.986547e-001, 5.995032e-001, 6.003429e-001, 6.011823e-001, 6.020216e-001, 6.028610e-001,
+6.037003e-001, 6.045382e-001, 6.053690e-001, 6.061998e-001, 6.070306e-001, 6.078615e-001, 6.086923e-001, 6.095214e-001, 6.103465e-001, 6.111717e-001,
+6.119969e-001, 6.128221e-001, 6.136473e-001, 6.144716e-001, 6.152944e-001, 6.161172e-001, 6.169400e-001, 6.177628e-001, 6.185857e-001, 6.194079e-001,
+6.202292e-001, 6.210505e-001, 6.218718e-001, 6.226930e-001, 6.235143e-001, 6.243357e-001, 6.251573e-001, 6.259789e-001, 6.268005e-001, 6.276221e-001,
+6.284437e-001, 6.292652e-001, 6.300834e-001, 6.309017e-001, 6.317199e-001, 6.325382e-001, 6.333565e-001, 6.341747e-001, 6.349883e-001, 6.358004e-001,
+6.366126e-001, 6.374247e-001, 6.382368e-001, 6.390490e-001, 6.398594e-001, 6.406674e-001, 6.414753e-001, 6.422833e-001, 6.430912e-001, 6.438992e-001,
+6.447071e-001, 6.455112e-001, 6.463152e-001, 6.471192e-001, 6.479231e-001, 6.487271e-001, 6.495311e-001, 6.503348e-001, 6.511383e-001, 6.519418e-001,
+6.527453e-001, 6.535488e-001, 6.543523e-001, 6.551558e-001, 6.559563e-001, 6.567561e-001, 6.575559e-001, 6.583557e-001, 6.591555e-001, 6.599553e-001,
+6.607548e-001, 6.615509e-001, 6.623470e-001, 6.631432e-001, 6.639393e-001, 6.647354e-001, 6.655315e-001, 6.663259e-001, 6.671159e-001, 6.679060e-001,
+6.686960e-001, 6.694861e-001, 6.702761e-001, 6.710662e-001, 6.718523e-001, 6.726326e-001, 6.734128e-001, 6.741931e-001, 6.749733e-001, 6.757535e-001,
+6.765338e-001, 6.773107e-001, 6.780829e-001, 6.788551e-001, 6.796273e-001, 6.803995e-001, 6.811717e-001, 6.819439e-001, 6.827138e-001, 6.834789e-001,
+6.842440e-001, 6.850091e-001, 6.857742e-001, 6.865393e-001, 6.873044e-001, 6.880689e-001, 6.888297e-001, 6.895905e-001, 6.903513e-001, 6.911121e-001,
+6.918729e-001, 6.926337e-001, 6.933945e-001, 6.941537e-001, 6.949127e-001, 6.956718e-001, 6.964308e-001, 6.971898e-001, 6.979488e-001, 6.987078e-001,
+6.994645e-001, 7.002186e-001, 7.009728e-001, 7.017270e-001, 7.024811e-001, 7.032353e-001, 7.039895e-001, 7.047435e-001, 7.054880e-001, 7.062326e-001,
+7.069771e-001, 7.077216e-001, 7.084662e-001, 7.092107e-001, 7.099553e-001, 7.106971e-001, 7.114354e-001, 7.121738e-001, 7.129122e-001, 7.136505e-001,
+7.143889e-001, 7.151273e-001, 7.158656e-001, 7.165970e-001, 7.173261e-001, 7.180553e-001, 7.187844e-001, 7.195135e-001, 7.202427e-001, 7.209718e-001,
+7.217009e-001, 7.224163e-001, 7.231313e-001, 7.238463e-001, 7.245612e-001, 7.252762e-001, 7.259912e-001, 7.267062e-001, 7.274207e-001, 7.281301e-001,
+7.288395e-001, 7.295489e-001, 7.302583e-001, 7.309677e-001, 7.316771e-001, 7.323865e-001, 7.330962e-001, 7.338085e-001, 7.345208e-001, 7.352331e-001,
+7.359454e-001, 7.366577e-001, 7.373700e-001, 7.380823e-001, 7.387946e-001, 7.395037e-001, 7.402128e-001, 7.409218e-001, 7.416308e-001, 7.423398e-001,
+7.430489e-001, 7.437579e-001, 7.444669e-001, 7.451686e-001, 7.458680e-001, 7.465673e-001, 7.472666e-001, 7.479660e-001, 7.486653e-001, 7.493646e-001,
+7.500640e-001, 7.507627e-001, 7.514608e-001, 7.521588e-001, 7.528568e-001, 7.535548e-001, 7.542528e-001, 7.549508e-001, 7.556489e-001, 7.563469e-001,
+7.570462e-001, 7.577455e-001, 7.584449e-001, 7.591442e-001, 7.598436e-001, 7.605429e-001, 7.612422e-001, 7.619416e-001, 7.626402e-001, 7.633377e-001,
+7.640352e-001, 7.647328e-001, 7.654303e-001, 7.661279e-001, 7.668254e-001, 7.675230e-001, 7.682205e-001, 7.689135e-001, 7.696050e-001, 7.702965e-001,
+7.709881e-001, 7.716796e-001, 7.723711e-001, 7.730626e-001, 7.737541e-001, 7.744456e-001, 7.751393e-001, 7.758330e-001, 7.765267e-001, 7.772204e-001,
+7.779141e-001, 7.786078e-001, 7.793015e-001, 7.799953e-001, 7.806888e-001, 7.813785e-001, 7.820682e-001, 7.827580e-001, 7.834477e-001, 7.841375e-001,
+7.848272e-001, 7.855170e-001, 7.862067e-001, 7.868963e-001, 7.875762e-001, 7.882561e-001, 7.889361e-001, 7.896160e-001, 7.902959e-001, 7.909759e-001,
+7.916558e-001, 7.923357e-001, 7.930157e-001, 7.936940e-001, 7.943721e-001, 7.950502e-001, 7.957283e-001, 7.964064e-001, 7.970845e-001, 7.977626e-001,
+7.984407e-001, 7.991188e-001, 7.997972e-001, 8.004759e-001, 8.011545e-001, 8.018332e-001, 8.025118e-001, 8.031905e-001, 8.038691e-001, 8.045478e-001,
+8.052264e-001, 8.059049e-001, 8.065828e-001, 8.072608e-001, 8.079387e-001, 8.086166e-001, 8.092945e-001, 8.099725e-001, 8.106504e-001, 8.113283e-001,
+8.120062e-001, 8.126829e-001, 8.133588e-001, 8.140347e-001, 8.147107e-001, 8.153866e-001, 8.160626e-001, 8.167385e-001, 8.174144e-001, 8.180904e-001,
+8.187663e-001, 8.194430e-001, 8.201196e-001, 8.207963e-001, 8.214729e-001, 8.221496e-001, 8.228263e-001, 8.235029e-001, 8.241796e-001, 8.248562e-001,
+8.255325e-001, 8.262074e-001, 8.268823e-001, 8.275572e-001, 8.282320e-001, 8.289069e-001, 8.295818e-001, 8.302566e-001, 8.309315e-001, 8.316064e-001,
+8.322812e-001, 8.329560e-001, 8.336307e-001, 8.343054e-001, 8.349802e-001, 8.356549e-001, 8.363296e-001, 8.370043e-001, 8.376791e-001, 8.383538e-001,
+8.390285e-001, 8.397032e-001, 8.403778e-001, 8.410525e-001, 8.417271e-001, 8.424018e-001, 8.430765e-001, 8.437511e-001, 8.444258e-001, 8.451004e-001,
+8.457751e-001, 8.464423e-001, 8.471095e-001, 8.477767e-001, 8.484439e-001, 8.491111e-001, 8.497783e-001, 8.504455e-001, 8.511127e-001, 8.517798e-001,
+8.524470e-001, 8.531115e-001, 8.537746e-001, 8.544377e-001, 8.551008e-001, 8.557639e-001, 8.564271e-001, 8.570902e-001, 8.577533e-001, 8.584164e-001,
+8.590795e-001, 8.597424e-001, 8.604044e-001, 8.610665e-001, 8.617285e-001, 8.623905e-001, 8.630526e-001, 8.637146e-001, 8.643766e-001, 8.650387e-001,
+8.657007e-001, 8.663627e-001, 8.670225e-001, 8.676806e-001, 8.683386e-001, 8.689967e-001, 8.696548e-001, 8.703128e-001, 8.709709e-001, 8.716289e-001,
+8.722870e-001, 8.729451e-001, 8.736031e-001, 8.742563e-001, 8.749082e-001, 8.755602e-001, 8.762121e-001, 8.768640e-001, 8.775160e-001, 8.781679e-001,
+8.788199e-001, 8.794718e-001, 8.801237e-001, 8.807757e-001, 8.814250e-001, 8.820741e-001, 8.827231e-001, 8.833721e-001, 8.840212e-001, 8.846702e-001,
+8.853192e-001, 8.859683e-001, 8.866173e-001, 8.872663e-001, 8.879154e-001, 8.885645e-001, 8.892137e-001, 8.898628e-001, 8.905120e-001, 8.911612e-001,
+8.918103e-001, 8.924595e-001, 8.931086e-001, 8.937578e-001, 8.944070e-001, 8.950561e-001, 8.957039e-001, 8.963508e-001, 8.969976e-001, 8.976445e-001,
+8.982914e-001, 8.989383e-001, 8.995851e-001, 9.002320e-001, 9.008789e-001, 9.015258e-001, 9.021727e-001, 9.028183e-001, 9.034605e-001, 9.041027e-001,
+9.047449e-001, 9.053872e-001, 9.060294e-001, 9.066716e-001, 9.073138e-001, 9.079560e-001, 9.085982e-001, 9.092404e-001, 9.098826e-001, 9.105214e-001,
+9.111590e-001, 9.117966e-001, 9.124342e-001, 9.130718e-001, 9.137094e-001, 9.143470e-001, 9.149846e-001, 9.156222e-001, 9.162598e-001, 9.168974e-001,
+9.175344e-001, 9.181635e-001, 9.187926e-001, 9.194217e-001, 9.200508e-001, 9.206800e-001, 9.213091e-001, 9.219382e-001, 9.225673e-001, 9.231964e-001,
+9.238255e-001, 9.244546e-001, 9.250796e-001, 9.256916e-001, 9.263037e-001, 9.269157e-001, 9.275278e-001, 9.281398e-001, 9.287518e-001, 9.293639e-001,
+9.299759e-001, 9.305880e-001, 9.312000e-001, 9.318121e-001, 9.324202e-001, 9.330167e-001, 9.336132e-001, 9.342097e-001, 9.348061e-001, 9.354026e-001,
+9.359991e-001, 9.365956e-001, 9.371921e-001, 9.377886e-001, 9.383851e-001, 9.389815e-001, 9.395771e-001, 9.401646e-001, 9.407520e-001, 9.413394e-001,
+9.419269e-001, 9.425143e-001, 9.431017e-001, 9.436892e-001, 9.442766e-001, 9.448640e-001, 9.454515e-001, 9.460389e-001, 9.466264e-001, 9.472072e-001,
+9.477861e-001, 9.483651e-001, 9.489440e-001, 9.495230e-001, 9.501019e-001, 9.506809e-001, 9.512599e-001, 9.518388e-001, 9.524178e-001, 9.529967e-001,
+9.535757e-001, 9.541511e-001, 9.547178e-001, 9.552846e-001, 9.558514e-001, 9.564182e-001, 9.569849e-001, 9.575517e-001, 9.581185e-001, 9.586853e-001,
+9.592520e-001, 9.598188e-001, 9.603856e-001, 9.609523e-001, 9.615089e-001, 9.620596e-001, 9.626103e-001, 9.631610e-001, 9.637117e-001, 9.642623e-001,
+9.648130e-001, 9.653637e-001, 9.659144e-001, 9.664651e-001, 9.670158e-001, 9.675665e-001, 9.681172e-001, 9.686547e-001, 9.691890e-001, 9.697234e-001,
+9.702578e-001, 9.707921e-001, 9.713265e-001, 9.718609e-001, 9.723952e-001, 9.729296e-001, 9.734640e-001, 9.739983e-001, 9.745327e-001, 9.750671e-001,
+9.755846e-001, 9.760981e-001, 9.766116e-001, 9.771251e-001, 9.776385e-001, 9.781520e-001, 9.786655e-001, 9.791790e-001, 9.796924e-001, 9.802059e-001,
+9.807194e-001, 9.812329e-001, 9.817463e-001, 9.822406e-001, 9.827233e-001, 9.832060e-001, 9.836887e-001, 9.841713e-001, 9.846540e-001, 9.851367e-001,
+9.856194e-001, 9.861021e-001, 9.865848e-001, 9.870674e-001, 9.875501e-001, 9.880328e-001, 9.885063e-001, 9.889545e-001, 9.894027e-001, 9.898509e-001,
+9.902991e-001, 9.907473e-001, 9.911955e-001, 9.916437e-001, 9.920919e-001, 9.925400e-001, 9.929882e-001, 9.934364e-001, 9.938846e-001, 9.943328e-001,
+9.947489e-001, 9.951529e-001, 9.955568e-001, 9.959607e-001, 9.963646e-001, 9.967686e-001, 9.971725e-001, 9.975764e-001, 9.979804e-001, 9.983843e-001,
+9.987882e-001, 9.991921e-001, 9.995961e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.290593e-003, 1.424245e-002, 2.041488e-002, 2.583454e-002, 3.082876e-002, 3.541989e-002, 3.971840e-002, 4.379579e-002, 4.770677e-002,
+5.146801e-002, 5.510498e-002, 5.855077e-002, 6.192521e-002, 6.523775e-002, 6.846345e-002, 7.158246e-002, 7.460669e-002, 7.753158e-002, 8.037113e-002,
+8.317529e-002, 8.595720e-002, 8.870650e-002, 9.141790e-002, 9.408620e-002, 9.672773e-002, 9.933223e-002, 1.018817e-001, 1.043871e-001, 1.068421e-001,
+1.092239e-001, 1.115904e-001, 1.139374e-001, 1.162880e-001, 1.186162e-001, 1.209223e-001, 1.232006e-001, 1.254397e-001, 1.276575e-001, 1.298466e-001,
+1.320065e-001, 1.341473e-001, 1.362611e-001, 1.383730e-001, 1.404493e-001, 1.425213e-001, 1.445824e-001, 1.466197e-001, 1.486462e-001, 1.506392e-001,
+1.526178e-001, 1.546076e-001, 1.565793e-001, 1.585436e-001, 1.604936e-001, 1.624073e-001, 1.643151e-001, 1.662093e-001, 1.680783e-001, 1.699372e-001,
+1.718004e-001, 1.736536e-001, 1.754879e-001, 1.773202e-001, 1.791378e-001, 1.809280e-001, 1.827086e-001, 1.844935e-001, 1.862594e-001, 1.880052e-001,
+1.897480e-001, 1.914830e-001, 1.931872e-001, 1.948740e-001, 1.965582e-001, 1.982422e-001, 1.999278e-001, 2.015965e-001, 2.032589e-001, 2.049263e-001,
+2.065898e-001, 2.082392e-001, 2.098810e-001, 2.115219e-001, 2.131509e-001, 2.147578e-001, 2.163495e-001, 2.179364e-001, 2.195289e-001, 2.211087e-001,
+2.226725e-001, 2.242245e-001, 2.257725e-001, 2.273271e-001, 2.288744e-001, 2.304067e-001, 2.319256e-001, 2.334372e-001, 2.349530e-001, 2.364765e-001,
+2.380003e-001, 2.395126e-001, 2.410166e-001, 2.425201e-001, 2.440229e-001, 2.455165e-001, 2.469966e-001, 2.484685e-001, 2.499337e-001, 2.513997e-001,
+2.528609e-001, 2.543111e-001, 2.557501e-001, 2.571833e-001, 2.586082e-001, 2.600342e-001, 2.614606e-001, 2.628875e-001, 2.643064e-001, 2.657200e-001,
+2.671194e-001, 2.685184e-001, 2.699166e-001, 2.713210e-001, 2.727270e-001, 2.741223e-001, 2.755122e-001, 2.768927e-001, 2.782716e-001, 2.796497e-001,
+2.810314e-001, 2.824106e-001, 2.837720e-001, 2.851283e-001, 2.864750e-001, 2.878204e-001, 2.891646e-001, 2.905083e-001, 2.918518e-001, 2.931913e-001,
+2.945300e-001, 2.958604e-001, 2.971901e-001, 2.985129e-001, 2.998352e-001, 3.011538e-001, 3.024721e-001, 3.037882e-001, 3.051016e-001, 3.063997e-001,
+3.076966e-001, 3.089853e-001, 3.102742e-001, 3.115651e-001, 3.128560e-001, 3.141461e-001, 3.154362e-001, 3.167093e-001, 3.179806e-001, 3.192439e-001,
+3.205048e-001, 3.217665e-001, 3.230286e-001, 3.242911e-001, 3.255540e-001, 3.268146e-001, 3.280658e-001, 3.293171e-001, 3.305567e-001, 3.317957e-001,
+3.330340e-001, 3.342721e-001, 3.355073e-001, 3.367376e-001, 3.379676e-001, 3.391882e-001, 3.404087e-001, 3.416185e-001, 3.428226e-001, 3.440254e-001,
+3.452241e-001, 3.464227e-001, 3.476234e-001, 3.488247e-001, 3.500243e-001, 3.512205e-001, 3.524167e-001, 3.536022e-001, 3.547854e-001, 3.559672e-001,
+3.571454e-001, 3.583235e-001, 3.595018e-001, 3.606802e-001, 3.618564e-001, 3.630137e-001, 3.641710e-001, 3.653210e-001, 3.664625e-001, 3.676040e-001,
+3.687413e-001, 3.698774e-001, 3.710138e-001, 3.721551e-001, 3.732963e-001, 3.744358e-001, 3.755710e-001, 3.767063e-001, 3.778327e-001, 3.789507e-001,
+3.800687e-001, 3.811819e-001, 3.822930e-001, 3.834040e-001, 3.845177e-001, 3.856320e-001, 3.867462e-001, 3.878606e-001, 3.889750e-001, 3.900894e-001,
+3.911888e-001, 3.922877e-001, 3.933865e-001, 3.944777e-001, 3.955688e-001, 3.966598e-001, 3.977529e-001, 3.988461e-001, 3.999393e-001, 4.010388e-001,
+4.021390e-001, 4.032392e-001, 4.043293e-001, 4.054166e-001, 4.065038e-001, 4.075861e-001, 4.086655e-001, 4.097449e-001, 4.108251e-001, 4.119066e-001,
+4.129881e-001, 4.140700e-001, 4.151534e-001, 4.162368e-001, 4.173202e-001, 4.183954e-001, 4.194698e-001, 4.205441e-001, 4.216129e-001, 4.226776e-001,
+4.237423e-001, 4.248071e-001, 4.258720e-001, 4.269369e-001, 4.280017e-001, 4.290624e-001, 4.301219e-001, 4.311815e-001, 4.322387e-001, 4.332911e-001,
+4.343434e-001, 4.353958e-001, 4.364374e-001, 4.374764e-001, 4.385155e-001, 4.395537e-001, 4.405891e-001, 4.416245e-001, 4.426599e-001, 4.436991e-001,
+4.447405e-001, 4.457818e-001, 4.468231e-001, 4.478600e-001, 4.488969e-001, 4.499338e-001, 4.509663e-001, 4.519883e-001, 4.530102e-001, 4.540322e-001,
+4.550513e-001, 4.560679e-001, 4.570845e-001, 4.581011e-001, 4.591206e-001, 4.601413e-001, 4.611620e-001, 4.621827e-001, 4.631980e-001, 4.642125e-001,
+4.652270e-001, 4.662415e-001, 4.672405e-001, 4.682387e-001, 4.692369e-001, 4.702351e-001, 4.712264e-001, 4.722175e-001, 4.732087e-001, 4.741999e-001,
+4.751932e-001, 4.761866e-001, 4.771799e-001, 4.781733e-001, 4.791613e-001, 4.801488e-001, 4.811362e-001, 4.821236e-001, 4.831021e-001, 4.840778e-001,
+4.850535e-001, 4.860292e-001, 4.869993e-001, 4.879654e-001, 4.889315e-001, 4.898976e-001, 4.908634e-001, 4.918288e-001, 4.927942e-001, 4.937596e-001,
+4.947250e-001, 4.956894e-001, 4.966539e-001, 4.976184e-001, 4.985829e-001, 4.995400e-001, 5.004938e-001, 5.014476e-001, 5.024013e-001, 5.033521e-001,
+5.042946e-001, 5.052371e-001, 5.061796e-001, 5.071221e-001, 5.080627e-001, 5.090027e-001, 5.099428e-001, 5.108828e-001, 5.118234e-001, 5.127655e-001,
+5.137075e-001, 5.146496e-001, 5.155917e-001, 5.165238e-001, 5.174507e-001, 5.183775e-001, 5.193044e-001, 5.202312e-001, 5.211473e-001, 5.220632e-001,
+5.229791e-001, 5.238950e-001, 5.248103e-001, 5.257238e-001, 5.266374e-001, 5.275509e-001, 5.284644e-001, 5.293798e-001, 5.302974e-001, 5.312149e-001,
+5.321325e-001, 5.330500e-001, 5.339618e-001, 5.348701e-001, 5.357784e-001, 5.366867e-001, 5.375950e-001, 5.384952e-001, 5.393918e-001, 5.402885e-001,
+5.411852e-001, 5.420819e-001, 5.429762e-001, 5.438697e-001, 5.447632e-001, 5.456567e-001, 5.465502e-001, 5.474457e-001, 5.483423e-001, 5.492389e-001,
+5.501356e-001, 5.510322e-001, 5.519236e-001, 5.528106e-001, 5.536976e-001, 5.545846e-001, 5.554716e-001, 5.563544e-001, 5.572292e-001, 5.581041e-001,
+5.589789e-001, 5.598537e-001, 5.607282e-001, 5.615992e-001, 5.624701e-001, 5.633410e-001, 5.642119e-001, 5.650828e-001, 5.659553e-001, 5.668284e-001,
+5.677015e-001, 5.685747e-001, 5.694478e-001, 5.703195e-001, 5.711885e-001, 5.720576e-001, 5.729266e-001, 5.737957e-001, 5.746647e-001, 5.755253e-001,
+5.763844e-001, 5.772435e-001, 5.781025e-001, 5.789616e-001, 5.798196e-001, 5.806747e-001, 5.815299e-001, 5.823850e-001, 5.832401e-001, 5.840953e-001,
+5.849506e-001, 5.858059e-001, 5.866612e-001, 5.875165e-001, 5.883719e-001, 5.892272e-001, 5.900742e-001, 5.909208e-001, 5.917674e-001, 5.926140e-001,
+5.934606e-001, 5.943057e-001, 5.951435e-001, 5.959813e-001, 5.968191e-001, 5.976568e-001, 5.984946e-001, 5.993314e-001, 6.001660e-001, 6.010006e-001,
+6.018351e-001, 6.026697e-001, 6.035043e-001, 6.043399e-001, 6.051772e-001, 6.060144e-001, 6.068517e-001, 6.076890e-001, 6.085263e-001, 6.093611e-001,
+6.101909e-001, 6.110207e-001, 6.118505e-001, 6.126804e-001, 6.135102e-001, 6.143385e-001, 6.151616e-001, 6.159848e-001, 6.168080e-001, 6.176311e-001,
+6.184543e-001, 6.192773e-001, 6.200963e-001, 6.209152e-001, 6.217342e-001, 6.225532e-001, 6.233722e-001, 6.241912e-001, 6.250127e-001, 6.258351e-001,
+6.266575e-001, 6.274798e-001, 6.283022e-001, 6.291245e-001, 6.299481e-001, 6.307735e-001, 6.315989e-001, 6.324243e-001, 6.332497e-001, 6.340751e-001,
+6.349005e-001, 6.357209e-001, 6.365412e-001, 6.373614e-001, 6.381816e-001, 6.390019e-001, 6.398221e-001, 6.406398e-001, 6.414540e-001, 6.422682e-001,
+6.430824e-001, 6.438967e-001, 6.447109e-001, 6.455251e-001, 6.463404e-001, 6.471559e-001, 6.479714e-001, 6.487870e-001, 6.496025e-001, 6.504180e-001,
+6.512335e-001, 6.520486e-001, 6.528638e-001, 6.536789e-001, 6.544940e-001, 6.553091e-001, 6.561243e-001, 6.569359e-001, 6.577392e-001, 6.585426e-001,
+6.593460e-001, 6.601493e-001, 6.609527e-001, 6.617560e-001, 6.625568e-001, 6.633538e-001, 6.641507e-001, 6.649477e-001, 6.657446e-001, 6.665416e-001,
+6.673386e-001, 6.681359e-001, 6.689337e-001, 6.697315e-001, 6.705293e-001, 6.713271e-001, 6.721249e-001, 6.729227e-001, 6.737202e-001, 6.745169e-001,
+6.753137e-001, 6.761105e-001, 6.769072e-001, 6.777040e-001, 6.785008e-001, 6.792957e-001, 6.800802e-001, 6.808647e-001, 6.816491e-001, 6.824336e-001,
+6.832181e-001, 6.840025e-001, 6.847870e-001, 6.855653e-001, 6.863428e-001, 6.871202e-001, 6.878976e-001, 6.886750e-001, 6.894524e-001, 6.902299e-001,
+6.910073e-001, 6.917847e-001, 6.925622e-001, 6.933396e-001, 6.941171e-001, 6.948945e-001, 6.956720e-001, 6.964493e-001, 6.972191e-001, 6.979890e-001,
+6.987588e-001, 6.995286e-001, 7.002985e-001, 7.010683e-001, 7.018381e-001, 7.026013e-001, 7.033559e-001, 7.041105e-001, 7.048651e-001, 7.056196e-001,
+7.063742e-001, 7.071288e-001, 7.078834e-001, 7.086318e-001, 7.093782e-001, 7.101245e-001, 7.108709e-001, 7.116173e-001, 7.123637e-001, 7.131101e-001,
+7.138565e-001, 7.146017e-001, 7.153468e-001, 7.160920e-001, 7.168372e-001, 7.175823e-001, 7.183275e-001, 7.190727e-001, 7.198178e-001, 7.205628e-001,
+7.213078e-001, 7.220528e-001, 7.227978e-001, 7.235428e-001, 7.242878e-001, 7.250328e-001, 7.257779e-001, 7.265240e-001, 7.272701e-001, 7.280163e-001,
+7.287624e-001, 7.295085e-001, 7.302546e-001, 7.310007e-001, 7.317468e-001, 7.324853e-001, 7.332236e-001, 7.339618e-001, 7.347001e-001, 7.354383e-001,
+7.361766e-001, 7.369149e-001, 7.376531e-001, 7.383893e-001, 7.391249e-001, 7.398604e-001, 7.405960e-001, 7.413315e-001, 7.420670e-001, 7.428026e-001,
+7.435381e-001, 7.442746e-001, 7.450124e-001, 7.457502e-001, 7.464880e-001, 7.472257e-001, 7.479635e-001, 7.487013e-001, 7.494391e-001, 7.501769e-001,
+7.509122e-001, 7.516475e-001, 7.523828e-001, 7.531181e-001, 7.538534e-001, 7.545887e-001, 7.553240e-001, 7.560593e-001, 7.567914e-001, 7.575193e-001,
+7.582471e-001, 7.589750e-001, 7.597029e-001, 7.604308e-001, 7.611586e-001, 7.618865e-001, 7.626144e-001, 7.633404e-001, 7.640657e-001, 7.647911e-001,
+7.655165e-001, 7.662419e-001, 7.669672e-001, 7.676926e-001, 7.684180e-001, 7.691434e-001, 7.698697e-001, 7.705960e-001, 7.713223e-001, 7.720487e-001,
+7.727750e-001, 7.735013e-001, 7.742277e-001, 7.749540e-001, 7.756797e-001, 7.763938e-001, 7.771079e-001, 7.778220e-001, 7.785360e-001, 7.792501e-001,
+7.799642e-001, 7.806783e-001, 7.813924e-001, 7.821063e-001, 7.828113e-001, 7.835163e-001, 7.842213e-001, 7.849263e-001, 7.856313e-001, 7.863363e-001,
+7.870413e-001, 7.877463e-001, 7.884514e-001, 7.891541e-001, 7.898566e-001, 7.905590e-001, 7.912614e-001, 7.919638e-001, 7.926663e-001, 7.933687e-001,
+7.940711e-001, 7.947735e-001, 7.954764e-001, 7.961795e-001, 7.968827e-001, 7.975858e-001, 7.982890e-001, 7.989921e-001, 7.996953e-001, 8.003984e-001,
+8.011015e-001, 8.018025e-001, 8.024935e-001, 8.031844e-001, 8.038754e-001, 8.045663e-001, 8.052573e-001, 8.059482e-001, 8.066392e-001, 8.073301e-001,
+8.080211e-001, 8.087062e-001, 8.093882e-001, 8.100702e-001, 8.107521e-001, 8.114341e-001, 8.121161e-001, 8.127981e-001, 8.134800e-001, 8.141620e-001,
+8.148440e-001, 8.155234e-001, 8.162028e-001, 8.168823e-001, 8.175617e-001, 8.182411e-001, 8.189205e-001, 8.195999e-001, 8.202794e-001, 8.209588e-001,
+8.216389e-001, 8.223221e-001, 8.230054e-001, 8.236886e-001, 8.243719e-001, 8.250551e-001, 8.257383e-001, 8.264216e-001, 8.271048e-001, 8.277881e-001,
+8.284710e-001, 8.291531e-001, 8.298351e-001, 8.305172e-001, 8.311993e-001, 8.318814e-001, 8.325635e-001, 8.332456e-001, 8.339276e-001, 8.346097e-001,
+8.352908e-001, 8.359679e-001, 8.366451e-001, 8.373222e-001, 8.379993e-001, 8.386765e-001, 8.393536e-001, 8.400307e-001, 8.407078e-001, 8.413850e-001,
+8.420621e-001, 8.427348e-001, 8.434074e-001, 8.440801e-001, 8.447527e-001, 8.454254e-001, 8.460981e-001, 8.467707e-001, 8.474434e-001, 8.481161e-001,
+8.487887e-001, 8.494626e-001, 8.501370e-001, 8.508114e-001, 8.514858e-001, 8.521602e-001, 8.528346e-001, 8.535091e-001, 8.541835e-001, 8.548579e-001,
+8.555323e-001, 8.562076e-001, 8.568869e-001, 8.575662e-001, 8.582455e-001, 8.589248e-001, 8.596040e-001, 8.602833e-001, 8.609626e-001, 8.616419e-001,
+8.623212e-001, 8.630004e-001, 8.636756e-001, 8.643475e-001, 8.650195e-001, 8.656914e-001, 8.663634e-001, 8.670354e-001, 8.677073e-001, 8.683793e-001,
+8.690512e-001, 8.697232e-001, 8.703952e-001, 8.710637e-001, 8.717314e-001, 8.723991e-001, 8.730668e-001, 8.737345e-001, 8.744023e-001, 8.750700e-001,
+8.757377e-001, 8.764054e-001, 8.770731e-001, 8.777408e-001, 8.784101e-001, 8.790796e-001, 8.797491e-001, 8.804187e-001, 8.810882e-001, 8.817577e-001,
+8.824272e-001, 8.830967e-001, 8.837662e-001, 8.844357e-001, 8.851052e-001, 8.857751e-001, 8.864450e-001, 8.871150e-001, 8.877849e-001, 8.884548e-001,
+8.891248e-001, 8.897947e-001, 8.904647e-001, 8.911346e-001, 8.918045e-001, 8.924745e-001, 8.931388e-001, 8.937997e-001, 8.944606e-001, 8.951215e-001,
+8.957824e-001, 8.964433e-001, 8.971043e-001, 8.977652e-001, 8.984261e-001, 8.990870e-001, 8.997479e-001, 9.004076e-001, 9.010637e-001, 9.017199e-001,
+9.023761e-001, 9.030323e-001, 9.036885e-001, 9.043446e-001, 9.050008e-001, 9.056570e-001, 9.063132e-001, 9.069694e-001, 9.076255e-001, 9.082816e-001,
+9.089375e-001, 9.095935e-001, 9.102495e-001, 9.109055e-001, 9.115615e-001, 9.122174e-001, 9.128734e-001, 9.135294e-001, 9.141854e-001, 9.148413e-001,
+9.154965e-001, 9.161416e-001, 9.167867e-001, 9.174318e-001, 9.180770e-001, 9.187221e-001, 9.193672e-001, 9.200123e-001, 9.206575e-001, 9.213026e-001,
+9.219477e-001, 9.225928e-001, 9.232334e-001, 9.238602e-001, 9.244870e-001, 9.251137e-001, 9.257405e-001, 9.263672e-001, 9.269940e-001, 9.276207e-001,
+9.282475e-001, 9.288743e-001, 9.295010e-001, 9.301278e-001, 9.307511e-001, 9.313645e-001, 9.319778e-001, 9.325912e-001, 9.332045e-001, 9.338178e-001,
+9.344312e-001, 9.350445e-001, 9.356579e-001, 9.362712e-001, 9.368846e-001, 9.374979e-001, 9.381105e-001, 9.387162e-001, 9.393219e-001, 9.399276e-001,
+9.405333e-001, 9.411389e-001, 9.417446e-001, 9.423503e-001, 9.429560e-001, 9.435617e-001, 9.441674e-001, 9.447731e-001, 9.453788e-001, 9.459721e-001,
+9.465620e-001, 9.471518e-001, 9.477416e-001, 9.483315e-001, 9.489213e-001, 9.495112e-001, 9.501010e-001, 9.506909e-001, 9.512807e-001, 9.518705e-001,
+9.524604e-001, 9.530453e-001, 9.536183e-001, 9.541914e-001, 9.547644e-001, 9.553375e-001, 9.559105e-001, 9.564835e-001, 9.570566e-001, 9.576296e-001,
+9.582027e-001, 9.587757e-001, 9.593487e-001, 9.599218e-001, 9.604855e-001, 9.610438e-001, 9.616021e-001, 9.621605e-001, 9.627188e-001, 9.632771e-001,
+9.638354e-001, 9.643938e-001, 9.649521e-001, 9.655104e-001, 9.660687e-001, 9.666271e-001, 9.671854e-001, 9.677324e-001, 9.682768e-001, 9.688212e-001,
+9.693655e-001, 9.699099e-001, 9.704542e-001, 9.709986e-001, 9.715429e-001, 9.720873e-001, 9.726317e-001, 9.731760e-001, 9.737204e-001, 9.742647e-001,
+9.747933e-001, 9.753181e-001, 9.758428e-001, 9.763676e-001, 9.768923e-001, 9.774171e-001, 9.779418e-001, 9.784666e-001, 9.789913e-001, 9.795161e-001,
+9.800408e-001, 9.805656e-001, 9.810903e-001, 9.815969e-001, 9.820926e-001, 9.825882e-001, 9.830839e-001, 9.835795e-001, 9.840752e-001, 9.845708e-001,
+9.850665e-001, 9.855621e-001, 9.860578e-001, 9.865534e-001, 9.870491e-001, 9.875447e-001, 9.880321e-001, 9.884965e-001, 9.889609e-001, 9.894253e-001,
+9.898897e-001, 9.903541e-001, 9.908185e-001, 9.912829e-001, 9.917473e-001, 9.922117e-001, 9.926761e-001, 9.931405e-001, 9.936049e-001, 9.940693e-001,
+9.945036e-001, 9.949264e-001, 9.953492e-001, 9.957720e-001, 9.961948e-001, 9.966176e-001, 9.970404e-001, 9.974632e-001, 9.978860e-001, 9.983088e-001,
+9.987316e-001, 9.991544e-001, 9.995772e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.783574e-003, 1.108003e-002, 1.575166e-002, 1.993565e-002, 2.380223e-002, 2.743276e-002, 3.086208e-002, 3.415658e-002, 3.735487e-002,
+4.040869e-002, 4.336539e-002, 4.623353e-002, 4.906484e-002, 5.184521e-002, 5.453563e-002, 5.713593e-002, 5.969797e-002, 6.223460e-002, 6.472895e-002,
+6.716067e-002, 6.955986e-002, 7.192151e-002, 7.425115e-002, 7.654013e-002, 7.880791e-002, 8.105119e-002, 8.326855e-002, 8.545934e-002, 8.762163e-002,
+8.975138e-002, 9.185061e-002, 9.392521e-002, 9.597722e-002, 9.801322e-002, 1.000508e-001, 1.020740e-001, 1.040984e-001, 1.060979e-001, 1.080758e-001,
+1.100342e-001, 1.119635e-001, 1.138700e-001, 1.157648e-001, 1.176468e-001, 1.195040e-001, 1.213504e-001, 1.231838e-001, 1.250088e-001, 1.268349e-001,
+1.286439e-001, 1.304429e-001, 1.322407e-001, 1.340296e-001, 1.357981e-001, 1.375523e-001, 1.393053e-001, 1.410588e-001, 1.427990e-001, 1.445256e-001,
+1.462456e-001, 1.479606e-001, 1.496646e-001, 1.513437e-001, 1.530140e-001, 1.546793e-001, 1.563451e-001, 1.580031e-001, 1.596434e-001, 1.612734e-001,
+1.628941e-001, 1.645098e-001, 1.661248e-001, 1.677244e-001, 1.693145e-001, 1.708989e-001, 1.724735e-001, 1.740392e-001, 1.755945e-001, 1.771457e-001,
+1.786844e-001, 1.802140e-001, 1.817325e-001, 1.832381e-001, 1.847354e-001, 1.862273e-001, 1.877096e-001, 1.891891e-001, 1.906654e-001, 1.921359e-001,
+1.936013e-001, 1.950621e-001, 1.965180e-001, 1.979725e-001, 1.994252e-001, 2.008765e-001, 2.023257e-001, 2.037705e-001, 2.052137e-001, 2.066581e-001,
+2.081031e-001, 2.095465e-001, 2.109802e-001, 2.124102e-001, 2.138370e-001, 2.152578e-001, 2.166766e-001, 2.180949e-001, 2.195140e-001, 2.209235e-001,
+2.223281e-001, 2.237278e-001, 2.251172e-001, 2.265006e-001, 2.278756e-001, 2.292471e-001, 2.306170e-001, 2.319861e-001, 2.333522e-001, 2.347161e-001,
+2.360663e-001, 2.374132e-001, 2.387543e-001, 2.400885e-001, 2.414194e-001, 2.427446e-001, 2.440690e-001, 2.453921e-001, 2.467114e-001, 2.480284e-001,
+2.493402e-001, 2.506507e-001, 2.519559e-001, 2.532580e-001, 2.545536e-001, 2.558461e-001, 2.571358e-001, 2.584241e-001, 2.597118e-001, 2.609947e-001,
+2.622764e-001, 2.635529e-001, 2.648288e-001, 2.660991e-001, 2.673687e-001, 2.686296e-001, 2.698899e-001, 2.711451e-001, 2.724000e-001, 2.736533e-001,
+2.749059e-001, 2.761534e-001, 2.774005e-001, 2.786424e-001, 2.798843e-001, 2.811207e-001, 2.823571e-001, 2.835854e-001, 2.848125e-001, 2.860356e-001,
+2.872572e-001, 2.884762e-001, 2.896934e-001, 2.909066e-001, 2.921139e-001, 2.933217e-001, 2.945318e-001, 2.957418e-001, 2.969468e-001, 2.981515e-001,
+2.993502e-001, 3.005459e-001, 3.017397e-001, 3.029300e-001, 3.041202e-001, 3.053085e-001, 3.064967e-001, 3.076831e-001, 3.088683e-001, 3.100539e-001,
+3.112407e-001, 3.124274e-001, 3.136095e-001, 3.147902e-001, 3.159680e-001, 3.171392e-001, 3.183103e-001, 3.194763e-001, 3.206410e-001, 3.218050e-001,
+3.229667e-001, 3.241284e-001, 3.252858e-001, 3.264413e-001, 3.275963e-001, 3.287459e-001, 3.298956e-001, 3.310426e-001, 3.321863e-001, 3.333300e-001,
+3.344664e-001, 3.356005e-001, 3.367343e-001, 3.378620e-001, 3.389898e-001, 3.401161e-001, 3.412387e-001, 3.423614e-001, 3.434791e-001, 3.445915e-001,
+3.457040e-001, 3.468175e-001, 3.479315e-001, 3.490454e-001, 3.501490e-001, 3.512499e-001, 3.523508e-001, 3.534473e-001, 3.545433e-001, 3.556393e-001,
+3.567320e-001, 3.578244e-001, 3.589169e-001, 3.600069e-001, 3.610969e-001, 3.621868e-001, 3.632733e-001, 3.643595e-001, 3.654457e-001, 3.665322e-001,
+3.676187e-001, 3.687051e-001, 3.697864e-001, 3.708660e-001, 3.719455e-001, 3.730237e-001, 3.741010e-001, 3.751783e-001, 3.762541e-001, 3.773278e-001,
+3.784016e-001, 3.794748e-001, 3.805458e-001, 3.816167e-001, 3.826877e-001, 3.837553e-001, 3.848226e-001, 3.858898e-001, 3.869574e-001, 3.880252e-001,
+3.890931e-001, 3.901598e-001, 3.912216e-001, 3.922834e-001, 3.933452e-001, 3.943997e-001, 3.954520e-001, 3.965043e-001, 3.975546e-001, 3.986003e-001,
+3.996460e-001, 4.006917e-001, 4.017346e-001, 4.027767e-001, 4.038188e-001, 4.048603e-001, 4.059000e-001, 4.069397e-001, 4.079794e-001, 4.090224e-001,
+4.100673e-001, 4.111123e-001, 4.121572e-001, 4.131882e-001, 4.142187e-001, 4.152493e-001, 4.162781e-001, 4.173019e-001, 4.183257e-001, 4.193495e-001,
+4.203704e-001, 4.213886e-001, 4.224067e-001, 4.234249e-001, 4.244411e-001, 4.254566e-001, 4.264721e-001, 4.274876e-001, 4.285032e-001, 4.295188e-001,
+4.305344e-001, 4.315500e-001, 4.325645e-001, 4.335790e-001, 4.345935e-001, 4.356080e-001, 4.366190e-001, 4.376298e-001, 4.386407e-001, 4.396516e-001,
+4.406566e-001, 4.416613e-001, 4.426660e-001, 4.436707e-001, 4.446693e-001, 4.456669e-001, 4.466646e-001, 4.476622e-001, 4.486567e-001, 4.496500e-001,
+4.506433e-001, 4.516366e-001, 4.526301e-001, 4.536238e-001, 4.546176e-001, 4.556113e-001, 4.566054e-001, 4.576003e-001, 4.585952e-001, 4.595902e-001,
+4.605848e-001, 4.615683e-001, 4.625518e-001, 4.635352e-001, 4.645187e-001, 4.654969e-001, 4.664726e-001, 4.674483e-001, 4.684239e-001, 4.693974e-001,
+4.703644e-001, 4.713313e-001, 4.722983e-001, 4.732652e-001, 4.742276e-001, 4.751887e-001, 4.761498e-001, 4.771109e-001, 4.780718e-001, 4.790319e-001,
+4.799919e-001, 4.809520e-001, 4.819121e-001, 4.828720e-001, 4.838318e-001, 4.847916e-001, 4.857513e-001, 4.867111e-001, 4.876580e-001, 4.886045e-001,
+4.895510e-001, 4.904975e-001, 4.914432e-001, 4.923861e-001, 4.933290e-001, 4.942720e-001, 4.952149e-001, 4.961545e-001, 4.970901e-001, 4.980257e-001,
+4.989613e-001, 4.998969e-001, 5.008287e-001, 5.017581e-001, 5.026874e-001, 5.036168e-001, 5.045462e-001, 5.054731e-001, 5.063988e-001, 5.073246e-001,
+5.082504e-001, 5.091761e-001, 5.100972e-001, 5.110162e-001, 5.119353e-001, 5.128543e-001, 5.137733e-001, 5.146882e-001, 5.156007e-001, 5.165133e-001,
+5.174258e-001, 5.183384e-001, 5.192476e-001, 5.201537e-001, 5.210598e-001, 5.219659e-001, 5.228720e-001, 5.237772e-001, 5.246803e-001, 5.255835e-001,
+5.264866e-001, 5.273898e-001, 5.282927e-001, 5.291919e-001, 5.300911e-001, 5.309904e-001, 5.318896e-001, 5.327888e-001, 5.336858e-001, 5.345819e-001,
+5.354781e-001, 5.363742e-001, 5.372703e-001, 5.381653e-001, 5.390578e-001, 5.399503e-001, 5.408427e-001, 5.417352e-001, 5.426277e-001, 5.435201e-001,
+5.444125e-001, 5.453048e-001, 5.461972e-001, 5.470895e-001, 5.479819e-001, 5.488742e-001, 5.497664e-001, 5.506587e-001, 5.515510e-001, 5.524433e-001,
+5.533314e-001, 5.542174e-001, 5.551033e-001, 5.559893e-001, 5.568752e-001, 5.577611e-001, 5.586417e-001, 5.595219e-001, 5.604021e-001, 5.612823e-001,
+5.621625e-001, 5.630425e-001, 5.639214e-001, 5.648003e-001, 5.656793e-001, 5.665582e-001, 5.674371e-001, 5.683160e-001, 5.691948e-001, 5.700736e-001,
+5.709523e-001, 5.718311e-001, 5.727099e-001, 5.735873e-001, 5.744622e-001, 5.753372e-001, 5.762121e-001, 5.770870e-001, 5.779620e-001, 5.788385e-001,
+5.797184e-001, 5.805982e-001, 5.814781e-001, 5.823580e-001, 5.832378e-001, 5.841163e-001, 5.849894e-001, 5.858626e-001, 5.867357e-001, 5.876089e-001,
+5.884820e-001, 5.893550e-001, 5.902222e-001, 5.910894e-001, 5.919566e-001, 5.928237e-001, 5.936909e-001, 5.945581e-001, 5.954240e-001, 5.962894e-001,
+5.971549e-001, 5.980203e-001, 5.988858e-001, 5.997512e-001, 6.006169e-001, 6.014830e-001, 6.023491e-001, 6.032152e-001, 6.040813e-001, 6.049474e-001,
+6.058135e-001, 6.066793e-001, 6.075452e-001, 6.084110e-001, 6.092768e-001, 6.101427e-001, 6.110085e-001, 6.118734e-001, 6.127370e-001, 6.136006e-001,
+6.144642e-001, 6.153278e-001, 6.161914e-001, 6.170550e-001, 6.179105e-001, 6.187640e-001, 6.196174e-001, 6.204708e-001, 6.213243e-001, 6.221777e-001,
+6.230304e-001, 6.238760e-001, 6.247217e-001, 6.255673e-001, 6.264129e-001, 6.272585e-001, 6.281041e-001, 6.289486e-001, 6.297904e-001, 6.306323e-001,
+6.314741e-001, 6.323159e-001, 6.331577e-001, 6.339995e-001, 6.348415e-001, 6.356835e-001, 6.365256e-001, 6.373677e-001, 6.382098e-001, 6.390518e-001,
+6.398939e-001, 6.407364e-001, 6.415794e-001, 6.424225e-001, 6.432656e-001, 6.441086e-001, 6.449517e-001, 6.457947e-001, 6.466347e-001, 6.474681e-001,
+6.483014e-001, 6.491347e-001, 6.499680e-001, 6.508014e-001, 6.516347e-001, 6.524671e-001, 6.532938e-001, 6.541204e-001, 6.549470e-001, 6.557737e-001,
+6.566003e-001, 6.574270e-001, 6.582536e-001, 6.590738e-001, 6.598929e-001, 6.607121e-001, 6.615312e-001, 6.623503e-001, 6.631695e-001, 6.639886e-001,
+6.648053e-001, 6.656194e-001, 6.664335e-001, 6.672476e-001, 6.680616e-001, 6.688757e-001, 6.696898e-001, 6.705039e-001, 6.713137e-001, 6.721234e-001,
+6.729332e-001, 6.737430e-001, 6.745528e-001, 6.753625e-001, 6.761723e-001, 6.769786e-001, 6.777802e-001, 6.785818e-001, 6.793834e-001, 6.801850e-001,
+6.809865e-001, 6.817881e-001, 6.825897e-001, 6.833916e-001, 6.841935e-001, 6.849954e-001, 6.857974e-001, 6.865993e-001, 6.874012e-001, 6.882031e-001,
+6.890051e-001, 6.897974e-001, 6.905894e-001, 6.913814e-001, 6.921733e-001, 6.929653e-001, 6.937572e-001, 6.945492e-001, 6.953409e-001, 6.961287e-001,
+6.969166e-001, 6.977044e-001, 6.984923e-001, 6.992802e-001, 7.000680e-001, 7.008559e-001, 7.016434e-001, 7.024264e-001, 7.032094e-001, 7.039923e-001,
+7.047753e-001, 7.055583e-001, 7.063413e-001, 7.071243e-001, 7.079072e-001, 7.086832e-001, 7.094589e-001, 7.102347e-001, 7.110104e-001, 7.117861e-001,
+7.125618e-001, 7.133375e-001, 7.141132e-001, 7.148859e-001, 7.156575e-001, 7.164290e-001, 7.172006e-001, 7.179722e-001, 7.187438e-001, 7.195154e-001,
+7.202870e-001, 7.210569e-001, 7.218245e-001, 7.225920e-001, 7.233595e-001, 7.241271e-001, 7.248946e-001, 7.256622e-001, 7.264297e-001, 7.271972e-001,
+7.279605e-001, 7.287237e-001, 7.294869e-001, 7.302501e-001, 7.310133e-001, 7.317764e-001, 7.325396e-001, 7.333028e-001, 7.340653e-001, 7.348270e-001,
+7.355887e-001, 7.363503e-001, 7.371120e-001, 7.378736e-001, 7.386353e-001, 7.393969e-001, 7.401586e-001, 7.409186e-001, 7.416779e-001, 7.424373e-001,
+7.431966e-001, 7.439560e-001, 7.447153e-001, 7.454747e-001, 7.462341e-001, 7.469934e-001, 7.477500e-001, 7.485064e-001, 7.492629e-001, 7.500193e-001,
+7.507757e-001, 7.515322e-001, 7.522886e-001, 7.530450e-001, 7.538012e-001, 7.545518e-001, 7.553023e-001, 7.560529e-001, 7.568034e-001, 7.575539e-001,
+7.583045e-001, 7.590550e-001, 7.598056e-001, 7.605561e-001, 7.613086e-001, 7.620610e-001, 7.628135e-001, 7.635659e-001, 7.643183e-001, 7.650708e-001,
+7.658232e-001, 7.665757e-001, 7.673281e-001, 7.680818e-001, 7.688358e-001, 7.695897e-001, 7.703436e-001, 7.710976e-001, 7.718515e-001, 7.726055e-001,
+7.733594e-001, 7.741133e-001, 7.748653e-001, 7.756157e-001, 7.763661e-001, 7.771166e-001, 7.778670e-001, 7.786175e-001, 7.793679e-001, 7.801183e-001,
+7.808688e-001, 7.816187e-001, 7.823664e-001, 7.831141e-001, 7.838618e-001, 7.846095e-001, 7.853572e-001, 7.861049e-001, 7.868526e-001, 7.876003e-001,
+7.883480e-001, 7.890954e-001, 7.898425e-001, 7.905897e-001, 7.913369e-001, 7.920841e-001, 7.928312e-001, 7.935784e-001, 7.943256e-001, 7.950727e-001,
+7.958199e-001, 7.965658e-001, 7.973116e-001, 7.980575e-001, 7.988034e-001, 7.995492e-001, 8.002951e-001, 8.010409e-001, 8.017868e-001, 8.025326e-001,
+8.032788e-001, 8.040260e-001, 8.047733e-001, 8.055205e-001, 8.062678e-001, 8.070150e-001, 8.077623e-001, 8.085095e-001, 8.092568e-001, 8.100040e-001,
+8.107492e-001, 8.114883e-001, 8.122274e-001, 8.129665e-001, 8.137056e-001, 8.144447e-001, 8.151838e-001, 8.159229e-001, 8.166620e-001, 8.174011e-001,
+8.181398e-001, 8.188765e-001, 8.196133e-001, 8.203501e-001, 8.210869e-001, 8.218236e-001, 8.225604e-001, 8.232972e-001, 8.240340e-001, 8.247707e-001,
+8.255075e-001, 8.262410e-001, 8.269745e-001, 8.277080e-001, 8.284415e-001, 8.291750e-001, 8.299084e-001, 8.306419e-001, 8.313754e-001, 8.321089e-001,
+8.328424e-001, 8.335721e-001, 8.342999e-001, 8.350276e-001, 8.357554e-001, 8.364831e-001, 8.372109e-001, 8.379387e-001, 8.386664e-001, 8.393942e-001,
+8.401219e-001, 8.408495e-001, 8.415761e-001, 8.423028e-001, 8.430294e-001, 8.437561e-001, 8.444827e-001, 8.452093e-001, 8.459360e-001, 8.466626e-001,
+8.473892e-001, 8.481159e-001, 8.488408e-001, 8.495643e-001, 8.502879e-001, 8.510114e-001, 8.517349e-001, 8.524585e-001, 8.531820e-001, 8.539056e-001,
+8.546291e-001, 8.553526e-001, 8.560762e-001, 8.567957e-001, 8.575141e-001, 8.582326e-001, 8.589510e-001, 8.596695e-001, 8.603880e-001, 8.611064e-001,
+8.618249e-001, 8.625433e-001, 8.632618e-001, 8.639802e-001, 8.646934e-001, 8.654058e-001, 8.661182e-001, 8.668307e-001, 8.675431e-001, 8.682555e-001,
+8.689680e-001, 8.696804e-001, 8.703928e-001, 8.711053e-001, 8.718177e-001, 8.725256e-001, 8.732325e-001, 8.739395e-001, 8.746464e-001, 8.753534e-001,
+8.760603e-001, 8.767673e-001, 8.774742e-001, 8.781811e-001, 8.788881e-001, 8.795950e-001, 8.802983e-001, 8.809992e-001, 8.817002e-001, 8.824012e-001,
+8.831022e-001, 8.838032e-001, 8.845041e-001, 8.852051e-001, 8.859061e-001, 8.866071e-001, 8.873080e-001, 8.880086e-001, 8.887078e-001, 8.894070e-001,
+8.901063e-001, 8.908055e-001, 8.915048e-001, 8.922040e-001, 8.929033e-001, 8.936025e-001, 8.943018e-001, 8.950010e-001, 8.957003e-001, 8.964002e-001,
+8.971004e-001, 8.978006e-001, 8.985008e-001, 8.992010e-001, 8.999013e-001, 9.006015e-001, 9.013017e-001, 9.020019e-001, 9.027021e-001, 9.034023e-001,
+9.041018e-001, 9.047920e-001, 9.054823e-001, 9.061725e-001, 9.068627e-001, 9.075530e-001, 9.082432e-001, 9.089334e-001, 9.096237e-001, 9.103139e-001,
+9.110042e-001, 9.116944e-001, 9.123820e-001, 9.130615e-001, 9.137410e-001, 9.144205e-001, 9.151000e-001, 9.157795e-001, 9.164591e-001, 9.171386e-001,
+9.178181e-001, 9.184976e-001, 9.191771e-001, 9.198566e-001, 9.205334e-001, 9.212021e-001, 9.218709e-001, 9.225397e-001, 9.232084e-001, 9.238772e-001,
+9.245459e-001, 9.252147e-001, 9.258835e-001, 9.265522e-001, 9.272210e-001, 9.278897e-001, 9.285579e-001, 9.292201e-001, 9.298823e-001, 9.305445e-001,
+9.312068e-001, 9.318690e-001, 9.325312e-001, 9.331934e-001, 9.338556e-001, 9.345179e-001, 9.351801e-001, 9.358423e-001, 9.365045e-001, 9.371624e-001,
+9.378191e-001, 9.384758e-001, 9.391324e-001, 9.397891e-001, 9.404457e-001, 9.411024e-001, 9.417591e-001, 9.424157e-001, 9.430724e-001, 9.437291e-001,
+9.443857e-001, 9.450407e-001, 9.456916e-001, 9.463424e-001, 9.469933e-001, 9.476441e-001, 9.482950e-001, 9.489458e-001, 9.495967e-001, 9.502475e-001,
+9.508984e-001, 9.515492e-001, 9.522001e-001, 9.528509e-001, 9.534955e-001, 9.541365e-001, 9.547775e-001, 9.554185e-001, 9.560595e-001, 9.567005e-001,
+9.573415e-001, 9.579825e-001, 9.586235e-001, 9.592645e-001, 9.599055e-001, 9.605465e-001, 9.611875e-001, 9.618178e-001, 9.624455e-001, 9.630731e-001,
+9.637008e-001, 9.643284e-001, 9.649561e-001, 9.655837e-001, 9.662114e-001, 9.668390e-001, 9.674667e-001, 9.680943e-001, 9.687220e-001, 9.693496e-001,
+9.699638e-001, 9.705746e-001, 9.711854e-001, 9.717963e-001, 9.724071e-001, 9.730179e-001, 9.736287e-001, 9.742396e-001, 9.748504e-001, 9.754612e-001,
+9.760721e-001, 9.766829e-001, 9.772937e-001, 9.778920e-001, 9.784828e-001, 9.790736e-001, 9.796643e-001, 9.802551e-001, 9.808458e-001, 9.814366e-001,
+9.820274e-001, 9.826181e-001, 9.832089e-001, 9.837996e-001, 9.843904e-001, 9.849812e-001, 9.855628e-001, 9.861190e-001, 9.866752e-001, 9.872315e-001,
+9.877877e-001, 9.883439e-001, 9.889001e-001, 9.894564e-001, 9.900126e-001, 9.905688e-001, 9.911250e-001, 9.916813e-001, 9.922375e-001, 9.927937e-001,
+9.933193e-001, 9.938332e-001, 9.943471e-001, 9.948610e-001, 9.953749e-001, 9.958888e-001, 9.964027e-001, 9.969166e-001, 9.974305e-001, 9.979444e-001,
+9.984583e-001, 9.989722e-001, 9.994861e-001, 1.000000e+000)),
+("Kodak", "Portra 160NC", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.043421e-002, 2.029328e-002, 2.877555e-002, 3.616994e-002, 4.278070e-002, 4.879971e-002, 5.445214e-002, 5.968075e-002, 6.463039e-002,
+6.933022e-002, 7.378455e-002, 7.809157e-002, 8.226949e-002, 8.632607e-002, 9.023597e-002, 9.401052e-002, 9.764870e-002, 1.011712e-001, 1.046311e-001,
+1.080254e-001, 1.113562e-001, 1.146244e-001, 1.178375e-001, 1.209478e-001, 1.239673e-001, 1.269288e-001, 1.298520e-001, 1.327519e-001, 1.356167e-001,
+1.384286e-001, 1.411979e-001, 1.438946e-001, 1.465526e-001, 1.491759e-001, 1.517739e-001, 1.543569e-001, 1.569266e-001, 1.594693e-001, 1.619731e-001,
+1.644496e-001, 1.668979e-001, 1.693101e-001, 1.717023e-001, 1.740535e-001, 1.763895e-001, 1.786943e-001, 1.809859e-001, 1.832553e-001, 1.855040e-001,
+1.877363e-001, 1.899456e-001, 1.921365e-001, 1.943153e-001, 1.964663e-001, 1.986126e-001, 2.007300e-001, 2.028378e-001, 2.049142e-001, 2.069772e-001,
+2.090151e-001, 2.110266e-001, 2.130141e-001, 2.149662e-001, 2.169061e-001, 2.188302e-001, 2.207367e-001, 2.226287e-001, 2.245007e-001, 2.263693e-001,
+2.282283e-001, 2.300663e-001, 2.318931e-001, 2.337074e-001, 2.355097e-001, 2.373178e-001, 2.391195e-001, 2.409115e-001, 2.427058e-001, 2.444884e-001,
+2.462591e-001, 2.480256e-001, 2.497811e-001, 2.515194e-001, 2.532551e-001, 2.549892e-001, 2.567018e-001, 2.584092e-001, 2.601016e-001, 2.617790e-001,
+2.634465e-001, 2.651094e-001, 2.667603e-001, 2.683969e-001, 2.700237e-001, 2.716447e-001, 2.732641e-001, 2.748671e-001, 2.764696e-001, 2.780737e-001,
+2.796798e-001, 2.812706e-001, 2.828596e-001, 2.844450e-001, 2.860140e-001, 2.875690e-001, 2.891199e-001, 2.906716e-001, 2.922110e-001, 2.937461e-001,
+2.952778e-001, 2.968106e-001, 2.983357e-001, 2.998512e-001, 3.013515e-001, 3.028487e-001, 3.043427e-001, 3.058384e-001, 3.073315e-001, 3.088151e-001,
+3.102928e-001, 3.117669e-001, 3.132205e-001, 3.146684e-001, 3.161059e-001, 3.175452e-001, 3.189852e-001, 3.204108e-001, 3.218325e-001, 3.232438e-001,
+3.246553e-001, 3.260669e-001, 3.274611e-001, 3.288492e-001, 3.302273e-001, 3.316037e-001, 3.329728e-001, 3.343342e-001, 3.356776e-001, 3.370170e-001,
+3.383513e-001, 3.396858e-001, 3.410206e-001, 3.423599e-001, 3.437018e-001, 3.450403e-001, 3.463772e-001, 3.477115e-001, 3.490448e-001, 3.503681e-001,
+3.516877e-001, 3.530015e-001, 3.543130e-001, 3.556298e-001, 3.569493e-001, 3.582645e-001, 3.595766e-001, 3.608855e-001, 3.621911e-001, 3.634958e-001,
+3.647992e-001, 3.661005e-001, 3.673924e-001, 3.686844e-001, 3.699693e-001, 3.712542e-001, 3.725373e-001, 3.738198e-001, 3.750964e-001, 3.763675e-001,
+3.776370e-001, 3.789013e-001, 3.801655e-001, 3.814154e-001, 3.826642e-001, 3.838985e-001, 3.851223e-001, 3.863449e-001, 3.875628e-001, 3.887807e-001,
+3.899891e-001, 3.911952e-001, 3.923954e-001, 3.935853e-001, 3.947751e-001, 3.959554e-001, 3.971344e-001, 3.983117e-001, 3.994864e-001, 4.006612e-001,
+4.018234e-001, 4.029831e-001, 4.041410e-001, 4.052937e-001, 4.064465e-001, 4.075922e-001, 4.087341e-001, 4.098759e-001, 4.110023e-001, 4.121287e-001,
+4.132548e-001, 4.143803e-001, 4.155057e-001, 4.166313e-001, 4.177572e-001, 4.188830e-001, 4.199971e-001, 4.211090e-001, 4.222209e-001, 4.233329e-001,
+4.244450e-001, 4.255573e-001, 4.266704e-001, 4.277835e-001, 4.288921e-001, 4.299926e-001, 4.310930e-001, 4.321939e-001, 4.332955e-001, 4.343971e-001,
+4.354996e-001, 4.366030e-001, 4.377063e-001, 4.388040e-001, 4.398962e-001, 4.409883e-001, 4.420804e-001, 4.431723e-001, 4.442642e-001, 4.453507e-001,
+4.464294e-001, 4.475080e-001, 4.485829e-001, 4.496490e-001, 4.507152e-001, 4.517814e-001, 4.528484e-001, 4.539154e-001, 4.549824e-001, 4.560459e-001,
+4.571091e-001, 4.581724e-001, 4.592300e-001, 4.602853e-001, 4.613406e-001, 4.623946e-001, 4.634468e-001, 4.644990e-001, 4.655507e-001, 4.665969e-001,
+4.676432e-001, 4.686895e-001, 4.697276e-001, 4.707627e-001, 4.717978e-001, 4.728318e-001, 4.738632e-001, 4.748947e-001, 4.759262e-001, 4.769519e-001,
+4.779764e-001, 4.790010e-001, 4.800216e-001, 4.810340e-001, 4.820464e-001, 4.830587e-001, 4.840714e-001, 4.850841e-001, 4.860968e-001, 4.871077e-001,
+4.881089e-001, 4.891101e-001, 4.901114e-001, 4.911072e-001, 4.920977e-001, 4.930882e-001, 4.940787e-001, 4.950704e-001, 4.960625e-001, 4.970546e-001,
+4.980463e-001, 4.990282e-001, 5.000101e-001, 5.009920e-001, 5.019717e-001, 5.029440e-001, 5.039164e-001, 5.048887e-001, 5.058620e-001, 5.068370e-001,
+5.078119e-001, 5.087868e-001, 5.097575e-001, 5.107232e-001, 5.116888e-001, 5.126545e-001, 5.136160e-001, 5.145732e-001, 5.155304e-001, 5.164875e-001,
+5.174427e-001, 5.183955e-001, 5.193484e-001, 5.203012e-001, 5.212495e-001, 5.221908e-001, 5.231321e-001, 5.240733e-001, 5.250125e-001, 5.259457e-001,
+5.268788e-001, 5.278120e-001, 5.287449e-001, 5.296742e-001, 5.306035e-001, 5.315329e-001, 5.324622e-001, 5.333820e-001, 5.343000e-001, 5.352180e-001,
+5.361360e-001, 5.370497e-001, 5.379598e-001, 5.388698e-001, 5.397799e-001, 5.406906e-001, 5.416040e-001, 5.425175e-001, 5.434309e-001, 5.443444e-001,
+5.452518e-001, 5.461575e-001, 5.470631e-001, 5.479687e-001, 5.488723e-001, 5.497710e-001, 5.506698e-001, 5.515685e-001, 5.524672e-001, 5.533674e-001,
+5.542681e-001, 5.551687e-001, 5.560694e-001, 5.569680e-001, 5.578554e-001, 5.587428e-001, 5.596302e-001, 5.605176e-001, 5.614028e-001, 5.622857e-001,
+5.631686e-001, 5.640514e-001, 5.649343e-001, 5.658144e-001, 5.666937e-001, 5.675729e-001, 5.684522e-001, 5.693315e-001, 5.701967e-001, 5.710616e-001,
+5.719265e-001, 5.727914e-001, 5.736559e-001, 5.745172e-001, 5.753785e-001, 5.762398e-001, 5.771011e-001, 5.779623e-001, 5.788232e-001, 5.796841e-001,
+5.805449e-001, 5.814058e-001, 5.822651e-001, 5.831186e-001, 5.839721e-001, 5.848256e-001, 5.856791e-001, 5.865321e-001, 5.873821e-001, 5.882321e-001,
+5.890821e-001, 5.899321e-001, 5.907821e-001, 5.916317e-001, 5.924813e-001, 5.933310e-001, 5.941806e-001, 5.950302e-001, 5.958740e-001, 5.967167e-001,
+5.975594e-001, 5.984022e-001, 5.992449e-001, 6.000845e-001, 6.009218e-001, 6.017591e-001, 6.025965e-001, 6.034338e-001, 6.042697e-001, 6.051010e-001,
+6.059323e-001, 6.067636e-001, 6.075949e-001, 6.084262e-001, 6.092526e-001, 6.100782e-001, 6.109037e-001, 6.117292e-001, 6.125548e-001, 6.133786e-001,
+6.141995e-001, 6.150203e-001, 6.158411e-001, 6.166620e-001, 6.174828e-001, 6.182974e-001, 6.191103e-001, 6.199232e-001, 6.207362e-001, 6.215491e-001,
+6.223602e-001, 6.231619e-001, 6.239636e-001, 6.247654e-001, 6.255671e-001, 6.263688e-001, 6.271702e-001, 6.279713e-001, 6.287724e-001, 6.295735e-001,
+6.303745e-001, 6.311756e-001, 6.319768e-001, 6.327779e-001, 6.335791e-001, 6.343803e-001, 6.351815e-001, 6.359827e-001, 6.367758e-001, 6.375672e-001,
+6.383586e-001, 6.391499e-001, 6.399413e-001, 6.407327e-001, 6.415246e-001, 6.423165e-001, 6.431084e-001, 6.439004e-001, 6.446923e-001, 6.454842e-001,
+6.462714e-001, 6.470577e-001, 6.478440e-001, 6.486304e-001, 6.494167e-001, 6.502030e-001, 6.509805e-001, 6.517549e-001, 6.525294e-001, 6.533038e-001,
+6.540782e-001, 6.548527e-001, 6.556272e-001, 6.564019e-001, 6.571765e-001, 6.579512e-001, 6.587259e-001, 6.595005e-001, 6.602734e-001, 6.610417e-001,
+6.618101e-001, 6.625784e-001, 6.633468e-001, 6.641151e-001, 6.648835e-001, 6.656407e-001, 6.663972e-001, 6.671536e-001, 6.679101e-001, 6.686665e-001,
+6.694230e-001, 6.701785e-001, 6.709331e-001, 6.716876e-001, 6.724422e-001, 6.731968e-001, 6.739513e-001, 6.747059e-001, 6.754562e-001, 6.762062e-001,
+6.769563e-001, 6.777064e-001, 6.784564e-001, 6.792065e-001, 6.799540e-001, 6.806966e-001, 6.814391e-001, 6.821817e-001, 6.829243e-001, 6.836668e-001,
+6.844094e-001, 6.851518e-001, 6.858942e-001, 6.866366e-001, 6.873789e-001, 6.881213e-001, 6.888637e-001, 6.896061e-001, 6.903458e-001, 6.910849e-001,
+6.918241e-001, 6.925633e-001, 6.933024e-001, 6.940416e-001, 6.947807e-001, 6.955141e-001, 6.962471e-001, 6.969801e-001, 6.977131e-001, 6.984461e-001,
+6.991791e-001, 6.999120e-001, 7.006403e-001, 7.013684e-001, 7.020965e-001, 7.028245e-001, 7.035526e-001, 7.042807e-001, 7.050087e-001, 7.057327e-001,
+7.064561e-001, 7.071795e-001, 7.079028e-001, 7.086262e-001, 7.093496e-001, 7.100730e-001, 7.107927e-001, 7.115109e-001, 7.122290e-001, 7.129472e-001,
+7.136653e-001, 7.143835e-001, 7.151016e-001, 7.158182e-001, 7.165327e-001, 7.172471e-001, 7.179616e-001, 7.186760e-001, 7.193905e-001, 7.201049e-001,
+7.208189e-001, 7.215241e-001, 7.222292e-001, 7.229344e-001, 7.236396e-001, 7.243447e-001, 7.250499e-001, 7.257550e-001, 7.264563e-001, 7.271548e-001,
+7.278532e-001, 7.285516e-001, 7.292501e-001, 7.299485e-001, 7.306470e-001, 7.313454e-001, 7.320457e-001, 7.327460e-001, 7.334462e-001, 7.341465e-001,
+7.348468e-001, 7.355470e-001, 7.362473e-001, 7.369454e-001, 7.376389e-001, 7.383324e-001, 7.390259e-001, 7.397195e-001, 7.404130e-001, 7.411065e-001,
+7.418000e-001, 7.424903e-001, 7.431778e-001, 7.438654e-001, 7.445529e-001, 7.452404e-001, 7.459280e-001, 7.466155e-001, 7.473030e-001, 7.479923e-001,
+7.486824e-001, 7.493724e-001, 7.500625e-001, 7.507526e-001, 7.514427e-001, 7.521328e-001, 7.528229e-001, 7.535090e-001, 7.541932e-001, 7.548774e-001,
+7.555615e-001, 7.562457e-001, 7.569299e-001, 7.576140e-001, 7.582982e-001, 7.589794e-001, 7.596584e-001, 7.603374e-001, 7.610164e-001, 7.616953e-001,
+7.623743e-001, 7.630533e-001, 7.637323e-001, 7.644117e-001, 7.650922e-001, 7.657726e-001, 7.664530e-001, 7.671334e-001, 7.678138e-001, 7.684942e-001,
+7.691747e-001, 7.698548e-001, 7.705252e-001, 7.711957e-001, 7.718661e-001, 7.725365e-001, 7.732069e-001, 7.738773e-001, 7.745477e-001, 7.752181e-001,
+7.758865e-001, 7.765535e-001, 7.772205e-001, 7.778875e-001, 7.785545e-001, 7.792214e-001, 7.798884e-001, 7.805554e-001, 7.812224e-001, 7.818885e-001,
+7.825545e-001, 7.832206e-001, 7.838867e-001, 7.845528e-001, 7.852189e-001, 7.858850e-001, 7.865511e-001, 7.872149e-001, 7.878748e-001, 7.885347e-001,
+7.891946e-001, 7.898545e-001, 7.905144e-001, 7.911743e-001, 7.918343e-001, 7.924942e-001, 7.931511e-001, 7.938058e-001, 7.944606e-001, 7.951153e-001,
+7.957701e-001, 7.964249e-001, 7.970796e-001, 7.977344e-001, 7.983891e-001, 7.990390e-001, 7.996865e-001, 8.003340e-001, 8.009815e-001, 8.016290e-001,
+8.022765e-001, 8.029240e-001, 8.035715e-001, 8.042190e-001, 8.048599e-001, 8.054973e-001, 8.061346e-001, 8.067720e-001, 8.074094e-001, 8.080468e-001,
+8.086841e-001, 8.093215e-001, 8.099589e-001, 8.105943e-001, 8.112279e-001, 8.118614e-001, 8.124950e-001, 8.131285e-001, 8.137621e-001, 8.143956e-001,
+8.150292e-001, 8.156627e-001, 8.162948e-001, 8.169224e-001, 8.175500e-001, 8.181776e-001, 8.188052e-001, 8.194327e-001, 8.200603e-001, 8.206879e-001,
+8.213155e-001, 8.219431e-001, 8.225635e-001, 8.231826e-001, 8.238016e-001, 8.244207e-001, 8.250398e-001, 8.256589e-001, 8.262779e-001, 8.268970e-001,
+8.275161e-001, 8.281350e-001, 8.287535e-001, 8.293720e-001, 8.299906e-001, 8.306091e-001, 8.312276e-001, 8.318462e-001, 8.324647e-001, 8.330832e-001,
+8.337017e-001, 8.343204e-001, 8.349392e-001, 8.355579e-001, 8.361767e-001, 8.367954e-001, 8.374142e-001, 8.380329e-001, 8.386517e-001, 8.392704e-001,
+8.398892e-001, 8.405013e-001, 8.411124e-001, 8.417235e-001, 8.423346e-001, 8.429457e-001, 8.435568e-001, 8.441679e-001, 8.447790e-001, 8.453901e-001,
+8.460012e-001, 8.466124e-001, 8.472236e-001, 8.478348e-001, 8.484459e-001, 8.490571e-001, 8.496683e-001, 8.502795e-001, 8.508907e-001, 8.515019e-001,
+8.521130e-001, 8.527247e-001, 8.533365e-001, 8.539483e-001, 8.545600e-001, 8.551718e-001, 8.557836e-001, 8.563953e-001, 8.570071e-001, 8.576189e-001,
+8.582306e-001, 8.588374e-001, 8.594422e-001, 8.600470e-001, 8.606518e-001, 8.612566e-001, 8.618613e-001, 8.624661e-001, 8.630709e-001, 8.636757e-001,
+8.642805e-001, 8.648855e-001, 8.654910e-001, 8.660964e-001, 8.667019e-001, 8.673073e-001, 8.679128e-001, 8.685182e-001, 8.691237e-001, 8.697291e-001,
+8.703346e-001, 8.709400e-001, 8.715463e-001, 8.721527e-001, 8.727591e-001, 8.733655e-001, 8.739720e-001, 8.745784e-001, 8.751848e-001, 8.757912e-001,
+8.763976e-001, 8.770040e-001, 8.776085e-001, 8.782087e-001, 8.788090e-001, 8.794092e-001, 8.800095e-001, 8.806097e-001, 8.812100e-001, 8.818103e-001,
+8.824105e-001, 8.830108e-001, 8.836110e-001, 8.842112e-001, 8.848113e-001, 8.854114e-001, 8.860116e-001, 8.866117e-001, 8.872118e-001, 8.878119e-001,
+8.884120e-001, 8.890121e-001, 8.896123e-001, 8.902124e-001, 8.908077e-001, 8.914005e-001, 8.919934e-001, 8.925862e-001, 8.931790e-001, 8.937718e-001,
+8.943647e-001, 8.949575e-001, 8.955503e-001, 8.961431e-001, 8.967359e-001, 8.973246e-001, 8.979105e-001, 8.984965e-001, 8.990824e-001, 8.996683e-001,
+9.002543e-001, 9.008402e-001, 9.014262e-001, 9.020121e-001, 9.025980e-001, 9.031840e-001, 9.037701e-001, 9.043566e-001, 9.049430e-001, 9.055294e-001,
+9.061158e-001, 9.067023e-001, 9.072887e-001, 9.078751e-001, 9.084616e-001, 9.090480e-001, 9.096344e-001, 9.102207e-001, 9.108051e-001, 9.113894e-001,
+9.119738e-001, 9.125581e-001, 9.131425e-001, 9.137269e-001, 9.143112e-001, 9.148956e-001, 9.154799e-001, 9.160643e-001, 9.166486e-001, 9.172298e-001,
+9.178083e-001, 9.183869e-001, 9.189654e-001, 9.195440e-001, 9.201225e-001, 9.207011e-001, 9.212796e-001, 9.218581e-001, 9.224367e-001, 9.230152e-001,
+9.235938e-001, 9.241642e-001, 9.247337e-001, 9.253032e-001, 9.258726e-001, 9.264421e-001, 9.270116e-001, 9.275811e-001, 9.281505e-001, 9.287200e-001,
+9.292895e-001, 9.298590e-001, 9.304274e-001, 9.309837e-001, 9.315400e-001, 9.320963e-001, 9.326525e-001, 9.332088e-001, 9.337651e-001, 9.343214e-001,
+9.348777e-001, 9.354339e-001, 9.359902e-001, 9.365465e-001, 9.371018e-001, 9.376483e-001, 9.381947e-001, 9.387412e-001, 9.392877e-001, 9.398342e-001,
+9.403806e-001, 9.409271e-001, 9.414736e-001, 9.420201e-001, 9.425665e-001, 9.431130e-001, 9.436595e-001, 9.441973e-001, 9.447347e-001, 9.452721e-001,
+9.458096e-001, 9.463470e-001, 9.468844e-001, 9.474219e-001, 9.479593e-001, 9.484967e-001, 9.490342e-001, 9.495716e-001, 9.501090e-001, 9.506387e-001,
+9.511643e-001, 9.516900e-001, 9.522156e-001, 9.527412e-001, 9.532668e-001, 9.537924e-001, 9.543180e-001, 9.548436e-001, 9.553692e-001, 9.558948e-001,
+9.564204e-001, 9.569442e-001, 9.574594e-001, 9.579746e-001, 9.584898e-001, 9.590050e-001, 9.595202e-001, 9.600354e-001, 9.605506e-001, 9.610658e-001,
+9.615810e-001, 9.620962e-001, 9.626115e-001, 9.631267e-001, 9.636358e-001, 9.641397e-001, 9.646437e-001, 9.651476e-001, 9.656515e-001, 9.661555e-001,
+9.666594e-001, 9.671633e-001, 9.676673e-001, 9.681712e-001, 9.686751e-001, 9.691791e-001, 9.696830e-001, 9.701765e-001, 9.706660e-001, 9.711555e-001,
+9.716450e-001, 9.721346e-001, 9.726241e-001, 9.731136e-001, 9.736031e-001, 9.740926e-001, 9.745821e-001, 9.750717e-001, 9.755612e-001, 9.760507e-001,
+9.765306e-001, 9.770072e-001, 9.774837e-001, 9.779603e-001, 9.784368e-001, 9.789134e-001, 9.793899e-001, 9.798665e-001, 9.803431e-001, 9.808196e-001,
+9.812962e-001, 9.817727e-001, 9.822493e-001, 9.827123e-001, 9.831652e-001, 9.836182e-001, 9.840712e-001, 9.845241e-001, 9.849771e-001, 9.854301e-001,
+9.858830e-001, 9.863360e-001, 9.867890e-001, 9.872419e-001, 9.876949e-001, 9.881478e-001, 9.885958e-001, 9.890271e-001, 9.894584e-001, 9.898897e-001,
+9.903210e-001, 9.907523e-001, 9.911836e-001, 9.916149e-001, 9.920462e-001, 9.924775e-001, 9.929088e-001, 9.933401e-001, 9.937714e-001, 9.942027e-001,
+9.946216e-001, 9.950353e-001, 9.954490e-001, 9.958627e-001, 9.962765e-001, 9.966902e-001, 9.971039e-001, 9.975176e-001, 9.979314e-001, 9.983451e-001,
+9.987588e-001, 9.991725e-001, 9.995863e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 9.736870e-003, 1.879277e-002, 2.664506e-002, 3.340156e-002, 3.946480e-002, 4.508076e-002, 5.023593e-002, 5.509002e-002, 5.975282e-002,
+6.415934e-002, 6.833513e-002, 7.239018e-002, 7.633135e-002, 8.016975e-002, 8.390167e-002, 8.748040e-002, 9.090661e-002, 9.426895e-002, 9.758220e-002,
+1.008833e-001, 1.041185e-001, 1.072700e-001, 1.103363e-001, 1.133145e-001, 1.161829e-001, 1.190017e-001, 1.217685e-001, 1.245192e-001, 1.272489e-001,
+1.299588e-001, 1.326563e-001, 1.353050e-001, 1.378984e-001, 1.404460e-001, 1.429633e-001, 1.454482e-001, 1.478973e-001, 1.503026e-001, 1.526698e-001,
+1.550290e-001, 1.573766e-001, 1.597099e-001, 1.620142e-001, 1.643050e-001, 1.665803e-001, 1.688499e-001, 1.710921e-001, 1.733157e-001, 1.754988e-001,
+1.776574e-001, 1.797675e-001, 1.818484e-001, 1.839255e-001, 1.859872e-001, 1.880322e-001, 1.900521e-001, 1.920509e-001, 1.940355e-001, 1.960064e-001,
+1.979558e-001, 1.998984e-001, 2.018424e-001, 2.037782e-001, 2.057027e-001, 2.076229e-001, 2.095226e-001, 2.114019e-001, 2.132597e-001, 2.151039e-001,
+2.169472e-001, 2.187917e-001, 2.206249e-001, 2.224475e-001, 2.242647e-001, 2.260648e-001, 2.278498e-001, 2.296246e-001, 2.313792e-001, 2.331136e-001,
+2.348330e-001, 2.365439e-001, 2.382505e-001, 2.399522e-001, 2.416505e-001, 2.433427e-001, 2.450259e-001, 2.467028e-001, 2.483645e-001, 2.500091e-001,
+2.516413e-001, 2.532702e-001, 2.549068e-001, 2.565379e-001, 2.581648e-001, 2.597900e-001, 2.614181e-001, 2.630350e-001, 2.646455e-001, 2.662520e-001,
+2.678572e-001, 2.694470e-001, 2.710260e-001, 2.725957e-001, 2.741583e-001, 2.757219e-001, 2.772797e-001, 2.788244e-001, 2.803616e-001, 2.818956e-001,
+2.834267e-001, 2.849394e-001, 2.864452e-001, 2.879436e-001, 2.894334e-001, 2.909137e-001, 2.923789e-001, 2.938305e-001, 2.952757e-001, 2.967103e-001,
+2.981418e-001, 2.995713e-001, 3.009906e-001, 3.024047e-001, 3.038089e-001, 3.052092e-001, 3.066073e-001, 3.079979e-001, 3.093868e-001, 3.107712e-001,
+3.121513e-001, 3.135270e-001, 3.148945e-001, 3.162589e-001, 3.176146e-001, 3.189670e-001, 3.203001e-001, 3.216343e-001, 3.229715e-001, 3.243104e-001,
+3.256518e-001, 3.269968e-001, 3.283448e-001, 3.296888e-001, 3.310303e-001, 3.323694e-001, 3.337073e-001, 3.350473e-001, 3.363880e-001, 3.377215e-001,
+3.390520e-001, 3.403775e-001, 3.417008e-001, 3.430233e-001, 3.443453e-001, 3.456592e-001, 3.469670e-001, 3.482683e-001, 3.495621e-001, 3.508524e-001,
+3.521358e-001, 3.534179e-001, 3.546931e-001, 3.559683e-001, 3.572291e-001, 3.584896e-001, 3.597457e-001, 3.610004e-001, 3.622535e-001, 3.635051e-001,
+3.647533e-001, 3.659900e-001, 3.672267e-001, 3.684552e-001, 3.696828e-001, 3.709067e-001, 3.721277e-001, 3.733452e-001, 3.745481e-001, 3.757510e-001,
+3.769413e-001, 3.781280e-001, 3.793082e-001, 3.804758e-001, 3.816434e-001, 3.828101e-001, 3.839767e-001, 3.851422e-001, 3.863060e-001, 3.874698e-001,
+3.886324e-001, 3.897947e-001, 3.909562e-001, 3.921153e-001, 3.932743e-001, 3.944297e-001, 3.955830e-001, 3.967362e-001, 3.978854e-001, 3.990345e-001,
+4.001821e-001, 4.013261e-001, 4.024702e-001, 4.036095e-001, 4.047453e-001, 4.058812e-001, 4.070142e-001, 4.081465e-001, 4.092785e-001, 4.104020e-001,
+4.115255e-001, 4.126478e-001, 4.137653e-001, 4.148827e-001, 4.160001e-001, 4.171173e-001, 4.182344e-001, 4.193537e-001, 4.204757e-001, 4.215977e-001,
+4.227165e-001, 4.238318e-001, 4.249470e-001, 4.260604e-001, 4.271719e-001, 4.282834e-001, 4.293954e-001, 4.305079e-001, 4.316205e-001, 4.327289e-001,
+4.338312e-001, 4.349335e-001, 4.360337e-001, 4.371290e-001, 4.382243e-001, 4.393192e-001, 4.404122e-001, 4.415051e-001, 4.425981e-001, 4.436712e-001,
+4.447430e-001, 4.458147e-001, 4.468768e-001, 4.479346e-001, 4.489924e-001, 4.500475e-001, 4.510987e-001, 4.521499e-001, 4.532004e-001, 4.542434e-001,
+4.552864e-001, 4.563295e-001, 4.573652e-001, 4.583980e-001, 4.594308e-001, 4.604610e-001, 4.614851e-001, 4.625091e-001, 4.635332e-001, 4.645488e-001,
+4.655626e-001, 4.665765e-001, 4.675864e-001, 4.685879e-001, 4.695893e-001, 4.705908e-001, 4.715860e-001, 4.725791e-001, 4.735723e-001, 4.745646e-001,
+4.755522e-001, 4.765398e-001, 4.775273e-001, 4.785117e-001, 4.794926e-001, 4.804735e-001, 4.814545e-001, 4.824301e-001, 4.834043e-001, 4.843785e-001,
+4.853525e-001, 4.863195e-001, 4.872866e-001, 4.882536e-001, 4.892205e-001, 4.901864e-001, 4.911524e-001, 4.921184e-001, 4.930835e-001, 4.940472e-001,
+4.950108e-001, 4.959745e-001, 4.969377e-001, 4.979004e-001, 4.988631e-001, 4.998258e-001, 5.007869e-001, 5.017462e-001, 5.027056e-001, 5.036649e-001,
+5.046222e-001, 5.055770e-001, 5.065318e-001, 5.074866e-001, 5.084402e-001, 5.093918e-001, 5.103435e-001, 5.112951e-001, 5.122454e-001, 5.131920e-001,
+5.141386e-001, 5.150852e-001, 5.160314e-001, 5.169716e-001, 5.179118e-001, 5.188520e-001, 5.197922e-001, 5.207303e-001, 5.216680e-001, 5.226057e-001,
+5.235434e-001, 5.244811e-001, 5.254188e-001, 5.263565e-001, 5.272942e-001, 5.282303e-001, 5.291589e-001, 5.300874e-001, 5.310159e-001, 5.319445e-001,
+5.328709e-001, 5.337966e-001, 5.347224e-001, 5.356481e-001, 5.365749e-001, 5.375043e-001, 5.384338e-001, 5.393632e-001, 5.402926e-001, 5.412127e-001,
+5.421294e-001, 5.430461e-001, 5.439628e-001, 5.448786e-001, 5.457889e-001, 5.466991e-001, 5.476094e-001, 5.485196e-001, 5.494298e-001, 5.503401e-001,
+5.512503e-001, 5.521605e-001, 5.530707e-001, 5.539742e-001, 5.548754e-001, 5.557766e-001, 5.566778e-001, 5.575789e-001, 5.584716e-001, 5.593640e-001,
+5.602563e-001, 5.611487e-001, 5.620401e-001, 5.629238e-001, 5.638076e-001, 5.646913e-001, 5.655751e-001, 5.664568e-001, 5.673298e-001, 5.682028e-001,
+5.690757e-001, 5.699487e-001, 5.708200e-001, 5.716848e-001, 5.725495e-001, 5.734142e-001, 5.742789e-001, 5.751430e-001, 5.760031e-001, 5.768632e-001,
+5.777234e-001, 5.785835e-001, 5.794435e-001, 5.802974e-001, 5.811514e-001, 5.820054e-001, 5.828594e-001, 5.837133e-001, 5.845610e-001, 5.854075e-001,
+5.862539e-001, 5.871004e-001, 5.879468e-001, 5.887897e-001, 5.896299e-001, 5.904701e-001, 5.913102e-001, 5.921504e-001, 5.929888e-001, 5.938213e-001,
+5.946538e-001, 5.954863e-001, 5.963187e-001, 5.971512e-001, 5.979761e-001, 5.987993e-001, 5.996225e-001, 6.004457e-001, 6.012689e-001, 6.020901e-001,
+6.029073e-001, 6.037246e-001, 6.045419e-001, 6.053592e-001, 6.061764e-001, 6.069907e-001, 6.078042e-001, 6.086177e-001, 6.094312e-001, 6.102447e-001,
+6.110575e-001, 6.118663e-001, 6.126751e-001, 6.134839e-001, 6.142927e-001, 6.151015e-001, 6.159092e-001, 6.167153e-001, 6.175215e-001, 6.183276e-001,
+6.191338e-001, 6.199399e-001, 6.207465e-001, 6.215533e-001, 6.223601e-001, 6.231669e-001, 6.239737e-001, 6.247805e-001, 6.255866e-001, 6.263926e-001,
+6.271985e-001, 6.280044e-001, 6.288104e-001, 6.296163e-001, 6.304203e-001, 6.312240e-001, 6.320276e-001, 6.328313e-001, 6.336350e-001, 6.344387e-001,
+6.352415e-001, 6.360441e-001, 6.368468e-001, 6.376494e-001, 6.384520e-001, 6.392547e-001, 6.400556e-001, 6.408560e-001, 6.416563e-001, 6.424566e-001,
+6.432569e-001, 6.440573e-001, 6.448555e-001, 6.456521e-001, 6.464487e-001, 6.472453e-001, 6.480419e-001, 6.488385e-001, 6.496349e-001, 6.504311e-001,
+6.512272e-001, 6.520234e-001, 6.528195e-001, 6.536157e-001, 6.544118e-001, 6.552036e-001, 6.559950e-001, 6.567865e-001, 6.575779e-001, 6.583693e-001,
+6.591608e-001, 6.599479e-001, 6.607304e-001, 6.615129e-001, 6.622954e-001, 6.630779e-001, 6.638603e-001, 6.646428e-001, 6.654220e-001, 6.662009e-001,
+6.669799e-001, 6.677589e-001, 6.685379e-001, 6.693168e-001, 6.700953e-001, 6.708728e-001, 6.716502e-001, 6.724277e-001, 6.732051e-001, 6.739826e-001,
+6.747600e-001, 6.755318e-001, 6.763000e-001, 6.770683e-001, 6.778366e-001, 6.786048e-001, 6.793731e-001, 6.801414e-001, 6.809049e-001, 6.816674e-001,
+6.824299e-001, 6.831924e-001, 6.839549e-001, 6.847174e-001, 6.854799e-001, 6.862388e-001, 6.869974e-001, 6.877560e-001, 6.885147e-001, 6.892733e-001,
+6.900319e-001, 6.907906e-001, 6.915384e-001, 6.922856e-001, 6.930328e-001, 6.937800e-001, 6.945272e-001, 6.952744e-001, 6.960216e-001, 6.967638e-001,
+6.975051e-001, 6.982464e-001, 6.989878e-001, 6.997291e-001, 7.004704e-001, 7.012118e-001, 7.019539e-001, 7.026965e-001, 7.034390e-001, 7.041815e-001,
+7.049241e-001, 7.056666e-001, 7.064091e-001, 7.071504e-001, 7.078899e-001, 7.086293e-001, 7.093688e-001, 7.101082e-001, 7.108477e-001, 7.115871e-001,
+7.123263e-001, 7.130589e-001, 7.137916e-001, 7.145242e-001, 7.152568e-001, 7.159894e-001, 7.167221e-001, 7.174547e-001, 7.181851e-001, 7.189138e-001,
+7.196426e-001, 7.203713e-001, 7.211000e-001, 7.218288e-001, 7.225575e-001, 7.232862e-001, 7.240096e-001, 7.247329e-001, 7.254563e-001, 7.261796e-001,
+7.269030e-001, 7.276263e-001, 7.283497e-001, 7.290710e-001, 7.297881e-001, 7.305051e-001, 7.312222e-001, 7.319392e-001, 7.326562e-001, 7.333733e-001,
+7.340903e-001, 7.348046e-001, 7.355164e-001, 7.362282e-001, 7.369400e-001, 7.376518e-001, 7.383637e-001, 7.390755e-001, 7.397873e-001, 7.404951e-001,
+7.412007e-001, 7.419063e-001, 7.426119e-001, 7.433175e-001, 7.440231e-001, 7.447287e-001, 7.454343e-001, 7.461349e-001, 7.468328e-001, 7.475308e-001,
+7.482287e-001, 7.489266e-001, 7.496245e-001, 7.503225e-001, 7.510204e-001, 7.517146e-001, 7.524058e-001, 7.530970e-001, 7.537882e-001, 7.544794e-001,
+7.551706e-001, 7.558618e-001, 7.565530e-001, 7.572417e-001, 7.579253e-001, 7.586090e-001, 7.592927e-001, 7.599763e-001, 7.606600e-001, 7.613437e-001,
+7.620273e-001, 7.627110e-001, 7.633913e-001, 7.640716e-001, 7.647520e-001, 7.654323e-001, 7.661127e-001, 7.667930e-001, 7.674733e-001, 7.681537e-001,
+7.688329e-001, 7.695114e-001, 7.701898e-001, 7.708683e-001, 7.715467e-001, 7.722252e-001, 7.729036e-001, 7.735821e-001, 7.742606e-001, 7.749401e-001,
+7.756197e-001, 7.762992e-001, 7.769788e-001, 7.776583e-001, 7.783378e-001, 7.790174e-001, 7.796969e-001, 7.803746e-001, 7.810489e-001, 7.817232e-001,
+7.823975e-001, 7.830719e-001, 7.837462e-001, 7.844205e-001, 7.850949e-001, 7.857692e-001, 7.864413e-001, 7.871118e-001, 7.877823e-001, 7.884528e-001,
+7.891234e-001, 7.897939e-001, 7.904644e-001, 7.911349e-001, 7.918054e-001, 7.924753e-001, 7.931450e-001, 7.938146e-001, 7.944843e-001, 7.951539e-001,
+7.958236e-001, 7.964932e-001, 7.971629e-001, 7.978325e-001, 7.984976e-001, 7.991602e-001, 7.998228e-001, 8.004854e-001, 8.011480e-001, 8.018106e-001,
+8.024732e-001, 8.031358e-001, 8.037984e-001, 8.044582e-001, 8.051152e-001, 8.057723e-001, 8.064293e-001, 8.070863e-001, 8.077433e-001, 8.084003e-001,
+8.090573e-001, 8.097144e-001, 8.103707e-001, 8.110250e-001, 8.116793e-001, 8.123336e-001, 8.129879e-001, 8.136422e-001, 8.142964e-001, 8.149507e-001,
+8.156050e-001, 8.162593e-001, 8.169105e-001, 8.175611e-001, 8.182117e-001, 8.188623e-001, 8.195129e-001, 8.201635e-001, 8.208141e-001, 8.214647e-001,
+8.221153e-001, 8.227658e-001, 8.234161e-001, 8.240664e-001, 8.247167e-001, 8.253670e-001, 8.260174e-001, 8.266677e-001, 8.273180e-001, 8.279683e-001,
+8.286186e-001, 8.292688e-001, 8.299189e-001, 8.305690e-001, 8.312192e-001, 8.318693e-001, 8.325195e-001, 8.331696e-001, 8.338197e-001, 8.344699e-001,
+8.351200e-001, 8.357701e-001, 8.364201e-001, 8.370702e-001, 8.377203e-001, 8.383703e-001, 8.390204e-001, 8.396704e-001, 8.403205e-001, 8.409705e-001,
+8.416206e-001, 8.422646e-001, 8.429083e-001, 8.435521e-001, 8.441958e-001, 8.448395e-001, 8.454832e-001, 8.461270e-001, 8.467707e-001, 8.474144e-001,
+8.480581e-001, 8.486987e-001, 8.493388e-001, 8.499790e-001, 8.506192e-001, 8.512594e-001, 8.518995e-001, 8.525397e-001, 8.531799e-001, 8.538200e-001,
+8.544602e-001, 8.550989e-001, 8.557370e-001, 8.563752e-001, 8.570133e-001, 8.576514e-001, 8.582895e-001, 8.589276e-001, 8.595657e-001, 8.602039e-001,
+8.608420e-001, 8.614770e-001, 8.621069e-001, 8.627368e-001, 8.633667e-001, 8.639966e-001, 8.646265e-001, 8.652564e-001, 8.658863e-001, 8.665163e-001,
+8.671462e-001, 8.677761e-001, 8.684011e-001, 8.690257e-001, 8.696503e-001, 8.702749e-001, 8.708995e-001, 8.715241e-001, 8.721487e-001, 8.727733e-001,
+8.733979e-001, 8.740224e-001, 8.746458e-001, 8.752665e-001, 8.758872e-001, 8.765078e-001, 8.771285e-001, 8.777492e-001, 8.783698e-001, 8.789905e-001,
+8.796112e-001, 8.802318e-001, 8.808525e-001, 8.814677e-001, 8.820786e-001, 8.826894e-001, 8.833002e-001, 8.839110e-001, 8.845218e-001, 8.851326e-001,
+8.857434e-001, 8.863543e-001, 8.869651e-001, 8.875759e-001, 8.881833e-001, 8.887888e-001, 8.893944e-001, 8.900000e-001, 8.906055e-001, 8.912111e-001,
+8.918167e-001, 8.924222e-001, 8.930278e-001, 8.936333e-001, 8.942389e-001, 8.948437e-001, 8.954480e-001, 8.960524e-001, 8.966567e-001, 8.972610e-001,
+8.978654e-001, 8.984697e-001, 8.990740e-001, 8.996783e-001, 9.002827e-001, 9.008870e-001, 9.014902e-001, 9.020918e-001, 9.026934e-001, 9.032950e-001,
+9.038966e-001, 9.044982e-001, 9.050998e-001, 9.057014e-001, 9.063030e-001, 9.069046e-001, 9.075062e-001, 9.081075e-001, 9.087041e-001, 9.093007e-001,
+9.098973e-001, 9.104939e-001, 9.110905e-001, 9.116871e-001, 9.122837e-001, 9.128803e-001, 9.134769e-001, 9.140735e-001, 9.146700e-001, 9.152630e-001,
+9.158529e-001, 9.164429e-001, 9.170328e-001, 9.176228e-001, 9.182127e-001, 9.188027e-001, 9.193927e-001, 9.199826e-001, 9.205726e-001, 9.211625e-001,
+9.217525e-001, 9.223377e-001, 9.229224e-001, 9.235071e-001, 9.240918e-001, 9.246764e-001, 9.252611e-001, 9.258458e-001, 9.264305e-001, 9.270152e-001,
+9.275998e-001, 9.281845e-001, 9.287682e-001, 9.293403e-001, 9.299124e-001, 9.304845e-001, 9.310566e-001, 9.316286e-001, 9.322007e-001, 9.327728e-001,
+9.333449e-001, 9.339170e-001, 9.344890e-001, 9.350611e-001, 9.356323e-001, 9.361947e-001, 9.367572e-001, 9.373197e-001, 9.378821e-001, 9.384446e-001,
+9.390071e-001, 9.395695e-001, 9.401320e-001, 9.406945e-001, 9.412570e-001, 9.418194e-001, 9.423819e-001, 9.429399e-001, 9.434977e-001, 9.440555e-001,
+9.446133e-001, 9.451711e-001, 9.457288e-001, 9.462866e-001, 9.468444e-001, 9.474022e-001, 9.479600e-001, 9.485178e-001, 9.490756e-001, 9.496260e-001,
+9.501725e-001, 9.507190e-001, 9.512655e-001, 9.518120e-001, 9.523585e-001, 9.529050e-001, 9.534515e-001, 9.539980e-001, 9.545445e-001, 9.550910e-001,
+9.556375e-001, 9.561819e-001, 9.567170e-001, 9.572521e-001, 9.577872e-001, 9.583223e-001, 9.588574e-001, 9.593925e-001, 9.599276e-001, 9.604626e-001,
+9.609977e-001, 9.615328e-001, 9.620679e-001, 9.626030e-001, 9.631323e-001, 9.636566e-001, 9.641809e-001, 9.647052e-001, 9.652295e-001, 9.657538e-001,
+9.662781e-001, 9.668024e-001, 9.673267e-001, 9.678510e-001, 9.683753e-001, 9.688996e-001, 9.694239e-001, 9.699373e-001, 9.704464e-001, 9.709556e-001,
+9.714648e-001, 9.719740e-001, 9.724831e-001, 9.729923e-001, 9.735015e-001, 9.740107e-001, 9.745198e-001, 9.750290e-001, 9.755382e-001, 9.760474e-001,
+9.765432e-001, 9.770342e-001, 9.775253e-001, 9.780164e-001, 9.785074e-001, 9.789985e-001, 9.794895e-001, 9.799806e-001, 9.804716e-001, 9.809627e-001,
+9.814538e-001, 9.819448e-001, 9.824359e-001, 9.829129e-001, 9.833794e-001, 9.838459e-001, 9.843124e-001, 9.847789e-001, 9.852454e-001, 9.857120e-001,
+9.861785e-001, 9.866450e-001, 9.871115e-001, 9.875780e-001, 9.880445e-001, 9.885111e-001, 9.889689e-001, 9.893979e-001, 9.898269e-001, 9.902559e-001,
+9.906849e-001, 9.911139e-001, 9.915429e-001, 9.919719e-001, 9.924009e-001, 9.928299e-001, 9.932589e-001, 9.936879e-001, 9.941169e-001, 9.945459e-001,
+9.949465e-001, 9.953352e-001, 9.957239e-001, 9.961127e-001, 9.965014e-001, 9.968901e-001, 9.972789e-001, 9.976676e-001, 9.980563e-001, 9.984451e-001,
+9.988338e-001, 9.992225e-001, 9.996113e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.100443e-003, 1.526697e-002, 2.138948e-002, 2.676546e-002, 3.165982e-002, 3.615057e-002, 4.043250e-002, 4.450771e-002, 4.842480e-002,
+5.215057e-002, 5.569680e-002, 5.912617e-002, 6.244150e-002, 6.570545e-002, 6.890032e-002, 7.199914e-002, 7.501589e-002, 7.796018e-002, 8.085351e-002,
+8.370271e-002, 8.648965e-002, 8.924409e-002, 9.194820e-002, 9.459505e-002, 9.719590e-002, 9.976396e-002, 1.022855e-001, 1.047451e-001, 1.071710e-001,
+1.095672e-001, 1.119203e-001, 1.142713e-001, 1.166002e-001, 1.189038e-001, 1.211722e-001, 1.234188e-001, 1.256409e-001, 1.278519e-001, 1.300269e-001,
+1.322003e-001, 1.343421e-001, 1.364780e-001, 1.385955e-001, 1.406961e-001, 1.427801e-001, 1.448350e-001, 1.468731e-001, 1.488974e-001, 1.508942e-001,
+1.528869e-001, 1.548428e-001, 1.567813e-001, 1.587089e-001, 1.605975e-001, 1.624717e-001, 1.643451e-001, 1.662127e-001, 1.680644e-001, 1.699177e-001,
+1.717617e-001, 1.735891e-001, 1.754164e-001, 1.772358e-001, 1.790401e-001, 1.808345e-001, 1.826319e-001, 1.844108e-001, 1.861658e-001, 1.879154e-001,
+1.896585e-001, 1.913760e-001, 1.930719e-001, 1.947627e-001, 1.964587e-001, 1.981410e-001, 1.998063e-001, 2.014670e-001, 2.031273e-001, 2.047773e-001,
+2.064110e-001, 2.080344e-001, 2.096567e-001, 2.112802e-001, 2.129055e-001, 2.145149e-001, 2.161193e-001, 2.177299e-001, 2.193390e-001, 2.209367e-001,
+2.225186e-001, 2.240934e-001, 2.256740e-001, 2.272487e-001, 2.288097e-001, 2.303546e-001, 2.318903e-001, 2.334287e-001, 2.349649e-001, 2.364969e-001,
+2.380220e-001, 2.395334e-001, 2.410412e-001, 2.425480e-001, 2.440553e-001, 2.455566e-001, 2.470499e-001, 2.485287e-001, 2.500022e-001, 2.514746e-001,
+2.529469e-001, 2.543964e-001, 2.558353e-001, 2.572623e-001, 2.586838e-001, 2.601067e-001, 2.615341e-001, 2.629559e-001, 2.643721e-001, 2.657704e-001,
+2.671637e-001, 2.685532e-001, 2.699465e-001, 2.713372e-001, 2.727209e-001, 2.740900e-001, 2.754499e-001, 2.767996e-001, 2.781487e-001, 2.794989e-001,
+2.808524e-001, 2.822100e-001, 2.835561e-001, 2.848970e-001, 2.862281e-001, 2.875579e-001, 2.888859e-001, 2.902135e-001, 2.915400e-001, 2.928609e-001,
+2.941726e-001, 2.954798e-001, 2.967823e-001, 2.980846e-001, 2.993867e-001, 3.006790e-001, 3.019658e-001, 3.032433e-001, 3.045163e-001, 3.057813e-001,
+3.070426e-001, 3.083038e-001, 3.095651e-001, 3.108317e-001, 3.121018e-001, 3.133673e-001, 3.146287e-001, 3.158848e-001, 3.171336e-001, 3.183821e-001,
+3.196298e-001, 3.208785e-001, 3.221335e-001, 3.233886e-001, 3.246343e-001, 3.258794e-001, 3.271151e-001, 3.283471e-001, 3.295781e-001, 3.308079e-001,
+3.320389e-001, 3.332747e-001, 3.345105e-001, 3.357368e-001, 3.369618e-001, 3.381795e-001, 3.393907e-001, 3.406014e-001, 3.418095e-001, 3.430176e-001,
+3.442226e-001, 3.454266e-001, 3.466268e-001, 3.478181e-001, 3.490094e-001, 3.501938e-001, 3.513769e-001, 3.525579e-001, 3.537346e-001, 3.549113e-001,
+3.560853e-001, 3.572585e-001, 3.584313e-001, 3.596021e-001, 3.607728e-001, 3.619342e-001, 3.630890e-001, 3.642439e-001, 3.653909e-001, 3.665375e-001,
+3.676846e-001, 3.688332e-001, 3.699817e-001, 3.711297e-001, 3.722773e-001, 3.734248e-001, 3.745591e-001, 3.756899e-001, 3.768206e-001, 3.779423e-001,
+3.790639e-001, 3.801857e-001, 3.813084e-001, 3.824311e-001, 3.835541e-001, 3.846775e-001, 3.858010e-001, 3.869204e-001, 3.880335e-001, 3.891466e-001,
+3.902549e-001, 3.913571e-001, 3.924593e-001, 3.935611e-001, 3.946624e-001, 3.957637e-001, 3.968655e-001, 3.979678e-001, 3.990701e-001, 4.001704e-001,
+4.012670e-001, 4.023636e-001, 4.034569e-001, 4.045400e-001, 4.056230e-001, 4.067058e-001, 4.077851e-001, 4.088645e-001, 4.099438e-001, 4.110217e-001,
+4.120995e-001, 4.131772e-001, 4.142549e-001, 4.153325e-001, 4.164102e-001, 4.174832e-001, 4.185485e-001, 4.196138e-001, 4.206788e-001, 4.217386e-001,
+4.227983e-001, 4.238580e-001, 4.249186e-001, 4.259795e-001, 4.270404e-001, 4.280979e-001, 4.291454e-001, 4.301929e-001, 4.312405e-001, 4.322756e-001,
+4.333075e-001, 4.343394e-001, 4.353695e-001, 4.363950e-001, 4.374206e-001, 4.384461e-001, 4.394738e-001, 4.405023e-001, 4.415308e-001, 4.425588e-001,
+4.435826e-001, 4.446065e-001, 4.456303e-001, 4.466493e-001, 4.476625e-001, 4.486756e-001, 4.496888e-001, 4.506952e-001, 4.516993e-001, 4.527034e-001,
+4.537075e-001, 4.547116e-001, 4.557158e-001, 4.567199e-001, 4.577235e-001, 4.587248e-001, 4.597261e-001, 4.607274e-001, 4.617234e-001, 4.627084e-001,
+4.636934e-001, 4.646784e-001, 4.656595e-001, 4.666348e-001, 4.676100e-001, 4.685853e-001, 4.695603e-001, 4.705348e-001, 4.715093e-001, 4.724838e-001,
+4.734597e-001, 4.744376e-001, 4.754155e-001, 4.763934e-001, 4.773665e-001, 4.783307e-001, 4.792948e-001, 4.802590e-001, 4.812211e-001, 4.821757e-001,
+4.831303e-001, 4.840850e-001, 4.850396e-001, 4.859934e-001, 4.869472e-001, 4.879010e-001, 4.888548e-001, 4.898129e-001, 4.907722e-001, 4.917314e-001,
+4.926906e-001, 4.936461e-001, 4.945977e-001, 4.955493e-001, 4.965009e-001, 4.974511e-001, 4.983925e-001, 4.993340e-001, 5.002754e-001, 5.012169e-001,
+5.021572e-001, 5.030972e-001, 5.040371e-001, 5.049770e-001, 5.059171e-001, 5.068573e-001, 5.077976e-001, 5.087379e-001, 5.096782e-001, 5.106148e-001,
+5.115499e-001, 5.124850e-001, 5.134201e-001, 5.143539e-001, 5.152763e-001, 5.161987e-001, 5.171211e-001, 5.180435e-001, 5.189640e-001, 5.198821e-001,
+5.208002e-001, 5.217184e-001, 5.226365e-001, 5.235576e-001, 5.244798e-001, 5.254021e-001, 5.263243e-001, 5.272466e-001, 5.281707e-001, 5.290949e-001,
+5.300192e-001, 5.309434e-001, 5.318668e-001, 5.327801e-001, 5.336935e-001, 5.346068e-001, 5.355201e-001, 5.364327e-001, 5.373412e-001, 5.382498e-001,
+5.391583e-001, 5.400669e-001, 5.409761e-001, 5.418883e-001, 5.428005e-001, 5.437127e-001, 5.446249e-001, 5.455365e-001, 5.464432e-001, 5.473499e-001,
+5.482565e-001, 5.491632e-001, 5.500699e-001, 5.509622e-001, 5.518544e-001, 5.527466e-001, 5.536388e-001, 5.545310e-001, 5.554182e-001, 5.563042e-001,
+5.571901e-001, 5.580761e-001, 5.589620e-001, 5.598490e-001, 5.607369e-001, 5.616248e-001, 5.625127e-001, 5.634006e-001, 5.642879e-001, 5.651727e-001,
+5.660576e-001, 5.669425e-001, 5.678274e-001, 5.687122e-001, 5.695931e-001, 5.704730e-001, 5.713529e-001, 5.722327e-001, 5.731126e-001, 5.739895e-001,
+5.748601e-001, 5.757307e-001, 5.766013e-001, 5.774719e-001, 5.783425e-001, 5.792120e-001, 5.800813e-001, 5.809506e-001, 5.818199e-001, 5.826891e-001,
+5.835584e-001, 5.844281e-001, 5.852977e-001, 5.861673e-001, 5.870369e-001, 5.879065e-001, 5.887740e-001, 5.896387e-001, 5.905033e-001, 5.913679e-001,
+5.922326e-001, 5.930972e-001, 5.939545e-001, 5.948077e-001, 5.956608e-001, 5.965140e-001, 5.973672e-001, 5.982203e-001, 5.990706e-001, 5.999201e-001,
+6.007696e-001, 6.016191e-001, 6.024686e-001, 6.033180e-001, 6.041709e-001, 6.050244e-001, 6.058779e-001, 6.067315e-001, 6.075850e-001, 6.084385e-001,
+6.092901e-001, 6.101413e-001, 6.109924e-001, 6.118436e-001, 6.126947e-001, 6.135459e-001, 6.143918e-001, 6.152355e-001, 6.160792e-001, 6.169229e-001,
+6.177666e-001, 6.186103e-001, 6.194509e-001, 6.202887e-001, 6.211265e-001, 6.219642e-001, 6.228020e-001, 6.236398e-001, 6.244780e-001, 6.253174e-001,
+6.261568e-001, 6.269962e-001, 6.278356e-001, 6.286749e-001, 6.295143e-001, 6.303496e-001, 6.311844e-001, 6.320193e-001, 6.328541e-001, 6.336889e-001,
+6.345237e-001, 6.353541e-001, 6.361792e-001, 6.370043e-001, 6.378294e-001, 6.386545e-001, 6.394796e-001, 6.403047e-001, 6.411225e-001, 6.419396e-001,
+6.427568e-001, 6.435739e-001, 6.443911e-001, 6.452082e-001, 6.460253e-001, 6.468420e-001, 6.476588e-001, 6.484755e-001, 6.492923e-001, 6.501090e-001,
+6.509258e-001, 6.517397e-001, 6.525518e-001, 6.533638e-001, 6.541758e-001, 6.549879e-001, 6.557999e-001, 6.566119e-001, 6.574186e-001, 6.582240e-001,
+6.590293e-001, 6.598347e-001, 6.606400e-001, 6.614454e-001, 6.622507e-001, 6.630463e-001, 6.638409e-001, 6.646355e-001, 6.654302e-001, 6.662248e-001,
+6.670194e-001, 6.678140e-001, 6.686055e-001, 6.693966e-001, 6.701878e-001, 6.709790e-001, 6.717702e-001, 6.725614e-001, 6.733526e-001, 6.741454e-001,
+6.749385e-001, 6.757316e-001, 6.765247e-001, 6.773178e-001, 6.781109e-001, 6.789040e-001, 6.796910e-001, 6.804749e-001, 6.812588e-001, 6.820428e-001,
+6.828267e-001, 6.836106e-001, 6.843946e-001, 6.851742e-001, 6.859470e-001, 6.867199e-001, 6.874927e-001, 6.882656e-001, 6.890385e-001, 6.898113e-001,
+6.905841e-001, 6.913529e-001, 6.921218e-001, 6.928906e-001, 6.936594e-001, 6.944282e-001, 6.951970e-001, 6.959659e-001, 6.967344e-001, 6.975026e-001,
+6.982708e-001, 6.990390e-001, 6.998072e-001, 7.005754e-001, 7.013436e-001, 7.021118e-001, 7.028661e-001, 7.036201e-001, 7.043740e-001, 7.051280e-001,
+7.058819e-001, 7.066359e-001, 7.073898e-001, 7.081404e-001, 7.088832e-001, 7.096260e-001, 7.103687e-001, 7.111115e-001, 7.118542e-001, 7.125970e-001,
+7.133397e-001, 7.140803e-001, 7.148188e-001, 7.155572e-001, 7.162957e-001, 7.170342e-001, 7.177727e-001, 7.185112e-001, 7.192496e-001, 7.199898e-001,
+7.207309e-001, 7.214720e-001, 7.222132e-001, 7.229543e-001, 7.236954e-001, 7.244365e-001, 7.251777e-001, 7.259193e-001, 7.266612e-001, 7.274032e-001,
+7.281451e-001, 7.288870e-001, 7.296290e-001, 7.303709e-001, 7.311128e-001, 7.318497e-001, 7.325822e-001, 7.333147e-001, 7.340471e-001, 7.347796e-001,
+7.355121e-001, 7.362445e-001, 7.369770e-001, 7.377080e-001, 7.384359e-001, 7.391639e-001, 7.398918e-001, 7.406197e-001, 7.413476e-001, 7.420756e-001,
+7.428035e-001, 7.435314e-001, 7.442615e-001, 7.449915e-001, 7.457215e-001, 7.464515e-001, 7.471816e-001, 7.479116e-001, 7.486416e-001, 7.493717e-001,
+7.501017e-001, 7.508317e-001, 7.515617e-001, 7.522917e-001, 7.530218e-001, 7.537518e-001, 7.544818e-001, 7.552118e-001, 7.559417e-001, 7.566617e-001,
+7.573817e-001, 7.581016e-001, 7.588216e-001, 7.595416e-001, 7.602616e-001, 7.609816e-001, 7.617016e-001, 7.624198e-001, 7.631347e-001, 7.638495e-001,
+7.645644e-001, 7.652793e-001, 7.659942e-001, 7.667091e-001, 7.674239e-001, 7.681388e-001, 7.688535e-001, 7.695679e-001, 7.702824e-001, 7.709968e-001,
+7.717113e-001, 7.724257e-001, 7.731401e-001, 7.738546e-001, 7.745690e-001, 7.752832e-001, 7.759973e-001, 7.767113e-001, 7.774253e-001, 7.781393e-001,
+7.788534e-001, 7.795674e-001, 7.802814e-001, 7.809955e-001, 7.817048e-001, 7.824114e-001, 7.831179e-001, 7.838245e-001, 7.845311e-001, 7.852376e-001,
+7.859442e-001, 7.866508e-001, 7.873574e-001, 7.880618e-001, 7.887640e-001, 7.894663e-001, 7.901685e-001, 7.908707e-001, 7.915730e-001, 7.922752e-001,
+7.929774e-001, 7.936797e-001, 7.943820e-001, 7.950845e-001, 7.957871e-001, 7.964897e-001, 7.971923e-001, 7.978949e-001, 7.985974e-001, 7.993000e-001,
+8.000026e-001, 8.007052e-001, 8.014043e-001, 8.021026e-001, 8.028009e-001, 8.034993e-001, 8.041976e-001, 8.048959e-001, 8.055942e-001, 8.062926e-001,
+8.069909e-001, 8.076866e-001, 8.083761e-001, 8.090656e-001, 8.097551e-001, 8.104446e-001, 8.111341e-001, 8.118236e-001, 8.125131e-001, 8.132026e-001,
+8.138921e-001, 8.145788e-001, 8.152640e-001, 8.159491e-001, 8.166343e-001, 8.173194e-001, 8.180045e-001, 8.186897e-001, 8.193748e-001, 8.200599e-001,
+8.207451e-001, 8.214318e-001, 8.221188e-001, 8.228058e-001, 8.234927e-001, 8.241797e-001, 8.248667e-001, 8.255537e-001, 8.262406e-001, 8.269276e-001,
+8.276146e-001, 8.282997e-001, 8.289847e-001, 8.296697e-001, 8.303547e-001, 8.310397e-001, 8.317247e-001, 8.324097e-001, 8.330947e-001, 8.337797e-001,
+8.344647e-001, 8.351468e-001, 8.358285e-001, 8.365102e-001, 8.371919e-001, 8.378736e-001, 8.385553e-001, 8.392369e-001, 8.399186e-001, 8.406003e-001,
+8.412820e-001, 8.419592e-001, 8.426345e-001, 8.433098e-001, 8.439850e-001, 8.446603e-001, 8.453356e-001, 8.460108e-001, 8.466861e-001, 8.473614e-001,
+8.480366e-001, 8.487118e-001, 8.493868e-001, 8.500617e-001, 8.507367e-001, 8.514117e-001, 8.520867e-001, 8.527616e-001, 8.534366e-001, 8.541116e-001,
+8.547865e-001, 8.554615e-001, 8.561388e-001, 8.568163e-001, 8.574938e-001, 8.581713e-001, 8.588488e-001, 8.595263e-001, 8.602038e-001, 8.608813e-001,
+8.615588e-001, 8.622363e-001, 8.629111e-001, 8.635793e-001, 8.642475e-001, 8.649157e-001, 8.655839e-001, 8.662521e-001, 8.669203e-001, 8.675885e-001,
+8.682567e-001, 8.689249e-001, 8.695931e-001, 8.702578e-001, 8.709196e-001, 8.715813e-001, 8.722430e-001, 8.729048e-001, 8.735665e-001, 8.742282e-001,
+8.748900e-001, 8.755517e-001, 8.762134e-001, 8.768752e-001, 8.775366e-001, 8.781978e-001, 8.788590e-001, 8.795202e-001, 8.801814e-001, 8.808426e-001,
+8.815038e-001, 8.821650e-001, 8.828263e-001, 8.834875e-001, 8.841487e-001, 8.848111e-001, 8.854744e-001, 8.861378e-001, 8.868011e-001, 8.874644e-001,
+8.881277e-001, 8.887910e-001, 8.894543e-001, 8.901176e-001, 8.907809e-001, 8.914443e-001, 8.921038e-001, 8.927577e-001, 8.934117e-001, 8.940656e-001,
+8.947195e-001, 8.953734e-001, 8.960273e-001, 8.966812e-001, 8.973351e-001, 8.979890e-001, 8.986429e-001, 8.992965e-001, 8.999441e-001, 9.005916e-001,
+9.012391e-001, 9.018866e-001, 9.025342e-001, 9.031817e-001, 9.038292e-001, 9.044768e-001, 9.051243e-001, 9.057718e-001, 9.064193e-001, 9.070658e-001,
+9.077115e-001, 9.083572e-001, 9.090028e-001, 9.096485e-001, 9.102941e-001, 9.109398e-001, 9.115854e-001, 9.122311e-001, 9.128767e-001, 9.135224e-001,
+9.141680e-001, 9.148080e-001, 9.154471e-001, 9.160863e-001, 9.167255e-001, 9.173647e-001, 9.180039e-001, 9.186431e-001, 9.192823e-001, 9.199214e-001,
+9.205606e-001, 9.211998e-001, 9.218380e-001, 9.224633e-001, 9.230885e-001, 9.237137e-001, 9.243390e-001, 9.249642e-001, 9.255895e-001, 9.262147e-001,
+9.268399e-001, 9.274652e-001, 9.280904e-001, 9.287157e-001, 9.293396e-001, 9.299503e-001, 9.305610e-001, 9.311717e-001, 9.317824e-001, 9.323931e-001,
+9.330038e-001, 9.336146e-001, 9.342253e-001, 9.348360e-001, 9.354467e-001, 9.360574e-001, 9.366681e-001, 9.372713e-001, 9.378742e-001, 9.384770e-001,
+9.390799e-001, 9.396827e-001, 9.402856e-001, 9.408884e-001, 9.414913e-001, 9.420941e-001, 9.426969e-001, 9.432998e-001, 9.439026e-001, 9.444973e-001,
+9.450876e-001, 9.456779e-001, 9.462682e-001, 9.468585e-001, 9.474488e-001, 9.480391e-001, 9.486293e-001, 9.492196e-001, 9.498099e-001, 9.504002e-001,
+9.509905e-001, 9.515780e-001, 9.521525e-001, 9.527270e-001, 9.533016e-001, 9.538761e-001, 9.544506e-001, 9.550251e-001, 9.555996e-001, 9.561741e-001,
+9.567486e-001, 9.573232e-001, 9.578977e-001, 9.584722e-001, 9.590396e-001, 9.596007e-001, 9.601618e-001, 9.607230e-001, 9.612841e-001, 9.618453e-001,
+9.624064e-001, 9.629675e-001, 9.635287e-001, 9.640898e-001, 9.646510e-001, 9.652121e-001, 9.657732e-001, 9.663273e-001, 9.668785e-001, 9.674297e-001,
+9.679810e-001, 9.685322e-001, 9.690835e-001, 9.696347e-001, 9.701859e-001, 9.707372e-001, 9.712884e-001, 9.718397e-001, 9.723909e-001, 9.729421e-001,
+9.734862e-001, 9.740275e-001, 9.745689e-001, 9.751103e-001, 9.756517e-001, 9.761931e-001, 9.767344e-001, 9.772758e-001, 9.778172e-001, 9.783586e-001,
+9.789000e-001, 9.794413e-001, 9.799827e-001, 9.805109e-001, 9.810291e-001, 9.815473e-001, 9.820655e-001, 9.825838e-001, 9.831020e-001, 9.836202e-001,
+9.841384e-001, 9.846566e-001, 9.851749e-001, 9.856931e-001, 9.862113e-001, 9.867295e-001, 9.872413e-001, 9.877313e-001, 9.882213e-001, 9.887113e-001,
+9.892013e-001, 9.896913e-001, 9.901813e-001, 9.906714e-001, 9.911614e-001, 9.916514e-001, 9.921414e-001, 9.926314e-001, 9.931214e-001, 9.936114e-001,
+9.940771e-001, 9.945327e-001, 9.949883e-001, 9.954439e-001, 9.958995e-001, 9.963552e-001, 9.968108e-001, 9.972664e-001, 9.977220e-001, 9.981776e-001,
+9.986332e-001, 9.990888e-001, 9.995444e-001, 1.000000e+000)),
+("Kodak", "Portra 160VC", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.769985e-003, 1.532819e-002, 2.204927e-002, 2.799489e-002, 3.342642e-002, 3.838130e-002, 4.307512e-002, 4.744762e-002, 5.156415e-002,
+5.554462e-002, 5.942757e-002, 6.318666e-002, 6.680745e-002, 7.028060e-002, 7.365300e-002, 7.691468e-002, 8.010846e-002, 8.320340e-002, 8.622108e-002,
+8.918831e-002, 9.210976e-002, 9.500334e-002, 9.787094e-002, 1.006767e-001, 1.034491e-001, 1.061700e-001, 1.088621e-001, 1.115100e-001, 1.141035e-001,
+1.166576e-001, 1.191660e-001, 1.216190e-001, 1.240210e-001, 1.263786e-001, 1.287033e-001, 1.309966e-001, 1.332729e-001, 1.355165e-001, 1.377673e-001,
+1.400065e-001, 1.422520e-001, 1.444955e-001, 1.467241e-001, 1.489525e-001, 1.511590e-001, 1.533526e-001, 1.555102e-001, 1.576403e-001, 1.597459e-001,
+1.618218e-001, 1.638692e-001, 1.658922e-001, 1.678851e-001, 1.698529e-001, 1.718069e-001, 1.737360e-001, 1.756429e-001, 1.775456e-001, 1.794250e-001,
+1.812937e-001, 1.831598e-001, 1.850039e-001, 1.868477e-001, 1.886914e-001, 1.905230e-001, 1.923421e-001, 1.941601e-001, 1.959782e-001, 1.978068e-001,
+1.996330e-001, 2.014474e-001, 2.032515e-001, 2.050576e-001, 2.068455e-001, 2.086116e-001, 2.103771e-001, 2.121285e-001, 2.138639e-001, 2.155896e-001,
+2.173082e-001, 2.190069e-001, 2.206841e-001, 2.223511e-001, 2.240124e-001, 2.256612e-001, 2.272908e-001, 2.289058e-001, 2.305078e-001, 2.321005e-001,
+2.336920e-001, 2.352899e-001, 2.368839e-001, 2.384623e-001, 2.400311e-001, 2.415943e-001, 2.431555e-001, 2.447042e-001, 2.462362e-001, 2.477615e-001,
+2.492882e-001, 2.508075e-001, 2.523134e-001, 2.538113e-001, 2.553073e-001, 2.568026e-001, 2.582917e-001, 2.597729e-001, 2.612325e-001, 2.626927e-001,
+2.641533e-001, 2.656059e-001, 2.670470e-001, 2.684782e-001, 2.699055e-001, 2.713302e-001, 2.727522e-001, 2.741548e-001, 2.755548e-001, 2.769533e-001,
+2.783551e-001, 2.797576e-001, 2.811529e-001, 2.825410e-001, 2.839199e-001, 2.853043e-001, 2.866902e-001, 2.880729e-001, 2.894503e-001, 2.908178e-001,
+2.921773e-001, 2.935317e-001, 2.948885e-001, 2.962455e-001, 2.975969e-001, 2.989455e-001, 3.002853e-001, 3.016225e-001, 3.029560e-001, 3.042887e-001,
+3.056208e-001, 3.069527e-001, 3.082845e-001, 3.096183e-001, 3.109530e-001, 3.122856e-001, 3.136177e-001, 3.149412e-001, 3.162628e-001, 3.175767e-001,
+3.188890e-001, 3.202066e-001, 3.215256e-001, 3.228304e-001, 3.241306e-001, 3.254285e-001, 3.267253e-001, 3.280225e-001, 3.293201e-001, 3.306170e-001,
+3.319132e-001, 3.332049e-001, 3.344849e-001, 3.357647e-001, 3.370434e-001, 3.383222e-001, 3.395951e-001, 3.408671e-001, 3.421292e-001, 3.433852e-001,
+3.446363e-001, 3.458774e-001, 3.471183e-001, 3.483508e-001, 3.495833e-001, 3.508102e-001, 3.520343e-001, 3.532548e-001, 3.544664e-001, 3.556780e-001,
+3.568766e-001, 3.580736e-001, 3.592629e-001, 3.604427e-001, 3.616225e-001, 3.627897e-001, 3.639565e-001, 3.651241e-001, 3.662925e-001, 3.674609e-001,
+3.686209e-001, 3.697803e-001, 3.709328e-001, 3.720725e-001, 3.732122e-001, 3.743419e-001, 3.754679e-001, 3.765944e-001, 3.777253e-001, 3.788562e-001,
+3.799857e-001, 3.811131e-001, 3.822405e-001, 3.833587e-001, 3.844728e-001, 3.855868e-001, 3.867012e-001, 3.878157e-001, 3.889300e-001, 3.900434e-001,
+3.911568e-001, 3.922654e-001, 3.933632e-001, 3.944610e-001, 3.955566e-001, 3.966492e-001, 3.977418e-001, 3.988340e-001, 3.999256e-001, 4.010173e-001,
+4.021055e-001, 4.031911e-001, 4.042767e-001, 4.053549e-001, 4.064281e-001, 4.075013e-001, 4.085747e-001, 4.096483e-001, 4.107218e-001, 4.117961e-001,
+4.128711e-001, 4.139461e-001, 4.150182e-001, 4.160854e-001, 4.171527e-001, 4.182185e-001, 4.192797e-001, 4.203409e-001, 4.214020e-001, 4.224613e-001,
+4.235205e-001, 4.245798e-001, 4.256360e-001, 4.266915e-001, 4.277469e-001, 4.287993e-001, 4.298486e-001, 4.308980e-001, 4.319470e-001, 4.329943e-001,
+4.340417e-001, 4.350890e-001, 4.361298e-001, 4.371690e-001, 4.382082e-001, 4.392425e-001, 4.402691e-001, 4.412956e-001, 4.423222e-001, 4.433424e-001,
+4.443620e-001, 4.453817e-001, 4.464051e-001, 4.474341e-001, 4.484630e-001, 4.494919e-001, 4.505176e-001, 4.515426e-001, 4.525676e-001, 4.535906e-001,
+4.546070e-001, 4.556234e-001, 4.566398e-001, 4.576533e-001, 4.586646e-001, 4.596759e-001, 4.606872e-001, 4.616913e-001, 4.626944e-001, 4.636975e-001,
+4.646999e-001, 4.656973e-001, 4.666947e-001, 4.676921e-001, 4.686877e-001, 4.696793e-001, 4.706710e-001, 4.716626e-001, 4.726535e-001, 4.736435e-001,
+4.746335e-001, 4.756235e-001, 4.766106e-001, 4.775952e-001, 4.785799e-001, 4.795645e-001, 4.805474e-001, 4.815289e-001, 4.825105e-001, 4.834921e-001,
+4.844722e-001, 4.854512e-001, 4.864302e-001, 4.874091e-001, 4.883851e-001, 4.893578e-001, 4.903305e-001, 4.913032e-001, 4.922738e-001, 4.932405e-001,
+4.942072e-001, 4.951740e-001, 4.961401e-001, 4.971034e-001, 4.980666e-001, 4.990298e-001, 4.999930e-001, 5.009501e-001, 5.019065e-001, 5.028630e-001,
+5.038195e-001, 5.047739e-001, 5.057269e-001, 5.066800e-001, 5.076331e-001, 5.085848e-001, 5.095327e-001, 5.104805e-001, 5.114284e-001, 5.123762e-001,
+5.133185e-001, 5.142597e-001, 5.152009e-001, 5.161421e-001, 5.170795e-001, 5.180102e-001, 5.189410e-001, 5.198717e-001, 5.208025e-001, 5.217247e-001,
+5.226452e-001, 5.235656e-001, 5.244860e-001, 5.254061e-001, 5.263252e-001, 5.272442e-001, 5.281633e-001, 5.290824e-001, 5.299967e-001, 5.309073e-001,
+5.318178e-001, 5.327284e-001, 5.336390e-001, 5.345441e-001, 5.354480e-001, 5.363520e-001, 5.372559e-001, 5.381596e-001, 5.390571e-001, 5.399546e-001,
+5.408521e-001, 5.417496e-001, 5.426463e-001, 5.435394e-001, 5.444326e-001, 5.453258e-001, 5.462189e-001, 5.471101e-001, 5.479956e-001, 5.488812e-001,
+5.497668e-001, 5.506524e-001, 5.515369e-001, 5.524185e-001, 5.533001e-001, 5.541816e-001, 5.550632e-001, 5.559430e-001, 5.568165e-001, 5.576901e-001,
+5.585636e-001, 5.594371e-001, 5.603093e-001, 5.611694e-001, 5.620295e-001, 5.628896e-001, 5.637497e-001, 5.646099e-001, 5.654671e-001, 5.663241e-001,
+5.671810e-001, 5.680380e-001, 5.688949e-001, 5.697519e-001, 5.706089e-001, 5.714659e-001, 5.723228e-001, 5.731798e-001, 5.740356e-001, 5.748888e-001,
+5.757420e-001, 5.765952e-001, 5.774485e-001, 5.783017e-001, 5.791468e-001, 5.799911e-001, 5.808354e-001, 5.816797e-001, 5.825240e-001, 5.833688e-001,
+5.842141e-001, 5.850595e-001, 5.859048e-001, 5.867501e-001, 5.875955e-001, 5.884352e-001, 5.892740e-001, 5.901129e-001, 5.909517e-001, 5.917905e-001,
+5.926261e-001, 5.934513e-001, 5.942764e-001, 5.951016e-001, 5.959268e-001, 5.967519e-001, 5.975750e-001, 5.983961e-001, 5.992173e-001, 6.000384e-001,
+6.008596e-001, 6.016807e-001, 6.025014e-001, 6.033218e-001, 6.041422e-001, 6.049627e-001, 6.057831e-001, 6.066035e-001, 6.074202e-001, 6.082364e-001,
+6.090526e-001, 6.098688e-001, 6.106850e-001, 6.115012e-001, 6.123086e-001, 6.131153e-001, 6.139221e-001, 6.147289e-001, 6.155357e-001, 6.163425e-001,
+6.171493e-001, 6.179562e-001, 6.187630e-001, 6.195699e-001, 6.203767e-001, 6.211836e-001, 6.219863e-001, 6.227881e-001, 6.235899e-001, 6.243917e-001,
+6.251935e-001, 6.259953e-001, 6.267919e-001, 6.275852e-001, 6.283785e-001, 6.291718e-001, 6.299651e-001, 6.307584e-001, 6.315499e-001, 6.323379e-001,
+6.331260e-001, 6.339140e-001, 6.347020e-001, 6.354900e-001, 6.362781e-001, 6.370700e-001, 6.378619e-001, 6.386538e-001, 6.394458e-001, 6.402377e-001,
+6.410297e-001, 6.418200e-001, 6.426091e-001, 6.433981e-001, 6.441872e-001, 6.449762e-001, 6.457653e-001, 6.465542e-001, 6.473350e-001, 6.481159e-001,
+6.488967e-001, 6.496775e-001, 6.504583e-001, 6.512391e-001, 6.520216e-001, 6.528064e-001, 6.535913e-001, 6.543761e-001, 6.551610e-001, 6.559459e-001,
+6.567307e-001, 6.575128e-001, 6.582935e-001, 6.590742e-001, 6.598550e-001, 6.606357e-001, 6.614164e-001, 6.621972e-001, 6.629760e-001, 6.637545e-001,
+6.645331e-001, 6.653116e-001, 6.660901e-001, 6.668687e-001, 6.676472e-001, 6.684236e-001, 6.691999e-001, 6.699763e-001, 6.707526e-001, 6.715290e-001,
+6.723053e-001, 6.730817e-001, 6.738588e-001, 6.746358e-001, 6.754129e-001, 6.761900e-001, 6.769671e-001, 6.777442e-001, 6.785212e-001, 6.792948e-001,
+6.800681e-001, 6.808414e-001, 6.816147e-001, 6.823881e-001, 6.831614e-001, 6.839347e-001, 6.847041e-001, 6.854723e-001, 6.862405e-001, 6.870086e-001,
+6.877768e-001, 6.885450e-001, 6.893131e-001, 6.900816e-001, 6.908505e-001, 6.916194e-001, 6.923882e-001, 6.931571e-001, 6.939260e-001, 6.946948e-001,
+6.954629e-001, 6.962239e-001, 6.969848e-001, 6.977458e-001, 6.985068e-001, 6.992678e-001, 7.000287e-001, 7.007897e-001, 7.015471e-001, 7.023023e-001,
+7.030575e-001, 7.038127e-001, 7.045679e-001, 7.053231e-001, 7.060784e-001, 7.068333e-001, 7.075829e-001, 7.083326e-001, 7.090822e-001, 7.098319e-001,
+7.105816e-001, 7.113312e-001, 7.120809e-001, 7.128294e-001, 7.135761e-001, 7.143228e-001, 7.150694e-001, 7.158161e-001, 7.165628e-001, 7.173095e-001,
+7.180561e-001, 7.187996e-001, 7.195409e-001, 7.202821e-001, 7.210234e-001, 7.217646e-001, 7.225059e-001, 7.232472e-001, 7.239884e-001, 7.247272e-001,
+7.254650e-001, 7.262028e-001, 7.269406e-001, 7.276784e-001, 7.284161e-001, 7.291539e-001, 7.298917e-001, 7.306271e-001, 7.313616e-001, 7.320961e-001,
+7.328305e-001, 7.335650e-001, 7.342995e-001, 7.350340e-001, 7.357684e-001, 7.364992e-001, 7.372277e-001, 7.379561e-001, 7.386845e-001, 7.394129e-001,
+7.401414e-001, 7.408698e-001, 7.415982e-001, 7.423244e-001, 7.430472e-001, 7.437700e-001, 7.444928e-001, 7.452156e-001, 7.459384e-001, 7.466612e-001,
+7.473840e-001, 7.481066e-001, 7.488254e-001, 7.495442e-001, 7.502630e-001, 7.509818e-001, 7.517007e-001, 7.524195e-001, 7.531383e-001, 7.538571e-001,
+7.545718e-001, 7.552839e-001, 7.559961e-001, 7.567083e-001, 7.574204e-001, 7.581326e-001, 7.588448e-001, 7.595570e-001, 7.602683e-001, 7.609707e-001,
+7.616730e-001, 7.623753e-001, 7.630776e-001, 7.637800e-001, 7.644823e-001, 7.651846e-001, 7.658869e-001, 7.665888e-001, 7.672902e-001, 7.679915e-001,
+7.686929e-001, 7.693942e-001, 7.700956e-001, 7.707969e-001, 7.714983e-001, 7.721996e-001, 7.729007e-001, 7.736016e-001, 7.743026e-001, 7.750035e-001,
+7.757044e-001, 7.764054e-001, 7.771063e-001, 7.778072e-001, 7.785081e-001, 7.792060e-001, 7.799027e-001, 7.805994e-001, 7.812961e-001, 7.819928e-001,
+7.826895e-001, 7.833862e-001, 7.840829e-001, 7.847796e-001, 7.854750e-001, 7.861699e-001, 7.868647e-001, 7.875596e-001, 7.882544e-001, 7.889492e-001,
+7.896441e-001, 7.903389e-001, 7.910338e-001, 7.917259e-001, 7.924157e-001, 7.931055e-001, 7.937953e-001, 7.944852e-001, 7.951750e-001, 7.958648e-001,
+7.965546e-001, 7.972444e-001, 7.979318e-001, 7.986127e-001, 7.992936e-001, 7.999745e-001, 8.006554e-001, 8.013363e-001, 8.020172e-001, 8.026981e-001,
+8.033790e-001, 8.040599e-001, 8.047353e-001, 8.054098e-001, 8.060844e-001, 8.067589e-001, 8.074334e-001, 8.081080e-001, 8.087825e-001, 8.094571e-001,
+8.101316e-001, 8.108058e-001, 8.114793e-001, 8.121528e-001, 8.128263e-001, 8.134997e-001, 8.141732e-001, 8.148467e-001, 8.155202e-001, 8.161936e-001,
+8.168671e-001, 8.175390e-001, 8.182101e-001, 8.188813e-001, 8.195524e-001, 8.202236e-001, 8.208947e-001, 8.215658e-001, 8.222370e-001, 8.229081e-001,
+8.235793e-001, 8.242447e-001, 8.249096e-001, 8.255745e-001, 8.262394e-001, 8.269043e-001, 8.275692e-001, 8.282340e-001, 8.288989e-001, 8.295638e-001,
+8.302287e-001, 8.308900e-001, 8.315512e-001, 8.322124e-001, 8.328736e-001, 8.335348e-001, 8.341960e-001, 8.348572e-001, 8.355184e-001, 8.361796e-001,
+8.368408e-001, 8.374972e-001, 8.381533e-001, 8.388094e-001, 8.394655e-001, 8.401216e-001, 8.407777e-001, 8.414338e-001, 8.420899e-001, 8.427460e-001,
+8.434021e-001, 8.440536e-001, 8.447034e-001, 8.453533e-001, 8.460031e-001, 8.466530e-001, 8.473028e-001, 8.479527e-001, 8.486025e-001, 8.492524e-001,
+8.499022e-001, 8.505505e-001, 8.511967e-001, 8.518428e-001, 8.524890e-001, 8.531351e-001, 8.537813e-001, 8.544274e-001, 8.550736e-001, 8.557197e-001,
+8.563658e-001, 8.570120e-001, 8.576570e-001, 8.583020e-001, 8.589470e-001, 8.595920e-001, 8.602369e-001, 8.608819e-001, 8.615269e-001, 8.621719e-001,
+8.628169e-001, 8.634618e-001, 8.641055e-001, 8.647467e-001, 8.653878e-001, 8.660289e-001, 8.666700e-001, 8.673112e-001, 8.679523e-001, 8.685934e-001,
+8.692345e-001, 8.698757e-001, 8.705168e-001, 8.711532e-001, 8.717863e-001, 8.724194e-001, 8.730524e-001, 8.736855e-001, 8.743185e-001, 8.749516e-001,
+8.755847e-001, 8.762177e-001, 8.768508e-001, 8.774839e-001, 8.781165e-001, 8.787490e-001, 8.793815e-001, 8.800139e-001, 8.806464e-001, 8.812789e-001,
+8.819114e-001, 8.825438e-001, 8.831763e-001, 8.838088e-001, 8.844413e-001, 8.850709e-001, 8.856990e-001, 8.863270e-001, 8.869551e-001, 8.875831e-001,
+8.882112e-001, 8.888392e-001, 8.894673e-001, 8.900953e-001, 8.907234e-001, 8.913514e-001, 8.919770e-001, 8.925994e-001, 8.932217e-001, 8.938440e-001,
+8.944663e-001, 8.950886e-001, 8.957110e-001, 8.963333e-001, 8.969556e-001, 8.975779e-001, 8.982003e-001, 8.988225e-001, 8.994441e-001, 9.000657e-001,
+9.006873e-001, 9.013089e-001, 9.019305e-001, 9.025521e-001, 9.031737e-001, 9.037953e-001, 9.044169e-001, 9.050385e-001, 9.056601e-001, 9.062819e-001,
+9.069040e-001, 9.075260e-001, 9.081480e-001, 9.087701e-001, 9.093921e-001, 9.100141e-001, 9.106362e-001, 9.112582e-001, 9.118802e-001, 9.125023e-001,
+9.131243e-001, 9.137399e-001, 9.143548e-001, 9.149697e-001, 9.155847e-001, 9.161996e-001, 9.168145e-001, 9.174294e-001, 9.180444e-001, 9.186593e-001,
+9.192742e-001, 9.198892e-001, 9.205034e-001, 9.211104e-001, 9.217175e-001, 9.223245e-001, 9.229315e-001, 9.235386e-001, 9.241456e-001, 9.247527e-001,
+9.253597e-001, 9.259668e-001, 9.265738e-001, 9.271809e-001, 9.277874e-001, 9.283900e-001, 9.289927e-001, 9.295953e-001, 9.301979e-001, 9.308005e-001,
+9.314031e-001, 9.320058e-001, 9.326084e-001, 9.332110e-001, 9.338136e-001, 9.344162e-001, 9.350189e-001, 9.356136e-001, 9.362081e-001, 9.368026e-001,
+9.373972e-001, 9.379917e-001, 9.385862e-001, 9.391807e-001, 9.397752e-001, 9.403697e-001, 9.409643e-001, 9.415588e-001, 9.421533e-001, 9.427426e-001,
+9.433292e-001, 9.439158e-001, 9.445024e-001, 9.450890e-001, 9.456756e-001, 9.462622e-001, 9.468489e-001, 9.474355e-001, 9.480221e-001, 9.486087e-001,
+9.491953e-001, 9.497809e-001, 9.503621e-001, 9.509434e-001, 9.515246e-001, 9.521059e-001, 9.526871e-001, 9.532684e-001, 9.538496e-001, 9.544309e-001,
+9.550121e-001, 9.555934e-001, 9.561746e-001, 9.567559e-001, 9.573335e-001, 9.579080e-001, 9.584826e-001, 9.590572e-001, 9.596317e-001, 9.602063e-001,
+9.607809e-001, 9.613554e-001, 9.619300e-001, 9.625046e-001, 9.630791e-001, 9.636537e-001, 9.642283e-001, 9.647950e-001, 9.653589e-001, 9.659227e-001,
+9.664866e-001, 9.670505e-001, 9.676143e-001, 9.681782e-001, 9.687421e-001, 9.693060e-001, 9.698698e-001, 9.704337e-001, 9.709976e-001, 9.715614e-001,
+9.721186e-001, 9.726735e-001, 9.732284e-001, 9.737833e-001, 9.743382e-001, 9.748931e-001, 9.754480e-001, 9.760029e-001, 9.765578e-001, 9.771127e-001,
+9.776676e-001, 9.782225e-001, 9.787774e-001, 9.793238e-001, 9.798640e-001, 9.804042e-001, 9.809443e-001, 9.814845e-001, 9.820247e-001, 9.825649e-001,
+9.831050e-001, 9.836452e-001, 9.841854e-001, 9.847256e-001, 9.852657e-001, 9.858059e-001, 9.863404e-001, 9.868565e-001, 9.873725e-001, 9.878885e-001,
+9.884045e-001, 9.889205e-001, 9.894366e-001, 9.899526e-001, 9.904686e-001, 9.909846e-001, 9.915006e-001, 9.920167e-001, 9.925327e-001, 9.930487e-001,
+9.935506e-001, 9.940467e-001, 9.945428e-001, 9.950389e-001, 9.955350e-001, 9.960311e-001, 9.965273e-001, 9.970234e-001, 9.975195e-001, 9.980156e-001,
+9.985117e-001, 9.990078e-001, 9.995039e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.209122e-003, 1.406182e-002, 2.013409e-002, 2.556771e-002, 3.051605e-002, 3.506630e-002, 3.936433e-002, 4.343104e-002, 4.728537e-002,
+5.099482e-002, 5.459087e-002, 5.807252e-002, 6.140851e-002, 6.465508e-002, 6.785008e-002, 7.096842e-002, 7.396836e-002, 7.688564e-002, 7.977079e-002,
+8.261552e-002, 8.539022e-002, 8.810990e-002, 9.079032e-002, 9.343749e-002, 9.603755e-002, 9.859360e-002, 1.011144e-001, 1.035860e-001, 1.060299e-001,
+1.084465e-001, 1.108224e-001, 1.131646e-001, 1.154722e-001, 1.177325e-001, 1.199774e-001, 1.222234e-001, 1.244523e-001, 1.266828e-001, 1.288990e-001,
+1.310786e-001, 1.332331e-001, 1.353804e-001, 1.374987e-001, 1.396069e-001, 1.416790e-001, 1.437290e-001, 1.457713e-001, 1.477762e-001, 1.497581e-001,
+1.517187e-001, 1.536568e-001, 1.555901e-001, 1.574812e-001, 1.593549e-001, 1.612353e-001, 1.631091e-001, 1.649707e-001, 1.668395e-001, 1.687040e-001,
+1.705541e-001, 1.724057e-001, 1.742419e-001, 1.760638e-001, 1.778782e-001, 1.796796e-001, 1.814687e-001, 1.832400e-001, 1.850112e-001, 1.867781e-001,
+1.885201e-001, 1.902449e-001, 1.919704e-001, 1.936957e-001, 1.953990e-001, 1.970870e-001, 1.987719e-001, 2.004461e-001, 2.020983e-001, 2.037347e-001,
+2.053683e-001, 2.069964e-001, 2.086153e-001, 2.102249e-001, 2.118260e-001, 2.134267e-001, 2.150334e-001, 2.166190e-001, 2.181905e-001, 2.197569e-001,
+2.213246e-001, 2.228954e-001, 2.244486e-001, 2.259979e-001, 2.275449e-001, 2.290932e-001, 2.306477e-001, 2.321884e-001, 2.337167e-001, 2.352366e-001,
+2.367514e-001, 2.382549e-001, 2.397527e-001, 2.412422e-001, 2.427164e-001, 2.441852e-001, 2.456547e-001, 2.471264e-001, 2.485917e-001, 2.500482e-001,
+2.514964e-001, 2.529383e-001, 2.543821e-001, 2.558273e-001, 2.572558e-001, 2.586747e-001, 2.600824e-001, 2.614835e-001, 2.628856e-001, 2.642917e-001,
+2.656919e-001, 2.670886e-001, 2.684741e-001, 2.698574e-001, 2.712377e-001, 2.726214e-001, 2.740063e-001, 2.753945e-001, 2.767790e-001, 2.781564e-001,
+2.795271e-001, 2.808934e-001, 2.822520e-001, 2.836092e-001, 2.849699e-001, 2.863265e-001, 2.876688e-001, 2.890065e-001, 2.903368e-001, 2.916674e-001,
+2.929982e-001, 2.943270e-001, 2.956546e-001, 2.969662e-001, 2.982715e-001, 2.995667e-001, 3.008590e-001, 3.021505e-001, 3.034418e-001, 3.047347e-001,
+3.060280e-001, 3.073163e-001, 3.086033e-001, 3.098782e-001, 3.111488e-001, 3.124165e-001, 3.136828e-001, 3.149532e-001, 3.162269e-001, 3.174982e-001,
+3.187663e-001, 3.200295e-001, 3.212795e-001, 3.225290e-001, 3.237727e-001, 3.250164e-001, 3.262596e-001, 3.275028e-001, 3.287386e-001, 3.299695e-001,
+3.311984e-001, 3.324228e-001, 3.336473e-001, 3.348652e-001, 3.360830e-001, 3.373040e-001, 3.385266e-001, 3.397471e-001, 3.409624e-001, 3.421776e-001,
+3.433756e-001, 3.445712e-001, 3.457630e-001, 3.469501e-001, 3.481372e-001, 3.493269e-001, 3.505167e-001, 3.517034e-001, 3.528865e-001, 3.540695e-001,
+3.552398e-001, 3.564088e-001, 3.575740e-001, 3.587315e-001, 3.598890e-001, 3.610461e-001, 3.622029e-001, 3.633604e-001, 3.645246e-001, 3.656889e-001,
+3.668494e-001, 3.680044e-001, 3.691595e-001, 3.703059e-001, 3.714484e-001, 3.725909e-001, 3.737317e-001, 3.748725e-001, 3.760137e-001, 3.771580e-001,
+3.783023e-001, 3.794414e-001, 3.805680e-001, 3.816947e-001, 3.828162e-001, 3.839308e-001, 3.850454e-001, 3.861593e-001, 3.872724e-001, 3.883855e-001,
+3.894925e-001, 3.905951e-001, 3.916976e-001, 3.927961e-001, 3.938918e-001, 3.949875e-001, 3.960805e-001, 3.971713e-001, 3.982622e-001, 3.993507e-001,
+4.004370e-001, 4.015233e-001, 4.026117e-001, 4.037037e-001, 4.047957e-001, 4.058865e-001, 4.069729e-001, 4.080594e-001, 4.091454e-001, 4.102150e-001,
+4.112845e-001, 4.123540e-001, 4.134183e-001, 4.144812e-001, 4.155441e-001, 4.166063e-001, 4.176677e-001, 4.187291e-001, 4.197882e-001, 4.208358e-001,
+4.218834e-001, 4.229310e-001, 4.239683e-001, 4.250030e-001, 4.260377e-001, 4.270703e-001, 4.280996e-001, 4.291290e-001, 4.301583e-001, 4.311894e-001,
+4.322208e-001, 4.332521e-001, 4.342833e-001, 4.353141e-001, 4.363449e-001, 4.373758e-001, 4.384073e-001, 4.394389e-001, 4.404705e-001, 4.415004e-001,
+4.425247e-001, 4.435490e-001, 4.445734e-001, 4.455991e-001, 4.466258e-001, 4.476525e-001, 4.486792e-001, 4.497005e-001, 4.507211e-001, 4.517416e-001,
+4.527609e-001, 4.537693e-001, 4.547777e-001, 4.557861e-001, 4.567916e-001, 4.577903e-001, 4.587890e-001, 4.597878e-001, 4.607864e-001, 4.617849e-001,
+4.627834e-001, 4.637819e-001, 4.647787e-001, 4.657740e-001, 4.667693e-001, 4.677645e-001, 4.687534e-001, 4.697373e-001, 4.707212e-001, 4.717051e-001,
+4.726847e-001, 4.736607e-001, 4.746366e-001, 4.756126e-001, 4.765883e-001, 4.775637e-001, 4.785391e-001, 4.795145e-001, 4.804913e-001, 4.814708e-001,
+4.824503e-001, 4.834298e-001, 4.844072e-001, 4.853728e-001, 4.863384e-001, 4.873039e-001, 4.882695e-001, 4.892266e-001, 4.901829e-001, 4.911391e-001,
+4.920954e-001, 4.930515e-001, 4.940074e-001, 4.949633e-001, 4.959193e-001, 4.968730e-001, 4.978204e-001, 4.987678e-001, 4.997152e-001, 5.006626e-001,
+5.016015e-001, 5.025386e-001, 5.034758e-001, 5.044130e-001, 5.053502e-001, 5.062875e-001, 5.072248e-001, 5.081621e-001, 5.090993e-001, 5.100328e-001,
+5.109654e-001, 5.118980e-001, 5.128306e-001, 5.137627e-001, 5.146926e-001, 5.156226e-001, 5.165526e-001, 5.174825e-001, 5.184154e-001, 5.193507e-001,
+5.202859e-001, 5.212211e-001, 5.221564e-001, 5.230833e-001, 5.240085e-001, 5.249337e-001, 5.258589e-001, 5.267839e-001, 5.277035e-001, 5.286231e-001,
+5.295427e-001, 5.304622e-001, 5.313824e-001, 5.323049e-001, 5.332274e-001, 5.341499e-001, 5.350724e-001, 5.359949e-001, 5.369172e-001, 5.378396e-001,
+5.387619e-001, 5.396842e-001, 5.406030e-001, 5.415124e-001, 5.424217e-001, 5.433311e-001, 5.442405e-001, 5.451485e-001, 5.460516e-001, 5.469546e-001,
+5.478577e-001, 5.487607e-001, 5.496640e-001, 5.505691e-001, 5.514743e-001, 5.523794e-001, 5.532846e-001, 5.541897e-001, 5.550884e-001, 5.559865e-001,
+5.568845e-001, 5.577826e-001, 5.586807e-001, 5.595684e-001, 5.604504e-001, 5.613324e-001, 5.622144e-001, 5.630964e-001, 5.639760e-001, 5.648501e-001,
+5.657242e-001, 5.665983e-001, 5.674724e-001, 5.683465e-001, 5.692208e-001, 5.700951e-001, 5.709695e-001, 5.718438e-001, 5.727181e-001, 5.735895e-001,
+5.744568e-001, 5.753241e-001, 5.761914e-001, 5.770587e-001, 5.779260e-001, 5.787827e-001, 5.796378e-001, 5.804928e-001, 5.813478e-001, 5.822029e-001,
+5.830556e-001, 5.839005e-001, 5.847454e-001, 5.855903e-001, 5.864353e-001, 5.872802e-001, 5.881241e-001, 5.889670e-001, 5.898099e-001, 5.906528e-001,
+5.914957e-001, 5.923386e-001, 5.931785e-001, 5.940174e-001, 5.948563e-001, 5.956952e-001, 5.965341e-001, 5.973730e-001, 5.982082e-001, 5.990428e-001,
+5.998774e-001, 6.007121e-001, 6.015467e-001, 6.023813e-001, 6.032110e-001, 6.040402e-001, 6.048695e-001, 6.056988e-001, 6.065281e-001, 6.073573e-001,
+6.081854e-001, 6.090134e-001, 6.098414e-001, 6.106694e-001, 6.114974e-001, 6.123253e-001, 6.131554e-001, 6.139859e-001, 6.148164e-001, 6.156469e-001,
+6.164775e-001, 6.173080e-001, 6.181306e-001, 6.189482e-001, 6.197659e-001, 6.205835e-001, 6.214011e-001, 6.222188e-001, 6.230333e-001, 6.238421e-001,
+6.246508e-001, 6.254595e-001, 6.262683e-001, 6.270770e-001, 6.278857e-001, 6.286914e-001, 6.294970e-001, 6.303027e-001, 6.311083e-001, 6.319140e-001,
+6.327197e-001, 6.335239e-001, 6.343270e-001, 6.351301e-001, 6.359332e-001, 6.367363e-001, 6.375394e-001, 6.383423e-001, 6.391350e-001, 6.399277e-001,
+6.407204e-001, 6.415132e-001, 6.423059e-001, 6.430986e-001, 6.438899e-001, 6.446790e-001, 6.454682e-001, 6.462573e-001, 6.470464e-001, 6.478356e-001,
+6.486247e-001, 6.494132e-001, 6.502012e-001, 6.509893e-001, 6.517774e-001, 6.525655e-001, 6.533536e-001, 6.541417e-001, 6.549354e-001, 6.557300e-001,
+6.565245e-001, 6.573191e-001, 6.581136e-001, 6.589082e-001, 6.597027e-001, 6.604956e-001, 6.612885e-001, 6.620813e-001, 6.628742e-001, 6.636670e-001,
+6.644599e-001, 6.652527e-001, 6.660355e-001, 6.668183e-001, 6.676011e-001, 6.683839e-001, 6.691667e-001, 6.699494e-001, 6.707322e-001, 6.715126e-001,
+6.722927e-001, 6.730729e-001, 6.738530e-001, 6.746331e-001, 6.754133e-001, 6.761934e-001, 6.769771e-001, 6.777620e-001, 6.785469e-001, 6.793317e-001,
+6.801166e-001, 6.809015e-001, 6.816864e-001, 6.824722e-001, 6.832591e-001, 6.840459e-001, 6.848328e-001, 6.856197e-001, 6.864065e-001, 6.871934e-001,
+6.879794e-001, 6.887571e-001, 6.895347e-001, 6.903124e-001, 6.910901e-001, 6.918678e-001, 6.926454e-001, 6.934231e-001, 6.941987e-001, 6.949730e-001,
+6.957472e-001, 6.965215e-001, 6.972958e-001, 6.980701e-001, 6.988443e-001, 6.996186e-001, 7.003934e-001, 7.011681e-001, 7.019429e-001, 7.027176e-001,
+7.034923e-001, 7.042671e-001, 7.050418e-001, 7.058115e-001, 7.065725e-001, 7.073335e-001, 7.080945e-001, 7.088556e-001, 7.096166e-001, 7.103776e-001,
+7.111386e-001, 7.118937e-001, 7.126445e-001, 7.133953e-001, 7.141462e-001, 7.148970e-001, 7.156479e-001, 7.163987e-001, 7.171496e-001, 7.178982e-001,
+7.186460e-001, 7.193937e-001, 7.201414e-001, 7.208891e-001, 7.216368e-001, 7.223845e-001, 7.231323e-001, 7.238803e-001, 7.246286e-001, 7.253768e-001,
+7.261251e-001, 7.268733e-001, 7.276216e-001, 7.283698e-001, 7.291180e-001, 7.298580e-001, 7.305926e-001, 7.313272e-001, 7.320618e-001, 7.327964e-001,
+7.335310e-001, 7.342656e-001, 7.350001e-001, 7.357306e-001, 7.364547e-001, 7.371787e-001, 7.379027e-001, 7.386268e-001, 7.393508e-001, 7.400749e-001,
+7.407989e-001, 7.415227e-001, 7.422429e-001, 7.429632e-001, 7.436835e-001, 7.444037e-001, 7.451240e-001, 7.458442e-001, 7.465645e-001, 7.472847e-001,
+7.480040e-001, 7.487227e-001, 7.494414e-001, 7.501601e-001, 7.508788e-001, 7.515975e-001, 7.523162e-001, 7.530349e-001, 7.537532e-001, 7.544673e-001,
+7.551813e-001, 7.558953e-001, 7.566094e-001, 7.573234e-001, 7.580374e-001, 7.587515e-001, 7.594655e-001, 7.601786e-001, 7.608903e-001, 7.616020e-001,
+7.623137e-001, 7.630254e-001, 7.637371e-001, 7.644489e-001, 7.651606e-001, 7.658723e-001, 7.665820e-001, 7.672904e-001, 7.679989e-001, 7.687074e-001,
+7.694158e-001, 7.701243e-001, 7.708327e-001, 7.715412e-001, 7.722497e-001, 7.729594e-001, 7.736696e-001, 7.743798e-001, 7.750899e-001, 7.758001e-001,
+7.765103e-001, 7.772205e-001, 7.779307e-001, 7.786409e-001, 7.793545e-001, 7.800695e-001, 7.807846e-001, 7.814996e-001, 7.822147e-001, 7.829297e-001,
+7.836448e-001, 7.843598e-001, 7.850749e-001, 7.857854e-001, 7.864920e-001, 7.871986e-001, 7.879051e-001, 7.886117e-001, 7.893183e-001, 7.900249e-001,
+7.907315e-001, 7.914381e-001, 7.921433e-001, 7.928449e-001, 7.935464e-001, 7.942479e-001, 7.949494e-001, 7.956509e-001, 7.963524e-001, 7.970539e-001,
+7.977555e-001, 7.984570e-001, 7.991585e-001, 7.998599e-001, 8.005614e-001, 8.012629e-001, 8.019643e-001, 8.026658e-001, 8.033673e-001, 8.040687e-001,
+8.047702e-001, 8.054718e-001, 8.061737e-001, 8.068756e-001, 8.075775e-001, 8.082794e-001, 8.089813e-001, 8.096832e-001, 8.103851e-001, 8.110869e-001,
+8.117888e-001, 8.124854e-001, 8.131794e-001, 8.138735e-001, 8.145676e-001, 8.152617e-001, 8.159558e-001, 8.166498e-001, 8.173439e-001, 8.180380e-001,
+8.187321e-001, 8.194222e-001, 8.201120e-001, 8.208017e-001, 8.214914e-001, 8.221811e-001, 8.228709e-001, 8.235606e-001, 8.242503e-001, 8.249400e-001,
+8.256298e-001, 8.263184e-001, 8.270071e-001, 8.276958e-001, 8.283844e-001, 8.290731e-001, 8.297618e-001, 8.304504e-001, 8.311391e-001, 8.318278e-001,
+8.325164e-001, 8.331937e-001, 8.338700e-001, 8.345464e-001, 8.352228e-001, 8.358992e-001, 8.365755e-001, 8.372519e-001, 8.379283e-001, 8.386047e-001,
+8.392811e-001, 8.399528e-001, 8.406228e-001, 8.412929e-001, 8.419630e-001, 8.426330e-001, 8.433031e-001, 8.439732e-001, 8.446432e-001, 8.453133e-001,
+8.459834e-001, 8.466515e-001, 8.473168e-001, 8.479821e-001, 8.486474e-001, 8.493127e-001, 8.499780e-001, 8.506433e-001, 8.513086e-001, 8.519739e-001,
+8.526392e-001, 8.533045e-001, 8.539714e-001, 8.546384e-001, 8.553054e-001, 8.559723e-001, 8.566393e-001, 8.573063e-001, 8.579732e-001, 8.586402e-001,
+8.593072e-001, 8.599741e-001, 8.606404e-001, 8.613053e-001, 8.619701e-001, 8.626350e-001, 8.632999e-001, 8.639647e-001, 8.646296e-001, 8.652945e-001,
+8.659593e-001, 8.666242e-001, 8.672891e-001, 8.679519e-001, 8.686133e-001, 8.692747e-001, 8.699361e-001, 8.705974e-001, 8.712588e-001, 8.719202e-001,
+8.725816e-001, 8.732429e-001, 8.739043e-001, 8.745657e-001, 8.752221e-001, 8.758761e-001, 8.765301e-001, 8.771840e-001, 8.778380e-001, 8.784920e-001,
+8.791460e-001, 8.798000e-001, 8.804540e-001, 8.811080e-001, 8.817619e-001, 8.824152e-001, 8.830681e-001, 8.837210e-001, 8.843739e-001, 8.850268e-001,
+8.856797e-001, 8.863326e-001, 8.869855e-001, 8.876384e-001, 8.882913e-001, 8.889442e-001, 8.895980e-001, 8.902531e-001, 8.909081e-001, 8.915632e-001,
+8.922183e-001, 8.928733e-001, 8.935284e-001, 8.941834e-001, 8.948385e-001, 8.954935e-001, 8.961486e-001, 8.968032e-001, 8.974526e-001, 8.981019e-001,
+8.987513e-001, 8.994006e-001, 9.000500e-001, 9.006994e-001, 9.013487e-001, 9.019981e-001, 9.026474e-001, 9.032968e-001, 9.039461e-001, 9.045926e-001,
+9.052368e-001, 9.058810e-001, 9.065252e-001, 9.071695e-001, 9.078137e-001, 9.084579e-001, 9.091021e-001, 9.097463e-001, 9.103906e-001, 9.110348e-001,
+9.116790e-001, 9.123210e-001, 9.129627e-001, 9.136045e-001, 9.142462e-001, 9.148880e-001, 9.155298e-001, 9.161715e-001, 9.168133e-001, 9.174550e-001,
+9.180968e-001, 9.187385e-001, 9.193800e-001, 9.200190e-001, 9.206580e-001, 9.212969e-001, 9.219359e-001, 9.225749e-001, 9.232138e-001, 9.238528e-001,
+9.244918e-001, 9.251308e-001, 9.257697e-001, 9.264087e-001, 9.270468e-001, 9.276784e-001, 9.283100e-001, 9.289416e-001, 9.295732e-001, 9.302048e-001,
+9.308364e-001, 9.314680e-001, 9.320995e-001, 9.327311e-001, 9.333627e-001, 9.339943e-001, 9.346259e-001, 9.352514e-001, 9.358768e-001, 9.365021e-001,
+9.371275e-001, 9.377528e-001, 9.383781e-001, 9.390035e-001, 9.396288e-001, 9.402542e-001, 9.408795e-001, 9.415048e-001, 9.421302e-001, 9.427515e-001,
+9.433709e-001, 9.439902e-001, 9.446096e-001, 9.452289e-001, 9.458482e-001, 9.464676e-001, 9.470869e-001, 9.477063e-001, 9.483256e-001, 9.489449e-001,
+9.495643e-001, 9.501816e-001, 9.507901e-001, 9.513987e-001, 9.520072e-001, 9.526158e-001, 9.532243e-001, 9.538329e-001, 9.544415e-001, 9.550500e-001,
+9.556586e-001, 9.562671e-001, 9.568757e-001, 9.574842e-001, 9.580840e-001, 9.586765e-001, 9.592690e-001, 9.598614e-001, 9.604539e-001, 9.610464e-001,
+9.616388e-001, 9.622313e-001, 9.628238e-001, 9.634163e-001, 9.640087e-001, 9.646012e-001, 9.651937e-001, 9.657723e-001, 9.663459e-001, 9.669195e-001,
+9.674930e-001, 9.680666e-001, 9.686402e-001, 9.692138e-001, 9.697873e-001, 9.703609e-001, 9.709345e-001, 9.715081e-001, 9.720816e-001, 9.726552e-001,
+9.732081e-001, 9.737539e-001, 9.742997e-001, 9.748454e-001, 9.753912e-001, 9.759370e-001, 9.764827e-001, 9.770285e-001, 9.775743e-001, 9.781200e-001,
+9.786658e-001, 9.792116e-001, 9.797573e-001, 9.802884e-001, 9.808088e-001, 9.813292e-001, 9.818496e-001, 9.823700e-001, 9.828904e-001, 9.834108e-001,
+9.839312e-001, 9.844516e-001, 9.849720e-001, 9.854924e-001, 9.860129e-001, 9.865333e-001, 9.870470e-001, 9.875390e-001, 9.880309e-001, 9.885229e-001,
+9.890148e-001, 9.895068e-001, 9.899987e-001, 9.904907e-001, 9.909826e-001, 9.914746e-001, 9.919665e-001, 9.924585e-001, 9.929505e-001, 9.934424e-001,
+9.939173e-001, 9.943852e-001, 9.948531e-001, 9.953210e-001, 9.957889e-001, 9.962568e-001, 9.967247e-001, 9.971926e-001, 9.976605e-001, 9.981284e-001,
+9.985963e-001, 9.990642e-001, 9.995321e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.745574e-003, 1.101337e-002, 1.561838e-002, 1.981306e-002, 2.363291e-002, 2.727294e-002, 3.068532e-002, 3.396774e-002, 3.714979e-002,
+4.022669e-002, 4.320206e-002, 4.606999e-002, 4.883636e-002, 5.155155e-002, 5.422157e-002, 5.684577e-002, 5.942567e-002, 6.196758e-002, 6.445417e-002,
+6.687812e-002, 6.926495e-002, 7.160698e-002, 7.393885e-002, 7.623720e-002, 7.851023e-002, 8.074176e-002, 8.295241e-002, 8.514209e-002, 8.730481e-002,
+8.945768e-002, 9.157508e-002, 9.366754e-002, 9.573912e-002, 9.777016e-002, 9.979196e-002, 1.018017e-001, 1.037893e-001, 1.057760e-001, 1.077485e-001,
+1.096967e-001, 1.116394e-001, 1.135682e-001, 1.154883e-001, 1.173893e-001, 1.192753e-001, 1.211494e-001, 1.229985e-001, 1.248320e-001, 1.266517e-001,
+1.284563e-001, 1.302371e-001, 1.320014e-001, 1.337444e-001, 1.354826e-001, 1.372071e-001, 1.389128e-001, 1.406111e-001, 1.423042e-001, 1.439954e-001,
+1.456900e-001, 1.473833e-001, 1.490697e-001, 1.507642e-001, 1.524640e-001, 1.541470e-001, 1.558177e-001, 1.574839e-001, 1.591471e-001, 1.608042e-001,
+1.624432e-001, 1.640714e-001, 1.656913e-001, 1.672881e-001, 1.688699e-001, 1.704351e-001, 1.719868e-001, 1.735249e-001, 1.750529e-001, 1.765847e-001,
+1.781220e-001, 1.796504e-001, 1.811677e-001, 1.826826e-001, 1.841963e-001, 1.857065e-001, 1.872135e-001, 1.887131e-001, 1.902054e-001, 1.916910e-001,
+1.931721e-001, 1.946519e-001, 1.961287e-001, 1.976062e-001, 1.990850e-001, 2.005599e-001, 2.020221e-001, 2.034724e-001, 2.049137e-001, 2.063476e-001,
+2.077757e-001, 2.092022e-001, 2.106287e-001, 2.120527e-001, 2.134691e-001, 2.148848e-001, 2.162963e-001, 2.177021e-001, 2.190997e-001, 2.204964e-001,
+2.218923e-001, 2.232879e-001, 2.246784e-001, 2.260642e-001, 2.274404e-001, 2.288105e-001, 2.301731e-001, 2.315273e-001, 2.328795e-001, 2.342298e-001,
+2.355792e-001, 2.369273e-001, 2.382657e-001, 2.396034e-001, 2.409402e-001, 2.422693e-001, 2.435952e-001, 2.449123e-001, 2.462285e-001, 2.475429e-001,
+2.488565e-001, 2.501695e-001, 2.514741e-001, 2.527768e-001, 2.540781e-001, 2.553772e-001, 2.566682e-001, 2.579559e-001, 2.592380e-001, 2.605187e-001,
+2.617981e-001, 2.630767e-001, 2.643548e-001, 2.656278e-001, 2.668987e-001, 2.681746e-001, 2.694520e-001, 2.707208e-001, 2.719873e-001, 2.732458e-001,
+2.745023e-001, 2.757558e-001, 2.770086e-001, 2.782612e-001, 2.795139e-001, 2.807643e-001, 2.820135e-001, 2.832611e-001, 2.845074e-001, 2.857489e-001,
+2.869836e-001, 2.882155e-001, 2.894395e-001, 2.906631e-001, 2.918823e-001, 2.931015e-001, 2.943179e-001, 2.955337e-001, 2.967429e-001, 2.979475e-001,
+2.991509e-001, 3.003518e-001, 3.015527e-001, 3.027420e-001, 3.039312e-001, 3.051137e-001, 3.062925e-001, 3.074702e-001, 3.086448e-001, 3.098195e-001,
+3.109913e-001, 3.121628e-001, 3.133305e-001, 3.144932e-001, 3.156560e-001, 3.168224e-001, 3.179890e-001, 3.191502e-001, 3.203047e-001, 3.214593e-001,
+3.226110e-001, 3.237625e-001, 3.249133e-001, 3.260629e-001, 3.272125e-001, 3.283613e-001, 3.295099e-001, 3.306581e-001, 3.318022e-001, 3.329462e-001,
+3.340887e-001, 3.352287e-001, 3.363687e-001, 3.375062e-001, 3.386425e-001, 3.397788e-001, 3.409083e-001, 3.420371e-001, 3.431654e-001, 3.442899e-001,
+3.454144e-001, 3.465386e-001, 3.476623e-001, 3.487859e-001, 3.499089e-001, 3.510311e-001, 3.521533e-001, 3.532768e-001, 3.544014e-001, 3.555260e-001,
+3.566437e-001, 3.577560e-001, 3.588683e-001, 3.599741e-001, 3.610751e-001, 3.621761e-001, 3.632729e-001, 3.643661e-001, 3.654592e-001, 3.665484e-001,
+3.676329e-001, 3.687175e-001, 3.698010e-001, 3.708826e-001, 3.719643e-001, 3.730462e-001, 3.741292e-001, 3.752123e-001, 3.762952e-001, 3.773654e-001,
+3.784357e-001, 3.795059e-001, 3.805727e-001, 3.816384e-001, 3.827041e-001, 3.837669e-001, 3.848268e-001, 3.858866e-001, 3.869450e-001, 3.879957e-001,
+3.890464e-001, 3.900970e-001, 3.911440e-001, 3.921900e-001, 3.932359e-001, 3.942803e-001, 3.953221e-001, 3.963639e-001, 3.974056e-001, 3.984431e-001,
+3.994801e-001, 4.005172e-001, 4.015509e-001, 4.025795e-001, 4.036081e-001, 4.046367e-001, 4.056607e-001, 4.066839e-001, 4.077070e-001, 4.087301e-001,
+4.097533e-001, 4.107764e-001, 4.117995e-001, 4.128247e-001, 4.138515e-001, 4.148782e-001, 4.159050e-001, 4.169327e-001, 4.179605e-001, 4.189884e-001,
+4.200156e-001, 4.210372e-001, 4.220588e-001, 4.230804e-001, 4.241015e-001, 4.251210e-001, 4.261406e-001, 4.271601e-001, 4.281784e-001, 4.291949e-001,
+4.302114e-001, 4.312279e-001, 4.322431e-001, 4.332572e-001, 4.342712e-001, 4.352853e-001, 4.362984e-001, 4.373108e-001, 4.383231e-001, 4.393355e-001,
+4.403477e-001, 4.413598e-001, 4.423719e-001, 4.433840e-001, 4.443917e-001, 4.453943e-001, 4.463969e-001, 4.473994e-001, 4.484009e-001, 4.494001e-001,
+4.503993e-001, 4.513984e-001, 4.523967e-001, 4.533890e-001, 4.543813e-001, 4.553737e-001, 4.563660e-001, 4.573511e-001, 4.583353e-001, 4.593194e-001,
+4.603036e-001, 4.612890e-001, 4.622752e-001, 4.632614e-001, 4.642477e-001, 4.652321e-001, 4.662107e-001, 4.671893e-001, 4.681679e-001, 4.691465e-001,
+4.701164e-001, 4.710844e-001, 4.720525e-001, 4.730205e-001, 4.739846e-001, 4.749414e-001, 4.758983e-001, 4.768551e-001, 4.778119e-001, 4.787622e-001,
+4.797110e-001, 4.806598e-001, 4.816085e-001, 4.825567e-001, 4.835024e-001, 4.844481e-001, 4.853938e-001, 4.863395e-001, 4.872839e-001, 4.882272e-001,
+4.891706e-001, 4.901140e-001, 4.910573e-001, 4.919950e-001, 4.929314e-001, 4.938678e-001, 4.948042e-001, 4.957407e-001, 4.966802e-001, 4.976196e-001,
+4.985591e-001, 4.994986e-001, 5.004375e-001, 5.013736e-001, 5.023098e-001, 5.032459e-001, 5.041820e-001, 5.051166e-001, 5.060468e-001, 5.069770e-001,
+5.079072e-001, 5.088373e-001, 5.097666e-001, 5.106935e-001, 5.116204e-001, 5.125473e-001, 5.134742e-001, 5.144009e-001, 5.153270e-001, 5.162532e-001,
+5.171793e-001, 5.181055e-001, 5.190313e-001, 5.199540e-001, 5.208766e-001, 5.217992e-001, 5.227219e-001, 5.236445e-001, 5.245587e-001, 5.254720e-001,
+5.263852e-001, 5.272984e-001, 5.282117e-001, 5.291251e-001, 5.300387e-001, 5.309523e-001, 5.318659e-001, 5.327795e-001, 5.336920e-001, 5.346015e-001,
+5.355111e-001, 5.364207e-001, 5.373303e-001, 5.382398e-001, 5.391464e-001, 5.400526e-001, 5.409587e-001, 5.418649e-001, 5.427711e-001, 5.436769e-001,
+5.445824e-001, 5.454879e-001, 5.463934e-001, 5.472989e-001, 5.482044e-001, 5.491034e-001, 5.500012e-001, 5.508990e-001, 5.517968e-001, 5.526946e-001,
+5.535923e-001, 5.544895e-001, 5.553867e-001, 5.562840e-001, 5.571812e-001, 5.580784e-001, 5.589732e-001, 5.598655e-001, 5.607578e-001, 5.616501e-001,
+5.625424e-001, 5.634347e-001, 5.643217e-001, 5.652067e-001, 5.660917e-001, 5.669767e-001, 5.678617e-001, 5.687467e-001, 5.696277e-001, 5.705081e-001,
+5.713885e-001, 5.722689e-001, 5.731493e-001, 5.740297e-001, 5.749082e-001, 5.757865e-001, 5.766647e-001, 5.775430e-001, 5.784213e-001, 5.792995e-001,
+5.801750e-001, 5.810501e-001, 5.819252e-001, 5.828003e-001, 5.836755e-001, 5.845506e-001, 5.854260e-001, 5.863015e-001, 5.871770e-001, 5.880525e-001,
+5.889280e-001, 5.898035e-001, 5.906724e-001, 5.915370e-001, 5.924015e-001, 5.932661e-001, 5.941307e-001, 5.949952e-001, 5.958584e-001, 5.967188e-001,
+5.975792e-001, 5.984395e-001, 5.992999e-001, 6.001603e-001, 6.010207e-001, 6.018776e-001, 6.027345e-001, 6.035914e-001, 6.044483e-001, 6.053052e-001,
+6.061620e-001, 6.070174e-001, 6.078713e-001, 6.087253e-001, 6.095792e-001, 6.104332e-001, 6.112871e-001, 6.121410e-001, 6.129897e-001, 6.138384e-001,
+6.146871e-001, 6.155358e-001, 6.163845e-001, 6.172332e-001, 6.180807e-001, 6.189264e-001, 6.197722e-001, 6.206179e-001, 6.214636e-001, 6.223093e-001,
+6.231550e-001, 6.240007e-001, 6.248464e-001, 6.256921e-001, 6.265378e-001, 6.273834e-001, 6.282291e-001, 6.290748e-001, 6.299115e-001, 6.307469e-001,
+6.315823e-001, 6.324177e-001, 6.332531e-001, 6.340886e-001, 6.349240e-001, 6.357484e-001, 6.365725e-001, 6.373967e-001, 6.382208e-001, 6.390450e-001,
+6.398692e-001, 6.406933e-001, 6.415145e-001, 6.423356e-001, 6.431567e-001, 6.439778e-001, 6.447989e-001, 6.456201e-001, 6.464412e-001, 6.472592e-001,
+6.480770e-001, 6.488947e-001, 6.497125e-001, 6.505302e-001, 6.513480e-001, 6.521658e-001, 6.529844e-001, 6.538034e-001, 6.546224e-001, 6.554414e-001,
+6.562603e-001, 6.570793e-001, 6.578983e-001, 6.587166e-001, 6.595342e-001, 6.603517e-001, 6.611692e-001, 6.619867e-001, 6.628043e-001, 6.636218e-001,
+6.644391e-001, 6.652536e-001, 6.660681e-001, 6.668827e-001, 6.676972e-001, 6.685117e-001, 6.693262e-001, 6.701408e-001, 6.709530e-001, 6.717637e-001,
+6.725745e-001, 6.733852e-001, 6.741960e-001, 6.750067e-001, 6.758174e-001, 6.766281e-001, 6.774358e-001, 6.782434e-001, 6.790511e-001, 6.798588e-001,
+6.806665e-001, 6.814742e-001, 6.822819e-001, 6.830887e-001, 6.838941e-001, 6.846995e-001, 6.855048e-001, 6.863102e-001, 6.871155e-001, 6.879209e-001,
+6.887263e-001, 6.895337e-001, 6.903426e-001, 6.911515e-001, 6.919604e-001, 6.927693e-001, 6.935782e-001, 6.943871e-001, 6.951960e-001, 6.960002e-001,
+6.968024e-001, 6.976047e-001, 6.984069e-001, 6.992091e-001, 7.000113e-001, 7.008135e-001, 7.016157e-001, 7.024155e-001, 7.032142e-001, 7.040129e-001,
+7.048116e-001, 7.056103e-001, 7.064090e-001, 7.072077e-001, 7.080064e-001, 7.088026e-001, 7.095971e-001, 7.103916e-001, 7.111861e-001, 7.119805e-001,
+7.127750e-001, 7.135695e-001, 7.143640e-001, 7.151565e-001, 7.159457e-001, 7.167349e-001, 7.175241e-001, 7.183134e-001, 7.191026e-001, 7.198918e-001,
+7.206810e-001, 7.214697e-001, 7.222498e-001, 7.230298e-001, 7.238098e-001, 7.245899e-001, 7.253699e-001, 7.261500e-001, 7.269300e-001, 7.277100e-001,
+7.284894e-001, 7.292685e-001, 7.300475e-001, 7.308265e-001, 7.316056e-001, 7.323846e-001, 7.331636e-001, 7.339427e-001, 7.347213e-001, 7.354944e-001,
+7.362675e-001, 7.370407e-001, 7.378138e-001, 7.385869e-001, 7.393600e-001, 7.401331e-001, 7.409063e-001, 7.416763e-001, 7.424416e-001, 7.432069e-001,
+7.439723e-001, 7.447376e-001, 7.455030e-001, 7.462683e-001, 7.470336e-001, 7.477990e-001, 7.485641e-001, 7.493290e-001, 7.500940e-001, 7.508589e-001,
+7.516239e-001, 7.523888e-001, 7.531538e-001, 7.539188e-001, 7.546837e-001, 7.554478e-001, 7.562116e-001, 7.569754e-001, 7.577392e-001, 7.585030e-001,
+7.592668e-001, 7.600306e-001, 7.607944e-001, 7.615582e-001, 7.623157e-001, 7.630702e-001, 7.638248e-001, 7.645793e-001, 7.653339e-001, 7.660884e-001,
+7.668430e-001, 7.675975e-001, 7.683521e-001, 7.691050e-001, 7.698564e-001, 7.706079e-001, 7.713593e-001, 7.721108e-001, 7.728622e-001, 7.736137e-001,
+7.743651e-001, 7.751166e-001, 7.758662e-001, 7.766108e-001, 7.773554e-001, 7.781001e-001, 7.788447e-001, 7.795893e-001, 7.803339e-001, 7.810785e-001,
+7.818232e-001, 7.825678e-001, 7.833090e-001, 7.840498e-001, 7.847905e-001, 7.855312e-001, 7.862720e-001, 7.870127e-001, 7.877534e-001, 7.884941e-001,
+7.892349e-001, 7.899757e-001, 7.907167e-001, 7.914577e-001, 7.921988e-001, 7.929398e-001, 7.936808e-001, 7.944218e-001, 7.951628e-001, 7.959039e-001,
+7.966449e-001, 7.973858e-001, 7.981266e-001, 7.988674e-001, 7.996082e-001, 8.003490e-001, 8.010898e-001, 8.018306e-001, 8.025714e-001, 8.033122e-001,
+8.040530e-001, 8.047931e-001, 8.055330e-001, 8.062730e-001, 8.070129e-001, 8.077529e-001, 8.084928e-001, 8.092328e-001, 8.099727e-001, 8.107127e-001,
+8.114526e-001, 8.121871e-001, 8.129215e-001, 8.136559e-001, 8.143903e-001, 8.151247e-001, 8.158590e-001, 8.165934e-001, 8.173278e-001, 8.180622e-001,
+8.187966e-001, 8.195257e-001, 8.202544e-001, 8.209831e-001, 8.217117e-001, 8.224404e-001, 8.231691e-001, 8.238978e-001, 8.246265e-001, 8.253552e-001,
+8.260838e-001, 8.268138e-001, 8.275441e-001, 8.282745e-001, 8.290049e-001, 8.297352e-001, 8.304656e-001, 8.311959e-001, 8.319263e-001, 8.326567e-001,
+8.333870e-001, 8.341168e-001, 8.348455e-001, 8.355743e-001, 8.363031e-001, 8.370318e-001, 8.377606e-001, 8.384894e-001, 8.392182e-001, 8.399469e-001,
+8.406757e-001, 8.414045e-001, 8.421310e-001, 8.428574e-001, 8.435838e-001, 8.443102e-001, 8.450366e-001, 8.457630e-001, 8.464894e-001, 8.472158e-001,
+8.479421e-001, 8.486685e-001, 8.493939e-001, 8.501171e-001, 8.508403e-001, 8.515636e-001, 8.522868e-001, 8.530100e-001, 8.537332e-001, 8.544565e-001,
+8.551797e-001, 8.559029e-001, 8.566261e-001, 8.573492e-001, 8.580722e-001, 8.587951e-001, 8.595181e-001, 8.602411e-001, 8.609640e-001, 8.616870e-001,
+8.624100e-001, 8.631329e-001, 8.638559e-001, 8.645789e-001, 8.652966e-001, 8.660117e-001, 8.667268e-001, 8.674419e-001, 8.681571e-001, 8.688722e-001,
+8.695873e-001, 8.703025e-001, 8.710176e-001, 8.717327e-001, 8.724479e-001, 8.731632e-001, 8.738788e-001, 8.745943e-001, 8.753099e-001, 8.760254e-001,
+8.767409e-001, 8.774565e-001, 8.781720e-001, 8.788875e-001, 8.796031e-001, 8.803186e-001, 8.810324e-001, 8.817438e-001, 8.824552e-001, 8.831665e-001,
+8.838779e-001, 8.845893e-001, 8.853007e-001, 8.860121e-001, 8.867235e-001, 8.874348e-001, 8.881462e-001, 8.888575e-001, 8.895666e-001, 8.902758e-001,
+8.909850e-001, 8.916942e-001, 8.924034e-001, 8.931126e-001, 8.938218e-001, 8.945309e-001, 8.952401e-001, 8.959493e-001, 8.966585e-001, 8.973668e-001,
+8.980745e-001, 8.987821e-001, 8.994898e-001, 9.001974e-001, 9.009051e-001, 9.016128e-001, 9.023204e-001, 9.030281e-001, 9.037357e-001, 9.044434e-001,
+9.051510e-001, 9.058521e-001, 9.065524e-001, 9.072528e-001, 9.079532e-001, 9.086536e-001, 9.093540e-001, 9.100543e-001, 9.107547e-001, 9.114551e-001,
+9.121555e-001, 9.128558e-001, 9.135551e-001, 9.142435e-001, 9.149318e-001, 9.156202e-001, 9.163085e-001, 9.169969e-001, 9.176852e-001, 9.183736e-001,
+9.190619e-001, 9.197503e-001, 9.204387e-001, 9.211270e-001, 9.218143e-001, 9.224933e-001, 9.231722e-001, 9.238512e-001, 9.245301e-001, 9.252091e-001,
+9.258880e-001, 9.265670e-001, 9.272459e-001, 9.279249e-001, 9.286039e-001, 9.292828e-001, 9.299618e-001, 9.306330e-001, 9.313039e-001, 9.319749e-001,
+9.326458e-001, 9.333167e-001, 9.339877e-001, 9.346586e-001, 9.353296e-001, 9.360005e-001, 9.366715e-001, 9.373424e-001, 9.380134e-001, 9.386783e-001,
+9.393402e-001, 9.400020e-001, 9.406639e-001, 9.413258e-001, 9.419877e-001, 9.426495e-001, 9.433114e-001, 9.439733e-001, 9.446351e-001, 9.452970e-001,
+9.459589e-001, 9.466191e-001, 9.472720e-001, 9.479249e-001, 9.485779e-001, 9.492308e-001, 9.498837e-001, 9.505366e-001, 9.511896e-001, 9.518425e-001,
+9.524954e-001, 9.531484e-001, 9.538013e-001, 9.544542e-001, 9.551011e-001, 9.557430e-001, 9.563848e-001, 9.570267e-001, 9.576685e-001, 9.583104e-001,
+9.589522e-001, 9.595941e-001, 9.602360e-001, 9.608778e-001, 9.615197e-001, 9.621615e-001, 9.628034e-001, 9.634308e-001, 9.640529e-001, 9.646750e-001,
+9.652972e-001, 9.659193e-001, 9.665414e-001, 9.671635e-001, 9.677856e-001, 9.684077e-001, 9.690298e-001, 9.696520e-001, 9.702741e-001, 9.708962e-001,
+9.714969e-001, 9.720902e-001, 9.726835e-001, 9.732768e-001, 9.738701e-001, 9.744634e-001, 9.750567e-001, 9.756499e-001, 9.762432e-001, 9.768365e-001,
+9.774298e-001, 9.780231e-001, 9.786164e-001, 9.791917e-001, 9.797538e-001, 9.803159e-001, 9.808780e-001, 9.814401e-001, 9.820022e-001, 9.825643e-001,
+9.831264e-001, 9.836885e-001, 9.842506e-001, 9.848127e-001, 9.853748e-001, 9.859368e-001, 9.864905e-001, 9.870165e-001, 9.875424e-001, 9.880683e-001,
+9.885943e-001, 9.891202e-001, 9.896461e-001, 9.901721e-001, 9.906980e-001, 9.912239e-001, 9.917499e-001, 9.922758e-001, 9.928018e-001, 9.933277e-001,
+9.938179e-001, 9.942935e-001, 9.947690e-001, 9.952446e-001, 9.957201e-001, 9.961957e-001, 9.966712e-001, 9.971467e-001, 9.976223e-001, 9.980978e-001,
+9.985734e-001, 9.990489e-001, 9.995245e-001, 1.000000e+000)),
+("Kodak", "Portra 800", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.812428e-003, 1.731826e-002, 2.500979e-002, 3.186754e-002, 3.824581e-002, 4.409079e-002, 4.969138e-002, 5.495934e-002, 6.001880e-002,
+6.482574e-002, 6.946606e-002, 7.396590e-002, 7.828632e-002, 8.245077e-002, 8.649290e-002, 9.046974e-002, 9.432731e-002, 9.810246e-002, 1.018401e-001,
+1.054691e-001, 1.090489e-001, 1.125440e-001, 1.159221e-001, 1.192713e-001, 1.225582e-001, 1.257861e-001, 1.289589e-001, 1.321442e-001, 1.352636e-001,
+1.383159e-001, 1.413582e-001, 1.443577e-001, 1.472718e-001, 1.501351e-001, 1.529816e-001, 1.558008e-001, 1.586033e-001, 1.613504e-001, 1.640669e-001,
+1.667777e-001, 1.694520e-001, 1.720924e-001, 1.746968e-001, 1.772591e-001, 1.797760e-001, 1.822801e-001, 1.847687e-001, 1.872310e-001, 1.896562e-001,
+1.920384e-001, 1.944015e-001, 1.967526e-001, 1.990911e-001, 2.014011e-001, 2.037015e-001, 2.060169e-001, 2.083324e-001, 2.106439e-001, 2.129283e-001,
+2.151844e-001, 2.174350e-001, 2.196765e-001, 2.219023e-001, 2.241205e-001, 2.263172e-001, 2.284787e-001, 2.306169e-001, 2.327333e-001, 2.348273e-001,
+2.369115e-001, 2.389767e-001, 2.410170e-001, 2.430370e-001, 2.450459e-001, 2.470475e-001, 2.490427e-001, 2.510350e-001, 2.530182e-001, 2.549868e-001,
+2.569331e-001, 2.588599e-001, 2.607747e-001, 2.626814e-001, 2.645847e-001, 2.664898e-001, 2.683837e-001, 2.702632e-001, 2.721141e-001, 2.739478e-001,
+2.757706e-001, 2.775854e-001, 2.794038e-001, 2.812231e-001, 2.830418e-001, 2.848351e-001, 2.866136e-001, 2.883686e-001, 2.901135e-001, 2.918517e-001,
+2.935770e-001, 2.953031e-001, 2.970305e-001, 2.987627e-001, 3.004962e-001, 3.022179e-001, 3.039327e-001, 3.056339e-001, 3.073236e-001, 3.090057e-001,
+3.106757e-001, 3.123433e-001, 3.140108e-001, 3.156793e-001, 3.173511e-001, 3.190176e-001, 3.206757e-001, 3.223229e-001, 3.239594e-001, 3.255837e-001,
+3.271996e-001, 3.288048e-001, 3.304042e-001, 3.320014e-001, 3.335976e-001, 3.351889e-001, 3.367778e-001, 3.383550e-001, 3.399256e-001, 3.414828e-001,
+3.430298e-001, 3.445637e-001, 3.460822e-001, 3.475958e-001, 3.490990e-001, 3.506018e-001, 3.521027e-001, 3.536036e-001, 3.551059e-001, 3.566082e-001,
+3.580995e-001, 3.595857e-001, 3.610610e-001, 3.625204e-001, 3.639777e-001, 3.654134e-001, 3.668491e-001, 3.682769e-001, 3.697017e-001, 3.711272e-001,
+3.725540e-001, 3.739808e-001, 3.754134e-001, 3.768466e-001, 3.782753e-001, 3.796979e-001, 3.811204e-001, 3.825325e-001, 3.839436e-001, 3.853505e-001,
+3.867499e-001, 3.881493e-001, 3.895345e-001, 3.909152e-001, 3.922944e-001, 3.936628e-001, 3.950311e-001, 3.963942e-001, 3.977502e-001, 3.991063e-001,
+4.004458e-001, 4.017783e-001, 4.031107e-001, 4.044226e-001, 4.057330e-001, 4.070421e-001, 4.083416e-001, 4.096411e-001, 4.109367e-001, 4.122210e-001,
+4.135053e-001, 4.147842e-001, 4.160530e-001, 4.173217e-001, 4.185840e-001, 4.198360e-001, 4.210879e-001, 4.223288e-001, 4.235516e-001, 4.247743e-001,
+4.259924e-001, 4.272009e-001, 4.284093e-001, 4.296151e-001, 4.308117e-001, 4.320084e-001, 4.332041e-001, 4.343877e-001, 4.355713e-001, 4.367548e-001,
+4.379392e-001, 4.391237e-001, 4.403083e-001, 4.414937e-001, 4.426796e-001, 4.438656e-001, 4.450480e-001, 4.462217e-001, 4.473954e-001, 4.485691e-001,
+4.497333e-001, 4.508968e-001, 4.520604e-001, 4.532183e-001, 4.543709e-001, 4.555235e-001, 4.566759e-001, 4.578221e-001, 4.589683e-001, 4.601145e-001,
+4.612562e-001, 4.623935e-001, 4.635308e-001, 4.646682e-001, 4.657954e-001, 4.669216e-001, 4.680478e-001, 4.691723e-001, 4.702918e-001, 4.714112e-001,
+4.725307e-001, 4.736501e-001, 4.747695e-001, 4.758890e-001, 4.770084e-001, 4.781275e-001, 4.792464e-001, 4.803654e-001, 4.814843e-001, 4.825978e-001,
+4.837110e-001, 4.848242e-001, 4.859368e-001, 4.870402e-001, 4.881435e-001, 4.892468e-001, 4.903484e-001, 4.914353e-001, 4.925222e-001, 4.936090e-001,
+4.946955e-001, 4.957770e-001, 4.968584e-001, 4.979399e-001, 4.990214e-001, 5.000976e-001, 5.011738e-001, 5.022500e-001, 5.033262e-001, 5.043833e-001,
+5.054368e-001, 5.064904e-001, 5.075440e-001, 5.085870e-001, 5.096237e-001, 5.106604e-001, 5.116971e-001, 5.127326e-001, 5.137655e-001, 5.147984e-001,
+5.158313e-001, 5.168642e-001, 5.178936e-001, 5.189229e-001, 5.199522e-001, 5.209816e-001, 5.220068e-001, 5.230285e-001, 5.240503e-001, 5.250720e-001,
+5.260933e-001, 5.271026e-001, 5.281119e-001, 5.291212e-001, 5.301305e-001, 5.311339e-001, 5.321304e-001, 5.331269e-001, 5.341234e-001, 5.351198e-001,
+5.361113e-001, 5.371017e-001, 5.380920e-001, 5.390823e-001, 5.400725e-001, 5.410608e-001, 5.420491e-001, 5.430375e-001, 5.440258e-001, 5.450109e-001,
+5.459878e-001, 5.469647e-001, 5.479416e-001, 5.489185e-001, 5.498881e-001, 5.508466e-001, 5.518052e-001, 5.527637e-001, 5.537223e-001, 5.546782e-001,
+5.556307e-001, 5.565833e-001, 5.575358e-001, 5.584883e-001, 5.594410e-001, 5.603938e-001, 5.613466e-001, 5.622995e-001, 5.632523e-001, 5.642019e-001,
+5.651431e-001, 5.660842e-001, 5.670254e-001, 5.679666e-001, 5.689065e-001, 5.698278e-001, 5.707491e-001, 5.716704e-001, 5.725917e-001, 5.735130e-001,
+5.744281e-001, 5.753415e-001, 5.762548e-001, 5.771682e-001, 5.780815e-001, 5.789892e-001, 5.798880e-001, 5.807867e-001, 5.816855e-001, 5.825843e-001,
+5.834830e-001, 5.843645e-001, 5.852445e-001, 5.861245e-001, 5.870045e-001, 5.878845e-001, 5.887588e-001, 5.896231e-001, 5.904875e-001, 5.913518e-001,
+5.922162e-001, 5.930805e-001, 5.939382e-001, 5.947932e-001, 5.956482e-001, 5.965033e-001, 5.973583e-001, 5.982133e-001, 5.990639e-001, 5.999143e-001,
+6.007647e-001, 6.016151e-001, 6.024655e-001, 6.033153e-001, 6.041615e-001, 6.050077e-001, 6.058538e-001, 6.067000e-001, 6.075462e-001, 6.083909e-001,
+6.092299e-001, 6.100690e-001, 6.109081e-001, 6.117472e-001, 6.125863e-001, 6.134226e-001, 6.142470e-001, 6.150715e-001, 6.158960e-001, 6.167205e-001,
+6.175450e-001, 6.183693e-001, 6.191921e-001, 6.200149e-001, 6.208377e-001, 6.216605e-001, 6.224833e-001, 6.233062e-001, 6.241316e-001, 6.249575e-001,
+6.257833e-001, 6.266092e-001, 6.274351e-001, 6.282610e-001, 6.290842e-001, 6.299049e-001, 6.307256e-001, 6.315464e-001, 6.323671e-001, 6.331878e-001,
+6.340079e-001, 6.348219e-001, 6.356359e-001, 6.364499e-001, 6.372639e-001, 6.380779e-001, 6.388919e-001, 6.397082e-001, 6.405262e-001, 6.413442e-001,
+6.421622e-001, 6.429803e-001, 6.437983e-001, 6.446163e-001, 6.454325e-001, 6.462485e-001, 6.470645e-001, 6.478806e-001, 6.486966e-001, 6.495126e-001,
+6.503265e-001, 6.511305e-001, 6.519344e-001, 6.527383e-001, 6.535422e-001, 6.543462e-001, 6.551501e-001, 6.559516e-001, 6.567479e-001, 6.575443e-001,
+6.583406e-001, 6.591369e-001, 6.599332e-001, 6.607296e-001, 6.615231e-001, 6.623114e-001, 6.630997e-001, 6.638880e-001, 6.646762e-001, 6.654645e-001,
+6.662528e-001, 6.670368e-001, 6.678088e-001, 6.685809e-001, 6.693529e-001, 6.701249e-001, 6.708970e-001, 6.716690e-001, 6.724402e-001, 6.731993e-001,
+6.739584e-001, 6.747175e-001, 6.754767e-001, 6.762358e-001, 6.769949e-001, 6.777541e-001, 6.785085e-001, 6.792613e-001, 6.800142e-001, 6.807670e-001,
+6.815198e-001, 6.822727e-001, 6.830255e-001, 6.837748e-001, 6.845165e-001, 6.852582e-001, 6.859999e-001, 6.867416e-001, 6.874832e-001, 6.882249e-001,
+6.889666e-001, 6.897013e-001, 6.904339e-001, 6.911664e-001, 6.918990e-001, 6.926315e-001, 6.933640e-001, 6.940966e-001, 6.948286e-001, 6.955538e-001,
+6.962791e-001, 6.970044e-001, 6.977297e-001, 6.984550e-001, 6.991803e-001, 6.999056e-001, 7.006272e-001, 7.013388e-001, 7.020504e-001, 7.027621e-001,
+7.034737e-001, 7.041853e-001, 7.048970e-001, 7.056086e-001, 7.063144e-001, 7.070090e-001, 7.077037e-001, 7.083983e-001, 7.090929e-001, 7.097875e-001,
+7.104821e-001, 7.111767e-001, 7.118694e-001, 7.125569e-001, 7.132445e-001, 7.139321e-001, 7.146196e-001, 7.153072e-001, 7.159948e-001, 7.166824e-001,
+7.173695e-001, 7.180529e-001, 7.187363e-001, 7.194197e-001, 7.201030e-001, 7.207864e-001, 7.214698e-001, 7.221531e-001, 7.228365e-001, 7.235093e-001,
+7.241788e-001, 7.248483e-001, 7.255179e-001, 7.261874e-001, 7.268569e-001, 7.275264e-001, 7.281959e-001, 7.288634e-001, 7.295260e-001, 7.301887e-001,
+7.308513e-001, 7.315140e-001, 7.321766e-001, 7.328393e-001, 7.335019e-001, 7.341646e-001, 7.348305e-001, 7.354978e-001, 7.361652e-001, 7.368325e-001,
+7.374998e-001, 7.381672e-001, 7.388345e-001, 7.395018e-001, 7.401691e-001, 7.408332e-001, 7.414971e-001, 7.421609e-001, 7.428248e-001, 7.434887e-001,
+7.441526e-001, 7.448164e-001, 7.454803e-001, 7.461434e-001, 7.467959e-001, 7.474485e-001, 7.481011e-001, 7.487536e-001, 7.494062e-001, 7.500588e-001,
+7.507113e-001, 7.513639e-001, 7.520165e-001, 7.526692e-001, 7.533219e-001, 7.539746e-001, 7.546273e-001, 7.552800e-001, 7.559327e-001, 7.565854e-001,
+7.572381e-001, 7.578908e-001, 7.585410e-001, 7.591910e-001, 7.598409e-001, 7.604908e-001, 7.611407e-001, 7.617906e-001, 7.624406e-001, 7.630905e-001,
+7.637404e-001, 7.643837e-001, 7.650216e-001, 7.656595e-001, 7.662973e-001, 7.669352e-001, 7.675730e-001, 7.682109e-001, 7.688488e-001, 7.694866e-001,
+7.701241e-001, 7.707566e-001, 7.713890e-001, 7.720215e-001, 7.726540e-001, 7.732864e-001, 7.739189e-001, 7.745513e-001, 7.751838e-001, 7.758163e-001,
+7.764492e-001, 7.770828e-001, 7.777164e-001, 7.783500e-001, 7.789836e-001, 7.796172e-001, 7.802508e-001, 7.808844e-001, 7.815180e-001, 7.821516e-001,
+7.827800e-001, 7.834056e-001, 7.840313e-001, 7.846569e-001, 7.852826e-001, 7.859082e-001, 7.865339e-001, 7.871595e-001, 7.877852e-001, 7.884108e-001,
+7.890290e-001, 7.896440e-001, 7.902589e-001, 7.908739e-001, 7.914889e-001, 7.921039e-001, 7.927189e-001, 7.933339e-001, 7.939489e-001, 7.945639e-001,
+7.951789e-001, 7.957940e-001, 7.964091e-001, 7.970242e-001, 7.976393e-001, 7.982544e-001, 7.988696e-001, 7.994847e-001, 8.000998e-001, 8.007149e-001,
+8.013292e-001, 8.019416e-001, 8.025541e-001, 8.031666e-001, 8.037791e-001, 8.043916e-001, 8.050041e-001, 8.056166e-001, 8.062291e-001, 8.068416e-001,
+8.074541e-001, 8.080566e-001, 8.086578e-001, 8.092589e-001, 8.098600e-001, 8.104611e-001, 8.110623e-001, 8.116634e-001, 8.122645e-001, 8.128657e-001,
+8.134668e-001, 8.140666e-001, 8.146626e-001, 8.152587e-001, 8.158547e-001, 8.164507e-001, 8.170468e-001, 8.176428e-001, 8.182388e-001, 8.188349e-001,
+8.194309e-001, 8.200269e-001, 8.206235e-001, 8.212206e-001, 8.218177e-001, 8.224148e-001, 8.230119e-001, 8.236090e-001, 8.242061e-001, 8.248032e-001,
+8.254003e-001, 8.259974e-001, 8.265945e-001, 8.271878e-001, 8.277774e-001, 8.283670e-001, 8.289566e-001, 8.295463e-001, 8.301359e-001, 8.307255e-001,
+8.313151e-001, 8.319047e-001, 8.324943e-001, 8.330839e-001, 8.336698e-001, 8.342494e-001, 8.348290e-001, 8.354085e-001, 8.359881e-001, 8.365677e-001,
+8.371473e-001, 8.377268e-001, 8.383064e-001, 8.388860e-001, 8.394655e-001, 8.400451e-001, 8.406248e-001, 8.412045e-001, 8.417841e-001, 8.423638e-001,
+8.429435e-001, 8.435232e-001, 8.441029e-001, 8.446826e-001, 8.452622e-001, 8.458419e-001, 8.464216e-001, 8.469976e-001, 8.475705e-001, 8.481434e-001,
+8.487163e-001, 8.492892e-001, 8.498621e-001, 8.504350e-001, 8.510080e-001, 8.515809e-001, 8.521538e-001, 8.527267e-001, 8.532996e-001, 8.538609e-001,
+8.544202e-001, 8.549794e-001, 8.555387e-001, 8.560979e-001, 8.566572e-001, 8.572164e-001, 8.577757e-001, 8.583349e-001, 8.588942e-001, 8.594534e-001,
+8.600127e-001, 8.605682e-001, 8.611236e-001, 8.616791e-001, 8.622345e-001, 8.627899e-001, 8.633453e-001, 8.639007e-001, 8.644561e-001, 8.650115e-001,
+8.655669e-001, 8.661223e-001, 8.666777e-001, 8.672348e-001, 8.677921e-001, 8.683494e-001, 8.689067e-001, 8.694639e-001, 8.700212e-001, 8.705785e-001,
+8.711358e-001, 8.716931e-001, 8.722504e-001, 8.728077e-001, 8.733650e-001, 8.739186e-001, 8.744699e-001, 8.750212e-001, 8.755724e-001, 8.761237e-001,
+8.766749e-001, 8.772262e-001, 8.777774e-001, 8.783287e-001, 8.788799e-001, 8.794312e-001, 8.799824e-001, 8.805326e-001, 8.810754e-001, 8.816182e-001,
+8.821610e-001, 8.827038e-001, 8.832466e-001, 8.837893e-001, 8.843321e-001, 8.848749e-001, 8.854177e-001, 8.859605e-001, 8.865033e-001, 8.870460e-001,
+8.875892e-001, 8.881330e-001, 8.886767e-001, 8.892205e-001, 8.897642e-001, 8.903079e-001, 8.908517e-001, 8.913954e-001, 8.919392e-001, 8.924829e-001,
+8.930266e-001, 8.935704e-001, 8.941141e-001, 8.946548e-001, 8.951931e-001, 8.957314e-001, 8.962697e-001, 8.968080e-001, 8.973464e-001, 8.978847e-001,
+8.984230e-001, 8.989613e-001, 8.994996e-001, 9.000379e-001, 9.005762e-001, 9.011145e-001, 9.016473e-001, 9.021737e-001, 9.027002e-001, 9.032266e-001,
+9.037530e-001, 9.042794e-001, 9.048058e-001, 9.053322e-001, 9.058587e-001, 9.063851e-001, 9.069115e-001, 9.074379e-001, 9.079643e-001, 9.084903e-001,
+9.090140e-001, 9.095377e-001, 9.100614e-001, 9.105851e-001, 9.111088e-001, 9.116325e-001, 9.121562e-001, 9.126799e-001, 9.132036e-001, 9.137273e-001,
+9.142510e-001, 9.147748e-001, 9.152985e-001, 9.158238e-001, 9.163501e-001, 9.168764e-001, 9.174027e-001, 9.179290e-001, 9.184553e-001, 9.189816e-001,
+9.195079e-001, 9.200342e-001, 9.205605e-001, 9.210868e-001, 9.216130e-001, 9.221393e-001, 9.226656e-001, 9.231877e-001, 9.237092e-001, 9.242307e-001,
+9.247521e-001, 9.252736e-001, 9.257951e-001, 9.263165e-001, 9.268380e-001, 9.273594e-001, 9.278809e-001, 9.284024e-001, 9.289238e-001, 9.294453e-001,
+9.299668e-001, 9.304790e-001, 9.309902e-001, 9.315014e-001, 9.320126e-001, 9.325237e-001, 9.330349e-001, 9.335461e-001, 9.340573e-001, 9.345685e-001,
+9.350797e-001, 9.355909e-001, 9.361020e-001, 9.366132e-001, 9.371244e-001, 9.376301e-001, 9.381334e-001, 9.386367e-001, 9.391400e-001, 9.396432e-001,
+9.401465e-001, 9.406498e-001, 9.411531e-001, 9.416564e-001, 9.421597e-001, 9.426630e-001, 9.431663e-001, 9.436695e-001, 9.441728e-001, 9.446741e-001,
+9.451695e-001, 9.456649e-001, 9.461604e-001, 9.466558e-001, 9.471513e-001, 9.476467e-001, 9.481422e-001, 9.486376e-001, 9.491331e-001, 9.496285e-001,
+9.501240e-001, 9.506194e-001, 9.511149e-001, 9.516103e-001, 9.521000e-001, 9.525858e-001, 9.530716e-001, 9.535575e-001, 9.540433e-001, 9.545291e-001,
+9.550149e-001, 9.555007e-001, 9.559866e-001, 9.564724e-001, 9.569582e-001, 9.574440e-001, 9.579298e-001, 9.584157e-001, 9.589015e-001, 9.593813e-001,
+9.598585e-001, 9.603356e-001, 9.608128e-001, 9.612900e-001, 9.617671e-001, 9.622443e-001, 9.627214e-001, 9.631986e-001, 9.636757e-001, 9.641529e-001,
+9.646300e-001, 9.651072e-001, 9.655843e-001, 9.660615e-001, 9.665308e-001, 9.669935e-001, 9.674562e-001, 9.679189e-001, 9.683816e-001, 9.688443e-001,
+9.693070e-001, 9.697697e-001, 9.702324e-001, 9.706950e-001, 9.711577e-001, 9.716204e-001, 9.720831e-001, 9.725458e-001, 9.730085e-001, 9.734690e-001,
+9.739160e-001, 9.743631e-001, 9.748102e-001, 9.752573e-001, 9.757044e-001, 9.761515e-001, 9.765985e-001, 9.770456e-001, 9.774927e-001, 9.779398e-001,
+9.783869e-001, 9.788340e-001, 9.792810e-001, 9.797281e-001, 9.801752e-001, 9.806161e-001, 9.810506e-001, 9.814851e-001, 9.819195e-001, 9.823540e-001,
+9.827885e-001, 9.832230e-001, 9.836575e-001, 9.840920e-001, 9.845265e-001, 9.849610e-001, 9.853955e-001, 9.858299e-001, 9.862644e-001, 9.866989e-001,
+9.871334e-001, 9.875544e-001, 9.879659e-001, 9.883775e-001, 9.887890e-001, 9.892006e-001, 9.896121e-001, 9.900237e-001, 9.904352e-001, 9.908468e-001,
+9.912583e-001, 9.916699e-001, 9.920814e-001, 9.924930e-001, 9.929045e-001, 9.933161e-001, 9.937276e-001, 9.941204e-001, 9.944878e-001, 9.948553e-001,
+9.952228e-001, 9.955903e-001, 9.959578e-001, 9.963252e-001, 9.966927e-001, 9.970602e-001, 9.974277e-001, 9.977951e-001, 9.981626e-001, 9.985301e-001,
+9.988976e-001, 9.992650e-001, 9.996325e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.926053e-003, 1.546899e-002, 2.231344e-002, 2.855927e-002, 3.432922e-002, 3.973385e-002, 4.479388e-002, 4.962622e-002, 5.422883e-002,
+5.867886e-002, 6.295911e-002, 6.706596e-002, 7.108926e-002, 7.499121e-002, 7.884056e-002, 8.256257e-002, 8.619796e-002, 8.977079e-002, 9.322111e-002,
+9.665635e-002, 1.000294e-001, 1.033192e-001, 1.065331e-001, 1.097006e-001, 1.128139e-001, 1.158875e-001, 1.189556e-001, 1.219801e-001, 1.249567e-001,
+1.278753e-001, 1.307423e-001, 1.336017e-001, 1.364332e-001, 1.392025e-001, 1.419408e-001, 1.446658e-001, 1.473689e-001, 1.500455e-001, 1.526847e-001,
+1.552832e-001, 1.578583e-001, 1.604107e-001, 1.629473e-001, 1.654642e-001, 1.679516e-001, 1.704009e-001, 1.728226e-001, 1.752289e-001, 1.776169e-001,
+1.799840e-001, 1.823206e-001, 1.846180e-001, 1.869054e-001, 1.891890e-001, 1.914498e-001, 1.936779e-001, 1.958771e-001, 1.980605e-001, 2.002373e-001,
+2.024063e-001, 2.045634e-001, 2.067063e-001, 2.088321e-001, 2.109334e-001, 2.130157e-001, 2.150928e-001, 2.171599e-001, 2.192052e-001, 2.212346e-001,
+2.232697e-001, 2.253111e-001, 2.273572e-001, 2.294019e-001, 2.314381e-001, 2.334637e-001, 2.354703e-001, 2.374535e-001, 2.394182e-001, 2.413694e-001,
+2.433118e-001, 2.452446e-001, 2.471683e-001, 2.490823e-001, 2.509845e-001, 2.528661e-001, 2.547390e-001, 2.566036e-001, 2.584481e-001, 2.602775e-001,
+2.620961e-001, 2.639020e-001, 2.656953e-001, 2.674825e-001, 2.692643e-001, 2.710476e-001, 2.728300e-001, 2.746051e-001, 2.763741e-001, 2.781391e-001,
+2.798882e-001, 2.816232e-001, 2.833354e-001, 2.850273e-001, 2.867107e-001, 2.883764e-001, 2.900390e-001, 2.916957e-001, 2.933524e-001, 2.950092e-001,
+2.966647e-001, 2.983195e-001, 2.999662e-001, 3.016083e-001, 3.032362e-001, 3.048543e-001, 3.064570e-001, 3.080513e-001, 3.096375e-001, 3.112207e-001,
+3.128019e-001, 3.143789e-001, 3.159537e-001, 3.175299e-001, 3.191068e-001, 3.206779e-001, 3.222463e-001, 3.238070e-001, 3.253634e-001, 3.269123e-001,
+3.284555e-001, 3.299895e-001, 3.315128e-001, 3.330294e-001, 3.345321e-001, 3.360328e-001, 3.375233e-001, 3.390138e-001, 3.404915e-001, 3.419684e-001,
+3.434371e-001, 3.449021e-001, 3.463631e-001, 3.478183e-001, 3.492722e-001, 3.507140e-001, 3.521557e-001, 3.535880e-001, 3.550169e-001, 3.564417e-001,
+3.578588e-001, 3.592759e-001, 3.606815e-001, 3.620860e-001, 3.634851e-001, 3.648771e-001, 3.662690e-001, 3.676514e-001, 3.690330e-001, 3.704111e-001,
+3.717833e-001, 3.731555e-001, 3.745233e-001, 3.758896e-001, 3.772548e-001, 3.786113e-001, 3.799678e-001, 3.813194e-001, 3.826650e-001, 3.840106e-001,
+3.853495e-001, 3.866857e-001, 3.880219e-001, 3.893507e-001, 3.906790e-001, 3.920062e-001, 3.933257e-001, 3.946452e-001, 3.959635e-001, 3.972787e-001,
+3.985939e-001, 3.999079e-001, 4.012197e-001, 4.025315e-001, 4.038358e-001, 4.051289e-001, 4.064219e-001, 4.077094e-001, 4.089881e-001, 4.102669e-001,
+4.115405e-001, 4.128042e-001, 4.140679e-001, 4.153267e-001, 4.165698e-001, 4.178129e-001, 4.190547e-001, 4.202808e-001, 4.215069e-001, 4.227330e-001,
+4.239531e-001, 4.251723e-001, 4.263914e-001, 4.276081e-001, 4.288231e-001, 4.300382e-001, 4.312499e-001, 4.324540e-001, 4.336580e-001, 4.348620e-001,
+4.360530e-001, 4.372431e-001, 4.384333e-001, 4.396133e-001, 4.407839e-001, 4.419544e-001, 4.431243e-001, 4.442784e-001, 4.454325e-001, 4.465866e-001,
+4.477372e-001, 4.488846e-001, 4.500319e-001, 4.511793e-001, 4.523160e-001, 4.534518e-001, 4.545876e-001, 4.557210e-001, 4.568477e-001, 4.579745e-001,
+4.591013e-001, 4.602225e-001, 4.613394e-001, 4.624564e-001, 4.635733e-001, 4.646795e-001, 4.657829e-001, 4.668863e-001, 4.679896e-001, 4.690911e-001,
+4.701924e-001, 4.712938e-001, 4.723946e-001, 4.734885e-001, 4.745825e-001, 4.756764e-001, 4.767696e-001, 4.778566e-001, 4.789435e-001, 4.800305e-001,
+4.811174e-001, 4.822036e-001, 4.832898e-001, 4.843761e-001, 4.854622e-001, 4.865371e-001, 4.876120e-001, 4.886869e-001, 4.897618e-001, 4.908238e-001,
+4.918835e-001, 4.929432e-001, 4.940029e-001, 4.950587e-001, 4.961124e-001, 4.971660e-001, 4.982196e-001, 4.992742e-001, 5.003306e-001, 5.013869e-001,
+5.024433e-001, 5.034996e-001, 5.045478e-001, 5.055958e-001, 5.066438e-001, 5.076918e-001, 5.087349e-001, 5.097741e-001, 5.108132e-001, 5.118523e-001,
+5.128911e-001, 5.139240e-001, 5.149568e-001, 5.159897e-001, 5.170226e-001, 5.180505e-001, 5.190728e-001, 5.200952e-001, 5.211176e-001, 5.221399e-001,
+5.231561e-001, 5.241709e-001, 5.251858e-001, 5.262006e-001, 5.272145e-001, 5.282196e-001, 5.292247e-001, 5.302299e-001, 5.312350e-001, 5.322360e-001,
+5.332268e-001, 5.342177e-001, 5.352085e-001, 5.361994e-001, 5.371838e-001, 5.381589e-001, 5.391340e-001, 5.401091e-001, 5.410842e-001, 5.420533e-001,
+5.430148e-001, 5.439764e-001, 5.449379e-001, 5.458995e-001, 5.468540e-001, 5.477982e-001, 5.487424e-001, 5.496866e-001, 5.506308e-001, 5.515701e-001,
+5.524967e-001, 5.534233e-001, 5.543498e-001, 5.552764e-001, 5.562022e-001, 5.571172e-001, 5.580322e-001, 5.589473e-001, 5.598623e-001, 5.607773e-001,
+5.616866e-001, 5.625942e-001, 5.635018e-001, 5.644094e-001, 5.653170e-001, 5.662231e-001, 5.671267e-001, 5.680304e-001, 5.689340e-001, 5.698377e-001,
+5.707413e-001, 5.716377e-001, 5.725335e-001, 5.734294e-001, 5.743252e-001, 5.752210e-001, 5.761132e-001, 5.769993e-001, 5.778854e-001, 5.787714e-001,
+5.796575e-001, 5.805436e-001, 5.814265e-001, 5.823082e-001, 5.831899e-001, 5.840715e-001, 5.849532e-001, 5.858349e-001, 5.867123e-001, 5.875897e-001,
+5.884671e-001, 5.893444e-001, 5.902218e-001, 5.910989e-001, 5.919742e-001, 5.928496e-001, 5.937249e-001, 5.946002e-001, 5.954756e-001, 5.963500e-001,
+5.972210e-001, 5.980921e-001, 5.989631e-001, 5.998342e-001, 6.007053e-001, 6.015741e-001, 6.024342e-001, 6.032943e-001, 6.041544e-001, 6.050144e-001,
+6.058745e-001, 6.067342e-001, 6.075887e-001, 6.084432e-001, 6.092978e-001, 6.101523e-001, 6.110068e-001, 6.118613e-001, 6.127145e-001, 6.135674e-001,
+6.144203e-001, 6.152732e-001, 6.161261e-001, 6.169791e-001, 6.178271e-001, 6.186709e-001, 6.195146e-001, 6.203583e-001, 6.212021e-001, 6.220458e-001,
+6.228886e-001, 6.237223e-001, 6.245561e-001, 6.253899e-001, 6.262236e-001, 6.270574e-001, 6.278912e-001, 6.287242e-001, 6.295566e-001, 6.303890e-001,
+6.312214e-001, 6.320538e-001, 6.328862e-001, 6.337186e-001, 6.345450e-001, 6.353709e-001, 6.361969e-001, 6.370228e-001, 6.378487e-001, 6.386746e-001,
+6.394987e-001, 6.403146e-001, 6.411305e-001, 6.419464e-001, 6.427623e-001, 6.435782e-001, 6.443941e-001, 6.452056e-001, 6.460080e-001, 6.468103e-001,
+6.476126e-001, 6.484150e-001, 6.492173e-001, 6.500196e-001, 6.508171e-001, 6.516058e-001, 6.523945e-001, 6.531832e-001, 6.539719e-001, 6.547606e-001,
+6.555493e-001, 6.563370e-001, 6.571221e-001, 6.579073e-001, 6.586924e-001, 6.594775e-001, 6.602627e-001, 6.610478e-001, 6.618330e-001, 6.626194e-001,
+6.634058e-001, 6.641922e-001, 6.649786e-001, 6.657650e-001, 6.665514e-001, 6.673378e-001, 6.681155e-001, 6.688905e-001, 6.696655e-001, 6.704405e-001,
+6.712155e-001, 6.719905e-001, 6.727655e-001, 6.735369e-001, 6.743008e-001, 6.750648e-001, 6.758287e-001, 6.765927e-001, 6.773566e-001, 6.781205e-001,
+6.788845e-001, 6.796460e-001, 6.804067e-001, 6.811675e-001, 6.819283e-001, 6.826890e-001, 6.834498e-001, 6.842105e-001, 6.849714e-001, 6.857335e-001,
+6.864956e-001, 6.872576e-001, 6.880197e-001, 6.887818e-001, 6.895439e-001, 6.903060e-001, 6.910655e-001, 6.918187e-001, 6.925718e-001, 6.933249e-001,
+6.940780e-001, 6.948312e-001, 6.955843e-001, 6.963374e-001, 6.970837e-001, 6.978172e-001, 6.985507e-001, 6.992841e-001, 7.000176e-001, 7.007511e-001,
+7.014846e-001, 7.022181e-001, 7.029486e-001, 7.036715e-001, 7.043945e-001, 7.051174e-001, 7.058404e-001, 7.065634e-001, 7.072863e-001, 7.080093e-001,
+7.087321e-001, 7.094536e-001, 7.101750e-001, 7.108965e-001, 7.116180e-001, 7.123395e-001, 7.130609e-001, 7.137824e-001, 7.145039e-001, 7.152239e-001,
+7.159435e-001, 7.166631e-001, 7.173827e-001, 7.181023e-001, 7.188219e-001, 7.195415e-001, 7.202611e-001, 7.209777e-001, 7.216872e-001, 7.223967e-001,
+7.231062e-001, 7.238157e-001, 7.245252e-001, 7.252347e-001, 7.259442e-001, 7.266537e-001, 7.273571e-001, 7.280579e-001, 7.287588e-001, 7.294596e-001,
+7.301604e-001, 7.308612e-001, 7.315620e-001, 7.322629e-001, 7.329637e-001, 7.336601e-001, 7.343564e-001, 7.350527e-001, 7.357490e-001, 7.364453e-001,
+7.371416e-001, 7.378379e-001, 7.385342e-001, 7.392304e-001, 7.399262e-001, 7.406219e-001, 7.413177e-001, 7.420134e-001, 7.427091e-001, 7.434049e-001,
+7.441006e-001, 7.447964e-001, 7.454917e-001, 7.461783e-001, 7.468650e-001, 7.475517e-001, 7.482383e-001, 7.489250e-001, 7.496117e-001, 7.502983e-001,
+7.509850e-001, 7.516717e-001, 7.523459e-001, 7.530184e-001, 7.536909e-001, 7.543634e-001, 7.550359e-001, 7.557084e-001, 7.563808e-001, 7.570533e-001,
+7.577258e-001, 7.583954e-001, 7.590625e-001, 7.597296e-001, 7.603967e-001, 7.610639e-001, 7.617310e-001, 7.623981e-001, 7.630653e-001, 7.637324e-001,
+7.643994e-001, 7.650649e-001, 7.657304e-001, 7.663959e-001, 7.670614e-001, 7.677269e-001, 7.683924e-001, 7.690579e-001, 7.697234e-001, 7.703889e-001,
+7.710500e-001, 7.717057e-001, 7.723613e-001, 7.730170e-001, 7.736727e-001, 7.743283e-001, 7.749840e-001, 7.756396e-001, 7.762953e-001, 7.769509e-001,
+7.775999e-001, 7.782454e-001, 7.788908e-001, 7.795363e-001, 7.801818e-001, 7.808272e-001, 7.814727e-001, 7.821182e-001, 7.827636e-001, 7.834091e-001,
+7.840545e-001, 7.846998e-001, 7.853451e-001, 7.859904e-001, 7.866357e-001, 7.872810e-001, 7.879263e-001, 7.885716e-001, 7.892169e-001, 7.898622e-001,
+7.905039e-001, 7.911430e-001, 7.917821e-001, 7.924213e-001, 7.930604e-001, 7.936995e-001, 7.943387e-001, 7.949778e-001, 7.956169e-001, 7.962561e-001,
+7.968929e-001, 7.975248e-001, 7.981567e-001, 7.987886e-001, 7.994205e-001, 8.000524e-001, 8.006843e-001, 8.013161e-001, 8.019480e-001, 8.025799e-001,
+8.032118e-001, 8.038353e-001, 8.044575e-001, 8.050797e-001, 8.057019e-001, 8.063242e-001, 8.069464e-001, 8.075686e-001, 8.081908e-001, 8.088131e-001,
+8.094353e-001, 8.100558e-001, 8.106715e-001, 8.112871e-001, 8.119028e-001, 8.125184e-001, 8.131341e-001, 8.137497e-001, 8.143654e-001, 8.149810e-001,
+8.155967e-001, 8.162123e-001, 8.168266e-001, 8.174394e-001, 8.180521e-001, 8.186649e-001, 8.192776e-001, 8.198904e-001, 8.205031e-001, 8.211159e-001,
+8.217287e-001, 8.223414e-001, 8.229542e-001, 8.235661e-001, 8.241772e-001, 8.247883e-001, 8.253994e-001, 8.260105e-001, 8.266215e-001, 8.272326e-001,
+8.278437e-001, 8.284548e-001, 8.290659e-001, 8.296770e-001, 8.302866e-001, 8.308938e-001, 8.315009e-001, 8.321080e-001, 8.327152e-001, 8.333223e-001,
+8.339294e-001, 8.345366e-001, 8.351437e-001, 8.357508e-001, 8.363580e-001, 8.369646e-001, 8.375620e-001, 8.381594e-001, 8.387568e-001, 8.393542e-001,
+8.399516e-001, 8.405490e-001, 8.411465e-001, 8.417439e-001, 8.423413e-001, 8.429387e-001, 8.435361e-001, 8.441310e-001, 8.447238e-001, 8.453166e-001,
+8.459094e-001, 8.465022e-001, 8.470950e-001, 8.476878e-001, 8.482806e-001, 8.488734e-001, 8.494662e-001, 8.500590e-001, 8.506518e-001, 8.512413e-001,
+8.518302e-001, 8.524191e-001, 8.530079e-001, 8.535968e-001, 8.541857e-001, 8.547746e-001, 8.553635e-001, 8.559524e-001, 8.565413e-001, 8.571302e-001,
+8.577190e-001, 8.583009e-001, 8.588824e-001, 8.594640e-001, 8.600456e-001, 8.606271e-001, 8.612087e-001, 8.617902e-001, 8.623718e-001, 8.629534e-001,
+8.635349e-001, 8.641165e-001, 8.646980e-001, 8.652762e-001, 8.658539e-001, 8.664317e-001, 8.670094e-001, 8.675871e-001, 8.681648e-001, 8.687426e-001,
+8.693203e-001, 8.698980e-001, 8.704758e-001, 8.710535e-001, 8.716312e-001, 8.722062e-001, 8.727794e-001, 8.733525e-001, 8.739257e-001, 8.744989e-001,
+8.750720e-001, 8.756452e-001, 8.762184e-001, 8.767916e-001, 8.773647e-001, 8.779379e-001, 8.785111e-001, 8.790834e-001, 8.796499e-001, 8.802164e-001,
+8.807829e-001, 8.813493e-001, 8.819158e-001, 8.824823e-001, 8.830488e-001, 8.836153e-001, 8.841818e-001, 8.847482e-001, 8.853147e-001, 8.858812e-001,
+8.864450e-001, 8.870056e-001, 8.875662e-001, 8.881268e-001, 8.886873e-001, 8.892479e-001, 8.898085e-001, 8.903690e-001, 8.909296e-001, 8.914902e-001,
+8.920507e-001, 8.926113e-001, 8.931719e-001, 8.937310e-001, 8.942890e-001, 8.948469e-001, 8.954049e-001, 8.959629e-001, 8.965209e-001, 8.970788e-001,
+8.976368e-001, 8.981948e-001, 8.987527e-001, 8.993107e-001, 8.998687e-001, 9.004266e-001, 9.009830e-001, 9.015374e-001, 9.020918e-001, 9.026463e-001,
+9.032007e-001, 9.037551e-001, 9.043095e-001, 9.048639e-001, 9.054184e-001, 9.059728e-001, 9.065272e-001, 9.070816e-001, 9.076361e-001, 9.081891e-001,
+9.087344e-001, 9.092797e-001, 9.098249e-001, 9.103702e-001, 9.109155e-001, 9.114607e-001, 9.120060e-001, 9.125513e-001, 9.130965e-001, 9.136418e-001,
+9.141871e-001, 9.147323e-001, 9.152776e-001, 9.158192e-001, 9.163585e-001, 9.168978e-001, 9.174371e-001, 9.179764e-001, 9.185156e-001, 9.190549e-001,
+9.195942e-001, 9.201335e-001, 9.206728e-001, 9.212121e-001, 9.217514e-001, 9.222907e-001, 9.228300e-001, 9.233683e-001, 9.239064e-001, 9.244445e-001,
+9.249826e-001, 9.255208e-001, 9.260589e-001, 9.265970e-001, 9.271351e-001, 9.276732e-001, 9.282113e-001, 9.287495e-001, 9.292876e-001, 9.298257e-001,
+9.303638e-001, 9.308948e-001, 9.314251e-001, 9.319553e-001, 9.324856e-001, 9.330158e-001, 9.335461e-001, 9.340763e-001, 9.346066e-001, 9.351368e-001,
+9.356670e-001, 9.361973e-001, 9.367275e-001, 9.372578e-001, 9.377880e-001, 9.383096e-001, 9.388274e-001, 9.393453e-001, 9.398631e-001, 9.403810e-001,
+9.408988e-001, 9.414167e-001, 9.419345e-001, 9.424523e-001, 9.429702e-001, 9.434880e-001, 9.440059e-001, 9.445237e-001, 9.450415e-001, 9.455562e-001,
+9.460619e-001, 9.465677e-001, 9.470734e-001, 9.475792e-001, 9.480849e-001, 9.485907e-001, 9.490964e-001, 9.496022e-001, 9.501079e-001, 9.506137e-001,
+9.511194e-001, 9.516252e-001, 9.521309e-001, 9.526367e-001, 9.531362e-001, 9.536316e-001, 9.541269e-001, 9.546223e-001, 9.551176e-001, 9.556129e-001,
+9.561083e-001, 9.566036e-001, 9.570990e-001, 9.575943e-001, 9.580897e-001, 9.585850e-001, 9.590803e-001, 9.595757e-001, 9.600710e-001, 9.605569e-001,
+9.610384e-001, 9.615200e-001, 9.620016e-001, 9.624832e-001, 9.629647e-001, 9.634463e-001, 9.639279e-001, 9.644095e-001, 9.648910e-001, 9.653726e-001,
+9.658542e-001, 9.663358e-001, 9.668173e-001, 9.672989e-001, 9.677715e-001, 9.682365e-001, 9.687015e-001, 9.691665e-001, 9.696315e-001, 9.700965e-001,
+9.705615e-001, 9.710265e-001, 9.714915e-001, 9.719565e-001, 9.724215e-001, 9.728865e-001, 9.733515e-001, 9.738165e-001, 9.742815e-001, 9.747437e-001,
+9.751892e-001, 9.756347e-001, 9.760802e-001, 9.765258e-001, 9.769713e-001, 9.774168e-001, 9.778623e-001, 9.783079e-001, 9.787534e-001, 9.791989e-001,
+9.796444e-001, 9.800899e-001, 9.805355e-001, 9.809810e-001, 9.814265e-001, 9.818612e-001, 9.822847e-001, 9.827083e-001, 9.831319e-001, 9.835554e-001,
+9.839790e-001, 9.844025e-001, 9.848261e-001, 9.852496e-001, 9.856732e-001, 9.860967e-001, 9.865203e-001, 9.869438e-001, 9.873674e-001, 9.877910e-001,
+9.882145e-001, 9.886164e-001, 9.890031e-001, 9.893898e-001, 9.897766e-001, 9.901633e-001, 9.905501e-001, 9.909368e-001, 9.913236e-001, 9.917103e-001,
+9.920970e-001, 9.924838e-001, 9.928705e-001, 9.932573e-001, 9.936440e-001, 9.940308e-001, 9.944175e-001, 9.947785e-001, 9.951048e-001, 9.954312e-001,
+9.957575e-001, 9.960838e-001, 9.964102e-001, 9.967365e-001, 9.970629e-001, 9.973892e-001, 9.977156e-001, 9.980419e-001, 9.983683e-001, 9.986946e-001,
+9.990210e-001, 9.993473e-001, 9.996737e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.926053e-003, 1.546899e-002, 2.231344e-002, 2.855927e-002, 3.432922e-002, 3.973385e-002, 4.479388e-002, 4.962622e-002, 5.422883e-002,
+5.867886e-002, 6.295911e-002, 6.706596e-002, 7.108926e-002, 7.499121e-002, 7.884056e-002, 8.256257e-002, 8.619796e-002, 8.977079e-002, 9.322111e-002,
+9.665635e-002, 1.000294e-001, 1.033192e-001, 1.065331e-001, 1.097006e-001, 1.128139e-001, 1.158875e-001, 1.189556e-001, 1.219801e-001, 1.249567e-001,
+1.278753e-001, 1.307423e-001, 1.336017e-001, 1.364332e-001, 1.392025e-001, 1.419408e-001, 1.446658e-001, 1.473689e-001, 1.500455e-001, 1.526847e-001,
+1.552832e-001, 1.578583e-001, 1.604107e-001, 1.629473e-001, 1.654642e-001, 1.679516e-001, 1.704009e-001, 1.728226e-001, 1.752289e-001, 1.776169e-001,
+1.799840e-001, 1.823206e-001, 1.846180e-001, 1.869054e-001, 1.891890e-001, 1.914498e-001, 1.936779e-001, 1.958771e-001, 1.980605e-001, 2.002373e-001,
+2.024063e-001, 2.045634e-001, 2.067063e-001, 2.088321e-001, 2.109334e-001, 2.130157e-001, 2.150928e-001, 2.171599e-001, 2.192052e-001, 2.212346e-001,
+2.232697e-001, 2.253111e-001, 2.273572e-001, 2.294019e-001, 2.314381e-001, 2.334637e-001, 2.354703e-001, 2.374535e-001, 2.394182e-001, 2.413694e-001,
+2.433118e-001, 2.452446e-001, 2.471683e-001, 2.490823e-001, 2.509845e-001, 2.528661e-001, 2.547390e-001, 2.566036e-001, 2.584481e-001, 2.602775e-001,
+2.620961e-001, 2.639020e-001, 2.656953e-001, 2.674825e-001, 2.692643e-001, 2.710476e-001, 2.728300e-001, 2.746051e-001, 2.763741e-001, 2.781391e-001,
+2.798882e-001, 2.816232e-001, 2.833354e-001, 2.850273e-001, 2.867107e-001, 2.883764e-001, 2.900390e-001, 2.916957e-001, 2.933524e-001, 2.950092e-001,
+2.966647e-001, 2.983195e-001, 2.999662e-001, 3.016083e-001, 3.032362e-001, 3.048543e-001, 3.064570e-001, 3.080513e-001, 3.096375e-001, 3.112207e-001,
+3.128019e-001, 3.143789e-001, 3.159537e-001, 3.175299e-001, 3.191068e-001, 3.206779e-001, 3.222463e-001, 3.238070e-001, 3.253634e-001, 3.269123e-001,
+3.284555e-001, 3.299895e-001, 3.315128e-001, 3.330294e-001, 3.345321e-001, 3.360328e-001, 3.375233e-001, 3.390138e-001, 3.404915e-001, 3.419684e-001,
+3.434371e-001, 3.449021e-001, 3.463631e-001, 3.478183e-001, 3.492722e-001, 3.507140e-001, 3.521557e-001, 3.535880e-001, 3.550169e-001, 3.564417e-001,
+3.578588e-001, 3.592759e-001, 3.606815e-001, 3.620860e-001, 3.634851e-001, 3.648771e-001, 3.662690e-001, 3.676514e-001, 3.690330e-001, 3.704111e-001,
+3.717833e-001, 3.731555e-001, 3.745233e-001, 3.758896e-001, 3.772548e-001, 3.786113e-001, 3.799678e-001, 3.813194e-001, 3.826650e-001, 3.840106e-001,
+3.853495e-001, 3.866857e-001, 3.880219e-001, 3.893507e-001, 3.906790e-001, 3.920062e-001, 3.933257e-001, 3.946452e-001, 3.959635e-001, 3.972787e-001,
+3.985939e-001, 3.999079e-001, 4.012197e-001, 4.025315e-001, 4.038358e-001, 4.051289e-001, 4.064219e-001, 4.077094e-001, 4.089881e-001, 4.102669e-001,
+4.115405e-001, 4.128042e-001, 4.140679e-001, 4.153267e-001, 4.165698e-001, 4.178129e-001, 4.190547e-001, 4.202808e-001, 4.215069e-001, 4.227330e-001,
+4.239531e-001, 4.251723e-001, 4.263914e-001, 4.276081e-001, 4.288231e-001, 4.300382e-001, 4.312499e-001, 4.324540e-001, 4.336580e-001, 4.348620e-001,
+4.360530e-001, 4.372431e-001, 4.384333e-001, 4.396133e-001, 4.407839e-001, 4.419544e-001, 4.431243e-001, 4.442784e-001, 4.454325e-001, 4.465866e-001,
+4.477372e-001, 4.488846e-001, 4.500319e-001, 4.511793e-001, 4.523160e-001, 4.534518e-001, 4.545876e-001, 4.557210e-001, 4.568477e-001, 4.579745e-001,
+4.591013e-001, 4.602225e-001, 4.613394e-001, 4.624564e-001, 4.635733e-001, 4.646795e-001, 4.657829e-001, 4.668863e-001, 4.679896e-001, 4.690911e-001,
+4.701924e-001, 4.712938e-001, 4.723946e-001, 4.734885e-001, 4.745825e-001, 4.756764e-001, 4.767696e-001, 4.778566e-001, 4.789435e-001, 4.800305e-001,
+4.811174e-001, 4.822036e-001, 4.832898e-001, 4.843761e-001, 4.854622e-001, 4.865371e-001, 4.876120e-001, 4.886869e-001, 4.897618e-001, 4.908238e-001,
+4.918835e-001, 4.929432e-001, 4.940029e-001, 4.950587e-001, 4.961124e-001, 4.971660e-001, 4.982196e-001, 4.992742e-001, 5.003306e-001, 5.013869e-001,
+5.024433e-001, 5.034996e-001, 5.045478e-001, 5.055958e-001, 5.066438e-001, 5.076918e-001, 5.087349e-001, 5.097741e-001, 5.108132e-001, 5.118523e-001,
+5.128911e-001, 5.139240e-001, 5.149568e-001, 5.159897e-001, 5.170226e-001, 5.180505e-001, 5.190728e-001, 5.200952e-001, 5.211176e-001, 5.221399e-001,
+5.231561e-001, 5.241709e-001, 5.251858e-001, 5.262006e-001, 5.272145e-001, 5.282196e-001, 5.292247e-001, 5.302299e-001, 5.312350e-001, 5.322360e-001,
+5.332268e-001, 5.342177e-001, 5.352085e-001, 5.361994e-001, 5.371838e-001, 5.381589e-001, 5.391340e-001, 5.401091e-001, 5.410842e-001, 5.420533e-001,
+5.430148e-001, 5.439764e-001, 5.449379e-001, 5.458995e-001, 5.468540e-001, 5.477982e-001, 5.487424e-001, 5.496866e-001, 5.506308e-001, 5.515701e-001,
+5.524967e-001, 5.534233e-001, 5.543498e-001, 5.552764e-001, 5.562022e-001, 5.571172e-001, 5.580322e-001, 5.589473e-001, 5.598623e-001, 5.607773e-001,
+5.616866e-001, 5.625942e-001, 5.635018e-001, 5.644094e-001, 5.653170e-001, 5.662231e-001, 5.671267e-001, 5.680304e-001, 5.689340e-001, 5.698377e-001,
+5.707413e-001, 5.716377e-001, 5.725335e-001, 5.734294e-001, 5.743252e-001, 5.752210e-001, 5.761132e-001, 5.769993e-001, 5.778854e-001, 5.787714e-001,
+5.796575e-001, 5.805436e-001, 5.814265e-001, 5.823082e-001, 5.831899e-001, 5.840715e-001, 5.849532e-001, 5.858349e-001, 5.867123e-001, 5.875897e-001,
+5.884671e-001, 5.893444e-001, 5.902218e-001, 5.910989e-001, 5.919742e-001, 5.928496e-001, 5.937249e-001, 5.946002e-001, 5.954756e-001, 5.963500e-001,
+5.972210e-001, 5.980921e-001, 5.989631e-001, 5.998342e-001, 6.007053e-001, 6.015741e-001, 6.024342e-001, 6.032943e-001, 6.041544e-001, 6.050144e-001,
+6.058745e-001, 6.067342e-001, 6.075887e-001, 6.084432e-001, 6.092978e-001, 6.101523e-001, 6.110068e-001, 6.118613e-001, 6.127145e-001, 6.135674e-001,
+6.144203e-001, 6.152732e-001, 6.161261e-001, 6.169791e-001, 6.178271e-001, 6.186709e-001, 6.195146e-001, 6.203583e-001, 6.212021e-001, 6.220458e-001,
+6.228886e-001, 6.237223e-001, 6.245561e-001, 6.253899e-001, 6.262236e-001, 6.270574e-001, 6.278912e-001, 6.287242e-001, 6.295566e-001, 6.303890e-001,
+6.312214e-001, 6.320538e-001, 6.328862e-001, 6.337186e-001, 6.345450e-001, 6.353709e-001, 6.361969e-001, 6.370228e-001, 6.378487e-001, 6.386746e-001,
+6.394987e-001, 6.403146e-001, 6.411305e-001, 6.419464e-001, 6.427623e-001, 6.435782e-001, 6.443941e-001, 6.452056e-001, 6.460080e-001, 6.468103e-001,
+6.476126e-001, 6.484150e-001, 6.492173e-001, 6.500196e-001, 6.508171e-001, 6.516058e-001, 6.523945e-001, 6.531832e-001, 6.539719e-001, 6.547606e-001,
+6.555493e-001, 6.563370e-001, 6.571221e-001, 6.579073e-001, 6.586924e-001, 6.594775e-001, 6.602627e-001, 6.610478e-001, 6.618330e-001, 6.626194e-001,
+6.634058e-001, 6.641922e-001, 6.649786e-001, 6.657650e-001, 6.665514e-001, 6.673378e-001, 6.681155e-001, 6.688905e-001, 6.696655e-001, 6.704405e-001,
+6.712155e-001, 6.719905e-001, 6.727655e-001, 6.735369e-001, 6.743008e-001, 6.750648e-001, 6.758287e-001, 6.765927e-001, 6.773566e-001, 6.781205e-001,
+6.788845e-001, 6.796460e-001, 6.804067e-001, 6.811675e-001, 6.819283e-001, 6.826890e-001, 6.834498e-001, 6.842105e-001, 6.849714e-001, 6.857335e-001,
+6.864956e-001, 6.872576e-001, 6.880197e-001, 6.887818e-001, 6.895439e-001, 6.903060e-001, 6.910655e-001, 6.918187e-001, 6.925718e-001, 6.933249e-001,
+6.940780e-001, 6.948312e-001, 6.955843e-001, 6.963374e-001, 6.970837e-001, 6.978172e-001, 6.985507e-001, 6.992841e-001, 7.000176e-001, 7.007511e-001,
+7.014846e-001, 7.022181e-001, 7.029486e-001, 7.036715e-001, 7.043945e-001, 7.051174e-001, 7.058404e-001, 7.065634e-001, 7.072863e-001, 7.080093e-001,
+7.087321e-001, 7.094536e-001, 7.101750e-001, 7.108965e-001, 7.116180e-001, 7.123395e-001, 7.130609e-001, 7.137824e-001, 7.145039e-001, 7.152239e-001,
+7.159435e-001, 7.166631e-001, 7.173827e-001, 7.181023e-001, 7.188219e-001, 7.195415e-001, 7.202611e-001, 7.209777e-001, 7.216872e-001, 7.223967e-001,
+7.231062e-001, 7.238157e-001, 7.245252e-001, 7.252347e-001, 7.259442e-001, 7.266537e-001, 7.273571e-001, 7.280579e-001, 7.287588e-001, 7.294596e-001,
+7.301604e-001, 7.308612e-001, 7.315620e-001, 7.322629e-001, 7.329637e-001, 7.336601e-001, 7.343564e-001, 7.350527e-001, 7.357490e-001, 7.364453e-001,
+7.371416e-001, 7.378379e-001, 7.385342e-001, 7.392304e-001, 7.399262e-001, 7.406219e-001, 7.413177e-001, 7.420134e-001, 7.427091e-001, 7.434049e-001,
+7.441006e-001, 7.447964e-001, 7.454917e-001, 7.461783e-001, 7.468650e-001, 7.475517e-001, 7.482383e-001, 7.489250e-001, 7.496117e-001, 7.502983e-001,
+7.509850e-001, 7.516717e-001, 7.523459e-001, 7.530184e-001, 7.536909e-001, 7.543634e-001, 7.550359e-001, 7.557084e-001, 7.563808e-001, 7.570533e-001,
+7.577258e-001, 7.583954e-001, 7.590625e-001, 7.597296e-001, 7.603967e-001, 7.610639e-001, 7.617310e-001, 7.623981e-001, 7.630653e-001, 7.637324e-001,
+7.643994e-001, 7.650649e-001, 7.657304e-001, 7.663959e-001, 7.670614e-001, 7.677269e-001, 7.683924e-001, 7.690579e-001, 7.697234e-001, 7.703889e-001,
+7.710500e-001, 7.717057e-001, 7.723613e-001, 7.730170e-001, 7.736727e-001, 7.743283e-001, 7.749840e-001, 7.756396e-001, 7.762953e-001, 7.769509e-001,
+7.775999e-001, 7.782454e-001, 7.788908e-001, 7.795363e-001, 7.801818e-001, 7.808272e-001, 7.814727e-001, 7.821182e-001, 7.827636e-001, 7.834091e-001,
+7.840545e-001, 7.846998e-001, 7.853451e-001, 7.859904e-001, 7.866357e-001, 7.872810e-001, 7.879263e-001, 7.885716e-001, 7.892169e-001, 7.898622e-001,
+7.905039e-001, 7.911430e-001, 7.917821e-001, 7.924213e-001, 7.930604e-001, 7.936995e-001, 7.943387e-001, 7.949778e-001, 7.956169e-001, 7.962561e-001,
+7.968929e-001, 7.975248e-001, 7.981567e-001, 7.987886e-001, 7.994205e-001, 8.000524e-001, 8.006843e-001, 8.013161e-001, 8.019480e-001, 8.025799e-001,
+8.032118e-001, 8.038353e-001, 8.044575e-001, 8.050797e-001, 8.057019e-001, 8.063242e-001, 8.069464e-001, 8.075686e-001, 8.081908e-001, 8.088131e-001,
+8.094353e-001, 8.100558e-001, 8.106715e-001, 8.112871e-001, 8.119028e-001, 8.125184e-001, 8.131341e-001, 8.137497e-001, 8.143654e-001, 8.149810e-001,
+8.155967e-001, 8.162123e-001, 8.168266e-001, 8.174394e-001, 8.180521e-001, 8.186649e-001, 8.192776e-001, 8.198904e-001, 8.205031e-001, 8.211159e-001,
+8.217287e-001, 8.223414e-001, 8.229542e-001, 8.235661e-001, 8.241772e-001, 8.247883e-001, 8.253994e-001, 8.260105e-001, 8.266215e-001, 8.272326e-001,
+8.278437e-001, 8.284548e-001, 8.290659e-001, 8.296770e-001, 8.302866e-001, 8.308938e-001, 8.315009e-001, 8.321080e-001, 8.327152e-001, 8.333223e-001,
+8.339294e-001, 8.345366e-001, 8.351437e-001, 8.357508e-001, 8.363580e-001, 8.369646e-001, 8.375620e-001, 8.381594e-001, 8.387568e-001, 8.393542e-001,
+8.399516e-001, 8.405490e-001, 8.411465e-001, 8.417439e-001, 8.423413e-001, 8.429387e-001, 8.435361e-001, 8.441310e-001, 8.447238e-001, 8.453166e-001,
+8.459094e-001, 8.465022e-001, 8.470950e-001, 8.476878e-001, 8.482806e-001, 8.488734e-001, 8.494662e-001, 8.500590e-001, 8.506518e-001, 8.512413e-001,
+8.518302e-001, 8.524191e-001, 8.530079e-001, 8.535968e-001, 8.541857e-001, 8.547746e-001, 8.553635e-001, 8.559524e-001, 8.565413e-001, 8.571302e-001,
+8.577190e-001, 8.583009e-001, 8.588824e-001, 8.594640e-001, 8.600456e-001, 8.606271e-001, 8.612087e-001, 8.617902e-001, 8.623718e-001, 8.629534e-001,
+8.635349e-001, 8.641165e-001, 8.646980e-001, 8.652762e-001, 8.658539e-001, 8.664317e-001, 8.670094e-001, 8.675871e-001, 8.681648e-001, 8.687426e-001,
+8.693203e-001, 8.698980e-001, 8.704758e-001, 8.710535e-001, 8.716312e-001, 8.722062e-001, 8.727794e-001, 8.733525e-001, 8.739257e-001, 8.744989e-001,
+8.750720e-001, 8.756452e-001, 8.762184e-001, 8.767916e-001, 8.773647e-001, 8.779379e-001, 8.785111e-001, 8.790834e-001, 8.796499e-001, 8.802164e-001,
+8.807829e-001, 8.813493e-001, 8.819158e-001, 8.824823e-001, 8.830488e-001, 8.836153e-001, 8.841818e-001, 8.847482e-001, 8.853147e-001, 8.858812e-001,
+8.864450e-001, 8.870056e-001, 8.875662e-001, 8.881268e-001, 8.886873e-001, 8.892479e-001, 8.898085e-001, 8.903690e-001, 8.909296e-001, 8.914902e-001,
+8.920507e-001, 8.926113e-001, 8.931719e-001, 8.937310e-001, 8.942890e-001, 8.948469e-001, 8.954049e-001, 8.959629e-001, 8.965209e-001, 8.970788e-001,
+8.976368e-001, 8.981948e-001, 8.987527e-001, 8.993107e-001, 8.998687e-001, 9.004266e-001, 9.009830e-001, 9.015374e-001, 9.020918e-001, 9.026463e-001,
+9.032007e-001, 9.037551e-001, 9.043095e-001, 9.048639e-001, 9.054184e-001, 9.059728e-001, 9.065272e-001, 9.070816e-001, 9.076361e-001, 9.081891e-001,
+9.087344e-001, 9.092797e-001, 9.098249e-001, 9.103702e-001, 9.109155e-001, 9.114607e-001, 9.120060e-001, 9.125513e-001, 9.130965e-001, 9.136418e-001,
+9.141871e-001, 9.147323e-001, 9.152776e-001, 9.158192e-001, 9.163585e-001, 9.168978e-001, 9.174371e-001, 9.179764e-001, 9.185156e-001, 9.190549e-001,
+9.195942e-001, 9.201335e-001, 9.206728e-001, 9.212121e-001, 9.217514e-001, 9.222907e-001, 9.228300e-001, 9.233683e-001, 9.239064e-001, 9.244445e-001,
+9.249826e-001, 9.255208e-001, 9.260589e-001, 9.265970e-001, 9.271351e-001, 9.276732e-001, 9.282113e-001, 9.287495e-001, 9.292876e-001, 9.298257e-001,
+9.303638e-001, 9.308948e-001, 9.314251e-001, 9.319553e-001, 9.324856e-001, 9.330158e-001, 9.335461e-001, 9.340763e-001, 9.346066e-001, 9.351368e-001,
+9.356670e-001, 9.361973e-001, 9.367275e-001, 9.372578e-001, 9.377880e-001, 9.383096e-001, 9.388274e-001, 9.393453e-001, 9.398631e-001, 9.403810e-001,
+9.408988e-001, 9.414167e-001, 9.419345e-001, 9.424523e-001, 9.429702e-001, 9.434880e-001, 9.440059e-001, 9.445237e-001, 9.450415e-001, 9.455562e-001,
+9.460619e-001, 9.465677e-001, 9.470734e-001, 9.475792e-001, 9.480849e-001, 9.485907e-001, 9.490964e-001, 9.496022e-001, 9.501079e-001, 9.506137e-001,
+9.511194e-001, 9.516252e-001, 9.521309e-001, 9.526367e-001, 9.531362e-001, 9.536316e-001, 9.541269e-001, 9.546223e-001, 9.551176e-001, 9.556129e-001,
+9.561083e-001, 9.566036e-001, 9.570990e-001, 9.575943e-001, 9.580897e-001, 9.585850e-001, 9.590803e-001, 9.595757e-001, 9.600710e-001, 9.605569e-001,
+9.610384e-001, 9.615200e-001, 9.620016e-001, 9.624832e-001, 9.629647e-001, 9.634463e-001, 9.639279e-001, 9.644095e-001, 9.648910e-001, 9.653726e-001,
+9.658542e-001, 9.663358e-001, 9.668173e-001, 9.672989e-001, 9.677715e-001, 9.682365e-001, 9.687015e-001, 9.691665e-001, 9.696315e-001, 9.700965e-001,
+9.705615e-001, 9.710265e-001, 9.714915e-001, 9.719565e-001, 9.724215e-001, 9.728865e-001, 9.733515e-001, 9.738165e-001, 9.742815e-001, 9.747437e-001,
+9.751892e-001, 9.756347e-001, 9.760802e-001, 9.765258e-001, 9.769713e-001, 9.774168e-001, 9.778623e-001, 9.783079e-001, 9.787534e-001, 9.791989e-001,
+9.796444e-001, 9.800899e-001, 9.805355e-001, 9.809810e-001, 9.814265e-001, 9.818612e-001, 9.822847e-001, 9.827083e-001, 9.831319e-001, 9.835554e-001,
+9.839790e-001, 9.844025e-001, 9.848261e-001, 9.852496e-001, 9.856732e-001, 9.860967e-001, 9.865203e-001, 9.869438e-001, 9.873674e-001, 9.877910e-001,
+9.882145e-001, 9.886164e-001, 9.890031e-001, 9.893898e-001, 9.897766e-001, 9.901633e-001, 9.905501e-001, 9.909368e-001, 9.913236e-001, 9.917103e-001,
+9.920970e-001, 9.924838e-001, 9.928705e-001, 9.932573e-001, 9.936440e-001, 9.940308e-001, 9.944175e-001, 9.947785e-001, 9.951048e-001, 9.954312e-001,
+9.957575e-001, 9.960838e-001, 9.964102e-001, 9.967365e-001, 9.970629e-001, 9.973892e-001, 9.977156e-001, 9.980419e-001, 9.983683e-001, 9.986946e-001,
+9.990210e-001, 9.993473e-001, 9.996737e-001, 1.000000e+000)),
+("Kodak", "Portra 400VC", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.629134e-003, 1.662794e-002, 2.345025e-002, 2.949777e-002, 3.490411e-002, 3.986050e-002, 4.458252e-002, 4.898782e-002, 5.321773e-002,
+5.723550e-002, 6.106516e-002, 6.478054e-002, 6.840349e-002, 7.191859e-002, 7.534649e-002, 7.868921e-002, 8.192053e-002, 8.505633e-002, 8.810823e-002,
+9.109976e-002, 9.405065e-002, 9.693732e-002, 9.975036e-002, 1.025147e-001, 1.052661e-001, 1.079823e-001, 1.106742e-001, 1.133475e-001, 1.159680e-001,
+1.185554e-001, 1.210844e-001, 1.235641e-001, 1.260134e-001, 1.284332e-001, 1.308184e-001, 1.331772e-001, 1.355086e-001, 1.378097e-001, 1.400967e-001,
+1.423414e-001, 1.445591e-001, 1.467432e-001, 1.489122e-001, 1.510476e-001, 1.531808e-001, 1.553075e-001, 1.574216e-001, 1.595199e-001, 1.615948e-001,
+1.636703e-001, 1.657373e-001, 1.677850e-001, 1.698163e-001, 1.718431e-001, 1.738559e-001, 1.758597e-001, 1.778583e-001, 1.798356e-001, 1.817938e-001,
+1.837291e-001, 1.856500e-001, 1.875600e-001, 1.894560e-001, 1.913281e-001, 1.931733e-001, 1.949938e-001, 1.968042e-001, 1.985995e-001, 2.003759e-001,
+2.021436e-001, 2.039009e-001, 2.056314e-001, 2.073460e-001, 2.090656e-001, 2.107871e-001, 2.125018e-001, 2.142132e-001, 2.159195e-001, 2.176185e-001,
+2.193065e-001, 2.209899e-001, 2.226741e-001, 2.243522e-001, 2.260199e-001, 2.276818e-001, 2.293323e-001, 2.309723e-001, 2.325981e-001, 2.342166e-001,
+2.358343e-001, 2.374478e-001, 2.390589e-001, 2.406686e-001, 2.422688e-001, 2.438557e-001, 2.454297e-001, 2.469906e-001, 2.485449e-001, 2.500948e-001,
+2.516425e-001, 2.531889e-001, 2.547359e-001, 2.562828e-001, 2.578261e-001, 2.593622e-001, 2.608925e-001, 2.624159e-001, 2.639255e-001, 2.654293e-001,
+2.669276e-001, 2.684176e-001, 2.699045e-001, 2.713881e-001, 2.728622e-001, 2.743292e-001, 2.757858e-001, 2.772284e-001, 2.786627e-001, 2.800801e-001,
+2.814943e-001, 2.829064e-001, 2.843184e-001, 2.857283e-001, 2.871338e-001, 2.885296e-001, 2.899203e-001, 2.913027e-001, 2.926811e-001, 2.940480e-001,
+2.954031e-001, 2.967463e-001, 2.980837e-001, 2.994191e-001, 3.007619e-001, 3.021047e-001, 3.034441e-001, 3.047791e-001, 3.061031e-001, 3.074271e-001,
+3.087512e-001, 3.100728e-001, 3.113922e-001, 3.127082e-001, 3.140223e-001, 3.153295e-001, 3.166336e-001, 3.179413e-001, 3.192504e-001, 3.205552e-001,
+3.218582e-001, 3.231492e-001, 3.244349e-001, 3.257191e-001, 3.270025e-001, 3.282819e-001, 3.295584e-001, 3.308313e-001, 3.321002e-001, 3.333650e-001,
+3.346219e-001, 3.358792e-001, 3.371386e-001, 3.383980e-001, 3.396492e-001, 3.409003e-001, 3.421368e-001, 3.433690e-001, 3.445987e-001, 3.458261e-001,
+3.470515e-001, 3.482699e-001, 3.494883e-001, 3.507005e-001, 3.519122e-001, 3.531203e-001, 3.543256e-001, 3.555308e-001, 3.567353e-001, 3.579397e-001,
+3.591401e-001, 3.603395e-001, 3.615380e-001, 3.627347e-001, 3.639314e-001, 3.651260e-001, 3.663202e-001, 3.675153e-001, 3.687119e-001, 3.699085e-001,
+3.711038e-001, 3.722988e-001, 3.734932e-001, 3.746860e-001, 3.758787e-001, 3.770669e-001, 3.782525e-001, 3.794381e-001, 3.806131e-001, 3.817881e-001,
+3.829604e-001, 3.841270e-001, 3.852936e-001, 3.864553e-001, 3.876137e-001, 3.887722e-001, 3.899285e-001, 3.910845e-001, 3.922401e-001, 3.933893e-001,
+3.945386e-001, 3.956862e-001, 3.968279e-001, 3.979696e-001, 3.991076e-001, 4.002385e-001, 4.013694e-001, 4.024934e-001, 4.036085e-001, 4.047235e-001,
+4.058330e-001, 4.069366e-001, 4.080402e-001, 4.091409e-001, 4.102386e-001, 4.113362e-001, 4.124297e-001, 4.135183e-001, 4.146069e-001, 4.156936e-001,
+4.167774e-001, 4.178611e-001, 4.189420e-001, 4.200159e-001, 4.210897e-001, 4.221613e-001, 4.232190e-001, 4.242766e-001, 4.253342e-001, 4.263880e-001,
+4.274415e-001, 4.284951e-001, 4.295487e-001, 4.306023e-001, 4.316559e-001, 4.327076e-001, 4.337567e-001, 4.348058e-001, 4.358539e-001, 4.368919e-001,
+4.379300e-001, 4.389680e-001, 4.400067e-001, 4.410456e-001, 4.420845e-001, 4.431211e-001, 4.441523e-001, 4.451834e-001, 4.462145e-001, 4.472317e-001,
+4.482461e-001, 4.492605e-001, 4.502734e-001, 4.512829e-001, 4.522925e-001, 4.533021e-001, 4.543111e-001, 4.553198e-001, 4.563286e-001, 4.573365e-001,
+4.583398e-001, 4.593431e-001, 4.603464e-001, 4.613440e-001, 4.623357e-001, 4.633274e-001, 4.643192e-001, 4.653110e-001, 4.663027e-001, 4.672945e-001,
+4.682862e-001, 4.692745e-001, 4.702628e-001, 4.712511e-001, 4.722385e-001, 4.732227e-001, 4.742070e-001, 4.751913e-001, 4.761729e-001, 4.771497e-001,
+4.781265e-001, 4.791033e-001, 4.800818e-001, 4.810624e-001, 4.820430e-001, 4.830236e-001, 4.840020e-001, 4.849780e-001, 4.859540e-001, 4.869301e-001,
+4.879001e-001, 4.888632e-001, 4.898263e-001, 4.907893e-001, 4.917517e-001, 4.927131e-001, 4.936744e-001, 4.946357e-001, 4.955956e-001, 4.965517e-001,
+4.975079e-001, 4.984640e-001, 4.994197e-001, 5.003701e-001, 5.013206e-001, 5.022711e-001, 5.032215e-001, 5.041645e-001, 5.051059e-001, 5.060474e-001,
+5.069888e-001, 5.079313e-001, 5.088746e-001, 5.098179e-001, 5.107612e-001, 5.117039e-001, 5.126434e-001, 5.135829e-001, 5.145224e-001, 5.154619e-001,
+5.163953e-001, 5.173267e-001, 5.182582e-001, 5.191896e-001, 5.201198e-001, 5.210467e-001, 5.219736e-001, 5.229005e-001, 5.238275e-001, 5.247487e-001,
+5.256681e-001, 5.265874e-001, 5.275068e-001, 5.284253e-001, 5.293390e-001, 5.302528e-001, 5.311665e-001, 5.320802e-001, 5.329914e-001, 5.338997e-001,
+5.348080e-001, 5.357164e-001, 5.366247e-001, 5.375317e-001, 5.384383e-001, 5.393448e-001, 5.402514e-001, 5.411579e-001, 5.420578e-001, 5.429574e-001,
+5.438571e-001, 5.447567e-001, 5.456551e-001, 5.465437e-001, 5.474323e-001, 5.483209e-001, 5.492095e-001, 5.500965e-001, 5.509771e-001, 5.518578e-001,
+5.527384e-001, 5.536190e-001, 5.545002e-001, 5.553833e-001, 5.562665e-001, 5.571496e-001, 5.580328e-001, 5.589159e-001, 5.597989e-001, 5.606819e-001,
+5.615649e-001, 5.624479e-001, 5.633309e-001, 5.642132e-001, 5.650954e-001, 5.659776e-001, 5.668599e-001, 5.677421e-001, 5.686208e-001, 5.694987e-001,
+5.703767e-001, 5.712546e-001, 5.721326e-001, 5.730064e-001, 5.738772e-001, 5.747479e-001, 5.756187e-001, 5.764895e-001, 5.773584e-001, 5.782214e-001,
+5.790843e-001, 5.799473e-001, 5.808103e-001, 5.816733e-001, 5.825273e-001, 5.833795e-001, 5.842317e-001, 5.850839e-001, 5.859361e-001, 5.867882e-001,
+5.876401e-001, 5.884919e-001, 5.893438e-001, 5.901956e-001, 5.910475e-001, 5.918962e-001, 5.927442e-001, 5.935921e-001, 5.944401e-001, 5.952880e-001,
+5.961352e-001, 5.969788e-001, 5.978223e-001, 5.986658e-001, 5.995093e-001, 6.003529e-001, 6.011932e-001, 6.020298e-001, 6.028664e-001, 6.037030e-001,
+6.045396e-001, 6.053762e-001, 6.062103e-001, 6.070431e-001, 6.078760e-001, 6.087088e-001, 6.095417e-001, 6.103746e-001, 6.112044e-001, 6.120336e-001,
+6.128627e-001, 6.136919e-001, 6.145211e-001, 6.153502e-001, 6.161778e-001, 6.170051e-001, 6.178324e-001, 6.186598e-001, 6.194871e-001, 6.203144e-001,
+6.211381e-001, 6.219612e-001, 6.227842e-001, 6.236073e-001, 6.244303e-001, 6.252534e-001, 6.260753e-001, 6.268969e-001, 6.277184e-001, 6.285399e-001,
+6.293615e-001, 6.301830e-001, 6.310017e-001, 6.318180e-001, 6.326344e-001, 6.334508e-001, 6.342671e-001, 6.350835e-001, 6.358970e-001, 6.367034e-001,
+6.375098e-001, 6.383162e-001, 6.391226e-001, 6.399290e-001, 6.407354e-001, 6.415357e-001, 6.423355e-001, 6.431353e-001, 6.439351e-001, 6.447349e-001,
+6.455347e-001, 6.463315e-001, 6.471250e-001, 6.479186e-001, 6.487122e-001, 6.495057e-001, 6.502993e-001, 6.510929e-001, 6.518820e-001, 6.526708e-001,
+6.534597e-001, 6.542486e-001, 6.550374e-001, 6.558263e-001, 6.566127e-001, 6.573941e-001, 6.581755e-001, 6.589569e-001, 6.597383e-001, 6.605197e-001,
+6.613010e-001, 6.620834e-001, 6.628664e-001, 6.636493e-001, 6.644323e-001, 6.652152e-001, 6.659982e-001, 6.667811e-001, 6.675598e-001, 6.683376e-001,
+6.691154e-001, 6.698932e-001, 6.706710e-001, 6.714488e-001, 6.722266e-001, 6.729933e-001, 6.737593e-001, 6.745253e-001, 6.752913e-001, 6.760573e-001,
+6.768233e-001, 6.775893e-001, 6.783526e-001, 6.791156e-001, 6.798787e-001, 6.806418e-001, 6.814049e-001, 6.821680e-001, 6.829311e-001, 6.836893e-001,
+6.844468e-001, 6.852043e-001, 6.859618e-001, 6.867193e-001, 6.874767e-001, 6.882342e-001, 6.889876e-001, 6.897391e-001, 6.904906e-001, 6.912421e-001,
+6.919936e-001, 6.927451e-001, 6.934966e-001, 6.942445e-001, 6.949873e-001, 6.957302e-001, 6.964730e-001, 6.972159e-001, 6.979587e-001, 6.987016e-001,
+6.994444e-001, 7.001873e-001, 7.009302e-001, 7.016731e-001, 7.024160e-001, 7.031589e-001, 7.039018e-001, 7.046447e-001, 7.053861e-001, 7.061263e-001,
+7.068666e-001, 7.076068e-001, 7.083471e-001, 7.090874e-001, 7.098276e-001, 7.105679e-001, 7.113052e-001, 7.120424e-001, 7.127797e-001, 7.135170e-001,
+7.142542e-001, 7.149915e-001, 7.157288e-001, 7.164642e-001, 7.171959e-001, 7.179275e-001, 7.186592e-001, 7.193908e-001, 7.201225e-001, 7.208541e-001,
+7.215858e-001, 7.223190e-001, 7.230535e-001, 7.237880e-001, 7.245226e-001, 7.252571e-001, 7.259916e-001, 7.267261e-001, 7.274606e-001, 7.281941e-001,
+7.289270e-001, 7.296599e-001, 7.303928e-001, 7.311258e-001, 7.318587e-001, 7.325916e-001, 7.333245e-001, 7.340542e-001, 7.347822e-001, 7.355103e-001,
+7.362383e-001, 7.369664e-001, 7.376944e-001, 7.384225e-001, 7.391505e-001, 7.398774e-001, 7.406034e-001, 7.413294e-001, 7.420554e-001, 7.427814e-001,
+7.435074e-001, 7.442334e-001, 7.449594e-001, 7.456838e-001, 7.464053e-001, 7.471268e-001, 7.478482e-001, 7.485697e-001, 7.492912e-001, 7.500127e-001,
+7.507342e-001, 7.514556e-001, 7.521722e-001, 7.528889e-001, 7.536056e-001, 7.543222e-001, 7.550389e-001, 7.557556e-001, 7.564722e-001, 7.571889e-001,
+7.579011e-001, 7.586102e-001, 7.593192e-001, 7.600283e-001, 7.607374e-001, 7.614464e-001, 7.621555e-001, 7.628645e-001, 7.635736e-001, 7.642833e-001,
+7.649930e-001, 7.657027e-001, 7.664125e-001, 7.671222e-001, 7.678319e-001, 7.685416e-001, 7.692513e-001, 7.699597e-001, 7.706660e-001, 7.713723e-001,
+7.720786e-001, 7.727849e-001, 7.734912e-001, 7.741974e-001, 7.749037e-001, 7.756100e-001, 7.763124e-001, 7.770121e-001, 7.777118e-001, 7.784114e-001,
+7.791111e-001, 7.798107e-001, 7.805104e-001, 7.812101e-001, 7.819097e-001, 7.826066e-001, 7.833021e-001, 7.839977e-001, 7.846932e-001, 7.853888e-001,
+7.860843e-001, 7.867799e-001, 7.874754e-001, 7.881709e-001, 7.888624e-001, 7.895516e-001, 7.902409e-001, 7.909301e-001, 7.916194e-001, 7.923086e-001,
+7.929979e-001, 7.936871e-001, 7.943764e-001, 7.950641e-001, 7.957503e-001, 7.964366e-001, 7.971228e-001, 7.978091e-001, 7.984953e-001, 7.991815e-001,
+7.998678e-001, 8.005540e-001, 8.012402e-001, 8.019265e-001, 8.026127e-001, 8.032989e-001, 8.039851e-001, 8.046713e-001, 8.053576e-001, 8.060438e-001,
+8.067300e-001, 8.074162e-001, 8.081002e-001, 8.087838e-001, 8.094674e-001, 8.101510e-001, 8.108346e-001, 8.115182e-001, 8.122017e-001, 8.128853e-001,
+8.135689e-001, 8.142509e-001, 8.149295e-001, 8.156081e-001, 8.162867e-001, 8.169653e-001, 8.176439e-001, 8.183225e-001, 8.190010e-001, 8.196796e-001,
+8.203582e-001, 8.210344e-001, 8.217092e-001, 8.223841e-001, 8.230590e-001, 8.237338e-001, 8.244087e-001, 8.250836e-001, 8.257584e-001, 8.264333e-001,
+8.271082e-001, 8.277802e-001, 8.284517e-001, 8.291233e-001, 8.297949e-001, 8.304665e-001, 8.311380e-001, 8.318096e-001, 8.324812e-001, 8.331528e-001,
+8.338243e-001, 8.344955e-001, 8.351666e-001, 8.358377e-001, 8.365089e-001, 8.371800e-001, 8.378511e-001, 8.385222e-001, 8.391934e-001, 8.398645e-001,
+8.405356e-001, 8.412041e-001, 8.418723e-001, 8.425405e-001, 8.432087e-001, 8.438770e-001, 8.445452e-001, 8.452134e-001, 8.458816e-001, 8.465498e-001,
+8.472180e-001, 8.478840e-001, 8.485489e-001, 8.492139e-001, 8.498789e-001, 8.505439e-001, 8.512089e-001, 8.518739e-001, 8.525389e-001, 8.532039e-001,
+8.538689e-001, 8.545317e-001, 8.551911e-001, 8.558505e-001, 8.565100e-001, 8.571694e-001, 8.578288e-001, 8.584882e-001, 8.591476e-001, 8.598070e-001,
+8.604664e-001, 8.611258e-001, 8.617824e-001, 8.624387e-001, 8.630950e-001, 8.637513e-001, 8.644076e-001, 8.650639e-001, 8.657202e-001, 8.663765e-001,
+8.670328e-001, 8.676891e-001, 8.683446e-001, 8.689983e-001, 8.696519e-001, 8.703056e-001, 8.709592e-001, 8.716129e-001, 8.722666e-001, 8.729202e-001,
+8.735739e-001, 8.742275e-001, 8.748812e-001, 8.755341e-001, 8.761865e-001, 8.768388e-001, 8.774912e-001, 8.781435e-001, 8.787959e-001, 8.794482e-001,
+8.801006e-001, 8.807529e-001, 8.814053e-001, 8.820576e-001, 8.827077e-001, 8.833565e-001, 8.840054e-001, 8.846543e-001, 8.853031e-001, 8.859520e-001,
+8.866009e-001, 8.872497e-001, 8.878986e-001, 8.885474e-001, 8.891963e-001, 8.898416e-001, 8.904846e-001, 8.911275e-001, 8.917705e-001, 8.924135e-001,
+8.930564e-001, 8.936994e-001, 8.943423e-001, 8.949853e-001, 8.956283e-001, 8.962712e-001, 8.969116e-001, 8.975484e-001, 8.981851e-001, 8.988218e-001,
+8.994585e-001, 9.000952e-001, 9.007319e-001, 9.013686e-001, 9.020053e-001, 9.026420e-001, 9.032788e-001, 9.039150e-001, 9.045433e-001, 9.051716e-001,
+9.057999e-001, 9.064282e-001, 9.070565e-001, 9.076849e-001, 9.083132e-001, 9.089415e-001, 9.095698e-001, 9.101981e-001, 9.108264e-001, 9.114509e-001,
+9.120722e-001, 9.126935e-001, 9.133148e-001, 9.139361e-001, 9.145574e-001, 9.151787e-001, 9.158000e-001, 9.164213e-001, 9.170426e-001, 9.176639e-001,
+9.182853e-001, 9.188956e-001, 9.195046e-001, 9.201137e-001, 9.207228e-001, 9.213318e-001, 9.219409e-001, 9.225499e-001, 9.231590e-001, 9.237680e-001,
+9.243771e-001, 9.249861e-001, 9.255942e-001, 9.261905e-001, 9.267868e-001, 9.273831e-001, 9.279794e-001, 9.285757e-001, 9.291720e-001, 9.297683e-001,
+9.303646e-001, 9.309608e-001, 9.315571e-001, 9.321534e-001, 9.327490e-001, 9.333375e-001, 9.339260e-001, 9.345145e-001, 9.351030e-001, 9.356916e-001,
+9.362801e-001, 9.368686e-001, 9.374571e-001, 9.380456e-001, 9.386342e-001, 9.392227e-001, 9.398112e-001, 9.403958e-001, 9.409803e-001, 9.415648e-001,
+9.421493e-001, 9.427338e-001, 9.433182e-001, 9.439027e-001, 9.444872e-001, 9.450717e-001, 9.456562e-001, 9.462407e-001, 9.468251e-001, 9.474025e-001,
+9.479761e-001, 9.485497e-001, 9.491233e-001, 9.496969e-001, 9.502705e-001, 9.508441e-001, 9.514177e-001, 9.519913e-001, 9.525649e-001, 9.531385e-001,
+9.537121e-001, 9.542836e-001, 9.548455e-001, 9.554074e-001, 9.559694e-001, 9.565313e-001, 9.570932e-001, 9.576551e-001, 9.582170e-001, 9.587789e-001,
+9.593408e-001, 9.599027e-001, 9.604646e-001, 9.610265e-001, 9.615818e-001, 9.621313e-001, 9.626807e-001, 9.632302e-001, 9.637797e-001, 9.643292e-001,
+9.648787e-001, 9.654282e-001, 9.659777e-001, 9.665271e-001, 9.670766e-001, 9.676261e-001, 9.681756e-001, 9.687123e-001, 9.692442e-001, 9.697761e-001,
+9.703080e-001, 9.708399e-001, 9.713717e-001, 9.719036e-001, 9.724355e-001, 9.729674e-001, 9.734993e-001, 9.740311e-001, 9.745630e-001, 9.750949e-001,
+9.756121e-001, 9.761241e-001, 9.766360e-001, 9.771480e-001, 9.776600e-001, 9.781719e-001, 9.786839e-001, 9.791959e-001, 9.797078e-001, 9.802198e-001,
+9.807318e-001, 9.812437e-001, 9.817557e-001, 9.822546e-001, 9.827439e-001, 9.832331e-001, 9.837223e-001, 9.842115e-001, 9.847008e-001, 9.851900e-001,
+9.856792e-001, 9.861685e-001, 9.866577e-001, 9.871469e-001, 9.876361e-001, 9.881254e-001, 9.886041e-001, 9.890480e-001, 9.894919e-001, 9.899358e-001,
+9.903797e-001, 9.908236e-001, 9.912675e-001, 9.917114e-001, 9.921553e-001, 9.925992e-001, 9.930431e-001, 9.934869e-001, 9.939308e-001, 9.943747e-001,
+9.947882e-001, 9.951891e-001, 9.955900e-001, 9.959909e-001, 9.963919e-001, 9.967928e-001, 9.971937e-001, 9.975946e-001, 9.979955e-001, 9.983964e-001,
+9.987973e-001, 9.991982e-001, 9.995991e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.800549e-003, 1.492121e-002, 2.106357e-002, 2.646407e-002, 3.139266e-002, 3.596282e-002, 4.027581e-002, 4.431429e-002, 4.821379e-002,
+5.193151e-002, 5.551570e-002, 5.900680e-002, 6.238987e-002, 6.569358e-002, 6.888959e-002, 7.199438e-002, 7.499785e-002, 7.791839e-002, 8.078365e-002,
+8.361650e-002, 8.640031e-002, 8.913568e-002, 9.183058e-002, 9.448816e-002, 9.710419e-002, 9.970084e-002, 1.022530e-001, 1.047334e-001, 1.071523e-001,
+1.095332e-001, 1.118893e-001, 1.142370e-001, 1.165517e-001, 1.188732e-001, 1.211700e-001, 1.234538e-001, 1.256997e-001, 1.279380e-001, 1.301370e-001,
+1.323242e-001, 1.344672e-001, 1.365955e-001, 1.386838e-001, 1.407471e-001, 1.428091e-001, 1.448387e-001, 1.468653e-001, 1.488718e-001, 1.508520e-001,
+1.528412e-001, 1.548042e-001, 1.567574e-001, 1.587091e-001, 1.606369e-001, 1.625535e-001, 1.644703e-001, 1.663695e-001, 1.682511e-001, 1.701293e-001,
+1.719716e-001, 1.737945e-001, 1.756184e-001, 1.774290e-001, 1.792114e-001, 1.809861e-001, 1.827580e-001, 1.845048e-001, 1.862315e-001, 1.879574e-001,
+1.896873e-001, 1.914020e-001, 1.931017e-001, 1.948023e-001, 1.965142e-001, 1.982154e-001, 1.999047e-001, 2.015920e-001, 2.032641e-001, 2.049120e-001,
+2.065432e-001, 2.081688e-001, 2.097914e-001, 2.114066e-001, 2.130115e-001, 2.146049e-001, 2.161997e-001, 2.177952e-001, 2.193817e-001, 2.209558e-001,
+2.225205e-001, 2.240840e-001, 2.256535e-001, 2.272066e-001, 2.287466e-001, 2.302783e-001, 2.318089e-001, 2.333445e-001, 2.348676e-001, 2.363776e-001,
+2.378766e-001, 2.393743e-001, 2.408725e-001, 2.423699e-001, 2.438612e-001, 2.453384e-001, 2.468092e-001, 2.482766e-001, 2.497424e-001, 2.512080e-001,
+2.526737e-001, 2.541225e-001, 2.555668e-001, 2.570067e-001, 2.584454e-001, 2.598778e-001, 2.613001e-001, 2.627095e-001, 2.641145e-001, 2.655147e-001,
+2.669171e-001, 2.683208e-001, 2.697082e-001, 2.710885e-001, 2.724552e-001, 2.738171e-001, 2.751764e-001, 2.765411e-001, 2.779048e-001, 2.792651e-001,
+2.806189e-001, 2.819664e-001, 2.833054e-001, 2.846413e-001, 2.859782e-001, 2.873162e-001, 2.886606e-001, 2.899999e-001, 2.913273e-001, 2.926500e-001,
+2.939666e-001, 2.952839e-001, 2.966020e-001, 2.979250e-001, 2.992509e-001, 3.005655e-001, 3.018752e-001, 3.031772e-001, 3.044763e-001, 3.057742e-001,
+3.070715e-001, 3.083544e-001, 3.096314e-001, 3.108930e-001, 3.121467e-001, 3.133935e-001, 3.146355e-001, 3.158773e-001, 3.171189e-001, 3.183605e-001,
+3.196019e-001, 3.208409e-001, 3.220692e-001, 3.232975e-001, 3.245128e-001, 3.257281e-001, 3.269419e-001, 3.281554e-001, 3.293736e-001, 3.305963e-001,
+3.318206e-001, 3.330497e-001, 3.342789e-001, 3.354977e-001, 3.367156e-001, 3.379318e-001, 3.391467e-001, 3.403621e-001, 3.415793e-001, 3.427965e-001,
+3.439979e-001, 3.451953e-001, 3.463876e-001, 3.475710e-001, 3.487544e-001, 3.499352e-001, 3.511157e-001, 3.522971e-001, 3.534801e-001, 3.546631e-001,
+3.558302e-001, 3.569942e-001, 3.581548e-001, 3.593055e-001, 3.604562e-001, 3.616054e-001, 3.627536e-001, 3.639019e-001, 3.650487e-001, 3.661954e-001,
+3.673395e-001, 3.684779e-001, 3.696163e-001, 3.707447e-001, 3.718663e-001, 3.729879e-001, 3.741045e-001, 3.752200e-001, 3.763358e-001, 3.774559e-001,
+3.785760e-001, 3.796964e-001, 3.808179e-001, 3.819393e-001, 3.830556e-001, 3.841623e-001, 3.852690e-001, 3.863727e-001, 3.874725e-001, 3.885723e-001,
+3.896723e-001, 3.907727e-001, 3.918730e-001, 3.929738e-001, 3.940750e-001, 3.951762e-001, 3.962723e-001, 3.973629e-001, 3.984536e-001, 3.995419e-001,
+4.006269e-001, 4.017120e-001, 4.027975e-001, 4.038844e-001, 4.049712e-001, 4.060561e-001, 4.071292e-001, 4.082024e-001, 4.092756e-001, 4.103333e-001,
+4.113903e-001, 4.124472e-001, 4.134994e-001, 4.145496e-001, 4.155999e-001, 4.166513e-001, 4.177044e-001, 4.187575e-001, 4.198101e-001, 4.208577e-001,
+4.219054e-001, 4.229531e-001, 4.239928e-001, 4.250295e-001, 4.260662e-001, 4.271000e-001, 4.281273e-001, 4.291546e-001, 4.301819e-001, 4.312093e-001,
+4.322367e-001, 4.332642e-001, 4.342932e-001, 4.353256e-001, 4.363580e-001, 4.373905e-001, 4.384125e-001, 4.394314e-001, 4.404503e-001, 4.414678e-001,
+4.424778e-001, 4.434877e-001, 4.444976e-001, 4.455076e-001, 4.465177e-001, 4.475277e-001, 4.485378e-001, 4.495514e-001, 4.505660e-001, 4.515805e-001,
+4.525945e-001, 4.535954e-001, 4.545962e-001, 4.555971e-001, 4.565959e-001, 4.575877e-001, 4.585796e-001, 4.595714e-001, 4.605633e-001, 4.615552e-001,
+4.625471e-001, 4.635390e-001, 4.645307e-001, 4.655223e-001, 4.665139e-001, 4.675054e-001, 4.684921e-001, 4.694738e-001, 4.704555e-001, 4.714371e-001,
+4.724138e-001, 4.733850e-001, 4.743562e-001, 4.753274e-001, 4.762980e-001, 4.772676e-001, 4.782372e-001, 4.792068e-001, 4.801763e-001, 4.811457e-001,
+4.821151e-001, 4.830845e-001, 4.840534e-001, 4.850172e-001, 4.859809e-001, 4.869446e-001, 4.879083e-001, 4.888612e-001, 4.898120e-001, 4.907627e-001,
+4.917135e-001, 4.926620e-001, 4.936085e-001, 4.945550e-001, 4.955015e-001, 4.964487e-001, 4.973995e-001, 4.983503e-001, 4.993010e-001, 5.002518e-001,
+5.012043e-001, 5.021574e-001, 5.031105e-001, 5.040636e-001, 5.050135e-001, 5.059555e-001, 5.068974e-001, 5.078394e-001, 5.087814e-001, 5.097197e-001,
+5.106567e-001, 5.115938e-001, 5.125308e-001, 5.134680e-001, 5.144063e-001, 5.153445e-001, 5.162827e-001, 5.172210e-001, 5.181534e-001, 5.190796e-001,
+5.200058e-001, 5.209321e-001, 5.218583e-001, 5.227739e-001, 5.236863e-001, 5.245986e-001, 5.255110e-001, 5.264233e-001, 5.273302e-001, 5.282369e-001,
+5.291437e-001, 5.300504e-001, 5.309572e-001, 5.318646e-001, 5.327720e-001, 5.336794e-001, 5.345868e-001, 5.354917e-001, 5.363870e-001, 5.372823e-001,
+5.381776e-001, 5.390729e-001, 5.399650e-001, 5.408457e-001, 5.417263e-001, 5.426069e-001, 5.434876e-001, 5.443672e-001, 5.452415e-001, 5.461158e-001,
+5.469900e-001, 5.478643e-001, 5.487386e-001, 5.496148e-001, 5.504909e-001, 5.513671e-001, 5.522432e-001, 5.531194e-001, 5.539949e-001, 5.548702e-001,
+5.557455e-001, 5.566209e-001, 5.574962e-001, 5.583639e-001, 5.592260e-001, 5.600881e-001, 5.609502e-001, 5.618123e-001, 5.626727e-001, 5.635279e-001,
+5.643830e-001, 5.652381e-001, 5.660933e-001, 5.669484e-001, 5.678044e-001, 5.686606e-001, 5.695167e-001, 5.703729e-001, 5.712291e-001, 5.720870e-001,
+5.729480e-001, 5.738091e-001, 5.746701e-001, 5.755312e-001, 5.763923e-001, 5.772445e-001, 5.780945e-001, 5.789445e-001, 5.797946e-001, 5.806446e-001,
+5.814934e-001, 5.823365e-001, 5.831796e-001, 5.840227e-001, 5.848657e-001, 5.857088e-001, 5.865523e-001, 5.873963e-001, 5.882403e-001, 5.890843e-001,
+5.899283e-001, 5.907723e-001, 5.916195e-001, 5.924683e-001, 5.933171e-001, 5.941658e-001, 5.950146e-001, 5.958634e-001, 5.967034e-001, 5.975414e-001,
+5.983794e-001, 5.992174e-001, 6.000554e-001, 6.008934e-001, 6.017255e-001, 6.025568e-001, 6.033880e-001, 6.042193e-001, 6.050505e-001, 6.058818e-001,
+6.067139e-001, 6.075462e-001, 6.083784e-001, 6.092107e-001, 6.100430e-001, 6.108752e-001, 6.117079e-001, 6.125406e-001, 6.133734e-001, 6.142062e-001,
+6.150389e-001, 6.158717e-001, 6.167000e-001, 6.175248e-001, 6.183496e-001, 6.191744e-001, 6.199992e-001, 6.208240e-001, 6.216465e-001, 6.224632e-001,
+6.232798e-001, 6.240965e-001, 6.249132e-001, 6.257298e-001, 6.265465e-001, 6.273627e-001, 6.281788e-001, 6.289949e-001, 6.298110e-001, 6.306271e-001,
+6.314432e-001, 6.322598e-001, 6.330771e-001, 6.338943e-001, 6.347116e-001, 6.355288e-001, 6.363461e-001, 6.371633e-001, 6.379770e-001, 6.387906e-001,
+6.396042e-001, 6.404178e-001, 6.412314e-001, 6.420449e-001, 6.428550e-001, 6.436583e-001, 6.444616e-001, 6.452649e-001, 6.460682e-001, 6.468715e-001,
+6.476748e-001, 6.484764e-001, 6.492768e-001, 6.500773e-001, 6.508778e-001, 6.516783e-001, 6.524788e-001, 6.532792e-001, 6.540804e-001, 6.548818e-001,
+6.556832e-001, 6.564845e-001, 6.572859e-001, 6.580872e-001, 6.588886e-001, 6.596770e-001, 6.604645e-001, 6.612521e-001, 6.620396e-001, 6.628272e-001,
+6.636147e-001, 6.644023e-001, 6.651804e-001, 6.659580e-001, 6.667356e-001, 6.675132e-001, 6.682908e-001, 6.690684e-001, 6.698460e-001, 6.706213e-001,
+6.713962e-001, 6.721712e-001, 6.729462e-001, 6.737211e-001, 6.744961e-001, 6.752711e-001, 6.760480e-001, 6.768259e-001, 6.776037e-001, 6.783815e-001,
+6.791594e-001, 6.799372e-001, 6.807151e-001, 6.814894e-001, 6.822588e-001, 6.830282e-001, 6.837977e-001, 6.845671e-001, 6.853366e-001, 6.861060e-001,
+6.868749e-001, 6.876338e-001, 6.883926e-001, 6.891514e-001, 6.899103e-001, 6.906691e-001, 6.914280e-001, 6.921868e-001, 6.929437e-001, 6.936991e-001,
+6.944546e-001, 6.952100e-001, 6.959655e-001, 6.967209e-001, 6.974764e-001, 6.982319e-001, 6.989893e-001, 6.997468e-001, 7.005043e-001, 7.012618e-001,
+7.020193e-001, 7.027768e-001, 7.035343e-001, 7.042889e-001, 7.050375e-001, 7.057860e-001, 7.065346e-001, 7.072832e-001, 7.080318e-001, 7.087804e-001,
+7.095290e-001, 7.102716e-001, 7.110090e-001, 7.117465e-001, 7.124840e-001, 7.132215e-001, 7.139590e-001, 7.146965e-001, 7.154340e-001, 7.161688e-001,
+7.169022e-001, 7.176356e-001, 7.183690e-001, 7.191024e-001, 7.198358e-001, 7.205692e-001, 7.213026e-001, 7.220379e-001, 7.227741e-001, 7.235104e-001,
+7.242466e-001, 7.249829e-001, 7.257191e-001, 7.264554e-001, 7.271916e-001, 7.279284e-001, 7.286654e-001, 7.294025e-001, 7.301396e-001, 7.308767e-001,
+7.316137e-001, 7.323508e-001, 7.330879e-001, 7.338216e-001, 7.345489e-001, 7.352762e-001, 7.360035e-001, 7.367308e-001, 7.374581e-001, 7.381855e-001,
+7.389128e-001, 7.396400e-001, 7.403626e-001, 7.410853e-001, 7.418080e-001, 7.425306e-001, 7.432533e-001, 7.439760e-001, 7.446986e-001, 7.454213e-001,
+7.461452e-001, 7.468700e-001, 7.475948e-001, 7.483196e-001, 7.490443e-001, 7.497691e-001, 7.504939e-001, 7.512187e-001, 7.519437e-001, 7.526741e-001,
+7.534046e-001, 7.541350e-001, 7.548654e-001, 7.555958e-001, 7.563263e-001, 7.570567e-001, 7.577871e-001, 7.585147e-001, 7.592375e-001, 7.599602e-001,
+7.606830e-001, 7.614058e-001, 7.621285e-001, 7.628513e-001, 7.635740e-001, 7.642968e-001, 7.650170e-001, 7.657353e-001, 7.664536e-001, 7.671720e-001,
+7.678903e-001, 7.686086e-001, 7.693270e-001, 7.700453e-001, 7.707636e-001, 7.714834e-001, 7.722039e-001, 7.729244e-001, 7.736448e-001, 7.743653e-001,
+7.750858e-001, 7.758062e-001, 7.765267e-001, 7.772472e-001, 7.779653e-001, 7.786823e-001, 7.793992e-001, 7.801161e-001, 7.808331e-001, 7.815500e-001,
+7.822669e-001, 7.829839e-001, 7.837008e-001, 7.844139e-001, 7.851232e-001, 7.858325e-001, 7.865418e-001, 7.872512e-001, 7.879605e-001, 7.886698e-001,
+7.893791e-001, 7.900884e-001, 7.907963e-001, 7.914994e-001, 7.922024e-001, 7.929055e-001, 7.936086e-001, 7.943117e-001, 7.950148e-001, 7.957178e-001,
+7.964209e-001, 7.971240e-001, 7.978272e-001, 7.985304e-001, 7.992336e-001, 7.999368e-001, 8.006400e-001, 8.013432e-001, 8.020465e-001, 8.027497e-001,
+8.034529e-001, 8.041560e-001, 8.048590e-001, 8.055621e-001, 8.062651e-001, 8.069681e-001, 8.076711e-001, 8.083741e-001, 8.090771e-001, 8.097801e-001,
+8.104832e-001, 8.111814e-001, 8.118773e-001, 8.125731e-001, 8.132689e-001, 8.139647e-001, 8.146606e-001, 8.153564e-001, 8.160522e-001, 8.167480e-001,
+8.174438e-001, 8.181331e-001, 8.188215e-001, 8.195099e-001, 8.201982e-001, 8.208866e-001, 8.215750e-001, 8.222633e-001, 8.229517e-001, 8.236400e-001,
+8.243284e-001, 8.250158e-001, 8.257031e-001, 8.263904e-001, 8.270778e-001, 8.277651e-001, 8.284524e-001, 8.291397e-001, 8.298271e-001, 8.305144e-001,
+8.312017e-001, 8.318878e-001, 8.325737e-001, 8.332597e-001, 8.339457e-001, 8.346316e-001, 8.353176e-001, 8.360035e-001, 8.366895e-001, 8.373754e-001,
+8.380614e-001, 8.387415e-001, 8.394192e-001, 8.400970e-001, 8.407747e-001, 8.414524e-001, 8.421302e-001, 8.428079e-001, 8.434856e-001, 8.441634e-001,
+8.448411e-001, 8.455155e-001, 8.461847e-001, 8.468538e-001, 8.475230e-001, 8.481922e-001, 8.488613e-001, 8.495305e-001, 8.501996e-001, 8.508688e-001,
+8.515380e-001, 8.522071e-001, 8.528741e-001, 8.535410e-001, 8.542078e-001, 8.548746e-001, 8.555414e-001, 8.562082e-001, 8.568751e-001, 8.575419e-001,
+8.582087e-001, 8.588755e-001, 8.595426e-001, 8.602102e-001, 8.608778e-001, 8.615455e-001, 8.622131e-001, 8.628807e-001, 8.635483e-001, 8.642160e-001,
+8.648836e-001, 8.655512e-001, 8.662188e-001, 8.668800e-001, 8.675361e-001, 8.681922e-001, 8.688483e-001, 8.695044e-001, 8.701604e-001, 8.708165e-001,
+8.714726e-001, 8.721287e-001, 8.727848e-001, 8.734409e-001, 8.740914e-001, 8.747391e-001, 8.753868e-001, 8.760344e-001, 8.766821e-001, 8.773298e-001,
+8.779775e-001, 8.786251e-001, 8.792728e-001, 8.799205e-001, 8.805681e-001, 8.812144e-001, 8.818598e-001, 8.825052e-001, 8.831506e-001, 8.837960e-001,
+8.844414e-001, 8.850868e-001, 8.857321e-001, 8.863775e-001, 8.870229e-001, 8.876683e-001, 8.883140e-001, 8.889602e-001, 8.896064e-001, 8.902525e-001,
+8.908987e-001, 8.915449e-001, 8.921910e-001, 8.928372e-001, 8.934834e-001, 8.941295e-001, 8.947757e-001, 8.954212e-001, 8.960561e-001, 8.966909e-001,
+8.973258e-001, 8.979606e-001, 8.985955e-001, 8.992303e-001, 8.998652e-001, 9.005000e-001, 9.011349e-001, 9.017697e-001, 9.024046e-001, 9.030348e-001,
+9.036614e-001, 9.042880e-001, 9.049146e-001, 9.055412e-001, 9.061678e-001, 9.067944e-001, 9.074210e-001, 9.080476e-001, 9.086742e-001, 9.093007e-001,
+9.099273e-001, 9.105506e-001, 9.111735e-001, 9.117964e-001, 9.124193e-001, 9.130421e-001, 9.136650e-001, 9.142879e-001, 9.149108e-001, 9.155337e-001,
+9.161566e-001, 9.167795e-001, 9.174021e-001, 9.180212e-001, 9.186404e-001, 9.192596e-001, 9.198788e-001, 9.204980e-001, 9.211171e-001, 9.217363e-001,
+9.223555e-001, 9.229747e-001, 9.235939e-001, 9.242130e-001, 9.248315e-001, 9.254437e-001, 9.260558e-001, 9.266679e-001, 9.272801e-001, 9.278922e-001,
+9.285043e-001, 9.291165e-001, 9.297286e-001, 9.303408e-001, 9.309529e-001, 9.315650e-001, 9.321772e-001, 9.327827e-001, 9.333880e-001, 9.339933e-001,
+9.345986e-001, 9.352039e-001, 9.358092e-001, 9.364145e-001, 9.370198e-001, 9.376251e-001, 9.382304e-001, 9.388357e-001, 9.394410e-001, 9.400426e-001,
+9.406422e-001, 9.412418e-001, 9.418415e-001, 9.424411e-001, 9.430407e-001, 9.436403e-001, 9.442400e-001, 9.448396e-001, 9.454392e-001, 9.460388e-001,
+9.466385e-001, 9.472374e-001, 9.478333e-001, 9.484291e-001, 9.490250e-001, 9.496209e-001, 9.502167e-001, 9.508126e-001, 9.514084e-001, 9.520043e-001,
+9.526002e-001, 9.531960e-001, 9.537919e-001, 9.543877e-001, 9.549802e-001, 9.555697e-001, 9.561593e-001, 9.567488e-001, 9.573383e-001, 9.579279e-001,
+9.585174e-001, 9.591069e-001, 9.596965e-001, 9.602860e-001, 9.608755e-001, 9.614651e-001, 9.620546e-001, 9.626389e-001, 9.632212e-001, 9.638035e-001,
+9.643858e-001, 9.649681e-001, 9.655504e-001, 9.661327e-001, 9.667150e-001, 9.672973e-001, 9.678796e-001, 9.684619e-001, 9.690441e-001, 9.696264e-001,
+9.702054e-001, 9.707831e-001, 9.713609e-001, 9.719387e-001, 9.725164e-001, 9.730942e-001, 9.736719e-001, 9.742497e-001, 9.748274e-001, 9.754052e-001,
+9.759829e-001, 9.765607e-001, 9.771384e-001, 9.777117e-001, 9.782818e-001, 9.788518e-001, 9.794218e-001, 9.799918e-001, 9.805618e-001, 9.811318e-001,
+9.817018e-001, 9.822718e-001, 9.828418e-001, 9.834119e-001, 9.839819e-001, 9.845519e-001, 9.851186e-001, 9.856745e-001, 9.862304e-001, 9.867863e-001,
+9.873422e-001, 9.878981e-001, 9.884540e-001, 9.890099e-001, 9.895658e-001, 9.901217e-001, 9.906776e-001, 9.912334e-001, 9.917893e-001, 9.923452e-001,
+9.928945e-001, 9.934411e-001, 9.939877e-001, 9.945343e-001, 9.950808e-001, 9.956274e-001, 9.961740e-001, 9.967206e-001, 9.972671e-001, 9.978137e-001,
+9.983603e-001, 9.989069e-001, 9.994534e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.155341e-003, 1.154773e-002, 1.621591e-002, 2.041653e-002, 2.427130e-002, 2.791289e-002, 3.138687e-002, 3.469478e-002, 3.788374e-002,
+4.097370e-002, 4.395438e-002, 4.686497e-002, 4.969610e-002, 5.245325e-002, 5.514579e-002, 5.779574e-002, 6.036961e-002, 6.289007e-002, 6.536800e-002,
+6.781653e-002, 7.025050e-002, 7.266041e-002, 7.503410e-002, 7.736603e-002, 7.964657e-002, 8.189207e-002, 8.409723e-002, 8.626702e-002, 8.840320e-002,
+9.052696e-002, 9.264069e-002, 9.474927e-002, 9.682954e-002, 9.889669e-002, 1.009426e-001, 1.029729e-001, 1.049893e-001, 1.069732e-001, 1.089398e-001,
+1.109105e-001, 1.128706e-001, 1.148164e-001, 1.167599e-001, 1.186747e-001, 1.205610e-001, 1.224155e-001, 1.242437e-001, 1.260576e-001, 1.278497e-001,
+1.296254e-001, 1.313930e-001, 1.331462e-001, 1.349010e-001, 1.366535e-001, 1.383930e-001, 1.401329e-001, 1.418719e-001, 1.436001e-001, 1.453143e-001,
+1.470246e-001, 1.487206e-001, 1.504009e-001, 1.520728e-001, 1.537348e-001, 1.554002e-001, 1.570577e-001, 1.587099e-001, 1.603520e-001, 1.619875e-001,
+1.636176e-001, 1.652458e-001, 1.668602e-001, 1.684632e-001, 1.700568e-001, 1.716396e-001, 1.732197e-001, 1.747862e-001, 1.763375e-001, 1.778808e-001,
+1.794188e-001, 1.809533e-001, 1.824880e-001, 1.840220e-001, 1.855459e-001, 1.870635e-001, 1.885785e-001, 1.900880e-001, 1.915943e-001, 1.930999e-001,
+1.946053e-001, 1.961077e-001, 1.975980e-001, 1.990833e-001, 2.005632e-001, 2.020381e-001, 2.035096e-001, 2.049811e-001, 2.064443e-001, 2.079003e-001,
+2.093524e-001, 2.107995e-001, 2.122383e-001, 2.136691e-001, 2.150932e-001, 2.165145e-001, 2.179323e-001, 2.193447e-001, 2.207509e-001, 2.221534e-001,
+2.235517e-001, 2.249393e-001, 2.263229e-001, 2.277022e-001, 2.290781e-001, 2.304509e-001, 2.318189e-001, 2.331835e-001, 2.345475e-001, 2.359124e-001,
+2.372699e-001, 2.386226e-001, 2.399671e-001, 2.413100e-001, 2.426497e-001, 2.439856e-001, 2.453195e-001, 2.466553e-001, 2.479909e-001, 2.493253e-001,
+2.506528e-001, 2.519731e-001, 2.532928e-001, 2.546122e-001, 2.559293e-001, 2.572457e-001, 2.585586e-001, 2.598730e-001, 2.611912e-001, 2.625050e-001,
+2.638129e-001, 2.651131e-001, 2.664064e-001, 2.676930e-001, 2.689754e-001, 2.702546e-001, 2.715323e-001, 2.728073e-001, 2.740811e-001, 2.753461e-001,
+2.766075e-001, 2.778604e-001, 2.791096e-001, 2.803491e-001, 2.815834e-001, 2.828159e-001, 2.840469e-001, 2.852747e-001, 2.864989e-001, 2.877180e-001,
+2.889272e-001, 2.901360e-001, 2.913432e-001, 2.925504e-001, 2.937471e-001, 2.949437e-001, 2.961354e-001, 2.973257e-001, 2.985164e-001, 2.997077e-001,
+3.008984e-001, 3.020872e-001, 3.032760e-001, 3.044617e-001, 3.056470e-001, 3.068350e-001, 3.080250e-001, 3.092129e-001, 3.103925e-001, 3.115720e-001,
+3.127532e-001, 3.139348e-001, 3.151153e-001, 3.162938e-001, 3.174723e-001, 3.186488e-001, 3.198250e-001, 3.210015e-001, 3.221787e-001, 3.233558e-001,
+3.245330e-001, 3.257103e-001, 3.268886e-001, 3.280702e-001, 3.292518e-001, 3.304269e-001, 3.315982e-001, 3.327696e-001, 3.339314e-001, 3.350930e-001,
+3.362526e-001, 3.374074e-001, 3.385623e-001, 3.397139e-001, 3.408632e-001, 3.420126e-001, 3.431645e-001, 3.443170e-001, 3.454688e-001, 3.466031e-001,
+3.477375e-001, 3.488697e-001, 3.499937e-001, 3.511176e-001, 3.522385e-001, 3.533534e-001, 3.544683e-001, 3.555806e-001, 3.566895e-001, 3.577984e-001,
+3.589072e-001, 3.600157e-001, 3.611243e-001, 3.622342e-001, 3.633456e-001, 3.644570e-001, 3.655648e-001, 3.666686e-001, 3.677723e-001, 3.688745e-001,
+3.699743e-001, 3.710741e-001, 3.721716e-001, 3.732632e-001, 3.743549e-001, 3.754456e-001, 3.765301e-001, 3.776145e-001, 3.786989e-001, 3.797815e-001,
+3.808639e-001, 3.819463e-001, 3.830277e-001, 3.841085e-001, 3.851893e-001, 3.862666e-001, 3.873387e-001, 3.884109e-001, 3.894824e-001, 3.905463e-001,
+3.916103e-001, 3.926743e-001, 3.937355e-001, 3.947955e-001, 3.958555e-001, 3.969140e-001, 3.979692e-001, 3.990243e-001, 4.000794e-001, 4.011329e-001,
+4.021861e-001, 4.032392e-001, 4.042919e-001, 4.053437e-001, 4.063955e-001, 4.074473e-001, 4.084874e-001, 4.095238e-001, 4.105602e-001, 4.115959e-001,
+4.126275e-001, 4.136591e-001, 4.146907e-001, 4.157181e-001, 4.167410e-001, 4.177640e-001, 4.187869e-001, 4.198037e-001, 4.208188e-001, 4.218339e-001,
+4.228490e-001, 4.238614e-001, 4.248737e-001, 4.258861e-001, 4.268980e-001, 4.279081e-001, 4.289183e-001, 4.299284e-001, 4.309361e-001, 4.319397e-001,
+4.329432e-001, 4.339467e-001, 4.349519e-001, 4.359594e-001, 4.369668e-001, 4.379743e-001, 4.389805e-001, 4.399853e-001, 4.409902e-001, 4.419950e-001,
+4.429973e-001, 4.439964e-001, 4.449956e-001, 4.459948e-001, 4.469919e-001, 4.479858e-001, 4.489797e-001, 4.499736e-001, 4.509660e-001, 4.519539e-001,
+4.529418e-001, 4.539297e-001, 4.549174e-001, 4.559034e-001, 4.568893e-001, 4.578752e-001, 4.588611e-001, 4.598459e-001, 4.608305e-001, 4.618150e-001,
+4.627996e-001, 4.637799e-001, 4.647563e-001, 4.657327e-001, 4.667090e-001, 4.676841e-001, 4.686525e-001, 4.696210e-001, 4.705894e-001, 4.715578e-001,
+4.725239e-001, 4.734891e-001, 4.744544e-001, 4.754197e-001, 4.763843e-001, 4.773474e-001, 4.783104e-001, 4.792735e-001, 4.802366e-001, 4.811953e-001,
+4.821526e-001, 4.831099e-001, 4.840672e-001, 4.850250e-001, 4.859859e-001, 4.869468e-001, 4.879077e-001, 4.888687e-001, 4.898254e-001, 4.907775e-001,
+4.917296e-001, 4.926817e-001, 4.936338e-001, 4.945797e-001, 4.955236e-001, 4.964675e-001, 4.974114e-001, 4.983553e-001, 4.992960e-001, 5.002364e-001,
+5.011769e-001, 5.021174e-001, 5.030578e-001, 5.039975e-001, 5.049371e-001, 5.058768e-001, 5.068165e-001, 5.077555e-001, 5.086915e-001, 5.096275e-001,
+5.105634e-001, 5.114994e-001, 5.124346e-001, 5.133669e-001, 5.142992e-001, 5.152314e-001, 5.161637e-001, 5.170946e-001, 5.180176e-001, 5.189407e-001,
+5.198638e-001, 5.207868e-001, 5.217098e-001, 5.226305e-001, 5.235512e-001, 5.244719e-001, 5.253926e-001, 5.263133e-001, 5.272329e-001, 5.281524e-001,
+5.290718e-001, 5.299912e-001, 5.309106e-001, 5.318285e-001, 5.327451e-001, 5.336617e-001, 5.345783e-001, 5.354949e-001, 5.364095e-001, 5.373175e-001,
+5.382254e-001, 5.391334e-001, 5.400414e-001, 5.409493e-001, 5.418502e-001, 5.427495e-001, 5.436488e-001, 5.445482e-001, 5.454475e-001, 5.463450e-001,
+5.472389e-001, 5.481328e-001, 5.490267e-001, 5.499207e-001, 5.508146e-001, 5.517038e-001, 5.525919e-001, 5.534799e-001, 5.543679e-001, 5.552559e-001,
+5.561434e-001, 5.570283e-001, 5.579131e-001, 5.587979e-001, 5.596828e-001, 5.605676e-001, 5.614522e-001, 5.623364e-001, 5.632206e-001, 5.641048e-001,
+5.649891e-001, 5.658733e-001, 5.667579e-001, 5.676426e-001, 5.685273e-001, 5.694121e-001, 5.702968e-001, 5.711816e-001, 5.720716e-001, 5.729628e-001,
+5.738540e-001, 5.747452e-001, 5.756365e-001, 5.765277e-001, 5.774099e-001, 5.782908e-001, 5.791717e-001, 5.800525e-001, 5.809334e-001, 5.818142e-001,
+5.826920e-001, 5.835691e-001, 5.844463e-001, 5.853234e-001, 5.862006e-001, 5.870777e-001, 5.879529e-001, 5.888275e-001, 5.897021e-001, 5.905766e-001,
+5.914512e-001, 5.923258e-001, 5.932002e-001, 5.940744e-001, 5.949487e-001, 5.958229e-001, 5.966971e-001, 5.975714e-001, 5.984457e-001, 5.993201e-001,
+6.001945e-001, 6.010690e-001, 6.019434e-001, 6.028178e-001, 6.036922e-001, 6.045618e-001, 6.054311e-001, 6.063003e-001, 6.071695e-001, 6.080387e-001,
+6.089079e-001, 6.097749e-001, 6.106393e-001, 6.115038e-001, 6.123682e-001, 6.132327e-001, 6.140971e-001, 6.149616e-001, 6.158189e-001, 6.166758e-001,
+6.175328e-001, 6.183897e-001, 6.192467e-001, 6.201036e-001, 6.209588e-001, 6.218106e-001, 6.226623e-001, 6.235140e-001, 6.243657e-001, 6.252174e-001,
+6.260692e-001, 6.269180e-001, 6.277650e-001, 6.286120e-001, 6.294591e-001, 6.303061e-001, 6.311531e-001, 6.320002e-001, 6.328404e-001, 6.336792e-001,
+6.345179e-001, 6.353567e-001, 6.361954e-001, 6.370342e-001, 6.378729e-001, 6.387121e-001, 6.395512e-001, 6.403904e-001, 6.412295e-001, 6.420687e-001,
+6.429078e-001, 6.437470e-001, 6.445765e-001, 6.454054e-001, 6.462343e-001, 6.470632e-001, 6.478921e-001, 6.487210e-001, 6.495499e-001, 6.503704e-001,
+6.511895e-001, 6.520086e-001, 6.528278e-001, 6.536469e-001, 6.544660e-001, 6.552852e-001, 6.560991e-001, 6.569107e-001, 6.577222e-001, 6.585338e-001,
+6.593454e-001, 6.601569e-001, 6.609685e-001, 6.617767e-001, 6.625801e-001, 6.633834e-001, 6.641868e-001, 6.649902e-001, 6.657936e-001, 6.665970e-001,
+6.674002e-001, 6.682004e-001, 6.690005e-001, 6.698007e-001, 6.706008e-001, 6.714010e-001, 6.722011e-001, 6.730013e-001, 6.738013e-001, 6.746011e-001,
+6.754009e-001, 6.762007e-001, 6.770005e-001, 6.778003e-001, 6.786002e-001, 6.794000e-001, 6.801937e-001, 6.809874e-001, 6.817812e-001, 6.825749e-001,
+6.833686e-001, 6.841623e-001, 6.849560e-001, 6.857505e-001, 6.865467e-001, 6.873429e-001, 6.881391e-001, 6.889353e-001, 6.897314e-001, 6.905276e-001,
+6.913238e-001, 6.921185e-001, 6.929119e-001, 6.937052e-001, 6.944986e-001, 6.952920e-001, 6.960854e-001, 6.968788e-001, 6.976722e-001, 6.984622e-001,
+6.992504e-001, 7.000387e-001, 7.008269e-001, 7.016151e-001, 7.024034e-001, 7.031916e-001, 7.039798e-001, 7.047695e-001, 7.055600e-001, 7.063505e-001,
+7.071410e-001, 7.079314e-001, 7.087219e-001, 7.095124e-001, 7.103029e-001, 7.110937e-001, 7.118848e-001, 7.126759e-001, 7.134671e-001, 7.142582e-001,
+7.150493e-001, 7.158404e-001, 7.166315e-001, 7.174229e-001, 7.182147e-001, 7.190065e-001, 7.197983e-001, 7.205901e-001, 7.213820e-001, 7.221738e-001,
+7.229656e-001, 7.237573e-001, 7.245445e-001, 7.253318e-001, 7.261190e-001, 7.269062e-001, 7.276935e-001, 7.284807e-001, 7.292679e-001, 7.300552e-001,
+7.308400e-001, 7.316231e-001, 7.324062e-001, 7.331893e-001, 7.339724e-001, 7.347555e-001, 7.355386e-001, 7.363217e-001, 7.371048e-001, 7.378859e-001,
+7.386671e-001, 7.394482e-001, 7.402294e-001, 7.410105e-001, 7.417917e-001, 7.425728e-001, 7.433540e-001, 7.441342e-001, 7.449126e-001, 7.456911e-001,
+7.464696e-001, 7.472481e-001, 7.480265e-001, 7.488050e-001, 7.495835e-001, 7.503620e-001, 7.511405e-001, 7.519190e-001, 7.526975e-001, 7.534761e-001,
+7.542546e-001, 7.550331e-001, 7.558117e-001, 7.565902e-001, 7.573688e-001, 7.581411e-001, 7.589104e-001, 7.596797e-001, 7.604490e-001, 7.612183e-001,
+7.619876e-001, 7.627569e-001, 7.635262e-001, 7.642955e-001, 7.650623e-001, 7.658278e-001, 7.665933e-001, 7.673588e-001, 7.681243e-001, 7.688898e-001,
+7.696553e-001, 7.704208e-001, 7.711863e-001, 7.719494e-001, 7.727103e-001, 7.734711e-001, 7.742320e-001, 7.749928e-001, 7.757537e-001, 7.765145e-001,
+7.772754e-001, 7.780362e-001, 7.787958e-001, 7.795513e-001, 7.803067e-001, 7.810621e-001, 7.818176e-001, 7.825730e-001, 7.833284e-001, 7.840839e-001,
+7.848393e-001, 7.855947e-001, 7.863516e-001, 7.871089e-001, 7.878661e-001, 7.886234e-001, 7.893806e-001, 7.901378e-001, 7.908951e-001, 7.916523e-001,
+7.924096e-001, 7.931652e-001, 7.939172e-001, 7.946693e-001, 7.954213e-001, 7.961733e-001, 7.969254e-001, 7.976774e-001, 7.984294e-001, 7.991815e-001,
+7.999335e-001, 8.006807e-001, 8.014255e-001, 8.021702e-001, 8.029149e-001, 8.036597e-001, 8.044044e-001, 8.051491e-001, 8.058939e-001, 8.066386e-001,
+8.073834e-001, 8.081256e-001, 8.088674e-001, 8.096092e-001, 8.103510e-001, 8.110929e-001, 8.118347e-001, 8.125765e-001, 8.133183e-001, 8.140602e-001,
+8.148020e-001, 8.155405e-001, 8.162788e-001, 8.170172e-001, 8.177555e-001, 8.184939e-001, 8.192322e-001, 8.199705e-001, 8.207089e-001, 8.214472e-001,
+8.221856e-001, 8.229212e-001, 8.236565e-001, 8.243918e-001, 8.251271e-001, 8.258624e-001, 8.265977e-001, 8.273330e-001, 8.280683e-001, 8.288036e-001,
+8.295389e-001, 8.302717e-001, 8.310034e-001, 8.317351e-001, 8.324669e-001, 8.331986e-001, 8.339303e-001, 8.346620e-001, 8.353938e-001, 8.361255e-001,
+8.368572e-001, 8.375867e-001, 8.383126e-001, 8.390386e-001, 8.397645e-001, 8.404904e-001, 8.412163e-001, 8.419422e-001, 8.426681e-001, 8.433941e-001,
+8.441200e-001, 8.448459e-001, 8.455689e-001, 8.462917e-001, 8.470144e-001, 8.477372e-001, 8.484599e-001, 8.491827e-001, 8.499055e-001, 8.506282e-001,
+8.513510e-001, 8.520737e-001, 8.527961e-001, 8.535175e-001, 8.542390e-001, 8.549604e-001, 8.556819e-001, 8.564033e-001, 8.571248e-001, 8.578462e-001,
+8.585677e-001, 8.592891e-001, 8.600106e-001, 8.607302e-001, 8.614482e-001, 8.621663e-001, 8.628843e-001, 8.636024e-001, 8.643205e-001, 8.650385e-001,
+8.657566e-001, 8.664746e-001, 8.671927e-001, 8.679107e-001, 8.686279e-001, 8.693445e-001, 8.700612e-001, 8.707778e-001, 8.714945e-001, 8.722112e-001,
+8.729278e-001, 8.736445e-001, 8.743611e-001, 8.750778e-001, 8.757944e-001, 8.765114e-001, 8.772286e-001, 8.779458e-001, 8.786630e-001, 8.793803e-001,
+8.800975e-001, 8.808147e-001, 8.815319e-001, 8.822491e-001, 8.829663e-001, 8.836835e-001, 8.844001e-001, 8.851157e-001, 8.858313e-001, 8.865469e-001,
+8.872625e-001, 8.879781e-001, 8.886937e-001, 8.894093e-001, 8.901249e-001, 8.908404e-001, 8.915560e-001, 8.922713e-001, 8.929809e-001, 8.936905e-001,
+8.944002e-001, 8.951098e-001, 8.958194e-001, 8.965290e-001, 8.972387e-001, 8.979483e-001, 8.986579e-001, 8.993675e-001, 9.000772e-001, 9.007843e-001,
+9.014894e-001, 9.021945e-001, 9.028996e-001, 9.036046e-001, 9.043097e-001, 9.050148e-001, 9.057199e-001, 9.064250e-001, 9.071301e-001, 9.078352e-001,
+9.085403e-001, 9.092365e-001, 9.099318e-001, 9.106270e-001, 9.113223e-001, 9.120175e-001, 9.127128e-001, 9.134080e-001, 9.141033e-001, 9.147985e-001,
+9.154938e-001, 9.161890e-001, 9.168832e-001, 9.175653e-001, 9.182474e-001, 9.189295e-001, 9.196116e-001, 9.202937e-001, 9.209758e-001, 9.216579e-001,
+9.223400e-001, 9.230221e-001, 9.237042e-001, 9.243863e-001, 9.250671e-001, 9.257368e-001, 9.264064e-001, 9.270760e-001, 9.277456e-001, 9.284153e-001,
+9.290849e-001, 9.297545e-001, 9.304241e-001, 9.310937e-001, 9.317634e-001, 9.324330e-001, 9.331026e-001, 9.337632e-001, 9.344233e-001, 9.350835e-001,
+9.357437e-001, 9.364038e-001, 9.370640e-001, 9.377242e-001, 9.383843e-001, 9.390445e-001, 9.397047e-001, 9.403648e-001, 9.410250e-001, 9.416800e-001,
+9.423323e-001, 9.429845e-001, 9.436368e-001, 9.442891e-001, 9.449413e-001, 9.455936e-001, 9.462458e-001, 9.468981e-001, 9.475504e-001, 9.482026e-001,
+9.488549e-001, 9.495049e-001, 9.501445e-001, 9.507842e-001, 9.514238e-001, 9.520635e-001, 9.527032e-001, 9.533428e-001, 9.539825e-001, 9.546221e-001,
+9.552618e-001, 9.559014e-001, 9.565411e-001, 9.571807e-001, 9.578107e-001, 9.584324e-001, 9.590541e-001, 9.596757e-001, 9.602974e-001, 9.609191e-001,
+9.615408e-001, 9.621624e-001, 9.627841e-001, 9.634058e-001, 9.640274e-001, 9.646491e-001, 9.652708e-001, 9.658780e-001, 9.664797e-001, 9.670814e-001,
+9.676831e-001, 9.682848e-001, 9.688865e-001, 9.694882e-001, 9.700899e-001, 9.706916e-001, 9.712933e-001, 9.718950e-001, 9.724966e-001, 9.730983e-001,
+9.736818e-001, 9.742588e-001, 9.748357e-001, 9.754127e-001, 9.759896e-001, 9.765666e-001, 9.771436e-001, 9.777205e-001, 9.782975e-001, 9.788744e-001,
+9.794514e-001, 9.800283e-001, 9.806053e-001, 9.811592e-001, 9.816958e-001, 9.822325e-001, 9.827691e-001, 9.833058e-001, 9.838424e-001, 9.843790e-001,
+9.849157e-001, 9.854523e-001, 9.859890e-001, 9.865256e-001, 9.870623e-001, 9.875989e-001, 9.881225e-001, 9.886026e-001, 9.890827e-001, 9.895628e-001,
+9.900428e-001, 9.905229e-001, 9.910030e-001, 9.914830e-001, 9.919631e-001, 9.924432e-001, 9.929233e-001, 9.934033e-001, 9.938834e-001, 9.943635e-001,
+9.947876e-001, 9.951886e-001, 9.955895e-001, 9.959905e-001, 9.963914e-001, 9.967924e-001, 9.971933e-001, 9.975943e-001, 9.979952e-001, 9.983962e-001,
+9.987971e-001, 9.991981e-001, 9.995990e-001, 1.000000e+000)),
+("Kodak", "Portra 400NC", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.146864e-002, 2.175124e-002, 3.034647e-002, 3.772427e-002, 4.430955e-002, 5.030212e-002, 5.587283e-002, 6.102569e-002, 6.592631e-002,
+7.064341e-002, 7.515748e-002, 7.946066e-002, 8.358474e-002, 8.761478e-002, 9.153867e-002, 9.532854e-002, 9.895167e-002, 1.024664e-001, 1.058961e-001,
+1.092603e-001, 1.125695e-001, 1.157975e-001, 1.189696e-001, 1.221099e-001, 1.251875e-001, 1.281960e-001, 1.311469e-001, 1.340449e-001, 1.368933e-001,
+1.396845e-001, 1.424379e-001, 1.451424e-001, 1.478172e-001, 1.504549e-001, 1.530500e-001, 1.555911e-001, 1.581020e-001, 1.605874e-001, 1.630427e-001,
+1.654827e-001, 1.679004e-001, 1.703008e-001, 1.726766e-001, 1.750312e-001, 1.773743e-001, 1.796951e-001, 1.819853e-001, 1.842299e-001, 1.864487e-001,
+1.886311e-001, 1.907832e-001, 1.929027e-001, 1.950244e-001, 1.971315e-001, 1.992381e-001, 2.013241e-001, 2.034000e-001, 2.054556e-001, 2.074958e-001,
+2.095359e-001, 2.115649e-001, 2.135839e-001, 2.155832e-001, 2.175677e-001, 2.195197e-001, 2.214522e-001, 2.233704e-001, 2.252652e-001, 2.271434e-001,
+2.290212e-001, 2.308853e-001, 2.327376e-001, 2.345707e-001, 2.363775e-001, 2.381744e-001, 2.399537e-001, 2.417089e-001, 2.434547e-001, 2.451962e-001,
+2.469275e-001, 2.486505e-001, 2.503684e-001, 2.520723e-001, 2.537688e-001, 2.554596e-001, 2.571457e-001, 2.588266e-001, 2.605035e-001, 2.621728e-001,
+2.638291e-001, 2.654761e-001, 2.671324e-001, 2.687830e-001, 2.704267e-001, 2.720651e-001, 2.737014e-001, 2.753258e-001, 2.769434e-001, 2.785556e-001,
+2.801621e-001, 2.817465e-001, 2.833233e-001, 2.848966e-001, 2.864697e-001, 2.880344e-001, 2.895927e-001, 2.911434e-001, 2.926710e-001, 2.941831e-001,
+2.956765e-001, 2.971623e-001, 2.986419e-001, 3.001125e-001, 3.015663e-001, 3.030163e-001, 3.044653e-001, 3.059150e-001, 3.073624e-001, 3.087940e-001,
+3.102258e-001, 3.116577e-001, 3.130911e-001, 3.145204e-001, 3.159373e-001, 3.173551e-001, 3.187736e-001, 3.201943e-001, 3.216129e-001, 3.230192e-001,
+3.244254e-001, 3.258317e-001, 3.272288e-001, 3.286210e-001, 3.300077e-001, 3.313938e-001, 3.327835e-001, 3.341748e-001, 3.355719e-001, 3.369681e-001,
+3.383626e-001, 3.397515e-001, 3.411339e-001, 3.425045e-001, 3.438652e-001, 3.452149e-001, 3.465575e-001, 3.478951e-001, 3.492299e-001, 3.505576e-001,
+3.518814e-001, 3.531937e-001, 3.544990e-001, 3.558034e-001, 3.571070e-001, 3.584021e-001, 3.596883e-001, 3.609680e-001, 3.622377e-001, 3.635074e-001,
+3.647772e-001, 3.660453e-001, 3.672988e-001, 3.685523e-001, 3.697922e-001, 3.710306e-001, 3.722676e-001, 3.735038e-001, 3.747294e-001, 3.759412e-001,
+3.771511e-001, 3.783504e-001, 3.795498e-001, 3.807409e-001, 3.819305e-001, 3.831127e-001, 3.842875e-001, 3.854615e-001, 3.866303e-001, 3.877991e-001,
+3.889720e-001, 3.901465e-001, 3.913211e-001, 3.924961e-001, 3.936711e-001, 3.948435e-001, 3.960154e-001, 3.971867e-001, 3.983570e-001, 3.995273e-001,
+4.006893e-001, 4.018486e-001, 4.030069e-001, 4.041604e-001, 4.053138e-001, 4.064703e-001, 4.076293e-001, 4.087882e-001, 4.099337e-001, 4.110779e-001,
+4.122214e-001, 4.133623e-001, 4.145031e-001, 4.156428e-001, 4.167812e-001, 4.179197e-001, 4.190457e-001, 4.201678e-001, 4.212899e-001, 4.224099e-001,
+4.235299e-001, 4.246497e-001, 4.257685e-001, 4.268873e-001, 4.280022e-001, 4.291063e-001, 4.302105e-001, 4.313144e-001, 4.324179e-001, 4.335214e-001,
+4.346221e-001, 4.357189e-001, 4.368157e-001, 4.379083e-001, 4.389953e-001, 4.400823e-001, 4.411674e-001, 4.422497e-001, 4.433320e-001, 4.444084e-001,
+4.454728e-001, 4.465372e-001, 4.475978e-001, 4.486451e-001, 4.496924e-001, 4.507394e-001, 4.517830e-001, 4.528266e-001, 4.538702e-001, 4.549070e-001,
+4.559428e-001, 4.569786e-001, 4.580070e-001, 4.590309e-001, 4.600548e-001, 4.610792e-001, 4.621046e-001, 4.631299e-001, 4.641553e-001, 4.651830e-001,
+4.662107e-001, 4.672384e-001, 4.682592e-001, 4.692762e-001, 4.702933e-001, 4.713108e-001, 4.723303e-001, 4.733497e-001, 4.743692e-001, 4.753846e-001,
+4.763988e-001, 4.774130e-001, 4.784238e-001, 4.794248e-001, 4.804258e-001, 4.814268e-001, 4.824293e-001, 4.834325e-001, 4.844358e-001, 4.854385e-001,
+4.864361e-001, 4.874337e-001, 4.884313e-001, 4.894234e-001, 4.904081e-001, 4.913928e-001, 4.923775e-001, 4.933622e-001, 4.943469e-001, 4.953316e-001,
+4.963162e-001, 4.972892e-001, 4.982617e-001, 4.992342e-001, 5.002050e-001, 5.011661e-001, 5.021273e-001, 5.030885e-001, 5.040500e-001, 5.050122e-001,
+5.059744e-001, 5.069365e-001, 5.078974e-001, 5.088562e-001, 5.098149e-001, 5.107737e-001, 5.117294e-001, 5.126809e-001, 5.136323e-001, 5.145838e-001,
+5.155331e-001, 5.164790e-001, 5.174250e-001, 5.183709e-001, 5.193128e-001, 5.202462e-001, 5.211796e-001, 5.221130e-001, 5.230446e-001, 5.239687e-001,
+5.248929e-001, 5.258171e-001, 5.267412e-001, 5.276607e-001, 5.285801e-001, 5.294995e-001, 5.304190e-001, 5.313292e-001, 5.322366e-001, 5.331441e-001,
+5.340515e-001, 5.349549e-001, 5.358536e-001, 5.367524e-001, 5.376511e-001, 5.385502e-001, 5.394515e-001, 5.403528e-001, 5.412541e-001, 5.421554e-001,
+5.430505e-001, 5.439430e-001, 5.448354e-001, 5.457279e-001, 5.466186e-001, 5.475033e-001, 5.483881e-001, 5.492728e-001, 5.501575e-001, 5.510446e-001,
+5.519328e-001, 5.528210e-001, 5.537092e-001, 5.545967e-001, 5.554771e-001, 5.563575e-001, 5.572379e-001, 5.581183e-001, 5.589959e-001, 5.598696e-001,
+5.607433e-001, 5.616170e-001, 5.624907e-001, 5.633660e-001, 5.642419e-001, 5.651177e-001, 5.659936e-001, 5.668695e-001, 5.677334e-001, 5.685961e-001,
+5.694588e-001, 5.703215e-001, 5.711839e-001, 5.720422e-001, 5.729005e-001, 5.737587e-001, 5.746170e-001, 5.754748e-001, 5.763297e-001, 5.771846e-001,
+5.780395e-001, 5.788944e-001, 5.797473e-001, 5.805880e-001, 5.814288e-001, 5.822695e-001, 5.831102e-001, 5.839507e-001, 5.847879e-001, 5.856252e-001,
+5.864625e-001, 5.872997e-001, 5.881370e-001, 5.889739e-001, 5.898107e-001, 5.906476e-001, 5.914845e-001, 5.923213e-001, 5.931526e-001, 5.939823e-001,
+5.948120e-001, 5.956416e-001, 5.964713e-001, 5.972992e-001, 5.981255e-001, 5.989518e-001, 5.997781e-001, 6.006044e-001, 6.014306e-001, 6.022565e-001,
+6.030824e-001, 6.039084e-001, 6.047343e-001, 6.055602e-001, 6.063809e-001, 6.072001e-001, 6.080193e-001, 6.088385e-001, 6.096577e-001, 6.104760e-001,
+6.112921e-001, 6.121082e-001, 6.129243e-001, 6.137404e-001, 6.145565e-001, 6.153724e-001, 6.161883e-001, 6.170042e-001, 6.178200e-001, 6.186359e-001,
+6.194511e-001, 6.202606e-001, 6.210701e-001, 6.218797e-001, 6.226892e-001, 6.234987e-001, 6.243070e-001, 6.251134e-001, 6.259198e-001, 6.267263e-001,
+6.275327e-001, 6.283391e-001, 6.291439e-001, 6.299477e-001, 6.307515e-001, 6.315552e-001, 6.323590e-001, 6.331628e-001, 6.339570e-001, 6.347482e-001,
+6.355394e-001, 6.363306e-001, 6.371218e-001, 6.379130e-001, 6.387022e-001, 6.394911e-001, 6.402799e-001, 6.410687e-001, 6.418575e-001, 6.426463e-001,
+6.434337e-001, 6.442208e-001, 6.450079e-001, 6.457950e-001, 6.465821e-001, 6.473692e-001, 6.481485e-001, 6.489244e-001, 6.497004e-001, 6.504763e-001,
+6.512522e-001, 6.520281e-001, 6.528034e-001, 6.535782e-001, 6.543530e-001, 6.551278e-001, 6.559026e-001, 6.566773e-001, 6.574509e-001, 6.582205e-001,
+6.589901e-001, 6.597597e-001, 6.605293e-001, 6.612989e-001, 6.620684e-001, 6.628314e-001, 6.635934e-001, 6.643555e-001, 6.651175e-001, 6.658795e-001,
+6.666416e-001, 6.674026e-001, 6.681625e-001, 6.689224e-001, 6.696822e-001, 6.704421e-001, 6.712019e-001, 6.719618e-001, 6.727159e-001, 6.734695e-001,
+6.742231e-001, 6.749766e-001, 6.757302e-001, 6.764838e-001, 6.772350e-001, 6.779803e-001, 6.787256e-001, 6.794709e-001, 6.802163e-001, 6.809616e-001,
+6.817069e-001, 6.824506e-001, 6.831931e-001, 6.839357e-001, 6.846782e-001, 6.854207e-001, 6.861632e-001, 6.869057e-001, 6.876466e-001, 6.883869e-001,
+6.891273e-001, 6.898676e-001, 6.906079e-001, 6.913483e-001, 6.920886e-001, 6.928189e-001, 6.935479e-001, 6.942768e-001, 6.950058e-001, 6.957348e-001,
+6.964638e-001, 6.971927e-001, 6.979198e-001, 6.986466e-001, 6.993734e-001, 7.001003e-001, 7.008271e-001, 7.015539e-001, 7.022808e-001, 7.030063e-001,
+7.037316e-001, 7.044569e-001, 7.051822e-001, 7.059075e-001, 7.066328e-001, 7.073581e-001, 7.080766e-001, 7.087915e-001, 7.095063e-001, 7.102212e-001,
+7.109360e-001, 7.116509e-001, 7.123658e-001, 7.130801e-001, 7.137936e-001, 7.145071e-001, 7.152207e-001, 7.159342e-001, 7.166477e-001, 7.173612e-001,
+7.180747e-001, 7.187875e-001, 7.195002e-001, 7.202130e-001, 7.209258e-001, 7.216385e-001, 7.223513e-001, 7.230641e-001, 7.237719e-001, 7.244753e-001,
+7.251788e-001, 7.258822e-001, 7.265857e-001, 7.272891e-001, 7.279926e-001, 7.286960e-001, 7.293974e-001, 7.300986e-001, 7.307999e-001, 7.315011e-001,
+7.322024e-001, 7.329036e-001, 7.336049e-001, 7.343036e-001, 7.349956e-001, 7.356877e-001, 7.363798e-001, 7.370718e-001, 7.377639e-001, 7.384559e-001,
+7.391480e-001, 7.398372e-001, 7.405236e-001, 7.412100e-001, 7.418964e-001, 7.425828e-001, 7.432692e-001, 7.439556e-001, 7.446420e-001, 7.453269e-001,
+7.460109e-001, 7.466949e-001, 7.473789e-001, 7.480629e-001, 7.487469e-001, 7.494309e-001, 7.501149e-001, 7.507921e-001, 7.514652e-001, 7.521383e-001,
+7.528113e-001, 7.534844e-001, 7.541575e-001, 7.548306e-001, 7.555037e-001, 7.561715e-001, 7.568344e-001, 7.574973e-001, 7.581602e-001, 7.588232e-001,
+7.594861e-001, 7.601490e-001, 7.608119e-001, 7.614744e-001, 7.621357e-001, 7.627970e-001, 7.634583e-001, 7.641196e-001, 7.647810e-001, 7.654423e-001,
+7.661036e-001, 7.667649e-001, 7.674220e-001, 7.680791e-001, 7.687361e-001, 7.693931e-001, 7.700502e-001, 7.707072e-001, 7.713642e-001, 7.720213e-001,
+7.726746e-001, 7.733249e-001, 7.739752e-001, 7.746255e-001, 7.752758e-001, 7.759261e-001, 7.765763e-001, 7.772266e-001, 7.778769e-001, 7.785271e-001,
+7.791772e-001, 7.798274e-001, 7.804775e-001, 7.811277e-001, 7.817778e-001, 7.824279e-001, 7.830781e-001, 7.837272e-001, 7.843743e-001, 7.850215e-001,
+7.856686e-001, 7.863157e-001, 7.869629e-001, 7.876100e-001, 7.882571e-001, 7.889042e-001, 7.895485e-001, 7.901903e-001, 7.908321e-001, 7.914740e-001,
+7.921158e-001, 7.927576e-001, 7.933995e-001, 7.940413e-001, 7.946831e-001, 7.953270e-001, 7.959720e-001, 7.966170e-001, 7.972620e-001, 7.979070e-001,
+7.985519e-001, 7.991969e-001, 7.998419e-001, 8.004869e-001, 8.011307e-001, 8.017739e-001, 8.024170e-001, 8.030601e-001, 8.037033e-001, 8.043464e-001,
+8.049896e-001, 8.056327e-001, 8.062758e-001, 8.069156e-001, 8.075515e-001, 8.081874e-001, 8.088234e-001, 8.094593e-001, 8.100953e-001, 8.107312e-001,
+8.113672e-001, 8.120031e-001, 8.126396e-001, 8.132784e-001, 8.139171e-001, 8.145559e-001, 8.151946e-001, 8.158334e-001, 8.164721e-001, 8.171109e-001,
+8.177496e-001, 8.183884e-001, 8.190253e-001, 8.196617e-001, 8.202981e-001, 8.209345e-001, 8.215709e-001, 8.222073e-001, 8.228438e-001, 8.234802e-001,
+8.241166e-001, 8.247510e-001, 8.253805e-001, 8.260099e-001, 8.266394e-001, 8.272688e-001, 8.278983e-001, 8.285278e-001, 8.291572e-001, 8.297867e-001,
+8.304161e-001, 8.310465e-001, 8.316775e-001, 8.323084e-001, 8.329394e-001, 8.335703e-001, 8.342013e-001, 8.348322e-001, 8.354632e-001, 8.360941e-001,
+8.367251e-001, 8.373507e-001, 8.379753e-001, 8.385999e-001, 8.392245e-001, 8.398491e-001, 8.404738e-001, 8.410984e-001, 8.417230e-001, 8.423476e-001,
+8.429722e-001, 8.435915e-001, 8.442104e-001, 8.448292e-001, 8.454481e-001, 8.460670e-001, 8.466858e-001, 8.473047e-001, 8.479236e-001, 8.485424e-001,
+8.491613e-001, 8.497757e-001, 8.503894e-001, 8.510032e-001, 8.516169e-001, 8.522306e-001, 8.528444e-001, 8.534581e-001, 8.540718e-001, 8.546856e-001,
+8.552993e-001, 8.559077e-001, 8.565136e-001, 8.571195e-001, 8.577255e-001, 8.583314e-001, 8.589373e-001, 8.595432e-001, 8.601492e-001, 8.607551e-001,
+8.613610e-001, 8.619658e-001, 8.625687e-001, 8.631715e-001, 8.637743e-001, 8.643772e-001, 8.649800e-001, 8.655828e-001, 8.661857e-001, 8.667885e-001,
+8.673914e-001, 8.679942e-001, 8.685937e-001, 8.691927e-001, 8.697918e-001, 8.703908e-001, 8.709899e-001, 8.715889e-001, 8.721880e-001, 8.727870e-001,
+8.733861e-001, 8.739851e-001, 8.745810e-001, 8.751688e-001, 8.757566e-001, 8.763445e-001, 8.769323e-001, 8.775202e-001, 8.781080e-001, 8.786959e-001,
+8.792837e-001, 8.798715e-001, 8.804594e-001, 8.810451e-001, 8.816290e-001, 8.822129e-001, 8.827967e-001, 8.833806e-001, 8.839645e-001, 8.845484e-001,
+8.851323e-001, 8.857162e-001, 8.863000e-001, 8.868839e-001, 8.874659e-001, 8.880469e-001, 8.886278e-001, 8.892088e-001, 8.897898e-001, 8.903707e-001,
+8.909517e-001, 8.915326e-001, 8.921136e-001, 8.926945e-001, 8.932755e-001, 8.938504e-001, 8.944211e-001, 8.949918e-001, 8.955624e-001, 8.961331e-001,
+8.967038e-001, 8.972745e-001, 8.978451e-001, 8.984158e-001, 8.989865e-001, 8.995572e-001, 9.001260e-001, 9.006919e-001, 9.012579e-001, 9.018238e-001,
+9.023898e-001, 9.029557e-001, 9.035217e-001, 9.040876e-001, 9.046536e-001, 9.052195e-001, 9.057855e-001, 9.063512e-001, 9.069121e-001, 9.074729e-001,
+9.080338e-001, 9.085947e-001, 9.091555e-001, 9.097164e-001, 9.102773e-001, 9.108382e-001, 9.113990e-001, 9.119599e-001, 9.125208e-001, 9.130790e-001,
+9.136350e-001, 9.141910e-001, 9.147470e-001, 9.153030e-001, 9.158590e-001, 9.164150e-001, 9.169710e-001, 9.175270e-001, 9.180830e-001, 9.186390e-001,
+9.191950e-001, 9.197478e-001, 9.203000e-001, 9.208523e-001, 9.214046e-001, 9.219569e-001, 9.225092e-001, 9.230614e-001, 9.236137e-001, 9.241660e-001,
+9.247183e-001, 9.252706e-001, 9.258227e-001, 9.263734e-001, 9.269240e-001, 9.274747e-001, 9.280253e-001, 9.285760e-001, 9.291266e-001, 9.296773e-001,
+9.302279e-001, 9.307786e-001, 9.313292e-001, 9.318799e-001, 9.324298e-001, 9.329724e-001, 9.335151e-001, 9.340577e-001, 9.346003e-001, 9.351429e-001,
+9.356855e-001, 9.362281e-001, 9.367707e-001, 9.373133e-001, 9.378559e-001, 9.383985e-001, 9.389411e-001, 9.394807e-001, 9.400201e-001, 9.405596e-001,
+9.410990e-001, 9.416384e-001, 9.421779e-001, 9.427173e-001, 9.432567e-001, 9.437962e-001, 9.443356e-001, 9.448750e-001, 9.454145e-001, 9.459543e-001,
+9.464944e-001, 9.470345e-001, 9.475746e-001, 9.481147e-001, 9.486548e-001, 9.491950e-001, 9.497351e-001, 9.502752e-001, 9.508153e-001, 9.513554e-001,
+9.518955e-001, 9.524349e-001, 9.529715e-001, 9.535080e-001, 9.540445e-001, 9.545811e-001, 9.551176e-001, 9.556541e-001, 9.561907e-001, 9.567272e-001,
+9.572637e-001, 9.578003e-001, 9.583368e-001, 9.588733e-001, 9.594082e-001, 9.599416e-001, 9.604749e-001, 9.610083e-001, 9.615417e-001, 9.620750e-001,
+9.626084e-001, 9.631418e-001, 9.636752e-001, 9.642085e-001, 9.647419e-001, 9.652753e-001, 9.658086e-001, 9.663384e-001, 9.668668e-001, 9.673952e-001,
+9.679236e-001, 9.684520e-001, 9.689804e-001, 9.695087e-001, 9.700371e-001, 9.705655e-001, 9.710939e-001, 9.716223e-001, 9.721507e-001, 9.726791e-001,
+9.732029e-001, 9.737252e-001, 9.742474e-001, 9.747696e-001, 9.752919e-001, 9.758141e-001, 9.763363e-001, 9.768586e-001, 9.773808e-001, 9.779031e-001,
+9.784253e-001, 9.789475e-001, 9.794698e-001, 9.799848e-001, 9.804944e-001, 9.810041e-001, 9.815137e-001, 9.820233e-001, 9.825330e-001, 9.830426e-001,
+9.835522e-001, 9.840618e-001, 9.845715e-001, 9.850811e-001, 9.855907e-001, 9.861004e-001, 9.866076e-001, 9.871065e-001, 9.876055e-001, 9.881045e-001,
+9.886035e-001, 9.891025e-001, 9.896015e-001, 9.901004e-001, 9.905994e-001, 9.910984e-001, 9.915974e-001, 9.920964e-001, 9.925954e-001, 9.930944e-001,
+9.935892e-001, 9.940824e-001, 9.945755e-001, 9.950686e-001, 9.955618e-001, 9.960549e-001, 9.965480e-001, 9.970412e-001, 9.975343e-001, 9.980275e-001,
+9.985206e-001, 9.990137e-001, 9.995069e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.074714e-002, 2.026433e-002, 2.817178e-002, 3.493186e-002, 4.093965e-002, 4.647371e-002, 5.170932e-002, 5.660214e-002, 6.122654e-002,
+6.564220e-002, 6.985959e-002, 7.389033e-002, 7.781563e-002, 8.162171e-002, 8.534316e-002, 8.895915e-002, 9.249311e-002, 9.586890e-002, 9.913326e-002,
+1.023299e-001, 1.054402e-001, 1.085370e-001, 1.115974e-001, 1.145919e-001, 1.175365e-001, 1.204661e-001, 1.233218e-001, 1.260856e-001, 1.287901e-001,
+1.314755e-001, 1.341182e-001, 1.367079e-001, 1.392981e-001, 1.418842e-001, 1.444394e-001, 1.469539e-001, 1.494355e-001, 1.518718e-001, 1.542988e-001,
+1.566974e-001, 1.590469e-001, 1.613459e-001, 1.636166e-001, 1.658514e-001, 1.680633e-001, 1.702527e-001, 1.724139e-001, 1.745468e-001, 1.766641e-001,
+1.787832e-001, 1.809105e-001, 1.830411e-001, 1.851601e-001, 1.872644e-001, 1.893534e-001, 1.914180e-001, 1.934723e-001, 1.955030e-001, 1.975184e-001,
+1.995350e-001, 2.015224e-001, 2.034906e-001, 2.054294e-001, 2.073419e-001, 2.092444e-001, 2.111348e-001, 2.130121e-001, 2.148773e-001, 2.167268e-001,
+2.185604e-001, 2.203781e-001, 2.221764e-001, 2.239618e-001, 2.257477e-001, 2.275270e-001, 2.292969e-001, 2.310636e-001, 2.328284e-001, 2.345886e-001,
+2.363440e-001, 2.380899e-001, 2.398184e-001, 2.415341e-001, 2.432459e-001, 2.449575e-001, 2.466548e-001, 2.483399e-001, 2.500117e-001, 2.516688e-001,
+2.533113e-001, 2.549428e-001, 2.565666e-001, 2.581740e-001, 2.597663e-001, 2.613467e-001, 2.629152e-001, 2.644810e-001, 2.660413e-001, 2.675941e-001,
+2.691348e-001, 2.706715e-001, 2.722041e-001, 2.737326e-001, 2.752566e-001, 2.767754e-001, 2.782890e-001, 2.797945e-001, 2.812936e-001, 2.827874e-001,
+2.842740e-001, 2.857593e-001, 2.872451e-001, 2.887324e-001, 2.902269e-001, 2.917179e-001, 2.931961e-001, 2.946687e-001, 2.961394e-001, 2.976127e-001,
+2.990802e-001, 3.005423e-001, 3.019973e-001, 3.034511e-001, 3.049039e-001, 3.063477e-001, 3.077848e-001, 3.092113e-001, 3.106359e-001, 3.120585e-001,
+3.134770e-001, 3.148898e-001, 3.162914e-001, 3.176869e-001, 3.190724e-001, 3.204556e-001, 3.218251e-001, 3.231914e-001, 3.245448e-001, 3.258947e-001,
+3.272379e-001, 3.285780e-001, 3.299140e-001, 3.312395e-001, 3.325557e-001, 3.338659e-001, 3.351719e-001, 3.364771e-001, 3.377817e-001, 3.390836e-001,
+3.403840e-001, 3.416805e-001, 3.429747e-001, 3.442664e-001, 3.455563e-001, 3.468429e-001, 3.481261e-001, 3.494060e-001, 3.506805e-001, 3.519532e-001,
+3.532208e-001, 3.544876e-001, 3.557466e-001, 3.570056e-001, 3.582545e-001, 3.595023e-001, 3.607460e-001, 3.619878e-001, 3.632285e-001, 3.644678e-001,
+3.657064e-001, 3.669405e-001, 3.681747e-001, 3.694047e-001, 3.706338e-001, 3.718604e-001, 3.730844e-001, 3.743064e-001, 3.755133e-001, 3.767202e-001,
+3.779212e-001, 3.791198e-001, 3.803184e-001, 3.815169e-001, 3.827155e-001, 3.839045e-001, 3.850910e-001, 3.862751e-001, 3.874530e-001, 3.886308e-001,
+3.898058e-001, 3.909798e-001, 3.921527e-001, 3.933204e-001, 3.944881e-001, 3.956514e-001, 3.968113e-001, 3.979711e-001, 3.991281e-001, 4.002848e-001,
+4.014416e-001, 4.025983e-001, 4.037550e-001, 4.049059e-001, 4.060513e-001, 4.071968e-001, 4.083349e-001, 4.094708e-001, 4.106067e-001, 4.117317e-001,
+4.128564e-001, 4.139793e-001, 4.150904e-001, 4.162016e-001, 4.173096e-001, 4.184090e-001, 4.195084e-001, 4.206029e-001, 4.216888e-001, 4.227746e-001,
+4.238578e-001, 4.249372e-001, 4.260165e-001, 4.270943e-001, 4.281699e-001, 4.292455e-001, 4.303215e-001, 4.313979e-001, 4.324743e-001, 4.335477e-001,
+4.346148e-001, 4.356819e-001, 4.367474e-001, 4.378076e-001, 4.388678e-001, 4.399278e-001, 4.409854e-001, 4.420430e-001, 4.431006e-001, 4.441546e-001,
+4.452080e-001, 4.462615e-001, 4.473111e-001, 4.483583e-001, 4.494056e-001, 4.504512e-001, 4.514939e-001, 4.525366e-001, 4.535792e-001, 4.546159e-001,
+4.556526e-001, 4.566893e-001, 4.577208e-001, 4.587494e-001, 4.597780e-001, 4.608064e-001, 4.618339e-001, 4.628615e-001, 4.638891e-001, 4.649214e-001,
+4.659551e-001, 4.669889e-001, 4.680216e-001, 4.690510e-001, 4.700804e-001, 4.711099e-001, 4.721364e-001, 4.731617e-001, 4.741869e-001, 4.752118e-001,
+4.762332e-001, 4.772545e-001, 4.782759e-001, 4.792913e-001, 4.802986e-001, 4.813059e-001, 4.823132e-001, 4.833155e-001, 4.843157e-001, 4.853160e-001,
+4.863162e-001, 4.873187e-001, 4.883212e-001, 4.893238e-001, 4.903247e-001, 4.913163e-001, 4.923080e-001, 4.932996e-001, 4.942878e-001, 4.952678e-001,
+4.962478e-001, 4.972278e-001, 4.982069e-001, 4.991845e-001, 5.001622e-001, 5.011398e-001, 5.021173e-001, 5.030945e-001, 5.040718e-001, 5.050491e-001,
+5.060226e-001, 5.069903e-001, 5.079580e-001, 5.089257e-001, 5.098917e-001, 5.108541e-001, 5.118165e-001, 5.127790e-001, 5.137408e-001, 5.147002e-001,
+5.156595e-001, 5.166189e-001, 5.175782e-001, 5.185251e-001, 5.194721e-001, 5.204190e-001, 5.213660e-001, 5.223047e-001, 5.232409e-001, 5.241771e-001,
+5.251134e-001, 5.260437e-001, 5.269673e-001, 5.278910e-001, 5.288146e-001, 5.297368e-001, 5.306468e-001, 5.315569e-001, 5.324670e-001, 5.333770e-001,
+5.342804e-001, 5.351807e-001, 5.360810e-001, 5.369813e-001, 5.378801e-001, 5.387730e-001, 5.396659e-001, 5.405587e-001, 5.414516e-001, 5.423437e-001,
+5.432355e-001, 5.441272e-001, 5.450190e-001, 5.459103e-001, 5.467962e-001, 5.476821e-001, 5.485680e-001, 5.494539e-001, 5.503362e-001, 5.512136e-001,
+5.520910e-001, 5.529684e-001, 5.538457e-001, 5.547166e-001, 5.555846e-001, 5.564526e-001, 5.573205e-001, 5.581885e-001, 5.590493e-001, 5.599093e-001,
+5.607694e-001, 5.616294e-001, 5.624893e-001, 5.633451e-001, 5.642010e-001, 5.650569e-001, 5.659127e-001, 5.667680e-001, 5.676189e-001, 5.684699e-001,
+5.693208e-001, 5.701718e-001, 5.710228e-001, 5.718738e-001, 5.727249e-001, 5.735760e-001, 5.744271e-001, 5.752779e-001, 5.761267e-001, 5.769755e-001,
+5.778243e-001, 5.786731e-001, 5.795219e-001, 5.803652e-001, 5.812083e-001, 5.820514e-001, 5.828944e-001, 5.837375e-001, 5.845799e-001, 5.854221e-001,
+5.862642e-001, 5.871064e-001, 5.879485e-001, 5.887914e-001, 5.896349e-001, 5.904785e-001, 5.913220e-001, 5.921655e-001, 5.930099e-001, 5.938586e-001,
+5.947072e-001, 5.955558e-001, 5.964044e-001, 5.972530e-001, 5.980987e-001, 5.989436e-001, 5.997886e-001, 6.006335e-001, 6.014784e-001, 6.023223e-001,
+6.031637e-001, 6.040052e-001, 6.048466e-001, 6.056881e-001, 6.065295e-001, 6.073685e-001, 6.082066e-001, 6.090447e-001, 6.098829e-001, 6.107210e-001,
+6.115579e-001, 6.123845e-001, 6.132111e-001, 6.140377e-001, 6.148643e-001, 6.156909e-001, 6.165152e-001, 6.173360e-001, 6.181568e-001, 6.189776e-001,
+6.197984e-001, 6.206192e-001, 6.214399e-001, 6.222605e-001, 6.230810e-001, 6.239016e-001, 6.247221e-001, 6.255427e-001, 6.263572e-001, 6.271697e-001,
+6.279822e-001, 6.287947e-001, 6.296073e-001, 6.304198e-001, 6.312274e-001, 6.320339e-001, 6.328405e-001, 6.336470e-001, 6.344535e-001, 6.352600e-001,
+6.360662e-001, 6.368721e-001, 6.376781e-001, 6.384841e-001, 6.392901e-001, 6.400961e-001, 6.408988e-001, 6.417000e-001, 6.425011e-001, 6.433023e-001,
+6.441034e-001, 6.449046e-001, 6.457012e-001, 6.464934e-001, 6.472855e-001, 6.480777e-001, 6.488698e-001, 6.496619e-001, 6.504533e-001, 6.512418e-001,
+6.520304e-001, 6.528190e-001, 6.536075e-001, 6.543961e-001, 6.551847e-001, 6.559717e-001, 6.567586e-001, 6.575454e-001, 6.583323e-001, 6.591191e-001,
+6.599059e-001, 6.606888e-001, 6.614663e-001, 6.622439e-001, 6.630214e-001, 6.637990e-001, 6.645765e-001, 6.653540e-001, 6.661243e-001, 6.668938e-001,
+6.676633e-001, 6.684328e-001, 6.692023e-001, 6.699718e-001, 6.707386e-001, 6.714985e-001, 6.722584e-001, 6.730183e-001, 6.737782e-001, 6.745381e-001,
+6.752980e-001, 6.760519e-001, 6.768013e-001, 6.775507e-001, 6.783001e-001, 6.790494e-001, 6.797988e-001, 6.805482e-001, 6.812919e-001, 6.820340e-001,
+6.827761e-001, 6.835182e-001, 6.842603e-001, 6.850024e-001, 6.857444e-001, 6.864817e-001, 6.872183e-001, 6.879549e-001, 6.886916e-001, 6.894282e-001,
+6.901648e-001, 6.909014e-001, 6.916377e-001, 6.923739e-001, 6.931101e-001, 6.938463e-001, 6.945825e-001, 6.953187e-001, 6.960550e-001, 6.967895e-001,
+6.975237e-001, 6.982578e-001, 6.989920e-001, 6.997262e-001, 7.004604e-001, 7.011945e-001, 7.019280e-001, 7.026611e-001, 7.033943e-001, 7.041274e-001,
+7.048605e-001, 7.055936e-001, 7.063267e-001, 7.070570e-001, 7.077824e-001, 7.085078e-001, 7.092332e-001, 7.099586e-001, 7.106840e-001, 7.114094e-001,
+7.121348e-001, 7.128538e-001, 7.135729e-001, 7.142919e-001, 7.150110e-001, 7.157300e-001, 7.164490e-001, 7.171681e-001, 7.178853e-001, 7.186010e-001,
+7.193167e-001, 7.200324e-001, 7.207481e-001, 7.214638e-001, 7.221794e-001, 7.228951e-001, 7.236070e-001, 7.243188e-001, 7.250305e-001, 7.257422e-001,
+7.264540e-001, 7.271657e-001, 7.278774e-001, 7.285876e-001, 7.292935e-001, 7.299995e-001, 7.307055e-001, 7.314115e-001, 7.321175e-001, 7.328235e-001,
+7.335295e-001, 7.342341e-001, 7.349374e-001, 7.356406e-001, 7.363438e-001, 7.370471e-001, 7.377503e-001, 7.384536e-001, 7.391568e-001, 7.398598e-001,
+7.405626e-001, 7.412653e-001, 7.419681e-001, 7.426709e-001, 7.433737e-001, 7.440765e-001, 7.447792e-001, 7.454808e-001, 7.461815e-001, 7.468823e-001,
+7.475830e-001, 7.482838e-001, 7.489846e-001, 7.496853e-001, 7.503861e-001, 7.510858e-001, 7.517846e-001, 7.524833e-001, 7.531821e-001, 7.538809e-001,
+7.545796e-001, 7.552784e-001, 7.559772e-001, 7.566753e-001, 7.573720e-001, 7.580687e-001, 7.587654e-001, 7.594621e-001, 7.601588e-001, 7.608555e-001,
+7.615522e-001, 7.622490e-001, 7.629418e-001, 7.636345e-001, 7.643273e-001, 7.650201e-001, 7.657128e-001, 7.664056e-001, 7.670983e-001, 7.677911e-001,
+7.684819e-001, 7.691712e-001, 7.698604e-001, 7.705496e-001, 7.712389e-001, 7.719281e-001, 7.726174e-001, 7.733066e-001, 7.739958e-001, 7.746814e-001,
+7.753669e-001, 7.760524e-001, 7.767379e-001, 7.774235e-001, 7.781090e-001, 7.787945e-001, 7.794800e-001, 7.801622e-001, 7.808376e-001, 7.815130e-001,
+7.821883e-001, 7.828637e-001, 7.835391e-001, 7.842145e-001, 7.848899e-001, 7.855653e-001, 7.862369e-001, 7.869054e-001, 7.875740e-001, 7.882425e-001,
+7.889110e-001, 7.895795e-001, 7.902480e-001, 7.909166e-001, 7.915851e-001, 7.922513e-001, 7.929161e-001, 7.935810e-001, 7.942459e-001, 7.949107e-001,
+7.955756e-001, 7.962405e-001, 7.969054e-001, 7.975702e-001, 7.982337e-001, 7.988962e-001, 7.995588e-001, 8.002214e-001, 8.008840e-001, 8.015465e-001,
+8.022091e-001, 8.028717e-001, 8.035342e-001, 8.041943e-001, 8.048514e-001, 8.055086e-001, 8.061658e-001, 8.068230e-001, 8.074802e-001, 8.081374e-001,
+8.087946e-001, 8.094517e-001, 8.101088e-001, 8.107651e-001, 8.114215e-001, 8.120778e-001, 8.127342e-001, 8.133906e-001, 8.140469e-001, 8.147033e-001,
+8.153596e-001, 8.160160e-001, 8.166727e-001, 8.173294e-001, 8.179861e-001, 8.186429e-001, 8.192996e-001, 8.199563e-001, 8.206131e-001, 8.212698e-001,
+8.219265e-001, 8.225817e-001, 8.232326e-001, 8.238835e-001, 8.245345e-001, 8.251854e-001, 8.258364e-001, 8.264873e-001, 8.271383e-001, 8.277892e-001,
+8.284401e-001, 8.290881e-001, 8.297342e-001, 8.303803e-001, 8.310264e-001, 8.316725e-001, 8.323186e-001, 8.329648e-001, 8.336109e-001, 8.342570e-001,
+8.349031e-001, 8.355441e-001, 8.361841e-001, 8.368242e-001, 8.374642e-001, 8.381042e-001, 8.387442e-001, 8.393843e-001, 8.400243e-001, 8.406643e-001,
+8.413044e-001, 8.419380e-001, 8.425710e-001, 8.432041e-001, 8.438372e-001, 8.444703e-001, 8.451034e-001, 8.457365e-001, 8.463695e-001, 8.470026e-001,
+8.476357e-001, 8.482635e-001, 8.488906e-001, 8.495177e-001, 8.501448e-001, 8.507718e-001, 8.513989e-001, 8.520260e-001, 8.526530e-001, 8.532801e-001,
+8.539072e-001, 8.545295e-001, 8.551497e-001, 8.557699e-001, 8.563901e-001, 8.570103e-001, 8.576304e-001, 8.582506e-001, 8.588708e-001, 8.594910e-001,
+8.601112e-001, 8.607303e-001, 8.613476e-001, 8.619649e-001, 8.625822e-001, 8.631995e-001, 8.638168e-001, 8.644341e-001, 8.650513e-001, 8.656686e-001,
+8.662859e-001, 8.669032e-001, 8.675162e-001, 8.681287e-001, 8.687412e-001, 8.693537e-001, 8.699662e-001, 8.705787e-001, 8.711912e-001, 8.718037e-001,
+8.724162e-001, 8.730287e-001, 8.736391e-001, 8.742443e-001, 8.748495e-001, 8.754547e-001, 8.760599e-001, 8.766652e-001, 8.772704e-001, 8.778756e-001,
+8.784808e-001, 8.790860e-001, 8.796913e-001, 8.802946e-001, 8.808964e-001, 8.814982e-001, 8.821000e-001, 8.827018e-001, 8.833036e-001, 8.839053e-001,
+8.845071e-001, 8.851089e-001, 8.857107e-001, 8.863125e-001, 8.869127e-001, 8.875121e-001, 8.881115e-001, 8.887108e-001, 8.893102e-001, 8.899096e-001,
+8.905089e-001, 8.911083e-001, 8.917077e-001, 8.923070e-001, 8.929064e-001, 8.935059e-001, 8.941054e-001, 8.947050e-001, 8.953045e-001, 8.959041e-001,
+8.965036e-001, 8.971032e-001, 8.977027e-001, 8.983023e-001, 8.989018e-001, 8.995013e-001, 9.000989e-001, 9.006932e-001, 9.012876e-001, 9.018819e-001,
+9.024763e-001, 9.030706e-001, 9.036650e-001, 9.042593e-001, 9.048537e-001, 9.054480e-001, 9.060424e-001, 9.066366e-001, 9.072268e-001, 9.078170e-001,
+9.084072e-001, 9.089974e-001, 9.095876e-001, 9.101779e-001, 9.107681e-001, 9.113583e-001, 9.119485e-001, 9.125387e-001, 9.131289e-001, 9.137184e-001,
+9.143072e-001, 9.148960e-001, 9.154848e-001, 9.160737e-001, 9.166625e-001, 9.172513e-001, 9.178401e-001, 9.184290e-001, 9.190178e-001, 9.196066e-001,
+9.201954e-001, 9.207763e-001, 9.213561e-001, 9.219358e-001, 9.225156e-001, 9.230954e-001, 9.236752e-001, 9.242549e-001, 9.248347e-001, 9.254145e-001,
+9.259943e-001, 9.265740e-001, 9.271532e-001, 9.277231e-001, 9.282930e-001, 9.288630e-001, 9.294329e-001, 9.300028e-001, 9.305727e-001, 9.311426e-001,
+9.317126e-001, 9.322825e-001, 9.328524e-001, 9.334223e-001, 9.339917e-001, 9.345555e-001, 9.351192e-001, 9.356829e-001, 9.362467e-001, 9.368104e-001,
+9.373741e-001, 9.379379e-001, 9.385016e-001, 9.390653e-001, 9.396291e-001, 9.401928e-001, 9.407566e-001, 9.413191e-001, 9.418815e-001, 9.424440e-001,
+9.430064e-001, 9.435689e-001, 9.441313e-001, 9.446938e-001, 9.452562e-001, 9.458187e-001, 9.463812e-001, 9.469436e-001, 9.475061e-001, 9.480665e-001,
+9.486257e-001, 9.491849e-001, 9.497442e-001, 9.503034e-001, 9.508627e-001, 9.514219e-001, 9.519812e-001, 9.525404e-001, 9.530997e-001, 9.536589e-001,
+9.542182e-001, 9.547764e-001, 9.553295e-001, 9.558826e-001, 9.564358e-001, 9.569889e-001, 9.575420e-001, 9.580951e-001, 9.586482e-001, 9.592014e-001,
+9.597545e-001, 9.603076e-001, 9.608607e-001, 9.614138e-001, 9.619623e-001, 9.625065e-001, 9.630507e-001, 9.635949e-001, 9.641392e-001, 9.646834e-001,
+9.652276e-001, 9.657718e-001, 9.663161e-001, 9.668603e-001, 9.674045e-001, 9.679487e-001, 9.684930e-001, 9.690269e-001, 9.695569e-001, 9.700868e-001,
+9.706168e-001, 9.711467e-001, 9.716767e-001, 9.722066e-001, 9.727366e-001, 9.732665e-001, 9.737964e-001, 9.743264e-001, 9.748563e-001, 9.753863e-001,
+9.759041e-001, 9.764175e-001, 9.769310e-001, 9.774444e-001, 9.779578e-001, 9.784712e-001, 9.789846e-001, 9.794980e-001, 9.800114e-001, 9.805249e-001,
+9.810383e-001, 9.815517e-001, 9.820651e-001, 9.825600e-001, 9.830408e-001, 9.835216e-001, 9.840024e-001, 9.844832e-001, 9.849640e-001, 9.854448e-001,
+9.859256e-001, 9.864064e-001, 9.868872e-001, 9.873680e-001, 9.878488e-001, 9.883296e-001, 9.888012e-001, 9.892416e-001, 9.896820e-001, 9.901224e-001,
+9.905629e-001, 9.910033e-001, 9.914437e-001, 9.918841e-001, 9.923245e-001, 9.927649e-001, 9.932053e-001, 9.936457e-001, 9.940861e-001, 9.945266e-001,
+9.949313e-001, 9.953212e-001, 9.957111e-001, 9.961010e-001, 9.964909e-001, 9.968808e-001, 9.972707e-001, 9.976606e-001, 9.980505e-001, 9.984404e-001,
+9.988303e-001, 9.992202e-001, 9.996101e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.756444e-003, 1.608143e-002, 2.217054e-002, 2.759462e-002, 3.242262e-002, 3.697870e-002, 4.126298e-002, 4.529654e-002, 4.918370e-002,
+5.289634e-002, 5.646419e-002, 5.993435e-002, 6.329297e-002, 6.655179e-002, 6.975009e-002, 7.286491e-002, 7.590185e-002, 7.883510e-002, 8.168675e-002,
+8.446836e-002, 8.721671e-002, 8.996688e-002, 9.268894e-002, 9.537120e-002, 9.799435e-002, 1.005420e-001, 1.030569e-001, 1.055212e-001, 1.079170e-001,
+1.103053e-001, 1.126657e-001, 1.150160e-001, 1.173410e-001, 1.196571e-001, 1.219562e-001, 1.242328e-001, 1.264850e-001, 1.287029e-001, 1.308920e-001,
+1.330560e-001, 1.351831e-001, 1.372949e-001, 1.393576e-001, 1.414174e-001, 1.434594e-001, 1.454784e-001, 1.474942e-001, 1.494761e-001, 1.514540e-001,
+1.534275e-001, 1.553764e-001, 1.573255e-001, 1.592600e-001, 1.611716e-001, 1.630840e-001, 1.649880e-001, 1.668666e-001, 1.687465e-001, 1.706251e-001,
+1.724744e-001, 1.743170e-001, 1.761588e-001, 1.779756e-001, 1.797723e-001, 1.815698e-001, 1.833600e-001, 1.851365e-001, 1.868986e-001, 1.886556e-001,
+1.903920e-001, 1.921015e-001, 1.937995e-001, 1.954976e-001, 1.971796e-001, 1.988391e-001, 2.004887e-001, 2.021430e-001, 2.037986e-001, 2.054409e-001,
+2.070686e-001, 2.086946e-001, 2.103239e-001, 2.119439e-001, 2.135417e-001, 2.151298e-001, 2.167214e-001, 2.183215e-001, 2.199174e-001, 2.215020e-001,
+2.230799e-001, 2.246622e-001, 2.262382e-001, 2.278028e-001, 2.293560e-001, 2.309002e-001, 2.324445e-001, 2.339832e-001, 2.355153e-001, 2.370390e-001,
+2.385461e-001, 2.400489e-001, 2.415542e-001, 2.430643e-001, 2.445681e-001, 2.460585e-001, 2.475391e-001, 2.490137e-001, 2.504927e-001, 2.519704e-001,
+2.534419e-001, 2.548941e-001, 2.563389e-001, 2.577767e-001, 2.592169e-001, 2.606566e-001, 2.620926e-001, 2.635230e-001, 2.649494e-001, 2.663622e-001,
+2.677739e-001, 2.691846e-001, 2.705928e-001, 2.719972e-001, 2.733886e-001, 2.747705e-001, 2.761444e-001, 2.775142e-001, 2.788833e-001, 2.802533e-001,
+2.816143e-001, 2.829608e-001, 2.842969e-001, 2.856263e-001, 2.869521e-001, 2.882771e-001, 2.896099e-001, 2.909417e-001, 2.922688e-001, 2.935900e-001,
+2.948979e-001, 2.962029e-001, 2.975038e-001, 2.988073e-001, 3.001133e-001, 3.014147e-001, 3.027124e-001, 3.039974e-001, 3.052738e-001, 3.065445e-001,
+3.078115e-001, 3.090800e-001, 3.103496e-001, 3.116237e-001, 3.129017e-001, 3.141731e-001, 3.154368e-001, 3.166973e-001, 3.179522e-001, 3.192068e-001,
+3.204610e-001, 3.217146e-001, 3.229593e-001, 3.242040e-001, 3.254339e-001, 3.266617e-001, 3.278839e-001, 3.291031e-001, 3.303221e-001, 3.315409e-001,
+3.327583e-001, 3.339653e-001, 3.351723e-001, 3.363747e-001, 3.375759e-001, 3.387717e-001, 3.399612e-001, 3.411506e-001, 3.423394e-001, 3.435282e-001,
+3.447239e-001, 3.459228e-001, 3.471213e-001, 3.483185e-001, 3.495157e-001, 3.507024e-001, 3.518858e-001, 3.530685e-001, 3.542488e-001, 3.554292e-001,
+3.566128e-001, 3.577977e-001, 3.589809e-001, 3.601540e-001, 3.613270e-001, 3.624923e-001, 3.636508e-001, 3.648093e-001, 3.659643e-001, 3.671189e-001,
+3.682743e-001, 3.694328e-001, 3.705912e-001, 3.717438e-001, 3.728901e-001, 3.740365e-001, 3.751721e-001, 3.763038e-001, 3.774355e-001, 3.785631e-001,
+3.796903e-001, 3.808172e-001, 3.819408e-001, 3.830644e-001, 3.841861e-001, 3.853017e-001, 3.864173e-001, 3.875293e-001, 3.886339e-001, 3.897385e-001,
+3.908397e-001, 3.919354e-001, 3.930310e-001, 3.941243e-001, 3.952139e-001, 3.963035e-001, 3.973941e-001, 3.984862e-001, 3.995784e-001, 4.006664e-001,
+4.017446e-001, 4.028229e-001, 4.038993e-001, 4.049680e-001, 4.060368e-001, 4.071055e-001, 4.081743e-001, 4.092432e-001, 4.103120e-001, 4.113867e-001,
+4.124625e-001, 4.135384e-001, 4.146098e-001, 4.156782e-001, 4.167467e-001, 4.178118e-001, 4.188697e-001, 4.199276e-001, 4.209855e-001, 4.220424e-001,
+4.230993e-001, 4.241562e-001, 4.252122e-001, 4.262678e-001, 4.273233e-001, 4.283766e-001, 4.294205e-001, 4.304644e-001, 4.315084e-001, 4.325435e-001,
+4.335754e-001, 4.346073e-001, 4.356386e-001, 4.366680e-001, 4.376974e-001, 4.387268e-001, 4.397541e-001, 4.407802e-001, 4.418064e-001, 4.428318e-001,
+4.438446e-001, 4.448574e-001, 4.458701e-001, 4.468775e-001, 4.478765e-001, 4.488755e-001, 4.498746e-001, 4.508705e-001, 4.518649e-001, 4.528594e-001,
+4.538538e-001, 4.548525e-001, 4.558515e-001, 4.568505e-001, 4.578497e-001, 4.588507e-001, 4.598517e-001, 4.608527e-001, 4.618506e-001, 4.628400e-001,
+4.638294e-001, 4.648188e-001, 4.658064e-001, 4.667906e-001, 4.677748e-001, 4.687591e-001, 4.697438e-001, 4.707294e-001, 4.717150e-001, 4.727006e-001,
+4.736824e-001, 4.746578e-001, 4.756332e-001, 4.766086e-001, 4.775813e-001, 4.785476e-001, 4.795139e-001, 4.804802e-001, 4.814454e-001, 4.824050e-001,
+4.833647e-001, 4.843243e-001, 4.852839e-001, 4.862455e-001, 4.872071e-001, 4.881687e-001, 4.891303e-001, 4.900931e-001, 4.910562e-001, 4.920193e-001,
+4.929825e-001, 4.939421e-001, 4.948974e-001, 4.958527e-001, 4.968080e-001, 4.977625e-001, 4.987093e-001, 4.996561e-001, 5.006029e-001, 5.015497e-001,
+5.024966e-001, 5.034434e-001, 5.043903e-001, 5.053371e-001, 5.062835e-001, 5.072280e-001, 5.081725e-001, 5.091169e-001, 5.100614e-001, 5.109959e-001,
+5.119252e-001, 5.128544e-001, 5.137837e-001, 5.147124e-001, 5.156327e-001, 5.165529e-001, 5.174731e-001, 5.183934e-001, 5.193133e-001, 5.202329e-001,
+5.211526e-001, 5.220722e-001, 5.229918e-001, 5.239106e-001, 5.248290e-001, 5.257474e-001, 5.266659e-001, 5.275843e-001, 5.284937e-001, 5.294020e-001,
+5.303102e-001, 5.312184e-001, 5.321263e-001, 5.330241e-001, 5.339218e-001, 5.348195e-001, 5.357172e-001, 5.366147e-001, 5.375101e-001, 5.384054e-001,
+5.393008e-001, 5.401962e-001, 5.410920e-001, 5.419911e-001, 5.428901e-001, 5.437892e-001, 5.446882e-001, 5.455867e-001, 5.464771e-001, 5.473675e-001,
+5.482579e-001, 5.491483e-001, 5.500387e-001, 5.509186e-001, 5.517979e-001, 5.526772e-001, 5.535565e-001, 5.544358e-001, 5.553128e-001, 5.561890e-001,
+5.570652e-001, 5.579414e-001, 5.588176e-001, 5.596931e-001, 5.605678e-001, 5.614424e-001, 5.623171e-001, 5.631918e-001, 5.640664e-001, 5.649405e-001,
+5.658147e-001, 5.666888e-001, 5.675629e-001, 5.684371e-001, 5.693033e-001, 5.701668e-001, 5.710304e-001, 5.718939e-001, 5.727574e-001, 5.736197e-001,
+5.744786e-001, 5.753375e-001, 5.761964e-001, 5.770552e-001, 5.779141e-001, 5.787752e-001, 5.796372e-001, 5.804992e-001, 5.813612e-001, 5.822232e-001,
+5.830853e-001, 5.839483e-001, 5.848112e-001, 5.856742e-001, 5.865372e-001, 5.874002e-001, 5.882590e-001, 5.891109e-001, 5.899629e-001, 5.908148e-001,
+5.916668e-001, 5.925187e-001, 5.933675e-001, 5.942141e-001, 5.950608e-001, 5.959074e-001, 5.967540e-001, 5.976007e-001, 5.984492e-001, 5.992983e-001,
+6.001474e-001, 6.009965e-001, 6.018456e-001, 6.026948e-001, 6.035408e-001, 6.043862e-001, 6.052315e-001, 6.060768e-001, 6.069221e-001, 6.077674e-001,
+6.086057e-001, 6.094419e-001, 6.102781e-001, 6.111144e-001, 6.119506e-001, 6.127868e-001, 6.136180e-001, 6.144467e-001, 6.152755e-001, 6.161042e-001,
+6.169329e-001, 6.177616e-001, 6.185904e-001, 6.194193e-001, 6.202482e-001, 6.210771e-001, 6.219060e-001, 6.227349e-001, 6.235638e-001, 6.243926e-001,
+6.252213e-001, 6.260501e-001, 6.268788e-001, 6.277076e-001, 6.285363e-001, 6.293579e-001, 6.301783e-001, 6.309987e-001, 6.318191e-001, 6.326395e-001,
+6.334599e-001, 6.342767e-001, 6.350883e-001, 6.359000e-001, 6.367117e-001, 6.375233e-001, 6.383350e-001, 6.391467e-001, 6.399571e-001, 6.407674e-001,
+6.415776e-001, 6.423879e-001, 6.431982e-001, 6.440084e-001, 6.448182e-001, 6.456268e-001, 6.464353e-001, 6.472438e-001, 6.480524e-001, 6.488609e-001,
+6.496694e-001, 6.504725e-001, 6.512713e-001, 6.520701e-001, 6.528689e-001, 6.536677e-001, 6.544665e-001, 6.552653e-001, 6.560565e-001, 6.568453e-001,
+6.576341e-001, 6.584229e-001, 6.592116e-001, 6.600004e-001, 6.607892e-001, 6.615757e-001, 6.623617e-001, 6.631477e-001, 6.639338e-001, 6.647198e-001,
+6.655059e-001, 6.662919e-001, 6.670785e-001, 6.678652e-001, 6.686519e-001, 6.694386e-001, 6.702252e-001, 6.710119e-001, 6.717986e-001, 6.725747e-001,
+6.733482e-001, 6.741217e-001, 6.748952e-001, 6.756686e-001, 6.764421e-001, 6.772156e-001, 6.779829e-001, 6.787466e-001, 6.795103e-001, 6.802740e-001,
+6.810376e-001, 6.818013e-001, 6.825650e-001, 6.833277e-001, 6.840886e-001, 6.848495e-001, 6.856105e-001, 6.863714e-001, 6.871323e-001, 6.878933e-001,
+6.886542e-001, 6.894174e-001, 6.901808e-001, 6.909441e-001, 6.917074e-001, 6.924707e-001, 6.932340e-001, 6.939973e-001, 6.947564e-001, 6.955114e-001,
+6.962664e-001, 6.970214e-001, 6.977764e-001, 6.985314e-001, 6.992864e-001, 7.000414e-001, 7.007868e-001, 7.015316e-001, 7.022763e-001, 7.030211e-001,
+7.037658e-001, 7.045106e-001, 7.052553e-001, 7.059992e-001, 7.067407e-001, 7.074822e-001, 7.082236e-001, 7.089651e-001, 7.097066e-001, 7.104480e-001,
+7.111895e-001, 7.119327e-001, 7.126778e-001, 7.134229e-001, 7.141680e-001, 7.149131e-001, 7.156582e-001, 7.164033e-001, 7.171484e-001, 7.178944e-001,
+7.186410e-001, 7.193876e-001, 7.201342e-001, 7.208808e-001, 7.216274e-001, 7.223740e-001, 7.231205e-001, 7.238617e-001, 7.245994e-001, 7.253370e-001,
+7.260747e-001, 7.268123e-001, 7.275499e-001, 7.282876e-001, 7.290252e-001, 7.297609e-001, 7.304947e-001, 7.312285e-001, 7.319623e-001, 7.326961e-001,
+7.334299e-001, 7.341636e-001, 7.348974e-001, 7.356321e-001, 7.363688e-001, 7.371055e-001, 7.378422e-001, 7.385789e-001, 7.393156e-001, 7.400524e-001,
+7.407891e-001, 7.415258e-001, 7.422630e-001, 7.430003e-001, 7.437375e-001, 7.444748e-001, 7.452120e-001, 7.459493e-001, 7.466865e-001, 7.474238e-001,
+7.481558e-001, 7.488833e-001, 7.496108e-001, 7.503383e-001, 7.510658e-001, 7.517933e-001, 7.525208e-001, 7.532483e-001, 7.539758e-001, 7.546988e-001,
+7.554216e-001, 7.561445e-001, 7.568673e-001, 7.575902e-001, 7.583130e-001, 7.590359e-001, 7.597587e-001, 7.604822e-001, 7.612072e-001, 7.619321e-001,
+7.626570e-001, 7.633819e-001, 7.641068e-001, 7.648317e-001, 7.655566e-001, 7.662815e-001, 7.670075e-001, 7.677345e-001, 7.684614e-001, 7.691884e-001,
+7.699153e-001, 7.706423e-001, 7.713692e-001, 7.720962e-001, 7.728231e-001, 7.735467e-001, 7.742683e-001, 7.749899e-001, 7.757115e-001, 7.764332e-001,
+7.771548e-001, 7.778764e-001, 7.785980e-001, 7.793196e-001, 7.800378e-001, 7.807539e-001, 7.814699e-001, 7.821859e-001, 7.829019e-001, 7.836179e-001,
+7.843340e-001, 7.850500e-001, 7.857660e-001, 7.864825e-001, 7.871995e-001, 7.879165e-001, 7.886335e-001, 7.893505e-001, 7.900676e-001, 7.907846e-001,
+7.915016e-001, 7.922186e-001, 7.929350e-001, 7.936489e-001, 7.943628e-001, 7.950767e-001, 7.957905e-001, 7.965044e-001, 7.972183e-001, 7.979322e-001,
+7.986460e-001, 7.993599e-001, 8.000700e-001, 8.007791e-001, 8.014883e-001, 8.021974e-001, 8.029065e-001, 8.036156e-001, 8.043248e-001, 8.050339e-001,
+8.057430e-001, 8.064500e-001, 8.071512e-001, 8.078524e-001, 8.085535e-001, 8.092547e-001, 8.099559e-001, 8.106571e-001, 8.113583e-001, 8.120595e-001,
+8.127607e-001, 8.134608e-001, 8.141604e-001, 8.148599e-001, 8.155595e-001, 8.162590e-001, 8.169585e-001, 8.176581e-001, 8.183576e-001, 8.190571e-001,
+8.197567e-001, 8.204558e-001, 8.211549e-001, 8.218540e-001, 8.225531e-001, 8.232522e-001, 8.239513e-001, 8.246504e-001, 8.253494e-001, 8.260485e-001,
+8.267476e-001, 8.274425e-001, 8.281369e-001, 8.288314e-001, 8.295258e-001, 8.302203e-001, 8.309147e-001, 8.316092e-001, 8.323036e-001, 8.329981e-001,
+8.336925e-001, 8.343786e-001, 8.350633e-001, 8.357481e-001, 8.364328e-001, 8.371176e-001, 8.378023e-001, 8.384870e-001, 8.391718e-001, 8.398565e-001,
+8.405413e-001, 8.412236e-001, 8.419047e-001, 8.425859e-001, 8.432671e-001, 8.439482e-001, 8.446294e-001, 8.453105e-001, 8.459917e-001, 8.466728e-001,
+8.473540e-001, 8.480354e-001, 8.487173e-001, 8.493992e-001, 8.500811e-001, 8.507631e-001, 8.514450e-001, 8.521269e-001, 8.528088e-001, 8.534907e-001,
+8.541726e-001, 8.548545e-001, 8.555288e-001, 8.562021e-001, 8.568754e-001, 8.575487e-001, 8.582220e-001, 8.588953e-001, 8.595686e-001, 8.602419e-001,
+8.609152e-001, 8.615885e-001, 8.622590e-001, 8.629223e-001, 8.635855e-001, 8.642487e-001, 8.649120e-001, 8.655752e-001, 8.662384e-001, 8.669017e-001,
+8.675649e-001, 8.682281e-001, 8.688914e-001, 8.695525e-001, 8.702116e-001, 8.708708e-001, 8.715300e-001, 8.721891e-001, 8.728483e-001, 8.735074e-001,
+8.741666e-001, 8.748258e-001, 8.754849e-001, 8.761441e-001, 8.768044e-001, 8.774655e-001, 8.781265e-001, 8.787876e-001, 8.794486e-001, 8.801097e-001,
+8.807707e-001, 8.814318e-001, 8.820928e-001, 8.827539e-001, 8.834149e-001, 8.840741e-001, 8.847320e-001, 8.853899e-001, 8.860478e-001, 8.867057e-001,
+8.873636e-001, 8.880215e-001, 8.886794e-001, 8.893373e-001, 8.899952e-001, 8.906531e-001, 8.913082e-001, 8.919589e-001, 8.926095e-001, 8.932602e-001,
+8.939109e-001, 8.945616e-001, 8.952122e-001, 8.958629e-001, 8.965136e-001, 8.971643e-001, 8.978149e-001, 8.984654e-001, 8.991104e-001, 8.997554e-001,
+9.004003e-001, 9.010453e-001, 9.016903e-001, 9.023352e-001, 9.029802e-001, 9.036252e-001, 9.042702e-001, 9.049151e-001, 9.055601e-001, 9.062044e-001,
+9.068480e-001, 9.074916e-001, 9.081353e-001, 9.087789e-001, 9.094225e-001, 9.100662e-001, 9.107098e-001, 9.113535e-001, 9.119971e-001, 9.126407e-001,
+9.132844e-001, 9.139228e-001, 9.145606e-001, 9.151983e-001, 9.158361e-001, 9.164738e-001, 9.171116e-001, 9.177493e-001, 9.183871e-001, 9.190248e-001,
+9.196626e-001, 9.203003e-001, 9.209373e-001, 9.215621e-001, 9.221869e-001, 9.228117e-001, 9.234365e-001, 9.240614e-001, 9.246862e-001, 9.253110e-001,
+9.259358e-001, 9.265606e-001, 9.271854e-001, 9.278102e-001, 9.284340e-001, 9.290462e-001, 9.296583e-001, 9.302705e-001, 9.308827e-001, 9.314948e-001,
+9.321070e-001, 9.327191e-001, 9.333313e-001, 9.339435e-001, 9.345556e-001, 9.351678e-001, 9.357799e-001, 9.363881e-001, 9.369959e-001, 9.376038e-001,
+9.382117e-001, 9.388195e-001, 9.394274e-001, 9.400353e-001, 9.406431e-001, 9.412510e-001, 9.418589e-001, 9.424668e-001, 9.430746e-001, 9.436800e-001,
+9.442839e-001, 9.448878e-001, 9.454917e-001, 9.460956e-001, 9.466995e-001, 9.473034e-001, 9.479073e-001, 9.485112e-001, 9.491151e-001, 9.497190e-001,
+9.503230e-001, 9.509252e-001, 9.515192e-001, 9.521132e-001, 9.527072e-001, 9.533011e-001, 9.538951e-001, 9.544891e-001, 9.550831e-001, 9.556771e-001,
+9.562711e-001, 9.568651e-001, 9.574590e-001, 9.580530e-001, 9.586417e-001, 9.592257e-001, 9.598097e-001, 9.603936e-001, 9.609776e-001, 9.615616e-001,
+9.621456e-001, 9.627295e-001, 9.633135e-001, 9.638975e-001, 9.644814e-001, 9.650654e-001, 9.656494e-001, 9.662257e-001, 9.667990e-001, 9.673722e-001,
+9.679455e-001, 9.685188e-001, 9.690920e-001, 9.696653e-001, 9.702386e-001, 9.708118e-001, 9.713851e-001, 9.719584e-001, 9.725316e-001, 9.731049e-001,
+9.736630e-001, 9.742156e-001, 9.747681e-001, 9.753206e-001, 9.758732e-001, 9.764257e-001, 9.769782e-001, 9.775307e-001, 9.780833e-001, 9.786358e-001,
+9.791883e-001, 9.797409e-001, 9.802934e-001, 9.808301e-001, 9.813547e-001, 9.818794e-001, 9.824040e-001, 9.829287e-001, 9.834533e-001, 9.839780e-001,
+9.845026e-001, 9.850273e-001, 9.855519e-001, 9.860766e-001, 9.866012e-001, 9.871259e-001, 9.876429e-001, 9.881339e-001, 9.886250e-001, 9.891160e-001,
+9.896071e-001, 9.900981e-001, 9.905891e-001, 9.910802e-001, 9.915712e-001, 9.920623e-001, 9.925533e-001, 9.930444e-001, 9.935354e-001, 9.940265e-001,
+9.944711e-001, 9.948964e-001, 9.953217e-001, 9.957470e-001, 9.961723e-001, 9.965976e-001, 9.970229e-001, 9.974482e-001, 9.978735e-001, 9.982988e-001,
+9.987241e-001, 9.991494e-001, 9.995747e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 100 plus", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.568259e-004, 9.166480e-004, 1.381155e-003, 1.858887e-003, 2.356361e-003, 2.880450e-003, 3.437953e-003, 4.022534e-003, 4.635420e-003,
+5.271191e-003, 5.936325e-003, 6.632915e-003, 7.349084e-003, 8.080764e-003, 8.835518e-003, 9.628961e-003, 1.046551e-002, 1.133507e-002, 1.224962e-002,
+1.319884e-002, 1.418103e-002, 1.519876e-002, 1.624048e-002, 1.730833e-002, 1.841242e-002, 1.955182e-002, 2.073532e-002, 2.196287e-002, 2.323884e-002,
+2.455344e-002, 2.590765e-002, 2.730419e-002, 2.873913e-002, 3.021026e-002, 3.172125e-002, 3.327315e-002, 3.487602e-002, 3.651832e-002, 3.820874e-002,
+3.994953e-002, 4.172976e-002, 4.355101e-002, 4.541294e-002, 4.730769e-002, 4.923472e-002, 5.120375e-002, 5.321912e-002, 5.527558e-002, 5.738420e-002,
+5.953824e-002, 6.173008e-002, 6.396342e-002, 6.624602e-002, 6.857838e-002, 7.095217e-002, 7.336372e-002, 7.582682e-002, 7.833384e-002, 8.089904e-002,
+8.351253e-002, 8.617543e-002, 8.888890e-002, 9.164794e-002, 9.445172e-002, 9.729179e-002, 1.001829e-001, 1.031202e-001, 1.061026e-001, 1.091277e-001,
+1.121969e-001, 1.153126e-001, 1.184773e-001, 1.216841e-001, 1.249388e-001, 1.282431e-001, 1.315929e-001, 1.349757e-001, 1.383993e-001, 1.418683e-001,
+1.453785e-001, 1.489268e-001, 1.525138e-001, 1.561374e-001, 1.597927e-001, 1.634855e-001, 1.672230e-001, 1.710027e-001, 1.748191e-001, 1.786740e-001,
+1.825644e-001, 1.864795e-001, 1.904242e-001, 1.944115e-001, 1.984315e-001, 2.024817e-001, 2.065693e-001, 2.106909e-001, 2.148406e-001, 2.190158e-001,
+2.232162e-001, 2.274380e-001, 2.316683e-001, 2.359098e-001, 2.401737e-001, 2.444602e-001, 2.487655e-001, 2.530877e-001, 2.574403e-001, 2.618154e-001,
+2.662160e-001, 2.706287e-001, 2.750388e-001, 2.794605e-001, 2.838952e-001, 2.883373e-001, 2.927843e-001, 2.972404e-001, 3.016997e-001, 3.061661e-001,
+3.106426e-001, 3.151304e-001, 3.196105e-001, 3.240851e-001, 3.285589e-001, 3.330226e-001, 3.374676e-001, 3.418787e-001, 3.462743e-001, 3.506547e-001,
+3.550148e-001, 3.593492e-001, 3.636717e-001, 3.679802e-001, 3.722730e-001, 3.765604e-001, 3.808422e-001, 3.850819e-001, 3.893063e-001, 3.935188e-001,
+3.977066e-001, 4.018787e-001, 4.060067e-001, 4.101200e-001, 4.142100e-001, 4.182652e-001, 4.223062e-001, 4.263221e-001, 4.303199e-001, 4.342920e-001,
+4.382178e-001, 4.421251e-001, 4.459949e-001, 4.498532e-001, 4.536816e-001, 4.574846e-001, 4.612646e-001, 4.650111e-001, 4.687467e-001, 4.724291e-001,
+4.761006e-001, 4.797236e-001, 4.833353e-001, 4.869242e-001, 4.905021e-001, 4.940682e-001, 4.975985e-001, 5.011065e-001, 5.045886e-001, 5.080611e-001,
+5.115217e-001, 5.149799e-001, 5.184120e-001, 5.218411e-001, 5.252186e-001, 5.285930e-001, 5.319072e-001, 5.352198e-001, 5.384925e-001, 5.417644e-001,
+5.449958e-001, 5.482258e-001, 5.514275e-001, 5.546270e-001, 5.577928e-001, 5.609537e-001, 5.640918e-001, 5.672239e-001, 5.703287e-001, 5.734215e-001,
+5.764908e-001, 5.795423e-001, 5.825763e-001, 5.855859e-001, 5.885831e-001, 5.915424e-001, 5.944979e-001, 5.973832e-001, 6.002685e-001, 6.031266e-001,
+6.059791e-001, 6.088135e-001, 6.116351e-001, 6.144290e-001, 6.171647e-001, 6.198991e-001, 6.225900e-001, 6.252810e-001, 6.279500e-001, 6.306102e-001,
+6.332606e-001, 6.358943e-001, 6.385279e-001, 6.411197e-001, 6.437116e-001, 6.462586e-001, 6.487772e-001, 6.512871e-001, 6.537609e-001, 6.562347e-001,
+6.586758e-001, 6.611059e-001, 6.635296e-001, 6.659365e-001, 6.683434e-001, 6.707114e-001, 6.730682e-001, 6.754177e-001, 6.777454e-001, 6.800731e-001,
+6.823897e-001, 6.847014e-001, 6.870060e-001, 6.892571e-001, 6.915083e-001, 6.937377e-001, 6.959463e-001, 6.981548e-001, 7.003312e-001, 7.025029e-001,
+7.046647e-001, 7.067890e-001, 7.089133e-001, 7.110231e-001, 7.131193e-001, 7.152154e-001, 7.172770e-001, 7.193294e-001, 7.213793e-001, 7.233661e-001,
+7.253528e-001, 7.273291e-001, 7.292747e-001, 7.312203e-001, 7.331499e-001, 7.350592e-001, 7.369684e-001, 7.388588e-001, 7.407366e-001, 7.426143e-001,
+7.444640e-001, 7.463031e-001, 7.481421e-001, 7.499330e-001, 7.517132e-001, 7.534933e-001, 7.552290e-001, 7.569586e-001, 7.586883e-001, 7.603802e-001,
+7.620685e-001, 7.637568e-001, 7.654249e-001, 7.670910e-001, 7.687572e-001, 7.703764e-001, 7.719892e-001, 7.736020e-001, 7.751834e-001, 7.767576e-001,
+7.783317e-001, 7.799008e-001, 7.814677e-001, 7.830347e-001, 7.845696e-001, 7.860811e-001, 7.875926e-001, 7.890849e-001, 7.905498e-001, 7.920146e-001,
+7.934714e-001, 7.948976e-001, 7.963239e-001, 7.977501e-001, 7.991691e-001, 8.005878e-001, 8.020066e-001, 8.034045e-001, 8.047935e-001, 8.061826e-001,
+8.075595e-001, 8.089176e-001, 8.102758e-001, 8.116321e-001, 8.129533e-001, 8.142745e-001, 8.155958e-001, 8.168949e-001, 8.181831e-001, 8.194714e-001,
+8.207565e-001, 8.220326e-001, 8.233086e-001, 8.245846e-001, 8.258384e-001, 8.270868e-001, 8.283351e-001, 8.295805e-001, 8.308194e-001, 8.320583e-001,
+8.332972e-001, 8.345113e-001, 8.357186e-001, 8.369258e-001, 8.381229e-001, 8.392837e-001, 8.404445e-001, 8.416053e-001, 8.427383e-001, 8.438537e-001,
+8.449691e-001, 8.460846e-001, 8.471650e-001, 8.482443e-001, 8.493236e-001, 8.503887e-001, 8.514185e-001, 8.524482e-001, 8.534779e-001, 8.544931e-001,
+8.554970e-001, 8.565009e-001, 8.575048e-001, 8.584918e-001, 8.594746e-001, 8.604573e-001, 8.614401e-001, 8.623783e-001, 8.633163e-001, 8.642542e-001,
+8.651857e-001, 8.660803e-001, 8.669749e-001, 8.678696e-001, 8.687559e-001, 8.696189e-001, 8.704819e-001, 8.713449e-001, 8.722006e-001, 8.730415e-001,
+8.738825e-001, 8.747235e-001, 8.755509e-001, 8.763541e-001, 8.771573e-001, 8.779605e-001, 8.787579e-001, 8.795443e-001, 8.803307e-001, 8.811172e-001,
+8.818971e-001, 8.826605e-001, 8.834240e-001, 8.841875e-001, 8.849436e-001, 8.856665e-001, 8.863893e-001, 8.871122e-001, 8.878351e-001, 8.885604e-001,
+8.892857e-001, 8.900109e-001, 8.907362e-001, 8.914462e-001, 8.921533e-001, 8.928604e-001, 8.935676e-001, 8.942709e-001, 8.949717e-001, 8.956726e-001,
+8.963734e-001, 8.970721e-001, 8.977662e-001, 8.984603e-001, 8.991544e-001, 8.998485e-001, 9.005149e-001, 9.011809e-001, 9.018470e-001, 9.025130e-001,
+9.031683e-001, 9.038167e-001, 9.044651e-001, 9.051135e-001, 9.057582e-001, 9.063869e-001, 9.070156e-001, 9.076442e-001, 9.082729e-001, 9.088766e-001,
+9.094702e-001, 9.100638e-001, 9.106575e-001, 9.112506e-001, 9.118416e-001, 9.124327e-001, 9.130237e-001, 9.136147e-001, 9.142035e-001, 9.147909e-001,
+9.153784e-001, 9.159658e-001, 9.165533e-001, 9.171172e-001, 9.176811e-001, 9.182451e-001, 9.188090e-001, 9.193635e-001, 9.198989e-001, 9.204343e-001,
+9.209698e-001, 9.215052e-001, 9.220255e-001, 9.225361e-001, 9.230468e-001, 9.235574e-001, 9.240681e-001, 9.245593e-001, 9.250469e-001, 9.255344e-001,
+9.260220e-001, 9.265089e-001, 9.269595e-001, 9.274101e-001, 9.278606e-001, 9.283112e-001, 9.287610e-001, 9.292059e-001, 9.296509e-001, 9.300958e-001,
+9.305407e-001, 9.309821e-001, 9.314102e-001, 9.318384e-001, 9.322665e-001, 9.326946e-001, 9.331154e-001, 9.335114e-001, 9.339074e-001, 9.343034e-001,
+9.346995e-001, 9.350925e-001, 9.354733e-001, 9.358541e-001, 9.362349e-001, 9.366156e-001, 9.369942e-001, 9.373536e-001, 9.377130e-001, 9.380724e-001,
+9.384317e-001, 9.387911e-001, 9.391242e-001, 9.394561e-001, 9.397880e-001, 9.401199e-001, 9.404518e-001, 9.407856e-001, 9.411201e-001, 9.414545e-001,
+9.417890e-001, 9.421235e-001, 9.424526e-001, 9.427763e-001, 9.430999e-001, 9.434236e-001, 9.437472e-001, 9.440697e-001, 9.443871e-001, 9.447046e-001,
+9.450220e-001, 9.453394e-001, 9.456568e-001, 9.459626e-001, 9.462655e-001, 9.465685e-001, 9.468714e-001, 9.471744e-001, 9.474688e-001, 9.477492e-001,
+9.480296e-001, 9.483100e-001, 9.485904e-001, 9.488708e-001, 9.491494e-001, 9.494279e-001, 9.497063e-001, 9.499848e-001, 9.502632e-001, 9.505477e-001,
+9.508439e-001, 9.511401e-001, 9.514363e-001, 9.517325e-001, 9.520287e-001, 9.523310e-001, 9.526355e-001, 9.529400e-001, 9.532445e-001, 9.535490e-001,
+9.538534e-001, 9.541549e-001, 9.544565e-001, 9.547581e-001, 9.550596e-001, 9.553612e-001, 9.556582e-001, 9.559459e-001, 9.562335e-001, 9.565211e-001,
+9.568087e-001, 9.570963e-001, 9.573791e-001, 9.576574e-001, 9.579358e-001, 9.582142e-001, 9.584926e-001, 9.587710e-001, 9.590389e-001, 9.593018e-001,
+9.595646e-001, 9.598275e-001, 9.600903e-001, 9.603532e-001, 9.606087e-001, 9.608618e-001, 9.611149e-001, 9.613680e-001, 9.616211e-001, 9.618742e-001,
+9.621182e-001, 9.623593e-001, 9.626005e-001, 9.628417e-001, 9.630828e-001, 9.633240e-001, 9.635609e-001, 9.637961e-001, 9.640313e-001, 9.642665e-001,
+9.645018e-001, 9.647370e-001, 9.649641e-001, 9.651859e-001, 9.654078e-001, 9.656296e-001, 9.658514e-001, 9.660732e-001, 9.662867e-001, 9.664887e-001,
+9.666908e-001, 9.668928e-001, 9.670949e-001, 9.672969e-001, 9.674958e-001, 9.676799e-001, 9.678639e-001, 9.680479e-001, 9.682319e-001, 9.684160e-001,
+9.686000e-001, 9.687843e-001, 9.689686e-001, 9.691529e-001, 9.693372e-001, 9.695215e-001, 9.697058e-001, 9.698892e-001, 9.700717e-001, 9.702541e-001,
+9.704365e-001, 9.706190e-001, 9.708014e-001, 9.709837e-001, 9.711578e-001, 9.713319e-001, 9.715060e-001, 9.716801e-001, 9.718542e-001, 9.720284e-001,
+9.721953e-001, 9.723549e-001, 9.725145e-001, 9.726742e-001, 9.728338e-001, 9.729934e-001, 9.731530e-001, 9.732947e-001, 9.734344e-001, 9.735741e-001,
+9.737137e-001, 9.738534e-001, 9.739931e-001, 9.741299e-001, 9.742575e-001, 9.743851e-001, 9.745126e-001, 9.746402e-001, 9.747678e-001, 9.748953e-001,
+9.750214e-001, 9.751459e-001, 9.752704e-001, 9.753949e-001, 9.755195e-001, 9.756440e-001, 9.757685e-001, 9.758896e-001, 9.760090e-001, 9.761284e-001,
+9.762479e-001, 9.763673e-001, 9.764867e-001, 9.766062e-001, 9.767203e-001, 9.768331e-001, 9.769459e-001, 9.770586e-001, 9.771714e-001, 9.772842e-001,
+9.773970e-001, 9.775123e-001, 9.776281e-001, 9.777439e-001, 9.778597e-001, 9.779755e-001, 9.780913e-001, 9.782071e-001, 9.783318e-001, 9.784587e-001,
+9.785856e-001, 9.787125e-001, 9.788395e-001, 9.789664e-001, 9.790933e-001, 9.792244e-001, 9.793574e-001, 9.794905e-001, 9.796235e-001, 9.797565e-001,
+9.798896e-001, 9.800226e-001, 9.801558e-001, 9.802892e-001, 9.804226e-001, 9.805560e-001, 9.806893e-001, 9.808227e-001, 9.809561e-001, 9.810881e-001,
+9.812154e-001, 9.813427e-001, 9.814701e-001, 9.815974e-001, 9.817247e-001, 9.818521e-001, 9.819794e-001, 9.821054e-001, 9.822312e-001, 9.823570e-001,
+9.824827e-001, 9.826085e-001, 9.827343e-001, 9.828601e-001, 9.829840e-001, 9.831056e-001, 9.832272e-001, 9.833488e-001, 9.834704e-001, 9.835920e-001,
+9.837136e-001, 9.838352e-001, 9.839490e-001, 9.840625e-001, 9.841760e-001, 9.842895e-001, 9.844030e-001, 9.845164e-001, 9.846299e-001, 9.847433e-001,
+9.848564e-001, 9.849695e-001, 9.850827e-001, 9.851958e-001, 9.853089e-001, 9.854221e-001, 9.855352e-001, 9.856475e-001, 9.857596e-001, 9.858716e-001,
+9.859836e-001, 9.860956e-001, 9.862076e-001, 9.863196e-001, 9.864316e-001, 9.865403e-001, 9.866489e-001, 9.867574e-001, 9.868659e-001, 9.869744e-001,
+9.870830e-001, 9.871915e-001, 9.872993e-001, 9.874020e-001, 9.875046e-001, 9.876072e-001, 9.877098e-001, 9.878124e-001, 9.879151e-001, 9.880177e-001,
+9.881187e-001, 9.882129e-001, 9.883071e-001, 9.884013e-001, 9.884955e-001, 9.885897e-001, 9.886839e-001, 9.887781e-001, 9.888703e-001, 9.889534e-001,
+9.890366e-001, 9.891197e-001, 9.892028e-001, 9.892859e-001, 9.893690e-001, 9.894521e-001, 9.895341e-001, 9.896033e-001, 9.896725e-001, 9.897418e-001,
+9.898110e-001, 9.898802e-001, 9.899495e-001, 9.900187e-001, 9.900879e-001, 9.901421e-001, 9.901946e-001, 9.902471e-001, 9.902997e-001, 9.903522e-001,
+9.904048e-001, 9.904573e-001, 9.905098e-001, 9.905501e-001, 9.905833e-001, 9.906166e-001, 9.906498e-001, 9.906830e-001, 9.907162e-001, 9.907494e-001,
+9.907826e-001, 9.908105e-001, 9.908241e-001, 9.908378e-001, 9.908514e-001, 9.908650e-001, 9.908786e-001, 9.908923e-001, 9.909059e-001, 9.909195e-001,
+9.909345e-001, 9.909498e-001, 9.909651e-001, 9.909805e-001, 9.909958e-001, 9.910111e-001, 9.910264e-001, 9.910417e-001, 9.910593e-001, 9.910831e-001,
+9.911068e-001, 9.911305e-001, 9.911543e-001, 9.911780e-001, 9.912017e-001, 9.912254e-001, 9.912492e-001, 9.912775e-001, 9.913085e-001, 9.913394e-001,
+9.913704e-001, 9.914013e-001, 9.914323e-001, 9.914632e-001, 9.914942e-001, 9.915251e-001, 9.915610e-001, 9.915973e-001, 9.916337e-001, 9.916700e-001,
+9.917063e-001, 9.917427e-001, 9.917790e-001, 9.918153e-001, 9.918520e-001, 9.918924e-001, 9.919328e-001, 9.919732e-001, 9.920136e-001, 9.920540e-001,
+9.920944e-001, 9.921348e-001, 9.921752e-001, 9.922161e-001, 9.922596e-001, 9.923030e-001, 9.923465e-001, 9.923900e-001, 9.924335e-001, 9.924770e-001,
+9.925205e-001, 9.925640e-001, 9.926078e-001, 9.926536e-001, 9.926993e-001, 9.927451e-001, 9.927909e-001, 9.928366e-001, 9.928824e-001, 9.929282e-001,
+9.929739e-001, 9.930197e-001, 9.930669e-001, 9.931141e-001, 9.931613e-001, 9.932085e-001, 9.932557e-001, 9.933028e-001, 9.933500e-001, 9.933972e-001,
+9.934444e-001, 9.934919e-001, 9.935395e-001, 9.935871e-001, 9.936347e-001, 9.936823e-001, 9.937299e-001, 9.937775e-001, 9.938251e-001, 9.938727e-001,
+9.939200e-001, 9.939668e-001, 9.940136e-001, 9.940604e-001, 9.941072e-001, 9.941541e-001, 9.942009e-001, 9.942477e-001, 9.942945e-001, 9.943411e-001,
+9.943858e-001, 9.944304e-001, 9.944751e-001, 9.945198e-001, 9.945644e-001, 9.946091e-001, 9.946537e-001, 9.946984e-001, 9.947431e-001, 9.947856e-001,
+9.948267e-001, 9.948678e-001, 9.949088e-001, 9.949499e-001, 9.949909e-001, 9.950320e-001, 9.950731e-001, 9.951141e-001, 9.951552e-001, 9.951915e-001,
+9.952276e-001, 9.952637e-001, 9.952998e-001, 9.953359e-001, 9.953720e-001, 9.954081e-001, 9.954442e-001, 9.954803e-001, 9.955152e-001, 9.955464e-001,
+9.955775e-001, 9.956087e-001, 9.956398e-001, 9.956710e-001, 9.957021e-001, 9.957333e-001, 9.957644e-001, 9.957956e-001, 9.958271e-001, 9.958592e-001,
+9.958912e-001, 9.959233e-001, 9.959554e-001, 9.959875e-001, 9.960195e-001, 9.960516e-001, 9.960837e-001, 9.961157e-001, 9.961478e-001, 9.961799e-001,
+9.962120e-001, 9.962440e-001, 9.962761e-001, 9.963082e-001, 9.963402e-001, 9.963723e-001, 9.964044e-001, 9.964365e-001, 9.964682e-001, 9.964997e-001,
+9.965311e-001, 9.965625e-001, 9.965939e-001, 9.966253e-001, 9.966567e-001, 9.966881e-001, 9.967195e-001, 9.967509e-001, 9.967819e-001, 9.968118e-001,
+9.968416e-001, 9.968715e-001, 9.969014e-001, 9.969312e-001, 9.969611e-001, 9.969910e-001, 9.970209e-001, 9.970507e-001, 9.970807e-001, 9.971146e-001,
+9.971485e-001, 9.971824e-001, 9.972163e-001, 9.972502e-001, 9.972841e-001, 9.973180e-001, 9.973520e-001, 9.973859e-001, 9.974198e-001, 9.974562e-001,
+9.974939e-001, 9.975317e-001, 9.975695e-001, 9.976072e-001, 9.976450e-001, 9.976828e-001, 9.977205e-001, 9.977583e-001, 9.977961e-001, 9.978342e-001,
+9.978745e-001, 9.979147e-001, 9.979549e-001, 9.979952e-001, 9.980354e-001, 9.980756e-001, 9.981159e-001, 9.981561e-001, 9.981964e-001, 9.982366e-001,
+9.982774e-001, 9.983187e-001, 9.983601e-001, 9.984014e-001, 9.984427e-001, 9.984840e-001, 9.985253e-001, 9.985666e-001, 9.986080e-001, 9.986493e-001,
+9.986906e-001, 9.987318e-001, 9.987729e-001, 9.988141e-001, 9.988552e-001, 9.988964e-001, 9.989375e-001, 9.989786e-001, 9.990198e-001, 9.990609e-001,
+9.991021e-001, 9.991432e-001, 9.991832e-001, 9.992231e-001, 9.992631e-001, 9.993030e-001, 9.993430e-001, 9.993829e-001, 9.994229e-001, 9.994628e-001,
+9.995028e-001, 9.995427e-001, 9.995825e-001, 9.996205e-001, 9.996584e-001, 9.996964e-001, 9.997343e-001, 9.997723e-001, 9.998102e-001, 9.998482e-001,
+9.998861e-001, 9.999241e-001, 9.999620e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.897309e-004, 3.902519e-004, 6.009749e-004, 8.188499e-004, 1.045925e-003, 1.282994e-003, 1.532615e-003, 1.792833e-003, 2.063988e-003,
+2.347465e-003, 2.640426e-003, 2.945200e-003, 3.263294e-003, 3.594430e-003, 3.939615e-003, 4.301439e-003, 4.676684e-003, 5.064067e-003, 5.464949e-003,
+5.877981e-003, 6.304445e-003, 6.744198e-003, 7.200591e-003, 7.674368e-003, 8.165362e-003, 8.674933e-003, 9.202759e-003, 9.746780e-003, 1.030678e-002,
+1.088246e-002, 1.147772e-002, 1.209232e-002, 1.272617e-002, 1.338115e-002, 1.405845e-002, 1.476041e-002, 1.548226e-002, 1.622582e-002, 1.699296e-002,
+1.778020e-002, 1.858517e-002, 1.941291e-002, 2.025479e-002, 2.111680e-002, 2.199699e-002, 2.290128e-002, 2.382686e-002, 2.477612e-002, 2.574816e-002,
+2.674263e-002, 2.776683e-002, 2.881751e-002, 2.989328e-002, 3.099708e-002, 3.212536e-002, 3.327477e-002, 3.444571e-002, 3.563961e-002, 3.685627e-002,
+3.809465e-002, 3.935327e-002, 4.063609e-002, 4.194544e-002, 4.328280e-002, 4.464635e-002, 4.603564e-002, 4.745305e-002, 4.889775e-002, 5.037371e-002,
+5.188803e-002, 5.344191e-002, 5.503203e-002, 5.665308e-002, 5.830613e-002, 5.999663e-002, 6.172809e-002, 6.349488e-002, 6.529146e-002, 6.711638e-002,
+6.896976e-002, 7.085989e-002, 7.278245e-002, 7.473638e-002, 7.671902e-002, 7.872828e-002, 8.076153e-002, 8.281753e-002, 8.490117e-002, 8.702378e-002,
+8.918776e-002, 9.138776e-002, 9.361636e-002, 9.586818e-002, 9.814322e-002, 1.004460e-001, 1.027875e-001, 1.051672e-001, 1.075756e-001, 1.100081e-001,
+1.124618e-001, 1.149377e-001, 1.174454e-001, 1.199734e-001, 1.225221e-001, 1.250932e-001, 1.276911e-001, 1.303068e-001, 1.329408e-001, 1.355947e-001,
+1.382691e-001, 1.409653e-001, 1.436827e-001, 1.464273e-001, 1.492000e-001, 1.519946e-001, 1.548147e-001, 1.576558e-001, 1.605057e-001, 1.633637e-001,
+1.662496e-001, 1.691480e-001, 1.720583e-001, 1.749928e-001, 1.779374e-001, 1.808930e-001, 1.838704e-001, 1.868537e-001, 1.898440e-001, 1.928508e-001,
+1.958659e-001, 1.988967e-001, 2.019404e-001, 2.049918e-001, 2.080595e-001, 2.111341e-001, 2.142200e-001, 2.173251e-001, 2.204380e-001, 2.235598e-001,
+2.266864e-001, 2.298217e-001, 2.329685e-001, 2.361216e-001, 2.392961e-001, 2.424752e-001, 2.456675e-001, 2.488581e-001, 2.520465e-001, 2.552389e-001,
+2.584339e-001, 2.616393e-001, 2.648471e-001, 2.680525e-001, 2.712588e-001, 2.744692e-001, 2.776810e-001, 2.808963e-001, 2.841088e-001, 2.873169e-001,
+2.905253e-001, 2.937339e-001, 2.969322e-001, 3.001226e-001, 3.033183e-001, 3.065171e-001, 3.097181e-001, 3.129202e-001, 3.161265e-001, 3.193351e-001,
+3.225524e-001, 3.257744e-001, 3.289855e-001, 3.321901e-001, 3.353937e-001, 3.385963e-001, 3.417963e-001, 3.449936e-001, 3.481870e-001, 3.513747e-001,
+3.545600e-001, 3.577390e-001, 3.609148e-001, 3.640692e-001, 3.672236e-001, 3.703645e-001, 3.735049e-001, 3.766364e-001, 3.797653e-001, 3.828807e-001,
+3.859855e-001, 3.890850e-001, 3.921729e-001, 3.952594e-001, 3.983199e-001, 4.013804e-001, 4.044235e-001, 4.074613e-001, 4.104873e-001, 4.134993e-001,
+4.165073e-001, 4.194851e-001, 4.224628e-001, 4.254232e-001, 4.283778e-001, 4.313284e-001, 4.342722e-001, 4.372159e-001, 4.401437e-001, 4.430706e-001,
+4.459845e-001, 4.488859e-001, 4.517868e-001, 4.546741e-001, 4.575615e-001, 4.604416e-001, 4.633157e-001, 4.661892e-001, 4.690420e-001, 4.718948e-001,
+4.747399e-001, 4.775765e-001, 4.804131e-001, 4.832343e-001, 4.860538e-001, 4.888609e-001, 4.916390e-001, 4.944170e-001, 4.971829e-001, 4.999426e-001,
+5.027022e-001, 5.054432e-001, 5.081842e-001, 5.109151e-001, 5.136245e-001, 5.163338e-001, 5.190214e-001, 5.216943e-001, 5.243672e-001, 5.270034e-001,
+5.296330e-001, 5.322594e-001, 5.348445e-001, 5.374296e-001, 5.399996e-001, 5.425275e-001, 5.450554e-001, 5.475719e-001, 5.500730e-001, 5.525741e-001,
+5.550535e-001, 5.575155e-001, 5.599775e-001, 5.624241e-001, 5.648627e-001, 5.673013e-001, 5.697148e-001, 5.721187e-001, 5.745226e-001, 5.768791e-001,
+5.792205e-001, 5.815620e-001, 5.838884e-001, 5.862101e-001, 5.885318e-001, 5.908361e-001, 5.931340e-001, 5.954320e-001, 5.977076e-001, 5.999724e-001,
+6.022373e-001, 6.044870e-001, 6.067258e-001, 6.089646e-001, 6.111889e-001, 6.133956e-001, 6.156023e-001, 6.177954e-001, 6.199552e-001, 6.221150e-001,
+6.242699e-001, 6.263784e-001, 6.284868e-001, 6.305952e-001, 6.326768e-001, 6.347541e-001, 6.368314e-001, 6.388926e-001, 6.409429e-001, 6.429932e-001,
+6.450357e-001, 6.470594e-001, 6.490831e-001, 6.511069e-001, 6.531022e-001, 6.550962e-001, 6.570903e-001, 6.590561e-001, 6.610018e-001, 6.629475e-001,
+6.648829e-001, 6.667698e-001, 6.686566e-001, 6.705435e-001, 6.724057e-001, 6.742588e-001, 6.761118e-001, 6.779593e-001, 6.797895e-001, 6.816197e-001,
+6.834500e-001, 6.852661e-001, 6.870769e-001, 6.888877e-001, 6.906918e-001, 6.924620e-001, 6.942321e-001, 6.960023e-001, 6.977445e-001, 6.994650e-001,
+7.011855e-001, 7.029060e-001, 7.046008e-001, 7.062937e-001, 7.079865e-001, 7.096688e-001, 7.113192e-001, 7.129697e-001, 7.146201e-001, 7.162568e-001,
+7.178814e-001, 7.195060e-001, 7.211306e-001, 7.227484e-001, 7.243643e-001, 7.259801e-001, 7.275959e-001, 7.291962e-001, 7.307961e-001, 7.323961e-001,
+7.339911e-001, 7.355559e-001, 7.371207e-001, 7.386855e-001, 7.402415e-001, 7.417722e-001, 7.433029e-001, 7.448336e-001, 7.463522e-001, 7.478467e-001,
+7.493411e-001, 7.508356e-001, 7.523164e-001, 7.537738e-001, 7.552313e-001, 7.566887e-001, 7.581345e-001, 7.595599e-001, 7.609852e-001, 7.624105e-001,
+7.638270e-001, 7.652239e-001, 7.666209e-001, 7.680178e-001, 7.694097e-001, 7.707833e-001, 7.721569e-001, 7.735305e-001, 7.749016e-001, 7.762401e-001,
+7.775787e-001, 7.789173e-001, 7.802559e-001, 7.815646e-001, 7.828696e-001, 7.841745e-001, 7.854795e-001, 7.867678e-001, 7.880475e-001, 7.893271e-001,
+7.906068e-001, 7.918794e-001, 7.931404e-001, 7.944014e-001, 7.956624e-001, 7.969212e-001, 7.981447e-001, 7.993682e-001, 8.005917e-001, 8.018152e-001,
+8.030144e-001, 8.042025e-001, 8.053906e-001, 8.065787e-001, 8.077602e-001, 8.089238e-001, 8.100874e-001, 8.112510e-001, 8.124147e-001, 8.135333e-001,
+8.146412e-001, 8.157490e-001, 8.168568e-001, 8.179542e-001, 8.190262e-001, 8.200982e-001, 8.211702e-001, 8.222423e-001, 8.232968e-001, 8.243449e-001,
+8.253930e-001, 8.264411e-001, 8.274879e-001, 8.285259e-001, 8.295638e-001, 8.306018e-001, 8.316397e-001, 8.326592e-001, 8.336567e-001, 8.346542e-001,
+8.356517e-001, 8.366492e-001, 8.376236e-001, 8.385900e-001, 8.395563e-001, 8.405227e-001, 8.414891e-001, 8.424319e-001, 8.433743e-001, 8.443166e-001,
+8.452589e-001, 8.461969e-001, 8.471128e-001, 8.480286e-001, 8.489445e-001, 8.498603e-001, 8.507688e-001, 8.516599e-001, 8.525511e-001, 8.534422e-001,
+8.543333e-001, 8.552089e-001, 8.560589e-001, 8.569089e-001, 8.577589e-001, 8.586089e-001, 8.594486e-001, 8.602731e-001, 8.610976e-001, 8.619221e-001,
+8.627466e-001, 8.635641e-001, 8.643702e-001, 8.651763e-001, 8.659824e-001, 8.667885e-001, 8.675866e-001, 8.683659e-001, 8.691452e-001, 8.699245e-001,
+8.707038e-001, 8.714814e-001, 8.722500e-001, 8.730186e-001, 8.737872e-001, 8.745558e-001, 8.753244e-001, 8.760708e-001, 8.768165e-001, 8.775621e-001,
+8.783078e-001, 8.790534e-001, 8.797796e-001, 8.804981e-001, 8.812165e-001, 8.819350e-001, 8.826535e-001, 8.833674e-001, 8.840746e-001, 8.847819e-001,
+8.854891e-001, 8.861964e-001, 8.869027e-001, 8.875903e-001, 8.882780e-001, 8.889656e-001, 8.896532e-001, 8.903409e-001, 8.910048e-001, 8.916544e-001,
+8.923041e-001, 8.929538e-001, 8.936034e-001, 8.942502e-001, 8.948796e-001, 8.955091e-001, 8.961385e-001, 8.967680e-001, 8.973974e-001, 8.980208e-001,
+8.986401e-001, 8.992594e-001, 8.998787e-001, 9.004980e-001, 9.011172e-001, 9.017203e-001, 9.023235e-001, 9.029266e-001, 9.035297e-001, 9.041329e-001,
+9.047262e-001, 9.053007e-001, 9.058751e-001, 9.064496e-001, 9.070241e-001, 9.075986e-001, 9.081653e-001, 9.087274e-001, 9.092894e-001, 9.098514e-001,
+9.104134e-001, 9.109754e-001, 9.115230e-001, 9.120679e-001, 9.126128e-001, 9.131576e-001, 9.137025e-001, 9.142474e-001, 9.147705e-001, 9.152935e-001,
+9.158165e-001, 9.163394e-001, 9.168624e-001, 9.173836e-001, 9.178846e-001, 9.183856e-001, 9.188866e-001, 9.193876e-001, 9.198886e-001, 9.203869e-001,
+9.208634e-001, 9.213399e-001, 9.218164e-001, 9.222929e-001, 9.227694e-001, 9.232440e-001, 9.236922e-001, 9.241404e-001, 9.245886e-001, 9.250368e-001,
+9.254850e-001, 9.259333e-001, 9.263677e-001, 9.268017e-001, 9.272356e-001, 9.276696e-001, 9.281035e-001, 9.285375e-001, 9.289492e-001, 9.293551e-001,
+9.297610e-001, 9.301669e-001, 9.305728e-001, 9.309787e-001, 9.313749e-001, 9.317634e-001, 9.321519e-001, 9.325405e-001, 9.329290e-001, 9.333175e-001,
+9.337004e-001, 9.340665e-001, 9.344326e-001, 9.347986e-001, 9.351647e-001, 9.355308e-001, 9.358969e-001, 9.362516e-001, 9.366048e-001, 9.369579e-001,
+9.373110e-001, 9.376642e-001, 9.380173e-001, 9.383694e-001, 9.387202e-001, 9.390709e-001, 9.394217e-001, 9.397724e-001, 9.401232e-001, 9.404739e-001,
+9.408151e-001, 9.411554e-001, 9.414957e-001, 9.418360e-001, 9.421764e-001, 9.425167e-001, 9.428497e-001, 9.431682e-001, 9.434867e-001, 9.438052e-001,
+9.441237e-001, 9.444423e-001, 9.447608e-001, 9.450663e-001, 9.453658e-001, 9.456653e-001, 9.459647e-001, 9.462642e-001, 9.465637e-001, 9.468632e-001,
+9.471693e-001, 9.474758e-001, 9.477823e-001, 9.480888e-001, 9.483953e-001, 9.487018e-001, 9.490080e-001, 9.493122e-001, 9.496164e-001, 9.499207e-001,
+9.502249e-001, 9.505292e-001, 9.508334e-001, 9.511339e-001, 9.514248e-001, 9.517157e-001, 9.520066e-001, 9.522975e-001, 9.525885e-001, 9.528794e-001,
+9.531695e-001, 9.534580e-001, 9.537466e-001, 9.540351e-001, 9.543237e-001, 9.546122e-001, 9.549007e-001, 9.551869e-001, 9.554678e-001, 9.557487e-001,
+9.560296e-001, 9.563105e-001, 9.565914e-001, 9.568723e-001, 9.571503e-001, 9.574174e-001, 9.576845e-001, 9.579516e-001, 9.582187e-001, 9.584858e-001,
+9.587530e-001, 9.590197e-001, 9.592756e-001, 9.595315e-001, 9.597874e-001, 9.600433e-001, 9.602992e-001, 9.605551e-001, 9.608110e-001, 9.610598e-001,
+9.613066e-001, 9.615534e-001, 9.618002e-001, 9.620471e-001, 9.622939e-001, 9.625407e-001, 9.627808e-001, 9.630127e-001, 9.632447e-001, 9.634766e-001,
+9.637085e-001, 9.639404e-001, 9.641724e-001, 9.644043e-001, 9.646360e-001, 9.648677e-001, 9.650995e-001, 9.653312e-001, 9.655629e-001, 9.657947e-001,
+9.660264e-001, 9.662543e-001, 9.664790e-001, 9.667037e-001, 9.669284e-001, 9.671531e-001, 9.673778e-001, 9.676026e-001, 9.678273e-001, 9.680370e-001,
+9.682463e-001, 9.684555e-001, 9.686648e-001, 9.688741e-001, 9.690833e-001, 9.692926e-001, 9.694946e-001, 9.696804e-001, 9.698663e-001, 9.700521e-001,
+9.702380e-001, 9.704238e-001, 9.706097e-001, 9.707956e-001, 9.709765e-001, 9.711538e-001, 9.713311e-001, 9.715084e-001, 9.716858e-001, 9.718631e-001,
+9.720404e-001, 9.722177e-001, 9.723868e-001, 9.725532e-001, 9.727196e-001, 9.728860e-001, 9.730524e-001, 9.732188e-001, 9.733852e-001, 9.735516e-001,
+9.737042e-001, 9.738543e-001, 9.740043e-001, 9.741543e-001, 9.743043e-001, 9.744543e-001, 9.746043e-001, 9.747543e-001, 9.748876e-001, 9.750179e-001,
+9.751481e-001, 9.752784e-001, 9.754087e-001, 9.755390e-001, 9.756692e-001, 9.757995e-001, 9.759184e-001, 9.760339e-001, 9.761494e-001, 9.762649e-001,
+9.763804e-001, 9.764959e-001, 9.766114e-001, 9.767269e-001, 9.768431e-001, 9.769597e-001, 9.770764e-001, 9.771930e-001, 9.773096e-001, 9.774263e-001,
+9.775429e-001, 9.776595e-001, 9.777797e-001, 9.779066e-001, 9.780335e-001, 9.781604e-001, 9.782873e-001, 9.784142e-001, 9.785411e-001, 9.786680e-001,
+9.787948e-001, 9.789273e-001, 9.790598e-001, 9.791922e-001, 9.793247e-001, 9.794572e-001, 9.795896e-001, 9.797221e-001, 9.798546e-001, 9.799874e-001,
+9.801204e-001, 9.802534e-001, 9.803864e-001, 9.805194e-001, 9.806525e-001, 9.807855e-001, 9.809185e-001, 9.810514e-001, 9.811799e-001, 9.813084e-001,
+9.814370e-001, 9.815655e-001, 9.816941e-001, 9.818226e-001, 9.819512e-001, 9.820797e-001, 9.822043e-001, 9.823232e-001, 9.824422e-001, 9.825612e-001,
+9.826801e-001, 9.827991e-001, 9.829180e-001, 9.830370e-001, 9.831560e-001, 9.832715e-001, 9.833855e-001, 9.834995e-001, 9.836135e-001, 9.837275e-001,
+9.838415e-001, 9.839556e-001, 9.840696e-001, 9.841836e-001, 9.842915e-001, 9.843987e-001, 9.845059e-001, 9.846131e-001, 9.847203e-001, 9.848275e-001,
+9.849347e-001, 9.850419e-001, 9.851491e-001, 9.852462e-001, 9.853431e-001, 9.854400e-001, 9.855369e-001, 9.856338e-001, 9.857307e-001, 9.858275e-001,
+9.859244e-001, 9.860213e-001, 9.861149e-001, 9.862085e-001, 9.863021e-001, 9.863956e-001, 9.864892e-001, 9.865828e-001, 9.866763e-001, 9.867699e-001,
+9.868634e-001, 9.869537e-001, 9.870436e-001, 9.871335e-001, 9.872234e-001, 9.873133e-001, 9.874032e-001, 9.874931e-001, 9.875830e-001, 9.876729e-001,
+9.877598e-001, 9.878454e-001, 9.879310e-001, 9.880165e-001, 9.881021e-001, 9.881877e-001, 9.882733e-001, 9.883589e-001, 9.884445e-001, 9.885308e-001,
+9.886182e-001, 9.887056e-001, 9.887929e-001, 9.888803e-001, 9.889677e-001, 9.890551e-001, 9.891425e-001, 9.892299e-001, 9.893173e-001, 9.894028e-001,
+9.894883e-001, 9.895738e-001, 9.896594e-001, 9.897449e-001, 9.898304e-001, 9.899159e-001, 9.900015e-001, 9.900870e-001, 9.901696e-001, 9.902492e-001,
+9.903288e-001, 9.904084e-001, 9.904880e-001, 9.905676e-001, 9.906472e-001, 9.907268e-001, 9.908064e-001, 9.908860e-001, 9.909566e-001, 9.910261e-001,
+9.910956e-001, 9.911652e-001, 9.912347e-001, 9.913042e-001, 9.913738e-001, 9.914433e-001, 9.915128e-001, 9.915798e-001, 9.916355e-001, 9.916912e-001,
+9.917469e-001, 9.918026e-001, 9.918583e-001, 9.919140e-001, 9.919697e-001, 9.920254e-001, 9.920811e-001, 9.921348e-001, 9.921853e-001, 9.922358e-001,
+9.922863e-001, 9.923368e-001, 9.923873e-001, 9.924378e-001, 9.924883e-001, 9.925388e-001, 9.925893e-001, 9.926403e-001, 9.926918e-001, 9.927434e-001,
+9.927949e-001, 9.928464e-001, 9.928980e-001, 9.929495e-001, 9.930011e-001, 9.930526e-001, 9.931041e-001, 9.931588e-001, 9.932174e-001, 9.932761e-001,
+9.933348e-001, 9.933935e-001, 9.934521e-001, 9.935108e-001, 9.935695e-001, 9.936281e-001, 9.936868e-001, 9.937476e-001, 9.938133e-001, 9.938790e-001,
+9.939447e-001, 9.940104e-001, 9.940761e-001, 9.941418e-001, 9.942075e-001, 9.942732e-001, 9.943389e-001, 9.944049e-001, 9.944759e-001, 9.945470e-001,
+9.946180e-001, 9.946890e-001, 9.947600e-001, 9.948310e-001, 9.949021e-001, 9.949731e-001, 9.950441e-001, 9.951151e-001, 9.951883e-001, 9.952625e-001,
+9.953366e-001, 9.954108e-001, 9.954849e-001, 9.955591e-001, 9.956332e-001, 9.957074e-001, 9.957815e-001, 9.958557e-001, 9.959299e-001, 9.960047e-001,
+9.960794e-001, 9.961541e-001, 9.962289e-001, 9.963036e-001, 9.963783e-001, 9.964530e-001, 9.965278e-001, 9.966025e-001, 9.966772e-001, 9.967506e-001,
+9.968233e-001, 9.968960e-001, 9.969687e-001, 9.970413e-001, 9.971140e-001, 9.971867e-001, 9.972594e-001, 9.973321e-001, 9.974047e-001, 9.974774e-001,
+9.975459e-001, 9.976141e-001, 9.976823e-001, 9.977505e-001, 9.978188e-001, 9.978870e-001, 9.979552e-001, 9.980235e-001, 9.980917e-001, 9.981599e-001,
+9.982273e-001, 9.982891e-001, 9.983510e-001, 9.984129e-001, 9.984747e-001, 9.985366e-001, 9.985984e-001, 9.986603e-001, 9.987222e-001, 9.987840e-001,
+9.988459e-001, 9.989061e-001, 9.989602e-001, 9.990144e-001, 9.990685e-001, 9.991226e-001, 9.991768e-001, 9.992309e-001, 9.992850e-001, 9.993392e-001,
+9.993933e-001, 9.994474e-001, 9.995001e-001, 9.995455e-001, 9.995910e-001, 9.996364e-001, 9.996819e-001, 9.997273e-001, 9.997728e-001, 9.998182e-001,
+9.998637e-001, 9.999091e-001, 9.999546e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.937342e-004, 3.960232e-004, 6.110691e-004, 8.411508e-004, 1.086915e-003, 1.346612e-003, 1.619250e-003, 1.904812e-003, 2.203532e-003,
+2.518100e-003, 2.848711e-003, 3.195766e-003, 3.558253e-003, 3.934801e-003, 4.324570e-003, 4.730457e-003, 5.152758e-003, 5.593274e-003, 6.051202e-003,
+6.528231e-003, 7.024211e-003, 7.538694e-003, 8.072690e-003, 8.625895e-003, 9.197523e-003, 9.790075e-003, 1.039924e-002, 1.102721e-002, 1.167581e-002,
+1.234889e-002, 1.304745e-002, 1.377250e-002, 1.452422e-002, 1.530332e-002, 1.610618e-002, 1.692638e-002, 1.776203e-002, 1.861645e-002, 1.948963e-002,
+2.037955e-002, 2.129118e-002, 2.222459e-002, 2.318613e-002, 2.417584e-002, 2.519847e-002, 2.624667e-002, 2.732285e-002, 2.842048e-002, 2.954240e-002,
+3.068466e-002, 3.184569e-002, 3.302684e-002, 3.422245e-002, 3.543115e-002, 3.665707e-002, 3.790078e-002, 3.916498e-002, 4.045155e-002, 4.176145e-002,
+4.309668e-002, 4.445761e-002, 4.584590e-002, 4.726169e-002, 4.869942e-002, 5.015261e-002, 5.163192e-002, 5.313388e-002, 5.465857e-002, 5.620165e-002,
+5.776658e-002, 5.935591e-002, 6.096929e-002, 6.260694e-002, 6.427009e-002, 6.596063e-002, 6.767775e-002, 6.942183e-002, 7.118891e-002, 7.297505e-002,
+7.478650e-002, 7.662216e-002, 7.847737e-002, 8.035398e-002, 8.226196e-002, 8.420079e-002, 8.616607e-002, 8.815499e-002, 9.016175e-002, 9.218906e-002,
+9.424070e-002, 9.631575e-002, 9.841561e-002, 1.005404e-001, 1.026867e-001, 1.048532e-001, 1.070402e-001, 1.092483e-001, 1.114758e-001, 1.137153e-001,
+1.159679e-001, 1.182357e-001, 1.205221e-001, 1.228303e-001, 1.251549e-001, 1.274984e-001, 1.298630e-001, 1.322595e-001, 1.346741e-001, 1.371086e-001,
+1.395682e-001, 1.420474e-001, 1.445466e-001, 1.470647e-001, 1.496022e-001, 1.521558e-001, 1.547247e-001, 1.573172e-001, 1.599285e-001, 1.625496e-001,
+1.651808e-001, 1.678353e-001, 1.704952e-001, 1.731575e-001, 1.758298e-001, 1.785068e-001, 1.811907e-001, 1.838903e-001, 1.865974e-001, 1.893137e-001,
+1.920381e-001, 1.947683e-001, 1.975080e-001, 2.002497e-001, 2.029946e-001, 2.057336e-001, 2.084709e-001, 2.112186e-001, 2.139669e-001, 2.167158e-001,
+2.194724e-001, 2.222322e-001, 2.249838e-001, 2.277350e-001, 2.304856e-001, 2.332390e-001, 2.359952e-001, 2.387603e-001, 2.415284e-001, 2.442980e-001,
+2.470682e-001, 2.498412e-001, 2.526099e-001, 2.553699e-001, 2.581271e-001, 2.608813e-001, 2.636287e-001, 2.663718e-001, 2.691045e-001, 2.718334e-001,
+2.745407e-001, 2.772436e-001, 2.799426e-001, 2.826412e-001, 2.853289e-001, 2.880161e-001, 2.906906e-001, 2.933648e-001, 2.960148e-001, 2.986648e-001,
+3.013045e-001, 3.039440e-001, 3.065663e-001, 3.091877e-001, 3.117879e-001, 3.143858e-001, 3.169587e-001, 3.195260e-001, 3.220764e-001, 3.246203e-001,
+3.271426e-001, 3.296504e-001, 3.321474e-001, 3.346313e-001, 3.371110e-001, 3.395805e-001, 3.420476e-001, 3.444921e-001, 3.469367e-001, 3.493632e-001,
+3.517871e-001, 3.541991e-001, 3.566044e-001, 3.590024e-001, 3.613884e-001, 3.637714e-001, 3.661236e-001, 3.684759e-001, 3.708046e-001, 3.731264e-001,
+3.754420e-001, 3.777496e-001, 3.800561e-001, 3.823486e-001, 3.846412e-001, 3.869284e-001, 3.892132e-001, 3.914948e-001, 3.937678e-001, 3.960409e-001,
+3.983030e-001, 4.005627e-001, 4.028214e-001, 4.050782e-001, 4.073350e-001, 4.095784e-001, 4.118197e-001, 4.140588e-001, 4.162936e-001, 4.185284e-001,
+4.207590e-001, 4.229886e-001, 4.252168e-001, 4.274397e-001, 4.296626e-001, 4.318815e-001, 4.340976e-001, 4.363138e-001, 4.385362e-001, 4.407588e-001,
+4.429790e-001, 4.451939e-001, 4.474087e-001, 4.496184e-001, 4.518249e-001, 4.540314e-001, 4.562327e-001, 4.584334e-001, 4.606318e-001, 4.628175e-001,
+4.650033e-001, 4.671837e-001, 4.693552e-001, 4.715267e-001, 4.736973e-001, 4.758674e-001, 4.780374e-001, 4.801995e-001, 4.823586e-001, 4.845177e-001,
+4.866720e-001, 4.888255e-001, 4.909789e-001, 4.931291e-001, 4.952791e-001, 4.974289e-001, 4.995673e-001, 5.017058e-001, 5.038431e-001, 5.059599e-001,
+5.080766e-001, 5.101923e-001, 5.122897e-001, 5.143871e-001, 5.164838e-001, 5.185532e-001, 5.206226e-001, 5.226920e-001, 5.247408e-001, 5.267890e-001,
+5.288371e-001, 5.308630e-001, 5.328855e-001, 5.349080e-001, 5.369162e-001, 5.389194e-001, 5.409225e-001, 5.429117e-001, 5.448905e-001, 5.468693e-001,
+5.488427e-001, 5.508072e-001, 5.527717e-001, 5.547340e-001, 5.566832e-001, 5.586324e-001, 5.605816e-001, 5.625146e-001, 5.644454e-001, 5.663762e-001,
+5.682946e-001, 5.702040e-001, 5.721133e-001, 5.740167e-001, 5.759012e-001, 5.777856e-001, 5.796701e-001, 5.815389e-001, 5.834053e-001, 5.852718e-001,
+5.871320e-001, 5.889848e-001, 5.908376e-001, 5.926902e-001, 5.945152e-001, 5.963402e-001, 5.981652e-001, 5.999824e-001, 6.017926e-001, 6.036027e-001,
+6.054128e-001, 6.072115e-001, 6.090102e-001, 6.108089e-001, 6.126013e-001, 6.143857e-001, 6.161700e-001, 6.179544e-001, 6.197059e-001, 6.214510e-001,
+6.231962e-001, 6.249344e-001, 6.266447e-001, 6.283550e-001, 6.300653e-001, 6.317604e-001, 6.334416e-001, 6.351227e-001, 6.368038e-001, 6.384651e-001,
+6.401216e-001, 6.417780e-001, 6.434330e-001, 6.450562e-001, 6.466793e-001, 6.483024e-001, 6.499151e-001, 6.514954e-001, 6.530758e-001, 6.546561e-001,
+6.562228e-001, 6.577694e-001, 6.593159e-001, 6.608624e-001, 6.623889e-001, 6.638968e-001, 6.654047e-001, 6.669126e-001, 6.683938e-001, 6.698569e-001,
+6.713200e-001, 6.727831e-001, 6.742259e-001, 6.756565e-001, 6.770872e-001, 6.785178e-001, 6.799272e-001, 6.813234e-001, 6.827196e-001, 6.841157e-001,
+6.854911e-001, 6.868504e-001, 6.882098e-001, 6.895691e-001, 6.909182e-001, 6.922556e-001, 6.935930e-001, 6.949304e-001, 6.962568e-001, 6.975602e-001,
+6.988637e-001, 7.001671e-001, 7.014655e-001, 7.027324e-001, 7.039992e-001, 7.052660e-001, 7.065328e-001, 7.077703e-001, 7.090048e-001, 7.102393e-001,
+7.114737e-001, 7.126893e-001, 7.138936e-001, 7.150978e-001, 7.163021e-001, 7.175000e-001, 7.186828e-001, 7.198657e-001, 7.210486e-001, 7.222315e-001,
+7.233735e-001, 7.245126e-001, 7.256517e-001, 7.267907e-001, 7.279145e-001, 7.290236e-001, 7.301327e-001, 7.312418e-001, 7.323492e-001, 7.334214e-001,
+7.344937e-001, 7.355659e-001, 7.366381e-001, 7.376983e-001, 7.387477e-001, 7.397971e-001, 7.408466e-001, 7.418960e-001, 7.429301e-001, 7.439636e-001,
+7.449972e-001, 7.460307e-001, 7.470514e-001, 7.480485e-001, 7.490455e-001, 7.500426e-001, 7.510396e-001, 7.520161e-001, 7.529834e-001, 7.539507e-001,
+7.549180e-001, 7.558852e-001, 7.568265e-001, 7.577672e-001, 7.587078e-001, 7.596484e-001, 7.605821e-001, 7.614898e-001, 7.623975e-001, 7.633051e-001,
+7.642128e-001, 7.651120e-001, 7.659983e-001, 7.668846e-001, 7.677709e-001, 7.686572e-001, 7.695333e-001, 7.704000e-001, 7.712668e-001, 7.721336e-001,
+7.730003e-001, 7.738538e-001, 7.746984e-001, 7.755430e-001, 7.763876e-001, 7.772322e-001, 7.780703e-001, 7.789046e-001, 7.797389e-001, 7.805732e-001,
+7.814075e-001, 7.822363e-001, 7.830613e-001, 7.838864e-001, 7.847114e-001, 7.855364e-001, 7.863515e-001, 7.871573e-001, 7.879630e-001, 7.887688e-001,
+7.895745e-001, 7.903773e-001, 7.911752e-001, 7.919730e-001, 7.927709e-001, 7.935688e-001, 7.943631e-001, 7.951408e-001, 7.959186e-001, 7.966964e-001,
+7.974742e-001, 7.982520e-001, 7.990128e-001, 7.997723e-001, 8.005318e-001, 8.012913e-001, 8.020508e-001, 8.027990e-001, 8.035404e-001, 8.042817e-001,
+8.050230e-001, 8.057644e-001, 8.065026e-001, 8.072319e-001, 8.079612e-001, 8.086905e-001, 8.094198e-001, 8.101491e-001, 8.108693e-001, 8.115876e-001,
+8.123059e-001, 8.130242e-001, 8.137425e-001, 8.144533e-001, 8.151501e-001, 8.158469e-001, 8.165438e-001, 8.172406e-001, 8.179374e-001, 8.186288e-001,
+8.193189e-001, 8.200090e-001, 8.206990e-001, 8.213891e-001, 8.220767e-001, 8.227545e-001, 8.234324e-001, 8.241102e-001, 8.247881e-001, 8.254659e-001,
+8.261310e-001, 8.267852e-001, 8.274394e-001, 8.280936e-001, 8.287478e-001, 8.294020e-001, 8.300411e-001, 8.306768e-001, 8.313125e-001, 8.319483e-001,
+8.325840e-001, 8.332192e-001, 8.338393e-001, 8.344593e-001, 8.350793e-001, 8.356994e-001, 8.363194e-001, 8.369359e-001, 8.375367e-001, 8.381375e-001,
+8.387383e-001, 8.393391e-001, 8.399399e-001, 8.405391e-001, 8.411339e-001, 8.417287e-001, 8.423236e-001, 8.429184e-001, 8.435133e-001, 8.441043e-001,
+8.446862e-001, 8.452680e-001, 8.458499e-001, 8.464318e-001, 8.470137e-001, 8.475909e-001, 8.481546e-001, 8.487183e-001, 8.492819e-001, 8.498456e-001,
+8.504093e-001, 8.509713e-001, 8.515233e-001, 8.520753e-001, 8.526273e-001, 8.531793e-001, 8.537313e-001, 8.542833e-001, 8.548195e-001, 8.553553e-001,
+8.558911e-001, 8.564268e-001, 8.569626e-001, 8.574984e-001, 8.580274e-001, 8.585539e-001, 8.590805e-001, 8.596070e-001, 8.601335e-001, 8.606601e-001,
+8.611857e-001, 8.617103e-001, 8.622348e-001, 8.627593e-001, 8.632838e-001, 8.638083e-001, 8.643323e-001, 8.648459e-001, 8.653595e-001, 8.658731e-001,
+8.663867e-001, 8.669003e-001, 8.674139e-001, 8.679203e-001, 8.684220e-001, 8.689238e-001, 8.694255e-001, 8.699272e-001, 8.704290e-001, 8.709302e-001,
+8.714262e-001, 8.719221e-001, 8.724181e-001, 8.729141e-001, 8.734100e-001, 8.739060e-001, 8.744006e-001, 8.748937e-001, 8.753869e-001, 8.758801e-001,
+8.763733e-001, 8.768664e-001, 8.773596e-001, 8.778408e-001, 8.783198e-001, 8.787988e-001, 8.792778e-001, 8.797568e-001, 8.802357e-001, 8.807138e-001,
+8.811848e-001, 8.816557e-001, 8.821267e-001, 8.825977e-001, 8.830686e-001, 8.835396e-001, 8.840103e-001, 8.844806e-001, 8.849508e-001, 8.854211e-001,
+8.858913e-001, 8.863616e-001, 8.868318e-001, 8.872955e-001, 8.877508e-001, 8.882061e-001, 8.886614e-001, 8.891167e-001, 8.895720e-001, 8.900273e-001,
+8.904743e-001, 8.909125e-001, 8.913507e-001, 8.917889e-001, 8.922271e-001, 8.926653e-001, 8.931035e-001, 8.935418e-001, 8.939803e-001, 8.944188e-001,
+8.948573e-001, 8.952959e-001, 8.957344e-001, 8.961729e-001, 8.966065e-001, 8.970314e-001, 8.974563e-001, 8.978813e-001, 8.983062e-001, 8.987311e-001,
+8.991560e-001, 8.995798e-001, 8.999985e-001, 9.004172e-001, 9.008360e-001, 9.012547e-001, 9.016734e-001, 9.020922e-001, 9.025109e-001, 9.029234e-001,
+9.033355e-001, 9.037475e-001, 9.041596e-001, 9.045716e-001, 9.049836e-001, 9.053957e-001, 9.057967e-001, 9.061899e-001, 9.065831e-001, 9.069763e-001,
+9.073695e-001, 9.077627e-001, 9.081559e-001, 9.085468e-001, 9.089267e-001, 9.093065e-001, 9.096864e-001, 9.100662e-001, 9.104460e-001, 9.108259e-001,
+9.112057e-001, 9.115758e-001, 9.119413e-001, 9.123068e-001, 9.126722e-001, 9.130377e-001, 9.134031e-001, 9.137686e-001, 9.141318e-001, 9.144750e-001,
+9.148182e-001, 9.151615e-001, 9.155047e-001, 9.158479e-001, 9.161911e-001, 9.165343e-001, 9.168791e-001, 9.172259e-001, 9.175728e-001, 9.179196e-001,
+9.182664e-001, 9.186133e-001, 9.189601e-001, 9.193069e-001, 9.196500e-001, 9.199914e-001, 9.203328e-001, 9.206743e-001, 9.210157e-001, 9.213571e-001,
+9.216986e-001, 9.220400e-001, 9.223677e-001, 9.226933e-001, 9.230189e-001, 9.233446e-001, 9.236702e-001, 9.239959e-001, 9.243215e-001, 9.246471e-001,
+9.249748e-001, 9.253026e-001, 9.256304e-001, 9.259581e-001, 9.262859e-001, 9.266137e-001, 9.269414e-001, 9.272692e-001, 9.276003e-001, 9.279316e-001,
+9.282628e-001, 9.285941e-001, 9.289253e-001, 9.292566e-001, 9.295879e-001, 9.299191e-001, 9.302432e-001, 9.305663e-001, 9.308895e-001, 9.312126e-001,
+9.315357e-001, 9.318588e-001, 9.321819e-001, 9.325050e-001, 9.328216e-001, 9.331354e-001, 9.334493e-001, 9.337631e-001, 9.340769e-001, 9.343908e-001,
+9.347046e-001, 9.350185e-001, 9.353330e-001, 9.356484e-001, 9.359638e-001, 9.362791e-001, 9.365945e-001, 9.369099e-001, 9.372253e-001, 9.375407e-001,
+9.378562e-001, 9.381729e-001, 9.384895e-001, 9.388062e-001, 9.391229e-001, 9.394395e-001, 9.397562e-001, 9.400728e-001, 9.403895e-001, 9.406993e-001,
+9.410055e-001, 9.413117e-001, 9.416180e-001, 9.419242e-001, 9.422304e-001, 9.425367e-001, 9.428429e-001, 9.431487e-001, 9.434513e-001, 9.437539e-001,
+9.440566e-001, 9.443592e-001, 9.446619e-001, 9.449645e-001, 9.452671e-001, 9.455698e-001, 9.458691e-001, 9.461651e-001, 9.464610e-001, 9.467570e-001,
+9.470530e-001, 9.473490e-001, 9.476450e-001, 9.479410e-001, 9.482370e-001, 9.485341e-001, 9.488316e-001, 9.491291e-001, 9.494265e-001, 9.497240e-001,
+9.500214e-001, 9.503189e-001, 9.506164e-001, 9.509138e-001, 9.512111e-001, 9.515084e-001, 9.518057e-001, 9.521030e-001, 9.524002e-001, 9.526975e-001,
+9.529948e-001, 9.532921e-001, 9.535887e-001, 9.538760e-001, 9.541633e-001, 9.544506e-001, 9.547379e-001, 9.550252e-001, 9.553124e-001, 9.555997e-001,
+9.558870e-001, 9.561737e-001, 9.564520e-001, 9.567303e-001, 9.570086e-001, 9.572868e-001, 9.575651e-001, 9.578434e-001, 9.581217e-001, 9.583999e-001,
+9.586782e-001, 9.589494e-001, 9.592203e-001, 9.594913e-001, 9.597622e-001, 9.600331e-001, 9.603040e-001, 9.605749e-001, 9.608459e-001, 9.611168e-001,
+9.613807e-001, 9.616423e-001, 9.619040e-001, 9.621657e-001, 9.624274e-001, 9.626890e-001, 9.629507e-001, 9.632124e-001, 9.634740e-001, 9.637350e-001,
+9.639952e-001, 9.642553e-001, 9.645155e-001, 9.647756e-001, 9.650357e-001, 9.652959e-001, 9.655560e-001, 9.658162e-001, 9.660759e-001, 9.663285e-001,
+9.665812e-001, 9.668338e-001, 9.670865e-001, 9.673391e-001, 9.675918e-001, 9.678444e-001, 9.680970e-001, 9.683497e-001, 9.685934e-001, 9.688299e-001,
+9.690665e-001, 9.693030e-001, 9.695396e-001, 9.697762e-001, 9.700127e-001, 9.702493e-001, 9.704858e-001, 9.707224e-001, 9.709470e-001, 9.711709e-001,
+9.713949e-001, 9.716189e-001, 9.718428e-001, 9.720668e-001, 9.722908e-001, 9.725147e-001, 9.727387e-001, 9.729639e-001, 9.731929e-001, 9.734220e-001,
+9.736511e-001, 9.738801e-001, 9.741092e-001, 9.743382e-001, 9.745673e-001, 9.747963e-001, 9.750254e-001, 9.752536e-001, 9.754808e-001, 9.757079e-001,
+9.759351e-001, 9.761622e-001, 9.763893e-001, 9.766165e-001, 9.768436e-001, 9.770708e-001, 9.772979e-001, 9.775206e-001, 9.777389e-001, 9.779572e-001,
+9.781755e-001, 9.783938e-001, 9.786121e-001, 9.788304e-001, 9.790487e-001, 9.792670e-001, 9.794852e-001, 9.797026e-001, 9.799190e-001, 9.801353e-001,
+9.803516e-001, 9.805680e-001, 9.807843e-001, 9.810007e-001, 9.812170e-001, 9.814333e-001, 9.816497e-001, 9.818659e-001, 9.820818e-001, 9.822978e-001,
+9.825137e-001, 9.827297e-001, 9.829456e-001, 9.831615e-001, 9.833775e-001, 9.835934e-001, 9.838094e-001, 9.840244e-001, 9.842302e-001, 9.844359e-001,
+9.846417e-001, 9.848475e-001, 9.850532e-001, 9.852590e-001, 9.854648e-001, 9.856705e-001, 9.858763e-001, 9.860820e-001, 9.862826e-001, 9.864812e-001,
+9.866798e-001, 9.868784e-001, 9.870770e-001, 9.872756e-001, 9.874743e-001, 9.876729e-001, 9.878715e-001, 9.880701e-001, 9.882663e-001, 9.884555e-001,
+9.886448e-001, 9.888340e-001, 9.890233e-001, 9.892125e-001, 9.894018e-001, 9.895910e-001, 9.897803e-001, 9.899695e-001, 9.901588e-001, 9.903477e-001,
+9.905365e-001, 9.907253e-001, 9.909141e-001, 9.911028e-001, 9.912916e-001, 9.914804e-001, 9.916692e-001, 9.918579e-001, 9.920467e-001, 9.922355e-001,
+9.924197e-001, 9.926037e-001, 9.927877e-001, 9.929718e-001, 9.931558e-001, 9.933398e-001, 9.935239e-001, 9.937079e-001, 9.938919e-001, 9.940760e-001,
+9.942586e-001, 9.944334e-001, 9.946082e-001, 9.947831e-001, 9.949579e-001, 9.951328e-001, 9.953076e-001, 9.954825e-001, 9.956573e-001, 9.958321e-001,
+9.960070e-001, 9.961811e-001, 9.963525e-001, 9.965239e-001, 9.966953e-001, 9.968667e-001, 9.970382e-001, 9.972096e-001, 9.973810e-001, 9.975524e-001,
+9.977238e-001, 9.978952e-001, 9.980674e-001, 9.982431e-001, 9.984188e-001, 9.985945e-001, 9.987702e-001, 9.989459e-001, 9.991215e-001, 9.992972e-001,
+9.994729e-001, 9.996486e-001, 9.998243e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 320T", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.252978e-004, 4.642465e-004, 7.179323e-004, 9.859804e-004, 1.267872e-003, 1.558840e-003, 1.863033e-003, 2.181988e-003, 2.515589e-003,
+2.859925e-003, 3.215065e-003, 3.584873e-003, 3.970500e-003, 4.373388e-003, 4.788762e-003, 5.214542e-003, 5.650067e-003, 6.100727e-003, 6.569176e-003,
+7.061060e-003, 7.569897e-003, 8.094173e-003, 8.627419e-003, 9.179829e-003, 9.745812e-003, 1.032715e-002, 1.092486e-002, 1.154058e-002, 1.217612e-002,
+1.282704e-002, 1.349872e-002, 1.419423e-002, 1.490994e-002, 1.564644e-002, 1.640255e-002, 1.717758e-002, 1.797363e-002, 1.879041e-002, 1.963292e-002,
+2.050267e-002, 2.139676e-002, 2.231947e-002, 2.326507e-002, 2.423432e-002, 2.523318e-002, 2.624775e-002, 2.728295e-002, 2.833901e-002, 2.941617e-002,
+3.052106e-002, 3.165508e-002, 3.281921e-002, 3.400857e-002, 3.522224e-002, 3.646553e-002, 3.774362e-002, 3.905679e-002, 4.040022e-002, 4.177383e-002,
+4.317322e-002, 4.459036e-002, 4.602468e-002, 4.748313e-002, 4.897094e-002, 5.048628e-002, 5.202578e-002, 5.358824e-002, 5.517593e-002, 5.679481e-002,
+5.844240e-002, 6.011752e-002, 6.182187e-002, 6.356163e-002, 6.533828e-002, 6.714293e-002, 6.896804e-002, 7.080938e-002, 7.267100e-002, 7.455756e-002,
+7.647117e-002, 7.841093e-002, 8.037713e-002, 8.237377e-002, 8.440594e-002, 8.647712e-002, 8.858186e-002, 9.071456e-002, 9.287730e-002, 9.507410e-002,
+9.730750e-002, 9.957692e-002, 1.018781e-001, 1.042044e-001, 1.065539e-001, 1.089283e-001, 1.113215e-001, 1.137316e-001, 1.161574e-001, 1.185980e-001,
+1.210615e-001, 1.235487e-001, 1.260568e-001, 1.285868e-001, 1.311426e-001, 1.337202e-001, 1.363097e-001, 1.389120e-001, 1.415282e-001, 1.441826e-001,
+1.468576e-001, 1.495532e-001, 1.522719e-001, 1.550172e-001, 1.577735e-001, 1.605415e-001, 1.633354e-001, 1.661441e-001, 1.689610e-001, 1.717839e-001,
+1.746120e-001, 1.774457e-001, 1.802876e-001, 1.831532e-001, 1.860265e-001, 1.889073e-001, 1.918104e-001, 1.947200e-001, 1.976353e-001, 2.005549e-001,
+2.034774e-001, 2.064063e-001, 2.093464e-001, 2.122936e-001, 2.152556e-001, 2.182167e-001, 2.211763e-001, 2.241538e-001, 2.271366e-001, 2.301204e-001,
+2.331143e-001, 2.361202e-001, 2.391359e-001, 2.421552e-001, 2.451844e-001, 2.482129e-001, 2.512401e-001, 2.542673e-001, 2.572944e-001, 2.603251e-001,
+2.633564e-001, 2.663846e-001, 2.694126e-001, 2.724404e-001, 2.754599e-001, 2.784682e-001, 2.814693e-001, 2.844651e-001, 2.874703e-001, 2.904791e-001,
+2.934839e-001, 2.964879e-001, 2.994953e-001, 3.025027e-001, 3.054914e-001, 3.084802e-001, 3.114694e-001, 3.144572e-001, 3.174341e-001, 3.204114e-001,
+3.233911e-001, 3.263702e-001, 3.293449e-001, 3.323191e-001, 3.352886e-001, 3.382575e-001, 3.412112e-001, 3.441649e-001, 3.471064e-001, 3.500476e-001,
+3.529730e-001, 3.558961e-001, 3.588060e-001, 3.617117e-001, 3.645961e-001, 3.674674e-001, 3.703210e-001, 3.731534e-001, 3.759778e-001, 3.787800e-001,
+3.815816e-001, 3.843732e-001, 3.871648e-001, 3.899507e-001, 3.927354e-001, 3.955127e-001, 3.982843e-001, 4.010469e-001, 4.037859e-001, 4.065250e-001,
+4.092408e-001, 4.119558e-001, 4.146685e-001, 4.173799e-001, 4.200862e-001, 4.227793e-001, 4.254723e-001, 4.281426e-001, 4.308102e-001, 4.334703e-001,
+4.361222e-001, 4.387736e-001, 4.414155e-001, 4.440574e-001, 4.466897e-001, 4.493152e-001, 4.519402e-001, 4.545604e-001, 4.571806e-001, 4.597934e-001,
+4.624008e-001, 4.650070e-001, 4.675797e-001, 4.701523e-001, 4.727116e-001, 4.752551e-001, 4.777986e-001, 4.803014e-001, 4.827977e-001, 4.852870e-001,
+4.877533e-001, 4.902195e-001, 4.926729e-001, 4.951169e-001, 4.975609e-001, 4.999994e-001, 5.024373e-001, 5.048713e-001, 5.072881e-001, 5.097049e-001,
+5.121038e-001, 5.144798e-001, 5.168557e-001, 5.192153e-001, 5.215666e-001, 5.239178e-001, 5.262326e-001, 5.285415e-001, 5.308492e-001, 5.331151e-001,
+5.353810e-001, 5.376407e-001, 5.398690e-001, 5.420973e-001, 5.443141e-001, 5.464997e-001, 5.486852e-001, 5.508529e-001, 5.529861e-001, 5.551192e-001,
+5.572411e-001, 5.593449e-001, 5.614486e-001, 5.635407e-001, 5.656147e-001, 5.676888e-001, 5.697505e-001, 5.717914e-001, 5.738322e-001, 5.758669e-001,
+5.778882e-001, 5.799094e-001, 5.819228e-001, 5.839093e-001, 5.858957e-001, 5.878792e-001, 5.898366e-001, 5.917940e-001, 5.937514e-001, 5.956691e-001,
+5.975846e-001, 5.995001e-001, 6.013881e-001, 6.032672e-001, 6.051464e-001, 6.070122e-001, 6.088664e-001, 6.107205e-001, 6.125701e-001, 6.144073e-001,
+6.162445e-001, 6.180818e-001, 6.199104e-001, 6.217388e-001, 6.235671e-001, 6.253791e-001, 6.271820e-001, 6.289849e-001, 6.307768e-001, 6.325400e-001,
+6.343032e-001, 6.360664e-001, 6.378103e-001, 6.395515e-001, 6.412926e-001, 6.430226e-001, 6.447380e-001, 6.464534e-001, 6.481688e-001, 6.498512e-001,
+6.515321e-001, 6.532130e-001, 6.548699e-001, 6.564965e-001, 6.581231e-001, 6.597497e-001, 6.613442e-001, 6.629346e-001, 6.645250e-001, 6.661086e-001,
+6.676759e-001, 6.692433e-001, 6.708107e-001, 6.723604e-001, 6.739011e-001, 6.754419e-001, 6.769826e-001, 6.784970e-001, 6.800111e-001, 6.815253e-001,
+6.830374e-001, 6.845443e-001, 6.860512e-001, 6.875581e-001, 6.890511e-001, 6.905319e-001, 6.920126e-001, 6.934934e-001, 6.949405e-001, 6.963760e-001,
+6.978115e-001, 6.992469e-001, 7.006595e-001, 7.020697e-001, 7.034800e-001, 7.048899e-001, 7.062891e-001, 7.076884e-001, 7.090877e-001, 7.104841e-001,
+7.118595e-001, 7.132350e-001, 7.146104e-001, 7.159860e-001, 7.173621e-001, 7.187382e-001, 7.201143e-001, 7.214856e-001, 7.228314e-001, 7.241771e-001,
+7.255229e-001, 7.268647e-001, 7.281753e-001, 7.294859e-001, 7.307965e-001, 7.321065e-001, 7.333904e-001, 7.346743e-001, 7.359583e-001, 7.372422e-001,
+7.385115e-001, 7.397790e-001, 7.410465e-001, 7.423140e-001, 7.435635e-001, 7.448058e-001, 7.460481e-001, 7.472904e-001, 7.485198e-001, 7.497360e-001,
+7.509522e-001, 7.521684e-001, 7.533807e-001, 7.545793e-001, 7.557779e-001, 7.569764e-001, 7.581750e-001, 7.593537e-001, 7.605303e-001, 7.617069e-001,
+7.628835e-001, 7.640434e-001, 7.651894e-001, 7.663354e-001, 7.674814e-001, 7.686261e-001, 7.697625e-001, 7.708990e-001, 7.720355e-001, 7.731719e-001,
+7.742877e-001, 7.753937e-001, 7.764997e-001, 7.776057e-001, 7.787057e-001, 7.797777e-001, 7.808496e-001, 7.819216e-001, 7.829935e-001, 7.840589e-001,
+7.851203e-001, 7.861817e-001, 7.872430e-001, 7.883045e-001, 7.893706e-001, 7.904367e-001, 7.915028e-001, 7.925689e-001, 7.936292e-001, 7.946795e-001,
+7.957298e-001, 7.967801e-001, 7.978304e-001, 7.988723e-001, 7.999097e-001, 8.009472e-001, 8.019847e-001, 8.030221e-001, 8.040328e-001, 8.050406e-001,
+8.060484e-001, 8.070562e-001, 8.080615e-001, 8.090434e-001, 8.100253e-001, 8.110071e-001, 8.119890e-001, 8.129675e-001, 8.139353e-001, 8.149031e-001,
+8.158710e-001, 8.168388e-001, 8.177987e-001, 8.187428e-001, 8.196868e-001, 8.206308e-001, 8.215748e-001, 8.225091e-001, 8.234265e-001, 8.243438e-001,
+8.252612e-001, 8.261786e-001, 8.270889e-001, 8.279858e-001, 8.288828e-001, 8.297798e-001, 8.306768e-001, 8.315676e-001, 8.324421e-001, 8.333166e-001,
+8.341911e-001, 8.350657e-001, 8.359373e-001, 8.367924e-001, 8.376474e-001, 8.385024e-001, 8.393574e-001, 8.402125e-001, 8.410466e-001, 8.418799e-001,
+8.427132e-001, 8.435465e-001, 8.443799e-001, 8.452068e-001, 8.460312e-001, 8.468557e-001, 8.476801e-001, 8.485045e-001, 8.493137e-001, 8.501023e-001,
+8.508909e-001, 8.516795e-001, 8.524681e-001, 8.532543e-001, 8.540086e-001, 8.547630e-001, 8.555173e-001, 8.562717e-001, 8.570260e-001, 8.577691e-001,
+8.585064e-001, 8.592436e-001, 8.599809e-001, 8.607182e-001, 8.614515e-001, 8.621681e-001, 8.628846e-001, 8.636012e-001, 8.643178e-001, 8.650344e-001,
+8.657494e-001, 8.664636e-001, 8.671778e-001, 8.678920e-001, 8.686062e-001, 8.693194e-001, 8.700185e-001, 8.707176e-001, 8.714167e-001, 8.721158e-001,
+8.728149e-001, 8.734970e-001, 8.741556e-001, 8.748142e-001, 8.754728e-001, 8.761315e-001, 8.767901e-001, 8.774240e-001, 8.780479e-001, 8.786717e-001,
+8.792955e-001, 8.799194e-001, 8.805432e-001, 8.811553e-001, 8.817665e-001, 8.823778e-001, 8.829890e-001, 8.836003e-001, 8.842099e-001, 8.848046e-001,
+8.853993e-001, 8.859940e-001, 8.865887e-001, 8.871833e-001, 8.877706e-001, 8.883280e-001, 8.888854e-001, 8.894428e-001, 8.900002e-001, 8.905576e-001,
+8.911084e-001, 8.916377e-001, 8.921671e-001, 8.926964e-001, 8.932257e-001, 8.937551e-001, 8.942792e-001, 8.947835e-001, 8.952878e-001, 8.957922e-001,
+8.962965e-001, 8.968008e-001, 8.973022e-001, 8.977812e-001, 8.982601e-001, 8.987390e-001, 8.992179e-001, 8.996969e-001, 9.001758e-001, 9.006456e-001,
+9.011150e-001, 9.015843e-001, 9.020537e-001, 9.025231e-001, 9.029924e-001, 9.034620e-001, 9.039317e-001, 9.044015e-001, 9.048712e-001, 9.053409e-001,
+9.058106e-001, 9.062727e-001, 9.067248e-001, 9.071769e-001, 9.076290e-001, 9.080811e-001, 9.085333e-001, 9.089835e-001, 9.094098e-001, 9.098360e-001,
+9.102623e-001, 9.106886e-001, 9.111148e-001, 9.115411e-001, 9.119545e-001, 9.123608e-001, 9.127670e-001, 9.131733e-001, 9.135795e-001, 9.139858e-001,
+9.143912e-001, 9.147915e-001, 9.151918e-001, 9.155921e-001, 9.159924e-001, 9.163928e-001, 9.167931e-001, 9.171940e-001, 9.175955e-001, 9.179969e-001,
+9.183983e-001, 9.187998e-001, 9.192012e-001, 9.196027e-001, 9.199983e-001, 9.203936e-001, 9.207888e-001, 9.211840e-001, 9.215792e-001, 9.219744e-001,
+9.223681e-001, 9.227562e-001, 9.231444e-001, 9.235325e-001, 9.239206e-001, 9.243088e-001, 9.246969e-001, 9.250845e-001, 9.254714e-001, 9.258583e-001,
+9.262452e-001, 9.266321e-001, 9.270189e-001, 9.274058e-001, 9.277873e-001, 9.281645e-001, 9.285417e-001, 9.289189e-001, 9.292962e-001, 9.296734e-001,
+9.300506e-001, 9.304202e-001, 9.307852e-001, 9.311502e-001, 9.315153e-001, 9.318803e-001, 9.322453e-001, 9.326103e-001, 9.329578e-001, 9.332943e-001,
+9.336308e-001, 9.339673e-001, 9.343038e-001, 9.346403e-001, 9.349768e-001, 9.352998e-001, 9.356108e-001, 9.359218e-001, 9.362328e-001, 9.365439e-001,
+9.368549e-001, 9.371659e-001, 9.374731e-001, 9.377737e-001, 9.380742e-001, 9.383748e-001, 9.386753e-001, 9.389759e-001, 9.392765e-001, 9.395747e-001,
+9.398567e-001, 9.401388e-001, 9.404208e-001, 9.407028e-001, 9.409849e-001, 9.412669e-001, 9.415489e-001, 9.418273e-001, 9.421049e-001, 9.423825e-001,
+9.426600e-001, 9.429376e-001, 9.432152e-001, 9.434927e-001, 9.437696e-001, 9.440455e-001, 9.443214e-001, 9.445973e-001, 9.448732e-001, 9.451491e-001,
+9.454250e-001, 9.457010e-001, 9.459672e-001, 9.462328e-001, 9.464983e-001, 9.467638e-001, 9.470294e-001, 9.472949e-001, 9.475604e-001, 9.478178e-001,
+9.480611e-001, 9.483045e-001, 9.485478e-001, 9.487911e-001, 9.490345e-001, 9.492778e-001, 9.495211e-001, 9.497414e-001, 9.499528e-001, 9.501643e-001,
+9.503757e-001, 9.505872e-001, 9.507986e-001, 9.510101e-001, 9.512215e-001, 9.514276e-001, 9.516336e-001, 9.518396e-001, 9.520457e-001, 9.522517e-001,
+9.524578e-001, 9.526638e-001, 9.528686e-001, 9.530680e-001, 9.532673e-001, 9.534667e-001, 9.536661e-001, 9.538655e-001, 9.540649e-001, 9.542643e-001,
+9.544624e-001, 9.546577e-001, 9.548530e-001, 9.550482e-001, 9.552435e-001, 9.554388e-001, 9.556340e-001, 9.558293e-001, 9.560242e-001, 9.562184e-001,
+9.564125e-001, 9.566067e-001, 9.568009e-001, 9.569950e-001, 9.571892e-001, 9.573833e-001, 9.575789e-001, 9.577787e-001, 9.579784e-001, 9.581782e-001,
+9.583780e-001, 9.585777e-001, 9.587775e-001, 9.589773e-001, 9.591775e-001, 9.593816e-001, 9.595857e-001, 9.597898e-001, 9.599939e-001, 9.601980e-001,
+9.604021e-001, 9.606062e-001, 9.608103e-001, 9.610272e-001, 9.612464e-001, 9.614656e-001, 9.616847e-001, 9.619039e-001, 9.621230e-001, 9.623422e-001,
+9.625613e-001, 9.627831e-001, 9.630071e-001, 9.632312e-001, 9.634553e-001, 9.636794e-001, 9.639034e-001, 9.641275e-001, 9.643516e-001, 9.645749e-001,
+9.647920e-001, 9.650090e-001, 9.652261e-001, 9.654432e-001, 9.656602e-001, 9.658773e-001, 9.660944e-001, 9.663114e-001, 9.665257e-001, 9.667379e-001,
+9.669501e-001, 9.671623e-001, 9.673745e-001, 9.675868e-001, 9.677990e-001, 9.680112e-001, 9.682234e-001, 9.684261e-001, 9.686286e-001, 9.688311e-001,
+9.690336e-001, 9.692361e-001, 9.694386e-001, 9.696411e-001, 9.698436e-001, 9.700453e-001, 9.702449e-001, 9.704446e-001, 9.706442e-001, 9.708439e-001,
+9.710435e-001, 9.712432e-001, 9.714429e-001, 9.716425e-001, 9.718437e-001, 9.720465e-001, 9.722493e-001, 9.724521e-001, 9.726550e-001, 9.728578e-001,
+9.730606e-001, 9.732634e-001, 9.734662e-001, 9.736676e-001, 9.738680e-001, 9.740685e-001, 9.742689e-001, 9.744693e-001, 9.746698e-001, 9.748702e-001,
+9.750707e-001, 9.752711e-001, 9.754704e-001, 9.756691e-001, 9.758678e-001, 9.760664e-001, 9.762651e-001, 9.764637e-001, 9.766624e-001, 9.768610e-001,
+9.770597e-001, 9.772513e-001, 9.774368e-001, 9.776224e-001, 9.778079e-001, 9.779934e-001, 9.781790e-001, 9.783645e-001, 9.785501e-001, 9.787356e-001,
+9.789177e-001, 9.790938e-001, 9.792699e-001, 9.794460e-001, 9.796221e-001, 9.797982e-001, 9.799743e-001, 9.801504e-001, 9.803265e-001, 9.805016e-001,
+9.806643e-001, 9.808270e-001, 9.809898e-001, 9.811525e-001, 9.813152e-001, 9.814779e-001, 9.816407e-001, 9.818034e-001, 9.819661e-001, 9.821213e-001,
+9.822732e-001, 9.824251e-001, 9.825769e-001, 9.827288e-001, 9.828807e-001, 9.830326e-001, 9.831845e-001, 9.833364e-001, 9.834849e-001, 9.836213e-001,
+9.837577e-001, 9.838941e-001, 9.840305e-001, 9.841670e-001, 9.843034e-001, 9.844398e-001, 9.845762e-001, 9.847126e-001, 9.848354e-001, 9.849503e-001,
+9.850653e-001, 9.851802e-001, 9.852951e-001, 9.854101e-001, 9.855250e-001, 9.856399e-001, 9.857548e-001, 9.858698e-001, 9.859718e-001, 9.860731e-001,
+9.861744e-001, 9.862757e-001, 9.863771e-001, 9.864784e-001, 9.865797e-001, 9.866810e-001, 9.867823e-001, 9.868843e-001, 9.869906e-001, 9.870968e-001,
+9.872030e-001, 9.873093e-001, 9.874155e-001, 9.875218e-001, 9.876280e-001, 9.877343e-001, 9.878405e-001, 9.879498e-001, 9.880681e-001, 9.881863e-001,
+9.883046e-001, 9.884229e-001, 9.885412e-001, 9.886595e-001, 9.887778e-001, 9.888960e-001, 9.890143e-001, 9.891342e-001, 9.892589e-001, 9.893837e-001,
+9.895085e-001, 9.896333e-001, 9.897581e-001, 9.898828e-001, 9.900076e-001, 9.901324e-001, 9.902572e-001, 9.903820e-001, 9.905075e-001, 9.906330e-001,
+9.907584e-001, 9.908839e-001, 9.910094e-001, 9.911348e-001, 9.912603e-001, 9.913857e-001, 9.915112e-001, 9.916367e-001, 9.917576e-001, 9.918780e-001,
+9.919983e-001, 9.921187e-001, 9.922391e-001, 9.923595e-001, 9.924799e-001, 9.926003e-001, 9.927207e-001, 9.928411e-001, 9.929553e-001, 9.930647e-001,
+9.931742e-001, 9.932836e-001, 9.933931e-001, 9.935025e-001, 9.936120e-001, 9.937215e-001, 9.938309e-001, 9.939404e-001, 9.940490e-001, 9.941515e-001,
+9.942540e-001, 9.943564e-001, 9.944589e-001, 9.945614e-001, 9.946639e-001, 9.947664e-001, 9.948688e-001, 9.949713e-001, 9.950738e-001, 9.951713e-001,
+9.952647e-001, 9.953581e-001, 9.954516e-001, 9.955450e-001, 9.956384e-001, 9.957318e-001, 9.958253e-001, 9.959187e-001, 9.960121e-001, 9.961055e-001,
+9.961967e-001, 9.962876e-001, 9.963785e-001, 9.964694e-001, 9.965603e-001, 9.966512e-001, 9.967421e-001, 9.968330e-001, 9.969239e-001, 9.970148e-001,
+9.971056e-001, 9.971954e-001, 9.972853e-001, 9.973751e-001, 9.974650e-001, 9.975548e-001, 9.976447e-001, 9.977345e-001, 9.978244e-001, 9.979142e-001,
+9.980041e-001, 9.980940e-001, 9.981844e-001, 9.982747e-001, 9.983651e-001, 9.984555e-001, 9.985459e-001, 9.986362e-001, 9.987266e-001, 9.988170e-001,
+9.989074e-001, 9.989977e-001, 9.990870e-001, 9.991700e-001, 9.992530e-001, 9.993360e-001, 9.994190e-001, 9.995020e-001, 9.995850e-001, 9.996680e-001,
+9.997510e-001, 9.998340e-001, 9.999170e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.790309e-004, 3.632053e-004, 5.541568e-004, 7.514893e-004, 9.573574e-004, 1.169902e-003, 1.391134e-003, 1.621146e-003, 1.856578e-003,
+2.100516e-003, 2.350829e-003, 2.610526e-003, 2.883161e-003, 3.166482e-003, 3.460269e-003, 3.764516e-003, 4.080214e-003, 4.405580e-003, 4.743217e-003,
+5.093165e-003, 5.455137e-003, 5.828577e-003, 6.213227e-003, 6.612410e-003, 7.023942e-003, 7.448171e-003, 7.883793e-003, 8.331356e-003, 8.791385e-003,
+9.262905e-003, 9.747654e-003, 1.024795e-002, 1.076460e-002, 1.129935e-002, 1.185296e-002, 1.242434e-002, 1.300980e-002, 1.361229e-002, 1.423261e-002,
+1.486948e-002, 1.552383e-002, 1.619268e-002, 1.687444e-002, 1.757305e-002, 1.829043e-002, 1.902701e-002, 1.978170e-002, 2.055570e-002, 2.135195e-002,
+2.217057e-002, 2.301397e-002, 2.388309e-002, 2.477734e-002, 2.569552e-002, 2.663274e-002, 2.758948e-002, 2.856632e-002, 2.956259e-002, 3.057666e-002,
+3.160940e-002, 3.266505e-002, 3.374630e-002, 3.485127e-002, 3.597758e-002, 3.712388e-002, 3.828767e-002, 3.947249e-002, 4.068486e-002, 4.192356e-002,
+4.318615e-002, 4.447197e-002, 4.577972e-002, 4.710597e-002, 4.845265e-002, 4.981796e-002, 5.120848e-002, 5.262833e-002, 5.407543e-002, 5.554533e-002,
+5.703522e-002, 5.854395e-002, 6.007033e-002, 6.161208e-002, 6.316678e-002, 6.474549e-002, 6.635407e-002, 6.798635e-002, 6.964469e-002, 7.132707e-002,
+7.302933e-002, 7.474808e-002, 7.649014e-002, 7.824870e-002, 8.002888e-002, 8.183114e-002, 8.365387e-002, 8.549803e-002, 8.736843e-002, 8.926114e-002,
+9.117544e-002, 9.311127e-002, 9.507207e-002, 9.704987e-002, 9.904426e-002, 1.010560e-001, 1.031070e-001, 1.051762e-001, 1.072626e-001, 1.093715e-001,
+1.115005e-001, 1.136447e-001, 1.158049e-001, 1.179930e-001, 1.201986e-001, 1.224215e-001, 1.246768e-001, 1.269477e-001, 1.292310e-001, 1.315293e-001,
+1.338451e-001, 1.361752e-001, 1.385368e-001, 1.409143e-001, 1.433060e-001, 1.457218e-001, 1.481487e-001, 1.505914e-001, 1.530454e-001, 1.555086e-001,
+1.579967e-001, 1.605020e-001, 1.630199e-001, 1.655519e-001, 1.680873e-001, 1.706292e-001, 1.731803e-001, 1.757373e-001, 1.783048e-001, 1.808758e-001,
+1.834572e-001, 1.860489e-001, 1.886530e-001, 1.912736e-001, 1.939012e-001, 1.965422e-001, 1.991860e-001, 2.018410e-001, 2.045024e-001, 2.071764e-001,
+2.098607e-001, 2.125552e-001, 2.152568e-001, 2.179622e-001, 2.206755e-001, 2.233911e-001, 2.261153e-001, 2.288406e-001, 2.315698e-001, 2.343001e-001,
+2.370491e-001, 2.397977e-001, 2.425440e-001, 2.452910e-001, 2.480436e-001, 2.507982e-001, 2.535662e-001, 2.563356e-001, 2.591149e-001, 2.618940e-001,
+2.646703e-001, 2.674466e-001, 2.702299e-001, 2.730131e-001, 2.757953e-001, 2.785773e-001, 2.813608e-001, 2.841447e-001, 2.869217e-001, 2.896958e-001,
+2.924658e-001, 2.952325e-001, 2.979985e-001, 3.007634e-001, 3.035243e-001, 3.062673e-001, 3.090103e-001, 3.117266e-001, 3.144418e-001, 3.171554e-001,
+3.198684e-001, 3.225779e-001, 3.252830e-001, 3.279863e-001, 3.306790e-001, 3.333716e-001, 3.360340e-001, 3.386904e-001, 3.413349e-001, 3.439669e-001,
+3.465988e-001, 3.492295e-001, 3.518602e-001, 3.544926e-001, 3.571257e-001, 3.597556e-001, 3.623784e-001, 3.650011e-001, 3.676073e-001, 3.702106e-001,
+3.728044e-001, 3.753828e-001, 3.779612e-001, 3.805245e-001, 3.830858e-001, 3.856398e-001, 3.881802e-001, 3.907207e-001, 3.932437e-001, 3.957622e-001,
+3.982788e-001, 4.007884e-001, 4.032980e-001, 4.057932e-001, 4.082788e-001, 4.107643e-001, 4.132384e-001, 4.157120e-001, 4.181811e-001, 4.206390e-001,
+4.230970e-001, 4.255496e-001, 4.279987e-001, 4.304478e-001, 4.328849e-001, 4.353203e-001, 4.377534e-001, 4.401685e-001, 4.425837e-001, 4.449891e-001,
+4.473745e-001, 4.497599e-001, 4.521427e-001, 4.545232e-001, 4.569036e-001, 4.592864e-001, 4.616704e-001, 4.640543e-001, 4.664344e-001, 4.688135e-001,
+4.711925e-001, 4.735459e-001, 4.758956e-001, 4.782454e-001, 4.805634e-001, 4.828793e-001, 4.851951e-001, 4.874885e-001, 4.897811e-001, 4.920736e-001,
+4.943392e-001, 4.966035e-001, 4.988679e-001, 5.010881e-001, 5.033046e-001, 5.055211e-001, 5.077061e-001, 5.098856e-001, 5.120652e-001, 5.142083e-001,
+5.163393e-001, 5.184702e-001, 5.205832e-001, 5.226848e-001, 5.247864e-001, 5.268791e-001, 5.289608e-001, 5.310424e-001, 5.331161e-001, 5.351640e-001,
+5.372118e-001, 5.392597e-001, 5.412785e-001, 5.432972e-001, 5.453159e-001, 5.473181e-001, 5.493139e-001, 5.513098e-001, 5.532948e-001, 5.552642e-001,
+5.572336e-001, 5.592027e-001, 5.611671e-001, 5.631314e-001, 5.650958e-001, 5.670525e-001, 5.690057e-001, 5.709588e-001, 5.729085e-001, 5.748483e-001,
+5.767882e-001, 5.787281e-001, 5.806528e-001, 5.825738e-001, 5.844948e-001, 5.864081e-001, 5.883043e-001, 5.902004e-001, 5.920965e-001, 5.939830e-001,
+5.958668e-001, 5.977506e-001, 5.996312e-001, 6.014997e-001, 6.033681e-001, 6.052365e-001, 6.070838e-001, 6.089170e-001, 6.107502e-001, 6.125833e-001,
+6.143842e-001, 6.161835e-001, 6.179828e-001, 6.197699e-001, 6.215232e-001, 6.232765e-001, 6.250298e-001, 6.267580e-001, 6.284643e-001, 6.301707e-001,
+6.318771e-001, 6.335585e-001, 6.352325e-001, 6.369064e-001, 6.385803e-001, 6.402256e-001, 6.418696e-001, 6.435136e-001, 6.451523e-001, 6.467464e-001,
+6.483405e-001, 6.499347e-001, 6.515223e-001, 6.530866e-001, 6.546509e-001, 6.562152e-001, 6.577690e-001, 6.592960e-001, 6.608230e-001, 6.623500e-001,
+6.638726e-001, 6.653854e-001, 6.668981e-001, 6.684109e-001, 6.699141e-001, 6.713936e-001, 6.728731e-001, 6.743526e-001, 6.758231e-001, 6.772615e-001,
+6.787000e-001, 6.801384e-001, 6.815736e-001, 6.829831e-001, 6.843927e-001, 6.858022e-001, 6.872118e-001, 6.885959e-001, 6.899790e-001, 6.913622e-001,
+6.927453e-001, 6.941305e-001, 6.955163e-001, 6.969020e-001, 6.982878e-001, 6.996649e-001, 7.010340e-001, 7.024030e-001, 7.037721e-001, 7.051347e-001,
+7.064758e-001, 7.078168e-001, 7.091579e-001, 7.104990e-001, 7.118229e-001, 7.131448e-001, 7.144667e-001, 7.157886e-001, 7.170933e-001, 7.183820e-001,
+7.196707e-001, 7.209593e-001, 7.222460e-001, 7.235113e-001, 7.247765e-001, 7.260418e-001, 7.273071e-001, 7.285520e-001, 7.297836e-001, 7.310153e-001,
+7.322469e-001, 7.334776e-001, 7.346972e-001, 7.359167e-001, 7.371363e-001, 7.383558e-001, 7.395550e-001, 7.407343e-001, 7.419135e-001, 7.430928e-001,
+7.442720e-001, 7.454272e-001, 7.465792e-001, 7.477311e-001, 7.488831e-001, 7.500287e-001, 7.511498e-001, 7.522709e-001, 7.533920e-001, 7.545131e-001,
+7.556205e-001, 7.567132e-001, 7.578058e-001, 7.588984e-001, 7.599910e-001, 7.610652e-001, 7.621317e-001, 7.631981e-001, 7.642645e-001, 7.653309e-001,
+7.663742e-001, 7.674141e-001, 7.684540e-001, 7.694939e-001, 7.705338e-001, 7.715379e-001, 7.725417e-001, 7.735455e-001, 7.745493e-001, 7.755506e-001,
+7.765091e-001, 7.774677e-001, 7.784263e-001, 7.793848e-001, 7.803426e-001, 7.812893e-001, 7.822361e-001, 7.831828e-001, 7.841296e-001, 7.850759e-001,
+7.860084e-001, 7.869409e-001, 7.878734e-001, 7.888059e-001, 7.897384e-001, 7.906384e-001, 7.915361e-001, 7.924337e-001, 7.933314e-001, 7.942290e-001,
+7.951080e-001, 7.959816e-001, 7.968553e-001, 7.977289e-001, 7.986026e-001, 7.994633e-001, 8.003144e-001, 8.011655e-001, 8.020166e-001, 8.028677e-001,
+8.037161e-001, 8.045581e-001, 8.054002e-001, 8.062422e-001, 8.070843e-001, 8.079264e-001, 8.087494e-001, 8.095721e-001, 8.103949e-001, 8.112176e-001,
+8.120404e-001, 8.128636e-001, 8.136872e-001, 8.145108e-001, 8.153344e-001, 8.161580e-001, 8.169798e-001, 8.177930e-001, 8.186062e-001, 8.194194e-001,
+8.202325e-001, 8.210457e-001, 8.218514e-001, 8.226535e-001, 8.234555e-001, 8.242576e-001, 8.250596e-001, 8.258601e-001, 8.266490e-001, 8.274380e-001,
+8.282269e-001, 8.290158e-001, 8.298047e-001, 8.305819e-001, 8.313473e-001, 8.321127e-001, 8.328780e-001, 8.336434e-001, 8.344088e-001, 8.351647e-001,
+8.359185e-001, 8.366723e-001, 8.374262e-001, 8.381800e-001, 8.389330e-001, 8.396767e-001, 8.404204e-001, 8.411641e-001, 8.419077e-001, 8.426514e-001,
+8.433900e-001, 8.441157e-001, 8.448413e-001, 8.455670e-001, 8.462926e-001, 8.470183e-001, 8.477351e-001, 8.484397e-001, 8.491443e-001, 8.498489e-001,
+8.505535e-001, 8.512581e-001, 8.519488e-001, 8.526255e-001, 8.533021e-001, 8.539788e-001, 8.546554e-001, 8.553320e-001, 8.560088e-001, 8.566856e-001,
+8.573625e-001, 8.580393e-001, 8.587162e-001, 8.593930e-001, 8.600616e-001, 8.607198e-001, 8.613780e-001, 8.620361e-001, 8.626943e-001, 8.633525e-001,
+8.640045e-001, 8.646434e-001, 8.652823e-001, 8.659211e-001, 8.665600e-001, 8.671989e-001, 8.678355e-001, 8.684572e-001, 8.690789e-001, 8.697006e-001,
+8.703223e-001, 8.709441e-001, 8.715658e-001, 8.721611e-001, 8.727529e-001, 8.733446e-001, 8.739364e-001, 8.745281e-001, 8.751199e-001, 8.756938e-001,
+8.762535e-001, 8.768131e-001, 8.773728e-001, 8.779325e-001, 8.784921e-001, 8.790519e-001, 8.796120e-001, 8.801721e-001, 8.807323e-001, 8.812924e-001,
+8.818526e-001, 8.824127e-001, 8.829627e-001, 8.835083e-001, 8.840540e-001, 8.845997e-001, 8.851453e-001, 8.856910e-001, 8.862351e-001, 8.867712e-001,
+8.873074e-001, 8.878436e-001, 8.883798e-001, 8.889160e-001, 8.894522e-001, 8.899857e-001, 8.905174e-001, 8.910490e-001, 8.915806e-001, 8.921123e-001,
+8.926439e-001, 8.931755e-001, 8.936873e-001, 8.941967e-001, 8.947062e-001, 8.952156e-001, 8.957251e-001, 8.962345e-001, 8.967436e-001, 8.972502e-001,
+8.977568e-001, 8.982635e-001, 8.987701e-001, 8.992768e-001, 8.997834e-001, 9.002879e-001, 9.007881e-001, 9.012883e-001, 9.017884e-001, 9.022886e-001,
+9.027888e-001, 9.032890e-001, 9.037816e-001, 9.042645e-001, 9.047474e-001, 9.052304e-001, 9.057133e-001, 9.061962e-001, 9.066791e-001, 9.071536e-001,
+9.076185e-001, 9.080835e-001, 9.085484e-001, 9.090134e-001, 9.094783e-001, 9.099433e-001, 9.103997e-001, 9.108446e-001, 9.112895e-001, 9.117343e-001,
+9.121792e-001, 9.126241e-001, 9.130689e-001, 9.135128e-001, 9.139543e-001, 9.143959e-001, 9.148374e-001, 9.152789e-001, 9.157204e-001, 9.161620e-001,
+9.166017e-001, 9.170260e-001, 9.174504e-001, 9.178748e-001, 9.182992e-001, 9.187236e-001, 9.191479e-001, 9.195723e-001, 9.199801e-001, 9.203845e-001,
+9.207890e-001, 9.211934e-001, 9.215979e-001, 9.220024e-001, 9.224068e-001, 9.228081e-001, 9.232061e-001, 9.236040e-001, 9.240019e-001, 9.243999e-001,
+9.247978e-001, 9.251957e-001, 9.255933e-001, 9.259833e-001, 9.263733e-001, 9.267633e-001, 9.271534e-001, 9.275434e-001, 9.279334e-001, 9.283234e-001,
+9.286992e-001, 9.290624e-001, 9.294255e-001, 9.297887e-001, 9.301519e-001, 9.305151e-001, 9.308783e-001, 9.312414e-001, 9.315894e-001, 9.319362e-001,
+9.322831e-001, 9.326300e-001, 9.329768e-001, 9.333237e-001, 9.336706e-001, 9.340136e-001, 9.343457e-001, 9.346778e-001, 9.350098e-001, 9.353419e-001,
+9.356740e-001, 9.360061e-001, 9.363381e-001, 9.366635e-001, 9.369819e-001, 9.373004e-001, 9.376189e-001, 9.379373e-001, 9.382558e-001, 9.385743e-001,
+9.388927e-001, 9.392105e-001, 9.395279e-001, 9.398452e-001, 9.401626e-001, 9.404800e-001, 9.407973e-001, 9.411147e-001, 9.414321e-001, 9.417477e-001,
+9.420625e-001, 9.423773e-001, 9.426922e-001, 9.430070e-001, 9.433219e-001, 9.436367e-001, 9.439516e-001, 9.442649e-001, 9.445776e-001, 9.448904e-001,
+9.452031e-001, 9.455158e-001, 9.458285e-001, 9.461413e-001, 9.464540e-001, 9.467725e-001, 9.470949e-001, 9.474173e-001, 9.477398e-001, 9.480622e-001,
+9.483846e-001, 9.487070e-001, 9.490294e-001, 9.493506e-001, 9.496699e-001, 9.499892e-001, 9.503086e-001, 9.506279e-001, 9.509472e-001, 9.512665e-001,
+9.515859e-001, 9.519030e-001, 9.522051e-001, 9.525071e-001, 9.528092e-001, 9.531113e-001, 9.534133e-001, 9.537154e-001, 9.540174e-001, 9.543195e-001,
+9.546112e-001, 9.548995e-001, 9.551878e-001, 9.554761e-001, 9.557644e-001, 9.560528e-001, 9.563411e-001, 9.566294e-001, 9.569211e-001, 9.572211e-001,
+9.575210e-001, 9.578210e-001, 9.581209e-001, 9.584208e-001, 9.587208e-001, 9.590207e-001, 9.593207e-001, 9.596204e-001, 9.599201e-001, 9.602197e-001,
+9.605194e-001, 9.608191e-001, 9.611188e-001, 9.614184e-001, 9.617181e-001, 9.620164e-001, 9.623021e-001, 9.625877e-001, 9.628734e-001, 9.631591e-001,
+9.634447e-001, 9.637304e-001, 9.640160e-001, 9.643017e-001, 9.645820e-001, 9.648528e-001, 9.651236e-001, 9.653944e-001, 9.656652e-001, 9.659359e-001,
+9.662067e-001, 9.664775e-001, 9.667483e-001, 9.670148e-001, 9.672774e-001, 9.675399e-001, 9.678025e-001, 9.680651e-001, 9.683277e-001, 9.685903e-001,
+9.688529e-001, 9.691155e-001, 9.693739e-001, 9.696295e-001, 9.698851e-001, 9.701407e-001, 9.703963e-001, 9.706519e-001, 9.709075e-001, 9.711631e-001,
+9.714188e-001, 9.716637e-001, 9.719005e-001, 9.721374e-001, 9.723742e-001, 9.726111e-001, 9.728479e-001, 9.730847e-001, 9.733216e-001, 9.735584e-001,
+9.737908e-001, 9.740175e-001, 9.742442e-001, 9.744709e-001, 9.746976e-001, 9.749243e-001, 9.751510e-001, 9.753777e-001, 9.756044e-001, 9.758261e-001,
+9.760301e-001, 9.762341e-001, 9.764381e-001, 9.766422e-001, 9.768462e-001, 9.770502e-001, 9.772542e-001, 9.774582e-001, 9.776623e-001, 9.778533e-001,
+9.780429e-001, 9.782324e-001, 9.784220e-001, 9.786115e-001, 9.788011e-001, 9.789906e-001, 9.791802e-001, 9.793697e-001, 9.795543e-001, 9.797333e-001,
+9.799123e-001, 9.800913e-001, 9.802703e-001, 9.804493e-001, 9.806283e-001, 9.808073e-001, 9.809863e-001, 9.811653e-001, 9.813308e-001, 9.814955e-001,
+9.816602e-001, 9.818250e-001, 9.819897e-001, 9.821544e-001, 9.823192e-001, 9.824839e-001, 9.826486e-001, 9.828113e-001, 9.829697e-001, 9.831281e-001,
+9.832864e-001, 9.834448e-001, 9.836031e-001, 9.837615e-001, 9.839199e-001, 9.840782e-001, 9.842366e-001, 9.843990e-001, 9.845643e-001, 9.847296e-001,
+9.848949e-001, 9.850603e-001, 9.852256e-001, 9.853909e-001, 9.855562e-001, 9.857215e-001, 9.858868e-001, 9.860410e-001, 9.861914e-001, 9.863417e-001,
+9.864920e-001, 9.866423e-001, 9.867926e-001, 9.869430e-001, 9.870933e-001, 9.872436e-001, 9.873939e-001, 9.875226e-001, 9.876458e-001, 9.877689e-001,
+9.878920e-001, 9.880152e-001, 9.881383e-001, 9.882614e-001, 9.883846e-001, 9.885077e-001, 9.886308e-001, 9.887587e-001, 9.888883e-001, 9.890179e-001,
+9.891474e-001, 9.892770e-001, 9.894066e-001, 9.895361e-001, 9.896657e-001, 9.897953e-001, 9.899248e-001, 9.900572e-001, 9.901916e-001, 9.903261e-001,
+9.904605e-001, 9.905950e-001, 9.907294e-001, 9.908639e-001, 9.909983e-001, 9.911327e-001, 9.912672e-001, 9.914013e-001, 9.915347e-001, 9.916681e-001,
+9.918015e-001, 9.919349e-001, 9.920683e-001, 9.922016e-001, 9.923350e-001, 9.924684e-001, 9.926018e-001, 9.927352e-001, 9.928620e-001, 9.929883e-001,
+9.931145e-001, 9.932408e-001, 9.933671e-001, 9.934933e-001, 9.936196e-001, 9.937458e-001, 9.938721e-001, 9.939983e-001, 9.941191e-001, 9.942322e-001,
+9.943454e-001, 9.944585e-001, 9.945717e-001, 9.946848e-001, 9.947979e-001, 9.949111e-001, 9.950242e-001, 9.951374e-001, 9.952505e-001, 9.953570e-001,
+9.954619e-001, 9.955668e-001, 9.956717e-001, 9.957766e-001, 9.958815e-001, 9.959864e-001, 9.960912e-001, 9.961961e-001, 9.963010e-001, 9.964051e-001,
+9.965000e-001, 9.965949e-001, 9.966898e-001, 9.967847e-001, 9.968796e-001, 9.969745e-001, 9.970694e-001, 9.971643e-001, 9.972592e-001, 9.973541e-001,
+9.974478e-001, 9.975378e-001, 9.976279e-001, 9.977179e-001, 9.978079e-001, 9.978979e-001, 9.979879e-001, 9.980779e-001, 9.981679e-001, 9.982580e-001,
+9.983480e-001, 9.984342e-001, 9.985108e-001, 9.985873e-001, 9.986638e-001, 9.987404e-001, 9.988169e-001, 9.988935e-001, 9.989700e-001, 9.990465e-001,
+9.991231e-001, 9.991996e-001, 9.992740e-001, 9.993400e-001, 9.994060e-001, 9.994720e-001, 9.995380e-001, 9.996040e-001, 9.996700e-001, 9.997360e-001,
+9.998020e-001, 9.998680e-001, 9.999340e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.295420e-004, 2.623819e-004, 4.006781e-004, 5.452139e-004, 6.973416e-004, 8.563135e-004, 1.022361e-003, 1.192687e-003, 1.368544e-003,
+1.548769e-003, 1.734121e-003, 1.926114e-003, 2.124776e-003, 2.330620e-003, 2.544405e-003, 2.766164e-003, 2.995026e-003, 3.231288e-003, 3.475542e-003,
+3.727164e-003, 3.985985e-003, 4.251054e-003, 4.525256e-003, 4.809109e-003, 5.102086e-003, 5.404831e-003, 5.716456e-003, 6.036877e-003, 6.367635e-003,
+6.708131e-003, 7.057503e-003, 7.417482e-003, 7.787990e-003, 8.168387e-003, 8.559629e-003, 8.964975e-003, 9.386821e-003, 9.819766e-003, 1.026411e-002,
+1.071988e-002, 1.118654e-002, 1.166701e-002, 1.216097e-002, 1.266818e-002, 1.318733e-002, 1.371954e-002, 1.426450e-002, 1.482158e-002, 1.539185e-002,
+1.597672e-002, 1.657754e-002, 1.719225e-002, 1.782133e-002, 1.846209e-002, 1.911501e-002, 1.978344e-002, 2.046768e-002, 2.116818e-002, 2.188401e-002,
+2.261338e-002, 2.335745e-002, 2.411823e-002, 2.489606e-002, 2.568706e-002, 2.649204e-002, 2.731393e-002, 2.815238e-002, 2.901209e-002, 2.988987e-002,
+3.078164e-002, 3.168984e-002, 3.261609e-002, 3.355981e-002, 3.452129e-002, 3.550151e-002, 3.649938e-002, 3.751619e-002, 3.855308e-002, 3.960755e-002,
+4.068176e-002, 4.177324e-002, 4.287903e-002, 4.399850e-002, 4.513916e-002, 4.629691e-002, 4.747178e-002, 4.866428e-002, 4.987448e-002, 5.110199e-002,
+5.234699e-002, 5.360880e-002, 5.488683e-002, 5.618182e-002, 5.749823e-002, 5.883142e-002, 6.018110e-002, 6.155209e-002, 6.294854e-002, 6.436503e-002,
+6.580118e-002, 6.726664e-002, 6.874626e-002, 7.023911e-002, 7.175079e-002, 7.328353e-002, 7.483158e-002, 7.639941e-002, 7.798320e-002, 7.957824e-002,
+8.118849e-002, 8.281645e-002, 8.445428e-002, 8.610590e-002, 8.777505e-002, 8.945425e-002, 9.115080e-002, 9.285896e-002, 9.457463e-002, 9.630996e-002,
+9.805742e-002, 9.981836e-002, 1.016085e-001, 1.034116e-001, 1.052437e-001, 1.070918e-001, 1.089528e-001, 1.108305e-001, 1.127144e-001, 1.146151e-001,
+1.165283e-001, 1.184550e-001, 1.204016e-001, 1.223547e-001, 1.243321e-001, 1.263146e-001, 1.283139e-001, 1.303220e-001, 1.323408e-001, 1.343753e-001,
+1.364186e-001, 1.384806e-001, 1.405466e-001, 1.426350e-001, 1.447259e-001, 1.468326e-001, 1.489424e-001, 1.510629e-001, 1.531887e-001, 1.553261e-001,
+1.574766e-001, 1.596475e-001, 1.618286e-001, 1.640225e-001, 1.662251e-001, 1.684375e-001, 1.706585e-001, 1.728888e-001, 1.751245e-001, 1.773662e-001,
+1.796109e-001, 1.818596e-001, 1.841097e-001, 1.863623e-001, 1.886177e-001, 1.908795e-001, 1.931430e-001, 1.954130e-001, 1.976845e-001, 1.999710e-001,
+2.022576e-001, 2.045579e-001, 2.068591e-001, 2.091719e-001, 2.114882e-001, 2.138084e-001, 2.161315e-001, 2.184565e-001, 2.207846e-001, 2.231137e-001,
+2.254500e-001, 2.277863e-001, 2.301244e-001, 2.324628e-001, 2.348098e-001, 2.371634e-001, 2.395183e-001, 2.418768e-001, 2.442354e-001, 2.465996e-001,
+2.489644e-001, 2.513362e-001, 2.537139e-001, 2.560917e-001, 2.584706e-001, 2.608496e-001, 2.632276e-001, 2.656053e-001, 2.679820e-001, 2.703563e-001,
+2.727306e-001, 2.751063e-001, 2.774824e-001, 2.798557e-001, 2.822236e-001, 2.845914e-001, 2.869648e-001, 2.893395e-001, 2.917164e-001, 2.940999e-001,
+2.964834e-001, 2.988684e-001, 3.012541e-001, 3.036402e-001, 3.060307e-001, 3.084212e-001, 3.108114e-001, 3.132014e-001, 3.155914e-001, 3.179831e-001,
+3.203753e-001, 3.227670e-001, 3.251538e-001, 3.275407e-001, 3.299231e-001, 3.322981e-001, 3.346731e-001, 3.370327e-001, 3.393831e-001, 3.417335e-001,
+3.440715e-001, 3.464072e-001, 3.487424e-001, 3.510629e-001, 3.533834e-001, 3.556985e-001, 3.579911e-001, 3.602836e-001, 3.625684e-001, 3.648371e-001,
+3.671058e-001, 3.693706e-001, 3.716300e-001, 3.738894e-001, 3.761452e-001, 3.783971e-001, 3.806490e-001, 3.828857e-001, 3.851085e-001, 3.873313e-001,
+3.895425e-001, 3.917432e-001, 3.939439e-001, 3.961328e-001, 3.983096e-001, 4.004863e-001, 4.026563e-001, 4.048171e-001, 4.069780e-001, 4.091327e-001,
+4.112751e-001, 4.134175e-001, 4.155569e-001, 4.176844e-001, 4.198120e-001, 4.219393e-001, 4.240606e-001, 4.261820e-001, 4.283034e-001, 4.304130e-001,
+4.325203e-001, 4.346276e-001, 4.367291e-001, 4.388268e-001, 4.409245e-001, 4.430137e-001, 4.450865e-001, 4.471594e-001, 4.492312e-001, 4.512765e-001,
+4.533218e-001, 4.553670e-001, 4.573918e-001, 4.594077e-001, 4.614236e-001, 4.634315e-001, 4.654227e-001, 4.674139e-001, 4.694051e-001, 4.713697e-001,
+4.733317e-001, 4.752938e-001, 4.772515e-001, 4.792042e-001, 4.811569e-001, 4.831096e-001, 4.850563e-001, 4.870028e-001, 4.889494e-001, 4.908913e-001,
+4.928275e-001, 4.947637e-001, 4.966999e-001, 4.986213e-001, 5.005409e-001, 5.024605e-001, 5.043705e-001, 5.062571e-001, 5.081436e-001, 5.100302e-001,
+5.119036e-001, 5.137700e-001, 5.156363e-001, 5.175027e-001, 5.193520e-001, 5.212007e-001, 5.230495e-001, 5.248933e-001, 5.267223e-001, 5.285514e-001,
+5.303804e-001, 5.322029e-001, 5.340184e-001, 5.358340e-001, 5.376495e-001, 5.394586e-001, 5.412648e-001, 5.430710e-001, 5.448771e-001, 5.466738e-001,
+5.484687e-001, 5.502636e-001, 5.520586e-001, 5.538394e-001, 5.556198e-001, 5.574001e-001, 5.591800e-001, 5.609491e-001, 5.627182e-001, 5.644872e-001,
+5.662546e-001, 5.680006e-001, 5.697466e-001, 5.714927e-001, 5.732376e-001, 5.749658e-001, 5.766941e-001, 5.784224e-001, 5.801504e-001, 5.818541e-001,
+5.835578e-001, 5.852615e-001, 5.869652e-001, 5.886417e-001, 5.903154e-001, 5.919892e-001, 5.936630e-001, 5.953097e-001, 5.969482e-001, 5.985867e-001,
+6.002252e-001, 6.018486e-001, 6.034609e-001, 6.050732e-001, 6.066855e-001, 6.082887e-001, 6.098747e-001, 6.114608e-001, 6.130468e-001, 6.146310e-001,
+6.161890e-001, 6.177470e-001, 6.193049e-001, 6.208629e-001, 6.223968e-001, 6.239222e-001, 6.254477e-001, 6.269731e-001, 6.284868e-001, 6.299803e-001,
+6.314739e-001, 6.329675e-001, 6.344610e-001, 6.359265e-001, 6.373905e-001, 6.388545e-001, 6.403185e-001, 6.417623e-001, 6.431842e-001, 6.446062e-001,
+6.460281e-001, 6.474501e-001, 6.488506e-001, 6.502504e-001, 6.516501e-001, 6.530498e-001, 6.544443e-001, 6.558309e-001, 6.572174e-001, 6.586040e-001,
+6.599906e-001, 6.613617e-001, 6.627286e-001, 6.640955e-001, 6.654624e-001, 6.668283e-001, 6.681865e-001, 6.695447e-001, 6.709029e-001, 6.722612e-001,
+6.736128e-001, 6.749550e-001, 6.762971e-001, 6.776393e-001, 6.789814e-001, 6.803114e-001, 6.816345e-001, 6.829576e-001, 6.842807e-001, 6.856039e-001,
+6.869194e-001, 6.882332e-001, 6.895471e-001, 6.908610e-001, 6.921749e-001, 6.934753e-001, 6.947750e-001, 6.960748e-001, 6.973745e-001, 6.986738e-001,
+6.999593e-001, 7.012448e-001, 7.025303e-001, 7.038157e-001, 7.050996e-001, 7.063539e-001, 7.076082e-001, 7.088625e-001, 7.101168e-001, 7.113707e-001,
+7.126060e-001, 7.138412e-001, 7.150765e-001, 7.163118e-001, 7.175470e-001, 7.187737e-001, 7.199998e-001, 7.212259e-001, 7.224520e-001, 7.236781e-001,
+7.248950e-001, 7.261095e-001, 7.273240e-001, 7.285386e-001, 7.297531e-001, 7.309512e-001, 7.321384e-001, 7.333257e-001, 7.345129e-001, 7.357001e-001,
+7.368818e-001, 7.380531e-001, 7.392245e-001, 7.403959e-001, 7.415672e-001, 7.427378e-001, 7.438890e-001, 7.450403e-001, 7.461915e-001, 7.473427e-001,
+7.484940e-001, 7.496195e-001, 7.507325e-001, 7.518454e-001, 7.529584e-001, 7.540713e-001, 7.551763e-001, 7.562570e-001, 7.573378e-001, 7.584185e-001,
+7.594993e-001, 7.605800e-001, 7.616461e-001, 7.627076e-001, 7.637691e-001, 7.648306e-001, 7.658921e-001, 7.669504e-001, 7.679973e-001, 7.690442e-001,
+7.700911e-001, 7.711379e-001, 7.721848e-001, 7.732229e-001, 7.742554e-001, 7.752880e-001, 7.763205e-001, 7.773531e-001, 7.783857e-001, 7.793797e-001,
+7.803717e-001, 7.813638e-001, 7.823559e-001, 7.833480e-001, 7.843326e-001, 7.852918e-001, 7.862509e-001, 7.872101e-001, 7.881693e-001, 7.891284e-001,
+7.900806e-001, 7.910240e-001, 7.919673e-001, 7.929107e-001, 7.938540e-001, 7.947974e-001, 7.957334e-001, 7.966642e-001, 7.975950e-001, 7.985258e-001,
+7.994566e-001, 8.003874e-001, 8.012885e-001, 8.021752e-001, 8.030619e-001, 8.039487e-001, 8.048354e-001, 8.057221e-001, 8.065842e-001, 8.074355e-001,
+8.082868e-001, 8.091381e-001, 8.099894e-001, 8.108407e-001, 8.116824e-001, 8.125190e-001, 8.133556e-001, 8.141923e-001, 8.150289e-001, 8.158655e-001,
+8.166936e-001, 8.175145e-001, 8.183355e-001, 8.191564e-001, 8.199774e-001, 8.207983e-001, 8.216100e-001, 8.224059e-001, 8.232019e-001, 8.239978e-001,
+8.247938e-001, 8.255898e-001, 8.263819e-001, 8.271486e-001, 8.279152e-001, 8.286819e-001, 8.294485e-001, 8.302152e-001, 8.309819e-001, 8.317355e-001,
+8.324862e-001, 8.332369e-001, 8.339877e-001, 8.347384e-001, 8.354892e-001, 8.362295e-001, 8.369569e-001, 8.376843e-001, 8.384117e-001, 8.391390e-001,
+8.398664e-001, 8.405938e-001, 8.413041e-001, 8.420143e-001, 8.427246e-001, 8.434349e-001, 8.441451e-001, 8.448554e-001, 8.455567e-001, 8.462482e-001,
+8.469398e-001, 8.476314e-001, 8.483230e-001, 8.490145e-001, 8.497061e-001, 8.503819e-001, 8.510559e-001, 8.517298e-001, 8.524037e-001, 8.530777e-001,
+8.537516e-001, 8.544243e-001, 8.550929e-001, 8.557615e-001, 8.564301e-001, 8.570986e-001, 8.577672e-001, 8.584358e-001, 8.590923e-001, 8.597367e-001,
+8.603812e-001, 8.610257e-001, 8.616701e-001, 8.623146e-001, 8.629591e-001, 8.635930e-001, 8.642224e-001, 8.648518e-001, 8.654812e-001, 8.661106e-001,
+8.667400e-001, 8.673694e-001, 8.679876e-001, 8.686034e-001, 8.692192e-001, 8.698350e-001, 8.704508e-001, 8.710666e-001, 8.716825e-001, 8.722918e-001,
+8.729002e-001, 8.735086e-001, 8.741170e-001, 8.747254e-001, 8.753338e-001, 8.759422e-001, 8.765338e-001, 8.771222e-001, 8.777105e-001, 8.782989e-001,
+8.788873e-001, 8.794757e-001, 8.800640e-001, 8.806304e-001, 8.811890e-001, 8.817476e-001, 8.823062e-001, 8.828648e-001, 8.834234e-001, 8.839820e-001,
+8.845335e-001, 8.850794e-001, 8.856253e-001, 8.861711e-001, 8.867170e-001, 8.872629e-001, 8.878088e-001, 8.883526e-001, 8.888917e-001, 8.894308e-001,
+8.899700e-001, 8.905091e-001, 8.910482e-001, 8.915873e-001, 8.921264e-001, 8.926638e-001, 8.932011e-001, 8.937383e-001, 8.942756e-001, 8.948129e-001,
+8.953502e-001, 8.958875e-001, 8.964194e-001, 8.969466e-001, 8.974739e-001, 8.980012e-001, 8.985285e-001, 8.990557e-001, 8.995830e-001, 9.001093e-001,
+9.006151e-001, 9.011210e-001, 9.016268e-001, 9.021327e-001, 9.026385e-001, 9.031443e-001, 9.036502e-001, 9.041492e-001, 9.046405e-001, 9.051318e-001,
+9.056231e-001, 9.061144e-001, 9.066057e-001, 9.070969e-001, 9.075882e-001, 9.080798e-001, 9.085715e-001, 9.090631e-001, 9.095547e-001, 9.100464e-001,
+9.105380e-001, 9.110297e-001, 9.115203e-001, 9.119966e-001, 9.124728e-001, 9.129491e-001, 9.134254e-001, 9.139016e-001, 9.143779e-001, 9.148542e-001,
+9.153260e-001, 9.157836e-001, 9.162412e-001, 9.166988e-001, 9.171563e-001, 9.176139e-001, 9.180715e-001, 9.185291e-001, 9.189861e-001, 9.194421e-001,
+9.198980e-001, 9.203540e-001, 9.208099e-001, 9.212658e-001, 9.217218e-001, 9.221777e-001, 9.226272e-001, 9.230634e-001, 9.234995e-001, 9.239356e-001,
+9.243717e-001, 9.248078e-001, 9.252440e-001, 9.256801e-001, 9.261130e-001, 9.265359e-001, 9.269588e-001, 9.273817e-001, 9.278045e-001, 9.282274e-001,
+9.286503e-001, 9.290731e-001, 9.294951e-001, 9.299050e-001, 9.303149e-001, 9.307247e-001, 9.311346e-001, 9.315445e-001, 9.319543e-001, 9.323642e-001,
+9.327741e-001, 9.331760e-001, 9.335759e-001, 9.339758e-001, 9.343758e-001, 9.347757e-001, 9.351757e-001, 9.355756e-001, 9.359755e-001, 9.363702e-001,
+9.367584e-001, 9.371466e-001, 9.375349e-001, 9.379231e-001, 9.383113e-001, 9.386995e-001, 9.390878e-001, 9.394758e-001, 9.398491e-001, 9.402223e-001,
+9.405955e-001, 9.409687e-001, 9.413420e-001, 9.417152e-001, 9.420884e-001, 9.424616e-001, 9.428309e-001, 9.431958e-001, 9.435608e-001, 9.439257e-001,
+9.442907e-001, 9.446556e-001, 9.450206e-001, 9.453855e-001, 9.457505e-001, 9.461066e-001, 9.464613e-001, 9.468160e-001, 9.471706e-001, 9.475253e-001,
+9.478799e-001, 9.482346e-001, 9.485892e-001, 9.489435e-001, 9.492951e-001, 9.496467e-001, 9.499983e-001, 9.503500e-001, 9.507016e-001, 9.510532e-001,
+9.514048e-001, 9.517564e-001, 9.521071e-001, 9.524558e-001, 9.528045e-001, 9.531532e-001, 9.535019e-001, 9.538506e-001, 9.541994e-001, 9.545481e-001,
+9.548968e-001, 9.552431e-001, 9.555862e-001, 9.559292e-001, 9.562722e-001, 9.566152e-001, 9.569582e-001, 9.573013e-001, 9.576443e-001, 9.579873e-001,
+9.583258e-001, 9.586578e-001, 9.589898e-001, 9.593218e-001, 9.596538e-001, 9.599857e-001, 9.603177e-001, 9.606497e-001, 9.609817e-001, 9.613105e-001,
+9.616319e-001, 9.619533e-001, 9.622747e-001, 9.625961e-001, 9.629175e-001, 9.632390e-001, 9.635604e-001, 9.638818e-001, 9.642020e-001, 9.645113e-001,
+9.648205e-001, 9.651298e-001, 9.654391e-001, 9.657483e-001, 9.660576e-001, 9.663669e-001, 9.666761e-001, 9.669854e-001, 9.672716e-001, 9.675519e-001,
+9.678322e-001, 9.681125e-001, 9.683928e-001, 9.686730e-001, 9.689533e-001, 9.692336e-001, 9.695139e-001, 9.697944e-001, 9.700751e-001, 9.703558e-001,
+9.706365e-001, 9.709172e-001, 9.711979e-001, 9.714786e-001, 9.717593e-001, 9.720400e-001, 9.723207e-001, 9.725947e-001, 9.728678e-001, 9.731410e-001,
+9.734141e-001, 9.736873e-001, 9.739604e-001, 9.742336e-001, 9.745067e-001, 9.747799e-001, 9.750474e-001, 9.753007e-001, 9.755539e-001, 9.758072e-001,
+9.760604e-001, 9.763137e-001, 9.765669e-001, 9.768202e-001, 9.770734e-001, 9.773267e-001, 9.775664e-001, 9.777958e-001, 9.780252e-001, 9.782546e-001,
+9.784840e-001, 9.787134e-001, 9.789428e-001, 9.791723e-001, 9.794017e-001, 9.796311e-001, 9.798449e-001, 9.800536e-001, 9.802622e-001, 9.804709e-001,
+9.806796e-001, 9.808882e-001, 9.810969e-001, 9.813055e-001, 9.815142e-001, 9.817229e-001, 9.819098e-001, 9.820921e-001, 9.822745e-001, 9.824568e-001,
+9.826392e-001, 9.828215e-001, 9.830038e-001, 9.831862e-001, 9.833685e-001, 9.835509e-001, 9.837235e-001, 9.838937e-001, 9.840639e-001, 9.842340e-001,
+9.844042e-001, 9.845744e-001, 9.847446e-001, 9.849147e-001, 9.850849e-001, 9.852551e-001, 9.854250e-001, 9.855948e-001, 9.857646e-001, 9.859344e-001,
+9.861043e-001, 9.862741e-001, 9.864439e-001, 9.866137e-001, 9.867835e-001, 9.869533e-001, 9.871199e-001, 9.872817e-001, 9.874434e-001, 9.876052e-001,
+9.877669e-001, 9.879287e-001, 9.880905e-001, 9.882522e-001, 9.884140e-001, 9.885757e-001, 9.887370e-001, 9.888863e-001, 9.890357e-001, 9.891851e-001,
+9.893345e-001, 9.894839e-001, 9.896332e-001, 9.897826e-001, 9.899320e-001, 9.900814e-001, 9.902308e-001, 9.903745e-001, 9.905139e-001, 9.906533e-001,
+9.907927e-001, 9.909321e-001, 9.910715e-001, 9.912109e-001, 9.913503e-001, 9.914897e-001, 9.916291e-001, 9.917685e-001, 9.919059e-001, 9.920433e-001,
+9.921807e-001, 9.923180e-001, 9.924554e-001, 9.925928e-001, 9.927302e-001, 9.928675e-001, 9.930049e-001, 9.931423e-001, 9.932782e-001, 9.934103e-001,
+9.935424e-001, 9.936744e-001, 9.938065e-001, 9.939386e-001, 9.940707e-001, 9.942028e-001, 9.943349e-001, 9.944670e-001, 9.945990e-001, 9.947275e-001,
+9.948516e-001, 9.949758e-001, 9.951000e-001, 9.952241e-001, 9.953483e-001, 9.954725e-001, 9.955966e-001, 9.957208e-001, 9.958449e-001, 9.959691e-001,
+9.960889e-001, 9.962047e-001, 9.963206e-001, 9.964364e-001, 9.965522e-001, 9.966681e-001, 9.967839e-001, 9.968997e-001, 9.970156e-001, 9.971314e-001,
+9.972472e-001, 9.973635e-001, 9.974803e-001, 9.975971e-001, 9.977139e-001, 9.978307e-001, 9.979475e-001, 9.980643e-001, 9.981811e-001, 9.982979e-001,
+9.984147e-001, 9.985315e-001, 9.986501e-001, 9.987728e-001, 9.988955e-001, 9.990182e-001, 9.991410e-001, 9.992637e-001, 9.993864e-001, 9.995091e-001,
+9.996318e-001, 9.997546e-001, 9.998773e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 400X", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.428414e-004, 7.192744e-004, 1.133544e-003, 1.578669e-003, 2.047629e-003, 2.540482e-003, 3.061650e-003, 3.612514e-003, 4.192989e-003,
+4.804370e-003, 5.449743e-003, 6.118351e-003, 6.814669e-003, 7.534067e-003, 8.295030e-003, 9.091106e-003, 9.917552e-003, 1.079048e-002, 1.170025e-002,
+1.265704e-002, 1.366483e-002, 1.470752e-002, 1.579506e-002, 1.692977e-002, 1.811037e-002, 1.933328e-002, 2.061300e-002, 2.193281e-002, 2.330886e-002,
+2.473315e-002, 2.620729e-002, 2.773597e-002, 2.932843e-002, 3.096794e-002, 3.265972e-002, 3.439374e-002, 3.619408e-002, 3.804646e-002, 3.994933e-002,
+4.191401e-002, 4.394885e-002, 4.604395e-002, 4.819847e-002, 5.041180e-002, 5.269273e-002, 5.502704e-002, 5.742648e-002, 5.988228e-002, 6.239288e-002,
+6.496544e-002, 6.760140e-002, 7.029587e-002, 7.304185e-002, 7.585191e-002, 7.873059e-002, 8.166977e-002, 8.467056e-002, 8.771869e-002, 9.082574e-002,
+9.400860e-002, 9.723533e-002, 1.005206e-001, 1.038618e-001, 1.072567e-001, 1.107104e-001, 1.142260e-001, 1.177944e-001, 1.214151e-001, 1.250821e-001,
+1.287856e-001, 1.325510e-001, 1.363651e-001, 1.402193e-001, 1.441060e-001, 1.480047e-001, 1.519187e-001, 1.558500e-001, 1.598220e-001, 1.638336e-001,
+1.678801e-001, 1.719820e-001, 1.761176e-001, 1.802734e-001, 1.844419e-001, 1.886289e-001, 1.928298e-001, 1.970760e-001, 2.013374e-001, 2.056181e-001,
+2.099272e-001, 2.142390e-001, 2.185355e-001, 2.228299e-001, 2.271223e-001, 2.314382e-001, 2.357621e-001, 2.401127e-001, 2.444832e-001, 2.488923e-001,
+2.533152e-001, 2.577490e-001, 2.621993e-001, 2.666551e-001, 2.711016e-001, 2.755473e-001, 2.799974e-001, 2.844476e-001, 2.888988e-001, 2.933452e-001,
+2.977733e-001, 3.021937e-001, 3.065907e-001, 3.109778e-001, 3.153360e-001, 3.196929e-001, 3.240458e-001, 3.283929e-001, 3.327110e-001, 3.370262e-001,
+3.413049e-001, 3.455836e-001, 3.498139e-001, 3.540414e-001, 3.582440e-001, 3.624396e-001, 3.666112e-001, 3.707656e-001, 3.749123e-001, 3.790445e-001,
+3.831718e-001, 3.872436e-001, 3.913154e-001, 3.953065e-001, 3.992744e-001, 4.032139e-001, 4.071162e-001, 4.110162e-001, 4.148718e-001, 4.187274e-001,
+4.225727e-001, 4.264119e-001, 4.302517e-001, 4.340943e-001, 4.379370e-001, 4.417563e-001, 4.455639e-001, 4.493666e-001, 4.531347e-001, 4.569029e-001,
+4.606313e-001, 4.643262e-001, 4.680210e-001, 4.716568e-001, 4.752873e-001, 4.789054e-001, 4.824861e-001, 4.860669e-001, 4.896277e-001, 4.931712e-001,
+4.967147e-001, 5.001958e-001, 5.036592e-001, 5.071226e-001, 5.105045e-001, 5.138846e-001, 5.172545e-001, 5.205571e-001, 5.238596e-001, 5.271421e-001,
+5.303608e-001, 5.335794e-001, 5.367782e-001, 5.399305e-001, 5.430827e-001, 5.462197e-001, 5.493231e-001, 5.524265e-001, 5.555045e-001, 5.585152e-001,
+5.615259e-001, 5.645241e-001, 5.674679e-001, 5.704117e-001, 5.733518e-001, 5.762203e-001, 5.790888e-001, 5.819573e-001, 5.847469e-001, 5.875238e-001,
+5.903007e-001, 5.930447e-001, 5.957688e-001, 5.984929e-001, 6.011798e-001, 6.037913e-001, 6.064027e-001, 6.090142e-001, 6.115440e-001, 6.140724e-001,
+6.166007e-001, 6.191328e-001, 6.216674e-001, 6.242021e-001, 6.267292e-001, 6.292035e-001, 6.316779e-001, 6.341522e-001, 6.366035e-001, 6.390402e-001,
+6.414769e-001, 6.439122e-001, 6.463144e-001, 6.487165e-001, 6.511187e-001, 6.535045e-001, 6.558671e-001, 6.582297e-001, 6.605922e-001, 6.629051e-001,
+6.651992e-001, 6.674933e-001, 6.697874e-001, 6.720268e-001, 6.742651e-001, 6.765033e-001, 6.787335e-001, 6.809239e-001, 6.831144e-001, 6.853048e-001,
+6.874767e-001, 6.896050e-001, 6.917333e-001, 6.938616e-001, 6.959703e-001, 6.980446e-001, 7.001190e-001, 7.021933e-001, 7.042300e-001, 7.062015e-001,
+7.081730e-001, 7.101445e-001, 7.120977e-001, 7.140085e-001, 7.159194e-001, 7.178302e-001, 7.197390e-001, 7.216380e-001, 7.235371e-001, 7.254361e-001,
+7.273351e-001, 7.291655e-001, 7.309942e-001, 7.328228e-001, 7.346515e-001, 7.364508e-001, 7.382381e-001, 7.400254e-001, 7.418126e-001, 7.435859e-001,
+7.453357e-001, 7.470855e-001, 7.488353e-001, 7.505851e-001, 7.522722e-001, 7.539573e-001, 7.556424e-001, 7.573276e-001, 7.590009e-001, 7.606621e-001,
+7.623233e-001, 7.639845e-001, 7.656457e-001, 7.672730e-001, 7.688981e-001, 7.705233e-001, 7.721485e-001, 7.737552e-001, 7.753220e-001, 7.768889e-001,
+7.784557e-001, 7.800226e-001, 7.815605e-001, 7.830803e-001, 7.846001e-001, 7.861199e-001, 7.876397e-001, 7.891362e-001, 7.906283e-001, 7.921204e-001,
+7.936125e-001, 7.951045e-001, 7.965341e-001, 7.979625e-001, 7.993910e-001, 8.008195e-001, 8.022456e-001, 8.036259e-001, 8.050063e-001, 8.063866e-001,
+8.077669e-001, 8.091464e-001, 8.105020e-001, 8.118575e-001, 8.132131e-001, 8.145686e-001, 8.159241e-001, 8.172051e-001, 8.184811e-001, 8.197571e-001,
+8.210332e-001, 8.223092e-001, 8.235438e-001, 8.247652e-001, 8.259867e-001, 8.272081e-001, 8.284296e-001, 8.296269e-001, 8.307995e-001, 8.319722e-001,
+8.331449e-001, 8.343175e-001, 8.354797e-001, 8.365803e-001, 8.376808e-001, 8.387814e-001, 8.398819e-001, 8.409825e-001, 8.420794e-001, 8.431748e-001,
+8.442702e-001, 8.453656e-001, 8.464610e-001, 8.475471e-001, 8.485909e-001, 8.496348e-001, 8.506787e-001, 8.517225e-001, 8.527664e-001, 8.537737e-001,
+8.547531e-001, 8.557325e-001, 8.567119e-001, 8.576913e-001, 8.586707e-001, 8.596334e-001, 8.605933e-001, 8.615533e-001, 8.625132e-001, 8.634732e-001,
+8.644313e-001, 8.653596e-001, 8.662879e-001, 8.672162e-001, 8.681445e-001, 8.690729e-001, 8.699941e-001, 8.708788e-001, 8.717636e-001, 8.726484e-001,
+8.735331e-001, 8.744179e-001, 8.752960e-001, 8.761417e-001, 8.769874e-001, 8.778331e-001, 8.786788e-001, 8.795245e-001, 8.803674e-001, 8.811801e-001,
+8.819929e-001, 8.828056e-001, 8.836184e-001, 8.844311e-001, 8.852439e-001, 8.860118e-001, 8.867746e-001, 8.875373e-001, 8.883000e-001, 8.890628e-001,
+8.898255e-001, 8.905583e-001, 8.912716e-001, 8.919849e-001, 8.926982e-001, 8.934116e-001, 8.941249e-001, 8.948332e-001, 8.955229e-001, 8.962127e-001,
+8.969024e-001, 8.975922e-001, 8.982819e-001, 8.989717e-001, 8.996361e-001, 9.002905e-001, 9.009450e-001, 9.015994e-001, 9.022538e-001, 9.029083e-001,
+9.035585e-001, 9.041764e-001, 9.047943e-001, 9.054122e-001, 9.060302e-001, 9.066481e-001, 9.072660e-001, 9.078579e-001, 9.084117e-001, 9.089655e-001,
+9.095193e-001, 9.100730e-001, 9.106268e-001, 9.111806e-001, 9.117125e-001, 9.122291e-001, 9.127456e-001, 9.132621e-001, 9.137787e-001, 9.142952e-001,
+9.148117e-001, 9.153102e-001, 9.157994e-001, 9.162885e-001, 9.167776e-001, 9.172668e-001, 9.177559e-001, 9.182450e-001, 9.187003e-001, 9.191343e-001,
+9.195683e-001, 9.200023e-001, 9.204363e-001, 9.208703e-001, 9.213043e-001, 9.217390e-001, 9.221746e-001, 9.226102e-001, 9.230457e-001, 9.234813e-001,
+9.239169e-001, 9.243525e-001, 9.247846e-001, 9.252012e-001, 9.256178e-001, 9.260343e-001, 9.264509e-001, 9.268675e-001, 9.272841e-001, 9.277006e-001,
+9.280946e-001, 9.284824e-001, 9.288702e-001, 9.292580e-001, 9.296458e-001, 9.300336e-001, 9.304215e-001, 9.308113e-001, 9.312064e-001, 9.316015e-001,
+9.319966e-001, 9.323917e-001, 9.327868e-001, 9.331819e-001, 9.335770e-001, 9.339686e-001, 9.343582e-001, 9.347478e-001, 9.351374e-001, 9.355270e-001,
+9.359166e-001, 9.363062e-001, 9.366958e-001, 9.370885e-001, 9.374816e-001, 9.378747e-001, 9.382678e-001, 9.386609e-001, 9.390540e-001, 9.394471e-001,
+9.398402e-001, 9.402080e-001, 9.405754e-001, 9.409429e-001, 9.413103e-001, 9.416777e-001, 9.420451e-001, 9.424126e-001, 9.427800e-001, 9.431212e-001,
+9.434616e-001, 9.438020e-001, 9.441424e-001, 9.444829e-001, 9.448233e-001, 9.451637e-001, 9.455041e-001, 9.458434e-001, 9.461824e-001, 9.465214e-001,
+9.468604e-001, 9.471994e-001, 9.475385e-001, 9.478775e-001, 9.482165e-001, 9.485536e-001, 9.488891e-001, 9.492246e-001, 9.495601e-001, 9.498956e-001,
+9.502310e-001, 9.505665e-001, 9.509020e-001, 9.512334e-001, 9.515367e-001, 9.518401e-001, 9.521435e-001, 9.524468e-001, 9.527502e-001, 9.530536e-001,
+9.533570e-001, 9.536603e-001, 9.539365e-001, 9.541926e-001, 9.544487e-001, 9.547049e-001, 9.549610e-001, 9.552171e-001, 9.554733e-001, 9.557294e-001,
+9.559856e-001, 9.562344e-001, 9.564823e-001, 9.567301e-001, 9.569780e-001, 9.572259e-001, 9.574738e-001, 9.577217e-001, 9.579695e-001, 9.582171e-001,
+9.584597e-001, 9.587022e-001, 9.589447e-001, 9.591872e-001, 9.594297e-001, 9.596722e-001, 9.599147e-001, 9.601572e-001, 9.603989e-001, 9.606298e-001,
+9.608606e-001, 9.610915e-001, 9.613224e-001, 9.615533e-001, 9.617842e-001, 9.620150e-001, 9.622459e-001, 9.624768e-001, 9.627114e-001, 9.629463e-001,
+9.631811e-001, 9.634159e-001, 9.636507e-001, 9.638856e-001, 9.641204e-001, 9.643552e-001, 9.645901e-001, 9.648158e-001, 9.650372e-001, 9.652586e-001,
+9.654801e-001, 9.657015e-001, 9.659229e-001, 9.661443e-001, 9.663657e-001, 9.665871e-001, 9.668062e-001, 9.670186e-001, 9.672309e-001, 9.674432e-001,
+9.676555e-001, 9.678679e-001, 9.680802e-001, 9.682925e-001, 9.685048e-001, 9.687172e-001, 9.689158e-001, 9.691077e-001, 9.692997e-001, 9.694917e-001,
+9.696837e-001, 9.698756e-001, 9.700676e-001, 9.702596e-001, 9.704516e-001, 9.706435e-001, 9.708372e-001, 9.710310e-001, 9.712248e-001, 9.714186e-001,
+9.716124e-001, 9.718062e-001, 9.720000e-001, 9.721938e-001, 9.723876e-001, 9.725819e-001, 9.727863e-001, 9.729906e-001, 9.731949e-001, 9.733993e-001,
+9.736036e-001, 9.738079e-001, 9.740122e-001, 9.742166e-001, 9.744209e-001, 9.746252e-001, 9.748240e-001, 9.750227e-001, 9.752214e-001, 9.754202e-001,
+9.756189e-001, 9.758176e-001, 9.760163e-001, 9.762151e-001, 9.764138e-001, 9.766125e-001, 9.767935e-001, 9.769693e-001, 9.771451e-001, 9.773209e-001,
+9.774967e-001, 9.776725e-001, 9.778483e-001, 9.780241e-001, 9.781999e-001, 9.783757e-001, 9.785385e-001, 9.786811e-001, 9.788236e-001, 9.789662e-001,
+9.791087e-001, 9.792513e-001, 9.793938e-001, 9.795364e-001, 9.796789e-001, 9.798215e-001, 9.799640e-001, 9.800882e-001, 9.802088e-001, 9.803295e-001,
+9.804501e-001, 9.805707e-001, 9.806914e-001, 9.808120e-001, 9.809326e-001, 9.810533e-001, 9.811739e-001, 9.812928e-001, 9.813982e-001, 9.815035e-001,
+9.816088e-001, 9.817141e-001, 9.818194e-001, 9.819247e-001, 9.820300e-001, 9.821353e-001, 9.822406e-001, 9.823459e-001, 9.824468e-001, 9.825309e-001,
+9.826151e-001, 9.826992e-001, 9.827833e-001, 9.828675e-001, 9.829516e-001, 9.830357e-001, 9.831198e-001, 9.832040e-001, 9.832881e-001, 9.833708e-001,
+9.834440e-001, 9.835173e-001, 9.835905e-001, 9.836637e-001, 9.837369e-001, 9.838102e-001, 9.838834e-001, 9.839566e-001, 9.840299e-001, 9.841031e-001,
+9.841763e-001, 9.842556e-001, 9.843357e-001, 9.844158e-001, 9.844959e-001, 9.845761e-001, 9.846562e-001, 9.847363e-001, 9.848165e-001, 9.848966e-001,
+9.849767e-001, 9.850568e-001, 9.851420e-001, 9.852340e-001, 9.853259e-001, 9.854179e-001, 9.855099e-001, 9.856018e-001, 9.856938e-001, 9.857857e-001,
+9.858777e-001, 9.859697e-001, 9.860616e-001, 9.861536e-001, 9.862488e-001, 9.863448e-001, 9.864409e-001, 9.865369e-001, 9.866329e-001, 9.867290e-001,
+9.868250e-001, 9.869210e-001, 9.870171e-001, 9.871131e-001, 9.872091e-001, 9.873052e-001, 9.874122e-001, 9.875195e-001, 9.876268e-001, 9.877340e-001,
+9.878413e-001, 9.879486e-001, 9.880559e-001, 9.881631e-001, 9.882704e-001, 9.883777e-001, 9.884850e-001, 9.885923e-001, 9.887036e-001, 9.888151e-001,
+9.889265e-001, 9.890380e-001, 9.891495e-001, 9.892610e-001, 9.893725e-001, 9.894839e-001, 9.895954e-001, 9.897069e-001, 9.898184e-001, 9.899299e-001,
+9.900401e-001, 9.901499e-001, 9.902598e-001, 9.903696e-001, 9.904795e-001, 9.905893e-001, 9.906991e-001, 9.908090e-001, 9.909188e-001, 9.910287e-001,
+9.911385e-001, 9.912483e-001, 9.913557e-001, 9.914583e-001, 9.915609e-001, 9.916635e-001, 9.917661e-001, 9.918687e-001, 9.919713e-001, 9.920739e-001,
+9.921765e-001, 9.922791e-001, 9.923817e-001, 9.924843e-001, 9.925869e-001, 9.926796e-001, 9.927687e-001, 9.928579e-001, 9.929470e-001, 9.930362e-001,
+9.931253e-001, 9.932145e-001, 9.933036e-001, 9.933928e-001, 9.934819e-001, 9.935711e-001, 9.936602e-001, 9.937494e-001, 9.938194e-001, 9.938878e-001,
+9.939562e-001, 9.940246e-001, 9.940930e-001, 9.941615e-001, 9.942299e-001, 9.942983e-001, 9.943667e-001, 9.944351e-001, 9.945035e-001, 9.945720e-001,
+9.946404e-001, 9.946832e-001, 9.947232e-001, 9.947632e-001, 9.948033e-001, 9.948433e-001, 9.948833e-001, 9.949233e-001, 9.949633e-001, 9.950033e-001,
+9.950433e-001, 9.950834e-001, 9.951234e-001, 9.951634e-001, 9.951839e-001, 9.951947e-001, 9.952054e-001, 9.952161e-001, 9.952269e-001, 9.952376e-001,
+9.952483e-001, 9.952590e-001, 9.952698e-001, 9.952805e-001, 9.952912e-001, 9.953020e-001, 9.953127e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001,
+9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001,
+9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001,
+9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001,
+9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953212e-001, 9.953224e-001,
+9.953249e-001, 9.953273e-001, 9.953298e-001, 9.953323e-001, 9.953347e-001, 9.953372e-001, 9.953396e-001, 9.953421e-001, 9.953445e-001, 9.953470e-001,
+9.953494e-001, 9.953519e-001, 9.953543e-001, 9.953568e-001, 9.953592e-001, 9.953617e-001, 9.953642e-001, 9.953666e-001, 9.953691e-001, 9.953715e-001,
+9.953740e-001, 9.953764e-001, 9.953789e-001, 9.953813e-001, 9.953838e-001, 9.953862e-001, 9.953887e-001, 9.953912e-001, 9.953936e-001, 9.953961e-001,
+9.953985e-001, 9.954010e-001, 9.954034e-001, 9.954059e-001, 9.954083e-001, 9.954108e-001, 9.954132e-001, 9.954157e-001, 9.954181e-001, 9.954206e-001,
+9.954231e-001, 9.954255e-001, 9.954280e-001, 9.954304e-001, 9.954329e-001, 9.954353e-001, 9.954378e-001, 9.954402e-001, 9.954427e-001, 9.954451e-001,
+9.954476e-001, 9.954500e-001, 9.954525e-001, 9.954550e-001, 9.954574e-001, 9.954599e-001, 9.954623e-001, 9.954648e-001, 9.954801e-001, 9.955012e-001,
+9.955222e-001, 9.955432e-001, 9.955642e-001, 9.955853e-001, 9.956063e-001, 9.956273e-001, 9.956483e-001, 9.956693e-001, 9.956904e-001, 9.957114e-001,
+9.957324e-001, 9.957534e-001, 9.957744e-001, 9.957994e-001, 9.958306e-001, 9.958618e-001, 9.958930e-001, 9.959242e-001, 9.959553e-001, 9.959865e-001,
+9.960177e-001, 9.960489e-001, 9.960801e-001, 9.961113e-001, 9.961425e-001, 9.961737e-001, 9.962049e-001, 9.962361e-001, 9.962673e-001, 9.963044e-001,
+9.963428e-001, 9.963811e-001, 9.964195e-001, 9.964578e-001, 9.964962e-001, 9.965345e-001, 9.965729e-001, 9.966112e-001, 9.966496e-001, 9.966879e-001,
+9.967263e-001, 9.967646e-001, 9.968030e-001, 9.968413e-001, 9.968797e-001, 9.969286e-001, 9.969775e-001, 9.970264e-001, 9.970752e-001, 9.971241e-001,
+9.971730e-001, 9.972219e-001, 9.972707e-001, 9.973196e-001, 9.973685e-001, 9.974174e-001, 9.974662e-001, 9.975151e-001, 9.975640e-001, 9.976129e-001,
+9.976617e-001, 9.977236e-001, 9.977864e-001, 9.978492e-001, 9.979120e-001, 9.979748e-001, 9.980376e-001, 9.981004e-001, 9.981632e-001, 9.982260e-001,
+9.982887e-001, 9.983515e-001, 9.984143e-001, 9.984771e-001, 9.985399e-001, 9.986027e-001, 9.986655e-001, 9.987379e-001, 9.988168e-001, 9.988957e-001,
+9.989746e-001, 9.990535e-001, 9.991323e-001, 9.992112e-001, 9.992901e-001, 9.993690e-001, 9.994478e-001, 9.995267e-001, 9.996056e-001, 9.996845e-001,
+9.997634e-001, 9.998422e-001, 9.999211e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.644671e-004, 5.423503e-004, 8.326409e-004, 1.143341e-003, 1.479944e-003, 1.829878e-003, 2.194684e-003, 2.573521e-003, 2.968688e-003,
+3.376778e-003, 3.804361e-003, 4.249344e-003, 4.714355e-003, 5.196753e-003, 5.705664e-003, 6.249654e-003, 6.820475e-003, 7.421147e-003, 8.048300e-003,
+8.700337e-003, 9.382917e-003, 1.010656e-002, 1.085558e-002, 1.163110e-002, 1.243878e-002, 1.327600e-002, 1.414133e-002, 1.504378e-002, 1.598557e-002,
+1.695058e-002, 1.793695e-002, 1.895590e-002, 2.002548e-002, 2.111078e-002, 2.222191e-002, 2.336899e-002, 2.455786e-002, 2.577280e-002, 2.700755e-002,
+2.827460e-002, 2.960800e-002, 3.098768e-002, 3.238783e-002, 3.381527e-002, 3.528005e-002, 3.679008e-002, 3.833531e-002, 3.989858e-002, 4.148419e-002,
+4.311714e-002, 4.481697e-002, 4.657117e-002, 4.834803e-002, 5.015042e-002, 5.199584e-002, 5.388944e-002, 5.583315e-002, 5.781234e-002, 5.981011e-002,
+6.182896e-002, 6.390703e-002, 6.603147e-002, 6.820742e-002, 7.043477e-002, 7.269762e-002, 7.497832e-002, 7.729185e-002, 7.964813e-002, 8.208989e-002,
+8.457602e-002, 8.708898e-002, 8.962135e-002, 9.218224e-002, 9.477218e-002, 9.739589e-002, 1.000885e-001, 1.028293e-001, 1.056242e-001, 1.084792e-001,
+1.113489e-001, 1.142351e-001, 1.171705e-001, 1.201329e-001, 1.231522e-001, 1.262086e-001, 1.292911e-001, 1.324020e-001, 1.355181e-001, 1.386441e-001,
+1.417902e-001, 1.449522e-001, 1.481644e-001, 1.513927e-001, 1.547018e-001, 1.580224e-001, 1.613737e-001, 1.647437e-001, 1.681363e-001, 1.715582e-001,
+1.749991e-001, 1.784824e-001, 1.819818e-001, 1.855380e-001, 1.891071e-001, 1.927215e-001, 1.963424e-001, 2.000226e-001, 2.037090e-001, 2.073960e-001,
+2.110830e-001, 2.147787e-001, 2.184758e-001, 2.221865e-001, 2.259006e-001, 2.296067e-001, 2.333092e-001, 2.370096e-001, 2.407082e-001, 2.444002e-001,
+2.480811e-001, 2.517619e-001, 2.554424e-001, 2.591229e-001, 2.627831e-001, 2.664416e-001, 2.701123e-001, 2.737898e-001, 2.774769e-001, 2.811842e-001,
+2.848914e-001, 2.885521e-001, 2.922113e-001, 2.958714e-001, 2.995322e-001, 3.031899e-001, 3.068281e-001, 3.104662e-001, 3.140855e-001, 3.176954e-001,
+3.213038e-001, 3.249039e-001, 3.285040e-001, 3.320691e-001, 3.356105e-001, 3.391518e-001, 3.426533e-001, 3.461548e-001, 3.496446e-001, 3.531137e-001,
+3.565828e-001, 3.600330e-001, 3.634742e-001, 3.669154e-001, 3.703399e-001, 3.737635e-001, 3.771829e-001, 3.805834e-001, 3.839838e-001, 3.873958e-001,
+3.908276e-001, 3.942595e-001, 3.976673e-001, 4.010519e-001, 4.044364e-001, 4.077871e-001, 4.111150e-001, 4.144430e-001, 4.177626e-001, 4.210774e-001,
+4.243923e-001, 4.276579e-001, 4.308959e-001, 4.341339e-001, 4.373330e-001, 4.405049e-001, 4.436768e-001, 4.468129e-001, 4.499110e-001, 4.530091e-001,
+4.560930e-001, 4.591484e-001, 4.622037e-001, 4.652596e-001, 4.683186e-001, 4.713775e-001, 4.744365e-001, 4.774442e-001, 4.804444e-001, 4.834446e-001,
+4.864538e-001, 4.894700e-001, 4.924863e-001, 4.954943e-001, 4.984689e-001, 5.014435e-001, 5.044181e-001, 5.073412e-001, 5.102498e-001, 5.131584e-001,
+5.160554e-001, 5.189261e-001, 5.217969e-001, 5.246677e-001, 5.274787e-001, 5.302724e-001, 5.330661e-001, 5.358421e-001, 5.385412e-001, 5.412403e-001,
+5.439393e-001, 5.465759e-001, 5.491590e-001, 5.517422e-001, 5.543253e-001, 5.568908e-001, 5.594527e-001, 5.620147e-001, 5.645741e-001, 5.670987e-001,
+5.696233e-001, 5.721479e-001, 5.746628e-001, 5.771466e-001, 5.796304e-001, 5.821142e-001, 5.846081e-001, 5.871209e-001, 5.896338e-001, 5.921466e-001,
+5.946517e-001, 5.971448e-001, 5.996379e-001, 6.021310e-001, 6.046125e-001, 6.070746e-001, 6.095366e-001, 6.119987e-001, 6.144392e-001, 6.168267e-001,
+6.192143e-001, 6.216018e-001, 6.239740e-001, 6.262511e-001, 6.285282e-001, 6.308054e-001, 6.330825e-001, 6.352655e-001, 6.374403e-001, 6.396151e-001,
+6.417900e-001, 6.438944e-001, 6.459581e-001, 6.480217e-001, 6.500853e-001, 6.521360e-001, 6.541525e-001, 6.561690e-001, 6.581856e-001, 6.602021e-001,
+6.621177e-001, 6.640152e-001, 6.659126e-001, 6.678101e-001, 6.696809e-001, 6.715017e-001, 6.733225e-001, 6.751433e-001, 6.769641e-001, 6.787366e-001,
+6.804948e-001, 6.822531e-001, 6.840113e-001, 6.857655e-001, 6.874911e-001, 6.892166e-001, 6.909422e-001, 6.926677e-001, 6.943894e-001, 6.961052e-001,
+6.978209e-001, 6.995367e-001, 7.012524e-001, 7.029502e-001, 7.046360e-001, 7.063217e-001, 7.080074e-001, 7.096932e-001, 7.113500e-001, 7.129955e-001,
+7.146411e-001, 7.162866e-001, 7.179322e-001, 7.195677e-001, 7.212001e-001, 7.228324e-001, 7.244648e-001, 7.260971e-001, 7.276835e-001, 7.292519e-001,
+7.308204e-001, 7.323888e-001, 7.339572e-001, 7.355171e-001, 7.370711e-001, 7.386251e-001, 7.401791e-001, 7.417331e-001, 7.432689e-001, 7.447763e-001,
+7.462838e-001, 7.477912e-001, 7.492986e-001, 7.507972e-001, 7.522162e-001, 7.536353e-001, 7.550544e-001, 7.564735e-001, 7.578925e-001, 7.592418e-001,
+7.605644e-001, 7.618870e-001, 7.632096e-001, 7.645322e-001, 7.658464e-001, 7.671361e-001, 7.684259e-001, 7.697157e-001, 7.710055e-001, 7.722952e-001,
+7.735280e-001, 7.747368e-001, 7.759457e-001, 7.771545e-001, 7.783633e-001, 7.795685e-001, 7.807170e-001, 7.818654e-001, 7.830139e-001, 7.841623e-001,
+7.853107e-001, 7.864532e-001, 7.875833e-001, 7.887134e-001, 7.898434e-001, 7.909735e-001, 7.921036e-001, 7.932408e-001, 7.943855e-001, 7.955302e-001,
+7.966749e-001, 7.978195e-001, 7.989642e-001, 8.000708e-001, 8.011485e-001, 8.022263e-001, 8.033040e-001, 8.043817e-001, 8.054594e-001, 8.065189e-001,
+8.075633e-001, 8.086077e-001, 8.096521e-001, 8.106965e-001, 8.117409e-001, 8.127887e-001, 8.138411e-001, 8.148935e-001, 8.159459e-001, 8.169983e-001,
+8.180507e-001, 8.190910e-001, 8.200847e-001, 8.210783e-001, 8.220720e-001, 8.230657e-001, 8.240593e-001, 8.250530e-001, 8.260309e-001, 8.270068e-001,
+8.279826e-001, 8.289585e-001, 8.299343e-001, 8.309102e-001, 8.318813e-001, 8.328470e-001, 8.338126e-001, 8.347782e-001, 8.357439e-001, 8.367095e-001,
+8.376751e-001, 8.385697e-001, 8.394592e-001, 8.403486e-001, 8.412380e-001, 8.421275e-001, 8.430169e-001, 8.438990e-001, 8.447636e-001, 8.456281e-001,
+8.464927e-001, 8.473573e-001, 8.482219e-001, 8.490865e-001, 8.499293e-001, 8.507545e-001, 8.515797e-001, 8.524049e-001, 8.532301e-001, 8.540553e-001,
+8.548805e-001, 8.557092e-001, 8.565393e-001, 8.573695e-001, 8.581997e-001, 8.590299e-001, 8.598600e-001, 8.606902e-001, 8.614908e-001, 8.622807e-001,
+8.630706e-001, 8.638605e-001, 8.646503e-001, 8.654402e-001, 8.662301e-001, 8.670080e-001, 8.677797e-001, 8.685514e-001, 8.693230e-001, 8.700947e-001,
+8.708663e-001, 8.716380e-001, 8.723940e-001, 8.731314e-001, 8.738688e-001, 8.746062e-001, 8.753437e-001, 8.760811e-001, 8.768185e-001, 8.775456e-001,
+8.782122e-001, 8.788789e-001, 8.795455e-001, 8.802122e-001, 8.808789e-001, 8.815455e-001, 8.822122e-001, 8.828688e-001, 8.835215e-001, 8.841741e-001,
+8.848268e-001, 8.854794e-001, 8.861320e-001, 8.867847e-001, 8.874309e-001, 8.880440e-001, 8.886572e-001, 8.892703e-001, 8.898835e-001, 8.904966e-001,
+8.911098e-001, 8.917229e-001, 8.923314e-001, 8.929349e-001, 8.935384e-001, 8.941419e-001, 8.947455e-001, 8.953490e-001, 8.959525e-001, 8.965560e-001,
+8.971522e-001, 8.977450e-001, 8.983378e-001, 8.989306e-001, 8.995234e-001, 9.001162e-001, 9.007090e-001, 9.013018e-001, 9.018632e-001, 9.024147e-001,
+9.029661e-001, 9.035176e-001, 9.040690e-001, 9.046205e-001, 9.051719e-001, 9.057234e-001, 9.062736e-001, 9.068232e-001, 9.073728e-001, 9.079225e-001,
+9.084721e-001, 9.090218e-001, 9.095714e-001, 9.101210e-001, 9.106593e-001, 9.111869e-001, 9.117144e-001, 9.122419e-001, 9.127694e-001, 9.132969e-001,
+9.138244e-001, 9.143519e-001, 9.148817e-001, 9.154210e-001, 9.159604e-001, 9.164998e-001, 9.170392e-001, 9.175785e-001, 9.181179e-001, 9.186573e-001,
+9.191967e-001, 9.197020e-001, 9.201950e-001, 9.206879e-001, 9.211808e-001, 9.216738e-001, 9.221667e-001, 9.226596e-001, 9.231525e-001, 9.236371e-001,
+9.240685e-001, 9.244999e-001, 9.249312e-001, 9.253626e-001, 9.257940e-001, 9.262254e-001, 9.266567e-001, 9.270881e-001, 9.275092e-001, 9.279150e-001,
+9.283208e-001, 9.287265e-001, 9.291323e-001, 9.295380e-001, 9.299438e-001, 9.303496e-001, 9.307553e-001, 9.311472e-001, 9.315264e-001, 9.319056e-001,
+9.322848e-001, 9.326640e-001, 9.330431e-001, 9.334223e-001, 9.338015e-001, 9.341807e-001, 9.345544e-001, 9.349226e-001, 9.352908e-001, 9.356589e-001,
+9.360271e-001, 9.363953e-001, 9.367635e-001, 9.371317e-001, 9.374999e-001, 9.378612e-001, 9.382085e-001, 9.385558e-001, 9.389031e-001, 9.392504e-001,
+9.395977e-001, 9.399450e-001, 9.402923e-001, 9.406396e-001, 9.409869e-001, 9.413303e-001, 9.416738e-001, 9.420172e-001, 9.423607e-001, 9.427041e-001,
+9.430476e-001, 9.433910e-001, 9.437345e-001, 9.440779e-001, 9.444156e-001, 9.447483e-001, 9.450810e-001, 9.454137e-001, 9.457464e-001, 9.460790e-001,
+9.464117e-001, 9.467444e-001, 9.470771e-001, 9.474098e-001, 9.477066e-001, 9.479999e-001, 9.482931e-001, 9.485863e-001, 9.488795e-001, 9.491727e-001,
+9.494659e-001, 9.497591e-001, 9.500523e-001, 9.503494e-001, 9.506735e-001, 9.509977e-001, 9.513219e-001, 9.516460e-001, 9.519702e-001, 9.522943e-001,
+9.526185e-001, 9.529427e-001, 9.532668e-001, 9.535914e-001, 9.539176e-001, 9.542438e-001, 9.545700e-001, 9.548962e-001, 9.552224e-001, 9.555486e-001,
+9.558748e-001, 9.562010e-001, 9.565272e-001, 9.568511e-001, 9.571460e-001, 9.574409e-001, 9.577359e-001, 9.580308e-001, 9.583257e-001, 9.586207e-001,
+9.589156e-001, 9.592105e-001, 9.595055e-001, 9.598004e-001, 9.600865e-001, 9.603704e-001, 9.606543e-001, 9.609383e-001, 9.612222e-001, 9.615061e-001,
+9.617901e-001, 9.620740e-001, 9.623579e-001, 9.626419e-001, 9.629205e-001, 9.631900e-001, 9.634596e-001, 9.637291e-001, 9.639986e-001, 9.642681e-001,
+9.645377e-001, 9.648072e-001, 9.650767e-001, 9.653462e-001, 9.656158e-001, 9.658737e-001, 9.661280e-001, 9.663822e-001, 9.666365e-001, 9.668908e-001,
+9.671451e-001, 9.673993e-001, 9.676536e-001, 9.679079e-001, 9.681622e-001, 9.684164e-001, 9.686573e-001, 9.688979e-001, 9.691385e-001, 9.693791e-001,
+9.696197e-001, 9.698603e-001, 9.701010e-001, 9.703416e-001, 9.705822e-001, 9.708228e-001, 9.710630e-001, 9.712887e-001, 9.715144e-001, 9.717401e-001,
+9.719657e-001, 9.721914e-001, 9.724171e-001, 9.726428e-001, 9.728684e-001, 9.730941e-001, 9.733198e-001, 9.735455e-001, 9.737340e-001, 9.739178e-001,
+9.741016e-001, 9.742854e-001, 9.744691e-001, 9.746529e-001, 9.748367e-001, 9.750205e-001, 9.752043e-001, 9.753881e-001, 9.755719e-001, 9.757250e-001,
+9.758548e-001, 9.759847e-001, 9.761146e-001, 9.762445e-001, 9.763744e-001, 9.765042e-001, 9.766341e-001, 9.767640e-001, 9.768939e-001, 9.770238e-001,
+9.771536e-001, 9.772823e-001, 9.774110e-001, 9.775398e-001, 9.776685e-001, 9.777972e-001, 9.779259e-001, 9.780547e-001, 9.781834e-001, 9.783121e-001,
+9.784409e-001, 9.785696e-001, 9.787037e-001, 9.788468e-001, 9.789899e-001, 9.791330e-001, 9.792761e-001, 9.794192e-001, 9.795622e-001, 9.797053e-001,
+9.798484e-001, 9.799915e-001, 9.801346e-001, 9.802777e-001, 9.804212e-001, 9.805651e-001, 9.807090e-001, 9.808530e-001, 9.809969e-001, 9.811409e-001,
+9.812848e-001, 9.814287e-001, 9.815727e-001, 9.817166e-001, 9.818606e-001, 9.820045e-001, 9.821480e-001, 9.822907e-001, 9.824335e-001, 9.825763e-001,
+9.827191e-001, 9.828619e-001, 9.830047e-001, 9.831475e-001, 9.832903e-001, 9.834331e-001, 9.835759e-001, 9.837187e-001, 9.838594e-001, 9.839886e-001,
+9.841178e-001, 9.842471e-001, 9.843763e-001, 9.845056e-001, 9.846348e-001, 9.847641e-001, 9.848933e-001, 9.850226e-001, 9.851518e-001, 9.852811e-001,
+9.854103e-001, 9.855383e-001, 9.856657e-001, 9.857931e-001, 9.859205e-001, 9.860478e-001, 9.861752e-001, 9.863026e-001, 9.864300e-001, 9.865574e-001,
+9.866847e-001, 9.868121e-001, 9.869395e-001, 9.870668e-001, 9.871831e-001, 9.872994e-001, 9.874157e-001, 9.875320e-001, 9.876484e-001, 9.877647e-001,
+9.878810e-001, 9.879973e-001, 9.881136e-001, 9.882299e-001, 9.883463e-001, 9.884626e-001, 9.885760e-001, 9.886701e-001, 9.887642e-001, 9.888582e-001,
+9.889523e-001, 9.890464e-001, 9.891405e-001, 9.892346e-001, 9.893286e-001, 9.894227e-001, 9.895168e-001, 9.896109e-001, 9.897050e-001, 9.897977e-001,
+9.898560e-001, 9.899143e-001, 9.899726e-001, 9.900309e-001, 9.900892e-001, 9.901475e-001, 9.902058e-001, 9.902641e-001, 9.903224e-001, 9.903807e-001,
+9.904391e-001, 9.904974e-001, 9.905557e-001, 9.905830e-001, 9.905992e-001, 9.906154e-001, 9.906316e-001, 9.906478e-001, 9.906640e-001, 9.906801e-001,
+9.906963e-001, 9.907125e-001, 9.907287e-001, 9.907449e-001, 9.907611e-001, 9.907773e-001, 9.907947e-001, 9.908166e-001, 9.908384e-001, 9.908603e-001,
+9.908822e-001, 9.909041e-001, 9.909260e-001, 9.909479e-001, 9.909698e-001, 9.909917e-001, 9.910136e-001, 9.910355e-001, 9.910574e-001, 9.910793e-001,
+9.911092e-001, 9.911482e-001, 9.911871e-001, 9.912261e-001, 9.912650e-001, 9.913040e-001, 9.913429e-001, 9.913819e-001, 9.914208e-001, 9.914598e-001,
+9.914987e-001, 9.915377e-001, 9.915766e-001, 9.916156e-001, 9.916596e-001, 9.917086e-001, 9.917576e-001, 9.918066e-001, 9.918555e-001, 9.919045e-001,
+9.919535e-001, 9.920025e-001, 9.920515e-001, 9.921004e-001, 9.921494e-001, 9.921984e-001, 9.922474e-001, 9.922964e-001, 9.923472e-001, 9.924021e-001,
+9.924571e-001, 9.925120e-001, 9.925670e-001, 9.926219e-001, 9.926769e-001, 9.927318e-001, 9.927868e-001, 9.928417e-001, 9.928967e-001, 9.929516e-001,
+9.930066e-001, 9.930615e-001, 9.931165e-001, 9.931734e-001, 9.932305e-001, 9.932877e-001, 9.933448e-001, 9.934020e-001, 9.934591e-001, 9.935163e-001,
+9.935734e-001, 9.936306e-001, 9.936877e-001, 9.937449e-001, 9.938020e-001, 9.938592e-001, 9.939163e-001, 9.939728e-001, 9.940270e-001, 9.940812e-001,
+9.941354e-001, 9.941896e-001, 9.942439e-001, 9.942981e-001, 9.943523e-001, 9.944065e-001, 9.944607e-001, 9.945149e-001, 9.945691e-001, 9.946233e-001,
+9.946775e-001, 9.947317e-001, 9.947830e-001, 9.948282e-001, 9.948733e-001, 9.949185e-001, 9.949636e-001, 9.950088e-001, 9.950540e-001, 9.950991e-001,
+9.951443e-001, 9.951894e-001, 9.952346e-001, 9.952798e-001, 9.953249e-001, 9.953701e-001, 9.954152e-001, 9.954605e-001, 9.955064e-001, 9.955522e-001,
+9.955981e-001, 9.956439e-001, 9.956898e-001, 9.957356e-001, 9.957815e-001, 9.958273e-001, 9.958732e-001, 9.959190e-001, 9.959649e-001, 9.960107e-001,
+9.960566e-001, 9.961024e-001, 9.961483e-001, 9.961936e-001, 9.962387e-001, 9.962838e-001, 9.963290e-001, 9.963741e-001, 9.964193e-001, 9.964644e-001,
+9.965096e-001, 9.965547e-001, 9.965999e-001, 9.966450e-001, 9.966902e-001, 9.967353e-001, 9.967804e-001, 9.968256e-001, 9.968704e-001, 9.969135e-001,
+9.969566e-001, 9.969998e-001, 9.970429e-001, 9.970860e-001, 9.971291e-001, 9.971722e-001, 9.972153e-001, 9.972584e-001, 9.973015e-001, 9.973446e-001,
+9.973878e-001, 9.974309e-001, 9.974740e-001, 9.975171e-001, 9.975620e-001, 9.976122e-001, 9.976624e-001, 9.977126e-001, 9.977627e-001, 9.978129e-001,
+9.978631e-001, 9.979133e-001, 9.979634e-001, 9.980136e-001, 9.980638e-001, 9.981140e-001, 9.981642e-001, 9.982143e-001, 9.982645e-001, 9.983147e-001,
+9.983650e-001, 9.984163e-001, 9.984676e-001, 9.985189e-001, 9.985702e-001, 9.986215e-001, 9.986728e-001, 9.987241e-001, 9.987754e-001, 9.988267e-001,
+9.988780e-001, 9.989293e-001, 9.989806e-001, 9.990319e-001, 9.990832e-001, 9.991345e-001, 9.991858e-001, 9.992347e-001, 9.992825e-001, 9.993303e-001,
+9.993782e-001, 9.994260e-001, 9.994738e-001, 9.995217e-001, 9.995695e-001, 9.996173e-001, 9.996652e-001, 9.997130e-001, 9.997608e-001, 9.998087e-001,
+9.998565e-001, 9.999043e-001, 9.999522e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.401811e-004, 2.875368e-004, 4.389792e-004, 5.958441e-004, 7.588092e-004, 9.286210e-004, 1.106007e-003, 1.291931e-003, 1.484716e-003,
+1.685733e-003, 1.894229e-003, 2.108964e-003, 2.331549e-003, 2.564043e-003, 2.803567e-003, 3.050951e-003, 3.306744e-003, 3.572715e-003, 3.846599e-003,
+4.127434e-003, 4.419472e-003, 4.725114e-003, 5.042973e-003, 5.371153e-003, 5.711322e-003, 6.067662e-003, 6.439096e-003, 6.824102e-003, 7.219647e-003,
+7.626628e-003, 8.047517e-003, 8.481577e-003, 8.928107e-003, 9.387045e-003, 9.859276e-003, 1.034573e-002, 1.084660e-002, 1.136174e-002, 1.189109e-002,
+1.243596e-002, 1.299560e-002, 1.356903e-002, 1.416312e-002, 1.477085e-002, 1.539279e-002, 1.603092e-002, 1.668573e-002, 1.735537e-002, 1.804624e-002,
+1.874850e-002, 1.946327e-002, 2.019205e-002, 2.093907e-002, 2.170331e-002, 2.247952e-002, 2.326697e-002, 2.406751e-002, 2.489210e-002, 2.573202e-002,
+2.658614e-002, 2.746429e-002, 2.835925e-002, 2.926936e-002, 3.020356e-002, 3.115737e-002, 3.212601e-002, 3.312008e-002, 3.413177e-002, 3.515683e-002,
+3.621339e-002, 3.727991e-002, 3.836021e-002, 3.946257e-002, 4.057524e-002, 4.171355e-002, 4.286660e-002, 4.403490e-002, 4.522433e-002, 4.642090e-002,
+4.763981e-002, 4.886797e-002, 5.011595e-002, 5.138375e-002, 5.266864e-002, 5.398248e-002, 5.530717e-002, 5.667126e-002, 5.804106e-002, 5.945069e-002,
+6.086520e-002, 6.231592e-002, 6.377587e-002, 6.527575e-002, 6.678590e-002, 6.833138e-002, 6.988577e-002, 7.146989e-002, 7.306120e-002, 7.468055e-002,
+7.630599e-002, 7.796762e-002, 7.963136e-002, 8.133491e-002, 8.303846e-002, 8.476830e-002, 8.650034e-002, 8.825612e-002, 9.001939e-002, 9.179888e-002,
+9.359097e-002, 9.539603e-002, 9.722751e-002, 9.906160e-002, 1.009373e-001, 1.028130e-001, 1.047335e-001, 1.066686e-001, 1.086295e-001, 1.106277e-001,
+1.126270e-001, 1.146646e-001, 1.167022e-001, 1.187661e-001, 1.208473e-001, 1.229355e-001, 1.250668e-001, 1.271981e-001, 1.293662e-001, 1.315551e-001,
+1.337490e-001, 1.359899e-001, 1.382308e-001, 1.404815e-001, 1.427416e-001, 1.450017e-001, 1.472705e-001, 1.495405e-001, 1.518153e-001, 1.541072e-001,
+1.563991e-001, 1.586963e-001, 1.609987e-001, 1.633011e-001, 1.656249e-001, 1.679558e-001, 1.702867e-001, 1.726520e-001, 1.750191e-001, 1.773868e-001,
+1.797601e-001, 1.821334e-001, 1.845104e-001, 1.869013e-001, 1.892923e-001, 1.916885e-001, 1.940988e-001, 1.965091e-001, 1.989265e-001, 2.013620e-001,
+2.037976e-001, 2.062384e-001, 2.086958e-001, 2.111532e-001, 2.136142e-001, 2.160945e-001, 2.185747e-001, 2.210549e-001, 2.235322e-001, 2.260096e-001,
+2.284869e-001, 2.309691e-001, 2.334524e-001, 2.359357e-001, 2.384334e-001, 2.409410e-001, 2.434486e-001, 2.459537e-001, 2.484525e-001, 2.509513e-001,
+2.534501e-001, 2.559669e-001, 2.584846e-001, 2.610024e-001, 2.635214e-001, 2.660415e-001, 2.685616e-001, 2.710804e-001, 2.735868e-001, 2.760931e-001,
+2.785995e-001, 2.811084e-001, 2.836192e-001, 2.861299e-001, 2.886404e-001, 2.911295e-001, 2.936186e-001, 2.961077e-001, 2.985941e-001, 3.010762e-001,
+3.035584e-001, 3.060405e-001, 3.085111e-001, 3.109766e-001, 3.134421e-001, 3.159076e-001, 3.183634e-001, 3.208185e-001, 3.232736e-001, 3.257263e-001,
+3.281633e-001, 3.306003e-001, 3.330373e-001, 3.354707e-001, 3.378941e-001, 3.403175e-001, 3.427409e-001, 3.451600e-001, 3.475706e-001, 3.499811e-001,
+3.523916e-001, 3.547942e-001, 3.571807e-001, 3.595672e-001, 3.619538e-001, 3.643410e-001, 3.667304e-001, 3.691198e-001, 3.715091e-001, 3.738975e-001,
+3.762792e-001, 3.786609e-001, 3.810426e-001, 3.834243e-001, 3.858002e-001, 3.881757e-001, 3.905513e-001, 3.929268e-001, 3.952862e-001, 3.976376e-001,
+3.999891e-001, 4.023406e-001, 4.046814e-001, 4.070012e-001, 4.093209e-001, 4.116407e-001, 4.139604e-001, 4.162608e-001, 4.185598e-001, 4.208588e-001,
+4.231578e-001, 4.254482e-001, 4.277282e-001, 4.300082e-001, 4.322883e-001, 4.345683e-001, 4.368131e-001, 4.390539e-001, 4.412947e-001, 4.435355e-001,
+4.457657e-001, 4.479678e-001, 4.501699e-001, 4.523719e-001, 4.545740e-001, 4.567523e-001, 4.589130e-001, 4.610737e-001, 4.632344e-001, 4.653950e-001,
+4.675134e-001, 4.696210e-001, 4.717286e-001, 4.738362e-001, 4.759437e-001, 4.780164e-001, 4.800868e-001, 4.821572e-001, 4.842277e-001, 4.862979e-001,
+4.883330e-001, 4.903682e-001, 4.924034e-001, 4.944386e-001, 4.964738e-001, 4.984566e-001, 5.004389e-001, 5.024212e-001, 5.044036e-001, 5.063859e-001,
+5.083439e-001, 5.102991e-001, 5.122542e-001, 5.142093e-001, 5.161644e-001, 5.181019e-001, 5.200323e-001, 5.219627e-001, 5.238931e-001, 5.258235e-001,
+5.277478e-001, 5.296645e-001, 5.315813e-001, 5.334980e-001, 5.354147e-001, 5.373279e-001, 5.392090e-001, 5.410901e-001, 5.429711e-001, 5.448522e-001,
+5.467333e-001, 5.485992e-001, 5.504574e-001, 5.523155e-001, 5.541737e-001, 5.560318e-001, 5.578854e-001, 5.597094e-001, 5.615334e-001, 5.633574e-001,
+5.651814e-001, 5.670054e-001, 5.688126e-001, 5.706043e-001, 5.723959e-001, 5.741876e-001, 5.759792e-001, 5.777709e-001, 5.795427e-001, 5.813098e-001,
+5.830769e-001, 5.848440e-001, 5.866111e-001, 5.883778e-001, 5.900941e-001, 5.918104e-001, 5.935267e-001, 5.952431e-001, 5.969594e-001, 5.986704e-001,
+6.003401e-001, 6.020098e-001, 6.036794e-001, 6.053491e-001, 6.070188e-001, 6.086829e-001, 6.103072e-001, 6.119315e-001, 6.135558e-001, 6.151801e-001,
+6.168044e-001, 6.184267e-001, 6.199904e-001, 6.215541e-001, 6.231178e-001, 6.246815e-001, 6.262451e-001, 6.278088e-001, 6.293695e-001, 6.309296e-001,
+6.324898e-001, 6.340499e-001, 6.356101e-001, 6.371702e-001, 6.387234e-001, 6.402710e-001, 6.418186e-001, 6.433662e-001, 6.449138e-001, 6.464615e-001,
+6.480066e-001, 6.495387e-001, 6.510709e-001, 6.526030e-001, 6.541351e-001, 6.556673e-001, 6.571994e-001, 6.587041e-001, 6.601949e-001, 6.616856e-001,
+6.631764e-001, 6.646672e-001, 6.661580e-001, 6.676467e-001, 6.691030e-001, 6.705593e-001, 6.720156e-001, 6.734719e-001, 6.749282e-001, 6.763845e-001,
+6.778261e-001, 6.792403e-001, 6.806546e-001, 6.820688e-001, 6.834830e-001, 6.848973e-001, 6.863115e-001, 6.877010e-001, 6.890685e-001, 6.904361e-001,
+6.918037e-001, 6.931712e-001, 6.945388e-001, 6.959063e-001, 6.972551e-001, 6.985913e-001, 6.999275e-001, 7.012637e-001, 7.025999e-001, 7.039362e-001,
+7.052724e-001, 7.065873e-001, 7.078853e-001, 7.091832e-001, 7.104812e-001, 7.117791e-001, 7.130771e-001, 7.143750e-001, 7.156554e-001, 7.169090e-001,
+7.181627e-001, 7.194163e-001, 7.206699e-001, 7.219235e-001, 7.231772e-001, 7.244260e-001, 7.256402e-001, 7.268543e-001, 7.280684e-001, 7.292826e-001,
+7.304967e-001, 7.317108e-001, 7.329250e-001, 7.341042e-001, 7.352702e-001, 7.364362e-001, 7.376022e-001, 7.387683e-001, 7.399343e-001, 7.411003e-001,
+7.422618e-001, 7.434060e-001, 7.445503e-001, 7.456946e-001, 7.468389e-001, 7.479831e-001, 7.491274e-001, 7.502717e-001, 7.514012e-001, 7.525197e-001,
+7.536382e-001, 7.547567e-001, 7.558752e-001, 7.569937e-001, 7.581123e-001, 7.592308e-001, 7.603215e-001, 7.614058e-001, 7.624901e-001, 7.635744e-001,
+7.646587e-001, 7.657430e-001, 7.668273e-001, 7.679116e-001, 7.689800e-001, 7.700471e-001, 7.711141e-001, 7.721812e-001, 7.732483e-001, 7.743153e-001,
+7.753824e-001, 7.764495e-001, 7.774728e-001, 7.784915e-001, 7.795102e-001, 7.805289e-001, 7.815477e-001, 7.825664e-001, 7.835851e-001, 7.846038e-001,
+7.855820e-001, 7.865473e-001, 7.875126e-001, 7.884778e-001, 7.894431e-001, 7.904084e-001, 7.913736e-001, 7.923389e-001, 7.932832e-001, 7.942045e-001,
+7.951258e-001, 7.960471e-001, 7.969683e-001, 7.978896e-001, 7.988109e-001, 7.997322e-001, 8.006522e-001, 8.015512e-001, 8.024501e-001, 8.033491e-001,
+8.042481e-001, 8.051471e-001, 8.060461e-001, 8.069451e-001, 8.078441e-001, 8.087292e-001, 8.096009e-001, 8.104726e-001, 8.113443e-001, 8.122160e-001,
+8.130877e-001, 8.139594e-001, 8.148311e-001, 8.157028e-001, 8.165383e-001, 8.173654e-001, 8.181925e-001, 8.190197e-001, 8.198468e-001, 8.206740e-001,
+8.215011e-001, 8.223283e-001, 8.231554e-001, 8.239536e-001, 8.247511e-001, 8.255487e-001, 8.263463e-001, 8.271439e-001, 8.279415e-001, 8.287390e-001,
+8.295366e-001, 8.303342e-001, 8.311038e-001, 8.318735e-001, 8.326432e-001, 8.334128e-001, 8.341825e-001, 8.349522e-001, 8.357219e-001, 8.364915e-001,
+8.372612e-001, 8.380025e-001, 8.387397e-001, 8.394770e-001, 8.402142e-001, 8.409515e-001, 8.416887e-001, 8.424260e-001, 8.431632e-001, 8.439005e-001,
+8.446271e-001, 8.453466e-001, 8.460662e-001, 8.467858e-001, 8.475054e-001, 8.482249e-001, 8.489445e-001, 8.496641e-001, 8.503837e-001, 8.510985e-001,
+8.517916e-001, 8.524847e-001, 8.531777e-001, 8.538708e-001, 8.545639e-001, 8.552569e-001, 8.559500e-001, 8.566430e-001, 8.573361e-001, 8.580203e-001,
+8.586985e-001, 8.593767e-001, 8.600549e-001, 8.607331e-001, 8.614113e-001, 8.620895e-001, 8.627677e-001, 8.634459e-001, 8.641241e-001, 8.647658e-001,
+8.654016e-001, 8.660374e-001, 8.666732e-001, 8.673090e-001, 8.679448e-001, 8.685807e-001, 8.692165e-001, 8.698523e-001, 8.704881e-001, 8.711016e-001,
+8.717143e-001, 8.723271e-001, 8.729399e-001, 8.735526e-001, 8.741654e-001, 8.747782e-001, 8.753909e-001, 8.760037e-001, 8.766165e-001, 8.772181e-001,
+8.778186e-001, 8.784192e-001, 8.790198e-001, 8.796203e-001, 8.802209e-001, 8.808215e-001, 8.814220e-001, 8.820226e-001, 8.826231e-001, 8.832188e-001,
+8.838123e-001, 8.844057e-001, 8.849992e-001, 8.855927e-001, 8.861862e-001, 8.867797e-001, 8.873731e-001, 8.879666e-001, 8.885601e-001, 8.891479e-001,
+8.897229e-001, 8.902979e-001, 8.908729e-001, 8.914479e-001, 8.920229e-001, 8.925979e-001, 8.931729e-001, 8.937479e-001, 8.943229e-001, 8.948979e-001,
+8.954554e-001, 8.960071e-001, 8.965589e-001, 8.971106e-001, 8.976623e-001, 8.982141e-001, 8.987658e-001, 8.993175e-001, 8.998693e-001, 9.004210e-001,
+9.009723e-001, 9.015076e-001, 9.020430e-001, 9.025783e-001, 9.031136e-001, 9.036490e-001, 9.041843e-001, 9.047196e-001, 9.052549e-001, 9.057903e-001,
+9.063256e-001, 9.068584e-001, 9.073730e-001, 9.078877e-001, 9.084023e-001, 9.089170e-001, 9.094317e-001, 9.099463e-001, 9.104610e-001, 9.109756e-001,
+9.114903e-001, 9.120050e-001, 9.125185e-001, 9.130075e-001, 9.134966e-001, 9.139856e-001, 9.144747e-001, 9.149637e-001, 9.154528e-001, 9.159418e-001,
+9.164309e-001, 9.169199e-001, 9.174090e-001, 9.178980e-001, 9.183770e-001, 9.188531e-001, 9.193292e-001, 9.198053e-001, 9.202814e-001, 9.207575e-001,
+9.212337e-001, 9.217098e-001, 9.221859e-001, 9.226620e-001, 9.231381e-001, 9.236043e-001, 9.240511e-001, 9.244979e-001, 9.249447e-001, 9.253915e-001,
+9.258383e-001, 9.262851e-001, 9.267318e-001, 9.271786e-001, 9.276254e-001, 9.280722e-001, 9.285190e-001, 9.289493e-001, 9.293728e-001, 9.297963e-001,
+9.302198e-001, 9.306433e-001, 9.310668e-001, 9.314903e-001, 9.319138e-001, 9.323373e-001, 9.327608e-001, 9.331843e-001, 9.336078e-001, 9.340066e-001,
+9.344023e-001, 9.347980e-001, 9.351937e-001, 9.355894e-001, 9.359851e-001, 9.363807e-001, 9.367764e-001, 9.371721e-001, 9.375678e-001, 9.379635e-001,
+9.383592e-001, 9.387403e-001, 9.391193e-001, 9.394982e-001, 9.398772e-001, 9.402562e-001, 9.406352e-001, 9.410142e-001, 9.413932e-001, 9.417721e-001,
+9.421511e-001, 9.425301e-001, 9.429091e-001, 9.432800e-001, 9.436467e-001, 9.440134e-001, 9.443802e-001, 9.447469e-001, 9.451136e-001, 9.454804e-001,
+9.458471e-001, 9.462139e-001, 9.465806e-001, 9.469473e-001, 9.473141e-001, 9.476754e-001, 9.480211e-001, 9.483667e-001, 9.487123e-001, 9.490580e-001,
+9.494036e-001, 9.497492e-001, 9.500949e-001, 9.504405e-001, 9.507861e-001, 9.511318e-001, 9.514774e-001, 9.518230e-001, 9.521476e-001, 9.524605e-001,
+9.527734e-001, 9.530863e-001, 9.533992e-001, 9.537121e-001, 9.540250e-001, 9.543379e-001, 9.546508e-001, 9.549637e-001, 9.552766e-001, 9.555895e-001,
+9.559024e-001, 9.562044e-001, 9.565040e-001, 9.568037e-001, 9.571033e-001, 9.574030e-001, 9.577026e-001, 9.580023e-001, 9.583019e-001, 9.586016e-001,
+9.589012e-001, 9.592009e-001, 9.595005e-001, 9.598002e-001, 9.600860e-001, 9.603684e-001, 9.606508e-001, 9.609331e-001, 9.612155e-001, 9.614979e-001,
+9.617803e-001, 9.620627e-001, 9.623451e-001, 9.626274e-001, 9.629098e-001, 9.631922e-001, 9.634746e-001, 9.637439e-001, 9.640030e-001, 9.642622e-001,
+9.645213e-001, 9.647804e-001, 9.650396e-001, 9.652987e-001, 9.655579e-001, 9.658170e-001, 9.660761e-001, 9.663353e-001, 9.665944e-001, 9.668535e-001,
+9.671122e-001, 9.673675e-001, 9.676228e-001, 9.678780e-001, 9.681333e-001, 9.683885e-001, 9.686438e-001, 9.688990e-001, 9.691543e-001, 9.694095e-001,
+9.696648e-001, 9.699201e-001, 9.701753e-001, 9.704306e-001, 9.706832e-001, 9.709324e-001, 9.711816e-001, 9.714308e-001, 9.716800e-001, 9.719291e-001,
+9.721783e-001, 9.724275e-001, 9.726767e-001, 9.729259e-001, 9.731751e-001, 9.734243e-001, 9.736735e-001, 9.739227e-001, 9.741605e-001, 9.743886e-001,
+9.746166e-001, 9.748447e-001, 9.750727e-001, 9.753008e-001, 9.755289e-001, 9.757569e-001, 9.759850e-001, 9.762130e-001, 9.764411e-001, 9.766691e-001,
+9.768972e-001, 9.771253e-001, 9.773471e-001, 9.775603e-001, 9.777734e-001, 9.779866e-001, 9.781998e-001, 9.784129e-001, 9.786261e-001, 9.788392e-001,
+9.790524e-001, 9.792656e-001, 9.794787e-001, 9.796919e-001, 9.799050e-001, 9.801182e-001, 9.803304e-001, 9.805279e-001, 9.807254e-001, 9.809228e-001,
+9.811203e-001, 9.813178e-001, 9.815153e-001, 9.817128e-001, 9.819103e-001, 9.821078e-001, 9.823053e-001, 9.825028e-001, 9.827002e-001, 9.828977e-001,
+9.830952e-001, 9.832865e-001, 9.834708e-001, 9.836550e-001, 9.838393e-001, 9.840236e-001, 9.842079e-001, 9.843922e-001, 9.845765e-001, 9.847608e-001,
+9.849451e-001, 9.851294e-001, 9.853137e-001, 9.854980e-001, 9.856823e-001, 9.858666e-001, 9.860420e-001, 9.862126e-001, 9.863832e-001, 9.865538e-001,
+9.867244e-001, 9.868950e-001, 9.870656e-001, 9.872363e-001, 9.874069e-001, 9.875775e-001, 9.877481e-001, 9.879187e-001, 9.880893e-001, 9.882599e-001,
+9.884305e-001, 9.885919e-001, 9.887466e-001, 9.889014e-001, 9.890561e-001, 9.892109e-001, 9.893656e-001, 9.895203e-001, 9.896751e-001, 9.898298e-001,
+9.899846e-001, 9.901393e-001, 9.902941e-001, 9.904488e-001, 9.906036e-001, 9.907583e-001, 9.909070e-001, 9.910391e-001, 9.911712e-001, 9.913033e-001,
+9.914354e-001, 9.915675e-001, 9.916996e-001, 9.918317e-001, 9.919638e-001, 9.920959e-001, 9.922280e-001, 9.923601e-001, 9.924923e-001, 9.926244e-001,
+9.927565e-001, 9.928886e-001, 9.930138e-001, 9.931361e-001, 9.932584e-001, 9.933807e-001, 9.935031e-001, 9.936254e-001, 9.937477e-001, 9.938700e-001,
+9.939924e-001, 9.941147e-001, 9.942370e-001, 9.943593e-001, 9.944817e-001, 9.946040e-001, 9.947263e-001, 9.948486e-001, 9.949529e-001, 9.950549e-001,
+9.951569e-001, 9.952589e-001, 9.953609e-001, 9.954629e-001, 9.955650e-001, 9.956670e-001, 9.957690e-001, 9.958710e-001, 9.959730e-001, 9.960750e-001,
+9.961770e-001, 9.962790e-001, 9.963810e-001, 9.964830e-001, 9.965667e-001, 9.966462e-001, 9.967257e-001, 9.968052e-001, 9.968847e-001, 9.969642e-001,
+9.970438e-001, 9.971233e-001, 9.972028e-001, 9.972823e-001, 9.973618e-001, 9.974413e-001, 9.975208e-001, 9.976003e-001, 9.976798e-001, 9.977593e-001,
+9.978352e-001, 9.979071e-001, 9.979789e-001, 9.980508e-001, 9.981227e-001, 9.981945e-001, 9.982664e-001, 9.983383e-001, 9.984102e-001, 9.984820e-001,
+9.985539e-001, 9.986258e-001, 9.986976e-001, 9.987695e-001, 9.988414e-001, 9.989133e-001, 9.989851e-001, 9.990463e-001, 9.991059e-001, 9.991655e-001,
+9.992251e-001, 9.992847e-001, 9.993443e-001, 9.994039e-001, 9.994635e-001, 9.995231e-001, 9.995828e-001, 9.996424e-001, 9.997020e-001, 9.997616e-001,
+9.998212e-001, 9.998808e-001, 9.999404e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 64", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.177276e-004, 6.504654e-004, 1.002447e-003, 1.369473e-003, 1.745205e-003, 2.134921e-003, 2.541707e-003, 2.963326e-003, 3.395851e-003,
+3.845797e-003, 4.316249e-003, 4.807706e-003, 5.320466e-003, 5.860900e-003, 6.435962e-003, 7.037497e-003, 7.660130e-003, 8.307884e-003, 8.980973e-003,
+9.681658e-003, 1.041070e-002, 1.116868e-002, 1.195360e-002, 1.277341e-002, 1.362534e-002, 1.450925e-002, 1.541852e-002, 1.635180e-002, 1.731764e-002,
+1.831633e-002, 1.935136e-002, 2.042122e-002, 2.153153e-002, 2.268355e-002, 2.387472e-002, 2.510022e-002, 2.636733e-002, 2.767585e-002, 2.902316e-002,
+3.040859e-002, 3.182601e-002, 3.328195e-002, 3.477335e-002, 3.630295e-002, 3.787240e-002, 3.947309e-002, 4.110831e-002, 4.278531e-002, 4.449472e-002,
+4.624474e-002, 4.802150e-002, 4.982944e-002, 5.167176e-002, 5.355537e-002, 5.547240e-002, 5.742803e-002, 5.942301e-002, 6.144957e-002, 6.350856e-002,
+6.560586e-002, 6.774082e-002, 6.991153e-002, 7.211975e-002, 7.436075e-002, 7.663210e-002, 7.894119e-002, 8.129134e-002, 8.367480e-002, 8.609340e-002,
+8.854347e-002, 9.102158e-002, 9.352826e-002, 9.606534e-002, 9.862727e-002, 1.012184e-001, 1.038418e-001, 1.064930e-001, 1.091664e-001, 1.118554e-001,
+1.145604e-001, 1.172853e-001, 1.200316e-001, 1.228056e-001, 1.256062e-001, 1.284315e-001, 1.312846e-001, 1.341657e-001, 1.370669e-001, 1.399843e-001,
+1.429265e-001, 1.458959e-001, 1.488838e-001, 1.518886e-001, 1.549195e-001, 1.579770e-001, 1.610528e-001, 1.641493e-001, 1.672637e-001, 1.703891e-001,
+1.735228e-001, 1.766714e-001, 1.798343e-001, 1.830091e-001, 1.861924e-001, 1.893825e-001, 1.925912e-001, 1.958243e-001, 1.990809e-001, 2.023572e-001,
+2.056479e-001, 2.089466e-001, 2.122560e-001, 2.155747e-001, 2.189022e-001, 2.222437e-001, 2.255931e-001, 2.289552e-001, 2.323366e-001, 2.357339e-001,
+2.391352e-001, 2.425421e-001, 2.459710e-001, 2.494048e-001, 2.528399e-001, 2.562730e-001, 2.597049e-001, 2.631390e-001, 2.665785e-001, 2.700112e-001,
+2.734401e-001, 2.768635e-001, 2.802909e-001, 2.837207e-001, 2.871546e-001, 2.905928e-001, 2.940322e-001, 2.974657e-001, 3.008909e-001, 3.043087e-001,
+3.077211e-001, 3.111295e-001, 3.145295e-001, 3.179245e-001, 3.213168e-001, 3.247093e-001, 3.281051e-001, 3.315084e-001, 3.348961e-001, 3.382737e-001,
+3.416487e-001, 3.450246e-001, 3.484073e-001, 3.517859e-001, 3.551585e-001, 3.585281e-001, 3.618961e-001, 3.652539e-001, 3.686092e-001, 3.719412e-001,
+3.752706e-001, 3.785892e-001, 3.819032e-001, 3.852080e-001, 3.885084e-001, 3.918038e-001, 3.950856e-001, 3.983577e-001, 4.016107e-001, 4.048541e-001,
+4.080661e-001, 4.112666e-001, 4.144413e-001, 4.176087e-001, 4.207500e-001, 4.238849e-001, 4.270057e-001, 4.301231e-001, 4.332121e-001, 4.362936e-001,
+4.393600e-001, 4.424214e-001, 4.454444e-001, 4.484500e-001, 4.514287e-001, 4.543898e-001, 4.573354e-001, 4.602654e-001, 4.631789e-001, 4.660641e-001,
+4.689424e-001, 4.717960e-001, 4.746481e-001, 4.774643e-001, 4.802805e-001, 4.830631e-001, 4.858393e-001, 4.886022e-001, 4.913568e-001, 4.941014e-001,
+4.968290e-001, 4.995543e-001, 5.022573e-001, 5.049604e-001, 5.076419e-001, 5.103181e-001, 5.129829e-001, 5.156351e-001, 5.182831e-001, 5.209033e-001,
+5.235236e-001, 5.261075e-001, 5.286799e-001, 5.312322e-001, 5.337487e-001, 5.362653e-001, 5.387454e-001, 5.412231e-001, 5.436828e-001, 5.461235e-001,
+5.485640e-001, 5.509893e-001, 5.534147e-001, 5.558288e-001, 5.582319e-001, 5.606351e-001, 5.629964e-001, 5.653567e-001, 5.677016e-001, 5.700251e-001,
+5.723485e-001, 5.746430e-001, 5.769315e-001, 5.792130e-001, 5.814689e-001, 5.837247e-001, 5.859629e-001, 5.881881e-001, 5.904132e-001, 5.926192e-001,
+5.948230e-001, 5.970178e-001, 5.991766e-001, 6.013354e-001, 6.034781e-001, 6.056027e-001, 6.077274e-001, 6.098302e-001, 6.119243e-001, 6.140185e-001,
+6.160812e-001, 6.181415e-001, 6.201986e-001, 6.222298e-001, 6.242611e-001, 6.262831e-001, 6.282787e-001, 6.302742e-001, 6.322615e-001, 6.342349e-001,
+6.362084e-001, 6.381634e-001, 6.400971e-001, 6.420307e-001, 6.439447e-001, 6.458404e-001, 6.477362e-001, 6.496070e-001, 6.514571e-001, 6.533072e-001,
+6.551311e-001, 6.569325e-001, 6.587339e-001, 6.605201e-001, 6.622909e-001, 6.640617e-001, 6.658166e-001, 6.675499e-001, 6.692832e-001, 6.710019e-001,
+6.726892e-001, 6.743766e-001, 6.760562e-001, 6.777000e-001, 6.793438e-001, 6.809874e-001, 6.826079e-001, 6.842284e-001, 6.858489e-001, 6.874537e-001,
+6.890545e-001, 6.906552e-001, 6.922481e-001, 6.938346e-001, 6.954211e-001, 6.969973e-001, 6.985462e-001, 7.000952e-001, 7.016441e-001, 7.031658e-001,
+7.046864e-001, 7.062070e-001, 7.077114e-001, 7.092053e-001, 7.106992e-001, 7.121831e-001, 7.136318e-001, 7.150805e-001, 7.165293e-001, 7.179604e-001,
+7.193871e-001, 7.208138e-001, 7.222303e-001, 7.236267e-001, 7.250231e-001, 7.264196e-001, 7.277973e-001, 7.291716e-001, 7.305458e-001, 7.319158e-001,
+7.332760e-001, 7.346363e-001, 7.359965e-001, 7.373400e-001, 7.386774e-001, 7.400147e-001, 7.413491e-001, 7.426621e-001, 7.439751e-001, 7.452881e-001,
+7.465865e-001, 7.478683e-001, 7.491501e-001, 7.504319e-001, 7.516843e-001, 7.529282e-001, 7.541721e-001, 7.554147e-001, 7.566284e-001, 7.578422e-001,
+7.590560e-001, 7.602615e-001, 7.614449e-001, 7.626284e-001, 7.638118e-001, 7.649739e-001, 7.661107e-001, 7.672476e-001, 7.683845e-001, 7.695063e-001,
+7.706182e-001, 7.717301e-001, 7.728419e-001, 7.739313e-001, 7.750115e-001, 7.760916e-001, 7.771717e-001, 7.782340e-001, 7.792908e-001, 7.803477e-001,
+7.814046e-001, 7.824332e-001, 7.834541e-001, 7.844750e-001, 7.854960e-001, 7.865009e-001, 7.875008e-001, 7.885008e-001, 7.895008e-001, 7.904886e-001,
+7.914711e-001, 7.924536e-001, 7.934361e-001, 7.943943e-001, 7.953353e-001, 7.962763e-001, 7.972173e-001, 7.981507e-001, 7.990739e-001, 7.999971e-001,
+8.009203e-001, 8.018380e-001, 8.027368e-001, 8.036356e-001, 8.045344e-001, 8.054332e-001, 8.063106e-001, 8.071876e-001, 8.080646e-001, 8.089416e-001,
+8.098158e-001, 8.106888e-001, 8.115618e-001, 8.124347e-001, 8.132983e-001, 8.141440e-001, 8.149898e-001, 8.158355e-001, 8.166813e-001, 8.174951e-001,
+8.183075e-001, 8.191199e-001, 8.199323e-001, 8.207354e-001, 8.215301e-001, 8.223248e-001, 8.231195e-001, 8.239132e-001, 8.246841e-001, 8.254551e-001,
+8.262260e-001, 8.269970e-001, 8.277591e-001, 8.285128e-001, 8.292664e-001, 8.300201e-001, 8.307737e-001, 8.315144e-001, 8.322540e-001, 8.329937e-001,
+8.337333e-001, 8.344634e-001, 8.351711e-001, 8.358789e-001, 8.365866e-001, 8.372944e-001, 8.379939e-001, 8.386886e-001, 8.393832e-001, 8.400778e-001,
+8.407724e-001, 8.414523e-001, 8.421304e-001, 8.428085e-001, 8.434865e-001, 8.441630e-001, 8.448263e-001, 8.454895e-001, 8.461528e-001, 8.468161e-001,
+8.474723e-001, 8.481098e-001, 8.487473e-001, 8.493848e-001, 8.500223e-001, 8.506528e-001, 8.512720e-001, 8.518912e-001, 8.525105e-001, 8.531297e-001,
+8.537435e-001, 8.543507e-001, 8.549580e-001, 8.555652e-001, 8.561724e-001, 8.567661e-001, 8.573439e-001, 8.579216e-001, 8.584993e-001, 8.590770e-001,
+8.596464e-001, 8.602035e-001, 8.607607e-001, 8.613178e-001, 8.618750e-001, 8.624272e-001, 8.629680e-001, 8.635089e-001, 8.640498e-001, 8.645906e-001,
+8.651301e-001, 8.656618e-001, 8.661936e-001, 8.667253e-001, 8.672570e-001, 8.677887e-001, 8.683094e-001, 8.688293e-001, 8.693492e-001, 8.698691e-001,
+8.703891e-001, 8.708938e-001, 8.713909e-001, 8.718880e-001, 8.723851e-001, 8.728822e-001, 8.733705e-001, 8.738416e-001, 8.743126e-001, 8.747837e-001,
+8.752548e-001, 8.757258e-001, 8.761900e-001, 8.766540e-001, 8.771179e-001, 8.775818e-001, 8.780457e-001, 8.785020e-001, 8.789512e-001, 8.794004e-001,
+8.798495e-001, 8.802987e-001, 8.807478e-001, 8.811937e-001, 8.816397e-001, 8.820856e-001, 8.825315e-001, 8.829774e-001, 8.834268e-001, 8.838805e-001,
+8.843341e-001, 8.847878e-001, 8.852415e-001, 8.856951e-001, 8.861432e-001, 8.865902e-001, 8.870372e-001, 8.874842e-001, 8.879311e-001, 8.883766e-001,
+8.888130e-001, 8.892495e-001, 8.896859e-001, 8.901224e-001, 8.905588e-001, 8.909912e-001, 8.914174e-001, 8.918436e-001, 8.922698e-001, 8.926960e-001,
+8.931223e-001, 8.935400e-001, 8.939519e-001, 8.943638e-001, 8.947757e-001, 8.951875e-001, 8.955994e-001, 8.960081e-001, 8.964156e-001, 8.968231e-001,
+8.972306e-001, 8.976380e-001, 8.980455e-001, 8.984466e-001, 8.988459e-001, 8.992452e-001, 8.996445e-001, 9.000439e-001, 9.004432e-001, 9.008391e-001,
+9.012340e-001, 9.016290e-001, 9.020240e-001, 9.024190e-001, 9.028139e-001, 9.032066e-001, 9.035984e-001, 9.039902e-001, 9.043820e-001, 9.047738e-001,
+9.051656e-001, 9.055475e-001, 9.059227e-001, 9.062979e-001, 9.066731e-001, 9.070483e-001, 9.074235e-001, 9.077919e-001, 9.081502e-001, 9.085085e-001,
+9.088668e-001, 9.092251e-001, 9.095834e-001, 9.099410e-001, 9.102940e-001, 9.106470e-001, 9.110000e-001, 9.113530e-001, 9.117061e-001, 9.120591e-001,
+9.124002e-001, 9.127386e-001, 9.130770e-001, 9.134154e-001, 9.137538e-001, 9.140922e-001, 9.144208e-001, 9.147356e-001, 9.150504e-001, 9.153652e-001,
+9.156800e-001, 9.159948e-001, 9.163096e-001, 9.166139e-001, 9.169176e-001, 9.172213e-001, 9.175250e-001, 9.178287e-001, 9.181324e-001, 9.184330e-001,
+9.187292e-001, 9.190254e-001, 9.193215e-001, 9.196177e-001, 9.199138e-001, 9.202100e-001, 9.205019e-001, 9.207927e-001, 9.210835e-001, 9.213743e-001,
+9.216651e-001, 9.219559e-001, 9.222460e-001, 9.225309e-001, 9.228157e-001, 9.231006e-001, 9.233854e-001, 9.236703e-001, 9.239551e-001, 9.242395e-001,
+9.245232e-001, 9.248069e-001, 9.250906e-001, 9.253743e-001, 9.256579e-001, 9.259416e-001, 9.262231e-001, 9.265028e-001, 9.267825e-001, 9.270622e-001,
+9.273419e-001, 9.276215e-001, 9.279012e-001, 9.281797e-001, 9.284575e-001, 9.287353e-001, 9.290131e-001, 9.292909e-001, 9.295686e-001, 9.298464e-001,
+9.301218e-001, 9.303958e-001, 9.306699e-001, 9.309440e-001, 9.312181e-001, 9.314922e-001, 9.317663e-001, 9.320313e-001, 9.322907e-001, 9.325501e-001,
+9.328095e-001, 9.330688e-001, 9.333282e-001, 9.335876e-001, 9.338458e-001, 9.341027e-001, 9.343596e-001, 9.346164e-001, 9.348733e-001, 9.351302e-001,
+9.353871e-001, 9.356437e-001, 9.358994e-001, 9.361552e-001, 9.364109e-001, 9.366667e-001, 9.369224e-001, 9.371782e-001, 9.374339e-001, 9.376984e-001,
+9.379628e-001, 9.382273e-001, 9.384917e-001, 9.387561e-001, 9.390206e-001, 9.392850e-001, 9.395544e-001, 9.398267e-001, 9.400989e-001, 9.403711e-001,
+9.406434e-001, 9.409156e-001, 9.411879e-001, 9.414602e-001, 9.417330e-001, 9.420057e-001, 9.422785e-001, 9.425512e-001, 9.428240e-001, 9.430967e-001,
+9.433695e-001, 9.436366e-001, 9.439011e-001, 9.441655e-001, 9.444300e-001, 9.446944e-001, 9.449589e-001, 9.452233e-001, 9.454872e-001, 9.457438e-001,
+9.460004e-001, 9.462570e-001, 9.465135e-001, 9.467701e-001, 9.470267e-001, 9.472833e-001, 9.475367e-001, 9.477852e-001, 9.480337e-001, 9.482822e-001,
+9.485307e-001, 9.487792e-001, 9.490277e-001, 9.492762e-001, 9.495244e-001, 9.497724e-001, 9.500204e-001, 9.502684e-001, 9.505164e-001, 9.507644e-001,
+9.510125e-001, 9.512605e-001, 9.515028e-001, 9.517432e-001, 9.519837e-001, 9.522242e-001, 9.524647e-001, 9.527052e-001, 9.529457e-001, 9.531862e-001,
+9.534236e-001, 9.536604e-001, 9.538972e-001, 9.541339e-001, 9.543707e-001, 9.546075e-001, 9.548443e-001, 9.550810e-001, 9.553158e-001, 9.555501e-001,
+9.557844e-001, 9.560187e-001, 9.562529e-001, 9.564872e-001, 9.567215e-001, 9.569558e-001, 9.571848e-001, 9.574114e-001, 9.576380e-001, 9.578646e-001,
+9.580912e-001, 9.583179e-001, 9.585445e-001, 9.587711e-001, 9.589902e-001, 9.592015e-001, 9.594127e-001, 9.596239e-001, 9.598351e-001, 9.600464e-001,
+9.602576e-001, 9.604688e-001, 9.606760e-001, 9.608664e-001, 9.610567e-001, 9.612471e-001, 9.614375e-001, 9.616279e-001, 9.618183e-001, 9.620087e-001,
+9.621991e-001, 9.623834e-001, 9.625664e-001, 9.627494e-001, 9.629324e-001, 9.631155e-001, 9.632985e-001, 9.634815e-001, 9.636645e-001, 9.638484e-001,
+9.640339e-001, 9.642195e-001, 9.644050e-001, 9.645905e-001, 9.647761e-001, 9.649616e-001, 9.651472e-001, 9.653327e-001, 9.655121e-001, 9.656898e-001,
+9.658675e-001, 9.660452e-001, 9.662228e-001, 9.664005e-001, 9.665782e-001, 9.667559e-001, 9.669328e-001, 9.671043e-001, 9.672759e-001, 9.674474e-001,
+9.676189e-001, 9.677905e-001, 9.679620e-001, 9.681335e-001, 9.683051e-001, 9.684718e-001, 9.686310e-001, 9.687901e-001, 9.689492e-001, 9.691084e-001,
+9.692675e-001, 9.694266e-001, 9.695858e-001, 9.697449e-001, 9.699027e-001, 9.700593e-001, 9.702159e-001, 9.703725e-001, 9.705291e-001, 9.706857e-001,
+9.708423e-001, 9.709989e-001, 9.711555e-001, 9.713115e-001, 9.714669e-001, 9.716224e-001, 9.717779e-001, 9.719334e-001, 9.720888e-001, 9.722443e-001,
+9.723998e-001, 9.725553e-001, 9.727124e-001, 9.728709e-001, 9.730294e-001, 9.731879e-001, 9.733464e-001, 9.735049e-001, 9.736634e-001, 9.738219e-001,
+9.739804e-001, 9.741386e-001, 9.742962e-001, 9.744538e-001, 9.746114e-001, 9.747691e-001, 9.749267e-001, 9.750843e-001, 9.752420e-001, 9.753996e-001,
+9.755574e-001, 9.757157e-001, 9.758740e-001, 9.760324e-001, 9.761907e-001, 9.763490e-001, 9.765074e-001, 9.766657e-001, 9.768240e-001, 9.769824e-001,
+9.771349e-001, 9.772865e-001, 9.774382e-001, 9.775898e-001, 9.777414e-001, 9.778930e-001, 9.780447e-001, 9.781963e-001, 9.783479e-001, 9.785014e-001,
+9.786573e-001, 9.788131e-001, 9.789690e-001, 9.791249e-001, 9.792807e-001, 9.794366e-001, 9.795925e-001, 9.797484e-001, 9.799042e-001, 9.800560e-001,
+9.802073e-001, 9.803586e-001, 9.805099e-001, 9.806613e-001, 9.808126e-001, 9.809639e-001, 9.811152e-001, 9.812665e-001, 9.814171e-001, 9.815659e-001,
+9.817147e-001, 9.818634e-001, 9.820122e-001, 9.821609e-001, 9.823097e-001, 9.824584e-001, 9.826072e-001, 9.827559e-001, 9.829031e-001, 9.830488e-001,
+9.831944e-001, 9.833401e-001, 9.834857e-001, 9.836314e-001, 9.837771e-001, 9.839227e-001, 9.840684e-001, 9.842140e-001, 9.843599e-001, 9.845058e-001,
+9.846517e-001, 9.847976e-001, 9.849435e-001, 9.850894e-001, 9.852353e-001, 9.853813e-001, 9.855272e-001, 9.856731e-001, 9.858203e-001, 9.859680e-001,
+9.861157e-001, 9.862634e-001, 9.864111e-001, 9.865589e-001, 9.867066e-001, 9.868543e-001, 9.870020e-001, 9.871497e-001, 9.872943e-001, 9.874372e-001,
+9.875801e-001, 9.877229e-001, 9.878658e-001, 9.880087e-001, 9.881515e-001, 9.882944e-001, 9.884373e-001, 9.885801e-001, 9.887198e-001, 9.888557e-001,
+9.889916e-001, 9.891275e-001, 9.892635e-001, 9.893994e-001, 9.895353e-001, 9.896712e-001, 9.898072e-001, 9.899431e-001, 9.900798e-001, 9.902199e-001,
+9.903600e-001, 9.905001e-001, 9.906403e-001, 9.907804e-001, 9.909205e-001, 9.910606e-001, 9.912007e-001, 9.913409e-001, 9.914810e-001, 9.916190e-001,
+9.917565e-001, 9.918940e-001, 9.920315e-001, 9.921690e-001, 9.923065e-001, 9.924441e-001, 9.925816e-001, 9.927191e-001, 9.928566e-001, 9.929937e-001,
+9.931298e-001, 9.932658e-001, 9.934019e-001, 9.935380e-001, 9.936741e-001, 9.938102e-001, 9.939463e-001, 9.940824e-001, 9.942185e-001, 9.943545e-001,
+9.944881e-001, 9.946203e-001, 9.947524e-001, 9.948846e-001, 9.950168e-001, 9.951490e-001, 9.952812e-001, 9.954133e-001, 9.955455e-001, 9.956777e-001,
+9.958099e-001, 9.959365e-001, 9.960626e-001, 9.961886e-001, 9.963147e-001, 9.964408e-001, 9.965669e-001, 9.966929e-001, 9.968190e-001, 9.969451e-001,
+9.970712e-001, 9.971972e-001, 9.973221e-001, 9.974470e-001, 9.975720e-001, 9.976969e-001, 9.978219e-001, 9.979468e-001, 9.980717e-001, 9.981967e-001,
+9.983216e-001, 9.984465e-001, 9.985719e-001, 9.987018e-001, 9.988316e-001, 9.989614e-001, 9.990912e-001, 9.992211e-001, 9.993509e-001, 9.994807e-001,
+9.996105e-001, 9.997404e-001, 9.998702e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.941380e-004, 3.951061e-004, 6.061521e-004, 8.284810e-004, 1.060700e-003, 1.300276e-003, 1.547927e-003, 1.808065e-003, 2.079532e-003,
+2.364564e-003, 2.663742e-003, 2.976007e-003, 3.300431e-003, 3.637655e-003, 3.985412e-003, 4.344714e-003, 4.717876e-003, 5.106579e-003, 5.510850e-003,
+5.931867e-003, 6.370538e-003, 6.825412e-003, 7.297976e-003, 7.787398e-003, 8.294877e-003, 8.819249e-003, 9.362648e-003, 9.927605e-003, 1.051593e-002,
+1.112964e-002, 1.176826e-002, 1.242947e-002, 1.311568e-002, 1.382757e-002, 1.456419e-002, 1.532657e-002, 1.611362e-002, 1.692683e-002, 1.776570e-002,
+1.863265e-002, 1.952934e-002, 2.044781e-002, 2.139320e-002, 2.236405e-002, 2.336009e-002, 2.437956e-002, 2.542620e-002, 2.649678e-002, 2.759358e-002,
+2.871119e-002, 2.985799e-002, 3.103458e-002, 3.223873e-002, 3.347329e-002, 3.473755e-002, 3.603050e-002, 3.735060e-002, 3.869899e-002, 4.007837e-002,
+4.148735e-002, 4.292961e-002, 4.440771e-002, 4.591561e-002, 4.744664e-002, 4.900130e-002, 5.058298e-002, 5.219598e-002, 5.384011e-002, 5.551393e-002,
+5.721806e-002, 5.895118e-002, 6.070714e-002, 6.248109e-002, 6.427252e-002, 6.608629e-002, 6.792217e-002, 6.977822e-002, 7.166028e-002, 7.357086e-002,
+7.550722e-002, 7.746919e-002, 7.945692e-002, 8.146807e-002, 8.350349e-002, 8.556530e-002, 8.765437e-002, 8.976891e-002, 9.190974e-002, 9.407929e-002,
+9.627848e-002, 9.850526e-002, 1.007623e-001, 1.030461e-001, 1.053560e-001, 1.076907e-001, 1.100479e-001, 1.124247e-001, 1.148207e-001, 1.172373e-001,
+1.196703e-001, 1.221214e-001, 1.245934e-001, 1.270965e-001, 1.296185e-001, 1.321596e-001, 1.347206e-001, 1.373080e-001, 1.399127e-001, 1.425280e-001,
+1.451531e-001, 1.477965e-001, 1.504597e-001, 1.531387e-001, 1.558340e-001, 1.585477e-001, 1.612743e-001, 1.640138e-001, 1.667792e-001, 1.695535e-001,
+1.723369e-001, 1.751406e-001, 1.779553e-001, 1.807787e-001, 1.836172e-001, 1.864625e-001, 1.893129e-001, 1.921742e-001, 1.950452e-001, 1.979238e-001,
+2.008170e-001, 2.037173e-001, 2.066275e-001, 2.095532e-001, 2.124857e-001, 2.154320e-001, 2.183827e-001, 2.213368e-001, 2.242962e-001, 2.272600e-001,
+2.302364e-001, 2.332222e-001, 2.362163e-001, 2.392162e-001, 2.422180e-001, 2.452265e-001, 2.482353e-001, 2.512445e-001, 2.542503e-001, 2.572539e-001,
+2.602625e-001, 2.632723e-001, 2.662931e-001, 2.693150e-001, 2.723414e-001, 2.753702e-001, 2.784039e-001, 2.814370e-001, 2.844695e-001, 2.875000e-001,
+2.905291e-001, 2.935575e-001, 2.965855e-001, 2.996021e-001, 3.026155e-001, 3.056125e-001, 3.086062e-001, 3.115797e-001, 3.145501e-001, 3.175121e-001,
+3.204729e-001, 3.234160e-001, 3.263563e-001, 3.292810e-001, 3.322027e-001, 3.351123e-001, 3.380188e-001, 3.409165e-001, 3.438107e-001, 3.467021e-001,
+3.495918e-001, 3.524695e-001, 3.553349e-001, 3.581919e-001, 3.610336e-001, 3.638724e-001, 3.666980e-001, 3.695237e-001, 3.723417e-001, 3.751596e-001,
+3.779620e-001, 3.807600e-001, 3.835526e-001, 3.863407e-001, 3.891261e-001, 3.919047e-001, 3.946832e-001, 3.974429e-001, 4.002025e-001, 4.029656e-001,
+4.057301e-001, 4.084877e-001, 4.112327e-001, 4.139777e-001, 4.167033e-001, 4.194288e-001, 4.221394e-001, 4.248404e-001, 4.275378e-001, 4.302202e-001,
+4.329027e-001, 4.355578e-001, 4.382040e-001, 4.408401e-001, 4.434513e-001, 4.460626e-001, 4.486452e-001, 4.512208e-001, 4.537887e-001, 4.563368e-001,
+4.588850e-001, 4.614096e-001, 4.639258e-001, 4.664359e-001, 4.689145e-001, 4.713930e-001, 4.738500e-001, 4.762900e-001, 4.787300e-001, 4.811363e-001,
+4.835400e-001, 4.859382e-001, 4.883220e-001, 4.907057e-001, 4.930708e-001, 4.954228e-001, 4.977747e-001, 5.000953e-001, 5.024111e-001, 5.047225e-001,
+5.070027e-001, 5.092829e-001, 5.115441e-001, 5.137697e-001, 5.159952e-001, 5.182106e-001, 5.204173e-001, 5.226241e-001, 5.248165e-001, 5.270029e-001,
+5.291893e-001, 5.313519e-001, 5.335099e-001, 5.356679e-001, 5.378025e-001, 5.399356e-001, 5.420684e-001, 5.441771e-001, 5.462857e-001, 5.483934e-001,
+5.504837e-001, 5.525741e-001, 5.546635e-001, 5.567383e-001, 5.588131e-001, 5.608873e-001, 5.629431e-001, 5.649988e-001, 5.670546e-001, 5.690968e-001,
+5.711387e-001, 5.731805e-001, 5.751888e-001, 5.771927e-001, 5.791966e-001, 5.811751e-001, 5.831454e-001, 5.851158e-001, 5.870722e-001, 5.890191e-001,
+5.909660e-001, 5.928978e-001, 5.948076e-001, 5.967173e-001, 5.986235e-001, 6.005136e-001, 6.024037e-001, 6.042937e-001, 6.061665e-001, 6.080377e-001,
+6.099089e-001, 6.117550e-001, 6.135855e-001, 6.154160e-001, 6.172372e-001, 6.190348e-001, 6.208323e-001, 6.226299e-001, 6.243864e-001, 6.261391e-001,
+6.278917e-001, 6.296277e-001, 6.313475e-001, 6.330673e-001, 6.347843e-001, 6.364611e-001, 6.381379e-001, 6.398147e-001, 6.414785e-001, 6.431330e-001,
+6.447874e-001, 6.464402e-001, 6.480689e-001, 6.496976e-001, 6.513262e-001, 6.529368e-001, 6.545298e-001, 6.561228e-001, 6.577158e-001, 6.592859e-001,
+6.608538e-001, 6.624217e-001, 6.639863e-001, 6.655421e-001, 6.670980e-001, 6.686539e-001, 6.702006e-001, 6.717412e-001, 6.732819e-001, 6.748226e-001,
+6.763488e-001, 6.778733e-001, 6.793978e-001, 6.809165e-001, 6.823993e-001, 6.838821e-001, 6.853649e-001, 6.868362e-001, 6.882852e-001, 6.897342e-001,
+6.911832e-001, 6.926219e-001, 6.940507e-001, 6.954795e-001, 6.969083e-001, 6.983196e-001, 6.997205e-001, 7.011214e-001, 7.025223e-001, 7.039136e-001,
+7.053010e-001, 7.066884e-001, 7.080759e-001, 7.094560e-001, 7.108336e-001, 7.122113e-001, 7.135889e-001, 7.149401e-001, 7.162821e-001, 7.176241e-001,
+7.189661e-001, 7.202813e-001, 7.215846e-001, 7.228880e-001, 7.241913e-001, 7.254747e-001, 7.267451e-001, 7.280154e-001, 7.292857e-001, 7.305502e-001,
+7.318079e-001, 7.330656e-001, 7.343233e-001, 7.355696e-001, 7.367875e-001, 7.380054e-001, 7.392233e-001, 7.404393e-001, 7.416235e-001, 7.428077e-001,
+7.439920e-001, 7.451762e-001, 7.463407e-001, 7.474998e-001, 7.486589e-001, 7.498181e-001, 7.509674e-001, 7.521057e-001, 7.532439e-001, 7.543822e-001,
+7.555182e-001, 7.566339e-001, 7.577497e-001, 7.588655e-001, 7.599812e-001, 7.610853e-001, 7.621841e-001, 7.632828e-001, 7.643816e-001, 7.654762e-001,
+7.665567e-001, 7.676371e-001, 7.687176e-001, 7.697980e-001, 7.708620e-001, 7.719196e-001, 7.729771e-001, 7.740346e-001, 7.750877e-001, 7.761170e-001,
+7.771463e-001, 7.781756e-001, 7.792049e-001, 7.802204e-001, 7.812248e-001, 7.822293e-001, 7.832337e-001, 7.842381e-001, 7.852112e-001, 7.861807e-001,
+7.871502e-001, 7.881197e-001, 7.890832e-001, 7.900207e-001, 7.909581e-001, 7.918956e-001, 7.928330e-001, 7.937646e-001, 7.946882e-001, 7.956117e-001,
+7.965353e-001, 7.974589e-001, 7.983703e-001, 7.992741e-001, 8.001778e-001, 8.010816e-001, 8.019854e-001, 8.028789e-001, 8.037690e-001, 8.046592e-001,
+8.055493e-001, 8.064395e-001, 8.073066e-001, 8.081693e-001, 8.090321e-001, 8.098948e-001, 8.107575e-001, 8.115878e-001, 8.124132e-001, 8.132387e-001,
+8.140641e-001, 8.148896e-001, 8.157023e-001, 8.165128e-001, 8.173233e-001, 8.181338e-001, 8.189443e-001, 8.197409e-001, 8.205334e-001, 8.213259e-001,
+8.221184e-001, 8.229109e-001, 8.236930e-001, 8.244691e-001, 8.252452e-001, 8.260213e-001, 8.267975e-001, 8.275654e-001, 8.283232e-001, 8.290811e-001,
+8.298390e-001, 8.305969e-001, 8.313514e-001, 8.320926e-001, 8.328338e-001, 8.335750e-001, 8.343162e-001, 8.350574e-001, 8.357766e-001, 8.364936e-001,
+8.372105e-001, 8.379275e-001, 8.386444e-001, 8.393507e-001, 8.400480e-001, 8.407454e-001, 8.414428e-001, 8.421401e-001, 8.428346e-001, 8.435099e-001,
+8.441852e-001, 8.448605e-001, 8.455357e-001, 8.462110e-001, 8.468806e-001, 8.475473e-001, 8.482139e-001, 8.488805e-001, 8.495471e-001, 8.502117e-001,
+8.508617e-001, 8.515116e-001, 8.521615e-001, 8.528114e-001, 8.534613e-001, 8.541016e-001, 8.547332e-001, 8.553648e-001, 8.559964e-001, 8.566280e-001,
+8.572597e-001, 8.578745e-001, 8.584867e-001, 8.590990e-001, 8.597113e-001, 8.603236e-001, 8.609316e-001, 8.615156e-001, 8.620996e-001, 8.626837e-001,
+8.632677e-001, 8.638518e-001, 8.644295e-001, 8.649968e-001, 8.655641e-001, 8.661314e-001, 8.666986e-001, 8.672659e-001, 8.678284e-001, 8.683868e-001,
+8.689451e-001, 8.695035e-001, 8.700618e-001, 8.706202e-001, 8.711759e-001, 8.717301e-001, 8.722843e-001, 8.728385e-001, 8.733927e-001, 8.739469e-001,
+8.744983e-001, 8.750483e-001, 8.755983e-001, 8.761483e-001, 8.766983e-001, 8.772484e-001, 8.777912e-001, 8.783297e-001, 8.788682e-001, 8.794067e-001,
+8.799452e-001, 8.804838e-001, 8.810168e-001, 8.815448e-001, 8.820728e-001, 8.826008e-001, 8.831288e-001, 8.836568e-001, 8.841773e-001, 8.846845e-001,
+8.851917e-001, 8.856989e-001, 8.862062e-001, 8.867134e-001, 8.872200e-001, 8.877231e-001, 8.882262e-001, 8.887292e-001, 8.892323e-001, 8.897353e-001,
+8.902384e-001, 8.907388e-001, 8.912387e-001, 8.917386e-001, 8.922385e-001, 8.927385e-001, 8.932384e-001, 8.937345e-001, 8.942262e-001, 8.947179e-001,
+8.952096e-001, 8.957013e-001, 8.961931e-001, 8.966843e-001, 8.971562e-001, 8.976282e-001, 8.981002e-001, 8.985722e-001, 8.990442e-001, 8.995161e-001,
+8.999810e-001, 9.004394e-001, 9.008978e-001, 9.013561e-001, 9.018145e-001, 9.022728e-001, 9.027312e-001, 9.031662e-001, 9.035998e-001, 9.040333e-001,
+9.044669e-001, 9.049005e-001, 9.053340e-001, 9.057644e-001, 9.061869e-001, 9.066093e-001, 9.070318e-001, 9.074543e-001, 9.078768e-001, 9.082993e-001,
+9.087104e-001, 9.091130e-001, 9.095156e-001, 9.099182e-001, 9.103208e-001, 9.107235e-001, 9.111261e-001, 9.115068e-001, 9.118813e-001, 9.122559e-001,
+9.126304e-001, 9.130050e-001, 9.133795e-001, 9.137541e-001, 9.141280e-001, 9.145019e-001, 9.148758e-001, 9.152497e-001, 9.156236e-001, 9.159975e-001,
+9.163714e-001, 9.167358e-001, 9.171000e-001, 9.174642e-001, 9.178284e-001, 9.181925e-001, 9.185567e-001, 9.189209e-001, 9.192627e-001, 9.196035e-001,
+9.199443e-001, 9.202850e-001, 9.206258e-001, 9.209665e-001, 9.213073e-001, 9.216343e-001, 9.219590e-001, 9.222837e-001, 9.226085e-001, 9.229332e-001,
+9.232580e-001, 9.235827e-001, 9.238941e-001, 9.241997e-001, 9.245052e-001, 9.248107e-001, 9.251162e-001, 9.254217e-001, 9.257272e-001, 9.260296e-001,
+9.263282e-001, 9.266267e-001, 9.269253e-001, 9.272238e-001, 9.275224e-001, 9.278209e-001, 9.281199e-001, 9.284217e-001, 9.287236e-001, 9.290254e-001,
+9.293273e-001, 9.296291e-001, 9.299310e-001, 9.302328e-001, 9.305326e-001, 9.308316e-001, 9.311305e-001, 9.314295e-001, 9.317285e-001, 9.320274e-001,
+9.323264e-001, 9.326242e-001, 9.329178e-001, 9.332114e-001, 9.335050e-001, 9.337986e-001, 9.340922e-001, 9.343858e-001, 9.346794e-001, 9.349704e-001,
+9.352600e-001, 9.355496e-001, 9.358392e-001, 9.361288e-001, 9.364184e-001, 9.367080e-001, 9.369976e-001, 9.372946e-001, 9.375915e-001, 9.378884e-001,
+9.381854e-001, 9.384823e-001, 9.387793e-001, 9.390762e-001, 9.393728e-001, 9.396686e-001, 9.399644e-001, 9.402602e-001, 9.405561e-001, 9.408519e-001,
+9.411477e-001, 9.414435e-001, 9.417339e-001, 9.420179e-001, 9.423020e-001, 9.425861e-001, 9.428702e-001, 9.431543e-001, 9.434383e-001, 9.437224e-001,
+9.440008e-001, 9.442748e-001, 9.445488e-001, 9.448228e-001, 9.450968e-001, 9.453708e-001, 9.456448e-001, 9.459188e-001, 9.461904e-001, 9.464602e-001,
+9.467300e-001, 9.469999e-001, 9.472697e-001, 9.475396e-001, 9.478094e-001, 9.480792e-001, 9.483508e-001, 9.486242e-001, 9.488975e-001, 9.491708e-001,
+9.494441e-001, 9.497175e-001, 9.499908e-001, 9.502641e-001, 9.505358e-001, 9.508043e-001, 9.510729e-001, 9.513414e-001, 9.516100e-001, 9.518785e-001,
+9.521470e-001, 9.524156e-001, 9.526827e-001, 9.529364e-001, 9.531900e-001, 9.534437e-001, 9.536973e-001, 9.539509e-001, 9.542046e-001, 9.544582e-001,
+9.547119e-001, 9.549634e-001, 9.552143e-001, 9.554651e-001, 9.557159e-001, 9.559668e-001, 9.562176e-001, 9.564685e-001, 9.567193e-001, 9.569705e-001,
+9.572222e-001, 9.574739e-001, 9.577257e-001, 9.579774e-001, 9.582291e-001, 9.584809e-001, 9.587326e-001, 9.589843e-001, 9.592265e-001, 9.594663e-001,
+9.597062e-001, 9.599460e-001, 9.601858e-001, 9.604257e-001, 9.606655e-001, 9.609054e-001, 9.611442e-001, 9.613789e-001, 9.616137e-001, 9.618484e-001,
+9.620831e-001, 9.623179e-001, 9.625526e-001, 9.627873e-001, 9.630220e-001, 9.632469e-001, 9.634613e-001, 9.636757e-001, 9.638901e-001, 9.641045e-001,
+9.643190e-001, 9.645334e-001, 9.647478e-001, 9.649622e-001, 9.651690e-001, 9.653723e-001, 9.655756e-001, 9.657789e-001, 9.659822e-001, 9.661855e-001,
+9.663888e-001, 9.665920e-001, 9.667953e-001, 9.669919e-001, 9.671867e-001, 9.673816e-001, 9.675764e-001, 9.677712e-001, 9.679660e-001, 9.681608e-001,
+9.683556e-001, 9.685504e-001, 9.687360e-001, 9.689193e-001, 9.691025e-001, 9.692858e-001, 9.694690e-001, 9.696523e-001, 9.698355e-001, 9.700188e-001,
+9.702020e-001, 9.703845e-001, 9.705667e-001, 9.707489e-001, 9.709311e-001, 9.711133e-001, 9.712954e-001, 9.714776e-001, 9.716598e-001, 9.718420e-001,
+9.720212e-001, 9.721978e-001, 9.723744e-001, 9.725510e-001, 9.727276e-001, 9.729041e-001, 9.730807e-001, 9.732573e-001, 9.734339e-001, 9.736100e-001,
+9.737847e-001, 9.739593e-001, 9.741340e-001, 9.743086e-001, 9.744832e-001, 9.746579e-001, 9.748325e-001, 9.750072e-001, 9.751818e-001, 9.753580e-001,
+9.755344e-001, 9.757108e-001, 9.758872e-001, 9.760636e-001, 9.762400e-001, 9.764164e-001, 9.765928e-001, 9.767692e-001, 9.769437e-001, 9.771149e-001,
+9.772862e-001, 9.774574e-001, 9.776286e-001, 9.777998e-001, 9.779710e-001, 9.781423e-001, 9.783135e-001, 9.784847e-001, 9.786470e-001, 9.788065e-001,
+9.789660e-001, 9.791254e-001, 9.792849e-001, 9.794444e-001, 9.796039e-001, 9.797634e-001, 9.799228e-001, 9.800818e-001, 9.802326e-001, 9.803834e-001,
+9.805342e-001, 9.806849e-001, 9.808357e-001, 9.809865e-001, 9.811373e-001, 9.812881e-001, 9.814389e-001, 9.815893e-001, 9.817385e-001, 9.818877e-001,
+9.820369e-001, 9.821861e-001, 9.823353e-001, 9.824845e-001, 9.826337e-001, 9.827829e-001, 9.829321e-001, 9.830826e-001, 9.832354e-001, 9.833882e-001,
+9.835410e-001, 9.836938e-001, 9.838467e-001, 9.839995e-001, 9.841523e-001, 9.843051e-001, 9.844579e-001, 9.846124e-001, 9.847701e-001, 9.849279e-001,
+9.850856e-001, 9.852434e-001, 9.854011e-001, 9.855589e-001, 9.857166e-001, 9.858744e-001, 9.860321e-001, 9.861895e-001, 9.863453e-001, 9.865011e-001,
+9.866569e-001, 9.868128e-001, 9.869686e-001, 9.871244e-001, 9.872803e-001, 9.874361e-001, 9.875919e-001, 9.877477e-001, 9.878988e-001, 9.880497e-001,
+9.882006e-001, 9.883515e-001, 9.885024e-001, 9.886533e-001, 9.888042e-001, 9.889551e-001, 9.891060e-001, 9.892569e-001, 9.894033e-001, 9.895471e-001,
+9.896909e-001, 9.898347e-001, 9.899785e-001, 9.901223e-001, 9.902661e-001, 9.904099e-001, 9.905537e-001, 9.906975e-001, 9.908416e-001, 9.909869e-001,
+9.911323e-001, 9.912776e-001, 9.914230e-001, 9.915683e-001, 9.917137e-001, 9.918590e-001, 9.920044e-001, 9.921497e-001, 9.922950e-001, 9.924386e-001,
+9.925811e-001, 9.927236e-001, 9.928660e-001, 9.930085e-001, 9.931509e-001, 9.932934e-001, 9.934358e-001, 9.935783e-001, 9.937207e-001, 9.938632e-001,
+9.940040e-001, 9.941447e-001, 9.942854e-001, 9.944261e-001, 9.945669e-001, 9.947076e-001, 9.948483e-001, 9.949890e-001, 9.951297e-001, 9.952704e-001,
+9.954108e-001, 9.955487e-001, 9.956866e-001, 9.958245e-001, 9.959624e-001, 9.961003e-001, 9.962382e-001, 9.963761e-001, 9.965140e-001, 9.966519e-001,
+9.967898e-001, 9.969280e-001, 9.970670e-001, 9.972059e-001, 9.973449e-001, 9.974839e-001, 9.976229e-001, 9.977619e-001, 9.979009e-001, 9.980399e-001,
+9.981789e-001, 9.983179e-001, 9.984571e-001, 9.985974e-001, 9.987376e-001, 9.988779e-001, 9.990181e-001, 9.991584e-001, 9.992987e-001, 9.994389e-001,
+9.995792e-001, 9.997195e-001, 9.998597e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.446141e-004, 2.949580e-004, 4.526987e-004, 6.180415e-004, 7.899137e-004, 9.697909e-004, 1.156662e-003, 1.351121e-003, 1.553510e-003,
+1.764030e-003, 1.982026e-003, 2.209765e-003, 2.446062e-003, 2.691994e-003, 2.947401e-003, 3.212887e-003, 3.487495e-003, 3.772350e-003, 4.067251e-003,
+4.371813e-003, 4.686240e-003, 5.011705e-003, 5.349386e-003, 5.698956e-003, 6.060745e-003, 6.434058e-003, 6.819385e-003, 7.216145e-003, 7.625487e-003,
+8.047614e-003, 8.480270e-003, 8.924783e-003, 9.383095e-003, 9.854216e-003, 1.033776e-002, 1.083246e-002, 1.133827e-002, 1.185599e-002, 1.238690e-002,
+1.293017e-002, 1.348532e-002, 1.405069e-002, 1.462524e-002, 1.521280e-002, 1.581415e-002, 1.643017e-002, 1.706005e-002, 1.770417e-002, 1.836031e-002,
+1.902604e-002, 1.970184e-002, 2.039097e-002, 2.109612e-002, 2.181557e-002, 2.254810e-002, 2.329380e-002, 2.405232e-002, 2.482431e-002, 2.561021e-002,
+2.641028e-002, 2.722277e-002, 2.804661e-002, 2.888442e-002, 2.973721e-002, 3.060236e-002, 3.147762e-002, 3.236322e-002, 3.326104e-002, 3.417226e-002,
+3.509616e-002, 3.603244e-002, 3.698324e-002, 3.794833e-002, 3.892646e-002, 3.991722e-002, 4.092053e-002, 4.193780e-002, 4.296985e-002, 4.401557e-002,
+4.507325e-002, 4.614249e-002, 4.722519e-002, 4.832519e-002, 4.944077e-002, 5.056895e-002, 5.170925e-002, 5.286273e-002, 5.403044e-002, 5.521227e-002,
+5.641167e-002, 5.762413e-002, 5.884852e-002, 6.008559e-002, 6.133668e-002, 6.260538e-002, 6.388824e-002, 6.518393e-002, 6.649214e-002, 6.781403e-002,
+6.915318e-002, 7.050299e-002, 7.186290e-002, 7.323443e-002, 7.462249e-002, 7.602402e-002, 7.743921e-002, 7.887445e-002, 8.032562e-002, 8.178755e-002,
+8.326004e-002, 8.474531e-002, 8.623879e-002, 8.774065e-002, 8.925907e-002, 9.078595e-002, 9.232099e-002, 9.386805e-002, 9.542219e-002, 9.698358e-002,
+9.855966e-002, 1.001449e-001, 1.017420e-001, 1.033572e-001, 1.049805e-001, 1.066167e-001, 1.082695e-001, 1.099312e-001, 1.116095e-001, 1.132924e-001,
+1.149809e-001, 1.166793e-001, 1.183827e-001, 1.201020e-001, 1.218283e-001, 1.235625e-001, 1.253096e-001, 1.270615e-001, 1.288305e-001, 1.306018e-001,
+1.323783e-001, 1.341592e-001, 1.359437e-001, 1.377421e-001, 1.395443e-001, 1.413614e-001, 1.431804e-001, 1.450074e-001, 1.468372e-001, 1.486723e-001,
+1.505121e-001, 1.523568e-001, 1.542068e-001, 1.560602e-001, 1.579222e-001, 1.597875e-001, 1.616557e-001, 1.635245e-001, 1.653988e-001, 1.672739e-001,
+1.691565e-001, 1.710398e-001, 1.729319e-001, 1.748246e-001, 1.767163e-001, 1.786079e-001, 1.804991e-001, 1.823902e-001, 1.842829e-001, 1.861758e-001,
+1.880693e-001, 1.899631e-001, 1.918608e-001, 1.937602e-001, 1.956638e-001, 1.975702e-001, 1.994725e-001, 2.013706e-001, 2.032697e-001, 2.051707e-001,
+2.070730e-001, 2.089823e-001, 2.108915e-001, 2.128048e-001, 2.147184e-001, 2.166287e-001, 2.185378e-001, 2.204502e-001, 2.223665e-001, 2.242841e-001,
+2.262072e-001, 2.281304e-001, 2.300625e-001, 2.319957e-001, 2.339315e-001, 2.358692e-001, 2.378090e-001, 2.397564e-001, 2.417037e-001, 2.436509e-001,
+2.455981e-001, 2.475478e-001, 2.495004e-001, 2.514531e-001, 2.534070e-001, 2.553609e-001, 2.573103e-001, 2.592564e-001, 2.612016e-001, 2.631373e-001,
+2.650731e-001, 2.670041e-001, 2.689318e-001, 2.708589e-001, 2.727748e-001, 2.746907e-001, 2.766083e-001, 2.785278e-001, 2.804473e-001, 2.823555e-001,
+2.842624e-001, 2.861676e-001, 2.880688e-001, 2.899699e-001, 2.918665e-001, 2.937605e-001, 2.956545e-001, 2.975474e-001, 2.994403e-001, 3.013292e-001,
+3.032069e-001, 3.050846e-001, 3.069568e-001, 3.088241e-001, 3.106914e-001, 3.125566e-001, 3.144212e-001, 3.162857e-001, 3.181492e-001, 3.200126e-001,
+3.218754e-001, 3.237349e-001, 3.255944e-001, 3.274546e-001, 3.293164e-001, 3.311783e-001, 3.330386e-001, 3.348967e-001, 3.367549e-001, 3.386109e-001,
+3.404648e-001, 3.423186e-001, 3.441709e-001, 3.460219e-001, 3.478729e-001, 3.497232e-001, 3.515730e-001, 3.534227e-001, 3.552713e-001, 3.571188e-001,
+3.589664e-001, 3.608083e-001, 3.626451e-001, 3.644819e-001, 3.663118e-001, 3.681331e-001, 3.699545e-001, 3.717769e-001, 3.736014e-001, 3.754260e-001,
+3.772483e-001, 3.790615e-001, 3.808746e-001, 3.826876e-001, 3.844921e-001, 3.862965e-001, 3.881009e-001, 3.898972e-001, 3.916916e-001, 3.934859e-001,
+3.952795e-001, 3.970726e-001, 3.988656e-001, 4.006549e-001, 4.024340e-001, 4.042131e-001, 4.059922e-001, 4.077546e-001, 4.095161e-001, 4.112777e-001,
+4.130331e-001, 4.147845e-001, 4.165358e-001, 4.182861e-001, 4.200322e-001, 4.217784e-001, 4.235246e-001, 4.252654e-001, 4.270048e-001, 4.287442e-001,
+4.304836e-001, 4.322234e-001, 4.339631e-001, 4.357028e-001, 4.374335e-001, 4.391623e-001, 4.408910e-001, 4.426157e-001, 4.443300e-001, 4.460442e-001,
+4.477584e-001, 4.494678e-001, 4.511752e-001, 4.528825e-001, 4.545894e-001, 4.562912e-001, 4.579930e-001, 4.596947e-001, 4.613985e-001, 4.631048e-001,
+4.648111e-001, 4.665174e-001, 4.682200e-001, 4.699214e-001, 4.716227e-001, 4.733241e-001, 4.750083e-001, 4.766925e-001, 4.783768e-001, 4.800590e-001,
+4.817342e-001, 4.834094e-001, 4.850846e-001, 4.867551e-001, 4.884187e-001, 4.900823e-001, 4.917458e-001, 4.934012e-001, 4.950498e-001, 4.966984e-001,
+4.983471e-001, 4.999813e-001, 5.016077e-001, 5.032341e-001, 5.048604e-001, 5.064806e-001, 5.080982e-001, 5.097158e-001, 5.113334e-001, 5.129374e-001,
+5.145361e-001, 5.161348e-001, 5.177334e-001, 5.193112e-001, 5.208796e-001, 5.224481e-001, 5.240165e-001, 5.255811e-001, 5.271433e-001, 5.287055e-001,
+5.302677e-001, 5.318275e-001, 5.333847e-001, 5.349420e-001, 5.364993e-001, 5.380508e-001, 5.395910e-001, 5.411313e-001, 5.426715e-001, 5.442110e-001,
+5.457459e-001, 5.472807e-001, 5.488155e-001, 5.503503e-001, 5.518706e-001, 5.533890e-001, 5.549074e-001, 5.564258e-001, 5.579321e-001, 5.594297e-001,
+5.609274e-001, 5.624250e-001, 5.639189e-001, 5.654007e-001, 5.668826e-001, 5.683644e-001, 5.698463e-001, 5.713131e-001, 5.727773e-001, 5.742415e-001,
+5.757057e-001, 5.771645e-001, 5.786156e-001, 5.800666e-001, 5.815177e-001, 5.829688e-001, 5.843982e-001, 5.858259e-001, 5.872536e-001, 5.886812e-001,
+5.901004e-001, 5.915062e-001, 5.929120e-001, 5.943178e-001, 5.957236e-001, 5.971150e-001, 5.985030e-001, 5.998910e-001, 6.012789e-001, 6.026648e-001,
+6.040399e-001, 6.054151e-001, 6.067903e-001, 6.081655e-001, 6.095304e-001, 6.108843e-001, 6.122382e-001, 6.135921e-001, 6.149461e-001, 6.162794e-001,
+6.176058e-001, 6.189322e-001, 6.202585e-001, 6.215849e-001, 6.228949e-001, 6.242042e-001, 6.255135e-001, 6.268228e-001, 6.281303e-001, 6.294245e-001,
+6.307187e-001, 6.320130e-001, 6.333072e-001, 6.345959e-001, 6.358658e-001, 6.371357e-001, 6.384056e-001, 6.396755e-001, 6.409432e-001, 6.422051e-001,
+6.434670e-001, 6.447290e-001, 6.459909e-001, 6.472480e-001, 6.484933e-001, 6.497385e-001, 6.509838e-001, 6.522290e-001, 6.534695e-001, 6.546945e-001,
+6.559194e-001, 6.571443e-001, 6.583693e-001, 6.595931e-001, 6.608086e-001, 6.620242e-001, 6.632398e-001, 6.644554e-001, 6.656710e-001, 6.668659e-001,
+6.680600e-001, 6.692542e-001, 6.704483e-001, 6.716424e-001, 6.728152e-001, 6.739807e-001, 6.751462e-001, 6.763117e-001, 6.774772e-001, 6.786334e-001,
+6.797792e-001, 6.809249e-001, 6.820707e-001, 6.832165e-001, 6.843608e-001, 6.854962e-001, 6.866315e-001, 6.877668e-001, 6.889021e-001, 6.900375e-001,
+6.911700e-001, 6.923017e-001, 6.934333e-001, 6.945649e-001, 6.956965e-001, 6.968225e-001, 6.979350e-001, 6.990476e-001, 7.001601e-001, 7.012727e-001,
+7.023853e-001, 7.034786e-001, 7.045670e-001, 7.056553e-001, 7.067436e-001, 7.078319e-001, 7.089164e-001, 7.099874e-001, 7.110585e-001, 7.121296e-001,
+7.132006e-001, 7.142717e-001, 7.153381e-001, 7.164012e-001, 7.174643e-001, 7.185274e-001, 7.195906e-001, 7.206537e-001, 7.216954e-001, 7.227350e-001,
+7.237745e-001, 7.248140e-001, 7.258535e-001, 7.268896e-001, 7.279072e-001, 7.289247e-001, 7.299422e-001, 7.309598e-001, 7.319773e-001, 7.329847e-001,
+7.339726e-001, 7.349604e-001, 7.359483e-001, 7.369361e-001, 7.379240e-001, 7.389045e-001, 7.398765e-001, 7.408485e-001, 7.418206e-001, 7.427926e-001,
+7.437646e-001, 7.447343e-001, 7.457019e-001, 7.466695e-001, 7.476370e-001, 7.486046e-001, 7.495722e-001, 7.505386e-001, 7.515040e-001, 7.524695e-001,
+7.534349e-001, 7.544003e-001, 7.553657e-001, 7.563228e-001, 7.572700e-001, 7.582172e-001, 7.591644e-001, 7.601115e-001, 7.610587e-001, 7.620021e-001,
+7.629373e-001, 7.638724e-001, 7.648076e-001, 7.657428e-001, 7.666780e-001, 7.676121e-001, 7.685371e-001, 7.694622e-001, 7.703872e-001, 7.713123e-001,
+7.722373e-001, 7.731624e-001, 7.740742e-001, 7.749837e-001, 7.758933e-001, 7.768028e-001, 7.777123e-001, 7.786218e-001, 7.795185e-001, 7.804031e-001,
+7.812876e-001, 7.821721e-001, 7.830566e-001, 7.839412e-001, 7.848230e-001, 7.856824e-001, 7.865417e-001, 7.874011e-001, 7.882605e-001, 7.891198e-001,
+7.899792e-001, 7.908261e-001, 7.916658e-001, 7.925054e-001, 7.933451e-001, 7.941847e-001, 7.950244e-001, 7.958625e-001, 7.966838e-001, 7.975051e-001,
+7.983264e-001, 7.991478e-001, 7.999691e-001, 8.007904e-001, 8.015990e-001, 8.023932e-001, 8.031873e-001, 8.039815e-001, 8.047757e-001, 8.055699e-001,
+8.063641e-001, 8.071422e-001, 8.079160e-001, 8.086897e-001, 8.094635e-001, 8.102372e-001, 8.110109e-001, 8.117844e-001, 8.125453e-001, 8.133062e-001,
+8.140671e-001, 8.148280e-001, 8.155889e-001, 8.163498e-001, 8.171091e-001, 8.178618e-001, 8.186144e-001, 8.193670e-001, 8.201197e-001, 8.208723e-001,
+8.216249e-001, 8.223709e-001, 8.230999e-001, 8.238288e-001, 8.245578e-001, 8.252867e-001, 8.260157e-001, 8.267446e-001, 8.274663e-001, 8.281710e-001,
+8.288756e-001, 8.295802e-001, 8.302848e-001, 8.309894e-001, 8.316941e-001, 8.323920e-001, 8.330685e-001, 8.337450e-001, 8.344215e-001, 8.350981e-001,
+8.357746e-001, 8.364511e-001, 8.371245e-001, 8.377707e-001, 8.384169e-001, 8.390631e-001, 8.397093e-001, 8.403555e-001, 8.410017e-001, 8.416479e-001,
+8.422836e-001, 8.429180e-001, 8.435524e-001, 8.441868e-001, 8.448212e-001, 8.454556e-001, 8.460900e-001, 8.467178e-001, 8.473411e-001, 8.479645e-001,
+8.485879e-001, 8.492112e-001, 8.498346e-001, 8.504580e-001, 8.510762e-001, 8.516776e-001, 8.522790e-001, 8.528804e-001, 8.534818e-001, 8.540832e-001,
+8.546846e-001, 8.552860e-001, 8.558799e-001, 8.564718e-001, 8.570638e-001, 8.576557e-001, 8.582476e-001, 8.588395e-001, 8.594314e-001, 8.600232e-001,
+8.606148e-001, 8.612063e-001, 8.617979e-001, 8.623894e-001, 8.629810e-001, 8.635725e-001, 8.641641e-001, 8.647502e-001, 8.653334e-001, 8.659165e-001,
+8.664996e-001, 8.670827e-001, 8.676658e-001, 8.682490e-001, 8.688321e-001, 8.694059e-001, 8.699793e-001, 8.705526e-001, 8.711259e-001, 8.716993e-001,
+8.722726e-001, 8.728459e-001, 8.734165e-001, 8.739735e-001, 8.745304e-001, 8.750874e-001, 8.756444e-001, 8.762013e-001, 8.767583e-001, 8.773153e-001,
+8.778693e-001, 8.784166e-001, 8.789640e-001, 8.795113e-001, 8.800587e-001, 8.806061e-001, 8.811534e-001, 8.817008e-001, 8.822471e-001, 8.827916e-001,
+8.833362e-001, 8.838807e-001, 8.844252e-001, 8.849697e-001, 8.855142e-001, 8.860588e-001, 8.865967e-001, 8.871210e-001, 8.876453e-001, 8.881696e-001,
+8.886940e-001, 8.892183e-001, 8.897426e-001, 8.902669e-001, 8.907888e-001, 8.913013e-001, 8.918138e-001, 8.923263e-001, 8.928388e-001, 8.933514e-001,
+8.938639e-001, 8.943764e-001, 8.948889e-001, 8.953927e-001, 8.958965e-001, 8.964002e-001, 8.969040e-001, 8.974078e-001, 8.979116e-001, 8.984153e-001,
+8.989191e-001, 8.994186e-001, 8.999163e-001, 9.004139e-001, 9.009116e-001, 9.014092e-001, 9.019069e-001, 9.024045e-001, 9.029022e-001, 9.033971e-001,
+9.038861e-001, 9.043750e-001, 9.048639e-001, 9.053528e-001, 9.058417e-001, 9.063306e-001, 9.068195e-001, 9.073084e-001, 9.077844e-001, 9.082578e-001,
+9.087312e-001, 9.092046e-001, 9.096780e-001, 9.101514e-001, 9.106247e-001, 9.110981e-001, 9.115682e-001, 9.120291e-001, 9.124899e-001, 9.129507e-001,
+9.134116e-001, 9.138724e-001, 9.143332e-001, 9.147940e-001, 9.152549e-001, 9.157108e-001, 9.161634e-001, 9.166160e-001, 9.170686e-001, 9.175213e-001,
+9.179739e-001, 9.184265e-001, 9.188791e-001, 9.193317e-001, 9.197780e-001, 9.202230e-001, 9.206681e-001, 9.211131e-001, 9.215581e-001, 9.220032e-001,
+9.224482e-001, 9.228933e-001, 9.233383e-001, 9.237800e-001, 9.242217e-001, 9.246633e-001, 9.251050e-001, 9.255466e-001, 9.259883e-001, 9.264299e-001,
+9.268716e-001, 9.273126e-001, 9.277383e-001, 9.281641e-001, 9.285898e-001, 9.290155e-001, 9.294412e-001, 9.298669e-001, 9.302927e-001, 9.307184e-001,
+9.311441e-001, 9.315564e-001, 9.319686e-001, 9.323808e-001, 9.327929e-001, 9.332051e-001, 9.336173e-001, 9.340295e-001, 9.344417e-001, 9.348539e-001,
+9.352610e-001, 9.356672e-001, 9.360734e-001, 9.364796e-001, 9.368858e-001, 9.372921e-001, 9.376983e-001, 9.381045e-001, 9.385107e-001, 9.389162e-001,
+9.393214e-001, 9.397265e-001, 9.401317e-001, 9.405368e-001, 9.409420e-001, 9.413471e-001, 9.417522e-001, 9.421574e-001, 9.425605e-001, 9.429581e-001,
+9.433557e-001, 9.437533e-001, 9.441508e-001, 9.445484e-001, 9.449460e-001, 9.453436e-001, 9.457412e-001, 9.461388e-001, 9.465218e-001, 9.469018e-001,
+9.472817e-001, 9.476616e-001, 9.480415e-001, 9.484214e-001, 9.488014e-001, 9.491813e-001, 9.495612e-001, 9.499387e-001, 9.503099e-001, 9.506811e-001,
+9.510523e-001, 9.514235e-001, 9.517948e-001, 9.521660e-001, 9.525372e-001, 9.529084e-001, 9.532796e-001, 9.536481e-001, 9.540151e-001, 9.543820e-001,
+9.547490e-001, 9.551159e-001, 9.554828e-001, 9.558498e-001, 9.562167e-001, 9.565837e-001, 9.569506e-001, 9.573095e-001, 9.576672e-001, 9.580248e-001,
+9.583825e-001, 9.587402e-001, 9.590978e-001, 9.594555e-001, 9.598132e-001, 9.601708e-001, 9.605285e-001, 9.608864e-001, 9.612444e-001, 9.616023e-001,
+9.619602e-001, 9.623182e-001, 9.626761e-001, 9.630340e-001, 9.633920e-001, 9.637499e-001, 9.641077e-001, 9.644622e-001, 9.648168e-001, 9.651713e-001,
+9.655258e-001, 9.658803e-001, 9.662348e-001, 9.665893e-001, 9.669439e-001, 9.672984e-001, 9.676529e-001, 9.679955e-001, 9.683376e-001, 9.686798e-001,
+9.690219e-001, 9.693641e-001, 9.697062e-001, 9.700484e-001, 9.703905e-001, 9.707327e-001, 9.710748e-001, 9.714079e-001, 9.717384e-001, 9.720689e-001,
+9.723994e-001, 9.727299e-001, 9.730604e-001, 9.733909e-001, 9.737214e-001, 9.740519e-001, 9.743824e-001, 9.747108e-001, 9.750369e-001, 9.753629e-001,
+9.756890e-001, 9.760151e-001, 9.763412e-001, 9.766672e-001, 9.769933e-001, 9.773194e-001, 9.776454e-001, 9.779709e-001, 9.782887e-001, 9.786066e-001,
+9.789245e-001, 9.792423e-001, 9.795602e-001, 9.798781e-001, 9.801959e-001, 9.805138e-001, 9.808317e-001, 9.811495e-001, 9.814661e-001, 9.817818e-001,
+9.820974e-001, 9.824131e-001, 9.827287e-001, 9.830443e-001, 9.833600e-001, 9.836756e-001, 9.839913e-001, 9.843069e-001, 9.846225e-001, 9.849328e-001,
+9.852427e-001, 9.855526e-001, 9.858625e-001, 9.861724e-001, 9.864822e-001, 9.867921e-001, 9.871020e-001, 9.874119e-001, 9.877217e-001, 9.880297e-001,
+9.883287e-001, 9.886277e-001, 9.889267e-001, 9.892257e-001, 9.895246e-001, 9.898236e-001, 9.901226e-001, 9.904216e-001, 9.907206e-001, 9.910196e-001,
+9.913133e-001, 9.915956e-001, 9.918778e-001, 9.921600e-001, 9.924422e-001, 9.927244e-001, 9.930066e-001, 9.932888e-001, 9.935710e-001, 9.938532e-001,
+9.941354e-001, 9.944100e-001, 9.946690e-001, 9.949279e-001, 9.951869e-001, 9.954459e-001, 9.957048e-001, 9.959638e-001, 9.962227e-001, 9.964817e-001,
+9.967407e-001, 9.969996e-001, 9.972564e-001, 9.975059e-001, 9.977553e-001, 9.980047e-001, 9.982541e-001, 9.985035e-001, 9.987529e-001, 9.990023e-001,
+9.992518e-001, 9.995012e-001, 9.997506e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 64T", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.026231e-004, 1.485705e-003, 2.353644e-003, 3.309128e-003, 4.358159e-003, 5.504747e-003, 6.743706e-003, 8.065619e-003, 9.475567e-003,
+1.099478e-002, 1.259972e-002, 1.429054e-002, 1.608128e-002, 1.798667e-002, 1.999465e-002, 2.209395e-002, 2.429564e-002, 2.660192e-002, 2.900704e-002,
+3.151424e-002, 3.412686e-002, 3.685159e-002, 3.969527e-002, 4.265499e-002, 4.572030e-002, 4.888595e-002, 5.214338e-002, 5.549697e-002, 5.894614e-002,
+6.249695e-002, 6.615493e-002, 6.991896e-002, 7.378598e-002, 7.776322e-002, 8.183709e-002, 8.601763e-002, 9.030118e-002, 9.469210e-002, 9.917543e-002,
+1.037482e-001, 1.084047e-001, 1.131416e-001, 1.179561e-001, 1.228470e-001, 1.278257e-001, 1.328838e-001, 1.380223e-001, 1.432215e-001, 1.484942e-001,
+1.538526e-001, 1.592796e-001, 1.647691e-001, 1.703309e-001, 1.759332e-001, 1.815856e-001, 1.872842e-001, 1.930217e-001, 1.988135e-001, 2.046463e-001,
+2.105436e-001, 2.164897e-001, 2.224934e-001, 2.285284e-001, 2.345997e-001, 2.407191e-001, 2.468645e-001, 2.530235e-001, 2.591836e-001, 2.653718e-001,
+2.715786e-001, 2.777848e-001, 2.839922e-001, 2.902092e-001, 2.964079e-001, 3.025959e-001, 3.087723e-001, 3.149321e-001, 3.210678e-001, 3.272047e-001,
+3.333188e-001, 3.394154e-001, 3.454919e-001, 3.515485e-001, 3.576078e-001, 3.636479e-001, 3.696722e-001, 3.756689e-001, 3.816396e-001, 3.875685e-001,
+3.934744e-001, 3.993683e-001, 4.052383e-001, 4.110727e-001, 4.168589e-001, 4.226125e-001, 4.283437e-001, 4.340477e-001, 4.397180e-001, 4.453499e-001,
+4.509378e-001, 4.564813e-001, 4.619686e-001, 4.674081e-001, 4.728043e-001, 4.781545e-001, 4.834581e-001, 4.887135e-001, 4.939058e-001, 4.990504e-001,
+5.041617e-001, 5.092216e-001, 5.142281e-001, 5.191957e-001, 5.241003e-001, 5.289487e-001, 5.337404e-001, 5.384751e-001, 5.431363e-001, 5.477465e-001,
+5.523137e-001, 5.568383e-001, 5.613049e-001, 5.657191e-001, 5.700794e-001, 5.743808e-001, 5.786145e-001, 5.828108e-001, 5.869714e-001, 5.910838e-001,
+5.951429e-001, 5.991551e-001, 6.030983e-001, 6.069651e-001, 6.107724e-001, 6.144963e-001, 6.181484e-001, 6.217647e-001, 6.253351e-001, 6.288507e-001,
+6.323326e-001, 6.357543e-001, 6.391350e-001, 6.424909e-001, 6.457951e-001, 6.490676e-001, 6.523084e-001, 6.554991e-001, 6.586679e-001, 6.617909e-001,
+6.648770e-001, 6.679385e-001, 6.709473e-001, 6.739342e-001, 6.768647e-001, 6.797602e-001, 6.826252e-001, 6.854385e-001, 6.882363e-001, 6.909871e-001,
+6.937232e-001, 6.964259e-001, 6.990894e-001, 7.017172e-001, 7.042944e-001, 7.068523e-001, 7.093624e-001, 7.118645e-001, 7.143245e-001, 7.167755e-001,
+7.191916e-001, 7.215894e-001, 7.239490e-001, 7.262918e-001, 7.286117e-001, 7.308965e-001, 7.331464e-001, 7.353671e-001, 7.375649e-001, 7.397303e-001,
+7.418738e-001, 7.439815e-001, 7.460666e-001, 7.481164e-001, 7.501433e-001, 7.521458e-001, 7.541307e-001, 7.560967e-001, 7.580460e-001, 7.599691e-001,
+7.618615e-001, 7.637409e-001, 7.655980e-001, 7.674413e-001, 7.692432e-001, 7.710395e-001, 7.727897e-001, 7.745399e-001, 7.762632e-001, 7.779851e-001,
+7.796736e-001, 7.813516e-001, 7.830191e-001, 7.846779e-001, 7.863258e-001, 7.879499e-001, 7.895723e-001, 7.911683e-001, 7.927643e-001, 7.943251e-001,
+7.958757e-001, 7.974109e-001, 7.989286e-001, 8.004400e-001, 8.019112e-001, 8.033824e-001, 8.048381e-001, 8.062894e-001, 8.077280e-001, 8.091472e-001,
+8.105665e-001, 8.119463e-001, 8.133255e-001, 8.146850e-001, 8.160282e-001, 8.173695e-001, 8.186913e-001, 8.200130e-001, 8.213170e-001, 8.226091e-001,
+8.238982e-001, 8.251539e-001, 8.264096e-001, 8.276506e-001, 8.288793e-001, 8.301080e-001, 8.313010e-001, 8.324930e-001, 8.336700e-001, 8.348219e-001,
+8.359738e-001, 8.371134e-001, 8.382488e-001, 8.393824e-001, 8.404984e-001, 8.416143e-001, 8.427139e-001, 8.437898e-001, 8.448658e-001, 8.459321e-001,
+8.469941e-001, 8.480561e-001, 8.491019e-001, 8.501470e-001, 8.511854e-001, 8.521944e-001, 8.532034e-001, 8.542025e-001, 8.551856e-001, 8.561687e-001,
+8.571283e-001, 8.580685e-001, 8.590087e-001, 8.599494e-001, 8.608903e-001, 8.618312e-001, 8.627600e-001, 8.636855e-001, 8.646111e-001, 8.655209e-001,
+8.664282e-001, 8.673355e-001, 8.682217e-001, 8.691057e-001, 8.699898e-001, 8.708516e-001, 8.717116e-001, 8.725715e-001, 8.734114e-001, 8.742489e-001,
+8.750864e-001, 8.759170e-001, 8.767464e-001, 8.775757e-001, 8.783870e-001, 8.791925e-001, 8.799980e-001, 8.807792e-001, 8.815463e-001, 8.823134e-001,
+8.830744e-001, 8.838288e-001, 8.845831e-001, 8.853344e-001, 8.860781e-001, 8.868217e-001, 8.875637e-001, 8.882815e-001, 8.889993e-001, 8.897172e-001,
+8.904142e-001, 8.911063e-001, 8.917984e-001, 8.924920e-001, 8.931870e-001, 8.938820e-001, 8.945751e-001, 8.952596e-001, 8.959441e-001, 8.966286e-001,
+8.972942e-001, 8.979557e-001, 8.986173e-001, 8.992746e-001, 8.999263e-001, 9.005779e-001, 9.012296e-001, 9.018730e-001, 9.025162e-001, 9.031594e-001,
+9.037922e-001, 9.044146e-001, 9.050371e-001, 9.056595e-001, 9.062777e-001, 9.068959e-001, 9.075140e-001, 9.081309e-001, 9.087464e-001, 9.093618e-001,
+9.099772e-001, 9.105805e-001, 9.111816e-001, 9.117827e-001, 9.123782e-001, 9.129537e-001, 9.135291e-001, 9.141046e-001, 9.146608e-001, 9.152012e-001,
+9.157415e-001, 9.162819e-001, 9.168179e-001, 9.173532e-001, 9.178884e-001, 9.184232e-001, 9.189543e-001, 9.194853e-001, 9.200163e-001, 9.205432e-001,
+9.210606e-001, 9.215780e-001, 9.220954e-001, 9.226071e-001, 9.231126e-001, 9.236181e-001, 9.241235e-001, 9.246153e-001, 9.250978e-001, 9.255803e-001,
+9.260628e-001, 9.265328e-001, 9.269970e-001, 9.274612e-001, 9.279254e-001, 9.283786e-001, 9.288276e-001, 9.292767e-001, 9.297257e-001, 9.301575e-001,
+9.305828e-001, 9.310081e-001, 9.314334e-001, 9.318456e-001, 9.322518e-001, 9.326581e-001, 9.330643e-001, 9.334683e-001, 9.338708e-001, 9.342733e-001,
+9.346758e-001, 9.350727e-001, 9.354630e-001, 9.358533e-001, 9.362437e-001, 9.366283e-001, 9.369992e-001, 9.373700e-001, 9.377409e-001, 9.381108e-001,
+9.384678e-001, 9.388248e-001, 9.391818e-001, 9.395388e-001, 9.398884e-001, 9.402361e-001, 9.405839e-001, 9.409316e-001, 9.412720e-001, 9.416048e-001,
+9.419375e-001, 9.422702e-001, 9.426017e-001, 9.429250e-001, 9.432483e-001, 9.435716e-001, 9.438948e-001, 9.442144e-001, 9.445325e-001, 9.448506e-001,
+9.451688e-001, 9.454866e-001, 9.458039e-001, 9.461211e-001, 9.464384e-001, 9.467556e-001, 9.470669e-001, 9.473763e-001, 9.476857e-001, 9.479951e-001,
+9.483040e-001, 9.486112e-001, 9.489184e-001, 9.492256e-001, 9.495327e-001, 9.498349e-001, 9.501338e-001, 9.504328e-001, 9.507317e-001, 9.510307e-001,
+9.513162e-001, 9.516012e-001, 9.518862e-001, 9.521712e-001, 9.524512e-001, 9.527168e-001, 9.529824e-001, 9.532480e-001, 9.535136e-001, 9.537726e-001,
+9.540250e-001, 9.542773e-001, 9.545297e-001, 9.547821e-001, 9.550375e-001, 9.552942e-001, 9.555509e-001, 9.558076e-001, 9.560643e-001, 9.563277e-001,
+9.565924e-001, 9.568571e-001, 9.571217e-001, 9.573864e-001, 9.576531e-001, 9.579199e-001, 9.581868e-001, 9.584536e-001, 9.587204e-001, 9.589839e-001,
+9.592473e-001, 9.595106e-001, 9.597740e-001, 9.600374e-001, 9.602922e-001, 9.605466e-001, 9.608010e-001, 9.610555e-001, 9.613099e-001, 9.615522e-001,
+9.617929e-001, 9.620336e-001, 9.622743e-001, 9.625151e-001, 9.627497e-001, 9.629824e-001, 9.632151e-001, 9.634478e-001, 9.636805e-001, 9.639063e-001,
+9.641271e-001, 9.643479e-001, 9.645687e-001, 9.647895e-001, 9.650084e-001, 9.652239e-001, 9.654393e-001, 9.656547e-001, 9.658702e-001, 9.660856e-001,
+9.663015e-001, 9.665174e-001, 9.667333e-001, 9.669492e-001, 9.671651e-001, 9.673789e-001, 9.675917e-001, 9.678045e-001, 9.680174e-001, 9.682302e-001,
+9.684410e-001, 9.686466e-001, 9.688523e-001, 9.690579e-001, 9.692635e-001, 9.694691e-001, 9.696654e-001, 9.698595e-001, 9.700537e-001, 9.702479e-001,
+9.704420e-001, 9.706341e-001, 9.708212e-001, 9.710082e-001, 9.711953e-001, 9.713824e-001, 9.715694e-001, 9.717485e-001, 9.719241e-001, 9.720997e-001,
+9.722753e-001, 9.724509e-001, 9.726263e-001, 9.727977e-001, 9.729690e-001, 9.731404e-001, 9.733117e-001, 9.734831e-001, 9.736548e-001, 9.738274e-001,
+9.739999e-001, 9.741724e-001, 9.743450e-001, 9.745175e-001, 9.746889e-001, 9.748594e-001, 9.750299e-001, 9.752004e-001, 9.753709e-001, 9.755415e-001,
+9.757080e-001, 9.758732e-001, 9.760384e-001, 9.762036e-001, 9.763688e-001, 9.765340e-001, 9.766919e-001, 9.768484e-001, 9.770050e-001, 9.771615e-001,
+9.773181e-001, 9.774746e-001, 9.776208e-001, 9.777655e-001, 9.779103e-001, 9.780550e-001, 9.781998e-001, 9.783445e-001, 9.784767e-001, 9.786067e-001,
+9.787368e-001, 9.788669e-001, 9.789969e-001, 9.791270e-001, 9.792443e-001, 9.793578e-001, 9.794713e-001, 9.795848e-001, 9.796983e-001, 9.798117e-001,
+9.799194e-001, 9.800234e-001, 9.801274e-001, 9.802314e-001, 9.803354e-001, 9.804394e-001, 9.805419e-001, 9.806420e-001, 9.807421e-001, 9.808422e-001,
+9.809423e-001, 9.810424e-001, 9.811419e-001, 9.812365e-001, 9.813310e-001, 9.814256e-001, 9.815201e-001, 9.816147e-001, 9.817092e-001, 9.817987e-001,
+9.818863e-001, 9.819739e-001, 9.820615e-001, 9.821491e-001, 9.822367e-001, 9.823242e-001, 9.824114e-001, 9.824986e-001, 9.825858e-001, 9.826729e-001,
+9.827601e-001, 9.828473e-001, 9.829329e-001, 9.830182e-001, 9.831034e-001, 9.831887e-001, 9.832739e-001, 9.833592e-001, 9.834436e-001, 9.835252e-001,
+9.836069e-001, 9.836886e-001, 9.837702e-001, 9.838519e-001, 9.839335e-001, 9.840176e-001, 9.841032e-001, 9.841888e-001, 9.842744e-001, 9.843601e-001,
+9.844457e-001, 9.845313e-001, 9.846189e-001, 9.847068e-001, 9.847946e-001, 9.848825e-001, 9.849704e-001, 9.850582e-001, 9.851460e-001, 9.852334e-001,
+9.853208e-001, 9.854082e-001, 9.854956e-001, 9.855829e-001, 9.856703e-001, 9.857584e-001, 9.858488e-001, 9.859391e-001, 9.860295e-001, 9.861198e-001,
+9.862102e-001, 9.863005e-001, 9.863909e-001, 9.864816e-001, 9.865723e-001, 9.866630e-001, 9.867537e-001, 9.868444e-001, 9.869350e-001, 9.870251e-001,
+9.871138e-001, 9.872025e-001, 9.872911e-001, 9.873798e-001, 9.874685e-001, 9.875571e-001, 9.876450e-001, 9.877302e-001, 9.878153e-001, 9.879005e-001,
+9.879856e-001, 9.880708e-001, 9.881559e-001, 9.882412e-001, 9.883287e-001, 9.884162e-001, 9.885036e-001, 9.885911e-001, 9.886786e-001, 9.887660e-001,
+9.888535e-001, 9.889419e-001, 9.890304e-001, 9.891190e-001, 9.892076e-001, 9.892962e-001, 9.893847e-001, 9.894733e-001, 9.895619e-001, 9.896506e-001,
+9.897392e-001, 9.898278e-001, 9.899165e-001, 9.900051e-001, 9.900938e-001, 9.901823e-001, 9.902700e-001, 9.903578e-001, 9.904455e-001, 9.905333e-001,
+9.906210e-001, 9.907088e-001, 9.907965e-001, 9.908831e-001, 9.909690e-001, 9.910550e-001, 9.911409e-001, 9.912268e-001, 9.913127e-001, 9.913987e-001,
+9.914844e-001, 9.915675e-001, 9.916506e-001, 9.917338e-001, 9.918169e-001, 9.919001e-001, 9.919832e-001, 9.920664e-001, 9.921478e-001, 9.922271e-001,
+9.923065e-001, 9.923858e-001, 9.924651e-001, 9.925444e-001, 9.926237e-001, 9.927031e-001, 9.927788e-001, 9.928531e-001, 9.929274e-001, 9.930018e-001,
+9.930761e-001, 9.931504e-001, 9.932247e-001, 9.932990e-001, 9.933676e-001, 9.934356e-001, 9.935036e-001, 9.935716e-001, 9.936396e-001, 9.937076e-001,
+9.937756e-001, 9.938434e-001, 9.939036e-001, 9.939639e-001, 9.940241e-001, 9.940843e-001, 9.941445e-001, 9.942047e-001, 9.942649e-001, 9.943247e-001,
+9.943756e-001, 9.944264e-001, 9.944773e-001, 9.945281e-001, 9.945790e-001, 9.946299e-001, 9.946807e-001, 9.947316e-001, 9.947717e-001, 9.948117e-001,
+9.948517e-001, 9.948916e-001, 9.949316e-001, 9.949716e-001, 9.950115e-001, 9.950515e-001, 9.950813e-001, 9.951090e-001, 9.951367e-001, 9.951645e-001,
+9.951922e-001, 9.952199e-001, 9.952477e-001, 9.952754e-001, 9.952956e-001, 9.953106e-001, 9.953257e-001, 9.953408e-001, 9.953558e-001, 9.953709e-001,
+9.953859e-001, 9.954010e-001, 9.954147e-001, 9.954246e-001, 9.954346e-001, 9.954445e-001, 9.954545e-001, 9.954644e-001, 9.954744e-001, 9.954843e-001,
+9.954943e-001, 9.954999e-001, 9.955048e-001, 9.955096e-001, 9.955145e-001, 9.955193e-001, 9.955242e-001, 9.955291e-001, 9.955339e-001, 9.955371e-001,
+9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955371e-001, 9.955377e-001, 9.955384e-001,
+9.955392e-001, 9.955399e-001, 9.955406e-001, 9.955414e-001, 9.955421e-001, 9.955429e-001, 9.955436e-001, 9.955444e-001, 9.955451e-001, 9.955459e-001,
+9.955466e-001, 9.955473e-001, 9.955481e-001, 9.955488e-001, 9.955496e-001, 9.955503e-001, 9.955511e-001, 9.955518e-001, 9.955525e-001, 9.955533e-001,
+9.955540e-001, 9.955548e-001, 9.955555e-001, 9.955563e-001, 9.955570e-001, 9.955578e-001, 9.955585e-001, 9.955592e-001, 9.955600e-001, 9.955607e-001,
+9.955615e-001, 9.955622e-001, 9.955630e-001, 9.955637e-001, 9.955644e-001, 9.955652e-001, 9.955659e-001, 9.955667e-001, 9.955674e-001, 9.955682e-001,
+9.955689e-001, 9.955697e-001, 9.955704e-001, 9.955711e-001, 9.955719e-001, 9.955726e-001, 9.955734e-001, 9.955741e-001, 9.955749e-001, 9.955756e-001,
+9.955763e-001, 9.955771e-001, 9.955778e-001, 9.955786e-001, 9.955793e-001, 9.955801e-001, 9.955808e-001, 9.955816e-001, 9.955823e-001, 9.955830e-001,
+9.955838e-001, 9.955845e-001, 9.955853e-001, 9.955860e-001, 9.955868e-001, 9.955875e-001, 9.955882e-001, 9.955890e-001, 9.955897e-001, 9.955905e-001,
+9.955912e-001, 9.955920e-001, 9.955927e-001, 9.955935e-001, 9.955942e-001, 9.955949e-001, 9.955957e-001, 9.955964e-001, 9.955972e-001, 9.955980e-001,
+9.956102e-001, 9.956224e-001, 9.956346e-001, 9.956469e-001, 9.956591e-001, 9.956713e-001, 9.956835e-001, 9.956957e-001, 9.957079e-001, 9.957222e-001,
+9.957391e-001, 9.957560e-001, 9.957729e-001, 9.957898e-001, 9.958067e-001, 9.958237e-001, 9.958406e-001, 9.958575e-001, 9.958744e-001, 9.958941e-001,
+9.959147e-001, 9.959354e-001, 9.959560e-001, 9.959767e-001, 9.959973e-001, 9.960180e-001, 9.960386e-001, 9.960593e-001, 9.960799e-001, 9.961034e-001,
+9.961270e-001, 9.961506e-001, 9.961741e-001, 9.961977e-001, 9.962213e-001, 9.962449e-001, 9.962685e-001, 9.962921e-001, 9.963158e-001, 9.963418e-001,
+9.963677e-001, 9.963936e-001, 9.964196e-001, 9.964455e-001, 9.964715e-001, 9.964974e-001, 9.965233e-001, 9.965493e-001, 9.965753e-001, 9.966031e-001,
+9.966309e-001, 9.966587e-001, 9.966865e-001, 9.967144e-001, 9.967422e-001, 9.967700e-001, 9.967978e-001, 9.968256e-001, 9.968534e-001, 9.968827e-001,
+9.969120e-001, 9.969413e-001, 9.969706e-001, 9.969999e-001, 9.970293e-001, 9.970586e-001, 9.970879e-001, 9.971172e-001, 9.971465e-001, 9.971769e-001,
+9.972077e-001, 9.972384e-001, 9.972692e-001, 9.973000e-001, 9.973308e-001, 9.973615e-001, 9.973923e-001, 9.974231e-001, 9.974539e-001, 9.974855e-001,
+9.975186e-001, 9.975517e-001, 9.975848e-001, 9.976179e-001, 9.976510e-001, 9.976841e-001, 9.977172e-001, 9.977503e-001, 9.977834e-001, 9.978165e-001,
+9.978521e-001, 9.978878e-001, 9.979235e-001, 9.979592e-001, 9.979950e-001, 9.980307e-001, 9.980664e-001, 9.981022e-001, 9.981379e-001, 9.981736e-001,
+9.982104e-001, 9.982488e-001, 9.982872e-001, 9.983256e-001, 9.983640e-001, 9.984024e-001, 9.984408e-001, 9.984792e-001, 9.985177e-001, 9.985561e-001,
+9.985945e-001, 9.986346e-001, 9.986755e-001, 9.987164e-001, 9.987573e-001, 9.987982e-001, 9.988391e-001, 9.988800e-001, 9.989209e-001, 9.989618e-001,
+9.990027e-001, 9.990436e-001, 9.990863e-001, 9.991292e-001, 9.991721e-001, 9.992150e-001, 9.992579e-001, 9.993008e-001, 9.993437e-001, 9.993866e-001,
+9.994295e-001, 9.994724e-001, 9.995154e-001, 9.995594e-001, 9.996035e-001, 9.996475e-001, 9.996916e-001, 9.997357e-001, 9.997797e-001, 9.998238e-001,
+9.998678e-001, 9.999119e-001, 9.999559e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.291322e-004, 1.121228e-003, 1.771316e-003, 2.479031e-003, 3.243629e-003, 4.064791e-003, 4.946787e-003, 5.886294e-003, 6.891625e-003,
+7.963404e-003, 9.105693e-003, 1.030720e-002, 1.157573e-002, 1.291829e-002, 1.433680e-002, 1.584361e-002, 1.743345e-002, 1.910233e-002, 2.085479e-002,
+2.268934e-002, 2.460773e-002, 2.660963e-002, 2.869639e-002, 3.086318e-002, 3.310551e-002, 3.542709e-002, 3.782209e-002, 4.029375e-002, 4.283983e-002,
+4.546113e-002, 4.816123e-002, 5.094777e-002, 5.381812e-002, 5.677073e-002, 5.981308e-002, 6.294887e-002, 6.616937e-002, 6.947109e-002, 7.285404e-002,
+7.631452e-002, 7.984755e-002, 8.344600e-002, 8.712945e-002, 9.089338e-002, 9.472738e-002, 9.863725e-002, 1.026312e-001, 1.067062e-001, 1.108567e-001,
+1.150842e-001, 1.193785e-001, 1.237355e-001, 1.281584e-001, 1.326268e-001, 1.371478e-001, 1.417110e-001, 1.463265e-001, 1.509988e-001, 1.557403e-001,
+1.605253e-001, 1.653805e-001, 1.702827e-001, 1.752300e-001, 1.802355e-001, 1.852917e-001, 1.903931e-001, 1.955378e-001, 2.007203e-001, 2.059362e-001,
+2.111911e-001, 2.164550e-001, 2.217417e-001, 2.270426e-001, 2.323474e-001, 2.376510e-001, 2.429574e-001, 2.482704e-001, 2.535850e-001, 2.589013e-001,
+2.642198e-001, 2.695528e-001, 2.748903e-001, 2.802192e-001, 2.855532e-001, 2.909021e-001, 2.962612e-001, 3.016174e-001, 3.069771e-001, 3.123393e-001,
+3.176955e-001, 3.230510e-001, 3.284166e-001, 3.337814e-001, 3.391354e-001, 3.444840e-001, 3.498202e-001, 3.551412e-001, 3.604323e-001, 3.657176e-001,
+3.709863e-001, 3.762353e-001, 3.814581e-001, 3.866479e-001, 3.918175e-001, 3.969656e-001, 4.020648e-001, 4.071336e-001, 4.121664e-001, 4.171527e-001,
+4.221055e-001, 4.270166e-001, 4.319120e-001, 4.367877e-001, 4.416338e-001, 4.464288e-001, 4.511983e-001, 4.559360e-001, 4.606370e-001, 4.652822e-001,
+4.699007e-001, 4.744860e-001, 4.790317e-001, 4.835188e-001, 4.879747e-001, 4.923952e-001, 4.967536e-001, 5.010760e-001, 5.053608e-001, 5.095917e-001,
+5.137746e-001, 5.179340e-001, 5.220690e-001, 5.261592e-001, 5.302232e-001, 5.342566e-001, 5.382382e-001, 5.421988e-001, 5.461328e-001, 5.500105e-001,
+5.538635e-001, 5.576798e-001, 5.614630e-001, 5.652248e-001, 5.689184e-001, 5.725791e-001, 5.761986e-001, 5.797788e-001, 5.833429e-001, 5.868696e-001,
+5.903774e-001, 5.938648e-001, 5.972957e-001, 6.007062e-001, 6.040559e-001, 6.073855e-001, 6.106784e-001, 6.139552e-001, 6.172216e-001, 6.204240e-001,
+6.236107e-001, 6.267351e-001, 6.298514e-001, 6.329440e-001, 6.360032e-001, 6.390182e-001, 6.420083e-001, 6.449811e-001, 6.479083e-001, 6.508182e-001,
+6.536681e-001, 6.565066e-001, 6.593150e-001, 6.621206e-001, 6.648774e-001, 6.676304e-001, 6.703311e-001, 6.730267e-001, 6.756759e-001, 6.783176e-001,
+6.808996e-001, 6.834768e-001, 6.860130e-001, 6.885464e-001, 6.910448e-001, 6.935424e-001, 6.960023e-001, 6.984623e-001, 7.008609e-001, 7.032560e-001,
+7.055974e-001, 7.079291e-001, 7.102228e-001, 7.125022e-001, 7.147536e-001, 7.169851e-001, 7.192016e-001, 7.213971e-001, 7.235781e-001, 7.257089e-001,
+7.278391e-001, 7.299192e-001, 7.319994e-001, 7.340466e-001, 7.360842e-001, 7.381075e-001, 7.401171e-001, 7.421148e-001, 7.440715e-001, 7.460282e-001,
+7.479511e-001, 7.498709e-001, 7.517752e-001, 7.536682e-001, 7.555514e-001, 7.573989e-001, 7.592465e-001, 7.610546e-001, 7.628545e-001, 7.646414e-001,
+7.664098e-001, 7.681781e-001, 7.698963e-001, 7.716132e-001, 7.733102e-001, 7.749880e-001, 7.766654e-001, 7.783105e-001, 7.799556e-001, 7.815762e-001,
+7.831718e-001, 7.847674e-001, 7.863462e-001, 7.879242e-001, 7.894842e-001, 7.910141e-001, 7.925441e-001, 7.940390e-001, 7.955235e-001, 7.970044e-001,
+7.984637e-001, 7.999229e-001, 8.013638e-001, 8.027847e-001, 8.042056e-001, 8.055990e-001, 8.069852e-001, 8.083692e-001, 8.097263e-001, 8.110835e-001,
+8.124285e-001, 8.137485e-001, 8.150685e-001, 8.163607e-001, 8.176304e-001, 8.189001e-001, 8.201503e-001, 8.213939e-001, 8.226375e-001, 8.238469e-001,
+8.250528e-001, 8.262571e-001, 8.274198e-001, 8.285825e-001, 8.297395e-001, 8.308608e-001, 8.319822e-001, 8.330980e-001, 8.341926e-001, 8.352873e-001,
+8.363730e-001, 8.374316e-001, 8.384901e-001, 8.395387e-001, 8.405580e-001, 8.415773e-001, 8.425924e-001, 8.435931e-001, 8.445938e-001, 8.455909e-001,
+8.465702e-001, 8.475494e-001, 8.485258e-001, 8.494656e-001, 8.504053e-001, 8.513450e-001, 8.522825e-001, 8.532198e-001, 8.541572e-001, 8.550791e-001,
+8.559969e-001, 8.569147e-001, 8.578170e-001, 8.587086e-001, 8.596002e-001, 8.604817e-001, 8.613451e-001, 8.622086e-001, 8.630690e-001, 8.639015e-001,
+8.647339e-001, 8.655664e-001, 8.663951e-001, 8.672229e-001, 8.680507e-001, 8.688691e-001, 8.696764e-001, 8.704837e-001, 8.712878e-001, 8.720599e-001,
+8.728319e-001, 8.736040e-001, 8.743599e-001, 8.751083e-001, 8.758567e-001, 8.766025e-001, 8.773399e-001, 8.780772e-001, 8.788146e-001, 8.795429e-001,
+8.802683e-001, 8.809937e-001, 8.817160e-001, 8.824285e-001, 8.831410e-001, 8.838535e-001, 8.845480e-001, 8.852339e-001, 8.859198e-001, 8.866026e-001,
+8.872501e-001, 8.878977e-001, 8.885452e-001, 8.891865e-001, 8.898200e-001, 8.904534e-001, 8.910869e-001, 8.917122e-001, 8.923351e-001, 8.929580e-001,
+8.935797e-001, 8.941801e-001, 8.947806e-001, 8.953810e-001, 8.959743e-001, 8.965504e-001, 8.971265e-001, 8.977026e-001, 8.982680e-001, 8.988228e-001,
+8.993775e-001, 8.999322e-001, 9.004656e-001, 9.009882e-001, 9.015108e-001, 9.020333e-001, 9.025335e-001, 9.030275e-001, 9.035215e-001, 9.040155e-001,
+9.045064e-001, 9.049968e-001, 9.054872e-001, 9.059776e-001, 9.064563e-001, 9.069336e-001, 9.074110e-001, 9.078883e-001, 9.083464e-001, 9.088021e-001,
+9.092579e-001, 9.097136e-001, 9.101629e-001, 9.106109e-001, 9.110590e-001, 9.115070e-001, 9.119517e-001, 9.123954e-001, 9.128390e-001, 9.132826e-001,
+9.137256e-001, 9.141683e-001, 9.146110e-001, 9.150536e-001, 9.154922e-001, 9.159254e-001, 9.163585e-001, 9.167916e-001, 9.172231e-001, 9.176480e-001,
+9.180729e-001, 9.184977e-001, 9.189226e-001, 9.193426e-001, 9.197623e-001, 9.201820e-001, 9.206016e-001, 9.210133e-001, 9.214197e-001, 9.218262e-001,
+9.222326e-001, 9.226341e-001, 9.230197e-001, 9.234052e-001, 9.237907e-001, 9.241762e-001, 9.245484e-001, 9.249175e-001, 9.252867e-001, 9.256558e-001,
+9.260243e-001, 9.263916e-001, 9.267588e-001, 9.271261e-001, 9.274933e-001, 9.278638e-001, 9.282349e-001, 9.286060e-001, 9.289770e-001, 9.293472e-001,
+9.297148e-001, 9.300825e-001, 9.304502e-001, 9.308179e-001, 9.311781e-001, 9.315346e-001, 9.318912e-001, 9.322477e-001, 9.326039e-001, 9.329423e-001,
+9.332806e-001, 9.336189e-001, 9.339573e-001, 9.342914e-001, 9.346158e-001, 9.349402e-001, 9.352647e-001, 9.355891e-001, 9.359091e-001, 9.362253e-001,
+9.365415e-001, 9.368577e-001, 9.371739e-001, 9.374798e-001, 9.377818e-001, 9.380839e-001, 9.383859e-001, 9.386879e-001, 9.389883e-001, 9.392885e-001,
+9.395886e-001, 9.398887e-001, 9.401888e-001, 9.404815e-001, 9.407737e-001, 9.410659e-001, 9.413581e-001, 9.416503e-001, 9.419289e-001, 9.422073e-001,
+9.424857e-001, 9.427641e-001, 9.430424e-001, 9.433137e-001, 9.435847e-001, 9.438556e-001, 9.441265e-001, 9.443975e-001, 9.446647e-001, 9.449313e-001,
+9.451980e-001, 9.454647e-001, 9.457313e-001, 9.459909e-001, 9.462481e-001, 9.465052e-001, 9.467624e-001, 9.470195e-001, 9.472687e-001, 9.475113e-001,
+9.477539e-001, 9.479965e-001, 9.482392e-001, 9.484791e-001, 9.487127e-001, 9.489463e-001, 9.491799e-001, 9.494135e-001, 9.496471e-001, 9.498767e-001,
+9.501063e-001, 9.503358e-001, 9.505654e-001, 9.507950e-001, 9.510245e-001, 9.512541e-001, 9.514836e-001, 9.517131e-001, 9.519427e-001, 9.521713e-001,
+9.523969e-001, 9.526225e-001, 9.528480e-001, 9.530736e-001, 9.532991e-001, 9.535260e-001, 9.537533e-001, 9.539807e-001, 9.542080e-001, 9.544353e-001,
+9.546621e-001, 9.548869e-001, 9.551116e-001, 9.553363e-001, 9.555611e-001, 9.557858e-001, 9.560061e-001, 9.562234e-001, 9.564408e-001, 9.566582e-001,
+9.568755e-001, 9.570929e-001, 9.572993e-001, 9.575052e-001, 9.577110e-001, 9.579169e-001, 9.581227e-001, 9.583271e-001, 9.585263e-001, 9.587255e-001,
+9.589247e-001, 9.591240e-001, 9.593232e-001, 9.595178e-001, 9.597066e-001, 9.598954e-001, 9.600842e-001, 9.602730e-001, 9.604618e-001, 9.606479e-001,
+9.608322e-001, 9.610165e-001, 9.612008e-001, 9.613851e-001, 9.615694e-001, 9.617481e-001, 9.619244e-001, 9.621007e-001, 9.622771e-001, 9.624534e-001,
+9.626297e-001, 9.628033e-001, 9.629759e-001, 9.631486e-001, 9.633212e-001, 9.634938e-001, 9.636664e-001, 9.638398e-001, 9.640134e-001, 9.641871e-001,
+9.643608e-001, 9.645345e-001, 9.647082e-001, 9.648808e-001, 9.650526e-001, 9.652245e-001, 9.653963e-001, 9.655682e-001, 9.657400e-001, 9.659097e-001,
+9.660762e-001, 9.662428e-001, 9.664094e-001, 9.665760e-001, 9.667426e-001, 9.669077e-001, 9.670665e-001, 9.672253e-001, 9.673840e-001, 9.675428e-001,
+9.677016e-001, 9.678603e-001, 9.680220e-001, 9.681841e-001, 9.683462e-001, 9.685082e-001, 9.686703e-001, 9.688324e-001, 9.689945e-001, 9.691566e-001,
+9.693187e-001, 9.694808e-001, 9.696429e-001, 9.698050e-001, 9.699669e-001, 9.701261e-001, 9.702853e-001, 9.704445e-001, 9.706036e-001, 9.707628e-001,
+9.709220e-001, 9.710780e-001, 9.712316e-001, 9.713851e-001, 9.715387e-001, 9.716922e-001, 9.718458e-001, 9.719993e-001, 9.721450e-001, 9.722905e-001,
+9.724361e-001, 9.725816e-001, 9.727271e-001, 9.728726e-001, 9.730173e-001, 9.731602e-001, 9.733031e-001, 9.734461e-001, 9.735890e-001, 9.737319e-001,
+9.738749e-001, 9.740149e-001, 9.741529e-001, 9.742910e-001, 9.744291e-001, 9.745672e-001, 9.747052e-001, 9.748433e-001, 9.749874e-001, 9.751328e-001,
+9.752783e-001, 9.754237e-001, 9.755692e-001, 9.757147e-001, 9.758601e-001, 9.760093e-001, 9.761588e-001, 9.763083e-001, 9.764578e-001, 9.766073e-001,
+9.767568e-001, 9.769062e-001, 9.770559e-001, 9.772056e-001, 9.773552e-001, 9.775049e-001, 9.776546e-001, 9.778043e-001, 9.779539e-001, 9.781007e-001,
+9.782474e-001, 9.783941e-001, 9.785408e-001, 9.786874e-001, 9.788341e-001, 9.789808e-001, 9.791290e-001, 9.792773e-001, 9.794257e-001, 9.795741e-001,
+9.797224e-001, 9.798708e-001, 9.800191e-001, 9.801668e-001, 9.803142e-001, 9.804617e-001, 9.806091e-001, 9.807565e-001, 9.809039e-001, 9.810513e-001,
+9.811972e-001, 9.813411e-001, 9.814851e-001, 9.816291e-001, 9.817731e-001, 9.819170e-001, 9.820610e-001, 9.822043e-001, 9.823424e-001, 9.824805e-001,
+9.826187e-001, 9.827568e-001, 9.828949e-001, 9.830330e-001, 9.831712e-001, 9.833034e-001, 9.834333e-001, 9.835632e-001, 9.836931e-001, 9.838230e-001,
+9.839529e-001, 9.840828e-001, 9.842103e-001, 9.843295e-001, 9.844488e-001, 9.845681e-001, 9.846873e-001, 9.848066e-001, 9.849258e-001, 9.850451e-001,
+9.851558e-001, 9.852621e-001, 9.853683e-001, 9.854745e-001, 9.855807e-001, 9.856870e-001, 9.857932e-001, 9.858994e-001, 9.859907e-001, 9.860820e-001,
+9.861733e-001, 9.862647e-001, 9.863560e-001, 9.864473e-001, 9.865386e-001, 9.866276e-001, 9.867103e-001, 9.867929e-001, 9.868755e-001, 9.869581e-001,
+9.870408e-001, 9.871234e-001, 9.872060e-001, 9.872871e-001, 9.873664e-001, 9.874456e-001, 9.875249e-001, 9.876041e-001, 9.876833e-001, 9.877626e-001,
+9.878418e-001, 9.879187e-001, 9.879934e-001, 9.880682e-001, 9.881430e-001, 9.882178e-001, 9.882926e-001, 9.883673e-001, 9.884421e-001, 9.885138e-001,
+9.885829e-001, 9.886521e-001, 9.887213e-001, 9.887904e-001, 9.888596e-001, 9.889287e-001, 9.889979e-001, 9.890638e-001, 9.891260e-001, 9.891883e-001,
+9.892506e-001, 9.893129e-001, 9.893752e-001, 9.894374e-001, 9.894997e-001, 9.895594e-001, 9.896135e-001, 9.896676e-001, 9.897217e-001, 9.897758e-001,
+9.898299e-001, 9.898840e-001, 9.899380e-001, 9.899916e-001, 9.900361e-001, 9.900807e-001, 9.901252e-001, 9.901698e-001, 9.902143e-001, 9.902589e-001,
+9.903034e-001, 9.903480e-001, 9.903848e-001, 9.904186e-001, 9.904523e-001, 9.904861e-001, 9.905198e-001, 9.905535e-001, 9.905873e-001, 9.906210e-001,
+9.906514e-001, 9.906733e-001, 9.906951e-001, 9.907170e-001, 9.907388e-001, 9.907607e-001, 9.907825e-001, 9.908044e-001, 9.908262e-001, 9.908388e-001,
+9.908485e-001, 9.908582e-001, 9.908678e-001, 9.908775e-001, 9.908872e-001, 9.908969e-001, 9.909065e-001, 9.909155e-001, 9.909202e-001, 9.909249e-001,
+9.909297e-001, 9.909344e-001, 9.909391e-001, 9.909438e-001, 9.909486e-001, 9.909533e-001, 9.909560e-001, 9.909560e-001, 9.909560e-001, 9.909560e-001,
+9.909560e-001, 9.909560e-001, 9.909560e-001, 9.909560e-001, 9.909560e-001, 9.909574e-001, 9.909597e-001, 9.909620e-001, 9.909643e-001, 9.909666e-001,
+9.909689e-001, 9.909712e-001, 9.909735e-001, 9.909758e-001, 9.909781e-001, 9.909804e-001, 9.909827e-001, 9.909850e-001, 9.909873e-001, 9.909896e-001,
+9.909919e-001, 9.909942e-001, 9.909965e-001, 9.910038e-001, 9.910130e-001, 9.910221e-001, 9.910313e-001, 9.910405e-001, 9.910496e-001, 9.910588e-001,
+9.910680e-001, 9.910771e-001, 9.910891e-001, 9.911027e-001, 9.911163e-001, 9.911299e-001, 9.911434e-001, 9.911570e-001, 9.911706e-001, 9.911842e-001,
+9.911978e-001, 9.912132e-001, 9.912310e-001, 9.912489e-001, 9.912667e-001, 9.912845e-001, 9.913023e-001, 9.913201e-001, 9.913379e-001, 9.913557e-001,
+9.913742e-001, 9.913959e-001, 9.914177e-001, 9.914395e-001, 9.914613e-001, 9.914831e-001, 9.915049e-001, 9.915266e-001, 9.915484e-001, 9.915702e-001,
+9.915947e-001, 9.916201e-001, 9.916454e-001, 9.916708e-001, 9.916961e-001, 9.917215e-001, 9.917468e-001, 9.917722e-001, 9.917975e-001, 9.918254e-001,
+9.918604e-001, 9.918953e-001, 9.919303e-001, 9.919653e-001, 9.920002e-001, 9.920352e-001, 9.920701e-001, 9.921051e-001, 9.921400e-001, 9.921805e-001,
+9.922238e-001, 9.922671e-001, 9.923103e-001, 9.923536e-001, 9.923969e-001, 9.924401e-001, 9.924834e-001, 9.925267e-001, 9.925699e-001, 9.926194e-001,
+9.926690e-001, 9.927187e-001, 9.927683e-001, 9.928180e-001, 9.928676e-001, 9.929173e-001, 9.929669e-001, 9.930166e-001, 9.930669e-001, 9.931212e-001,
+9.931754e-001, 9.932296e-001, 9.932839e-001, 9.933381e-001, 9.933923e-001, 9.934466e-001, 9.935008e-001, 9.935550e-001, 9.936100e-001, 9.936673e-001,
+9.937246e-001, 9.937819e-001, 9.938392e-001, 9.938965e-001, 9.939538e-001, 9.940111e-001, 9.940684e-001, 9.941257e-001, 9.941834e-001, 9.942425e-001,
+9.943017e-001, 9.943608e-001, 9.944200e-001, 9.944792e-001, 9.945383e-001, 9.945975e-001, 9.946566e-001, 9.947158e-001, 9.947746e-001, 9.948306e-001,
+9.948865e-001, 9.949424e-001, 9.949983e-001, 9.950542e-001, 9.951101e-001, 9.951661e-001, 9.952220e-001, 9.952779e-001, 9.953338e-001, 9.953922e-001,
+9.954510e-001, 9.955098e-001, 9.955687e-001, 9.956275e-001, 9.956863e-001, 9.957451e-001, 9.958039e-001, 9.958627e-001, 9.959216e-001, 9.959819e-001,
+9.960437e-001, 9.961055e-001, 9.961673e-001, 9.962291e-001, 9.962909e-001, 9.963527e-001, 9.964145e-001, 9.964763e-001, 9.965381e-001, 9.966000e-001,
+9.966641e-001, 9.967283e-001, 9.967924e-001, 9.968566e-001, 9.969207e-001, 9.969849e-001, 9.970490e-001, 9.971132e-001, 9.971773e-001, 9.972415e-001,
+9.973062e-001, 9.973717e-001, 9.974372e-001, 9.975027e-001, 9.975681e-001, 9.976336e-001, 9.976991e-001, 9.977646e-001, 9.978301e-001, 9.978955e-001,
+9.979610e-001, 9.980263e-001, 9.980916e-001, 9.981568e-001, 9.982221e-001, 9.982874e-001, 9.983526e-001, 9.984179e-001, 9.984831e-001, 9.985484e-001,
+9.986137e-001, 9.986789e-001, 9.987418e-001, 9.988046e-001, 9.988675e-001, 9.989303e-001, 9.989931e-001, 9.990559e-001, 9.991187e-001, 9.991815e-001,
+9.992443e-001, 9.993071e-001, 9.993697e-001, 9.994270e-001, 9.994843e-001, 9.995416e-001, 9.995989e-001, 9.996562e-001, 9.997135e-001, 9.997708e-001,
+9.998281e-001, 9.998854e-001, 9.999427e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.438386e-004, 7.142003e-004, 1.115217e-003, 1.547288e-003, 2.006878e-003, 2.498671e-003, 3.021316e-003, 3.577651e-003, 4.166888e-003,
+4.788501e-003, 5.445089e-003, 6.136147e-003, 6.859071e-003, 7.617648e-003, 8.412425e-003, 9.243980e-003, 1.011332e-002, 1.102547e-002, 1.197733e-002,
+1.296931e-002, 1.400187e-002, 1.507372e-002, 1.618372e-002, 1.733523e-002, 1.852228e-002, 1.975167e-002, 2.102119e-002, 2.233361e-002, 2.369059e-002,
+2.509339e-002, 2.653557e-002, 2.802454e-002, 2.956028e-002, 3.113856e-002, 3.276198e-002, 3.443157e-002, 3.614739e-002, 3.790511e-002, 3.970595e-002,
+4.154951e-002, 4.343697e-002, 4.537087e-002, 4.734617e-002, 4.936734e-002, 5.142615e-002, 5.353013e-002, 5.567735e-002, 5.786652e-002, 6.010716e-002,
+6.238940e-002, 6.471175e-002, 6.707459e-002, 6.948515e-002, 7.193404e-002, 7.442303e-002, 7.694822e-002, 7.951749e-002, 8.213372e-002, 8.478955e-002,
+8.749431e-002, 9.023543e-002, 9.301472e-002, 9.584025e-002, 9.870482e-002, 1.016041e-001, 1.045442e-001, 1.075214e-001, 1.105407e-001, 1.135977e-001,
+1.166936e-001, 1.198228e-001, 1.229954e-001, 1.262023e-001, 1.294421e-001, 1.327184e-001, 1.360210e-001, 1.393565e-001, 1.427318e-001, 1.461383e-001,
+1.495731e-001, 1.530420e-001, 1.565402e-001, 1.600638e-001, 1.636112e-001, 1.671816e-001, 1.707742e-001, 1.743833e-001, 1.780118e-001, 1.816574e-001,
+1.853219e-001, 1.890095e-001, 1.927215e-001, 1.964581e-001, 2.002174e-001, 2.039883e-001, 2.077812e-001, 2.115974e-001, 2.154301e-001, 2.192792e-001,
+2.231477e-001, 2.270365e-001, 2.309400e-001, 2.348692e-001, 2.388215e-001, 2.427939e-001, 2.467841e-001, 2.507896e-001, 2.548082e-001, 2.588364e-001,
+2.628707e-001, 2.669112e-001, 2.709618e-001, 2.750129e-001, 2.790606e-001, 2.831024e-001, 2.871333e-001, 2.911600e-001, 2.951761e-001, 2.991818e-001,
+3.031804e-001, 3.071657e-001, 3.111445e-001, 3.151197e-001, 3.190811e-001, 3.230371e-001, 3.269885e-001, 3.309373e-001, 3.348788e-001, 3.388132e-001,
+3.427393e-001, 3.466500e-001, 3.505468e-001, 3.544330e-001, 3.583127e-001, 3.621850e-001, 3.660446e-001, 3.698979e-001, 3.737413e-001, 3.775792e-001,
+3.814141e-001, 3.852417e-001, 3.890604e-001, 3.928706e-001, 3.966499e-001, 4.004212e-001, 4.041798e-001, 4.079318e-001, 4.116779e-001, 4.154145e-001,
+4.191451e-001, 4.228456e-001, 4.265332e-001, 4.302002e-001, 4.338528e-001, 4.374972e-001, 4.411130e-001, 4.447222e-001, 4.483056e-001, 4.518765e-001,
+4.554122e-001, 4.589309e-001, 4.624272e-001, 4.658999e-001, 4.693557e-001, 4.727905e-001, 4.762170e-001, 4.796275e-001, 4.830345e-001, 4.864130e-001,
+4.897888e-001, 4.931453e-001, 4.965006e-001, 4.998255e-001, 5.031486e-001, 5.064403e-001, 5.097303e-001, 5.129926e-001, 5.162527e-001, 5.194661e-001,
+5.226792e-001, 5.258497e-001, 5.290202e-001, 5.321524e-001, 5.352825e-001, 5.383894e-001, 5.414927e-001, 5.445663e-001, 5.476305e-001, 5.506602e-001,
+5.536697e-001, 5.566582e-001, 5.596239e-001, 5.625798e-001, 5.655139e-001, 5.684433e-001, 5.713354e-001, 5.742275e-001, 5.770719e-001, 5.799103e-001,
+5.827142e-001, 5.854988e-001, 5.882691e-001, 5.910150e-001, 5.937580e-001, 5.964655e-001, 5.991730e-001, 6.018517e-001, 6.045211e-001, 6.071750e-001,
+6.098068e-001, 6.124359e-001, 6.150038e-001, 6.175718e-001, 6.200997e-001, 6.226057e-001, 6.251030e-001, 6.275702e-001, 6.300374e-001, 6.324740e-001,
+6.349017e-001, 6.373167e-001, 6.397023e-001, 6.420880e-001, 6.444456e-001, 6.467963e-001, 6.491395e-001, 6.514626e-001, 6.537856e-001, 6.560756e-001,
+6.583524e-001, 6.606240e-001, 6.628613e-001, 6.650987e-001, 6.673101e-001, 6.694975e-001, 6.716848e-001, 6.738217e-001, 6.759517e-001, 6.780722e-001,
+6.801573e-001, 6.822423e-001, 6.843022e-001, 6.863384e-001, 6.883745e-001, 6.903743e-001, 6.923641e-001, 6.943527e-001, 6.963013e-001, 6.982499e-001,
+7.001879e-001, 7.020930e-001, 7.039981e-001, 7.058872e-001, 7.077549e-001, 7.096226e-001, 7.114666e-001, 7.132934e-001, 7.151202e-001, 7.169187e-001,
+7.187050e-001, 7.204913e-001, 7.222427e-001, 7.239849e-001, 7.257270e-001, 7.274337e-001, 7.291341e-001, 7.308345e-001, 7.325049e-001, 7.341711e-001,
+7.358373e-001, 7.374769e-001, 7.391128e-001, 7.407486e-001, 7.423660e-001, 7.439797e-001, 7.455935e-001, 7.471753e-001, 7.487472e-001, 7.503192e-001,
+7.518702e-001, 7.534103e-001, 7.549505e-001, 7.564717e-001, 7.579757e-001, 7.594797e-001, 7.609726e-001, 7.624450e-001, 7.639175e-001, 7.653834e-001,
+7.668110e-001, 7.682386e-001, 7.696663e-001, 7.710727e-001, 7.724770e-001, 7.738813e-001, 7.752763e-001, 7.766660e-001, 7.780556e-001, 7.794316e-001,
+7.807787e-001, 7.821258e-001, 7.834729e-001, 7.847925e-001, 7.861112e-001, 7.874300e-001, 7.887394e-001, 7.900424e-001, 7.913453e-001, 7.926431e-001,
+7.939155e-001, 7.951878e-001, 7.964602e-001, 7.977172e-001, 7.989681e-001, 8.002189e-001, 8.014594e-001, 8.026627e-001, 8.038660e-001, 8.050693e-001,
+8.062510e-001, 8.074227e-001, 8.085945e-001, 8.097618e-001, 8.108942e-001, 8.120266e-001, 8.131590e-001, 8.142759e-001, 8.153776e-001, 8.164793e-001,
+8.175811e-001, 8.186519e-001, 8.197176e-001, 8.207833e-001, 8.218469e-001, 8.229006e-001, 8.239542e-001, 8.250078e-001, 8.260519e-001, 8.270838e-001,
+8.281157e-001, 8.291477e-001, 8.301672e-001, 8.311807e-001, 8.321941e-001, 8.332076e-001, 8.341963e-001, 8.351811e-001, 8.361659e-001, 8.371505e-001,
+8.381142e-001, 8.390779e-001, 8.400416e-001, 8.410019e-001, 8.419361e-001, 8.428703e-001, 8.438046e-001, 8.447363e-001, 8.456569e-001, 8.465776e-001,
+8.474982e-001, 8.484144e-001, 8.493137e-001, 8.502130e-001, 8.511123e-001, 8.520067e-001, 8.528792e-001, 8.537517e-001, 8.546241e-001, 8.554927e-001,
+8.563321e-001, 8.571715e-001, 8.580110e-001, 8.588502e-001, 8.596741e-001, 8.604980e-001, 8.613219e-001, 8.621458e-001, 8.629440e-001, 8.637380e-001,
+8.645321e-001, 8.653261e-001, 8.661042e-001, 8.668742e-001, 8.676441e-001, 8.684141e-001, 8.691806e-001, 8.699422e-001, 8.707038e-001, 8.714654e-001,
+8.722240e-001, 8.729616e-001, 8.736993e-001, 8.744369e-001, 8.751746e-001, 8.758922e-001, 8.766046e-001, 8.773170e-001, 8.780294e-001, 8.787424e-001,
+8.794564e-001, 8.801705e-001, 8.808845e-001, 8.815985e-001, 8.823022e-001, 8.830056e-001, 8.837091e-001, 8.844125e-001, 8.851083e-001, 8.857964e-001,
+8.864845e-001, 8.871727e-001, 8.878608e-001, 8.885198e-001, 8.891779e-001, 8.898361e-001, 8.904942e-001, 8.911437e-001, 8.917800e-001, 8.924163e-001,
+8.930526e-001, 8.936889e-001, 8.942997e-001, 8.949031e-001, 8.955064e-001, 8.961097e-001, 8.967118e-001, 8.973020e-001, 8.978921e-001, 8.984823e-001,
+8.990725e-001, 8.996540e-001, 9.002209e-001, 9.007878e-001, 9.013546e-001, 9.019215e-001, 9.024796e-001, 9.030316e-001, 9.035837e-001, 9.041357e-001,
+9.046877e-001, 9.052294e-001, 9.057678e-001, 9.063061e-001, 9.068445e-001, 9.073829e-001, 9.079147e-001, 9.084457e-001, 9.089766e-001, 9.095076e-001,
+9.100386e-001, 9.105516e-001, 9.110635e-001, 9.115754e-001, 9.120874e-001, 9.125993e-001, 9.130939e-001, 9.135877e-001, 9.140815e-001, 9.145753e-001,
+9.150691e-001, 9.155386e-001, 9.160057e-001, 9.164728e-001, 9.169399e-001, 9.174070e-001, 9.178672e-001, 9.183259e-001, 9.187846e-001, 9.192432e-001,
+9.197019e-001, 9.201497e-001, 9.205918e-001, 9.210340e-001, 9.214762e-001, 9.219184e-001, 9.223541e-001, 9.227822e-001, 9.232103e-001, 9.236383e-001,
+9.240664e-001, 9.244916e-001, 9.249045e-001, 9.253175e-001, 9.257304e-001, 9.261433e-001, 9.265562e-001, 9.269578e-001, 9.273577e-001, 9.277576e-001,
+9.281575e-001, 9.285574e-001, 9.289472e-001, 9.293262e-001, 9.297051e-001, 9.300841e-001, 9.304631e-001, 9.308412e-001, 9.312015e-001, 9.315618e-001,
+9.319220e-001, 9.322823e-001, 9.326426e-001, 9.330029e-001, 9.333632e-001, 9.337235e-001, 9.340837e-001, 9.344440e-001, 9.348043e-001, 9.351576e-001,
+9.355109e-001, 9.358642e-001, 9.362174e-001, 9.365707e-001, 9.369189e-001, 9.372588e-001, 9.375988e-001, 9.379387e-001, 9.382786e-001, 9.386185e-001,
+9.389562e-001, 9.392928e-001, 9.396294e-001, 9.399661e-001, 9.403027e-001, 9.406394e-001, 9.409671e-001, 9.412944e-001, 9.416217e-001, 9.419491e-001,
+9.422764e-001, 9.426027e-001, 9.429237e-001, 9.432446e-001, 9.435655e-001, 9.438865e-001, 9.442074e-001, 9.445272e-001, 9.448443e-001, 9.451613e-001,
+9.454783e-001, 9.457954e-001, 9.461124e-001, 9.464285e-001, 9.467430e-001, 9.470575e-001, 9.473719e-001, 9.476864e-001, 9.480009e-001, 9.483118e-001,
+9.486168e-001, 9.489219e-001, 9.492269e-001, 9.495319e-001, 9.498370e-001, 9.501399e-001, 9.504382e-001, 9.507365e-001, 9.510348e-001, 9.513331e-001,
+9.516314e-001, 9.519273e-001, 9.522131e-001, 9.524989e-001, 9.527846e-001, 9.530704e-001, 9.533562e-001, 9.536419e-001, 9.539102e-001, 9.541785e-001,
+9.544467e-001, 9.547150e-001, 9.549833e-001, 9.552516e-001, 9.555095e-001, 9.557638e-001, 9.560182e-001, 9.562726e-001, 9.565270e-001, 9.567814e-001,
+9.570345e-001, 9.572860e-001, 9.575374e-001, 9.577888e-001, 9.580403e-001, 9.582917e-001, 9.585429e-001, 9.587876e-001, 9.590323e-001, 9.592769e-001,
+9.595216e-001, 9.597663e-001, 9.600110e-001, 9.602542e-001, 9.604964e-001, 9.607386e-001, 9.609808e-001, 9.612230e-001, 9.614651e-001, 9.617071e-001,
+9.619416e-001, 9.621762e-001, 9.624108e-001, 9.626453e-001, 9.628799e-001, 9.631145e-001, 9.633466e-001, 9.635754e-001, 9.638043e-001, 9.640332e-001,
+9.642621e-001, 9.644909e-001, 9.647198e-001, 9.649403e-001, 9.651581e-001, 9.653759e-001, 9.655937e-001, 9.658116e-001, 9.660294e-001, 9.662471e-001,
+9.664586e-001, 9.666702e-001, 9.668817e-001, 9.670932e-001, 9.673047e-001, 9.675163e-001, 9.677258e-001, 9.679268e-001, 9.681278e-001, 9.683288e-001,
+9.685298e-001, 9.687308e-001, 9.689318e-001, 9.691284e-001, 9.693146e-001, 9.695009e-001, 9.696871e-001, 9.698734e-001, 9.700596e-001, 9.702459e-001,
+9.704262e-001, 9.705942e-001, 9.707623e-001, 9.709303e-001, 9.710983e-001, 9.712664e-001, 9.714344e-001, 9.715990e-001, 9.717546e-001, 9.719102e-001,
+9.720658e-001, 9.722214e-001, 9.723770e-001, 9.725326e-001, 9.726879e-001, 9.728415e-001, 9.729952e-001, 9.731489e-001, 9.733025e-001, 9.734562e-001,
+9.736099e-001, 9.737635e-001, 9.739124e-001, 9.740611e-001, 9.742098e-001, 9.743585e-001, 9.745071e-001, 9.746558e-001, 9.748045e-001, 9.749522e-001,
+9.750993e-001, 9.752465e-001, 9.753937e-001, 9.755409e-001, 9.756881e-001, 9.758353e-001, 9.759811e-001, 9.761243e-001, 9.762675e-001, 9.764107e-001,
+9.765539e-001, 9.766971e-001, 9.768403e-001, 9.769834e-001, 9.771208e-001, 9.772575e-001, 9.773942e-001, 9.775309e-001, 9.776676e-001, 9.778043e-001,
+9.779410e-001, 9.780769e-001, 9.782114e-001, 9.783458e-001, 9.784803e-001, 9.786148e-001, 9.787493e-001, 9.788838e-001, 9.790182e-001, 9.791533e-001,
+9.792885e-001, 9.794237e-001, 9.795590e-001, 9.796942e-001, 9.798294e-001, 9.799646e-001, 9.800997e-001, 9.802331e-001, 9.803666e-001, 9.805001e-001,
+9.806335e-001, 9.807670e-001, 9.809004e-001, 9.810339e-001, 9.811660e-001, 9.812954e-001, 9.814248e-001, 9.815542e-001, 9.816836e-001, 9.818131e-001,
+9.819425e-001, 9.820719e-001, 9.821983e-001, 9.823215e-001, 9.824448e-001, 9.825681e-001, 9.826913e-001, 9.828146e-001, 9.829379e-001, 9.830612e-001,
+9.831799e-001, 9.832950e-001, 9.834102e-001, 9.835253e-001, 9.836405e-001, 9.837556e-001, 9.838708e-001, 9.839859e-001, 9.840956e-001, 9.842007e-001,
+9.843058e-001, 9.844108e-001, 9.845159e-001, 9.846210e-001, 9.847261e-001, 9.848312e-001, 9.849311e-001, 9.850244e-001, 9.851178e-001, 9.852111e-001,
+9.853045e-001, 9.853978e-001, 9.854912e-001, 9.855846e-001, 9.856761e-001, 9.857621e-001, 9.858481e-001, 9.859342e-001, 9.860202e-001, 9.861062e-001,
+9.861923e-001, 9.862783e-001, 9.863643e-001, 9.864418e-001, 9.865189e-001, 9.865960e-001, 9.866732e-001, 9.867503e-001, 9.868275e-001, 9.869046e-001,
+9.869817e-001, 9.870570e-001, 9.871310e-001, 9.872050e-001, 9.872789e-001, 9.873529e-001, 9.874269e-001, 9.875009e-001, 9.875749e-001, 9.876483e-001,
+9.877181e-001, 9.877879e-001, 9.878577e-001, 9.879275e-001, 9.879974e-001, 9.880672e-001, 9.881370e-001, 9.882068e-001, 9.882771e-001, 9.883476e-001,
+9.884182e-001, 9.884888e-001, 9.885594e-001, 9.886300e-001, 9.887005e-001, 9.887711e-001, 9.888417e-001, 9.889119e-001, 9.889820e-001, 9.890522e-001,
+9.891224e-001, 9.891925e-001, 9.892627e-001, 9.893328e-001, 9.894030e-001, 9.894727e-001, 9.895406e-001, 9.896085e-001, 9.896764e-001, 9.897443e-001,
+9.898123e-001, 9.898802e-001, 9.899481e-001, 9.900160e-001, 9.900824e-001, 9.901462e-001, 9.902100e-001, 9.902737e-001, 9.903375e-001, 9.904012e-001,
+9.904650e-001, 9.905287e-001, 9.905925e-001, 9.906536e-001, 9.907113e-001, 9.907689e-001, 9.908266e-001, 9.908842e-001, 9.909419e-001, 9.909995e-001,
+9.910572e-001, 9.911148e-001, 9.911693e-001, 9.912190e-001, 9.912687e-001, 9.913184e-001, 9.913681e-001, 9.914177e-001, 9.914674e-001, 9.915171e-001,
+9.915668e-001, 9.916140e-001, 9.916546e-001, 9.916951e-001, 9.917357e-001, 9.917762e-001, 9.918168e-001, 9.918574e-001, 9.918979e-001, 9.919385e-001,
+9.919789e-001, 9.920161e-001, 9.920533e-001, 9.920905e-001, 9.921277e-001, 9.921649e-001, 9.922021e-001, 9.922393e-001, 9.922765e-001, 9.923137e-001,
+9.923480e-001, 9.923813e-001, 9.924145e-001, 9.924478e-001, 9.924810e-001, 9.925143e-001, 9.925475e-001, 9.925807e-001, 9.926140e-001, 9.926488e-001,
+9.926875e-001, 9.927261e-001, 9.927648e-001, 9.928034e-001, 9.928421e-001, 9.928807e-001, 9.929194e-001, 9.929580e-001, 9.929967e-001, 9.930392e-001,
+9.930828e-001, 9.931264e-001, 9.931701e-001, 9.932137e-001, 9.932574e-001, 9.933010e-001, 9.933447e-001, 9.933883e-001, 9.934325e-001, 9.934805e-001,
+9.935285e-001, 9.935765e-001, 9.936244e-001, 9.936724e-001, 9.937204e-001, 9.937683e-001, 9.938163e-001, 9.938643e-001, 9.939137e-001, 9.939653e-001,
+9.940168e-001, 9.940684e-001, 9.941200e-001, 9.941715e-001, 9.942231e-001, 9.942746e-001, 9.943262e-001, 9.943778e-001, 9.944309e-001, 9.944852e-001,
+9.945395e-001, 9.945938e-001, 9.946480e-001, 9.947023e-001, 9.947566e-001, 9.948109e-001, 9.948652e-001, 9.949195e-001, 9.949749e-001, 9.950309e-001,
+9.950869e-001, 9.951429e-001, 9.951989e-001, 9.952550e-001, 9.953110e-001, 9.953670e-001, 9.954230e-001, 9.954790e-001, 9.955354e-001, 9.955920e-001,
+9.956486e-001, 9.957052e-001, 9.957619e-001, 9.958185e-001, 9.958751e-001, 9.959317e-001, 9.959883e-001, 9.960449e-001, 9.961013e-001, 9.961574e-001,
+9.962134e-001, 9.962695e-001, 9.963255e-001, 9.963815e-001, 9.964376e-001, 9.964936e-001, 9.965497e-001, 9.966057e-001, 9.966616e-001, 9.967159e-001,
+9.967702e-001, 9.968245e-001, 9.968789e-001, 9.969332e-001, 9.969875e-001, 9.970419e-001, 9.970962e-001, 9.971505e-001, 9.972048e-001, 9.972572e-001,
+9.973088e-001, 9.973604e-001, 9.974119e-001, 9.974635e-001, 9.975151e-001, 9.975667e-001, 9.976183e-001, 9.976699e-001, 9.977215e-001, 9.977723e-001,
+9.978203e-001, 9.978683e-001, 9.979163e-001, 9.979643e-001, 9.980123e-001, 9.980603e-001, 9.981083e-001, 9.981563e-001, 9.982043e-001, 9.982523e-001,
+9.982976e-001, 9.983414e-001, 9.983851e-001, 9.984289e-001, 9.984726e-001, 9.985164e-001, 9.985601e-001, 9.986039e-001, 9.986476e-001, 9.986914e-001,
+9.987351e-001, 9.987768e-001, 9.988182e-001, 9.988597e-001, 9.989011e-001, 9.989426e-001, 9.989840e-001, 9.990255e-001, 9.990669e-001, 9.991084e-001,
+9.991498e-001, 9.991911e-001, 9.992295e-001, 9.992678e-001, 9.993061e-001, 9.993445e-001, 9.993828e-001, 9.994212e-001, 9.994595e-001, 9.994979e-001,
+9.995362e-001, 9.995746e-001, 9.996126e-001, 9.996479e-001, 9.996831e-001, 9.997183e-001, 9.997535e-001, 9.997887e-001, 9.998239e-001, 9.998591e-001,
+9.998944e-001, 9.999296e-001, 9.999648e-001, 1.000000e+000)),
+("Kodak", "Ektachrome E100S", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.622885e-004, 7.382494e-004, 1.132498e-003, 1.544729e-003, 1.982284e-003, 2.449683e-003, 2.942674e-003, 3.461052e-003, 4.006115e-003,
+4.579225e-003, 5.183887e-003, 5.823756e-003, 6.496035e-003, 7.203922e-003, 7.950540e-003, 8.736769e-003, 9.558484e-003, 1.041249e-002, 1.129897e-002,
+1.222001e-002, 1.317551e-002, 1.417130e-002, 1.520686e-002, 1.628017e-002, 1.738356e-002, 1.852104e-002, 1.968544e-002, 2.088140e-002, 2.211858e-002,
+2.340444e-002, 2.473985e-002, 2.611586e-002, 2.753941e-002, 2.900603e-002, 3.051296e-002, 3.206347e-002, 3.365370e-002, 3.528614e-002, 3.696755e-002,
+3.869815e-002, 4.047452e-002, 4.229771e-002, 4.417264e-002, 4.609961e-002, 4.808874e-002, 5.012752e-002, 5.222077e-002, 5.436719e-002, 5.656637e-002,
+5.881873e-002, 6.112720e-002, 6.347485e-002, 6.587607e-002, 6.834007e-002, 7.085117e-002, 7.342339e-002, 7.604770e-002, 7.872818e-002, 8.145334e-002,
+8.422914e-002, 8.706403e-002, 8.994509e-002, 9.287831e-002, 9.587422e-002, 9.890815e-002, 1.019898e-001, 1.051272e-001, 1.083052e-001, 1.115389e-001,
+1.148212e-001, 1.181530e-001, 1.215258e-001, 1.249411e-001, 1.283981e-001, 1.318998e-001, 1.354436e-001, 1.390311e-001, 1.426660e-001, 1.463364e-001,
+1.500398e-001, 1.537826e-001, 1.575698e-001, 1.613817e-001, 1.652164e-001, 1.690933e-001, 1.729969e-001, 1.769411e-001, 1.809352e-001, 1.849523e-001,
+1.889985e-001, 1.930781e-001, 1.971941e-001, 2.013469e-001, 2.055313e-001, 2.097439e-001, 2.139831e-001, 2.182557e-001, 2.225302e-001, 2.268306e-001,
+2.311581e-001, 2.355094e-001, 2.398718e-001, 2.442272e-001, 2.485899e-001, 2.529604e-001, 2.573277e-001, 2.616989e-001, 2.660799e-001, 2.704606e-001,
+2.748312e-001, 2.791988e-001, 2.835668e-001, 2.879389e-001, 2.923108e-001, 2.966753e-001, 3.010304e-001, 3.053743e-001, 3.097003e-001, 3.140352e-001,
+3.183708e-001, 3.226906e-001, 3.270022e-001, 3.313121e-001, 3.356219e-001, 3.399326e-001, 3.442340e-001, 3.485252e-001, 3.527927e-001, 3.570409e-001,
+3.612729e-001, 3.654754e-001, 3.696605e-001, 3.738317e-001, 3.779727e-001, 3.820927e-001, 3.861967e-001, 3.902787e-001, 3.943498e-001, 3.984076e-001,
+4.024240e-001, 4.064257e-001, 4.104037e-001, 4.143417e-001, 4.182565e-001, 4.221282e-001, 4.259957e-001, 4.298555e-001, 4.336968e-001, 4.375285e-001,
+4.413171e-001, 4.450969e-001, 4.488552e-001, 4.526068e-001, 4.563523e-001, 4.600827e-001, 4.638085e-001, 4.674849e-001, 4.711488e-001, 4.747653e-001,
+4.783576e-001, 4.819137e-001, 4.854590e-001, 4.889962e-001, 4.925226e-001, 4.960449e-001, 4.995129e-001, 5.029718e-001, 5.064191e-001, 5.098642e-001,
+5.132803e-001, 5.166903e-001, 5.200588e-001, 5.234237e-001, 5.267718e-001, 5.301046e-001, 5.333795e-001, 5.366391e-001, 5.398436e-001, 5.430373e-001,
+5.461882e-001, 5.493322e-001, 5.524413e-001, 5.555447e-001, 5.586011e-001, 5.616549e-001, 5.646228e-001, 5.675906e-001, 5.705261e-001, 5.734590e-001,
+5.763446e-001, 5.792184e-001, 5.820408e-001, 5.848356e-001, 5.875927e-001, 5.903086e-001, 5.930046e-001, 5.956503e-001, 5.982949e-001, 6.009236e-001,
+6.035524e-001, 6.061716e-001, 6.087888e-001, 6.113740e-001, 6.139331e-001, 6.164815e-001, 6.189995e-001, 6.215175e-001, 6.240080e-001, 6.264969e-001,
+6.289772e-001, 6.314516e-001, 6.339148e-001, 6.363408e-001, 6.387668e-001, 6.411426e-001, 6.435088e-001, 6.458575e-001, 6.481821e-001, 6.505067e-001,
+6.528094e-001, 6.551115e-001, 6.573888e-001, 6.596413e-001, 6.618937e-001, 6.641113e-001, 6.663289e-001, 6.685290e-001, 6.707098e-001, 6.728905e-001,
+6.750383e-001, 6.771833e-001, 6.793135e-001, 6.814151e-001, 6.835167e-001, 6.855755e-001, 6.876185e-001, 6.896558e-001, 6.916379e-001, 6.936199e-001,
+6.955877e-001, 6.975364e-001, 6.994851e-001, 7.013980e-001, 7.032978e-001, 7.051974e-001, 7.070761e-001, 7.089548e-001, 7.108244e-001, 7.126673e-001,
+7.145102e-001, 7.163286e-001, 7.181194e-001, 7.199102e-001, 7.216754e-001, 7.234272e-001, 7.251790e-001, 7.269017e-001, 7.286177e-001, 7.303336e-001,
+7.319886e-001, 7.336396e-001, 7.352888e-001, 7.368847e-001, 7.384806e-001, 7.400731e-001, 7.416329e-001, 7.431928e-001, 7.447494e-001, 7.462830e-001,
+7.478165e-001, 7.493440e-001, 7.508273e-001, 7.523107e-001, 7.537911e-001, 7.552407e-001, 7.566903e-001, 7.581396e-001, 7.595730e-001, 7.610063e-001,
+7.624397e-001, 7.638342e-001, 7.652254e-001, 7.666165e-001, 7.679902e-001, 7.693590e-001, 7.707279e-001, 7.720706e-001, 7.733970e-001, 7.747235e-001,
+7.760393e-001, 7.773400e-001, 7.786408e-001, 7.799372e-001, 7.812135e-001, 7.824897e-001, 7.837660e-001, 7.850178e-001, 7.862670e-001, 7.875162e-001,
+7.887520e-001, 7.899787e-001, 7.912054e-001, 7.924262e-001, 7.936294e-001, 7.948326e-001, 7.960357e-001, 7.972221e-001, 7.984061e-001, 7.995900e-001,
+8.007580e-001, 8.019068e-001, 8.030557e-001, 8.042045e-001, 8.053394e-001, 8.064744e-001, 8.076094e-001, 8.087307e-001, 8.098389e-001, 8.109472e-001,
+8.120555e-001, 8.131191e-001, 8.141819e-001, 8.152447e-001, 8.162903e-001, 8.173117e-001, 8.183331e-001, 8.193544e-001, 8.203511e-001, 8.213420e-001,
+8.223329e-001, 8.233173e-001, 8.242688e-001, 8.252202e-001, 8.261717e-001, 8.271054e-001, 8.280198e-001, 8.289342e-001, 8.298486e-001, 8.307465e-001,
+8.316390e-001, 8.325315e-001, 8.334240e-001, 8.342830e-001, 8.351417e-001, 8.360004e-001, 8.368576e-001, 8.377087e-001, 8.385598e-001, 8.394109e-001,
+8.402518e-001, 8.410723e-001, 8.418928e-001, 8.427134e-001, 8.435238e-001, 8.443217e-001, 8.451195e-001, 8.459174e-001, 8.467006e-001, 8.474699e-001,
+8.482393e-001, 8.490086e-001, 8.497788e-001, 8.505498e-001, 8.513207e-001, 8.520916e-001, 8.528512e-001, 8.536006e-001, 8.543500e-001, 8.550994e-001,
+8.558359e-001, 8.565575e-001, 8.572790e-001, 8.580006e-001, 8.587100e-001, 8.593978e-001, 8.600856e-001, 8.607734e-001, 8.614576e-001, 8.621284e-001,
+8.627992e-001, 8.634700e-001, 8.641407e-001, 8.648100e-001, 8.654794e-001, 8.661487e-001, 8.668180e-001, 8.674688e-001, 8.681143e-001, 8.687598e-001,
+8.694053e-001, 8.700295e-001, 8.706319e-001, 8.712343e-001, 8.718366e-001, 8.724340e-001, 8.730055e-001, 8.735770e-001, 8.741485e-001, 8.747200e-001,
+8.752838e-001, 8.758455e-001, 8.764071e-001, 8.769688e-001, 8.775206e-001, 8.780546e-001, 8.785887e-001, 8.791227e-001, 8.796568e-001, 8.801620e-001,
+8.806634e-001, 8.811649e-001, 8.816663e-001, 8.821567e-001, 8.826276e-001, 8.830985e-001, 8.835694e-001, 8.840403e-001, 8.845029e-001, 8.849633e-001,
+8.854237e-001, 8.858841e-001, 8.863461e-001, 8.868156e-001, 8.872851e-001, 8.877546e-001, 8.882240e-001, 8.886895e-001, 8.891508e-001, 8.896122e-001,
+8.900736e-001, 8.905349e-001, 8.909786e-001, 8.914171e-001, 8.918557e-001, 8.922942e-001, 8.927328e-001, 8.931676e-001, 8.936024e-001, 8.940372e-001,
+8.944720e-001, 8.949096e-001, 8.953595e-001, 8.958095e-001, 8.962594e-001, 8.967094e-001, 8.971595e-001, 8.976099e-001, 8.980603e-001, 8.985107e-001,
+8.989611e-001, 8.994054e-001, 8.998396e-001, 9.002737e-001, 9.007078e-001, 9.011420e-001, 9.015652e-001, 9.019711e-001, 9.023771e-001, 9.027830e-001,
+9.031889e-001, 9.035964e-001, 9.040069e-001, 9.044173e-001, 9.048277e-001, 9.052381e-001, 9.056466e-001, 9.060495e-001, 9.064525e-001, 9.068554e-001,
+9.072583e-001, 9.076608e-001, 9.080597e-001, 9.084586e-001, 9.088575e-001, 9.092564e-001, 9.096553e-001, 9.100392e-001, 9.104216e-001, 9.108039e-001,
+9.111863e-001, 9.115687e-001, 9.119420e-001, 9.123104e-001, 9.126789e-001, 9.130473e-001, 9.134157e-001, 9.137811e-001, 9.141400e-001, 9.144990e-001,
+9.148579e-001, 9.152169e-001, 9.155759e-001, 9.159142e-001, 9.162516e-001, 9.165889e-001, 9.169263e-001, 9.172637e-001, 9.175905e-001, 9.179077e-001,
+9.182248e-001, 9.185420e-001, 9.188591e-001, 9.191758e-001, 9.194787e-001, 9.197816e-001, 9.200844e-001, 9.203873e-001, 9.206902e-001, 9.209961e-001,
+9.213052e-001, 9.216143e-001, 9.219235e-001, 9.222326e-001, 9.225418e-001, 9.228464e-001, 9.231504e-001, 9.234544e-001, 9.237584e-001, 9.240624e-001,
+9.243631e-001, 9.246509e-001, 9.249387e-001, 9.252265e-001, 9.255142e-001, 9.258020e-001, 9.260784e-001, 9.263416e-001, 9.266049e-001, 9.268681e-001,
+9.271314e-001, 9.273946e-001, 9.276559e-001, 9.279161e-001, 9.281764e-001, 9.284367e-001, 9.286970e-001, 9.289573e-001, 9.292187e-001, 9.294803e-001,
+9.297419e-001, 9.300035e-001, 9.302651e-001, 9.305268e-001, 9.307944e-001, 9.310628e-001, 9.313312e-001, 9.315996e-001, 9.318680e-001, 9.321364e-001,
+9.324026e-001, 9.326686e-001, 9.329346e-001, 9.332006e-001, 9.334665e-001, 9.337325e-001, 9.339888e-001, 9.342434e-001, 9.344980e-001, 9.347526e-001,
+9.350072e-001, 9.352618e-001, 9.355120e-001, 9.357607e-001, 9.360094e-001, 9.362582e-001, 9.365069e-001, 9.367556e-001, 9.369971e-001, 9.372327e-001,
+9.374684e-001, 9.377040e-001, 9.379396e-001, 9.381753e-001, 9.384090e-001, 9.386385e-001, 9.388679e-001, 9.390973e-001, 9.393268e-001, 9.395562e-001,
+9.397856e-001, 9.400131e-001, 9.402405e-001, 9.404679e-001, 9.406953e-001, 9.409227e-001, 9.411501e-001, 9.413791e-001, 9.416092e-001, 9.418393e-001,
+9.420694e-001, 9.422995e-001, 9.425296e-001, 9.427592e-001, 9.429851e-001, 9.432110e-001, 9.434369e-001, 9.436628e-001, 9.438887e-001, 9.441146e-001,
+9.443339e-001, 9.445490e-001, 9.447641e-001, 9.449792e-001, 9.451943e-001, 9.454094e-001, 9.456244e-001, 9.458345e-001, 9.460445e-001, 9.462546e-001,
+9.464646e-001, 9.466746e-001, 9.468847e-001, 9.470942e-001, 9.473028e-001, 9.475115e-001, 9.477201e-001, 9.479287e-001, 9.481373e-001, 9.483459e-001,
+9.485498e-001, 9.487507e-001, 9.489515e-001, 9.491523e-001, 9.493531e-001, 9.495540e-001, 9.497548e-001, 9.499650e-001, 9.501776e-001, 9.503902e-001,
+9.506028e-001, 9.508154e-001, 9.510280e-001, 9.512406e-001, 9.514578e-001, 9.516754e-001, 9.518931e-001, 9.521107e-001, 9.523284e-001, 9.525460e-001,
+9.527637e-001, 9.529777e-001, 9.531914e-001, 9.534052e-001, 9.536189e-001, 9.538327e-001, 9.540465e-001, 9.542602e-001, 9.544740e-001, 9.546877e-001,
+9.549015e-001, 9.551152e-001, 9.553289e-001, 9.555427e-001, 9.557564e-001, 9.559655e-001, 9.561733e-001, 9.563812e-001, 9.565890e-001, 9.567969e-001,
+9.570047e-001, 9.572126e-001, 9.574205e-001, 9.576283e-001, 9.578362e-001, 9.580441e-001, 9.582520e-001, 9.584599e-001, 9.586678e-001, 9.588737e-001,
+9.590757e-001, 9.592777e-001, 9.594797e-001, 9.596817e-001, 9.598836e-001, 9.600856e-001, 9.602876e-001, 9.604778e-001, 9.606678e-001, 9.608578e-001,
+9.610478e-001, 9.612378e-001, 9.614278e-001, 9.616177e-001, 9.617975e-001, 9.619693e-001, 9.621410e-001, 9.623127e-001, 9.624844e-001, 9.626561e-001,
+9.628278e-001, 9.629983e-001, 9.631455e-001, 9.632926e-001, 9.634398e-001, 9.635870e-001, 9.637341e-001, 9.638813e-001, 9.640285e-001, 9.641625e-001,
+9.642811e-001, 9.643997e-001, 9.645183e-001, 9.646369e-001, 9.647555e-001, 9.648741e-001, 9.649927e-001, 9.651055e-001, 9.652166e-001, 9.653277e-001,
+9.654389e-001, 9.655500e-001, 9.656612e-001, 9.657723e-001, 9.658838e-001, 9.660049e-001, 9.661260e-001, 9.662471e-001, 9.663682e-001, 9.664893e-001,
+9.666104e-001, 9.667315e-001, 9.668538e-001, 9.669811e-001, 9.671084e-001, 9.672357e-001, 9.673629e-001, 9.674902e-001, 9.676175e-001, 9.677448e-001,
+9.678722e-001, 9.680001e-001, 9.681280e-001, 9.682559e-001, 9.683838e-001, 9.685117e-001, 9.686396e-001, 9.687675e-001, 9.688940e-001, 9.690169e-001,
+9.691397e-001, 9.692626e-001, 9.693854e-001, 9.695082e-001, 9.696311e-001, 9.697539e-001, 9.698750e-001, 9.699872e-001, 9.700994e-001, 9.702115e-001,
+9.703237e-001, 9.704359e-001, 9.705480e-001, 9.706602e-001, 9.707723e-001, 9.708714e-001, 9.709703e-001, 9.710691e-001, 9.711679e-001, 9.712667e-001,
+9.713655e-001, 9.714643e-001, 9.715631e-001, 9.716647e-001, 9.717674e-001, 9.718701e-001, 9.719728e-001, 9.720755e-001, 9.721782e-001, 9.722810e-001,
+9.723837e-001, 9.724902e-001, 9.726038e-001, 9.727175e-001, 9.728312e-001, 9.729448e-001, 9.730585e-001, 9.731722e-001, 9.732859e-001, 9.733995e-001,
+9.735302e-001, 9.736629e-001, 9.737957e-001, 9.739285e-001, 9.740612e-001, 9.741940e-001, 9.743268e-001, 9.744595e-001, 9.745974e-001, 9.747449e-001,
+9.748925e-001, 9.750400e-001, 9.751875e-001, 9.753351e-001, 9.754826e-001, 9.756301e-001, 9.757777e-001, 9.759316e-001, 9.760882e-001, 9.762448e-001,
+9.764014e-001, 9.765580e-001, 9.767146e-001, 9.768712e-001, 9.770278e-001, 9.771844e-001, 9.773445e-001, 9.775047e-001, 9.776650e-001, 9.778252e-001,
+9.779855e-001, 9.781457e-001, 9.783059e-001, 9.784662e-001, 9.786262e-001, 9.787849e-001, 9.789437e-001, 9.791024e-001, 9.792612e-001, 9.794199e-001,
+9.795787e-001, 9.797374e-001, 9.798962e-001, 9.800535e-001, 9.802057e-001, 9.803580e-001, 9.805102e-001, 9.806625e-001, 9.808148e-001, 9.809670e-001,
+9.811193e-001, 9.812715e-001, 9.814214e-001, 9.815622e-001, 9.817030e-001, 9.818438e-001, 9.819845e-001, 9.821253e-001, 9.822661e-001, 9.824068e-001,
+9.825476e-001, 9.826869e-001, 9.828112e-001, 9.829355e-001, 9.830598e-001, 9.831840e-001, 9.833083e-001, 9.834326e-001, 9.835569e-001, 9.836812e-001,
+9.838054e-001, 9.839123e-001, 9.840167e-001, 9.841210e-001, 9.842254e-001, 9.843298e-001, 9.844341e-001, 9.845385e-001, 9.846428e-001, 9.847472e-001,
+9.848500e-001, 9.849516e-001, 9.850532e-001, 9.851548e-001, 9.852563e-001, 9.853579e-001, 9.854595e-001, 9.855611e-001, 9.856627e-001, 9.857648e-001,
+9.858701e-001, 9.859754e-001, 9.860807e-001, 9.861860e-001, 9.862913e-001, 9.863966e-001, 9.865019e-001, 9.866072e-001, 9.867125e-001, 9.868179e-001,
+9.869233e-001, 9.870288e-001, 9.871343e-001, 9.872397e-001, 9.873452e-001, 9.874507e-001, 9.875562e-001, 9.876616e-001, 9.877671e-001, 9.878692e-001,
+9.879713e-001, 9.880735e-001, 9.881756e-001, 9.882777e-001, 9.883799e-001, 9.884820e-001, 9.885841e-001, 9.886862e-001, 9.887885e-001, 9.888912e-001,
+9.889939e-001, 9.890967e-001, 9.891994e-001, 9.893021e-001, 9.894048e-001, 9.895075e-001, 9.896102e-001, 9.897129e-001, 9.898141e-001, 9.899132e-001,
+9.900123e-001, 9.901114e-001, 9.902105e-001, 9.903096e-001, 9.904087e-001, 9.905078e-001, 9.906069e-001, 9.907060e-001, 9.908011e-001, 9.908922e-001,
+9.909833e-001, 9.910744e-001, 9.911654e-001, 9.912565e-001, 9.913476e-001, 9.914387e-001, 9.915298e-001, 9.916209e-001, 9.917073e-001, 9.917883e-001,
+9.918694e-001, 9.919504e-001, 9.920314e-001, 9.921124e-001, 9.921934e-001, 9.922744e-001, 9.923554e-001, 9.924364e-001, 9.925167e-001, 9.925955e-001,
+9.926742e-001, 9.927530e-001, 9.928318e-001, 9.929105e-001, 9.929893e-001, 9.930681e-001, 9.931468e-001, 9.932256e-001, 9.933045e-001, 9.933882e-001,
+9.934718e-001, 9.935554e-001, 9.936391e-001, 9.937227e-001, 9.938063e-001, 9.938900e-001, 9.939736e-001, 9.940573e-001, 9.941409e-001, 9.942286e-001,
+9.943185e-001, 9.944083e-001, 9.944981e-001, 9.945880e-001, 9.946778e-001, 9.947676e-001, 9.948574e-001, 9.949473e-001, 9.950371e-001, 9.951278e-001,
+9.952227e-001, 9.953177e-001, 9.954126e-001, 9.955075e-001, 9.956024e-001, 9.956974e-001, 9.957923e-001, 9.958872e-001, 9.959821e-001, 9.960770e-001,
+9.961733e-001, 9.962706e-001, 9.963679e-001, 9.964652e-001, 9.965625e-001, 9.966597e-001, 9.967570e-001, 9.968543e-001, 9.969516e-001, 9.970489e-001,
+9.971462e-001, 9.972419e-001, 9.973374e-001, 9.974329e-001, 9.975284e-001, 9.976239e-001, 9.977193e-001, 9.978148e-001, 9.979103e-001, 9.980058e-001,
+9.981013e-001, 9.981966e-001, 9.982849e-001, 9.983732e-001, 9.984615e-001, 9.985498e-001, 9.986381e-001, 9.987264e-001, 9.988147e-001, 9.989030e-001,
+9.989913e-001, 9.990796e-001, 9.991671e-001, 9.992428e-001, 9.993185e-001, 9.993942e-001, 9.994699e-001, 9.995457e-001, 9.996214e-001, 9.996971e-001,
+9.997728e-001, 9.998486e-001, 9.999243e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.231146e-004, 4.596260e-004, 7.107497e-004, 9.748340e-004, 1.254114e-003, 1.551073e-003, 1.867371e-003, 2.202400e-003, 2.557282e-003,
+2.930430e-003, 3.323574e-003, 3.737357e-003, 4.169301e-003, 4.623010e-003, 5.097976e-003, 5.591583e-003, 6.107049e-003, 6.644223e-003, 7.199964e-003,
+7.777037e-003, 8.377237e-003, 8.999362e-003, 9.644462e-003, 1.031513e-002, 1.101317e-002, 1.173869e-002, 1.248933e-002, 1.326243e-002, 1.406228e-002,
+1.488949e-002, 1.573911e-002, 1.662049e-002, 1.753249e-002, 1.847640e-002, 1.944916e-002, 2.045045e-002, 2.148232e-002, 2.254376e-002, 2.363902e-002,
+2.477058e-002, 2.593483e-002, 2.713751e-002, 2.838178e-002, 2.965909e-002, 3.097591e-002, 3.232276e-002, 3.370680e-002, 3.512555e-002, 3.658060e-002,
+3.807113e-002, 3.960836e-002, 4.117841e-002, 4.279080e-002, 4.444808e-002, 4.614565e-002, 4.788097e-002, 4.965249e-002, 5.146548e-002, 5.331782e-002,
+5.520905e-002, 5.713360e-002, 5.909611e-002, 6.109423e-002, 6.313537e-002, 6.521459e-002, 6.732576e-002, 6.947030e-002, 7.164926e-002, 7.386349e-002,
+7.610866e-002, 7.838525e-002, 8.068911e-002, 8.302748e-002, 8.540156e-002, 8.780689e-002, 9.024279e-002, 9.270557e-002, 9.520045e-002, 9.773238e-002,
+1.002931e-001, 1.028838e-001, 1.055003e-001, 1.081381e-001, 1.108010e-001, 1.134868e-001, 1.161941e-001, 1.189276e-001, 1.216920e-001, 1.244781e-001,
+1.272817e-001, 1.301011e-001, 1.329389e-001, 1.358012e-001, 1.386941e-001, 1.416131e-001, 1.445533e-001, 1.475161e-001, 1.505061e-001, 1.535230e-001,
+1.565563e-001, 1.596102e-001, 1.626808e-001, 1.657689e-001, 1.688731e-001, 1.719909e-001, 1.751365e-001, 1.782941e-001, 1.814624e-001, 1.846423e-001,
+1.878450e-001, 1.910510e-001, 1.942614e-001, 1.974804e-001, 2.007077e-001, 2.039379e-001, 2.071726e-001, 2.104313e-001, 2.136991e-001, 2.169768e-001,
+2.202725e-001, 2.235676e-001, 2.268693e-001, 2.301850e-001, 2.334985e-001, 2.368156e-001, 2.401402e-001, 2.434774e-001, 2.468263e-001, 2.501969e-001,
+2.535722e-001, 2.569539e-001, 2.603574e-001, 2.637628e-001, 2.671697e-001, 2.705962e-001, 2.740235e-001, 2.774519e-001, 2.808937e-001, 2.843414e-001,
+2.878028e-001, 2.912661e-001, 2.947318e-001, 2.981860e-001, 3.016364e-001, 3.050856e-001, 3.085319e-001, 3.119722e-001, 3.154139e-001, 3.188567e-001,
+3.222773e-001, 3.256926e-001, 3.290956e-001, 3.324886e-001, 3.358507e-001, 3.392089e-001, 3.425620e-001, 3.459057e-001, 3.492427e-001, 3.525684e-001,
+3.558900e-001, 3.591866e-001, 3.624788e-001, 3.657391e-001, 3.689970e-001, 3.722280e-001, 3.754577e-001, 3.786749e-001, 3.818857e-001, 3.850541e-001,
+3.882221e-001, 3.913877e-001, 3.945508e-001, 3.976990e-001, 4.008451e-001, 4.039751e-001, 4.071030e-001, 4.102007e-001, 4.132985e-001, 4.163656e-001,
+4.194327e-001, 4.224605e-001, 4.254843e-001, 4.284947e-001, 4.315016e-001, 4.344901e-001, 4.374688e-001, 4.404281e-001, 4.433673e-001, 4.462912e-001,
+4.491803e-001, 4.520643e-001, 4.549018e-001, 4.577394e-001, 4.605427e-001, 4.633407e-001, 4.661261e-001, 4.689034e-001, 4.716738e-001, 4.744301e-001,
+4.771855e-001, 4.799031e-001, 4.826207e-001, 4.853240e-001, 4.880209e-001, 4.907048e-001, 4.933629e-001, 4.960211e-001, 4.986291e-001, 5.012347e-001,
+5.038244e-001, 5.064008e-001, 5.089727e-001, 5.115088e-001, 5.140448e-001, 5.165611e-001, 5.190668e-001, 5.215664e-001, 5.240357e-001, 5.265050e-001,
+5.289555e-001, 5.313962e-001, 5.338328e-001, 5.362384e-001, 5.386439e-001, 5.410385e-001, 5.434240e-001, 5.458095e-001, 5.481578e-001, 5.505042e-001,
+5.528418e-001, 5.551611e-001, 5.574804e-001, 5.597793e-001, 5.620683e-001, 5.643572e-001, 5.665962e-001, 5.688347e-001, 5.710634e-001, 5.732670e-001,
+5.754707e-001, 5.776561e-001, 5.798260e-001, 5.819959e-001, 5.841306e-001, 5.862548e-001, 5.883789e-001, 5.904625e-001, 5.925448e-001, 5.946222e-001,
+5.966692e-001, 5.987162e-001, 6.007555e-001, 6.027748e-001, 6.047940e-001, 6.068055e-001, 6.088048e-001, 6.108040e-001, 6.127885e-001, 6.147557e-001,
+6.167229e-001, 6.186692e-001, 6.205952e-001, 6.225212e-001, 6.244305e-001, 6.263243e-001, 6.282182e-001, 6.301015e-001, 6.319743e-001, 6.338471e-001,
+6.356995e-001, 6.375270e-001, 6.393544e-001, 6.411694e-001, 6.429628e-001, 6.447561e-001, 6.465445e-001, 6.483176e-001, 6.500907e-001, 6.518587e-001,
+6.535770e-001, 6.552952e-001, 6.570135e-001, 6.587092e-001, 6.604025e-001, 6.620958e-001, 6.637633e-001, 6.654189e-001, 6.670744e-001, 6.687203e-001,
+6.703534e-001, 6.719865e-001, 6.736163e-001, 6.752254e-001, 6.768346e-001, 6.784438e-001, 6.800181e-001, 6.815843e-001, 6.831505e-001, 6.846909e-001,
+6.861993e-001, 6.877077e-001, 6.892146e-001, 6.906891e-001, 6.921636e-001, 6.936382e-001, 6.950960e-001, 6.965432e-001, 6.979903e-001, 6.994343e-001,
+7.008578e-001, 7.022813e-001, 7.037048e-001, 7.051180e-001, 7.065249e-001, 7.079318e-001, 7.093364e-001, 7.107118e-001, 7.120871e-001, 7.134624e-001,
+7.148199e-001, 7.161585e-001, 7.174972e-001, 7.188358e-001, 7.201492e-001, 7.214585e-001, 7.227678e-001, 7.240737e-001, 7.253654e-001, 7.266570e-001,
+7.279486e-001, 7.292182e-001, 7.304646e-001, 7.317110e-001, 7.329574e-001, 7.341820e-001, 7.353988e-001, 7.366157e-001, 7.378326e-001, 7.390285e-001,
+7.402233e-001, 7.414182e-001, 7.426075e-001, 7.437587e-001, 7.449098e-001, 7.460609e-001, 7.472000e-001, 7.483039e-001, 7.494079e-001, 7.505118e-001,
+7.516050e-001, 7.526779e-001, 7.537507e-001, 7.548235e-001, 7.558842e-001, 7.569259e-001, 7.579676e-001, 7.590093e-001, 7.600433e-001, 7.610656e-001,
+7.620878e-001, 7.631100e-001, 7.641209e-001, 7.651112e-001, 7.661015e-001, 7.670918e-001, 7.680724e-001, 7.690268e-001, 7.699812e-001, 7.709356e-001,
+7.718879e-001, 7.728270e-001, 7.737662e-001, 7.747054e-001, 7.756445e-001, 7.765567e-001, 7.774680e-001, 7.783793e-001, 7.792906e-001, 7.801937e-001,
+7.810940e-001, 7.819943e-001, 7.828946e-001, 7.837845e-001, 7.846637e-001, 7.855428e-001, 7.864219e-001, 7.872972e-001, 7.881550e-001, 7.890127e-001,
+7.898705e-001, 7.907282e-001, 7.915743e-001, 7.924179e-001, 7.932615e-001, 7.941050e-001, 7.949375e-001, 7.957543e-001, 7.965712e-001, 7.973880e-001,
+7.982049e-001, 7.989869e-001, 7.997676e-001, 8.005483e-001, 8.013290e-001, 8.021017e-001, 8.028652e-001, 8.036287e-001, 8.043922e-001, 8.051557e-001,
+8.058985e-001, 8.066394e-001, 8.073803e-001, 8.081211e-001, 8.088607e-001, 8.095976e-001, 8.103344e-001, 8.110712e-001, 8.118081e-001, 8.125373e-001,
+8.132628e-001, 8.139883e-001, 8.147138e-001, 8.154393e-001, 8.161317e-001, 8.168232e-001, 8.175147e-001, 8.182062e-001, 8.188944e-001, 8.195710e-001,
+8.202476e-001, 8.209241e-001, 8.216007e-001, 8.222700e-001, 8.229292e-001, 8.235885e-001, 8.242477e-001, 8.249069e-001, 8.255604e-001, 8.262094e-001,
+8.268585e-001, 8.275076e-001, 8.281567e-001, 8.287856e-001, 8.294042e-001, 8.300228e-001, 8.306415e-001, 8.312601e-001, 8.318728e-001, 8.324831e-001,
+8.330934e-001, 8.337036e-001, 8.343139e-001, 8.349159e-001, 8.355142e-001, 8.361125e-001, 8.367107e-001, 8.373090e-001, 8.378885e-001, 8.384567e-001,
+8.390248e-001, 8.395930e-001, 8.401612e-001, 8.407253e-001, 8.412854e-001, 8.418455e-001, 8.424057e-001, 8.429658e-001, 8.435230e-001, 8.440741e-001,
+8.446252e-001, 8.451763e-001, 8.457275e-001, 8.462774e-001, 8.468161e-001, 8.473547e-001, 8.478933e-001, 8.484320e-001, 8.489706e-001, 8.494959e-001,
+8.500180e-001, 8.505400e-001, 8.510620e-001, 8.515840e-001, 8.521022e-001, 8.526158e-001, 8.531293e-001, 8.536429e-001, 8.541565e-001, 8.546690e-001,
+8.551610e-001, 8.556530e-001, 8.561450e-001, 8.566370e-001, 8.571289e-001, 8.576136e-001, 8.580930e-001, 8.585724e-001, 8.590519e-001, 8.595313e-001,
+8.600099e-001, 8.604763e-001, 8.609428e-001, 8.614092e-001, 8.618756e-001, 8.623420e-001, 8.628141e-001, 8.632925e-001, 8.637708e-001, 8.642491e-001,
+8.647274e-001, 8.652058e-001, 8.656809e-001, 8.661554e-001, 8.666299e-001, 8.671044e-001, 8.675789e-001, 8.680509e-001, 8.685061e-001, 8.689613e-001,
+8.694165e-001, 8.698716e-001, 8.703268e-001, 8.707792e-001, 8.712267e-001, 8.716741e-001, 8.721216e-001, 8.725690e-001, 8.730165e-001, 8.734666e-001,
+8.739192e-001, 8.743718e-001, 8.748244e-001, 8.752769e-001, 8.757295e-001, 8.761757e-001, 8.766183e-001, 8.770609e-001, 8.775034e-001, 8.779460e-001,
+8.783886e-001, 8.788154e-001, 8.792348e-001, 8.796542e-001, 8.800736e-001, 8.804931e-001, 8.809125e-001, 8.813328e-001, 8.817537e-001, 8.821746e-001,
+8.825954e-001, 8.830163e-001, 8.834371e-001, 8.838580e-001, 8.842790e-001, 8.846999e-001, 8.851209e-001, 8.855419e-001, 8.859628e-001, 8.863783e-001,
+8.867863e-001, 8.871943e-001, 8.876023e-001, 8.880103e-001, 8.884182e-001, 8.888233e-001, 8.892169e-001, 8.896105e-001, 8.900041e-001, 8.903976e-001,
+8.907912e-001, 8.911848e-001, 8.915761e-001, 8.919671e-001, 8.923582e-001, 8.927492e-001, 8.931403e-001, 8.935313e-001, 8.939135e-001, 8.942885e-001,
+8.946636e-001, 8.950387e-001, 8.954138e-001, 8.957888e-001, 8.961620e-001, 8.965228e-001, 8.968836e-001, 8.972444e-001, 8.976051e-001, 8.979659e-001,
+8.983267e-001, 8.986871e-001, 8.990471e-001, 8.994072e-001, 8.997673e-001, 9.001273e-001, 9.004874e-001, 9.008464e-001, 9.011930e-001, 9.015396e-001,
+9.018862e-001, 9.022328e-001, 9.025794e-001, 9.029260e-001, 9.032617e-001, 9.035840e-001, 9.039062e-001, 9.042284e-001, 9.045506e-001, 9.048728e-001,
+9.051950e-001, 9.055181e-001, 9.058414e-001, 9.061647e-001, 9.064880e-001, 9.068113e-001, 9.071347e-001, 9.074580e-001, 9.077845e-001, 9.081111e-001,
+9.084377e-001, 9.087643e-001, 9.090909e-001, 9.094176e-001, 9.097433e-001, 9.100612e-001, 9.103792e-001, 9.106972e-001, 9.110151e-001, 9.113331e-001,
+9.116511e-001, 9.119695e-001, 9.122900e-001, 9.126106e-001, 9.129311e-001, 9.132517e-001, 9.135722e-001, 9.138928e-001, 9.142142e-001, 9.145399e-001,
+9.148656e-001, 9.151913e-001, 9.155170e-001, 9.158427e-001, 9.161684e-001, 9.164946e-001, 9.168256e-001, 9.171566e-001, 9.174876e-001, 9.178186e-001,
+9.181496e-001, 9.184805e-001, 9.188115e-001, 9.191363e-001, 9.194607e-001, 9.197851e-001, 9.201094e-001, 9.204338e-001, 9.207582e-001, 9.210826e-001,
+9.214031e-001, 9.217220e-001, 9.220410e-001, 9.223599e-001, 9.226789e-001, 9.229978e-001, 9.233168e-001, 9.236334e-001, 9.239465e-001, 9.242596e-001,
+9.245728e-001, 9.248859e-001, 9.251990e-001, 9.255121e-001, 9.258252e-001, 9.261450e-001, 9.264647e-001, 9.267844e-001, 9.271042e-001, 9.274239e-001,
+9.277436e-001, 9.280634e-001, 9.283817e-001, 9.286988e-001, 9.290159e-001, 9.293331e-001, 9.296502e-001, 9.299673e-001, 9.302844e-001, 9.306015e-001,
+9.309072e-001, 9.312127e-001, 9.315181e-001, 9.318236e-001, 9.321291e-001, 9.324346e-001, 9.327400e-001, 9.330422e-001, 9.333382e-001, 9.336343e-001,
+9.339303e-001, 9.342263e-001, 9.345224e-001, 9.348184e-001, 9.351144e-001, 9.354105e-001, 9.357065e-001, 9.360026e-001, 9.362986e-001, 9.365946e-001,
+9.368907e-001, 9.371867e-001, 9.374828e-001, 9.377809e-001, 9.380795e-001, 9.383780e-001, 9.386766e-001, 9.389751e-001, 9.392737e-001, 9.395722e-001,
+9.398708e-001, 9.401614e-001, 9.404516e-001, 9.407418e-001, 9.410319e-001, 9.413221e-001, 9.416123e-001, 9.419024e-001, 9.421926e-001, 9.424643e-001,
+9.427356e-001, 9.430069e-001, 9.432782e-001, 9.435495e-001, 9.438207e-001, 9.440920e-001, 9.443633e-001, 9.446106e-001, 9.448559e-001, 9.451011e-001,
+9.453463e-001, 9.455916e-001, 9.458368e-001, 9.460821e-001, 9.463273e-001, 9.465690e-001, 9.468097e-001, 9.470503e-001, 9.472910e-001, 9.475316e-001,
+9.477723e-001, 9.480129e-001, 9.482535e-001, 9.484932e-001, 9.487320e-001, 9.489707e-001, 9.492095e-001, 9.494483e-001, 9.496871e-001, 9.499259e-001,
+9.501647e-001, 9.504017e-001, 9.506326e-001, 9.508635e-001, 9.510944e-001, 9.513254e-001, 9.515563e-001, 9.517872e-001, 9.520181e-001, 9.522490e-001,
+9.524822e-001, 9.527159e-001, 9.529496e-001, 9.531833e-001, 9.534170e-001, 9.536506e-001, 9.538843e-001, 9.541180e-001, 9.543502e-001, 9.545792e-001,
+9.548081e-001, 9.550370e-001, 9.552659e-001, 9.554948e-001, 9.557238e-001, 9.559527e-001, 9.561816e-001, 9.564020e-001, 9.566190e-001, 9.568361e-001,
+9.570531e-001, 9.572701e-001, 9.574871e-001, 9.577041e-001, 9.579211e-001, 9.581381e-001, 9.583560e-001, 9.585740e-001, 9.587919e-001, 9.590098e-001,
+9.592277e-001, 9.594457e-001, 9.596636e-001, 9.598815e-001, 9.601004e-001, 9.603220e-001, 9.605437e-001, 9.607654e-001, 9.609871e-001, 9.612088e-001,
+9.614305e-001, 9.616522e-001, 9.618739e-001, 9.620940e-001, 9.623115e-001, 9.625289e-001, 9.627464e-001, 9.629638e-001, 9.631813e-001, 9.633988e-001,
+9.636162e-001, 9.638337e-001, 9.640504e-001, 9.642659e-001, 9.644815e-001, 9.646970e-001, 9.649126e-001, 9.651282e-001, 9.653437e-001, 9.655593e-001,
+9.657748e-001, 9.659874e-001, 9.661937e-001, 9.664000e-001, 9.666063e-001, 9.668126e-001, 9.670189e-001, 9.672252e-001, 9.674314e-001, 9.676377e-001,
+9.678443e-001, 9.680524e-001, 9.682605e-001, 9.684685e-001, 9.686766e-001, 9.688847e-001, 9.690928e-001, 9.693009e-001, 9.695090e-001, 9.697171e-001,
+9.699230e-001, 9.701288e-001, 9.703345e-001, 9.705402e-001, 9.707459e-001, 9.709516e-001, 9.711573e-001, 9.713630e-001, 9.715687e-001, 9.717782e-001,
+9.719914e-001, 9.722046e-001, 9.724178e-001, 9.726309e-001, 9.728441e-001, 9.730573e-001, 9.732705e-001, 9.734837e-001, 9.736968e-001, 9.739102e-001,
+9.741236e-001, 9.743369e-001, 9.745503e-001, 9.747637e-001, 9.749770e-001, 9.751904e-001, 9.754038e-001, 9.756172e-001, 9.758274e-001, 9.760340e-001,
+9.762406e-001, 9.764473e-001, 9.766539e-001, 9.768605e-001, 9.770671e-001, 9.772738e-001, 9.774804e-001, 9.776870e-001, 9.778900e-001, 9.780920e-001,
+9.782939e-001, 9.784959e-001, 9.786979e-001, 9.788999e-001, 9.791018e-001, 9.793038e-001, 9.795058e-001, 9.797077e-001, 9.798991e-001, 9.800904e-001,
+9.802818e-001, 9.804731e-001, 9.806644e-001, 9.808558e-001, 9.810471e-001, 9.812385e-001, 9.814298e-001, 9.816213e-001, 9.818138e-001, 9.820062e-001,
+9.821987e-001, 9.823911e-001, 9.825836e-001, 9.827760e-001, 9.829685e-001, 9.831609e-001, 9.833534e-001, 9.835463e-001, 9.837431e-001, 9.839398e-001,
+9.841365e-001, 9.843333e-001, 9.845300e-001, 9.847267e-001, 9.849235e-001, 9.851202e-001, 9.853169e-001, 9.855136e-001, 9.857080e-001, 9.859024e-001,
+9.860967e-001, 9.862911e-001, 9.864854e-001, 9.866798e-001, 9.868742e-001, 9.870685e-001, 9.872629e-001, 9.874573e-001, 9.876401e-001, 9.878201e-001,
+9.880001e-001, 9.881801e-001, 9.883600e-001, 9.885400e-001, 9.887200e-001, 9.889000e-001, 9.890800e-001, 9.892599e-001, 9.894348e-001, 9.896040e-001,
+9.897733e-001, 9.899425e-001, 9.901117e-001, 9.902810e-001, 9.904502e-001, 9.906194e-001, 9.907887e-001, 9.909579e-001, 9.911267e-001, 9.912837e-001,
+9.914406e-001, 9.915976e-001, 9.917546e-001, 9.919116e-001, 9.920686e-001, 9.922256e-001, 9.923826e-001, 9.925396e-001, 9.926966e-001, 9.928529e-001,
+9.930084e-001, 9.931639e-001, 9.933194e-001, 9.934750e-001, 9.936305e-001, 9.937860e-001, 9.939415e-001, 9.940970e-001, 9.942525e-001, 9.944081e-001,
+9.945562e-001, 9.947029e-001, 9.948495e-001, 9.949961e-001, 9.951427e-001, 9.952894e-001, 9.954360e-001, 9.955826e-001, 9.957293e-001, 9.958759e-001,
+9.960218e-001, 9.961523e-001, 9.962828e-001, 9.964133e-001, 9.965438e-001, 9.966743e-001, 9.968048e-001, 9.969353e-001, 9.970658e-001, 9.971963e-001,
+9.973268e-001, 9.974548e-001, 9.975687e-001, 9.976827e-001, 9.977966e-001, 9.979106e-001, 9.980245e-001, 9.981384e-001, 9.982524e-001, 9.983663e-001,
+9.984803e-001, 9.985942e-001, 9.987086e-001, 9.988260e-001, 9.989434e-001, 9.990608e-001, 9.991782e-001, 9.992956e-001, 9.994130e-001, 9.995304e-001,
+9.996478e-001, 9.997652e-001, 9.998826e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.231146e-004, 4.596260e-004, 7.107497e-004, 9.748340e-004, 1.254114e-003, 1.551073e-003, 1.867371e-003, 2.202400e-003, 2.557282e-003,
+2.930430e-003, 3.323574e-003, 3.737357e-003, 4.169301e-003, 4.623010e-003, 5.097976e-003, 5.591583e-003, 6.107049e-003, 6.644223e-003, 7.199964e-003,
+7.777037e-003, 8.377237e-003, 8.999362e-003, 9.644462e-003, 1.031513e-002, 1.101317e-002, 1.173869e-002, 1.248933e-002, 1.326243e-002, 1.406228e-002,
+1.488949e-002, 1.573911e-002, 1.662049e-002, 1.753249e-002, 1.847640e-002, 1.944916e-002, 2.045045e-002, 2.148232e-002, 2.254376e-002, 2.363902e-002,
+2.477058e-002, 2.593483e-002, 2.713751e-002, 2.838178e-002, 2.965909e-002, 3.097591e-002, 3.232276e-002, 3.370680e-002, 3.512555e-002, 3.658060e-002,
+3.807113e-002, 3.960836e-002, 4.117841e-002, 4.279080e-002, 4.444808e-002, 4.614565e-002, 4.788097e-002, 4.965249e-002, 5.146548e-002, 5.331782e-002,
+5.520905e-002, 5.713360e-002, 5.909611e-002, 6.109423e-002, 6.313537e-002, 6.521459e-002, 6.732576e-002, 6.947030e-002, 7.164926e-002, 7.386349e-002,
+7.610866e-002, 7.838525e-002, 8.068911e-002, 8.302748e-002, 8.540156e-002, 8.780689e-002, 9.024279e-002, 9.270557e-002, 9.520045e-002, 9.773238e-002,
+1.002931e-001, 1.028838e-001, 1.055003e-001, 1.081381e-001, 1.108010e-001, 1.134868e-001, 1.161941e-001, 1.189276e-001, 1.216920e-001, 1.244781e-001,
+1.272817e-001, 1.301011e-001, 1.329389e-001, 1.358012e-001, 1.386941e-001, 1.416131e-001, 1.445533e-001, 1.475161e-001, 1.505061e-001, 1.535230e-001,
+1.565563e-001, 1.596102e-001, 1.626808e-001, 1.657689e-001, 1.688731e-001, 1.719909e-001, 1.751365e-001, 1.782941e-001, 1.814624e-001, 1.846423e-001,
+1.878450e-001, 1.910510e-001, 1.942614e-001, 1.974804e-001, 2.007077e-001, 2.039379e-001, 2.071726e-001, 2.104313e-001, 2.136991e-001, 2.169768e-001,
+2.202725e-001, 2.235676e-001, 2.268693e-001, 2.301850e-001, 2.334985e-001, 2.368156e-001, 2.401402e-001, 2.434774e-001, 2.468263e-001, 2.501969e-001,
+2.535722e-001, 2.569539e-001, 2.603574e-001, 2.637628e-001, 2.671697e-001, 2.705962e-001, 2.740235e-001, 2.774519e-001, 2.808937e-001, 2.843414e-001,
+2.878028e-001, 2.912661e-001, 2.947318e-001, 2.981860e-001, 3.016364e-001, 3.050856e-001, 3.085319e-001, 3.119722e-001, 3.154139e-001, 3.188567e-001,
+3.222773e-001, 3.256926e-001, 3.290956e-001, 3.324886e-001, 3.358507e-001, 3.392089e-001, 3.425620e-001, 3.459057e-001, 3.492427e-001, 3.525684e-001,
+3.558900e-001, 3.591866e-001, 3.624788e-001, 3.657391e-001, 3.689970e-001, 3.722280e-001, 3.754577e-001, 3.786749e-001, 3.818857e-001, 3.850541e-001,
+3.882221e-001, 3.913877e-001, 3.945508e-001, 3.976990e-001, 4.008451e-001, 4.039751e-001, 4.071030e-001, 4.102007e-001, 4.132985e-001, 4.163656e-001,
+4.194327e-001, 4.224605e-001, 4.254843e-001, 4.284947e-001, 4.315016e-001, 4.344901e-001, 4.374688e-001, 4.404281e-001, 4.433673e-001, 4.462912e-001,
+4.491803e-001, 4.520643e-001, 4.549018e-001, 4.577394e-001, 4.605427e-001, 4.633407e-001, 4.661261e-001, 4.689034e-001, 4.716738e-001, 4.744301e-001,
+4.771855e-001, 4.799031e-001, 4.826207e-001, 4.853240e-001, 4.880209e-001, 4.907048e-001, 4.933629e-001, 4.960211e-001, 4.986291e-001, 5.012347e-001,
+5.038244e-001, 5.064008e-001, 5.089727e-001, 5.115088e-001, 5.140448e-001, 5.165611e-001, 5.190668e-001, 5.215664e-001, 5.240357e-001, 5.265050e-001,
+5.289555e-001, 5.313962e-001, 5.338328e-001, 5.362384e-001, 5.386439e-001, 5.410385e-001, 5.434240e-001, 5.458095e-001, 5.481578e-001, 5.505042e-001,
+5.528418e-001, 5.551611e-001, 5.574804e-001, 5.597793e-001, 5.620683e-001, 5.643572e-001, 5.665962e-001, 5.688347e-001, 5.710634e-001, 5.732670e-001,
+5.754707e-001, 5.776561e-001, 5.798260e-001, 5.819959e-001, 5.841306e-001, 5.862548e-001, 5.883789e-001, 5.904625e-001, 5.925448e-001, 5.946222e-001,
+5.966692e-001, 5.987162e-001, 6.007555e-001, 6.027748e-001, 6.047940e-001, 6.068055e-001, 6.088048e-001, 6.108040e-001, 6.127885e-001, 6.147557e-001,
+6.167229e-001, 6.186692e-001, 6.205952e-001, 6.225212e-001, 6.244305e-001, 6.263243e-001, 6.282182e-001, 6.301015e-001, 6.319743e-001, 6.338471e-001,
+6.356995e-001, 6.375270e-001, 6.393544e-001, 6.411694e-001, 6.429628e-001, 6.447561e-001, 6.465445e-001, 6.483176e-001, 6.500907e-001, 6.518587e-001,
+6.535770e-001, 6.552952e-001, 6.570135e-001, 6.587092e-001, 6.604025e-001, 6.620958e-001, 6.637633e-001, 6.654189e-001, 6.670744e-001, 6.687203e-001,
+6.703534e-001, 6.719865e-001, 6.736163e-001, 6.752254e-001, 6.768346e-001, 6.784438e-001, 6.800181e-001, 6.815843e-001, 6.831505e-001, 6.846909e-001,
+6.861993e-001, 6.877077e-001, 6.892146e-001, 6.906891e-001, 6.921636e-001, 6.936382e-001, 6.950960e-001, 6.965432e-001, 6.979903e-001, 6.994343e-001,
+7.008578e-001, 7.022813e-001, 7.037048e-001, 7.051180e-001, 7.065249e-001, 7.079318e-001, 7.093364e-001, 7.107118e-001, 7.120871e-001, 7.134624e-001,
+7.148199e-001, 7.161585e-001, 7.174972e-001, 7.188358e-001, 7.201492e-001, 7.214585e-001, 7.227678e-001, 7.240737e-001, 7.253654e-001, 7.266570e-001,
+7.279486e-001, 7.292182e-001, 7.304646e-001, 7.317110e-001, 7.329574e-001, 7.341820e-001, 7.353988e-001, 7.366157e-001, 7.378326e-001, 7.390285e-001,
+7.402233e-001, 7.414182e-001, 7.426075e-001, 7.437587e-001, 7.449098e-001, 7.460609e-001, 7.472000e-001, 7.483039e-001, 7.494079e-001, 7.505118e-001,
+7.516050e-001, 7.526779e-001, 7.537507e-001, 7.548235e-001, 7.558842e-001, 7.569259e-001, 7.579676e-001, 7.590093e-001, 7.600433e-001, 7.610656e-001,
+7.620878e-001, 7.631100e-001, 7.641209e-001, 7.651112e-001, 7.661015e-001, 7.670918e-001, 7.680724e-001, 7.690268e-001, 7.699812e-001, 7.709356e-001,
+7.718879e-001, 7.728270e-001, 7.737662e-001, 7.747054e-001, 7.756445e-001, 7.765567e-001, 7.774680e-001, 7.783793e-001, 7.792906e-001, 7.801937e-001,
+7.810940e-001, 7.819943e-001, 7.828946e-001, 7.837845e-001, 7.846637e-001, 7.855428e-001, 7.864219e-001, 7.872972e-001, 7.881550e-001, 7.890127e-001,
+7.898705e-001, 7.907282e-001, 7.915743e-001, 7.924179e-001, 7.932615e-001, 7.941050e-001, 7.949375e-001, 7.957543e-001, 7.965712e-001, 7.973880e-001,
+7.982049e-001, 7.989869e-001, 7.997676e-001, 8.005483e-001, 8.013290e-001, 8.021017e-001, 8.028652e-001, 8.036287e-001, 8.043922e-001, 8.051557e-001,
+8.058985e-001, 8.066394e-001, 8.073803e-001, 8.081211e-001, 8.088607e-001, 8.095976e-001, 8.103344e-001, 8.110712e-001, 8.118081e-001, 8.125373e-001,
+8.132628e-001, 8.139883e-001, 8.147138e-001, 8.154393e-001, 8.161317e-001, 8.168232e-001, 8.175147e-001, 8.182062e-001, 8.188944e-001, 8.195710e-001,
+8.202476e-001, 8.209241e-001, 8.216007e-001, 8.222700e-001, 8.229292e-001, 8.235885e-001, 8.242477e-001, 8.249069e-001, 8.255604e-001, 8.262094e-001,
+8.268585e-001, 8.275076e-001, 8.281567e-001, 8.287856e-001, 8.294042e-001, 8.300228e-001, 8.306415e-001, 8.312601e-001, 8.318728e-001, 8.324831e-001,
+8.330934e-001, 8.337036e-001, 8.343139e-001, 8.349159e-001, 8.355142e-001, 8.361125e-001, 8.367107e-001, 8.373090e-001, 8.378885e-001, 8.384567e-001,
+8.390248e-001, 8.395930e-001, 8.401612e-001, 8.407253e-001, 8.412854e-001, 8.418455e-001, 8.424057e-001, 8.429658e-001, 8.435230e-001, 8.440741e-001,
+8.446252e-001, 8.451763e-001, 8.457275e-001, 8.462774e-001, 8.468161e-001, 8.473547e-001, 8.478933e-001, 8.484320e-001, 8.489706e-001, 8.494959e-001,
+8.500180e-001, 8.505400e-001, 8.510620e-001, 8.515840e-001, 8.521022e-001, 8.526158e-001, 8.531293e-001, 8.536429e-001, 8.541565e-001, 8.546690e-001,
+8.551610e-001, 8.556530e-001, 8.561450e-001, 8.566370e-001, 8.571289e-001, 8.576136e-001, 8.580930e-001, 8.585724e-001, 8.590519e-001, 8.595313e-001,
+8.600099e-001, 8.604763e-001, 8.609428e-001, 8.614092e-001, 8.618756e-001, 8.623420e-001, 8.628141e-001, 8.632925e-001, 8.637708e-001, 8.642491e-001,
+8.647274e-001, 8.652058e-001, 8.656809e-001, 8.661554e-001, 8.666299e-001, 8.671044e-001, 8.675789e-001, 8.680509e-001, 8.685061e-001, 8.689613e-001,
+8.694165e-001, 8.698716e-001, 8.703268e-001, 8.707792e-001, 8.712267e-001, 8.716741e-001, 8.721216e-001, 8.725690e-001, 8.730165e-001, 8.734666e-001,
+8.739192e-001, 8.743718e-001, 8.748244e-001, 8.752769e-001, 8.757295e-001, 8.761757e-001, 8.766183e-001, 8.770609e-001, 8.775034e-001, 8.779460e-001,
+8.783886e-001, 8.788154e-001, 8.792348e-001, 8.796542e-001, 8.800736e-001, 8.804931e-001, 8.809125e-001, 8.813328e-001, 8.817537e-001, 8.821746e-001,
+8.825954e-001, 8.830163e-001, 8.834371e-001, 8.838580e-001, 8.842790e-001, 8.846999e-001, 8.851209e-001, 8.855419e-001, 8.859628e-001, 8.863783e-001,
+8.867863e-001, 8.871943e-001, 8.876023e-001, 8.880103e-001, 8.884182e-001, 8.888233e-001, 8.892169e-001, 8.896105e-001, 8.900041e-001, 8.903976e-001,
+8.907912e-001, 8.911848e-001, 8.915761e-001, 8.919671e-001, 8.923582e-001, 8.927492e-001, 8.931403e-001, 8.935313e-001, 8.939135e-001, 8.942885e-001,
+8.946636e-001, 8.950387e-001, 8.954138e-001, 8.957888e-001, 8.961620e-001, 8.965228e-001, 8.968836e-001, 8.972444e-001, 8.976051e-001, 8.979659e-001,
+8.983267e-001, 8.986871e-001, 8.990471e-001, 8.994072e-001, 8.997673e-001, 9.001273e-001, 9.004874e-001, 9.008464e-001, 9.011930e-001, 9.015396e-001,
+9.018862e-001, 9.022328e-001, 9.025794e-001, 9.029260e-001, 9.032617e-001, 9.035840e-001, 9.039062e-001, 9.042284e-001, 9.045506e-001, 9.048728e-001,
+9.051950e-001, 9.055181e-001, 9.058414e-001, 9.061647e-001, 9.064880e-001, 9.068113e-001, 9.071347e-001, 9.074580e-001, 9.077845e-001, 9.081111e-001,
+9.084377e-001, 9.087643e-001, 9.090909e-001, 9.094176e-001, 9.097433e-001, 9.100612e-001, 9.103792e-001, 9.106972e-001, 9.110151e-001, 9.113331e-001,
+9.116511e-001, 9.119695e-001, 9.122900e-001, 9.126106e-001, 9.129311e-001, 9.132517e-001, 9.135722e-001, 9.138928e-001, 9.142142e-001, 9.145399e-001,
+9.148656e-001, 9.151913e-001, 9.155170e-001, 9.158427e-001, 9.161684e-001, 9.164946e-001, 9.168256e-001, 9.171566e-001, 9.174876e-001, 9.178186e-001,
+9.181496e-001, 9.184805e-001, 9.188115e-001, 9.191363e-001, 9.194607e-001, 9.197851e-001, 9.201094e-001, 9.204338e-001, 9.207582e-001, 9.210826e-001,
+9.214031e-001, 9.217220e-001, 9.220410e-001, 9.223599e-001, 9.226789e-001, 9.229978e-001, 9.233168e-001, 9.236334e-001, 9.239465e-001, 9.242596e-001,
+9.245728e-001, 9.248859e-001, 9.251990e-001, 9.255121e-001, 9.258252e-001, 9.261450e-001, 9.264647e-001, 9.267844e-001, 9.271042e-001, 9.274239e-001,
+9.277436e-001, 9.280634e-001, 9.283817e-001, 9.286988e-001, 9.290159e-001, 9.293331e-001, 9.296502e-001, 9.299673e-001, 9.302844e-001, 9.306015e-001,
+9.309072e-001, 9.312127e-001, 9.315181e-001, 9.318236e-001, 9.321291e-001, 9.324346e-001, 9.327400e-001, 9.330422e-001, 9.333382e-001, 9.336343e-001,
+9.339303e-001, 9.342263e-001, 9.345224e-001, 9.348184e-001, 9.351144e-001, 9.354105e-001, 9.357065e-001, 9.360026e-001, 9.362986e-001, 9.365946e-001,
+9.368907e-001, 9.371867e-001, 9.374828e-001, 9.377809e-001, 9.380795e-001, 9.383780e-001, 9.386766e-001, 9.389751e-001, 9.392737e-001, 9.395722e-001,
+9.398708e-001, 9.401614e-001, 9.404516e-001, 9.407418e-001, 9.410319e-001, 9.413221e-001, 9.416123e-001, 9.419024e-001, 9.421926e-001, 9.424643e-001,
+9.427356e-001, 9.430069e-001, 9.432782e-001, 9.435495e-001, 9.438207e-001, 9.440920e-001, 9.443633e-001, 9.446106e-001, 9.448559e-001, 9.451011e-001,
+9.453463e-001, 9.455916e-001, 9.458368e-001, 9.460821e-001, 9.463273e-001, 9.465690e-001, 9.468097e-001, 9.470503e-001, 9.472910e-001, 9.475316e-001,
+9.477723e-001, 9.480129e-001, 9.482535e-001, 9.484932e-001, 9.487320e-001, 9.489707e-001, 9.492095e-001, 9.494483e-001, 9.496871e-001, 9.499259e-001,
+9.501647e-001, 9.504017e-001, 9.506326e-001, 9.508635e-001, 9.510944e-001, 9.513254e-001, 9.515563e-001, 9.517872e-001, 9.520181e-001, 9.522490e-001,
+9.524822e-001, 9.527159e-001, 9.529496e-001, 9.531833e-001, 9.534170e-001, 9.536506e-001, 9.538843e-001, 9.541180e-001, 9.543502e-001, 9.545792e-001,
+9.548081e-001, 9.550370e-001, 9.552659e-001, 9.554948e-001, 9.557238e-001, 9.559527e-001, 9.561816e-001, 9.564020e-001, 9.566190e-001, 9.568361e-001,
+9.570531e-001, 9.572701e-001, 9.574871e-001, 9.577041e-001, 9.579211e-001, 9.581381e-001, 9.583560e-001, 9.585740e-001, 9.587919e-001, 9.590098e-001,
+9.592277e-001, 9.594457e-001, 9.596636e-001, 9.598815e-001, 9.601004e-001, 9.603220e-001, 9.605437e-001, 9.607654e-001, 9.609871e-001, 9.612088e-001,
+9.614305e-001, 9.616522e-001, 9.618739e-001, 9.620940e-001, 9.623115e-001, 9.625289e-001, 9.627464e-001, 9.629638e-001, 9.631813e-001, 9.633988e-001,
+9.636162e-001, 9.638337e-001, 9.640504e-001, 9.642659e-001, 9.644815e-001, 9.646970e-001, 9.649126e-001, 9.651282e-001, 9.653437e-001, 9.655593e-001,
+9.657748e-001, 9.659874e-001, 9.661937e-001, 9.664000e-001, 9.666063e-001, 9.668126e-001, 9.670189e-001, 9.672252e-001, 9.674314e-001, 9.676377e-001,
+9.678443e-001, 9.680524e-001, 9.682605e-001, 9.684685e-001, 9.686766e-001, 9.688847e-001, 9.690928e-001, 9.693009e-001, 9.695090e-001, 9.697171e-001,
+9.699230e-001, 9.701288e-001, 9.703345e-001, 9.705402e-001, 9.707459e-001, 9.709516e-001, 9.711573e-001, 9.713630e-001, 9.715687e-001, 9.717782e-001,
+9.719914e-001, 9.722046e-001, 9.724178e-001, 9.726309e-001, 9.728441e-001, 9.730573e-001, 9.732705e-001, 9.734837e-001, 9.736968e-001, 9.739102e-001,
+9.741236e-001, 9.743369e-001, 9.745503e-001, 9.747637e-001, 9.749770e-001, 9.751904e-001, 9.754038e-001, 9.756172e-001, 9.758274e-001, 9.760340e-001,
+9.762406e-001, 9.764473e-001, 9.766539e-001, 9.768605e-001, 9.770671e-001, 9.772738e-001, 9.774804e-001, 9.776870e-001, 9.778900e-001, 9.780920e-001,
+9.782939e-001, 9.784959e-001, 9.786979e-001, 9.788999e-001, 9.791018e-001, 9.793038e-001, 9.795058e-001, 9.797077e-001, 9.798991e-001, 9.800904e-001,
+9.802818e-001, 9.804731e-001, 9.806644e-001, 9.808558e-001, 9.810471e-001, 9.812385e-001, 9.814298e-001, 9.816213e-001, 9.818138e-001, 9.820062e-001,
+9.821987e-001, 9.823911e-001, 9.825836e-001, 9.827760e-001, 9.829685e-001, 9.831609e-001, 9.833534e-001, 9.835463e-001, 9.837431e-001, 9.839398e-001,
+9.841365e-001, 9.843333e-001, 9.845300e-001, 9.847267e-001, 9.849235e-001, 9.851202e-001, 9.853169e-001, 9.855136e-001, 9.857080e-001, 9.859024e-001,
+9.860967e-001, 9.862911e-001, 9.864854e-001, 9.866798e-001, 9.868742e-001, 9.870685e-001, 9.872629e-001, 9.874573e-001, 9.876401e-001, 9.878201e-001,
+9.880001e-001, 9.881801e-001, 9.883600e-001, 9.885400e-001, 9.887200e-001, 9.889000e-001, 9.890800e-001, 9.892599e-001, 9.894348e-001, 9.896040e-001,
+9.897733e-001, 9.899425e-001, 9.901117e-001, 9.902810e-001, 9.904502e-001, 9.906194e-001, 9.907887e-001, 9.909579e-001, 9.911267e-001, 9.912837e-001,
+9.914406e-001, 9.915976e-001, 9.917546e-001, 9.919116e-001, 9.920686e-001, 9.922256e-001, 9.923826e-001, 9.925396e-001, 9.926966e-001, 9.928529e-001,
+9.930084e-001, 9.931639e-001, 9.933194e-001, 9.934750e-001, 9.936305e-001, 9.937860e-001, 9.939415e-001, 9.940970e-001, 9.942525e-001, 9.944081e-001,
+9.945562e-001, 9.947029e-001, 9.948495e-001, 9.949961e-001, 9.951427e-001, 9.952894e-001, 9.954360e-001, 9.955826e-001, 9.957293e-001, 9.958759e-001,
+9.960218e-001, 9.961523e-001, 9.962828e-001, 9.964133e-001, 9.965438e-001, 9.966743e-001, 9.968048e-001, 9.969353e-001, 9.970658e-001, 9.971963e-001,
+9.973268e-001, 9.974548e-001, 9.975687e-001, 9.976827e-001, 9.977966e-001, 9.979106e-001, 9.980245e-001, 9.981384e-001, 9.982524e-001, 9.983663e-001,
+9.984803e-001, 9.985942e-001, 9.987086e-001, 9.988260e-001, 9.989434e-001, 9.990608e-001, 9.991782e-001, 9.992956e-001, 9.994130e-001, 9.995304e-001,
+9.996478e-001, 9.997652e-001, 9.998826e-001, 1.000000e+000)),
+("Kodak", "Ektachrome 100", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.029108e-004, 8.352380e-004, 1.288466e-003, 1.766164e-003, 2.272768e-003, 2.801640e-003, 3.360221e-003, 3.947370e-003, 4.562417e-003,
+5.206450e-003, 5.891345e-003, 6.610617e-003, 7.370369e-003, 8.164684e-003, 9.004652e-003, 9.879711e-003, 1.080155e-002, 1.177659e-002, 1.280894e-002,
+1.389625e-002, 1.503669e-002, 1.623671e-002, 1.749482e-002, 1.881182e-002, 2.018810e-002, 2.162760e-002, 2.313462e-002, 2.471294e-002, 2.636952e-002,
+2.809602e-002, 2.989763e-002, 3.177821e-002, 3.375124e-002, 3.580262e-002, 3.793126e-002, 4.014993e-002, 4.245322e-002, 4.484404e-002, 4.732146e-002,
+4.988194e-002, 5.254236e-002, 5.530065e-002, 5.814301e-002, 6.106037e-002, 6.405915e-002, 6.714269e-002, 7.030968e-002, 7.356535e-002, 7.691818e-002,
+8.035922e-002, 8.389699e-002, 8.752231e-002, 9.123067e-002, 9.503328e-002, 9.892075e-002, 1.029007e-001, 1.069691e-001, 1.111252e-001, 1.153606e-001,
+1.196606e-001, 1.240457e-001, 1.285090e-001, 1.330395e-001, 1.376579e-001, 1.423474e-001, 1.471081e-001, 1.519422e-001, 1.568460e-001, 1.618087e-001,
+1.668351e-001, 1.719326e-001, 1.770923e-001, 1.823212e-001, 1.875974e-001, 1.929260e-001, 1.983052e-001, 2.037338e-001, 2.092059e-001, 2.147054e-001,
+2.202476e-001, 2.258259e-001, 2.314377e-001, 2.370905e-001, 2.427741e-001, 2.484735e-001, 2.541978e-001, 2.599339e-001, 2.656922e-001, 2.714639e-001,
+2.772484e-001, 2.830585e-001, 2.888925e-001, 2.947472e-001, 3.006065e-001, 3.064776e-001, 3.123730e-001, 3.182819e-001, 3.241821e-001, 3.300934e-001,
+3.360261e-001, 3.419635e-001, 3.478933e-001, 3.538097e-001, 3.597146e-001, 3.656163e-001, 3.715221e-001, 3.774075e-001, 3.832853e-001, 3.891583e-001,
+3.950240e-001, 4.008567e-001, 4.066801e-001, 4.124873e-001, 4.182812e-001, 4.240791e-001, 4.298572e-001, 4.356110e-001, 4.413395e-001, 4.470395e-001,
+4.527026e-001, 4.583335e-001, 4.639327e-001, 4.695221e-001, 4.750847e-001, 4.806161e-001, 4.860873e-001, 4.915177e-001, 4.969187e-001, 5.022816e-001,
+5.076226e-001, 5.129232e-001, 5.181547e-001, 5.233272e-001, 5.284634e-001, 5.335465e-001, 5.385752e-001, 5.435781e-001, 5.485448e-001, 5.534678e-001,
+5.583646e-001, 5.632167e-001, 5.680477e-001, 5.728545e-001, 5.775995e-001, 5.823163e-001, 5.869674e-001, 5.915769e-001, 5.961519e-001, 6.006463e-001,
+6.051229e-001, 6.095721e-001, 6.139862e-001, 6.183604e-001, 6.226824e-001, 6.269859e-001, 6.312271e-001, 6.354542e-001, 6.396341e-001, 6.438084e-001,
+6.479752e-001, 6.520851e-001, 6.561610e-001, 6.601615e-001, 6.641432e-001, 6.680348e-001, 6.719155e-001, 6.757278e-001, 6.795323e-001, 6.833059e-001,
+6.870679e-001, 6.908020e-001, 6.945023e-001, 6.981445e-001, 7.017527e-001, 7.053137e-001, 7.088435e-001, 7.123348e-001, 7.157995e-001, 7.192327e-001,
+7.226405e-001, 7.260167e-001, 7.293487e-001, 7.326174e-001, 7.358595e-001, 7.390533e-001, 7.422223e-001, 7.453267e-001, 7.484183e-001, 7.514507e-001,
+7.544791e-001, 7.574347e-001, 7.603903e-001, 7.632429e-001, 7.660847e-001, 7.688931e-001, 7.716894e-001, 7.744498e-001, 7.771798e-001, 7.798776e-001,
+7.825079e-001, 7.851305e-001, 7.876676e-001, 7.902047e-001, 7.926717e-001, 7.951231e-001, 7.975525e-001, 7.999621e-001, 8.023658e-001, 8.047470e-001,
+8.071283e-001, 8.094397e-001, 8.117408e-001, 8.139896e-001, 8.161870e-001, 8.183761e-001, 8.205000e-001, 8.226239e-001, 8.247258e-001, 8.268182e-001,
+8.289020e-001, 8.309609e-001, 8.330197e-001, 8.350235e-001, 8.370119e-001, 8.389792e-001, 8.408939e-001, 8.428086e-001, 8.446682e-001, 8.465105e-001,
+8.483420e-001, 8.501333e-001, 8.519245e-001, 8.536860e-001, 8.554302e-001, 8.571731e-001, 8.588686e-001, 8.605640e-001, 8.622372e-001, 8.638756e-001,
+8.655140e-001, 8.671009e-001, 8.686685e-001, 8.702338e-001, 8.717328e-001, 8.732319e-001, 8.747141e-001, 8.761592e-001, 8.776043e-001, 8.790065e-001,
+8.803751e-001, 8.817436e-001, 8.830840e-001, 8.844164e-001, 8.857487e-001, 8.870560e-001, 8.883624e-001, 8.896636e-001, 8.909290e-001, 8.921945e-001,
+8.934394e-001, 8.946237e-001, 8.958080e-001, 8.969696e-001, 8.980889e-001, 8.992082e-001, 9.003195e-001, 9.014196e-001, 9.025197e-001, 9.035979e-001,
+9.046491e-001, 9.057002e-001, 9.067236e-001, 9.077128e-001, 9.087020e-001, 9.096746e-001, 9.106239e-001, 9.115732e-001, 9.124993e-001, 9.133828e-001,
+9.142662e-001, 9.151423e-001, 9.159967e-001, 9.168511e-001, 9.176997e-001, 9.185073e-001, 9.193148e-001, 9.201223e-001, 9.209262e-001, 9.217298e-001,
+9.225334e-001, 9.233225e-001, 9.241070e-001, 9.248915e-001, 9.256622e-001, 9.264205e-001, 9.271788e-001, 9.279241e-001, 9.286309e-001, 9.293377e-001,
+9.300445e-001, 9.307246e-001, 9.314033e-001, 9.320819e-001, 9.327320e-001, 9.333637e-001, 9.339953e-001, 9.346169e-001, 9.352050e-001, 9.357931e-001,
+9.363812e-001, 9.369479e-001, 9.375098e-001, 9.380718e-001, 9.386350e-001, 9.392004e-001, 9.397658e-001, 9.403312e-001, 9.408558e-001, 9.413746e-001,
+9.418935e-001, 9.423981e-001, 9.428764e-001, 9.433547e-001, 9.438331e-001, 9.443081e-001, 9.447824e-001, 9.452566e-001, 9.457270e-001, 9.461809e-001,
+9.466348e-001, 9.470886e-001, 9.475203e-001, 9.479332e-001, 9.483462e-001, 9.487592e-001, 9.491466e-001, 9.495299e-001, 9.499133e-001, 9.502914e-001,
+9.506376e-001, 9.509837e-001, 9.513299e-001, 9.516645e-001, 9.519802e-001, 9.522959e-001, 9.526115e-001, 9.529042e-001, 9.531800e-001, 9.534558e-001,
+9.537315e-001, 9.539870e-001, 9.542350e-001, 9.544830e-001, 9.547310e-001, 9.549532e-001, 9.551707e-001, 9.553882e-001, 9.556057e-001, 9.558088e-001,
+9.560106e-001, 9.562124e-001, 9.564142e-001, 9.566017e-001, 9.567885e-001, 9.569753e-001, 9.571621e-001, 9.573430e-001, 9.575236e-001, 9.577042e-001,
+9.578847e-001, 9.580754e-001, 9.582675e-001, 9.584596e-001, 9.586517e-001, 9.588462e-001, 9.590413e-001, 9.592364e-001, 9.594315e-001, 9.596217e-001,
+9.598089e-001, 9.599962e-001, 9.601835e-001, 9.603782e-001, 9.605821e-001, 9.607860e-001, 9.609899e-001, 9.611927e-001, 9.613917e-001, 9.615907e-001,
+9.617896e-001, 9.619886e-001, 9.621634e-001, 9.623364e-001, 9.625094e-001, 9.626824e-001, 9.628574e-001, 9.630338e-001, 9.632101e-001, 9.633865e-001,
+9.635632e-001, 9.637411e-001, 9.639191e-001, 9.640970e-001, 9.642749e-001, 9.644509e-001, 9.646264e-001, 9.648019e-001, 9.649774e-001, 9.651509e-001,
+9.653204e-001, 9.654898e-001, 9.656593e-001, 9.658287e-001, 9.659902e-001, 9.661499e-001, 9.663096e-001, 9.664692e-001, 9.666254e-001, 9.667712e-001,
+9.669169e-001, 9.670627e-001, 9.672084e-001, 9.673423e-001, 9.674693e-001, 9.675963e-001, 9.677233e-001, 9.678503e-001, 9.679562e-001, 9.680612e-001,
+9.681662e-001, 9.682713e-001, 9.683721e-001, 9.684601e-001, 9.685481e-001, 9.686361e-001, 9.687242e-001, 9.687963e-001, 9.688510e-001, 9.689058e-001,
+9.689605e-001, 9.690153e-001, 9.690718e-001, 9.691294e-001, 9.691869e-001, 9.692444e-001, 9.693020e-001, 9.693596e-001, 9.694173e-001, 9.694750e-001,
+9.695327e-001, 9.695904e-001, 9.696562e-001, 9.697234e-001, 9.697906e-001, 9.698578e-001, 9.699250e-001, 9.700003e-001, 9.700767e-001, 9.701530e-001,
+9.702294e-001, 9.703058e-001, 9.703886e-001, 9.704726e-001, 9.705566e-001, 9.706405e-001, 9.707245e-001, 9.708134e-001, 9.709037e-001, 9.709941e-001,
+9.710845e-001, 9.711749e-001, 9.712683e-001, 9.713637e-001, 9.714591e-001, 9.715544e-001, 9.716498e-001, 9.717406e-001, 9.718249e-001, 9.719093e-001,
+9.719937e-001, 9.720781e-001, 9.721640e-001, 9.722575e-001, 9.723510e-001, 9.724446e-001, 9.725381e-001, 9.726317e-001, 9.727250e-001, 9.728183e-001,
+9.729116e-001, 9.730049e-001, 9.730982e-001, 9.731950e-001, 9.732956e-001, 9.733961e-001, 9.734967e-001, 9.735972e-001, 9.736980e-001, 9.738026e-001,
+9.739071e-001, 9.740117e-001, 9.741162e-001, 9.742208e-001, 9.743257e-001, 9.744309e-001, 9.745361e-001, 9.746413e-001, 9.747465e-001, 9.748516e-001,
+9.749541e-001, 9.750565e-001, 9.751589e-001, 9.752614e-001, 9.753638e-001, 9.754638e-001, 9.755604e-001, 9.756569e-001, 9.757534e-001, 9.758500e-001,
+9.759465e-001, 9.760365e-001, 9.761243e-001, 9.762120e-001, 9.762998e-001, 9.763875e-001, 9.764753e-001, 9.765615e-001, 9.766476e-001, 9.767338e-001,
+9.768200e-001, 9.769062e-001, 9.769896e-001, 9.770637e-001, 9.771377e-001, 9.772117e-001, 9.772858e-001, 9.773598e-001, 9.774324e-001, 9.775023e-001,
+9.775723e-001, 9.776423e-001, 9.777123e-001, 9.777823e-001, 9.778507e-001, 9.779173e-001, 9.779839e-001, 9.780505e-001, 9.781171e-001, 9.781837e-001,
+9.782492e-001, 9.783134e-001, 9.783776e-001, 9.784418e-001, 9.785060e-001, 9.785702e-001, 9.786368e-001, 9.787065e-001, 9.787763e-001, 9.788460e-001,
+9.789157e-001, 9.789854e-001, 9.790521e-001, 9.791121e-001, 9.791721e-001, 9.792321e-001, 9.792921e-001, 9.793521e-001, 9.794105e-001, 9.794590e-001,
+9.795076e-001, 9.795562e-001, 9.796048e-001, 9.796533e-001, 9.797019e-001, 9.797382e-001, 9.797730e-001, 9.798078e-001, 9.798427e-001, 9.798775e-001,
+9.799123e-001, 9.799376e-001, 9.799561e-001, 9.799745e-001, 9.799930e-001, 9.800114e-001, 9.800299e-001, 9.800478e-001, 9.800635e-001, 9.800792e-001,
+9.800949e-001, 9.801106e-001, 9.801263e-001, 9.801420e-001, 9.801494e-001, 9.801541e-001, 9.801587e-001, 9.801634e-001, 9.801681e-001, 9.801728e-001,
+9.801768e-001, 9.801786e-001, 9.801804e-001, 9.801822e-001, 9.801840e-001, 9.801859e-001, 9.801877e-001, 9.801887e-001, 9.801893e-001, 9.801899e-001,
+9.801905e-001, 9.801911e-001, 9.801917e-001, 9.801923e-001, 9.801944e-001, 9.801965e-001, 9.801987e-001, 9.802008e-001, 9.802030e-001, 9.802051e-001,
+9.802073e-001, 9.802094e-001, 9.802116e-001, 9.802137e-001, 9.802159e-001, 9.802180e-001, 9.802201e-001, 9.802223e-001, 9.802244e-001, 9.802266e-001,
+9.802287e-001, 9.802309e-001, 9.802330e-001, 9.802352e-001, 9.802373e-001, 9.802395e-001, 9.802416e-001, 9.802438e-001, 9.802459e-001, 9.802480e-001,
+9.802502e-001, 9.802523e-001, 9.802545e-001, 9.802566e-001, 9.802588e-001, 9.802609e-001, 9.802631e-001, 9.802652e-001, 9.802674e-001, 9.802695e-001,
+9.802717e-001, 9.802738e-001, 9.802759e-001, 9.802781e-001, 9.802802e-001, 9.802928e-001, 9.803175e-001, 9.803423e-001, 9.803670e-001, 9.803917e-001,
+9.804164e-001, 9.804412e-001, 9.804722e-001, 9.805197e-001, 9.805672e-001, 9.806148e-001, 9.806623e-001, 9.807098e-001, 9.807573e-001, 9.808051e-001,
+9.808718e-001, 9.809384e-001, 9.810051e-001, 9.810717e-001, 9.811384e-001, 9.812050e-001, 9.812717e-001, 9.813528e-001, 9.814409e-001, 9.815291e-001,
+9.816172e-001, 9.817053e-001, 9.817934e-001, 9.818816e-001, 9.819724e-001, 9.820711e-001, 9.821699e-001, 9.822686e-001, 9.823674e-001, 9.824661e-001,
+9.825648e-001, 9.826636e-001, 9.827668e-001, 9.828714e-001, 9.829760e-001, 9.830806e-001, 9.831853e-001, 9.832899e-001, 9.833945e-001, 9.834997e-001,
+9.836073e-001, 9.837150e-001, 9.838227e-001, 9.839304e-001, 9.840380e-001, 9.841457e-001, 9.842534e-001, 9.843615e-001, 9.844700e-001, 9.845785e-001,
+9.846870e-001, 9.847955e-001, 9.849040e-001, 9.850124e-001, 9.851209e-001, 9.852286e-001, 9.853361e-001, 9.854435e-001, 9.855509e-001, 9.856583e-001,
+9.857658e-001, 9.858732e-001, 9.859806e-001, 9.860853e-001, 9.861898e-001, 9.862944e-001, 9.863989e-001, 9.865034e-001, 9.866079e-001, 9.867124e-001,
+9.868169e-001, 9.869164e-001, 9.870160e-001, 9.871155e-001, 9.872151e-001, 9.873146e-001, 9.874142e-001, 9.875137e-001, 9.876132e-001, 9.877053e-001,
+9.877974e-001, 9.878895e-001, 9.879816e-001, 9.880737e-001, 9.881658e-001, 9.882579e-001, 9.883500e-001, 9.884337e-001, 9.885166e-001, 9.885995e-001,
+9.886824e-001, 9.887653e-001, 9.888483e-001, 9.889312e-001, 9.890141e-001, 9.890915e-001, 9.891669e-001, 9.892423e-001, 9.893177e-001, 9.893931e-001,
+9.894685e-001, 9.895439e-001, 9.896193e-001, 9.896823e-001, 9.897315e-001, 9.897806e-001, 9.898297e-001, 9.898789e-001, 9.899280e-001, 9.899771e-001,
+9.900263e-001, 9.900729e-001, 9.901001e-001, 9.901274e-001, 9.901547e-001, 9.901819e-001, 9.902092e-001, 9.902365e-001, 9.902637e-001, 9.902910e-001,
+9.903111e-001, 9.903278e-001, 9.903444e-001, 9.903610e-001, 9.903776e-001, 9.903943e-001, 9.904109e-001, 9.904275e-001, 9.904430e-001, 9.904513e-001,
+9.904596e-001, 9.904679e-001, 9.904762e-001, 9.904845e-001, 9.904927e-001, 9.905010e-001, 9.905093e-001, 9.905135e-001, 9.905136e-001, 9.905137e-001,
+9.905138e-001, 9.905139e-001, 9.905140e-001, 9.905141e-001, 9.905142e-001, 9.905142e-001, 9.905145e-001, 9.905148e-001, 9.905152e-001, 9.905155e-001,
+9.905158e-001, 9.905161e-001, 9.905165e-001, 9.905168e-001, 9.905171e-001, 9.905174e-001, 9.905177e-001, 9.905181e-001, 9.905184e-001, 9.905187e-001,
+9.905190e-001, 9.905194e-001, 9.905197e-001, 9.905200e-001, 9.905203e-001, 9.905206e-001, 9.905210e-001, 9.905213e-001, 9.905216e-001, 9.905219e-001,
+9.905223e-001, 9.905226e-001, 9.905229e-001, 9.905232e-001, 9.905235e-001, 9.905239e-001, 9.905242e-001, 9.905245e-001, 9.905248e-001, 9.905252e-001,
+9.905255e-001, 9.905258e-001, 9.905261e-001, 9.905265e-001, 9.905268e-001, 9.905271e-001, 9.905274e-001, 9.905277e-001, 9.905281e-001, 9.905284e-001,
+9.905287e-001, 9.905290e-001, 9.905294e-001, 9.905297e-001, 9.905300e-001, 9.905303e-001, 9.905306e-001, 9.905310e-001, 9.905313e-001, 9.905316e-001,
+9.905319e-001, 9.905323e-001, 9.905326e-001, 9.905329e-001, 9.905332e-001, 9.905335e-001, 9.905339e-001, 9.905342e-001, 9.905345e-001, 9.905348e-001,
+9.905352e-001, 9.905355e-001, 9.905358e-001, 9.905361e-001, 9.905364e-001, 9.905368e-001, 9.905371e-001, 9.905374e-001, 9.905377e-001, 9.905451e-001,
+9.905598e-001, 9.905745e-001, 9.905891e-001, 9.906038e-001, 9.906185e-001, 9.906331e-001, 9.906478e-001, 9.906624e-001, 9.906771e-001, 9.906994e-001,
+9.907227e-001, 9.907460e-001, 9.907693e-001, 9.907926e-001, 9.908159e-001, 9.908392e-001, 9.908625e-001, 9.908858e-001, 9.909120e-001, 9.909530e-001,
+9.909940e-001, 9.910349e-001, 9.910759e-001, 9.911169e-001, 9.911578e-001, 9.911988e-001, 9.912398e-001, 9.912807e-001, 9.913269e-001, 9.913832e-001,
+9.914394e-001, 9.914957e-001, 9.915519e-001, 9.916082e-001, 9.916644e-001, 9.917207e-001, 9.917770e-001, 9.918332e-001, 9.918966e-001, 9.919702e-001,
+9.920438e-001, 9.921175e-001, 9.921911e-001, 9.922647e-001, 9.923383e-001, 9.924119e-001, 9.924855e-001, 9.925591e-001, 9.926333e-001, 9.927082e-001,
+9.927832e-001, 9.928581e-001, 9.929331e-001, 9.930080e-001, 9.930830e-001, 9.931580e-001, 9.932329e-001, 9.933079e-001, 9.933836e-001, 9.934618e-001,
+9.935400e-001, 9.936182e-001, 9.936963e-001, 9.937745e-001, 9.938527e-001, 9.939309e-001, 9.940091e-001, 9.940873e-001, 9.941655e-001, 9.942459e-001,
+9.943264e-001, 9.944069e-001, 9.944873e-001, 9.945678e-001, 9.946483e-001, 9.947287e-001, 9.948092e-001, 9.948897e-001, 9.949702e-001, 9.950510e-001,
+9.951321e-001, 9.952132e-001, 9.952943e-001, 9.953754e-001, 9.954564e-001, 9.955375e-001, 9.956186e-001, 9.956997e-001, 9.957808e-001, 9.958618e-001,
+9.959421e-001, 9.960223e-001, 9.961026e-001, 9.961829e-001, 9.962632e-001, 9.963435e-001, 9.964238e-001, 9.965040e-001, 9.965843e-001, 9.966646e-001,
+9.967440e-001, 9.968225e-001, 9.969011e-001, 9.969796e-001, 9.970582e-001, 9.971367e-001, 9.972153e-001, 9.972938e-001, 9.973724e-001, 9.974510e-001,
+9.975295e-001, 9.976075e-001, 9.976853e-001, 9.977632e-001, 9.978411e-001, 9.979189e-001, 9.979968e-001, 9.980746e-001, 9.981525e-001, 9.982304e-001,
+9.983082e-001, 9.983861e-001, 9.984629e-001, 9.985397e-001, 9.986165e-001, 9.986933e-001, 9.987701e-001, 9.988469e-001, 9.989237e-001, 9.990005e-001,
+9.990773e-001, 9.991542e-001, 9.992305e-001, 9.993005e-001, 9.993704e-001, 9.994404e-001, 9.995103e-001, 9.995803e-001, 9.996502e-001, 9.997202e-001,
+9.997901e-001, 9.998601e-001, 9.999300e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.821621e-004, 5.855577e-004, 9.102127e-004, 1.260808e-003, 1.634445e-003, 2.027964e-003, 2.446907e-003, 2.894080e-003, 3.370999e-003,
+3.875586e-003, 4.409891e-003, 4.973836e-003, 5.571710e-003, 6.207676e-003, 6.875459e-003, 7.575629e-003, 8.313639e-003, 9.089690e-003, 9.905136e-003,
+1.076234e-002, 1.166269e-002, 1.260686e-002, 1.359494e-002, 1.462934e-002, 1.570778e-002, 1.682809e-002, 1.799870e-002, 1.922092e-002, 2.049823e-002,
+2.182725e-002, 2.320126e-002, 2.462556e-002, 2.609622e-002, 2.761088e-002, 2.918252e-002, 3.080937e-002, 3.249519e-002, 3.424490e-002, 3.606108e-002,
+3.793415e-002, 3.986014e-002, 4.184999e-002, 4.389297e-002, 4.599162e-002, 4.815358e-002, 5.037382e-002, 5.263820e-002, 5.495714e-002, 5.732862e-002,
+5.976772e-002, 6.227120e-002, 6.482755e-002, 6.743862e-002, 7.011598e-002, 7.284332e-002, 7.563100e-002, 7.847488e-002, 8.137589e-002, 8.433341e-002,
+8.734075e-002, 9.039890e-002, 9.349795e-002, 9.664123e-002, 9.983825e-002, 1.030810e-001, 1.063693e-001, 1.097079e-001, 1.131009e-001, 1.165459e-001,
+1.200487e-001, 1.235952e-001, 1.271921e-001, 1.308319e-001, 1.345201e-001, 1.382502e-001, 1.420248e-001, 1.458451e-001, 1.496911e-001, 1.535611e-001,
+1.574510e-001, 1.613723e-001, 1.653227e-001, 1.692909e-001, 1.732849e-001, 1.773027e-001, 1.813421e-001, 1.854172e-001, 1.895330e-001, 1.936807e-001,
+1.978672e-001, 2.020946e-001, 2.063394e-001, 2.105994e-001, 2.148775e-001, 2.191728e-001, 2.234859e-001, 2.278206e-001, 2.321731e-001, 2.365338e-001,
+2.409182e-001, 2.453252e-001, 2.497423e-001, 2.541580e-001, 2.585824e-001, 2.630196e-001, 2.674664e-001, 2.719157e-001, 2.763611e-001, 2.808066e-001,
+2.852618e-001, 2.897278e-001, 2.942065e-001, 2.987080e-001, 3.031934e-001, 3.076609e-001, 3.121108e-001, 3.165585e-001, 3.209870e-001, 3.254048e-001,
+3.298168e-001, 3.342175e-001, 3.386010e-001, 3.429653e-001, 3.473366e-001, 3.517041e-001, 3.560671e-001, 3.604130e-001, 3.647586e-001, 3.691031e-001,
+3.734342e-001, 3.777643e-001, 3.820936e-001, 3.864078e-001, 3.907110e-001, 3.950001e-001, 3.992711e-001, 4.035327e-001, 4.077767e-001, 4.120056e-001,
+4.162251e-001, 4.203993e-001, 4.245612e-001, 4.287038e-001, 4.328233e-001, 4.369328e-001, 4.410141e-001, 4.450847e-001, 4.491346e-001, 4.531684e-001,
+4.571923e-001, 4.611826e-001, 4.651635e-001, 4.691112e-001, 4.730412e-001, 4.769391e-001, 4.808133e-001, 4.846690e-001, 4.885058e-001, 4.923364e-001,
+4.961438e-001, 4.999469e-001, 5.037172e-001, 5.074794e-001, 5.112071e-001, 5.149219e-001, 5.186061e-001, 5.222735e-001, 5.259138e-001, 5.295231e-001,
+5.330942e-001, 5.366339e-001, 5.401414e-001, 5.436181e-001, 5.470660e-001, 5.504944e-001, 5.539048e-001, 5.572901e-001, 5.606504e-001, 5.639902e-001,
+5.673059e-001, 5.705997e-001, 5.738596e-001, 5.771085e-001, 5.803326e-001, 5.835513e-001, 5.867486e-001, 5.899421e-001, 5.930835e-001, 5.962249e-001,
+5.993114e-001, 6.023926e-001, 6.054285e-001, 6.084480e-001, 6.114342e-001, 6.143911e-001, 6.173363e-001, 6.202555e-001, 6.231728e-001, 6.260603e-001,
+6.289478e-001, 6.318118e-001, 6.346692e-001, 6.375093e-001, 6.403308e-001, 6.431399e-001, 6.458843e-001, 6.486287e-001, 6.513150e-001, 6.539879e-001,
+6.566321e-001, 6.592396e-001, 6.618457e-001, 6.644177e-001, 6.669897e-001, 6.695259e-001, 6.720393e-001, 6.745491e-001, 6.770399e-001, 6.795308e-001,
+6.819990e-001, 6.844567e-001, 6.869028e-001, 6.892951e-001, 6.916874e-001, 6.940458e-001, 6.963855e-001, 6.987230e-001, 7.010375e-001, 7.033519e-001,
+7.056419e-001, 7.079067e-001, 7.101716e-001, 7.123854e-001, 7.145921e-001, 7.167863e-001, 7.189391e-001, 7.210920e-001, 7.232129e-001, 7.253087e-001,
+7.274044e-001, 7.294500e-001, 7.314873e-001, 7.335180e-001, 7.355037e-001, 7.374893e-001, 7.394585e-001, 7.413990e-001, 7.433394e-001, 7.452736e-001,
+7.472031e-001, 7.491326e-001, 7.510257e-001, 7.529068e-001, 7.547880e-001, 7.566237e-001, 7.584544e-001, 7.602845e-001, 7.620762e-001, 7.638679e-001,
+7.656568e-001, 7.674205e-001, 7.691842e-001, 7.709386e-001, 7.726434e-001, 7.743481e-001, 7.760473e-001, 7.777206e-001, 7.793939e-001, 7.810617e-001,
+7.827024e-001, 7.843430e-001, 7.859767e-001, 7.875623e-001, 7.891480e-001, 7.907313e-001, 7.922712e-001, 7.938110e-001, 7.953509e-001, 7.968598e-001,
+7.983667e-001, 7.998737e-001, 8.013571e-001, 8.028344e-001, 8.043118e-001, 8.057657e-001, 8.072052e-001, 8.086446e-001, 8.100745e-001, 8.114904e-001,
+8.129063e-001, 8.143163e-001, 8.156955e-001, 8.170747e-001, 8.184539e-001, 8.198124e-001, 8.211680e-001, 8.225237e-001, 8.238555e-001, 8.251689e-001,
+8.264823e-001, 8.277850e-001, 8.290479e-001, 8.303108e-001, 8.315737e-001, 8.327975e-001, 8.340129e-001, 8.352283e-001, 8.364299e-001, 8.376105e-001,
+8.387910e-001, 8.399716e-001, 8.411087e-001, 8.422428e-001, 8.433769e-001, 8.445005e-001, 8.456104e-001, 8.467203e-001, 8.478302e-001, 8.489074e-001,
+8.499806e-001, 8.510539e-001, 8.521230e-001, 8.531831e-001, 8.542432e-001, 8.553033e-001, 8.563415e-001, 8.573703e-001, 8.583990e-001, 8.594260e-001,
+8.604150e-001, 8.614040e-001, 8.623931e-001, 8.633654e-001, 8.643069e-001, 8.652484e-001, 8.661899e-001, 8.671161e-001, 8.680330e-001, 8.689498e-001,
+8.698666e-001, 8.707539e-001, 8.716355e-001, 8.725172e-001, 8.733979e-001, 8.742435e-001, 8.750890e-001, 8.759345e-001, 8.767787e-001, 8.776161e-001,
+8.784536e-001, 8.792910e-001, 8.801240e-001, 8.809452e-001, 8.817664e-001, 8.825875e-001, 8.833963e-001, 8.841795e-001, 8.849628e-001, 8.857461e-001,
+8.865263e-001, 8.873008e-001, 8.880753e-001, 8.888497e-001, 8.896216e-001, 8.903880e-001, 8.911543e-001, 8.919207e-001, 8.926829e-001, 8.934323e-001,
+8.941817e-001, 8.949312e-001, 8.956754e-001, 8.963846e-001, 8.970938e-001, 8.978030e-001, 8.985122e-001, 8.991948e-001, 8.998765e-001, 9.005583e-001,
+9.012400e-001, 9.018873e-001, 9.025239e-001, 9.031605e-001, 9.037971e-001, 9.044255e-001, 9.050460e-001, 9.056666e-001, 9.062872e-001, 9.069045e-001,
+9.075098e-001, 9.081152e-001, 9.087206e-001, 9.093260e-001, 9.099286e-001, 9.105308e-001, 9.111331e-001, 9.117353e-001, 9.123305e-001, 9.129181e-001,
+9.135056e-001, 9.140932e-001, 9.146800e-001, 9.152501e-001, 9.158202e-001, 9.163903e-001, 9.169603e-001, 9.175173e-001, 9.180639e-001, 9.186105e-001,
+9.191571e-001, 9.197033e-001, 9.202299e-001, 9.207566e-001, 9.212832e-001, 9.218099e-001, 9.223287e-001, 9.228377e-001, 9.233466e-001, 9.238555e-001,
+9.243644e-001, 9.248357e-001, 9.252979e-001, 9.257601e-001, 9.262223e-001, 9.266851e-001, 9.271526e-001, 9.276202e-001, 9.280877e-001, 9.285552e-001,
+9.290199e-001, 9.294800e-001, 9.299402e-001, 9.304004e-001, 9.308605e-001, 9.313056e-001, 9.317406e-001, 9.321756e-001, 9.326106e-001, 9.330456e-001,
+9.334610e-001, 9.338704e-001, 9.342798e-001, 9.346892e-001, 9.350986e-001, 9.354946e-001, 9.358887e-001, 9.362828e-001, 9.366768e-001, 9.370709e-001,
+9.374543e-001, 9.378369e-001, 9.382195e-001, 9.386021e-001, 9.389847e-001, 9.393534e-001, 9.397210e-001, 9.400886e-001, 9.404562e-001, 9.408238e-001,
+9.411832e-001, 9.415414e-001, 9.418996e-001, 9.422578e-001, 9.426160e-001, 9.429604e-001, 9.433008e-001, 9.436412e-001, 9.439816e-001, 9.443219e-001,
+9.446521e-001, 9.449758e-001, 9.452995e-001, 9.456232e-001, 9.459469e-001, 9.462660e-001, 9.465780e-001, 9.468900e-001, 9.472020e-001, 9.475140e-001,
+9.478241e-001, 9.481199e-001, 9.484158e-001, 9.487116e-001, 9.490075e-001, 9.493034e-001, 9.495918e-001, 9.498784e-001, 9.501649e-001, 9.504514e-001,
+9.507379e-001, 9.510221e-001, 9.513029e-001, 9.515836e-001, 9.518643e-001, 9.521450e-001, 9.524258e-001, 9.526972e-001, 9.529682e-001, 9.532393e-001,
+9.535103e-001, 9.537813e-001, 9.540500e-001, 9.543160e-001, 9.545820e-001, 9.548479e-001, 9.551139e-001, 9.553798e-001, 9.556449e-001, 9.559098e-001,
+9.561747e-001, 9.564397e-001, 9.567046e-001, 9.569633e-001, 9.572037e-001, 9.574441e-001, 9.576846e-001, 9.579250e-001, 9.581654e-001, 9.584036e-001,
+9.586401e-001, 9.588767e-001, 9.591132e-001, 9.593497e-001, 9.595862e-001, 9.598244e-001, 9.600630e-001, 9.603015e-001, 9.605401e-001, 9.607787e-001,
+9.610171e-001, 9.612381e-001, 9.614590e-001, 9.616799e-001, 9.619008e-001, 9.621218e-001, 9.623394e-001, 9.625350e-001, 9.627306e-001, 9.629262e-001,
+9.631218e-001, 9.633174e-001, 9.635074e-001, 9.636735e-001, 9.638396e-001, 9.640057e-001, 9.641718e-001, 9.643379e-001, 9.645029e-001, 9.646632e-001,
+9.648235e-001, 9.649837e-001, 9.651440e-001, 9.653042e-001, 9.654664e-001, 9.656418e-001, 9.658173e-001, 9.659928e-001, 9.661683e-001, 9.663438e-001,
+9.665192e-001, 9.667049e-001, 9.668907e-001, 9.670765e-001, 9.672623e-001, 9.674480e-001, 9.676338e-001, 9.678208e-001, 9.680082e-001, 9.681956e-001,
+9.683829e-001, 9.685703e-001, 9.687577e-001, 9.689377e-001, 9.691110e-001, 9.692844e-001, 9.694577e-001, 9.696310e-001, 9.698044e-001, 9.699763e-001,
+9.701422e-001, 9.703081e-001, 9.704741e-001, 9.706400e-001, 9.708059e-001, 9.709718e-001, 9.711271e-001, 9.712795e-001, 9.714319e-001, 9.715842e-001,
+9.717366e-001, 9.718890e-001, 9.720391e-001, 9.721842e-001, 9.723293e-001, 9.724744e-001, 9.726195e-001, 9.727646e-001, 9.729096e-001, 9.730469e-001,
+9.731817e-001, 9.733165e-001, 9.734513e-001, 9.735862e-001, 9.737210e-001, 9.738534e-001, 9.739726e-001, 9.740918e-001, 9.742110e-001, 9.743301e-001,
+9.744493e-001, 9.745685e-001, 9.746857e-001, 9.748008e-001, 9.749158e-001, 9.750309e-001, 9.751459e-001, 9.752609e-001, 9.753760e-001, 9.754949e-001,
+9.756155e-001, 9.757360e-001, 9.758566e-001, 9.759772e-001, 9.760977e-001, 9.762183e-001, 9.763411e-001, 9.764642e-001, 9.765874e-001, 9.767105e-001,
+9.768336e-001, 9.769568e-001, 9.770799e-001, 9.772125e-001, 9.773454e-001, 9.774783e-001, 9.776112e-001, 9.777441e-001, 9.778770e-001, 9.780099e-001,
+9.781574e-001, 9.783051e-001, 9.784528e-001, 9.786006e-001, 9.787483e-001, 9.788960e-001, 9.790437e-001, 9.791916e-001, 9.793395e-001, 9.794874e-001,
+9.796353e-001, 9.797832e-001, 9.799311e-001, 9.800790e-001, 9.802208e-001, 9.803610e-001, 9.805012e-001, 9.806414e-001, 9.807816e-001, 9.809218e-001,
+9.810620e-001, 9.811942e-001, 9.813209e-001, 9.814475e-001, 9.815742e-001, 9.817008e-001, 9.818275e-001, 9.819541e-001, 9.820785e-001, 9.821977e-001,
+9.823168e-001, 9.824360e-001, 9.825551e-001, 9.826743e-001, 9.827934e-001, 9.829125e-001, 9.830339e-001, 9.831554e-001, 9.832769e-001, 9.833984e-001,
+9.835199e-001, 9.836414e-001, 9.837629e-001, 9.838853e-001, 9.840088e-001, 9.841322e-001, 9.842557e-001, 9.843791e-001, 9.845025e-001, 9.846260e-001,
+9.847494e-001, 9.848723e-001, 9.849951e-001, 9.851179e-001, 9.852408e-001, 9.853636e-001, 9.854864e-001, 9.856093e-001, 9.857273e-001, 9.858361e-001,
+9.859449e-001, 9.860537e-001, 9.861625e-001, 9.862713e-001, 9.863801e-001, 9.864889e-001, 9.865923e-001, 9.866927e-001, 9.867932e-001, 9.868936e-001,
+9.869940e-001, 9.870945e-001, 9.871949e-001, 9.872953e-001, 9.873874e-001, 9.874783e-001, 9.875692e-001, 9.876601e-001, 9.877510e-001, 9.878419e-001,
+9.879328e-001, 9.880235e-001, 9.881017e-001, 9.881800e-001, 9.882582e-001, 9.883364e-001, 9.884146e-001, 9.884928e-001, 9.885710e-001, 9.886482e-001,
+9.887103e-001, 9.887724e-001, 9.888346e-001, 9.888967e-001, 9.889588e-001, 9.890210e-001, 9.890831e-001, 9.891446e-001, 9.891886e-001, 9.892326e-001,
+9.892766e-001, 9.893207e-001, 9.893647e-001, 9.894087e-001, 9.894527e-001, 9.894968e-001, 9.895276e-001, 9.895573e-001, 9.895870e-001, 9.896167e-001,
+9.896464e-001, 9.896761e-001, 9.897058e-001, 9.897355e-001, 9.897569e-001, 9.897749e-001, 9.897929e-001, 9.898109e-001, 9.898290e-001, 9.898470e-001,
+9.898650e-001, 9.898830e-001, 9.898969e-001, 9.899049e-001, 9.899129e-001, 9.899209e-001, 9.899289e-001, 9.899369e-001, 9.899449e-001, 9.899530e-001,
+9.899609e-001, 9.899665e-001, 9.899721e-001, 9.899777e-001, 9.899833e-001, 9.899889e-001, 9.899945e-001, 9.900001e-001, 9.900058e-001, 9.900107e-001,
+9.900152e-001, 9.900196e-001, 9.900241e-001, 9.900286e-001, 9.900330e-001, 9.900375e-001, 9.900419e-001, 9.900464e-001, 9.900498e-001, 9.900531e-001,
+9.900565e-001, 9.900599e-001, 9.900632e-001, 9.900666e-001, 9.900700e-001, 9.900733e-001, 9.900764e-001, 9.900787e-001, 9.900810e-001, 9.900834e-001,
+9.900857e-001, 9.900880e-001, 9.900904e-001, 9.900927e-001, 9.900950e-001, 9.900968e-001, 9.900982e-001, 9.900995e-001, 9.901009e-001, 9.901023e-001,
+9.901036e-001, 9.901050e-001, 9.901064e-001, 9.901077e-001, 9.901084e-001, 9.901089e-001, 9.901093e-001, 9.901098e-001, 9.901102e-001, 9.901107e-001,
+9.901111e-001, 9.901116e-001, 9.901120e-001, 9.901125e-001, 9.901130e-001, 9.901136e-001, 9.901141e-001, 9.901146e-001, 9.901151e-001, 9.901156e-001,
+9.901161e-001, 9.901167e-001, 9.901172e-001, 9.901177e-001, 9.901182e-001, 9.901187e-001, 9.901192e-001, 9.901198e-001, 9.901203e-001, 9.901208e-001,
+9.901213e-001, 9.901218e-001, 9.901223e-001, 9.901229e-001, 9.901234e-001, 9.901239e-001, 9.901244e-001, 9.901249e-001, 9.901254e-001, 9.901259e-001,
+9.901265e-001, 9.901270e-001, 9.901275e-001, 9.901280e-001, 9.901285e-001, 9.901290e-001, 9.901296e-001, 9.901301e-001, 9.901306e-001, 9.901311e-001,
+9.901316e-001, 9.901321e-001, 9.901327e-001, 9.901332e-001, 9.901337e-001, 9.901342e-001, 9.901347e-001, 9.901352e-001, 9.901358e-001, 9.901363e-001,
+9.901368e-001, 9.901373e-001, 9.901378e-001, 9.901383e-001, 9.901389e-001, 9.901394e-001, 9.901399e-001, 9.901404e-001, 9.901409e-001, 9.901414e-001,
+9.901419e-001, 9.901425e-001, 9.901430e-001, 9.901435e-001, 9.901440e-001, 9.901445e-001, 9.901450e-001, 9.901456e-001, 9.901519e-001, 9.901680e-001,
+9.901842e-001, 9.902004e-001, 9.902166e-001, 9.902328e-001, 9.902490e-001, 9.902652e-001, 9.902813e-001, 9.902975e-001, 9.903177e-001, 9.903403e-001,
+9.903629e-001, 9.903855e-001, 9.904081e-001, 9.904307e-001, 9.904533e-001, 9.904759e-001, 9.904985e-001, 9.905211e-001, 9.905535e-001, 9.905891e-001,
+9.906246e-001, 9.906601e-001, 9.906957e-001, 9.907312e-001, 9.907668e-001, 9.908023e-001, 9.908378e-001, 9.908734e-001, 9.909214e-001, 9.909728e-001,
+9.910241e-001, 9.910754e-001, 9.911268e-001, 9.911781e-001, 9.912294e-001, 9.912808e-001, 9.913321e-001, 9.913834e-001, 9.914424e-001, 9.915044e-001,
+9.915664e-001, 9.916284e-001, 9.916904e-001, 9.917524e-001, 9.918143e-001, 9.918763e-001, 9.919383e-001, 9.920003e-001, 9.920656e-001, 9.921336e-001,
+9.922017e-001, 9.922698e-001, 9.923379e-001, 9.924060e-001, 9.924741e-001, 9.925422e-001, 9.926103e-001, 9.926783e-001, 9.927479e-001, 9.928219e-001,
+9.928959e-001, 9.929699e-001, 9.930439e-001, 9.931180e-001, 9.931920e-001, 9.932660e-001, 9.933400e-001, 9.934140e-001, 9.934880e-001, 9.935687e-001,
+9.936506e-001, 9.937325e-001, 9.938144e-001, 9.938963e-001, 9.939782e-001, 9.940601e-001, 9.941419e-001, 9.942238e-001, 9.943057e-001, 9.943904e-001,
+9.944810e-001, 9.945715e-001, 9.946621e-001, 9.947527e-001, 9.948432e-001, 9.949338e-001, 9.950243e-001, 9.951149e-001, 9.952055e-001, 9.952960e-001,
+9.953925e-001, 9.954916e-001, 9.955907e-001, 9.956899e-001, 9.957890e-001, 9.958881e-001, 9.959873e-001, 9.960864e-001, 9.961855e-001, 9.962846e-001,
+9.963838e-001, 9.964899e-001, 9.965964e-001, 9.967029e-001, 9.968094e-001, 9.969160e-001, 9.970225e-001, 9.971290e-001, 9.972355e-001, 9.973421e-001,
+9.974486e-001, 9.975555e-001, 9.976667e-001, 9.977779e-001, 9.978891e-001, 9.980002e-001, 9.981114e-001, 9.982226e-001, 9.983338e-001, 9.984450e-001,
+9.985562e-001, 9.986674e-001, 9.987786e-001, 9.988896e-001, 9.990006e-001, 9.991117e-001, 9.992227e-001, 9.993338e-001, 9.994448e-001, 9.995558e-001,
+9.996669e-001, 9.997779e-001, 9.998890e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.828344e-004, 3.765924e-004, 5.832637e-004, 8.021335e-004, 1.032392e-003, 1.274422e-003, 1.525648e-003, 1.788894e-003, 2.065500e-003,
+2.356527e-003, 2.661438e-003, 2.980830e-003, 3.312665e-003, 3.657820e-003, 4.016976e-003, 4.392302e-003, 4.782615e-003, 5.189009e-003, 5.611079e-003,
+6.049154e-003, 6.504259e-003, 6.975861e-003, 7.463701e-003, 7.966663e-003, 8.483239e-003, 9.017967e-003, 9.570445e-003, 1.014425e-002, 1.073892e-002,
+1.135102e-002, 1.198044e-002, 1.262698e-002, 1.329094e-002, 1.397095e-002, 1.466653e-002, 1.538186e-002, 1.611847e-002, 1.687591e-002, 1.766074e-002,
+1.846738e-002, 1.929784e-002, 2.014896e-002, 2.102182e-002, 2.191179e-002, 2.282506e-002, 2.375767e-002, 2.470941e-002, 2.568049e-002, 2.667112e-002,
+2.768275e-002, 2.871142e-002, 2.975784e-002, 3.082475e-002, 3.191165e-002, 3.301914e-002, 3.414750e-002, 3.529683e-002, 3.647083e-002, 3.766551e-002,
+3.888171e-002, 4.011834e-002, 4.137416e-002, 4.265007e-002, 4.394912e-002, 4.527043e-002, 4.661237e-002, 4.797356e-002, 4.935647e-002, 5.076221e-002,
+5.218937e-002, 5.363712e-002, 5.510492e-002, 5.659521e-002, 5.811063e-002, 5.965162e-002, 6.121493e-002, 6.279923e-002, 6.440685e-002, 6.603892e-002,
+6.769143e-002, 6.935708e-002, 7.103995e-002, 7.274130e-002, 7.445943e-002, 7.619277e-002, 7.794214e-002, 7.970974e-002, 8.149763e-002, 8.330642e-002,
+8.513365e-002, 8.697528e-002, 8.882874e-002, 9.069590e-002, 9.257947e-002, 9.448267e-002, 9.640894e-002, 9.834871e-002, 1.003041e-001, 1.022775e-001,
+1.042753e-001, 1.062982e-001, 1.083303e-001, 1.103702e-001, 1.124206e-001, 1.144891e-001, 1.165636e-001, 1.186439e-001, 1.207353e-001, 1.228388e-001,
+1.249522e-001, 1.270756e-001, 1.292198e-001, 1.313750e-001, 1.335413e-001, 1.357282e-001, 1.379179e-001, 1.401115e-001, 1.423158e-001, 1.445332e-001,
+1.467590e-001, 1.489966e-001, 1.512416e-001, 1.534926e-001, 1.557578e-001, 1.580405e-001, 1.603358e-001, 1.626514e-001, 1.649708e-001, 1.672957e-001,
+1.696294e-001, 1.719670e-001, 1.743122e-001, 1.766574e-001, 1.790026e-001, 1.813486e-001, 1.836973e-001, 1.860560e-001, 1.884246e-001, 1.908024e-001,
+1.931804e-001, 1.955590e-001, 1.979467e-001, 2.003420e-001, 2.027535e-001, 2.051690e-001, 2.075876e-001, 2.100103e-001, 2.124343e-001, 2.148667e-001,
+2.172998e-001, 2.197347e-001, 2.221717e-001, 2.246143e-001, 2.270616e-001, 2.295158e-001, 2.319785e-001, 2.344492e-001, 2.369216e-001, 2.393949e-001,
+2.418685e-001, 2.443421e-001, 2.468206e-001, 2.493009e-001, 2.517745e-001, 2.542459e-001, 2.567092e-001, 2.591698e-001, 2.616206e-001, 2.640682e-001,
+2.665097e-001, 2.689489e-001, 2.713932e-001, 2.738404e-001, 2.762868e-001, 2.787326e-001, 2.811723e-001, 2.836047e-001, 2.860364e-001, 2.884667e-001,
+2.908955e-001, 2.933178e-001, 2.957400e-001, 2.981606e-001, 3.005811e-001, 3.029995e-001, 3.054174e-001, 3.078261e-001, 3.102285e-001, 3.126305e-001,
+3.150318e-001, 3.174335e-001, 3.198407e-001, 3.222478e-001, 3.246581e-001, 3.270692e-001, 3.294793e-001, 3.318882e-001, 3.342961e-001, 3.366978e-001,
+3.390996e-001, 3.414918e-001, 3.438811e-001, 3.462617e-001, 3.486274e-001, 3.509930e-001, 3.533450e-001, 3.556961e-001, 3.580407e-001, 3.603786e-001,
+3.627164e-001, 3.650526e-001, 3.673887e-001, 3.697171e-001, 3.720384e-001, 3.743597e-001, 3.766688e-001, 3.789779e-001, 3.812793e-001, 3.835709e-001,
+3.858625e-001, 3.881478e-001, 3.904320e-001, 3.927092e-001, 3.949654e-001, 3.972216e-001, 3.994632e-001, 4.016954e-001, 4.039277e-001, 4.061439e-001,
+4.083590e-001, 4.105660e-001, 4.127483e-001, 4.149305e-001, 4.171047e-001, 4.192717e-001, 4.214386e-001, 4.236005e-001, 4.257610e-001, 4.279214e-001,
+4.300719e-001, 4.322223e-001, 4.343703e-001, 4.365069e-001, 4.386435e-001, 4.407753e-001, 4.428967e-001, 4.450182e-001, 4.471281e-001, 4.492236e-001,
+4.513191e-001, 4.533992e-001, 4.554661e-001, 4.575330e-001, 4.595871e-001, 4.616328e-001, 4.636784e-001, 4.657067e-001, 4.677248e-001, 4.697429e-001,
+4.717616e-001, 4.737805e-001, 4.757995e-001, 4.778141e-001, 4.798258e-001, 4.818374e-001, 4.838385e-001, 4.858299e-001, 4.878214e-001, 4.898057e-001,
+4.917800e-001, 4.937544e-001, 4.957254e-001, 4.976881e-001, 4.996508e-001, 5.016112e-001, 5.035546e-001, 5.054980e-001, 5.074414e-001, 5.093577e-001,
+5.112712e-001, 5.131847e-001, 5.150826e-001, 5.169729e-001, 5.188632e-001, 5.207425e-001, 5.226052e-001, 5.244679e-001, 5.263286e-001, 5.281689e-001,
+5.300091e-001, 5.318494e-001, 5.336812e-001, 5.355101e-001, 5.373390e-001, 5.391627e-001, 5.409774e-001, 5.427920e-001, 5.446066e-001, 5.463947e-001,
+5.481811e-001, 5.499676e-001, 5.517386e-001, 5.534932e-001, 5.552479e-001, 5.570025e-001, 5.587229e-001, 5.604430e-001, 5.621632e-001, 5.638736e-001,
+5.655728e-001, 5.672720e-001, 5.689712e-001, 5.706508e-001, 5.723282e-001, 5.740055e-001, 5.756754e-001, 5.773271e-001, 5.789787e-001, 5.806304e-001,
+5.822653e-001, 5.838909e-001, 5.855165e-001, 5.871421e-001, 5.887404e-001, 5.903375e-001, 5.919346e-001, 5.935288e-001, 5.951130e-001, 5.966972e-001,
+5.982814e-001, 5.998545e-001, 6.014149e-001, 6.029752e-001, 6.045356e-001, 6.060755e-001, 6.076047e-001, 6.091339e-001, 6.106632e-001, 6.121818e-001,
+6.136978e-001, 6.152139e-001, 6.167300e-001, 6.182157e-001, 6.196988e-001, 6.211818e-001, 6.226648e-001, 6.241228e-001, 6.255804e-001, 6.270379e-001,
+6.284953e-001, 6.299348e-001, 6.313742e-001, 6.328136e-001, 6.342531e-001, 6.356779e-001, 6.371027e-001, 6.385274e-001, 6.399521e-001, 6.413485e-001,
+6.427427e-001, 6.441369e-001, 6.455310e-001, 6.469084e-001, 6.482822e-001, 6.496560e-001, 6.510298e-001, 6.523879e-001, 6.537382e-001, 6.550885e-001,
+6.564389e-001, 6.577758e-001, 6.590979e-001, 6.604200e-001, 6.617421e-001, 6.630571e-001, 6.643491e-001, 6.656410e-001, 6.669330e-001, 6.682249e-001,
+6.695014e-001, 6.707772e-001, 6.720529e-001, 6.733286e-001, 6.746001e-001, 6.758690e-001, 6.771380e-001, 6.784069e-001, 6.796714e-001, 6.809216e-001,
+6.821717e-001, 6.834219e-001, 6.846720e-001, 6.859097e-001, 6.871445e-001, 6.883792e-001, 6.896140e-001, 6.908426e-001, 6.920587e-001, 6.932748e-001,
+6.944910e-001, 6.957071e-001, 6.969081e-001, 6.981055e-001, 6.993029e-001, 7.005002e-001, 7.016944e-001, 7.028783e-001, 7.040622e-001, 7.052460e-001,
+7.064299e-001, 7.075976e-001, 7.087551e-001, 7.099126e-001, 7.110701e-001, 7.122275e-001, 7.133823e-001, 7.145369e-001, 7.156915e-001, 7.168461e-001,
+7.179934e-001, 7.191139e-001, 7.202344e-001, 7.213549e-001, 7.224754e-001, 7.235805e-001, 7.246659e-001, 7.257513e-001, 7.268367e-001, 7.279221e-001,
+7.289988e-001, 7.300699e-001, 7.311410e-001, 7.322121e-001, 7.332832e-001, 7.343558e-001, 7.354290e-001, 7.365021e-001, 7.375753e-001, 7.386484e-001,
+7.396969e-001, 7.407392e-001, 7.417816e-001, 7.428239e-001, 7.438662e-001, 7.448875e-001, 7.459040e-001, 7.469205e-001, 7.479370e-001, 7.489535e-001,
+7.499631e-001, 7.509707e-001, 7.519783e-001, 7.529859e-001, 7.539935e-001, 7.549922e-001, 7.559867e-001, 7.569812e-001, 7.579757e-001, 7.589702e-001,
+7.599533e-001, 7.609264e-001, 7.618995e-001, 7.628726e-001, 7.638456e-001, 7.648131e-001, 7.657690e-001, 7.667248e-001, 7.676807e-001, 7.686366e-001,
+7.695921e-001, 7.705424e-001, 7.714928e-001, 7.724432e-001, 7.733935e-001, 7.743439e-001, 7.752858e-001, 7.762248e-001, 7.771639e-001, 7.781029e-001,
+7.790420e-001, 7.799775e-001, 7.809069e-001, 7.818364e-001, 7.827658e-001, 7.836953e-001, 7.846247e-001, 7.855425e-001, 7.864595e-001, 7.873764e-001,
+7.882934e-001, 7.892104e-001, 7.901171e-001, 7.910108e-001, 7.919045e-001, 7.927982e-001, 7.936919e-001, 7.945856e-001, 7.954729e-001, 7.963594e-001,
+7.972459e-001, 7.981324e-001, 7.990188e-001, 7.999022e-001, 8.007771e-001, 8.016519e-001, 8.025268e-001, 8.034017e-001, 8.042766e-001, 8.051420e-001,
+8.060011e-001, 8.068601e-001, 8.077192e-001, 8.085782e-001, 8.094373e-001, 8.102780e-001, 8.111159e-001, 8.119537e-001, 8.127915e-001, 8.136294e-001,
+8.144660e-001, 8.152854e-001, 8.161048e-001, 8.169242e-001, 8.177436e-001, 8.185630e-001, 8.193803e-001, 8.201890e-001, 8.209977e-001, 8.218064e-001,
+8.226152e-001, 8.234239e-001, 8.242325e-001, 8.250408e-001, 8.258491e-001, 8.266574e-001, 8.274656e-001, 8.282739e-001, 8.290752e-001, 8.298594e-001,
+8.306435e-001, 8.314277e-001, 8.322118e-001, 8.329960e-001, 8.337737e-001, 8.345308e-001, 8.352878e-001, 8.360449e-001, 8.368019e-001, 8.375590e-001,
+8.383143e-001, 8.390562e-001, 8.397982e-001, 8.405401e-001, 8.412820e-001, 8.420239e-001, 8.427659e-001, 8.434939e-001, 8.442208e-001, 8.449477e-001,
+8.456747e-001, 8.464016e-001, 8.471285e-001, 8.478465e-001, 8.485603e-001, 8.492741e-001, 8.499878e-001, 8.507016e-001, 8.514153e-001, 8.521232e-001,
+8.528203e-001, 8.535174e-001, 8.542146e-001, 8.549117e-001, 8.556089e-001, 8.563060e-001, 8.569780e-001, 8.576492e-001, 8.583204e-001, 8.589916e-001,
+8.596628e-001, 8.603340e-001, 8.609988e-001, 8.616574e-001, 8.623160e-001, 8.629746e-001, 8.636332e-001, 8.642918e-001, 8.649504e-001, 8.655931e-001,
+8.662354e-001, 8.668778e-001, 8.675202e-001, 8.681626e-001, 8.688050e-001, 8.694402e-001, 8.700638e-001, 8.706874e-001, 8.713109e-001, 8.719345e-001,
+8.725581e-001, 8.731817e-001, 8.737874e-001, 8.743859e-001, 8.749844e-001, 8.755829e-001, 8.761814e-001, 8.767799e-001, 8.773784e-001, 8.779737e-001,
+8.785690e-001, 8.791642e-001, 8.797595e-001, 8.803547e-001, 8.809500e-001, 8.815436e-001, 8.821283e-001, 8.827130e-001, 8.832976e-001, 8.838823e-001,
+8.844670e-001, 8.850517e-001, 8.856287e-001, 8.861844e-001, 8.867400e-001, 8.872956e-001, 8.878512e-001, 8.884068e-001, 8.889624e-001, 8.895107e-001,
+8.900416e-001, 8.905725e-001, 8.911035e-001, 8.916344e-001, 8.921653e-001, 8.926963e-001, 8.932246e-001, 8.937453e-001, 8.942660e-001, 8.947867e-001,
+8.953074e-001, 8.958282e-001, 8.963489e-001, 8.968678e-001, 8.973753e-001, 8.978827e-001, 8.983902e-001, 8.988977e-001, 8.994052e-001, 8.999127e-001,
+9.004202e-001, 9.009217e-001, 9.014229e-001, 9.019241e-001, 9.024253e-001, 9.029264e-001, 9.034276e-001, 9.039288e-001, 9.044218e-001, 9.049109e-001,
+9.054000e-001, 9.058891e-001, 9.063782e-001, 9.068673e-001, 9.073564e-001, 9.078389e-001, 9.083073e-001, 9.087758e-001, 9.092442e-001, 9.097126e-001,
+9.101811e-001, 9.106495e-001, 9.111180e-001, 9.115677e-001, 9.120152e-001, 9.124627e-001, 9.129102e-001, 9.133577e-001, 9.138052e-001, 9.142526e-001,
+9.146982e-001, 9.151405e-001, 9.155829e-001, 9.160252e-001, 9.164675e-001, 9.169099e-001, 9.173522e-001, 9.177946e-001, 9.182294e-001, 9.186623e-001,
+9.190952e-001, 9.195280e-001, 9.199609e-001, 9.203937e-001, 9.208266e-001, 9.212581e-001, 9.216785e-001, 9.220990e-001, 9.225194e-001, 9.229399e-001,
+9.233603e-001, 9.237808e-001, 9.242012e-001, 9.246130e-001, 9.250090e-001, 9.254049e-001, 9.258008e-001, 9.261968e-001, 9.265927e-001, 9.269887e-001,
+9.273846e-001, 9.277727e-001, 9.281532e-001, 9.285338e-001, 9.289144e-001, 9.292949e-001, 9.296755e-001, 9.300560e-001, 9.304366e-001, 9.308060e-001,
+9.311676e-001, 9.315292e-001, 9.318907e-001, 9.322523e-001, 9.326138e-001, 9.329754e-001, 9.333369e-001, 9.336917e-001, 9.340415e-001, 9.343912e-001,
+9.347409e-001, 9.350907e-001, 9.354404e-001, 9.357901e-001, 9.361399e-001, 9.364842e-001, 9.368223e-001, 9.371605e-001, 9.374987e-001, 9.378369e-001,
+9.381750e-001, 9.385132e-001, 9.388514e-001, 9.391886e-001, 9.395235e-001, 9.398585e-001, 9.401934e-001, 9.405283e-001, 9.408632e-001, 9.411981e-001,
+9.415330e-001, 9.418679e-001, 9.422002e-001, 9.425325e-001, 9.428647e-001, 9.431970e-001, 9.435293e-001, 9.438615e-001, 9.441938e-001, 9.445260e-001,
+9.448490e-001, 9.451668e-001, 9.454846e-001, 9.458024e-001, 9.461202e-001, 9.464380e-001, 9.467557e-001, 9.470735e-001, 9.473884e-001, 9.476900e-001,
+9.479916e-001, 9.482933e-001, 9.485949e-001, 9.488966e-001, 9.491982e-001, 9.494998e-001, 9.498015e-001, 9.501005e-001, 9.503980e-001, 9.506955e-001,
+9.509931e-001, 9.512906e-001, 9.515881e-001, 9.518856e-001, 9.521831e-001, 9.524806e-001, 9.527738e-001, 9.530669e-001, 9.533600e-001, 9.536531e-001,
+9.539462e-001, 9.542394e-001, 9.545325e-001, 9.548256e-001, 9.551170e-001, 9.554037e-001, 9.556903e-001, 9.559770e-001, 9.562636e-001, 9.565503e-001,
+9.568369e-001, 9.571236e-001, 9.574102e-001, 9.576948e-001, 9.579766e-001, 9.582585e-001, 9.585403e-001, 9.588221e-001, 9.591039e-001, 9.593858e-001,
+9.596676e-001, 9.599494e-001, 9.602294e-001, 9.605074e-001, 9.607855e-001, 9.610636e-001, 9.613417e-001, 9.616197e-001, 9.618978e-001, 9.621759e-001,
+9.624540e-001, 9.627260e-001, 9.629915e-001, 9.632570e-001, 9.635225e-001, 9.637880e-001, 9.640535e-001, 9.643190e-001, 9.645845e-001, 9.648500e-001,
+9.651171e-001, 9.653870e-001, 9.656568e-001, 9.659267e-001, 9.661966e-001, 9.664664e-001, 9.667363e-001, 9.670061e-001, 9.672760e-001, 9.675456e-001,
+9.678133e-001, 9.680811e-001, 9.683488e-001, 9.686166e-001, 9.688843e-001, 9.691521e-001, 9.694198e-001, 9.696876e-001, 9.699553e-001, 9.702138e-001,
+9.704702e-001, 9.707266e-001, 9.709830e-001, 9.712394e-001, 9.714958e-001, 9.717522e-001, 9.720086e-001, 9.722651e-001, 9.725132e-001, 9.727490e-001,
+9.729848e-001, 9.732206e-001, 9.734564e-001, 9.736922e-001, 9.739280e-001, 9.741638e-001, 9.743996e-001, 9.746354e-001, 9.748559e-001, 9.750743e-001,
+9.752926e-001, 9.755109e-001, 9.757293e-001, 9.759476e-001, 9.761659e-001, 9.763843e-001, 9.766026e-001, 9.768189e-001, 9.770291e-001, 9.772393e-001,
+9.774495e-001, 9.776597e-001, 9.778699e-001, 9.780801e-001, 9.782903e-001, 9.785005e-001, 9.787107e-001, 9.789108e-001, 9.791018e-001, 9.792928e-001,
+9.794839e-001, 9.796749e-001, 9.798659e-001, 9.800569e-001, 9.802479e-001, 9.804389e-001, 9.806299e-001, 9.808202e-001, 9.810102e-001, 9.812002e-001,
+9.813902e-001, 9.815803e-001, 9.817703e-001, 9.819603e-001, 9.821503e-001, 9.823403e-001, 9.825303e-001, 9.827158e-001, 9.828997e-001, 9.830836e-001,
+9.832674e-001, 9.834513e-001, 9.836352e-001, 9.838191e-001, 9.840029e-001, 9.841868e-001, 9.843707e-001, 9.845508e-001, 9.847292e-001, 9.849076e-001,
+9.850859e-001, 9.852643e-001, 9.854427e-001, 9.856211e-001, 9.857995e-001, 9.859779e-001, 9.861563e-001, 9.863288e-001, 9.864964e-001, 9.866639e-001,
+9.868314e-001, 9.869989e-001, 9.871664e-001, 9.873339e-001, 9.875014e-001, 9.876689e-001, 9.878365e-001, 9.879998e-001, 9.881515e-001, 9.883032e-001,
+9.884549e-001, 9.886066e-001, 9.887583e-001, 9.889100e-001, 9.890617e-001, 9.892134e-001, 9.893651e-001, 9.895168e-001, 9.896613e-001, 9.898049e-001,
+9.899485e-001, 9.900921e-001, 9.902357e-001, 9.903793e-001, 9.905229e-001, 9.906665e-001, 9.908101e-001, 9.909537e-001, 9.910960e-001, 9.912365e-001,
+9.913769e-001, 9.915173e-001, 9.916577e-001, 9.917981e-001, 9.919385e-001, 9.920789e-001, 9.922194e-001, 9.923598e-001, 9.925002e-001, 9.926363e-001,
+9.927713e-001, 9.929063e-001, 9.930412e-001, 9.931762e-001, 9.933112e-001, 9.934461e-001, 9.935811e-001, 9.937161e-001, 9.938511e-001, 9.939857e-001,
+9.941160e-001, 9.942464e-001, 9.943767e-001, 9.945070e-001, 9.946373e-001, 9.947676e-001, 9.948979e-001, 9.950283e-001, 9.951586e-001, 9.952889e-001,
+9.954196e-001, 9.955514e-001, 9.956832e-001, 9.958151e-001, 9.959469e-001, 9.960787e-001, 9.962106e-001, 9.963424e-001, 9.964742e-001, 9.966061e-001,
+9.967379e-001, 9.968718e-001, 9.970114e-001, 9.971511e-001, 9.972907e-001, 9.974303e-001, 9.975699e-001, 9.977096e-001, 9.978492e-001, 9.979888e-001,
+9.981284e-001, 9.982680e-001, 9.984086e-001, 9.985533e-001, 9.986980e-001, 9.988426e-001, 9.989873e-001, 9.991320e-001, 9.992767e-001, 9.994213e-001,
+9.995660e-001, 9.997107e-001, 9.998553e-001, 1.000000e+000)),
+("Kodak", "Kodachrome 200", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.730574e-004, 3.522631e-004, 5.379661e-004, 7.310679e-004, 9.340477e-004, 1.145725e-003, 1.366463e-003, 1.595398e-003, 1.829282e-003,
+2.073851e-003, 2.328169e-003, 2.592053e-003, 2.867948e-003, 3.152954e-003, 3.444866e-003, 3.747201e-003, 4.061777e-003, 4.385999e-003, 4.721727e-003,
+5.069921e-003, 5.434572e-003, 5.811639e-003, 6.201185e-003, 6.603134e-003, 7.017766e-003, 7.444274e-003, 7.879525e-003, 8.327870e-003, 8.791509e-003,
+9.269176e-003, 9.762311e-003, 1.026945e-002, 1.079061e-002, 1.132680e-002, 1.187862e-002, 1.244314e-002, 1.302190e-002, 1.361523e-002, 1.422322e-002,
+1.484492e-002, 1.547836e-002, 1.612570e-002, 1.678632e-002, 1.746315e-002, 1.815445e-002, 1.886420e-002, 1.958808e-002, 2.032756e-002, 2.108114e-002,
+2.185343e-002, 2.264513e-002, 2.345241e-002, 2.427639e-002, 2.512189e-002, 2.598514e-002, 2.686207e-002, 2.775487e-002, 2.866487e-002, 2.959085e-002,
+3.053344e-002, 3.149473e-002, 3.247446e-002, 3.347641e-002, 3.449951e-002, 3.554025e-002, 3.659812e-002, 3.767475e-002, 3.877227e-002, 3.989258e-002,
+4.103571e-002, 4.219717e-002, 4.337586e-002, 4.457244e-002, 4.578690e-002, 4.702134e-002, 4.827866e-002, 4.956166e-002, 5.087090e-002, 5.220399e-002,
+5.356213e-002, 5.494568e-002, 5.635429e-002, 5.778724e-002, 5.924354e-002, 6.072359e-002, 6.222991e-002, 6.376416e-002, 6.533009e-002, 6.691953e-002,
+6.852844e-002, 7.015612e-002, 7.180303e-002, 7.346956e-002, 7.515901e-002, 7.687239e-002, 7.860734e-002, 8.036409e-002, 8.214294e-002, 8.394720e-002,
+8.578245e-002, 8.764025e-002, 8.951866e-002, 9.141605e-002, 9.334144e-002, 9.528760e-002, 9.725521e-002, 9.924529e-002, 1.012667e-001, 1.033084e-001,
+1.053688e-001, 1.074499e-001, 1.095538e-001, 1.116734e-001, 1.138081e-001, 1.159645e-001, 1.181332e-001, 1.203133e-001, 1.225123e-001, 1.247253e-001,
+1.269483e-001, 1.291864e-001, 1.314398e-001, 1.337048e-001, 1.359920e-001, 1.382973e-001, 1.406148e-001, 1.429531e-001, 1.453037e-001, 1.476658e-001,
+1.500508e-001, 1.524462e-001, 1.548594e-001, 1.572893e-001, 1.597270e-001, 1.621784e-001, 1.646372e-001, 1.671067e-001, 1.695882e-001, 1.720747e-001,
+1.745768e-001, 1.770841e-001, 1.796021e-001, 1.821262e-001, 1.846542e-001, 1.871973e-001, 1.897435e-001, 1.922962e-001, 1.948486e-001, 1.974000e-001,
+1.999529e-001, 2.025073e-001, 2.050623e-001, 2.076176e-001, 2.101785e-001, 2.127405e-001, 2.153039e-001, 2.178677e-001, 2.204349e-001, 2.230034e-001,
+2.255781e-001, 2.281539e-001, 2.307338e-001, 2.333168e-001, 2.359074e-001, 2.384989e-001, 2.410926e-001, 2.436848e-001, 2.462744e-001, 2.488645e-001,
+2.514558e-001, 2.540476e-001, 2.566407e-001, 2.592354e-001, 2.618349e-001, 2.644350e-001, 2.670377e-001, 2.696410e-001, 2.722526e-001, 2.748641e-001,
+2.774799e-001, 2.800960e-001, 2.827027e-001, 2.853069e-001, 2.879045e-001, 2.904980e-001, 2.930888e-001, 2.956757e-001, 2.982619e-001, 3.008451e-001,
+3.034283e-001, 3.060013e-001, 3.085739e-001, 3.111369e-001, 3.136957e-001, 3.162499e-001, 3.187974e-001, 3.213434e-001, 3.238752e-001, 3.264069e-001,
+3.289283e-001, 3.314463e-001, 3.339582e-001, 3.364607e-001, 3.389631e-001, 3.414388e-001, 3.439145e-001, 3.463768e-001, 3.488296e-001, 3.512795e-001,
+3.537117e-001, 3.561440e-001, 3.585643e-001, 3.609788e-001, 3.633924e-001, 3.658021e-001, 3.682117e-001, 3.706200e-001, 3.730275e-001, 3.754345e-001,
+3.778377e-001, 3.802409e-001, 3.826423e-001, 3.850422e-001, 3.874421e-001, 3.898290e-001, 3.922148e-001, 3.945944e-001, 3.969588e-001, 3.993231e-001,
+4.016804e-001, 4.040334e-001, 4.063865e-001, 4.087264e-001, 4.110654e-001, 4.134009e-001, 4.157232e-001, 4.180455e-001, 4.203621e-001, 4.226720e-001,
+4.249819e-001, 4.272815e-001, 4.295764e-001, 4.318712e-001, 4.341446e-001, 4.364148e-001, 4.386842e-001, 4.409302e-001, 4.431763e-001, 4.454182e-001,
+4.476383e-001, 4.498584e-001, 4.520726e-001, 4.542695e-001, 4.564663e-001, 4.586520e-001, 4.608141e-001, 4.629763e-001, 4.651245e-001, 4.672471e-001,
+4.693698e-001, 4.714810e-001, 4.735712e-001, 4.756615e-001, 4.777420e-001, 4.798025e-001, 4.818629e-001, 4.839159e-001, 4.859476e-001, 4.879794e-001,
+4.900069e-001, 4.920125e-001, 4.940182e-001, 4.960233e-001, 4.980137e-001, 5.000041e-001, 5.019946e-001, 5.039595e-001, 5.059207e-001, 5.078819e-001,
+5.098254e-001, 5.117604e-001, 5.136954e-001, 5.156212e-001, 5.175352e-001, 5.194492e-001, 5.213581e-001, 5.232422e-001, 5.251263e-001, 5.270104e-001,
+5.288773e-001, 5.307417e-001, 5.326061e-001, 5.344614e-001, 5.363087e-001, 5.381559e-001, 5.400000e-001, 5.418263e-001, 5.436527e-001, 5.454791e-001,
+5.472977e-001, 5.491136e-001, 5.509295e-001, 5.527412e-001, 5.545426e-001, 5.563440e-001, 5.581454e-001, 5.599331e-001, 5.617173e-001, 5.635016e-001,
+5.652782e-001, 5.670351e-001, 5.687919e-001, 5.705488e-001, 5.722796e-001, 5.740000e-001, 5.757205e-001, 5.774373e-001, 5.791263e-001, 5.808153e-001,
+5.825042e-001, 5.841787e-001, 5.858369e-001, 5.874952e-001, 5.891535e-001, 5.907947e-001, 5.924314e-001, 5.940682e-001, 5.957034e-001, 5.973180e-001,
+5.989326e-001, 6.005473e-001, 6.021553e-001, 6.037487e-001, 6.053421e-001, 6.069355e-001, 6.085183e-001, 6.100910e-001, 6.116637e-001, 6.132364e-001,
+6.147911e-001, 6.163368e-001, 6.178825e-001, 6.194281e-001, 6.209585e-001, 6.224847e-001, 6.240109e-001, 6.255372e-001, 6.270472e-001, 6.285546e-001,
+6.300620e-001, 6.315694e-001, 6.330656e-001, 6.345605e-001, 6.360553e-001, 6.375501e-001, 6.390339e-001, 6.405161e-001, 6.419983e-001, 6.434805e-001,
+6.449519e-001, 6.464209e-001, 6.478899e-001, 6.493589e-001, 6.508316e-001, 6.523056e-001, 6.537796e-001, 6.552537e-001, 6.567261e-001, 6.581973e-001,
+6.596685e-001, 6.611397e-001, 6.626037e-001, 6.640565e-001, 6.655093e-001, 6.669621e-001, 6.684113e-001, 6.698417e-001, 6.712720e-001, 6.727023e-001,
+6.741326e-001, 6.755437e-001, 6.769521e-001, 6.783605e-001, 6.797690e-001, 6.811654e-001, 6.825523e-001, 6.839391e-001, 6.853259e-001, 6.867080e-001,
+6.880686e-001, 6.894293e-001, 6.907899e-001, 6.921505e-001, 6.934960e-001, 6.948368e-001, 6.961775e-001, 6.975182e-001, 6.988572e-001, 7.001918e-001,
+7.015264e-001, 7.028610e-001, 7.041956e-001, 7.055236e-001, 7.068497e-001, 7.081758e-001, 7.095018e-001, 7.108236e-001, 7.121293e-001, 7.134349e-001,
+7.147405e-001, 7.160462e-001, 7.173392e-001, 7.186235e-001, 7.199079e-001, 7.211923e-001, 7.224767e-001, 7.237458e-001, 7.250138e-001, 7.262817e-001,
+7.275497e-001, 7.288152e-001, 7.300717e-001, 7.313283e-001, 7.325848e-001, 7.338414e-001, 7.350923e-001, 7.363362e-001, 7.375801e-001, 7.388241e-001,
+7.400680e-001, 7.413054e-001, 7.425388e-001, 7.437722e-001, 7.450056e-001, 7.462391e-001, 7.474638e-001, 7.486857e-001, 7.499076e-001, 7.511295e-001,
+7.523514e-001, 7.535636e-001, 7.547738e-001, 7.559840e-001, 7.571942e-001, 7.584044e-001, 7.596077e-001, 7.608097e-001, 7.620118e-001, 7.632139e-001,
+7.644160e-001, 7.655979e-001, 7.667755e-001, 7.679530e-001, 7.691306e-001, 7.703081e-001, 7.714644e-001, 7.726130e-001, 7.737616e-001, 7.749102e-001,
+7.760588e-001, 7.771977e-001, 7.783301e-001, 7.794624e-001, 7.805947e-001, 7.817270e-001, 7.828512e-001, 7.839630e-001, 7.850749e-001, 7.861867e-001,
+7.872986e-001, 7.884056e-001, 7.894845e-001, 7.905633e-001, 7.916421e-001, 7.927210e-001, 7.937998e-001, 7.948550e-001, 7.959054e-001, 7.969559e-001,
+7.980064e-001, 7.990568e-001, 8.000958e-001, 8.011217e-001, 8.021476e-001, 8.031735e-001, 8.041994e-001, 8.052239e-001, 8.062177e-001, 8.072115e-001,
+8.082052e-001, 8.091990e-001, 8.101927e-001, 8.111652e-001, 8.121207e-001, 8.130762e-001, 8.140318e-001, 8.149873e-001, 8.159424e-001, 8.168679e-001,
+8.177933e-001, 8.187187e-001, 8.196441e-001, 8.205695e-001, 8.214858e-001, 8.223888e-001, 8.232918e-001, 8.241948e-001, 8.250979e-001, 8.260009e-001,
+8.268916e-001, 8.277780e-001, 8.286645e-001, 8.295509e-001, 8.304374e-001, 8.313234e-001, 8.321877e-001, 8.330520e-001, 8.339163e-001, 8.347806e-001,
+8.356449e-001, 8.365029e-001, 8.373396e-001, 8.381764e-001, 8.390132e-001, 8.398499e-001, 8.406867e-001, 8.415160e-001, 8.423329e-001, 8.431499e-001,
+8.439669e-001, 8.447839e-001, 8.456009e-001, 8.464123e-001, 8.472172e-001, 8.480221e-001, 8.488271e-001, 8.496320e-001, 8.504369e-001, 8.512372e-001,
+8.520324e-001, 8.528277e-001, 8.536229e-001, 8.544182e-001, 8.552135e-001, 8.559978e-001, 8.567682e-001, 8.575387e-001, 8.583091e-001, 8.590795e-001,
+8.598499e-001, 8.606120e-001, 8.613571e-001, 8.621021e-001, 8.628472e-001, 8.635922e-001, 8.643373e-001, 8.650797e-001, 8.658074e-001, 8.665351e-001,
+8.672628e-001, 8.679905e-001, 8.687182e-001, 8.694459e-001, 8.701534e-001, 8.708591e-001, 8.715647e-001, 8.722703e-001, 8.729759e-001, 8.736816e-001,
+8.743743e-001, 8.750585e-001, 8.757428e-001, 8.764270e-001, 8.771112e-001, 8.777955e-001, 8.784751e-001, 8.791389e-001, 8.798026e-001, 8.804663e-001,
+8.811301e-001, 8.817938e-001, 8.824576e-001, 8.831110e-001, 8.837616e-001, 8.844121e-001, 8.850626e-001, 8.857132e-001, 8.863637e-001, 8.870092e-001,
+8.876400e-001, 8.882709e-001, 8.889017e-001, 8.895326e-001, 8.901634e-001, 8.907943e-001, 8.914090e-001, 8.920159e-001, 8.926227e-001, 8.932296e-001,
+8.938365e-001, 8.944433e-001, 8.950501e-001, 8.956451e-001, 8.962401e-001, 8.968351e-001, 8.974302e-001, 8.980252e-001, 8.986202e-001, 8.992115e-001,
+8.997929e-001, 9.003743e-001, 9.009556e-001, 9.015370e-001, 9.021184e-001, 9.026998e-001, 9.032739e-001, 9.038397e-001, 9.044055e-001, 9.049713e-001,
+9.055371e-001, 9.061030e-001, 9.066688e-001, 9.072258e-001, 9.077768e-001, 9.083277e-001, 9.088787e-001, 9.094297e-001, 9.099807e-001, 9.105316e-001,
+9.110672e-001, 9.115941e-001, 9.121210e-001, 9.126479e-001, 9.131749e-001, 9.137018e-001, 9.142287e-001, 9.147396e-001, 9.152405e-001, 9.157413e-001,
+9.162421e-001, 9.167430e-001, 9.172438e-001, 9.177446e-001, 9.182331e-001, 9.187097e-001, 9.191862e-001, 9.196628e-001, 9.201393e-001, 9.206159e-001,
+9.210924e-001, 9.215655e-001, 9.220311e-001, 9.224968e-001, 9.229624e-001, 9.234281e-001, 9.238938e-001, 9.243594e-001, 9.248240e-001, 9.252729e-001,
+9.257218e-001, 9.261707e-001, 9.266196e-001, 9.270686e-001, 9.275175e-001, 9.279664e-001, 9.283986e-001, 9.288245e-001, 9.292504e-001, 9.296763e-001,
+9.301022e-001, 9.305281e-001, 9.309540e-001, 9.313746e-001, 9.317832e-001, 9.321918e-001, 9.326004e-001, 9.330091e-001, 9.334177e-001, 9.338263e-001,
+9.342349e-001, 9.346324e-001, 9.350272e-001, 9.354221e-001, 9.358169e-001, 9.362118e-001, 9.366066e-001, 9.370014e-001, 9.373939e-001, 9.377783e-001,
+9.381627e-001, 9.385471e-001, 9.389316e-001, 9.393160e-001, 9.397004e-001, 9.400848e-001, 9.404577e-001, 9.408218e-001, 9.411860e-001, 9.415501e-001,
+9.419142e-001, 9.422784e-001, 9.426425e-001, 9.430067e-001, 9.433518e-001, 9.436928e-001, 9.440338e-001, 9.443748e-001, 9.447158e-001, 9.450569e-001,
+9.453979e-001, 9.457389e-001, 9.460589e-001, 9.463787e-001, 9.466985e-001, 9.470183e-001, 9.473382e-001, 9.476580e-001, 9.479778e-001, 9.482966e-001,
+9.486030e-001, 9.489094e-001, 9.492158e-001, 9.495223e-001, 9.498287e-001, 9.501351e-001, 9.504415e-001, 9.507478e-001, 9.510523e-001, 9.513569e-001,
+9.516614e-001, 9.519660e-001, 9.522706e-001, 9.525751e-001, 9.528797e-001, 9.531842e-001, 9.534816e-001, 9.537790e-001, 9.540763e-001, 9.543737e-001,
+9.546710e-001, 9.549684e-001, 9.552657e-001, 9.555630e-001, 9.558495e-001, 9.561336e-001, 9.564176e-001, 9.567017e-001, 9.569857e-001, 9.572698e-001,
+9.575538e-001, 9.578379e-001, 9.581202e-001, 9.584012e-001, 9.586822e-001, 9.589632e-001, 9.592442e-001, 9.595253e-001, 9.598063e-001, 9.600873e-001,
+9.603687e-001, 9.606518e-001, 9.609350e-001, 9.612181e-001, 9.615012e-001, 9.617843e-001, 9.620674e-001, 9.623506e-001, 9.626337e-001, 9.629139e-001,
+9.631932e-001, 9.634725e-001, 9.637518e-001, 9.640312e-001, 9.643105e-001, 9.645898e-001, 9.648691e-001, 9.651449e-001, 9.654085e-001, 9.656722e-001,
+9.659358e-001, 9.661995e-001, 9.664632e-001, 9.667268e-001, 9.669905e-001, 9.672541e-001, 9.675125e-001, 9.677673e-001, 9.680221e-001, 9.682769e-001,
+9.685317e-001, 9.687865e-001, 9.690413e-001, 9.692961e-001, 9.695509e-001, 9.698060e-001, 9.700612e-001, 9.703164e-001, 9.705715e-001, 9.708267e-001,
+9.710819e-001, 9.713371e-001, 9.715922e-001, 9.718468e-001, 9.720928e-001, 9.723388e-001, 9.725848e-001, 9.728308e-001, 9.730768e-001, 9.733228e-001,
+9.735688e-001, 9.738148e-001, 9.740588e-001, 9.742915e-001, 9.745242e-001, 9.747568e-001, 9.749895e-001, 9.752222e-001, 9.754549e-001, 9.756876e-001,
+9.759202e-001, 9.761514e-001, 9.763735e-001, 9.765956e-001, 9.768176e-001, 9.770397e-001, 9.772618e-001, 9.774839e-001, 9.777060e-001, 9.779281e-001,
+9.781497e-001, 9.783595e-001, 9.785694e-001, 9.787792e-001, 9.789891e-001, 9.791989e-001, 9.794088e-001, 9.796186e-001, 9.798285e-001, 9.800383e-001,
+9.802370e-001, 9.804333e-001, 9.806297e-001, 9.808260e-001, 9.810224e-001, 9.812188e-001, 9.814151e-001, 9.816115e-001, 9.818078e-001, 9.819965e-001,
+9.821782e-001, 9.823600e-001, 9.825418e-001, 9.827236e-001, 9.829054e-001, 9.830871e-001, 9.832689e-001, 9.834507e-001, 9.836298e-001, 9.837906e-001,
+9.839513e-001, 9.841120e-001, 9.842728e-001, 9.844335e-001, 9.845943e-001, 9.847550e-001, 9.849157e-001, 9.850765e-001, 9.852262e-001, 9.853692e-001,
+9.855122e-001, 9.856552e-001, 9.857982e-001, 9.859411e-001, 9.860841e-001, 9.862271e-001, 9.863701e-001, 9.865130e-001, 9.866450e-001, 9.867771e-001,
+9.869091e-001, 9.870412e-001, 9.871733e-001, 9.873053e-001, 9.874374e-001, 9.875694e-001, 9.877015e-001, 9.878289e-001, 9.879450e-001, 9.880611e-001,
+9.881773e-001, 9.882934e-001, 9.884095e-001, 9.885257e-001, 9.886418e-001, 9.887579e-001, 9.888741e-001, 9.889798e-001, 9.890742e-001, 9.891685e-001,
+9.892628e-001, 9.893571e-001, 9.894514e-001, 9.895458e-001, 9.896401e-001, 9.897344e-001, 9.898287e-001, 9.899169e-001, 9.900002e-001, 9.900834e-001,
+9.901666e-001, 9.902498e-001, 9.903330e-001, 9.904163e-001, 9.904995e-001, 9.905827e-001, 9.906659e-001, 9.907503e-001, 9.908356e-001, 9.909210e-001,
+9.910064e-001, 9.910918e-001, 9.911772e-001, 9.912626e-001, 9.913480e-001, 9.914334e-001, 9.915187e-001, 9.916055e-001, 9.916944e-001, 9.917834e-001,
+9.918723e-001, 9.919612e-001, 9.920502e-001, 9.921391e-001, 9.922281e-001, 9.923170e-001, 9.924060e-001, 9.924944e-001, 9.925794e-001, 9.926644e-001,
+9.927494e-001, 9.928344e-001, 9.929194e-001, 9.930044e-001, 9.930894e-001, 9.931744e-001, 9.932594e-001, 9.933443e-001, 9.934259e-001, 9.935063e-001,
+9.935868e-001, 9.936672e-001, 9.937477e-001, 9.938281e-001, 9.939086e-001, 9.939890e-001, 9.940694e-001, 9.941499e-001, 9.942312e-001, 9.943148e-001,
+9.943983e-001, 9.944819e-001, 9.945655e-001, 9.946490e-001, 9.947326e-001, 9.948162e-001, 9.948997e-001, 9.949833e-001, 9.950669e-001, 9.951515e-001,
+9.952365e-001, 9.953215e-001, 9.954065e-001, 9.954916e-001, 9.955766e-001, 9.956616e-001, 9.957467e-001, 9.958317e-001, 9.959167e-001, 9.960018e-001,
+9.960865e-001, 9.961712e-001, 9.962559e-001, 9.963406e-001, 9.964253e-001, 9.965100e-001, 9.965947e-001, 9.966794e-001, 9.967641e-001, 9.968488e-001,
+9.969335e-001, 9.970176e-001, 9.971017e-001, 9.971859e-001, 9.972700e-001, 9.973541e-001, 9.974382e-001, 9.975224e-001, 9.976065e-001, 9.976906e-001,
+9.977748e-001, 9.978601e-001, 9.979493e-001, 9.980385e-001, 9.981276e-001, 9.982168e-001, 9.983060e-001, 9.983952e-001, 9.984844e-001, 9.985736e-001,
+9.986627e-001, 9.987519e-001, 9.988439e-001, 9.989490e-001, 9.990541e-001, 9.991592e-001, 9.992643e-001, 9.993694e-001, 9.994745e-001, 9.995796e-001,
+9.996847e-001, 9.997898e-001, 9.998949e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.039562e-004, 4.149732e-004, 6.318853e-004, 8.542882e-004, 1.081915e-003, 1.317279e-003, 1.559076e-003, 1.807468e-003, 2.066103e-003,
+2.332793e-003, 2.608781e-003, 2.890569e-003, 3.183689e-003, 3.491340e-003, 3.809591e-003, 4.136133e-003, 4.467815e-003, 4.807341e-003, 5.155951e-003,
+5.517087e-003, 5.891276e-003, 6.276733e-003, 6.672363e-003, 7.079900e-003, 7.502091e-003, 7.933821e-003, 8.377121e-003, 8.832612e-003, 9.298773e-003,
+9.772532e-003, 1.025465e-002, 1.074957e-002, 1.125783e-002, 1.177902e-002, 1.231267e-002, 1.286129e-002, 1.342342e-002, 1.399970e-002, 1.458768e-002,
+1.518700e-002, 1.580256e-002, 1.643369e-002, 1.708060e-002, 1.774768e-002, 1.842699e-002, 1.912246e-002, 1.983330e-002, 2.056031e-002, 2.129927e-002,
+2.205465e-002, 2.282545e-002, 2.361164e-002, 2.441430e-002, 2.523026e-002, 2.606414e-002, 2.691840e-002, 2.778733e-002, 2.867316e-002, 2.957777e-002,
+3.049729e-002, 3.143306e-002, 3.238690e-002, 3.336020e-002, 3.435284e-002, 3.536106e-002, 3.638449e-002, 3.742445e-002, 3.847748e-002, 3.954603e-002,
+4.063538e-002, 4.174627e-002, 4.287162e-002, 4.401302e-002, 4.517166e-002, 4.634346e-002, 4.752793e-002, 4.872963e-002, 4.995188e-002, 5.119354e-002,
+5.245077e-002, 5.372229e-002, 5.500987e-002, 5.631691e-002, 5.764298e-002, 5.898213e-002, 6.033489e-002, 6.170520e-002, 6.309723e-002, 6.450760e-002,
+6.592971e-002, 6.736070e-002, 6.880408e-002, 7.026525e-002, 7.174605e-002, 7.323949e-002, 7.474260e-002, 7.625603e-002, 7.778183e-002, 7.932041e-002,
+8.086813e-002, 8.242512e-002, 8.399398e-002, 8.557688e-002, 8.717689e-002, 8.878948e-002, 9.041450e-002, 9.205128e-002, 9.369887e-002, 9.535875e-002,
+9.703070e-002, 9.871444e-002, 1.004106e-001, 1.021208e-001, 1.038434e-001, 1.055796e-001, 1.073434e-001, 1.091196e-001, 1.109067e-001, 1.127051e-001,
+1.145213e-001, 1.163516e-001, 1.182034e-001, 1.200675e-001, 1.219405e-001, 1.238283e-001, 1.257332e-001, 1.276490e-001, 1.295825e-001, 1.315266e-001,
+1.334788e-001, 1.354574e-001, 1.374480e-001, 1.394518e-001, 1.414680e-001, 1.434910e-001, 1.455283e-001, 1.475758e-001, 1.496293e-001, 1.517005e-001,
+1.537802e-001, 1.558784e-001, 1.579937e-001, 1.601195e-001, 1.622675e-001, 1.644203e-001, 1.665845e-001, 1.687586e-001, 1.709450e-001, 1.731521e-001,
+1.753689e-001, 1.776115e-001, 1.798598e-001, 1.821342e-001, 1.844156e-001, 1.867152e-001, 1.890224e-001, 1.913392e-001, 1.936642e-001, 1.959953e-001,
+1.983426e-001, 2.006971e-001, 2.030776e-001, 2.054648e-001, 2.078784e-001, 2.102958e-001, 2.127332e-001, 2.151720e-001, 2.176246e-001, 2.200776e-001,
+2.225457e-001, 2.250140e-001, 2.275064e-001, 2.299995e-001, 2.325156e-001, 2.350329e-001, 2.375658e-001, 2.401003e-001, 2.426491e-001, 2.452008e-001,
+2.477629e-001, 2.503289e-001, 2.529033e-001, 2.554831e-001, 2.580694e-001, 2.606629e-001, 2.632612e-001, 2.658706e-001, 2.684814e-001, 2.711029e-001,
+2.737244e-001, 2.763523e-001, 2.789807e-001, 2.816147e-001, 2.842512e-001, 2.868914e-001, 2.895369e-001, 2.921832e-001, 2.948345e-001, 2.974859e-001,
+3.001478e-001, 3.028119e-001, 3.054810e-001, 3.081552e-001, 3.108294e-001, 3.135038e-001, 3.161781e-001, 3.188591e-001, 3.215422e-001, 3.242281e-001,
+3.269194e-001, 3.296107e-001, 3.322994e-001, 3.349879e-001, 3.376731e-001, 3.403542e-001, 3.430353e-001, 3.457180e-001, 3.484009e-001, 3.510806e-001,
+3.537563e-001, 3.564321e-001, 3.591000e-001, 3.617670e-001, 3.644312e-001, 3.670895e-001, 3.697477e-001, 3.723874e-001, 3.750202e-001, 3.776505e-001,
+3.802587e-001, 3.828669e-001, 3.854654e-001, 3.880515e-001, 3.906377e-001, 3.932112e-001, 3.957807e-001, 3.983495e-001, 4.009038e-001, 4.034581e-001,
+4.060050e-001, 4.085351e-001, 4.110653e-001, 4.135863e-001, 4.160992e-001, 4.186122e-001, 4.211214e-001, 4.236292e-001, 4.261370e-001, 4.286366e-001,
+4.311353e-001, 4.336336e-001, 4.361194e-001, 4.386052e-001, 4.410878e-001, 4.435505e-001, 4.460131e-001, 4.484689e-001, 4.508990e-001, 4.533291e-001,
+4.557510e-001, 4.581489e-001, 4.605468e-001, 4.629384e-001, 4.653125e-001, 4.676867e-001, 4.700528e-001, 4.723934e-001, 4.747340e-001, 4.770675e-001,
+4.793699e-001, 4.816723e-001, 4.839723e-001, 4.862492e-001, 4.885262e-001, 4.908031e-001, 4.930541e-001, 4.953045e-001, 4.975549e-001, 4.997824e-001,
+5.020050e-001, 5.042275e-001, 5.064237e-001, 5.086046e-001, 5.107855e-001, 5.129476e-001, 5.150822e-001, 5.172169e-001, 5.193459e-001, 5.214425e-001,
+5.235390e-001, 5.256355e-001, 5.277008e-001, 5.297606e-001, 5.318204e-001, 5.338671e-001, 5.359018e-001, 5.379365e-001, 5.399680e-001, 5.419825e-001,
+5.439969e-001, 5.460113e-001, 5.480144e-001, 5.500137e-001, 5.520131e-001, 5.540095e-001, 5.559997e-001, 5.579898e-001, 5.599800e-001, 5.619544e-001,
+5.639257e-001, 5.658969e-001, 5.678616e-001, 5.698120e-001, 5.717625e-001, 5.737129e-001, 5.756405e-001, 5.775612e-001, 5.794819e-001, 5.813961e-001,
+5.832801e-001, 5.851641e-001, 5.870480e-001, 5.889141e-001, 5.907651e-001, 5.926162e-001, 5.944672e-001, 5.962750e-001, 5.980766e-001, 5.998782e-001,
+6.016729e-001, 6.034334e-001, 6.051939e-001, 6.069544e-001, 6.087045e-001, 6.104401e-001, 6.121757e-001, 6.139114e-001, 6.156324e-001, 6.173447e-001,
+6.190570e-001, 6.207693e-001, 6.224603e-001, 6.241457e-001, 6.258311e-001, 6.275166e-001, 6.291700e-001, 6.308206e-001, 6.324712e-001, 6.341216e-001,
+6.357386e-001, 6.373555e-001, 6.389724e-001, 6.405878e-001, 6.421717e-001, 6.437557e-001, 6.453396e-001, 6.469222e-001, 6.484759e-001, 6.500297e-001,
+6.515834e-001, 6.531371e-001, 6.546550e-001, 6.561729e-001, 6.576908e-001, 6.592087e-001, 6.606941e-001, 6.621764e-001, 6.636588e-001, 6.651412e-001,
+6.666093e-001, 6.680735e-001, 6.695376e-001, 6.710018e-001, 6.724610e-001, 6.739168e-001, 6.753727e-001, 6.768286e-001, 6.782852e-001, 6.797430e-001,
+6.812009e-001, 6.826587e-001, 6.841160e-001, 6.855689e-001, 6.870219e-001, 6.884749e-001, 6.899279e-001, 6.913648e-001, 6.927976e-001, 6.942305e-001,
+6.956633e-001, 6.970889e-001, 6.985053e-001, 6.999217e-001, 7.013381e-001, 7.027541e-001, 7.041571e-001, 7.055601e-001, 7.069631e-001, 7.083662e-001,
+7.097567e-001, 7.111379e-001, 7.125192e-001, 7.139005e-001, 7.152802e-001, 7.166394e-001, 7.179986e-001, 7.193578e-001, 7.207170e-001, 7.220676e-001,
+7.234103e-001, 7.247529e-001, 7.260956e-001, 7.274382e-001, 7.287702e-001, 7.301012e-001, 7.314322e-001, 7.327632e-001, 7.340888e-001, 7.353992e-001,
+7.367096e-001, 7.380200e-001, 7.393304e-001, 7.406291e-001, 7.419185e-001, 7.432079e-001, 7.444974e-001, 7.457868e-001, 7.470659e-001, 7.483425e-001,
+7.496191e-001, 7.508957e-001, 7.521723e-001, 7.534268e-001, 7.546814e-001, 7.559359e-001, 7.571905e-001, 7.584406e-001, 7.596642e-001, 7.608877e-001,
+7.621112e-001, 7.633348e-001, 7.645513e-001, 7.657446e-001, 7.669378e-001, 7.681311e-001, 7.693244e-001, 7.705098e-001, 7.716736e-001, 7.728374e-001,
+7.740012e-001, 7.751651e-001, 7.763244e-001, 7.774704e-001, 7.786164e-001, 7.797624e-001, 7.809084e-001, 7.820516e-001, 7.831821e-001, 7.843126e-001,
+7.854432e-001, 7.865737e-001, 7.877030e-001, 7.888091e-001, 7.899152e-001, 7.910214e-001, 7.921275e-001, 7.932337e-001, 7.943174e-001, 7.953978e-001,
+7.964781e-001, 7.975585e-001, 7.986389e-001, 7.997054e-001, 8.007637e-001, 8.018221e-001, 8.028805e-001, 8.039388e-001, 8.049922e-001, 8.060358e-001,
+8.070794e-001, 8.081230e-001, 8.091667e-001, 8.102103e-001, 8.112318e-001, 8.122529e-001, 8.132740e-001, 8.142952e-001, 8.153163e-001, 8.163194e-001,
+8.173091e-001, 8.182987e-001, 8.192884e-001, 8.202780e-001, 8.212654e-001, 8.222320e-001, 8.231987e-001, 8.241654e-001, 8.251321e-001, 8.260988e-001,
+8.270537e-001, 8.279998e-001, 8.289459e-001, 8.298920e-001, 8.308381e-001, 8.317842e-001, 8.327032e-001, 8.336217e-001, 8.345402e-001, 8.354587e-001,
+8.363772e-001, 8.372876e-001, 8.381816e-001, 8.390757e-001, 8.399697e-001, 8.408638e-001, 8.417578e-001, 8.426352e-001, 8.435023e-001, 8.443695e-001,
+8.452367e-001, 8.461038e-001, 8.469710e-001, 8.478138e-001, 8.486523e-001, 8.494908e-001, 8.503292e-001, 8.511677e-001, 8.520058e-001, 8.528186e-001,
+8.536313e-001, 8.544440e-001, 8.552567e-001, 8.560694e-001, 8.568791e-001, 8.576658e-001, 8.584525e-001, 8.592392e-001, 8.600259e-001, 8.608126e-001,
+8.615955e-001, 8.623575e-001, 8.631194e-001, 8.638814e-001, 8.646434e-001, 8.654053e-001, 8.661652e-001, 8.669109e-001, 8.676565e-001, 8.684021e-001,
+8.691478e-001, 8.698934e-001, 8.706385e-001, 8.713684e-001, 8.720982e-001, 8.728280e-001, 8.735578e-001, 8.742876e-001, 8.750174e-001, 8.757198e-001,
+8.764182e-001, 8.771166e-001, 8.778150e-001, 8.785135e-001, 8.792119e-001, 8.798919e-001, 8.805619e-001, 8.812319e-001, 8.819020e-001, 8.825720e-001,
+8.832420e-001, 8.839061e-001, 8.845594e-001, 8.852127e-001, 8.858660e-001, 8.865194e-001, 8.871727e-001, 8.878260e-001, 8.884590e-001, 8.890919e-001,
+8.897248e-001, 8.903577e-001, 8.909907e-001, 8.916236e-001, 8.922483e-001, 8.928668e-001, 8.934854e-001, 8.941039e-001, 8.947224e-001, 8.953409e-001,
+8.959586e-001, 8.965658e-001, 8.971729e-001, 8.977800e-001, 8.983872e-001, 8.989943e-001, 8.996015e-001, 9.001982e-001, 9.007844e-001, 9.013706e-001,
+9.019568e-001, 9.025430e-001, 9.031292e-001, 9.037154e-001, 9.042839e-001, 9.048495e-001, 9.054150e-001, 9.059805e-001, 9.065460e-001, 9.071116e-001,
+9.076751e-001, 9.082267e-001, 9.087783e-001, 9.093299e-001, 9.098815e-001, 9.104331e-001, 9.109847e-001, 9.115308e-001, 9.120669e-001, 9.126030e-001,
+9.131391e-001, 9.136751e-001, 9.142112e-001, 9.147473e-001, 9.152769e-001, 9.157999e-001, 9.163230e-001, 9.168460e-001, 9.173690e-001, 9.178920e-001,
+9.184150e-001, 9.189338e-001, 9.194491e-001, 9.199644e-001, 9.204797e-001, 9.209951e-001, 9.215104e-001, 9.220257e-001, 9.225335e-001, 9.230351e-001,
+9.235368e-001, 9.240384e-001, 9.245400e-001, 9.250417e-001, 9.255433e-001, 9.260322e-001, 9.265064e-001, 9.269807e-001, 9.274549e-001, 9.279291e-001,
+9.284034e-001, 9.288776e-001, 9.293446e-001, 9.297950e-001, 9.302454e-001, 9.306958e-001, 9.311462e-001, 9.315966e-001, 9.320470e-001, 9.324962e-001,
+9.329272e-001, 9.333582e-001, 9.337892e-001, 9.342203e-001, 9.346513e-001, 9.350823e-001, 9.355134e-001, 9.359328e-001, 9.363483e-001, 9.367639e-001,
+9.371794e-001, 9.375949e-001, 9.380104e-001, 9.384259e-001, 9.388350e-001, 9.392321e-001, 9.396291e-001, 9.400262e-001, 9.404232e-001, 9.408203e-001,
+9.412173e-001, 9.416144e-001, 9.419872e-001, 9.423564e-001, 9.427255e-001, 9.430947e-001, 9.434638e-001, 9.438330e-001, 9.442021e-001, 9.445647e-001,
+9.449127e-001, 9.452607e-001, 9.456086e-001, 9.459566e-001, 9.463046e-001, 9.466526e-001, 9.470005e-001, 9.473390e-001, 9.476728e-001, 9.480066e-001,
+9.483404e-001, 9.486742e-001, 9.490080e-001, 9.493418e-001, 9.496756e-001, 9.499998e-001, 9.503236e-001, 9.506473e-001, 9.509710e-001, 9.512947e-001,
+9.516185e-001, 9.519422e-001, 9.522647e-001, 9.525792e-001, 9.528937e-001, 9.532083e-001, 9.535228e-001, 9.538374e-001, 9.541519e-001, 9.544664e-001,
+9.547756e-001, 9.550681e-001, 9.553607e-001, 9.556532e-001, 9.559457e-001, 9.562382e-001, 9.565308e-001, 9.568233e-001, 9.571123e-001, 9.573917e-001,
+9.576711e-001, 9.579505e-001, 9.582299e-001, 9.585093e-001, 9.587887e-001, 9.590681e-001, 9.593475e-001, 9.596265e-001, 9.599055e-001, 9.601845e-001,
+9.604635e-001, 9.607425e-001, 9.610215e-001, 9.613005e-001, 9.615791e-001, 9.618505e-001, 9.621219e-001, 9.623933e-001, 9.626647e-001, 9.629361e-001,
+9.632075e-001, 9.634789e-001, 9.637503e-001, 9.640164e-001, 9.642812e-001, 9.645460e-001, 9.648108e-001, 9.650756e-001, 9.653404e-001, 9.656052e-001,
+9.658700e-001, 9.661341e-001, 9.663974e-001, 9.666608e-001, 9.669242e-001, 9.671875e-001, 9.674509e-001, 9.677142e-001, 9.679776e-001, 9.682407e-001,
+9.685001e-001, 9.687595e-001, 9.690188e-001, 9.692782e-001, 9.695376e-001, 9.697969e-001, 9.700563e-001, 9.703156e-001, 9.705702e-001, 9.708209e-001,
+9.710716e-001, 9.713223e-001, 9.715730e-001, 9.718237e-001, 9.720744e-001, 9.723251e-001, 9.725757e-001, 9.728142e-001, 9.730519e-001, 9.732896e-001,
+9.735273e-001, 9.737651e-001, 9.740028e-001, 9.742405e-001, 9.744782e-001, 9.747122e-001, 9.749349e-001, 9.751575e-001, 9.753802e-001, 9.756028e-001,
+9.758255e-001, 9.760482e-001, 9.762708e-001, 9.764935e-001, 9.767107e-001, 9.769215e-001, 9.771322e-001, 9.773430e-001, 9.775538e-001, 9.777646e-001,
+9.779753e-001, 9.781861e-001, 9.783969e-001, 9.786027e-001, 9.788047e-001, 9.790067e-001, 9.792087e-001, 9.794108e-001, 9.796128e-001, 9.798148e-001,
+9.800168e-001, 9.802188e-001, 9.804111e-001, 9.805965e-001, 9.807819e-001, 9.809673e-001, 9.811527e-001, 9.813381e-001, 9.815235e-001, 9.817089e-001,
+9.818943e-001, 9.820705e-001, 9.822378e-001, 9.824051e-001, 9.825724e-001, 9.827397e-001, 9.829071e-001, 9.830744e-001, 9.832417e-001, 9.834090e-001,
+9.835722e-001, 9.837270e-001, 9.838818e-001, 9.840366e-001, 9.841914e-001, 9.843462e-001, 9.845011e-001, 9.846559e-001, 9.848107e-001, 9.849649e-001,
+9.851077e-001, 9.852505e-001, 9.853933e-001, 9.855362e-001, 9.856790e-001, 9.858218e-001, 9.859646e-001, 9.861074e-001, 9.862502e-001, 9.863816e-001,
+9.865074e-001, 9.866332e-001, 9.867590e-001, 9.868848e-001, 9.870106e-001, 9.871364e-001, 9.872622e-001, 9.873880e-001, 9.875095e-001, 9.876127e-001,
+9.877159e-001, 9.878190e-001, 9.879222e-001, 9.880254e-001, 9.881286e-001, 9.882318e-001, 9.883350e-001, 9.884382e-001, 9.885315e-001, 9.886184e-001,
+9.887053e-001, 9.887922e-001, 9.888791e-001, 9.889660e-001, 9.890529e-001, 9.891398e-001, 9.892267e-001, 9.893135e-001, 9.893946e-001, 9.894751e-001,
+9.895556e-001, 9.896361e-001, 9.897166e-001, 9.897971e-001, 9.898777e-001, 9.899582e-001, 9.900387e-001, 9.901186e-001, 9.901948e-001, 9.902710e-001,
+9.903472e-001, 9.904234e-001, 9.904996e-001, 9.905758e-001, 9.906520e-001, 9.907282e-001, 9.908044e-001, 9.908796e-001, 9.909515e-001, 9.910233e-001,
+9.910952e-001, 9.911670e-001, 9.912389e-001, 9.913107e-001, 9.913826e-001, 9.914544e-001, 9.915262e-001, 9.915975e-001, 9.916665e-001, 9.917355e-001,
+9.918045e-001, 9.918735e-001, 9.919425e-001, 9.920115e-001, 9.920805e-001, 9.921496e-001, 9.922186e-001, 9.922881e-001, 9.923617e-001, 9.924354e-001,
+9.925091e-001, 9.925827e-001, 9.926564e-001, 9.927300e-001, 9.928037e-001, 9.928774e-001, 9.929510e-001, 9.930247e-001, 9.931048e-001, 9.931857e-001,
+9.932667e-001, 9.933476e-001, 9.934285e-001, 9.935095e-001, 9.935904e-001, 9.936713e-001, 9.937523e-001, 9.938332e-001, 9.939159e-001, 9.940001e-001,
+9.940843e-001, 9.941684e-001, 9.942526e-001, 9.943367e-001, 9.944209e-001, 9.945051e-001, 9.945892e-001, 9.946734e-001, 9.947574e-001, 9.948405e-001,
+9.949236e-001, 9.950067e-001, 9.950898e-001, 9.951729e-001, 9.952560e-001, 9.953391e-001, 9.954222e-001, 9.955053e-001, 9.955884e-001, 9.956673e-001,
+9.957426e-001, 9.958179e-001, 9.958933e-001, 9.959686e-001, 9.960439e-001, 9.961193e-001, 9.961946e-001, 9.962699e-001, 9.963453e-001, 9.964206e-001,
+9.964955e-001, 9.965703e-001, 9.966451e-001, 9.967199e-001, 9.967947e-001, 9.968695e-001, 9.969443e-001, 9.970191e-001, 9.970939e-001, 9.971687e-001,
+9.972440e-001, 9.973254e-001, 9.974068e-001, 9.974881e-001, 9.975695e-001, 9.976508e-001, 9.977322e-001, 9.978136e-001, 9.978949e-001, 9.979763e-001,
+9.980576e-001, 9.981396e-001, 9.982248e-001, 9.983099e-001, 9.983950e-001, 9.984801e-001, 9.985653e-001, 9.986504e-001, 9.987355e-001, 9.988206e-001,
+9.989058e-001, 9.989909e-001, 9.990758e-001, 9.991599e-001, 9.992439e-001, 9.993279e-001, 9.994119e-001, 9.994959e-001, 9.995799e-001, 9.996639e-001,
+9.997480e-001, 9.998320e-001, 9.999160e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.358485e-004, 4.803593e-004, 7.290206e-004, 9.827145e-004, 1.246605e-003, 1.517515e-003, 1.796642e-003, 2.081306e-003, 2.371216e-003,
+2.670146e-003, 2.981706e-003, 3.303322e-003, 3.632662e-003, 3.970196e-003, 4.321793e-003, 4.687744e-003, 5.062749e-003, 5.440758e-003, 5.827206e-003,
+6.221239e-003, 6.627351e-003, 7.046659e-003, 7.476275e-003, 7.911449e-003, 8.353537e-003, 8.804698e-003, 9.265385e-003, 9.734455e-003, 1.021262e-002,
+1.070039e-002, 1.119548e-002, 1.169903e-002, 1.221145e-002, 1.273111e-002, 1.326150e-002, 1.380189e-002, 1.435220e-002, 1.491304e-002, 1.548522e-002,
+1.606847e-002, 1.666031e-002, 1.726539e-002, 1.788046e-002, 1.850507e-002, 1.914214e-002, 1.979056e-002, 2.044911e-002, 2.111437e-002, 2.178798e-002,
+2.246713e-002, 2.315465e-002, 2.384852e-002, 2.454801e-002, 2.525815e-002, 2.597899e-002, 2.671408e-002, 2.746582e-002, 2.823110e-002, 2.901017e-002,
+2.980306e-002, 3.060551e-002, 3.141689e-002, 3.223725e-002, 3.306520e-002, 3.390459e-002, 3.475264e-002, 3.560940e-002, 3.647480e-002, 3.734850e-002,
+3.823473e-002, 3.913403e-002, 4.004486e-002, 4.096301e-002, 4.189137e-002, 4.283293e-002, 4.378317e-002, 4.474061e-002, 4.570805e-002, 4.668581e-002,
+4.767397e-002, 4.867433e-002, 4.968323e-002, 5.070132e-002, 5.173505e-002, 5.277822e-002, 5.383057e-002, 5.489486e-002, 5.597150e-002, 5.705870e-002,
+5.815398e-002, 5.925792e-002, 6.037388e-002, 6.150305e-002, 6.264463e-002, 6.379406e-002, 6.495307e-002, 6.612457e-002, 6.730985e-002, 6.850843e-002,
+6.972335e-002, 7.094878e-002, 7.218477e-002, 7.343310e-002, 7.469519e-002, 7.596871e-002, 7.724812e-002, 7.853548e-002, 7.983217e-002, 8.114162e-002,
+8.246292e-002, 8.379244e-002, 8.512971e-002, 8.647886e-002, 8.784284e-002, 8.921815e-002, 9.060476e-002, 9.200635e-002, 9.341726e-002, 9.483784e-002,
+9.627869e-002, 9.773443e-002, 9.920263e-002, 1.006904e-001, 1.021960e-001, 1.037139e-001, 1.052495e-001, 1.068023e-001, 1.083669e-001, 1.099525e-001,
+1.115524e-001, 1.131627e-001, 1.147976e-001, 1.164445e-001, 1.181051e-001, 1.197828e-001, 1.214681e-001, 1.231684e-001, 1.248829e-001, 1.266062e-001,
+1.283616e-001, 1.301272e-001, 1.319142e-001, 1.337159e-001, 1.355266e-001, 1.373614e-001, 1.392045e-001, 1.410739e-001, 1.429604e-001, 1.448680e-001,
+1.467960e-001, 1.487334e-001, 1.506955e-001, 1.526625e-001, 1.546498e-001, 1.566448e-001, 1.586592e-001, 1.606917e-001, 1.627465e-001, 1.648251e-001,
+1.669203e-001, 1.690407e-001, 1.711711e-001, 1.733302e-001, 1.754958e-001, 1.776868e-001, 1.798808e-001, 1.820942e-001, 1.843085e-001, 1.865466e-001,
+1.887852e-001, 1.910569e-001, 1.933290e-001, 1.956388e-001, 1.979486e-001, 2.002822e-001, 2.026163e-001, 2.049712e-001, 2.073276e-001, 2.097112e-001,
+2.120991e-001, 2.145109e-001, 2.169296e-001, 2.193608e-001, 2.217984e-001, 2.242448e-001, 2.266992e-001, 2.291606e-001, 2.316346e-001, 2.341126e-001,
+2.366094e-001, 2.391062e-001, 2.416251e-001, 2.441448e-001, 2.466782e-001, 2.492165e-001, 2.517606e-001, 2.543110e-001, 2.568640e-001, 2.594281e-001,
+2.619922e-001, 2.645706e-001, 2.671508e-001, 2.697337e-001, 2.723187e-001, 2.749026e-001, 2.774827e-001, 2.800628e-001, 2.826369e-001, 2.852098e-001,
+2.877876e-001, 2.903720e-001, 2.929564e-001, 2.955451e-001, 2.981339e-001, 3.007180e-001, 3.032978e-001, 3.058774e-001, 3.084514e-001, 3.110255e-001,
+3.135906e-001, 3.161478e-001, 3.187050e-001, 3.212369e-001, 3.237685e-001, 3.262920e-001, 3.288042e-001, 3.313164e-001, 3.338195e-001, 3.363206e-001,
+3.388189e-001, 3.413055e-001, 3.437921e-001, 3.462659e-001, 3.487289e-001, 3.511920e-001, 3.536265e-001, 3.560566e-001, 3.584819e-001, 3.608816e-001,
+3.632813e-001, 3.656720e-001, 3.680498e-001, 3.704277e-001, 3.727912e-001, 3.751470e-001, 3.775027e-001, 3.798316e-001, 3.821556e-001, 3.844790e-001,
+3.867709e-001, 3.890627e-001, 3.913498e-001, 3.936109e-001, 3.958719e-001, 3.981298e-001, 4.003788e-001, 4.026277e-001, 4.048694e-001, 4.070971e-001,
+4.093249e-001, 4.115391e-001, 4.137321e-001, 4.159251e-001, 4.181060e-001, 4.202689e-001, 4.224317e-001, 4.245787e-001, 4.266998e-001, 4.288209e-001,
+4.309298e-001, 4.330140e-001, 4.350981e-001, 4.371762e-001, 4.392358e-001, 4.412954e-001, 4.433520e-001, 4.453881e-001, 4.474242e-001, 4.494602e-001,
+4.514681e-001, 4.534753e-001, 4.554825e-001, 4.574632e-001, 4.594367e-001, 4.614103e-001, 4.633643e-001, 4.653035e-001, 4.672427e-001, 4.691695e-001,
+4.710689e-001, 4.729684e-001, 4.748673e-001, 4.767382e-001, 4.786092e-001, 4.804801e-001, 4.823343e-001, 4.841810e-001, 4.860278e-001, 4.878644e-001,
+4.896807e-001, 4.914970e-001, 4.933133e-001, 4.951044e-001, 4.968936e-001, 4.986829e-001, 5.004620e-001, 5.022308e-001, 5.039996e-001, 5.057681e-001,
+5.075238e-001, 5.092795e-001, 5.110352e-001, 5.127811e-001, 5.145177e-001, 5.162543e-001, 5.179908e-001, 5.197012e-001, 5.214105e-001, 5.231198e-001,
+5.248202e-001, 5.265056e-001, 5.281911e-001, 5.298766e-001, 5.315345e-001, 5.331832e-001, 5.348318e-001, 5.364783e-001, 5.381014e-001, 5.397246e-001,
+5.413477e-001, 5.429692e-001, 5.445882e-001, 5.462072e-001, 5.478263e-001, 5.494416e-001, 5.510548e-001, 5.526680e-001, 5.542812e-001, 5.558876e-001,
+5.574928e-001, 5.590980e-001, 5.607027e-001, 5.622802e-001, 5.638578e-001, 5.654353e-001, 5.670078e-001, 5.685514e-001, 5.700950e-001, 5.716386e-001,
+5.731750e-001, 5.746887e-001, 5.762024e-001, 5.777161e-001, 5.792215e-001, 5.807062e-001, 5.821908e-001, 5.836755e-001, 5.851555e-001, 5.866241e-001,
+5.880927e-001, 5.895612e-001, 5.910267e-001, 5.924829e-001, 5.939390e-001, 5.953951e-001, 5.968485e-001, 5.982881e-001, 5.997277e-001, 6.011674e-001,
+6.026062e-001, 6.040264e-001, 6.054466e-001, 6.068668e-001, 6.082870e-001, 6.096944e-001, 6.110998e-001, 6.125053e-001, 6.139107e-001, 6.153100e-001,
+6.167059e-001, 6.181019e-001, 6.194979e-001, 6.208894e-001, 6.222738e-001, 6.236581e-001, 6.250425e-001, 6.264259e-001, 6.277985e-001, 6.291712e-001,
+6.305438e-001, 6.319164e-001, 6.332756e-001, 6.346296e-001, 6.359836e-001, 6.373376e-001, 6.386855e-001, 6.400206e-001, 6.413557e-001, 6.426908e-001,
+6.440259e-001, 6.453584e-001, 6.466905e-001, 6.480226e-001, 6.493547e-001, 6.506858e-001, 6.520152e-001, 6.533447e-001, 6.546741e-001, 6.560036e-001,
+6.573339e-001, 6.586644e-001, 6.599950e-001, 6.613255e-001, 6.626539e-001, 6.639747e-001, 6.652955e-001, 6.666163e-001, 6.679372e-001, 6.692439e-001,
+6.705401e-001, 6.718363e-001, 6.731325e-001, 6.744287e-001, 6.757105e-001, 6.769904e-001, 6.782702e-001, 6.795500e-001, 6.808269e-001, 6.820835e-001,
+6.833401e-001, 6.845966e-001, 6.858532e-001, 6.871013e-001, 6.883319e-001, 6.895624e-001, 6.907930e-001, 6.920236e-001, 6.932477e-001, 6.944645e-001,
+6.956814e-001, 6.968983e-001, 6.981152e-001, 6.993273e-001, 7.005358e-001, 7.017442e-001, 7.029527e-001, 7.041612e-001, 7.053572e-001, 7.065454e-001,
+7.077336e-001, 7.089218e-001, 7.101099e-001, 7.112854e-001, 7.124524e-001, 7.136193e-001, 7.147863e-001, 7.159533e-001, 7.171167e-001, 7.182772e-001,
+7.194376e-001, 7.205980e-001, 7.217584e-001, 7.229158e-001, 7.240688e-001, 7.252219e-001, 7.263749e-001, 7.275279e-001, 7.286770e-001, 7.298131e-001,
+7.309491e-001, 7.320852e-001, 7.332213e-001, 7.343574e-001, 7.354778e-001, 7.365983e-001, 7.377187e-001, 7.388392e-001, 7.399596e-001, 7.410690e-001,
+7.421738e-001, 7.432787e-001, 7.443836e-001, 7.454885e-001, 7.465877e-001, 7.476771e-001, 7.487665e-001, 7.498559e-001, 7.509453e-001, 7.520347e-001,
+7.531047e-001, 7.541739e-001, 7.552432e-001, 7.563124e-001, 7.573817e-001, 7.584378e-001, 7.594808e-001, 7.605238e-001, 7.615668e-001, 7.626097e-001,
+7.636527e-001, 7.646676e-001, 7.656818e-001, 7.666960e-001, 7.677102e-001, 7.687244e-001, 7.697293e-001, 7.707198e-001, 7.717104e-001, 7.727010e-001,
+7.736915e-001, 7.746821e-001, 7.756630e-001, 7.766406e-001, 7.776183e-001, 7.785960e-001, 7.795736e-001, 7.805503e-001, 7.815072e-001, 7.824641e-001,
+7.834209e-001, 7.843778e-001, 7.853347e-001, 7.862827e-001, 7.872080e-001, 7.881333e-001, 7.890586e-001, 7.899839e-001, 7.909092e-001, 7.918231e-001,
+7.927233e-001, 7.936236e-001, 7.945238e-001, 7.954240e-001, 7.963243e-001, 7.972148e-001, 7.980977e-001, 7.989806e-001, 7.998635e-001, 8.007464e-001,
+8.016293e-001, 8.024988e-001, 8.033595e-001, 8.042202e-001, 8.050809e-001, 8.059417e-001, 8.068024e-001, 8.076456e-001, 8.084762e-001, 8.093069e-001,
+8.101375e-001, 8.109682e-001, 8.117989e-001, 8.126195e-001, 8.134301e-001, 8.142406e-001, 8.150512e-001, 8.158618e-001, 8.166724e-001, 8.174801e-001,
+8.182824e-001, 8.190848e-001, 8.198871e-001, 8.206895e-001, 8.214919e-001, 8.222925e-001, 8.230812e-001, 8.238700e-001, 8.246587e-001, 8.254474e-001,
+8.262362e-001, 8.270249e-001, 8.277987e-001, 8.285697e-001, 8.293407e-001, 8.301117e-001, 8.308827e-001, 8.316536e-001, 8.324190e-001, 8.331785e-001,
+8.339379e-001, 8.346974e-001, 8.354569e-001, 8.362163e-001, 8.369745e-001, 8.377141e-001, 8.384537e-001, 8.391933e-001, 8.399328e-001, 8.406724e-001,
+8.414120e-001, 8.421401e-001, 8.428595e-001, 8.435790e-001, 8.442984e-001, 8.450179e-001, 8.457373e-001, 8.464565e-001, 8.471538e-001, 8.478512e-001,
+8.485485e-001, 8.492458e-001, 8.499431e-001, 8.506404e-001, 8.513295e-001, 8.520048e-001, 8.526801e-001, 8.533554e-001, 8.540307e-001, 8.547060e-001,
+8.553813e-001, 8.560461e-001, 8.567056e-001, 8.573652e-001, 8.580248e-001, 8.586843e-001, 8.593439e-001, 8.600035e-001, 8.606566e-001, 8.613089e-001,
+8.619612e-001, 8.626135e-001, 8.632658e-001, 8.639181e-001, 8.645702e-001, 8.652151e-001, 8.658600e-001, 8.665049e-001, 8.671499e-001, 8.677948e-001,
+8.684397e-001, 8.690824e-001, 8.697077e-001, 8.703330e-001, 8.709583e-001, 8.715835e-001, 8.722088e-001, 8.728341e-001, 8.734576e-001, 8.740668e-001,
+8.746760e-001, 8.752852e-001, 8.758944e-001, 8.765036e-001, 8.771128e-001, 8.777215e-001, 8.783164e-001, 8.789112e-001, 8.795061e-001, 8.801010e-001,
+8.806958e-001, 8.812907e-001, 8.818855e-001, 8.824583e-001, 8.830281e-001, 8.835980e-001, 8.841678e-001, 8.847376e-001, 8.853074e-001, 8.858772e-001,
+8.864342e-001, 8.869844e-001, 8.875345e-001, 8.880846e-001, 8.886348e-001, 8.891849e-001, 8.897350e-001, 8.902794e-001, 8.908126e-001, 8.913459e-001,
+8.918791e-001, 8.924124e-001, 8.929456e-001, 8.934788e-001, 8.940121e-001, 8.945347e-001, 8.950567e-001, 8.955787e-001, 8.961007e-001, 8.966228e-001,
+8.971448e-001, 8.976668e-001, 8.981864e-001, 8.987035e-001, 8.992205e-001, 8.997375e-001, 9.002545e-001, 9.007715e-001, 9.012885e-001, 9.018056e-001,
+9.023094e-001, 9.028122e-001, 9.033150e-001, 9.038178e-001, 9.043206e-001, 9.048234e-001, 9.053262e-001, 9.058225e-001, 9.063037e-001, 9.067849e-001,
+9.072661e-001, 9.077473e-001, 9.082284e-001, 9.087096e-001, 9.091908e-001, 9.096608e-001, 9.101228e-001, 9.105848e-001, 9.110468e-001, 9.115088e-001,
+9.119708e-001, 9.124328e-001, 9.128948e-001, 9.133455e-001, 9.137931e-001, 9.142407e-001, 9.146882e-001, 9.151358e-001, 9.155834e-001, 9.160309e-001,
+9.164785e-001, 9.169083e-001, 9.173362e-001, 9.177641e-001, 9.181920e-001, 9.186198e-001, 9.190477e-001, 9.194756e-001, 9.199035e-001, 9.203203e-001,
+9.207364e-001, 9.211525e-001, 9.215685e-001, 9.219846e-001, 9.224006e-001, 9.228167e-001, 9.232328e-001, 9.236451e-001, 9.240568e-001, 9.244686e-001,
+9.248804e-001, 9.252921e-001, 9.257039e-001, 9.261156e-001, 9.265274e-001, 9.269321e-001, 9.273341e-001, 9.277362e-001, 9.281383e-001, 9.285403e-001,
+9.289424e-001, 9.293444e-001, 9.297465e-001, 9.301461e-001, 9.305432e-001, 9.309403e-001, 9.313375e-001, 9.317346e-001, 9.321317e-001, 9.325288e-001,
+9.329260e-001, 9.333215e-001, 9.337097e-001, 9.340978e-001, 9.344860e-001, 9.348742e-001, 9.352624e-001, 9.356506e-001, 9.360388e-001, 9.364270e-001,
+9.368089e-001, 9.371889e-001, 9.375690e-001, 9.379490e-001, 9.383290e-001, 9.387091e-001, 9.390891e-001, 9.394692e-001, 9.398465e-001, 9.402164e-001,
+9.405864e-001, 9.409563e-001, 9.413263e-001, 9.416962e-001, 9.420662e-001, 9.424361e-001, 9.428061e-001, 9.431679e-001, 9.435258e-001, 9.438837e-001,
+9.442416e-001, 9.445996e-001, 9.449575e-001, 9.453154e-001, 9.456733e-001, 9.460312e-001, 9.463843e-001, 9.467372e-001, 9.470902e-001, 9.474431e-001,
+9.477961e-001, 9.481490e-001, 9.485020e-001, 9.488550e-001, 9.492065e-001, 9.495525e-001, 9.498985e-001, 9.502445e-001, 9.505905e-001, 9.509365e-001,
+9.512825e-001, 9.516285e-001, 9.519745e-001, 9.523156e-001, 9.526465e-001, 9.529774e-001, 9.533084e-001, 9.536393e-001, 9.539703e-001, 9.543012e-001,
+9.546322e-001, 9.549631e-001, 9.552908e-001, 9.556128e-001, 9.559348e-001, 9.562568e-001, 9.565788e-001, 9.569008e-001, 9.572228e-001, 9.575447e-001,
+9.578667e-001, 9.581861e-001, 9.584988e-001, 9.588116e-001, 9.591243e-001, 9.594371e-001, 9.597498e-001, 9.600626e-001, 9.603753e-001, 9.606881e-001,
+9.609988e-001, 9.612951e-001, 9.615915e-001, 9.618878e-001, 9.621841e-001, 9.624804e-001, 9.627767e-001, 9.630730e-001, 9.633693e-001, 9.636656e-001,
+9.639507e-001, 9.642338e-001, 9.645170e-001, 9.648002e-001, 9.650833e-001, 9.653665e-001, 9.656497e-001, 9.659329e-001, 9.662160e-001, 9.664933e-001,
+9.667643e-001, 9.670353e-001, 9.673063e-001, 9.675773e-001, 9.678484e-001, 9.681194e-001, 9.683904e-001, 9.686614e-001, 9.689321e-001, 9.691805e-001,
+9.694290e-001, 9.696774e-001, 9.699258e-001, 9.701743e-001, 9.704227e-001, 9.706712e-001, 9.709196e-001, 9.711681e-001, 9.714097e-001, 9.716426e-001,
+9.718756e-001, 9.721086e-001, 9.723416e-001, 9.725745e-001, 9.728075e-001, 9.730405e-001, 9.732735e-001, 9.735064e-001, 9.737378e-001, 9.739686e-001,
+9.741995e-001, 9.744303e-001, 9.746612e-001, 9.748920e-001, 9.751229e-001, 9.753538e-001, 9.755846e-001, 9.758155e-001, 9.760392e-001, 9.762627e-001,
+9.764863e-001, 9.767099e-001, 9.769335e-001, 9.771571e-001, 9.773807e-001, 9.776043e-001, 9.778279e-001, 9.780503e-001, 9.782622e-001, 9.784741e-001,
+9.786860e-001, 9.788979e-001, 9.791098e-001, 9.793217e-001, 9.795336e-001, 9.797455e-001, 9.799574e-001, 9.801695e-001, 9.803834e-001, 9.805972e-001,
+9.808110e-001, 9.810249e-001, 9.812387e-001, 9.814525e-001, 9.816664e-001, 9.818802e-001, 9.820940e-001, 9.823078e-001, 9.825233e-001, 9.827388e-001,
+9.829543e-001, 9.831698e-001, 9.833853e-001, 9.836008e-001, 9.838163e-001, 9.840318e-001, 9.842473e-001, 9.844627e-001, 9.846641e-001, 9.848615e-001,
+9.850590e-001, 9.852565e-001, 9.854540e-001, 9.856515e-001, 9.858490e-001, 9.860465e-001, 9.862440e-001, 9.864415e-001, 9.866344e-001, 9.868219e-001,
+9.870094e-001, 9.871969e-001, 9.873844e-001, 9.875720e-001, 9.877595e-001, 9.879470e-001, 9.881345e-001, 9.883221e-001, 9.885097e-001, 9.887015e-001,
+9.888934e-001, 9.890852e-001, 9.892770e-001, 9.894688e-001, 9.896607e-001, 9.898525e-001, 9.900443e-001, 9.902361e-001, 9.904280e-001, 9.906189e-001,
+9.908090e-001, 9.909991e-001, 9.911892e-001, 9.913793e-001, 9.915694e-001, 9.917595e-001, 9.919496e-001, 9.921397e-001, 9.923298e-001, 9.925199e-001,
+9.927044e-001, 9.928878e-001, 9.930711e-001, 9.932544e-001, 9.934378e-001, 9.936211e-001, 9.938044e-001, 9.939878e-001, 9.941711e-001, 9.943544e-001,
+9.945375e-001, 9.947145e-001, 9.948914e-001, 9.950683e-001, 9.952453e-001, 9.954222e-001, 9.955992e-001, 9.957761e-001, 9.959531e-001, 9.961300e-001,
+9.963069e-001, 9.964826e-001, 9.966511e-001, 9.968195e-001, 9.969879e-001, 9.971563e-001, 9.973248e-001, 9.974932e-001, 9.976616e-001, 9.978300e-001,
+9.979985e-001, 9.981669e-001, 9.983331e-001, 9.984846e-001, 9.986361e-001, 9.987877e-001, 9.989392e-001, 9.990908e-001, 9.992423e-001, 9.993938e-001,
+9.995454e-001, 9.996969e-001, 9.998485e-001, 1.000000e+000)),
+("Kodak", "Kodachrome 25", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.187211e-004, 2.416660e-004, 3.686174e-004, 4.986166e-004, 6.320932e-004, 7.689670e-004, 9.098884e-004, 1.054624e-003, 1.205652e-003,
+1.361079e-003, 1.521024e-003, 1.685764e-003, 1.855514e-003, 2.030058e-003, 2.207898e-003, 2.391601e-003, 2.580537e-003, 2.774060e-003, 2.972226e-003,
+3.175339e-003, 3.384509e-003, 3.601367e-003, 3.823560e-003, 4.051276e-003, 4.287023e-003, 4.529445e-003, 4.779119e-003, 5.035790e-003, 5.297516e-003,
+5.564759e-003, 5.840144e-003, 6.125182e-003, 6.419008e-003, 6.720825e-003, 7.029875e-003, 7.346538e-003, 7.671576e-003, 8.004527e-003, 8.345776e-003,
+8.694119e-003, 9.048196e-003, 9.409458e-003, 9.779725e-003, 1.016044e-002, 1.055088e-002, 1.095014e-002, 1.135729e-002, 1.177291e-002, 1.219644e-002,
+1.262601e-002, 1.306270e-002, 1.350765e-002, 1.396069e-002, 1.442030e-002, 1.488660e-002, 1.536071e-002, 1.584376e-002, 1.633647e-002, 1.683592e-002,
+1.734424e-002, 1.786082e-002, 1.838829e-002, 1.892357e-002, 1.946647e-002, 2.001626e-002, 2.057523e-002, 2.114292e-002, 2.171751e-002, 2.229722e-002,
+2.288218e-002, 2.347327e-002, 2.407139e-002, 2.467745e-002, 2.529234e-002, 2.591658e-002, 2.654820e-002, 2.718854e-002, 2.783725e-002, 2.849566e-002,
+2.916313e-002, 2.983646e-002, 3.051979e-002, 3.121134e-002, 3.191309e-002, 3.262394e-002, 3.334177e-002, 3.406902e-002, 3.479891e-002, 3.553094e-002,
+3.626545e-002, 3.700430e-002, 3.775000e-002, 3.850231e-002, 3.926121e-002, 4.002778e-002, 4.080115e-002, 4.157797e-002, 4.235753e-002, 4.314313e-002,
+4.393456e-002, 4.473057e-002, 4.553116e-002, 4.633864e-002, 4.715224e-002, 4.797474e-002, 4.881123e-002, 4.965664e-002, 5.051356e-002, 5.138704e-002,
+5.226483e-002, 5.314540e-002, 5.403097e-002, 5.492041e-002, 5.581799e-002, 5.672578e-002, 5.763988e-002, 5.856797e-002, 5.950328e-002, 6.044661e-002,
+6.140231e-002, 6.236216e-002, 6.332945e-002, 6.430184e-002, 6.527834e-002, 6.626182e-002, 6.724770e-002, 6.823983e-002, 6.923777e-002, 7.024222e-002,
+7.125992e-002, 7.228225e-002, 7.332317e-002, 7.436733e-002, 7.542223e-002, 7.648206e-002, 7.754831e-002, 7.861944e-002, 7.969346e-002, 8.077455e-002,
+8.185738e-002, 8.295743e-002, 8.406001e-002, 8.518037e-002, 8.630372e-002, 8.743897e-002, 8.857842e-002, 8.972801e-002, 9.088300e-002, 9.204737e-002,
+9.321818e-002, 9.439802e-002, 9.558196e-002, 9.677101e-002, 9.796457e-002, 9.916356e-002, 1.003676e-001, 1.015782e-001, 1.027940e-001, 1.040176e-001,
+1.052479e-001, 1.064908e-001, 1.077374e-001, 1.089941e-001, 1.102523e-001, 1.115182e-001, 1.127844e-001, 1.140556e-001, 1.153268e-001, 1.166016e-001,
+1.178767e-001, 1.191576e-001, 1.204407e-001, 1.217328e-001, 1.230328e-001, 1.243387e-001, 1.256576e-001, 1.269775e-001, 1.283123e-001, 1.296471e-001,
+1.309921e-001, 1.323397e-001, 1.336949e-001, 1.350574e-001, 1.364232e-001, 1.378029e-001, 1.391826e-001, 1.405749e-001, 1.419695e-001, 1.433696e-001,
+1.447756e-001, 1.461827e-001, 1.476010e-001, 1.490193e-001, 1.504456e-001, 1.518757e-001, 1.533089e-001, 1.547531e-001, 1.561972e-001, 1.576559e-001,
+1.591195e-001, 1.605871e-001, 1.620667e-001, 1.635463e-001, 1.650296e-001, 1.665142e-001, 1.680004e-001, 1.694939e-001, 1.709874e-001, 1.724853e-001,
+1.739861e-001, 1.754870e-001, 1.769934e-001, 1.784998e-001, 1.800076e-001, 1.815180e-001, 1.830283e-001, 1.845443e-001, 1.860629e-001, 1.875816e-001,
+1.891086e-001, 1.906357e-001, 1.921654e-001, 1.937022e-001, 1.952390e-001, 1.967843e-001, 1.983377e-001, 1.998911e-001, 2.014496e-001, 2.030101e-001,
+2.045706e-001, 2.061385e-001, 2.077072e-001, 2.092769e-001, 2.108619e-001, 2.124470e-001, 2.140338e-001, 2.156284e-001, 2.172230e-001, 2.188205e-001,
+2.204252e-001, 2.220299e-001, 2.236386e-001, 2.252546e-001, 2.268707e-001, 2.284910e-001, 2.301183e-001, 2.317456e-001, 2.333762e-001, 2.350125e-001,
+2.366487e-001, 2.382875e-001, 2.399312e-001, 2.415750e-001, 2.432213e-001, 2.448745e-001, 2.465276e-001, 2.481831e-001, 2.498494e-001, 2.515156e-001,
+2.531823e-001, 2.548569e-001, 2.565315e-001, 2.582061e-001, 2.598899e-001, 2.615750e-001, 2.632601e-001, 2.649541e-001, 2.666525e-001, 2.683509e-001,
+2.700531e-001, 2.717602e-001, 2.734673e-001, 2.751759e-001, 2.768929e-001, 2.786100e-001, 2.803270e-001, 2.820505e-001, 2.837753e-001, 2.855000e-001,
+2.872274e-001, 2.889575e-001, 2.906876e-001, 2.924185e-001, 2.941546e-001, 2.958907e-001, 2.976269e-001, 2.993661e-001, 3.011066e-001, 3.028471e-001,
+3.045875e-001, 3.063274e-001, 3.080672e-001, 3.098071e-001, 3.115399e-001, 3.132705e-001, 3.150011e-001, 3.167326e-001, 3.184674e-001, 3.202022e-001,
+3.219370e-001, 3.236667e-001, 3.253937e-001, 3.271207e-001, 3.288466e-001, 3.305548e-001, 3.322629e-001, 3.339710e-001, 3.356797e-001, 3.373891e-001,
+3.390985e-001, 3.408079e-001, 3.425270e-001, 3.442499e-001, 3.459727e-001, 3.476956e-001, 3.494233e-001, 3.511510e-001, 3.528788e-001, 3.546074e-001,
+3.563389e-001, 3.580704e-001, 3.598020e-001, 3.615403e-001, 3.632878e-001, 3.650353e-001, 3.667827e-001, 3.685362e-001, 3.702941e-001, 3.720519e-001,
+3.738098e-001, 3.755826e-001, 3.773621e-001, 3.791416e-001, 3.809211e-001, 3.827107e-001, 3.845036e-001, 3.862965e-001, 3.880894e-001, 3.898767e-001,
+3.916624e-001, 3.934481e-001, 3.952338e-001, 3.970318e-001, 3.988335e-001, 4.006352e-001, 4.024369e-001, 4.042539e-001, 4.060774e-001, 4.079009e-001,
+4.097244e-001, 4.115552e-001, 4.133910e-001, 4.152267e-001, 4.170625e-001, 4.189002e-001, 4.207402e-001, 4.225801e-001, 4.244201e-001, 4.262587e-001,
+4.280927e-001, 4.299268e-001, 4.317609e-001, 4.335948e-001, 4.354150e-001, 4.372351e-001, 4.390552e-001, 4.408754e-001, 4.426894e-001, 4.445011e-001,
+4.463127e-001, 4.481244e-001, 4.499398e-001, 4.517613e-001, 4.535827e-001, 4.554042e-001, 4.572256e-001, 4.590498e-001, 4.608739e-001, 4.626981e-001,
+4.645222e-001, 4.663370e-001, 4.681450e-001, 4.699530e-001, 4.717609e-001, 4.735681e-001, 4.753684e-001, 4.771686e-001, 4.789688e-001, 4.807690e-001,
+4.825682e-001, 4.843666e-001, 4.861650e-001, 4.879634e-001, 4.897617e-001, 4.915564e-001, 4.933511e-001, 4.951457e-001, 4.969404e-001, 4.987324e-001,
+5.005198e-001, 5.023073e-001, 5.040948e-001, 5.058822e-001, 5.076613e-001, 5.094368e-001, 5.112123e-001, 5.129878e-001, 5.147633e-001, 5.165187e-001,
+5.182737e-001, 5.200287e-001, 5.217838e-001, 5.235413e-001, 5.253082e-001, 5.270751e-001, 5.288420e-001, 5.306090e-001, 5.323774e-001, 5.341483e-001,
+5.359192e-001, 5.376901e-001, 5.394610e-001, 5.412336e-001, 5.430079e-001, 5.447822e-001, 5.465565e-001, 5.483308e-001, 5.500997e-001, 5.518644e-001,
+5.536291e-001, 5.553939e-001, 5.571586e-001, 5.589030e-001, 5.606324e-001, 5.623618e-001, 5.640913e-001, 5.658207e-001, 5.675325e-001, 5.692291e-001,
+5.709257e-001, 5.726223e-001, 5.743189e-001, 5.760101e-001, 5.776947e-001, 5.793792e-001, 5.810637e-001, 5.827483e-001, 5.844304e-001, 5.861068e-001,
+5.877831e-001, 5.894595e-001, 5.911359e-001, 5.928110e-001, 5.944728e-001, 5.961346e-001, 5.977965e-001, 5.994583e-001, 6.011201e-001, 6.027657e-001,
+6.044077e-001, 6.060497e-001, 6.076918e-001, 6.093338e-001, 6.109706e-001, 6.126020e-001, 6.142335e-001, 6.158649e-001, 6.174964e-001, 6.191260e-001,
+6.207425e-001, 6.223589e-001, 6.239754e-001, 6.255919e-001, 6.272084e-001, 6.288107e-001, 6.304065e-001, 6.320024e-001, 6.335982e-001, 6.351940e-001,
+6.367835e-001, 6.383459e-001, 6.399083e-001, 6.414707e-001, 6.430331e-001, 6.445955e-001, 6.461373e-001, 6.476673e-001, 6.491974e-001, 6.507274e-001,
+6.522575e-001, 6.537868e-001, 6.552812e-001, 6.567756e-001, 6.582700e-001, 6.597645e-001, 6.612589e-001, 6.627463e-001, 6.642203e-001, 6.656943e-001,
+6.671683e-001, 6.686423e-001, 6.701163e-001, 6.715676e-001, 6.730042e-001, 6.744407e-001, 6.758772e-001, 6.773137e-001, 6.787502e-001, 6.801577e-001,
+6.815580e-001, 6.829584e-001, 6.843587e-001, 6.857591e-001, 6.871594e-001, 6.885199e-001, 6.898779e-001, 6.912358e-001, 6.925938e-001, 6.939518e-001,
+6.953091e-001, 6.966228e-001, 6.979365e-001, 6.992502e-001, 7.005639e-001, 7.018775e-001, 7.031904e-001, 7.044676e-001, 7.057447e-001, 7.070219e-001,
+7.082990e-001, 7.095762e-001, 7.108534e-001, 7.121080e-001, 7.133618e-001, 7.146157e-001, 7.158695e-001, 7.171233e-001, 7.183771e-001, 7.195920e-001,
+7.207997e-001, 7.220074e-001, 7.232151e-001, 7.244229e-001, 7.256306e-001, 7.268121e-001, 7.279800e-001, 7.291478e-001, 7.303156e-001, 7.314835e-001,
+7.326513e-001, 7.338057e-001, 7.349400e-001, 7.360742e-001, 7.372084e-001, 7.383427e-001, 7.394769e-001, 7.406093e-001, 7.417197e-001, 7.428302e-001,
+7.439406e-001, 7.450510e-001, 7.461614e-001, 7.472718e-001, 7.483663e-001, 7.494534e-001, 7.505405e-001, 7.516276e-001, 7.527148e-001, 7.538019e-001,
+7.548861e-001, 7.559603e-001, 7.570344e-001, 7.581086e-001, 7.591827e-001, 7.602569e-001, 7.613310e-001, 7.623906e-001, 7.634438e-001, 7.644969e-001,
+7.655500e-001, 7.666031e-001, 7.676562e-001, 7.687064e-001, 7.697265e-001, 7.707466e-001, 7.717667e-001, 7.727868e-001, 7.738069e-001, 7.748269e-001,
+7.758403e-001, 7.768442e-001, 7.778481e-001, 7.788520e-001, 7.798559e-001, 7.808597e-001, 7.818636e-001, 7.828533e-001, 7.838358e-001, 7.848183e-001,
+7.858009e-001, 7.867834e-001, 7.877659e-001, 7.887484e-001, 7.897031e-001, 7.906527e-001, 7.916023e-001, 7.925519e-001, 7.935015e-001, 7.944511e-001,
+7.954007e-001, 7.963156e-001, 7.972288e-001, 7.981420e-001, 7.990551e-001, 7.999683e-001, 8.008814e-001, 8.017946e-001, 8.026858e-001, 8.035766e-001,
+8.044674e-001, 8.053581e-001, 8.062489e-001, 8.071397e-001, 8.080305e-001, 8.089057e-001, 8.097798e-001, 8.106539e-001, 8.115280e-001, 8.124022e-001,
+8.132763e-001, 8.141504e-001, 8.150118e-001, 8.158703e-001, 8.167289e-001, 8.175874e-001, 8.184460e-001, 8.193045e-001, 8.201630e-001, 8.210127e-001,
+8.218568e-001, 8.227009e-001, 8.235450e-001, 8.243891e-001, 8.252332e-001, 8.260773e-001, 8.269129e-001, 8.277320e-001, 8.285510e-001, 8.293701e-001,
+8.301892e-001, 8.310083e-001, 8.318274e-001, 8.326464e-001, 8.334459e-001, 8.342450e-001, 8.350441e-001, 8.358432e-001, 8.366424e-001, 8.374415e-001,
+8.382406e-001, 8.390304e-001, 8.398124e-001, 8.405945e-001, 8.413766e-001, 8.421586e-001, 8.429407e-001, 8.437227e-001, 8.445037e-001, 8.452533e-001,
+8.460029e-001, 8.467524e-001, 8.475020e-001, 8.482516e-001, 8.490012e-001, 8.497508e-001, 8.504916e-001, 8.512210e-001, 8.519504e-001, 8.526798e-001,
+8.534092e-001, 8.541386e-001, 8.548680e-001, 8.555974e-001, 8.563107e-001, 8.570188e-001, 8.577269e-001, 8.584350e-001, 8.591431e-001, 8.598512e-001,
+8.605592e-001, 8.612673e-001, 8.619577e-001, 8.626479e-001, 8.633381e-001, 8.640283e-001, 8.647185e-001, 8.654087e-001, 8.660989e-001, 8.667852e-001,
+8.674482e-001, 8.681112e-001, 8.687743e-001, 8.694373e-001, 8.701003e-001, 8.707633e-001, 8.714263e-001, 8.720873e-001, 8.727403e-001, 8.733933e-001,
+8.740463e-001, 8.746993e-001, 8.753523e-001, 8.760053e-001, 8.766583e-001, 8.773071e-001, 8.779380e-001, 8.785689e-001, 8.791998e-001, 8.798307e-001,
+8.804616e-001, 8.810925e-001, 8.817234e-001, 8.823524e-001, 8.829598e-001, 8.835673e-001, 8.841748e-001, 8.847822e-001, 8.853897e-001, 8.859972e-001,
+8.866046e-001, 8.872121e-001, 8.877960e-001, 8.883770e-001, 8.889581e-001, 8.895391e-001, 8.901201e-001, 8.907011e-001, 8.912821e-001, 8.918631e-001,
+8.924348e-001, 8.930004e-001, 8.935660e-001, 8.941316e-001, 8.946972e-001, 8.952629e-001, 8.958285e-001, 8.963941e-001, 8.969567e-001, 8.975096e-001,
+8.980625e-001, 8.986153e-001, 8.991682e-001, 8.997210e-001, 9.002739e-001, 9.008268e-001, 9.013796e-001, 9.019127e-001, 9.024398e-001, 9.029669e-001,
+9.034940e-001, 9.040211e-001, 9.045482e-001, 9.050753e-001, 9.056024e-001, 9.061270e-001, 9.066427e-001, 9.071583e-001, 9.076739e-001, 9.081896e-001,
+9.087052e-001, 9.092208e-001, 9.097364e-001, 9.102521e-001, 9.107690e-001, 9.112870e-001, 9.118050e-001, 9.123230e-001, 9.128410e-001, 9.133591e-001,
+9.138771e-001, 9.143951e-001, 9.149131e-001, 9.154274e-001, 9.159409e-001, 9.164544e-001, 9.169679e-001, 9.174814e-001, 9.179949e-001, 9.185084e-001,
+9.190219e-001, 9.195354e-001, 9.200411e-001, 9.205467e-001, 9.210522e-001, 9.215578e-001, 9.220634e-001, 9.225690e-001, 9.230745e-001, 9.235801e-001,
+9.240845e-001, 9.245653e-001, 9.250461e-001, 9.255269e-001, 9.260077e-001, 9.264885e-001, 9.269693e-001, 9.274501e-001, 9.279310e-001, 9.284117e-001,
+9.288892e-001, 9.293668e-001, 9.298443e-001, 9.303218e-001, 9.307994e-001, 9.312769e-001, 9.317544e-001, 9.322319e-001, 9.327095e-001, 9.331723e-001,
+9.336332e-001, 9.340942e-001, 9.345551e-001, 9.350161e-001, 9.354771e-001, 9.359380e-001, 9.363990e-001, 9.368600e-001, 9.373095e-001, 9.377532e-001,
+9.381969e-001, 9.386406e-001, 9.390843e-001, 9.395280e-001, 9.399717e-001, 9.404154e-001, 9.408591e-001, 9.412962e-001, 9.417200e-001, 9.421438e-001,
+9.425676e-001, 9.429914e-001, 9.434152e-001, 9.438390e-001, 9.442628e-001, 9.446866e-001, 9.451105e-001, 9.455275e-001, 9.459439e-001, 9.463602e-001,
+9.467766e-001, 9.471930e-001, 9.476093e-001, 9.480257e-001, 9.484420e-001, 9.488584e-001, 9.492664e-001, 9.496603e-001, 9.500543e-001, 9.504482e-001,
+9.508421e-001, 9.512361e-001, 9.516300e-001, 9.520239e-001, 9.524179e-001, 9.528118e-001, 9.531950e-001, 9.535744e-001, 9.539538e-001, 9.543332e-001,
+9.547126e-001, 9.550919e-001, 9.554713e-001, 9.558507e-001, 9.562301e-001, 9.566095e-001, 9.569787e-001, 9.573479e-001, 9.577171e-001, 9.580864e-001,
+9.584556e-001, 9.588248e-001, 9.591940e-001, 9.595632e-001, 9.599325e-001, 9.602993e-001, 9.606529e-001, 9.610066e-001, 9.613602e-001, 9.617139e-001,
+9.620675e-001, 9.624212e-001, 9.627749e-001, 9.631285e-001, 9.634822e-001, 9.638335e-001, 9.641757e-001, 9.645179e-001, 9.648601e-001, 9.652023e-001,
+9.655445e-001, 9.658866e-001, 9.662288e-001, 9.665710e-001, 9.669132e-001, 9.672524e-001, 9.675733e-001, 9.678941e-001, 9.682150e-001, 9.685358e-001,
+9.688567e-001, 9.691775e-001, 9.694984e-001, 9.698193e-001, 9.701401e-001, 9.704610e-001, 9.707776e-001, 9.710940e-001, 9.714105e-001, 9.717269e-001,
+9.720434e-001, 9.723599e-001, 9.726763e-001, 9.729928e-001, 9.733093e-001, 9.736257e-001, 9.739437e-001, 9.742623e-001, 9.745809e-001, 9.748995e-001,
+9.752182e-001, 9.755368e-001, 9.758554e-001, 9.761740e-001, 9.764927e-001, 9.768113e-001, 9.771254e-001, 9.774290e-001, 9.777325e-001, 9.780361e-001,
+9.783396e-001, 9.786432e-001, 9.789467e-001, 9.792503e-001, 9.795538e-001, 9.798574e-001, 9.801609e-001, 9.804582e-001, 9.807540e-001, 9.810497e-001,
+9.813454e-001, 9.816412e-001, 9.819369e-001, 9.822326e-001, 9.825284e-001, 9.828241e-001, 9.831198e-001, 9.834141e-001, 9.837013e-001, 9.839886e-001,
+9.842758e-001, 9.845630e-001, 9.848503e-001, 9.851375e-001, 9.854248e-001, 9.857120e-001, 9.859992e-001, 9.862865e-001, 9.865727e-001, 9.868577e-001,
+9.871426e-001, 9.874276e-001, 9.877125e-001, 9.879975e-001, 9.882824e-001, 9.885674e-001, 9.888523e-001, 9.891373e-001, 9.894222e-001, 9.896981e-001,
+9.899676e-001, 9.902372e-001, 9.905067e-001, 9.907763e-001, 9.910458e-001, 9.913154e-001, 9.915849e-001, 9.918545e-001, 9.921240e-001, 9.923936e-001,
+9.926525e-001, 9.929051e-001, 9.931576e-001, 9.934101e-001, 9.936627e-001, 9.939152e-001, 9.941678e-001, 9.944203e-001, 9.946728e-001, 9.949254e-001,
+9.951779e-001, 9.954192e-001, 9.956508e-001, 9.958824e-001, 9.961140e-001, 9.963456e-001, 9.965772e-001, 9.968088e-001, 9.970404e-001, 9.972720e-001,
+9.975035e-001, 9.977351e-001, 9.979518e-001, 9.981380e-001, 9.983242e-001, 9.985104e-001, 9.986966e-001, 9.988828e-001, 9.990690e-001, 9.992552e-001,
+9.994414e-001, 9.996276e-001, 9.998138e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.161198e-004, 2.335670e-004, 3.530100e-004, 4.744168e-004, 5.989556e-004, 7.275027e-004, 8.590615e-004, 9.952968e-004, 1.135704e-003,
+1.280496e-003, 1.429037e-003, 1.583130e-003, 1.742354e-003, 1.906822e-003, 2.076701e-003, 2.251187e-003, 2.430183e-003, 2.613400e-003, 2.802272e-003,
+2.998495e-003, 3.200241e-003, 3.407853e-003, 3.621594e-003, 3.840628e-003, 4.066250e-003, 4.297597e-003, 4.534547e-003, 4.778544e-003, 5.028908e-003,
+5.284917e-003, 5.547603e-003, 5.816262e-003, 6.091061e-003, 6.371658e-003, 6.658977e-003, 6.953751e-003, 7.255830e-003, 7.564597e-003, 7.881423e-003,
+8.203689e-003, 8.533077e-003, 8.868975e-003, 9.211406e-003, 9.559568e-003, 9.912071e-003, 1.026940e-002, 1.063359e-002, 1.100589e-002, 1.138463e-002,
+1.177048e-002, 1.216542e-002, 1.256803e-002, 1.297684e-002, 1.339335e-002, 1.381799e-002, 1.425090e-002, 1.469131e-002, 1.513746e-002, 1.558955e-002,
+1.604936e-002, 1.651617e-002, 1.699016e-002, 1.747157e-002, 1.796151e-002, 1.846235e-002, 1.897360e-002, 1.949282e-002, 2.001892e-002, 2.055194e-002,
+2.109297e-002, 2.164187e-002, 2.219739e-002, 2.276003e-002, 2.333120e-002, 2.391119e-002, 2.450176e-002, 2.510280e-002, 2.570915e-002, 2.632287e-002,
+2.694458e-002, 2.757442e-002, 2.821283e-002, 2.886090e-002, 2.951996e-002, 3.018569e-002, 3.085862e-002, 3.153884e-002, 3.222623e-002, 3.292424e-002,
+3.363076e-002, 3.434444e-002, 3.506545e-002, 3.579524e-002, 3.653852e-002, 3.728940e-002, 3.804791e-002, 3.881495e-002, 3.958708e-002, 4.036564e-002,
+4.115068e-002, 4.194366e-002, 4.274404e-002, 4.355088e-002, 4.436447e-002, 4.518859e-002, 4.601803e-002, 4.685292e-002, 4.769843e-002, 4.855150e-002,
+4.941111e-002, 5.028297e-002, 5.116165e-002, 5.204510e-002, 5.293598e-002, 5.383527e-002, 5.474064e-002, 5.565755e-002, 5.657827e-002, 5.750275e-002,
+5.843344e-002, 5.936684e-002, 6.030483e-002, 6.125000e-002, 6.219891e-002, 6.315732e-002, 6.412014e-002, 6.508909e-002, 6.606556e-002, 6.704489e-002,
+6.802950e-002, 6.901810e-002, 7.001390e-002, 7.101758e-002, 7.202588e-002, 7.304629e-002, 7.406996e-002, 7.510567e-002, 7.614161e-002, 7.717799e-002,
+7.821725e-002, 7.925893e-002, 8.030914e-002, 8.136264e-002, 8.242465e-002, 8.348803e-002, 8.456184e-002, 8.563748e-002, 8.672429e-002, 8.781235e-002,
+8.890437e-002, 8.999824e-002, 9.109607e-002, 9.219946e-002, 9.331210e-002, 9.443011e-002, 9.555579e-002, 9.668567e-002, 9.782118e-002, 9.895963e-002,
+1.001021e-001, 1.012484e-001, 1.024007e-001, 1.035558e-001, 1.047164e-001, 1.058802e-001, 1.070527e-001, 1.082268e-001, 1.094080e-001, 1.105892e-001,
+1.117719e-001, 1.129546e-001, 1.141435e-001, 1.153329e-001, 1.165270e-001, 1.177226e-001, 1.189235e-001, 1.201286e-001, 1.213377e-001, 1.225541e-001,
+1.237716e-001, 1.249968e-001, 1.262220e-001, 1.274488e-001, 1.286760e-001, 1.299049e-001, 1.311350e-001, 1.323675e-001, 1.336061e-001, 1.348448e-001,
+1.360921e-001, 1.373401e-001, 1.385940e-001, 1.398522e-001, 1.411113e-001, 1.423743e-001, 1.436372e-001, 1.449093e-001, 1.461840e-001, 1.474615e-001,
+1.487443e-001, 1.500271e-001, 1.513231e-001, 1.526210e-001, 1.539209e-001, 1.552241e-001, 1.565274e-001, 1.578350e-001, 1.591434e-001, 1.604538e-001,
+1.617685e-001, 1.630831e-001, 1.644009e-001, 1.657196e-001, 1.670404e-001, 1.683725e-001, 1.697045e-001, 1.710446e-001, 1.723918e-001, 1.737389e-001,
+1.750913e-001, 1.764444e-001, 1.777989e-001, 1.791589e-001, 1.805190e-001, 1.818804e-001, 1.832433e-001, 1.846062e-001, 1.859743e-001, 1.873443e-001,
+1.887144e-001, 1.900895e-001, 1.914649e-001, 1.928412e-001, 1.942230e-001, 1.956048e-001, 1.969861e-001, 1.983664e-001, 1.997466e-001, 2.011310e-001,
+2.025205e-001, 2.039099e-001, 2.053046e-001, 2.067035e-001, 2.081024e-001, 2.095097e-001, 2.109221e-001, 2.123344e-001, 2.137437e-001, 2.151516e-001,
+2.165594e-001, 2.179677e-001, 2.193763e-001, 2.207849e-001, 2.221989e-001, 2.236157e-001, 2.250326e-001, 2.264544e-001, 2.278796e-001, 2.293048e-001,
+2.307376e-001, 2.321777e-001, 2.336179e-001, 2.350665e-001, 2.365286e-001, 2.379908e-001, 2.394559e-001, 2.409312e-001, 2.424065e-001, 2.438821e-001,
+2.453690e-001, 2.468559e-001, 2.483428e-001, 2.498390e-001, 2.513373e-001, 2.528357e-001, 2.543384e-001, 2.558449e-001, 2.573513e-001, 2.588597e-001,
+2.603741e-001, 2.618885e-001, 2.634029e-001, 2.649247e-001, 2.664471e-001, 2.679696e-001, 2.694909e-001, 2.710113e-001, 2.725317e-001, 2.740520e-001,
+2.755718e-001, 2.770917e-001, 2.786116e-001, 2.801362e-001, 2.816629e-001, 2.831897e-001, 2.847179e-001, 2.862517e-001, 2.877854e-001, 2.893191e-001,
+2.908465e-001, 2.923713e-001, 2.938960e-001, 2.954206e-001, 2.969438e-001, 2.984670e-001, 2.999902e-001, 3.015184e-001, 3.030507e-001, 3.045830e-001,
+3.061152e-001, 3.076441e-001, 3.091727e-001, 3.107013e-001, 3.122313e-001, 3.137655e-001, 3.152998e-001, 3.168340e-001, 3.183681e-001, 3.199021e-001,
+3.214360e-001, 3.229700e-001, 3.245059e-001, 3.260425e-001, 3.275790e-001, 3.291155e-001, 3.306687e-001, 3.322222e-001, 3.337756e-001, 3.353295e-001,
+3.368858e-001, 3.384420e-001, 3.399982e-001, 3.415560e-001, 3.431178e-001, 3.446795e-001, 3.462412e-001, 3.478037e-001, 3.493674e-001, 3.509311e-001,
+3.524948e-001, 3.540600e-001, 3.556275e-001, 3.571951e-001, 3.587626e-001, 3.603334e-001, 3.619092e-001, 3.634850e-001, 3.650608e-001, 3.666354e-001,
+3.682079e-001, 3.697804e-001, 3.713529e-001, 3.729280e-001, 3.745108e-001, 3.760936e-001, 3.776763e-001, 3.792598e-001, 3.808481e-001, 3.824365e-001,
+3.840248e-001, 3.856132e-001, 3.872022e-001, 3.887913e-001, 3.903804e-001, 3.919695e-001, 3.935660e-001, 3.951654e-001, 3.967649e-001, 3.983644e-001,
+3.999700e-001, 4.015835e-001, 4.031969e-001, 4.048104e-001, 4.064253e-001, 4.080508e-001, 4.096763e-001, 4.113018e-001, 4.129273e-001, 4.145581e-001,
+4.161906e-001, 4.178231e-001, 4.194557e-001, 4.210890e-001, 4.227239e-001, 4.243588e-001, 4.259937e-001, 4.276286e-001, 4.292654e-001, 4.309025e-001,
+4.325395e-001, 4.341765e-001, 4.358191e-001, 4.374711e-001, 4.391231e-001, 4.407751e-001, 4.424271e-001, 4.440837e-001, 4.457413e-001, 4.473989e-001,
+4.490565e-001, 4.507141e-001, 4.523720e-001, 4.540298e-001, 4.556876e-001, 4.573454e-001, 4.589950e-001, 4.606380e-001, 4.622809e-001, 4.639238e-001,
+4.655668e-001, 4.672067e-001, 4.688460e-001, 4.704854e-001, 4.721248e-001, 4.737643e-001, 4.754061e-001, 4.770479e-001, 4.786897e-001, 4.803316e-001,
+4.819717e-001, 4.836075e-001, 4.852433e-001, 4.868790e-001, 4.885148e-001, 4.901468e-001, 4.917734e-001, 4.934000e-001, 4.950266e-001, 4.966532e-001,
+4.982693e-001, 4.998747e-001, 5.014801e-001, 5.030854e-001, 5.046908e-001, 5.062917e-001, 5.078886e-001, 5.094854e-001, 5.110823e-001, 5.126792e-001,
+5.142681e-001, 5.158490e-001, 5.174300e-001, 5.190109e-001, 5.205919e-001, 5.221625e-001, 5.237189e-001, 5.252754e-001, 5.268318e-001, 5.283882e-001,
+5.299438e-001, 5.314973e-001, 5.330507e-001, 5.346042e-001, 5.361576e-001, 5.377095e-001, 5.392475e-001, 5.407855e-001, 5.423235e-001, 5.438615e-001,
+5.453994e-001, 5.469250e-001, 5.484485e-001, 5.499719e-001, 5.514954e-001, 5.530188e-001, 5.545320e-001, 5.560369e-001, 5.575418e-001, 5.590467e-001,
+5.605516e-001, 5.620546e-001, 5.635497e-001, 5.650447e-001, 5.665397e-001, 5.680348e-001, 5.695298e-001, 5.710126e-001, 5.724920e-001, 5.739713e-001,
+5.754506e-001, 5.769299e-001, 5.784005e-001, 5.798508e-001, 5.813011e-001, 5.827514e-001, 5.842017e-001, 5.856519e-001, 5.870864e-001, 5.885159e-001,
+5.899454e-001, 5.913749e-001, 5.928044e-001, 5.942305e-001, 5.956394e-001, 5.970483e-001, 5.984573e-001, 5.998662e-001, 6.012751e-001, 6.026799e-001,
+6.040808e-001, 6.054817e-001, 6.068826e-001, 6.082836e-001, 6.096845e-001, 6.110807e-001, 6.124756e-001, 6.138706e-001, 6.152656e-001, 6.166606e-001,
+6.180554e-001, 6.194347e-001, 6.208140e-001, 6.221934e-001, 6.235727e-001, 6.249521e-001, 6.263289e-001, 6.276934e-001, 6.290579e-001, 6.304224e-001,
+6.317869e-001, 6.331513e-001, 6.345125e-001, 6.358645e-001, 6.372164e-001, 6.385684e-001, 6.399203e-001, 6.412723e-001, 6.426153e-001, 6.439368e-001,
+6.452583e-001, 6.465797e-001, 6.479012e-001, 6.492227e-001, 6.505348e-001, 6.518198e-001, 6.531049e-001, 6.543899e-001, 6.556749e-001, 6.569600e-001,
+6.582420e-001, 6.595075e-001, 6.607731e-001, 6.620386e-001, 6.633041e-001, 6.645697e-001, 6.658352e-001, 6.670750e-001, 6.683145e-001, 6.695540e-001,
+6.707935e-001, 6.720330e-001, 6.732724e-001, 6.744793e-001, 6.756756e-001, 6.768719e-001, 6.780682e-001, 6.792645e-001, 6.804608e-001, 6.816481e-001,
+6.828245e-001, 6.840010e-001, 6.851774e-001, 6.863538e-001, 6.875302e-001, 6.887052e-001, 6.898639e-001, 6.910225e-001, 6.921812e-001, 6.933399e-001,
+6.944985e-001, 6.956572e-001, 6.968037e-001, 6.979434e-001, 6.990832e-001, 7.002230e-001, 7.013627e-001, 7.025025e-001, 7.036384e-001, 7.047494e-001,
+7.058605e-001, 7.069716e-001, 7.080827e-001, 7.091938e-001, 7.103049e-001, 7.114004e-001, 7.124834e-001, 7.135664e-001, 7.146494e-001, 7.157323e-001,
+7.168153e-001, 7.178983e-001, 7.189553e-001, 7.200095e-001, 7.210637e-001, 7.221180e-001, 7.231722e-001, 7.242264e-001, 7.252787e-001, 7.263221e-001,
+7.273654e-001, 7.284088e-001, 7.294522e-001, 7.304956e-001, 7.315390e-001, 7.325803e-001, 7.336181e-001, 7.346560e-001, 7.356939e-001, 7.367317e-001,
+7.377696e-001, 7.388075e-001, 7.398343e-001, 7.408507e-001, 7.418671e-001, 7.428835e-001, 7.438999e-001, 7.449164e-001, 7.459328e-001, 7.469387e-001,
+7.479368e-001, 7.489348e-001, 7.499329e-001, 7.509309e-001, 7.519289e-001, 7.529270e-001, 7.539178e-001, 7.549026e-001, 7.558874e-001, 7.568722e-001,
+7.578571e-001, 7.588419e-001, 7.598267e-001, 7.607943e-001, 7.617410e-001, 7.626877e-001, 7.636344e-001, 7.645811e-001, 7.655278e-001, 7.664745e-001,
+7.674121e-001, 7.683262e-001, 7.692403e-001, 7.701544e-001, 7.710685e-001, 7.719825e-001, 7.728966e-001, 7.738102e-001, 7.747034e-001, 7.755967e-001,
+7.764899e-001, 7.773832e-001, 7.782764e-001, 7.791697e-001, 7.800629e-001, 7.809472e-001, 7.818276e-001, 7.827080e-001, 7.835883e-001, 7.844687e-001,
+7.853491e-001, 7.862294e-001, 7.871022e-001, 7.879562e-001, 7.888103e-001, 7.896643e-001, 7.905183e-001, 7.913723e-001, 7.922264e-001, 7.930804e-001,
+7.939235e-001, 7.947638e-001, 7.956042e-001, 7.964445e-001, 7.972848e-001, 7.981252e-001, 7.989655e-001, 7.998054e-001, 8.006436e-001, 8.014818e-001,
+8.023201e-001, 8.031583e-001, 8.039965e-001, 8.048348e-001, 8.056730e-001, 8.065040e-001, 8.073295e-001, 8.081550e-001, 8.089806e-001, 8.098061e-001,
+8.106317e-001, 8.114572e-001, 8.122827e-001, 8.130953e-001, 8.139054e-001, 8.147154e-001, 8.155255e-001, 8.163355e-001, 8.171456e-001, 8.179556e-001,
+8.187654e-001, 8.195549e-001, 8.203443e-001, 8.211338e-001, 8.219232e-001, 8.227127e-001, 8.235022e-001, 8.242916e-001, 8.250802e-001, 8.258610e-001,
+8.266419e-001, 8.274228e-001, 8.282037e-001, 8.289846e-001, 8.297655e-001, 8.305464e-001, 8.313268e-001, 8.321037e-001, 8.328806e-001, 8.336575e-001,
+8.344345e-001, 8.352114e-001, 8.359883e-001, 8.367652e-001, 8.375415e-001, 8.383017e-001, 8.390619e-001, 8.398221e-001, 8.405823e-001, 8.413426e-001,
+8.421028e-001, 8.428630e-001, 8.436232e-001, 8.443627e-001, 8.450993e-001, 8.458358e-001, 8.465723e-001, 8.473088e-001, 8.480454e-001, 8.487819e-001,
+8.495184e-001, 8.502457e-001, 8.509672e-001, 8.516888e-001, 8.524103e-001, 8.531319e-001, 8.538534e-001, 8.545750e-001, 8.552965e-001, 8.560137e-001,
+8.567194e-001, 8.574251e-001, 8.581307e-001, 8.588364e-001, 8.595421e-001, 8.602477e-001, 8.609534e-001, 8.616591e-001, 8.623467e-001, 8.630310e-001,
+8.637152e-001, 8.643995e-001, 8.650837e-001, 8.657680e-001, 8.664522e-001, 8.671365e-001, 8.678160e-001, 8.684851e-001, 8.691542e-001, 8.698232e-001,
+8.704923e-001, 8.711614e-001, 8.718305e-001, 8.724996e-001, 8.731687e-001, 8.738380e-001, 8.745075e-001, 8.751769e-001, 8.758463e-001, 8.765158e-001,
+8.771852e-001, 8.778547e-001, 8.785241e-001, 8.791936e-001, 8.798611e-001, 8.805287e-001, 8.811962e-001, 8.818637e-001, 8.825313e-001, 8.831988e-001,
+8.838664e-001, 8.845339e-001, 8.851995e-001, 8.858562e-001, 8.865130e-001, 8.871697e-001, 8.878264e-001, 8.884831e-001, 8.891398e-001, 8.897965e-001,
+8.904532e-001, 8.911066e-001, 8.917511e-001, 8.923956e-001, 8.930401e-001, 8.936846e-001, 8.943291e-001, 8.949736e-001, 8.956181e-001, 8.962626e-001,
+8.969045e-001, 8.975396e-001, 8.981747e-001, 8.988098e-001, 8.994448e-001, 9.000799e-001, 9.007150e-001, 9.013501e-001, 9.019851e-001, 9.026165e-001,
+9.032307e-001, 9.038449e-001, 9.044591e-001, 9.050733e-001, 9.056875e-001, 9.063017e-001, 9.069159e-001, 9.075301e-001, 9.081443e-001, 9.087434e-001,
+9.093422e-001, 9.099410e-001, 9.105398e-001, 9.111386e-001, 9.117374e-001, 9.123362e-001, 9.129350e-001, 9.135338e-001, 9.141230e-001, 9.147080e-001,
+9.152929e-001, 9.158778e-001, 9.164627e-001, 9.170476e-001, 9.176325e-001, 9.182175e-001, 9.188024e-001, 9.193829e-001, 9.199525e-001, 9.205221e-001,
+9.210917e-001, 9.216613e-001, 9.222309e-001, 9.228005e-001, 9.233701e-001, 9.239397e-001, 9.245093e-001, 9.250700e-001, 9.256283e-001, 9.261865e-001,
+9.267448e-001, 9.273031e-001, 9.278614e-001, 9.284197e-001, 9.289779e-001, 9.295362e-001, 9.300905e-001, 9.306278e-001, 9.311652e-001, 9.317025e-001,
+9.322398e-001, 9.327772e-001, 9.333145e-001, 9.338518e-001, 9.343891e-001, 9.349265e-001, 9.354529e-001, 9.359677e-001, 9.364825e-001, 9.369973e-001,
+9.375121e-001, 9.380269e-001, 9.385417e-001, 9.390564e-001, 9.395712e-001, 9.400860e-001, 9.405860e-001, 9.410789e-001, 9.415717e-001, 9.420645e-001,
+9.425573e-001, 9.430501e-001, 9.435429e-001, 9.440357e-001, 9.445285e-001, 9.450213e-001, 9.455037e-001, 9.459828e-001, 9.464619e-001, 9.469410e-001,
+9.474201e-001, 9.478992e-001, 9.483783e-001, 9.488574e-001, 9.493365e-001, 9.498156e-001, 9.502952e-001, 9.507750e-001, 9.512547e-001, 9.517344e-001,
+9.522142e-001, 9.526939e-001, 9.531736e-001, 9.536534e-001, 9.541331e-001, 9.546129e-001, 9.550943e-001, 9.555769e-001, 9.560596e-001, 9.565422e-001,
+9.570248e-001, 9.575074e-001, 9.579900e-001, 9.584727e-001, 9.589553e-001, 9.594379e-001, 9.599211e-001, 9.604055e-001, 9.608898e-001, 9.613741e-001,
+9.618584e-001, 9.623428e-001, 9.628271e-001, 9.633114e-001, 9.637957e-001, 9.642801e-001, 9.647644e-001, 9.652258e-001, 9.656871e-001, 9.661484e-001,
+9.666097e-001, 9.670710e-001, 9.675323e-001, 9.679936e-001, 9.684549e-001, 9.689162e-001, 9.693775e-001, 9.698340e-001, 9.702862e-001, 9.707384e-001,
+9.711906e-001, 9.716428e-001, 9.720950e-001, 9.725471e-001, 9.729993e-001, 9.734515e-001, 9.739037e-001, 9.743559e-001, 9.748013e-001, 9.752463e-001,
+9.756913e-001, 9.761363e-001, 9.765813e-001, 9.770263e-001, 9.774713e-001, 9.779163e-001, 9.783613e-001, 9.788062e-001, 9.792487e-001, 9.796837e-001,
+9.801186e-001, 9.805535e-001, 9.809884e-001, 9.814233e-001, 9.818582e-001, 9.822932e-001, 9.827281e-001, 9.831630e-001, 9.835979e-001, 9.840263e-001,
+9.844464e-001, 9.848664e-001, 9.852864e-001, 9.857064e-001, 9.861265e-001, 9.865465e-001, 9.869665e-001, 9.873866e-001, 9.878066e-001, 9.882266e-001,
+9.886333e-001, 9.890270e-001, 9.894207e-001, 9.898144e-001, 9.902082e-001, 9.906019e-001, 9.909956e-001, 9.913893e-001, 9.917830e-001, 9.921767e-001,
+9.925704e-001, 9.929419e-001, 9.932870e-001, 9.936322e-001, 9.939773e-001, 9.943225e-001, 9.946676e-001, 9.950128e-001, 9.953579e-001, 9.957031e-001,
+9.960482e-001, 9.963934e-001, 9.967248e-001, 9.970226e-001, 9.973203e-001, 9.976180e-001, 9.979158e-001, 9.982135e-001, 9.985113e-001, 9.988090e-001,
+9.991068e-001, 9.994045e-001, 9.997023e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.305900e-004, 2.639299e-004, 3.996764e-004, 5.390237e-004, 6.801367e-004, 8.226076e-004, 9.674262e-004, 1.114806e-003, 1.265970e-003,
+1.420882e-003, 1.580505e-003, 1.742336e-003, 1.907211e-003, 2.074155e-003, 2.244346e-003, 2.418402e-003, 2.597752e-003, 2.781527e-003, 2.967242e-003,
+3.154851e-003, 3.345428e-003, 3.539337e-003, 3.736538e-003, 3.937096e-003, 4.142457e-003, 4.351931e-003, 4.564096e-003, 4.778545e-003, 4.996931e-003,
+5.218572e-003, 5.445141e-003, 5.676998e-003, 5.913462e-003, 6.154498e-003, 6.401488e-003, 6.652087e-003, 6.907511e-003, 7.168359e-003, 7.434855e-003,
+7.704702e-003, 7.979293e-003, 8.259031e-003, 8.543018e-003, 8.831881e-003, 9.124737e-003, 9.422923e-003, 9.727349e-003, 1.003655e-002, 1.035240e-002,
+1.067311e-002, 1.099907e-002, 1.133012e-002, 1.166581e-002, 1.200678e-002, 1.235534e-002, 1.270893e-002, 1.306586e-002, 1.342721e-002, 1.379408e-002,
+1.416729e-002, 1.454666e-002, 1.493363e-002, 1.532786e-002, 1.572761e-002, 1.613284e-002, 1.654408e-002, 1.696311e-002, 1.738704e-002, 1.781716e-002,
+1.825537e-002, 1.870031e-002, 1.915155e-002, 1.961038e-002, 2.007703e-002, 2.054971e-002, 2.102850e-002, 2.151492e-002, 2.200962e-002, 2.251206e-002,
+2.302172e-002, 2.353930e-002, 2.406528e-002, 2.460025e-002, 2.514466e-002, 2.569622e-002, 2.625386e-002, 2.681816e-002, 2.739080e-002, 2.797028e-002,
+2.855638e-002, 2.914960e-002, 2.975012e-002, 3.035868e-002, 3.097232e-002, 3.159047e-002, 3.221414e-002, 3.284441e-002, 3.348234e-002, 3.412596e-002,
+3.477444e-002, 3.542719e-002, 3.608972e-002, 3.675952e-002, 3.743584e-002, 3.811901e-002, 3.881012e-002, 3.950723e-002, 4.021056e-002, 4.092127e-002,
+4.163506e-002, 4.235205e-002, 4.307744e-002, 4.380909e-002, 4.454591e-002, 4.529024e-002, 4.604138e-002, 4.679795e-002, 4.756429e-002, 4.833604e-002,
+4.911293e-002, 4.990068e-002, 5.069332e-002, 5.149320e-002, 5.229504e-002, 5.309910e-002, 5.391138e-002, 5.472979e-002, 5.555343e-002, 5.638571e-002,
+5.722136e-002, 5.806495e-002, 5.891259e-002, 5.976363e-002, 6.062121e-002, 6.148079e-002, 6.234598e-002, 6.321409e-002, 6.408693e-002, 6.496472e-002,
+6.584547e-002, 6.673185e-002, 6.761971e-002, 6.851618e-002, 6.941499e-002, 7.032133e-002, 7.123138e-002, 7.214696e-002, 7.307098e-002, 7.400196e-002,
+7.494169e-002, 7.588568e-002, 7.683472e-002, 7.778520e-002, 7.874360e-002, 7.970327e-002, 8.067345e-002, 8.164448e-002, 8.262874e-002, 8.361346e-002,
+8.460565e-002, 8.559793e-002, 8.659524e-002, 8.759261e-002, 8.860190e-002, 8.961163e-002, 9.062783e-002, 9.164458e-002, 9.266890e-002, 9.369452e-002,
+9.472363e-002, 9.575382e-002, 9.678772e-002, 9.782360e-002, 9.885968e-002, 9.989593e-002, 1.009350e-001, 1.019791e-001, 1.030249e-001, 1.040780e-001,
+1.051312e-001, 1.061976e-001, 1.072642e-001, 1.083405e-001, 1.094201e-001, 1.105058e-001, 1.115980e-001, 1.126938e-001, 1.138031e-001, 1.149123e-001,
+1.160331e-001, 1.171550e-001, 1.182891e-001, 1.194319e-001, 1.205772e-001, 1.217304e-001, 1.228836e-001, 1.240446e-001, 1.252069e-001, 1.263779e-001,
+1.275596e-001, 1.287415e-001, 1.299324e-001, 1.311234e-001, 1.323246e-001, 1.335338e-001, 1.347435e-001, 1.359594e-001, 1.371753e-001, 1.383930e-001,
+1.396121e-001, 1.408315e-001, 1.420598e-001, 1.432882e-001, 1.445214e-001, 1.457598e-001, 1.469982e-001, 1.482492e-001, 1.495018e-001, 1.507571e-001,
+1.520196e-001, 1.532822e-001, 1.545533e-001, 1.558299e-001, 1.571064e-001, 1.583925e-001, 1.596792e-001, 1.609705e-001, 1.622772e-001, 1.635839e-001,
+1.648987e-001, 1.662220e-001, 1.675452e-001, 1.688794e-001, 1.702178e-001, 1.715561e-001, 1.729073e-001, 1.742596e-001, 1.756128e-001, 1.769745e-001,
+1.783363e-001, 1.797030e-001, 1.810847e-001, 1.824664e-001, 1.838539e-001, 1.852518e-001, 1.866497e-001, 1.880540e-001, 1.894666e-001, 1.908792e-001,
+1.922983e-001, 1.937243e-001, 1.951504e-001, 1.965807e-001, 1.980153e-001, 1.994500e-001, 2.008942e-001, 2.023487e-001, 2.038032e-001, 2.052644e-001,
+2.067341e-001, 2.082037e-001, 2.096809e-001, 2.111717e-001, 2.126624e-001, 2.141568e-001, 2.156627e-001, 2.171685e-001, 2.186763e-001, 2.202026e-001,
+2.217289e-001, 2.232551e-001, 2.247944e-001, 2.263348e-001, 2.278753e-001, 2.294309e-001, 2.309931e-001, 2.325553e-001, 2.341265e-001, 2.357090e-001,
+2.372916e-001, 2.388752e-001, 2.404648e-001, 2.420545e-001, 2.436441e-001, 2.452433e-001, 2.468444e-001, 2.484454e-001, 2.500451e-001, 2.516433e-001,
+2.532414e-001, 2.548404e-001, 2.564507e-001, 2.580610e-001, 2.596713e-001, 2.612848e-001, 2.629001e-001, 2.645154e-001, 2.661319e-001, 2.677548e-001,
+2.693777e-001, 2.710005e-001, 2.726289e-001, 2.742599e-001, 2.758910e-001, 2.775225e-001, 2.791568e-001, 2.807912e-001, 2.824255e-001, 2.840623e-001,
+2.857012e-001, 2.873400e-001, 2.889789e-001, 2.906232e-001, 2.922680e-001, 2.939128e-001, 2.955601e-001, 2.972146e-001, 2.988691e-001, 3.005236e-001,
+3.021857e-001, 3.038539e-001, 3.055221e-001, 3.071903e-001, 3.088661e-001, 3.105436e-001, 3.122211e-001, 3.138988e-001, 3.155812e-001, 3.172636e-001,
+3.189460e-001, 3.206303e-001, 3.223223e-001, 3.240142e-001, 3.257062e-001, 3.274028e-001, 3.291089e-001, 3.308150e-001, 3.325211e-001, 3.342321e-001,
+3.359497e-001, 3.376674e-001, 3.393851e-001, 3.411100e-001, 3.428430e-001, 3.445760e-001, 3.463089e-001, 3.480438e-001, 3.497806e-001, 3.515175e-001,
+3.532544e-001, 3.549941e-001, 3.567375e-001, 3.584810e-001, 3.602244e-001, 3.619695e-001, 3.637175e-001, 3.654656e-001, 3.672137e-001, 3.689667e-001,
+3.707353e-001, 3.725039e-001, 3.742724e-001, 3.760411e-001, 3.778105e-001, 3.795798e-001, 3.813492e-001, 3.831186e-001, 3.848997e-001, 3.866828e-001,
+3.884659e-001, 3.902489e-001, 3.920352e-001, 3.938237e-001, 3.956122e-001, 3.974006e-001, 3.991901e-001, 4.009820e-001, 4.027738e-001, 4.045657e-001,
+4.063575e-001, 4.081601e-001, 4.099634e-001, 4.117667e-001, 4.135700e-001, 4.153786e-001, 4.171918e-001, 4.190050e-001, 4.208182e-001, 4.226312e-001,
+4.244415e-001, 4.262518e-001, 4.280620e-001, 4.298723e-001, 4.316802e-001, 4.334865e-001, 4.352927e-001, 4.370990e-001, 4.389046e-001, 4.406982e-001,
+4.424919e-001, 4.442855e-001, 4.460792e-001, 4.478673e-001, 4.496487e-001, 4.514302e-001, 4.532116e-001, 4.549931e-001, 4.567654e-001, 4.585355e-001,
+4.603056e-001, 4.620758e-001, 4.638450e-001, 4.656073e-001, 4.673697e-001, 4.691320e-001, 4.708943e-001, 4.726508e-001, 4.743974e-001, 4.761439e-001,
+4.778904e-001, 4.796369e-001, 4.813723e-001, 4.830994e-001, 4.848264e-001, 4.865534e-001, 4.882805e-001, 4.900054e-001, 4.917295e-001, 4.934537e-001,
+4.951778e-001, 4.969019e-001, 4.986188e-001, 5.003340e-001, 5.020492e-001, 5.037645e-001, 5.054797e-001, 5.071663e-001, 5.088485e-001, 5.105306e-001,
+5.122128e-001, 5.138949e-001, 5.155733e-001, 5.172511e-001, 5.189288e-001, 5.206066e-001, 5.222843e-001, 5.239500e-001, 5.256125e-001, 5.272751e-001,
+5.289376e-001, 5.306001e-001, 5.322603e-001, 5.339193e-001, 5.355783e-001, 5.372374e-001, 5.388964e-001, 5.405500e-001, 5.421981e-001, 5.438463e-001,
+5.454945e-001, 5.471427e-001, 5.487864e-001, 5.504183e-001, 5.520502e-001, 5.536820e-001, 5.553139e-001, 5.569457e-001, 5.585567e-001, 5.601673e-001,
+5.617778e-001, 5.633884e-001, 5.649990e-001, 5.666050e-001, 5.682083e-001, 5.698117e-001, 5.714150e-001, 5.730183e-001, 5.746159e-001, 5.761947e-001,
+5.777735e-001, 5.793524e-001, 5.809312e-001, 5.825100e-001, 5.840648e-001, 5.856127e-001, 5.871606e-001, 5.887084e-001, 5.902563e-001, 5.917943e-001,
+5.933035e-001, 5.948127e-001, 5.963220e-001, 5.978312e-001, 5.993404e-001, 6.008219e-001, 6.022902e-001, 6.037584e-001, 6.052266e-001, 6.066949e-001,
+6.081615e-001, 6.095843e-001, 6.110070e-001, 6.124297e-001, 6.138524e-001, 6.152751e-001, 6.166885e-001, 6.180831e-001, 6.194776e-001, 6.208722e-001,
+6.222668e-001, 6.236613e-001, 6.250467e-001, 6.264251e-001, 6.278035e-001, 6.291819e-001, 6.305603e-001, 6.319387e-001, 6.332968e-001, 6.346478e-001,
+6.359988e-001, 6.373498e-001, 6.387008e-001, 6.400518e-001, 6.413752e-001, 6.426938e-001, 6.440124e-001, 6.453310e-001, 6.466496e-001, 6.479682e-001,
+6.492699e-001, 6.505697e-001, 6.518694e-001, 6.531692e-001, 6.544690e-001, 6.557687e-001, 6.570505e-001, 6.583298e-001, 6.596090e-001, 6.608883e-001,
+6.621676e-001, 6.634469e-001, 6.647216e-001, 6.659952e-001, 6.672689e-001, 6.685425e-001, 6.698161e-001, 6.710897e-001, 6.723519e-001, 6.736079e-001,
+6.748639e-001, 6.761198e-001, 6.773758e-001, 6.786317e-001, 6.798825e-001, 6.811263e-001, 6.823702e-001, 6.836140e-001, 6.848578e-001, 6.861017e-001,
+6.873414e-001, 6.885574e-001, 6.897733e-001, 6.909892e-001, 6.922052e-001, 6.934211e-001, 6.946370e-001, 6.958393e-001, 6.970380e-001, 6.982367e-001,
+6.994354e-001, 7.006341e-001, 7.018328e-001, 7.030227e-001, 7.041977e-001, 7.053728e-001, 7.065479e-001, 7.077229e-001, 7.088980e-001, 7.100731e-001,
+7.112265e-001, 7.123770e-001, 7.135276e-001, 7.146781e-001, 7.158286e-001, 7.169791e-001, 7.181215e-001, 7.192468e-001, 7.203721e-001, 7.214973e-001,
+7.226226e-001, 7.237479e-001, 7.248731e-001, 7.259737e-001, 7.270630e-001, 7.281524e-001, 7.292417e-001, 7.303311e-001, 7.314204e-001, 7.325098e-001,
+7.335511e-001, 7.345916e-001, 7.356320e-001, 7.366725e-001, 7.377130e-001, 7.387535e-001, 7.397875e-001, 7.407964e-001, 7.418052e-001, 7.428141e-001,
+7.438230e-001, 7.448318e-001, 7.458407e-001, 7.468412e-001, 7.478263e-001, 7.488114e-001, 7.497966e-001, 7.507817e-001, 7.517668e-001, 7.527520e-001,
+7.537306e-001, 7.547006e-001, 7.556706e-001, 7.566406e-001, 7.576106e-001, 7.585806e-001, 7.595506e-001, 7.605129e-001, 7.614649e-001, 7.624170e-001,
+7.633691e-001, 7.643211e-001, 7.652732e-001, 7.662252e-001, 7.671692e-001, 7.680982e-001, 7.690272e-001, 7.699562e-001, 7.708853e-001, 7.718143e-001,
+7.727433e-001, 7.736695e-001, 7.745841e-001, 7.754987e-001, 7.764133e-001, 7.773279e-001, 7.782425e-001, 7.791571e-001, 7.800717e-001, 7.809834e-001,
+7.818949e-001, 7.828064e-001, 7.837179e-001, 7.846295e-001, 7.855410e-001, 7.864525e-001, 7.873617e-001, 7.882696e-001, 7.891775e-001, 7.900854e-001,
+7.909934e-001, 7.919013e-001, 7.928092e-001, 7.937149e-001, 7.946144e-001, 7.955139e-001, 7.964133e-001, 7.973128e-001, 7.982123e-001, 7.991118e-001,
+8.000113e-001, 8.008963e-001, 8.017778e-001, 8.026592e-001, 8.035406e-001, 8.044220e-001, 8.053035e-001, 8.061849e-001, 8.070607e-001, 8.079198e-001,
+8.087789e-001, 8.096380e-001, 8.104970e-001, 8.113561e-001, 8.122152e-001, 8.130743e-001, 8.139201e-001, 8.147576e-001, 8.155952e-001, 8.164328e-001,
+8.172703e-001, 8.181079e-001, 8.189455e-001, 8.197830e-001, 8.205946e-001, 8.214034e-001, 8.222122e-001, 8.230210e-001, 8.238298e-001, 8.246386e-001,
+8.254474e-001, 8.262543e-001, 8.270450e-001, 8.278358e-001, 8.286265e-001, 8.294173e-001, 8.302080e-001, 8.309988e-001, 8.317895e-001, 8.325753e-001,
+8.333438e-001, 8.341123e-001, 8.348808e-001, 8.356493e-001, 8.364178e-001, 8.371862e-001, 8.379547e-001, 8.387172e-001, 8.394616e-001, 8.402061e-001,
+8.409506e-001, 8.416951e-001, 8.424396e-001, 8.431841e-001, 8.439286e-001, 8.446694e-001, 8.453953e-001, 8.461211e-001, 8.468470e-001, 8.475728e-001,
+8.482987e-001, 8.490245e-001, 8.497504e-001, 8.504749e-001, 8.511757e-001, 8.518766e-001, 8.525774e-001, 8.532783e-001, 8.539791e-001, 8.546800e-001,
+8.553808e-001, 8.560817e-001, 8.567735e-001, 8.574634e-001, 8.581532e-001, 8.588431e-001, 8.595330e-001, 8.602229e-001, 8.609127e-001, 8.616026e-001,
+8.622910e-001, 8.629780e-001, 8.636650e-001, 8.643520e-001, 8.650389e-001, 8.657259e-001, 8.664129e-001, 8.670999e-001, 8.677851e-001, 8.684529e-001,
+8.691207e-001, 8.697886e-001, 8.704564e-001, 8.711242e-001, 8.717920e-001, 8.724599e-001, 8.731277e-001, 8.737883e-001, 8.744438e-001, 8.750993e-001,
+8.757548e-001, 8.764103e-001, 8.770658e-001, 8.777213e-001, 8.783767e-001, 8.790322e-001, 8.796920e-001, 8.803519e-001, 8.810117e-001, 8.816715e-001,
+8.823313e-001, 8.829912e-001, 8.836510e-001, 8.843108e-001, 8.849681e-001, 8.856196e-001, 8.862711e-001, 8.869226e-001, 8.875741e-001, 8.882257e-001,
+8.888772e-001, 8.895287e-001, 8.901802e-001, 8.908231e-001, 8.914582e-001, 8.920934e-001, 8.927285e-001, 8.933636e-001, 8.939987e-001, 8.946339e-001,
+8.952690e-001, 8.959041e-001, 8.965278e-001, 8.971453e-001, 8.977628e-001, 8.983803e-001, 8.989977e-001, 8.996152e-001, 9.002327e-001, 9.008502e-001,
+9.014677e-001, 9.020716e-001, 9.026690e-001, 9.032664e-001, 9.038638e-001, 9.044612e-001, 9.050586e-001, 9.056560e-001, 9.062534e-001, 9.068508e-001,
+9.074404e-001, 9.080248e-001, 9.086092e-001, 9.091937e-001, 9.097781e-001, 9.103625e-001, 9.109470e-001, 9.115314e-001, 9.121159e-001, 9.126855e-001,
+9.132358e-001, 9.137860e-001, 9.143362e-001, 9.148865e-001, 9.154367e-001, 9.159869e-001, 9.165371e-001, 9.170874e-001, 9.176348e-001, 9.181676e-001,
+9.187005e-001, 9.192333e-001, 9.197662e-001, 9.202991e-001, 9.208319e-001, 9.213648e-001, 9.218976e-001, 9.224305e-001, 9.229545e-001, 9.234762e-001,
+9.239979e-001, 9.245196e-001, 9.250414e-001, 9.255631e-001, 9.260848e-001, 9.266065e-001, 9.271282e-001, 9.276459e-001, 9.281548e-001, 9.286638e-001,
+9.291728e-001, 9.296818e-001, 9.301908e-001, 9.306998e-001, 9.312087e-001, 9.317177e-001, 9.322267e-001, 9.327246e-001, 9.332186e-001, 9.337126e-001,
+9.342067e-001, 9.347007e-001, 9.351948e-001, 9.356888e-001, 9.361828e-001, 9.366769e-001, 9.371693e-001, 9.376393e-001, 9.381093e-001, 9.385793e-001,
+9.390493e-001, 9.395193e-001, 9.399894e-001, 9.404594e-001, 9.409294e-001, 9.413994e-001, 9.418667e-001, 9.423272e-001, 9.427877e-001, 9.432482e-001,
+9.437087e-001, 9.441692e-001, 9.446297e-001, 9.450902e-001, 9.455508e-001, 9.460113e-001, 9.464758e-001, 9.469466e-001, 9.474174e-001, 9.478882e-001,
+9.483590e-001, 9.488298e-001, 9.493006e-001, 9.497714e-001, 9.502422e-001, 9.507130e-001, 9.511812e-001, 9.516454e-001, 9.521096e-001, 9.525737e-001,
+9.530379e-001, 9.535021e-001, 9.539663e-001, 9.544305e-001, 9.548947e-001, 9.553589e-001, 9.558221e-001, 9.562828e-001, 9.567435e-001, 9.572042e-001,
+9.576649e-001, 9.581256e-001, 9.585863e-001, 9.590470e-001, 9.595077e-001, 9.599684e-001, 9.604295e-001, 9.608956e-001, 9.613618e-001, 9.618279e-001,
+9.622940e-001, 9.627602e-001, 9.632263e-001, 9.636924e-001, 9.641586e-001, 9.646247e-001, 9.650908e-001, 9.655428e-001, 9.659900e-001, 9.664372e-001,
+9.668845e-001, 9.673317e-001, 9.677789e-001, 9.682262e-001, 9.686734e-001, 9.691206e-001, 9.695678e-001, 9.700127e-001, 9.704523e-001, 9.708919e-001,
+9.713316e-001, 9.717712e-001, 9.722108e-001, 9.726504e-001, 9.730900e-001, 9.735296e-001, 9.739693e-001, 9.744089e-001, 9.748445e-001, 9.752790e-001,
+9.757134e-001, 9.761478e-001, 9.765822e-001, 9.770166e-001, 9.774510e-001, 9.778854e-001, 9.783198e-001, 9.787542e-001, 9.791879e-001, 9.796146e-001,
+9.800414e-001, 9.804681e-001, 9.808948e-001, 9.813216e-001, 9.817483e-001, 9.821750e-001, 9.826018e-001, 9.830285e-001, 9.834552e-001, 9.838775e-001,
+9.842901e-001, 9.847027e-001, 9.851152e-001, 9.855278e-001, 9.859404e-001, 9.863529e-001, 9.867655e-001, 9.871780e-001, 9.875906e-001, 9.880032e-001,
+9.884101e-001, 9.888090e-001, 9.892080e-001, 9.896069e-001, 9.900058e-001, 9.904047e-001, 9.908037e-001, 9.912026e-001, 9.916015e-001, 9.920004e-001,
+9.923993e-001, 9.927872e-001, 9.931579e-001, 9.935287e-001, 9.938995e-001, 9.942703e-001, 9.946411e-001, 9.950119e-001, 9.953826e-001, 9.957534e-001,
+9.961242e-001, 9.964950e-001, 9.968441e-001, 9.971310e-001, 9.974179e-001, 9.977048e-001, 9.979917e-001, 9.982786e-001, 9.985655e-001, 9.988524e-001,
+9.991393e-001, 9.994262e-001, 9.997131e-001, 1.000000e+000)),
+("Kodak", "Kodachrome 64", "graph-log-log-pos", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.951461e-004, 3.971827e-004, 6.093314e-004, 8.331265e-004, 1.069325e-003, 1.316574e-003, 1.572318e-003, 1.837107e-003, 2.111139e-003,
+2.397596e-003, 2.694737e-003, 3.004376e-003, 3.324373e-003, 3.656406e-003, 4.000052e-003, 4.358352e-003, 4.730162e-003, 5.115937e-003, 5.516824e-003,
+5.931819e-003, 6.360613e-003, 6.803912e-003, 7.261015e-003, 7.732482e-003, 8.218694e-003, 8.719561e-003, 9.237381e-003, 9.771320e-003, 1.032153e-002,
+1.088597e-002, 1.146825e-002, 1.206882e-002, 1.268711e-002, 1.332619e-002, 1.398106e-002, 1.465690e-002, 1.535182e-002, 1.606807e-002, 1.680819e-002,
+1.756533e-002, 1.834051e-002, 1.913431e-002, 1.994440e-002, 2.077244e-002, 2.162471e-002, 2.249674e-002, 2.339009e-002, 2.430384e-002, 2.524292e-002,
+2.620414e-002, 2.718707e-002, 2.819233e-002, 2.922174e-002, 3.026999e-002, 3.134030e-002, 3.243791e-002, 3.355816e-002, 3.470371e-002, 3.587355e-002,
+3.707086e-002, 3.829632e-002, 3.955087e-002, 4.083404e-002, 4.214157e-002, 4.346910e-002, 4.481975e-002, 4.619171e-002, 4.758592e-002, 4.899746e-002,
+5.042214e-002, 5.186649e-002, 5.333141e-002, 5.481298e-002, 5.630973e-002, 5.782556e-002, 5.935638e-002, 6.091170e-002, 6.248875e-002, 6.408491e-002,
+6.570322e-002, 6.734187e-002, 6.900226e-002, 7.068209e-002, 7.238339e-002, 7.410888e-002, 7.585812e-002, 7.763098e-002, 7.942830e-002, 8.124764e-002,
+8.308302e-002, 8.493132e-002, 8.679454e-002, 8.867202e-002, 9.056416e-002, 9.247306e-002, 9.440086e-002, 9.634971e-002, 9.831698e-002, 1.002992e-001,
+1.022921e-001, 1.043059e-001, 1.063339e-001, 1.083754e-001, 1.104299e-001, 1.125015e-001, 1.145864e-001, 1.166832e-001, 1.187920e-001, 1.209282e-001,
+1.230840e-001, 1.252560e-001, 1.274450e-001, 1.296390e-001, 1.318370e-001, 1.340392e-001, 1.362587e-001, 1.384843e-001, 1.407156e-001, 1.429520e-001,
+1.451933e-001, 1.474387e-001, 1.496894e-001, 1.519509e-001, 1.542216e-001, 1.564984e-001, 1.587806e-001, 1.610693e-001, 1.633671e-001, 1.656686e-001,
+1.679760e-001, 1.702945e-001, 1.726183e-001, 1.749460e-001, 1.772750e-001, 1.796055e-001, 1.819469e-001, 1.842930e-001, 1.866527e-001, 1.890151e-001,
+1.913815e-001, 1.937530e-001, 1.961269e-001, 1.984995e-001, 2.008749e-001, 2.032616e-001, 2.056464e-001, 2.080288e-001, 2.104110e-001, 2.127932e-001,
+2.151795e-001, 2.175665e-001, 2.199523e-001, 2.223391e-001, 2.247312e-001, 2.271241e-001, 2.295188e-001, 2.319131e-001, 2.343071e-001, 2.366984e-001,
+2.390874e-001, 2.414731e-001, 2.438565e-001, 2.462437e-001, 2.486331e-001, 2.510172e-001, 2.533988e-001, 2.557758e-001, 2.581505e-001, 2.605293e-001,
+2.629101e-001, 2.652883e-001, 2.676650e-001, 2.700410e-001, 2.724166e-001, 2.747871e-001, 2.771524e-001, 2.795103e-001, 2.818570e-001, 2.842002e-001,
+2.865338e-001, 2.888651e-001, 2.911805e-001, 2.934958e-001, 2.957996e-001, 2.981028e-001, 3.004046e-001, 3.027058e-001, 3.050029e-001, 3.072964e-001,
+3.095871e-001, 3.118711e-001, 3.141548e-001, 3.164271e-001, 3.186994e-001, 3.209619e-001, 3.232210e-001, 3.254742e-001, 3.277195e-001, 3.299638e-001,
+3.321967e-001, 3.344297e-001, 3.366633e-001, 3.388972e-001, 3.411271e-001, 3.433490e-001, 3.455709e-001, 3.477727e-001, 3.499727e-001, 3.521771e-001,
+3.543867e-001, 3.565962e-001, 3.587930e-001, 3.609899e-001, 3.631898e-001, 3.653928e-001, 3.675958e-001, 3.697830e-001, 3.719698e-001, 3.741520e-001,
+3.763280e-001, 3.785041e-001, 3.806638e-001, 3.828206e-001, 3.849751e-001, 3.871222e-001, 3.892693e-001, 3.914064e-001, 3.935371e-001, 3.956677e-001,
+3.977790e-001, 3.998892e-001, 4.019931e-001, 4.040785e-001, 4.061638e-001, 4.082497e-001, 4.103359e-001, 4.124221e-001, 4.144963e-001, 4.165671e-001,
+4.186378e-001, 4.206883e-001, 4.227387e-001, 4.247852e-001, 4.268149e-001, 4.288447e-001, 4.308728e-001, 4.328977e-001, 4.349226e-001, 4.369453e-001,
+4.389654e-001, 4.409855e-001, 4.429949e-001, 4.449959e-001, 4.469970e-001, 4.489865e-001, 4.509692e-001, 4.529519e-001, 4.549243e-001, 4.568914e-001,
+4.588586e-001, 4.608167e-001, 4.627703e-001, 4.647239e-001, 4.666719e-001, 4.686165e-001, 4.705611e-001, 4.724956e-001, 4.744223e-001, 4.763490e-001,
+4.782695e-001, 4.801832e-001, 4.820968e-001, 4.840039e-001, 4.858982e-001, 4.877924e-001, 4.896840e-001, 4.915628e-001, 4.934415e-001, 4.953202e-001,
+4.971916e-001, 4.990628e-001, 5.009341e-001, 5.027933e-001, 5.046482e-001, 5.065031e-001, 5.083466e-001, 5.101771e-001, 5.120075e-001, 5.138359e-001,
+5.156533e-001, 5.174707e-001, 5.192881e-001, 5.211005e-001, 5.229117e-001, 5.247229e-001, 5.265293e-001, 5.283295e-001, 5.301297e-001, 5.319294e-001,
+5.337139e-001, 5.354984e-001, 5.372829e-001, 5.390647e-001, 5.408445e-001, 5.426243e-001, 5.444022e-001, 5.461611e-001, 5.479199e-001, 5.496788e-001,
+5.514247e-001, 5.531605e-001, 5.548964e-001, 5.566322e-001, 5.583571e-001, 5.600819e-001, 5.618068e-001, 5.635148e-001, 5.651975e-001, 5.668801e-001,
+5.685628e-001, 5.702366e-001, 5.719075e-001, 5.735785e-001, 5.752487e-001, 5.769107e-001, 5.785727e-001, 5.802346e-001, 5.818874e-001, 5.835234e-001,
+5.851594e-001, 5.867954e-001, 5.884161e-001, 5.900264e-001, 5.916366e-001, 5.932468e-001, 5.948414e-001, 5.964319e-001, 5.980223e-001, 5.996128e-001,
+6.011690e-001, 6.027232e-001, 6.042774e-001, 6.058307e-001, 6.073688e-001, 6.089070e-001, 6.104451e-001, 6.119817e-001, 6.135081e-001, 6.150345e-001,
+6.165609e-001, 6.180860e-001, 6.196046e-001, 6.211233e-001, 6.226419e-001, 6.241582e-001, 6.256613e-001, 6.271645e-001, 6.286676e-001, 6.301685e-001,
+6.316462e-001, 6.331239e-001, 6.346017e-001, 6.360794e-001, 6.375384e-001, 6.389972e-001, 6.404560e-001, 6.419148e-001, 6.433645e-001, 6.448125e-001,
+6.462605e-001, 6.477085e-001, 6.491544e-001, 6.505993e-001, 6.520442e-001, 6.534891e-001, 6.549305e-001, 6.563671e-001, 6.578037e-001, 6.592403e-001,
+6.606747e-001, 6.620953e-001, 6.635159e-001, 6.649365e-001, 6.663571e-001, 6.677600e-001, 6.691588e-001, 6.705575e-001, 6.719563e-001, 6.733427e-001,
+6.747133e-001, 6.760839e-001, 6.774544e-001, 6.788250e-001, 6.801914e-001, 6.815579e-001, 6.829244e-001, 6.842909e-001, 6.856526e-001, 6.870101e-001,
+6.883677e-001, 6.897252e-001, 6.910821e-001, 6.924132e-001, 6.937443e-001, 6.950754e-001, 6.964065e-001, 6.977305e-001, 6.990461e-001, 7.003617e-001,
+7.016773e-001, 7.029929e-001, 7.043046e-001, 7.056154e-001, 7.069262e-001, 7.082371e-001, 7.095442e-001, 7.108336e-001, 7.121230e-001, 7.134124e-001,
+7.147018e-001, 7.159799e-001, 7.172445e-001, 7.185090e-001, 7.197736e-001, 7.210381e-001, 7.222944e-001, 7.235469e-001, 7.247993e-001, 7.260518e-001,
+7.273042e-001, 7.285580e-001, 7.298120e-001, 7.310661e-001, 7.323201e-001, 7.335741e-001, 7.348139e-001, 7.360535e-001, 7.372932e-001, 7.385329e-001,
+7.397707e-001, 7.409820e-001, 7.421933e-001, 7.434047e-001, 7.446160e-001, 7.458250e-001, 7.470090e-001, 7.481931e-001, 7.493771e-001, 7.505611e-001,
+7.517436e-001, 7.528991e-001, 7.540546e-001, 7.552101e-001, 7.563656e-001, 7.575211e-001, 7.586535e-001, 7.597849e-001, 7.609164e-001, 7.620479e-001,
+7.631794e-001, 7.643040e-001, 7.654271e-001, 7.665502e-001, 7.676733e-001, 7.687965e-001, 7.699063e-001, 7.710080e-001, 7.721098e-001, 7.732116e-001,
+7.743133e-001, 7.754092e-001, 7.764948e-001, 7.775804e-001, 7.786661e-001, 7.797517e-001, 7.808366e-001, 7.819091e-001, 7.829816e-001, 7.840540e-001,
+7.851265e-001, 7.861990e-001, 7.872559e-001, 7.883058e-001, 7.893556e-001, 7.904054e-001, 7.914553e-001, 7.924998e-001, 7.935290e-001, 7.945583e-001,
+7.955875e-001, 7.966168e-001, 7.976460e-001, 7.986531e-001, 7.996535e-001, 8.006539e-001, 8.016543e-001, 8.026548e-001, 8.036468e-001, 8.046096e-001,
+8.055725e-001, 8.065354e-001, 8.074983e-001, 8.084612e-001, 8.094077e-001, 8.103441e-001, 8.112805e-001, 8.122169e-001, 8.131533e-001, 8.140897e-001,
+8.150095e-001, 8.159284e-001, 8.168473e-001, 8.177662e-001, 8.186851e-001, 8.195986e-001, 8.204927e-001, 8.213869e-001, 8.222811e-001, 8.231752e-001,
+8.240694e-001, 8.249510e-001, 8.258158e-001, 8.266806e-001, 8.275455e-001, 8.284103e-001, 8.292751e-001, 8.301309e-001, 8.309800e-001, 8.318291e-001,
+8.326781e-001, 8.335272e-001, 8.343763e-001, 8.352112e-001, 8.360387e-001, 8.368662e-001, 8.376937e-001, 8.385212e-001, 8.393487e-001, 8.401601e-001,
+8.409640e-001, 8.417678e-001, 8.425716e-001, 8.433754e-001, 8.441792e-001, 8.449678e-001, 8.457477e-001, 8.465276e-001, 8.473075e-001, 8.480874e-001,
+8.488672e-001, 8.496319e-001, 8.503824e-001, 8.511330e-001, 8.518835e-001, 8.526341e-001, 8.533847e-001, 8.541217e-001, 8.548329e-001, 8.555440e-001,
+8.562552e-001, 8.569663e-001, 8.576774e-001, 8.583873e-001, 8.590851e-001, 8.597828e-001, 8.604806e-001, 8.611784e-001, 8.618762e-001, 8.625740e-001,
+8.632514e-001, 8.639233e-001, 8.645952e-001, 8.652671e-001, 8.659390e-001, 8.666109e-001, 8.672789e-001, 8.679411e-001, 8.686033e-001, 8.692654e-001,
+8.699276e-001, 8.705898e-001, 8.712519e-001, 8.719060e-001, 8.725597e-001, 8.732133e-001, 8.738670e-001, 8.745207e-001, 8.751743e-001, 8.758152e-001,
+8.764393e-001, 8.770634e-001, 8.776875e-001, 8.783117e-001, 8.789358e-001, 8.795599e-001, 8.801736e-001, 8.807854e-001, 8.813971e-001, 8.820089e-001,
+8.826206e-001, 8.832324e-001, 8.838424e-001, 8.844445e-001, 8.850466e-001, 8.856487e-001, 8.862508e-001, 8.868529e-001, 8.874550e-001, 8.880429e-001,
+8.886129e-001, 8.891829e-001, 8.897530e-001, 8.903230e-001, 8.908931e-001, 8.914631e-001, 8.920254e-001, 8.925834e-001, 8.931414e-001, 8.936994e-001,
+8.942574e-001, 8.948153e-001, 8.953733e-001, 8.959251e-001, 8.964748e-001, 8.970246e-001, 8.975743e-001, 8.981241e-001, 8.986738e-001, 8.992236e-001,
+8.997610e-001, 9.002953e-001, 9.008296e-001, 9.013640e-001, 9.018983e-001, 9.024326e-001, 9.029669e-001, 9.034835e-001, 9.039947e-001, 9.045059e-001,
+9.050171e-001, 9.055283e-001, 9.060395e-001, 9.065507e-001, 9.070444e-001, 9.075291e-001, 9.080138e-001, 9.084984e-001, 9.089831e-001, 9.094678e-001,
+9.099525e-001, 9.104329e-001, 9.109085e-001, 9.113841e-001, 9.118597e-001, 9.123352e-001, 9.128108e-001, 9.132864e-001, 9.137566e-001, 9.142068e-001,
+9.146569e-001, 9.151071e-001, 9.155572e-001, 9.160074e-001, 9.164575e-001, 9.169077e-001, 9.173452e-001, 9.177808e-001, 9.182164e-001, 9.186520e-001,
+9.190875e-001, 9.195231e-001, 9.199587e-001, 9.203907e-001, 9.208181e-001, 9.212455e-001, 9.216730e-001, 9.221004e-001, 9.225278e-001, 9.229553e-001,
+9.233827e-001, 9.237879e-001, 9.241919e-001, 9.245959e-001, 9.249998e-001, 9.254038e-001, 9.258078e-001, 9.262118e-001, 9.266104e-001, 9.269998e-001,
+9.273892e-001, 9.277786e-001, 9.281680e-001, 9.285574e-001, 9.289468e-001, 9.293362e-001, 9.297145e-001, 9.300879e-001, 9.304613e-001, 9.308347e-001,
+9.312081e-001, 9.315815e-001, 9.319549e-001, 9.323283e-001, 9.326866e-001, 9.330440e-001, 9.334015e-001, 9.337590e-001, 9.341165e-001, 9.344740e-001,
+9.348315e-001, 9.351881e-001, 9.355377e-001, 9.358874e-001, 9.362371e-001, 9.365867e-001, 9.369364e-001, 9.372861e-001, 9.376358e-001, 9.379813e-001,
+9.383107e-001, 9.386400e-001, 9.389693e-001, 9.392986e-001, 9.396280e-001, 9.399573e-001, 9.402866e-001, 9.406143e-001, 9.409354e-001, 9.412565e-001,
+9.415775e-001, 9.418986e-001, 9.422197e-001, 9.425407e-001, 9.428618e-001, 9.431818e-001, 9.434933e-001, 9.438048e-001, 9.441162e-001, 9.444277e-001,
+9.447392e-001, 9.450506e-001, 9.453621e-001, 9.456736e-001, 9.459662e-001, 9.462575e-001, 9.465487e-001, 9.468400e-001, 9.471312e-001, 9.474225e-001,
+9.477137e-001, 9.480050e-001, 9.482977e-001, 9.485910e-001, 9.488844e-001, 9.491778e-001, 9.494712e-001, 9.497646e-001, 9.500580e-001, 9.503514e-001,
+9.506422e-001, 9.509275e-001, 9.512127e-001, 9.514980e-001, 9.517832e-001, 9.520685e-001, 9.523537e-001, 9.526389e-001, 9.529242e-001, 9.532032e-001,
+9.534811e-001, 9.537591e-001, 9.540371e-001, 9.543150e-001, 9.545930e-001, 9.548710e-001, 9.551490e-001, 9.554250e-001, 9.556970e-001, 9.559690e-001,
+9.562411e-001, 9.565131e-001, 9.567851e-001, 9.570571e-001, 9.573291e-001, 9.576012e-001, 9.578632e-001, 9.581208e-001, 9.583784e-001, 9.586360e-001,
+9.588936e-001, 9.591512e-001, 9.594088e-001, 9.596664e-001, 9.599240e-001, 9.601871e-001, 9.604503e-001, 9.607136e-001, 9.609769e-001, 9.612401e-001,
+9.615034e-001, 9.617667e-001, 9.620299e-001, 9.622897e-001, 9.625296e-001, 9.627695e-001, 9.630094e-001, 9.632493e-001, 9.634892e-001, 9.637291e-001,
+9.639689e-001, 9.642088e-001, 9.644484e-001, 9.646872e-001, 9.649259e-001, 9.651646e-001, 9.654033e-001, 9.656420e-001, 9.658808e-001, 9.661195e-001,
+9.663582e-001, 9.665972e-001, 9.668370e-001, 9.670769e-001, 9.673168e-001, 9.675567e-001, 9.677965e-001, 9.680364e-001, 9.682763e-001, 9.685161e-001,
+9.687551e-001, 9.689875e-001, 9.692199e-001, 9.694522e-001, 9.696846e-001, 9.699169e-001, 9.701493e-001, 9.703816e-001, 9.706140e-001, 9.708464e-001,
+9.710645e-001, 9.712812e-001, 9.714978e-001, 9.717145e-001, 9.719312e-001, 9.721479e-001, 9.723646e-001, 9.725812e-001, 9.727979e-001, 9.730128e-001,
+9.732266e-001, 9.734403e-001, 9.736540e-001, 9.738677e-001, 9.740815e-001, 9.742952e-001, 9.745089e-001, 9.747227e-001, 9.749328e-001, 9.751277e-001,
+9.753227e-001, 9.755176e-001, 9.757125e-001, 9.759075e-001, 9.761024e-001, 9.762974e-001, 9.764923e-001, 9.766872e-001, 9.768774e-001, 9.770654e-001,
+9.772534e-001, 9.774413e-001, 9.776293e-001, 9.778173e-001, 9.780053e-001, 9.781932e-001, 9.783812e-001, 9.785689e-001, 9.787534e-001, 9.789379e-001,
+9.791223e-001, 9.793068e-001, 9.794912e-001, 9.796757e-001, 9.798601e-001, 9.800446e-001, 9.802290e-001, 9.804099e-001, 9.805839e-001, 9.807580e-001,
+9.809321e-001, 9.811062e-001, 9.812802e-001, 9.814543e-001, 9.816284e-001, 9.818025e-001, 9.819766e-001, 9.821426e-001, 9.823013e-001, 9.824601e-001,
+9.826188e-001, 9.827776e-001, 9.829363e-001, 9.830951e-001, 9.832538e-001, 9.834125e-001, 9.835713e-001, 9.837297e-001, 9.838878e-001, 9.840460e-001,
+9.842041e-001, 9.843623e-001, 9.845204e-001, 9.846786e-001, 9.848367e-001, 9.849949e-001, 9.851530e-001, 9.853115e-001, 9.854704e-001, 9.856293e-001,
+9.857881e-001, 9.859470e-001, 9.861058e-001, 9.862647e-001, 9.864236e-001, 9.865824e-001, 9.867413e-001, 9.868973e-001, 9.870493e-001, 9.872012e-001,
+9.873532e-001, 9.875052e-001, 9.876572e-001, 9.878092e-001, 9.879612e-001, 9.881131e-001, 9.882651e-001, 9.884156e-001, 9.885584e-001, 9.887011e-001,
+9.888438e-001, 9.889865e-001, 9.891293e-001, 9.892720e-001, 9.894147e-001, 9.895574e-001, 9.897002e-001, 9.898429e-001, 9.899816e-001, 9.901193e-001,
+9.902570e-001, 9.903946e-001, 9.905323e-001, 9.906700e-001, 9.908077e-001, 9.909453e-001, 9.910830e-001, 9.912207e-001, 9.913564e-001, 9.914880e-001,
+9.916195e-001, 9.917510e-001, 9.918825e-001, 9.920140e-001, 9.921455e-001, 9.922770e-001, 9.924085e-001, 9.925400e-001, 9.926715e-001, 9.928074e-001,
+9.929450e-001, 9.930827e-001, 9.932203e-001, 9.933580e-001, 9.934956e-001, 9.936332e-001, 9.937709e-001, 9.939085e-001, 9.940462e-001, 9.941837e-001,
+9.943145e-001, 9.944454e-001, 9.945762e-001, 9.947070e-001, 9.948378e-001, 9.949686e-001, 9.950994e-001, 9.952302e-001, 9.953610e-001, 9.954918e-001,
+9.956233e-001, 9.957579e-001, 9.958926e-001, 9.960272e-001, 9.961619e-001, 9.962965e-001, 9.964311e-001, 9.965658e-001, 9.967004e-001, 9.968351e-001,
+9.969697e-001, 9.971042e-001, 9.972380e-001, 9.973718e-001, 9.975057e-001, 9.976395e-001, 9.977734e-001, 9.979072e-001, 9.980411e-001, 9.981749e-001,
+9.983088e-001, 9.984426e-001, 9.985757e-001, 9.987052e-001, 9.988346e-001, 9.989641e-001, 9.990936e-001, 9.992231e-001, 9.993526e-001, 9.994821e-001,
+9.996115e-001, 9.997410e-001, 9.998705e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.957432e-004, 4.013765e-004, 6.168035e-004, 8.421433e-004, 1.080043e-003, 1.332742e-003, 1.596499e-003, 1.869191e-003, 2.153499e-003,
+2.450108e-003, 2.762067e-003, 3.086136e-003, 3.419674e-003, 3.763168e-003, 4.118915e-003, 4.487205e-003, 4.866232e-003, 5.259863e-003, 5.666820e-003,
+6.085558e-003, 6.519085e-003, 6.962120e-003, 7.417130e-003, 7.881233e-003, 8.356668e-003, 8.842698e-003, 9.341273e-003, 9.849353e-003, 1.037192e-002,
+1.090695e-002, 1.145349e-002, 1.201498e-002, 1.259007e-002, 1.318132e-002, 1.378806e-002, 1.441429e-002, 1.505528e-002, 1.570838e-002, 1.637662e-002,
+1.705980e-002, 1.775515e-002, 1.846562e-002, 1.919360e-002, 1.993505e-002, 2.069017e-002, 2.146684e-002, 2.225986e-002, 2.307340e-002, 2.390604e-002,
+2.475747e-002, 2.562742e-002, 2.651530e-002, 2.742431e-002, 2.835016e-002, 2.929340e-002, 3.025573e-002, 3.123501e-002, 3.223241e-002, 3.325200e-002,
+3.429497e-002, 3.535510e-002, 3.643974e-002, 3.754519e-002, 3.867128e-002, 3.981810e-002, 4.098559e-002, 4.217670e-002, 4.338617e-002, 4.461469e-002,
+4.585877e-002, 4.712183e-002, 4.840390e-002, 4.970359e-002, 5.102059e-002, 5.235896e-002, 5.372267e-002, 5.510599e-002, 5.650319e-002, 5.791889e-002,
+5.935333e-002, 6.080515e-002, 6.227835e-002, 6.377289e-002, 6.529258e-002, 6.683744e-002, 6.840048e-002, 6.997832e-002, 7.157126e-002, 7.317536e-002,
+7.479539e-002, 7.643753e-002, 7.809915e-002, 7.977951e-002, 8.148049e-002, 8.320313e-002, 8.494412e-002, 8.669991e-002, 8.847183e-002, 9.025941e-002,
+9.206197e-002, 9.388069e-002, 9.572346e-002, 9.758511e-002, 9.946533e-002, 1.013638e-001, 1.032825e-001, 1.052193e-001, 1.071742e-001, 1.091484e-001,
+1.111427e-001, 1.131450e-001, 1.151550e-001, 1.171758e-001, 1.192135e-001, 1.212674e-001, 1.233420e-001, 1.254397e-001, 1.275477e-001, 1.296652e-001,
+1.317926e-001, 1.339261e-001, 1.360657e-001, 1.382189e-001, 1.403803e-001, 1.425506e-001, 1.447318e-001, 1.469234e-001, 1.491299e-001, 1.513458e-001,
+1.535694e-001, 1.558119e-001, 1.580559e-001, 1.603008e-001, 1.625522e-001, 1.648124e-001, 1.670872e-001, 1.693770e-001, 1.716733e-001, 1.739847e-001,
+1.763011e-001, 1.786265e-001, 1.809586e-001, 1.832943e-001, 1.856396e-001, 1.879891e-001, 1.903553e-001, 1.927255e-001, 1.951017e-001, 1.974837e-001,
+1.998693e-001, 2.022628e-001, 2.046581e-001, 2.070544e-001, 2.094525e-001, 2.118603e-001, 2.142691e-001, 2.166802e-001, 2.190933e-001, 2.215094e-001,
+2.239298e-001, 2.263546e-001, 2.287807e-001, 2.312079e-001, 2.336384e-001, 2.360707e-001, 2.385022e-001, 2.409332e-001, 2.433750e-001, 2.458224e-001,
+2.482778e-001, 2.507375e-001, 2.532020e-001, 2.556693e-001, 2.581461e-001, 2.606298e-001, 2.631142e-001, 2.655993e-001, 2.680786e-001, 2.705488e-001,
+2.730178e-001, 2.754839e-001, 2.779509e-001, 2.804241e-001, 2.828973e-001, 2.853642e-001, 2.878307e-001, 2.902926e-001, 2.927532e-001, 2.952115e-001,
+2.976680e-001, 3.001233e-001, 3.025760e-001, 3.050286e-001, 3.074804e-001, 3.099323e-001, 3.123745e-001, 3.148137e-001, 3.172555e-001, 3.197004e-001,
+3.221448e-001, 3.245867e-001, 3.270285e-001, 3.294713e-001, 3.319145e-001, 3.343560e-001, 3.367948e-001, 3.392335e-001, 3.416741e-001, 3.441149e-001,
+3.465546e-001, 3.489935e-001, 3.514320e-001, 3.538624e-001, 3.562928e-001, 3.587243e-001, 3.611567e-001, 3.635890e-001, 3.660192e-001, 3.684494e-001,
+3.708697e-001, 3.732794e-001, 3.756891e-001, 3.780809e-001, 3.804707e-001, 3.828579e-001, 3.852391e-001, 3.876202e-001, 3.899952e-001, 3.923671e-001,
+3.947389e-001, 3.970890e-001, 3.994391e-001, 4.017912e-001, 4.041476e-001, 4.065040e-001, 4.088486e-001, 4.111853e-001, 4.135220e-001, 4.158436e-001,
+4.181625e-001, 4.204813e-001, 4.227986e-001, 4.251160e-001, 4.274306e-001, 4.297378e-001, 4.320450e-001, 4.343562e-001, 4.366728e-001, 4.389894e-001,
+4.412984e-001, 4.436013e-001, 4.459043e-001, 4.482020e-001, 4.504969e-001, 4.527919e-001, 4.550857e-001, 4.573792e-001, 4.596727e-001, 4.619601e-001,
+4.642455e-001, 4.665309e-001, 4.688046e-001, 4.710747e-001, 4.733447e-001, 4.756113e-001, 4.778766e-001, 4.801420e-001, 4.823894e-001, 4.846283e-001,
+4.868671e-001, 4.890892e-001, 4.912991e-001, 4.935090e-001, 4.957110e-001, 4.979033e-001, 5.000956e-001, 5.022780e-001, 5.044360e-001, 5.065940e-001,
+5.087499e-001, 5.108858e-001, 5.130217e-001, 5.151577e-001, 5.172630e-001, 5.193634e-001, 5.214639e-001, 5.235528e-001, 5.256341e-001, 5.277154e-001,
+5.297919e-001, 5.318573e-001, 5.339226e-001, 5.359880e-001, 5.380240e-001, 5.400588e-001, 5.420936e-001, 5.441211e-001, 5.461434e-001, 5.481658e-001,
+5.501839e-001, 5.521821e-001, 5.541803e-001, 5.561785e-001, 5.581639e-001, 5.601447e-001, 5.621254e-001, 5.640997e-001, 5.660543e-001, 5.680088e-001,
+5.699633e-001, 5.718949e-001, 5.738178e-001, 5.757406e-001, 5.776598e-001, 5.795600e-001, 5.814603e-001, 5.833605e-001, 5.852446e-001, 5.871162e-001,
+5.889877e-001, 5.908593e-001, 5.926998e-001, 5.945380e-001, 5.963761e-001, 5.982088e-001, 6.000253e-001, 6.018419e-001, 6.036585e-001, 6.054543e-001,
+6.072320e-001, 6.090097e-001, 6.107873e-001, 6.125335e-001, 6.142706e-001, 6.160078e-001, 6.177449e-001, 6.194577e-001, 6.211700e-001, 6.228823e-001,
+6.245880e-001, 6.262523e-001, 6.279167e-001, 6.295810e-001, 6.312367e-001, 6.328673e-001, 6.344978e-001, 6.361284e-001, 6.377482e-001, 6.393466e-001,
+6.409450e-001, 6.425434e-001, 6.441306e-001, 6.456986e-001, 6.472667e-001, 6.488348e-001, 6.503942e-001, 6.519384e-001, 6.534825e-001, 6.550267e-001,
+6.565703e-001, 6.581129e-001, 6.596555e-001, 6.611981e-001, 6.627355e-001, 6.642532e-001, 6.657709e-001, 6.672887e-001, 6.688051e-001, 6.703054e-001,
+6.718056e-001, 6.733058e-001, 6.748061e-001, 6.762985e-001, 6.777899e-001, 6.792813e-001, 6.807727e-001, 6.822533e-001, 6.837282e-001, 6.852030e-001,
+6.866779e-001, 6.881393e-001, 6.895787e-001, 6.910182e-001, 6.924576e-001, 6.938956e-001, 6.953093e-001, 6.967230e-001, 6.981367e-001, 6.995504e-001,
+7.009537e-001, 7.023523e-001, 7.037508e-001, 7.051494e-001, 7.065390e-001, 7.079041e-001, 7.092693e-001, 7.106345e-001, 7.119996e-001, 7.133481e-001,
+7.146926e-001, 7.160371e-001, 7.173816e-001, 7.187204e-001, 7.200454e-001, 7.213705e-001, 7.226955e-001, 7.240206e-001, 7.253168e-001, 7.266024e-001,
+7.278880e-001, 7.291736e-001, 7.304562e-001, 7.317164e-001, 7.329766e-001, 7.342369e-001, 7.354971e-001, 7.367406e-001, 7.379641e-001, 7.391876e-001,
+7.404111e-001, 7.416346e-001, 7.428414e-001, 7.440424e-001, 7.452434e-001, 7.464445e-001, 7.476455e-001, 7.488264e-001, 7.500070e-001, 7.511875e-001,
+7.523681e-001, 7.535430e-001, 7.546894e-001, 7.558357e-001, 7.569821e-001, 7.581285e-001, 7.592621e-001, 7.603655e-001, 7.614690e-001, 7.625724e-001,
+7.636758e-001, 7.647761e-001, 7.658712e-001, 7.669663e-001, 7.680615e-001, 7.691566e-001, 7.702390e-001, 7.713027e-001, 7.723663e-001, 7.734300e-001,
+7.744937e-001, 7.755484e-001, 7.765882e-001, 7.776281e-001, 7.786679e-001, 7.797078e-001, 7.807422e-001, 7.817639e-001, 7.827856e-001, 7.838072e-001,
+7.848289e-001, 7.858467e-001, 7.868435e-001, 7.878404e-001, 7.888373e-001, 7.898342e-001, 7.908311e-001, 7.917974e-001, 7.927627e-001, 7.937280e-001,
+7.946932e-001, 7.956585e-001, 7.966090e-001, 7.975538e-001, 7.984985e-001, 7.994433e-001, 8.003880e-001, 8.013279e-001, 8.022609e-001, 8.031939e-001,
+8.041269e-001, 8.050599e-001, 8.059915e-001, 8.068947e-001, 8.077979e-001, 8.087011e-001, 8.096043e-001, 8.105075e-001, 8.113903e-001, 8.122608e-001,
+8.131313e-001, 8.140019e-001, 8.148724e-001, 8.157399e-001, 8.165896e-001, 8.174394e-001, 8.182891e-001, 8.191388e-001, 8.199885e-001, 8.208152e-001,
+8.216269e-001, 8.224385e-001, 8.232502e-001, 8.240618e-001, 8.248734e-001, 8.256731e-001, 8.264727e-001, 8.272724e-001, 8.280721e-001, 8.288717e-001,
+8.296631e-001, 8.304389e-001, 8.312146e-001, 8.319904e-001, 8.327661e-001, 8.335418e-001, 8.343117e-001, 8.350779e-001, 8.358441e-001, 8.366104e-001,
+8.373766e-001, 8.381429e-001, 8.389006e-001, 8.396567e-001, 8.404128e-001, 8.411689e-001, 8.419250e-001, 8.426810e-001, 8.434000e-001, 8.441187e-001,
+8.448373e-001, 8.455560e-001, 8.462746e-001, 8.469918e-001, 8.476917e-001, 8.483916e-001, 8.490915e-001, 8.497914e-001, 8.504914e-001, 8.511894e-001,
+8.518716e-001, 8.525538e-001, 8.532360e-001, 8.539182e-001, 8.546004e-001, 8.552806e-001, 8.559337e-001, 8.565867e-001, 8.572398e-001, 8.578929e-001,
+8.585459e-001, 8.591990e-001, 8.598428e-001, 8.604861e-001, 8.611295e-001, 8.617729e-001, 8.624163e-001, 8.630597e-001, 8.636872e-001, 8.643105e-001,
+8.649338e-001, 8.655570e-001, 8.661803e-001, 8.668036e-001, 8.674191e-001, 8.680283e-001, 8.686374e-001, 8.692466e-001, 8.698558e-001, 8.704650e-001,
+8.710713e-001, 8.716691e-001, 8.722669e-001, 8.728647e-001, 8.734625e-001, 8.740603e-001, 8.746581e-001, 8.752397e-001, 8.758190e-001, 8.763983e-001,
+8.769776e-001, 8.775568e-001, 8.781361e-001, 8.787040e-001, 8.792570e-001, 8.798101e-001, 8.803631e-001, 8.809161e-001, 8.814692e-001, 8.820222e-001,
+8.825591e-001, 8.830946e-001, 8.836302e-001, 8.841657e-001, 8.847012e-001, 8.852368e-001, 8.857639e-001, 8.862746e-001, 8.867853e-001, 8.872959e-001,
+8.878066e-001, 8.883173e-001, 8.888280e-001, 8.893266e-001, 8.898196e-001, 8.903127e-001, 8.908057e-001, 8.912988e-001, 8.917918e-001, 8.922848e-001,
+8.927574e-001, 8.932290e-001, 8.937007e-001, 8.941723e-001, 8.946439e-001, 8.951156e-001, 8.955852e-001, 8.960441e-001, 8.965030e-001, 8.969618e-001,
+8.974207e-001, 8.978796e-001, 8.983385e-001, 8.987923e-001, 8.992335e-001, 8.996747e-001, 9.001159e-001, 9.005571e-001, 9.009983e-001, 9.014394e-001,
+9.018742e-001, 9.022963e-001, 9.027183e-001, 9.031404e-001, 9.035624e-001, 9.039845e-001, 9.044065e-001, 9.048255e-001, 9.052378e-001, 9.056500e-001,
+9.060623e-001, 9.064745e-001, 9.068868e-001, 9.072990e-001, 9.077087e-001, 9.081089e-001, 9.085092e-001, 9.089094e-001, 9.093096e-001, 9.097099e-001,
+9.101101e-001, 9.105102e-001, 9.109075e-001, 9.113048e-001, 9.117020e-001, 9.120993e-001, 9.124966e-001, 9.128938e-001, 9.132911e-001, 9.136837e-001,
+9.140750e-001, 9.144663e-001, 9.148576e-001, 9.152489e-001, 9.156402e-001, 9.160315e-001, 9.164192e-001, 9.168026e-001, 9.171860e-001, 9.175694e-001,
+9.179528e-001, 9.183362e-001, 9.187196e-001, 9.191031e-001, 9.194877e-001, 9.198724e-001, 9.202571e-001, 9.206417e-001, 9.210264e-001, 9.214111e-001,
+9.217957e-001, 9.221795e-001, 9.225626e-001, 9.229458e-001, 9.233289e-001, 9.237120e-001, 9.240951e-001, 9.244782e-001, 9.248613e-001, 9.252420e-001,
+9.256226e-001, 9.260032e-001, 9.263837e-001, 9.267643e-001, 9.271449e-001, 9.275255e-001, 9.279054e-001, 9.282837e-001, 9.286620e-001, 9.290403e-001,
+9.294187e-001, 9.297970e-001, 9.301753e-001, 9.305536e-001, 9.309234e-001, 9.312868e-001, 9.316503e-001, 9.320137e-001, 9.323772e-001, 9.327406e-001,
+9.331041e-001, 9.334675e-001, 9.338106e-001, 9.341468e-001, 9.344830e-001, 9.348192e-001, 9.351554e-001, 9.354916e-001, 9.358279e-001, 9.361641e-001,
+9.364856e-001, 9.368045e-001, 9.371233e-001, 9.374421e-001, 9.377609e-001, 9.380797e-001, 9.383986e-001, 9.387174e-001, 9.390224e-001, 9.393250e-001,
+9.396277e-001, 9.399303e-001, 9.402329e-001, 9.405355e-001, 9.408381e-001, 9.411407e-001, 9.414328e-001, 9.417218e-001, 9.420107e-001, 9.422997e-001,
+9.425886e-001, 9.428776e-001, 9.431665e-001, 9.434555e-001, 9.437438e-001, 9.440318e-001, 9.443197e-001, 9.446076e-001, 9.448956e-001, 9.451835e-001,
+9.454715e-001, 9.457594e-001, 9.460437e-001, 9.463212e-001, 9.465987e-001, 9.468762e-001, 9.471537e-001, 9.474311e-001, 9.477086e-001, 9.479861e-001,
+9.482636e-001, 9.485384e-001, 9.488133e-001, 9.490882e-001, 9.493630e-001, 9.496379e-001, 9.499127e-001, 9.501876e-001, 9.504625e-001, 9.507295e-001,
+9.509905e-001, 9.512514e-001, 9.515124e-001, 9.517734e-001, 9.520343e-001, 9.522953e-001, 9.525562e-001, 9.528168e-001, 9.530668e-001, 9.533167e-001,
+9.535666e-001, 9.538166e-001, 9.540665e-001, 9.543165e-001, 9.545664e-001, 9.548164e-001, 9.550621e-001, 9.553020e-001, 9.555419e-001, 9.557818e-001,
+9.560217e-001, 9.562615e-001, 9.565014e-001, 9.567413e-001, 9.569812e-001, 9.572149e-001, 9.574460e-001, 9.576771e-001, 9.579082e-001, 9.581393e-001,
+9.583704e-001, 9.586015e-001, 9.588325e-001, 9.590636e-001, 9.592814e-001, 9.594976e-001, 9.597137e-001, 9.599299e-001, 9.601460e-001, 9.603622e-001,
+9.605784e-001, 9.607945e-001, 9.610107e-001, 9.612245e-001, 9.614383e-001, 9.616520e-001, 9.618658e-001, 9.620796e-001, 9.622934e-001, 9.625072e-001,
+9.627210e-001, 9.629347e-001, 9.631499e-001, 9.633651e-001, 9.635802e-001, 9.637954e-001, 9.640106e-001, 9.642258e-001, 9.644410e-001, 9.646561e-001,
+9.648713e-001, 9.650798e-001, 9.652874e-001, 9.654950e-001, 9.657026e-001, 9.659103e-001, 9.661179e-001, 9.663255e-001, 9.665331e-001, 9.667407e-001,
+9.669466e-001, 9.671518e-001, 9.673569e-001, 9.675620e-001, 9.677672e-001, 9.679723e-001, 9.681775e-001, 9.683826e-001, 9.685877e-001, 9.687933e-001,
+9.689996e-001, 9.692058e-001, 9.694121e-001, 9.696183e-001, 9.698246e-001, 9.700308e-001, 9.702371e-001, 9.704433e-001, 9.706496e-001, 9.708500e-001,
+9.710504e-001, 9.712507e-001, 9.714511e-001, 9.716515e-001, 9.718519e-001, 9.720523e-001, 9.722527e-001, 9.724531e-001, 9.726469e-001, 9.728343e-001,
+9.730216e-001, 9.732090e-001, 9.733963e-001, 9.735836e-001, 9.737710e-001, 9.739583e-001, 9.741457e-001, 9.743330e-001, 9.745093e-001, 9.746843e-001,
+9.748593e-001, 9.750343e-001, 9.752093e-001, 9.753843e-001, 9.755593e-001, 9.757343e-001, 9.759093e-001, 9.760806e-001, 9.762361e-001, 9.763917e-001,
+9.765472e-001, 9.767027e-001, 9.768583e-001, 9.770138e-001, 9.771693e-001, 9.773249e-001, 9.774804e-001, 9.776375e-001, 9.777972e-001, 9.779569e-001,
+9.781166e-001, 9.782762e-001, 9.784359e-001, 9.785956e-001, 9.787553e-001, 9.789150e-001, 9.790747e-001, 9.792377e-001, 9.794046e-001, 9.795715e-001,
+9.797384e-001, 9.799053e-001, 9.800723e-001, 9.802392e-001, 9.804061e-001, 9.805730e-001, 9.807399e-001, 9.809073e-001, 9.810754e-001, 9.812435e-001,
+9.814115e-001, 9.815796e-001, 9.817477e-001, 9.819157e-001, 9.820838e-001, 9.822519e-001, 9.824199e-001, 9.825896e-001, 9.827629e-001, 9.829362e-001,
+9.831095e-001, 9.832828e-001, 9.834561e-001, 9.836293e-001, 9.838026e-001, 9.839759e-001, 9.841492e-001, 9.843228e-001, 9.845007e-001, 9.846786e-001,
+9.848565e-001, 9.850344e-001, 9.852123e-001, 9.853902e-001, 9.855681e-001, 9.857460e-001, 9.859239e-001, 9.861018e-001, 9.862814e-001, 9.864618e-001,
+9.866422e-001, 9.868225e-001, 9.870029e-001, 9.871833e-001, 9.873636e-001, 9.875440e-001, 9.877244e-001, 9.879048e-001, 9.880853e-001, 9.882667e-001,
+9.884480e-001, 9.886294e-001, 9.888107e-001, 9.889920e-001, 9.891734e-001, 9.893547e-001, 9.895361e-001, 9.897174e-001, 9.898987e-001, 9.900819e-001,
+9.902659e-001, 9.904500e-001, 9.906340e-001, 9.908181e-001, 9.910022e-001, 9.911862e-001, 9.913703e-001, 9.915544e-001, 9.917384e-001, 9.919225e-001,
+9.921046e-001, 9.922867e-001, 9.924687e-001, 9.926507e-001, 9.928328e-001, 9.930148e-001, 9.931968e-001, 9.933789e-001, 9.935609e-001, 9.937429e-001,
+9.939254e-001, 9.941106e-001, 9.942957e-001, 9.944809e-001, 9.946661e-001, 9.948513e-001, 9.950364e-001, 9.952216e-001, 9.954068e-001, 9.955919e-001,
+9.957771e-001, 9.959601e-001, 9.961352e-001, 9.963102e-001, 9.964853e-001, 9.966604e-001, 9.968355e-001, 9.970105e-001, 9.971856e-001, 9.973607e-001,
+9.975357e-001, 9.977108e-001, 9.978887e-001, 9.980806e-001, 9.982726e-001, 9.984645e-001, 9.986564e-001, 9.988484e-001, 9.990403e-001, 9.992323e-001,
+9.994242e-001, 9.996161e-001, 9.998081e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.951461e-004, 3.971827e-004, 6.093314e-004, 8.331265e-004, 1.069325e-003, 1.316574e-003, 1.572318e-003, 1.837107e-003, 2.111139e-003,
+2.397596e-003, 2.694737e-003, 3.004376e-003, 3.324373e-003, 3.656406e-003, 4.000052e-003, 4.358352e-003, 4.730162e-003, 5.115937e-003, 5.516824e-003,
+5.931819e-003, 6.360613e-003, 6.803912e-003, 7.261015e-003, 7.732482e-003, 8.218694e-003, 8.719561e-003, 9.237381e-003, 9.771320e-003, 1.032153e-002,
+1.088597e-002, 1.146825e-002, 1.206882e-002, 1.268711e-002, 1.332619e-002, 1.398106e-002, 1.465690e-002, 1.535182e-002, 1.606807e-002, 1.680819e-002,
+1.756533e-002, 1.834051e-002, 1.913431e-002, 1.994440e-002, 2.077244e-002, 2.162471e-002, 2.249674e-002, 2.339009e-002, 2.430384e-002, 2.524292e-002,
+2.620414e-002, 2.718707e-002, 2.819233e-002, 2.922174e-002, 3.026999e-002, 3.134030e-002, 3.243791e-002, 3.355816e-002, 3.470371e-002, 3.587355e-002,
+3.707086e-002, 3.829632e-002, 3.955087e-002, 4.083404e-002, 4.214157e-002, 4.346910e-002, 4.481975e-002, 4.619171e-002, 4.758592e-002, 4.899746e-002,
+5.042214e-002, 5.186649e-002, 5.333141e-002, 5.481298e-002, 5.630973e-002, 5.782556e-002, 5.935638e-002, 6.091170e-002, 6.248875e-002, 6.408491e-002,
+6.570322e-002, 6.734187e-002, 6.900226e-002, 7.068209e-002, 7.238339e-002, 7.410888e-002, 7.585812e-002, 7.763098e-002, 7.942830e-002, 8.124764e-002,
+8.308302e-002, 8.493132e-002, 8.679454e-002, 8.867202e-002, 9.056416e-002, 9.247306e-002, 9.440086e-002, 9.634971e-002, 9.831698e-002, 1.002992e-001,
+1.022921e-001, 1.043059e-001, 1.063339e-001, 1.083754e-001, 1.104299e-001, 1.125015e-001, 1.145864e-001, 1.166832e-001, 1.187920e-001, 1.209282e-001,
+1.230840e-001, 1.252560e-001, 1.274450e-001, 1.296390e-001, 1.318370e-001, 1.340392e-001, 1.362587e-001, 1.384843e-001, 1.407156e-001, 1.429520e-001,
+1.451933e-001, 1.474387e-001, 1.496894e-001, 1.519509e-001, 1.542216e-001, 1.564984e-001, 1.587806e-001, 1.610693e-001, 1.633671e-001, 1.656686e-001,
+1.679760e-001, 1.702945e-001, 1.726183e-001, 1.749460e-001, 1.772750e-001, 1.796055e-001, 1.819469e-001, 1.842930e-001, 1.866527e-001, 1.890151e-001,
+1.913815e-001, 1.937530e-001, 1.961269e-001, 1.984995e-001, 2.008749e-001, 2.032616e-001, 2.056464e-001, 2.080288e-001, 2.104110e-001, 2.127932e-001,
+2.151795e-001, 2.175665e-001, 2.199523e-001, 2.223391e-001, 2.247312e-001, 2.271241e-001, 2.295188e-001, 2.319131e-001, 2.343071e-001, 2.366984e-001,
+2.390874e-001, 2.414731e-001, 2.438565e-001, 2.462437e-001, 2.486331e-001, 2.510172e-001, 2.533988e-001, 2.557758e-001, 2.581505e-001, 2.605293e-001,
+2.629101e-001, 2.652883e-001, 2.676650e-001, 2.700410e-001, 2.724166e-001, 2.747871e-001, 2.771524e-001, 2.795103e-001, 2.818570e-001, 2.842002e-001,
+2.865338e-001, 2.888651e-001, 2.911805e-001, 2.934958e-001, 2.957996e-001, 2.981028e-001, 3.004046e-001, 3.027058e-001, 3.050029e-001, 3.072964e-001,
+3.095871e-001, 3.118711e-001, 3.141548e-001, 3.164271e-001, 3.186994e-001, 3.209619e-001, 3.232210e-001, 3.254742e-001, 3.277195e-001, 3.299638e-001,
+3.321967e-001, 3.344297e-001, 3.366633e-001, 3.388972e-001, 3.411271e-001, 3.433490e-001, 3.455709e-001, 3.477727e-001, 3.499727e-001, 3.521771e-001,
+3.543867e-001, 3.565962e-001, 3.587930e-001, 3.609899e-001, 3.631898e-001, 3.653928e-001, 3.675958e-001, 3.697830e-001, 3.719698e-001, 3.741520e-001,
+3.763280e-001, 3.785041e-001, 3.806638e-001, 3.828206e-001, 3.849751e-001, 3.871222e-001, 3.892693e-001, 3.914064e-001, 3.935371e-001, 3.956677e-001,
+3.977790e-001, 3.998892e-001, 4.019931e-001, 4.040785e-001, 4.061638e-001, 4.082497e-001, 4.103359e-001, 4.124221e-001, 4.144963e-001, 4.165671e-001,
+4.186378e-001, 4.206883e-001, 4.227387e-001, 4.247852e-001, 4.268149e-001, 4.288447e-001, 4.308728e-001, 4.328977e-001, 4.349226e-001, 4.369453e-001,
+4.389654e-001, 4.409855e-001, 4.429949e-001, 4.449959e-001, 4.469970e-001, 4.489865e-001, 4.509692e-001, 4.529519e-001, 4.549243e-001, 4.568914e-001,
+4.588586e-001, 4.608167e-001, 4.627703e-001, 4.647239e-001, 4.666719e-001, 4.686165e-001, 4.705611e-001, 4.724956e-001, 4.744223e-001, 4.763490e-001,
+4.782695e-001, 4.801832e-001, 4.820968e-001, 4.840039e-001, 4.858982e-001, 4.877924e-001, 4.896840e-001, 4.915628e-001, 4.934415e-001, 4.953202e-001,
+4.971916e-001, 4.990628e-001, 5.009341e-001, 5.027933e-001, 5.046482e-001, 5.065031e-001, 5.083466e-001, 5.101771e-001, 5.120075e-001, 5.138359e-001,
+5.156533e-001, 5.174707e-001, 5.192881e-001, 5.211005e-001, 5.229117e-001, 5.247229e-001, 5.265293e-001, 5.283295e-001, 5.301297e-001, 5.319294e-001,
+5.337139e-001, 5.354984e-001, 5.372829e-001, 5.390647e-001, 5.408445e-001, 5.426243e-001, 5.444022e-001, 5.461611e-001, 5.479199e-001, 5.496788e-001,
+5.514247e-001, 5.531605e-001, 5.548964e-001, 5.566322e-001, 5.583571e-001, 5.600819e-001, 5.618068e-001, 5.635148e-001, 5.651975e-001, 5.668801e-001,
+5.685628e-001, 5.702366e-001, 5.719075e-001, 5.735785e-001, 5.752487e-001, 5.769107e-001, 5.785727e-001, 5.802346e-001, 5.818874e-001, 5.835234e-001,
+5.851594e-001, 5.867954e-001, 5.884161e-001, 5.900264e-001, 5.916366e-001, 5.932468e-001, 5.948414e-001, 5.964319e-001, 5.980223e-001, 5.996128e-001,
+6.011690e-001, 6.027232e-001, 6.042774e-001, 6.058307e-001, 6.073688e-001, 6.089070e-001, 6.104451e-001, 6.119817e-001, 6.135081e-001, 6.150345e-001,
+6.165609e-001, 6.180860e-001, 6.196046e-001, 6.211233e-001, 6.226419e-001, 6.241582e-001, 6.256613e-001, 6.271645e-001, 6.286676e-001, 6.301685e-001,
+6.316462e-001, 6.331239e-001, 6.346017e-001, 6.360794e-001, 6.375384e-001, 6.389972e-001, 6.404560e-001, 6.419148e-001, 6.433645e-001, 6.448125e-001,
+6.462605e-001, 6.477085e-001, 6.491544e-001, 6.505993e-001, 6.520442e-001, 6.534891e-001, 6.549305e-001, 6.563671e-001, 6.578037e-001, 6.592403e-001,
+6.606747e-001, 6.620953e-001, 6.635159e-001, 6.649365e-001, 6.663571e-001, 6.677600e-001, 6.691588e-001, 6.705575e-001, 6.719563e-001, 6.733427e-001,
+6.747133e-001, 6.760839e-001, 6.774544e-001, 6.788250e-001, 6.801914e-001, 6.815579e-001, 6.829244e-001, 6.842909e-001, 6.856526e-001, 6.870101e-001,
+6.883677e-001, 6.897252e-001, 6.910821e-001, 6.924132e-001, 6.937443e-001, 6.950754e-001, 6.964065e-001, 6.977305e-001, 6.990461e-001, 7.003617e-001,
+7.016773e-001, 7.029929e-001, 7.043046e-001, 7.056154e-001, 7.069262e-001, 7.082371e-001, 7.095442e-001, 7.108336e-001, 7.121230e-001, 7.134124e-001,
+7.147018e-001, 7.159799e-001, 7.172445e-001, 7.185090e-001, 7.197736e-001, 7.210381e-001, 7.222944e-001, 7.235469e-001, 7.247993e-001, 7.260518e-001,
+7.273042e-001, 7.285580e-001, 7.298120e-001, 7.310661e-001, 7.323201e-001, 7.335741e-001, 7.348139e-001, 7.360535e-001, 7.372932e-001, 7.385329e-001,
+7.397707e-001, 7.409820e-001, 7.421933e-001, 7.434047e-001, 7.446160e-001, 7.458250e-001, 7.470090e-001, 7.481931e-001, 7.493771e-001, 7.505611e-001,
+7.517436e-001, 7.528991e-001, 7.540546e-001, 7.552101e-001, 7.563656e-001, 7.575211e-001, 7.586535e-001, 7.597849e-001, 7.609164e-001, 7.620479e-001,
+7.631794e-001, 7.643040e-001, 7.654271e-001, 7.665502e-001, 7.676733e-001, 7.687965e-001, 7.699063e-001, 7.710080e-001, 7.721098e-001, 7.732116e-001,
+7.743133e-001, 7.754092e-001, 7.764948e-001, 7.775804e-001, 7.786661e-001, 7.797517e-001, 7.808366e-001, 7.819091e-001, 7.829816e-001, 7.840540e-001,
+7.851265e-001, 7.861990e-001, 7.872559e-001, 7.883058e-001, 7.893556e-001, 7.904054e-001, 7.914553e-001, 7.924998e-001, 7.935290e-001, 7.945583e-001,
+7.955875e-001, 7.966168e-001, 7.976460e-001, 7.986531e-001, 7.996535e-001, 8.006539e-001, 8.016543e-001, 8.026548e-001, 8.036468e-001, 8.046096e-001,
+8.055725e-001, 8.065354e-001, 8.074983e-001, 8.084612e-001, 8.094077e-001, 8.103441e-001, 8.112805e-001, 8.122169e-001, 8.131533e-001, 8.140897e-001,
+8.150095e-001, 8.159284e-001, 8.168473e-001, 8.177662e-001, 8.186851e-001, 8.195986e-001, 8.204927e-001, 8.213869e-001, 8.222811e-001, 8.231752e-001,
+8.240694e-001, 8.249510e-001, 8.258158e-001, 8.266806e-001, 8.275455e-001, 8.284103e-001, 8.292751e-001, 8.301309e-001, 8.309800e-001, 8.318291e-001,
+8.326781e-001, 8.335272e-001, 8.343763e-001, 8.352112e-001, 8.360387e-001, 8.368662e-001, 8.376937e-001, 8.385212e-001, 8.393487e-001, 8.401601e-001,
+8.409640e-001, 8.417678e-001, 8.425716e-001, 8.433754e-001, 8.441792e-001, 8.449678e-001, 8.457477e-001, 8.465276e-001, 8.473075e-001, 8.480874e-001,
+8.488672e-001, 8.496319e-001, 8.503824e-001, 8.511330e-001, 8.518835e-001, 8.526341e-001, 8.533847e-001, 8.541217e-001, 8.548329e-001, 8.555440e-001,
+8.562552e-001, 8.569663e-001, 8.576774e-001, 8.583873e-001, 8.590851e-001, 8.597828e-001, 8.604806e-001, 8.611784e-001, 8.618762e-001, 8.625740e-001,
+8.632514e-001, 8.639233e-001, 8.645952e-001, 8.652671e-001, 8.659390e-001, 8.666109e-001, 8.672789e-001, 8.679411e-001, 8.686033e-001, 8.692654e-001,
+8.699276e-001, 8.705898e-001, 8.712519e-001, 8.719060e-001, 8.725597e-001, 8.732133e-001, 8.738670e-001, 8.745207e-001, 8.751743e-001, 8.758152e-001,
+8.764393e-001, 8.770634e-001, 8.776875e-001, 8.783117e-001, 8.789358e-001, 8.795599e-001, 8.801736e-001, 8.807854e-001, 8.813971e-001, 8.820089e-001,
+8.826206e-001, 8.832324e-001, 8.838424e-001, 8.844445e-001, 8.850466e-001, 8.856487e-001, 8.862508e-001, 8.868529e-001, 8.874550e-001, 8.880429e-001,
+8.886129e-001, 8.891829e-001, 8.897530e-001, 8.903230e-001, 8.908931e-001, 8.914631e-001, 8.920254e-001, 8.925834e-001, 8.931414e-001, 8.936994e-001,
+8.942574e-001, 8.948153e-001, 8.953733e-001, 8.959251e-001, 8.964748e-001, 8.970246e-001, 8.975743e-001, 8.981241e-001, 8.986738e-001, 8.992236e-001,
+8.997610e-001, 9.002953e-001, 9.008296e-001, 9.013640e-001, 9.018983e-001, 9.024326e-001, 9.029669e-001, 9.034835e-001, 9.039947e-001, 9.045059e-001,
+9.050171e-001, 9.055283e-001, 9.060395e-001, 9.065507e-001, 9.070444e-001, 9.075291e-001, 9.080138e-001, 9.084984e-001, 9.089831e-001, 9.094678e-001,
+9.099525e-001, 9.104329e-001, 9.109085e-001, 9.113841e-001, 9.118597e-001, 9.123352e-001, 9.128108e-001, 9.132864e-001, 9.137566e-001, 9.142068e-001,
+9.146569e-001, 9.151071e-001, 9.155572e-001, 9.160074e-001, 9.164575e-001, 9.169077e-001, 9.173452e-001, 9.177808e-001, 9.182164e-001, 9.186520e-001,
+9.190875e-001, 9.195231e-001, 9.199587e-001, 9.203907e-001, 9.208181e-001, 9.212455e-001, 9.216730e-001, 9.221004e-001, 9.225278e-001, 9.229553e-001,
+9.233827e-001, 9.237879e-001, 9.241919e-001, 9.245959e-001, 9.249998e-001, 9.254038e-001, 9.258078e-001, 9.262118e-001, 9.266104e-001, 9.269998e-001,
+9.273892e-001, 9.277786e-001, 9.281680e-001, 9.285574e-001, 9.289468e-001, 9.293362e-001, 9.297145e-001, 9.300879e-001, 9.304613e-001, 9.308347e-001,
+9.312081e-001, 9.315815e-001, 9.319549e-001, 9.323283e-001, 9.326866e-001, 9.330440e-001, 9.334015e-001, 9.337590e-001, 9.341165e-001, 9.344740e-001,
+9.348315e-001, 9.351881e-001, 9.355377e-001, 9.358874e-001, 9.362371e-001, 9.365867e-001, 9.369364e-001, 9.372861e-001, 9.376358e-001, 9.379813e-001,
+9.383107e-001, 9.386400e-001, 9.389693e-001, 9.392986e-001, 9.396280e-001, 9.399573e-001, 9.402866e-001, 9.406143e-001, 9.409354e-001, 9.412565e-001,
+9.415775e-001, 9.418986e-001, 9.422197e-001, 9.425407e-001, 9.428618e-001, 9.431818e-001, 9.434933e-001, 9.438048e-001, 9.441162e-001, 9.444277e-001,
+9.447392e-001, 9.450506e-001, 9.453621e-001, 9.456736e-001, 9.459662e-001, 9.462575e-001, 9.465487e-001, 9.468400e-001, 9.471312e-001, 9.474225e-001,
+9.477137e-001, 9.480050e-001, 9.482977e-001, 9.485910e-001, 9.488844e-001, 9.491778e-001, 9.494712e-001, 9.497646e-001, 9.500580e-001, 9.503514e-001,
+9.506422e-001, 9.509275e-001, 9.512127e-001, 9.514980e-001, 9.517832e-001, 9.520685e-001, 9.523537e-001, 9.526389e-001, 9.529242e-001, 9.532032e-001,
+9.534811e-001, 9.537591e-001, 9.540371e-001, 9.543150e-001, 9.545930e-001, 9.548710e-001, 9.551490e-001, 9.554250e-001, 9.556970e-001, 9.559690e-001,
+9.562411e-001, 9.565131e-001, 9.567851e-001, 9.570571e-001, 9.573291e-001, 9.576012e-001, 9.578632e-001, 9.581208e-001, 9.583784e-001, 9.586360e-001,
+9.588936e-001, 9.591512e-001, 9.594088e-001, 9.596664e-001, 9.599240e-001, 9.601871e-001, 9.604503e-001, 9.607136e-001, 9.609769e-001, 9.612401e-001,
+9.615034e-001, 9.617667e-001, 9.620299e-001, 9.622897e-001, 9.625296e-001, 9.627695e-001, 9.630094e-001, 9.632493e-001, 9.634892e-001, 9.637291e-001,
+9.639689e-001, 9.642088e-001, 9.644484e-001, 9.646872e-001, 9.649259e-001, 9.651646e-001, 9.654033e-001, 9.656420e-001, 9.658808e-001, 9.661195e-001,
+9.663582e-001, 9.665972e-001, 9.668370e-001, 9.670769e-001, 9.673168e-001, 9.675567e-001, 9.677965e-001, 9.680364e-001, 9.682763e-001, 9.685161e-001,
+9.687551e-001, 9.689875e-001, 9.692199e-001, 9.694522e-001, 9.696846e-001, 9.699169e-001, 9.701493e-001, 9.703816e-001, 9.706140e-001, 9.708464e-001,
+9.710645e-001, 9.712812e-001, 9.714978e-001, 9.717145e-001, 9.719312e-001, 9.721479e-001, 9.723646e-001, 9.725812e-001, 9.727979e-001, 9.730128e-001,
+9.732266e-001, 9.734403e-001, 9.736540e-001, 9.738677e-001, 9.740815e-001, 9.742952e-001, 9.745089e-001, 9.747227e-001, 9.749328e-001, 9.751277e-001,
+9.753227e-001, 9.755176e-001, 9.757125e-001, 9.759075e-001, 9.761024e-001, 9.762974e-001, 9.764923e-001, 9.766872e-001, 9.768774e-001, 9.770654e-001,
+9.772534e-001, 9.774413e-001, 9.776293e-001, 9.778173e-001, 9.780053e-001, 9.781932e-001, 9.783812e-001, 9.785689e-001, 9.787534e-001, 9.789379e-001,
+9.791223e-001, 9.793068e-001, 9.794912e-001, 9.796757e-001, 9.798601e-001, 9.800446e-001, 9.802290e-001, 9.804099e-001, 9.805839e-001, 9.807580e-001,
+9.809321e-001, 9.811062e-001, 9.812802e-001, 9.814543e-001, 9.816284e-001, 9.818025e-001, 9.819766e-001, 9.821426e-001, 9.823013e-001, 9.824601e-001,
+9.826188e-001, 9.827776e-001, 9.829363e-001, 9.830951e-001, 9.832538e-001, 9.834125e-001, 9.835713e-001, 9.837297e-001, 9.838878e-001, 9.840460e-001,
+9.842041e-001, 9.843623e-001, 9.845204e-001, 9.846786e-001, 9.848367e-001, 9.849949e-001, 9.851530e-001, 9.853115e-001, 9.854704e-001, 9.856293e-001,
+9.857881e-001, 9.859470e-001, 9.861058e-001, 9.862647e-001, 9.864236e-001, 9.865824e-001, 9.867413e-001, 9.868973e-001, 9.870493e-001, 9.872012e-001,
+9.873532e-001, 9.875052e-001, 9.876572e-001, 9.878092e-001, 9.879612e-001, 9.881131e-001, 9.882651e-001, 9.884156e-001, 9.885584e-001, 9.887011e-001,
+9.888438e-001, 9.889865e-001, 9.891293e-001, 9.892720e-001, 9.894147e-001, 9.895574e-001, 9.897002e-001, 9.898429e-001, 9.899816e-001, 9.901193e-001,
+9.902570e-001, 9.903946e-001, 9.905323e-001, 9.906700e-001, 9.908077e-001, 9.909453e-001, 9.910830e-001, 9.912207e-001, 9.913564e-001, 9.914880e-001,
+9.916195e-001, 9.917510e-001, 9.918825e-001, 9.920140e-001, 9.921455e-001, 9.922770e-001, 9.924085e-001, 9.925400e-001, 9.926715e-001, 9.928074e-001,
+9.929450e-001, 9.930827e-001, 9.932203e-001, 9.933580e-001, 9.934956e-001, 9.936332e-001, 9.937709e-001, 9.939085e-001, 9.940462e-001, 9.941837e-001,
+9.943145e-001, 9.944454e-001, 9.945762e-001, 9.947070e-001, 9.948378e-001, 9.949686e-001, 9.950994e-001, 9.952302e-001, 9.953610e-001, 9.954918e-001,
+9.956233e-001, 9.957579e-001, 9.958926e-001, 9.960272e-001, 9.961619e-001, 9.962965e-001, 9.964311e-001, 9.965658e-001, 9.967004e-001, 9.968351e-001,
+9.969697e-001, 9.971042e-001, 9.972380e-001, 9.973718e-001, 9.975057e-001, 9.976395e-001, 9.977734e-001, 9.979072e-001, 9.980411e-001, 9.981749e-001,
+9.983088e-001, 9.984426e-001, 9.985757e-001, 9.987052e-001, 9.988346e-001, 9.989641e-001, 9.990936e-001, 9.992231e-001, 9.993526e-001, 9.994821e-001,
+9.996115e-001, 9.997410e-001, 9.998705e-001, 1.000000e+000)),
+("Fujifilm", "F-125", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.744984e-002, 3.610750e-002, 5.085345e-002, 6.307431e-002, 7.370553e-002, 8.318998e-002, 9.183368e-002, 9.990757e-002, 1.073999e-001,
+1.143994e-001, 1.210075e-001, 1.272652e-001, 1.332023e-001, 1.389860e-001, 1.446686e-001, 1.502208e-001, 1.556082e-001, 1.608344e-001, 1.659597e-001,
+1.709611e-001, 1.758396e-001, 1.805783e-001, 1.851566e-001, 1.896200e-001, 1.940072e-001, 1.983579e-001, 2.026146e-001, 2.068162e-001, 2.109510e-001,
+2.149750e-001, 2.188792e-001, 2.226789e-001, 2.264376e-001, 2.301400e-001, 2.337515e-001, 2.373262e-001, 2.408698e-001, 2.443857e-001, 2.478294e-001,
+2.511906e-001, 2.545030e-001, 2.577551e-001, 2.609706e-001, 2.641761e-001, 2.673386e-001, 2.704798e-001, 2.735693e-001, 2.766305e-001, 2.796724e-001,
+2.826832e-001, 2.856606e-001, 2.885997e-001, 2.914835e-001, 2.943135e-001, 2.971065e-001, 2.998841e-001, 3.026126e-001, 3.053068e-001, 3.079755e-001,
+3.106072e-001, 3.132098e-001, 3.157896e-001, 3.183388e-001, 3.208618e-001, 3.233729e-001, 3.258589e-001, 3.283307e-001, 3.308002e-001, 3.332616e-001,
+3.356887e-001, 3.380911e-001, 3.404774e-001, 3.428532e-001, 3.452278e-001, 3.475916e-001, 3.499328e-001, 3.522517e-001, 3.545555e-001, 3.568529e-001,
+3.591203e-001, 3.613556e-001, 3.635645e-001, 3.657539e-001, 3.679294e-001, 3.700732e-001, 3.722013e-001, 3.743169e-001, 3.764213e-001, 3.785130e-001,
+3.805955e-001, 3.826781e-001, 3.847547e-001, 3.867942e-001, 3.888105e-001, 3.908145e-001, 3.928089e-001, 3.947995e-001, 3.967805e-001, 3.987524e-001,
+4.007174e-001, 4.026708e-001, 4.046144e-001, 4.065484e-001, 4.084820e-001, 4.104150e-001, 4.123413e-001, 4.142560e-001, 4.161522e-001, 4.180340e-001,
+4.199068e-001, 4.217524e-001, 4.235874e-001, 4.254118e-001, 4.272232e-001, 4.290307e-001, 4.308294e-001, 4.326210e-001, 4.344018e-001, 4.361708e-001,
+4.379334e-001, 4.396810e-001, 4.414246e-001, 4.431431e-001, 4.448565e-001, 4.465528e-001, 4.482432e-001, 4.499239e-001, 4.515937e-001, 4.532520e-001,
+4.548969e-001, 4.565317e-001, 4.581527e-001, 4.597655e-001, 4.613633e-001, 4.629531e-001, 4.645408e-001, 4.661273e-001, 4.677077e-001, 4.692843e-001,
+4.708592e-001, 4.724325e-001, 4.739957e-001, 4.755469e-001, 4.770910e-001, 4.786213e-001, 4.801476e-001, 4.816561e-001, 4.831645e-001, 4.846527e-001,
+4.861407e-001, 4.876180e-001, 4.890920e-001, 4.905653e-001, 4.920378e-001, 4.935062e-001, 4.949602e-001, 4.964141e-001, 4.978365e-001, 4.992553e-001,
+5.006621e-001, 5.020588e-001, 5.034534e-001, 5.048361e-001, 5.062187e-001, 5.075957e-001, 5.089704e-001, 5.103421e-001, 5.117047e-001, 5.130673e-001,
+5.144176e-001, 5.157638e-001, 5.171049e-001, 5.184270e-001, 5.197492e-001, 5.210538e-001, 5.223483e-001, 5.236423e-001, 5.249115e-001, 5.261808e-001,
+5.274490e-001, 5.287155e-001, 5.299820e-001, 5.312492e-001, 5.325168e-001, 5.337844e-001, 5.350343e-001, 5.362829e-001, 5.375290e-001, 5.387613e-001,
+5.399936e-001, 5.412209e-001, 5.424384e-001, 5.436559e-001, 5.448678e-001, 5.460735e-001, 5.472793e-001, 5.484791e-001, 5.496747e-001, 5.508702e-001,
+5.520611e-001, 5.532493e-001, 5.544374e-001, 5.556218e-001, 5.568041e-001, 5.579863e-001, 5.591588e-001, 5.603247e-001, 5.614907e-001, 5.626431e-001,
+5.637830e-001, 5.649230e-001, 5.660512e-001, 5.671615e-001, 5.682718e-001, 5.693791e-001, 5.704758e-001, 5.715726e-001, 5.726693e-001, 5.737720e-001,
+5.748748e-001, 5.759775e-001, 5.770761e-001, 5.781732e-001, 5.792703e-001, 5.803601e-001, 5.814398e-001, 5.825194e-001, 5.835988e-001, 5.846728e-001,
+5.857469e-001, 5.868209e-001, 5.878757e-001, 5.889193e-001, 5.899628e-001, 5.910036e-001, 5.920301e-001, 5.930567e-001, 5.940833e-001, 5.950983e-001,
+5.961067e-001, 5.971152e-001, 5.981239e-001, 5.991357e-001, 6.001476e-001, 6.011594e-001, 6.021643e-001, 6.031603e-001, 6.041564e-001, 6.051524e-001,
+6.061364e-001, 6.071165e-001, 6.080966e-001, 6.090765e-001, 6.100435e-001, 6.110105e-001, 6.119775e-001, 6.129397e-001, 6.138860e-001, 6.148323e-001,
+6.157786e-001, 6.167213e-001, 6.176583e-001, 6.185953e-001, 6.195323e-001, 6.204635e-001, 6.213885e-001, 6.223134e-001, 6.232383e-001, 6.241629e-001,
+6.250872e-001, 6.260114e-001, 6.269357e-001, 6.278558e-001, 6.287717e-001, 6.296875e-001, 6.306034e-001, 6.315114e-001, 6.324080e-001, 6.333046e-001,
+6.342011e-001, 6.350932e-001, 6.359727e-001, 6.368522e-001, 6.377317e-001, 6.386105e-001, 6.394773e-001, 6.403442e-001, 6.412110e-001, 6.420779e-001,
+6.429409e-001, 6.438030e-001, 6.446650e-001, 6.455270e-001, 6.463868e-001, 6.472438e-001, 6.481008e-001, 6.489578e-001, 6.498141e-001, 6.506562e-001,
+6.514983e-001, 6.523405e-001, 6.531826e-001, 6.540184e-001, 6.548498e-001, 6.556812e-001, 6.565125e-001, 6.573434e-001, 6.581645e-001, 6.589856e-001,
+6.598067e-001, 6.606278e-001, 6.614432e-001, 6.622518e-001, 6.630604e-001, 6.638690e-001, 6.646776e-001, 6.654757e-001, 6.662709e-001, 6.670661e-001,
+6.678613e-001, 6.686562e-001, 6.694442e-001, 6.702322e-001, 6.710202e-001, 6.718082e-001, 6.725955e-001, 6.733806e-001, 6.741657e-001, 6.749507e-001,
+6.757358e-001, 6.765164e-001, 6.772890e-001, 6.780615e-001, 6.788341e-001, 6.796066e-001, 6.803762e-001, 6.811413e-001, 6.819063e-001, 6.826714e-001,
+6.834365e-001, 6.841985e-001, 6.849552e-001, 6.857119e-001, 6.864687e-001, 6.872254e-001, 6.879792e-001, 6.887252e-001, 6.894711e-001, 6.902171e-001,
+6.909630e-001, 6.917080e-001, 6.924436e-001, 6.931793e-001, 6.939149e-001, 6.946505e-001, 6.953861e-001, 6.961168e-001, 6.968465e-001, 6.975763e-001,
+6.983060e-001, 6.990358e-001, 6.997651e-001, 7.004940e-001, 7.012230e-001, 7.019519e-001, 7.026809e-001, 7.034089e-001, 7.041272e-001, 7.048455e-001,
+7.055638e-001, 7.062822e-001, 7.070005e-001, 7.077153e-001, 7.084275e-001, 7.091398e-001, 7.098521e-001, 7.105644e-001, 7.112766e-001, 7.119773e-001,
+7.126780e-001, 7.133788e-001, 7.140795e-001, 7.147803e-001, 7.154779e-001, 7.161696e-001, 7.168614e-001, 7.175531e-001, 7.182449e-001, 7.189366e-001,
+7.196236e-001, 7.203075e-001, 7.209914e-001, 7.216753e-001, 7.223593e-001, 7.230432e-001, 7.237169e-001, 7.243875e-001, 7.250582e-001, 7.257289e-001,
+7.263996e-001, 7.270702e-001, 7.277340e-001, 7.283965e-001, 7.290591e-001, 7.297216e-001, 7.303842e-001, 7.310467e-001, 7.317049e-001, 7.323622e-001,
+7.330196e-001, 7.336769e-001, 7.343343e-001, 7.349916e-001, 7.356425e-001, 7.362912e-001, 7.369398e-001, 7.375885e-001, 7.382372e-001, 7.388859e-001,
+7.395280e-001, 7.401650e-001, 7.408020e-001, 7.414390e-001, 7.420759e-001, 7.427129e-001, 7.433465e-001, 7.439709e-001, 7.445953e-001, 7.452197e-001,
+7.458442e-001, 7.464686e-001, 7.470930e-001, 7.477156e-001, 7.483380e-001, 7.489604e-001, 7.495828e-001, 7.502052e-001, 7.508276e-001, 7.514471e-001,
+7.520625e-001, 7.526780e-001, 7.532935e-001, 7.539089e-001, 7.545244e-001, 7.551399e-001, 7.557541e-001, 7.563681e-001, 7.569821e-001, 7.575962e-001,
+7.582102e-001, 7.588242e-001, 7.594367e-001, 7.600428e-001, 7.606488e-001, 7.612549e-001, 7.618610e-001, 7.624670e-001, 7.630731e-001, 7.636763e-001,
+7.642757e-001, 7.648751e-001, 7.654744e-001, 7.660738e-001, 7.666732e-001, 7.672725e-001, 7.678693e-001, 7.684640e-001, 7.690587e-001, 7.696535e-001,
+7.702482e-001, 7.708429e-001, 7.714376e-001, 7.720239e-001, 7.726042e-001, 7.731845e-001, 7.737648e-001, 7.743451e-001, 7.749254e-001, 7.755057e-001,
+7.760874e-001, 7.766704e-001, 7.772535e-001, 7.778365e-001, 7.784196e-001, 7.790026e-001, 7.795857e-001, 7.801664e-001, 7.807425e-001, 7.813186e-001,
+7.818947e-001, 7.824708e-001, 7.830468e-001, 7.836229e-001, 7.841988e-001, 7.847699e-001, 7.853411e-001, 7.859122e-001, 7.864833e-001, 7.870545e-001,
+7.876256e-001, 7.881967e-001, 7.887654e-001, 7.893327e-001, 7.899000e-001, 7.904673e-001, 7.910346e-001, 7.916019e-001, 7.921692e-001, 7.927351e-001,
+7.932926e-001, 7.938501e-001, 7.944076e-001, 7.949651e-001, 7.955227e-001, 7.960802e-001, 7.966377e-001, 7.971892e-001, 7.977351e-001, 7.982811e-001,
+7.988271e-001, 7.993731e-001, 7.999191e-001, 8.004651e-001, 8.010110e-001, 8.015481e-001, 8.020828e-001, 8.026175e-001, 8.031522e-001, 8.036869e-001,
+8.042216e-001, 8.047562e-001, 8.052909e-001, 8.058195e-001, 8.063477e-001, 8.068759e-001, 8.074041e-001, 8.079322e-001, 8.084604e-001, 8.089886e-001,
+8.095168e-001, 8.100429e-001, 8.105689e-001, 8.110949e-001, 8.116210e-001, 8.121470e-001, 8.126730e-001, 8.131991e-001, 8.137251e-001, 8.142498e-001,
+8.147744e-001, 8.152990e-001, 8.158236e-001, 8.163481e-001, 8.168727e-001, 8.173973e-001, 8.179219e-001, 8.184442e-001, 8.189655e-001, 8.194869e-001,
+8.200082e-001, 8.205295e-001, 8.210508e-001, 8.215722e-001, 8.220935e-001, 8.226118e-001, 8.231247e-001, 8.236376e-001, 8.241505e-001, 8.246634e-001,
+8.251762e-001, 8.256891e-001, 8.262020e-001, 8.267149e-001, 8.272214e-001, 8.277271e-001, 8.282329e-001, 8.287386e-001, 8.292444e-001, 8.297502e-001,
+8.302559e-001, 8.307617e-001, 8.312665e-001, 8.317692e-001, 8.322720e-001, 8.327747e-001, 8.332775e-001, 8.337802e-001, 8.342830e-001, 8.347858e-001,
+8.352885e-001, 8.357870e-001, 8.362828e-001, 8.367785e-001, 8.372743e-001, 8.377701e-001, 8.382658e-001, 8.387616e-001, 8.392574e-001, 8.397531e-001,
+8.402497e-001, 8.407465e-001, 8.412433e-001, 8.417401e-001, 8.422369e-001, 8.427337e-001, 8.432304e-001, 8.437272e-001, 8.442240e-001, 8.447151e-001,
+8.452049e-001, 8.456946e-001, 8.461843e-001, 8.466740e-001, 8.471637e-001, 8.476534e-001, 8.481432e-001, 8.486329e-001, 8.491188e-001, 8.496030e-001,
+8.500873e-001, 8.505715e-001, 8.510558e-001, 8.515400e-001, 8.520243e-001, 8.525085e-001, 8.529928e-001, 8.534750e-001, 8.539547e-001, 8.544344e-001,
+8.549141e-001, 8.553938e-001, 8.558735e-001, 8.563532e-001, 8.568329e-001, 8.573125e-001, 8.577918e-001, 8.582650e-001, 8.587383e-001, 8.592115e-001,
+8.596848e-001, 8.601580e-001, 8.606313e-001, 8.611046e-001, 8.615778e-001, 8.620511e-001, 8.625226e-001, 8.629927e-001, 8.634628e-001, 8.639330e-001,
+8.644031e-001, 8.648732e-001, 8.653433e-001, 8.658134e-001, 8.662836e-001, 8.667537e-001, 8.672151e-001, 8.676755e-001, 8.681359e-001, 8.685963e-001,
+8.690567e-001, 8.695171e-001, 8.699775e-001, 8.704379e-001, 8.708983e-001, 8.713576e-001, 8.718056e-001, 8.722537e-001, 8.727017e-001, 8.731498e-001,
+8.735978e-001, 8.740459e-001, 8.744939e-001, 8.749419e-001, 8.753900e-001, 8.758367e-001, 8.762752e-001, 8.767136e-001, 8.771521e-001, 8.775905e-001,
+8.780290e-001, 8.784674e-001, 8.789059e-001, 8.793443e-001, 8.797828e-001, 8.802210e-001, 8.806513e-001, 8.810817e-001, 8.815121e-001, 8.819424e-001,
+8.823728e-001, 8.828032e-001, 8.832335e-001, 8.836639e-001, 8.840943e-001, 8.845247e-001, 8.849477e-001, 8.853686e-001, 8.857896e-001, 8.862105e-001,
+8.866315e-001, 8.870524e-001, 8.874734e-001, 8.878943e-001, 8.883153e-001, 8.887362e-001, 8.891550e-001, 8.895699e-001, 8.899849e-001, 8.903999e-001,
+8.908148e-001, 8.912298e-001, 8.916448e-001, 8.920598e-001, 8.924747e-001, 8.928897e-001, 8.933047e-001, 8.937179e-001, 8.941306e-001, 8.945433e-001,
+8.949561e-001, 8.953688e-001, 8.957816e-001, 8.961943e-001, 8.966071e-001, 8.970198e-001, 8.974326e-001, 8.978449e-001, 8.982529e-001, 8.986609e-001,
+8.990688e-001, 8.994768e-001, 8.998848e-001, 9.002928e-001, 9.007008e-001, 9.011088e-001, 9.015168e-001, 9.019247e-001, 9.023322e-001, 9.027375e-001,
+9.031428e-001, 9.035481e-001, 9.039534e-001, 9.043587e-001, 9.047640e-001, 9.051693e-001, 9.055746e-001, 9.059799e-001, 9.063852e-001, 9.067893e-001,
+9.071873e-001, 9.075853e-001, 9.079833e-001, 9.083813e-001, 9.087793e-001, 9.091774e-001, 9.095754e-001, 9.099734e-001, 9.103714e-001, 9.107694e-001,
+9.111674e-001, 9.115555e-001, 9.119431e-001, 9.123308e-001, 9.127184e-001, 9.131061e-001, 9.134937e-001, 9.138813e-001, 9.142690e-001, 9.146566e-001,
+9.150443e-001, 9.154319e-001, 9.158164e-001, 9.161985e-001, 9.165807e-001, 9.169628e-001, 9.173450e-001, 9.177272e-001, 9.181093e-001, 9.184915e-001,
+9.188736e-001, 9.192558e-001, 9.196380e-001, 9.200200e-001, 9.203977e-001, 9.207755e-001, 9.211533e-001, 9.215311e-001, 9.219088e-001, 9.222866e-001,
+9.226644e-001, 9.230421e-001, 9.234199e-001, 9.237977e-001, 9.241755e-001, 9.245520e-001, 9.249257e-001, 9.252995e-001, 9.256732e-001, 9.260470e-001,
+9.264207e-001, 9.267945e-001, 9.271683e-001, 9.275420e-001, 9.279158e-001, 9.282895e-001, 9.286633e-001, 9.290362e-001, 9.294081e-001, 9.297800e-001,
+9.301519e-001, 9.305237e-001, 9.308956e-001, 9.312675e-001, 9.316394e-001, 9.320112e-001, 9.323831e-001, 9.327550e-001, 9.331269e-001, 9.334966e-001,
+9.338625e-001, 9.342283e-001, 9.345941e-001, 9.349600e-001, 9.353258e-001, 9.356916e-001, 9.360575e-001, 9.364233e-001, 9.367891e-001, 9.371550e-001,
+9.375208e-001, 9.378861e-001, 9.382457e-001, 9.386053e-001, 9.389649e-001, 9.393245e-001, 9.396841e-001, 9.400437e-001, 9.404033e-001, 9.407629e-001,
+9.411225e-001, 9.414821e-001, 9.418417e-001, 9.422013e-001, 9.425579e-001, 9.429130e-001, 9.432681e-001, 9.436232e-001, 9.439783e-001, 9.443333e-001,
+9.446884e-001, 9.450435e-001, 9.453986e-001, 9.457537e-001, 9.461087e-001, 9.464638e-001, 9.468188e-001, 9.471714e-001, 9.475240e-001, 9.478766e-001,
+9.482291e-001, 9.485817e-001, 9.489343e-001, 9.492869e-001, 9.496395e-001, 9.499921e-001, 9.503447e-001, 9.506972e-001, 9.510498e-001, 9.514018e-001,
+9.517516e-001, 9.521014e-001, 9.524511e-001, 9.528009e-001, 9.531507e-001, 9.535005e-001, 9.538503e-001, 9.542001e-001, 9.545499e-001, 9.548997e-001,
+9.552494e-001, 9.555992e-001, 9.559475e-001, 9.562902e-001, 9.566329e-001, 9.569757e-001, 9.573184e-001, 9.576611e-001, 9.580039e-001, 9.583466e-001,
+9.586893e-001, 9.590321e-001, 9.593748e-001, 9.597175e-001, 9.600602e-001, 9.604027e-001, 9.607350e-001, 9.610672e-001, 9.613995e-001, 9.617317e-001,
+9.620639e-001, 9.623962e-001, 9.627284e-001, 9.630606e-001, 9.633929e-001, 9.637251e-001, 9.640574e-001, 9.643896e-001, 9.647218e-001, 9.650494e-001,
+9.653743e-001, 9.656992e-001, 9.660241e-001, 9.663490e-001, 9.666739e-001, 9.669988e-001, 9.673237e-001, 9.676485e-001, 9.679734e-001, 9.682983e-001,
+9.686232e-001, 9.689481e-001, 9.692728e-001, 9.695921e-001, 9.699113e-001, 9.702306e-001, 9.705499e-001, 9.708692e-001, 9.711884e-001, 9.715077e-001,
+9.718270e-001, 9.721462e-001, 9.724655e-001, 9.727848e-001, 9.731040e-001, 9.734233e-001, 9.737419e-001, 9.740585e-001, 9.743750e-001, 9.746916e-001,
+9.750081e-001, 9.753246e-001, 9.756412e-001, 9.759577e-001, 9.762743e-001, 9.765908e-001, 9.769073e-001, 9.772239e-001, 9.775404e-001, 9.778569e-001,
+9.781731e-001, 9.784878e-001, 9.788025e-001, 9.791172e-001, 9.794320e-001, 9.797467e-001, 9.800614e-001, 9.803761e-001, 9.806909e-001, 9.810056e-001,
+9.813203e-001, 9.816350e-001, 9.819498e-001, 9.822645e-001, 9.825791e-001, 9.828889e-001, 9.831986e-001, 9.835083e-001, 9.838181e-001, 9.841278e-001,
+9.844375e-001, 9.847472e-001, 9.850570e-001, 9.853667e-001, 9.856764e-001, 9.859862e-001, 9.862959e-001, 9.866056e-001, 9.869154e-001, 9.872200e-001,
+9.875210e-001, 9.878221e-001, 9.881231e-001, 9.884241e-001, 9.887252e-001, 9.890262e-001, 9.893273e-001, 9.896283e-001, 9.899294e-001, 9.902304e-001,
+9.905314e-001, 9.908325e-001, 9.911335e-001, 9.914346e-001, 9.917227e-001, 9.920100e-001, 9.922973e-001, 9.925847e-001, 9.928720e-001, 9.931594e-001,
+9.934467e-001, 9.937341e-001, 9.940214e-001, 9.943088e-001, 9.945961e-001, 9.948835e-001, 9.951708e-001, 9.954582e-001, 9.957452e-001, 9.960289e-001,
+9.963125e-001, 9.965962e-001, 9.968798e-001, 9.971635e-001, 9.974471e-001, 9.977308e-001, 9.980144e-001, 9.982981e-001, 9.985817e-001, 9.988654e-001,
+9.991490e-001, 9.994327e-001, 9.997163e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.589848e-002, 3.008926e-002, 4.133880e-002, 5.118210e-002, 5.956894e-002, 6.707625e-002, 7.394204e-002, 8.035869e-002, 8.635868e-002,
+9.195138e-002, 9.721318e-002, 1.023329e-001, 1.073141e-001, 1.120810e-001, 1.166312e-001, 1.210202e-001, 1.252893e-001, 1.294762e-001, 1.336128e-001,
+1.376407e-001, 1.415354e-001, 1.453580e-001, 1.491020e-001, 1.527583e-001, 1.563414e-001, 1.599266e-001, 1.634612e-001, 1.669550e-001, 1.704288e-001,
+1.738846e-001, 1.773295e-001, 1.807734e-001, 1.841789e-001, 1.875509e-001, 1.908916e-001, 1.941868e-001, 1.974609e-001, 2.007011e-001, 2.038741e-001,
+2.069950e-001, 2.100717e-001, 2.130948e-001, 2.161157e-001, 2.191050e-001, 2.220420e-001, 2.249206e-001, 2.277641e-001, 2.305578e-001, 2.333119e-001,
+2.360485e-001, 2.387614e-001, 2.414369e-001, 2.441027e-001, 2.467697e-001, 2.494162e-001, 2.520293e-001, 2.546142e-001, 2.571906e-001, 2.597542e-001,
+2.622893e-001, 2.647836e-001, 2.672505e-001, 2.697114e-001, 2.721552e-001, 2.745686e-001, 2.769568e-001, 2.793405e-001, 2.817173e-001, 2.840747e-001,
+2.864070e-001, 2.887320e-001, 2.910597e-001, 2.933830e-001, 2.956912e-001, 2.979754e-001, 3.002284e-001, 3.024463e-001, 3.046588e-001, 3.068628e-001,
+3.090505e-001, 3.112153e-001, 3.133526e-001, 3.154605e-001, 3.175631e-001, 3.196572e-001, 3.217284e-001, 3.237737e-001, 3.257967e-001, 3.278082e-001,
+3.298071e-001, 3.317958e-001, 3.337771e-001, 3.357304e-001, 3.376703e-001, 3.396002e-001, 3.415268e-001, 3.434461e-001, 3.453573e-001, 3.472534e-001,
+3.491293e-001, 3.509948e-001, 3.528489e-001, 3.546791e-001, 3.565005e-001, 3.583168e-001, 3.601279e-001, 3.619349e-001, 3.637281e-001, 3.655182e-001,
+3.673050e-001, 3.690750e-001, 3.708429e-001, 3.726145e-001, 3.743841e-001, 3.761518e-001, 3.779004e-001, 3.796432e-001, 3.813721e-001, 3.830938e-001,
+3.848012e-001, 3.864955e-001, 3.881794e-001, 3.898509e-001, 3.915182e-001, 3.931697e-001, 3.948189e-001, 3.964514e-001, 3.980819e-001, 3.997016e-001,
+4.013179e-001, 4.029235e-001, 4.045227e-001, 4.061067e-001, 4.076886e-001, 4.092662e-001, 4.108398e-001, 4.124050e-001, 4.139650e-001, 4.155120e-001,
+4.170548e-001, 4.185824e-001, 4.201084e-001, 4.216217e-001, 4.231351e-001, 4.246394e-001, 4.261436e-001, 4.276434e-001, 4.291423e-001, 4.306377e-001,
+4.321313e-001, 4.336220e-001, 4.351087e-001, 4.365926e-001, 4.380625e-001, 4.395324e-001, 4.409979e-001, 4.424628e-001, 4.439247e-001, 4.453841e-001,
+4.468389e-001, 4.482731e-001, 4.497072e-001, 4.511240e-001, 4.525361e-001, 4.539421e-001, 4.553369e-001, 4.567318e-001, 4.581159e-001, 4.594987e-001,
+4.608712e-001, 4.622273e-001, 4.635834e-001, 4.649256e-001, 4.662652e-001, 4.676026e-001, 4.689338e-001, 4.702651e-001, 4.715861e-001, 4.729016e-001,
+4.742171e-001, 4.755304e-001, 4.768437e-001, 4.781505e-001, 4.794408e-001, 4.807312e-001, 4.820165e-001, 4.832975e-001, 4.845785e-001, 4.858368e-001,
+4.870883e-001, 4.883398e-001, 4.895804e-001, 4.908204e-001, 4.920595e-001, 4.932896e-001, 4.945197e-001, 4.957481e-001, 4.969693e-001, 4.981905e-001,
+4.994138e-001, 5.006438e-001, 5.018738e-001, 5.030999e-001, 5.043139e-001, 5.055278e-001, 5.067375e-001, 5.079305e-001, 5.091236e-001, 5.103173e-001,
+5.115153e-001, 5.127133e-001, 5.139113e-001, 5.151089e-001, 5.163065e-001, 5.175041e-001, 5.186816e-001, 5.198547e-001, 5.210277e-001, 5.221965e-001,
+5.233624e-001, 5.245283e-001, 5.256924e-001, 5.268526e-001, 5.280128e-001, 5.291729e-001, 5.303236e-001, 5.314744e-001, 5.326252e-001, 5.337677e-001,
+5.349056e-001, 5.360434e-001, 5.371788e-001, 5.383053e-001, 5.394318e-001, 5.405584e-001, 5.416884e-001, 5.428196e-001, 5.439508e-001, 5.450790e-001,
+5.461968e-001, 5.473146e-001, 5.484325e-001, 5.495415e-001, 5.506459e-001, 5.517503e-001, 5.528541e-001, 5.539363e-001, 5.550184e-001, 5.561006e-001,
+5.571806e-001, 5.582564e-001, 5.593321e-001, 5.604079e-001, 5.614696e-001, 5.625220e-001, 5.635744e-001, 5.646268e-001, 5.656727e-001, 5.667169e-001,
+5.677612e-001, 5.688054e-001, 5.698326e-001, 5.708590e-001, 5.718854e-001, 5.729114e-001, 5.739294e-001, 5.749473e-001, 5.759653e-001, 5.769823e-001,
+5.779897e-001, 5.789971e-001, 5.800045e-001, 5.810111e-001, 5.820035e-001, 5.829960e-001, 5.839884e-001, 5.849809e-001, 5.859525e-001, 5.869236e-001,
+5.878946e-001, 5.888656e-001, 5.898336e-001, 5.908009e-001, 5.917682e-001, 5.927355e-001, 5.937000e-001, 5.946627e-001, 5.956255e-001, 5.965882e-001,
+5.975463e-001, 5.984956e-001, 5.994448e-001, 6.003941e-001, 6.013433e-001, 6.022869e-001, 6.032305e-001, 6.041741e-001, 6.051177e-001, 6.060569e-001,
+6.069931e-001, 6.079294e-001, 6.088657e-001, 6.098007e-001, 6.107281e-001, 6.116556e-001, 6.125831e-001, 6.135106e-001, 6.144320e-001, 6.153495e-001,
+6.162670e-001, 6.171844e-001, 6.181019e-001, 6.190115e-001, 6.199212e-001, 6.208308e-001, 6.217405e-001, 6.226496e-001, 6.235577e-001, 6.244658e-001,
+6.253739e-001, 6.262820e-001, 6.271823e-001, 6.280776e-001, 6.289729e-001, 6.298682e-001, 6.307635e-001, 6.316475e-001, 6.325287e-001, 6.334098e-001,
+6.342909e-001, 6.351721e-001, 6.360509e-001, 6.369296e-001, 6.378083e-001, 6.386870e-001, 6.395656e-001, 6.404412e-001, 6.413166e-001, 6.421920e-001,
+6.430674e-001, 6.439428e-001, 6.448049e-001, 6.456660e-001, 6.465271e-001, 6.473882e-001, 6.482493e-001, 6.491037e-001, 6.499567e-001, 6.508097e-001,
+6.516628e-001, 6.525158e-001, 6.533648e-001, 6.542117e-001, 6.550586e-001, 6.559055e-001, 6.567524e-001, 6.575965e-001, 6.584362e-001, 6.592760e-001,
+6.601157e-001, 6.609555e-001, 6.617948e-001, 6.626261e-001, 6.634575e-001, 6.642889e-001, 6.651203e-001, 6.659517e-001, 6.667771e-001, 6.675990e-001,
+6.684209e-001, 6.692429e-001, 6.700648e-001, 6.708840e-001, 6.716861e-001, 6.724883e-001, 6.732905e-001, 6.740926e-001, 6.748948e-001, 6.756910e-001,
+6.764827e-001, 6.772743e-001, 6.780659e-001, 6.788576e-001, 6.796492e-001, 6.804392e-001, 6.812291e-001, 6.820190e-001, 6.828088e-001, 6.835987e-001,
+6.843873e-001, 6.851689e-001, 6.859505e-001, 6.867322e-001, 6.875138e-001, 6.882954e-001, 6.890760e-001, 6.898545e-001, 6.906331e-001, 6.914116e-001,
+6.921901e-001, 6.929686e-001, 6.937433e-001, 6.945124e-001, 6.952815e-001, 6.960507e-001, 6.968198e-001, 6.975889e-001, 6.983529e-001, 6.991090e-001,
+6.998651e-001, 7.006212e-001, 7.013773e-001, 7.021334e-001, 7.028859e-001, 7.036299e-001, 7.043739e-001, 7.051178e-001, 7.058618e-001, 7.066058e-001,
+7.073493e-001, 7.080891e-001, 7.088290e-001, 7.095689e-001, 7.103087e-001, 7.110486e-001, 7.117884e-001, 7.125199e-001, 7.132497e-001, 7.139794e-001,
+7.147092e-001, 7.154390e-001, 7.161687e-001, 7.168960e-001, 7.176202e-001, 7.183444e-001, 7.190686e-001, 7.197928e-001, 7.205170e-001, 7.212412e-001,
+7.219575e-001, 7.226737e-001, 7.233898e-001, 7.241060e-001, 7.248222e-001, 7.255384e-001, 7.262522e-001, 7.269627e-001, 7.276733e-001, 7.283839e-001,
+7.290944e-001, 7.298050e-001, 7.305155e-001, 7.312165e-001, 7.319143e-001, 7.326120e-001, 7.333098e-001, 7.340076e-001, 7.347054e-001, 7.354032e-001,
+7.360878e-001, 7.367722e-001, 7.374566e-001, 7.381410e-001, 7.388254e-001, 7.395099e-001, 7.401931e-001, 7.408680e-001, 7.415429e-001, 7.422179e-001,
+7.428928e-001, 7.435677e-001, 7.442426e-001, 7.449170e-001, 7.455885e-001, 7.462600e-001, 7.469315e-001, 7.476030e-001, 7.482745e-001, 7.489460e-001,
+7.496169e-001, 7.502801e-001, 7.509432e-001, 7.516064e-001, 7.522696e-001, 7.529328e-001, 7.535960e-001, 7.542592e-001, 7.549132e-001, 7.555663e-001,
+7.562194e-001, 7.568725e-001, 7.575256e-001, 7.581787e-001, 7.588318e-001, 7.594775e-001, 7.601187e-001, 7.607599e-001, 7.614011e-001, 7.620423e-001,
+7.626835e-001, 7.633247e-001, 7.639620e-001, 7.645862e-001, 7.652104e-001, 7.658346e-001, 7.664587e-001, 7.670829e-001, 7.677071e-001, 7.683313e-001,
+7.689499e-001, 7.695665e-001, 7.701830e-001, 7.707996e-001, 7.714161e-001, 7.720326e-001, 7.726492e-001, 7.732650e-001, 7.738748e-001, 7.744845e-001,
+7.750943e-001, 7.757040e-001, 7.763138e-001, 7.769235e-001, 7.775333e-001, 7.781411e-001, 7.787458e-001, 7.793504e-001, 7.799550e-001, 7.805596e-001,
+7.811643e-001, 7.817689e-001, 7.823735e-001, 7.829758e-001, 7.835759e-001, 7.841761e-001, 7.847763e-001, 7.853764e-001, 7.859766e-001, 7.865768e-001,
+7.871769e-001, 7.877739e-001, 7.883684e-001, 7.889629e-001, 7.895574e-001, 7.901519e-001, 7.907464e-001, 7.913408e-001, 7.919353e-001, 7.925246e-001,
+7.931083e-001, 7.936920e-001, 7.942757e-001, 7.948594e-001, 7.954432e-001, 7.960269e-001, 7.966106e-001, 7.971937e-001, 7.977755e-001, 7.983572e-001,
+7.989390e-001, 7.995207e-001, 8.001024e-001, 8.006842e-001, 8.012659e-001, 8.018477e-001, 8.024280e-001, 8.030082e-001, 8.035884e-001, 8.041686e-001,
+8.047489e-001, 8.053291e-001, 8.059093e-001, 8.064896e-001, 8.070696e-001, 8.076496e-001, 8.082295e-001, 8.088094e-001, 8.093893e-001, 8.099692e-001,
+8.105491e-001, 8.111290e-001, 8.117090e-001, 8.122891e-001, 8.128693e-001, 8.134495e-001, 8.140297e-001, 8.146099e-001, 8.151901e-001, 8.157703e-001,
+8.163505e-001, 8.169274e-001, 8.174931e-001, 8.180589e-001, 8.186247e-001, 8.191904e-001, 8.197562e-001, 8.203219e-001, 8.208877e-001, 8.214535e-001,
+8.220161e-001, 8.225740e-001, 8.231318e-001, 8.236896e-001, 8.242475e-001, 8.248053e-001, 8.253631e-001, 8.259210e-001, 8.264788e-001, 8.270347e-001,
+8.275880e-001, 8.281414e-001, 8.286947e-001, 8.292480e-001, 8.298013e-001, 8.303547e-001, 8.309080e-001, 8.314613e-001, 8.320135e-001, 8.325636e-001,
+8.331136e-001, 8.336636e-001, 8.342137e-001, 8.347637e-001, 8.353137e-001, 8.358637e-001, 8.364138e-001, 8.369630e-001, 8.375041e-001, 8.380452e-001,
+8.385863e-001, 8.391274e-001, 8.396685e-001, 8.402096e-001, 8.407507e-001, 8.412918e-001, 8.418330e-001, 8.423717e-001, 8.429095e-001, 8.434472e-001,
+8.439850e-001, 8.445228e-001, 8.450606e-001, 8.455984e-001, 8.461362e-001, 8.466740e-001, 8.472100e-001, 8.477394e-001, 8.482688e-001, 8.487981e-001,
+8.493275e-001, 8.498568e-001, 8.503862e-001, 8.509156e-001, 8.514449e-001, 8.519743e-001, 8.524994e-001, 8.530210e-001, 8.535426e-001, 8.540641e-001,
+8.545857e-001, 8.551073e-001, 8.556289e-001, 8.561505e-001, 8.566720e-001, 8.571936e-001, 8.577103e-001, 8.582253e-001, 8.587402e-001, 8.592552e-001,
+8.597702e-001, 8.602852e-001, 8.608002e-001, 8.613151e-001, 8.618301e-001, 8.623451e-001, 8.628505e-001, 8.633534e-001, 8.638564e-001, 8.643593e-001,
+8.648623e-001, 8.653652e-001, 8.658682e-001, 8.663712e-001, 8.668741e-001, 8.673771e-001, 8.678757e-001, 8.683726e-001, 8.688695e-001, 8.693663e-001,
+8.698632e-001, 8.703601e-001, 8.708569e-001, 8.713538e-001, 8.718507e-001, 8.723475e-001, 8.728403e-001, 8.733281e-001, 8.738159e-001, 8.743038e-001,
+8.747916e-001, 8.752795e-001, 8.757673e-001, 8.762552e-001, 8.767430e-001, 8.772309e-001, 8.777185e-001, 8.782029e-001, 8.786874e-001, 8.791718e-001,
+8.796562e-001, 8.801407e-001, 8.806251e-001, 8.811095e-001, 8.815940e-001, 8.820784e-001, 8.825628e-001, 8.830412e-001, 8.835137e-001, 8.839862e-001,
+8.844587e-001, 8.849312e-001, 8.854037e-001, 8.858763e-001, 8.863488e-001, 8.868213e-001, 8.872938e-001, 8.877663e-001, 8.882371e-001, 8.887075e-001,
+8.891779e-001, 8.896482e-001, 8.901186e-001, 8.905890e-001, 8.910594e-001, 8.915298e-001, 8.920002e-001, 8.924706e-001, 8.929409e-001, 8.934036e-001,
+8.938656e-001, 8.943277e-001, 8.947897e-001, 8.952517e-001, 8.957138e-001, 8.961758e-001, 8.966378e-001, 8.970998e-001, 8.975619e-001, 8.980239e-001,
+8.984870e-001, 8.989503e-001, 8.994136e-001, 8.998769e-001, 9.003402e-001, 9.008035e-001, 9.012668e-001, 9.017301e-001, 9.021934e-001, 9.026567e-001,
+9.031200e-001, 9.035798e-001, 9.040382e-001, 9.044965e-001, 9.049548e-001, 9.054132e-001, 9.058715e-001, 9.063298e-001, 9.067882e-001, 9.072465e-001,
+9.077048e-001, 9.081632e-001, 9.086192e-001, 9.090703e-001, 9.095214e-001, 9.099725e-001, 9.104236e-001, 9.108747e-001, 9.113258e-001, 9.117770e-001,
+9.122281e-001, 9.126792e-001, 9.131303e-001, 9.135814e-001, 9.140260e-001, 9.144688e-001, 9.149116e-001, 9.153544e-001, 9.157972e-001, 9.162400e-001,
+9.166828e-001, 9.171256e-001, 9.175684e-001, 9.180112e-001, 9.184540e-001, 9.188957e-001, 9.193244e-001, 9.197530e-001, 9.201817e-001, 9.206103e-001,
+9.210389e-001, 9.214676e-001, 9.218962e-001, 9.223249e-001, 9.227535e-001, 9.231822e-001, 9.236108e-001, 9.240378e-001, 9.244576e-001, 9.248775e-001,
+9.252973e-001, 9.257171e-001, 9.261369e-001, 9.265568e-001, 9.269766e-001, 9.273964e-001, 9.278163e-001, 9.282361e-001, 9.286559e-001, 9.290750e-001,
+9.294890e-001, 9.299030e-001, 9.303171e-001, 9.307311e-001, 9.311451e-001, 9.315592e-001, 9.319732e-001, 9.323872e-001, 9.328012e-001, 9.332153e-001,
+9.336293e-001, 9.340433e-001, 9.344479e-001, 9.348514e-001, 9.352548e-001, 9.356582e-001, 9.360616e-001, 9.364651e-001, 9.368685e-001, 9.372719e-001,
+9.376753e-001, 9.380788e-001, 9.384822e-001, 9.388856e-001, 9.392852e-001, 9.396802e-001, 9.400753e-001, 9.404703e-001, 9.408654e-001, 9.412604e-001,
+9.416555e-001, 9.420506e-001, 9.424456e-001, 9.428407e-001, 9.432357e-001, 9.436308e-001, 9.440258e-001, 9.444158e-001, 9.448049e-001, 9.451941e-001,
+9.455832e-001, 9.459723e-001, 9.463614e-001, 9.467505e-001, 9.471397e-001, 9.475288e-001, 9.479179e-001, 9.483070e-001, 9.486962e-001, 9.490848e-001,
+9.494651e-001, 9.498454e-001, 9.502257e-001, 9.506060e-001, 9.509863e-001, 9.513666e-001, 9.517469e-001, 9.521272e-001, 9.525075e-001, 9.528878e-001,
+9.532682e-001, 9.536485e-001, 9.540282e-001, 9.543992e-001, 9.547703e-001, 9.551414e-001, 9.555124e-001, 9.558835e-001, 9.562546e-001, 9.566256e-001,
+9.569967e-001, 9.573678e-001, 9.577388e-001, 9.581099e-001, 9.584810e-001, 9.588520e-001, 9.592134e-001, 9.595736e-001, 9.599337e-001, 9.602938e-001,
+9.606539e-001, 9.610140e-001, 9.613741e-001, 9.617342e-001, 9.620944e-001, 9.624545e-001, 9.628146e-001, 9.631747e-001, 9.635348e-001, 9.638900e-001,
+9.642402e-001, 9.645904e-001, 9.649405e-001, 9.652907e-001, 9.656409e-001, 9.659911e-001, 9.663413e-001, 9.666915e-001, 9.670417e-001, 9.673919e-001,
+9.677421e-001, 9.680922e-001, 9.684424e-001, 9.687845e-001, 9.691258e-001, 9.694671e-001, 9.698084e-001, 9.701497e-001, 9.704910e-001, 9.708323e-001,
+9.711736e-001, 9.715149e-001, 9.718562e-001, 9.721975e-001, 9.725388e-001, 9.728801e-001, 9.732202e-001, 9.735529e-001, 9.738855e-001, 9.742182e-001,
+9.745508e-001, 9.748835e-001, 9.752161e-001, 9.755488e-001, 9.758814e-001, 9.762141e-001, 9.765467e-001, 9.768794e-001, 9.772120e-001, 9.775447e-001,
+9.778758e-001, 9.781980e-001, 9.785203e-001, 9.788425e-001, 9.791647e-001, 9.794870e-001, 9.798092e-001, 9.801315e-001, 9.804537e-001, 9.807759e-001,
+9.810982e-001, 9.814204e-001, 9.817427e-001, 9.820649e-001, 9.823871e-001, 9.827021e-001, 9.830166e-001, 9.833311e-001, 9.836457e-001, 9.839602e-001,
+9.842747e-001, 9.845892e-001, 9.849038e-001, 9.852183e-001, 9.855328e-001, 9.858473e-001, 9.861619e-001, 9.864764e-001, 9.867909e-001, 9.871008e-001,
+9.874068e-001, 9.877127e-001, 9.880187e-001, 9.883246e-001, 9.886306e-001, 9.889365e-001, 9.892425e-001, 9.895484e-001, 9.898544e-001, 9.901603e-001,
+9.904663e-001, 9.907722e-001, 9.910782e-001, 9.913841e-001, 9.916865e-001, 9.919886e-001, 9.922906e-001, 9.925927e-001, 9.928947e-001, 9.931968e-001,
+9.934988e-001, 9.938009e-001, 9.941029e-001, 9.944050e-001, 9.947070e-001, 9.950091e-001, 9.953111e-001, 9.956132e-001, 9.959133e-001, 9.961857e-001,
+9.964582e-001, 9.967306e-001, 9.970031e-001, 9.972755e-001, 9.975480e-001, 9.978204e-001, 9.980929e-001, 9.983653e-001, 9.986378e-001, 9.989102e-001,
+9.991827e-001, 9.994551e-001, 9.997276e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.147647e-002, 2.272518e-002, 3.317786e-002, 4.240592e-002, 5.070760e-002, 5.836692e-002, 6.536217e-002, 7.195822e-002, 7.811436e-002,
+8.401814e-002, 8.968573e-002, 9.509552e-002, 1.002842e-001, 1.052709e-001, 1.100750e-001, 1.147160e-001, 1.191812e-001, 1.235382e-001, 1.277815e-001,
+1.319574e-001, 1.360506e-001, 1.400354e-001, 1.439131e-001, 1.477226e-001, 1.514364e-001, 1.550768e-001, 1.586581e-001, 1.621633e-001, 1.656110e-001,
+1.689940e-001, 1.723018e-001, 1.755645e-001, 1.787341e-001, 1.818515e-001, 1.848968e-001, 1.878946e-001, 1.908354e-001, 1.937474e-001, 1.966456e-001,
+1.995197e-001, 2.023606e-001, 2.052041e-001, 2.080169e-001, 2.107932e-001, 2.135624e-001, 2.162752e-001, 2.189542e-001, 2.216016e-001, 2.241948e-001,
+2.267569e-001, 2.292927e-001, 2.317843e-001, 2.342379e-001, 2.366533e-001, 2.390290e-001, 2.413757e-001, 2.437072e-001, 2.460274e-001, 2.483307e-001,
+2.506221e-001, 2.528900e-001, 2.551301e-001, 2.573641e-001, 2.595870e-001, 2.617991e-001, 2.639977e-001, 2.661921e-001, 2.683887e-001, 2.705699e-001,
+2.727307e-001, 2.748725e-001, 2.769971e-001, 2.791089e-001, 2.812051e-001, 2.832851e-001, 2.853565e-001, 2.874125e-001, 2.894455e-001, 2.914513e-001,
+2.934391e-001, 2.954115e-001, 2.973645e-001, 2.992907e-001, 3.012038e-001, 3.031010e-001, 3.049889e-001, 3.068725e-001, 3.087452e-001, 3.106025e-001,
+3.124461e-001, 3.142770e-001, 3.160953e-001, 3.179017e-001, 3.196955e-001, 3.214754e-001, 3.232490e-001, 3.250179e-001, 3.267831e-001, 3.285475e-001,
+3.303103e-001, 3.320707e-001, 3.338233e-001, 3.355643e-001, 3.372964e-001, 3.390068e-001, 3.407028e-001, 3.423875e-001, 3.440541e-001, 3.457127e-001,
+3.473585e-001, 3.489894e-001, 3.506138e-001, 3.522236e-001, 3.538291e-001, 3.554285e-001, 3.570241e-001, 3.586182e-001, 3.602060e-001, 3.617907e-001,
+3.633659e-001, 3.649328e-001, 3.664896e-001, 3.680340e-001, 3.695714e-001, 3.710972e-001, 3.726202e-001, 3.741201e-001, 3.756182e-001, 3.771078e-001,
+3.785970e-001, 3.800841e-001, 3.815703e-001, 3.830527e-001, 3.845353e-001, 3.860189e-001, 3.874995e-001, 3.889682e-001, 3.904353e-001, 3.918947e-001,
+3.933513e-001, 3.947859e-001, 3.962202e-001, 3.976346e-001, 3.990489e-001, 4.004501e-001, 4.018496e-001, 4.032417e-001, 4.046311e-001, 4.060145e-001,
+4.073928e-001, 4.087674e-001, 4.101338e-001, 4.114997e-001, 4.128587e-001, 4.142177e-001, 4.155749e-001, 4.169316e-001, 4.182891e-001, 4.196475e-001,
+4.210050e-001, 4.223509e-001, 4.236968e-001, 4.250375e-001, 4.263758e-001, 4.277085e-001, 4.290248e-001, 4.303410e-001, 4.316442e-001, 4.329438e-001,
+4.342382e-001, 4.355194e-001, 4.368005e-001, 4.380723e-001, 4.393407e-001, 4.406092e-001, 4.418779e-001, 4.431465e-001, 4.444108e-001, 4.456713e-001,
+4.469317e-001, 4.481886e-001, 4.494449e-001, 4.506980e-001, 4.519374e-001, 4.531768e-001, 4.544105e-001, 4.556373e-001, 4.568640e-001, 4.580819e-001,
+4.592955e-001, 4.605091e-001, 4.617216e-001, 4.629341e-001, 4.641465e-001, 4.653517e-001, 4.665570e-001, 4.677615e-001, 4.689594e-001, 4.701572e-001,
+4.713544e-001, 4.725481e-001, 4.737417e-001, 4.749347e-001, 4.761235e-001, 4.773123e-001, 4.785006e-001, 4.796843e-001, 4.808681e-001, 4.820516e-001,
+4.832227e-001, 4.843937e-001, 4.855648e-001, 4.867220e-001, 4.878777e-001, 4.890333e-001, 4.901837e-001, 4.913321e-001, 4.924805e-001, 4.936193e-001,
+4.947486e-001, 4.958779e-001, 4.970035e-001, 4.981165e-001, 4.992294e-001, 5.003424e-001, 5.014445e-001, 5.025455e-001, 5.036465e-001, 5.047430e-001,
+5.058357e-001, 5.069284e-001, 5.080201e-001, 5.091048e-001, 5.101895e-001, 5.112742e-001, 5.123529e-001, 5.134284e-001, 5.145039e-001, 5.155787e-001,
+5.166484e-001, 5.177181e-001, 5.187878e-001, 5.198484e-001, 5.209016e-001, 5.219547e-001, 5.230079e-001, 5.240487e-001, 5.250884e-001, 5.261282e-001,
+5.271658e-001, 5.281967e-001, 5.292276e-001, 5.302585e-001, 5.312880e-001, 5.323162e-001, 5.333444e-001, 5.343726e-001, 5.353970e-001, 5.364200e-001,
+5.374429e-001, 5.384659e-001, 5.394817e-001, 5.404965e-001, 5.415112e-001, 5.425259e-001, 5.435300e-001, 5.445337e-001, 5.455373e-001, 5.465409e-001,
+5.475350e-001, 5.485289e-001, 5.495228e-001, 5.505168e-001, 5.515152e-001, 5.525138e-001, 5.535124e-001, 5.545110e-001, 5.554962e-001, 5.564796e-001,
+5.574630e-001, 5.584464e-001, 5.594201e-001, 5.603902e-001, 5.613602e-001, 5.623303e-001, 5.632958e-001, 5.642570e-001, 5.652183e-001, 5.661796e-001,
+5.671394e-001, 5.680949e-001, 5.690503e-001, 5.700058e-001, 5.709613e-001, 5.719025e-001, 5.728425e-001, 5.737825e-001, 5.747225e-001, 5.756578e-001,
+5.765889e-001, 5.775199e-001, 5.784509e-001, 5.793818e-001, 5.803100e-001, 5.812382e-001, 5.821665e-001, 5.830947e-001, 5.840186e-001, 5.849387e-001,
+5.858588e-001, 5.867789e-001, 5.876990e-001, 5.886114e-001, 5.895231e-001, 5.904348e-001, 5.913465e-001, 5.922542e-001, 5.931503e-001, 5.940464e-001,
+5.949425e-001, 5.958386e-001, 5.967333e-001, 5.976269e-001, 5.985204e-001, 5.994139e-001, 6.003074e-001, 6.011891e-001, 6.020658e-001, 6.029426e-001,
+6.038194e-001, 6.046961e-001, 6.055695e-001, 6.064421e-001, 6.073147e-001, 6.081874e-001, 6.090600e-001, 6.099301e-001, 6.107999e-001, 6.116697e-001,
+6.125395e-001, 6.134093e-001, 6.142743e-001, 6.151384e-001, 6.160026e-001, 6.168667e-001, 6.177309e-001, 6.185951e-001, 6.194593e-001, 6.203235e-001,
+6.211877e-001, 6.220519e-001, 6.229112e-001, 6.237668e-001, 6.246223e-001, 6.254779e-001, 6.263334e-001, 6.271871e-001, 6.280365e-001, 6.288859e-001,
+6.297354e-001, 6.305848e-001, 6.314343e-001, 6.322729e-001, 6.331113e-001, 6.339497e-001, 6.347881e-001, 6.356265e-001, 6.364636e-001, 6.372997e-001,
+6.381359e-001, 6.389720e-001, 6.398081e-001, 6.406438e-001, 6.414728e-001, 6.423018e-001, 6.431308e-001, 6.439598e-001, 6.447888e-001, 6.456167e-001,
+6.464435e-001, 6.472703e-001, 6.480971e-001, 6.489240e-001, 6.497508e-001, 6.505677e-001, 6.513826e-001, 6.521975e-001, 6.530124e-001, 6.538272e-001,
+6.546415e-001, 6.554480e-001, 6.562545e-001, 6.570610e-001, 6.578675e-001, 6.586740e-001, 6.594785e-001, 6.602772e-001, 6.610759e-001, 6.618746e-001,
+6.626733e-001, 6.634720e-001, 6.642684e-001, 6.650602e-001, 6.658521e-001, 6.666439e-001, 6.674357e-001, 6.682276e-001, 6.690183e-001, 6.698068e-001,
+6.705953e-001, 6.713838e-001, 6.721723e-001, 6.729608e-001, 6.737465e-001, 6.745222e-001, 6.752980e-001, 6.760737e-001, 6.768495e-001, 6.776252e-001,
+6.784007e-001, 6.791678e-001, 6.799350e-001, 6.807021e-001, 6.814693e-001, 6.822364e-001, 6.830036e-001, 6.837612e-001, 6.845157e-001, 6.852702e-001,
+6.860247e-001, 6.867792e-001, 6.875337e-001, 6.882865e-001, 6.890365e-001, 6.897866e-001, 6.905366e-001, 6.912867e-001, 6.920368e-001, 6.927868e-001,
+6.935217e-001, 6.942551e-001, 6.949886e-001, 6.957220e-001, 6.964554e-001, 6.971888e-001, 6.979203e-001, 6.986479e-001, 6.993755e-001, 7.001032e-001,
+7.008308e-001, 7.015585e-001, 7.022861e-001, 7.030052e-001, 7.037204e-001, 7.044355e-001, 7.051507e-001, 7.058659e-001, 7.065810e-001, 7.072962e-001,
+7.080059e-001, 7.087152e-001, 7.094245e-001, 7.101338e-001, 7.108430e-001, 7.115523e-001, 7.122616e-001, 7.129713e-001, 7.136811e-001, 7.143908e-001,
+7.151005e-001, 7.158102e-001, 7.165200e-001, 7.172292e-001, 7.179328e-001, 7.186364e-001, 7.193400e-001, 7.200436e-001, 7.207472e-001, 7.214508e-001,
+7.221543e-001, 7.228549e-001, 7.235554e-001, 7.242559e-001, 7.249565e-001, 7.256570e-001, 7.263575e-001, 7.270581e-001, 7.277508e-001, 7.284421e-001,
+7.291333e-001, 7.298246e-001, 7.305158e-001, 7.312071e-001, 7.318983e-001, 7.325916e-001, 7.332865e-001, 7.339815e-001, 7.346764e-001, 7.353713e-001,
+7.360663e-001, 7.367612e-001, 7.374558e-001, 7.381486e-001, 7.388415e-001, 7.395344e-001, 7.402272e-001, 7.409201e-001, 7.416130e-001, 7.423059e-001,
+7.429926e-001, 7.436763e-001, 7.443599e-001, 7.450435e-001, 7.457272e-001, 7.464108e-001, 7.470945e-001, 7.477774e-001, 7.484463e-001, 7.491152e-001,
+7.497841e-001, 7.504530e-001, 7.511219e-001, 7.517908e-001, 7.524597e-001, 7.531279e-001, 7.537946e-001, 7.544614e-001, 7.551281e-001, 7.557948e-001,
+7.564616e-001, 7.571283e-001, 7.577950e-001, 7.584580e-001, 7.591166e-001, 7.597753e-001, 7.604340e-001, 7.610926e-001, 7.617513e-001, 7.624100e-001,
+7.630686e-001, 7.637247e-001, 7.643781e-001, 7.650316e-001, 7.656851e-001, 7.663386e-001, 7.669920e-001, 7.676455e-001, 7.682990e-001, 7.689477e-001,
+7.695900e-001, 7.702323e-001, 7.708745e-001, 7.715168e-001, 7.721591e-001, 7.728014e-001, 7.734437e-001, 7.740848e-001, 7.747217e-001, 7.753585e-001,
+7.759954e-001, 7.766323e-001, 7.772692e-001, 7.779061e-001, 7.785430e-001, 7.791799e-001, 7.798111e-001, 7.804416e-001, 7.810721e-001, 7.817026e-001,
+7.823331e-001, 7.829635e-001, 7.835940e-001, 7.842245e-001, 7.848518e-001, 7.854751e-001, 7.860983e-001, 7.867216e-001, 7.873449e-001, 7.879682e-001,
+7.885915e-001, 7.892148e-001, 7.898380e-001, 7.904540e-001, 7.910689e-001, 7.916838e-001, 7.922987e-001, 7.929136e-001, 7.935285e-001, 7.941434e-001,
+7.947583e-001, 7.953717e-001, 7.959779e-001, 7.965841e-001, 7.971904e-001, 7.977966e-001, 7.984028e-001, 7.990091e-001, 7.996153e-001, 8.002215e-001,
+8.008268e-001, 8.014301e-001, 8.020335e-001, 8.026369e-001, 8.032402e-001, 8.038436e-001, 8.044470e-001, 8.050503e-001, 8.056537e-001, 8.062539e-001,
+8.068488e-001, 8.074437e-001, 8.080386e-001, 8.086336e-001, 8.092285e-001, 8.098234e-001, 8.104183e-001, 8.110132e-001, 8.116053e-001, 8.121903e-001,
+8.127752e-001, 8.133601e-001, 8.139451e-001, 8.145300e-001, 8.151149e-001, 8.156999e-001, 8.162848e-001, 8.168695e-001, 8.174485e-001, 8.180275e-001,
+8.186065e-001, 8.191856e-001, 8.197646e-001, 8.203436e-001, 8.209226e-001, 8.215017e-001, 8.220807e-001, 8.226526e-001, 8.232211e-001, 8.237895e-001,
+8.243580e-001, 8.249265e-001, 8.254949e-001, 8.260634e-001, 8.266319e-001, 8.272003e-001, 8.277677e-001, 8.283293e-001, 8.288909e-001, 8.294524e-001,
+8.300140e-001, 8.305756e-001, 8.311371e-001, 8.316987e-001, 8.322603e-001, 8.328218e-001, 8.333820e-001, 8.339408e-001, 8.344996e-001, 8.350584e-001,
+8.356172e-001, 8.361761e-001, 8.367349e-001, 8.372937e-001, 8.378525e-001, 8.384113e-001, 8.389707e-001, 8.395304e-001, 8.400900e-001, 8.406497e-001,
+8.412094e-001, 8.417690e-001, 8.423287e-001, 8.428884e-001, 8.434481e-001, 8.440077e-001, 8.445583e-001, 8.451061e-001, 8.456538e-001, 8.462016e-001,
+8.467493e-001, 8.472971e-001, 8.478448e-001, 8.483925e-001, 8.489403e-001, 8.494880e-001, 8.500299e-001, 8.505688e-001, 8.511077e-001, 8.516465e-001,
+8.521854e-001, 8.527243e-001, 8.532632e-001, 8.538021e-001, 8.543410e-001, 8.548799e-001, 8.554144e-001, 8.559429e-001, 8.564714e-001, 8.569999e-001,
+8.575283e-001, 8.580568e-001, 8.585853e-001, 8.591138e-001, 8.596423e-001, 8.601708e-001, 8.606992e-001, 8.612252e-001, 8.617512e-001, 8.622772e-001,
+8.628033e-001, 8.633293e-001, 8.638553e-001, 8.643813e-001, 8.649073e-001, 8.654334e-001, 8.659594e-001, 8.664833e-001, 8.670050e-001, 8.675267e-001,
+8.680483e-001, 8.685700e-001, 8.690916e-001, 8.696133e-001, 8.701350e-001, 8.706566e-001, 8.711783e-001, 8.716999e-001, 8.722208e-001, 8.727415e-001,
+8.732621e-001, 8.737828e-001, 8.743034e-001, 8.748241e-001, 8.753447e-001, 8.758654e-001, 8.763860e-001, 8.769066e-001, 8.774273e-001, 8.779383e-001,
+8.784481e-001, 8.789578e-001, 8.794676e-001, 8.799774e-001, 8.804872e-001, 8.809969e-001, 8.815067e-001, 8.820165e-001, 8.825263e-001, 8.830360e-001,
+8.835431e-001, 8.840497e-001, 8.845562e-001, 8.850628e-001, 8.855694e-001, 8.860760e-001, 8.865826e-001, 8.870891e-001, 8.875957e-001, 8.881023e-001,
+8.886089e-001, 8.891085e-001, 8.896043e-001, 8.901002e-001, 8.905961e-001, 8.910920e-001, 8.915879e-001, 8.920838e-001, 8.925797e-001, 8.930756e-001,
+8.935715e-001, 8.940674e-001, 8.945624e-001, 8.950552e-001, 8.955479e-001, 8.960407e-001, 8.965335e-001, 8.970262e-001, 8.975190e-001, 8.980118e-001,
+8.985045e-001, 8.989973e-001, 8.994901e-001, 8.999828e-001, 9.004677e-001, 9.009500e-001, 9.014323e-001, 9.019146e-001, 9.023969e-001, 9.028792e-001,
+9.033615e-001, 9.038438e-001, 9.043261e-001, 9.048084e-001, 9.052907e-001, 9.057729e-001, 9.062543e-001, 9.067356e-001, 9.072170e-001, 9.076984e-001,
+9.081798e-001, 9.086611e-001, 9.091425e-001, 9.096239e-001, 9.101052e-001, 9.105866e-001, 9.110680e-001, 9.115487e-001, 9.120260e-001, 9.125033e-001,
+9.129807e-001, 9.134580e-001, 9.139353e-001, 9.144127e-001, 9.148900e-001, 9.153673e-001, 9.158446e-001, 9.163220e-001, 9.167993e-001, 9.172764e-001,
+9.177515e-001, 9.182266e-001, 9.187017e-001, 9.191767e-001, 9.196518e-001, 9.201269e-001, 9.206020e-001, 9.210771e-001, 9.215522e-001, 9.220273e-001,
+9.225024e-001, 9.229774e-001, 9.234445e-001, 9.239102e-001, 9.243760e-001, 9.248417e-001, 9.253074e-001, 9.257732e-001, 9.262389e-001, 9.267047e-001,
+9.271704e-001, 9.276362e-001, 9.281019e-001, 9.285677e-001, 9.290300e-001, 9.294880e-001, 9.299459e-001, 9.304039e-001, 9.308618e-001, 9.313198e-001,
+9.317778e-001, 9.322357e-001, 9.326937e-001, 9.331517e-001, 9.336096e-001, 9.340676e-001, 9.345256e-001, 9.349750e-001, 9.354226e-001, 9.358703e-001,
+9.363180e-001, 9.367656e-001, 9.372133e-001, 9.376610e-001, 9.381087e-001, 9.385563e-001, 9.390040e-001, 9.394517e-001, 9.398993e-001, 9.403469e-001,
+9.407905e-001, 9.412341e-001, 9.416778e-001, 9.421214e-001, 9.425650e-001, 9.430087e-001, 9.434523e-001, 9.438960e-001, 9.443396e-001, 9.447832e-001,
+9.452269e-001, 9.456705e-001, 9.461137e-001, 9.465477e-001, 9.469818e-001, 9.474158e-001, 9.478498e-001, 9.482839e-001, 9.487179e-001, 9.491520e-001,
+9.495860e-001, 9.500200e-001, 9.504541e-001, 9.508881e-001, 9.513221e-001, 9.517562e-001, 9.521834e-001, 9.526096e-001, 9.530359e-001, 9.534621e-001,
+9.538883e-001, 9.543145e-001, 9.547407e-001, 9.551669e-001, 9.555931e-001, 9.560193e-001, 9.564455e-001, 9.568717e-001, 9.572979e-001, 9.577191e-001,
+9.581351e-001, 9.585510e-001, 9.589670e-001, 9.593829e-001, 9.597989e-001, 9.602148e-001, 9.606308e-001, 9.610467e-001, 9.614627e-001, 9.618786e-001,
+9.622946e-001, 9.627105e-001, 9.631265e-001, 9.635348e-001, 9.639423e-001, 9.643498e-001, 9.647573e-001, 9.651648e-001, 9.655723e-001, 9.659799e-001,
+9.663874e-001, 9.667949e-001, 9.672024e-001, 9.676099e-001, 9.680174e-001, 9.684249e-001, 9.688311e-001, 9.692280e-001, 9.696249e-001, 9.700219e-001,
+9.704188e-001, 9.708157e-001, 9.712126e-001, 9.716096e-001, 9.720065e-001, 9.724034e-001, 9.728003e-001, 9.731973e-001, 9.735942e-001, 9.739911e-001,
+9.743869e-001, 9.747754e-001, 9.751639e-001, 9.755524e-001, 9.759409e-001, 9.763294e-001, 9.767180e-001, 9.771065e-001, 9.774950e-001, 9.778835e-001,
+9.782720e-001, 9.786605e-001, 9.790491e-001, 9.794376e-001, 9.798261e-001, 9.802025e-001, 9.805781e-001, 9.809537e-001, 9.813293e-001, 9.817049e-001,
+9.820805e-001, 9.824561e-001, 9.828318e-001, 9.832074e-001, 9.835830e-001, 9.839586e-001, 9.843342e-001, 9.847098e-001, 9.850854e-001, 9.854502e-001,
+9.858055e-001, 9.861608e-001, 9.865160e-001, 9.868713e-001, 9.872265e-001, 9.875818e-001, 9.879370e-001, 9.882923e-001, 9.886476e-001, 9.890028e-001,
+9.893581e-001, 9.897133e-001, 9.900686e-001, 9.904238e-001, 9.907622e-001, 9.910988e-001, 9.914355e-001, 9.917721e-001, 9.921088e-001, 9.924454e-001,
+9.927820e-001, 9.931187e-001, 9.934553e-001, 9.937919e-001, 9.941286e-001, 9.944652e-001, 9.948019e-001, 9.951385e-001, 9.954729e-001, 9.957747e-001,
+9.960765e-001, 9.963783e-001, 9.966801e-001, 9.969819e-001, 9.972837e-001, 9.975855e-001, 9.978873e-001, 9.981892e-001, 9.984910e-001, 9.987928e-001,
+9.990946e-001, 9.993964e-001, 9.996982e-001, 1.000000e+000)),
+("Fujifilm", "F-250", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.405635e-002, 5.812816e-002, 7.667325e-002, 9.128643e-002, 1.037112e-001, 1.149741e-001, 1.255444e-001, 1.358117e-001, 1.458894e-001,
+1.554105e-001, 1.642754e-001, 1.725185e-001, 1.802160e-001, 1.874678e-001, 1.943995e-001, 2.010439e-001, 2.075249e-001, 2.138666e-001, 2.200817e-001,
+2.262571e-001, 2.322959e-001, 2.381743e-001, 2.439599e-001, 2.495302e-001, 2.549104e-001, 2.600974e-001, 2.651268e-001, 2.699951e-001, 2.746873e-001,
+2.792501e-001, 2.837044e-001, 2.880541e-001, 2.922781e-001, 2.963983e-001, 3.004223e-001, 3.043056e-001, 3.080698e-001, 3.117355e-001, 3.153220e-001,
+3.188440e-001, 3.223091e-001, 3.257098e-001, 3.290208e-001, 3.322732e-001, 3.354866e-001, 3.386512e-001, 3.417851e-001, 3.448847e-001, 3.479135e-001,
+3.508972e-001, 3.538431e-001, 3.567288e-001, 3.595845e-001, 3.624259e-001, 3.652456e-001, 3.680749e-001, 3.708611e-001, 3.735972e-001, 3.762691e-001,
+3.789086e-001, 3.814966e-001, 3.840736e-001, 3.866174e-001, 3.891361e-001, 3.916285e-001, 3.941093e-001, 3.965597e-001, 3.989767e-001, 4.013714e-001,
+4.037455e-001, 4.060991e-001, 4.084275e-001, 4.107517e-001, 4.130511e-001, 4.153209e-001, 4.175667e-001, 4.197983e-001, 4.220117e-001, 4.241906e-001,
+4.263458e-001, 4.284876e-001, 4.306013e-001, 4.326950e-001, 4.347662e-001, 4.368287e-001, 4.388832e-001, 4.409215e-001, 4.429436e-001, 4.449626e-001,
+4.469791e-001, 4.489936e-001, 4.509987e-001, 4.529815e-001, 4.549527e-001, 4.569248e-001, 4.588771e-001, 4.608316e-001, 4.627926e-001, 4.647418e-001,
+4.666926e-001, 4.686441e-001, 4.705765e-001, 4.724830e-001, 4.743657e-001, 4.762322e-001, 4.780816e-001, 4.799089e-001, 4.817309e-001, 4.835452e-001,
+4.853380e-001, 4.871333e-001, 4.889299e-001, 4.907036e-001, 4.924693e-001, 4.942173e-001, 4.959533e-001, 4.976806e-001, 4.994090e-001, 5.011367e-001,
+5.028569e-001, 5.045689e-001, 5.062633e-001, 5.079504e-001, 5.096307e-001, 5.112874e-001, 5.129329e-001, 5.145742e-001, 5.162146e-001, 5.178315e-001,
+5.194466e-001, 5.210655e-001, 5.226833e-001, 5.242862e-001, 5.258901e-001, 5.275050e-001, 5.291188e-001, 5.307204e-001, 5.323221e-001, 5.339250e-001,
+5.355279e-001, 5.371186e-001, 5.387090e-001, 5.402762e-001, 5.418405e-001, 5.433958e-001, 5.449483e-001, 5.464795e-001, 5.479968e-001, 5.495104e-001,
+5.510191e-001, 5.525226e-001, 5.540046e-001, 5.554866e-001, 5.569680e-001, 5.584493e-001, 5.599154e-001, 5.613730e-001, 5.628271e-001, 5.642739e-001,
+5.657207e-001, 5.671554e-001, 5.685896e-001, 5.700143e-001, 5.714317e-001, 5.728463e-001, 5.742423e-001, 5.756383e-001, 5.770088e-001, 5.783666e-001,
+5.797222e-001, 5.810663e-001, 5.824104e-001, 5.837360e-001, 5.850501e-001, 5.863641e-001, 5.876724e-001, 5.889808e-001, 5.902798e-001, 5.915662e-001,
+5.928526e-001, 5.941187e-001, 5.953787e-001, 5.966372e-001, 5.978768e-001, 5.991164e-001, 6.003508e-001, 6.015749e-001, 6.027990e-001, 6.040028e-001,
+6.051901e-001, 6.063774e-001, 6.075573e-001, 6.087345e-001, 6.099117e-001, 6.110657e-001, 6.122164e-001, 6.133671e-001, 6.145062e-001, 6.156449e-001,
+6.167832e-001, 6.179026e-001, 6.190221e-001, 6.201403e-001, 6.212201e-001, 6.222999e-001, 6.233797e-001, 6.244452e-001, 6.255106e-001, 6.265759e-001,
+6.276177e-001, 6.286571e-001, 6.296965e-001, 6.307348e-001, 6.317728e-001, 6.328108e-001, 6.338410e-001, 6.348660e-001, 6.358911e-001, 6.369111e-001,
+6.379229e-001, 6.389347e-001, 6.399448e-001, 6.409430e-001, 6.419412e-001, 6.429393e-001, 6.439178e-001, 6.448914e-001, 6.458649e-001, 6.468329e-001,
+6.477934e-001, 6.487539e-001, 6.497142e-001, 6.506604e-001, 6.516065e-001, 6.525526e-001, 6.534927e-001, 6.544277e-001, 6.553627e-001, 6.562977e-001,
+6.572293e-001, 6.581609e-001, 6.590925e-001, 6.600256e-001, 6.609606e-001, 6.618956e-001, 6.628305e-001, 6.637493e-001, 6.646644e-001, 6.655796e-001,
+6.664932e-001, 6.673965e-001, 6.682998e-001, 6.692031e-001, 6.701044e-001, 6.710027e-001, 6.719010e-001, 6.727993e-001, 6.736879e-001, 6.745703e-001,
+6.754528e-001, 6.763352e-001, 6.772044e-001, 6.780694e-001, 6.789344e-001, 6.797994e-001, 6.806520e-001, 6.815026e-001, 6.823531e-001, 6.832037e-001,
+6.840480e-001, 6.848915e-001, 6.857351e-001, 6.865786e-001, 6.874217e-001, 6.882648e-001, 6.891078e-001, 6.899508e-001, 6.907768e-001, 6.915979e-001,
+6.924190e-001, 6.932401e-001, 6.940519e-001, 6.948581e-001, 6.956644e-001, 6.964707e-001, 6.972734e-001, 6.980715e-001, 6.988695e-001, 6.996675e-001,
+7.004622e-001, 7.012382e-001, 7.020143e-001, 7.027904e-001, 7.035664e-001, 7.043432e-001, 7.051201e-001, 7.058970e-001, 7.066739e-001, 7.074454e-001,
+7.082094e-001, 7.089733e-001, 7.097373e-001, 7.105012e-001, 7.112401e-001, 7.119779e-001, 7.127156e-001, 7.134533e-001, 7.141892e-001, 7.149226e-001,
+7.156560e-001, 7.163894e-001, 7.171228e-001, 7.178445e-001, 7.185637e-001, 7.192828e-001, 7.200020e-001, 7.207183e-001, 7.214187e-001, 7.221192e-001,
+7.228196e-001, 7.235201e-001, 7.242173e-001, 7.249101e-001, 7.256028e-001, 7.262956e-001, 7.269883e-001, 7.276725e-001, 7.283512e-001, 7.290299e-001,
+7.297086e-001, 7.303873e-001, 7.310576e-001, 7.317248e-001, 7.323921e-001, 7.330593e-001, 7.337265e-001, 7.343795e-001, 7.350285e-001, 7.356774e-001,
+7.363264e-001, 7.369754e-001, 7.376107e-001, 7.382416e-001, 7.388725e-001, 7.395034e-001, 7.401343e-001, 7.407568e-001, 7.413747e-001, 7.419926e-001,
+7.426105e-001, 7.432284e-001, 7.438343e-001, 7.444268e-001, 7.450193e-001, 7.456118e-001, 7.462043e-001, 7.467948e-001, 7.473781e-001, 7.479613e-001,
+7.485445e-001, 7.491278e-001, 7.497110e-001, 7.502849e-001, 7.508574e-001, 7.514300e-001, 7.520026e-001, 7.525751e-001, 7.531384e-001, 7.536910e-001,
+7.542436e-001, 7.547962e-001, 7.553488e-001, 7.559014e-001, 7.564553e-001, 7.570091e-001, 7.575629e-001, 7.581168e-001, 7.586706e-001, 7.592213e-001,
+7.597671e-001, 7.603130e-001, 7.608589e-001, 7.614047e-001, 7.619506e-001, 7.624894e-001, 7.630257e-001, 7.635619e-001, 7.640982e-001, 7.646345e-001,
+7.651708e-001, 7.657119e-001, 7.662530e-001, 7.667941e-001, 7.673353e-001, 7.678764e-001, 7.684165e-001, 7.689509e-001, 7.694853e-001, 7.700197e-001,
+7.705542e-001, 7.710886e-001, 7.716192e-001, 7.721379e-001, 7.726567e-001, 7.731754e-001, 7.736941e-001, 7.742129e-001, 7.747326e-001, 7.752555e-001,
+7.757783e-001, 7.763012e-001, 7.768241e-001, 7.773470e-001, 7.778692e-001, 7.783874e-001, 7.789056e-001, 7.794238e-001, 7.799419e-001, 7.804601e-001,
+7.809783e-001, 7.814986e-001, 7.820190e-001, 7.825394e-001, 7.830598e-001, 7.835802e-001, 7.841005e-001, 7.846269e-001, 7.851562e-001, 7.856855e-001,
+7.862148e-001, 7.867441e-001, 7.872734e-001, 7.878013e-001, 7.883257e-001, 7.888501e-001, 7.893746e-001, 7.898990e-001, 7.904235e-001, 7.909479e-001,
+7.914678e-001, 7.919868e-001, 7.925058e-001, 7.930248e-001, 7.935438e-001, 7.940627e-001, 7.945837e-001, 7.951102e-001, 7.956367e-001, 7.961632e-001,
+7.966897e-001, 7.972162e-001, 7.977427e-001, 7.982670e-001, 7.987900e-001, 7.993130e-001, 7.998360e-001, 8.003590e-001, 8.008820e-001, 8.014049e-001,
+8.019158e-001, 8.024243e-001, 8.029329e-001, 8.034414e-001, 8.039500e-001, 8.044585e-001, 8.049671e-001, 8.054732e-001, 8.059793e-001, 8.064854e-001,
+8.069915e-001, 8.074976e-001, 8.080037e-001, 8.085097e-001, 8.090132e-001, 8.095167e-001, 8.100202e-001, 8.105237e-001, 8.110272e-001, 8.115307e-001,
+8.120342e-001, 8.125368e-001, 8.130393e-001, 8.135419e-001, 8.140444e-001, 8.145469e-001, 8.150494e-001, 8.155520e-001, 8.160500e-001, 8.165466e-001,
+8.170432e-001, 8.175398e-001, 8.180364e-001, 8.185330e-001, 8.190297e-001, 8.195242e-001, 8.200165e-001, 8.205089e-001, 8.210012e-001, 8.214935e-001,
+8.219858e-001, 8.224782e-001, 8.229702e-001, 8.234596e-001, 8.239490e-001, 8.244383e-001, 8.249277e-001, 8.254171e-001, 8.259065e-001, 8.263958e-001,
+8.268807e-001, 8.273625e-001, 8.278442e-001, 8.283260e-001, 8.288077e-001, 8.292895e-001, 8.297712e-001, 8.302530e-001, 8.307291e-001, 8.312050e-001,
+8.316810e-001, 8.321569e-001, 8.326329e-001, 8.331088e-001, 8.335847e-001, 8.340601e-001, 8.345337e-001, 8.350073e-001, 8.354809e-001, 8.359545e-001,
+8.364281e-001, 8.369017e-001, 8.373753e-001, 8.378482e-001, 8.383200e-001, 8.387918e-001, 8.392637e-001, 8.397355e-001, 8.402073e-001, 8.406791e-001,
+8.411509e-001, 8.416199e-001, 8.420853e-001, 8.425506e-001, 8.430159e-001, 8.434813e-001, 8.439466e-001, 8.444120e-001, 8.448773e-001, 8.453407e-001,
+8.458008e-001, 8.462608e-001, 8.467208e-001, 8.471809e-001, 8.476409e-001, 8.481009e-001, 8.485610e-001, 8.490195e-001, 8.494699e-001, 8.499204e-001,
+8.503708e-001, 8.508212e-001, 8.512717e-001, 8.517221e-001, 8.521726e-001, 8.526230e-001, 8.530670e-001, 8.535096e-001, 8.539523e-001, 8.543950e-001,
+8.548377e-001, 8.552804e-001, 8.557230e-001, 8.561657e-001, 8.566075e-001, 8.570478e-001, 8.574880e-001, 8.579283e-001, 8.583686e-001, 8.588089e-001,
+8.592492e-001, 8.596895e-001, 8.601298e-001, 8.605728e-001, 8.610164e-001, 8.614600e-001, 8.619036e-001, 8.623472e-001, 8.627907e-001, 8.632343e-001,
+8.636779e-001, 8.641206e-001, 8.645566e-001, 8.649925e-001, 8.654284e-001, 8.658644e-001, 8.663003e-001, 8.667362e-001, 8.671722e-001, 8.676081e-001,
+8.680428e-001, 8.684742e-001, 8.689056e-001, 8.693370e-001, 8.697684e-001, 8.701998e-001, 8.706312e-001, 8.710626e-001, 8.714941e-001, 8.719243e-001,
+8.723520e-001, 8.727797e-001, 8.732074e-001, 8.736351e-001, 8.740628e-001, 8.744905e-001, 8.749181e-001, 8.753458e-001, 8.757717e-001, 8.761912e-001,
+8.766107e-001, 8.770302e-001, 8.774497e-001, 8.778692e-001, 8.782887e-001, 8.787082e-001, 8.791277e-001, 8.795472e-001, 8.799599e-001, 8.803725e-001,
+8.807851e-001, 8.811977e-001, 8.816103e-001, 8.820229e-001, 8.824356e-001, 8.828482e-001, 8.832608e-001, 8.836669e-001, 8.840688e-001, 8.844708e-001,
+8.848728e-001, 8.852748e-001, 8.856767e-001, 8.860787e-001, 8.864807e-001, 8.868827e-001, 8.872837e-001, 8.876764e-001, 8.880690e-001, 8.884617e-001,
+8.888544e-001, 8.892471e-001, 8.896398e-001, 8.900325e-001, 8.904251e-001, 8.908178e-001, 8.912086e-001, 8.915971e-001, 8.919856e-001, 8.923740e-001,
+8.927625e-001, 8.931510e-001, 8.935394e-001, 8.939279e-001, 8.943164e-001, 8.947049e-001, 8.950938e-001, 8.954830e-001, 8.958722e-001, 8.962614e-001,
+8.966506e-001, 8.970398e-001, 8.974290e-001, 8.978182e-001, 8.982074e-001, 8.985966e-001, 8.989794e-001, 8.993596e-001, 8.997398e-001, 9.001200e-001,
+9.005002e-001, 9.008804e-001, 9.012606e-001, 9.016408e-001, 9.020210e-001, 9.024012e-001, 9.027789e-001, 9.031550e-001, 9.035311e-001, 9.039073e-001,
+9.042834e-001, 9.046595e-001, 9.050356e-001, 9.054118e-001, 9.057879e-001, 9.061640e-001, 9.065404e-001, 9.069172e-001, 9.072940e-001, 9.076709e-001,
+9.080477e-001, 9.084245e-001, 9.088013e-001, 9.091782e-001, 9.095550e-001, 9.099318e-001, 9.103087e-001, 9.106770e-001, 9.110451e-001, 9.114132e-001,
+9.117813e-001, 9.121494e-001, 9.125175e-001, 9.128857e-001, 9.132538e-001, 9.136219e-001, 9.139900e-001, 9.143564e-001, 9.147206e-001, 9.150848e-001,
+9.154489e-001, 9.158131e-001, 9.161773e-001, 9.165414e-001, 9.169056e-001, 9.172698e-001, 9.176339e-001, 9.179981e-001, 9.183628e-001, 9.187276e-001,
+9.190924e-001, 9.194573e-001, 9.198221e-001, 9.201870e-001, 9.205518e-001, 9.209167e-001, 9.212815e-001, 9.216464e-001, 9.220112e-001, 9.223689e-001,
+9.227253e-001, 9.230818e-001, 9.234382e-001, 9.237946e-001, 9.241510e-001, 9.245074e-001, 9.248638e-001, 9.252202e-001, 9.255767e-001, 9.259331e-001,
+9.262825e-001, 9.266304e-001, 9.269782e-001, 9.273261e-001, 9.276739e-001, 9.280218e-001, 9.283696e-001, 9.287175e-001, 9.290654e-001, 9.294132e-001,
+9.297611e-001, 9.301087e-001, 9.304562e-001, 9.308036e-001, 9.311511e-001, 9.314986e-001, 9.318460e-001, 9.321935e-001, 9.325410e-001, 9.328885e-001,
+9.332359e-001, 9.335834e-001, 9.339289e-001, 9.342687e-001, 9.346086e-001, 9.349484e-001, 9.352882e-001, 9.356281e-001, 9.359679e-001, 9.363077e-001,
+9.366475e-001, 9.369874e-001, 9.373272e-001, 9.376670e-001, 9.379975e-001, 9.383243e-001, 9.386511e-001, 9.389780e-001, 9.393048e-001, 9.396316e-001,
+9.399585e-001, 9.402853e-001, 9.406122e-001, 9.409390e-001, 9.412658e-001, 9.415926e-001, 9.419143e-001, 9.422359e-001, 9.425576e-001, 9.428793e-001,
+9.432010e-001, 9.435226e-001, 9.438443e-001, 9.441660e-001, 9.444876e-001, 9.448093e-001, 9.451310e-001, 9.454517e-001, 9.457663e-001, 9.460809e-001,
+9.463955e-001, 9.467101e-001, 9.470247e-001, 9.473394e-001, 9.476540e-001, 9.479686e-001, 9.482832e-001, 9.485978e-001, 9.489124e-001, 9.492262e-001,
+9.495301e-001, 9.498340e-001, 9.501379e-001, 9.504418e-001, 9.507457e-001, 9.510496e-001, 9.513535e-001, 9.516574e-001, 9.519613e-001, 9.522652e-001,
+9.525691e-001, 9.528730e-001, 9.531697e-001, 9.534651e-001, 9.537604e-001, 9.540557e-001, 9.543510e-001, 9.546463e-001, 9.549416e-001, 9.552369e-001,
+9.555322e-001, 9.558276e-001, 9.561229e-001, 9.564182e-001, 9.567112e-001, 9.570008e-001, 9.572905e-001, 9.575802e-001, 9.578699e-001, 9.581596e-001,
+9.584493e-001, 9.587390e-001, 9.590287e-001, 9.593184e-001, 9.596081e-001, 9.598978e-001, 9.601875e-001, 9.604712e-001, 9.607534e-001, 9.610357e-001,
+9.613179e-001, 9.616002e-001, 9.618824e-001, 9.621647e-001, 9.624469e-001, 9.627291e-001, 9.630114e-001, 9.632936e-001, 9.635759e-001, 9.638580e-001,
+9.641315e-001, 9.644049e-001, 9.646784e-001, 9.649519e-001, 9.652253e-001, 9.654988e-001, 9.657723e-001, 9.660457e-001, 9.663192e-001, 9.665926e-001,
+9.668661e-001, 9.671396e-001, 9.674128e-001, 9.676774e-001, 9.679421e-001, 9.682067e-001, 9.684713e-001, 9.687360e-001, 9.690006e-001, 9.692652e-001,
+9.695299e-001, 9.697945e-001, 9.700591e-001, 9.703238e-001, 9.705884e-001, 9.708531e-001, 9.711100e-001, 9.713655e-001, 9.716210e-001, 9.718766e-001,
+9.721321e-001, 9.723876e-001, 9.726431e-001, 9.728987e-001, 9.731542e-001, 9.734097e-001, 9.736653e-001, 9.739208e-001, 9.741763e-001, 9.744295e-001,
+9.746801e-001, 9.749307e-001, 9.751814e-001, 9.754320e-001, 9.756826e-001, 9.759332e-001, 9.761838e-001, 9.764344e-001, 9.766850e-001, 9.769356e-001,
+9.771862e-001, 9.774368e-001, 9.776874e-001, 9.779302e-001, 9.781720e-001, 9.784138e-001, 9.786556e-001, 9.788974e-001, 9.791392e-001, 9.793810e-001,
+9.796229e-001, 9.798647e-001, 9.801065e-001, 9.803483e-001, 9.805901e-001, 9.808319e-001, 9.810728e-001, 9.813065e-001, 9.815401e-001, 9.817738e-001,
+9.820074e-001, 9.822411e-001, 9.824747e-001, 9.827084e-001, 9.829420e-001, 9.831757e-001, 9.834094e-001, 9.836430e-001, 9.838767e-001, 9.841103e-001,
+9.843432e-001, 9.845708e-001, 9.847984e-001, 9.850260e-001, 9.852536e-001, 9.854812e-001, 9.857088e-001, 9.859364e-001, 9.861640e-001, 9.863917e-001,
+9.866193e-001, 9.868469e-001, 9.870745e-001, 9.873021e-001, 9.875297e-001, 9.877506e-001, 9.879710e-001, 9.881914e-001, 9.884117e-001, 9.886321e-001,
+9.888525e-001, 9.890729e-001, 9.892933e-001, 9.895137e-001, 9.897341e-001, 9.899545e-001, 9.901749e-001, 9.903953e-001, 9.906157e-001, 9.908352e-001,
+9.910538e-001, 9.912725e-001, 9.914912e-001, 9.917098e-001, 9.919285e-001, 9.921472e-001, 9.923659e-001, 9.925845e-001, 9.928032e-001, 9.930219e-001,
+9.932405e-001, 9.934592e-001, 9.936779e-001, 9.938965e-001, 9.941065e-001, 9.943155e-001, 9.945246e-001, 9.947336e-001, 9.949426e-001, 9.951517e-001,
+9.953607e-001, 9.955697e-001, 9.957788e-001, 9.959878e-001, 9.961968e-001, 9.964058e-001, 9.966149e-001, 9.968239e-001, 9.970322e-001, 9.972301e-001,
+9.974279e-001, 9.976258e-001, 9.978236e-001, 9.980215e-001, 9.982193e-001, 9.984172e-001, 9.986150e-001, 9.988129e-001, 9.990107e-001, 9.992086e-001,
+9.994064e-001, 9.996043e-001, 9.998021e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.750657e-002, 4.460177e-002, 5.852057e-002, 6.934595e-002, 7.839058e-002, 8.662555e-002, 9.437306e-002, 1.018529e-001, 1.092693e-001,
+1.165431e-001, 1.235137e-001, 1.300638e-001, 1.362310e-001, 1.420270e-001, 1.475103e-001, 1.526765e-001, 1.576138e-001, 1.623017e-001, 1.667638e-001,
+1.710769e-001, 1.752613e-001, 1.792901e-001, 1.831697e-001, 1.869385e-001, 1.905891e-001, 1.941210e-001, 1.975311e-001, 2.007963e-001, 2.039688e-001,
+2.070634e-001, 2.100958e-001, 2.130753e-001, 2.160122e-001, 2.189164e-001, 2.217879e-001, 2.246080e-001, 2.273644e-001, 2.300620e-001, 2.327065e-001,
+2.353048e-001, 2.378443e-001, 2.403287e-001, 2.427733e-001, 2.452046e-001, 2.476018e-001, 2.499758e-001, 2.523289e-001, 2.546672e-001, 2.569605e-001,
+2.591898e-001, 2.613660e-001, 2.634985e-001, 2.655823e-001, 2.676231e-001, 2.696105e-001, 2.715514e-001, 2.734310e-001, 2.752598e-001, 2.770378e-001,
+2.787887e-001, 2.805096e-001, 2.822039e-001, 2.838775e-001, 2.855110e-001, 2.871398e-001, 2.887692e-001, 2.904031e-001, 2.920188e-001, 2.936234e-001,
+2.952231e-001, 2.968242e-001, 2.984309e-001, 3.000446e-001, 3.016583e-001, 3.032869e-001, 3.049051e-001, 3.065397e-001, 3.081745e-001, 3.098129e-001,
+3.114566e-001, 3.130968e-001, 3.147350e-001, 3.163721e-001, 3.180099e-001, 3.196572e-001, 3.213165e-001, 3.229748e-001, 3.246041e-001, 3.262286e-001,
+3.278539e-001, 3.294833e-001, 3.311120e-001, 3.327403e-001, 3.343682e-001, 3.359953e-001, 3.376198e-001, 3.392421e-001, 3.408618e-001, 3.424758e-001,
+3.440927e-001, 3.457146e-001, 3.473288e-001, 3.489371e-001, 3.505379e-001, 3.521256e-001, 3.537108e-001, 3.552945e-001, 3.568659e-001, 3.584319e-001,
+3.599914e-001, 3.615401e-001, 3.630784e-001, 3.646185e-001, 3.661573e-001, 3.676884e-001, 3.692195e-001, 3.707507e-001, 3.722807e-001, 3.738102e-001,
+3.753307e-001, 3.768486e-001, 3.783572e-001, 3.798608e-001, 3.813571e-001, 3.828430e-001, 3.843211e-001, 3.857963e-001, 3.872702e-001, 3.887483e-001,
+3.902273e-001, 3.916977e-001, 3.931672e-001, 3.946342e-001, 3.961011e-001, 3.975508e-001, 3.990003e-001, 4.004559e-001, 4.019116e-001, 4.033721e-001,
+4.048328e-001, 4.062802e-001, 4.077258e-001, 4.091561e-001, 4.105821e-001, 4.120020e-001, 4.134189e-001, 4.148292e-001, 4.162329e-001, 4.176311e-001,
+4.190171e-001, 4.204013e-001, 4.217655e-001, 4.231297e-001, 4.244850e-001, 4.258384e-001, 4.271919e-001, 4.285453e-001, 4.298978e-001, 4.312471e-001,
+4.325964e-001, 4.339383e-001, 4.352790e-001, 4.366140e-001, 4.379423e-001, 4.392706e-001, 4.405962e-001, 4.419219e-001, 4.432437e-001, 4.445624e-001,
+4.458796e-001, 4.471734e-001, 4.484672e-001, 4.497536e-001, 4.510330e-001, 4.523125e-001, 4.535883e-001, 4.548640e-001, 4.561336e-001, 4.573904e-001,
+4.586473e-001, 4.598957e-001, 4.611398e-001, 4.623838e-001, 4.636138e-001, 4.648432e-001, 4.660690e-001, 4.672826e-001, 4.684962e-001, 4.697115e-001,
+4.709290e-001, 4.721465e-001, 4.733570e-001, 4.745635e-001, 4.757699e-001, 4.769655e-001, 4.781580e-001, 4.793504e-001, 4.805292e-001, 4.817060e-001,
+4.828827e-001, 4.840502e-001, 4.852169e-001, 4.863836e-001, 4.875405e-001, 4.886966e-001, 4.898527e-001, 4.909954e-001, 4.921365e-001, 4.932776e-001,
+4.943978e-001, 4.955133e-001, 4.966288e-001, 4.977381e-001, 4.988445e-001, 4.999509e-001, 5.010526e-001, 5.021499e-001, 5.032472e-001, 5.043412e-001,
+5.054274e-001, 5.065135e-001, 5.075993e-001, 5.086715e-001, 5.097437e-001, 5.108159e-001, 5.118789e-001, 5.129379e-001, 5.139970e-001, 5.150540e-001,
+5.161071e-001, 5.171603e-001, 5.182134e-001, 5.192496e-001, 5.202844e-001, 5.213191e-001, 5.223446e-001, 5.233589e-001, 5.243731e-001, 5.253874e-001,
+5.263924e-001, 5.273967e-001, 5.284010e-001, 5.294005e-001, 5.303912e-001, 5.313820e-001, 5.323727e-001, 5.333474e-001, 5.343161e-001, 5.352847e-001,
+5.362531e-001, 5.372167e-001, 5.381803e-001, 5.391438e-001, 5.401028e-001, 5.410515e-001, 5.420002e-001, 5.429489e-001, 5.438944e-001, 5.448371e-001,
+5.457797e-001, 5.467223e-001, 5.476604e-001, 5.485961e-001, 5.495318e-001, 5.504675e-001, 5.513973e-001, 5.523252e-001, 5.532531e-001, 5.541811e-001,
+5.551019e-001, 5.560209e-001, 5.569399e-001, 5.578589e-001, 5.587706e-001, 5.596801e-001, 5.605895e-001, 5.614990e-001, 5.624088e-001, 5.633186e-001,
+5.642285e-001, 5.651384e-001, 5.660479e-001, 5.669571e-001, 5.678663e-001, 5.687755e-001, 5.696834e-001, 5.705887e-001, 5.714940e-001, 5.723993e-001,
+5.733037e-001, 5.741963e-001, 5.750889e-001, 5.759815e-001, 5.768742e-001, 5.777689e-001, 5.786644e-001, 5.795600e-001, 5.804555e-001, 5.813495e-001,
+5.822403e-001, 5.831312e-001, 5.840221e-001, 5.849129e-001, 5.857966e-001, 5.866792e-001, 5.875618e-001, 5.884445e-001, 5.893244e-001, 5.901989e-001,
+5.910735e-001, 5.919481e-001, 5.928227e-001, 5.936961e-001, 5.945691e-001, 5.954422e-001, 5.963152e-001, 5.971875e-001, 5.980508e-001, 5.989142e-001,
+5.997775e-001, 6.006408e-001, 6.015027e-001, 6.023618e-001, 6.032209e-001, 6.040800e-001, 6.049390e-001, 6.057918e-001, 6.066388e-001, 6.074859e-001,
+6.083329e-001, 6.091800e-001, 6.100225e-001, 6.108626e-001, 6.117026e-001, 6.125427e-001, 6.133828e-001, 6.142180e-001, 6.150510e-001, 6.158841e-001,
+6.167172e-001, 6.175503e-001, 6.183787e-001, 6.192048e-001, 6.200310e-001, 6.208571e-001, 6.216833e-001, 6.225084e-001, 6.233326e-001, 6.241569e-001,
+6.249812e-001, 6.258055e-001, 6.266261e-001, 6.274409e-001, 6.282557e-001, 6.290705e-001, 6.298853e-001, 6.306994e-001, 6.315096e-001, 6.323197e-001,
+6.331299e-001, 6.339400e-001, 6.347502e-001, 6.355508e-001, 6.363491e-001, 6.371475e-001, 6.379458e-001, 6.387441e-001, 6.395425e-001, 6.403411e-001,
+6.411397e-001, 6.419383e-001, 6.427369e-001, 6.435354e-001, 6.443220e-001, 6.451072e-001, 6.458923e-001, 6.466774e-001, 6.474626e-001, 6.482473e-001,
+6.490309e-001, 6.498146e-001, 6.505983e-001, 6.513819e-001, 6.521656e-001, 6.529438e-001, 6.537193e-001, 6.544947e-001, 6.552701e-001, 6.560455e-001,
+6.568210e-001, 6.575929e-001, 6.583645e-001, 6.591362e-001, 6.599078e-001, 6.606794e-001, 6.614501e-001, 6.622111e-001, 6.629720e-001, 6.637329e-001,
+6.644939e-001, 6.652548e-001, 6.660150e-001, 6.667713e-001, 6.675275e-001, 6.682838e-001, 6.690401e-001, 6.697964e-001, 6.705529e-001, 6.713106e-001,
+6.720684e-001, 6.728261e-001, 6.735839e-001, 6.743416e-001, 6.750989e-001, 6.758497e-001, 6.766005e-001, 6.773512e-001, 6.781020e-001, 6.788528e-001,
+6.796036e-001, 6.803465e-001, 6.810884e-001, 6.818303e-001, 6.825722e-001, 6.833141e-001, 6.840560e-001, 6.847928e-001, 6.855261e-001, 6.862595e-001,
+6.869929e-001, 6.877262e-001, 6.884596e-001, 6.891936e-001, 6.899295e-001, 6.906655e-001, 6.914015e-001, 6.921374e-001, 6.928734e-001, 6.936093e-001,
+6.943377e-001, 6.950636e-001, 6.957896e-001, 6.965156e-001, 6.972415e-001, 6.979675e-001, 6.986933e-001, 6.994188e-001, 7.001444e-001, 7.008699e-001,
+7.015954e-001, 7.023209e-001, 7.030464e-001, 7.037688e-001, 7.044886e-001, 7.052084e-001, 7.059281e-001, 7.066479e-001, 7.073677e-001, 7.080874e-001,
+7.088060e-001, 7.095242e-001, 7.102423e-001, 7.109605e-001, 7.116787e-001, 7.123969e-001, 7.131150e-001, 7.138309e-001, 7.145465e-001, 7.152621e-001,
+7.159777e-001, 7.166933e-001, 7.174089e-001, 7.181245e-001, 7.188359e-001, 7.195470e-001, 7.202581e-001, 7.209693e-001, 7.216804e-001, 7.223916e-001,
+7.231027e-001, 7.238089e-001, 7.245143e-001, 7.252198e-001, 7.259252e-001, 7.266307e-001, 7.273361e-001, 7.280416e-001, 7.287421e-001, 7.294405e-001,
+7.301388e-001, 7.308372e-001, 7.315356e-001, 7.322340e-001, 7.329324e-001, 7.336298e-001, 7.343257e-001, 7.350217e-001, 7.357177e-001, 7.364136e-001,
+7.371096e-001, 7.378056e-001, 7.385015e-001, 7.391961e-001, 7.398906e-001, 7.405852e-001, 7.412798e-001, 7.419744e-001, 7.426689e-001, 7.433635e-001,
+7.440590e-001, 7.447553e-001, 7.454517e-001, 7.461480e-001, 7.468443e-001, 7.475407e-001, 7.482370e-001, 7.489333e-001, 7.496249e-001, 7.503161e-001,
+7.510072e-001, 7.516984e-001, 7.523895e-001, 7.530807e-001, 7.537718e-001, 7.544626e-001, 7.551519e-001, 7.558412e-001, 7.565305e-001, 7.572198e-001,
+7.579091e-001, 7.585984e-001, 7.592877e-001, 7.599760e-001, 7.606625e-001, 7.613489e-001, 7.620353e-001, 7.627218e-001, 7.634082e-001, 7.640946e-001,
+7.647810e-001, 7.654657e-001, 7.661475e-001, 7.668293e-001, 7.675111e-001, 7.681930e-001, 7.688748e-001, 7.695566e-001, 7.702384e-001, 7.709182e-001,
+7.715934e-001, 7.722685e-001, 7.729437e-001, 7.736188e-001, 7.742940e-001, 7.749692e-001, 7.756443e-001, 7.763193e-001, 7.769931e-001, 7.776669e-001,
+7.783407e-001, 7.790145e-001, 7.796883e-001, 7.803621e-001, 7.810359e-001, 7.817097e-001, 7.823808e-001, 7.830513e-001, 7.837217e-001, 7.843922e-001,
+7.850626e-001, 7.857330e-001, 7.864035e-001, 7.870739e-001, 7.877444e-001, 7.884149e-001, 7.890855e-001, 7.897560e-001, 7.904265e-001, 7.910971e-001,
+7.917676e-001, 7.924381e-001, 7.931086e-001, 7.937740e-001, 7.944378e-001, 7.951016e-001, 7.957654e-001, 7.964292e-001, 7.970930e-001, 7.977568e-001,
+7.984206e-001, 7.990842e-001, 7.997450e-001, 8.004058e-001, 8.010666e-001, 8.017274e-001, 8.023882e-001, 8.030490e-001, 8.037098e-001, 8.043706e-001,
+8.050302e-001, 8.056856e-001, 8.063411e-001, 8.069965e-001, 8.076520e-001, 8.083074e-001, 8.089628e-001, 8.096183e-001, 8.102737e-001, 8.109273e-001,
+8.115759e-001, 8.122244e-001, 8.128730e-001, 8.135215e-001, 8.141701e-001, 8.148186e-001, 8.154672e-001, 8.161157e-001, 8.167629e-001, 8.174033e-001,
+8.180438e-001, 8.186842e-001, 8.193246e-001, 8.199651e-001, 8.206055e-001, 8.212460e-001, 8.218864e-001, 8.225269e-001, 8.231631e-001, 8.237991e-001,
+8.244350e-001, 8.250710e-001, 8.257070e-001, 8.263430e-001, 8.269789e-001, 8.276149e-001, 8.282509e-001, 8.288805e-001, 8.295054e-001, 8.301303e-001,
+8.307551e-001, 8.313800e-001, 8.320049e-001, 8.326297e-001, 8.332546e-001, 8.338795e-001, 8.345039e-001, 8.351210e-001, 8.357381e-001, 8.363551e-001,
+8.369722e-001, 8.375893e-001, 8.382064e-001, 8.388235e-001, 8.394406e-001, 8.400577e-001, 8.406691e-001, 8.412723e-001, 8.418755e-001, 8.424787e-001,
+8.430819e-001, 8.436851e-001, 8.442883e-001, 8.448915e-001, 8.454947e-001, 8.460979e-001, 8.466901e-001, 8.472755e-001, 8.478608e-001, 8.484462e-001,
+8.490315e-001, 8.496169e-001, 8.502022e-001, 8.507875e-001, 8.513729e-001, 8.519582e-001, 8.525332e-001, 8.531031e-001, 8.536729e-001, 8.542428e-001,
+8.548127e-001, 8.553825e-001, 8.559524e-001, 8.565223e-001, 8.570921e-001, 8.576620e-001, 8.582289e-001, 8.587937e-001, 8.593584e-001, 8.599232e-001,
+8.604880e-001, 8.610527e-001, 8.616175e-001, 8.621823e-001, 8.627470e-001, 8.633118e-001, 8.638729e-001, 8.644266e-001, 8.649803e-001, 8.655340e-001,
+8.660877e-001, 8.666414e-001, 8.671951e-001, 8.677488e-001, 8.683025e-001, 8.688562e-001, 8.694099e-001, 8.699470e-001, 8.704831e-001, 8.710192e-001,
+8.715553e-001, 8.720914e-001, 8.726275e-001, 8.731635e-001, 8.736996e-001, 8.742357e-001, 8.747718e-001, 8.753022e-001, 8.758237e-001, 8.763453e-001,
+8.768668e-001, 8.773883e-001, 8.779099e-001, 8.784314e-001, 8.789529e-001, 8.794744e-001, 8.799960e-001, 8.805175e-001, 8.810274e-001, 8.815319e-001,
+8.820363e-001, 8.825408e-001, 8.830453e-001, 8.835498e-001, 8.840542e-001, 8.845587e-001, 8.850632e-001, 8.855676e-001, 8.860721e-001, 8.865699e-001,
+8.870661e-001, 8.875623e-001, 8.880585e-001, 8.885547e-001, 8.890509e-001, 8.895472e-001, 8.900434e-001, 8.905396e-001, 8.910358e-001, 8.915320e-001,
+8.920152e-001, 8.924948e-001, 8.929744e-001, 8.934540e-001, 8.939337e-001, 8.944133e-001, 8.948929e-001, 8.953725e-001, 8.958521e-001, 8.963317e-001,
+8.968113e-001, 8.972868e-001, 8.977593e-001, 8.982318e-001, 8.987044e-001, 8.991769e-001, 8.996494e-001, 9.001220e-001, 9.005945e-001, 9.010671e-001,
+9.015396e-001, 9.020121e-001, 9.024820e-001, 9.029427e-001, 9.034033e-001, 9.038640e-001, 9.043247e-001, 9.047854e-001, 9.052460e-001, 9.057067e-001,
+9.061674e-001, 9.066281e-001, 9.070887e-001, 9.075494e-001, 9.080064e-001, 9.084617e-001, 9.089169e-001, 9.093722e-001, 9.098275e-001, 9.102828e-001,
+9.107381e-001, 9.111934e-001, 9.116487e-001, 9.121040e-001, 9.125593e-001, 9.130146e-001, 9.134653e-001, 9.139158e-001, 9.143664e-001, 9.148170e-001,
+9.152675e-001, 9.157181e-001, 9.161687e-001, 9.166192e-001, 9.170698e-001, 9.175204e-001, 9.179709e-001, 9.184200e-001, 9.188567e-001, 9.192935e-001,
+9.197302e-001, 9.201670e-001, 9.206037e-001, 9.210404e-001, 9.214772e-001, 9.219139e-001, 9.223507e-001, 9.227874e-001, 9.232241e-001, 9.236607e-001,
+9.240929e-001, 9.245252e-001, 9.249575e-001, 9.253897e-001, 9.258220e-001, 9.262543e-001, 9.266865e-001, 9.271188e-001, 9.275511e-001, 9.279833e-001,
+9.284156e-001, 9.288479e-001, 9.292709e-001, 9.296919e-001, 9.301128e-001, 9.305338e-001, 9.309548e-001, 9.313757e-001, 9.317967e-001, 9.322176e-001,
+9.326386e-001, 9.330596e-001, 9.334805e-001, 9.339015e-001, 9.343216e-001, 9.347404e-001, 9.351593e-001, 9.355781e-001, 9.359970e-001, 9.364159e-001,
+9.368347e-001, 9.372536e-001, 9.376724e-001, 9.380913e-001, 9.385101e-001, 9.389290e-001, 9.393478e-001, 9.397597e-001, 9.401697e-001, 9.405797e-001,
+9.409896e-001, 9.413996e-001, 9.418096e-001, 9.422196e-001, 9.426296e-001, 9.430396e-001, 9.434496e-001, 9.438596e-001, 9.442696e-001, 9.446796e-001,
+9.450819e-001, 9.454843e-001, 9.458866e-001, 9.462889e-001, 9.466912e-001, 9.470935e-001, 9.474958e-001, 9.478981e-001, 9.483005e-001, 9.487028e-001,
+9.491051e-001, 9.495074e-001, 9.499096e-001, 9.503046e-001, 9.506996e-001, 9.510946e-001, 9.514895e-001, 9.518845e-001, 9.522795e-001, 9.526745e-001,
+9.530694e-001, 9.534644e-001, 9.538594e-001, 9.542544e-001, 9.546493e-001, 9.550443e-001, 9.554365e-001, 9.558282e-001, 9.562199e-001, 9.566115e-001,
+9.570032e-001, 9.573949e-001, 9.577865e-001, 9.581782e-001, 9.585698e-001, 9.589615e-001, 9.593532e-001, 9.597448e-001, 9.601365e-001, 9.605246e-001,
+9.609083e-001, 9.612921e-001, 9.616759e-001, 9.620596e-001, 9.624434e-001, 9.628272e-001, 9.632109e-001, 9.635947e-001, 9.639785e-001, 9.643622e-001,
+9.647460e-001, 9.651298e-001, 9.655135e-001, 9.658905e-001, 9.662665e-001, 9.666425e-001, 9.670186e-001, 9.673946e-001, 9.677706e-001, 9.681466e-001,
+9.685227e-001, 9.688987e-001, 9.692747e-001, 9.696507e-001, 9.700268e-001, 9.704028e-001, 9.707782e-001, 9.711479e-001, 9.715176e-001, 9.718872e-001,
+9.722569e-001, 9.726266e-001, 9.729963e-001, 9.733660e-001, 9.737357e-001, 9.741054e-001, 9.744751e-001, 9.748448e-001, 9.752145e-001, 9.755842e-001,
+9.759528e-001, 9.763130e-001, 9.766732e-001, 9.770335e-001, 9.773937e-001, 9.777539e-001, 9.781142e-001, 9.784744e-001, 9.788346e-001, 9.791949e-001,
+9.795551e-001, 9.799153e-001, 9.802756e-001, 9.806358e-001, 9.809960e-001, 9.813417e-001, 9.816861e-001, 9.820305e-001, 9.823750e-001, 9.827194e-001,
+9.830638e-001, 9.834083e-001, 9.837527e-001, 9.840971e-001, 9.844415e-001, 9.847860e-001, 9.851304e-001, 9.854748e-001, 9.858193e-001, 9.861569e-001,
+9.864884e-001, 9.868198e-001, 9.871512e-001, 9.874826e-001, 9.878140e-001, 9.881454e-001, 9.884769e-001, 9.888083e-001, 9.891397e-001, 9.894711e-001,
+9.898025e-001, 9.901340e-001, 9.904654e-001, 9.907968e-001, 9.911096e-001, 9.914203e-001, 9.917310e-001, 9.920417e-001, 9.923524e-001, 9.926631e-001,
+9.929738e-001, 9.932845e-001, 9.935952e-001, 9.939059e-001, 9.942166e-001, 9.945273e-001, 9.948380e-001, 9.951487e-001, 9.954589e-001, 9.957616e-001,
+9.960644e-001, 9.963671e-001, 9.966699e-001, 9.969726e-001, 9.972753e-001, 9.975781e-001, 9.978808e-001, 9.981836e-001, 9.984863e-001, 9.987890e-001,
+9.990918e-001, 9.993945e-001, 9.996973e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.593097e-002, 2.862598e-002, 3.930327e-002, 4.868465e-002, 5.711687e-002, 6.478485e-002, 7.182557e-002, 7.837460e-002, 8.453601e-002,
+9.028415e-002, 9.563114e-002, 1.007089e-001, 1.055678e-001, 1.101926e-001, 1.146183e-001, 1.188453e-001, 1.229264e-001, 1.268836e-001, 1.307622e-001,
+1.345601e-001, 1.383389e-001, 1.420553e-001, 1.457192e-001, 1.493069e-001, 1.528359e-001, 1.562989e-001, 1.596667e-001, 1.629732e-001, 1.662474e-001,
+1.694675e-001, 1.726872e-001, 1.758598e-001, 1.789811e-001, 1.820619e-001, 1.850834e-001, 1.880794e-001, 1.910150e-001, 1.939161e-001, 1.967921e-001,
+1.996531e-001, 2.024717e-001, 2.052705e-001, 2.080610e-001, 2.108310e-001, 2.135528e-001, 2.162420e-001, 2.188851e-001, 2.214844e-001, 2.240576e-001,
+2.266031e-001, 2.291244e-001, 2.316230e-001, 2.340889e-001, 2.365392e-001, 2.389808e-001, 2.413962e-001, 2.437824e-001, 2.461562e-001, 2.485168e-001,
+2.508699e-001, 2.532047e-001, 2.555143e-001, 2.578059e-001, 2.600739e-001, 2.623230e-001, 2.645553e-001, 2.667698e-001, 2.689580e-001, 2.711285e-001,
+2.732938e-001, 2.754479e-001, 2.775818e-001, 2.796878e-001, 2.817657e-001, 2.838353e-001, 2.858907e-001, 2.879245e-001, 2.899452e-001, 2.919526e-001,
+2.939467e-001, 2.959287e-001, 2.978995e-001, 2.998577e-001, 3.018038e-001, 3.037435e-001, 3.056769e-001, 3.075989e-001, 3.095020e-001, 3.113961e-001,
+3.132843e-001, 3.151694e-001, 3.170453e-001, 3.189097e-001, 3.207617e-001, 3.225967e-001, 3.244308e-001, 3.262627e-001, 3.280918e-001, 3.298951e-001,
+3.316844e-001, 3.334603e-001, 3.352112e-001, 3.369530e-001, 3.386858e-001, 3.404065e-001, 3.421171e-001, 3.438138e-001, 3.454997e-001, 3.471781e-001,
+3.488381e-001, 3.504877e-001, 3.521301e-001, 3.537612e-001, 3.553893e-001, 3.570110e-001, 3.586301e-001, 3.602473e-001, 3.618557e-001, 3.634609e-001,
+3.650503e-001, 3.666362e-001, 3.682140e-001, 3.697811e-001, 3.713372e-001, 3.728885e-001, 3.744374e-001, 3.759794e-001, 3.775197e-001, 3.790464e-001,
+3.805717e-001, 3.820922e-001, 3.836125e-001, 3.851282e-001, 3.866433e-001, 3.881508e-001, 3.896571e-001, 3.911464e-001, 3.926355e-001, 3.941121e-001,
+3.955887e-001, 3.970467e-001, 3.985039e-001, 3.999439e-001, 4.013813e-001, 4.028141e-001, 4.042452e-001, 4.056676e-001, 4.070835e-001, 4.084953e-001,
+4.099005e-001, 4.113028e-001, 4.126910e-001, 4.140792e-001, 4.154513e-001, 4.168217e-001, 4.181850e-001, 4.195438e-001, 4.209015e-001, 4.222565e-001,
+4.236116e-001, 4.249607e-001, 4.263094e-001, 4.276516e-001, 4.289884e-001, 4.303237e-001, 4.316474e-001, 4.329712e-001, 4.342881e-001, 4.356011e-001,
+4.369125e-001, 4.382139e-001, 4.395152e-001, 4.408144e-001, 4.421120e-001, 4.434093e-001, 4.446893e-001, 4.459693e-001, 4.472444e-001, 4.485122e-001,
+4.497800e-001, 4.510426e-001, 4.523035e-001, 4.535635e-001, 4.548071e-001, 4.560508e-001, 4.572937e-001, 4.585349e-001, 4.597762e-001, 4.610106e-001,
+4.622391e-001, 4.634676e-001, 4.646885e-001, 4.659062e-001, 4.671240e-001, 4.683316e-001, 4.695375e-001, 4.707434e-001, 4.719372e-001, 4.731303e-001,
+4.743235e-001, 4.755181e-001, 4.767127e-001, 4.779073e-001, 4.790931e-001, 4.802790e-001, 4.814649e-001, 4.826443e-001, 4.838236e-001, 4.850028e-001,
+4.861754e-001, 4.873472e-001, 4.885190e-001, 4.896813e-001, 4.908406e-001, 4.919999e-001, 4.931561e-001, 4.943102e-001, 4.954642e-001, 4.966160e-001,
+4.977641e-001, 4.989122e-001, 5.000599e-001, 5.012037e-001, 5.023476e-001, 5.034914e-001, 5.046313e-001, 5.057701e-001, 5.069089e-001, 5.080436e-001,
+5.091723e-001, 5.103010e-001, 5.114297e-001, 5.125469e-001, 5.136641e-001, 5.147813e-001, 5.158961e-001, 5.170088e-001, 5.181215e-001, 5.192342e-001,
+5.203433e-001, 5.214524e-001, 5.225615e-001, 5.236659e-001, 5.247640e-001, 5.258621e-001, 5.269601e-001, 5.280525e-001, 5.291435e-001, 5.302344e-001,
+5.313249e-001, 5.324122e-001, 5.334995e-001, 5.345867e-001, 5.356700e-001, 5.367467e-001, 5.378235e-001, 5.389002e-001, 5.399749e-001, 5.410481e-001,
+5.421213e-001, 5.431945e-001, 5.442599e-001, 5.453225e-001, 5.463851e-001, 5.474477e-001, 5.485046e-001, 5.495604e-001, 5.506161e-001, 5.516719e-001,
+5.527249e-001, 5.537775e-001, 5.548301e-001, 5.558827e-001, 5.569268e-001, 5.579693e-001, 5.590119e-001, 5.600544e-001, 5.610944e-001, 5.621335e-001,
+5.631726e-001, 5.642117e-001, 5.652445e-001, 5.662733e-001, 5.673021e-001, 5.683309e-001, 5.693570e-001, 5.703791e-001, 5.714012e-001, 5.724233e-001,
+5.734450e-001, 5.744643e-001, 5.754837e-001, 5.765030e-001, 5.775224e-001, 5.785338e-001, 5.795433e-001, 5.805527e-001, 5.815622e-001, 5.825702e-001,
+5.835762e-001, 5.845821e-001, 5.855881e-001, 5.865940e-001, 5.875905e-001, 5.885864e-001, 5.895823e-001, 5.905782e-001, 5.915714e-001, 5.925609e-001,
+5.935503e-001, 5.945397e-001, 5.955292e-001, 5.965165e-001, 5.975033e-001, 5.984901e-001, 5.994769e-001, 6.004620e-001, 6.014366e-001, 6.024111e-001,
+6.033857e-001, 6.043603e-001, 6.053301e-001, 6.062928e-001, 6.072555e-001, 6.082183e-001, 6.091810e-001, 6.101375e-001, 6.110896e-001, 6.120418e-001,
+6.129939e-001, 6.139461e-001, 6.148931e-001, 6.158381e-001, 6.167831e-001, 6.177282e-001, 6.186732e-001, 6.196153e-001, 6.205566e-001, 6.214978e-001,
+6.224391e-001, 6.233803e-001, 6.243142e-001, 6.252454e-001, 6.261766e-001, 6.271078e-001, 6.280390e-001, 6.289677e-001, 6.298949e-001, 6.308221e-001,
+6.317494e-001, 6.326766e-001, 6.335960e-001, 6.345061e-001, 6.354162e-001, 6.363263e-001, 6.372364e-001, 6.381447e-001, 6.390462e-001, 6.399477e-001,
+6.408492e-001, 6.417507e-001, 6.426522e-001, 6.435451e-001, 6.444366e-001, 6.453281e-001, 6.462196e-001, 6.471111e-001, 6.479978e-001, 6.488788e-001,
+6.497598e-001, 6.506408e-001, 6.515218e-001, 6.524028e-001, 6.532748e-001, 6.541465e-001, 6.550181e-001, 6.558898e-001, 6.567614e-001, 6.576270e-001,
+6.584825e-001, 6.593380e-001, 6.601936e-001, 6.610491e-001, 6.619046e-001, 6.627511e-001, 6.635940e-001, 6.644369e-001, 6.652798e-001, 6.661227e-001,
+6.669656e-001, 6.677941e-001, 6.686222e-001, 6.694504e-001, 6.702785e-001, 6.711066e-001, 6.719335e-001, 6.727536e-001, 6.735736e-001, 6.743936e-001,
+6.752136e-001, 6.760336e-001, 6.768512e-001, 6.776608e-001, 6.784704e-001, 6.792800e-001, 6.800896e-001, 6.808992e-001, 6.817059e-001, 6.825024e-001,
+6.832989e-001, 6.840954e-001, 6.848919e-001, 6.856884e-001, 6.864832e-001, 6.872666e-001, 6.880500e-001, 6.888334e-001, 6.896168e-001, 6.904002e-001,
+6.911836e-001, 6.919562e-001, 6.927281e-001, 6.935000e-001, 6.942719e-001, 6.950438e-001, 6.958157e-001, 6.965779e-001, 6.973350e-001, 6.980922e-001,
+6.988493e-001, 6.996064e-001, 7.003636e-001, 7.011185e-001, 7.018679e-001, 7.026173e-001, 7.033667e-001, 7.041161e-001, 7.048655e-001, 7.056149e-001,
+7.063498e-001, 7.070816e-001, 7.078134e-001, 7.085452e-001, 7.092770e-001, 7.100087e-001, 7.107384e-001, 7.114617e-001, 7.121850e-001, 7.129083e-001,
+7.136316e-001, 7.143549e-001, 7.150782e-001, 7.157931e-001, 7.165022e-001, 7.172113e-001, 7.179204e-001, 7.186294e-001, 7.193385e-001, 7.200476e-001,
+7.207497e-001, 7.214504e-001, 7.221511e-001, 7.228518e-001, 7.235525e-001, 7.242533e-001, 7.249540e-001, 7.256455e-001, 7.263367e-001, 7.270279e-001,
+7.277192e-001, 7.284104e-001, 7.291016e-001, 7.297928e-001, 7.304674e-001, 7.311419e-001, 7.318165e-001, 7.324910e-001, 7.331656e-001, 7.338401e-001,
+7.345147e-001, 7.351783e-001, 7.358411e-001, 7.365039e-001, 7.371666e-001, 7.378294e-001, 7.384922e-001, 7.391550e-001, 7.398017e-001, 7.404432e-001,
+7.410847e-001, 7.417262e-001, 7.423677e-001, 7.430092e-001, 7.436507e-001, 7.442871e-001, 7.449178e-001, 7.455485e-001, 7.461792e-001, 7.468099e-001,
+7.474407e-001, 7.480714e-001, 7.487009e-001, 7.493169e-001, 7.499329e-001, 7.505489e-001, 7.511649e-001, 7.517809e-001, 7.523969e-001, 7.530129e-001,
+7.536231e-001, 7.542292e-001, 7.548352e-001, 7.554412e-001, 7.560473e-001, 7.566533e-001, 7.572593e-001, 7.578654e-001, 7.584576e-001, 7.590493e-001,
+7.596410e-001, 7.602327e-001, 7.608244e-001, 7.614161e-001, 7.620078e-001, 7.625958e-001, 7.631718e-001, 7.637478e-001, 7.643238e-001, 7.648998e-001,
+7.654758e-001, 7.660518e-001, 7.666278e-001, 7.671978e-001, 7.677584e-001, 7.683190e-001, 7.688796e-001, 7.694402e-001, 7.700008e-001, 7.705614e-001,
+7.711220e-001, 7.716754e-001, 7.722192e-001, 7.727631e-001, 7.733069e-001, 7.738507e-001, 7.743945e-001, 7.749384e-001, 7.754822e-001, 7.760233e-001,
+7.765594e-001, 7.770955e-001, 7.776316e-001, 7.781677e-001, 7.787038e-001, 7.792399e-001, 7.797760e-001, 7.803100e-001, 7.808323e-001, 7.813545e-001,
+7.818767e-001, 7.823990e-001, 7.829212e-001, 7.834434e-001, 7.839657e-001, 7.844879e-001, 7.850015e-001, 7.855133e-001, 7.860250e-001, 7.865368e-001,
+7.870485e-001, 7.875603e-001, 7.880721e-001, 7.885838e-001, 7.890910e-001, 7.895908e-001, 7.900906e-001, 7.905903e-001, 7.910901e-001, 7.915899e-001,
+7.920896e-001, 7.925894e-001, 7.930892e-001, 7.935797e-001, 7.940680e-001, 7.945562e-001, 7.950445e-001, 7.955328e-001, 7.960211e-001, 7.965093e-001,
+7.969976e-001, 7.974849e-001, 7.979636e-001, 7.984423e-001, 7.989211e-001, 7.993998e-001, 7.998785e-001, 8.003572e-001, 8.008359e-001, 8.013146e-001,
+8.017914e-001, 8.022627e-001, 8.027341e-001, 8.032055e-001, 8.036769e-001, 8.041483e-001, 8.046196e-001, 8.050910e-001, 8.055624e-001, 8.060321e-001,
+8.064982e-001, 8.069643e-001, 8.074304e-001, 8.078964e-001, 8.083625e-001, 8.088286e-001, 8.092946e-001, 8.097607e-001, 8.102261e-001, 8.106890e-001,
+8.111518e-001, 8.116147e-001, 8.120776e-001, 8.125404e-001, 8.130033e-001, 8.134662e-001, 8.139290e-001, 8.143919e-001, 8.148488e-001, 8.153056e-001,
+8.157624e-001, 8.162191e-001, 8.166759e-001, 8.171327e-001, 8.175895e-001, 8.180463e-001, 8.185031e-001, 8.189596e-001, 8.194159e-001, 8.198722e-001,
+8.203285e-001, 8.207848e-001, 8.212411e-001, 8.216974e-001, 8.221537e-001, 8.226100e-001, 8.230659e-001, 8.235191e-001, 8.239723e-001, 8.244254e-001,
+8.248786e-001, 8.253317e-001, 8.257849e-001, 8.262380e-001, 8.266912e-001, 8.271443e-001, 8.275968e-001, 8.280483e-001, 8.284998e-001, 8.289513e-001,
+8.294028e-001, 8.298543e-001, 8.303058e-001, 8.307573e-001, 8.312088e-001, 8.316603e-001, 8.321078e-001, 8.325531e-001, 8.329984e-001, 8.334437e-001,
+8.338890e-001, 8.343343e-001, 8.347796e-001, 8.352249e-001, 8.356702e-001, 8.361155e-001, 8.365577e-001, 8.369986e-001, 8.374396e-001, 8.378805e-001,
+8.383214e-001, 8.387623e-001, 8.392032e-001, 8.396442e-001, 8.400851e-001, 8.405260e-001, 8.409655e-001, 8.414040e-001, 8.418425e-001, 8.422811e-001,
+8.427196e-001, 8.431582e-001, 8.435967e-001, 8.440352e-001, 8.444738e-001, 8.449123e-001, 8.453506e-001, 8.457885e-001, 8.462264e-001, 8.466644e-001,
+8.471023e-001, 8.475402e-001, 8.479781e-001, 8.484160e-001, 8.488539e-001, 8.492919e-001, 8.497298e-001, 8.501740e-001, 8.506183e-001, 8.510627e-001,
+8.515071e-001, 8.519515e-001, 8.523959e-001, 8.528403e-001, 8.532846e-001, 8.537290e-001, 8.541734e-001, 8.546188e-001, 8.550655e-001, 8.555122e-001,
+8.559589e-001, 8.564056e-001, 8.568523e-001, 8.572990e-001, 8.577457e-001, 8.581924e-001, 8.586392e-001, 8.590859e-001, 8.595321e-001, 8.599781e-001,
+8.604242e-001, 8.608702e-001, 8.613162e-001, 8.617623e-001, 8.622083e-001, 8.626543e-001, 8.631004e-001, 8.635464e-001, 8.639924e-001, 8.644400e-001,
+8.648879e-001, 8.653358e-001, 8.657837e-001, 8.662316e-001, 8.666794e-001, 8.671273e-001, 8.675752e-001, 8.680231e-001, 8.684710e-001, 8.689188e-001,
+8.693682e-001, 8.698180e-001, 8.702677e-001, 8.707175e-001, 8.711672e-001, 8.716170e-001, 8.720667e-001, 8.725165e-001, 8.729662e-001, 8.734159e-001,
+8.738657e-001, 8.743185e-001, 8.747732e-001, 8.752279e-001, 8.756826e-001, 8.761373e-001, 8.765920e-001, 8.770467e-001, 8.775014e-001, 8.779561e-001,
+8.784109e-001, 8.788656e-001, 8.793207e-001, 8.797769e-001, 8.802332e-001, 8.806894e-001, 8.811457e-001, 8.816020e-001, 8.820582e-001, 8.825145e-001,
+8.829707e-001, 8.834270e-001, 8.838833e-001, 8.843395e-001, 8.847973e-001, 8.852557e-001, 8.857141e-001, 8.861725e-001, 8.866309e-001, 8.870893e-001,
+8.875477e-001, 8.880061e-001, 8.884645e-001, 8.889229e-001, 8.893813e-001, 8.898397e-001, 8.903029e-001, 8.907660e-001, 8.912292e-001, 8.916923e-001,
+8.921554e-001, 8.926186e-001, 8.930817e-001, 8.935449e-001, 8.940080e-001, 8.944711e-001, 8.949343e-001, 8.953979e-001, 8.958651e-001, 8.963323e-001,
+8.967995e-001, 8.972667e-001, 8.977338e-001, 8.982010e-001, 8.986682e-001, 8.991354e-001, 8.996025e-001, 9.000697e-001, 9.005369e-001, 9.010049e-001,
+9.014832e-001, 9.019615e-001, 9.024398e-001, 9.029181e-001, 9.033964e-001, 9.038747e-001, 9.043530e-001, 9.048313e-001, 9.053096e-001, 9.057879e-001,
+9.062662e-001, 9.067445e-001, 9.072286e-001, 9.077139e-001, 9.081991e-001, 9.086844e-001, 9.091697e-001, 9.096550e-001, 9.101403e-001, 9.106256e-001,
+9.111109e-001, 9.115961e-001, 9.120814e-001, 9.125667e-001, 9.130540e-001, 9.135441e-001, 9.140342e-001, 9.145243e-001, 9.150145e-001, 9.155046e-001,
+9.159947e-001, 9.164848e-001, 9.169749e-001, 9.174651e-001, 9.179552e-001, 9.184453e-001, 9.189354e-001, 9.194251e-001, 9.199147e-001, 9.204042e-001,
+9.208938e-001, 9.213834e-001, 9.218729e-001, 9.223625e-001, 9.228521e-001, 9.233416e-001, 9.238312e-001, 9.243208e-001, 9.248104e-001, 9.252999e-001,
+9.257894e-001, 9.262789e-001, 9.267684e-001, 9.272579e-001, 9.277474e-001, 9.282369e-001, 9.287264e-001, 9.292159e-001, 9.297054e-001, 9.301949e-001,
+9.306843e-001, 9.311738e-001, 9.316634e-001, 9.321550e-001, 9.326466e-001, 9.331382e-001, 9.336298e-001, 9.341214e-001, 9.346130e-001, 9.351046e-001,
+9.355962e-001, 9.360878e-001, 9.365794e-001, 9.370710e-001, 9.375626e-001, 9.380542e-001, 9.385490e-001, 9.390444e-001, 9.395397e-001, 9.400351e-001,
+9.405305e-001, 9.410259e-001, 9.415213e-001, 9.420167e-001, 9.425121e-001, 9.430075e-001, 9.435028e-001, 9.439982e-001, 9.444936e-001, 9.449895e-001,
+9.454861e-001, 9.459826e-001, 9.464792e-001, 9.469757e-001, 9.474722e-001, 9.479688e-001, 9.484653e-001, 9.489619e-001, 9.494584e-001, 9.499549e-001,
+9.504515e-001, 9.509480e-001, 9.514446e-001, 9.519405e-001, 9.524363e-001, 9.529322e-001, 9.534280e-001, 9.539239e-001, 9.544197e-001, 9.549156e-001,
+9.554114e-001, 9.559073e-001, 9.564031e-001, 9.568990e-001, 9.573948e-001, 9.578907e-001, 9.583865e-001, 9.588823e-001, 9.593781e-001, 9.598739e-001,
+9.603696e-001, 9.608654e-001, 9.613612e-001, 9.618570e-001, 9.623527e-001, 9.628485e-001, 9.633443e-001, 9.638401e-001, 9.643358e-001, 9.648316e-001,
+9.653275e-001, 9.658238e-001, 9.663201e-001, 9.668164e-001, 9.673127e-001, 9.678090e-001, 9.683053e-001, 9.688016e-001, 9.692979e-001, 9.697942e-001,
+9.702905e-001, 9.707868e-001, 9.712831e-001, 9.717794e-001, 9.722757e-001, 9.727703e-001, 9.732648e-001, 9.737593e-001, 9.742537e-001, 9.747482e-001,
+9.752426e-001, 9.757371e-001, 9.762316e-001, 9.767260e-001, 9.772205e-001, 9.777150e-001, 9.782094e-001, 9.787039e-001, 9.791984e-001, 9.796868e-001,
+9.801697e-001, 9.806527e-001, 9.811356e-001, 9.816186e-001, 9.821015e-001, 9.825845e-001, 9.830674e-001, 9.835504e-001, 9.840333e-001, 9.845163e-001,
+9.849992e-001, 9.854822e-001, 9.859651e-001, 9.864481e-001, 9.869107e-001, 9.873710e-001, 9.878314e-001, 9.882918e-001, 9.887522e-001, 9.892126e-001,
+9.896730e-001, 9.901334e-001, 9.905937e-001, 9.910541e-001, 9.915145e-001, 9.919749e-001, 9.924353e-001, 9.928957e-001, 9.933550e-001, 9.937980e-001,
+9.942410e-001, 9.946840e-001, 9.951270e-001, 9.955700e-001, 9.960130e-001, 9.964560e-001, 9.968990e-001, 9.973420e-001, 9.977850e-001, 9.982280e-001,
+9.986710e-001, 9.991140e-001, 9.995570e-001, 1.000000e+000)),
+("Fujifilm", "F-400", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.036329e-002, 9.161454e-002, 1.141283e-001, 1.319569e-001, 1.474671e-001, 1.610251e-001, 1.732669e-001, 1.844484e-001, 1.948005e-001,
+2.044326e-001, 2.135391e-001, 2.222227e-001, 2.305279e-001, 2.384292e-001, 2.459528e-001, 2.531176e-001, 2.599834e-001, 2.665783e-001, 2.729393e-001,
+2.790790e-001, 2.850644e-001, 2.908408e-001, 2.965438e-001, 3.020818e-001, 3.074505e-001, 3.126476e-001, 3.176782e-001, 3.225967e-001, 3.274006e-001,
+3.320433e-001, 3.365654e-001, 3.410259e-001, 3.453224e-001, 3.495549e-001, 3.537135e-001, 3.577654e-001, 3.617588e-001, 3.657540e-001, 3.696199e-001,
+3.734039e-001, 3.770940e-001, 3.806685e-001, 3.841705e-001, 3.875945e-001, 3.909009e-001, 3.941605e-001, 3.973405e-001, 4.004949e-001, 4.036109e-001,
+4.066616e-001, 4.096830e-001, 4.127061e-001, 4.156986e-001, 4.186557e-001, 4.215945e-001, 4.244618e-001, 4.272699e-001, 4.300500e-001, 4.328002e-001,
+4.354939e-001, 4.381406e-001, 4.407618e-001, 4.433784e-001, 4.459332e-001, 4.484469e-001, 4.509405e-001, 4.534223e-001, 4.558777e-001, 4.582909e-001,
+4.606810e-001, 4.630530e-001, 4.653714e-001, 4.676779e-001, 4.699575e-001, 4.722292e-001, 4.745066e-001, 4.767519e-001, 4.789671e-001, 4.811646e-001,
+4.833408e-001, 4.854698e-001, 4.875838e-001, 4.896747e-001, 4.917361e-001, 4.937821e-001, 4.958267e-001, 4.978322e-001, 4.998154e-001, 5.017875e-001,
+5.037455e-001, 5.056618e-001, 5.075918e-001, 5.095140e-001, 5.114190e-001, 5.132684e-001, 5.151204e-001, 5.169650e-001, 5.187843e-001, 5.205676e-001,
+5.223403e-001, 5.241093e-001, 5.258463e-001, 5.275856e-001, 5.293406e-001, 5.310855e-001, 5.328161e-001, 5.345104e-001, 5.362127e-001, 5.379176e-001,
+5.396011e-001, 5.412701e-001, 5.429203e-001, 5.445726e-001, 5.462222e-001, 5.478433e-001, 5.494470e-001, 5.510246e-001, 5.525965e-001, 5.541655e-001,
+5.557032e-001, 5.572413e-001, 5.587987e-001, 5.603525e-001, 5.618990e-001, 5.634241e-001, 5.649274e-001, 5.664382e-001, 5.679532e-001, 5.694529e-001,
+5.709474e-001, 5.723991e-001, 5.738420e-001, 5.752863e-001, 5.767307e-001, 5.781518e-001, 5.795706e-001, 5.809578e-001, 5.823418e-001, 5.837211e-001,
+5.850996e-001, 5.864555e-001, 5.878060e-001, 5.891577e-001, 5.905099e-001, 5.918569e-001, 5.932002e-001, 5.945292e-001, 5.958389e-001, 5.971521e-001,
+5.984766e-001, 5.998010e-001, 6.011153e-001, 6.024296e-001, 6.037280e-001, 6.050212e-001, 6.063180e-001, 6.076188e-001, 6.089168e-001, 6.101981e-001,
+6.114793e-001, 6.127242e-001, 6.139590e-001, 6.151936e-001, 6.164277e-001, 6.176618e-001, 6.188758e-001, 6.200889e-001, 6.212957e-001, 6.224961e-001,
+6.236965e-001, 6.248923e-001, 6.260881e-001, 6.272731e-001, 6.284448e-001, 6.296164e-001, 6.307747e-001, 6.319309e-001, 6.330849e-001, 6.342328e-001,
+6.353806e-001, 6.365122e-001, 6.376328e-001, 6.387533e-001, 6.398714e-001, 6.409891e-001, 6.421050e-001, 6.432113e-001, 6.443176e-001, 6.454115e-001,
+6.464858e-001, 6.475602e-001, 6.486206e-001, 6.496705e-001, 6.507204e-001, 6.517605e-001, 6.527966e-001, 6.538327e-001, 6.548563e-001, 6.558769e-001,
+6.568975e-001, 6.579242e-001, 6.589520e-001, 6.599798e-001, 6.609984e-001, 6.620156e-001, 6.630329e-001, 6.640465e-001, 6.650594e-001, 6.660723e-001,
+6.670762e-001, 6.680769e-001, 6.690777e-001, 6.700694e-001, 6.710557e-001, 6.720419e-001, 6.730256e-001, 6.740061e-001, 6.749866e-001, 6.759674e-001,
+6.769494e-001, 6.779313e-001, 6.789132e-001, 6.798807e-001, 6.808475e-001, 6.818143e-001, 6.827754e-001, 6.837335e-001, 6.846915e-001, 6.856490e-001,
+6.866050e-001, 6.875610e-001, 6.885171e-001, 6.894577e-001, 6.903957e-001, 6.913337e-001, 6.922674e-001, 6.931942e-001, 6.941210e-001, 6.950477e-001,
+6.959590e-001, 6.968678e-001, 6.977766e-001, 6.986793e-001, 6.995667e-001, 7.004541e-001, 7.013415e-001, 7.022204e-001, 7.030950e-001, 7.039696e-001,
+7.048441e-001, 7.057146e-001, 7.065849e-001, 7.074552e-001, 7.083240e-001, 7.091880e-001, 7.100520e-001, 7.109160e-001, 7.117737e-001, 7.126240e-001,
+7.134742e-001, 7.143245e-001, 7.151702e-001, 7.160130e-001, 7.168557e-001, 7.176984e-001, 7.185257e-001, 7.193462e-001, 7.201668e-001, 7.209873e-001,
+7.217961e-001, 7.226006e-001, 7.234051e-001, 7.242096e-001, 7.250013e-001, 7.257877e-001, 7.265742e-001, 7.273607e-001, 7.281493e-001, 7.289392e-001,
+7.297291e-001, 7.305190e-001, 7.313020e-001, 7.320774e-001, 7.328529e-001, 7.336284e-001, 7.344021e-001, 7.351712e-001, 7.359404e-001, 7.367095e-001,
+7.374785e-001, 7.382401e-001, 7.390016e-001, 7.397632e-001, 7.405247e-001, 7.412761e-001, 7.420225e-001, 7.427689e-001, 7.435153e-001, 7.442602e-001,
+7.450011e-001, 7.457420e-001, 7.464829e-001, 7.472238e-001, 7.479678e-001, 7.487124e-001, 7.494571e-001, 7.502018e-001, 7.509424e-001, 7.516725e-001,
+7.524025e-001, 7.531326e-001, 7.538627e-001, 7.545817e-001, 7.552954e-001, 7.560091e-001, 7.567229e-001, 7.574366e-001, 7.581535e-001, 7.588703e-001,
+7.595872e-001, 7.603040e-001, 7.610172e-001, 7.617210e-001, 7.624248e-001, 7.631285e-001, 7.638323e-001, 7.645226e-001, 7.651978e-001, 7.658729e-001,
+7.665481e-001, 7.672233e-001, 7.678938e-001, 7.685611e-001, 7.692285e-001, 7.698958e-001, 7.705631e-001, 7.712235e-001, 7.718799e-001, 7.725364e-001,
+7.731929e-001, 7.738493e-001, 7.744975e-001, 7.751405e-001, 7.757835e-001, 7.764265e-001, 7.770696e-001, 7.777154e-001, 7.783639e-001, 7.790124e-001,
+7.796609e-001, 7.803094e-001, 7.809548e-001, 7.815938e-001, 7.822329e-001, 7.828719e-001, 7.835110e-001, 7.841491e-001, 7.847761e-001, 7.854030e-001,
+7.860300e-001, 7.866570e-001, 7.872840e-001, 7.879159e-001, 7.885495e-001, 7.891830e-001, 7.898166e-001, 7.904502e-001, 7.910811e-001, 7.917066e-001,
+7.923321e-001, 7.929577e-001, 7.935832e-001, 7.942087e-001, 7.948156e-001, 7.954189e-001, 7.960221e-001, 7.966254e-001, 7.972287e-001, 7.978311e-001,
+7.984311e-001, 7.990311e-001, 7.996311e-001, 8.002311e-001, 8.008311e-001, 8.014271e-001, 8.020205e-001, 8.026139e-001, 8.032073e-001, 8.038007e-001,
+8.043942e-001, 8.049714e-001, 8.055460e-001, 8.061206e-001, 8.066952e-001, 8.072699e-001, 8.078448e-001, 8.084273e-001, 8.090099e-001, 8.095924e-001,
+8.101750e-001, 8.107575e-001, 8.113396e-001, 8.119179e-001, 8.124963e-001, 8.130746e-001, 8.136530e-001, 8.142313e-001, 8.148079e-001, 8.153703e-001,
+8.159328e-001, 8.164952e-001, 8.170577e-001, 8.176201e-001, 8.181826e-001, 8.187462e-001, 8.193099e-001, 8.198736e-001, 8.204373e-001, 8.210010e-001,
+8.215646e-001, 8.221263e-001, 8.226876e-001, 8.232489e-001, 8.238101e-001, 8.243714e-001, 8.249327e-001, 8.254862e-001, 8.260336e-001, 8.265809e-001,
+8.271282e-001, 8.276756e-001, 8.282229e-001, 8.287673e-001, 8.292988e-001, 8.298302e-001, 8.303616e-001, 8.308930e-001, 8.314245e-001, 8.319559e-001,
+8.324869e-001, 8.330176e-001, 8.335484e-001, 8.340792e-001, 8.346099e-001, 8.351407e-001, 8.356697e-001, 8.361886e-001, 8.367076e-001, 8.372265e-001,
+8.377454e-001, 8.382643e-001, 8.387833e-001, 8.392911e-001, 8.397874e-001, 8.402837e-001, 8.407800e-001, 8.412763e-001, 8.417726e-001, 8.422689e-001,
+8.427660e-001, 8.432634e-001, 8.437608e-001, 8.442582e-001, 8.447556e-001, 8.452530e-001, 8.457504e-001, 8.462409e-001, 8.467302e-001, 8.472196e-001,
+8.477090e-001, 8.481984e-001, 8.486878e-001, 8.491772e-001, 8.496577e-001, 8.501372e-001, 8.506168e-001, 8.510963e-001, 8.515759e-001, 8.520554e-001,
+8.525350e-001, 8.530109e-001, 8.534861e-001, 8.539613e-001, 8.544364e-001, 8.549116e-001, 8.553868e-001, 8.558620e-001, 8.563337e-001, 8.568036e-001,
+8.572735e-001, 8.577435e-001, 8.582134e-001, 8.586833e-001, 8.591532e-001, 8.596208e-001, 8.600845e-001, 8.605483e-001, 8.610121e-001, 8.614758e-001,
+8.619396e-001, 8.624033e-001, 8.628671e-001, 8.633220e-001, 8.637769e-001, 8.642318e-001, 8.646866e-001, 8.651415e-001, 8.655963e-001, 8.660512e-001,
+8.665008e-001, 8.669448e-001, 8.673888e-001, 8.678328e-001, 8.682769e-001, 8.687209e-001, 8.691649e-001, 8.696089e-001, 8.700436e-001, 8.704770e-001,
+8.709103e-001, 8.713436e-001, 8.717770e-001, 8.722103e-001, 8.726437e-001, 8.730764e-001, 8.735056e-001, 8.739347e-001, 8.743639e-001, 8.747930e-001,
+8.752222e-001, 8.756513e-001, 8.760805e-001, 8.765052e-001, 8.769198e-001, 8.773343e-001, 8.777489e-001, 8.781634e-001, 8.785779e-001, 8.789925e-001,
+8.794070e-001, 8.798194e-001, 8.802277e-001, 8.806360e-001, 8.810443e-001, 8.814526e-001, 8.818609e-001, 8.822692e-001, 8.826775e-001, 8.830862e-001,
+8.834958e-001, 8.839055e-001, 8.843151e-001, 8.847247e-001, 8.851344e-001, 8.855440e-001, 8.859536e-001, 8.863627e-001, 8.867634e-001, 8.871641e-001,
+8.875648e-001, 8.879655e-001, 8.883663e-001, 8.887670e-001, 8.891677e-001, 8.895684e-001, 8.899617e-001, 8.903526e-001, 8.907434e-001, 8.911342e-001,
+8.915250e-001, 8.919158e-001, 8.923067e-001, 8.926975e-001, 8.930877e-001, 8.934766e-001, 8.938656e-001, 8.942545e-001, 8.946434e-001, 8.950323e-001,
+8.954212e-001, 8.958102e-001, 8.961991e-001, 8.965854e-001, 8.969708e-001, 8.973562e-001, 8.977415e-001, 8.981269e-001, 8.985123e-001, 8.988977e-001,
+8.992830e-001, 8.996680e-001, 9.000402e-001, 9.004124e-001, 9.007845e-001, 9.011567e-001, 9.015288e-001, 9.019010e-001, 9.022732e-001, 9.026453e-001,
+9.030135e-001, 9.033655e-001, 9.037175e-001, 9.040695e-001, 9.044215e-001, 9.047735e-001, 9.051255e-001, 9.054775e-001, 9.058295e-001, 9.061817e-001,
+9.065345e-001, 9.068873e-001, 9.072401e-001, 9.075930e-001, 9.079458e-001, 9.082986e-001, 9.086514e-001, 9.090042e-001, 9.093562e-001, 9.097027e-001,
+9.100491e-001, 9.103956e-001, 9.107421e-001, 9.110886e-001, 9.114350e-001, 9.117815e-001, 9.121280e-001, 9.124745e-001, 9.128089e-001, 9.131421e-001,
+9.134754e-001, 9.138086e-001, 9.141418e-001, 9.144750e-001, 9.148082e-001, 9.151415e-001, 9.154747e-001, 9.158116e-001, 9.161516e-001, 9.164916e-001,
+9.168316e-001, 9.171716e-001, 9.175117e-001, 9.178517e-001, 9.181917e-001, 9.185317e-001, 9.188717e-001, 9.192115e-001, 9.195513e-001, 9.198911e-001,
+9.202310e-001, 9.205708e-001, 9.209106e-001, 9.212504e-001, 9.215902e-001, 9.219300e-001, 9.222668e-001, 9.225986e-001, 9.229304e-001, 9.232621e-001,
+9.235939e-001, 9.239257e-001, 9.242575e-001, 9.245893e-001, 9.249211e-001, 9.252529e-001, 9.255800e-001, 9.259037e-001, 9.262274e-001, 9.265511e-001,
+9.268748e-001, 9.271985e-001, 9.275222e-001, 9.278460e-001, 9.281697e-001, 9.284934e-001, 9.288159e-001, 9.291377e-001, 9.294595e-001, 9.297814e-001,
+9.301032e-001, 9.304250e-001, 9.307468e-001, 9.310687e-001, 9.313905e-001, 9.317123e-001, 9.320326e-001, 9.323516e-001, 9.326706e-001, 9.329896e-001,
+9.333087e-001, 9.336277e-001, 9.339467e-001, 9.342657e-001, 9.345847e-001, 9.349037e-001, 9.352200e-001, 9.355299e-001, 9.358399e-001, 9.361499e-001,
+9.364598e-001, 9.367698e-001, 9.370798e-001, 9.373898e-001, 9.376997e-001, 9.380097e-001, 9.383197e-001, 9.386215e-001, 9.389225e-001, 9.392235e-001,
+9.395245e-001, 9.398256e-001, 9.401266e-001, 9.404276e-001, 9.407287e-001, 9.410297e-001, 9.413307e-001, 9.416282e-001, 9.419195e-001, 9.422109e-001,
+9.425022e-001, 9.427935e-001, 9.430848e-001, 9.433761e-001, 9.436675e-001, 9.439588e-001, 9.442501e-001, 9.445414e-001, 9.448264e-001, 9.451081e-001,
+9.453897e-001, 9.456714e-001, 9.459530e-001, 9.462347e-001, 9.465164e-001, 9.467980e-001, 9.470797e-001, 9.473613e-001, 9.476430e-001, 9.479180e-001,
+9.481912e-001, 9.484645e-001, 9.487377e-001, 9.490109e-001, 9.492842e-001, 9.495574e-001, 9.498306e-001, 9.501039e-001, 9.503771e-001, 9.506503e-001,
+9.509219e-001, 9.511930e-001, 9.514641e-001, 9.517352e-001, 9.520064e-001, 9.522775e-001, 9.525486e-001, 9.528197e-001, 9.530908e-001, 9.533619e-001,
+9.536330e-001, 9.538991e-001, 9.541615e-001, 9.544238e-001, 9.546862e-001, 9.549485e-001, 9.552109e-001, 9.554733e-001, 9.557356e-001, 9.559980e-001,
+9.562603e-001, 9.565227e-001, 9.567822e-001, 9.570304e-001, 9.572787e-001, 9.575270e-001, 9.577753e-001, 9.580236e-001, 9.582718e-001, 9.585201e-001,
+9.587684e-001, 9.590167e-001, 9.592650e-001, 9.595133e-001, 9.597612e-001, 9.600089e-001, 9.602566e-001, 9.605043e-001, 9.607520e-001, 9.609997e-001,
+9.612474e-001, 9.614952e-001, 9.617429e-001, 9.619906e-001, 9.622383e-001, 9.624860e-001, 9.627341e-001, 9.629823e-001, 9.632304e-001, 9.634785e-001,
+9.637267e-001, 9.639748e-001, 9.642229e-001, 9.644711e-001, 9.647192e-001, 9.649673e-001, 9.652154e-001, 9.654630e-001, 9.657053e-001, 9.659475e-001,
+9.661898e-001, 9.664320e-001, 9.666743e-001, 9.669165e-001, 9.671588e-001, 9.674010e-001, 9.676433e-001, 9.678855e-001, 9.681278e-001, 9.683696e-001,
+9.685998e-001, 9.688300e-001, 9.690603e-001, 9.692905e-001, 9.695207e-001, 9.697510e-001, 9.699812e-001, 9.702114e-001, 9.704416e-001, 9.706719e-001,
+9.709021e-001, 9.711323e-001, 9.713497e-001, 9.715638e-001, 9.717779e-001, 9.719919e-001, 9.722060e-001, 9.724201e-001, 9.726342e-001, 9.728483e-001,
+9.730624e-001, 9.732765e-001, 9.734906e-001, 9.737047e-001, 9.739152e-001, 9.741197e-001, 9.743241e-001, 9.745286e-001, 9.747331e-001, 9.749376e-001,
+9.751421e-001, 9.753466e-001, 9.755511e-001, 9.757556e-001, 9.759601e-001, 9.761646e-001, 9.763690e-001, 9.765669e-001, 9.767629e-001, 9.769588e-001,
+9.771548e-001, 9.773507e-001, 9.775467e-001, 9.777426e-001, 9.779386e-001, 9.781345e-001, 9.783305e-001, 9.785264e-001, 9.787224e-001, 9.789183e-001,
+9.791035e-001, 9.792885e-001, 9.794734e-001, 9.796584e-001, 9.798434e-001, 9.800284e-001, 9.802134e-001, 9.803983e-001, 9.805833e-001, 9.807683e-001,
+9.809533e-001, 9.811383e-001, 9.813233e-001, 9.815040e-001, 9.816848e-001, 9.818656e-001, 9.820463e-001, 9.822271e-001, 9.824079e-001, 9.825886e-001,
+9.827694e-001, 9.829502e-001, 9.831309e-001, 9.833117e-001, 9.834925e-001, 9.836732e-001, 9.838452e-001, 9.840152e-001, 9.841853e-001, 9.843553e-001,
+9.845253e-001, 9.846954e-001, 9.848654e-001, 9.850355e-001, 9.852055e-001, 9.853756e-001, 9.855456e-001, 9.857156e-001, 9.858857e-001, 9.860521e-001,
+9.862140e-001, 9.863760e-001, 9.865379e-001, 9.866999e-001, 9.868618e-001, 9.870237e-001, 9.871857e-001, 9.873476e-001, 9.875096e-001, 9.876715e-001,
+9.878334e-001, 9.879954e-001, 9.881573e-001, 9.883104e-001, 9.884621e-001, 9.886138e-001, 9.887656e-001, 9.889173e-001, 9.890691e-001, 9.892208e-001,
+9.893726e-001, 9.895243e-001, 9.896761e-001, 9.898278e-001, 9.899795e-001, 9.901313e-001, 9.902823e-001, 9.904265e-001, 9.905707e-001, 9.907148e-001,
+9.908590e-001, 9.910032e-001, 9.911474e-001, 9.912915e-001, 9.914357e-001, 9.915799e-001, 9.917241e-001, 9.918682e-001, 9.920124e-001, 9.921566e-001,
+9.922998e-001, 9.924353e-001, 9.925709e-001, 9.927064e-001, 9.928419e-001, 9.929775e-001, 9.931130e-001, 9.932485e-001, 9.933841e-001, 9.935196e-001,
+9.936551e-001, 9.937907e-001, 9.939262e-001, 9.940617e-001, 9.941973e-001, 9.943201e-001, 9.944419e-001, 9.945636e-001, 9.946854e-001, 9.948071e-001,
+9.949288e-001, 9.950506e-001, 9.951723e-001, 9.952941e-001, 9.954158e-001, 9.955376e-001, 9.956593e-001, 9.957811e-001, 9.959028e-001, 9.960159e-001,
+9.961208e-001, 9.962257e-001, 9.963307e-001, 9.964356e-001, 9.965405e-001, 9.966455e-001, 9.967504e-001, 9.968553e-001, 9.969603e-001, 9.970652e-001,
+9.971701e-001, 9.972751e-001, 9.973800e-001, 9.974849e-001, 9.975775e-001, 9.976686e-001, 9.977597e-001, 9.978508e-001, 9.979420e-001, 9.980331e-001,
+9.981242e-001, 9.982153e-001, 9.983065e-001, 9.983976e-001, 9.984887e-001, 9.985798e-001, 9.986710e-001, 9.987621e-001, 9.988524e-001, 9.989289e-001,
+9.990054e-001, 9.990819e-001, 9.991584e-001, 9.992349e-001, 9.993114e-001, 9.993879e-001, 9.994644e-001, 9.995409e-001, 9.996175e-001, 9.996940e-001,
+9.997705e-001, 9.998470e-001, 9.999235e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.546805e-002, 6.723345e-002, 8.324980e-002, 9.638738e-002, 1.078207e-001, 1.180548e-001, 1.273127e-001, 1.358956e-001, 1.437651e-001,
+1.510639e-001, 1.580074e-001, 1.645934e-001, 1.708792e-001, 1.768720e-001, 1.825959e-001, 1.880603e-001, 1.933407e-001, 1.983919e-001, 2.032618e-001,
+2.080130e-001, 2.126219e-001, 2.170598e-001, 2.213745e-001, 2.255963e-001, 2.297366e-001, 2.337452e-001, 2.376386e-001, 2.414473e-001, 2.451925e-001,
+2.488889e-001, 2.524789e-001, 2.559857e-001, 2.594096e-001, 2.627863e-001, 2.661120e-001, 2.694039e-001, 2.726262e-001, 2.757806e-001, 2.788714e-001,
+2.819065e-001, 2.849086e-001, 2.878706e-001, 2.907994e-001, 2.937095e-001, 2.965499e-001, 2.993266e-001, 3.020490e-001, 3.047289e-001, 3.073732e-001,
+3.100095e-001, 3.126213e-001, 3.152045e-001, 3.177571e-001, 3.202544e-001, 3.227119e-001, 3.251401e-001, 3.275529e-001, 3.299374e-001, 3.323052e-001,
+3.346739e-001, 3.370255e-001, 3.393488e-001, 3.416441e-001, 3.439006e-001, 3.461334e-001, 3.483205e-001, 3.504906e-001, 3.526290e-001, 3.547618e-001,
+3.568730e-001, 3.589905e-001, 3.610835e-001, 3.631530e-001, 3.652003e-001, 3.671888e-001, 3.691641e-001, 3.711192e-001, 3.730652e-001, 3.749937e-001,
+3.769024e-001, 3.788143e-001, 3.807007e-001, 3.826004e-001, 3.844895e-001, 3.863630e-001, 3.882221e-001, 3.900677e-001, 3.919059e-001, 3.937377e-001,
+3.955607e-001, 3.973649e-001, 3.991670e-001, 4.009511e-001, 4.027170e-001, 4.044859e-001, 4.062363e-001, 4.079819e-001, 4.097360e-001, 4.114728e-001,
+4.132055e-001, 4.149374e-001, 4.166536e-001, 4.183550e-001, 4.200340e-001, 4.217009e-001, 4.233531e-001, 4.249719e-001, 4.265844e-001, 4.281909e-001,
+4.297637e-001, 4.313360e-001, 4.329077e-001, 4.344569e-001, 4.360015e-001, 4.375521e-001, 4.390931e-001, 4.406210e-001, 4.421331e-001, 4.436381e-001,
+4.451265e-001, 4.466089e-001, 4.480652e-001, 4.495176e-001, 4.509631e-001, 4.523978e-001, 4.538225e-001, 4.552442e-001, 4.566643e-001, 4.580617e-001,
+4.594523e-001, 4.608454e-001, 4.622390e-001, 4.636129e-001, 4.649849e-001, 4.663663e-001, 4.677484e-001, 4.691171e-001, 4.704849e-001, 4.718533e-001,
+4.732218e-001, 4.745810e-001, 4.759384e-001, 4.772794e-001, 4.786146e-001, 4.799452e-001, 4.812730e-001, 4.825869e-001, 4.838841e-001, 4.851810e-001,
+4.864774e-001, 4.877731e-001, 4.890461e-001, 4.903191e-001, 4.915967e-001, 4.928756e-001, 4.941464e-001, 4.954087e-001, 4.966705e-001, 4.979301e-001,
+4.991896e-001, 5.004387e-001, 5.016852e-001, 5.029277e-001, 5.041646e-001, 5.054014e-001, 5.066293e-001, 5.078570e-001, 5.090679e-001, 5.102629e-001,
+5.114579e-001, 5.126475e-001, 5.138371e-001, 5.150146e-001, 5.161782e-001, 5.173418e-001, 5.185060e-001, 5.196703e-001, 5.208293e-001, 5.219741e-001,
+5.231189e-001, 5.242678e-001, 5.254192e-001, 5.265707e-001, 5.277099e-001, 5.288481e-001, 5.299884e-001, 5.311388e-001, 5.322891e-001, 5.334355e-001,
+5.345761e-001, 5.357167e-001, 5.368448e-001, 5.379639e-001, 5.390831e-001, 5.401956e-001, 5.413055e-001, 5.424154e-001, 5.435020e-001, 5.445837e-001,
+5.456653e-001, 5.467440e-001, 5.478223e-001, 5.489006e-001, 5.499593e-001, 5.510155e-001, 5.520716e-001, 5.531297e-001, 5.541882e-001, 5.552466e-001,
+5.562925e-001, 5.573346e-001, 5.583767e-001, 5.594154e-001, 5.604523e-001, 5.614892e-001, 5.625199e-001, 5.635436e-001, 5.645673e-001, 5.655883e-001,
+5.666012e-001, 5.676141e-001, 5.686270e-001, 5.696320e-001, 5.706369e-001, 5.716418e-001, 5.726358e-001, 5.736240e-001, 5.746123e-001, 5.755989e-001,
+5.765814e-001, 5.775640e-001, 5.785465e-001, 5.795089e-001, 5.804683e-001, 5.814277e-001, 5.823867e-001, 5.833454e-001, 5.843040e-001, 5.852626e-001,
+5.862057e-001, 5.871467e-001, 5.880877e-001, 5.890267e-001, 5.899612e-001, 5.908958e-001, 5.918303e-001, 5.927560e-001, 5.936775e-001, 5.945990e-001,
+5.955205e-001, 5.964315e-001, 5.973425e-001, 5.982534e-001, 5.991624e-001, 6.000659e-001, 6.009693e-001, 6.018727e-001, 6.027743e-001, 6.036738e-001,
+6.045733e-001, 6.054729e-001, 6.063697e-001, 6.072649e-001, 6.081601e-001, 6.090553e-001, 6.099364e-001, 6.108119e-001, 6.116873e-001, 6.125628e-001,
+6.134388e-001, 6.143149e-001, 6.151911e-001, 6.160673e-001, 6.169329e-001, 6.177945e-001, 6.186562e-001, 6.195178e-001, 6.203829e-001, 6.212500e-001,
+6.221170e-001, 6.229840e-001, 6.238461e-001, 6.247032e-001, 6.255603e-001, 6.264174e-001, 6.272712e-001, 6.281174e-001, 6.289636e-001, 6.298097e-001,
+6.306557e-001, 6.314934e-001, 6.323311e-001, 6.331688e-001, 6.340065e-001, 6.348341e-001, 6.356573e-001, 6.364804e-001, 6.373036e-001, 6.381259e-001,
+6.389462e-001, 6.397664e-001, 6.405867e-001, 6.414070e-001, 6.422203e-001, 6.430321e-001, 6.438439e-001, 6.446557e-001, 6.454677e-001, 6.462804e-001,
+6.470930e-001, 6.479057e-001, 6.487183e-001, 6.495214e-001, 6.503203e-001, 6.511193e-001, 6.519182e-001, 6.527170e-001, 6.535111e-001, 6.543052e-001,
+6.550994e-001, 6.558935e-001, 6.566846e-001, 6.574688e-001, 6.582529e-001, 6.590371e-001, 6.598212e-001, 6.606014e-001, 6.613773e-001, 6.621533e-001,
+6.629292e-001, 6.637052e-001, 6.644771e-001, 6.652465e-001, 6.660159e-001, 6.667853e-001, 6.675547e-001, 6.683162e-001, 6.690734e-001, 6.698307e-001,
+6.705879e-001, 6.713452e-001, 6.721003e-001, 6.728541e-001, 6.736080e-001, 6.743618e-001, 6.751157e-001, 6.758606e-001, 6.765974e-001, 6.773343e-001,
+6.780712e-001, 6.788080e-001, 6.795421e-001, 6.802709e-001, 6.809997e-001, 6.817285e-001, 6.824573e-001, 6.831848e-001, 6.839003e-001, 6.846158e-001,
+6.853313e-001, 6.860469e-001, 6.867624e-001, 6.874758e-001, 6.881886e-001, 6.889013e-001, 6.896141e-001, 6.903269e-001, 6.910367e-001, 6.917410e-001,
+6.924454e-001, 6.931497e-001, 6.938541e-001, 6.945584e-001, 6.952574e-001, 6.959554e-001, 6.966534e-001, 6.973515e-001, 6.980495e-001, 6.987464e-001,
+6.994404e-001, 7.001343e-001, 7.008282e-001, 7.015222e-001, 7.022161e-001, 7.029096e-001, 7.036027e-001, 7.042958e-001, 7.049889e-001, 7.056820e-001,
+7.063751e-001, 7.070598e-001, 7.077433e-001, 7.084269e-001, 7.091104e-001, 7.097939e-001, 7.104768e-001, 7.111462e-001, 7.118156e-001, 7.124850e-001,
+7.131545e-001, 7.138239e-001, 7.144927e-001, 7.151576e-001, 7.158225e-001, 7.164874e-001, 7.171524e-001, 7.178173e-001, 7.184810e-001, 7.191364e-001,
+7.197919e-001, 7.204474e-001, 7.211028e-001, 7.217583e-001, 7.224135e-001, 7.230613e-001, 7.237090e-001, 7.243568e-001, 7.250046e-001, 7.256523e-001,
+7.263001e-001, 7.269432e-001, 7.275855e-001, 7.282277e-001, 7.288700e-001, 7.295123e-001, 7.301545e-001, 7.307953e-001, 7.314348e-001, 7.320744e-001,
+7.327140e-001, 7.333536e-001, 7.339931e-001, 7.346324e-001, 7.352702e-001, 7.359081e-001, 7.365460e-001, 7.371838e-001, 7.378217e-001, 7.384595e-001,
+7.390930e-001, 7.397249e-001, 7.403567e-001, 7.409886e-001, 7.416205e-001, 7.422523e-001, 7.428832e-001, 7.435090e-001, 7.441349e-001, 7.447607e-001,
+7.453865e-001, 7.460124e-001, 7.466382e-001, 7.472589e-001, 7.478746e-001, 7.484903e-001, 7.491059e-001, 7.497216e-001, 7.503373e-001, 7.509530e-001,
+7.515619e-001, 7.521684e-001, 7.527749e-001, 7.533815e-001, 7.539880e-001, 7.545946e-001, 7.552011e-001, 7.558020e-001, 7.564021e-001, 7.570023e-001,
+7.576024e-001, 7.582025e-001, 7.588026e-001, 7.594027e-001, 7.599988e-001, 7.605946e-001, 7.611903e-001, 7.617860e-001, 7.623818e-001, 7.629775e-001,
+7.635732e-001, 7.641666e-001, 7.647594e-001, 7.653523e-001, 7.659452e-001, 7.665381e-001, 7.671309e-001, 7.677238e-001, 7.683118e-001, 7.688974e-001,
+7.694830e-001, 7.700686e-001, 7.706542e-001, 7.712398e-001, 7.718254e-001, 7.724086e-001, 7.729881e-001, 7.735677e-001, 7.741472e-001, 7.747267e-001,
+7.753062e-001, 7.758857e-001, 7.764652e-001, 7.770413e-001, 7.776174e-001, 7.781935e-001, 7.787696e-001, 7.793457e-001, 7.799218e-001, 7.804979e-001,
+7.810694e-001, 7.816362e-001, 7.822030e-001, 7.827698e-001, 7.833365e-001, 7.839033e-001, 7.844701e-001, 7.850369e-001, 7.855977e-001, 7.861578e-001,
+7.867178e-001, 7.872779e-001, 7.878379e-001, 7.883980e-001, 7.889580e-001, 7.895173e-001, 7.900727e-001, 7.906281e-001, 7.911835e-001, 7.917389e-001,
+7.922942e-001, 7.928496e-001, 7.934050e-001, 7.939593e-001, 7.945113e-001, 7.950633e-001, 7.956153e-001, 7.961672e-001, 7.967192e-001, 7.972712e-001,
+7.978232e-001, 7.983725e-001, 7.989167e-001, 7.994610e-001, 8.000053e-001, 8.005495e-001, 8.010938e-001, 8.016381e-001, 8.021824e-001, 8.027231e-001,
+8.032547e-001, 8.037862e-001, 8.043178e-001, 8.048493e-001, 8.053809e-001, 8.059124e-001, 8.064440e-001, 8.069752e-001, 8.075023e-001, 8.080293e-001,
+8.085564e-001, 8.090834e-001, 8.096105e-001, 8.101376e-001, 8.106646e-001, 8.111917e-001, 8.117121e-001, 8.122305e-001, 8.127488e-001, 8.132671e-001,
+8.137854e-001, 8.143037e-001, 8.148221e-001, 8.153404e-001, 8.158568e-001, 8.163688e-001, 8.168809e-001, 8.173929e-001, 8.179049e-001, 8.184170e-001,
+8.189290e-001, 8.194411e-001, 8.199531e-001, 8.204619e-001, 8.209697e-001, 8.214774e-001, 8.219851e-001, 8.224928e-001, 8.230005e-001, 8.235082e-001,
+8.240159e-001, 8.245236e-001, 8.250294e-001, 8.255352e-001, 8.260410e-001, 8.265468e-001, 8.270525e-001, 8.275583e-001, 8.280641e-001, 8.285699e-001,
+8.290757e-001, 8.295813e-001, 8.300869e-001, 8.305925e-001, 8.310981e-001, 8.316036e-001, 8.321092e-001, 8.326148e-001, 8.331204e-001, 8.336248e-001,
+8.341254e-001, 8.346260e-001, 8.351266e-001, 8.356271e-001, 8.361277e-001, 8.366283e-001, 8.371289e-001, 8.376295e-001, 8.381296e-001, 8.386270e-001,
+8.391245e-001, 8.396219e-001, 8.401193e-001, 8.406167e-001, 8.411141e-001, 8.416115e-001, 8.421089e-001, 8.426063e-001, 8.430963e-001, 8.435855e-001,
+8.440748e-001, 8.445641e-001, 8.450534e-001, 8.455426e-001, 8.460319e-001, 8.465212e-001, 8.470104e-001, 8.474964e-001, 8.479797e-001, 8.484629e-001,
+8.489462e-001, 8.494294e-001, 8.499127e-001, 8.503959e-001, 8.508792e-001, 8.513624e-001, 8.518455e-001, 8.523248e-001, 8.528040e-001, 8.532832e-001,
+8.537624e-001, 8.542416e-001, 8.547208e-001, 8.552001e-001, 8.556793e-001, 8.561585e-001, 8.566346e-001, 8.571057e-001, 8.575768e-001, 8.580479e-001,
+8.585190e-001, 8.589901e-001, 8.594612e-001, 8.599323e-001, 8.604034e-001, 8.608746e-001, 8.613454e-001, 8.618162e-001, 8.622869e-001, 8.627576e-001,
+8.632283e-001, 8.636990e-001, 8.641698e-001, 8.646405e-001, 8.651112e-001, 8.655819e-001, 8.660464e-001, 8.665075e-001, 8.669686e-001, 8.674297e-001,
+8.678908e-001, 8.683519e-001, 8.688130e-001, 8.692741e-001, 8.697352e-001, 8.701963e-001, 8.706560e-001, 8.711145e-001, 8.715731e-001, 8.720317e-001,
+8.724902e-001, 8.729488e-001, 8.734074e-001, 8.738659e-001, 8.743245e-001, 8.747831e-001, 8.752397e-001, 8.756920e-001, 8.761444e-001, 8.765967e-001,
+8.770491e-001, 8.775015e-001, 8.779538e-001, 8.784062e-001, 8.788586e-001, 8.793109e-001, 8.797633e-001, 8.802114e-001, 8.806591e-001, 8.811068e-001,
+8.815545e-001, 8.820022e-001, 8.824499e-001, 8.828976e-001, 8.833453e-001, 8.837931e-001, 8.842408e-001, 8.846876e-001, 8.851328e-001, 8.855780e-001,
+8.860233e-001, 8.864685e-001, 8.869138e-001, 8.873590e-001, 8.878043e-001, 8.882495e-001, 8.886947e-001, 8.891400e-001, 8.895812e-001, 8.900203e-001,
+8.904595e-001, 8.908986e-001, 8.913378e-001, 8.917769e-001, 8.922161e-001, 8.926552e-001, 8.930943e-001, 8.935335e-001, 8.939726e-001, 8.944124e-001,
+8.948523e-001, 8.952922e-001, 8.957322e-001, 8.961721e-001, 8.966120e-001, 8.970519e-001, 8.974918e-001, 8.979318e-001, 8.983717e-001, 8.988116e-001,
+8.992447e-001, 8.996757e-001, 9.001067e-001, 9.005377e-001, 9.009687e-001, 9.013997e-001, 9.018307e-001, 9.022617e-001, 9.026927e-001, 9.031237e-001,
+9.035547e-001, 9.039817e-001, 9.044055e-001, 9.048294e-001, 9.052532e-001, 9.056771e-001, 9.061010e-001, 9.065248e-001, 9.069487e-001, 9.073725e-001,
+9.077964e-001, 9.082203e-001, 9.086430e-001, 9.090616e-001, 9.094802e-001, 9.098988e-001, 9.103174e-001, 9.107360e-001, 9.111546e-001, 9.115733e-001,
+9.119919e-001, 9.124105e-001, 9.128291e-001, 9.132477e-001, 9.136606e-001, 9.140707e-001, 9.144809e-001, 9.148911e-001, 9.153013e-001, 9.157114e-001,
+9.161216e-001, 9.165318e-001, 9.169420e-001, 9.173521e-001, 9.177623e-001, 9.181725e-001, 9.185807e-001, 9.189888e-001, 9.193969e-001, 9.198051e-001,
+9.202132e-001, 9.206214e-001, 9.210295e-001, 9.214376e-001, 9.218458e-001, 9.222539e-001, 9.226620e-001, 9.230693e-001, 9.234678e-001, 9.238664e-001,
+9.242649e-001, 9.246635e-001, 9.250620e-001, 9.254606e-001, 9.258591e-001, 9.262577e-001, 9.266563e-001, 9.270548e-001, 9.274534e-001, 9.278520e-001,
+9.282520e-001, 9.286520e-001, 9.290520e-001, 9.294521e-001, 9.298521e-001, 9.302521e-001, 9.306521e-001, 9.310522e-001, 9.314522e-001, 9.318522e-001,
+9.322522e-001, 9.326523e-001, 9.330476e-001, 9.334417e-001, 9.338359e-001, 9.342300e-001, 9.346241e-001, 9.350183e-001, 9.354124e-001, 9.358066e-001,
+9.362007e-001, 9.365949e-001, 9.369890e-001, 9.373832e-001, 9.377776e-001, 9.381725e-001, 9.385674e-001, 9.389622e-001, 9.393571e-001, 9.397520e-001,
+9.401469e-001, 9.405417e-001, 9.409366e-001, 9.413315e-001, 9.417264e-001, 9.421213e-001, 9.425161e-001, 9.429088e-001, 9.433009e-001, 9.436930e-001,
+9.440850e-001, 9.444771e-001, 9.448692e-001, 9.452612e-001, 9.456533e-001, 9.460454e-001, 9.464375e-001, 9.468295e-001, 9.472216e-001, 9.476137e-001,
+9.479907e-001, 9.483674e-001, 9.487442e-001, 9.491210e-001, 9.494978e-001, 9.498745e-001, 9.502513e-001, 9.506281e-001, 9.510049e-001, 9.513816e-001,
+9.517584e-001, 9.521352e-001, 9.525119e-001, 9.528858e-001, 9.532597e-001, 9.536336e-001, 9.540074e-001, 9.543813e-001, 9.547552e-001, 9.551290e-001,
+9.555029e-001, 9.558768e-001, 9.562507e-001, 9.566245e-001, 9.569984e-001, 9.573723e-001, 9.577409e-001, 9.581084e-001, 9.584759e-001, 9.588434e-001,
+9.592108e-001, 9.595783e-001, 9.599458e-001, 9.603133e-001, 9.606808e-001, 9.610483e-001, 9.614158e-001, 9.617833e-001, 9.621507e-001, 9.625152e-001,
+9.628759e-001, 9.632366e-001, 9.635973e-001, 9.639580e-001, 9.643187e-001, 9.646794e-001, 9.650401e-001, 9.654007e-001, 9.657614e-001, 9.661221e-001,
+9.664828e-001, 9.668435e-001, 9.672042e-001, 9.675583e-001, 9.679114e-001, 9.682645e-001, 9.686176e-001, 9.689707e-001, 9.693238e-001, 9.696769e-001,
+9.700300e-001, 9.703831e-001, 9.707363e-001, 9.710894e-001, 9.714425e-001, 9.717956e-001, 9.721478e-001, 9.724921e-001, 9.728364e-001, 9.731807e-001,
+9.735249e-001, 9.738692e-001, 9.742135e-001, 9.745578e-001, 9.749020e-001, 9.752463e-001, 9.755906e-001, 9.759349e-001, 9.762791e-001, 9.766234e-001,
+9.769669e-001, 9.773040e-001, 9.776411e-001, 9.779782e-001, 9.783154e-001, 9.786525e-001, 9.789896e-001, 9.793267e-001, 9.796638e-001, 9.800010e-001,
+9.803381e-001, 9.806752e-001, 9.810123e-001, 9.813494e-001, 9.816866e-001, 9.820180e-001, 9.823490e-001, 9.826800e-001, 9.830109e-001, 9.833419e-001,
+9.836729e-001, 9.840038e-001, 9.843348e-001, 9.846658e-001, 9.849968e-001, 9.853277e-001, 9.856587e-001, 9.859897e-001, 9.863206e-001, 9.866454e-001,
+9.869645e-001, 9.872835e-001, 9.876026e-001, 9.879216e-001, 9.882406e-001, 9.885597e-001, 9.888787e-001, 9.891977e-001, 9.895168e-001, 9.898358e-001,
+9.901549e-001, 9.904739e-001, 9.907929e-001, 9.911120e-001, 9.914192e-001, 9.917250e-001, 9.920308e-001, 9.923366e-001, 9.926424e-001, 9.929482e-001,
+9.932541e-001, 9.935599e-001, 9.938657e-001, 9.941715e-001, 9.944773e-001, 9.947832e-001, 9.950890e-001, 9.953948e-001, 9.956995e-001, 9.959862e-001,
+9.962729e-001, 9.965596e-001, 9.968463e-001, 9.971330e-001, 9.974197e-001, 9.977064e-001, 9.979931e-001, 9.982798e-001, 9.985665e-001, 9.988532e-001,
+9.991399e-001, 9.994266e-001, 9.997133e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.250508e-002, 5.605192e-002, 7.376380e-002, 8.741027e-002, 9.747578e-002, 1.053475e-001, 1.128625e-001, 1.203550e-001, 1.278493e-001,
+1.352436e-001, 1.424624e-001, 1.493878e-001, 1.560760e-001, 1.626076e-001, 1.688463e-001, 1.748790e-001, 1.807506e-001, 1.864421e-001, 1.920263e-001,
+1.974908e-001, 2.027806e-001, 2.078877e-001, 2.128471e-001, 2.176714e-001, 2.223368e-001, 2.268441e-001, 2.312132e-001, 2.354972e-001, 2.396982e-001,
+2.437301e-001, 2.476261e-001, 2.514533e-001, 2.552187e-001, 2.589013e-001, 2.625199e-001, 2.660698e-001, 2.695470e-001, 2.729555e-001, 2.763258e-001,
+2.796600e-001, 2.829269e-001, 2.861185e-001, 2.892412e-001, 2.923243e-001, 2.953714e-001, 2.983839e-001, 3.013431e-001, 3.042708e-001, 3.071705e-001,
+3.100284e-001, 3.128501e-001, 3.156497e-001, 3.184090e-001, 3.211378e-001, 3.238493e-001, 3.265129e-001, 3.291610e-001, 3.317634e-001, 3.343206e-001,
+3.368438e-001, 3.393224e-001, 3.417755e-001, 3.441849e-001, 3.465533e-001, 3.488821e-001, 3.511760e-001, 3.534452e-001, 3.557047e-001, 3.579384e-001,
+3.601483e-001, 3.623368e-001, 3.645075e-001, 3.666631e-001, 3.688057e-001, 3.709379e-001, 3.730610e-001, 3.751786e-001, 3.772910e-001, 3.793990e-001,
+3.814974e-001, 3.835781e-001, 3.856569e-001, 3.877165e-001, 3.897740e-001, 3.918242e-001, 3.938601e-001, 3.958754e-001, 3.978558e-001, 3.998196e-001,
+4.017658e-001, 4.036836e-001, 4.055893e-001, 4.074888e-001, 4.093823e-001, 4.112666e-001, 4.131283e-001, 4.149853e-001, 4.168486e-001, 4.186882e-001,
+4.205283e-001, 4.223743e-001, 4.241973e-001, 4.260226e-001, 4.278545e-001, 4.296847e-001, 4.315182e-001, 4.333597e-001, 4.351973e-001, 4.370344e-001,
+4.388786e-001, 4.407181e-001, 4.425528e-001, 4.443916e-001, 4.462321e-001, 4.480772e-001, 4.499237e-001, 4.517718e-001, 4.536193e-001, 4.554667e-001,
+4.573142e-001, 4.591605e-001, 4.610021e-001, 4.628402e-001, 4.646732e-001, 4.664989e-001, 4.683188e-001, 4.701270e-001, 4.719302e-001, 4.737173e-001,
+4.755006e-001, 4.772619e-001, 4.790205e-001, 4.807559e-001, 4.824901e-001, 4.842282e-001, 4.859664e-001, 4.876766e-001, 4.893858e-001, 4.910923e-001,
+4.927986e-001, 4.944743e-001, 4.961454e-001, 4.978107e-001, 4.994743e-001, 5.011222e-001, 5.027614e-001, 5.043946e-001, 5.060215e-001, 5.076393e-001,
+5.092360e-001, 5.108314e-001, 5.124111e-001, 5.139907e-001, 5.155414e-001, 5.170856e-001, 5.186199e-001, 5.201452e-001, 5.216659e-001, 5.231690e-001,
+5.246721e-001, 5.261574e-001, 5.276395e-001, 5.291115e-001, 5.305710e-001, 5.320304e-001, 5.334818e-001, 5.349332e-001, 5.363718e-001, 5.378000e-001,
+5.392269e-001, 5.406283e-001, 5.420296e-001, 5.434191e-001, 5.447971e-001, 5.461751e-001, 5.475438e-001, 5.489118e-001, 5.502726e-001, 5.516172e-001,
+5.529618e-001, 5.542978e-001, 5.556292e-001, 5.569607e-001, 5.582699e-001, 5.595782e-001, 5.608839e-001, 5.621807e-001, 5.634775e-001, 5.647641e-001,
+5.660378e-001, 5.673116e-001, 5.685881e-001, 5.698663e-001, 5.711445e-001, 5.724067e-001, 5.736641e-001, 5.749214e-001, 5.761708e-001, 5.774188e-001,
+5.786669e-001, 5.798961e-001, 5.811235e-001, 5.823509e-001, 5.835714e-001, 5.847914e-001, 5.860113e-001, 5.872146e-001, 5.884157e-001, 5.896168e-001,
+5.908034e-001, 5.919866e-001, 5.931698e-001, 5.943411e-001, 5.955067e-001, 5.966723e-001, 5.978301e-001, 5.989803e-001, 6.001304e-001, 6.012764e-001,
+6.024119e-001, 6.035473e-001, 6.046826e-001, 6.058050e-001, 6.069275e-001, 6.080500e-001, 6.091644e-001, 6.102753e-001, 6.113861e-001, 6.124937e-001,
+6.135943e-001, 6.146950e-001, 6.157957e-001, 6.168873e-001, 6.179779e-001, 6.190685e-001, 6.201496e-001, 6.212184e-001, 6.222872e-001, 6.233560e-001,
+6.244189e-001, 6.254813e-001, 6.265437e-001, 6.276041e-001, 6.286605e-001, 6.297170e-001, 6.307734e-001, 6.318182e-001, 6.328583e-001, 6.338984e-001,
+6.349384e-001, 6.359746e-001, 6.370108e-001, 6.380469e-001, 6.390790e-001, 6.401015e-001, 6.411240e-001, 6.421465e-001, 6.431625e-001, 6.441722e-001,
+6.451818e-001, 6.461915e-001, 6.471874e-001, 6.481762e-001, 6.491649e-001, 6.501537e-001, 6.511444e-001, 6.521357e-001, 6.531270e-001, 6.541183e-001,
+6.550964e-001, 6.560709e-001, 6.570454e-001, 6.580199e-001, 6.589906e-001, 6.599600e-001, 6.609295e-001, 6.618990e-001, 6.628596e-001, 6.638160e-001,
+6.647724e-001, 6.657288e-001, 6.666783e-001, 6.676219e-001, 6.685655e-001, 6.695091e-001, 6.704490e-001, 6.713813e-001, 6.723137e-001, 6.732461e-001,
+6.741767e-001, 6.750793e-001, 6.759819e-001, 6.768845e-001, 6.777871e-001, 6.786838e-001, 6.795783e-001, 6.804728e-001, 6.813673e-001, 6.822536e-001,
+6.831232e-001, 6.839928e-001, 6.848624e-001, 6.857320e-001, 6.865985e-001, 6.874646e-001, 6.883307e-001, 6.891968e-001, 6.900564e-001, 6.909027e-001,
+6.917491e-001, 6.925954e-001, 6.934418e-001, 6.942891e-001, 6.951368e-001, 6.959845e-001, 6.968322e-001, 6.976789e-001, 6.985119e-001, 6.993449e-001,
+7.001779e-001, 7.010109e-001, 7.018424e-001, 7.026709e-001, 7.034994e-001, 7.043279e-001, 7.051564e-001, 7.059795e-001, 7.067976e-001, 7.076158e-001,
+7.084340e-001, 7.092521e-001, 7.100642e-001, 7.108727e-001, 7.116813e-001, 7.124899e-001, 7.132985e-001, 7.141026e-001, 7.149047e-001, 7.157067e-001,
+7.165088e-001, 7.173109e-001, 7.181041e-001, 7.188927e-001, 7.196814e-001, 7.204700e-001, 7.212586e-001, 7.220466e-001, 7.228341e-001, 7.236215e-001,
+7.244090e-001, 7.251965e-001, 7.259810e-001, 7.267609e-001, 7.275407e-001, 7.283205e-001, 7.291004e-001, 7.298780e-001, 7.306407e-001, 7.314034e-001,
+7.321662e-001, 7.329289e-001, 7.336916e-001, 7.344440e-001, 7.351938e-001, 7.359436e-001, 7.366933e-001, 7.374431e-001, 7.381889e-001, 7.389283e-001,
+7.396677e-001, 7.404071e-001, 7.411465e-001, 7.418858e-001, 7.426194e-001, 7.433521e-001, 7.440849e-001, 7.448176e-001, 7.455504e-001, 7.462819e-001,
+7.470108e-001, 7.477396e-001, 7.484685e-001, 7.491973e-001, 7.499262e-001, 7.506538e-001, 7.513807e-001, 7.521076e-001, 7.528346e-001, 7.535615e-001,
+7.542884e-001, 7.550077e-001, 7.557262e-001, 7.564447e-001, 7.571632e-001, 7.578817e-001, 7.585989e-001, 7.593011e-001, 7.600034e-001, 7.607056e-001,
+7.614078e-001, 7.621100e-001, 7.628100e-001, 7.634986e-001, 7.641873e-001, 7.648759e-001, 7.655645e-001, 7.662531e-001, 7.669401e-001, 7.676184e-001,
+7.682968e-001, 7.689751e-001, 7.696534e-001, 7.703317e-001, 7.710091e-001, 7.716706e-001, 7.723322e-001, 7.729938e-001, 7.736553e-001, 7.743169e-001,
+7.749784e-001, 7.756360e-001, 7.762929e-001, 7.769499e-001, 7.776068e-001, 7.782638e-001, 7.789208e-001, 7.795672e-001, 7.802065e-001, 7.808458e-001,
+7.814851e-001, 7.821244e-001, 7.827637e-001, 7.834033e-001, 7.840442e-001, 7.846850e-001, 7.853259e-001, 7.859667e-001, 7.866076e-001, 7.872484e-001,
+7.878806e-001, 7.885100e-001, 7.891394e-001, 7.897688e-001, 7.903982e-001, 7.910276e-001, 7.916555e-001, 7.922765e-001, 7.928976e-001, 7.935186e-001,
+7.941397e-001, 7.947607e-001, 7.953818e-001, 7.959994e-001, 7.966140e-001, 7.972286e-001, 7.978432e-001, 7.984578e-001, 7.990724e-001, 7.996870e-001,
+8.002872e-001, 8.008830e-001, 8.014789e-001, 8.020747e-001, 8.026705e-001, 8.032664e-001, 8.038622e-001, 8.044577e-001, 8.050531e-001, 8.056485e-001,
+8.062439e-001, 8.068394e-001, 8.074348e-001, 8.080302e-001, 8.086149e-001, 8.091988e-001, 8.097828e-001, 8.103667e-001, 8.109507e-001, 8.115346e-001,
+8.121186e-001, 8.127081e-001, 8.132985e-001, 8.138889e-001, 8.144793e-001, 8.150697e-001, 8.156600e-001, 8.162504e-001, 8.168363e-001, 8.174201e-001,
+8.180039e-001, 8.185877e-001, 8.191715e-001, 8.197554e-001, 8.203392e-001, 8.209150e-001, 8.214796e-001, 8.220441e-001, 8.226086e-001, 8.231731e-001,
+8.237376e-001, 8.243021e-001, 8.248666e-001, 8.254293e-001, 8.259920e-001, 8.265548e-001, 8.271175e-001, 8.276803e-001, 8.282430e-001, 8.288057e-001,
+8.293620e-001, 8.299123e-001, 8.304626e-001, 8.310130e-001, 8.315633e-001, 8.321136e-001, 8.326639e-001, 8.332142e-001, 8.337549e-001, 8.342946e-001,
+8.348343e-001, 8.353740e-001, 8.359137e-001, 8.364534e-001, 8.369931e-001, 8.375317e-001, 8.380653e-001, 8.385988e-001, 8.391324e-001, 8.396660e-001,
+8.401996e-001, 8.407332e-001, 8.412668e-001, 8.417996e-001, 8.423308e-001, 8.428620e-001, 8.433932e-001, 8.439245e-001, 8.444557e-001, 8.449869e-001,
+8.455181e-001, 8.460464e-001, 8.465699e-001, 8.470934e-001, 8.476169e-001, 8.481404e-001, 8.486639e-001, 8.491874e-001, 8.497109e-001, 8.502314e-001,
+8.507447e-001, 8.512580e-001, 8.517714e-001, 8.522847e-001, 8.527981e-001, 8.533114e-001, 8.538247e-001, 8.543374e-001, 8.548439e-001, 8.553504e-001,
+8.558568e-001, 8.563633e-001, 8.568698e-001, 8.573763e-001, 8.578828e-001, 8.583892e-001, 8.588875e-001, 8.593834e-001, 8.598793e-001, 8.603752e-001,
+8.608712e-001, 8.613671e-001, 8.618630e-001, 8.623589e-001, 8.628521e-001, 8.633398e-001, 8.638275e-001, 8.643152e-001, 8.648029e-001, 8.652906e-001,
+8.657783e-001, 8.662660e-001, 8.667537e-001, 8.672325e-001, 8.677084e-001, 8.681843e-001, 8.686602e-001, 8.691361e-001, 8.696120e-001, 8.700879e-001,
+8.705638e-001, 8.710392e-001, 8.715068e-001, 8.719743e-001, 8.724419e-001, 8.729094e-001, 8.733770e-001, 8.738445e-001, 8.743121e-001, 8.747796e-001,
+8.752462e-001, 8.757094e-001, 8.761726e-001, 8.766359e-001, 8.770991e-001, 8.775623e-001, 8.780255e-001, 8.784888e-001, 8.789520e-001, 8.794113e-001,
+8.798597e-001, 8.803080e-001, 8.807564e-001, 8.812047e-001, 8.816531e-001, 8.821015e-001, 8.825498e-001, 8.829982e-001, 8.834459e-001, 8.838904e-001,
+8.843349e-001, 8.847794e-001, 8.852239e-001, 8.856684e-001, 8.861130e-001, 8.865575e-001, 8.870020e-001, 8.874465e-001, 8.878841e-001, 8.883212e-001,
+8.887583e-001, 8.891954e-001, 8.896325e-001, 8.900696e-001, 8.905067e-001, 8.909438e-001, 8.913809e-001, 8.918085e-001, 8.922289e-001, 8.926493e-001,
+8.930696e-001, 8.934900e-001, 8.939104e-001, 8.943308e-001, 8.947512e-001, 8.951716e-001, 8.955916e-001, 8.960055e-001, 8.964195e-001, 8.968334e-001,
+8.972474e-001, 8.976613e-001, 8.980752e-001, 8.984892e-001, 8.989031e-001, 8.993170e-001, 8.997276e-001, 9.001333e-001, 9.005389e-001, 9.009445e-001,
+9.013502e-001, 9.017558e-001, 9.021614e-001, 9.025671e-001, 9.029727e-001, 9.033783e-001, 9.037811e-001, 9.041819e-001, 9.045828e-001, 9.049837e-001,
+9.053845e-001, 9.057854e-001, 9.061863e-001, 9.065871e-001, 9.069880e-001, 9.073889e-001, 9.077850e-001, 9.081788e-001, 9.085725e-001, 9.089663e-001,
+9.093600e-001, 9.097538e-001, 9.101475e-001, 9.105413e-001, 9.109350e-001, 9.113288e-001, 9.117176e-001, 9.121027e-001, 9.124878e-001, 9.128729e-001,
+9.132580e-001, 9.136431e-001, 9.140282e-001, 9.144133e-001, 9.147984e-001, 9.151835e-001, 9.155669e-001, 9.159468e-001, 9.163267e-001, 9.167066e-001,
+9.170865e-001, 9.174664e-001, 9.178462e-001, 9.182261e-001, 9.186060e-001, 9.189859e-001, 9.193658e-001, 9.197325e-001, 9.200983e-001, 9.204641e-001,
+9.208299e-001, 9.211957e-001, 9.215615e-001, 9.219273e-001, 9.222931e-001, 9.226589e-001, 9.230247e-001, 9.233872e-001, 9.237445e-001, 9.241018e-001,
+9.244590e-001, 9.248163e-001, 9.251735e-001, 9.255308e-001, 9.258880e-001, 9.262453e-001, 9.266026e-001, 9.269598e-001, 9.273141e-001, 9.276671e-001,
+9.280200e-001, 9.283730e-001, 9.287259e-001, 9.290789e-001, 9.294318e-001, 9.297848e-001, 9.301377e-001, 9.304907e-001, 9.308436e-001, 9.311866e-001,
+9.315271e-001, 9.318677e-001, 9.322083e-001, 9.325489e-001, 9.328895e-001, 9.332301e-001, 9.335707e-001, 9.339113e-001, 9.342518e-001, 9.345924e-001,
+9.349266e-001, 9.352591e-001, 9.355915e-001, 9.359239e-001, 9.362563e-001, 9.365887e-001, 9.369211e-001, 9.372536e-001, 9.375860e-001, 9.379184e-001,
+9.382508e-001, 9.385810e-001, 9.389095e-001, 9.392380e-001, 9.395665e-001, 9.398951e-001, 9.402236e-001, 9.405521e-001, 9.408807e-001, 9.412092e-001,
+9.415377e-001, 9.418662e-001, 9.421923e-001, 9.425099e-001, 9.428274e-001, 9.431450e-001, 9.434625e-001, 9.437801e-001, 9.440976e-001, 9.444152e-001,
+9.447327e-001, 9.450502e-001, 9.453678e-001, 9.456853e-001, 9.459949e-001, 9.463008e-001, 9.466067e-001, 9.469127e-001, 9.472186e-001, 9.475245e-001,
+9.478304e-001, 9.481364e-001, 9.484423e-001, 9.487482e-001, 9.490542e-001, 9.493601e-001, 9.496526e-001, 9.499450e-001, 9.502374e-001, 9.505297e-001,
+9.508221e-001, 9.511144e-001, 9.514068e-001, 9.516992e-001, 9.519915e-001, 9.522839e-001, 9.525762e-001, 9.528677e-001, 9.531522e-001, 9.534367e-001,
+9.537212e-001, 9.540057e-001, 9.542902e-001, 9.545747e-001, 9.548592e-001, 9.551437e-001, 9.554281e-001, 9.557126e-001, 9.559971e-001, 9.562815e-001,
+9.565636e-001, 9.568457e-001, 9.571278e-001, 9.574100e-001, 9.576921e-001, 9.579742e-001, 9.582563e-001, 9.585384e-001, 9.588206e-001, 9.591027e-001,
+9.593848e-001, 9.596669e-001, 9.599414e-001, 9.602141e-001, 9.604869e-001, 9.607596e-001, 9.610323e-001, 9.613050e-001, 9.615778e-001, 9.618505e-001,
+9.621232e-001, 9.623959e-001, 9.626687e-001, 9.629414e-001, 9.632083e-001, 9.634661e-001, 9.637240e-001, 9.639819e-001, 9.642398e-001, 9.644976e-001,
+9.647555e-001, 9.650134e-001, 9.652712e-001, 9.655291e-001, 9.657870e-001, 9.660448e-001, 9.663027e-001, 9.665576e-001, 9.668117e-001, 9.670658e-001,
+9.673200e-001, 9.675741e-001, 9.678282e-001, 9.680823e-001, 9.683364e-001, 9.685905e-001, 9.688446e-001, 9.690987e-001, 9.693528e-001, 9.696069e-001,
+9.698532e-001, 9.700993e-001, 9.703455e-001, 9.705916e-001, 9.708378e-001, 9.710840e-001, 9.713301e-001, 9.715763e-001, 9.718224e-001, 9.720686e-001,
+9.723148e-001, 9.725609e-001, 9.728070e-001, 9.730427e-001, 9.732784e-001, 9.735141e-001, 9.737499e-001, 9.739856e-001, 9.742213e-001, 9.744570e-001,
+9.746928e-001, 9.749285e-001, 9.751642e-001, 9.753999e-001, 9.756356e-001, 9.758714e-001, 9.761005e-001, 9.763283e-001, 9.765561e-001, 9.767839e-001,
+9.770117e-001, 9.772395e-001, 9.774673e-001, 9.776951e-001, 9.779229e-001, 9.781507e-001, 9.783785e-001, 9.786063e-001, 9.788341e-001, 9.790583e-001,
+9.792781e-001, 9.794978e-001, 9.797176e-001, 9.799374e-001, 9.801571e-001, 9.803769e-001, 9.805967e-001, 9.808164e-001, 9.810362e-001, 9.812560e-001,
+9.814757e-001, 9.816955e-001, 9.819153e-001, 9.821262e-001, 9.823359e-001, 9.825456e-001, 9.827553e-001, 9.829650e-001, 9.831747e-001, 9.833844e-001,
+9.835941e-001, 9.838038e-001, 9.840136e-001, 9.842233e-001, 9.844330e-001, 9.846427e-001, 9.848515e-001, 9.850528e-001, 9.852542e-001, 9.854555e-001,
+9.856568e-001, 9.858581e-001, 9.860594e-001, 9.862607e-001, 9.864620e-001, 9.866633e-001, 9.868646e-001, 9.870659e-001, 9.872672e-001, 9.874685e-001,
+9.876685e-001, 9.878588e-001, 9.880491e-001, 9.882394e-001, 9.884296e-001, 9.886199e-001, 9.888102e-001, 9.890005e-001, 9.891908e-001, 9.893810e-001,
+9.895713e-001, 9.897616e-001, 9.899519e-001, 9.901422e-001, 9.903324e-001, 9.905114e-001, 9.906894e-001, 9.908673e-001, 9.910453e-001, 9.912233e-001,
+9.914013e-001, 9.915793e-001, 9.917573e-001, 9.919353e-001, 9.921133e-001, 9.922913e-001, 9.924693e-001, 9.926473e-001, 9.928253e-001, 9.930019e-001,
+9.931773e-001, 9.933526e-001, 9.935279e-001, 9.937033e-001, 9.938786e-001, 9.940540e-001, 9.942293e-001, 9.944047e-001, 9.945800e-001, 9.947554e-001,
+9.949307e-001, 9.951061e-001, 9.952814e-001, 9.954568e-001, 9.956181e-001, 9.957778e-001, 9.959376e-001, 9.960973e-001, 9.962570e-001, 9.964167e-001,
+9.965765e-001, 9.967362e-001, 9.968959e-001, 9.970557e-001, 9.972154e-001, 9.973751e-001, 9.975349e-001, 9.976946e-001, 9.978533e-001, 9.979965e-001,
+9.981396e-001, 9.982827e-001, 9.984258e-001, 9.985689e-001, 9.987120e-001, 9.988551e-001, 9.989982e-001, 9.991413e-001, 9.992844e-001, 9.994276e-001,
+9.995707e-001, 9.997138e-001, 9.998569e-001, 1.000000e+000)),
+("Fujifilm", "FCI", "graph-log-log-neg", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.352900e-003, 7.212882e-003, 1.136980e-002, 1.560709e-002, 1.998079e-002, 2.438351e-002, 2.861328e-002, 3.249654e-002, 3.609501e-002,
+3.958007e-002, 4.294663e-002, 4.627064e-002, 4.950573e-002, 5.268568e-002, 5.575287e-002, 5.875522e-002, 6.171342e-002, 6.460464e-002, 6.744753e-002,
+7.027358e-002, 7.306316e-002, 7.580777e-002, 7.852785e-002, 8.118676e-002, 8.381953e-002, 8.638452e-002, 8.892841e-002, 9.142226e-002, 9.390966e-002,
+9.637660e-002, 9.881494e-002, 1.012423e-001, 1.036200e-001, 1.059934e-001, 1.083454e-001, 1.106606e-001, 1.129731e-001, 1.152469e-001, 1.174898e-001,
+1.197345e-001, 1.219704e-001, 1.241703e-001, 1.263649e-001, 1.285486e-001, 1.306926e-001, 1.328168e-001, 1.349381e-001, 1.370306e-001, 1.390943e-001,
+1.411486e-001, 1.432065e-001, 1.452423e-001, 1.472521e-001, 1.492527e-001, 1.512524e-001, 1.532358e-001, 1.552000e-001, 1.571528e-001, 1.591076e-001,
+1.610588e-001, 1.629907e-001, 1.649050e-001, 1.668142e-001, 1.687302e-001, 1.706393e-001, 1.725255e-001, 1.743943e-001, 1.762565e-001, 1.781219e-001,
+1.799845e-001, 1.818296e-001, 1.836558e-001, 1.854720e-001, 1.872864e-001, 1.891042e-001, 1.909209e-001, 1.927120e-001, 1.944851e-001, 1.962500e-001,
+1.980130e-001, 1.997700e-001, 2.015155e-001, 2.032481e-001, 2.049618e-001, 2.066676e-001, 2.083702e-001, 2.100693e-001, 2.117556e-001, 2.134384e-001,
+2.151104e-001, 2.167720e-001, 2.184258e-001, 2.200689e-001, 2.217032e-001, 2.233295e-001, 2.249526e-001, 2.265653e-001, 2.281705e-001, 2.297695e-001,
+2.313689e-001, 2.329651e-001, 2.345502e-001, 2.361330e-001, 2.377143e-001, 2.392926e-001, 2.408663e-001, 2.424365e-001, 2.439859e-001, 2.455308e-001,
+2.470699e-001, 2.486098e-001, 2.501479e-001, 2.516751e-001, 2.531997e-001, 2.547213e-001, 2.562285e-001, 2.577312e-001, 2.592264e-001, 2.607225e-001,
+2.622208e-001, 2.637136e-001, 2.652012e-001, 2.666865e-001, 2.681710e-001, 2.696505e-001, 2.711292e-001, 2.726015e-001, 2.740729e-001, 2.755377e-001,
+2.770004e-001, 2.784548e-001, 2.799059e-001, 2.813473e-001, 2.827846e-001, 2.842110e-001, 2.856362e-001, 2.870579e-001, 2.884808e-001, 2.899080e-001,
+2.913341e-001, 2.927549e-001, 2.941757e-001, 2.955970e-001, 2.970184e-001, 2.984277e-001, 2.998363e-001, 3.012432e-001, 3.026495e-001, 3.040473e-001,
+3.054393e-001, 3.068284e-001, 3.082127e-001, 3.095947e-001, 3.109589e-001, 3.123231e-001, 3.136793e-001, 3.150336e-001, 3.163881e-001, 3.177426e-001,
+3.190953e-001, 3.204369e-001, 3.217784e-001, 3.231084e-001, 3.244344e-001, 3.257552e-001, 3.270645e-001, 3.283738e-001, 3.296772e-001, 3.309794e-001,
+3.322824e-001, 3.335868e-001, 3.348912e-001, 3.361887e-001, 3.374845e-001, 3.387758e-001, 3.400513e-001, 3.413268e-001, 3.425958e-001, 3.438604e-001,
+3.451249e-001, 3.463880e-001, 3.476511e-001, 3.489137e-001, 3.501750e-001, 3.514364e-001, 3.526903e-001, 3.539369e-001, 3.551836e-001, 3.564186e-001,
+3.576494e-001, 3.588801e-001, 3.601047e-001, 3.613288e-001, 3.625529e-001, 3.637793e-001, 3.650057e-001, 3.662337e-001, 3.674710e-001, 3.687084e-001,
+3.699420e-001, 3.711603e-001, 3.723787e-001, 3.735949e-001, 3.748030e-001, 3.760110e-001, 3.772188e-001, 3.784256e-001, 3.796324e-001, 3.808398e-001,
+3.820542e-001, 3.832687e-001, 3.844831e-001, 3.856852e-001, 3.868866e-001, 3.880881e-001, 3.892784e-001, 3.904656e-001, 3.916528e-001, 3.928369e-001,
+3.940187e-001, 3.952004e-001, 3.963830e-001, 3.975678e-001, 3.987527e-001, 3.999375e-001, 4.011156e-001, 4.022935e-001, 4.034713e-001, 4.046388e-001,
+4.057992e-001, 4.069596e-001, 4.081185e-001, 4.092699e-001, 4.104213e-001, 4.115728e-001, 4.127239e-001, 4.138750e-001, 4.150260e-001, 4.161768e-001,
+4.173265e-001, 4.184763e-001, 4.196260e-001, 4.207629e-001, 4.218915e-001, 4.230201e-001, 4.241488e-001, 4.252648e-001, 4.263805e-001, 4.274963e-001,
+4.286107e-001, 4.297220e-001, 4.308333e-001, 4.319446e-001, 4.330580e-001, 4.341729e-001, 4.352878e-001, 4.364027e-001, 4.375130e-001, 4.386218e-001,
+4.397307e-001, 4.408396e-001, 4.419341e-001, 4.430273e-001, 4.441206e-001, 4.452137e-001, 4.462993e-001, 4.473849e-001, 4.484705e-001, 4.495561e-001,
+4.506419e-001, 4.517278e-001, 4.528136e-001, 4.538995e-001, 4.549855e-001, 4.560715e-001, 4.571575e-001, 4.582435e-001, 4.593131e-001, 4.603815e-001,
+4.614499e-001, 4.625184e-001, 4.635790e-001, 4.646375e-001, 4.656960e-001, 4.667545e-001, 4.678118e-001, 4.688682e-001, 4.699247e-001, 4.709811e-001,
+4.720369e-001, 4.730911e-001, 4.741453e-001, 4.751995e-001, 4.762537e-001, 4.772972e-001, 4.783404e-001, 4.793836e-001, 4.804267e-001, 4.814636e-001,
+4.824957e-001, 4.835279e-001, 4.845600e-001, 4.855918e-001, 4.866204e-001, 4.876490e-001, 4.886776e-001, 4.897062e-001, 4.907325e-001, 4.917572e-001,
+4.927819e-001, 4.938066e-001, 4.948313e-001, 4.958443e-001, 4.968571e-001, 4.978698e-001, 4.988826e-001, 4.998916e-001, 5.008922e-001, 5.018928e-001,
+5.028934e-001, 5.038940e-001, 5.048918e-001, 5.058875e-001, 5.068832e-001, 5.078789e-001, 5.088745e-001, 5.098663e-001, 5.108568e-001, 5.118473e-001,
+5.128379e-001, 5.138284e-001, 5.148210e-001, 5.158140e-001, 5.168069e-001, 5.177998e-001, 5.187928e-001, 5.197734e-001, 5.207530e-001, 5.217326e-001,
+5.227121e-001, 5.236917e-001, 5.246658e-001, 5.256393e-001, 5.266127e-001, 5.275862e-001, 5.285596e-001, 5.295340e-001, 5.305087e-001, 5.314833e-001,
+5.324579e-001, 5.334326e-001, 5.344075e-001, 5.353826e-001, 5.363577e-001, 5.373328e-001, 5.383079e-001, 5.392804e-001, 5.402482e-001, 5.412160e-001,
+5.421838e-001, 5.431516e-001, 5.441192e-001, 5.450796e-001, 5.460400e-001, 5.470004e-001, 5.479608e-001, 5.489212e-001, 5.498813e-001, 5.508413e-001,
+5.518013e-001, 5.527614e-001, 5.537214e-001, 5.546813e-001, 5.556407e-001, 5.566001e-001, 5.575595e-001, 5.585189e-001, 5.594783e-001, 5.604330e-001,
+5.613837e-001, 5.623344e-001, 5.632850e-001, 5.642357e-001, 5.651864e-001, 5.661293e-001, 5.670711e-001, 5.680129e-001, 5.689548e-001, 5.698966e-001,
+5.708373e-001, 5.717708e-001, 5.727043e-001, 5.736377e-001, 5.745712e-001, 5.755046e-001, 5.764377e-001, 5.773698e-001, 5.783019e-001, 5.792340e-001,
+5.801661e-001, 5.810983e-001, 5.820269e-001, 5.829499e-001, 5.838728e-001, 5.847957e-001, 5.857186e-001, 5.866415e-001, 5.875610e-001, 5.884745e-001,
+5.893880e-001, 5.903015e-001, 5.912150e-001, 5.921285e-001, 5.930395e-001, 5.939436e-001, 5.948477e-001, 5.957517e-001, 5.966558e-001, 5.975599e-001,
+5.984632e-001, 5.993575e-001, 6.002519e-001, 6.011463e-001, 6.020406e-001, 6.029350e-001, 6.038293e-001, 6.047170e-001, 6.056031e-001, 6.064891e-001,
+6.073752e-001, 6.082612e-001, 6.091472e-001, 6.100294e-001, 6.109064e-001, 6.117833e-001, 6.126603e-001, 6.135372e-001, 6.144142e-001, 6.152912e-001,
+6.161588e-001, 6.170260e-001, 6.178932e-001, 6.187603e-001, 6.196275e-001, 6.204947e-001, 6.213582e-001, 6.222160e-001, 6.230738e-001, 6.239316e-001,
+6.247894e-001, 6.256472e-001, 6.265049e-001, 6.273571e-001, 6.282070e-001, 6.290570e-001, 6.299069e-001, 6.307569e-001, 6.316068e-001, 6.324568e-001,
+6.333056e-001, 6.341545e-001, 6.350033e-001, 6.358521e-001, 6.367009e-001, 6.375498e-001, 6.383977e-001, 6.392375e-001, 6.400774e-001, 6.409172e-001,
+6.417570e-001, 6.425968e-001, 6.434366e-001, 6.442754e-001, 6.451068e-001, 6.459383e-001, 6.467698e-001, 6.476012e-001, 6.484327e-001, 6.492642e-001,
+6.500956e-001, 6.509269e-001, 6.517582e-001, 6.525894e-001, 6.534207e-001, 6.542519e-001, 6.550832e-001, 6.559145e-001, 6.567457e-001, 6.575770e-001,
+6.584082e-001, 6.592395e-001, 6.600708e-001, 6.609020e-001, 6.617333e-001, 6.625600e-001, 6.633837e-001, 6.642074e-001, 6.650311e-001, 6.658548e-001,
+6.666785e-001, 6.675022e-001, 6.683245e-001, 6.691415e-001, 6.699585e-001, 6.707755e-001, 6.715925e-001, 6.724095e-001, 6.732265e-001, 6.740435e-001,
+6.748614e-001, 6.756797e-001, 6.764979e-001, 6.773162e-001, 6.781344e-001, 6.789527e-001, 6.797710e-001, 6.805893e-001, 6.814084e-001, 6.822275e-001,
+6.830467e-001, 6.838658e-001, 6.846849e-001, 6.855040e-001, 6.863232e-001, 6.871381e-001, 6.879450e-001, 6.887520e-001, 6.895590e-001, 6.903660e-001,
+6.911730e-001, 6.919799e-001, 6.927869e-001, 6.935916e-001, 6.943940e-001, 6.951964e-001, 6.959988e-001, 6.968013e-001, 6.976037e-001, 6.984061e-001,
+6.992085e-001, 7.000086e-001, 7.008068e-001, 7.016050e-001, 7.024032e-001, 7.032014e-001, 7.039996e-001, 7.047978e-001, 7.055960e-001, 7.063922e-001,
+7.071862e-001, 7.079802e-001, 7.087742e-001, 7.095682e-001, 7.103622e-001, 7.111562e-001, 7.119502e-001, 7.127416e-001, 7.135255e-001, 7.143094e-001,
+7.150933e-001, 7.158773e-001, 7.166612e-001, 7.174451e-001, 7.182290e-001, 7.190130e-001, 7.197942e-001, 7.205751e-001, 7.213561e-001, 7.221371e-001,
+7.229181e-001, 7.236991e-001, 7.244801e-001, 7.252610e-001, 7.260381e-001, 7.268109e-001, 7.275837e-001, 7.283566e-001, 7.291294e-001, 7.299022e-001,
+7.306751e-001, 7.314479e-001, 7.322207e-001, 7.329800e-001, 7.337379e-001, 7.344958e-001, 7.352537e-001, 7.360116e-001, 7.367695e-001, 7.375274e-001,
+7.382853e-001, 7.390416e-001, 7.397917e-001, 7.405419e-001, 7.412921e-001, 7.420422e-001, 7.427924e-001, 7.435425e-001, 7.442927e-001, 7.450429e-001,
+7.457928e-001, 7.465424e-001, 7.472919e-001, 7.480415e-001, 7.487910e-001, 7.495406e-001, 7.502901e-001, 7.510397e-001, 7.517892e-001, 7.525364e-001,
+7.532799e-001, 7.540234e-001, 7.547670e-001, 7.555105e-001, 7.562541e-001, 7.569976e-001, 7.577412e-001, 7.584847e-001, 7.592246e-001, 7.599560e-001,
+7.606874e-001, 7.614189e-001, 7.621503e-001, 7.628818e-001, 7.636132e-001, 7.643447e-001, 7.650761e-001, 7.658072e-001, 7.665334e-001, 7.672596e-001,
+7.679858e-001, 7.687121e-001, 7.694383e-001, 7.701645e-001, 7.708907e-001, 7.716169e-001, 7.723432e-001, 7.730664e-001, 7.737883e-001, 7.745103e-001,
+7.752322e-001, 7.759542e-001, 7.766761e-001, 7.773981e-001, 7.781200e-001, 7.788420e-001, 7.795622e-001, 7.802751e-001, 7.809880e-001, 7.817009e-001,
+7.824138e-001, 7.831267e-001, 7.838396e-001, 7.845525e-001, 7.852654e-001, 7.859783e-001, 7.866868e-001, 7.873915e-001, 7.880962e-001, 7.888009e-001,
+7.895056e-001, 7.902103e-001, 7.909150e-001, 7.916197e-001, 7.923244e-001, 7.930291e-001, 7.937325e-001, 7.944355e-001, 7.951385e-001, 7.958415e-001,
+7.965445e-001, 7.972475e-001, 7.979504e-001, 7.986534e-001, 7.993564e-001, 8.000594e-001, 8.007570e-001, 8.014532e-001, 8.021494e-001, 8.028456e-001,
+8.035418e-001, 8.042379e-001, 8.049341e-001, 8.056303e-001, 8.063265e-001, 8.070227e-001, 8.077153e-001, 8.084064e-001, 8.090974e-001, 8.097885e-001,
+8.104795e-001, 8.111706e-001, 8.118616e-001, 8.125527e-001, 8.132437e-001, 8.139348e-001, 8.146215e-001, 8.153028e-001, 8.159841e-001, 8.166655e-001,
+8.173468e-001, 8.180281e-001, 8.187094e-001, 8.193907e-001, 8.200720e-001, 8.207533e-001, 8.214342e-001, 8.221067e-001, 8.227792e-001, 8.234516e-001,
+8.241241e-001, 8.247966e-001, 8.254691e-001, 8.261415e-001, 8.268140e-001, 8.274865e-001, 8.281589e-001, 8.288310e-001, 8.295025e-001, 8.301741e-001,
+8.308456e-001, 8.315172e-001, 8.321887e-001, 8.328603e-001, 8.335318e-001, 8.342034e-001, 8.348749e-001, 8.355465e-001, 8.362093e-001, 8.368696e-001,
+8.375299e-001, 8.381903e-001, 8.388506e-001, 8.395109e-001, 8.401713e-001, 8.408316e-001, 8.414919e-001, 8.421523e-001, 8.428126e-001, 8.434634e-001,
+8.441132e-001, 8.447631e-001, 8.454129e-001, 8.460628e-001, 8.467126e-001, 8.473624e-001, 8.480123e-001, 8.486621e-001, 8.493120e-001, 8.499618e-001,
+8.506091e-001, 8.512561e-001, 8.519031e-001, 8.525501e-001, 8.531971e-001, 8.538441e-001, 8.544911e-001, 8.551381e-001, 8.557851e-001, 8.564321e-001,
+8.570790e-001, 8.577216e-001, 8.583621e-001, 8.590026e-001, 8.596431e-001, 8.602835e-001, 8.609240e-001, 8.615645e-001, 8.622049e-001, 8.628454e-001,
+8.634859e-001, 8.641264e-001, 8.647633e-001, 8.653924e-001, 8.660214e-001, 8.666505e-001, 8.672795e-001, 8.679086e-001, 8.685376e-001, 8.691667e-001,
+8.697957e-001, 8.704248e-001, 8.710538e-001, 8.716829e-001, 8.723051e-001, 8.729253e-001, 8.735455e-001, 8.741656e-001, 8.747858e-001, 8.754060e-001,
+8.760262e-001, 8.766464e-001, 8.772665e-001, 8.778867e-001, 8.785069e-001, 8.791267e-001, 8.797398e-001, 8.803530e-001, 8.809662e-001, 8.815794e-001,
+8.821926e-001, 8.828057e-001, 8.834189e-001, 8.840321e-001, 8.846453e-001, 8.852585e-001, 8.858716e-001, 8.864827e-001, 8.870842e-001, 8.876857e-001,
+8.882872e-001, 8.888887e-001, 8.894902e-001, 8.900918e-001, 8.906933e-001, 8.912948e-001, 8.918963e-001, 8.924978e-001, 8.930993e-001, 8.936997e-001,
+8.942916e-001, 8.948835e-001, 8.954755e-001, 8.960674e-001, 8.966594e-001, 8.972513e-001, 8.978432e-001, 8.984352e-001, 8.990271e-001, 8.996191e-001,
+9.002110e-001, 9.008030e-001, 9.013880e-001, 9.019721e-001, 9.025562e-001, 9.031403e-001, 9.037244e-001, 9.043085e-001, 9.048926e-001, 9.054767e-001,
+9.060608e-001, 9.066449e-001, 9.072290e-001, 9.078131e-001, 9.083930e-001, 9.089676e-001, 9.095423e-001, 9.101170e-001, 9.106916e-001, 9.112663e-001,
+9.118410e-001, 9.124156e-001, 9.129903e-001, 9.135650e-001, 9.141397e-001, 9.147143e-001, 9.152890e-001, 9.158568e-001, 9.164234e-001, 9.169900e-001,
+9.175566e-001, 9.181231e-001, 9.186897e-001, 9.192563e-001, 9.198229e-001, 9.203895e-001, 9.209560e-001, 9.215226e-001, 9.220892e-001, 9.226552e-001,
+9.232083e-001, 9.237614e-001, 9.243146e-001, 9.248677e-001, 9.254208e-001, 9.259739e-001, 9.265271e-001, 9.270802e-001, 9.276333e-001, 9.281865e-001,
+9.287396e-001, 9.292927e-001, 9.298455e-001, 9.303920e-001, 9.309385e-001, 9.314851e-001, 9.320316e-001, 9.325782e-001, 9.331247e-001, 9.336712e-001,
+9.342178e-001, 9.347643e-001, 9.353108e-001, 9.358574e-001, 9.364039e-001, 9.369504e-001, 9.374884e-001, 9.380251e-001, 9.385618e-001, 9.390986e-001,
+9.396353e-001, 9.401720e-001, 9.407088e-001, 9.412455e-001, 9.417822e-001, 9.423189e-001, 9.428557e-001, 9.433924e-001, 9.439291e-001, 9.444623e-001,
+9.449920e-001, 9.455216e-001, 9.460513e-001, 9.465809e-001, 9.471106e-001, 9.476402e-001, 9.481698e-001, 9.486995e-001, 9.492291e-001, 9.497588e-001,
+9.502884e-001, 9.508181e-001, 9.513477e-001, 9.518716e-001, 9.523951e-001, 9.529185e-001, 9.534419e-001, 9.539653e-001, 9.544887e-001, 9.550121e-001,
+9.555355e-001, 9.560589e-001, 9.565823e-001, 9.571057e-001, 9.576292e-001, 9.581526e-001, 9.586744e-001, 9.591860e-001, 9.596975e-001, 9.602091e-001,
+9.607207e-001, 9.612322e-001, 9.617438e-001, 9.622554e-001, 9.627669e-001, 9.632785e-001, 9.637901e-001, 9.643016e-001, 9.648132e-001, 9.653248e-001,
+9.658346e-001, 9.663344e-001, 9.668341e-001, 9.673338e-001, 9.678336e-001, 9.683333e-001, 9.688330e-001, 9.693328e-001, 9.698325e-001, 9.703322e-001,
+9.708319e-001, 9.713317e-001, 9.718314e-001, 9.723311e-001, 9.728309e-001, 9.733167e-001, 9.738018e-001, 9.742868e-001, 9.747719e-001, 9.752570e-001,
+9.757420e-001, 9.762271e-001, 9.767121e-001, 9.771972e-001, 9.776822e-001, 9.781673e-001, 9.786523e-001, 9.791374e-001, 9.796224e-001, 9.801008e-001,
+9.805732e-001, 9.810456e-001, 9.815181e-001, 9.819905e-001, 9.824629e-001, 9.829354e-001, 9.834078e-001, 9.838803e-001, 9.843527e-001, 9.848251e-001,
+9.852976e-001, 9.857700e-001, 9.862425e-001, 9.867149e-001, 9.871709e-001, 9.876252e-001, 9.880795e-001, 9.885339e-001, 9.889882e-001, 9.894425e-001,
+9.898969e-001, 9.903512e-001, 9.908055e-001, 9.912599e-001, 9.917142e-001, 9.921685e-001, 9.926229e-001, 9.930772e-001, 9.935300e-001, 9.939613e-001,
+9.943927e-001, 9.948240e-001, 9.952553e-001, 9.956867e-001, 9.961180e-001, 9.965493e-001, 9.969807e-001, 9.974120e-001, 9.978433e-001, 9.982747e-001,
+9.987060e-001, 9.991373e-001, 9.995687e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 5.022290e-003, 1.081811e-002, 1.629388e-002, 2.148593e-002, 2.632469e-002, 3.083350e-002, 3.507377e-002, 3.906354e-002, 4.289377e-002,
+4.657906e-002, 5.014710e-002, 5.361810e-002, 5.703614e-002, 6.035787e-002, 6.358788e-002, 6.673113e-002, 6.982726e-002, 7.285734e-002, 7.582416e-002,
+7.873561e-002, 8.159776e-002, 8.440806e-002, 8.719432e-002, 8.996146e-002, 9.268748e-002, 9.538085e-002, 9.803313e-002, 1.006408e-001, 1.032158e-001,
+1.057695e-001, 1.082856e-001, 1.107629e-001, 1.132119e-001, 1.156331e-001, 1.180198e-001, 1.203960e-001, 1.227460e-001, 1.250717e-001, 1.273722e-001,
+1.296402e-001, 1.319028e-001, 1.341575e-001, 1.363900e-001, 1.386094e-001, 1.408099e-001, 1.429898e-001, 1.451606e-001, 1.473140e-001, 1.494464e-001,
+1.515574e-001, 1.536654e-001, 1.557527e-001, 1.578147e-001, 1.598653e-001, 1.619043e-001, 1.639177e-001, 1.659058e-001, 1.678874e-001, 1.698615e-001,
+1.718100e-001, 1.737367e-001, 1.756579e-001, 1.775817e-001, 1.794972e-001, 1.813944e-001, 1.832813e-001, 1.851720e-001, 1.870613e-001, 1.889401e-001,
+1.908052e-001, 1.926642e-001, 1.945221e-001, 1.963764e-001, 1.982189e-001, 2.000445e-001, 2.018636e-001, 2.036862e-001, 2.054955e-001, 2.072805e-001,
+2.090492e-001, 2.108096e-001, 2.125661e-001, 2.143186e-001, 2.160614e-001, 2.177939e-001, 2.195162e-001, 2.212310e-001, 2.229442e-001, 2.246555e-001,
+2.263628e-001, 2.280619e-001, 2.297438e-001, 2.314165e-001, 2.330886e-001, 2.347614e-001, 2.364338e-001, 2.380887e-001, 2.397311e-001, 2.413610e-001,
+2.429879e-001, 2.446156e-001, 2.462484e-001, 2.478673e-001, 2.494771e-001, 2.510703e-001, 2.526575e-001, 2.542415e-001, 2.558272e-001, 2.574067e-001,
+2.589787e-001, 2.605281e-001, 2.620698e-001, 2.635981e-001, 2.651237e-001, 2.666468e-001, 2.681732e-001, 2.696993e-001, 2.712090e-001, 2.727131e-001,
+2.742045e-001, 2.756916e-001, 2.771748e-001, 2.786592e-001, 2.801440e-001, 2.816297e-001, 2.831150e-001, 2.845806e-001, 2.860447e-001, 2.874991e-001,
+2.889532e-001, 2.904063e-001, 2.918587e-001, 2.933095e-001, 2.947535e-001, 2.961813e-001, 2.976050e-001, 2.990190e-001, 3.004321e-001, 3.018426e-001,
+3.032543e-001, 3.046708e-001, 3.060868e-001, 3.074971e-001, 3.089074e-001, 3.103012e-001, 3.116944e-001, 3.130815e-001, 3.144671e-001, 3.158538e-001,
+3.172412e-001, 3.186291e-001, 3.200176e-001, 3.214036e-001, 3.227730e-001, 3.241423e-001, 3.255028e-001, 3.268616e-001, 3.282202e-001, 3.295787e-001,
+3.309384e-001, 3.323050e-001, 3.336716e-001, 3.350209e-001, 3.363648e-001, 3.377039e-001, 3.390335e-001, 3.403631e-001, 3.416890e-001, 3.430142e-001,
+3.443412e-001, 3.456713e-001, 3.470014e-001, 3.483263e-001, 3.496501e-001, 3.509699e-001, 3.522767e-001, 3.535835e-001, 3.548852e-001, 3.561839e-001,
+3.574825e-001, 3.587826e-001, 3.600828e-001, 3.613828e-001, 3.626825e-001, 3.639823e-001, 3.652708e-001, 3.665492e-001, 3.678277e-001, 3.690967e-001,
+3.703625e-001, 3.716283e-001, 3.728911e-001, 3.741537e-001, 3.754166e-001, 3.766839e-001, 3.779512e-001, 3.792163e-001, 3.804696e-001, 3.817229e-001,
+3.829732e-001, 3.842122e-001, 3.854512e-001, 3.866889e-001, 3.879220e-001, 3.891551e-001, 3.903886e-001, 3.916241e-001, 3.928596e-001, 3.940944e-001,
+3.953225e-001, 3.965505e-001, 3.977786e-001, 3.989898e-001, 4.002005e-001, 4.014112e-001, 4.026145e-001, 4.038159e-001, 4.050173e-001, 4.062180e-001,
+4.074181e-001, 4.086182e-001, 4.098180e-001, 4.110169e-001, 4.122159e-001, 4.134149e-001, 4.145950e-001, 4.157749e-001, 4.169547e-001, 4.181273e-001,
+4.192952e-001, 4.204632e-001, 4.216303e-001, 4.227937e-001, 4.239572e-001, 4.251207e-001, 4.262751e-001, 4.274261e-001, 4.285770e-001, 4.297257e-001,
+4.308654e-001, 4.320050e-001, 4.331447e-001, 4.342771e-001, 4.354052e-001, 4.365333e-001, 4.376614e-001, 4.387851e-001, 4.399087e-001, 4.410324e-001,
+4.421545e-001, 4.432732e-001, 4.443919e-001, 4.455107e-001, 4.466271e-001, 4.477420e-001, 4.488568e-001, 4.499716e-001, 4.510774e-001, 4.521808e-001,
+4.532842e-001, 4.543875e-001, 4.554865e-001, 4.565852e-001, 4.576839e-001, 4.587827e-001, 4.598834e-001, 4.609842e-001, 4.620849e-001, 4.631854e-001,
+4.642808e-001, 4.653763e-001, 4.664717e-001, 4.675667e-001, 4.686493e-001, 4.697319e-001, 4.708144e-001, 4.718970e-001, 4.729730e-001, 4.740487e-001,
+4.751244e-001, 4.762001e-001, 4.772703e-001, 4.783391e-001, 4.794079e-001, 4.804767e-001, 4.815420e-001, 4.826049e-001, 4.836677e-001, 4.847306e-001,
+4.857919e-001, 4.868500e-001, 4.879081e-001, 4.889662e-001, 4.900243e-001, 4.910765e-001, 4.921286e-001, 4.931807e-001, 4.942328e-001, 4.952807e-001,
+4.963257e-001, 4.973706e-001, 4.984156e-001, 4.994598e-001, 5.004988e-001, 5.015377e-001, 5.025766e-001, 5.036156e-001, 5.046515e-001, 5.056853e-001,
+5.067192e-001, 5.077530e-001, 5.087868e-001, 5.098150e-001, 5.108431e-001, 5.118713e-001, 5.128994e-001, 5.139254e-001, 5.149468e-001, 5.159683e-001,
+5.169898e-001, 5.180112e-001, 5.190292e-001, 5.200446e-001, 5.210601e-001, 5.220756e-001, 5.230910e-001, 5.240967e-001, 5.250995e-001, 5.261024e-001,
+5.271052e-001, 5.281080e-001, 5.291043e-001, 5.300997e-001, 5.310951e-001, 5.320905e-001, 5.330859e-001, 5.340676e-001, 5.350484e-001, 5.360292e-001,
+5.370100e-001, 5.379908e-001, 5.389664e-001, 5.399416e-001, 5.409168e-001, 5.418919e-001, 5.428671e-001, 5.438383e-001, 5.448085e-001, 5.457787e-001,
+5.467489e-001, 5.477192e-001, 5.486855e-001, 5.496495e-001, 5.506135e-001, 5.515775e-001, 5.525415e-001, 5.535005e-001, 5.544509e-001, 5.554014e-001,
+5.563518e-001, 5.573022e-001, 5.582525e-001, 5.591980e-001, 5.601436e-001, 5.610891e-001, 5.620347e-001, 5.629802e-001, 5.639281e-001, 5.648774e-001,
+5.658267e-001, 5.667760e-001, 5.677253e-001, 5.686742e-001, 5.696194e-001, 5.705646e-001, 5.715098e-001, 5.724550e-001, 5.734002e-001, 5.743390e-001,
+5.752724e-001, 5.762057e-001, 5.771391e-001, 5.780725e-001, 5.790059e-001, 5.799363e-001, 5.808664e-001, 5.817964e-001, 5.827264e-001, 5.836564e-001,
+5.845860e-001, 5.855132e-001, 5.864404e-001, 5.873676e-001, 5.882948e-001, 5.892219e-001, 5.901459e-001, 5.910627e-001, 5.919794e-001, 5.928962e-001,
+5.938129e-001, 5.947296e-001, 5.956424e-001, 5.965489e-001, 5.974555e-001, 5.983620e-001, 5.992685e-001, 6.001750e-001, 6.010808e-001, 6.019854e-001,
+6.028900e-001, 6.037946e-001, 6.046992e-001, 6.056038e-001, 6.065080e-001, 6.074111e-001, 6.083141e-001, 6.092172e-001, 6.101202e-001, 6.110233e-001,
+6.119255e-001, 6.128195e-001, 6.137136e-001, 6.146076e-001, 6.155017e-001, 6.163957e-001, 6.172898e-001, 6.181768e-001, 6.190622e-001, 6.199476e-001,
+6.208330e-001, 6.217185e-001, 6.226039e-001, 6.234888e-001, 6.243732e-001, 6.252575e-001, 6.261419e-001, 6.270262e-001, 6.279106e-001, 6.287949e-001,
+6.296725e-001, 6.305498e-001, 6.314271e-001, 6.323044e-001, 6.331817e-001, 6.340590e-001, 6.349308e-001, 6.357945e-001, 6.366583e-001, 6.375220e-001,
+6.383857e-001, 6.392494e-001, 6.401131e-001, 6.409725e-001, 6.418304e-001, 6.426882e-001, 6.435461e-001, 6.444039e-001, 6.452617e-001, 6.461196e-001,
+6.469791e-001, 6.478387e-001, 6.486982e-001, 6.495578e-001, 6.504173e-001, 6.512769e-001, 6.521352e-001, 6.529835e-001, 6.538318e-001, 6.546801e-001,
+6.555284e-001, 6.563767e-001, 6.572250e-001, 6.580717e-001, 6.589083e-001, 6.597450e-001, 6.605816e-001, 6.614183e-001, 6.622549e-001, 6.630916e-001,
+6.639280e-001, 6.647610e-001, 6.655940e-001, 6.664270e-001, 6.672600e-001, 6.680931e-001, 6.689261e-001, 6.697591e-001, 6.705950e-001, 6.714312e-001,
+6.722675e-001, 6.731037e-001, 6.739400e-001, 6.747762e-001, 6.756125e-001, 6.764392e-001, 6.772598e-001, 6.780803e-001, 6.789009e-001, 6.797214e-001,
+6.805420e-001, 6.813625e-001, 6.821812e-001, 6.829929e-001, 6.838046e-001, 6.846164e-001, 6.854281e-001, 6.862398e-001, 6.870515e-001, 6.878632e-001,
+6.886738e-001, 6.894840e-001, 6.902941e-001, 6.911043e-001, 6.919144e-001, 6.927246e-001, 6.935347e-001, 6.943448e-001, 6.951546e-001, 6.959643e-001,
+6.967741e-001, 6.975838e-001, 6.983936e-001, 6.992033e-001, 7.000131e-001, 7.008184e-001, 7.016160e-001, 7.024135e-001, 7.032110e-001, 7.040086e-001,
+7.048061e-001, 7.056037e-001, 7.064012e-001, 7.071956e-001, 7.079872e-001, 7.087787e-001, 7.095702e-001, 7.103618e-001, 7.111533e-001, 7.119448e-001,
+7.127364e-001, 7.135254e-001, 7.143123e-001, 7.150992e-001, 7.158861e-001, 7.166730e-001, 7.174600e-001, 7.182469e-001, 7.190338e-001, 7.198162e-001,
+7.205936e-001, 7.213709e-001, 7.221483e-001, 7.229256e-001, 7.237030e-001, 7.244803e-001, 7.252576e-001, 7.260325e-001, 7.268007e-001, 7.275689e-001,
+7.283371e-001, 7.291053e-001, 7.298735e-001, 7.306417e-001, 7.314098e-001, 7.321780e-001, 7.329385e-001, 7.336984e-001, 7.344584e-001, 7.352183e-001,
+7.359783e-001, 7.367382e-001, 7.374982e-001, 7.382581e-001, 7.390147e-001, 7.397678e-001, 7.405210e-001, 7.412741e-001, 7.420272e-001, 7.427803e-001,
+7.435335e-001, 7.442866e-001, 7.450397e-001, 7.457881e-001, 7.465361e-001, 7.472842e-001, 7.480322e-001, 7.487802e-001, 7.495282e-001, 7.502762e-001,
+7.510242e-001, 7.517700e-001, 7.525079e-001, 7.532458e-001, 7.539836e-001, 7.547215e-001, 7.554594e-001, 7.561972e-001, 7.569351e-001, 7.576729e-001,
+7.584073e-001, 7.591359e-001, 7.598644e-001, 7.605930e-001, 7.613216e-001, 7.620502e-001, 7.627788e-001, 7.635074e-001, 7.642359e-001, 7.649617e-001,
+7.656835e-001, 7.664054e-001, 7.671272e-001, 7.678490e-001, 7.685709e-001, 7.692927e-001, 7.700145e-001, 7.707363e-001, 7.714543e-001, 7.721639e-001,
+7.728734e-001, 7.735830e-001, 7.742925e-001, 7.750021e-001, 7.757117e-001, 7.764212e-001, 7.771308e-001, 7.778395e-001, 7.785378e-001, 7.792361e-001,
+7.799345e-001, 7.806328e-001, 7.813312e-001, 7.820295e-001, 7.827279e-001, 7.834262e-001, 7.841246e-001, 7.848206e-001, 7.855157e-001, 7.862108e-001,
+7.869059e-001, 7.876011e-001, 7.882962e-001, 7.889913e-001, 7.896864e-001, 7.903815e-001, 7.910753e-001, 7.917635e-001, 7.924516e-001, 7.931398e-001,
+7.938280e-001, 7.945162e-001, 7.952044e-001, 7.958926e-001, 7.965808e-001, 7.972690e-001, 7.979509e-001, 7.986276e-001, 7.993042e-001, 7.999808e-001,
+8.006574e-001, 8.013341e-001, 8.020107e-001, 8.026873e-001, 8.033639e-001, 8.040405e-001, 8.047140e-001, 8.053864e-001, 8.060588e-001, 8.067312e-001,
+8.074036e-001, 8.080759e-001, 8.087483e-001, 8.094207e-001, 8.100931e-001, 8.107655e-001, 8.114361e-001, 8.121062e-001, 8.127764e-001, 8.134465e-001,
+8.141167e-001, 8.147869e-001, 8.154570e-001, 8.161272e-001, 8.167973e-001, 8.174675e-001, 8.181295e-001, 8.187881e-001, 8.194466e-001, 8.201051e-001,
+8.207636e-001, 8.214221e-001, 8.220807e-001, 8.227392e-001, 8.233977e-001, 8.240562e-001, 8.247126e-001, 8.253662e-001, 8.260199e-001, 8.266735e-001,
+8.273272e-001, 8.279809e-001, 8.286345e-001, 8.292882e-001, 8.299418e-001, 8.305955e-001, 8.312490e-001, 8.318998e-001, 8.325507e-001, 8.332015e-001,
+8.338523e-001, 8.345032e-001, 8.351540e-001, 8.358049e-001, 8.364557e-001, 8.371065e-001, 8.377574e-001, 8.384053e-001, 8.390502e-001, 8.396951e-001,
+8.403400e-001, 8.409849e-001, 8.416298e-001, 8.422747e-001, 8.429197e-001, 8.435646e-001, 8.442095e-001, 8.448544e-001, 8.454959e-001, 8.461365e-001,
+8.467771e-001, 8.474177e-001, 8.480582e-001, 8.486988e-001, 8.493394e-001, 8.499800e-001, 8.506206e-001, 8.512611e-001, 8.519017e-001, 8.525398e-001,
+8.531776e-001, 8.538154e-001, 8.544532e-001, 8.550911e-001, 8.557289e-001, 8.563667e-001, 8.570045e-001, 8.576423e-001, 8.582801e-001, 8.589180e-001,
+8.595503e-001, 8.601820e-001, 8.608136e-001, 8.614452e-001, 8.620768e-001, 8.627085e-001, 8.633401e-001, 8.639717e-001, 8.646034e-001, 8.652350e-001,
+8.658666e-001, 8.664918e-001, 8.671139e-001, 8.677360e-001, 8.683582e-001, 8.689803e-001, 8.696024e-001, 8.702245e-001, 8.708466e-001, 8.714688e-001,
+8.720909e-001, 8.727130e-001, 8.733326e-001, 8.739467e-001, 8.745608e-001, 8.751749e-001, 8.757890e-001, 8.764031e-001, 8.770172e-001, 8.776313e-001,
+8.782454e-001, 8.788595e-001, 8.794736e-001, 8.800877e-001, 8.806946e-001, 8.812993e-001, 8.819040e-001, 8.825087e-001, 8.831134e-001, 8.837181e-001,
+8.843229e-001, 8.849276e-001, 8.855323e-001, 8.861370e-001, 8.867417e-001, 8.873459e-001, 8.879420e-001, 8.885382e-001, 8.891344e-001, 8.897306e-001,
+8.903267e-001, 8.909229e-001, 8.915191e-001, 8.921153e-001, 8.927114e-001, 8.933076e-001, 8.939038e-001, 8.944980e-001, 8.950834e-001, 8.956688e-001,
+8.962541e-001, 8.968395e-001, 8.974249e-001, 8.980103e-001, 8.985957e-001, 8.991811e-001, 8.997665e-001, 9.003518e-001, 9.009372e-001, 9.015216e-001,
+9.020984e-001, 9.026752e-001, 9.032519e-001, 9.038287e-001, 9.044055e-001, 9.049823e-001, 9.055591e-001, 9.061359e-001, 9.067127e-001, 9.072895e-001,
+9.078663e-001, 9.084431e-001, 9.090056e-001, 9.095662e-001, 9.101268e-001, 9.106875e-001, 9.112481e-001, 9.118087e-001, 9.123693e-001, 9.129299e-001,
+9.134905e-001, 9.140511e-001, 9.146117e-001, 9.151723e-001, 9.157287e-001, 9.162801e-001, 9.168315e-001, 9.173829e-001, 9.179343e-001, 9.184857e-001,
+9.190371e-001, 9.195885e-001, 9.201399e-001, 9.206913e-001, 9.212427e-001, 9.217941e-001, 9.223455e-001, 9.228839e-001, 9.234201e-001, 9.239562e-001,
+9.244924e-001, 9.250285e-001, 9.255647e-001, 9.261008e-001, 9.266370e-001, 9.271731e-001, 9.277093e-001, 9.282454e-001, 9.287816e-001, 9.293169e-001,
+9.298372e-001, 9.303574e-001, 9.308777e-001, 9.313980e-001, 9.319182e-001, 9.324385e-001, 9.329588e-001, 9.334790e-001, 9.339993e-001, 9.345196e-001,
+9.350399e-001, 9.355601e-001, 9.360799e-001, 9.365919e-001, 9.371039e-001, 9.376158e-001, 9.381278e-001, 9.386398e-001, 9.391518e-001, 9.396638e-001,
+9.401758e-001, 9.406878e-001, 9.411997e-001, 9.417117e-001, 9.422237e-001, 9.427357e-001, 9.432381e-001, 9.437392e-001, 9.442403e-001, 9.447414e-001,
+9.452425e-001, 9.457436e-001, 9.462447e-001, 9.467458e-001, 9.472469e-001, 9.477481e-001, 9.482492e-001, 9.487503e-001, 9.492514e-001, 9.497454e-001,
+9.502324e-001, 9.507193e-001, 9.512062e-001, 9.516932e-001, 9.521801e-001, 9.526671e-001, 9.531540e-001, 9.536409e-001, 9.541279e-001, 9.546148e-001,
+9.551018e-001, 9.555887e-001, 9.560756e-001, 9.565511e-001, 9.570255e-001, 9.574998e-001, 9.579742e-001, 9.584486e-001, 9.589230e-001, 9.593974e-001,
+9.598717e-001, 9.603461e-001, 9.608205e-001, 9.612949e-001, 9.617693e-001, 9.622436e-001, 9.627162e-001, 9.631766e-001, 9.636370e-001, 9.640975e-001,
+9.645579e-001, 9.650184e-001, 9.654788e-001, 9.659392e-001, 9.663997e-001, 9.668601e-001, 9.673205e-001, 9.677810e-001, 9.682414e-001, 9.687019e-001,
+9.691603e-001, 9.696069e-001, 9.700534e-001, 9.705000e-001, 9.709466e-001, 9.713931e-001, 9.718397e-001, 9.722863e-001, 9.727329e-001, 9.731794e-001,
+9.736260e-001, 9.740726e-001, 9.745191e-001, 9.749657e-001, 9.754123e-001, 9.758465e-001, 9.762801e-001, 9.767136e-001, 9.771471e-001, 9.775807e-001,
+9.780142e-001, 9.784477e-001, 9.788813e-001, 9.793148e-001, 9.797484e-001, 9.801819e-001, 9.806154e-001, 9.810490e-001, 9.814825e-001, 9.819087e-001,
+9.823286e-001, 9.827484e-001, 9.831682e-001, 9.835881e-001, 9.840079e-001, 9.844278e-001, 9.848476e-001, 9.852675e-001, 9.856873e-001, 9.861072e-001,
+9.865270e-001, 9.869468e-001, 9.873667e-001, 9.877865e-001, 9.882005e-001, 9.886139e-001, 9.890273e-001, 9.894407e-001, 9.898541e-001, 9.902675e-001,
+9.906809e-001, 9.910943e-001, 9.915077e-001, 9.919211e-001, 9.923345e-001, 9.927479e-001, 9.931613e-001, 9.935747e-001, 9.939873e-001, 9.943881e-001,
+9.947890e-001, 9.951898e-001, 9.955907e-001, 9.959915e-001, 9.963924e-001, 9.967932e-001, 9.971941e-001, 9.975949e-001, 9.979958e-001, 9.983966e-001,
+9.987975e-001, 9.991983e-001, 9.995992e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.247685e-003, 7.799948e-003, 1.230008e-002, 1.663850e-002, 2.079709e-002, 2.473849e-002, 2.849631e-002, 3.208774e-002, 3.549047e-002,
+3.870741e-002, 4.167423e-002, 4.438376e-002, 4.687990e-002, 4.928654e-002, 5.167507e-002, 5.405820e-002, 5.645954e-002, 5.882685e-002, 6.116019e-002,
+6.346661e-002, 6.574902e-002, 6.802025e-002, 7.027722e-002, 7.251718e-002, 7.473446e-002, 7.692558e-002, 7.908455e-002, 8.122031e-002, 8.332725e-002,
+8.541282e-002, 8.747132e-002, 8.952188e-002, 9.155015e-002, 9.355978e-002, 9.555811e-002, 9.752838e-002, 9.949045e-002, 1.014443e-001, 1.033671e-001,
+1.052874e-001, 1.072128e-001, 1.091050e-001, 1.109855e-001, 1.128652e-001, 1.147163e-001, 1.165445e-001, 1.183725e-001, 1.202074e-001, 1.220165e-001,
+1.238056e-001, 1.255939e-001, 1.273799e-001, 1.291384e-001, 1.308757e-001, 1.326085e-001, 1.343494e-001, 1.360911e-001, 1.378227e-001, 1.395413e-001,
+1.412588e-001, 1.429695e-001, 1.446525e-001, 1.463117e-001, 1.479573e-001, 1.495993e-001, 1.512473e-001, 1.529007e-001, 1.545382e-001, 1.561595e-001,
+1.577728e-001, 1.593861e-001, 1.610000e-001, 1.625990e-001, 1.641765e-001, 1.657396e-001, 1.672948e-001, 1.688484e-001, 1.704075e-001, 1.719690e-001,
+1.735302e-001, 1.750830e-001, 1.766262e-001, 1.781644e-001, 1.797035e-001, 1.812402e-001, 1.827661e-001, 1.842781e-001, 1.857749e-001, 1.872583e-001,
+1.887381e-001, 1.902170e-001, 1.916978e-001, 1.931888e-001, 1.946719e-001, 1.961460e-001, 1.976051e-001, 1.990567e-001, 2.005051e-001, 2.019520e-001,
+2.034036e-001, 2.048534e-001, 2.062974e-001, 2.077304e-001, 2.091593e-001, 2.105841e-001, 2.120015e-001, 2.134160e-001, 2.148285e-001, 2.162440e-001,
+2.176621e-001, 2.190826e-001, 2.204977e-001, 2.218971e-001, 2.232883e-001, 2.246736e-001, 2.260530e-001, 2.274316e-001, 2.288106e-001, 2.301889e-001,
+2.315658e-001, 2.329388e-001, 2.343092e-001, 2.356633e-001, 2.370134e-001, 2.383510e-001, 2.396876e-001, 2.410193e-001, 2.423514e-001, 2.436848e-001,
+2.450178e-001, 2.463498e-001, 2.476797e-001, 2.490059e-001, 2.503249e-001, 2.516323e-001, 2.529353e-001, 2.542309e-001, 2.555251e-001, 2.568162e-001,
+2.581080e-001, 2.594016e-001, 2.606951e-001, 2.619884e-001, 2.632819e-001, 2.645808e-001, 2.658798e-001, 2.671643e-001, 2.684471e-001, 2.697231e-001,
+2.709963e-001, 2.722683e-001, 2.735389e-001, 2.748104e-001, 2.760852e-001, 2.773601e-001, 2.786275e-001, 2.798944e-001, 2.811589e-001, 2.824219e-001,
+2.836811e-001, 2.849281e-001, 2.861750e-001, 2.874142e-001, 2.886519e-001, 2.898886e-001, 2.911237e-001, 2.923589e-001, 2.935977e-001, 2.948368e-001,
+2.960684e-001, 2.972904e-001, 2.985124e-001, 2.997243e-001, 3.009351e-001, 3.021414e-001, 3.033382e-001, 3.045350e-001, 3.057266e-001, 3.069159e-001,
+3.081053e-001, 3.092937e-001, 3.104822e-001, 3.116726e-001, 3.128666e-001, 3.140607e-001, 3.152511e-001, 3.164390e-001, 3.176269e-001, 3.188066e-001,
+3.199845e-001, 3.211624e-001, 3.223275e-001, 3.234926e-001, 3.246567e-001, 3.258154e-001, 3.269740e-001, 3.281327e-001, 3.292913e-001, 3.304499e-001,
+3.316103e-001, 3.327751e-001, 3.339400e-001, 3.351032e-001, 3.362624e-001, 3.374216e-001, 3.385764e-001, 3.397187e-001, 3.408610e-001, 3.420014e-001,
+3.431330e-001, 3.442645e-001, 3.453958e-001, 3.465227e-001, 3.476496e-001, 3.487765e-001, 3.499046e-001, 3.510330e-001, 3.521613e-001, 3.532944e-001,
+3.544300e-001, 3.555657e-001, 3.566969e-001, 3.578208e-001, 3.589447e-001, 3.600678e-001, 3.611776e-001, 3.622873e-001, 3.633971e-001, 3.645012e-001,
+3.656028e-001, 3.667044e-001, 3.678053e-001, 3.689046e-001, 3.700039e-001, 3.711033e-001, 3.721982e-001, 3.732921e-001, 3.743860e-001, 3.754799e-001,
+3.765741e-001, 3.776683e-001, 3.787625e-001, 3.798545e-001, 3.809455e-001, 3.820366e-001, 3.831266e-001, 3.842038e-001, 3.852810e-001, 3.863583e-001,
+3.874323e-001, 3.885015e-001, 3.895707e-001, 3.906398e-001, 3.917075e-001, 3.927743e-001, 3.938411e-001, 3.949080e-001, 3.959777e-001, 3.970480e-001,
+3.981182e-001, 3.991885e-001, 4.002598e-001, 4.013311e-001, 4.024024e-001, 4.034720e-001, 4.045264e-001, 4.055808e-001, 4.066353e-001, 4.076882e-001,
+4.087311e-001, 4.097741e-001, 4.108171e-001, 4.118594e-001, 4.128966e-001, 4.139338e-001, 4.149710e-001, 4.160081e-001, 4.170451e-001, 4.180821e-001,
+4.191191e-001, 4.201561e-001, 4.211978e-001, 4.222403e-001, 4.232827e-001, 4.243251e-001, 4.253645e-001, 4.264025e-001, 4.274404e-001, 4.284784e-001,
+4.295132e-001, 4.305432e-001, 4.315731e-001, 4.326031e-001, 4.336325e-001, 4.346519e-001, 4.356714e-001, 4.366909e-001, 4.377104e-001, 4.387266e-001,
+4.397412e-001, 4.407558e-001, 4.417704e-001, 4.427852e-001, 4.438005e-001, 4.448158e-001, 4.458311e-001, 4.468464e-001, 4.478605e-001, 4.488741e-001,
+4.498876e-001, 4.509011e-001, 4.519144e-001, 4.529229e-001, 4.539315e-001, 4.549400e-001, 4.559486e-001, 4.569540e-001, 4.579546e-001, 4.589552e-001,
+4.599558e-001, 4.609564e-001, 4.619504e-001, 4.629410e-001, 4.639315e-001, 4.649220e-001, 4.659125e-001, 4.668991e-001, 4.678850e-001, 4.688709e-001,
+4.698568e-001, 4.708426e-001, 4.718292e-001, 4.728157e-001, 4.738023e-001, 4.747888e-001, 4.757754e-001, 4.767677e-001, 4.777600e-001, 4.787523e-001,
+4.797446e-001, 4.807369e-001, 4.817185e-001, 4.826998e-001, 4.836811e-001, 4.846624e-001, 4.856437e-001, 4.866138e-001, 4.875822e-001, 4.885506e-001,
+4.895191e-001, 4.904875e-001, 4.914506e-001, 4.924112e-001, 4.933719e-001, 4.943326e-001, 4.952932e-001, 4.962527e-001, 4.972106e-001, 4.981686e-001,
+4.991265e-001, 5.000844e-001, 5.010425e-001, 5.020027e-001, 5.029629e-001, 5.039231e-001, 5.048832e-001, 5.058434e-001, 5.067989e-001, 5.077522e-001,
+5.087054e-001, 5.096587e-001, 5.106120e-001, 5.115647e-001, 5.125146e-001, 5.134644e-001, 5.144143e-001, 5.153642e-001, 5.163141e-001, 5.172605e-001,
+5.182046e-001, 5.191487e-001, 5.200928e-001, 5.210370e-001, 5.219811e-001, 5.229174e-001, 5.238532e-001, 5.247890e-001, 5.257249e-001, 5.266607e-001,
+5.275959e-001, 5.285284e-001, 5.294609e-001, 5.303935e-001, 5.313260e-001, 5.322586e-001, 5.331917e-001, 5.341259e-001, 5.350601e-001, 5.359943e-001,
+5.369285e-001, 5.378627e-001, 5.387967e-001, 5.397306e-001, 5.406644e-001, 5.415983e-001, 5.425322e-001, 5.434660e-001, 5.443957e-001, 5.453198e-001,
+5.462440e-001, 5.471681e-001, 5.480923e-001, 5.490165e-001, 5.499367e-001, 5.508492e-001, 5.517617e-001, 5.526742e-001, 5.535868e-001, 5.544993e-001,
+5.554108e-001, 5.563166e-001, 5.572223e-001, 5.581281e-001, 5.590338e-001, 5.599395e-001, 5.608453e-001, 5.617493e-001, 5.626531e-001, 5.635568e-001,
+5.644606e-001, 5.653644e-001, 5.662681e-001, 5.671733e-001, 5.680799e-001, 5.689864e-001, 5.698930e-001, 5.707996e-001, 5.717062e-001, 5.726128e-001,
+5.735203e-001, 5.744279e-001, 5.753354e-001, 5.762429e-001, 5.771505e-001, 5.780580e-001, 5.789619e-001, 5.798614e-001, 5.807610e-001, 5.816605e-001,
+5.825600e-001, 5.834595e-001, 5.843591e-001, 5.852505e-001, 5.861398e-001, 5.870290e-001, 5.879183e-001, 5.888076e-001, 5.896969e-001, 5.905860e-001,
+5.914697e-001, 5.923534e-001, 5.932370e-001, 5.941207e-001, 5.950044e-001, 5.958881e-001, 5.967717e-001, 5.976545e-001, 5.985374e-001, 5.994203e-001,
+6.003031e-001, 6.011860e-001, 6.020689e-001, 6.029512e-001, 6.038313e-001, 6.047113e-001, 6.055914e-001, 6.064714e-001, 6.073515e-001, 6.082315e-001,
+6.091110e-001, 6.099859e-001, 6.108609e-001, 6.117358e-001, 6.126108e-001, 6.134857e-001, 6.143607e-001, 6.152356e-001, 6.160973e-001, 6.169581e-001,
+6.178189e-001, 6.186797e-001, 6.195405e-001, 6.204013e-001, 6.212621e-001, 6.221167e-001, 6.229681e-001, 6.238195e-001, 6.246708e-001, 6.255222e-001,
+6.263735e-001, 6.272249e-001, 6.280750e-001, 6.289216e-001, 6.297682e-001, 6.306148e-001, 6.314614e-001, 6.323080e-001, 6.331546e-001, 6.340012e-001,
+6.348477e-001, 6.356942e-001, 6.365406e-001, 6.373871e-001, 6.382335e-001, 6.390800e-001, 6.399264e-001, 6.407735e-001, 6.416242e-001, 6.424750e-001,
+6.433258e-001, 6.441765e-001, 6.450273e-001, 6.458780e-001, 6.467288e-001, 6.475782e-001, 6.484257e-001, 6.492732e-001, 6.501207e-001, 6.509682e-001,
+6.518156e-001, 6.526631e-001, 6.535106e-001, 6.543517e-001, 6.551877e-001, 6.560238e-001, 6.568598e-001, 6.576959e-001, 6.585319e-001, 6.593680e-001,
+6.602040e-001, 6.610359e-001, 6.618650e-001, 6.626941e-001, 6.635232e-001, 6.643522e-001, 6.651813e-001, 6.660104e-001, 6.668395e-001, 6.676674e-001,
+6.684942e-001, 6.693210e-001, 6.701478e-001, 6.709745e-001, 6.718013e-001, 6.726281e-001, 6.734549e-001, 6.742824e-001, 6.751113e-001, 6.759403e-001,
+6.767693e-001, 6.775983e-001, 6.784273e-001, 6.792562e-001, 6.800852e-001, 6.809142e-001, 6.817373e-001, 6.825604e-001, 6.833835e-001, 6.842065e-001,
+6.850296e-001, 6.858527e-001, 6.866758e-001, 6.874988e-001, 6.883147e-001, 6.891244e-001, 6.899341e-001, 6.907438e-001, 6.915535e-001, 6.923632e-001,
+6.931729e-001, 6.939826e-001, 6.947923e-001, 6.955934e-001, 6.963940e-001, 6.971947e-001, 6.979954e-001, 6.987961e-001, 6.995967e-001, 7.003974e-001,
+7.011981e-001, 7.019976e-001, 7.027937e-001, 7.035898e-001, 7.043859e-001, 7.051819e-001, 7.059780e-001, 7.067741e-001, 7.075702e-001, 7.083663e-001,
+7.091623e-001, 7.099583e-001, 7.107542e-001, 7.115502e-001, 7.123462e-001, 7.131421e-001, 7.139381e-001, 7.147340e-001, 7.155300e-001, 7.163278e-001,
+7.171277e-001, 7.179277e-001, 7.187277e-001, 7.195277e-001, 7.203276e-001, 7.211276e-001, 7.219276e-001, 7.227276e-001, 7.235244e-001, 7.243157e-001,
+7.251069e-001, 7.258981e-001, 7.266893e-001, 7.274806e-001, 7.282718e-001, 7.290630e-001, 7.298542e-001, 7.306442e-001, 7.314252e-001, 7.322061e-001,
+7.329870e-001, 7.337679e-001, 7.345489e-001, 7.353298e-001, 7.361107e-001, 7.368917e-001, 7.376726e-001, 7.384490e-001, 7.392238e-001, 7.399986e-001,
+7.407734e-001, 7.415482e-001, 7.423230e-001, 7.430978e-001, 7.438726e-001, 7.446474e-001, 7.454218e-001, 7.461948e-001, 7.469678e-001, 7.477408e-001,
+7.485138e-001, 7.492868e-001, 7.500599e-001, 7.508329e-001, 7.516059e-001, 7.523789e-001, 7.531532e-001, 7.539284e-001, 7.547037e-001, 7.554790e-001,
+7.562542e-001, 7.570295e-001, 7.578048e-001, 7.585800e-001, 7.593553e-001, 7.601305e-001, 7.609026e-001, 7.616737e-001, 7.624449e-001, 7.632160e-001,
+7.639871e-001, 7.647583e-001, 7.655294e-001, 7.663005e-001, 7.670717e-001, 7.678428e-001, 7.686049e-001, 7.693650e-001, 7.701252e-001, 7.708853e-001,
+7.716455e-001, 7.724056e-001, 7.731658e-001, 7.739259e-001, 7.746860e-001, 7.754462e-001, 7.762012e-001, 7.769543e-001, 7.777075e-001, 7.784606e-001,
+7.792137e-001, 7.799668e-001, 7.807199e-001, 7.814730e-001, 7.822262e-001, 7.829793e-001, 7.837310e-001, 7.844812e-001, 7.852314e-001, 7.859816e-001,
+7.867318e-001, 7.874820e-001, 7.882322e-001, 7.889824e-001, 7.897326e-001, 7.904828e-001, 7.912326e-001, 7.919784e-001, 7.927242e-001, 7.934700e-001,
+7.942158e-001, 7.949616e-001, 7.957074e-001, 7.964532e-001, 7.971989e-001, 7.979447e-001, 7.986905e-001, 7.994338e-001, 8.001748e-001, 8.009158e-001,
+8.016568e-001, 8.023978e-001, 8.031388e-001, 8.038798e-001, 8.046207e-001, 8.053617e-001, 8.061027e-001, 8.068437e-001, 8.075804e-001, 8.083160e-001,
+8.090517e-001, 8.097873e-001, 8.105230e-001, 8.112586e-001, 8.119943e-001, 8.127299e-001, 8.134656e-001, 8.142012e-001, 8.149369e-001, 8.156663e-001,
+8.163954e-001, 8.171245e-001, 8.178536e-001, 8.185827e-001, 8.193117e-001, 8.200408e-001, 8.207699e-001, 8.214990e-001, 8.222281e-001, 8.229571e-001,
+8.236837e-001, 8.244099e-001, 8.251362e-001, 8.258624e-001, 8.265887e-001, 8.273149e-001, 8.280412e-001, 8.287674e-001, 8.294937e-001, 8.302199e-001,
+8.309462e-001, 8.316696e-001, 8.323918e-001, 8.331140e-001, 8.338362e-001, 8.345585e-001, 8.352807e-001, 8.360029e-001, 8.367251e-001, 8.374474e-001,
+8.381696e-001, 8.388918e-001, 8.396125e-001, 8.403300e-001, 8.410476e-001, 8.417651e-001, 8.424827e-001, 8.432003e-001, 8.439178e-001, 8.446354e-001,
+8.453529e-001, 8.460705e-001, 8.467881e-001, 8.475056e-001, 8.482187e-001, 8.489307e-001, 8.496427e-001, 8.503547e-001, 8.510667e-001, 8.517787e-001,
+8.524907e-001, 8.532027e-001, 8.539147e-001, 8.546267e-001, 8.553387e-001, 8.560501e-001, 8.567556e-001, 8.574610e-001, 8.581665e-001, 8.588719e-001,
+8.595774e-001, 8.602828e-001, 8.609883e-001, 8.616937e-001, 8.623992e-001, 8.631046e-001, 8.638101e-001, 8.645150e-001, 8.652177e-001, 8.659205e-001,
+8.666232e-001, 8.673259e-001, 8.680287e-001, 8.687314e-001, 8.694342e-001, 8.701369e-001, 8.708396e-001, 8.715424e-001, 8.722451e-001, 8.729473e-001,
+8.736460e-001, 8.743448e-001, 8.750435e-001, 8.757423e-001, 8.764410e-001, 8.771397e-001, 8.778385e-001, 8.785372e-001, 8.792360e-001, 8.799347e-001,
+8.806334e-001, 8.813322e-001, 8.820267e-001, 8.827208e-001, 8.834148e-001, 8.841089e-001, 8.848030e-001, 8.854970e-001, 8.861911e-001, 8.868852e-001,
+8.875792e-001, 8.882733e-001, 8.889673e-001, 8.896614e-001, 8.903554e-001, 8.910494e-001, 8.917434e-001, 8.924374e-001, 8.931314e-001, 8.938253e-001,
+8.945193e-001, 8.952133e-001, 8.959073e-001, 8.966013e-001, 8.972952e-001, 8.979892e-001, 8.986832e-001, 8.993654e-001, 9.000457e-001, 9.007260e-001,
+9.014064e-001, 9.020867e-001, 9.027670e-001, 9.034473e-001, 9.041276e-001, 9.048080e-001, 9.054883e-001, 9.061686e-001, 9.068489e-001, 9.075281e-001,
+9.081909e-001, 9.088537e-001, 9.095164e-001, 9.101792e-001, 9.108420e-001, 9.115047e-001, 9.121675e-001, 9.128303e-001, 9.134931e-001, 9.141558e-001,
+9.148186e-001, 9.154814e-001, 9.161438e-001, 9.168016e-001, 9.174593e-001, 9.181171e-001, 9.187749e-001, 9.194326e-001, 9.200904e-001, 9.207481e-001,
+9.214059e-001, 9.220637e-001, 9.227214e-001, 9.233792e-001, 9.240370e-001, 9.246947e-001, 9.253485e-001, 9.260017e-001, 9.266550e-001, 9.273082e-001,
+9.279615e-001, 9.286147e-001, 9.292680e-001, 9.299212e-001, 9.305745e-001, 9.312277e-001, 9.318810e-001, 9.325342e-001, 9.331875e-001, 9.338380e-001,
+9.344857e-001, 9.351335e-001, 9.357813e-001, 9.364291e-001, 9.370768e-001, 9.377246e-001, 9.383724e-001, 9.390202e-001, 9.396680e-001, 9.403157e-001,
+9.409635e-001, 9.416113e-001, 9.422591e-001, 9.428948e-001, 9.435295e-001, 9.441642e-001, 9.447989e-001, 9.454336e-001, 9.460684e-001, 9.467031e-001,
+9.473378e-001, 9.479725e-001, 9.486072e-001, 9.492420e-001, 9.498767e-001, 9.505114e-001, 9.511443e-001, 9.517664e-001, 9.523884e-001, 9.530104e-001,
+9.536325e-001, 9.542545e-001, 9.548765e-001, 9.554986e-001, 9.561206e-001, 9.567426e-001, 9.573647e-001, 9.579867e-001, 9.586087e-001, 9.592307e-001,
+9.598506e-001, 9.604583e-001, 9.610659e-001, 9.616736e-001, 9.622812e-001, 9.628889e-001, 9.634965e-001, 9.641042e-001, 9.647119e-001, 9.653195e-001,
+9.659272e-001, 9.665348e-001, 9.671425e-001, 9.677501e-001, 9.683578e-001, 9.689435e-001, 9.695281e-001, 9.701127e-001, 9.706972e-001, 9.712818e-001,
+9.718664e-001, 9.724510e-001, 9.730356e-001, 9.736202e-001, 9.742048e-001, 9.747893e-001, 9.753739e-001, 9.759585e-001, 9.765431e-001, 9.771106e-001,
+9.776637e-001, 9.782167e-001, 9.787697e-001, 9.793227e-001, 9.798758e-001, 9.804288e-001, 9.809818e-001, 9.815348e-001, 9.820878e-001, 9.826409e-001,
+9.831939e-001, 9.837469e-001, 9.842999e-001, 9.848530e-001, 9.853777e-001, 9.858997e-001, 9.864217e-001, 9.869437e-001, 9.874657e-001, 9.879877e-001,
+9.885097e-001, 9.890318e-001, 9.895538e-001, 9.900758e-001, 9.905978e-001, 9.911198e-001, 9.916418e-001, 9.921638e-001, 9.926835e-001, 9.931713e-001,
+9.936591e-001, 9.941468e-001, 9.946346e-001, 9.951224e-001, 9.956101e-001, 9.960979e-001, 9.965857e-001, 9.970734e-001, 9.975612e-001, 9.980489e-001,
+9.985367e-001, 9.990245e-001, 9.995122e-001, 1.000000e+000)),
+("Kodak", "DSCS 3151", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.720476e-003, 7.440952e-003, 1.121081e-002, 1.508948e-002, 1.896815e-002, 2.294561e-002, 2.695888e-002, 3.099820e-002, 3.511900e-002,
+3.923981e-002, 4.342441e-002, 4.762345e-002, 5.184339e-002, 5.609059e-002, 6.033927e-002, 6.460518e-002, 6.887109e-002, 7.313049e-002, 7.738755e-002,
+8.163166e-002, 8.585520e-002, 9.007771e-002, 9.424656e-002, 9.841542e-002, 1.025396e-001, 1.066365e-001, 1.107180e-001, 1.147294e-001, 1.187408e-001,
+1.226869e-001, 1.266030e-001, 1.305056e-001, 1.343199e-001, 1.381342e-001, 1.418947e-001, 1.456035e-001, 1.493123e-001, 1.529341e-001, 1.565361e-001,
+1.601340e-001, 1.636297e-001, 1.671254e-001, 1.706027e-001, 1.739942e-001, 1.773857e-001, 1.807541e-001, 1.840446e-001, 1.873351e-001, 1.906071e-001,
+1.938005e-001, 1.969940e-001, 2.001820e-001, 2.032829e-001, 2.063837e-001, 2.094846e-001, 2.125124e-001, 2.155256e-001, 2.185387e-001, 2.215093e-001,
+2.244399e-001, 2.273704e-001, 2.302929e-001, 2.331458e-001, 2.359987e-001, 2.388516e-001, 2.416612e-001, 2.444416e-001, 2.472219e-001, 2.500022e-001,
+2.527150e-001, 2.554277e-001, 2.581404e-001, 2.608334e-001, 2.634832e-001, 2.661331e-001, 2.687830e-001, 2.714013e-001, 2.739929e-001, 2.765845e-001,
+2.791760e-001, 2.817308e-001, 2.842685e-001, 2.868061e-001, 2.893437e-001, 2.918445e-001, 2.943323e-001, 2.968201e-001, 2.993079e-001, 3.017626e-001,
+3.042045e-001, 3.066464e-001, 3.090883e-001, 3.115036e-001, 3.139032e-001, 3.163028e-001, 3.187024e-001, 3.210841e-001, 3.234448e-001, 3.258055e-001,
+3.281662e-001, 3.305189e-001, 3.328438e-001, 3.351687e-001, 3.374936e-001, 3.398185e-001, 3.421131e-001, 3.444052e-001, 3.466972e-001, 3.489892e-001,
+3.512643e-001, 3.535261e-001, 3.557879e-001, 3.580497e-001, 3.603077e-001, 3.625417e-001, 3.647756e-001, 3.670096e-001, 3.692435e-001, 3.714605e-001,
+3.736688e-001, 3.758770e-001, 3.780853e-001, 3.802904e-001, 3.824749e-001, 3.846593e-001, 3.868438e-001, 3.890283e-001, 3.912005e-001, 3.933628e-001,
+3.955251e-001, 3.976874e-001, 3.998498e-001, 4.019928e-001, 4.041343e-001, 4.062759e-001, 4.084175e-001, 4.105539e-001, 4.126758e-001, 4.147978e-001,
+4.169197e-001, 4.190416e-001, 4.211533e-001, 4.232564e-001, 4.253596e-001, 4.274627e-001, 4.295659e-001, 4.316546e-001, 4.337396e-001, 4.358245e-001,
+4.379095e-001, 4.399944e-001, 4.420616e-001, 4.441287e-001, 4.461957e-001, 4.482628e-001, 4.503270e-001, 4.523763e-001, 4.544255e-001, 4.564747e-001,
+4.585239e-001, 4.605681e-001, 4.625991e-001, 4.646302e-001, 4.666613e-001, 4.686924e-001, 4.707168e-001, 4.727293e-001, 4.747417e-001, 4.767541e-001,
+4.787665e-001, 4.807713e-001, 4.827642e-001, 4.847571e-001, 4.867500e-001, 4.887428e-001, 4.907281e-001, 4.927003e-001, 4.946726e-001, 4.966448e-001,
+4.986170e-001, 5.005826e-001, 5.025328e-001, 5.044830e-001, 5.064331e-001, 5.083833e-001, 5.103294e-001, 5.122558e-001, 5.141823e-001, 5.161087e-001,
+5.180351e-001, 5.199616e-001, 5.218629e-001, 5.237637e-001, 5.256645e-001, 5.275653e-001, 5.294661e-001, 5.313469e-001, 5.332200e-001, 5.350930e-001,
+5.369661e-001, 5.388391e-001, 5.407007e-001, 5.425437e-001, 5.443867e-001, 5.462297e-001, 5.480727e-001, 5.499156e-001, 5.517276e-001, 5.535381e-001,
+5.553485e-001, 5.571590e-001, 5.589695e-001, 5.607649e-001, 5.625403e-001, 5.643157e-001, 5.660911e-001, 5.678665e-001, 5.696419e-001, 5.713873e-001,
+5.731251e-001, 5.748629e-001, 5.766006e-001, 5.783384e-001, 5.800744e-001, 5.817720e-001, 5.834695e-001, 5.851671e-001, 5.868647e-001, 5.885622e-001,
+5.902532e-001, 5.919081e-001, 5.935629e-001, 5.952177e-001, 5.968725e-001, 5.985273e-001, 6.001772e-001, 6.017869e-001, 6.033966e-001, 6.050063e-001,
+6.066160e-001, 6.082256e-001, 6.098353e-001, 6.114025e-001, 6.129649e-001, 6.145272e-001, 6.160896e-001, 6.176519e-001, 6.192143e-001, 6.207521e-001,
+6.222651e-001, 6.237781e-001, 6.252911e-001, 6.268041e-001, 6.283171e-001, 6.298301e-001, 6.312978e-001, 6.327597e-001, 6.342217e-001, 6.356836e-001,
+6.371456e-001, 6.386075e-001, 6.400670e-001, 6.414764e-001, 6.428859e-001, 6.442953e-001, 6.457048e-001, 6.471143e-001, 6.485237e-001, 6.499332e-001,
+6.512916e-001, 6.526475e-001, 6.540034e-001, 6.553593e-001, 6.567151e-001, 6.580710e-001, 6.594269e-001, 6.607514e-001, 6.620530e-001, 6.633546e-001,
+6.646561e-001, 6.659577e-001, 6.672592e-001, 6.685608e-001, 6.698624e-001, 6.711150e-001, 6.723618e-001, 6.736087e-001, 6.748555e-001, 6.761023e-001,
+6.773492e-001, 6.785960e-001, 6.798429e-001, 6.810418e-001, 6.822339e-001, 6.834260e-001, 6.846180e-001, 6.858101e-001, 6.870022e-001, 6.881942e-001,
+6.893863e-001, 6.905519e-001, 6.916895e-001, 6.928271e-001, 6.939646e-001, 6.951022e-001, 6.962398e-001, 6.973774e-001, 6.985149e-001, 6.996525e-001,
+7.007526e-001, 7.018363e-001, 7.029200e-001, 7.040036e-001, 7.050873e-001, 7.061710e-001, 7.072547e-001, 7.083383e-001, 7.094220e-001, 7.104809e-001,
+7.115116e-001, 7.125422e-001, 7.135729e-001, 7.146035e-001, 7.156342e-001, 7.166648e-001, 7.176955e-001, 7.187261e-001, 7.197567e-001, 7.207477e-001,
+7.217265e-001, 7.227052e-001, 7.236840e-001, 7.246628e-001, 7.256415e-001, 7.266203e-001, 7.275990e-001, 7.285778e-001, 7.295565e-001, 7.305076e-001,
+7.314358e-001, 7.323640e-001, 7.332922e-001, 7.342204e-001, 7.351486e-001, 7.360769e-001, 7.370051e-001, 7.379333e-001, 7.388615e-001, 7.397897e-001,
+7.406800e-001, 7.415592e-001, 7.424384e-001, 7.433176e-001, 7.441967e-001, 7.450759e-001, 7.459551e-001, 7.468343e-001, 7.477135e-001, 7.485927e-001,
+7.494719e-001, 7.503322e-001, 7.511641e-001, 7.519959e-001, 7.528278e-001, 7.536597e-001, 7.544915e-001, 7.553234e-001, 7.561553e-001, 7.569871e-001,
+7.578190e-001, 7.586508e-001, 7.594827e-001, 7.602974e-001, 7.610837e-001, 7.618700e-001, 7.626563e-001, 7.634427e-001, 7.642290e-001, 7.650153e-001,
+7.658017e-001, 7.665880e-001, 7.673743e-001, 7.681607e-001, 7.689470e-001, 7.697333e-001, 7.704908e-001, 7.712335e-001, 7.719762e-001, 7.727188e-001,
+7.734615e-001, 7.742042e-001, 7.749469e-001, 7.756895e-001, 7.764322e-001, 7.771749e-001, 7.779176e-001, 7.786602e-001, 7.794029e-001, 7.801374e-001,
+7.808384e-001, 7.815393e-001, 7.822403e-001, 7.829412e-001, 7.836422e-001, 7.843431e-001, 7.850441e-001, 7.857451e-001, 7.864460e-001, 7.871470e-001,
+7.878479e-001, 7.885489e-001, 7.892498e-001, 7.899508e-001, 7.906148e-001, 7.912760e-001, 7.919371e-001, 7.925983e-001, 7.932595e-001, 7.939207e-001,
+7.945819e-001, 7.952431e-001, 7.959043e-001, 7.965655e-001, 7.972267e-001, 7.978879e-001, 7.985491e-001, 7.992103e-001, 7.998715e-001, 8.005022e-001,
+8.011256e-001, 8.017490e-001, 8.023724e-001, 8.029958e-001, 8.036192e-001, 8.042425e-001, 8.048659e-001, 8.054893e-001, 8.061127e-001, 8.067361e-001,
+8.073595e-001, 8.079829e-001, 8.086063e-001, 8.092297e-001, 8.098531e-001, 8.104491e-001, 8.110366e-001, 8.116241e-001, 8.122117e-001, 8.127992e-001,
+8.133868e-001, 8.139743e-001, 8.145618e-001, 8.151494e-001, 8.157369e-001, 8.163245e-001, 8.169120e-001, 8.174995e-001, 8.180871e-001, 8.186746e-001,
+8.192622e-001, 8.198497e-001, 8.204120e-001, 8.209656e-001, 8.215192e-001, 8.220728e-001, 8.226264e-001, 8.231800e-001, 8.237336e-001, 8.242872e-001,
+8.248408e-001, 8.253944e-001, 8.259480e-001, 8.265016e-001, 8.270552e-001, 8.276088e-001, 8.281624e-001, 8.287160e-001, 8.292696e-001, 8.298232e-001,
+8.303550e-001, 8.308765e-001, 8.313980e-001, 8.319196e-001, 8.324411e-001, 8.329626e-001, 8.334841e-001, 8.340057e-001, 8.345272e-001, 8.350487e-001,
+8.355703e-001, 8.360918e-001, 8.366133e-001, 8.371349e-001, 8.376564e-001, 8.381779e-001, 8.386995e-001, 8.392210e-001, 8.397425e-001, 8.402487e-001,
+8.407400e-001, 8.412313e-001, 8.417226e-001, 8.422138e-001, 8.427051e-001, 8.431964e-001, 8.436876e-001, 8.441789e-001, 8.446702e-001, 8.451615e-001,
+8.456527e-001, 8.461440e-001, 8.466353e-001, 8.471266e-001, 8.476178e-001, 8.481091e-001, 8.486004e-001, 8.490916e-001, 8.495829e-001, 8.500699e-001,
+8.505327e-001, 8.509954e-001, 8.514582e-001, 8.519209e-001, 8.523837e-001, 8.528465e-001, 8.533092e-001, 8.537720e-001, 8.542348e-001, 8.546975e-001,
+8.551603e-001, 8.556230e-001, 8.560858e-001, 8.565486e-001, 8.570113e-001, 8.574741e-001, 8.579369e-001, 8.583996e-001, 8.588624e-001, 8.593252e-001,
+8.597879e-001, 8.602361e-001, 8.606721e-001, 8.611080e-001, 8.615439e-001, 8.619799e-001, 8.624158e-001, 8.628517e-001, 8.632877e-001, 8.637236e-001,
+8.641595e-001, 8.645955e-001, 8.650314e-001, 8.654673e-001, 8.659032e-001, 8.663392e-001, 8.667751e-001, 8.672110e-001, 8.676470e-001, 8.680829e-001,
+8.685188e-001, 8.689548e-001, 8.693907e-001, 8.698266e-001, 8.702474e-001, 8.706581e-001, 8.710688e-001, 8.714795e-001, 8.718902e-001, 8.723009e-001,
+8.727116e-001, 8.731223e-001, 8.735330e-001, 8.739437e-001, 8.743544e-001, 8.747651e-001, 8.751758e-001, 8.755865e-001, 8.759972e-001, 8.764079e-001,
+8.768186e-001, 8.772293e-001, 8.776400e-001, 8.780507e-001, 8.784614e-001, 8.788721e-001, 8.792828e-001, 8.796935e-001, 8.800982e-001, 8.804852e-001,
+8.808722e-001, 8.812592e-001, 8.816462e-001, 8.820331e-001, 8.824201e-001, 8.828071e-001, 8.831941e-001, 8.835811e-001, 8.839681e-001, 8.843551e-001,
+8.847421e-001, 8.851291e-001, 8.855161e-001, 8.859031e-001, 8.862901e-001, 8.866771e-001, 8.870641e-001, 8.874511e-001, 8.878381e-001, 8.882251e-001,
+8.886121e-001, 8.889991e-001, 8.893861e-001, 8.897731e-001, 8.901509e-001, 8.905156e-001, 8.908804e-001, 8.912451e-001, 8.916099e-001, 8.919746e-001,
+8.923393e-001, 8.927041e-001, 8.930688e-001, 8.934336e-001, 8.937983e-001, 8.941631e-001, 8.945278e-001, 8.948925e-001, 8.952573e-001, 8.956220e-001,
+8.959868e-001, 8.963515e-001, 8.967162e-001, 8.970810e-001, 8.974457e-001, 8.978105e-001, 8.981752e-001, 8.985400e-001, 8.989047e-001, 8.992694e-001,
+8.996342e-001, 8.999989e-001, 9.003428e-001, 9.006867e-001, 9.010306e-001, 9.013744e-001, 9.017183e-001, 9.020621e-001, 9.024060e-001, 9.027499e-001,
+9.030937e-001, 9.034376e-001, 9.037814e-001, 9.041253e-001, 9.044692e-001, 9.048130e-001, 9.051569e-001, 9.055007e-001, 9.058446e-001, 9.061884e-001,
+9.065323e-001, 9.068762e-001, 9.072200e-001, 9.075639e-001, 9.079077e-001, 9.082516e-001, 9.085955e-001, 9.089393e-001, 9.092832e-001, 9.096270e-001,
+9.099709e-001, 9.102968e-001, 9.106211e-001, 9.109454e-001, 9.112696e-001, 9.115939e-001, 9.119182e-001, 9.122424e-001, 9.125667e-001, 9.128910e-001,
+9.132152e-001, 9.135395e-001, 9.138638e-001, 9.141880e-001, 9.145123e-001, 9.148366e-001, 9.151609e-001, 9.154851e-001, 9.158094e-001, 9.161337e-001,
+9.164579e-001, 9.167822e-001, 9.171065e-001, 9.174307e-001, 9.177550e-001, 9.180793e-001, 9.184035e-001, 9.187278e-001, 9.190521e-001, 9.193764e-001,
+9.197006e-001, 9.200235e-001, 9.203294e-001, 9.206353e-001, 9.209412e-001, 9.212471e-001, 9.215530e-001, 9.218589e-001, 9.221648e-001, 9.224707e-001,
+9.227766e-001, 9.230825e-001, 9.233884e-001, 9.236943e-001, 9.240002e-001, 9.243061e-001, 9.246120e-001, 9.249179e-001, 9.252238e-001, 9.255297e-001,
+9.258356e-001, 9.261415e-001, 9.264474e-001, 9.267533e-001, 9.270592e-001, 9.273651e-001, 9.276710e-001, 9.279769e-001, 9.282828e-001, 9.285887e-001,
+9.288946e-001, 9.292005e-001, 9.295064e-001, 9.298123e-001, 9.301115e-001, 9.304002e-001, 9.306889e-001, 9.309776e-001, 9.312662e-001, 9.315549e-001,
+9.318436e-001, 9.321323e-001, 9.324209e-001, 9.327096e-001, 9.329983e-001, 9.332870e-001, 9.335757e-001, 9.338643e-001, 9.341530e-001, 9.344417e-001,
+9.347304e-001, 9.350190e-001, 9.353077e-001, 9.355964e-001, 9.358851e-001, 9.361738e-001, 9.364624e-001, 9.367511e-001, 9.370398e-001, 9.373285e-001,
+9.376172e-001, 9.379058e-001, 9.381945e-001, 9.384832e-001, 9.387719e-001, 9.390605e-001, 9.393492e-001, 9.396379e-001, 9.399266e-001, 9.402032e-001,
+9.404757e-001, 9.407483e-001, 9.410208e-001, 9.412933e-001, 9.415659e-001, 9.418384e-001, 9.421109e-001, 9.423835e-001, 9.426560e-001, 9.429286e-001,
+9.432011e-001, 9.434736e-001, 9.437462e-001, 9.440187e-001, 9.442912e-001, 9.445638e-001, 9.448363e-001, 9.451088e-001, 9.453814e-001, 9.456539e-001,
+9.459264e-001, 9.461990e-001, 9.464715e-001, 9.467440e-001, 9.470166e-001, 9.472891e-001, 9.475616e-001, 9.478342e-001, 9.481067e-001, 9.483792e-001,
+9.486518e-001, 9.489243e-001, 9.491968e-001, 9.494694e-001, 9.497419e-001, 9.500136e-001, 9.502710e-001, 9.505284e-001, 9.507858e-001, 9.510432e-001,
+9.513006e-001, 9.515580e-001, 9.518154e-001, 9.520728e-001, 9.523302e-001, 9.525876e-001, 9.528450e-001, 9.531024e-001, 9.533598e-001, 9.536172e-001,
+9.538746e-001, 9.541320e-001, 9.543894e-001, 9.546468e-001, 9.549042e-001, 9.551616e-001, 9.554190e-001, 9.556764e-001, 9.559338e-001, 9.561912e-001,
+9.564486e-001, 9.567060e-001, 9.569634e-001, 9.572208e-001, 9.574782e-001, 9.577356e-001, 9.579930e-001, 9.582504e-001, 9.585078e-001, 9.587652e-001,
+9.590226e-001, 9.592800e-001, 9.595374e-001, 9.597948e-001, 9.600494e-001, 9.602926e-001, 9.605358e-001, 9.607790e-001, 9.610222e-001, 9.612654e-001,
+9.615086e-001, 9.617518e-001, 9.619951e-001, 9.622383e-001, 9.624815e-001, 9.627247e-001, 9.629679e-001, 9.632111e-001, 9.634543e-001, 9.636976e-001,
+9.639408e-001, 9.641840e-001, 9.644272e-001, 9.646704e-001, 9.649136e-001, 9.651568e-001, 9.654001e-001, 9.656433e-001, 9.658865e-001, 9.661297e-001,
+9.663729e-001, 9.666161e-001, 9.668593e-001, 9.671025e-001, 9.673458e-001, 9.675890e-001, 9.678322e-001, 9.680754e-001, 9.683186e-001, 9.685618e-001,
+9.688050e-001, 9.690483e-001, 9.692915e-001, 9.695347e-001, 9.697779e-001, 9.700200e-001, 9.702499e-001, 9.704798e-001, 9.707097e-001, 9.709396e-001,
+9.711695e-001, 9.713994e-001, 9.716294e-001, 9.718593e-001, 9.720892e-001, 9.723191e-001, 9.725490e-001, 9.727789e-001, 9.730088e-001, 9.732388e-001,
+9.734687e-001, 9.736986e-001, 9.739285e-001, 9.741584e-001, 9.743883e-001, 9.746182e-001, 9.748481e-001, 9.750781e-001, 9.753080e-001, 9.755379e-001,
+9.757678e-001, 9.759977e-001, 9.762276e-001, 9.764575e-001, 9.766875e-001, 9.769174e-001, 9.771473e-001, 9.773772e-001, 9.776071e-001, 9.778370e-001,
+9.780669e-001, 9.782969e-001, 9.785268e-001, 9.787567e-001, 9.789866e-001, 9.792165e-001, 9.794464e-001, 9.796763e-001, 9.799063e-001, 9.801288e-001,
+9.803462e-001, 9.805637e-001, 9.807811e-001, 9.809986e-001, 9.812160e-001, 9.814334e-001, 9.816509e-001, 9.818683e-001, 9.820858e-001, 9.823032e-001,
+9.825207e-001, 9.827381e-001, 9.829555e-001, 9.831730e-001, 9.833904e-001, 9.836079e-001, 9.838253e-001, 9.840428e-001, 9.842602e-001, 9.844776e-001,
+9.846951e-001, 9.849125e-001, 9.851300e-001, 9.853474e-001, 9.855649e-001, 9.857823e-001, 9.859997e-001, 9.862172e-001, 9.864346e-001, 9.866521e-001,
+9.868695e-001, 9.870870e-001, 9.873044e-001, 9.875218e-001, 9.877393e-001, 9.879567e-001, 9.881742e-001, 9.883916e-001, 9.886091e-001, 9.888265e-001,
+9.890439e-001, 9.892614e-001, 9.894788e-001, 9.896963e-001, 9.899137e-001, 9.901241e-001, 9.903299e-001, 9.905356e-001, 9.907414e-001, 9.909471e-001,
+9.911528e-001, 9.913586e-001, 9.915643e-001, 9.917701e-001, 9.919758e-001, 9.921816e-001, 9.923873e-001, 9.925931e-001, 9.927988e-001, 9.930046e-001,
+9.932103e-001, 9.934161e-001, 9.936218e-001, 9.938276e-001, 9.940333e-001, 9.942391e-001, 9.944448e-001, 9.946506e-001, 9.948563e-001, 9.950621e-001,
+9.952678e-001, 9.954735e-001, 9.956793e-001, 9.958850e-001, 9.960908e-001, 9.962965e-001, 9.965023e-001, 9.967080e-001, 9.969138e-001, 9.971195e-001,
+9.973253e-001, 9.975310e-001, 9.977368e-001, 9.979425e-001, 9.981483e-001, 9.983540e-001, 9.985598e-001, 9.987655e-001, 9.989713e-001, 9.991770e-001,
+9.993828e-001, 9.995885e-001, 9.997943e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.997109e-003, 5.994218e-003, 8.991328e-003, 1.218374e-002, 1.547522e-002, 1.876670e-002, 2.224669e-002, 2.583963e-002, 2.943257e-002,
+3.327787e-002, 3.717049e-002, 4.114150e-002, 4.532113e-002, 4.950076e-002, 5.391126e-002, 5.835308e-002, 6.293661e-002, 6.760364e-002, 7.235712e-002,
+7.720183e-002, 8.209834e-002, 8.706567e-002, 9.205927e-002, 9.709077e-002, 1.021251e-001, 1.071634e-001, 1.121816e-001, 1.171742e-001, 1.221275e-001,
+1.270297e-001, 1.318825e-001, 1.366591e-001, 1.413904e-001, 1.460159e-001, 1.506181e-001, 1.550759e-001, 1.595336e-001, 1.638332e-001, 1.681144e-001,
+1.722953e-001, 1.763972e-001, 1.804776e-001, 1.844026e-001, 1.883275e-001, 1.921540e-001, 1.959076e-001, 1.996611e-001, 2.032658e-001, 2.068559e-001,
+2.104267e-001, 2.138626e-001, 2.172985e-001, 2.207036e-001, 2.239954e-001, 2.272873e-001, 2.305556e-001, 2.337139e-001, 2.368721e-001, 2.400291e-001,
+2.430640e-001, 2.460989e-001, 2.491338e-001, 2.520878e-001, 2.550094e-001, 2.579310e-001, 2.608224e-001, 2.636403e-001, 2.664583e-001, 2.692762e-001,
+2.720238e-001, 2.747471e-001, 2.774705e-001, 2.801877e-001, 2.828249e-001, 2.854621e-001, 2.880993e-001, 2.907147e-001, 2.932738e-001, 2.958329e-001,
+2.983919e-001, 3.009247e-001, 3.034130e-001, 3.059013e-001, 3.083896e-001, 3.108553e-001, 3.132797e-001, 3.157040e-001, 3.181284e-001, 3.205396e-001,
+3.229064e-001, 3.252731e-001, 3.276399e-001, 3.300065e-001, 3.323215e-001, 3.346365e-001, 3.369515e-001, 3.392665e-001, 3.415498e-001, 3.438184e-001,
+3.460870e-001, 3.483556e-001, 3.506128e-001, 3.528400e-001, 3.550672e-001, 3.572943e-001, 3.595215e-001, 3.617198e-001, 3.639101e-001, 3.661004e-001,
+3.682907e-001, 3.704739e-001, 3.726315e-001, 3.747891e-001, 3.769468e-001, 3.791044e-001, 3.812451e-001, 3.833739e-001, 3.855027e-001, 3.876315e-001,
+3.897602e-001, 3.918665e-001, 3.939699e-001, 3.960733e-001, 3.981767e-001, 4.002771e-001, 4.023583e-001, 4.044394e-001, 4.065206e-001, 4.086017e-001,
+4.106765e-001, 4.127383e-001, 4.148001e-001, 4.168618e-001, 4.189236e-001, 4.209773e-001, 4.230221e-001, 4.250670e-001, 4.271118e-001, 4.291567e-001,
+4.311929e-001, 4.332231e-001, 4.352532e-001, 4.372834e-001, 4.393135e-001, 4.413351e-001, 4.433524e-001, 4.453697e-001, 4.473870e-001, 4.494043e-001,
+4.514135e-001, 4.534195e-001, 4.554254e-001, 4.574314e-001, 4.594373e-001, 4.614359e-001, 4.634317e-001, 4.654274e-001, 4.674232e-001, 4.694189e-001,
+4.714081e-001, 4.733944e-001, 4.753808e-001, 4.773672e-001, 4.793536e-001, 4.813339e-001, 4.833113e-001, 4.852887e-001, 4.872662e-001, 4.892436e-001,
+4.912155e-001, 4.931839e-001, 4.951524e-001, 4.971209e-001, 4.990893e-001, 5.010528e-001, 5.030119e-001, 5.049710e-001, 5.069301e-001, 5.088893e-001,
+5.108440e-001, 5.127929e-001, 5.147418e-001, 5.166908e-001, 5.186397e-001, 5.205851e-001, 5.225226e-001, 5.244600e-001, 5.263975e-001, 5.283349e-001,
+5.302705e-001, 5.321948e-001, 5.341190e-001, 5.360433e-001, 5.379675e-001, 5.398917e-001, 5.418014e-001, 5.437103e-001, 5.456191e-001, 5.475279e-001,
+5.494368e-001, 5.513329e-001, 5.532237e-001, 5.551146e-001, 5.570054e-001, 5.588962e-001, 5.607783e-001, 5.626481e-001, 5.645178e-001, 5.663876e-001,
+5.682574e-001, 5.701255e-001, 5.719709e-001, 5.738162e-001, 5.756616e-001, 5.775070e-001, 5.793523e-001, 5.811794e-001, 5.829967e-001, 5.848139e-001,
+5.866312e-001, 5.884484e-001, 5.902610e-001, 5.920462e-001, 5.938314e-001, 5.956166e-001, 5.974019e-001, 5.991871e-001, 6.009526e-001, 6.027018e-001,
+6.044509e-001, 6.062001e-001, 6.079492e-001, 6.096983e-001, 6.114142e-001, 6.131232e-001, 6.148322e-001, 6.165411e-001, 6.182501e-001, 6.199591e-001,
+6.216249e-001, 6.232897e-001, 6.249545e-001, 6.266192e-001, 6.282840e-001, 6.299488e-001, 6.315670e-001, 6.331837e-001, 6.348005e-001, 6.364172e-001,
+6.380339e-001, 6.396507e-001, 6.412270e-001, 6.427921e-001, 6.443573e-001, 6.459224e-001, 6.474876e-001, 6.490527e-001, 6.505963e-001, 6.521067e-001,
+6.536171e-001, 6.551274e-001, 6.566378e-001, 6.581482e-001, 6.596586e-001, 6.611245e-001, 6.625775e-001, 6.640304e-001, 6.654833e-001, 6.669363e-001,
+6.683892e-001, 6.698421e-001, 6.712419e-001, 6.726352e-001, 6.740285e-001, 6.754219e-001, 6.768152e-001, 6.782085e-001, 6.796018e-001, 6.809514e-001,
+6.822834e-001, 6.836155e-001, 6.849476e-001, 6.862797e-001, 6.876118e-001, 6.889439e-001, 6.902631e-001, 6.915329e-001, 6.928028e-001, 6.940726e-001,
+6.953425e-001, 6.966123e-001, 6.978822e-001, 6.991520e-001, 7.004011e-001, 7.016083e-001, 7.028155e-001, 7.040227e-001, 7.052299e-001, 7.064371e-001,
+7.076443e-001, 7.088515e-001, 7.100557e-001, 7.112004e-001, 7.123451e-001, 7.134898e-001, 7.146345e-001, 7.157792e-001, 7.169239e-001, 7.180686e-001,
+7.192133e-001, 7.203386e-001, 7.214215e-001, 7.225043e-001, 7.235872e-001, 7.246700e-001, 7.257529e-001, 7.268358e-001, 7.279186e-001, 7.290015e-001,
+7.300796e-001, 7.311017e-001, 7.321239e-001, 7.331460e-001, 7.341682e-001, 7.351903e-001, 7.362125e-001, 7.372346e-001, 7.382567e-001, 7.392789e-001,
+7.402836e-001, 7.412466e-001, 7.422095e-001, 7.431725e-001, 7.441355e-001, 7.450984e-001, 7.460614e-001, 7.470243e-001, 7.479873e-001, 7.489503e-001,
+7.499132e-001, 7.508240e-001, 7.517297e-001, 7.526353e-001, 7.535410e-001, 7.544466e-001, 7.553523e-001, 7.562579e-001, 7.571636e-001, 7.580692e-001,
+7.589749e-001, 7.598805e-001, 7.607383e-001, 7.615888e-001, 7.624392e-001, 7.632897e-001, 7.641402e-001, 7.649907e-001, 7.658411e-001, 7.666916e-001,
+7.675421e-001, 7.683925e-001, 7.692430e-001, 7.700877e-001, 7.708853e-001, 7.716829e-001, 7.724806e-001, 7.732782e-001, 7.740758e-001, 7.748735e-001,
+7.756711e-001, 7.764687e-001, 7.772664e-001, 7.780640e-001, 7.788616e-001, 7.796593e-001, 7.804281e-001, 7.811753e-001, 7.819226e-001, 7.826699e-001,
+7.834171e-001, 7.841644e-001, 7.849117e-001, 7.856589e-001, 7.864062e-001, 7.871535e-001, 7.879007e-001, 7.886480e-001, 7.893953e-001, 7.901334e-001,
+7.908329e-001, 7.915324e-001, 7.922318e-001, 7.929313e-001, 7.936308e-001, 7.943303e-001, 7.950297e-001, 7.957292e-001, 7.964287e-001, 7.971281e-001,
+7.978276e-001, 7.985271e-001, 7.992265e-001, 7.999260e-001, 8.005851e-001, 8.012393e-001, 8.018936e-001, 8.025479e-001, 8.032021e-001, 8.038564e-001,
+8.045107e-001, 8.051650e-001, 8.058192e-001, 8.064735e-001, 8.071278e-001, 8.077820e-001, 8.084363e-001, 8.090906e-001, 8.097449e-001, 8.103731e-001,
+8.109848e-001, 8.115965e-001, 8.122082e-001, 8.128198e-001, 8.134315e-001, 8.140432e-001, 8.146548e-001, 8.152665e-001, 8.158782e-001, 8.164898e-001,
+8.171015e-001, 8.177132e-001, 8.183249e-001, 8.189365e-001, 8.195482e-001, 8.201494e-001, 8.207210e-001, 8.212927e-001, 8.218643e-001, 8.224359e-001,
+8.230076e-001, 8.235792e-001, 8.241508e-001, 8.247225e-001, 8.252941e-001, 8.258657e-001, 8.264374e-001, 8.270090e-001, 8.275806e-001, 8.281522e-001,
+8.287239e-001, 8.292955e-001, 8.298671e-001, 8.304100e-001, 8.309440e-001, 8.314781e-001, 8.320122e-001, 8.325463e-001, 8.330804e-001, 8.336145e-001,
+8.341486e-001, 8.346827e-001, 8.352168e-001, 8.357509e-001, 8.362849e-001, 8.368190e-001, 8.373531e-001, 8.378872e-001, 8.384213e-001, 8.389554e-001,
+8.394895e-001, 8.400220e-001, 8.405210e-001, 8.410200e-001, 8.415189e-001, 8.420179e-001, 8.425169e-001, 8.430158e-001, 8.435148e-001, 8.440138e-001,
+8.445127e-001, 8.450117e-001, 8.455106e-001, 8.460096e-001, 8.465086e-001, 8.470075e-001, 8.475065e-001, 8.480055e-001, 8.485044e-001, 8.490034e-001,
+8.495024e-001, 8.500012e-001, 8.504674e-001, 8.509336e-001, 8.513997e-001, 8.518659e-001, 8.523320e-001, 8.527982e-001, 8.532643e-001, 8.537305e-001,
+8.541966e-001, 8.546628e-001, 8.551290e-001, 8.555951e-001, 8.560613e-001, 8.565274e-001, 8.569936e-001, 8.574597e-001, 8.579259e-001, 8.583920e-001,
+8.588582e-001, 8.593244e-001, 8.597905e-001, 8.602398e-001, 8.606754e-001, 8.611109e-001, 8.615465e-001, 8.619820e-001, 8.624176e-001, 8.628532e-001,
+8.632887e-001, 8.637243e-001, 8.641598e-001, 8.645954e-001, 8.650309e-001, 8.654665e-001, 8.659020e-001, 8.663376e-001, 8.667731e-001, 8.672087e-001,
+8.676443e-001, 8.680798e-001, 8.685154e-001, 8.689509e-001, 8.693865e-001, 8.698220e-001, 8.702407e-001, 8.706478e-001, 8.710548e-001, 8.714619e-001,
+8.718689e-001, 8.722760e-001, 8.726830e-001, 8.730901e-001, 8.734971e-001, 8.739041e-001, 8.743112e-001, 8.747182e-001, 8.751253e-001, 8.755323e-001,
+8.759394e-001, 8.763464e-001, 8.767535e-001, 8.771605e-001, 8.775676e-001, 8.779746e-001, 8.783817e-001, 8.787887e-001, 8.791958e-001, 8.796028e-001,
+8.800092e-001, 8.803897e-001, 8.807702e-001, 8.811508e-001, 8.815313e-001, 8.819118e-001, 8.822923e-001, 8.826728e-001, 8.830533e-001, 8.834338e-001,
+8.838144e-001, 8.841949e-001, 8.845754e-001, 8.849559e-001, 8.853364e-001, 8.857169e-001, 8.860974e-001, 8.864779e-001, 8.868585e-001, 8.872390e-001,
+8.876195e-001, 8.880000e-001, 8.883805e-001, 8.887610e-001, 8.891415e-001, 8.895221e-001, 8.899026e-001, 8.902647e-001, 8.906206e-001, 8.909764e-001,
+8.913322e-001, 8.916881e-001, 8.920439e-001, 8.923998e-001, 8.927556e-001, 8.931114e-001, 8.934673e-001, 8.938231e-001, 8.941789e-001, 8.945348e-001,
+8.948906e-001, 8.952464e-001, 8.956023e-001, 8.959581e-001, 8.963140e-001, 8.966698e-001, 8.970256e-001, 8.973815e-001, 8.977373e-001, 8.980931e-001,
+8.984490e-001, 8.988048e-001, 8.991607e-001, 8.995165e-001, 8.998723e-001, 9.002135e-001, 9.005464e-001, 9.008792e-001, 9.012121e-001, 9.015450e-001,
+9.018779e-001, 9.022108e-001, 9.025437e-001, 9.028766e-001, 9.032095e-001, 9.035424e-001, 9.038753e-001, 9.042082e-001, 9.045411e-001, 9.048740e-001,
+9.052069e-001, 9.055398e-001, 9.058727e-001, 9.062056e-001, 9.065385e-001, 9.068714e-001, 9.072043e-001, 9.075372e-001, 9.078701e-001, 9.082030e-001,
+9.085359e-001, 9.088688e-001, 9.092017e-001, 9.095346e-001, 9.098675e-001, 9.101876e-001, 9.104992e-001, 9.108107e-001, 9.111223e-001, 9.114339e-001,
+9.117455e-001, 9.120571e-001, 9.123687e-001, 9.126802e-001, 9.129918e-001, 9.133034e-001, 9.136150e-001, 9.139266e-001, 9.142382e-001, 9.145497e-001,
+9.148613e-001, 9.151729e-001, 9.154845e-001, 9.157961e-001, 9.161077e-001, 9.164192e-001, 9.167308e-001, 9.170424e-001, 9.173540e-001, 9.176656e-001,
+9.179772e-001, 9.182887e-001, 9.186003e-001, 9.189119e-001, 9.192235e-001, 9.195351e-001, 9.198467e-001, 9.201482e-001, 9.204400e-001, 9.207318e-001,
+9.210235e-001, 9.213153e-001, 9.216071e-001, 9.218989e-001, 9.221907e-001, 9.224825e-001, 9.227742e-001, 9.230660e-001, 9.233578e-001, 9.236496e-001,
+9.239414e-001, 9.242332e-001, 9.245249e-001, 9.248167e-001, 9.251085e-001, 9.254003e-001, 9.256921e-001, 9.259838e-001, 9.262756e-001, 9.265674e-001,
+9.268592e-001, 9.271510e-001, 9.274428e-001, 9.277345e-001, 9.280263e-001, 9.283181e-001, 9.286099e-001, 9.289017e-001, 9.291935e-001, 9.294852e-001,
+9.297770e-001, 9.300645e-001, 9.303379e-001, 9.306112e-001, 9.308846e-001, 9.311580e-001, 9.314314e-001, 9.317048e-001, 9.319782e-001, 9.322516e-001,
+9.325250e-001, 9.327984e-001, 9.330718e-001, 9.333451e-001, 9.336185e-001, 9.338919e-001, 9.341653e-001, 9.344387e-001, 9.347121e-001, 9.349855e-001,
+9.352589e-001, 9.355323e-001, 9.358056e-001, 9.360790e-001, 9.363524e-001, 9.366258e-001, 9.368992e-001, 9.371726e-001, 9.374460e-001, 9.377194e-001,
+9.379928e-001, 9.382662e-001, 9.385395e-001, 9.388129e-001, 9.390863e-001, 9.393597e-001, 9.396331e-001, 9.399065e-001, 9.401686e-001, 9.404249e-001,
+9.406813e-001, 9.409376e-001, 9.411939e-001, 9.414502e-001, 9.417065e-001, 9.419628e-001, 9.422191e-001, 9.424754e-001, 9.427317e-001, 9.429880e-001,
+9.432443e-001, 9.435006e-001, 9.437569e-001, 9.440132e-001, 9.442695e-001, 9.445258e-001, 9.447821e-001, 9.450384e-001, 9.452947e-001, 9.455510e-001,
+9.458073e-001, 9.460636e-001, 9.463199e-001, 9.465762e-001, 9.468325e-001, 9.470889e-001, 9.473452e-001, 9.476015e-001, 9.478578e-001, 9.481141e-001,
+9.483704e-001, 9.486267e-001, 9.488830e-001, 9.491393e-001, 9.493956e-001, 9.496519e-001, 9.499082e-001, 9.501543e-001, 9.503947e-001, 9.506352e-001,
+9.508756e-001, 9.511160e-001, 9.513565e-001, 9.515969e-001, 9.518373e-001, 9.520778e-001, 9.523182e-001, 9.525586e-001, 9.527991e-001, 9.530395e-001,
+9.532799e-001, 9.535203e-001, 9.537608e-001, 9.540012e-001, 9.542416e-001, 9.544821e-001, 9.547225e-001, 9.549629e-001, 9.552034e-001, 9.554438e-001,
+9.556842e-001, 9.559247e-001, 9.561651e-001, 9.564055e-001, 9.566460e-001, 9.568864e-001, 9.571268e-001, 9.573672e-001, 9.576077e-001, 9.578481e-001,
+9.580885e-001, 9.583290e-001, 9.585694e-001, 9.588098e-001, 9.590503e-001, 9.592907e-001, 9.595311e-001, 9.597716e-001, 9.600113e-001, 9.602369e-001,
+9.604626e-001, 9.606883e-001, 9.609140e-001, 9.611397e-001, 9.613653e-001, 9.615910e-001, 9.618167e-001, 9.620424e-001, 9.622681e-001, 9.624938e-001,
+9.627194e-001, 9.629451e-001, 9.631708e-001, 9.633965e-001, 9.636222e-001, 9.638478e-001, 9.640735e-001, 9.642992e-001, 9.645249e-001, 9.647506e-001,
+9.649763e-001, 9.652019e-001, 9.654276e-001, 9.656533e-001, 9.658790e-001, 9.661047e-001, 9.663304e-001, 9.665560e-001, 9.667817e-001, 9.670074e-001,
+9.672331e-001, 9.674588e-001, 9.676844e-001, 9.679101e-001, 9.681358e-001, 9.683615e-001, 9.685872e-001, 9.688129e-001, 9.690385e-001, 9.692642e-001,
+9.694899e-001, 9.697156e-001, 9.699413e-001, 9.701568e-001, 9.703688e-001, 9.705808e-001, 9.707927e-001, 9.710047e-001, 9.712167e-001, 9.714286e-001,
+9.716406e-001, 9.718526e-001, 9.720646e-001, 9.722765e-001, 9.724885e-001, 9.727005e-001, 9.729125e-001, 9.731244e-001, 9.733364e-001, 9.735484e-001,
+9.737603e-001, 9.739723e-001, 9.741843e-001, 9.743963e-001, 9.746082e-001, 9.748202e-001, 9.750322e-001, 9.752442e-001, 9.754561e-001, 9.756681e-001,
+9.758801e-001, 9.760921e-001, 9.763040e-001, 9.765160e-001, 9.767280e-001, 9.769399e-001, 9.771519e-001, 9.773639e-001, 9.775759e-001, 9.777878e-001,
+9.779998e-001, 9.782118e-001, 9.784238e-001, 9.786357e-001, 9.788477e-001, 9.790597e-001, 9.792717e-001, 9.794836e-001, 9.796956e-001, 9.799076e-001,
+9.801124e-001, 9.803116e-001, 9.805108e-001, 9.807100e-001, 9.809093e-001, 9.811085e-001, 9.813077e-001, 9.815069e-001, 9.817062e-001, 9.819054e-001,
+9.821046e-001, 9.823039e-001, 9.825031e-001, 9.827023e-001, 9.829015e-001, 9.831008e-001, 9.833000e-001, 9.834992e-001, 9.836984e-001, 9.838977e-001,
+9.840969e-001, 9.842961e-001, 9.844954e-001, 9.846946e-001, 9.848938e-001, 9.850930e-001, 9.852923e-001, 9.854915e-001, 9.856907e-001, 9.858899e-001,
+9.860892e-001, 9.862884e-001, 9.864876e-001, 9.866869e-001, 9.868861e-001, 9.870853e-001, 9.872845e-001, 9.874838e-001, 9.876830e-001, 9.878822e-001,
+9.880814e-001, 9.882807e-001, 9.884799e-001, 9.886791e-001, 9.888783e-001, 9.890776e-001, 9.892768e-001, 9.894760e-001, 9.896753e-001, 9.898745e-001,
+9.900693e-001, 9.902567e-001, 9.904441e-001, 9.906314e-001, 9.908188e-001, 9.910062e-001, 9.911936e-001, 9.913809e-001, 9.915683e-001, 9.917557e-001,
+9.919430e-001, 9.921304e-001, 9.923178e-001, 9.925052e-001, 9.926925e-001, 9.928799e-001, 9.930673e-001, 9.932546e-001, 9.934420e-001, 9.936294e-001,
+9.938167e-001, 9.940041e-001, 9.941915e-001, 9.943789e-001, 9.945662e-001, 9.947536e-001, 9.949410e-001, 9.951283e-001, 9.953157e-001, 9.955031e-001,
+9.956905e-001, 9.958778e-001, 9.960652e-001, 9.962526e-001, 9.964399e-001, 9.966273e-001, 9.968147e-001, 9.970021e-001, 9.971894e-001, 9.973768e-001,
+9.975642e-001, 9.977515e-001, 9.979389e-001, 9.981263e-001, 9.983137e-001, 9.985010e-001, 9.986884e-001, 9.988758e-001, 9.990631e-001, 9.992505e-001,
+9.994379e-001, 9.996253e-001, 9.998126e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.431716e-003, 6.863432e-003, 1.031682e-002, 1.400053e-002, 1.768425e-002, 2.145658e-002, 2.537892e-002, 2.930127e-002, 3.340154e-002,
+3.754037e-002, 4.175461e-002, 4.607932e-002, 5.041786e-002, 5.489067e-002, 5.936348e-002, 6.392662e-002, 6.850475e-002, 7.312349e-002, 7.776191e-002,
+8.240855e-002, 8.706284e-002, 9.170780e-002, 9.633678e-002, 1.009530e-001, 1.055206e-001, 1.100866e-001, 1.145634e-001, 1.190402e-001, 1.234277e-001,
+1.277908e-001, 1.320899e-001, 1.363232e-001, 1.405382e-001, 1.446315e-001, 1.487248e-001, 1.527182e-001, 1.566663e-001, 1.605917e-001, 1.643937e-001,
+1.681956e-001, 1.719217e-001, 1.755794e-001, 1.792372e-001, 1.827842e-001, 1.863021e-001, 1.898200e-001, 1.932110e-001, 1.965950e-001, 1.999791e-001,
+2.032371e-001, 2.064943e-001, 2.097516e-001, 2.128987e-001, 2.160367e-001, 2.191747e-001, 2.222306e-001, 2.252573e-001, 2.282839e-001, 2.312658e-001,
+2.341890e-001, 2.371122e-001, 2.400343e-001, 2.428618e-001, 2.456893e-001, 2.485169e-001, 2.513025e-001, 2.540419e-001, 2.567812e-001, 2.595206e-001,
+2.621931e-001, 2.648515e-001, 2.675099e-001, 2.701636e-001, 2.727478e-001, 2.753320e-001, 2.779162e-001, 2.804873e-001, 2.830037e-001, 2.855202e-001,
+2.880367e-001, 2.905395e-001, 2.929943e-001, 2.954490e-001, 2.979038e-001, 3.003503e-001, 3.027490e-001, 3.051476e-001, 3.075463e-001, 3.099449e-001,
+3.122939e-001, 3.146417e-001, 3.169896e-001, 3.193374e-001, 3.216522e-001, 3.239541e-001, 3.262560e-001, 3.285579e-001, 3.308443e-001, 3.331048e-001,
+3.353653e-001, 3.376257e-001, 3.398862e-001, 3.421114e-001, 3.443347e-001, 3.465579e-001, 3.487812e-001, 3.509894e-001, 3.531794e-001, 3.553693e-001,
+3.575593e-001, 3.597492e-001, 3.619128e-001, 3.640730e-001, 3.662332e-001, 3.683934e-001, 3.705468e-001, 3.726806e-001, 3.748143e-001, 3.769480e-001,
+3.790817e-001, 3.812020e-001, 3.833122e-001, 3.854224e-001, 3.875326e-001, 3.896428e-001, 3.917357e-001, 3.938251e-001, 3.959145e-001, 3.980039e-001,
+4.000924e-001, 4.021634e-001, 4.042344e-001, 4.063053e-001, 4.083763e-001, 4.104438e-001, 4.124985e-001, 4.145531e-001, 4.166078e-001, 4.186625e-001,
+4.207122e-001, 4.227524e-001, 4.247926e-001, 4.268329e-001, 4.288731e-001, 4.309075e-001, 4.329349e-001, 4.349622e-001, 4.369895e-001, 4.390168e-001,
+4.410381e-001, 4.430537e-001, 4.450694e-001, 4.470850e-001, 4.491006e-001, 4.511103e-001, 4.531151e-001, 4.551200e-001, 4.571248e-001, 4.591297e-001,
+4.611288e-001, 4.631234e-001, 4.651181e-001, 4.671127e-001, 4.691074e-001, 4.710965e-001, 4.730812e-001, 4.750659e-001, 4.770506e-001, 4.790353e-001,
+4.810148e-001, 4.829894e-001, 4.849640e-001, 4.869386e-001, 4.889132e-001, 4.908830e-001, 4.928470e-001, 4.948110e-001, 4.967750e-001, 4.987390e-001,
+5.006989e-001, 5.026514e-001, 5.046039e-001, 5.065565e-001, 5.085090e-001, 5.104585e-001, 5.123982e-001, 5.143380e-001, 5.162777e-001, 5.182175e-001,
+5.201561e-001, 5.220814e-001, 5.240067e-001, 5.259320e-001, 5.278573e-001, 5.297827e-001, 5.316933e-001, 5.336022e-001, 5.355110e-001, 5.374198e-001,
+5.393286e-001, 5.412251e-001, 5.431150e-001, 5.450049e-001, 5.468948e-001, 5.487847e-001, 5.506668e-001, 5.525350e-001, 5.544031e-001, 5.562713e-001,
+5.581395e-001, 5.600075e-001, 5.618509e-001, 5.636943e-001, 5.655376e-001, 5.673810e-001, 5.692244e-001, 5.710515e-001, 5.728667e-001, 5.746819e-001,
+5.764972e-001, 5.783124e-001, 5.801254e-001, 5.819090e-001, 5.836926e-001, 5.854762e-001, 5.872597e-001, 5.890433e-001, 5.908105e-001, 5.925588e-001,
+5.943070e-001, 5.960553e-001, 5.978036e-001, 5.995518e-001, 6.012711e-001, 6.029804e-001, 6.046897e-001, 6.063990e-001, 6.081083e-001, 6.098175e-001,
+6.114888e-001, 6.131555e-001, 6.148222e-001, 6.164888e-001, 6.181555e-001, 6.198222e-001, 6.214477e-001, 6.230684e-001, 6.246890e-001, 6.263096e-001,
+6.279302e-001, 6.295508e-001, 6.311358e-001, 6.327071e-001, 6.342785e-001, 6.358498e-001, 6.374211e-001, 6.389924e-001, 6.405450e-001, 6.420642e-001,
+6.435833e-001, 6.451024e-001, 6.466216e-001, 6.481407e-001, 6.496598e-001, 6.511365e-001, 6.526009e-001, 6.540653e-001, 6.555297e-001, 6.569941e-001,
+6.584586e-001, 6.599230e-001, 6.613336e-001, 6.627412e-001, 6.641489e-001, 6.655565e-001, 6.669642e-001, 6.683718e-001, 6.697795e-001, 6.711379e-001,
+6.724872e-001, 6.738365e-001, 6.751858e-001, 6.765351e-001, 6.778844e-001, 6.792337e-001, 6.805573e-001, 6.818472e-001, 6.831371e-001, 6.844270e-001,
+6.857169e-001, 6.870068e-001, 6.882966e-001, 6.895865e-001, 6.908357e-001, 6.920656e-001, 6.932955e-001, 6.945255e-001, 6.957554e-001, 6.969853e-001,
+6.982152e-001, 6.994452e-001, 7.006422e-001, 7.018121e-001, 7.029820e-001, 7.041519e-001, 7.053218e-001, 7.064917e-001, 7.076617e-001, 7.088316e-001,
+7.100014e-001, 7.111117e-001, 7.122221e-001, 7.133324e-001, 7.144427e-001, 7.155530e-001, 7.166634e-001, 7.177737e-001, 7.188840e-001, 7.199943e-001,
+7.210462e-001, 7.220978e-001, 7.231494e-001, 7.242009e-001, 7.252525e-001, 7.263041e-001, 7.273557e-001, 7.284073e-001, 7.294588e-001, 7.304825e-001,
+7.314765e-001, 7.324706e-001, 7.334647e-001, 7.344587e-001, 7.354528e-001, 7.364468e-001, 7.374409e-001, 7.384350e-001, 7.394290e-001, 7.403993e-001,
+7.413373e-001, 7.422754e-001, 7.432135e-001, 7.441516e-001, 7.450897e-001, 7.460278e-001, 7.469659e-001, 7.479040e-001, 7.488421e-001, 7.497802e-001,
+7.506768e-001, 7.515608e-001, 7.524447e-001, 7.533287e-001, 7.542126e-001, 7.550965e-001, 7.559805e-001, 7.568644e-001, 7.577484e-001, 7.586323e-001,
+7.595163e-001, 7.603766e-001, 7.612085e-001, 7.620403e-001, 7.628721e-001, 7.637040e-001, 7.645358e-001, 7.653676e-001, 7.661995e-001, 7.670313e-001,
+7.678631e-001, 7.686950e-001, 7.695268e-001, 7.703371e-001, 7.711190e-001, 7.719009e-001, 7.726829e-001, 7.734648e-001, 7.742467e-001, 7.750286e-001,
+7.758105e-001, 7.765924e-001, 7.773743e-001, 7.781563e-001, 7.789382e-001, 7.797201e-001, 7.804714e-001, 7.812057e-001, 7.819400e-001, 7.826743e-001,
+7.834086e-001, 7.841429e-001, 7.848772e-001, 7.856115e-001, 7.863458e-001, 7.870801e-001, 7.878144e-001, 7.885487e-001, 7.892830e-001, 7.900162e-001,
+7.907052e-001, 7.913943e-001, 7.920833e-001, 7.927723e-001, 7.934614e-001, 7.941504e-001, 7.948395e-001, 7.955285e-001, 7.962175e-001, 7.969066e-001,
+7.975956e-001, 7.982846e-001, 7.989737e-001, 7.996627e-001, 8.003299e-001, 8.009760e-001, 8.016222e-001, 8.022684e-001, 8.029146e-001, 8.035607e-001,
+8.042069e-001, 8.048531e-001, 8.054992e-001, 8.061454e-001, 8.067916e-001, 8.074378e-001, 8.080839e-001, 8.087301e-001, 8.093763e-001, 8.100210e-001,
+8.106267e-001, 8.112324e-001, 8.118381e-001, 8.124438e-001, 8.130495e-001, 8.136552e-001, 8.142609e-001, 8.148665e-001, 8.154722e-001, 8.160779e-001,
+8.166836e-001, 8.172893e-001, 8.178950e-001, 8.185007e-001, 8.191064e-001, 8.197120e-001, 8.202977e-001, 8.208653e-001, 8.214328e-001, 8.220004e-001,
+8.225679e-001, 8.231355e-001, 8.237030e-001, 8.242706e-001, 8.248381e-001, 8.254057e-001, 8.259732e-001, 8.265408e-001, 8.271083e-001, 8.276759e-001,
+8.282434e-001, 8.288110e-001, 8.293785e-001, 8.299461e-001, 8.304812e-001, 8.310129e-001, 8.315446e-001, 8.320763e-001, 8.326080e-001, 8.331397e-001,
+8.336714e-001, 8.342031e-001, 8.347348e-001, 8.352665e-001, 8.357982e-001, 8.363299e-001, 8.368616e-001, 8.373933e-001, 8.379250e-001, 8.384567e-001,
+8.389884e-001, 8.395201e-001, 8.400486e-001, 8.405466e-001, 8.410447e-001, 8.415428e-001, 8.420408e-001, 8.425389e-001, 8.430370e-001, 8.435351e-001,
+8.440331e-001, 8.445312e-001, 8.450293e-001, 8.455273e-001, 8.460254e-001, 8.465235e-001, 8.470215e-001, 8.475196e-001, 8.480177e-001, 8.485158e-001,
+8.490138e-001, 8.495119e-001, 8.500093e-001, 8.504759e-001, 8.509425e-001, 8.514090e-001, 8.518756e-001, 8.523422e-001, 8.528088e-001, 8.532753e-001,
+8.537419e-001, 8.542085e-001, 8.546750e-001, 8.551416e-001, 8.556082e-001, 8.560747e-001, 8.565413e-001, 8.570079e-001, 8.574744e-001, 8.579410e-001,
+8.584076e-001, 8.588742e-001, 8.593407e-001, 8.598073e-001, 8.602566e-001, 8.606937e-001, 8.611308e-001, 8.615679e-001, 8.620050e-001, 8.624421e-001,
+8.628792e-001, 8.633163e-001, 8.637534e-001, 8.641905e-001, 8.646276e-001, 8.650647e-001, 8.655018e-001, 8.659389e-001, 8.663760e-001, 8.668131e-001,
+8.672502e-001, 8.676873e-001, 8.681244e-001, 8.685615e-001, 8.689986e-001, 8.694357e-001, 8.698728e-001, 8.702904e-001, 8.706999e-001, 8.711095e-001,
+8.715191e-001, 8.719286e-001, 8.723382e-001, 8.727478e-001, 8.731573e-001, 8.735669e-001, 8.739765e-001, 8.743860e-001, 8.747956e-001, 8.752052e-001,
+8.756147e-001, 8.760243e-001, 8.764339e-001, 8.768434e-001, 8.772530e-001, 8.776626e-001, 8.780721e-001, 8.784817e-001, 8.788913e-001, 8.793008e-001,
+8.797104e-001, 8.801124e-001, 8.804963e-001, 8.808802e-001, 8.812640e-001, 8.816479e-001, 8.820318e-001, 8.824156e-001, 8.827995e-001, 8.831834e-001,
+8.835672e-001, 8.839511e-001, 8.843349e-001, 8.847188e-001, 8.851027e-001, 8.854865e-001, 8.858704e-001, 8.862543e-001, 8.866381e-001, 8.870220e-001,
+8.874058e-001, 8.877897e-001, 8.881736e-001, 8.885574e-001, 8.889413e-001, 8.893252e-001, 8.897090e-001, 8.900871e-001, 8.904470e-001, 8.908069e-001,
+8.911667e-001, 8.915266e-001, 8.918865e-001, 8.922464e-001, 8.926063e-001, 8.929662e-001, 8.933260e-001, 8.936859e-001, 8.940458e-001, 8.944057e-001,
+8.947656e-001, 8.951255e-001, 8.954853e-001, 8.958452e-001, 8.962051e-001, 8.965650e-001, 8.969249e-001, 8.972848e-001, 8.976446e-001, 8.980045e-001,
+8.983644e-001, 8.987243e-001, 8.990842e-001, 8.994441e-001, 8.998039e-001, 9.001537e-001, 9.004912e-001, 9.008287e-001, 9.011662e-001, 9.015038e-001,
+9.018413e-001, 9.021788e-001, 9.025163e-001, 9.028539e-001, 9.031914e-001, 9.035289e-001, 9.038664e-001, 9.042040e-001, 9.045415e-001, 9.048790e-001,
+9.052166e-001, 9.055541e-001, 9.058916e-001, 9.062291e-001, 9.065667e-001, 9.069042e-001, 9.072417e-001, 9.075792e-001, 9.079168e-001, 9.082543e-001,
+9.085918e-001, 9.089293e-001, 9.092669e-001, 9.096044e-001, 9.099419e-001, 9.102622e-001, 9.105789e-001, 9.108956e-001, 9.112123e-001, 9.115289e-001,
+9.118456e-001, 9.121623e-001, 9.124790e-001, 9.127957e-001, 9.131124e-001, 9.134291e-001, 9.137458e-001, 9.140625e-001, 9.143791e-001, 9.146958e-001,
+9.150125e-001, 9.153292e-001, 9.156459e-001, 9.159626e-001, 9.162793e-001, 9.165960e-001, 9.169127e-001, 9.172293e-001, 9.175460e-001, 9.178627e-001,
+9.181794e-001, 9.184961e-001, 9.188128e-001, 9.191295e-001, 9.194462e-001, 9.197629e-001, 9.200747e-001, 9.203719e-001, 9.206692e-001, 9.209665e-001,
+9.212638e-001, 9.215610e-001, 9.218583e-001, 9.221556e-001, 9.224528e-001, 9.227501e-001, 9.230474e-001, 9.233447e-001, 9.236419e-001, 9.239392e-001,
+9.242365e-001, 9.245338e-001, 9.248310e-001, 9.251283e-001, 9.254256e-001, 9.257228e-001, 9.260201e-001, 9.263174e-001, 9.266147e-001, 9.269119e-001,
+9.272092e-001, 9.275065e-001, 9.278037e-001, 9.281010e-001, 9.283983e-001, 9.286956e-001, 9.289928e-001, 9.292901e-001, 9.295874e-001, 9.298847e-001,
+9.301709e-001, 9.304500e-001, 9.307292e-001, 9.310084e-001, 9.312876e-001, 9.315668e-001, 9.318460e-001, 9.321251e-001, 9.324043e-001, 9.326835e-001,
+9.329627e-001, 9.332419e-001, 9.335211e-001, 9.338002e-001, 9.340794e-001, 9.343586e-001, 9.346378e-001, 9.349170e-001, 9.351962e-001, 9.354753e-001,
+9.357545e-001, 9.360337e-001, 9.363129e-001, 9.365921e-001, 9.368713e-001, 9.371504e-001, 9.374296e-001, 9.377088e-001, 9.379880e-001, 9.382672e-001,
+9.385464e-001, 9.388255e-001, 9.391047e-001, 9.393839e-001, 9.396631e-001, 9.399423e-001, 9.402081e-001, 9.404704e-001, 9.407328e-001, 9.409951e-001,
+9.412574e-001, 9.415197e-001, 9.417821e-001, 9.420444e-001, 9.423067e-001, 9.425691e-001, 9.428314e-001, 9.430937e-001, 9.433561e-001, 9.436184e-001,
+9.438807e-001, 9.441431e-001, 9.444054e-001, 9.446677e-001, 9.449300e-001, 9.451924e-001, 9.454547e-001, 9.457170e-001, 9.459794e-001, 9.462417e-001,
+9.465040e-001, 9.467664e-001, 9.470287e-001, 9.472910e-001, 9.475534e-001, 9.478157e-001, 9.480780e-001, 9.483403e-001, 9.486027e-001, 9.488650e-001,
+9.491273e-001, 9.493897e-001, 9.496520e-001, 9.499143e-001, 9.501661e-001, 9.504127e-001, 9.506593e-001, 9.509060e-001, 9.511526e-001, 9.513992e-001,
+9.516459e-001, 9.518925e-001, 9.521391e-001, 9.523858e-001, 9.526324e-001, 9.528790e-001, 9.531256e-001, 9.533723e-001, 9.536189e-001, 9.538655e-001,
+9.541122e-001, 9.543588e-001, 9.546054e-001, 9.548520e-001, 9.550987e-001, 9.553453e-001, 9.555919e-001, 9.558386e-001, 9.560852e-001, 9.563318e-001,
+9.565785e-001, 9.568251e-001, 9.570717e-001, 9.573183e-001, 9.575650e-001, 9.578116e-001, 9.580582e-001, 9.583049e-001, 9.585515e-001, 9.587981e-001,
+9.590448e-001, 9.592914e-001, 9.595380e-001, 9.597846e-001, 9.600294e-001, 9.602614e-001, 9.604934e-001, 9.607254e-001, 9.609574e-001, 9.611894e-001,
+9.614214e-001, 9.616534e-001, 9.618854e-001, 9.621174e-001, 9.623494e-001, 9.625814e-001, 9.628134e-001, 9.630454e-001, 9.632774e-001, 9.635094e-001,
+9.637414e-001, 9.639734e-001, 9.642054e-001, 9.644374e-001, 9.646694e-001, 9.649014e-001, 9.651334e-001, 9.653654e-001, 9.655974e-001, 9.658294e-001,
+9.660614e-001, 9.662934e-001, 9.665254e-001, 9.667574e-001, 9.669894e-001, 9.672214e-001, 9.674534e-001, 9.676854e-001, 9.679174e-001, 9.681494e-001,
+9.683814e-001, 9.686134e-001, 9.688454e-001, 9.690774e-001, 9.693094e-001, 9.695414e-001, 9.697734e-001, 9.700050e-001, 9.702234e-001, 9.704418e-001,
+9.706601e-001, 9.708785e-001, 9.710969e-001, 9.713152e-001, 9.715336e-001, 9.717519e-001, 9.719703e-001, 9.721887e-001, 9.724070e-001, 9.726254e-001,
+9.728438e-001, 9.730621e-001, 9.732805e-001, 9.734988e-001, 9.737172e-001, 9.739356e-001, 9.741539e-001, 9.743723e-001, 9.745907e-001, 9.748090e-001,
+9.750274e-001, 9.752457e-001, 9.754641e-001, 9.756825e-001, 9.759008e-001, 9.761192e-001, 9.763376e-001, 9.765559e-001, 9.767743e-001, 9.769926e-001,
+9.772110e-001, 9.774294e-001, 9.776477e-001, 9.778661e-001, 9.780845e-001, 9.783028e-001, 9.785212e-001, 9.787395e-001, 9.789579e-001, 9.791763e-001,
+9.793946e-001, 9.796130e-001, 9.798314e-001, 9.800468e-001, 9.802525e-001, 9.804581e-001, 9.806638e-001, 9.808694e-001, 9.810751e-001, 9.812807e-001,
+9.814864e-001, 9.816920e-001, 9.818977e-001, 9.821033e-001, 9.823090e-001, 9.825146e-001, 9.827203e-001, 9.829259e-001, 9.831316e-001, 9.833372e-001,
+9.835429e-001, 9.837485e-001, 9.839542e-001, 9.841598e-001, 9.843655e-001, 9.845711e-001, 9.847768e-001, 9.849824e-001, 9.851881e-001, 9.853937e-001,
+9.855994e-001, 9.858050e-001, 9.860107e-001, 9.862163e-001, 9.864220e-001, 9.866276e-001, 9.868333e-001, 9.870389e-001, 9.872446e-001, 9.874502e-001,
+9.876559e-001, 9.878615e-001, 9.880672e-001, 9.882728e-001, 9.884785e-001, 9.886841e-001, 9.888898e-001, 9.890954e-001, 9.893011e-001, 9.895067e-001,
+9.897124e-001, 9.899180e-001, 9.901165e-001, 9.903103e-001, 9.905041e-001, 9.906979e-001, 9.908917e-001, 9.910855e-001, 9.912793e-001, 9.914731e-001,
+9.916669e-001, 9.918607e-001, 9.920545e-001, 9.922483e-001, 9.924420e-001, 9.926358e-001, 9.928296e-001, 9.930234e-001, 9.932172e-001, 9.934110e-001,
+9.936048e-001, 9.937986e-001, 9.939924e-001, 9.941862e-001, 9.943800e-001, 9.945738e-001, 9.947676e-001, 9.949614e-001, 9.951552e-001, 9.953490e-001,
+9.955427e-001, 9.957365e-001, 9.959303e-001, 9.961241e-001, 9.963179e-001, 9.965117e-001, 9.967055e-001, 9.968993e-001, 9.970931e-001, 9.972869e-001,
+9.974807e-001, 9.976745e-001, 9.978683e-001, 9.980621e-001, 9.982559e-001, 9.984497e-001, 9.986434e-001, 9.988372e-001, 9.990310e-001, 9.992248e-001,
+9.994186e-001, 9.996124e-001, 9.998062e-001, 1.000000e+000)),
+("Kodak", "DSCS 3152", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.129124e-003, 6.258247e-003, 9.387371e-003, 1.280037e-002, 1.628249e-002, 1.976460e-002, 2.359346e-002, 2.744746e-002, 3.143005e-002,
+3.566483e-002, 3.989961e-002, 4.450124e-002, 4.911178e-002, 5.400774e-002, 5.897181e-002, 6.418356e-002, 6.946001e-002, 7.496364e-002, 8.050917e-002,
+8.621807e-002, 9.195988e-002, 9.776630e-002, 1.035819e-001, 1.094033e-001, 1.151699e-001, 1.209100e-001, 1.265449e-001, 1.321122e-001, 1.375723e-001,
+1.429160e-001, 1.481667e-001, 1.532677e-001, 1.582884e-001, 1.631516e-001, 1.679333e-001, 1.725794e-001, 1.771221e-001, 1.815797e-001, 1.858898e-001,
+1.901896e-001, 1.942778e-001, 1.983660e-001, 2.023289e-001, 2.062084e-001, 2.100835e-001, 2.137690e-001, 2.174544e-001, 2.210844e-001, 2.245908e-001,
+2.280972e-001, 2.315285e-001, 2.348707e-001, 2.382130e-001, 2.414855e-001, 2.446778e-001, 2.478702e-001, 2.510173e-001, 2.540734e-001, 2.571295e-001,
+2.601781e-001, 2.631106e-001, 2.660431e-001, 2.689756e-001, 2.718353e-001, 2.746560e-001, 2.774766e-001, 2.802866e-001, 2.830061e-001, 2.857257e-001,
+2.884453e-001, 2.911258e-001, 2.937542e-001, 2.963827e-001, 2.990111e-001, 3.015883e-001, 3.041347e-001, 3.066811e-001, 3.092275e-001, 3.117224e-001,
+3.141951e-001, 3.166677e-001, 3.191403e-001, 3.215698e-001, 3.239762e-001, 3.263827e-001, 3.287891e-001, 3.311661e-001, 3.335133e-001, 3.358605e-001,
+3.382078e-001, 3.405425e-001, 3.428368e-001, 3.451311e-001, 3.474254e-001, 3.497197e-001, 3.519726e-001, 3.542198e-001, 3.564670e-001, 3.587142e-001,
+3.609434e-001, 3.631487e-001, 3.653541e-001, 3.675594e-001, 3.697647e-001, 3.719370e-001, 3.741052e-001, 3.762735e-001, 3.784418e-001, 3.806009e-001,
+3.827365e-001, 3.848722e-001, 3.870078e-001, 3.891434e-001, 3.912619e-001, 3.933688e-001, 3.954758e-001, 3.975827e-001, 3.996897e-001, 4.017753e-001,
+4.038572e-001, 4.059390e-001, 4.080209e-001, 4.101017e-001, 4.121617e-001, 4.142218e-001, 4.162818e-001, 4.183419e-001, 4.203982e-001, 4.224393e-001,
+4.244804e-001, 4.265214e-001, 4.285625e-001, 4.305987e-001, 4.326234e-001, 4.346480e-001, 4.366727e-001, 4.386973e-001, 4.407169e-001, 4.427273e-001,
+4.447377e-001, 4.467481e-001, 4.487585e-001, 4.507641e-001, 4.527621e-001, 4.547601e-001, 4.567581e-001, 4.587560e-001, 4.607499e-001, 4.627369e-001,
+4.647239e-001, 4.667109e-001, 4.686979e-001, 4.706815e-001, 4.726586e-001, 4.746357e-001, 4.766128e-001, 4.785900e-001, 4.805644e-001, 4.825324e-001,
+4.845003e-001, 4.864682e-001, 4.884361e-001, 4.904022e-001, 4.923612e-001, 4.943202e-001, 4.962792e-001, 4.982382e-001, 5.001962e-001, 5.021462e-001,
+5.040961e-001, 5.060460e-001, 5.079959e-001, 5.099458e-001, 5.118863e-001, 5.138265e-001, 5.157667e-001, 5.177069e-001, 5.196471e-001, 5.215785e-001,
+5.235080e-001, 5.254374e-001, 5.273669e-001, 5.292964e-001, 5.312180e-001, 5.331351e-001, 5.350523e-001, 5.369695e-001, 5.388866e-001, 5.407978e-001,
+5.427006e-001, 5.446034e-001, 5.465063e-001, 5.484091e-001, 5.503092e-001, 5.521953e-001, 5.540813e-001, 5.559674e-001, 5.578534e-001, 5.597395e-001,
+5.616086e-001, 5.634749e-001, 5.653413e-001, 5.672076e-001, 5.690740e-001, 5.709287e-001, 5.727721e-001, 5.746154e-001, 5.764587e-001, 5.783021e-001,
+5.801433e-001, 5.819600e-001, 5.837767e-001, 5.855933e-001, 5.874100e-001, 5.892267e-001, 5.910258e-001, 5.928118e-001, 5.945979e-001, 5.963840e-001,
+5.981701e-001, 5.999561e-001, 6.017083e-001, 6.034597e-001, 6.052110e-001, 6.069624e-001, 6.087138e-001, 6.104548e-001, 6.121672e-001, 6.138797e-001,
+6.155921e-001, 6.173046e-001, 6.190170e-001, 6.207111e-001, 6.223805e-001, 6.240499e-001, 6.257192e-001, 6.273886e-001, 6.290580e-001, 6.307068e-001,
+6.323291e-001, 6.339514e-001, 6.355737e-001, 6.371960e-001, 6.388183e-001, 6.404267e-001, 6.419982e-001, 6.435696e-001, 6.451410e-001, 6.467125e-001,
+6.482839e-001, 6.498554e-001, 6.513776e-001, 6.528948e-001, 6.544120e-001, 6.559292e-001, 6.574464e-001, 6.589636e-001, 6.604627e-001, 6.619228e-001,
+6.633828e-001, 6.648429e-001, 6.663030e-001, 6.677630e-001, 6.692231e-001, 6.706553e-001, 6.720558e-001, 6.734563e-001, 6.748568e-001, 6.762574e-001,
+6.776579e-001, 6.790584e-001, 6.804388e-001, 6.817780e-001, 6.831172e-001, 6.844564e-001, 6.857956e-001, 6.871348e-001, 6.884740e-001, 6.898131e-001,
+6.910985e-001, 6.923752e-001, 6.936519e-001, 6.949285e-001, 6.962052e-001, 6.974818e-001, 6.987585e-001, 7.000334e-001, 7.012470e-001, 7.024606e-001,
+7.036741e-001, 7.048877e-001, 7.061013e-001, 7.073148e-001, 7.085284e-001, 7.097420e-001, 7.109059e-001, 7.120563e-001, 7.132068e-001, 7.143573e-001,
+7.155078e-001, 7.166583e-001, 7.178088e-001, 7.189592e-001, 7.201038e-001, 7.211917e-001, 7.222797e-001, 7.233677e-001, 7.244557e-001, 7.255436e-001,
+7.266316e-001, 7.277196e-001, 7.288076e-001, 7.298955e-001, 7.309280e-001, 7.319545e-001, 7.329810e-001, 7.340076e-001, 7.350341e-001, 7.360606e-001,
+7.370872e-001, 7.381137e-001, 7.391402e-001, 7.401570e-001, 7.411236e-001, 7.420902e-001, 7.430568e-001, 7.440234e-001, 7.449900e-001, 7.459565e-001,
+7.469231e-001, 7.478897e-001, 7.488563e-001, 7.498229e-001, 7.507420e-001, 7.516505e-001, 7.525590e-001, 7.534675e-001, 7.543760e-001, 7.552845e-001,
+7.561930e-001, 7.571015e-001, 7.580100e-001, 7.589185e-001, 7.598270e-001, 7.606902e-001, 7.615428e-001, 7.623953e-001, 7.632479e-001, 7.641005e-001,
+7.649530e-001, 7.658056e-001, 7.666581e-001, 7.675107e-001, 7.683632e-001, 7.692158e-001, 7.700641e-001, 7.708631e-001, 7.716620e-001, 7.724610e-001,
+7.732600e-001, 7.740590e-001, 7.748580e-001, 7.756570e-001, 7.764560e-001, 7.772549e-001, 7.780539e-001, 7.788529e-001, 7.796519e-001, 7.804221e-001,
+7.811700e-001, 7.819179e-001, 7.826659e-001, 7.834138e-001, 7.841617e-001, 7.849097e-001, 7.856576e-001, 7.864055e-001, 7.871535e-001, 7.879014e-001,
+7.886493e-001, 7.893973e-001, 7.901358e-001, 7.908353e-001, 7.915348e-001, 7.922343e-001, 7.929338e-001, 7.936332e-001, 7.943327e-001, 7.950322e-001,
+7.957317e-001, 7.964312e-001, 7.971307e-001, 7.978302e-001, 7.985297e-001, 7.992292e-001, 7.999287e-001, 8.005871e-001, 8.012408e-001, 8.018945e-001,
+8.025482e-001, 8.032019e-001, 8.038556e-001, 8.045094e-001, 8.051631e-001, 8.058168e-001, 8.064705e-001, 8.071242e-001, 8.077779e-001, 8.084316e-001,
+8.090854e-001, 8.097391e-001, 8.103669e-001, 8.109775e-001, 8.115881e-001, 8.121986e-001, 8.128092e-001, 8.134198e-001, 8.140304e-001, 8.146410e-001,
+8.152516e-001, 8.158622e-001, 8.164728e-001, 8.170834e-001, 8.176940e-001, 8.183046e-001, 8.189152e-001, 8.195257e-001, 8.201273e-001, 8.206974e-001,
+8.212675e-001, 8.218376e-001, 8.224077e-001, 8.229778e-001, 8.235479e-001, 8.241179e-001, 8.246880e-001, 8.252581e-001, 8.258282e-001, 8.263983e-001,
+8.269684e-001, 8.275385e-001, 8.281086e-001, 8.286787e-001, 8.292488e-001, 8.298189e-001, 8.303631e-001, 8.308952e-001, 8.314274e-001, 8.319595e-001,
+8.324917e-001, 8.330239e-001, 8.335560e-001, 8.340882e-001, 8.346203e-001, 8.351525e-001, 8.356846e-001, 8.362168e-001, 8.367489e-001, 8.372811e-001,
+8.378132e-001, 8.383454e-001, 8.388775e-001, 8.394097e-001, 8.399418e-001, 8.404424e-001, 8.409391e-001, 8.414358e-001, 8.419325e-001, 8.424291e-001,
+8.429258e-001, 8.434225e-001, 8.439192e-001, 8.444159e-001, 8.449126e-001, 8.454093e-001, 8.459059e-001, 8.464026e-001, 8.468993e-001, 8.473960e-001,
+8.478927e-001, 8.483894e-001, 8.488860e-001, 8.493827e-001, 8.498794e-001, 8.503510e-001, 8.508146e-001, 8.512782e-001, 8.517418e-001, 8.522054e-001,
+8.526690e-001, 8.531326e-001, 8.535962e-001, 8.540597e-001, 8.545233e-001, 8.549869e-001, 8.554505e-001, 8.559141e-001, 8.563777e-001, 8.568413e-001,
+8.573049e-001, 8.577685e-001, 8.582320e-001, 8.586956e-001, 8.591592e-001, 8.596228e-001, 8.600807e-001, 8.605134e-001, 8.609462e-001, 8.613789e-001,
+8.618117e-001, 8.622444e-001, 8.626772e-001, 8.631099e-001, 8.635427e-001, 8.639754e-001, 8.644082e-001, 8.648409e-001, 8.652737e-001, 8.657064e-001,
+8.661392e-001, 8.665719e-001, 8.670046e-001, 8.674374e-001, 8.678701e-001, 8.683029e-001, 8.687356e-001, 8.691684e-001, 8.696011e-001, 8.700317e-001,
+8.704357e-001, 8.708398e-001, 8.712438e-001, 8.716479e-001, 8.720519e-001, 8.724560e-001, 8.728600e-001, 8.732641e-001, 8.736681e-001, 8.740722e-001,
+8.744762e-001, 8.748803e-001, 8.752843e-001, 8.756884e-001, 8.760924e-001, 8.764965e-001, 8.769005e-001, 8.773046e-001, 8.777086e-001, 8.781127e-001,
+8.785167e-001, 8.789208e-001, 8.793248e-001, 8.797289e-001, 8.801241e-001, 8.805015e-001, 8.808789e-001, 8.812562e-001, 8.816336e-001, 8.820110e-001,
+8.823883e-001, 8.827657e-001, 8.831431e-001, 8.835204e-001, 8.838978e-001, 8.842752e-001, 8.846525e-001, 8.850299e-001, 8.854073e-001, 8.857846e-001,
+8.861620e-001, 8.865393e-001, 8.869167e-001, 8.872941e-001, 8.876714e-001, 8.880488e-001, 8.884262e-001, 8.888035e-001, 8.891809e-001, 8.895583e-001,
+8.899356e-001, 8.902924e-001, 8.906450e-001, 8.909976e-001, 8.913502e-001, 8.917027e-001, 8.920553e-001, 8.924079e-001, 8.927605e-001, 8.931130e-001,
+8.934656e-001, 8.938182e-001, 8.941708e-001, 8.945233e-001, 8.948759e-001, 8.952285e-001, 8.955811e-001, 8.959336e-001, 8.962862e-001, 8.966388e-001,
+8.969914e-001, 8.973439e-001, 8.976965e-001, 8.980491e-001, 8.984017e-001, 8.987542e-001, 8.991068e-001, 8.994594e-001, 8.998120e-001, 9.001538e-001,
+9.004834e-001, 9.008129e-001, 9.011425e-001, 9.014720e-001, 9.018016e-001, 9.021311e-001, 9.024607e-001, 9.027902e-001, 9.031198e-001, 9.034494e-001,
+9.037789e-001, 9.041085e-001, 9.044380e-001, 9.047676e-001, 9.050971e-001, 9.054267e-001, 9.057562e-001, 9.060858e-001, 9.064154e-001, 9.067449e-001,
+9.070745e-001, 9.074040e-001, 9.077336e-001, 9.080631e-001, 9.083927e-001, 9.087222e-001, 9.090518e-001, 9.093813e-001, 9.097109e-001, 9.100378e-001,
+9.103460e-001, 9.106542e-001, 9.109624e-001, 9.112706e-001, 9.115788e-001, 9.118870e-001, 9.121951e-001, 9.125033e-001, 9.128115e-001, 9.131197e-001,
+9.134279e-001, 9.137361e-001, 9.140443e-001, 9.143525e-001, 9.146606e-001, 9.149688e-001, 9.152770e-001, 9.155852e-001, 9.158934e-001, 9.162016e-001,
+9.165098e-001, 9.168180e-001, 9.171261e-001, 9.174343e-001, 9.177425e-001, 9.180507e-001, 9.183589e-001, 9.186671e-001, 9.189753e-001, 9.192835e-001,
+9.195916e-001, 9.198998e-001, 9.201946e-001, 9.204830e-001, 9.207713e-001, 9.210597e-001, 9.213481e-001, 9.216364e-001, 9.219248e-001, 9.222131e-001,
+9.225015e-001, 9.227899e-001, 9.230782e-001, 9.233666e-001, 9.236549e-001, 9.239433e-001, 9.242316e-001, 9.245200e-001, 9.248084e-001, 9.250967e-001,
+9.253851e-001, 9.256734e-001, 9.259618e-001, 9.262501e-001, 9.265385e-001, 9.268269e-001, 9.271152e-001, 9.274036e-001, 9.276919e-001, 9.279803e-001,
+9.282687e-001, 9.285570e-001, 9.288454e-001, 9.291337e-001, 9.294221e-001, 9.297104e-001, 9.299988e-001, 9.302688e-001, 9.305388e-001, 9.308088e-001,
+9.310787e-001, 9.313487e-001, 9.316186e-001, 9.318886e-001, 9.321585e-001, 9.324285e-001, 9.326985e-001, 9.329684e-001, 9.332384e-001, 9.335083e-001,
+9.337783e-001, 9.340482e-001, 9.343182e-001, 9.345882e-001, 9.348581e-001, 9.351281e-001, 9.353980e-001, 9.356680e-001, 9.359379e-001, 9.362079e-001,
+9.364779e-001, 9.367478e-001, 9.370178e-001, 9.372877e-001, 9.375577e-001, 9.378277e-001, 9.380976e-001, 9.383676e-001, 9.386375e-001, 9.389075e-001,
+9.391774e-001, 9.394474e-001, 9.397174e-001, 9.399873e-001, 9.402410e-001, 9.404939e-001, 9.407468e-001, 9.409996e-001, 9.412525e-001, 9.415054e-001,
+9.417583e-001, 9.420112e-001, 9.422641e-001, 9.425169e-001, 9.427698e-001, 9.430227e-001, 9.432756e-001, 9.435285e-001, 9.437814e-001, 9.440342e-001,
+9.442871e-001, 9.445400e-001, 9.447929e-001, 9.450458e-001, 9.452987e-001, 9.455515e-001, 9.458044e-001, 9.460573e-001, 9.463102e-001, 9.465631e-001,
+9.468160e-001, 9.470688e-001, 9.473217e-001, 9.475746e-001, 9.478275e-001, 9.480804e-001, 9.483332e-001, 9.485861e-001, 9.488390e-001, 9.490919e-001,
+9.493448e-001, 9.495977e-001, 9.498505e-001, 9.500969e-001, 9.503340e-001, 9.505710e-001, 9.508081e-001, 9.510451e-001, 9.512821e-001, 9.515192e-001,
+9.517562e-001, 9.519932e-001, 9.522303e-001, 9.524673e-001, 9.527043e-001, 9.529414e-001, 9.531784e-001, 9.534155e-001, 9.536525e-001, 9.538895e-001,
+9.541266e-001, 9.543636e-001, 9.546006e-001, 9.548377e-001, 9.550747e-001, 9.553117e-001, 9.555488e-001, 9.557858e-001, 9.560228e-001, 9.562599e-001,
+9.564969e-001, 9.567340e-001, 9.569710e-001, 9.572080e-001, 9.574451e-001, 9.576821e-001, 9.579191e-001, 9.581562e-001, 9.583932e-001, 9.586302e-001,
+9.588673e-001, 9.591043e-001, 9.593414e-001, 9.595784e-001, 9.598154e-001, 9.600492e-001, 9.602715e-001, 9.604939e-001, 9.607162e-001, 9.609385e-001,
+9.611608e-001, 9.613832e-001, 9.616055e-001, 9.618278e-001, 9.620501e-001, 9.622725e-001, 9.624948e-001, 9.627171e-001, 9.629394e-001, 9.631618e-001,
+9.633841e-001, 9.636064e-001, 9.638287e-001, 9.640511e-001, 9.642734e-001, 9.644957e-001, 9.647180e-001, 9.649404e-001, 9.651627e-001, 9.653850e-001,
+9.656073e-001, 9.658297e-001, 9.660520e-001, 9.662743e-001, 9.664966e-001, 9.667190e-001, 9.669413e-001, 9.671636e-001, 9.673860e-001, 9.676083e-001,
+9.678306e-001, 9.680529e-001, 9.682753e-001, 9.684976e-001, 9.687199e-001, 9.689422e-001, 9.691646e-001, 9.693869e-001, 9.696092e-001, 9.698315e-001,
+9.700506e-001, 9.702592e-001, 9.704679e-001, 9.706765e-001, 9.708852e-001, 9.710939e-001, 9.713025e-001, 9.715112e-001, 9.717199e-001, 9.719285e-001,
+9.721372e-001, 9.723459e-001, 9.725545e-001, 9.727632e-001, 9.729719e-001, 9.731805e-001, 9.733892e-001, 9.735979e-001, 9.738065e-001, 9.740152e-001,
+9.742239e-001, 9.744325e-001, 9.746412e-001, 9.748499e-001, 9.750585e-001, 9.752672e-001, 9.754759e-001, 9.756845e-001, 9.758932e-001, 9.761019e-001,
+9.763105e-001, 9.765192e-001, 9.767279e-001, 9.769365e-001, 9.771452e-001, 9.773539e-001, 9.775625e-001, 9.777712e-001, 9.779799e-001, 9.781885e-001,
+9.783972e-001, 9.786059e-001, 9.788145e-001, 9.790232e-001, 9.792319e-001, 9.794405e-001, 9.796492e-001, 9.798579e-001, 9.800625e-001, 9.802585e-001,
+9.804544e-001, 9.806504e-001, 9.808464e-001, 9.810424e-001, 9.812384e-001, 9.814343e-001, 9.816303e-001, 9.818263e-001, 9.820223e-001, 9.822182e-001,
+9.824142e-001, 9.826102e-001, 9.828062e-001, 9.830022e-001, 9.831981e-001, 9.833941e-001, 9.835901e-001, 9.837861e-001, 9.839820e-001, 9.841780e-001,
+9.843740e-001, 9.845700e-001, 9.847660e-001, 9.849619e-001, 9.851579e-001, 9.853539e-001, 9.855499e-001, 9.857458e-001, 9.859418e-001, 9.861378e-001,
+9.863338e-001, 9.865298e-001, 9.867257e-001, 9.869217e-001, 9.871177e-001, 9.873137e-001, 9.875096e-001, 9.877056e-001, 9.879016e-001, 9.880976e-001,
+9.882936e-001, 9.884895e-001, 9.886855e-001, 9.888815e-001, 9.890775e-001, 9.892734e-001, 9.894694e-001, 9.896654e-001, 9.898614e-001, 9.900539e-001,
+9.902381e-001, 9.904223e-001, 9.906065e-001, 9.907907e-001, 9.909748e-001, 9.911590e-001, 9.913432e-001, 9.915274e-001, 9.917116e-001, 9.918958e-001,
+9.920800e-001, 9.922642e-001, 9.924483e-001, 9.926325e-001, 9.928167e-001, 9.930009e-001, 9.931851e-001, 9.933693e-001, 9.935535e-001, 9.937376e-001,
+9.939218e-001, 9.941060e-001, 9.942902e-001, 9.944744e-001, 9.946586e-001, 9.948428e-001, 9.950270e-001, 9.952111e-001, 9.953953e-001, 9.955795e-001,
+9.957637e-001, 9.959479e-001, 9.961321e-001, 9.963163e-001, 9.965004e-001, 9.966846e-001, 9.968688e-001, 9.970530e-001, 9.972372e-001, 9.974214e-001,
+9.976056e-001, 9.977898e-001, 9.979739e-001, 9.981581e-001, 9.983423e-001, 9.985265e-001, 9.987107e-001, 9.988949e-001, 9.990791e-001, 9.992633e-001,
+9.994474e-001, 9.996316e-001, 9.998158e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.327820e-003, 6.655641e-003, 9.983461e-003, 1.363521e-002, 1.728859e-002, 2.102790e-002, 2.501460e-002, 2.900131e-002, 3.323635e-002,
+3.755441e-002, 4.201007e-002, 4.664548e-002, 5.136101e-002, 5.628638e-002, 6.127304e-002, 6.644757e-002, 7.168373e-002, 7.705487e-002, 8.248732e-002,
+8.799418e-002, 9.354615e-002, 9.912395e-002, 1.047078e-001, 1.102902e-001, 1.158241e-001, 1.213333e-001, 1.267663e-001, 1.321426e-001, 1.374354e-001,
+1.426412e-001, 1.477651e-001, 1.527831e-001, 1.577193e-001, 1.625492e-001, 1.672876e-001, 1.719402e-001, 1.764778e-001, 1.809709e-001, 1.853098e-001,
+1.896487e-001, 1.938106e-001, 1.979570e-001, 2.020100e-001, 2.059723e-001, 2.099347e-001, 2.137263e-001, 2.175149e-001, 2.212477e-001, 2.248738e-001,
+2.284999e-001, 2.320374e-001, 2.355124e-001, 2.389874e-001, 2.423633e-001, 2.456985e-001, 2.490337e-001, 2.522774e-001, 2.554838e-001, 2.586903e-001,
+2.618267e-001, 2.649149e-001, 2.680031e-001, 2.710530e-001, 2.740329e-001, 2.770128e-001, 2.799926e-001, 2.828738e-001, 2.857546e-001, 2.886355e-001,
+2.914688e-001, 2.942594e-001, 2.970499e-001, 2.998404e-001, 3.025533e-001, 3.052615e-001, 3.079697e-001, 3.106591e-001, 3.132923e-001, 3.159256e-001,
+3.185588e-001, 3.211611e-001, 3.237262e-001, 3.262913e-001, 3.288563e-001, 3.313871e-001, 3.338902e-001, 3.363933e-001, 3.388964e-001, 3.413681e-001,
+3.438150e-001, 3.462619e-001, 3.487088e-001, 3.511316e-001, 3.535274e-001, 3.559233e-001, 3.583191e-001, 3.607012e-001, 3.630508e-001, 3.654003e-001,
+3.677499e-001, 3.700977e-001, 3.724053e-001, 3.747128e-001, 3.770204e-001, 3.793280e-001, 3.816085e-001, 3.838780e-001, 3.861474e-001, 3.884169e-001,
+3.906759e-001, 3.929107e-001, 3.951455e-001, 3.973803e-001, 3.996151e-001, 4.018238e-001, 4.040271e-001, 4.062303e-001, 4.084336e-001, 4.106285e-001,
+4.128029e-001, 4.149773e-001, 4.171518e-001, 4.193262e-001, 4.214823e-001, 4.236302e-001, 4.257782e-001, 4.279261e-001, 4.300732e-001, 4.321966e-001,
+4.343200e-001, 4.364434e-001, 4.385669e-001, 4.406828e-001, 4.427834e-001, 4.448839e-001, 4.469845e-001, 4.490850e-001, 4.511734e-001, 4.532523e-001,
+4.553312e-001, 4.574101e-001, 4.594890e-001, 4.615523e-001, 4.636105e-001, 4.656687e-001, 4.677269e-001, 4.697851e-001, 4.718252e-001, 4.738632e-001,
+4.759013e-001, 4.779393e-001, 4.799773e-001, 4.819955e-001, 4.840134e-001, 4.860314e-001, 4.880494e-001, 4.900667e-001, 4.920644e-001, 4.940622e-001,
+4.960599e-001, 4.980576e-001, 5.000548e-001, 5.020317e-001, 5.040086e-001, 5.059855e-001, 5.079624e-001, 5.099393e-001, 5.118951e-001, 5.138502e-001,
+5.158053e-001, 5.177604e-001, 5.197155e-001, 5.216509e-001, 5.235829e-001, 5.255150e-001, 5.274470e-001, 5.293790e-001, 5.312943e-001, 5.332015e-001,
+5.351088e-001, 5.370161e-001, 5.389234e-001, 5.408190e-001, 5.426996e-001, 5.445801e-001, 5.464607e-001, 5.483413e-001, 5.502184e-001, 5.520700e-001,
+5.539216e-001, 5.557732e-001, 5.576248e-001, 5.594764e-001, 5.613054e-001, 5.631255e-001, 5.649456e-001, 5.667657e-001, 5.685858e-001, 5.703983e-001,
+5.721842e-001, 5.739701e-001, 5.757561e-001, 5.775420e-001, 5.793279e-001, 5.810908e-001, 5.828397e-001, 5.845886e-001, 5.863376e-001, 5.880865e-001,
+5.898354e-001, 5.915482e-001, 5.932572e-001, 5.949662e-001, 5.966752e-001, 5.983842e-001, 6.000909e-001, 6.017571e-001, 6.034233e-001, 6.050895e-001,
+6.067557e-001, 6.084219e-001, 6.100856e-001, 6.117062e-001, 6.133268e-001, 6.149473e-001, 6.165679e-001, 6.181885e-001, 6.198090e-001, 6.213870e-001,
+6.229592e-001, 6.245315e-001, 6.261038e-001, 6.276760e-001, 6.292483e-001, 6.307940e-001, 6.323156e-001, 6.338371e-001, 6.353586e-001, 6.368801e-001,
+6.384016e-001, 6.399231e-001, 6.413944e-001, 6.428630e-001, 6.443316e-001, 6.458002e-001, 6.472688e-001, 6.487374e-001, 6.501983e-001, 6.516122e-001,
+6.530260e-001, 6.544399e-001, 6.558538e-001, 6.572677e-001, 6.586815e-001, 6.600916e-001, 6.614493e-001, 6.628070e-001, 6.641647e-001, 6.655225e-001,
+6.668802e-001, 6.682379e-001, 6.695956e-001, 6.709131e-001, 6.722137e-001, 6.735142e-001, 6.748147e-001, 6.761152e-001, 6.774157e-001, 6.787163e-001,
+6.800160e-001, 6.812588e-001, 6.825015e-001, 6.837442e-001, 6.849870e-001, 6.862297e-001, 6.874724e-001, 6.887152e-001, 6.899579e-001, 6.911446e-001,
+6.923294e-001, 6.935142e-001, 6.946990e-001, 6.958837e-001, 6.970685e-001, 6.982533e-001, 6.994380e-001, 7.005925e-001, 7.017195e-001, 7.028466e-001,
+7.039736e-001, 7.051007e-001, 7.062277e-001, 7.073547e-001, 7.084818e-001, 7.096088e-001, 7.106986e-001, 7.117685e-001, 7.128385e-001, 7.139084e-001,
+7.149784e-001, 7.160483e-001, 7.171183e-001, 7.181882e-001, 7.192581e-001, 7.203109e-001, 7.213247e-001, 7.223385e-001, 7.233523e-001, 7.243661e-001,
+7.253799e-001, 7.263938e-001, 7.274076e-001, 7.284214e-001, 7.294352e-001, 7.304247e-001, 7.313837e-001, 7.323426e-001, 7.333016e-001, 7.342606e-001,
+7.352196e-001, 7.361785e-001, 7.371375e-001, 7.380965e-001, 7.390554e-001, 7.400136e-001, 7.409193e-001, 7.418249e-001, 7.427306e-001, 7.436363e-001,
+7.445420e-001, 7.454477e-001, 7.463533e-001, 7.472590e-001, 7.481647e-001, 7.490704e-001, 7.499760e-001, 7.508316e-001, 7.516857e-001, 7.525399e-001,
+7.533940e-001, 7.542482e-001, 7.551023e-001, 7.559565e-001, 7.568106e-001, 7.576648e-001, 7.585190e-001, 7.593731e-001, 7.602141e-001, 7.610187e-001,
+7.618232e-001, 7.626278e-001, 7.634324e-001, 7.642370e-001, 7.650416e-001, 7.658462e-001, 7.666507e-001, 7.674553e-001, 7.682599e-001, 7.690645e-001,
+7.698691e-001, 7.706339e-001, 7.713910e-001, 7.721480e-001, 7.729051e-001, 7.736622e-001, 7.744193e-001, 7.751764e-001, 7.759335e-001, 7.766906e-001,
+7.774476e-001, 7.782047e-001, 7.789618e-001, 7.797189e-001, 7.804475e-001, 7.811592e-001, 7.818710e-001, 7.825827e-001, 7.832945e-001, 7.840062e-001,
+7.847180e-001, 7.854297e-001, 7.861415e-001, 7.868532e-001, 7.875650e-001, 7.882767e-001, 7.889885e-001, 7.897002e-001, 7.903870e-001, 7.910557e-001,
+7.917243e-001, 7.923929e-001, 7.930616e-001, 7.937302e-001, 7.943988e-001, 7.950675e-001, 7.957361e-001, 7.964047e-001, 7.970734e-001, 7.977420e-001,
+7.984106e-001, 7.990793e-001, 7.997479e-001, 8.003911e-001, 8.010188e-001, 8.016466e-001, 8.022743e-001, 8.029021e-001, 8.035298e-001, 8.041576e-001,
+8.047853e-001, 8.054131e-001, 8.060408e-001, 8.066686e-001, 8.072963e-001, 8.079241e-001, 8.085518e-001, 8.091796e-001, 8.098073e-001, 8.104083e-001,
+8.109974e-001, 8.115865e-001, 8.121756e-001, 8.127647e-001, 8.133537e-001, 8.139428e-001, 8.145319e-001, 8.151210e-001, 8.157101e-001, 8.162992e-001,
+8.168883e-001, 8.174774e-001, 8.180665e-001, 8.186556e-001, 8.192447e-001, 8.198337e-001, 8.203967e-001, 8.209493e-001, 8.215019e-001, 8.220545e-001,
+8.226072e-001, 8.231598e-001, 8.237124e-001, 8.242650e-001, 8.248177e-001, 8.253703e-001, 8.259229e-001, 8.264755e-001, 8.270282e-001, 8.275808e-001,
+8.281334e-001, 8.286860e-001, 8.292386e-001, 8.297913e-001, 8.303225e-001, 8.308408e-001, 8.313591e-001, 8.318774e-001, 8.323957e-001, 8.329140e-001,
+8.334323e-001, 8.339506e-001, 8.344689e-001, 8.349872e-001, 8.355055e-001, 8.360238e-001, 8.365421e-001, 8.370604e-001, 8.375787e-001, 8.380970e-001,
+8.386153e-001, 8.391336e-001, 8.396519e-001, 8.401596e-001, 8.406456e-001, 8.411317e-001, 8.416177e-001, 8.421038e-001, 8.425898e-001, 8.430758e-001,
+8.435619e-001, 8.440479e-001, 8.445340e-001, 8.450200e-001, 8.455061e-001, 8.459921e-001, 8.464781e-001, 8.469642e-001, 8.474502e-001, 8.479363e-001,
+8.484223e-001, 8.489084e-001, 8.493944e-001, 8.498804e-001, 8.503437e-001, 8.507995e-001, 8.512552e-001, 8.517110e-001, 8.521668e-001, 8.526226e-001,
+8.530784e-001, 8.535342e-001, 8.539899e-001, 8.544457e-001, 8.549015e-001, 8.553573e-001, 8.558131e-001, 8.562689e-001, 8.567247e-001, 8.571804e-001,
+8.576362e-001, 8.580920e-001, 8.585478e-001, 8.590036e-001, 8.594594e-001, 8.599151e-001, 8.603479e-001, 8.607753e-001, 8.612027e-001, 8.616302e-001,
+8.620576e-001, 8.624850e-001, 8.629125e-001, 8.633399e-001, 8.637674e-001, 8.641948e-001, 8.646222e-001, 8.650497e-001, 8.654771e-001, 8.659045e-001,
+8.663320e-001, 8.667594e-001, 8.671868e-001, 8.676143e-001, 8.680417e-001, 8.684691e-001, 8.688966e-001, 8.693240e-001, 8.697515e-001, 8.701678e-001,
+8.705687e-001, 8.709696e-001, 8.713705e-001, 8.717714e-001, 8.721723e-001, 8.725732e-001, 8.729741e-001, 8.733750e-001, 8.737759e-001, 8.741769e-001,
+8.745778e-001, 8.749787e-001, 8.753796e-001, 8.757805e-001, 8.761814e-001, 8.765823e-001, 8.769832e-001, 8.773841e-001, 8.777850e-001, 8.781859e-001,
+8.785868e-001, 8.789877e-001, 8.793886e-001, 8.797895e-001, 8.801787e-001, 8.805548e-001, 8.809309e-001, 8.813070e-001, 8.816831e-001, 8.820592e-001,
+8.824353e-001, 8.828114e-001, 8.831875e-001, 8.835636e-001, 8.839397e-001, 8.843158e-001, 8.846919e-001, 8.850680e-001, 8.854441e-001, 8.858202e-001,
+8.861963e-001, 8.865724e-001, 8.869485e-001, 8.873246e-001, 8.877007e-001, 8.880768e-001, 8.884529e-001, 8.888290e-001, 8.892051e-001, 8.895812e-001,
+8.899573e-001, 8.903128e-001, 8.906658e-001, 8.910187e-001, 8.913716e-001, 8.917245e-001, 8.920775e-001, 8.924304e-001, 8.927833e-001, 8.931362e-001,
+8.934892e-001, 8.938421e-001, 8.941950e-001, 8.945479e-001, 8.949009e-001, 8.952538e-001, 8.956067e-001, 8.959596e-001, 8.963126e-001, 8.966655e-001,
+8.970184e-001, 8.973713e-001, 8.977243e-001, 8.980772e-001, 8.984301e-001, 8.987830e-001, 8.991360e-001, 8.994889e-001, 8.998418e-001, 9.001828e-001,
+9.005141e-001, 9.008454e-001, 9.011767e-001, 9.015079e-001, 9.018392e-001, 9.021705e-001, 9.025018e-001, 9.028331e-001, 9.031644e-001, 9.034956e-001,
+9.038269e-001, 9.041582e-001, 9.044895e-001, 9.048208e-001, 9.051521e-001, 9.054833e-001, 9.058146e-001, 9.061459e-001, 9.064772e-001, 9.068085e-001,
+9.071398e-001, 9.074711e-001, 9.078023e-001, 9.081336e-001, 9.084649e-001, 9.087962e-001, 9.091275e-001, 9.094588e-001, 9.097900e-001, 9.101139e-001,
+9.104250e-001, 9.107361e-001, 9.110472e-001, 9.113583e-001, 9.116694e-001, 9.119804e-001, 9.122915e-001, 9.126026e-001, 9.129137e-001, 9.132248e-001,
+9.135359e-001, 9.138470e-001, 9.141580e-001, 9.144691e-001, 9.147802e-001, 9.150913e-001, 9.154024e-001, 9.157135e-001, 9.160246e-001, 9.163356e-001,
+9.166467e-001, 9.169578e-001, 9.172689e-001, 9.175800e-001, 9.178911e-001, 9.182022e-001, 9.185132e-001, 9.188243e-001, 9.191354e-001, 9.194465e-001,
+9.197576e-001, 9.200645e-001, 9.203567e-001, 9.206490e-001, 9.209412e-001, 9.212335e-001, 9.215257e-001, 9.218179e-001, 9.221102e-001, 9.224024e-001,
+9.226946e-001, 9.229869e-001, 9.232791e-001, 9.235714e-001, 9.238636e-001, 9.241558e-001, 9.244481e-001, 9.247403e-001, 9.250325e-001, 9.253248e-001,
+9.256170e-001, 9.259093e-001, 9.262015e-001, 9.264937e-001, 9.267860e-001, 9.270782e-001, 9.273705e-001, 9.276627e-001, 9.279549e-001, 9.282472e-001,
+9.285394e-001, 9.288316e-001, 9.291239e-001, 9.294161e-001, 9.297084e-001, 9.300006e-001, 9.302752e-001, 9.305499e-001, 9.308245e-001, 9.310992e-001,
+9.313738e-001, 9.316485e-001, 9.319231e-001, 9.321978e-001, 9.324725e-001, 9.327471e-001, 9.330218e-001, 9.332964e-001, 9.335711e-001, 9.338457e-001,
+9.341204e-001, 9.343950e-001, 9.346697e-001, 9.349443e-001, 9.352190e-001, 9.354937e-001, 9.357683e-001, 9.360430e-001, 9.363176e-001, 9.365923e-001,
+9.368669e-001, 9.371416e-001, 9.374162e-001, 9.376909e-001, 9.379656e-001, 9.382402e-001, 9.385149e-001, 9.387895e-001, 9.390642e-001, 9.393388e-001,
+9.396135e-001, 9.398881e-001, 9.401531e-001, 9.404113e-001, 9.406696e-001, 9.409278e-001, 9.411861e-001, 9.414443e-001, 9.417026e-001, 9.419608e-001,
+9.422191e-001, 9.424773e-001, 9.427356e-001, 9.429938e-001, 9.432521e-001, 9.435104e-001, 9.437686e-001, 9.440269e-001, 9.442851e-001, 9.445434e-001,
+9.448016e-001, 9.450599e-001, 9.453181e-001, 9.455764e-001, 9.458346e-001, 9.460929e-001, 9.463511e-001, 9.466094e-001, 9.468676e-001, 9.471259e-001,
+9.473841e-001, 9.476424e-001, 9.479007e-001, 9.481589e-001, 9.484172e-001, 9.486754e-001, 9.489337e-001, 9.491919e-001, 9.494502e-001, 9.497084e-001,
+9.499667e-001, 9.502116e-001, 9.504546e-001, 9.506975e-001, 9.509405e-001, 9.511834e-001, 9.514264e-001, 9.516693e-001, 9.519123e-001, 9.521552e-001,
+9.523982e-001, 9.526411e-001, 9.528841e-001, 9.531270e-001, 9.533700e-001, 9.536129e-001, 9.538559e-001, 9.540988e-001, 9.543418e-001, 9.545847e-001,
+9.548277e-001, 9.550706e-001, 9.553136e-001, 9.555565e-001, 9.557995e-001, 9.560424e-001, 9.562854e-001, 9.565284e-001, 9.567713e-001, 9.570143e-001,
+9.572572e-001, 9.575002e-001, 9.577431e-001, 9.579861e-001, 9.582290e-001, 9.584720e-001, 9.587149e-001, 9.589579e-001, 9.592008e-001, 9.594438e-001,
+9.596867e-001, 9.599297e-001, 9.601625e-001, 9.603912e-001, 9.606198e-001, 9.608485e-001, 9.610772e-001, 9.613059e-001, 9.615346e-001, 9.617632e-001,
+9.619919e-001, 9.622206e-001, 9.624493e-001, 9.626779e-001, 9.629066e-001, 9.631353e-001, 9.633640e-001, 9.635927e-001, 9.638213e-001, 9.640500e-001,
+9.642787e-001, 9.645074e-001, 9.647360e-001, 9.649647e-001, 9.651934e-001, 9.654221e-001, 9.656507e-001, 9.658794e-001, 9.661081e-001, 9.663368e-001,
+9.665655e-001, 9.667941e-001, 9.670228e-001, 9.672515e-001, 9.674802e-001, 9.677088e-001, 9.679375e-001, 9.681662e-001, 9.683949e-001, 9.686236e-001,
+9.688522e-001, 9.690809e-001, 9.693096e-001, 9.695383e-001, 9.697669e-001, 9.699956e-001, 9.702112e-001, 9.704266e-001, 9.706419e-001, 9.708573e-001,
+9.710727e-001, 9.712880e-001, 9.715034e-001, 9.717187e-001, 9.719341e-001, 9.721495e-001, 9.723648e-001, 9.725802e-001, 9.727955e-001, 9.730109e-001,
+9.732262e-001, 9.734416e-001, 9.736570e-001, 9.738723e-001, 9.740877e-001, 9.743030e-001, 9.745184e-001, 9.747338e-001, 9.749491e-001, 9.751645e-001,
+9.753798e-001, 9.755952e-001, 9.758105e-001, 9.760259e-001, 9.762413e-001, 9.764566e-001, 9.766720e-001, 9.768873e-001, 9.771027e-001, 9.773180e-001,
+9.775334e-001, 9.777488e-001, 9.779641e-001, 9.781795e-001, 9.783948e-001, 9.786102e-001, 9.788256e-001, 9.790409e-001, 9.792563e-001, 9.794716e-001,
+9.796870e-001, 9.799023e-001, 9.801109e-001, 9.803138e-001, 9.805168e-001, 9.807197e-001, 9.809226e-001, 9.811255e-001, 9.813285e-001, 9.815314e-001,
+9.817343e-001, 9.819373e-001, 9.821402e-001, 9.823431e-001, 9.825460e-001, 9.827490e-001, 9.829519e-001, 9.831548e-001, 9.833577e-001, 9.835607e-001,
+9.837636e-001, 9.839665e-001, 9.841695e-001, 9.843724e-001, 9.845753e-001, 9.847782e-001, 9.849812e-001, 9.851841e-001, 9.853870e-001, 9.855899e-001,
+9.857929e-001, 9.859958e-001, 9.861987e-001, 9.864017e-001, 9.866046e-001, 9.868075e-001, 9.870104e-001, 9.872134e-001, 9.874163e-001, 9.876192e-001,
+9.878221e-001, 9.880251e-001, 9.882280e-001, 9.884309e-001, 9.886339e-001, 9.888368e-001, 9.890397e-001, 9.892426e-001, 9.894456e-001, 9.896485e-001,
+9.898514e-001, 9.900512e-001, 9.902426e-001, 9.904339e-001, 9.906252e-001, 9.908165e-001, 9.910078e-001, 9.911992e-001, 9.913905e-001, 9.915818e-001,
+9.917731e-001, 9.919645e-001, 9.921558e-001, 9.923471e-001, 9.925384e-001, 9.927297e-001, 9.929211e-001, 9.931124e-001, 9.933037e-001, 9.934950e-001,
+9.936864e-001, 9.938777e-001, 9.940690e-001, 9.942603e-001, 9.944517e-001, 9.946430e-001, 9.948343e-001, 9.950256e-001, 9.952169e-001, 9.954083e-001,
+9.955996e-001, 9.957909e-001, 9.959822e-001, 9.961736e-001, 9.963649e-001, 9.965562e-001, 9.967475e-001, 9.969388e-001, 9.971302e-001, 9.973215e-001,
+9.975128e-001, 9.977041e-001, 9.978955e-001, 9.980868e-001, 9.982781e-001, 9.984694e-001, 9.986607e-001, 9.988521e-001, 9.990434e-001, 9.992347e-001,
+9.994260e-001, 9.996174e-001, 9.998087e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.115381e-003, 8.230761e-003, 1.252522e-002, 1.695473e-002, 2.147685e-002, 2.620273e-002, 3.098099e-002, 3.597344e-002, 4.100946e-002,
+4.622715e-002, 5.149310e-002, 5.688509e-002, 6.232650e-002, 6.783551e-002, 7.337935e-002, 7.894573e-002, 8.451167e-002, 9.007678e-002, 9.558951e-002,
+1.010827e-001, 1.064976e-001, 1.118654e-001, 1.171469e-001, 1.223551e-001, 1.274772e-001, 1.325096e-001, 1.374548e-001, 1.423096e-001, 1.470684e-001,
+1.517543e-001, 1.563232e-001, 1.608553e-001, 1.652356e-001, 1.696160e-001, 1.738290e-001, 1.780259e-001, 1.821296e-001, 1.861504e-001, 1.901642e-001,
+1.940181e-001, 1.978720e-001, 2.016555e-001, 2.053524e-001, 2.090493e-001, 2.126374e-001, 2.161877e-001, 2.197380e-001, 2.231622e-001, 2.265763e-001,
+2.299905e-001, 2.332791e-001, 2.365673e-001, 2.398556e-001, 2.430329e-001, 2.462050e-001, 2.493772e-001, 2.524636e-001, 2.555291e-001, 2.585946e-001,
+2.616071e-001, 2.645747e-001, 2.675423e-001, 2.704945e-001, 2.733726e-001, 2.762506e-001, 2.791286e-001, 2.819496e-001, 2.847457e-001, 2.875418e-001,
+2.903289e-001, 2.930503e-001, 2.957717e-001, 2.984931e-001, 3.011841e-001, 3.038373e-001, 3.064906e-001, 3.091438e-001, 3.117550e-001, 3.143462e-001,
+3.169374e-001, 3.195286e-001, 3.220736e-001, 3.246083e-001, 3.271430e-001, 3.296778e-001, 3.321677e-001, 3.346511e-001, 3.371345e-001, 3.396179e-001,
+3.420618e-001, 3.444986e-001, 3.469354e-001, 3.493721e-001, 3.517775e-001, 3.541719e-001, 3.565663e-001, 3.589607e-001, 3.613333e-001, 3.636893e-001,
+3.660452e-001, 3.684012e-001, 3.707459e-001, 3.730669e-001, 3.753878e-001, 3.777088e-001, 3.800294e-001, 3.823185e-001, 3.846076e-001, 3.868968e-001,
+3.891859e-001, 3.914563e-001, 3.937164e-001, 3.959765e-001, 3.982365e-001, 4.004907e-001, 4.027242e-001, 4.049576e-001, 4.071910e-001, 4.094245e-001,
+4.116397e-001, 4.138485e-001, 4.160574e-001, 4.182663e-001, 4.204702e-001, 4.226563e-001, 4.248423e-001, 4.270283e-001, 4.292143e-001, 4.313866e-001,
+4.335512e-001, 4.357158e-001, 4.378803e-001, 4.400445e-001, 4.421886e-001, 4.443328e-001, 4.464769e-001, 4.486211e-001, 4.507582e-001, 4.528826e-001,
+4.550069e-001, 4.571313e-001, 4.592557e-001, 4.613675e-001, 4.634724e-001, 4.655774e-001, 4.676823e-001, 4.697872e-001, 4.718747e-001, 4.739601e-001,
+4.760456e-001, 4.781310e-001, 4.802144e-001, 4.822799e-001, 4.843455e-001, 4.864110e-001, 4.884765e-001, 4.905366e-001, 4.925815e-001, 4.946263e-001,
+4.966711e-001, 4.987160e-001, 5.007527e-001, 5.027757e-001, 5.047987e-001, 5.068217e-001, 5.088446e-001, 5.108576e-001, 5.128573e-001, 5.148569e-001,
+5.168566e-001, 5.188563e-001, 5.208451e-001, 5.228196e-001, 5.247941e-001, 5.267686e-001, 5.287431e-001, 5.307077e-001, 5.326549e-001, 5.346020e-001,
+5.365492e-001, 5.384964e-001, 5.404369e-001, 5.423543e-001, 5.442718e-001, 5.461893e-001, 5.481068e-001, 5.500238e-001, 5.519090e-001, 5.537941e-001,
+5.556792e-001, 5.575644e-001, 5.594495e-001, 5.613097e-001, 5.631597e-001, 5.650097e-001, 5.668596e-001, 5.687096e-001, 5.705480e-001, 5.723599e-001,
+5.741717e-001, 5.759836e-001, 5.777954e-001, 5.796073e-001, 5.813869e-001, 5.831577e-001, 5.849284e-001, 5.866992e-001, 5.884700e-001, 5.902347e-001,
+5.919614e-001, 5.936881e-001, 5.954148e-001, 5.971414e-001, 5.988681e-001, 6.005786e-001, 6.022584e-001, 6.039381e-001, 6.056178e-001, 6.072976e-001,
+6.089773e-001, 6.106376e-001, 6.122677e-001, 6.138977e-001, 6.155278e-001, 6.171579e-001, 6.187879e-001, 6.204046e-001, 6.219826e-001, 6.235605e-001,
+6.251384e-001, 6.267164e-001, 6.282943e-001, 6.298722e-001, 6.314002e-001, 6.329238e-001, 6.344474e-001, 6.359710e-001, 6.374946e-001, 6.390183e-001,
+6.405219e-001, 6.419894e-001, 6.434568e-001, 6.449243e-001, 6.463917e-001, 6.478592e-001, 6.493266e-001, 6.507629e-001, 6.521728e-001, 6.535827e-001,
+6.549925e-001, 6.564024e-001, 6.578122e-001, 6.592221e-001, 6.606057e-001, 6.619569e-001, 6.633082e-001, 6.646594e-001, 6.660107e-001, 6.673619e-001,
+6.687131e-001, 6.700616e-001, 6.713536e-001, 6.726456e-001, 6.739376e-001, 6.752296e-001, 6.765217e-001, 6.778137e-001, 6.791057e-001, 6.803794e-001,
+6.816121e-001, 6.828447e-001, 6.840773e-001, 6.853099e-001, 6.865425e-001, 6.877752e-001, 6.890078e-001, 6.902289e-001, 6.914023e-001, 6.925758e-001,
+6.937493e-001, 6.949227e-001, 6.960962e-001, 6.972696e-001, 6.984431e-001, 6.996166e-001, 7.007506e-001, 7.018656e-001, 7.029805e-001, 7.040954e-001,
+7.052103e-001, 7.063253e-001, 7.074402e-001, 7.085551e-001, 7.096700e-001, 7.107444e-001, 7.118018e-001, 7.128592e-001, 7.139165e-001, 7.149739e-001,
+7.160312e-001, 7.170886e-001, 7.181460e-001, 7.192033e-001, 7.202468e-001, 7.212479e-001, 7.222490e-001, 7.232501e-001, 7.242512e-001, 7.252523e-001,
+7.262533e-001, 7.272544e-001, 7.282555e-001, 7.292566e-001, 7.302436e-001, 7.311900e-001, 7.321363e-001, 7.330827e-001, 7.340291e-001, 7.349754e-001,
+7.359218e-001, 7.368682e-001, 7.378145e-001, 7.387609e-001, 7.397073e-001, 7.406171e-001, 7.415105e-001, 7.424039e-001, 7.432974e-001, 7.441908e-001,
+7.450842e-001, 7.459776e-001, 7.468711e-001, 7.477645e-001, 7.486579e-001, 7.495513e-001, 7.504194e-001, 7.512618e-001, 7.521043e-001, 7.529467e-001,
+7.537891e-001, 7.546316e-001, 7.554740e-001, 7.563164e-001, 7.571589e-001, 7.580013e-001, 7.588438e-001, 7.596862e-001, 7.604980e-001, 7.612915e-001,
+7.620850e-001, 7.628786e-001, 7.636721e-001, 7.644656e-001, 7.652592e-001, 7.660527e-001, 7.668462e-001, 7.676398e-001, 7.684333e-001, 7.692268e-001,
+7.700192e-001, 7.707660e-001, 7.715128e-001, 7.722596e-001, 7.730064e-001, 7.737532e-001, 7.745001e-001, 7.752469e-001, 7.759937e-001, 7.767405e-001,
+7.774873e-001, 7.782341e-001, 7.789809e-001, 7.797278e-001, 7.804463e-001, 7.811486e-001, 7.818509e-001, 7.825533e-001, 7.832556e-001, 7.839579e-001,
+7.846602e-001, 7.853626e-001, 7.860649e-001, 7.867672e-001, 7.874695e-001, 7.881719e-001, 7.888742e-001, 7.895765e-001, 7.902621e-001, 7.909221e-001,
+7.915822e-001, 7.922423e-001, 7.929024e-001, 7.935625e-001, 7.942226e-001, 7.948827e-001, 7.955428e-001, 7.962028e-001, 7.968629e-001, 7.975230e-001,
+7.981831e-001, 7.988432e-001, 7.995033e-001, 8.001535e-001, 8.007736e-001, 8.013937e-001, 8.020138e-001, 8.026339e-001, 8.032540e-001, 8.038741e-001,
+8.044942e-001, 8.051143e-001, 8.057344e-001, 8.063545e-001, 8.069746e-001, 8.075947e-001, 8.082148e-001, 8.088349e-001, 8.094550e-001, 8.100706e-001,
+8.106529e-001, 8.112352e-001, 8.118176e-001, 8.123999e-001, 8.129822e-001, 8.135646e-001, 8.141469e-001, 8.147293e-001, 8.153116e-001, 8.158939e-001,
+8.164763e-001, 8.170586e-001, 8.176409e-001, 8.182233e-001, 8.188056e-001, 8.193880e-001, 8.199703e-001, 8.205189e-001, 8.210656e-001, 8.216123e-001,
+8.221591e-001, 8.227058e-001, 8.232526e-001, 8.237993e-001, 8.243461e-001, 8.248928e-001, 8.254395e-001, 8.259863e-001, 8.265330e-001, 8.270798e-001,
+8.276265e-001, 8.281733e-001, 8.287200e-001, 8.292668e-001, 8.298135e-001, 8.303382e-001, 8.308514e-001, 8.313647e-001, 8.318779e-001, 8.323912e-001,
+8.329045e-001, 8.334177e-001, 8.339310e-001, 8.344442e-001, 8.349575e-001, 8.354707e-001, 8.359840e-001, 8.364972e-001, 8.370105e-001, 8.375238e-001,
+8.380370e-001, 8.385503e-001, 8.390635e-001, 8.395768e-001, 8.400845e-001, 8.405663e-001, 8.410481e-001, 8.415299e-001, 8.420117e-001, 8.424935e-001,
+8.429753e-001, 8.434571e-001, 8.439389e-001, 8.444207e-001, 8.449025e-001, 8.453843e-001, 8.458661e-001, 8.463479e-001, 8.468297e-001, 8.473115e-001,
+8.477933e-001, 8.482751e-001, 8.487569e-001, 8.492387e-001, 8.497205e-001, 8.501899e-001, 8.506422e-001, 8.510945e-001, 8.515468e-001, 8.519991e-001,
+8.524514e-001, 8.529037e-001, 8.533560e-001, 8.538083e-001, 8.542606e-001, 8.547129e-001, 8.551652e-001, 8.556174e-001, 8.560697e-001, 8.565220e-001,
+8.569743e-001, 8.574266e-001, 8.578789e-001, 8.583312e-001, 8.587835e-001, 8.592358e-001, 8.596881e-001, 8.601318e-001, 8.605564e-001, 8.609811e-001,
+8.614057e-001, 8.618304e-001, 8.622550e-001, 8.626796e-001, 8.631043e-001, 8.635289e-001, 8.639536e-001, 8.643782e-001, 8.648028e-001, 8.652275e-001,
+8.656521e-001, 8.660768e-001, 8.665014e-001, 8.669261e-001, 8.673507e-001, 8.677753e-001, 8.682000e-001, 8.686246e-001, 8.690493e-001, 8.694739e-001,
+8.698986e-001, 8.703035e-001, 8.707023e-001, 8.711010e-001, 8.714998e-001, 8.718985e-001, 8.722973e-001, 8.726960e-001, 8.730948e-001, 8.734936e-001,
+8.738923e-001, 8.742911e-001, 8.746898e-001, 8.750886e-001, 8.754873e-001, 8.758861e-001, 8.762848e-001, 8.766836e-001, 8.770824e-001, 8.774811e-001,
+8.778799e-001, 8.782786e-001, 8.786774e-001, 8.790761e-001, 8.794749e-001, 8.798737e-001, 8.802559e-001, 8.806304e-001, 8.810050e-001, 8.813795e-001,
+8.817540e-001, 8.821286e-001, 8.825031e-001, 8.828777e-001, 8.832522e-001, 8.836268e-001, 8.840013e-001, 8.843758e-001, 8.847504e-001, 8.851249e-001,
+8.854995e-001, 8.858740e-001, 8.862486e-001, 8.866231e-001, 8.869976e-001, 8.873722e-001, 8.877467e-001, 8.881213e-001, 8.884958e-001, 8.888703e-001,
+8.892449e-001, 8.896194e-001, 8.899940e-001, 8.903462e-001, 8.906981e-001, 8.910500e-001, 8.914020e-001, 8.917539e-001, 8.921058e-001, 8.924577e-001,
+8.928096e-001, 8.931615e-001, 8.935134e-001, 8.938653e-001, 8.942172e-001, 8.945691e-001, 8.949210e-001, 8.952729e-001, 8.956248e-001, 8.959767e-001,
+8.963286e-001, 8.966805e-001, 8.970324e-001, 8.973843e-001, 8.977362e-001, 8.980881e-001, 8.984400e-001, 8.987919e-001, 8.991438e-001, 8.994957e-001,
+8.998476e-001, 9.001875e-001, 9.005183e-001, 9.008490e-001, 9.011798e-001, 9.015105e-001, 9.018413e-001, 9.021720e-001, 9.025028e-001, 9.028335e-001,
+9.031643e-001, 9.034950e-001, 9.038258e-001, 9.041565e-001, 9.044873e-001, 9.048180e-001, 9.051488e-001, 9.054795e-001, 9.058103e-001, 9.061410e-001,
+9.064718e-001, 9.068025e-001, 9.071333e-001, 9.074640e-001, 9.077947e-001, 9.081255e-001, 9.084562e-001, 9.087870e-001, 9.091177e-001, 9.094485e-001,
+9.097792e-001, 9.101034e-001, 9.104144e-001, 9.107254e-001, 9.110364e-001, 9.113474e-001, 9.116583e-001, 9.119693e-001, 9.122803e-001, 9.125913e-001,
+9.129023e-001, 9.132133e-001, 9.135242e-001, 9.138352e-001, 9.141462e-001, 9.144572e-001, 9.147682e-001, 9.150792e-001, 9.153902e-001, 9.157011e-001,
+9.160121e-001, 9.163231e-001, 9.166341e-001, 9.169451e-001, 9.172561e-001, 9.175670e-001, 9.178780e-001, 9.181890e-001, 9.185000e-001, 9.188110e-001,
+9.191220e-001, 9.194330e-001, 9.197439e-001, 9.200517e-001, 9.203442e-001, 9.206367e-001, 9.209292e-001, 9.212218e-001, 9.215143e-001, 9.218068e-001,
+9.220994e-001, 9.223919e-001, 9.226844e-001, 9.229769e-001, 9.232695e-001, 9.235620e-001, 9.238545e-001, 9.241470e-001, 9.244396e-001, 9.247321e-001,
+9.250246e-001, 9.253171e-001, 9.256097e-001, 9.259022e-001, 9.261947e-001, 9.264872e-001, 9.267798e-001, 9.270723e-001, 9.273648e-001, 9.276573e-001,
+9.279499e-001, 9.282424e-001, 9.285349e-001, 9.288275e-001, 9.291200e-001, 9.294125e-001, 9.297050e-001, 9.299976e-001, 9.302730e-001, 9.305483e-001,
+9.308236e-001, 9.310989e-001, 9.313741e-001, 9.316494e-001, 9.319247e-001, 9.322000e-001, 9.324753e-001, 9.327506e-001, 9.330259e-001, 9.333012e-001,
+9.335764e-001, 9.338517e-001, 9.341270e-001, 9.344023e-001, 9.346776e-001, 9.349529e-001, 9.352282e-001, 9.355035e-001, 9.357787e-001, 9.360540e-001,
+9.363293e-001, 9.366046e-001, 9.368799e-001, 9.371552e-001, 9.374305e-001, 9.377058e-001, 9.379811e-001, 9.382563e-001, 9.385316e-001, 9.388069e-001,
+9.390822e-001, 9.393575e-001, 9.396328e-001, 9.399081e-001, 9.401726e-001, 9.404318e-001, 9.406910e-001, 9.409502e-001, 9.412094e-001, 9.414686e-001,
+9.417278e-001, 9.419870e-001, 9.422462e-001, 9.425053e-001, 9.427645e-001, 9.430237e-001, 9.432829e-001, 9.435421e-001, 9.438013e-001, 9.440605e-001,
+9.443197e-001, 9.445789e-001, 9.448380e-001, 9.450972e-001, 9.453564e-001, 9.456156e-001, 9.458748e-001, 9.461340e-001, 9.463932e-001, 9.466524e-001,
+9.469116e-001, 9.471708e-001, 9.474299e-001, 9.476891e-001, 9.479483e-001, 9.482075e-001, 9.484667e-001, 9.487259e-001, 9.489851e-001, 9.492443e-001,
+9.495035e-001, 9.497626e-001, 9.500206e-001, 9.502647e-001, 9.505089e-001, 9.507530e-001, 9.509972e-001, 9.512413e-001, 9.514855e-001, 9.517297e-001,
+9.519738e-001, 9.522180e-001, 9.524621e-001, 9.527063e-001, 9.529504e-001, 9.531946e-001, 9.534387e-001, 9.536829e-001, 9.539270e-001, 9.541712e-001,
+9.544154e-001, 9.546595e-001, 9.549037e-001, 9.551478e-001, 9.553920e-001, 9.556361e-001, 9.558803e-001, 9.561244e-001, 9.563686e-001, 9.566128e-001,
+9.568569e-001, 9.571011e-001, 9.573452e-001, 9.575894e-001, 9.578335e-001, 9.580777e-001, 9.583218e-001, 9.585660e-001, 9.588101e-001, 9.590543e-001,
+9.592985e-001, 9.595426e-001, 9.597868e-001, 9.600291e-001, 9.602593e-001, 9.604894e-001, 9.607195e-001, 9.609496e-001, 9.611797e-001, 9.614098e-001,
+9.616399e-001, 9.618700e-001, 9.621001e-001, 9.623303e-001, 9.625604e-001, 9.627905e-001, 9.630206e-001, 9.632507e-001, 9.634808e-001, 9.637109e-001,
+9.639410e-001, 9.641712e-001, 9.644013e-001, 9.646314e-001, 9.648615e-001, 9.650916e-001, 9.653217e-001, 9.655518e-001, 9.657819e-001, 9.660120e-001,
+9.662422e-001, 9.664723e-001, 9.667024e-001, 9.669325e-001, 9.671626e-001, 9.673927e-001, 9.676228e-001, 9.678529e-001, 9.680831e-001, 9.683132e-001,
+9.685433e-001, 9.687734e-001, 9.690035e-001, 9.692336e-001, 9.694637e-001, 9.696938e-001, 9.699239e-001, 9.701453e-001, 9.703623e-001, 9.705793e-001,
+9.707963e-001, 9.710132e-001, 9.712302e-001, 9.714472e-001, 9.716642e-001, 9.718812e-001, 9.720982e-001, 9.723152e-001, 9.725322e-001, 9.727492e-001,
+9.729662e-001, 9.731832e-001, 9.734002e-001, 9.736171e-001, 9.738341e-001, 9.740511e-001, 9.742681e-001, 9.744851e-001, 9.747021e-001, 9.749191e-001,
+9.751361e-001, 9.753531e-001, 9.755701e-001, 9.757871e-001, 9.760041e-001, 9.762211e-001, 9.764380e-001, 9.766550e-001, 9.768720e-001, 9.770890e-001,
+9.773060e-001, 9.775230e-001, 9.777400e-001, 9.779570e-001, 9.781740e-001, 9.783910e-001, 9.786080e-001, 9.788250e-001, 9.790419e-001, 9.792589e-001,
+9.794759e-001, 9.796929e-001, 9.799099e-001, 9.801197e-001, 9.803245e-001, 9.805292e-001, 9.807339e-001, 9.809387e-001, 9.811434e-001, 9.813481e-001,
+9.815529e-001, 9.817576e-001, 9.819623e-001, 9.821671e-001, 9.823718e-001, 9.825765e-001, 9.827813e-001, 9.829860e-001, 9.831907e-001, 9.833955e-001,
+9.836002e-001, 9.838049e-001, 9.840096e-001, 9.842144e-001, 9.844191e-001, 9.846238e-001, 9.848286e-001, 9.850333e-001, 9.852380e-001, 9.854428e-001,
+9.856475e-001, 9.858522e-001, 9.860570e-001, 9.862617e-001, 9.864664e-001, 9.866712e-001, 9.868759e-001, 9.870806e-001, 9.872854e-001, 9.874901e-001,
+9.876948e-001, 9.878996e-001, 9.881043e-001, 9.883090e-001, 9.885138e-001, 9.887185e-001, 9.889232e-001, 9.891279e-001, 9.893327e-001, 9.895374e-001,
+9.897421e-001, 9.899469e-001, 9.901431e-001, 9.903364e-001, 9.905297e-001, 9.907229e-001, 9.909162e-001, 9.911095e-001, 9.913028e-001, 9.914960e-001,
+9.916893e-001, 9.918826e-001, 9.920758e-001, 9.922691e-001, 9.924624e-001, 9.926557e-001, 9.928489e-001, 9.930422e-001, 9.932355e-001, 9.934287e-001,
+9.936220e-001, 9.938153e-001, 9.940086e-001, 9.942018e-001, 9.943951e-001, 9.945884e-001, 9.947817e-001, 9.949749e-001, 9.951682e-001, 9.953615e-001,
+9.955547e-001, 9.957480e-001, 9.959413e-001, 9.961346e-001, 9.963278e-001, 9.965211e-001, 9.967144e-001, 9.969076e-001, 9.971009e-001, 9.972942e-001,
+9.974875e-001, 9.976807e-001, 9.978740e-001, 9.980673e-001, 9.982606e-001, 9.984538e-001, 9.986471e-001, 9.988404e-001, 9.990336e-001, 9.992269e-001,
+9.994202e-001, 9.996135e-001, 9.998067e-001, 1.000000e+000)),
+("Kodak", "DSCS 3153", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.355690e-003, 6.711381e-003, 1.007196e-002, 1.367220e-002, 1.727245e-002, 2.092887e-002, 2.476088e-002, 2.859289e-002, 3.255814e-002,
+3.660070e-002, 4.067210e-002, 4.489588e-002, 4.911967e-002, 5.345823e-002, 5.782700e-002, 6.224798e-002, 6.672062e-002, 7.120938e-002, 7.574246e-002,
+8.027659e-002, 8.482714e-002, 8.937768e-002, 9.390876e-002, 9.843675e-002, 1.029270e-001, 1.073973e-001, 1.118313e-001, 1.162149e-001, 1.205835e-001,
+1.248578e-001, 1.291321e-001, 1.333064e-001, 1.374553e-001, 1.415516e-001, 1.455647e-001, 1.495777e-001, 1.534643e-001, 1.573361e-001, 1.611633e-001,
+1.648924e-001, 1.686215e-001, 1.722616e-001, 1.758497e-001, 1.794377e-001, 1.829102e-001, 1.863612e-001, 1.898121e-001, 1.931388e-001, 1.964583e-001,
+1.997778e-001, 2.029809e-001, 2.061756e-001, 2.093703e-001, 2.124707e-001, 2.155478e-001, 2.186250e-001, 2.216414e-001, 2.246086e-001, 2.275758e-001,
+2.305242e-001, 2.333891e-001, 2.362540e-001, 2.391189e-001, 2.419181e-001, 2.446881e-001, 2.474582e-001, 2.502210e-001, 2.529035e-001, 2.555860e-001,
+2.582685e-001, 2.609224e-001, 2.635244e-001, 2.661263e-001, 2.687282e-001, 2.712923e-001, 2.738203e-001, 2.763483e-001, 2.788763e-001, 2.813667e-001,
+2.838270e-001, 2.862873e-001, 2.887476e-001, 2.911775e-001, 2.935760e-001, 2.959744e-001, 2.983729e-001, 3.007532e-001, 3.030953e-001, 3.054375e-001,
+3.077796e-001, 3.101191e-001, 3.124100e-001, 3.147009e-001, 3.169918e-001, 3.192827e-001, 3.215417e-001, 3.237861e-001, 3.260306e-001, 3.282750e-001,
+3.305097e-001, 3.327121e-001, 3.349145e-001, 3.371169e-001, 3.393193e-001, 3.414955e-001, 3.436600e-001, 3.458244e-001, 3.479889e-001, 3.501509e-001,
+3.522812e-001, 3.544115e-001, 3.565418e-001, 3.586720e-001, 3.607908e-001, 3.628903e-001, 3.649899e-001, 3.670895e-001, 3.691891e-001, 3.712718e-001,
+3.733438e-001, 3.754159e-001, 3.774880e-001, 3.795600e-001, 3.816127e-001, 3.836602e-001, 3.857076e-001, 3.877551e-001, 3.898025e-001, 3.918301e-001,
+3.938556e-001, 3.958811e-001, 3.979066e-001, 3.999320e-001, 4.019385e-001, 4.039444e-001, 4.059503e-001, 4.079561e-001, 4.099620e-001, 4.119506e-001,
+4.139389e-001, 4.159272e-001, 4.179156e-001, 4.199039e-001, 4.218772e-001, 4.238498e-001, 4.258224e-001, 4.277950e-001, 4.297676e-001, 4.317277e-001,
+4.336861e-001, 4.356445e-001, 4.376029e-001, 4.395613e-001, 4.415097e-001, 4.434552e-001, 4.454007e-001, 4.473461e-001, 4.492916e-001, 4.512295e-001,
+4.531630e-001, 4.550965e-001, 4.570300e-001, 4.589635e-001, 4.608917e-001, 4.628139e-001, 4.647361e-001, 4.666583e-001, 4.685805e-001, 4.704998e-001,
+4.724110e-001, 4.743222e-001, 4.762334e-001, 4.781446e-001, 4.800555e-001, 4.819558e-001, 4.838560e-001, 4.857563e-001, 4.876565e-001, 4.895568e-001,
+4.914484e-001, 4.933373e-001, 4.952263e-001, 4.971152e-001, 4.990042e-001, 5.008875e-001, 5.027645e-001, 5.046415e-001, 5.065185e-001, 5.083955e-001,
+5.102707e-001, 5.121347e-001, 5.139987e-001, 5.158627e-001, 5.177268e-001, 5.195908e-001, 5.214436e-001, 5.232933e-001, 5.251430e-001, 5.269927e-001,
+5.288423e-001, 5.306860e-001, 5.325196e-001, 5.343532e-001, 5.361868e-001, 5.380204e-001, 5.398540e-001, 5.416709e-001, 5.434863e-001, 5.453018e-001,
+5.471173e-001, 5.489327e-001, 5.507397e-001, 5.525347e-001, 5.543296e-001, 5.561246e-001, 5.579195e-001, 5.597144e-001, 5.614899e-001, 5.632617e-001,
+5.650334e-001, 5.668052e-001, 5.685770e-001, 5.703436e-001, 5.720893e-001, 5.738349e-001, 5.755806e-001, 5.773263e-001, 5.790720e-001, 5.808040e-001,
+5.825205e-001, 5.842370e-001, 5.859535e-001, 5.876700e-001, 5.893865e-001, 5.910822e-001, 5.927663e-001, 5.944504e-001, 5.961345e-001, 5.978186e-001,
+5.995027e-001, 6.011616e-001, 6.028101e-001, 6.044585e-001, 6.061069e-001, 6.077553e-001, 6.094037e-001, 6.110272e-001, 6.126367e-001, 6.142462e-001,
+6.158556e-001, 6.174651e-001, 6.190745e-001, 6.206661e-001, 6.222334e-001, 6.238007e-001, 6.253681e-001, 6.269354e-001, 6.285027e-001, 6.300681e-001,
+6.315903e-001, 6.331125e-001, 6.346347e-001, 6.361569e-001, 6.376791e-001, 6.392014e-001, 6.407008e-001, 6.421752e-001, 6.436495e-001, 6.451239e-001,
+6.465982e-001, 6.480726e-001, 6.495469e-001, 6.509865e-001, 6.524105e-001, 6.538346e-001, 6.552587e-001, 6.566827e-001, 6.581068e-001, 6.595309e-001,
+6.609198e-001, 6.622916e-001, 6.636633e-001, 6.650350e-001, 6.664068e-001, 6.677785e-001, 6.691502e-001, 6.705014e-001, 6.718192e-001, 6.731369e-001,
+6.744547e-001, 6.757724e-001, 6.770902e-001, 6.784079e-001, 6.797257e-001, 6.809998e-001, 6.822623e-001, 6.835249e-001, 6.847875e-001, 6.860501e-001,
+6.873127e-001, 6.885753e-001, 6.898379e-001, 6.910517e-001, 6.922584e-001, 6.934651e-001, 6.946717e-001, 6.958784e-001, 6.970851e-001, 6.982918e-001,
+6.994984e-001, 7.006723e-001, 7.018228e-001, 7.029732e-001, 7.041237e-001, 7.052742e-001, 7.064247e-001, 7.075752e-001, 7.087256e-001, 7.098761e-001,
+7.109766e-001, 7.120710e-001, 7.131654e-001, 7.142598e-001, 7.153543e-001, 7.164487e-001, 7.175431e-001, 7.186375e-001, 7.197320e-001, 7.207845e-001,
+7.218234e-001, 7.228623e-001, 7.239012e-001, 7.249401e-001, 7.259791e-001, 7.270180e-001, 7.280569e-001, 7.290958e-001, 7.301276e-001, 7.311120e-001,
+7.320963e-001, 7.330806e-001, 7.340650e-001, 7.350493e-001, 7.360336e-001, 7.370179e-001, 7.380023e-001, 7.389866e-001, 7.399709e-001, 7.409035e-001,
+7.418344e-001, 7.427654e-001, 7.436964e-001, 7.446273e-001, 7.455583e-001, 7.464893e-001, 7.474203e-001, 7.483512e-001, 7.492822e-001, 7.502013e-001,
+7.510804e-001, 7.519595e-001, 7.528387e-001, 7.537178e-001, 7.545969e-001, 7.554760e-001, 7.563552e-001, 7.572343e-001, 7.581134e-001, 7.589925e-001,
+7.598717e-001, 7.607080e-001, 7.615370e-001, 7.623660e-001, 7.631950e-001, 7.640240e-001, 7.648531e-001, 7.656821e-001, 7.665111e-001, 7.673401e-001,
+7.681691e-001, 7.689981e-001, 7.698271e-001, 7.706180e-001, 7.713988e-001, 7.721796e-001, 7.729604e-001, 7.737412e-001, 7.745220e-001, 7.753028e-001,
+7.760836e-001, 7.768645e-001, 7.776453e-001, 7.784261e-001, 7.792069e-001, 7.799877e-001, 7.807231e-001, 7.814577e-001, 7.821923e-001, 7.829270e-001,
+7.836616e-001, 7.843963e-001, 7.851309e-001, 7.858656e-001, 7.866002e-001, 7.873348e-001, 7.880695e-001, 7.888041e-001, 7.895388e-001, 7.902570e-001,
+7.909476e-001, 7.916382e-001, 7.923288e-001, 7.930194e-001, 7.937100e-001, 7.944006e-001, 7.950912e-001, 7.957818e-001, 7.964724e-001, 7.971630e-001,
+7.978536e-001, 7.985442e-001, 7.992348e-001, 7.999254e-001, 8.005787e-001, 8.012274e-001, 8.018762e-001, 8.025249e-001, 8.031736e-001, 8.038224e-001,
+8.044711e-001, 8.051198e-001, 8.057686e-001, 8.064173e-001, 8.070660e-001, 8.077148e-001, 8.083635e-001, 8.090122e-001, 8.096610e-001, 8.102908e-001,
+8.108998e-001, 8.115089e-001, 8.121179e-001, 8.127270e-001, 8.133360e-001, 8.139451e-001, 8.145542e-001, 8.151632e-001, 8.157723e-001, 8.163813e-001,
+8.169904e-001, 8.175994e-001, 8.182085e-001, 8.188176e-001, 8.194266e-001, 8.200335e-001, 8.206050e-001, 8.211766e-001, 8.217482e-001, 8.223197e-001,
+8.228913e-001, 8.234628e-001, 8.240344e-001, 8.246060e-001, 8.251775e-001, 8.257491e-001, 8.263206e-001, 8.268922e-001, 8.274638e-001, 8.280353e-001,
+8.286069e-001, 8.291784e-001, 8.297500e-001, 8.303017e-001, 8.308379e-001, 8.313741e-001, 8.319103e-001, 8.324465e-001, 8.329827e-001, 8.335189e-001,
+8.340551e-001, 8.345913e-001, 8.351275e-001, 8.356637e-001, 8.361999e-001, 8.367361e-001, 8.372723e-001, 8.378085e-001, 8.383447e-001, 8.388810e-001,
+8.394172e-001, 8.399534e-001, 8.404592e-001, 8.409621e-001, 8.414651e-001, 8.419680e-001, 8.424710e-001, 8.429739e-001, 8.434769e-001, 8.439798e-001,
+8.444827e-001, 8.449857e-001, 8.454886e-001, 8.459916e-001, 8.464945e-001, 8.469974e-001, 8.475004e-001, 8.480033e-001, 8.485063e-001, 8.490092e-001,
+8.495122e-001, 8.500142e-001, 8.504859e-001, 8.509576e-001, 8.514293e-001, 8.519010e-001, 8.523727e-001, 8.528444e-001, 8.533161e-001, 8.537878e-001,
+8.542595e-001, 8.547312e-001, 8.552029e-001, 8.556746e-001, 8.561463e-001, 8.566180e-001, 8.570897e-001, 8.575614e-001, 8.580331e-001, 8.585048e-001,
+8.589765e-001, 8.594482e-001, 8.599199e-001, 8.603672e-001, 8.608097e-001, 8.612521e-001, 8.616945e-001, 8.621369e-001, 8.625793e-001, 8.630217e-001,
+8.634641e-001, 8.639065e-001, 8.643489e-001, 8.647913e-001, 8.652337e-001, 8.656761e-001, 8.661185e-001, 8.665609e-001, 8.670033e-001, 8.674457e-001,
+8.678881e-001, 8.683305e-001, 8.687729e-001, 8.692153e-001, 8.696577e-001, 8.700939e-001, 8.705089e-001, 8.709239e-001, 8.713388e-001, 8.717538e-001,
+8.721687e-001, 8.725837e-001, 8.729987e-001, 8.734136e-001, 8.738286e-001, 8.742436e-001, 8.746585e-001, 8.750735e-001, 8.754885e-001, 8.759034e-001,
+8.763184e-001, 8.767334e-001, 8.771483e-001, 8.775633e-001, 8.779783e-001, 8.783932e-001, 8.788082e-001, 8.792232e-001, 8.796381e-001, 8.800498e-001,
+8.804391e-001, 8.808284e-001, 8.812177e-001, 8.816070e-001, 8.819963e-001, 8.823856e-001, 8.827749e-001, 8.831642e-001, 8.835535e-001, 8.839427e-001,
+8.843320e-001, 8.847213e-001, 8.851106e-001, 8.854999e-001, 8.858892e-001, 8.862785e-001, 8.866678e-001, 8.870571e-001, 8.874464e-001, 8.878357e-001,
+8.882250e-001, 8.886143e-001, 8.890036e-001, 8.893929e-001, 8.897822e-001, 8.901609e-001, 8.905262e-001, 8.908915e-001, 8.912568e-001, 8.916221e-001,
+8.919874e-001, 8.923527e-001, 8.927180e-001, 8.930833e-001, 8.934486e-001, 8.938139e-001, 8.941792e-001, 8.945445e-001, 8.949098e-001, 8.952751e-001,
+8.956404e-001, 8.960057e-001, 8.963710e-001, 8.967363e-001, 8.971016e-001, 8.974669e-001, 8.978322e-001, 8.981975e-001, 8.985628e-001, 8.989281e-001,
+8.992933e-001, 8.996586e-001, 9.000225e-001, 9.003654e-001, 9.007082e-001, 9.010511e-001, 9.013940e-001, 9.017369e-001, 9.020798e-001, 9.024227e-001,
+9.027655e-001, 9.031084e-001, 9.034513e-001, 9.037942e-001, 9.041371e-001, 9.044800e-001, 9.048228e-001, 9.051657e-001, 9.055086e-001, 9.058515e-001,
+9.061944e-001, 9.065372e-001, 9.068801e-001, 9.072230e-001, 9.075659e-001, 9.079088e-001, 9.082517e-001, 9.085945e-001, 9.089374e-001, 9.092803e-001,
+9.096232e-001, 9.099661e-001, 9.102901e-001, 9.106121e-001, 9.109340e-001, 9.112560e-001, 9.115779e-001, 9.118999e-001, 9.122218e-001, 9.125438e-001,
+9.128657e-001, 9.131877e-001, 9.135096e-001, 9.138316e-001, 9.141536e-001, 9.144755e-001, 9.147975e-001, 9.151194e-001, 9.154414e-001, 9.157633e-001,
+9.160853e-001, 9.164072e-001, 9.167292e-001, 9.170511e-001, 9.173731e-001, 9.176951e-001, 9.180170e-001, 9.183390e-001, 9.186609e-001, 9.189829e-001,
+9.193048e-001, 9.196268e-001, 9.199487e-001, 9.202543e-001, 9.205567e-001, 9.208591e-001, 9.211615e-001, 9.214640e-001, 9.217664e-001, 9.220688e-001,
+9.223712e-001, 9.226737e-001, 9.229761e-001, 9.232785e-001, 9.235809e-001, 9.238833e-001, 9.241858e-001, 9.244882e-001, 9.247906e-001, 9.250930e-001,
+9.253955e-001, 9.256979e-001, 9.260003e-001, 9.263027e-001, 9.266052e-001, 9.269076e-001, 9.272100e-001, 9.275124e-001, 9.278148e-001, 9.281173e-001,
+9.284197e-001, 9.287221e-001, 9.290245e-001, 9.293270e-001, 9.296294e-001, 9.299318e-001, 9.302201e-001, 9.305043e-001, 9.307885e-001, 9.310727e-001,
+9.313569e-001, 9.316411e-001, 9.319253e-001, 9.322095e-001, 9.324937e-001, 9.327779e-001, 9.330621e-001, 9.333463e-001, 9.336305e-001, 9.339147e-001,
+9.341989e-001, 9.344831e-001, 9.347673e-001, 9.350515e-001, 9.353357e-001, 9.356199e-001, 9.359041e-001, 9.361883e-001, 9.364725e-001, 9.367567e-001,
+9.370409e-001, 9.373251e-001, 9.376093e-001, 9.378935e-001, 9.381777e-001, 9.384619e-001, 9.387461e-001, 9.390303e-001, 9.393145e-001, 9.395987e-001,
+9.398829e-001, 9.401571e-001, 9.404243e-001, 9.406915e-001, 9.409587e-001, 9.412259e-001, 9.414931e-001, 9.417603e-001, 9.420275e-001, 9.422946e-001,
+9.425618e-001, 9.428290e-001, 9.430962e-001, 9.433634e-001, 9.436306e-001, 9.438978e-001, 9.441650e-001, 9.444322e-001, 9.446994e-001, 9.449666e-001,
+9.452338e-001, 9.455010e-001, 9.457682e-001, 9.460354e-001, 9.463026e-001, 9.465698e-001, 9.468370e-001, 9.471042e-001, 9.473714e-001, 9.476386e-001,
+9.479058e-001, 9.481730e-001, 9.484402e-001, 9.487074e-001, 9.489746e-001, 9.492418e-001, 9.495090e-001, 9.497762e-001, 9.500408e-001, 9.502921e-001,
+9.505435e-001, 9.507948e-001, 9.510461e-001, 9.512975e-001, 9.515488e-001, 9.518002e-001, 9.520515e-001, 9.523028e-001, 9.525542e-001, 9.528055e-001,
+9.530568e-001, 9.533082e-001, 9.535595e-001, 9.538108e-001, 9.540622e-001, 9.543135e-001, 9.545649e-001, 9.548162e-001, 9.550675e-001, 9.553189e-001,
+9.555702e-001, 9.558215e-001, 9.560729e-001, 9.563242e-001, 9.565756e-001, 9.568269e-001, 9.570782e-001, 9.573296e-001, 9.575809e-001, 9.578322e-001,
+9.580836e-001, 9.583349e-001, 9.585862e-001, 9.588376e-001, 9.590889e-001, 9.593403e-001, 9.595916e-001, 9.598429e-001, 9.600887e-001, 9.603253e-001,
+9.605618e-001, 9.607983e-001, 9.610349e-001, 9.612714e-001, 9.615080e-001, 9.617445e-001, 9.619810e-001, 9.622176e-001, 9.624541e-001, 9.626907e-001,
+9.629272e-001, 9.631637e-001, 9.634003e-001, 9.636368e-001, 9.638734e-001, 9.641099e-001, 9.643464e-001, 9.645830e-001, 9.648195e-001, 9.650561e-001,
+9.652926e-001, 9.655292e-001, 9.657657e-001, 9.660022e-001, 9.662388e-001, 9.664753e-001, 9.667119e-001, 9.669484e-001, 9.671849e-001, 9.674215e-001,
+9.676580e-001, 9.678946e-001, 9.681311e-001, 9.683676e-001, 9.686042e-001, 9.688407e-001, 9.690773e-001, 9.693138e-001, 9.695503e-001, 9.697869e-001,
+9.700221e-001, 9.702448e-001, 9.704675e-001, 9.706903e-001, 9.709130e-001, 9.711357e-001, 9.713585e-001, 9.715812e-001, 9.718039e-001, 9.720267e-001,
+9.722494e-001, 9.724721e-001, 9.726949e-001, 9.729176e-001, 9.731403e-001, 9.733631e-001, 9.735858e-001, 9.738085e-001, 9.740313e-001, 9.742540e-001,
+9.744768e-001, 9.746995e-001, 9.749222e-001, 9.751450e-001, 9.753677e-001, 9.755904e-001, 9.758132e-001, 9.760359e-001, 9.762586e-001, 9.764814e-001,
+9.767041e-001, 9.769268e-001, 9.771496e-001, 9.773723e-001, 9.775950e-001, 9.778178e-001, 9.780405e-001, 9.782632e-001, 9.784860e-001, 9.787087e-001,
+9.789314e-001, 9.791542e-001, 9.793769e-001, 9.795997e-001, 9.798224e-001, 9.800425e-001, 9.802524e-001, 9.804622e-001, 9.806721e-001, 9.808819e-001,
+9.810918e-001, 9.813016e-001, 9.815115e-001, 9.817213e-001, 9.819312e-001, 9.821410e-001, 9.823509e-001, 9.825607e-001, 9.827706e-001, 9.829804e-001,
+9.831903e-001, 9.834001e-001, 9.836100e-001, 9.838198e-001, 9.840297e-001, 9.842395e-001, 9.844494e-001, 9.846592e-001, 9.848691e-001, 9.850789e-001,
+9.852888e-001, 9.854986e-001, 9.857085e-001, 9.859183e-001, 9.861282e-001, 9.863380e-001, 9.865479e-001, 9.867578e-001, 9.869676e-001, 9.871775e-001,
+9.873873e-001, 9.875972e-001, 9.878070e-001, 9.880169e-001, 9.882267e-001, 9.884366e-001, 9.886464e-001, 9.888563e-001, 9.890661e-001, 9.892760e-001,
+9.894858e-001, 9.896957e-001, 9.899055e-001, 9.901088e-001, 9.903066e-001, 9.905044e-001, 9.907022e-001, 9.909001e-001, 9.910979e-001, 9.912957e-001,
+9.914935e-001, 9.916914e-001, 9.918892e-001, 9.920870e-001, 9.922848e-001, 9.924827e-001, 9.926805e-001, 9.928783e-001, 9.930761e-001, 9.932740e-001,
+9.934718e-001, 9.936696e-001, 9.938674e-001, 9.940653e-001, 9.942631e-001, 9.944609e-001, 9.946587e-001, 9.948566e-001, 9.950544e-001, 9.952522e-001,
+9.954500e-001, 9.956479e-001, 9.958457e-001, 9.960435e-001, 9.962413e-001, 9.964392e-001, 9.966370e-001, 9.968348e-001, 9.970326e-001, 9.972305e-001,
+9.974283e-001, 9.976261e-001, 9.978239e-001, 9.980218e-001, 9.982196e-001, 9.984174e-001, 9.986152e-001, 9.988131e-001, 9.990109e-001, 9.992087e-001,
+9.994065e-001, 9.996044e-001, 9.998022e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.624346e-003, 7.248693e-003, 1.094508e-002, 1.486851e-002, 1.879194e-002, 2.291670e-002, 2.713102e-002, 3.143218e-002, 3.591850e-002,
+4.042666e-002, 4.515495e-002, 4.988323e-002, 5.480806e-002, 5.973786e-002, 6.481228e-002, 6.989482e-002, 7.507412e-002, 8.025760e-002, 8.548239e-002,
+9.070589e-002, 9.592110e-002, 1.011239e-001, 1.062820e-001, 1.114129e-001, 1.164739e-001, 1.214959e-001, 1.264283e-001, 1.313190e-001, 1.361002e-001,
+1.408508e-001, 1.454660e-001, 1.500781e-001, 1.545193e-001, 1.589604e-001, 1.632666e-001, 1.675314e-001, 1.717228e-001, 1.758132e-001, 1.799037e-001,
+1.838287e-001, 1.877497e-001, 1.916016e-001, 1.953604e-001, 1.991192e-001, 2.027604e-001, 2.063656e-001, 2.099707e-001, 2.134328e-001, 2.168937e-001,
+2.203408e-001, 2.236670e-001, 2.269933e-001, 2.303076e-001, 2.335089e-001, 2.367102e-001, 2.399115e-001, 2.430006e-001, 2.460864e-001, 2.491723e-001,
+2.521803e-001, 2.551598e-001, 2.581393e-001, 2.610821e-001, 2.639640e-001, 2.668458e-001, 2.697276e-001, 2.725283e-001, 2.753206e-001, 2.781129e-001,
+2.808786e-001, 2.835890e-001, 2.862994e-001, 2.890098e-001, 2.916728e-001, 2.943084e-001, 2.969441e-001, 2.995797e-001, 3.021581e-001, 3.047256e-001,
+3.072931e-001, 3.098606e-001, 3.123695e-001, 3.148749e-001, 3.173804e-001, 3.198859e-001, 3.223376e-001, 3.247867e-001, 3.272358e-001, 3.296849e-001,
+3.320894e-001, 3.344874e-001, 3.368853e-001, 3.392832e-001, 3.416487e-001, 3.440002e-001, 3.463517e-001, 3.487033e-001, 3.510360e-001, 3.533455e-001,
+3.556550e-001, 3.579646e-001, 3.602696e-001, 3.625411e-001, 3.648126e-001, 3.670841e-001, 3.693555e-001, 3.716024e-001, 3.738395e-001, 3.760766e-001,
+3.783137e-001, 3.805431e-001, 3.827491e-001, 3.849550e-001, 3.871610e-001, 3.893669e-001, 3.915528e-001, 3.937306e-001, 3.959083e-001, 3.980861e-001,
+4.002607e-001, 4.024129e-001, 4.045651e-001, 4.067172e-001, 4.088694e-001, 4.110105e-001, 4.131393e-001, 4.152681e-001, 4.173969e-001, 4.195258e-001,
+4.216380e-001, 4.237454e-001, 4.258528e-001, 4.279602e-001, 4.300670e-001, 4.321547e-001, 4.342423e-001, 4.363300e-001, 4.384176e-001, 4.405008e-001,
+4.425699e-001, 4.446391e-001, 4.467082e-001, 4.487774e-001, 4.508393e-001, 4.528909e-001, 4.549425e-001, 4.569940e-001, 4.590456e-001, 4.610881e-001,
+4.631227e-001, 4.651573e-001, 4.671919e-001, 4.692265e-001, 4.712507e-001, 4.732686e-001, 4.752865e-001, 4.773043e-001, 4.793222e-001, 4.813289e-001,
+4.833299e-001, 4.853309e-001, 4.873320e-001, 4.893330e-001, 4.913225e-001, 4.933062e-001, 4.952899e-001, 4.972736e-001, 4.992573e-001, 5.012296e-001,
+5.031952e-001, 5.051607e-001, 5.071263e-001, 5.090918e-001, 5.110469e-001, 5.129931e-001, 5.149393e-001, 5.168855e-001, 5.188317e-001, 5.207695e-001,
+5.226947e-001, 5.246200e-001, 5.265453e-001, 5.284706e-001, 5.303911e-001, 5.322936e-001, 5.341961e-001, 5.360985e-001, 5.380010e-001, 5.399035e-001,
+5.417822e-001, 5.436596e-001, 5.455371e-001, 5.474146e-001, 5.492920e-001, 5.511524e-001, 5.530024e-001, 5.548523e-001, 5.567023e-001, 5.585523e-001,
+5.603957e-001, 5.622155e-001, 5.640352e-001, 5.658550e-001, 5.676748e-001, 5.694946e-001, 5.712904e-001, 5.730771e-001, 5.748638e-001, 5.766504e-001,
+5.784371e-001, 5.802192e-001, 5.819698e-001, 5.837203e-001, 5.854709e-001, 5.872214e-001, 5.889720e-001, 5.907063e-001, 5.924177e-001, 5.941290e-001,
+5.958403e-001, 5.975517e-001, 5.992630e-001, 6.009503e-001, 6.026193e-001, 6.042884e-001, 6.059575e-001, 6.076265e-001, 6.092956e-001, 6.109385e-001,
+6.125624e-001, 6.141862e-001, 6.158100e-001, 6.174339e-001, 6.190577e-001, 6.206614e-001, 6.222372e-001, 6.238130e-001, 6.253888e-001, 6.269646e-001,
+6.285404e-001, 6.301125e-001, 6.316378e-001, 6.331630e-001, 6.346882e-001, 6.362135e-001, 6.377387e-001, 6.392639e-001, 6.407619e-001, 6.422343e-001,
+6.437067e-001, 6.451791e-001, 6.466515e-001, 6.481240e-001, 6.495964e-001, 6.510291e-001, 6.524468e-001, 6.538646e-001, 6.552823e-001, 6.567000e-001,
+6.581177e-001, 6.595354e-001, 6.609154e-001, 6.622769e-001, 6.636385e-001, 6.650000e-001, 6.663615e-001, 6.677231e-001, 6.690846e-001, 6.704274e-001,
+6.717317e-001, 6.730360e-001, 6.743403e-001, 6.756446e-001, 6.769489e-001, 6.782532e-001, 6.795575e-001, 6.808236e-001, 6.820700e-001, 6.833164e-001,
+6.845629e-001, 6.858093e-001, 6.870558e-001, 6.883022e-001, 6.895486e-001, 6.907581e-001, 6.919464e-001, 6.931348e-001, 6.943232e-001, 6.955116e-001,
+6.967000e-001, 6.978884e-001, 6.990768e-001, 7.002523e-001, 7.013829e-001, 7.025135e-001, 7.036441e-001, 7.047747e-001, 7.059053e-001, 7.070359e-001,
+7.081665e-001, 7.092970e-001, 7.104060e-001, 7.114794e-001, 7.125528e-001, 7.136262e-001, 7.146996e-001, 7.157731e-001, 7.168465e-001, 7.179199e-001,
+7.189933e-001, 7.200632e-001, 7.210804e-001, 7.220976e-001, 7.231148e-001, 7.241321e-001, 7.251493e-001, 7.261665e-001, 7.271837e-001, 7.282009e-001,
+7.292181e-001, 7.302226e-001, 7.311849e-001, 7.321472e-001, 7.331096e-001, 7.340719e-001, 7.350342e-001, 7.359965e-001, 7.369588e-001, 7.379211e-001,
+7.388834e-001, 7.398457e-001, 7.407632e-001, 7.416722e-001, 7.425812e-001, 7.434902e-001, 7.443991e-001, 7.453081e-001, 7.462171e-001, 7.471260e-001,
+7.480350e-001, 7.489440e-001, 7.498529e-001, 7.507187e-001, 7.515761e-001, 7.524335e-001, 7.532909e-001, 7.541484e-001, 7.550058e-001, 7.558632e-001,
+7.567206e-001, 7.575780e-001, 7.584354e-001, 7.592928e-001, 7.601416e-001, 7.609494e-001, 7.617572e-001, 7.625650e-001, 7.633728e-001, 7.641806e-001,
+7.649884e-001, 7.657962e-001, 7.666041e-001, 7.674119e-001, 7.682197e-001, 7.690275e-001, 7.698353e-001, 7.706053e-001, 7.713656e-001, 7.721259e-001,
+7.728862e-001, 7.736465e-001, 7.744068e-001, 7.751671e-001, 7.759273e-001, 7.766876e-001, 7.774479e-001, 7.782082e-001, 7.789685e-001, 7.797288e-001,
+7.804599e-001, 7.811749e-001, 7.818898e-001, 7.826048e-001, 7.833197e-001, 7.840347e-001, 7.847496e-001, 7.854646e-001, 7.861795e-001, 7.868944e-001,
+7.876094e-001, 7.883243e-001, 7.890393e-001, 7.897542e-001, 7.904409e-001, 7.911127e-001, 7.917845e-001, 7.924563e-001, 7.931281e-001, 7.937999e-001,
+7.944718e-001, 7.951436e-001, 7.958154e-001, 7.964872e-001, 7.971590e-001, 7.978308e-001, 7.985027e-001, 7.991745e-001, 7.998463e-001, 8.004866e-001,
+8.011175e-001, 8.017484e-001, 8.023793e-001, 8.030102e-001, 8.036412e-001, 8.042721e-001, 8.049030e-001, 8.055339e-001, 8.061649e-001, 8.067958e-001,
+8.074267e-001, 8.080576e-001, 8.086885e-001, 8.093195e-001, 8.099504e-001, 8.105457e-001, 8.111379e-001, 8.117302e-001, 8.123224e-001, 8.129147e-001,
+8.135069e-001, 8.140992e-001, 8.146914e-001, 8.152837e-001, 8.158759e-001, 8.164682e-001, 8.170604e-001, 8.176527e-001, 8.182449e-001, 8.188372e-001,
+8.194294e-001, 8.200204e-001, 8.205761e-001, 8.211319e-001, 8.216877e-001, 8.222435e-001, 8.227992e-001, 8.233550e-001, 8.239108e-001, 8.244665e-001,
+8.250223e-001, 8.255781e-001, 8.261339e-001, 8.266896e-001, 8.272454e-001, 8.278012e-001, 8.283569e-001, 8.289127e-001, 8.294685e-001, 8.300228e-001,
+8.305442e-001, 8.310656e-001, 8.315870e-001, 8.321085e-001, 8.326299e-001, 8.331513e-001, 8.336728e-001, 8.341942e-001, 8.347156e-001, 8.352371e-001,
+8.357585e-001, 8.362799e-001, 8.368014e-001, 8.373228e-001, 8.378442e-001, 8.383656e-001, 8.388871e-001, 8.394085e-001, 8.399299e-001, 8.404234e-001,
+8.409126e-001, 8.414017e-001, 8.418909e-001, 8.423801e-001, 8.428692e-001, 8.433584e-001, 8.438475e-001, 8.443367e-001, 8.448258e-001, 8.453150e-001,
+8.458042e-001, 8.462933e-001, 8.467825e-001, 8.472716e-001, 8.477608e-001, 8.482500e-001, 8.487391e-001, 8.492283e-001, 8.497174e-001, 8.501938e-001,
+8.506527e-001, 8.511116e-001, 8.515704e-001, 8.520293e-001, 8.524882e-001, 8.529471e-001, 8.534059e-001, 8.538648e-001, 8.543237e-001, 8.547826e-001,
+8.552415e-001, 8.557003e-001, 8.561592e-001, 8.566181e-001, 8.570770e-001, 8.575358e-001, 8.579947e-001, 8.584536e-001, 8.589125e-001, 8.593714e-001,
+8.598302e-001, 8.602712e-001, 8.607017e-001, 8.611322e-001, 8.615627e-001, 8.619932e-001, 8.624237e-001, 8.628543e-001, 8.632848e-001, 8.637153e-001,
+8.641458e-001, 8.645763e-001, 8.650068e-001, 8.654373e-001, 8.658678e-001, 8.662983e-001, 8.667288e-001, 8.671593e-001, 8.675898e-001, 8.680203e-001,
+8.684508e-001, 8.688813e-001, 8.693118e-001, 8.697423e-001, 8.701621e-001, 8.705661e-001, 8.709700e-001, 8.713740e-001, 8.717779e-001, 8.721819e-001,
+8.725858e-001, 8.729897e-001, 8.733937e-001, 8.737976e-001, 8.742016e-001, 8.746055e-001, 8.750095e-001, 8.754134e-001, 8.758173e-001, 8.762213e-001,
+8.766252e-001, 8.770292e-001, 8.774331e-001, 8.778371e-001, 8.782410e-001, 8.786449e-001, 8.790489e-001, 8.794528e-001, 8.798568e-001, 8.802447e-001,
+8.806238e-001, 8.810029e-001, 8.813820e-001, 8.817611e-001, 8.821402e-001, 8.825193e-001, 8.828984e-001, 8.832775e-001, 8.836566e-001, 8.840357e-001,
+8.844148e-001, 8.847939e-001, 8.851730e-001, 8.855521e-001, 8.859312e-001, 8.863103e-001, 8.866894e-001, 8.870685e-001, 8.874476e-001, 8.878267e-001,
+8.882058e-001, 8.885849e-001, 8.889640e-001, 8.893431e-001, 8.897223e-001, 8.900951e-001, 8.904510e-001, 8.908069e-001, 8.911628e-001, 8.915187e-001,
+8.918746e-001, 8.922305e-001, 8.925864e-001, 8.929423e-001, 8.932981e-001, 8.936540e-001, 8.940099e-001, 8.943658e-001, 8.947217e-001, 8.950776e-001,
+8.954335e-001, 8.957894e-001, 8.961453e-001, 8.965011e-001, 8.968570e-001, 8.972129e-001, 8.975688e-001, 8.979247e-001, 8.982806e-001, 8.986365e-001,
+8.989924e-001, 8.993482e-001, 8.997041e-001, 9.000564e-001, 9.003906e-001, 9.007248e-001, 9.010590e-001, 9.013932e-001, 9.017274e-001, 9.020616e-001,
+9.023958e-001, 9.027300e-001, 9.030642e-001, 9.033984e-001, 9.037326e-001, 9.040668e-001, 9.044010e-001, 9.047352e-001, 9.050694e-001, 9.054036e-001,
+9.057378e-001, 9.060721e-001, 9.064063e-001, 9.067405e-001, 9.070747e-001, 9.074089e-001, 9.077431e-001, 9.080773e-001, 9.084115e-001, 9.087457e-001,
+9.090799e-001, 9.094141e-001, 9.097483e-001, 9.100775e-001, 9.103915e-001, 9.107054e-001, 9.110194e-001, 9.113334e-001, 9.116473e-001, 9.119613e-001,
+9.122752e-001, 9.125892e-001, 9.129032e-001, 9.132171e-001, 9.135311e-001, 9.138450e-001, 9.141590e-001, 9.144730e-001, 9.147869e-001, 9.151009e-001,
+9.154148e-001, 9.157288e-001, 9.160428e-001, 9.163567e-001, 9.166707e-001, 9.169846e-001, 9.172986e-001, 9.176126e-001, 9.179265e-001, 9.182405e-001,
+9.185544e-001, 9.188684e-001, 9.191824e-001, 9.194963e-001, 9.198103e-001, 9.201168e-001, 9.204118e-001, 9.207069e-001, 9.210019e-001, 9.212970e-001,
+9.215921e-001, 9.218871e-001, 9.221822e-001, 9.224773e-001, 9.227723e-001, 9.230674e-001, 9.233624e-001, 9.236575e-001, 9.239526e-001, 9.242476e-001,
+9.245427e-001, 9.248378e-001, 9.251328e-001, 9.254279e-001, 9.257230e-001, 9.260180e-001, 9.263131e-001, 9.266081e-001, 9.269032e-001, 9.271983e-001,
+9.274933e-001, 9.277884e-001, 9.280835e-001, 9.283785e-001, 9.286736e-001, 9.289686e-001, 9.292637e-001, 9.295588e-001, 9.298538e-001, 9.301400e-001,
+9.304174e-001, 9.306949e-001, 9.309723e-001, 9.312497e-001, 9.315271e-001, 9.318046e-001, 9.320820e-001, 9.323594e-001, 9.326369e-001, 9.329143e-001,
+9.331917e-001, 9.334691e-001, 9.337466e-001, 9.340240e-001, 9.343014e-001, 9.345788e-001, 9.348563e-001, 9.351337e-001, 9.354111e-001, 9.356886e-001,
+9.359660e-001, 9.362434e-001, 9.365208e-001, 9.367983e-001, 9.370757e-001, 9.373531e-001, 9.376306e-001, 9.379080e-001, 9.381854e-001, 9.384628e-001,
+9.387403e-001, 9.390177e-001, 9.392951e-001, 9.395726e-001, 9.398500e-001, 9.401198e-001, 9.403808e-001, 9.406418e-001, 9.409028e-001, 9.411637e-001,
+9.414247e-001, 9.416857e-001, 9.419466e-001, 9.422076e-001, 9.424686e-001, 9.427296e-001, 9.429905e-001, 9.432515e-001, 9.435125e-001, 9.437734e-001,
+9.440344e-001, 9.442954e-001, 9.445564e-001, 9.448173e-001, 9.450783e-001, 9.453393e-001, 9.456002e-001, 9.458612e-001, 9.461222e-001, 9.463832e-001,
+9.466441e-001, 9.469051e-001, 9.471661e-001, 9.474270e-001, 9.476880e-001, 9.479490e-001, 9.482100e-001, 9.484709e-001, 9.487319e-001, 9.489929e-001,
+9.492538e-001, 9.495148e-001, 9.497758e-001, 9.500346e-001, 9.502802e-001, 9.505258e-001, 9.507714e-001, 9.510170e-001, 9.512627e-001, 9.515083e-001,
+9.517539e-001, 9.519995e-001, 9.522451e-001, 9.524907e-001, 9.527363e-001, 9.529820e-001, 9.532276e-001, 9.534732e-001, 9.537188e-001, 9.539644e-001,
+9.542100e-001, 9.544556e-001, 9.547013e-001, 9.549469e-001, 9.551925e-001, 9.554381e-001, 9.556837e-001, 9.559293e-001, 9.561749e-001, 9.564206e-001,
+9.566662e-001, 9.569118e-001, 9.571574e-001, 9.574030e-001, 9.576486e-001, 9.578942e-001, 9.581399e-001, 9.583855e-001, 9.586311e-001, 9.588767e-001,
+9.591223e-001, 9.593679e-001, 9.596135e-001, 9.598591e-001, 9.600987e-001, 9.603299e-001, 9.605612e-001, 9.607925e-001, 9.610238e-001, 9.612551e-001,
+9.614863e-001, 9.617176e-001, 9.619489e-001, 9.621802e-001, 9.624115e-001, 9.626427e-001, 9.628740e-001, 9.631053e-001, 9.633366e-001, 9.635679e-001,
+9.637991e-001, 9.640304e-001, 9.642617e-001, 9.644930e-001, 9.647243e-001, 9.649556e-001, 9.651868e-001, 9.654181e-001, 9.656494e-001, 9.658807e-001,
+9.661120e-001, 9.663432e-001, 9.665745e-001, 9.668058e-001, 9.670371e-001, 9.672684e-001, 9.674996e-001, 9.677309e-001, 9.679622e-001, 9.681935e-001,
+9.684248e-001, 9.686561e-001, 9.688873e-001, 9.691186e-001, 9.693499e-001, 9.695812e-001, 9.698125e-001, 9.700412e-001, 9.702591e-001, 9.704770e-001,
+9.706949e-001, 9.709128e-001, 9.711307e-001, 9.713486e-001, 9.715665e-001, 9.717844e-001, 9.720023e-001, 9.722202e-001, 9.724381e-001, 9.726560e-001,
+9.728739e-001, 9.730918e-001, 9.733097e-001, 9.735276e-001, 9.737456e-001, 9.739635e-001, 9.741814e-001, 9.743993e-001, 9.746172e-001, 9.748351e-001,
+9.750530e-001, 9.752709e-001, 9.754888e-001, 9.757067e-001, 9.759246e-001, 9.761425e-001, 9.763604e-001, 9.765783e-001, 9.767962e-001, 9.770141e-001,
+9.772320e-001, 9.774499e-001, 9.776678e-001, 9.778857e-001, 9.781036e-001, 9.783215e-001, 9.785394e-001, 9.787573e-001, 9.789752e-001, 9.791931e-001,
+9.794110e-001, 9.796289e-001, 9.798468e-001, 9.800610e-001, 9.802664e-001, 9.804718e-001, 9.806772e-001, 9.808827e-001, 9.810881e-001, 9.812935e-001,
+9.814989e-001, 9.817043e-001, 9.819097e-001, 9.821151e-001, 9.823205e-001, 9.825259e-001, 9.827314e-001, 9.829368e-001, 9.831422e-001, 9.833476e-001,
+9.835530e-001, 9.837584e-001, 9.839638e-001, 9.841692e-001, 9.843746e-001, 9.845801e-001, 9.847855e-001, 9.849909e-001, 9.851963e-001, 9.854017e-001,
+9.856071e-001, 9.858125e-001, 9.860179e-001, 9.862233e-001, 9.864288e-001, 9.866342e-001, 9.868396e-001, 9.870450e-001, 9.872504e-001, 9.874558e-001,
+9.876612e-001, 9.878666e-001, 9.880720e-001, 9.882775e-001, 9.884829e-001, 9.886883e-001, 9.888937e-001, 9.890991e-001, 9.893045e-001, 9.895099e-001,
+9.897153e-001, 9.899207e-001, 9.901190e-001, 9.903127e-001, 9.905065e-001, 9.907002e-001, 9.908940e-001, 9.910877e-001, 9.912815e-001, 9.914752e-001,
+9.916690e-001, 9.918627e-001, 9.920564e-001, 9.922502e-001, 9.924439e-001, 9.926377e-001, 9.928314e-001, 9.930252e-001, 9.932189e-001, 9.934127e-001,
+9.936064e-001, 9.938002e-001, 9.939939e-001, 9.941876e-001, 9.943814e-001, 9.945751e-001, 9.947689e-001, 9.949626e-001, 9.951564e-001, 9.953501e-001,
+9.955439e-001, 9.957376e-001, 9.959313e-001, 9.961251e-001, 9.963188e-001, 9.965126e-001, 9.967063e-001, 9.969001e-001, 9.970938e-001, 9.972876e-001,
+9.974813e-001, 9.976751e-001, 9.978688e-001, 9.980625e-001, 9.982563e-001, 9.984500e-001, 9.986438e-001, 9.988375e-001, 9.990313e-001, 9.992250e-001,
+9.994188e-001, 9.996125e-001, 9.998063e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.177176e-003, 4.354351e-003, 6.531527e-003, 8.708703e-003, 1.099680e-002, 1.344657e-002, 1.589635e-002, 1.834612e-002, 2.089431e-002,
+2.364700e-002, 2.639969e-002, 2.915238e-002, 3.213487e-002, 3.521961e-002, 3.830436e-002, 4.155000e-002, 4.499206e-002, 4.843412e-002, 5.208068e-002,
+5.589792e-002, 5.971516e-002, 6.388537e-002, 6.808405e-002, 7.248488e-002, 7.705539e-002, 8.174795e-002, 8.666153e-002, 9.166936e-002, 9.687694e-002,
+1.021752e-001, 1.076092e-001, 1.131249e-001, 1.187048e-001, 1.243305e-001, 1.299701e-001, 1.355862e-001, 1.411815e-001, 1.467006e-001, 1.521571e-001,
+1.575206e-001, 1.627777e-001, 1.679432e-001, 1.729735e-001, 1.779143e-001, 1.827175e-001, 1.874202e-001, 1.920142e-001, 1.964761e-001, 2.008883e-001,
+2.051143e-001, 2.093403e-001, 2.133757e-001, 2.173760e-001, 2.213031e-001, 2.250909e-001, 2.288787e-001, 2.325275e-001, 2.361179e-001, 2.397083e-001,
+2.431316e-001, 2.465402e-001, 2.499488e-001, 2.531936e-001, 2.564358e-001, 2.596781e-001, 2.627841e-001, 2.658750e-001, 2.689659e-001, 2.719655e-001,
+2.749192e-001, 2.778730e-001, 2.807920e-001, 2.836216e-001, 2.864513e-001, 2.892810e-001, 2.920272e-001, 2.947450e-001, 2.974628e-001, 3.001739e-001,
+3.027911e-001, 3.054082e-001, 3.080253e-001, 3.106203e-001, 3.131470e-001, 3.156736e-001, 3.182003e-001, 3.207037e-001, 3.231493e-001, 3.255949e-001,
+3.280405e-001, 3.304716e-001, 3.328446e-001, 3.352177e-001, 3.375907e-001, 3.399637e-001, 3.422729e-001, 3.445811e-001, 3.468892e-001, 3.491974e-001,
+3.514680e-001, 3.537184e-001, 3.559688e-001, 3.582193e-001, 3.604590e-001, 3.626582e-001, 3.648573e-001, 3.670565e-001, 3.692556e-001, 3.714247e-001,
+3.735784e-001, 3.757321e-001, 3.778859e-001, 3.800388e-001, 3.821525e-001, 3.842662e-001, 3.863798e-001, 3.884935e-001, 3.905970e-001, 3.926755e-001,
+3.947540e-001, 3.968324e-001, 3.989109e-001, 4.009747e-001, 4.030225e-001, 4.050702e-001, 4.071179e-001, 4.091657e-001, 4.111976e-001, 4.132186e-001,
+4.152396e-001, 4.172606e-001, 4.192816e-001, 4.212877e-001, 4.232857e-001, 4.252836e-001, 4.272816e-001, 4.292795e-001, 4.312648e-001, 4.332429e-001,
+4.352210e-001, 4.371992e-001, 4.391773e-001, 4.411456e-001, 4.431068e-001, 4.450680e-001, 4.470293e-001, 4.489905e-001, 4.509448e-001, 4.528916e-001,
+4.548385e-001, 4.567854e-001, 4.587322e-001, 4.606749e-001, 4.626096e-001, 4.645443e-001, 4.664790e-001, 4.684137e-001, 4.703465e-001, 4.722708e-001,
+4.741952e-001, 4.761195e-001, 4.780438e-001, 4.799682e-001, 4.818837e-001, 4.837991e-001, 4.857145e-001, 4.876299e-001, 4.895453e-001, 4.914547e-001,
+4.933621e-001, 4.952696e-001, 4.971771e-001, 4.990846e-001, 5.009883e-001, 5.028885e-001, 5.047887e-001, 5.066889e-001, 5.085891e-001, 5.104874e-001,
+5.123805e-001, 5.142735e-001, 5.161666e-001, 5.180596e-001, 5.199526e-001, 5.218384e-001, 5.237240e-001, 5.256096e-001, 5.274953e-001, 5.293809e-001,
+5.312609e-001, 5.331383e-001, 5.350157e-001, 5.368930e-001, 5.387704e-001, 5.406445e-001, 5.425123e-001, 5.443801e-001, 5.462480e-001, 5.481158e-001,
+5.499836e-001, 5.518402e-001, 5.536967e-001, 5.555532e-001, 5.574097e-001, 5.592661e-001, 5.611143e-001, 5.629572e-001, 5.648000e-001, 5.666428e-001,
+5.684856e-001, 5.703254e-001, 5.721517e-001, 5.739780e-001, 5.758043e-001, 5.776306e-001, 5.794569e-001, 5.812692e-001, 5.830757e-001, 5.848822e-001,
+5.866886e-001, 5.884951e-001, 5.902977e-001, 5.920806e-001, 5.938635e-001, 5.956465e-001, 5.974294e-001, 5.992123e-001, 6.009799e-001, 6.027352e-001,
+6.044905e-001, 6.062458e-001, 6.080012e-001, 6.097565e-001, 6.114843e-001, 6.132076e-001, 6.149310e-001, 6.166544e-001, 6.183778e-001, 6.200990e-001,
+6.217859e-001, 6.234729e-001, 6.251598e-001, 6.268467e-001, 6.285337e-001, 6.302152e-001, 6.318612e-001, 6.335072e-001, 6.351532e-001, 6.367992e-001,
+6.384452e-001, 6.400886e-001, 6.416892e-001, 6.432899e-001, 6.448905e-001, 6.464911e-001, 6.480917e-001, 6.496923e-001, 6.512529e-001, 6.528040e-001,
+6.543551e-001, 6.559062e-001, 6.574573e-001, 6.590084e-001, 6.605402e-001, 6.620379e-001, 6.635357e-001, 6.650334e-001, 6.665312e-001, 6.680289e-001,
+6.695267e-001, 6.709857e-001, 6.724267e-001, 6.738678e-001, 6.753089e-001, 6.767500e-001, 6.781910e-001, 6.796321e-001, 6.810289e-001, 6.824106e-001,
+6.837923e-001, 6.851739e-001, 6.865556e-001, 6.879372e-001, 6.893189e-001, 6.906694e-001, 6.919895e-001, 6.933096e-001, 6.946297e-001, 6.959499e-001,
+6.972700e-001, 6.985901e-001, 6.999102e-001, 7.011717e-001, 7.024288e-001, 7.036860e-001, 7.049431e-001, 7.062003e-001, 7.074574e-001, 7.087146e-001,
+7.099717e-001, 7.111666e-001, 7.123600e-001, 7.135534e-001, 7.147468e-001, 7.159402e-001, 7.171337e-001, 7.183271e-001, 7.195205e-001, 7.206757e-001,
+7.218053e-001, 7.229349e-001, 7.240644e-001, 7.251940e-001, 7.263236e-001, 7.274532e-001, 7.285828e-001, 7.297123e-001, 7.307947e-001, 7.318610e-001,
+7.329272e-001, 7.339935e-001, 7.350597e-001, 7.361260e-001, 7.371923e-001, 7.382585e-001, 7.393248e-001, 7.403682e-001, 7.413722e-001, 7.423762e-001,
+7.433802e-001, 7.443842e-001, 7.453882e-001, 7.463922e-001, 7.473963e-001, 7.484003e-001, 7.494043e-001, 7.503836e-001, 7.513269e-001, 7.522702e-001,
+7.532135e-001, 7.541568e-001, 7.551001e-001, 7.560434e-001, 7.569867e-001, 7.579300e-001, 7.588733e-001, 7.598166e-001, 7.607126e-001, 7.615972e-001,
+7.624817e-001, 7.633663e-001, 7.642508e-001, 7.651354e-001, 7.660199e-001, 7.669045e-001, 7.677890e-001, 7.686736e-001, 7.695581e-001, 7.704144e-001,
+7.712425e-001, 7.720705e-001, 7.728986e-001, 7.737267e-001, 7.745547e-001, 7.753828e-001, 7.762109e-001, 7.770389e-001, 7.778670e-001, 7.786950e-001,
+7.795231e-001, 7.803283e-001, 7.811023e-001, 7.818764e-001, 7.826505e-001, 7.834246e-001, 7.841986e-001, 7.849727e-001, 7.857468e-001, 7.865209e-001,
+7.872949e-001, 7.880690e-001, 7.888431e-001, 7.896171e-001, 7.903653e-001, 7.910880e-001, 7.918108e-001, 7.925335e-001, 7.932563e-001, 7.939790e-001,
+7.947018e-001, 7.954245e-001, 7.961472e-001, 7.968700e-001, 7.975927e-001, 7.983155e-001, 7.990382e-001, 7.997610e-001, 8.004512e-001, 8.011254e-001,
+8.017996e-001, 8.024737e-001, 8.031479e-001, 8.038221e-001, 8.044963e-001, 8.051704e-001, 8.058446e-001, 8.065188e-001, 8.071930e-001, 8.078672e-001,
+8.085413e-001, 8.092155e-001, 8.098897e-001, 8.105256e-001, 8.111540e-001, 8.117824e-001, 8.124108e-001, 8.130392e-001, 8.136676e-001, 8.142960e-001,
+8.149244e-001, 8.155528e-001, 8.161812e-001, 8.168096e-001, 8.174380e-001, 8.180664e-001, 8.186948e-001, 8.193232e-001, 8.199516e-001, 8.205404e-001,
+8.211258e-001, 8.217112e-001, 8.222966e-001, 8.228820e-001, 8.234675e-001, 8.240529e-001, 8.246383e-001, 8.252237e-001, 8.258091e-001, 8.263946e-001,
+8.269800e-001, 8.275654e-001, 8.281508e-001, 8.287362e-001, 8.293217e-001, 8.299071e-001, 8.304586e-001, 8.310038e-001, 8.315490e-001, 8.320942e-001,
+8.326393e-001, 8.331845e-001, 8.337297e-001, 8.342749e-001, 8.348200e-001, 8.353652e-001, 8.359104e-001, 8.364556e-001, 8.370007e-001, 8.375459e-001,
+8.380911e-001, 8.386363e-001, 8.391814e-001, 8.397266e-001, 8.402530e-001, 8.407606e-001, 8.412682e-001, 8.417758e-001, 8.422834e-001, 8.427910e-001,
+8.432986e-001, 8.438062e-001, 8.443138e-001, 8.448214e-001, 8.453290e-001, 8.458366e-001, 8.463442e-001, 8.468517e-001, 8.473593e-001, 8.478669e-001,
+8.483745e-001, 8.488821e-001, 8.493897e-001, 8.498973e-001, 8.503770e-001, 8.508495e-001, 8.513221e-001, 8.517947e-001, 8.522673e-001, 8.527398e-001,
+8.532124e-001, 8.536850e-001, 8.541575e-001, 8.546301e-001, 8.551027e-001, 8.555753e-001, 8.560478e-001, 8.565204e-001, 8.569930e-001, 8.574656e-001,
+8.579381e-001, 8.584107e-001, 8.588833e-001, 8.593558e-001, 8.598284e-001, 8.602802e-001, 8.607202e-001, 8.611602e-001, 8.616002e-001, 8.620402e-001,
+8.624802e-001, 8.629202e-001, 8.633602e-001, 8.638002e-001, 8.642402e-001, 8.646802e-001, 8.651202e-001, 8.655602e-001, 8.660002e-001, 8.664402e-001,
+8.668802e-001, 8.673202e-001, 8.677602e-001, 8.682002e-001, 8.686402e-001, 8.690802e-001, 8.695202e-001, 8.699602e-001, 8.703727e-001, 8.707825e-001,
+8.711922e-001, 8.716020e-001, 8.720117e-001, 8.724214e-001, 8.728312e-001, 8.732409e-001, 8.736507e-001, 8.740604e-001, 8.744702e-001, 8.748799e-001,
+8.752897e-001, 8.756994e-001, 8.761092e-001, 8.765189e-001, 8.769286e-001, 8.773384e-001, 8.777481e-001, 8.781579e-001, 8.785676e-001, 8.789774e-001,
+8.793871e-001, 8.797969e-001, 8.801925e-001, 8.805741e-001, 8.809558e-001, 8.813375e-001, 8.817192e-001, 8.821009e-001, 8.824825e-001, 8.828642e-001,
+8.832459e-001, 8.836276e-001, 8.840093e-001, 8.843909e-001, 8.847726e-001, 8.851543e-001, 8.855360e-001, 8.859177e-001, 8.862993e-001, 8.866810e-001,
+8.870627e-001, 8.874444e-001, 8.878260e-001, 8.882077e-001, 8.885894e-001, 8.889711e-001, 8.893528e-001, 8.897344e-001, 8.901082e-001, 8.904639e-001,
+8.908195e-001, 8.911752e-001, 8.915309e-001, 8.918865e-001, 8.922422e-001, 8.925979e-001, 8.929535e-001, 8.933092e-001, 8.936649e-001, 8.940205e-001,
+8.943762e-001, 8.947319e-001, 8.950875e-001, 8.954432e-001, 8.957989e-001, 8.961545e-001, 8.965102e-001, 8.968659e-001, 8.972215e-001, 8.975772e-001,
+8.979329e-001, 8.982885e-001, 8.986442e-001, 8.989998e-001, 8.993555e-001, 8.997112e-001, 9.000623e-001, 9.003939e-001, 9.007255e-001, 9.010570e-001,
+9.013886e-001, 9.017202e-001, 9.020517e-001, 9.023833e-001, 9.027149e-001, 9.030465e-001, 9.033780e-001, 9.037096e-001, 9.040412e-001, 9.043727e-001,
+9.047043e-001, 9.050359e-001, 9.053674e-001, 9.056990e-001, 9.060306e-001, 9.063622e-001, 9.066937e-001, 9.070253e-001, 9.073569e-001, 9.076884e-001,
+9.080200e-001, 9.083516e-001, 9.086832e-001, 9.090147e-001, 9.093463e-001, 9.096779e-001, 9.100088e-001, 9.103181e-001, 9.106273e-001, 9.109366e-001,
+9.112459e-001, 9.115551e-001, 9.118644e-001, 9.121737e-001, 9.124829e-001, 9.127922e-001, 9.131014e-001, 9.134107e-001, 9.137200e-001, 9.140292e-001,
+9.143385e-001, 9.146478e-001, 9.149570e-001, 9.152663e-001, 9.155756e-001, 9.158848e-001, 9.161941e-001, 9.165033e-001, 9.168126e-001, 9.171219e-001,
+9.174311e-001, 9.177404e-001, 9.180497e-001, 9.183589e-001, 9.186682e-001, 9.189775e-001, 9.192867e-001, 9.195960e-001, 9.199052e-001, 9.202002e-001,
+9.204888e-001, 9.207774e-001, 9.210660e-001, 9.213547e-001, 9.216433e-001, 9.219319e-001, 9.222205e-001, 9.225091e-001, 9.227978e-001, 9.230864e-001,
+9.233750e-001, 9.236636e-001, 9.239522e-001, 9.242408e-001, 9.245295e-001, 9.248181e-001, 9.251067e-001, 9.253953e-001, 9.256839e-001, 9.259726e-001,
+9.262612e-001, 9.265498e-001, 9.268384e-001, 9.271270e-001, 9.274156e-001, 9.277043e-001, 9.279929e-001, 9.282815e-001, 9.285701e-001, 9.288587e-001,
+9.291474e-001, 9.294360e-001, 9.297246e-001, 9.300123e-001, 9.302818e-001, 9.305514e-001, 9.308209e-001, 9.310904e-001, 9.313599e-001, 9.316294e-001,
+9.318989e-001, 9.321684e-001, 9.324380e-001, 9.327075e-001, 9.329770e-001, 9.332465e-001, 9.335160e-001, 9.337855e-001, 9.340550e-001, 9.343245e-001,
+9.345941e-001, 9.348636e-001, 9.351331e-001, 9.354026e-001, 9.356721e-001, 9.359416e-001, 9.362111e-001, 9.364806e-001, 9.367502e-001, 9.370197e-001,
+9.372892e-001, 9.375587e-001, 9.378282e-001, 9.380977e-001, 9.383672e-001, 9.386367e-001, 9.389063e-001, 9.391758e-001, 9.394453e-001, 9.397148e-001,
+9.399843e-001, 9.402372e-001, 9.404890e-001, 9.407408e-001, 9.409927e-001, 9.412445e-001, 9.414963e-001, 9.417482e-001, 9.420000e-001, 9.422518e-001,
+9.425037e-001, 9.427555e-001, 9.430073e-001, 9.432592e-001, 9.435110e-001, 9.437628e-001, 9.440147e-001, 9.442665e-001, 9.445183e-001, 9.447702e-001,
+9.450220e-001, 9.452738e-001, 9.455257e-001, 9.457775e-001, 9.460293e-001, 9.462811e-001, 9.465330e-001, 9.467848e-001, 9.470366e-001, 9.472885e-001,
+9.475403e-001, 9.477921e-001, 9.480440e-001, 9.482958e-001, 9.485476e-001, 9.487995e-001, 9.490513e-001, 9.493031e-001, 9.495550e-001, 9.498068e-001,
+9.500548e-001, 9.502903e-001, 9.505258e-001, 9.507612e-001, 9.509967e-001, 9.512322e-001, 9.514676e-001, 9.517031e-001, 9.519386e-001, 9.521741e-001,
+9.524095e-001, 9.526450e-001, 9.528805e-001, 9.531159e-001, 9.533514e-001, 9.535869e-001, 9.538223e-001, 9.540578e-001, 9.542933e-001, 9.545287e-001,
+9.547642e-001, 9.549997e-001, 9.552352e-001, 9.554706e-001, 9.557061e-001, 9.559416e-001, 9.561770e-001, 9.564125e-001, 9.566480e-001, 9.568834e-001,
+9.571189e-001, 9.573544e-001, 9.575898e-001, 9.578253e-001, 9.580608e-001, 9.582963e-001, 9.585317e-001, 9.587672e-001, 9.590027e-001, 9.592381e-001,
+9.594736e-001, 9.597091e-001, 9.599445e-001, 9.601684e-001, 9.603888e-001, 9.606091e-001, 9.608294e-001, 9.610497e-001, 9.612700e-001, 9.614904e-001,
+9.617107e-001, 9.619310e-001, 9.621513e-001, 9.623716e-001, 9.625920e-001, 9.628123e-001, 9.630326e-001, 9.632529e-001, 9.634733e-001, 9.636936e-001,
+9.639139e-001, 9.641342e-001, 9.643545e-001, 9.645749e-001, 9.647952e-001, 9.650155e-001, 9.652358e-001, 9.654562e-001, 9.656765e-001, 9.658968e-001,
+9.661171e-001, 9.663374e-001, 9.665578e-001, 9.667781e-001, 9.669984e-001, 9.672187e-001, 9.674391e-001, 9.676594e-001, 9.678797e-001, 9.681000e-001,
+9.683203e-001, 9.685407e-001, 9.687610e-001, 9.689813e-001, 9.692016e-001, 9.694219e-001, 9.696423e-001, 9.698626e-001, 9.700776e-001, 9.702839e-001,
+9.704902e-001, 9.706965e-001, 9.709028e-001, 9.711091e-001, 9.713154e-001, 9.715217e-001, 9.717280e-001, 9.719343e-001, 9.721406e-001, 9.723469e-001,
+9.725532e-001, 9.727595e-001, 9.729658e-001, 9.731721e-001, 9.733784e-001, 9.735847e-001, 9.737909e-001, 9.739972e-001, 9.742035e-001, 9.744098e-001,
+9.746161e-001, 9.748224e-001, 9.750287e-001, 9.752350e-001, 9.754413e-001, 9.756476e-001, 9.758539e-001, 9.760602e-001, 9.762665e-001, 9.764728e-001,
+9.766791e-001, 9.768854e-001, 9.770917e-001, 9.772980e-001, 9.775043e-001, 9.777106e-001, 9.779169e-001, 9.781231e-001, 9.783294e-001, 9.785357e-001,
+9.787420e-001, 9.789483e-001, 9.791546e-001, 9.793609e-001, 9.795672e-001, 9.797735e-001, 9.799798e-001, 9.801744e-001, 9.803677e-001, 9.805610e-001,
+9.807543e-001, 9.809476e-001, 9.811409e-001, 9.813342e-001, 9.815275e-001, 9.817208e-001, 9.819141e-001, 9.821074e-001, 9.823007e-001, 9.824940e-001,
+9.826873e-001, 9.828806e-001, 9.830739e-001, 9.832672e-001, 9.834605e-001, 9.836538e-001, 9.838471e-001, 9.840404e-001, 9.842337e-001, 9.844270e-001,
+9.846203e-001, 9.848136e-001, 9.850069e-001, 9.852002e-001, 9.853935e-001, 9.855868e-001, 9.857801e-001, 9.859734e-001, 9.861667e-001, 9.863600e-001,
+9.865533e-001, 9.867466e-001, 9.869399e-001, 9.871332e-001, 9.873265e-001, 9.875198e-001, 9.877131e-001, 9.879064e-001, 9.880997e-001, 9.882930e-001,
+9.884863e-001, 9.886796e-001, 9.888730e-001, 9.890663e-001, 9.892596e-001, 9.894529e-001, 9.896462e-001, 9.898395e-001, 9.900307e-001, 9.902120e-001,
+9.903932e-001, 9.905745e-001, 9.907558e-001, 9.909370e-001, 9.911183e-001, 9.912995e-001, 9.914808e-001, 9.916621e-001, 9.918433e-001, 9.920246e-001,
+9.922058e-001, 9.923871e-001, 9.925684e-001, 9.927496e-001, 9.929309e-001, 9.931121e-001, 9.932934e-001, 9.934747e-001, 9.936559e-001, 9.938372e-001,
+9.940184e-001, 9.941997e-001, 9.943810e-001, 9.945622e-001, 9.947435e-001, 9.949247e-001, 9.951060e-001, 9.952872e-001, 9.954685e-001, 9.956498e-001,
+9.958310e-001, 9.960123e-001, 9.961935e-001, 9.963748e-001, 9.965561e-001, 9.967373e-001, 9.969186e-001, 9.970998e-001, 9.972811e-001, 9.974624e-001,
+9.976436e-001, 9.978249e-001, 9.980061e-001, 9.981874e-001, 9.983687e-001, 9.985499e-001, 9.987312e-001, 9.989124e-001, 9.990937e-001, 9.992750e-001,
+9.994562e-001, 9.996375e-001, 9.998187e-001, 1.000000e+000)),
+("Kodak", "DSCS 3154", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.270687e-004, 1.654137e-003, 2.481206e-003, 3.308275e-003, 4.135344e-003, 4.962412e-003, 5.789481e-003, 6.616550e-003, 7.443619e-003,
+8.270687e-003, 9.097756e-003, 9.924825e-003, 1.083201e-002, 1.174722e-002, 1.266242e-002, 1.357762e-002, 1.449282e-002, 1.540802e-002, 1.632322e-002,
+1.723842e-002, 1.815362e-002, 1.906882e-002, 1.998402e-002, 2.099662e-002, 2.201094e-002, 2.302527e-002, 2.403959e-002, 2.505392e-002, 2.606825e-002,
+2.708257e-002, 2.809690e-002, 2.911122e-002, 3.013935e-002, 3.126512e-002, 3.239090e-002, 3.351668e-002, 3.464246e-002, 3.576824e-002, 3.689402e-002,
+3.801980e-002, 3.914558e-002, 4.030153e-002, 4.155249e-002, 4.280345e-002, 4.405441e-002, 4.530537e-002, 4.655633e-002, 4.780729e-002, 4.905825e-002,
+5.034390e-002, 5.173518e-002, 5.312646e-002, 5.451774e-002, 5.590903e-002, 5.730031e-002, 5.869159e-002, 6.009221e-002, 6.164030e-002, 6.318838e-002,
+6.473646e-002, 6.628455e-002, 6.783263e-002, 6.938072e-002, 7.103344e-002, 7.275594e-002, 7.447844e-002, 7.620094e-002, 7.792343e-002, 7.964593e-002,
+8.152157e-002, 8.343683e-002, 8.535210e-002, 8.726736e-002, 8.918262e-002, 9.121896e-002, 9.334544e-002, 9.547191e-002, 9.759839e-002, 9.972487e-002,
+1.020506e-001, 1.044058e-001, 1.067611e-001, 1.091164e-001, 1.116243e-001, 1.142238e-001, 1.168234e-001, 1.194229e-001, 1.222215e-001, 1.250769e-001,
+1.279323e-001, 1.308599e-001, 1.339771e-001, 1.370943e-001, 1.402291e-001, 1.436063e-001, 1.469835e-001, 1.503873e-001, 1.540134e-001, 1.576396e-001,
+1.613451e-001, 1.651988e-001, 1.690524e-001, 1.730537e-001, 1.771031e-001, 1.811968e-001, 1.854016e-001, 1.896063e-001, 1.939094e-001, 1.982227e-001,
+2.025707e-001, 2.069430e-001, 2.113184e-001, 2.157011e-001, 2.200832e-001, 2.244319e-001, 2.287806e-001, 2.330776e-001, 2.373544e-001, 2.415924e-001,
+2.457673e-001, 2.499421e-001, 2.539947e-001, 2.580456e-001, 2.620248e-001, 2.659371e-001, 2.698495e-001, 2.736209e-001, 2.773866e-001, 2.811067e-001,
+2.847231e-001, 2.883395e-001, 2.918758e-001, 2.953441e-001, 2.988124e-001, 3.021861e-001, 3.055105e-001, 3.088350e-001, 3.120699e-001, 3.152567e-001,
+3.184434e-001, 3.215635e-001, 3.246200e-001, 3.276765e-001, 3.307037e-001, 3.336381e-001, 3.365725e-001, 3.395070e-001, 3.423468e-001, 3.451676e-001,
+3.479884e-001, 3.507790e-001, 3.534946e-001, 3.562101e-001, 3.589256e-001, 3.615825e-001, 3.642011e-001, 3.668196e-001, 3.694381e-001, 3.719865e-001,
+3.745158e-001, 3.770451e-001, 3.795744e-001, 3.820356e-001, 3.844831e-001, 3.869305e-001, 3.893780e-001, 3.917696e-001, 3.941422e-001, 3.965147e-001,
+3.988873e-001, 4.012235e-001, 4.035276e-001, 4.058316e-001, 4.081357e-001, 4.104279e-001, 4.126693e-001, 4.149108e-001, 4.171523e-001, 4.193938e-001,
+4.215936e-001, 4.237780e-001, 4.259623e-001, 4.281467e-001, 4.303231e-001, 4.324553e-001, 4.345874e-001, 4.367195e-001, 4.388516e-001, 4.409618e-001,
+4.430461e-001, 4.451305e-001, 4.472149e-001, 4.492993e-001, 4.513547e-001, 4.533954e-001, 4.554361e-001, 4.574768e-001, 4.595174e-001, 4.615275e-001,
+4.635281e-001, 4.655286e-001, 4.675292e-001, 4.695298e-001, 4.715021e-001, 4.734657e-001, 4.754294e-001, 4.773930e-001, 4.793567e-001, 4.812973e-001,
+4.832268e-001, 4.851563e-001, 4.870858e-001, 4.890153e-001, 4.909292e-001, 4.928269e-001, 4.947246e-001, 4.966223e-001, 4.985200e-001, 5.004112e-001,
+5.022791e-001, 5.041470e-001, 5.060149e-001, 5.078829e-001, 5.097508e-001, 5.115943e-001, 5.134340e-001, 5.152738e-001, 5.171135e-001, 5.189533e-001,
+5.207814e-001, 5.225942e-001, 5.244070e-001, 5.262198e-001, 5.280326e-001, 5.298455e-001, 5.316344e-001, 5.334211e-001, 5.352079e-001, 5.369946e-001,
+5.387813e-001, 5.405599e-001, 5.423210e-001, 5.440822e-001, 5.458433e-001, 5.476044e-001, 5.493656e-001, 5.511104e-001, 5.528461e-001, 5.545817e-001,
+5.563174e-001, 5.580531e-001, 5.597887e-001, 5.615018e-001, 5.632118e-001, 5.649218e-001, 5.666317e-001, 5.683417e-001, 5.700509e-001, 5.717346e-001,
+5.734183e-001, 5.751019e-001, 5.767856e-001, 5.784693e-001, 5.801506e-001, 5.818071e-001, 5.834636e-001, 5.851201e-001, 5.867766e-001, 5.884331e-001,
+5.900881e-001, 5.917162e-001, 5.933443e-001, 5.949724e-001, 5.966005e-001, 5.982286e-001, 5.998567e-001, 6.014576e-001, 6.030558e-001, 6.046541e-001,
+6.062523e-001, 6.078505e-001, 6.094487e-001, 6.110262e-001, 6.125928e-001, 6.141594e-001, 6.157260e-001, 6.172926e-001, 6.188593e-001, 6.204167e-001,
+6.219498e-001, 6.234828e-001, 6.250159e-001, 6.265489e-001, 6.280820e-001, 6.296150e-001, 6.311214e-001, 6.326188e-001, 6.341163e-001, 6.356137e-001,
+6.371111e-001, 6.386085e-001, 6.401033e-001, 6.415629e-001, 6.430226e-001, 6.444822e-001, 6.459418e-001, 6.474015e-001, 6.488611e-001, 6.503120e-001,
+6.517316e-001, 6.531513e-001, 6.545710e-001, 6.559906e-001, 6.574103e-001, 6.588299e-001, 6.602422e-001, 6.616198e-001, 6.629973e-001, 6.643749e-001,
+6.657524e-001, 6.671300e-001, 6.685075e-001, 6.698851e-001, 6.712222e-001, 6.725556e-001, 6.738890e-001, 6.752224e-001, 6.765558e-001, 6.778892e-001,
+6.792226e-001, 6.805368e-001, 6.818242e-001, 6.831117e-001, 6.843991e-001, 6.856865e-001, 6.869739e-001, 6.882613e-001, 6.895487e-001, 6.908052e-001,
+6.920450e-001, 6.932848e-001, 6.945246e-001, 6.957643e-001, 6.970041e-001, 6.982439e-001, 6.994837e-001, 7.006949e-001, 7.018857e-001, 7.030766e-001,
+7.042674e-001, 7.054582e-001, 7.066490e-001, 7.078399e-001, 7.090307e-001, 7.102122e-001, 7.113531e-001, 7.124939e-001, 7.136347e-001, 7.147756e-001,
+7.159164e-001, 7.170572e-001, 7.181981e-001, 7.193389e-001, 7.204584e-001, 7.215486e-001, 7.226388e-001, 7.237290e-001, 7.248191e-001, 7.259093e-001,
+7.269995e-001, 7.280897e-001, 7.291798e-001, 7.302574e-001, 7.312966e-001, 7.323358e-001, 7.333750e-001, 7.344142e-001, 7.354534e-001, 7.364926e-001,
+7.375318e-001, 7.385710e-001, 7.396102e-001, 7.406175e-001, 7.416058e-001, 7.425940e-001, 7.435823e-001, 7.445706e-001, 7.455588e-001, 7.465471e-001,
+7.475354e-001, 7.485236e-001, 7.495119e-001, 7.504746e-001, 7.514123e-001, 7.523500e-001, 7.532877e-001, 7.542255e-001, 7.551632e-001, 7.561009e-001,
+7.570386e-001, 7.579764e-001, 7.589141e-001, 7.598518e-001, 7.607476e-001, 7.616355e-001, 7.625234e-001, 7.634113e-001, 7.642992e-001, 7.651871e-001,
+7.660750e-001, 7.669629e-001, 7.678508e-001, 7.687387e-001, 7.696266e-001, 7.704862e-001, 7.713253e-001, 7.721645e-001, 7.730036e-001, 7.738427e-001,
+7.746818e-001, 7.755209e-001, 7.763600e-001, 7.771991e-001, 7.780382e-001, 7.788773e-001, 7.797164e-001, 7.805240e-001, 7.813156e-001, 7.821072e-001,
+7.828987e-001, 7.836903e-001, 7.844819e-001, 7.852735e-001, 7.860651e-001, 7.868566e-001, 7.876482e-001, 7.884398e-001, 7.892314e-001, 7.900216e-001,
+7.907672e-001, 7.915127e-001, 7.922583e-001, 7.930038e-001, 7.937494e-001, 7.944949e-001, 7.952405e-001, 7.959860e-001, 7.967316e-001, 7.974771e-001,
+7.982227e-001, 7.989683e-001, 7.997138e-001, 8.004320e-001, 8.011332e-001, 8.018345e-001, 8.025357e-001, 8.032369e-001, 8.039381e-001, 8.046393e-001,
+8.053405e-001, 8.060417e-001, 8.067429e-001, 8.074441e-001, 8.081453e-001, 8.088465e-001, 8.095477e-001, 8.102338e-001, 8.108925e-001, 8.115512e-001,
+8.122099e-001, 8.128686e-001, 8.135272e-001, 8.141859e-001, 8.148446e-001, 8.155033e-001, 8.161620e-001, 8.168206e-001, 8.174793e-001, 8.181380e-001,
+8.187967e-001, 8.194554e-001, 8.201070e-001, 8.207251e-001, 8.213431e-001, 8.219612e-001, 8.225793e-001, 8.231973e-001, 8.238154e-001, 8.244335e-001,
+8.250515e-001, 8.256696e-001, 8.262877e-001, 8.269057e-001, 8.275238e-001, 8.281419e-001, 8.287599e-001, 8.293780e-001, 8.299961e-001, 8.305758e-001,
+8.311552e-001, 8.317346e-001, 8.323141e-001, 8.328935e-001, 8.334729e-001, 8.340524e-001, 8.346318e-001, 8.352112e-001, 8.357907e-001, 8.363701e-001,
+8.369495e-001, 8.375290e-001, 8.381084e-001, 8.386878e-001, 8.392673e-001, 8.398467e-001, 8.403992e-001, 8.409420e-001, 8.414848e-001, 8.420276e-001,
+8.425705e-001, 8.431133e-001, 8.436561e-001, 8.441989e-001, 8.447417e-001, 8.452845e-001, 8.458273e-001, 8.463702e-001, 8.469130e-001, 8.474558e-001,
+8.479986e-001, 8.485414e-001, 8.490842e-001, 8.496270e-001, 8.501590e-001, 8.506672e-001, 8.511754e-001, 8.516836e-001, 8.521918e-001, 8.527000e-001,
+8.532082e-001, 8.537164e-001, 8.542247e-001, 8.547329e-001, 8.552411e-001, 8.557493e-001, 8.562575e-001, 8.567657e-001, 8.572739e-001, 8.577821e-001,
+8.582903e-001, 8.587985e-001, 8.593067e-001, 8.598149e-001, 8.603024e-001, 8.607780e-001, 8.612535e-001, 8.617291e-001, 8.622047e-001, 8.626803e-001,
+8.631559e-001, 8.636315e-001, 8.641071e-001, 8.645827e-001, 8.650582e-001, 8.655338e-001, 8.660094e-001, 8.664850e-001, 8.669606e-001, 8.674362e-001,
+8.679118e-001, 8.683874e-001, 8.688630e-001, 8.693385e-001, 8.698141e-001, 8.702710e-001, 8.707160e-001, 8.711609e-001, 8.716058e-001, 8.720507e-001,
+8.724956e-001, 8.729406e-001, 8.733855e-001, 8.738304e-001, 8.742753e-001, 8.747203e-001, 8.751652e-001, 8.756101e-001, 8.760550e-001, 8.764999e-001,
+8.769449e-001, 8.773898e-001, 8.778347e-001, 8.782796e-001, 8.787246e-001, 8.791695e-001, 8.796144e-001, 8.800555e-001, 8.804716e-001, 8.808878e-001,
+8.813039e-001, 8.817201e-001, 8.821362e-001, 8.825524e-001, 8.829685e-001, 8.833847e-001, 8.838008e-001, 8.842170e-001, 8.846331e-001, 8.850493e-001,
+8.854654e-001, 8.858816e-001, 8.862977e-001, 8.867139e-001, 8.871301e-001, 8.875462e-001, 8.879624e-001, 8.883785e-001, 8.887947e-001, 8.892108e-001,
+8.896270e-001, 8.900403e-001, 8.904295e-001, 8.908187e-001, 8.912079e-001, 8.915971e-001, 8.919863e-001, 8.923755e-001, 8.927648e-001, 8.931540e-001,
+8.935432e-001, 8.939324e-001, 8.943216e-001, 8.947108e-001, 8.951000e-001, 8.954892e-001, 8.958784e-001, 8.962676e-001, 8.966568e-001, 8.970460e-001,
+8.974352e-001, 8.978244e-001, 8.982136e-001, 8.986028e-001, 8.989920e-001, 8.993812e-001, 8.997704e-001, 9.001493e-001, 9.005133e-001, 9.008773e-001,
+9.012413e-001, 9.016053e-001, 9.019694e-001, 9.023334e-001, 9.026974e-001, 9.030614e-001, 9.034254e-001, 9.037894e-001, 9.041534e-001, 9.045174e-001,
+9.048814e-001, 9.052454e-001, 9.056094e-001, 9.059734e-001, 9.063375e-001, 9.067015e-001, 9.070655e-001, 9.074295e-001, 9.077935e-001, 9.081575e-001,
+9.085215e-001, 9.088855e-001, 9.092495e-001, 9.096135e-001, 9.099775e-001, 9.103195e-001, 9.106599e-001, 9.110004e-001, 9.113409e-001, 9.116814e-001,
+9.120218e-001, 9.123623e-001, 9.127028e-001, 9.130433e-001, 9.133838e-001, 9.137242e-001, 9.140647e-001, 9.144052e-001, 9.147457e-001, 9.150861e-001,
+9.154266e-001, 9.157671e-001, 9.161076e-001, 9.164480e-001, 9.167885e-001, 9.171290e-001, 9.174695e-001, 9.178099e-001, 9.181504e-001, 9.184909e-001,
+9.188314e-001, 9.191719e-001, 9.195123e-001, 9.198528e-001, 9.201808e-001, 9.204993e-001, 9.208179e-001, 9.211364e-001, 9.214549e-001, 9.217734e-001,
+9.220920e-001, 9.224105e-001, 9.227290e-001, 9.230475e-001, 9.233661e-001, 9.236846e-001, 9.240031e-001, 9.243216e-001, 9.246402e-001, 9.249587e-001,
+9.252772e-001, 9.255957e-001, 9.259143e-001, 9.262328e-001, 9.265513e-001, 9.268698e-001, 9.271883e-001, 9.275069e-001, 9.278254e-001, 9.281439e-001,
+9.284624e-001, 9.287810e-001, 9.290995e-001, 9.294180e-001, 9.297365e-001, 9.300515e-001, 9.303496e-001, 9.306476e-001, 9.309457e-001, 9.312438e-001,
+9.315418e-001, 9.318399e-001, 9.321380e-001, 9.324360e-001, 9.327341e-001, 9.330321e-001, 9.333302e-001, 9.336283e-001, 9.339263e-001, 9.342244e-001,
+9.345224e-001, 9.348205e-001, 9.351186e-001, 9.354166e-001, 9.357147e-001, 9.360128e-001, 9.363108e-001, 9.366089e-001, 9.369069e-001, 9.372050e-001,
+9.375031e-001, 9.378011e-001, 9.380992e-001, 9.383972e-001, 9.386953e-001, 9.389934e-001, 9.392914e-001, 9.395895e-001, 9.398876e-001, 9.401737e-001,
+9.404527e-001, 9.407318e-001, 9.410108e-001, 9.412898e-001, 9.415688e-001, 9.418478e-001, 9.421268e-001, 9.424058e-001, 9.426848e-001, 9.429638e-001,
+9.432428e-001, 9.435218e-001, 9.438008e-001, 9.440798e-001, 9.443588e-001, 9.446378e-001, 9.449168e-001, 9.451958e-001, 9.454748e-001, 9.457538e-001,
+9.460328e-001, 9.463118e-001, 9.465908e-001, 9.468698e-001, 9.471488e-001, 9.474278e-001, 9.477068e-001, 9.479858e-001, 9.482648e-001, 9.485438e-001,
+9.488228e-001, 9.491018e-001, 9.493808e-001, 9.496598e-001, 9.499388e-001, 9.502040e-001, 9.504652e-001, 9.507265e-001, 9.509877e-001, 9.512490e-001,
+9.515102e-001, 9.517715e-001, 9.520328e-001, 9.522940e-001, 9.525553e-001, 9.528165e-001, 9.530778e-001, 9.533390e-001, 9.536003e-001, 9.538616e-001,
+9.541228e-001, 9.543841e-001, 9.546453e-001, 9.549066e-001, 9.551678e-001, 9.554291e-001, 9.556904e-001, 9.559516e-001, 9.562129e-001, 9.564741e-001,
+9.567354e-001, 9.569966e-001, 9.572579e-001, 9.575192e-001, 9.577804e-001, 9.580417e-001, 9.583029e-001, 9.585642e-001, 9.588255e-001, 9.590867e-001,
+9.593480e-001, 9.596092e-001, 9.598705e-001, 9.601234e-001, 9.603682e-001, 9.606129e-001, 9.608576e-001, 9.611024e-001, 9.613471e-001, 9.615919e-001,
+9.618366e-001, 9.620814e-001, 9.623261e-001, 9.625709e-001, 9.628156e-001, 9.630603e-001, 9.633051e-001, 9.635498e-001, 9.637946e-001, 9.640393e-001,
+9.642841e-001, 9.645288e-001, 9.647735e-001, 9.650183e-001, 9.652630e-001, 9.655078e-001, 9.657525e-001, 9.659973e-001, 9.662420e-001, 9.664868e-001,
+9.667315e-001, 9.669762e-001, 9.672210e-001, 9.674657e-001, 9.677105e-001, 9.679552e-001, 9.682000e-001, 9.684447e-001, 9.686894e-001, 9.689342e-001,
+9.691789e-001, 9.694237e-001, 9.696684e-001, 9.699132e-001, 9.701480e-001, 9.703774e-001, 9.706068e-001, 9.708361e-001, 9.710655e-001, 9.712949e-001,
+9.715243e-001, 9.717537e-001, 9.719830e-001, 9.722124e-001, 9.724418e-001, 9.726712e-001, 9.729006e-001, 9.731299e-001, 9.733593e-001, 9.735887e-001,
+9.738181e-001, 9.740475e-001, 9.742768e-001, 9.745062e-001, 9.747356e-001, 9.749650e-001, 9.751944e-001, 9.754237e-001, 9.756531e-001, 9.758825e-001,
+9.761119e-001, 9.763413e-001, 9.765706e-001, 9.768000e-001, 9.770294e-001, 9.772588e-001, 9.774881e-001, 9.777175e-001, 9.779469e-001, 9.781763e-001,
+9.784057e-001, 9.786350e-001, 9.788644e-001, 9.790938e-001, 9.793232e-001, 9.795526e-001, 9.797819e-001, 9.800106e-001, 9.802257e-001, 9.804408e-001,
+9.806559e-001, 9.808710e-001, 9.810861e-001, 9.813011e-001, 9.815162e-001, 9.817313e-001, 9.819464e-001, 9.821615e-001, 9.823766e-001, 9.825917e-001,
+9.828067e-001, 9.830218e-001, 9.832369e-001, 9.834520e-001, 9.836671e-001, 9.838822e-001, 9.840973e-001, 9.843124e-001, 9.845274e-001, 9.847425e-001,
+9.849576e-001, 9.851727e-001, 9.853878e-001, 9.856029e-001, 9.858180e-001, 9.860330e-001, 9.862481e-001, 9.864632e-001, 9.866783e-001, 9.868934e-001,
+9.871085e-001, 9.873236e-001, 9.875386e-001, 9.877537e-001, 9.879688e-001, 9.881839e-001, 9.883990e-001, 9.886141e-001, 9.888292e-001, 9.890443e-001,
+9.892593e-001, 9.894744e-001, 9.896895e-001, 9.899046e-001, 9.901123e-001, 9.903141e-001, 9.905159e-001, 9.907177e-001, 9.909194e-001, 9.911212e-001,
+9.913230e-001, 9.915248e-001, 9.917266e-001, 9.919284e-001, 9.921302e-001, 9.923320e-001, 9.925338e-001, 9.927356e-001, 9.929373e-001, 9.931391e-001,
+9.933409e-001, 9.935427e-001, 9.937445e-001, 9.939463e-001, 9.941481e-001, 9.943499e-001, 9.945517e-001, 9.947535e-001, 9.949552e-001, 9.951570e-001,
+9.953588e-001, 9.955606e-001, 9.957624e-001, 9.959642e-001, 9.961660e-001, 9.963678e-001, 9.965696e-001, 9.967714e-001, 9.969731e-001, 9.971749e-001,
+9.973767e-001, 9.975785e-001, 9.977803e-001, 9.979821e-001, 9.981839e-001, 9.983857e-001, 9.985875e-001, 9.987893e-001, 9.989910e-001, 9.991928e-001,
+9.993946e-001, 9.995964e-001, 9.997982e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.280614e-003, 2.561227e-003, 3.841841e-003, 5.122455e-003, 6.403068e-003, 7.683682e-003, 8.964296e-003, 1.027372e-002, 1.170497e-002,
+1.313621e-002, 1.456746e-002, 1.599871e-002, 1.742996e-002, 1.886121e-002, 2.032727e-002, 2.192892e-002, 2.353056e-002, 2.513221e-002, 2.673385e-002,
+2.833549e-002, 2.993714e-002, 3.172343e-002, 3.351728e-002, 3.531112e-002, 3.710496e-002, 3.889880e-002, 4.077597e-002, 4.278563e-002, 4.479529e-002,
+4.680495e-002, 4.881461e-002, 5.092300e-002, 5.317340e-002, 5.542380e-002, 5.767420e-002, 5.992460e-002, 6.243214e-002, 6.494860e-002, 6.746505e-002,
+6.998151e-002, 7.278618e-002, 7.559298e-002, 7.839979e-002, 8.134052e-002, 8.445888e-002, 8.757724e-002, 9.076854e-002, 9.421392e-002, 9.765931e-002,
+1.012117e-001, 1.049906e-001, 1.087696e-001, 1.127699e-001, 1.168770e-001, 1.210579e-001, 1.254729e-001, 1.298879e-001, 1.345676e-001, 1.392543e-001,
+1.441261e-001, 1.490331e-001, 1.540661e-001, 1.591301e-001, 1.642663e-001, 1.694174e-001, 1.745833e-001, 1.797512e-001, 1.848731e-001, 1.899926e-001,
+1.950089e-001, 2.000242e-001, 2.048938e-001, 2.097634e-001, 2.144647e-001, 2.191574e-001, 2.236897e-001, 2.281869e-001, 2.325621e-001, 2.368549e-001,
+2.410928e-001, 2.451802e-001, 2.492675e-001, 2.531899e-001, 2.570763e-001, 2.609150e-001, 2.646088e-001, 2.683025e-001, 2.718980e-001, 2.754099e-001,
+2.789217e-001, 2.823159e-001, 2.856579e-001, 2.889999e-001, 2.922316e-001, 2.954163e-001, 2.986010e-001, 3.017044e-001, 3.047442e-001, 3.077841e-001,
+3.107880e-001, 3.136951e-001, 3.166022e-001, 3.195093e-001, 3.223157e-001, 3.251017e-001, 3.278876e-001, 3.306469e-001, 3.333224e-001, 3.359980e-001,
+3.386735e-001, 3.412985e-001, 3.438736e-001, 3.464488e-001, 3.490240e-001, 3.515426e-001, 3.540267e-001, 3.565107e-001, 3.589948e-001, 3.614296e-001,
+3.638310e-001, 3.662324e-001, 3.686338e-001, 3.710030e-001, 3.733295e-001, 3.756559e-001, 3.779824e-001, 3.802999e-001, 3.825586e-001, 3.848172e-001,
+3.870758e-001, 3.893345e-001, 3.915498e-001, 3.937469e-001, 3.959441e-001, 3.981413e-001, 4.003299e-001, 4.024715e-001, 4.046130e-001, 4.067545e-001,
+4.088961e-001, 4.110132e-001, 4.131043e-001, 4.151954e-001, 4.172866e-001, 4.193777e-001, 4.214368e-001, 4.234822e-001, 4.255277e-001, 4.275731e-001,
+4.296186e-001, 4.316303e-001, 4.336344e-001, 4.356384e-001, 4.376424e-001, 4.396465e-001, 4.416195e-001, 4.435859e-001, 4.455523e-001, 4.475187e-001,
+4.494850e-001, 4.514261e-001, 4.533582e-001, 4.552903e-001, 4.572224e-001, 4.591545e-001, 4.610690e-001, 4.629697e-001, 4.648705e-001, 4.667713e-001,
+4.686720e-001, 4.705641e-001, 4.724361e-001, 4.743080e-001, 4.761800e-001, 4.780519e-001, 4.799239e-001, 4.817703e-001, 4.836157e-001, 4.854610e-001,
+4.873063e-001, 4.891517e-001, 4.909836e-001, 4.928041e-001, 4.946246e-001, 4.964450e-001, 4.982655e-001, 5.000849e-001, 5.018820e-001, 5.036791e-001,
+5.054761e-001, 5.072732e-001, 5.090703e-001, 5.108565e-001, 5.126312e-001, 5.144059e-001, 5.161806e-001, 5.179553e-001, 5.197300e-001, 5.214863e-001,
+5.232393e-001, 5.249923e-001, 5.267453e-001, 5.284983e-001, 5.302483e-001, 5.319799e-001, 5.337115e-001, 5.354432e-001, 5.371748e-001, 5.389064e-001,
+5.406302e-001, 5.423404e-001, 5.440506e-001, 5.457608e-001, 5.474711e-001, 5.491813e-001, 5.508801e-001, 5.525686e-001, 5.542570e-001, 5.559454e-001,
+5.576338e-001, 5.593222e-001, 5.609971e-001, 5.626630e-001, 5.643289e-001, 5.659947e-001, 5.676606e-001, 5.693264e-001, 5.709782e-001, 5.726205e-001,
+5.742627e-001, 5.759049e-001, 5.775472e-001, 5.791894e-001, 5.808190e-001, 5.824362e-001, 5.840534e-001, 5.856706e-001, 5.872878e-001, 5.889050e-001,
+5.905136e-001, 5.921042e-001, 5.936947e-001, 5.952852e-001, 5.968757e-001, 5.984662e-001, 6.000557e-001, 6.016176e-001, 6.031795e-001, 6.047414e-001,
+6.063033e-001, 6.078652e-001, 6.094271e-001, 6.109695e-001, 6.125006e-001, 6.140318e-001, 6.155629e-001, 6.170940e-001, 6.186252e-001, 6.201529e-001,
+6.216510e-001, 6.231491e-001, 6.246472e-001, 6.261453e-001, 6.276433e-001, 6.291414e-001, 6.306244e-001, 6.320870e-001, 6.335497e-001, 6.350123e-001,
+6.364750e-001, 6.379376e-001, 6.394003e-001, 6.408406e-001, 6.422654e-001, 6.436902e-001, 6.451150e-001, 6.465398e-001, 6.479646e-001, 6.493894e-001,
+6.507912e-001, 6.521758e-001, 6.535604e-001, 6.549450e-001, 6.563295e-001, 6.577141e-001, 6.590987e-001, 6.604684e-001, 6.618105e-001, 6.631526e-001,
+6.644947e-001, 6.658368e-001, 6.671789e-001, 6.685209e-001, 6.698630e-001, 6.711651e-001, 6.724626e-001, 6.737600e-001, 6.750575e-001, 6.763550e-001,
+6.776525e-001, 6.789500e-001, 6.802387e-001, 6.814897e-001, 6.827408e-001, 6.839918e-001, 6.852429e-001, 6.864939e-001, 6.877450e-001, 6.889960e-001,
+6.902376e-001, 6.914406e-001, 6.926437e-001, 6.938467e-001, 6.950497e-001, 6.962528e-001, 6.974558e-001, 6.986589e-001, 6.998619e-001, 7.010213e-001,
+7.021751e-001, 7.033289e-001, 7.044827e-001, 7.056365e-001, 7.067903e-001, 7.079441e-001, 7.090979e-001, 7.102408e-001, 7.113444e-001, 7.124481e-001,
+7.135518e-001, 7.146555e-001, 7.157592e-001, 7.168628e-001, 7.179665e-001, 7.190702e-001, 7.201659e-001, 7.212189e-001, 7.222720e-001, 7.233251e-001,
+7.243781e-001, 7.254312e-001, 7.264843e-001, 7.275373e-001, 7.285904e-001, 7.296434e-001, 7.306630e-001, 7.316653e-001, 7.326676e-001, 7.336699e-001,
+7.346723e-001, 7.356746e-001, 7.366769e-001, 7.376793e-001, 7.386816e-001, 7.396839e-001, 7.406517e-001, 7.416035e-001, 7.425554e-001, 7.435072e-001,
+7.444591e-001, 7.454109e-001, 7.463628e-001, 7.473146e-001, 7.482665e-001, 7.492183e-001, 7.501613e-001, 7.510632e-001, 7.519652e-001, 7.528672e-001,
+7.537691e-001, 7.546711e-001, 7.555731e-001, 7.564750e-001, 7.573770e-001, 7.582790e-001, 7.591809e-001, 7.600784e-001, 7.609314e-001, 7.617844e-001,
+7.626374e-001, 7.634904e-001, 7.643434e-001, 7.651964e-001, 7.660494e-001, 7.669024e-001, 7.677554e-001, 7.686084e-001, 7.694614e-001, 7.702968e-001,
+7.711020e-001, 7.719072e-001, 7.727124e-001, 7.735176e-001, 7.743229e-001, 7.751281e-001, 7.759333e-001, 7.767385e-001, 7.775437e-001, 7.783490e-001,
+7.791542e-001, 7.799594e-001, 7.807206e-001, 7.814795e-001, 7.822383e-001, 7.829972e-001, 7.837561e-001, 7.845150e-001, 7.852738e-001, 7.860327e-001,
+7.867916e-001, 7.875505e-001, 7.883093e-001, 7.890682e-001, 7.898271e-001, 7.905514e-001, 7.912656e-001, 7.919797e-001, 7.926939e-001, 7.934080e-001,
+7.941222e-001, 7.948363e-001, 7.955505e-001, 7.962646e-001, 7.969788e-001, 7.976929e-001, 7.984071e-001, 7.991213e-001, 7.998354e-001, 8.005165e-001,
+8.011877e-001, 8.018589e-001, 8.025301e-001, 8.032013e-001, 8.038726e-001, 8.045438e-001, 8.052150e-001, 8.058862e-001, 8.065574e-001, 8.072286e-001,
+8.078998e-001, 8.085710e-001, 8.092422e-001, 8.099134e-001, 8.105489e-001, 8.111790e-001, 8.118092e-001, 8.124394e-001, 8.130695e-001, 8.136997e-001,
+8.143298e-001, 8.149600e-001, 8.155901e-001, 8.162203e-001, 8.168504e-001, 8.174806e-001, 8.181107e-001, 8.187409e-001, 8.193711e-001, 8.200011e-001,
+8.205922e-001, 8.211833e-001, 8.217743e-001, 8.223654e-001, 8.229564e-001, 8.235475e-001, 8.241386e-001, 8.247296e-001, 8.253207e-001, 8.259118e-001,
+8.265028e-001, 8.270939e-001, 8.276849e-001, 8.282760e-001, 8.288671e-001, 8.294581e-001, 8.300461e-001, 8.306001e-001, 8.311540e-001, 8.317080e-001,
+8.322620e-001, 8.328160e-001, 8.333699e-001, 8.339239e-001, 8.344779e-001, 8.350318e-001, 8.355858e-001, 8.361398e-001, 8.366938e-001, 8.372477e-001,
+8.378017e-001, 8.383557e-001, 8.389096e-001, 8.394636e-001, 8.400165e-001, 8.405354e-001, 8.410543e-001, 8.415731e-001, 8.420920e-001, 8.426109e-001,
+8.431298e-001, 8.436487e-001, 8.441676e-001, 8.446865e-001, 8.452054e-001, 8.457243e-001, 8.462432e-001, 8.467620e-001, 8.472809e-001, 8.477998e-001,
+8.483187e-001, 8.488376e-001, 8.493565e-001, 8.498754e-001, 8.503691e-001, 8.508549e-001, 8.513407e-001, 8.518266e-001, 8.523124e-001, 8.527982e-001,
+8.532840e-001, 8.537698e-001, 8.542556e-001, 8.547414e-001, 8.552272e-001, 8.557130e-001, 8.561988e-001, 8.566846e-001, 8.571704e-001, 8.576562e-001,
+8.581420e-001, 8.586278e-001, 8.591136e-001, 8.595994e-001, 8.600798e-001, 8.605344e-001, 8.609891e-001, 8.614438e-001, 8.618985e-001, 8.623532e-001,
+8.628078e-001, 8.632625e-001, 8.637172e-001, 8.641719e-001, 8.646265e-001, 8.650812e-001, 8.655359e-001, 8.659906e-001, 8.664453e-001, 8.668999e-001,
+8.673546e-001, 8.678093e-001, 8.682640e-001, 8.687186e-001, 8.691733e-001, 8.696280e-001, 8.700774e-001, 8.705028e-001, 8.709283e-001, 8.713537e-001,
+8.717792e-001, 8.722046e-001, 8.726301e-001, 8.730555e-001, 8.734810e-001, 8.739065e-001, 8.743319e-001, 8.747574e-001, 8.751828e-001, 8.756083e-001,
+8.760337e-001, 8.764592e-001, 8.768846e-001, 8.773101e-001, 8.777355e-001, 8.781610e-001, 8.785865e-001, 8.790119e-001, 8.794374e-001, 8.798628e-001,
+8.802697e-001, 8.806678e-001, 8.810659e-001, 8.814639e-001, 8.818620e-001, 8.822601e-001, 8.826582e-001, 8.830562e-001, 8.834543e-001, 8.838524e-001,
+8.842504e-001, 8.846485e-001, 8.850466e-001, 8.854447e-001, 8.858427e-001, 8.862408e-001, 8.866389e-001, 8.870369e-001, 8.874350e-001, 8.878331e-001,
+8.882312e-001, 8.886292e-001, 8.890273e-001, 8.894254e-001, 8.898234e-001, 8.902073e-001, 8.905797e-001, 8.909522e-001, 8.913246e-001, 8.916971e-001,
+8.920695e-001, 8.924420e-001, 8.928144e-001, 8.931869e-001, 8.935593e-001, 8.939318e-001, 8.943042e-001, 8.946767e-001, 8.950491e-001, 8.954216e-001,
+8.957940e-001, 8.961665e-001, 8.965390e-001, 8.969114e-001, 8.972839e-001, 8.976563e-001, 8.980288e-001, 8.984012e-001, 8.987737e-001, 8.991461e-001,
+8.995186e-001, 8.998910e-001, 9.002465e-001, 9.005951e-001, 9.009436e-001, 9.012921e-001, 9.016406e-001, 9.019891e-001, 9.023376e-001, 9.026861e-001,
+9.030347e-001, 9.033832e-001, 9.037317e-001, 9.040802e-001, 9.044287e-001, 9.047772e-001, 9.051257e-001, 9.054743e-001, 9.058228e-001, 9.061713e-001,
+9.065198e-001, 9.068683e-001, 9.072168e-001, 9.075653e-001, 9.079139e-001, 9.082624e-001, 9.086109e-001, 9.089594e-001, 9.093079e-001, 9.096564e-001,
+9.100046e-001, 9.103308e-001, 9.106570e-001, 9.109831e-001, 9.113093e-001, 9.116355e-001, 9.119617e-001, 9.122878e-001, 9.126140e-001, 9.129402e-001,
+9.132663e-001, 9.135925e-001, 9.139187e-001, 9.142449e-001, 9.145710e-001, 9.148972e-001, 9.152234e-001, 9.155496e-001, 9.158757e-001, 9.162019e-001,
+9.165281e-001, 9.168542e-001, 9.171804e-001, 9.175066e-001, 9.178328e-001, 9.181589e-001, 9.184851e-001, 9.188113e-001, 9.191374e-001, 9.194636e-001,
+9.197898e-001, 9.201086e-001, 9.204139e-001, 9.207192e-001, 9.210246e-001, 9.213299e-001, 9.216352e-001, 9.219406e-001, 9.222459e-001, 9.225513e-001,
+9.228566e-001, 9.231619e-001, 9.234673e-001, 9.237726e-001, 9.240779e-001, 9.243833e-001, 9.246886e-001, 9.249940e-001, 9.252993e-001, 9.256046e-001,
+9.259100e-001, 9.262153e-001, 9.265206e-001, 9.268260e-001, 9.271313e-001, 9.274367e-001, 9.277420e-001, 9.280473e-001, 9.283527e-001, 9.286580e-001,
+9.289633e-001, 9.292687e-001, 9.295740e-001, 9.298794e-001, 9.301730e-001, 9.304589e-001, 9.307448e-001, 9.310307e-001, 9.313166e-001, 9.316026e-001,
+9.318885e-001, 9.321744e-001, 9.324603e-001, 9.327463e-001, 9.330322e-001, 9.333181e-001, 9.336040e-001, 9.338900e-001, 9.341759e-001, 9.344618e-001,
+9.347477e-001, 9.350336e-001, 9.353196e-001, 9.356055e-001, 9.358914e-001, 9.361773e-001, 9.364633e-001, 9.367492e-001, 9.370351e-001, 9.373210e-001,
+9.376070e-001, 9.378929e-001, 9.381788e-001, 9.384647e-001, 9.387506e-001, 9.390366e-001, 9.393225e-001, 9.396084e-001, 9.398943e-001, 9.401689e-001,
+9.404367e-001, 9.407045e-001, 9.409724e-001, 9.412402e-001, 9.415081e-001, 9.417759e-001, 9.420438e-001, 9.423116e-001, 9.425794e-001, 9.428473e-001,
+9.431151e-001, 9.433830e-001, 9.436508e-001, 9.439186e-001, 9.441865e-001, 9.444543e-001, 9.447222e-001, 9.449900e-001, 9.452578e-001, 9.455257e-001,
+9.457935e-001, 9.460614e-001, 9.463292e-001, 9.465971e-001, 9.468649e-001, 9.471327e-001, 9.474006e-001, 9.476684e-001, 9.479363e-001, 9.482041e-001,
+9.484719e-001, 9.487398e-001, 9.490076e-001, 9.492755e-001, 9.495433e-001, 9.498111e-001, 9.500740e-001, 9.503250e-001, 9.505760e-001, 9.508270e-001,
+9.510780e-001, 9.513291e-001, 9.515801e-001, 9.518311e-001, 9.520821e-001, 9.523331e-001, 9.525841e-001, 9.528351e-001, 9.530861e-001, 9.533371e-001,
+9.535881e-001, 9.538391e-001, 9.540901e-001, 9.543411e-001, 9.545921e-001, 9.548432e-001, 9.550942e-001, 9.553452e-001, 9.555962e-001, 9.558472e-001,
+9.560982e-001, 9.563492e-001, 9.566002e-001, 9.568512e-001, 9.571022e-001, 9.573532e-001, 9.576042e-001, 9.578552e-001, 9.581062e-001, 9.583572e-001,
+9.586083e-001, 9.588593e-001, 9.591103e-001, 9.593613e-001, 9.596123e-001, 9.598633e-001, 9.601072e-001, 9.603425e-001, 9.605778e-001, 9.608132e-001,
+9.610485e-001, 9.612839e-001, 9.615192e-001, 9.617545e-001, 9.619899e-001, 9.622252e-001, 9.624605e-001, 9.626959e-001, 9.629312e-001, 9.631666e-001,
+9.634019e-001, 9.636372e-001, 9.638726e-001, 9.641079e-001, 9.643432e-001, 9.645786e-001, 9.648139e-001, 9.650493e-001, 9.652846e-001, 9.655199e-001,
+9.657553e-001, 9.659906e-001, 9.662260e-001, 9.664613e-001, 9.666966e-001, 9.669320e-001, 9.671673e-001, 9.674026e-001, 9.676380e-001, 9.678733e-001,
+9.681087e-001, 9.683440e-001, 9.685793e-001, 9.688147e-001, 9.690500e-001, 9.692854e-001, 9.695207e-001, 9.697560e-001, 9.699914e-001, 9.702127e-001,
+9.704334e-001, 9.706542e-001, 9.708749e-001, 9.710957e-001, 9.713164e-001, 9.715372e-001, 9.717580e-001, 9.719787e-001, 9.721995e-001, 9.724202e-001,
+9.726410e-001, 9.728617e-001, 9.730825e-001, 9.733032e-001, 9.735240e-001, 9.737448e-001, 9.739655e-001, 9.741863e-001, 9.744070e-001, 9.746278e-001,
+9.748485e-001, 9.750693e-001, 9.752901e-001, 9.755108e-001, 9.757316e-001, 9.759523e-001, 9.761731e-001, 9.763938e-001, 9.766146e-001, 9.768353e-001,
+9.770561e-001, 9.772769e-001, 9.774976e-001, 9.777184e-001, 9.779391e-001, 9.781599e-001, 9.783806e-001, 9.786014e-001, 9.788222e-001, 9.790429e-001,
+9.792637e-001, 9.794844e-001, 9.797052e-001, 9.799259e-001, 9.801377e-001, 9.803449e-001, 9.805520e-001, 9.807592e-001, 9.809664e-001, 9.811736e-001,
+9.813808e-001, 9.815880e-001, 9.817952e-001, 9.820024e-001, 9.822095e-001, 9.824167e-001, 9.826239e-001, 9.828311e-001, 9.830383e-001, 9.832455e-001,
+9.834527e-001, 9.836598e-001, 9.838670e-001, 9.840742e-001, 9.842814e-001, 9.844886e-001, 9.846958e-001, 9.849030e-001, 9.851101e-001, 9.853173e-001,
+9.855245e-001, 9.857317e-001, 9.859389e-001, 9.861461e-001, 9.863533e-001, 9.865604e-001, 9.867676e-001, 9.869748e-001, 9.871820e-001, 9.873892e-001,
+9.875964e-001, 9.878036e-001, 9.880108e-001, 9.882179e-001, 9.884251e-001, 9.886323e-001, 9.888395e-001, 9.890467e-001, 9.892539e-001, 9.894611e-001,
+9.896682e-001, 9.898754e-001, 9.900776e-001, 9.902721e-001, 9.904667e-001, 9.906613e-001, 9.908558e-001, 9.910504e-001, 9.912449e-001, 9.914395e-001,
+9.916340e-001, 9.918286e-001, 9.920232e-001, 9.922177e-001, 9.924123e-001, 9.926068e-001, 9.928014e-001, 9.929959e-001, 9.931905e-001, 9.933851e-001,
+9.935796e-001, 9.937742e-001, 9.939687e-001, 9.941633e-001, 9.943578e-001, 9.945524e-001, 9.947470e-001, 9.949415e-001, 9.951361e-001, 9.953306e-001,
+9.955252e-001, 9.957197e-001, 9.959143e-001, 9.961089e-001, 9.963034e-001, 9.964980e-001, 9.966925e-001, 9.968871e-001, 9.970816e-001, 9.972762e-001,
+9.974708e-001, 9.976653e-001, 9.978599e-001, 9.980544e-001, 9.982490e-001, 9.984435e-001, 9.986381e-001, 9.988327e-001, 9.990272e-001, 9.992218e-001,
+9.994163e-001, 9.996109e-001, 9.998054e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.092019e-004, 1.418404e-003, 2.127606e-003, 2.836808e-003, 3.546010e-003, 4.255212e-003, 4.964414e-003, 5.673615e-003, 6.382817e-003,
+7.092019e-003, 7.801221e-003, 8.510423e-003, 9.219625e-003, 9.928827e-003, 1.070556e-002, 1.148982e-002, 1.227409e-002, 1.305835e-002, 1.384261e-002,
+1.462688e-002, 1.541114e-002, 1.619540e-002, 1.697967e-002, 1.776393e-002, 1.854820e-002, 1.933246e-002, 2.012931e-002, 2.099816e-002, 2.186700e-002,
+2.273585e-002, 2.360469e-002, 2.447354e-002, 2.534238e-002, 2.621123e-002, 2.708008e-002, 2.794892e-002, 2.881777e-002, 2.968661e-002, 3.061642e-002,
+3.158062e-002, 3.254482e-002, 3.350902e-002, 3.447322e-002, 3.543743e-002, 3.640163e-002, 3.736583e-002, 3.833003e-002, 3.929423e-002, 4.028725e-002,
+4.135895e-002, 4.243065e-002, 4.350235e-002, 4.457406e-002, 4.564576e-002, 4.671746e-002, 4.778916e-002, 4.886087e-002, 4.993257e-002, 5.111776e-002,
+5.231057e-002, 5.350338e-002, 5.469620e-002, 5.588901e-002, 5.708182e-002, 5.827463e-002, 5.946744e-002, 6.073566e-002, 6.206469e-002, 6.339373e-002,
+6.472277e-002, 6.605181e-002, 6.738084e-002, 6.870988e-002, 7.004339e-002, 7.152525e-002, 7.300711e-002, 7.448898e-002, 7.597084e-002, 7.745270e-002,
+7.893456e-002, 8.046440e-002, 8.211701e-002, 8.376963e-002, 8.542224e-002, 8.707485e-002, 8.872746e-002, 9.042370e-002, 9.226599e-002, 9.410828e-002,
+9.595057e-002, 9.779287e-002, 9.963516e-002, 1.016451e-001, 1.036964e-001, 1.057478e-001, 1.077991e-001, 1.098504e-001, 1.121131e-001, 1.143923e-001,
+1.166716e-001, 1.189509e-001, 1.213624e-001, 1.238868e-001, 1.264112e-001, 1.289356e-001, 1.316097e-001, 1.343929e-001, 1.371762e-001, 1.399595e-001,
+1.430062e-001, 1.460568e-001, 1.491074e-001, 1.523478e-001, 1.556667e-001, 1.589856e-001, 1.624848e-001, 1.660634e-001, 1.696420e-001, 1.734370e-001,
+1.772560e-001, 1.811342e-001, 1.851634e-001, 1.891926e-001, 1.933576e-001, 1.975566e-001, 2.018068e-001, 2.061282e-001, 2.104570e-001, 2.148494e-001,
+2.192418e-001, 2.236507e-001, 2.280632e-001, 2.324603e-001, 2.368456e-001, 2.412119e-001, 2.455295e-001, 2.498471e-001, 2.540682e-001, 2.582857e-001,
+2.624298e-001, 2.665235e-001, 2.705961e-001, 2.745502e-001, 2.785042e-001, 2.823660e-001, 2.861715e-001, 2.899771e-001, 2.936319e-001, 2.972859e-001,
+3.009011e-001, 3.044046e-001, 3.079080e-001, 3.113526e-001, 3.147100e-001, 3.180673e-001, 3.213654e-001, 3.245830e-001, 3.278007e-001, 3.309766e-001,
+3.340623e-001, 3.371481e-001, 3.402245e-001, 3.431869e-001, 3.461493e-001, 3.491117e-001, 3.519939e-001, 3.548417e-001, 3.576895e-001, 3.605173e-001,
+3.632593e-001, 3.660013e-001, 3.687433e-001, 3.714326e-001, 3.740773e-001, 3.767220e-001, 3.793666e-001, 3.819435e-001, 3.844990e-001, 3.870545e-001,
+3.896100e-001, 3.920965e-001, 3.945705e-001, 3.970445e-001, 3.995185e-001, 4.019326e-001, 4.043322e-001, 4.067319e-001, 4.091315e-001, 4.114880e-001,
+4.138199e-001, 4.161519e-001, 4.184838e-001, 4.207942e-001, 4.230645e-001, 4.253348e-001, 4.276051e-001, 4.298755e-001, 4.320928e-001, 4.343071e-001,
+4.365214e-001, 4.387357e-001, 4.409281e-001, 4.430915e-001, 4.452548e-001, 4.474182e-001, 4.495815e-001, 4.517075e-001, 4.538244e-001, 4.559414e-001,
+4.580584e-001, 4.601719e-001, 4.622466e-001, 4.643214e-001, 4.663961e-001, 4.684709e-001, 4.705355e-001, 4.725716e-001, 4.746078e-001, 4.766440e-001,
+4.786801e-001, 4.807039e-001, 4.827047e-001, 4.847055e-001, 4.867063e-001, 4.887071e-001, 4.906964e-001, 4.926646e-001, 4.946328e-001, 4.966011e-001,
+4.985693e-001, 5.005293e-001, 5.024673e-001, 5.044053e-001, 5.063433e-001, 5.082813e-001, 5.102161e-001, 5.121259e-001, 5.140356e-001, 5.159453e-001,
+5.178550e-001, 5.197648e-001, 5.216510e-001, 5.235340e-001, 5.254169e-001, 5.272999e-001, 5.291828e-001, 5.310512e-001, 5.329085e-001, 5.347658e-001,
+5.366231e-001, 5.384803e-001, 5.403331e-001, 5.421654e-001, 5.439976e-001, 5.458299e-001, 5.476622e-001, 5.494945e-001, 5.513089e-001, 5.531164e-001,
+5.549240e-001, 5.567315e-001, 5.585391e-001, 5.603418e-001, 5.621245e-001, 5.639072e-001, 5.656898e-001, 5.674725e-001, 5.692551e-001, 5.710230e-001,
+5.727802e-001, 5.745375e-001, 5.762947e-001, 5.780519e-001, 5.798091e-001, 5.815428e-001, 5.832737e-001, 5.850045e-001, 5.867353e-001, 5.884662e-001,
+5.901939e-001, 5.918970e-001, 5.936001e-001, 5.953033e-001, 5.970064e-001, 5.987095e-001, 6.004055e-001, 6.020793e-001, 6.037531e-001, 6.054268e-001,
+6.071006e-001, 6.087743e-001, 6.104397e-001, 6.120821e-001, 6.137245e-001, 6.153670e-001, 6.170094e-001, 6.186518e-001, 6.202882e-001, 6.218971e-001,
+6.235059e-001, 6.251148e-001, 6.267236e-001, 6.283325e-001, 6.299413e-001, 6.315155e-001, 6.330883e-001, 6.346612e-001, 6.362340e-001, 6.378069e-001,
+6.393797e-001, 6.409292e-001, 6.424635e-001, 6.439978e-001, 6.455321e-001, 6.470664e-001, 6.486007e-001, 6.501314e-001, 6.516245e-001, 6.531176e-001,
+6.546107e-001, 6.561039e-001, 6.575970e-001, 6.590901e-001, 6.605661e-001, 6.620155e-001, 6.634649e-001, 6.649142e-001, 6.663636e-001, 6.678130e-001,
+6.692623e-001, 6.706890e-001, 6.720921e-001, 6.734952e-001, 6.748983e-001, 6.763014e-001, 6.777046e-001, 6.791077e-001, 6.804931e-001, 6.818477e-001,
+6.832023e-001, 6.845569e-001, 6.859115e-001, 6.872661e-001, 6.886206e-001, 6.899752e-001, 6.912802e-001, 6.925842e-001, 6.938882e-001, 6.951922e-001,
+6.964963e-001, 6.978003e-001, 6.991043e-001, 7.003920e-001, 7.016437e-001, 7.028955e-001, 7.041472e-001, 7.053990e-001, 7.066508e-001, 7.079025e-001,
+7.091543e-001, 7.103886e-001, 7.115868e-001, 7.127850e-001, 7.139832e-001, 7.151813e-001, 7.163795e-001, 7.175777e-001, 7.187758e-001, 7.199740e-001,
+7.211189e-001, 7.222625e-001, 7.234062e-001, 7.245499e-001, 7.256936e-001, 7.268372e-001, 7.279809e-001, 7.291246e-001, 7.302554e-001, 7.313441e-001,
+7.324328e-001, 7.335215e-001, 7.346102e-001, 7.356989e-001, 7.367876e-001, 7.378763e-001, 7.389650e-001, 7.400510e-001, 7.410847e-001, 7.421183e-001,
+7.431520e-001, 7.441857e-001, 7.452194e-001, 7.462531e-001, 7.472868e-001, 7.483205e-001, 7.493542e-001, 7.503673e-001, 7.513464e-001, 7.523254e-001,
+7.533045e-001, 7.542835e-001, 7.552626e-001, 7.562417e-001, 7.572207e-001, 7.581998e-001, 7.591788e-001, 7.601492e-001, 7.610744e-001, 7.619995e-001,
+7.629247e-001, 7.638499e-001, 7.647751e-001, 7.657003e-001, 7.666255e-001, 7.675507e-001, 7.684758e-001, 7.694010e-001, 7.703076e-001, 7.711801e-001,
+7.720525e-001, 7.729249e-001, 7.737974e-001, 7.746698e-001, 7.755423e-001, 7.764147e-001, 7.772872e-001, 7.781596e-001, 7.790321e-001, 7.799045e-001,
+7.807313e-001, 7.815524e-001, 7.823736e-001, 7.831947e-001, 7.840158e-001, 7.848370e-001, 7.856581e-001, 7.864793e-001, 7.873004e-001, 7.881216e-001,
+7.889427e-001, 7.897638e-001, 7.905496e-001, 7.913212e-001, 7.920927e-001, 7.928642e-001, 7.936358e-001, 7.944073e-001, 7.951788e-001, 7.959504e-001,
+7.967219e-001, 7.974934e-001, 7.982650e-001, 7.990365e-001, 7.998080e-001, 8.005437e-001, 8.012676e-001, 8.019914e-001, 8.027152e-001, 8.034391e-001,
+8.041629e-001, 8.048867e-001, 8.056106e-001, 8.063344e-001, 8.070582e-001, 8.077820e-001, 8.085059e-001, 8.092297e-001, 8.099535e-001, 8.106346e-001,
+8.113128e-001, 8.119910e-001, 8.126692e-001, 8.133474e-001, 8.140256e-001, 8.147038e-001, 8.153820e-001, 8.160601e-001, 8.167383e-001, 8.174165e-001,
+8.180947e-001, 8.187729e-001, 8.194511e-001, 8.201210e-001, 8.207557e-001, 8.213904e-001, 8.220251e-001, 8.226598e-001, 8.232945e-001, 8.239293e-001,
+8.245640e-001, 8.251987e-001, 8.258334e-001, 8.264681e-001, 8.271028e-001, 8.277375e-001, 8.283723e-001, 8.290070e-001, 8.296417e-001, 8.302584e-001,
+8.308519e-001, 8.314454e-001, 8.320389e-001, 8.326324e-001, 8.332258e-001, 8.338193e-001, 8.344128e-001, 8.350063e-001, 8.355997e-001, 8.361932e-001,
+8.367867e-001, 8.373802e-001, 8.379737e-001, 8.385671e-001, 8.391606e-001, 8.397541e-001, 8.403248e-001, 8.408793e-001, 8.414338e-001, 8.419883e-001,
+8.425428e-001, 8.430973e-001, 8.436518e-001, 8.442063e-001, 8.447608e-001, 8.453153e-001, 8.458698e-001, 8.464243e-001, 8.469788e-001, 8.475333e-001,
+8.480879e-001, 8.486424e-001, 8.491969e-001, 8.497514e-001, 8.502856e-001, 8.508034e-001, 8.513212e-001, 8.518390e-001, 8.523568e-001, 8.528746e-001,
+8.533924e-001, 8.539102e-001, 8.544280e-001, 8.549458e-001, 8.554636e-001, 8.559814e-001, 8.564992e-001, 8.570170e-001, 8.575347e-001, 8.580525e-001,
+8.585703e-001, 8.590881e-001, 8.596059e-001, 8.601155e-001, 8.605988e-001, 8.610821e-001, 8.615654e-001, 8.620487e-001, 8.625320e-001, 8.630153e-001,
+8.634986e-001, 8.639819e-001, 8.644652e-001, 8.649485e-001, 8.654318e-001, 8.659152e-001, 8.663985e-001, 8.668818e-001, 8.673651e-001, 8.678484e-001,
+8.683317e-001, 8.688150e-001, 8.692983e-001, 8.697816e-001, 8.702472e-001, 8.706982e-001, 8.711492e-001, 8.716002e-001, 8.720511e-001, 8.725021e-001,
+8.729531e-001, 8.734041e-001, 8.738551e-001, 8.743061e-001, 8.747571e-001, 8.752081e-001, 8.756590e-001, 8.761100e-001, 8.765610e-001, 8.770120e-001,
+8.774630e-001, 8.779140e-001, 8.783650e-001, 8.788160e-001, 8.792670e-001, 8.797179e-001, 8.801576e-001, 8.805784e-001, 8.809991e-001, 8.814199e-001,
+8.818407e-001, 8.822614e-001, 8.826822e-001, 8.831030e-001, 8.835237e-001, 8.839445e-001, 8.843653e-001, 8.847860e-001, 8.852068e-001, 8.856276e-001,
+8.860483e-001, 8.864691e-001, 8.868899e-001, 8.873106e-001, 8.877314e-001, 8.881522e-001, 8.885729e-001, 8.889937e-001, 8.894145e-001, 8.898352e-001,
+8.902388e-001, 8.906314e-001, 8.910240e-001, 8.914165e-001, 8.918091e-001, 8.922016e-001, 8.925942e-001, 8.929867e-001, 8.933793e-001, 8.937719e-001,
+8.941644e-001, 8.945570e-001, 8.949495e-001, 8.953421e-001, 8.957346e-001, 8.961272e-001, 8.965198e-001, 8.969123e-001, 8.973049e-001, 8.976974e-001,
+8.980900e-001, 8.984825e-001, 8.988751e-001, 8.992677e-001, 8.996602e-001, 9.000492e-001, 9.004155e-001, 9.007818e-001, 9.011480e-001, 9.015143e-001,
+9.018806e-001, 9.022468e-001, 9.026131e-001, 9.029793e-001, 9.033456e-001, 9.037119e-001, 9.040781e-001, 9.044444e-001, 9.048107e-001, 9.051769e-001,
+9.055432e-001, 9.059095e-001, 9.062757e-001, 9.066420e-001, 9.070083e-001, 9.073745e-001, 9.077408e-001, 9.081071e-001, 9.084733e-001, 9.088396e-001,
+9.092058e-001, 9.095721e-001, 9.099384e-001, 9.102843e-001, 9.106261e-001, 9.109679e-001, 9.113097e-001, 9.116514e-001, 9.119932e-001, 9.123350e-001,
+9.126768e-001, 9.130186e-001, 9.133604e-001, 9.137022e-001, 9.140440e-001, 9.143858e-001, 9.147276e-001, 9.150693e-001, 9.154111e-001, 9.157529e-001,
+9.160947e-001, 9.164365e-001, 9.167783e-001, 9.171201e-001, 9.174619e-001, 9.178037e-001, 9.181455e-001, 9.184872e-001, 9.188290e-001, 9.191708e-001,
+9.195126e-001, 9.198544e-001, 9.201831e-001, 9.205022e-001, 9.208212e-001, 9.211402e-001, 9.214592e-001, 9.217783e-001, 9.220973e-001, 9.224163e-001,
+9.227354e-001, 9.230544e-001, 9.233734e-001, 9.236925e-001, 9.240115e-001, 9.243305e-001, 9.246495e-001, 9.249686e-001, 9.252876e-001, 9.256066e-001,
+9.259257e-001, 9.262447e-001, 9.265637e-001, 9.268828e-001, 9.272018e-001, 9.275208e-001, 9.278399e-001, 9.281589e-001, 9.284779e-001, 9.287969e-001,
+9.291160e-001, 9.294350e-001, 9.297540e-001, 9.300682e-001, 9.303661e-001, 9.306640e-001, 9.309619e-001, 9.312597e-001, 9.315576e-001, 9.318555e-001,
+9.321534e-001, 9.324513e-001, 9.327492e-001, 9.330470e-001, 9.333449e-001, 9.336428e-001, 9.339407e-001, 9.342386e-001, 9.345364e-001, 9.348343e-001,
+9.351322e-001, 9.354301e-001, 9.357280e-001, 9.360259e-001, 9.363237e-001, 9.366216e-001, 9.369195e-001, 9.372174e-001, 9.375153e-001, 9.378132e-001,
+9.381110e-001, 9.384089e-001, 9.387068e-001, 9.390047e-001, 9.393026e-001, 9.396004e-001, 9.398983e-001, 9.401833e-001, 9.404615e-001, 9.407398e-001,
+9.410180e-001, 9.412962e-001, 9.415745e-001, 9.418527e-001, 9.421310e-001, 9.424092e-001, 9.426875e-001, 9.429657e-001, 9.432440e-001, 9.435222e-001,
+9.438004e-001, 9.440787e-001, 9.443569e-001, 9.446352e-001, 9.449134e-001, 9.451917e-001, 9.454699e-001, 9.457481e-001, 9.460264e-001, 9.463046e-001,
+9.465829e-001, 9.468611e-001, 9.471394e-001, 9.474176e-001, 9.476959e-001, 9.479741e-001, 9.482523e-001, 9.485306e-001, 9.488088e-001, 9.490871e-001,
+9.493653e-001, 9.496436e-001, 9.499218e-001, 9.501869e-001, 9.504470e-001, 9.507070e-001, 9.509670e-001, 9.512270e-001, 9.514870e-001, 9.517470e-001,
+9.520070e-001, 9.522671e-001, 9.525271e-001, 9.527871e-001, 9.530471e-001, 9.533071e-001, 9.535671e-001, 9.538271e-001, 9.540872e-001, 9.543472e-001,
+9.546072e-001, 9.548672e-001, 9.551272e-001, 9.553872e-001, 9.556472e-001, 9.559073e-001, 9.561673e-001, 9.564273e-001, 9.566873e-001, 9.569473e-001,
+9.572073e-001, 9.574673e-001, 9.577274e-001, 9.579874e-001, 9.582474e-001, 9.585074e-001, 9.587674e-001, 9.590274e-001, 9.592875e-001, 9.595475e-001,
+9.598075e-001, 9.600631e-001, 9.603062e-001, 9.605493e-001, 9.607924e-001, 9.610355e-001, 9.612786e-001, 9.615217e-001, 9.617648e-001, 9.620079e-001,
+9.622510e-001, 9.624941e-001, 9.627372e-001, 9.629803e-001, 9.632234e-001, 9.634665e-001, 9.637096e-001, 9.639527e-001, 9.641958e-001, 9.644389e-001,
+9.646820e-001, 9.649251e-001, 9.651682e-001, 9.654113e-001, 9.656544e-001, 9.658975e-001, 9.661406e-001, 9.663837e-001, 9.666268e-001, 9.668699e-001,
+9.671130e-001, 9.673561e-001, 9.675992e-001, 9.678423e-001, 9.680854e-001, 9.683285e-001, 9.685716e-001, 9.688147e-001, 9.690578e-001, 9.693009e-001,
+9.695440e-001, 9.697871e-001, 9.700282e-001, 9.702556e-001, 9.704830e-001, 9.707104e-001, 9.709378e-001, 9.711653e-001, 9.713927e-001, 9.716201e-001,
+9.718475e-001, 9.720749e-001, 9.723023e-001, 9.725297e-001, 9.727571e-001, 9.729845e-001, 9.732119e-001, 9.734393e-001, 9.736667e-001, 9.738941e-001,
+9.741215e-001, 9.743489e-001, 9.745763e-001, 9.748037e-001, 9.750311e-001, 9.752585e-001, 9.754859e-001, 9.757134e-001, 9.759408e-001, 9.761682e-001,
+9.763956e-001, 9.766230e-001, 9.768504e-001, 9.770778e-001, 9.773052e-001, 9.775326e-001, 9.777600e-001, 9.779874e-001, 9.782148e-001, 9.784422e-001,
+9.786696e-001, 9.788970e-001, 9.791244e-001, 9.793518e-001, 9.795792e-001, 9.798066e-001, 9.800319e-001, 9.802447e-001, 9.804576e-001, 9.806704e-001,
+9.808832e-001, 9.810961e-001, 9.813089e-001, 9.815218e-001, 9.817346e-001, 9.819475e-001, 9.821603e-001, 9.823732e-001, 9.825860e-001, 9.827988e-001,
+9.830117e-001, 9.832245e-001, 9.834374e-001, 9.836502e-001, 9.838631e-001, 9.840759e-001, 9.842888e-001, 9.845016e-001, 9.847144e-001, 9.849273e-001,
+9.851401e-001, 9.853530e-001, 9.855658e-001, 9.857787e-001, 9.859915e-001, 9.862043e-001, 9.864172e-001, 9.866300e-001, 9.868429e-001, 9.870557e-001,
+9.872686e-001, 9.874814e-001, 9.876943e-001, 9.879071e-001, 9.881199e-001, 9.883328e-001, 9.885456e-001, 9.887585e-001, 9.889713e-001, 9.891842e-001,
+9.893970e-001, 9.896099e-001, 9.898227e-001, 9.900333e-001, 9.902326e-001, 9.904320e-001, 9.906313e-001, 9.908306e-001, 9.910300e-001, 9.912293e-001,
+9.914286e-001, 9.916280e-001, 9.918273e-001, 9.920266e-001, 9.922260e-001, 9.924253e-001, 9.926246e-001, 9.928240e-001, 9.930233e-001, 9.932226e-001,
+9.934220e-001, 9.936213e-001, 9.938206e-001, 9.940200e-001, 9.942193e-001, 9.944186e-001, 9.946180e-001, 9.948173e-001, 9.950166e-001, 9.952160e-001,
+9.954153e-001, 9.956146e-001, 9.958140e-001, 9.960133e-001, 9.962127e-001, 9.964120e-001, 9.966113e-001, 9.968107e-001, 9.970100e-001, 9.972093e-001,
+9.974087e-001, 9.976080e-001, 9.978073e-001, 9.980067e-001, 9.982060e-001, 9.984053e-001, 9.986047e-001, 9.988040e-001, 9.990033e-001, 9.992027e-001,
+9.994020e-001, 9.996013e-001, 9.998007e-001, 1.000000e+000)),
+("Kodak", "DSCS 3155", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.812047e-003, 9.624095e-003, 1.450092e-002, 1.938324e-002, 2.429684e-002, 2.921496e-002, 3.413533e-002, 3.905613e-002, 4.395442e-002,
+4.884738e-002, 5.369847e-002, 5.853667e-002, 6.332082e-002, 6.808154e-002, 7.278507e-002, 7.745000e-002, 8.206517e-002, 8.662034e-002, 9.114463e-002,
+9.558012e-002, 1.000152e-001, 1.043246e-001, 1.086341e-001, 1.128552e-001, 1.170353e-001, 1.211776e-001, 1.252277e-001, 1.292777e-001, 1.332219e-001,
+1.371431e-001, 1.410301e-001, 1.448253e-001, 1.486205e-001, 1.523380e-001, 1.560111e-001, 1.596842e-001, 1.632500e-001, 1.668058e-001, 1.703502e-001,
+1.737939e-001, 1.772377e-001, 1.806604e-001, 1.839977e-001, 1.873350e-001, 1.906520e-001, 1.938886e-001, 1.971253e-001, 2.003513e-001, 2.034930e-001,
+2.066347e-001, 2.097764e-001, 2.128353e-001, 2.158877e-001, 2.189402e-001, 2.219380e-001, 2.249068e-001, 2.278755e-001, 2.308220e-001, 2.337123e-001,
+2.366027e-001, 2.394930e-001, 2.423229e-001, 2.451399e-001, 2.479569e-001, 2.507550e-001, 2.535035e-001, 2.562520e-001, 2.590004e-001, 2.617082e-001,
+2.643926e-001, 2.670771e-001, 2.697615e-001, 2.723915e-001, 2.750162e-001, 2.776409e-001, 2.802600e-001, 2.828289e-001, 2.853978e-001, 2.879667e-001,
+2.905247e-001, 2.930415e-001, 2.955583e-001, 2.980751e-001, 3.005805e-001, 3.030486e-001, 3.055167e-001, 3.079848e-001, 3.104445e-001, 3.128670e-001,
+3.152896e-001, 3.177121e-001, 3.201322e-001, 3.225121e-001, 3.248919e-001, 3.272718e-001, 3.296516e-001, 3.319972e-001, 3.343370e-001, 3.366767e-001,
+3.390165e-001, 3.413344e-001, 3.436364e-001, 3.459384e-001, 3.482405e-001, 3.505341e-001, 3.528005e-001, 3.550669e-001, 3.573333e-001, 3.595997e-001,
+3.618383e-001, 3.640710e-001, 3.663036e-001, 3.685363e-001, 3.707579e-001, 3.729584e-001, 3.751589e-001, 3.773594e-001, 3.795599e-001, 3.817359e-001,
+3.839056e-001, 3.860754e-001, 3.882452e-001, 3.904093e-001, 3.925495e-001, 3.946897e-001, 3.968299e-001, 3.989701e-001, 4.010954e-001, 4.032069e-001,
+4.053184e-001, 4.074299e-001, 4.095415e-001, 4.116311e-001, 4.137147e-001, 4.157982e-001, 4.178818e-001, 4.199654e-001, 4.220219e-001, 4.240780e-001,
+4.261341e-001, 4.281901e-001, 4.302430e-001, 4.322718e-001, 4.343007e-001, 4.363296e-001, 4.383584e-001, 4.403821e-001, 4.423838e-001, 4.443855e-001,
+4.463872e-001, 4.483889e-001, 4.503852e-001, 4.523596e-001, 4.543340e-001, 4.563083e-001, 4.582827e-001, 4.602535e-001, 4.622002e-001, 4.641468e-001,
+4.660935e-001, 4.680402e-001, 4.699869e-001, 4.719056e-001, 4.738240e-001, 4.757425e-001, 4.776609e-001, 4.795794e-001, 4.814753e-001, 4.833648e-001,
+4.852543e-001, 4.871438e-001, 4.890333e-001, 4.909083e-001, 4.927679e-001, 4.946276e-001, 4.964873e-001, 4.983470e-001, 5.002033e-001, 5.020321e-001,
+5.038609e-001, 5.056897e-001, 5.075186e-001, 5.093474e-001, 5.111556e-001, 5.129525e-001, 5.147493e-001, 5.165461e-001, 5.183429e-001, 5.201371e-001,
+5.219007e-001, 5.236643e-001, 5.254278e-001, 5.271914e-001, 5.289549e-001, 5.307044e-001, 5.324333e-001, 5.341623e-001, 5.358912e-001, 5.376202e-001,
+5.393491e-001, 5.410556e-001, 5.427486e-001, 5.444415e-001, 5.461345e-001, 5.478274e-001, 5.495204e-001, 5.511866e-001, 5.528421e-001, 5.544977e-001,
+5.561532e-001, 5.578088e-001, 5.594643e-001, 5.610936e-001, 5.627104e-001, 5.643271e-001, 5.659438e-001, 5.675606e-001, 5.691773e-001, 5.707743e-001,
+5.723509e-001, 5.739275e-001, 5.755040e-001, 5.770806e-001, 5.786571e-001, 5.802275e-001, 5.817626e-001, 5.832977e-001, 5.848327e-001, 5.863678e-001,
+5.879029e-001, 5.894379e-001, 5.909459e-001, 5.924383e-001, 5.939307e-001, 5.954230e-001, 5.969154e-001, 5.984077e-001, 5.999001e-001, 6.013516e-001,
+6.028002e-001, 6.042487e-001, 6.056973e-001, 6.071458e-001, 6.085944e-001, 6.100416e-001, 6.114454e-001, 6.128492e-001, 6.142530e-001, 6.156568e-001,
+6.170606e-001, 6.184644e-001, 6.198683e-001, 6.212308e-001, 6.225890e-001, 6.239473e-001, 6.253056e-001, 6.266638e-001, 6.280221e-001, 6.293803e-001,
+6.307135e-001, 6.320256e-001, 6.333377e-001, 6.346498e-001, 6.359619e-001, 6.372740e-001, 6.385861e-001, 6.398982e-001, 6.411673e-001, 6.424328e-001,
+6.436983e-001, 6.449638e-001, 6.462294e-001, 6.474949e-001, 6.487604e-001, 6.500249e-001, 6.512436e-001, 6.524624e-001, 6.536811e-001, 6.548998e-001,
+6.561185e-001, 6.573372e-001, 6.585559e-001, 6.597746e-001, 6.609551e-001, 6.621270e-001, 6.632988e-001, 6.644707e-001, 6.656426e-001, 6.668144e-001,
+6.679863e-001, 6.691582e-001, 6.703169e-001, 6.714421e-001, 6.725673e-001, 6.736925e-001, 6.748177e-001, 6.759429e-001, 6.770681e-001, 6.781933e-001,
+6.793185e-001, 6.804254e-001, 6.815043e-001, 6.825832e-001, 6.836621e-001, 6.847409e-001, 6.858198e-001, 6.868987e-001, 6.879776e-001, 6.890565e-001,
+6.901296e-001, 6.911628e-001, 6.921959e-001, 6.932290e-001, 6.942621e-001, 6.952952e-001, 6.963283e-001, 6.973615e-001, 6.983946e-001, 6.994277e-001,
+7.004407e-001, 7.014288e-001, 7.024168e-001, 7.034049e-001, 7.043930e-001, 7.053810e-001, 7.063691e-001, 7.073571e-001, 7.083452e-001, 7.093333e-001,
+7.103069e-001, 7.112508e-001, 7.121947e-001, 7.131385e-001, 7.140824e-001, 7.150263e-001, 7.159701e-001, 7.169140e-001, 7.178578e-001, 7.188017e-001,
+7.197456e-001, 7.206579e-001, 7.215585e-001, 7.224592e-001, 7.233599e-001, 7.242605e-001, 7.251612e-001, 7.260619e-001, 7.269625e-001, 7.278632e-001,
+7.287639e-001, 7.296645e-001, 7.305388e-001, 7.313974e-001, 7.322560e-001, 7.331146e-001, 7.339732e-001, 7.348317e-001, 7.356903e-001, 7.365489e-001,
+7.374075e-001, 7.382661e-001, 7.391247e-001, 7.399833e-001, 7.408018e-001, 7.416195e-001, 7.424373e-001, 7.432550e-001, 7.440727e-001, 7.448904e-001,
+7.457082e-001, 7.465259e-001, 7.473436e-001, 7.481614e-001, 7.489791e-001, 7.497968e-001, 7.505848e-001, 7.513630e-001, 7.521412e-001, 7.529194e-001,
+7.536975e-001, 7.544757e-001, 7.552539e-001, 7.560320e-001, 7.568102e-001, 7.575884e-001, 7.583666e-001, 7.591447e-001, 7.599229e-001, 7.606667e-001,
+7.614067e-001, 7.621466e-001, 7.628866e-001, 7.636266e-001, 7.643666e-001, 7.651066e-001, 7.658466e-001, 7.665865e-001, 7.673265e-001, 7.680665e-001,
+7.688065e-001, 7.695465e-001, 7.702722e-001, 7.709754e-001, 7.716786e-001, 7.723818e-001, 7.730850e-001, 7.737883e-001, 7.744915e-001, 7.751947e-001,
+7.758979e-001, 7.766011e-001, 7.773043e-001, 7.780075e-001, 7.787107e-001, 7.794139e-001, 7.801112e-001, 7.807791e-001, 7.814470e-001, 7.821149e-001,
+7.827827e-001, 7.834506e-001, 7.841185e-001, 7.847864e-001, 7.854542e-001, 7.861221e-001, 7.867900e-001, 7.874579e-001, 7.881257e-001, 7.887936e-001,
+7.894615e-001, 7.901228e-001, 7.907568e-001, 7.913908e-001, 7.920248e-001, 7.926588e-001, 7.932929e-001, 7.939269e-001, 7.945609e-001, 7.951949e-001,
+7.958289e-001, 7.964629e-001, 7.970969e-001, 7.977309e-001, 7.983649e-001, 7.989989e-001, 7.996329e-001, 8.002533e-001, 8.008549e-001, 8.014565e-001,
+8.020581e-001, 8.026597e-001, 8.032614e-001, 8.038630e-001, 8.044646e-001, 8.050662e-001, 8.056678e-001, 8.062694e-001, 8.068710e-001, 8.074726e-001,
+8.080742e-001, 8.086758e-001, 8.092774e-001, 8.098791e-001, 8.104559e-001, 8.110266e-001, 8.115973e-001, 8.121680e-001, 8.127386e-001, 8.133093e-001,
+8.138800e-001, 8.144506e-001, 8.150213e-001, 8.155920e-001, 8.161626e-001, 8.167333e-001, 8.173040e-001, 8.178747e-001, 8.184453e-001, 8.190160e-001,
+8.195867e-001, 8.201492e-001, 8.206904e-001, 8.212316e-001, 8.217727e-001, 8.223139e-001, 8.228551e-001, 8.233962e-001, 8.239374e-001, 8.244786e-001,
+8.250198e-001, 8.255609e-001, 8.261021e-001, 8.266433e-001, 8.271845e-001, 8.277256e-001, 8.282668e-001, 8.288080e-001, 8.293492e-001, 8.298903e-001,
+8.304091e-001, 8.309222e-001, 8.314353e-001, 8.319484e-001, 8.324615e-001, 8.329746e-001, 8.334877e-001, 8.340008e-001, 8.345139e-001, 8.350270e-001,
+8.355401e-001, 8.360532e-001, 8.365663e-001, 8.370794e-001, 8.375925e-001, 8.381056e-001, 8.386187e-001, 8.391318e-001, 8.396449e-001, 8.401497e-001,
+8.406362e-001, 8.411226e-001, 8.416090e-001, 8.420954e-001, 8.425818e-001, 8.430682e-001, 8.435546e-001, 8.440410e-001, 8.445274e-001, 8.450138e-001,
+8.455002e-001, 8.459866e-001, 8.464730e-001, 8.469594e-001, 8.474458e-001, 8.479322e-001, 8.484186e-001, 8.489050e-001, 8.493914e-001, 8.498778e-001,
+8.503453e-001, 8.508063e-001, 8.512674e-001, 8.517284e-001, 8.521895e-001, 8.526506e-001, 8.531116e-001, 8.535727e-001, 8.540337e-001, 8.544948e-001,
+8.549559e-001, 8.554169e-001, 8.558780e-001, 8.563391e-001, 8.568001e-001, 8.572612e-001, 8.577222e-001, 8.581833e-001, 8.586444e-001, 8.591054e-001,
+8.595665e-001, 8.600261e-001, 8.604631e-001, 8.609001e-001, 8.613372e-001, 8.617742e-001, 8.622112e-001, 8.626482e-001, 8.630852e-001, 8.635223e-001,
+8.639593e-001, 8.643963e-001, 8.648333e-001, 8.652703e-001, 8.657074e-001, 8.661444e-001, 8.665814e-001, 8.670184e-001, 8.674554e-001, 8.678925e-001,
+8.683295e-001, 8.687665e-001, 8.692035e-001, 8.696406e-001, 8.700735e-001, 8.704878e-001, 8.709020e-001, 8.713162e-001, 8.717305e-001, 8.721447e-001,
+8.725590e-001, 8.729732e-001, 8.733874e-001, 8.738017e-001, 8.742159e-001, 8.746302e-001, 8.750444e-001, 8.754586e-001, 8.758729e-001, 8.762871e-001,
+8.767014e-001, 8.771156e-001, 8.775298e-001, 8.779441e-001, 8.783583e-001, 8.787726e-001, 8.791868e-001, 8.796010e-001, 8.800145e-001, 8.804072e-001,
+8.807998e-001, 8.811925e-001, 8.815852e-001, 8.819778e-001, 8.823705e-001, 8.827632e-001, 8.831558e-001, 8.835485e-001, 8.839412e-001, 8.843338e-001,
+8.847265e-001, 8.851192e-001, 8.855119e-001, 8.859045e-001, 8.862972e-001, 8.866899e-001, 8.870825e-001, 8.874752e-001, 8.878679e-001, 8.882605e-001,
+8.886532e-001, 8.890459e-001, 8.894385e-001, 8.898312e-001, 8.902122e-001, 8.905845e-001, 8.909568e-001, 8.913290e-001, 8.917013e-001, 8.920735e-001,
+8.924458e-001, 8.928181e-001, 8.931903e-001, 8.935626e-001, 8.939348e-001, 8.943071e-001, 8.946794e-001, 8.950516e-001, 8.954239e-001, 8.957961e-001,
+8.961684e-001, 8.965406e-001, 8.969129e-001, 8.972852e-001, 8.976574e-001, 8.980297e-001, 8.984019e-001, 8.987742e-001, 8.991465e-001, 8.995187e-001,
+8.998910e-001, 9.002496e-001, 9.006025e-001, 9.009555e-001, 9.013085e-001, 9.016614e-001, 9.020144e-001, 9.023673e-001, 9.027203e-001, 9.030732e-001,
+9.034262e-001, 9.037792e-001, 9.041321e-001, 9.044851e-001, 9.048380e-001, 9.051910e-001, 9.055439e-001, 9.058969e-001, 9.062499e-001, 9.066028e-001,
+9.069558e-001, 9.073087e-001, 9.076617e-001, 9.080146e-001, 9.083676e-001, 9.087206e-001, 9.090735e-001, 9.094265e-001, 9.097794e-001, 9.101255e-001,
+9.104603e-001, 9.107950e-001, 9.111297e-001, 9.114644e-001, 9.117991e-001, 9.121338e-001, 9.124685e-001, 9.128033e-001, 9.131380e-001, 9.134727e-001,
+9.138074e-001, 9.141421e-001, 9.144768e-001, 9.148115e-001, 9.151463e-001, 9.154810e-001, 9.158157e-001, 9.161504e-001, 9.164851e-001, 9.168198e-001,
+9.171545e-001, 9.174893e-001, 9.178240e-001, 9.181587e-001, 9.184934e-001, 9.188281e-001, 9.191628e-001, 9.194975e-001, 9.198323e-001, 9.201584e-001,
+9.204758e-001, 9.207933e-001, 9.211108e-001, 9.214283e-001, 9.217458e-001, 9.220632e-001, 9.223807e-001, 9.226982e-001, 9.230157e-001, 9.233332e-001,
+9.236506e-001, 9.239681e-001, 9.242856e-001, 9.246031e-001, 9.249205e-001, 9.252380e-001, 9.255555e-001, 9.258730e-001, 9.261905e-001, 9.265079e-001,
+9.268254e-001, 9.271429e-001, 9.274604e-001, 9.277778e-001, 9.280953e-001, 9.284128e-001, 9.287303e-001, 9.290478e-001, 9.293652e-001, 9.296827e-001,
+9.300002e-001, 9.303014e-001, 9.306026e-001, 9.309038e-001, 9.312050e-001, 9.315062e-001, 9.318074e-001, 9.321086e-001, 9.324098e-001, 9.327110e-001,
+9.330122e-001, 9.333134e-001, 9.336146e-001, 9.339158e-001, 9.342170e-001, 9.345182e-001, 9.348194e-001, 9.351206e-001, 9.354218e-001, 9.357230e-001,
+9.360242e-001, 9.363254e-001, 9.366265e-001, 9.369277e-001, 9.372289e-001, 9.375301e-001, 9.378313e-001, 9.381325e-001, 9.384337e-001, 9.387349e-001,
+9.390361e-001, 9.393373e-001, 9.396385e-001, 9.399397e-001, 9.402286e-001, 9.405145e-001, 9.408003e-001, 9.410861e-001, 9.413719e-001, 9.416578e-001,
+9.419436e-001, 9.422294e-001, 9.425153e-001, 9.428011e-001, 9.430869e-001, 9.433727e-001, 9.436586e-001, 9.439444e-001, 9.442302e-001, 9.445160e-001,
+9.448019e-001, 9.450877e-001, 9.453735e-001, 9.456594e-001, 9.459452e-001, 9.462310e-001, 9.465168e-001, 9.468027e-001, 9.470885e-001, 9.473743e-001,
+9.476601e-001, 9.479460e-001, 9.482318e-001, 9.485176e-001, 9.488034e-001, 9.490893e-001, 9.493751e-001, 9.496609e-001, 9.499468e-001, 9.502208e-001,
+9.504921e-001, 9.507634e-001, 9.510347e-001, 9.513060e-001, 9.515774e-001, 9.518487e-001, 9.521200e-001, 9.523913e-001, 9.526626e-001, 9.529339e-001,
+9.532052e-001, 9.534766e-001, 9.537479e-001, 9.540192e-001, 9.542905e-001, 9.545618e-001, 9.548331e-001, 9.551044e-001, 9.553758e-001, 9.556471e-001,
+9.559184e-001, 9.561897e-001, 9.564610e-001, 9.567323e-001, 9.570037e-001, 9.572750e-001, 9.575463e-001, 9.578176e-001, 9.580889e-001, 9.583602e-001,
+9.586315e-001, 9.589029e-001, 9.591742e-001, 9.594455e-001, 9.597168e-001, 9.599881e-001, 9.602463e-001, 9.605040e-001, 9.607616e-001, 9.610192e-001,
+9.612768e-001, 9.615344e-001, 9.617920e-001, 9.620497e-001, 9.623073e-001, 9.625649e-001, 9.628225e-001, 9.630801e-001, 9.633377e-001, 9.635954e-001,
+9.638530e-001, 9.641106e-001, 9.643682e-001, 9.646258e-001, 9.648834e-001, 9.651411e-001, 9.653987e-001, 9.656563e-001, 9.659139e-001, 9.661715e-001,
+9.664291e-001, 9.666868e-001, 9.669444e-001, 9.672020e-001, 9.674596e-001, 9.677172e-001, 9.679748e-001, 9.682325e-001, 9.684901e-001, 9.687477e-001,
+9.690053e-001, 9.692629e-001, 9.695205e-001, 9.697782e-001, 9.700340e-001, 9.702787e-001, 9.705233e-001, 9.707680e-001, 9.710127e-001, 9.712574e-001,
+9.715021e-001, 9.717468e-001, 9.719915e-001, 9.722362e-001, 9.724808e-001, 9.727255e-001, 9.729702e-001, 9.732149e-001, 9.734596e-001, 9.737043e-001,
+9.739490e-001, 9.741936e-001, 9.744383e-001, 9.746830e-001, 9.749277e-001, 9.751724e-001, 9.754171e-001, 9.756618e-001, 9.759065e-001, 9.761511e-001,
+9.763958e-001, 9.766405e-001, 9.768852e-001, 9.771299e-001, 9.773746e-001, 9.776193e-001, 9.778640e-001, 9.781086e-001, 9.783533e-001, 9.785980e-001,
+9.788427e-001, 9.790874e-001, 9.793321e-001, 9.795768e-001, 9.798214e-001, 9.800628e-001, 9.802953e-001, 9.805278e-001, 9.807603e-001, 9.809928e-001,
+9.812252e-001, 9.814577e-001, 9.816902e-001, 9.819227e-001, 9.821552e-001, 9.823877e-001, 9.826201e-001, 9.828526e-001, 9.830851e-001, 9.833176e-001,
+9.835501e-001, 9.837826e-001, 9.840150e-001, 9.842475e-001, 9.844800e-001, 9.847125e-001, 9.849450e-001, 9.851775e-001, 9.854099e-001, 9.856424e-001,
+9.858749e-001, 9.861074e-001, 9.863399e-001, 9.865724e-001, 9.868048e-001, 9.870373e-001, 9.872698e-001, 9.875023e-001, 9.877348e-001, 9.879673e-001,
+9.881997e-001, 9.884322e-001, 9.886647e-001, 9.888972e-001, 9.891297e-001, 9.893621e-001, 9.895946e-001, 9.898271e-001, 9.900566e-001, 9.902776e-001,
+9.904986e-001, 9.907195e-001, 9.909405e-001, 9.911615e-001, 9.913824e-001, 9.916034e-001, 9.918244e-001, 9.920453e-001, 9.922663e-001, 9.924872e-001,
+9.927082e-001, 9.929292e-001, 9.931501e-001, 9.933711e-001, 9.935921e-001, 9.938130e-001, 9.940340e-001, 9.942549e-001, 9.944759e-001, 9.946969e-001,
+9.949178e-001, 9.951388e-001, 9.953598e-001, 9.955807e-001, 9.958017e-001, 9.960227e-001, 9.962436e-001, 9.964646e-001, 9.966855e-001, 9.969065e-001,
+9.971275e-001, 9.973484e-001, 9.975694e-001, 9.977904e-001, 9.980113e-001, 9.982323e-001, 9.984533e-001, 9.986742e-001, 9.988952e-001, 9.991161e-001,
+9.993371e-001, 9.995581e-001, 9.997790e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.812047e-003, 9.624095e-003, 1.450092e-002, 1.938324e-002, 2.429684e-002, 2.921496e-002, 3.413533e-002, 3.905613e-002, 4.395442e-002,
+4.884738e-002, 5.369847e-002, 5.853667e-002, 6.332082e-002, 6.808154e-002, 7.278507e-002, 7.745000e-002, 8.206517e-002, 8.662034e-002, 9.114463e-002,
+9.558012e-002, 1.000152e-001, 1.043246e-001, 1.086341e-001, 1.128552e-001, 1.170353e-001, 1.211776e-001, 1.252277e-001, 1.292777e-001, 1.332219e-001,
+1.371431e-001, 1.410301e-001, 1.448253e-001, 1.486205e-001, 1.523380e-001, 1.560111e-001, 1.596842e-001, 1.632500e-001, 1.668058e-001, 1.703502e-001,
+1.737939e-001, 1.772377e-001, 1.806604e-001, 1.839977e-001, 1.873350e-001, 1.906520e-001, 1.938886e-001, 1.971253e-001, 2.003513e-001, 2.034930e-001,
+2.066347e-001, 2.097764e-001, 2.128353e-001, 2.158877e-001, 2.189402e-001, 2.219380e-001, 2.249068e-001, 2.278755e-001, 2.308220e-001, 2.337123e-001,
+2.366027e-001, 2.394930e-001, 2.423229e-001, 2.451399e-001, 2.479569e-001, 2.507550e-001, 2.535035e-001, 2.562520e-001, 2.590004e-001, 2.617082e-001,
+2.643926e-001, 2.670771e-001, 2.697615e-001, 2.723915e-001, 2.750162e-001, 2.776409e-001, 2.802600e-001, 2.828289e-001, 2.853978e-001, 2.879667e-001,
+2.905247e-001, 2.930415e-001, 2.955583e-001, 2.980751e-001, 3.005805e-001, 3.030486e-001, 3.055167e-001, 3.079848e-001, 3.104445e-001, 3.128670e-001,
+3.152896e-001, 3.177121e-001, 3.201322e-001, 3.225121e-001, 3.248919e-001, 3.272718e-001, 3.296516e-001, 3.319972e-001, 3.343370e-001, 3.366767e-001,
+3.390165e-001, 3.413344e-001, 3.436364e-001, 3.459384e-001, 3.482405e-001, 3.505341e-001, 3.528005e-001, 3.550669e-001, 3.573333e-001, 3.595997e-001,
+3.618383e-001, 3.640710e-001, 3.663036e-001, 3.685363e-001, 3.707579e-001, 3.729584e-001, 3.751589e-001, 3.773594e-001, 3.795599e-001, 3.817359e-001,
+3.839056e-001, 3.860754e-001, 3.882452e-001, 3.904093e-001, 3.925495e-001, 3.946897e-001, 3.968299e-001, 3.989701e-001, 4.010954e-001, 4.032069e-001,
+4.053184e-001, 4.074299e-001, 4.095415e-001, 4.116311e-001, 4.137147e-001, 4.157982e-001, 4.178818e-001, 4.199654e-001, 4.220219e-001, 4.240780e-001,
+4.261341e-001, 4.281901e-001, 4.302430e-001, 4.322718e-001, 4.343007e-001, 4.363296e-001, 4.383584e-001, 4.403821e-001, 4.423838e-001, 4.443855e-001,
+4.463872e-001, 4.483889e-001, 4.503852e-001, 4.523596e-001, 4.543340e-001, 4.563083e-001, 4.582827e-001, 4.602535e-001, 4.622002e-001, 4.641468e-001,
+4.660935e-001, 4.680402e-001, 4.699869e-001, 4.719056e-001, 4.738240e-001, 4.757425e-001, 4.776609e-001, 4.795794e-001, 4.814753e-001, 4.833648e-001,
+4.852543e-001, 4.871438e-001, 4.890333e-001, 4.909083e-001, 4.927679e-001, 4.946276e-001, 4.964873e-001, 4.983470e-001, 5.002033e-001, 5.020321e-001,
+5.038609e-001, 5.056897e-001, 5.075186e-001, 5.093474e-001, 5.111556e-001, 5.129525e-001, 5.147493e-001, 5.165461e-001, 5.183429e-001, 5.201371e-001,
+5.219007e-001, 5.236643e-001, 5.254278e-001, 5.271914e-001, 5.289549e-001, 5.307044e-001, 5.324333e-001, 5.341623e-001, 5.358912e-001, 5.376202e-001,
+5.393491e-001, 5.410556e-001, 5.427486e-001, 5.444415e-001, 5.461345e-001, 5.478274e-001, 5.495204e-001, 5.511866e-001, 5.528421e-001, 5.544977e-001,
+5.561532e-001, 5.578088e-001, 5.594643e-001, 5.610936e-001, 5.627104e-001, 5.643271e-001, 5.659438e-001, 5.675606e-001, 5.691773e-001, 5.707743e-001,
+5.723509e-001, 5.739275e-001, 5.755040e-001, 5.770806e-001, 5.786571e-001, 5.802275e-001, 5.817626e-001, 5.832977e-001, 5.848327e-001, 5.863678e-001,
+5.879029e-001, 5.894379e-001, 5.909459e-001, 5.924383e-001, 5.939307e-001, 5.954230e-001, 5.969154e-001, 5.984077e-001, 5.999001e-001, 6.013516e-001,
+6.028002e-001, 6.042487e-001, 6.056973e-001, 6.071458e-001, 6.085944e-001, 6.100416e-001, 6.114454e-001, 6.128492e-001, 6.142530e-001, 6.156568e-001,
+6.170606e-001, 6.184644e-001, 6.198683e-001, 6.212308e-001, 6.225890e-001, 6.239473e-001, 6.253056e-001, 6.266638e-001, 6.280221e-001, 6.293803e-001,
+6.307135e-001, 6.320256e-001, 6.333377e-001, 6.346498e-001, 6.359619e-001, 6.372740e-001, 6.385861e-001, 6.398982e-001, 6.411673e-001, 6.424328e-001,
+6.436983e-001, 6.449638e-001, 6.462294e-001, 6.474949e-001, 6.487604e-001, 6.500249e-001, 6.512436e-001, 6.524624e-001, 6.536811e-001, 6.548998e-001,
+6.561185e-001, 6.573372e-001, 6.585559e-001, 6.597746e-001, 6.609551e-001, 6.621270e-001, 6.632988e-001, 6.644707e-001, 6.656426e-001, 6.668144e-001,
+6.679863e-001, 6.691582e-001, 6.703169e-001, 6.714421e-001, 6.725673e-001, 6.736925e-001, 6.748177e-001, 6.759429e-001, 6.770681e-001, 6.781933e-001,
+6.793185e-001, 6.804254e-001, 6.815043e-001, 6.825832e-001, 6.836621e-001, 6.847409e-001, 6.858198e-001, 6.868987e-001, 6.879776e-001, 6.890565e-001,
+6.901296e-001, 6.911628e-001, 6.921959e-001, 6.932290e-001, 6.942621e-001, 6.952952e-001, 6.963283e-001, 6.973615e-001, 6.983946e-001, 6.994277e-001,
+7.004407e-001, 7.014288e-001, 7.024168e-001, 7.034049e-001, 7.043930e-001, 7.053810e-001, 7.063691e-001, 7.073571e-001, 7.083452e-001, 7.093333e-001,
+7.103069e-001, 7.112508e-001, 7.121947e-001, 7.131385e-001, 7.140824e-001, 7.150263e-001, 7.159701e-001, 7.169140e-001, 7.178578e-001, 7.188017e-001,
+7.197456e-001, 7.206579e-001, 7.215585e-001, 7.224592e-001, 7.233599e-001, 7.242605e-001, 7.251612e-001, 7.260619e-001, 7.269625e-001, 7.278632e-001,
+7.287639e-001, 7.296645e-001, 7.305388e-001, 7.313974e-001, 7.322560e-001, 7.331146e-001, 7.339732e-001, 7.348317e-001, 7.356903e-001, 7.365489e-001,
+7.374075e-001, 7.382661e-001, 7.391247e-001, 7.399833e-001, 7.408018e-001, 7.416195e-001, 7.424373e-001, 7.432550e-001, 7.440727e-001, 7.448904e-001,
+7.457082e-001, 7.465259e-001, 7.473436e-001, 7.481614e-001, 7.489791e-001, 7.497968e-001, 7.505848e-001, 7.513630e-001, 7.521412e-001, 7.529194e-001,
+7.536975e-001, 7.544757e-001, 7.552539e-001, 7.560320e-001, 7.568102e-001, 7.575884e-001, 7.583666e-001, 7.591447e-001, 7.599229e-001, 7.606667e-001,
+7.614067e-001, 7.621466e-001, 7.628866e-001, 7.636266e-001, 7.643666e-001, 7.651066e-001, 7.658466e-001, 7.665865e-001, 7.673265e-001, 7.680665e-001,
+7.688065e-001, 7.695465e-001, 7.702722e-001, 7.709754e-001, 7.716786e-001, 7.723818e-001, 7.730850e-001, 7.737883e-001, 7.744915e-001, 7.751947e-001,
+7.758979e-001, 7.766011e-001, 7.773043e-001, 7.780075e-001, 7.787107e-001, 7.794139e-001, 7.801112e-001, 7.807791e-001, 7.814470e-001, 7.821149e-001,
+7.827827e-001, 7.834506e-001, 7.841185e-001, 7.847864e-001, 7.854542e-001, 7.861221e-001, 7.867900e-001, 7.874579e-001, 7.881257e-001, 7.887936e-001,
+7.894615e-001, 7.901228e-001, 7.907568e-001, 7.913908e-001, 7.920248e-001, 7.926588e-001, 7.932929e-001, 7.939269e-001, 7.945609e-001, 7.951949e-001,
+7.958289e-001, 7.964629e-001, 7.970969e-001, 7.977309e-001, 7.983649e-001, 7.989989e-001, 7.996329e-001, 8.002533e-001, 8.008549e-001, 8.014565e-001,
+8.020581e-001, 8.026597e-001, 8.032614e-001, 8.038630e-001, 8.044646e-001, 8.050662e-001, 8.056678e-001, 8.062694e-001, 8.068710e-001, 8.074726e-001,
+8.080742e-001, 8.086758e-001, 8.092774e-001, 8.098791e-001, 8.104559e-001, 8.110266e-001, 8.115973e-001, 8.121680e-001, 8.127386e-001, 8.133093e-001,
+8.138800e-001, 8.144506e-001, 8.150213e-001, 8.155920e-001, 8.161626e-001, 8.167333e-001, 8.173040e-001, 8.178747e-001, 8.184453e-001, 8.190160e-001,
+8.195867e-001, 8.201492e-001, 8.206904e-001, 8.212316e-001, 8.217727e-001, 8.223139e-001, 8.228551e-001, 8.233962e-001, 8.239374e-001, 8.244786e-001,
+8.250198e-001, 8.255609e-001, 8.261021e-001, 8.266433e-001, 8.271845e-001, 8.277256e-001, 8.282668e-001, 8.288080e-001, 8.293492e-001, 8.298903e-001,
+8.304091e-001, 8.309222e-001, 8.314353e-001, 8.319484e-001, 8.324615e-001, 8.329746e-001, 8.334877e-001, 8.340008e-001, 8.345139e-001, 8.350270e-001,
+8.355401e-001, 8.360532e-001, 8.365663e-001, 8.370794e-001, 8.375925e-001, 8.381056e-001, 8.386187e-001, 8.391318e-001, 8.396449e-001, 8.401497e-001,
+8.406362e-001, 8.411226e-001, 8.416090e-001, 8.420954e-001, 8.425818e-001, 8.430682e-001, 8.435546e-001, 8.440410e-001, 8.445274e-001, 8.450138e-001,
+8.455002e-001, 8.459866e-001, 8.464730e-001, 8.469594e-001, 8.474458e-001, 8.479322e-001, 8.484186e-001, 8.489050e-001, 8.493914e-001, 8.498778e-001,
+8.503453e-001, 8.508063e-001, 8.512674e-001, 8.517284e-001, 8.521895e-001, 8.526506e-001, 8.531116e-001, 8.535727e-001, 8.540337e-001, 8.544948e-001,
+8.549559e-001, 8.554169e-001, 8.558780e-001, 8.563391e-001, 8.568001e-001, 8.572612e-001, 8.577222e-001, 8.581833e-001, 8.586444e-001, 8.591054e-001,
+8.595665e-001, 8.600261e-001, 8.604631e-001, 8.609001e-001, 8.613372e-001, 8.617742e-001, 8.622112e-001, 8.626482e-001, 8.630852e-001, 8.635223e-001,
+8.639593e-001, 8.643963e-001, 8.648333e-001, 8.652703e-001, 8.657074e-001, 8.661444e-001, 8.665814e-001, 8.670184e-001, 8.674554e-001, 8.678925e-001,
+8.683295e-001, 8.687665e-001, 8.692035e-001, 8.696406e-001, 8.700735e-001, 8.704878e-001, 8.709020e-001, 8.713162e-001, 8.717305e-001, 8.721447e-001,
+8.725590e-001, 8.729732e-001, 8.733874e-001, 8.738017e-001, 8.742159e-001, 8.746302e-001, 8.750444e-001, 8.754586e-001, 8.758729e-001, 8.762871e-001,
+8.767014e-001, 8.771156e-001, 8.775298e-001, 8.779441e-001, 8.783583e-001, 8.787726e-001, 8.791868e-001, 8.796010e-001, 8.800145e-001, 8.804072e-001,
+8.807998e-001, 8.811925e-001, 8.815852e-001, 8.819778e-001, 8.823705e-001, 8.827632e-001, 8.831558e-001, 8.835485e-001, 8.839412e-001, 8.843338e-001,
+8.847265e-001, 8.851192e-001, 8.855119e-001, 8.859045e-001, 8.862972e-001, 8.866899e-001, 8.870825e-001, 8.874752e-001, 8.878679e-001, 8.882605e-001,
+8.886532e-001, 8.890459e-001, 8.894385e-001, 8.898312e-001, 8.902122e-001, 8.905845e-001, 8.909568e-001, 8.913290e-001, 8.917013e-001, 8.920735e-001,
+8.924458e-001, 8.928181e-001, 8.931903e-001, 8.935626e-001, 8.939348e-001, 8.943071e-001, 8.946794e-001, 8.950516e-001, 8.954239e-001, 8.957961e-001,
+8.961684e-001, 8.965406e-001, 8.969129e-001, 8.972852e-001, 8.976574e-001, 8.980297e-001, 8.984019e-001, 8.987742e-001, 8.991465e-001, 8.995187e-001,
+8.998910e-001, 9.002496e-001, 9.006025e-001, 9.009555e-001, 9.013085e-001, 9.016614e-001, 9.020144e-001, 9.023673e-001, 9.027203e-001, 9.030732e-001,
+9.034262e-001, 9.037792e-001, 9.041321e-001, 9.044851e-001, 9.048380e-001, 9.051910e-001, 9.055439e-001, 9.058969e-001, 9.062499e-001, 9.066028e-001,
+9.069558e-001, 9.073087e-001, 9.076617e-001, 9.080146e-001, 9.083676e-001, 9.087206e-001, 9.090735e-001, 9.094265e-001, 9.097794e-001, 9.101255e-001,
+9.104603e-001, 9.107950e-001, 9.111297e-001, 9.114644e-001, 9.117991e-001, 9.121338e-001, 9.124685e-001, 9.128033e-001, 9.131380e-001, 9.134727e-001,
+9.138074e-001, 9.141421e-001, 9.144768e-001, 9.148115e-001, 9.151463e-001, 9.154810e-001, 9.158157e-001, 9.161504e-001, 9.164851e-001, 9.168198e-001,
+9.171545e-001, 9.174893e-001, 9.178240e-001, 9.181587e-001, 9.184934e-001, 9.188281e-001, 9.191628e-001, 9.194975e-001, 9.198323e-001, 9.201584e-001,
+9.204758e-001, 9.207933e-001, 9.211108e-001, 9.214283e-001, 9.217458e-001, 9.220632e-001, 9.223807e-001, 9.226982e-001, 9.230157e-001, 9.233332e-001,
+9.236506e-001, 9.239681e-001, 9.242856e-001, 9.246031e-001, 9.249205e-001, 9.252380e-001, 9.255555e-001, 9.258730e-001, 9.261905e-001, 9.265079e-001,
+9.268254e-001, 9.271429e-001, 9.274604e-001, 9.277778e-001, 9.280953e-001, 9.284128e-001, 9.287303e-001, 9.290478e-001, 9.293652e-001, 9.296827e-001,
+9.300002e-001, 9.303014e-001, 9.306026e-001, 9.309038e-001, 9.312050e-001, 9.315062e-001, 9.318074e-001, 9.321086e-001, 9.324098e-001, 9.327110e-001,
+9.330122e-001, 9.333134e-001, 9.336146e-001, 9.339158e-001, 9.342170e-001, 9.345182e-001, 9.348194e-001, 9.351206e-001, 9.354218e-001, 9.357230e-001,
+9.360242e-001, 9.363254e-001, 9.366265e-001, 9.369277e-001, 9.372289e-001, 9.375301e-001, 9.378313e-001, 9.381325e-001, 9.384337e-001, 9.387349e-001,
+9.390361e-001, 9.393373e-001, 9.396385e-001, 9.399397e-001, 9.402286e-001, 9.405145e-001, 9.408003e-001, 9.410861e-001, 9.413719e-001, 9.416578e-001,
+9.419436e-001, 9.422294e-001, 9.425153e-001, 9.428011e-001, 9.430869e-001, 9.433727e-001, 9.436586e-001, 9.439444e-001, 9.442302e-001, 9.445160e-001,
+9.448019e-001, 9.450877e-001, 9.453735e-001, 9.456594e-001, 9.459452e-001, 9.462310e-001, 9.465168e-001, 9.468027e-001, 9.470885e-001, 9.473743e-001,
+9.476601e-001, 9.479460e-001, 9.482318e-001, 9.485176e-001, 9.488034e-001, 9.490893e-001, 9.493751e-001, 9.496609e-001, 9.499468e-001, 9.502208e-001,
+9.504921e-001, 9.507634e-001, 9.510347e-001, 9.513060e-001, 9.515774e-001, 9.518487e-001, 9.521200e-001, 9.523913e-001, 9.526626e-001, 9.529339e-001,
+9.532052e-001, 9.534766e-001, 9.537479e-001, 9.540192e-001, 9.542905e-001, 9.545618e-001, 9.548331e-001, 9.551044e-001, 9.553758e-001, 9.556471e-001,
+9.559184e-001, 9.561897e-001, 9.564610e-001, 9.567323e-001, 9.570037e-001, 9.572750e-001, 9.575463e-001, 9.578176e-001, 9.580889e-001, 9.583602e-001,
+9.586315e-001, 9.589029e-001, 9.591742e-001, 9.594455e-001, 9.597168e-001, 9.599881e-001, 9.602463e-001, 9.605040e-001, 9.607616e-001, 9.610192e-001,
+9.612768e-001, 9.615344e-001, 9.617920e-001, 9.620497e-001, 9.623073e-001, 9.625649e-001, 9.628225e-001, 9.630801e-001, 9.633377e-001, 9.635954e-001,
+9.638530e-001, 9.641106e-001, 9.643682e-001, 9.646258e-001, 9.648834e-001, 9.651411e-001, 9.653987e-001, 9.656563e-001, 9.659139e-001, 9.661715e-001,
+9.664291e-001, 9.666868e-001, 9.669444e-001, 9.672020e-001, 9.674596e-001, 9.677172e-001, 9.679748e-001, 9.682325e-001, 9.684901e-001, 9.687477e-001,
+9.690053e-001, 9.692629e-001, 9.695205e-001, 9.697782e-001, 9.700340e-001, 9.702787e-001, 9.705233e-001, 9.707680e-001, 9.710127e-001, 9.712574e-001,
+9.715021e-001, 9.717468e-001, 9.719915e-001, 9.722362e-001, 9.724808e-001, 9.727255e-001, 9.729702e-001, 9.732149e-001, 9.734596e-001, 9.737043e-001,
+9.739490e-001, 9.741936e-001, 9.744383e-001, 9.746830e-001, 9.749277e-001, 9.751724e-001, 9.754171e-001, 9.756618e-001, 9.759065e-001, 9.761511e-001,
+9.763958e-001, 9.766405e-001, 9.768852e-001, 9.771299e-001, 9.773746e-001, 9.776193e-001, 9.778640e-001, 9.781086e-001, 9.783533e-001, 9.785980e-001,
+9.788427e-001, 9.790874e-001, 9.793321e-001, 9.795768e-001, 9.798214e-001, 9.800628e-001, 9.802953e-001, 9.805278e-001, 9.807603e-001, 9.809928e-001,
+9.812252e-001, 9.814577e-001, 9.816902e-001, 9.819227e-001, 9.821552e-001, 9.823877e-001, 9.826201e-001, 9.828526e-001, 9.830851e-001, 9.833176e-001,
+9.835501e-001, 9.837826e-001, 9.840150e-001, 9.842475e-001, 9.844800e-001, 9.847125e-001, 9.849450e-001, 9.851775e-001, 9.854099e-001, 9.856424e-001,
+9.858749e-001, 9.861074e-001, 9.863399e-001, 9.865724e-001, 9.868048e-001, 9.870373e-001, 9.872698e-001, 9.875023e-001, 9.877348e-001, 9.879673e-001,
+9.881997e-001, 9.884322e-001, 9.886647e-001, 9.888972e-001, 9.891297e-001, 9.893621e-001, 9.895946e-001, 9.898271e-001, 9.900566e-001, 9.902776e-001,
+9.904986e-001, 9.907195e-001, 9.909405e-001, 9.911615e-001, 9.913824e-001, 9.916034e-001, 9.918244e-001, 9.920453e-001, 9.922663e-001, 9.924872e-001,
+9.927082e-001, 9.929292e-001, 9.931501e-001, 9.933711e-001, 9.935921e-001, 9.938130e-001, 9.940340e-001, 9.942549e-001, 9.944759e-001, 9.946969e-001,
+9.949178e-001, 9.951388e-001, 9.953598e-001, 9.955807e-001, 9.958017e-001, 9.960227e-001, 9.962436e-001, 9.964646e-001, 9.966855e-001, 9.969065e-001,
+9.971275e-001, 9.973484e-001, 9.975694e-001, 9.977904e-001, 9.980113e-001, 9.982323e-001, 9.984533e-001, 9.986742e-001, 9.988952e-001, 9.991161e-001,
+9.993371e-001, 9.995581e-001, 9.997790e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.812047e-003, 9.624095e-003, 1.450092e-002, 1.938324e-002, 2.429684e-002, 2.921496e-002, 3.413533e-002, 3.905613e-002, 4.395442e-002,
+4.884738e-002, 5.369847e-002, 5.853667e-002, 6.332082e-002, 6.808154e-002, 7.278507e-002, 7.745000e-002, 8.206517e-002, 8.662034e-002, 9.114463e-002,
+9.558012e-002, 1.000152e-001, 1.043246e-001, 1.086341e-001, 1.128552e-001, 1.170353e-001, 1.211776e-001, 1.252277e-001, 1.292777e-001, 1.332219e-001,
+1.371431e-001, 1.410301e-001, 1.448253e-001, 1.486205e-001, 1.523380e-001, 1.560111e-001, 1.596842e-001, 1.632500e-001, 1.668058e-001, 1.703502e-001,
+1.737939e-001, 1.772377e-001, 1.806604e-001, 1.839977e-001, 1.873350e-001, 1.906520e-001, 1.938886e-001, 1.971253e-001, 2.003513e-001, 2.034930e-001,
+2.066347e-001, 2.097764e-001, 2.128353e-001, 2.158877e-001, 2.189402e-001, 2.219380e-001, 2.249068e-001, 2.278755e-001, 2.308220e-001, 2.337123e-001,
+2.366027e-001, 2.394930e-001, 2.423229e-001, 2.451399e-001, 2.479569e-001, 2.507550e-001, 2.535035e-001, 2.562520e-001, 2.590004e-001, 2.617082e-001,
+2.643926e-001, 2.670771e-001, 2.697615e-001, 2.723915e-001, 2.750162e-001, 2.776409e-001, 2.802600e-001, 2.828289e-001, 2.853978e-001, 2.879667e-001,
+2.905247e-001, 2.930415e-001, 2.955583e-001, 2.980751e-001, 3.005805e-001, 3.030486e-001, 3.055167e-001, 3.079848e-001, 3.104445e-001, 3.128670e-001,
+3.152896e-001, 3.177121e-001, 3.201322e-001, 3.225121e-001, 3.248919e-001, 3.272718e-001, 3.296516e-001, 3.319972e-001, 3.343370e-001, 3.366767e-001,
+3.390165e-001, 3.413344e-001, 3.436364e-001, 3.459384e-001, 3.482405e-001, 3.505341e-001, 3.528005e-001, 3.550669e-001, 3.573333e-001, 3.595997e-001,
+3.618383e-001, 3.640710e-001, 3.663036e-001, 3.685363e-001, 3.707579e-001, 3.729584e-001, 3.751589e-001, 3.773594e-001, 3.795599e-001, 3.817359e-001,
+3.839056e-001, 3.860754e-001, 3.882452e-001, 3.904093e-001, 3.925495e-001, 3.946897e-001, 3.968299e-001, 3.989701e-001, 4.010954e-001, 4.032069e-001,
+4.053184e-001, 4.074299e-001, 4.095415e-001, 4.116311e-001, 4.137147e-001, 4.157982e-001, 4.178818e-001, 4.199654e-001, 4.220219e-001, 4.240780e-001,
+4.261341e-001, 4.281901e-001, 4.302430e-001, 4.322718e-001, 4.343007e-001, 4.363296e-001, 4.383584e-001, 4.403821e-001, 4.423838e-001, 4.443855e-001,
+4.463872e-001, 4.483889e-001, 4.503852e-001, 4.523596e-001, 4.543340e-001, 4.563083e-001, 4.582827e-001, 4.602535e-001, 4.622002e-001, 4.641468e-001,
+4.660935e-001, 4.680402e-001, 4.699869e-001, 4.719056e-001, 4.738240e-001, 4.757425e-001, 4.776609e-001, 4.795794e-001, 4.814753e-001, 4.833648e-001,
+4.852543e-001, 4.871438e-001, 4.890333e-001, 4.909083e-001, 4.927679e-001, 4.946276e-001, 4.964873e-001, 4.983470e-001, 5.002033e-001, 5.020321e-001,
+5.038609e-001, 5.056897e-001, 5.075186e-001, 5.093474e-001, 5.111556e-001, 5.129525e-001, 5.147493e-001, 5.165461e-001, 5.183429e-001, 5.201371e-001,
+5.219007e-001, 5.236643e-001, 5.254278e-001, 5.271914e-001, 5.289549e-001, 5.307044e-001, 5.324333e-001, 5.341623e-001, 5.358912e-001, 5.376202e-001,
+5.393491e-001, 5.410556e-001, 5.427486e-001, 5.444415e-001, 5.461345e-001, 5.478274e-001, 5.495204e-001, 5.511866e-001, 5.528421e-001, 5.544977e-001,
+5.561532e-001, 5.578088e-001, 5.594643e-001, 5.610936e-001, 5.627104e-001, 5.643271e-001, 5.659438e-001, 5.675606e-001, 5.691773e-001, 5.707743e-001,
+5.723509e-001, 5.739275e-001, 5.755040e-001, 5.770806e-001, 5.786571e-001, 5.802275e-001, 5.817626e-001, 5.832977e-001, 5.848327e-001, 5.863678e-001,
+5.879029e-001, 5.894379e-001, 5.909459e-001, 5.924383e-001, 5.939307e-001, 5.954230e-001, 5.969154e-001, 5.984077e-001, 5.999001e-001, 6.013516e-001,
+6.028002e-001, 6.042487e-001, 6.056973e-001, 6.071458e-001, 6.085944e-001, 6.100416e-001, 6.114454e-001, 6.128492e-001, 6.142530e-001, 6.156568e-001,
+6.170606e-001, 6.184644e-001, 6.198683e-001, 6.212308e-001, 6.225890e-001, 6.239473e-001, 6.253056e-001, 6.266638e-001, 6.280221e-001, 6.293803e-001,
+6.307135e-001, 6.320256e-001, 6.333377e-001, 6.346498e-001, 6.359619e-001, 6.372740e-001, 6.385861e-001, 6.398982e-001, 6.411673e-001, 6.424328e-001,
+6.436983e-001, 6.449638e-001, 6.462294e-001, 6.474949e-001, 6.487604e-001, 6.500249e-001, 6.512436e-001, 6.524624e-001, 6.536811e-001, 6.548998e-001,
+6.561185e-001, 6.573372e-001, 6.585559e-001, 6.597746e-001, 6.609551e-001, 6.621270e-001, 6.632988e-001, 6.644707e-001, 6.656426e-001, 6.668144e-001,
+6.679863e-001, 6.691582e-001, 6.703169e-001, 6.714421e-001, 6.725673e-001, 6.736925e-001, 6.748177e-001, 6.759429e-001, 6.770681e-001, 6.781933e-001,
+6.793185e-001, 6.804254e-001, 6.815043e-001, 6.825832e-001, 6.836621e-001, 6.847409e-001, 6.858198e-001, 6.868987e-001, 6.879776e-001, 6.890565e-001,
+6.901296e-001, 6.911628e-001, 6.921959e-001, 6.932290e-001, 6.942621e-001, 6.952952e-001, 6.963283e-001, 6.973615e-001, 6.983946e-001, 6.994277e-001,
+7.004407e-001, 7.014288e-001, 7.024168e-001, 7.034049e-001, 7.043930e-001, 7.053810e-001, 7.063691e-001, 7.073571e-001, 7.083452e-001, 7.093333e-001,
+7.103069e-001, 7.112508e-001, 7.121947e-001, 7.131385e-001, 7.140824e-001, 7.150263e-001, 7.159701e-001, 7.169140e-001, 7.178578e-001, 7.188017e-001,
+7.197456e-001, 7.206579e-001, 7.215585e-001, 7.224592e-001, 7.233599e-001, 7.242605e-001, 7.251612e-001, 7.260619e-001, 7.269625e-001, 7.278632e-001,
+7.287639e-001, 7.296645e-001, 7.305388e-001, 7.313974e-001, 7.322560e-001, 7.331146e-001, 7.339732e-001, 7.348317e-001, 7.356903e-001, 7.365489e-001,
+7.374075e-001, 7.382661e-001, 7.391247e-001, 7.399833e-001, 7.408018e-001, 7.416195e-001, 7.424373e-001, 7.432550e-001, 7.440727e-001, 7.448904e-001,
+7.457082e-001, 7.465259e-001, 7.473436e-001, 7.481614e-001, 7.489791e-001, 7.497968e-001, 7.505848e-001, 7.513630e-001, 7.521412e-001, 7.529194e-001,
+7.536975e-001, 7.544757e-001, 7.552539e-001, 7.560320e-001, 7.568102e-001, 7.575884e-001, 7.583666e-001, 7.591447e-001, 7.599229e-001, 7.606667e-001,
+7.614067e-001, 7.621466e-001, 7.628866e-001, 7.636266e-001, 7.643666e-001, 7.651066e-001, 7.658466e-001, 7.665865e-001, 7.673265e-001, 7.680665e-001,
+7.688065e-001, 7.695465e-001, 7.702722e-001, 7.709754e-001, 7.716786e-001, 7.723818e-001, 7.730850e-001, 7.737883e-001, 7.744915e-001, 7.751947e-001,
+7.758979e-001, 7.766011e-001, 7.773043e-001, 7.780075e-001, 7.787107e-001, 7.794139e-001, 7.801112e-001, 7.807791e-001, 7.814470e-001, 7.821149e-001,
+7.827827e-001, 7.834506e-001, 7.841185e-001, 7.847864e-001, 7.854542e-001, 7.861221e-001, 7.867900e-001, 7.874579e-001, 7.881257e-001, 7.887936e-001,
+7.894615e-001, 7.901228e-001, 7.907568e-001, 7.913908e-001, 7.920248e-001, 7.926588e-001, 7.932929e-001, 7.939269e-001, 7.945609e-001, 7.951949e-001,
+7.958289e-001, 7.964629e-001, 7.970969e-001, 7.977309e-001, 7.983649e-001, 7.989989e-001, 7.996329e-001, 8.002533e-001, 8.008549e-001, 8.014565e-001,
+8.020581e-001, 8.026597e-001, 8.032614e-001, 8.038630e-001, 8.044646e-001, 8.050662e-001, 8.056678e-001, 8.062694e-001, 8.068710e-001, 8.074726e-001,
+8.080742e-001, 8.086758e-001, 8.092774e-001, 8.098791e-001, 8.104559e-001, 8.110266e-001, 8.115973e-001, 8.121680e-001, 8.127386e-001, 8.133093e-001,
+8.138800e-001, 8.144506e-001, 8.150213e-001, 8.155920e-001, 8.161626e-001, 8.167333e-001, 8.173040e-001, 8.178747e-001, 8.184453e-001, 8.190160e-001,
+8.195867e-001, 8.201492e-001, 8.206904e-001, 8.212316e-001, 8.217727e-001, 8.223139e-001, 8.228551e-001, 8.233962e-001, 8.239374e-001, 8.244786e-001,
+8.250198e-001, 8.255609e-001, 8.261021e-001, 8.266433e-001, 8.271845e-001, 8.277256e-001, 8.282668e-001, 8.288080e-001, 8.293492e-001, 8.298903e-001,
+8.304091e-001, 8.309222e-001, 8.314353e-001, 8.319484e-001, 8.324615e-001, 8.329746e-001, 8.334877e-001, 8.340008e-001, 8.345139e-001, 8.350270e-001,
+8.355401e-001, 8.360532e-001, 8.365663e-001, 8.370794e-001, 8.375925e-001, 8.381056e-001, 8.386187e-001, 8.391318e-001, 8.396449e-001, 8.401497e-001,
+8.406362e-001, 8.411226e-001, 8.416090e-001, 8.420954e-001, 8.425818e-001, 8.430682e-001, 8.435546e-001, 8.440410e-001, 8.445274e-001, 8.450138e-001,
+8.455002e-001, 8.459866e-001, 8.464730e-001, 8.469594e-001, 8.474458e-001, 8.479322e-001, 8.484186e-001, 8.489050e-001, 8.493914e-001, 8.498778e-001,
+8.503453e-001, 8.508063e-001, 8.512674e-001, 8.517284e-001, 8.521895e-001, 8.526506e-001, 8.531116e-001, 8.535727e-001, 8.540337e-001, 8.544948e-001,
+8.549559e-001, 8.554169e-001, 8.558780e-001, 8.563391e-001, 8.568001e-001, 8.572612e-001, 8.577222e-001, 8.581833e-001, 8.586444e-001, 8.591054e-001,
+8.595665e-001, 8.600261e-001, 8.604631e-001, 8.609001e-001, 8.613372e-001, 8.617742e-001, 8.622112e-001, 8.626482e-001, 8.630852e-001, 8.635223e-001,
+8.639593e-001, 8.643963e-001, 8.648333e-001, 8.652703e-001, 8.657074e-001, 8.661444e-001, 8.665814e-001, 8.670184e-001, 8.674554e-001, 8.678925e-001,
+8.683295e-001, 8.687665e-001, 8.692035e-001, 8.696406e-001, 8.700735e-001, 8.704878e-001, 8.709020e-001, 8.713162e-001, 8.717305e-001, 8.721447e-001,
+8.725590e-001, 8.729732e-001, 8.733874e-001, 8.738017e-001, 8.742159e-001, 8.746302e-001, 8.750444e-001, 8.754586e-001, 8.758729e-001, 8.762871e-001,
+8.767014e-001, 8.771156e-001, 8.775298e-001, 8.779441e-001, 8.783583e-001, 8.787726e-001, 8.791868e-001, 8.796010e-001, 8.800145e-001, 8.804072e-001,
+8.807998e-001, 8.811925e-001, 8.815852e-001, 8.819778e-001, 8.823705e-001, 8.827632e-001, 8.831558e-001, 8.835485e-001, 8.839412e-001, 8.843338e-001,
+8.847265e-001, 8.851192e-001, 8.855119e-001, 8.859045e-001, 8.862972e-001, 8.866899e-001, 8.870825e-001, 8.874752e-001, 8.878679e-001, 8.882605e-001,
+8.886532e-001, 8.890459e-001, 8.894385e-001, 8.898312e-001, 8.902122e-001, 8.905845e-001, 8.909568e-001, 8.913290e-001, 8.917013e-001, 8.920735e-001,
+8.924458e-001, 8.928181e-001, 8.931903e-001, 8.935626e-001, 8.939348e-001, 8.943071e-001, 8.946794e-001, 8.950516e-001, 8.954239e-001, 8.957961e-001,
+8.961684e-001, 8.965406e-001, 8.969129e-001, 8.972852e-001, 8.976574e-001, 8.980297e-001, 8.984019e-001, 8.987742e-001, 8.991465e-001, 8.995187e-001,
+8.998910e-001, 9.002496e-001, 9.006025e-001, 9.009555e-001, 9.013085e-001, 9.016614e-001, 9.020144e-001, 9.023673e-001, 9.027203e-001, 9.030732e-001,
+9.034262e-001, 9.037792e-001, 9.041321e-001, 9.044851e-001, 9.048380e-001, 9.051910e-001, 9.055439e-001, 9.058969e-001, 9.062499e-001, 9.066028e-001,
+9.069558e-001, 9.073087e-001, 9.076617e-001, 9.080146e-001, 9.083676e-001, 9.087206e-001, 9.090735e-001, 9.094265e-001, 9.097794e-001, 9.101255e-001,
+9.104603e-001, 9.107950e-001, 9.111297e-001, 9.114644e-001, 9.117991e-001, 9.121338e-001, 9.124685e-001, 9.128033e-001, 9.131380e-001, 9.134727e-001,
+9.138074e-001, 9.141421e-001, 9.144768e-001, 9.148115e-001, 9.151463e-001, 9.154810e-001, 9.158157e-001, 9.161504e-001, 9.164851e-001, 9.168198e-001,
+9.171545e-001, 9.174893e-001, 9.178240e-001, 9.181587e-001, 9.184934e-001, 9.188281e-001, 9.191628e-001, 9.194975e-001, 9.198323e-001, 9.201584e-001,
+9.204758e-001, 9.207933e-001, 9.211108e-001, 9.214283e-001, 9.217458e-001, 9.220632e-001, 9.223807e-001, 9.226982e-001, 9.230157e-001, 9.233332e-001,
+9.236506e-001, 9.239681e-001, 9.242856e-001, 9.246031e-001, 9.249205e-001, 9.252380e-001, 9.255555e-001, 9.258730e-001, 9.261905e-001, 9.265079e-001,
+9.268254e-001, 9.271429e-001, 9.274604e-001, 9.277778e-001, 9.280953e-001, 9.284128e-001, 9.287303e-001, 9.290478e-001, 9.293652e-001, 9.296827e-001,
+9.300002e-001, 9.303014e-001, 9.306026e-001, 9.309038e-001, 9.312050e-001, 9.315062e-001, 9.318074e-001, 9.321086e-001, 9.324098e-001, 9.327110e-001,
+9.330122e-001, 9.333134e-001, 9.336146e-001, 9.339158e-001, 9.342170e-001, 9.345182e-001, 9.348194e-001, 9.351206e-001, 9.354218e-001, 9.357230e-001,
+9.360242e-001, 9.363254e-001, 9.366265e-001, 9.369277e-001, 9.372289e-001, 9.375301e-001, 9.378313e-001, 9.381325e-001, 9.384337e-001, 9.387349e-001,
+9.390361e-001, 9.393373e-001, 9.396385e-001, 9.399397e-001, 9.402286e-001, 9.405145e-001, 9.408003e-001, 9.410861e-001, 9.413719e-001, 9.416578e-001,
+9.419436e-001, 9.422294e-001, 9.425153e-001, 9.428011e-001, 9.430869e-001, 9.433727e-001, 9.436586e-001, 9.439444e-001, 9.442302e-001, 9.445160e-001,
+9.448019e-001, 9.450877e-001, 9.453735e-001, 9.456594e-001, 9.459452e-001, 9.462310e-001, 9.465168e-001, 9.468027e-001, 9.470885e-001, 9.473743e-001,
+9.476601e-001, 9.479460e-001, 9.482318e-001, 9.485176e-001, 9.488034e-001, 9.490893e-001, 9.493751e-001, 9.496609e-001, 9.499468e-001, 9.502208e-001,
+9.504921e-001, 9.507634e-001, 9.510347e-001, 9.513060e-001, 9.515774e-001, 9.518487e-001, 9.521200e-001, 9.523913e-001, 9.526626e-001, 9.529339e-001,
+9.532052e-001, 9.534766e-001, 9.537479e-001, 9.540192e-001, 9.542905e-001, 9.545618e-001, 9.548331e-001, 9.551044e-001, 9.553758e-001, 9.556471e-001,
+9.559184e-001, 9.561897e-001, 9.564610e-001, 9.567323e-001, 9.570037e-001, 9.572750e-001, 9.575463e-001, 9.578176e-001, 9.580889e-001, 9.583602e-001,
+9.586315e-001, 9.589029e-001, 9.591742e-001, 9.594455e-001, 9.597168e-001, 9.599881e-001, 9.602463e-001, 9.605040e-001, 9.607616e-001, 9.610192e-001,
+9.612768e-001, 9.615344e-001, 9.617920e-001, 9.620497e-001, 9.623073e-001, 9.625649e-001, 9.628225e-001, 9.630801e-001, 9.633377e-001, 9.635954e-001,
+9.638530e-001, 9.641106e-001, 9.643682e-001, 9.646258e-001, 9.648834e-001, 9.651411e-001, 9.653987e-001, 9.656563e-001, 9.659139e-001, 9.661715e-001,
+9.664291e-001, 9.666868e-001, 9.669444e-001, 9.672020e-001, 9.674596e-001, 9.677172e-001, 9.679748e-001, 9.682325e-001, 9.684901e-001, 9.687477e-001,
+9.690053e-001, 9.692629e-001, 9.695205e-001, 9.697782e-001, 9.700340e-001, 9.702787e-001, 9.705233e-001, 9.707680e-001, 9.710127e-001, 9.712574e-001,
+9.715021e-001, 9.717468e-001, 9.719915e-001, 9.722362e-001, 9.724808e-001, 9.727255e-001, 9.729702e-001, 9.732149e-001, 9.734596e-001, 9.737043e-001,
+9.739490e-001, 9.741936e-001, 9.744383e-001, 9.746830e-001, 9.749277e-001, 9.751724e-001, 9.754171e-001, 9.756618e-001, 9.759065e-001, 9.761511e-001,
+9.763958e-001, 9.766405e-001, 9.768852e-001, 9.771299e-001, 9.773746e-001, 9.776193e-001, 9.778640e-001, 9.781086e-001, 9.783533e-001, 9.785980e-001,
+9.788427e-001, 9.790874e-001, 9.793321e-001, 9.795768e-001, 9.798214e-001, 9.800628e-001, 9.802953e-001, 9.805278e-001, 9.807603e-001, 9.809928e-001,
+9.812252e-001, 9.814577e-001, 9.816902e-001, 9.819227e-001, 9.821552e-001, 9.823877e-001, 9.826201e-001, 9.828526e-001, 9.830851e-001, 9.833176e-001,
+9.835501e-001, 9.837826e-001, 9.840150e-001, 9.842475e-001, 9.844800e-001, 9.847125e-001, 9.849450e-001, 9.851775e-001, 9.854099e-001, 9.856424e-001,
+9.858749e-001, 9.861074e-001, 9.863399e-001, 9.865724e-001, 9.868048e-001, 9.870373e-001, 9.872698e-001, 9.875023e-001, 9.877348e-001, 9.879673e-001,
+9.881997e-001, 9.884322e-001, 9.886647e-001, 9.888972e-001, 9.891297e-001, 9.893621e-001, 9.895946e-001, 9.898271e-001, 9.900566e-001, 9.902776e-001,
+9.904986e-001, 9.907195e-001, 9.909405e-001, 9.911615e-001, 9.913824e-001, 9.916034e-001, 9.918244e-001, 9.920453e-001, 9.922663e-001, 9.924872e-001,
+9.927082e-001, 9.929292e-001, 9.931501e-001, 9.933711e-001, 9.935921e-001, 9.938130e-001, 9.940340e-001, 9.942549e-001, 9.944759e-001, 9.946969e-001,
+9.949178e-001, 9.951388e-001, 9.953598e-001, 9.955807e-001, 9.958017e-001, 9.960227e-001, 9.962436e-001, 9.964646e-001, 9.966855e-001, 9.969065e-001,
+9.971275e-001, 9.973484e-001, 9.975694e-001, 9.977904e-001, 9.980113e-001, 9.982323e-001, 9.984533e-001, 9.986742e-001, 9.988952e-001, 9.991161e-001,
+9.993371e-001, 9.995581e-001, 9.997790e-001, 1.000000e+000)),
+("Kodak", "DSCS 3156", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.291351e-003, 2.582703e-003, 3.874054e-003, 5.165406e-003, 6.456757e-003, 7.748109e-003, 9.039460e-003, 1.036904e-002, 1.180963e-002,
+1.325022e-002, 1.469082e-002, 1.613141e-002, 1.757200e-002, 1.901259e-002, 2.050632e-002, 2.211582e-002, 2.372533e-002, 2.533484e-002, 2.694435e-002,
+2.855386e-002, 3.018273e-002, 3.198307e-002, 3.378342e-002, 3.558376e-002, 3.738410e-002, 3.918444e-002, 4.110233e-002, 4.311757e-002, 4.513281e-002,
+4.714805e-002, 4.916329e-002, 5.131935e-002, 5.357539e-002, 5.583144e-002, 5.808748e-002, 6.038430e-002, 6.290823e-002, 6.543215e-002, 6.795607e-002,
+7.053609e-002, 7.335504e-002, 7.617399e-002, 7.899293e-002, 8.201790e-002, 8.515737e-002, 8.829685e-002, 9.159278e-002, 9.507425e-002, 9.855572e-002,
+1.022457e-001, 1.060836e-001, 1.099215e-001, 1.141122e-001, 1.183103e-001, 1.227175e-001, 1.272657e-001, 1.319429e-001, 1.368145e-001, 1.417827e-001,
+1.469336e-001, 1.521733e-001, 1.575436e-001, 1.629939e-001, 1.685119e-001, 1.740811e-001, 1.796694e-001, 1.852523e-001, 1.908237e-001, 1.963317e-001,
+2.017958e-001, 2.071722e-001, 2.124657e-001, 2.176671e-001, 2.227557e-001, 2.277524e-001, 2.326271e-001, 2.374019e-001, 2.420724e-001, 2.466182e-001,
+2.511057e-001, 2.554234e-001, 2.597410e-001, 2.638502e-001, 2.679460e-001, 2.719363e-001, 2.758204e-001, 2.797045e-001, 2.834044e-001, 2.870891e-001,
+2.907347e-001, 2.942334e-001, 2.977321e-001, 3.011703e-001, 3.044968e-001, 3.078233e-001, 3.110950e-001, 3.142629e-001, 3.174308e-001, 3.205712e-001,
+3.235936e-001, 3.266160e-001, 3.296383e-001, 3.325434e-001, 3.354325e-001, 3.383216e-001, 3.411597e-001, 3.439270e-001, 3.466943e-001, 3.494617e-001,
+3.521394e-001, 3.547956e-001, 3.574517e-001, 3.601037e-001, 3.626584e-001, 3.652130e-001, 3.677676e-001, 3.703106e-001, 3.727726e-001, 3.752346e-001,
+3.776965e-001, 3.801531e-001, 3.825305e-001, 3.849078e-001, 3.872852e-001, 3.896626e-001, 3.919736e-001, 3.942736e-001, 3.965737e-001, 3.988737e-001,
+4.011376e-001, 4.033669e-001, 4.055961e-001, 4.078254e-001, 4.100531e-001, 4.122174e-001, 4.143818e-001, 4.165462e-001, 4.187106e-001, 4.208510e-001,
+4.229558e-001, 4.250606e-001, 4.271655e-001, 4.292703e-001, 4.313394e-001, 4.333894e-001, 4.354394e-001, 4.374894e-001, 4.395395e-001, 4.415503e-001,
+4.435497e-001, 4.455492e-001, 4.475486e-001, 4.495481e-001, 4.515112e-001, 4.534638e-001, 4.554164e-001, 4.573690e-001, 4.593216e-001, 4.612458e-001,
+4.631549e-001, 4.650639e-001, 4.669730e-001, 4.688820e-001, 4.707742e-001, 4.726425e-001, 4.745109e-001, 4.763793e-001, 4.782476e-001, 4.801136e-001,
+4.819438e-001, 4.837739e-001, 4.856041e-001, 4.874342e-001, 4.892644e-001, 4.910729e-001, 4.928669e-001, 4.946610e-001, 4.964550e-001, 4.982490e-001,
+5.000422e-001, 5.018019e-001, 5.035615e-001, 5.053212e-001, 5.070808e-001, 5.088404e-001, 5.105888e-001, 5.123155e-001, 5.140421e-001, 5.157688e-001,
+5.174954e-001, 5.192221e-001, 5.209312e-001, 5.226259e-001, 5.243206e-001, 5.260154e-001, 5.277101e-001, 5.294048e-001, 5.310793e-001, 5.327429e-001,
+5.344065e-001, 5.360700e-001, 5.377336e-001, 5.393971e-001, 5.410411e-001, 5.426740e-001, 5.443069e-001, 5.459397e-001, 5.475726e-001, 5.492054e-001,
+5.508226e-001, 5.524250e-001, 5.540273e-001, 5.556297e-001, 5.572320e-001, 5.588344e-001, 5.604284e-001, 5.620002e-001, 5.635719e-001, 5.651437e-001,
+5.667154e-001, 5.682872e-001, 5.698590e-001, 5.714026e-001, 5.729435e-001, 5.744843e-001, 5.760252e-001, 5.775660e-001, 5.791069e-001, 5.806345e-001,
+5.821440e-001, 5.836534e-001, 5.851628e-001, 5.866722e-001, 5.881817e-001, 5.896911e-001, 5.911749e-001, 5.926522e-001, 5.941295e-001, 5.956067e-001,
+5.970840e-001, 5.985613e-001, 6.000377e-001, 6.014819e-001, 6.029261e-001, 6.043703e-001, 6.058146e-001, 6.072588e-001, 6.087030e-001, 6.101438e-001,
+6.115540e-001, 6.129641e-001, 6.143743e-001, 6.157845e-001, 6.171946e-001, 6.186048e-001, 6.200146e-001, 6.213896e-001, 6.227646e-001, 6.241396e-001,
+6.255146e-001, 6.268896e-001, 6.282646e-001, 6.296396e-001, 6.309878e-001, 6.323265e-001, 6.336652e-001, 6.350039e-001, 6.363425e-001, 6.376812e-001,
+6.390199e-001, 6.403485e-001, 6.416497e-001, 6.429508e-001, 6.442520e-001, 6.455532e-001, 6.468543e-001, 6.481555e-001, 6.494566e-001, 6.507353e-001,
+6.519978e-001, 6.532602e-001, 6.545227e-001, 6.557852e-001, 6.570477e-001, 6.583102e-001, 6.595727e-001, 6.608088e-001, 6.620316e-001, 6.632543e-001,
+6.644770e-001, 6.656997e-001, 6.669224e-001, 6.681451e-001, 6.693678e-001, 6.705708e-001, 6.717528e-001, 6.729347e-001, 6.741166e-001, 6.752986e-001,
+6.764805e-001, 6.776625e-001, 6.788444e-001, 6.800254e-001, 6.811657e-001, 6.823060e-001, 6.834463e-001, 6.845866e-001, 6.857269e-001, 6.868671e-001,
+6.880074e-001, 6.891477e-001, 6.902773e-001, 6.913753e-001, 6.924732e-001, 6.935711e-001, 6.946691e-001, 6.957670e-001, 6.968650e-001, 6.979629e-001,
+6.990608e-001, 7.001526e-001, 7.012077e-001, 7.022627e-001, 7.033178e-001, 7.043729e-001, 7.054279e-001, 7.064830e-001, 7.075381e-001, 7.085931e-001,
+7.096482e-001, 7.106745e-001, 7.116863e-001, 7.126982e-001, 7.137101e-001, 7.147220e-001, 7.157338e-001, 7.167457e-001, 7.177576e-001, 7.187695e-001,
+7.197814e-001, 7.207593e-001, 7.217279e-001, 7.226964e-001, 7.236650e-001, 7.246336e-001, 7.256022e-001, 7.265708e-001, 7.275393e-001, 7.285079e-001,
+7.294765e-001, 7.304252e-001, 7.313506e-001, 7.322760e-001, 7.332014e-001, 7.341268e-001, 7.350522e-001, 7.359776e-001, 7.369030e-001, 7.378284e-001,
+7.387538e-001, 7.396792e-001, 7.405766e-001, 7.414592e-001, 7.423417e-001, 7.432242e-001, 7.441068e-001, 7.449893e-001, 7.458719e-001, 7.467544e-001,
+7.476370e-001, 7.485195e-001, 7.494021e-001, 7.502709e-001, 7.511112e-001, 7.519514e-001, 7.527916e-001, 7.536319e-001, 7.544721e-001, 7.553123e-001,
+7.561525e-001, 7.569928e-001, 7.578330e-001, 7.586732e-001, 7.595135e-001, 7.603362e-001, 7.611348e-001, 7.619335e-001, 7.627321e-001, 7.635307e-001,
+7.643294e-001, 7.651280e-001, 7.659267e-001, 7.667253e-001, 7.675240e-001, 7.683226e-001, 7.691212e-001, 7.699199e-001, 7.706819e-001, 7.714399e-001,
+7.721979e-001, 7.729558e-001, 7.737138e-001, 7.744718e-001, 7.752297e-001, 7.759877e-001, 7.767457e-001, 7.775036e-001, 7.782616e-001, 7.790196e-001,
+7.797775e-001, 7.805075e-001, 7.812259e-001, 7.819442e-001, 7.826626e-001, 7.833809e-001, 7.840993e-001, 7.848176e-001, 7.855360e-001, 7.862543e-001,
+7.869727e-001, 7.876910e-001, 7.884094e-001, 7.891278e-001, 7.898461e-001, 7.905343e-001, 7.912142e-001, 7.918942e-001, 7.925741e-001, 7.932540e-001,
+7.939340e-001, 7.946139e-001, 7.952939e-001, 7.959738e-001, 7.966537e-001, 7.973337e-001, 7.980136e-001, 7.986936e-001, 7.993735e-001, 8.000505e-001,
+8.006934e-001, 8.013362e-001, 8.019790e-001, 8.026219e-001, 8.032647e-001, 8.039076e-001, 8.045504e-001, 8.051932e-001, 8.058361e-001, 8.064789e-001,
+8.071217e-001, 8.077646e-001, 8.084074e-001, 8.090502e-001, 8.096931e-001, 8.103173e-001, 8.109244e-001, 8.115315e-001, 8.121387e-001, 8.127458e-001,
+8.133529e-001, 8.139601e-001, 8.145672e-001, 8.151743e-001, 8.157814e-001, 8.163886e-001, 8.169957e-001, 8.176028e-001, 8.182100e-001, 8.188171e-001,
+8.194242e-001, 8.200296e-001, 8.206025e-001, 8.211754e-001, 8.217483e-001, 8.223211e-001, 8.228940e-001, 8.234669e-001, 8.240398e-001, 8.246127e-001,
+8.251856e-001, 8.257585e-001, 8.263314e-001, 8.269042e-001, 8.274771e-001, 8.280500e-001, 8.286229e-001, 8.291958e-001, 8.297687e-001, 8.303220e-001,
+8.308622e-001, 8.314023e-001, 8.319425e-001, 8.324826e-001, 8.330228e-001, 8.335629e-001, 8.341031e-001, 8.346432e-001, 8.351834e-001, 8.357235e-001,
+8.362637e-001, 8.368038e-001, 8.373440e-001, 8.378841e-001, 8.384243e-001, 8.389644e-001, 8.395046e-001, 8.400421e-001, 8.405511e-001, 8.410600e-001,
+8.415690e-001, 8.420779e-001, 8.425868e-001, 8.430958e-001, 8.436047e-001, 8.441137e-001, 8.446226e-001, 8.451315e-001, 8.456405e-001, 8.461494e-001,
+8.466584e-001, 8.471673e-001, 8.476762e-001, 8.481852e-001, 8.486941e-001, 8.492031e-001, 8.497120e-001, 8.502081e-001, 8.506873e-001, 8.511666e-001,
+8.516459e-001, 8.521251e-001, 8.526044e-001, 8.530836e-001, 8.535629e-001, 8.540422e-001, 8.545214e-001, 8.550007e-001, 8.554800e-001, 8.559592e-001,
+8.564385e-001, 8.569178e-001, 8.573970e-001, 8.578763e-001, 8.583556e-001, 8.588348e-001, 8.593141e-001, 8.597934e-001, 8.602566e-001, 8.607078e-001,
+8.611589e-001, 8.616100e-001, 8.620611e-001, 8.625122e-001, 8.629634e-001, 8.634145e-001, 8.638656e-001, 8.643167e-001, 8.647678e-001, 8.652190e-001,
+8.656701e-001, 8.661212e-001, 8.665723e-001, 8.670234e-001, 8.674746e-001, 8.679257e-001, 8.683768e-001, 8.688279e-001, 8.692790e-001, 8.697302e-001,
+8.701706e-001, 8.705951e-001, 8.710195e-001, 8.714440e-001, 8.718685e-001, 8.722930e-001, 8.727174e-001, 8.731419e-001, 8.735664e-001, 8.739909e-001,
+8.744154e-001, 8.748398e-001, 8.752643e-001, 8.756888e-001, 8.761133e-001, 8.765378e-001, 8.769622e-001, 8.773867e-001, 8.778112e-001, 8.782357e-001,
+8.786601e-001, 8.790846e-001, 8.795091e-001, 8.799336e-001, 8.803368e-001, 8.807361e-001, 8.811354e-001, 8.815348e-001, 8.819341e-001, 8.823334e-001,
+8.827327e-001, 8.831320e-001, 8.835313e-001, 8.839306e-001, 8.843299e-001, 8.847292e-001, 8.851285e-001, 8.855278e-001, 8.859272e-001, 8.863265e-001,
+8.867258e-001, 8.871251e-001, 8.875244e-001, 8.879237e-001, 8.883230e-001, 8.887223e-001, 8.891216e-001, 8.895209e-001, 8.899202e-001, 8.903006e-001,
+8.906761e-001, 8.910517e-001, 8.914273e-001, 8.918028e-001, 8.921784e-001, 8.925540e-001, 8.929295e-001, 8.933051e-001, 8.936807e-001, 8.940562e-001,
+8.944318e-001, 8.948074e-001, 8.951830e-001, 8.955585e-001, 8.959341e-001, 8.963097e-001, 8.966852e-001, 8.970608e-001, 8.974364e-001, 8.978119e-001,
+8.981875e-001, 8.985631e-001, 8.989386e-001, 8.993142e-001, 8.996898e-001, 9.000615e-001, 9.004147e-001, 9.007679e-001, 9.011211e-001, 9.014743e-001,
+9.018275e-001, 9.021807e-001, 9.025339e-001, 9.028872e-001, 9.032404e-001, 9.035936e-001, 9.039468e-001, 9.043000e-001, 9.046532e-001, 9.050064e-001,
+9.053596e-001, 9.057129e-001, 9.060661e-001, 9.064193e-001, 9.067725e-001, 9.071257e-001, 9.074789e-001, 9.078321e-001, 9.081853e-001, 9.085385e-001,
+9.088918e-001, 9.092450e-001, 9.095982e-001, 9.099514e-001, 9.102865e-001, 9.106187e-001, 9.109508e-001, 9.112830e-001, 9.116152e-001, 9.119474e-001,
+9.122796e-001, 9.126117e-001, 9.129439e-001, 9.132761e-001, 9.136083e-001, 9.139405e-001, 9.142726e-001, 9.146048e-001, 9.149370e-001, 9.152692e-001,
+9.156014e-001, 9.159336e-001, 9.162657e-001, 9.165979e-001, 9.169301e-001, 9.172623e-001, 9.175945e-001, 9.179266e-001, 9.182588e-001, 9.185910e-001,
+9.189232e-001, 9.192554e-001, 9.195876e-001, 9.199197e-001, 9.202369e-001, 9.205494e-001, 9.208618e-001, 9.211742e-001, 9.214866e-001, 9.217990e-001,
+9.221115e-001, 9.224239e-001, 9.227363e-001, 9.230487e-001, 9.233612e-001, 9.236736e-001, 9.239860e-001, 9.242984e-001, 9.246109e-001, 9.249233e-001,
+9.252357e-001, 9.255481e-001, 9.258605e-001, 9.261730e-001, 9.264854e-001, 9.267978e-001, 9.271102e-001, 9.274227e-001, 9.277351e-001, 9.280475e-001,
+9.283599e-001, 9.286723e-001, 9.289848e-001, 9.292972e-001, 9.296096e-001, 9.299220e-001, 9.302205e-001, 9.305144e-001, 9.308083e-001, 9.311022e-001,
+9.313960e-001, 9.316899e-001, 9.319838e-001, 9.322777e-001, 9.325715e-001, 9.328654e-001, 9.331593e-001, 9.334532e-001, 9.337470e-001, 9.340409e-001,
+9.343348e-001, 9.346287e-001, 9.349225e-001, 9.352164e-001, 9.355103e-001, 9.358041e-001, 9.360980e-001, 9.363919e-001, 9.366858e-001, 9.369796e-001,
+9.372735e-001, 9.375674e-001, 9.378613e-001, 9.381551e-001, 9.384490e-001, 9.387429e-001, 9.390368e-001, 9.393306e-001, 9.396245e-001, 9.399184e-001,
+9.401997e-001, 9.404762e-001, 9.407527e-001, 9.410291e-001, 9.413056e-001, 9.415821e-001, 9.418586e-001, 9.421350e-001, 9.424115e-001, 9.426880e-001,
+9.429645e-001, 9.432409e-001, 9.435174e-001, 9.437939e-001, 9.440704e-001, 9.443468e-001, 9.446233e-001, 9.448998e-001, 9.451763e-001, 9.454527e-001,
+9.457292e-001, 9.460057e-001, 9.462822e-001, 9.465587e-001, 9.468351e-001, 9.471116e-001, 9.473881e-001, 9.476646e-001, 9.479410e-001, 9.482175e-001,
+9.484940e-001, 9.487705e-001, 9.490469e-001, 9.493234e-001, 9.495999e-001, 9.498764e-001, 9.501438e-001, 9.504040e-001, 9.506642e-001, 9.509243e-001,
+9.511845e-001, 9.514447e-001, 9.517048e-001, 9.519650e-001, 9.522252e-001, 9.524853e-001, 9.527455e-001, 9.530057e-001, 9.532658e-001, 9.535260e-001,
+9.537862e-001, 9.540463e-001, 9.543065e-001, 9.545667e-001, 9.548269e-001, 9.550870e-001, 9.553472e-001, 9.556074e-001, 9.558675e-001, 9.561277e-001,
+9.563879e-001, 9.566480e-001, 9.569082e-001, 9.571684e-001, 9.574285e-001, 9.576887e-001, 9.579489e-001, 9.582090e-001, 9.584692e-001, 9.587294e-001,
+9.589895e-001, 9.592497e-001, 9.595099e-001, 9.597700e-001, 9.600284e-001, 9.602733e-001, 9.605182e-001, 9.607631e-001, 9.610080e-001, 9.612529e-001,
+9.614978e-001, 9.617426e-001, 9.619875e-001, 9.622324e-001, 9.624773e-001, 9.627222e-001, 9.629671e-001, 9.632120e-001, 9.634569e-001, 9.637018e-001,
+9.639466e-001, 9.641915e-001, 9.644364e-001, 9.646813e-001, 9.649262e-001, 9.651711e-001, 9.654160e-001, 9.656609e-001, 9.659057e-001, 9.661506e-001,
+9.663955e-001, 9.666404e-001, 9.668853e-001, 9.671302e-001, 9.673751e-001, 9.676200e-001, 9.678648e-001, 9.681097e-001, 9.683546e-001, 9.685995e-001,
+9.688444e-001, 9.690893e-001, 9.693342e-001, 9.695791e-001, 9.698240e-001, 9.700648e-001, 9.702954e-001, 9.705260e-001, 9.707566e-001, 9.709871e-001,
+9.712177e-001, 9.714483e-001, 9.716789e-001, 9.719094e-001, 9.721400e-001, 9.723706e-001, 9.726012e-001, 9.728318e-001, 9.730623e-001, 9.732929e-001,
+9.735235e-001, 9.737541e-001, 9.739846e-001, 9.742152e-001, 9.744458e-001, 9.746764e-001, 9.749070e-001, 9.751375e-001, 9.753681e-001, 9.755987e-001,
+9.758293e-001, 9.760598e-001, 9.762904e-001, 9.765210e-001, 9.767516e-001, 9.769822e-001, 9.772127e-001, 9.774433e-001, 9.776739e-001, 9.779045e-001,
+9.781350e-001, 9.783656e-001, 9.785962e-001, 9.788268e-001, 9.790574e-001, 9.792879e-001, 9.795185e-001, 9.797491e-001, 9.799797e-001, 9.801980e-001,
+9.804152e-001, 9.806324e-001, 9.808496e-001, 9.810667e-001, 9.812839e-001, 9.815011e-001, 9.817183e-001, 9.819355e-001, 9.821526e-001, 9.823698e-001,
+9.825870e-001, 9.828042e-001, 9.830214e-001, 9.832385e-001, 9.834557e-001, 9.836729e-001, 9.838901e-001, 9.841073e-001, 9.843244e-001, 9.845416e-001,
+9.847588e-001, 9.849760e-001, 9.851932e-001, 9.854103e-001, 9.856275e-001, 9.858447e-001, 9.860619e-001, 9.862790e-001, 9.864962e-001, 9.867134e-001,
+9.869306e-001, 9.871478e-001, 9.873649e-001, 9.875821e-001, 9.877993e-001, 9.880165e-001, 9.882337e-001, 9.884508e-001, 9.886680e-001, 9.888852e-001,
+9.891024e-001, 9.893196e-001, 9.895367e-001, 9.897539e-001, 9.899711e-001, 9.901774e-001, 9.903820e-001, 9.905867e-001, 9.907913e-001, 9.909960e-001,
+9.912006e-001, 9.914052e-001, 9.916099e-001, 9.918145e-001, 9.920191e-001, 9.922238e-001, 9.924284e-001, 9.926331e-001, 9.928377e-001, 9.930423e-001,
+9.932470e-001, 9.934516e-001, 9.936562e-001, 9.938609e-001, 9.940655e-001, 9.942702e-001, 9.944748e-001, 9.946794e-001, 9.948841e-001, 9.950887e-001,
+9.952933e-001, 9.954980e-001, 9.957026e-001, 9.959073e-001, 9.961119e-001, 9.963165e-001, 9.965212e-001, 9.967258e-001, 9.969304e-001, 9.971351e-001,
+9.973397e-001, 9.975444e-001, 9.977490e-001, 9.979536e-001, 9.981583e-001, 9.983629e-001, 9.985675e-001, 9.987722e-001, 9.989768e-001, 9.991815e-001,
+9.993861e-001, 9.995907e-001, 9.997954e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.980598e-004, 1.796120e-003, 2.694179e-003, 3.592239e-003, 4.490299e-003, 5.388359e-003, 6.286419e-003, 7.184479e-003, 8.082538e-003,
+8.980598e-003, 9.878658e-003, 1.085931e-002, 1.185286e-002, 1.284641e-002, 1.383997e-002, 1.483352e-002, 1.582707e-002, 1.682062e-002, 1.781418e-002,
+1.880773e-002, 1.980128e-002, 2.088093e-002, 2.198212e-002, 2.308330e-002, 2.418448e-002, 2.528566e-002, 2.638684e-002, 2.748802e-002, 2.858920e-002,
+2.969038e-002, 3.087879e-002, 3.210130e-002, 3.332382e-002, 3.454634e-002, 3.576885e-002, 3.699137e-002, 3.821389e-002, 3.943641e-002, 4.073262e-002,
+4.209188e-002, 4.345113e-002, 4.481038e-002, 4.616963e-002, 4.752889e-002, 4.888814e-002, 5.027540e-002, 5.178856e-002, 5.330172e-002, 5.481488e-002,
+5.632803e-002, 5.784119e-002, 5.935435e-002, 6.096660e-002, 6.265259e-002, 6.433859e-002, 6.602459e-002, 6.771059e-002, 6.939658e-002, 7.120677e-002,
+7.308617e-002, 7.496558e-002, 7.684498e-002, 7.872439e-002, 8.067296e-002, 8.276765e-002, 8.486234e-002, 8.695703e-002, 8.905172e-002, 9.127660e-002,
+9.360915e-002, 9.594171e-002, 9.827426e-002, 1.006745e-001, 1.032672e-001, 1.058600e-001, 1.084527e-001, 1.111586e-001, 1.140321e-001, 1.169056e-001,
+1.197791e-001, 1.229275e-001, 1.260988e-001, 1.292701e-001, 1.326791e-001, 1.361591e-001, 1.396391e-001, 1.433980e-001, 1.471891e-001, 1.510583e-001,
+1.551516e-001, 1.592449e-001, 1.635666e-001, 1.679401e-001, 1.724428e-001, 1.770606e-001, 1.817496e-001, 1.865633e-001, 1.914165e-001, 1.963681e-001,
+2.013395e-001, 2.063657e-001, 2.113949e-001, 2.164323e-001, 2.214559e-001, 2.264461e-001, 2.314082e-001, 2.363009e-001, 2.411602e-001, 2.459158e-001,
+2.506480e-001, 2.552377e-001, 2.598275e-001, 2.642399e-001, 2.686453e-001, 2.729164e-001, 2.771279e-001, 2.812768e-001, 2.852917e-001, 2.893066e-001,
+2.931610e-001, 2.969820e-001, 3.007636e-001, 3.043972e-001, 3.080308e-001, 3.115826e-001, 3.150376e-001, 3.184926e-001, 3.218528e-001, 3.251396e-001,
+3.284264e-001, 3.316313e-001, 3.347609e-001, 3.378904e-001, 3.409724e-001, 3.439560e-001, 3.469395e-001, 3.499230e-001, 3.527749e-001, 3.556234e-001,
+3.584718e-001, 3.612624e-001, 3.639862e-001, 3.667100e-001, 3.694338e-001, 3.720667e-001, 3.746758e-001, 3.772849e-001, 3.798939e-001, 3.824018e-001,
+3.849054e-001, 3.874089e-001, 3.899125e-001, 3.923225e-001, 3.947291e-001, 3.971356e-001, 3.995422e-001, 4.018766e-001, 4.041941e-001, 4.065115e-001,
+4.088290e-001, 4.111058e-001, 4.133413e-001, 4.155767e-001, 4.178122e-001, 4.200460e-001, 4.222060e-001, 4.243659e-001, 4.265258e-001, 4.286858e-001,
+4.308185e-001, 4.329088e-001, 4.349991e-001, 4.370894e-001, 4.391798e-001, 4.412310e-001, 4.432570e-001, 4.452830e-001, 4.473090e-001, 4.493350e-001,
+4.513210e-001, 4.532875e-001, 4.552540e-001, 4.572204e-001, 4.591869e-001, 4.611210e-001, 4.630321e-001, 4.649433e-001, 4.668545e-001, 4.687657e-001,
+4.706587e-001, 4.725184e-001, 4.743781e-001, 4.762378e-001, 4.780976e-001, 4.799573e-001, 4.817700e-001, 4.835816e-001, 4.853932e-001, 4.872049e-001,
+4.890165e-001, 4.908075e-001, 4.925739e-001, 4.943404e-001, 4.961069e-001, 4.978734e-001, 4.996399e-001, 5.013725e-001, 5.030964e-001, 5.048203e-001,
+5.065443e-001, 5.082682e-001, 5.099921e-001, 5.116760e-001, 5.133596e-001, 5.150432e-001, 5.167268e-001, 5.184104e-001, 5.200919e-001, 5.217371e-001,
+5.233823e-001, 5.250275e-001, 5.266727e-001, 5.283179e-001, 5.299632e-001, 5.315724e-001, 5.331808e-001, 5.347892e-001, 5.363975e-001, 5.380059e-001,
+5.396143e-001, 5.411957e-001, 5.427686e-001, 5.443415e-001, 5.459143e-001, 5.474872e-001, 5.490601e-001, 5.506191e-001, 5.521575e-001, 5.536959e-001,
+5.552342e-001, 5.567726e-001, 5.583110e-001, 5.598494e-001, 5.613574e-001, 5.628620e-001, 5.643667e-001, 5.658714e-001, 5.673761e-001, 5.688807e-001,
+5.703769e-001, 5.718484e-001, 5.733199e-001, 5.747914e-001, 5.762629e-001, 5.777344e-001, 5.792059e-001, 5.806623e-001, 5.821009e-001, 5.835396e-001,
+5.849782e-001, 5.864169e-001, 5.878555e-001, 5.892941e-001, 5.907161e-001, 5.921220e-001, 5.935280e-001, 5.949339e-001, 5.963398e-001, 5.977457e-001,
+5.991516e-001, 6.005445e-001, 6.019177e-001, 6.032908e-001, 6.046640e-001, 6.060371e-001, 6.074103e-001, 6.087834e-001, 6.101528e-001, 6.114929e-001,
+6.128331e-001, 6.141733e-001, 6.155134e-001, 6.168536e-001, 6.181937e-001, 6.195339e-001, 6.208523e-001, 6.221592e-001, 6.234660e-001, 6.247729e-001,
+6.260797e-001, 6.273866e-001, 6.286934e-001, 6.300003e-001, 6.312734e-001, 6.325465e-001, 6.338196e-001, 6.350927e-001, 6.363658e-001, 6.376389e-001,
+6.389120e-001, 6.401802e-001, 6.414190e-001, 6.426579e-001, 6.438967e-001, 6.451356e-001, 6.463744e-001, 6.476133e-001, 6.488522e-001, 6.500885e-001,
+6.512925e-001, 6.524965e-001, 6.537006e-001, 6.549046e-001, 6.561087e-001, 6.573127e-001, 6.585168e-001, 6.597208e-001, 6.608977e-001, 6.620663e-001,
+6.632350e-001, 6.644036e-001, 6.655723e-001, 6.667409e-001, 6.679096e-001, 6.690782e-001, 6.702393e-001, 6.713720e-001, 6.725047e-001, 6.736374e-001,
+6.747701e-001, 6.759028e-001, 6.770355e-001, 6.781682e-001, 6.793009e-001, 6.804196e-001, 6.815158e-001, 6.826120e-001, 6.837082e-001, 6.848044e-001,
+6.859006e-001, 6.869968e-001, 6.880930e-001, 6.891892e-001, 6.902758e-001, 6.913350e-001, 6.923943e-001, 6.934535e-001, 6.945127e-001, 6.955720e-001,
+6.966312e-001, 6.976904e-001, 6.987497e-001, 6.998089e-001, 7.008375e-001, 7.018594e-001, 7.028812e-001, 7.039031e-001, 7.049250e-001, 7.059468e-001,
+7.069687e-001, 7.079906e-001, 7.090124e-001, 7.100330e-001, 7.110173e-001, 7.120015e-001, 7.129857e-001, 7.139699e-001, 7.149541e-001, 7.159383e-001,
+7.169225e-001, 7.179068e-001, 7.188910e-001, 7.198752e-001, 7.208264e-001, 7.217728e-001, 7.227192e-001, 7.236655e-001, 7.246119e-001, 7.255583e-001,
+7.265047e-001, 7.274511e-001, 7.283975e-001, 7.293439e-001, 7.302787e-001, 7.311872e-001, 7.320957e-001, 7.330042e-001, 7.339128e-001, 7.348213e-001,
+7.357298e-001, 7.366383e-001, 7.375468e-001, 7.384554e-001, 7.393639e-001, 7.402611e-001, 7.411319e-001, 7.420026e-001, 7.428734e-001, 7.437441e-001,
+7.446149e-001, 7.454857e-001, 7.463564e-001, 7.472272e-001, 7.480979e-001, 7.489687e-001, 7.498395e-001, 7.506796e-001, 7.515128e-001, 7.523461e-001,
+7.531793e-001, 7.540126e-001, 7.548458e-001, 7.556790e-001, 7.565123e-001, 7.573455e-001, 7.581788e-001, 7.590120e-001, 7.598452e-001, 7.606482e-001,
+7.614443e-001, 7.622404e-001, 7.630366e-001, 7.638327e-001, 7.646288e-001, 7.654249e-001, 7.662210e-001, 7.670171e-001, 7.678132e-001, 7.686093e-001,
+7.694054e-001, 7.701922e-001, 7.709517e-001, 7.717112e-001, 7.724707e-001, 7.732302e-001, 7.739897e-001, 7.747492e-001, 7.755087e-001, 7.762682e-001,
+7.770277e-001, 7.777872e-001, 7.785467e-001, 7.793062e-001, 7.800626e-001, 7.807862e-001, 7.815097e-001, 7.822333e-001, 7.829568e-001, 7.836804e-001,
+7.844039e-001, 7.851275e-001, 7.858511e-001, 7.865746e-001, 7.872982e-001, 7.880217e-001, 7.887453e-001, 7.894688e-001, 7.901830e-001, 7.908714e-001,
+7.915598e-001, 7.922482e-001, 7.929366e-001, 7.936250e-001, 7.943134e-001, 7.950018e-001, 7.956901e-001, 7.963785e-001, 7.970669e-001, 7.977553e-001,
+7.984437e-001, 7.991321e-001, 7.998205e-001, 8.004835e-001, 8.011377e-001, 8.017918e-001, 8.024459e-001, 8.031000e-001, 8.037541e-001, 8.044083e-001,
+8.050624e-001, 8.057165e-001, 8.063706e-001, 8.070247e-001, 8.076788e-001, 8.083330e-001, 8.089871e-001, 8.096412e-001, 8.102803e-001, 8.109011e-001,
+8.115220e-001, 8.121428e-001, 8.127636e-001, 8.133845e-001, 8.140053e-001, 8.146261e-001, 8.152470e-001, 8.158678e-001, 8.164886e-001, 8.171095e-001,
+8.177303e-001, 8.183512e-001, 8.189720e-001, 8.195928e-001, 8.202026e-001, 8.207912e-001, 8.213798e-001, 8.219684e-001, 8.225571e-001, 8.231457e-001,
+8.237343e-001, 8.243229e-001, 8.249115e-001, 8.255002e-001, 8.260888e-001, 8.266774e-001, 8.272660e-001, 8.278547e-001, 8.284433e-001, 8.290319e-001,
+8.296205e-001, 8.301981e-001, 8.307556e-001, 8.313132e-001, 8.318707e-001, 8.324283e-001, 8.329858e-001, 8.335434e-001, 8.341009e-001, 8.346584e-001,
+8.352160e-001, 8.357735e-001, 8.363311e-001, 8.368886e-001, 8.374462e-001, 8.380037e-001, 8.385612e-001, 8.391188e-001, 8.396763e-001, 8.402213e-001,
+8.407490e-001, 8.412766e-001, 8.418043e-001, 8.423319e-001, 8.428596e-001, 8.433872e-001, 8.439149e-001, 8.444425e-001, 8.449702e-001, 8.454978e-001,
+8.460255e-001, 8.465531e-001, 8.470808e-001, 8.476084e-001, 8.481361e-001, 8.486637e-001, 8.491914e-001, 8.497190e-001, 8.502333e-001, 8.507323e-001,
+8.512312e-001, 8.517302e-001, 8.522292e-001, 8.527282e-001, 8.532271e-001, 8.537261e-001, 8.542251e-001, 8.547241e-001, 8.552231e-001, 8.557220e-001,
+8.562210e-001, 8.567200e-001, 8.572190e-001, 8.577180e-001, 8.582169e-001, 8.587159e-001, 8.592149e-001, 8.597139e-001, 8.602011e-001, 8.606727e-001,
+8.611443e-001, 8.616158e-001, 8.620874e-001, 8.625589e-001, 8.630305e-001, 8.635020e-001, 8.639736e-001, 8.644451e-001, 8.649167e-001, 8.653882e-001,
+8.658598e-001, 8.663313e-001, 8.668029e-001, 8.672744e-001, 8.677460e-001, 8.682175e-001, 8.686891e-001, 8.691606e-001, 8.696322e-001, 8.700980e-001,
+8.705433e-001, 8.709887e-001, 8.714341e-001, 8.718795e-001, 8.723249e-001, 8.727702e-001, 8.732156e-001, 8.736610e-001, 8.741064e-001, 8.745517e-001,
+8.749971e-001, 8.754425e-001, 8.758879e-001, 8.763332e-001, 8.767786e-001, 8.772240e-001, 8.776694e-001, 8.781148e-001, 8.785601e-001, 8.790055e-001,
+8.794509e-001, 8.798963e-001, 8.803225e-001, 8.807430e-001, 8.811634e-001, 8.815839e-001, 8.820043e-001, 8.824248e-001, 8.828452e-001, 8.832657e-001,
+8.836862e-001, 8.841066e-001, 8.845271e-001, 8.849475e-001, 8.853680e-001, 8.857884e-001, 8.862089e-001, 8.866293e-001, 8.870498e-001, 8.874702e-001,
+8.878907e-001, 8.883111e-001, 8.887316e-001, 8.891521e-001, 8.895725e-001, 8.899930e-001, 8.903901e-001, 8.907869e-001, 8.911837e-001, 8.915804e-001,
+8.919772e-001, 8.923740e-001, 8.927707e-001, 8.931675e-001, 8.935643e-001, 8.939611e-001, 8.943578e-001, 8.947546e-001, 8.951514e-001, 8.955481e-001,
+8.959449e-001, 8.963417e-001, 8.967384e-001, 8.971352e-001, 8.975320e-001, 8.979288e-001, 8.983255e-001, 8.987223e-001, 8.991191e-001, 8.995158e-001,
+8.999126e-001, 9.002919e-001, 9.006662e-001, 9.010405e-001, 9.014148e-001, 9.017891e-001, 9.021634e-001, 9.025377e-001, 9.029120e-001, 9.032863e-001,
+9.036606e-001, 9.040349e-001, 9.044092e-001, 9.047835e-001, 9.051578e-001, 9.055321e-001, 9.059064e-001, 9.062807e-001, 9.066551e-001, 9.070294e-001,
+9.074037e-001, 9.077780e-001, 9.081523e-001, 9.085266e-001, 9.089009e-001, 9.092752e-001, 9.096495e-001, 9.100224e-001, 9.103755e-001, 9.107285e-001,
+9.110815e-001, 9.114346e-001, 9.117876e-001, 9.121406e-001, 9.124937e-001, 9.128467e-001, 9.131997e-001, 9.135528e-001, 9.139058e-001, 9.142588e-001,
+9.146119e-001, 9.149649e-001, 9.153179e-001, 9.156709e-001, 9.160240e-001, 9.163770e-001, 9.167300e-001, 9.170831e-001, 9.174361e-001, 9.177891e-001,
+9.181422e-001, 9.184952e-001, 9.188482e-001, 9.192013e-001, 9.195543e-001, 9.199073e-001, 9.202455e-001, 9.205784e-001, 9.209113e-001, 9.212443e-001,
+9.215772e-001, 9.219101e-001, 9.222430e-001, 9.225759e-001, 9.229088e-001, 9.232417e-001, 9.235747e-001, 9.239076e-001, 9.242405e-001, 9.245734e-001,
+9.249063e-001, 9.252392e-001, 9.255721e-001, 9.259051e-001, 9.262380e-001, 9.265709e-001, 9.269038e-001, 9.272367e-001, 9.275696e-001, 9.279025e-001,
+9.282355e-001, 9.285684e-001, 9.289013e-001, 9.292342e-001, 9.295671e-001, 9.299000e-001, 9.302197e-001, 9.305336e-001, 9.308475e-001, 9.311614e-001,
+9.314753e-001, 9.317892e-001, 9.321032e-001, 9.324171e-001, 9.327310e-001, 9.330449e-001, 9.333588e-001, 9.336727e-001, 9.339867e-001, 9.343006e-001,
+9.346145e-001, 9.349284e-001, 9.352423e-001, 9.355562e-001, 9.358702e-001, 9.361841e-001, 9.364980e-001, 9.368119e-001, 9.371258e-001, 9.374398e-001,
+9.377537e-001, 9.380676e-001, 9.383815e-001, 9.386954e-001, 9.390093e-001, 9.393233e-001, 9.396372e-001, 9.399511e-001, 9.402499e-001, 9.405459e-001,
+9.408419e-001, 9.411379e-001, 9.414339e-001, 9.417299e-001, 9.420259e-001, 9.423219e-001, 9.426179e-001, 9.429139e-001, 9.432098e-001, 9.435058e-001,
+9.438018e-001, 9.440978e-001, 9.443938e-001, 9.446898e-001, 9.449858e-001, 9.452818e-001, 9.455778e-001, 9.458738e-001, 9.461698e-001, 9.464658e-001,
+9.467618e-001, 9.470578e-001, 9.473538e-001, 9.476498e-001, 9.479458e-001, 9.482418e-001, 9.485378e-001, 9.488338e-001, 9.491298e-001, 9.494258e-001,
+9.497218e-001, 9.500168e-001, 9.502959e-001, 9.505750e-001, 9.508541e-001, 9.511332e-001, 9.514123e-001, 9.516914e-001, 9.519705e-001, 9.522496e-001,
+9.525288e-001, 9.528079e-001, 9.530870e-001, 9.533661e-001, 9.536452e-001, 9.539243e-001, 9.542034e-001, 9.544825e-001, 9.547616e-001, 9.550407e-001,
+9.553199e-001, 9.555990e-001, 9.558781e-001, 9.561572e-001, 9.564363e-001, 9.567154e-001, 9.569945e-001, 9.572736e-001, 9.575527e-001, 9.578318e-001,
+9.581110e-001, 9.583901e-001, 9.586692e-001, 9.589483e-001, 9.592274e-001, 9.595065e-001, 9.597856e-001, 9.600610e-001, 9.603242e-001, 9.605875e-001,
+9.608507e-001, 9.611139e-001, 9.613771e-001, 9.616403e-001, 9.619035e-001, 9.621667e-001, 9.624299e-001, 9.626931e-001, 9.629563e-001, 9.632196e-001,
+9.634828e-001, 9.637460e-001, 9.640092e-001, 9.642724e-001, 9.645356e-001, 9.647988e-001, 9.650620e-001, 9.653252e-001, 9.655884e-001, 9.658517e-001,
+9.661149e-001, 9.663781e-001, 9.666413e-001, 9.669045e-001, 9.671677e-001, 9.674309e-001, 9.676941e-001, 9.679573e-001, 9.682205e-001, 9.684838e-001,
+9.687470e-001, 9.690102e-001, 9.692734e-001, 9.695366e-001, 9.697998e-001, 9.700594e-001, 9.703077e-001, 9.705559e-001, 9.708042e-001, 9.710524e-001,
+9.713007e-001, 9.715489e-001, 9.717972e-001, 9.720454e-001, 9.722937e-001, 9.725419e-001, 9.727902e-001, 9.730384e-001, 9.732867e-001, 9.735349e-001,
+9.737832e-001, 9.740314e-001, 9.742797e-001, 9.745279e-001, 9.747762e-001, 9.750244e-001, 9.752727e-001, 9.755209e-001, 9.757692e-001, 9.760174e-001,
+9.762657e-001, 9.765139e-001, 9.767622e-001, 9.770105e-001, 9.772587e-001, 9.775070e-001, 9.777552e-001, 9.780035e-001, 9.782517e-001, 9.785000e-001,
+9.787482e-001, 9.789965e-001, 9.792447e-001, 9.794930e-001, 9.797412e-001, 9.799895e-001, 9.802242e-001, 9.804584e-001, 9.806926e-001, 9.809268e-001,
+9.811610e-001, 9.813952e-001, 9.816293e-001, 9.818635e-001, 9.820977e-001, 9.823319e-001, 9.825661e-001, 9.828003e-001, 9.830344e-001, 9.832686e-001,
+9.835028e-001, 9.837370e-001, 9.839712e-001, 9.842054e-001, 9.844396e-001, 9.846737e-001, 9.849079e-001, 9.851421e-001, 9.853763e-001, 9.856105e-001,
+9.858447e-001, 9.860788e-001, 9.863130e-001, 9.865472e-001, 9.867814e-001, 9.870156e-001, 9.872498e-001, 9.874840e-001, 9.877181e-001, 9.879523e-001,
+9.881865e-001, 9.884207e-001, 9.886549e-001, 9.888891e-001, 9.891232e-001, 9.893574e-001, 9.895916e-001, 9.898258e-001, 9.900566e-001, 9.902776e-001,
+9.904985e-001, 9.907195e-001, 9.909405e-001, 9.911614e-001, 9.913824e-001, 9.916033e-001, 9.918243e-001, 9.920453e-001, 9.922662e-001, 9.924872e-001,
+9.927082e-001, 9.929291e-001, 9.931501e-001, 9.933711e-001, 9.935920e-001, 9.938130e-001, 9.940340e-001, 9.942549e-001, 9.944759e-001, 9.946968e-001,
+9.949178e-001, 9.951388e-001, 9.953597e-001, 9.955807e-001, 9.958017e-001, 9.960226e-001, 9.962436e-001, 9.964646e-001, 9.966855e-001, 9.969065e-001,
+9.971275e-001, 9.973484e-001, 9.975694e-001, 9.977904e-001, 9.980113e-001, 9.982323e-001, 9.984532e-001, 9.986742e-001, 9.988952e-001, 9.991161e-001,
+9.993371e-001, 9.995581e-001, 9.997790e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 4.710060e-004, 9.420120e-004, 1.413018e-003, 1.884024e-003, 2.355030e-003, 2.826036e-003, 3.297042e-003, 3.768048e-003, 4.239054e-003,
+4.710060e-003, 5.181066e-003, 5.652072e-003, 6.123078e-003, 6.594084e-003, 7.065090e-003, 7.536096e-003, 8.007102e-003, 8.478108e-003, 8.949114e-003,
+9.420120e-003, 9.891126e-003, 1.039803e-002, 1.091572e-002, 1.143341e-002, 1.195111e-002, 1.246880e-002, 1.298649e-002, 1.350418e-002, 1.402188e-002,
+1.453957e-002, 1.505726e-002, 1.557496e-002, 1.609265e-002, 1.661034e-002, 1.712803e-002, 1.764573e-002, 1.816342e-002, 1.868111e-002, 1.919881e-002,
+1.971650e-002, 2.025796e-002, 2.082820e-002, 2.139844e-002, 2.196867e-002, 2.253891e-002, 2.310915e-002, 2.367938e-002, 2.424962e-002, 2.481986e-002,
+2.539009e-002, 2.596033e-002, 2.653057e-002, 2.710080e-002, 2.767104e-002, 2.824128e-002, 2.881151e-002, 2.938175e-002, 2.995199e-002, 3.057650e-002,
+3.120600e-002, 3.183550e-002, 3.246500e-002, 3.309450e-002, 3.372400e-002, 3.435350e-002, 3.498300e-002, 3.561250e-002, 3.624200e-002, 3.687150e-002,
+3.750100e-002, 3.813050e-002, 3.876000e-002, 3.938950e-002, 4.002102e-002, 4.071750e-002, 4.141398e-002, 4.211046e-002, 4.280695e-002, 4.350343e-002,
+4.419991e-002, 4.489639e-002, 4.559287e-002, 4.628935e-002, 4.698584e-002, 4.768232e-002, 4.837880e-002, 4.907528e-002, 4.977176e-002, 5.051924e-002,
+5.129158e-002, 5.206391e-002, 5.283625e-002, 5.360858e-002, 5.438092e-002, 5.515325e-002, 5.592559e-002, 5.669793e-002, 5.747026e-002, 5.824260e-002,
+5.901493e-002, 5.978727e-002, 6.062195e-002, 6.148034e-002, 6.233873e-002, 6.319712e-002, 6.405551e-002, 6.491389e-002, 6.577228e-002, 6.663067e-002,
+6.748906e-002, 6.834745e-002, 6.920584e-002, 7.007154e-002, 7.102770e-002, 7.198386e-002, 7.294001e-002, 7.389617e-002, 7.485233e-002, 7.580849e-002,
+7.676464e-002, 7.772080e-002, 7.867696e-002, 7.963312e-002, 8.065781e-002, 8.172518e-002, 8.279254e-002, 8.385990e-002, 8.492727e-002, 8.599463e-002,
+8.706199e-002, 8.812936e-002, 8.919672e-002, 9.029540e-002, 9.148933e-002, 9.268326e-002, 9.387719e-002, 9.507112e-002, 9.626505e-002, 9.745898e-002,
+9.865291e-002, 9.984684e-002, 1.011663e-001, 1.025043e-001, 1.038423e-001, 1.051802e-001, 1.065182e-001, 1.078562e-001, 1.091941e-001, 1.105972e-001,
+1.120990e-001, 1.136007e-001, 1.151024e-001, 1.166041e-001, 1.181058e-001, 1.196076e-001, 1.212465e-001, 1.229340e-001, 1.246215e-001, 1.263090e-001,
+1.279965e-001, 1.296840e-001, 1.315421e-001, 1.334395e-001, 1.353370e-001, 1.372344e-001, 1.391319e-001, 1.411573e-001, 1.432906e-001, 1.454240e-001,
+1.475573e-001, 1.496907e-001, 1.520488e-001, 1.544450e-001, 1.568412e-001, 1.592375e-001, 1.618311e-001, 1.645168e-001, 1.672026e-001, 1.698883e-001,
+1.728749e-001, 1.758745e-001, 1.788741e-001, 1.820818e-001, 1.854146e-001, 1.887473e-001, 1.922949e-001, 1.959717e-001, 1.996485e-001, 2.036354e-001,
+2.076551e-001, 2.118107e-001, 2.161566e-001, 2.205363e-001, 2.251745e-001, 2.298126e-001, 2.346821e-001, 2.395613e-001, 2.446004e-001, 2.496554e-001,
+2.548052e-001, 2.599620e-001, 2.651448e-001, 2.703251e-001, 2.754638e-001, 2.805903e-001, 2.856245e-001, 2.906390e-001, 2.955219e-001, 3.003895e-001,
+3.050881e-001, 3.097867e-001, 3.142903e-001, 3.187845e-001, 3.231229e-001, 3.274035e-001, 3.315997e-001, 3.356657e-001, 3.397318e-001, 3.436022e-001,
+3.474588e-001, 3.512471e-001, 3.549035e-001, 3.585598e-001, 3.621017e-001, 3.655693e-001, 3.690369e-001, 3.723774e-001, 3.756691e-001, 3.789607e-001,
+3.821411e-001, 3.852700e-001, 3.883990e-001, 3.914548e-001, 3.944341e-001, 3.974134e-001, 4.003747e-001, 4.032169e-001, 4.060591e-001, 4.089013e-001,
+4.116666e-001, 4.143835e-001, 4.171004e-001, 4.198173e-001, 4.224275e-001, 4.250301e-001, 4.276326e-001, 4.302257e-001, 4.327240e-001, 4.352223e-001,
+4.377206e-001, 4.402106e-001, 4.426138e-001, 4.450171e-001, 4.474203e-001, 4.498235e-001, 4.521464e-001, 4.544629e-001, 4.567794e-001, 4.590959e-001,
+4.613641e-001, 4.636014e-001, 4.658387e-001, 4.680760e-001, 4.703032e-001, 4.724680e-001, 4.746328e-001, 4.767977e-001, 4.789625e-001, 4.810927e-001,
+4.831912e-001, 4.852896e-001, 4.873880e-001, 4.894864e-001, 4.915387e-001, 4.935761e-001, 4.956135e-001, 4.976508e-001, 4.996882e-001, 5.016779e-001,
+5.036589e-001, 5.056400e-001, 5.076211e-001, 5.096021e-001, 5.115415e-001, 5.134705e-001, 5.153994e-001, 5.173284e-001, 5.192573e-001, 5.211565e-001,
+5.230369e-001, 5.249174e-001, 5.267978e-001, 5.286783e-001, 5.305453e-001, 5.323804e-001, 5.342155e-001, 5.360506e-001, 5.378857e-001, 5.397208e-001,
+5.415198e-001, 5.433122e-001, 5.451046e-001, 5.468971e-001, 5.486895e-001, 5.504710e-001, 5.522230e-001, 5.539750e-001, 5.557269e-001, 5.574789e-001,
+5.592309e-001, 5.609612e-001, 5.626745e-001, 5.643878e-001, 5.661011e-001, 5.678144e-001, 5.695277e-001, 5.712140e-001, 5.728901e-001, 5.745661e-001,
+5.762422e-001, 5.779182e-001, 5.795943e-001, 5.812429e-001, 5.828827e-001, 5.845226e-001, 5.861624e-001, 5.878023e-001, 5.894421e-001, 5.910585e-001,
+5.926628e-001, 5.942671e-001, 5.958714e-001, 5.974757e-001, 5.990800e-001, 6.006693e-001, 6.022385e-001, 6.038076e-001, 6.053767e-001, 6.069459e-001,
+6.085150e-001, 6.100823e-001, 6.116163e-001, 6.131503e-001, 6.146843e-001, 6.162184e-001, 6.177524e-001, 6.192864e-001, 6.208015e-001, 6.223003e-001,
+6.237990e-001, 6.252977e-001, 6.267964e-001, 6.282951e-001, 6.297938e-001, 6.312616e-001, 6.327246e-001, 6.341875e-001, 6.356505e-001, 6.371134e-001,
+6.385763e-001, 6.400383e-001, 6.414648e-001, 6.428913e-001, 6.443178e-001, 6.457444e-001, 6.471709e-001, 6.485974e-001, 6.500233e-001, 6.514126e-001,
+6.528018e-001, 6.541911e-001, 6.555804e-001, 6.569697e-001, 6.583589e-001, 6.597482e-001, 6.611062e-001, 6.624573e-001, 6.638084e-001, 6.651595e-001,
+6.665106e-001, 6.678617e-001, 6.692128e-001, 6.705475e-001, 6.718594e-001, 6.731713e-001, 6.744832e-001, 6.757950e-001, 6.771069e-001, 6.784188e-001,
+6.797307e-001, 6.810106e-001, 6.822822e-001, 6.835538e-001, 6.848255e-001, 6.860971e-001, 6.873687e-001, 6.886403e-001, 6.899120e-001, 6.911451e-001,
+6.923755e-001, 6.936058e-001, 6.948361e-001, 6.960664e-001, 6.972967e-001, 6.985271e-001, 6.997574e-001, 7.009538e-001, 7.021418e-001, 7.033298e-001,
+7.045179e-001, 7.057059e-001, 7.068939e-001, 7.080820e-001, 7.092700e-001, 7.104414e-001, 7.115863e-001, 7.127312e-001, 7.138760e-001, 7.150209e-001,
+7.161658e-001, 7.173107e-001, 7.184555e-001, 7.196004e-001, 7.207167e-001, 7.218177e-001, 7.229187e-001, 7.240196e-001, 7.251206e-001, 7.262216e-001,
+7.273226e-001, 7.284235e-001, 7.295245e-001, 7.306002e-001, 7.316567e-001, 7.327133e-001, 7.337698e-001, 7.348263e-001, 7.358828e-001, 7.369393e-001,
+7.379958e-001, 7.390523e-001, 7.401042e-001, 7.411159e-001, 7.421276e-001, 7.431393e-001, 7.441510e-001, 7.451627e-001, 7.461744e-001, 7.471861e-001,
+7.481978e-001, 7.492095e-001, 7.502114e-001, 7.511781e-001, 7.521449e-001, 7.531116e-001, 7.540783e-001, 7.550451e-001, 7.560118e-001, 7.569786e-001,
+7.579453e-001, 7.589120e-001, 7.598788e-001, 7.608063e-001, 7.617281e-001, 7.626500e-001, 7.635719e-001, 7.644938e-001, 7.654156e-001, 7.663375e-001,
+7.672594e-001, 7.681813e-001, 7.691031e-001, 7.700238e-001, 7.709011e-001, 7.717785e-001, 7.726558e-001, 7.735331e-001, 7.744105e-001, 7.752878e-001,
+7.761651e-001, 7.770425e-001, 7.779198e-001, 7.787971e-001, 7.796745e-001, 7.805241e-001, 7.813575e-001, 7.821908e-001, 7.830242e-001, 7.838575e-001,
+7.846909e-001, 7.855242e-001, 7.863576e-001, 7.871909e-001, 7.880243e-001, 7.888576e-001, 7.896910e-001, 7.904971e-001, 7.912873e-001, 7.920774e-001,
+7.928675e-001, 7.936577e-001, 7.944478e-001, 7.952379e-001, 7.960281e-001, 7.968182e-001, 7.976083e-001, 7.983985e-001, 7.991886e-001, 7.999787e-001,
+8.007278e-001, 8.014757e-001, 8.022235e-001, 8.029714e-001, 8.037193e-001, 8.044672e-001, 8.052151e-001, 8.059630e-001, 8.067109e-001, 8.074588e-001,
+8.082067e-001, 8.089545e-001, 8.097024e-001, 8.104256e-001, 8.111324e-001, 8.118392e-001, 8.125459e-001, 8.132527e-001, 8.139595e-001, 8.146663e-001,
+8.153731e-001, 8.160799e-001, 8.167867e-001, 8.174935e-001, 8.182003e-001, 8.189071e-001, 8.196138e-001, 8.203026e-001, 8.209696e-001, 8.216365e-001,
+8.223035e-001, 8.229705e-001, 8.236375e-001, 8.243045e-001, 8.249715e-001, 8.256385e-001, 8.263055e-001, 8.269725e-001, 8.276394e-001, 8.283064e-001,
+8.289734e-001, 8.296404e-001, 8.302897e-001, 8.309183e-001, 8.315469e-001, 8.321755e-001, 8.328041e-001, 8.334328e-001, 8.340614e-001, 8.346900e-001,
+8.353186e-001, 8.359472e-001, 8.365758e-001, 8.372044e-001, 8.378330e-001, 8.384616e-001, 8.390902e-001, 8.397189e-001, 8.403271e-001, 8.409188e-001,
+8.415106e-001, 8.421024e-001, 8.426941e-001, 8.432859e-001, 8.438776e-001, 8.444694e-001, 8.450611e-001, 8.456529e-001, 8.462446e-001, 8.468364e-001,
+8.474281e-001, 8.480199e-001, 8.486116e-001, 8.492034e-001, 8.497951e-001, 8.503638e-001, 8.509203e-001, 8.514768e-001, 8.520333e-001, 8.525898e-001,
+8.531463e-001, 8.537028e-001, 8.542593e-001, 8.548158e-001, 8.553723e-001, 8.559288e-001, 8.564853e-001, 8.570417e-001, 8.575982e-001, 8.581547e-001,
+8.587112e-001, 8.592677e-001, 8.598242e-001, 8.603577e-001, 8.608806e-001, 8.614034e-001, 8.619263e-001, 8.624492e-001, 8.629720e-001, 8.634949e-001,
+8.640178e-001, 8.645407e-001, 8.650635e-001, 8.655864e-001, 8.661093e-001, 8.666321e-001, 8.671550e-001, 8.676779e-001, 8.682008e-001, 8.687236e-001,
+8.692465e-001, 8.697694e-001, 8.702744e-001, 8.707653e-001, 8.712562e-001, 8.717471e-001, 8.722380e-001, 8.727290e-001, 8.732199e-001, 8.737108e-001,
+8.742017e-001, 8.746926e-001, 8.751835e-001, 8.756745e-001, 8.761654e-001, 8.766563e-001, 8.771472e-001, 8.776381e-001, 8.781290e-001, 8.786200e-001,
+8.791109e-001, 8.796018e-001, 8.800870e-001, 8.805476e-001, 8.810082e-001, 8.814689e-001, 8.819295e-001, 8.823901e-001, 8.828508e-001, 8.833114e-001,
+8.837720e-001, 8.842327e-001, 8.846933e-001, 8.851539e-001, 8.856146e-001, 8.860752e-001, 8.865358e-001, 8.869965e-001, 8.874571e-001, 8.879177e-001,
+8.883783e-001, 8.888390e-001, 8.892996e-001, 8.897602e-001, 8.902071e-001, 8.906391e-001, 8.910711e-001, 8.915032e-001, 8.919352e-001, 8.923672e-001,
+8.927992e-001, 8.932312e-001, 8.936632e-001, 8.940952e-001, 8.945272e-001, 8.949592e-001, 8.953912e-001, 8.958232e-001, 8.962552e-001, 8.966872e-001,
+8.971192e-001, 8.975512e-001, 8.979832e-001, 8.984152e-001, 8.988472e-001, 8.992792e-001, 8.997112e-001, 9.001343e-001, 9.005393e-001, 9.009443e-001,
+9.013493e-001, 9.017543e-001, 9.021593e-001, 9.025643e-001, 9.029693e-001, 9.033743e-001, 9.037793e-001, 9.041843e-001, 9.045893e-001, 9.049943e-001,
+9.053993e-001, 9.058043e-001, 9.062093e-001, 9.066143e-001, 9.070193e-001, 9.074243e-001, 9.078293e-001, 9.082343e-001, 9.086393e-001, 9.090443e-001,
+9.094493e-001, 9.098543e-001, 9.102430e-001, 9.106226e-001, 9.110022e-001, 9.113818e-001, 9.117614e-001, 9.121410e-001, 9.125206e-001, 9.129002e-001,
+9.132797e-001, 9.136593e-001, 9.140389e-001, 9.144185e-001, 9.147981e-001, 9.151777e-001, 9.155573e-001, 9.159369e-001, 9.163165e-001, 9.166960e-001,
+9.170756e-001, 9.174552e-001, 9.178348e-001, 9.182144e-001, 9.185940e-001, 9.189736e-001, 9.193532e-001, 9.197328e-001, 9.201053e-001, 9.204610e-001,
+9.208167e-001, 9.211724e-001, 9.215281e-001, 9.218838e-001, 9.222395e-001, 9.225953e-001, 9.229510e-001, 9.233067e-001, 9.236624e-001, 9.240181e-001,
+9.243738e-001, 9.247295e-001, 9.250852e-001, 9.254410e-001, 9.257967e-001, 9.261524e-001, 9.265081e-001, 9.268638e-001, 9.272195e-001, 9.275752e-001,
+9.279309e-001, 9.282866e-001, 9.286424e-001, 9.289981e-001, 9.293538e-001, 9.297095e-001, 9.300611e-001, 9.303944e-001, 9.307277e-001, 9.310610e-001,
+9.313943e-001, 9.317277e-001, 9.320610e-001, 9.323943e-001, 9.327276e-001, 9.330609e-001, 9.333942e-001, 9.337275e-001, 9.340608e-001, 9.343942e-001,
+9.347275e-001, 9.350608e-001, 9.353941e-001, 9.357274e-001, 9.360607e-001, 9.363940e-001, 9.367273e-001, 9.370607e-001, 9.373940e-001, 9.377273e-001,
+9.380606e-001, 9.383939e-001, 9.387272e-001, 9.390605e-001, 9.393939e-001, 9.397272e-001, 9.400567e-001, 9.403690e-001, 9.406813e-001, 9.409937e-001,
+9.413060e-001, 9.416183e-001, 9.419306e-001, 9.422430e-001, 9.425553e-001, 9.428676e-001, 9.431800e-001, 9.434923e-001, 9.438046e-001, 9.441169e-001,
+9.444293e-001, 9.447416e-001, 9.450539e-001, 9.453663e-001, 9.456786e-001, 9.459909e-001, 9.463032e-001, 9.466156e-001, 9.469279e-001, 9.472402e-001,
+9.475526e-001, 9.478649e-001, 9.481772e-001, 9.484895e-001, 9.488019e-001, 9.491142e-001, 9.494265e-001, 9.497389e-001, 9.500480e-001, 9.503407e-001,
+9.506334e-001, 9.509260e-001, 9.512187e-001, 9.515114e-001, 9.518041e-001, 9.520968e-001, 9.523895e-001, 9.526822e-001, 9.529749e-001, 9.532676e-001,
+9.535603e-001, 9.538530e-001, 9.541457e-001, 9.544384e-001, 9.547310e-001, 9.550237e-001, 9.553164e-001, 9.556091e-001, 9.559018e-001, 9.561945e-001,
+9.564872e-001, 9.567799e-001, 9.570726e-001, 9.573653e-001, 9.576580e-001, 9.579507e-001, 9.582434e-001, 9.585361e-001, 9.588287e-001, 9.591214e-001,
+9.594141e-001, 9.597068e-001, 9.599995e-001, 9.602739e-001, 9.605482e-001, 9.608225e-001, 9.610969e-001, 9.613712e-001, 9.616456e-001, 9.619199e-001,
+9.621942e-001, 9.624686e-001, 9.627429e-001, 9.630172e-001, 9.632916e-001, 9.635659e-001, 9.638402e-001, 9.641146e-001, 9.643889e-001, 9.646632e-001,
+9.649376e-001, 9.652119e-001, 9.654862e-001, 9.657606e-001, 9.660349e-001, 9.663093e-001, 9.665836e-001, 9.668579e-001, 9.671323e-001, 9.674066e-001,
+9.676809e-001, 9.679553e-001, 9.682296e-001, 9.685039e-001, 9.687783e-001, 9.690526e-001, 9.693269e-001, 9.696013e-001, 9.698756e-001, 9.701406e-001,
+9.703978e-001, 9.706549e-001, 9.709121e-001, 9.711693e-001, 9.714265e-001, 9.716837e-001, 9.719409e-001, 9.721981e-001, 9.724552e-001, 9.727124e-001,
+9.729696e-001, 9.732268e-001, 9.734840e-001, 9.737412e-001, 9.739984e-001, 9.742556e-001, 9.745127e-001, 9.747699e-001, 9.750271e-001, 9.752843e-001,
+9.755415e-001, 9.757987e-001, 9.760559e-001, 9.763130e-001, 9.765702e-001, 9.768274e-001, 9.770846e-001, 9.773418e-001, 9.775990e-001, 9.778562e-001,
+9.781134e-001, 9.783705e-001, 9.786277e-001, 9.788849e-001, 9.791421e-001, 9.793993e-001, 9.796565e-001, 9.799137e-001, 9.801602e-001, 9.804014e-001,
+9.806426e-001, 9.808837e-001, 9.811249e-001, 9.813661e-001, 9.816073e-001, 9.818485e-001, 9.820896e-001, 9.823308e-001, 9.825720e-001, 9.828132e-001,
+9.830543e-001, 9.832955e-001, 9.835367e-001, 9.837779e-001, 9.840190e-001, 9.842602e-001, 9.845014e-001, 9.847426e-001, 9.849838e-001, 9.852249e-001,
+9.854661e-001, 9.857073e-001, 9.859485e-001, 9.861896e-001, 9.864308e-001, 9.866720e-001, 9.869132e-001, 9.871544e-001, 9.873955e-001, 9.876367e-001,
+9.878779e-001, 9.881191e-001, 9.883602e-001, 9.886014e-001, 9.888426e-001, 9.890838e-001, 9.893249e-001, 9.895661e-001, 9.898073e-001, 9.900455e-001,
+9.902717e-001, 9.904980e-001, 9.907242e-001, 9.909504e-001, 9.911767e-001, 9.914029e-001, 9.916292e-001, 9.918554e-001, 9.920816e-001, 9.923079e-001,
+9.925341e-001, 9.927603e-001, 9.929866e-001, 9.932128e-001, 9.934391e-001, 9.936653e-001, 9.938915e-001, 9.941178e-001, 9.943440e-001, 9.945703e-001,
+9.947965e-001, 9.950227e-001, 9.952490e-001, 9.954752e-001, 9.957015e-001, 9.959277e-001, 9.961539e-001, 9.963802e-001, 9.966064e-001, 9.968327e-001,
+9.970589e-001, 9.972851e-001, 9.975114e-001, 9.977376e-001, 9.979638e-001, 9.981901e-001, 9.984163e-001, 9.986426e-001, 9.988688e-001, 9.990950e-001,
+9.993213e-001, 9.995475e-001, 9.997738e-001, 1.000000e+000)),
+("Fujifilm", "FP2900Z", "mlab-lin-lin", True,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.503073e-004, 3.124702e-003, 6.588905e-003, 8.746619e-003, 1.088015e-002, 1.451628e-002, 1.937888e-002, 2.405569e-002, 2.858503e-002,
+3.306535e-002, 3.728120e-002, 4.101043e-002, 4.429453e-002, 4.748889e-002, 5.095953e-002, 5.512888e-002, 6.023445e-002, 6.578418e-002, 7.122873e-002,
+7.601876e-002, 7.970533e-002, 8.275394e-002, 8.541748e-002, 8.781794e-002, 9.007728e-002, 9.231746e-002, 9.466047e-002, 9.722826e-002, 1.001428e-001,
+1.034547e-001, 1.070738e-001, 1.109554e-001, 1.150562e-001, 1.193328e-001, 1.237417e-001, 1.282396e-001, 1.330090e-001, 1.381776e-001, 1.436399e-001,
+1.492906e-001, 1.550242e-001, 1.607353e-001, 1.663186e-001, 1.716686e-001, 1.766800e-001, 1.812472e-001, 1.853773e-001, 1.893155e-001, 1.930918e-001,
+1.967225e-001, 2.002238e-001, 2.036123e-001, 2.069043e-001, 2.101161e-001, 2.132641e-001, 2.163647e-001, 2.194342e-001, 2.224891e-001, 2.255457e-001,
+2.286203e-001, 2.317294e-001, 2.348893e-001, 2.381163e-001, 2.414057e-001, 2.446806e-001, 2.479368e-001, 2.511793e-001, 2.544131e-001, 2.576432e-001,
+2.608746e-001, 2.641122e-001, 2.673612e-001, 2.706264e-001, 2.739129e-001, 2.772257e-001, 2.805698e-001, 2.839502e-001, 2.874232e-001, 2.910543e-001,
+2.948203e-001, 2.986972e-001, 3.026611e-001, 3.066878e-001, 3.107535e-001, 3.148341e-001, 3.189056e-001, 3.229441e-001, 3.269254e-001, 3.308257e-001,
+3.346208e-001, 3.382869e-001, 3.417999e-001, 3.451357e-001, 3.482705e-001, 3.511802e-001, 3.538408e-001, 3.562283e-001, 3.583298e-001, 3.602797e-001,
+3.621290e-001, 3.638837e-001, 3.655497e-001, 3.671330e-001, 3.686398e-001, 3.700759e-001, 3.714475e-001, 3.727604e-001, 3.740208e-001, 3.752345e-001,
+3.764077e-001, 3.775463e-001, 3.786564e-001, 3.797440e-001, 3.808149e-001, 3.818754e-001, 3.829313e-001, 3.839888e-001, 3.850537e-001, 3.861321e-001,
+3.872301e-001, 3.883535e-001, 3.895085e-001, 3.907011e-001, 3.919371e-001, 3.932228e-001, 3.945640e-001, 3.959667e-001, 3.974371e-001, 3.989810e-001,
+4.006046e-001, 4.023137e-001, 4.041146e-001, 4.060754e-001, 4.082339e-001, 4.105701e-001, 4.130641e-001, 4.156960e-001, 4.184457e-001, 4.212932e-001,
+4.242187e-001, 4.272021e-001, 4.302235e-001, 4.332629e-001, 4.363003e-001, 4.393157e-001, 4.422893e-001, 4.452010e-001, 4.480309e-001, 4.507589e-001,
+4.533652e-001, 4.558297e-001, 4.581324e-001, 4.602535e-001, 4.622519e-001, 4.642115e-001, 4.661338e-001, 4.680200e-001, 4.698712e-001, 4.716887e-001,
+4.734738e-001, 4.752276e-001, 4.769513e-001, 4.786463e-001, 4.803136e-001, 4.819546e-001, 4.835704e-001, 4.851623e-001, 4.867315e-001, 4.882792e-001,
+4.898067e-001, 4.913151e-001, 4.928056e-001, 4.942796e-001, 4.957382e-001, 4.971827e-001, 4.986142e-001, 5.000340e-001, 5.014433e-001, 5.028433e-001,
+5.042353e-001, 5.056205e-001, 5.070000e-001, 5.083752e-001, 5.097472e-001, 5.111172e-001, 5.124866e-001, 5.138564e-001, 5.152280e-001, 5.166025e-001,
+5.179812e-001, 5.193653e-001, 5.207560e-001, 5.221545e-001, 5.235620e-001, 5.249799e-001, 5.264092e-001, 5.278513e-001, 5.293072e-001, 5.307784e-001,
+5.322659e-001, 5.337721e-001, 5.353027e-001, 5.368572e-001, 5.384340e-001, 5.400315e-001, 5.416481e-001, 5.432823e-001, 5.449323e-001, 5.465967e-001,
+5.482738e-001, 5.499621e-001, 5.516599e-001, 5.533656e-001, 5.550777e-001, 5.567945e-001, 5.585145e-001, 5.602361e-001, 5.619576e-001, 5.636775e-001,
+5.653942e-001, 5.671060e-001, 5.688114e-001, 5.705089e-001, 5.721967e-001, 5.738733e-001, 5.755371e-001, 5.771865e-001, 5.788200e-001, 5.804358e-001,
+5.820325e-001, 5.836084e-001, 5.851619e-001, 5.866915e-001, 5.881955e-001, 5.896724e-001, 5.911205e-001, 5.925383e-001, 5.939241e-001, 5.952764e-001,
+5.965935e-001, 5.978739e-001, 5.991160e-001, 6.003182e-001, 6.014789e-001, 6.025965e-001, 6.036693e-001, 6.046959e-001, 6.056745e-001, 6.066037e-001,
+6.074818e-001, 6.083072e-001, 6.090785e-001, 6.098169e-001, 6.105372e-001, 6.112401e-001, 6.119259e-001, 6.125950e-001, 6.132479e-001, 6.138850e-001,
+6.145066e-001, 6.151132e-001, 6.157053e-001, 6.162832e-001, 6.168473e-001, 6.173981e-001, 6.179361e-001, 6.184615e-001, 6.189749e-001, 6.194766e-001,
+6.199671e-001, 6.204468e-001, 6.209161e-001, 6.213754e-001, 6.218251e-001, 6.222657e-001, 6.226976e-001, 6.231212e-001, 6.235369e-001, 6.239451e-001,
+6.243463e-001, 6.247408e-001, 6.251292e-001, 6.255117e-001, 6.258889e-001, 6.262611e-001, 6.266288e-001, 6.269923e-001, 6.273522e-001, 6.277087e-001,
+6.280624e-001, 6.284137e-001, 6.287629e-001, 6.291105e-001, 6.294569e-001, 6.298025e-001, 6.301478e-001, 6.304932e-001, 6.308390e-001, 6.311857e-001,
+6.315337e-001, 6.318835e-001, 6.322354e-001, 6.325899e-001, 6.329474e-001, 6.333083e-001, 6.336730e-001, 6.340420e-001, 6.344156e-001, 6.347943e-001,
+6.351785e-001, 6.355686e-001, 6.359650e-001, 6.363682e-001, 6.367786e-001, 6.371966e-001, 6.376226e-001, 6.380570e-001, 6.385002e-001, 6.389527e-001,
+6.394149e-001, 6.398872e-001, 6.403700e-001, 6.408638e-001, 6.413689e-001, 6.418857e-001, 6.424148e-001, 6.429565e-001, 6.435112e-001, 6.440793e-001,
+6.446613e-001, 6.452576e-001, 6.458686e-001, 6.464947e-001, 6.471363e-001, 6.477939e-001, 6.484679e-001, 6.491587e-001, 6.498693e-001, 6.506213e-001,
+6.514184e-001, 6.522591e-001, 6.531424e-001, 6.540668e-001, 6.550312e-001, 6.560342e-001, 6.570746e-001, 6.581511e-001, 6.592624e-001, 6.604073e-001,
+6.615846e-001, 6.627929e-001, 6.640309e-001, 6.652974e-001, 6.665912e-001, 6.679109e-001, 6.692553e-001, 6.706232e-001, 6.720132e-001, 6.734240e-001,
+6.748545e-001, 6.763033e-001, 6.777692e-001, 6.792509e-001, 6.807471e-001, 6.822565e-001, 6.837780e-001, 6.853102e-001, 6.868518e-001, 6.884017e-001,
+6.899584e-001, 6.915208e-001, 6.930875e-001, 6.946574e-001, 6.962291e-001, 6.978013e-001, 6.993729e-001, 7.009424e-001, 7.025088e-001, 7.040706e-001,
+7.056266e-001, 7.071756e-001, 7.087163e-001, 7.102473e-001, 7.117675e-001, 7.132756e-001, 7.147703e-001, 7.162502e-001, 7.177143e-001, 7.191611e-001,
+7.205895e-001, 7.219981e-001, 7.233857e-001, 7.247510e-001, 7.260927e-001, 7.274097e-001, 7.287005e-001, 7.299639e-001, 7.311987e-001, 7.324036e-001,
+7.335774e-001, 7.347186e-001, 7.358262e-001, 7.368988e-001, 7.379351e-001, 7.389339e-001, 7.398939e-001, 7.408269e-001, 7.417528e-001, 7.426718e-001,
+7.435840e-001, 7.444894e-001, 7.453881e-001, 7.462803e-001, 7.471659e-001, 7.480451e-001, 7.489179e-001, 7.497844e-001, 7.506446e-001, 7.514987e-001,
+7.523467e-001, 7.531886e-001, 7.540247e-001, 7.548548e-001, 7.556791e-001, 7.564978e-001, 7.573107e-001, 7.581181e-001, 7.589199e-001, 7.597164e-001,
+7.605074e-001, 7.612932e-001, 7.620737e-001, 7.628491e-001, 7.636194e-001, 7.643847e-001, 7.651450e-001, 7.659006e-001, 7.666513e-001, 7.673973e-001,
+7.681386e-001, 7.688754e-001, 7.696077e-001, 7.703356e-001, 7.710591e-001, 7.717784e-001, 7.724934e-001, 7.732043e-001, 7.739112e-001, 7.746140e-001,
+7.753129e-001, 7.760080e-001, 7.766993e-001, 7.773869e-001, 7.780709e-001, 7.787514e-001, 7.794283e-001, 7.801019e-001, 7.807721e-001, 7.814390e-001,
+7.821028e-001, 7.827634e-001, 7.834210e-001, 7.840756e-001, 7.847273e-001, 7.853762e-001, 7.860223e-001, 7.866657e-001, 7.873066e-001, 7.879448e-001,
+7.885807e-001, 7.892141e-001, 7.898452e-001, 7.904740e-001, 7.911007e-001, 7.917253e-001, 7.923478e-001, 7.929684e-001, 7.935871e-001, 7.942040e-001,
+7.948191e-001, 7.954326e-001, 7.960445e-001, 7.966548e-001, 7.972637e-001, 7.978712e-001, 7.984774e-001, 7.990824e-001, 7.996862e-001, 8.002890e-001,
+8.008907e-001, 8.014914e-001, 8.020913e-001, 8.026904e-001, 8.032888e-001, 8.038865e-001, 8.044837e-001, 8.050803e-001, 8.056765e-001, 8.062723e-001,
+8.068678e-001, 8.074631e-001, 8.080583e-001, 8.086534e-001, 8.092485e-001, 8.098437e-001, 8.104390e-001, 8.110345e-001, 8.116303e-001, 8.122265e-001,
+8.128219e-001, 8.134156e-001, 8.140076e-001, 8.145981e-001, 8.151868e-001, 8.157740e-001, 8.163595e-001, 8.169434e-001, 8.175257e-001, 8.181065e-001,
+8.186856e-001, 8.192632e-001, 8.198393e-001, 8.204138e-001, 8.209868e-001, 8.215583e-001, 8.221282e-001, 8.226967e-001, 8.232637e-001, 8.238292e-001,
+8.243933e-001, 8.249559e-001, 8.255170e-001, 8.260768e-001, 8.266351e-001, 8.271920e-001, 8.277475e-001, 8.283016e-001, 8.288544e-001, 8.294058e-001,
+8.299558e-001, 8.305045e-001, 8.310519e-001, 8.315980e-001, 8.321427e-001, 8.326862e-001, 8.332284e-001, 8.337693e-001, 8.343089e-001, 8.348473e-001,
+8.353844e-001, 8.359203e-001, 8.364550e-001, 8.369885e-001, 8.375208e-001, 8.380519e-001, 8.385819e-001, 8.391106e-001, 8.396383e-001, 8.401647e-001,
+8.406901e-001, 8.412143e-001, 8.417374e-001, 8.422595e-001, 8.427804e-001, 8.433003e-001, 8.438191e-001, 8.443368e-001, 8.448536e-001, 8.453692e-001,
+8.458839e-001, 8.463976e-001, 8.469102e-001, 8.474219e-001, 8.479326e-001, 8.484423e-001, 8.489511e-001, 8.494589e-001, 8.499659e-001, 8.504719e-001,
+8.509769e-001, 8.514811e-001, 8.519844e-001, 8.524868e-001, 8.529884e-001, 8.534891e-001, 8.539890e-001, 8.544880e-001, 8.549862e-001, 8.554837e-001,
+8.559803e-001, 8.564761e-001, 8.569711e-001, 8.574654e-001, 8.579590e-001, 8.584517e-001, 8.589438e-001, 8.594351e-001, 8.599258e-001, 8.604157e-001,
+8.609050e-001, 8.613935e-001, 8.618814e-001, 8.623687e-001, 8.628553e-001, 8.633413e-001, 8.638266e-001, 8.643114e-001, 8.647955e-001, 8.652791e-001,
+8.657621e-001, 8.662445e-001, 8.667264e-001, 8.672077e-001, 8.676885e-001, 8.681688e-001, 8.686485e-001, 8.691278e-001, 8.696066e-001, 8.700849e-001,
+8.705627e-001, 8.710401e-001, 8.715170e-001, 8.719936e-001, 8.724696e-001, 8.729453e-001, 8.734206e-001, 8.738955e-001, 8.743700e-001, 8.748441e-001,
+8.753179e-001, 8.757914e-001, 8.762645e-001, 8.767373e-001, 8.772098e-001, 8.776820e-001, 8.781539e-001, 8.786255e-001, 8.790968e-001, 8.795679e-001,
+8.800388e-001, 8.805094e-001, 8.809798e-001, 8.814500e-001, 8.819200e-001, 8.823898e-001, 8.828594e-001, 8.833289e-001, 8.837982e-001, 8.842673e-001,
+8.847364e-001, 8.852053e-001, 8.856741e-001, 8.861428e-001, 8.866114e-001, 8.870799e-001, 8.875484e-001, 8.880168e-001, 8.884851e-001, 8.889534e-001,
+8.894217e-001, 8.898900e-001, 8.903583e-001, 8.908266e-001, 8.912950e-001, 8.917633e-001, 8.922317e-001, 8.927002e-001, 8.931687e-001, 8.936373e-001,
+8.941060e-001, 8.945748e-001, 8.950437e-001, 8.955127e-001, 8.959818e-001, 8.964511e-001, 8.969206e-001, 8.973902e-001, 8.978600e-001, 8.983300e-001,
+8.988001e-001, 8.992709e-001, 8.997430e-001, 9.002166e-001, 9.006915e-001, 9.011679e-001, 9.016455e-001, 9.021244e-001, 9.026045e-001, 9.030858e-001,
+9.035682e-001, 9.040518e-001, 9.045363e-001, 9.050219e-001, 9.055085e-001, 9.059960e-001, 9.064844e-001, 9.069736e-001, 9.074636e-001, 9.079544e-001,
+9.084459e-001, 9.089381e-001, 9.094309e-001, 9.099243e-001, 9.104183e-001, 9.109127e-001, 9.114076e-001, 9.119029e-001, 9.123987e-001, 9.128947e-001,
+9.133910e-001, 9.138876e-001, 9.143844e-001, 9.148814e-001, 9.153785e-001, 9.158757e-001, 9.163729e-001, 9.168701e-001, 9.173673e-001, 9.178644e-001,
+9.183613e-001, 9.188581e-001, 9.193547e-001, 9.198510e-001, 9.203470e-001, 9.208427e-001, 9.213380e-001, 9.218328e-001, 9.223272e-001, 9.228211e-001,
+9.233145e-001, 9.238072e-001, 9.242993e-001, 9.247907e-001, 9.252815e-001, 9.257714e-001, 9.262605e-001, 9.267488e-001, 9.272362e-001, 9.277227e-001,
+9.282082e-001, 9.286927e-001, 9.291761e-001, 9.296584e-001, 9.301396e-001, 9.306196e-001, 9.310984e-001, 9.315759e-001, 9.320520e-001, 9.325269e-001,
+9.330003e-001, 9.334723e-001, 9.339428e-001, 9.344118e-001, 9.348792e-001, 9.353450e-001, 9.358092e-001, 9.362716e-001, 9.367324e-001, 9.371913e-001,
+9.376485e-001, 9.381037e-001, 9.385571e-001, 9.390085e-001, 9.394579e-001, 9.399053e-001, 9.403507e-001, 9.407939e-001, 9.412349e-001, 9.416738e-001,
+9.421104e-001, 9.425447e-001, 9.429767e-001, 9.434064e-001, 9.438336e-001, 9.442584e-001, 9.446806e-001, 9.451004e-001, 9.455175e-001, 9.459320e-001,
+9.463439e-001, 9.467530e-001, 9.471595e-001, 9.475631e-001, 9.479638e-001, 9.483617e-001, 9.487567e-001, 9.491488e-001, 9.495378e-001, 9.499238e-001,
+9.503066e-001, 9.506864e-001, 9.510630e-001, 9.514363e-001, 9.518065e-001, 9.521733e-001, 9.525367e-001, 9.528968e-001, 9.532535e-001, 9.536067e-001,
+9.539564e-001, 9.543025e-001, 9.546450e-001, 9.549839e-001, 9.553192e-001, 9.556507e-001, 9.559784e-001, 9.563023e-001, 9.566224e-001, 9.569386e-001,
+9.572508e-001, 9.575591e-001, 9.578634e-001, 9.581636e-001, 9.584597e-001, 9.587516e-001, 9.590394e-001, 9.593229e-001, 9.596031e-001, 9.598833e-001,
+9.601637e-001, 9.604444e-001, 9.607254e-001, 9.610066e-001, 9.612881e-001, 9.615697e-001, 9.618515e-001, 9.621336e-001, 9.624157e-001, 9.626980e-001,
+9.629804e-001, 9.632630e-001, 9.635456e-001, 9.638283e-001, 9.641111e-001, 9.643939e-001, 9.646767e-001, 9.649596e-001, 9.652424e-001, 9.655252e-001,
+9.658080e-001, 9.660907e-001, 9.663734e-001, 9.666560e-001, 9.669384e-001, 9.672208e-001, 9.675030e-001, 9.677850e-001, 9.680669e-001, 9.683486e-001,
+9.686301e-001, 9.689114e-001, 9.691925e-001, 9.694733e-001, 9.697538e-001, 9.700341e-001, 9.703140e-001, 9.705936e-001, 9.708730e-001, 9.711519e-001,
+9.714305e-001, 9.717087e-001, 9.719865e-001, 9.722639e-001, 9.725409e-001, 9.728174e-001, 9.730935e-001, 9.733691e-001, 9.736442e-001, 9.739188e-001,
+9.741928e-001, 9.744664e-001, 9.747393e-001, 9.750117e-001, 9.752835e-001, 9.755547e-001, 9.758252e-001, 9.760951e-001, 9.763644e-001, 9.766330e-001,
+9.769009e-001, 9.771681e-001, 9.774345e-001, 9.777002e-001, 9.779652e-001, 9.782294e-001, 9.784928e-001, 9.787554e-001, 9.790172e-001, 9.792782e-001,
+9.795383e-001, 9.797975e-001, 9.800559e-001, 9.803133e-001, 9.805698e-001, 9.808254e-001, 9.810800e-001, 9.813337e-001, 9.815864e-001, 9.818381e-001,
+9.820888e-001, 9.823384e-001, 9.825870e-001, 9.828345e-001, 9.830810e-001, 9.833264e-001, 9.835706e-001, 9.838137e-001, 9.840557e-001, 9.842965e-001,
+9.845361e-001, 9.847745e-001, 9.850117e-001, 9.852477e-001, 9.854825e-001, 9.857160e-001, 9.859482e-001, 9.861791e-001, 9.864087e-001, 9.866370e-001,
+9.868639e-001, 9.870895e-001, 9.873137e-001, 9.875365e-001, 9.877579e-001, 9.879779e-001, 9.881965e-001, 9.884136e-001, 9.886292e-001, 9.888433e-001,
+9.890560e-001, 9.892671e-001, 9.894766e-001, 9.896847e-001, 9.898911e-001, 9.900960e-001, 9.902992e-001, 9.905009e-001, 9.907009e-001, 9.908992e-001,
+9.910959e-001, 9.912909e-001, 9.914842e-001, 9.916758e-001, 9.918657e-001, 9.920538e-001, 9.922401e-001, 9.924247e-001, 9.926075e-001, 9.927884e-001,
+9.929675e-001, 9.931448e-001, 9.933202e-001, 9.934938e-001, 9.936654e-001, 9.938351e-001, 9.940029e-001, 9.941688e-001, 9.943327e-001, 9.944946e-001,
+9.946545e-001, 9.948124e-001, 9.949683e-001, 9.951222e-001, 9.952740e-001, 9.954237e-001, 9.955713e-001, 9.957168e-001, 9.958602e-001, 9.960015e-001,
+9.961405e-001, 9.962775e-001, 9.964122e-001, 9.965447e-001, 9.966750e-001, 9.968031e-001, 9.969289e-001, 9.970525e-001, 9.971737e-001, 9.972927e-001,
+9.974093e-001, 9.975237e-001, 9.976356e-001, 9.977452e-001, 9.978524e-001, 9.979572e-001, 9.980596e-001, 9.981595e-001, 9.982570e-001, 9.983521e-001,
+9.984446e-001, 9.985347e-001, 9.986222e-001, 9.987072e-001, 9.987897e-001, 9.988696e-001, 9.989469e-001, 9.990216e-001, 9.990938e-001, 9.991632e-001,
+9.992301e-001, 9.992943e-001, 9.993558e-001, 9.994146e-001, 9.994707e-001, 9.995240e-001, 9.995747e-001, 9.996225e-001, 9.996676e-001, 9.997099e-001,
+9.997494e-001, 9.997861e-001, 9.998200e-001, 9.998509e-001, 9.998790e-001, 9.999042e-001, 9.999266e-001, 9.999459e-001, 9.999624e-001, 9.999759e-001,
+9.999864e-001, 9.999940e-001, 9.999985e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.048702e-003, 7.707007e-003, 9.376753e-003, 1.719946e-002, 2.716149e-002, 3.247967e-002, 3.654660e-002, 4.013934e-002, 4.310720e-002,
+4.485299e-002, 4.574788e-002, 4.651903e-002, 4.784008e-002, 5.102234e-002, 5.590575e-002, 6.161846e-002, 6.728865e-002, 7.246731e-002, 7.789587e-002,
+8.344635e-002, 8.891065e-002, 9.408062e-002, 9.879353e-002, 1.031831e-001, 1.073582e-001, 1.114075e-001, 1.154199e-001, 1.194841e-001, 1.236868e-001,
+1.279577e-001, 1.322295e-001, 1.365103e-001, 1.408081e-001, 1.451307e-001, 1.494862e-001, 1.538825e-001, 1.583276e-001, 1.628294e-001, 1.673960e-001,
+1.720409e-001, 1.768026e-001, 1.816648e-001, 1.866011e-001, 1.915850e-001, 1.965897e-001, 2.015890e-001, 2.065561e-001, 2.114646e-001, 2.164135e-001,
+2.215436e-001, 2.267997e-001, 2.321251e-001, 2.374628e-001, 2.427562e-001, 2.479483e-001, 2.529824e-001, 2.578017e-001, 2.623493e-001, 2.665685e-001,
+2.704024e-001, 2.737949e-001, 2.768654e-001, 2.797452e-001, 2.824517e-001, 2.850024e-001, 2.874149e-001, 2.897065e-001, 2.918949e-001, 2.939974e-001,
+2.960316e-001, 2.980149e-001, 2.999648e-001, 3.018989e-001, 3.038345e-001, 3.057892e-001, 3.077805e-001, 3.098259e-001, 3.119428e-001, 3.141488e-001,
+3.164612e-001, 3.188977e-001, 3.214756e-001, 3.242134e-001, 3.271134e-001, 3.301572e-001, 3.333253e-001, 3.365986e-001, 3.399577e-001, 3.433833e-001,
+3.468561e-001, 3.503567e-001, 3.538660e-001, 3.573646e-001, 3.608332e-001, 3.642525e-001, 3.676031e-001, 3.708658e-001, 3.740213e-001, 3.770503e-001,
+3.799623e-001, 3.828690e-001, 3.857801e-001, 3.886910e-001, 3.915975e-001, 3.944953e-001, 3.973798e-001, 4.002468e-001, 4.030919e-001, 4.059108e-001,
+4.086990e-001, 4.114522e-001, 4.141661e-001, 4.168362e-001, 4.194582e-001, 4.220278e-001, 4.245405e-001, 4.269920e-001, 4.293780e-001, 4.316940e-001,
+4.339357e-001, 4.360988e-001, 4.381788e-001, 4.401714e-001, 4.420722e-001, 4.438770e-001, 4.456013e-001, 4.472714e-001, 4.488897e-001, 4.504585e-001,
+4.519804e-001, 4.534576e-001, 4.548926e-001, 4.562878e-001, 4.576455e-001, 4.589682e-001, 4.602582e-001, 4.615180e-001, 4.627498e-001, 4.639562e-001,
+4.651395e-001, 4.663021e-001, 4.674464e-001, 4.685748e-001, 4.696896e-001, 4.707934e-001, 4.718883e-001, 4.729770e-001, 4.740617e-001, 4.751448e-001,
+4.762287e-001, 4.773159e-001, 4.784087e-001, 4.795095e-001, 4.806207e-001, 4.817446e-001, 4.828838e-001, 4.840405e-001, 4.852172e-001, 4.864163e-001,
+4.876401e-001, 4.888911e-001, 4.901716e-001, 4.914840e-001, 4.928307e-001, 4.942142e-001, 4.956367e-001, 4.971008e-001, 4.986090e-001, 5.001742e-001,
+5.017988e-001, 5.034782e-001, 5.052076e-001, 5.069822e-001, 5.087974e-001, 5.106484e-001, 5.125305e-001, 5.144390e-001, 5.163691e-001, 5.183160e-001,
+5.202752e-001, 5.222417e-001, 5.242110e-001, 5.261782e-001, 5.281387e-001, 5.300877e-001, 5.320205e-001, 5.339323e-001, 5.358185e-001, 5.376742e-001,
+5.394948e-001, 5.412756e-001, 5.430117e-001, 5.446985e-001, 5.463313e-001, 5.479233e-001, 5.495031e-001, 5.510712e-001, 5.526281e-001, 5.541737e-001,
+5.557085e-001, 5.572325e-001, 5.587461e-001, 5.602493e-001, 5.617425e-001, 5.632258e-001, 5.646996e-001, 5.661639e-001, 5.676190e-001, 5.690651e-001,
+5.705024e-001, 5.719312e-001, 5.733517e-001, 5.747640e-001, 5.761685e-001, 5.775652e-001, 5.789545e-001, 5.803365e-001, 5.817115e-001, 5.830797e-001,
+5.844413e-001, 5.857965e-001, 5.871455e-001, 5.884886e-001, 5.898259e-001, 5.911577e-001, 5.924842e-001, 5.938055e-001, 5.951221e-001, 5.964339e-001,
+5.977414e-001, 5.990446e-001, 6.003437e-001, 6.016391e-001, 6.029310e-001, 6.042194e-001, 6.055047e-001, 6.067871e-001, 6.080668e-001, 6.093440e-001,
+6.106189e-001, 6.118917e-001, 6.131627e-001, 6.144320e-001, 6.157000e-001, 6.169667e-001, 6.182325e-001, 6.194975e-001, 6.207619e-001, 6.220260e-001,
+6.232900e-001, 6.245541e-001, 6.258185e-001, 6.270835e-001, 6.283515e-001, 6.296306e-001, 6.309206e-001, 6.322209e-001, 6.335308e-001, 6.348495e-001,
+6.361764e-001, 6.375108e-001, 6.388520e-001, 6.401992e-001, 6.415519e-001, 6.429092e-001, 6.442705e-001, 6.456350e-001, 6.470022e-001, 6.483713e-001,
+6.497415e-001, 6.511122e-001, 6.524828e-001, 6.538524e-001, 6.552204e-001, 6.565861e-001, 6.579488e-001, 6.593079e-001, 6.606625e-001, 6.620120e-001,
+6.633557e-001, 6.646930e-001, 6.660230e-001, 6.673452e-001, 6.686588e-001, 6.699631e-001, 6.712574e-001, 6.725410e-001, 6.738132e-001, 6.750734e-001,
+6.763208e-001, 6.775547e-001, 6.787744e-001, 6.799793e-001, 6.811686e-001, 6.823416e-001, 6.834977e-001, 6.846361e-001, 6.857561e-001, 6.868570e-001,
+6.879382e-001, 6.889990e-001, 6.900386e-001, 6.910563e-001, 6.920515e-001, 6.930234e-001, 6.939713e-001, 6.948947e-001, 6.957926e-001, 6.966645e-001,
+6.975097e-001, 6.983275e-001, 6.991170e-001, 6.998778e-001, 7.006090e-001, 7.013100e-001, 7.019800e-001, 7.026184e-001, 7.032273e-001, 7.038218e-001,
+7.044045e-001, 7.049758e-001, 7.055358e-001, 7.060847e-001, 7.066228e-001, 7.071502e-001, 7.076672e-001, 7.081741e-001, 7.086710e-001, 7.091582e-001,
+7.096359e-001, 7.101043e-001, 7.105637e-001, 7.110142e-001, 7.114561e-001, 7.118896e-001, 7.123149e-001, 7.127323e-001, 7.131420e-001, 7.135442e-001,
+7.139391e-001, 7.143269e-001, 7.147079e-001, 7.150823e-001, 7.154504e-001, 7.158122e-001, 7.161681e-001, 7.165183e-001, 7.168631e-001, 7.172025e-001,
+7.175369e-001, 7.178665e-001, 7.181914e-001, 7.185120e-001, 7.188285e-001, 7.191410e-001, 7.194498e-001, 7.197551e-001, 7.200571e-001, 7.203561e-001,
+7.206523e-001, 7.209459e-001, 7.212371e-001, 7.215262e-001, 7.218134e-001, 7.220988e-001, 7.223828e-001, 7.226655e-001, 7.229471e-001, 7.232280e-001,
+7.235083e-001, 7.237882e-001, 7.240679e-001, 7.243478e-001, 7.246279e-001, 7.249086e-001, 7.251900e-001, 7.254724e-001, 7.257560e-001, 7.260410e-001,
+7.263276e-001, 7.266161e-001, 7.269067e-001, 7.271996e-001, 7.274951e-001, 7.277933e-001, 7.280944e-001, 7.283988e-001, 7.287066e-001, 7.290181e-001,
+7.293334e-001, 7.296528e-001, 7.299765e-001, 7.303048e-001, 7.306378e-001, 7.309758e-001, 7.313190e-001, 7.316676e-001, 7.320219e-001, 7.323821e-001,
+7.327484e-001, 7.331210e-001, 7.335001e-001, 7.338860e-001, 7.342789e-001, 7.346790e-001, 7.350866e-001, 7.355018e-001, 7.359248e-001, 7.363560e-001,
+7.367956e-001, 7.372436e-001, 7.377005e-001, 7.381663e-001, 7.386414e-001, 7.391259e-001, 7.396201e-001, 7.401241e-001, 7.406383e-001, 7.411628e-001,
+7.416979e-001, 7.422437e-001, 7.428005e-001, 7.433686e-001, 7.439481e-001, 7.445440e-001, 7.451735e-001, 7.458377e-001, 7.465357e-001, 7.472668e-001,
+7.480302e-001, 7.488251e-001, 7.496506e-001, 7.505061e-001, 7.513906e-001, 7.523034e-001, 7.532438e-001, 7.542108e-001, 7.552037e-001, 7.562218e-001,
+7.572642e-001, 7.583301e-001, 7.594187e-001, 7.605293e-001, 7.616610e-001, 7.628130e-001, 7.639846e-001, 7.651749e-001, 7.663832e-001, 7.676087e-001,
+7.688505e-001, 7.701079e-001, 7.713800e-001, 7.726661e-001, 7.739655e-001, 7.752771e-001, 7.766004e-001, 7.779345e-001, 7.792786e-001, 7.806319e-001,
+7.819936e-001, 7.833629e-001, 7.847390e-001, 7.861211e-001, 7.875085e-001, 7.889003e-001, 7.902957e-001, 7.916940e-001, 7.930943e-001, 7.944959e-001,
+7.958979e-001, 7.972996e-001, 7.987001e-001, 8.000987e-001, 8.014946e-001, 8.028869e-001, 8.042749e-001, 8.056578e-001, 8.070348e-001, 8.084051e-001,
+8.097679e-001, 8.111224e-001, 8.124678e-001, 8.138033e-001, 8.151281e-001, 8.164414e-001, 8.177425e-001, 8.190305e-001, 8.203046e-001, 8.215640e-001,
+8.228080e-001, 8.240358e-001, 8.252465e-001, 8.264393e-001, 8.276135e-001, 8.287683e-001, 8.299028e-001, 8.310164e-001, 8.321081e-001, 8.331771e-001,
+8.342228e-001, 8.352442e-001, 8.362407e-001, 8.372113e-001, 8.381554e-001, 8.390720e-001, 8.399605e-001, 8.408200e-001, 8.416497e-001, 8.424488e-001,
+8.432167e-001, 8.439699e-001, 8.447198e-001, 8.454665e-001, 8.462099e-001, 8.469501e-001, 8.476870e-001, 8.484207e-001, 8.491511e-001, 8.498782e-001,
+8.506021e-001, 8.513227e-001, 8.520401e-001, 8.527541e-001, 8.534649e-001, 8.541724e-001, 8.548767e-001, 8.555776e-001, 8.562753e-001, 8.569697e-001,
+8.576608e-001, 8.583486e-001, 8.590331e-001, 8.597143e-001, 8.603922e-001, 8.610668e-001, 8.617381e-001, 8.624061e-001, 8.630708e-001, 8.637322e-001,
+8.643902e-001, 8.650450e-001, 8.656964e-001, 8.663445e-001, 8.669893e-001, 8.676308e-001, 8.682689e-001, 8.689037e-001, 8.695351e-001, 8.701633e-001,
+8.707881e-001, 8.714095e-001, 8.720276e-001, 8.726424e-001, 8.732538e-001, 8.738619e-001, 8.744666e-001, 8.750680e-001, 8.756660e-001, 8.762606e-001,
+8.768519e-001, 8.774398e-001, 8.780244e-001, 8.786056e-001, 8.791834e-001, 8.797578e-001, 8.803289e-001, 8.808965e-001, 8.814608e-001, 8.820218e-001,
+8.825793e-001, 8.831334e-001, 8.836842e-001, 8.842315e-001, 8.847755e-001, 8.853161e-001, 8.858532e-001, 8.863870e-001, 8.869173e-001, 8.874443e-001,
+8.879678e-001, 8.884879e-001, 8.890047e-001, 8.895179e-001, 8.900278e-001, 8.905343e-001, 8.910373e-001, 8.915369e-001, 8.920330e-001, 8.925258e-001,
+8.930151e-001, 8.935009e-001, 8.939834e-001, 8.944623e-001, 8.949379e-001, 8.954100e-001, 8.958786e-001, 8.963438e-001, 8.968055e-001, 8.972638e-001,
+8.977186e-001, 8.981700e-001, 8.986179e-001, 8.990623e-001, 8.995033e-001, 8.999408e-001, 9.003748e-001, 9.008053e-001, 9.012324e-001, 9.016560e-001,
+9.020761e-001, 9.024927e-001, 9.029058e-001, 9.033155e-001, 9.037216e-001, 9.041243e-001, 9.045234e-001, 9.049191e-001, 9.053112e-001, 9.056999e-001,
+9.060850e-001, 9.064666e-001, 9.068448e-001, 9.072194e-001, 9.075905e-001, 9.079580e-001, 9.083221e-001, 9.086826e-001, 9.090396e-001, 9.093931e-001,
+9.097430e-001, 9.100894e-001, 9.104323e-001, 9.107716e-001, 9.111074e-001, 9.114396e-001, 9.117683e-001, 9.120935e-001, 9.124151e-001, 9.127336e-001,
+9.130501e-001, 9.133645e-001, 9.136769e-001, 9.139873e-001, 9.142957e-001, 9.146021e-001, 9.149065e-001, 9.152090e-001, 9.155095e-001, 9.158081e-001,
+9.161048e-001, 9.163996e-001, 9.166926e-001, 9.169837e-001, 9.172729e-001, 9.175603e-001, 9.178459e-001, 9.181297e-001, 9.184117e-001, 9.186919e-001,
+9.189704e-001, 9.192472e-001, 9.195222e-001, 9.197955e-001, 9.200672e-001, 9.203371e-001, 9.206054e-001, 9.208721e-001, 9.211371e-001, 9.214005e-001,
+9.216623e-001, 9.219225e-001, 9.221812e-001, 9.224383e-001, 9.226939e-001, 9.229479e-001, 9.232005e-001, 9.234515e-001, 9.237011e-001, 9.239492e-001,
+9.241959e-001, 9.244412e-001, 9.246850e-001, 9.249275e-001, 9.251685e-001, 9.254082e-001, 9.256466e-001, 9.258836e-001, 9.261192e-001, 9.263536e-001,
+9.265867e-001, 9.268185e-001, 9.270491e-001, 9.272784e-001, 9.275065e-001, 9.277334e-001, 9.279591e-001, 9.281836e-001, 9.284069e-001, 9.286291e-001,
+9.288501e-001, 9.290701e-001, 9.292889e-001, 9.295066e-001, 9.297233e-001, 9.299389e-001, 9.301535e-001, 9.303670e-001, 9.305795e-001, 9.307911e-001,
+9.310016e-001, 9.312112e-001, 9.314198e-001, 9.316275e-001, 9.318343e-001, 9.320402e-001, 9.322452e-001, 9.324493e-001, 9.326526e-001, 9.328550e-001,
+9.330566e-001, 9.332574e-001, 9.334574e-001, 9.336566e-001, 9.338550e-001, 9.340527e-001, 9.342497e-001, 9.344459e-001, 9.346415e-001, 9.348363e-001,
+9.350305e-001, 9.352240e-001, 9.354169e-001, 9.356092e-001, 9.358008e-001, 9.359919e-001, 9.361824e-001, 9.363723e-001, 9.365616e-001, 9.367505e-001,
+9.369388e-001, 9.371266e-001, 9.373139e-001, 9.375008e-001, 9.376872e-001, 9.378731e-001, 9.380587e-001, 9.382438e-001, 9.384285e-001, 9.386129e-001,
+9.387969e-001, 9.389805e-001, 9.391639e-001, 9.393469e-001, 9.395295e-001, 9.397120e-001, 9.398941e-001, 9.400760e-001, 9.402576e-001, 9.404391e-001,
+9.406203e-001, 9.408013e-001, 9.409821e-001, 9.411628e-001, 9.413434e-001, 9.415238e-001, 9.417040e-001, 9.418842e-001, 9.420643e-001, 9.422444e-001,
+9.424244e-001, 9.426043e-001, 9.427842e-001, 9.429641e-001, 9.431440e-001, 9.433240e-001, 9.435040e-001, 9.436840e-001, 9.438641e-001, 9.440443e-001,
+9.442246e-001, 9.444050e-001, 9.445855e-001, 9.447662e-001, 9.449470e-001, 9.451281e-001, 9.453093e-001, 9.454907e-001, 9.456724e-001, 9.458542e-001,
+9.460364e-001, 9.462188e-001, 9.464015e-001, 9.465845e-001, 9.467678e-001, 9.469515e-001, 9.471355e-001, 9.473198e-001, 9.475045e-001, 9.476897e-001,
+9.478752e-001, 9.480612e-001, 9.482476e-001, 9.484344e-001, 9.486218e-001, 9.488096e-001, 9.489979e-001, 9.491868e-001, 9.493761e-001, 9.495660e-001,
+9.497565e-001, 9.499476e-001, 9.501392e-001, 9.503315e-001, 9.505244e-001, 9.507179e-001, 9.509121e-001, 9.511070e-001, 9.513025e-001, 9.514988e-001,
+9.516957e-001, 9.518934e-001, 9.520919e-001, 9.522911e-001, 9.524911e-001, 9.526919e-001, 9.528935e-001, 9.530959e-001, 9.532992e-001, 9.535033e-001,
+9.537083e-001, 9.539142e-001, 9.541210e-001, 9.543287e-001, 9.545373e-001, 9.547469e-001, 9.549575e-001, 9.551690e-001, 9.553815e-001, 9.555951e-001,
+9.558096e-001, 9.560252e-001, 9.562419e-001, 9.564597e-001, 9.566785e-001, 9.568984e-001, 9.571195e-001, 9.573417e-001, 9.575650e-001, 9.577895e-001,
+9.580152e-001, 9.582421e-001, 9.584702e-001, 9.586990e-001, 9.589279e-001, 9.591571e-001, 9.593864e-001, 9.596159e-001, 9.598456e-001, 9.600755e-001,
+9.603056e-001, 9.605358e-001, 9.607662e-001, 9.609969e-001, 9.612277e-001, 9.614587e-001, 9.616898e-001, 9.619212e-001, 9.621527e-001, 9.623845e-001,
+9.626164e-001, 9.628484e-001, 9.630807e-001, 9.633131e-001, 9.635458e-001, 9.637786e-001, 9.640115e-001, 9.642447e-001, 9.644780e-001, 9.647116e-001,
+9.649453e-001, 9.651791e-001, 9.654132e-001, 9.656474e-001, 9.658818e-001, 9.661164e-001, 9.663511e-001, 9.665860e-001, 9.668211e-001, 9.670564e-001,
+9.672919e-001, 9.675275e-001, 9.677633e-001, 9.679992e-001, 9.682354e-001, 9.684717e-001, 9.687082e-001, 9.689448e-001, 9.691816e-001, 9.694186e-001,
+9.696558e-001, 9.698931e-001, 9.701306e-001, 9.703683e-001, 9.706061e-001, 9.708441e-001, 9.710823e-001, 9.713206e-001, 9.715592e-001, 9.717978e-001,
+9.720367e-001, 9.722757e-001, 9.725148e-001, 9.727542e-001, 9.729937e-001, 9.732333e-001, 9.734732e-001, 9.737132e-001, 9.739533e-001, 9.741936e-001,
+9.744341e-001, 9.746747e-001, 9.749155e-001, 9.751565e-001, 9.753976e-001, 9.756389e-001, 9.758804e-001, 9.761220e-001, 9.763637e-001, 9.766056e-001,
+9.768477e-001, 9.770899e-001, 9.773323e-001, 9.775749e-001, 9.778176e-001, 9.780605e-001, 9.783035e-001, 9.785467e-001, 9.787900e-001, 9.790335e-001,
+9.792771e-001, 9.795209e-001, 9.797649e-001, 9.800090e-001, 9.802532e-001, 9.804976e-001, 9.807422e-001, 9.809869e-001, 9.812318e-001, 9.814768e-001,
+9.817219e-001, 9.819673e-001, 9.822127e-001, 9.824583e-001, 9.827041e-001, 9.829500e-001, 9.831961e-001, 9.834423e-001, 9.836886e-001, 9.839351e-001,
+9.841818e-001, 9.844286e-001, 9.846755e-001, 9.849226e-001, 9.851698e-001, 9.854172e-001, 9.856647e-001, 9.859124e-001, 9.861602e-001, 9.864082e-001,
+9.866563e-001, 9.869045e-001, 9.871529e-001, 9.874014e-001, 9.876501e-001, 9.878989e-001, 9.881478e-001, 9.883969e-001, 9.886462e-001, 9.888955e-001,
+9.891450e-001, 9.893947e-001, 9.896445e-001, 9.898944e-001, 9.901444e-001, 9.903946e-001, 9.906450e-001, 9.908954e-001, 9.911460e-001, 9.913968e-001,
+9.916477e-001, 9.918987e-001, 9.921498e-001, 9.924011e-001, 9.926525e-001, 9.929041e-001, 9.931557e-001, 9.934075e-001, 9.936595e-001, 9.939116e-001,
+9.941638e-001, 9.944161e-001, 9.946686e-001, 9.949212e-001, 9.951739e-001, 9.954268e-001, 9.956798e-001, 9.959329e-001, 9.961861e-001, 9.964395e-001,
+9.966930e-001, 9.969466e-001, 9.972004e-001, 9.974543e-001, 9.977083e-001, 9.979624e-001, 9.982167e-001, 9.984711e-001, 9.987256e-001, 9.989802e-001,
+9.992350e-001, 9.994899e-001, 9.997449e-001, 1.000000e+000),
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 6.400244e-003, 8.480709e-003, 9.261481e-003, 1.015356e-002, 1.095911e-002, 1.172382e-002, 1.249670e-002, 1.332676e-002, 1.426302e-002,
+1.535448e-002, 1.665015e-002, 1.834840e-002, 2.080992e-002, 2.383382e-002, 2.718461e-002, 3.076293e-002, 3.496127e-002, 3.966712e-002, 4.469689e-002,
+4.986699e-002, 5.499381e-002, 5.989378e-002, 6.461805e-002, 6.956528e-002, 7.449549e-002, 7.913332e-002, 8.320341e-002, 8.644672e-002, 8.907498e-002,
+9.132950e-002, 9.332554e-002, 9.517836e-002, 9.700322e-002, 9.891537e-002, 1.010301e-001, 1.034626e-001, 1.061729e-001, 1.090466e-001, 1.120758e-001,
+1.152525e-001, 1.185686e-001, 1.220162e-001, 1.255874e-001, 1.292741e-001, 1.330683e-001, 1.369620e-001, 1.409474e-001, 1.450163e-001, 1.491608e-001,
+1.533937e-001, 1.579982e-001, 1.629923e-001, 1.682806e-001, 1.737676e-001, 1.793580e-001, 1.849561e-001, 1.904667e-001, 1.957941e-001, 2.008430e-001,
+2.055179e-001, 2.097504e-001, 2.138120e-001, 2.177951e-001, 2.216964e-001, 2.255128e-001, 2.292410e-001, 2.328778e-001, 2.364201e-001, 2.398646e-001,
+2.432081e-001, 2.464474e-001, 2.495793e-001, 2.526006e-001, 2.555082e-001, 2.582987e-001, 2.609690e-001, 2.635160e-001, 2.659430e-001, 2.682637e-001,
+2.704858e-001, 2.726169e-001, 2.746646e-001, 2.766366e-001, 2.785406e-001, 2.803841e-001, 2.821749e-001, 2.839205e-001, 2.856287e-001, 2.873070e-001,
+2.889631e-001, 2.906046e-001, 2.922393e-001, 2.938747e-001, 2.955184e-001, 2.971782e-001, 2.988617e-001, 3.005765e-001, 3.023302e-001, 3.041305e-001,
+3.059851e-001, 3.079016e-001, 3.098876e-001, 3.119508e-001, 3.140988e-001, 3.163442e-001, 3.187193e-001, 3.212150e-001, 3.238150e-001, 3.265029e-001,
+3.292626e-001, 3.320776e-001, 3.349316e-001, 3.378083e-001, 3.406915e-001, 3.435647e-001, 3.464117e-001, 3.492162e-001, 3.519618e-001, 3.546323e-001,
+3.572112e-001, 3.596824e-001, 3.620485e-001, 3.643789e-001, 3.666826e-001, 3.689603e-001, 3.712130e-001, 3.734416e-001, 3.756470e-001, 3.778301e-001,
+3.799916e-001, 3.821327e-001, 3.842540e-001, 3.863566e-001, 3.884412e-001, 3.905089e-001, 3.925604e-001, 3.945968e-001, 3.966187e-001, 3.986273e-001,
+4.006232e-001, 4.026075e-001, 4.045811e-001, 4.065447e-001, 4.084993e-001, 4.104458e-001, 4.123851e-001, 4.143181e-001, 4.162456e-001, 4.181686e-001,
+4.200878e-001, 4.220044e-001, 4.239190e-001, 4.258326e-001, 4.277462e-001, 4.296605e-001, 4.315764e-001, 4.334950e-001, 4.354170e-001, 4.373433e-001,
+4.392807e-001, 4.412496e-001, 4.432490e-001, 4.452759e-001, 4.473274e-001, 4.494006e-001, 4.514926e-001, 4.536005e-001, 4.557212e-001, 4.578520e-001,
+4.599898e-001, 4.621317e-001, 4.642749e-001, 4.664163e-001, 4.685531e-001, 4.706822e-001, 4.728009e-001, 4.749062e-001, 4.769951e-001, 4.790647e-001,
+4.811121e-001, 4.831344e-001, 4.851285e-001, 4.870917e-001, 4.890210e-001, 4.909134e-001, 4.927660e-001, 4.945759e-001, 4.963402e-001, 4.980559e-001,
+4.997202e-001, 5.013300e-001, 5.028825e-001, 5.043747e-001, 5.058037e-001, 5.071665e-001, 5.084603e-001, 5.096822e-001, 5.108291e-001, 5.118982e-001,
+5.128865e-001, 5.137988e-001, 5.146776e-001, 5.155304e-001, 5.163580e-001, 5.171612e-001, 5.179406e-001, 5.186971e-001, 5.194314e-001, 5.201442e-001,
+5.208364e-001, 5.215086e-001, 5.221616e-001, 5.227962e-001, 5.234131e-001, 5.240131e-001, 5.245970e-001, 5.251654e-001, 5.257192e-001, 5.262590e-001,
+5.267857e-001, 5.273000e-001, 5.278027e-001, 5.282945e-001, 5.287762e-001, 5.292484e-001, 5.297121e-001, 5.301678e-001, 5.306165e-001, 5.310588e-001,
+5.314955e-001, 5.319273e-001, 5.323550e-001, 5.327794e-001, 5.332012e-001, 5.336211e-001, 5.340399e-001, 5.344585e-001, 5.348774e-001, 5.352975e-001,
+5.357196e-001, 5.361443e-001, 5.365725e-001, 5.370048e-001, 5.374421e-001, 5.378851e-001, 5.383346e-001, 5.387913e-001, 5.392559e-001, 5.397292e-001,
+5.402121e-001, 5.407051e-001, 5.412091e-001, 5.417249e-001, 5.422531e-001, 5.427946e-001, 5.433501e-001, 5.439203e-001, 5.445060e-001, 5.451080e-001,
+5.457270e-001, 5.463637e-001, 5.470190e-001, 5.476935e-001, 5.483881e-001, 5.491035e-001, 5.498403e-001, 5.505995e-001, 5.513817e-001, 5.521877e-001,
+5.530344e-001, 5.539387e-001, 5.548986e-001, 5.559120e-001, 5.569766e-001, 5.580904e-001, 5.592513e-001, 5.604572e-001, 5.617059e-001, 5.629952e-001,
+5.643232e-001, 5.656876e-001, 5.670864e-001, 5.685173e-001, 5.699784e-001, 5.714674e-001, 5.729822e-001, 5.745208e-001, 5.760810e-001, 5.776606e-001,
+5.792576e-001, 5.808698e-001, 5.824952e-001, 5.841315e-001, 5.857766e-001, 5.874286e-001, 5.890851e-001, 5.907441e-001, 5.924035e-001, 5.940611e-001,
+5.957149e-001, 5.973627e-001, 5.990023e-001, 6.006317e-001, 6.022487e-001, 6.038513e-001, 6.054372e-001, 6.070044e-001, 6.085508e-001, 6.100741e-001,
+6.115724e-001, 6.130434e-001, 6.144851e-001, 6.158953e-001, 6.172720e-001, 6.186129e-001, 6.199159e-001, 6.211791e-001, 6.224001e-001, 6.235769e-001,
+6.247074e-001, 6.257894e-001, 6.268209e-001, 6.277997e-001, 6.287240e-001, 6.296195e-001, 6.305025e-001, 6.313733e-001, 6.322320e-001, 6.330790e-001,
+6.339144e-001, 6.347385e-001, 6.355516e-001, 6.363538e-001, 6.371454e-001, 6.379266e-001, 6.386977e-001, 6.394590e-001, 6.402105e-001, 6.409527e-001,
+6.416856e-001, 6.424096e-001, 6.431249e-001, 6.438317e-001, 6.445303e-001, 6.452208e-001, 6.459036e-001, 6.465789e-001, 6.472468e-001, 6.479077e-001,
+6.485617e-001, 6.492091e-001, 6.498502e-001, 6.504852e-001, 6.511142e-001, 6.517376e-001, 6.523556e-001, 6.529684e-001, 6.535763e-001, 6.541794e-001,
+6.547781e-001, 6.553725e-001, 6.559629e-001, 6.565496e-001, 6.571327e-001, 6.577125e-001, 6.582892e-001, 6.588631e-001, 6.594344e-001, 6.600034e-001,
+6.605702e-001, 6.611352e-001, 6.616984e-001, 6.622603e-001, 6.628210e-001, 6.633808e-001, 6.639398e-001, 6.644984e-001, 6.650567e-001, 6.656150e-001,
+6.661736e-001, 6.667326e-001, 6.672923e-001, 6.678530e-001, 6.684148e-001, 6.689780e-001, 6.695429e-001, 6.701097e-001, 6.706785e-001, 6.712498e-001,
+6.718236e-001, 6.724002e-001, 6.729799e-001, 6.735629e-001, 6.741494e-001, 6.747397e-001, 6.753340e-001, 6.759325e-001, 6.765354e-001, 6.771431e-001,
+6.777558e-001, 6.783736e-001, 6.789968e-001, 6.796256e-001, 6.802604e-001, 6.809012e-001, 6.815484e-001, 6.821989e-001, 6.828477e-001, 6.834948e-001,
+6.841401e-001, 6.847838e-001, 6.854260e-001, 6.860665e-001, 6.867056e-001, 6.873432e-001, 6.879793e-001, 6.886141e-001, 6.892475e-001, 6.898796e-001,
+6.905105e-001, 6.911401e-001, 6.917686e-001, 6.923959e-001, 6.930221e-001, 6.936473e-001, 6.942714e-001, 6.948946e-001, 6.955169e-001, 6.961382e-001,
+6.967588e-001, 6.973785e-001, 6.979975e-001, 6.986158e-001, 6.992333e-001, 6.998503e-001, 7.004667e-001, 7.010825e-001, 7.016978e-001, 7.023126e-001,
+7.029271e-001, 7.035411e-001, 7.041548e-001, 7.047682e-001, 7.053814e-001, 7.059943e-001, 7.066071e-001, 7.072197e-001, 7.078323e-001, 7.084448e-001,
+7.090573e-001, 7.096699e-001, 7.102825e-001, 7.108953e-001, 7.115082e-001, 7.121213e-001, 7.127347e-001, 7.133484e-001, 7.139624e-001, 7.145768e-001,
+7.151916e-001, 7.158069e-001, 7.164226e-001, 7.170390e-001, 7.176559e-001, 7.182734e-001, 7.188916e-001, 7.195105e-001, 7.201302e-001, 7.207506e-001,
+7.213719e-001, 7.219941e-001, 7.226172e-001, 7.232413e-001, 7.238664e-001, 7.244925e-001, 7.251197e-001, 7.257481e-001, 7.263776e-001, 7.270083e-001,
+7.276403e-001, 7.282736e-001, 7.289083e-001, 7.295443e-001, 7.301818e-001, 7.308207e-001, 7.314611e-001, 7.321031e-001, 7.327467e-001, 7.333919e-001,
+7.340388e-001, 7.346874e-001, 7.353378e-001, 7.359900e-001, 7.366440e-001, 7.373000e-001, 7.379578e-001, 7.386177e-001, 7.392795e-001, 7.399434e-001,
+7.406094e-001, 7.412776e-001, 7.419479e-001, 7.426204e-001, 7.432953e-001, 7.439724e-001, 7.446519e-001, 7.453337e-001, 7.460181e-001, 7.467048e-001,
+7.473942e-001, 7.480860e-001, 7.487805e-001, 7.494776e-001, 7.501774e-001, 7.508800e-001, 7.515853e-001, 7.522934e-001, 7.530044e-001, 7.537182e-001,
+7.544351e-001, 7.551549e-001, 7.558777e-001, 7.566036e-001, 7.573326e-001, 7.580647e-001, 7.588001e-001, 7.595386e-001, 7.602805e-001, 7.610256e-001,
+7.617742e-001, 7.625261e-001, 7.632815e-001, 7.640403e-001, 7.648027e-001, 7.655687e-001, 7.663382e-001, 7.671115e-001, 7.678884e-001, 7.686690e-001,
+7.694535e-001, 7.702417e-001, 7.710339e-001, 7.718299e-001, 7.726337e-001, 7.734528e-001, 7.742872e-001, 7.751365e-001, 7.760005e-001, 7.768787e-001,
+7.777708e-001, 7.786765e-001, 7.795955e-001, 7.805274e-001, 7.814719e-001, 7.824286e-001, 7.833972e-001, 7.843774e-001, 7.853689e-001, 7.863712e-001,
+7.873841e-001, 7.884072e-001, 7.894402e-001, 7.904827e-001, 7.915345e-001, 7.925951e-001, 7.936643e-001, 7.947416e-001, 7.958269e-001, 7.969196e-001,
+7.980196e-001, 7.991264e-001, 8.002397e-001, 8.013592e-001, 8.024845e-001, 8.036153e-001, 8.047513e-001, 8.058922e-001, 8.070375e-001, 8.081870e-001,
+8.093403e-001, 8.104971e-001, 8.116571e-001, 8.128198e-001, 8.139850e-001, 8.151524e-001, 8.163216e-001, 8.174922e-001, 8.186639e-001, 8.198365e-001,
+8.210095e-001, 8.221826e-001, 8.233554e-001, 8.245278e-001, 8.256992e-001, 8.268694e-001, 8.280380e-001, 8.292047e-001, 8.303692e-001, 8.315311e-001,
+8.326901e-001, 8.338458e-001, 8.349979e-001, 8.361461e-001, 8.372901e-001, 8.384294e-001, 8.395638e-001, 8.406929e-001, 8.418164e-001, 8.429340e-001,
+8.440452e-001, 8.451499e-001, 8.462476e-001, 8.473380e-001, 8.484207e-001, 8.494955e-001, 8.505620e-001, 8.516198e-001, 8.526687e-001, 8.537082e-001,
+8.547381e-001, 8.557580e-001, 8.567675e-001, 8.577664e-001, 8.587543e-001, 8.597308e-001, 8.606957e-001, 8.616485e-001, 8.625890e-001, 8.635169e-001,
+8.644316e-001, 8.653331e-001, 8.662208e-001, 8.670945e-001, 8.679538e-001, 8.687984e-001, 8.696280e-001, 8.704422e-001, 8.712406e-001, 8.720230e-001,
+8.727890e-001, 8.735383e-001, 8.742705e-001, 8.749853e-001, 8.756824e-001, 8.763614e-001, 8.770220e-001, 8.776638e-001, 8.782865e-001, 8.788898e-001,
+8.794734e-001, 8.800368e-001, 8.805798e-001, 8.811022e-001, 8.816139e-001, 8.821214e-001, 8.826246e-001, 8.831236e-001, 8.836185e-001, 8.841091e-001,
+8.845957e-001, 8.850782e-001, 8.855567e-001, 8.860313e-001, 8.865018e-001, 8.869685e-001, 8.874313e-001, 8.878902e-001, 8.883454e-001, 8.887968e-001,
+8.892445e-001, 8.896885e-001, 8.901289e-001, 8.905657e-001, 8.909990e-001, 8.914287e-001, 8.918549e-001, 8.922777e-001, 8.926970e-001, 8.931130e-001,
+8.935257e-001, 8.939351e-001, 8.943412e-001, 8.947441e-001, 8.951439e-001, 8.955405e-001, 8.959340e-001, 8.963244e-001, 8.967118e-001, 8.970963e-001,
+8.974778e-001, 8.978564e-001, 8.982321e-001, 8.986050e-001, 8.989751e-001, 8.993424e-001, 8.997071e-001, 9.000691e-001, 9.004284e-001, 9.007851e-001,
+9.011393e-001, 9.014909e-001, 9.018401e-001, 9.021868e-001, 9.025312e-001, 9.028731e-001, 9.032128e-001, 9.035501e-001, 9.038852e-001, 9.042181e-001,
+9.045488e-001, 9.048773e-001, 9.052038e-001, 9.055282e-001, 9.058506e-001, 9.061710e-001, 9.064895e-001, 9.068061e-001, 9.071208e-001, 9.074337e-001,
+9.077448e-001, 9.080541e-001, 9.083617e-001, 9.086677e-001, 9.089720e-001, 9.092747e-001, 9.095759e-001, 9.098756e-001, 9.101737e-001, 9.104705e-001,
+9.107658e-001, 9.110597e-001, 9.113524e-001, 9.116437e-001, 9.119338e-001, 9.122227e-001, 9.125104e-001, 9.127970e-001, 9.130825e-001, 9.133670e-001,
+9.136504e-001, 9.139328e-001, 9.142143e-001, 9.144949e-001, 9.147746e-001, 9.150535e-001, 9.153317e-001, 9.156090e-001, 9.158857e-001, 9.161617e-001,
+9.164371e-001, 9.167118e-001, 9.169860e-001, 9.172597e-001, 9.175330e-001, 9.178057e-001, 9.180781e-001, 9.183501e-001, 9.186218e-001, 9.188932e-001,
+9.191644e-001, 9.194353e-001, 9.197061e-001, 9.199768e-001, 9.202473e-001, 9.205178e-001, 9.207883e-001, 9.210588e-001, 9.213294e-001, 9.216001e-001,
+9.218709e-001, 9.221419e-001, 9.224131e-001, 9.226845e-001, 9.229563e-001, 9.232284e-001, 9.235008e-001, 9.237737e-001, 9.240470e-001, 9.243208e-001,
+9.245951e-001, 9.248699e-001, 9.251454e-001, 9.254215e-001, 9.256983e-001, 9.259758e-001, 9.262541e-001, 9.265332e-001, 9.268131e-001, 9.270938e-001,
+9.273755e-001, 9.276581e-001, 9.279417e-001, 9.282263e-001, 9.285120e-001, 9.287988e-001, 9.290868e-001, 9.293759e-001, 9.296662e-001, 9.299578e-001,
+9.302507e-001, 9.305449e-001, 9.308405e-001, 9.311375e-001, 9.314359e-001, 9.317358e-001, 9.320373e-001, 9.323403e-001, 9.326449e-001, 9.329512e-001,
+9.332592e-001, 9.335688e-001, 9.338802e-001, 9.341935e-001, 9.345085e-001, 9.348254e-001, 9.351443e-001, 9.354650e-001, 9.357874e-001, 9.361098e-001,
+9.364322e-001, 9.367544e-001, 9.370766e-001, 9.373987e-001, 9.377207e-001, 9.380426e-001, 9.383645e-001, 9.386863e-001, 9.390079e-001, 9.393295e-001,
+9.396511e-001, 9.399725e-001, 9.402939e-001, 9.406151e-001, 9.409363e-001, 9.412574e-001, 9.415785e-001, 9.418994e-001, 9.422203e-001, 9.425410e-001,
+9.428617e-001, 9.431823e-001, 9.435028e-001, 9.438233e-001, 9.441436e-001, 9.444639e-001, 9.447841e-001, 9.451042e-001, 9.454242e-001, 9.457441e-001,
+9.460640e-001, 9.463837e-001, 9.467034e-001, 9.470230e-001, 9.473425e-001, 9.476619e-001, 9.479813e-001, 9.483005e-001, 9.486197e-001, 9.489387e-001,
+9.492577e-001, 9.495766e-001, 9.498954e-001, 9.502142e-001, 9.505328e-001, 9.508514e-001, 9.511698e-001, 9.514882e-001, 9.518065e-001, 9.521247e-001,
+9.524428e-001, 9.527609e-001, 9.530788e-001, 9.533967e-001, 9.537144e-001, 9.540321e-001, 9.543497e-001, 9.546672e-001, 9.549846e-001, 9.553019e-001,
+9.556191e-001, 9.559363e-001, 9.562533e-001, 9.565703e-001, 9.568872e-001, 9.572040e-001, 9.575207e-001, 9.578373e-001, 9.581538e-001, 9.584702e-001,
+9.587865e-001, 9.591028e-001, 9.594189e-001, 9.597350e-001, 9.600510e-001, 9.603668e-001, 9.606826e-001, 9.609983e-001, 9.613139e-001, 9.616295e-001,
+9.619449e-001, 9.622602e-001, 9.625754e-001, 9.628906e-001, 9.632056e-001, 9.635206e-001, 9.638355e-001, 9.641503e-001, 9.644649e-001, 9.647795e-001,
+9.650940e-001, 9.654084e-001, 9.657227e-001, 9.660370e-001, 9.663511e-001, 9.666651e-001, 9.669791e-001, 9.672929e-001, 9.676066e-001, 9.679203e-001,
+9.682339e-001, 9.685473e-001, 9.688607e-001, 9.691740e-001, 9.694872e-001, 9.698002e-001, 9.701132e-001, 9.704261e-001, 9.707389e-001, 9.710516e-001,
+9.713642e-001, 9.716768e-001, 9.719892e-001, 9.723015e-001, 9.726137e-001, 9.729259e-001, 9.732379e-001, 9.735498e-001, 9.738617e-001, 9.741734e-001,
+9.744850e-001, 9.747966e-001, 9.751080e-001, 9.754194e-001, 9.757306e-001, 9.760418e-001, 9.763529e-001, 9.766638e-001, 9.769747e-001, 9.772855e-001,
+9.775961e-001, 9.779067e-001, 9.782172e-001, 9.785275e-001, 9.788378e-001, 9.791480e-001, 9.794580e-001, 9.797680e-001, 9.800779e-001, 9.803877e-001,
+9.806973e-001, 9.810069e-001, 9.813164e-001, 9.816258e-001, 9.819350e-001, 9.822442e-001, 9.825533e-001, 9.828623e-001, 9.831711e-001, 9.834799e-001,
+9.837886e-001, 9.840972e-001, 9.844056e-001, 9.847140e-001, 9.850223e-001, 9.853304e-001, 9.856385e-001, 9.859464e-001, 9.862543e-001, 9.865620e-001,
+9.868697e-001, 9.871772e-001, 9.874847e-001, 9.877920e-001, 9.880993e-001, 9.884064e-001, 9.887135e-001, 9.890204e-001, 9.893272e-001, 9.896339e-001,
+9.899406e-001, 9.902471e-001, 9.905535e-001, 9.908598e-001, 9.911660e-001, 9.914721e-001, 9.917781e-001, 9.920840e-001, 9.923898e-001, 9.926955e-001,
+9.930010e-001, 9.933065e-001, 9.936119e-001, 9.939171e-001, 9.942223e-001, 9.945273e-001, 9.948323e-001, 9.951371e-001, 9.954419e-001, 9.957465e-001,
+9.960510e-001, 9.963554e-001, 9.966597e-001, 9.969639e-001, 9.972680e-001, 9.975720e-001, 9.978759e-001, 9.981796e-001, 9.984833e-001, 9.987869e-001,
+9.990903e-001, 9.993936e-001, 9.996969e-001, 1.000000e+000)),
+("Eastman", "Double X Neg 12min", "graph-log-log-neg", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.793432e-004, 1.604387e-003, 2.504831e-003, 3.456485e-003, 4.453106e-003, 5.492721e-003, 6.574306e-003, 7.696603e-003, 8.865247e-003,
+1.004063e-002, 1.124826e-002, 1.248930e-002, 1.375139e-002, 1.503189e-002, 1.630538e-002, 1.759687e-002, 1.889597e-002, 2.022098e-002, 2.154179e-002,
+2.284154e-002, 2.413452e-002, 2.541661e-002, 2.670514e-002, 2.797155e-002, 2.922997e-002, 3.051079e-002, 3.181484e-002, 3.312444e-002, 3.441829e-002,
+3.567108e-002, 3.690001e-002, 3.812645e-002, 3.936044e-002, 4.059323e-002, 4.182753e-002, 4.305400e-002, 4.427560e-002, 4.549254e-002, 4.671482e-002,
+4.795684e-002, 4.922012e-002, 5.050555e-002, 5.180397e-002, 5.309990e-002, 5.439354e-002, 5.567281e-002, 5.692861e-002, 5.817006e-002, 5.939753e-002,
+6.062114e-002, 6.184903e-002, 6.307550e-002, 6.429917e-002, 6.552742e-002, 6.676230e-002, 6.799541e-002, 6.922883e-002, 7.046690e-002, 7.170511e-002,
+7.293889e-002, 7.417421e-002, 7.541143e-002, 7.664906e-002, 7.790469e-002, 7.917588e-002, 8.045682e-002, 8.174577e-002, 8.304553e-002, 8.435124e-002,
+8.566697e-002, 8.698786e-002, 8.830996e-002, 8.962941e-002, 9.094167e-002, 9.223986e-002, 9.352237e-002, 9.480025e-002, 9.608063e-002, 9.735618e-002,
+9.862275e-002, 9.987919e-002, 1.011311e-001, 1.023768e-001, 1.036218e-001, 1.048733e-001, 1.061238e-001, 1.073772e-001, 1.086406e-001, 1.099131e-001,
+1.111890e-001, 1.124633e-001, 1.137432e-001, 1.150280e-001, 1.163161e-001, 1.176022e-001, 1.188818e-001, 1.201585e-001, 1.214374e-001, 1.227220e-001,
+1.240141e-001, 1.253069e-001, 1.266024e-001, 1.279032e-001, 1.292033e-001, 1.305052e-001, 1.318121e-001, 1.331252e-001, 1.344417e-001, 1.357488e-001,
+1.370531e-001, 1.383568e-001, 1.396605e-001, 1.409630e-001, 1.422599e-001, 1.435439e-001, 1.448163e-001, 1.460812e-001, 1.473406e-001, 1.486003e-001,
+1.498605e-001, 1.511213e-001, 1.523707e-001, 1.536184e-001, 1.548664e-001, 1.561182e-001, 1.573731e-001, 1.586305e-001, 1.598911e-001, 1.611556e-001,
+1.624190e-001, 1.636800e-001, 1.649399e-001, 1.662012e-001, 1.674640e-001, 1.687299e-001, 1.699973e-001, 1.712665e-001, 1.725308e-001, 1.737936e-001,
+1.750549e-001, 1.763174e-001, 1.775806e-001, 1.788450e-001, 1.801103e-001, 1.813762e-001, 1.826316e-001, 1.838831e-001, 1.851278e-001, 1.863733e-001,
+1.876192e-001, 1.888664e-001, 1.901142e-001, 1.913629e-001, 1.926099e-001, 1.938559e-001, 1.950968e-001, 1.963376e-001, 1.975809e-001, 1.988253e-001,
+2.000715e-001, 2.013194e-001, 2.025685e-001, 2.038164e-001, 2.050641e-001, 2.063077e-001, 2.075518e-001, 2.087996e-001, 2.100487e-001, 2.113008e-001,
+2.125547e-001, 2.138113e-001, 2.150680e-001, 2.163250e-001, 2.175805e-001, 2.188349e-001, 2.200878e-001, 2.213396e-001, 2.225918e-001, 2.238440e-001,
+2.250992e-001, 2.263559e-001, 2.276154e-001, 2.288765e-001, 2.301405e-001, 2.314060e-001, 2.326693e-001, 2.339308e-001, 2.351918e-001, 2.364521e-001,
+2.377137e-001, 2.389771e-001, 2.402402e-001, 2.415029e-001, 2.427645e-001, 2.440197e-001, 2.452748e-001, 2.465146e-001, 2.477541e-001, 2.489841e-001,
+2.502117e-001, 2.514351e-001, 2.526554e-001, 2.538737e-001, 2.550880e-001, 2.563014e-001, 2.575060e-001, 2.587105e-001, 2.599006e-001, 2.610872e-001,
+2.622726e-001, 2.634567e-001, 2.646412e-001, 2.658275e-001, 2.670138e-001, 2.682031e-001, 2.693930e-001, 2.705830e-001, 2.717730e-001, 2.729630e-001,
+2.741508e-001, 2.753386e-001, 2.765289e-001, 2.777212e-001, 2.789133e-001, 2.801041e-001, 2.812949e-001, 2.824903e-001, 2.836887e-001, 2.848883e-001,
+2.861018e-001, 2.873153e-001, 2.885308e-001, 2.897481e-001, 2.909654e-001, 2.921859e-001, 2.934065e-001, 2.946257e-001, 2.958427e-001, 2.970597e-001,
+2.982782e-001, 2.994972e-001, 3.007167e-001, 3.019423e-001, 3.031679e-001, 3.043950e-001, 3.056245e-001, 3.068540e-001, 3.080824e-001, 3.093104e-001,
+3.105383e-001, 3.117618e-001, 3.129849e-001, 3.142082e-001, 3.154325e-001, 3.166568e-001, 3.178821e-001, 3.191089e-001, 3.203358e-001, 3.215648e-001,
+3.227959e-001, 3.240269e-001, 3.252558e-001, 3.264835e-001, 3.277112e-001, 3.289370e-001, 3.301622e-001, 3.313874e-001, 3.326055e-001, 3.338221e-001,
+3.350387e-001, 3.362471e-001, 3.374541e-001, 3.386611e-001, 3.398616e-001, 3.410610e-001, 3.422604e-001, 3.434515e-001, 3.446409e-001, 3.458304e-001,
+3.470165e-001, 3.482017e-001, 3.493868e-001, 3.505715e-001, 3.517560e-001, 3.529405e-001, 3.541254e-001, 3.553107e-001, 3.564960e-001, 3.576815e-001,
+3.588676e-001, 3.600536e-001, 3.612395e-001, 3.624250e-001, 3.636104e-001, 3.647959e-001, 3.659863e-001, 3.671767e-001, 3.683671e-001, 3.695602e-001,
+3.707543e-001, 3.719484e-001, 3.731409e-001, 3.743312e-001, 3.755215e-001, 3.767109e-001, 3.778905e-001, 3.790702e-001, 3.802498e-001, 3.814250e-001,
+3.825984e-001, 3.837718e-001, 3.849434e-001, 3.861110e-001, 3.872786e-001, 3.884461e-001, 3.896096e-001, 3.907724e-001, 3.919352e-001, 3.930952e-001,
+3.942511e-001, 3.954069e-001, 3.965628e-001, 3.977114e-001, 3.988590e-001, 4.000066e-001, 4.011511e-001, 4.022891e-001, 4.034270e-001, 4.045650e-001,
+4.056947e-001, 4.068213e-001, 4.079478e-001, 4.090737e-001, 4.101923e-001, 4.113109e-001, 4.124295e-001, 4.135465e-001, 4.146609e-001, 4.157754e-001,
+4.168899e-001, 4.180073e-001, 4.191260e-001, 4.202447e-001, 4.213634e-001, 4.224788e-001, 4.235939e-001, 4.247091e-001, 4.258244e-001, 4.269405e-001,
+4.280566e-001, 4.291727e-001, 4.302916e-001, 4.314163e-001, 4.325410e-001, 4.336657e-001, 4.347922e-001, 4.359208e-001, 4.370495e-001, 4.381781e-001,
+4.393090e-001, 4.404419e-001, 4.415748e-001, 4.427077e-001, 4.438371e-001, 4.449638e-001, 4.460904e-001, 4.472170e-001, 4.483405e-001, 4.494614e-001,
+4.505823e-001, 4.517032e-001, 4.528234e-001, 4.539429e-001, 4.550624e-001, 4.561819e-001, 4.572989e-001, 4.584122e-001, 4.595254e-001, 4.606387e-001,
+4.617524e-001, 4.628674e-001, 4.639823e-001, 4.650972e-001, 4.662119e-001, 4.673240e-001, 4.684361e-001, 4.695482e-001, 4.706603e-001, 4.717625e-001,
+4.728632e-001, 4.739639e-001, 4.750646e-001, 4.761615e-001, 4.772560e-001, 4.783505e-001, 4.794450e-001, 4.805379e-001, 4.816267e-001, 4.827155e-001,
+4.838043e-001, 4.848932e-001, 4.859697e-001, 4.870451e-001, 4.881204e-001, 4.891958e-001, 4.902659e-001, 4.913307e-001, 4.923956e-001, 4.934605e-001,
+4.945252e-001, 4.955862e-001, 4.966472e-001, 4.977082e-001, 4.987692e-001, 4.998276e-001, 5.008836e-001, 5.019396e-001, 5.029956e-001, 5.040516e-001,
+5.051162e-001, 5.061810e-001, 5.072459e-001, 5.083107e-001, 5.093781e-001, 5.104499e-001, 5.115216e-001, 5.125934e-001, 5.136652e-001, 5.147347e-001,
+5.158032e-001, 5.168717e-001, 5.179402e-001, 5.190087e-001, 5.200641e-001, 5.211194e-001, 5.221747e-001, 5.232301e-001, 5.242826e-001, 5.253263e-001,
+5.263700e-001, 5.274137e-001, 5.284574e-001, 5.294986e-001, 5.305367e-001, 5.315749e-001, 5.326130e-001, 5.336511e-001, 5.346895e-001, 5.357281e-001,
+5.367668e-001, 5.378054e-001, 5.388441e-001, 5.398869e-001, 5.409320e-001, 5.419770e-001, 5.430221e-001, 5.440671e-001, 5.451144e-001, 5.461627e-001,
+5.472110e-001, 5.482593e-001, 5.493076e-001, 5.503468e-001, 5.513814e-001, 5.524160e-001, 5.534506e-001, 5.544852e-001, 5.555141e-001, 5.565391e-001,
+5.575641e-001, 5.585891e-001, 5.596141e-001, 5.606383e-001, 5.616616e-001, 5.626850e-001, 5.637083e-001, 5.647316e-001, 5.657542e-001, 5.667750e-001,
+5.677957e-001, 5.688164e-001, 5.698372e-001, 5.708576e-001, 5.718626e-001, 5.728676e-001, 5.738726e-001, 5.748776e-001, 5.758826e-001, 5.768746e-001,
+5.778616e-001, 5.788486e-001, 5.798355e-001, 5.808225e-001, 5.818051e-001, 5.827798e-001, 5.837546e-001, 5.847293e-001, 5.857041e-001, 5.866789e-001,
+5.876461e-001, 5.886128e-001, 5.895796e-001, 5.905464e-001, 5.915131e-001, 5.924791e-001, 5.934441e-001, 5.944091e-001, 5.953741e-001, 5.963391e-001,
+5.973042e-001, 5.982727e-001, 5.992415e-001, 6.002103e-001, 6.011792e-001, 6.021480e-001, 6.031123e-001, 6.040681e-001, 6.050239e-001, 6.059797e-001,
+6.069355e-001, 6.078913e-001, 6.088355e-001, 6.097745e-001, 6.107134e-001, 6.116524e-001, 6.125914e-001, 6.135303e-001, 6.144612e-001, 6.153919e-001,
+6.163225e-001, 6.172532e-001, 6.181838e-001, 6.191146e-001, 6.200459e-001, 6.209772e-001, 6.219085e-001, 6.228398e-001, 6.237710e-001, 6.247058e-001,
+6.256469e-001, 6.265881e-001, 6.275292e-001, 6.284703e-001, 6.294115e-001, 6.303575e-001, 6.313095e-001, 6.322615e-001, 6.332136e-001, 6.341656e-001,
+6.351176e-001, 6.360645e-001, 6.370056e-001, 6.379467e-001, 6.388879e-001, 6.398290e-001, 6.407701e-001, 6.417067e-001, 6.426376e-001, 6.435685e-001,
+6.444994e-001, 6.454303e-001, 6.463611e-001, 6.472915e-001, 6.482210e-001, 6.491505e-001, 6.500799e-001, 6.510094e-001, 6.519389e-001, 6.528681e-001,
+6.537962e-001, 6.547243e-001, 6.556524e-001, 6.565805e-001, 6.575087e-001, 6.584368e-001, 6.593579e-001, 6.602787e-001, 6.611994e-001, 6.621202e-001,
+6.630409e-001, 6.639617e-001, 6.648804e-001, 6.657980e-001, 6.667156e-001, 6.676333e-001, 6.685509e-001, 6.694685e-001, 6.703848e-001, 6.712978e-001,
+6.722108e-001, 6.731238e-001, 6.740368e-001, 6.749498e-001, 6.758628e-001, 6.767728e-001, 6.776821e-001, 6.785915e-001, 6.795009e-001, 6.804103e-001,
+6.813196e-001, 6.822265e-001, 6.831287e-001, 6.840308e-001, 6.849329e-001, 6.858351e-001, 6.867372e-001, 6.876393e-001, 6.885449e-001, 6.894516e-001,
+6.903583e-001, 6.912649e-001, 6.921716e-001, 6.930783e-001, 6.939844e-001, 6.948862e-001, 6.957879e-001, 6.966897e-001, 6.975915e-001, 6.984933e-001,
+6.993951e-001, 7.002942e-001, 7.011893e-001, 7.020843e-001, 7.029794e-001, 7.038745e-001, 7.047696e-001, 7.056647e-001, 7.065536e-001, 7.074385e-001,
+7.083234e-001, 7.092083e-001, 7.100932e-001, 7.109781e-001, 7.118630e-001, 7.127363e-001, 7.136056e-001, 7.144749e-001, 7.153441e-001, 7.162134e-001,
+7.170826e-001, 7.179519e-001, 7.188182e-001, 7.196837e-001, 7.205493e-001, 7.214148e-001, 7.222804e-001, 7.231459e-001, 7.240114e-001, 7.248805e-001,
+7.257506e-001, 7.266207e-001, 7.274908e-001, 7.283609e-001, 7.292310e-001, 7.301011e-001, 7.309634e-001, 7.318222e-001, 7.326809e-001, 7.335396e-001,
+7.343984e-001, 7.352571e-001, 7.361158e-001, 7.369657e-001, 7.378073e-001, 7.386490e-001, 7.394906e-001, 7.403322e-001, 7.411738e-001, 7.420154e-001,
+7.428557e-001, 7.436921e-001, 7.445285e-001, 7.453650e-001, 7.462014e-001, 7.470379e-001, 7.478743e-001, 7.487107e-001, 7.495497e-001, 7.503887e-001,
+7.512278e-001, 7.520668e-001, 7.529059e-001, 7.537449e-001, 7.545840e-001, 7.554157e-001, 7.562411e-001, 7.570664e-001, 7.578918e-001, 7.587172e-001,
+7.595426e-001, 7.603679e-001, 7.611923e-001, 7.619992e-001, 7.628061e-001, 7.636130e-001, 7.644199e-001, 7.652268e-001, 7.660337e-001, 7.668405e-001,
+7.676423e-001, 7.684385e-001, 7.692347e-001, 7.700310e-001, 7.708272e-001, 7.716234e-001, 7.724197e-001, 7.732159e-001, 7.740071e-001, 7.747973e-001,
+7.755874e-001, 7.763776e-001, 7.771678e-001, 7.779580e-001, 7.787482e-001, 7.795379e-001, 7.803234e-001, 7.811089e-001, 7.818945e-001, 7.826800e-001,
+7.834655e-001, 7.842511e-001, 7.850366e-001, 7.858233e-001, 7.866128e-001, 7.874023e-001, 7.881918e-001, 7.889813e-001, 7.897708e-001, 7.905603e-001,
+7.913498e-001, 7.921416e-001, 7.929370e-001, 7.937325e-001, 7.945279e-001, 7.953234e-001, 7.961188e-001, 7.969143e-001, 7.977098e-001, 7.985073e-001,
+7.993079e-001, 8.001084e-001, 8.009090e-001, 8.017096e-001, 8.025102e-001, 8.033107e-001, 8.041113e-001, 8.049137e-001, 8.057197e-001, 8.065257e-001,
+8.073317e-001, 8.081377e-001, 8.089437e-001, 8.097497e-001, 8.105557e-001, 8.113610e-001, 8.121625e-001, 8.129641e-001, 8.137656e-001, 8.145672e-001,
+8.153687e-001, 8.161703e-001, 8.169718e-001, 8.177734e-001, 8.185742e-001, 8.193749e-001, 8.201756e-001, 8.209763e-001, 8.217771e-001, 8.225778e-001,
+8.233785e-001, 8.241792e-001, 8.249863e-001, 8.257977e-001, 8.266092e-001, 8.274207e-001, 8.282322e-001, 8.290437e-001, 8.298552e-001, 8.306667e-001,
+8.314790e-001, 8.322962e-001, 8.331134e-001, 8.339306e-001, 8.347478e-001, 8.355650e-001, 8.363821e-001, 8.371993e-001, 8.380165e-001, 8.388273e-001,
+8.396344e-001, 8.404416e-001, 8.412487e-001, 8.420559e-001, 8.428630e-001, 8.436702e-001, 8.444773e-001, 8.452843e-001, 8.460859e-001, 8.468874e-001,
+8.476890e-001, 8.484905e-001, 8.492920e-001, 8.500936e-001, 8.508951e-001, 8.516967e-001, 8.524970e-001, 8.532948e-001, 8.540926e-001, 8.548903e-001,
+8.556881e-001, 8.564858e-001, 8.572836e-001, 8.580814e-001, 8.588791e-001, 8.596730e-001, 8.604632e-001, 8.612535e-001, 8.620437e-001, 8.628340e-001,
+8.636242e-001, 8.644145e-001, 8.652047e-001, 8.659950e-001, 8.667807e-001, 8.675638e-001, 8.683468e-001, 8.691298e-001, 8.699129e-001, 8.706959e-001,
+8.714789e-001, 8.722620e-001, 8.730450e-001, 8.738256e-001, 8.746049e-001, 8.753841e-001, 8.761633e-001, 8.769426e-001, 8.777218e-001, 8.785010e-001,
+8.792803e-001, 8.800595e-001, 8.808331e-001, 8.816020e-001, 8.823708e-001, 8.831397e-001, 8.839085e-001, 8.846774e-001, 8.854462e-001, 8.862151e-001,
+8.869839e-001, 8.877494e-001, 8.885087e-001, 8.892680e-001, 8.900274e-001, 8.907867e-001, 8.915461e-001, 8.923054e-001, 8.930647e-001, 8.938241e-001,
+8.945831e-001, 8.953374e-001, 8.960917e-001, 8.968460e-001, 8.976003e-001, 8.983546e-001, 8.991089e-001, 8.998632e-001, 9.006175e-001, 9.013718e-001,
+9.021222e-001, 9.028707e-001, 9.036192e-001, 9.043677e-001, 9.051162e-001, 9.058647e-001, 9.066132e-001, 9.073617e-001, 9.081102e-001, 9.088572e-001,
+9.095978e-001, 9.103383e-001, 9.110789e-001, 9.118194e-001, 9.125599e-001, 9.133005e-001, 9.140410e-001, 9.147816e-001, 9.155221e-001, 9.162617e-001,
+9.170007e-001, 9.177397e-001, 9.184786e-001, 9.192176e-001, 9.199566e-001, 9.206956e-001, 9.214346e-001, 9.221735e-001, 9.229125e-001, 9.236471e-001,
+9.243811e-001, 9.251152e-001, 9.258492e-001, 9.265833e-001, 9.273174e-001, 9.280514e-001, 9.287855e-001, 9.295195e-001, 9.302525e-001, 9.309753e-001,
+9.316981e-001, 9.324210e-001, 9.331438e-001, 9.338666e-001, 9.345894e-001, 9.353123e-001, 9.360351e-001, 9.367579e-001, 9.374782e-001, 9.381874e-001,
+9.388967e-001, 9.396059e-001, 9.403151e-001, 9.410244e-001, 9.417336e-001, 9.424428e-001, 9.431521e-001, 9.438613e-001, 9.445694e-001, 9.452717e-001,
+9.459741e-001, 9.466765e-001, 9.473789e-001, 9.480813e-001, 9.487837e-001, 9.494861e-001, 9.501885e-001, 9.508909e-001, 9.515927e-001, 9.522831e-001,
+9.529735e-001, 9.536639e-001, 9.543543e-001, 9.550447e-001, 9.557351e-001, 9.564255e-001, 9.571159e-001, 9.578063e-001, 9.584967e-001, 9.591748e-001,
+9.598502e-001, 9.605256e-001, 9.612010e-001, 9.618764e-001, 9.625518e-001, 9.632272e-001, 9.639026e-001, 9.645780e-001, 9.652534e-001, 9.659177e-001,
+9.665695e-001, 9.672212e-001, 9.678730e-001, 9.685248e-001, 9.691765e-001, 9.698283e-001, 9.704800e-001, 9.711318e-001, 9.717836e-001, 9.724349e-001,
+9.730531e-001, 9.736713e-001, 9.742895e-001, 9.749077e-001, 9.755260e-001, 9.761442e-001, 9.767624e-001, 9.773806e-001, 9.779988e-001, 9.786170e-001,
+9.792194e-001, 9.798018e-001, 9.803842e-001, 9.809667e-001, 9.815491e-001, 9.821315e-001, 9.827139e-001, 9.832964e-001, 9.838788e-001, 9.844612e-001,
+9.850436e-001, 9.855897e-001, 9.861240e-001, 9.866583e-001, 9.871927e-001, 9.877270e-001, 9.882613e-001, 9.887956e-001, 9.893300e-001, 9.898643e-001,
+9.903986e-001, 9.909329e-001, 9.913934e-001, 9.918505e-001, 9.923075e-001, 9.927645e-001, 9.932215e-001, 9.936786e-001, 9.941356e-001, 9.945926e-001,
+9.950496e-001, 9.955067e-001, 9.959604e-001, 9.963276e-001, 9.966949e-001, 9.970621e-001, 9.974293e-001, 9.977966e-001, 9.981638e-001, 9.985311e-001,
+9.988983e-001, 9.992655e-001, 9.996328e-001, 1.000000e+000), (), (), (), ()),
+("Eastman", "Double X Neg 6min", "graph-log-log-neg", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.207676e-003, 4.850599e-003, 7.730768e-003, 1.064302e-002, 1.349414e-002, 1.642714e-002, 1.936429e-002, 2.228150e-002, 2.533381e-002,
+2.832986e-002, 3.122959e-002, 3.406779e-002, 3.681279e-002, 3.951927e-002, 4.222457e-002, 4.486340e-002, 4.739907e-002, 4.986088e-002, 5.229685e-002,
+5.476386e-002, 5.722669e-002, 5.961687e-002, 6.194271e-002, 6.418592e-002, 6.638405e-002, 6.855921e-002, 7.071257e-002, 7.289322e-002, 7.507300e-002,
+7.724236e-002, 7.937424e-002, 8.148044e-002, 8.354592e-002, 8.557937e-002, 8.761876e-002, 8.967561e-002, 9.172015e-002, 9.374890e-002, 9.576705e-002,
+9.776918e-002, 9.976112e-002, 1.017475e-001, 1.037304e-001, 1.057140e-001, 1.076988e-001, 1.096797e-001, 1.116434e-001, 1.136051e-001, 1.155519e-001,
+1.174954e-001, 1.194273e-001, 1.213322e-001, 1.232244e-001, 1.250977e-001, 1.269564e-001, 1.288059e-001, 1.306265e-001, 1.324592e-001, 1.342981e-001,
+1.361421e-001, 1.379899e-001, 1.398338e-001, 1.416724e-001, 1.435086e-001, 1.453595e-001, 1.472202e-001, 1.490904e-001, 1.509465e-001, 1.527886e-001,
+1.546381e-001, 1.564874e-001, 1.583338e-001, 1.601832e-001, 1.620080e-001, 1.638301e-001, 1.656454e-001, 1.674110e-001, 1.691545e-001, 1.708903e-001,
+1.726087e-001, 1.743193e-001, 1.760135e-001, 1.776891e-001, 1.793549e-001, 1.810145e-001, 1.826763e-001, 1.843472e-001, 1.860086e-001, 1.876677e-001,
+1.893320e-001, 1.910057e-001, 1.926884e-001, 1.943672e-001, 1.960388e-001, 1.977011e-001, 1.993734e-001, 2.010557e-001, 2.027230e-001, 2.043715e-001,
+2.060067e-001, 2.076273e-001, 2.092293e-001, 2.108174e-001, 2.123903e-001, 2.139515e-001, 2.155004e-001, 2.170375e-001, 2.185631e-001, 2.200783e-001,
+2.215854e-001, 2.230909e-001, 2.245920e-001, 2.260849e-001, 2.275708e-001, 2.290592e-001, 2.305610e-001, 2.320587e-001, 2.335456e-001, 2.350172e-001,
+2.364921e-001, 2.379685e-001, 2.394436e-001, 2.409150e-001, 2.423750e-001, 2.438221e-001, 2.452609e-001, 2.466982e-001, 2.481336e-001, 2.495693e-001,
+2.510061e-001, 2.524541e-001, 2.539057e-001, 2.553602e-001, 2.568137e-001, 2.582661e-001, 2.597176e-001, 2.611657e-001, 2.626079e-001, 2.640449e-001,
+2.654654e-001, 2.668786e-001, 2.682839e-001, 2.696811e-001, 2.710822e-001, 2.724925e-001, 2.739025e-001, 2.753120e-001, 2.767191e-001, 2.781172e-001,
+2.795062e-001, 2.808851e-001, 2.822608e-001, 2.836303e-001, 2.849979e-001, 2.863635e-001, 2.877384e-001, 2.891166e-001, 2.905051e-001, 2.918923e-001,
+2.932764e-001, 2.946614e-001, 2.960470e-001, 2.974393e-001, 2.988334e-001, 3.002208e-001, 3.016053e-001, 3.029762e-001, 3.043460e-001, 3.057134e-001,
+3.070786e-001, 3.084413e-001, 3.098074e-001, 3.111760e-001, 3.125430e-001, 3.139094e-001, 3.152735e-001, 3.166370e-001, 3.179859e-001, 3.193318e-001,
+3.206685e-001, 3.220038e-001, 3.233413e-001, 3.246791e-001, 3.260106e-001, 3.273412e-001, 3.286639e-001, 3.299851e-001, 3.313086e-001, 3.326326e-001,
+3.339475e-001, 3.352592e-001, 3.365674e-001, 3.378737e-001, 3.391835e-001, 3.404964e-001, 3.418086e-001, 3.431196e-001, 3.444281e-001, 3.457284e-001,
+3.470287e-001, 3.483308e-001, 3.496329e-001, 3.509300e-001, 3.522260e-001, 3.535212e-001, 3.548158e-001, 3.561145e-001, 3.574211e-001, 3.587279e-001,
+3.600377e-001, 3.613475e-001, 3.626418e-001, 3.639314e-001, 3.652201e-001, 3.665078e-001, 3.677952e-001, 3.690789e-001, 3.703626e-001, 3.716370e-001,
+3.729075e-001, 3.741777e-001, 3.754476e-001, 3.767175e-001, 3.779971e-001, 3.792784e-001, 3.805551e-001, 3.818249e-001, 3.830948e-001, 3.843518e-001,
+3.856075e-001, 3.868649e-001, 3.881247e-001, 3.893846e-001, 3.906409e-001, 3.918967e-001, 3.931471e-001, 3.943846e-001, 3.956222e-001, 3.968514e-001,
+3.980770e-001, 3.993020e-001, 4.005203e-001, 4.017386e-001, 4.029510e-001, 4.041553e-001, 4.053595e-001, 4.065567e-001, 4.077515e-001, 4.089460e-001,
+4.101308e-001, 4.113157e-001, 4.124986e-001, 4.136764e-001, 4.148543e-001, 4.160274e-001, 4.171961e-001, 4.183648e-001, 4.195276e-001, 4.206880e-001,
+4.218484e-001, 4.230014e-001, 4.241535e-001, 4.253055e-001, 4.264522e-001, 4.275989e-001, 4.287459e-001, 4.298944e-001, 4.310429e-001, 4.321909e-001,
+4.333373e-001, 4.344836e-001, 4.356265e-001, 4.367592e-001, 4.378920e-001, 4.390230e-001, 4.401494e-001, 4.412759e-001, 4.424026e-001, 4.435302e-001,
+4.446578e-001, 4.457833e-001, 4.469004e-001, 4.480176e-001, 4.491330e-001, 4.502356e-001, 4.513381e-001, 4.524406e-001, 4.535480e-001, 4.546555e-001,
+4.557629e-001, 4.568734e-001, 4.579846e-001, 4.590957e-001, 4.602054e-001, 4.613144e-001, 4.624234e-001, 4.635319e-001, 4.646397e-001, 4.657475e-001,
+4.668547e-001, 4.679592e-001, 4.690638e-001, 4.701683e-001, 4.712668e-001, 4.723646e-001, 4.734624e-001, 4.745511e-001, 4.756327e-001, 4.767143e-001,
+4.777937e-001, 4.788640e-001, 4.799342e-001, 4.810045e-001, 4.820768e-001, 4.831496e-001, 4.842225e-001, 4.852964e-001, 4.863724e-001, 4.874483e-001,
+4.885243e-001, 4.895890e-001, 4.906523e-001, 4.917157e-001, 4.927777e-001, 4.938377e-001, 4.948977e-001, 4.959576e-001, 4.970098e-001, 4.980605e-001,
+4.991111e-001, 5.001580e-001, 5.011936e-001, 5.022291e-001, 5.032647e-001, 5.042962e-001, 5.053253e-001, 5.063544e-001, 5.073835e-001, 5.083958e-001,
+5.094074e-001, 5.104189e-001, 5.114264e-001, 5.124221e-001, 5.134177e-001, 5.144133e-001, 5.154061e-001, 5.163959e-001, 5.173858e-001, 5.183757e-001,
+5.193517e-001, 5.203221e-001, 5.212926e-001, 5.222630e-001, 5.232200e-001, 5.241754e-001, 5.251307e-001, 5.260861e-001, 5.270461e-001, 5.280061e-001,
+5.289661e-001, 5.299252e-001, 5.308770e-001, 5.318287e-001, 5.327805e-001, 5.337301e-001, 5.346678e-001, 5.356055e-001, 5.365432e-001, 5.374809e-001,
+5.384189e-001, 5.393569e-001, 5.402949e-001, 5.412318e-001, 5.421610e-001, 5.430902e-001, 5.440193e-001, 5.449480e-001, 5.458661e-001, 5.467841e-001,
+5.477021e-001, 5.486202e-001, 5.495286e-001, 5.504362e-001, 5.513437e-001, 5.522513e-001, 5.531493e-001, 5.540440e-001, 5.549387e-001, 5.558334e-001,
+5.567305e-001, 5.576296e-001, 5.585288e-001, 5.594280e-001, 5.603267e-001, 5.612240e-001, 5.621214e-001, 5.630187e-001, 5.639160e-001, 5.648062e-001,
+5.656959e-001, 5.665857e-001, 5.674754e-001, 5.683673e-001, 5.692605e-001, 5.701537e-001, 5.710470e-001, 5.719397e-001, 5.728303e-001, 5.737209e-001,
+5.746115e-001, 5.755021e-001, 5.763865e-001, 5.772688e-001, 5.781511e-001, 5.790334e-001, 5.799122e-001, 5.807796e-001, 5.816470e-001, 5.825144e-001,
+5.833818e-001, 5.842389e-001, 5.850912e-001, 5.859435e-001, 5.867958e-001, 5.876481e-001, 5.885004e-001, 5.893527e-001, 5.902051e-001, 5.910574e-001,
+5.919092e-001, 5.927604e-001, 5.936115e-001, 5.944627e-001, 5.953139e-001, 5.961607e-001, 5.970061e-001, 5.978515e-001, 5.986968e-001, 5.995422e-001,
+6.003857e-001, 6.012292e-001, 6.020726e-001, 6.029161e-001, 6.037605e-001, 6.046084e-001, 6.054564e-001, 6.063044e-001, 6.071524e-001, 6.080002e-001,
+6.088477e-001, 6.096951e-001, 6.105426e-001, 6.113901e-001, 6.122345e-001, 6.130749e-001, 6.139154e-001, 6.147558e-001, 6.155962e-001, 6.164314e-001,
+6.172607e-001, 6.180901e-001, 6.189195e-001, 6.197489e-001, 6.205751e-001, 6.213977e-001, 6.222203e-001, 6.230429e-001, 6.238655e-001, 6.246876e-001,
+6.255089e-001, 6.263303e-001, 6.271517e-001, 6.279730e-001, 6.287913e-001, 6.296016e-001, 6.304120e-001, 6.312224e-001, 6.320327e-001, 6.328420e-001,
+6.336416e-001, 6.344412e-001, 6.352408e-001, 6.360404e-001, 6.368400e-001, 6.376360e-001, 6.384314e-001, 6.392268e-001, 6.400222e-001, 6.408177e-001,
+6.416134e-001, 6.424095e-001, 6.432056e-001, 6.440016e-001, 6.447977e-001, 6.455929e-001, 6.463852e-001, 6.471776e-001, 6.479700e-001, 6.487624e-001,
+6.495548e-001, 6.503387e-001, 6.511209e-001, 6.519031e-001, 6.526852e-001, 6.534674e-001, 6.542478e-001, 6.550251e-001, 6.558023e-001, 6.565796e-001,
+6.573568e-001, 6.581341e-001, 6.589120e-001, 6.596900e-001, 6.604681e-001, 6.612461e-001, 6.620242e-001, 6.628038e-001, 6.635877e-001, 6.643715e-001,
+6.651554e-001, 6.659393e-001, 6.667231e-001, 6.675077e-001, 6.682926e-001, 6.690775e-001, 6.698624e-001, 6.706474e-001, 6.714323e-001, 6.722125e-001,
+6.729924e-001, 6.737722e-001, 6.745521e-001, 6.753319e-001, 6.761127e-001, 6.768987e-001, 6.776848e-001, 6.784708e-001, 6.792568e-001, 6.800428e-001,
+6.808322e-001, 6.816287e-001, 6.824251e-001, 6.832216e-001, 6.840180e-001, 6.848145e-001, 6.856052e-001, 6.863881e-001, 6.871711e-001, 6.879541e-001,
+6.887370e-001, 6.895200e-001, 6.902992e-001, 6.910744e-001, 6.918495e-001, 6.926247e-001, 6.933998e-001, 6.941749e-001, 6.949504e-001, 6.957262e-001,
+6.965020e-001, 6.972778e-001, 6.980537e-001, 6.988295e-001, 6.996038e-001, 7.003754e-001, 7.011471e-001, 7.019187e-001, 7.026903e-001, 7.034620e-001,
+7.042315e-001, 7.049934e-001, 7.057552e-001, 7.065170e-001, 7.072789e-001, 7.080407e-001, 7.088026e-001, 7.095501e-001, 7.102975e-001, 7.110450e-001,
+7.117924e-001, 7.125399e-001, 7.132873e-001, 7.140312e-001, 7.147735e-001, 7.155159e-001, 7.162583e-001, 7.170007e-001, 7.177430e-001, 7.184851e-001,
+7.192267e-001, 7.199682e-001, 7.207098e-001, 7.214513e-001, 7.221929e-001, 7.229344e-001, 7.236633e-001, 7.243913e-001, 7.251193e-001, 7.258473e-001,
+7.265753e-001, 7.273033e-001, 7.280254e-001, 7.287403e-001, 7.294551e-001, 7.301700e-001, 7.308848e-001, 7.315996e-001, 7.323145e-001, 7.330236e-001,
+7.337319e-001, 7.344402e-001, 7.351485e-001, 7.358568e-001, 7.365651e-001, 7.372738e-001, 7.379835e-001, 7.386933e-001, 7.394030e-001, 7.401127e-001,
+7.408225e-001, 7.415322e-001, 7.422451e-001, 7.429605e-001, 7.436760e-001, 7.443914e-001, 7.451069e-001, 7.458223e-001, 7.465378e-001, 7.472482e-001,
+7.479571e-001, 7.486660e-001, 7.493749e-001, 7.500838e-001, 7.507927e-001, 7.515016e-001, 7.522053e-001, 7.529084e-001, 7.536116e-001, 7.543147e-001,
+7.550179e-001, 7.557210e-001, 7.564242e-001, 7.571367e-001, 7.578495e-001, 7.585622e-001, 7.592749e-001, 7.599876e-001, 7.607003e-001, 7.614131e-001,
+7.621261e-001, 7.628391e-001, 7.635521e-001, 7.642651e-001, 7.649781e-001, 7.656911e-001, 7.664041e-001, 7.671094e-001, 7.678139e-001, 7.685185e-001,
+7.692230e-001, 7.699275e-001, 7.706320e-001, 7.713365e-001, 7.720378e-001, 7.727381e-001, 7.734383e-001, 7.741385e-001, 7.748388e-001, 7.755390e-001,
+7.762392e-001, 7.769402e-001, 7.776417e-001, 7.783433e-001, 7.790448e-001, 7.797464e-001, 7.804480e-001, 7.811495e-001, 7.818514e-001, 7.825547e-001,
+7.832580e-001, 7.839612e-001, 7.846645e-001, 7.853678e-001, 7.860711e-001, 7.867743e-001, 7.874720e-001, 7.881685e-001, 7.888650e-001, 7.895615e-001,
+7.902580e-001, 7.909545e-001, 7.916510e-001, 7.923468e-001, 7.930413e-001, 7.937358e-001, 7.944303e-001, 7.951248e-001, 7.958192e-001, 7.965137e-001,
+7.972082e-001, 7.979042e-001, 7.986006e-001, 7.992970e-001, 7.999934e-001, 8.006898e-001, 8.013862e-001, 8.020826e-001, 8.027787e-001, 8.034736e-001,
+8.041685e-001, 8.048635e-001, 8.055584e-001, 8.062533e-001, 8.069482e-001, 8.076431e-001, 8.083346e-001, 8.090219e-001, 8.097093e-001, 8.103966e-001,
+8.110839e-001, 8.117713e-001, 8.124586e-001, 8.131460e-001, 8.138282e-001, 8.145077e-001, 8.151873e-001, 8.158668e-001, 8.165463e-001, 8.172258e-001,
+8.179054e-001, 8.185849e-001, 8.192652e-001, 8.199457e-001, 8.206262e-001, 8.213067e-001, 8.219872e-001, 8.226677e-001, 8.233482e-001, 8.240287e-001,
+8.247127e-001, 8.253976e-001, 8.260826e-001, 8.267675e-001, 8.274525e-001, 8.281374e-001, 8.288223e-001, 8.295073e-001, 8.301901e-001, 8.308723e-001,
+8.315545e-001, 8.322366e-001, 8.329188e-001, 8.336009e-001, 8.342831e-001, 8.349652e-001, 8.356407e-001, 8.363117e-001, 8.369828e-001, 8.376538e-001,
+8.383248e-001, 8.389958e-001, 8.396669e-001, 8.403379e-001, 8.410078e-001, 8.416758e-001, 8.423439e-001, 8.430119e-001, 8.436799e-001, 8.443479e-001,
+8.450159e-001, 8.456840e-001, 8.463522e-001, 8.470253e-001, 8.476984e-001, 8.483714e-001, 8.490445e-001, 8.497176e-001, 8.503907e-001, 8.510637e-001,
+8.517368e-001, 8.524101e-001, 8.530836e-001, 8.537571e-001, 8.544305e-001, 8.551040e-001, 8.557774e-001, 8.564509e-001, 8.571244e-001, 8.577974e-001,
+8.584673e-001, 8.591373e-001, 8.598073e-001, 8.604773e-001, 8.611472e-001, 8.618172e-001, 8.624872e-001, 8.631571e-001, 8.638227e-001, 8.644846e-001,
+8.651466e-001, 8.658085e-001, 8.664704e-001, 8.671323e-001, 8.677942e-001, 8.684561e-001, 8.691180e-001, 8.697800e-001, 8.704419e-001, 8.711039e-001,
+8.717659e-001, 8.724278e-001, 8.730898e-001, 8.737517e-001, 8.744137e-001, 8.750753e-001, 8.757330e-001, 8.763906e-001, 8.770483e-001, 8.777059e-001,
+8.783635e-001, 8.790212e-001, 8.796788e-001, 8.803364e-001, 8.809923e-001, 8.816409e-001, 8.822894e-001, 8.829380e-001, 8.835866e-001, 8.842352e-001,
+8.848837e-001, 8.855323e-001, 8.861809e-001, 8.868293e-001, 8.874774e-001, 8.881254e-001, 8.887734e-001, 8.894214e-001, 8.900695e-001, 8.907175e-001,
+8.913655e-001, 8.920136e-001, 8.926613e-001, 8.933075e-001, 8.939537e-001, 8.946000e-001, 8.952462e-001, 8.958924e-001, 8.965386e-001, 8.971849e-001,
+8.978311e-001, 8.984773e-001, 8.991330e-001, 8.997887e-001, 9.004444e-001, 9.011002e-001, 9.017559e-001, 9.024117e-001, 9.030674e-001, 9.037232e-001,
+9.043789e-001, 9.050328e-001, 9.056859e-001, 9.063390e-001, 9.069921e-001, 9.076453e-001, 9.082984e-001, 9.089515e-001, 9.096046e-001, 9.102578e-001,
+9.109084e-001, 9.115544e-001, 9.122004e-001, 9.128465e-001, 9.134925e-001, 9.141385e-001, 9.147845e-001, 9.154306e-001, 9.160766e-001, 9.167226e-001,
+9.173694e-001, 9.180163e-001, 9.186632e-001, 9.193101e-001, 9.199570e-001, 9.206039e-001, 9.212508e-001, 9.218977e-001, 9.225446e-001, 9.231904e-001,
+9.238339e-001, 9.244774e-001, 9.251208e-001, 9.257643e-001, 9.264077e-001, 9.270512e-001, 9.276946e-001, 9.283381e-001, 9.289816e-001, 9.296204e-001,
+9.302565e-001, 9.308926e-001, 9.315287e-001, 9.321648e-001, 9.328009e-001, 9.334370e-001, 9.340732e-001, 9.347093e-001, 9.353454e-001, 9.359716e-001,
+9.365961e-001, 9.372205e-001, 9.378450e-001, 9.384695e-001, 9.390940e-001, 9.397185e-001, 9.403430e-001, 9.409674e-001, 9.415919e-001, 9.422089e-001,
+9.428256e-001, 9.434423e-001, 9.440590e-001, 9.446757e-001, 9.452924e-001, 9.459091e-001, 9.465258e-001, 9.471425e-001, 9.477592e-001, 9.483685e-001,
+9.489775e-001, 9.495866e-001, 9.501956e-001, 9.508047e-001, 9.514137e-001, 9.520228e-001, 9.526318e-001, 9.532409e-001, 9.538499e-001, 9.544496e-001,
+9.550478e-001, 9.556460e-001, 9.562442e-001, 9.568424e-001, 9.574406e-001, 9.580388e-001, 9.586370e-001, 9.592352e-001, 9.598334e-001, 9.604254e-001,
+9.610140e-001, 9.616027e-001, 9.621914e-001, 9.627800e-001, 9.633687e-001, 9.639573e-001, 9.645460e-001, 9.651347e-001, 9.657233e-001, 9.663069e-001,
+9.668803e-001, 9.674537e-001, 9.680271e-001, 9.686005e-001, 9.691739e-001, 9.697473e-001, 9.703207e-001, 9.708941e-001, 9.714675e-001, 9.720409e-001,
+9.725995e-001, 9.731564e-001, 9.737132e-001, 9.742701e-001, 9.748270e-001, 9.753838e-001, 9.759407e-001, 9.764976e-001, 9.770544e-001, 9.776113e-001,
+9.781597e-001, 9.786923e-001, 9.792249e-001, 9.797576e-001, 9.802902e-001, 9.808228e-001, 9.813554e-001, 9.818881e-001, 9.824207e-001, 9.829533e-001,
+9.834859e-001, 9.840050e-001, 9.845179e-001, 9.850308e-001, 9.855437e-001, 9.860567e-001, 9.865696e-001, 9.870825e-001, 9.875954e-001, 9.881083e-001,
+9.886212e-001, 9.891341e-001, 9.896370e-001, 9.901389e-001, 9.906408e-001, 9.911427e-001, 9.916446e-001, 9.921465e-001, 9.926484e-001, 9.931503e-001,
+9.936522e-001, 9.941541e-001, 9.946558e-001, 9.951417e-001, 9.956275e-001, 9.961133e-001, 9.965992e-001, 9.970850e-001, 9.975708e-001, 9.980567e-001,
+9.985425e-001, 9.990283e-001, 9.995142e-001, 1.000000e+000), (), (), (), ()),
+("Eastman", "Double X Neg 5min", "graph-log-log-neg", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 3.027212e-003, 6.309420e-003, 9.817588e-003, 1.323909e-002, 1.650685e-002, 1.976173e-002, 2.300129e-002, 2.618609e-002, 2.937401e-002,
+3.259794e-002, 3.586360e-002, 3.913149e-002, 4.242523e-002, 4.573982e-002, 4.911245e-002, 5.253451e-002, 5.586069e-002, 5.915938e-002, 6.235922e-002,
+6.560639e-002, 6.880828e-002, 7.196199e-002, 7.506814e-002, 7.812416e-002, 8.113203e-002, 8.409309e-002, 8.698519e-002, 8.982695e-002, 9.265802e-002,
+9.541124e-002, 9.812688e-002, 1.008647e-001, 1.035747e-001, 1.062444e-001, 1.088568e-001, 1.114613e-001, 1.140118e-001, 1.165104e-001, 1.189729e-001,
+1.214018e-001, 1.238031e-001, 1.261426e-001, 1.285005e-001, 1.308862e-001, 1.332634e-001, 1.356559e-001, 1.380044e-001, 1.403447e-001, 1.426549e-001,
+1.449655e-001, 1.472641e-001, 1.495569e-001, 1.518307e-001, 1.540545e-001, 1.562413e-001, 1.584435e-001, 1.606242e-001, 1.627897e-001, 1.649412e-001,
+1.670478e-001, 1.691659e-001, 1.713186e-001, 1.734749e-001, 1.756159e-001, 1.777509e-001, 1.798589e-001, 1.819704e-001, 1.841047e-001, 1.862292e-001,
+1.883135e-001, 1.904103e-001, 1.924743e-001, 1.944988e-001, 1.965172e-001, 1.985401e-001, 2.005352e-001, 2.025036e-001, 2.044759e-001, 2.064372e-001,
+2.083603e-001, 2.102862e-001, 2.122135e-001, 2.141226e-001, 2.159959e-001, 2.178680e-001, 2.197511e-001, 2.216200e-001, 2.234733e-001, 2.253249e-001,
+2.271879e-001, 2.290569e-001, 2.309206e-001, 2.327876e-001, 2.346781e-001, 2.365760e-001, 2.384558e-001, 2.403216e-001, 2.421821e-001, 2.440276e-001,
+2.458492e-001, 2.476379e-001, 2.494102e-001, 2.511883e-001, 2.529624e-001, 2.547252e-001, 2.564689e-001, 2.581931e-001, 2.599115e-001, 2.616337e-001,
+2.633337e-001, 2.650091e-001, 2.666670e-001, 2.683194e-001, 2.699856e-001, 2.716381e-001, 2.732736e-001, 2.748896e-001, 2.764845e-001, 2.780745e-001,
+2.796624e-001, 2.812372e-001, 2.827902e-001, 2.843336e-001, 2.858857e-001, 2.874445e-001, 2.890089e-001, 2.905733e-001, 2.921340e-001, 2.936923e-001,
+2.952659e-001, 2.968513e-001, 2.984413e-001, 3.000228e-001, 3.015751e-001, 3.031129e-001, 3.046397e-001, 3.061711e-001, 3.077040e-001, 3.092371e-001,
+3.107507e-001, 3.122517e-001, 3.137294e-001, 3.152104e-001, 3.166939e-001, 3.181836e-001, 3.196648e-001, 3.211344e-001, 3.225882e-001, 3.240387e-001,
+3.254922e-001, 3.269437e-001, 3.283936e-001, 3.298348e-001, 3.312719e-001, 3.326954e-001, 3.341206e-001, 3.355478e-001, 3.369952e-001, 3.384498e-001,
+3.399038e-001, 3.413537e-001, 3.427904e-001, 3.442232e-001, 3.456514e-001, 3.470814e-001, 3.485123e-001, 3.499530e-001, 3.513955e-001, 3.528393e-001,
+3.542820e-001, 3.557189e-001, 3.571557e-001, 3.585921e-001, 3.600326e-001, 3.614801e-001, 3.629247e-001, 3.643658e-001, 3.657987e-001, 3.672238e-001,
+3.686500e-001, 3.700770e-001, 3.714995e-001, 3.729187e-001, 3.743285e-001, 3.757313e-001, 3.771198e-001, 3.784963e-001, 3.798680e-001, 3.812348e-001,
+3.826049e-001, 3.839793e-001, 3.853528e-001, 3.867249e-001, 3.880947e-001, 3.894569e-001, 3.908174e-001, 3.921599e-001, 3.935025e-001, 3.948426e-001,
+3.961825e-001, 3.975263e-001, 3.988716e-001, 4.002110e-001, 4.015453e-001, 4.028793e-001, 4.042125e-001, 4.055452e-001, 4.068676e-001, 4.081901e-001,
+4.095176e-001, 4.108466e-001, 4.121742e-001, 4.135002e-001, 4.148246e-001, 4.161388e-001, 4.174530e-001, 4.187706e-001, 4.200891e-001, 4.214057e-001,
+4.227195e-001, 4.240333e-001, 4.253349e-001, 4.266365e-001, 4.279261e-001, 4.292064e-001, 4.304861e-001, 4.317607e-001, 4.330352e-001, 4.343157e-001,
+4.355999e-001, 4.368842e-001, 4.381691e-001, 4.394541e-001, 4.407306e-001, 4.420006e-001, 4.432706e-001, 4.445108e-001, 4.457509e-001, 4.469895e-001,
+4.482259e-001, 4.494622e-001, 4.506839e-001, 4.519015e-001, 4.531167e-001, 4.543156e-001, 4.555146e-001, 4.567095e-001, 4.578997e-001, 4.590898e-001,
+4.602785e-001, 4.614668e-001, 4.626550e-001, 4.638503e-001, 4.650457e-001, 4.662391e-001, 4.674264e-001, 4.686136e-001, 4.697980e-001, 4.709784e-001,
+4.721589e-001, 4.733403e-001, 4.745223e-001, 4.757043e-001, 4.768934e-001, 4.780850e-001, 4.792765e-001, 4.804634e-001, 4.816495e-001, 4.828355e-001,
+4.839956e-001, 4.851538e-001, 4.863120e-001, 4.874628e-001, 4.886134e-001, 4.897641e-001, 4.909220e-001, 4.920799e-001, 4.932379e-001, 4.943912e-001,
+4.955445e-001, 4.966978e-001, 4.978221e-001, 4.989440e-001, 5.000660e-001, 5.011757e-001, 5.022831e-001, 5.033905e-001, 5.044889e-001, 5.055839e-001,
+5.066790e-001, 5.077672e-001, 5.088504e-001, 5.099336e-001, 5.110127e-001, 5.120856e-001, 5.131585e-001, 5.142298e-001, 5.152939e-001, 5.163579e-001,
+5.174219e-001, 5.184923e-001, 5.195632e-001, 5.206341e-001, 5.217061e-001, 5.227789e-001, 5.238516e-001, 5.249237e-001, 5.259944e-001, 5.270652e-001,
+5.281359e-001, 5.291953e-001, 5.302540e-001, 5.313128e-001, 5.323666e-001, 5.334163e-001, 5.344660e-001, 5.355166e-001, 5.365738e-001, 5.376310e-001,
+5.386883e-001, 5.397394e-001, 5.407870e-001, 5.418346e-001, 5.428798e-001, 5.439077e-001, 5.449357e-001, 5.459637e-001, 5.469854e-001, 5.480024e-001,
+5.490195e-001, 5.500365e-001, 5.510536e-001, 5.520708e-001, 5.530879e-001, 5.541034e-001, 5.551161e-001, 5.561288e-001, 5.571415e-001, 5.581472e-001,
+5.591498e-001, 5.601524e-001, 5.611549e-001, 5.621367e-001, 5.631184e-001, 5.641000e-001, 5.650776e-001, 5.660428e-001, 5.670081e-001, 5.679734e-001,
+5.689417e-001, 5.699135e-001, 5.708853e-001, 5.718571e-001, 5.728264e-001, 5.737943e-001, 5.747622e-001, 5.757302e-001, 5.766976e-001, 5.776649e-001,
+5.786322e-001, 5.795995e-001, 5.805698e-001, 5.815405e-001, 5.825111e-001, 5.834818e-001, 5.844539e-001, 5.854261e-001, 5.863983e-001, 5.873706e-001,
+5.883414e-001, 5.893122e-001, 5.902830e-001, 5.912537e-001, 5.922100e-001, 5.931643e-001, 5.941185e-001, 5.950728e-001, 5.960160e-001, 5.969564e-001,
+5.978967e-001, 5.988371e-001, 5.997706e-001, 6.007007e-001, 6.016308e-001, 6.025608e-001, 6.034847e-001, 6.044022e-001, 6.053198e-001, 6.062374e-001,
+6.071523e-001, 6.080606e-001, 6.089688e-001, 6.098771e-001, 6.107852e-001, 6.116871e-001, 6.125890e-001, 6.134909e-001, 6.143928e-001, 6.152886e-001,
+6.161821e-001, 6.170755e-001, 6.179690e-001, 6.188615e-001, 6.197524e-001, 6.206434e-001, 6.215343e-001, 6.224252e-001, 6.233009e-001, 6.241760e-001,
+6.250511e-001, 6.259262e-001, 6.267928e-001, 6.276514e-001, 6.285100e-001, 6.293685e-001, 6.302271e-001, 6.310850e-001, 6.319429e-001, 6.328008e-001,
+6.336587e-001, 6.345123e-001, 6.353612e-001, 6.362100e-001, 6.370588e-001, 6.379077e-001, 6.387492e-001, 6.395896e-001, 6.404300e-001, 6.412704e-001,
+6.421101e-001, 6.429476e-001, 6.437851e-001, 6.446227e-001, 6.454602e-001, 6.463015e-001, 6.471462e-001, 6.479909e-001, 6.488356e-001, 6.496803e-001,
+6.505241e-001, 6.513678e-001, 6.522115e-001, 6.530551e-001, 6.538988e-001, 6.547306e-001, 6.555623e-001, 6.563939e-001, 6.572256e-001, 6.580555e-001,
+6.588744e-001, 6.596933e-001, 6.605123e-001, 6.613312e-001, 6.621484e-001, 6.629602e-001, 6.637720e-001, 6.645838e-001, 6.653956e-001, 6.662080e-001,
+6.670223e-001, 6.678365e-001, 6.686508e-001, 6.694651e-001, 6.702783e-001, 6.710888e-001, 6.718993e-001, 6.727098e-001, 6.735203e-001, 6.743296e-001,
+6.751339e-001, 6.759383e-001, 6.767426e-001, 6.775470e-001, 6.783510e-001, 6.791514e-001, 6.799518e-001, 6.807523e-001, 6.815527e-001, 6.823531e-001,
+6.831543e-001, 6.839555e-001, 6.847568e-001, 6.855580e-001, 6.863593e-001, 6.871564e-001, 6.879516e-001, 6.887468e-001, 6.895420e-001, 6.903371e-001,
+6.911250e-001, 6.919013e-001, 6.926776e-001, 6.934539e-001, 6.942302e-001, 6.950062e-001, 6.957770e-001, 6.965478e-001, 6.973185e-001, 6.980893e-001,
+6.988600e-001, 6.996240e-001, 7.003840e-001, 7.011441e-001, 7.019041e-001, 7.026642e-001, 7.034215e-001, 7.041661e-001, 7.049108e-001, 7.056554e-001,
+7.064000e-001, 7.071447e-001, 7.078786e-001, 7.086069e-001, 7.093351e-001, 7.100634e-001, 7.107917e-001, 7.115197e-001, 7.122438e-001, 7.129679e-001,
+7.136920e-001, 7.144161e-001, 7.151402e-001, 7.158653e-001, 7.165918e-001, 7.173183e-001, 7.180448e-001, 7.187713e-001, 7.194978e-001, 7.202196e-001,
+7.209397e-001, 7.216597e-001, 7.223798e-001, 7.230999e-001, 7.238200e-001, 7.245283e-001, 7.252362e-001, 7.259441e-001, 7.266521e-001, 7.273600e-001,
+7.280663e-001, 7.287629e-001, 7.294594e-001, 7.301560e-001, 7.308526e-001, 7.315491e-001, 7.322456e-001, 7.329418e-001, 7.336380e-001, 7.343342e-001,
+7.350304e-001, 7.357266e-001, 7.364248e-001, 7.371275e-001, 7.378303e-001, 7.385330e-001, 7.392357e-001, 7.399384e-001, 7.406404e-001, 7.413404e-001,
+7.420405e-001, 7.427405e-001, 7.434405e-001, 7.441406e-001, 7.448391e-001, 7.455318e-001, 7.462245e-001, 7.469172e-001, 7.476099e-001, 7.483026e-001,
+7.489954e-001, 7.496907e-001, 7.503859e-001, 7.510811e-001, 7.517764e-001, 7.524716e-001, 7.531669e-001, 7.538705e-001, 7.545759e-001, 7.552812e-001,
+7.559866e-001, 7.566919e-001, 7.573973e-001, 7.581035e-001, 7.588103e-001, 7.595171e-001, 7.602239e-001, 7.609307e-001, 7.616376e-001, 7.623427e-001,
+7.630413e-001, 7.637399e-001, 7.644385e-001, 7.651371e-001, 7.658356e-001, 7.665342e-001, 7.672234e-001, 7.679099e-001, 7.685963e-001, 7.692828e-001,
+7.699693e-001, 7.706558e-001, 7.713416e-001, 7.720259e-001, 7.727101e-001, 7.733944e-001, 7.740787e-001, 7.747629e-001, 7.754472e-001, 7.761262e-001,
+7.768034e-001, 7.774805e-001, 7.781576e-001, 7.788347e-001, 7.795119e-001, 7.801875e-001, 7.808487e-001, 7.815100e-001, 7.821712e-001, 7.828325e-001,
+7.834938e-001, 7.841550e-001, 7.848130e-001, 7.854658e-001, 7.861186e-001, 7.867714e-001, 7.874242e-001, 7.880770e-001, 7.887298e-001, 7.893806e-001,
+7.900302e-001, 7.906798e-001, 7.913294e-001, 7.919789e-001, 7.926285e-001, 7.932781e-001, 7.939222e-001, 7.945648e-001, 7.952073e-001, 7.958499e-001,
+7.964924e-001, 7.971349e-001, 7.977775e-001, 7.984188e-001, 7.990599e-001, 7.997010e-001, 8.003420e-001, 8.009831e-001, 8.016242e-001, 8.022653e-001,
+8.028982e-001, 8.035295e-001, 8.041608e-001, 8.047922e-001, 8.054235e-001, 8.060548e-001, 8.066862e-001, 8.073113e-001, 8.079346e-001, 8.085579e-001,
+8.091812e-001, 8.098045e-001, 8.104277e-001, 8.110510e-001, 8.116706e-001, 8.122878e-001, 8.129050e-001, 8.135222e-001, 8.141395e-001, 8.147567e-001,
+8.153739e-001, 8.159894e-001, 8.166023e-001, 8.172151e-001, 8.178279e-001, 8.184408e-001, 8.190536e-001, 8.196664e-001, 8.202791e-001, 8.208893e-001,
+8.214996e-001, 8.221099e-001, 8.227202e-001, 8.233304e-001, 8.239407e-001, 8.245510e-001, 8.251606e-001, 8.257699e-001, 8.263792e-001, 8.269885e-001,
+8.275978e-001, 8.282072e-001, 8.288165e-001, 8.294250e-001, 8.300310e-001, 8.306370e-001, 8.312430e-001, 8.318490e-001, 8.324550e-001, 8.330610e-001,
+8.336669e-001, 8.342693e-001, 8.348700e-001, 8.354707e-001, 8.360714e-001, 8.366721e-001, 8.372727e-001, 8.378734e-001, 8.384737e-001, 8.390662e-001,
+8.396586e-001, 8.402511e-001, 8.408436e-001, 8.414361e-001, 8.420285e-001, 8.426210e-001, 8.432113e-001, 8.437972e-001, 8.443832e-001, 8.449691e-001,
+8.455551e-001, 8.461411e-001, 8.467270e-001, 8.473130e-001, 8.479040e-001, 8.484995e-001, 8.490949e-001, 8.496903e-001, 8.502858e-001, 8.508812e-001,
+8.514766e-001, 8.520721e-001, 8.526653e-001, 8.532573e-001, 8.538494e-001, 8.544414e-001, 8.550335e-001, 8.556255e-001, 8.562176e-001, 8.568096e-001,
+8.573905e-001, 8.579664e-001, 8.585424e-001, 8.591184e-001, 8.596943e-001, 8.602703e-001, 8.608463e-001, 8.614222e-001, 8.619980e-001, 8.625737e-001,
+8.631494e-001, 8.637250e-001, 8.643007e-001, 8.648764e-001, 8.654521e-001, 8.660277e-001, 8.666041e-001, 8.671810e-001, 8.677580e-001, 8.683350e-001,
+8.689119e-001, 8.694889e-001, 8.700659e-001, 8.706428e-001, 8.712194e-001, 8.717948e-001, 8.723702e-001, 8.729457e-001, 8.735211e-001, 8.740965e-001,
+8.746720e-001, 8.752474e-001, 8.758228e-001, 8.763950e-001, 8.769670e-001, 8.775390e-001, 8.781110e-001, 8.786830e-001, 8.792550e-001, 8.798270e-001,
+8.803990e-001, 8.809680e-001, 8.815343e-001, 8.821007e-001, 8.826671e-001, 8.832335e-001, 8.837999e-001, 8.843662e-001, 8.849326e-001, 8.854988e-001,
+8.860610e-001, 8.866233e-001, 8.871855e-001, 8.877478e-001, 8.883101e-001, 8.888723e-001, 8.894346e-001, 8.899968e-001, 8.905580e-001, 8.911178e-001,
+8.916776e-001, 8.922374e-001, 8.927972e-001, 8.933570e-001, 8.939168e-001, 8.944766e-001, 8.950364e-001, 8.955955e-001, 8.961544e-001, 8.967132e-001,
+8.972721e-001, 8.978309e-001, 8.983898e-001, 8.989487e-001, 8.995075e-001, 9.000664e-001, 9.006261e-001, 9.011857e-001, 9.017454e-001, 9.023050e-001,
+9.028647e-001, 9.034243e-001, 9.039840e-001, 9.045436e-001, 9.051036e-001, 9.056655e-001, 9.062274e-001, 9.067893e-001, 9.073512e-001, 9.079131e-001,
+9.084750e-001, 9.090369e-001, 9.095988e-001, 9.101593e-001, 9.107123e-001, 9.112653e-001, 9.118183e-001, 9.123712e-001, 9.129242e-001, 9.134772e-001,
+9.140302e-001, 9.145832e-001, 9.151351e-001, 9.156766e-001, 9.162181e-001, 9.167596e-001, 9.173010e-001, 9.178425e-001, 9.183840e-001, 9.189255e-001,
+9.194670e-001, 9.200085e-001, 9.205374e-001, 9.210654e-001, 9.215933e-001, 9.221213e-001, 9.226492e-001, 9.231772e-001, 9.237051e-001, 9.242331e-001,
+9.247610e-001, 9.252844e-001, 9.258054e-001, 9.263264e-001, 9.268475e-001, 9.273685e-001, 9.278896e-001, 9.284106e-001, 9.289316e-001, 9.294527e-001,
+9.299738e-001, 9.304951e-001, 9.310163e-001, 9.315376e-001, 9.320589e-001, 9.325802e-001, 9.331015e-001, 9.336227e-001, 9.341440e-001, 9.346653e-001,
+9.351785e-001, 9.356900e-001, 9.362015e-001, 9.367130e-001, 9.372245e-001, 9.377360e-001, 9.382475e-001, 9.387590e-001, 9.392705e-001, 9.397780e-001,
+9.402742e-001, 9.407704e-001, 9.412666e-001, 9.417628e-001, 9.422591e-001, 9.427553e-001, 9.432515e-001, 9.437477e-001, 9.442439e-001, 9.447419e-001,
+9.452412e-001, 9.457404e-001, 9.462396e-001, 9.467389e-001, 9.472381e-001, 9.477374e-001, 9.482366e-001, 9.487359e-001, 9.492351e-001, 9.497361e-001,
+9.502376e-001, 9.507390e-001, 9.512404e-001, 9.517419e-001, 9.522433e-001, 9.527448e-001, 9.532462e-001, 9.537476e-001, 9.542491e-001, 9.547459e-001,
+9.552423e-001, 9.557387e-001, 9.562352e-001, 9.567316e-001, 9.572281e-001, 9.577245e-001, 9.582209e-001, 9.587174e-001, 9.592138e-001, 9.596955e-001,
+9.601761e-001, 9.606567e-001, 9.611373e-001, 9.616180e-001, 9.620986e-001, 9.625792e-001, 9.630599e-001, 9.635405e-001, 9.640211e-001, 9.644860e-001,
+9.649479e-001, 9.654097e-001, 9.658716e-001, 9.663334e-001, 9.667953e-001, 9.672571e-001, 9.677190e-001, 9.681808e-001, 9.686427e-001, 9.691008e-001,
+9.695567e-001, 9.700127e-001, 9.704686e-001, 9.709245e-001, 9.713805e-001, 9.718364e-001, 9.722923e-001, 9.727482e-001, 9.732042e-001, 9.736584e-001,
+9.741090e-001, 9.745596e-001, 9.750102e-001, 9.754608e-001, 9.759114e-001, 9.763620e-001, 9.768125e-001, 9.772631e-001, 9.777137e-001, 9.781643e-001,
+9.786109e-001, 9.790569e-001, 9.795029e-001, 9.799490e-001, 9.803950e-001, 9.808410e-001, 9.812871e-001, 9.817331e-001, 9.821791e-001, 9.826251e-001,
+9.830691e-001, 9.835088e-001, 9.839485e-001, 9.843882e-001, 9.848279e-001, 9.852676e-001, 9.857073e-001, 9.861470e-001, 9.865867e-001, 9.870265e-001,
+9.874662e-001, 9.878935e-001, 9.883149e-001, 9.887363e-001, 9.891577e-001, 9.895791e-001, 9.900006e-001, 9.904220e-001, 9.908434e-001, 9.912648e-001,
+9.916862e-001, 9.921076e-001, 9.924956e-001, 9.928798e-001, 9.932641e-001, 9.936484e-001, 9.940327e-001, 9.944170e-001, 9.948012e-001, 9.951855e-001,
+9.955698e-001, 9.959541e-001, 9.963379e-001, 9.966708e-001, 9.970037e-001, 9.973367e-001, 9.976696e-001, 9.980025e-001, 9.983354e-001, 9.986683e-001,
+9.990012e-001, 9.993342e-001, 9.996671e-001, 1.000000e+000), (), (), (), ()),
+("Eastman", "Double X Neg 4min", "graph-log-log-neg", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.368768e-003, 5.470683e-003, 8.665179e-003, 1.201765e-002, 1.583395e-002, 1.957656e-002, 2.361593e-002, 2.763670e-002, 3.180522e-002,
+3.587205e-002, 3.990600e-002, 4.396076e-002, 4.782967e-002, 5.172732e-002, 5.559485e-002, 5.931243e-002, 6.290539e-002, 6.646926e-002, 6.998500e-002,
+7.342766e-002, 7.685074e-002, 8.016143e-002, 8.335905e-002, 8.650804e-002, 8.959577e-002, 9.264536e-002, 9.565369e-002, 9.858904e-002, 1.014889e-001,
+1.043139e-001, 1.071280e-001, 1.098439e-001, 1.126044e-001, 1.154048e-001, 1.181370e-001, 1.207929e-001, 1.234568e-001, 1.260992e-001, 1.286775e-001,
+1.312311e-001, 1.338003e-001, 1.363786e-001, 1.389156e-001, 1.414254e-001, 1.439869e-001, 1.465485e-001, 1.490968e-001, 1.516237e-001, 1.540951e-001,
+1.565377e-001, 1.589566e-001, 1.613541e-001, 1.637308e-001, 1.660850e-001, 1.684197e-001, 1.707346e-001, 1.730296e-001, 1.753066e-001, 1.775437e-001,
+1.797462e-001, 1.819387e-001, 1.841226e-001, 1.862974e-001, 1.884626e-001, 1.906191e-001, 1.927488e-001, 1.948511e-001, 1.969520e-001, 1.990513e-001,
+2.011492e-001, 2.032301e-001, 2.052827e-001, 2.073220e-001, 2.093351e-001, 2.113272e-001, 2.133180e-001, 2.153075e-001, 2.172959e-001, 2.192791e-001,
+2.212337e-001, 2.231718e-001, 2.251034e-001, 2.270285e-001, 2.289548e-001, 2.309035e-001, 2.328732e-001, 2.348370e-001, 2.367958e-001, 2.387501e-001,
+2.406919e-001, 2.426078e-001, 2.445062e-001, 2.464056e-001, 2.483084e-001, 2.502100e-001, 2.521065e-001, 2.539938e-001, 2.558684e-001, 2.577266e-001,
+2.595651e-001, 2.613836e-001, 2.631974e-001, 2.650325e-001, 2.668823e-001, 2.687313e-001, 2.705838e-001, 2.724445e-001, 2.743075e-001, 2.761450e-001,
+2.779581e-001, 2.797524e-001, 2.815275e-001, 2.832886e-001, 2.850483e-001, 2.868124e-001, 2.885822e-001, 2.903468e-001, 2.920976e-001, 2.938277e-001,
+2.955365e-001, 2.972254e-001, 2.988938e-001, 3.005305e-001, 3.021554e-001, 3.037792e-001, 3.054073e-001, 3.070621e-001, 3.087309e-001, 3.104070e-001,
+3.120704e-001, 3.137197e-001, 3.153669e-001, 3.170216e-001, 3.186618e-001, 3.202942e-001, 3.219176e-001, 3.235363e-001, 3.251608e-001, 3.267996e-001,
+3.284519e-001, 3.301032e-001, 3.317410e-001, 3.333636e-001, 3.349765e-001, 3.365670e-001, 3.381486e-001, 3.397214e-001, 3.412905e-001, 3.428558e-001,
+3.444117e-001, 3.459688e-001, 3.475268e-001, 3.490850e-001, 3.506406e-001, 3.521886e-001, 3.537278e-001, 3.552600e-001, 3.567727e-001, 3.582784e-001,
+3.597534e-001, 3.612213e-001, 3.626750e-001, 3.641249e-001, 3.655718e-001, 3.670118e-001, 3.684496e-001, 3.698936e-001, 3.713377e-001, 3.727798e-001,
+3.742179e-001, 3.756432e-001, 3.770616e-001, 3.784677e-001, 3.798623e-001, 3.812437e-001, 3.826157e-001, 3.839799e-001, 3.853353e-001, 3.866849e-001,
+3.880396e-001, 3.893971e-001, 3.907648e-001, 3.921376e-001, 3.935118e-001, 3.948867e-001, 3.962558e-001, 3.976217e-001, 3.989878e-001, 4.003542e-001,
+4.017100e-001, 4.030560e-001, 4.043888e-001, 4.057038e-001, 4.070141e-001, 4.083140e-001, 4.096129e-001, 4.109064e-001, 4.121998e-001, 4.134868e-001,
+4.147739e-001, 4.160556e-001, 4.173363e-001, 4.186184e-001, 4.199014e-001, 4.211878e-001, 4.224792e-001, 4.237694e-001, 4.250516e-001, 4.263338e-001,
+4.276081e-001, 4.288811e-001, 4.301380e-001, 4.313819e-001, 4.326207e-001, 4.338418e-001, 4.350629e-001, 4.362734e-001, 4.374822e-001, 4.386931e-001,
+4.399060e-001, 4.411189e-001, 4.423306e-001, 4.435424e-001, 4.447481e-001, 4.459505e-001, 4.471527e-001, 4.483539e-001, 4.495551e-001, 4.507592e-001,
+4.519645e-001, 4.531675e-001, 4.543609e-001, 4.555542e-001, 4.567396e-001, 4.579208e-001, 4.591009e-001, 4.602701e-001, 4.614393e-001, 4.626026e-001,
+4.637597e-001, 4.649168e-001, 4.660638e-001, 4.672092e-001, 4.683555e-001, 4.695048e-001, 4.706542e-001, 4.718030e-001, 4.729512e-001, 4.740994e-001,
+4.752403e-001, 4.763797e-001, 4.775183e-001, 4.786491e-001, 4.797799e-001, 4.809079e-001, 4.820298e-001, 4.831518e-001, 4.842692e-001, 4.853824e-001,
+4.864956e-001, 4.876026e-001, 4.887069e-001, 4.898111e-001, 4.909138e-001, 4.920163e-001, 4.931187e-001, 4.942247e-001, 4.953310e-001, 4.964371e-001,
+4.975334e-001, 4.986296e-001, 4.997261e-001, 5.008262e-001, 5.019262e-001, 5.030261e-001, 5.041244e-001, 5.052227e-001, 5.063205e-001, 5.074101e-001,
+5.084997e-001, 5.095893e-001, 5.106705e-001, 5.117518e-001, 5.128330e-001, 5.139065e-001, 5.149794e-001, 5.160522e-001, 5.171186e-001, 5.181834e-001,
+5.192482e-001, 5.203077e-001, 5.213643e-001, 5.224209e-001, 5.234770e-001, 5.245326e-001, 5.255881e-001, 5.266446e-001, 5.277037e-001, 5.287628e-001,
+5.298219e-001, 5.308707e-001, 5.319193e-001, 5.329680e-001, 5.340091e-001, 5.350470e-001, 5.360849e-001, 5.371163e-001, 5.381369e-001, 5.391575e-001,
+5.401778e-001, 5.411760e-001, 5.421741e-001, 5.431723e-001, 5.441655e-001, 5.451557e-001, 5.461459e-001, 5.471357e-001, 5.481236e-001, 5.491116e-001,
+5.500995e-001, 5.510741e-001, 5.520432e-001, 5.530123e-001, 5.539786e-001, 5.549340e-001, 5.558893e-001, 5.568446e-001, 5.578003e-001, 5.587562e-001,
+5.597121e-001, 5.606680e-001, 5.616241e-001, 5.625803e-001, 5.635365e-001, 5.644925e-001, 5.654482e-001, 5.664040e-001, 5.673597e-001, 5.683151e-001,
+5.692704e-001, 5.702256e-001, 5.711804e-001, 5.721279e-001, 5.730755e-001, 5.740230e-001, 5.749646e-001, 5.758937e-001, 5.768229e-001, 5.777520e-001,
+5.786723e-001, 5.795849e-001, 5.804976e-001, 5.814103e-001, 5.823227e-001, 5.832351e-001, 5.841474e-001, 5.850597e-001, 5.859694e-001, 5.868785e-001,
+5.877877e-001, 5.886968e-001, 5.896003e-001, 5.905033e-001, 5.914063e-001, 5.923094e-001, 5.932081e-001, 5.941068e-001, 5.950054e-001, 5.959041e-001,
+5.967945e-001, 5.976848e-001, 5.985752e-001, 5.994655e-001, 6.003587e-001, 6.012521e-001, 6.021454e-001, 6.030387e-001, 6.039313e-001, 6.048238e-001,
+6.057162e-001, 6.066087e-001, 6.074912e-001, 6.083702e-001, 6.092492e-001, 6.101281e-001, 6.109965e-001, 6.118569e-001, 6.127172e-001, 6.135776e-001,
+6.144361e-001, 6.152914e-001, 6.161466e-001, 6.170018e-001, 6.178574e-001, 6.187162e-001, 6.195750e-001, 6.204338e-001, 6.212926e-001, 6.221556e-001,
+6.230199e-001, 6.238841e-001, 6.247483e-001, 6.256137e-001, 6.264808e-001, 6.273479e-001, 6.282149e-001, 6.290820e-001, 6.299491e-001, 6.308162e-001,
+6.316833e-001, 6.325505e-001, 6.334147e-001, 6.342768e-001, 6.351390e-001, 6.360011e-001, 6.368620e-001, 6.377085e-001, 6.385550e-001, 6.394015e-001,
+6.402480e-001, 6.410933e-001, 6.419375e-001, 6.427817e-001, 6.436260e-001, 6.444702e-001, 6.453065e-001, 6.461422e-001, 6.469779e-001, 6.478136e-001,
+6.486437e-001, 6.494596e-001, 6.502756e-001, 6.510915e-001, 6.519075e-001, 6.527133e-001, 6.535121e-001, 6.543109e-001, 6.551098e-001, 6.559086e-001,
+6.566949e-001, 6.574789e-001, 6.582628e-001, 6.590468e-001, 6.598308e-001, 6.606148e-001, 6.613988e-001, 6.621828e-001, 6.629668e-001, 6.637505e-001,
+6.645327e-001, 6.653149e-001, 6.660971e-001, 6.668794e-001, 6.676582e-001, 6.684289e-001, 6.691997e-001, 6.699704e-001, 6.707411e-001, 6.715074e-001,
+6.722648e-001, 6.730222e-001, 6.737796e-001, 6.745370e-001, 6.752945e-001, 6.760522e-001, 6.768100e-001, 6.775677e-001, 6.783255e-001, 6.790840e-001,
+6.798447e-001, 6.806053e-001, 6.813660e-001, 6.821267e-001, 6.828873e-001, 6.836470e-001, 6.844068e-001, 6.851666e-001, 6.859263e-001, 6.866861e-001,
+6.874373e-001, 6.881882e-001, 6.889392e-001, 6.896901e-001, 6.904410e-001, 6.911798e-001, 6.919142e-001, 6.926485e-001, 6.933829e-001, 6.941173e-001,
+6.948506e-001, 6.955826e-001, 6.963146e-001, 6.970465e-001, 6.977785e-001, 6.985105e-001, 6.992425e-001, 6.999746e-001, 7.007066e-001, 7.014386e-001,
+7.021707e-001, 7.028998e-001, 7.036276e-001, 7.043554e-001, 7.050832e-001, 7.058110e-001, 7.065402e-001, 7.072740e-001, 7.080078e-001, 7.087416e-001,
+7.094754e-001, 7.102092e-001, 7.109381e-001, 7.116651e-001, 7.123921e-001, 7.131191e-001, 7.138461e-001, 7.145712e-001, 7.152837e-001, 7.159962e-001,
+7.167087e-001, 7.174213e-001, 7.181338e-001, 7.188458e-001, 7.195572e-001, 7.202687e-001, 7.209801e-001, 7.216915e-001, 7.224030e-001, 7.231107e-001,
+7.238175e-001, 7.245242e-001, 7.252309e-001, 7.259377e-001, 7.266442e-001, 7.273383e-001, 7.280324e-001, 7.287266e-001, 7.294207e-001, 7.301149e-001,
+7.308075e-001, 7.314937e-001, 7.321800e-001, 7.328662e-001, 7.335524e-001, 7.342386e-001, 7.349203e-001, 7.355915e-001, 7.362627e-001, 7.369339e-001,
+7.376051e-001, 7.382763e-001, 7.389467e-001, 7.396154e-001, 7.402841e-001, 7.409528e-001, 7.416215e-001, 7.422903e-001, 7.429625e-001, 7.436417e-001,
+7.443210e-001, 7.450002e-001, 7.456794e-001, 7.463587e-001, 7.470390e-001, 7.477224e-001, 7.484059e-001, 7.490894e-001, 7.497729e-001, 7.504564e-001,
+7.511396e-001, 7.518201e-001, 7.525005e-001, 7.531810e-001, 7.538614e-001, 7.545419e-001, 7.552224e-001, 7.558921e-001, 7.565605e-001, 7.572288e-001,
+7.578971e-001, 7.585655e-001, 7.592338e-001, 7.598943e-001, 7.605494e-001, 7.612045e-001, 7.618596e-001, 7.625148e-001, 7.631699e-001, 7.638274e-001,
+7.644921e-001, 7.651568e-001, 7.658215e-001, 7.664862e-001, 7.671508e-001, 7.678155e-001, 7.684821e-001, 7.691490e-001, 7.698160e-001, 7.704829e-001,
+7.711499e-001, 7.718168e-001, 7.724805e-001, 7.731374e-001, 7.737944e-001, 7.744514e-001, 7.751084e-001, 7.757654e-001, 7.764224e-001, 7.770790e-001,
+7.777354e-001, 7.783919e-001, 7.790484e-001, 7.797049e-001, 7.803613e-001, 7.810173e-001, 7.816702e-001, 7.823230e-001, 7.829759e-001, 7.836287e-001,
+7.842816e-001, 7.849345e-001, 7.855864e-001, 7.862373e-001, 7.868882e-001, 7.875390e-001, 7.881899e-001, 7.888408e-001, 7.894916e-001, 7.901494e-001,
+7.908108e-001, 7.914721e-001, 7.921335e-001, 7.927949e-001, 7.934563e-001, 7.941176e-001, 7.947735e-001, 7.954281e-001, 7.960827e-001, 7.967372e-001,
+7.973918e-001, 7.980463e-001, 7.987009e-001, 7.993466e-001, 7.999911e-001, 8.006356e-001, 8.012802e-001, 8.019247e-001, 8.025692e-001, 8.032137e-001,
+8.038467e-001, 8.044781e-001, 8.051096e-001, 8.057410e-001, 8.063725e-001, 8.070039e-001, 8.076354e-001, 8.082552e-001, 8.088722e-001, 8.094893e-001,
+8.101063e-001, 8.107234e-001, 8.113404e-001, 8.119575e-001, 8.125758e-001, 8.131948e-001, 8.138139e-001, 8.144329e-001, 8.150519e-001, 8.156709e-001,
+8.162900e-001, 8.169055e-001, 8.175162e-001, 8.181269e-001, 8.187375e-001, 8.193482e-001, 8.199589e-001, 8.205696e-001, 8.211793e-001, 8.217806e-001,
+8.223820e-001, 8.229834e-001, 8.235848e-001, 8.241862e-001, 8.247876e-001, 8.253890e-001, 8.259867e-001, 8.265830e-001, 8.271793e-001, 8.277756e-001,
+8.283720e-001, 8.289683e-001, 8.295646e-001, 8.301581e-001, 8.307437e-001, 8.313293e-001, 8.319149e-001, 8.325005e-001, 8.330861e-001, 8.336717e-001,
+8.342573e-001, 8.348430e-001, 8.354287e-001, 8.360144e-001, 8.366002e-001, 8.371859e-001, 8.377716e-001, 8.383573e-001, 8.389439e-001, 8.395407e-001,
+8.401375e-001, 8.407343e-001, 8.413311e-001, 8.419279e-001, 8.425247e-001, 8.431215e-001, 8.437164e-001, 8.443078e-001, 8.448993e-001, 8.454907e-001,
+8.460822e-001, 8.466736e-001, 8.472651e-001, 8.478565e-001, 8.484436e-001, 8.490273e-001, 8.496111e-001, 8.501949e-001, 8.507786e-001, 8.513624e-001,
+8.519461e-001, 8.525299e-001, 8.531132e-001, 8.536962e-001, 8.542792e-001, 8.548622e-001, 8.554453e-001, 8.560283e-001, 8.566113e-001, 8.571943e-001,
+8.577736e-001, 8.583513e-001, 8.589291e-001, 8.595069e-001, 8.600847e-001, 8.606625e-001, 8.612403e-001, 8.618181e-001, 8.624027e-001, 8.629906e-001,
+8.635786e-001, 8.641665e-001, 8.647545e-001, 8.653424e-001, 8.659304e-001, 8.665183e-001, 8.671081e-001, 8.676996e-001, 8.682911e-001, 8.688825e-001,
+8.694740e-001, 8.700655e-001, 8.706569e-001, 8.712484e-001, 8.718379e-001, 8.724227e-001, 8.730075e-001, 8.735923e-001, 8.741771e-001, 8.747619e-001,
+8.753467e-001, 8.759315e-001, 8.765163e-001, 8.770982e-001, 8.776800e-001, 8.782619e-001, 8.788438e-001, 8.794256e-001, 8.800075e-001, 8.805894e-001,
+8.811712e-001, 8.817477e-001, 8.823203e-001, 8.828929e-001, 8.834654e-001, 8.840380e-001, 8.846105e-001, 8.851831e-001, 8.857556e-001, 8.863283e-001,
+8.869023e-001, 8.874762e-001, 8.880502e-001, 8.886242e-001, 8.891981e-001, 8.897721e-001, 8.903460e-001, 8.909200e-001, 8.914953e-001, 8.920720e-001,
+8.926487e-001, 8.932254e-001, 8.938022e-001, 8.943789e-001, 8.949556e-001, 8.955323e-001, 8.961090e-001, 8.966785e-001, 8.972461e-001, 8.978138e-001,
+8.983815e-001, 8.989492e-001, 8.995168e-001, 9.000845e-001, 9.006522e-001, 9.012197e-001, 9.017802e-001, 9.023407e-001, 9.029012e-001, 9.034617e-001,
+9.040222e-001, 9.045827e-001, 9.051432e-001, 9.057037e-001, 9.062627e-001, 9.068132e-001, 9.073637e-001, 9.079142e-001, 9.084648e-001, 9.090153e-001,
+9.095658e-001, 9.101163e-001, 9.106668e-001, 9.112154e-001, 9.117550e-001, 9.122947e-001, 9.128343e-001, 9.133739e-001, 9.139136e-001, 9.144532e-001,
+9.149928e-001, 9.155325e-001, 9.160725e-001, 9.166155e-001, 9.171585e-001, 9.177015e-001, 9.182446e-001, 9.187876e-001, 9.193306e-001, 9.198736e-001,
+9.204166e-001, 9.209596e-001, 9.214973e-001, 9.220345e-001, 9.225718e-001, 9.231091e-001, 9.236464e-001, 9.241837e-001, 9.247209e-001, 9.252582e-001,
+9.257955e-001, 9.263282e-001, 9.268588e-001, 9.273894e-001, 9.279200e-001, 9.284505e-001, 9.289811e-001, 9.295117e-001, 9.300423e-001, 9.305728e-001,
+9.311011e-001, 9.316243e-001, 9.321475e-001, 9.326707e-001, 9.331939e-001, 9.337171e-001, 9.342403e-001, 9.347636e-001, 9.352868e-001, 9.358100e-001,
+9.363203e-001, 9.368284e-001, 9.373364e-001, 9.378444e-001, 9.383524e-001, 9.388604e-001, 9.393684e-001, 9.398765e-001, 9.403845e-001, 9.408924e-001,
+9.413999e-001, 9.419075e-001, 9.424151e-001, 9.429226e-001, 9.434302e-001, 9.439378e-001, 9.444453e-001, 9.449529e-001, 9.454604e-001, 9.459722e-001,
+9.464868e-001, 9.470014e-001, 9.475159e-001, 9.480305e-001, 9.485450e-001, 9.490596e-001, 9.495742e-001, 9.500887e-001, 9.506033e-001, 9.511143e-001,
+9.516245e-001, 9.521348e-001, 9.526450e-001, 9.531552e-001, 9.536655e-001, 9.541757e-001, 9.546859e-001, 9.551961e-001, 9.557064e-001, 9.562019e-001,
+9.566964e-001, 9.571909e-001, 9.576854e-001, 9.581799e-001, 9.586744e-001, 9.591689e-001, 9.596635e-001, 9.601580e-001, 9.606525e-001, 9.611294e-001,
+9.616053e-001, 9.620812e-001, 9.625571e-001, 9.630330e-001, 9.635089e-001, 9.639848e-001, 9.644607e-001, 9.649366e-001, 9.654124e-001, 9.658751e-001,
+9.663354e-001, 9.667957e-001, 9.672560e-001, 9.677162e-001, 9.681765e-001, 9.686368e-001, 9.690971e-001, 9.695574e-001, 9.700176e-001, 9.704771e-001,
+9.709361e-001, 9.713951e-001, 9.718541e-001, 9.723131e-001, 9.727721e-001, 9.732311e-001, 9.736901e-001, 9.741491e-001, 9.746082e-001, 9.750655e-001,
+9.755192e-001, 9.759730e-001, 9.764267e-001, 9.768804e-001, 9.773342e-001, 9.777879e-001, 9.782417e-001, 9.786954e-001, 9.791491e-001, 9.796029e-001,
+9.800477e-001, 9.804914e-001, 9.809351e-001, 9.813788e-001, 9.818225e-001, 9.822662e-001, 9.827099e-001, 9.831536e-001, 9.835973e-001, 9.840410e-001,
+9.844786e-001, 9.849042e-001, 9.853297e-001, 9.857553e-001, 9.861809e-001, 9.866065e-001, 9.870321e-001, 9.874577e-001, 9.878833e-001, 9.883089e-001,
+9.887345e-001, 9.891439e-001, 9.895456e-001, 9.899473e-001, 9.903490e-001, 9.907507e-001, 9.911524e-001, 9.915542e-001, 9.919559e-001, 9.923576e-001,
+9.927593e-001, 9.931610e-001, 9.935230e-001, 9.938808e-001, 9.942385e-001, 9.945963e-001, 9.949540e-001, 9.953117e-001, 9.956695e-001, 9.960272e-001,
+9.963850e-001, 9.967427e-001, 9.970995e-001, 9.973632e-001, 9.976268e-001, 9.978905e-001, 9.981542e-001, 9.984179e-001, 9.986816e-001, 9.989453e-001,
+9.992089e-001, 9.994726e-001, 9.997363e-001, 1.000000e+000), (), (), (), ()),
+("Kodak", "KAI-0311", "graph-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.605950e-003, 3.203936e-003, 4.792534e-003, 6.368111e-003, 7.926144e-003, 9.462075e-003, 1.097178e-002, 1.244789e-002, 1.388707e-002,
+1.529032e-002, 1.665845e-002, 1.799262e-002, 1.929522e-002, 2.056962e-002, 2.181275e-002, 2.301903e-002, 2.419361e-002, 2.534050e-002, 2.646167e-002,
+2.755891e-002, 2.863440e-002, 2.968887e-002, 3.072156e-002, 3.173547e-002, 3.273269e-002, 3.371387e-002, 3.468026e-002, 3.563369e-002, 3.657581e-002,
+3.751035e-002, 3.843922e-002, 3.936676e-002, 4.029434e-002, 4.122326e-002, 4.215438e-002, 4.308761e-002, 4.402182e-002, 4.495896e-002, 4.590019e-002,
+4.684378e-002, 4.778954e-002, 4.873755e-002, 4.968758e-002, 5.063955e-002, 5.159421e-002, 5.255258e-002, 5.351446e-002, 5.447949e-002, 5.544783e-002,
+5.641992e-002, 5.739575e-002, 5.837462e-002, 5.935756e-002, 6.034392e-002, 6.133333e-002, 6.232586e-002, 6.332190e-002, 6.432153e-002, 6.532291e-002,
+6.632609e-002, 6.733018e-002, 6.833557e-002, 6.934102e-002, 7.034620e-002, 7.135185e-002, 7.235787e-002, 7.336344e-002, 7.436848e-002, 7.537475e-002,
+7.638144e-002, 7.738792e-002, 7.839426e-002, 7.940091e-002, 8.040768e-002, 8.141276e-002, 8.241819e-002, 8.342405e-002, 8.442987e-002, 8.543525e-002,
+8.644049e-002, 8.744726e-002, 8.845390e-002, 8.946020e-002, 9.046671e-002, 9.147342e-002, 9.247953e-002, 9.348462e-002, 9.449021e-002, 9.549625e-002,
+9.650187e-002, 9.750771e-002, 9.851572e-002, 9.952596e-002, 1.005386e-001, 1.015558e-001, 1.025788e-001, 1.036100e-001, 1.046488e-001, 1.056961e-001,
+1.067530e-001, 1.078197e-001, 1.088961e-001, 1.099824e-001, 1.110826e-001, 1.121942e-001, 1.133179e-001, 1.144539e-001, 1.156023e-001, 1.167630e-001,
+1.179357e-001, 1.191223e-001, 1.203234e-001, 1.215377e-001, 1.227634e-001, 1.240004e-001, 1.252482e-001, 1.265043e-001, 1.277697e-001, 1.290420e-001,
+1.303198e-001, 1.316014e-001, 1.328858e-001, 1.341720e-001, 1.354583e-001, 1.367450e-001, 1.380295e-001, 1.393116e-001, 1.405913e-001, 1.418688e-001,
+1.431440e-001, 1.444166e-001, 1.456869e-001, 1.469539e-001, 1.482183e-001, 1.494797e-001, 1.507385e-001, 1.519940e-001, 1.532455e-001, 1.544932e-001,
+1.557371e-001, 1.569786e-001, 1.582174e-001, 1.594553e-001, 1.606920e-001, 1.619275e-001, 1.631625e-001, 1.643958e-001, 1.656282e-001, 1.668587e-001,
+1.680880e-001, 1.693165e-001, 1.705441e-001, 1.717692e-001, 1.729894e-001, 1.742039e-001, 1.754093e-001, 1.766050e-001, 1.777882e-001, 1.789582e-001,
+1.801136e-001, 1.812522e-001, 1.823735e-001, 1.834750e-001, 1.845587e-001, 1.856248e-001, 1.866753e-001, 1.877116e-001, 1.887341e-001, 1.897435e-001,
+1.907389e-001, 1.917219e-001, 1.926930e-001, 1.936533e-001, 1.946033e-001, 1.955437e-001, 1.964760e-001, 1.974004e-001, 1.983196e-001, 1.992345e-001,
+2.001473e-001, 2.010586e-001, 2.019691e-001, 2.028800e-001, 2.037911e-001, 2.047036e-001, 2.056164e-001, 2.065296e-001, 2.074444e-001, 2.083612e-001,
+2.092799e-001, 2.101999e-001, 2.111201e-001, 2.120410e-001, 2.129642e-001, 2.138909e-001, 2.148218e-001, 2.157568e-001, 2.166954e-001, 2.176383e-001,
+2.185853e-001, 2.195378e-001, 2.204961e-001, 2.214610e-001, 2.224321e-001, 2.234086e-001, 2.243913e-001, 2.253791e-001, 2.263737e-001, 2.273754e-001,
+2.283848e-001, 2.294009e-001, 2.304224e-001, 2.314487e-001, 2.324784e-001, 2.335129e-001, 2.345526e-001, 2.355960e-001, 2.366417e-001, 2.376892e-001,
+2.387382e-001, 2.397857e-001, 2.408334e-001, 2.418813e-001, 2.429291e-001, 2.439767e-001, 2.450251e-001, 2.460754e-001, 2.471273e-001, 2.481832e-001,
+2.492412e-001, 2.503012e-001, 2.513638e-001, 2.524306e-001, 2.535029e-001, 2.545805e-001, 2.556642e-001, 2.567521e-001, 2.578443e-001, 2.589425e-001,
+2.600479e-001, 2.611603e-001, 2.622781e-001, 2.634014e-001, 2.645293e-001, 2.656619e-001, 2.667997e-001, 2.679435e-001, 2.690926e-001, 2.702455e-001,
+2.714022e-001, 2.725618e-001, 2.737231e-001, 2.748859e-001, 2.760507e-001, 2.772169e-001, 2.783834e-001, 2.795505e-001, 2.807164e-001, 2.818817e-001,
+2.830451e-001, 2.842077e-001, 2.853684e-001, 2.865259e-001, 2.876792e-001, 2.888275e-001, 2.899697e-001, 2.911050e-001, 2.922331e-001, 2.933534e-001,
+2.944663e-001, 2.955725e-001, 2.966713e-001, 2.977609e-001, 2.988406e-001, 2.999116e-001, 3.009748e-001, 3.020303e-001, 3.030777e-001, 3.041163e-001,
+3.051471e-001, 3.061706e-001, 3.071884e-001, 3.082001e-001, 3.092053e-001, 3.102043e-001, 3.111982e-001, 3.121899e-001, 3.131796e-001, 3.141692e-001,
+3.151580e-001, 3.161460e-001, 3.171347e-001, 3.181253e-001, 3.191179e-001, 3.201133e-001, 3.211116e-001, 3.221124e-001, 3.231155e-001, 3.241209e-001,
+3.251287e-001, 3.261393e-001, 3.271541e-001, 3.281735e-001, 3.291964e-001, 3.302216e-001, 3.312487e-001, 3.322782e-001, 3.333105e-001, 3.343453e-001,
+3.353832e-001, 3.364242e-001, 3.374665e-001, 3.385098e-001, 3.395539e-001, 3.405987e-001, 3.416440e-001, 3.426909e-001, 3.437392e-001, 3.447869e-001,
+3.458350e-001, 3.468832e-001, 3.479309e-001, 3.489786e-001, 3.500263e-001, 3.510748e-001, 3.521224e-001, 3.531706e-001, 3.542183e-001, 3.552643e-001,
+3.563081e-001, 3.573494e-001, 3.583878e-001, 3.594241e-001, 3.604597e-001, 3.614933e-001, 3.625242e-001, 3.635517e-001, 3.645759e-001, 3.655968e-001,
+3.666146e-001, 3.676308e-001, 3.686437e-001, 3.696532e-001, 3.706598e-001, 3.716637e-001, 3.726654e-001, 3.736641e-001, 3.746609e-001, 3.756552e-001,
+3.766474e-001, 3.776386e-001, 3.786295e-001, 3.796211e-001, 3.806126e-001, 3.816056e-001, 3.825981e-001, 3.835909e-001, 3.845844e-001, 3.855786e-001,
+3.865730e-001, 3.875676e-001, 3.885631e-001, 3.895589e-001, 3.905552e-001, 3.915528e-001, 3.925519e-001, 3.935522e-001, 3.945526e-001, 3.955547e-001,
+3.965588e-001, 3.975653e-001, 3.985738e-001, 3.995841e-001, 4.005963e-001, 4.016097e-001, 4.026259e-001, 4.036449e-001, 4.046655e-001, 4.056874e-001,
+4.067110e-001, 4.077361e-001, 4.087626e-001, 4.097931e-001, 4.108272e-001, 4.118642e-001, 4.129031e-001, 4.139436e-001, 4.149854e-001, 4.160276e-001,
+4.170711e-001, 4.181162e-001, 4.191624e-001, 4.202099e-001, 4.212584e-001, 4.223066e-001, 4.233540e-001, 4.244021e-001, 4.254503e-001, 4.264976e-001,
+4.275455e-001, 4.285940e-001, 4.296421e-001, 4.306895e-001, 4.317377e-001, 4.327859e-001, 4.338331e-001, 4.348810e-001, 4.359296e-001, 4.369776e-001,
+4.380250e-001, 4.390732e-001, 4.401214e-001, 4.411686e-001, 4.422165e-001, 4.432652e-001, 4.443131e-001, 4.453606e-001, 4.464088e-001, 4.474569e-001,
+4.485041e-001, 4.495521e-001, 4.506008e-001, 4.516486e-001, 4.526961e-001, 4.537443e-001, 4.547924e-001, 4.558396e-001, 4.568876e-001, 4.579363e-001,
+4.589840e-001, 4.600317e-001, 4.610798e-001, 4.621279e-001, 4.631751e-001, 4.642232e-001, 4.652719e-001, 4.663195e-001, 4.673672e-001, 4.684154e-001,
+4.694634e-001, 4.705107e-001, 4.715587e-001, 4.726075e-001, 4.736550e-001, 4.747028e-001, 4.757509e-001, 4.767989e-001, 4.778462e-001, 4.788942e-001,
+4.799431e-001, 4.809905e-001, 4.820383e-001, 4.830865e-001, 4.841343e-001, 4.851817e-001, 4.862298e-001, 4.872787e-001, 4.883260e-001, 4.893738e-001,
+4.904220e-001, 4.914698e-001, 4.925173e-001, 4.935654e-001, 4.946143e-001, 4.956615e-001, 4.967094e-001, 4.977576e-001, 4.988053e-001, 4.998528e-001,
+5.009010e-001, 5.019498e-001, 5.029969e-001, 5.040449e-001, 5.050931e-001, 5.061408e-001, 5.071883e-001, 5.082366e-001, 5.092853e-001, 5.103324e-001,
+5.113805e-001, 5.124287e-001, 5.134763e-001, 5.145239e-001, 5.155722e-001, 5.166208e-001, 5.176679e-001, 5.187160e-001, 5.197642e-001, 5.208118e-001,
+5.218594e-001, 5.229077e-001, 5.239563e-001, 5.250034e-001, 5.260516e-001, 5.270998e-001, 5.281473e-001, 5.291950e-001, 5.302433e-001, 5.312918e-001,
+5.323390e-001, 5.333871e-001, 5.344353e-001, 5.354828e-001, 5.365305e-001, 5.375789e-001, 5.386273e-001, 5.396745e-001, 5.407227e-001, 5.417709e-001,
+5.428183e-001, 5.438660e-001, 5.449145e-001, 5.459627e-001, 5.470100e-001, 5.480582e-001, 5.491064e-001, 5.501538e-001, 5.512016e-001, 5.522501e-001,
+5.532982e-001, 5.543456e-001, 5.553937e-001, 5.564420e-001, 5.574893e-001, 5.585371e-001, 5.595857e-001, 5.606337e-001, 5.616811e-001, 5.627293e-001,
+5.637775e-001, 5.648247e-001, 5.658726e-001, 5.669212e-001, 5.679692e-001, 5.690164e-001, 5.700634e-001, 5.711092e-001, 5.721534e-001, 5.731965e-001,
+5.742385e-001, 5.752782e-001, 5.763154e-001, 5.773493e-001, 5.783769e-001, 5.793967e-001, 5.804105e-001, 5.814169e-001, 5.824149e-001, 5.834048e-001,
+5.843869e-001, 5.853602e-001, 5.863254e-001, 5.872826e-001, 5.882346e-001, 5.891797e-001, 5.901175e-001, 5.910484e-001, 5.919718e-001, 5.928867e-001,
+5.937937e-001, 5.946958e-001, 5.955929e-001, 5.964864e-001, 5.973765e-001, 5.982631e-001, 5.991475e-001, 6.000298e-001, 6.009126e-001, 6.017951e-001,
+6.026778e-001, 6.035615e-001, 6.044463e-001, 6.053317e-001, 6.062174e-001, 6.071027e-001, 6.079886e-001, 6.088756e-001, 6.097621e-001, 6.106480e-001,
+6.115352e-001, 6.124257e-001, 6.133217e-001, 6.142217e-001, 6.151272e-001, 6.160376e-001, 6.169527e-001, 6.178737e-001, 6.188027e-001, 6.197397e-001,
+6.206821e-001, 6.216303e-001, 6.225834e-001, 6.235426e-001, 6.245095e-001, 6.254850e-001, 6.264699e-001, 6.274636e-001, 6.284655e-001, 6.294741e-001,
+6.304890e-001, 6.315107e-001, 6.325399e-001, 6.335755e-001, 6.346142e-001, 6.356560e-001, 6.366982e-001, 6.377419e-001, 6.387875e-001, 6.398347e-001,
+6.408824e-001, 6.419300e-001, 6.429791e-001, 6.440269e-001, 6.450746e-001, 6.461224e-001, 6.471703e-001, 6.482180e-001, 6.492655e-001, 6.503147e-001,
+6.513624e-001, 6.524101e-001, 6.534579e-001, 6.545058e-001, 6.555535e-001, 6.566011e-001, 6.576503e-001, 6.586980e-001, 6.597456e-001, 6.607935e-001,
+6.618413e-001, 6.628890e-001, 6.639367e-001, 6.649859e-001, 6.660335e-001, 6.670812e-001, 6.681290e-001, 6.691768e-001, 6.702245e-001, 6.712723e-001,
+6.723214e-001, 6.733690e-001, 6.744167e-001, 6.754645e-001, 6.765123e-001, 6.775600e-001, 6.786079e-001, 6.796569e-001, 6.807045e-001, 6.817514e-001,
+6.827966e-001, 6.838403e-001, 6.848835e-001, 6.859274e-001, 6.869724e-001, 6.880163e-001, 6.890600e-001, 6.901013e-001, 6.911397e-001, 6.921761e-001,
+6.932122e-001, 6.942488e-001, 6.952843e-001, 6.963181e-001, 6.973489e-001, 6.983771e-001, 6.994027e-001, 7.004273e-001, 7.014517e-001, 7.024747e-001,
+7.034965e-001, 7.045165e-001, 7.055343e-001, 7.065514e-001, 7.075693e-001, 7.085879e-001, 7.096057e-001, 7.106239e-001, 7.116402e-001, 7.126544e-001,
+7.136672e-001, 7.146798e-001, 7.156929e-001, 7.167074e-001, 7.177237e-001, 7.187397e-001, 7.197557e-001, 7.207709e-001, 7.217856e-001, 7.227994e-001,
+7.238122e-001, 7.248240e-001, 7.258350e-001, 7.268440e-001, 7.278504e-001, 7.288549e-001, 7.298565e-001, 7.308546e-001, 7.318492e-001, 7.328398e-001,
+7.338245e-001, 7.348057e-001, 7.357833e-001, 7.367560e-001, 7.377242e-001, 7.386889e-001, 7.396496e-001, 7.406046e-001, 7.415548e-001, 7.425006e-001,
+7.434420e-001, 7.443799e-001, 7.453151e-001, 7.462482e-001, 7.471804e-001, 7.481108e-001, 7.490396e-001, 7.499658e-001, 7.508904e-001, 7.518150e-001,
+7.527398e-001, 7.536644e-001, 7.545883e-001, 7.555134e-001, 7.564398e-001, 7.573670e-001, 7.582947e-001, 7.592232e-001, 7.601537e-001, 7.610865e-001,
+7.620201e-001, 7.629552e-001, 7.638924e-001, 7.648314e-001, 7.657712e-001, 7.667115e-001, 7.676536e-001, 7.685970e-001, 7.695416e-001, 7.704880e-001,
+7.714353e-001, 7.723832e-001, 7.733323e-001, 7.742838e-001, 7.752370e-001, 7.761910e-001, 7.771470e-001, 7.781039e-001, 7.790614e-001, 7.800199e-001,
+7.809798e-001, 7.819412e-001, 7.829020e-001, 7.838629e-001, 7.848243e-001, 7.857862e-001, 7.867478e-001, 7.877084e-001, 7.886681e-001, 7.896275e-001,
+7.905865e-001, 7.915449e-001, 7.925025e-001, 7.934594e-001, 7.944152e-001, 7.953701e-001, 7.963243e-001, 7.972785e-001, 7.982317e-001, 7.991853e-001,
+8.001390e-001, 8.010920e-001, 8.020442e-001, 8.029962e-001, 8.039493e-001, 8.049013e-001, 8.058535e-001, 8.068069e-001, 8.077615e-001, 8.087172e-001,
+8.096737e-001, 8.106311e-001, 8.115899e-001, 8.125505e-001, 8.135117e-001, 8.144731e-001, 8.154355e-001, 8.163996e-001, 8.173645e-001, 8.183292e-001,
+8.192948e-001, 8.202611e-001, 8.212278e-001, 8.221949e-001, 8.231618e-001, 8.241284e-001, 8.250943e-001, 8.260607e-001, 8.270269e-001, 8.279933e-001,
+8.289610e-001, 8.299307e-001, 8.309033e-001, 8.318770e-001, 8.328525e-001, 8.338283e-001, 8.348055e-001, 8.357861e-001, 8.367712e-001, 8.377606e-001,
+8.387532e-001, 8.397489e-001, 8.407462e-001, 8.417473e-001, 8.427533e-001, 8.437642e-001, 8.447790e-001, 8.457974e-001, 8.468208e-001, 8.478457e-001,
+8.488734e-001, 8.499054e-001, 8.509420e-001, 8.519824e-001, 8.530251e-001, 8.540698e-001, 8.551143e-001, 8.561593e-001, 8.572056e-001, 8.582529e-001,
+8.593006e-001, 8.603483e-001, 8.613974e-001, 8.624451e-001, 8.634921e-001, 8.645371e-001, 8.655791e-001, 8.666180e-001, 8.676548e-001, 8.686901e-001,
+8.697226e-001, 8.707529e-001, 8.717788e-001, 8.728000e-001, 8.738168e-001, 8.748298e-001, 8.758404e-001, 8.768458e-001, 8.778471e-001, 8.788425e-001,
+8.798324e-001, 8.808173e-001, 8.817984e-001, 8.827770e-001, 8.837513e-001, 8.847230e-001, 8.856912e-001, 8.866553e-001, 8.876157e-001, 8.885743e-001,
+8.895330e-001, 8.904910e-001, 8.914487e-001, 8.924051e-001, 8.933604e-001, 8.943152e-001, 8.952694e-001, 8.962223e-001, 8.971733e-001, 8.981228e-001,
+8.990686e-001, 9.000113e-001, 9.009503e-001, 9.018849e-001, 9.028136e-001, 9.037344e-001, 9.046464e-001, 9.055463e-001, 9.064350e-001, 9.073122e-001,
+9.081791e-001, 9.090357e-001, 9.098810e-001, 9.107148e-001, 9.115345e-001, 9.123430e-001, 9.131418e-001, 9.139323e-001, 9.147145e-001, 9.154878e-001,
+9.162528e-001, 9.170092e-001, 9.177588e-001, 9.185021e-001, 9.192394e-001, 9.199714e-001, 9.206994e-001, 9.214247e-001, 9.221467e-001, 9.228669e-001,
+9.235867e-001, 9.243061e-001, 9.250256e-001, 9.257463e-001, 9.264692e-001, 9.271946e-001, 9.279210e-001, 9.286499e-001, 9.293829e-001, 9.301196e-001,
+9.308602e-001, 9.316061e-001, 9.323577e-001, 9.331134e-001, 9.338729e-001, 9.346381e-001, 9.354091e-001, 9.361863e-001, 9.369704e-001, 9.377611e-001,
+9.385566e-001, 9.393566e-001, 9.401629e-001, 9.409752e-001, 9.417932e-001, 9.426163e-001, 9.434437e-001, 9.442740e-001, 9.451068e-001, 9.459424e-001,
+9.467787e-001, 9.476162e-001, 9.484548e-001, 9.492936e-001, 9.501317e-001, 9.509698e-001, 9.518089e-001, 9.526467e-001, 9.534838e-001, 9.543187e-001,
+9.551492e-001, 9.559733e-001, 9.567909e-001, 9.575985e-001, 9.583952e-001, 9.591815e-001, 9.599570e-001, 9.607215e-001, 9.614745e-001, 9.622160e-001,
+9.629416e-001, 9.636478e-001, 9.643381e-001, 9.650137e-001, 9.656763e-001, 9.663272e-001, 9.669669e-001, 9.675945e-001, 9.682069e-001, 9.688068e-001,
+9.693956e-001, 9.699756e-001, 9.705489e-001, 9.711167e-001, 9.716788e-001, 9.722322e-001, 9.727812e-001, 9.733269e-001, 9.738715e-001, 9.744166e-001,
+9.749621e-001, 9.755073e-001, 9.760522e-001, 9.765971e-001, 9.771424e-001, 9.776894e-001, 9.782382e-001, 9.787877e-001, 9.793368e-001, 9.798851e-001,
+9.804324e-001, 9.809778e-001, 9.815200e-001, 9.820588e-001, 9.825944e-001, 9.831265e-001, 9.836531e-001, 9.841737e-001, 9.846892e-001, 9.851981e-001,
+9.857001e-001, 9.861956e-001, 9.866848e-001, 9.871674e-001, 9.876440e-001, 9.881147e-001, 9.885799e-001, 9.890390e-001, 9.894917e-001, 9.899381e-001,
+9.903784e-001, 9.908132e-001, 9.912436e-001, 9.916706e-001, 9.920944e-001, 9.925168e-001, 9.929387e-001, 9.933599e-001, 9.937797e-001, 9.941994e-001,
+9.946184e-001, 9.950373e-001, 9.954560e-001, 9.958733e-001, 9.962889e-001, 9.967045e-001, 9.971199e-001, 9.975343e-001, 9.979482e-001, 9.983613e-001,
+9.987732e-001, 9.991838e-001, 9.995930e-001, 1.000000e+000), (), (), (), ()),
+("Kodak", "KAF-2001", "graph-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 7.931371e-004, 1.635517e-003, 2.550380e-003, 3.514624e-003, 4.527323e-003, 5.571522e-003, 6.644278e-003, 7.733925e-003, 8.836574e-003,
+9.944812e-003, 1.105454e-002, 1.216339e-002, 1.326608e-002, 1.436079e-002, 1.544472e-002, 1.651356e-002, 1.755636e-002, 1.856885e-002, 1.953350e-002,
+2.045696e-002, 2.135137e-002, 2.223388e-002, 2.311262e-002, 2.399209e-002, 2.487059e-002, 2.574433e-002, 2.660809e-002, 2.745746e-002, 2.828679e-002,
+2.909992e-002, 2.990877e-002, 3.072239e-002, 3.155028e-002, 3.239309e-002, 3.325378e-002, 3.413444e-002, 3.503811e-002, 3.596684e-002, 3.692468e-002,
+3.791540e-002, 3.894008e-002, 4.000401e-002, 4.111243e-002, 4.226938e-002, 4.346940e-002, 4.470563e-002, 4.596654e-002, 4.724292e-002, 4.852443e-002,
+4.980288e-002, 5.107695e-002, 5.235132e-002, 5.363444e-002, 5.492933e-002, 5.623518e-002, 5.754654e-002, 5.885509e-002, 6.015285e-002, 6.143606e-002,
+6.269173e-002, 6.391527e-002, 6.508843e-002, 6.620793e-002, 6.726801e-002, 6.827743e-002, 6.923171e-002, 7.014254e-002, 7.100244e-002, 7.182128e-002,
+7.259770e-002, 7.334371e-002, 7.405619e-002, 7.474470e-002, 7.540965e-002, 7.606336e-002, 7.671567e-002, 7.737660e-002, 7.805840e-002, 7.876288e-002,
+7.949798e-002, 8.026262e-002, 8.106546e-002, 8.190492e-002, 8.278997e-002, 8.371924e-002, 8.470321e-002, 8.574423e-002, 8.686116e-002, 8.804509e-002,
+8.929957e-002, 9.061117e-002, 9.197373e-002, 9.337125e-002, 9.479468e-002, 9.623122e-002, 9.767078e-002, 9.910162e-002, 1.005088e-001, 1.018796e-001,
+1.031992e-001, 1.044577e-001, 1.056413e-001, 1.067343e-001, 1.077464e-001, 1.087004e-001, 1.096138e-001, 1.104959e-001, 1.113546e-001, 1.121921e-001,
+1.130078e-001, 1.137993e-001, 1.145686e-001, 1.153164e-001, 1.160470e-001, 1.167627e-001, 1.174699e-001, 1.181748e-001, 1.188858e-001, 1.196159e-001,
+1.203754e-001, 1.211868e-001, 1.220536e-001, 1.229867e-001, 1.239702e-001, 1.250043e-001, 1.260708e-001, 1.271626e-001, 1.282667e-001, 1.293744e-001,
+1.304753e-001, 1.315566e-001, 1.326127e-001, 1.336388e-001, 1.346349e-001, 1.355908e-001, 1.365200e-001, 1.374217e-001, 1.383025e-001, 1.391608e-001,
+1.400026e-001, 1.408286e-001, 1.416438e-001, 1.424540e-001, 1.432685e-001, 1.440957e-001, 1.449375e-001, 1.457988e-001, 1.466776e-001, 1.475750e-001,
+1.484852e-001, 1.494164e-001, 1.503666e-001, 1.513418e-001, 1.523495e-001, 1.534101e-001, 1.545234e-001, 1.556780e-001, 1.568566e-001, 1.580476e-001,
+1.592365e-001, 1.604065e-001, 1.615456e-001, 1.626374e-001, 1.636672e-001, 1.646257e-001, 1.655282e-001, 1.663973e-001, 1.672483e-001, 1.680918e-001,
+1.689291e-001, 1.697597e-001, 1.705809e-001, 1.713818e-001, 1.721594e-001, 1.729160e-001, 1.736538e-001, 1.743783e-001, 1.750948e-001, 1.758113e-001,
+1.765365e-001, 1.772824e-001, 1.780716e-001, 1.789128e-001, 1.798152e-001, 1.807665e-001, 1.817690e-001, 1.828158e-001, 1.839096e-001, 1.850428e-001,
+1.862191e-001, 1.874303e-001, 1.886713e-001, 1.899241e-001, 1.911779e-001, 1.924244e-001, 1.936573e-001, 1.948783e-001, 1.960881e-001, 1.972880e-001,
+1.984703e-001, 1.996253e-001, 2.007281e-001, 2.017629e-001, 2.027095e-001, 2.036040e-001, 2.044609e-001, 2.053059e-001, 2.061520e-001, 2.070065e-001,
+2.078751e-001, 2.087563e-001, 2.096407e-001, 2.105237e-001, 2.113940e-001, 2.122494e-001, 2.130886e-001, 2.139183e-001, 2.147480e-001, 2.155908e-001,
+2.164691e-001, 2.174035e-001, 2.184235e-001, 2.195229e-001, 2.206816e-001, 2.218745e-001, 2.230866e-001, 2.243079e-001, 2.255353e-001, 2.267691e-001,
+2.280129e-001, 2.292631e-001, 2.305142e-001, 2.317567e-001, 2.329764e-001, 2.341637e-001, 2.353121e-001, 2.364190e-001, 2.374806e-001, 2.384950e-001,
+2.394601e-001, 2.403741e-001, 2.412285e-001, 2.420234e-001, 2.427742e-001, 2.435000e-001, 2.442154e-001, 2.449319e-001, 2.456567e-001, 2.463952e-001,
+2.471494e-001, 2.479220e-001, 2.487130e-001, 2.495251e-001, 2.503562e-001, 2.512076e-001, 2.520760e-001, 2.529664e-001, 2.538854e-001, 2.548437e-001,
+2.558579e-001, 2.569624e-001, 2.581419e-001, 2.593898e-001, 2.606801e-001, 2.619998e-001, 2.633246e-001, 2.646321e-001, 2.659066e-001, 2.671222e-001,
+2.682681e-001, 2.693216e-001, 2.703152e-001, 2.712578e-001, 2.721710e-001, 2.730555e-001, 2.739251e-001, 2.747743e-001, 2.756055e-001, 2.764146e-001,
+2.772052e-001, 2.779743e-001, 2.787271e-001, 2.794635e-001, 2.801891e-001, 2.809084e-001, 2.816320e-001, 2.823747e-001, 2.831506e-001, 2.839821e-001,
+2.848650e-001, 2.858025e-001, 2.867873e-001, 2.878227e-001, 2.889022e-001, 2.900270e-001, 2.911931e-001, 2.923979e-001, 2.936301e-001, 2.948762e-001,
+2.961242e-001, 2.973629e-001, 2.985885e-001, 2.998012e-001, 3.010048e-001, 3.021971e-001, 3.033717e-001, 3.045162e-001, 3.056160e-001, 3.066502e-001,
+3.076124e-001, 3.085129e-001, 3.093748e-001, 3.102149e-001, 3.110444e-001, 3.118738e-001, 3.127109e-001, 3.135590e-001, 3.144189e-001, 3.152843e-001,
+3.161521e-001, 3.170175e-001, 3.178756e-001, 3.187315e-001, 3.195927e-001, 3.204681e-001, 3.213740e-001, 3.223293e-001, 3.233570e-001, 3.244508e-001,
+3.255977e-001, 3.267757e-001, 3.279757e-001, 3.291803e-001, 3.303748e-001, 3.315485e-001, 3.326844e-001, 3.337798e-001, 3.348153e-001, 3.358032e-001,
+3.367349e-001, 3.376191e-001, 3.384444e-001, 3.392321e-001, 3.399784e-001, 3.406945e-001, 3.413781e-001, 3.420387e-001, 3.426808e-001, 3.433163e-001,
+3.439547e-001, 3.446054e-001, 3.452802e-001, 3.459803e-001, 3.467136e-001, 3.474790e-001, 3.482856e-001, 3.491323e-001, 3.500329e-001, 3.509812e-001,
+3.519835e-001, 3.530360e-001, 3.541389e-001, 3.552892e-001, 3.564738e-001, 3.576740e-001, 3.588740e-001, 3.600646e-001, 3.612403e-001, 3.623970e-001,
+3.635293e-001, 3.646346e-001, 3.657100e-001, 3.667556e-001, 3.677705e-001, 3.687557e-001, 3.697126e-001, 3.706438e-001, 3.715596e-001, 3.724690e-001,
+3.733773e-001, 3.742753e-001, 3.751675e-001, 3.760527e-001, 3.769319e-001, 3.778083e-001, 3.786880e-001, 3.795790e-001, 3.804906e-001, 3.814408e-001,
+3.824322e-001, 3.834637e-001, 3.845176e-001, 3.855883e-001, 3.866709e-001, 3.877635e-001, 3.888686e-001, 3.899910e-001, 3.911277e-001, 3.922776e-001,
+3.934313e-001, 3.945827e-001, 3.957261e-001, 3.968505e-001, 3.979482e-001, 3.990121e-001, 4.000468e-001, 4.010437e-001, 4.020088e-001, 4.029388e-001,
+4.038451e-001, 4.047275e-001, 4.055930e-001, 4.064427e-001, 4.072813e-001, 4.081072e-001, 4.089261e-001, 4.097452e-001, 4.105695e-001, 4.114066e-001,
+4.122570e-001, 4.131241e-001, 4.140050e-001, 4.148985e-001, 4.158009e-001, 4.167236e-001, 4.176675e-001, 4.186492e-001, 4.196804e-001, 4.207775e-001,
+4.219252e-001, 4.231063e-001, 4.243053e-001, 4.255081e-001, 4.267005e-001, 4.278687e-001, 4.290013e-001, 4.300687e-001, 4.310569e-001, 4.319737e-001,
+4.328454e-001, 4.336950e-001, 4.345388e-001, 4.353840e-001, 4.362317e-001, 4.370762e-001, 4.379086e-001, 4.387196e-001, 4.395041e-001, 4.402616e-001,
+4.409970e-001, 4.417151e-001, 4.424204e-001, 4.431224e-001, 4.438334e-001, 4.445699e-001, 4.453584e-001, 4.462081e-001, 4.471252e-001, 4.480919e-001,
+4.491103e-001, 4.501725e-001, 4.512811e-001, 4.524315e-001, 4.536259e-001, 4.548499e-001, 4.561011e-001, 4.573645e-001, 4.586338e-001, 4.599034e-001,
+4.611745e-001, 4.624509e-001, 4.637392e-001, 4.650415e-001, 4.663578e-001, 4.676811e-001, 4.690015e-001, 4.703140e-001, 4.716050e-001, 4.728696e-001,
+4.740908e-001, 4.752692e-001, 4.763814e-001, 4.774328e-001, 4.784271e-001, 4.793925e-001, 4.803339e-001, 4.812592e-001, 4.821657e-001, 4.830562e-001,
+4.839268e-001, 4.847800e-001, 4.856150e-001, 4.864366e-001, 4.872507e-001, 4.880649e-001, 4.888869e-001, 4.897224e-001, 4.905739e-001, 4.914413e-001,
+4.923292e-001, 4.932385e-001, 4.941751e-001, 4.951438e-001, 4.961484e-001, 4.971834e-001, 4.982457e-001, 4.993270e-001, 5.004199e-001, 5.015118e-001,
+5.025908e-001, 5.036478e-001, 5.046734e-001, 5.056590e-001, 5.065952e-001, 5.074754e-001, 5.082964e-001, 5.090650e-001, 5.098019e-001, 5.105222e-001,
+5.112395e-001, 5.119636e-001, 5.126994e-001, 5.134509e-001, 5.142197e-001, 5.150090e-001, 5.158177e-001, 5.166478e-001, 5.174968e-001, 5.183657e-001,
+5.192511e-001, 5.201654e-001, 5.211125e-001, 5.221105e-001, 5.231736e-001, 5.243277e-001, 5.255516e-001, 5.268324e-001, 5.281450e-001, 5.294731e-001,
+5.307943e-001, 5.320841e-001, 5.333307e-001, 5.345025e-001, 5.355963e-001, 5.366004e-001, 5.375566e-001, 5.384708e-001, 5.393585e-001, 5.402260e-001,
+5.410858e-001, 5.419417e-001, 5.427981e-001, 5.436624e-001, 5.445290e-001, 5.453966e-001, 5.462578e-001, 5.471146e-001, 5.479719e-001, 5.488394e-001,
+5.497274e-001, 5.506578e-001, 5.516471e-001, 5.527127e-001, 5.538355e-001, 5.549985e-001, 5.561833e-001, 5.573829e-001, 5.585943e-001, 5.598186e-001,
+5.610555e-001, 5.623053e-001, 5.635616e-001, 5.648146e-001, 5.660512e-001, 5.672566e-001, 5.684217e-001, 5.695446e-001, 5.706258e-001, 5.716617e-001,
+5.726499e-001, 5.735876e-001, 5.744670e-001, 5.752795e-001, 5.760352e-001, 5.767551e-001, 5.774592e-001, 5.781628e-001, 5.788755e-001, 5.796039e-001,
+5.803539e-001, 5.811277e-001, 5.819322e-001, 5.827585e-001, 5.836038e-001, 5.844543e-001, 5.853050e-001, 5.861506e-001, 5.869960e-001, 5.878554e-001,
+5.887522e-001, 5.897055e-001, 5.907446e-001, 5.918523e-001, 5.930092e-001, 5.941921e-001, 5.953929e-001, 5.965957e-001, 5.977848e-001, 5.989492e-001,
+6.000605e-001, 6.011225e-001, 6.021242e-001, 6.030789e-001, 6.039802e-001, 6.048384e-001, 6.056500e-001, 6.064301e-001, 6.071758e-001, 6.078961e-001,
+6.085895e-001, 6.092637e-001, 6.099225e-001, 6.105782e-001, 6.112405e-001, 6.119178e-001, 6.126191e-001, 6.133442e-001, 6.141007e-001, 6.148883e-001,
+6.157158e-001, 6.165836e-001, 6.175036e-001, 6.184764e-001, 6.195145e-001, 6.206190e-001, 6.218030e-001, 6.230566e-001, 6.243700e-001, 6.257280e-001,
+6.271185e-001, 6.285330e-001, 6.299641e-001, 6.314023e-001, 6.328353e-001, 6.342498e-001, 6.356308e-001, 6.369662e-001, 6.382427e-001, 6.394453e-001,
+6.405580e-001, 6.415868e-001, 6.425543e-001, 6.434767e-001, 6.443691e-001, 6.452344e-001, 6.460804e-001, 6.469036e-001, 6.477041e-001, 6.484808e-001,
+6.492365e-001, 6.499712e-001, 6.506898e-001, 6.513957e-001, 6.520954e-001, 6.527956e-001, 6.535081e-001, 6.542479e-001, 6.550296e-001, 6.558724e-001,
+6.567714e-001, 6.577283e-001, 6.587335e-001, 6.597932e-001, 6.608968e-001, 6.620493e-001, 6.632428e-001, 6.644775e-001, 6.657374e-001, 6.670100e-001,
+6.682801e-001, 6.695360e-001, 6.707767e-001, 6.719986e-001, 6.732080e-001, 6.743973e-001, 6.755646e-001, 6.766923e-001, 6.777757e-001, 6.787838e-001,
+6.797292e-001, 6.806203e-001, 6.814812e-001, 6.823215e-001, 6.831535e-001, 6.839842e-001, 6.848192e-001, 6.856622e-001, 6.865147e-001, 6.873625e-001,
+6.882052e-001, 6.890435e-001, 6.898779e-001, 6.907152e-001, 6.915640e-001, 6.924375e-001, 6.933465e-001, 6.943173e-001, 6.953550e-001, 6.964593e-001,
+6.976082e-001, 6.987894e-001, 6.999888e-001, 7.011907e-001, 7.023808e-001, 7.035447e-001, 7.046696e-001, 7.057372e-001, 7.067508e-001, 7.077292e-001,
+7.086814e-001, 7.096116e-001, 7.105264e-001, 7.114247e-001, 7.123048e-001, 7.131667e-001, 7.140098e-001, 7.148375e-001, 7.156538e-001, 7.164677e-001,
+7.172847e-001, 7.181129e-001, 7.189571e-001, 7.198164e-001, 7.206944e-001, 7.215925e-001, 7.225160e-001, 7.234673e-001, 7.244563e-001, 7.254764e-001,
+7.265271e-001, 7.275998e-001, 7.286886e-001, 7.297828e-001, 7.308688e-001, 7.319386e-001, 7.329789e-001, 7.339875e-001, 7.349455e-001, 7.358559e-001,
+7.367025e-001, 7.374975e-001, 7.382443e-001, 7.389717e-001, 7.396887e-001, 7.404084e-001, 7.411384e-001, 7.418810e-001, 7.426424e-001, 7.434210e-001,
+7.442209e-001, 7.450360e-001, 7.458640e-001, 7.466969e-001, 7.475344e-001, 7.483780e-001, 7.492404e-001, 7.501326e-001, 7.510781e-001, 7.520893e-001,
+7.531733e-001, 7.543053e-001, 7.554740e-001, 7.566643e-001, 7.578608e-001, 7.590483e-001, 7.602115e-001, 7.613403e-001, 7.624225e-001, 7.634521e-001,
+7.644327e-001, 7.653705e-001, 7.662619e-001, 7.671076e-001, 7.679154e-001, 7.686895e-001, 7.694332e-001, 7.701492e-001, 7.708417e-001, 7.715177e-001,
+7.721850e-001, 7.728538e-001, 7.735336e-001, 7.742336e-001, 7.749583e-001, 7.757119e-001, 7.764956e-001, 7.773145e-001, 7.781694e-001, 7.790682e-001,
+7.800117e-001, 7.810093e-001, 7.820672e-001, 7.831970e-001, 7.843931e-001, 7.856580e-001, 7.869744e-001, 7.883391e-001, 7.897359e-001, 7.911605e-001,
+7.926027e-001, 7.940539e-001, 7.954995e-001, 7.969206e-001, 7.983062e-001, 7.996307e-001, 8.008907e-001, 8.020378e-001, 8.030901e-001, 8.040466e-001,
+8.049608e-001, 8.058419e-001, 8.067099e-001, 8.075735e-001, 8.084388e-001, 8.093092e-001, 8.101883e-001, 8.110724e-001, 8.119565e-001, 8.128302e-001,
+8.136908e-001, 8.145390e-001, 8.153828e-001, 8.162343e-001, 8.171086e-001, 8.180341e-001, 8.190287e-001, 8.201074e-001, 8.212433e-001, 8.224158e-001,
+8.236095e-001, 8.248127e-001, 8.260108e-001, 8.271878e-001, 8.283282e-001, 8.294121e-001, 8.304438e-001, 8.314199e-001, 8.323469e-001, 8.332255e-001,
+8.340583e-001, 8.348532e-001, 8.356149e-001, 8.363471e-001, 8.370530e-001, 8.377360e-001, 8.384007e-001, 8.390572e-001, 8.397147e-001, 8.403840e-001,
+8.410734e-001, 8.417865e-001, 8.425278e-001, 8.432994e-001, 8.441076e-001, 8.449550e-001, 8.458500e-001, 8.467942e-001, 8.477940e-001, 8.488483e-001,
+8.499672e-001, 8.511454e-001, 8.523722e-001, 8.536306e-001, 8.549143e-001, 8.562114e-001, 8.575190e-001, 8.588297e-001, 8.601361e-001, 8.614333e-001,
+8.627084e-001, 8.639557e-001, 8.651600e-001, 8.663218e-001, 8.674149e-001, 8.684523e-001, 8.694357e-001, 8.703922e-001, 8.713268e-001, 8.722450e-001,
+8.731473e-001, 8.740348e-001, 8.749025e-001, 8.757532e-001, 8.765849e-001, 8.774042e-001, 8.782154e-001, 8.790270e-001, 8.798487e-001, 8.806847e-001,
+8.815388e-001, 8.824067e-001, 8.832883e-001, 8.841770e-001, 8.850685e-001, 8.859568e-001, 8.868266e-001, 8.876712e-001, 8.884992e-001, 8.893254e-001,
+8.901608e-001, 8.910120e-001, 8.918835e-001, 8.927683e-001, 8.936566e-001, 8.945343e-001, 8.953920e-001, 8.962272e-001, 8.970484e-001, 8.978644e-001,
+8.986831e-001, 8.995126e-001, 9.003558e-001, 9.012147e-001, 9.020918e-001, 9.029912e-001, 9.039173e-001, 9.048788e-001, 9.058735e-001, 9.069008e-001,
+9.079614e-001, 9.090539e-001, 9.101732e-001, 9.113155e-001, 9.124685e-001, 9.136266e-001, 9.147832e-001, 9.159304e-001, 9.170638e-001, 9.181826e-001,
+9.192898e-001, 9.203852e-001, 9.214703e-001, 9.225413e-001, 9.235911e-001, 9.246033e-001, 9.255704e-001, 9.264910e-001, 9.273848e-001, 9.282648e-001,
+9.291424e-001, 9.300235e-001, 9.309047e-001, 9.317825e-001, 9.326478e-001, 9.334927e-001, 9.343230e-001, 9.351406e-001, 9.359554e-001, 9.367739e-001,
+9.376012e-001, 9.384446e-001, 9.393029e-001, 9.401809e-001, 9.410789e-001, 9.420051e-001, 9.429584e-001, 9.439467e-001, 9.449679e-001, 9.460309e-001,
+9.471349e-001, 9.482826e-001, 9.494689e-001, 9.506922e-001, 9.519377e-001, 9.531915e-001, 9.544414e-001, 9.556765e-001, 9.568939e-001, 9.580924e-001,
+9.592747e-001, 9.604387e-001, 9.615804e-001, 9.626856e-001, 9.637448e-001, 9.647369e-001, 9.656660e-001, 9.665510e-001, 9.674116e-001, 9.682607e-001,
+9.691077e-001, 9.699588e-001, 9.708169e-001, 9.716814e-001, 9.725439e-001, 9.734040e-001, 9.742601e-001, 9.751064e-001, 9.759440e-001, 9.767826e-001,
+9.776347e-001, 9.785135e-001, 9.794372e-001, 9.804236e-001, 9.814879e-001, 9.826123e-001, 9.837834e-001, 9.849817e-001, 9.861916e-001, 9.873953e-001,
+9.885757e-001, 9.897236e-001, 9.908238e-001, 9.918766e-001, 9.928745e-001, 9.938510e-001, 9.947991e-001, 9.957082e-001, 9.965645e-001, 9.973733e-001,
+9.981199e-001, 9.988124e-001, 9.994353e-001, 1.000000e+000), (), (), (), ()),
+("Kodak", "KAF-3000", "graph-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 8.239537e-004, 1.711376e-003, 2.657261e-003, 3.641000e-003, 4.651731e-003, 5.675363e-003, 6.696604e-003, 7.703582e-003, 8.695666e-003,
+9.676869e-003, 1.065518e-002, 1.163746e-002, 1.262826e-002, 1.363364e-002, 1.465475e-002, 1.569890e-002, 1.677129e-002, 1.786670e-002, 1.897846e-002,
+2.010015e-002, 2.122876e-002, 2.235880e-002, 2.348388e-002, 2.459898e-002, 2.570054e-002, 2.679301e-002, 2.788199e-002, 2.897124e-002, 3.006039e-002,
+3.114668e-002, 3.222938e-002, 3.330953e-002, 3.439017e-002, 3.547101e-002, 3.654089e-002, 3.758629e-002, 3.860933e-002, 3.961461e-002, 4.061125e-002,
+4.160148e-002, 4.258148e-002, 4.354591e-002, 4.449030e-002, 4.542337e-002, 4.634459e-002, 4.725768e-002, 4.816455e-002, 4.906926e-002, 4.997594e-002,
+5.088917e-002, 5.181660e-002, 5.276266e-002, 5.372264e-002, 5.469196e-002, 5.566490e-002, 5.663731e-002, 5.760513e-002, 5.856231e-002, 5.950927e-002,
+6.044767e-002, 6.138463e-002, 6.232766e-002, 6.328012e-002, 6.424245e-002, 6.521192e-002, 6.618716e-002, 6.717503e-002, 6.817544e-002, 6.918553e-002,
+7.019991e-002, 7.121773e-002, 7.224249e-002, 7.328082e-002, 7.434585e-002, 7.543418e-002, 7.654588e-002, 7.767490e-002, 7.882243e-002, 7.998279e-002,
+8.115304e-002, 8.232623e-002, 8.349524e-002, 8.465705e-002, 8.581693e-002, 8.697826e-002, 8.814207e-002, 8.930910e-002, 9.047682e-002, 9.164015e-002,
+9.279334e-002, 9.392791e-002, 9.503353e-002, 9.610285e-002, 9.713305e-002, 9.813831e-002, 9.912645e-002, 1.001088e-001, 1.010834e-001, 1.020457e-001,
+1.029841e-001, 1.038997e-001, 1.047933e-001, 1.056652e-001, 1.065147e-001, 1.073456e-001, 1.081662e-001, 1.089895e-001, 1.098270e-001, 1.106916e-001,
+1.115796e-001, 1.124867e-001, 1.134070e-001, 1.143372e-001, 1.152724e-001, 1.162075e-001, 1.171367e-001, 1.180611e-001, 1.189864e-001, 1.199202e-001,
+1.209200e-001, 1.219738e-001, 1.230673e-001, 1.241782e-001, 1.253035e-001, 1.264393e-001, 1.275773e-001, 1.287124e-001, 1.298430e-001, 1.309713e-001,
+1.321021e-001, 1.332445e-001, 1.343924e-001, 1.355278e-001, 1.366423e-001, 1.377331e-001, 1.388027e-001, 1.398546e-001, 1.408876e-001, 1.419010e-001,
+1.428835e-001, 1.438401e-001, 1.447667e-001, 1.456669e-001, 1.465340e-001, 1.473750e-001, 1.481927e-001, 1.490017e-001, 1.498130e-001, 1.506288e-001,
+1.514475e-001, 1.522585e-001, 1.530572e-001, 1.538338e-001, 1.545996e-001, 1.553678e-001, 1.561365e-001, 1.569079e-001, 1.576898e-001, 1.584908e-001,
+1.593147e-001, 1.601596e-001, 1.610313e-001, 1.619255e-001, 1.628465e-001, 1.637899e-001, 1.647551e-001, 1.657351e-001, 1.667310e-001, 1.677470e-001,
+1.687899e-001, 1.698749e-001, 1.710060e-001, 1.721913e-001, 1.734060e-001, 1.746454e-001, 1.758996e-001, 1.771611e-001, 1.784185e-001, 1.796668e-001,
+1.809030e-001, 1.821372e-001, 1.833820e-001, 1.846434e-001, 1.859241e-001, 1.872128e-001, 1.884990e-001, 1.897741e-001, 1.910288e-001, 1.922530e-001,
+1.934325e-001, 1.945622e-001, 1.956469e-001, 1.966818e-001, 1.976772e-001, 1.986268e-001, 1.995413e-001, 2.004173e-001, 2.012623e-001, 2.020770e-001,
+2.028657e-001, 2.036325e-001, 2.043817e-001, 2.051237e-001, 2.058676e-001, 2.066214e-001, 2.074044e-001, 2.082142e-001, 2.090530e-001, 2.099053e-001,
+2.107656e-001, 2.116281e-001, 2.124830e-001, 2.133235e-001, 2.141489e-001, 2.149658e-001, 2.157903e-001, 2.166465e-001, 2.175376e-001, 2.184633e-001,
+2.194138e-001, 2.203831e-001, 2.213633e-001, 2.223458e-001, 2.233193e-001, 2.242776e-001, 2.252182e-001, 2.261507e-001, 2.270810e-001, 2.280131e-001,
+2.289511e-001, 2.298972e-001, 2.308543e-001, 2.318240e-001, 2.328101e-001, 2.338117e-001, 2.348213e-001, 2.358337e-001, 2.368507e-001, 2.378791e-001,
+2.389242e-001, 2.399876e-001, 2.410621e-001, 2.421357e-001, 2.432025e-001, 2.442668e-001, 2.453292e-001, 2.463902e-001, 2.474517e-001, 2.485162e-001,
+2.495937e-001, 2.506928e-001, 2.518277e-001, 2.529919e-001, 2.541777e-001, 2.553751e-001, 2.565745e-001, 2.577669e-001, 2.589449e-001, 2.600898e-001,
+2.612055e-001, 2.622892e-001, 2.633586e-001, 2.644208e-001, 2.654806e-001, 2.665414e-001, 2.676038e-001, 2.686690e-001, 2.697397e-001, 2.708160e-001,
+2.718920e-001, 2.729560e-001, 2.739931e-001, 2.749989e-001, 2.759633e-001, 2.768782e-001, 2.777278e-001, 2.785073e-001, 2.792311e-001, 2.799170e-001,
+2.805862e-001, 2.812471e-001, 2.819086e-001, 2.825777e-001, 2.832584e-001, 2.839589e-001, 2.846930e-001, 2.854613e-001, 2.862626e-001, 2.870805e-001,
+2.879105e-001, 2.887446e-001, 2.895752e-001, 2.903952e-001, 2.912051e-001, 2.920135e-001, 2.928391e-001, 2.937022e-001, 2.946189e-001, 2.955987e-001,
+2.966247e-001, 2.976949e-001, 2.987994e-001, 2.999471e-001, 3.011272e-001, 3.023349e-001, 3.035597e-001, 3.047933e-001, 3.060270e-001, 3.072520e-001,
+3.084550e-001, 3.096269e-001, 3.107634e-001, 3.118778e-001, 3.129779e-001, 3.140725e-001, 3.151645e-001, 3.162543e-001, 3.173392e-001, 3.184189e-001,
+3.194958e-001, 3.205689e-001, 3.216290e-001, 3.226648e-001, 3.236808e-001, 3.246812e-001, 3.256719e-001, 3.266537e-001, 3.276238e-001, 3.285811e-001,
+3.295295e-001, 3.304791e-001, 3.314438e-001, 3.324182e-001, 3.333996e-001, 3.343865e-001, 3.353834e-001, 3.363946e-001, 3.374285e-001, 3.384770e-001,
+3.395331e-001, 3.405885e-001, 3.416406e-001, 3.426834e-001, 3.437139e-001, 3.447252e-001, 3.457197e-001, 3.466979e-001, 3.476672e-001, 3.486328e-001,
+3.495933e-001, 3.505494e-001, 3.514995e-001, 3.524490e-001, 3.534051e-001, 3.543708e-001, 3.553416e-001, 3.563007e-001, 3.572335e-001, 3.581456e-001,
+3.590349e-001, 3.599028e-001, 3.607496e-001, 3.615793e-001, 3.623997e-001, 3.632219e-001, 3.640663e-001, 3.649504e-001, 3.658618e-001, 3.667995e-001,
+3.677534e-001, 3.687168e-001, 3.696814e-001, 3.706348e-001, 3.715701e-001, 3.724885e-001, 3.733963e-001, 3.743011e-001, 3.752077e-001, 3.761194e-001,
+3.770408e-001, 3.779735e-001, 3.789207e-001, 3.798850e-001, 3.808659e-001, 3.818588e-001, 3.828561e-001, 3.838580e-001, 3.848698e-001, 3.859066e-001,
+3.869642e-001, 3.880375e-001, 3.891114e-001, 3.901838e-001, 3.912554e-001, 3.923275e-001, 3.934000e-001, 3.944741e-001, 3.955541e-001, 3.966433e-001,
+3.977557e-001, 3.989007e-001, 4.000787e-001, 4.012784e-001, 4.024907e-001, 4.037070e-001, 4.049186e-001, 4.061145e-001, 4.072830e-001, 4.084155e-001,
+4.095209e-001, 4.106052e-001, 4.116788e-001, 4.127461e-001, 4.138118e-001, 4.148772e-001, 4.159424e-001, 4.170076e-001, 4.180722e-001, 4.191268e-001,
+4.201578e-001, 4.211622e-001, 4.221380e-001, 4.230896e-001, 4.240145e-001, 4.249121e-001, 4.257783e-001, 4.266144e-001, 4.274252e-001, 4.282116e-001,
+4.289814e-001, 4.297375e-001, 4.304882e-001, 4.312419e-001, 4.320063e-001, 4.327985e-001, 4.336202e-001, 4.344716e-001, 4.353393e-001, 4.362154e-001,
+4.370938e-001, 4.379680e-001, 4.388278e-001, 4.396712e-001, 4.405009e-001, 4.413329e-001, 4.421813e-001, 4.430596e-001, 4.439747e-001, 4.449261e-001,
+4.459050e-001, 4.469138e-001, 4.479499e-001, 4.490180e-001, 4.501049e-001, 4.512072e-001, 4.523200e-001, 4.534398e-001, 4.545613e-001, 4.556762e-001,
+4.567787e-001, 4.578686e-001, 4.589491e-001, 4.600252e-001, 4.611013e-001, 4.621792e-001, 4.632558e-001, 4.643297e-001, 4.654009e-001, 4.664718e-001,
+4.675420e-001, 4.686032e-001, 4.696451e-001, 4.706640e-001, 4.716723e-001, 4.726729e-001, 4.736702e-001, 4.746588e-001, 4.756379e-001, 4.766108e-001,
+4.775831e-001, 4.785614e-001, 4.795452e-001, 4.805310e-001, 4.815203e-001, 4.825159e-001, 4.835259e-001, 4.845574e-001, 4.856085e-001, 4.866689e-001,
+4.877328e-001, 4.888002e-001, 4.898719e-001, 4.909470e-001, 4.920219e-001, 4.930953e-001, 4.941662e-001, 4.952344e-001, 4.963007e-001, 4.973612e-001,
+4.984085e-001, 4.994311e-001, 5.004293e-001, 5.014035e-001, 5.023515e-001, 5.032756e-001, 5.041643e-001, 5.050223e-001, 5.058480e-001, 5.066505e-001,
+5.074305e-001, 5.081961e-001, 5.089521e-001, 5.097070e-001, 5.104699e-001, 5.112538e-001, 5.120664e-001, 5.129059e-001, 5.137628e-001, 5.146342e-001,
+5.155119e-001, 5.163893e-001, 5.172570e-001, 5.181057e-001, 5.189392e-001, 5.197678e-001, 5.206073e-001, 5.214716e-001, 5.223724e-001, 5.233045e-001,
+5.242694e-001, 5.252613e-001, 5.262829e-001, 5.273327e-001, 5.284061e-001, 5.294969e-001, 5.305972e-001, 5.317054e-001, 5.328170e-001, 5.339269e-001,
+5.350281e-001, 5.361132e-001, 5.371880e-001, 5.382578e-001, 5.393271e-001, 5.403998e-001, 5.414753e-001, 5.425496e-001, 5.436222e-001, 5.446936e-001,
+5.457675e-001, 5.468341e-001, 5.478799e-001, 5.489077e-001, 5.499224e-001, 5.509317e-001, 5.519385e-001, 5.529380e-001, 5.539291e-001, 5.549092e-001,
+5.558865e-001, 5.568640e-001, 5.578450e-001, 5.588300e-001, 5.598174e-001, 5.608099e-001, 5.618140e-001, 5.628398e-001, 5.638893e-001, 5.649537e-001,
+5.660216e-001, 5.670881e-001, 5.681571e-001, 5.692279e-001, 5.702992e-001, 5.713713e-001, 5.724448e-001, 5.735239e-001, 5.746115e-001, 5.757126e-001,
+5.768242e-001, 5.779409e-001, 5.790570e-001, 5.801681e-001, 5.812727e-001, 5.823651e-001, 5.834385e-001, 5.844845e-001, 5.854977e-001, 5.864801e-001,
+5.874280e-001, 5.883440e-001, 5.892180e-001, 5.900631e-001, 5.908904e-001, 5.917155e-001, 5.925497e-001, 5.933986e-001, 5.942596e-001, 5.951249e-001,
+5.959878e-001, 5.968421e-001, 5.976834e-001, 5.984950e-001, 5.992792e-001, 6.000333e-001, 6.007767e-001, 6.015187e-001, 6.022672e-001, 6.030322e-001,
+6.038195e-001, 6.046322e-001, 6.054781e-001, 6.063601e-001, 6.072819e-001, 6.082325e-001, 6.092107e-001, 6.102108e-001, 6.112338e-001, 6.122770e-001,
+6.133307e-001, 6.143916e-001, 6.154522e-001, 6.165164e-001, 6.175840e-001, 6.186556e-001, 6.197302e-001, 6.208109e-001, 6.219017e-001, 6.230134e-001,
+6.241538e-001, 6.253302e-001, 6.265389e-001, 6.277643e-001, 6.289971e-001, 6.302282e-001, 6.314478e-001, 6.326466e-001, 6.338087e-001, 6.349387e-001,
+6.360425e-001, 6.371321e-001, 6.382141e-001, 6.392921e-001, 6.403672e-001, 6.414382e-001, 6.425055e-001, 6.435724e-001, 6.446369e-001, 6.456918e-001,
+6.467275e-001, 6.477333e-001, 6.487027e-001, 6.496293e-001, 6.505001e-001, 6.513101e-001, 6.520530e-001, 6.527564e-001, 6.534317e-001, 6.540934e-001,
+6.547485e-001, 6.554052e-001, 6.560714e-001, 6.567541e-001, 6.574617e-001, 6.582100e-001, 6.589958e-001, 6.598117e-001, 6.606449e-001, 6.614923e-001,
+6.623447e-001, 6.631943e-001, 6.640358e-001, 6.648727e-001, 6.657136e-001, 6.665758e-001, 6.674811e-001, 6.684336e-001, 6.694404e-001, 6.704827e-001,
+6.715667e-001, 6.726836e-001, 6.738362e-001, 6.750172e-001, 6.762194e-001, 6.774325e-001, 6.786480e-001, 6.798575e-001, 6.810537e-001, 6.822185e-001,
+6.833532e-001, 6.844527e-001, 6.855350e-001, 6.866068e-001, 6.876753e-001, 6.887421e-001, 6.898088e-001, 6.908743e-001, 6.919374e-001, 6.929990e-001,
+6.940524e-001, 6.950901e-001, 6.961061e-001, 6.971120e-001, 6.981121e-001, 6.991108e-001, 7.001062e-001, 7.010953e-001, 7.020772e-001, 7.030572e-001,
+7.040421e-001, 7.050337e-001, 7.060308e-001, 7.070298e-001, 7.080342e-001, 7.090519e-001, 7.100887e-001, 7.111470e-001, 7.122196e-001, 7.132938e-001,
+7.143607e-001, 7.154163e-001, 7.164533e-001, 7.174722e-001, 7.184677e-001, 7.194434e-001, 7.204009e-001, 7.213471e-001, 7.222881e-001, 7.232226e-001,
+7.241495e-001, 7.250617e-001, 7.259560e-001, 7.268222e-001, 7.276610e-001, 7.284513e-001, 7.291994e-001, 7.299144e-001, 7.306105e-001, 7.312947e-001,
+7.319728e-001, 7.326508e-001, 7.333355e-001, 7.340328e-001, 7.347601e-001, 7.355272e-001, 7.363471e-001, 7.372058e-001, 7.380937e-001, 7.390054e-001,
+7.399355e-001, 7.408784e-001, 7.418275e-001, 7.427803e-001, 7.437380e-001, 7.447055e-001, 7.456836e-001, 7.466776e-001, 7.476888e-001, 7.487217e-001,
+7.497778e-001, 7.508601e-001, 7.519811e-001, 7.531362e-001, 7.543209e-001, 7.555188e-001, 7.567230e-001, 7.579242e-001, 7.591124e-001, 7.602768e-001,
+7.614082e-001, 7.625084e-001, 7.635901e-001, 7.646593e-001, 7.657236e-001, 7.667865e-001, 7.678502e-001, 7.689156e-001, 7.699835e-001, 7.710578e-001,
+7.721307e-001, 7.731892e-001, 7.742263e-001, 7.752460e-001, 7.762552e-001, 7.772603e-001, 7.782598e-001, 7.792512e-001, 7.802270e-001, 7.811888e-001,
+7.821359e-001, 7.830717e-001, 7.839983e-001, 7.849182e-001, 7.858354e-001, 7.867543e-001, 7.876857e-001, 7.886386e-001, 7.896097e-001, 7.905899e-001,
+7.915676e-001, 7.925337e-001, 7.934818e-001, 7.944026e-001, 7.952839e-001, 7.961305e-001, 7.969564e-001, 7.977766e-001, 7.986038e-001, 7.994433e-001,
+8.003032e-001, 8.011813e-001, 8.020803e-001, 8.030009e-001, 8.039442e-001, 8.048942e-001, 8.058394e-001, 8.067726e-001, 8.077022e-001, 8.086334e-001,
+8.095720e-001, 8.105241e-001, 8.114865e-001, 8.124600e-001, 8.134480e-001, 8.144549e-001, 8.154819e-001, 8.165273e-001, 8.175873e-001, 8.186547e-001,
+8.197260e-001, 8.207991e-001, 8.218632e-001, 8.229098e-001, 8.239314e-001, 8.249355e-001, 8.259270e-001, 8.269089e-001, 8.278800e-001, 8.288375e-001,
+8.297862e-001, 8.307326e-001, 8.316871e-001, 8.326555e-001, 8.336303e-001, 8.346098e-001, 8.355954e-001, 8.365911e-001, 8.376066e-001, 8.386395e-001,
+8.396871e-001, 8.407386e-001, 8.417950e-001, 8.428555e-001, 8.439220e-001, 8.449908e-001, 8.460598e-001, 8.471271e-001, 8.481943e-001, 8.492627e-001,
+8.503319e-001, 8.513955e-001, 8.524439e-001, 8.534614e-001, 8.544461e-001, 8.553860e-001, 8.562804e-001, 8.571104e-001, 8.578769e-001, 8.585958e-001,
+8.592830e-001, 8.599522e-001, 8.606104e-001, 8.612663e-001, 8.619268e-001, 8.625972e-001, 8.632894e-001, 8.640219e-001, 8.647895e-001, 8.655846e-001,
+8.664000e-001, 8.672315e-001, 8.680711e-001, 8.689119e-001, 8.697466e-001, 8.705791e-001, 8.714180e-001, 8.722799e-001, 8.731784e-001, 8.741275e-001,
+8.751282e-001, 8.761690e-001, 8.772517e-001, 8.783689e-001, 8.795279e-001, 8.807160e-001, 8.819315e-001, 8.831598e-001, 8.843934e-001, 8.856235e-001,
+8.868407e-001, 8.880309e-001, 8.891867e-001, 8.903077e-001, 8.914115e-001, 8.925023e-001, 8.935890e-001, 8.946737e-001, 8.957551e-001, 8.968315e-001,
+8.979025e-001, 8.989741e-001, 9.000407e-001, 9.010896e-001, 9.021161e-001, 9.031258e-001, 9.041232e-001, 9.051137e-001, 9.060967e-001, 9.070688e-001,
+9.080282e-001, 9.089828e-001, 9.099377e-001, 9.109022e-001, 9.118763e-001, 9.128566e-001, 9.138408e-001, 9.148361e-001, 9.158486e-001, 9.168852e-001,
+9.179407e-001, 9.190022e-001, 9.200581e-001, 9.210987e-001, 9.221141e-001, 9.230915e-001, 9.240095e-001, 9.248782e-001, 9.257149e-001, 9.265411e-001,
+9.273703e-001, 9.282113e-001, 9.290707e-001, 9.299506e-001, 9.308521e-001, 9.317785e-001, 9.327259e-001, 9.336797e-001, 9.346216e-001, 9.355352e-001,
+9.364286e-001, 9.372990e-001, 9.381507e-001, 9.389857e-001, 9.398119e-001, 9.406411e-001, 9.414887e-001, 9.423734e-001, 9.433203e-001, 9.443135e-001,
+9.453420e-001, 9.463896e-001, 9.474491e-001, 9.485103e-001, 9.495586e-001, 9.505851e-001, 9.515897e-001, 9.525791e-001, 9.535615e-001, 9.545397e-001,
+9.555109e-001, 9.564700e-001, 9.574239e-001, 9.583800e-001, 9.593443e-001, 9.603208e-001, 9.613076e-001, 9.623005e-001, 9.633029e-001, 9.643172e-001,
+9.653546e-001, 9.664107e-001, 9.674817e-001, 9.685522e-001, 9.696256e-001, 9.707053e-001, 9.717904e-001, 9.728768e-001, 9.739595e-001, 9.750362e-001,
+9.761100e-001, 9.771819e-001, 9.782529e-001, 9.793108e-001, 9.803508e-001, 9.813615e-001, 9.823463e-001, 9.833049e-001, 9.842357e-001, 9.851344e-001,
+9.859966e-001, 9.868291e-001, 9.876329e-001, 9.884180e-001, 9.891839e-001, 9.899348e-001, 9.906693e-001, 9.913892e-001, 9.920962e-001, 9.927937e-001,
+9.934824e-001, 9.941564e-001, 9.948134e-001, 9.954446e-001, 9.960511e-001, 9.966242e-001, 9.971636e-001, 9.976590e-001, 9.981125e-001, 9.985359e-001,
+9.989339e-001, 9.993115e-001, 9.996663e-001, 1.000000e+000), (), (), (), ()),
+("Kodak", "KAI-0372", "graph-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.418727e-003, 2.848517e-003, 4.293148e-003, 5.748756e-003, 7.209913e-003, 8.671684e-003, 1.013031e-002, 1.158256e-002, 1.302445e-002,
+1.445146e-002, 1.586045e-002, 1.725039e-002, 1.861995e-002, 1.996869e-002, 2.129681e-002, 2.260291e-002, 2.388855e-002, 2.515133e-002, 2.639163e-002,
+2.761037e-002, 2.880792e-002, 2.998579e-002, 3.114550e-002, 3.228852e-002, 3.341651e-002, 3.452972e-002, 3.562703e-002, 3.670956e-002, 3.778032e-002,
+3.883912e-002, 3.988636e-002, 4.092650e-002, 4.196250e-002, 4.299615e-002, 4.402969e-002, 4.506519e-002, 4.610528e-002, 4.715268e-002, 4.820832e-002,
+4.927145e-002, 5.034203e-002, 5.142146e-002, 5.251062e-002, 5.360957e-002, 5.471877e-002, 5.583808e-002, 5.696894e-002, 5.811199e-002, 5.926715e-002,
+6.043417e-002, 6.161262e-002, 6.280316e-002, 6.400615e-002, 6.522089e-002, 6.644696e-002, 6.768434e-002, 6.893097e-002, 7.018461e-002, 7.144384e-002,
+7.270657e-002, 7.397053e-002, 7.523298e-002, 7.649071e-002, 7.774101e-002, 7.898281e-002, 8.021495e-002, 8.143616e-002, 8.264534e-002, 8.384164e-002,
+8.502524e-002, 8.619706e-002, 8.735673e-002, 8.850457e-002, 8.964223e-002, 9.076872e-002, 9.188455e-002, 9.298974e-002, 9.408502e-002, 9.517177e-002,
+9.624973e-002, 9.731781e-002, 9.837619e-002, 9.942681e-002, 1.004719e-001, 1.015126e-001, 1.025493e-001, 1.035822e-001, 1.046126e-001, 1.056427e-001,
+1.066748e-001, 1.077088e-001, 1.087436e-001, 1.097813e-001, 1.108229e-001, 1.118687e-001, 1.129189e-001, 1.139732e-001, 1.150322e-001, 1.160956e-001,
+1.171634e-001, 1.182367e-001, 1.193158e-001, 1.204013e-001, 1.214939e-001, 1.225938e-001, 1.236993e-001, 1.248105e-001, 1.259278e-001, 1.270509e-001,
+1.281803e-001, 1.293145e-001, 1.304522e-001, 1.315928e-001, 1.327366e-001, 1.338833e-001, 1.350334e-001, 1.361864e-001, 1.373412e-001, 1.384980e-001,
+1.396572e-001, 1.408192e-001, 1.419842e-001, 1.431522e-001, 1.443247e-001, 1.455023e-001, 1.466851e-001, 1.478727e-001, 1.490653e-001, 1.502631e-001,
+1.514662e-001, 1.526743e-001, 1.538881e-001, 1.551087e-001, 1.563372e-001, 1.575720e-001, 1.588125e-001, 1.600577e-001, 1.613082e-001, 1.625638e-001,
+1.638233e-001, 1.650867e-001, 1.663545e-001, 1.676257e-001, 1.688988e-001, 1.701712e-001, 1.714410e-001, 1.727070e-001, 1.739681e-001, 1.752225e-001,
+1.764676e-001, 1.777033e-001, 1.789286e-001, 1.801432e-001, 1.813487e-001, 1.825450e-001, 1.837306e-001, 1.849053e-001, 1.860696e-001, 1.872239e-001,
+1.883683e-001, 1.895033e-001, 1.906295e-001, 1.917480e-001, 1.928583e-001, 1.939616e-001, 1.950584e-001, 1.961484e-001, 1.972329e-001, 1.983122e-001,
+1.993872e-001, 2.004589e-001, 2.015293e-001, 2.025997e-001, 2.036705e-001, 2.047414e-001, 2.058123e-001, 2.068837e-001, 2.079552e-001, 2.090264e-001,
+2.100980e-001, 2.111709e-001, 2.122472e-001, 2.133263e-001, 2.144073e-001, 2.154910e-001, 2.165782e-001, 2.176690e-001, 2.187631e-001, 2.198592e-001,
+2.209577e-001, 2.220600e-001, 2.231667e-001, 2.242773e-001, 2.253910e-001, 2.265067e-001, 2.276258e-001, 2.287493e-001, 2.298769e-001, 2.310087e-001,
+2.321445e-001, 2.332839e-001, 2.344264e-001, 2.355710e-001, 2.367177e-001, 2.378669e-001, 2.390172e-001, 2.401686e-001, 2.413198e-001, 2.424693e-001,
+2.436170e-001, 2.447617e-001, 2.459024e-001, 2.470398e-001, 2.481732e-001, 2.493016e-001, 2.504243e-001, 2.515400e-001, 2.526472e-001, 2.537457e-001,
+2.548359e-001, 2.559179e-001, 2.569903e-001, 2.580535e-001, 2.591086e-001, 2.601555e-001, 2.611947e-001, 2.622262e-001, 2.632491e-001, 2.642633e-001,
+2.652696e-001, 2.662688e-001, 2.672610e-001, 2.682466e-001, 2.692261e-001, 2.702012e-001, 2.711735e-001, 2.721416e-001, 2.731073e-001, 2.740713e-001,
+2.750340e-001, 2.759961e-001, 2.769577e-001, 2.779190e-001, 2.788805e-001, 2.798439e-001, 2.808106e-001, 2.817816e-001, 2.827577e-001, 2.837403e-001,
+2.847315e-001, 2.857330e-001, 2.867462e-001, 2.877715e-001, 2.888085e-001, 2.898588e-001, 2.909234e-001, 2.920029e-001, 2.930967e-001, 2.942047e-001,
+2.953280e-001, 2.964682e-001, 2.976255e-001, 2.987984e-001, 2.999859e-001, 3.011891e-001, 3.024067e-001, 3.036353e-001, 3.048755e-001, 3.061271e-001,
+3.073874e-001, 3.086516e-001, 3.099172e-001, 3.111823e-001, 3.124447e-001, 3.137022e-001, 3.149535e-001, 3.161974e-001, 3.174318e-001, 3.186557e-001,
+3.198691e-001, 3.210715e-001, 3.222627e-001, 3.234441e-001, 3.246166e-001, 3.257783e-001, 3.269310e-001, 3.280749e-001, 3.292090e-001, 3.303337e-001,
+3.314496e-001, 3.325574e-001, 3.336577e-001, 3.347520e-001, 3.358414e-001, 3.369264e-001, 3.380081e-001, 3.390851e-001, 3.401588e-001, 3.412316e-001,
+3.423040e-001, 3.433767e-001, 3.444487e-001, 3.455203e-001, 3.465914e-001, 3.476618e-001, 3.487314e-001, 3.498007e-001, 3.508692e-001, 3.519367e-001,
+3.530030e-001, 3.540688e-001, 3.551346e-001, 3.562012e-001, 3.572681e-001, 3.583359e-001, 3.594044e-001, 3.604734e-001, 3.615426e-001, 3.626111e-001,
+3.636786e-001, 3.647457e-001, 3.658131e-001, 3.668813e-001, 3.679509e-001, 3.690213e-001, 3.700926e-001, 3.711653e-001, 3.722379e-001, 3.733104e-001,
+3.743830e-001, 3.754550e-001, 3.765266e-001, 3.775977e-001, 3.786680e-001, 3.797376e-001, 3.808068e-001, 3.818753e-001, 3.829428e-001, 3.840090e-001,
+3.850749e-001, 3.861419e-001, 3.872109e-001, 3.882801e-001, 3.893499e-001, 3.904219e-001, 3.914968e-001, 3.925746e-001, 3.936545e-001, 3.947367e-001,
+3.958214e-001, 3.969092e-001, 3.980004e-001, 3.990950e-001, 4.001934e-001, 4.012971e-001, 4.024053e-001, 4.035160e-001, 4.046309e-001, 4.057500e-001,
+4.068732e-001, 4.080010e-001, 4.091326e-001, 4.102681e-001, 4.114076e-001, 4.125506e-001, 4.136967e-001, 4.148448e-001, 4.159939e-001, 4.171438e-001,
+4.182942e-001, 4.194458e-001, 4.205986e-001, 4.217510e-001, 4.229009e-001, 4.240475e-001, 4.251903e-001, 4.263280e-001, 4.274600e-001, 4.285858e-001,
+4.297052e-001, 4.308179e-001, 4.319226e-001, 4.330177e-001, 4.341033e-001, 4.351784e-001, 4.362433e-001, 4.372983e-001, 4.383429e-001, 4.393776e-001,
+4.404035e-001, 4.414204e-001, 4.424286e-001, 4.434290e-001, 4.444229e-001, 4.454112e-001, 4.463939e-001, 4.473722e-001, 4.483464e-001, 4.493158e-001,
+4.502819e-001, 4.512457e-001, 4.522085e-001, 4.531711e-001, 4.541337e-001, 4.550962e-001, 4.560594e-001, 4.570237e-001, 4.579895e-001, 4.589587e-001,
+4.599328e-001, 4.609123e-001, 4.618987e-001, 4.628936e-001, 4.638980e-001, 4.649139e-001, 4.659439e-001, 4.669869e-001, 4.680424e-001, 4.691106e-001,
+4.701920e-001, 4.712863e-001, 4.723939e-001, 4.735165e-001, 4.746556e-001, 4.758110e-001, 4.769818e-001, 4.781684e-001, 4.793711e-001, 4.805894e-001,
+4.818194e-001, 4.830603e-001, 4.843109e-001, 4.855697e-001, 4.868359e-001, 4.881083e-001, 4.893856e-001, 4.906665e-001, 4.919497e-001, 4.932327e-001,
+4.945131e-001, 4.957897e-001, 4.970611e-001, 4.983257e-001, 4.995831e-001, 5.008316e-001, 5.020682e-001, 5.032952e-001, 5.045124e-001, 5.057162e-001,
+5.069070e-001, 5.080851e-001, 5.092489e-001, 5.103980e-001, 5.115344e-001, 5.126597e-001, 5.137739e-001, 5.148768e-001, 5.159683e-001, 5.170494e-001,
+5.181218e-001, 5.191835e-001, 5.202353e-001, 5.212791e-001, 5.223166e-001, 5.233480e-001, 5.243744e-001, 5.253981e-001, 5.264204e-001, 5.274419e-001,
+5.284639e-001, 5.294873e-001, 5.305124e-001, 5.315392e-001, 5.325690e-001, 5.336017e-001, 5.346363e-001, 5.356731e-001, 5.367122e-001, 5.377533e-001,
+5.387956e-001, 5.398390e-001, 5.408840e-001, 5.419311e-001, 5.429804e-001, 5.440320e-001, 5.450868e-001, 5.461450e-001, 5.472045e-001, 5.482644e-001,
+5.493269e-001, 5.503927e-001, 5.514603e-001, 5.525295e-001, 5.535999e-001, 5.546712e-001, 5.557433e-001, 5.568157e-001, 5.578881e-001, 5.589601e-001,
+5.600318e-001, 5.611037e-001, 5.621762e-001, 5.632489e-001, 5.643216e-001, 5.653941e-001, 5.664660e-001, 5.675368e-001, 5.686055e-001, 5.696708e-001,
+5.707320e-001, 5.717889e-001, 5.728414e-001, 5.738888e-001, 5.749312e-001, 5.759691e-001, 5.770026e-001, 5.780308e-001, 5.790536e-001, 5.800703e-001,
+5.810798e-001, 5.820824e-001, 5.830807e-001, 5.840756e-001, 5.850659e-001, 5.860516e-001, 5.870334e-001, 5.880114e-001, 5.889859e-001, 5.899572e-001,
+5.909251e-001, 5.918905e-001, 5.928550e-001, 5.938176e-001, 5.947793e-001, 5.957412e-001, 5.967022e-001, 5.976634e-001, 5.986256e-001, 5.995883e-001,
+6.005505e-001, 6.015124e-001, 6.024753e-001, 6.034411e-001, 6.044096e-001, 6.053803e-001, 6.063546e-001, 6.073335e-001, 6.083169e-001, 6.093051e-001,
+6.102979e-001, 6.112932e-001, 6.122915e-001, 6.132950e-001, 6.143042e-001, 6.153184e-001, 6.163371e-001, 6.173606e-001, 6.183896e-001, 6.194241e-001,
+6.204635e-001, 6.215073e-001, 6.225566e-001, 6.236105e-001, 6.246664e-001, 6.257254e-001, 6.267880e-001, 6.278534e-001, 6.289205e-001, 6.299881e-001,
+6.310555e-001, 6.321224e-001, 6.331891e-001, 6.342563e-001, 6.353240e-001, 6.363925e-001, 6.374621e-001, 6.385327e-001, 6.396048e-001, 6.406792e-001,
+6.417565e-001, 6.428371e-001, 6.439194e-001, 6.450036e-001, 6.460907e-001, 6.471815e-001, 6.482767e-001, 6.493767e-001, 6.504801e-001, 6.515864e-001,
+6.526965e-001, 6.538105e-001, 6.549285e-001, 6.560505e-001, 6.571759e-001, 6.583046e-001, 6.594374e-001, 6.605747e-001, 6.617149e-001, 6.628565e-001,
+6.639989e-001, 6.651424e-001, 6.662872e-001, 6.674332e-001, 6.685804e-001, 6.697283e-001, 6.708768e-001, 6.720256e-001, 6.731722e-001, 6.743155e-001,
+6.754554e-001, 6.765919e-001, 6.777250e-001, 6.788530e-001, 6.799748e-001, 6.810904e-001, 6.821988e-001, 6.832993e-001, 6.843918e-001, 6.854762e-001,
+6.865515e-001, 6.876170e-001, 6.886735e-001, 6.897208e-001, 6.907576e-001, 6.917873e-001, 6.928106e-001, 6.938271e-001, 6.948360e-001, 6.958370e-001,
+6.968308e-001, 6.978186e-001, 6.988013e-001, 6.997787e-001, 7.007515e-001, 7.017212e-001, 7.026877e-001, 7.036520e-001, 7.046157e-001, 7.055790e-001,
+7.065419e-001, 7.075043e-001, 7.084663e-001, 7.094286e-001, 7.103923e-001, 7.113581e-001, 7.123269e-001, 7.132993e-001, 7.142758e-001, 7.152579e-001,
+7.162470e-001, 7.172422e-001, 7.182437e-001, 7.192532e-001, 7.202717e-001, 7.212986e-001, 7.223340e-001, 7.233784e-001, 7.244324e-001, 7.254966e-001,
+7.265704e-001, 7.276533e-001, 7.287458e-001, 7.298484e-001, 7.309605e-001, 7.320820e-001, 7.332108e-001, 7.343450e-001, 7.354853e-001, 7.366309e-001,
+7.377815e-001, 7.389365e-001, 7.400947e-001, 7.412542e-001, 7.424135e-001, 7.435715e-001, 7.447264e-001, 7.458764e-001, 7.470207e-001, 7.481593e-001,
+7.492918e-001, 7.504174e-001, 7.515341e-001, 7.526403e-001, 7.537367e-001, 7.548219e-001, 7.558972e-001, 7.569635e-001, 7.580206e-001, 7.590687e-001,
+7.601084e-001, 7.611391e-001, 7.621600e-001, 7.631717e-001, 7.641761e-001, 7.651740e-001, 7.661652e-001, 7.671487e-001, 7.681260e-001, 7.690988e-001,
+7.700666e-001, 7.710312e-001, 7.719942e-001, 7.729566e-001, 7.739175e-001, 7.748776e-001, 7.758383e-001, 7.768000e-001, 7.777621e-001, 7.787245e-001,
+7.796872e-001, 7.806502e-001, 7.816136e-001, 7.825773e-001, 7.835413e-001, 7.845047e-001, 7.854664e-001, 7.864275e-001, 7.873894e-001, 7.883518e-001,
+7.893143e-001, 7.902770e-001, 7.912396e-001, 7.922011e-001, 7.931612e-001, 7.941214e-001, 7.950831e-001, 7.960450e-001, 7.970073e-001, 7.979700e-001,
+7.989329e-001, 7.998962e-001, 8.008598e-001, 8.018237e-001, 8.027874e-001, 8.037497e-001, 8.047108e-001, 8.056723e-001, 8.066347e-001, 8.075972e-001,
+8.085598e-001, 8.095226e-001, 8.104846e-001, 8.114448e-001, 8.124049e-001, 8.133671e-001, 8.143310e-001, 8.152962e-001, 8.162639e-001, 8.172360e-001,
+8.182134e-001, 8.191961e-001, 8.201840e-001, 8.211781e-001, 8.221784e-001, 8.231854e-001, 8.242005e-001, 8.252244e-001, 8.262565e-001, 8.272977e-001,
+8.283491e-001, 8.294097e-001, 8.304785e-001, 8.315558e-001, 8.326427e-001, 8.337396e-001, 8.348457e-001, 8.359598e-001, 8.370815e-001, 8.382107e-001,
+8.393465e-001, 8.404888e-001, 8.416360e-001, 8.427860e-001, 8.439380e-001, 8.450908e-001, 8.462440e-001, 8.473960e-001, 8.485454e-001, 8.496917e-001,
+8.508347e-001, 8.519737e-001, 8.531072e-001, 8.542334e-001, 8.553516e-001, 8.564621e-001, 8.575645e-001, 8.586577e-001, 8.597412e-001, 8.608148e-001,
+8.618785e-001, 8.629317e-001, 8.639750e-001, 8.650091e-001, 8.660346e-001, 8.670523e-001, 8.680630e-001, 8.690674e-001, 8.700646e-001, 8.710550e-001,
+8.720394e-001, 8.730176e-001, 8.739910e-001, 8.749604e-001, 8.759278e-001, 8.768940e-001, 8.778584e-001, 8.788213e-001, 8.797837e-001, 8.807460e-001,
+8.817077e-001, 8.826690e-001, 8.836311e-001, 8.845938e-001, 8.855554e-001, 8.865151e-001, 8.874728e-001, 8.884278e-001, 8.893801e-001, 8.903309e-001,
+8.912788e-001, 8.922230e-001, 8.931637e-001, 8.941029e-001, 8.950411e-001, 8.959774e-001, 8.969108e-001, 8.978417e-001, 8.987694e-001, 8.996942e-001,
+9.006167e-001, 9.015372e-001, 9.024555e-001, 9.033702e-001, 9.042806e-001, 9.051872e-001, 9.060916e-001, 9.069947e-001, 9.078967e-001, 9.087975e-001,
+9.096975e-001, 9.105959e-001, 9.114923e-001, 9.123886e-001, 9.132851e-001, 9.141798e-001, 9.150691e-001, 9.159537e-001, 9.168338e-001, 9.177090e-001,
+9.185785e-001, 9.194408e-001, 9.202949e-001, 9.211413e-001, 9.219814e-001, 9.228158e-001, 9.236447e-001, 9.244682e-001, 9.252853e-001, 9.260940e-001,
+9.268961e-001, 9.276924e-001, 9.284831e-001, 9.292683e-001, 9.300468e-001, 9.308175e-001, 9.315805e-001, 9.323381e-001, 9.330930e-001, 9.338462e-001,
+9.345974e-001, 9.353472e-001, 9.360959e-001, 9.368441e-001, 9.375926e-001, 9.383411e-001, 9.390903e-001, 9.398399e-001, 9.405894e-001, 9.413391e-001,
+9.420892e-001, 9.428393e-001, 9.435887e-001, 9.443354e-001, 9.450780e-001, 9.458170e-001, 9.465533e-001, 9.472862e-001, 9.480144e-001, 9.487375e-001,
+9.494558e-001, 9.501701e-001, 9.508795e-001, 9.515822e-001, 9.522790e-001, 9.529713e-001, 9.536584e-001, 9.543386e-001, 9.550122e-001, 9.556815e-001,
+9.563482e-001, 9.570120e-001, 9.576710e-001, 9.583244e-001, 9.589740e-001, 9.596223e-001, 9.602678e-001, 9.609097e-001, 9.615486e-001, 9.621847e-001,
+9.628177e-001, 9.634479e-001, 9.640748e-001, 9.646963e-001, 9.653109e-001, 9.659178e-001, 9.665164e-001, 9.671065e-001, 9.676873e-001, 9.682564e-001,
+9.688133e-001, 9.693596e-001, 9.698956e-001, 9.704217e-001, 9.709378e-001, 9.714442e-001, 9.719427e-001, 9.724339e-001, 9.729166e-001, 9.733897e-001,
+9.738553e-001, 9.743154e-001, 9.747707e-001, 9.752202e-001, 9.756632e-001, 9.761012e-001, 9.765369e-001, 9.769702e-001, 9.774006e-001, 9.778288e-001,
+9.782562e-001, 9.786834e-001, 9.791105e-001, 9.795381e-001, 9.799663e-001, 9.803939e-001, 9.808201e-001, 9.812436e-001, 9.816620e-001, 9.820752e-001,
+9.824827e-001, 9.828831e-001, 9.832751e-001, 9.836579e-001, 9.840303e-001, 9.843911e-001, 9.847407e-001, 9.850799e-001, 9.854090e-001, 9.857276e-001,
+9.860363e-001, 9.863357e-001, 9.866275e-001, 9.869117e-001, 9.871860e-001, 9.874522e-001, 9.877109e-001, 9.879606e-001, 9.882023e-001, 9.884371e-001,
+9.886657e-001, 9.888894e-001, 9.891093e-001, 9.893258e-001, 9.895406e-001, 9.897547e-001, 9.899684e-001, 9.901812e-001, 9.903943e-001, 9.906081e-001,
+9.908218e-001, 9.910366e-001, 9.912521e-001, 9.914677e-001, 9.916833e-001, 9.918985e-001, 9.921130e-001, 9.923266e-001, 9.925396e-001, 9.927519e-001,
+9.929634e-001, 9.931753e-001, 9.933876e-001, 9.935999e-001, 9.938135e-001, 9.940276e-001, 9.942418e-001, 9.944561e-001, 9.946700e-001, 9.948838e-001,
+9.950978e-001, 9.953122e-001, 9.955271e-001, 9.957418e-001, 9.959560e-001, 9.961696e-001, 9.963824e-001, 9.965956e-001, 9.968093e-001, 9.970230e-001,
+9.972379e-001, 9.974534e-001, 9.976690e-001, 9.978846e-001, 9.980998e-001, 9.983143e-001, 9.985278e-001, 9.987404e-001, 9.989518e-001, 9.991620e-001,
+9.993719e-001, 9.995811e-001, 9.997904e-001, 1.000000e+000), (), (), (), ()),
+("Kodak", "KAI-1010", "graph-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.597093e-003, 3.210827e-003, 4.838425e-003, 6.473239e-003, 8.108176e-003, 9.737594e-003, 1.135488e-002, 1.295288e-002, 1.452614e-002,
+1.607037e-002, 1.758317e-002, 1.906303e-002, 2.051025e-002, 2.192593e-002, 2.331275e-002, 2.467160e-002, 2.600105e-002, 2.729949e-002, 2.856706e-002,
+2.980290e-002, 3.100982e-002, 3.219022e-002, 3.334357e-002, 3.447038e-002, 3.557389e-002, 3.665544e-002, 3.771667e-002, 3.875898e-002, 3.978436e-002,
+4.079517e-002, 4.179453e-002, 4.278660e-002, 4.377507e-002, 4.476194e-002, 4.574857e-002, 4.673670e-002, 4.772710e-002, 4.871867e-002, 4.971235e-002,
+5.070817e-002, 5.170659e-002, 5.270766e-002, 5.371117e-002, 5.471698e-002, 5.572499e-002, 5.673626e-002, 5.775164e-002, 5.877071e-002, 5.979423e-002,
+6.082232e-002, 6.185419e-002, 6.288956e-002, 6.392791e-002, 6.496896e-002, 6.601218e-002, 6.705819e-002, 6.810737e-002, 6.915907e-002, 7.021323e-002,
+7.126966e-002, 7.232812e-002, 7.338841e-002, 7.444975e-002, 7.551192e-002, 7.657466e-002, 7.763768e-002, 7.870188e-002, 7.976733e-002, 8.083315e-002,
+8.189906e-002, 8.296511e-002, 8.403170e-002, 8.509841e-002, 8.616527e-002, 8.723258e-002, 8.829943e-002, 8.936649e-002, 9.043441e-002, 9.150230e-002,
+9.256987e-002, 9.363720e-002, 9.470500e-002, 9.577357e-002, 9.684235e-002, 9.791111e-002, 9.897894e-002, 1.000463e-001, 1.011144e-001, 1.021835e-001,
+1.032545e-001, 1.043292e-001, 1.054089e-001, 1.064951e-001, 1.075880e-001, 1.086886e-001, 1.097973e-001, 1.109145e-001, 1.120417e-001, 1.131796e-001,
+1.143285e-001, 1.154886e-001, 1.166604e-001, 1.178442e-001, 1.190398e-001, 1.202476e-001, 1.214689e-001, 1.227028e-001, 1.239495e-001, 1.252095e-001,
+1.264819e-001, 1.277656e-001, 1.290592e-001, 1.303616e-001, 1.316712e-001, 1.329866e-001, 1.343074e-001, 1.356315e-001, 1.369580e-001, 1.382858e-001,
+1.396145e-001, 1.409430e-001, 1.422718e-001, 1.436003e-001, 1.449290e-001, 1.462575e-001, 1.475863e-001, 1.489148e-001, 1.502435e-001, 1.515720e-001,
+1.529008e-001, 1.542292e-001, 1.555580e-001, 1.568865e-001, 1.582153e-001, 1.595437e-001, 1.608725e-001, 1.622010e-001, 1.635298e-001, 1.648582e-001,
+1.661870e-001, 1.675154e-001, 1.688434e-001, 1.701688e-001, 1.714916e-001, 1.728099e-001, 1.741225e-001, 1.754272e-001, 1.767228e-001, 1.780070e-001,
+1.792788e-001, 1.805344e-001, 1.817728e-001, 1.829934e-001, 1.841961e-001, 1.853809e-001, 1.865483e-001, 1.876983e-001, 1.888300e-001, 1.899435e-001,
+1.910408e-001, 1.921222e-001, 1.931896e-001, 1.942428e-001, 1.952829e-001, 1.963099e-001, 1.973252e-001, 1.983292e-001, 1.993234e-001, 2.003085e-001,
+2.012864e-001, 2.022588e-001, 2.032284e-001, 2.041958e-001, 2.051616e-001, 2.061273e-001, 2.070931e-001, 2.080596e-001, 2.090270e-001, 2.099956e-001,
+2.109649e-001, 2.119349e-001, 2.129059e-001, 2.138798e-001, 2.148582e-001, 2.158417e-001, 2.168301e-001, 2.178226e-001, 2.188192e-001, 2.198205e-001,
+2.208279e-001, 2.218416e-001, 2.228616e-001, 2.238875e-001, 2.249186e-001, 2.259558e-001, 2.269994e-001, 2.280489e-001, 2.291045e-001, 2.301660e-001,
+2.312329e-001, 2.323054e-001, 2.333831e-001, 2.344656e-001, 2.355525e-001, 2.366431e-001, 2.377368e-001, 2.388330e-001, 2.399306e-001, 2.410296e-001,
+2.421303e-001, 2.432314e-001, 2.443311e-001, 2.454299e-001, 2.465300e-001, 2.476333e-001, 2.487404e-001, 2.498512e-001, 2.509643e-001, 2.520791e-001,
+2.531974e-001, 2.543210e-001, 2.554508e-001, 2.565865e-001, 2.577268e-001, 2.588710e-001, 2.600203e-001, 2.611760e-001, 2.623381e-001, 2.635067e-001,
+2.646814e-001, 2.658608e-001, 2.670450e-001, 2.682339e-001, 2.694280e-001, 2.706277e-001, 2.718321e-001, 2.730395e-001, 2.742493e-001, 2.754604e-001,
+2.766728e-001, 2.778874e-001, 2.791037e-001, 2.803192e-001, 2.815322e-001, 2.827436e-001, 2.839539e-001, 2.851621e-001, 2.863675e-001, 2.875690e-001,
+2.887648e-001, 2.899549e-001, 2.911391e-001, 2.923171e-001, 2.934887e-001, 2.946529e-001, 2.958091e-001, 2.969569e-001, 2.980966e-001, 2.992289e-001,
+3.003538e-001, 3.014718e-001, 3.025817e-001, 3.036832e-001, 3.047771e-001, 3.058654e-001, 3.069496e-001, 3.080292e-001, 3.091029e-001, 3.101706e-001,
+3.112339e-001, 3.122944e-001, 3.133535e-001, 3.144116e-001, 3.154679e-001, 3.165229e-001, 3.175788e-001, 3.186369e-001, 3.196959e-001, 3.207564e-001,
+3.218187e-001, 3.228829e-001, 3.239509e-001, 3.250220e-001, 3.260952e-001, 3.271706e-001, 3.282475e-001, 3.293264e-001, 3.304073e-001, 3.314907e-001,
+3.325760e-001, 3.336637e-001, 3.347538e-001, 3.358460e-001, 3.369395e-001, 3.380327e-001, 3.391278e-001, 3.402254e-001, 3.413243e-001, 3.424233e-001,
+3.435213e-001, 3.446191e-001, 3.457185e-001, 3.468186e-001, 3.479178e-001, 3.490159e-001, 3.501128e-001, 3.512093e-001, 3.523041e-001, 3.533973e-001,
+3.544896e-001, 3.555799e-001, 3.566689e-001, 3.577585e-001, 3.588476e-001, 3.599355e-001, 3.610216e-001, 3.621058e-001, 3.631886e-001, 3.642696e-001,
+3.653490e-001, 3.664268e-001, 3.675036e-001, 3.685796e-001, 3.696550e-001, 3.707289e-001, 3.718005e-001, 3.728711e-001, 3.739414e-001, 3.750106e-001,
+3.760792e-001, 3.771469e-001, 3.782135e-001, 3.792808e-001, 3.803486e-001, 3.814166e-001, 3.824853e-001, 3.835539e-001, 3.846215e-001, 3.856872e-001,
+3.867522e-001, 3.878182e-001, 3.888849e-001, 3.899521e-001, 3.910199e-001, 3.920885e-001, 3.931585e-001, 3.942298e-001, 3.953023e-001, 3.963758e-001,
+3.974499e-001, 3.985247e-001, 3.996006e-001, 4.006777e-001, 4.017565e-001, 4.028377e-001, 4.039207e-001, 4.050049e-001, 4.060908e-001, 4.071780e-001,
+4.082661e-001, 4.093562e-001, 4.104485e-001, 4.115422e-001, 4.126375e-001, 4.137335e-001, 4.148307e-001, 4.159297e-001, 4.170302e-001, 4.181306e-001,
+4.192298e-001, 4.203280e-001, 4.214271e-001, 4.225275e-001, 4.236279e-001, 4.247275e-001, 4.258260e-001, 4.269243e-001, 4.280230e-001, 4.291217e-001,
+4.302200e-001, 4.313179e-001, 4.324155e-001, 4.335127e-001, 4.346086e-001, 4.357029e-001, 4.367968e-001, 4.378912e-001, 4.389862e-001, 4.400814e-001,
+4.411763e-001, 4.422704e-001, 4.433648e-001, 4.444605e-001, 4.455576e-001, 4.466555e-001, 4.477527e-001, 4.488491e-001, 4.499465e-001, 4.510458e-001,
+4.521470e-001, 4.532484e-001, 4.543492e-001, 4.554497e-001, 4.565511e-001, 4.576538e-001, 4.587570e-001, 4.598602e-001, 4.609632e-001, 4.620660e-001,
+4.631691e-001, 4.642724e-001, 4.653758e-001, 4.664796e-001, 4.675836e-001, 4.686865e-001, 4.697881e-001, 4.708894e-001, 4.719911e-001, 4.730936e-001,
+4.741966e-001, 4.752988e-001, 4.763999e-001, 4.775001e-001, 4.785998e-001, 4.797008e-001, 4.808028e-001, 4.819044e-001, 4.830043e-001, 4.841025e-001,
+4.852008e-001, 4.863009e-001, 4.874026e-001, 4.885046e-001, 4.896054e-001, 4.907051e-001, 4.918053e-001, 4.929065e-001, 4.940089e-001, 4.951120e-001,
+4.962143e-001, 4.973159e-001, 4.984173e-001, 4.995189e-001, 5.006220e-001, 5.017261e-001, 5.028307e-001, 5.039374e-001, 5.050470e-001, 5.061582e-001,
+5.072712e-001, 5.083870e-001, 5.095050e-001, 5.106258e-001, 5.117478e-001, 5.128696e-001, 5.139923e-001, 5.151175e-001, 5.162450e-001, 5.173735e-001,
+5.185020e-001, 5.196316e-001, 5.207641e-001, 5.218990e-001, 5.230356e-001, 5.241733e-001, 5.253112e-001, 5.264499e-001, 5.275894e-001, 5.287294e-001,
+5.298690e-001, 5.310085e-001, 5.321471e-001, 5.332846e-001, 5.344208e-001, 5.355552e-001, 5.366872e-001, 5.378179e-001, 5.389485e-001, 5.400791e-001,
+5.412082e-001, 5.423351e-001, 5.434600e-001, 5.445840e-001, 5.457080e-001, 5.468309e-001, 5.479511e-001, 5.490680e-001, 5.501825e-001, 5.512953e-001,
+5.524056e-001, 5.535135e-001, 5.546204e-001, 5.557265e-001, 5.568308e-001, 5.579333e-001, 5.590346e-001, 5.601357e-001, 5.612371e-001, 5.623383e-001,
+5.634381e-001, 5.645358e-001, 5.656321e-001, 5.667272e-001, 5.678205e-001, 5.689108e-001, 5.699964e-001, 5.710761e-001, 5.721501e-001, 5.732189e-001,
+5.742821e-001, 5.753387e-001, 5.763882e-001, 5.774299e-001, 5.784643e-001, 5.794925e-001, 5.805140e-001, 5.815274e-001, 5.825326e-001, 5.835304e-001,
+5.845211e-001, 5.855050e-001, 5.864828e-001, 5.874556e-001, 5.884236e-001, 5.893866e-001, 5.903437e-001, 5.912957e-001, 5.922437e-001, 5.931885e-001,
+5.941304e-001, 5.950702e-001, 5.960083e-001, 5.969455e-001, 5.978826e-001, 5.988200e-001, 5.997574e-001, 6.006944e-001, 6.016309e-001, 6.025679e-001,
+6.035057e-001, 6.044442e-001, 6.053842e-001, 6.063275e-001, 6.072760e-001, 6.082305e-001, 6.091914e-001, 6.101578e-001, 6.111288e-001, 6.121054e-001,
+6.130893e-001, 6.140809e-001, 6.150802e-001, 6.160869e-001, 6.171012e-001, 6.181237e-001, 6.191561e-001, 6.201986e-001, 6.212495e-001, 6.223082e-001,
+6.233735e-001, 6.244443e-001, 6.255209e-001, 6.266024e-001, 6.276888e-001, 6.287800e-001, 6.298750e-001, 6.309718e-001, 6.320694e-001, 6.331679e-001,
+6.342683e-001, 6.353699e-001, 6.364707e-001, 6.375695e-001, 6.386673e-001, 6.397667e-001, 6.408684e-001, 6.419710e-001, 6.430730e-001, 6.441742e-001,
+6.452762e-001, 6.463810e-001, 6.474881e-001, 6.485970e-001, 6.497082e-001, 6.508216e-001, 6.519369e-001, 6.530544e-001, 6.541745e-001, 6.552980e-001,
+6.564245e-001, 6.575521e-001, 6.586806e-001, 6.598100e-001, 6.609410e-001, 6.620740e-001, 6.632086e-001, 6.643440e-001, 6.654803e-001, 6.666182e-001,
+6.677570e-001, 6.688961e-001, 6.700353e-001, 6.711744e-001, 6.723119e-001, 6.734473e-001, 6.745814e-001, 6.757146e-001, 6.768456e-001, 6.779727e-001,
+6.790955e-001, 6.802144e-001, 6.813290e-001, 6.824392e-001, 6.835450e-001, 6.846471e-001, 6.857452e-001, 6.868384e-001, 6.879264e-001, 6.890089e-001,
+6.900870e-001, 6.911613e-001, 6.922309e-001, 6.932950e-001, 6.943536e-001, 6.954085e-001, 6.964603e-001, 6.975084e-001, 6.985530e-001, 6.995959e-001,
+7.006380e-001, 7.016789e-001, 7.027179e-001, 7.037552e-001, 7.047919e-001, 7.058282e-001, 7.068638e-001, 7.078988e-001, 7.089342e-001, 7.099705e-001,
+7.110071e-001, 7.120436e-001, 7.130794e-001, 7.141141e-001, 7.151474e-001, 7.161789e-001, 7.172087e-001, 7.182367e-001, 7.192623e-001, 7.202853e-001,
+7.213062e-001, 7.223259e-001, 7.233441e-001, 7.243600e-001, 7.253736e-001, 7.263845e-001, 7.273933e-001, 7.284000e-001, 7.294044e-001, 7.304064e-001,
+7.314064e-001, 7.324049e-001, 7.334017e-001, 7.343969e-001, 7.353904e-001, 7.363826e-001, 7.373743e-001, 7.383653e-001, 7.393557e-001, 7.403461e-001,
+7.413364e-001, 7.423262e-001, 7.433159e-001, 7.443064e-001, 7.452974e-001, 7.462878e-001, 7.472771e-001, 7.482659e-001, 7.492549e-001, 7.502439e-001,
+7.512321e-001, 7.522204e-001, 7.532093e-001, 7.541986e-001, 7.551875e-001, 7.561764e-001, 7.571651e-001, 7.581533e-001, 7.591396e-001, 7.601244e-001,
+7.611086e-001, 7.620922e-001, 7.630746e-001, 7.640558e-001, 7.650362e-001, 7.660158e-001, 7.669951e-001, 7.679739e-001, 7.689527e-001, 7.699315e-001,
+7.709107e-001, 7.718900e-001, 7.728688e-001, 7.738466e-001, 7.748247e-001, 7.758037e-001, 7.767832e-001, 7.777635e-001, 7.787455e-001, 7.797296e-001,
+7.807155e-001, 7.817036e-001, 7.826943e-001, 7.836888e-001, 7.846868e-001, 7.856897e-001, 7.866985e-001, 7.877131e-001, 7.887325e-001, 7.897547e-001,
+7.907802e-001, 7.918102e-001, 7.928442e-001, 7.938814e-001, 7.949219e-001, 7.959659e-001, 7.970144e-001, 7.980663e-001, 7.991214e-001, 8.001786e-001,
+8.012386e-001, 8.023005e-001, 8.033639e-001, 8.044287e-001, 8.054935e-001, 8.065580e-001, 8.076240e-001, 8.086903e-001, 8.097564e-001, 8.108221e-001,
+8.118875e-001, 8.129522e-001, 8.140148e-001, 8.150777e-001, 8.161421e-001, 8.172072e-001, 8.182732e-001, 8.193401e-001, 8.204080e-001, 8.214778e-001,
+8.225491e-001, 8.236217e-001, 8.246956e-001, 8.257702e-001, 8.268460e-001, 8.279230e-001, 8.290016e-001, 8.300825e-001, 8.311661e-001, 8.322516e-001,
+8.333385e-001, 8.344270e-001, 8.355159e-001, 8.366057e-001, 8.376974e-001, 8.387902e-001, 8.398838e-001, 8.409780e-001, 8.420728e-001, 8.431687e-001,
+8.442659e-001, 8.453642e-001, 8.464625e-001, 8.475596e-001, 8.486564e-001, 8.497542e-001, 8.508524e-001, 8.519497e-001, 8.530451e-001, 8.541381e-001,
+8.552294e-001, 8.563185e-001, 8.574042e-001, 8.584863e-001, 8.595638e-001, 8.606367e-001, 8.617051e-001, 8.627687e-001, 8.638274e-001, 8.648814e-001,
+8.659304e-001, 8.669739e-001, 8.680112e-001, 8.690429e-001, 8.700705e-001, 8.710942e-001, 8.721133e-001, 8.731275e-001, 8.741363e-001, 8.751402e-001,
+8.761406e-001, 8.771389e-001, 8.781351e-001, 8.791291e-001, 8.801204e-001, 8.811099e-001, 8.820987e-001, 8.830871e-001, 8.840739e-001, 8.850582e-001,
+8.860397e-001, 8.870177e-001, 8.879905e-001, 8.889574e-001, 8.899184e-001, 8.908733e-001, 8.918205e-001, 8.927587e-001, 8.936868e-001, 8.946046e-001,
+8.955130e-001, 8.964124e-001, 8.973017e-001, 8.981795e-001, 8.990461e-001, 8.999027e-001, 9.007507e-001, 9.015906e-001, 9.024221e-001, 9.032450e-001,
+9.040595e-001, 9.048662e-001, 9.056665e-001, 9.064613e-001, 9.072514e-001, 9.080368e-001, 9.088181e-001, 9.095961e-001, 9.103735e-001, 9.111510e-001,
+9.119281e-001, 9.127063e-001, 9.134866e-001, 9.142684e-001, 9.150518e-001, 9.158386e-001, 9.166295e-001, 9.174248e-001, 9.182246e-001, 9.190281e-001,
+9.198363e-001, 9.206499e-001, 9.214690e-001, 9.222938e-001, 9.231243e-001, 9.239605e-001, 9.248024e-001, 9.256508e-001, 9.265056e-001, 9.273657e-001,
+9.282308e-001, 9.291007e-001, 9.299767e-001, 9.308584e-001, 9.317453e-001, 9.326366e-001, 9.335307e-001, 9.344261e-001, 9.353220e-001, 9.362200e-001,
+9.371208e-001, 9.380228e-001, 9.389241e-001, 9.398237e-001, 9.407201e-001, 9.416117e-001, 9.424964e-001, 9.433728e-001, 9.442401e-001, 9.450958e-001,
+9.459366e-001, 9.467617e-001, 9.475711e-001, 9.483642e-001, 9.491405e-001, 9.498987e-001, 9.506379e-001, 9.513601e-001, 9.520673e-001, 9.527601e-001,
+9.534382e-001, 9.541031e-001, 9.547549e-001, 9.553935e-001, 9.560202e-001, 9.566346e-001, 9.572382e-001, 9.578329e-001, 9.584187e-001, 9.589972e-001,
+9.595694e-001, 9.601373e-001, 9.607033e-001, 9.612680e-001, 9.618327e-001, 9.623975e-001, 9.629617e-001, 9.635256e-001, 9.640891e-001, 9.646534e-001,
+9.652183e-001, 9.657815e-001, 9.663418e-001, 9.668994e-001, 9.674542e-001, 9.680058e-001, 9.685540e-001, 9.690971e-001, 9.696342e-001, 9.701663e-001,
+9.706927e-001, 9.712131e-001, 9.717287e-001, 9.722388e-001, 9.727418e-001, 9.732380e-001, 9.737279e-001, 9.742118e-001, 9.746911e-001, 9.751665e-001,
+9.756376e-001, 9.761040e-001, 9.765653e-001, 9.770221e-001, 9.774756e-001, 9.779269e-001, 9.783759e-001, 9.788223e-001, 9.792656e-001, 9.797067e-001,
+9.801476e-001, 9.805890e-001, 9.810297e-001, 9.814690e-001, 9.819056e-001, 9.823381e-001, 9.827660e-001, 9.831881e-001, 9.836020e-001, 9.840061e-001,
+9.844007e-001, 9.847850e-001, 9.851579e-001, 9.855204e-001, 9.858721e-001, 9.862110e-001, 9.865372e-001, 9.868520e-001, 9.871560e-001, 9.874502e-001,
+9.877350e-001, 9.880086e-001, 9.882714e-001, 9.885252e-001, 9.887697e-001, 9.890058e-001, 9.892352e-001, 9.894578e-001, 9.896727e-001, 9.898801e-001,
+9.900824e-001, 9.902831e-001, 9.904840e-001, 9.906855e-001, 9.908869e-001, 9.910881e-001, 9.912898e-001, 9.914923e-001, 9.916949e-001, 9.918974e-001,
+9.920993e-001, 9.923006e-001, 9.925017e-001, 9.927030e-001, 9.929041e-001, 9.931047e-001, 9.933042e-001, 9.935021e-001, 9.936986e-001, 9.938936e-001,
+9.940874e-001, 9.942803e-001, 9.944715e-001, 9.946610e-001, 9.948499e-001, 9.950380e-001, 9.952244e-001, 9.954094e-001, 9.955927e-001, 9.957734e-001,
+9.959522e-001, 9.961301e-001, 9.963077e-001, 9.964857e-001, 9.966630e-001, 9.968385e-001, 9.970130e-001, 9.971876e-001, 9.973619e-001, 9.975370e-001,
+9.977136e-001, 9.978904e-001, 9.980656e-001, 9.982392e-001, 9.984129e-001, 9.985876e-001, 9.987637e-001, 9.989405e-001, 9.991180e-001, 9.992955e-001,
+9.994722e-001, 9.996480e-001, 9.998240e-001, 1.000000e+000), (), (), (), ()),
+("Canon", "Optura 981111", "mlab-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 2.545048e-003, 5.090096e-003, 7.635143e-003, 1.018847e-002, 1.285047e-002, 1.551247e-002, 1.817446e-002, 2.088445e-002, 2.369919e-002,
+2.651392e-002, 2.932865e-002, 3.227322e-002, 3.525847e-002, 3.824371e-002, 4.129917e-002, 4.445498e-002, 4.761079e-002, 5.080385e-002, 5.411300e-002,
+5.742214e-002, 6.075811e-002, 6.418865e-002, 6.761918e-002, 7.107413e-002, 7.458444e-002, 7.809475e-002, 8.162113e-002, 8.516658e-002, 8.871203e-002,
+9.225356e-002, 9.579286e-002, 9.933216e-002, 1.028395e-001, 1.063393e-001, 1.098392e-001, 1.132792e-001, 1.167164e-001, 1.201502e-001, 1.235114e-001,
+1.268726e-001, 1.302281e-001, 1.335085e-001, 1.367888e-001, 1.400675e-001, 1.432684e-001, 1.464692e-001, 1.496701e-001, 1.528047e-001, 1.559317e-001,
+1.590587e-001, 1.621397e-001, 1.652008e-001, 1.682619e-001, 1.712983e-001, 1.743024e-001, 1.773066e-001, 1.803057e-001, 1.832617e-001, 1.862176e-001,
+1.891736e-001, 1.921005e-001, 1.950162e-001, 1.979319e-001, 2.008378e-001, 2.037197e-001, 2.066015e-001, 2.094834e-001, 2.123412e-001, 2.151938e-001,
+2.180464e-001, 2.208905e-001, 2.237162e-001, 2.265419e-001, 2.293676e-001, 2.321725e-001, 2.349714e-001, 2.377704e-001, 2.405634e-001, 2.433334e-001,
+2.461033e-001, 2.488733e-001, 2.516236e-001, 2.543603e-001, 2.570971e-001, 2.598339e-001, 2.625338e-001, 2.652313e-001, 2.679289e-001, 2.706156e-001,
+2.732666e-001, 2.759177e-001, 2.785687e-001, 2.811946e-001, 2.837912e-001, 2.863877e-001, 2.889843e-001, 2.915427e-001, 2.940768e-001, 2.966108e-001,
+2.991449e-001, 3.016327e-001, 3.040970e-001, 3.065613e-001, 3.090255e-001, 3.114439e-001, 3.138321e-001, 3.162203e-001, 3.186085e-001, 3.209632e-001,
+3.232709e-001, 3.255786e-001, 3.278863e-001, 3.301870e-001, 3.324113e-001, 3.346356e-001, 3.368599e-001, 3.390842e-001, 3.412589e-001, 3.433990e-001,
+3.455390e-001, 3.476791e-001, 3.498191e-001, 3.518828e-001, 3.539395e-001, 3.559962e-001, 3.580528e-001, 3.601052e-001, 3.620810e-001, 3.640568e-001,
+3.660326e-001, 3.680083e-001, 3.699841e-001, 3.718834e-001, 3.737821e-001, 3.756807e-001, 3.775794e-001, 3.794780e-001, 3.813243e-001, 3.831506e-001,
+3.849770e-001, 3.868034e-001, 3.886298e-001, 3.904395e-001, 3.921991e-001, 3.939588e-001, 3.957184e-001, 3.974781e-001, 3.992377e-001, 4.009630e-001,
+4.026621e-001, 4.043612e-001, 4.060603e-001, 4.077594e-001, 4.094585e-001, 4.111206e-001, 4.127655e-001, 4.144104e-001, 4.160553e-001, 4.177002e-001,
+4.193451e-001, 4.209614e-001, 4.225587e-001, 4.241560e-001, 4.257533e-001, 4.273506e-001, 4.289479e-001, 4.305312e-001, 4.320875e-001, 4.336438e-001,
+4.352000e-001, 4.367563e-001, 4.383125e-001, 4.398688e-001, 4.413935e-001, 4.429152e-001, 4.444370e-001, 4.459588e-001, 4.474806e-001, 4.490023e-001,
+4.505144e-001, 4.520081e-001, 4.535017e-001, 4.549954e-001, 4.564890e-001, 4.579827e-001, 4.594763e-001, 4.609557e-001, 4.624273e-001, 4.638990e-001,
+4.653706e-001, 4.668422e-001, 4.683139e-001, 4.697855e-001, 4.712435e-001, 4.726991e-001, 4.741546e-001, 4.756102e-001, 4.770658e-001, 4.785214e-001,
+4.799770e-001, 4.814223e-001, 4.828675e-001, 4.843126e-001, 4.857578e-001, 4.872029e-001, 4.886481e-001, 4.900929e-001, 4.915328e-001, 4.929728e-001,
+4.944128e-001, 4.958527e-001, 4.972927e-001, 4.987327e-001, 5.001726e-001, 5.016122e-001, 5.030519e-001, 5.044915e-001, 5.059312e-001, 5.073708e-001,
+5.088104e-001, 5.102508e-001, 5.116944e-001, 5.131380e-001, 5.145816e-001, 5.160253e-001, 5.174689e-001, 5.189125e-001, 5.203580e-001, 5.218093e-001,
+5.232606e-001, 5.247119e-001, 5.261633e-001, 5.276146e-001, 5.290659e-001, 5.305209e-001, 5.319827e-001, 5.334445e-001, 5.349063e-001, 5.363681e-001,
+5.378300e-001, 5.392918e-001, 5.407600e-001, 5.422342e-001, 5.437084e-001, 5.451826e-001, 5.466568e-001, 5.481310e-001, 5.496053e-001, 5.510890e-001,
+5.525763e-001, 5.540636e-001, 5.555508e-001, 5.570381e-001, 5.585253e-001, 5.600127e-001, 5.615122e-001, 5.630118e-001, 5.645113e-001, 5.660108e-001,
+5.675103e-001, 5.690099e-001, 5.705127e-001, 5.720221e-001, 5.735315e-001, 5.750409e-001, 5.765503e-001, 5.780597e-001, 5.795690e-001, 5.810825e-001,
+5.825976e-001, 5.841127e-001, 5.856278e-001, 5.871428e-001, 5.886579e-001, 5.901730e-001, 5.916878e-001, 5.932027e-001, 5.947175e-001, 5.962324e-001,
+5.977472e-001, 5.992620e-001, 6.007729e-001, 6.022800e-001, 6.037871e-001, 6.052943e-001, 6.068014e-001, 6.083085e-001, 6.098156e-001, 6.113082e-001,
+6.127988e-001, 6.142895e-001, 6.157801e-001, 6.172707e-001, 6.187613e-001, 6.202476e-001, 6.217123e-001, 6.231770e-001, 6.246417e-001, 6.261065e-001,
+6.275712e-001, 6.290359e-001, 6.304885e-001, 6.319180e-001, 6.333474e-001, 6.347768e-001, 6.362062e-001, 6.376356e-001, 6.390650e-001, 6.404792e-001,
+6.418645e-001, 6.432499e-001, 6.446353e-001, 6.460206e-001, 6.474060e-001, 6.487914e-001, 6.501702e-001, 6.515042e-001, 6.528383e-001, 6.541723e-001,
+6.555064e-001, 6.568404e-001, 6.581745e-001, 6.595085e-001, 6.608067e-001, 6.620839e-001, 6.633612e-001, 6.646384e-001, 6.659157e-001, 6.671930e-001,
+6.684702e-001, 6.697475e-001, 6.709765e-001, 6.721936e-001, 6.734107e-001, 6.746279e-001, 6.758450e-001, 6.770621e-001, 6.782793e-001, 6.794964e-001,
+6.806776e-001, 6.818334e-001, 6.829892e-001, 6.841450e-001, 6.853008e-001, 6.864566e-001, 6.876124e-001, 6.887682e-001, 6.899240e-001, 6.910232e-001,
+6.921185e-001, 6.932137e-001, 6.943090e-001, 6.954042e-001, 6.964995e-001, 6.975947e-001, 6.986899e-001, 6.997852e-001, 7.008337e-001, 7.018709e-001,
+7.029080e-001, 7.039451e-001, 7.049823e-001, 7.060194e-001, 7.070566e-001, 7.080937e-001, 7.091308e-001, 7.101592e-001, 7.111420e-001, 7.121248e-001,
+7.131077e-001, 7.140905e-001, 7.150733e-001, 7.160561e-001, 7.170390e-001, 7.180218e-001, 7.190046e-001, 7.199874e-001, 7.209214e-001, 7.218547e-001,
+7.227880e-001, 7.237213e-001, 7.246546e-001, 7.255879e-001, 7.265212e-001, 7.274545e-001, 7.283878e-001, 7.293211e-001, 7.302424e-001, 7.311317e-001,
+7.320210e-001, 7.329103e-001, 7.337996e-001, 7.346889e-001, 7.355781e-001, 7.364674e-001, 7.373567e-001, 7.382460e-001, 7.391353e-001, 7.400235e-001,
+7.408747e-001, 7.417260e-001, 7.425772e-001, 7.434284e-001, 7.442797e-001, 7.451309e-001, 7.459822e-001, 7.468334e-001, 7.476846e-001, 7.485359e-001,
+7.493871e-001, 7.502294e-001, 7.510489e-001, 7.518684e-001, 7.526879e-001, 7.535074e-001, 7.543269e-001, 7.551464e-001, 7.559659e-001, 7.567854e-001,
+7.576049e-001, 7.584244e-001, 7.592439e-001, 7.600615e-001, 7.608558e-001, 7.616501e-001, 7.624444e-001, 7.632388e-001, 7.640331e-001, 7.648274e-001,
+7.656217e-001, 7.664160e-001, 7.672104e-001, 7.680047e-001, 7.687990e-001, 7.695933e-001, 7.703787e-001, 7.711546e-001, 7.719305e-001, 7.727065e-001,
+7.734824e-001, 7.742583e-001, 7.750343e-001, 7.758102e-001, 7.765861e-001, 7.773621e-001, 7.781380e-001, 7.789139e-001, 7.796899e-001, 7.804590e-001,
+7.812236e-001, 7.819883e-001, 7.827529e-001, 7.835175e-001, 7.842821e-001, 7.850467e-001, 7.858114e-001, 7.865760e-001, 7.873406e-001, 7.881052e-001,
+7.888698e-001, 7.896345e-001, 7.903971e-001, 7.911578e-001, 7.919185e-001, 7.926793e-001, 7.934400e-001, 7.942007e-001, 7.949615e-001, 7.957222e-001,
+7.964830e-001, 7.972437e-001, 7.980044e-001, 7.987652e-001, 7.995259e-001, 8.002882e-001, 8.010530e-001, 8.018177e-001, 8.025825e-001, 8.033473e-001,
+8.041121e-001, 8.048768e-001, 8.056416e-001, 8.064064e-001, 8.071712e-001, 8.079360e-001, 8.087007e-001, 8.094655e-001, 8.102341e-001, 8.110114e-001,
+8.117887e-001, 8.125661e-001, 8.133434e-001, 8.141207e-001, 8.148981e-001, 8.156754e-001, 8.164527e-001, 8.172300e-001, 8.180074e-001, 8.187847e-001,
+8.195620e-001, 8.203489e-001, 8.211479e-001, 8.219470e-001, 8.227461e-001, 8.235452e-001, 8.243443e-001, 8.251433e-001, 8.259424e-001, 8.267415e-001,
+8.275406e-001, 8.283396e-001, 8.291387e-001, 8.299378e-001, 8.307659e-001, 8.315965e-001, 8.324271e-001, 8.332577e-001, 8.340882e-001, 8.349188e-001,
+8.357494e-001, 8.365800e-001, 8.374106e-001, 8.382411e-001, 8.390717e-001, 8.399023e-001, 8.407693e-001, 8.416412e-001, 8.425130e-001, 8.433849e-001,
+8.442568e-001, 8.451286e-001, 8.460005e-001, 8.468724e-001, 8.477442e-001, 8.486161e-001, 8.494880e-001, 8.503803e-001, 8.513019e-001, 8.522234e-001,
+8.531450e-001, 8.540665e-001, 8.549881e-001, 8.559096e-001, 8.568312e-001, 8.577527e-001, 8.586742e-001, 8.595958e-001, 8.605474e-001, 8.615226e-001,
+8.624977e-001, 8.634729e-001, 8.644481e-001, 8.654232e-001, 8.663984e-001, 8.673735e-001, 8.683487e-001, 8.693238e-001, 8.703136e-001, 8.713365e-001,
+8.723593e-001, 8.733821e-001, 8.744049e-001, 8.754278e-001, 8.764506e-001, 8.774734e-001, 8.784963e-001, 8.795191e-001, 8.805549e-001, 8.816024e-001,
+8.826498e-001, 8.836972e-001, 8.847446e-001, 8.857920e-001, 8.868394e-001, 8.878868e-001, 8.889342e-001, 8.899816e-001, 8.910092e-001, 8.920365e-001,
+8.930637e-001, 8.940910e-001, 8.951182e-001, 8.961455e-001, 8.971728e-001, 8.982000e-001, 8.992273e-001, 9.002348e-001, 9.011824e-001, 9.021301e-001,
+9.030777e-001, 9.040254e-001, 9.049730e-001, 9.059206e-001, 9.068683e-001, 9.078159e-001, 9.087635e-001, 9.097112e-001, 9.105667e-001, 9.113819e-001,
+9.121970e-001, 9.130122e-001, 9.138273e-001, 9.146425e-001, 9.154576e-001, 9.162728e-001, 9.170879e-001, 9.179031e-001, 9.187182e-001, 9.195334e-001,
+9.202812e-001, 9.209387e-001, 9.215963e-001, 9.222538e-001, 9.229114e-001, 9.235690e-001, 9.242265e-001, 9.248841e-001, 9.255416e-001, 9.261992e-001,
+9.268567e-001, 9.275143e-001, 9.281718e-001, 9.288294e-001, 9.294870e-001, 9.301112e-001, 9.306169e-001, 9.311227e-001, 9.316285e-001, 9.321342e-001,
+9.326400e-001, 9.331458e-001, 9.336515e-001, 9.341573e-001, 9.346631e-001, 9.351688e-001, 9.356746e-001, 9.361804e-001, 9.366861e-001, 9.371919e-001,
+9.376977e-001, 9.382034e-001, 9.387092e-001, 9.392150e-001, 9.397207e-001, 9.401694e-001, 9.405476e-001, 9.409258e-001, 9.413041e-001, 9.416823e-001,
+9.420605e-001, 9.424388e-001, 9.428170e-001, 9.431952e-001, 9.435734e-001, 9.439517e-001, 9.443299e-001, 9.447081e-001, 9.450864e-001, 9.454646e-001,
+9.458428e-001, 9.462211e-001, 9.465993e-001, 9.469775e-001, 9.473558e-001, 9.477340e-001, 9.481122e-001, 9.484904e-001, 9.488687e-001, 9.492469e-001,
+9.496251e-001, 9.500025e-001, 9.502820e-001, 9.505615e-001, 9.508409e-001, 9.511204e-001, 9.513999e-001, 9.516794e-001, 9.519589e-001, 9.522384e-001,
+9.525179e-001, 9.527974e-001, 9.530768e-001, 9.533563e-001, 9.536358e-001, 9.539153e-001, 9.541948e-001, 9.544743e-001, 9.547538e-001, 9.550332e-001,
+9.553127e-001, 9.555922e-001, 9.558717e-001, 9.561512e-001, 9.564307e-001, 9.567102e-001, 9.569896e-001, 9.572691e-001, 9.575486e-001, 9.578281e-001,
+9.581076e-001, 9.583871e-001, 9.586666e-001, 9.589460e-001, 9.592255e-001, 9.595050e-001, 9.597845e-001, 9.600472e-001, 9.602535e-001, 9.604599e-001,
+9.606662e-001, 9.608725e-001, 9.610788e-001, 9.612851e-001, 9.614914e-001, 9.616977e-001, 9.619040e-001, 9.621103e-001, 9.623167e-001, 9.625230e-001,
+9.627293e-001, 9.629356e-001, 9.631419e-001, 9.633482e-001, 9.635545e-001, 9.637608e-001, 9.639671e-001, 9.641735e-001, 9.643798e-001, 9.645861e-001,
+9.647924e-001, 9.649987e-001, 9.652050e-001, 9.654113e-001, 9.656176e-001, 9.658239e-001, 9.660303e-001, 9.662366e-001, 9.664429e-001, 9.666492e-001,
+9.668555e-001, 9.670618e-001, 9.672681e-001, 9.674744e-001, 9.676807e-001, 9.678870e-001, 9.680934e-001, 9.682997e-001, 9.685060e-001, 9.687123e-001,
+9.689186e-001, 9.691249e-001, 9.693312e-001, 9.695375e-001, 9.697438e-001, 9.699502e-001, 9.701161e-001, 9.702693e-001, 9.704224e-001, 9.705755e-001,
+9.707287e-001, 9.708818e-001, 9.710349e-001, 9.711880e-001, 9.713412e-001, 9.714943e-001, 9.716474e-001, 9.718006e-001, 9.719537e-001, 9.721068e-001,
+9.722600e-001, 9.724131e-001, 9.725662e-001, 9.727194e-001, 9.728725e-001, 9.730256e-001, 9.731787e-001, 9.733319e-001, 9.734850e-001, 9.736381e-001,
+9.737913e-001, 9.739444e-001, 9.740975e-001, 9.742507e-001, 9.744038e-001, 9.745569e-001, 9.747101e-001, 9.748632e-001, 9.750163e-001, 9.751694e-001,
+9.753226e-001, 9.754757e-001, 9.756288e-001, 9.757820e-001, 9.759351e-001, 9.760882e-001, 9.762414e-001, 9.763945e-001, 9.765476e-001, 9.767007e-001,
+9.768539e-001, 9.770070e-001, 9.771601e-001, 9.773133e-001, 9.774664e-001, 9.776195e-001, 9.777727e-001, 9.779258e-001, 9.780789e-001, 9.782321e-001,
+9.783852e-001, 9.785383e-001, 9.786914e-001, 9.788446e-001, 9.789977e-001, 9.791508e-001, 9.793040e-001, 9.794571e-001, 9.796102e-001, 9.797634e-001,
+9.799165e-001, 9.800521e-001, 9.801668e-001, 9.802815e-001, 9.803961e-001, 9.805108e-001, 9.806255e-001, 9.807402e-001, 9.808548e-001, 9.809695e-001,
+9.810842e-001, 9.811989e-001, 9.813135e-001, 9.814282e-001, 9.815429e-001, 9.816575e-001, 9.817722e-001, 9.818869e-001, 9.820016e-001, 9.821162e-001,
+9.822309e-001, 9.823456e-001, 9.824602e-001, 9.825749e-001, 9.826896e-001, 9.828043e-001, 9.829189e-001, 9.830336e-001, 9.831483e-001, 9.832629e-001,
+9.833776e-001, 9.834923e-001, 9.836070e-001, 9.837216e-001, 9.838363e-001, 9.839510e-001, 9.840656e-001, 9.841803e-001, 9.842950e-001, 9.844097e-001,
+9.845243e-001, 9.846390e-001, 9.847537e-001, 9.848683e-001, 9.849830e-001, 9.850977e-001, 9.852124e-001, 9.853270e-001, 9.854417e-001, 9.855564e-001,
+9.856711e-001, 9.857857e-001, 9.859004e-001, 9.860151e-001, 9.861297e-001, 9.862444e-001, 9.863591e-001, 9.864738e-001, 9.865884e-001, 9.867031e-001,
+9.868178e-001, 9.869324e-001, 9.870471e-001, 9.871618e-001, 9.872765e-001, 9.873911e-001, 9.875058e-001, 9.876205e-001, 9.877351e-001, 9.878498e-001,
+9.879645e-001, 9.880792e-001, 9.881938e-001, 9.883085e-001, 9.884232e-001, 9.885378e-001, 9.886525e-001, 9.887672e-001, 9.888819e-001, 9.889965e-001,
+9.891112e-001, 9.892259e-001, 9.893405e-001, 9.894552e-001, 9.895699e-001, 9.896846e-001, 9.897992e-001, 9.899139e-001, 9.900216e-001, 9.901084e-001,
+9.901952e-001, 9.902819e-001, 9.903687e-001, 9.904555e-001, 9.905422e-001, 9.906290e-001, 9.907158e-001, 9.908025e-001, 9.908893e-001, 9.909761e-001,
+9.910628e-001, 9.911496e-001, 9.912364e-001, 9.913232e-001, 9.914099e-001, 9.914967e-001, 9.915835e-001, 9.916702e-001, 9.917570e-001, 9.918438e-001,
+9.919305e-001, 9.920173e-001, 9.921041e-001, 9.921908e-001, 9.922776e-001, 9.923644e-001, 9.924511e-001, 9.925379e-001, 9.926247e-001, 9.927114e-001,
+9.927982e-001, 9.928850e-001, 9.929718e-001, 9.930585e-001, 9.931453e-001, 9.932321e-001, 9.933188e-001, 9.934056e-001, 9.934924e-001, 9.935791e-001,
+9.936659e-001, 9.937527e-001, 9.938394e-001, 9.939262e-001, 9.940130e-001, 9.940997e-001, 9.941865e-001, 9.942733e-001, 9.943600e-001, 9.944468e-001,
+9.945336e-001, 9.946204e-001, 9.947071e-001, 9.947939e-001, 9.948807e-001, 9.949674e-001, 9.950542e-001, 9.951410e-001, 9.952277e-001, 9.953145e-001,
+9.954013e-001, 9.954880e-001, 9.955748e-001, 9.956616e-001, 9.957483e-001, 9.958351e-001, 9.959219e-001, 9.960086e-001, 9.960954e-001, 9.961822e-001,
+9.962690e-001, 9.963557e-001, 9.964425e-001, 9.965293e-001, 9.966160e-001, 9.967028e-001, 9.967896e-001, 9.968763e-001, 9.969631e-001, 9.970499e-001,
+9.971366e-001, 9.972234e-001, 9.973102e-001, 9.973969e-001, 9.974837e-001, 9.975705e-001, 9.976573e-001, 9.977440e-001, 9.978308e-001, 9.979176e-001,
+9.980043e-001, 9.980911e-001, 9.981779e-001, 9.982646e-001, 9.983514e-001, 9.984382e-001, 9.985249e-001, 9.986117e-001, 9.986985e-001, 9.987852e-001,
+9.988720e-001, 9.989588e-001, 9.990455e-001, 9.991323e-001, 9.992191e-001, 9.993059e-001, 9.993926e-001, 9.994794e-001, 9.995662e-001, 9.996529e-001,
+9.997397e-001, 9.998265e-001, 9.999132e-001, 1.000000e+000), (), (), (), ()),
+("Canon", "Optura 981113", "mlab-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.354460e-002, 2.027356e-002, 2.499111e-002, 2.970866e-002, 3.368794e-002, 3.761862e-002, 4.140956e-002, 4.498568e-002, 4.856179e-002,
+5.204238e-002, 5.545870e-002, 5.887502e-002, 6.225369e-002, 6.561388e-002, 6.897406e-002, 7.233640e-002, 7.569969e-002, 7.906297e-002, 8.245238e-002,
+8.585187e-002, 8.925137e-002, 9.269112e-002, 9.614225e-002, 9.959337e-002, 1.030921e-001, 1.065972e-001, 1.101037e-001, 1.136553e-001, 1.172068e-001,
+1.207652e-001, 1.243487e-001, 1.279323e-001, 1.315213e-001, 1.351178e-001, 1.387143e-001, 1.423058e-001, 1.458944e-001, 1.494831e-001, 1.530473e-001,
+1.566074e-001, 1.601653e-001, 1.636778e-001, 1.671904e-001, 1.706902e-001, 1.741390e-001, 1.775878e-001, 1.810135e-001, 1.843855e-001, 1.877575e-001,
+1.911004e-001, 1.943856e-001, 1.976709e-001, 2.009289e-001, 2.041204e-001, 2.073119e-001, 2.104879e-001, 2.135811e-001, 2.166743e-001, 2.197676e-001,
+2.227675e-001, 2.257599e-001, 2.287522e-001, 2.316852e-001, 2.345757e-001, 2.374662e-001, 2.403441e-001, 2.431329e-001, 2.459216e-001, 2.487104e-001,
+2.514450e-001, 2.541330e-001, 2.568210e-001, 2.595091e-001, 2.621161e-001, 2.647051e-001, 2.672941e-001, 2.698830e-001, 2.723795e-001, 2.748716e-001,
+2.773637e-001, 2.798558e-001, 2.822590e-001, 2.846568e-001, 2.870546e-001, 2.894524e-001, 2.917796e-001, 2.940860e-001, 2.963924e-001, 2.986988e-001,
+3.009668e-001, 3.031851e-001, 3.054033e-001, 3.076216e-001, 3.098398e-001, 3.119795e-001, 3.141130e-001, 3.162465e-001, 3.183800e-001, 3.204941e-001,
+3.225466e-001, 3.245992e-001, 3.266518e-001, 3.287043e-001, 3.307285e-001, 3.327040e-001, 3.346796e-001, 3.366551e-001, 3.386306e-001, 3.405838e-001,
+3.424864e-001, 3.443890e-001, 3.462916e-001, 3.481942e-001, 3.500933e-001, 3.519272e-001, 3.537611e-001, 3.555950e-001, 3.574289e-001, 3.592628e-001,
+3.610582e-001, 3.628278e-001, 3.645974e-001, 3.663670e-001, 3.681367e-001, 3.699063e-001, 3.716191e-001, 3.733288e-001, 3.750385e-001, 3.767482e-001,
+3.784579e-001, 3.801622e-001, 3.818164e-001, 3.834707e-001, 3.851250e-001, 3.867792e-001, 3.884335e-001, 3.900850e-001, 3.916883e-001, 3.932915e-001,
+3.948947e-001, 3.964980e-001, 3.981012e-001, 3.997045e-001, 4.012697e-001, 4.028264e-001, 4.043831e-001, 4.059397e-001, 4.074964e-001, 4.090531e-001,
+4.105932e-001, 4.121076e-001, 4.136220e-001, 4.151364e-001, 4.166508e-001, 4.181652e-001, 4.196796e-001, 4.211640e-001, 4.226403e-001, 4.241167e-001,
+4.255930e-001, 4.270694e-001, 4.285457e-001, 4.300215e-001, 4.314639e-001, 4.329063e-001, 4.343487e-001, 4.357911e-001, 4.372335e-001, 4.386759e-001,
+4.401158e-001, 4.415282e-001, 4.429405e-001, 4.443529e-001, 4.457652e-001, 4.471775e-001, 4.485899e-001, 4.500022e-001, 4.513882e-001, 4.527742e-001,
+4.541603e-001, 4.555463e-001, 4.569324e-001, 4.583184e-001, 4.597045e-001, 4.610726e-001, 4.624360e-001, 4.637993e-001, 4.651626e-001, 4.665259e-001,
+4.678892e-001, 4.692526e-001, 4.706071e-001, 4.719510e-001, 4.732949e-001, 4.746388e-001, 4.759827e-001, 4.773266e-001, 4.786705e-001, 4.800142e-001,
+4.813418e-001, 4.826693e-001, 4.839969e-001, 4.853244e-001, 4.866519e-001, 4.879795e-001, 4.893070e-001, 4.906281e-001, 4.919421e-001, 4.932560e-001,
+4.945700e-001, 4.958840e-001, 4.971980e-001, 4.985119e-001, 4.998259e-001, 5.011303e-001, 5.024331e-001, 5.037360e-001, 5.050389e-001, 5.063418e-001,
+5.076446e-001, 5.089475e-001, 5.102487e-001, 5.115425e-001, 5.128364e-001, 5.141303e-001, 5.154241e-001, 5.167180e-001, 5.180119e-001, 5.193057e-001,
+5.205962e-001, 5.218827e-001, 5.231693e-001, 5.244558e-001, 5.257424e-001, 5.270290e-001, 5.283155e-001, 5.296021e-001, 5.308844e-001, 5.321650e-001,
+5.334455e-001, 5.347260e-001, 5.360065e-001, 5.372870e-001, 5.385676e-001, 5.398481e-001, 5.411239e-001, 5.423991e-001, 5.436743e-001, 5.449495e-001,
+5.462247e-001, 5.474999e-001, 5.487751e-001, 5.500501e-001, 5.513203e-001, 5.525904e-001, 5.538605e-001, 5.551306e-001, 5.564008e-001, 5.576709e-001,
+5.589410e-001, 5.602102e-001, 5.614749e-001, 5.627396e-001, 5.640043e-001, 5.652690e-001, 5.665337e-001, 5.677984e-001, 5.690631e-001, 5.703262e-001,
+5.715845e-001, 5.728428e-001, 5.741011e-001, 5.753594e-001, 5.766177e-001, 5.778760e-001, 5.791343e-001, 5.803902e-001, 5.816406e-001, 5.828910e-001,
+5.841414e-001, 5.853918e-001, 5.866422e-001, 5.878926e-001, 5.891430e-001, 5.903903e-001, 5.916307e-001, 5.928711e-001, 5.941116e-001, 5.953520e-001,
+5.965924e-001, 5.978329e-001, 5.990733e-001, 6.003105e-001, 6.015384e-001, 6.027663e-001, 6.039941e-001, 6.052220e-001, 6.064499e-001, 6.076777e-001,
+6.089056e-001, 6.101318e-001, 6.113442e-001, 6.125565e-001, 6.137689e-001, 6.149813e-001, 6.161937e-001, 6.174061e-001, 6.186185e-001, 6.198309e-001,
+6.210272e-001, 6.222210e-001, 6.234147e-001, 6.246085e-001, 6.258022e-001, 6.269960e-001, 6.281897e-001, 6.293835e-001, 6.305666e-001, 6.317385e-001,
+6.329104e-001, 6.340823e-001, 6.352541e-001, 6.364260e-001, 6.375979e-001, 6.387698e-001, 6.399417e-001, 6.410898e-001, 6.422367e-001, 6.433836e-001,
+6.445305e-001, 6.456773e-001, 6.468242e-001, 6.479711e-001, 6.491180e-001, 6.502585e-001, 6.513776e-001, 6.524967e-001, 6.536157e-001, 6.547348e-001,
+6.558539e-001, 6.569730e-001, 6.580921e-001, 6.592112e-001, 6.603214e-001, 6.614103e-001, 6.624992e-001, 6.635881e-001, 6.646770e-001, 6.657659e-001,
+6.668548e-001, 6.679437e-001, 6.690326e-001, 6.701180e-001, 6.711750e-001, 6.722319e-001, 6.732889e-001, 6.743459e-001, 6.754029e-001, 6.764598e-001,
+6.775168e-001, 6.785738e-001, 6.796308e-001, 6.806663e-001, 6.816902e-001, 6.827141e-001, 6.837380e-001, 6.847619e-001, 6.857858e-001, 6.868097e-001,
+6.878336e-001, 6.888575e-001, 6.898815e-001, 6.908758e-001, 6.918662e-001, 6.928567e-001, 6.938471e-001, 6.948375e-001, 6.958280e-001, 6.968184e-001,
+6.978089e-001, 6.987993e-001, 6.997897e-001, 7.007541e-001, 7.017113e-001, 7.026686e-001, 7.036259e-001, 7.045832e-001, 7.055405e-001, 7.064978e-001,
+7.074551e-001, 7.084123e-001, 7.093696e-001, 7.103159e-001, 7.112410e-001, 7.121661e-001, 7.130912e-001, 7.140163e-001, 7.149414e-001, 7.158665e-001,
+7.167915e-001, 7.177166e-001, 7.186417e-001, 7.195668e-001, 7.204756e-001, 7.213701e-001, 7.222646e-001, 7.231591e-001, 7.240536e-001, 7.249481e-001,
+7.258425e-001, 7.267370e-001, 7.276315e-001, 7.285260e-001, 7.294205e-001, 7.303049e-001, 7.311709e-001, 7.320369e-001, 7.329029e-001, 7.337688e-001,
+7.346348e-001, 7.355008e-001, 7.363668e-001, 7.372328e-001, 7.380987e-001, 7.389647e-001, 7.398307e-001, 7.406758e-001, 7.415159e-001, 7.423559e-001,
+7.431960e-001, 7.440360e-001, 7.448761e-001, 7.457161e-001, 7.465562e-001, 7.473962e-001, 7.482363e-001, 7.490763e-001, 7.499164e-001, 7.507357e-001,
+7.515528e-001, 7.523698e-001, 7.531868e-001, 7.540039e-001, 7.548209e-001, 7.556380e-001, 7.564550e-001, 7.572721e-001, 7.580891e-001, 7.589061e-001,
+7.597232e-001, 7.605272e-001, 7.613244e-001, 7.621217e-001, 7.629190e-001, 7.637163e-001, 7.645135e-001, 7.653108e-001, 7.661081e-001, 7.669054e-001,
+7.677026e-001, 7.684999e-001, 7.692972e-001, 7.700925e-001, 7.708735e-001, 7.716544e-001, 7.724353e-001, 7.732163e-001, 7.739972e-001, 7.747782e-001,
+7.755591e-001, 7.763401e-001, 7.771210e-001, 7.779019e-001, 7.786829e-001, 7.794638e-001, 7.802408e-001, 7.810090e-001, 7.817772e-001, 7.825455e-001,
+7.833137e-001, 7.840819e-001, 7.848502e-001, 7.856184e-001, 7.863866e-001, 7.871549e-001, 7.879231e-001, 7.886913e-001, 7.894595e-001, 7.902251e-001,
+7.909843e-001, 7.917435e-001, 7.925027e-001, 7.932620e-001, 7.940212e-001, 7.947804e-001, 7.955396e-001, 7.962988e-001, 7.970580e-001, 7.978172e-001,
+7.985765e-001, 7.993357e-001, 8.000942e-001, 8.008481e-001, 8.016020e-001, 8.023559e-001, 8.031098e-001, 8.038637e-001, 8.046176e-001, 8.053714e-001,
+8.061253e-001, 8.068792e-001, 8.076331e-001, 8.083870e-001, 8.091409e-001, 8.098948e-001, 8.106471e-001, 8.113992e-001, 8.121514e-001, 8.129035e-001,
+8.136556e-001, 8.144077e-001, 8.151598e-001, 8.159119e-001, 8.166640e-001, 8.174161e-001, 8.181683e-001, 8.189204e-001, 8.196725e-001, 8.204254e-001,
+8.211789e-001, 8.219324e-001, 8.226860e-001, 8.234395e-001, 8.241930e-001, 8.249465e-001, 8.257001e-001, 8.264536e-001, 8.272071e-001, 8.279606e-001,
+8.287142e-001, 8.294677e-001, 8.302224e-001, 8.309798e-001, 8.317373e-001, 8.324948e-001, 8.332523e-001, 8.340097e-001, 8.347672e-001, 8.355247e-001,
+8.362821e-001, 8.370396e-001, 8.377971e-001, 8.385546e-001, 8.393120e-001, 8.400700e-001, 8.408328e-001, 8.415955e-001, 8.423583e-001, 8.431211e-001,
+8.438839e-001, 8.446466e-001, 8.454094e-001, 8.461722e-001, 8.469349e-001, 8.476977e-001, 8.484605e-001, 8.492233e-001, 8.499860e-001, 8.507535e-001,
+8.515210e-001, 8.522886e-001, 8.530562e-001, 8.538237e-001, 8.545913e-001, 8.553588e-001, 8.561264e-001, 8.568939e-001, 8.576615e-001, 8.584290e-001,
+8.591966e-001, 8.599641e-001, 8.607331e-001, 8.615022e-001, 8.622712e-001, 8.630402e-001, 8.638093e-001, 8.645783e-001, 8.653474e-001, 8.661164e-001,
+8.668855e-001, 8.676545e-001, 8.684235e-001, 8.691926e-001, 8.699616e-001, 8.707254e-001, 8.714889e-001, 8.722524e-001, 8.730159e-001, 8.737794e-001,
+8.745429e-001, 8.753065e-001, 8.760700e-001, 8.768335e-001, 8.775970e-001, 8.783605e-001, 8.791240e-001, 8.798875e-001, 8.806366e-001, 8.813831e-001,
+8.821297e-001, 8.828763e-001, 8.836229e-001, 8.843695e-001, 8.851160e-001, 8.858626e-001, 8.866092e-001, 8.873558e-001, 8.881024e-001, 8.888489e-001,
+8.895955e-001, 8.903273e-001, 8.910416e-001, 8.917558e-001, 8.924701e-001, 8.931844e-001, 8.938987e-001, 8.946129e-001, 8.953272e-001, 8.960415e-001,
+8.967557e-001, 8.974700e-001, 8.981843e-001, 8.988986e-001, 8.996128e-001, 9.003043e-001, 9.009688e-001, 9.016332e-001, 9.022977e-001, 9.029622e-001,
+9.036267e-001, 9.042911e-001, 9.049556e-001, 9.056201e-001, 9.062846e-001, 9.069490e-001, 9.076135e-001, 9.082780e-001, 9.089424e-001, 9.096069e-001,
+9.102444e-001, 9.108429e-001, 9.114415e-001, 9.120400e-001, 9.126385e-001, 9.132370e-001, 9.138355e-001, 9.144340e-001, 9.150325e-001, 9.156310e-001,
+9.162295e-001, 9.168280e-001, 9.174265e-001, 9.180250e-001, 9.186235e-001, 9.192220e-001, 9.198205e-001, 9.203650e-001, 9.208864e-001, 9.214078e-001,
+9.219291e-001, 9.224505e-001, 9.229718e-001, 9.234932e-001, 9.240146e-001, 9.245359e-001, 9.250573e-001, 9.255786e-001, 9.261000e-001, 9.266214e-001,
+9.271427e-001, 9.276641e-001, 9.281855e-001, 9.287068e-001, 9.292282e-001, 9.297495e-001, 9.302288e-001, 9.306690e-001, 9.311093e-001, 9.315496e-001,
+9.319899e-001, 9.324302e-001, 9.328704e-001, 9.333107e-001, 9.337510e-001, 9.341913e-001, 9.346316e-001, 9.350718e-001, 9.355121e-001, 9.359524e-001,
+9.363927e-001, 9.368330e-001, 9.372732e-001, 9.377135e-001, 9.381538e-001, 9.385941e-001, 9.390344e-001, 9.394746e-001, 9.399149e-001, 9.402923e-001,
+9.406546e-001, 9.410169e-001, 9.413792e-001, 9.417415e-001, 9.421038e-001, 9.424661e-001, 9.428284e-001, 9.431907e-001, 9.435530e-001, 9.439153e-001,
+9.442776e-001, 9.446399e-001, 9.450022e-001, 9.453646e-001, 9.457269e-001, 9.460892e-001, 9.464515e-001, 9.468138e-001, 9.471761e-001, 9.475384e-001,
+9.479007e-001, 9.482630e-001, 9.486253e-001, 9.489876e-001, 9.493499e-001, 9.497122e-001, 9.500601e-001, 9.503526e-001, 9.506450e-001, 9.509374e-001,
+9.512298e-001, 9.515223e-001, 9.518147e-001, 9.521071e-001, 9.523995e-001, 9.526920e-001, 9.529844e-001, 9.532768e-001, 9.535692e-001, 9.538617e-001,
+9.541541e-001, 9.544465e-001, 9.547389e-001, 9.550314e-001, 9.553238e-001, 9.556162e-001, 9.559086e-001, 9.562011e-001, 9.564935e-001, 9.567859e-001,
+9.570783e-001, 9.573707e-001, 9.576632e-001, 9.579556e-001, 9.582480e-001, 9.585404e-001, 9.588329e-001, 9.591253e-001, 9.594177e-001, 9.597101e-001,
+9.600020e-001, 9.602351e-001, 9.604681e-001, 9.607011e-001, 9.609341e-001, 9.611671e-001, 9.614001e-001, 9.616331e-001, 9.618662e-001, 9.620992e-001,
+9.623322e-001, 9.625652e-001, 9.627982e-001, 9.630312e-001, 9.632642e-001, 9.634973e-001, 9.637303e-001, 9.639633e-001, 9.641963e-001, 9.644293e-001,
+9.646623e-001, 9.648953e-001, 9.651284e-001, 9.653614e-001, 9.655944e-001, 9.658274e-001, 9.660604e-001, 9.662934e-001, 9.665264e-001, 9.667595e-001,
+9.669925e-001, 9.672255e-001, 9.674585e-001, 9.676915e-001, 9.679245e-001, 9.681575e-001, 9.683906e-001, 9.686236e-001, 9.688566e-001, 9.690896e-001,
+9.693226e-001, 9.695556e-001, 9.697886e-001, 9.700171e-001, 9.702015e-001, 9.703858e-001, 9.705702e-001, 9.707545e-001, 9.709389e-001, 9.711232e-001,
+9.713076e-001, 9.714919e-001, 9.716763e-001, 9.718606e-001, 9.720450e-001, 9.722293e-001, 9.724137e-001, 9.725980e-001, 9.727824e-001, 9.729667e-001,
+9.731511e-001, 9.733354e-001, 9.735198e-001, 9.737041e-001, 9.738885e-001, 9.740728e-001, 9.742572e-001, 9.744415e-001, 9.746259e-001, 9.748102e-001,
+9.749946e-001, 9.751789e-001, 9.753633e-001, 9.755476e-001, 9.757320e-001, 9.759163e-001, 9.761006e-001, 9.762850e-001, 9.764693e-001, 9.766537e-001,
+9.768380e-001, 9.770224e-001, 9.772067e-001, 9.773911e-001, 9.775754e-001, 9.777598e-001, 9.779441e-001, 9.781285e-001, 9.783128e-001, 9.784972e-001,
+9.786815e-001, 9.788659e-001, 9.790502e-001, 9.792346e-001, 9.794189e-001, 9.796033e-001, 9.797876e-001, 9.799720e-001, 9.801233e-001, 9.802688e-001,
+9.804142e-001, 9.805597e-001, 9.807051e-001, 9.808506e-001, 9.809960e-001, 9.811415e-001, 9.812869e-001, 9.814324e-001, 9.815778e-001, 9.817233e-001,
+9.818687e-001, 9.820142e-001, 9.821596e-001, 9.823051e-001, 9.824505e-001, 9.825960e-001, 9.827414e-001, 9.828869e-001, 9.830323e-001, 9.831778e-001,
+9.833232e-001, 9.834687e-001, 9.836141e-001, 9.837596e-001, 9.839050e-001, 9.840505e-001, 9.841959e-001, 9.843414e-001, 9.844868e-001, 9.846323e-001,
+9.847777e-001, 9.849232e-001, 9.850686e-001, 9.852141e-001, 9.853595e-001, 9.855050e-001, 9.856504e-001, 9.857959e-001, 9.859413e-001, 9.860868e-001,
+9.862322e-001, 9.863777e-001, 9.865231e-001, 9.866686e-001, 9.868140e-001, 9.869595e-001, 9.871049e-001, 9.872504e-001, 9.873958e-001, 9.875413e-001,
+9.876867e-001, 9.878322e-001, 9.879776e-001, 9.881231e-001, 9.882685e-001, 9.884140e-001, 9.885594e-001, 9.887049e-001, 9.888503e-001, 9.889958e-001,
+9.891412e-001, 9.892867e-001, 9.894321e-001, 9.895776e-001, 9.897231e-001, 9.898685e-001, 9.900110e-001, 9.901258e-001, 9.902406e-001, 9.903555e-001,
+9.904703e-001, 9.905851e-001, 9.906999e-001, 9.908147e-001, 9.909295e-001, 9.910444e-001, 9.911592e-001, 9.912740e-001, 9.913888e-001, 9.915036e-001,
+9.916184e-001, 9.917333e-001, 9.918481e-001, 9.919629e-001, 9.920777e-001, 9.921925e-001, 9.923073e-001, 9.924221e-001, 9.925370e-001, 9.926518e-001,
+9.927666e-001, 9.928814e-001, 9.929962e-001, 9.931110e-001, 9.932259e-001, 9.933407e-001, 9.934555e-001, 9.935703e-001, 9.936851e-001, 9.937999e-001,
+9.939148e-001, 9.940296e-001, 9.941444e-001, 9.942592e-001, 9.943740e-001, 9.944888e-001, 9.946037e-001, 9.947185e-001, 9.948333e-001, 9.949481e-001,
+9.950629e-001, 9.951777e-001, 9.952925e-001, 9.954074e-001, 9.955222e-001, 9.956370e-001, 9.957518e-001, 9.958666e-001, 9.959814e-001, 9.960963e-001,
+9.962111e-001, 9.963259e-001, 9.964407e-001, 9.965555e-001, 9.966703e-001, 9.967852e-001, 9.969000e-001, 9.970148e-001, 9.971296e-001, 9.972444e-001,
+9.973592e-001, 9.974740e-001, 9.975889e-001, 9.977037e-001, 9.978185e-001, 9.979333e-001, 9.980481e-001, 9.981629e-001, 9.982778e-001, 9.983926e-001,
+9.985074e-001, 9.986222e-001, 9.987370e-001, 9.988518e-001, 9.989667e-001, 9.990815e-001, 9.991963e-001, 9.993111e-001, 9.994259e-001, 9.995407e-001,
+9.996556e-001, 9.997704e-001, 9.998852e-001, 1.000000e+000), (), (), (), ()),
+("Canon", "Optura 981114", "mlab-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.154998e-003, 2.309995e-003, 3.464993e-003, 4.619990e-003, 5.774988e-003, 6.929986e-003, 8.084983e-003, 9.239981e-003, 1.049889e-002,
+1.195773e-002, 1.341657e-002, 1.487541e-002, 1.633426e-002, 1.779310e-002, 1.925194e-002, 2.088223e-002, 2.269296e-002, 2.450369e-002, 2.631441e-002,
+2.812514e-002, 2.993587e-002, 3.211057e-002, 3.429863e-002, 3.648670e-002, 3.867477e-002, 4.100609e-002, 4.355745e-002, 4.610881e-002, 4.866017e-002,
+5.135511e-002, 5.420884e-002, 5.706257e-002, 5.991630e-002, 6.296947e-002, 6.602866e-002, 6.908785e-002, 7.221589e-002, 7.537318e-002, 7.853047e-002,
+8.169078e-002, 8.485371e-002, 8.801664e-002, 9.115773e-002, 9.426210e-002, 9.736647e-002, 1.004566e-001, 1.034670e-001, 1.064774e-001, 1.094878e-001,
+1.124092e-001, 1.153124e-001, 1.182156e-001, 1.210780e-001, 1.238754e-001, 1.266727e-001, 1.294700e-001, 1.321891e-001, 1.348898e-001, 1.375905e-001,
+1.402822e-001, 1.428993e-001, 1.455163e-001, 1.481334e-001, 1.507305e-001, 1.532779e-001, 1.558253e-001, 1.583727e-001, 1.608998e-001, 1.633909e-001,
+1.658820e-001, 1.683732e-001, 1.708490e-001, 1.732959e-001, 1.757429e-001, 1.781898e-001, 1.806280e-001, 1.830410e-001, 1.854541e-001, 1.878672e-001,
+1.902773e-001, 1.926648e-001, 1.950524e-001, 1.974399e-001, 1.998274e-001, 2.021971e-001, 2.045654e-001, 2.069337e-001, 2.093020e-001, 2.116596e-001,
+2.140129e-001, 2.163662e-001, 2.187194e-001, 2.210668e-001, 2.234073e-001, 2.257477e-001, 2.280881e-001, 2.304262e-001, 2.327540e-001, 2.350818e-001,
+2.374096e-001, 2.397375e-001, 2.420527e-001, 2.443664e-001, 2.466801e-001, 2.489938e-001, 2.512977e-001, 2.535941e-001, 2.558905e-001, 2.581869e-001,
+2.604787e-001, 2.627534e-001, 2.650281e-001, 2.673028e-001, 2.695775e-001, 2.718302e-001, 2.740780e-001, 2.763257e-001, 2.785734e-001, 2.808091e-001,
+2.830239e-001, 2.852387e-001, 2.874535e-001, 2.896682e-001, 2.918500e-001, 2.940259e-001, 2.962018e-001, 2.983777e-001, 3.005423e-001, 3.026735e-001,
+3.048047e-001, 3.069360e-001, 3.090672e-001, 3.111705e-001, 3.132519e-001, 3.153333e-001, 3.174148e-001, 3.194962e-001, 3.215366e-001, 3.235639e-001,
+3.255912e-001, 3.276185e-001, 3.296457e-001, 3.316256e-001, 3.335955e-001, 3.355653e-001, 3.375352e-001, 3.395051e-001, 3.414302e-001, 3.433404e-001,
+3.452506e-001, 3.471608e-001, 3.490710e-001, 3.509501e-001, 3.527996e-001, 3.546491e-001, 3.564986e-001, 3.583482e-001, 3.601912e-001, 3.619799e-001,
+3.637686e-001, 3.655573e-001, 3.673460e-001, 3.691348e-001, 3.708925e-001, 3.726213e-001, 3.743501e-001, 3.760789e-001, 3.778077e-001, 3.795365e-001,
+3.812227e-001, 3.828932e-001, 3.845637e-001, 3.862342e-001, 3.879047e-001, 3.895752e-001, 3.912039e-001, 3.928183e-001, 3.944328e-001, 3.960472e-001,
+3.976616e-001, 3.992760e-001, 4.008611e-001, 4.024222e-001, 4.039833e-001, 4.055444e-001, 4.071056e-001, 4.086667e-001, 4.102205e-001, 4.117314e-001,
+4.132422e-001, 4.147531e-001, 4.162640e-001, 4.177748e-001, 4.192857e-001, 4.207718e-001, 4.222357e-001, 4.236997e-001, 4.251636e-001, 4.266275e-001,
+4.280914e-001, 4.295553e-001, 4.309889e-001, 4.324093e-001, 4.338297e-001, 4.352501e-001, 4.366704e-001, 4.380908e-001, 4.395112e-001, 4.409053e-001,
+4.422855e-001, 4.436658e-001, 4.450461e-001, 4.464264e-001, 4.478067e-001, 4.491870e-001, 4.505522e-001, 4.518958e-001, 4.532394e-001, 4.545830e-001,
+4.559266e-001, 4.572702e-001, 4.586139e-001, 4.599575e-001, 4.612688e-001, 4.625792e-001, 4.638895e-001, 4.651998e-001, 4.665101e-001, 4.678204e-001,
+4.691307e-001, 4.704309e-001, 4.717112e-001, 4.729914e-001, 4.742717e-001, 4.755519e-001, 4.768322e-001, 4.781124e-001, 4.793927e-001, 4.806587e-001,
+4.819120e-001, 4.831653e-001, 4.844186e-001, 4.856719e-001, 4.869252e-001, 4.881785e-001, 4.894317e-001, 4.906719e-001, 4.919011e-001, 4.931304e-001,
+4.943596e-001, 4.955889e-001, 4.968182e-001, 4.980474e-001, 4.992767e-001, 5.004972e-001, 5.017052e-001, 5.029132e-001, 5.041211e-001, 5.053291e-001,
+5.065371e-001, 5.077451e-001, 5.089531e-001, 5.101586e-001, 5.113480e-001, 5.125373e-001, 5.137266e-001, 5.149159e-001, 5.161053e-001, 5.172946e-001,
+5.184839e-001, 5.196733e-001, 5.208508e-001, 5.220239e-001, 5.231969e-001, 5.243700e-001, 5.255431e-001, 5.267162e-001, 5.278892e-001, 5.290623e-001,
+5.302325e-001, 5.313915e-001, 5.325506e-001, 5.337096e-001, 5.348686e-001, 5.360276e-001, 5.371866e-001, 5.383456e-001, 5.395046e-001, 5.406568e-001,
+5.418038e-001, 5.429507e-001, 5.440977e-001, 5.452447e-001, 5.463917e-001, 5.475387e-001, 5.486857e-001, 5.498327e-001, 5.509709e-001, 5.521077e-001,
+5.532445e-001, 5.543813e-001, 5.555181e-001, 5.566549e-001, 5.577917e-001, 5.589285e-001, 5.600648e-001, 5.611930e-001, 5.623212e-001, 5.634494e-001,
+5.645776e-001, 5.657058e-001, 5.668340e-001, 5.679622e-001, 5.690904e-001, 5.702172e-001, 5.713383e-001, 5.724594e-001, 5.735804e-001, 5.747015e-001,
+5.758226e-001, 5.769437e-001, 5.780647e-001, 5.791858e-001, 5.803053e-001, 5.814205e-001, 5.825356e-001, 5.836508e-001, 5.847660e-001, 5.858812e-001,
+5.869964e-001, 5.881116e-001, 5.892268e-001, 5.903405e-001, 5.914508e-001, 5.925611e-001, 5.936715e-001, 5.947818e-001, 5.958922e-001, 5.970025e-001,
+5.981129e-001, 5.992232e-001, 6.003324e-001, 6.014387e-001, 6.025451e-001, 6.036515e-001, 6.047579e-001, 6.058642e-001, 6.069706e-001, 6.080770e-001,
+6.091833e-001, 6.102889e-001, 6.113919e-001, 6.124950e-001, 6.135980e-001, 6.147011e-001, 6.158042e-001, 6.169072e-001, 6.180103e-001, 6.191134e-001,
+6.202159e-001, 6.213161e-001, 6.224164e-001, 6.235167e-001, 6.246169e-001, 6.257172e-001, 6.268175e-001, 6.279177e-001, 6.290180e-001, 6.301180e-001,
+6.312158e-001, 6.323136e-001, 6.334114e-001, 6.345092e-001, 6.356070e-001, 6.367048e-001, 6.378026e-001, 6.389004e-001, 6.399982e-001, 6.410936e-001,
+6.421891e-001, 6.432846e-001, 6.443800e-001, 6.454755e-001, 6.465710e-001, 6.476664e-001, 6.487619e-001, 6.498574e-001, 6.509508e-001, 6.520440e-001,
+6.531371e-001, 6.542303e-001, 6.553234e-001, 6.564166e-001, 6.575097e-001, 6.586029e-001, 6.596960e-001, 6.607874e-001, 6.618781e-001, 6.629689e-001,
+6.640596e-001, 6.651503e-001, 6.662410e-001, 6.673317e-001, 6.684224e-001, 6.695131e-001, 6.706023e-001, 6.716903e-001, 6.727783e-001, 6.738663e-001,
+6.749543e-001, 6.760424e-001, 6.771304e-001, 6.782184e-001, 6.793064e-001, 6.803932e-001, 6.814782e-001, 6.825631e-001, 6.836480e-001, 6.847329e-001,
+6.858179e-001, 6.869028e-001, 6.879877e-001, 6.890726e-001, 6.901570e-001, 6.912384e-001, 6.923197e-001, 6.934010e-001, 6.944824e-001, 6.955637e-001,
+6.966450e-001, 6.977263e-001, 6.988077e-001, 6.998890e-001, 7.009666e-001, 7.020437e-001, 7.031209e-001, 7.041980e-001, 7.052752e-001, 7.063523e-001,
+7.074295e-001, 7.085066e-001, 7.095838e-001, 7.106579e-001, 7.117302e-001, 7.128025e-001, 7.138748e-001, 7.149470e-001, 7.160193e-001, 7.170916e-001,
+7.181639e-001, 7.192361e-001, 7.203068e-001, 7.213734e-001, 7.224400e-001, 7.235066e-001, 7.245731e-001, 7.256397e-001, 7.267063e-001, 7.277729e-001,
+7.288395e-001, 7.299061e-001, 7.309666e-001, 7.320266e-001, 7.330866e-001, 7.341465e-001, 7.352065e-001, 7.362665e-001, 7.373265e-001, 7.383864e-001,
+7.394464e-001, 7.405027e-001, 7.415549e-001, 7.426072e-001, 7.436594e-001, 7.447116e-001, 7.457639e-001, 7.468161e-001, 7.478684e-001, 7.489206e-001,
+7.499728e-001, 7.510163e-001, 7.520595e-001, 7.531028e-001, 7.541460e-001, 7.551892e-001, 7.562325e-001, 7.572757e-001, 7.583189e-001, 7.593622e-001,
+7.604013e-001, 7.614340e-001, 7.624667e-001, 7.634994e-001, 7.645321e-001, 7.655648e-001, 7.665975e-001, 7.676302e-001, 7.686629e-001, 7.696956e-001,
+7.707196e-001, 7.717399e-001, 7.727602e-001, 7.737805e-001, 7.748008e-001, 7.758212e-001, 7.768415e-001, 7.778618e-001, 7.788821e-001, 7.799024e-001,
+7.809096e-001, 7.819153e-001, 7.829211e-001, 7.839268e-001, 7.849326e-001, 7.859383e-001, 7.869440e-001, 7.879498e-001, 7.889555e-001, 7.899613e-001,
+7.909505e-001, 7.919390e-001, 7.929275e-001, 7.939161e-001, 7.949046e-001, 7.958931e-001, 7.968817e-001, 7.978702e-001, 7.988587e-001, 7.998473e-001,
+8.008186e-001, 8.017868e-001, 8.027550e-001, 8.037232e-001, 8.046915e-001, 8.056597e-001, 8.066279e-001, 8.075961e-001, 8.085643e-001, 8.095325e-001,
+8.104883e-001, 8.114325e-001, 8.123768e-001, 8.133210e-001, 8.142652e-001, 8.152094e-001, 8.161537e-001, 8.170979e-001, 8.180421e-001, 8.189863e-001,
+8.199306e-001, 8.208488e-001, 8.217649e-001, 8.226810e-001, 8.235971e-001, 8.245132e-001, 8.254293e-001, 8.263454e-001, 8.272615e-001, 8.281776e-001,
+8.290937e-001, 8.300095e-001, 8.308929e-001, 8.317763e-001, 8.326597e-001, 8.335431e-001, 8.344264e-001, 8.353098e-001, 8.361932e-001, 8.370766e-001,
+8.379600e-001, 8.388434e-001, 8.397268e-001, 8.405842e-001, 8.414300e-001, 8.422757e-001, 8.431215e-001, 8.439673e-001, 8.448130e-001, 8.456588e-001,
+8.465046e-001, 8.473503e-001, 8.481961e-001, 8.490419e-001, 8.498876e-001, 8.506965e-001, 8.514997e-001, 8.523029e-001, 8.531061e-001, 8.539093e-001,
+8.547124e-001, 8.555156e-001, 8.563188e-001, 8.571220e-001, 8.579252e-001, 8.587284e-001, 8.595316e-001, 8.603150e-001, 8.610709e-001, 8.618268e-001,
+8.625826e-001, 8.633385e-001, 8.640943e-001, 8.648502e-001, 8.656061e-001, 8.663619e-001, 8.671178e-001, 8.678736e-001, 8.686295e-001, 8.693854e-001,
+8.701316e-001, 8.708360e-001, 8.715404e-001, 8.722447e-001, 8.729491e-001, 8.736535e-001, 8.743578e-001, 8.750622e-001, 8.757666e-001, 8.764710e-001,
+8.771753e-001, 8.778797e-001, 8.785841e-001, 8.792884e-001, 8.799928e-001, 8.806430e-001, 8.812926e-001, 8.819422e-001, 8.825919e-001, 8.832415e-001,
+8.838911e-001, 8.845407e-001, 8.851904e-001, 8.858400e-001, 8.864896e-001, 8.871392e-001, 8.877889e-001, 8.884385e-001, 8.890881e-001, 8.897377e-001,
+8.903535e-001, 8.909463e-001, 8.915392e-001, 8.921320e-001, 8.927248e-001, 8.933176e-001, 8.939105e-001, 8.945033e-001, 8.950961e-001, 8.956890e-001,
+8.962818e-001, 8.968746e-001, 8.974675e-001, 8.980603e-001, 8.986531e-001, 8.992459e-001, 8.998388e-001, 9.003898e-001, 9.009251e-001, 9.014605e-001,
+9.019958e-001, 9.025312e-001, 9.030666e-001, 9.036019e-001, 9.041373e-001, 9.046726e-001, 9.052080e-001, 9.057434e-001, 9.062787e-001, 9.068141e-001,
+9.073494e-001, 9.078848e-001, 9.084202e-001, 9.089555e-001, 9.094909e-001, 9.100235e-001, 9.105021e-001, 9.109807e-001, 9.114594e-001, 9.119380e-001,
+9.124166e-001, 9.128953e-001, 9.133739e-001, 9.138525e-001, 9.143312e-001, 9.148098e-001, 9.152884e-001, 9.157671e-001, 9.162457e-001, 9.167243e-001,
+9.172030e-001, 9.176816e-001, 9.181602e-001, 9.186389e-001, 9.191175e-001, 9.195961e-001, 9.200662e-001, 9.204902e-001, 9.209141e-001, 9.213381e-001,
+9.217620e-001, 9.221860e-001, 9.226099e-001, 9.230339e-001, 9.234578e-001, 9.238818e-001, 9.243057e-001, 9.247297e-001, 9.251536e-001, 9.255775e-001,
+9.260015e-001, 9.264254e-001, 9.268494e-001, 9.272733e-001, 9.276973e-001, 9.281212e-001, 9.285452e-001, 9.289691e-001, 9.293931e-001, 9.298170e-001,
+9.302117e-001, 9.305841e-001, 9.309565e-001, 9.313288e-001, 9.317012e-001, 9.320736e-001, 9.324460e-001, 9.328184e-001, 9.331908e-001, 9.335632e-001,
+9.339356e-001, 9.343080e-001, 9.346803e-001, 9.350527e-001, 9.354251e-001, 9.357975e-001, 9.361699e-001, 9.365423e-001, 9.369147e-001, 9.372871e-001,
+9.376595e-001, 9.380318e-001, 9.384042e-001, 9.387766e-001, 9.391490e-001, 9.395214e-001, 9.398938e-001, 9.402321e-001, 9.405569e-001, 9.408816e-001,
+9.412063e-001, 9.415311e-001, 9.418558e-001, 9.421806e-001, 9.425053e-001, 9.428301e-001, 9.431548e-001, 9.434795e-001, 9.438043e-001, 9.441290e-001,
+9.444538e-001, 9.447785e-001, 9.451033e-001, 9.454280e-001, 9.457527e-001, 9.460775e-001, 9.464022e-001, 9.467270e-001, 9.470517e-001, 9.473764e-001,
+9.477012e-001, 9.480259e-001, 9.483507e-001, 9.486754e-001, 9.490002e-001, 9.493249e-001, 9.496496e-001, 9.499744e-001, 9.502593e-001, 9.505408e-001,
+9.508222e-001, 9.511037e-001, 9.513852e-001, 9.516667e-001, 9.519482e-001, 9.522296e-001, 9.525111e-001, 9.527926e-001, 9.530741e-001, 9.533556e-001,
+9.536370e-001, 9.539185e-001, 9.542000e-001, 9.544815e-001, 9.547630e-001, 9.550444e-001, 9.553259e-001, 9.556074e-001, 9.558889e-001, 9.561704e-001,
+9.564518e-001, 9.567333e-001, 9.570148e-001, 9.572963e-001, 9.575778e-001, 9.578592e-001, 9.581407e-001, 9.584222e-001, 9.587037e-001, 9.589852e-001,
+9.592666e-001, 9.595481e-001, 9.598296e-001, 9.600958e-001, 9.603386e-001, 9.605814e-001, 9.608242e-001, 9.610670e-001, 9.613098e-001, 9.615526e-001,
+9.617954e-001, 9.620382e-001, 9.622810e-001, 9.625238e-001, 9.627666e-001, 9.630094e-001, 9.632522e-001, 9.634950e-001, 9.637378e-001, 9.639806e-001,
+9.642234e-001, 9.644662e-001, 9.647090e-001, 9.649518e-001, 9.651946e-001, 9.654374e-001, 9.656802e-001, 9.659230e-001, 9.661658e-001, 9.664086e-001,
+9.666514e-001, 9.668942e-001, 9.671370e-001, 9.673798e-001, 9.676226e-001, 9.678654e-001, 9.681082e-001, 9.683510e-001, 9.685938e-001, 9.688366e-001,
+9.690794e-001, 9.693222e-001, 9.695650e-001, 9.698078e-001, 9.700434e-001, 9.702521e-001, 9.704608e-001, 9.706694e-001, 9.708781e-001, 9.710867e-001,
+9.712954e-001, 9.715040e-001, 9.717127e-001, 9.719213e-001, 9.721300e-001, 9.723386e-001, 9.725473e-001, 9.727559e-001, 9.729646e-001, 9.731732e-001,
+9.733819e-001, 9.735905e-001, 9.737992e-001, 9.740078e-001, 9.742165e-001, 9.744252e-001, 9.746338e-001, 9.748425e-001, 9.750511e-001, 9.752598e-001,
+9.754684e-001, 9.756771e-001, 9.758857e-001, 9.760944e-001, 9.763030e-001, 9.765117e-001, 9.767203e-001, 9.769290e-001, 9.771376e-001, 9.773463e-001,
+9.775549e-001, 9.777636e-001, 9.779723e-001, 9.781809e-001, 9.783896e-001, 9.785982e-001, 9.788069e-001, 9.790155e-001, 9.792242e-001, 9.794328e-001,
+9.796415e-001, 9.798501e-001, 9.800504e-001, 9.802292e-001, 9.804080e-001, 9.805869e-001, 9.807657e-001, 9.809445e-001, 9.811233e-001, 9.813022e-001,
+9.814810e-001, 9.816598e-001, 9.818386e-001, 9.820175e-001, 9.821963e-001, 9.823751e-001, 9.825540e-001, 9.827328e-001, 9.829116e-001, 9.830904e-001,
+9.832693e-001, 9.834481e-001, 9.836269e-001, 9.838057e-001, 9.839846e-001, 9.841634e-001, 9.843422e-001, 9.845210e-001, 9.846999e-001, 9.848787e-001,
+9.850575e-001, 9.852364e-001, 9.854152e-001, 9.855940e-001, 9.857728e-001, 9.859517e-001, 9.861305e-001, 9.863093e-001, 9.864881e-001, 9.866670e-001,
+9.868458e-001, 9.870246e-001, 9.872034e-001, 9.873823e-001, 9.875611e-001, 9.877399e-001, 9.879188e-001, 9.880976e-001, 9.882764e-001, 9.884552e-001,
+9.886341e-001, 9.888129e-001, 9.889917e-001, 9.891705e-001, 9.893494e-001, 9.895282e-001, 9.897070e-001, 9.898858e-001, 9.900553e-001, 9.902083e-001,
+9.903613e-001, 9.905143e-001, 9.906673e-001, 9.908203e-001, 9.909733e-001, 9.911263e-001, 9.912793e-001, 9.914323e-001, 9.915853e-001, 9.917383e-001,
+9.918913e-001, 9.920443e-001, 9.921973e-001, 9.923503e-001, 9.925033e-001, 9.926562e-001, 9.928092e-001, 9.929622e-001, 9.931152e-001, 9.932682e-001,
+9.934212e-001, 9.935742e-001, 9.937272e-001, 9.938802e-001, 9.940332e-001, 9.941862e-001, 9.943392e-001, 9.944922e-001, 9.946452e-001, 9.947982e-001,
+9.949512e-001, 9.951042e-001, 9.952572e-001, 9.954102e-001, 9.955631e-001, 9.957161e-001, 9.958691e-001, 9.960221e-001, 9.961751e-001, 9.963281e-001,
+9.964811e-001, 9.966341e-001, 9.967871e-001, 9.969401e-001, 9.970931e-001, 9.972461e-001, 9.973991e-001, 9.975521e-001, 9.977051e-001, 9.978581e-001,
+9.980111e-001, 9.981641e-001, 9.983171e-001, 9.984701e-001, 9.986230e-001, 9.987760e-001, 9.989290e-001, 9.990820e-001, 9.992350e-001, 9.993880e-001,
+9.995410e-001, 9.996940e-001, 9.998470e-001, 1.000000e+000), (), (), (), ()),
+("Canon", "Optura 981111.SLRR", "mlab-lin-lin", False,
+(0.000000e+000, 9.775171e-004, 1.955034e-003, 2.932551e-003, 3.910068e-003, 4.887586e-003, 5.865103e-003, 6.842620e-003, 7.820137e-003, 8.797654e-003,
+9.775171e-003, 1.075269e-002, 1.173021e-002, 1.270772e-002, 1.368524e-002, 1.466276e-002, 1.564027e-002, 1.661779e-002, 1.759531e-002, 1.857283e-002,
+1.955034e-002, 2.052786e-002, 2.150538e-002, 2.248289e-002, 2.346041e-002, 2.443793e-002, 2.541544e-002, 2.639296e-002, 2.737048e-002, 2.834800e-002,
+2.932551e-002, 3.030303e-002, 3.128055e-002, 3.225806e-002, 3.323558e-002, 3.421310e-002, 3.519062e-002, 3.616813e-002, 3.714565e-002, 3.812317e-002,
+3.910068e-002, 4.007820e-002, 4.105572e-002, 4.203324e-002, 4.301075e-002, 4.398827e-002, 4.496579e-002, 4.594330e-002, 4.692082e-002, 4.789834e-002,
+4.887586e-002, 4.985337e-002, 5.083089e-002, 5.180841e-002, 5.278592e-002, 5.376344e-002, 5.474096e-002, 5.571848e-002, 5.669599e-002, 5.767351e-002,
+5.865103e-002, 5.962854e-002, 6.060606e-002, 6.158358e-002, 6.256109e-002, 6.353861e-002, 6.451613e-002, 6.549365e-002, 6.647116e-002, 6.744868e-002,
+6.842620e-002, 6.940371e-002, 7.038123e-002, 7.135875e-002, 7.233627e-002, 7.331378e-002, 7.429130e-002, 7.526882e-002, 7.624633e-002, 7.722385e-002,
+7.820137e-002, 7.917889e-002, 8.015640e-002, 8.113392e-002, 8.211144e-002, 8.308895e-002, 8.406647e-002, 8.504399e-002, 8.602151e-002, 8.699902e-002,
+8.797654e-002, 8.895406e-002, 8.993157e-002, 9.090909e-002, 9.188661e-002, 9.286413e-002, 9.384164e-002, 9.481916e-002, 9.579668e-002, 9.677419e-002,
+9.775171e-002, 9.872923e-002, 9.970674e-002, 1.006843e-001, 1.016618e-001, 1.026393e-001, 1.036168e-001, 1.045943e-001, 1.055718e-001, 1.065494e-001,
+1.075269e-001, 1.085044e-001, 1.094819e-001, 1.104594e-001, 1.114370e-001, 1.124145e-001, 1.133920e-001, 1.143695e-001, 1.153470e-001, 1.163245e-001,
+1.173021e-001, 1.182796e-001, 1.192571e-001, 1.202346e-001, 1.212121e-001, 1.221896e-001, 1.231672e-001, 1.241447e-001, 1.251222e-001, 1.260997e-001,
+1.270772e-001, 1.280547e-001, 1.290323e-001, 1.300098e-001, 1.309873e-001, 1.319648e-001, 1.329423e-001, 1.339198e-001, 1.348974e-001, 1.358749e-001,
+1.368524e-001, 1.378299e-001, 1.388074e-001, 1.397849e-001, 1.407625e-001, 1.417400e-001, 1.427175e-001, 1.436950e-001, 1.446725e-001, 1.456500e-001,
+1.466276e-001, 1.476051e-001, 1.485826e-001, 1.495601e-001, 1.505376e-001, 1.515152e-001, 1.524927e-001, 1.534702e-001, 1.544477e-001, 1.554252e-001,
+1.564027e-001, 1.573803e-001, 1.583578e-001, 1.593353e-001, 1.603128e-001, 1.612903e-001, 1.622678e-001, 1.632454e-001, 1.642229e-001, 1.652004e-001,
+1.661779e-001, 1.671554e-001, 1.681329e-001, 1.691105e-001, 1.700880e-001, 1.710655e-001, 1.720430e-001, 1.730205e-001, 1.739980e-001, 1.749756e-001,
+1.759531e-001, 1.769306e-001, 1.779081e-001, 1.788856e-001, 1.798631e-001, 1.808407e-001, 1.818182e-001, 1.827957e-001, 1.837732e-001, 1.847507e-001,
+1.857283e-001, 1.867058e-001, 1.876833e-001, 1.886608e-001, 1.896383e-001, 1.906158e-001, 1.915934e-001, 1.925709e-001, 1.935484e-001, 1.945259e-001,
+1.955034e-001, 1.964809e-001, 1.974585e-001, 1.984360e-001, 1.994135e-001, 2.003910e-001, 2.013685e-001, 2.023460e-001, 2.033236e-001, 2.043011e-001,
+2.052786e-001, 2.062561e-001, 2.072336e-001, 2.082111e-001, 2.091887e-001, 2.101662e-001, 2.111437e-001, 2.121212e-001, 2.130987e-001, 2.140762e-001,
+2.150538e-001, 2.160313e-001, 2.170088e-001, 2.179863e-001, 2.189638e-001, 2.199413e-001, 2.209189e-001, 2.218964e-001, 2.228739e-001, 2.238514e-001,
+2.248289e-001, 2.258065e-001, 2.267840e-001, 2.277615e-001, 2.287390e-001, 2.297165e-001, 2.306940e-001, 2.316716e-001, 2.326491e-001, 2.336266e-001,
+2.346041e-001, 2.355816e-001, 2.365591e-001, 2.375367e-001, 2.385142e-001, 2.394917e-001, 2.404692e-001, 2.414467e-001, 2.424242e-001, 2.434018e-001,
+2.443793e-001, 2.453568e-001, 2.463343e-001, 2.473118e-001, 2.482893e-001, 2.492669e-001, 2.502444e-001, 2.512219e-001, 2.521994e-001, 2.531769e-001,
+2.541544e-001, 2.551320e-001, 2.561095e-001, 2.570870e-001, 2.580645e-001, 2.590420e-001, 2.600196e-001, 2.609971e-001, 2.619746e-001, 2.629521e-001,
+2.639296e-001, 2.649071e-001, 2.658847e-001, 2.668622e-001, 2.678397e-001, 2.688172e-001, 2.697947e-001, 2.707722e-001, 2.717498e-001, 2.727273e-001,
+2.737048e-001, 2.746823e-001, 2.756598e-001, 2.766373e-001, 2.776149e-001, 2.785924e-001, 2.795699e-001, 2.805474e-001, 2.815249e-001, 2.825024e-001,
+2.834800e-001, 2.844575e-001, 2.854350e-001, 2.864125e-001, 2.873900e-001, 2.883675e-001, 2.893451e-001, 2.903226e-001, 2.913001e-001, 2.922776e-001,
+2.932551e-001, 2.942326e-001, 2.952102e-001, 2.961877e-001, 2.971652e-001, 2.981427e-001, 2.991202e-001, 3.000978e-001, 3.010753e-001, 3.020528e-001,
+3.030303e-001, 3.040078e-001, 3.049853e-001, 3.059629e-001, 3.069404e-001, 3.079179e-001, 3.088954e-001, 3.098729e-001, 3.108504e-001, 3.118280e-001,
+3.128055e-001, 3.137830e-001, 3.147605e-001, 3.157380e-001, 3.167155e-001, 3.176931e-001, 3.186706e-001, 3.196481e-001, 3.206256e-001, 3.216031e-001,
+3.225806e-001, 3.235582e-001, 3.245357e-001, 3.255132e-001, 3.264907e-001, 3.274682e-001, 3.284457e-001, 3.294233e-001, 3.304008e-001, 3.313783e-001,
+3.323558e-001, 3.333333e-001, 3.343109e-001, 3.352884e-001, 3.362659e-001, 3.372434e-001, 3.382209e-001, 3.391984e-001, 3.401760e-001, 3.411535e-001,
+3.421310e-001, 3.431085e-001, 3.440860e-001, 3.450635e-001, 3.460411e-001, 3.470186e-001, 3.479961e-001, 3.489736e-001, 3.499511e-001, 3.509286e-001,
+3.519062e-001, 3.528837e-001, 3.538612e-001, 3.548387e-001, 3.558162e-001, 3.567937e-001, 3.577713e-001, 3.587488e-001, 3.597263e-001, 3.607038e-001,
+3.616813e-001, 3.626588e-001, 3.636364e-001, 3.646139e-001, 3.655914e-001, 3.665689e-001, 3.675464e-001, 3.685239e-001, 3.695015e-001, 3.704790e-001,
+3.714565e-001, 3.724340e-001, 3.734115e-001, 3.743891e-001, 3.753666e-001, 3.763441e-001, 3.773216e-001, 3.782991e-001, 3.792766e-001, 3.802542e-001,
+3.812317e-001, 3.822092e-001, 3.831867e-001, 3.841642e-001, 3.851417e-001, 3.861193e-001, 3.870968e-001, 3.880743e-001, 3.890518e-001, 3.900293e-001,
+3.910068e-001, 3.919844e-001, 3.929619e-001, 3.939394e-001, 3.949169e-001, 3.958944e-001, 3.968719e-001, 3.978495e-001, 3.988270e-001, 3.998045e-001,
+4.007820e-001, 4.017595e-001, 4.027370e-001, 4.037146e-001, 4.046921e-001, 4.056696e-001, 4.066471e-001, 4.076246e-001, 4.086022e-001, 4.095797e-001,
+4.105572e-001, 4.115347e-001, 4.125122e-001, 4.134897e-001, 4.144673e-001, 4.154448e-001, 4.164223e-001, 4.173998e-001, 4.183773e-001, 4.193548e-001,
+4.203324e-001, 4.213099e-001, 4.222874e-001, 4.232649e-001, 4.242424e-001, 4.252199e-001, 4.261975e-001, 4.271750e-001, 4.281525e-001, 4.291300e-001,
+4.301075e-001, 4.310850e-001, 4.320626e-001, 4.330401e-001, 4.340176e-001, 4.349951e-001, 4.359726e-001, 4.369501e-001, 4.379277e-001, 4.389052e-001,
+4.398827e-001, 4.408602e-001, 4.418377e-001, 4.428152e-001, 4.437928e-001, 4.447703e-001, 4.457478e-001, 4.467253e-001, 4.477028e-001, 4.486804e-001,
+4.496579e-001, 4.506354e-001, 4.516129e-001, 4.525904e-001, 4.535679e-001, 4.545455e-001, 4.555230e-001, 4.565005e-001, 4.574780e-001, 4.584555e-001,
+4.594330e-001, 4.604106e-001, 4.613881e-001, 4.623656e-001, 4.633431e-001, 4.643206e-001, 4.652981e-001, 4.662757e-001, 4.672532e-001, 4.682307e-001,
+4.692082e-001, 4.701857e-001, 4.711632e-001, 4.721408e-001, 4.731183e-001, 4.740958e-001, 4.750733e-001, 4.760508e-001, 4.770283e-001, 4.780059e-001,
+4.789834e-001, 4.799609e-001, 4.809384e-001, 4.819159e-001, 4.828935e-001, 4.838710e-001, 4.848485e-001, 4.858260e-001, 4.868035e-001, 4.877810e-001,
+4.887586e-001, 4.897361e-001, 4.907136e-001, 4.916911e-001, 4.926686e-001, 4.936461e-001, 4.946237e-001, 4.956012e-001, 4.965787e-001, 4.975562e-001,
+4.985337e-001, 4.995112e-001, 5.004888e-001, 5.014663e-001, 5.024438e-001, 5.034213e-001, 5.043988e-001, 5.053763e-001, 5.063539e-001, 5.073314e-001,
+5.083089e-001, 5.092864e-001, 5.102639e-001, 5.112414e-001, 5.122190e-001, 5.131965e-001, 5.141740e-001, 5.151515e-001, 5.161290e-001, 5.171065e-001,
+5.180841e-001, 5.190616e-001, 5.200391e-001, 5.210166e-001, 5.219941e-001, 5.229717e-001, 5.239492e-001, 5.249267e-001, 5.259042e-001, 5.268817e-001,
+5.278592e-001, 5.288368e-001, 5.298143e-001, 5.307918e-001, 5.317693e-001, 5.327468e-001, 5.337243e-001, 5.347019e-001, 5.356794e-001, 5.366569e-001,
+5.376344e-001, 5.386119e-001, 5.395894e-001, 5.405670e-001, 5.415445e-001, 5.425220e-001, 5.434995e-001, 5.444770e-001, 5.454545e-001, 5.464321e-001,
+5.474096e-001, 5.483871e-001, 5.493646e-001, 5.503421e-001, 5.513196e-001, 5.522972e-001, 5.532747e-001, 5.542522e-001, 5.552297e-001, 5.562072e-001,
+5.571848e-001, 5.581623e-001, 5.591398e-001, 5.601173e-001, 5.610948e-001, 5.620723e-001, 5.630499e-001, 5.640274e-001, 5.650049e-001, 5.659824e-001,
+5.669599e-001, 5.679374e-001, 5.689150e-001, 5.698925e-001, 5.708700e-001, 5.718475e-001, 5.728250e-001, 5.738025e-001, 5.747801e-001, 5.757576e-001,
+5.767351e-001, 5.777126e-001, 5.786901e-001, 5.796676e-001, 5.806452e-001, 5.816227e-001, 5.826002e-001, 5.835777e-001, 5.845552e-001, 5.855327e-001,
+5.865103e-001, 5.874878e-001, 5.884653e-001, 5.894428e-001, 5.904203e-001, 5.913978e-001, 5.923754e-001, 5.933529e-001, 5.943304e-001, 5.953079e-001,
+5.962854e-001, 5.972630e-001, 5.982405e-001, 5.992180e-001, 6.001955e-001, 6.011730e-001, 6.021505e-001, 6.031281e-001, 6.041056e-001, 6.050831e-001,
+6.060606e-001, 6.070381e-001, 6.080156e-001, 6.089932e-001, 6.099707e-001, 6.109482e-001, 6.119257e-001, 6.129032e-001, 6.138807e-001, 6.148583e-001,
+6.158358e-001, 6.168133e-001, 6.177908e-001, 6.187683e-001, 6.197458e-001, 6.207234e-001, 6.217009e-001, 6.226784e-001, 6.236559e-001, 6.246334e-001,
+6.256109e-001, 6.265885e-001, 6.275660e-001, 6.285435e-001, 6.295210e-001, 6.304985e-001, 6.314761e-001, 6.324536e-001, 6.334311e-001, 6.344086e-001,
+6.353861e-001, 6.363636e-001, 6.373412e-001, 6.383187e-001, 6.392962e-001, 6.402737e-001, 6.412512e-001, 6.422287e-001, 6.432063e-001, 6.441838e-001,
+6.451613e-001, 6.461388e-001, 6.471163e-001, 6.480938e-001, 6.490714e-001, 6.500489e-001, 6.510264e-001, 6.520039e-001, 6.529814e-001, 6.539589e-001,
+6.549365e-001, 6.559140e-001, 6.568915e-001, 6.578690e-001, 6.588465e-001, 6.598240e-001, 6.608016e-001, 6.617791e-001, 6.627566e-001, 6.637341e-001,
+6.647116e-001, 6.656891e-001, 6.666667e-001, 6.676442e-001, 6.686217e-001, 6.695992e-001, 6.705767e-001, 6.715543e-001, 6.725318e-001, 6.735093e-001,
+6.744868e-001, 6.754643e-001, 6.764418e-001, 6.774194e-001, 6.783969e-001, 6.793744e-001, 6.803519e-001, 6.813294e-001, 6.823069e-001, 6.832845e-001,
+6.842620e-001, 6.852395e-001, 6.862170e-001, 6.871945e-001, 6.881720e-001, 6.891496e-001, 6.901271e-001, 6.911046e-001, 6.920821e-001, 6.930596e-001,
+6.940371e-001, 6.950147e-001, 6.959922e-001, 6.969697e-001, 6.979472e-001, 6.989247e-001, 6.999022e-001, 7.008798e-001, 7.018573e-001, 7.028348e-001,
+7.038123e-001, 7.047898e-001, 7.057674e-001, 7.067449e-001, 7.077224e-001, 7.086999e-001, 7.096774e-001, 7.106549e-001, 7.116325e-001, 7.126100e-001,
+7.135875e-001, 7.145650e-001, 7.155425e-001, 7.165200e-001, 7.174976e-001, 7.184751e-001, 7.194526e-001, 7.204301e-001, 7.214076e-001, 7.223851e-001,
+7.233627e-001, 7.243402e-001, 7.253177e-001, 7.262952e-001, 7.272727e-001, 7.282502e-001, 7.292278e-001, 7.302053e-001, 7.311828e-001, 7.321603e-001,
+7.331378e-001, 7.341153e-001, 7.350929e-001, 7.360704e-001, 7.370479e-001, 7.380254e-001, 7.390029e-001, 7.399804e-001, 7.409580e-001, 7.419355e-001,
+7.429130e-001, 7.438905e-001, 7.448680e-001, 7.458456e-001, 7.468231e-001, 7.478006e-001, 7.487781e-001, 7.497556e-001, 7.507331e-001, 7.517107e-001,
+7.526882e-001, 7.536657e-001, 7.546432e-001, 7.556207e-001, 7.565982e-001, 7.575758e-001, 7.585533e-001, 7.595308e-001, 7.605083e-001, 7.614858e-001,
+7.624633e-001, 7.634409e-001, 7.644184e-001, 7.653959e-001, 7.663734e-001, 7.673509e-001, 7.683284e-001, 7.693060e-001, 7.702835e-001, 7.712610e-001,
+7.722385e-001, 7.732160e-001, 7.741935e-001, 7.751711e-001, 7.761486e-001, 7.771261e-001, 7.781036e-001, 7.790811e-001, 7.800587e-001, 7.810362e-001,
+7.820137e-001, 7.829912e-001, 7.839687e-001, 7.849462e-001, 7.859238e-001, 7.869013e-001, 7.878788e-001, 7.888563e-001, 7.898338e-001, 7.908113e-001,
+7.917889e-001, 7.927664e-001, 7.937439e-001, 7.947214e-001, 7.956989e-001, 7.966764e-001, 7.976540e-001, 7.986315e-001, 7.996090e-001, 8.005865e-001,
+8.015640e-001, 8.025415e-001, 8.035191e-001, 8.044966e-001, 8.054741e-001, 8.064516e-001, 8.074291e-001, 8.084066e-001, 8.093842e-001, 8.103617e-001,
+8.113392e-001, 8.123167e-001, 8.132942e-001, 8.142717e-001, 8.152493e-001, 8.162268e-001, 8.172043e-001, 8.181818e-001, 8.191593e-001, 8.201369e-001,
+8.211144e-001, 8.220919e-001, 8.230694e-001, 8.240469e-001, 8.250244e-001, 8.260020e-001, 8.269795e-001, 8.279570e-001, 8.289345e-001, 8.299120e-001,
+8.308895e-001, 8.318671e-001, 8.328446e-001, 8.338221e-001, 8.347996e-001, 8.357771e-001, 8.367546e-001, 8.377322e-001, 8.387097e-001, 8.396872e-001,
+8.406647e-001, 8.416422e-001, 8.426197e-001, 8.435973e-001, 8.445748e-001, 8.455523e-001, 8.465298e-001, 8.475073e-001, 8.484848e-001, 8.494624e-001,
+8.504399e-001, 8.514174e-001, 8.523949e-001, 8.533724e-001, 8.543500e-001, 8.553275e-001, 8.563050e-001, 8.572825e-001, 8.582600e-001, 8.592375e-001,
+8.602151e-001, 8.611926e-001, 8.621701e-001, 8.631476e-001, 8.641251e-001, 8.651026e-001, 8.660802e-001, 8.670577e-001, 8.680352e-001, 8.690127e-001,
+8.699902e-001, 8.709677e-001, 8.719453e-001, 8.729228e-001, 8.739003e-001, 8.748778e-001, 8.758553e-001, 8.768328e-001, 8.778104e-001, 8.787879e-001,
+8.797654e-001, 8.807429e-001, 8.817204e-001, 8.826979e-001, 8.836755e-001, 8.846530e-001, 8.856305e-001, 8.866080e-001, 8.875855e-001, 8.885630e-001,
+8.895406e-001, 8.905181e-001, 8.914956e-001, 8.924731e-001, 8.934506e-001, 8.944282e-001, 8.954057e-001, 8.963832e-001, 8.973607e-001, 8.983382e-001,
+8.993157e-001, 9.002933e-001, 9.012708e-001, 9.022483e-001, 9.032258e-001, 9.042033e-001, 9.051808e-001, 9.061584e-001, 9.071359e-001, 9.081134e-001,
+9.090909e-001, 9.100684e-001, 9.110459e-001, 9.120235e-001, 9.130010e-001, 9.139785e-001, 9.149560e-001, 9.159335e-001, 9.169110e-001, 9.178886e-001,
+9.188661e-001, 9.198436e-001, 9.208211e-001, 9.217986e-001, 9.227761e-001, 9.237537e-001, 9.247312e-001, 9.257087e-001, 9.266862e-001, 9.276637e-001,
+9.286413e-001, 9.296188e-001, 9.305963e-001, 9.315738e-001, 9.325513e-001, 9.335288e-001, 9.345064e-001, 9.354839e-001, 9.364614e-001, 9.374389e-001,
+9.384164e-001, 9.393939e-001, 9.403715e-001, 9.413490e-001, 9.423265e-001, 9.433040e-001, 9.442815e-001, 9.452590e-001, 9.462366e-001, 9.472141e-001,
+9.481916e-001, 9.491691e-001, 9.501466e-001, 9.511241e-001, 9.521017e-001, 9.530792e-001, 9.540567e-001, 9.550342e-001, 9.560117e-001, 9.569892e-001,
+9.579668e-001, 9.589443e-001, 9.599218e-001, 9.608993e-001, 9.618768e-001, 9.628543e-001, 9.638319e-001, 9.648094e-001, 9.657869e-001, 9.667644e-001,
+9.677419e-001, 9.687195e-001, 9.696970e-001, 9.706745e-001, 9.716520e-001, 9.726295e-001, 9.736070e-001, 9.745846e-001, 9.755621e-001, 9.765396e-001,
+9.775171e-001, 9.784946e-001, 9.794721e-001, 9.804497e-001, 9.814272e-001, 9.824047e-001, 9.833822e-001, 9.843597e-001, 9.853372e-001, 9.863148e-001,
+9.872923e-001, 9.882698e-001, 9.892473e-001, 9.902248e-001, 9.912023e-001, 9.921799e-001, 9.931574e-001, 9.941349e-001, 9.951124e-001, 9.960899e-001,
+9.970674e-001, 9.980450e-001, 9.990225e-001, 1.000000e+000),
+(0.000000e+000, 1.472689e-003, 2.945378e-003, 4.418066e-003, 5.890755e-003, 7.363444e-003, 8.836133e-003, 1.034718e-002, 1.200282e-002, 1.365845e-002,
+1.531409e-002, 1.696972e-002, 1.862535e-002, 2.031424e-002, 2.216583e-002, 2.401741e-002, 2.586900e-002, 2.772058e-002, 2.957217e-002, 3.157694e-002,
+3.362775e-002, 3.567855e-002, 3.772936e-002, 3.978016e-002, 4.200040e-002, 4.424098e-002, 4.648155e-002, 4.872213e-002, 5.103431e-002, 5.344152e-002,
+5.584874e-002, 5.825595e-002, 6.069945e-002, 6.323839e-002, 6.577732e-002, 6.831626e-002, 7.088549e-002, 7.351435e-002, 7.614321e-002, 7.877207e-002,
+8.142617e-002, 8.410240e-002, 8.677862e-002, 8.945485e-002, 9.213878e-002, 9.482467e-002, 9.751057e-002, 1.001950e-001, 1.028613e-001, 1.055275e-001,
+1.081938e-001, 1.108473e-001, 1.134740e-001, 1.161007e-001, 1.187274e-001, 1.213281e-001, 1.239042e-001, 1.264803e-001, 1.290564e-001, 1.315979e-001,
+1.341194e-001, 1.366408e-001, 1.391623e-001, 1.416480e-001, 1.441158e-001, 1.465836e-001, 1.490515e-001, 1.514890e-001, 1.539076e-001, 1.563263e-001,
+1.587449e-001, 1.611428e-001, 1.635184e-001, 1.658940e-001, 1.682696e-001, 1.706354e-001, 1.729750e-001, 1.753146e-001, 1.776542e-001, 1.799938e-001,
+1.823045e-001, 1.846151e-001, 1.869257e-001, 1.892362e-001, 1.915317e-001, 1.938196e-001, 1.961075e-001, 1.983955e-001, 2.006783e-001, 2.029489e-001,
+2.052196e-001, 2.074902e-001, 2.097609e-001, 2.120197e-001, 2.142771e-001, 2.165345e-001, 2.187919e-001, 2.210443e-001, 2.232910e-001, 2.255376e-001,
+2.277843e-001, 2.300308e-001, 2.322676e-001, 2.345044e-001, 2.367411e-001, 2.389779e-001, 2.412089e-001, 2.434349e-001, 2.456609e-001, 2.478869e-001,
+2.501123e-001, 2.523250e-001, 2.545378e-001, 2.567506e-001, 2.589633e-001, 2.611669e-001, 2.633624e-001, 2.655579e-001, 2.677534e-001, 2.699489e-001,
+2.721224e-001, 2.742954e-001, 2.764685e-001, 2.786415e-001, 2.808038e-001, 2.829483e-001, 2.850928e-001, 2.872373e-001, 2.893818e-001, 2.915015e-001,
+2.936110e-001, 2.957205e-001, 2.978301e-001, 2.999396e-001, 3.020090e-001, 3.040772e-001, 3.061454e-001, 3.082136e-001, 3.102754e-001, 3.122964e-001,
+3.143175e-001, 3.163385e-001, 3.183595e-001, 3.203707e-001, 3.223396e-001, 3.243085e-001, 3.262774e-001, 3.282463e-001, 3.302091e-001, 3.321221e-001,
+3.340351e-001, 3.359481e-001, 3.378611e-001, 3.397741e-001, 3.416356e-001, 3.434903e-001, 3.453450e-001, 3.471997e-001, 3.490544e-001, 3.508800e-001,
+3.526753e-001, 3.544706e-001, 3.562659e-001, 3.580613e-001, 3.598566e-001, 3.615976e-001, 3.633338e-001, 3.650701e-001, 3.668063e-001, 3.685425e-001,
+3.702695e-001, 3.719482e-001, 3.736268e-001, 3.753054e-001, 3.769841e-001, 3.786627e-001, 3.803301e-001, 3.819537e-001, 3.835772e-001, 3.852007e-001,
+3.868242e-001, 3.884477e-001, 3.900690e-001, 3.916407e-001, 3.932124e-001, 3.947841e-001, 3.963559e-001, 3.979276e-001, 3.994993e-001, 4.010384e-001,
+4.025623e-001, 4.040861e-001, 4.056100e-001, 4.071338e-001, 4.086577e-001, 4.101764e-001, 4.116568e-001, 4.131372e-001, 4.146176e-001, 4.160980e-001,
+4.175784e-001, 4.190589e-001, 4.205252e-001, 4.219668e-001, 4.234085e-001, 4.248502e-001, 4.262919e-001, 4.277335e-001, 4.291752e-001, 4.306024e-001,
+4.320103e-001, 4.334181e-001, 4.348259e-001, 4.362338e-001, 4.376416e-001, 4.390495e-001, 4.404479e-001, 4.418269e-001, 4.432059e-001, 4.445849e-001,
+4.459639e-001, 4.473429e-001, 4.487218e-001, 4.500991e-001, 4.514542e-001, 4.528093e-001, 4.541644e-001, 4.555195e-001, 4.568746e-001, 4.582297e-001,
+4.595848e-001, 4.609268e-001, 4.622629e-001, 4.635991e-001, 4.649352e-001, 4.662713e-001, 4.676075e-001, 4.689436e-001, 4.702768e-001, 4.715988e-001,
+4.729208e-001, 4.742427e-001, 4.755647e-001, 4.768867e-001, 4.782087e-001, 4.795306e-001, 4.808465e-001, 4.821589e-001, 4.834713e-001, 4.847838e-001,
+4.860962e-001, 4.874087e-001, 4.887211e-001, 4.900334e-001, 4.913407e-001, 4.926480e-001, 4.939553e-001, 4.952626e-001, 4.965699e-001, 4.978772e-001,
+4.991845e-001, 5.004914e-001, 5.017977e-001, 5.031039e-001, 5.044102e-001, 5.057165e-001, 5.070227e-001, 5.083290e-001, 5.096353e-001, 5.109435e-001,
+5.122525e-001, 5.135615e-001, 5.148705e-001, 5.161795e-001, 5.174885e-001, 5.187975e-001, 5.201069e-001, 5.214219e-001, 5.227369e-001, 5.240519e-001,
+5.253669e-001, 5.266819e-001, 5.279969e-001, 5.293119e-001, 5.306311e-001, 5.319548e-001, 5.332785e-001, 5.346022e-001, 5.359260e-001, 5.372497e-001,
+5.385734e-001, 5.398971e-001, 5.412307e-001, 5.425651e-001, 5.438995e-001, 5.452339e-001, 5.465684e-001, 5.479028e-001, 5.492372e-001, 5.505767e-001,
+5.519229e-001, 5.532691e-001, 5.546153e-001, 5.559615e-001, 5.573077e-001, 5.586539e-001, 5.600002e-001, 5.613582e-001, 5.627163e-001, 5.640743e-001,
+5.654324e-001, 5.667904e-001, 5.681485e-001, 5.695065e-001, 5.708713e-001, 5.722400e-001, 5.736087e-001, 5.749774e-001, 5.763461e-001, 5.777148e-001,
+5.790835e-001, 5.804549e-001, 5.818317e-001, 5.832085e-001, 5.845853e-001, 5.859622e-001, 5.873390e-001, 5.887158e-001, 5.900929e-001, 5.914738e-001,
+5.928548e-001, 5.942358e-001, 5.956167e-001, 5.969977e-001, 5.983787e-001, 5.997596e-001, 6.011396e-001, 6.025194e-001, 6.038992e-001, 6.052790e-001,
+6.066588e-001, 6.080386e-001, 6.094184e-001, 6.107937e-001, 6.121658e-001, 6.135379e-001, 6.149100e-001, 6.162821e-001, 6.176542e-001, 6.190263e-001,
+6.203941e-001, 6.217511e-001, 6.231081e-001, 6.244651e-001, 6.258221e-001, 6.271792e-001, 6.285362e-001, 6.298932e-001, 6.312292e-001, 6.325633e-001,
+6.338975e-001, 6.352316e-001, 6.365658e-001, 6.378999e-001, 6.392341e-001, 6.405552e-001, 6.418588e-001, 6.431624e-001, 6.444660e-001, 6.457697e-001,
+6.470733e-001, 6.483769e-001, 6.496805e-001, 6.509558e-001, 6.522219e-001, 6.534880e-001, 6.547541e-001, 6.560202e-001, 6.572863e-001, 6.585524e-001,
+6.598184e-001, 6.610474e-001, 6.622702e-001, 6.634930e-001, 6.647157e-001, 6.659385e-001, 6.671613e-001, 6.683840e-001, 6.696068e-001, 6.707973e-001,
+6.719724e-001, 6.731475e-001, 6.743227e-001, 6.754978e-001, 6.766730e-001, 6.778481e-001, 6.790233e-001, 6.801899e-001, 6.813148e-001, 6.824398e-001,
+6.835647e-001, 6.846896e-001, 6.858145e-001, 6.869395e-001, 6.880644e-001, 6.891893e-001, 6.903000e-001, 6.913738e-001, 6.924476e-001, 6.935214e-001,
+6.945953e-001, 6.956691e-001, 6.967429e-001, 6.978167e-001, 6.988906e-001, 6.999644e-001, 7.009895e-001, 7.020129e-001, 7.030364e-001, 7.040598e-001,
+7.050833e-001, 7.061067e-001, 7.071301e-001, 7.081536e-001, 7.091770e-001, 7.101910e-001, 7.111661e-001, 7.121413e-001, 7.131164e-001, 7.140915e-001,
+7.150667e-001, 7.160418e-001, 7.170170e-001, 7.179921e-001, 7.189672e-001, 7.199424e-001, 7.208751e-001, 7.218052e-001, 7.227352e-001, 7.236653e-001,
+7.245953e-001, 7.255254e-001, 7.264555e-001, 7.273855e-001, 7.283156e-001, 7.292456e-001, 7.301679e-001, 7.310570e-001, 7.319461e-001, 7.328351e-001,
+7.337242e-001, 7.346133e-001, 7.355023e-001, 7.363914e-001, 7.372805e-001, 7.381695e-001, 7.390586e-001, 7.399477e-001, 7.408026e-001, 7.416555e-001,
+7.425083e-001, 7.433611e-001, 7.442139e-001, 7.450668e-001, 7.459196e-001, 7.467724e-001, 7.476252e-001, 7.484781e-001, 7.493309e-001, 7.501770e-001,
+7.509988e-001, 7.518207e-001, 7.526425e-001, 7.534643e-001, 7.542861e-001, 7.551079e-001, 7.559298e-001, 7.567516e-001, 7.575734e-001, 7.583952e-001,
+7.592170e-001, 7.600377e-001, 7.608341e-001, 7.616305e-001, 7.624269e-001, 7.632233e-001, 7.640198e-001, 7.648162e-001, 7.656126e-001, 7.664090e-001,
+7.672055e-001, 7.680019e-001, 7.687983e-001, 7.695947e-001, 7.703816e-001, 7.711586e-001, 7.719355e-001, 7.727125e-001, 7.734894e-001, 7.742664e-001,
+7.750433e-001, 7.758203e-001, 7.765973e-001, 7.773742e-001, 7.781512e-001, 7.789281e-001, 7.797051e-001, 7.804738e-001, 7.812375e-001, 7.820013e-001,
+7.827650e-001, 7.835287e-001, 7.842924e-001, 7.850561e-001, 7.858199e-001, 7.865836e-001, 7.873473e-001, 7.881110e-001, 7.888747e-001, 7.896384e-001,
+7.903987e-001, 7.911557e-001, 7.919128e-001, 7.926698e-001, 7.934269e-001, 7.941839e-001, 7.949410e-001, 7.956980e-001, 7.964551e-001, 7.972121e-001,
+7.979692e-001, 7.987263e-001, 7.994833e-001, 8.002405e-001, 8.009978e-001, 8.017552e-001, 8.025126e-001, 8.032699e-001, 8.040273e-001, 8.047846e-001,
+8.055420e-001, 8.062994e-001, 8.070567e-001, 8.078141e-001, 8.085715e-001, 8.093288e-001, 8.100871e-001, 8.108522e-001, 8.116173e-001, 8.123824e-001,
+8.131475e-001, 8.139126e-001, 8.146778e-001, 8.154429e-001, 8.162080e-001, 8.169731e-001, 8.177382e-001, 8.185033e-001, 8.192685e-001, 8.200343e-001,
+8.208151e-001, 8.215959e-001, 8.223767e-001, 8.231575e-001, 8.239383e-001, 8.247191e-001, 8.255000e-001, 8.262808e-001, 8.270616e-001, 8.278424e-001,
+8.286232e-001, 8.294040e-001, 8.301905e-001, 8.309954e-001, 8.318003e-001, 8.326052e-001, 8.334100e-001, 8.342149e-001, 8.350198e-001, 8.358247e-001,
+8.366295e-001, 8.374344e-001, 8.382393e-001, 8.390442e-001, 8.398490e-001, 8.406803e-001, 8.415176e-001, 8.423550e-001, 8.431923e-001, 8.440296e-001,
+8.448670e-001, 8.457043e-001, 8.465416e-001, 8.473790e-001, 8.482163e-001, 8.490536e-001, 8.498910e-001, 8.507630e-001, 8.516403e-001, 8.525176e-001,
+8.533949e-001, 8.542722e-001, 8.551494e-001, 8.560267e-001, 8.569040e-001, 8.577813e-001, 8.586585e-001, 8.595358e-001, 8.604340e-001, 8.613558e-001,
+8.622775e-001, 8.631993e-001, 8.641210e-001, 8.650427e-001, 8.659645e-001, 8.668862e-001, 8.678080e-001, 8.687297e-001, 8.696515e-001, 8.705996e-001,
+8.715637e-001, 8.725278e-001, 8.734919e-001, 8.744560e-001, 8.754202e-001, 8.763843e-001, 8.773484e-001, 8.783125e-001, 8.792767e-001, 8.802479e-001,
+8.812404e-001, 8.822329e-001, 8.832254e-001, 8.842179e-001, 8.852105e-001, 8.862030e-001, 8.871955e-001, 8.881880e-001, 8.891805e-001, 8.901726e-001,
+8.911628e-001, 8.921530e-001, 8.931431e-001, 8.941333e-001, 8.951235e-001, 8.961137e-001, 8.971038e-001, 8.980940e-001, 8.990842e-001, 9.000707e-001,
+9.010120e-001, 9.019533e-001, 9.028946e-001, 9.038360e-001, 9.047773e-001, 9.057186e-001, 9.066599e-001, 9.076013e-001, 9.085426e-001, 9.094839e-001,
+9.103805e-001, 9.112227e-001, 9.120650e-001, 9.129072e-001, 9.137495e-001, 9.145918e-001, 9.154340e-001, 9.162763e-001, 9.171185e-001, 9.179608e-001,
+9.188030e-001, 9.196453e-001, 9.204098e-001, 9.211177e-001, 9.218256e-001, 9.225335e-001, 9.232414e-001, 9.239493e-001, 9.246572e-001, 9.253651e-001,
+9.260730e-001, 9.267809e-001, 9.274888e-001, 9.281967e-001, 9.289046e-001, 9.296125e-001, 9.302553e-001, 9.308196e-001, 9.313838e-001, 9.319481e-001,
+9.325123e-001, 9.330765e-001, 9.336408e-001, 9.342050e-001, 9.347692e-001, 9.353335e-001, 9.358977e-001, 9.364619e-001, 9.370262e-001, 9.375904e-001,
+9.381546e-001, 9.387189e-001, 9.392831e-001, 9.398473e-001, 9.403161e-001, 9.407496e-001, 9.411830e-001, 9.416164e-001, 9.420498e-001, 9.424832e-001,
+9.429166e-001, 9.433500e-001, 9.437834e-001, 9.442168e-001, 9.446502e-001, 9.450836e-001, 9.455170e-001, 9.459504e-001, 9.463839e-001, 9.468173e-001,
+9.472507e-001, 9.476841e-001, 9.481175e-001, 9.485509e-001, 9.489843e-001, 9.494177e-001, 9.498511e-001, 9.502141e-001, 9.505402e-001, 9.508663e-001,
+9.511924e-001, 9.515185e-001, 9.518446e-001, 9.521707e-001, 9.524968e-001, 9.528229e-001, 9.531490e-001, 9.534751e-001, 9.538012e-001, 9.541273e-001,
+9.544534e-001, 9.547795e-001, 9.551056e-001, 9.554317e-001, 9.557578e-001, 9.560839e-001, 9.564100e-001, 9.567361e-001, 9.570622e-001, 9.573883e-001,
+9.577144e-001, 9.580405e-001, 9.583666e-001, 9.586927e-001, 9.590188e-001, 9.593449e-001, 9.596710e-001, 9.599971e-001, 9.602413e-001, 9.604847e-001,
+9.607281e-001, 9.609715e-001, 9.612150e-001, 9.614584e-001, 9.617018e-001, 9.619452e-001, 9.621887e-001, 9.624321e-001, 9.626755e-001, 9.629189e-001,
+9.631623e-001, 9.634058e-001, 9.636492e-001, 9.638926e-001, 9.641360e-001, 9.643795e-001, 9.646229e-001, 9.648663e-001, 9.651097e-001, 9.653532e-001,
+9.655966e-001, 9.658400e-001, 9.660834e-001, 9.663269e-001, 9.665703e-001, 9.668137e-001, 9.670571e-001, 9.673006e-001, 9.675440e-001, 9.677874e-001,
+9.680308e-001, 9.682742e-001, 9.685177e-001, 9.687611e-001, 9.690045e-001, 9.692479e-001, 9.694914e-001, 9.697348e-001, 9.699782e-001, 9.701655e-001,
+9.703474e-001, 9.705292e-001, 9.707110e-001, 9.708928e-001, 9.710746e-001, 9.712564e-001, 9.714382e-001, 9.716200e-001, 9.718019e-001, 9.719837e-001,
+9.721655e-001, 9.723473e-001, 9.725291e-001, 9.727109e-001, 9.728927e-001, 9.730746e-001, 9.732564e-001, 9.734382e-001, 9.736200e-001, 9.738018e-001,
+9.739836e-001, 9.741654e-001, 9.743472e-001, 9.745291e-001, 9.747109e-001, 9.748927e-001, 9.750745e-001, 9.752563e-001, 9.754381e-001, 9.756199e-001,
+9.758018e-001, 9.759836e-001, 9.761654e-001, 9.763472e-001, 9.765290e-001, 9.767108e-001, 9.768926e-001, 9.770744e-001, 9.772563e-001, 9.774381e-001,
+9.776199e-001, 9.778017e-001, 9.779835e-001, 9.781653e-001, 9.783471e-001, 9.785289e-001, 9.787108e-001, 9.788926e-001, 9.790744e-001, 9.792562e-001,
+9.794380e-001, 9.796198e-001, 9.798016e-001, 9.799835e-001, 9.801241e-001, 9.802607e-001, 9.803973e-001, 9.805338e-001, 9.806704e-001, 9.808070e-001,
+9.809435e-001, 9.810801e-001, 9.812166e-001, 9.813532e-001, 9.814898e-001, 9.816263e-001, 9.817629e-001, 9.818995e-001, 9.820360e-001, 9.821726e-001,
+9.823091e-001, 9.824457e-001, 9.825823e-001, 9.827188e-001, 9.828554e-001, 9.829920e-001, 9.831285e-001, 9.832651e-001, 9.834016e-001, 9.835382e-001,
+9.836748e-001, 9.838113e-001, 9.839479e-001, 9.840845e-001, 9.842210e-001, 9.843576e-001, 9.844942e-001, 9.846307e-001, 9.847673e-001, 9.849038e-001,
+9.850404e-001, 9.851770e-001, 9.853135e-001, 9.854501e-001, 9.855867e-001, 9.857232e-001, 9.858598e-001, 9.859963e-001, 9.861329e-001, 9.862695e-001,
+9.864060e-001, 9.865426e-001, 9.866792e-001, 9.868157e-001, 9.869523e-001, 9.870888e-001, 9.872254e-001, 9.873620e-001, 9.874985e-001, 9.876351e-001,
+9.877717e-001, 9.879082e-001, 9.880448e-001, 9.881814e-001, 9.883179e-001, 9.884545e-001, 9.885910e-001, 9.887276e-001, 9.888642e-001, 9.890007e-001,
+9.891373e-001, 9.892739e-001, 9.894104e-001, 9.895470e-001, 9.896835e-001, 9.898201e-001, 9.899567e-001, 9.900706e-001, 9.901740e-001, 9.902775e-001,
+9.903809e-001, 9.904843e-001, 9.905878e-001, 9.906912e-001, 9.907946e-001, 9.908981e-001, 9.910015e-001, 9.911049e-001, 9.912084e-001, 9.913118e-001,
+9.914152e-001, 9.915186e-001, 9.916221e-001, 9.917255e-001, 9.918289e-001, 9.919324e-001, 9.920358e-001, 9.921392e-001, 9.922427e-001, 9.923461e-001,
+9.924495e-001, 9.925530e-001, 9.926564e-001, 9.927598e-001, 9.928633e-001, 9.929667e-001, 9.930701e-001, 9.931735e-001, 9.932770e-001, 9.933804e-001,
+9.934838e-001, 9.935873e-001, 9.936907e-001, 9.937941e-001, 9.938976e-001, 9.940010e-001, 9.941044e-001, 9.942079e-001, 9.943113e-001, 9.944147e-001,
+9.945182e-001, 9.946216e-001, 9.947250e-001, 9.948284e-001, 9.949319e-001, 9.950353e-001, 9.951387e-001, 9.952422e-001, 9.953456e-001, 9.954490e-001,
+9.955525e-001, 9.956559e-001, 9.957593e-001, 9.958628e-001, 9.959662e-001, 9.960696e-001, 9.961730e-001, 9.962765e-001, 9.963799e-001, 9.964833e-001,
+9.965868e-001, 9.966902e-001, 9.967936e-001, 9.968971e-001, 9.970005e-001, 9.971039e-001, 9.972074e-001, 9.973108e-001, 9.974142e-001, 9.975177e-001,
+9.976211e-001, 9.977245e-001, 9.978279e-001, 9.979314e-001, 9.980348e-001, 9.981382e-001, 9.982417e-001, 9.983451e-001, 9.984485e-001, 9.985520e-001,
+9.986554e-001, 9.987588e-001, 9.988623e-001, 9.989657e-001, 9.990691e-001, 9.991726e-001, 9.992760e-001, 9.993794e-001, 9.994828e-001, 9.995863e-001,
+9.996897e-001, 9.997931e-001, 9.998966e-001, 1.000000e+000), (), (), (), ())
+)
+
diff --git a/release/scripts/addons/io_coat3D/coat.py b/release/scripts/addons/io_coat3D/coat.py
index ee81aea..0186e62 100644
--- a/release/scripts/addons/io_coat3D/coat.py
+++ b/release/scripts/addons/io_coat3D/coat.py
@@ -392,8 +392,9 @@ class SCENE_OT_import(bpy.types.Operator):
                         obj_data = objekti.data.id_data
                         objekti.data = obj_proxy.data.id_data
                         if(bpy.data.meshes[obj_data.name].users == 0):
-                            bpy.data.meshes.remove(obj_data)
                             objekti.data.id_data.name = obj_data.name
+                            bpy.data.meshes.remove(obj_data)
+                            
 
                     obj_proxy.select = True
                     bpy.ops.object.delete()
diff --git a/release/scripts/addons/io_curve_svg/import_svg.py b/release/scripts/addons/io_curve_svg/import_svg.py
index 90cd89f..0965b26 100644
--- a/release/scripts/addons/io_curve_svg/import_svg.py
+++ b/release/scripts/addons/io_curve_svg/import_svg.py
@@ -32,9 +32,9 @@ from . import svg_colors
 # TODO: "em" and "ex" aren't actually supported
 SVGUnits = {"": 1.0,
             "px": 1.0,
-            "in": 90,
-            "mm": 90 / 25.4,
-            "cm": 90 / 2.54,
+            "in": 90.0,
+            "mm": 90.0 / 25.4,
+            "cm": 90.0 / 2.54,
             "pt": 1.25,
             "pc": 15.0,
             "em": 1.0,
@@ -87,7 +87,7 @@ def SVGParseFloat(s, i=0):
                 token += s[i]
                 i += 1
         elif s[i].isspace() or s[i] == ',':
-            # Inkscape sometimes uses qeird float format with missed
+            # Inkscape sometimes uses weird float format with missed
             # fractional part after dot. Suppose zero fractional part
             # for this case
             pass
@@ -790,7 +790,7 @@ class SVGPathParser:
         """
         Calc arc paths
 
-        Copied and adoptedfrom paths_svg2obj.py scring for Blender 2.49
+        Copied and adoptedfrom paths_svg2obj.py script for Blender 2.49
         which is Copyright (c) jm soler juillet/novembre 2004-april 2009,
         """
 
@@ -1781,8 +1781,8 @@ class SVGLoader(SVGGeometryContainer):
         node = xml.dom.minidom.parse(filepath)
 
         m = Matrix()
-        m = m * Matrix.Scale(1.0 / 90.0, 4, Vector((1.0, 0.0, 0.0)))
-        m = m * Matrix.Scale(-1.0 / 90.0, 4, Vector((0.0, 1.0, 0.0)))
+        m = m * Matrix.Scale(1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((1.0, 0.0, 0.0)))
+        m = m * Matrix.Scale(-1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((0.0, 1.0, 0.0)))
 
         rect = (1, 1)
 
diff --git a/release/scripts/addons/io_curve_svg/svg_colors.py b/release/scripts/addons/io_curve_svg/svg_colors.py
index fd5e954..6b8657e 100644
--- a/release/scripts/addons/io_curve_svg/svg_colors.py
+++ b/release/scripts/addons/io_curve_svg/svg_colors.py
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 
 #
-# Copied and adoptedfrom paths_svg2obj.py scring for Blender 2.49 which is
+# Copied and adopted from paths_svg2obj.py script for Blender 2.49 which is
 # Copyright (c) jm soler juillet/novembre 2004-april 2009,
 #
 
diff --git a/release/scripts/addons/io_export_unreal_psk_psa.py b/release/scripts/addons/io_export_unreal_psk_psa.py
index 137d3d4..d0baffc 100644
--- a/release/scripts/addons/io_export_unreal_psk_psa.py
+++ b/release/scripts/addons/io_export_unreal_psk_psa.py
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Export Unreal Engine Format(.psk/.psa)",
     "author": "Darknet/Optimus_P-Fat/Active_Trash/Sinsoft/VendorX/Spoof",
-    "version": (2, 5),
+    "version": (2, 6),
     "blender": (2, 6, 3),
     "api": 36079,
     "location": "File > Export > Skeletal Mesh/Animation Data (.psk/.psa)",
@@ -139,7 +139,7 @@ considering the other issues with Rigify, it was abandoned.
 """
 #===========================================================================
 
-
+import bmesh
 import os
 import time
 import bpy
@@ -148,10 +148,9 @@ import math
 import random
 import operator
 import sys
-
+from bpy.props import *
 from struct import pack
 
-
 # REFERENCE MATERIAL JUST IN CASE:
 # 
 # U = x / sqrt(x^2 + y^2 + z^2)
@@ -185,7 +184,6 @@ class Error( Exception ):
 	def __init__(self, message):
 		self.message = message
 
-
 #===========================================================================
 # Verbose logging with loop truncation
 #===========================================================================
@@ -201,7 +199,6 @@ def verbose( msg, iteration=-1, max_iterations=4, msg_truncated="..." ):
 
 		print(msg)
 	
-
 #===========================================================================
 # Log header/separator
 #===========================================================================
@@ -218,7 +215,6 @@ def header( msg, justify='LEFT', spacer='_', cols=78 ):
 	
 	return "\n" + s + "\n"
 
-
 #===========================================================================
 # Generic Object->Integer mapping
 # the object must be usable as a dictionary key
@@ -243,7 +239,6 @@ class ObjMap:
 		getkey = operator.itemgetter(1)
 		return map(getval, sorted(self.dict.items(), key=getkey))
 
-
 #===========================================================================
 # RG - UNREAL DATA STRUCTS - CONVERTED FROM C STRUCTS GIVEN ON UDN SITE 
 # provided here: http://udn.epicgames.com/Two/BinaryFormatSpecifications.html
@@ -272,7 +267,6 @@ class FQuat:
 	def __str__(self):
 		return "[%f,%f,%f,%f](FQuat)" % (self.X, self.Y, self.Z, self.W)
 
-
 class FVector(object):
 
 	def __init__(self, X=0.0, Y=0.0, Z=0.0):
@@ -312,7 +306,6 @@ class FVector(object):
 			self.Y - other.Y,
 			self.Z - other.Z)
 
-
 class VJointPos:
 
 	def __init__(self):
@@ -326,7 +319,6 @@ class VJointPos:
 	def dump(self):
 		return self.Orientation.dump() + self.Position.dump() + pack('4f', self.Length, self.XSize, self.YSize, self.ZSize)
 
-
 class AnimInfoBinary:
 
 	def __init__(self):
@@ -346,7 +338,6 @@ class AnimInfoBinary:
 	def dump(self):
 		return pack('64s64siiiifffiii', str.encode(self.Name), str.encode(self.Group), self.TotalBones, self.RootInclude, self.KeyCompressionStyle, self.KeyQuotum, self.KeyPrediction, self.TrackTime, self.AnimRate, self.StartBone, self.FirstRawFrame, self.NumRawFrames)
 
-
 class VChunkHeader:
 
 	def __init__(self, name, type_size):
@@ -358,7 +349,6 @@ class VChunkHeader:
 	def dump(self):
 		return pack('20siii', self.ChunkID, self.TypeFlag, self.DataSize, self.DataCount)
 
-
 class VMaterial:
 
 	def __init__(self):
@@ -374,7 +364,6 @@ class VMaterial:
 		#print("DATA MATERIAL:",self.MaterialName)
 		return pack('64siLiLii', str.encode(self.MaterialName), self.TextureIndex, self.PolyFlags, self.AuxMaterial, self.AuxFlags, self.LodBias, self.LodStyle)
 
-
 class VBone:
 
 	def __init__(self):
@@ -387,7 +376,6 @@ class VBone:
 	def dump(self):
 		return pack('64sLii', str.encode(self.Name), self.Flags, self.NumChildren, self.ParentIndex) + self.BonePos.dump()
 
-
 #same as above - whatever - this is how Epic does it...	 
 class FNamedBoneBinary:
 
@@ -402,7 +390,6 @@ class FNamedBoneBinary:
 	def dump(self):
 		return pack('64sLii', str.encode(self.Name), self.Flags, self.NumChildren, self.ParentIndex) + self.BonePos.dump()
 
-
 class VRawBoneInfluence:
 
 	def __init__(self):
@@ -413,7 +400,6 @@ class VRawBoneInfluence:
 	def dump(self):
 		return pack('fii', self.Weight, self.PointIndex, self.BoneIndex)
 
-
 class VQuatAnimKey:
 
 	def __init__(self):
@@ -424,7 +410,6 @@ class VQuatAnimKey:
 	def dump(self):
 		return self.Position.dump() + self.Orientation.dump() + pack('f', self.Time)
 
-
 class VVertex(object):
 
 	def __init__(self):
@@ -457,7 +442,6 @@ class VVertex(object):
 			return False
 		return self._key() == other._key()
 
-
 class VPointSimple:
 
 	def __init__(self):
@@ -477,7 +461,6 @@ class VPointSimple:
 			return False
 		return self._key() == other._key()
 
-
 class VPoint(object):
 
 	def __init__(self):
@@ -503,7 +486,6 @@ class VPoint(object):
 			return False
 		return self._key() == other._key() 
 
-
 class VTriangle:
 
 	def __init__(self):
@@ -520,7 +502,6 @@ class VTriangle:
 # END UNREAL DATA STRUCTS
 #===========================================================================
 
-
 #===========================================================================
 # RG - helper class to handle the normal way the UT files are stored 
 # as sections consisting of a header and then a list of data structures
@@ -540,7 +521,6 @@ class FileSection:
 	def UpdateHeader(self):
 		self.Header.DataCount = len(self.Data)
 
-
 #===========================================================================
 # PSK
 #===========================================================================
@@ -619,7 +599,6 @@ class PSKFile:
 		print( "{:>16} {:}".format( "Bones", len(self.Bones.Data) ) )
 		print( "{:>16} {:}".format( "Influences", len(self.Influences.Data) ) )
 
-
 #===========================================================================
 # PSA
 #
@@ -701,7 +680,6 @@ class PSAFile:
 		print( "{:>16} {:}".format( "Animations", len(self.Animations.Data) ) )
 		print( "{:>16} {:}".format( "Raw keys", len(self.RawKeys.Data) ) )
 
-
 #===========================================================================
 # Helpers to create bone structs
 #===========================================================================
@@ -751,7 +729,6 @@ def make_fquat_default( bquat ):
 	quat.W  = bquat.w
 	return quat
 
-
 #===========================================================================
 #RG - check to make sure face isnt a line
 #===========================================================================
@@ -766,7 +743,6 @@ def is_1d_face( face, mesh ):
 		or mesh.vertices[v2].co == mesh.vertices[v0].co)
 	return False
 
-
 #===========================================================================
 # Smoothing group
 # (renamed to seperate it from VVertex.SmoothGroup)
@@ -819,7 +795,6 @@ class SmoothingGroup:
 		if not face in self.faces:
 			self.faces.append( face )
 
-
 def determine_edge_sharing( mesh ):
 	
 	edge_sharing_list = dict()
@@ -834,7 +809,6 @@ def determine_edge_sharing( mesh ):
 	
 	return edge_sharing_list
 
-
 def find_edges( mesh, key ):
 	"""	Temp replacement for mesh.findEdges().
 		This is painfully slow.
@@ -844,7 +818,6 @@ def find_edges( mesh, key ):
 		if key[0] == v[0] and key[1] == v[1]:
 			return edge.index
 
-
 def add_face_to_smoothgroup( mesh, face, edge_sharing_list, smoothgroup ):
 	
 	if face in smoothgroup.faces:
@@ -871,7 +844,6 @@ def add_face_to_smoothgroup( mesh, face, edge_sharing_list, smoothgroup ):
 					if shared_face != face:
 						smoothgroup.add_neighbor_face( shared_face )
 
-
 def determine_smoothgroup_for_face( mesh, face, edge_sharing_list, smoothgroup_list ):
 	
 	for group in smoothgroup_list:
@@ -884,7 +856,6 @@ def determine_smoothgroup_for_face( mesh, face, edge_sharing_list, smoothgroup_l
 	if not smoothgroup in smoothgroup_list:
 		smoothgroup_list.append( smoothgroup )
 
-
 def build_neighbors_tree( smoothgroup_list ):
 
 	for group in smoothgroup_list:
@@ -894,7 +865,6 @@ def build_neighbors_tree( smoothgroup_list ):
 					group.make_neighbor( neighbor_group )
 					neighbor_group.make_neighbor( group )
 
-
 #===========================================================================
 # parse_smooth_groups
 #===========================================================================
@@ -929,7 +899,6 @@ def parse_smooth_groups( mesh ):
 	print("Smooth group parsing completed in {:.2f}s".format(time.clock() - t))
 	return smoothgroup_list
 
-
 #===========================================================================
 # http://en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python/Cookbook#Triangulate_NMesh
 # blender 2.50 format using the Operators/command convert the mesh to tri mesh
@@ -1323,7 +1292,6 @@ def parse_mesh( mesh, psk ):
 		bpy.ops.object.mode_set(mode='OBJECT')	  # OBJECT mode
 		mesh.parent = None						  # unparent to avoid phantom links
 		bpy.context.scene.objects.unlink(mesh)	  # unlink
-		
 
 #===========================================================================
 # Collate bones that belong to the UDK skeletal mesh
@@ -1361,7 +1329,6 @@ def parse_armature( armature, psk, psa ):
 	# this is passed to parse_animation instead of working from keyed bones in the action
 	return udk_bones
 
-
 #===========================================================================
 # bone				current bone
 # bones				bone list
@@ -1430,12 +1397,10 @@ def recurse_bone( bone, bones, psk, psa, parent_id, parent_matrix, indent="" ):
 	for child_bone in bone.children:
 		recurse_bone(child_bone, bones, psk, psa, bone_id, parent_matrix, " "+indent)
 
-
 # FIXME rename? remove?
 class BoneUtil:
 	static_bone_id = 0 # static property to replace global
 
-
 #===========================================================================
 # armature			the armature
 # udk_bones			list of bones to be exported
@@ -1469,7 +1434,19 @@ def parse_animation( armature, udk_bones, actions_to_export, psa ):
 		if not len(action.fcurves):
 			print("{} has no keys, skipping".format(action.name))
 			continue
-		
+		'''
+		if bpy.context.scene.udk_option_selectanimations:
+			print("Action Set is selected!")
+			bready = False
+			for actionlist in bpy.context.scene.udkas_list:
+				if actionlist.name == action.name and actionlist.bmatch == True and actionlist.bexport == True:
+					bready = True
+					print("Added Action Set:",action.name)
+					break
+			if bready == False:#don't export it
+				print("Skipping Action Set:",action.name)
+				continue
+		'''
 		# apply action to armature and update scene
 		armature.animation_data.action = action
 		context.scene.update()
@@ -1568,7 +1545,6 @@ def parse_animation( armature, udk_bones, actions_to_export, psa ):
 	armature.animation_data.action = restoreAction
 	context.scene.frame_set(restoreFrame)
 
-
 #===========================================================================
 # Collate actions to be exported
 # Modify this to filter for one, some or all actions. For now use all.
@@ -1579,13 +1555,22 @@ def collate_actions():
 	actions_to_export = []
 	
 	for action in bpy.data.actions:
-		
+		if bpy.context.scene.udk_option_selectanimations:
+			print("Action Set is selected!")
+			bready = False
+			for actionlist in bpy.context.scene.udkas_list:
+				if actionlist.name == action.name and actionlist.bmatch == True and actionlist.bexport == True:
+					bready = True
+					print("Added Action Set:",action.name)
+					break
+			if bready == False:#don't export it
+				print("Skipping Action Set:",action.name)
+				continue
 		verbose(" + {}".format(action.name))
 		actions_to_export.append(action)
 	
 	return actions_to_export
 
-
 #===========================================================================
 # Locate the target armature and mesh for export
 # RETURNS armature, mesh
@@ -1600,64 +1585,111 @@ def find_armature_and_mesh():
 	
 	# TODO:
 	# this could be more intuitive
-	bpy.ops.object.mode_set(mode='OBJECT')
-	# try the active object
-	if active_object and active_object.type == 'ARMATURE':
-		armature = active_object
+	#bpy.ops.object.mode_set(mode='OBJECT')
 	
-	# otherwise, try for a single armature in the scene
-	else:
-		all_armatures = [obj for obj in context.scene.objects if obj.type == 'ARMATURE']
-		
-		if len(all_armatures) == 1:
-			armature = all_armatures[0]
-		
-		elif len(all_armatures) > 1:
-			raise Error("Please select an armature in the scene")
-		
+	if bpy.context.scene.udk_option_selectobjects:
+		print("select mode:")
+		if len(bpy.context.scene.udkArm_list) > 0:
+			print("Armature Name:",bpy.context.scene.udkArm_list[bpy.context.scene.udkArm_list_idx].name)
+			for obj in bpy.context.scene.objects:
+				if obj.name == bpy.context.scene.udkArm_list[bpy.context.scene.udkArm_list_idx].name:
+					armature = obj
+					break
 		else:
-			raise Error("No armatures in scene")
-	
-	verbose("Found armature: {}".format(armature.name))
-	
-	meshselected = []
-	parented_meshes = [obj for obj in armature.children if obj.type == 'MESH']
-	for obj in armature.children:
-		#print(dir(obj))
-		if obj.type == 'MESH' and obj.select == True:
-			meshselected.append(obj)
-	# try the active object
-	if active_object and active_object.type == 'MESH' and len(meshselected) == 0:
+			raise Error("There is no Armature in the list!")
+		meshselected = []
+		parented_meshes = [obj for obj in armature.children if obj.type == 'MESH']
+		for obj in armature.children:
+			#print(dir(obj))
+			if obj.type == 'MESH' and obj.select == True:
+				bexportmesh = False
+				#print("PARENT MESH:",obj.name)
+				for udkmeshlist in bpy.context.scene.udkmesh_list:
+					if obj.name == udkmeshlist.name and udkmeshlist.bexport == True:
+						bexportmesh = True
+						break
+				if bexportmesh == True:
+					print("Mesh Name:",obj.name," < SELECT TO EXPORT!")
+					meshselected.append(obj)
+		print("MESH COUNT:",len(meshselected))
+		# try the active object
+		if active_object and active_object.type == 'MESH' and len(meshselected) == 0:
+			if active_object.parent == armature:
+				mesh = active_object
+			else:
+				raise Error("The selected mesh is not parented to the armature")
 	
-		if active_object.parent == armature:
-			mesh = active_object
-		
+		# otherwise, expect a single mesh parented to the armature (other object types are ignored)
 		else:
-			raise Error("The selected mesh is not parented to the armature")
-	
-	# otherwise, expect a single mesh parented to the armature (other object types are ignored)
+			print("Number of meshes:",len(parented_meshes))
+			print("Number of meshes (selected):",len(meshselected))
+			if len(parented_meshes) == 1:
+				mesh = parented_meshes[0]
+				
+			elif len(parented_meshes) > 1:
+				if len(meshselected) >= 1:
+					mesh = sortmesh(meshselected)
+				else:
+					raise Error("More than one mesh(s) parented to armature. Select object(s)!")
+			else:
+				raise Error("No mesh parented to armature")
 	else:
-		print("Number of meshes:",len(parented_meshes))
-		print("Number of meshes (selected):",len(meshselected))
-		if len(parented_meshes) == 1:
-			mesh = parented_meshes[0]
+		print("normal mode:")
+		# try the active object
+		if active_object and active_object.type == 'ARMATURE':
+			armature = active_object
+			bpy.ops.object.mode_set(mode='OBJECT')
+		# otherwise, try for a single armature in the scene
+		else:
+			#bpy.ops.object.mode_set(mode='OBJECT')
+			all_armatures = [obj for obj in bpy.context.scene.objects if obj.type == 'ARMATURE']
 			
-		elif len(parented_meshes) > 1:
-			if len(meshselected) >= 1:
-				mesh = sortmesh(meshselected)
+			if len(all_armatures) == 1:
+				armature = all_armatures[0]
+			elif len(all_armatures) > 1:
+				raise Error("Please select an armature in the scene")
 			else:
-				raise Error("More than one mesh(s) parented to armature. Select object(s)!")
+				raise Error("No armatures in scene")
+		
+		verbose("Found armature: {}".format(armature.name))
+		
+		meshselected = []
+		parented_meshes = [obj for obj in armature.children if obj.type == 'MESH']
+		for obj in armature.children:
+			#print(dir(obj))
+			if obj.type == 'MESH' and obj.select == True:
+				meshselected.append(obj)
+		# try the active object
+		if active_object and active_object.type == 'MESH' and len(meshselected) == 0:
+			if active_object.parent == armature:
+				mesh = active_object
+			else:
+				raise Error("The selected mesh is not parented to the armature")
+	
+		# otherwise, expect a single mesh parented to the armature (other object types are ignored)
 		else:
-			raise Error("No mesh parented to armature")
+			print("Number of meshes:",len(parented_meshes))
+			print("Number of meshes (selected):",len(meshselected))
+			if len(parented_meshes) == 1:
+				mesh = parented_meshes[0]
+				
+			elif len(parented_meshes) > 1:
+				if len(meshselected) >= 1:
+					mesh = sortmesh(meshselected)
+				else:
+					raise Error("More than one mesh(s) parented to armature. Select object(s)!")
+			else:
+				raise Error("No mesh parented to armature")
 		
-	verbose("Found mesh: {}".format(mesh.name))	
+		verbose("Found mesh: {}".format(mesh.name))
+	if mesh == None or armature == None:
+		raise Error("Check Mesh and Armature are list!")
 	if len(armature.pose.bones) == len(mesh.vertex_groups):
 		print("Armature and Mesh Vertex Groups matches Ok!")
 	else:
 		raise Error("Armature bones:" + str(len(armature.pose.bones)) + " Mesh Vertex Groups:" + str(len(mesh.vertex_groups)) +" doesn't match!")
 	return armature, mesh
 
-
 #===========================================================================
 # Returns a list of vertex groups in the mesh. Can be modified to filter
 # groups as necessary.
@@ -1753,8 +1785,6 @@ def export(filepath):
 
 	print("Export completed in {:.2f} seconds".format((time.clock() - t)))
 
-from bpy.props import *
-
 #===========================================================================
 # Operator
 #===========================================================================
@@ -1811,7 +1841,6 @@ class Operator_ToggleConsole( bpy.types.Operator ):
 		bpy.ops.wm.console_toggle()
 		return {'FINISHED'}
 
-
 #===========================================================================
 # Get filepath for export
 #===========================================================================
@@ -1820,15 +1849,12 @@ def get_dst_path():
 		if bpy.context.active_object:
 			path = os.path.split(bpy.data.filepath)[0] + "\\" + bpy.context.active_object.name# + ".psk"
 		else:
-			path = os.path.split(bpy.data.filepath)[0] + "\\" + "Unknown";
+			#path = os.path.split(bpy.data.filepath)[0] + "\\" + "Unknown";
+			path = os.path.splitext(bpy.data.filepath)[0]# + ".psk"
 	else:
 		path = os.path.splitext(bpy.data.filepath)[0]# + ".psk"
 	return path
 
-# fixme
-from bpy.props import *
-
-
 #Added by [MGVS]
 bpy.types.Scene.udk_option_filename_src = EnumProperty(
 		name		= "Filename",
@@ -1880,14 +1906,22 @@ bpy.types.Scene.udk_option_triangulate = BoolProperty(
 		description	= "Convert Quads to Triangles",
 		default		= False)
 		
+bpy.types.Scene.udk_option_selectanimations = BoolProperty(
+		name		= "Select Animation(s)",
+		description	= "Select aimation(s) for export to psa file.",
+		default		= False)
+		
+bpy.types.Scene.udk_option_selectobjects = BoolProperty(
+		name		= "Select Object(s)",
+		description	= "Select aimation(s) for export to psa file.",
+		default		= False)
 
-import bmesh
 #===========================================================================
 # User interface
 #===========================================================================
 class OBJECT_OT_UTSelectedFaceSmooth(bpy.types.Operator):
     bl_idname = "object.utselectfacesmooth"  # XXX, name???
-    bl_label = "Select Smooth faces"
+    bl_label = "Select Smooth Faces"#"Select Smooth faces"
     __doc__ = """It will only select smooth faces that is select mesh"""
     
     def invoke(self, context, event):
@@ -1930,7 +1964,7 @@ class OBJECT_OT_UTSelectedFaceSmooth(bpy.types.Operator):
 		
 class OBJECT_OT_MeshClearWeights(bpy.types.Operator):
     bl_idname = "object.meshclearweights"  # XXX, name???
-    bl_label = "Remove Mesh vertex weights"
+    bl_label = "Remove Vertex Weights"#"Remove Mesh vertex weights"
     __doc__ = """Remove all mesh vertex groups weights for the bones."""
     
     def invoke(self, context, event):
@@ -1950,7 +1984,7 @@ def unpack_list(list_of_tuples):
 	
 class OBJECT_OT_UTRebuildMesh(bpy.types.Operator):
     bl_idname = "object.utrebuildmesh"  # XXX, name???
-    bl_label = "Rebuild Mesh"
+    bl_label = "Rebuild"#"Rebuild Mesh"
     __doc__ = """It rebuild the mesh from scrape from the selected mesh object. Note the scale will be 1:1 for object mode. To keep from deforming"""
     
     def invoke(self, context, event):
@@ -2061,7 +2095,7 @@ class OBJECT_OT_UTRebuildMesh(bpy.types.Operator):
 		
 class OBJECT_OT_UTRebuildArmature(bpy.types.Operator):
     bl_idname = "object.utrebuildarmature"  # XXX, name???
-    bl_label = "Rebuild Armature"
+    bl_label = "Rebuild" #Rebuild Armature
     __doc__ = """If mesh is deform when importing to unreal engine try this. It rebuild the bones one at the time by select one armature object scrape to raw setup build. Note the scale will be 1:1 for object mode. To keep from deforming"""
     
     def invoke(self, context, event):
@@ -2120,6 +2154,53 @@ class OBJECT_OT_UTRebuildArmature(bpy.types.Operator):
         print("----------------------------------------")
         return{'FINISHED'}
 
+class UDKActionSetListPG(bpy.types.PropertyGroup):
+	bool    = BoolProperty(default=False)
+	string  = StringProperty()
+	actionname  = StringProperty()
+	bmatch    = BoolProperty(default=False,name="Match", options={"HIDDEN"},description = "This check against bone names and action group names matches and override boolean if true.")
+	bexport    = BoolProperty(default=False,name="Export",description = "Check this to export the animation")
+	template_list_controls = StringProperty(default="bmatch:bexport", options={"HIDDEN"})
+
+bpy.utils.register_class(UDKActionSetListPG)
+bpy.types.Scene.udkas_list = CollectionProperty(type=UDKActionSetListPG)
+bpy.types.Scene.udkas_list_idx = IntProperty()
+
+class UDKObjListPG(bpy.types.PropertyGroup):
+	bool    = BoolProperty(default=False)
+	string  = StringProperty()
+	bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
+	bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
+	otype  = StringProperty(name="Type",description = "This will be ignore when exported")
+	template_list_controls = StringProperty(default="otype:bselect", options={"HIDDEN"})
+
+bpy.utils.register_class(UDKObjListPG)
+bpy.types.Scene.udkobj_list = CollectionProperty(type=UDKObjListPG)
+bpy.types.Scene.udkobj_list_idx = IntProperty()
+
+class UDKMeshListPG(bpy.types.PropertyGroup):
+	bool    = BoolProperty(default=False)
+	string  = StringProperty()
+	bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This object will be export when true.")
+	bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "Make sure you have Mesh is parent to Armature.")
+	otype  = StringProperty(name="Type",description = "This will be ignore when exported")
+	template_list_controls = StringProperty(default="bselect:bexport", options={"HIDDEN"})
+
+bpy.utils.register_class(UDKMeshListPG)
+bpy.types.Scene.udkmesh_list = CollectionProperty(type=UDKMeshListPG)
+bpy.types.Scene.udkmesh_list_idx = IntProperty()
+
+class UDKArmListPG(bpy.types.PropertyGroup):
+	bool    = BoolProperty(default=False)
+	string  = StringProperty()
+	bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
+	bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
+	otype  = StringProperty(name="Type",description = "This will be ignore when exported")
+	template_list_controls = StringProperty(default="", options={"HIDDEN"})
+
+bpy.utils.register_class(UDKArmListPG)
+bpy.types.Scene.udkArm_list = CollectionProperty(type=UDKArmListPG)
+bpy.types.Scene.udkArm_list_idx = IntProperty()
 
 class Panel_UDKExport( bpy.types.Panel ):
 
@@ -2149,35 +2230,221 @@ class Panel_UDKExport( bpy.types.Panel ):
 		#	object_name = context.object.name
 		if context.active_object:
 			object_name = context.active_object.name
-
-		layout.prop(context.scene, "udk_option_smoothing_groups")
-		layout.prop(context.scene, "udk_option_clamp_uv")
-		layout.prop(context.scene, "udk_option_verbose")
-
+		row10 = layout.row()
+		row10.prop(context.scene, "udk_option_smoothing_groups")
+		row10.prop(context.scene, "udk_option_clamp_uv")
+		row10.prop(context.scene, "udk_option_verbose")
+		#layout.prop(context.scene, "udk_option_smoothing_groups")
+		#layout.prop(context.scene, "udk_option_clamp_uv")
+		#layout.prop(context.scene, "udk_option_verbose")
 		row = layout.row()
 		row.label(text="Active object: " + object_name)
-
 		#layout.separator()
-
 		layout.prop(context.scene, "udk_option_filename_src")
 		row = layout.row()
 		row.label(text=path)
-
 		#layout.separator()
-
 		layout.prop(context.scene, "udk_option_export")
-		layout.operator("object.udk_export")
 		
-		#layout.separator()
+		row10 = layout.row()
+		
+		row10.prop(context.scene, "udk_option_selectanimations")
+		row10.prop(context.scene, "udk_option_selectobjects")
+		
+		if context.scene.udk_option_selectobjects:
+			layout.operator("object.selobjectpdate")
+			#layout.template_list(context.scene, "udkobj_list", context.scene, "udkobj_list_idx",prop_list="template_list_controls", rows=5)
+			layout.label(text="ARMATURE")
+			layout.template_list(context.scene, "udkArm_list", context.scene, "udkArm_list_idx",prop_list="template_list_controls", rows=3)
+			layout.label(text="MESH")
+			layout.template_list(context.scene, "udkmesh_list", context.scene, "udkmesh_list_idx",prop_list="template_list_controls", rows=5)
+			
+		if context.scene.udk_option_selectanimations:
+			layout.operator("action.setanimupdate")
+			layout.label(text="Action Set(s)")
+			layout.template_list(context.scene, "udkas_list", context.scene, "udkas_list_idx",prop_list="template_list_controls", rows=5)
+		test = layout.separator()
+		#test.operator("object.udk_export")
+		row11 = layout.row()
+		row11.operator("object.udk_export")
+		row11.operator("object.toggle_console")
+		layout.label(text="Armature")
+		row12 = layout.row()
+		row12.operator(OBJECT_OT_UTRebuildArmature.bl_idname)
+		layout.label(text="Mesh")
+		row13 = layout.row()
+		row13.operator(OBJECT_OT_MeshClearWeights.bl_idname)
+		row13.operator(OBJECT_OT_UTSelectedFaceSmooth.bl_idname)
+		row13.operator(OBJECT_OT_UTRebuildMesh.bl_idname)
+		#row13.box(name="Test")
+		
+def udkupdateobjects():
+		my_objlist = bpy.context.scene.udkArm_list
+		objectl = []
+		for objarm in bpy.context.scene.objects:#list and filter only mesh and armature
+			if objarm.type == 'ARMATURE':
+				objectl.append(objarm)
+		for _objd in objectl:#check if list has in udk list
+			bfound_obj = False
+			for _obj in my_objlist:
+				if _obj.name == _objd.name and _obj.otype == _objd.type:
+					_obj.bselect = _objd.select
+					bfound_obj = True
+					break
+			if bfound_obj == False:
+				#print("ADD ARMATURE...")
+				my_item = my_objlist.add()
+				my_item.name = _objd.name
+				my_item.bselect = _objd.select
+				my_item.otype = _objd.type
+		removeobject = []
+		for _udkobj in my_objlist:
+			bfound_objv = False
+			for _objd in bpy.context.scene.objects: #check if there no existing object from sense to remove it
+				if _udkobj.name == _objd.name and _udkobj.otype == _objd.type:
+					bfound_objv = True
+					break
+			if bfound_objv == False:
+				removeobject.append(_udkobj)
+		#print("remove check...")
+		for _item in removeobject: #loop remove object from udk list object
+			count = 0
+			for _obj in my_objlist:
+				if _obj.name == _item.name and _obj.otype == _item.otype:
+					my_objlist.remove(count)
+					break
+				count += 1
+				
+		my_objlist = bpy.context.scene.udkmesh_list
+		objectl = []
+		for objarm in bpy.context.scene.objects:#list and filter only mesh and armature
+			if objarm.type == 'MESH':
+				objectl.append(objarm)
+		for _objd in objectl:#check if list has in udk list
+			bfound_obj = False
+			for _obj in my_objlist:
+				if _obj.name == _objd.name and _obj.otype == _objd.type:
+					_obj.bselect = _objd.select
+					bfound_obj = True
+					break
+			if bfound_obj == False:
+				my_item = my_objlist.add()
+				my_item.name = _objd.name
+				my_item.bselect = _objd.select
+				my_item.otype = _objd.type
+		removeobject = []
+		for _udkobj in my_objlist:
+			bfound_objv = False
+			for _objd in bpy.context.scene.objects: #check if there no existing object from sense to remove it
+				if _udkobj.name == _objd.name and _udkobj.otype == _objd.type:
+					bfound_objv = True
+					break
+			if bfound_objv == False:
+				removeobject.append(_udkobj)
+		#print("remove check...")
+		for _item in removeobject: #loop remove object from udk list object
+			count = 0
+			for _obj in my_objlist:
+				if _obj.name == _item.name and _obj.otype == _item.otype:
+					my_objlist.remove(count)
+					break
+				count += 1
+				
+class OBJECT_OT_UDKObjUpdate(bpy.types.Operator):
+	bl_idname = "object.selobjectpdate"
+	bl_label = "Update Object(s)"
+	__doc__		= "This will update the filter of the mesh and armature."
+	actionname = bpy.props.StringProperty()
+ 
+	def execute(self, context):
+		udkupdateobjects()
+		return{'FINISHED'}
+
+class OBJECT_OT_ActionSetAnimUpdate(bpy.types.Operator):
+	bl_idname = "action.setanimupdate"
+	bl_label = "Update Action Set(s)"
+	__doc__		= "Select Armture to match the action set groups. All bones keys must be set to match with number of bones."
+	actionname = bpy.props.StringProperty()
+ 
+	def execute(self, context):
+		my_sett = bpy.context.scene.udkas_list
+		
+		bones = []
+		armature = None
+		armatures = []
+		armatureselected = []
+		for objarm in bpy.context.scene.objects:
+			if objarm.type == 'ARMATURE':
+				#print("ADDED ARMATURE...")
+				armatures.append(objarm)
+				if objarm.select == True:
+					armatureselected.append(objarm)
+				
+		if len(armatureselected) == len(armatures) == 1:
+			armature = armatures[0]
+		if len(armatures) == 1:
+			armature = armatures[0]
+		if len(armatureselected) == 1:		
+			armature = armatureselected[0]
+			
+		if armature != None:
+			for bone in armature.pose.bones:
+				bones.append(bone.name)
+
+		for action in bpy.data.actions:#action list
+			bfound = False
+			count = 0
+			for actionbone in action.groups:
+				#print("Pose bone name: ",actionbone.name)
+				for b in bones:
+					if b == actionbone.name:
+						count += 1
+						#print(b," : ",actionbone.name)
+						break
+			for actionlist in my_sett:
+				if action.name == actionlist.name:
+					bactionfound = True
+					if len(bones) == len(action.groups) == count:
+						actionlist.bmatch = True
+					else:
+						actionlist.bmatch = False
+					bfound = True
+					break
+			if bfound != True:
+				my_item = my_sett.add()
+				#print(dir(my_item.bmatch))
+				my_item.name = action.name
+				my_item.template_list_controls = "bmatch:bexport"
+				if len(bones) == len(action.groups) == count:
+					my_item.bmatch = True
+				else:
+					my_item.bmatch = False
+		removeactions = []	
+		#check action list and data actions
+		for actionlist in bpy.context.scene.udkas_list:
+			bfind = False
+			notfound = 0
+			for act in bpy.data.actions:
+				if actionlist.name == act.name:
+					bfind = True
+				else:
+					notfound += 1
+			#print("ACT NAME:",actionlist.name," COUNT",notfound)
+			if notfound == len(bpy.data.actions):
+				#print("remove :",actionlist.name)
+				removeactions.append(actionlist.name)	
+		#print("Not in the action data list:",len(removeactions))
+		#remove list or chnages in the name the template list
+		for actname in removeactions:
+			actioncount = 0
+			for actionlist in my_sett:
+				#print("action name:",actionlist.name)
+				if actionlist.name == actname:
+					my_sett.remove(actioncount);
+					break
+				actioncount += 1
+		return{'FINISHED'}		
 		
-		layout.operator("object.toggle_console")
-		layout.operator(OBJECT_OT_UTRebuildArmature.bl_idname)
-		layout.operator(OBJECT_OT_MeshClearWeights.bl_idname)
-		layout.operator(OBJECT_OT_UTSelectedFaceSmooth.bl_idname)
-		layout.operator(OBJECT_OT_UTRebuildMesh.bl_idname)
-
-		#layout.separator()
-
 class ExportUDKAnimData(bpy.types.Operator):
     """Export Skeleton Mesh / Animation Data file(s)"""
     bl_idname = "export_anim.udk" # this is important since its how bpy.ops.export.udk_anim_data is constructed
@@ -2231,7 +2498,8 @@ class ExportUDKAnimData(bpy.types.Operator):
     def invoke(self, context, event):
         wm = context.window_manager
         wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}		
+        return {'RUNNING_MODAL'}
+		
 def menu_func(self, context):
     default_path = os.path.splitext(bpy.data.filepath)[0] + ".psk"
     self.layout.operator(ExportUDKAnimData.bl_idname, text="Skeleton Mesh / Animation Data (.psk/.psa)").filepath = default_path
@@ -2243,15 +2511,15 @@ def register():
 	#print("REGISTER")
 	bpy.utils.register_module(__name__)
 	bpy.types.INFO_MT_file_export.append(menu_func)
-
+	
 def unregister():
 	#print("UNREGISTER")
 	bpy.utils.unregister_module(__name__)
 	bpy.types.INFO_MT_file_export.remove(menu_func)
-	
+		
 if __name__ == "__main__":
 	#print("\n"*4)
-	print(header("UDK Export PSK/PSA Alpha 0.1", 'CENTER'))
+	print(header("UDK Export PSK/PSA 2.6", 'CENTER'))
 	register()
 	
 #loader
diff --git a/release/scripts/addons/io_import_images_as_planes.py b/release/scripts/addons/io_import_images_as_planes.py
index 2a44104..d072453 100644
--- a/release/scripts/addons/io_import_images_as_planes.py
+++ b/release/scripts/addons/io_import_images_as_planes.py
@@ -18,9 +18,9 @@
 
 bl_info = {
     "name": "Import Images as Planes",
-    "author": "Florian Meyer (tstscr)",
-    "version": (1, 6),
-    "blender": (2, 6, 3),
+    "author": "Florian Meyer (tstscr), mont29, matali",
+    "version": (1, 7),
+    "blender": (2, 6, 5),
     "location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
     "description": "Imports images and creates planes with the appropriate "
                    "aspect ratio. The images are mapped to the planes.",
@@ -226,12 +226,21 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
                              description="Only import files of this type",
                              update=update_extensions)
 
-    use_dimension = BoolProperty(name="Use Image Dimensions", default=False,
-                                 description="Use the images pixels to derive "
-                                             "planes size")
+    # -------------------
+    # Plane size options.
+    _size_modes = (
+        ('ABSOLUTE', "Absolute", "Use absolute size"),
+        ('DPI', "Dpi", "Use definition of the image as dots per inch"),
+        ('DPBU', "Dots/BU", "Use definition of the image as dots per Blender Unit"),
+    )
+    size_mode = EnumProperty(name="Size Mode", default='DPI', items=_size_modes,
+                             description="How the size of the plane is computed")
 
-    factor = IntProperty(name="Pixels/BU", min=1, default=500,
-                         description="Number of pixels per Blenderunit")
+    height = FloatProperty(name="Height", description="Height of the created plane",
+                           default=1.0, min=0.001, soft_min=0.001, subtype='DISTANCE', unit='LENGTH')
+
+    factor = FloatProperty(name="Definition", min=1.0, default=600.0,
+                           description="Number of pixels per inch or Blender Unit")
 
     # -------------------------
     # Blender material options.
@@ -309,7 +318,8 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
             box.prop(self, "use_shadeless")
             box.prop(self, "use_transparency")
             box.prop(self, "use_premultiply")
-            box.prop(self, "transparency_method", expand=True)
+            row = box.row()
+            row.prop(self, "transparency_method", expand=True)
             box.prop(self, "use_transparent_shadows")
         elif engine == 'CYCLES':
             box = layout.box()
@@ -319,8 +329,12 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
 
         box = layout.box()
         box.label("Plane dimensions:", icon='ARROW_LEFTRIGHT')
-        box.prop(self, "use_dimension")
-        box.prop(self, "factor", expand=True)
+        row = box.row()
+        row.prop(self, "size_mode", expand=True)
+        if self.size_mode == 'ABSOLUTE':
+            box.prop(self, "height")
+        else:
+            box.prop(self, "factor")
 
     def invoke(self, context, event):
         self.update_extensions(context)
@@ -356,7 +370,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
             textures = []
             for img in images:
                 self.set_image_options(img)
-                textures.append(self.create_image_textures(img))
+                textures.append(self.create_image_textures(context, img))
 
             materials = (self.create_material_for_texture(tex)
                          for tex in textures)
@@ -389,12 +403,17 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
         if px == 0 or py == 0:
             px = py = 1
 
-        x = px / py
-        y = 1.0
-
-        if self.use_dimension:
-            x = (px * (1.0 / self.factor)) * 0.5
-            y = (py * (1.0 / self.factor)) * 0.5
+        if self.size_mode == 'ABSOLUTE':
+            y = self.height / 2
+            x = px / py * y
+        elif self.size_mode == 'DPI':
+            fact = 1 / self.factor / context.scene.unit_settings.scale_length * 0.0254 / 2
+            x = px * fact
+            y = py * fact
+        else:  # self.size_mode == 'DPBU'
+            fact = 1 / self.factor / 2
+            x = px * fact
+            y = py * fact
 
         verts = ((-x, -y, 0.0),
                  (+x, -y, 0.0),
@@ -433,7 +452,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
                 if is_image_fn(fn.name, self.extension)), self.directory
 
     # Internal
-    def create_image_textures(self, image):
+    def create_image_textures(self, context, image):
         fn_full = os.path.normpath(bpy.path.abspath(image.filepath))
 
         # look for texture with importsettings
@@ -443,14 +462,14 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
                 if (tex_img is not None) and (tex_img.library is None):
                     fn_tex_full = os.path.normpath(bpy.path.abspath(tex_img.filepath))
                     if fn_full == fn_tex_full:
-                        self.set_texture_options(texture)
+                        self.set_texture_options(context, texture)
                         return texture
 
         # if no texture is found: create one
         name_compat = bpy.path.display_name_from_filepath(image.filepath)
         texture = bpy.data.textures.new(name=name_compat, type='IMAGE')
         texture.image = image
-        self.set_texture_options(texture)
+        self.set_texture_options(context, texture)
         return texture
 
     def create_material_for_texture(self, texture):
@@ -477,12 +496,13 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
         if self.relative:
             image.filepath = bpy.path.relpath(image.filepath)
 
-    def set_texture_options(self, texture):
+    def set_texture_options(self, context, texture):
         texture.use_alpha = self.use_transparency
         texture.image_user.use_auto_refresh = self.use_auto_refresh
         if self.match_len:
-            ctx = {"edit_image": texture.image,
-                   "edit_image_user": texture.image_user,}
+            ctx = context.copy()
+            ctx["edit_image"] = texture.image
+            ctx["edit_image_user"] = texture.image_user
             bpy.ops.image.match_movie_length(ctx)
 
     def set_material_options(self, material, slot):
diff --git a/release/scripts/addons/io_import_scene_dxf.py b/release/scripts/addons/io_import_scene_dxf.py
index 87cdd51..f0cc671 100644
--- a/release/scripts/addons/io_import_scene_dxf.py
+++ b/release/scripts/addons/io_import_scene_dxf.py
@@ -2376,7 +2376,7 @@ def removeDoubles(ob):
         scn = bpy.context.scene
         scn.objects.active = ob
         bpy.ops.object.mode_set(mode='EDIT')
-        bpy.ops.mesh.remove_doubles(mergedist=theMergeLimit)
+        bpy.ops.mesh.remove_doubles(threshold=theMergeLimit)
         bpy.ops.object.mode_set(mode='OBJECT')
 
 
diff --git a/release/scripts/addons/io_import_scene_lwo.py b/release/scripts/addons/io_import_scene_lwo.py
index b019f5b..fac7ff9 100644
--- a/release/scripts/addons/io_import_scene_lwo.py
+++ b/release/scripts/addons/io_import_scene_lwo.py
@@ -1088,8 +1088,9 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
             print("Adding %d Vertex Color Maps" % len(layer_data.colmaps))
             for cmap_key in layer_data.colmaps:
                 map_pack= create_mappack(layer_data, cmap_key, "COLOR")
-                vcol= me.vertex_colors.new(cmap_key)
-                if not vcol:
+                me.vertex_colors.new(cmap_key)
+                vcol= me.tessface_vertex_colors[-1]
+                if not vcol or not vcol.data:
                     break
                 for fi in map_pack:
                     if fi > len(vcol.data):
@@ -1109,10 +1110,9 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
             print("Adding %d UV Textures" % len(layer_data.uvmaps))
             for uvmap_key in layer_data.uvmaps:
                 map_pack= create_mappack(layer_data, uvmap_key, "UV")
-                uvm= me.uv_textures.new(name=uvmap_key)
-                uvloop = me.uv_layers[-1]
-                uvm = uvloop.data
-                if not uvm:
+                me.uv_textures.new(name=uvmap_key)
+                uvm= me.tessface_uv_textures[-1]
+                if not uvm or not uvm.data:
                     break
                 for fi in map_pack:
                     if fi > len(uvm.data):
diff --git a/release/scripts/addons/io_import_scene_mhx.py b/release/scripts/addons/io_import_scene_mhx.py
index 2d47b45..c1c9145 100644
--- a/release/scripts/addons/io_import_scene_mhx.py
+++ b/release/scripts/addons/io_import_scene_mhx.py
@@ -26,7 +26,7 @@
 """
 Abstract
 MHX (MakeHuman eXchange format) importer for Blender 2.5x.
-Version 1.13.2
+Version 1.14.0
 
 This script should be distributed with Blender.
 If not, place it in the .blender/scripts/addons dir
@@ -39,8 +39,8 @@ Alternatively, run the script in the script editor (Alt-P), and access from the
 bl_info = {
     'name': 'Import: MakeHuman (.mhx)',
     'author': 'Thomas Larsson',
-    'version': (1, 13, 2),
-    "blender": (2, 6, 3),
+    'version': (1, 14, 1),
+    "blender": (2, 6, 4),
     'location': "File > Import > MakeHuman (.mhx)",
     'description': 'Import files in the MakeHuman eXchange format (.mhx)',
     'warning': '',
@@ -50,8 +50,9 @@ bl_info = {
     'category': 'Import-Export'}
 
 MAJOR_VERSION = 1
-MINOR_VERSION = 13
-SUB_VERSION = 2
+MINOR_VERSION = 14
+FROM_VERSION = 13
+SUB_VERSION = 1
 
 #
 #
@@ -117,8 +118,11 @@ T_Rigify = 0x1000
 T_Opcns = 0x2000
 T_Symm = 0x4000
 
-toggle = ( T_EnforceVersion + T_Mesh + T_Armature + 
+DefaultToggle = ( T_EnforceVersion + T_Mesh + T_Armature + 
     T_Shapekeys + T_ShapeDrivers + T_Proxy + T_Clothes + T_Rigify )
+    
+toggle = DefaultToggle
+toggleSettings = toggle
 
 #
 #    Dictionaries
@@ -197,10 +201,13 @@ Plural = {
 #
 
 def readMhxFile(filePath):
-    global todo, nErrors, theScale, defaultScale, One, toggle, warnedVersion, theMessage
+    global todo, nErrors, theScale, theArmature, defaultScale, One
+    global toggle, warnedVersion, theMessage, alpha7
 
     defaultScale = theScale
     One = 1.0/theScale
+    theArmature = None
+    alpha7 = False
     warnedVersion = False
     initLoadedData()
     theMessage = ""
@@ -280,7 +287,7 @@ def readMhxFile(filePath):
 
     if level != 0:
         MyError("Tokenizer out of kilter %d" % level)    
-    clearScene()
+    scn = clearScene()
     print( "Parsing" )
     parse(tokens)
     
@@ -294,6 +301,10 @@ def readMhxFile(filePath):
             nErrors += 1
             #MyError(msg)
 
+    scn.objects.active = theArmature
+    theArmature.MhAlpha8 = not alpha7
+    #bpy.ops.wm.properties_edit(data_path="object", property="MhxRig", value=theArmature["MhxRig"])
+        
     time2 = time.clock()
     print("toggle = %x" % toggle)
     msg = "File %s loaded in %g s" % (fileName, time2-time1)
@@ -322,7 +333,7 @@ def getObject(name, var, glbals, lcals):
 def checkMhxVersion(major, minor):
     global warnedVersion
     print("MHX", (major,minor), (MAJOR_VERSION, MINOR_VERSION), warnedVersion)
-    if  major != MAJOR_VERSION or minor != MINOR_VERSION:
+    if  major != MAJOR_VERSION or minor < FROM_VERSION:
         if warnedVersion:
             return
         else:
@@ -330,7 +341,7 @@ def checkMhxVersion(major, minor):
 "Wrong MHX version\n" +
 "Expected MHX %d.%02d but the loaded file " % (MAJOR_VERSION, MINOR_VERSION) +
 "has version MHX %d.%02d\n" % (major, minor))
-            if minor < MINOR_VERSION:
+            if minor < FROM_VERSION:
                 msg += (
 "You can disable this error message by deselecting the \n" +
 "Enforce version option when importing. Better:\n" +
@@ -743,7 +754,14 @@ def parseDriverTarget(var, nTarget, rna, args, tokens):
     targ.id = loadedData[dtype][name]
     #print("    ->", targ.id)
     for (key, val, sub) in tokens:
-        defaultKey(key, val, sub, 'targ', [], globals(), locals())
+        if key == 'data_path':
+            words = val[0].split('"')
+            if len(words) > 1:
+                targ.data_path = propNames(words[1])[1]
+            else:
+                targ.data_path = propNames(val)[1]
+        else:
+            defaultKey(key, val, sub, 'targ', [], globals(), locals())
     return targ
 
     
@@ -1493,10 +1511,29 @@ def parseShapeKeys(ob, me, args, tokens):
         elif key == 'AnimationData':
             if me.shape_keys:
                 parseAnimationData(me.shape_keys, val, sub)
+        elif key == 'Expression':
+            prop = "Mhe" + val[0].capitalize()
+            parseUnits(prop, ob, sub)
+        elif key == 'Viseme':
+            name = val[0].upper()
+            if name in ["REST", "ETC"]:
+                name = name.capitalize()
+            prop = "Mhv" + name
+            parseUnits(prop, ob, sub)            
     ob.active_shape_key_index = 0
     print("Shapekeys parsed")
     return
 
+            
+def parseUnits(prop, ob, sub):
+    string = ""
+    for words in sub:
+        unit = words[0].replace("-","_")
+        value = words[1][0]
+        string += "%s:%s;" % (unit, value)
+    rig = ob.parent
+    rig[prop] = string
+
 
 def parseShapeKey(ob, me, args, tokens):
     if verbosity > 2:
@@ -1542,7 +1579,7 @@ def addShapeKey(ob, name, vgroup, tokens):
 #
 
 def parseArmature (args, tokens):
-    global toggle
+    global toggle, theArmature
     if verbosity > 2:
         print( "Parsing armature %s" % args )
     
@@ -1551,10 +1588,9 @@ def parseArmature (args, tokens):
     mode = args[2]
     
     amt = bpy.data.armatures.new(amtname)
-    ob = createObject('ARMATURE', obname, amt, amtname)    
-
-    linkObject(ob, amt)
-    print("Linked")
+    ob = createObject('ARMATURE', obname, amt, amtname) 
+    linkObject(ob, amt)    
+    theArmature = ob
 
     bpy.ops.object.mode_set(mode='OBJECT')
     bpy.ops.object.mode_set(mode='EDIT')
@@ -1586,6 +1622,7 @@ def parseArmature (args, tokens):
         else:
             defaultKey(key, val,  sub, "amt", ['MetaRig'], globals(), locals())
     bpy.ops.object.mode_set(mode='OBJECT')
+    
     return amt
         
 #
@@ -1746,7 +1783,7 @@ def parseConstraint(constraints, pb, args, tokens):
         elif key == 'rot_lock':
             parseArray(cns, ["lock_rotation_x", "lock_rotation_y", "lock_rotation_z"], val)
         else:
-            defaultKey(key, val,  sub, "cns", [], globals(), locals())
+            defaultKey(key, val,  sub, "cns", ["use_target"], globals(), locals())
 
 
     #print("cns %s done" % cns.name)
@@ -2109,36 +2146,110 @@ def deleteDiamonds(ob):
 #    defaultKey(ext, args, tokens, var, exclude, glbals, lcals):
 #
 
-thePropTip = ""
+theProperty = None
+
+def propNames(string):
+    global alpha7
+    # Alpha 7 compatibility
+    if string[0:2] == "&_":
+        string = "Mhf"+string[2:]
+        alpha7 = True
+    elif string[0] == "&":
+        string = "Mha"+string[1:]
+        alpha7 = True
+    elif string[0] == "*":
+        string = "Mhs"+string[1:]
+        alpha7 = True
+    elif string.startswith("Hide"):
+        string = "Mhh"+string[4:]
+        alpha7 = True
+    
+    if string.startswith(("Mha", "Mhf", "Mhs", "Mhh", "Mhv", "Mhc")):
+        name = string.replace("-","_")
+        return name, '["%s"]' % name
+    elif string[0] == "_":
+        return None,None
+    else:
+        return string, '["%s"]' % string
+        
+
+def defProp(args, var, glbals, lcals):
+    proptype = args[0]
+    name = propNames(args[1])[0]
+    value = args[2]    
+    rest = 'description="%s"' % args[3].replace("_", " ")
+    if len(args) > 4:
+        rest += ", " + args[4]
+        
+    if name:
+        expr = 'bpy.types.Object.%s = %sProperty(%s)' % (name, proptype, rest)
+        print(expr)
+        exec(expr)
+        expr = '%s.%s = %s' % (var, name, value)
+        print(expr)
+        exec(expr, glbals, lcals)
+        
+
+def defNewProp(name, proptype, rest):
+    expr = 'bpy.types.Object.%s = %sProperty(%s)' % (name, proptype, rest)
+    print(expr)
+    exec(expr)
+
+        
+def setProperty(args, var, glbals, lcals):
+    global theProperty
+    tip = ""
+    name = propNames(args[0])[0]
+    value = args[1]
+    if name:
+        expr = '%s["%s"] = %s' % (var, name, value)
+        exec(expr, glbals, lcals)
+        print(expr)
+        
+        if len(args) > 2:
+            tip = 'description="%s"' % args[2].replace("_", " ")
+        if value in ["True", "False"]:
+            proptype = "Bool"
+        elif value[0] in ["'",'"']:
+            proptype = "String"
+        elif "." in value:
+            proptype = "Float"
+        else:
+            proptype = "Int"
+        theProperty = (name, tip, proptype)
+        #if proptype == "Int":
+        #    halt
+    return
+
+
+def defineProperty(args):
+    global theProperty
+    if theProperty is None:
+        return
+    (name, tip, proptype) = theProperty
+    if len(args) >= 2 and proptype != "Bool":
+        if "BOOLEAN" in args[1]:
+            proptype = "Bool"
+        else:
+            tip = tip + "," + args[1].replace(":", "=").replace('"', " ")
+    expr = "bpy.types.Object.%s = %sProperty(%s)" % (name, proptype, tip)
+    print(expr)
+    exec(expr)
+    if proptype == "Int":
+        halt
+    theProperty = None
+    return
+
 
 def defaultKey(ext, args, tokens, var, exclude, glbals, lcals):
-    global todo, thePropTip
+    global todo
 
     if ext == 'Property':
-        thePropTip = ""
-        try:
-            expr = '%s["%s"] = %s' % (var, args[0], args[1])
-        except:
-            expr = None
-        #print("Property", expr)
-        if expr:
-            exec(expr, glbals, lcals)
-            if len(args) > 2:
-                thePropTip =  '"description":"%s"' % args[2].replace("_", " ")
-        return
+        return setProperty(args, var, glbals, lcals)        
     elif ext == 'PropKeys':
-        if len(args) < 2:
-            values = '{%s}' % thePropTip
-        else:
-            values = '{%s%s}' % (args[1], thePropTip)        
-        try:
-            expr = '%s["_RNA_UI"]["%s"] = %s' % (var, args[0], values)
-        except:
-            expr = None
-        #print("PropKeys", expr)
-        if expr:
-            exec(expr, glbals, lcals)
-        return
+        return defineProperty(args)
+    elif ext == 'DefProp':
+        return defProp(args, var, glbals, lcals)
 
     if ext == 'bpyops':
         expr = "bpy.ops.%s" % args[0]
@@ -2455,7 +2566,7 @@ ConfigFile = '~/mhx_import.cfg'
 
 
 def readDefaults():
-    global toggle, theScale
+    global toggle, toggleSettings, theScale
     path = os.path.realpath(os.path.expanduser(ConfigFile))
     try:
         fp = open(path, 'rU')
@@ -2473,10 +2584,11 @@ def readDefaults():
             except:
                 print('Configuration file "%s" is corrupt' % path)                
     fp.close()
+    toggleSettings = toggle
     return
 
 def writeDefaults():
-    global toggle, theScale
+    global toggleSettings, theScale
     path = os.path.realpath(os.path.expanduser(ConfigFile))
     try:
         fp = open(path, 'w')
@@ -2484,7 +2596,7 @@ def writeDefaults():
     except:
         print('Cannot open "%s" for writing' % path)
         return
-    fp.write("%x %f Graphicall" % (toggle, theScale))
+    fp.write("%x %f Graphicall" % (toggleSettings, theScale))
     fp.close()
     return
 
@@ -2908,21 +3020,36 @@ class ImportMhx(bpy.types.Operator, ImportHelper):
     bl_region_type = "WINDOW"
     bl_options = {'UNDO'}
 
-    scale = FloatProperty(name="Scale", description="Default meter, decimeter = 1.0", default = theScale)
     filename_ext = ".mhx"
     filter_glob = StringProperty(default="*.mhx", options={'HIDDEN'})
     filepath = StringProperty(subtype='FILE_PATH')
-
+    
+    scale = FloatProperty(name="Scale", description="Default meter, decimeter = 1.0", default = theScale)
+    advanced = BoolProperty(name="Advanced settings", description="Use advanced import settings", default=False)
     for (prop, name, desc, flag) in MhxBoolProps:
-        expr = '%s = BoolProperty(name="%s", description="%s", default=toggle&%s)' % (prop, name, desc, flag)
+        expr = '%s = BoolProperty(name="%s", description="%s", default=toggleSettings&%s)' % (prop, name, desc, flag)
         exec(expr)
+    
+    
+    def draw(self, context):
+        layout = self.layout
+        layout.prop(self, "scale")
+        layout.prop(self, "advanced")
+        if self.advanced:
+            for (prop, name, desc, flag) in MhxBoolProps:
+                layout.prop(self, prop)
+
         
     def execute(self, context):
-        global toggle, theScale, MhxBoolProps
-        toggle = T_Armature
-        for (prop, name, desc, flag) in MhxBoolProps:
-            expr = '(%s if self.%s else 0)' % (flag, prop)
-            toggle |=  eval(expr)
+        global toggle, toggleSettings, theScale, MhxBoolProps
+        if not self.advanced:
+            toggle = DefaultToggle
+        else:
+            toggle = T_Armature
+            for (prop, name, desc, flag) in MhxBoolProps:
+                expr = '(%s if self.%s else 0)' % (flag, prop)
+                toggle |=  eval(expr)
+            toggleSettings = toggle
         print("execute flags %x" % toggle)
         theScale = self.scale
 
@@ -2932,9 +3059,12 @@ class ImportMhx(bpy.types.Operator, ImportHelper):
         except MhxError:
             print("Error when loading MHX file:\n" + theMessage)
 
-        writeDefaults()
+        if self.advanced:
+            writeDefaults()
+            self.advanced = False
         return {'FINISHED'}
 
+
     def invoke(self, context, event):
         global toggle, theScale, MhxBoolProps
         readDefaults()
@@ -3038,7 +3168,7 @@ stopStaringVisemes = ({
     'Blink' : [('PUpLid', (0,1.0)), ('PLoLid', (0,-1.0))], 
     'Unblink' : [('PUpLid', (0,0)), ('PLoLid', (0,0))], 
 })
-"""
+
 bodyLanguageVisemes = ({
     'Rest' : [
         ('MouthWidth_L', 0), 
@@ -3323,13 +3453,13 @@ class VIEW3D_OT_MhxMakeVisemesButton(bpy.types.Operator):
     def execute(self, context):
         makeVisemes(context.object, context.scene)
         return{'FINISHED'}    
-       
+"""       
 #
 #    mohoVisemes
 #    magpieVisemes
 #
 
-mohoVisemes = dict({
+MohoVisemes = dict({
     'rest' : 'Rest', 
     'etc' : 'Etc', 
     'AI' : 'AH', 
@@ -3342,16 +3472,16 @@ mohoVisemes = dict({
     'FV' : 'FV', 
 })
 
-magpieVisemes = dict({
-    "CONS" : "t,d,k,g,T,D,s,z,S,Z,h,n,N,j,r,tS", 
-    "AI" : "i,&,V,aU,I,0,@,aI", 
-    "E" : "eI,3,e", 
-    "O" : "O, at U,oI", 
-    "UW" : "U,u,w", 
-    "MBP" : "m,b,p", 
-    "L" : "l", 
-    "FV" : "f,v", 
-    "Sh" : "dZ", 
+MagpieVisemes = dict({
+    "CONS" : "Etc", 
+    "AI" : 'AH', 
+    "E" : "EH", 
+    "O" : "O", 
+    "UW" : "AH", 
+    "MBP" : "MBP", 
+    "L" : "L", 
+    "FV" : "FV", 
+    "Sh" : "SH", 
 })
 
 #
@@ -3359,7 +3489,7 @@ magpieVisemes = dict({
 #    setBoneLocation(context, pbone, loc, mirror, setKey, frame):
 #    class VIEW3D_OT_MhxVisemeButton(bpy.types.Operator):
 #
-
+"""
 def getVisemeSet(context, rig):
     try:
         visset = rig['MhxVisemeSet']
@@ -3373,7 +3503,7 @@ def getVisemeSet(context, rig):
         raise MhxError("Unknown viseme set %s" % visset)
 
 
-def setViseme(context, vis, setKey, frame):
+def setVisemeAlpha7(context, vis, visemes, setKey, frame):
     (rig, mesh) = getMhxRigMesh(context.object)
     isPanel = False
     isProp = False
@@ -3387,7 +3517,7 @@ def setViseme(context, vis, setKey, frame):
             isProp = True
     elif mesh:
         shapekeys = mesh.data.shape_keys.key_blocks
-    visemes = getVisemeSet(context, rig)
+
     for (skey, value) in visemes[vis]:
         if isPanel:
             (b, (x,z)) = VisemePanelBones[skey]
@@ -3398,7 +3528,7 @@ def setViseme(context, vis, setKey, frame):
                 for n in range(3):
                     pb.keyframe_insert('location', index=n, frame=frame, group=pb.name)
         elif isProp:
-            skey = '&_' + skey
+            skey = 'Mhf' + skey
             try:
                 prop = rig[skey]
             except:
@@ -3415,7 +3545,7 @@ def setViseme(context, vis, setKey, frame):
                 shapekeys[skey].keyframe_insert("value", frame=frame)            
     updatePose(context)
     return
-    
+
 
 class VIEW3D_OT_MhxVisemeButton(bpy.types.Operator):
     bl_idname = 'mhx.pose_viseme'
@@ -3424,107 +3554,76 @@ class VIEW3D_OT_MhxVisemeButton(bpy.types.Operator):
     viseme = StringProperty()
 
     def invoke(self, context, event):
-        setViseme(context, self.viseme, False, context.scene.frame_current)
+        (rig, mesh) = getMhxRigMesh(context.object)
+        visemes = getVisemeSet(context, rig)
+        setVisemeAlpha7(context, self.viseme, visemes, False, context.scene.frame_current)
         return{'FINISHED'}
 
+"""
 
 
-#
-#    openFile(context, filepath):
-#    readMoho(context, filepath, offs):
-#    readMagpie(context, filepath, offs):
-#
-
-def openFile(context, filepath):
-    (path, fileName) = os.path.split(filepath)
-    (name, ext) = os.path.splitext(fileName)
-    return open(filepath, "rU")
-
-def readMoho(context, filepath, offs):
+def readLipsync(context, filepath, offs, struct):
     (rig, mesh) = getMhxRigMesh(context.object)
+    if rig.MhAlpha8:
+        props = getProps(rig, "Mhv")
+        visemes = {}
+        oldKeys = []
+        for prop in props:
+            dummy,units = getUnitsFromString("x;"+rig[prop])
+            visemes[prop] = units
+        props = getProps(rig, "Mhsmouth")
+        auto = context.tool_settings.use_keyframe_insert_auto
+        auto = True
+        factor = rig.MhxStrength
+        shapekeys = getMhmShapekeys(rig, mesh)        
+    else:
+        visemes = getVisemeSet(context, rig)    
     context.scene.objects.active = rig
     bpy.ops.object.mode_set(mode='POSE')    
-    fp = openFile(context, filepath)        
+    
+    fp = open(filepath, "rU")
     for line in fp:
         words= line.split()
         if len(words) < 2:
-            pass
+            continue
         else:
-            vis = mohoVisemes[words[1]]
-            setViseme(context, vis, True, int(words[0])+offs)
-    fp.close()
-    setInterpolation(rig)
-    updatePose(context)
-    print("Moho file %s loaded" % filepath)
-    return
-
-def readMagpie(context, filepath, offs):
-    rig,mesh = getMhxRigMesh(context.object)
-    context.scene.objects.active = rig
-    bpy.ops.object.mode_set(mode='POSE')    
-    fp = openFile(context, filepath)        
-    for line in fp: 
-        words= line.split()
-        if len(words) < 3:
-            pass
-        elif words[2] == 'X':
-            vis = magpieVisemes[words[3]]
-            setViseme(context, vis, True, int(words[0])+offs)
+            vis = "Mhv" + struct[words[1]]
+            frame = int(words[0])+offs
+        if rig.MhAlpha8:
+            setMhmProps(rig, shapekeys, "Mhsmouth", visemes[vis], factor, auto, frame)
+        else:
+            setVisemeAlpha7(context, vis, visemes, True, frame)
     fp.close()
-    setInterpolation(rig)
+    
+    #setInterpolation(rig)
     updatePose(context)
-    print("Magpie file %s loaded" % filepath)
-    return
+    print("Lipsync file %s loaded" % filepath)
 
-# 
-#    class VIEW3D_OT_MhxLoadMohoButton(bpy.types.Operator):
-#
 
-class VIEW3D_OT_MhxLoadMohoButton(bpy.types.Operator):
+class VIEW3D_OT_MhxMohoButton(bpy.types.Operator, ImportHelper):
     bl_idname = "mhx.pose_load_moho"
-    bl_label = "Moho (.dat)"
+    bl_label = "Load Moho (.dat)"
     bl_options = {'UNDO'}
-    filepath = StringProperty(subtype='FILE_PATH')
-    startFrame = IntProperty(name="Start frame", description="First frame to import", default=1)
-
-    def execute(self, context):
-        import bpy, os, mathutils
-        readMoho(context, self.properties.filepath, self.properties.startFrame-1)        
-        return{'FINISHED'}    
-
-    def invoke(self, context, event):
-        context.window_manager.fileselect_add(self)
-        return {'RUNNING_MODAL'}    
-
-#
-#    class VIEW3D_OT_MhxLoadMagpieButton(bpy.types.Operator):
-#
-
-class VIEW3D_OT_MhxLoadMagpieButton(bpy.types.Operator):
-    bl_idname = "mhx.pose_load_magpie"
-    bl_label = "Magpie (.mag)"
-    filepath = StringProperty(subtype='FILE_PATH')
-    startFrame = IntProperty(name="Start frame", description="First frame to import", default=1)
+    
+    filename_ext = ".dat"
+    filter_glob = StringProperty(default="*.dat", options={'HIDDEN'})
+    filepath = StringProperty(subtype='FILE_PATH')    
 
-    def execute(self, context):
-        import bpy, os, mathutils
-        readMagpie(context, self.properties.filepath, self.properties.startFrame-1)        
+    def execute(self, context):        
+        readLipsync(context, self.properties.filepath, context.scene.frame_start - 1, MohoVisemes)        
         return{'FINISHED'}    
 
     def invoke(self, context, event):
         context.window_manager.fileselect_add(self)
         return {'RUNNING_MODAL'}    
 
-#
-#    class MhxLipsyncPanel(bpy.types.Panel):
-#
 
 class MhxLipsyncPanel(bpy.types.Panel):
     bl_label = "MHX Lipsync"
     bl_space_type = "VIEW_3D"
     bl_region_type = "UI"
     bl_options = {'DEFAULT_CLOSED'}
-    
+
     @classmethod
     def poll(cls, context):
         return pollMhx(context.object)
@@ -3532,28 +3631,54 @@ class MhxLipsyncPanel(bpy.types.Panel):
     def draw(self, context):
         rig,mesh = getMhxRigMesh(context.object)
         if not rig:
+            layout.label("No MHX rig found")
             return
-
         layout = self.layout        
-        layout.label(text="Visemes")
-        for (vis1, vis2, vis3) in VisemeList:
+        
+        if rig.MhAlpha8:
+            visemes = getProps(rig, "Mhv")
+            if not visemes:
+                layout.label("No visemes found")
+                return
+            
+            layout.operator("mhx.pose_reset_expressions", text="Reset visemes").prefix="Mhsmouth"
+            layout.operator("mhx.pose_key_expressions", text="Key visemes").prefix="Mhsmouth"
+            layout.prop(rig, "MhxStrength")
+            layout.separator()
+            n = 0
+            for prop in visemes:
+                if n % 3 == 0:
+                    row = layout.row()
+                    n = 0
+                row.operator("mhx.pose_mhm", text=prop[3:]).data="Mhsmouth;"+rig[prop]        
+                n += 1
+            while n % 3 != 0:
+                row.label("")
+                n += 1
+            layout.separator()
+            row = layout.row()
+            row.operator("mhx.pose_mhm", text="Blink").data="Mhsmouth;eye_left_closure:1;eye_right_closure:1"        
+            row.operator("mhx.pose_mhm", text="Unblink").data="Mhsmouth;eye_left_closure:0;eye_right_closure:0"        
+        else:   
+            layout.label("Lipsync disabled for alpha7 mhx files")
+            return
+            for (vis1, vis2, vis3) in VisemeList:
+                row = layout.row()
+                row.operator("mhx.pose_viseme", text=vis1).viseme = vis1
+                row.operator("mhx.pose_viseme", text=vis2).viseme = vis2
+                row.operator("mhx.pose_viseme", text=vis3).viseme = vis3
+            layout.separator()
             row = layout.row()
-            row.operator("mhx.pose_viseme", text=vis1).viseme = vis1
-            row.operator("mhx.pose_viseme", text=vis2).viseme = vis2
-            row.operator("mhx.pose_viseme", text=vis3).viseme = vis3
+            row.operator("mhx.pose_viseme", text="Blink").viseme = 'Blink'
+            row.operator("mhx.pose_viseme", text="Unblink").viseme = 'Unblink'
+            layout.separator()
+            layout.operator("mhx.make_visemes")
+            
         layout.separator()
         row = layout.row()
-        row.operator("mhx.pose_viseme", text="Blink").viseme = 'Blink'
-        row.operator("mhx.pose_viseme", text="Unblink").viseme = 'Unblink'
-        layout.label(text="Load file")
-        row = layout.row()
         row.operator("mhx.pose_load_moho")
-        row.operator("mhx.pose_load_magpie")
-        layout.operator("mhx.update")
-        layout.separator()
-        layout.operator("mhx.make_visemes")
-        return
-        
+        #layout.operator("mhx.update")
+
 #
 #   updatePose(context):
 #   class VIEW3D_OT_MhxUpdateButton(bpy.types.Operator):
@@ -3577,91 +3702,147 @@ class VIEW3D_OT_MhxUpdateButton(bpy.types.Operator):
 
 ###################################################################################    
 #
-#    Expression panel
+#    Expression panels
 #
 ###################################################################################    
-#
-#    class VIEW3D_OT_MhxResetExpressionsButton(bpy.types.Operator):
-#
 
 class VIEW3D_OT_MhxResetExpressionsButton(bpy.types.Operator):
     bl_idname = "mhx.pose_reset_expressions"
     bl_label = "Reset expressions"
     bl_options = {'UNDO'}
+    prefix = StringProperty()
 
     def execute(self, context):
         rig,mesh = getMhxRigMesh(context.object)
-        props = getShapeProps(rig)
-        for (prop, name) in props:
-            rig[prop] = 0.0
+        shapekeys = getMhmShapekeys(rig, mesh)
+        clearMhmProps(rig, shapekeys, self.prefix, context.tool_settings.use_keyframe_insert_auto, context.scene.frame_current)
         updatePose(context)
         return{'FINISHED'}    
 
-#
-#    class VIEW3D_OT_MhxKeyExpressionButton(bpy.types.Operator):
-#
 
 class VIEW3D_OT_MhxKeyExpressionsButton(bpy.types.Operator):
     bl_idname = "mhx.pose_key_expressions"
     bl_label = "Key expressions"
     bl_options = {'UNDO'}
+    prefix = StringProperty()
 
     def execute(self, context):
         rig,mesh = getMhxRigMesh(context.object)
-        props = getShapeProps(rig)
+        props = getProps(rig, self.prefix)
         frame = context.scene.frame_current
-        for (prop, name) in props:
-            rig.keyframe_insert('["%s"]' % prop, frame=frame)
+        for prop in props:
+            rig.keyframe_insert(prop, frame=frame)
         updatePose(context)
-        return{'FINISHED'}    
-#
-#    class VIEW3D_OT_MhxPinExpressionButton(bpy.types.Operator):
-#
+        return{'FINISHED'}   
+        
 
 class VIEW3D_OT_MhxPinExpressionButton(bpy.types.Operator):
     bl_idname = "mhx.pose_pin_expression"
     bl_label = "Pin"
     bl_options = {'UNDO'}
-    expression = StringProperty()
+    data = StringProperty()
 
     def execute(self, context):
         rig,mesh = getMhxRigMesh(context.object)
-        props = getShapeProps(rig)
+        words = self.data.split(";")
+        prefix = words[0]
+        expression = words[1]
+        
+        props = getProps(rig, prefix)
         if context.tool_settings.use_keyframe_insert_auto:
             frame = context.scene.frame_current
-            for (prop, name) in props:
+            for prop in props:
                 old = rig[prop]
-                if prop == self.expression:
+                if prop == expression:
                     rig[prop] = 1.0
                 else:
                     rig[prop] = 0.0
                 if abs(rig[prop] - old) > 1e-3:
-                    rig.keyframe_insert('["%s"]' % prop, frame=frame)
+                    rig.keyframe_insert(prop, frame=frame)
         else:                    
-            for (prop, name) in props:
-                if prop == self.expression:
+            for prop in props:
+                if prop == expression:
                     rig[prop] = 1.0
                 else:
                     rig[prop] = 0.0
         updatePose(context)
         return{'FINISHED'}    
 
-#
-#   getShapeProps(ob):        
-#
 
-def getShapeProps(rig):
-    props = []        
-    plist = list(rig.keys())
-    plist.sort()
-    for prop in plist:
-        if prop[0] == '*':
-            props.append((prop, prop[1:]))
-    return props                
+def getMhmShapekeys(rig, mesh):
+    if rig.MhxShapekeyDrivers:
+        return None
+    else:
+        return mesh.data.shape_keys.key_blocks
+    
+
+def setMhmProps(rig, shapekeys, prefix, units, factor, auto, frame):
+    clearMhmProps(rig, shapekeys, prefix, auto, frame)
+    for (prop, value) in units:
+        if shapekeys:
+            skey = prop[3:].replace("_","-")
+            shapekeys[skey].value = factor*value
+            if auto:
+                shapekeys[skey].keyframe_insert("value", frame=frame)            
+        else:
+            rig[prop] = factor*value
+            if auto:
+                rig.keyframe_insert(prop, frame=frame)    
+    
+    
+def clearMhmProps(rig, shapekeys, prefix, auto, frame):
+    props = getProps(rig, prefix)
+    for prop in props:
+        if shapekeys:
+            skey = prop[3:].replace("_","-")
+            shapekeys[skey].value = 0.0
+            if auto:
+                shapekeys[skey].keyframe_insert("value", frame=frame)            
+        else:
+            rig[prop] = 0.0
+            if auto:
+                rig.keyframe_insert(prop, frame=frame)   
+
+
+def getUnitsFromString(string):    
+    words = string.split(";")
+    prefix = words[0]
+    units = []
+    for word in words[1:]:
+        if word == "":
+            continue
+        unit = word.split(":") 
+        prop = "Mhs" + unit[0]
+        value = float(unit[1])
+        units.append((prop, value))
+    return prefix,units            
+            
+
+class VIEW3D_OT_MhxMhmButton(bpy.types.Operator):
+    bl_idname = "mhx.pose_mhm"
+    bl_label = "Mhm"
+    bl_options = {'UNDO'}
+    data = StringProperty()
+
+    def execute(self, context):   
+        rig,mesh = getMhxRigMesh(context.object)
+        auto = context.tool_settings.use_keyframe_insert_auto
+        frame = context.scene.frame_current
+        shapekeys = getMhmShapekeys(rig, mesh)
+        prefix,units = getUnitsFromString(self.data)        
+        setMhmProps(rig, shapekeys, prefix, units, rig.MhxStrength, auto, frame)
+        updatePose(context)
+        return{'FINISHED'}  
+                
+                
+def getProps(rig, prefix):
+    props = []
+    for prop in rig.keys():
+        if prop.startswith(prefix):
+            props.append(prop)
+    props.sort()            
+    return props
 
-#
-#    class MhxExpressionsPanel(bpy.types.Panel):
-#
 
 class MhxExpressionsPanel(bpy.types.Panel):
     bl_label = "MHX Expressions"
@@ -3677,25 +3858,75 @@ class MhxExpressionsPanel(bpy.types.Panel):
         layout = self.layout
         rig,mesh = getMhxRigMesh(context.object)
         if not rig:
-            print("No MHX rig found")
+            layout.label("No MHX rig found")
             return
-        if not rig.MhxShapekeyDrivers:
-            layout.label("No shapekey drivers.")
-            layout.label("Set expression values in mesh context instead")
+        exprs = getProps(rig, "Mhe")
+        if not exprs:
+            layout.label("No expressions found")
             return
-        props = getShapeProps(rig)
-        if not props:
-            return
-        layout.label(text="Expressions")
-        layout.operator("mhx.pose_reset_expressions")
-        layout.operator("mhx.pose_key_expressions")
-        #layout.operator("mhx.update")
+            
+        layout.operator("mhx.pose_reset_expressions").prefix="Mhs"
+        layout.operator("mhx.pose_key_expressions").prefix="Mhs"
+        layout.prop(rig, "MhxStrength")
         layout.separator()
-        for (prop, name) in props:
-            row = layout.split(0.85)
-            row.prop(rig, '["%s"]' % prop, text=name)
-            row.operator("mhx.pose_pin_expression", text="", icon='UNPINNED').expression = prop
+        for prop in exprs:
+            layout.operator("mhx.pose_mhm", text=prop[3:]).data="Mhs;"+rig[prop]
+
+
+def drawShapePanel(self, context, prefix, name):
+    layout = self.layout
+    rig,mesh = getMhxRigMesh(context.object)
+    if not rig:
+        print("No MHX rig found")
+        return
+    if not rig.MhxShapekeyDrivers:
+        layout.label("No shapekey drivers.")
+        layout.label("Set %s values in mesh context instead" % name)
         return
+    props = getProps(rig, prefix)
+    if not props:
+        layout.label("No %ss found" % name)
+        return
+        
+    layout.operator("mhx.pose_reset_expressions", text="Reset %ss" % name).prefix=prefix
+    layout.operator("mhx.pose_key_expressions", text="Reset %ss" % name).prefix=prefix
+    #layout.operator("mhx.update")
+
+    layout.separator()
+    for prop in props:
+        row = layout.split(0.85)
+        row.prop(rig, '["%s"]' % prop, text=prop[3:])
+        row.operator("mhx.pose_pin_expression", text="", icon='UNPINNED').data = (prefix + ";" + prop)
+    return
+
+
+class MhxExpressionUnitsPanel(bpy.types.Panel):
+    bl_label = "MHX Expression Units"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "UI"
+    bl_options = {'DEFAULT_CLOSED'}
+    
+    @classmethod
+    def poll(cls, context):
+        return pollMhx(context.object)
+
+    def draw(self, context):
+        drawShapePanel(self, context, "Mhs", "expression")
+
+
+class MhxCustomShapePanel(bpy.types.Panel):
+    bl_label = "MHX Custom Shapes"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "UI"
+    bl_options = {'DEFAULT_CLOSED'}
+    
+    @classmethod
+    def poll(cls, context):
+        return pollMhx(context.object)
+
+    def draw(self, context):
+        drawShapePanel(self, context, "Mhc", "custom shape")
+
 
 #########################################
 #
@@ -3791,7 +4022,7 @@ def fk2ikArm(context, suffix):
     matchPoseRotation(loarmFk, loarmFk, auto)
     matchPoseScale(loarmFk, loarmFk, auto)
 
-    if rig["&HandFollowsWrist" + suffix]:
+    if rig["MhaHandFollowsWrist" + suffix]:
         matchPoseRotation(handFk, wrist, auto)
         matchPoseScale(handFk, wrist, auto)
     return
@@ -3805,8 +4036,8 @@ def ik2fkArm(context, suffix):
     (uparmIk, loarmIk, elbow, elbowPt, wrist) = getSnapBones(rig, "ArmIK", suffix)
     (uparmFk, loarmFk, elbowPtFk, handFk) = getSnapBones(rig, "ArmFK", suffix)
 
-    #rig["&ElbowFollowsShoulder" + suffix] = False
-    #rig["&ElbowFollowsWrist" + suffix] = False
+    #rig["MhaElbowFollowsShoulder" + suffix] = False
+    #rig["MhaElbowFollowsWrist" + suffix] = False
     
     matchPoseTranslation(wrist, handFk, auto)
     matchPoseRotation(wrist, handFk, auto)  
@@ -3839,10 +4070,10 @@ def ik2fkLeg(context, suffix):
     (uplegIk, lolegIk, kneePt, ankleIk, legIk, legFk, footIk, toeIk) = getSnapBones(rig, "LegIK", suffix)
     (uplegFk, lolegFk, kneePtFk, footFk, toeFk) = getSnapBones(rig, "LegFK", suffix)
 
-    #rig["&KneeFollowsHip" + suffix] = False
-    #rig["&KneeFollowsFoot" + suffix] = False
+    #rig["MhaKneeFollowsHip" + suffix] = False
+    #rig["MhaKneeFollowsFoot" + suffix] = False
     
-    legIkToAnkle = rig["&LegIkToAnkle" + suffix]
+    legIkToAnkle = rig["MhaLegIkToAnkle" + suffix]
     if legIkToAnkle:
         matchPoseTranslation(ankleIk, footFk, auto)
     matchPoseTranslation(legIk, legFk, auto)
@@ -3963,9 +4194,9 @@ class VIEW3D_OT_MhxSnapFk2IkButton(bpy.types.Operator):
         bpy.ops.object.mode_set(mode='POSE')
         rig = context.object
         (prop, old) = setSnapProp(rig, self.data, 1.0, context, False)
-        if prop[:4] == "&Arm":
+        if prop[:6] == "MhaArm":
             fk2ikArm(context, prop[-2:])
-        elif prop[:4] == "&Leg":
+        elif prop[:6] == "MhaLeg":
             fk2ikLeg(context, prop[-2:])
         restoreSnapProp(rig, prop, old, context)
         return{'FINISHED'}    
@@ -3981,9 +4212,9 @@ class VIEW3D_OT_MhxSnapIk2FkButton(bpy.types.Operator):
         bpy.ops.object.mode_set(mode='POSE')
         rig = context.object
         (prop, old) = setSnapProp(rig, self.data, 0.0, context, True)
-        if prop[:4] == "&Arm":
+        if prop[:6] == "MhaArm":
             ik2fkArm(context, prop[-2:])
-        elif prop[:4] == "&Leg":
+        elif prop[:6] == "MhaLeg":
             ik2fkLeg(context, prop[-2:])
         restoreSnapProp(rig, prop, old, context)
         return{'FINISHED'}    
@@ -4075,12 +4306,12 @@ class MhxFKIKPanel(bpy.types.Panel):
         layout.label("FK/IK switch")
         row = layout.row()
         row.label("Arm")
-        self.toggleButton(row, rig, "&ArmIk_L", " 3", " 2")
-        self.toggleButton(row, rig, "&ArmIk_R", " 19", " 18")
+        self.toggleButton(row, rig, "MhaArmIk_L", " 3", " 2")
+        self.toggleButton(row, rig, "MhaArmIk_R", " 19", " 18")
         row = layout.row()
         row.label("Leg")
-        self.toggleButton(row, rig, "&LegIk_L", " 5", " 4")
-        self.toggleButton(row, rig, "&LegIk_R", " 21", " 20")
+        self.toggleButton(row, rig, "MhaLegIk_L", " 5", " 4")
+        self.toggleButton(row, rig, "MhaLegIk_R", " 21", " 20")
         
         try:
             ok = (rig["MhxVersion"] >= 12)
@@ -4093,22 +4324,22 @@ class MhxFKIKPanel(bpy.types.Panel):
         layout.label("Snap Arm bones")
         row = layout.row()
         row.label("FK Arm")
-        row.operator("mhx.snap_fk_ik", text="Snap L FK Arm").data = "&ArmIk_L 2 3 12"
-        row.operator("mhx.snap_fk_ik", text="Snap R FK Arm").data = "&ArmIk_R 18 19 28"
+        row.operator("mhx.snap_fk_ik", text="Snap L FK Arm").data = "MhaArmIk_L 2 3 12"
+        row.operator("mhx.snap_fk_ik", text="Snap R FK Arm").data = "MhaArmIk_R 18 19 28"
         row = layout.row()
         row.label("IK Arm")
-        row.operator("mhx.snap_ik_fk", text="Snap L IK Arm").data = "&ArmIk_L 2 3 12"
-        row.operator("mhx.snap_ik_fk", text="Snap R IK Arm").data = "&ArmIk_R 18 19 28"
+        row.operator("mhx.snap_ik_fk", text="Snap L IK Arm").data = "MhaArmIk_L 2 3 12"
+        row.operator("mhx.snap_ik_fk", text="Snap R IK Arm").data = "MhaArmIk_R 18 19 28"
 
         layout.label("Snap Leg bones")
         row = layout.row()
         row.label("FK Leg")
-        row.operator("mhx.snap_fk_ik", text="Snap L FK Leg").data = "&LegIk_L 4 5 12"
-        row.operator("mhx.snap_fk_ik", text="Snap R FK Leg").data = "&LegIk_R 20 21 28"
+        row.operator("mhx.snap_fk_ik", text="Snap L FK Leg").data = "MhaLegIk_L 4 5 12"
+        row.operator("mhx.snap_fk_ik", text="Snap R FK Leg").data = "MhaLegIk_R 20 21 28"
         row = layout.row()
         row.label("IK Leg")
-        row.operator("mhx.snap_ik_fk", text="Snap L IK Leg").data = "&LegIk_L 4 5 12"
-        row.operator("mhx.snap_ik_fk", text="Snap R IK Leg").data = "&LegIk_R 20 21 28"
+        row.operator("mhx.snap_ik_fk", text="Snap L IK Leg").data = "MhaLegIk_L 4 5 12"
+        row.operator("mhx.snap_ik_fk", text="Snap R IK Leg").data = "MhaLegIk_R 20 21 28"
         """
         row = layout.row()
         row.label("Ankle")
@@ -4147,55 +4378,53 @@ class MhxDriversPanel(bpy.types.Panel):
         return (context.object and context.object.MhxRig)
 
     def draw(self, context):
-        lProps = []
-        rProps = []
+        lrProps = []
         props = []
-        lFaceProps = []
-        rFaceProps = []
+        lrFaceProps = []
         faceProps = []
         plist = list(context.object.keys())
         plist.sort()
         for prop in plist:
-            if prop[0] == '&':
-                prop1 = prop[1:]
-            else:
-                continue
-            if prop[-2:] == '_L':
-                if prop1[0] == '_':
-                    lFaceProps.append((prop, prop1[1:-2]))
-                else:
-                    lProps.append((prop, prop1[:-2]))
-            elif prop[-2:] == '_R':
-                if prop1[0] == '_':
-                    rFaceProps.append((prop, prop1[1:-2]))
-                else:
-                    rProps.append((prop, prop1[:-2]))
-            else:
-                if prop1[0] == '_':
-                    faceProps.append((prop, prop1[1:]))
-                else:
-                    props.append((prop, prop1))
+            if prop[0:3] == 'Mha':
+                if prop[-2:] == '_L':
+                    lrProps.append(prop[:-2])
+                elif prop[-2:] != '_R':
+                    props.append(prop)
+            elif prop[0:3] == 'Mhf':
+                if prop[-2:] == '_L':
+                    lrFaceProps.append(prop[:-2])
+                elif prop[-2:] != '_R':
+                    faceProps.append(prop)
+                    
         ob = context.object
         layout = self.layout
-        for (prop, pname) in props:
-            layout.prop(ob, '["%s"]' % prop, text=pname)
-        layout.label("Left")
-        for (prop, pname) in lProps:
-            layout.prop(ob, '["%s"]' % prop, text=pname)
-        layout.label("Right")
-        for (prop, pname) in rProps:
-            layout.prop(ob, '["%s"]' % prop, text=pname)
+        for prop in props:
+            layout.prop(ob, '["%s"]' % prop, text=prop[3:])
+
+        layout.separator()
+        row = layout.row()
+        row.label("Left")
+        row.label("Right")
+        for prop in lrProps:
+            row = layout.row()
+            row.prop(ob, '["%s"]' % (prop+"_L"), text=prop[3:])
+            row.prop(ob, '["%s"]' % (prop+"_R"), text=prop[3:])
+
         if faceProps:
             layout.separator()
             layout.label("Face shapes")
-            for (prop, pname) in faceProps:
-                layout.prop(ob, '["%s"]' % prop, text=pname)
-            layout.label("Left")
-            for (prop, pname) in lFaceProps:
-                layout.prop(ob, '["%s"]' % prop, text=pname)
-            layout.label("Right")
-            for (prop, pname) in rFaceProps:
-                layout.prop(ob, '["%s"]' % prop, text=pname)        
+            for prop in faceProps:
+                layout.prop(ob, '["%s"]' % prop, text=prop[3:])
+
+            layout.separator()
+            row = layout.row()
+            row.label("Left")
+            row.label("Right")
+            for prop in lrFaceProps:
+                row = layout.row()
+                row.prop(ob, '["%s"]' % (prop+"_L"), text=prop[3:])
+                row.prop(ob, '["%s"]' % (prop+"_R"), text=prop[3:])
+     
         return
 
 ###################################################################################    
@@ -4223,8 +4452,8 @@ class MhxVisibilityPanel(bpy.types.Panel):
         props = list(ob.keys())
         props.sort()
         for prop in props:
-            if prop[0:4] == "Hide": 
-                layout.prop(ob, '["%s"]' % prop)
+            if prop[0:3] == "Mhh": 
+                layout.prop(ob, '["%s"]' % prop, text="Hide %s" % prop[3:])
         layout.separator()
         layout.operator("mhx.update_textures")
         layout.separator()
@@ -4261,7 +4490,8 @@ class VIEW3D_OT_MhxAddHidersButton(bpy.types.Operator):
         rig = context.object
         for ob in context.scene.objects:
             if ob.select and ob != rig:
-                prop = "Hide%s" % ob.name        
+                prop = "Mhh%s" % ob.name        
+                defNewProp(prop, "Bool", "default=False")
                 rig[prop] = False        
                 addHider(ob, "hide", rig, prop)
                 addHider(ob, "hide_render", rig, prop)
@@ -4291,7 +4521,7 @@ class VIEW3D_OT_MhxRemoveHidersButton(bpy.types.Operator):
             if ob.select and ob != rig:
                 ob.driver_remove("hide")
                 ob.driver_remove("hide_render")
-                del rig["Hide%s" % ob.name]
+                del rig["Mhh%s" % ob.name]
         return{'FINISHED'}    
         
 ###################################################################################    
@@ -4456,10 +4686,16 @@ def menu_func(self, context):
     self.layout.operator(ImportMhx.bl_idname, text="MakeHuman (.mhx)...")
 
 def register():
+    bpy.types.Object.MhAlpha8 = BoolProperty(default=True)
     bpy.types.Object.MhxMesh = BoolProperty(default=False)
     bpy.types.Object.MhxRig = StringProperty(default="")
     bpy.types.Object.MhxRigify = BoolProperty(default=False)
     bpy.types.Object.MhxShapekeyDrivers = BoolProperty(default=True)
+    bpy.types.Object.MhxStrength = FloatProperty(
+        name = "Expression strength",
+        description = "Multiply expression with this factor",
+        default=1.0, min=-1.0, max=2.0
+        )
     bpy.utils.register_module(__name__)
     bpy.types.INFO_MT_file_import.append(menu_func)
 
diff --git a/release/scripts/addons/io_import_scene_unreal_psa_psk.py b/release/scripts/addons/io_import_scene_unreal_psa_psk.py
new file mode 100644
index 0000000..822f49e
--- /dev/null
+++ b/release/scripts/addons/io_import_scene_unreal_psa_psk.py
@@ -0,0 +1,1273 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+    "name": "Import Unreal Skeleton Mesh (.psk)/Animation Set (psa)",
+    "author": "Darknet, flufy3d, camg188",
+    "version": (2, 2),
+    "blender": (2, 6, 4),
+    "location": "File > Import > Skeleton Mesh (.psk)/Animation Set (psa)",
+    "description": "Import Skeleleton Mesh/Animation Data",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+        "Scripts/Import-Export/Unreal_psk_psa",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=21366",
+    "category": "Import-Export"}
+
+"""
+Version': '2.0' ported by Darknet
+
+Unreal Tournament PSK file to Blender mesh converter V1.0
+Author: D.M. Sturgeon (camg188 at the elYsium forum), ported by Darknet
+Imports a *psk file to a new mesh
+
+-No UV Texutre
+-No Weight
+-No Armature Bones
+-No Material ID
+-Export Text Log From Current Location File (Bool )
+"""
+
+import bpy
+import mathutils
+import math
+from mathutils import *
+from math import *
+from bpy.props import *
+from string import *
+from struct import *
+from math import *
+from bpy.props import *
+
+bpy.types.Scene.unrealbonesize = FloatProperty(
+    name="Bone Length",
+    description="Bone Length from head to tail distance",
+    default=1,min=0.001,max=1000)
+
+#output log in to txt file
+DEBUGLOG = False
+
+scale = 1.0
+bonesize = 1.0
+from bpy_extras.io_utils import unpack_list, unpack_face_list
+
+class md5_bone:
+    bone_index=0
+    name=""
+    bindpos=[]
+    bindmat=[]
+    origmat=[]
+    head=[]
+    tail=[]
+    scale = []
+    parent=""
+    parent_index=0
+    blenderbone=None
+    roll=0
+
+    def __init__(self):
+        self.bone_index=0
+        self.name=""
+        self.bindpos=[0.0]*3
+        self.scale=[0.0]*3
+        self.head=[0.0]*3
+        self.tail=[0.0]*3
+        self.bindmat=[None]*3  #is this how you initilize a 2d-array
+        for i in range(3): self.bindmat[i] = [0.0]*3
+        self.origmat=[None]*3  #is this how you initilize a 2d-array
+        for i in range(3): self.origmat[i] = [0.0]*3
+        self.parent=""
+        self.parent_index=0
+        self.blenderbone=None
+
+    def dump(self):
+        print ("bone index: ", self.bone_index)
+        print ("name: ", self.name)
+        print ("bind position: ", self.bindpos)
+        print ("bind translation matrix: ", self.bindmat)
+        print ("parent: ", self.parent)
+        print ("parent index: ", self.parent_index)
+        print ("blenderbone: ", self.blenderbone)
+        
+def getheadpos(pbone,bones):
+    pos_head = [0.0]*3
+
+    #pos = mathutils.Vector((x,y,z)) * pbone.origmat
+    pos = pbone.bindmat.to_translation()
+    
+    """
+    tmp_bone = pbone
+    while tmp_bone.name != tmp_bone.parent.name:
+        pos = pos * tmp_bone.parent.bindmat
+        tmp_bone = tmp_bone.parent
+    """
+    
+    pos_head[0] = pos.x
+    pos_head[1] = pos.y
+    pos_head[2] = pos.z
+    
+    return pos_head
+	
+def gettailpos(pbone,bones):
+    pos_tail = [0.0]*3
+    ischildfound = False
+    childbone = None
+    childbonelist = []
+    for bone in bones:
+        if bone.parent.name == pbone.name:
+            ischildfound = True
+            childbone = bone
+            childbonelist.append(bone)
+            
+    if ischildfound:
+        tmp_head = [0.0]*3
+        for bone in childbonelist:
+            tmp_head[0] += bone.head[0]
+            tmp_head[1] += bone.head[1]
+            tmp_head[2] += bone.head[2]
+        tmp_head[0] /= len(childbonelist)
+        tmp_head[1] /= len(childbonelist)
+        tmp_head[2] /= len(childbonelist)
+        return tmp_head
+    else:
+        tmp_len = 0.0
+        tmp_len += (pbone.head[0] - pbone.parent.head[0])**2
+        tmp_len += (pbone.head[1] - pbone.parent.head[1])**2
+        tmp_len += (pbone.head[2] - pbone.parent.head[2])**2
+        tmp_len = tmp_len**0.5 * 0.5
+        pos_tail[0] = pbone.head[0] + tmp_len * pbone.bindmat[0][0]
+        pos_tail[1] = pbone.head[1] + tmp_len * pbone.bindmat[1][0]
+        pos_tail[2] = pbone.head[2] + tmp_len * pbone.bindmat[2][0]
+
+        
+    return pos_tail
+
+def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
+    global DEBUGLOG
+    DEBUGLOG = bDebugLogPSK
+    print ("--------------------------------------------------")
+    print ("---------SCRIPT EXECUTING PYTHON IMPORTER---------")
+    print ("--------------------------------------------------")
+    print (" DEBUG Log:",bDebugLogPSK)
+    print ("Importing file: ", infile)
+    
+    pskfile = open(infile,'rb')
+    if (DEBUGLOG):
+        logpath = infile.replace(".psk", ".txt")
+        print("logpath:",logpath)
+        logf = open(logpath,'w')
+        
+    def printlog(strdata):
+        if (DEBUGLOG):
+            logf.write(strdata)
+    
+    objName = infile.split('\\')[-1].split('.')[0]
+    
+    me_ob = bpy.data.meshes.new(objName)
+    print("objName:",objName)
+    printlog(("New Mesh = " + me_ob.name + "\n"))
+    #read general header
+    indata = unpack('20s3i',pskfile.read(32))
+    #not using the general header at this time
+    #================================================================================================== 
+    # vertex point
+    #================================================================================================== 
+    #read the PNTS0000 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog(( "Nbr of PNTS0000 records: " + str(recCount) + "\n"))
+    counter = 0
+    verts = []
+    verts2 = []
+    while counter < recCount:
+        counter = counter + 1
+        indata = unpack('3f',pskfile.read(12))
+        #print(indata[0],indata[1],indata[2])
+        verts.extend([(indata[0],indata[1],indata[2])])
+        verts2.extend([(indata[0],indata[1],indata[2])])
+        #print([(indata[0],indata[1],indata[2])])
+        printlog(str(indata[0]) + "|" +str(indata[1]) + "|" +str(indata[2]) + "\n")
+        #Tmsh.vertices.append(NMesh.Vert(indata[0],indata[1],indata[2]))
+        
+    #================================================================================================== 
+    # UV
+    #================================================================================================== 
+    #read the VTXW0000 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog( "Nbr of VTXW0000 records: " + str(recCount)+ "\n")
+    counter = 0
+    UVCoords = []
+    #UVCoords record format = [index to PNTS, U coord, v coord]
+    printlog("[index to PNTS, U coord, v coord]\n");
+    while counter < recCount:
+        counter = counter + 1
+        indata = unpack('hhffhh',pskfile.read(16))
+        UVCoords.append([indata[0],indata[2],indata[3]])
+        printlog(str(indata[0]) + "|" +str(indata[2]) + "|" +str(indata[3])+"\n")
+        #print('mat index %i',indata(4))
+        #print([indata[0],indata[2],indata[3]])
+        #print([indata[1],indata[2],indata[3]])
+        
+    #================================================================================================== 
+    # Face
+    #================================================================================================== 
+    #read the FACE0000 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog( "Nbr of FACE0000 records: "+ str(recCount) + "\n")
+    #PSK FACE0000 fields: WdgIdx1|WdgIdx2|WdgIdx3|MatIdx|AuxMatIdx|SmthGrp
+    #associate MatIdx to an image, associate SmthGrp to a material
+    SGlist = []
+    counter = 0
+    faces = []
+    faceuv = []
+    facesmooth = []
+    #the psk values are: nWdgIdx1|WdgIdx2|WdgIdx3|MatIdx|AuxMatIdx|SmthGrp
+    printlog("nWdgIdx1|WdgIdx2|WdgIdx3|MatIdx|AuxMatIdx|SmthGrp \n")
+    while counter < recCount:
+        counter = counter + 1
+        indata = unpack('hhhbbi',pskfile.read(12))        
+        printlog(str(indata[0]) + "|" +str(indata[1]) + "|" +str(indata[2])+ "|" +str(indata[3])+ "|" +str(indata[4])+ "|" +str(indata[5]) + "\n")
+        #indata[0] = index of UVCoords
+        #UVCoords[indata[0]]=[index to PNTS, U coord, v coord]
+        #UVCoords[indata[0]][0] = index to PNTS
+        PNTSA = UVCoords[indata[2]][0]
+        PNTSB = UVCoords[indata[1]][0]
+        PNTSC = UVCoords[indata[0]][0]
+        #print(PNTSA,PNTSB,PNTSC) #face id vertex
+        #faces.extend([0,1,2,0])
+        faces.extend([(PNTSA,PNTSB,PNTSC,0)])
+        uv = []
+        u0 = UVCoords[indata[2]][1]
+        v0 = UVCoords[indata[2]][2]
+        uv.append([u0,1.0 - v0])
+        u1 = UVCoords[indata[1]][1]
+        v1 = UVCoords[indata[1]][2]
+        uv.append([u1,1.0 - v1])
+        u2 = UVCoords[indata[0]][1]
+        v2 = UVCoords[indata[0]][2]
+        uv.append([u2,1.0 - v2])
+        faceuv.append([uv,indata[3],indata[4],indata[5]])
+        
+        #print("material:",indata[3])
+        #print("UV: ",u0,v0)
+        #update the uv var of the last item in the Tmsh.faces list
+        # which is the face just added above
+        ##Tmsh.faces[-1].uv = [(u0,v0),(u1,v1),(u2,v2)]
+        #print("smooth:",indata[5])
+        #collect a list of the smoothing groups
+        facesmooth.append(indata[5])
+        #print(indata[5])
+        if SGlist.count(indata[5]) == 0:
+            SGlist.append(indata[5])
+            print("smooth:",indata[5])
+        #assign a material index to the face
+        #Tmsh.faces[-1].materialIndex = SGlist.index(indata[5])
+    printlog( "Using Materials to represent PSK Smoothing Groups...\n")
+    #==========
+    # skip something...
+    #==========
+    
+    #================================================================================================== 
+    # Material
+    #================================================================================================== 
+    ##
+    #read the MATT0000 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog("Nbr of MATT0000 records: " +  str(recCount) + "\n" )
+    printlog(" - Not importing any material data now. PSKs are texture wrapped! \n")
+    counter = 0
+    materialcount = 0
+    while counter < recCount:
+        counter = counter + 1
+        indata = unpack('64s6i',pskfile.read(88))
+        materialcount += 1
+        print("Material",counter)
+        print("Mat name %s",indata[0])
+
+    ##
+    
+    #================================================================================================== 
+    # Bones (Armature)
+    #================================================================================================== 
+    #read the REFSKEL0 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog( "Nbr of REFSKEL0 records: " + str(recCount) + "\n")
+    #REFSKEL0 fields - Name|Flgs|NumChld|PrntIdx|Qw|Qx|Qy|Qz|LocX|LocY|LocZ|Lngth|XSize|YSize|ZSize
+    
+    Bns = []
+    bone = []
+    
+    md5_bones = []
+    bni_dict = {}
+    #================================================================================================== 
+    # Bone Data 
+    #==================================================================================================
+    counter = 0
+    print ("---PRASE--BONES---")
+    printlog("Name|Flgs|NumChld|PrntIdx|Qx|Qy|Qz|Qw|LocX|LocY|LocZ|Lngth|XSize|YSize|ZSize\n")
+    while counter < recCount:
+        indata = unpack('64s3i11f',pskfile.read(120))
+        #print( "DATA",str(indata))
+        
+        bone.append(indata)
+        
+        createbone = md5_bone()
+        #temp_name = indata[0][:30]
+        temp_name = indata[0]
+        temp_name = bytes.decode(temp_name)
+        temp_name = temp_name.lstrip(" ")
+        temp_name = temp_name.rstrip(" ")
+        temp_name = temp_name.strip()
+        temp_name = temp_name.strip( bytes.decode(b'\x00'))
+        printlog(temp_name + "|" +str(indata[1]) + "|" +str(indata[2])+ "|" +str(indata[3])+ "|" +str(indata[4])+ "|" +str(indata[5]) + "|" +str(indata[6]) + "|" +str(indata[7]) + "|" +str(indata[8])+ "|" +str(indata[9])+ "|" +str(indata[10])+ "|" +str(indata[11]) + "|" +str(indata[12]) + "|" +str(indata[13]) + "|" +str(indata[14])+ "\n")   
+        createbone.name = temp_name
+        createbone.bone_index = counter
+        createbone.parent_index = indata[3]
+        createbone.bindpos[0] = indata[8]
+        createbone.bindpos[1] = indata[9]
+        createbone.bindpos[2] = indata[10]
+        createbone.scale[0] = indata[12]
+        createbone.scale[1] = indata[13]
+        createbone.scale[2] = indata[14]
+        
+        bni_dict[createbone.name] = createbone.bone_index
+        
+        #w,x,y,z
+        if (counter == 0):#main parent
+             createbone.bindmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6])).to_matrix() 
+             createbone.origmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6])).to_matrix() 
+        else:
+             createbone.bindmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6])).to_matrix()
+             createbone.origmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6])).to_matrix()
+        
+        createbone.bindmat = mathutils.Matrix.Translation(mathutils.Vector((indata[8],indata[9],indata[10]))) * createbone.bindmat.to_4x4()
+
+            
+        md5_bones.append(createbone)
+        counter = counter + 1
+        bnstr = (str(indata[0]))
+        Bns.append(bnstr)
+        
+    for pbone in md5_bones:
+        pbone.parent =  md5_bones[pbone.parent_index]
+
+    for pbone in md5_bones:
+        if pbone.name != pbone.parent.name:
+            pbone.bindmat =   pbone.parent.bindmat * pbone.bindmat 
+            #print(pbone.name)
+            #print(pbone.bindmat)
+            #print("end")
+        else:
+            pbone.bindmat = pbone.bindmat
+        
+    for pbone in md5_bones:
+        pbone.head = getheadpos(pbone,md5_bones)
+        
+    for pbone in md5_bones:
+        pbone.tail = gettailpos(pbone,md5_bones)
+
+    for pbone in md5_bones:
+        pbone.parent =  md5_bones[pbone.parent_index].name
+
+    bonecount = 0
+    for armbone in bone:
+        temp_name = armbone[0][:30]
+        #print ("BONE NAME: ",len(temp_name))
+        temp_name=str((temp_name))
+        #temp_name = temp_name[1]
+        #print ("BONE NAME: ",temp_name)
+        bonecount +=1
+    print ("-------------------------")
+    print ("----Creating--Armature---")
+    print ("-------------------------")
+    
+    #================================================================================================
+    #Check armature if exist if so create or update or remove all and addnew bone
+    #================================================================================================
+    #bpy.ops.object.mode_set(mode='OBJECT')
+    meshname ="ArmObject"
+    objectname = "armaturedata"
+    # arm = None  # UNUSED
+    if importbone:
+        obj = bpy.data.objects.get(meshname)
+        # arm = obj  # UNUSED
+
+        if not obj:
+            armdata = bpy.data.armatures.new(objectname)
+            ob_new = bpy.data.objects.new(meshname, armdata)
+            #ob_new = bpy.data.objects.new(meshname, 'ARMATURE')
+            #ob_new.data = armdata
+            bpy.context.scene.objects.link(ob_new)
+            #bpy.ops.object.mode_set(mode='OBJECT')
+            for i in bpy.context.scene.objects: i.select = False #deselect all objects
+            ob_new.select = True
+            #set current armature to edit the bone
+            bpy.context.scene.objects.active = ob_new
+            #set mode to able to edit the bone
+            if bpy.ops.object.mode_set.poll():
+                bpy.ops.object.mode_set(mode='EDIT')
+
+            #newbone = ob_new.data.edit_bones.new('test')
+            #newbone.tail.y = 1
+            print("creating bone(s)")
+            bpy.ops.object.mode_set(mode='OBJECT')
+            for bone in md5_bones:
+                #print(dir(bone))
+                bpy.ops.object.mode_set(mode='EDIT')#Go to edit mode for the bones
+                newbone = ob_new.data.edit_bones.new(bone.name)
+                #parent the bone
+                #print("DRI:",dir(newbone))
+                parentbone = None
+                #note bone location is set in the real space or global not local
+                bonesize = bpy.types.Scene.unrealbonesize
+                if bone.name != bone.parent:
+                    pos_x = bone.bindpos[0]
+                    pos_y = bone.bindpos[1]
+                    pos_z = bone.bindpos[2]
+                    #print( "LINKING:" , bone.parent ,"j")
+                    parentbone = ob_new.data.edit_bones[bone.parent]
+                    newbone.parent = parentbone
+                    rotmatrix = bone.bindmat
+                    newbone.head.x = bone.head[0]
+                    newbone.head.y = bone.head[1]
+                    newbone.head.z = bone.head[2]
+                    newbone.tail.x = bone.tail[0]
+                    newbone.tail.y = bone.tail[1]
+                    newbone.tail.z = bone.tail[2]
+
+                    vecp = parentbone.tail - parentbone.head
+                    vecc = newbone.tail - newbone.head
+                    vecc.normalize()
+                    vecp.normalize()
+                    if vecp.dot(vecc) > -0.8:
+                        newbone.roll = parentbone.roll
+                    else:
+                        newbone.roll = - parentbone.roll
+                else:
+                    rotmatrix = bone.bindmat
+                    newbone.head.x = bone.head[0]
+                    newbone.head.y = bone.head[1]
+                    newbone.head.z = bone.head[2]
+                    newbone.tail.x = bone.tail[0]
+                    newbone.tail.y = bone.tail[1]
+                    newbone.tail.z = bone.tail[2]
+                    newbone.roll = math.radians(90.0)
+                """
+                vec = newbone.tail - newbone.head 
+                if vec.z > 0.0:
+                    newbone.roll = math.radians(90.0)
+                else:
+                    newbone.roll = math.radians(-90.0)
+                """
+    bpy.context.scene.update()
+    
+    #==================================================================================================
+    #END BONE DATA BUILD
+    #==================================================================================================
+    VtxCol = []
+    for x in range(len(Bns)):
+        #change the overall darkness of each material in a range between 0.1 and 0.9
+        tmpVal = ((float(x)+1.0)/(len(Bns))*0.7)+0.1
+        tmpVal = int(tmpVal * 256)
+        tmpCol = [tmpVal,tmpVal,tmpVal,0]
+        #Change the color of each material slightly
+        if x % 3 == 0:
+            if tmpCol[0] < 128: tmpCol[0] += 60
+            else: tmpCol[0] -= 60
+        if x % 3 == 1:
+            if tmpCol[1] < 128: tmpCol[1] += 60
+            else: tmpCol[1] -= 60
+        if x % 3 == 2:
+            if tmpCol[2] < 128: tmpCol[2] += 60
+            else: tmpCol[2] -= 60
+        #Add the material to the mesh
+        VtxCol.append(tmpCol)
+    
+    #================================================================================================== 
+    # Bone Weight
+    #================================================================================================== 
+    #read the RAWW0000 header
+    indata = unpack('20s3i',pskfile.read(32))
+    recCount = indata[3]
+    printlog( "Nbr of RAWW0000 records: " + str(recCount) +"\n")
+    #RAWW0000 fields: Weight|PntIdx|BoneIdx
+    RWghts = []
+    counter = 0
+    while counter < recCount:
+        counter = counter + 1
+        indata = unpack('fii',pskfile.read(12))
+        RWghts.append([indata[1],indata[2],indata[0]])
+        #print("weight:",[indata[1],indata[2],indata[0]])
+    #RWghts fields = PntIdx|BoneIdx|Weight
+    RWghts.sort()
+    printlog( "Vertex point and groups count =" + str(len(RWghts)) + "\n")
+    printlog("PntIdx|BoneIdx|Weight")
+    for vg in RWghts:
+        printlog( str(vg[0]) + "|" + str(vg[1]) + "|" + str(vg[2]) + "\n")
+        
+    #Tmsh.update_tag()
+    
+    #set the Vertex Colors of the faces
+    #face.v[n] = RWghts[0]
+    #RWghts[1] = index of VtxCol
+    """
+    for x in range(len(Tmsh.faces)):
+        for y in range(len(Tmsh.faces[x].v)):
+            #find v in RWghts[n][0]
+            findVal = Tmsh.faces[x].v[y].index
+            n = 0
+            while findVal != RWghts[n][0]:
+                n = n + 1
+            TmpCol = VtxCol[RWghts[n][1]]
+            #check if a vertex has more than one influence
+            if n != len(RWghts)-1:
+                if RWghts[n][0] == RWghts[n+1][0]:
+                    #if there is more than one influence, use the one with the greater influence
+                    #for simplicity only 2 influences are checked, 2nd and 3rd influences are usually very small
+                    if RWghts[n][2] < RWghts[n+1][2]:
+                        TmpCol = VtxCol[RWghts[n+1][1]]
+        Tmsh.faces[x].col.append(NMesh.Col(TmpCol[0],TmpCol[1],TmpCol[2],0))
+    """
+    if (DEBUGLOG):
+        logf.close()
+    #================================================================================================== 
+    #Building Mesh
+    #================================================================================================== 
+    print("vertex:",len(verts),"faces:",len(faces))
+    print("vertex2:",len(verts2))
+    me_ob.vertices.add(len(verts2))
+    me_ob.tessfaces.add(len(faces))
+    me_ob.vertices.foreach_set("co", unpack_list(verts2))
+    me_ob.tessfaces.foreach_set("vertices_raw",unpack_list( faces))
+    
+    for face in me_ob.tessfaces:
+	    face.use_smooth = facesmooth[face.index]    
+        
+    """
+    Material setup coding.
+    First the mesh has to be create first to get the uv texture setup working.
+    -Create material(s) list in the psk pack data from the list.(to do list)
+    -Append the material to the from create the mesh object.
+    -Create Texture(s)
+    -fae loop for uv assign and assign material index
+    
+    """
+    bpy.ops.object.mode_set(mode='OBJECT')
+    #===================================================================================================
+    #Material Setup
+    #===================================================================================================
+    print ("-------------------------")
+    print ("----Creating--Materials--")
+    print ("-------------------------")
+    materialname = "pskmat"
+    materials = []
+
+    for matcount in range(materialcount):
+        #if texturedata != None:
+        matdata = bpy.data.materials.new(materialname + str(matcount))
+        #mtex = matdata.texture_slots.new()
+        #mtex.texture = texture[matcount].data
+        #print(type(texture[matcount].data))
+        #print(dir(mtex))
+        #print(dir(matdata))
+        #for texno in range(len( bpy.data.textures)):
+            #print((bpy.data.textures[texno].name))		
+            #print(dir(bpy.data.textures[texno]))
+        #matdata.active_texture = bpy.data.textures[matcount-1]
+        #matdata.texture_coords = 'UV'
+        #matdata.active_texture = texturedata
+        materials.append(matdata)
+
+    for material in materials:
+        #add material to the mesh list of materials
+        me_ob.materials.append(material)
+    #===================================================================================================
+    #UV Setup
+    #===================================================================================================
+    print ("-------------------------")
+    print ("-- Creating UV Texture --")
+    print ("-------------------------") 
+    texture = []
+    # texturename = "text1"  # UNUSED
+    countm = 0
+    for countm in range(materialcount):
+        psktexname="psk" + str(countm)
+        me_ob.uv_textures.new(name=psktexname)
+        countm += 1
+    print("INIT UV TEXTURE...")
+    _matcount = 0
+    #for mattexcount in materials:
+        #print("MATERAIL ID:",_matcount)
+    _textcount = 0
+    for uv in me_ob.tessface_uv_textures: # uv texture
+        print("UV TEXTURE ID:",_textcount)
+        print(dir(uv))
+        for face in me_ob.tessfaces:# face, uv
+            #print(dir(face))
+            if faceuv[face.index][1] == _textcount: #if face index and texture index matches assign it
+                mfaceuv = faceuv[face.index] #face index
+                _uv1 = mfaceuv[0][0] #(0,0)
+                uv.data[face.index].uv1 = mathutils.Vector((_uv1[0],_uv1[1])) #set them
+                _uv2 = mfaceuv[0][1] #(0,0)
+                uv.data[face.index].uv2 = mathutils.Vector((_uv2[0],_uv2[1])) #set them
+                _uv3 = mfaceuv[0][2] #(0,0)
+                uv.data[face.index].uv3 = mathutils.Vector((_uv3[0],_uv3[1])) #set them
+            else: #if not match zero them
+                uv.data[face.index].uv1 = mathutils.Vector((0,0)) #zero them 
+                uv.data[face.index].uv2 = mathutils.Vector((0,0)) #zero them 
+                uv.data[face.index].uv3 = mathutils.Vector((0,0)) #zero them 
+        _textcount += 1
+        #_matcount += 1
+        #print(matcount)
+    print("END UV TEXTURE...")
+
+    print("UV TEXTURE LEN:",len(texture))
+        #for tex in me_ob.uv_textures:
+            #print("mesh tex:",dir(tex))
+            #print((tex.name))
+    
+    #for face in me_ob.faces:
+        #print(dir(face))
+
+    #===================================================================================================
+    #
+    #===================================================================================================
+    obmesh = bpy.data.objects.new(objName,me_ob)
+    #===================================================================================================
+    #Mesh Vertex Group bone weight
+    #===================================================================================================
+    print("---- building bone weight mesh ----")
+    #print(dir(ob_new.data.bones))
+    #create bone vertex group #deal with bone id for index number
+    for bone in ob_new.data.bones:
+        #print("names:",bone.name,":",dir(bone))
+        #print("names:",bone.name)
+        group = obmesh.vertex_groups.new(bone.name)
+
+    for vgroup in obmesh.vertex_groups:
+        #print(vgroup.name,":",vgroup.index)
+        for vgp in RWghts:
+            #bone index
+                
+            if vgp[1] == bni_dict[vgroup.name]:
+                #print(vgp)
+                #[vertex id],weight
+                vgroup.add([vgp[0]], vgp[2], 'ADD')
+
+    #check if there is a material to set to
+    if len(materials) > 0:
+        obmesh.active_material = materials[0] #material setup tmp
+    print("---- adding mesh to the scene ----")
+    
+    bpy.ops.object.mode_set(mode='OBJECT')
+    #bpy.ops.object.select_pattern(extend=True, pattern=obmesh.name, case_sensitive=True)
+    #bpy.ops.object.select_pattern(extend=True, pattern=ob_new.name, case_sensitive=True)
+
+    #bpy.ops.object.select_name(name=str(obmesh.name))
+    #bpy.ops.object.select_name(name=str(ob_new.name))
+    #bpy.context.scene.objects.active = ob_new
+    me_ob.update()
+    bpy.context.scene.objects.link(obmesh)   
+    bpy.context.scene.update()
+    obmesh.select = False
+    ob_new.select = False
+    obmesh.select = True
+    ob_new.select = True
+    bpy.ops.object.parent_set(type="ARMATURE")
+    
+    print ("PSK2Blender completed")
+#End of def pskimport#########################
+
+def getInputFilenamepsk(self,filename,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
+    checktype = filename.split('\\')[-1].split('.')[1]
+    print ("------------",filename)
+    if checktype.lower() != 'psk':
+        print ("  Selected file = ",filename)
+        raise (IOError, "The selected input file is not a *.psk file")
+        #self.report({'INFO'}, ("Selected file:"+ filename))
+    else:
+        pskimport(filename,importmesh,importbone,bDebugLogPSK,importmultiuvtextures)
+		
+def getInputFilenamepsa(self,filename,context):
+    checktype = filename.split('\\')[-1].split('.')[1]
+    if checktype.lower() != 'psa':
+        print ("  Selected file = ",filename)
+        raise (IOError, "The selected input file is not a *.psa file")
+        #self.report({'INFO'}, ("Selected file:"+ filename))
+    else:
+        psaimport(filename,context)
+
+class IMPORT_OT_psk(bpy.types.Operator):
+    '''Load a skeleton mesh psk File'''
+    bl_idname = "import_scene.psk"
+    bl_label = "Import PSK"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_options = {'UNDO'}
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+    filepath = StringProperty(
+            subtype='FILE_PATH',
+            )
+    filter_glob = StringProperty(
+            default="*.psk",
+            options={'HIDDEN'},
+            )
+    importmesh = BoolProperty(
+            name="Mesh",
+            description="Import mesh only. (not yet build.)",
+            default=True,
+            )
+    importbone = BoolProperty(
+            name="Bones",
+            description="Import bones only. Current not working yet",
+            default=True,
+            )
+    importmultiuvtextures = BoolProperty(
+            name="Single UV Texture(s)",
+            description="Single or Multi uv textures",
+            default=True,
+            )
+    bDebugLogPSK = BoolProperty(
+            name="Debug Log.txt",
+            description="Log the output of raw format. It will save in " \
+                        "current file dir. Note this just for testing",
+            default=False,
+            )
+    unrealbonesize = FloatProperty(
+            name="Bone Length",
+            description="Bone Length from head to tail distance",
+            default=1,
+            min=0.001,
+            max=1000,
+            )
+
+    def execute(self, context):
+        bpy.types.Scene.unrealbonesize = self.unrealbonesize
+        getInputFilenamepsk(self,self.filepath,self.importmesh,self.importbone,self.bDebugLogPSK,self.importmultiuvtextures)
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}  
+
+class psa_bone:
+    name=""
+    Transform=None
+    parent=None
+    def __init__(self):
+        self.name=""
+        self.Transform=None
+        self.parent=None
+		
+def psaimport(filename,context):
+    print ("--------------------------------------------------")
+    print ("---------SCRIPT EXECUTING PYTHON IMPORTER---------")
+    print ("--------------------------------------------------")
+    print ("Importing file: ", filename)
+    psafile = open(filename,'rb')
+    debug = True
+    if (debug):
+        logpath = filename.replace(".psa", ".txt")
+        print("logpath:",logpath)
+        logf = open(logpath,'w')
+    def printlog(strdata):
+        if (debug):
+            logf.write(strdata)
+    def printlogplus(name,data):
+        if (debug):
+            logf.write(str(name)+'\n')
+            if isinstance(data,bytes):
+                logf.write(str(bytes.decode(data).strip(bytes.decode(b'\x00'))))
+            else:
+                logf.write(str(data))
+            logf.write('\n')
+            
+    printlog('-----------Log File------------\n')
+    #General Header
+    indata = unpack('20s3i',psafile.read(32))
+    printlogplus('ChunkID',indata[0])
+    printlogplus('TypeFlag',indata[1])
+    printlogplus('DataSize',indata[2])
+    printlogplus('DataCount',indata[3])
+    #Bones Header
+    indata = unpack('20s3i',psafile.read(32))
+    printlogplus('ChunkID',indata[0])
+    printlogplus('TypeFlag',indata[1])
+    printlogplus('DataSize',indata[2])
+    printlogplus('DataCount',indata[3])
+    #Bones Data
+    BoneIndex2NamePairMap = {}
+    BoneNotFoundList = []
+    printlog("Name|Flgs|NumChld|PrntIdx|Qx|Qy|Qz|Qw|LocX|LocY|LocZ|Length|XSize|YSize|ZSize\n")
+    recCount = indata[3]
+    counter = 0
+    nobonematch = True
+    while counter < recCount:
+        indata = unpack('64s3i11f',psafile.read(120))
+        #printlogplus('bone',indata[0])
+        bonename = str(bytes.decode(indata[0]).strip(bytes.decode(b'\x00')))
+        if bonename in bpy.data.armatures['armaturedata'].bones.keys():
+            BoneIndex2NamePairMap[counter] = bonename
+            print('find bone',bonename)
+            nobonematch = False
+        else:
+            print('can not find the bone:',bonename)
+            BoneNotFoundList.append(counter)
+        counter += 1
+    
+    if nobonematch:
+        print('no bone was match so skip import!')
+        return
+        
+    #Animations Header
+    indata = unpack('20s3i',psafile.read(32))
+    printlogplus('ChunkID',indata[0])
+    printlogplus('TypeFlag',indata[1])
+    printlogplus('DataSize',indata[2])
+    printlogplus('DataCount',indata[3])
+    #Animations Data
+    recCount = indata[3]
+    counter = 0
+    Raw_Key_Nums = 0
+    Action_List = []
+    while counter < recCount:
+        indata = unpack('64s64s4i3f3i',psafile.read(64+64+4*4+3*4+3*4))
+        printlogplus('Name',indata[0])
+        printlogplus('Group',indata[1])
+        printlogplus('totalbones',indata[2])
+        printlogplus('NumRawFrames',indata[-1])
+        Name = str(bytes.decode(indata[0]).strip(bytes.decode(b'\x00')))
+        Group = str(bytes.decode(indata[1]).strip(bytes.decode(b'\x00')))
+        totalbones = indata[2]
+        NumRawFrames = indata[-1]
+        
+        Raw_Key_Nums += indata[2] * indata[-1]
+        Action_List.append((Name,Group,totalbones,NumRawFrames))
+        
+        counter += 1
+        
+    #Raw keys Header
+    Raw_Key_List = []
+    indata = unpack('20s3i',psafile.read(32))
+    printlogplus('ChunkID',indata[0])
+    printlogplus('TypeFlag',indata[1])
+    printlogplus('DataSize',indata[2])
+    printlogplus('DataCount',indata[3])
+    if(Raw_Key_Nums != indata[3]):
+        print('error! Raw_Key_Nums Inconsistent')
+        return
+    #Raw keys Data
+    recCount = Raw_Key_Nums
+    counter = 0
+    while counter < recCount:
+        indata = unpack('3f4f1f',psafile.read(3*4+4*4+4))
+        pos = mathutils.Vector((indata[0], indata[1], indata[2]))
+        quat = mathutils.Quaternion((indata[6], indata[3], indata[4], indata[5]))
+        time = indata[7]
+        Raw_Key_List.append((pos,quat,time))
+        counter += 1
+    #Scale keys Header,Scale keys Data,Curve keys Header,Curve keys Data
+    curFilePos = psafile.tell()
+    psafile.seek(0,2)
+    endFilePos = psafile.tell()
+    if curFilePos == endFilePos:
+        print('no Scale keys,Curve keys')
+     
+    #build the animation line
+    if bpy.ops.object.mode_set.poll():
+        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+        
+    NeededBoneMatrix = {}
+    ARMATURE_OBJ = 'ArmObject'
+    ARMATURE_DATA = 'armaturedata'
+    if bpy.context.scene.udk_importarmatureselect:
+        if len(bpy.context.scene.udkas_list) > 0:
+            print("CHECKING ARMATURE...")
+			#for bone in bpy.data.objects[ARMATURE_OBJ].pose.bones:
+            #for objd in bpy.data.objects:
+                #print("NAME:",objd.name," TYPE:",objd.type)
+                #if objd.type == 'ARMARURE':
+                    #print(dir(objd))
+            armature_list = bpy.context.scene.udkas_list #armature list array
+            armature_idx = bpy.context.scene.udkimportarmature_list_idx #armature index selected
+            ARMATURE_OBJ = bpy.data.objects[armature_list[armature_idx]].name #object armature
+            ARMATURE_DATA = bpy.data.objects[armature_list[armature_idx]].data.name #object data
+            
+    for bone in bpy.data.armatures[ARMATURE_DATA].bones:
+        name = bone.name
+        ori_matrix = bone.matrix
+        matrix = bone.matrix_local.to_3x3()
+        bone_rest_matrix = Matrix(matrix)
+        #bone_rest_matrix = bone.matrix_local.to_3x3()
+        #bone_rest_matrix = bone.matrix_local.to_quaternion().conjugated().to_matrix()
+        bone_rest_matrix_inv = Matrix(bone_rest_matrix)
+        bone_rest_matrix_inv.invert()
+        bone_rest_matrix_inv.resize_4x4()
+        bone_rest_matrix.resize_4x4()
+        NeededBoneMatrix[name] = (bone_rest_matrix,bone_rest_matrix_inv,ori_matrix)
+        
+    #build tmp pose bone tree
+    psa_bones = {}
+    for bone in bpy.data.objects[ARMATURE_OBJ].pose.bones:
+        _psa_bone = psa_bone()
+        _psa_bone.name = bone.name
+        _psa_bone.Transform = bone.matrix
+        if bone.parent != None:
+            _psa_bone.parent = psa_bones[bone.parent.name]
+        else:
+            _psa_bone.parent = None
+        psa_bones[bone.name] = _psa_bone
+    
+    raw_key_index = 0
+
+    for raw_action in Action_List:
+        Name            = raw_action[0]
+        Group           = raw_action[1]
+        Totalbones      = raw_action[2]
+        NumRawFrames    = raw_action[3]
+        context.scene.update()
+        object = bpy.data.objects['ArmObject']
+        object.animation_data_create()
+        action = bpy.data.actions.new(name=Name)    
+        object.animation_data.action = action
+        for i in range(NumRawFrames):
+            context.scene.frame_set(i+1)
+            pose_bones = object.pose.bones
+            for j in range(Totalbones):
+                if j not in BoneNotFoundList:
+                    bName = BoneIndex2NamePairMap[j]
+                    pbone           = psa_bones[bName]
+                    pos = Raw_Key_List[raw_key_index][0]
+                    quat = Raw_Key_List[raw_key_index][1]
+           
+                    mat = Matrix()
+                    if pbone.parent != None:
+                        quat = quat.conjugated()
+                        mat = Matrix.Translation(pos) * quat.to_matrix().to_4x4()
+                        mat = pose_bones[bName].parent.matrix * mat 
+                        #mat = pbone.parent.Transform * mat
+                    else:
+                        mat = pbone.Transform * Matrix.Translation(pos) * quat.to_matrix().to_4x4()
+
+                    pose_bones[bName].matrix = mat
+                    pbone.Transform = mat
+
+                raw_key_index += 1
+
+            #bpy.data.meshes[1]
+            for bone in pose_bones:              
+                bone.matrix = psa_bones[bone.name].Transform
+                bone.keyframe_insert("rotation_quaternion")
+                bone.keyframe_insert("location")
+
+            def whirlSingleBone(pose_bone,quat):
+                bpy.context.scene.update()
+                #record child's matrix and origin rotate
+                hymat = Quaternion((0.707,-0.707,0,0)).inverted().to_matrix().to_4x4()
+                children_infos = {}
+                childrens = pose_bone.children
+                for child in childrens:
+                    armmat = bpy.data.armatures['armaturedata'].bones[child.name].matrix.copy().to_4x4()                    
+                    cmat = child.matrix.copy() * armmat.inverted() * hymat.inverted()
+                    pos = cmat.to_translation()
+                    rotmat = cmat.to_3x3()
+                    children_infos[child] = (armmat,pos,rotmat)
+                
+                #whirl this bone by quat
+                pose_bone.matrix *= quat.to_matrix().to_4x4()
+                pose_bone.keyframe_insert("location")
+                pose_bone.keyframe_insert("rotation_quaternion")
+                bpy.context.scene.update()
+                #set back children bon to original position 
+                #reverse whirl child bone by quat.inverse()
+                
+                for child in childrens:
+                    armmat = children_infos[child][0]
+                    pos = children_infos[child][1]
+                    rotmat = children_infos[child][2] 
+
+                    child.matrix = Matrix.Translation(pos) * rotmat.to_4x4() * hymat * armmat 
+                    child.keyframe_insert("location") 
+                    child.keyframe_insert("rotation_quaternion")
+
+            for bone in pose_bones:
+                if bone.parent != None:
+                    whirlSingleBone(bone,Quaternion((0.707,0,0,-0.707)))
+                else:
+                    bone.rotation_quaternion *= Quaternion((0.707,-0.707,0,0))*Quaternion((0.707,0,0,-0.707))
+                    bone.keyframe_insert("rotation_quaternion")
+            
+        break
+        
+    context.scene.frame_set(0)
+    if(debug):
+        logf.close()
+		
+class IMPORT_OT_psa(bpy.types.Operator):
+    '''Load a skeleton anim psa File'''
+    bl_idname = "import_scene.psa"
+    bl_label = "Import PSA"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+
+    filepath = StringProperty(
+            subtype='FILE_PATH',
+            )
+    filter_glob = StringProperty(
+            default="*.psa",
+            options={'HIDDEN'},
+            )
+
+    def execute(self, context):
+        getInputFilenamepsa(self,self.filepath,context)
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}  		
+
+class IMPORT_OT_psa(bpy.types.Operator):
+    '''Load a skeleton anim psa File'''
+    bl_idname = "import_scene.psa"
+    bl_label = "Import PSA"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+
+    filepath = StringProperty(
+            subtype='FILE_PATH',
+            )
+    filter_glob = StringProperty(
+            default="*.psa",
+            options={'HIDDEN'},
+            )
+
+    def execute(self, context):
+        getInputFilenamepsa(self,self.filepath,context)
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}  
+
+bpy.types.Scene.udk_importpsk = StringProperty(
+		name		= "Import .psk",
+		description	= "Skeleton mesh file path for psk",
+		default		= "")
+bpy.types.Scene.udk_importpsa = StringProperty(
+		name		= "Import .psa",
+		description	= "Animation Data to Action Set(s) file path for psa",
+		default		= "")
+bpy.types.Scene.udk_importarmatureselect = BoolProperty(
+		name		= "Armature Selected",
+		description	= "Select Armature to Import psa animation data.",
+		default		= False)
+
+class Panel_UDKImport( bpy.types.Panel ):
+
+	bl_label		= "UDK Import"
+	bl_idname		= "OBJECT_PT_udk_import"
+	bl_space_type	= "VIEW_3D"
+	bl_region_type	= "TOOLS"
+	
+	filepath = StringProperty(
+            subtype='FILE_PATH',
+            )
+	
+	#@classmethod
+	#def poll(cls, context):
+	#	return context.active_object
+
+	def draw(self, context):
+		layout = self.layout
+		layout.operator(OBJECT_OT_PSKPath.bl_idname)		
+		
+		layout.prop(context.scene, "udk_importarmatureselect")
+		if bpy.context.scene.udk_importarmatureselect:
+			layout.operator(OBJECT_OT_UDKImportArmature.bl_idname)
+			layout.template_list(context.scene, "udkimportarmature_list", context.scene, "udkimportarmature_list_idx",prop_list="template_list_controls", rows=5)
+		layout.operator(OBJECT_OT_PSAPath.bl_idname)
+		
+class OBJECT_OT_PSKPath(bpy.types.Operator):
+    bl_idname = "object.pskpath"
+    bl_label = "Import PSK Path"
+    __doc__ = " Select .psk file path to import for skeleton mesh."
+
+    filepath = StringProperty(
+            subtype='FILE_PATH',
+            )
+    filter_glob = StringProperty(
+            default="*.psk",
+            options={'HIDDEN'},
+            )
+    importmesh = BoolProperty(
+            name="Mesh",
+            description="Import mesh only. (not yet build.)",
+            default=True,
+            )
+    importbone = BoolProperty(
+            name="Bones",
+            description="Import bones only. Current not working yet",
+            default=True,
+            )
+    importmultiuvtextures = BoolProperty(
+            name="Single UV Texture(s)",
+            description="Single or Multi uv textures",
+            default=True,
+            )
+    bDebugLogPSK = BoolProperty(
+            name="Debug Log.txt",
+            description="Log the output of raw format. It will save in " \
+                        "current file dir. Note this just for testing",
+            default=False,
+            )
+    unrealbonesize = FloatProperty(
+            name="Bone Length",
+            description="Bone Length from head to tail distance",
+            default=1,
+            min=0.001,
+            max=1000,
+            )
+    
+    def execute(self, context):
+        #context.scene.importpskpath = self.properties.filepath
+        bpy.types.Scene.unrealbonesize = self.unrealbonesize
+        getInputFilenamepsk(self,self.filepath,self.importmesh,self.importbone,self.bDebugLogPSK,self.importmultiuvtextures)
+        return {'FINISHED'}
+        
+    def invoke(self, context, event):
+        #bpy.context.window_manager.fileselect_add(self)
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}
+	
+class UDKImportArmaturePG(bpy.types.PropertyGroup):
+	bool    = BoolProperty(default=False)
+	string  = StringProperty()
+	bexport    = BoolProperty(default=False,name="Export", options={"HIDDEN"},description = "This will be ignore when exported")
+	bselect    = BoolProperty(default=False,name="Select", options={"HIDDEN"},description = "This will be ignore when exported")
+	otype  = StringProperty(name="Type",description = "This will be ignore when exported")
+	template_list_controls = StringProperty(default="", options={"HIDDEN"})
+
+bpy.utils.register_class(UDKImportArmaturePG)
+bpy.types.Scene.udkimportarmature_list = CollectionProperty(type=UDKImportArmaturePG)
+bpy.types.Scene.udkimportarmature_list_idx = IntProperty()
+
+class OBJECT_OT_PSAPath(bpy.types.Operator):
+	bl_idname = "object.psapath"
+	bl_label = "Import PSA Path"
+	__doc__ = " Select .psa file path to import for animation data."
+
+	filepath = StringProperty(name="PSA File Path", description="Filepath used for importing the PSA file", maxlen= 1024, default= "")
+	filter_glob = StringProperty(
+            default="*.psa",
+            options={'HIDDEN'},
+            )
+			
+	def execute(self, context):
+		#context.scene.importpsapath = self.properties.filepath
+		getInputFilenamepsa(self,self.filepath,context)
+		return {'FINISHED'}
+        
+	def invoke(self, context, event):
+		bpy.context.window_manager.fileselect_add(self)
+		return {'RUNNING_MODAL'}
+		
+class OBJECT_OT_UDKImportArmature(bpy.types.Operator):
+	bl_idname = "object.udkimportarmature"
+	bl_label = "Update Armature"
+	__doc__		= "This will update the filter of the mesh and armature."
+ 
+	def execute(self, context):
+		my_objlist = bpy.context.scene.udkimportarmature_list
+		objectl = []
+		for objarm in bpy.context.scene.objects:#list and filter only mesh and armature
+			if objarm.type == 'ARMATURE':
+				objectl.append(objarm)
+		for _objd in objectl:#check if list has in udk list
+			bfound_obj = False
+			for _obj in my_objlist:
+				if _obj.name == _objd.name and _obj.otype == _objd.type:
+					_obj.bselect = _objd.select
+					bfound_obj = True
+					break
+			if bfound_obj == False:
+				#print("ADD ARMATURE...")
+				my_item = my_objlist.add()
+				my_item.name = _objd.name
+				my_item.bselect = _objd.select
+				my_item.otype = _objd.type
+		removeobject = []
+		for _udkobj in my_objlist:
+			bfound_objv = False
+			for _objd in bpy.context.scene.objects: #check if there no existing object from sense to remove it
+				if _udkobj.name == _objd.name and _udkobj.otype == _objd.type:
+					bfound_objv = True
+					break
+			if bfound_objv == False:
+				removeobject.append(_udkobj)
+		#print("remove check...")
+		for _item in removeobject: #loop remove object from udk list object
+			count = 0
+			for _obj in my_objlist:
+				if _obj.name == _item.name and _obj.otype == _item.otype:
+					my_objlist.remove(count)
+					break
+				count += 1
+		return{'FINISHED'}
+		
+class OBJECT_OT_UDKImportA(bpy.types.Operator):
+	bl_idname = "object.udkimporta"
+	bl_label = "Update Armature"
+	__doc__		= "This will update the filter of the mesh and armature."
+ 
+	def execute(self, context):
+		for objd in bpy.data.objects:
+			print("NAME:",objd.name," TYPE:",objd.type)
+			if objd.type == "ARMATURE":
+				print(dir(objd))
+				print((objd.data.name))
+		return{'FINISHED'}		
+		
+def menu_func(self, context):
+    self.layout.operator(IMPORT_OT_psk.bl_idname, text="Skeleton Mesh (.psk)")
+    self.layout.operator(IMPORT_OT_psa.bl_idname, text="Skeleton Anim (.psa)")
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_file_import.append(menu_func)
+    
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_file_import.remove(menu_func)
+
+if __name__ == "__main__":
+    register()
+
+#note this only read the data and will not be place in the scene    
+#getInputFilename('C:\\blenderfiles\\BotA.psk') 
+#getInputFilename('C:\\blenderfiles\\AA.PSK')
\ No newline at end of file
diff --git a/release/scripts/addons/io_import_scene_unreal_psk.py b/release/scripts/addons/io_import_scene_unreal_psk.py
deleted file mode 100644
index 96784b1..0000000
--- a/release/scripts/addons/io_import_scene_unreal_psk.py
+++ /dev/null
@@ -1,804 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-bl_info = {
-    "name": "Import Unreal Skeleton Mesh (.psk)",
-    "author": "Darknet",
-    "version": (2, 1),
-    "blender": (2, 6, 3),
-    "location": "File > Import > Skeleton Mesh (.psk)",
-    "description": "Import Skeleleton Mesh",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
-        "Scripts/Import-Export/Unreal_psk_psa",
-    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=21366",
-    "category": "Import-Export"}
-
-"""
-Version': '2.0' ported by Darknet
-
-Unreal Tournament PSK file to Blender mesh converter V1.0
-Author: 
--Darknet (Redesign and reworked)
--D.M. Sturgeon (camg188 at the elYsium forum)
--#2011-01-20 MARIUSZ SZKARADEK GLOGOW POLAND 
-
-Imports a *psk file to a new mesh
-
--No UV Texutre
--No Weight
--No Armature Bones
--No Material ID
-"""
-
-import bpy
-import bmesh
-import mathutils
-import math
-from string import *
-from struct import *
-import struct
-from math import *
-from bpy.props import *
-from bpy_extras.io_utils import unpack_list, unpack_face_list
-
-Quaternion = mathutils.Quaternion
-
-bpy.types.Scene.unrealbonesize = FloatProperty(
-    name="Bone Length",
-    description="Bone Length from head to tail distance",
-    default=1,min=0.001,max=1000)
-
-#output log in to txt file
-DEBUGLOG = False
-
-scale = 1.0
-bonesize = 1.0
-skala = 1
-flipyz = False   
-flipuv = True
-
-#pack read words	
-def word(long): 
-   s=''
-   for j in range(0,long): 
-       lit =  struct.unpack('c',plik.read(1))[0]
-       #print(">",lit)
-       #print(">",bytes.decode(lit))
-       if ord(lit)!=0:
-           #print(lit)
-           s+=bytes.decode(lit)
-           if len(s)>100:
-               break
-   return s
-#pack read data   
-def b(n):
-    return struct.unpack(n*'b', plik.read(n))
-def B(n):
-    return struct.unpack(n*'B', plik.read(n))
-def h(n):
-    return struct.unpack(n*'h', plik.read(n*2))
-def H(n):
-    return struct.unpack(n*'H', plik.read(n*2))
-def i(n):
-    return struct.unpack(n*'i', plik.read(n*4))
-def f(n):
-    return struct.unpack(n*'f', plik.read(n*4))
-
-#work in progress
-#bmesh
-#tess function prefix
-def drawmesh():
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,mat_faceslist
-    global vertices,faces
-    print(faces[0])
-    print("[CREATING MESH:]")
-    me_ob = bpy.data.meshes.new('testmesh')
-    #create mesh
-    print("-Vertices count:",len(vertices))
-    me_ob.vertices.add(len(vertices))
-    print("-Faces count:",len(faces))
-    me_ob.tessfaces.add(len(faces))
-    print("-Creating vertices points...")
-    me_ob.vertices.foreach_set("co", unpack_list(vertices))
-    print("-Creating faces idx...")
-    me_ob.tessfaces.foreach_set("vertices_raw",unpack_list( faces))
-    for face in me_ob.tessfaces:
-        print(dir(face))
-        face.use_smooth = facesmooth[face.index]
-        #face.material_index = facemat[face.index]#not yet working
-    print("-Creating UV Texture...")
-    me_ob.tessface_uv_textures.new('uvtexture')
-    #uvtex = me_ob.tessface_uv_textures[0]
-    for uv in me_ob.tessface_uv_textures:
-        for face in me_ob.tessfaces:
-            #uv.data[face.index].uv1.x = 
-            
-            #print(uv.data[face.index].uv1)
-            #uv.data[face.index].uv1 = Vector(uvcoord[faces[face.index]][0],uvcoord[face.index][1])
-            print(face.vertices_raw[0],face.vertices_raw[1],face.vertices_raw[2])
-            uv.data[face.index].uv1 = mathutils.Vector((uvcoord[face.vertices_raw[0]][0],uvcoord[face.vertices_raw[0]][1]))
-            uv.data[face.index].uv2 = mathutils.Vector((uvcoord[face.vertices_raw[1]][0],uvcoord[face.vertices_raw[1]][1]))
-            uv.data[face.index].uv3 = mathutils.Vector((uvcoord[face.vertices_raw[2]][0],uvcoord[face.vertices_raw[2]][1]))
-
-    ob = bpy.data.objects.new("TestObject",me_ob)
-    #create vertex group
-    for bone_id in range(len(bonesdata)):
-        bonedata = bonesdata[str(bone_id)]
-        namebone = bonedata[0]#.strip()[-25:]
-        #print("NAME:",namebone)
-        ob.vertex_groups.new(namebone)
-    me_ob.update()
-    bpy.context.scene.objects.link(ob) 
-
-#Create Armature
-def check_armature():
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,amt
-    
-    #create Armature
-    bpy.ops.object.mode_set(mode='OBJECT')
-    for i in bpy.context.scene.objects: i.select = False #deselect all objects
-
-    bpy.ops.object.add(
-     type='ARMATURE', 
-     enter_editmode=True,
-     location=(0,0,0))
-    ob = bpy.context.object
-    ob.show_x_ray = True
-    ob.name = "ARM"
-    amt = ob.data
-    amt.name = 'Amt'
-    amt.show_axes = True
-    bpy.ops.object.mode_set(mode='EDIT')
-    bpy.context.scene.update()
-#Create bones
-def make_bone():    
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,amt
-    global bonenames
-    bonenames = []
-    
-    print ('make bone')
-    
-    for bone_id in range(len(bonesdata)):
-       bonedata = bonesdata[str(bone_id)]
-       namebone = bonedata[0]#.strip()[-25:]
-       newbone = amt.edit_bones.new(namebone)
-       #those are need to show in the scene
-       newbone.head = (0,0,0)
-       newbone.tail = (0,0,1)
-       bonenames.append(namebone)
-    bpy.context.scene.update()
-#Make bone parent
-def make_bone_parent():    
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,amt    
-    global children
-    children = {}
-    
-    print ('make bone parent')
-    for bone_id in range(len(bonesdata)):
-        bonedata = bonesdata[str(bone_id)]
-        namebone  = bonenames[bone_id]
-        nameparent = bonenames[bonedata[1][2]]
-        #print(nameparent)
-        if nameparent != None:#make sure it has name
-           parentbone = amt.edit_bones[nameparent]
-           bonecurrnet = amt.edit_bones[namebone]
-           bonecurrnet.parent = parentbone
-    bpy.context.scene.update()
-
-#make bone martix set    
-def bones_matrix():    
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,amt
-    
-    for bone_id in range(len(bonesdata)):
-        bonedata = bonesdata[str(bone_id)]
-        namebone = bonedata[0]#.strip()[-25:]
-        nameparent = bonenames[bonedata[1][2]]
-        pos = bonedata[2][4:7] 
-        rot = bonedata[2][0:4] 
-        qx,qy,qz,qw = rot[0],rot[1],rot[2],rot[3]
-        #print("Quaternion:",qx,qy,qz,qw)
-        if bone_id==0:
-            rot =  mathutils.Quaternion((qw,-qx,-qy,-qz))
-        if bone_id!=0:
-            rot =  mathutils.Quaternion((qw,qx,qy,qz))
-        matrix = mathutils.Matrix()
-        rot = rot.to_matrix().inverted()
-        #print(rot)
-        matrix[0][:3] = rot[0]
-        matrix[1][:3] = rot[1]
-        matrix[2][:3] = rot[2]
-        matrix[3][:3] = pos
-        if bone_id>0:
-            bonedata.append(matrix*bonesdata[str(bonedata[1][2])][3])
-        else:
-            bonedata.append(matrix)
-    bpy.context.scene.update()
-
-#not working    
-def make_bone_position():
-    print ('make bone position')
-    bpy.ops.object.mode_set(mode='EDIT')
-    for bone_id in range(len(bonesdata)):
-        bonedata = bonesdata[str(bone_id)]
-        namebone = bonedata[0]#.strip()[-25:]
-        bone = amt.edit_bones[namebone]
-        bone.transform(bonedata[3], scale=True, roll=True)
-        bvec = bone.tail- bone.head
-        bvec.normalize()
-        bone.tail = bone.head + 0.1 * bvec
-        #bone.tail = bone.head + 1 * bvec
-    bpy.context.scene.update()    
-        
-#not working  
-def make_bone_position1():    
-    print ('make bone position')
-    bpy.ops.object.mode_set(mode='EDIT')
-    for bone_id in range(len(bonesdata)):
-        bonedata = bonesdata[str(bone_id)]
-        namebone = bonedata[0]#.strip()[-25:]
-        pos = bonedata[2][4:7] 
-        pos1 = pos[0]*skala  
-        pos2 = pos[1]*skala  
-        pos3 = pos[2]*skala 
-        if flipyz == False:
-            pos = [pos1,pos2,pos3]
-        if flipyz == True:
-            pos = [pos1,-pos3,pos2]
-        rot = bonedata[2][0:4] 
-        qx,qy,qz,qw = rot[0],rot[1],rot[2],rot[3]
-        if bone_id==0:
-            rot = mathutils.Quaternion((qw,-qx,-qy,-qz))
-        if bone_id!=0:
-            rot = mathutils.Quaternion((qw,qx,qy,qz))
-        #rot = rot.toMatrix().invert() 	
-        rot = rot.to_matrix().inverted() 	
-        bone = amt.edit_bones[namebone]
-        #print("BONES:",amt.bones[0])
-        
-        if bone_id!=0:
-            bone.head = bone.parent.head+mathutils.Vector(pos) * bone.parent.matrix
-            #print(dir(rot))
-            #print("rot:",rot)
-            #print("matrix:",bone.parent.matrix)
-            
-            tempM = rot.to_4x4()*bone.parent.matrix
-            #bone.matrix = tempM
-            bone.transform(tempM, scale=False, roll=True)
-            #bone.matrix_local = tempM
-        else:
-            bone.head = mathutils.Vector(pos)
-            #bone.matrix = rot
-            bone.transform(rot, scale=False, roll=True)
-            #bone.matrix_local = rot
-        bvec = bone.tail- bone.head
-        bvec.normalize()
-        bone.tail = bone.head + 0.1 * bvec
-        #bone.tail = bone.head + 1 * bvec
-    
-
-#http://www.blender.org/forum/viewtopic.php?t=13340&sid=8b17d5de07b17960021bbd72cac0495f            
-def fixRollZ(b):
-    v = (b.tail-b.head)/b.length
-    b.roll -= math.degrees(math.atan2(v[0]*v[2]*(1 - v[1]),v[0]*v[0] + v[1]*v[2]*v[2])) 
-def fixRoll(b):
-    v = (b.tail-b.head)/b.length
-    if v[2]*v[2] > .5:
-        #align X-axis
-        b.roll += math.degrees(math.atan2(v[0]*v[2]*(1 - v[1]),v[2]*v[2] + v[1]*v[0]*v[0]))
-    else:
-        #align Z-axis
-        b.roll -= math.degrees(math.atan2(v[0]*v[2]*(1 - v[1]),v[0]*v[0] + v[1]*v[2]*v[2])) 
-""" #did not port this yet unstable but work in some ways
-def make_bone_position3():    
-            for bone in md5_bones:
-                #print(dir(bone))
-                bpy.ops.object.mode_set(mode='EDIT')
-                newbone = ob_new.data.edit_bones.new(bone.name)
-                #parent the bone
-                print("DRI:",dir(newbone))
-                parentbone = None
-                print("bone name:",bone.name)
-                #note bone location is set in the real space or global not local
-                bonesize = bpy.types.Scene.unrealbonesize
-                if bone.name != bone.parent:
-
-                    pos_x = bone.bindpos[0]
-                    pos_y = bone.bindpos[1]
-                    pos_z = bone.bindpos[2]
-                    
-                    #print( "LINKING:" , bone.parent ,"j")
-                    parentbone = ob_new.data.edit_bones[bone.parent]
-                    newbone.parent = parentbone
-                    
-                    rotmatrix = bone.bindmat.to_matrix().to_4x4().to_3x3()  # XXX, redundant matrix conversion?
-                    newbone.transform(bone.bindmat.to_matrix().to_4x4(),True,True)
-                    #parent_head = parentbone.matrix.to_quaternion().inverse() * parentbone.head
-                    #parent_tail = parentbone.matrix.to_quaternion().inverse() * parentbone.tail
-                    #location=Vector(pos_x,pos_y,pos_z)
-                    #set_position = (parent_tail - parent_head) + location
-                    #print("tmp head:",set_position)
-
-                    #pos_x = set_position.x
-                    #pos_y = set_position.y
-                    #pos_z = set_position.z
-                    
-                 
-                    newbone.head.x = parentbone.head.x + pos_x
-                    newbone.head.y = parentbone.head.y + pos_y
-                    newbone.head.z = parentbone.head.z + pos_z
-                    #print("head:",newbone.head)
-                    newbone.tail.x = parentbone.head.x + (pos_x + bonesize * rotmatrix[0][1])
-                    newbone.tail.y = parentbone.head.y + (pos_y + bonesize * rotmatrix[1][1])
-                    newbone.tail.z = parentbone.head.z + (pos_z + bonesize * rotmatrix[2][1])
-                    #newbone.roll = fixRoll(newbone)
-                else:
-                    #print("rotmatrix:",dir(bone.bindmat.to_matrix().resize_4x4()))
-                    #rotmatrix = bone.bindmat.to_matrix().resize_4x4().to_3x3()  # XXX, redundant matrix conversion?
-                    rotmatrix = bone.bindmat.to_matrix().to_3x3()  # XXX, redundant matrix conversion?
-                    #newbone.transform(bone.bindmat.to_matrix(),True,True)
-                    newbone.head.x = bone.bindpos[0]
-                    newbone.head.y = bone.bindpos[1]
-                    newbone.head.z = bone.bindpos[2]
-                    newbone.tail.x = bone.bindpos[0] + bonesize * rotmatrix[0][1]
-                    newbone.tail.y = bone.bindpos[1] + bonesize * rotmatrix[1][1]
-                    newbone.tail.z = bone.bindpos[2] + bonesize * rotmatrix[2][1]
-                    #newbone.roll = fixRoll(newbone)
-                    #print("no parent")    
-""" 
-    
-
-#import psk file
-def pskimport(filename,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
-    global DEBUGLOG, plik,vertexes,uvcoord,faceslist,num_faces,facemat,facesmooth,m
-    global vertexes_ids,bonesdata,meshesdata,groups,num_materials,skala,flipyz,flipuv,amt,vertices,faces
-    points = []
-    vertexes = []
-    vertices = []
-    uvcoord = []
-    faceslist = []
-    datafaces = []
-    faces = []
-    facemat = []
-    facesmooth = []
-    groups = []
-    vertexes_ids = []
-    bonesdata = {}
-    meshesdata ={}
-	
-    DEBUGLOG = bDebugLogPSK
-    print ("--------------------------------------------------")
-    print ("---------SCRIPT EXECUTING PYTHON IMPORTER---------")
-    print ("--------------------------------------------------")
-    print (" DEBUG Log:",bDebugLogPSK)
-    print ("Importing file: ", filename)
-    
-    plik = open(filename,'rb')
-    word(20),i(3)
-    
-    #------POINTS------
-    print ('reading points')
-    word(20)
-    data = i(3)
-    num_points = data[2]    
-    for m in range(num_points):
-        v=f(3)
-        v1 =v[0]*skala
-        v2 =v[1]*skala
-        v3 =v[2]*skala
-        if flipyz == False:
-            points.append([v1,v2,v3])
-        if flipyz == True:
-            points.append([v1,-v3,v2])
-        vertexes_ids.append([])
-    
-    #------VERTEXES----
-    print ('reading vertexes')
-    word(20)
-    data = i(3)
-    num_vertexes = data[2]
-    for m in range(num_vertexes):
-        data1 = H(2)
-        vertexes.append(points[data1[0]])
-        vertices.append(points[data1[0]])
-        #vertices.extend(points[data1[0]])
-        #vertices.extend([(points[data1[0]][0],points[data1[0]][1],points[data1[0]][2] )])
-        #vertices.extend([(points[data1[0]][0],points[data1[0]][1],points[data1[0]][2] )])
-        #print(points[data1[0]])
-        if flipuv == False:
-            uvcoord.append([f(1)[0],1-f(1)[0]])
-        if flipuv == True:
-            uvcoord.append([f(1)[0],f(1)[0]])
-        vertexes_ids[data1[0]].append(m)
-        b(2),h(1)
-    
-    
-    #------FACES-------
-    print ('reading faces')
-    word(20)
-    data = i(3)
-    num_faces = data[2]
-    for m in range(num_faces):
-        v0=H(1)[0]
-        v1=H(1)[0]
-        v2=H(1)[0]
-        faceslist.append([v1,v0,v2])
-        faces.extend([(v1,v0,v2,0)])
-        #faces.append([v1,v0,v2])
-        #print((v1,v0,v2,0))
-        mat_ids = B(2) 
-        facemat.append(mat_ids)
-        if str(mat_ids[0]) not in meshesdata:
-            meshesdata[str(mat_ids[0])] = []          
-        meshesdata[str(mat_ids[0])].append(m)
-        facesmooth.append(i(1)[0])
-        #datafaces.append([v1,v0,v2],mat_ids
-    
-    #------MATERIALS---
-    print ('making materials')
-    word(20)
-    data = i(3)
-    num_materials = data[2]
-    for m in range(num_materials):
-        name = word(64)
-        print ('read materials from',name)
-        matdata = bpy.data.materials.new(name)
-        #try:
-            #mat = Material.Get(namemodel+'-'+str(m))
-            #mat = Material.Get(name)
-        #except:
-            #mat = Material.New(namemodel+'-'+str(m))
-            #mat = Material.New(name)
-        i(6)
-        #make_materials(name,mat)
-    
-    #-------BONES------
-    print ('reading bones')
-    #check_armature()
-    check_armature()
-    word(20)
-    data = i(3)
-    num_bones = data[2]
-    for m in range(num_bones):
-        #print(str(m)) #index
-        bonesdata[str(m)] = []
-        bonename = word(64)
-        bonename = bonename#.strip() 
-        bonename = bonename.strip() 
-        #print(bonename)#bone name
-        bonesdata[str(m)].append(bonename)
-        bonesdata[str(m)].append(i(3))
-        bonesdata[str(m)].append(f(11))
-    make_bone()
-    make_bone_parent()
-    bones_matrix()
-    make_bone_position1()
-
-    
-     #-------SKINNING---
-    print ('making skinning')
-    word(20)
-    data = i(3)
-    num_groups = data[2]
-    
-    for m in range(num_groups):
-        w = f(1)[0]
-        v_id  = i(1)[0]         
-        gr = i(1)[0]
-        groups.append([w,v_id,gr]) 
-    #create Mesh
-    drawmesh()
-
-    print ("IMPORTER PSK Blender 2.6 completed")
-#End of def pskimport#########################
-
-def psaimport(filename):
-    global plik,bonesdata,animdata,anim_offset,animation_names
-    bonesdata = {}
-    animation_names = []
-    animation_num_bones = []
-    animation_num_keys = []
-    animation_loc_keys = []
-    animation_rot_keys = []
-    animdata = {}
-    plik = open(filename,'rb')
-    print (word(20),i(3))
-
-    #-------BONES------
-    #check_armature_for_psa()
-    print (word(20))
-    data = i(3)
-    #print data
-    num_bones = data[2]
-    for m in range(num_bones):
-        bonesdata[str(m)] = []
-        name = word(64)
-        bonesdata[str(m)].append(name)
-        bonesdata[str(m)].append(i(3))
-        bonesdata[str(m)].append(f(11))
-
-
-    #--------ANIMATIONS-INFO
-    print (word(20))
-    data = i(3)
-    #print data
-    for m in range(data[2]):
-        name_animation = word(64)#name animation
-        print("NAME:",name_animation)
-        animation_names.append(name_animation)
-        word(64)#name of owner of animation ?
-        data = i(4)#num bones - 0 - 0 - num keys for all bones for this animation
-        num_bones = data[0] 
-        animation_num_bones.append(num_bones)
-        f(3)
-        data = i(3) 
-        num_keys = data[2]
-        animation_num_keys.append(num_keys)
-    print (plik.tell())
-
-    #--------ANIMATIONS-KEYS
-    print (word(20))
-    data = i(3)
-    #print data
-    anim_offset = {}
-    seek = plik.tell()
-    for m in range(len(animation_names)):
-        anim_name = animation_names[m]
-        anim_bones = animation_num_bones[m]
-        anim_keys = animation_num_keys[m]
-        anim_offset[anim_name] = []
-        anim_offset[anim_name].append(seek)
-        anim_offset[anim_name].append(anim_keys)
-        anim_offset[anim_name].append(anim_bones)
-        seek+=anim_keys*anim_bones*32
-    
-    
-def getInputFilename(self,filename,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
-    checktype = filename.split('\\')[-1].split('.')[1]
-    print ("------------",filename)
-    if checktype.lower() != 'psk':
-        print ("  Selected file = ",filename)
-        raise (IOError, "The selected input file is not a *.psk file")
-        #self.report({'INFO'}, ("Selected file:"+ filename))
-    else:
-        pskimport(filename,importmesh,importbone,bDebugLogPSK,importmultiuvtextures)
-#import panel
-class IMPORT_OT_psk(bpy.types.Operator):
-    """Load a skeleton mesh psk File"""
-    bl_idname = "import_scene.psk"
-    bl_label = "Import PSK"
-    bl_space_type = "PROPERTIES"
-    bl_region_type = "WINDOW"
-    bl_options = {'UNDO'}
-
-    # List of operator properties, the attributes will be assigned
-    # to the class instance from the operator settings before calling.
-    filepath = StringProperty(
-            subtype='FILE_PATH',
-            )
-    filter_glob = StringProperty(
-            default="*.psk",
-            options={'HIDDEN'},
-            )
-    importmesh = BoolProperty(
-            name="Mesh",
-            description="Import mesh only. (not yet build.)",
-            default=True,
-            )
-    importbone = BoolProperty(
-            name="Bones",
-            description="Import bones only. Current not working yet",
-            default=True,
-            )
-    importmultiuvtextures = BoolProperty(
-            name="Single UV Texture(s)",
-            description="Single or Multi uv textures",
-            default=True,
-            )
-    bDebugLogPSK = BoolProperty(
-            name="Debug Log.txt",
-            description="Log the output of raw format. It will save in " \
-                        "current file dir. Note this just for testing",
-            default=False,
-            )
-    unrealbonesize = FloatProperty(
-            name="Bone Length",
-            description="Bone Length from head to tail distance",
-            default=1,
-            min=0.001,
-            max=1000,
-            )
-
-    def execute(self, context):
-        bpy.types.Scene.unrealbonesize = self.unrealbonesize
-        getInputFilename(self,self.filepath,self.importmesh,self.importbone,self.bDebugLogPSK,self.importmultiuvtextures)
-        return {'FINISHED'}
-
-    def invoke(self, context, event):
-        wm = context.window_manager
-        wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}  
-#import panel psk	
-class OBJECT_OT_PSKPath(bpy.types.Operator):
-    bl_idname = "object.pskpath"
-    bl_label = "PSK Path"
-    __doc__ = ""
-
-    filepath = StringProperty(
-            subtype='FILE_PATH',
-            )
-    filter_glob = StringProperty(
-            default="*.psk",
-            options={'HIDDEN'},
-            )
-    importmesh = BoolProperty(
-            name="Mesh",
-            description="Import mesh only. (not yet build.)",
-            default=True,
-            )
-    importbone = BoolProperty(
-            name="Bones",
-            description="Import bones only. Current not working yet",
-            default=True,
-            )
-    importmultiuvtextures = BoolProperty(
-            name="Single UV Texture(s)",
-            description="Single or Multi uv textures",
-            default=True,
-            )
-    bDebugLogPSK = BoolProperty(
-            name="Debug Log.txt",
-            description="Log the output of raw format. It will save in " \
-                        "current file dir. Note this just for testing",
-            default=False,
-            )
-    unrealbonesize = FloatProperty(
-            name="Bone Length",
-            description="Bone Length from head to tail distance",
-            default=1,
-            min=0.001,
-            max=1000,
-            )
-    
-    def execute(self, context):
-        #context.scene.importpskpath = self.properties.filepath
-        bpy.types.Scene.unrealbonesize = self.unrealbonesize
-        getInputFilename(self,self.filepath,self.importmesh,self.importbone,self.bDebugLogPSK,self.importmultiuvtextures)
-        return {'FINISHED'}
-        
-    def invoke(self, context, event):
-        #bpy.context.window_manager.fileselect_add(self)
-        wm = context.window_manager
-        wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}
-#import panel psa		
-class OBJECT_OT_PSAPath(bpy.types.Operator):
-    bl_idname = "object.psapath"
-    bl_label = "PSA Path"
-    __doc__ = ""
-
-    filepath = StringProperty(name="PSA File Path", description="Filepath used for importing the PSA file", maxlen= 1024, default= "")
-    filter_glob = StringProperty(
-            default="*.psa",
-            options={'HIDDEN'},
-            )
-    def execute(self, context):
-        #context.scene.importpsapath = self.properties.filepath
-        psaimport(self.filepath)
-        return {'FINISHED'}
-        
-    def invoke(self, context, event):
-        bpy.context.window_manager.fileselect_add(self)
-        return {'RUNNING_MODAL'}
-		
-class OBJECT_OT_Path(bpy.types.Operator):
-    bl_idname = "object.path"
-    bl_label = "MESH BUILD TEST"
-    __doc__ = ""
-    # generic transform props
-    view_align = BoolProperty(
-            name="Align to View",
-            default=False,
-            )
-    location = FloatVectorProperty(
-            name="Location",
-            subtype='TRANSLATION',
-            )
-    rotation = FloatVectorProperty(
-            name="Rotation",
-            subtype='EULER',
-            )
-    def execute(self, context):
-        return {'FINISHED'}
-        
-    def invoke(self, context, event):
-        me = bpy.data.meshes.new("test")
-        obmade = bpy.data.objects.new("TestObject",me)
-        print("Create Simple Mesh")
-        bpy.data.scenes[0].objects.link(obmade)
-        for i in bpy.context.scene.objects: i.select = False #deselect all objects
-        obmade.select = True
-        bpy.context.scene.objects.active = obmade
-        
-        verts = [(0,0,0),(2,0,0),(2,0,2)]
-        edges = [(0,1),(1,2),(2,0)]
-        faces = []
-        faces.extend([(0,1,2,0)])
-        #me.vertices.add(len(verts))
-        #print(dir(me))
-        me.vertices.add(len(verts))
-        me.tessfaces.add(len(faces))
-        for face in me.tessfaces:
-            print(dir(face))
-        
-        me.vertices.foreach_set("co", unpack_list(verts))
-        me.tessfaces.foreach_set("vertices_raw", unpack_list(faces))
-        me.edges.add(len(edges))
-        me.edges.foreach_set("vertices", unpack_list(edges))
-        
-        #print(len(me.tessfaces))
-        me.tessface_uv_textures.new("uvtexture")
-        #for uv in me.tessface_uv_textures:
-            #print(len(uv.data))
-            #print(dir(uv.data[0]))
-            #print(dir(uv.data[0].uv1))
-        return {'RUNNING_MODAL'}
-
-#import menu panel tool bar
-class VIEW3D_PT_unrealimport_objectmode(bpy.types.Panel):
-    bl_space_type = "VIEW_3D"
-    bl_region_type = "TOOLS"
-    bl_label = "Import PSK/PSA"
-    
-    @classmethod
-    def poll(cls, context):
-        return context.active_object
-
-    def draw(self, context):
-        layout = self.layout
-        rd = context.scene
-
-        row2 = layout.row(align=True)
-        row2.operator(OBJECT_OT_PSKPath.bl_idname)                
-        row2.operator(OBJECT_OT_PSAPath.bl_idname)        
-        row2.operator(OBJECT_OT_Path.bl_idname)        
-#import panel
-def menu_func(self, context):
-    self.layout.operator(IMPORT_OT_psk.bl_idname, text="Skeleton Mesh (.psk)")
-
-def register():
-    bpy.utils.register_module(__name__)
-    bpy.types.INFO_MT_file_import.append(menu_func)
-    
-def unregister():
-    bpy.utils.unregister_module(__name__)
-    bpy.types.INFO_MT_file_import.remove(menu_func)
-
-if __name__ == "__main__":
-    register()
-
-#note this only read the data and will not be place in the scene    
-#getInputFilename('C:\\blenderfiles\\BotA.psk') 
-#getInputFilename('C:\\blenderfiles\\AA.PSK')
-#getInputFilename('C:\\blender26x\\blender-2.psk')
diff --git a/release/scripts/addons/io_mesh_pdb/__init__.py b/release/scripts/addons/io_mesh_pdb/__init__.py
index 2568ec7..15d6642 100644
--- a/release/scripts/addons/io_mesh_pdb/__init__.py
+++ b/release/scripts/addons/io_mesh_pdb/__init__.py
@@ -21,23 +21,26 @@
 #  Authors           : Clemens Barth (Blendphys at root-1.de), ...
 #
 #  Homepage(Wiki)    : http://development.root-1.de/Atomic_Blender.php
-#  Tracker           : http://projects.blender.org/tracker/index.php?func=detail&aid=29226&group_id=153&atid=467
 #
 #  Start of project              : 2011-08-31 by Clemens Barth
 #  First publication in Blender  : 2011-11-11
-#  Last modified                 : 2012-03-23
+#  Last modified                 : 2012-11-09
 #
-#  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
-#  dairin0d, PKHG, Valter, etc
+#  Acknowledgements 
+#  ================
+#
+#  Blender: ideasman, meta_androcto, truman, kilon, CoDEmanX, dairin0d, PKHG, 
+#           Valter, ...
+#  Other: Frank Palmino
 #
 
 bl_info = {
-    "name": "PDB Atomic Blender",
+    "name": "Atomic Blender - PDB",
     "description": "Loading and manipulating atoms from PDB files",
     "author": "Clemens Barth",
-    "version": (1,3),
+    "version": (1,5),
     "blender": (2,6),
-    "location": "File -> Import -> PDB (.pdb), Panel: View 3D - Tools",
+    "location": "File -> Import -> PDB (.pdb)",
     "warning": "",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/"
                 "Py/Scripts/Import-Export/PDB",
@@ -46,11 +49,8 @@ bl_info = {
     "category": "Import-Export"
 }
 
-import os
-import io
 import bpy
-import bmesh
-from bpy.types import Operator, Panel
+from bpy.types import Operator
 from bpy_extras.io_utils import ImportHelper, ExportHelper
 from bpy.props import (StringProperty,
                        BoolProperty,
@@ -61,504 +61,11 @@ from bpy.props import (StringProperty,
 from . import import_pdb
 from . import export_pdb
 
-ATOM_PDB_ERROR = ""
-ATOM_PDB_PANEL = ""
-
 # -----------------------------------------------------------------------------
 #                                                                           GUI
 
-# The panel, which is loaded after the file has been
-# chosen via the menu 'File -> Import'
-class CLASS_atom_pdb_panel(Panel):
-    bl_label       = "PDB - Atomic Blender"
-    bl_space_type  = "VIEW_3D"
-    bl_region_type = "TOOL_PROPS"
-
-    @classmethod
-    def poll(self, context):
-        global ATOM_PDB_PANEL
-        
-        if ATOM_PDB_PANEL == "0" and import_pdb.ATOM_PDB_FILEPATH == "":
-            return False
-        if ATOM_PDB_PANEL == "0" and import_pdb.ATOM_PDB_FILEPATH != "":
-            return True
-        if ATOM_PDB_PANEL == "1":
-            return True
-        if ATOM_PDB_PANEL == "2":
-            return False
-        
-        return True
-
-    def draw(self, context):
-        layout = self.layout
-
-        # This is for the case that a blend file is loaded. 
-        if len(context.scene.atom_pdb) == 0:
-            bpy.context.scene.atom_pdb.add()
-
-        scn    = context.scene.atom_pdb[0]
-
-        row = layout.row()
-        row.label(text="Outputs and custom data file")
-        box = layout.box()
-        row = box.row()
-        row.label(text="Custom data file")
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "datafile")
-        col.operator("atom_pdb.datafile_apply")
-        row = box.row()
-        col = row.column(align=True)
-        col.prop(scn, "PDB_file")
-        row = layout.row()
-        row.label(text="Reload structure")
-        box = layout.box()
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "use_mesh")
-        col = row.column()
-        col.label(text="Scaling factors")
-        row = box.row()
-        col = row.column(align=True)  
-        col.active = scn.use_mesh   
-        col.prop(scn, "mesh_azimuth")
-        col.prop(scn, "mesh_zenith")
-        col = row.column(align=True)
-        col.prop(scn, "scale_ballradius")
-        col.prop(scn, "scale_distances")
-        row = box.row()
-        col = row.column()  
-        col.prop(scn, "use_sticks")
-        row = box.row()        
-        row.active = scn.use_sticks
-        col = row.column(align=True)
-        col.prop(scn, "sticks_sectors")
-        col.prop(scn, "sticks_radius")
-        col.prop(scn, "sticks_unit_length")
-        col = row.column(align=True)        
-        col.prop(scn, "use_sticks_color")        
-        col.prop(scn, "use_sticks_smooth")
-        col.prop(scn, "use_sticks_bonds")
-        row = box.row()        
-        row.active = scn.use_sticks
-        col = row.column(align=True)
-        col = row.column(align=True)
-        col.active = scn.use_sticks and scn.use_sticks_bonds 
-        col.prop(scn, "sticks_dist")        
-        row = box.row()
-        row.prop(scn, "use_center")
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "use_camera")
-        col.prop(scn, "use_lamp")
-        col = row.column()
-        col.operator("atom_pdb.button_reload")
-        col.prop(scn, "number_atoms")
-        row = box.row()
-        row.operator("atom_pdb.button_distance")
-        row.prop(scn, "distance")
-        row = layout.row()
-        row.label(text="Modify atom radii")
-        box = layout.box()
-        row = box.row()
-        row.label(text="All changes concern:")
-        row = box.row()
-        row.prop(scn, "radius_how")
-        row = box.row()
-        row.label(text="1. Change type of radii")
-        row = box.row()
-        row.prop(scn, "radius_type")
-        row = box.row()
-        row.label(text="2. Change atom radii in pm")
-        row = box.row()
-        row.prop(scn, "radius_pm_name")
-        row = box.row()
-        row.prop(scn, "radius_pm")
-        row = box.row()
-        row.label(text="3. Change atom radii by scale")
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "radius_all")
-        col = row.column(align=True)
-        col.operator( "atom_pdb.radius_all_bigger" )
-        col.operator( "atom_pdb.radius_all_smaller" )
-        row = box.row()
-        row.label(text="4. Show sticks only")
-        row = box.row()
-        col = row.column()
-        col.operator( "atom_pdb.radius_sticks" )
-
-        if bpy.context.mode == 'EDIT_MESH':
-            row = layout.row()
-            row.label(text="Separate atom")
-            box = layout.box()
-            row = box.row()
-            row.operator( "atom_pdb.separate_atom" )
-
-
-# The properties (gadgets) in the panel. They all go to scene
-# during initialization (see end) 
-class CLASS_atom_pdb_Properties(bpy.types.PropertyGroup):
-
-    def Callback_radius_type(self, context):
-        scn = bpy.context.scene.atom_pdb[0]
-        import_pdb.DEF_atom_pdb_radius_type(
-                scn.radius_type,
-                scn.radius_how,)
-
-    def Callback_radius_pm(self, context):
-        scn = bpy.context.scene.atom_pdb[0]
-        import_pdb.DEF_atom_pdb_radius_pm(
-                scn.radius_pm_name,
-                scn.radius_pm,
-                scn.radius_how,)
-
-    # In the file dialog window - Import
-    use_camera = BoolProperty(
-        name="Camera", default=False,
-        description="Do you need a camera?")
-    use_lamp = BoolProperty(
-        name="Lamp", default=False,
-        description = "Do you need a lamp?")
-    use_mesh = BoolProperty(
-        name = "Mesh balls", default=False,
-        description = "Use mesh balls instead of NURBS")
-    mesh_azimuth = IntProperty(
-        name = "Azimuth", default=32, min=1,
-        description = "Number of sectors (azimuth)")
-    mesh_zenith = IntProperty(
-        name = "Zenith", default=32, min=1,
-        description = "Number of sectors (zenith)")
-    scale_ballradius = FloatProperty(
-        name = "Balls", default=1.0, min=0.0001,
-        description = "Scale factor for all atom radii")
-    scale_distances = FloatProperty (
-        name = "Distances", default=1.0, min=0.0001,
-        description = "Scale factor for all distances")
-    use_center = BoolProperty(
-        name = "Object to origin", default=True,
-        description = "Put the object into the global origin")
-    use_sticks = BoolProperty(
-        name="Use sticks", default=True,
-        description="Do you want to display the sticks?")
-    sticks_sectors = IntProperty(
-        name = "Sector", default=20, min=1,
-        description="Number of sectors of a stick")
-    sticks_radius = FloatProperty(
-        name = "Radius", default=0.1, min=0.0001,
-        description ="Radius of a stick")
-    sticks_unit_length = FloatProperty(
-        name = "Unit", default=0.05, min=0.0001,
-        description = "Length of the unit of a stick in Angstrom")        
-    use_sticks_color = BoolProperty(
-        name="Color", default=True,
-        description="The sticks appear in the color of the atoms")
-    use_sticks_smooth = BoolProperty(
-        name="Smooth", default=False,
-        description="The sticks are round (sectors are not visible)")     
-    use_sticks_bonds = BoolProperty(
-        name="Bonds", default=False,
-        description="Show double and tripple bonds.")
-    sticks_dist = FloatProperty(
-        name="Distance", default = 1.1, min=1.0, max=3.0,
-        description="Distance between sticks measured in stick diameter")        
-    atomradius = EnumProperty(
-        name="Type of radius",
-        description="Choose type of atom radius",
-        items=(('0', "Pre-defined", "Use pre-defined radius"),
-               ('1', "Atomic", "Use atomic radius"),
-               ('2', "van der Waals", "Use van der Waals radius")),
-               default='0',)  
-    # In the panel
-    datafile = StringProperty(
-        name = "", description="Path to your custom data file",
-        maxlen = 256, default = "", subtype='FILE_PATH')
-    PDB_file = StringProperty(
-        name = "PDB file", default="",
-        description = "Path of the PDB file")
-    number_atoms = StringProperty(name="",
-        default="Number", description = "This output shows "
-        "the number of atoms which have been loaded")
-    distance = StringProperty(
-        name="", default="Distance (A)",
-        description="Distance of 2 objects in Angstrom")
-    radius_how = EnumProperty(
-        name="",
-        description="Which objects shall be modified?",
-        items=(('ALL_ACTIVE',"all active objects", "in the current layer"),
-               ('ALL_IN_LAYER',"all"," in active layer(s)")),
-               default='ALL_ACTIVE',)
-    radius_type = EnumProperty(
-        name="Type",
-        description="Which type of atom radii?",
-        items=(('0',"predefined", "Use pre-defined radii"),
-               ('1',"atomic", "Use atomic radii"),
-               ('2',"van der Waals","Use van der Waals radii")),
-               default='0',update=Callback_radius_type)
-    radius_pm_name = StringProperty(
-        name="", default="Atom name",
-        description="Put in the name of the atom (e.g. Hydrogen)")
-    radius_pm = FloatProperty(
-        name="", default=100.0, min=0.01,
-        description="Put in the radius of the atom (in pm)",
-        update=Callback_radius_pm)
-    radius_all = FloatProperty(
-        name="Scale", default = 1.05, min=1.0, max=5.0,
-        description="Put in the scale factor")
-
-
-# Button loading a custom data file
-class CLASS_atom_pdb_datafile_apply(Operator):
-    bl_idname = "atom_pdb.datafile_apply"
-    bl_label = "Apply"
-    bl_description = "Use color and radii values stored in the custom file"
-
-    def execute(self, context):
-        scn    = bpy.context.scene.atom_pdb[0]
-
-        if scn.datafile == "":
-            return {'FINISHED'}
-
-        import_pdb.DEF_atom_pdb_custom_datafile(scn.datafile)
-
-        return {'FINISHED'}
-
-
-# Button for separating single objects from a atom mesh
-class CLASS_atom_pdb_separate_atom(Operator):
-    bl_idname = "atom_pdb.separate_atom"
-    bl_label = "Separate atom"
-    bl_description = "Separate the atom you have chosen"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_pdb[0]
-
-        # Get first all important properties from the atoms, which the user
-        # has chosen: location, color, scale
-        obj = bpy.context.edit_object
-        bm = bmesh.from_edit_mesh(obj.data)
-
-        locations = []
-
-        for v in bm.verts:
-            if v.select:
-                locations.append(obj.matrix_world * v.co)
-
-        bm.free()
-        del(bm)
-
-        name  = obj.name
-        scale = obj.children[0].scale
-        material = obj.children[0].active_material
-
-        # Separate the vertex from the main mesh and create a new mesh.
-        bpy.ops.mesh.separate()
-        new_object = bpy.context.scene.objects[0]
-        # And now, switch to the OBJECT mode such that we can ...
-        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-        # ... delete the new mesh including the separated vertex
-        bpy.ops.object.select_all(action='DESELECT')
-        new_object.select = True
-        bpy.ops.object.delete()  
-
-        # Create new atoms/vacancies at the position of the old atoms
-        current_layers=bpy.context.scene.layers
-
-        # For all selected positions do:
-        for location in locations:
-            if "Vacancy" not in name:
-                if scn.use_mesh == False:
-                    bpy.ops.surface.primitive_nurbs_surface_sphere_add(
-                                    view_align=False, enter_editmode=False,
-                                    location=location,
-                                    rotation=(0.0, 0.0, 0.0),
-                                    layers=current_layers)
-                else:
-                    bpy.ops.mesh.primitive_uv_sphere_add(
-                                segments=scn.mesh_azimuth,
-                                ring_count=scn.mesh_zenith,
-                                size=1, view_align=False, enter_editmode=False,
-                                location=location,
-                                rotation=(0, 0, 0),
-                                layers=current_layers)
-            else:
-                bpy.ops.mesh.primitive_cube_add(
-                               view_align=False, enter_editmode=False,
-                               location=location,
-                               rotation=(0.0, 0.0, 0.0),
-                               layers=current_layers)
-
-            new_atom = bpy.context.scene.objects.active
-            # Scale, material and name it.
-            new_atom.scale = scale
-            new_atom.active_material = material
-            new_atom.name = name + "_sep"
-            new_atom.select = False
-
-        bpy.context.scene.objects.active = obj
-        bpy.ops.object.select_all(action='DESELECT')
-
-        return {'FINISHED'}
-
-
-# Button for measuring the distance of the active objects
-class CLASS_atom_pdb_distance_button(Operator):
-    bl_idname = "atom_pdb.button_distance"
-    bl_label = "Measure ..."
-    bl_description = "Measure the distance between two objects (only in Object Mode)"
-
-    def execute(self, context):
-        scn    = bpy.context.scene.atom_pdb[0]
-        dist   = import_pdb.DEF_atom_pdb_distance()
-
-        if dist != "N.A.":
-           # The string length is cut, 3 digits after the first 3 digits
-           # after the '.'. Append also "Angstrom".
-           # Remember: 1 Angstrom = 10^(-10) m
-           pos    = str.find(dist, ".")
-           dist   = dist[:pos+4]
-           dist   = dist + " A"
-
-        # Put the distance into the string of the output field.
-        scn.distance = dist
-        return {'FINISHED'}
-
-
-# Button for increasing the radii of all atoms
-class CLASS_atom_pdb_radius_all_bigger_button(Operator):
-    bl_idname = "atom_pdb.radius_all_bigger"
-    bl_label = "Bigger ..."
-    bl_description = "Increase the radii of the atoms"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_pdb[0]
-        import_pdb.DEF_atom_pdb_radius_all(
-                scn.radius_all,
-                scn.radius_how,)
-        return {'FINISHED'}
-
-
-# Button for decreasing the radii of all atoms
-class CLASS_atom_pdb_radius_all_smaller_button(Operator):
-    bl_idname = "atom_pdb.radius_all_smaller"
-    bl_label = "Smaller ..."
-    bl_description = "Decrease the radii of the atoms"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_pdb[0]
-        import_pdb.DEF_atom_pdb_radius_all(
-                1.0/scn.radius_all,
-                scn.radius_how,)
-        return {'FINISHED'}
-
-
-# Button for showing the sticks only - the radii of the atoms downscaled onto
-# 90% of the stick radius
-class CLASS_atom_pdb_radius_sticks_button(Operator):
-    bl_idname = "atom_pdb.radius_sticks"
-    bl_label = "Show sticks"
-    bl_description = "Show only the sticks (atom radii = stick radii)"
-
-    def execute(self, context):
-        global ATOM_PDB_ERROR
-        scn = bpy.context.scene.atom_pdb[0]
-                
-        result = import_pdb.DEF_atom_pdb_radius_sticks(
-                     0.01,
-                     scn.radius_how,)  
-        if result == False:
-            ATOM_PDB_ERROR = "No sticks => no changes"
-            bpy.ops.atom_pdb.error_dialog('INVOKE_DEFAULT')
-                                          
-        return {'FINISHED'}
-
-
-# The button for reloading the atoms and creating the scene
-class CLASS_atom_pdb_load_button(Operator):
-    bl_idname = "atom_pdb.button_reload"
-    bl_label = "RELOAD"
-    bl_description = "Load the structure again"
-
-    def execute(self, context):
-        scn = context.scene.atom_pdb[0]
-        
-        atom_number = import_pdb.DEF_atom_pdb_main(
-                      scn.use_mesh,
-                      scn.mesh_azimuth,
-                      scn.mesh_zenith,
-                      scn.scale_ballradius,
-                      scn.atomradius,
-                      scn.scale_distances,
-                      scn.use_sticks,
-                      scn.use_sticks_color,
-                      scn.use_sticks_smooth,
-                      scn.use_sticks_bonds,
-                      scn.sticks_unit_length,
-                      scn.sticks_dist,
-                      scn.sticks_sectors,
-                      scn.sticks_radius,
-                      scn.use_center,
-                      scn.use_camera,
-                      scn.use_lamp,
-                      scn.datafile)     
-                      
-        scn.number_atoms = str(atom_number) + " atoms"
-
-        return {'FINISHED'}
-
-
-def DEF_panel_yes_no():
-    global ATOM_PDB_PANEL
-
-    datafile_path = bpy.utils.user_resource('SCRIPTS', path='', create=False)
-    if os.path.isdir(datafile_path) == False:
-        bpy.utils.user_resource('SCRIPTS', path='', create=True)
-    datafile_path = os.path.join(datafile_path, "presets")
-    if os.path.isdir(datafile_path) == False:
-        os.mkdir(datafile_path)   
-    datafile = os.path.join(datafile_path, "io_mesh_pdb.pref")
-    if os.path.isfile(datafile):
-        datafile_fp = io.open(datafile, "r")
-        for line in datafile_fp:
-            if "Panel" in line:
-                ATOM_PDB_PANEL = line[-2:]
-                ATOM_PDB_PANEL = ATOM_PDB_PANEL[0:1]
-                bpy.context.scene.use_panel = ATOM_PDB_PANEL
-                break       
-        datafile_fp.close()
-    else:
-        DEF_panel_write_pref("0") 
-
-
-def DEF_panel_write_pref(value): 
-    datafile_path = bpy.utils.user_resource('SCRIPTS', path='', create=False)
-    datafile_path = os.path.join(datafile_path, "presets")
-    datafile = os.path.join(datafile_path, "io_mesh_pdb.pref")
-    datafile_fp = io.open(datafile, "w")
-    datafile_fp.write("Atomic Blender PDB - Import/Export - Preferences\n")
-    datafile_fp.write("================================================\n")
-    datafile_fp.write("\n")
-    datafile_fp.write("Panel: "+value+"\n\n\n")
-    datafile_fp.close()        
-
-
-class CLASS_atom_pdb_error_dialog(bpy.types.Operator):
-    bl_idname = "atom_pdb.error_dialog"
-    bl_label = "Attention !"
-    
-    def draw(self, context):
-        layout = self.layout
-        row = layout.row()
-        row.label(text="                          "+ATOM_PDB_ERROR) 
-    def execute(self, context):
-        print("Atomic Blender - Error: "+ATOM_PDB_ERROR+"\n")
-        return {'FINISHED'}
-    def invoke(self, context, event):
-        return context.window_manager.invoke_props_dialog(self)        
-
-
 # This is the class for the file dialog of the importer.
-class CLASS_ImportPDB(Operator, ImportHelper):
+class ImportPDB(Operator, ImportHelper):
     bl_idname = "import_mesh.pdb"
     bl_label  = "Import Protein Data Bank(*.pdb)"
     bl_options = {'PRESET', 'UNDO'}
@@ -566,22 +73,19 @@ class CLASS_ImportPDB(Operator, ImportHelper):
     filename_ext = ".pdb"
     filter_glob  = StringProperty(default="*.pdb", options={'HIDDEN'},)
 
-    bpy.types.Scene.use_panel = EnumProperty(
-        name="Panel",
-        description="Choose whether the panel shall appear or not in the View 3D.",
-        items=(('0', "Once", "The panel appears only in this session"),
-               ('1', "Always", "The panel always appears when Blender is started"),
-               ('2', "Never", "The panel never appears")),
-               default='0')  
     use_camera = BoolProperty(
         name="Camera", default=False,
         description="Do you need a camera?")
     use_lamp = BoolProperty(
         name="Lamp", default=False,
         description = "Do you need a lamp?")
-    use_mesh = BoolProperty(
-        name = "Mesh balls", default=False,
-        description = "Use mesh balls instead of NURBS")
+    ball = EnumProperty(
+        name="Type of ball",
+        description="Choose ball",
+        items=(('0', "NURBS", "NURBS balls"),
+               ('1', "Mesh" , "Mesh balls"),
+               ('2', "Meta" , "Metaballs")),
+               default='0',) 
     mesh_azimuth = IntProperty(
         name = "Azimuth", default=32, min=1,
         description = "Number of sectors (azimuth)")
@@ -639,9 +143,10 @@ class CLASS_ImportPDB(Operator, ImportHelper):
         row.prop(self, "use_lamp")
         row = layout.row()
         col = row.column()
-        col.prop(self, "use_mesh")
-        col = row.column(align=True)
-        col.active = self.use_mesh
+        col.prop(self, "ball")
+        row = layout.row()
+        row.active = (self.ball == "1")
+        col = row.column(align=True)             
         col.prop(self, "mesh_azimuth")
         col.prop(self, "mesh_zenith")
         row = layout.row()
@@ -673,16 +178,14 @@ class CLASS_ImportPDB(Operator, ImportHelper):
         col.prop(self, "sticks_dist")
         row = layout.row()
         row.prop(self, "use_center")
-        row = layout.row()
-        row.prop(bpy.context.scene, "use_panel")
 
     def execute(self, context):
         # This is in order to solve this strange 'relative path' thing.
-        import_pdb.ATOM_PDB_FILEPATH = bpy.path.abspath(self.filepath)
+        filepath_pdb = bpy.path.abspath(self.filepath)
 
         # Execute main routine                
-        atom_number = import_pdb.DEF_atom_pdb_main(
-                      self.use_mesh,
+        import_pdb.import_pdb(
+                      self.ball,
                       self.mesh_azimuth,
                       self.mesh_zenith,
                       self.scale_ballradius,
@@ -699,42 +202,13 @@ class CLASS_ImportPDB(Operator, ImportHelper):
                       self.use_center,
                       self.use_camera,
                       self.use_lamp,
-                      self.datafile)        
-
-        # Copy the whole bunch of values into the property collection.
-        scn = context.scene.atom_pdb[0]
-        scn.use_mesh = self.use_mesh
-        scn.mesh_azimuth = self.mesh_azimuth
-        scn.mesh_zenith = self.mesh_zenith
-        scn.scale_ballradius = self.scale_ballradius
-        scn.atomradius = self.atomradius
-        scn.scale_distances = self.scale_distances
-        scn.use_sticks = self.use_sticks
-        scn.use_sticks_color = self.use_sticks_color
-        scn.use_sticks_smooth = self.use_sticks_smooth
-        scn.use_sticks_bonds = self.use_sticks_bonds
-        scn.sticks_unit_length = self.sticks_unit_length
-        scn.sticks_dist = self.sticks_dist
-        scn.sticks_sectors = self.sticks_sectors
-        scn.sticks_radius = self.sticks_radius
-        scn.use_center = self.use_center
-        scn.use_camera = self.use_camera
-        scn.use_lamp = self.use_lamp
-        scn.datafile = self.datafile
-        
-        scn.number_atoms = str(atom_number) + " atoms"
-        scn.PDB_file = import_pdb.ATOM_PDB_FILEPATH
-      
-        global ATOM_PDB_PANEL
-        ATOM_PDB_PANEL = bpy.context.scene.use_panel
-        DEF_panel_write_pref(bpy.context.scene.use_panel)
+                      filepath_pdb)        
 
         return {'FINISHED'}
 
 
-
 # This is the class for the file dialog of the exporter.
-class CLASS_ExportPDB(Operator, ExportHelper):
+class ExportPDB(Operator, ExportHelper):
     bl_idname = "export_mesh.pdb"
     bl_label  = "Export Protein Data Bank(*.pdb)"
     filename_ext = ".pdb"
@@ -756,34 +230,29 @@ class CLASS_ExportPDB(Operator, ExportHelper):
         row.prop(self, "atom_pdb_export_type")
 
     def execute(self, context):
-        # This is in order to solve this strange 'relative path' thing.
-        export_pdb.ATOM_PDB_FILEPATH = bpy.path.abspath(self.filepath)
-        export_pdb.DEF_atom_pdb_export(self.atom_pdb_export_type)
+        export_pdb.export_pdb(self.atom_pdb_export_type,
+                              bpy.path.abspath(self.filepath))
 
         return {'FINISHED'}
 
 
 # The entry into the menu 'file -> import'
-def DEF_menu_func_import(self, context):
-    self.layout.operator(CLASS_ImportPDB.bl_idname, text="Protein Data Bank (.pdb)")
+def menu_func_import(self, context):
+    self.layout.operator(ImportPDB.bl_idname, text="Protein Data Bank (.pdb)")
 
 # The entry into the menu 'file -> export'
-def DEF_menu_func_export(self, context):
-    self.layout.operator(CLASS_ExportPDB.bl_idname, text="Protein Data Bank (.pdb)")
-
+def menu_func_export(self, context):
+    self.layout.operator(ExportPDB.bl_idname, text="Protein Data Bank (.pdb)")
 
 def register():
-    DEF_panel_yes_no()
     bpy.utils.register_module(__name__)
-    bpy.types.INFO_MT_file_import.append(DEF_menu_func_import)
-    bpy.types.INFO_MT_file_export.append(DEF_menu_func_export)
-    bpy.types.Scene.atom_pdb = bpy.props.CollectionProperty(type=CLASS_atom_pdb_Properties)    
-    bpy.context.scene.atom_pdb.add()
+    bpy.types.INFO_MT_file_import.append(menu_func_import)
+    bpy.types.INFO_MT_file_export.append(menu_func_export)
     
 def unregister():
     bpy.utils.unregister_module(__name__)
-    bpy.types.INFO_MT_file_import.remove(DEF_menu_func_import)
-    bpy.types.INFO_MT_file_export.remove(DEF_menu_func_export)
+    bpy.types.INFO_MT_file_import.remove(menu_func_import)
+    bpy.types.INFO_MT_file_export.remove(menu_func_export)
 
 if __name__ == "__main__":
 
diff --git a/release/scripts/addons/io_mesh_pdb/export_pdb.py b/release/scripts/addons/io_mesh_pdb/export_pdb.py
index a7a67bf..81b60cb 100644
--- a/release/scripts/addons/io_mesh_pdb/export_pdb.py
+++ b/release/scripts/addons/io_mesh_pdb/export_pdb.py
@@ -17,32 +17,17 @@
 # ##### END GPL LICENSE BLOCK #####
 
 import bpy
-import io
-import math
-import os
-import copy
-from math import pi, cos, sin
-from mathutils import Vector, Matrix
-from copy import copy
 
 from . import import_pdb
 
-ATOM_PDB_FILEPATH = ""
-ATOM_PDB_PDBTEXT  = (  "REMARK This pdb file has been created with Blender "
-                     + "and the Atomic Blender script\n"
-                     + "REMARK For more details see wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/PDB\n"
-                     + "REMARK\n"
-                     + "REMARK\n")
-
-
-class CLASS_atom_pdb_atoms_export(object):  
+class AtomPropExport(object):  
     __slots__ = ('element', 'location')
     def __init__(self, element, location):
         self.element  = element
         self.location = location
 
 
-def DEF_atom_pdb_export(obj_type):
+def export_pdb(obj_type, filepath_pdb):
 
     list_atoms = []
     for obj in bpy.context.selected_objects:
@@ -50,21 +35,16 @@ def DEF_atom_pdb_export(obj_type):
         if "Stick" in obj.name:
             continue
             
-        if obj.type != "SURFACE" and obj.type != "MESH":
+        if obj.type not in {'MESH', 'SURFACE', 'META'}:
             continue 
        
         name = ""
-        for element in import_pdb.ATOM_PDB_ELEMENTS_DEFAULT:
+        for element in import_pdb.ELEMENTS_DEFAULT:
             if element[1] in obj.name:
                 if element[2] == "Vac":
                     name = "X"
                 else:
                     name = element[2]
-            elif element[1][:3] in obj.name:
-                if element[2] == "Vac":
-                    name = "X"
-                else:
-                    name = element[2]
         
         if name == "":
             if obj_type == "0":
@@ -74,17 +54,20 @@ def DEF_atom_pdb_export(obj_type):
 
         if len(obj.children) != 0:
             for vertex in obj.data.vertices:
-                list_atoms.append(CLASS_atom_pdb_atoms_export(
-                                                       name,
-                                                       obj.location+vertex.co))
+                location = obj.matrix_world*vertex.co
+                list_atoms.append(AtomPropExport(name, location))
         else:
             if not obj.parent:
-                list_atoms.append(CLASS_atom_pdb_atoms_export(
-                                                       name,
-                                                       obj.location))
+                location = obj.location
+                list_atoms.append(AtomPropExport(name, location))
 
-    pdb_file_p = open(ATOM_PDB_FILEPATH, "w")
-    pdb_file_p.write(ATOM_PDB_PDBTEXT)
+    pdb_file_p = open(filepath_pdb, "w")
+    pdb_file_p.write("REMARK This pdb file has been created with Blender "
+                     "and the addon Atomic Blender - PDB\n"
+                     "REMARK For more details see wiki.blender.org/index.php/"
+                     "Extensions:2.6/Py/Scripts/Import-Export/PDB\n"
+                     "REMARK\n"
+                     "REMARK\n")
 
     for i, atom in enumerate(list_atoms):
         string = "ATOM %6d%3s%24.3f%8.3f%8.3f%6.2f%6.2f%12s\n" % (
diff --git a/release/scripts/addons/io_mesh_pdb/import_pdb.py b/release/scripts/addons/io_mesh_pdb/import_pdb.py
index a24d8ae..5463980 100644
--- a/release/scripts/addons/io_mesh_pdb/import_pdb.py
+++ b/release/scripts/addons/io_mesh_pdb/import_pdb.py
@@ -17,26 +17,10 @@
 # ##### END GPL LICENSE BLOCK #####
 
 import bpy
-import io
-import math
-import os
-import copy
-from math import pi, cos, sin
+from math import pi, cos, sin, sqrt, ceil
 from mathutils import Vector, Matrix
 from copy import copy
 
-# These are variables, which contain the name of the PDB file and
-# the path of the PDB file.
-# They are used almost everywhere, which is the reason why they
-# should stay global. First, they are empty and get 'filled' directly
-# after having chosen the PDB file (see 'class LoadPDB' further below).
-
-ATOM_PDB_FILEPATH = ""
-
-# Some string stuff for the console.
-ATOM_PDB_STRING = "Atomic Blender\n==================="
-
-
 # -----------------------------------------------------------------------------
 #                                                  Atom, stick and element data
 
@@ -52,7 +36,7 @@ ATOM_PDB_STRING = "Atomic Blender\n==================="
 # charge states for any atom are listed, if existing.
 # The list is fixed and cannot be changed ... (see below)
 
-ATOM_PDB_ELEMENTS_DEFAULT = (
+ELEMENTS_DEFAULT = (
 ( 1,      "Hydrogen",        "H", (  1.0,   1.0,   1.0), 0.32, 0.32, 0.79 , -1 , 1.54 ),
 ( 2,        "Helium",       "He", ( 0.85,   1.0,   1.0), 0.93, 0.93, 0.49 ),
 ( 3,       "Lithium",       "Li", (  0.8,  0.50,   1.0), 1.23, 1.23, 2.05 ,  1 , 0.68 ),
@@ -164,14 +148,14 @@ ATOM_PDB_ELEMENTS_DEFAULT = (
 # This list here contains all data of the elements and will be used during
 # runtime. It is a list of classes.
 # During executing Atomic Blender, the list will be initialized with the fixed
-# data from above via the class structure below (CLASS_atom_pdb_Elements). We
+# data from above via the class structure below (ElementProp). We
 # have then one fixed list (above), which will never be changed, and a list of
 # classes with same data. The latter can be modified via loading a separate
 # custom data file.
-ATOM_PDB_ELEMENTS = []
+ELEMENTS = []
 
 # This is the class, which stores the properties for one element.
-class CLASS_atom_pdb_Elements(object):
+class ElementProp(object):
     __slots__ = ('number', 'name', 'short_name', 'color', 'radii', 'radii_ionic')
     def __init__(self, number, name, short_name, color, radii, radii_ionic):
         self.number = number
@@ -182,7 +166,7 @@ class CLASS_atom_pdb_Elements(object):
         self.radii_ionic = radii_ionic
 
 # This is the class, which stores the properties of one atom.
-class CLASS_atom_pdb_atom(object):  
+class AtomProp(object):  
     __slots__ = ('element', 'name', 'location', 'radius', 'color', 'material')
     def __init__(self, element, name, location, radius, color, material):
         self.element = element
@@ -193,7 +177,7 @@ class CLASS_atom_pdb_atom(object):
         self.material = material
 
 # This is the class, which stores the two atoms of one stick.
-class CLASS_atom_pdb_stick(object):
+class StickProp(object):
     __slots__ = ('atom1', 'atom2', 'number', 'dist')
     def __init__(self, atom1, atom2, number, dist):
         self.atom1 = atom1
@@ -202,396 +186,13 @@ class CLASS_atom_pdb_stick(object):
         self.dist = dist
 
 # -----------------------------------------------------------------------------
-#                                                          Some small routines
-
-# Routine which produces a cylinder. All is somewhat easy to undertsand.
-def DEF_atom_pdb_build_stick(radius, length, sectors):
-
-    dphi = 2.0 * pi/(float(sectors)-1)
-
-    # Vertices
-    vertices_top    = [Vector((0,0,length / 2.0))]
-    vertices_bottom = [Vector((0,0,-length / 2.0))]
-    vertices = []
-    for i in range(sectors-1):
-        x = radius * cos( dphi * i )
-        y = radius * sin( dphi * i )
-        z =  length / 2.0
-        vertex = Vector((x,y,z))
-        vertices_top.append(vertex)
-        z = -length / 2.0
-        vertex = Vector((x,y,z))
-        vertices_bottom.append(vertex)
-    vertices = vertices_top + vertices_bottom
-
-    # Side facets (Cylinder)
-    faces1 = []    
-    for i in range(sectors-1):
-        if i == sectors-2:
-            faces1.append(  [i+1, 1, 1+sectors, i+1+sectors] )
-        else:
-            faces1.append(  [i+1, i+2, i+2+sectors, i+1+sectors] )
-
-    # Top facets
-    faces2 = []    
-    for i in range(sectors-1):
-        if i == sectors-2:
-            face_top = [0,sectors-1,1]
-            face_bottom = [sectors,2*sectors-1,sectors+1]
-        else:
-            face_top    = [0]
-            face_bottom = [sectors]
-            for j in range(2):
-                face_top.append(i+j+1)
-                face_bottom.append(i+j+1+sectors)
-        faces2.append(face_top)
-        faces2.append(face_bottom)
-
-    # Build the mesh, Cylinder
-    cylinder = bpy.data.meshes.new("Sticks_Cylinder")
-    cylinder.from_pydata(vertices, [], faces1)
-    cylinder.update()
-    new_cylinder = bpy.data.objects.new("Sticks_Cylinder", cylinder)
-    bpy.context.scene.objects.link(new_cylinder)
-
-    # Build the mesh, Cups
-    cups = bpy.data.meshes.new("Sticks_Cups")
-    cups.from_pydata(vertices, [], faces2)
-    cups.update()
-    new_cups = bpy.data.objects.new("Sticks_Cups", cups)
-    bpy.context.scene.objects.link(new_cups)
-
-    return (new_cylinder, new_cups)
-
-
-# This function measures the distance between two active objects (atoms).
-def DEF_atom_pdb_distance():
-
-    if len(bpy.context.selected_bases) > 1:
-        object_1 = bpy.context.selected_objects[0]
-        object_2 = bpy.context.selected_objects[1]
-    else:
-        return "N.A."
-
-    dv = object_2.location - object_1.location
-    return str(dv.length)
-
-
-# Routine to modify the radii via the type: predefined, atomic or van der Waals
-# Explanations here are also valid for the next 3 DEFs.
-def DEF_atom_pdb_radius_type(rtype,how):
-
-    if how == "ALL_IN_LAYER":
-
-        # Note all layers that are active.
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-
-        # Put all objects, which are in the layers, into a list.
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-
-        # Consider all objects, which are in the list 'change_objects'.
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    for element in ATOM_PDB_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.children[0].scale = (element.radii[int(rtype)],) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    for element in ATOM_PDB_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[int(rtype)],) * 3
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    for element in ATOM_PDB_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.children[0].scale = (element.radii[int(rtype)],) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    for element in ATOM_PDB_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[int(rtype)],) * 3
-
-
-# Routine to modify the radii in picometer of a specific type of atom
-def DEF_atom_pdb_radius_pm(atomname, radius_pm, how):
-
-    if how == "ALL_IN_LAYER":
-
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if atomname in obj.name:
-                        if "Stick" not in obj.name:
-                            obj.children[0].scale = (radius_pm/100,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if atomname in obj.name:
-                        if "Stick" not in obj.name:
-                            obj.scale = (radius_pm/100,) * 3
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if atomname in obj.name:
-                        if "Stick" not in obj.name:
-                            obj.children[0].scale = (radius_pm/100,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if atomname in obj.name:
-                        if "Stick" not in obj.name:
-                            obj.scale = (radius_pm/100,) * 3
-
-
-# Routine to scale the radii of all atoms
-def DEF_atom_pdb_radius_all(scale, how):
-
-    if how == "ALL_IN_LAYER":
-
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-
-
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.children[0].scale *= scale
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.scale *= scale
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.children[0].scale *= scale
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.scale *= scale
-
-
-# This routine downscales all atom radii onto the value of the stick radius
-# for showing the sticks.
-def DEF_atom_pdb_radius_sticks(radius, how):
-
-    # Are there any sticks?
-    Found = False
-    if how == "ALL_IN_LAYER":
-
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" in obj.name:
-                        Found = True
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" in obj.name:
-                        Found = True
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" in obj.name:
-                        Found = True
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" in obj.name:
-                        Found = True
+#                                                           Some basic routines  
 
-    if Found == False:
-        return False
+def read_elements():
 
-    if how == "ALL_IN_LAYER":
+    del ELEMENTS[:]
 
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-
-
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.children[0].scale = (radius,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.scale = (radius,) * 3
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.children[0].scale = (radius,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if "Stick" not in obj.name:
-                        obj.scale = (radius,) * 3
-
-    return True
-
-# -----------------------------------------------------------------------------
-#                                                         The custom data file
-
-def DEF_atom_pdb_custom_datafile(path_datafile):
-
-    if path_datafile == "":
-        return False
-
-    path_datafile = bpy.path.abspath(path_datafile)
-
-    if os.path.isfile(path_datafile) == False:
-        return False
-
-    # The whole list gets deleted! We build it new.
-    ATOM_PDB_ELEMENTS[:] = []
-
-    # Read the data file, which contains all data
-    # (atom name, radii, colors, etc.)
-    data_file_p = io.open(path_datafile, "r")
-
-    for line in data_file_p:
-
-        if "Atom" in line:
-
-            line = data_file_p.readline()
-
-            # Number
-            line = data_file_p.readline()
-            number = line[19:-1]
-            # Name
-            line = data_file_p.readline()
-            name = line[19:-1]
-            # Short name
-            line = data_file_p.readline()
-            short_name = line[19:-1]
-            # Color
-            line = data_file_p.readline()
-            color_value = line[19:-1].split(',')
-            color = [float(color_value[0]),
-                     float(color_value[1]),
-                     float(color_value[2])]
-            # Used radius
-            line = data_file_p.readline()
-            radius_used = float(line[19:-1])
-            # Atomic radius
-            line = data_file_p.readline()
-            radius_atomic = float(line[19:-1])
-            # Van der Waals radius
-            line = data_file_p.readline()
-            radius_vdW = float(line[19:-1])
-
-            radii = [radius_used,radius_atomic,radius_vdW]
-            radii_ionic = []
-
-            element = CLASS_atom_pdb_Elements(number,name,short_name,color,
-                                              radii, radii_ionic)
-
-            ATOM_PDB_ELEMENTS.append(element)
-
-    data_file_p.close()
-    
-    for obj in bpy.context.selected_objects:
-        if len(obj.children) != 0:
-            child = obj.children[0]
-            if child.type == "SURFACE" or child.type  == "MESH":
-                for element in ATOM_PDB_ELEMENTS:
-                    if element.name in obj.name:
-                        child.scale = (element.radii[0],) * 3
-                        child.active_material.diffuse_color = element.color
-        else:
-            if obj.type == "SURFACE" or obj.type == "MESH":
-                for element in ATOM_PDB_ELEMENTS:
-                    if element.name in obj.name:
-                        obj.scale = (element.radii[0],) * 3
-                        obj.active_material.diffuse_color = element.color
-                        
-    return True
-
-# -----------------------------------------------------------------------------
-#                                                            The main routine
-
-def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
-               Ball_radius_factor,radiustype,Ball_distance_factor,
-               use_sticks,use_sticks_color,use_sticks_smooth,
-               use_sticks_bonds, Stick_unit, Stick_dist,
-               Stick_sectors,Stick_diameter,put_to_center,
-               use_camera,use_lamp,path_datafile):
-
-    # The list of all atoms as read from the PDB file.
-    all_atoms  = []
-
-    # The list of all sticks.
-    all_sticks = []
-
-    # List of materials
-    atom_material_list = []
-
-    # A list of ALL objects which are loaded (needed for selecting the loaded
-    # structure.
-    atom_object_list = []
-
-
-    # ------------------------------------------------------------------------
-    # INITIALIZE THE ELEMENT LIST
-
-    ATOM_PDB_ELEMENTS[:] = []
-
-    for item in ATOM_PDB_ELEMENTS_DEFAULT:
+    for item in ELEMENTS_DEFAULT:
 
         # All three radii into a list
         radii = [item[4],item[5],item[6]]
@@ -599,21 +200,25 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         # empty list.
         radii_ionic = []
 
-        li = CLASS_atom_pdb_Elements(item[0],item[1],item[2],item[3],
+        li = ElementProp(item[0],item[1],item[2],item[3],
                                      radii,radii_ionic)
-        ATOM_PDB_ELEMENTS.append(li)
+        ELEMENTS.append(li)
 
-    # ------------------------------------------------------------------------
-    # READING DATA OF ATOMS
 
-    if DEF_atom_pdb_custom_datafile(path_datafile):
-        print("Custom data file is loaded.")
+# filepath_pdb: path to pdb file
+# radiustype  : '0' default
+#               '1' atomic radii
+#               '2' van der Waals
+def read_pdb_file(filepath_pdb, radiustype):
 
-    # Open the file ...
-    ATOM_PDB_FILEPATH_p = io.open(ATOM_PDB_FILEPATH, "r")
+    # The list of all atoms as read from the PDB file.
+    all_atoms  = []
+
+    # Open the pdb file ...
+    filepath_pdb_p = open(filepath_pdb, "r")
 
     #Go to the line, in which "ATOM" or "HETATM" appears.
-    for line in ATOM_PDB_FILEPATH_p:
+    for line in filepath_pdb_p:
         split_list = line.split(' ')
         if "ATOM" in split_list[0]:
             break
@@ -639,11 +244,12 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
             color = [0,0,0]
             location = Vector((0,0,0))
             # Append the TER into the list. Material remains empty so far.
-            all_atoms.append(CLASS_atom_pdb_atom(short_name,
-                                                 name,
-                                                 location,
-                                                 radius,
-                                                 color,[]))
+            all_atoms.append(AtomProp(short_name, 
+                                      name, 
+                                      location, 
+                                      radius,
+                                      color,[]))
+                                      
         # If 'ATOM or 'HETATM' appears in the line then do ...
         elif "ATOM" in line or "HETATM" in line:
 
@@ -673,7 +279,7 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                 
                 if short_name2.isalpha() == True:
                     FOUND = False
-                    for element in ATOM_PDB_ELEMENTS:
+                    for element in ELEMENTS:
                         if str.upper(short_name2) == str.upper(element.short_name):
                             FOUND = True
                             break
@@ -681,10 +287,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                         short_name = short_name2
             # ....................................................... to here.
             
-
             # Go through all elements and find the element of the current atom.
             FLAG_FOUND = False
-            for element in ATOM_PDB_ELEMENTS:
+            for element in ELEMENTS:
                 if str.upper(short_name) == str.upper(element.short_name):
                     # Give the atom its proper names, color and radius:
                     short_name = str.upper(element.short_name)
@@ -703,16 +308,16 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                 if "X" in short_name:
                     short_name = "VAC"
                     name = "Vacancy"
-                    radius = float(ATOM_PDB_ELEMENTS[-3].radii[int(radiustype)])
-                    color = ATOM_PDB_ELEMENTS[-3].color
+                    radius = float(ELEMENTS[-3].radii[int(radiustype)])
+                    color = ELEMENTS[-3].color
                 # ... take what is written in the PDB file. These are somewhat
                 # unknown atoms. This should never happen, the element list is
                 # almost complete. However, we do this due to security reasons.
                 else:
                     short_name = str.upper(short_name)
                     name = str.upper(short_name)
-                    radius = float(ATOM_PDB_ELEMENTS[-2].radii[int(radiustype)])
-                    color = ATOM_PDB_ELEMENTS[-2].color
+                    radius = float(ELEMENTS[-2].radii[int(radiustype)])
+                    color = ELEMENTS[-2].color
 
             # x,y and z are at fixed positions in the PDB file.
             x = float(line[30:38].rsplit()[0])
@@ -724,86 +329,36 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
             j += 1
 
             # Append the atom to the list. Material remains empty so far.
-            all_atoms.append(CLASS_atom_pdb_atom(short_name,
-                                             name,
-                                             location,
-                                             radius,
-                                             color,[]))
+            all_atoms.append(AtomProp(short_name,
+                                      name,
+                                      location,
+                                      radius,
+                                      color,[]))
 
-        line = ATOM_PDB_FILEPATH_p.readline()
+        line = filepath_pdb_p.readline()
         line = line[:-1]
 
-    ATOM_PDB_FILEPATH_p.close()
+    filepath_pdb_p.close()
     # From above it can be clearly seen that j is now the number of all atoms.
     Number_of_total_atoms = j
 
-    # ------------------------------------------------------------------------
-    # MATERIAL PROPERTIES FOR ATOMS
-
-    # The list that contains info about all types of atoms is created
-    # here. It is used for building the material properties for
-    # instance (see below).
-    atom_all_types_list = []
-
-    for atom in all_atoms:
-        FLAG_FOUND = False
-        for atom_type in atom_all_types_list:
-            # If the atom name is already in the list, FLAG on 'True'.
-            if atom_type[0] == atom.name:
-                FLAG_FOUND = True
-                break
-        # No name in the current list has been found? => New entry.
-        if FLAG_FOUND == False:
-            # Stored are: Atom label (e.g. 'Na'), the corresponding atom
-            # name (e.g. 'Sodium') and its color.
-            atom_all_types_list.append([atom.name, atom.element, atom.color])
-
-    # The list of materials is built.
-    # Note that all atoms of one type (e.g. all hydrogens) get only ONE
-    # material! This is good because then, by activating one atom in the
-    # Blender scene and changing the color of this atom, one changes the color
-    # of ALL atoms of the same type at the same time.
-
-    # Create first a new list of materials for each type of atom
-    # (e.g. hydrogen)
-    for atom_type in atom_all_types_list:
-        material = bpy.data.materials.new(atom_type[1])
-        material.name = atom_type[0]
-        material.diffuse_color = atom_type[2]
-        atom_material_list.append(material)
+    return (Number_of_total_atoms, all_atoms)
+    
 
-    # Now, we go through all atoms and give them a material. For all atoms ...
-    for atom in all_atoms:
-        # ... and all materials ...
-        for material in atom_material_list:
-            # ... select the correct material for the current atom via
-            # comparison of names ...
-            if atom.name in material.name:
-                # ... and give the atom its material properties.
-                # However, before we check, if it is a vacancy, because then it
-                # gets some additional preparation. The vacancy is represented
-                # by a transparent cube.
-                if atom.name == "Vacancy":
-                    material.transparency_method = 'Z_TRANSPARENCY'
-                    material.alpha = 1.3
-                    material.raytrace_transparency.fresnel = 1.6
-                    material.raytrace_transparency.fresnel_factor = 1.6
-                    material.use_transparency = True
-                # The atom gets its properties.
-                atom.material = material
+def read_pdb_file_sticks(filepath_pdb, use_sticks_bonds, all_atoms):
 
-    # ------------------------------------------------------------------------
-    # READING DATA OF STICKS
+    # The list of all sticks.
+    all_sticks = []
 
-    # Open the PDB file again such that the file pointer is in the first
-    # line ... . Stupid, I know ... ;-)
-    ATOM_PDB_FILEPATH_p = io.open(ATOM_PDB_FILEPATH, "r")
+    # Open the PDB file again.
+    filepath_pdb_p = open(filepath_pdb, "r")
 
+    line = filepath_pdb_p.readline()
     split_list = line.split(' ')
 
     # Go to the first entry
     if "CONECT" not in split_list[0]:
-        for line in ATOM_PDB_FILEPATH_p:
+        for line in filepath_pdb_p:
             split_list = line.split(' ')
             if "CONECT" in split_list[0]:
                 break
@@ -899,15 +454,180 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
             # If the stick is not yet registered (FLAG_BAR == False), then
             # register it!
             if FLAG_BAR == False:
-                all_sticks.append(CLASS_atom_pdb_stick(atom1,atom2,number,dist_n))
+                all_sticks.append(StickProp(atom1,atom2,number,dist_n))
                 Number_of_sticks += 1
                 j += 1
 
-        line = ATOM_PDB_FILEPATH_p.readline()
+        line = filepath_pdb_p.readline()
         line = line.rstrip()
 
-    ATOM_PDB_FILEPATH_p.close()
-    # So far, all atoms and sticks have been registered.
+    filepath_pdb_p.close()
+    
+    return all_sticks
+
+
+# Routine which produces a cylinder. All is somewhat easy to undertsand.
+def build_stick(radius, length, sectors):
+
+    dphi = 2.0 * pi/(float(sectors)-1)
+
+    # Vertices
+    vertices_top    = [Vector((0,0,length / 2.0))]
+    vertices_bottom = [Vector((0,0,-length / 2.0))]
+    vertices = []
+    for i in range(sectors-1):
+        x = radius * cos( dphi * i )
+        y = radius * sin( dphi * i )
+        z =  length / 2.0
+        vertex = Vector((x,y,z))
+        vertices_top.append(vertex)
+        z = -length / 2.0
+        vertex = Vector((x,y,z))
+        vertices_bottom.append(vertex)
+    vertices = vertices_top + vertices_bottom
+
+    # Side facets (Cylinder)
+    faces1 = []    
+    for i in range(sectors-1):
+        if i == sectors-2:
+            faces1.append(  [i+1, 1, 1+sectors, i+1+sectors] )
+        else:
+            faces1.append(  [i+1, i+2, i+2+sectors, i+1+sectors] )
+
+    # Top facets
+    faces2 = []    
+    for i in range(sectors-1):
+        if i == sectors-2:
+            face_top = [0,sectors-1,1]
+            face_bottom = [sectors,2*sectors-1,sectors+1]
+        else:
+            face_top    = [0]
+            face_bottom = [sectors]
+            for j in range(2):
+                face_top.append(i+j+1)
+                face_bottom.append(i+j+1+sectors)
+        faces2.append(face_top)
+        faces2.append(face_bottom)
+
+    # Build the mesh, Cylinder
+    cylinder = bpy.data.meshes.new("Sticks_Cylinder")
+    cylinder.from_pydata(vertices, [], faces1)
+    cylinder.update()
+    new_cylinder = bpy.data.objects.new("Sticks_Cylinder", cylinder)
+    bpy.context.scene.objects.link(new_cylinder)
+
+    # Build the mesh, Cups
+    cups = bpy.data.meshes.new("Sticks_Cups")
+    cups.from_pydata(vertices, [], faces2)
+    cups.update()
+    new_cups = bpy.data.objects.new("Sticks_Cups", cups)
+    bpy.context.scene.objects.link(new_cups)
+
+    return (new_cylinder, new_cups)
+
+
+# -----------------------------------------------------------------------------
+#                                                            The main routine
+
+def import_pdb(Ball_type,
+               Ball_azimuth,
+               Ball_zenith,
+               Ball_radius_factor,
+               radiustype,
+               Ball_distance_factor,
+               use_sticks,
+               use_sticks_color,
+               use_sticks_smooth,
+               use_sticks_bonds, 
+               Stick_unit, Stick_dist,
+               Stick_sectors,
+               Stick_diameter,
+               put_to_center,
+               use_camera,
+               use_lamp,
+               filepath_pdb):
+
+
+    # List of materials
+    atom_material_list = []
+
+    # A list of ALL objects which are loaded (needed for selecting the loaded
+    # structure.
+    atom_object_list = []
+
+    # ------------------------------------------------------------------------
+    # INITIALIZE THE ELEMENT LIST
+
+    read_elements()
+
+    # ------------------------------------------------------------------------
+    # READING DATA OF ATOMS
+
+    (Number_of_total_atoms, all_atoms) = read_pdb_file(filepath_pdb, radiustype)
+
+    # ------------------------------------------------------------------------
+    # MATERIAL PROPERTIES FOR ATOMS
+
+    # The list that contains info about all types of atoms is created
+    # here. It is used for building the material properties for
+    # instance (see below).
+    atom_all_types_list = []
+
+    for atom in all_atoms:
+        FLAG_FOUND = False
+        for atom_type in atom_all_types_list:
+            # If the atom name is already in the list, FLAG on 'True'.
+            if atom_type[0] == atom.name:
+                FLAG_FOUND = True
+                break
+        # No name in the current list has been found? => New entry.
+        if FLAG_FOUND == False:
+            # Stored are: Atom label (e.g. 'Na'), the corresponding atom
+            # name (e.g. 'Sodium') and its color.
+            atom_all_types_list.append([atom.name, atom.element, atom.color])
+
+    # The list of materials is built.
+    # Note that all atoms of one type (e.g. all hydrogens) get only ONE
+    # material! This is good because then, by activating one atom in the
+    # Blender scene and changing the color of this atom, one changes the color
+    # of ALL atoms of the same type at the same time.
+
+    # Create first a new list of materials for each type of atom
+    # (e.g. hydrogen)
+    for atom_type in atom_all_types_list:
+        material = bpy.data.materials.new(atom_type[1])
+        material.name = atom_type[0]
+        material.diffuse_color = atom_type[2]
+        atom_material_list.append(material)
+
+    # Now, we go through all atoms and give them a material. For all atoms ...
+    for atom in all_atoms:
+        # ... and all materials ...
+        for material in atom_material_list:
+            # ... select the correct material for the current atom via
+            # comparison of names ...
+            if atom.name in material.name:
+                # ... and give the atom its material properties.
+                # However, before we check, if it is a vacancy, because then it
+                # gets some additional preparation. The vacancy is represented
+                # by a transparent cube.
+                if atom.name == "Vacancy":
+                    material.transparency_method = 'Z_TRANSPARENCY'
+                    material.alpha = 1.3
+                    material.raytrace_transparency.fresnel = 1.6
+                    material.raytrace_transparency.fresnel_factor = 1.6
+                    material.use_transparency = True
+                # The atom gets its properties.
+                atom.material = material
+
+    # ------------------------------------------------------------------------
+    # READING DATA OF STICKS
+
+    all_sticks = read_pdb_file_sticks(filepath_pdb, 
+                                      use_sticks_bonds, 
+                                      all_atoms)
+
+    # So far, all atoms, sticks and materials have been registered.
 
     # ------------------------------------------------------------------------
     # TRANSLATION OF THE STRUCTURE TO THE ORIGIN
@@ -967,25 +687,23 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
 
         # Assume that the object is put into the global origin. Then, the
         # camera is moved in x and z direction, not in y. The object has its
-        # size at distance math.sqrt(object_size) from the origin. So, move the
+        # size at distance sqrt(object_size) from the origin. So, move the
         # camera by this distance times a factor of camera_factor in x and z.
         # Then add x, y and z of the origin of the object.
-        object_camera_vec = Vector((math.sqrt(object_size) * camera_factor,
+        object_camera_vec = Vector((sqrt(object_size) * camera_factor,
                                     0.0,
-                                    math.sqrt(object_size) * camera_factor))
+                                    sqrt(object_size) * camera_factor))
         camera_xyz_vec = object_center_vec + object_camera_vec
 
         # Create the camera
-        current_layers=bpy.context.scene.layers
-        bpy.ops.object.camera_add(view_align=False, enter_editmode=False,
-                               location=camera_xyz_vec,
-                               rotation=(0.0, 0.0, 0.0), layers=current_layers)
-        # Some properties of the camera are changed.
-        camera = bpy.context.scene.objects.active
-        camera.name = "A_camera"
-        camera.data.name = "A_camera"
-        camera.data.lens = 45
-        camera.data.clip_end = 500.0
+        current_layers=bpy.context.scene.layers 
+        camera_data = bpy.data.cameras.new("A_camera")
+        camera_data.lens = 45
+        camera_data.clip_end = 500.0
+        camera = bpy.data.objects.new("A_camera", camera_data)
+        camera.location = camera_xyz_vec
+        camera.layers = current_layers
+        bpy.context.scene.objects.link(camera)
 
         # Here the camera is rotated such it looks towards the center of
         # the object. The [0.0, 0.0, 1.0] vector along the z axis
@@ -996,12 +714,13 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         axis_vec               = z_axis_vec.cross(object_camera_vec)
         # Rotate 'axis_vec' by 'angle' and convert this to euler parameters.
         # 4 is the size of the matrix.
-        euler                  = Matrix.Rotation(angle, 4, axis_vec).to_euler()
-        camera.rotation_euler  = euler
+        camera.rotation_euler  = Matrix.Rotation(angle, 4, axis_vec).to_euler()
 
         # Rotate the camera around its axis by 90° such that we have a nice
         # camera position and view onto the object.
-        bpy.ops.transform.rotate(value=(90.0*2*math.pi/360.0,),
+        bpy.ops.object.select_all(action='DESELECT')        
+        camera.select = True 
+        bpy.ops.transform.rotate(value=(90.0*2*pi/360.0),
                                  axis=object_camera_vec,
                                  constraint_axis=(False, False, False),
                                  constraint_orientation='GLOBAL',
@@ -1017,7 +736,7 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
 
         # This is the distance from the object measured in terms of %
         # of the camera distance. It is set onto 50% (1/2) distance.
-        lamp_dl = math.sqrt(object_size) * 15 * 0.5
+        lamp_dl = sqrt(object_size) * 15 * 0.5
         # This is a factor to which extend the lamp shall go to the right
         # (from the camera  point of view).
         lamp_dy_right = lamp_dl * (3.0/4.0)
@@ -1028,36 +747,19 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
 
         # Create the lamp
         current_layers=bpy.context.scene.layers
-        bpy.ops.object.lamp_add (type = 'POINT', view_align=False,
-                                 location=lamp_xyz_vec,
-                                 rotation=(0.0, 0.0, 0.0),
-                                 layers=current_layers)
-        # Some properties of the lamp are changed.
-        lamp = bpy.context.scene.objects.active
-        lamp.data.name = "A_lamp"
-        lamp.name = "A_lamp"
-        lamp.data.distance = 500.0
-        lamp.data.energy = 3.0
-        lamp.data.shadow_method = 'RAY_SHADOW'
+        lamp_data = bpy.data.lamps.new(name="A_lamp", type="POINT")
+        lamp_data.distance = 500.0
+        lamp_data.energy = 3.0
+        lamp_data.shadow_method = 'RAY_SHADOW'        
+        lamp = bpy.data.objects.new("A_lamp", lamp_data)
+        lamp.location = lamp_xyz_vec
+        lamp.layers = current_layers
+        bpy.context.scene.objects.link(lamp)         
 
         bpy.context.scene.world.light_settings.use_ambient_occlusion = True
         bpy.context.scene.world.light_settings.ao_factor = 0.2
 
     # ------------------------------------------------------------------------
-    # SOME OUTPUT ON THE CONSOLE
-
-    print()
-    print()
-    print()
-    print(ATOM_PDB_STRING)
-    print()
-    print("Total number of atoms       : " + str(Number_of_total_atoms))
-    print("Total number of sticks      : " + str(Number_of_sticks))
-    print("Center of object (Angstrom) : ", object_center_vec)
-    print("Size of object (Angstrom)   : ", object_size)
-    print()
-
-    # ------------------------------------------------------------------------
     # SORTING THE ATOMS
 
     # Lists of atoms of one type are created. Example:
@@ -1128,18 +830,23 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                             layers=current_layers)
         else:
             # NURBS balls
-            if use_mesh == False:
+            if Ball_type == "0":
                 bpy.ops.surface.primitive_nurbs_surface_sphere_add(
                             view_align=False, enter_editmode=False,
                             location=(0,0,0), rotation=(0.0, 0.0, 0.0),
                             layers=current_layers)
             # UV balls
-            else:
+            elif Ball_type == "1":
                 bpy.ops.mesh.primitive_uv_sphere_add(
                             segments=Ball_azimuth, ring_count=Ball_zenith,
                             size=1, view_align=False, enter_editmode=False,
                             location=(0,0,0), rotation=(0, 0, 0),
                             layers=current_layers)
+            # Meta balls
+            elif Ball_type == "2":
+                bpy.ops.object.metaball_add(type='BALL', view_align=False, 
+                            enter_editmode=False, location=(0, 0, 0), 
+                            rotation=(0, 0, 0), layers=current_layers)
 
         ball = bpy.context.scene.objects.active
         ball.scale  = (atom[3]*Ball_radius_factor,) * 3
@@ -1155,8 +862,6 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         new_atom_mesh.location = object_center_vec
         atom_object_list.append(new_atom_mesh)
 
-    print()
-
     # ------------------------------------------------------------------------
     # DRAWING THE STICKS
 
@@ -1166,8 +871,8 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
          
         if use_sticks_color == False:   
             bpy.ops.object.material_slot_add()
-            stick_material = bpy.data.materials.new(ATOM_PDB_ELEMENTS[-1].name)
-            stick_material.diffuse_color = ATOM_PDB_ELEMENTS[-1].color            
+            stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
+            stick_material.diffuse_color = ELEMENTS[-1].color            
 
         # Sort the sticks and put them into a new list such that ...            
         sticks_all_lists = []
@@ -1209,7 +914,7 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                             material = all_atoms[stick.atom1-1].material
                             sticks_list.append([name, location, dv, material])
                         if atom_type[0] == all_atoms[stick.atom2-1].name: 
-                            location = atom1 - n * dl * int(math.ceil(dv.length / (2.0 * dl)))
+                            location = atom1 - n * dl * int(ceil(dv.length / (2.0 * dl)))
                             name     = "_" + all_atoms[stick.atom2-1].name
                             material = all_atoms[stick.atom2-1].material
                             sticks_list.append([name, location, dv, material])
@@ -1270,9 +975,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                 n_b   = b / b.length
                 
                 if use_sticks_color == True:
-                    loops = int(math.ceil(dv.length / (2.0 * dl)))
+                    loops = int(ceil(dv.length / (2.0 * dl)))
                 else:
-                    loops = int(math.ceil(dv.length / dl))
+                    loops = int(ceil(dv.length / dl))
                     
                 for j in range(loops):
 
@@ -1296,7 +1001,7 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
             bpy.context.scene.objects.link(new_mesh)
 
             current_layers = bpy.context.scene.layers
-            object_stick = DEF_atom_pdb_build_stick(Stick_diameter, dl, Stick_sectors)
+            object_stick = build_stick(Stick_diameter, dl, Stick_sectors)
             stick_cylinder = object_stick[0]
             stick_cylinder.active_material = stick[3]
             stick_cups = object_stick[1]
@@ -1324,7 +1029,3 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
     if obj:
         bpy.context.scene.objects.active = obj
 
-    print("\n\nAll atoms (%d) and sticks (%d) have been drawn - finished.\n\n"
-           % (Number_of_total_atoms,Number_of_sticks))
-
-    return Number_of_total_atoms
diff --git a/release/scripts/addons/io_mesh_stl/stl_utils.py b/release/scripts/addons/io_mesh_stl/stl_utils.py
index ded7d2c..1d35acb 100644
--- a/release/scripts/addons/io_mesh_stl/stl_utils.py
+++ b/release/scripts/addons/io_mesh_stl/stl_utils.py
@@ -163,7 +163,7 @@ def _ascii_read(data):
 def _binary_write(filename, faces):
     with open(filename, 'wb') as data:
         # header
-        # we write padding at header begginning to avoid to
+        # we write padding at header beginning to avoid to
         # call len(list(faces)) which may be expensive
         data.write(struct.calcsize('<80sI') * b'\0')
 
diff --git a/release/scripts/addons/io_scene_3ds/export_3ds.py b/release/scripts/addons/io_scene_3ds/export_3ds.py
index f7ecf21..e7f624a 100644
--- a/release/scripts/addons/io_scene_3ds/export_3ds.py
+++ b/release/scripts/addons/io_scene_3ds/export_3ds.py
@@ -1156,7 +1156,7 @@ def save(operator,
     file.close()
 
     # Clear name mapping vars, could make locals too
-    name_unique[:] = []
+    del name_unique[:]
     name_mapping.clear()
 
     # Debugging only: report the exporting time:
diff --git a/release/scripts/addons/io_scene_3ds/import_3ds.py b/release/scripts/addons/io_scene_3ds/import_3ds.py
index 0da6822..c400bbd 100644
--- a/release/scripts/addons/io_scene_3ds/import_3ds.py
+++ b/release/scripts/addons/io_scene_3ds/import_3ds.py
@@ -859,7 +859,7 @@ def load_3ds(filepath,
     if IMPORT_CONSTRAIN_BOUNDS:
         BOUNDS_3DS[:] = [1 << 30, 1 << 30, 1 << 30, -1 << 30, -1 << 30, -1 << 30]
     else:
-        BOUNDS_3DS[:] = []
+        del BOUNDS_3DS[:]
 
     ##IMAGE_SEARCH
 
diff --git a/release/scripts/addons/io_scene_fbx/export_fbx.py b/release/scripts/addons/io_scene_fbx/export_fbx.py
index ce1de53..1c35fe8 100644
--- a/release/scripts/addons/io_scene_fbx/export_fbx.py
+++ b/release/scripts/addons/io_scene_fbx/export_fbx.py
@@ -2928,12 +2928,12 @@ Takes:  {''')
         mapping.clear()
     del mapping
 
-    ob_arms[:] = []
-    ob_bones[:] = []
-    ob_cameras[:] = []
-    ob_lights[:] = []
-    ob_meshes[:] = []
-    ob_null[:] = []
+    del ob_arms[:]
+    del ob_bones[:]
+    del ob_cameras[:]
+    del ob_lights[:]
+    del ob_meshes[:]
+    del ob_null[:]
 
     file.close()
 
diff --git a/release/scripts/addons/io_scene_obj/export_obj.py b/release/scripts/addons/io_scene_obj/export_obj.py
index c5fe57a..75443c3 100644
--- a/release/scripts/addons/io_scene_obj/export_obj.py
+++ b/release/scripts/addons/io_scene_obj/export_obj.py
@@ -61,7 +61,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
         # Get the Blender data for the material and the image.
         # Having an image named None will make a bug, dont do it :)
 
-        fw('newmtl %s\n' % mtl_mat_name)  # Define a new material: matname_imgname
+        fw('\nnewmtl %s\n' % mtl_mat_name)  # Define a new material: matname_imgname
 
         if mat:
             # convert from blenders spec to 0 - 1000 range.
@@ -79,7 +79,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
                 fw('Ni %.6f\n' % mat.ior)  # Refraction index
             else:
                 fw('Ni %.6f\n' % 1.0)
-            fw('d %.6f\n' % mat.alpha)  # Alpha (obj uses 'd' for dissolve)
+            fw('d %.6f\n' % (1.0 - mat.alpha))  # Alpha (obj uses 'd' for dissolve)
 
             # 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting.
             if mat.use_shadeless:
@@ -100,9 +100,16 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
 
         # Write images!
         if face_img:  # We have an image on the face!
-            # write relative image path
-            rel = bpy_extras.io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set, face_img.library)
-            fw('map_Kd %s\n' % rel)  # Diffuse mapping image
+            filepath = face_img.filepath
+            if filepath:  # may be '' for generated images
+                # write relative image path
+                filepath = bpy_extras.io_utils.path_reference(filepath, source_dir, dest_dir,
+                                                              path_mode, "", copy_set, face_img.library)
+                fw('map_Kd %s\n' % filepath)  # Diffuse mapping image
+                del filepath
+            else:
+                # so we write the materials image.
+                face_img = None
 
         if mat:  # No face image. if we havea material search for MTex image.
             image_map = {}
@@ -112,27 +119,40 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
                     image = mtex.texture.image
                     if image:
                         # texface overrides others
-                        if mtex.use_map_color_diffuse and face_img is None:
+                        if      (mtex.use_map_color_diffuse and
+                                (face_img is None) and
+                                (mtex.use_map_warp is False) and
+                                (mtex.texture_coords != 'REFLECTION')):
                             image_map["map_Kd"] = image
                         if mtex.use_map_ambient:
                             image_map["map_Ka"] = image
+                        # this is the Spec intensity channel but Ks stands for specular Color
+                        '''
                         if mtex.use_map_specular:
                             image_map["map_Ks"] = image
+                        '''
+                        if mtex.use_map_color_spec:  # specular color
+                            image_map["map_Ks"] = image
+                        if mtex.use_map_hardness:  # specular hardness/glossiness
+                            image_map["map_Ns"] = image
                         if mtex.use_map_alpha:
                             image_map["map_d"] = image
                         if mtex.use_map_translucency:
                             image_map["map_Tr"] = image
-                        if mtex.use_map_normal:
+                        if mtex.use_map_normal and (mtex.texture.use_normal_map is True):
                             image_map["map_Bump"] = image
-                        if mtex.use_map_hardness:
-                            image_map["map_Ns"] = image
+                        if mtex.use_map_normal and (mtex.texture.use_normal_map is False):
+                            image_map["map_Disp"] = image                      
+                        if mtex.use_map_color_diffuse and (mtex.texture_coords == 'REFLECTION'):
+                            image_map["map_refl"] = image
+                        if mtex.use_map_emit:
+                            image_map["map_Ke"] = image
 
             for key, image in image_map.items():
-                filepath = bpy_extras.io_utils.path_reference(image.filepath, source_dir, dest_dir, path_mode, "", copy_set, image.library)
+                filepath = bpy_extras.io_utils.path_reference(image.filepath, source_dir, dest_dir,
+                                                              path_mode, "", copy_set, image.library)
                 fw('%s %s\n' % (key, repr(filepath)[1:-1]))
 
-        fw('\n\n')
-
     file.close()
 
 
@@ -373,7 +393,7 @@ def write_file(filepath, objects, scene,
             # avoid bad index errors
             if not materials:
                 materials = [None]
-                material_names = [""]
+                material_names = [name_compat(None)]
 
             # Sort by Material, then images
             # so we dont over context switch in the obj file.
@@ -457,12 +477,12 @@ def write_file(filepath, objects, scene,
             if EXPORT_POLYGROUPS:
                 # Retrieve the list of vertex groups
                 vertGroupNames = ob.vertex_groups.keys()
-
-                currentVGroup = ''
-                # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
-                vgroupsMap = [[] for _i in range(len(me_verts))]
-                for v_idx, v_ls in enumerate(vgroupsMap):
-                    v_ls[:] = [(vertGroupNames[g.group], g.weight) for g in me_verts[v_idx].groups]
+                if vertGroupNames:
+                    currentVGroup = ''
+                    # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
+                    vgroupsMap = [[] for _i in range(len(me_verts))]
+                    for v_idx, v_ls in enumerate(vgroupsMap):
+                        v_ls[:] = [(vertGroupNames[g.group], g.weight) for g in me_verts[v_idx].groups]
 
             for f, f_index in face_index_pairs:
                 f_smooth = f.use_smooth
@@ -480,7 +500,7 @@ def write_file(filepath, objects, scene,
 
                 # Write the vertex group
                 if EXPORT_POLYGROUPS:
-                    if ob.vertex_groups:
+                    if vertGroupNames:
                         # find what vertext group the face belongs to
                         vgroup_of_face = findVertexGroupName(f, vgroupsMap)
                         if vgroup_of_face != currentVGroup:
diff --git a/release/scripts/addons/io_scene_obj/import_obj.py b/release/scripts/addons/io_scene_obj/import_obj.py
index 11fa543..2987362 100644
--- a/release/scripts/addons/io_scene_obj/import_obj.py
+++ b/release/scripts/addons/io_scene_obj/import_obj.py
@@ -68,7 +68,7 @@ def obj_image_load(imagepath, DIR, recursive):
     return load_image(imagepath, DIR, recursive=recursive, place_holder=True)
 
 
-def create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search):
+def create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search, float_func):
     """
     Create all the used materials in this obj,
     assign colors and images to the materials from all referenced material libs
@@ -85,14 +85,18 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
         # Absolute path - c:\.. etc would work here
         image = obj_image_load(imagepath, DIR, use_image_search)
         has_data = False
+        image_depth = 0
 
         if image:
             texture.image = image
+            # note, this causes the image to load, see: [#32637]
+            # which makes the following has_data work as expected.
+            image_depth = image.depth
             has_data = image.has_data
 
         # Adds textures for materials (rendering)
         if type == 'Kd':
-            if has_data and image.depth == 32:
+            if image_depth in {32, 128}:
                 # Image has alpha
 
                 mtex = blender_material.texture_slots.add()
@@ -159,9 +163,8 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
             mtex.use_map_color_diffuse = False
 
             mtex.texture = texture
-            mtex.texture_coords = 'UV'
-            mtex.use_map_reflect = True
-
+            mtex.texture_coords = 'REFLECTION'
+            mtex.use_map_color_diffuse = True
         else:
             raise Exception("invalid type %r" % type)
 
@@ -203,19 +206,21 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
                     line_split = line.split()
                     line_lower = line.lower().lstrip()
                     if line_lower.startswith(b'ka'):
-                        context_material.mirror_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+                        context_material.mirror_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
                     elif line_lower.startswith(b'kd'):
-                        context_material.diffuse_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+                        context_material.diffuse_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
                     elif line_lower.startswith(b'ks'):
-                        context_material.specular_color = float(line_split[1]), float(line_split[2]), float(line_split[3])
+                        context_material.specular_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
                     elif line_lower.startswith(b'ns'):
-                        context_material.specular_hardness = int((float(line_split[1]) * 0.51))
+                        context_material.specular_hardness = int((float_func(line_split[1]) * 0.51))
                     elif line_lower.startswith(b'ni'):  # Refraction index
-                        context_material.raytrace_transparency.ior = max(1, min(float(line_split[1]), 3))  # between 1 and 3
-                    elif line_lower.startswith((b'd', b'tr')):
-                        context_material.alpha = float(line_split[1])
+                        context_material.raytrace_transparency.ior = max(1, min(float_func(line_split[1]), 3))  # between 1 and 3
+                    elif line_lower.startswith(b'd'):  # dissolve (trancparency)
+                        context_material.alpha = float_func(line_split[1])
                         context_material.use_transparency = True
                         context_material.transparency_method = 'Z_TRANSPARENCY'
+                    elif line_lower.startswith(b'tr'):  # trancelucency
+                        context_material.translucency = float_func(line_split[1])
                     elif line_lower.startswith(b'tf'):
                         # rgb, filter color, blender has no support for this.
                         pass
@@ -339,7 +344,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
                         if img_filepath:
                             load_material_image(context_material, context_material_name, img_filepath, 'D')
 
-                    elif line_lower.startswith(b'refl'):  # reflectionmap
+                    elif line_lower.startswith((b'map_refl', b'refl')):  # reflectionmap
                         img_filepath = line_value(line.split())
                         if img_filepath:
                             load_material_image(context_material, context_material_name, img_filepath, 'refl')
@@ -1080,7 +1085,7 @@ def load(operator, context, filepath,
     time_sub = time_new
 
     print('\tloading materials and images...')
-    create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search)
+    create_materials(filepath, material_libs, unique_materials, unique_material_images, use_image_search, float_func)
 
     time_new = time.time()
     print("%.4f sec" % (time_new - time_sub))
diff --git a/release/scripts/addons/io_scene_x3d/export_x3d.py b/release/scripts/addons/io_scene_x3d/export_x3d.py
index ddc0713..eb5d346 100644
--- a/release/scripts/addons/io_scene_x3d/export_x3d.py
+++ b/release/scripts/addons/io_scene_x3d/export_x3d.py
@@ -369,7 +369,7 @@ def export(file,
 
         loc, rot, scale = matrix.decompose()
         rot = rot.to_axis_angle()
-        rot = rot[0][:] + (rot[1], )
+        rot = rot[0].normalized()[:] + (rot[1], )
 
         ident_step = ident + (' ' * (-len(ident) + \
         fw('%s<Viewpoint ' % ident)))
@@ -853,7 +853,9 @@ def export(file,
                         # --- Write IndexedFaceSet Attributes (same as IndexedTriangleSet)
                         fw('solid="%s"\n' % ('true' if material and material.game_settings.use_backface_culling else 'false'))
                         if is_smooth:
-                            fw(ident_step + 'creaseAngle="%.4f"\n' % mesh.auto_smooth_angle)
+                            # use Auto-Smooth angle, if enabled. Otherwise make
+                            # the mesh perfectly smooth by creaseAngle > pi.
+                            fw(ident_step + 'creaseAngle="%.4f"\n' % (mesh.auto_smooth_angle if mesh.use_auto_smooth else 4.0))
 
                         if use_normals:
                             # currently not optional, could be made so:
@@ -1333,9 +1335,9 @@ def export(file,
         # Blend Gradient
         elif blending == (True, False, False):
             fw(ident_step + 'groundColor="%.3f %.3f %.3f, %.3f %.3f %.3f"\n' % (grd_triple + mix_triple))
-            fw(ident_step + 'groundAngle="1.57, 1.57"\n')
+            fw(ident_step + 'groundAngle="1.57"\n')
             fw(ident_step + 'skyColor="%.3f %.3f %.3f, %.3f %.3f %.3f"\n' % (sky_triple + mix_triple))
-            fw(ident_step + 'skyAngle="1.57, 1.57"\n')
+            fw(ident_step + 'skyAngle="1.57"\n')
         # Blend+Real Gradient Inverse
         elif blending == (True, False, True):
             fw(ident_step + 'groundColor="%.3f %.3f %.3f, %.3f %.3f %.3f"\n' % (sky_triple + grd_triple))
@@ -1349,9 +1351,9 @@ def export(file,
         # Blend+Real+Paper - komplex gradient
         elif blending == (True, True, True):
             fw(ident_step + 'groundColor="%.3f %.3f %.3f, %.3f %.3f %.3f"\n' % (sky_triple + grd_triple))
-            fw(ident_step + 'groundAngle="1.57, 1.57"\n')
+            fw(ident_step + 'groundAngle="1.57"\n')
             fw(ident_step + 'skyColor="%.3f %.3f %.3f, %.3f %.3f %.3f"\n' % (sky_triple + grd_triple))
-            fw(ident_step + 'skyAngle="1.57, 1.57"\n')
+            fw(ident_step + 'skyAngle="1.57"\n')
         # Any Other two colors
         else:
             fw(ident_step + 'groundColor="%.3f %.3f %.3f"\n' % grd_triple)
diff --git a/release/scripts/addons/io_shape_mdd/__init__.py b/release/scripts/addons/io_shape_mdd/__init__.py
index b36bebc..8a6450b 100644
--- a/release/scripts/addons/io_shape_mdd/__init__.py
+++ b/release/scripts/addons/io_shape_mdd/__init__.py
@@ -40,7 +40,7 @@ if "bpy" in locals():
 
 
 import bpy
-from bpy.props import StringProperty, IntProperty
+from bpy.props import StringProperty, IntProperty, FloatProperty
 from bpy_extras.io_utils import ExportHelper, ImportHelper
 
 
@@ -70,16 +70,16 @@ class ImportMDD(bpy.types.Operator, ImportHelper):
 
     @classmethod
     def poll(cls, context):
-        ob = context.active_object
-        return (ob and ob.type == 'MESH')
-
-    def execute(self, context):
+        obj = context.active_object
+        return (obj and obj.type == 'MESH')
 
-        # initialize from scene if unset
+    def invoke(self, context, event):
         scene = context.scene
-        if not self.frame_start:
-            self.frame_start = scene.frame_current
+        self.frame_start = scene.frame_start
+
+        return super().invoke(context, event)
 
+    def execute(self, context):
         keywords = self.as_keywords(ignore=("filter_glob",))
 
         from . import import_mdd
@@ -98,16 +98,16 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
 
     minframe = 1
     maxframe = 300000
-    minfps = 1
-    maxfps = 120
+    minfps = 1.0
+    maxfps = 120.0
 
     # List of operator properties, the attributes will be assigned
     # to the class instance from the operator settings before calling.
-    fps = IntProperty(
+    fps = FloatProperty(
             name="Frames Per Second",
             description="Number of frames/second",
             min=minfps, max=maxfps,
-            default=25,
+            default=25.0,
             )
     frame_start = IntProperty(
             name="Start Frame",
@@ -127,16 +127,15 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
         obj = context.active_object
         return (obj and obj.type == 'MESH')
 
-    def execute(self, context):
-        # initialize from scene if unset
+    def invoke(self, context, event):
         scene = context.scene
-        if not self.frame_start:
-            self.frame_start = scene.frame_start
-        if not self.frame_end:
-            self.frame_end = scene.frame_end
-        if not self.fps:
-            self.fps = scene.render.fps
+        self.frame_start = scene.frame_start
+        self.frame_end = scene.frame_end
+        self.fps = scene.render.fps / scene.render.fps_base
 
+        return super().invoke(context, event)
+
+    def execute(self, context):
         keywords = self.as_keywords(ignore=("check_existing", "filter_glob"))
 
         from . import export_mdd
diff --git a/release/scripts/addons/io_shape_mdd/export_mdd.py b/release/scripts/addons/io_shape_mdd/export_mdd.py
index d078083..aaa2f6a 100644
--- a/release/scripts/addons/io_shape_mdd/export_mdd.py
+++ b/release/scripts/addons/io_shape_mdd/export_mdd.py
@@ -51,7 +51,7 @@ def check_vertcount(mesh, vertcount):
         raise Exception('Error, number of verts has changed during animation, cannot export')
 
 
-def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
+def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25.0):
     """
     Blender.Window.WaitCursor(1)
 
@@ -70,16 +70,18 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
     me = obj.to_mesh(scene, True, 'PREVIEW')
 
     #Flip y and z
+    '''
     mat_flip = mathutils.Matrix(((1.0, 0.0, 0.0, 0.0),
                                  (0.0, 0.0, 1.0, 0.0),
                                  (0.0, 1.0, 0.0, 0.0),
                                  (0.0, 0.0, 0.0, 1.0),
                                  ))
+    '''
+    mat_flip = mathutils.Matrix()
 
     numverts = len(me.vertices)
 
     numframes = frame_end - frame_start + 1
-    fps = float(fps)
     f = open(filepath, 'wb')  # no Errors yet:Safe to create file
 
     # Write the header
@@ -89,21 +91,11 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
     f.write(pack(">%df" % (numframes), *[frame / fps for frame in range(numframes)]))  # seconds
 
     #rest frame needed to keep frames in sync
-    """
-    Blender.Set('curframe', frame_start)
-    me_tmp.getFromObject(obj.name)
-    """
-
     check_vertcount(me, numverts)
     me.transform(mat_flip * obj.matrix_world)
     f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
 
     for frame in range(frame_start, frame_end + 1):  # in order to start at desired frame
-        """
-        Blender.Set('curframe', frame)
-        me_tmp.getFromObject(obj.name)
-        """
-
         scene.frame_set(frame)
         me = obj.to_mesh(scene, True, 'PREVIEW')
         check_vertcount(me, numverts)
@@ -112,16 +104,9 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
         # Write the vertex data
         f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
 
-    """
-    me_tmp.vertices= None
-    """
     f.close()
 
     print('MDD Exported: %r frames:%d\n' % (filepath, numframes - 1))
-    """
-    Blender.Window.WaitCursor(0)
-    Blender.Set('curframe', orig_frame)
-    """
     scene.frame_set(orig_frame)
 
     return {'FINISHED'}
diff --git a/release/scripts/addons/io_shape_mdd/import_mdd.py b/release/scripts/addons/io_shape_mdd/import_mdd.py
index f513685..e671e28 100644
--- a/release/scripts/addons/io_shape_mdd/import_mdd.py
+++ b/release/scripts/addons/io_shape_mdd/import_mdd.py
@@ -34,6 +34,41 @@
 import bpy
 from struct import unpack
 
+def obj_update_frame(file, scene, obj, fr, step):
+
+    # Insert new shape key
+    new_shapekey = obj.shape_key_add()
+    new_shapekey.name = ("frame_%.4d" % fr)
+
+    obj.active_shape_key_index = len(obj.data.shape_keys.key_blocks) - 1
+    index = len(obj.data.shape_keys.key_blocks) - 1
+    obj.show_only_shape_key = True
+
+    verts = obj.data.shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].data
+
+    for v in verts:  # 12 is the size of 3 floats
+        v.co[:] = unpack('>3f', file.read(12))
+
+    # me.update()
+    obj.show_only_shape_key = False
+
+    # insert keyframes
+    shape_keys = obj.data.shape_keys
+
+    scene.frame_current -= step
+    obj.data.shape_keys.key_blocks[index].value = 0.0
+    shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
+
+    scene.frame_current += step
+    obj.data.shape_keys.key_blocks[index].value = 1.0
+    shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
+
+    scene.frame_current += step
+    obj.data.shape_keys.key_blocks[index].value = 0.0
+    shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
+
+    obj.data.update()
+
 
 def load(operator, context, filepath, frame_start=0, frame_step=1):
 
@@ -60,42 +95,7 @@ def load(operator, context, filepath, frame_start=0, frame_step=1):
 
     scene.frame_current = frame_start
 
-    def UpdateMesh(ob, fr, step):
-
-        # Insert new shape key
-        new_shapekey = obj.shape_key_add()
-        new_shapekey.name = ("frame_%.4d" % fr)
-
-        obj.active_shape_key_index = len(obj.data.shape_keys.key_blocks) - 1
-        index = len(obj.data.shape_keys.key_blocks) - 1
-        obj.show_only_shape_key = True
-
-        verts = obj.data.shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].data
-
-        for v in verts:  # 12 is the size of 3 floats
-            v.co[:] = unpack('>3f', file.read(12))
-
-        # me.update()
-        obj.show_only_shape_key = False
-
-        # insert keyframes
-        shape_keys = obj.data.shape_keys
-
-        scene.frame_current -= step
-        obj.data.shape_keys.key_blocks[index].value = 0.0
-        shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
-
-        scene.frame_current += step
-        obj.data.shape_keys.key_blocks[index].value = 1.0
-        shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
-
-        scene.frame_current += step
-        obj.data.shape_keys.key_blocks[index].value = 0.0
-        shape_keys.key_blocks[len(obj.data.shape_keys.key_blocks) - 1].keyframe_insert("value")
-
-        obj.data.update()
-
     for i in range(frames):
-        UpdateMesh(obj, i, frame_step)
+        obj_update_frame(file, scene, obj, i, frame_step)
 
     return {'FINISHED'}
diff --git a/release/scripts/addons/mesh_bsurfaces.py b/release/scripts/addons/mesh_bsurfaces.py
index b4a0307..bd43513 100644
--- a/release/scripts/addons/mesh_bsurfaces.py
+++ b/release/scripts/addons/mesh_bsurfaces.py
@@ -789,7 +789,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         
         #### Perform "Remove Doubles" to weld all the disconnected verts
         bpy.ops.object.mode_set('INVOKE_REGION_WIN', mode='EDIT')
-        bpy.ops.mesh.remove_doubles(mergedist = 0.0001)
+        bpy.ops.mesh.remove_doubles(threshold=0.0001)
         
         bpy.ops.object.mode_set('INVOKE_REGION_WIN', mode='OBJECT')
         
@@ -1082,7 +1082,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
             # Find "intersection-nodes".
             bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
             bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='SELECT')
-            bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', mergedist=self.crosshatch_merge_distance)
+            bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', threshold=self.crosshatch_merge_distance)
             bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='DESELECT')
             bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
             
@@ -1114,7 +1114,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
             bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='SELECT')
             
             # Remove doubles to discard very near verts from calculations of distance.
-            bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', mergedist=self.crosshatch_merge_distance * 4)
+            bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', threshold=self.crosshatch_merge_distance * 4.0)
             bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
             
             # Get all coords of the resulting nodes.
@@ -1420,7 +1420,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='SELECT')
-        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', mergedist=average_edge_length / 15)
+        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', threshold=average_edge_length / 15.0)
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         
         final_points_ob = bpy.context.scene.objects.active
@@ -1561,7 +1561,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         bpy.ops.mesh.select_all(action='DESELECT')
-        bpy.ops.mesh.select_by_number_vertices(type='NOTEQUAL')
+        bpy.ops.mesh.select_face_by_sides(type='NOTEQUAL')
         bpy.ops.mesh.delete()
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         
@@ -1703,7 +1703,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         # Perform Remove doubles to merge verts.
         if not (self.automatic_join == False and self.main_object_selected_verts_count == 0):
-            bpy.ops.mesh.remove_doubles(mergedist=0.0001)
+            bpy.ops.mesh.remove_doubles(threshold=0.0001)
         
         bpy.ops.mesh.select_all(action='DESELECT')
         
@@ -2850,7 +2850,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
         
-        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', mergedist=0.0001)
+        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', threshold=0.0001)
         bpy.ops.mesh.normals_make_consistent('INVOKE_REGION_WIN', inside=False)
         bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='DESELECT')
         
@@ -2987,8 +2987,13 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
             if self.strokes_type == "GP_STROKES":
                 # Convert grease pencil strokes to curve.
                 bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
-                bpy.ops.gpencil.convert('INVOKE_REGION_WIN', type='CURVE')
-                self.original_curve = bpy.context.object
+                bpy.ops.gpencil.convert('INVOKE_REGION_WIN', type='CURVE', use_link_strokes=False)
+                # XXX gpencil.convert now keep org object as active/selected, *not* newly created curve!
+                # XXX This is far from perfect, but should work in most cases...
+#                self.original_curve = bpy.context.object
+                for ob in bpy.context.selected_objects:
+                    if ob != bpy.context.scene.objects.active and ob.name.startswith("GP_Layer"):
+                        self.original_curve = ob
                 self.using_external_curves = False
             elif self.strokes_type == "EXTERNAL_CURVE":
                 for ob in bpy.context.selected_objects:
diff --git a/release/scripts/addons/mocap/__init__.py b/release/scripts/addons/mocap/__init__.py
index 4cca6b3..ac1e350 100644
--- a/release/scripts/addons/mocap/__init__.py
+++ b/release/scripts/addons/mocap/__init__.py
@@ -433,7 +433,7 @@ class OBJECT_OT_RetargetButton(bpy.types.Operator):
     # has an action for retargeting
     """Retarget animation from selected armature to active armature"""
     bl_idname = "mocap.retarget"
-    bl_label = "Retarget active action from Performer to End-user"
+    bl_label = "Retarget"
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
@@ -471,7 +471,7 @@ class OBJECT_OT_SaveMappingButton(bpy.types.Operator):
     #Operator for saving mapping to enduser armature
     """Save mapping to active armature (for future retargets)"""
     bl_idname = "mocap.savemapping"
-    bl_label = "Save user generated mapping from Performer to End-user"
+    bl_label = "Save Mapping"
 
     def execute(self, context):
         enduser_obj = bpy.context.active_object
@@ -494,7 +494,7 @@ class OBJECT_OT_LoadMappingButton(bpy.types.Operator):
     """Load saved mapping from active armature"""
     #Operator for loading mapping to enduser armature
     bl_idname = "mocap.loadmapping"
-    bl_label = "Load user generated mapping from Performer to End-user"
+    bl_label = "Load Mapping"
 
     def execute(self, context):
         enduser_obj = bpy.context.active_object
@@ -517,7 +517,7 @@ class OBJECT_OT_SelectMapBoneButton(bpy.types.Operator):
     #Operator for setting selected bone in enduser armature to the performer mapping
     """Select a bone for faster mapping"""
     bl_idname = "mocap.selectmap"
-    bl_label = "Select a bone for faster mapping"
+    bl_label = "Select Mapping Bone"
     perf_bone = StringProperty()
 
     def execute(self, context):
@@ -549,7 +549,7 @@ class OBJECT_OT_ConvertSamplesButton(bpy.types.Operator):
     #Operator to convert samples to beziers on the selected object
     """Convert active armature's sampled keyframed to beziers"""
     bl_idname = "mocap.samples"
-    bl_label = "Convert samples / simplifies keyframes to beziers"
+    bl_label = "Convert Samples"
 
     def execute(self, context):
         mocap_tools.fcurves_simplify(context, context.active_object)
@@ -565,7 +565,7 @@ class OBJECT_OT_LooperButton(bpy.types.Operator):
     """Trim active armature's animation to a single cycle, given """ \
     """a cyclic animation (such as a walk cycle)"""
     bl_idname = "mocap.looper"
-    bl_label = "Loop animation / sampled mocap data"
+    bl_label = "Loop Mocap"
 
     def execute(self, context):
         mocap_tools.autoloop_anim()
@@ -581,7 +581,7 @@ class OBJECT_OT_DenoiseButton(bpy.types.Operator):
     """Denoise active armature's animation (good for dealing """ \
     """with 'bad' frames inherent in mocap animation)"""
     bl_idname = "mocap.denoise"
-    bl_label = "Denoise sampled mocap data"
+    bl_label = "Denoise Mocap"
 
     def execute(self, context):
         mocap_tools.denoise_median()
@@ -597,7 +597,7 @@ class OBJECT_OT_LimitDOFButton(bpy.types.Operator):
     """Create limit constraints on the active armature from """ \
     """the selected armature's animation's range of motion"""
     bl_idname = "mocap.limitdof"
-    bl_label = "Analyze animations Max/Min DOF and add hard/soft constraints"
+    bl_label = "Set DOF Constraints"
 
     def execute(self, context):
         performer_obj = [obj for obj in context.selected_objects if obj != context.active_object][0]
@@ -619,7 +619,7 @@ class OBJECT_OT_RemoveLimitDOFButton(bpy.types.Operator):
     #Removes constraints created by above operator
     """Remove previously created limit constraints on the active armature"""
     bl_idname = "mocap.removelimitdof"
-    bl_label = "Remove previously created limit constraints on the active armature"
+    bl_label = "Remove DOF Constraints"
 
     def execute(self, context):
         mocap_tools.limit_dof_toggle_off(context, context.active_object)
@@ -638,7 +638,7 @@ class OBJECT_OT_RotateFixArmature(bpy.types.Operator):
     """Realign the active armature's axis system to match Blender """ \
     """(commonly needed after bvh import)"""
     bl_idname = "mocap.rotate_fix"
-    bl_label = "Rotate selected armature 90 degrees (fix for bvh import)"
+    bl_label = "Rotate Fix"
 
     def execute(self, context):
         mocap_tools.rotate_fix_armature(context.active_object.data)
@@ -655,7 +655,7 @@ class OBJECT_OT_ScaleFixArmature(bpy.types.Operator):
     """Rescale selected armature to match the active animation, """ \
     """for convenience"""
     bl_idname = "mocap.scale_fix"
-    bl_label = "Scale performer armature to match target armature"
+    bl_label = "Scale Fix"
 
     def execute(self, context):
         enduser_obj = bpy.context.active_object
@@ -679,7 +679,7 @@ class MOCAP_OT_AddMocapFix(bpy.types.Operator):
     """Add a post-retarget fix - useful for fixing certain """ \
     """artifacts following the retarget"""
     bl_idname = "mocap.addmocapfix"
-    bl_label = "Add Mocap Fix to target armature"
+    bl_label = "Add Mocap Fix"
     type = EnumProperty(name="Type of Fix",
     items=[("point", "Maintain Position", "Bone is at a specific point"),
         ("freeze", "Maintain Position at frame", "Bone does not move from location specified in target frame"),
@@ -704,7 +704,7 @@ class OBJECT_OT_RemoveMocapConstraint(bpy.types.Operator):
     #Operator to remove a post-retarget fix
     """Remove this post-retarget fix"""
     bl_idname = "mocap.removeconstraint"
-    bl_label = "Remove fixes from target armature"
+    bl_label = "Remove Mocap Fix"
     constraint = IntProperty()
 
     def execute(self, context):
@@ -729,7 +729,7 @@ class OBJECT_OT_BakeMocapConstraints(bpy.types.Operator):
     #Operator to bake all post-retarget fixes
     """Bake all post-retarget fixes to the Retarget Fixes NLA Track"""
     bl_idname = "mocap.bakeconstraints"
-    bl_label = "Bake all fixes to target armature"
+    bl_label = "Bake Mocap Fixes"
 
     def execute(self, context):
         mocap_constraints.bakeConstraints(context)
@@ -746,7 +746,7 @@ class OBJECT_OT_UnbakeMocapConstraints(bpy.types.Operator):
     """Unbake all post-retarget fixes - removes the baked data """ \
     """from the Retarget Fixes NLA Track"""
     bl_idname = "mocap.unbakeconstraints"
-    bl_label = "Unbake all fixes to target armature"
+    bl_label = "Unbake Mocap Fixes"
 
     def execute(self, context):
         mocap_constraints.unbakeConstraints(context)
@@ -764,7 +764,7 @@ class OBJECT_OT_UpdateMocapConstraints(bpy.types.Operator):
     """Update all post-retarget fixes (neccesary to take under """ \
     """consideration changes to armature object or pose)"""
     bl_idname = "mocap.updateconstraints"
-    bl_label = "Update all post-retarget fixes"
+    bl_label = "Update Mocap Fixes"
 
     def execute(self, context):
         mocap_constraints.updateConstraints(context.active_object, context)
@@ -780,7 +780,7 @@ class OBJECT_OT_GuessHierachyMapping(bpy.types.Operator):
     #Operator which calls heurisitic function to guess mapping between 2 armatures
     """Attempt to auto figure out hierarchy mapping"""
     bl_idname = "mocap.guessmapping"
-    bl_label = "Attempt to auto figure out hierarchy mapping"
+    bl_label = "Guess Hierarchy Mapping"
 
     def execute(self, context):
         enduser_obj = bpy.context.active_object
@@ -803,7 +803,7 @@ class OBJECT_OT_PathEditing(bpy.types.Operator):
     #Operator which calls path editing function, making active object follow the selected curve.
     """Set active object (stride object) to follow the selected curve"""
     bl_idname = "mocap.pathediting"
-    bl_label = "Set active object (stride object) to follow the selected curve"
+    bl_label = "Set Path"
 
     def execute(self, context):
         path = [obj for obj in context.selected_objects if obj != context.active_object][0]
@@ -821,10 +821,9 @@ class OBJECT_OT_PathEditing(bpy.types.Operator):
 
 class OBJECT_OT_AnimationStitchingButton(bpy.types.Operator):
     #Operator which calls stitching function, combining 2 animations onto the NLA.
-    """Stitche two defined animations into a single one via """ \
-    """alignment of NLA Tracks"""
+    """Stitch two defined animations into a single one via alignment of NLA Tracks"""
     bl_idname = "mocap.animstitch"
-    bl_label = "Stitch two defined animations into a single one via alignment of NLA Tracks"
+    bl_label = "Stitch Animations"
 
     def execute(self, context):
         mocap_tools.anim_stitch(context, context.active_object)
@@ -845,7 +844,7 @@ class OBJECT_OT_GuessAnimationStitchingButton(bpy.types.Operator):
     #Operator which calls stitching function heuristic, setting good values for above operator.
     """Guess the stitch frame and second offset for animation stitch"""
     bl_idname = "mocap.animstitchguess"
-    bl_label = "Guess the stitch frame and second offset for animation stitch"
+    bl_label = "Guess Animation Stitch"
 
     def execute(self, context):
         mocap_tools.guess_anim_stitch(context, context.active_object)
diff --git a/release/scripts/addons/modules/rna_wiki_reference.py b/release/scripts/addons/modules/rna_wiki_reference.py
index c374c1f..1be0841 100644
--- a/release/scripts/addons/modules/rna_wiki_reference.py
+++ b/release/scripts/addons/modules/rna_wiki_reference.py
@@ -282,7 +282,10 @@ url_manual_mapping = (
     ("bpy.ops.pose.*",  "Rigging/Posing"),
     ("bpy.ops.poselib.*",  "Rigging/Posing/Pose_Library"),
     # ("bpy.ops.ptcache.*",  ""),  # TODO
-    ("bpy.ops.render.*",  "Render"),
+
+    ("bpy.ops.render.play_rendered_anim",  "Render/Display#Animation_Playback"),
+    ("bpy.ops.render.*",  "Render"),  # catchall
+
     ("bpy.ops.scene.*",  "Interface/Scenes"),
     ("bpy.ops.screen.*",  "Interface/Window_system"),
     ("bpy.ops.script.*",  "Extensions/Python"),
diff --git a/release/scripts/addons/modules/selection_utils.py b/release/scripts/addons/modules/selection_utils.py
index 3bf8981..eb85e86 100644
--- a/release/scripts/addons/modules/selection_utils.py
+++ b/release/scripts/addons/modules/selection_utils.py
@@ -46,7 +46,7 @@ class SelectionOrder(bpy.types.Operator):
 
         if num == 0:
             # Reset the list
-            selected[:] = []
+            del selected[:]
         elif num > self.num_selected:
             # Get all the newly selected objects and add
             new = [ob.name for ob in sel if ob.name not in selected]
diff --git a/release/scripts/addons/netrender/utils.py b/release/scripts/addons/netrender/utils.py
index ac21921..df3f00e 100644
--- a/release/scripts/addons/netrender/utils.py
+++ b/release/scripts/addons/netrender/utils.py
@@ -185,7 +185,7 @@ def clientConnection(netsettings, report = None, scan = True, timeout = 5):
             conn = HTTPConnection(address, port, timeout = timeout)
 
         if conn:
-            if clientVerifyVersion(conn):
+            if clientVerifyVersion(conn, timeout):
                 return conn
             else:
                 conn.close()
@@ -198,8 +198,8 @@ def clientConnection(netsettings, report = None, scan = True, timeout = 5):
             print(err)
             return None
 
-def clientVerifyVersion(conn):
-    with ConnectionContext():
+def clientVerifyVersion(conn, timeout):
+    with ConnectionContext(timeout):
         conn.request("GET", "/version")
     response = conn.getresponse()
 
diff --git a/release/scripts/addons/object_fracture_cell/fracture_cell_calc.py b/release/scripts/addons/object_fracture_cell/fracture_cell_calc.py
index 03d27df..9e6f0de 100644
--- a/release/scripts/addons/object_fracture_cell/fracture_cell_calc.py
+++ b/release/scripts/addons/object_fracture_cell/fracture_cell_calc.py
@@ -115,6 +115,6 @@ def points_as_bmesh_cells(verts,
             continue
 
         cells.append((point_cell_current, vertices[:]))
-        vertices[:] = []
+        del vertices[:]
 
     return cells
diff --git a/release/scripts/addons/paint_palette.py b/release/scripts/addons/paint_palette.py
index 7b97410..8a3f4df 100644
--- a/release/scripts/addons/paint_palette.py
+++ b/release/scripts/addons/paint_palette.py
@@ -762,7 +762,7 @@ class PaletteProps(bpy.types.PropertyGroup):
         return None
 
     palette_name = StringProperty(
-        name="Palette Name", default="Preset", subtype="FILENAME")
+        name="Palette Name", default="Preset", subtype='FILE_NAME')
 
     color_name = StringProperty(
         name="", description="Color Name", default="Untitled", update=update_color_name)
diff --git a/release/scripts/addons/space_view3d_screencast_keys.py b/release/scripts/addons/space_view3d_screencast_keys.py
index b20c551..09989e7 100644
--- a/release/scripts/addons/space_view3d_screencast_keys.py
+++ b/release/scripts/addons/space_view3d_screencast_keys.py
@@ -223,6 +223,12 @@ def draw_callback_px_box(self, context):
     self.key = self.key[:final]
     self.time = self.time[:final]
 
+
+def draw_callback_px(self, context):
+    draw_callback_px_text(self, context)
+    draw_callback_px_box(self, context)
+
+
 def draw_last_operator(context, pos_x, pos_y):
 
     wm = context.window_manager
@@ -597,9 +603,7 @@ class ScreencastKeysStatus(bpy.types.Operator):
                 self.mouse = []
                 self.mouse_time = []
                 ScreencastKeysStatus.overall_time = []
-                self._handle = context.region.callback_add(draw_callback_px_box,
-                    (self, context), 'POST_PIXEL')
-                self._handle = context.region.callback_add(draw_callback_px_text,
+                self._handle = context.region.callback_add(draw_callback_px,
                     (self, context), 'POST_PIXEL')
                 self._timer = context.window_manager.event_timer_add(0.075,
                     context.window)
diff --git a/release/scripts/addons/space_view3d_spacebar_menu.py b/release/scripts/addons/space_view3d_spacebar_menu.py
index d66d323..17775a0 100644
--- a/release/scripts/addons/space_view3d_spacebar_menu.py
+++ b/release/scripts/addons/space_view3d_spacebar_menu.py
@@ -843,7 +843,7 @@ class VIEW3D_MT_SelectEditMenu(bpy.types.Menu):
         layout.operator("mesh.select_axis", text="Side of Active")
         layout.separator()
 
-        layout.operator("mesh.select_by_number_vertices", text="By Number of Verts")
+        layout.operator("mesh.select_face_by_sides", text="By Number of Verts")
         if context.scene.tool_settings.mesh_select_mode[2] == False:
             layout.operator("mesh.select_non_manifold", text="Non Manifold")
         layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges")
diff --git a/release/scripts/addons/system_demo_mode/demo_mode.py b/release/scripts/addons/system_demo_mode/demo_mode.py
index 3cce16e..740dc50 100644
--- a/release/scripts/addons/system_demo_mode/demo_mode.py
+++ b/release/scripts/addons/system_demo_mode/demo_mode.py
@@ -468,7 +468,7 @@ def unregister():
 
 def load_config(cfg_name=DEMO_CFG):
     namespace = {}
-    global_config_files[:] = []
+    del global_config_files[:]
     basedir = os.path.dirname(bpy.data.filepath)
 
     text = bpy.data.texts.get(cfg_name)
diff --git a/release/scripts/addons/uv_bake_texture_to_vcols.py b/release/scripts/addons/uv_bake_texture_to_vcols.py
new file mode 100644
index 0000000..802a303
--- /dev/null
+++ b/release/scripts/addons/uv_bake_texture_to_vcols.py
@@ -0,0 +1,348 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+"""
+Bake UV-Texture to Vertex Colors Addon
+
+Contact:        p_boelens at msn.com
+Information:    http://projects.blender.org/tracker/index.php?func=detail&aid=28211
+
+Contributor(s): Patrick Boelens, CoDEmanX.
+    
+All rights reserved.
+"""
+
+bl_info = {
+    "name": "Bake UV-Texture to Vertex Colors",
+    "description": "Bakes the colors of the active UV Texture to a Vertex Color layer. ",
+    "author": "Patrick Boelens, CoDEmanX",
+    "version": (0, 6),
+    "blender": (2, 6, 3),
+    "location": "3D View > Vertex Paint > Toolshelf > Bake",
+    "warning": "Requires image texture, generated textures aren't supported.",
+    "wiki_url": "http://wiki.blender.org/index.php?title=Extensions:2.6/"
+                "Py/Scripts/UV/Bake_Texture_to_Vertex_Colors",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=28211",
+    "category": "UV"}
+
+import bpy
+from bpy.props import BoolProperty, EnumProperty, FloatVectorProperty
+from math import fabs
+from colorsys import rgb_to_hsv, hsv_to_rgb
+
+class UV_OT_bake_texture_to_vcols(bpy.types.Operator):
+    bl_idname = "uv.bake_texture_to_vcols"
+    bl_label = "Bake UV-Texture to Vertex Colors"
+    bl_description = "Bake active UV-Texture to new Vertex Color layer (requires image texture)"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    replace_active_layer = BoolProperty(name="Replace layer",
+                                        description="Overwrite active Vertex Color layer",
+                                        default=True)
+
+    mappingModes = [("CLIP", "Clip", "Don't affect vertices who's UV-coordinates are out of bounds."),
+                    ("REPEAT", "Repeat", "Tile the image so that each vertex is accounted for."),
+                    ("EXTEND", "Extend", "Extends the edges of the image to the UV-coordinates.")
+                   ]
+    
+    mappingMode = EnumProperty(items=mappingModes,
+                               default="CLIP",
+                               name="Mapping",
+                               description="The mode to use for baking vertices who's UV-coordinates are out of bounds.")
+    
+    blendingModes = [("MIX", "Mix", ""),
+                     ("ADD", "Add", ""),
+                     ("SUBTRACT", "Subtract", ""),
+                     ("MULTIPLY", "Multiply", ""),
+                     ("SCREEN", "Screen", ""),
+                     ("OVERLAY", "Overlay", ""),
+                     ("DIFFERENCE", "Difference", ""),
+                     ("DIVIDE", "Divide", ""),
+                     ("DARKEN", "Darken", ""),
+                     ("LIGHTEN", "Lighten", ""),
+                     ("HUE", "Hue", ""),
+                     ("SATURATION", "Saturation", ""),
+                     ("VALUE", "Value", ""),
+                     ("COLOR", "Color", ""),
+                     ("SOFT_LIGHT", "Soft Light", ""),
+                     ("LINEAR_LIGHT", "Linear Light", "")
+                    ]
+      
+    blendingMode = EnumProperty(items=blendingModes,
+                                default="MULTIPLY",
+                                name="Blend Type",
+                                description="The blending mode to use when baking")
+    
+    mirror_x = BoolProperty(name="Mirror X", description="Mirror the image on the X-axis.")
+    mirror_y = BoolProperty(name="Mirror Y", description="Mirror the image on the Y-axis.")
+        
+    @classmethod
+    def poll(self, context):
+        return (context.object and
+                context.object.type == 'MESH' and 
+                context.mode != 'EDIT_MESH' and
+                context.object.data.uv_layers.active and
+                context.object.data.uv_textures.active)
+
+    def execute(self, context):
+        obdata = context.object.data
+
+        if self.replace_active_layer and obdata.vertex_colors.active:
+            vertex_colors = obdata.vertex_colors.active
+        else:
+            vertex_colors = obdata.vertex_colors.new(name="Baked UV texture")
+        
+            if not vertex_colors:
+                # Can't add more than 17 VCol layers
+                self.report({'ERROR'}, "Couldn't add another Vertex Color layer,\n"
+                                       "Please remove an existing layer or replace active.")
+                return {'CANCELLED'}
+            
+        obdata.vertex_colors.active = vertex_colors
+        
+        uv_images = {}
+        for uv_tex in obdata.uv_textures.active.data:
+            if uv_tex.image and uv_tex.image.name not in uv_images and uv_tex.image.pixels:
+                
+                uv_images[uv_tex.image.name] = (uv_tex.image.size[0],
+                                                uv_tex.image.size[1],
+                                                uv_tex.image.pixels[:]
+                                                # Accessing pixels directly is far too slow.
+                                                # Copied to new array for massive performance-gain.
+                                               )
+        
+        for p in obdata.polygons:
+            img = obdata.uv_textures.active.data[p.index].image
+            if not img:
+                continue
+            
+            image_size_x, image_size_y, uv_pixels = uv_images[img.name]
+            
+            for loop in p.loop_indices:
+        
+                co = obdata.uv_layers.active.data[loop].uv
+                x_co = round(co[0] * (image_size_x - 1))
+                y_co = round(co[1] * (image_size_y - 1))
+                
+                if x_co < 0 or x_co >= image_size_x or y_co < 0 or y_co >= image_size_y:
+                    if self.mappingMode == 'CLIP':
+                        continue
+
+                    elif self.mappingMode == 'REPEAT':
+                        x_co %= image_size_x
+                        y_co %= image_size_y
+
+                    elif self.mappingMode == 'EXTEND':
+                        if x_co > image_size_x - 1:
+                            x_co = image_size_x - 1
+                        if x_co < 0:
+                            x_co = 0
+                        if y_co > image_size_y - 1:
+                            y_co = image_size_y - 1
+                        if y_co < 0:
+                            y_co = 0
+                
+                if self.mirror_x:
+                     x_co = image_size_x -1 - x_co
+                     
+                if self.mirror_y:
+                     y_co = image_size_y -1 - y_co
+                     
+                col_out = vertex_colors.data[loop].color
+                    
+                pixelNumber = (image_size_x * y_co) + x_co
+                r = uv_pixels[pixelNumber*4]
+                g = uv_pixels[pixelNumber*4 + 1]
+                b = uv_pixels[pixelNumber*4 + 2]
+                a = uv_pixels[pixelNumber*4 + 3]
+                
+                col_in = r, g, b # texture-color
+                col_result = [r,g,b] # existing / 'base' color
+                
+                if self.blendingMode == 'MIX':
+                    col_result = col_in
+                    
+                elif self.blendingMode == 'ADD':
+                    col_result[0] = col_in[0] + col_out[0]
+                    col_result[1] = col_in[1] + col_out[1]
+                    col_result[2] = col_in[2] + col_out[2]
+                    
+                elif self.blendingMode == 'SUBTRACT':
+                    col_result[0] = col_in[0] - col_out[0]
+                    col_result[1] = col_in[1] - col_out[1]
+                    col_result[2] = col_in[2] - col_out[2]
+                    
+                elif self.blendingMode == 'MULTIPLY':
+                    col_result[0] = col_in[0] * col_out[0]
+                    col_result[1] = col_in[1] * col_out[1]
+                    col_result[2] = col_in[2] * col_out[2]
+                    
+                elif self.blendingMode == 'SCREEN':
+                    col_result[0] = 1 - (1.0 - col_in[0]) * (1.0 - col_out[0])
+                    col_result[1] = 1 - (1.0 - col_in[1]) * (1.0 - col_out[1])
+                    col_result[2] = 1 - (1.0 - col_in[2]) * (1.0 - col_out[2])
+                    
+                elif self.blendingMode == 'OVERLAY':
+                    if col_out[0] < 0.5:
+                        col_result[0] = col_out[0] * (2.0 * col_in[0])
+                    else:
+                        col_result[0] = 1.0 - (2.0 * (1.0 - col_in[0])) * (1.0 - col_out[0])
+                    if col_out[1] < 0.5:
+                        col_result[1] = col_out[1] * (2.0 * col_in[1])
+                    else:
+                        col_result[1] = 1.0 - (2.0 * (1.0 - col_in[1])) * (1.0 - col_out[1])
+                    if col_out[2] < 0.5:
+                        col_result[2] = col_out[2] * (2.0 * col_in[2])
+                    else:
+                        col_result[2] = 1.0 - (2.0 * (1.0 - col_in[2])) * (1.0 - col_out[2])
+                    
+                elif self.blendingMode == 'DIFFERENCE':
+                    col_result[0] = fabs(col_in[0] - col_out[0])
+                    col_result[1] = fabs(col_in[1] - col_out[1])
+                    col_result[2] = fabs(col_in[2] - col_out[2])
+                    
+                elif self.blendingMode == 'DIVIDE':
+                    if(col_in[0] != 0.0):
+                        col_result[0] = col_out[0] / col_in[0]
+                    if(col_in[1] != 0.0):
+                        col_result[0] = col_out[1] / col_in[1]
+                    if(col_in[2] != 0.0):
+                        col_result[2] = col_out[2] / col_in[2]
+                    
+                elif self.blendingMode == 'DARKEN':
+                    if col_in[0] < col_out[0]:
+                        col_result[0] = col_in[0]
+                    else:
+                        col_result[0] = col_out[0]
+                    if col_in[1] < col_out[1]:
+                        col_result[1] = col_in[1]
+                    else:
+                        col_result[1] = col_out[1]
+                    if col_in[2] < col_out[2]:
+                        col_result[2] = col_in[2]
+                    else:
+                        col_result[2] = col_out[2]
+                    
+                    
+                elif self.blendingMode == 'LIGHTEN':
+                    if col_in[0] > col_out[0]:
+                        col_result[0] = col_in[0]
+                    else:
+                        col_result[0] = col_out[0]
+                    if col_in[1] > col_out[1]:
+                        col_result[1] = col_in[1]
+                    else:
+                        col_result[1] = col_out[1]
+                    if col_in[2] > col_out[2]:
+                        col_result[2] = col_in[2]
+                    else:
+                        col_result[2] = col_out[2]
+                    
+                elif self.blendingMode == 'HUE':
+                    hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
+                    hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
+                    hue = hsv_in[0]
+                    col_result = hsv_to_rgb(hue, hsv_out[1], hsv_out[2])
+                    
+                elif self.blendingMode == 'SATURATION':
+                    hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
+                    hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
+                    sat = hsv_in[1]
+                    col_result = hsv_to_rgb(hsv_out[0], sat, hsv_out[2])
+                    
+                elif self.blendingMode == 'VALUE':
+                    hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
+                    hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
+                    val = hsv_in[2]
+                    col_result = hsv_to_rgb(hsv_out[0], hsv_out[1], val)
+                    
+                elif self.blendingMode == 'COLOR':
+                    hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
+                    hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
+                    hue = hsv_in[0]
+                    sat = hsv_in[1]
+                    col_result = hsv_to_rgb(hue, sat, hsv_out[2])
+                    
+                elif self.blendingMode == 'SOFT_LIGHT':
+                    scr = 1 - (1.0 - col_in[0]) * (1.0 - col_out[0])
+                    scg = 1 - (1.0 - col_in[1]) * (1.0 - col_out[1])
+                    scb = 1 - (1.0 - col_in[2]) * (1.0 - col_out[2])
+                    
+                    col_result[0] = (1.0 - col_out[0]) * (col_in[0] * col_out[0]) + (col_out[0] * scr)
+                    col_result[1] = (1.0 - col_out[1]) * (col_in[1] * col_out[1]) + (col_out[1] * scg)
+                    col_result[2] = (1.0 - col_out[2]) * (col_in[2] * col_out[2]) + (col_out[2] * scb)
+                    
+                    
+                elif self.blendingMode == 'LINEAR_LIGHT':
+                    if col_in[0] > 0.5:
+                        col_result[0] = col_out[0] + 2.0 * (col_in[0] - 0.5)
+                    else:
+                        col_result[0] = col_out[0] + 2.0 * (col_in[0] - 1.0)
+                    if col_in[1] > 0.5:
+                        col_result[1] = col_out[1] + 2.0 * (col_in[1] - 0.5)
+                    else:
+                        col_result[1] = col_out[1] + 2.0 * (col_in[1] - 1.0)
+                    if col_in[2] > 0.5:
+                        col_result[2] = col_out[2] + 2.0 * (col_in[2] - 0.5)
+                    else:
+                        col_result[2] = col_out[2] + 2.0 * (col_in[2] - 1.0)
+                
+                # Add alpha color
+                a_inverted = 1 - a
+                alpha_color = context.scene.uv_bake_alpha_color
+                col_result = (col_result[0] * a + alpha_color[0] * a_inverted,
+                              col_result[1] * a + alpha_color[1] * a_inverted,
+                              col_result[2] * a + alpha_color[2] * a_inverted)
+                
+                vertex_colors.data[loop].color = col_result
+    
+        return {'FINISHED'}
+
+class VIEW3D_PT_tools_uv_bake_texture_to_vcols(bpy.types.Panel):
+    bl_label = "Bake"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "TOOLS"
+    bl_options = {'DEFAULT_CLOSED'}
+    
+    @classmethod
+    def poll(self, context):
+        return(context.mode == 'PAINT_VERTEX')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        col.prop(context.scene, "uv_bake_alpha_color")
+        col.separator()
+        col.operator("uv.bake_texture_to_vcols", text="UV Texture to VCols")
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.Scene.uv_bake_alpha_color = FloatVectorProperty(name="Alpha Color",
+        description="Color to be used for transparency",
+        subtype='COLOR',
+        min=0.0,
+        max=1.0)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    del bpy.types.Scene.uv_bake_alpha_color
+
+if __name__ == "__main__":
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/add_mesh_building_objects/__init__.py b/release/scripts/addons_contrib/add_mesh_building_objects/__init__.py
index f9c3309..af0c030 100644
--- a/release/scripts/addons_contrib/add_mesh_building_objects/__init__.py
+++ b/release/scripts/addons_contrib/add_mesh_building_objects/__init__.py
@@ -67,7 +67,7 @@ class INFO_MT_mesh_objects_add(bpy.types.Menu):
             text="Balcony")
         layout.operator("mesh.add_say3d_sove",
             text="Sove")
-        layout.operator("mesh.add_say3d_pencere",
+        layout.operator("mesh.add_say3d_pencere2",
             text="Window")
         layout.operator("mesh.wall_add",
             text="Wall Factory")
diff --git a/release/scripts/addons_contrib/add_mesh_building_objects/add_mesh_window.py b/release/scripts/addons_contrib/add_mesh_building_objects/add_mesh_window.py
index 1ea6d73..51dc0d3 100644
--- a/release/scripts/addons_contrib/add_mesh_building_objects/add_mesh_window.py
+++ b/release/scripts/addons_contrib/add_mesh_building_objects/add_mesh_window.py
@@ -1,79 +1,53 @@
-'''bl_info = {
-    "name": "Window",
+bl_info = {
+    "name": "Window Generator 2",
     "author": "SayPRODUCTIONS",
-    "version": (1, 0),
-    "blender": (2, 5, 9),
+    "version": (2, 0),
+    "blender": (2, 6, 3),
     "api": 33333,
     "location": "View3D > Add > Mesh > Say3D",
-    "description": "Window olusturma",
+    "description": "Window Generator 2",
     "warning": "",
     "wiki_url": "",
     "tracker_url": "",
     "category": "Add Mesh"}
-	'''
 import bpy
 from bpy.props import *
-from bpy_extras.object_utils import object_data_add
-from mathutils import Vector
-import operator
-from math import pi, sin, cos, sqrt, atan
-
-def MAhs():
-    if 'Wood' not in bpy.data.materials:
-        mtl=bpy.data.materials.new('Wood')
-        mtl.diffuse_color     = (0.3,0.18,0.12)
-        mtl.diffuse_shader    = 'LAMBERT' 
-        mtl.diffuse_intensity = 1.0 
+from math import pi, sin, cos, sqrt
+def MAT(AD,R,G,B):
+    if AD not in bpy.data.materials:
+        mtl=bpy.data.materials.new(AD)
+        mtl.diffuse_color     = ([R,G,B])
+        mtl.diffuse_shader    = 'LAMBERT'
+        mtl.diffuse_intensity = 1.0
     else:
-        mtl=bpy.data.materials['Glass']
-    return mtl
-def MPVC():
-    if 'PVC' not in bpy.data.materials:
-        mtl=bpy.data.materials.new('PVC')
-        mtl.diffuse_color     = (0.5,0.4,0.3)
-        mtl.diffuse_shader    = 'LAMBERT' 
-        mtl.diffuse_intensity = 1.0 
-    else:
-        mtl=bpy.data.materials['PVC']
-    return mtl
-
-def MGlass():
-
-    if 'Glass' not in bpy.data.materials:
-        mtl = bpy.data.materials.new('Glass')
-        mtl.diffuse_color     = (0.5,0.8,1.0)
-        mtl.diffuse_shader    = 'LAMBERT' 
-        mtl.diffuse_intensity = 1.0 
-        mtl.use_transparency = True
-        mtl.type = 'SURFACE'
-        mtl.alpha = 0.3
-        mtl.raytrace_mirror.use = True
-        mtl.raytrace_mirror.reflect_factor = 0.65
-    else:
-        mtl=bpy.data.materials['Glass']
-    return mtl
-def MMer():
-    if 'Marble' not in bpy.data.materials:
-        mtl=bpy.data.materials.new('Marble')
-        mtl.diffuse_color     = (0.2,0.1,0.1)
-        mtl.diffuse_shader    = 'LAMBERT' 
-        mtl.diffuse_intensity = 1.0 
-    else:
-        mtl=bpy.data.materials['Marble']
-    return mtl
-
-    matnew1.diffuse_shader = 'OREN_NAYAR' 
-    matnew1.roughness = 0.909
-
-    #spec1
-    matnew1.specular_color = spec1
-    matnew1.specular_shader = 'COOKTORR'
-    matnew1.specular_intensity = 0.5
-    matnew1.alpha = alpha
-    matnew1.ambient = 1
-    matnew1.emit=emit
-
+        mtl=bpy.data.materials[AD]
     return mtl
+def Fitil(vr,fc,X,Z,x,y,z,zz,xx):
+    k3=z*2
+    vr.extend([[X[x  ]+xx,-z+zz,Z[y  ]+xx],[X[x  ]+xx+k3,-z+zz,Z[y  ]+xx+k3],[X[x  ]+xx+k3,z+zz,Z[y  ]+xx+k3],[X[x  ]+xx,z+zz,Z[y  ]+xx]])
+    vr.extend([[X[x  ]+xx,-z+zz,Z[y+1]-xx],[X[x  ]+xx+k3,-z+zz,Z[y+1]-xx-k3],[X[x  ]+xx+k3,z+zz,Z[y+1]-xx-k3],[X[x  ]+xx,z+zz,Z[y+1]-xx]])
+    vr.extend([[X[x+1]-xx,-z+zz,Z[y+1]-xx],[X[x+1]-xx-k3,-z+zz,Z[y+1]-xx-k3],[X[x+1]-xx-k3,z+zz,Z[y+1]-xx-k3],[X[x+1]-xx,z+zz,Z[y+1]-xx]])
+    vr.extend([[X[x+1]-xx,-z+zz,Z[y  ]+xx],[X[x+1]-xx-k3,-z+zz,Z[y  ]+xx+k3],[X[x+1]-xx-k3,z+zz,Z[y  ]+xx+k3],[X[x+1]-xx,z+zz,Z[y  ]+xx]])
+    n=len(vr)
+    fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10]])
+    fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6]])
+    fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2]])
+    fc.extend([[n- 4,n- 3,n-15,n-16],[n- 3,n- 2,n-14,n-15],[n- 2,n- 1,n-13,n-14]])
+    z=0.005
+    vr.extend([[X[x]+xx+k3,-z+zz,Z[y]+xx+k3],[X[x]+xx+k3,-z+zz,Z[y+1]-xx-k3],[X[x+1]-xx-k3,-z+zz,Z[y+1]-xx-k3],[X[x+1]-xx-k3,-z+zz,Z[y]+xx+k3]])
+    vr.extend([[X[x]+xx+k3, z+zz,Z[y]+xx+k3],[X[x]+xx+k3, z+zz,Z[y+1]-xx-k3],[X[x+1]-xx-k3, z+zz,Z[y+1]-xx-k3],[X[x+1]-xx-k3, z+zz,Z[y]+xx+k3]])
+    fc.extend([[n+1,n+0,n+3,n+2],[n+4,n+5,n+6,n+7]])
+def Kapak(vr,fc,X,Z,x,y,z,zz):
+    k2=z*2
+    vr.extend([[X[x  ],-z+zz,Z[y  ]],[X[x  ]+k2,-z+zz,Z[y  ]+k2],[X[x  ]+k2,z+zz,Z[y  ]+k2],[X[x  ],z+zz,Z[y  ]]])
+    vr.extend([[X[x  ],-z+zz,Z[y+1]],[X[x  ]+k2,-z+zz,Z[y+1]-k2],[X[x  ]+k2,z+zz,Z[y+1]-k2],[X[x  ],z+zz,Z[y+1]]])
+    vr.extend([[X[x+1],-z+zz,Z[y+1]],[X[x+1]-k2,-z+zz,Z[y+1]-k2],[X[x+1]-k2,z+zz,Z[y+1]-k2],[X[x+1],z+zz,Z[y+1]]])
+    vr.extend([[X[x+1],-z+zz,Z[y  ]],[X[x+1]-k2,-z+zz,Z[y  ]+k2],[X[x+1]-k2,z+zz,Z[y  ]+k2],[X[x+1],z+zz,Z[y  ]]])
+    n=len(vr)
+    fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10],[n-13,n-16,n-12,n- 9]])
+    fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6],[n- 9,n-12,n- 8,n- 5]])
+    fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2],[n- 5,n- 8,n- 4,n- 1]])
+    fc.extend([[n- 4,n- 3,n-15,n-16],[n- 3,n- 2,n-14,n-15],[n- 2,n- 1,n-13,n-14],[n- 1,n- 4,n-16,n-13]])
 def Prs(s):
     if  s.prs=='1':
         s.gen=3;s.yuk=1;s.kl1=5;s.kl2=5;s.fk=2
@@ -117,17 +91,10 @@ def Prs(s):
         s.gnx0=70
         s.k00 =True;s.k10 =False
         s.mr=False
-def kub(f,y,k,x,l,r,u,d):
-    k=(k*2)+(x*y)
-    if d==1:f.append([  k,   1+k, y+1+k,   y+k])#Alt
-    if u==1:f.append([3+k,   2+k, y+2+k, y+3+k])#Ust
-    if l==1:f.append([1+k,     k,   2+k,   3+k])#Sol
-    if r==1:f.append([y+k, y+1+k, y+3+k, y+2+k])#Sag
-    f.append([   k,   y+k, y+2+k,   2+k])#On
-    f.append([ 3+k, y+3+k, y+1+k,   1+k])#Arka
 def add_object(self, context):
     fc=[];vr=[];kx=[]
-    mx=self.gen;my=self.yuk;k1=self.kl1/100;y=my*4+4;k2=self.kl2/100;k3=self.fk/200
+    mx=self.gen;my=self.yuk;k1=self.kl1/100;y=my*4+4;k2=self.kl2/100;k3=self.fk/200;fr=(k1+k2)*0.5-0.01
+    RES=self.RES
 
     u=self.kl1/100;X=[0,round(u,2)]
     if mx> 0:u+=self.gnx0 /100;X.append(round(u,2));u+=k2;X.append(round(u,2))
@@ -148,124 +115,520 @@ def add_object(self, context):
     if my> 4:u+=self.gny4 /100;Z.append(round(u,2));u+=k2;Z.append(round(u,2))
     Z[-1]=Z[-2]+k1
 
-    u=X[-1]/2
-
-    kp=[];kp.append(self.k00);kp.append(self.k10);kp.append(self.k20);kp.append(self.k30);kp.append(self.k40);kx.append(kp)
-    kp=[];kp.append(self.k01);kp.append(self.k11);kp.append(self.k21);kp.append(self.k31);kp.append(self.k41);kx.append(kp)
-    kp=[];kp.append(self.k02);kp.append(self.k12);kp.append(self.k22);kp.append(self.k32);kp.append(self.k42);kx.append(kp)
-    kp=[];kp.append(self.k03);kp.append(self.k13);kp.append(self.k23);kp.append(self.k33);kp.append(self.k43);kx.append(kp)
-    kp=[];kp.append(self.k04);kp.append(self.k14);kp.append(self.k24);kp.append(self.k34);kp.append(self.k44);kx.append(kp)
-    kp=[];kp.append(self.k05);kp.append(self.k15);kp.append(self.k25);kp.append(self.k35);kp.append(self.k45);kx.append(kp)
-    kp=[];kp.append(self.k06);kp.append(self.k16);kp.append(self.k26);kp.append(self.k36);kp.append(self.k46);kx.append(kp)
-    kp=[];kp.append(self.k07);kp.append(self.k17);kp.append(self.k27);kp.append(self.k37);kp.append(self.k47);kx.append(kp)
-    Glass=[];mer=[]
-
-    for x in X:
-        for z in Z:
-            vr.append([x-u, -k1/2,z]);vr.append([x-u,k1/2,z])
-    for x in range(0,mx*2+1):
-        for z in range(0,my*2+1):
-            if x%2==0:t=0;d=0
-            else:     t=1;d=1
-            if z%2==0:l=0;r=0
-            else:     l=1;r=1
-            if z  ==  0:d=1
-            if z ==my*2:t=1
-            if x  ==  0:l=1
-            if x ==mx*2:r=1
-            if x%2==0 or z%2==0:kub(fc,y,z,x,l,r,t,d)
-    #Divide
-    for x in range(0,mx*2):
-        for z in range(0,my*2):
-            if x%2==1 and z%2==1:
-                d=Z[ z ];  t=Z[z+1]
-                l=X[ x ]-u;r=X[x+1]-u
-                ac=0
-                if kx[int(x/2)][int(z/2)]==True:
-                    ac=k1-0.01
-                    vr.append([l,    k1/2+ac,d   ]);vr.append([l,   -k1/2+ac,d   ])
-                    vr.append([l+k1, k1/2+ac,d+k1]);vr.append([l+k1,-k1/2+ac,d+k1])
-                    vr.append([r,    k1/2+ac,d   ]);vr.append([r,   -k1/2+ac,d   ])
-                    vr.append([r-k1, k1/2+ac,d+k1]);vr.append([r-k1,-k1/2+ac,d+k1])
-                    vr.append([r,    k1/2+ac,t   ]);vr.append([r,   -k1/2+ac,t   ])
-                    vr.append([r-k1, k1/2+ac,t-k1]);vr.append([r-k1,-k1/2+ac,t-k1])
-                    vr.append([l,    k1/2+ac,t   ]);vr.append([l,   -k1/2+ac,t   ])
-                    vr.append([l+k1, k1/2+ac,t-k1]);vr.append([l+k1,-k1/2+ac,t-k1])
-                    l+=k1;r-=k1;d+=k1;t-=k1;n=len(vr)
-                    fc.append([n- 1,n- 2,n- 6,n- 5]);fc.append([n- 5,n- 6,n-10,n- 9])
-                    fc.append([n- 9,n-10,n-14,n-13]);fc.append([n- 2,n- 1,n-13,n-14])
-                    fc.append([n- 2,n- 4,n- 8,n- 6]);fc.append([n- 6,n- 8,n-12,n-10])
-                    fc.append([n-10,n-12,n-16,n-14]);fc.append([n- 4,n- 2,n-14,n-16])
-                    fc.append([n- 3,n- 1,n- 5,n- 7]);fc.append([n- 7,n- 5,n- 9,n-11])
-                    fc.append([n-11,n- 9,n-13,n-15]);fc.append([n- 1,n- 3,n-15,n-13])
-                    fc.append([n- 4,n- 3,n- 7,n- 8]);fc.append([n- 8,n- 7,n-11,n-12])
-                    fc.append([n-12,n-11,n-15,n-16]);fc.append([n- 3,n- 4,n-16,n-15])
-                #Fitil
-                vr.append([l,      k3+ac,d     ]);vr.append([l,     -k3+ac,d     ])
-                vr.append([l+k3*2, k3+ac,d+k3*2]);vr.append([l+k3*2,-k3+ac,d+k3*2])
-                vr.append([r,      k3+ac,d     ]);vr.append([r,     -k3+ac,d     ])
-                vr.append([r-k3*2, k3+ac,d+k3*2]);vr.append([r-k3*2,-k3+ac,d+k3*2])
-                vr.append([r,      k3+ac,t     ]);vr.append([r,     -k3+ac,t     ])
-                vr.append([r-k3*2, k3+ac,t-k3*2]);vr.append([r-k3*2,-k3+ac,t-k3*2])
-                vr.append([l,      k3+ac,t     ]);vr.append([l,     -k3+ac,t     ])
-                vr.append([l+k3*2, k3+ac,t-k3*2]);vr.append([l+k3*2,-k3+ac,t-k3*2])
+    u = X[-1]/2
+    for i in range(0,len(X)):X[i]-=u
+    kx=[[self.k00,self.k10,self.k20,self.k30,self.k40],
+        [self.k01,self.k11,self.k21,self.k31,self.k41],
+        [self.k02,self.k12,self.k22,self.k32,self.k42],
+        [self.k03,self.k13,self.k23,self.k33,self.k43],
+        [self.k04,self.k14,self.k24,self.k34,self.k44],
+        [self.k05,self.k15,self.k25,self.k35,self.k45],
+        [self.k06,self.k16,self.k26,self.k36,self.k46],
+        [self.k07,self.k17,self.k27,self.k37,self.k47]]
+    cam=[];mer=[];ftl=[];SM=[]
+#VERTICES ------------------------
+    vr.extend([[X[0],-k1/2,Z[0]],[X[0],k1/2,Z[0]]])
+    for x in range(1,len(X)-1):vr.extend([[X[x],-k1/2,Z[1]],[X[x], k1/2,Z[1]]])
+    vr.extend([[X[-1],-k1/2,Z[0]],[X[-1], k1/2,Z[0]]])
+    for z in range(2,len(Z)-2,2):
+        for x in range(0,len(X)):vr.extend([[X[x],-k1/2,Z[z]],[X[x], k1/2,Z[z]]])
+        for x in range(0,len(X)):vr.extend([[X[x],-k1/2,Z[z+1]],[X[x], k1/2,Z[z+1]]])
+    z=len(Z)-2
+    vr.extend([[X[0],-k1/2,Z[z+1]],[X[0], k1/2,Z[z+1]]])
+    ALT=[];UST=[len(vr)-2,len(vr)-1]
+    for x in range(1,len(X)-1):
+        vr.extend([[X[x],-k1/2,Z[z]],[X[x], k1/2,Z[z]]])
+        ALT.extend([len(vr)-2,len(vr)-1])
+    vr.extend([[X[-1],-k1/2,Z[z+1]],[X[-1],k1/2,Z[z+1]]])
+    SON=[len(vr)-2,len(vr)-1]
+#FACES ---------------------------
+    fc.append([0,1,3+mx*4,2+mx*4])
+    FB=[0];FR=[1]
+    for i in range(0,mx*4,4):
+        fc.append([i+3,i+2,i+4,i+5])
+        FB.extend([i+2,i+4])
+        FR.extend([i+3,i+5])
+    FR.append(3+mx*4);FB.append(2+mx*4)
+    FB.reverse()
+    fc.extend([FB,FR])
+    #Yatay
+    Y=(mx*4+4);V=mx*4+2
+    for z in range(0,(my-1)*Y*2,Y*2):
+        fc.extend([[z+Y+1,z+Y,z+Y+4+mx*4,z+Y+5+mx*4],[z+Y+V,z+Y+V+1,z+Y+V+5+mx*4,z+Y+V+4+mx*4]])
+        for i in range(0,mx*4+2,2):fc.extend([[z+i+Y+0,z+i+Y+2,z+i+Y+V+4,z+i+Y+V+2],[z+i+Y  +3,z+i+Y  +1,z+i+Y+V+3,z+i+Y+V+5]])
+        for i in range(0,mx*4-3,4):fc.extend([[z+i+Y+2,z+i+Y+3,z+i+Y  +5,z+i+Y  +4],[z+i+Y+V+5,z+i+Y+V+4,z+i+Y+V+6,z+i+Y+V+7]])
+    #Dikey
+    for Y in range(0,my):    
+        z=Y*(mx*4+4)*2
+        for i in range(0,mx*4+2,4):fc.extend([[z+i+1,z+i+0,z+i+V+2,z+i+V+3],[z+i+3,z+i+1,z+i+V+3,z+i+V+5],[z+i+2,z+i+3,z+i+V+5,z+i+V+4],[z+i+0,z+i+2,z+i+V+4,z+i+V+2]])
+    #Fitil-------------------
+    if self.UST=='1':y1=my
+    else:            y1=my-1
+    for y in range(0,y1):
+        for x in range(0,mx):
+            if  kx[x][y]==True:
+                Kapak(vr,fc,X,Z,x*2+1,y*2+1,k2/2,(k1+k2)*0.5-0.01)
+                Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,(k1+k2)*0.5-0.01,k2)
+            else:
+                Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,0,0)
+            m=len(fc);cam.extend([m-1,m-2])
+            ftl.extend([m-3,m-4,m-5,m-6,m-7,m-8,m-9,m-10,m-11,m-12,m-13,m-14])
+    #-----------------------------------------------------
+    if  self.UST=='1':#Duz
+        fc.append([UST[1],UST[0],SON[0],SON[1]])
+        for i in range(0,mx*4,4):
+            fc.append([ALT[i],ALT[i+1],ALT[i+3],ALT[i+2]])
+        ON=[UST[0]]
+        AR=[UST[1]]
+        for i in range(0,len(ALT)-1,2):
+            ON.append(ALT[i  ])
+            AR.append(ALT[i+1])
+        ON.append(SON[0])
+        fc.append(ON)
+        AR.append(SON[1])
+        AR.reverse();fc.append(AR)
+    elif self.UST=='2':#Yay
+        if   self.DT2=='1':
+            H=self.VL1/100
+            if   H<0.01:H=  0.01;self.VL1=1
+            elif H >= u:H=u-0.01;self.VL1=H*100
+            h=sqrt(u**2+H**2)/2
+            e=h*(u/H)
+            C=sqrt(h**2+e**2)
+            T1=Z[-1]-H
+        elif self.DT2=='2':
+            C=self.VL2/100
+            if  C<u+0.01:
+                C=u+0.01
+                self.VL2=C*100
+            T1=sqrt(C**2-u**2)+Z[-1]-C
+        R=C-k1;F=R-k3*2
+        K=R-k2;E=K-k3*2
+        z=Z[-1]-C
+
+        vr[UST[0]][2]=T1;vr[UST[1]][2]=T1
+        vr[SON[0]][2]=T1;vr[SON[1]][2]=T1
+        for i in ALT:vr[i][2]=sqrt(R**2-vr[i][0]**2)+z
+
+        ON=[SON[0]];U1=[]
+        for i in range(0,RES):
+            A=i*pi/RES;x=cos(A)*C
+            if  x>-u and x<u:
+                vr.append([x,-k1/2,sin(A)*C+z]);ON.append(len(vr)-1)
+        U1.extend(ON);U1.append(UST[0])
+        ON.extend([UST[0],ALT[0]])
+        AR=[];D1=[];D2=[]
+        for i in range(0,len(ALT)-2,4):
+            x1=vr[ALT[i+0]][0]; x2=vr[ALT[i+2]][0]
+            ON.append(ALT[i+0]);AR.append(ALT[i+1])
+            T1=[ALT[i+0]];      T2=[ALT[i+1]]
+            for j in range(0,RES):
+                A=j*pi/RES;x=-cos(A)*R
+                if  x1<x and x<x2:
+                    vr.extend([[x,-k1/2,sin(A)*R+z],[x,k1/2,sin(A)*R+z]])
+                    ON.append(len(vr)-2);AR.append(len(vr)-1)
+                    T1.append(len(vr)-2);T2.append(len(vr)-1)
+            ON.append(ALT[i+2]);AR.append(ALT[i+3])
+            T1.append(ALT[i+2]);T2.append(ALT[i+3])
+            D1.append(T1);      D2.append(T2)
+        AR.append(SON[1])
+        U2=[SON[1]]
+        for i in range(0,RES):
+            A=i*pi/RES;x=cos(A)*C
+            if  x>-u and x<u:
+                vr.append([x,k1/2,sin(A)*C+z])
+                AR.append(len(vr)-1);U2.append(len(vr)-1)
+        AR.append(UST[1])
+        U2.append(UST[1])
+        AR.reverse()
+        fc.extend([ON,AR])
+        for i in range(0,len(U1)-1):fc.append([U1[i+1],U1[i],U2[i],U2[i+1]]);SM.append(len(fc)-1)
+        for A in range(0,mx):
+            for i in range(0,len(D1[A])-1):
+                fc.append([D1[A][i+1],D1[A][i],D2[A][i],D2[A][i+1]]);SM.append(len(fc)-1)
+        y=my-1
+        for x in range(0,mx):
+            if  kx[x][y]==True:
+                fr=(k1+k2)*0.5-0.01;ek=k2                
+                R=C-k1;K=R-k2
+
+                x1=X[x*2+1];x2=X[x*2+2]
+                vr.extend([[x2,fr-k2/2,z+1  ],[x2-k2,fr-k2/2,z+1     ],[x2-k2,fr+k2/2,z+1     ],[x2,fr+k2/2,z+1  ]])
+                vr.extend([[x2,fr-k2/2,Z[-3]],[x2-k2,fr-k2/2,Z[-3]+k2],[x2-k2,fr+k2/2,Z[-3]+k2],[x2,fr+k2/2,Z[-3]]])
+                vr.extend([[x1,fr-k2/2,Z[-3]],[x1+k2,fr-k2/2,Z[-3]+k2],[x1+k2,fr+k2/2,Z[-3]+k2],[x1,fr+k2/2,Z[-3]]])
+                vr.extend([[x1,fr-k2/2,z+1  ],[x1+k2,fr-k2/2,z+1     ],[x1+k2,fr+k2/2,z+1     ],[x1,fr+k2/2,z+1  ]])
+
+                n=len(vr)
+                fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10],[n-13,n-16,n-12,n- 9]])
+                fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6],[n- 9,n-12,n- 8,n- 5]])
+                fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2],[n- 5,n- 8,n- 4,n- 1]])
+                ALT=[n-16,n-15,n-14,n-13,n-4,n-3,n-2,n-1]
+                vr[ALT[0]][2]=sqrt(R**2-vr[ALT[0]][0]**2)+z;vr[ALT[1]][2]=sqrt(K**2-vr[ALT[1]][0]**2)+z
+                vr[ALT[2]][2]=sqrt(K**2-vr[ALT[2]][0]**2)+z;vr[ALT[3]][2]=sqrt(R**2-vr[ALT[3]][0]**2)+z
+                vr[ALT[4]][2]=sqrt(R**2-vr[ALT[4]][0]**2)+z;vr[ALT[5]][2]=sqrt(K**2-vr[ALT[5]][0]**2)+z
+                vr[ALT[6]][2]=sqrt(K**2-vr[ALT[6]][0]**2)+z;vr[ALT[7]][2]=sqrt(R**2-vr[ALT[7]][0]**2)+z
+
+                D1=[];D2=[];T1=[];T2=[]
+                for i in range(0,RES):
+                    A =i*pi/RES;y1=cos(A)*R;y2=-cos(A)*K
+                    if x1   <y1 and y1<x2:   vr.extend([[y1,fr-k2/2,sin(A)*R+z],[y1,fr+k2/2,sin(A)*R+z]]);T1.append(len(vr)-2);T2.append(len(vr)-1)
+                    if x1+k2<y2 and y2<x2-k2:vr.extend([[y2,fr-k2/2,sin(A)*K+z],[y2,fr+k2/2,sin(A)*K+z]]);D1.append(len(vr)-2);D2.append(len(vr)-1)
+                ON=[ALT[1],ALT[0]];ON.extend(T1);ON.extend([ALT[4],ALT[5]]);ON.extend(D1)
+                AR=[ALT[2],ALT[3]];AR.extend(T2);AR.extend([ALT[7],ALT[6]]);AR.extend(D2);AR.reverse()
+
+                if   D1==[] and T1==[]:fc.extend([ON,AR,[ALT[5],ALT[6],ALT[2],ALT[1]],[ALT[7],ALT[4],ALT[0],ALT[3]]]);                                                        m=len(fc);SM.extend([m-1,m-2])
+                elif D1==[] and T1!=[]:fc.extend([ON,AR,[ALT[5],ALT[6],ALT[2],ALT[1]],[ALT[7],ALT[4],T1[-1],T2[-1]],[ALT[0],ALT[3],T2[0],T1[0]]]);                            m=len(fc);SM.extend([m-1,m-2,m-3])
+                elif D1!=[] and T1==[]:fc.extend([ON,AR,[ALT[5],ALT[6],D2[0],D1[0]],[ALT[2],ALT[1],D1[-1],D2[-1]],[ALT[7],ALT[4],ALT[0],ALT[3]]]);                            m=len(fc);SM.extend([m-1,m-2,m-3])
+                else:                  fc.extend([ON,AR,[ALT[5],ALT[6],D2[0],D1[0]],[ALT[2],ALT[1],D1[-1],D2[-1]],[ALT[7],ALT[4],T1[-1],T2[-1]],[ALT[0],ALT[3],T2[0],T1[0]]]);m=len(fc);SM.extend([m-1,m-2,m-3,m-4])
+
+                for i in range(0,len(D1)-1):fc.append([D1[i+1],D1[i],D2[i],D2[i+1]]);SM.append(len(fc)-1)
+                for i in range(0,len(T1)-1):fc.append([T1[i+1],T1[i],T2[i],T2[i+1]]);SM.append(len(fc)-1)
+                R=C-k1-k2;K=R-k3*2
+            else:
+                fr=0;ek=0
+                R=C-k1;K=R-k3*2
+            #Fitil
+            x1=X[x*2+1]+ek;x2=X[x*2+2]-ek
+            vr.extend([[x2,fr-k3,z+1     ],[x2-k3*2,fr-k3,z+1          ],[x2-k3*2,fr+k3,z+1          ],[x2,fr+k3,z+1     ]])
+            vr.extend([[x2,fr-k3,Z[-3]+ek],[x2-k3*2,fr-k3,Z[-3]+ek+k3*2],[x2-k3*2,fr+k3,Z[-3]+ek+k3*2],[x2,fr+k3,Z[-3]+ek]])
+            vr.extend([[x1,fr-k3,Z[-3]+ek],[x1+k3*2,fr-k3,Z[-3]+ek+k3*2],[x1+k3*2,fr+k3,Z[-3]+ek+k3*2],[x1,fr+k3,Z[-3]+ek]])
+            vr.extend([[x1,fr-k3,z+1     ],[x1+k3*2,fr-k3,z+1          ],[x1+k3*2,fr+k3,z+1          ],[x1,fr+k3,z+1     ]])
+            n=len(vr)
+            fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10]])
+            fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6]])
+            fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2]])
+            m=len(fc);ftl.extend([m-1,m-2,m-3,m-4,m-5,m-6,m-7,m-8,m-9])
+            ALT=[n-16,n-15,n-14,n-13,n-4,n-3,n-2,n-1]
+            vr[ALT[0]][2]=sqrt(R**2-vr[ALT[0]][0]**2)+z;vr[ALT[1]][2]=sqrt(K**2-vr[ALT[1]][0]**2)+z
+            vr[ALT[2]][2]=sqrt(K**2-vr[ALT[2]][0]**2)+z;vr[ALT[3]][2]=sqrt(R**2-vr[ALT[3]][0]**2)+z
+            vr[ALT[4]][2]=sqrt(R**2-vr[ALT[4]][0]**2)+z;vr[ALT[5]][2]=sqrt(K**2-vr[ALT[5]][0]**2)+z
+            vr[ALT[6]][2]=sqrt(K**2-vr[ALT[6]][0]**2)+z;vr[ALT[7]][2]=sqrt(R**2-vr[ALT[7]][0]**2)+z
+            D1=[];D2=[];T1=[];T2=[]
+            for i in range(0,RES):
+                A =i*pi/RES;y1=cos(A)*R;y2=-cos(A)*K
+                if x1     <y1 and y1<x2:     vr.extend([[y1,fr-k3,sin(A)*R+z],[y1,fr+k3,sin(A)*R+z]]);T1.append(len(vr)-2);T2.append(len(vr)-1);ftl.extend([len(fc)-1,len(fc)-2])
+                if x1+k3*2<y2 and y2<x2-k3*2:vr.extend([[y2,fr-k3,sin(A)*K+z],[y2,fr+k3,sin(A)*K+z]]);D1.append(len(vr)-2);D2.append(len(vr)-1);ftl.extend([len(fc)-1,len(fc)-2])
+            ON=[ALT[1],ALT[0]];ON.extend(T1);ON.extend([ALT[4],ALT[5]]);ON.extend(D1)
+            AR=[ALT[2],ALT[3]];AR.extend(T2);AR.extend([ALT[7],ALT[6]]);AR.extend(D2);AR.reverse()
+
+            if  D1==[]:fc.extend([ON,AR,[ALT[5],ALT[6],ALT[2],ALT[1]]]);                            m=len(fc);ftl.extend([m-1,m-2,m-3    ]);SM.extend([m-1    ])
+            else:      fc.extend([ON,AR,[ALT[5],ALT[6],D2[0],D1[0]],[ALT[2],ALT[1],D1[-1],D2[-1]]]);m=len(fc);ftl.extend([m-1,m-2,m-3,m-4]);SM.extend([m-1,m-2])
+
+            for i in range(0,len(D1)-1):fc.append([D1[i+1],D1[i],D2[i],D2[i+1]]);ftl.append(len(fc)-1);SM.append(len(fc)-1)
+            #Cam
+            x1=X[x*2+1]+ek+k3*2;x2=X[x*2+2]-ek-k3*2
+            ON=[];AR=[]
+            for i in range(0,RES):
+                A= i*pi/RES;y1=-cos(A)*K
+                if  x1<y1 and y1<x2:
+                    vr.extend([[y1,fr-0.005,sin(A)*K+z],[y1,fr+0.005,sin(A)*K+z]])
+                    n=len(vr);ON.append(n-1);AR.append(n-2)
+            vr.extend([[x1,fr-0.005,sqrt(K**2-x1**2)+z],[x1,fr+0.005,sqrt(K**2-x1**2)+z]])
+            vr.extend([[x1,fr-0.005,Z[-3]+ek+k3*2     ],[x1,fr+0.005,Z[-3]+ek+k3*2     ]])
+            vr.extend([[x2,fr-0.005,Z[-3]+ek+k3*2     ],[x2,fr+0.005,Z[-3]+ek+k3*2     ]])
+            vr.extend([[x2,fr-0.005,sqrt(K**2-x2**2)+z],[x2,fr+0.005,sqrt(K**2-x2**2)+z]])
+            n=len(vr);ON.extend([n-1,n-3,n-5,n-7]);AR.extend([n-2,n-4,n-6,n-8])
+            fc.append(ON);AR.reverse();fc.append(AR)
+            m=len(fc);cam.extend([m-1,m-2])        
+
+    elif self.UST=='3':#Egri
+        if   self.DT3=='1':H=(self.VL1/200)/u
+        elif self.DT3=='2':H=self.VL3/100
+        elif self.DT3=='3':H=sin(self.VL4*pi/180)/cos(self.VL4*pi/180)
+        z=sqrt(k1**2+(k1*H)**2)
+        k=sqrt(k2**2+(k2*H)**2)
+        f=sqrt(k3**2+(k3*H)**2)*2
+        vr[UST[0]][2]=Z[-1]+vr[UST[0]][0]*H
+        vr[UST[1]][2]=Z[-1]+vr[UST[1]][0]*H
+        for i in ALT:
+            vr[i][2] =Z[-1]+vr[i][0]*H-z
+        vr[SON[0]][2]=Z[-1]+vr[SON[0]][0]*H
+        vr[SON[1]][2]=Z[-1]+vr[SON[1]][0]*H
+        fc.append([UST[1],UST[0], SON[0],SON[1] ])
+        for i in range(0,mx*4,4):
+            fc.append([ALT[i],ALT[i+1],ALT[i+3],ALT[i+2]])
+        ON=[UST[0]]
+        AR=[UST[1]]
+        for i in range(0,len(ALT)-1,2):
+            ON.append(ALT[i  ])
+            AR.append(ALT[i+1])
+        ON.append(SON[0])
+        fc.append(ON)
+        AR.append(SON[1])
+        AR.reverse();fc.append(AR)
+        y=my-1
+        for x in range(0,mx):
+            if  kx[x][y]==True:
+                Kapak(vr,fc,X,Z,x*2+1,y*2+1,k2/2,(k1+k2)*0.5-0.01)
+                n=len(vr)
+                vr[n- 5][2]=Z[-1]+vr[n- 5][0]*H-z
+                vr[n- 6][2]=Z[-1]+vr[n- 6][0]*H-z-k
+                vr[n- 7][2]=Z[-1]+vr[n- 7][0]*H-z-k
+                vr[n- 8][2]=Z[-1]+vr[n- 8][0]*H-z
+                vr[n- 9][2]=Z[-1]+vr[n- 9][0]*H-z
+                vr[n-10][2]=Z[-1]+vr[n-10][0]*H-z-k
+                vr[n-11][2]=Z[-1]+vr[n-11][0]*H-z-k
+                vr[n-12][2]=Z[-1]+vr[n-12][0]*H-z
+                Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,(k1+k2)*0.5-0.01,k2)
                 n=len(vr)
-                fc.append([n- 1,n- 2,n- 6,n- 5]);fc.append([n- 5,n- 6,n-10,n- 9])
-                fc.append([n- 9,n-10,n-14,n-13]);fc.append([n- 2,n- 1,n-13,n-14])
-                fc.append([n- 2,n- 4,n- 8,n- 6]);fc.append([n- 6,n- 8,n-12,n-10])
-                fc.append([n-10,n-12,n-16,n-14]);fc.append([n- 4,n- 2,n-14,n-16])
-                fc.append([n- 3,n- 1,n- 5,n- 7]);fc.append([n- 7,n- 5,n- 9,n-11])
-                fc.append([n-11,n- 9,n-13,n-15]);fc.append([n- 1,n- 3,n-15,n-13])
-                #Glass
-                vr.append([l+k3*2, 0.003+ac,d+k3*2]);vr.append([l+k3*2,-0.003+ac,d+k3*2])
-                vr.append([r-k3*2, 0.003+ac,d+k3*2]);vr.append([r-k3*2,-0.003+ac,d+k3*2])
-                vr.append([r-k3*2, 0.003+ac,t-k3*2]);vr.append([r-k3*2,-0.003+ac,t-k3*2])
-                vr.append([l+k3*2, 0.003+ac,t-k3*2]);vr.append([l+k3*2,-0.003+ac,t-k3*2])
+                vr[n- 2][2]=Z[-1]+vr[n- 2][0]*H-z-k-f
+                vr[n- 3][2]=Z[-1]+vr[n- 3][0]*H-z-k-f
+                vr[n- 6][2]=Z[-1]+vr[n- 6][0]*H-z-k-f
+                vr[n- 7][2]=Z[-1]+vr[n- 7][0]*H-z-k-f
+                vr[n-13][2]=Z[-1]+vr[n-13][0]*H-z-k
+                vr[n-14][2]=Z[-1]+vr[n-14][0]*H-z-k-f
+                vr[n-15][2]=Z[-1]+vr[n-15][0]*H-z-k-f
+                vr[n-16][2]=Z[-1]+vr[n-16][0]*H-z-k
+                vr[n-17][2]=Z[-1]+vr[n-17][0]*H-z-k
+                vr[n-18][2]=Z[-1]+vr[n-18][0]*H-z-k-f
+                vr[n-19][2]=Z[-1]+vr[n-19][0]*H-z-k-f
+                vr[n-20][2]=Z[-1]+vr[n-20][0]*H-z-k
+            else:
+                Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,0,0)
                 n=len(vr)
-                fc.append([n-1,n-3,n-4,n-2]);fc.append([n-3,n-5,n-6,n-4])
-                fc.append([n-5,n-7,n-8,n-6]);fc.append([n-7,n-1,n-2,n-8])
-                fc.append([n-3,n-1,n-7,n-5]);fc.append([n-2,n-4,n-6,n-8])
-                n=len(fc)
-                Glass.append(n-1);Glass.append(n-2);Glass.append(n-3)
-                Glass.append(n-4);Glass.append(n-5);Glass.append(n-6)
-    #Marble
-    if self.mr==True:
-        mrh=-self.mr1/100
-        mrg= self.mr2/100
-        mdv= (self.mr3/200)+mrg
-        msv=-(mdv+(self.mr4/100))
-        vr.append([-u,mdv,  0]);vr.append([u,mdv,  0])
-        vr.append([-u,msv,  0]);vr.append([u,msv,  0])
-        vr.append([-u,mdv,mrh]);vr.append([u,mdv,mrh])
-        vr.append([-u,msv,mrh]);vr.append([u,msv,mrh])
+                vr[n-2][2]=Z[-1]+vr[n-2][0]*H-z-f
+                vr[n-3][2]=Z[-1]+vr[n-3][0]*H-z-f
+                vr[n-6][2]=Z[-1]+vr[n-6][0]*H-z-f
+                vr[n-7][2]=Z[-1]+vr[n-7][0]*H-z-f
+                vr[n-13][2]=Z[-1]+vr[n-13][0]*H-z
+                vr[n-14][2]=Z[-1]+vr[n-14][0]*H-z-f
+                vr[n-15][2]=Z[-1]+vr[n-15][0]*H-z-f
+                vr[n-16][2]=Z[-1]+vr[n-16][0]*H-z
+                vr[n-17][2]=Z[-1]+vr[n-17][0]*H-z
+                vr[n-18][2]=Z[-1]+vr[n-18][0]*H-z-f
+                vr[n-19][2]=Z[-1]+vr[n-19][0]*H-z-f
+                vr[n-20][2]=Z[-1]+vr[n-20][0]*H-z
+            m=len(fc);cam.extend([m-1,m-2])
+            ftl.extend([m-3,m-4,m-5,m-6,m-7,m-8,m-9,m-10,m-11,m-12,m-13,m-14])
+    elif self.UST=='4':#Ucgen
+        if   self.DT3=='1':H=(self.VL1/100)/u
+        elif self.DT3=='2':H=self.VL3/100
+        elif self.DT3=='3':H=sin(self.VL4*pi/180)/cos(self.VL4*pi/180)
+        z=sqrt(k1**2+(k1*H)**2)
+        k=sqrt(k2**2+(k2*H)**2)
+        f=sqrt(k3**2+(k3*H)**2)*2
+        vr[UST[0]][2]=Z[-1]+vr[UST[0]][0]*H
+        vr[UST[1]][2]=Z[-1]+vr[UST[1]][0]*H
+        for i in ALT:
+            vr[i][2] =Z[-1]-abs(vr[i][0])*H-z
+        vr[SON[0]][2]=Z[-1]-vr[SON[0]][0]*H
+        vr[SON[1]][2]=Z[-1]-vr[SON[1]][0]*H
+        vr.extend([[0,-k1/2,Z[-1]],[0, k1/2,Z[-1]]])
+
+        x = 0
+        for j in range(2,len(ALT)-2,4):
+            if vr[ALT[j]][0]<0 and 0<vr[ALT[j+2]][0]:x=1
+
         n=len(vr)
-        fc.append([n-1,n-2,n-4,n-3])
-        fc.append([n-3,n-4,n-8,n-7])
-        fc.append([n-6,n-5,n-7,n-8])
-        fc.append([n-2,n-1,n-5,n-6])
-        fc.append([n-4,n-2,n-6,n-8])
-        fc.append([n-5,n-1,n-3,n-7])
-        n=len(fc)
-        mer.append(n-1);mer.append(n-2);mer.append(n-3)
-        mer.append(n-4);mer.append(n-5);mer.append(n-6)
+        fc.extend([[UST[1],UST[0],n-2,n-1],[n-1,n-2,SON[0],SON[1]]])
+        ON=[SON[0],n-2,UST[0]];AR=[SON[1],n-1,UST[1]]
+
+        if  x==0:vr.extend([[0,-k1/2,Z[-1]-z],[0,k1/2,Z[-1]-z]])
+        for j in range(0,len(ALT)-2,4):
+            if  vr[ALT[j]][0]<0 and vr[ALT[j+2]][0]<0:
+                fc.append([ALT[j],ALT[j+1],ALT[j+3],ALT[j+2]])
+                ON.extend([ALT[j  ],ALT[j+2]])
+                AR.extend([ALT[j+1],ALT[j+3]])
+            elif vr[ALT[j]][0]>0 and vr[ALT[j+2]][0]>0:
+                fc.append([ALT[j],ALT[j+1],ALT[j+3],ALT[j+2]])
+                ON.extend([ALT[j  ],ALT[j+2]])
+                AR.extend([ALT[j+1],ALT[j+3]])
+            else:
+                n=len(vr)
+                fc.extend([[ALT[j],ALT[j+1],n-1,n-2],[n-2,n-1,ALT[j+3],ALT[j+2]]])
+                ON.extend([ALT[j+0],n-2,ALT[j+2]])
+                AR.extend([ALT[j+1],n-1,ALT[j+3]])
+        fc.append(ON);AR.reverse();fc.append(AR)
+        y=my-1
+        for x in range(0,mx):
+            if  vr[ALT[x*4]][0]<0 and vr[ALT[x*4+2]][0]<0:
+                if  kx[x][y]==True:
+                    Kapak(vr,fc,X,Z,x*2+1,y*2+1,k2/2,(k1+k2)*0.5-0.01)
+                    n=len(vr)
+                    vr[n- 5][2]=Z[-1]+vr[n- 5][0]*H-z
+                    vr[n- 6][2]=Z[-1]+vr[n- 6][0]*H-z-k
+                    vr[n- 7][2]=Z[-1]+vr[n- 7][0]*H-z-k
+                    vr[n- 8][2]=Z[-1]+vr[n- 8][0]*H-z
+                    vr[n- 9][2]=Z[-1]+vr[n- 9][0]*H-z
+                    vr[n-10][2]=Z[-1]+vr[n-10][0]*H-z-k
+                    vr[n-11][2]=Z[-1]+vr[n-11][0]*H-z-k
+                    vr[n-12][2]=Z[-1]+vr[n-12][0]*H-z
+                    Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,(k1+k2)*0.5-0.01,k2)
+                    n=len(vr)
+                    vr[n- 2][2]=Z[-1]+vr[n- 2][0]*H-z-k-f
+                    vr[n- 3][2]=Z[-1]+vr[n- 3][0]*H-z-k-f
+                    vr[n- 6][2]=Z[-1]+vr[n- 6][0]*H-z-k-f
+                    vr[n- 7][2]=Z[-1]+vr[n- 7][0]*H-z-k-f
+                    vr[n-13][2]=Z[-1]+vr[n-13][0]*H-z-k
+                    vr[n-14][2]=Z[-1]+vr[n-14][0]*H-z-k-f
+                    vr[n-15][2]=Z[-1]+vr[n-15][0]*H-z-k-f
+                    vr[n-16][2]=Z[-1]+vr[n-16][0]*H-z-k
+                    vr[n-17][2]=Z[-1]+vr[n-17][0]*H-z-k
+                    vr[n-18][2]=Z[-1]+vr[n-18][0]*H-z-k-f
+                    vr[n-19][2]=Z[-1]+vr[n-19][0]*H-z-k-f
+                    vr[n-20][2]=Z[-1]+vr[n-20][0]*H-z-k
+                else:
+                    Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,0,0)
+                    n=len(vr)
+                    vr[n-2][2]=Z[-1]+vr[n-2][0]*H-z-f
+                    vr[n-3][2]=Z[-1]+vr[n-3][0]*H-z-f
+                    vr[n-6][2]=Z[-1]+vr[n-6][0]*H-z-f
+                    vr[n-7][2]=Z[-1]+vr[n-7][0]*H-z-f
+                    vr[n-13][2]=Z[-1]+vr[n-13][0]*H-z
+                    vr[n-14][2]=Z[-1]+vr[n-14][0]*H-z-f
+                    vr[n-15][2]=Z[-1]+vr[n-15][0]*H-z-f
+                    vr[n-16][2]=Z[-1]+vr[n-16][0]*H-z
+                    vr[n-17][2]=Z[-1]+vr[n-17][0]*H-z
+                    vr[n-18][2]=Z[-1]+vr[n-18][0]*H-z-f
+                    vr[n-19][2]=Z[-1]+vr[n-19][0]*H-z-f
+                    vr[n-20][2]=Z[-1]+vr[n-20][0]*H-z
+                m=len(fc);cam.extend([m-1,m-2])
+                ftl.extend([m-3,m-4,m-5,m-6,m-7,m-8,m-9,m-10,m-11,m-12,m-13,m-14])
+            elif vr[ALT[x*4]][0]>0 and vr[ALT[x*4+2]][0]>0:
+                if  kx[x][y]==True:
+                    Kapak(vr,fc,X,Z,x*2+1,y*2+1,k2/2,(k1+k2)*0.5-0.01)
+                    n=len(vr)
+                    vr[n- 5][2]=Z[-1]-vr[n- 5][0]*H-z
+                    vr[n- 6][2]=Z[-1]-vr[n- 6][0]*H-z-k
+                    vr[n- 7][2]=Z[-1]-vr[n- 7][0]*H-z-k
+                    vr[n- 8][2]=Z[-1]-vr[n- 8][0]*H-z
+                    vr[n- 9][2]=Z[-1]-vr[n- 9][0]*H-z
+                    vr[n-10][2]=Z[-1]-vr[n-10][0]*H-z-k
+                    vr[n-11][2]=Z[-1]-vr[n-11][0]*H-z-k
+                    vr[n-12][2]=Z[-1]-vr[n-12][0]*H-z
+                    Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,(k1+k2)*0.5-0.01,k2)
+                    n=len(vr)
+                    vr[n- 2][2]=Z[-1]-vr[n- 2][0]*H-z-k-f
+                    vr[n- 3][2]=Z[-1]-vr[n- 3][0]*H-z-k-f
+                    vr[n- 6][2]=Z[-1]-vr[n- 6][0]*H-z-k-f
+                    vr[n- 7][2]=Z[-1]-vr[n- 7][0]*H-z-k-f
+                    vr[n-13][2]=Z[-1]-vr[n-13][0]*H-z-k
+                    vr[n-14][2]=Z[-1]-vr[n-14][0]*H-z-k-f
+                    vr[n-15][2]=Z[-1]-vr[n-15][0]*H-z-k-f
+                    vr[n-16][2]=Z[-1]-vr[n-16][0]*H-z-k
+                    vr[n-17][2]=Z[-1]-vr[n-17][0]*H-z-k
+                    vr[n-18][2]=Z[-1]-vr[n-18][0]*H-z-k-f
+                    vr[n-19][2]=Z[-1]-vr[n-19][0]*H-z-k-f
+                    vr[n-20][2]=Z[-1]-vr[n-20][0]*H-z-k
+                else:
+                    Fitil(vr,fc,X,Z,x*2+1,y*2+1,k3,0,0)
+                    n=len(vr)
+                    vr[n-2][2]=Z[-1]-vr[n-2][0]*H-z-f
+                    vr[n-3][2]=Z[-1]-vr[n-3][0]*H-z-f
+                    vr[n-6][2]=Z[-1]-vr[n-6][0]*H-z-f
+                    vr[n-7][2]=Z[-1]-vr[n-7][0]*H-z-f
+                    vr[n-13][2]=Z[-1]-vr[n-13][0]*H-z
+                    vr[n-14][2]=Z[-1]-vr[n-14][0]*H-z-f
+                    vr[n-15][2]=Z[-1]-vr[n-15][0]*H-z-f
+                    vr[n-16][2]=Z[-1]-vr[n-16][0]*H-z
+                    vr[n-17][2]=Z[-1]-vr[n-17][0]*H-z
+                    vr[n-18][2]=Z[-1]-vr[n-18][0]*H-z-f
+                    vr[n-19][2]=Z[-1]-vr[n-19][0]*H-z-f
+                    vr[n-20][2]=Z[-1]-vr[n-20][0]*H-z
+                m=len(fc);cam.extend([m-1,m-2])
+                ftl.extend([m-3,m-4,m-5,m-6,m-7,m-8,m-9,m-10,m-11,m-12,m-13,m-14])
+            else:
+                k4=k3*2
+                if  kx[x][y]==True:
+                    zz=(k1+k2)*0.5-0.01
+                    xx=X[x*2+1]
+                    vr.extend([[xx,-k2/2+zz,Z[-3]       ],[xx+k2,-k2/2+zz,Z[-3]    +k2       ],[xx+k2,k2/2+zz,Z[-3]    +k2       ],[xx,k2/2+zz,Z[-3]       ]])
+                    vr.extend([[xx,-k2/2+zz,Z[-1]+xx*H-z],[xx+k2,-k2/2+zz,Z[-1]+(xx+k2)*H-z-k],[xx+k2,k2/2+zz,Z[-1]+(xx+k2)*H-z-k],[xx,k2/2+zz,Z[-1]+xx*H-z]])
+                    vr.extend([[ 0,-k2/2+zz,Z[-1]     -z],[    0,-k2/2+zz,Z[-1]          -z-k],[    0,k2/2+zz,Z[-1]          -z-k],[ 0,k2/2+zz,Z[-1]     -z]])
+                    xx=X[x*2+2]
+                    vr.extend([[xx,-k2/2+zz,Z[-1]-xx*H-z],[xx-k2,-k2/2+zz,Z[-1]-(xx-k2)*H-z-k],[xx-k2,k2/2+zz,Z[-1]-(xx-k2)*H-z-k],[xx,k2/2+zz,Z[-1]-xx*H-z]])
+                    vr.extend([[xx,-k2/2+zz,Z[-3]       ],[xx-k2,-k2/2+zz,Z[-3]    +k2       ],[xx-k2,k2/2+zz,Z[-3]    +k2       ],[xx,k2/2+zz,Z[-3]       ]])
+                    n=len(vr)
+                    fc.extend([[n-20,n-19,n-15,n-16],[n-19,n-18,n-14,n-15],[n-18,n-17,n-13,n-14],[n-17,n-20,n-16,n-13]])
+                    fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10],[n-13,n-16,n-12,n- 9]])
+                    fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6],[n- 9,n-12,n- 8,n- 5]])
+                    fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2],[n- 5,n- 8,n- 4,n- 1]])
+                    fc.extend([[n- 4,n- 3,n-19,n-20],[n- 3,n- 2,n-18,n-19],[n- 2,n- 1,n-17,n-18],[n- 1,n- 4,n-20,n-17]])
+                    xx=X[x*2+1]
+                    vr.extend([[xx   +k2,-k3+zz,Z[-3]    +k2            ],[xx+k4+k2,-k3+zz,Z[-3]    +k2+k4         ],[xx+k4+k2, k3+zz,Z[-3]    +k2+k4         ],[xx   +k2, k3+zz,Z[-3]    +k2            ]])
+                    vr.extend([[xx   +k2,-k3+zz,Z[-1]+(xx+k2   )*H-z-k  ],[xx+k4+k2,-k3+zz,Z[-1]+(xx+k2+k4)*H-z-k-f],[xx+k4+k2, k3+zz,Z[-1]+(xx+k2+k4)*H-z-k-f],[xx   +k2, k3+zz,Z[-1]+(xx+k2   )*H-z-k  ]])
+                    vr.extend([[    0,-k3+zz,Z[-1]-k     -z],[       0,-k3+zz,Z[-1]-k             -z-f],[       0,k3+zz,Z[-1]-k          -z-f],[    0,k3+zz,Z[-1]-k     -z]])
+                    xx=X[x*2+2]
+                    vr.extend([[xx   -k2,-k3+zz,Z[-1]-(xx-k2   )*H-z-k  ],[xx-k4-k2,-k3+zz,Z[-1]-(xx-k2-k4)*H-z-k-f],[xx-k4-k2, k3+zz,Z[-1]-(xx-k2-k4)*H-z-k-f],[xx   -k2, k3+zz,Z[-1]-(xx-k2   )*H-z-k  ]])
+                    vr.extend([[xx   -k2,-k3+zz,Z[-3]    +k2            ],[xx-k4-k2,-k3+zz,Z[-3]    +k2+k4         ],[xx-k4-k2, k3+zz,Z[-3]    +k2+k4         ],[xx   -k2, k3+zz,Z[-3]    +k2            ]])
+                    n=len(vr)
+                    fc.extend([[n-20,n-19,n-15,n-16],[n-19,n-18,n-14,n-15],[n-18,n-17,n-13,n-14]])
+                    fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10]])
+                    fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6]])
+                    fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2]])
+                    fc.extend([[n- 4,n- 3,n-19,n-20],[n- 3,n- 2,n-18,n-19],[n- 2,n- 1,n-17,n-18]])
+                    xx=X[x*2+1]
+                    vr.extend([[xx+k4+k2,-k3+zz,Z[-3]    +k2+k4         ],[xx+k4+k2, k3+zz,Z[-3]    +k2+k4         ]])
+                    vr.extend([[xx+k4+k2,-k3+zz,Z[-1]+(xx+k2+k4)*H-z-k-f],[xx+k4+k2, k3+zz,Z[-1]+(xx+k2+k4)*H-z-k-f]])
+                    vr.extend([[       0,-k3+zz,Z[-1]-k             -z-f],[       0,k3+zz,Z[-1]-k          -z-f]])
+                    xx=X[x*2+2]
+                    vr.extend([[xx-k4-k2,-k3+zz,Z[-1]-(xx-k2-k4)*H-z-k-f],[xx-k4-k2, k3+zz,Z[-1]-(xx-k2-k4)*H-z-k-f]])
+                    vr.extend([[xx-k4-k2,-k3+zz,Z[-3]    +k2+k4         ],[xx-k4-k2, k3+zz,Z[-3]    +k2+k4         ]])
+                    fc.extend([[n+8,n+6,n+4,n+2,n+0],[n+1,n+3,n+5,n+7,n+9]])
+                else:
+                    xx=X[x*2+1]
+                    vr.extend([[xx,-k3,Z[-3]       ],[xx+k4,-k3,Z[-3]    +k4       ],[xx+k4,k3,Z[-3]    +k4       ],[xx,k3,Z[-3]       ]])
+                    vr.extend([[xx,-k3,Z[-1]+xx*H-z],[xx+k4,-k3,Z[-1]+(xx+k4)*H-z-f],[xx+k4,k3,Z[-1]+(xx+k4)*H-z-f],[xx,k3,Z[-1]+xx*H-z]])
+                    vr.extend([[ 0,-k3,Z[-1]     -z],[    0,-k3,Z[-1]          -z-f],[    0,k3,Z[-1]          -z-f],[ 0,k3,Z[-1]     -z]])
+                    xx=X[x*2+2]
+                    vr.extend([[xx,-k3,Z[-1]-xx*H-z],[xx-k4,-k3,Z[-1]-(xx-k4)*H-z-f],[xx-k4,k3,Z[-1]-(xx-k4)*H-z-f],[xx,k3,Z[-1]-xx*H-z]])
+                    vr.extend([[xx,-k3,Z[-3]       ],[xx-k4,-k3,Z[-3]    +k4       ],[xx-k4,k3,Z[-3]    +k4       ],[xx,k3,Z[-3]       ]])
+                    n=len(vr)
+                    fc.extend([[n-20,n-19,n-15,n-16],[n-19,n-18,n-14,n-15],[n-18,n-17,n-13,n-14]])
+                    fc.extend([[n-16,n-15,n-11,n-12],[n-15,n-14,n-10,n-11],[n-14,n-13,n- 9,n-10]])
+                    fc.extend([[n-12,n-11,n- 7,n- 8],[n-11,n-10,n- 6,n- 7],[n-10,n- 9,n- 5,n- 6]])
+                    fc.extend([[n- 8,n- 7,n- 3,n- 4],[n- 7,n- 6,n- 2,n- 3],[n- 6,n- 5,n- 1,n- 2]])
+                    fc.extend([[n- 4,n- 3,n-19,n-20],[n- 3,n- 2,n-18,n-19],[n- 2,n- 1,n-17,n-18]])
+                    xx=X[x*2+1]
+                    vr.extend([[xx+k4,-0.005,Z[-3]    +k4       ],[xx+k4,0.005,Z[-3]    +k4       ]])
+                    vr.extend([[xx+k4,-0.005,Z[-1]+(xx+k4)*H-z-f],[xx+k4,0.005,Z[-1]+(xx+k4)*H-z-f]])
+                    vr.extend([[    0,-0.005,Z[-1]          -z-f],[    0,0.005,Z[-1]          -z-f]])
+                    xx=X[x*2+2]
+                    vr.extend([[xx-k4,-0.005,Z[-1]-(xx-k4)*H-z-f],[xx-k4,0.005,Z[-1]-(xx-k4)*H-z-f]])
+                    vr.extend([[xx-k4,-0.005,Z[-3]    +k4       ],[xx-k4,0.005,Z[-3]    +k4       ]])
+                    fc.extend([[n+8,n+6,n+4,n+2,n+0],[n+1,n+3,n+5,n+7,n+9]])
+                m=len(fc);cam.extend([m-1,m-2])
+                ftl.extend([m-3,m-4,m-5,m-6,m-7,m-8,m-9,m-10,m-11,m-12,m-13,m-14,m-15,m-16,m-17])
+    #Mermer
+    if  self.mr==True:
+        mrh=-self.mr1/100;mrg= self.mr2/100
+        mdv=(self.mr3/200)+mrg;msv=-(mdv+(self.mr4/100))
+        vr.extend([[-u,mdv,0],[u,mdv,0],[-u,msv,0],[u,msv,0],[-u,mdv,mrh],[u,mdv,mrh],[-u,msv,mrh],[u,msv,mrh]])
+        n=len(vr);fc.extend([[n-1,n-2,n-4,n-3],[n-3,n-4,n-8,n-7],[n-6,n-5,n-7,n-8],[n-2,n-1,n-5,n-6],[n-4,n-2,n-6,n-8],[n-5,n-1,n-3,n-7]])
+        n=len(fc);mer.extend([n-1,n-2,n-3,n-4,n-5,n-6])
 #OBJE -----------------------------------------------------------
     mesh = bpy.data.meshes.new(name='Window')
     mesh.from_pydata(vr,[],fc)
-    mesh.materials.append(MPVC());mesh.materials.append(MGlass());mesh.materials.append(MMer())
-    for i in Glass:
+    if   self.mt1=='1':mesh.materials.append(MAT('PVC',    1.0,1.0,1.0))
+    elif self.mt1=='2':mesh.materials.append(MAT('Wood',   0.3,0.2,0.1))
+    elif self.mt1=='3':mesh.materials.append(MAT('Plastic',0.0,0.0,0.0))
+
+    if   self.mt2=='1':mesh.materials.append(MAT('PVC',    1.0,1.0,1.0))
+    elif self.mt2=='2':mesh.materials.append(MAT('Wood',   0.3,0.2,0.1))
+    elif self.mt2=='3':mesh.materials.append(MAT('Plastic',0.0,0.0,0.0))
+
+    mesh.materials.append(MAT('Glass',0.5,0.8,1.0))
+    if self.mr==True:mesh.materials.append(MAT('Marble', 0.9,0.8,0.7))
+
+    for i in ftl:
         mesh.polygons[i].material_index=1
-    for i in mer:
+    for i in cam:
         mesh.polygons[i].material_index=2
+    for i in mer:
+        mesh.polygons[i].material_index=3
+    for i in SM:
+        mesh.polygons[i].use_smooth = 1
     mesh.update(calc_edges=True)
-    object_data_add(context, mesh, operator=None)
-    if bpy.context.mode != 'EDIT_MESH':
+    from bpy_extras import object_utils
+    return object_utils.object_data_add(context, mesh, operator=None)
+    if  bpy.context.mode!='EDIT_MESH':
         bpy.ops.object.editmode_toggle()
         bpy.ops.object.editmode_toggle()
 #----------------------------------------------------------------
-class OBJECT_OT_add_object(bpy.types.Operator):
-    bl_idname = "mesh.add_say3d_pencere"
+class PENCERE(bpy.types.Operator):
+    bl_idname = "mesh.add_say3d_pencere2"
     bl_label = "Window"
-    bl_description = "Window Olustur"
+    bl_description = "Window Generator"
     bl_options = {'REGISTER', 'UNDO'}
     prs = EnumProperty(items = (('1',"WINDOW 250X200",""),
                                 ('2',"WINDOW 200X200",""),
@@ -275,59 +638,73 @@ class OBJECT_OT_add_object(bpy.types.Operator):
                                 ('6',"WINDOW 50X50",""),
                                 ('7',"DOOR 80X250",""),
                                 ('8',"DOOR 80X230","")),
-                                name="",description="")
+                                name="")
     son=prs
-    gen=IntProperty(name='Horizontal',    min=1,max= 8, default= 3, description='Horizontal Divide')
-    yuk=IntProperty(name='Vertical',    min=1,max= 5, default= 1, description='Vertical Divide')
-    kl1=IntProperty(name='Frame',  min=2,max=50, default= 5, description='Frame Thickness')
-    kl2=IntProperty(name='Gap',   min=2,max=50, default= 5, description='Gap Thickness')
-    fk =IntProperty(name='Piping',    min=1,max=20, default= 2, description='Piping Thickness')
-
-    mr=BoolProperty(name='Sill', default=True,description='Sill')
-    mr1=IntProperty(min=1, max=20, default= 4,  description='Height')
-    mr2=IntProperty(min=0, max=20, default= 4,  description='Width')
-    mr3=IntProperty(min=1, max=50, default=20,  description='Sill Thickness')
-    mr4=IntProperty(min=0, max=50, default= 0,  description='Jamb Thickness')
-
-    gnx0=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx1=IntProperty(min=1,max=300,default=110,description='Width')
-    gnx2=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx3=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx4=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx5=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx6=IntProperty(min=1,max=300,default= 60,description='Width')
-    gnx7=IntProperty(min=1,max=300,default= 60,description='Width')
-
-    gny0=IntProperty(min=1,max=300,default=190,description='Height')
-    gny1=IntProperty(min=1,max=300,default= 45,description='Height')
-    gny2=IntProperty(min=1,max=300,default= 45,description='Height')
-    gny3=IntProperty(min=1,max=300,default= 45,description='Height')
-    gny4=IntProperty(min=1,max=300,default= 45,description='Height')
-
-    k00=BoolProperty(default=True); k01=BoolProperty(default=False)
-    k02=BoolProperty(default=True); k03=BoolProperty(default=False)
-    k04=BoolProperty(default=False);k05=BoolProperty(default=False)
-    k06=BoolProperty(default=False);k07=BoolProperty(default=False)
-
-    k10=BoolProperty(default=False);k11=BoolProperty(default=False)
-    k12=BoolProperty(default=False);k13=BoolProperty(default=False)
-    k14=BoolProperty(default=False);k15=BoolProperty(default=False)
-    k16=BoolProperty(default=False);k17=BoolProperty(default=False)
-
-    k20=BoolProperty(default=False);k21=BoolProperty(default=False)
-    k22=BoolProperty(default=False);k23=BoolProperty(default=False)
-    k24=BoolProperty(default=False);k25=BoolProperty(default=False)
-    k26=BoolProperty(default=False);k27=BoolProperty(default=False)
-
-    k30=BoolProperty(default=False);k31=BoolProperty(default=False)
-    k32=BoolProperty(default=False);k33=BoolProperty(default=False)
-    k34=BoolProperty(default=False);k35=BoolProperty(default=False)
-    k36=BoolProperty(default=False);k37=BoolProperty(default=False)
-
-    k40=BoolProperty(default=False);k41=BoolProperty(default=False)
-    k42=BoolProperty(default=False);k43=BoolProperty(default=False)
-    k44=BoolProperty(default=False);k45=BoolProperty(default=False)
-    k46=BoolProperty(default=False);k47=BoolProperty(default=False)
+    gen=IntProperty(name='H Count',     min=1,max= 8, default= 3, description='Horizontal Panes')
+    yuk=IntProperty(name='V Count',     min=1,max= 5, default= 1, description='Vertical Panes')
+    kl1=IntProperty(name='Outer Frame', min=2,max=50, default= 5, description='Outside Frame Thickness')
+    kl2=IntProperty(name='Risers',      min=2,max=50, default= 5, description='Risers Width')
+    fk =IntProperty(name='Inner Frame', min=1,max=20, default= 2, description='Inside Frame Thickness')
+
+    mr=BoolProperty(name='Sill', default=True,description='Window Sill')
+    mr1=IntProperty(name='',min=1, max=20, default= 4, description='Height')
+    mr2=IntProperty(name='',min=0, max=20, default= 4, description='First Depth')
+    mr3=IntProperty(name='',min=1, max=50, default=20, description='Second Depth')
+    mr4=IntProperty(name='',min=0, max=50, default= 0, description='Extrusion for Jamb')
+
+    mt1=EnumProperty(items =(('1',"PVC",""),('2',"WOOD",""),('3',"Plastic","")),name="",default='1')
+    mt2=EnumProperty(items =(('1',"PVC",""),('2',"WOOD",""),('3',"Plastic","")),name="",default='3')
+
+    UST=EnumProperty(items =(('1',"Flat",""),('2',"Arch",  ""),('3',"Inclined", ""),('4',"Triangle","")),name="Top",default='1')
+    DT2=EnumProperty(items =(('1',"Difference",""),('2',"Radius",   "")),                         name="",default='1')
+    DT3=EnumProperty(items =(('1',"Difference",""),('2',"Incline %",""),('3',"Incline Angle","")),name="",default='1')
+
+    VL1=IntProperty( name='',min=-10000,max=10000,default=30)#Fark
+    VL2=IntProperty( name='',min=     1,max=10000,default=30)#Cap
+    VL3=IntProperty( name='',min=  -100,max=  100,default=30)#Egim %
+    VL4=IntProperty( name='',min=   -45,max=   45,default=30)#Egim Aci
+
+    RES=IntProperty(name='Resolution pi/',min=2,max=360,default=36)#Res
+
+    gnx0=IntProperty(name='',min=1,max=300,default= 60,description='1st Window Width')
+    gnx1=IntProperty(name='',min=1,max=300,default=110,description='2nd Window Width')
+    gnx2=IntProperty(name='',min=1,max=300,default= 60,description='3rd Window Width')
+    gnx3=IntProperty(name='',min=1,max=300,default= 60,description='4th Window Width')
+    gnx4=IntProperty(name='',min=1,max=300,default= 60,description='5th Window Width')
+    gnx5=IntProperty(name='',min=1,max=300,default= 60,description='6th Window Width')
+    gnx6=IntProperty(name='',min=1,max=300,default= 60,description='7th Window Width')
+    gnx7=IntProperty(name='',min=1,max=300,default= 60,description='8th Window Width')
+
+    gny0=IntProperty(name='',min=1,max=300,default=190,description='1st Row Height')
+    gny1=IntProperty(name='',min=1,max=300,default= 45,description='2nd Row Height')
+    gny2=IntProperty(name='',min=1,max=300,default= 45,description='3rd Row Height')
+    gny3=IntProperty(name='',min=1,max=300,default= 45,description='4th Row Height')
+    gny4=IntProperty(name='',min=1,max=300,default= 45,description='5th Row Height')
+
+    k00=BoolProperty(name='',default=True); k01=BoolProperty(name='',default=False)
+    k02=BoolProperty(name='',default=True); k03=BoolProperty(name='',default=False)
+    k04=BoolProperty(name='',default=False);k05=BoolProperty(name='',default=False)
+    k06=BoolProperty(name='',default=False);k07=BoolProperty(name='',default=False)
+
+    k10=BoolProperty(name='',default=False);k11=BoolProperty(name='',default=False)
+    k12=BoolProperty(name='',default=False);k13=BoolProperty(name='',default=False)
+    k14=BoolProperty(name='',default=False);k15=BoolProperty(name='',default=False)
+    k16=BoolProperty(name='',default=False);k17=BoolProperty(name='',default=False)
+
+    k20=BoolProperty(name='',default=False);k21=BoolProperty(name='',default=False)
+    k22=BoolProperty(name='',default=False);k23=BoolProperty(name='',default=False)
+    k24=BoolProperty(name='',default=False);k25=BoolProperty(name='',default=False)
+    k26=BoolProperty(name='',default=False);k27=BoolProperty(name='',default=False)
+
+    k30=BoolProperty(name='',default=False);k31=BoolProperty(name='',default=False)
+    k32=BoolProperty(name='',default=False);k33=BoolProperty(name='',default=False)
+    k34=BoolProperty(name='',default=False);k35=BoolProperty(name='',default=False)
+    k36=BoolProperty(name='',default=False);k37=BoolProperty(name='',default=False)
+
+    k40=BoolProperty(name='',default=False);k41=BoolProperty(name='',default=False)
+    k42=BoolProperty(name='',default=False);k43=BoolProperty(name='',default=False)
+    k44=BoolProperty(name='',default=False);k45=BoolProperty(name='',default=False)
+    k46=BoolProperty(name='',default=False);k47=BoolProperty(name='',default=False)
     #--------------------------------------------------------------
     def draw(self, context):
         layout = self.layout
@@ -338,22 +715,36 @@ class OBJECT_OT_add_object(bpy.types.Operator):
         box.prop(self, 'fk')
 
         box.prop(self,'mr')
-        row=box.row();row.prop(self,'mr1', text="Sill Height");row.prop(self,'mr2', text="Sill Width")
-        row=box.row();row.prop(self,'mr3', text="Sill Thick");row.prop(self,'mr4', text="Jamb Thick")
-        row=layout.row()
-        row.label(text="Column Settings")
-        row=layout.row()
+        if  self.mr==True:
+            row=box.row();row.prop(self,'mr1');row.prop(self,'mr2')
+            row=box.row();row.prop(self,'mr3');row.prop(self,'mr4')
+        row =layout.row();row.label('Frame');row.label('Inner Frame')
+        row =layout.row();row.prop(self,'mt1');row.prop(self,'mt2')
+
+        box.prop(self,'UST')
+        if   self.UST=='2':
+            row= box.row();    row.prop(self,'DT2')
+            if   self.DT2=='1':row.prop(self,'VL1')
+            elif self.DT2=='2':row.prop(self,'VL2')
+            box.prop(self,'RES')
+        elif self.UST=='3':
+            row= box.row();    row.prop(self,'DT3')
+            if   self.DT3=='1':row.prop(self,'VL1')
+            elif self.DT3=='2':row.prop(self,'VL3')
+            elif self.DT3=='3':row.prop(self,'VL4')
+        elif self.UST=='4':
+            row= box.row();    row.prop(self,'DT3')
+            if   self.DT3=='1':row.prop(self,'VL1')
+            elif self.DT3=='2':row.prop(self,'VL3')
+            elif self.DT3=='3':row.prop(self,'VL4')
+        row =layout.row()
         for i in range(0,self.gen):
             row.prop(self,'gnx'+str(i))
-            row=layout.row()
         for j in range(0,self.yuk):
-            row.prop(self,'gny'+str(self.yuk-j-1),text="Height")
-            row=layout.row()
-            row.label(text="Window Sash")
             row=layout.row()
+            row.prop(self,'gny'+str(self.yuk-j-1))
             for i in range(0,self.gen):
                 row.prop(self,'k'+str(self.yuk-j-1)+str(i))
-            row=layout.row()
     def execute(self, context):
         if self.son!=self.prs:
             Prs(self)
@@ -361,16 +752,13 @@ class OBJECT_OT_add_object(bpy.types.Operator):
         add_object(self,context)
         return {'FINISHED'}
 # Registration
-def add_object_button(self, context):
-    self.layout.operator(
-        OBJECT_OT_add_object.bl_idname,
-        text="WINDOW",
-        icon="MOD_LATTICE")
+def menu_func_pencere(self, context):
+    self.layout.operator(PENCERE.bl_idname,text="Window",icon="MOD_LATTICE")
 def register():
-    bpy.utils.register_class(OBJECT_OT_add_object)
-    bpy.types.INFO_MT_mesh_add.append(add_object_button)
+    bpy.utils.register_class(PENCERE)
+    bpy.types.INFO_MT_mesh_add.append(menu_func_pencere)
 def unregister():
-    bpy.utils.unregister_class(OBJECT_OT_add_object)
-    bpy.types.INFO_MT_mesh_add.remove(add_object_button)
+    bpy.utils.unregister_class(PENCERE)
+    bpy.types.INFO_MT_mesh_add.remove(menu_func_pencere)
 if __name__ == '__main__':
     register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/add_mesh_clusters/__init__.py b/release/scripts/addons_contrib/add_mesh_clusters/__init__.py
index 5eb9275..7c4ecf2 100644
--- a/release/scripts/addons_contrib/add_mesh_clusters/__init__.py
+++ b/release/scripts/addons_contrib/add_mesh_clusters/__init__.py
@@ -21,11 +21,10 @@
 #  Authors           : Clemens Barth, Christine Mottet (Icosahedra), ...
 #
 #  Homepage(Wiki)    : http://development.root-1.de/Atomic_Blender.php
-#  Tracker           : ...
 #
 #  Start of project              : 2012-03-25 by Clemens Barth
 #  First publication in Blender  : 2012-05-27 by Clemens Barth
-#  Last modified                 : 2012-06-08
+#  Last modified                 : 2012-11-03
 #
 #
 #
@@ -263,7 +262,7 @@ class CLASS_atom_cluster_load_button(Operator):
         scn    = context.scene.atom_cluster[0]
 
         add_mesh_cluster.DEF_atom_read_atom_data()
-        add_mesh_cluster.ATOM_CLUSTER_ALL_ATOMS[:] = []
+        del add_mesh_cluster.ATOM_CLUSTER_ALL_ATOMS[:]
 
         if scn.shape in ["parabolid_ab", "parabolid_abc", "parabolid_square"]:
             parameter1 = scn.parabol_height
@@ -511,7 +510,7 @@ def DEF_atom_cluster_radius_all(scale, how):
 
 # The entry into the menu 'file -> import'
 def DEF_menu_func(self, context):
-    self.layout.operator(CLASS_ImportCluster.bl_idname, icon='MESH_CUBE')
+    self.layout.operator(CLASS_ImportCluster.bl_idname, icon='PLUGIN')
 
 def register_atom_class():
     bpy.types.Scene.atom_cluster = bpy.props.CollectionProperty(type=CLASS_atom_cluster_Properties)    
diff --git a/release/scripts/addons_contrib/add_mesh_clusters/add_mesh_cluster.py b/release/scripts/addons_contrib/add_mesh_clusters/add_mesh_cluster.py
index f38a818..9e30203 100644
--- a/release/scripts/addons_contrib/add_mesh_clusters/add_mesh_cluster.py
+++ b/release/scripts/addons_contrib/add_mesh_clusters/add_mesh_cluster.py
@@ -181,7 +181,7 @@ class CLASS_atom_cluster_atom(object):
         
 def DEF_atom_read_atom_data():
 
-    ATOM_CLUSTER_ELEMENTS[:] = []
+    del ATOM_CLUSTER_ELEMENTS[:]
 
     for item in ATOM_CLUSTER_ELEMENTS_DEFAULT:
 
@@ -1085,14 +1085,14 @@ def create_square_lattice(ctype, size, skin, lattice):
 # Note that the icosahedron needs a special treatment since it requires a
 # non-common crystal lattice. The faces are (111) facets and the geometry
 # is five-fold. So far, a max size of 8217 atoms can be chosen.
-# More details can be found in:
+# More details about icosahedron shaped clusters can be found in:
 #
 # 1. C. Mottet, G. Tréglia, B. Legrand, Surface Science 383 (1997) L719-L727
 # 2. C. R. Henry, Surface Science Reports 31 (1998) 231-325
 
-# This routine is a translation from an existing Fortran code into Python.
-# The Fortran code has been created by Christine Mottet and translated by
-# Clemens Barth. 
+# The following code is a translation from an existing Fortran code into Python.
+# The Fortran code has been created by Christine Mottet and translated by me
+# (Clemens Barth). 
 
 # Although a couple of code lines are non-typical for Python, it is best to
 # leave the code as is.
diff --git a/release/scripts/addons_contrib/add_mesh_symmetrical_empty.py b/release/scripts/addons_contrib/add_mesh_symmetrical_empty.py
new file mode 100644
index 0000000..67f4831
--- /dev/null
+++ b/release/scripts/addons_contrib/add_mesh_symmetrical_empty.py
@@ -0,0 +1,97 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+    "name": "Add Symmetrical Empty",
+    "author": "Pablo Vazquez",			
+    "version": (1,0,2),
+    "blender": (2, 6, 4),
+    "location": "View3D > Add > Mesh > Symmetrical Empty",
+    "description": "Add an empty mesh with a Mirror Modifier for quick symmetrical modeling",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts/Add_Mesh/Add_Symmetrical_Empty",
+    "tracker_url": "",
+    "category": "Add Mesh"}
+'''
+Adds an empty mesh with a mirror modifier.
+'''    
+
+import bpy
+from bpy.props import BoolProperty
+
+def Add_Symmetrical_Empty():
+
+    bpy.ops.mesh.primitive_plane_add(enter_editmode = True)
+
+    sempty = bpy.context.object
+    sempty.name = "SymmEmpty"
+
+    # check if we have a mirror modifier, otherwise add
+    if (sempty.modifiers and sempty.modifiers['Mirror']):
+        pass
+    else:
+        bpy.ops.object.modifier_add(type ='MIRROR')
+
+    # Delete all!
+    bpy.ops.mesh.select_all(action='TOGGLE')
+    bpy.ops.mesh.select_all(action='TOGGLE')
+    bpy.ops.mesh.delete(type ='VERT')
+
+
+class AddSymmetricalEmpty(bpy.types.Operator):
+    
+    bl_idname = "mesh.primitive_symmetrical_empty_add"
+    bl_label = "Add Symmetrical Empty Mesh"
+    bl_description = "Add an empty mesh with a Mirror Modifier for quick symmetrical modeling"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    def draw(self, context):
+        layout = self.layout
+        mirror = bpy.context.object.modifiers['Mirror']
+
+        layout.prop(mirror,'use_clip', text="Use Clipping")
+
+        layout.label("Mirror Axis")
+        row = layout.row(align=True)
+        row.prop(mirror, "use_x")
+        row.prop(mirror, "use_y")
+        row.prop(mirror, "use_z")
+
+    def execute(self, context):
+        Add_Symmetrical_Empty()
+        return {'FINISHED'}
+
+## menu option ##
+def menu_item(self, context):
+    # only in object mode
+    if bpy.context.mode == "OBJECT":
+        self.layout.operator("mesh.primitive_symmetrical_empty_add",
+            text="Symmetrical Empty", icon="EMPTY_DATA")
+
+## register and add it on top of the list ##
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_mesh_add.prepend(menu_item)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_mesh_add.remove(menu_item)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/add_scene_elements/__init__.py b/release/scripts/addons_contrib/add_scene_elements/__init__.py
index 321ce55..f1f9f53 100644
--- a/release/scripts/addons_contrib/add_scene_elements/__init__.py
+++ b/release/scripts/addons_contrib/add_scene_elements/__init__.py
@@ -20,8 +20,8 @@
 bl_info = {
     "name": "Scene Elements",
     "author": "Meta Androcto, ",
-    "version": (0, 1),
-    "blender": (2, 6, 3),
+    "version": (0, 2),
+    "blender": (2, 6, 4),
     "location": "View3D > Add > Scene Elements",
     "description": "Add Scenes & Lights, Objects.",
     "warning": "",
@@ -57,8 +57,6 @@ class INFO_MT_mesh_objects_add(bpy.types.Menu):
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.menu("INFO_MT_lighting.add",
-            text="Scene_Lighting")
         layout.operator("camera.add_scene",
             text="Scene_Camera")
         layout.operator("materials.add_scene",
@@ -68,11 +66,28 @@ class INFO_MT_mesh_objects_add(bpy.types.Menu):
         layout.operator("objects_cycles.add_scene",
             text="Scene_Objects_Cycles")
 
+class INFO_MT_mesh_lamps_add(bpy.types.Menu):
+    # Define the "mesh objects" menu
+    bl_idname = "INFO_MT_scene_lamps"
+    bl_label = "Lighting Elements"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("object.add_single_spot",
+            text="Add Single Spot")
+        layout.operator("object.add_basic_3point",
+            text="Add 3 Point Spot Setup")
+        layout.operator("object.add_basic_2point",
+            text="Add 2 Point Setup")
+        layout.operator("object.add_area_3point",
+            text="Add 3 Point Setup")
+
 # Register all operators and panels
 # Define "Extras" menu
 def menu_func(self, context):
     self.layout.menu("INFO_MT_scene_elements", icon="PLUGIN")
-
+    self.layout.menu("INFO_MT_scene_lamps", icon="PLUGIN")
 def register():
     bpy.utils.register_module(__name__)
     # Add "Extras" menu to the "Add Mesh" menu
diff --git a/release/scripts/addons_contrib/add_scene_elements/scene_materials.py b/release/scripts/addons_contrib/add_scene_elements/scene_materials.py
index 7a95437..0383312 100644
--- a/release/scripts/addons_contrib/add_scene_elements/scene_materials.py
+++ b/release/scripts/addons_contrib/add_scene_elements/scene_materials.py
@@ -166,8 +166,8 @@ class add_scene(bpy.types.Operator):
         mtex.color = (1.000, 0.207, 0.000)
 #add monkey #
         bpy.ops.mesh.primitive_monkey_add(location = (-0.32639,0.08901,1.49976))
-        bpy.ops.transform.rotate(value=(1.15019,), axis=(0, 0, 1))
-        bpy.ops.transform.rotate(value=(-0.683882,), axis=(0, 1, 0))
+        bpy.ops.transform.rotate(value=(1.15019), axis=(0, 0, 1))
+        bpy.ops.transform.rotate(value=(-0.683882), axis=(0, 1, 0))
         bpy.ops.object.modifier_add(type='SUBSURF')
         bpy.ops.object.shade_smooth()
         monkey = bpy.context.active_object
@@ -196,7 +196,7 @@ class add_scene(bpy.types.Operator):
 # add plane
 
         bpy.ops.mesh.primitive_plane_add(location = (0.0,0.0,-1.0))
-        bpy.ops.transform.rotate(value=(-0.820305,), axis=(0, 0, 1))
+        bpy.ops.transform.rotate(value=(-0.820305), axis=(0, 0, 1))
         bpy.ops.transform.resize(value=(22.0, 22.0, 0.0))
         bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
 
diff --git a/release/scripts/addons_contrib/add_scene_elements/scene_objects.py b/release/scripts/addons_contrib/add_scene_elements/scene_objects.py
index 4bb64df..4b20867 100644
--- a/release/scripts/addons_contrib/add_scene_elements/scene_objects.py
+++ b/release/scripts/addons_contrib/add_scene_elements/scene_objects.py
@@ -103,7 +103,7 @@ class add_scene(bpy.types.Operator):
 # add plane
 
         bpy.ops.mesh.primitive_plane_add(location = (0.0,0.0,-1.0))
-        bpy.ops.transform.rotate(value=(-0.820305,), axis=(0, 0, 1))
+        bpy.ops.transform.rotate(value=(-0.820305), axis=(0, 0, 1))
         bpy.ops.transform.resize(value=(22.0, 22.0, 0.0))
         bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
 
diff --git a/release/scripts/addons_contrib/add_scene_elements/scene_objects_cycles.py b/release/scripts/addons_contrib/add_scene_elements/scene_objects_cycles.py
index fb4cd0b..de4a883 100644
--- a/release/scripts/addons_contrib/add_scene_elements/scene_objects_cycles.py
+++ b/release/scripts/addons_contrib/add_scene_elements/scene_objects_cycles.py
@@ -171,8 +171,8 @@ class add_scene(bpy.types.Operator):
         mtex.color = (1.000, 0.207, 0.000)
 #add monkey #
         bpy.ops.mesh.primitive_monkey_add(location = (-0.32639,0.08901,1.49976))
-        bpy.ops.transform.rotate(value=(1.15019,), axis=(0, 0, 1))
-        bpy.ops.transform.rotate(value=(-0.683882,), axis=(0, 1, 0))
+        bpy.ops.transform.rotate(value=(1.15019), axis=(0, 0, 1))
+        bpy.ops.transform.rotate(value=(-0.683882), axis=(0, 1, 0))
         bpy.ops.object.modifier_add(type='SUBSURF')
         bpy.ops.object.shade_smooth()
         monkey = bpy.context.active_object
@@ -202,7 +202,7 @@ class add_scene(bpy.types.Operator):
 # add plane
 
         bpy.ops.mesh.primitive_plane_add(location = (0.0,0.0,-1.0))
-        bpy.ops.transform.rotate(value=(-0.820305,), axis=(0, 0, 1))
+        bpy.ops.transform.rotate(value=(-0.820305), axis=(0, 0, 1))
         bpy.ops.transform.resize(value=(22.0, 22.0, 0.0))
         bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
 
diff --git a/release/scripts/addons_contrib/btrace/__init__.py b/release/scripts/addons_contrib/btrace/__init__.py
index 23bdf79..6b59e3a 100644
--- a/release/scripts/addons_contrib/btrace/__init__.py
+++ b/release/scripts/addons_contrib/btrace/__init__.py
@@ -24,7 +24,7 @@ bl_info = {
     'location': "View3D > Tools",
     'description': "Tools for converting/animating objects/particles into curves",
     'warning': "Still under development, bug reports appreciated",
-    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts",
+    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Curve/Btrace",
     'tracker_url': "https://projects.blender.org/tracker/index.php?"\
         "func=detail&aid=29563",
     'category': "Add Curve"
diff --git a/release/scripts/addons_contrib/io_atomblend_utilities/__init__.py b/release/scripts/addons_contrib/io_atomblend_utilities/__init__.py
new file mode 100644
index 0000000..dbd82d0
--- /dev/null
+++ b/release/scripts/addons_contrib/io_atomblend_utilities/__init__.py
@@ -0,0 +1,267 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+#
+#
+#  Authors           : Clemens Barth (Blendphys at root-1.de), ...
+#
+#  Homepage(Wiki)    : http://development.root-1.de/Atomic_Blender.php
+#
+#  Start of project              : 2011-12-01 by Clemens Barth
+#  First publication in Blender  : 2012-11-03
+#  Last modified                 : 2012-11-09
+#
+#  Acknowledgements 
+#  ================
+#
+#  Blender: ideasman, meta_androcto, truman, kilon, CoDEmanX, dairin0d, PKHG, 
+#           Valter, ...
+#  Other: Frank Palmino
+#
+
+bl_info = {
+    "name": "Atomic Blender - Utilities",
+    "description": "Utilities for manipulating atom structures",
+    "author": "Clemens Barth",
+    "version": (0,6),
+    "blender": (2,6),
+    "location": "Panel: View 3D - Tools",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/"
+                "Py/Scripts/Import-Export/PDB",
+    "tracker_url": "http://projects.blender.org/tracker/"
+                   "index.php?func=detail&aid=33071&group_id=153&atid=467",
+    "category": "Import-Export"
+}
+
+import bpy
+from bpy.types import Operator, Panel
+from bpy.props import (StringProperty,
+                       EnumProperty,
+                       FloatProperty)
+
+from . import io_atomblend_utilities
+
+# -----------------------------------------------------------------------------
+#                                                                           GUI
+
+# This is the panel, which can be used to prepare the scene.
+# It is loaded after the file has been chosen via the menu 'File -> Import'
+class PreparePanel(Panel):
+    bl_label       = "Atomic Blender Utilities"
+    bl_space_type  = "VIEW_3D"
+    bl_region_type = "TOOL_PROPS"
+
+    def draw(self, context):
+        layout = self.layout
+        scn    = context.scene.atom_blend[0]
+
+        row = layout.row()
+        row.label(text="Custom data file")
+        box = layout.box()
+        row = box.row()
+        row.label(text="Custom data file")
+        row = box.row()
+        col = row.column()
+        col.prop(scn, "datafile")
+        col.operator("atom_blend.datafile_apply")
+        row = box.row()
+        row.operator("atom_blend.button_distance")
+        row.prop(scn, "distance")
+        row = layout.row()
+        row.label(text="Choice of atom radii")
+        box = layout.box()
+        row = box.row()
+        row.label(text="All changes concern:")
+        row = box.row()
+        row.prop(scn, "radius_how")
+        row = box.row()
+        row.label(text="1. Change type of radii")
+        row = box.row()
+        row.prop(scn, "radius_type")
+        row = box.row()
+        row.label(text="2. Change atom radii in pm")
+        row = box.row()
+        row.prop(scn, "radius_pm_name")
+        row = box.row()
+        row.prop(scn, "radius_pm")
+        row = box.row()
+        row.label(text="3. Change atom radii by scale")
+        row = box.row()
+        col = row.column()
+        col.prop(scn, "radius_all")
+        col = row.column(align=True)
+        col.operator( "atom_blend.radius_all_bigger" )
+        col.operator( "atom_blend.radius_all_smaller" )
+
+        layout.separator()
+        row = box.row()
+        row.active = (bpy.context.mode == 'EDIT_MESH')
+        row.operator( "atom_blend.separate_atom" )
+
+
+class PanelProperties(bpy.types.PropertyGroup):
+
+    def Callback_radius_type(self, context):
+        scn = bpy.context.scene.atom_blend[0]
+        io_atomblend_utilities.choose_objects("radius_type", 
+                                              scn.radius_how, 
+                                              None,
+                                              None,
+                                              scn.radius_type) 
+    def Callback_radius_pm(self, context):
+        scn = bpy.context.scene.atom_blend[0]
+        io_atomblend_utilities.choose_objects("radius_pm", 
+                                              scn.radius_how, 
+                                              None,
+                                              [scn.radius_pm_name,
+                                              scn.radius_pm],
+                                              None) 
+        
+    datafile = StringProperty(
+        name = "", description="Path to your custom data file",
+        maxlen = 256, default = "", subtype='FILE_PATH')
+    XYZ_file = StringProperty(
+        name = "Path to file", default="",
+        description = "Path of the XYZ file")
+    number_atoms = StringProperty(name="",
+        default="Number", description = "This output shows "
+        "the number of atoms which have been loaded")
+    distance = StringProperty(
+        name="", default="Distance (A)",
+        description="Distance of 2 objects in Angstrom")
+    radius_how = EnumProperty(
+        name="",
+        description="Which objects shall be modified?",
+        items=(('ALL_ACTIVE',"all active objects", "in the current layer"),
+               ('ALL_IN_LAYER',"all"," in active layer(s)")),
+               default='ALL_ACTIVE',)
+    radius_type = EnumProperty(
+        name="Type",
+        description="Which type of atom radii?",
+        items=(('0',"predefined", "Use pre-defined radii"),
+               ('1',"atomic", "Use atomic radii"),
+               ('2',"van der Waals","Use van der Waals radii")),
+               default='0',update=Callback_radius_type)
+    radius_pm_name = StringProperty(
+        name="", default="Atom name",
+        description="Put in the name of the atom (e.g. Hydrogen)")
+    radius_pm = FloatProperty(
+        name="", default=100.0, min=0.0,
+        description="Put in the radius of the atom (in pm)",
+        update=Callback_radius_pm)
+    radius_all = FloatProperty(
+        name="Scale", default = 1.05, min=1.0, max=5.0,
+        description="Put in the scale factor")
+
+
+
+# Button loading a custom data file
+class DatafileApply(Operator):
+    bl_idname = "atom_blend.datafile_apply"
+    bl_label = "Apply"
+    bl_description = "Use color and radii values stored in the custom file"
+
+    def execute(self, context):
+        scn = bpy.context.scene.atom_blend[0]
+
+        if scn.datafile == "":
+            return {'FINISHED'}
+
+        io_atomblend_utilities.custom_datafile(scn.datafile)
+        io_atomblend_utilities.custom_datafile_change_atom_props()
+
+        return {'FINISHED'}
+
+
+# Button for separating a single atom from a structure
+class SeparateAtom(Operator):
+    bl_idname = "atom_blend.separate_atom"
+    bl_label = "Separate atoms"
+    bl_description = ("Separate atoms you have selected. "
+                      "You have to be in the 'Edit Mode'")
+
+    def execute(self, context):
+        scn = bpy.context.scene.atom_blend[0]
+
+        io_atomblend_utilities.separate_atoms(scn)
+
+        return {'FINISHED'}
+
+
+# Button for measuring the distance of the active objects
+class DistanceButton(Operator):
+    bl_idname = "atom_blend.button_distance"
+    bl_label = "Measure ..."
+    bl_description = "Measure the distance between two objects"
+
+    def execute(self, context):
+        scn  = bpy.context.scene.atom_blend[0]
+        dist = io_atomblend_utilities.distance()
+
+        # Put the distance into the string of the output field.
+        scn.distance = dist
+        return {'FINISHED'}
+
+
+# Button for increasing the radii of all atoms
+class RadiusAllBiggerButton(Operator):
+    bl_idname = "atom_blend.radius_all_bigger"
+    bl_label = "Bigger ..."
+    bl_description = "Increase the radii of the atoms"
+
+    def execute(self, context):
+        scn = bpy.context.scene.atom_blend[0]     
+        io_atomblend_utilities.choose_objects("radius_all", 
+                                              scn.radius_how, 
+                                              scn.radius_all, 
+                                              None,
+                                              None)        
+        return {'FINISHED'}
+
+
+# Button for decreasing the radii of all atoms
+class RadiusAllSmallerButton(Operator):
+    bl_idname = "atom_blend.radius_all_smaller"
+    bl_label = "Smaller ..."
+    bl_description = "Decrease the radii of the atoms"
+
+    def execute(self, context):
+        scn = bpy.context.scene.atom_blend[0]
+        io_atomblend_utilities.choose_objects("radius_all", 
+                                              scn.radius_how, 
+                                              1.0/scn.radius_all, 
+                                              None,
+                                              None)                                     
+        return {'FINISHED'}
+
+
+def register():
+    io_atomblend_utilities.read_elements()  
+    bpy.utils.register_module(__name__)
+    bpy.types.Scene.atom_blend = bpy.props.CollectionProperty(type=
+                                                   PanelProperties)
+    bpy.context.scene.atom_blend.add()
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+
+if __name__ == "__main__":
+
+    register()
diff --git a/release/scripts/addons_contrib/io_atomblend_utilities/io_atomblend_utilities.py b/release/scripts/addons_contrib/io_atomblend_utilities/io_atomblend_utilities.py
new file mode 100644
index 0000000..ae8d531
--- /dev/null
+++ b/release/scripts/addons_contrib/io_atomblend_utilities/io_atomblend_utilities.py
@@ -0,0 +1,465 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import os
+import bpy
+import bmesh
+
+# This variable contains the path of the XYZ file.
+# It is used almost everywhere, which explains why it
+# should stay global. First, it is empty and gets 'filled' directly
+# after having chosen the XYZ file (see 'class LoadXYZ' further below).
+
+
+# -----------------------------------------------------------------------------
+#                                                  Atom and element data
+
+
+# This is a list that contains some data of all possible elements. The structure
+# is as follows:
+#
+# 1, "Hydrogen", "H", [0.0,0.0,1.0], 0.32, 0.32, 0.32 , -1 , 1.54   means
+#
+# No., name, short name, color, radius (used), radius (covalent), radius (atomic),
+#
+# charge state 1, radius (ionic) 1, charge state 2, radius (ionic) 2, ... all
+# charge states for any atom are listed, if existing.
+# The list is fixed and cannot be changed ... (see below)
+
+ELEMENTS_DEFAULT = (
+( 1,      "Hydrogen",        "H", (  1.0,   1.0,   1.0), 0.32, 0.32, 0.79 , -1 , 1.54 ),
+( 2,        "Helium",       "He", ( 0.85,   1.0,   1.0), 0.93, 0.93, 0.49 ),
+( 3,       "Lithium",       "Li", (  0.8,  0.50,   1.0), 1.23, 1.23, 2.05 ,  1 , 0.68 ),
+( 4,     "Beryllium",       "Be", ( 0.76,   1.0,   0.0), 0.90, 0.90, 1.40 ,  1 , 0.44 ,  2 , 0.35 ),
+( 5,         "Boron",        "B", (  1.0,  0.70,  0.70), 0.82, 0.82, 1.17 ,  1 , 0.35 ,  3 , 0.23 ),
+( 6,        "Carbon",        "C", ( 0.56,  0.56,  0.56), 0.77, 0.77, 0.91 , -4 , 2.60 ,  4 , 0.16 ),
+( 7,      "Nitrogen",        "N", ( 0.18,  0.31,  0.97), 0.75, 0.75, 0.75 , -3 , 1.71 ,  1 , 0.25 ,  3 , 0.16 ,  5 , 0.13 ),
+( 8,        "Oxygen",        "O", (  1.0,  0.05,  0.05), 0.73, 0.73, 0.65 , -2 , 1.32 , -1 , 1.76 ,  1 , 0.22 ,  6 , 0.09 ),
+( 9,      "Fluorine",        "F", ( 0.56,  0.87,  0.31), 0.72, 0.72, 0.57 , -1 , 1.33 ,  7 , 0.08 ),
+(10,          "Neon",       "Ne", ( 0.70,  0.89,  0.96), 0.71, 0.71, 0.51 ,  1 , 1.12 ),
+(11,        "Sodium",       "Na", ( 0.67,  0.36,  0.94), 1.54, 1.54, 2.23 ,  1 , 0.97 ),
+(12,     "Magnesium",       "Mg", ( 0.54,   1.0,   0.0), 1.36, 1.36, 1.72 ,  1 , 0.82 ,  2 , 0.66 ),
+(13,     "Aluminium",       "Al", ( 0.74,  0.65,  0.65), 1.18, 1.18, 1.82 ,  3 , 0.51 ),
+(14,       "Silicon",       "Si", ( 0.94,  0.78,  0.62), 1.11, 1.11, 1.46 , -4 , 2.71 , -1 , 3.84 ,  1 , 0.65 ,  4 , 0.42 ),
+(15,    "Phosphorus",        "P", (  1.0,  0.50,   0.0), 1.06, 1.06, 1.23 , -3 , 2.12 ,  3 , 0.44 ,  5 , 0.35 ),
+(16,        "Sulfur",        "S", (  1.0,   1.0,  0.18), 1.02, 1.02, 1.09 , -2 , 1.84 ,  2 , 2.19 ,  4 , 0.37 ,  6 , 0.30 ),
+(17,      "Chlorine",       "Cl", ( 0.12,  0.94,  0.12), 0.99, 0.99, 0.97 , -1 , 1.81 ,  5 , 0.34 ,  7 , 0.27 ),
+(18,         "Argon",       "Ar", ( 0.50,  0.81,  0.89), 0.98, 0.98, 0.88 ,  1 , 1.54 ),
+(19,     "Potassium",        "K", ( 0.56,  0.25,  0.83), 2.03, 2.03, 2.77 ,  1 , 0.81 ),
+(20,       "Calcium",       "Ca", ( 0.23,   1.0,   0.0), 1.74, 1.74, 2.23 ,  1 , 1.18 ,  2 , 0.99 ),
+(21,      "Scandium",       "Sc", ( 0.90,  0.90,  0.90), 1.44, 1.44, 2.09 ,  3 , 0.73 ),
+(22,      "Titanium",       "Ti", ( 0.74,  0.76,  0.78), 1.32, 1.32, 2.00 ,  1 , 0.96 ,  2 , 0.94 ,  3 , 0.76 ,  4 , 0.68 ),
+(23,      "Vanadium",        "V", ( 0.65,  0.65,  0.67), 1.22, 1.22, 1.92 ,  2 , 0.88 ,  3 , 0.74 ,  4 , 0.63 ,  5 , 0.59 ),
+(24,      "Chromium",       "Cr", ( 0.54,   0.6,  0.78), 1.18, 1.18, 1.85 ,  1 , 0.81 ,  2 , 0.89 ,  3 , 0.63 ,  6 , 0.52 ),
+(25,     "Manganese",       "Mn", ( 0.61,  0.47,  0.78), 1.17, 1.17, 1.79 ,  2 , 0.80 ,  3 , 0.66 ,  4 , 0.60 ,  7 , 0.46 ),
+(26,          "Iron",       "Fe", ( 0.87,   0.4,   0.2), 1.17, 1.17, 1.72 ,  2 , 0.74 ,  3 , 0.64 ),
+(27,        "Cobalt",       "Co", ( 0.94,  0.56,  0.62), 1.16, 1.16, 1.67 ,  2 , 0.72 ,  3 , 0.63 ),
+(28,        "Nickel",       "Ni", ( 0.31,  0.81,  0.31), 1.15, 1.15, 1.62 ,  2 , 0.69 ),
+(29,        "Copper",       "Cu", ( 0.78,  0.50,   0.2), 1.17, 1.17, 1.57 ,  1 , 0.96 ,  2 , 0.72 ),
+(30,          "Zinc",       "Zn", ( 0.49,  0.50,  0.69), 1.25, 1.25, 1.53 ,  1 , 0.88 ,  2 , 0.74 ),
+(31,       "Gallium",       "Ga", ( 0.76,  0.56,  0.56), 1.26, 1.26, 1.81 ,  1 , 0.81 ,  3 , 0.62 ),
+(32,     "Germanium",       "Ge", (  0.4,  0.56,  0.56), 1.22, 1.22, 1.52 , -4 , 2.72 ,  2 , 0.73 ,  4 , 0.53 ),
+(33,       "Arsenic",       "As", ( 0.74,  0.50,  0.89), 1.20, 1.20, 1.33 , -3 , 2.22 ,  3 , 0.58 ,  5 , 0.46 ),
+(34,      "Selenium",       "Se", (  1.0,  0.63,   0.0), 1.16, 1.16, 1.22 , -2 , 1.91 , -1 , 2.32 ,  1 , 0.66 ,  4 , 0.50 ,  6 , 0.42 ),
+(35,       "Bromine",       "Br", ( 0.65,  0.16,  0.16), 1.14, 1.14, 1.12 , -1 , 1.96 ,  5 , 0.47 ,  7 , 0.39 ),
+(36,       "Krypton",       "Kr", ( 0.36,  0.72,  0.81), 1.31, 1.31, 1.24 ),
+(37,      "Rubidium",       "Rb", ( 0.43,  0.18,  0.69), 2.16, 2.16, 2.98 ,  1 , 1.47 ),
+(38,     "Strontium",       "Sr", (  0.0,   1.0,   0.0), 1.91, 1.91, 2.45 ,  2 , 1.12 ),
+(39,       "Yttrium",        "Y", ( 0.58,   1.0,   1.0), 1.62, 1.62, 2.27 ,  3 , 0.89 ),
+(40,     "Zirconium",       "Zr", ( 0.58,  0.87,  0.87), 1.45, 1.45, 2.16 ,  1 , 1.09 ,  4 , 0.79 ),
+(41,       "Niobium",       "Nb", ( 0.45,  0.76,  0.78), 1.34, 1.34, 2.08 ,  1 , 1.00 ,  4 , 0.74 ,  5 , 0.69 ),
+(42,    "Molybdenum",       "Mo", ( 0.32,  0.70,  0.70), 1.30, 1.30, 2.01 ,  1 , 0.93 ,  4 , 0.70 ,  6 , 0.62 ),
+(43,    "Technetium",       "Tc", ( 0.23,  0.61,  0.61), 1.27, 1.27, 1.95 ,  7 , 0.97 ),
+(44,     "Ruthenium",       "Ru", ( 0.14,  0.56,  0.56), 1.25, 1.25, 1.89 ,  4 , 0.67 ),
+(45,       "Rhodium",       "Rh", ( 0.03,  0.49,  0.54), 1.25, 1.25, 1.83 ,  3 , 0.68 ),
+(46,     "Palladium",       "Pd", (  0.0,  0.41,  0.52), 1.28, 1.28, 1.79 ,  2 , 0.80 ,  4 , 0.65 ),
+(47,        "Silver",       "Ag", ( 0.75,  0.75,  0.75), 1.34, 1.34, 1.75 ,  1 , 1.26 ,  2 , 0.89 ),
+(48,       "Cadmium",       "Cd", (  1.0,  0.85,  0.56), 1.48, 1.48, 1.71 ,  1 , 1.14 ,  2 , 0.97 ),
+(49,        "Indium",       "In", ( 0.65,  0.45,  0.45), 1.44, 1.44, 2.00 ,  3 , 0.81 ),
+(50,           "Tin",       "Sn", (  0.4,  0.50,  0.50), 1.41, 1.41, 1.72 , -4 , 2.94 , -1 , 3.70 ,  2 , 0.93 ,  4 , 0.71 ),
+(51,      "Antimony",       "Sb", ( 0.61,  0.38,  0.70), 1.40, 1.40, 1.53 , -3 , 2.45 ,  3 , 0.76 ,  5 , 0.62 ),
+(52,     "Tellurium",       "Te", ( 0.83,  0.47,   0.0), 1.36, 1.36, 1.42 , -2 , 2.11 , -1 , 2.50 ,  1 , 0.82 ,  4 , 0.70 ,  6 , 0.56 ),
+(53,        "Iodine",        "I", ( 0.58,   0.0,  0.58), 1.33, 1.33, 1.32 , -1 , 2.20 ,  5 , 0.62 ,  7 , 0.50 ),
+(54,         "Xenon",       "Xe", ( 0.25,  0.61,  0.69), 1.31, 1.31, 1.24 ),
+(55,       "Caesium",       "Cs", ( 0.34,  0.09,  0.56), 2.35, 2.35, 3.35 ,  1 , 1.67 ),
+(56,        "Barium",       "Ba", (  0.0,  0.78,   0.0), 1.98, 1.98, 2.78 ,  1 , 1.53 ,  2 , 1.34 ),
+(57,     "Lanthanum",       "La", ( 0.43,  0.83,   1.0), 1.69, 1.69, 2.74 ,  1 , 1.39 ,  3 , 1.06 ),
+(58,        "Cerium",       "Ce", (  1.0,   1.0,  0.78), 1.65, 1.65, 2.70 ,  1 , 1.27 ,  3 , 1.03 ,  4 , 0.92 ),
+(59,  "Praseodymium",       "Pr", ( 0.85,   1.0,  0.78), 1.65, 1.65, 2.67 ,  3 , 1.01 ,  4 , 0.90 ),
+(60,     "Neodymium",       "Nd", ( 0.78,   1.0,  0.78), 1.64, 1.64, 2.64 ,  3 , 0.99 ),
+(61,    "Promethium",       "Pm", ( 0.63,   1.0,  0.78), 1.63, 1.63, 2.62 ,  3 , 0.97 ),
+(62,      "Samarium",       "Sm", ( 0.56,   1.0,  0.78), 1.62, 1.62, 2.59 ,  3 , 0.96 ),
+(63,      "Europium",       "Eu", ( 0.38,   1.0,  0.78), 1.85, 1.85, 2.56 ,  2 , 1.09 ,  3 , 0.95 ),
+(64,    "Gadolinium",       "Gd", ( 0.27,   1.0,  0.78), 1.61, 1.61, 2.54 ,  3 , 0.93 ),
+(65,       "Terbium",       "Tb", ( 0.18,   1.0,  0.78), 1.59, 1.59, 2.51 ,  3 , 0.92 ,  4 , 0.84 ),
+(66,    "Dysprosium",       "Dy", ( 0.12,   1.0,  0.78), 1.59, 1.59, 2.49 ,  3 , 0.90 ),
+(67,       "Holmium",       "Ho", (  0.0,   1.0,  0.61), 1.58, 1.58, 2.47 ,  3 , 0.89 ),
+(68,        "Erbium",       "Er", (  0.0,  0.90,  0.45), 1.57, 1.57, 2.45 ,  3 , 0.88 ),
+(69,       "Thulium",       "Tm", (  0.0,  0.83,  0.32), 1.56, 1.56, 2.42 ,  3 , 0.87 ),
+(70,     "Ytterbium",       "Yb", (  0.0,  0.74,  0.21), 1.74, 1.74, 2.40 ,  2 , 0.93 ,  3 , 0.85 ),
+(71,      "Lutetium",       "Lu", (  0.0,  0.67,  0.14), 1.56, 1.56, 2.25 ,  3 , 0.85 ),
+(72,       "Hafnium",       "Hf", ( 0.30,  0.76,   1.0), 1.44, 1.44, 2.16 ,  4 , 0.78 ),
+(73,      "Tantalum",       "Ta", ( 0.30,  0.65,   1.0), 1.34, 1.34, 2.09 ,  5 , 0.68 ),
+(74,      "Tungsten",        "W", ( 0.12,  0.58,  0.83), 1.30, 1.30, 2.02 ,  4 , 0.70 ,  6 , 0.62 ),
+(75,       "Rhenium",       "Re", ( 0.14,  0.49,  0.67), 1.28, 1.28, 1.97 ,  4 , 0.72 ,  7 , 0.56 ),
+(76,        "Osmium",       "Os", ( 0.14,   0.4,  0.58), 1.26, 1.26, 1.92 ,  4 , 0.88 ,  6 , 0.69 ),
+(77,       "Iridium",       "Ir", ( 0.09,  0.32,  0.52), 1.27, 1.27, 1.87 ,  4 , 0.68 ),
+(78,     "Platinium",       "Pt", ( 0.81,  0.81,  0.87), 1.30, 1.30, 1.83 ,  2 , 0.80 ,  4 , 0.65 ),
+(79,          "Gold",       "Au", (  1.0,  0.81,  0.13), 1.34, 1.34, 1.79 ,  1 , 1.37 ,  3 , 0.85 ),
+(80,       "Mercury",       "Hg", ( 0.72,  0.72,  0.81), 1.49, 1.49, 1.76 ,  1 , 1.27 ,  2 , 1.10 ),
+(81,      "Thallium",       "Tl", ( 0.65,  0.32,  0.30), 1.48, 1.48, 2.08 ,  1 , 1.47 ,  3 , 0.95 ),
+(82,          "Lead",       "Pb", ( 0.34,  0.34,  0.38), 1.47, 1.47, 1.81 ,  2 , 1.20 ,  4 , 0.84 ),
+(83,       "Bismuth",       "Bi", ( 0.61,  0.30,  0.70), 1.46, 1.46, 1.63 ,  1 , 0.98 ,  3 , 0.96 ,  5 , 0.74 ),
+(84,      "Polonium",       "Po", ( 0.67,  0.36,   0.0), 1.46, 1.46, 1.53 ,  6 , 0.67 ),
+(85,      "Astatine",       "At", ( 0.45,  0.30,  0.27), 1.45, 1.45, 1.43 , -3 , 2.22 ,  3 , 0.85 ,  5 , 0.46 ),
+(86,         "Radon",       "Rn", ( 0.25,  0.50,  0.58), 1.00, 1.00, 1.34 ),
+(87,      "Francium",       "Fr", ( 0.25,   0.0,   0.4), 1.00, 1.00, 1.00 ,  1 , 1.80 ),
+(88,        "Radium",       "Ra", (  0.0,  0.49,   0.0), 1.00, 1.00, 1.00 ,  2 , 1.43 ),
+(89,      "Actinium",       "Ac", ( 0.43,  0.67,  0.98), 1.00, 1.00, 1.00 ,  3 , 1.18 ),
+(90,       "Thorium",       "Th", (  0.0,  0.72,   1.0), 1.65, 1.65, 1.00 ,  4 , 1.02 ),
+(91,  "Protactinium",       "Pa", (  0.0,  0.63,   1.0), 1.00, 1.00, 1.00 ,  3 , 1.13 ,  4 , 0.98 ,  5 , 0.89 ),
+(92,       "Uranium",        "U", (  0.0,  0.56,   1.0), 1.42, 1.42, 1.00 ,  4 , 0.97 ,  6 , 0.80 ),
+(93,     "Neptunium",       "Np", (  0.0,  0.50,   1.0), 1.00, 1.00, 1.00 ,  3 , 1.10 ,  4 , 0.95 ,  7 , 0.71 ),
+(94,     "Plutonium",       "Pu", (  0.0,  0.41,   1.0), 1.00, 1.00, 1.00 ,  3 , 1.08 ,  4 , 0.93 ),
+(95,     "Americium",       "Am", ( 0.32,  0.36,  0.94), 1.00, 1.00, 1.00 ,  3 , 1.07 ,  4 , 0.92 ),
+(96,        "Curium",       "Cm", ( 0.47,  0.36,  0.89), 1.00, 1.00, 1.00 ),
+(97,     "Berkelium",       "Bk", ( 0.54,  0.30,  0.89), 1.00, 1.00, 1.00 ),
+(98,   "Californium",       "Cf", ( 0.63,  0.21,  0.83), 1.00, 1.00, 1.00 ),
+(99,   "Einsteinium",       "Es", ( 0.70,  0.12,  0.83), 1.00, 1.00, 1.00 ),
+(100,       "Fermium",       "Fm", ( 0.70,  0.12,  0.72), 1.00, 1.00, 1.00 ),
+(101,   "Mendelevium",       "Md", ( 0.70,  0.05,  0.65), 1.00, 1.00, 1.00 ),
+(102,      "Nobelium",       "No", ( 0.74,  0.05,  0.52), 1.00, 1.00, 1.00 ),
+(103,    "Lawrencium",       "Lr", ( 0.78,   0.0,   0.4), 1.00, 1.00, 1.00 ),
+(104,       "Vacancy",      "Vac", (  0.5,   0.5,   0.5), 1.00, 1.00, 1.00),
+(105,       "Default",  "Default", (  1.0,   1.0,   1.0), 1.00, 1.00, 1.00),
+(106,         "Stick",    "Stick", (  0.5,   0.5,   0.5), 1.00, 1.00, 1.00),
+)
+
+# This list here contains all data of the elements and will be used during
+# runtime. It is a list of classes.
+# During executing Atomic Blender, the list will be initialized with the fixed
+# data from above via the class structure below (ElementProp). We
+# have then one fixed list (above), which will never be changed, and a list of
+# classes with same data. The latter can be modified via loading a separate
+# custom data file for instance.
+ELEMENTS = []
+
+# This is the class, which stores the properties for one element.
+class ElementProp(object):
+    __slots__ = ('number', 'name', 'short_name', 'color', 'radii', 'radii_ionic')
+    def __init__(self, number, name, short_name, color, radii, radii_ionic):
+        self.number = number
+        self.name = name
+        self.short_name = short_name
+        self.color = color
+        self.radii = radii
+        self.radii_ionic = radii_ionic
+
+
+# -----------------------------------------------------------------------------
+#                                                          Some small routines
+
+# This function measures the distance between two objects (atoms),
+# which are active.
+def distance():
+
+    # In the 'Edit mode'
+    if bpy.context.mode == 'EDIT_MESH':
+
+        obj = bpy.context.edit_object
+        bm = bmesh.from_edit_mesh(obj.data)
+        locations = []
+
+        for v in bm.verts:
+            if v.select:
+                locations.append(obj.matrix_world * v.co)
+                
+        if len(locations) > 1:
+            location1 = locations[0]
+            location2 = locations[1]        
+        else:
+            return "N.A"
+    # In the object mode
+    else:
+
+        if len(bpy.context.selected_bases) > 1:
+            location1 = bpy.context.selected_objects[0].location
+            location2 = bpy.context.selected_objects[1].location
+        else:
+            return "N.A."
+
+    dv = location2 - location1
+    dist = str(dv.length)
+    pos = str.find(dist, ".")
+    dist = dist[:pos+4]
+    dist = dist + " A"
+  
+    return dist
+
+
+def choose_objects(how, who, radius_all, radius_pm, radius_type):
+
+    if who == "ALL_IN_LAYER":
+
+        # Determine all selected layers.
+        layers = []
+        for i, layer in enumerate(bpy.context.scene.layers):
+            if layer == True:
+                layers.append(i)
+                
+        # Put all objects, which are in the layers, into a list.
+        change_objects = []
+        for obj in bpy.context.scene.objects:
+            for layer in layers:
+                if obj.layers[layer] == True:
+                    change_objects.append(obj)
+                    
+        # Consider all objects, which are in the list 'change_objects'.
+        for obj in change_objects:
+            if len(obj.children) != 0:
+                if obj.children[0].type in {'SURFACE', 'MESH', 'META'}:
+                    modify_objects(how, 
+                                   obj.children[0],
+                                   radius_all, 
+                                   radius_pm, 
+                                   radius_type)
+            else:
+                if obj.type in {'SURFACE', 'MESH', 'META'}:
+                    modify_objects(how, 
+                                   obj,  
+                                   radius_all, 
+                                   radius_pm, 
+                                   radius_type)
+    if who == "ALL_ACTIVE":
+        for obj in bpy.context.selected_objects:
+            if len(obj.children) != 0:
+                if obj.children[0].type in {'SURFACE', 'MESH', 'META'}:
+                    modify_objects(how, 
+                                   obj.children[0],
+                                   radius_all, 
+                                   radius_pm, 
+                                   radius_type)
+            else:
+                if obj.type in {'SURFACE', 'MESH', 'META'}:
+                    modify_objects(how, 
+                                   obj,
+                                   radius_all, 
+                                   radius_pm, 
+                                   radius_type)
+
+
+
+# Routine to modify the radii in picometer of a specific type of atom
+def modify_objects(how, obj, radius_all, radius_pm, radius_type):
+
+    # Radius pm 
+    if how == "radius_pm":
+        if radius_pm[0] in obj.name:
+            obj.scale = (radius_pm[1]/100,) * 3
+            
+    # Radius all 
+    if how == "radius_all":
+        obj.scale *= radius_all      
+              
+    # Radius type 
+    if how == "radius_type":
+        for element in ELEMENTS:
+            if element.name in obj.name:
+                obj.scale = (element.radii[int(radius_type)],) * 3
+
+
+# Read the default element list.
+def read_elements():
+
+    del ELEMENTS[:]
+
+    for item in ELEMENTS_DEFAULT:
+
+        # All three radii into a list
+        radii = [item[4],item[5],item[6]]
+        # The handling of the ionic radii will be done later. So far, it is an
+        # empty list.
+        radii_ionic = []
+
+        li = ElementProp(item[0],item[1],item[2],item[3],
+                                     radii,radii_ionic)
+        ELEMENTS.append(li)
+
+
+# Change color and radii by uisnf the list of elements.
+def custom_datafile_change_atom_props():
+
+    for obj in bpy.context.selected_objects:
+        if len(obj.children) != 0:
+            child = obj.children[0]
+            if child.type in {'SURFACE', 'MESH', 'META'}:
+                for element in ELEMENTS:
+                    if element.name in obj.name:
+                        child.scale = (element.radii[0],) * 3
+                        child.active_material.diffuse_color = element.color
+        else:
+            if obj.type in {'SURFACE', 'MESH', 'META'}:
+                for element in ELEMENTS:
+                    if element.name in obj.name:
+                        obj.scale = (element.radii[0],) * 3
+                        obj.active_material.diffuse_color = element.color
+
+
+# This reads a custom data file.
+def custom_datafile(path_datafile):
+
+    if path_datafile == "":
+        return False
+
+    path_datafile = bpy.path.abspath(path_datafile)
+
+    if os.path.isfile(path_datafile) == False:
+        return False
+
+    # The whole list gets deleted! We build it new.
+    del ELEMENTS[:]
+
+    # Read the data file, which contains all data
+    # (atom name, radii, colors, etc.)
+    data_file_p = open(path_datafile, "r")
+
+    for line in data_file_p:
+
+        if "Atom" in line:
+
+            line = data_file_p.readline()
+            # Number
+            line = data_file_p.readline()
+            number = line[19:-1]
+            # Name
+            line = data_file_p.readline()
+            name = line[19:-1]
+            # Short name
+            line = data_file_p.readline()
+            short_name = line[19:-1]
+            # Color
+            line = data_file_p.readline()
+            color_value = line[19:-1].split(',')
+            color = [float(color_value[0]),
+                     float(color_value[1]),
+                     float(color_value[2])]
+            # Used radius
+            line = data_file_p.readline()
+            radius_used = float(line[19:-1])
+            # Atomic radius
+            line = data_file_p.readline()
+            radius_atomic = float(line[19:-1])
+            # Van der Waals radius
+            line = data_file_p.readline()
+            radius_vdW = float(line[19:-1])
+            radii = [radius_used,radius_atomic,radius_vdW]
+            radii_ionic = []
+
+            element = ElementProp(number,name,short_name,color,
+                                              radii, radii_ionic)
+
+            ELEMENTS.append(element)
+
+    data_file_p.close()
+
+    return True
+
+
+# Routine for separating atoms from a dupliverts strucutre.
+def separate_atoms(scn):
+
+    # Get first all important properties from the atoms, which the user
+    # has chosen: location, color, scale
+    obj = bpy.context.edit_object
+        
+    # Do nothing if it is not a dupliverts structure.
+    if not obj.dupli_type == "VERTS":
+       return {'FINISHED'}
+        
+    bm = bmesh.from_edit_mesh(obj.data)
+
+    locations = []
+
+    for v in bm.verts:
+        if v.select:
+            locations.append(obj.matrix_world * v.co)
+
+    bm.free()
+    del(bm)
+
+    name  = obj.name
+    scale = obj.children[0].scale
+    material = obj.children[0].active_material
+
+    # Separate the vertex from the main mesh and create a new mesh.
+    bpy.ops.mesh.separate()
+    new_object = bpy.context.scene.objects[0]
+    # And now, switch to the OBJECT mode such that we can ...
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+    # ... delete the new mesh including the separated vertex
+    bpy.ops.object.select_all(action='DESELECT')
+    new_object.select = True
+    bpy.ops.object.delete()  
+
+    # Create new atoms/vacancies at the position of the old atoms
+    current_layers=bpy.context.scene.layers
+
+    # For all selected positions do:
+    for location in locations:
+        # For any ball do ...
+        if "Vacancy" not in name:
+            # NURBS ball
+            if obj.children[0].type == "SURFACE":
+                bpy.ops.surface.primitive_nurbs_surface_sphere_add(
+                                    view_align=False, enter_editmode=False,
+                                    location=location,
+                                    rotation=(0.0, 0.0, 0.0),
+                                    layers=current_layers)
+                # Mesh ball                    
+            elif obj.children[0].type == "MESH":
+                bpy.ops.mesh.primitive_uv_sphere_add(
+                                segments=32,
+                                ring_count=32,                    
+                                #segments=scn.mesh_azimuth,
+                                #ring_count=scn.mesh_zenith,
+                                size=1, view_align=False, enter_editmode=False,
+                                location=location,
+                                rotation=(0, 0, 0),
+                                layers=current_layers)
+                # Metaball
+            elif obj.children[0].type == "META":
+                bpy.ops.object.metaball_add(type='BALL', view_align=False, 
+                            enter_editmode=False, location=location, 
+                            rotation=(0, 0, 0), layers=current_layers)
+        # If it is a vacancy create a cube ...                    
+        else:
+            bpy.ops.mesh.primitive_cube_add(
+                           view_align=False, enter_editmode=False,
+                           location=location,
+                           rotation=(0.0, 0.0, 0.0),
+                           layers=current_layers)
+                               
+        new_atom = bpy.context.scene.objects.active
+        # Scale, material and name it.
+        new_atom.scale = scale
+        new_atom.active_material = material
+        new_atom.name = name + "_sep"
+        new_atom.select = True
+
+    bpy.context.scene.objects.active = obj
+    #bpy.ops.object.select_all(action='DESELECT')
diff --git a/release/scripts/addons_contrib/io_import_sound_to_anim.py b/release/scripts/addons_contrib/io_import_sound_to_anim.py
new file mode 100644
index 0000000..abfc4d0
--- /dev/null
+++ b/release/scripts/addons_contrib/io_import_sound_to_anim.py
@@ -0,0 +1,1930 @@
+#!/usr/bin/python3
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+#  ***** GPL LICENSE BLOCK *****
+#
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#  All rights reserved.
+#  ***** GPL LICENSE BLOCK *****
+
+bl_info = {
+    "name": "Import: Sound to Animation",
+    "author": "Vlassius",
+    "version": (0, 70),
+    "blender": (2, 64, 9),
+    "api": 52100,
+    "location": "Select a object -> go to the Object tab ->  Import Movement From Wav File",
+    "description": "Extract movement from sound file. See the Object Panel at the end.",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/Import_Movement_From_Audio_File",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=23565&group_id=153&atid=467",
+    "category": "Import-Export"}
+
+"""
+-- Extract movement from sound file, to help in animation - import script --<br>
+
+- NOTES:
+- This script takes a wav file and get sound "movement" to help you in sync the movement to words in the wave file. <br>
+- Supported Audio: .wav (wave) 8 bits and 16 bits - mono and multichanel file<br>
+- At least Blender 2.64.9 is necessary to run this program.
+- Curitiba - Brasil
+
+
+-v 0.70Beta-
+    Included: SmartRender - Render just the frames that has changes
+    Included: Options to check SmartRender for Blender Internal Render Engine:LocRotScale, Material, Transp, Mirror
+    Included: User can Cancel all functions with CANCEL button- Extensive Code and flux change (bugs expected)
+    Included: User can Cancel all functions with ESC
+    Inclused: User friendly messages into UI while running (its no more necessary to look at terminal window to most users)
+    Cleanup:  Non Stardard Chars in coments
+    To Do:    Decrease overhead of timer loops
+    To Do:    Try to implement Smart Render for Cycles
+
+-v 0.60Beta-
+    Included: Option to use just the beat from the audio sound
+    Included: Option to exclude the beat from the audio sound
+    Included: More or less sensibility options when using the beat
+    Included: Audio Channel Select option
+
+-v 0.50Beta-
+    Included: Auto Adjust Audio Sensity option
+    Included: 8 bits .wav file support
+    Recalibrated: Manual audio sense 1
+    Cosmetic: Many changes in panel and terminal window info
+    Corrected: Tracker_url
+    Corrected: a few bytes in Memory Leaks
+    work around: memory leak in function: bpy.ops.transform.rotate
+    work around: memory leak in function: bpy.ops.anim.keyframe_insert
+
+-v 0.22Beta-
+    Included:
+    Camera Rotation
+    Empty Location-Rotation-Scale
+
+-v 0.21Beta-
+    Changed just the meta informations like version and wiki page.
+
+-v 0.20 Beta-
+    New Panel
+
+-v 0.1.5 Beta-
+    Change in API-> Properties
+    Included the button "Get FPS from Scene" due to a problem to get it in the start
+    Return to Frame 1 after import
+    Filter .wav type file (by batFINGER)
+
+-v 0.1.4 Beta-
+    If choose negative in rotation, auto check the rotation negative to Bones
+    change in register()  unregister():
+
+-v 0.1.3 Beta-
+    File Cleanup
+    Change to bl_info.
+    Cosmetic Changes.
+    Minor change in API in how to define buttons.
+    Adjust in otimization.
+
+-v 0.1.2 Beta
+change in API- Update function bpy.ops.anim.keyframe_insert_menu
+
+-v 0.1.1 Beta
+change in API- Update property of  window_manager.fileselect_add
+
+-v 0.1.0 Beta
+new - Added support to LAMP object
+new - improved flow to import
+new - check the type of object before show options
+bug - option max. and min. values
+change- Updated scene properties for changes in property API.
+        See http://lists.blender.org/pipermail/bf-committers/2010-September/028654.html
+new flow: 1) Process the sound file    2) Show Button to import key frames
+
+- v0.0.4 ALPHA
+new - Added destructive optimizer option - LostLestSignificativeDigit lost/total -> 10/255 default
+new - Visual Graph to samples
+new - Option to just process audio file and do not import - this is to help adjust the audio values
+new - Get and show automatically the FPS (in proper field) information taking the information from scene
+bug- Display sensitivity +1
+bug - Corrected location of the script in description
+
+- v0.0.3
+Main change: Corrected to work INSIDE dir /install/linux2/2.53/scripts/addons
+Corrected position of label "Rotation Negative"
+Added correct way to deal with paths in Python os.path.join - os.path.normpath
+
+- v0.0.2
+Corrected initial error (Register() function)
+Corrected some labels R. S. L.
+Turned off "object field" for now
+Changed target default to Z location
+
+- v0.0.1
+Initial version
+
+Credit to:
+Vlassius
+
+- http://vlassius.com.br
+- vlassius at vlassius.com.br
+- Curitiba - Brasil
+
+"""
+
+import bpy
+from bpy.props import *
+#from io_utils import ImportHelper
+import wave
+
+#para deixar global
+def _Interna_Globals(BytesDadosTotProcess, context):
+    global array
+    global arrayAutoSense
+
+    array= bytearray(BytesDadosTotProcess)  # cria array
+    arrayAutoSense= bytearray((BytesDadosTotProcess)*2)  # cria array para AutoAudioSense
+    context.scene.imp_sound_to_anim.bArrayCriado=True
+
+#
+#==================================================================================================
+# BLENDER UI Panel
+#==================================================================================================
+#
+class VIEW3D_PT_CustomMenuPanel(bpy.types.Panel):
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "object"
+    bl_label = "Import Movement From Wav File"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        b=bpy.context.active_object.type=='EMPTY' or bpy.context.active_object.type=='ARMATURE' or \
+                                                            bpy.context.active_object.type=='MESH' or \
+                                                            bpy.context.active_object.type=='CAMERA' or \
+                                                            bpy.context.active_object.type=='LAMP'
+        if not b:
+            row=layout.row()
+            row.label(text="The Selected Object is: type \"" + bpy.context.active_object.type + \
+                                                                    "\", and it is not supported.")
+            row=layout.row()
+            row.label(text="Supported Object are Type: Armature, Mesh, Camera and Lamp")
+            row=layout.row()
+        else:
+            #print(context.scene.imp_sound_to_anim.bTypeImport)
+            if context.scene.imp_sound_to_anim.bTypeImport == 0:
+                #mount panel to Direct animation
+                row=layout.row()
+                layout.operator("import.sound_animation_botao_udirect")
+
+            # monta as telas quando está rodando
+            elif context.scene.imp_sound_to_anim.Working!="":   #its running
+                row=layout.row()
+                row=layout.row()
+
+                if context.scene.imp_sound_to_anim.Working== "CheckSmartRender":
+                    #context.scene.imp_sound_to_anim.Info_check_smartrender=
+                    row=layout.row()
+                    row.label(text="Checking for Smart Render...")
+                    row=layout.row()
+                    row.label(text=context.scene.imp_sound_to_anim.Info_check_smartrender)
+                    row=layout.row()
+
+                elif context.scene.imp_sound_to_anim.Working== "SmartRender":
+                    #context.scene.imp_sound_to_anim.Info_check_smartrender=
+                    row=layout.row()
+                    row.label(text="Processing Smart Render...")
+                    row=layout.row()
+                    row.label(text=context.scene.imp_sound_to_anim.Info_check_smartrender)
+                    row=layout.row()
+
+                elif context.scene.imp_sound_to_anim.Working== "ProcessaSom":
+                    #context.scene.imp_sound_to_anim.Info_Import=
+                    row=layout.row()
+                    row.label(text="Processing Sound File...")
+                    row=layout.row()
+                    row.label(text=context.scene.imp_sound_to_anim.Info_Import)
+
+                elif context.scene.imp_sound_to_anim.Working== "wavimport":
+                    #context.scene.imp_sound_to_anim.Info_Import=
+                    row=layout.row()
+                    row.label(text="Importing Keys...")
+                    row=layout.row()
+                    row.label(text=context.scene.imp_sound_to_anim.Info_Import)
+                    row=layout.row()
+
+                # botao cancel
+                layout.operator(OBJECT_OT_Botao_Cancel.bl_idname)
+                row=layout.row()
+
+            elif context.scene.imp_sound_to_anim.bTypeImport == 1:
+                row=layout.row()
+                row.label(text="1)Click button \"Process Wav\",")
+                row=layout.row()
+                row.label(text="2)Click Button \"Import Key Frames\",")
+                row=layout.row()
+                row.label(text="Run the animation (alt A) and Enjoy!")
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_auto_audio_sense")
+                row=layout.row()
+                if context.scene.imp_sound_to_anim.action_auto_audio_sense == 0:   # se auto audio sense desligado
+                    row.prop(context.scene.imp_sound_to_anim,"audio_sense")
+                    row=layout.row()
+
+                else: #somente se autosense ligado
+                    if context.scene.imp_sound_to_anim.remove_beat == 0 :
+                        row.prop(context.scene.imp_sound_to_anim,"use_just_beat")
+
+                    if context.scene.imp_sound_to_anim.use_just_beat == 0:
+                        row.prop(context.scene.imp_sound_to_anim,"remove_beat")
+
+                    if context.scene.imp_sound_to_anim.use_just_beat or context.scene.imp_sound_to_anim.remove_beat:
+                        if not context.scene.imp_sound_to_anim.beat_less_sensible and not context.scene.imp_sound_to_anim.beat_more_sensible:
+                            row=layout.row()
+                        if context.scene.imp_sound_to_anim.beat_less_sensible ==0:
+                            row.prop(context.scene.imp_sound_to_anim,"beat_more_sensible")
+
+                        if context.scene.imp_sound_to_anim.beat_more_sensible ==0:
+                            row.prop(context.scene.imp_sound_to_anim,"beat_less_sensible")
+
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_per_second")
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_escale")
+
+                #row=layout.row()
+                row.label(text="Result from 0 to " + str(round(255/context.scene.imp_sound_to_anim.action_escale,4)) + "")
+
+                row=layout.row()
+                row.label(text="Property to Change:")
+                row.prop(context.scene.imp_sound_to_anim,"import_type")
+
+                #coluna
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"import_where1")
+                row.prop(context.scene.imp_sound_to_anim,"import_where2")
+                row.prop(context.scene.imp_sound_to_anim,"import_where3")
+
+                row=layout.row()
+                row.label(text='Optional Configurations:')
+                row=layout.row()
+
+                row.prop(context.scene.imp_sound_to_anim,"frames_per_second")
+                row=layout.row()
+                #coluna
+                column= layout.column()
+                split=column.split(percentage=0.5)
+                col=split.column()
+
+                row=col.row()
+                row.prop(context.scene.imp_sound_to_anim,"frames_initial")
+
+                row=col.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_min_value")
+
+                col=split.column()
+
+                row=col.row()
+                row.prop(context.scene.imp_sound_to_anim,"optimization_destructive")
+
+                row=col.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_max_value")
+
+                row=layout.row()
+
+                row.prop(context.scene.imp_sound_to_anim,"action_offset_x")
+                row.prop(context.scene.imp_sound_to_anim,"action_offset_y")
+                row.prop(context.scene.imp_sound_to_anim,"action_offset_z")
+
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"audio_channel_select")
+                row.prop(context.scene.imp_sound_to_anim,"action_valor_igual")
+
+                #operator button
+                #OBJECT_OT_Botao_Go => Botao_GO
+                row=layout.row()
+                layout.operator(OBJECT_OT_Botao_Go.bl_idname)
+
+                row=layout.row()
+                row.label(text=context.scene.imp_sound_to_anim.Info_Import)
+
+                # preciso garantir a existencia do array porque o Blender salva no arquivo como existente sem o array existir
+                try:
+                    array
+                except NameError:
+                    nada=0 #dummy
+                else:
+                    if context.scene.imp_sound_to_anim.bArrayCriado:
+                        layout.operator(OBJECT_OT_Botao_Import.bl_idname)
+                        row=layout.row()
+
+                #Layout SmartRender, somente para Blender_render
+                if bpy.context.scene.render.engine == "BLENDER_RENDER":
+                    row=layout.row()
+                    row.label(text="----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")
+                    row=layout.row()
+                    if context.scene.imp_sound_to_anim.Info_check_smartrender!= "":
+                        row=layout.row()
+                        row.label(text=context.scene.imp_sound_to_anim.Info_check_smartrender)
+
+                    row=layout.row()
+                    row.operator(OBJECT_OT_Botao_Check_SmartRender.bl_idname)
+                    if context.scene.imp_sound_to_anim.Info_check_smartrender!= "":
+                        row.operator(OBJECT_OT_Botao_SmartRender.bl_idname)
+
+                    row=layout.row()
+                    row.prop(context.scene.imp_sound_to_anim,"check_smartrender_loc_rot_sc")
+                    row.prop(context.scene.imp_sound_to_anim,"check_smartrender_material_basic")
+                    row=layout.row()
+                    row.prop(context.scene.imp_sound_to_anim,"check_smartrender_material_transparence")
+                    row.prop(context.scene.imp_sound_to_anim,"check_smartrender_material_mirror")
+
+            #-----------------------------
+            #Use Driver
+            #-----------------------------
+            if context.scene.imp_sound_to_anim.bTypeImport == 2:
+
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"audio_sense")
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"frames_per_second")
+                row=layout.row()
+                row.prop(context.scene.imp_sound_to_anim,"action_per_second")
+                row=layout.row()
+                layout.operator(ImportWavFile.bl_idname)
+
+
+#
+#==================================================================================================
+# BLENDER UI PropertyGroup
+#==================================================================================================
+#
+class ImpSoundtoAnim(bpy.types.PropertyGroup):
+
+        #Array created
+        bArrayCriado = IntProperty(name="",
+            description="Avisa que rodou process de som",
+            default=0)
+
+        #Script Running
+        Working = StringProperty(name="",
+            description="Script esta trabalhando",
+            maxlen= 1024,
+            default="")
+
+        #Nome do objeto
+        Info_Import = StringProperty(name="",
+            description="Info about Import",
+            maxlen= 1024,
+            default= "")#this set the initial text
+
+        #Mensagem Smart Render
+        Info_check_smartrender = StringProperty(name="",
+            description="Smart Render Message",
+            maxlen= 1024,
+            default= "")#this set the initial text
+
+        #iAudioSensib=0    #sensibilidade volume do audio 0 a 5. Quanto maior, mais sensibilidade
+        audio_sense = IntProperty(name="Audio Sens",
+            description="Audio Sensibility.",
+            min=1,
+            max=6,
+            step=1,
+            default= 1)
+
+        #iFramesPorSeg=15  #Frames por segundo para key frame
+        #fps= (bpy.types.Scene) bpy.context.scene.render.fps
+        frames_per_second = IntProperty(name="#Frames/s",
+            description="Frames you want per second. Better match your set up in Blender scene.",
+            min=1,
+            max=120,
+            step=1)
+
+        #iMovPorSeg=1      #Sensibilidade de movimento. 3= 3 movimentos por segundo
+        action_per_second = IntProperty(name="Act/s",
+            description="Actions per second. From 1 to #Frames/s",
+            min=1,
+            max=120,
+            step=1,
+            default= 4)#this set the initial text
+
+        #iDivScala=200
+        #scala do valor do movimento. [se =1 - 0 a 255 ] [se=255 - 0,00000 a 1,00000] [se=1000 - 0 a 0.255]
+        action_escale = IntProperty(name="Scale",
+            description="Scale the result values. See the text at right side of the field",
+            min=1,
+            max=99999,
+            step=100,
+            default= 100)#this set the initial text
+
+        #iMaxValue=255
+        action_max_value = IntProperty(name="Clip Max",
+            description="Set the max value (clip higher values).",
+            min=1,
+            max=255,
+            step=1,
+            default= 255)#this set the initial text
+
+        #iMinValue=0
+        action_min_value = IntProperty(name="Clip Min",
+            description="Set the min value. (clip lower values)",
+            min=0,
+            max=255,
+            step=1,
+            default= 0)#this set the initial text
+
+        #iStartFrame=0#
+        frames_initial = IntProperty(name="Frame Ini",
+            description="Where to start to put the computed values.",
+            min=0,
+            max=999999999,
+            step=1,
+            default= 0)
+
+        audio_channel_select = IntProperty(name="Audio Channel",
+            description="Choose the audio channel to use",
+            min=1,
+            max=10,
+            step=1,
+            default= 1)
+
+        action_offset_x = FloatProperty(name="XOffset",
+            description="Offset X Values",
+            min=-999999,
+            max=999999,
+            step=1,
+            default= 0)
+
+        action_offset_y = FloatProperty(name="YOffset",
+            description="Offset Y Values",
+            min=-999999,
+            max=999999,
+            step=1,
+            default= 0)
+
+        action_offset_z = FloatProperty(name="ZOffset",
+            description="Offset Z Values",
+            min=-999999,
+            max=999999,
+            step=1,
+            default= 0)
+
+        import_type= EnumProperty(items=(('imp_t_Scale', "Scale", "Apply to Scale"),
+                                         ('imp_t_Rotation', "Rotation", "Apply to Rotation"),
+                                         ('imp_t_Location', "Location", "Apply to Location")
+                                        ),
+                                 name="",
+                                 description= "Property to Import Values",
+                                 default='imp_t_Location')
+
+        import_where1= EnumProperty(items=(('imp_w_-z', "-z", "Apply to -z"),
+                                          ('imp_w_-y', "-y", "Apply to -y"),
+                                          ('imp_w_-x', "-x", "Apply to -x"),
+                                          ('imp_w_z', "z", "Apply to z"),
+                                          ('imp_w_y', "y", "Apply to y"),
+                                          ('imp_w_x', "x", "Apply to x")
+                                        ),
+                                 name="",
+                                 description= "Where to Import",
+                                 default='imp_w_z')
+
+        import_where2= EnumProperty(items=(('imp_w_none', "None", ""),
+                                          ('imp_w_-z', "-z", "Apply to -z"),
+                                          ('imp_w_-y', "-y", "Apply to -y"),
+                                          ('imp_w_-x', "-x", "Apply to -x"),
+                                          ('imp_w_z', "z", "Apply to z"),
+                                          ('imp_w_y', "y", "Apply to y"),
+                                          ('imp_w_x', "x", "Apply to x")
+                                        ),
+                                 name="",
+                                 description= "Where to Import",
+                                 default='imp_w_none')
+
+        import_where3= EnumProperty(items=(('imp_w_none', "None", ""),
+                                          ('imp_w_-z', "-z", "Apply to -z"),
+                                          ('imp_w_-y', "-y", "Apply to -y"),
+                                          ('imp_w_-x', "-x", "Apply to -x"),
+                                          ('imp_w_z', "z", "Apply to z"),
+                                          ('imp_w_y', "y", "Apply to y"),
+                                          ('imp_w_x', "x", "Apply to x")
+                                        ),
+                                 name="",
+                                 description= "Where to Import",
+                                 default='imp_w_none')
+
+
+        #========== Propriedades boolean  =============#
+
+        #  INVERTIDO!!!  bNaoValorIgual=True    # nao deixa repetir valores     INVERTIDO!!!
+        action_valor_igual = BoolProperty(name="Hard Transition",
+            description="Use to movements like a mouth, to a arm movement, maybe you will not use this.",
+            default=1)
+
+        action_auto_audio_sense = BoolProperty(name="Auto Audio Sensitivity",
+            description="Try to discover best audio scale. ",
+            default=1)
+
+        use_just_beat=BoolProperty(name="Just Use The Beat",
+            description="Try to use just the beat to extract movement.",
+            default=0)
+
+        remove_beat=BoolProperty(name="Remove The Beat",
+            description="Try to remove the beat to extract movement.",
+            default=0)
+
+        beat_more_sensible=BoolProperty(name="More Sensible",
+            description="Try To be more sensible about the beat.",
+            default=0)
+
+        beat_less_sensible=BoolProperty(name="Less Sensible",
+            description="Try to be less sensible about the beat.",
+            default=0)
+
+        check_smartrender_loc_rot_sc=BoolProperty(name="Loc Rot Scale",
+            description="Find changes in Location, Rotation and Scale Frame by Frame.",
+            default=1)
+
+        check_smartrender_material_basic=BoolProperty(name="Basic Material",
+            description="Find changes in basic material settings Frame by Frame.",
+            default=1)
+
+        check_smartrender_material_transparence=BoolProperty(name="Material Transparence",
+            description="Find changes in material transparence settings Frame by Frame.",
+            default=0)
+
+        check_smartrender_material_mirror=BoolProperty(name="Material Mirror",
+            description="Find changes in material mirror settings Frame by Frame.",
+            default=0)
+
+        timer_reset_func=BoolProperty(name="Reset Counters",
+            description="Reset Counters after stop",
+            default=0)
+
+        cancel_button_hit=BoolProperty(name="Cancel Hit",
+            description="Cancel Hit",
+            default=0)
+
+        #  Optimization
+        optimization_destructive = IntProperty(name="Optimization",
+            description="Hi value = Hi optimization -> Hi loss of information.",
+            min=0,
+            max=254,
+            step=10,
+            default= 10)
+
+        # import as driver or direct   NOT IN USE!!
+        # not defined
+        # Direct=1
+        # Driver=2
+        bTypeImport = IntProperty(name="",
+            description="Import Direct or Driver",
+            default=0)
+
+        # globais do dialog open wave
+        filter_glob = StringProperty(default="*.wav", options={'HIDDEN'})
+        path =        StringProperty(name="File Path", description="Filepath used for importing the WAV file", \
+                                                                                        maxlen= 1024, default= "")
+        filename =    StringProperty(name="File Name", description="Name of the file")
+        directory =   StringProperty(name="Directory", description="Directory of the file")
+
+from bpy.props import *
+
+def WavFileImport(self, context):
+    self.layout.operator(ImportWavFile.bl_idname, text="Import a wav file", icon='PLUGIN')
+
+
+#
+#==================================================================================================
+# Use Direct
+#==================================================================================================
+#
+class OBJECT_OT_Botao_uDirect(bpy.types.Operator):
+    '''Import as Direct Animation'''
+    bl_idname = "import.sound_animation_botao_udirect"
+    bl_label = "Direct to a Property"
+
+    def execute(self, context):
+        context.scene.imp_sound_to_anim.bTypeImport= 1
+        if context.scene.imp_sound_to_anim.frames_per_second == 0:
+             context.scene.imp_sound_to_anim.frames_per_second= bpy.context.scene.render.fps
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        self.execute(context)
+        return {'FINISHED'}
+
+#
+#==================================================================================================
+# Button - Import
+#==================================================================================================
+#
+class OBJECT_OT_Botao_Import(bpy.types.Operator):
+    '''Import Key Frames to Blender'''
+    bl_idname = "import.sound_animation_botao_import"
+    bl_label = "Import Key Frames"
+
+    RunFrom=0
+    iSumImportFrames=0
+    iSumOptimizerP1=0
+    iSumOptimizerP2=0
+    iSumOptimizerP3=0
+
+    def wavimport(context, loop):
+        obi=OBJECT_OT_Botao_Import
+
+        # para de entrar no timer
+        context.scene.imp_sound_to_anim.Working=""
+        #reseta contadores caso seja pedido
+        if context.scene.imp_sound_to_anim.timer_reset_func:
+            obi.RunFrom=0
+            obi.iSumOptimizerP1=0
+            obi.iSumOptimizerP2=0
+            obi.iSumOptimizerP3=0
+            obi.iSumImportFrames=0
+            context.scene.imp_sound_to_anim.timer_reset_func=False
+
+        #limita o loop se estiver no fim
+        tot=len(array)-1
+        if obi.RunFrom+loop > tot:
+            loop= tot - obi.RunFrom
+
+        #scala do valor do movimento. [se =1 - 0 a 255 ] [se=255 - 0,00000 a 1,00000] [se=1000 - 0 a 0.255]
+        iDivScala= int(context.scene.imp_sound_to_anim.action_escale)
+
+        # nao deixa repetir valores
+        bNaoValorIgual=True
+        if context.scene.imp_sound_to_anim.action_valor_igual: bNaoValorIgual= False
+
+        # inicia no inicio pedido pelo usuario mais ponteiro RunFrom
+        iStartFrame= int(context.scene.imp_sound_to_anim.frames_initial) + obi.RunFrom
+
+        iMaxValue= context.scene.imp_sound_to_anim.action_max_value
+        iMinValue= context.scene.imp_sound_to_anim.action_min_value
+
+        bEscala=bRotacao=bEixo=False
+        if context.scene.imp_sound_to_anim.import_type=='imp_t_Scale':
+            bEscala=True;
+
+        if context.scene.imp_sound_to_anim.import_type=='imp_t_Rotation':
+            bRotacao=True;
+
+        if context.scene.imp_sound_to_anim.import_type=='imp_t_Location':
+            bEixo=True;
+
+        # atencao, nao eh boolean
+        iEixoXneg= iEixoYneg= iEixoZneg=1
+        # atencao, nao eh boolean
+        iRotationNeg=1
+        # atencao, nao eh boolean
+        iEscalaYneg= iEscalaZneg= iEscalaXneg=1
+        bEixoX=bEixoY=bEixoZ=bEscalaX=bEscalaY=bEscalaZ=bRotationX=bRotationY=bRotationZ=False
+
+        # LOCAL 1
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_-x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+            iEixoXneg=-1
+            iEscalaXneg=-1
+            iRotationNeg=-1
+
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_-y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+            iEixoYneg=-1
+            iRotationNeg=-1
+            iEscalaYneg=-1
+
+        if context.scene.imp_sound_to_anim.import_where1== 'imp_w_-z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+            iEixoZneg=-1
+            iRotationNeg=-1
+            iEscalaZneg=-1
+
+
+        # LOCAL 2
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_-x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+            iEixoXneg=-1
+            iEscalaXneg=-1
+            iRotationNeg=-1
+
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_-y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+            iEixoYneg=-1
+            iRotationNeg=-1
+            iEscalaYneg=-1
+
+        if context.scene.imp_sound_to_anim.import_where2== 'imp_w_-z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+            iEixoZneg=-1
+            iRotationNeg=-1
+            iEscalaZneg=-1
+
+
+        # LOCAL 3
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_-x':
+            bEixoX=True
+            bEscalaX=True
+            bRotationX=True
+            iEixoXneg=-1
+            iEscalaXneg=-1
+            iRotationNeg=-1
+
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_-y':
+            bEixoY=True
+            bEscalaY=True
+            bRotationY=True
+            iEixoYneg=-1
+            iRotationNeg=-1
+            iEscalaYneg=-1
+
+        if context.scene.imp_sound_to_anim.import_where3== 'imp_w_-z':
+            bEixoZ=True
+            bEscalaZ=True
+            bRotationZ=True
+            iEixoZneg=-1
+            iRotationNeg=-1
+            iEscalaZneg=-1
+
+        iMinBaseX=iMinScaleBaseX=context.scene.imp_sound_to_anim.action_offset_x
+        iMinBaseY=iMinScaleBaseY=context.scene.imp_sound_to_anim.action_offset_y
+        iMinBaseZ=iMinScaleBaseZ=context.scene.imp_sound_to_anim.action_offset_z
+
+        #escala inicia com 1 e nao com zero
+        iRotationAxisBaseX=context.scene.imp_sound_to_anim.action_offset_x  +1
+        iRotationAxisBaseY=context.scene.imp_sound_to_anim.action_offset_y  +1
+        iRotationAxisBaseZ=context.scene.imp_sound_to_anim.action_offset_z  +1
+
+        #Added destructive optimizer option - LostLestSignificativeDigit lost/total
+        iDestructiveOptimizer=context.scene.imp_sound_to_anim.optimization_destructive
+
+        #limita ou nao o valor - velocidade
+        bLimitValue=False
+
+        if iMinValue<0: iMinValue=0
+        if iMaxValue>255: iMaxValue=255
+        if iMinValue>255: iMinValue=255
+        if iMaxValue<0: iMaxValue=0
+        if iMinValue!= 0: bLimitValue= True
+        if iMaxValue!= 255: bLimitValue= True
+
+        if obi.RunFrom==0:
+            print('')
+            print("================================================================")
+            from time import strftime
+            print(strftime("Start Import:  %H:%M:%S"))
+            print("================================================================")
+            print('')
+
+        ilocationXAnt=0
+        ilocationYAnt=0
+        ilocationZAnt=0
+        iscaleXAnt=0
+        iscaleYAnt=0
+        iscaleZAnt=0
+        iRotateValAnt=0
+
+        # variavel global _Interna_Globals
+        if context.scene.imp_sound_to_anim.bArrayCriado:
+            for i in range(loop):
+                ival=array[i+obi.RunFrom]/iDivScala
+                #valor pequeno demais, vai dar zero na hora de aplicar
+                if ival < 0.001:
+                     array[i+obi.RunFrom]=0
+                     ival=0
+
+                # to increase performance and legibility
+                arrayI= array[i+obi.RunFrom]
+                arrayIP1= array[i+1+obi.RunFrom]
+                arrayIL1= array[i-1+obi.RunFrom]
+
+                # opcao de NAO colocar valores iguais sequenciais
+                if i>0 and bNaoValorIgual and arrayIL1== arrayI:
+                    print("Importing Blender Frame: "+str(i+obi.RunFrom+1)+"\tof "+str(len(array)-1) + \
+                                                                            "\t(skipped by optimizer)")
+                    obi.iSumOptimizerP3+=1
+                else:
+                    # otimizacao - nao preciso mais que 2 valores iguais.
+                    # pular key frame intermediario - Ex b, a, -, -, -, a
+                    # tambem otimiza pelo otimizador com perda
+                    # valor atual == anterior e posterior -> pula
+                    if i>0 and i< len(array)-1 and abs(arrayI - arrayIL1)<=iDestructiveOptimizer and \
+                                                        abs(arrayI - arrayIP1)<=iDestructiveOptimizer:
+                            print("Importing Blender Frame: "+str(i+obi.RunFrom+1)+"\tof "+str(len(array)-1) + \
+                                                                                    "\t(skipped by optimizer)")
+                            if iDestructiveOptimizer>0 and arrayI != arrayIL1 or arrayI != arrayIP1:
+                                obi.iSumOptimizerP1+=1
+                            else: obi.iSumOptimizerP2+=1
+                    else:
+                            if bLimitValue:
+                                if arrayI > iMaxValue: array[i+obi.RunFrom]=iMaxValue
+                                if arrayI < iMinValue: array[i+obi.RunFrom]=iMinValue
+
+                            ival=array[i+obi.RunFrom]/iDivScala
+                            #passa para float com somente 3 digitos caso seja float
+                            m_ival=ival*1000
+                            if int(m_ival) != m_ival:
+                                ival= int(m_ival)
+                                ival = ival /1000
+
+                            bpy.context.scene.frame_current = i+iStartFrame
+
+                            #precisa fazer objeto ativo
+                            if bpy.context.active_object.type=='MESH' or bpy.context.active_object.type=='CAMERA' or \
+                                                                            bpy.context.active_object.type=='EMPTY':
+                                if bEixo:
+                                    if bEixoX: bpy.context.active_object.location.x = ival*iEixoXneg+iMinBaseX
+                                    if bEixoY: bpy.context.active_object.location.y = ival*iEixoYneg+iMinBaseY
+                                    if bEixoZ: bpy.context.active_object.location.z = ival*iEixoZneg+iMinBaseZ
+
+                                if bEscala:
+                                    if bEscalaX: bpy.context.active_object.scale.x = ival*iEscalaXneg+iMinScaleBaseX
+                                    if bEscalaY: bpy.context.active_object.scale.y = ival*iEscalaYneg+iMinScaleBaseY
+                                    if bEscalaZ: bpy.context.active_object.scale.z = ival*iEscalaZneg+iMinScaleBaseZ
+
+                            # 'ARMATURE' or ('MESH' and bRotacao) or ('CAMERA' and bRotacao) or 'LAMP' or 'EMPTY' and bRotacao)
+                            if bpy.context.active_object.type=='ARMATURE' or (bpy.context.active_object.type=='MESH' and bRotacao) or \
+                                                                            (bpy.context.active_object.type=='CAMERA' and bRotacao) or \
+                                                                            bpy.context.active_object.type=='LAMP' or \
+                                                                            (bpy.context.active_object.type=='EMPTY' and bRotacao):
+
+                                    #===========  BONE ===========#
+                                    if bpy.context.active_object.type=='ARMATURE':   #precisa ser objeto ativo. Nao achei como passar para editmode
+                                        if bpy.context.mode!= 'POSE':    #posemode
+                                            bpy.ops.object.posemode_toggle()
+
+                                    #============= ALL ===========#
+                                    if bEixo:
+                                        if ilocationXAnt!=0 or ilocationYAnt!=0 or ilocationZAnt!=0:
+
+                                            bpy.ops.transform.translate(value=(ilocationXAnt*-1,                ilocationYAnt*-1, \
+                                                                                ilocationZAnt*-1),               constraint_axis=(bEixoX, bEixoY,bEixoZ), \
+                                                                                constraint_orientation='GLOBAL', mirror=False, \
+                                                                                proportional='DISABLED',         proportional_edit_falloff='SMOOTH', \
+                                                                                proportional_size=1,             snap=False, \
+                                                                                snap_target='CLOSEST',           snap_point=(0, 0, 0), \
+                                                                                snap_align=False,               snap_normal=(0, 0, 0), \
+                                                                                release_confirm=False)
+
+                                        ilocationX=ilocationY=ilocationZ=0
+                                        if bEixoX: ilocationX = ival*iEixoXneg+iMinBaseX
+                                        if bEixoY: ilocationY = ival*iEixoYneg+iMinBaseY
+                                        if bEixoZ: ilocationZ = ival*iEixoZneg+iMinBaseZ
+
+                                        bpy.ops.transform.translate(value=(ilocationX,                       ilocationY, \
+                                                                            ilocationZ),                      constraint_axis=(bEixoX, bEixoY,bEixoZ), \
+                                                                            constraint_orientation='GLOBAL',  mirror=False, \
+                                                                            proportional='DISABLED',          proportional_edit_falloff='SMOOTH', \
+                                                                            proportional_size=1,              snap=False, \
+                                                                            snap_target='CLOSEST',            snap_point=(0, 0, 0), snap_align=False, \
+                                                                            snap_normal=(0, 0, 0),           release_confirm=False)
+                                        ilocationXAnt= ilocationX
+                                        ilocationYAnt= ilocationY
+                                        ilocationZAnt= ilocationZ
+
+                                    if bEscala:
+                                        if iscaleXAnt!=0 or iscaleYAnt!=0 or iscaleZAnt!=0:
+                                            tmpscaleXAnt=0
+                                            tmpscaleYAnt=0
+                                            tmpscaleZAnt=0
+                                            if iscaleXAnt: tmpscaleXAnt=1/iscaleXAnt
+                                            if iscaleYAnt: tmpscaleYAnt=1/iscaleYAnt
+                                            if iscaleZAnt: tmpscaleZAnt=1/iscaleZAnt
+
+                                            bpy.ops.transform.resize(value=(tmpscaleXAnt,                    tmpscaleYAnt, \
+                                                                            tmpscaleZAnt ),                   constraint_axis=(False, False, False), \
+                                                                            constraint_orientation='GLOBAL',  mirror=False, \
+                                                                            proportional='DISABLED',          proportional_edit_falloff='SMOOTH', \
+                                                                            proportional_size=1, snap=False, snap_target='CLOSEST', \
+                                                                            snap_point=(0, 0, 0),             snap_align=False, \
+                                                                            snap_normal=(0, 0, 0),            release_confirm=False)
+
+                                        iscaleX=iscaleY=iscaleZ=0
+                                        if bEscalaX: iscaleX = ival*iEscalaXneg+iMinScaleBaseX
+                                        if bEscalaY: iscaleY = ival*iEscalaYneg+iMinScaleBaseY
+                                        if bEscalaZ: iscaleZ = ival*iEscalaZneg+iMinScaleBaseZ
+
+                                        bpy.ops.transform.resize(value=(iscaleX,                        iscaleY, \
+                                                                        iscaleZ),                        constraint_axis=(False, False, False), \
+                                                                        constraint_orientation='GLOBAL', mirror=False, \
+                                                                        proportional='DISABLED',         proportional_edit_falloff='SMOOTH', \
+                                                                        proportional_size=1,             snap=False, \
+                                                                        snap_target='CLOSEST',           snap_point=(0, 0, 0), \
+                                                                        snap_align=False,               snap_normal=(0, 0, 0), \
+                                                                        release_confirm=False)
+                                        iscaleXAnt= iscaleX
+                                        iscaleYAnt= iscaleY
+                                        iscaleZAnt= iscaleZ
+
+                                    if bRotacao:
+                                        if iRotateValAnt!=0:
+                                            bpy.context.active_object.rotation_euler= ((iRotateValAnt*-1)+    iRotationAxisBaseX) *bRotationX , \
+                                                                                        ((iRotateValAnt*-1)+  iRotationAxisBaseY) *bRotationY , \
+                                                                                        ((iRotateValAnt*-1)+  iRotationAxisBaseZ) *bRotationZ
+
+                                        bpy.context.active_object.rotation_euler= ((ival*iRotationNeg)+   iRotationAxisBaseX) * bRotationX, \
+                                                                                    ((ival*iRotationNeg)+ iRotationAxisBaseY)  * bRotationY, \
+                                                                                    ((ival*iRotationNeg)+ iRotationAxisBaseZ)  * bRotationZ
+                                        iRotateValAnt= ival*iRotationNeg
+
+                            ob = bpy.context.active_object
+
+                            if bEixo:
+                                ob.keyframe_insert(data_path="location")
+
+                            if bRotacao:
+                                ob.keyframe_insert(data_path="rotation_euler")
+
+                            if bEscala:
+                                ob.keyframe_insert(data_path="scale")
+
+                            print("Importing Blender Frame: "+str(i+obi.RunFrom+1)+"\tof "+str(len(array)-1) + "\tValue: "+ str(ival))
+
+                            obi.iSumImportFrames+=1
+                    # Fim do ELSE otimizador
+                # Fim bNaoValorIgual
+
+            if obi.RunFrom>= tot:
+                bpy.context.scene.frame_current = 1
+                context.scene.imp_sound_to_anim.Info_Import="Done. Imported " + str(obi.iSumImportFrames) + " Frames"
+                from time import strftime
+                print('')
+                print("================================================================")
+                print("Imported: " +str(obi.iSumImportFrames) + " Key Frames")
+                print("Optimizer Pass 1 prepared to optimize: " +str(obi.iSumOptimizerP1) + " blocks of Frames")
+                print("Optimizer Pass 2 has optimized: " +str(obi.iSumOptimizerP2) + " Frames")
+                print("Optimizer Pass 3 has optimized: " +str(obi.iSumOptimizerP3) + " Frames")
+                print("Optimizer has optimized: " +str(obi.iSumOptimizerP1 + obi.iSumOptimizerP2 + obi.iSumOptimizerP3) + " Frames")
+                print(strftime("End Import:  %H:%M:%S - by Vlassius"))
+                print("================================================================")
+                print('')
+                obi.RunFrom=0
+                obi.iSumImportFrames=0
+                obi.iSumOptimizerP1=0
+                obi.iSumOptimizerP2=0
+                obi.iSumOptimizerP3=0
+                return obi.RunFrom
+            else:
+                obi.RunFrom+= loop
+                context.scene.imp_sound_to_anim.Info_Import="Processing Frame " + str(obi.RunFrom+loop) + \
+                                                                            " of " + str(tot-1) + " Frames"
+                return obi.RunFrom
+
+
+    def execute(self, context):
+        #wavimport(context)
+        #return{'FINISHED'}
+        context.scene.imp_sound_to_anim.Working= "wavimport"
+        bpy.ops.wm.modal_timer_operator()
+
+    def invoke(self, context, event):
+        self.execute(context)
+        return {'FINISHED'}
+
+
+
+#
+#==================================================================================================
+# Button - Sound Process
+#==================================================================================================
+#
+class OBJECT_OT_Botao_Go(bpy.types.Operator):
+    ''''''
+    bl_idname = "import.sound_animation_botao_go"
+    # change in API
+    bl_description = "Process a .wav file, take movement from the sound and import to the scene as Key"
+    bl_label = "Process Wav"
+
+    filter_glob = StringProperty(default="*.wav", options={'HIDDEN'})
+    path = StringProperty(name="File Path", description="Filepath used for importing the WAV file", \
+                                                                            maxlen= 1024, default= "")
+    filename = StringProperty(name="File Name", description="Name of the file")
+    directory = StringProperty(name="Directory", description="Directory of the file")
+
+    RunFrom=0
+    Wave_read=0
+    MaxAudio=0
+
+
+    def SoundConv(File, DivSens, Sensibil, Resol, context, bAutoSense, bRemoveBeat, bUseBeat, bMoreSensible, \
+                                                                            bLessSensible, AudioChannel, loop):
+        obg= OBJECT_OT_Botao_Go
+        #reseta contadores caso seja pedido
+        if context.scene.imp_sound_to_anim.timer_reset_func:
+            obc.RunFrom=0
+            Wave_read=0
+            MaxAudio=0
+            context.scene.imp_sound_to_anim.timer_reset_func=False
+
+        #abre arquivo se primeira rodada
+        if obg.RunFrom==0:
+            try:
+                obg.Wave_read= wave.open(File, 'rb')
+            except IOError as e:
+                print("File Open Error: ", e)
+                return False
+
+        NumCh=      obg.Wave_read.getnchannels()
+        SampW=      obg.Wave_read.getsampwidth() # 8, 16, 24 32 bits
+        FrameR=     obg.Wave_read.getframerate()
+        NumFr=      obg.Wave_read.getnframes()
+        ChkCompr=   obg.Wave_read.getcomptype()
+
+        if ChkCompr != "NONE":
+            print('Sorry, this compressed Format is NOT Supported ', ChkCompr)
+            context.scene.imp_sound_to_anim.Info_Import= "Sorry, this compressed Format is NOT Supported "
+            return False
+
+        if SampW > 2:
+            context.scene.imp_sound_to_anim.Info_Import= "Sorry, supported .wav files 8 and 16 bits only"
+            print('Sorry, supported .wav files 8 and 16 bits only')
+            return False
+
+        context.scene.imp_sound_to_anim.Info_Import=""
+
+        # controla numero do canal
+        if AudioChannel > NumCh:
+            if obg.RunFrom==0:
+                print("Channel number " + str(AudioChannel) + " is selected but this audio file has just " + \
+                                                            str(NumCh) + " channels, so selecting channel " \
+                                                                                            + str(NumCh) + "!")
+            AudioChannel = NumCh
+
+        # apenas para por na tela
+        tmpAudioChannel= AudioChannel
+
+        #used in index sum to find the channe, adjust to first byte sample index
+        AudioChannel -= 1
+
+        # se dois canais, AudioChannel=4 porque sao 4 bytes
+        if SampW ==2:  AudioChannel*=2
+
+        # usado para achar contorno da onda - achando picos
+        # numero de audio frames para cada video frame
+        BytesResol= int(FrameR/Resol)
+
+        # com 8 bits/S - razao Sample/s por resolucao
+        # tamanho do array
+        BytesDadosTotProcess= NumFr // BytesResol
+
+        if obg.RunFrom==0:   # primeira rodada
+            # inicia array
+            _Interna_Globals(BytesDadosTotProcess, context)
+            print('')
+            print("================================================================")
+            from time import strftime
+            print(strftime("Go!  %H:%M:%S"))
+            print("================================================================")
+            print('')
+            print('Total Audio Time: \t ' + str(NumFr//FrameR) + 's (' + str(NumFr//FrameR//60) + 'min)')
+            print('Total # Interactions: \t', BytesDadosTotProcess)
+            print('Total Audio Frames: \t', NumFr)
+            print('Frames/s: \t\t ' + str(FrameR))
+            print('# Chanels in File: \t', NumCh)
+            print('Channel to use:\t\t', tmpAudioChannel)
+            print('Bit/Sample/Chanel: \t ' + str(SampW*8))
+            print('# Frames/Act: \t\t', DivSens)
+
+            if bAutoSense==0:
+                print('Audio Sensitivity: \t', Sensibil+1)
+            else:
+                print('Using Auto Audio Sentivity. This is pass 1 of 2.')
+
+            print('')
+            print ("Sample->[value]\tAudio Frame #   \t\t[Graph Value]")
+
+        if obg.RunFrom==0 and bAutoSense!=0:
+            Sensibil=0  # if auto sense, Sensibil must be zero here
+            obg.MaxAudio=0  # valor maximo de audio encontrado
+
+        # verifica limite total do audio
+        looptot= int(BytesDadosTotProcess // DivSens)
+        if obg.RunFrom+loop > looptot:
+            loop= looptot-obg.RunFrom
+
+        j=0  # usado de indice
+        # laco total leitura bytes
+        # armazena dado de pico
+        for jj in range(loop):
+            # caso de 2 canais (esterio)
+            # uso apenas 2 bytes em 16 bits, ie, apenas canal esquerdo
+            # [0] e [1] para CH L
+            # [2] e [3] para CH R   and so on
+            # mono:1 byte to 8 bits, 2 bytes to 16 bits
+            # sterio: 2 byte to 8 bits, 4 bytes to 16 bits
+            ValorPico=0
+            # leio o numero de frames de audio para cada frame de video, valor em torno de 1000
+            for i in range(BytesResol):
+                #loop exterior copia DivSens frames a cada frame calculado
+                frame = obg.Wave_read.readframes(DivSens)
+
+                if len(frame)==0: break
+
+                if bAutoSense==0:    # AutoAudioSense Desligado
+                    if SampW ==1:
+                        if Sensibil ==5:
+                            frame0= frame[AudioChannel] << 6 & 255
+
+                        elif Sensibil ==4:
+                            frame0= frame[AudioChannel] << 5 & 255
+
+                        elif Sensibil ==3:
+                            frame0= frame[AudioChannel] << 4 & 255
+
+                        elif Sensibil ==2:
+                            frame0= frame[AudioChannel] << 3 & 255
+
+                        elif Sensibil ==1:
+                            frame0= frame[AudioChannel] << 2 & 255
+
+                        elif Sensibil ==0:
+                            frame0= frame[AudioChannel]
+
+                        if frame0> ValorPico:
+                            ValorPico= frame0
+
+                    if SampW ==2:   # frame[0] baixa       frame[1] ALTA BIT 1 TEM SINAL!
+                        if frame[1+AudioChannel] <127:    # se bit1 =0, usa o valor - se bit1=1 quer dizer numero negativo
+                            if Sensibil ==0:
+                                frame0= frame[1+AudioChannel]
+
+                            elif Sensibil ==4:
+                                frame0= ((frame[AudioChannel] & 0b11111100) >> 2) | ((frame[1+AudioChannel] & 0b00000011) << 6)
+
+                            elif Sensibil ==3:
+                                frame0= ((frame[AudioChannel] & 0b11110000) >> 4) | ((frame[1+AudioChannel] & 0b00001111) << 4)
+
+                            elif Sensibil ==2:
+                                frame0= ((frame[AudioChannel] & 0b11100000) >> 5) | ((frame[1+AudioChannel] & 0b00011111) << 3)
+
+                            elif Sensibil ==1:
+                                frame0= ((frame[AudioChannel] & 0b11000000) >> 6) | ((frame[1+AudioChannel] & 0b00111111) << 2)
+
+                            elif Sensibil ==5:
+                                frame0=frame[AudioChannel]
+
+                            if frame0 > ValorPico:
+                                ValorPico= frame0
+
+                else:   # AutoAudioSense Ligado
+                    if SampW ==1:
+                        if frame[AudioChannel]> obg.MaxAudio:
+                            obg.MaxAudio = frame[AudioChannel]
+
+                        if frame[AudioChannel]> ValorPico:
+                            ValorPico=frame[AudioChannel]
+
+                    if SampW ==2:
+                        if frame[1+AudioChannel] < 127:
+                            tmpValorPico= frame[1+AudioChannel] << 8
+                            tmpValorPico+=  frame[AudioChannel]
+
+                            if tmpValorPico > obg.MaxAudio:
+                                obg.MaxAudio = tmpValorPico
+
+                            if tmpValorPico > ValorPico:
+                                ValorPico= tmpValorPico
+
+            if bAutoSense==0:    #autoaudiosense desligado
+                # repito o valor de frames por actions (OTIMIZAR)
+                for ii in range(DivSens):
+                    array[j+obg.RunFrom]=ValorPico  # valor de pico encontrado
+                    j +=1           # incrementa indice prox local
+            else:
+                idx=obg.RunFrom*2 # porque sao dois bytes
+                arrayAutoSense[j+idx]= (ValorPico & 0b0000000011111111) #copia valores baixos
+                arrayAutoSense[j+1+idx]= (ValorPico & 0b1111111100000000) >> 8   #copia valores altos
+                j+=2
+
+            if bAutoSense==0:    #autoaudiosense desligado
+                igraph= ValorPico//10
+            else:
+                if SampW ==2:
+                    igraph= ValorPico//1261
+
+                else:
+                    igraph= ValorPico//10
+
+            stgraph="["
+            for iii in range(igraph):
+                stgraph+="+"
+
+            for iiii in range(26-igraph):
+                stgraph+=" "
+            stgraph+="]"
+
+            print ("Sample-> " + str(ValorPico) + "\tAudio Frame #  " + str(jj+obg.RunFrom) + " of " + str(looptot-1) + "\t"+ stgraph)
+
+        # acabou primeira fase roda toda de uma vez
+        if obg.RunFrom+loop == looptot:
+            if bAutoSense==1:
+                print("")
+                print("================================================================")
+                print('Calculating Auto Audio Sentivity, pass 2 of 2.')
+                print("================================================================")
+
+                # caso usar batida, procurar por valores proximos do maximo e zerar restante.
+                # caso retirar batida, zerar valores proximos do maximo
+                UseMinim=0
+                UseMax=0
+
+                if bUseBeat==1:
+                    print("Trying to use just the beat.")
+                    UseMinim= obg.MaxAudio*0.8
+                    if bMoreSensible:
+                        UseMinim= obg.MaxAudio*0.7
+                    elif bLessSensible:
+                        UseMinim= obg.MaxAudio*0.9
+
+                if bRemoveBeat==1:
+                    print("Trying to exclude the beat.")
+                    UseMax= obg.MaxAudio*0.7
+                    if bMoreSensible:
+                        UseMax= obg.MaxAudio*0.8
+                    elif bLessSensible:
+                        UseMax= obg.MaxAudio*0.7
+
+                print("")
+                # para transformar 15 bits em 8 calibrando valor maximo -> fazer regra de 3
+                # obg.MaxAudio -> 255
+                # outros valores => valor calibrado= (255 * Valor) / obg.MaxAudio
+                scale= 255/obg.MaxAudio
+
+                j=0
+                jj=0
+                print ("Sample->[value]\tAudio Frame #    \t\t[Graph Value]")
+
+                for i in range(BytesDadosTotProcess // DivSens):
+
+                    ValorOriginal= arrayAutoSense[j+1] << 8
+                    ValorOriginal+= arrayAutoSense[j]
+
+                    if bUseBeat==1:
+                        if ValorOriginal < UseMinim:
+                            ValorOriginal = 0
+
+                    elif bRemoveBeat==1:
+                        if ValorOriginal > UseMax:
+                            ValorOriginal = 0
+
+                    ValorOriginal= ((round(ValorOriginal * scale)) & 0b11111111)    #aplica a escala
+
+                    for ii in range(DivSens):
+                        array[jj] = ValorOriginal
+                        jj += 1   # se autoaudiosense, o array tem dois bytes para cada valor
+
+                    j+=2
+                    igraph= round(array[jj-1]/10)
+                    stgraph="["
+                    for iii in range(igraph):
+                        stgraph+="+"
+
+                    for iiii in range(26-igraph):
+                        stgraph+=" "
+                    stgraph+="]"
+                    print ("Sample-> " + str(array[jj-1]) + "\tAudio Frame #  " + str(i) + " of " + str(looptot-1) + "\t"+ stgraph)
+
+                #limpa array tmp
+                del arrayAutoSense[:]
+
+            # mensagens finais
+            context.scene.imp_sound_to_anim.Info_Import= "Click \"Import Key frames\" to begin import" #this set the initial text
+
+            print("================================================================")
+            from time import strftime
+            print(strftime("End Process:  %H:%M:%S"))
+            print("================================================================")
+
+            try:
+                obg.Wave_read.close()
+            except:
+                print('File Close Error')
+
+            obg.RunFrom=0
+            return obg.RunFrom   # acabou tudo
+
+        else:#ainda nao acabou o arquivo todo if RunFrom+loop = looptot:
+            context.scene.imp_sound_to_anim.Info_Import="Processing " + str(obg.RunFrom) + " of " + str(looptot) +" Audio Frames"
+            # force update info text in UI
+            bpy.context.scene.frame_current= bpy.context.scene.frame_current
+            obg.RunFrom+=loop
+            return obg.RunFrom
+
+
+
+
+    def ProcessaSom(context, loop):
+        obg= OBJECT_OT_Botao_Go
+        # para de entrar o timer
+        context.scene.imp_sound_to_anim.Working=""
+        #reseta contadores caso seja pedido
+        if context.scene.imp_sound_to_anim.timer_reset_func:
+            obg.RunFrom=0
+            context.scene.imp_sound_to_anim.timer_reset_func=False
+
+        import os
+        f= os.path.join(context.scene.imp_sound_to_anim.directory, context.scene.imp_sound_to_anim.filename)
+        f= os.path.normpath(f)
+
+        if obg.RunFrom==0:
+            print ("")
+            print ("")
+            print ("Selected file = ",f)
+        checktype = f.split('\\')[-1].split('.')[1]
+        if checktype.upper() != 'WAV':
+            print ("ERROR!! Selected file = ", f)
+            print ("ERROR!! Its not a .wav file")
+            return
+
+        #sensibilidade volume do audio 0 a 5. Quanto maior, mais sensibilidade
+        iAudioSensib= int(context.scene.imp_sound_to_anim.audio_sense)-1
+        if iAudioSensib <0: iAudioSensib=0
+        elif iAudioSensib>5: iAudioSensib=5
+
+        #act/s nao pode se maior que frames/s
+        if context.scene.imp_sound_to_anim.action_per_second > context.scene.imp_sound_to_anim.frames_per_second:
+            context.scene.imp_sound_to_anim.action_per_second = context.scene.imp_sound_to_anim.frames_per_second
+
+        #Frames por segundo para key frame
+        iFramesPorSeg= int(context.scene.imp_sound_to_anim.frames_per_second)
+
+        #Sensibilidade de movimento. 3= 3 movimentos por segundo
+        iMovPorSeg= int(context.scene.imp_sound_to_anim.action_per_second)
+
+        #iDivMovPorSeg Padrao - taxa 4/s ou a cada 0,25s  => iFramesPorSeg/iDivMovPorSeg= ~0.25
+        for i in range(iFramesPorSeg):
+            iDivMovPorSeg=iFramesPorSeg/(i+1)
+            if iFramesPorSeg/iDivMovPorSeg >=iMovPorSeg:
+                break
+
+        bRemoveBeat=    context.scene.imp_sound_to_anim.remove_beat
+        bUseBeat=       context.scene.imp_sound_to_anim.use_just_beat
+        bLessSensible=  context.scene.imp_sound_to_anim.beat_less_sensible
+        bMoreSensible=  context.scene.imp_sound_to_anim.beat_more_sensible
+        AudioChannel=   context.scene.imp_sound_to_anim.audio_channel_select
+
+        # chama funcao de converter som, retorna preenchendo _Interna_Globals.array
+        index= OBJECT_OT_Botao_Go.SoundConv(f, int(iDivMovPorSeg), iAudioSensib, iFramesPorSeg, context, \
+                                    context.scene.imp_sound_to_anim.action_auto_audio_sense, bRemoveBeat, \
+                                    bUseBeat, bMoreSensible, bLessSensible, AudioChannel, loop)
+        return index
+
+
+    def execute(self, context):
+
+        # copia dados dialof open wave
+        context.scene.imp_sound_to_anim.filter_glob= self.filter_glob
+        context.scene.imp_sound_to_anim.path = self.path
+        context.scene.imp_sound_to_anim.filename = self.filename
+        context.scene.imp_sound_to_anim.directory = self.directory
+
+        context.scene.imp_sound_to_anim.Working= "ProcessaSom"
+        bpy.ops.wm.modal_timer_operator()
+        #ProcessaSom(context)
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        #need to set a path so so we can get the file name and path
+        wm = context.window_manager
+        wm.fileselect_add(self)
+
+        return {'RUNNING_MODAL'}
+
+
+#
+#==================================================================================================
+# Button - Check Smart Render
+#==================================================================================================
+#
+class OBJECT_OT_Botao_Check_SmartRender(bpy.types.Operator):
+    '''Check for Reduction'''
+    bl_idname = "import.sound_animation_botao_check_smartrender"
+    bl_label = "Check Smart Render"
+
+    RunFrom=0
+    Frames_Renderizar=0
+    Frames_Pular=0
+
+    def CheckSmartRender(context, loop):
+        obc= OBJECT_OT_Botao_Check_SmartRender
+
+        #reseta contadores caso seja pedido
+        if context.scene.imp_sound_to_anim.timer_reset_func:
+            obc.RunFrom=0
+            obc.Frames_Pular=0
+            obc.Frames_Renderizar=0
+            context.scene.imp_sound_to_anim.timer_reset_func=False
+
+        if obc.RunFrom==0:
+            if loop !=1: # loop==1 quando estou chamando de dentro da funcao render
+                print("")
+                print("================================================================")
+                print('Running Check Smart Render...')
+
+        #garante ao menos locrotscale ligado
+        if context.scene.imp_sound_to_anim.check_smartrender_loc_rot_sc==False and \
+                        context.scene.imp_sound_to_anim.check_smartrender_material_basic==False and \
+                        context.scene.imp_sound_to_anim.check_smartrender_material_transparence==False and \
+                        context.scene.imp_sound_to_anim.check_smartrender_material_mirror==False:
+            context.scene.imp_sound_to_anim.check_smartrender_loc_rot_sc=True
+
+        chkLocRotSc=  context.scene.imp_sound_to_anim.check_smartrender_loc_rot_sc
+        chkMatBas=    context.scene.imp_sound_to_anim.check_smartrender_material_basic
+        chkMatTransp= context.scene.imp_sound_to_anim.check_smartrender_material_transparence
+        chkMatMirror= context.scene.imp_sound_to_anim.check_smartrender_material_mirror
+
+        ToRender=[]
+        origloop=loop
+        from copy import copy
+        RunMax= bpy.context.scene.frame_end - bpy.context.scene.frame_start+1
+        if obc.RunFrom+loop > RunMax:
+            loop= RunMax-obc.RunFrom
+            if loop<=0:   #acabou
+                if origloop !=1: # loop==1 quando estou chamando de dentro da funcao render
+                    print("")
+                    print("Frames to copy: " + str(obc.Frames_Pular) + " Frames to really render= " + str(obc.Frames_Renderizar))
+                    print("================================================================")
+                    print("")
+                obc.RunFrom=0
+                obc.Frames_Pular=0
+                obc.Frames_Renderizar=0
+                return (ToRender, obc.RunFrom)
+
+        #move para o primeiro frame a renderizar
+        #RunFrom inicia em zero - frames inicia em 1
+        bpy.context.scene.frame_current = obc.RunFrom+bpy.context.scene.frame_start
+
+        for k in range(loop):
+            if obc.RunFrom==0 and k==0: #primeiro sempre renderiza
+                ToRender.append(bpy.context.scene.frame_current)
+                obc.Frames_Renderizar+=1
+                bpy.context.scene.frame_set(bpy.context.scene.frame_current + 1)
+            else:
+                if origloop !=1: # loop==1 quando estou chamando de dentro da funcao render
+                    import sys
+                    sys.stdout.write("\rChecking Frame "+str(bpy.context.scene.frame_current) + "  ")
+                    sys.stdout.flush()
+                #buffer de todos os objetos
+                a=[]
+                for obj in bpy.data.objects:
+                    if chkLocRotSc:
+                        # loc rot scale
+                        a.append(copy(obj.location))
+                        a.append(copy(obj.rotation_euler))
+                        a.append(copy(obj.scale))
+                    if hasattr(obj.data, 'materials') and obj.data.materials.keys()!=[] :
+                        if bpy.context.scene.render.engine == "BLENDER_RENDER":
+                            #pega somente primeiro material sempre
+                            if chkMatBas:
+                                # cores
+                                a.append(copy(obj.data.materials[0].type))
+                                a.append(copy(obj.data.materials[0].emit))
+                                a.append(copy(obj.data.materials[0].diffuse_color))
+                                a.append(copy(obj.data.materials[0].diffuse_intensity))
+                                a.append(copy(obj.data.materials[0].specular_intensity))
+                                a.append(copy(obj.data.materials[0].specular_color))
+                                a.append(copy(obj.data.materials[0].alpha))
+                                a.append(copy(obj.data.materials[0].diffuse_shader))
+                                a.append(copy(obj.data.materials[0].specular_shader))
+                                a.append(copy(obj.data.materials[0].specular_hardness))
+
+                            if chkMatTransp:
+                                # transp
+                                a.append(copy(obj.data.materials[0].transparency_method))
+                                a.append(copy(obj.data.materials[0].specular_alpha))
+                                a.append(copy(obj.data.materials[0].raytrace_transparency.fresnel))
+                                a.append(copy(obj.data.materials[0].raytrace_transparency.ior))
+                                a.append(copy(obj.data.materials[0].raytrace_transparency.filter))
+                                a.append(copy(obj.data.materials[0].raytrace_transparency.depth))
+                                a.append(copy(obj.data.materials[0].translucency))
+                                a.append(copy(obj.data.materials[0].specular_alpha))
+
+                            if chkMatMirror:
+                                #mirror
+                                a.append(copy(obj.data.materials[0].raytrace_mirror.reflect_factor))
+                                a.append(copy(obj.data.materials[0].raytrace_mirror.fresnel))
+                                a.append(copy(obj.data.materials[0].raytrace_mirror.fresnel_factor))
+                                a.append(copy(obj.data.materials[0].mirror_color))
+                                a.append(copy(obj.data.materials[0].raytrace_mirror.depth))
+                                a.append(copy(obj.data.materials[0].raytrace_mirror.gloss_factor))
+
+                # tenho todos os objetos em a[]
+                # incrementar um frame e checar se eh igual
+                bpy.context.scene.frame_set(bpy.context.scene.frame_current + 1)
+
+                j=0
+                dif=0
+                for obj in bpy.data.objects:
+                    if chkLocRotSc:
+                        if a[j]!= obj.location or a[j+1]!= obj.rotation_euler or a[j+2]!= obj.scale:
+                            dif=1
+                            #break
+                        j+=3
+
+                    if hasattr(obj.data, 'materials') and obj.data.materials.keys()!=[] :
+                        if bpy.context.scene.render.engine == "BLENDER_RENDER":
+                            if chkMatBas:
+                                # cores
+                                if a[j]!= obj.data.materials[0].type or   a[j+1]!= obj.data.materials[0].emit or \
+                                                                            a[j+2]!= obj.data.materials[0].diffuse_color or \
+                                                                            a[j+3]!= obj.data.materials[0].diffuse_intensity or \
+                                                                            a[j+4]!= obj.data.materials[0].specular_intensity or \
+                                                                            a[j+5]!= obj.data.materials[0].specular_color or \
+                                                                            a[j+6]!= obj.data.materials[0].alpha or \
+                                                                            a[j+7]!= obj.data.materials[0].diffuse_shader or \
+                                                                            a[j+8]!= obj.data.materials[0].specular_shader or \
+                                                                            a[j+9]!= obj.data.materials[0].specular_hardness:
+                                    dif=1
+                                    print("mat")
+                                    j+= 10  # ajusta ponteiro j
+                                    if chkMatTransp: j+=8
+                                    if chkMatMirror: j+=6
+                                    break
+                                j+=10
+
+                            if chkMatTransp:
+                                #transp
+                                if a[j]!= obj.data.materials[0].transparency_method or    a[j+1]!= obj.data.materials[0].specular_alpha or \
+                                                                                            a[j+2]!= obj.data.materials[0].raytrace_transparency.fresnel or \
+                                                                                            a[j+3]!= obj.data.materials[0].raytrace_transparency.ior or \
+                                                                                            a[j+4]!= obj.data.materials[0].raytrace_transparency.filter or \
+                                                                                            a[j+5]!= obj.data.materials[0].raytrace_transparency.depth or \
+                                                                                            a[j+6]!= obj.data.materials[0].translucency or \
+                                                                                            a[j+7]!= obj.data.materials[0].specular_alpha:
+                                    dif=1
+                                    j+= 8     # ajusta ponteiro j
+                                    if chkMatMirror: j+=6
+
+                                    break
+                                j+=8
+
+                            if chkMatMirror:
+                                #mirror
+                                if a[j]!= obj.data.materials[0].raytrace_mirror.reflect_factor or a[j+1]!= obj.data.materials[0].raytrace_mirror.fresnel or \
+                                                                                                    a[j+2]!= obj.data.materials[0].raytrace_mirror.fresnel_factor or \
+                                                                                                    a[j+3]!= obj.data.materials[0].mirror_color or \
+                                                                                                    a[j+4]!= obj.data.materials[0].raytrace_mirror.depth or \
+                                                                                                    a[j+5]!= obj.data.materials[0].raytrace_mirror.gloss_factor:
+                                    dif=1
+                                    j+= 6     # ajusta ponteiro j
+                                    break
+                                j+=6
+                # finaliza
+                if dif==0:
+                    obc.Frames_Pular+=1
+                else:
+                    obc.Frames_Renderizar+=1
+                    ToRender.append(bpy.context.scene.frame_current)
+
+                del a
+        # para nao sair do index - nunca chega nesse frame
+        ToRender.append(bpy.context.scene.frame_end+1)
+
+        if obc.RunFrom+loop < RunMax:
+            context.scene.imp_sound_to_anim.Info_check_smartrender= "["+str(obc.RunFrom+loop) + "/" + \
+                                        str(RunMax) + "] Frames to Render= " + str(obc.Frames_Renderizar) + \
+                                        " -> Reduction " + str(round((obc.Frames_Pular/RunMax)*100,1)) + "%"
+        else:
+            context.scene.imp_sound_to_anim.Info_check_smartrender= "Frames to Render= " + str(obc.Frames_Renderizar) + \
+                                                    " -> Reduction " + str(round((obc.Frames_Pular/RunMax)*100,1)) + "%"
+
+        #incrementa indice
+        obc.RunFrom+= loop
+        return (ToRender, obc.RunFrom)
+
+    def execute(self, context):
+        context.scene.imp_sound_to_anim.Working= "CheckSmartRender"
+        #context.scene.imp_sound_to_anim.timer_reset_func=True
+        bpy.ops.wm.modal_timer_operator()
+        #CheckSmartRender(context)
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        self.execute(context)
+        return {'FINISHED'}
+
+
+#
+#==================================================================================================
+# Button - Smart Render
+#==================================================================================================
+#
+class OBJECT_OT_Botao_SmartRender(bpy.types.Operator):
+    '''Render Only Modified Frames and Copy the Others'''
+    bl_idname = "import.sound_animation_smart_render"
+    bl_label = "Smart Render"
+
+    BaseRenderToCopy=0
+
+    def SmartRender(context):
+        obs=OBJECT_OT_Botao_SmartRender
+
+        index=0
+        pad=4
+        #calcula zero pad
+        if bpy.context.scene.frame_end //1000000 > 0:  #default 999999 1000000//1000000=1
+            pad=7
+        elif bpy.context.scene.frame_end //100000 > 0:  #default 99999 100000//100000=1
+            pad=6
+        elif bpy.context.scene.frame_end //10000 > 0:  #default 9999 10000//10000=1
+            pad=5
+
+        #bpy.data.images['Render Result'].file_format ='PNG'
+        bpy.context.scene.render.image_settings.file_format = 'PNG'
+
+        #info dos arquivos
+        path= bpy.context.scene.render.filepath
+
+        import shutil
+
+        tot=bpy.context.scene.frame_end - bpy.context.scene.frame_start+1
+        i=0
+        # checa apenas 1 frame    o indice é interno em ChackSmartRender
+        r= OBJECT_OT_Botao_Check_SmartRender.CheckSmartRender(context, 1)
+        ToRender= r[0] # tem numero do frame se for para renderizar
+        index= r[1]
+
+        #copia frame atual  #se o frame ja não foi renderizado
+        if (obs.BaseRenderToCopy!=(index+bpy.context.scene.frame_start-1)) and index > 1:   #index!=1 and index !=0:
+            print("Copying: " + str(obs.BaseRenderToCopy) + "-> " + str(index+bpy.context.scene.frame_start-1) + \
+                                "  To " + path + str(index+bpy.context.scene.frame_start-1).zfill(pad)  + ".png")
+            shutil.copy2(path + str(obs.BaseRenderToCopy).zfill(pad)  + ".png", path + \
+                        str(index+bpy.context.scene.frame_start-1).zfill(pad)  + ".png")
+
+        if ToRender.__len__()>1:   #renderizar 1 item em ToRender nao renderiza, (sempre vem com no minimo 1)
+            if index==1:
+                print("================================================================")
+                from time import strftime
+                print(strftime("Running Smart Render:  %H:%M:%S"))
+                print("================================================================")
+                BaseRenderToCopy=0
+
+            if ToRender[0] <= bpy.context.scene.frame_end:
+                #renderiza proximo frame
+                print("Rendering-> " + str(ToRender[0]))
+                obs.BaseRenderToCopy= ToRender[0]
+                bpy.ops.render.render(animation=False, write_still=False)
+                bpy.data.images['Render Result'].save_render(filepath=path + str(ToRender[0]).zfill(pad)  + ".png")
+                i+=1
+
+        if index==tot:
+            print("================================================================")
+            from time import strftime
+            print(strftime("Finish Render:  %H:%M:%S"))
+            print("================================================================")
+            print(".")
+
+        if index==tot+1:
+            obs.BaseRenderToCopy=0
+            return 0
+
+        return index
+
+
+    def execute(self, context):
+        # se for CYCLES, nao funciona com timer, preciso rodar direto
+        context.scene.imp_sound_to_anim.Working= "SmartRender"
+        bpy.ops.wm.modal_timer_operator()
+        #SmartRender(context)
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        self.execute(context)
+        return {'FINISHED'}
+
+
+
+#
+#==================================================================================================
+# Button - Cancel
+#==================================================================================================
+#
+class OBJECT_OT_Botao_Cancel(bpy.types.Operator):
+    '''Cancel Actual Operation'''
+    bl_idname = "import.sound_animation_botao_cancel"
+    bl_label = "CANCEL"
+
+    def execute(self, context):
+        context.scene.imp_sound_to_anim.cancel_button_hit=True
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        self.execute(context)
+        return {'FINISHED'}
+
+
+#
+#==================================================================================================
+#     TIMER - controla a execucao das funcoes
+#           Responsavel por rodar em partes usando o timer e possibilitando
+#           o cancelamento e textos informativos
+#==================================================================================================
+#
+class ModalTimerOperator(bpy.types.Operator):
+    """Internal Script Control"""
+    bl_idname = "wm.modal_timer_operator"
+    bl_label = "Internal Script Control"
+
+    _timer = None
+    Running= False
+
+    def CheckRunStop(self, context, func, index):
+        # forca update do UI
+        bpy.context.scene.frame_set(bpy.context.scene.frame_current)
+        if index!=0:
+            #configura timer para a funcao
+            context.scene.imp_sound_to_anim.Working= func
+            self.Running=True
+            return {'PASS_THROUGH'}
+        else: # posso desligar o timer e modal
+            if self._timer!= None:
+                context.window_manager.event_timer_remove(self._timer)
+                self._timer= None
+            return {'FINISHED'}
+
+
+    def modal(self, context, event):
+        if event.type == 'ESC'and self.Running:
+            print("-- ESC Pressed --")
+            self.cancel(context)
+            context.scene.imp_sound_to_anim.Working=""
+            self.Running=False
+            #reseta contadores
+            context.scene.imp_sound_to_anim.timer_reset_func=True
+            # forca update do UI
+            bpy.context.scene.frame_set(bpy.context.scene.frame_current)
+            return {'CANCELLED'}
+
+        if event.type == 'TIMER':
+            #print("timer")
+            #CheckSmartRender
+            if context.scene.imp_sound_to_anim.Working== "CheckSmartRender":
+                self.parar(context)
+                #5= frames para rodar antes de voltar    [1]= indice de posicao atual
+                index= OBJECT_OT_Botao_Check_SmartRender.CheckSmartRender(context, 5)[1]
+                return self.CheckRunStop(context, "CheckSmartRender", index)
+
+            #SmartRender
+            elif context.scene.imp_sound_to_anim.Working== "SmartRender":
+                self.parar(context)
+                #render/copia 1 e volta     index>=0 indice posicao atual
+                index= OBJECT_OT_Botao_SmartRender.SmartRender(context)
+                return self.CheckRunStop(context, "SmartRender", index)
+
+            #ProcessaSom
+            elif context.scene.imp_sound_to_anim.Working== "ProcessaSom":
+                self.parar(context)
+                # loop = numero de frames de audio    index=0 se terminou ou >0 se não acabou
+                index= OBJECT_OT_Botao_Go.ProcessaSom(context, 50)
+                return self.CheckRunStop(context, "ProcessaSom", index)
+
+            #wavimport(context)
+            elif context.scene.imp_sound_to_anim.Working== "wavimport":
+                self.parar(context)
+                # 5= numero de frames to import por timer
+                index=OBJECT_OT_Botao_Import.wavimport(context, 50)
+                return self.CheckRunStop(context, "wavimport", index)
+
+            #passa por aqui quando as funcoes estao sendo executadas mas
+            #configuradas para nao entrar porque  context.scene.imp_sound_to_anim.Working== ""
+            return {'PASS_THROUGH'}
+
+        # reseta e para tudo botao CANCEL pressionado
+        if context.scene.imp_sound_to_anim.cancel_button_hit==True:
+            context.scene.imp_sound_to_anim.Working=""
+            #pede reset contadores
+            context.scene.imp_sound_to_anim.timer_reset_func=True
+            if self._timer!= None:
+                context.window_manager.event_timer_remove(self._timer)
+                self._timer= None
+            print("-- Cancel Pressed --")
+            context.scene.imp_sound_to_anim.cancel_button_hit=False
+            return {'FINISHED'}
+
+        #print("modal")
+
+        # se o timer esta ativado, continua, (senao termina).
+        # desligar a chamada ao modal se caso chegar aqui (nao deveria)
+        if self._timer!= None:
+            return{'PASS_THROUGH'}
+        else:
+            return {'FINISHED'}
+
+    def execute(self, context):
+        if self._timer==None:
+            self._timer = context.window_manager.event_timer_add(0.2, context.window)
+            context.window_manager.modal_handler_add(self)
+        #para deixar rodar sem deligar o timer
+        context.scene.imp_sound_to_anim.timer_desligar=False
+        self.Running=True
+        return {'RUNNING_MODAL'}
+
+    def cancel(self, context):
+        if self._timer!= None:
+            context.window_manager.event_timer_remove(self._timer)
+        self._timer= None
+        return {'CANCELLED'}
+
+    def parar(self, context):
+        if self.Running:
+            context.scene.imp_sound_to_anim.Working=""
+            self.Running=False
+
+
+
+#
+#==================================================================================================
+#     Register - Unregister - MAIN
+#==================================================================================================
+#
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.Scene.imp_sound_to_anim = PointerProperty(type=ImpSoundtoAnim, name="Import: Sound to Animation", description="Extract movement from sound file. See the Object Panel at the end.")
+    bpy.types.INFO_MT_file_import.append(WavFileImport)
+
+def unregister():
+
+    try:
+        bpy.utils.unregister_module(__name__)
+    except:
+        pass
+
+    try:
+        bpy.types.INFO_MT_file_import.remove(WavFileImport)
+    except:
+        pass
+
+
+
+if __name__ == "__main__":
+    register()
+
+
+
+
diff --git a/release/scripts/addons_contrib/io_mesh_gwyddion/__init__.py b/release/scripts/addons_contrib/io_mesh_gwyddion/__init__.py
new file mode 100644
index 0000000..e3ce7da
--- /dev/null
+++ b/release/scripts/addons_contrib/io_mesh_gwyddion/__init__.py
@@ -0,0 +1,184 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+#
+#
+#  Authors           : Clemens Barth (Blendphys at root-1.de), ...
+#
+#  Homepage          : http://development.root-1.de/Atomic_Blender.php
+#
+#  Start of project              : 2012-11-12 by Clemens Barth
+#  First publication in Blender  : 2012-11-19
+#  Last modified                 : 2012-11-19
+#
+#  Acknowledgements 
+#  ================
+#
+#  Other: Frank Palmino
+#
+
+bl_info = {
+    "name": "Atomic Blender - Gwyddion",
+    "description": "Loading Gwyddion Atomic Force Microscopy images",
+    "author": "Clemens Barth",
+    "version": (0,1),
+    "blender": (2,6),
+    "location": "File -> Import -> Gwyddion (.gwy)",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+                "Scripts/Import-Export/Gwyddion",
+    "tracker_url": "http://projects.blender.org/tracker/"
+                   "index.php?func=detail&aid=33236&group_id=153&atid=469",
+    "category": "Import-Export"
+}
+
+import bpy
+from bpy.types import Operator
+from bpy_extras.io_utils import ImportHelper
+from bpy.props import (BoolProperty, 
+                       StringProperty, 
+                       EnumProperty,
+                       FloatProperty)
+
+from . import import_gwyddion
+
+# -----------------------------------------------------------------------------
+#                                                                           GUI
+
+# This is the class for the file dialog of the importer.
+class ImportGwyddion(Operator, ImportHelper):
+    bl_idname = "import_mesh.gwy"
+    bl_label  = "Import Gwyddion (*.gwy)"
+    bl_options = {'PRESET', 'UNDO'}
+
+    filename_ext = ".gwy"
+    filter_glob  = StringProperty(default="*.gwy", options={'HIDDEN'},)
+
+    use_camera = BoolProperty(
+        name="Camera", default=False,
+        description="Do you need a camera?")
+    use_lamp = BoolProperty(
+        name="Lamp", default=False,
+        description = "Do you need a lamp?")             
+    use_smooth = BoolProperty(
+        name="Smooth image data", default=False,
+        description = "Smooth the images")
+    scale_size = FloatProperty (
+        name = "Scale xy", default=0.5,
+        description = "Scale the lateral size")    
+    scale_height = FloatProperty (
+        name = "Scale h", default=3.0,
+        description = "Scale the height")    
+    use_all_channels = BoolProperty(
+        name="All channels", default=False,
+        description = "Load all images")        
+    use_c1 = BoolProperty(
+        name="1", default=True,
+        description = "Channel 1")
+    use_c2 = BoolProperty(
+        name="2", default=False,
+        description = "Channel 2")        
+    use_c3 = BoolProperty(
+        name="3", default=False,
+        description = "Channel 3")
+    use_c4 = BoolProperty(
+        name="4", default=False,
+        description = "Channel 4")       
+    use_c5 = BoolProperty(
+        name="5", default=False,
+        description = "Channel 5")
+    use_c6 = BoolProperty(
+        name="6", default=False,
+        description = "Channel 6")        
+    use_c7 = BoolProperty(
+        name="7", default=False,
+        description = "Channel 7")
+    use_c8 = BoolProperty(
+        name="8", default=False,
+        description = "Channel 8")       
+ 
+    def draw(self, context):
+        layout = self.layout
+        row = layout.row()
+        row.prop(self, "use_camera")
+        row.prop(self, "use_lamp")   
+        row = layout.row()
+        row.prop(self, "use_smooth")
+        row = layout.row()
+        row.prop(self, "scale_size")
+        row.prop(self, "scale_height")
+        row = layout.row()
+        row.label(text="Channels")
+        row.prop(self, "use_all_channels")
+        row = layout.row()
+        row.prop(self, "use_c1")
+        row.prop(self, "use_c2")
+        row.prop(self, "use_c3")
+        row.prop(self, "use_c4")
+        row = layout.row()
+        row.prop(self, "use_c5")
+        row.prop(self, "use_c6")
+        row.prop(self, "use_c7")
+        row.prop(self, "use_c8")
+        
+        if self.use_all_channels:
+            self.use_c1, self.use_c2, self.use_c3, self.use_c4, \
+            self.use_c5, self.use_c6, self.use_c7, self.use_c8  \
+            = True, True, True, True, True, True, True, True
+        
+    def execute(self, context):
+        # This is in order to solve this strange 'relative path' thing.
+        filepath_par = bpy.path.abspath(self.filepath)
+
+        channels = [self.use_c1, self.use_c2, self.use_c3, self.use_c4,
+                    self.use_c5, self.use_c6, self.use_c7, self.use_c8]
+
+        # Execute main routine   
+        #print("passed - 1")
+        images, AFMdata = import_gwyddion.load_gwyddion_images(filepath_par, 
+                                                               channels) 
+
+        #print("passed - 3")
+        import_gwyddion.create_mesh(images, 
+                                 AFMdata,
+                                 self.use_smooth,
+                                 self.scale_size,
+                                 self.scale_height,
+                                 self.use_camera,
+                                 self.use_lamp)  
+        #print("passed - 4")
+        
+        return {'FINISHED'}
+
+
+# The entry into the menu 'file -> import'
+def menu_func_import(self, context):
+    self.layout.operator(ImportGwyddion.bl_idname, text="Gwyddion (.gwy)")
+
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_file_import.append(menu_func_import)
+    
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_file_import.remove(menu_func_import)
+
+if __name__ == "__main__":
+
+    register()
diff --git a/release/scripts/addons_contrib/io_mesh_gwyddion/import_gwyddion.py b/release/scripts/addons_contrib/io_mesh_gwyddion/import_gwyddion.py
new file mode 100644
index 0000000..896a3f3
--- /dev/null
+++ b/release/scripts/addons_contrib/io_mesh_gwyddion/import_gwyddion.py
@@ -0,0 +1,309 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+import os
+import re
+from math import pi, sqrt
+from mathutils import Vector, Matrix
+import struct
+
+# All data for the images. Basically, each variable is a list with a length,
+# which equals the number of images.
+# Some of the variables are still not used. However, I keep them for purposes
+# in future.  
+class AFMData(object):
+    def __init__(self, date, x_size, y_size, x_pixel, y_pixel, x_off, y_off, 
+                 voltage, feedback, gain, speed, amplitude, angle, datfile, 
+                 channel, unit, z_factor, spec_x_unit, spec_x_label, spec_y_unit, 
+                 spec_y_label, spec_y_factor, spec_points, spec_feedback, 
+                 spec_acquisition, spec_delay):
+        self.date = date
+        self.x_size = x_size
+        self.y_size = y_size
+        self.x_pixel = x_pixel
+        self.y_pixel = y_pixel
+        self.x_off = x_off
+        self.y_off = y_off
+        self.voltage = voltage
+        self.feedback = feedback
+        self.gain = gain
+        self.speed = speed
+        self.amplitude = amplitude
+        self.angle = angle
+        self.datfile = datfile
+        self.channel = channel
+        self.unit = unit
+        self.z_factor = z_factor
+        self.spec_x_unit = spec_x_unit    
+        self.spec_x_label = spec_x_label     
+        self.spec_y_unit = spec_y_unit
+        self.spec_y_label = spec_y_label
+        self.spec_y_factor = spec_y_factor      
+        self.spec_points = spec_points
+        self.spec_feedback = spec_feedback
+        self.spec_acquisition = spec_acquisition
+        self.spec_delay = spec_delay     
+      
+
+# For loading the Gwyddion images. I basically have followed rules described 
+# here: http://gwyddion.net/documentation/user-guide-en/gwyfile-format.html
+def load_gwyddion_images(data_file, channels):
+   
+    if not os.path.isfile(data_file):
+        return False  
+
+    AFMdata = AFMData([],[],[],[],[],[],[],
+                      [],[],[],[],[],[],[],
+                      [],[],[],[],[],[],[],
+                      [],[],[],[],[])
+    AFMdata.datfile = data_file
+    
+    datafile = open(data_file, 'rb')
+    data = datafile.read()
+    datafile.close()   
+    
+    # Search the title of each image
+    for a in list(re.finditer(b"data/title\x00", data)):    
+            
+        pos = a.start()
+        channel_number = int(data[pos-2:pos-1])
+        
+        if channels[channel_number] == False:
+            continue
+                
+        pos1 = data[pos:].find(b"\x00") + pos + len("\x00") + 1
+        pos2 = data[pos1:].find(b"\x00") + pos1
+
+        channel_name = data[pos1:pos2].decode("utf-8")
+        
+        AFMdata.channel.append([channel_number, channel_name])    
+        
+    # Search important parameters and finally the image data.    
+    images = []    
+    for a in list(re.finditer(b"/data\x00", data)):
+    
+        pos = a.start()    
+
+        channel_number = int(data[pos-1:pos])
+        
+        if channels[channel_number] == False:
+            continue
+
+        # Find the image size in pixel (x direction)
+        pos1 = data[pos:].find(b"xres") + pos+len("xres")
+        size_x_pixel = struct.unpack("i",data[pos1+2:pos1+4+2])[0]
+
+        # ... the image size in pixel (y direction)
+        pos1 = data[pos:].find(b"yres") + pos+len("yres")
+        size_y_pixel = struct.unpack("i",data[pos1+2:pos1+4+2])[0]
+
+        # ... the real image size (x direction)
+        pos1 = data[pos:].find(b"xreal") + pos+len("xreal")
+        size_x_real = struct.unpack("d",data[pos1+2:pos1+8+2])[0]
+
+        # ... the real image size (y direction)
+        pos1 = data[pos:].find(b"yreal") + pos+len("yreal")
+        size_y_real = struct.unpack("d",data[pos1+2:pos1+8+2])[0]
+
+        # If it is a z image, multiply with 10^9 nm
+        factor = 1.0        
+        pos1 = data[pos:].find(b"si_unit_z") + pos
+        unit = data[pos1+34:pos1+36].decode("utf-8")
+        if "m" in unit:
+            factor = 1000000000.0
+        
+        # Now, find the image data and store it
+        pos1 = data[pos:].find(b"\x00data\x00") + pos + len("\x00data\x00") + 5
+
+        image = []        
+        for i in range(size_y_pixel):
+            line = []
+            for j in range(size_x_pixel):
+                # The '8' is for the double values
+                k = pos1 + (i*size_x_pixel+j)   * 8
+                l = pos1 + (i*size_x_pixel+j+1) * 8
+                line.append(struct.unpack("d",data[k:l])[0]*factor)
+            image.append(line)     
+            
+        images.append(image)
+   
+        # Note all parameters of the image.
+        AFMdata.x_pixel.append(int(size_x_pixel))
+        AFMdata.y_pixel.append(int(size_y_pixel))
+        AFMdata.x_size.append(size_x_real * 1000000000.0)
+        AFMdata.y_size.append(size_y_real * 1000000000.0)
+    
+    return (images, AFMdata)
+
+# Routine to create the mesh and finally the image
+def create_mesh(data_list, 
+                AFMdata, 
+                use_smooth, 
+                scale_size,
+                scale_height,
+                use_camera,
+                use_lamp):
+    # This is for the image name.       
+    path_list = AFMdata.datfile.strip('/').split('/') 
+
+    number_img = len(data_list)
+    image_x_offset_gap = 10.0 * scale_size
+    image_x_all = sum(AFMdata.x_size)*scale_size 
+    image_x_offset = -(image_x_all+image_x_offset_gap*(number_img-1)) / 2.0
+                                
+    # For each image do:
+    for k, data in enumerate(data_list):
+      
+        size_x = AFMdata.x_pixel[k]
+        size_y = AFMdata.y_pixel[k]
+        
+        image_scale = AFMdata.x_size[k] / float(AFMdata.x_pixel[k])    
+        image_scale = image_scale * scale_size    
+        image_x_size = AFMdata.x_size[k] * scale_size        
+        image_x_offset += image_x_size / 2.0
+      
+        image_name = path_list[-1] + "_" + AFMdata.channel[k][1]
+        
+        data_mesh = []
+        data_faces = []
+
+        #print("passed - create_mesh ---- 1")
+
+        for i, line in enumerate(data):
+            for j, pixel in enumerate(line):
+            
+               # The vertices
+               data_mesh.append(Vector((float(i) * image_scale, 
+                                        float(j) * image_scale, 
+                                        float(pixel)*scale_height)))
+               
+               # The faces
+               if i < size_y-1 and j < size_x-1:
+                   data_faces.append( [size_x*i+j      , size_x*(i+1)+j, 
+                                       size_x*(i+1)+j+1, size_x*i+j+1    ]) 
+
+        #print("passed - create_mesh ---- 2")
+               
+        # Build the mesh
+        surface_mesh = bpy.data.meshes.new("Mesh")
+        surface_mesh.from_pydata(data_mesh, [], data_faces)
+        surface_mesh.update()
+        surface = bpy.data.objects.new(image_name, surface_mesh)
+        bpy.context.scene.objects.link(surface)
+        bpy.ops.object.select_all(action='DESELECT')        
+        surface.select = True 
+
+        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
+        # sum((v.co for v in mesh.vertices), Vector()) / len(mesh.vertices)
+
+        if use_smooth:
+            for polygon in surface.data.polygons:
+                polygon.use_smooth = True
+
+        surface.location = Vector((0.0, image_x_offset, 0.0)) 
+        image_x_offset += image_x_size / 2.0 + image_x_offset_gap
+
+        #print("passed - create_mesh ---- 3")
+
+
+        
+    object_center_vec = Vector((0.0,0.0,0.0))
+    object_size = (sum(AFMdata.x_size) * scale_size 
+                   +image_x_offset_gap * (len(data_list)-1))
+
+    # ------------------------------------------------------------------------
+    # CAMERA AND LAMP
+    camera_factor = 20.0
+    
+    # If chosen a camera is put into the scene.
+    if use_camera == True:
+
+        # Assume that the object is put into the global origin. Then, the
+        # camera is moved in x and z direction, not in y. The object has its
+        # size at distance sqrt(object_size) from the origin. So, move the
+        # camera by this distance times a factor of camera_factor in x and z.
+        # Then add x, y and z of the origin of the object.
+        object_camera_vec = Vector((sqrt(object_size) * camera_factor,
+                                    0.0,
+                                    sqrt(object_size) * camera_factor))
+        camera_xyz_vec = object_center_vec + object_camera_vec
+
+        # Create the camera
+        current_layers=bpy.context.scene.layers 
+        camera_data = bpy.data.cameras.new("A_camera")
+        camera_data.lens = 45
+        camera_data.clip_end = 50000.0
+        camera = bpy.data.objects.new("A_camera", camera_data)
+        camera.location = camera_xyz_vec
+        camera.layers = current_layers
+        bpy.context.scene.objects.link(camera) 
+
+        # Here the camera is rotated such it looks towards the center of
+        # the object. The [0.0, 0.0, 1.0] vector along the z axis
+        z_axis_vec             = Vector((0.0, 0.0, 1.0))
+        # The angle between the last two vectors
+        angle                  = object_camera_vec.angle(z_axis_vec, 0)
+        # The cross-product of z_axis_vec and object_camera_vec
+        axis_vec               = z_axis_vec.cross(object_camera_vec)
+        # Rotate 'axis_vec' by 'angle' and convert this to euler parameters.
+        # 4 is the size of the matrix.
+        camera.rotation_euler  = Matrix.Rotation(angle, 4, axis_vec).to_euler()
+
+        # Rotate the camera around its axis by 90° such that we have a nice
+        # camera position and view onto the object.
+        bpy.ops.object.select_all(action='DESELECT')        
+        camera.select = True         
+        bpy.ops.transform.rotate(value=(90.0*2*pi/360.0),
+                                 axis=object_camera_vec,
+                                 constraint_axis=(False, False, False),
+                                 constraint_orientation='GLOBAL',
+                                 mirror=False, proportional='DISABLED',
+                                 proportional_edit_falloff='SMOOTH',
+                                 proportional_size=1, snap=False,
+                                 snap_target='CLOSEST', snap_point=(0, 0, 0),
+                                 snap_align=False, snap_normal=(0, 0, 0),
+                                 release_confirm=False)
+
+    # Here a lamp is put into the scene, if chosen.
+    if use_lamp == True:
+
+        # This is the distance from the object measured in terms of %
+        # of the camera distance. It is set onto 50% (1/2) distance.
+        lamp_dl = sqrt(object_size) * 15 * 0.5
+        # This is a factor to which extend the lamp shall go to the right
+        # (from the camera  point of view).
+        lamp_dy_right = lamp_dl * (3.0/4.0)
+
+        # Create x, y and z for the lamp.
+        object_lamp_vec = Vector((lamp_dl,lamp_dy_right,lamp_dl))
+        lamp_xyz_vec = object_center_vec + object_lamp_vec
+
+        # Create the lamp
+        current_layers=bpy.context.scene.layers
+        lamp_data = bpy.data.lamps.new(name="A_lamp", type="POINT")
+        lamp_data.distance = 5000.0
+        lamp_data.energy = 3.0
+        lamp_data.shadow_method = 'RAY_SHADOW'        
+        lamp = bpy.data.objects.new("A_lamp", lamp_data)
+        lamp.location = lamp_xyz_vec
+        lamp.layers = current_layers
+        bpy.context.scene.objects.link(lamp)         
+
+        bpy.context.scene.world.light_settings.use_ambient_occlusion = True
+        bpy.context.scene.world.light_settings.ao_factor = 0.1      
diff --git a/release/scripts/addons_contrib/io_mesh_xyz/__init__.py b/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
index 97558c7..0868368 100644
--- a/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
+++ b/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
@@ -21,23 +21,26 @@
 #  Authors           : Clemens Barth (Blendphys at root-1.de), ...
 #
 #  Homepage(Wiki)    : http://development.root-1.de/Atomic_Blender.php
-#  Tracker           : ... soon
 #
 #  Start of project              : 2011-12-01 by Clemens Barth
 #  First publication in Blender  : 2011-12-18
-#  Last modified                 : 2012-06-07
+#  Last modified                 : 2012-11-10
 #
-#  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
-#  dairin0d, PKHG, Valter, etc
+#  Acknowledgements 
+#  ================
+#
+#  Blender: ideasman, meta_androcto, truman, kilon, CoDEmanX, dairin0d, PKHG, 
+#           Valter, ...
+#  Other: Frank Palmino
 #
 
 bl_info = {
-    "name": "XYZ Atomic Blender",
-    "description": "Loading and manipulating atoms from XYZ files",
+    "name": "Atomic Blender - XYZ",
+    "description": "Import/export of atoms described in .xyz files",
     "author": "Clemens Barth",
-    "version": (0,6),
+    "version": (1,0),
     "blender": (2,6),
-    "location": "File -> Import -> XYZ (.xyz), Panel: View 3D - Tools",
+    "location": "File -> Import -> XYZ (.xyz)",
     "warning": "",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/"
                 "Import-Export/XYZ",
@@ -46,11 +49,9 @@ bl_info = {
     "category": "Import-Export"
 }
 
-import os
-import io
 import bpy
-from bpy.types import Operator, Panel
-from bpy_extras.io_utils import ImportHelper
+from bpy.types import Operator
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 from bpy.props import (StringProperty,
                        BoolProperty,
                        EnumProperty,
@@ -58,643 +59,14 @@ from bpy.props import (StringProperty,
                        FloatProperty)
 
 from . import import_xyz
-ATOM_XYZ_ERROR = ""
-ATOM_XYZ_NOTE  = ""
-ATOM_XYZ_PANEL = ""
+from . import export_xyz
 
 # -----------------------------------------------------------------------------
 #                                                                           GUI
 
-# This is the panel, which can be used to prepare the scene.
-# It is loaded after the file has been chosen via the menu 'File -> Import'
-class CLASS_atom_xyz_prepare_panel(Panel):
-    bl_label       = "XYZ - Atomic Blender"
-    bl_space_type  = "VIEW_3D"
-    bl_region_type = "TOOL_PROPS"
-
-    @classmethod
-    def poll(self, context):
-        global ATOM_XYZ_PANEL
-        
-        if ATOM_XYZ_PANEL == "0" and import_xyz.ATOM_XYZ_FILEPATH == "":
-            return False
-        if ATOM_XYZ_PANEL == "0" and import_xyz.ATOM_XYZ_FILEPATH != "":
-            return True
-        if ATOM_XYZ_PANEL == "1":
-            return True
-        if ATOM_XYZ_PANEL == "2":
-            return False
-        
-        return True
-
-
-    def draw(self, context):
-        layout = self.layout
-
-        if len(context.scene.atom_xyz) == 0:
-            bpy.context.scene.atom_xyz.add()
-
-        scn    = context.scene.atom_xyz[0]
-
-        row = layout.row()
-        row.label(text="Outputs and custom data file")
-        box = layout.box()
-        row = box.row()
-        row.label(text="Custom data file")
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "datafile")
-        col.operator("atom_xyz.datafile_apply")
-        row = box.row()
-        col = row.column(align=True)
-        col.prop(scn, "XYZ_file")
-        row = box.row()
-        row.prop(scn, "number_atoms")
-        row = box.row()
-        row.operator("atom_xyz.button_distance")
-        row.prop(scn, "distance")
-        row = layout.row()
-        row.label(text="Choice of atom radii")
-        box = layout.box()
-        row = box.row()
-        row.label(text="All changes concern:")
-        row = box.row()
-        row.prop(scn, "radius_how")
-        row = box.row()
-        row.label(text="1. Change type of radii")
-        row = box.row()
-        row.prop(scn, "radius_type")
-        row = box.row()
-        row.label(text="2. Change atom radii in pm")
-        row = box.row()
-        row.prop(scn, "radius_pm_name")
-        row = box.row()
-        row.prop(scn, "radius_pm")
-        row = box.row()
-        row.label(text="3. Change atom radii by scale")
-        row = box.row()
-        col = row.column()
-        col.prop(scn, "radius_all")
-        col = row.column(align=True)
-        col.operator( "atom_xyz.radius_all_bigger" )
-        col.operator( "atom_xyz.radius_all_smaller" )
-
-        if bpy.context.mode == 'EDIT_MESH':
-            layout.separator()
-            row = box.row()
-            row.operator( "atom_xyz.separate_atom" )
-
-        row = layout.row()
-        row.label(text="Loading frames")
-        box = layout.box()
-        row = box.row()
-        col = row.column()
-        col.label(text="Frames")
-        col = row.column()
-        col.prop(scn, "number_frames")
-        row = box.row()
-        col = row.column()
-        col.label(text="Skip frames")
-        col = row.column()
-        col.prop(scn, "skip_frames")
-        row = box.row()
-        col = row.column()
-        col.label(text="Frames/key")
-        col = row.column()
-        col.prop(scn, "images_per_key")        
-        row = box.row()
-        row.operator("atom_xyz.load_frames")
-        row = box.row()
-        row.operator("atom_xyz.delete_keys")
-        row = box.row()
-        row.operator( "atom_xyz.create_command")
-        row = box.row()
-        row.operator( "atom_xyz.render")
-
-
-class CLASS_atom_xyz_Properties(bpy.types.PropertyGroup):
-
-    def Callback_radius_type(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-        import_xyz.DEF_atom_xyz_radius_type(
-                scn.radius_type,
-                scn.radius_how,)
-
-    def Callback_radius_pm(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-        import_xyz.DEF_atom_xyz_radius_pm(
-                scn.radius_pm_name,
-                scn.radius_pm,
-                scn.radius_how,)
-
-    # In the file dialog window
-    use_camera = BoolProperty(
-        name="Camera", default=False,
-        description="Do you need a camera?")
-    use_lamp = BoolProperty(
-        name="Lamp", default=False,
-        description = "Do you need a lamp?")
-    use_mesh = BoolProperty(
-        name = "Mesh balls", default=False,
-        description = "Do you want to use mesh balls instead of NURBS?")
-    mesh_azimuth = IntProperty(
-        name = "Azimuth", default=32, min=0,
-        description = "Number of sectors (azimuth)")
-    mesh_zenith = IntProperty(
-        name = "Zenith", default=32, min=0,
-        description = "Number of sectors (zenith)")
-    scale_ballradius = FloatProperty(
-        name = "Balls", default=1.0, min=0.0,
-        description = "Scale factor for all atom radii")
-    scale_distances = FloatProperty (
-        name = "Distances", default=1.0, min=0.0,
-        description = "Scale factor for all distances")
-    use_center = BoolProperty(
-        name = "Object to origin (first frames)", default=False,
-        description = "Put the object into the global origin, the first frame only")           
-    use_center_all = BoolProperty(
-        name = "Object to origin (all frames)", default=True,
-        description = "Put the object into the global origin, all frames") 
-    atomradius = EnumProperty(
-        name="Type of radius",
-        description="Choose type of atom radius",
-        items=(('0', "Pre-defined", "Use pre-defined radii"),
-               ('1', "Atomic", "Use atomic radii"),
-               ('2', "van der Waals", "Use van der Waals radii")),
-               default='0',)
-    # In the panel, first part
-    datafile = StringProperty(
-        name = "", description="Path to your custom data file",
-        maxlen = 256, default = "", subtype='FILE_PATH')
-    XYZ_file = StringProperty(
-        name = "Path to file", default="",
-        description = "Path of the XYZ file")
-    number_atoms = StringProperty(name="",
-        default="Number", description = "This output shows "
-        "the number of atoms which have been loaded")
-    distance = StringProperty(
-        name="", default="Distance (A)",
-        description="Distance of 2 objects in Angstrom")
-    radius_how = EnumProperty(
-        name="",
-        description="Which objects shall be modified?",
-        items=(('ALL_ACTIVE',"all active objects", "in the current layer"),
-               ('ALL_IN_LAYER',"all"," in active layer(s)")),
-               default='ALL_ACTIVE',)
-    radius_type = EnumProperty(
-        name="Type",
-        description="Which type of atom radii?",
-        items=(('0',"predefined", "Use pre-defined radii"),
-               ('1',"atomic", "Use atomic radii"),
-               ('2',"van der Waals","Use van der Waals radii")),
-               default='0',update=Callback_radius_type)
-    radius_pm_name = StringProperty(
-        name="", default="Atom name",
-        description="Put in the name of the atom (e.g. Hydrogen)")
-    radius_pm = FloatProperty(
-        name="", default=100.0, min=0.0,
-        description="Put in the radius of the atom (in pm)",
-        update=Callback_radius_pm)
-    radius_all = FloatProperty(
-        name="Scale", default = 1.05, min=1.0, max=5.0,
-        description="Put in the scale factor")
-    # In the panel, second part
-    number_frames = StringProperty(
-        name="", default="0",
-        description="This is the total number of frames stored in the xyz file")
-    skip_frames = IntProperty(
-        name="", default=0, min=0,
-        description="Number of frames you want to skip.")
-    images_per_key = IntProperty(
-        name="", default=1, min=1,
-        description="Choose the number of images between 2 keys.")
-
-
-
-# Button for creating a file that contains the command for rendering
-class CLASS_atom_xyz_create_command(Operator):
-    bl_idname = "atom_xyz.create_command"
-    bl_label = "Create command"
-    bl_description = "Create a shell command for rendering the scene"
-
-    def execute(self, context):
-        global ATOM_XYZ_ERROR
-        global ATOM_XYZ_NOTE
- 
-        scn = bpy.context.scene
-
-        fstart = scn.frame_start
-        fend = scn.frame_end
-        file_blend = bpy.context.blend_data.filepath
-        
-        if file_blend == "":
-            ATOM_XYZ_ERROR = "Save your scene first !"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}
-            
-        cameras = []    
-        FOUND = False    
-        for obj in bpy.context.scene.objects:  
-            if obj.type == "CAMERA":
-                cameras.append(obj)
-                FOUND = True   
-        if FOUND == False:
-            ATOM_XYZ_ERROR = "No camera => no images !"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}      
-        if bpy.context.scene.camera == None:
-            bpy.context.scene.camera = cameras[0]
-            
-        KEYS_PRESENT = True
-        for element in import_xyz.STRUCTURE:
-            bpy.ops.object.select_all(action='DESELECT')
-            bpy.context.scene.objects.active = element
-            element.select = True
-            if element.data.shape_keys == None:
-                KEYS_PRESENT = False
-                break       
-        if KEYS_PRESENT == False:
-            ATOM_XYZ_ERROR = "No frames => no movie !"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}     
-        
-        bpy.ops.wm.save_mainfile()
-        file_name = bpy.path.basename(file_blend)
-        file_path = file_blend.replace(file_name,"")
-        file_movie = bpy.path.display_name_from_filepath(file_blend)
-        blender_exe = bpy.app.binary_path
-                
-        if os.name == "posix":
-            execute = (blender_exe+" -b \'"+file_blend+"\' -x 1 -o //"+file_movie+
-                  "_ -F AVIJPEG -s "+str(fstart)+" -e "+str(scn.frame_end)+" -a")
-        else:
-            execute = ("\""+blender_exe+"\" -b "+file_blend+" -x 1 -o //"+file_movie+
-                  "_ -F AVIJPEG -s "+str(fstart)+" -e "+str(scn.frame_end)+" -a")
-
-        if os.name == "posix":
-            command_file = file_path + file_movie + ".sh"
-        else:
-            command_file = file_path + file_movie + ".txt"
-        command_fp = open(command_file,"w")
-           
-        if os.name == "posix":        
-            command_fp.write("#!/bin/sh\n")   
-        command_fp.write("\n"+execute+"\n")     
-        command_fp.close()
-        
-        ATOM_XYZ_NOTE = "The command has been stored (dir. of the .blend file)"
-        bpy.ops.atom_xyz.note_dialog('INVOKE_DEFAULT')
-
-        return {'FINISHED'}
-
-
-# Button for rendering the scene in a terminal
-class CLASS_atom_xyz_render(Operator):
-    bl_idname = "atom_xyz.render"
-    bl_label = "Render"
-    bl_description = "Render the scene"
-
-    def execute(self, context):
-        global ATOM_XYZ_ERROR
-        scn = bpy.context.scene
-
-        fstart = scn.frame_start
-        fend = scn.frame_end
-        file_blend = bpy.context.blend_data.filepath
-        
-        if file_blend == "":
-            ATOM_XYZ_ERROR = "Save your scene first!"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}
-            
-        cameras = []    
-        FOUND = False    
-        for obj in bpy.context.scene.objects:  
-            if obj.type == "CAMERA":
-                cameras.append(obj)
-                FOUND = True   
-        if FOUND == False:
-            ATOM_XYZ_ERROR = "No camera => no images !"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}      
-        if bpy.context.scene.camera == None:
-            bpy.context.scene.camera = cameras[0]
-            
-            
-        KEYS_PRESENT = True
-        for element in import_xyz.STRUCTURE:
-            bpy.ops.object.select_all(action='DESELECT')
-            bpy.context.scene.objects.active = element
-            element.select = True
-            if element.data.shape_keys == None:
-                KEYS_PRESENT = False
-                break       
-        if KEYS_PRESENT == False:
-            ATOM_XYZ_ERROR = "No frames => no movie !"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}    
-            
-        bpy.ops.wm.save_mainfile()    
-        
-        file_name = bpy.path.basename(file_blend)
-        file_path = file_blend.replace(file_name,"")
-        file_movie = bpy.path.display_name_from_filepath(file_blend)
-        blender_exe = bpy.app.binary_path
- 
-        if os.name == "posix":
-            execute = (blender_exe+" -b \'"+file_blend+"\' -x 1 -o //"+file_movie+
-                  "_ -F AVIJPEG -s "+str(fstart)+" -e "+str(scn.frame_end)+" -a")
-            os_str = "xterm -e \"" + execute + "\" &"
-        else:
-            execute = ("\""+blender_exe+"\" -b "+file_blend+" -x 1 -o //"+file_movie+
-                  "_ -F AVIJPEG -s "+str(fstart)+" -e "+str(scn.frame_end)+" -a")
-            os_str = "C:\WINDOWS\system32\cmd.exe /C " + execute
-             
-        os.system(os_str)    
-        
-        return {'FINISHED'}
-
-
-# Button deleting all shape keys of the structure
-class CLASS_atom_xyz_delete_keys(Operator):
-    bl_idname = "atom_xyz.delete_keys"
-    bl_label = "Delete keys"
-    bl_description = "Delete the shape keys"
-
-    def execute(self, context):
-        for element in import_xyz.STRUCTURE:
-            if element.data.shape_keys == None:
-                break
-        
-            bpy.ops.object.select_all(action='DESELECT')
-            bpy.context.scene.objects.active = element
-            element.select = True
-        
-            for key in element.data.shape_keys.key_blocks:
-                bpy.ops.object.shape_key_remove()
-        
-        return {'FINISHED'}
-
-
-# Button loading the shape keys
-class CLASS_atom_xyz_load_frames(Operator):
-    bl_idname = "atom_xyz.load_frames"
-    bl_label = "Load frames"
-    bl_description = "Load the frames"
-
-    def execute(self, context):
-        global ATOM_XYZ_ERROR
-        scn = bpy.context.scene.atom_xyz[0]
-        
-        KEYS_PRESENT = False
-        for element in import_xyz.STRUCTURE:
-            bpy.ops.object.select_all(action='DESELECT')
-            bpy.context.scene.objects.active = element
-            element.select = True
-            if element.data.shape_keys != None:
-                KEYS_PRESENT = True
-                break
-                
-        if KEYS_PRESENT == True:
-            ATOM_XYZ_ERROR = "Delete first the keys"
-            bpy.ops.atom_xyz.error_dialog('INVOKE_DEFAULT')
-            return {'FINISHED'}
-        
-        
-        import_xyz.DEF_atom_xyz_build_frames(scn.images_per_key, 
-                                             scn.skip_frames)
-
-        return {'FINISHED'}
-
-
-
-# Button loading a custom data file
-class CLASS_atom_xyz_datafile_apply(Operator):
-    bl_idname = "atom_xyz.datafile_apply"
-    bl_label = "Apply"
-    bl_description = "Use color and radii values stored in the custom file"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-
-        if scn.datafile == "":
-            return {'FINISHED'}
-
-        import_xyz.DEF_atom_xyz_custom_datafile(scn.datafile)
-
-        # TODO, move this into 'import_xyz' and call the function
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                child = obj.children[0]
-                if child.type == "SURFACE" or child.type  == "MESH":
-                    for element in import_xyz.ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            child.scale = (element.radii[0],) * 3
-                            child.active_material.diffuse_color = element.color
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    for element in import_xyz.ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[0],) * 3
-                            obj.active_material.diffuse_color = element.color
-
-        return {'FINISHED'}
-
-
-# Button for separating a single atom from a structure
-class CLASS_atom_xyz_separate_atom(Operator):
-    bl_idname = "atom_xyz.separate_atom"
-    bl_label = "Separate atom"
-    bl_description = "Separate the atom you have chosen"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-
-        # Get first all important properties from the atom which the user
-        # has chosen: location, color, scale
-        obj = bpy.context.edit_object
-        name = obj.name
-        loc_obj_vec = obj.location
-        scale = obj.children[0].scale
-        material = obj.children[0].active_material
-
-        # Separate the vertex from the main mesh and create a new mesh.
-        bpy.ops.mesh.separate()
-        new_object = bpy.context.scene.objects[0]
-        # Keep in mind the coordinates <= We only need this
-        loc_vec = new_object.data.vertices[0].co
-
-        # And now, switch to the OBJECT mode such that we can ...
-        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-        # ... delete the new mesh including the separated vertex
-        bpy.ops.object.select_all(action='DESELECT')
-        new_object.select = True
-        bpy.ops.object.delete()
-
-        # Create a new atom/vacancy at the position of the old atom
-        current_layers=bpy.context.scene.layers
-
-        if "Vacancy" not in name:
-            if scn.use_mesh == False:
-                bpy.ops.surface.primitive_nurbs_surface_sphere_add(
-                                    view_align=False, enter_editmode=False,
-                                    location=loc_vec+loc_obj_vec,
-                                    rotation=(0.0, 0.0, 0.0),
-                                    layers=current_layers)
-            else:
-                bpy.ops.mesh.primitive_uv_sphere_add(
-                                segments=scn.mesh_azimuth,
-                                ring_count=scn.mesh_zenith,
-                                size=1, view_align=False, enter_editmode=False,
-                                location=loc_vec+loc_obj_vec,
-                                rotation=(0, 0, 0),
-                                layers=current_layers)
-        else:
-            bpy.ops.mesh.primitive_cube_add(
-                               view_align=False, enter_editmode=False,
-                               location=loc_vec+loc_obj_vec,
-                               rotation=(0.0, 0.0, 0.0),
-                               layers=current_layers)
-
-        new_atom = bpy.context.scene.objects.active
-        # Scale, material and name it.
-        new_atom.scale = scale
-        new_atom.active_material = material
-        new_atom.name = name + "_sep"
-
-        # Switch back into the 'Edit mode' because we would like to seprate
-        # other atoms may be (more convinient)
-        new_atom.select = False
-        obj.select = True
-        bpy.context.scene.objects.active = obj
-        bpy.ops.object.select_all(action='DESELECT')
-        bpy.ops.object.mode_set(mode='EDIT', toggle=False)
-
-        return {'FINISHED'}
-
-
-# Button for measuring the distance of the active objects
-class CLASS_atom_xyz_distance_button(Operator):
-    bl_idname = "atom_xyz.button_distance"
-    bl_label = "Measure ..."
-    bl_description = "Measure the distance between two objects"
-
-    def execute(self, context):
-        scn  = bpy.context.scene.atom_xyz[0]
-        dist = import_xyz.DEF_atom_xyz_distance()
-
-        if dist != "N.A.":
-           # The string length is cut, 3 digits after the first 3 digits
-           # after the '.'. Append also "Angstrom".
-           # Remember: 1 Angstrom = 10^(-10) m
-           pos    = str.find(dist, ".")
-           dist   = dist[:pos+4]
-           dist   = dist + " A"
-
-        # Put the distance into the string of the output field.
-        scn.distance = dist
-        return {'FINISHED'}
-
-
-# Button for increasing the radii of all atoms
-class CLASS_atom_xyz_radius_all_bigger_button(Operator):
-    bl_idname = "atom_xyz.radius_all_bigger"
-    bl_label = "Bigger ..."
-    bl_description = "Increase the radii of the atoms"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-        import_xyz.DEF_atom_xyz_radius_all(
-                scn.radius_all,
-                scn.radius_how,
-                )
-        return {'FINISHED'}
-
-
-# Button for decreasing the radii of all atoms
-class CLASS_atom_xyz_radius_all_smaller_button(Operator):
-    bl_idname = "atom_xyz.radius_all_smaller"
-    bl_label = "Smaller ..."
-    bl_description = "Decrease the radii of the atoms"
-
-    def execute(self, context):
-        scn = bpy.context.scene.atom_xyz[0]
-        import_xyz.DEF_atom_xyz_radius_all(
-                1.0/scn.radius_all,
-                scn.radius_how,
-                )
-        return {'FINISHED'}
-
-
-def DEF_panel_yes_no():
-    global ATOM_XYZ_PANEL
-
-    datafile_path = bpy.utils.user_resource('SCRIPTS', path='', create=False)
-    if os.path.isdir(datafile_path) == False:
-        bpy.utils.user_resource('SCRIPTS', path='', create=True)
-        
-    datafile_path = os.path.join(datafile_path, "presets")
-    if os.path.isdir(datafile_path) == False:
-        os.mkdir(datafile_path)   
-        
-    datafile = os.path.join(datafile_path, "io_mesh_xyz.pref")
-    if os.path.isfile(datafile):
-        datafile_fp = io.open(datafile, "r")
-        for line in datafile_fp:
-            if "Panel" in line:
-                ATOM_XYZ_PANEL = line[-2:]
-                ATOM_XYZ_PANEL = ATOM_XYZ_PANEL[0:1]
-                bpy.context.scene.use_panel = ATOM_XYZ_PANEL
-                break       
-        datafile_fp.close()
-    else:
-        DEF_panel_write_pref("0") 
-
-
-def DEF_panel_write_pref(value): 
-    datafile_path = bpy.utils.user_resource('SCRIPTS', path='', create=False)
-    datafile_path = os.path.join(datafile_path, "presets")
-    datafile = os.path.join(datafile_path, "io_mesh_xyz.pref")
-    datafile_fp = io.open(datafile, "w")
-    datafile_fp.write("Atomic Blender XYZ - Import/Export - Preferences\n")
-    datafile_fp.write("================================================\n")
-    datafile_fp.write("\n")
-    datafile_fp.write("Panel: "+value+"\n\n\n")
-    datafile_fp.close()
-
-
-class CLASS_atom_xyz_error_dialog(bpy.types.Operator):
-    bl_idname = "atom_xyz.error_dialog"
-    bl_label = "Attention !"
-    
-    def draw(self, context):
-        layout = self.layout
-        row = layout.row()
-        row.label(text="                          "+ATOM_XYZ_ERROR) 
-    def execute(self, context):
-        print("Atomic Blender - Error: "+ATOM_XYZ_ERROR+"\n")
-        return {'FINISHED'}
-    def invoke(self, context, event):
-        return context.window_manager.invoke_props_dialog(self)
-
-
-class CLASS_atom_xyz_note_dialog(bpy.types.Operator):
-    bl_idname = "atom_xyz.note_dialog"
-    bl_label = "Attention !"
-    
-    def draw(self, context):
-        layout = self.layout
-        row = layout.row()
-        row.label(text=ATOM_XYZ_NOTE) 
-    def execute(self, context):
-        print("Atomic Blender - Note: "+ATOM_XYZ_NOTE+"\n")
-        return {'FINISHED'}
-    def invoke(self, context, event):
-        return context.window_manager.invoke_props_dialog(self)
-
 
 # This is the class for the file dialog.
-class CLASS_ImportXYZ(Operator, ImportHelper):
+class ImportXYZ(Operator, ImportHelper):
     bl_idname = "import_mesh.xyz"
     bl_label  = "Import XYZ (*.xyz)"
     bl_options = {'PRESET', 'UNDO'}
@@ -702,22 +74,19 @@ class CLASS_ImportXYZ(Operator, ImportHelper):
     filename_ext = ".xyz"
     filter_glob  = StringProperty(default="*.xyz", options={'HIDDEN'},)
 
-    bpy.types.Scene.use_panel = EnumProperty(
-        name="Panel",
-        description="Choose whether the panel shall appear or not in the View 3D.",
-        items=(('0', "Once", "The panel appears only in this session"),
-               ('1', "Always", "The panel always appears when Blender is started"),
-               ('2', "Never", "The panel never appears")),
-               default='0') 
     use_camera = BoolProperty(
         name="Camera", default=False,
         description="Do you need a camera?")
     use_lamp = BoolProperty(
         name="Lamp", default=False,
         description = "Do you need a lamp?")
-    use_mesh = BoolProperty(
-        name = "Mesh balls", default=False,
-        description = "Use mesh balls instead of NURBS")
+    ball = EnumProperty(
+        name="Type of ball",
+        description="Choose ball",
+        items=(('0', "NURBS", "NURBS balls"),
+               ('1', "Mesh" , "Mesh balls"),
+               ('2', "Meta" , "Metaballs")),
+               default='0',) 
     mesh_azimuth = IntProperty(
         name = "Azimuth", default=32, min=1,
         description = "Number of sectors (azimuth)")
@@ -746,6 +115,15 @@ class CLASS_ImportXYZ(Operator, ImportHelper):
     datafile = StringProperty(
         name = "", description="Path to your custom data file",
         maxlen = 256, default = "", subtype='FILE_PATH')    
+    use_frames = BoolProperty(
+        name = "Load all frames?", default=False,
+        description = "Do you want to load all frames?") 
+    skip_frames = IntProperty(
+        name="", default=0, min=0,
+        description="Number of frames you want to skip.")
+    images_per_key = IntProperty(
+        name="", default=1, min=1,
+        description="Choose the number of images between 2 keys.")
 
     def draw(self, context):
         layout = self.layout
@@ -754,8 +132,10 @@ class CLASS_ImportXYZ(Operator, ImportHelper):
         row.prop(self, "use_lamp")
         row = layout.row()
         col = row.column()
-        col.prop(self, "use_mesh")
-        col = row.column(align=True)
+        col.prop(self, "ball")
+        row = layout.row()
+        row.active = (self.ball == "1")
+        col = row.column(align=True)        
         col.prop(self, "mesh_azimuth")
         col.prop(self, "mesh_zenith")
         row = layout.row()
@@ -770,23 +150,34 @@ class CLASS_ImportXYZ(Operator, ImportHelper):
         row.prop(self, "use_center_all")
         row = layout.row()
         row.prop(self, "atomradius")
+        
         row = layout.row()
-        row.prop(bpy.context.scene, "use_panel")
-
-    def execute(self, context):
+        row.prop(self, "use_frames")        
+        row = layout.row()        
+        row.active = self.use_frames        
+        col = row.column()
+        col.label(text="Skip frames")
+        col = row.column()
+        col.prop(self, "skip_frames")
+        row = layout.row()
+        row.active = self.use_frames
+        col = row.column()
+        col.label(text="Frames/key")
+        col = row.column()
+        col.prop(self, "images_per_key")            
         
-        import_xyz.ALL_FRAMES[:] = []
-        import_xyz.NUMBER_FRAMES = 0
-        import_xyz.ATOM_XYZ_ELEMENTS[:] = []
-        import_xyz.ATOM_XYZ_FILEPATH = ""
-        import_xyz.STRUCTURE[:] = []
+    def execute(self, context):
+
+        del import_xyz.ALL_FRAMES[:]
+        del import_xyz.ELEMENTS[:]
+        del import_xyz.STRUCTURE[:]
 
-        # This is in order to solve this strange 'relative path' thing.
-        import_xyz.ATOM_XYZ_FILEPATH = bpy.path.abspath(self.filepath)
+        # This is to determine the path.
+        filepath_xyz = bpy.path.abspath(self.filepath)
 
         # Execute main routine
-        atom_number = import_xyz.DEF_atom_xyz_main(
-                      self.use_mesh,
+        import_xyz.import_xyz(
+                      self.ball,
                       self.mesh_azimuth,
                       self.mesh_zenith,
                       self.scale_ballradius,
@@ -796,48 +187,63 @@ class CLASS_ImportXYZ(Operator, ImportHelper):
                       self.use_center_all,
                       self.use_camera,
                       self.use_lamp,
-                      self.datafile)
-                      
-        # Copy the whole bunch of values into the property collection.
-        scn = context.scene.atom_xyz[0]
-        scn.use_mesh = self.use_mesh
-        scn.mesh_azimuth = self.mesh_azimuth
-        scn.mesh_zenith = self.mesh_zenith
-        scn.scale_ballradius = self.scale_ballradius
-        scn.atomradius = self.atomradius
-        scn.scale_distances = self.scale_distances
-        scn.use_center = self.use_center
-        scn.use_center_all = self.use_center_all
-        scn.use_camera = self.use_camera
-        scn.use_lamp = self.use_lamp
-        scn.datafile = self.datafile              
-                      
-        scn.number_atoms = str(atom_number) + " atoms"
-        scn.number_frames = str(import_xyz.NUMBER_FRAMES)
-        scn.XYZ_file = import_xyz.ATOM_XYZ_FILEPATH
+                      filepath_xyz)   
 
-        global ATOM_XYZ_PANEL
-        ATOM_XYZ_PANEL = bpy.context.scene.use_panel
-        DEF_panel_write_pref(bpy.context.scene.use_panel)
+        # Load frames                  
+        if len(import_xyz.ALL_FRAMES) > 1 and self.use_frames:  
+                  
+            import_xyz.build_frames(self.images_per_key, 
+                                    self.skip_frames)
         
         return {'FINISHED'}
         
 
+# This is the class for the file dialog of the exporter.
+class ExportXYZ(Operator, ExportHelper):
+    bl_idname = "export_mesh.xyz"
+    bl_label  = "Export XYZ (*.xyz)"
+    filename_ext = ".xyz"
+
+    filter_glob  = StringProperty(
+        default="*.xyz", options={'HIDDEN'},)
+
+    atom_xyz_export_type = EnumProperty(
+        name="Type of Objects",
+        description="Choose type of objects",
+        items=(('0', "All", "Export all active objects"),
+               ('1', "Elements", "Export only those active objects which have"
+                                 " a proper element name")),
+               default='1',) 
+
+    def draw(self, context):
+        layout = self.layout
+        row = layout.row()
+        row.prop(self, "atom_xyz_export_type")
+
+    def execute(self, context):
+        export_xyz.export_xyz(self.atom_xyz_export_type, 
+                              bpy.path.abspath(self.filepath))
+
+        return {'FINISHED'}
+
+
 # The entry into the menu 'file -> import'
 def menu_func(self, context):
-    self.layout.operator(CLASS_ImportXYZ.bl_idname, text="XYZ (.xyz)")
+    self.layout.operator(ImportXYZ.bl_idname, text="XYZ (.xyz)")
 
+# The entry into the menu 'file -> export'
+def menu_func_export(self, context):
+    self.layout.operator(ExportXYZ.bl_idname, text="XYZ (.xyz)")
 
 def register():
-    DEF_panel_yes_no()
     bpy.utils.register_module(__name__)
     bpy.types.INFO_MT_file_import.append(menu_func)
-    bpy.types.Scene.atom_xyz = bpy.props.CollectionProperty(type=CLASS_atom_xyz_Properties)    
-    bpy.context.scene.atom_xyz.add()
+    bpy.types.INFO_MT_file_export.append(menu_func_export) 
     
 def unregister():
     bpy.utils.unregister_module(__name__)
     bpy.types.INFO_MT_file_import.remove(menu_func)
+    bpy.types.INFO_MT_file_export.remove(menu_func_export)
 
 if __name__ == "__main__":
 
diff --git a/release/scripts/addons_contrib/io_mesh_xyz/export_xyz.py b/release/scripts/addons_contrib/io_mesh_xyz/export_xyz.py
new file mode 100644
index 0000000..093d6e9
--- /dev/null
+++ b/release/scripts/addons_contrib/io_mesh_xyz/export_xyz.py
@@ -0,0 +1,85 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+from . import import_xyz
+
+
+class AtomsExport(object):  
+    __slots__ = ('element', 'location')
+    def __init__(self, element, location):
+        self.element  = element
+        self.location = location
+
+
+def export_xyz(obj_type, filepath_xyz):
+
+    list_atoms = []
+    counter = 0
+    for obj in bpy.context.selected_objects:
+    
+        if "Stick" in obj.name:
+            continue
+            
+        if obj.type not in {'MESH', 'SURFACE', 'META'}:
+            continue 
+       
+        name = ""
+        for element in import_xyz.ELEMENTS_DEFAULT:
+            if element[1] in obj.name:
+                if element[2] == "Vac":
+                    name = "X"
+                else:
+                    name = element[2]
+        
+        if name == "":
+            if obj_type == "0":
+                name = "?"
+            else:
+                continue
+
+        if len(obj.children) != 0:
+            for vertex in obj.data.vertices:
+                location = obj.matrix_world*vertex.co
+                list_atoms.append(AtomsExport(name, location))
+                counter += 1                                       
+        else:
+            if not obj.parent:
+                location = obj.location
+                list_atoms.append(AtomsExport(name, location))                                   
+                counter += 1                                               
+
+    xyz_file_p = open(filepath_xyz, "w")
+    xyz_file_p.write("%d\n" % counter)
+    xyz_file_p.write("This XYZ file has been created with Blender "
+                     "and the addon Atomic Blender - XYZ. "
+                     "For more details see: wiki.blender.org/index.php/"
+                     "Extensions:2.6/Py/Scripts/Import-Export/XYZ\n")
+
+    for i, atom in enumerate(list_atoms):
+        string = "%3s%15.5f%15.5f%15.5f\n" % (
+                                      atom.element,
+                                      atom.location[0],
+                                      atom.location[1],
+                                      atom.location[2])
+        xyz_file_p.write(string)
+
+    xyz_file_p.close()
+
+    return True
+
diff --git a/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py b/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py
index 200e6db..9a575f2 100644
--- a/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py
+++ b/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py
@@ -17,24 +17,9 @@
 # ##### END GPL LICENSE BLOCK #####
 
 import bpy
-import io
-import math
-import os
-from math import pi, cos, sin
+from math import pi, sqrt
 from mathutils import Vector, Matrix
 
-# These are variables, which contain the name of the XYZ file and
-# the path of the XYZ file.
-# They are used almost everywhere, which is the reason why they
-# should stay global. First, they are empty and get 'filled' directly
-# after having chosen the XYZ file (see 'class LoadXYZ' further below).
-
-ATOM_XYZ_FILEPATH = ""
-
-# Some string stuff for the console.
-ATOM_XYZ_STRING = "Atomic Blender\n==================="
-
-
 # -----------------------------------------------------------------------------
 #                                                  Atom and element data
 
@@ -50,7 +35,7 @@ ATOM_XYZ_STRING = "Atomic Blender\n==================="
 # charge states for any atom are listed, if existing.
 # The list is fixed and cannot be changed ... (see below)
 
-ATOM_XYZ_ELEMENTS_DEFAULT = (
+ELEMENTS_DEFAULT = (
 ( 1,      "Hydrogen",        "H", (  1.0,   1.0,   1.0), 0.32, 0.32, 0.79 , -1 , 1.54 ),
 ( 2,        "Helium",       "He", ( 0.85,   1.0,   1.0), 0.93, 0.93, 0.49 ),
 ( 3,       "Lithium",       "Li", (  0.8,  0.50,   1.0), 1.23, 1.23, 2.05 ,  1 , 0.68 ),
@@ -162,23 +147,23 @@ ATOM_XYZ_ELEMENTS_DEFAULT = (
 # This list here contains all data of the elements and will be used during
 # runtime. It is a list of classes.
 # During executing Atomic Blender, the list will be initialized with the fixed
-# data from above via the class structure below (CLASS_atom_xyz_Elements). We
+# data from above via the class structure below (ElementProp). We
 # have then one fixed list (above), which will never be changed, and a list of
 # classes with same data. The latter can be modified via loading a separate
 # custom data file for instance.
-ATOM_XYZ_ELEMENTS = []
+ELEMENTS = []
 
 # This is the list, which contains all atoms of all frames! Each item is a 
 # list which contains the atoms of a single frame. It is a list of  
-# 'CLASS_atom_xyz_atom'.
+# 'AtomProp'.
 ALL_FRAMES = []
-NUMBER_FRAMES = 0
 
 # A list of ALL balls which are put into the scene
 STRUCTURE = []
 
+
 # This is the class, which stores the properties for one element.
-class CLASS_atom_xyz_Elements(object):
+class ElementProp(object):
     __slots__ = ('number', 'name', 'short_name', 'color', 'radii', 'radii_ionic')
     def __init__(self, number, name, short_name, color, radii, radii_ionic):
         self.number = number
@@ -189,7 +174,7 @@ class CLASS_atom_xyz_Elements(object):
         self.radii_ionic = radii_ionic
 
 # This is the class, which stores the properties of one atom.
-class CLASS_atom_xyz_atom(object):  
+class AtomProp(object):  
     __slots__ = ('element', 'name', 'location', 'radius', 'color', 'material')
     def __init__(self, element, name, location, radius, color, material):
         self.element = element
@@ -198,147 +183,16 @@ class CLASS_atom_xyz_atom(object):
         self.radius = radius
         self.color = color
         self.material = material
-        
-
-# -----------------------------------------------------------------------------
-#                                                          Some small routines
-
 
 
-# This function measures the distance between two objects (atoms),
-# which are active.
-def DEF_atom_xyz_distance():
+# -----------------------------------------------------------------------------
+#                                                           Some basic routines        
 
-    if len(bpy.context.selected_bases) > 1:
-        object_1 = bpy.context.selected_objects[0]
-        object_2 = bpy.context.selected_objects[1]
-    else:
-        return "N.A."
+def read_elements():
 
-    dv = object_2.location - object_1.location
-    return str(dv.length)
+    del ELEMENTS[:]
 
-
-# Routine to modify the radii via the type:
-#
-#        pre-defined, atomic or van der Waals
-#
-# Explanations here are also valid for the next 3 DEFs.
-def DEF_atom_xyz_radius_type(rtype,how):
-
-    if how == "ALL_IN_LAYER":
-
-        # Note all layers that are active.
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-        # Put all objects, which are in the layers, into a list.
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-        # Consider all objects, which are in the list 'change_objects'.
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    for element in ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.children[0].scale = (element.radii[int(rtype)],) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    for element in ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[int(rtype)],) * 3
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    for element in ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.children[0].scale = (element.radii[int(rtype)],) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    for element in ATOM_XYZ_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[int(rtype)],) * 3
-
-
-# Routine to modify the radii in picometer of a specific type of atom
-def DEF_atom_xyz_radius_pm(atomname, radius_pm, how):
-
-    if how == "ALL_IN_LAYER":
-
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if atomname in obj.name:
-                        obj.children[0].scale = (radius_pm/100,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if atomname in obj.name:
-                        obj.scale = (radius_pm/100,) * 3
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    if atomname in obj.name:
-                        obj.children[0].scale = (radius_pm/100,) * 3
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    if atomname in obj.name:
-                        obj.scale = (radius_pm/100,) * 3
-
-
-# Routine to scale the radii of all atoms
-def DEF_atom_xyz_radius_all(scale, how):
-
-    if how == "ALL_IN_LAYER":
-
-        layers = []
-        for i in range(20):
-            if bpy.context.scene.layers[i] == True:
-                layers.append(i)
-        change_objects = []
-        for obj in bpy.context.scene.objects:
-            for layer in layers:
-                if obj.layers[layer] == True:
-                    change_objects.append(obj)
-        for obj in change_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    obj.children[0].scale *= scale
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    obj.scale *= scale
-
-    if how == "ALL_ACTIVE":
-        for obj in bpy.context.selected_objects:
-            if len(obj.children) != 0:
-                if obj.children[0].type == "SURFACE" or obj.children[0].type  == "MESH":
-                    obj.children[0].scale *= scale
-            else:
-                if obj.type == "SURFACE" or obj.type == "MESH":
-                    obj.scale *= scale
-
-
-def DEF_atom_xyz_read_elements():
-
-    ATOM_XYZ_ELEMENTS[:] = []
-
-    for item in ATOM_XYZ_ELEMENTS_DEFAULT:
+    for item in ELEMENTS_DEFAULT:
 
         # All three radii into a list
         radii = [item[4],item[5],item[6]]
@@ -346,21 +200,26 @@ def DEF_atom_xyz_read_elements():
         # empty list.
         radii_ionic = []
 
-        li = CLASS_atom_xyz_Elements(item[0],item[1],item[2],item[3],
+        li = ElementProp(item[0],item[1],item[2],item[3],
                                      radii,radii_ionic)
-        ATOM_XYZ_ELEMENTS.append(li)
+        ELEMENTS.append(li)
 
 
-def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
+# filepath_pdb: path to pdb file
+# radiustype  : '0' default
+#               '1' atomic radii
+#               '2' van der Waals
+def read_xyz_file(filepath_xyz,radiustype):
 
-    global NUMBER_FRAMES
+    number_frames = 0
+    total_number_atoms = 0
 
     # Open the file ...
-    ATOM_XYZ_FILEPATH_p = io.open(ATOM_XYZ_FILEPATH, "r")
+    filepath_xyz_p = open(filepath_xyz, "r")
 
     #Go through the whole file.
     FLAG = False
-    for line in ATOM_XYZ_FILEPATH_p:
+    for line in filepath_xyz_p:
 
         # ... the loop is broken here (EOF) ...
         if line == "":
@@ -370,12 +229,11 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
 
         if len(split_list) == 1:
             number_atoms = int(split_list[0])
-            #print(number_atoms)
             FLAG = True
             
         if FLAG == True:
         
-            line = ATOM_XYZ_FILEPATH_p.readline()
+            line = filepath_xyz_p.readline()
             line = line.rstrip()
             
             all_atoms= []
@@ -390,19 +248,19 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                 # is used.
                 # By time, I will allow varying atom numbers ... but this takes 
                 # some time ...            
-                if NUMBER_FRAMES != 0:
+                if number_frames != 0:
                     if i >= total_number_atoms:
                         break
                         
        
-                line = ATOM_XYZ_FILEPATH_p.readline()
+                line = filepath_xyz_p.readline()
                 line = line.rstrip()
                 split_list = line.rsplit()
                 short_name = str(split_list[0])
                      
                 # Go through all elements and find the element of the current atom.
                 FLAG_FOUND = False
-                for element in ATOM_XYZ_ELEMENTS:
+                for element in ELEMENTS:
                     if str.upper(short_name) == str.upper(element.short_name):
                         # Give the atom its proper name, color and radius:
                         name = element.name
@@ -420,15 +278,15 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                     if "X" in short_name:
                         short_name = "VAC"
                         name = "Vacancy"
-                        radius = float(ATOM_XYZ_ELEMENTS[-3].radii[int(radiustype)])
-                        color = ATOM_XYZ_ELEMENTS[-3].color
+                        radius = float(ELEMENTS[-3].radii[int(radiustype)])
+                        color = ELEMENTS[-3].color
                     # ... take what is written in the xyz file. These are somewhat
                     # unknown atoms. This should never happen, the element list is
                     # almost complete. However, we do this due to security reasons.
                     else:
                         name = str.upper(short_name)
-                        radius = float(ATOM_XYZ_ELEMENTS[-2].radii[int(radiustype)])
-                        color = ATOM_XYZ_ELEMENTS[-2].color
+                        radius = float(ELEMENTS[-2].radii[int(radiustype)])
+                        color = ELEMENTS[-2].color
               
                 x = float(split_list[1])
                 y = float(split_list[2])
@@ -439,7 +297,7 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                 all_atoms.append([short_name, name, location, radius, color])
             
             # We note here all elements. This needs to be done only once. 
-            if NUMBER_FRAMES == 0:
+            if number_frames == 0:
             
                 # This is a guarantee that only the total number of atoms of the
                 # first frame is used. Condition is, so far, that the number of
@@ -473,103 +331,36 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                 atoms_one_type = []
                 for atom in all_atoms:
                     if atom[1] == element:
-                        atoms_one_type.append(CLASS_atom_xyz_atom(
-                                                           atom[0],
-                                                           atom[1],
-                                                           atom[2],
-                                                           atom[3],
-                                                           atom[4],[]))
+                        atoms_one_type.append(AtomProp(atom[0],
+                                                       atom[1],
+                                                       atom[2],
+                                                       atom[3],
+                                                       atom[4],[]))
                 structure.append(atoms_one_type)
 
             ALL_FRAMES.append(structure)
-            NUMBER_FRAMES += 1
+            number_frames += 1
             FLAG = False
 
-    ATOM_XYZ_FILEPATH_p.close()
+    filepath_xyz_p.close()
     
-    """
-    for frame in ALL_FRAMES:
-        for element in frame:
-            for atom in element:
-                print(atom.element + "	" + str(atom.location))
-        print()    
-    """
     return total_number_atoms
 
 
-# This reads a custom data file.
-def DEF_atom_xyz_custom_datafile(path_datafile):
-
-    if path_datafile == "":
-        return False
-
-    path_datafile = bpy.path.abspath(path_datafile)
-
-    if os.path.isfile(path_datafile) == False:
-        return False
-
-    # The whole list gets deleted! We build it new.
-    ATOM_XYZ_ELEMENTS[:] = []
-
-    # Read the data file, which contains all data
-    # (atom name, radii, colors, etc.)
-    data_file_p = io.open(path_datafile, "r")
-
-    for line in data_file_p:
-
-        if "Atom" in line:
-
-            line = data_file_p.readline()
-            # Number
-            line = data_file_p.readline()
-            number = line[19:-1]
-            # Name
-            line = data_file_p.readline()
-            name = line[19:-1]
-            # Short name
-            line = data_file_p.readline()
-            short_name = line[19:-1]
-            # Color
-            line = data_file_p.readline()
-            color_value = line[19:-1].split(',')
-            color = [float(color_value[0]),
-                     float(color_value[1]),
-                     float(color_value[2])]
-            # Used radius
-            line = data_file_p.readline()
-            radius_used = float(line[19:-1])
-            # Atomic radius
-            line = data_file_p.readline()
-            radius_atomic = float(line[19:-1])
-            # Van der Waals radius
-            line = data_file_p.readline()
-            radius_vdW = float(line[19:-1])
-            radii = [radius_used,radius_atomic,radius_vdW]
-            radii_ionic = []
-
-            element = CLASS_atom_xyz_Elements(number,name,short_name,color,
-                                              radii, radii_ionic)
-
-            ATOM_XYZ_ELEMENTS.append(element)
-
-    data_file_p.close()
-
-    return True
-
 # -----------------------------------------------------------------------------
 #                                                            The main routine
 
-def DEF_atom_xyz_main(use_mesh,
-                      Ball_azimuth,
-                      Ball_zenith,
-                      Ball_radius_factor,
-                      radiustype,
-                      Ball_distance_factor,
-                      put_to_center, 
-                      put_to_center_all,
-                      use_camera,
-                      use_lamp,
-                      path_datafile):
+def import_xyz(Ball_type,
+               Ball_azimuth,
+               Ball_zenith,
+               Ball_radius_factor,
+               radiustype,
+               Ball_distance_factor,
+               put_to_center, 
+               put_to_center_all,
+               use_camera,
+               use_lamp,
+               filepath_xyz):
 
     # List of materials
     atom_material_list = []
@@ -577,12 +368,12 @@ def DEF_atom_xyz_main(use_mesh,
     # ------------------------------------------------------------------------
     # INITIALIZE THE ELEMENT LIST
 
-    DEF_atom_xyz_read_elements()
+    read_elements()
 
     # ------------------------------------------------------------------------
     # READING DATA OF ATOMS
 
-    Number_of_total_atoms = DEF_atom_xyz_read_xyz_file(ATOM_XYZ_FILEPATH, 
+    Number_of_total_atoms = read_xyz_file(filepath_xyz, 
                                                        radiustype)
                                                
     # We show the atoms of the first frame.
@@ -721,25 +512,23 @@ def DEF_atom_xyz_main(use_mesh,
 
         # Assume that the object is put into the global origin. Then, the
         # camera is moved in x and z direction, not in y. The object has its
-        # size at distance math.sqrt(object_size) from the origin. So, move the
+        # size at distance sqrt(object_size) from the origin. So, move the
         # camera by this distance times a factor of camera_factor in x and z.
         # Then add x, y and z of the origin of the object.
-        object_camera_vec = Vector((math.sqrt(object_size) * camera_factor,
+        object_camera_vec = Vector((sqrt(object_size) * camera_factor,
                                     0.0,
-                                    math.sqrt(object_size) * camera_factor))
+                                    sqrt(object_size) * camera_factor))
         camera_xyz_vec = object_center_vec + object_camera_vec
 
         # Create the camera
-        current_layers=bpy.context.scene.layers
-        bpy.ops.object.camera_add(view_align=False, enter_editmode=False,
-                               location=camera_xyz_vec,
-                               rotation=(0.0, 0.0, 0.0), layers=current_layers)
-        # Some properties of the camera are changed.
-        camera = bpy.context.scene.objects.active
-        camera.name = "A_camera"
-        camera.data.name = "A_camera"
-        camera.data.lens = 45
-        camera.data.clip_end = 500.0
+        current_layers=bpy.context.scene.layers 
+        camera_data = bpy.data.cameras.new("A_camera")
+        camera_data.lens = 45
+        camera_data.clip_end = 500.0
+        camera = bpy.data.objects.new("A_camera", camera_data)
+        camera.location = camera_xyz_vec
+        camera.layers = current_layers
+        bpy.context.scene.objects.link(camera) 
 
         # Here the camera is rotated such it looks towards the center of
         # the object. The [0.0, 0.0, 1.0] vector along the z axis
@@ -750,12 +539,13 @@ def DEF_atom_xyz_main(use_mesh,
         axis_vec               = z_axis_vec.cross(object_camera_vec)
         # Rotate 'axis_vec' by 'angle' and convert this to euler parameters.
         # 4 is the size of the matrix.
-        euler                  = Matrix.Rotation(angle, 4, axis_vec).to_euler()
-        camera.rotation_euler  = euler
+        camera.rotation_euler  = Matrix.Rotation(angle, 4, axis_vec).to_euler()
 
         # Rotate the camera around its axis by 90° such that we have a nice
         # camera position and view onto the object.
-        bpy.ops.transform.rotate(value=(90.0*2*math.pi/360.0,),
+        bpy.ops.object.select_all(action='DESELECT')        
+        camera.select = True         
+        bpy.ops.transform.rotate(value=(90.0*2*pi/360.0),
                                  axis=object_camera_vec,
                                  constraint_axis=(False, False, False),
                                  constraint_orientation='GLOBAL',
@@ -766,18 +556,12 @@ def DEF_atom_xyz_main(use_mesh,
                                  snap_align=False, snap_normal=(0, 0, 0),
                                  release_confirm=False)
 
-        # This does not work, I don't know why.
-        #
-        #for area in bpy.context.screen.areas:
-        #    if area.type == 'VIEW_3D':
-        #        area.spaces[0].region_3d.view_perspective = 'CAMERA'
-
     # Here a lamp is put into the scene, if chosen.
     if use_lamp == True:
 
         # This is the distance from the object measured in terms of %
         # of the camera distance. It is set onto 50% (1/2) distance.
-        lamp_dl = math.sqrt(object_size) * 15 * 0.5
+        lamp_dl = sqrt(object_size) * 15 * 0.5
         # This is a factor to which extend the lamp shall go to the right
         # (from the camera  point of view).
         lamp_dy_right = lamp_dl * (3.0/4.0)
@@ -788,33 +572,18 @@ def DEF_atom_xyz_main(use_mesh,
 
         # Create the lamp
         current_layers=bpy.context.scene.layers
-        bpy.ops.object.lamp_add (type = 'POINT', view_align=False,
-                                 location=lamp_xyz_vec,
-                                 rotation=(0.0, 0.0, 0.0),
-                                 layers=current_layers)
-        # Some properties of the lamp are changed.
-        lamp = bpy.context.scene.objects.active
-        lamp.data.name = "A_lamp"
-        lamp.name = "A_lamp"
-        lamp.data.distance = 500.0
-        lamp.data.energy = 3.0
-        lamp.data.shadow_method = 'RAY_SHADOW'
+        lamp_data = bpy.data.lamps.new(name="A_lamp", type="POINT")
+        lamp_data.distance = 500.0
+        lamp_data.energy = 3.0
+        lamp_data.shadow_method = 'RAY_SHADOW'        
+        lamp = bpy.data.objects.new("A_lamp", lamp_data)
+        lamp.location = lamp_xyz_vec
+        lamp.layers = current_layers
+        bpy.context.scene.objects.link(lamp)         
 
         bpy.context.scene.world.light_settings.use_ambient_occlusion = True
         bpy.context.scene.world.light_settings.ao_factor = 0.2
-
-    # ------------------------------------------------------------------------
-    # SOME OUTPUT ON THE CONSOLE
-
-    print()
-    print()
-    print()
-    print(ATOM_XYZ_STRING)
-    print()
-    print("Total number of atoms       : " + str(Number_of_total_atoms))
-    print("Center of object (Angstrom) : ", object_center_vec)
-    print("Size of object (Angstrom)   : ", object_size)
-    print()
+        
 
     # ------------------------------------------------------------------------
     # DRAWING THE ATOMS
@@ -851,18 +620,23 @@ def DEF_atom_xyz_main(use_mesh,
                             layers=current_layers)
         else:
             # NURBS balls
-            if use_mesh == False:
+            if Ball_type == "0":
                 bpy.ops.surface.primitive_nurbs_surface_sphere_add(
                             view_align=False, enter_editmode=False,
                             location=(0,0,0), rotation=(0.0, 0.0, 0.0),
                             layers=current_layers)
             # UV balls
-            else:
+            elif Ball_type == "1":
                 bpy.ops.mesh.primitive_uv_sphere_add(
                             segments=Ball_azimuth, ring_count=Ball_zenith,
                             size=1, view_align=False, enter_editmode=False,
                             location=(0,0,0), rotation=(0, 0, 0),
                             layers=current_layers)
+            # Meta balls
+            elif Ball_type == "2":
+                bpy.ops.object.metaball_add(type='BALL', view_align=False, 
+                            enter_editmode=False, location=(0, 0, 0), 
+                            rotation=(0, 0, 0), layers=current_layers)
 
         ball = bpy.context.scene.objects.active
         ball.scale  = (atom.radius*Ball_radius_factor,) * 3
@@ -878,8 +652,6 @@ def DEF_atom_xyz_main(use_mesh,
         new_atom_mesh.location = object_center_vec
         STRUCTURE.append(new_atom_mesh)
 
-    print()
-
     # ------------------------------------------------------------------------
     # SELECT ALL LOADED OBJECTS
     
@@ -890,16 +662,12 @@ def DEF_atom_xyz_main(use_mesh,
     # activate the last selected object (perhaps another should be active?)
     if obj:
         bpy.context.scene.objects.active = obj
-    print("\n\nAll atoms (%d) have been drawn - finished.\n\n"
-           % (Number_of_total_atoms))
 
-    return Number_of_total_atoms
-    
 
-def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
+
+def build_frames(frame_delta, frame_skip):
 
     scn = bpy.context.scene
-    current_layers = scn.layers
 
     # Introduce the basis for all elements that appear in the structure.     
     for element in STRUCTURE:
@@ -907,7 +675,7 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
         bpy.ops.object.select_all(action='DESELECT')   
         bpy.context.scene.objects.active = element
         element.select = True
-        bpy.ops.object.shape_key_add(None)
+        bpy.ops.object.shape_key_add(True)
         
     frame_skip += 1    
 
@@ -946,6 +714,8 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
         element.data.shape_keys.key_blocks[2].keyframe_insert("value")         
 
         scn.frame_current += frame_delta
+
+        number = 0
     
         for number in range(num_frames)[2:]:#-1]:
     
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/__README__.txt b/release/scripts/addons_contrib/io_scene_ms3d/__README__.txt
index 4a291c7..d0d9c00 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/__README__.txt
+++ b/release/scripts/addons_contrib/io_scene_ms3d/__README__.txt
@@ -73,23 +73,17 @@ ms3d_strings.py     : most of the strings used in the addon to have a
 
 known issues:
   importer issues:
-    - does not import keyframes
+    -/-
 
   exporter issues:
-    - does only export the first existing material, if more than one material
-            is used per mesh
+    - does only export active mesh object
     - does only export the first existing UV texture coordinates,
             if more than one UV texture is used per mesh
-    - does not export bones
-    - does not export joints
-    - does not export keyframes
-    - does not export comments (will never be supported - blender doesn't
-            have similar stuff)
 
 
-todo:
-- add support for bones and joints in exporter
-- add support for keyframes
+todo / nice to have:
+    - export options to ms3d joints/animation/extra parts optional
+
 
 ###############################################################################
     exporter:
@@ -97,61 +91,61 @@ todo:
             .vertices
                 Ms3dVertex
                     .vertex: 100%
-                    .bone_id: 0%
-                    .reference_count: 0%
+                    .bone_id: 100%
+                    .reference_count: 100%
                     .flags: 0%
                     .vertex_ex
                         Ms3dVertexEx
-                            .bone_ids: 0%
-                            .weights: 0%
-                            .extra: 0%
+                            .bone_ids: 100%
+                            .weights: 100%
+                            .extra: 100% (not exposed to UI)
             .triangles
                 Ms3dTriangle
                     .vertex_indices: 100%
                     .s: 100%
                     .t: 100%
-                    .group_index: 20% (not tested yet: TODO: auto generate groups from blender data, by materials)
+                    .group_index: 100%
                     .smoothing_group: 100%
                     .flags: 0%
-                    .vertex_normals: 80% (not tested yet)
+                    .vertex_normals: 100%
             .groups
                 Ms3dGroup
                     .name: 100%
                     .triangle_indices: 100%
-                    .material_index: 0% (TODO: auto generate groups from blender data, by materials)
+                    .material_index: 100%
                     .comment: 100%
                     .flags: 100%
             .materials
                 Ms3dMaterial
-                    name: 0%
-                    ambient: 0%
-                    diffuse: 0%
-                    specular: 0%
-                    emissive: 0%
-                    shininess: 0%
-                    transparency: 0%
-                    mode: 0%
-                    texture: 0%
-                    alphamap: 0%
-                    comment: 0%
-            .comment: 0%
+                    name: 100%
+                    ambient: 100%
+                    diffuse: 100%
+                    specular: 100%
+                    emissive: 100%
+                    shininess: 100%
+                    transparency: 100%
+                    mode: 100%
+                    texture: 100%
+                    alphamap: 100%
+                    comment: 100%
+            .comment: 100%
             .model_ex
                 Ms3dModelEx
-                    .joint_size: 0%
-                    .transparency_mode: 0%
-                    .alpha_ref: 0%
+                    .joint_size: 100%
+                    .transparency_mode: 100%
+                    .alpha_ref: 100%
             .joints
                 Ms3dJoint
-                    .name: 0%
-                    .parent_name: 0%
-                    .rotation: 0%
-                    .position: 0%
-                    .rotation_keyframes: 0%
-                    .translation_keyframes: 0%
+                    .name: 100%
+                    .parent_name: 100%
+                    .rotation: 100%
+                    .position: 100%
+                    .rotation_keyframes: 100%
+                    .translation_keyframes: 100%
                     .joint_ex
                         Ms3DJointEx
-                            .color: 0%
-                    .comment: 0%
+                            .color: 100%
+                    .comment: 100%
 ###############################################################################
     importer:
         Ms3dModel
@@ -159,60 +153,58 @@ todo:
                 Ms3dVertex
                     .vertex: 100%
                     .bone_id: 100%
-                    .reference_count: 0% (100% will be calculated on export)
-                    .flags: 0% (value only)
+                    .reference_count: 0%
+                    .flags: 0%
                     .vertex_ex
                         Ms3dVertexEx
-                            .bone_ids: 0%
-                            .weights: 0%
-                            .extra: 0%
+                            .bone_ids: 100%
+                            .weights: 100%
+                            .extra: 100% (not exposed to UI)
             .triangles
                 Ms3dTriangle
                     .vertex_indices: 100%
                     .s: 100%
                     .t: 100%
                     .group_index: 100%
-                    .smoothing_group: 100% (BUG: generation of sharp edges
-                            does not work well on isolated faces
-                            - faces, that does not share edges with neighbors)
+                    .smoothing_group: 100%
                     .flags: 0%
-                    .vertex_normals: 0% (not/never for import)
+                    .vertex_normals: 0%
             .groups
                 Ms3dGroup
-                    .name: 100% (value only)
+                    .name: 100%
                     .triangle_indices: 100%
                     .material_index: 100%
-                    .comment: 100% (value only)
-                    .flags: 100% (value only)
+                    .comment: 100%
+                    .flags: 100%
             .materials
                 Ms3dMaterial
-                    name: 100% (value only)
+                    name: 100%
                     ambient: 100%
                     diffuse: 100%
                     specular: 100%
                     emissive: 100%
                     shininess: 100%
                     transparency: 100%
-                    mode: 100% (value only)
-                    texture: 100% (value only)
-                    alphamap: 100% (value only)
-                    comment: 100% (value only)
-            .comment: 100% (value only)
+                    mode: 100%
+                    texture: 100%
+                    alphamap: 100%
+                    comment: 100%
+            .comment: 100%
             .model_ex
                 Ms3dModelEx
-                    .joint_size: 100% (value only)
-                    .transparency_mode: 100% (value only)
-                    .alpha_ref: 100% (value only)
+                    .joint_size: 100%
+                    .transparency_mode: 100%
+                    .alpha_ref: 100%
             .joints
                 Ms3dJoint
                     .name: 100%
                     .parent_name: 100%
                     .rotation: 100%
                     .position: 100%
-                    .rotation_keyframes: 0%
-                    .translation_keyframes: 0%
+                    .rotation_keyframes: 100%
+                    .translation_keyframes: 100%
                     .joint_ex
                         Ms3DJointEx
-                            .color: 100% (value only)
+                            .color: 100%
                     .comment: 100%
 ###############################################################################
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/__init__.py b/release/scripts/addons_contrib/io_scene_ms3d/__init__.py
index 47658d0..bf3cefb 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/__init__.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/__init__.py
@@ -23,10 +23,10 @@ bl_info = {
         'description': "Import / Export MilkShape3D MS3D files"\
                 " (conform with v1.8.4)",
         'author': "Alexander Nussbaumer",
-        'version': (0, 4, 0, 3),
+        'version': (0, 6, 0, 3),
         'blender': (2, 6, 3, 0),
         'location': "File > Import & File > Export",
-        'warning': "[2012-07-10] currently only the importer is implemented",
+        #'warning': "",
         'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
                 "Scripts/Import-Export/MilkShape3D_MS3D",
         'tracker_url': "http://projects.blender.org/tracker/index.php"\
@@ -48,7 +48,7 @@ bl_info = {
 
 # To support reload properly, try to access a package var,
 # if it's there, reload everything
-if ('bpy' in locals()):
+if 'bpy' in locals():
     import imp
     if 'io_scene_ms3d.ms3d_ui' in locals():
         imp.reload(io_scene_ms3d.ms3d_ui)
@@ -73,12 +73,23 @@ from bpy.types import (
 ###############################################################################
 # registration
 def register():
+    ####################
+    # F8 - key
+    import imp
+    imp.reload(ms3d_ui)
+    # F8 - key
+    ####################
+
+    ms3d_ui.register()
+
     register_module(__name__)
     INFO_MT_file_export.append(Ms3dExportOperator.menu_func)
     INFO_MT_file_import.append(Ms3dImportOperator.menu_func)
 
 
 def unregister():
+    ms3d_ui.unregister()
+
     unregister_module(__name__)
     INFO_MT_file_export.remove(Ms3dExportOperator.menu_func)
     INFO_MT_file_import.remove(Ms3dImportOperator.menu_func)
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_export.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_export.py
index 8f094ac..45e133a 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_export.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_export.py
@@ -33,10 +33,10 @@
 #import python stuff
 import io
 from math import (
-        radians,
+        pi,
         )
 from mathutils import (
-        Vector,
+        Matrix,
         )
 from os import (
         path,
@@ -49,50 +49,34 @@ from time import (
         )
 
 
-# To support reload properly, try to access a package var,
-# if it's there, reload everything
-if ('bpy' in locals()):
-    import imp
-    if 'io_scene_ms3d.ms3d_strings' in locals():
-        imp.reload(io_scene_ms3d.ms3d_strings)
-    if 'io_scene_ms3d.ms3d_spec' in locals():
-        imp.reload(io_scene_ms3d.ms3d_spec)
-    if 'io_scene_ms3d.ms3d_utils' in locals():
-        imp.reload(io_scene_ms3d.ms3d_utils)
-    if 'io_scene_ms3d.ms3d_ui' in locals():
-        imp.reload(io_scene_ms3d.ms3d_ui)
-    pass
-else:
-    from io_scene_ms3d.ms3d_strings import (
-            ms3d_str,
-            )
-    from io_scene_ms3d.ms3d_spec import (
-            Ms3dSpec,
-            Ms3dModel,
-            Ms3dModelEx,
-            Ms3dVertex,
-            Ms3dVertexEx2,
-            Ms3dTriangle,
-            Ms3dGroup,
-            Ms3dMaterial,
-            Ms3dJoint,
-            Ms3dJointEx,
-            Ms3dRotationKeyframe,
-            Ms3dTranslationKeyframe,
-            Ms3dComment,
-            Ms3dCommentEx,
-            )
-    from io_scene_ms3d.ms3d_utils import (
-            select_all,
-            enable_pose_mode,
-            enable_edit_mode,
-            pre_setup_environment,
-            post_setup_environment,
-            )
-    from io_scene_ms3d.ms3d_ui import (
-            Ms3dUi,
-            )
-    pass
+# import io_scene_ms3d stuff
+from io_scene_ms3d.ms3d_strings import (
+        ms3d_str,
+        )
+from io_scene_ms3d.ms3d_spec import (
+        Ms3dSpec,
+        Ms3dModel,
+        Ms3dVertex,
+        Ms3dTriangle,
+        Ms3dGroup,
+        Ms3dMaterial,
+        Ms3dJoint,
+        Ms3dRotationKeyframe,
+        Ms3dTranslationKeyframe,
+        Ms3dCommentEx,
+        )
+from io_scene_ms3d.ms3d_utils import (
+        select_all,
+        enable_edit_mode,
+        pre_setup_environment,
+        post_setup_environment,
+        matrix_difference,
+        )
+from io_scene_ms3d.ms3d_ui import (
+        Ms3dUi,
+        Ms3dMaterialProperties,
+        Ms3dMaterialHelper,
+        )
 
 
 #import blender stuff
@@ -132,19 +116,22 @@ class Ms3dExporter():
 
             t2 = time()
 
-            self.file = None
+            #self.file = None
             try:
                 # write ms3d file to disk
-                self.file = io.FileIO(self.options.filepath, "wb")
-
-                ms3d_model.write(self.file)
-                self.file.flush()
-            finally:
-                if self.file is not None:
+                #self.file = io.FileIO(self.options.filepath, "wb")
+                with io.FileIO(self.options.filepath, "wb") as self.file:
+                    ms3d_model.write(self.file)
+                    self.file.flush()
                     self.file.close()
+            finally:
+                # close ms3d file
+                #if self.file is not None:
+                #    self.file.close()
+                pass
 
             # if option is set, this time will enlargs the io time
-            if (self.options.prop_verbose):
+            if (self.options.verbose):
                 ms3d_model.print_internal()
 
             post_setup_environment(self, blender_context)
@@ -162,7 +149,7 @@ class Ms3dExporter():
             is_valid, statistics = ms3d_model.is_valid()
             print()
             print("##########################################################")
-            print("Blender -> MS3D : [{0}]".format(self.filepath_splitted[1]))
+            print("Export from Blender to MS3D")
             print(statistics)
             print("##########################################################")
 
@@ -188,37 +175,45 @@ class Ms3dExporter():
 
     ###########################################################################
     def from_blender(self, blender_context, ms3d_model):
-        blender_mesh_objects = self.create_geometry(blender_context, ms3d_model)
-        self.create_animation(blender_context, ms3d_model, blender_mesh_objects)
-
-        
-    ###########################################################################
-    def create_geometry(self, blender_context, ms3d_model):
         blender_mesh_objects = []
 
-        if self.options.prop_selected:
-            source = blender_context.selected_objects
-        else:
-            source = blender_context.blend_data.objects
+        source = (blender_context.active_object, )
 
         for blender_object in source:
             if blender_object and blender_object.type == 'MESH' \
                     and blender_object.is_visible(blender_context.scene):
                 blender_mesh_objects.append(blender_object)
 
+        blender_to_ms3d_bones = {}
+
+        self.create_animation(blender_context, ms3d_model, blender_mesh_objects, blender_to_ms3d_bones)
+        self.create_geometry(blender_context, ms3d_model, blender_mesh_objects, blender_to_ms3d_bones)
+
+
+    ###########################################################################
+    def create_geometry(self, blender_context, ms3d_model, blender_mesh_objects, blender_to_ms3d_bones):
         blender_scene = blender_context.scene
 
         blender_to_ms3d_vertices = {}
         blender_to_ms3d_triangles = {}
         blender_to_ms3d_groups = {}
         blender_to_ms3d_materials = {}
+
         for blender_mesh_object in blender_mesh_objects:
             blender_mesh = blender_mesh_object.data
 
+            ms3d_model._model_ex_object.joint_size = blender_mesh.ms3d.joint_size
+            ms3d_model._model_ex_object.alpha_ref = blender_mesh.ms3d.alpha_ref
+            ms3d_model._model_ex_object.transparency_mode = Ms3dUi.transparency_mode_to_ms3d(
+                                blender_mesh.ms3d.transparency_mode)
+
             ##########################
             # prepare ms3d groups if available
+            # works only for exporting active object
+            ##EXPORT_ACTIVE_ONLY:
             for ms3d_local_group_index, blender_ms3d_group in enumerate(blender_mesh.ms3d.groups):
                 ms3d_group = Ms3dGroup()
+                ms3d_group.__index = len(ms3d_model._groups)
                 ms3d_group.name = blender_ms3d_group.name
                 ms3d_group.flags = Ms3dUi.flags_to_ms3d(blender_ms3d_group.flags)
                 if blender_ms3d_group.comment:
@@ -226,7 +221,6 @@ class Ms3dExporter():
                     ms3d_group._comment_object.comment = blender_ms3d_group.comment
                     ms3d_group._comment_object.index = len(ms3d_model._groups)
                 ms3d_group.material_index = None # to mark as not setted
-                ms3d_group.__index = len(ms3d_model._groups)
                 ms3d_model._groups.append(ms3d_group)
                 blender_to_ms3d_groups[blender_ms3d_group.id] = ms3d_group
 
@@ -237,16 +231,13 @@ class Ms3dExporter():
             # create a complete copy of mesh and bend object data
             # to be able to apply operations to it.
 
-            # get a temporary mesh with applied modifiers
-            if self.options.prop_apply_modifier:
-                blender_mesh_temp = blender_mesh_object.to_mesh(blender_scene,
-                        self.options.prop_apply_modifier,
-                        self.options.prop_apply_modifier_mode)
-            else:
-                blender_mesh_temp = blender_mesh_object.data.copy()
-
-            # assign temporary mesh as new object data
-            blender_mesh_object.data = blender_mesh_temp
+            # temporary, create a full copy of the model
+            blender_mesh_temp = blender_mesh_object.data.copy()
+            blender_mesh_object_temp = blender_mesh_object.copy()
+            blender_mesh_object_temp.data = blender_mesh_temp
+            blender_scene.objects.link(blender_mesh_object_temp)
+            blender_scene.objects.active = blender_mesh_object_temp
+            blender_mesh_temp.validate(self.options.verbose)
 
             # convert to tris
             enable_edit_mode(True)
@@ -256,7 +247,8 @@ class Ms3dExporter():
             enable_edit_mode(False)
 
             enable_edit_mode(True)
-            bm = bmesh.from_edit_mesh(blender_mesh_temp)
+            bm = bmesh.new()
+            bm.from_mesh(blender_mesh_temp)
 
             layer_texture = bm.faces.layers.tex.get(
                     ms3d_str['OBJECT_LAYER_TEXTURE'])
@@ -283,6 +275,13 @@ class Ms3dExporter():
                 else:
                     layer_uv = bm.loops.layers.uv.new(ms3d_str['OBJECT_LAYER_UV'])
 
+            layer_deform = bm.verts.layers.deform.active
+
+            layer_extra = bm.verts.layers.int.get(ms3d_str['OBJECT_LAYER_EXTRA'])
+            if layer_extra is None:
+                layer_extra = bm.verts.layers.int.new(ms3d_str['OBJECT_LAYER_EXTRA'])
+
+
             ##########################
             # handle vertices
             for bmv in bm.verts:
@@ -291,8 +290,79 @@ class Ms3dExporter():
                     index = len(ms3d_model._vertices)
                     ms3d_vertex = Ms3dVertex()
                     ms3d_vertex.__index = index
-                    ms3d_vertex._vertex = (self.matrix_scaled_coordination_system \
-                            * (bmv.co + blender_mesh_object.location))[:]
+
+                    loc = (bmv.co + blender_mesh_object_temp.location)
+                    ms3d_vertex._vertex = self.geometry_correction(loc)
+
+                    if layer_deform:
+                        blender_vertex_group_ids = bmv[layer_deform]
+                        if blender_vertex_group_ids:
+                            count = 0
+                            bone_ids = []
+                            weights = []
+                            for blender_index, blender_weight in blender_vertex_group_ids.items():
+                                ms3d_joint = blender_to_ms3d_bones.get(
+                                        blender_mesh_object_temp.vertex_groups[blender_index].name)
+                                if ms3d_joint:
+                                    if count == 0:
+                                        ms3d_vertex.bone_id = ms3d_joint.__index
+                                        weights.append(int(blender_weight * 100.0))
+                                    elif count == 1:
+                                        bone_ids.append(ms3d_joint.__index)
+                                        weights.append(int(blender_weight * 100.0))
+                                    elif count == 2:
+                                        bone_ids.append(ms3d_joint.__index)
+                                        weights.append(int(blender_weight * 100.0))
+                                    elif count == 3:
+                                        bone_ids.append(ms3d_joint.__index)
+                                        self.options.report(
+                                                {'WARNING', 'INFO'},
+                                                ms3d_str['WARNING_EXPORT_SKIP_WEIGHT'])
+                                    else:
+                                        # only first three weights will be supported / four bones
+                                        self.options.report(
+                                                {'WARNING', 'INFO'},
+                                                ms3d_str['WARNING_EXPORT_SKIP_WEIGHT_EX'])
+                                        break
+                                count+= 1
+
+                            while len(bone_ids) < 3:
+                                bone_ids.append(Ms3dSpec.DEFAULT_VERTEX_BONE_ID)
+                            while len(weights) < 3:
+                                weights.append(0)
+
+                            # normalize weights to 100
+                            if self.options.normalize_weights:
+                                weight_sum = 0
+                                for weight in weights:
+                                    weight_sum += weight
+
+                                if weight_sum > 100:
+                                    weight_normalize = 100 / weight_sum
+                                else:
+                                    weight_normalize = 1
+
+                                weight_sum = 100
+                                for index, weight in enumerate(weights):
+                                    if index >= count-1:
+                                        weights[index] = weight_sum
+                                        break
+                                    normalized_weight = int(weight * weight_normalize)
+                                    weight_sum -= normalized_weight
+                                    weights[index] = normalized_weight
+
+                            ms3d_vertex._vertex_ex_object._bone_ids = tuple(bone_ids)
+                            ms3d_vertex._vertex_ex_object._weights = tuple(weights)
+
+                    if layer_extra:
+                        #ms3d_vertex._vertex_ex_object.extra = bmv[layer_extra]
+                        # bm.verts.layers.int does only support signed int32
+                        # convert signed int32 to unsigned int32 (little-endian)
+                        signed_int32 = bmv[layer_extra]
+                        bytes_int32 = signed_int32.to_bytes(4, byteorder='little', signed=True)
+                        unsigned_int32 = int.from_bytes(bytes_int32, byteorder='little', signed=False)
+                        ms3d_vertex._vertex_ex_object.extra = unsigned_int32
+
                     ms3d_model._vertices.append(ms3d_vertex)
                     blender_to_ms3d_vertices[bmv] = ms3d_vertex
 
@@ -319,9 +389,9 @@ class Ms3dExporter():
                             ms3d_vertex2.__index,
                             )
                     ms3d_triangle._vertex_normals = (
-                            (self.matrix_coordination_system * bmv0.normal)[:],
-                            (self.matrix_coordination_system * bmv1.normal)[:],
-                            (self.matrix_coordination_system * bmv2.normal)[:],
+                            self.geometry_correction(bmv0.normal),
+                            self.geometry_correction(bmv1.normal),
+                            self.geometry_correction(bmv2.normal),
                             )
                     ms3d_triangle._s = (
                             bmf.loops[0][layer_uv].uv.x,
@@ -333,21 +403,34 @@ class Ms3dExporter():
                             1.0 - bmf.loops[1][layer_uv].uv.y,
                             1.0 - bmf.loops[2][layer_uv].uv.y,
                             )
-                    
+
                     ms3d_triangle.smoothing_group = bmf[layer_smoothing_group]
                     ms3d_model._triangles.append(ms3d_triangle)
 
+                    ms3d_material = self.get_ms3d_material_add_if(blender_mesh, ms3d_model,
+                            blender_to_ms3d_materials, bmf.material_index)
                     ms3d_group = blender_to_ms3d_groups.get(bmf[layer_group])
+
+                    ##EXPORT_ACTIVE_ONLY:
                     if ms3d_group is not None:
-                        ms3d_triangle.group_index = ms3d_group.__index
-                        if ms3d_group.material_index is None:
-                            ms3d_material = self.get_ms3d_material_add_if(blender_mesh, ms3d_model, blender_to_ms3d_materials, bmf.material_index)
-                            if ms3d_material is None:
-                                ms3d_group.material_index = Ms3dSpec.DEFAULT_GROUP_MATERIAL_INDEX
-                            else:
+                        if ms3d_material is None:
+                            ms3d_group.material_index = Ms3dSpec.DEFAULT_GROUP_MATERIAL_INDEX
+                        else:
+                            if ms3d_group.material_index is None:
                                 ms3d_group.material_index = ms3d_material.__index
+                            else:
+                                if ms3d_group.material_index != ms3d_material.__index:
+                                    ms3d_group = self.get_ms3d_group_by_material_add_if(ms3d_model, ms3d_material)
+                    else:
+                        if ms3d_material is not None:
+                            ms3d_group = self.get_ms3d_group_by_material_add_if(ms3d_model, ms3d_material)
+                        else:
+                            ms3d_group = self.get_ms3d_group_default_material_add_if(ms3d_model)
+
+                    if ms3d_group is not None:
+                        ms3d_group._triangle_indices.append(ms3d_triangle.__index)
+                        ms3d_triangle.group_index = ms3d_group.__index
 
-                        #if ms3d_group.material_index != 
                     blender_to_ms3d_triangles[bmf] = ms3d_triangle
 
             if bm is not None:
@@ -356,598 +439,331 @@ class Ms3dExporter():
             enable_edit_mode(False)
 
             ##########################
-            # restore original object data
-            blender_mesh_object.data = blender_mesh
-
-            ##########################
             # remove the temporary data
+            blender_scene.objects.unlink(blender_mesh_object_temp)
+            if blender_mesh_object_temp is not None:
+                blender_mesh_object_temp.user_clear()
+                blender_context.blend_data.objects.remove(blender_mesh_object_temp)
             if blender_mesh_temp is not None:
                 blender_mesh_temp.user_clear()
                 blender_context.blend_data.meshes.remove(blender_mesh_temp)
 
-            # DEBUG:
-            print("DEBUG: blender_mesh_object: {}".format(blender_mesh_object))
-
-        return blender_mesh_objects
 
 
     ###########################################################################
-    def create_animation(self, blender_context, ms3d_model, blender_mesh_objects):
+    def create_animation(self, blender_context, ms3d_model, blender_mesh_objects, blender_to_ms3d_bones):
         ##########################
         # setup scene
         blender_scene = blender_context.scene
-        ms3d_model.animation_fps = blender_scene.render.fps * blender_scene.render.fps_base
-        ms3d_model.number_total_frames = (blender_scene.frame_end - blender_scene.frame_start) + 1
-        ms3d_model.current_time = (blender_scene.frame_current - blender_scene.frame_start) / (blender_scene.render.fps * blender_scene.render.fps_base)
 
-        pass
+        frame_start = blender_scene.frame_start
+        frame_end = blender_scene.frame_end
+        frame_total = (frame_end - frame_start) + 1
+        frame_step = blender_scene.frame_step
+        frame_offset = 0
 
+        fps = blender_scene.render.fps * blender_scene.render.fps_base
+        time_base = 1.0 / fps
 
-    ###########################################################################
-    def get_ms3d_group_add_if(self, blender_ms3d_group, ms3d_model, blender_to_ms3d_groups):
-        ms3d_group = Ms3dGroup()
-        ms3d_group.__index = len(ms3d_model._groups)
-        
-        ms3d_group.name = blender_ms3d_group.name
-        ms3d_group.flags = Ms3dUi.flags_to_ms3d(blender_ms3d_group.flags)
-        ms3d_group.material_index = None # to mark as not setted
-        if blender_ms3d_group.comment:
-            ms3d_group._comment_object = Ms3dCommentEx()
-            ms3d_group._comment_object.comment = blender_ms3d_group.comment
-            ms3d_group._comment_object.index = ms3d_group.__index
-        
-        ms3d_model._groups.append(ms3d_group)
-        
-        blender_to_ms3d_groups[blender_ms3d_group.id] = ms3d_group
-        
-        return ms3d_group
-    
-    
-    ###########################################################################
-    def get_ms3d_material_add_if(self, blender_mesh, ms3d_model, blender_to_ms3d_materials, blender_index):
-        if blender_index < 0 or blender_index >= len(blender_mesh.materials):
-            return None
-            
-        blender_material = blender_mesh.materials[blender_index]
-        ms3d_material = blender_to_ms3d_materials.get(blender_material)
-        if ms3d_material is None:
-            ms3d_material = Ms3dMaterial()
-            ms3d_material.__index = len(ms3d_model.materials)
-            
-            blender_ms3d_material = blender_material.ms3d
-            
-            ms3d_material.name = blender_ms3d_material.name
-            ms3d_material._ambient = blender_ms3d_material.ambient
-            ms3d_material._diffuse = blender_ms3d_material.diffuse
-            ms3d_material._specular = blender_ms3d_material.specular
-            ms3d_material._emissive = blender_ms3d_material.emissive
-            ms3d_material.shininess = blender_ms3d_material.shininess
-            ms3d_material.transparency = blender_ms3d_material.transparency
-            ms3d_material.mode = Ms3dUi.texture_mode_to_ms3d(blender_ms3d_material.mode)
-            ms3d_material.texture = blender_ms3d_material.texture
-            ms3d_material.alphamap = blender_ms3d_material.alphamap
-            if blender_ms3d_material.comment:
-                ms3d_material._comment_object = Ms3dCommentEx()
-                ms3d_material._comment_object.comment = blender_ms3d_material.comment
-                ms3d_material._comment_object.index = ms3d_material.__index
-                
-            ms3d_model.materials.append(ms3d_material)
-        
-            blender_to_ms3d_materials[blender_material] = ms3d_material
-            
-        return ms3d_material
+        base_bone_correction = Matrix.Rotation(pi / 2, 4, 'Z')
 
-        
-    ###########################################################################
-    def old_from_blender(self, blender_context, ms3d_model):
-        blender = blender_context.blend_data
-
-        ms3d_vertices = []
-
-        ms3d_triangles = []
-        ms3d_materials = []
-        ms3d_groups = []
-
-        flagHandleMaterials = \
-                (self.options.handle_materials)
-
-        # handle blender-materials (without mesh's uv texture image)
-        if (flagHandleMaterials):
-            for blender_material in blender.materials:
-                if (blender_material.users <= 0):
-                    continue
-
-                ms3d_material = self.create_material(blender_material, None)
-                if ms3d_material and (ms3d_material not in ms3d_materials):
-                    ms3d_materials.append(ms3d_material)
-
-        nLayers = len(blender_context.scene.layers)
-        # handle blender-objects
-        for blender_object in blender.objects:
-
-            # do not handle non-mesh objects or unused objects
-            if (blender_object.type != 'MESH') or (blender_object.users <= 0):
-                continue
-
-            # skip unselected objects in "only selected"-mode
-            if (self.options.prop_selected) and (not blender_object.select):
-                continue
-
-            # skip meshes of invisible layers
-            skip = True
-            for iLayer in range(nLayers):
-                if ((blender_object.layers[iLayer]
-                        and blender_context.scene.layers[iLayer])):
-                    skip = False
+        for blender_mesh_object in blender_mesh_objects:
+            blender_bones = None
+            blender_action = None
+            blender_nla_tracks = None
+            for blender_modifier in blender_mesh_object.modifiers:
+                if blender_modifier.type == 'ARMATURE' and blender_modifier.object.pose:
+                    blender_bones = blender_modifier.object.data.bones
+                    blender_pose_bones = blender_modifier.object.pose.bones
+                    if blender_modifier.object.animation_data:
+                        blender_action = blender_modifier.object.animation_data.action
+                        blender_nla_tracks =  blender_modifier.object.animation_data.nla_tracks
                     break
-            if (skip):
-                continue
 
-            # make new object as active and only selected object
-            context.scene.objects.active = blender_object
-
-            matrix_object = blender_object.matrix_basis
+            ##########################
+            # bones
+            blender_bones_ordered = []
+            self.build_blender_bone_dependency_order(blender_bones, blender_bones_ordered)
+            for blender_bone_name in blender_bones_ordered:
+                blender_bone_oject = blender_bones[blender_bone_name]
+                ms3d_joint = Ms3dJoint()
+                ms3d_joint.__index = len(ms3d_model._joints)
+
+                blender_bone_ms3d = blender_bone_oject.ms3d
+                blender_bone = blender_bone_oject
+
+                ms3d_joint.flags = Ms3dUi.flags_to_ms3d(blender_bone_ms3d.flags)
+                if blender_bone_ms3d.comment:
+                    ms3d_joint._comment_object = Ms3dCommentEx()
+                    ms3d_joint._comment_object.comment = blender_bone_ms3d.comment
+                    ms3d_joint._comment_object.index = ms3d_joint.__index
+
+                ms3d_joint.joint_ex_object._color = blender_bone_ms3d.color[:]
+
+                ms3d_joint.name = blender_bone.name
+
+                if blender_bone.parent:
+                    ms3d_joint.parent_name = blender_bone.parent.name
+                    ms3d_joint.__matrix = matrix_difference(blender_bone.matrix_local, blender_bone.parent.matrix_local)
+                else:
+                    ms3d_joint.__matrix = base_bone_correction * blender_bone.matrix_local
 
-            blender_mesh = blender_object.data
+                mat = ms3d_joint.__matrix
+                loc = mat.to_translation()
+                rot = mat.to_euler('XZY')
+                ms3d_joint._position = self.joint_correction(loc)
+                ms3d_joint._rotation = self.joint_correction(rot)
 
-            ms3d_group = Ms3dGroup()
-            ms3d_group.name = blender_object.name
+                ms3d_model._joints.append(ms3d_joint)
+                blender_to_ms3d_bones[blender_bone.name] = ms3d_joint
 
-            # handle blender-vertices
-            for blender_vertex in blender_mesh.vertices:
-                ms3dVertex = self.create_vertex(matrix_object, blender_vertex)
+            ##########################
+            # animation
+            frames = None
+            frames_location = set()
+            frames_rotation = set()
+            frames_scale = set()
+
+            if blender_action:
+                self.fill_keyframe_sets(
+                        blender_action.fcurves,
+                        frames_location, frames_rotation, frames_scale,
+                        0)
+
+            if blender_nla_tracks:
+                for nla_track in blender_nla_tracks:
+                    if nla_track.mute:
+                        continue
+                    for strip in nla_track.strips:
+                        if strip.mute:
+                            continue
+                        frame_correction = strip.frame_start - strip.action_frame_start
+                        self.fill_keyframe_sets(
+                                strip.action.fcurves,
+                                frames_location, frames_rotation, frames_scale,
+                                frame_correction)
+
+            frames = set(frames_location)
+            frames = frames.union(frames_rotation)
+            frames = frames.union(frames_scale)
+
+            if not self.options.shrink_to_keys:
+                frames = frames.intersection(range(blender_scene.frame_start, blender_scene.frame_end + 1))
+
+            frames_sorted = list(frames)
+            frames_sorted.sort()
+
+            if self.options.shrink_to_keys and len(frames_sorted) >= 2:
+                frame_start = frames_sorted[0]
+                frame_end = frames_sorted[len(frames_sorted)-1]
+                frame_total = (frame_end - frame_start) + 1
+                frame_offset = frame_start - 1
+
+            if self.options.bake_each_frame:
+                frames_sorted = range(int(frame_start), int(frame_end + 1), int(frame_step))
+
+            frame_temp = blender_scene.frame_current
+
+            for current_frame in frames_sorted:
+                blender_scene.frame_set(current_frame)
+
+                current_time = (current_frame - frame_offset) * time_base
+                for blender_bone_name in blender_bones_ordered:
+                    blender_bone = blender_bones[blender_bone_name]
+                    blender_pose_bone = blender_pose_bones[blender_bone_name]
+                    ms3d_joint = blender_to_ms3d_bones[blender_bone_name]
+
+                    m1 = blender_bone.matrix_local.inverted()
+                    if blender_pose_bone.parent:
+                        m2 = blender_pose_bone.parent.matrix_channel.inverted()
+                    else:
+                        m2 = Matrix()
+                    m3 = blender_pose_bone.matrix.copy()
+                    m = ((m1 * m2) * m3)
+                    loc = m.to_translation()
+                    rot = m.to_euler('XZY')
+
+                    ms3d_joint.translation_key_frames.append(
+                            Ms3dTranslationKeyframe(
+                                    current_time, self.joint_correction(loc)
+                                    )
+                            )
+                    ms3d_joint.rotation_key_frames.append(
+                            Ms3dRotationKeyframe(
+                                    current_time, self.joint_correction(rot)
+                                    )
+                            )
 
-                # handle reference_count and/or
-                # put vertex without duplicates
-                if (ms3dVertex in ms3d_vertices):
-                    ms3d_vertices[ms3d_vertices.index(ms3dVertex)]\
-                            .reference_count += 1
-                else:
-                    ms3dVertex.reference_count = 1
-                    ms3d_vertices.append(ms3dVertex)
-
-            """
-            # handle smoothing groups
-            smoothGroupFaces = self.generate_smoothing_groups(
-                    blender_context, ms3d_model, blender_mesh.faces)
-
-            # handle blender-faces
-            group_index = len(ms3d_groups)
-            for iFace, blender_face in enumerate(blender_mesh.faces):
-                if (smoothGroupFaces) and (iFace in smoothGroupFaces):
-                    smoothing_group = smoothGroupFaces[iFace]
-                else:
-                    smoothing_group = 0
-
-                if (len(blender_face.vertices) == 4):
-                    # 1'st tri of quad
-                    ms3dTriangle = self.create_triangle(matrix_object,
-                            ms3d_vertices, blender_mesh, blender_face,
-                            group_index, smoothing_group, 0)
-                    # put triangle
-                    ms3d_triangles.append(ms3dTriangle)
-                    # put triangle index
-                    ms3d_group.triangle_indices.append(
-                            ms3d_triangles.index(ms3dTriangle))
-
-                    # 2'nd tri of quad
-                    ms3dTriangle = self.create_triangle(matrix_object,
-                            ms3d_vertices, blender_mesh, blender_face,
-                            group_index, smoothing_group, 1)
+            blender_scene.frame_set(frame_temp)
 
-                else:
-                    ms3dTriangle = self.create_triangle(matrix_object,
-                            ms3d_vertices, blender_mesh, blender_face,
-                            group_index, smoothing_group)
-
-                # put triangle
-                ms3d_triangles.append(ms3dTriangle)
-                # put triangle index
-                ms3d_group.triangle_indices.append(
-                        ms3d_triangles.index(ms3dTriangle))
-            """
-
-            # handle material (take the first one)
-            if (flagHandleMaterials) and (blender_mesh.materials):
-                if (blender_mesh.uv_textures):
-                    tmpMaterial1 = self.create_material(
-                            blender_mesh.materials[0],
-                            blender_mesh.uv_textures[0])
-                else:
-                    tmpMaterial1 = self.create_material(
-                            blender_mesh.materials[0],
-                            None)
-
-                if tmpMaterial1:
-                    ms3d_group.material_index = ms3d_materials.index(tmpMaterial1)
-
-                    # upgrade poor material.texture with rich material.texture
-                    tmpMaterial2 = ms3d_materials[ms3d_group.material_index]
-                    if (tmpMaterial1.texture) and (not tmpMaterial2.texture):
-                        tmpMaterial2.texture = tmpMaterial1.texture
-
-            # put group
-            ms3d_groups.append(ms3d_group)
-
-        # injecting common data
-        ms3d_model._vertices = ms3d_vertices
-        ms3d_model._triangles = ms3d_triangles
-        ms3d_model._groups = ms3d_groups
-        ms3d_model._materials = ms3d_materials
-
-        # inject currently unsupported data
-        ms3d_model._vertex_ex = []
-        if (ms3d_model.sub_version_vertex_extra == 1):
-            for i in range(ms3d_model.number_vertices):
-                ms3d_model.vertex_ex.append(Ms3dVertexEx1())
-        elif (ms3d_model.sub_version_vertex_extra == 2):
-            for i in range(ms3d_model.number_vertices):
-                ms3d_model.vertex_ex.append(Ms3dVertexEx2())
-        elif (ms3d_model.sub_version_vertex_extra == 3):
-            for i in range(ms3d_model.number_vertices):
-                ms3d_model.vertex_ex.append(Ms3dVertexEx3())
-        else:
-            pass
+        ms3d_model.animation_fps = fps
+        ms3d_model.number_total_frames = int(frame_total)
+        ms3d_model.current_time = ((blender_scene.frame_current - blender_scene.frame_start) + 1) * time_base
 
-        if (self.options.prop_verbose):
-            ms3d_model.print_internal()
 
-        is_valid, statistics = ms3d_model.is_valid()
-        print()
-        print("##############################################################")
-        print("Blender -> MS3D : [{0}]".format(self.filepath_splitted[1]))
-        print(statistics)
-        print("##############################################################")
+    ###########################################################################
+    def get_ms3d_group_default_material_add_if(self, ms3d_model):
+        markerName = "MaterialGroupDefault"
+        markerComment = "group without material"
 
+        for ms3d_group in ms3d_model._groups:
+            if ms3d_group.material_index == Ms3dSpec.DEFAULT_GROUP_MATERIAL_INDEX \
+                    and ms3d_group.name == markerName \
+                    and ms3d_group._comment_object \
+                    and ms3d_group._comment_object.comment == markerComment:
+                return ms3d_group
 
-    ###########################################################################
-    def create_material(self, blender_material, blender_uv_layer):
-        if (not blender_material):
-            return None
+        ms3d_group = Ms3dGroup()
+        ms3d_group.__index = len(ms3d_model._groups)
+        ms3d_group.name = markerName
+        ms3d_group._comment_object = Ms3dCommentEx()
+        ms3d_group._comment_object.comment = markerComment
+        ms3d_group._comment_object.index = len(ms3d_model._groups)
+        ms3d_group.material_index = Ms3dSpec.DEFAULT_GROUP_MATERIAL_INDEX
 
-        ms3d_material = Ms3dMaterial()
-
-        ms3d_material.name = blender_material.name
-
-        ms3d_material._ambient = (
-                blender_material.diffuse_color[0],
-                blender_material.diffuse_color[1],
-                blender_material.diffuse_color[2],
-                blender_material.ambient
-                )
-
-        ms3d_material._diffuse = (
-                blender_material.diffuse_color[0],
-                blender_material.diffuse_color[1],
-                blender_material.diffuse_color[2],
-                blender_material.diffuse_intensity
-                )
-
-        ms3d_material._specular = (
-                blender_material.specular_color[0],
-                blender_material.specular_color[1],
-                blender_material.specular_color[2],
-                blender_material.specular_intensity
-                )
-
-        ms3d_material._emissive = (
-                blender_material.diffuse_color[0],
-                blender_material.diffuse_color[1],
-                blender_material.diffuse_color[2],
-                blender_material.emit
-                )
-
-        ms3d_material.shininess = blender_material.specular_hardness / 2.0
-        if ms3d_material.shininess > 128:
-            ms3d_material.shininess = 128
-        if ms3d_material.shininess < 1:
-            ms3d_material.shininess = 1
-
-        if (blender_material.use_transparency):
-            ms3d_material.transparency = blender_material.alpha
-
-        if (blender_material.texture_slots):
-            imageDiffuse = None
-            imageAlpha = None
-
-            for blender_texture_slot in blender_material.texture_slots:
-                if ((not blender_texture_slot)
-                        or (not blender_texture_slot.texture)
-                        or (blender_texture_slot.texture_coords != 'UV')
-                        or (blender_texture_slot.texture.type != 'IMAGE')
-                        ):
-                    continue
-
-                if ((not imageDiffuse)
-                        and (blender_texture_slot.use_map_color_diffuse)):
-                    if ((blender_texture_slot.texture.image)
-                            and (blender_texture_slot.texture.image.filepath)):
-                        imageDiffuse = path.split(
-                                blender_texture_slot.texture.image.filepath)[1]
-                    elif (not blender_texture_slot.texture.image):
-                        # case it image was not loaded
-                        imageDiffuse = path.split(
-                                blender_texture_slot.texture.name)[1]
-
-                elif ((not imageAlpha)
-                        and (blender_texture_slot.use_map_color_alpha)):
-                    if ((blender_texture_slot.texture.image)
-                            and (blender_texture_slot.texture.image.filepath)):
-                        imageAlpha = path.split(
-                                blender_texture_slot.texture.image.filepath)[1]
-                    elif (not blender_texture_slot.texture.image):
-                        # case it image was not loaded
-                        imageAlpha = path.split(
-                                blender_texture_slot.texture.name)[1]
-
-            # if no diffuse image was found, try to find a uv texture image
-            if (not imageDiffuse) and (blender_uv_layer):
-                for blender_texture_face in blender_uv_layer.data:
-                    if ((blender_texture_face) and (blender_texture_face.image)
-                            and (blender_texture_face.image.filepath)):
-                        imageDiffuse = path.split(
-                                blender_texture_face.image.filepath)[1]
-                        break
-
-            if (imageDiffuse):
-                ms3d_material.texture = imageDiffuse
-
-            if (imageAlpha):
-                ms3d_material.alphamap = imageDiffuse
+        ms3d_model._groups.append(ms3d_group)
 
-        return ms3d_material
+        return ms3d_group
 
 
     ###########################################################################
-    def create_normal(self,  matrix_object, blender_vertex):
-        mathVector = Vector(blender_vertex.normal)
+    def get_ms3d_group_by_material_add_if(self, ms3d_model, ms3d_material):
+        if ms3d_material.__index < 0 or ms3d_material.__index >= len(ms3d_model.materials):
+            return None
 
-        # apply its object matrix (translation, rotation, scale)
-        mathVector = (matrix_object * mathVector)
+        markerName = "MaterialGroup.{}".format(ms3d_material.__index)
+        markerComment = "MaterialGroup({})".format(ms3d_material.name)
 
-        # apply export swap axis matrix
-        mathVector = mathVector * self.matrixSwapAxis
+        for ms3d_group in ms3d_model._groups:
+            if ms3d_group.name == markerName \
+                    and ms3d_group._comment_object \
+                    and ms3d_group._comment_object.comment == markerComment:
+                return ms3d_group
 
-        ms3dNormal = tuple(mathVector)
+        ms3d_group = Ms3dGroup()
+        ms3d_group.__index = len(ms3d_model._groups)
+        ms3d_group.name = markerName
+        ms3d_group._comment_object = Ms3dCommentEx()
+        ms3d_group._comment_object.comment = markerComment
+        ms3d_group._comment_object.index = len(ms3d_model._groups)
+        ms3d_group.material_index = ms3d_material.__index
 
-        return ms3dNormal
+        ms3d_model._groups.append(ms3d_group)
 
+        return ms3d_group
 
-    ###########################################################################
-    def create_triangle(self, matrix_object, ms3d_vertices,
-            blender_mesh, blender_face,
-            group_index=0, smoothing_group=None, subIndex=0):
-        """
-        known limitations:
-            - it will take only the first uv_texture-data,
-              if one or more are present
-        """
-        ms3dTriangle = Ms3dTriangle()
-
-        ms3dTriangle.group_index = group_index
-
-        if (smoothing_group) and (smoothing_group > 0):
-            ms3dTriangle.smoothing_group = \
-                    (smoothing_group % Ms3dSpec.MAX_GROUPS) + 1
-
-        if (blender_face.select):
-            ms3dTriangle.flags |= Ms3dSpec.FLAG_SELECTED
-
-        if (blender_face.hide):
-            ms3dTriangle.flags |= Ms3dSpec.FLAG_HIDDEN
-
-        tx = None
-        l = len(blender_face.vertices)
-
-        if (l == 3):
-            # it is already a triangle geometry
-            if (subIndex != 0):
-                return None
-
-            # no order-translation needed
-            tx = (0, 1, 2)
-
-        elif (l == 4):
-            # it is a quad geometry
-            if (subIndex > 1) or (subIndex < 0):
-                return None
-
-            if (subIndex == 0):
-                # order-translation for 1'st triangle
-                tx = (0, 1, 3)
-            else:
-                # order-translation for 2'nd triangle
-                tx = (3, 1, 2)
 
-        else:
-            # it is any unhandled geometry
+    ###########################################################################
+    def get_ms3d_material_add_if(self, blender_mesh, ms3d_model, blender_to_ms3d_materials, blender_index):
+        if blender_index < 0 or blender_index >= len(blender_mesh.materials):
             return None
 
-        # take blender-vertex from blender-mesh
-        # to get its vertex and normal coordinates
-        v = blender_mesh.vertices[blender_face.vertices_raw[tx[0]]]
-        v0 = self.create_vertex(matrix_object, v)
-        n0 = self.create_normal(matrix_object, v)
-
-        # take blender-vertex from blender-mesh
-        # to get its vertex and normal coordinates
-        v = blender_mesh.vertices[blender_face.vertices_raw[tx[1]]]
-        v1 = self.create_vertex(matrix_object, v)
-        n1 = self.create_normal(matrix_object, v)
-
-        # take blender-vertex from blender-mesh
-        # to get its vertex and normal coordinates
-        v = blender_mesh.vertices[blender_face.vertices_raw[tx[2]]]
-        v2 = self.create_vertex(matrix_object, v)
-        n2 = self.create_normal(matrix_object, v)
-
-        # put the indices of ms3d-vertices!
-        ms3dTriangle._vertex_indices = (
-                ms3d_vertices.index(v0),
-                ms3d_vertices.index(v1),
-                ms3d_vertices.index(v2)
-                )
-
-        # put the normales
-        ms3dTriangle._vertex_normals = (n0, n1, n2)
-
-        # if uv's present
-        if (blender_mesh.uv_textures):
-            # take 1'st uv_texture-data
-            blenderUv = \
-                    blender_mesh.uv_textures[0].data[blender_face.index].uv_raw
-
-            # translate uv to st
-            #
-            # blender uw
-            # y(v)
-            # |(0,1)  (1,1)
-            # |
-            # |
-            # |(0,0)  (1,0)
-            # +--------x(u)
-            #
-            # ms3d st
-            # +--------x(s)
-            # |(0,0)  (1,0)
-            # |
-            # |
-            # |(0,1)  (1,1)
-            # y(t)
-            s0, t0 = blenderUv[tx[0] << 1], 1.0 - blenderUv[(tx[0] << 1) + 1]
-            s1, t1 = blenderUv[tx[1] << 1], 1.0 - blenderUv[(tx[1] << 1) + 1]
-            s2, t2 = blenderUv[tx[2] << 1], 1.0 - blenderUv[(tx[2] << 1) + 1]
-
-            # put the uv-coordinates
-            ms3dTriangle._s = (s0, s1, s2)
-            ms3dTriangle._t = (t0, t1, t2)
-
-        return ms3dTriangle
-
+        blender_material = blender_mesh.materials[blender_index]
+        ms3d_material = blender_to_ms3d_materials.get(blender_material)
+        if ms3d_material is None:
+            ms3d_material = Ms3dMaterial()
+            ms3d_material.__index = len(ms3d_model.materials)
 
-    ###########################################################################
-    def create_vertex(self,  matrix_object, blender_vertex):
-        """ known limitations:
-            - bone_id not supported """
-        ms3dVertex = Ms3dVertex()
+            blender_ms3d_material = blender_material.ms3d
 
-        if (blender_vertex.select):
-            ms3dVertex.flags |= Ms3dSpec.FLAG_SELECTED
+            if not self.options.use_blender_names and not self.options.use_blender_materials and blender_ms3d_material.name:
+                ms3d_material.name = blender_ms3d_material.name
+            else:
+                ms3d_material.name = blender_material.name
 
-        if (blender_vertex.hide):
-            ms3dVertex.flags |= Ms3dSpec.FLAG_HIDDEN
+            temp_material = None
+            if self.options.use_blender_materials:
+                temp_material = Ms3dMaterial()
+                Ms3dMaterialHelper.copy_from_blender(None, None, temp_material, blender_material)
+            else:
+                temp_material = blender_ms3d_material
 
-        mathVector = Vector(blender_vertex.co)
+            ms3d_material._ambient = temp_material.ambient[:]
+            ms3d_material._diffuse = temp_material.diffuse[:]
+            ms3d_material._specular = temp_material.specular[:]
+            ms3d_material._emissive = temp_material.emissive[:]
+            ms3d_material.shininess = temp_material.shininess
+            ms3d_material.transparency = temp_material.transparency
+            ms3d_material.texture = temp_material.texture
+            ms3d_material.alphamap = temp_material.alphamap
 
-        # apply its object matrix (translation, rotation, scale)
-        mathVector = (matrix_object * mathVector)
+            ms3d_material.mode = Ms3dUi.texture_mode_to_ms3d(blender_ms3d_material.mode)
+            if blender_ms3d_material.comment:
+                ms3d_material._comment_object = Ms3dCommentEx()
+                ms3d_material._comment_object.comment = blender_ms3d_material.comment
+                ms3d_material._comment_object.index = ms3d_material.__index
 
-        # apply export viewport matrix
-        mathVector = mathVector * self.matrixViewport
+            ms3d_model.materials.append(ms3d_material)
 
-        ms3dVertex._vertex = tuple(mathVector)
+            blender_to_ms3d_materials[blender_material] = ms3d_material
 
-        return ms3dVertex
+        return ms3d_material
 
 
     ###########################################################################
-    def generate_smoothing_groups(self, blender_context, ms3d_model,
-            blender_faces):
-        enable_edit_mode(True)
-
-        # enable face-selection-mode
-        context.tool_settings.mesh_select_mode = [False, False, True]
-
-        # deselect all "faces"
-        select_all(False) # mesh
+    def geometry_correction(self, value):
+        return (value[1], value[2], value[0])
 
-        # enable object-mode (important for face.select = value)
-        enable_edit_mode(False)
 
-        handledFacesSet = set()
-        smoothGroupVertices = {}
-
-        blenderVertices = blender_context.active_object.data.vertices
-
-        # run throug the faces
-        # mark linked faces and set its smoothGroup value
-        nFaces = len(blender_faces)
+    ###########################################################################
+    def joint_correction(self, value):
+        return (-value[0], value[2], value[1])
 
-        for iFace in range(nFaces):
-            if (blender_faces[iFace].select) or (iFace in handledFacesSet):
-                continue
 
-            # a new unhandled face found
-            blender_faces[iFace].select = True
+    ###########################################################################
+    def build_blender_bone_dependency_order(self, blender_bones, blender_bones_ordered):
+        if not blender_bones:
+            return blender_bones_ordered
+
+        blender_bones_children = {None: []}
+        for blender_bone in blender_bones:
+            if blender_bone.parent:
+                blender_bone_children = blender_bones_children.get(blender_bone.parent.name)
+                if blender_bone_children is None:
+                    blender_bone_children = blender_bones_children[blender_bone.parent.name] = []
+            else:
+                blender_bone_children = blender_bones_children[None]
 
-            enable_edit_mode(True)
+            blender_bone_children.append(blender_bone.name)
 
-            if ops.mesh.select_linked.poll():
-                ops.mesh.select_linked()
+        self.traverse_dependencies(
+                blender_bones_ordered,
+                blender_bones_children,
+                None)
 
-            enable_edit_mode(False)
+        return blender_bones_ordered
 
-            # build a set of vertices hashes
-            currentFaceSet = set()
-            currentVertexSet = set()
-            for iiFace in range(nFaces):
-                if ((blender_faces[iiFace].select)
-                        and (iiFace not in handledFacesSet)):
-                    handledFacesSet.add(iiFace)
-                    currentFaceSet.add(iiFace)
-
-                    iVertex = blender_faces[iiFace].vertices[0]
-                    mathVector = blenderVertices[iVertex].co
-                    currentVertexSet.add(
-                            hash(mathVector[0])
-                            ^ hash(mathVector[1])
-                            ^ hash(mathVector[2]))
-
-                    iVertex = blender_faces[iiFace].vertices[1]
-                    mathVector = blenderVertices[iVertex].co
-                    currentVertexSet.add(
-                            hash(mathVector[0])
-                            ^ hash(mathVector[1])
-                            ^ hash(mathVector[2]))
-
-                    iVertex = blender_faces[iiFace].vertices[2]
-                    mathVector = blenderVertices[iVertex].co
-                    currentVertexSet.add(
-                            hash(mathVector[0])
-                            ^ hash(mathVector[1])
-                            ^ hash(mathVector[2]))
-
-                    if(len(blender_faces[iiFace].vertices) == 4):
-                        iVertex = blender_faces[iiFace].vertices[3]
-                        mathVector = blenderVertices[iVertex].co
-                        currentVertexSet.add(
-                                hash(mathVector[0])
-                                ^ hash(mathVector[1])
-                                ^ hash(mathVector[2]))
-
-            # search for collision set
-            reused_smoothgroup = False
-            for iSmoothGroup in smoothGroupVertices:
-                smoothVertexSet = smoothGroupVertices[iSmoothGroup][1]
-                intersectionVertexSet = currentVertexSet & smoothVertexSet
-                if(len(intersectionVertexSet) == 0):
-                    # no shared vertices, you can use that smoothgroup without collision
-                    item = smoothGroupVertices[iSmoothGroup]
-                    item[0] |= currentFaceSet
-                    item[1] |= currentVertexSet
-                    reused_smoothgroup = True
-                    break
 
-            if not reused_smoothgroup:
-                smoothGroupVertices[len(smoothGroupVertices)] = [currentFaceSet, currentVertexSet]
+    ###########################################################################
+    def traverse_dependencies(self, blender_bones_ordered, blender_bones_children, key):
+        blender_bone_children = blender_bones_children.get(key)
+        if blender_bone_children:
+            for blender_bone_name in blender_bone_children:
+                blender_bones_ordered.append(blender_bone_name)
+                self.traverse_dependencies(
+                        blender_bones_ordered,
+                        blender_bones_children,
+                        blender_bone_name)
 
-        # put result to a smoothGroupFaces dictionary
-        smoothGroupFaces = {}
-        for iSmoothGroup in smoothGroupVertices:
-            for iFace in smoothGroupVertices[iSmoothGroup][0]:
-                smoothGroupFaces[iFace] = iSmoothGroup
+    ###########################################################################
+    def fill_keyframe_sets(self,
+            fcurves,
+            frames_location, frames_rotation, frames_scale,
+            frame_correction):
+        for fcurve in fcurves:
+            if fcurve.data_path.endswith(".location"):
+                frames = frames_location
+            elif fcurve.data_path.endswith(".rotation_euler"):
+                frames = frames_rotation
+            elif fcurve.data_path.endswith(".rotation_quaternion"):
+                frames = frames_rotation
+            elif fcurve.data_path.endswith(".scale"):
+                frames = frames_scale
+            else:
+                pass
 
-        return smoothGroupFaces
+            for keyframe_point in fcurve.keyframe_points:
+                frames.add(int(keyframe_point.co[0] + frame_correction))
 
 
 ###############################################################################
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_import.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_import.py
index 09480a7..612f230 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_import.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_import.py
@@ -32,12 +32,8 @@
 
 #import python stuff
 import io
-from math import (
-        radians,
-        )
 from mathutils import (
         Vector,
-        Euler,
         Matrix,
         )
 from os import (
@@ -45,45 +41,33 @@ from os import (
         )
 from sys import (
         exc_info,
-        float_info,
         )
 from time import (
         time,
         )
 
 
-# To support reload properly, try to access a package var,
-# if it's there, reload everything
-if ('bpy' in locals()):
-    import imp
-    if 'io_scene_ms3d.ms3d_strings' in locals():
-        imp.reload(io_scene_ms3d.ms3d_strings)
-    if 'io_scene_ms3d.ms3d_spec' in locals():
-        imp.reload(io_scene_ms3d.ms3d_spec)
-    if 'io_scene_ms3d.ms3d_utils' in locals():
-        imp.reload(io_scene_ms3d.ms3d_utils)
-    if 'io_scene_ms3d.ms3d_ui' in locals():
-        imp.reload(io_scene_ms3d.ms3d_ui)
-    pass
-else:
-    from io_scene_ms3d.ms3d_strings import (
-            ms3d_str,
-            )
-    from io_scene_ms3d.ms3d_spec import (
-            Ms3dSpec,
-            Ms3dModel,
-            )
-    from io_scene_ms3d.ms3d_utils import (
-            select_all,
-            enable_pose_mode,
-            enable_edit_mode,
-            pre_setup_environment,
-            post_setup_environment,
-            )
-    from io_scene_ms3d.ms3d_ui import (
-            Ms3dUi,
-            )
-    pass
+# import io_scene_ms3d stuff
+from io_scene_ms3d.ms3d_strings import (
+        ms3d_str,
+        )
+from io_scene_ms3d.ms3d_spec import (
+        Ms3dSpec,
+        Ms3dModel,
+        Ms3dVertexEx2,
+        Ms3dVertexEx3,
+        )
+from io_scene_ms3d.ms3d_utils import (
+        select_all,
+        enable_pose_mode,
+        enable_edit_mode,
+        pre_setup_environment,
+        post_setup_environment,
+        get_edge_split_modifier_add_if,
+        )
+from io_scene_ms3d.ms3d_ui import (
+        Ms3dUi,
+        )
 
 
 #import blender stuff
@@ -122,20 +106,22 @@ class Ms3dImporter():
             # create an empty ms3d template
             ms3d_model = Ms3dModel(self.filepath_splitted[1])
 
-            self.file = None
+            #self.file = None
             try:
                 # open ms3d file
-                self.file = io.FileIO(self.options.filepath, 'rb')
-
-                # read and inject ms3d data from disk to internal structure
-                ms3d_model.read(self.file)
+                #self.file = io.FileIO(self.options.filepath, 'rb')
+                with io.FileIO(self.options.filepath, 'rb') as self.file:
+                    # read and inject ms3d data from disk to internal structure
+                    ms3d_model.read(self.file)
+                    self.file.close()
             finally:
                 # close ms3d file
-                if self.file is not None:
-                    self.file.close()
+                #if self.file is not None:
+                #    self.file.close()
+                pass
 
             # if option is set, this time will enlargs the io time
-            if self.options.prop_verbose:
+            if self.options.verbose:
                 ms3d_model.print_internal()
 
             t2 = time()
@@ -149,45 +135,13 @@ class Ms3dImporter():
                 blender_scene = blender_context.scene
 
                 # finalize/restore environment
-                if self.options.prop_unit_mm:
-                    # set metrics
-                    blender_scene.unit_settings.system = 'METRIC'
-                    blender_scene.unit_settings.system_rotation = 'DEGREES'
-                    blender_scene.unit_settings.scale_length = 0.001 #1.0mm
-                    blender_scene.unit_settings.use_separate = False
-                    blender_context.tool_settings.normal_size = 1.0 # 1.0mm
-
-
-                    # set all 3D views to texture shaded
-                    # and set up the clipping
-                    if self.has_textures:
-                        viewport_shade = 'TEXTURED'
-                    else:
-                        viewport_shade = 'SOLID'
-
-                    for screen in blender_context.blend_data.screens:
-                        for area in screen.areas:
-                            if (area.type != 'VIEW_3D'):
-                                continue
-
-                            for space in area.spaces:
-                                if (space.type != 'VIEW_3D'):
-                                    continue
-
-                                space.viewport_shade = viewport_shade
-                                #screen.scene.game_settings.material_mode \
-                                #        = 'MULTITEXTURE'
-                                #space.show_textured_solid = True
-                                space.clip_start = 0.1 # 0.1mm
-                                space.clip_end = 1000000.0 # 1km
-
                 blender_scene.update()
 
                 post_setup_environment(self, blender_context)
 
             print()
             print("##########################################################")
-            print("MS3D -> Blender : [{0}]".format(self.filepath_splitted[1]))
+            print("Import from MS3D to Blender")
             print(statistics)
             print("##########################################################")
 
@@ -214,9 +168,12 @@ class Ms3dImporter():
     ###########################################################################
     def to_blender(self, blender_context, ms3d_model):
         blender_mesh_object = self.create_geometry(blender_context, ms3d_model)
-        blender_armature_object = self.create_animation(blender_context, ms3d_model, blender_mesh_object)
+        blender_armature_object = self.create_animation(
+                blender_context, ms3d_model, blender_mesh_object)
 
-        self.organize_objects(blender_context, ms3d_model, [blender_mesh_object, blender_armature_object])
+        self.organize_objects(
+                blender_context, ms3d_model,
+                [blender_mesh_object, blender_armature_object])
 
 
     ###########################################################################
@@ -230,8 +187,10 @@ class Ms3dImporter():
 
         blender_scene = blender_context.scene
 
-        blender_group = blender_context.blend_data.groups.new(ms3d_model.name + ".g")
-        blender_empty_object = blender_context.blend_data.objects.new(ms3d_model.name + ".e", None)
+        blender_group = blender_context.blend_data.groups.new(
+                "{}.g".format(ms3d_model.name))
+        blender_empty_object = blender_context.blend_data.objects.new(
+                "{}.e".format(ms3d_model.name), None)
         blender_empty_object.location = blender_scene.cursor_location
         blender_scene.objects.link(blender_empty_object)
         blender_group.objects.link(blender_empty_object)
@@ -247,8 +206,10 @@ class Ms3dImporter():
         ##########################
         # blender stuff:
         # create a blender Mesh
-        blender_mesh = blender_context.blend_data.meshes.new(ms3d_model.name + ".m")
+        blender_mesh = blender_context.blend_data.meshes.new(
+                "{}.m".format(ms3d_model.name))
         blender_mesh.ms3d.name = ms3d_model.name
+
         ms3d_comment = ms3d_model.comment_object
         if ms3d_comment is not None:
             blender_mesh.ms3d.comment = ms3d_comment.comment
@@ -264,29 +225,29 @@ class Ms3dImporter():
         # blender stuff:
         # link to blender object
         blender_mesh_object = blender_context.blend_data.objects.new(
-                ms3d_model.name + ".m", blender_mesh)
+                "{}.m".format(ms3d_model.name), blender_mesh)
 
         ##########################
         # blender stuff:
         # create edge split modifire, to make sharp edges visible
-        blender_modifier = blender_mesh_object.modifiers.new(
-                "ms3d_smoothing_groups", type='EDGE_SPLIT')
-        blender_modifier.show_expanded = False
-        blender_modifier.use_edge_angle = False
-        blender_modifier.use_edge_sharp = True
+        blender_modifier = get_edge_split_modifier_add_if(blender_mesh_object)
 
         ##########################
         # blender stuff:
         # link to blender scene
         blender_scene = blender_context.scene
         blender_scene.objects.link(blender_mesh_object)
-        blender_mesh_object.location = blender_scene.cursor_location
+        #blender_mesh_object.location = blender_scene.cursor_location
         enable_edit_mode(False)
         select_all(False)
         blender_mesh_object.select = True
         blender_scene.objects.active = blender_mesh_object
 
         ##########################
+        # take this as active object after import
+        self.active_object = blender_mesh_object
+
+        ##########################
         # blender stuff:
         # create all (ms3d) groups
         ms3d_to_blender_group_index = {}
@@ -343,11 +304,28 @@ class Ms3dImporter():
 
         ##########################
         # BMesh stuff:
+        # create new Layers for custom data per "vertex"
+        layer_extra = bm.verts.layers.int.get(ms3d_str['OBJECT_LAYER_EXTRA'])
+        if layer_extra is None:
+            layer_extra = bm.verts.layers.int.new(ms3d_str['OBJECT_LAYER_EXTRA'])
+
+        ##########################
+        # BMesh stuff:
         # create all vertices
         for ms3d_vertex_index, ms3d_vertex in enumerate(ms3d_model.vertices):
-            bmv = bm.verts.new(
-                    self.matrix_scaled_coordination_system
-                    * Vector(ms3d_vertex.vertex))
+            bmv = bm.verts.new(self.geometry_correction(ms3d_vertex.vertex))
+
+            if layer_extra and ms3d_vertex.vertex_ex_object and \
+                    (isinstance(ms3d_vertex.vertex_ex_object, Ms3dVertexEx2) \
+                    or isinstance(ms3d_vertex.vertex_ex_object, Ms3dVertexEx3)):
+
+                #bmv[layer_extra] = ms3d_vertex.vertex_ex_object.extra
+                # bm.verts.layers.int does only support signed int32
+                # convert unsigned int32 to signed int32 (little-endian)
+                unsigned_int32 = ms3d_vertex.vertex_ex_object.extra
+                bytes_int32 = unsigned_int32.to_bytes(4, byteorder='little', signed=False)
+                signed_int32 = int.from_bytes(bytes_int32, byteorder='little', signed=True)
+                bmv[layer_extra] = signed_int32
 
         ##########################
         # blender stuff (uses BMesh stuff):
@@ -355,7 +333,8 @@ class Ms3dImporter():
         ms3d_to_blender_material = {}
         for ms3d_material_index, ms3d_material in enumerate(
                 ms3d_model.materials):
-            blender_material = blender_context.blend_data.materials.new(ms3d_material.name)
+            blender_material = blender_context.blend_data.materials.new(
+                    ms3d_material.name)
 
             # custom datas
             blender_material.ms3d.name = ms3d_material.name
@@ -370,7 +349,6 @@ class Ms3dImporter():
 
             if ms3d_material.texture:
                 blender_material.ms3d.texture = ms3d_material.texture
-                self.has_textures = True
 
             if ms3d_material.alphamap:
                 blender_material.ms3d.alphamap = ms3d_material.alphamap
@@ -380,38 +358,26 @@ class Ms3dImporter():
                 blender_material.ms3d.comment = ms3d_comment.comment
 
             # blender datas
-            blender_material.ambient = ((
+            blender_material.ambient = (
                     (ms3d_material.ambient[0]
                     + ms3d_material.ambient[1]
                     + ms3d_material.ambient[2]) / 3.0)
-                    * ms3d_material.ambient[3])
 
             blender_material.diffuse_color[0] = ms3d_material.diffuse[0]
             blender_material.diffuse_color[1] = ms3d_material.diffuse[1]
             blender_material.diffuse_color[2] = ms3d_material.diffuse[2]
-            blender_material.diffuse_intensity = ms3d_material.diffuse[3]
 
             blender_material.specular_color[0] = ms3d_material.specular[0]
             blender_material.specular_color[1] = ms3d_material.specular[1]
             blender_material.specular_color[2] = ms3d_material.specular[2]
-            blender_material.specular_intensity = ms3d_material.specular[3]
 
-            blender_material.emit = ((
+            blender_material.emit = (
                     (ms3d_material.emissive[0]
                     + ms3d_material.emissive[1]
                     + ms3d_material.emissive[2]) / 3.0)
-                    * ms3d_material.emissive[3])
-
-            blender_material.specular_hardness = ms3d_material.shininess * 2.0
 
-            if (ms3d_material.transparency):
-                blender_material.use_transparency = True
-                blender_material.alpha = ms3d_material.transparency
-                blender_material.specular_alpha = blender_material.alpha
-
-            if (blender_material.game_settings):
-                blender_material.game_settings.use_backface_culling = False
-                blender_material.game_settings.alpha_blend = 'ALPHA'
+            blender_material.specular_hardness = ms3d_material.shininess * 4.0
+            blender_material.alpha = 1.0 - ms3d_material.transparency
 
             # diffuse texture
             if ms3d_material.texture:
@@ -429,6 +395,8 @@ class Ms3dImporter():
                 blender_texture_slot_diffuse.uv_layer = layer_uv.name
                 blender_texture_slot_diffuse.use_map_color_diffuse = True
                 blender_texture_slot_diffuse.use_map_alpha = False
+                if blender_image_diffuse is not None:
+                    self.has_textures = True
             else:
                 blender_image_diffuse = None
 
@@ -462,12 +430,16 @@ class Ms3dImporter():
         ##########################
         # BMesh stuff:
         # create all triangles
+        length_verts = len(bm.verts)
         smoothing_group_blender_faces = {}
         for ms3d_triangle_index, ms3d_triangle in enumerate(
                 ms3d_model.triangles):
             bmv_list = []
-            for vert_index in ms3d_triangle.vertex_indices:
+            for index, vert_index in enumerate(ms3d_triangle.vertex_indices):
+                if vert_index < 0 or vert_index >= length_verts:
+                    continue
                 bmv = bm.verts[vert_index]
+                bmv.normal = self.geometry_correction(ms3d_triangle.vertex_normals[index])
                 if [[x] for x in bmv_list if x == bmv]:
                     self.options.report(
                             {'WARNING', 'INFO'},
@@ -563,8 +535,11 @@ class Ms3dImporter():
         # end BMesh stuff
         ####################################################
 
+        blender_mesh.validate(self.options.verbose)
+
         return blender_mesh_object
 
+
     ###########################################################################
     def create_animation(self, blender_context, ms3d_model, blender_mesh_object):
         ##########################
@@ -586,12 +561,13 @@ class Ms3dImporter():
             return
 
         ##########################
-        ms3d_armature_name = ms3d_model.name + ".a"
-        ms3d_action_name = ms3d_model.name + ".act"
+        ms3d_armature_name = "{}.a".format(ms3d_model.name)
+        ms3d_action_name = "{}.act".format(ms3d_model.name)
 
         ##########################
         # create new blender_armature_object
-        blender_armature = blender_context.blend_data.armatures.new(ms3d_armature_name)
+        blender_armature = blender_context.blend_data.armatures.new(
+                ms3d_armature_name)
         blender_armature.ms3d.name = ms3d_model.name
         blender_armature.draw_type = 'STICK'
         blender_armature.show_axes = True
@@ -599,56 +575,102 @@ class Ms3dImporter():
         blender_armature_object = blender_context.blend_data.objects.new(
                 ms3d_armature_name, blender_armature)
         blender_scene.objects.link(blender_armature_object)
-        blender_armature_object.location = blender_scene.cursor_location
+        #blender_armature_object.location = blender_scene.cursor_location
         blender_armature_object.show_x_ray = True
 
         ##########################
+        # create new modifier
+        blender_modifier = blender_mesh_object.modifiers.new(
+                ms3d_armature_name, type='ARMATURE')
+        blender_modifier.show_expanded = False
+        blender_modifier.use_vertex_groups = True
+        blender_modifier.use_bone_envelopes = False
+        blender_modifier.object = blender_armature_object
+
+        ##########################
         # prepare for vertex groups
         ms3d_to_blender_vertex_groups = {}
         for ms3d_vertex_index, ms3d_vertex in enumerate(ms3d_model.vertices):
             # prepare for later use for blender vertex group
             if ms3d_vertex.bone_id != Ms3dSpec.NONE_VERTEX_BONE_ID:
-                blender_vertex_group = ms3d_to_blender_vertex_groups.get(
-                        ms3d_vertex.bone_id)
-                if blender_vertex_group is None:
-                    ms3d_to_blender_vertex_groups[ms3d_vertex.bone_id] \
-                            = blender_vertex_group = []
-                blender_vertex_group.append(ms3d_vertex_index)
+                if ms3d_vertex.vertex_ex_object \
+                        and ( \
+                        ms3d_vertex.vertex_ex_object.bone_ids[0] != Ms3dSpec.NONE_VERTEX_BONE_ID \
+                        or ms3d_vertex.vertex_ex_object.bone_ids[1] != Ms3dSpec.NONE_VERTEX_BONE_ID \
+                        or ms3d_vertex.vertex_ex_object.bone_ids[2] != Ms3dSpec.NONE_VERTEX_BONE_ID \
+                        ):
+                    ms3d_vertex_group_ids_weights = []
+                    ms3d_vertex_group_ids_weights.append(
+                            (ms3d_vertex.bone_id,
+                            float(ms3d_vertex.vertex_ex_object.weights[0] % 101) / 100.0,
+                            ))
+                    if ms3d_vertex.vertex_ex_object.bone_ids[0] != Ms3dSpec.NONE_VERTEX_BONE_ID:
+                        ms3d_vertex_group_ids_weights.append(
+                                (ms3d_vertex.vertex_ex_object.bone_ids[0],
+                                float(ms3d_vertex.vertex_ex_object.weights[1] % 101) / 100.0
+                                ))
+                    if ms3d_vertex.vertex_ex_object.bone_ids[1] != Ms3dSpec.NONE_VERTEX_BONE_ID:
+                        ms3d_vertex_group_ids_weights.append(
+                                (ms3d_vertex.vertex_ex_object.bone_ids[1],
+                                float(ms3d_vertex.vertex_ex_object.weights[2] % 101) / 100.0
+                                ))
+                    if ms3d_vertex.vertex_ex_object.bone_ids[2] != Ms3dSpec.NONE_VERTEX_BONE_ID:
+                        ms3d_vertex_group_ids_weights.append(
+                                (ms3d_vertex.vertex_ex_object.bone_ids[2],
+                                1.0 -
+                                float((ms3d_vertex.vertex_ex_object.weights[0] % 101)
+                                + (ms3d_vertex.vertex_ex_object.weights[1] % 101)
+                                + (ms3d_vertex.vertex_ex_object.weights[2] % 101)) / 100.0
+                                ))
+
+                else:
+                    ms3d_vertex_group_ids_weights = [(ms3d_vertex.bone_id, 1.0), ]
+
+                for ms3d_vertex_group_id_weight in ms3d_vertex_group_ids_weights:
+                    ms3d_vertex_group_id = ms3d_vertex_group_id_weight[0]
+                    blender_vertex_weight = ms3d_vertex_group_id_weight[1]
+                    blender_vertex_group = ms3d_to_blender_vertex_groups.get(
+                            ms3d_vertex_group_id)
+                    if blender_vertex_group is None:
+                        ms3d_to_blender_vertex_groups[ms3d_vertex_group_id] \
+                                = blender_vertex_group = []
+                    blender_vertex_group.append((ms3d_vertex_index, blender_vertex_weight))
 
         ##########################
         # blender stuff:
         # create all vertex groups to be used for bones
-        for ms3d_bone_id, blender_vertex_index_list \
+        for ms3d_bone_id, blender_vertex_index_weight_list \
                 in ms3d_to_blender_vertex_groups.items():
             ms3d_name = ms3d_model.joints[ms3d_bone_id].name
             blender_vertex_group = blender_mesh_object.vertex_groups.new(
                     ms3d_name)
-            blender_vertex_group.add(blender_vertex_index_list, 1.0, 'REPLACE')
+            for blender_vertex_id_weight in blender_vertex_index_weight_list:
+                blender_vertex_index = blender_vertex_id_weight[0]
+                blender_vertex_weight = blender_vertex_id_weight[1]
+                blender_vertex_group.add((blender_vertex_index, ), blender_vertex_weight, 'ADD')
 
-        blender_modifier = blender_mesh_object.modifiers.new(
-                ms3d_armature_name, type='ARMATURE')
-        blender_modifier.show_expanded = False
-        blender_modifier.use_vertex_groups = True
-        blender_modifier.use_bone_envelopes = False
-        blender_modifier.object = blender_armature_object
+        ##########################
+        # bring joints in the correct order
+        ms3d_joints_ordered = []
+        self.build_ms3d_joint_dependency_order(ms3d_model.joints, ms3d_joints_ordered)
 
         ##########################
         # prepare joint data for later use
         ms3d_joint_by_name = {}
-        for ms3d_joint in ms3d_model.joints:
+        for ms3d_joint in ms3d_joints_ordered:
             item = ms3d_joint_by_name.get(ms3d_joint.name)
             if item is None:
                 ms3d_joint.__children = []
-                ms3d_joint.__matrix_local = Matrix()
-                ms3d_joint.__matrix_global = Matrix()
                 ms3d_joint_by_name[ms3d_joint.name] = ms3d_joint
 
-            matrix_local = (Matrix.Rotation(ms3d_joint.rotation[2], 4, 'Z')
+            matrix_local_rot = (Matrix.Rotation(ms3d_joint.rotation[2], 4, 'Z')
                     * Matrix.Rotation(ms3d_joint.rotation[1], 4, 'Y')
                     ) * Matrix.Rotation(ms3d_joint.rotation[0], 4, 'X')
             matrix_local = Matrix.Translation(Vector(ms3d_joint.position)
-                    ) * matrix_local
+                    ) * matrix_local_rot
 
+            ms3d_joint.__matrix_local_rot = matrix_local_rot
+            ms3d_joint.__matrix_global_rot = matrix_local_rot
             ms3d_joint.__matrix_local = matrix_local
             ms3d_joint.__matrix_global = matrix_local
 
@@ -662,11 +684,22 @@ class Ms3dImporter():
                             * matrix_local
                     ms3d_joint.__matrix_global = matrix_global
 
+                    matrix_global_rot = ms3d_joint_parent.__matrix_global_rot \
+                            * matrix_local_rot
+                    ms3d_joint.__matrix_global_rot = matrix_global_rot
+
         ##########################
         # ms3d_joint to blender_edit_bone
+        if ms3d_model.model_ex_object and not self.options.use_joint_size:
+            joint_length = ms3d_model.model_ex_object.joint_size
+        else:
+            joint_length = self.options.joint_size
+        if joint_length < 0.01:
+            joint_length = 0.01
+
         blender_scene.objects.active = blender_armature_object
         enable_edit_mode(True)
-        for ms3d_joint in ms3d_model.joints:
+        for ms3d_joint in ms3d_joints_ordered:
             blender_edit_bone = blender_armature.edit_bones.new(ms3d_joint.name)
             blender_edit_bone.use_connect = False
             blender_edit_bone.use_inherit_rotation = True
@@ -678,37 +711,15 @@ class Ms3dImporter():
             ms3d_joint_vector = ms3d_joint.__matrix_global * Vector()
 
             blender_edit_bone.head \
-                    = self.matrix_scaled_coordination_system \
-                    * ms3d_joint_vector
-
-            number_children = len(ms3d_joint.__children)
-            if number_children > 0:
-                vector_midpoint = Vector()
-                for item_child in ms3d_joint.__children:
-                    ms3d_joint_child_vector \
-                            = ms3d_joint_by_name[item_child.name].__matrix_global \
-                            * Vector()
-                    vector_midpoint += ms3d_joint_child_vector \
-                            - ms3d_joint_vector
-                vector_midpoint /= number_children
-                vector_midpoint.normalize()
-                blender_edit_bone.tail = blender_edit_bone.head \
-                        + self.matrix_scaled_coordination_system \
-                        * vector_midpoint
-            else:
-                vector_tail_end = Vector()
-                if ms3d_joint.parent_name:
-                    ms3d_joint_parent_vector \
-                            = ms3d_joint_by_name[ms3d_joint.parent_name].__matrix_global \
-                            * Vector()
-                    vector_tail_end = ms3d_joint_vector \
-                            - ms3d_joint_parent_vector
-                else:
-                    #dummy tail
-                    vector_tail_end = ms3d_joint.__matrix_global * Vector()
-                vector_tail_end.normalize()
-                blender_edit_bone.tail = blender_edit_bone.head \
-                        + self.matrix_scaled_coordination_system * vector_tail_end
+                    = self.geometry_correction(ms3d_joint_vector)
+
+            vector_tail_end_up = ms3d_joint.__matrix_global_rot * Vector((0,1,0))
+            vector_tail_end_dir = ms3d_joint.__matrix_global_rot * Vector((0,0,1))
+            vector_tail_end_up.normalize()
+            vector_tail_end_dir.normalize()
+            blender_edit_bone.tail = blender_edit_bone.head \
+                    + self.geometry_correction(vector_tail_end_dir * joint_length)
+            blender_edit_bone.align_roll(self.geometry_correction(vector_tail_end_up))
 
             if ms3d_joint.parent_name:
                 ms3d_joint_parent = ms3d_joint_by_name[ms3d_joint.parent_name]
@@ -719,14 +730,21 @@ class Ms3dImporter():
             ms3d_joint.blender_edit_bone = blender_edit_bone
         enable_edit_mode(False)
 
-        ##########################
-        # post process bones
-        enable_edit_mode(True)
-        select_all(True)
-        if ops.armature.calculate_roll.poll():
-            ops.armature.calculate_roll(type='Y')
-        select_all(False)
-        enable_edit_mode(False)
+        if self.options.joint_to_bones:
+            enable_edit_mode(True)
+            for ms3d_joint in ms3d_joints_ordered:
+                blender_edit_bone = blender_armature.edit_bones[ms3d_joint.name]
+                if blender_edit_bone.children:
+                    new_length = 0.0
+                    for child_bone in blender_edit_bone.children:
+                        length = (child_bone.head - blender_edit_bone.head).length
+                        if new_length <= 0 or length < new_length:
+                            new_length = length
+                    if new_length >= 0.01:
+                        direction = blender_edit_bone.tail - blender_edit_bone.head
+                        direction.normalize()
+                        blender_edit_bone.tail = blender_edit_bone.head + (direction * new_length)
+            enable_edit_mode(False)
 
         ##########################
         # post process bones
@@ -749,7 +767,7 @@ class Ms3dImporter():
                 blender_bone.ms3d.comment = ms3d_comment.comment
 
         ##########################
-        if not self.options.prop_animation:
+        if not self.options.animation:
             return blender_armature_object
 
 
@@ -763,16 +781,21 @@ class Ms3dImporter():
         blender_armature_object.animation_data.action = blender_action
 
         ##########################
-        # this part is not correct implemented !
-        # currently i have absolute no idea how to fix.
-        # maybe somebody else can fix it.
-        for ms3d_joint_name, ms3d_joint  in ms3d_joint_by_name.items():
+        # transition between keys may be incorrect
+        # because of the gimbal-lock problem!
+        # http://www.youtube.com/watch?v=zc8b2Jo7mno
+        # http://www.youtube.com/watch?v=rrUCBOlJdt4
+        # you can fix it manually by selecting the affected keyframes
+        # and allpy the following option to it:
+        # "Graph Editor -> Key -> Discontinuity (Euler) Filter"
+        # ==> "bpy.ops.graph.euler_filter()"
+        # but this option is only available for Euler rotation f-curves!
+        #
+        for ms3d_joint_name, ms3d_joint in ms3d_joint_by_name.items():
             blender_pose_bone = blender_armature_object.pose.bones.get(
                     ms3d_joint.blender_bone_name)
             if blender_pose_bone is None:
                 continue
-            ms3d_joint_local_matrix = ms3d_joint.__matrix_local
-            ms3d_joint_global_matrix = ms3d_joint.__matrix_global
 
             data_path = blender_pose_bone.path_from_id('location')
             fcurve_location_x = blender_action.fcurves.new(data_path, index=0)
@@ -783,39 +806,86 @@ class Ms3dImporter():
                 matrix_local = Matrix.Translation(
                         Vector(translation_key_frames.position))
                 v = (matrix_local) * Vector()
-                fcurve_location_x.keyframe_points.insert(frame, v[0])
-                fcurve_location_y.keyframe_points.insert(frame, v[1])
-                fcurve_location_z.keyframe_points.insert(frame, v[2])
-
-            blender_pose_bone.rotation_mode = 'QUATERNION'
-            data_path = blender_pose_bone.path_from_id("rotation_quaternion")
-            fcurve_rotation_w = blender_action.fcurves.new(data_path, index=0)
-            fcurve_rotation_x = blender_action.fcurves.new(data_path, index=1)
-            fcurve_rotation_y = blender_action.fcurves.new(data_path, index=2)
-            fcurve_rotation_z = blender_action.fcurves.new(data_path, index=3)
-            for rotation_key_frames in ms3d_joint.rotation_key_frames:
-                frame = (rotation_key_frames.time * ms3d_model.animation_fps)
-                matrix_local = (Matrix.Rotation(
-                        rotation_key_frames.rotation[2], 4, 'Z')
-                        * Matrix.Rotation(
-                                rotation_key_frames.rotation[1],
-                                4,
-                                'Y')) \
-                                * Matrix.Rotation(
-                                        rotation_key_frames.rotation[0],
-                                        4,
-                                        'X')
-                q = (matrix_local).to_quaternion()
-                fcurve_rotation_w.keyframe_points.insert(frame, q.w)
-                fcurve_rotation_x.keyframe_points.insert(frame, q.x)
-                fcurve_rotation_y.keyframe_points.insert(frame, q.y)
-                fcurve_rotation_z.keyframe_points.insert(frame, q.z)
+                fcurve_location_x.keyframe_points.insert(frame, -v[0])
+                fcurve_location_y.keyframe_points.insert(frame, v[2])
+                fcurve_location_z.keyframe_points.insert(frame, v[1])
+
+            if self.options.is_rotation_mode_quaternion:
+                blender_pose_bone.rotation_mode = 'QUATERNION'
+                data_path = blender_pose_bone.path_from_id("rotation_quaternion")
+                fcurve_rotation_w = blender_action.fcurves.new(data_path, index=0)
+                fcurve_rotation_x = blender_action.fcurves.new(data_path, index=1)
+                fcurve_rotation_y = blender_action.fcurves.new(data_path, index=2)
+                fcurve_rotation_z = blender_action.fcurves.new(data_path, index=3)
+                for rotation_key_frames in ms3d_joint.rotation_key_frames:
+                    frame = (rotation_key_frames.time * ms3d_model.animation_fps)
+                    matrix_local_rot = (
+                            Matrix.Rotation(rotation_key_frames.rotation[2], 4, 'Y')
+                            * Matrix.Rotation(rotation_key_frames.rotation[1], 4, 'Z')
+                            ) * Matrix.Rotation(-rotation_key_frames.rotation[0], 4, 'X')
+                    q = (matrix_local_rot).to_quaternion()
+                    fcurve_rotation_w.keyframe_points.insert(frame, q.w)
+                    fcurve_rotation_x.keyframe_points.insert(frame, q.x)
+                    fcurve_rotation_y.keyframe_points.insert(frame, q.y)
+                    fcurve_rotation_z.keyframe_points.insert(frame, q.z)
+            else:
+                blender_pose_bone.rotation_mode = 'XZY'
+                data_path = blender_pose_bone.path_from_id("rotation_euler")
+                fcurve_rotation_x = blender_action.fcurves.new(data_path, index=0)
+                fcurve_rotation_y = blender_action.fcurves.new(data_path, index=1)
+                fcurve_rotation_z = blender_action.fcurves.new(data_path, index=2)
+                for rotation_key_frames in ms3d_joint.rotation_key_frames:
+                    frame = (rotation_key_frames.time * ms3d_model.animation_fps)
+                    fcurve_rotation_x.keyframe_points.insert(frame, -rotation_key_frames.rotation[0])
+                    fcurve_rotation_y.keyframe_points.insert(frame, rotation_key_frames.rotation[2])
+                    fcurve_rotation_z.keyframe_points.insert(frame, rotation_key_frames.rotation[1])
 
         enable_pose_mode(False)
 
         return blender_armature_object
 
 
+    ###########################################################################
+    def geometry_correction(self, value):
+        return Vector((value[2], value[0], value[1]))
+
+
+    ###########################################################################
+    def build_ms3d_joint_dependency_order(self, ms3d_joints, ms3d_joints_ordered):
+        ms3d_joints_children = {"": {}}
+        for ms3d_joint in ms3d_joints:
+            if ms3d_joint.parent_name:
+                ms3d_joint_children = ms3d_joints_children.get(ms3d_joint.parent_name)
+                if ms3d_joint_children is None:
+                    ms3d_joint_children = ms3d_joints_children[ms3d_joint.parent_name] = {}
+            else:
+                ms3d_joint_children = ms3d_joints_children[""]
+
+            ms3d_joint_children[ms3d_joint.name] = ms3d_joint
+
+        self.traverse_dependencies(
+                ms3d_joints_ordered,
+                ms3d_joints_children,
+                "")
+
+
+        return ms3d_joints_ordered
+
+
+    ###########################################################################
+    def traverse_dependencies(self, ms3d_joints_ordered, ms3d_joints_children, key):
+        ms3d_joint_children = ms3d_joints_children.get(key)
+        if ms3d_joint_children:
+            for item in ms3d_joint_children.items():
+                ms3d_joint_name = item[0]
+                ms3d_joint = item[1]
+                ms3d_joints_ordered.append(ms3d_joint)
+                self.traverse_dependencies(
+                        ms3d_joints_ordered,
+                        ms3d_joints_children,
+                        ms3d_joint_name)
+
+
 ###############################################################################
 #234567890123456789012345678901234567890123456789012345678901234567890123456789
 #--------1---------2---------3---------4---------5---------6---------7---------
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_spec.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_spec.py
index 441455b..b222711 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_spec.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_spec.py
@@ -124,6 +124,14 @@ class Ms3dSpec:
     DEFAULT_FLAGS = FLAG_NONE
     MAX_MATERIAL_SHININESS = 128
 
+    # blender default / OpenGL default
+    DEFAULT_MATERIAL_AMBIENT = (0.2, 0.2, 0.2, 1.0)
+    DEFAULT_MATERIAL_DIFFUSE = (0.8, 0.8, 0.8, 1.0)
+    DEFAULT_MATERIAL_SPECULAR = (1.0, 1.0, 1.0, 1.0)
+    DEFAULT_MATERIAL_EMISSIVE = (0.0, 0.0, 0.0, 1.0)
+    DEFAULT_MATERIAL_SHININESS = 12.5
+    
+    DEFAULT_JOINT_COLOR = (0.8, 0.8, 0.8)
 
 ###############################################################################
 #
@@ -143,6 +151,8 @@ class Ms3dIo:
     LENGTH_NAME = 32
     LENGTH_FILENAME = 128
 
+    PRECISION = 4
+
     @staticmethod
     def raise_on_eof(file):
         """ pseudo end of file detection """
@@ -282,7 +292,7 @@ class Ms3dIo:
             else:
                 raw = 0
 
-            file.write(pack('<b', raw % 255))
+            file.write(pack('<b', raw % 256))
 
 
 ###############################################################################
@@ -307,7 +317,7 @@ class Ms3dHeader:
         self.version = default_version
 
     def __repr__(self):
-        return "\n<id='{0}', version={1}>".format(
+        return "\n<id='{}', version={}>".format(
             self.id,
             self.version
             )
@@ -365,12 +375,15 @@ class Ms3dVertex:
         # Ms3dVertexEx
 
     def __repr__(self):
-        return "\n<flags={0}, vertex={1}, bone_id={2},"\
-                " reference_count={3}>".format(
+        return "\n<flags={}, vertex=({:.{p}f}, {:.{p}f}, {:.{p}f}), bone_id={},"\
+                " reference_count={}>".format(
                 self.flags,
-                self._vertex,
+                self._vertex[0],
+                self._vertex[1],
+                self._vertex[2],
                 self.bone_id,
-                self.reference_count
+                self.reference_count,
+                p=Ms3dIo.PRECISION
                 )
 
     def __hash__(self):
@@ -450,15 +463,31 @@ class Ms3dTriangle:
         self.group_index = default_group_index
 
     def __repr__(self):
-        return "\n<flags={0}, vertex_indices={1}, vertex_normals={2}, s={3},"\
-                " t={4}, smoothing_group={5}, group_index={6}>".format(
+        return "\n<flags={}, vertex_indices={}, vertex_normals=(({:.{p}f}, "\
+                "{:.{p}f}, {:.{p}f}), ({:.{p}f}, {:.{p}f}, {:.{p}f}), ({:.{p}f}, "\
+                "{:.{p}f}, {:.{p}f})), s=({:.{p}f}, {:.{p}f}, {:.{p}f}), "\
+                "t=({:.{p}f}, {:.{p}f}, {:.{p}f}), smoothing_group={}, "\
+                "group_index={}>".format(
                 self.flags,
                 self.vertex_indices,
-                self.vertex_normals,
-                self.s,
-                self.t,
+                self.vertex_normals[0][0],
+                self.vertex_normals[0][1],
+                self.vertex_normals[0][2],
+                self.vertex_normals[1][0],
+                self.vertex_normals[1][1],
+                self.vertex_normals[1][2],
+                self.vertex_normals[2][0],
+                self.vertex_normals[2][1],
+                self.vertex_normals[2][2],
+                self.s[0],
+                self.s[1],
+                self.s[2],
+                self.t[0],
+                self.t[1],
+                self.t[2],
                 self.smoothing_group,
-                self.group_index
+                self.group_index,
+                p=Ms3dIo.PRECISION
                 )
 
 
@@ -538,8 +567,8 @@ class Ms3dGroup:
         self._comment_object = default_comment_object # Ms3dComment
 
     def __repr__(self):
-        return "\n<flags={0}, name='{1}', number_triangles={2},"\
-                " triangle_indices={3}, material_index={4}>".format(
+        return "\n<flags={}, name='{}', number_triangles={},"\
+                " triangle_indices={}, material_index={}>".format(
                 self.flags,
                 self.name,
                 self.number_triangles,
@@ -602,15 +631,15 @@ class Ms3dMaterial:
             '_comment_object', # Ms3dComment
             )
     """
-    
+
     def __init__(
             self,
             default_name="",
-            default_ambient=(0.0, 0.0, 0.0, 0.0),
-            default_diffuse=(0.0, 0.0, 0.0, 0.0),
-            default_specular=(0.0, 0.0, 0.0, 0.0),
-            default_emissive=(0.0, 0.0, 0.0, 0.0),
-            default_shininess=0.0,
+            default_ambient=list(Ms3dSpec.DEFAULT_MATERIAL_AMBIENT),
+            default_diffuse=list(Ms3dSpec.DEFAULT_MATERIAL_DIFFUSE),
+            default_specular=list(Ms3dSpec.DEFAULT_MATERIAL_SPECULAR),
+            default_emissive=list(Ms3dSpec.DEFAULT_MATERIAL_EMISSIVE),
+            default_shininess=Ms3dSpec.DEFAULT_MATERIAL_SHININESS,
             default_transparency=0.0,
             default_mode=Ms3dSpec.DEFAULT_MATERIAL_MODE,
             default_texture="",
@@ -642,19 +671,34 @@ class Ms3dMaterial:
         self._comment_object = default_comment_object # Ms3dComment
 
     def __repr__(self):
-        return "\n<name='{0}', ambient={1}, diffuse={2}, specular={3},"\
-                " emissive={4}, shininess={5}, transparency={6}, mode={7},"\
-                " texture='{8}', alphamap='{9}'>".format(
+        return "\n<name='{}', ambient=({:.{p}f}, {:.{p}f}, {:.{p}f}, {:.{p}f}), "\
+                "diffuse=({:.{p}f}, {:.{p}f}, {:.{p}f}, {:.{p}f}), specular=("\
+                "{:.{p}f}, {:.{p}f}, {:.{p}f}, {:.{p}f}), emissive=({:.{p}f}, "\
+                "{:.{p}f}, {:.{p}f}, {:.{p}f}), shininess={:.{p}f}, transparency="\
+                "{:.{p}f}, mode={}, texture='{}', alphamap='{}'>".format(
                 self.name,
-                self.ambient,
-                self.diffuse,
-                self.specular,
-                self.emissive,
+                self.ambient[0],
+                self.ambient[1],
+                self.ambient[2],
+                self.ambient[3],
+                self.diffuse[0],
+                self.diffuse[1],
+                self.diffuse[2],
+                self.diffuse[3],
+                self.specular[0],
+                self.specular[1],
+                self.specular[2],
+                self.specular[3],
+                self.emissive[0],
+                self.emissive[1],
+                self.emissive[2],
+                self.emissive[3],
                 self.shininess,
                 self.transparency,
                 self.mode,
                 self.texture,
-                self.alphamap
+                self.alphamap,
+                p=Ms3dIo.PRECISION
                 )
 
     def __hash__(self):
@@ -754,9 +798,12 @@ class Ms3dRotationKeyframe:
         self._rotation = default_rotation
 
     def __repr__(self):
-        return "\n<time={0}, rotation={1}>".format(
+        return "\n<time={:.{p}f}, rotation=({:.{p}f}, {:.{p}f}, {:.{p}f})>".format(
                 self.time,
-                self.rotation,
+                self.rotation[0],
+                self.rotation[1],
+                self.rotation[2],
+                p=Ms3dIo.PRECISION
                 )
 
 
@@ -792,9 +839,12 @@ class Ms3dTranslationKeyframe:
         self._position = default_position
 
     def __repr__(self):
-        return "\n<time={0}, position={1}>".format(
+        return "\n<time={:.{p}f}, position=({:.{p}f}, {:.{p}f}, {:.{p}f})>".format(
                 self.time,
-                self.position,
+                self.position[0],
+                self.position[1],
+                self.position[2],
+                p=Ms3dIo.PRECISION
                 )
 
 
@@ -873,19 +923,24 @@ class Ms3dJoint:
         self._joint_ex_object = default_joint_ex_object # Ms3dJointEx
 
     def __repr__(self):
-        return "\n<flags={0}, name='{1}', parent_name='{2}', rotation={3},"\
-                " position={4}, number_rotation_keyframes={5},"\
-                " number_translation_keyframes={6},"\
-                " rotation_key_frames={7}, translation_key_frames={8}>".format(
+        return "\n<flags={}, name='{}', parent_name='{}', rotation=({:.{p}f}, "\
+                "{:.{p}f}, {:.{p}f}), position=({:.{p}f}, {:.{p}f}, {:.{p}f}), "\
+                "number_rotation_keyframes={}, number_translation_keyframes={},"\
+                " rotation_key_frames={}, translation_key_frames={}>".format(
                 self.flags,
                 self.name,
                 self.parent_name,
-                self.rotation,
-                self.position,
+                self.rotation[0],
+                self.rotation[1],
+                self.rotation[2],
+                self.position[0],
+                self.position[1],
+                self.position[2],
                 self.number_rotation_keyframes,
                 self.number_translation_keyframes,
                 self.rotation_key_frames,
-                self.translation_key_frames
+                self.translation_key_frames,
+                p=Ms3dIo.PRECISION
                 )
 
 
@@ -979,7 +1034,7 @@ class Ms3dCommentEx:
         self.comment = default_comment
 
     def __repr__(self):
-        return "\n<index={0}, comment_length={1}, comment={2}>".format(
+        return "\n<index={}, comment_length={}, comment='{}'>".format(
                 self.index,
                 self.comment_length,
                 self.comment
@@ -1022,7 +1077,7 @@ class Ms3dComment:
         self.comment = default_comment
 
     def __repr__(self):
-        return "\n<comment_length={0}, comment={1}>".format(
+        return "\n<comment_length={}, comment='{}'>".format(
                 self.comment_length,
                 self.comment
                 )
@@ -1059,13 +1114,13 @@ class Ms3dVertexEx1:
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID),
-            default_weights=(0, 0, 0)
+            default_weights=(100, 0, 0)
             ):
         self._bone_ids = default_bone_ids
         self._weights = default_weights
 
     def __repr__(self):
-        return "\n<bone_ids={0}, weights={1}>".format(
+        return "\n<bone_ids={}, weights={}>".format(
                 self.bone_ids,
                 self.weights
                 )
@@ -1131,7 +1186,7 @@ class Ms3dVertexEx2:
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID),
-            default_weights=(0, 0, 0),
+            default_weights=(100, 0, 0),
             default_extra=0
             ):
         self._bone_ids = default_bone_ids
@@ -1139,7 +1194,7 @@ class Ms3dVertexEx2:
         self.extra = default_extra
 
     def __repr__(self):
-        return "\n<bone_ids={0}, weights={1}, extra={2}>".format(
+        return "\n<bone_ids={}, weights={}, extra={}>".format(
                 self.bone_ids,
                 self.weights,
                 self.extra
@@ -1218,7 +1273,7 @@ class Ms3dVertexEx3:
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID,
                     Ms3dSpec.DEFAULT_VERTEX_BONE_ID),
-            default_weights=(0, 0, 0),
+            default_weights=(100, 0, 0),
             default_extra=0
             ):
         self._bone_ids = default_bone_ids
@@ -1226,7 +1281,7 @@ class Ms3dVertexEx3:
         self.extra = default_extra
 
     def __repr__(self):
-        return "\n<bone_ids={0}, weights={1}, extra={2}>".format(
+        return "\n<bone_ids={}, weights={}, extra={}>".format(
                 self.bone_ids,
                 self.weights,
                 self.extra
@@ -1289,12 +1344,17 @@ class Ms3dJointEx:
 
     def __init__(
             self,
-            default_color=(0.0, 0.0, 0.0)
+            default_color=Ms3dSpec.DEFAULT_JOINT_COLOR
             ):
         self._color = default_color
 
     def __repr__(self):
-        return "\n<color={0}>".format(self.color)
+        return "\n<color=({:.{p}f}, {:.{p}f}, {:.{p}f})>".format(
+                self.color[0],
+                self.color[1],
+                self.color[2],
+                p=Ms3dIo.PRECISION
+                )
 
 
     @property
@@ -1331,10 +1391,11 @@ class Ms3dModelEx:
         self.alpha_ref = default_alpha_ref
 
     def __repr__(self):
-        return "\n<joint_size={0}, transparency_mode={1}, alpha_ref={2}>".format(
+        return "\n<joint_size={:.{p}f}, transparency_mode={}, alpha_ref={:.{p}f}>".format(
                 self.joint_size,
                 self.transparency_mode,
-                self.alpha_ref
+                self.alpha_ref,
+                p=Ms3dIo.PRECISION
                 )
 
     def read(self, file):
@@ -1562,85 +1623,93 @@ class Ms3dModel:
         print("## the internal data of Ms3dModel object...")
         print("##")
 
-        print("header={0}".format(self.header))
+        print("header={}".format(self.header))
 
-        print("number_vertices={0}".format(self.number_vertices))
+        print("number_vertices={}".format(self.number_vertices))
         print("vertices=[", end="")
         if self.vertices:
             for obj in self.vertices:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj), end="")
         print("]")
 
-        print("number_triangles={0}".format(self.number_triangles))
+        print("number_triangles={}".format(self.number_triangles))
         print("triangles=[", end="")
         if self.triangles:
             for obj in self.triangles:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj), end="")
         print("]")
 
-        print("number_groups={0}".format(self.number_groups))
+        print("number_groups={}".format(self.number_groups))
         print("groups=[", end="")
         if self.groups:
             for obj in self.groups:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj), end="")
         print("]")
 
-        print("number_materials={0}".format(self.number_materials))
+        print("number_materials={}".format(self.number_materials))
         print("materials=[", end="")
         if self.materials:
             for obj in self.materials:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj), end="")
         print("]")
 
-        print("animation_fps={0}".format(self.animation_fps))
-        print("current_time={0}".format(self.current_time))
-        print("number_total_frames={0}".format(self.number_total_frames))
+        print("animation_fps={}".format(self.animation_fps))
+        print("current_time={}".format(self.current_time))
+        print("number_total_frames={}".format(self.number_total_frames))
 
-        print("number_joints={0}".format(self.number_joints))
+        print("number_joints={}".format(self.number_joints))
         print("joints=[", end="")
         if self.joints:
             for obj in self.joints:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj), end="")
         print("]")
 
-        print("sub_version_comments={0}".format(self.sub_version_comments))
+        print("sub_version_comments={}".format(self.sub_version_comments))
 
-        print("number_group_comments={0}".format(self.number_group_comments))
+        print("number_group_comments={}".format(self.number_group_comments))
         print("group_comments=[", end="")
         if self.group_comments:
             for obj in self.group_comments:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj.comment_object), end="")
         print("]")
 
-        print("number_material_comments={0}".format(
+        print("number_material_comments={}".format(
                 self.number_material_comments))
         print("material_comments=[", end="")
         if self.material_comments:
             for obj in self.material_comments:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj.comment_object), end="")
         print("]")
 
-        print("number_joint_comments={0}".format(self.number_joint_comments))
+        print("number_joint_comments={}".format(self.number_joint_comments))
         print("joint_comments=[", end="")
         if self.joint_comments:
             for obj in self.joint_comments:
-                print("{0}".format(obj), end="")
+                print("{}".format(obj.comment_object), end="")
         print("]")
 
-        print("has_model_comment={0}".format(self.has_model_comment))
-        print("model_comment={0}".format(self.comment_object))
+        print("has_model_comment={}".format(self.has_model_comment))
+        print("model_comment={}".format(self.comment_object))
 
-        print("sub_version_vertex_extra={0}".format(
+        print("sub_version_vertex_extra={}".format(
                 self.sub_version_vertex_extra))
-        print("vertex_ex={0}".format(self.vertex_ex))
+        print("vertex_ex=[", end="")
+        if self.vertex_ex:
+            for obj in self.vertex_ex:
+                print("{}".format(obj), end="")
+        print("]")
 
-        print("sub_version_joint_extra={0}".format(
+        print("sub_version_joint_extra={}".format(
                 self.sub_version_joint_extra))
-        print("joint_ex={0}".format(self.joint_ex))
+        print("joint_ex=[", end="")
+        if self.joint_ex:
+            for obj in self.joint_ex:
+                print("{}".format(obj), end="")
+        print("]")
 
-        print("sub_version_model_extra={0}".format(
+        print("sub_version_model_extra={}".format(
                 self.sub_version_model_extra))
-        print("model_ex={0}".format(self.model_ex_object))
+        print("model_ex={}".format(self.model_ex_object))
 
         print("##")
         print("## ...end")
@@ -1703,6 +1772,7 @@ class Ms3dModel:
             Ms3dIo.raise_on_eof(file)
 
             _number_joints = Ms3dIo.read_word(file)
+            _progress.add('NUMBER_JOINTS')
             if (_number_joints > Ms3dSpec.MAX_JOINTS):
                 print("\nwarning, invalid count: number_joints: {}".format(
                         _number_joints))
@@ -1714,7 +1784,9 @@ class Ms3dModel:
             Ms3dIo.raise_on_eof(file)
 
             self.sub_version_comments = Ms3dIo.read_dword(file)
+            _progress.add('SUB_VERSION_COMMENTS')
             _number_group_comments = Ms3dIo.read_dword(file)
+            _progress.add('NUMBER_GROUP_COMMENTS')
             if (_number_group_comments > Ms3dSpec.MAX_GROUPS):
                 print("\nwarning, invalid count:"\
                         " number_group_comments: {}".format(
@@ -1734,6 +1806,7 @@ class Ms3dModel:
             _progress.add('GROUP_COMMENTS')
 
             _number_material_comments = Ms3dIo.read_dword(file)
+            _progress.add('NUMBER_MATERIAL_COMMENTS')
             if (_number_material_comments > Ms3dSpec.MAX_MATERIALS):
                 print("\nwarning, invalid count:"\
                         " number_material_comments: {}".format(
@@ -1754,6 +1827,7 @@ class Ms3dModel:
             _progress.add('MATERIAL_COMMENTS')
 
             _number_joint_comments = Ms3dIo.read_dword(file)
+            _progress.add('NUMBER_JOINT_COMMENTS')
             if (_number_joint_comments > Ms3dSpec.MAX_JOINTS):
                 print("\nwarning, invalid count:"\
                         " number_joint_comments: {}".format(
@@ -1773,6 +1847,7 @@ class Ms3dModel:
             _progress.add('JOINT_COMMENTS')
 
             _has_model_comment = Ms3dIo.read_dword(file)
+            _progress.add('HAS_MODEL_COMMENTS')
             if (_has_model_comment != 0):
                 self._comment_object = Ms3dComment().read(file)
             else:
@@ -1782,6 +1857,7 @@ class Ms3dModel:
             Ms3dIo.raise_on_eof(file)
 
             self.sub_version_vertex_extra = Ms3dIo.read_dword(file)
+            _progress.add('SUB_VERSION_VERTEX_EXTRA')
             if self.sub_version_vertex_extra > 0:
                 length = len(self.joints)
                 for i in range(_number_vertices):
@@ -1802,6 +1878,7 @@ class Ms3dModel:
             Ms3dIo.raise_on_eof(file)
 
             self.sub_version_joint_extra = Ms3dIo.read_dword(file)
+            _progress.add('SUB_VERSION_JOINT_EXTRA')
             if self.sub_version_joint_extra > 0:
                 for i in range(_number_joints):
                     self.joints[i]._joint_ex_object = Ms3dJointEx().read(file)
@@ -1810,6 +1887,7 @@ class Ms3dModel:
             Ms3dIo.raise_on_eof(file)
 
             self.sub_version_model_extra = Ms3dIo.read_dword(file)
+            _progress.add('SUB_VERSION_MODEL_EXTRA')
             if self.sub_version_model_extra > 0:
                 self._model_ex_object.read(file)
             _progress.add('MODEL_EXTRA')
@@ -1899,15 +1977,15 @@ class Ms3dModel:
 
             Ms3dIo.write_dword(file, self.number_group_comments)
             for i in range(self.number_group_comments):
-                self.group_comments[i].write(file)
+                self.group_comments[i].comment_object.write(file)
 
             Ms3dIo.write_dword(file, self.number_material_comments)
             for i in range(self.number_material_comments):
-                self.material_comments[i].write(file)
+                self.material_comments[i].comment_object.write(file)
 
             Ms3dIo.write_dword(file, self.number_joint_comments)
             for i in range(self.number_joint_comments):
-                self.joint_comments[i].write(file)
+                self.joint_comments[i].comment_object.write(file)
 
             Ms3dIo.write_dword(file, self.has_model_comment)
             if (self.has_model_comment != 0):
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_strings.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_strings.py
index 3233ab5..95203f8 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_strings.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_strings.py
@@ -28,6 +28,7 @@
 # initial script copyright (c)2011,2012 Alexander Nussbaumer
 #
 # ##### END COPYRIGHT BLOCK #####
+SEE_MS3D_DOC = "see MilkShape 3D documentation"
 
 ms3d_str = {
         'lang': "en-US",
@@ -35,6 +36,7 @@ ms3d_str = {
 
         ###############################
         # blender key names
+        'OBJECT_LAYER_EXTRA': "ms3d_extra_layer",
         'OBJECT_LAYER_GROUP': "ms3d_group_layer",
         'OBJECT_LAYER_SMOOTHING_GROUP': "ms3d_smoothing_group_layer",
         'OBJECT_MODIFIER_SMOOTHING_GROUP': "ms3d_smoothing_groups",
@@ -58,19 +60,23 @@ ms3d_str = {
                 " ~{1:.4}s, converter: ~{2:.4}s)",
         'SUMMARY_EXPORT': "elapsed time: {0:.4}s (converter:"\
                 " ~{1:.4}s, media io: ~{2:.4}s)",
+        'WARNING_EXPORT_SKIP_WEIGHT' : "skipped weight",
+        'WARNING_EXPORT_SKIP_WEIGHT_EX' : "skipped weight:"\
+                " limit exceeded",
 
         ###############################
-        'TEXT_OPERATOR': "MilkShape3D MS3D (.ms3d)",
+        'TEXT_OPERATOR': "MilkShape 3D (.ms3d)",
         'FILE_EXT': ".ms3d",
         'FILE_FILTER': "*.ms3d",
-        'BL_DESCRIPTION_EXPORTER': "Export to a MS3D file format (.ms3d)",
-        'BL_DESCRIPTION_IMPORTER': "Import from a MS3D file format (.ms3d)",
+        'BL_DESCRIPTION_EXPORTER': "Export to a MilkShape 3D file format (.ms3d)",
+        'BL_DESCRIPTION_IMPORTER': "Import from a MilkShape 3D file format (.ms3d)",
         'BL_LABEL_EXPORTER': "Export MS3D",
         'BL_LABEL_GROUP_OPERATOR': "MS3D - Group Collection Operator",
         'BL_LABEL_IMPORTER': "Import MS3D",
         'BL_LABEL_PANEL_SMOOTHING_GROUP': "MS3D - Smoothing Group",
         'BL_LABEL_SMOOTHING_GROUP_OPERATOR': "MS3D Set Smoothing Group"\
                 " Operator",
+        'BL_LABEL_MATERIAL_OPERATOR' : "MS3D - Copy Material Operator",
         'ENUM_ADD_GROUP_1': "Add",
         'ENUM_ADD_GROUP_2': "adds an item",
         'ENUM_ASSIGN_1': "Assign",
@@ -82,21 +88,21 @@ ms3d_str = {
         'ENUM_DESELECT_2_SMOOTHING_GROUP': "deselects all faces of selected"\
                 " smoothing group",
         'ENUM_FLAG_DIRTY_1': "Dirty",
-        'ENUM_FLAG_DIRTY_2': "[TODO]",
+        'ENUM_FLAG_DIRTY_2': SEE_MS3D_DOC,
         'ENUM_FLAG_HIDDEN_1': "Hidden",
-        'ENUM_FLAG_HIDDEN_2': "[TODO]",
+        'ENUM_FLAG_HIDDEN_2': SEE_MS3D_DOC,
         'ENUM_FLAG_ISKEY_1': "Is Key",
-        'ENUM_FLAG_ISKEY_2': "[TODO]",
+        'ENUM_FLAG_ISKEY_2': SEE_MS3D_DOC,
         'ENUM_FLAG_MARKED_1': "Marked",
-        'ENUM_FLAG_MARKED_2': "[TODO]",
+        'ENUM_FLAG_MARKED_2': SEE_MS3D_DOC,
         'ENUM_FLAG_NEWLYCREATED_1': "Newly Created",
-        'ENUM_FLAG_NEWLYCREATED_2': "[TODO]",
+        'ENUM_FLAG_NEWLYCREATED_2': SEE_MS3D_DOC,
         'ENUM_FLAG_NONE_1': "None",
-        'ENUM_FLAG_NONE_2': "[TODO]",
+        'ENUM_FLAG_NONE_2': SEE_MS3D_DOC,
         'ENUM_FLAG_SELECTED_1': "Selected",
-        'ENUM_FLAG_SELECTED_2': "[TODO]",
+        'ENUM_FLAG_SELECTED_2': SEE_MS3D_DOC,
         'ENUM_FLAG_SELECTED2_1': "Selected Ex.",
-        'ENUM_FLAG_SELECTED2_2': "[TODO]",
+        'ENUM_FLAG_SELECTED2_2': SEE_MS3D_DOC,
         'ENUM_REMOVE_1': "Remove",
         'ENUM_REMOVE_2_GROUP': "remove selected faces from selected group",
         'ENUM_REMOVE_GROUP_1': "Remove",
@@ -124,7 +130,6 @@ ms3d_str = {
         'PROP_DESC_COMMENT_JOINT': "ms3d internal raw 'comment' of Joint",
         'PROP_DESC_COMMENT_MATERIAL': "ms3d internal raw 'comment' of Material",
         'PROP_DESC_COMMENT_MODEL': "ms3d internal raw 'comment' of Model",
-        'PROP_DESC_COORDINATESYSTEM': "Select a coordinate system to export to",
         'PROP_DESC_DIFFUSE': "ms3d internal raw 'diffuse' of Material",
         'PROP_DESC_EMISSIVE': "ms3d internal raw 'emissive' of Material",
         'PROP_DESC_FLAGS_GROUP': "ms3d internal raw 'flags' of Group",
@@ -132,14 +137,10 @@ ms3d_str = {
         'PROP_DESC_GROUP_NAME': "ms3d internal raw 'name' of Group",
         'PROP_DESC_JOINT_SIZE': "ms3d internal raw 'joint_size' of Model",
         'PROP_DESC_MODE_TEXTURE': "ms3d internal raw 'mode' of Material",
-        'PROP_DESC_NAME_ARMATURE': "ms3d internal raw 'name' of Model",
+        'PROP_DESC_NAME_ARMATURE': "ms3d internal raw 'name' of Model (not used for export)",
         'PROP_DESC_NAME_JOINT': "ms3d internal raw 'name' of Joint",
         'PROP_DESC_NAME_MATERIAL': "ms3d internal raw 'name' of Material",
-        'PROP_DESC_NAME_MODEL': "ms3d internal raw 'name' of Model",
-        'PROP_DESC_OBJECTS_EXP': "What to process during export",
-        'PROP_DESC_OBJECTS_IMP': "What to process during import",
-        'PROP_DESC_SCALE': "Scale all data",
-        'PROP_DESC_SELECTED': "Export only selected mesh(es), when enabled",
+        'PROP_DESC_NAME_MODEL': "ms3d internal raw 'name' of Model (not used for export)",
         'PROP_DESC_SHININESS': "ms3d internal raw 'shininess' of Material",
         'PROP_DESC_SPECULAR': "ms3d internal raw 'specular' of Material",
         'PROP_DESC_TEXTURE': "ms3d internal raw 'texture' file name of"\
@@ -148,84 +149,76 @@ ms3d_str = {
                 " Material",
         'PROP_DESC_TRANSPARENCY_MODE': "ms3d internal raw 'transparency_mode'"\
                 " of Model",
-        'PROP_DESC_UNIT_MM': "Setup blender unit to metric [mm]",
         'PROP_DESC_VERBOSE': "Run the converter in debug mode."\
                 " Check the console for output (Warning, may be very slow)",
         'PROP_FLAG_TEXTURE_COMBINE_ALPHA_1': "Combine Alpha",
-        'PROP_FLAG_TEXTURE_COMBINE_ALPHA_2': "see MilkShape3D documents",
+        'PROP_FLAG_TEXTURE_COMBINE_ALPHA_2': SEE_MS3D_DOC,
         'PROP_FLAG_TEXTURE_HAS_ALPHA_1': "Has Alpha",
-        'PROP_FLAG_TEXTURE_HAS_ALPHA_2': "see MilkShape3D documents",
+        'PROP_FLAG_TEXTURE_HAS_ALPHA_2': SEE_MS3D_DOC,
         'PROP_FLAG_TEXTURE_SPHERE_MAP_1': "Sphere Map",
-        'PROP_FLAG_TEXTURE_SPHERE_MAP_2': "see MilkShape3D documents",
-        'PROP_ITEM_COORDINATESYSTEM_1_BY_1_1': "xyz -> xyz (1:1)",
-        'PROP_ITEM_COORDINATESYSTEM_1_BY_1_2': "Take axis as is (1:1)",
-        'PROP_ITEM_COORDINATESYSTEM_EXP_1': "xyz -> yzx (export)",
-        'PROP_ITEM_COORDINATESYSTEM_EXP_2': "swap axis to fit to viewport"\
-                " (export blender to ms3d)",
-        'PROP_ITEM_COORDINATESYSTEM_IMP_1': "yzx -> xyz (import)",
-        'PROP_ITEM_COORDINATESYSTEM_IMP_2': "swap axis to fit to viewport"\
-                " (import ms3d to blender)",
-        'PROP_ITEM_OBJECT_ANIMATION_1': "Animation **)",
-        'PROP_ITEM_OBJECT_ANIMATION_2': "keyframes",
-        'PROP_ITEM_OBJECT_GROUP_1': "Group",
-        'PROP_ITEM_OBJECT_GROUP_2': "organize all file objects to a single"\
-                " group, named with the filename",
-        'PROP_ITEM_OBJECT_JOINT_1': "Joints",
-        'PROP_ITEM_OBJECT_JOINT_2': "joints, bones",
-        'PROP_ITEM_OBJECT_MATERIAL_1': "Materials",
-        'PROP_ITEM_OBJECT_MATERIAL_2': "ambient, diffuse, specular, emissive,"\
-                " shininess, transparency, diffuse texture, alpha texture",
-        'PROP_ITEM_OBJECT_MESH_1': "Meshes",
-        'PROP_ITEM_OBJECT_MESH_2': "vertices, triangles, uv",
-        'PROP_ITEM_OBJECT_SMOOTHGROUPS_1': "Smoothing Groups",
-        'PROP_ITEM_OBJECT_SMOOTHGROUPS_2': "split mesh faces according its"\
-                " smoothing groups",
+        'PROP_FLAG_TEXTURE_SPHERE_MAP_2': SEE_MS3D_DOC,
         'PROP_MODE_TRANSPARENCY_DEPTH_BUFFERED_WITH_ALPHA_REF_1': "Depth"\
                 " Buffered with Alpha Ref",
-        'PROP_MODE_TRANSPARENCY_DEPTH_BUFFERED_WITH_ALPHA_REF_2': "see"\
-                " MilkShape3D document",
+        'PROP_MODE_TRANSPARENCY_DEPTH_BUFFERED_WITH_ALPHA_REF_2': SEE_MS3D_DOC,
         'PROP_MODE_TRANSPARENCY_DEPTH_SORTED_TRIANGLES_1': "Depth Sorted"\
                 " Triangles",
-        'PROP_MODE_TRANSPARENCY_DEPTH_SORTED_TRIANGLES_2': "see MilkShape3D"\
-                " document",
+        'PROP_MODE_TRANSPARENCY_DEPTH_SORTED_TRIANGLES_2': SEE_MS3D_DOC,
         'PROP_MODE_TRANSPARENCY_SIMPLE_1': "Simple",
-        'PROP_MODE_TRANSPARENCY_SIMPLE_2': "see MilkShape3D document",
+        'PROP_MODE_TRANSPARENCY_SIMPLE_2': SEE_MS3D_DOC,
         'PROP_NAME_ALPHA_REF': "Alpha Ref.",
         'PROP_NAME_ALPHAMAP': "Alphamap",
         'PROP_NAME_AMBIENT': "Ambient",
-        'PROP_NAME_ANIMATION': "Animation **)",
+        'PROP_NAME_ANIMATION': "Animation",
         'PROP_NAME_COLOR': "Color",
         'PROP_NAME_COMMENT': "Comment",
-        'PROP_NAME_COORDINATESYSTEM': "Coordinate system",
         'PROP_NAME_DIFFUSE': "Diffuse",
         'PROP_NAME_EMISSIVE': "Emissive",
         'PROP_NAME_FLAGS': "Flags",
         'PROP_NAME_JOINT_SIZE': "Joint Size",
         'PROP_NAME_MODE': "Mode",
         'PROP_NAME_NAME': "Name",
-        'PROP_NAME_OBJECTS_EXP': "Export processing",
-        'PROP_NAME_OBJECTS_IMP': "Import processing",
-        'PROP_NAME_SCALE': "Scale",
-        'PROP_NAME_SELECTED': "Only selected mesh(es)",
+        'PROP_NAME_ACTIVE': "Active Mesh:",
         'PROP_NAME_SHININESS': "Shininess",
         'PROP_NAME_SPECULAR': "Specular",
         'PROP_NAME_TEXTURE': "Texture",
         'PROP_NAME_TRANSPARENCY': "Transparency",
         'PROP_NAME_TRANSPARENCY_MODE': "Transp. Mode",
-        'PROP_NAME_UNIT_MM': "Metric [mm]",
         'PROP_NAME_VERBOSE': "Verbose",
         'PROP_SMOOTHING_GROUP_INDEX': "Smoothing group id",
-        'REMARKS_1': "*)   partial implemented yet",
-        'REMARKS_2': "**) not implemented yet",
-        'REMARKS_3': "***) risk of unwanted results",
-        'PROP_NAME_APPLY_MODIFIER': "Apply Modifier",
-        'PROP_DESC_APPLY_MODIFIER': "applies modifier before process",
-        'PROP_NAME_APPLY_MODIFIER_MODE': "Mode",
-        'PROP_DESC_APPLY_MODIFIER_MODE': "apply mode, if applicable",
-        'PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW_1': "Preview",
-        'PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW_2': "takes the 'preview' settings of modifier, if applicable",
-        'PROP_ITEM_APPLY_MODIFIER_MODE_RENDER_1': "Render",
-        'PROP_ITEM_APPLY_MODIFIER_MODE_RENDER_2': "takes the 'render' settings of modifier, if applicable",
+        'PROP_NAME_ROTATION_MODE' : "Bone Rotation Mode",
+        'PROP_DESC_ROTATION_MODE' : "set the preferred rotation mode of bones",
+        'PROP_ITEM_ROTATION_MODE_EULER_1' : "Euler",
+        'PROP_ITEM_ROTATION_MODE_EULER_2' : "use euler bone rotation"\
+                " (gimbal-lock can be fixed by using "\
+                "'Graph Editor -> Key -> Discontinuity (Euler) Filter')",
+        'PROP_ITEM_ROTATION_MODE_QUATERNION_1' : "Quaternion",
+        'PROP_ITEM_ROTATION_MODE_QUATERNION_2' : "use quaternion bone rotation"\
+                " (no gimbal-lock filter available!)",
+        'PROP_NAME_USE_JOINT_SIZE': "Override Joint Size",
+        'PROP_DESC_USE_JOINT_SIZE': "use value of 'Joint Size', the value of the ms3d file is ignored for representation.",
+        'PROP_NAME_IMPORT_JOINT_SIZE': "Joint Size",
+        'PROP_DESC_IMPORT_JOINT_SIZE': "size of the joint representation in blender",
+        'BL_LABEL_SET_SCENE_TO_METRIC' : "Set Scene to 'Metric' [1 mm]",
+        'BL_DESC_SET_SCENE_TO_METRIC' : "set Scene | Units to Metric (1 Unit = 1 mm),"\
+                " Display | Textured Solid,"\
+                " View | Clip (0.001 mm ... 1 km)",
+        'PROP_NAME_NORMALIZE_WEIGHTS' : "Normalize Weights",
+        'PROP_DESC_NORMALIZE_WEIGHTS' : "normalize weights to 100%, weight' = weight(i) * (weight1 + weight2 + weight3) / 100.0",
+        'PROP_NAME_SHRINK_TO_KEYS' : "Shrink To Keys",
+        'PROP_DESC_SHRINK_TO_KEYS' : "shrinks the animation to region from first keyframe to last keyframe",
+        'PROP_NAME_BAKE_EACH_FRAME' : "Bake Each Frame As Key",
+        'PROP_DESC_BAKE_EACH_FRAME' : "if enabled, to each frame there will be a key baked",
+        'LABEL_NAME_JOINT_TO_BONES' : "works only with some models!",
+        'PROP_NAME_JOINT_TO_BONES' : "Joints To Bones",
+        'PROP_DESC_JOINT_TO_BONES' : "changes the length of the bones",
+        'PROP_NAME_USE_BLENDER_NAMES' : "Use Blender Names Only",
+        'PROP_DESC_USE_BLENDER_NAMES' : "use only blender names, ignores ms3d names (bone names will always be taken from blender)",
+        'PROP_NAME_USE_BLENDER_MATERIALS' : "Use Blender Materials",
+        'PROP_DESC_USE_BLENDER_MATERIALS' : "ignores ms3d material definition (you loose some information by choosing this option)",
+        'ENUM_FROM_BLENDER_1' : "Copy From Blender",
+        'ENUM_FROM_BLENDER_2' : "takes and copies all available values from blender",
+        'ENUM_TO_BLENDER_1' : "Copy To Blender",
+        'ENUM_TO_BLENDER_2' : "copies and puts all available values to blender",
 
         'PROP_NAME_': "Name",
         'PROP_DESC_': "Description",
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_ui.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_ui.py
index 32919ff..c672aa1 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_ui.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_ui.py
@@ -35,32 +35,19 @@ from random import (
         randrange,
         )
 
-# To support reload properly, try to access a package var,
-# if it's there, reload everything
-if ('bpy' in locals()):
-    import imp
-    if 'io_scene_ms3d.ms3d_strings' in locals():
-        imp.reload(io_scene_ms3d.ms3d_strings)
-    if 'io_scene_ms3d.ms3d_spec' in locals():
-        imp.reload(io_scene_ms3d.ms3d_spec)
-    if 'io_scene_ms3d.ms3d_utils' in locals():
-        imp.reload(io_scene_ms3d.ms3d_utils)
-    #if 'io_scene_ms3d.ms3d_import' in locals():
-    #    imp.reload(io_scene_ms3d.ms3d_import)
-    #if 'io_scene_ms3d.ms3d_export' in locals():
-    #    imp.reload(io_scene_ms3d.ms3d_export)
-else:
-    from io_scene_ms3d.ms3d_strings import (
-            ms3d_str,
-            )
-    from io_scene_ms3d.ms3d_spec import (
-            Ms3dSpec,
-            )
-    from io_scene_ms3d.ms3d_utils import (
-            enable_edit_mode,
-            )
-    #from io_scene_ms3d.ms3d_import import ( Ms3dImporter, )
-    #from io_scene_ms3d.ms3d_export import ( Ms3dExporter, )
+
+# import io_scene_ms3d stuff
+from io_scene_ms3d.ms3d_strings import (
+        ms3d_str,
+        )
+from io_scene_ms3d.ms3d_spec import (
+        Ms3dSpec,
+        )
+from io_scene_ms3d.ms3d_utils import (
+        enable_edit_mode,
+        get_edge_split_modifier_add_if,
+        set_sence_to_metric,
+        )
 
 
 #import blender stuff
@@ -214,162 +201,119 @@ class Ms3dUi:
     ICON_OBJECT = 'WORLD'
     ICON_PROCESSING = 'OBJECT_DATAMODE'
     ICON_ANIMATION = 'RENDER_ANIMATION'
-
+    ICON_ROTATION_MODE = 'BONE_DATA'
+    ICON_ERROR = 'ERROR'
 
     ###########################################################################
     PROP_DEFAULT_VERBOSE = DEFAULT_VERBOSE
 
-
     ###########################################################################
-    PROP_ITEM_COORDINATESYSTEM_1BY1 = '0'
-    PROP_ITEM_COORDINATESYSTEM_IMP = '1'
-    PROP_ITEM_COORDINATESYSTEM_EXP = '2'
-    PROP_DEFAULT_COORDINATESYSTEM_IMP = PROP_ITEM_COORDINATESYSTEM_IMP
-    PROP_DEFAULT_COORDINATESYSTEM_EXP = PROP_ITEM_COORDINATESYSTEM_EXP
-
+    PROP_DEFAULT_USE_JOINT_SIZE = False
+    PROP_DEFAULT_JOINT_SIZE = 0.01
+    PROP_JOINT_SIZE_MIN = 0.01
+    PROP_JOINT_SIZE_MAX = 10.0
+    PROP_JOINT_SIZE_STEP = 0.1
+    PROP_JOINT_SIZE_PRECISION = 2
 
     ###########################################################################
-    PROP_DEFAULT_SCALE = 1.0
-    PROP_MIN_SCALE = 0.001
-    PROP_MAX_SCALE = 1000.0
-    PROP_SMIN_SCALE = 0.01
-    PROP_SMAX_SCALE = 100.0
-
+    PROP_DEFAULT_ANIMATION = True
+    PROP_DEFAULT_NORMALIZE_WEIGHTS = True
+    PROP_DEFAULT_SHRINK_TO_KEYS = False
+    PROP_DEFAULT_BAKE_EACH_FRAME = True
+    PROP_DEFAULT_JOINT_TO_BONES = False
+    PROP_DEFAULT_USE_BLENDER_NAMES = True
+    PROP_DEFAULT_USE_BLENDER_MATERIALS = False
 
     ###########################################################################
-    PROP_DEFAULT_UNIT_MM = True
-
-
-    ###########################################################################
-    PROP_DEFAULT_SELECTED = False
-
-
-    ###########################################################################
-    PROP_ITEM_OBJECT_ANIMATION = 'ANIMATION'
-    PROP_ITEM_OBJECT_GROUP = 'GROUP'
-    PROP_ITEM_OBJECT_JOINT = 'JOINT'
-    PROP_ITEM_OBJECT_MATERIAL = 'MATERIAL'
-    PROP_ITEM_OBJECT_MESH = 'MESH'
-    PROP_ITEM_OBJECT_SMOOTHGROUPS = 'SMOOTHGROUPS'
-    ###########################################################################
-    PROP_DEFAULT_OBJECTS_IMP = {
-            #PROP_ITEM_OBJECT_MESH,
-            PROP_ITEM_OBJECT_MATERIAL,
-            PROP_ITEM_OBJECT_JOINT,
-            PROP_ITEM_OBJECT_SMOOTHGROUPS,
-            PROP_ITEM_OBJECT_GROUP,
-            }
-
-
-    ###########################################################################
-    PROP_DEFAULT_OBJECTS_EXP = {
-            #PROP_ITEM_OBJECT_MESH,
-            PROP_ITEM_OBJECT_MATERIAL,
-            }
-
-
-    ###########################################################################
-    PROP_DEFAULT_ANIMATION = False
-
-    ###########################################################################
-    PROP_DEFAULT_APPLY_MODIFIER = False
-    PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW = 'PREVIEW'
-    PROP_ITEM_APPLY_MODIFIER_MODE_RENDER = 'RENDER'
-    PROP_DEFAULT_APPLY_MODIFIER_MODE = PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW
+    PROP_ITEM_ROTATION_MODE_EULER = 'EULER'
+    PROP_ITEM_ROTATION_MODE_QUATERNION = 'QUATERNION'
+    PROP_DEFAULT_ANIMATION_ROTATION = PROP_ITEM_ROTATION_MODE_EULER
 
     ###########################################################################
     OPT_SMOOTHING_GROUP_APPLY = 'io_scene_ms3d.apply_smoothing_group'
     OPT_GROUP_APPLY = 'io_scene_ms3d.apply_group'
+    OPT_MATERIAL_APPLY = 'io_scene_ms3d.apply_material'
 
 
 ###############################################################################
 class Ms3dImportOperator(Operator, ImportHelper):
     """ Load a MilkShape3D MS3D File """
-    bl_idname = 'io_scene_ms3d.import'
+    bl_idname = 'import_scene.ms3d'
     bl_label = ms3d_str['BL_LABEL_IMPORTER']
     bl_description = ms3d_str['BL_DESCRIPTION_IMPORTER']
     bl_options = {'PRESET', }
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
 
-    @staticmethod
-    def menu_func(cls, context):
-        cls.layout.operator(
-                Ms3dImportOperator.bl_idname,
-                text=ms3d_str['TEXT_OPERATOR'],
-                )
-
     filename_ext = ms3d_str['FILE_EXT']
 
     filter_glob = StringProperty(
             default=ms3d_str['FILE_FILTER'],
-            options={'HIDDEN', 'SKIP_SAVE', }
+            options={'HIDDEN', }
             )
 
     filepath = StringProperty(
             subtype='FILE_PATH',
-            options={'HIDDEN', 'SKIP_SAVE', }
+            options={'HIDDEN', }
             )
 
-    prop_verbose = BoolProperty(
+    verbose = BoolProperty(
             name=ms3d_str['PROP_NAME_VERBOSE'],
             description=ms3d_str['PROP_DESC_VERBOSE'],
             default=Ms3dUi.PROP_DEFAULT_VERBOSE,
             )
 
-    prop_coordinate_system = EnumProperty(
-            name=ms3d_str['PROP_NAME_COORDINATESYSTEM'],
-            description=ms3d_str['PROP_DESC_COORDINATESYSTEM'],
-            items=( (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_1BY1,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_1_BY_1_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_1_BY_1_2']),
-                    (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_IMP,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_IMP_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_IMP_2']),
-                    (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_EXP,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_EXP_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_EXP_2']),
-                    ),
-            default=Ms3dUi.PROP_DEFAULT_COORDINATESYSTEM_IMP,
+    animation = BoolProperty(
+            name=ms3d_str['PROP_NAME_ANIMATION'],
+            description=ms3d_str['PROP_DESC_ANIMATION'],
+            default=Ms3dUi.PROP_DEFAULT_ANIMATION,
             )
 
-    prop_scale = FloatProperty(
-            name=ms3d_str['PROP_NAME_SCALE'],
-            description=ms3d_str['PROP_DESC_SCALE'],
-            default=Ms3dUi.PROP_DEFAULT_SCALE,
-            min=Ms3dUi.PROP_MIN_SCALE,
-            max=Ms3dUi.PROP_MAX_SCALE,
-            soft_min=Ms3dUi.PROP_SMIN_SCALE,
-            soft_max=Ms3dUi.PROP_SMAX_SCALE,
+    rotation_mode = EnumProperty(
+            name=ms3d_str['PROP_NAME_ROTATION_MODE'],
+            description=ms3d_str['PROP_DESC_ROTATION_MODE'],
+            items=( (Ms3dUi.PROP_ITEM_ROTATION_MODE_EULER,
+                            ms3d_str['PROP_ITEM_ROTATION_MODE_EULER_1'],
+                            ms3d_str['PROP_ITEM_ROTATION_MODE_EULER_2']),
+                    (Ms3dUi.PROP_ITEM_ROTATION_MODE_QUATERNION,
+                            ms3d_str['PROP_ITEM_ROTATION_MODE_QUATERNION_1'],
+                            ms3d_str['PROP_ITEM_ROTATION_MODE_QUATERNION_2']),
+                    ),
+            default=Ms3dUi.PROP_DEFAULT_ANIMATION_ROTATION,
             )
 
-    prop_unit_mm = BoolProperty(
-            name=ms3d_str['PROP_NAME_UNIT_MM'],
-            description=ms3d_str['PROP_DESC_UNIT_MM'],
-            default=Ms3dUi.PROP_DEFAULT_UNIT_MM,
+    use_joint_size = BoolProperty(
+            name=ms3d_str['PROP_NAME_USE_JOINT_SIZE'],
+            description=ms3d_str['PROP_DESC_USE_JOINT_SIZE'],
+            default=Ms3dUi.PROP_DEFAULT_USE_JOINT_SIZE,
             )
 
-    prop_animation = BoolProperty(
-            name=ms3d_str['PROP_NAME_ANIMATION'],
-            description=ms3d_str['PROP_DESC_ANIMATION'],
-            default=Ms3dUi.PROP_DEFAULT_ANIMATION,
+    joint_size = FloatProperty(
+            name=ms3d_str['PROP_NAME_IMPORT_JOINT_SIZE'],
+            description=ms3d_str['PROP_DESC_IMPORT_JOINT_SIZE'],
+            min=Ms3dUi.PROP_JOINT_SIZE_MIN, max=Ms3dUi.PROP_JOINT_SIZE_MAX,
+            precision=Ms3dUi.PROP_JOINT_SIZE_PRECISION, step=Ms3dUi.PROP_JOINT_SIZE_STEP,
+            default=Ms3dUi.PROP_DEFAULT_JOINT_SIZE,
+            subtype='FACTOR',
+            #options={'HIDDEN', },
             )
 
+    joint_to_bones = BoolProperty(
+            name=ms3d_str['PROP_NAME_JOINT_TO_BONES'],
+            description=ms3d_str['PROP_DESC_JOINT_TO_BONES'],
+            default=Ms3dUi.PROP_DEFAULT_JOINT_TO_BONES,
+            )
 
-    @property
-    def is_coordinate_system_1by1(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_1BY1 \
-                in self.prop_coordinate_system)
 
     @property
-    def is_coordinate_system_import(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_IMP \
-                in self.prop_coordinate_system)
+    def is_rotation_mode_euler(self):
+        return (Ms3dUi.PROP_ITEM_ROTATION_MODE_EULER \
+                in self.rotation_mode)
 
     @property
-    def is_coordinate_system_export(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_EXP \
-                in self.prop_coordinate_system)
+    def is_rotation_mode_quaternion(self):
+        return (Ms3dUi.PROP_ITEM_ROTATION_MODE_QUATERNION \
+                in self.rotation_mode)
 
 
     # draw the option panel
@@ -378,19 +322,21 @@ class Ms3dImportOperator(Operator, ImportHelper):
 
         box = layout.box()
         box.label(ms3d_str['LABEL_NAME_OPTIONS'], icon=Ms3dUi.ICON_OPTIONS)
-        box.prop(self, 'prop_verbose', icon='SPEAKER')
-
-        box = layout.box()
-        box.label(ms3d_str['LABEL_NAME_OBJECT'], icon=Ms3dUi.ICON_OBJECT)
-        box.prop(self, 'prop_unit_mm', icon='SCENE_DATA', expand=True)
-        box.prop(self, 'prop_coordinate_system', icon='WORLD_DATA', expand=True)
-        box.prop(self, 'prop_scale', icon='MESH_DATA')
+        box.prop(self, 'verbose', icon='SPEAKER')
 
         box = layout.box()
         box.label(ms3d_str['LABEL_NAME_ANIMATION'], icon=Ms3dUi.ICON_ANIMATION)
-        box.prop(self, 'prop_animation')
-        if (self.prop_animation):
-            box.label(ms3d_str['REMARKS_2'], icon='ERROR')
+        box.prop(self, 'animation')
+        if (self.animation):
+            box.prop(self, 'rotation_mode', icon=Ms3dUi.ICON_ROTATION_MODE, expand=False)
+            box.prop(self, 'use_joint_size')
+            if (self.use_joint_size):
+                col = box.column()
+                row = col.row()
+                row.prop(self, 'joint_size')
+            box.prop(self, 'joint_to_bones')
+            if (self.joint_to_bones):
+                box.box().label(ms3d_str['LABEL_NAME_JOINT_TO_BONES'], icon=Ms3dUi.ICON_ERROR)
 
     # entrypoint for MS3D -> blender
     def execute(self, blender_context):
@@ -402,184 +348,107 @@ class Ms3dImportOperator(Operator, ImportHelper):
         blender_context.window_manager.fileselect_add(self)
         return {'RUNNING_MODAL', }
 
+    @staticmethod
+    def menu_func(cls, context):
+        cls.layout.operator(
+                Ms3dImportOperator.bl_idname,
+                text=ms3d_str['TEXT_OPERATOR'],
+                )
+
 
 class Ms3dExportOperator(Operator, ExportHelper):
     """Save a MilkShape3D MS3D File"""
-    bl_idname = 'io_scene_ms3d.export'
+    bl_idname = 'export_scene.ms3d'
     bl_label = ms3d_str['BL_LABEL_EXPORTER']
     bl_description = ms3d_str['BL_DESCRIPTION_EXPORTER']
     bl_options = {'PRESET', }
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
 
-    def menu_func(cls, context):
-        cls.layout.operator(
-                Ms3dExportOperator.bl_idname,
-                text=ms3d_str['TEXT_OPERATOR']
-                )
-
     filename_ext = ms3d_str['FILE_EXT']
 
     filter_glob = StringProperty(
             default=ms3d_str['FILE_FILTER'],
-            options={'HIDDEN', 'SKIP_SAVE', }
+            options={'HIDDEN', }
             )
 
     filepath = StringProperty(
             subtype='FILE_PATH',
-            options={'HIDDEN', 'SKIP_SAVE', }
+            options={'HIDDEN', }
             )
 
-    prop_verbose = BoolProperty(
+    verbose = BoolProperty(
             name=ms3d_str['PROP_NAME_VERBOSE'],
             description=ms3d_str['PROP_DESC_VERBOSE'],
             default=Ms3dUi.PROP_DEFAULT_VERBOSE,
             )
 
-    prop_coordinate_system = EnumProperty(
-            name=ms3d_str['PROP_NAME_COORDINATESYSTEM'],
-            description=ms3d_str['PROP_DESC_COORDINATESYSTEM'],
-            items=( (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_1BY1,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_1_BY_1_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_1_BY_1_2']),
-                    (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_IMP,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_IMP_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_IMP_2']),
-                    (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_EXP,
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_EXP_1'],
-                            ms3d_str['PROP_ITEM_COORDINATESYSTEM_EXP_2']),
-                    ),
-            default=Ms3dUi.PROP_DEFAULT_COORDINATESYSTEM_EXP,
+    use_blender_names = BoolProperty(
+            name=ms3d_str['PROP_NAME_USE_BLENDER_NAMES'],
+            description=ms3d_str['PROP_DESC_USE_BLENDER_NAMES'],
+            default=Ms3dUi.PROP_DEFAULT_USE_BLENDER_NAMES,
             )
 
-    prop_scale = FloatProperty(
-            name=ms3d_str['PROP_NAME_SCALE'],
-            description=ms3d_str['PROP_DESC_SCALE'],
-            default=1.0 / Ms3dUi.PROP_DEFAULT_SCALE,
-            min=Ms3dUi.PROP_MIN_SCALE,
-            max=Ms3dUi.PROP_MAX_SCALE,
-            soft_min=Ms3dUi.PROP_SMIN_SCALE,
-            soft_max=Ms3dUi.PROP_SMAX_SCALE,
+    use_blender_materials = BoolProperty(
+            name=ms3d_str['PROP_NAME_USE_BLENDER_MATERIALS'],
+            description=ms3d_str['PROP_DESC_USE_BLENDER_MATERIALS'],
+            default=Ms3dUi.PROP_DEFAULT_USE_BLENDER_MATERIALS,
             )
 
-    prop_objects = EnumProperty(
-            name=ms3d_str['PROP_NAME_OBJECTS_EXP'],
-            description=ms3d_str['PROP_DESC_OBJECTS_EXP'],
-            items=( #(Ms3dUi.PROP_ITEM_OBJECT_MESH,
-                    #        ms3d_str['PROP_ITEM_OBJECT_MESH_1'],
-                    #        ms3d_str['PROP_ITEM_OBJECT_MESH_2']),
-                    (Ms3dUi.PROP_ITEM_OBJECT_MATERIAL,
-                            ms3d_str['PROP_ITEM_OBJECT_MATERIAL_1'],
-                            ms3d_str['PROP_ITEM_OBJECT_MATERIAL_2']),
-                    (Ms3dUi.PROP_ITEM_OBJECT_JOINT,
-                            ms3d_str['PROP_ITEM_OBJECT_JOINT_1'],
-                            ms3d_str['PROP_ITEM_OBJECT_JOINT_2']),
-                    #(Ms3dUi.PROP_ITEM_OBJECT_ANIMATION,
-                    #        ms3d_str['PROP_ITEM_OBJECT_ANIMATION_1'],
-                    #        ms3d_str['PROP_ITEM_OBJECT_ANIMATION_2']),
-                    ),
-            default=Ms3dUi.PROP_DEFAULT_OBJECTS_EXP,
-            options={'ENUM_FLAG', 'ANIMATABLE', },
-            )
-
-    prop_selected = BoolProperty(
-            name=ms3d_str['PROP_NAME_SELECTED'],
-            description=ms3d_str['PROP_DESC_SELECTED'],
-            default=Ms3dUi.PROP_DEFAULT_SELECTED,
+    normalize_weights = BoolProperty(
+            name=ms3d_str['PROP_NAME_NORMALIZE_WEIGHTS'],
+            description=ms3d_str['PROP_DESC_NORMALIZE_WEIGHTS'],
+            default=Ms3dUi.PROP_DEFAULT_NORMALIZE_WEIGHTS,
             )
 
-    prop_animation = BoolProperty(
-            name=ms3d_str['PROP_NAME_ANIMATION'],
-            description=ms3d_str['PROP_DESC_ANIMATION'],
-            default=Ms3dUi.PROP_DEFAULT_ANIMATION,
+    shrink_to_keys = BoolProperty(
+            name=ms3d_str['PROP_NAME_SHRINK_TO_KEYS'],
+            description=ms3d_str['PROP_DESC_SHRINK_TO_KEYS'],
+            default=Ms3dUi.PROP_DEFAULT_SHRINK_TO_KEYS,
             )
 
-    prop_apply_modifier = BoolProperty(
-            name=ms3d_str['PROP_NAME_APPLY_MODIFIER'],
-            description=ms3d_str['PROP_DESC_APPLY_MODIFIER'],
-            default=Ms3dUi.PROP_DEFAULT_APPLY_MODIFIER,
-            )
-    prop_apply_modifier_mode = EnumProperty(
-            name=ms3d_str['PROP_NAME_APPLY_MODIFIER_MODE'],
-            description=ms3d_str['PROP_DESC_APPLY_MODIFIER_MODE'],
-            items=( (Ms3dUi.PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW,
-                            ms3d_str['PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW_1'],
-                            ms3d_str['PROP_ITEM_APPLY_MODIFIER_MODE_PREVIEW_2']),
-                    (Ms3dUi.PROP_ITEM_APPLY_MODIFIER_MODE_RENDER,
-                            ms3d_str['PROP_ITEM_APPLY_MODIFIER_MODE_RENDER_1'],
-                            ms3d_str['PROP_ITEM_APPLY_MODIFIER_MODE_RENDER_2']),
-                    ),
-            default=Ms3dUi.PROP_DEFAULT_APPLY_MODIFIER_MODE,
+    bake_each_frame = BoolProperty(
+            name=ms3d_str['PROP_NAME_BAKE_EACH_FRAME'],
+            description=ms3d_str['PROP_DESC_BAKE_EACH_FRAME'],
+            default=Ms3dUi.PROP_DEFAULT_BAKE_EACH_FRAME,
             )
 
-    @property
-    def handle_animation(self):
-        return (Ms3dUi.PROP_ITEM_OBJECT_ANIMATION in self.prop_objects)
-
-    @property
-    def handle_materials(self):
-        return (Ms3dUi.PROP_ITEM_OBJECT_MATERIAL in self.prop_objects)
-
-    @property
-    def handle_joints(self):
-        return (Ms3dUi.PROP_ITEM_OBJECT_JOINT in self.prop_objects)
-
-    @property
-    def handle_smoothing_groups(self):
-        return (Ms3dUi.PROP_ITEM_OBJECT_SMOOTHGROUPS in self.prop_objects)
-
-    @property
-    def handle_groups(self):
-        return (Ms3dUi.PROP_ITEM_OBJECT_GROUP in self.prop_objects)
-
-
-    @property
-    def is_coordinate_system_1by1(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_1BY1 \
-                in self.prop_coordinate_system)
-
-    @property
-    def is_coordinate_system_import(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_IMP \
-                in self.prop_coordinate_system)
-
-    @property
-    def is_coordinate_system_export(self):
-        return (Ms3dUi.PROP_ITEM_COORDINATESYSTEM_EXP \
-                in self.prop_coordinate_system)
 
+    ##EXPORT_ACTIVE_ONLY:
+    ##limit availability to only active mesh object
+    @classmethod
+    def poll(cls, context):
+        return (context
+                and context.active_object
+                and context.active_object.type in {'MESH', }
+                and context.active_object.data
+                and context.active_object.data.ms3d is not None
+                )
 
     # draw the option panel
     def draw(self, context):
         layout = self.layout
 
-        # DEBUG:
-        layout.row().label(ms3d_str['REMARKS_2'], icon='ERROR')
-
         box = layout.box()
         box.label(ms3d_str['LABEL_NAME_OPTIONS'], icon=Ms3dUi.ICON_OPTIONS)
-        box.prop(self, 'prop_verbose', icon='SPEAKER')
-
-        box = layout.box()
-        box.label(ms3d_str['LABEL_NAME_OBJECT'], icon=Ms3dUi.ICON_OBJECT)
-        box.prop(self, 'prop_coordinate_system', icon='WORLD_DATA', expand=True)
-        box.prop(self, 'prop_scale', icon='MESH_DATA')
+        box.prop(self, 'verbose', icon='SPEAKER')
 
         box = layout.box()
         box.label(ms3d_str['LABEL_NAME_PROCESSING'],
                 icon=Ms3dUi.ICON_PROCESSING)
-        box.prop(self, 'prop_selected', icon='ROTACTIVE')
-        """
-        box.prop(self, 'prop_objects', icon='MESH_DATA', expand=True)
-
-        if (Ms3dUi.PROP_ITEM_OBJECT_JOINT in self.prop_objects):
-            box.label(ms3d_str['REMARKS_2'], icon='ERROR')
+        row = box.row()
+        row.label(ms3d_str['PROP_NAME_ACTIVE'], icon='ROTACTIVE')
+        row.label(context.active_object.name)
+        #box.prop(self, 'use_blender_names', icon='LINK_BLEND')
+        box.prop(self, 'use_blender_names')
+        box.prop(self, 'use_blender_materials')
 
-            box = layout.box()
-            box.label(ms3d_str['LABEL_NAME_ANIMATION'],
-                    icon=Ms3dUi.ICON_ANIMATION)
-            box.prop(self, 'prop_animation')
-        """
+        box = layout.box()
+        box.label(ms3d_str['LABEL_NAME_ANIMATION'],
+                icon=Ms3dUi.ICON_ANIMATION)
+        box.prop(self, 'normalize_weights')
+        box.prop(self, 'shrink_to_keys')
+        box.prop(self, 'bake_each_frame')
 
     # entrypoint for blender -> MS3D
     def execute(self, blender_context):
@@ -592,6 +461,13 @@ class Ms3dExportOperator(Operator, ExportHelper):
         blender_context.window_manager.fileselect_add(self)
         return {"RUNNING_MODAL", }
 
+    @staticmethod
+    def menu_func(cls, context):
+        cls.layout.operator(
+                Ms3dExportOperator.bl_idname,
+                text=ms3d_str['TEXT_OPERATOR']
+                )
+
 
 ###############################################################################
 ##
@@ -638,15 +514,7 @@ class Ms3dSetSmoothingGroupOperator(Operator):
                 layer_smoothing_group = bm.faces.layers.int.new(
                         ms3d_str['OBJECT_LAYER_SMOOTHING_GROUP'])
                 blender_mesh_object = context.object
-                blender_modifier = blender_mesh_object.modifiers.get(
-                        ms3d_str['OBJECT_MODIFIER_SMOOTHING_GROUP'])
-                if blender_modifier is None:
-                    blender_modifier = blender_mesh_object.modifiers.new(
-                            ms3d_str['OBJECT_MODIFIER_SMOOTHING_GROUP'],
-                            type='EDGE_SPLIT')
-                    blender_modifier.show_expanded = False
-                    blender_modifier.use_edge_angle = False
-                    blender_modifier.use_edge_sharp = True
+                get_edge_split_modifier_add_if(blender_mesh_object)
             blender_face_list = []
             for bmf in bm.faces:
                 if not bmf.smooth:
@@ -774,6 +642,53 @@ class Ms3dGroupOperator(Operator):
         return {'FINISHED', }
 
 
+class Ms3dMaterialOperator(Operator):
+    bl_idname = Ms3dUi.OPT_MATERIAL_APPLY
+    bl_label = ms3d_str['BL_LABEL_MATERIAL_OPERATOR']
+    bl_options = {'INTERNAL', }
+
+    mode = EnumProperty(
+            items=( ('', "", ""),
+                    ('FROM_BLENDER',
+                            ms3d_str['ENUM_FROM_BLENDER_1'],
+                            ms3d_str['ENUM_FROM_BLENDER_2']),
+                    ('TO_BLENDER',
+                            ms3d_str['ENUM_TO_BLENDER_1'],
+                            ms3d_str['ENUM_TO_BLENDER_2']),
+                    ),
+            options={'HIDDEN', 'SKIP_SAVE', },
+            )
+
+    @classmethod
+    def poll(cls, context):
+        return (context
+                and context.object
+                and context.object.type in {'MESH', }
+                and context.object.data
+                and context.object.data.ms3d is not None
+                and context.material
+                and context.material.ms3d is not None
+                )
+
+    def execute(self, context):
+        blender_material = context.active_object.active_material
+        ms3d_material = blender_material.ms3d
+
+        if self.mode == 'FROM_BLENDER':
+            Ms3dMaterialHelper.copy_from_blender(self, context, ms3d_material, blender_material)
+            pass
+
+        elif self.mode == 'TO_BLENDER':
+            # not implemented
+            pass
+
+        return {'FINISHED', }
+
+    # entrypoint for option via UI
+    def invoke(self, context, event):
+        return context.window_manager.invoke_props_dialog(self)
+
+
 ###############################################################################
 class Ms3dGroupProperties(PropertyGroup):
     name = StringProperty(
@@ -848,8 +763,9 @@ class Ms3dModelProperties(PropertyGroup):
     joint_size = FloatProperty(
             name=ms3d_str['PROP_NAME_JOINT_SIZE'],
             description=ms3d_str['PROP_DESC_JOINT_SIZE'],
-            min=0, max=1, precision=3, step=0.1,
-            default=Ms3dSpec.DEFAULT_MODEL_JOINT_SIZE,
+            min=Ms3dUi.PROP_JOINT_SIZE_MIN, max=Ms3dUi.PROP_JOINT_SIZE_MAX,
+            precision=Ms3dUi.PROP_JOINT_SIZE_PRECISION, step=Ms3dUi.PROP_JOINT_SIZE_STEP,
+            default=Ms3dUi.PROP_DEFAULT_JOINT_SIZE,
             subtype='FACTOR',
             #options={'HIDDEN', },
             )
@@ -1006,7 +922,7 @@ class Ms3dJointProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_COLOR'],
             description=ms3d_str['PROP_DESC_COLOR_JOINT'],
             subtype='COLOR', size=3, min=0, max=1, precision=3, step=0.1,
-            default=(0.8, 0.8, 0.8),
+            default=Ms3dSpec.DEFAULT_JOINT_COLOR,
             #options={'HIDDEN', },
             )
 
@@ -1020,38 +936,87 @@ class Ms3dJointProperties(PropertyGroup):
 
 class Ms3dMaterialHelper:
     @staticmethod
-    def on_update_ambient(cls, context):
+    def copy_to_blender_ambient(cls, context):
         pass
 
     @staticmethod
-    def on_update_diffuse(cls, context):
+    def copy_to_blender_diffuse(cls, context):
         cls.id_data.diffuse_color = cls.diffuse[0:3]
-        cls.id_data.diffuse_intensity = cls.diffuse[3]
+        #cls.id_data.diffuse_intensity = cls.diffuse[3]
         pass
 
     @staticmethod
-    def on_update_specular(cls, context):
+    def copy_to_blender_specular(cls, context):
         cls.id_data.specular_color = cls.specular[0:3]
-        cls.id_data.specular_intensity = cls.specular[3]
+        #cls.id_data.specular_intensity = cls.specular[3]
         pass
 
     @staticmethod
-    def on_update_emissive(cls, context):
+    def copy_to_blender_emissive(cls, context):
         cls.id_data.emit = (cls.emissive[0] + cls.emissive[1] \
                 + cls.emissive[2]) / 3.0
         pass
 
     @staticmethod
-    def on_update_shininess(cls, context):
+    def copy_to_blender_shininess(cls, context):
         cls.id_data.specular_hardness = cls.shininess * 4.0
         pass
 
     @staticmethod
-    def on_update_transparency(cls, context):
-        cls.id_data.alpha = cls.transparency
+    def copy_to_blender_transparency(cls, context):
+        cls.id_data.alpha = 1.0 - cls.transparency
         pass
 
 
+    @staticmethod
+    def copy_from_blender(cls, context, ms3d_material, blender_material):
+        # copy, bacause of auto update, it would distord original values
+        blender_material_diffuse_color = blender_material.diffuse_color.copy()
+        blender_material_diffuse_intensity = blender_material.diffuse_intensity
+        blender_material_specular_color = blender_material.specular_color.copy()
+        blender_material_specular_intensity = blender_material.specular_intensity
+        blender_material_emit = blender_material.emit
+        blender_material_specular_hardness = blender_material.specular_hardness
+        blender_material_alpha = blender_material.alpha
+
+        blender_material_texture = None
+        for slot in blender_material.texture_slots:
+            if slot and slot.use_map_color_diffuse and slot.texture.type == 'IMAGE':
+                blender_material_texture = slot.texture.image.filepath
+                break
+
+        blender_material_alphamap = None
+        for slot in blender_material.texture_slots:
+            if slot and not slot.use_map_color_diffuse and slot.use_map_alpha and slot.texture.type == 'IMAGE':
+                blender_material_alphamap = slot.texture.image.filepath
+                break
+
+        ms3d_material.diffuse[0] = blender_material_diffuse_color[0]
+        ms3d_material.diffuse[1] = blender_material_diffuse_color[1]
+        ms3d_material.diffuse[2] = blender_material_diffuse_color[2]
+        ms3d_material.diffuse[3] = 1.0
+        ms3d_material.specular[0] = blender_material_specular_color[0]
+        ms3d_material.specular[1] = blender_material_specular_color[1]
+        ms3d_material.specular[2] = blender_material_specular_color[2]
+        ms3d_material.specular[3] = 1.0
+        ms3d_material.emissive[0] = blender_material_emit
+        ms3d_material.emissive[1] = blender_material_emit
+        ms3d_material.emissive[2] = blender_material_emit
+        ms3d_material.emissive[3] = 1.0
+        ms3d_material.shininess = blender_material_specular_hardness / 4.0
+        ms3d_material.transparency = 1.0 - blender_material_alpha
+
+        if blender_material_texture:
+            ms3d_material.texture = blender_material_texture
+        else:
+            ms3d_material.texture = ""
+
+        if blender_material_alphamap:
+            ms3d_material.alphamap = blender_material_alphamap
+        else:
+            ms3d_material.alphamap = ""
+
+
 class Ms3dMaterialProperties(PropertyGroup):
     name = StringProperty(
             name=ms3d_str['PROP_NAME_NAME'],
@@ -1064,8 +1029,8 @@ class Ms3dMaterialProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_AMBIENT'],
             description=ms3d_str['PROP_DESC_AMBIENT'],
             subtype='COLOR', size=4, min=0, max=1, precision=3, step=0.1,
-            default=(0.2, 0.2, 0.2, 1.0), # OpenGL default for ambient
-            update=Ms3dMaterialHelper.on_update_ambient,
+            default=Ms3dSpec.DEFAULT_MATERIAL_AMBIENT,
+            update=Ms3dMaterialHelper.copy_to_blender_ambient,
             #options={'HIDDEN', },
             )
 
@@ -1073,8 +1038,8 @@ class Ms3dMaterialProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_DIFFUSE'],
             description=ms3d_str['PROP_DESC_DIFFUSE'],
             subtype='COLOR', size=4, min=0, max=1, precision=3, step=0.1,
-            default=(0.8, 0.8, 0.8, 1.0), # OpenGL default for diffuse
-            update=Ms3dMaterialHelper.on_update_diffuse,
+            default=Ms3dSpec.DEFAULT_MATERIAL_DIFFUSE,
+            update=Ms3dMaterialHelper.copy_to_blender_diffuse,
             #options={'HIDDEN', },
             )
 
@@ -1082,8 +1047,8 @@ class Ms3dMaterialProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_SPECULAR'],
             description=ms3d_str['PROP_DESC_SPECULAR'],
             subtype='COLOR', size=4, min=0, max=1, precision=3, step=0.1,
-            default=(0.0, 0.0, 0.0, 1.0), # OpenGL default for specular
-            update=Ms3dMaterialHelper.on_update_specular,
+            default=Ms3dSpec.DEFAULT_MATERIAL_SPECULAR,
+            update=Ms3dMaterialHelper.copy_to_blender_specular,
             #options={'HIDDEN', },
             )
 
@@ -1091,8 +1056,8 @@ class Ms3dMaterialProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_EMISSIVE'],
             description=ms3d_str['PROP_DESC_EMISSIVE'],
             subtype='COLOR', size=4, min=0, max=1, precision=3, step=0.1,
-            default=(0.0, 0.0, 0.0, 1.0), # OpenGL default for emissive
-            update=Ms3dMaterialHelper.on_update_emissive,
+            default=Ms3dSpec.DEFAULT_MATERIAL_EMISSIVE,
+            update=Ms3dMaterialHelper.copy_to_blender_emissive,
             #options={'HIDDEN', },
             )
 
@@ -1100,9 +1065,9 @@ class Ms3dMaterialProperties(PropertyGroup):
             name=ms3d_str['PROP_NAME_SHININESS'],
             description=ms3d_str['PROP_DESC_SHININESS'],
             min=0, max=Ms3dSpec.MAX_MATERIAL_SHININESS, precision=3, step=0.1,
-            default=0,
+            default=Ms3dSpec.DEFAULT_MATERIAL_SHININESS,
             subtype='FACTOR',
-            update=Ms3dMaterialHelper.on_update_shininess,
+            update=Ms3dMaterialHelper.copy_to_blender_shininess,
             #options={'HIDDEN', },
             )
 
@@ -1112,7 +1077,7 @@ class Ms3dMaterialProperties(PropertyGroup):
             min=0, max=1, precision=3, step=0.1,
             default=0,
             subtype='FACTOR',
-            update=Ms3dMaterialHelper.on_update_transparency,
+            update=Ms3dMaterialHelper.copy_to_blender_transparency,
             #options={'HIDDEN', },
             )
 
@@ -1230,8 +1195,8 @@ class Ms3dMaterialPanel(Panel):
 
         col = layout.column()
         row = col.row()
-        row.prop(custom_data, 'ambient')
         row.prop(custom_data, 'diffuse')
+        row.prop(custom_data, 'ambient')
         row = col.row()
         row.prop(custom_data, 'specular')
         row.prop(custom_data, 'emissive')
@@ -1250,6 +1215,16 @@ class Ms3dMaterialPanel(Panel):
         row = layout.row()
         row.prop(custom_data, 'comment')
 
+        layout.row().operator(
+                Ms3dUi.OPT_MATERIAL_APPLY,
+                text=ms3d_str['ENUM_FROM_BLENDER_1'], icon='APPEND_BLEND').mode = 'FROM_BLENDER'
+
+        # not implemented
+        #layout.row().operator(
+        #        Ms3dUi.OPT_MATERIAL_APPLY,
+        #        text=ms3d_str['ENUM_TO_BLENDER_1'], icon='IMPORT').mode = 'TO_BLENDER'
+        pass
+
 
 class Ms3dBonePanel(Panel):
     bl_label = ms3d_str['LABEL_PANEL_JOINTS']
@@ -1307,6 +1282,8 @@ class Ms3dGroupPanel(Panel):
     def draw(self, context):
         layout = self.layout
         custom_data = context.object.data.ms3d
+        layout.enabled = (context.mode == 'EDIT_MESH') and (
+                context.tool_settings.mesh_select_mode[2])
 
         row = layout.row()
         row.template_list(
@@ -1331,23 +1308,21 @@ class Ms3dGroupPanel(Panel):
             row = layout.row()
             row.prop(collection[index], 'name')
 
-            if (context.mode == 'EDIT_MESH') and (
-                    context.tool_settings.mesh_select_mode[2]):
-                row = layout.row()
-                subrow = row.row(align=True)
-                subrow.operator(
-                        Ms3dUi.OPT_GROUP_APPLY,
-                        text=ms3d_str['ENUM_ASSIGN_1']).mode = 'ASSIGN'
-                subrow.operator(
-                        Ms3dUi.OPT_GROUP_APPLY,
-                        text=ms3d_str['ENUM_REMOVE_1']).mode = 'REMOVE'
-                subrow = row.row(align=True)
-                subrow.operator(
-                        Ms3dUi.OPT_GROUP_APPLY,
-                        text=ms3d_str['ENUM_SELECT_1']).mode = 'SELECT'
-                subrow.operator(
-                        Ms3dUi.OPT_GROUP_APPLY,
-                        text=ms3d_str['ENUM_DESELECT_1']).mode = 'DESELECT'
+            row = layout.row()
+            subrow = row.row(align=True)
+            subrow.operator(
+                    Ms3dUi.OPT_GROUP_APPLY,
+                    text=ms3d_str['ENUM_ASSIGN_1']).mode = 'ASSIGN'
+            subrow.operator(
+                    Ms3dUi.OPT_GROUP_APPLY,
+                    text=ms3d_str['ENUM_REMOVE_1']).mode = 'REMOVE'
+            subrow = row.row(align=True)
+            subrow.operator(
+                    Ms3dUi.OPT_GROUP_APPLY,
+                    text=ms3d_str['ENUM_SELECT_1']).mode = 'SELECT'
+            subrow.operator(
+                    Ms3dUi.OPT_GROUP_APPLY,
+                    text=ms3d_str['ENUM_DESELECT_1']).mode = 'DESELECT'
 
             row = layout.row()
             row.prop(collection[index], 'flags', expand=True)
@@ -1410,303 +1385,184 @@ class Ms3dSmoothingGroupPanel(Panel):
 
         custom_data = context.object.data.ms3d
         layout = self.layout
+        layout.enabled = (context.mode == 'EDIT_MESH') and (
+                context.tool_settings.mesh_select_mode[2])
 
-        if True:
-            row = layout.row()
-            row.enabled = (context.mode == 'EDIT_MESH') and (
-                    context.tool_settings.mesh_select_mode[2])
-            subrow = row.row()
-            subrow.prop(custom_data, 'apply_mode', expand=True)
+        row = layout.row()
+        subrow = row.row()
+        subrow.prop(custom_data, 'apply_mode', expand=True)
+
+        col = layout.column(align=True)
+        subrow = col.row(align=True)
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 1, "1")
+                ).smoothing_group_index = 1
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 2, "2")
+                ).smoothing_group_index = 2
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 3, "3")
+                ).smoothing_group_index = 3
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 4, "4")
+                ).smoothing_group_index = 4
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 5, "5")
+                ).smoothing_group_index = 5
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 6, "6")
+                ).smoothing_group_index = 6
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 7, "7")
+                ).smoothing_group_index = 7
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 8, "8")
+                ).smoothing_group_index = 8
+        subrow = col.row(align=True)
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 9, "9")
+                ).smoothing_group_index = 9
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 10, "10")
+                ).smoothing_group_index = 10
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 11, "11")
+                ).smoothing_group_index = 11
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 12, "12")
+                ).smoothing_group_index = 12
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 13, "13")
+                ).smoothing_group_index = 13
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 14, "14")
+                ).smoothing_group_index = 14
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 15, "15")
+                ).smoothing_group_index = 15
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 16, "16")
+                ).smoothing_group_index = 16
+        subrow = col.row(align=True)
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 17, "17")
+                ).smoothing_group_index = 17
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 18, "18")
+                ).smoothing_group_index = 18
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 19, "19")
+                ).smoothing_group_index = 19
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 20, "20")
+                ).smoothing_group_index = 20
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 21, "21")
+                ).smoothing_group_index = 21
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 22, "22")
+                ).smoothing_group_index = 22
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 23, "23")
+                ).smoothing_group_index = 23
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 24, "24")
+                ).smoothing_group_index = 24
+        subrow = col.row(align=True)
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 25, "25")
+                ).smoothing_group_index = 25
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 26, "26")
+                ).smoothing_group_index = 26
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 27, "27")
+                ).smoothing_group_index = 27
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 28, "28")
+                ).smoothing_group_index = 28
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 29, "29")
+                ).smoothing_group_index = 29
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 30, "30")
+                ).smoothing_group_index = 30
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 31, "31")
+                ).smoothing_group_index = 31
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 32, "32")
+                ).smoothing_group_index = 32
+        subrow = col.row()
+        subrow.operator(
+                Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
+                text=self.preview(dict, 0, ms3d_str['LABEL_PANEL_BUTTON_NONE'])
+                ).smoothing_group_index = 0
 
-            col = layout.column(align=True)
-            subrow = col.row(align=True)
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 1, "1")
-                    ).smoothing_group_index = 1
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 2, "2")
-                    ).smoothing_group_index = 2
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 3, "3")
-                    ).smoothing_group_index = 3
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 4, "4")
-                    ).smoothing_group_index = 4
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 5, "5")
-                    ).smoothing_group_index = 5
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 6, "6")
-                    ).smoothing_group_index = 6
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 7, "7")
-                    ).smoothing_group_index = 7
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 8, "8")
-                    ).smoothing_group_index = 8
-            subrow = col.row(align=True)
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 9, "9")
-                    ).smoothing_group_index = 9
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 10, "10")
-                    ).smoothing_group_index = 10
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 11, "11")
-                    ).smoothing_group_index = 11
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 12, "12")
-                    ).smoothing_group_index = 12
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 13, "13")
-                    ).smoothing_group_index = 13
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 14, "14")
-                    ).smoothing_group_index = 14
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 15, "15")
-                    ).smoothing_group_index = 15
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 16, "16")
-                    ).smoothing_group_index = 16
-            subrow = col.row(align=True)
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 17, "17")
-                    ).smoothing_group_index = 17
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 18, "18")
-                    ).smoothing_group_index = 18
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 19, "19")
-                    ).smoothing_group_index = 19
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 20, "20")
-                    ).smoothing_group_index = 20
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 21, "21")
-                    ).smoothing_group_index = 21
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 22, "22")
-                    ).smoothing_group_index = 22
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 23, "23")
-                    ).smoothing_group_index = 23
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 24, "24")
-                    ).smoothing_group_index = 24
-            subrow = col.row(align=True)
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 25, "25")
-                    ).smoothing_group_index = 25
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 26, "26")
-                    ).smoothing_group_index = 26
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 27, "27")
-                    ).smoothing_group_index = 27
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 28, "28")
-                    ).smoothing_group_index = 28
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 29, "29")
-                    ).smoothing_group_index = 29
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 30, "30")
-                    ).smoothing_group_index = 30
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 31, "31")
-                    ).smoothing_group_index = 31
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 32, "32")
-                    ).smoothing_group_index = 32
-            subrow = col.row()
-            subrow.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 0, ms3d_str['LABEL_PANEL_BUTTON_NONE'])
-                    ).smoothing_group_index = 0
-        else:
-            col = layout.column()
-            #box = col.box()
-            col.enabled = (context.mode == 'EDIT_MESH') and (
-                    context.tool_settings.mesh_select_mode[2])
-            row = col.row()
-            row.prop(custom_data, 'apply_mode', expand=True)
-
-            col = col.column(align=True)
-            row = col.row(align=True)
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 1, "1")
-                    ).smoothing_group_index = 1
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 2, "2")
-                    ).smoothing_group_index = 2
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 3, "3")
-                    ).smoothing_group_index = 3
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 4, "4")
-                    ).smoothing_group_index = 4
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 5, "5")
-                    ).smoothing_group_index = 5
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 6, "6")
-                    ).smoothing_group_index = 6
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 7, "7")
-                    ).smoothing_group_index = 7
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 8, "8")
-                    ).smoothing_group_index = 8
-            row = col.row(align=True)
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 9, "9")
-                    ).smoothing_group_index = 9
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 10, "10")
-                    ).smoothing_group_index = 10
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 11, "11")
-                    ).smoothing_group_index = 11
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 12, "12")
-                    ).smoothing_group_index = 12
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 13, "13")
-                    ).smoothing_group_index = 13
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 14, "14")
-                    ).smoothing_group_index = 14
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 15, "15")
-                    ).smoothing_group_index = 15
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 16, "16")
-                    ).smoothing_group_index = 16
-            row = col.row(align=True)
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 17, "17")
-                    ).smoothing_group_index = 17
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 18, "18")
-                    ).smoothing_group_index = 18
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 19, "19")
-                    ).smoothing_group_index = 19
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 20, "20")
-                    ).smoothing_group_index = 20
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 21, "21")
-                    ).smoothing_group_index = 21
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 22, "22")
-                    ).smoothing_group_index = 22
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 23, "23")
-                    ).smoothing_group_index = 23
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 24, "24")
-                    ).smoothing_group_index = 24
-            row = col.row(align=True)
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 25, "25")
-                    ).smoothing_group_index = 25
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 26, "26")
-                    ).smoothing_group_index = 26
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 27, "27")
-                    ).smoothing_group_index = 27
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 28, "28")
-                    ).smoothing_group_index = 28
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 29, "29")
-                    ).smoothing_group_index = 29
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 30, "30")
-                    ).smoothing_group_index = 30
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 31, "31")
-                    ).smoothing_group_index = 31
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 32, "32")
-                    ).smoothing_group_index = 32
-            row = col.row()
-            row.operator(
-                    Ms3dUi.OPT_SMOOTHING_GROUP_APPLY,
-                    text=self.preview(dict, 0, ms3d_str['LABEL_PANEL_BUTTON_NONE'])
-                    ).smoothing_group_index = 0
 
+###############################################################################
+class Ms3dSetSceneToMetricOperator(Operator):
+    """ . """
+    bl_idname = 'io_scene_ms3d.set_sence_to_metric'
+    bl_label = ms3d_str['BL_LABEL_SET_SCENE_TO_METRIC']
+    bl_description = ms3d_str['BL_DESC_SET_SCENE_TO_METRIC']
+
+
+    #
+    @classmethod
+    def poll(cls, context):
+        return True
+
+    # entrypoint for option
+    def execute(self, context):
+        return self.set_sence_to_metric(context)
+
+    # entrypoint for option via UI
+    def invoke(self, context, event):
+        return context.window_manager.invoke_props_dialog(self)
+
+
+    ###########################################################################
+    def set_sence_to_metric(self, context):
+        set_sence_to_metric(context)
+        return {"FINISHED"}
 
 
 ###############################################################################
 def register():
+    register_class(Ms3dSetSceneToMetricOperator)
     register_class(Ms3dGroupProperties)
     register_class(Ms3dModelProperties)
     register_class(Ms3dArmatureProperties)
@@ -1725,6 +1581,7 @@ def unregister():
     unregister_class(Ms3dArmatureProperties)
     unregister_class(Ms3dModelProperties)
     unregister_class(Ms3dGroupProperties)
+    unregister_class(Ms3dSetSceneToMetricOperator)
 
 def inject_properties():
     Mesh.ms3d = PointerProperty(type=Ms3dModelProperties)
@@ -1743,7 +1600,6 @@ def delete_properties():
     del Group.ms3d
 
 ###############################################################################
-register()
 
 
 ###############################################################################
diff --git a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_utils.py b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_utils.py
index 7b42360..44b579c 100644
--- a/release/scripts/addons_contrib/io_scene_ms3d/ms3d_utils.py
+++ b/release/scripts/addons_contrib/io_scene_ms3d/ms3d_utils.py
@@ -34,21 +34,12 @@
 from os import (
         path
         )
-from math import (
-        radians,
-        )
-from mathutils import (
-        Matrix,
-        )
 
 
-# To support reload properly, try to access a package var,
-# if it's there, reload everything
-if ('bpy' in locals()):
-    import imp
-    pass
-else:
-    pass
+# import io_scene_ms3d stuff
+from io_scene_ms3d.ms3d_strings import (
+        ms3d_str,
+        )
 
 
 #import blender stuff
@@ -106,26 +97,6 @@ def select_all(select):
 
 
 ###############################################################################
-def create_coordination_system_matrix(options):
-    # DEBUG
-    #return Matrix(), Matrix()
-
-    matrix_coordination_system = None
-
-    if (options.is_coordinate_system_import):
-        matrix_coordination_system = Matrix.Rotation(radians(+90), 4, 'Z') \
-                * Matrix.Rotation(radians(+90), 4, 'X')
-    elif (options.is_coordinate_system_export):
-        matrix_coordination_system = Matrix.Rotation(radians(-90), 4, 'X') \
-                * Matrix.Rotation(radians(-90), 4, 'Z')
-    else:
-        matrix_coordination_system = Matrix()
-
-    return matrix_coordination_system * options.prop_scale, \
-            matrix_coordination_system
-
-
-###############################################################################
 def pre_setup_environment(porter, blender_context):
     # inject undo to porter
     # and turn off undo
@@ -146,11 +117,6 @@ def pre_setup_environment(porter, blender_context):
 
     blender_context.scene.update()
 
-    # inject matrix_scaled_coordination_system to self
-    porter.matrix_scaled_coordination_system, \
-            porter.matrix_coordination_system \
-            = create_coordination_system_matrix(porter.options)
-
     # inject splitted filepath
     porter.filepath_splitted = path.split(porter.options.filepath)
 
@@ -168,9 +134,91 @@ def post_setup_environment(porter, blender_context):
     # restore pre operator undo state
     blender_context.user_preferences.edit.use_global_undo = porter.undo
 
+
+###############################################################################
+def get_edge_split_modifier_add_if(blender_mesh_object):
+    blender_modifier = blender_mesh_object.modifiers.get(
+            ms3d_str['OBJECT_MODIFIER_SMOOTHING_GROUP'])
+
+    if blender_modifier is None:
+        blender_modifier = blender_mesh_object.modifiers.new(
+                ms3d_str['OBJECT_MODIFIER_SMOOTHING_GROUP'],
+                type='EDGE_SPLIT')
+        blender_modifier.show_expanded = False
+        blender_modifier.use_edge_angle = False
+        blender_modifier.use_edge_sharp = True
+
+        blender_mesh_object.data.show_edge_seams = True
+        blender_mesh_object.data.show_edge_sharp = True
+
+    return blender_modifier
+
+
+###########################################################################
+def rotation_matrix(v_track, v_up):
+    ## rotation matrix from two vectors
+    ## http://gamedev.stackexchange.com/questions/20097/how-to-calculate-a-3x3-rotation-matrix-from-2-direction-vectors
+    ## http://www.fastgraph.com/makegames/3drotation/
+    matrix = Matrix().to_3x3()
+
+    c1 = v_track
+    c1.normalize()
+
+    c0 = c1.cross(v_up)
+    c0.normalize()
+
+    c2 = c0.cross(c1)
+    c2.normalize()
+
+    matrix.col[0] = c0
+    matrix.col[1] = c1
+    matrix.col[2] = c2
+
+    return matrix
+
+
+###########################################################################
+def matrix_difference(mat_src, mat_dst):
+    mat_dst_inv = mat_dst.copy()
+    mat_dst_inv.invert()
+    return mat_dst_inv * mat_src
+
+
 ###############################################################################
+def set_sence_to_metric(context):
+    try:
+        # set metrics
+        context.scene.unit_settings.system = 'METRIC'
+        context.scene.unit_settings.system_rotation = 'DEGREES'
+        context.scene.unit_settings.scale_length = 0.001 # 1.0mm
+        context.scene.unit_settings.use_separate = False
+        context.tool_settings.normal_size = 1.0 # 1.0mm
+
+        # set all 3D views to texture shaded
+        # and set up the clipping
+        for screen in context.blend_data.screens:
+            for area in screen.areas:
+                if (area.type != 'VIEW_3D'):
+                    continue
+
+                for space in area.spaces:
+                    if (space.type != 'VIEW_3D'):
+                        continue
+
+                    #space.viewport_shade = 'SOLID'
+                    space.show_textured_solid = True
+                    space.clip_start = 0.1 # 0.1mm
+                    space.clip_end = 1000000.0 # 1km
+            #screen.scene.game_settings.material_mode = 'MULTITEXTURE'
+
+    except Exception:
+        raise
+
+    else:
+        pass
 
 
+###############################################################################
 
 ###############################################################################
 #234567890123456789012345678901234567890123456789012345678901234567890123456789
diff --git a/release/scripts/addons_contrib/io_scene_open_street_map.py b/release/scripts/addons_contrib/io_scene_open_street_map.py
index 3892255..3e7b3dd 100644
--- a/release/scripts/addons_contrib/io_scene_open_street_map.py
+++ b/release/scripts/addons_contrib/io_scene_open_street_map.py
@@ -246,7 +246,7 @@ def read(context, filepath, scale=100.0, tag=False, utm=False) :
     bm.to_mesh(me)
 
     # fast approximation of utm for not too big area
-    if utm == False :
+    if utm is False :
         global_matrix = Matrix(((0.65, 0.0, 0.0, 0.0),
                                 (0.0, 1.0, 0.0, 0.0),
                                 (0.0, 0.0, 1.0, 0.0),
diff --git a/release/scripts/addons_contrib/io_scene_x/export_x.py b/release/scripts/addons_contrib/io_scene_x/export_x.py
index 115650f..1abb650 100644
--- a/release/scripts/addons_contrib/io_scene_x/export_x.py
+++ b/release/scripts/addons_contrib/io_scene_x/export_x.py
@@ -100,7 +100,7 @@ class DirectXExporter:
         self.File.Close()
 
     def Log(self, String, MessageVerbose=True):
-        if self.Config.Verbose == True or MessageVerbose == False:
+        if self.Config.Verbose is True or MessageVerbose == False:
             print(String)
 
     # "Private" Methods
diff --git a/release/scripts/addons_contrib/mesh_discombobulator.py b/release/scripts/addons_contrib/mesh_discombobulator.py
index 099e252..5da42f4 100644
--- a/release/scripts/addons_contrib/mesh_discombobulator.py
+++ b/release/scripts/addons_contrib/mesh_discombobulator.py
@@ -21,8 +21,7 @@ bl_info = {
     "description": "Its job is to easily add scifi details to a surface to create nice-looking space-ships or futuristic cities.",
     "author": "Evan J. Rosky (syrux), Chichiri, Jace Priester",
     "version": (0,2),
-    "blender": (2, 6, 3),
-    "api": 45996,
+    "blender": (2, 6, 4),
     "location": "Spacebar > Discombobulate",
     "warning": 'Beta',
     'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts',
@@ -563,7 +562,26 @@ class discombobulator(bpy.types.Operator):
             discombobulate(scn.minHeight, scn.maxHeight, scn.minTaper, scn.maxTaper, scn.subpolygon1, scn.subpolygon2, scn.subpolygon3, scn.subpolygon4, scn.mindoodads, scn.maxdoodads, scn.repeatprot, scn.sideProtMat, scn.topProtMat, isLast)
             i+=1
         return {'FINISHED'}
- 
+
+class discombob_help(bpy.types.Operator):
+	bl_idname = 'help.discombobulator'
+	bl_label = ''
+
+	def draw(self, context):
+		layout = self.layout
+		layout.label('To use:')
+		layout.label('Works with Quads only not Ngons.')
+		layout.label('Select a face or faces')
+		layout.label('Press Discombobulate to create greebles')
+
+
+	
+	def execute(self, context):
+		return {'FINISHED'}
+
+	def invoke(self, context, event):
+		return context.window_manager.invoke_popup(self, width = 300)
+		
 class VIEW3D_PT_tools_discombobulate(bpy.types.Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
@@ -574,7 +592,9 @@ class VIEW3D_PT_tools_discombobulate(bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
         row = layout.row()
-        row.operator("object.discombobulate", text = "Discombobulate")
+        row = layout.split(0.80)
+        row.operator('object.discombobulate', text = 'Discombobulate', icon = 'PLUGIN')
+        row.operator('help.discombobulator', icon = 'INFO')
         box = layout.box()
         box.label("Protusions settings")
         row = box.row()
@@ -651,6 +671,7 @@ def register():
     bpy.utils.register_class(chooseDoodad)
     bpy.utils.register_class(unchooseDoodad)
     bpy.utils.register_class(VIEW3D_PT_tools_discombobulate)
+    bpy.utils.register_class(discombob_help)
  
 # unregistering and removing menus
 def unregister():
@@ -658,6 +679,7 @@ def unregister():
     bpy.utils.unregister_class(chooseDoodad)
     bpy.utils.unregister_class(unchooseDoodad)
     bpy.utils.unregister_class(VIEW3D_PT_tools_discombobulate)
+    bpy.utils.unregister_class(discombob_help)
  
 if __name__ == "__main__":
     register()
diff --git a/release/scripts/addons_contrib/mesh_edge_intersection_tools.py b/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
index 9b1d4de..5bf4a82 100644
--- a/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
+++ b/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
@@ -216,7 +216,7 @@ def runCleanUp():
     bpy.ops.object.mode_set(mode='EDIT')
     bpy.ops.mesh.select_all(action='TOGGLE')
     bpy.ops.mesh.select_all(action='TOGGLE')
-    bpy.ops.mesh.remove_doubles(mergedist=VTX_PRECISION)
+    bpy.ops.mesh.remove_doubles(threshold=VTX_PRECISION)
     bpy.ops.mesh.select_all(action='TOGGLE') #unselect all
 
 
diff --git a/release/scripts/addons_contrib/mesh_edgetools.py b/release/scripts/addons_contrib/mesh_edgetools.py
index 1dd4132..d549204 100644
--- a/release/scripts/addons_contrib/mesh_edgetools.py
+++ b/release/scripts/addons_contrib/mesh_edgetools.py
@@ -94,6 +94,8 @@ from bpy.props import (BoolProperty,
                        FloatProperty,
                        EnumProperty)
 
+integrated = False
+
 # Quick an dirty method for getting the sign of a number:
 def sign(number):
     return (number > 0) - (number < 0)
@@ -1360,6 +1362,8 @@ class Shaft(bpy.types.Operator):
 
 
 # "Slices" edges crossing a plane defined by a face.
+# @todo Selecting a face as the cutting plane will cause Blender to crash when
+#   using "Rip".
 class Slice(bpy.types.Operator):
     bl_idname = "mesh.edgetools_slice"
     bl_label = "Slice"
@@ -1450,13 +1454,6 @@ class Slice(bpy.types.Operator):
         if bpy.app.debug:
             print(len(bEdges))
 
-        # Deletion array:
-        # We cannot delete the edges while we are iterating over them, else we
-        # end up skiping edges (this needs to be for-sure confirmed - this
-        # behavior seems to be new). Instead we'll put the edges to remove into
-        # a list to delete after we are done iterating over them.
-        toDel = []
-
         # Iterate over the edges:
         for e in bEdges:
             # @todo DEBUG TRACKER - DELETE WHEN FINISHED:
@@ -1464,8 +1461,11 @@ class Slice(bpy.types.Operator):
                 print(dbg)
                 dbg = dbg + 1
 
+            # Get the end verts on the edge:
             v1 = e.verts[0]
             v2 = e.verts[1]
+            
+            # Make sure that verts are not a part of the cutting plane:
             if e.select and (v1 not in face.verts and v2 not in face.verts):
                 if len(face.verts) < 5:  # Not an n-gon
                     intersection = intersect_line_face(e, face, True)
@@ -1513,8 +1513,7 @@ class Slice(bpy.types.Operator):
                             if bpy.app.debug:
                                 print("new edges created", end = '; ')
 
-##                            bEdges.remove(e)
-                            toDel.append(e)
+                            bEdges.remove(e)
 
                             if bpy.app.debug:
                                 print("old edge removed.")
@@ -1525,15 +1524,9 @@ class Slice(bpy.types.Operator):
                             e.select = False
                             new[0].select = False
                             if self.pos:
-##                                bEdges.remove(new[0])
-                                toDel.append(new[0])
+                                bEdges.remove(new[0])
                             if self.neg:
-##                                bEdges.remove(e)
-                                toDel.append(e)
-
-        # Blast away the old edges
-        for e in toDel:
-            bEdges.remove(e)
+                                bEdges.remove(e)
 
         bm.to_mesh(context.active_object.data)
         bpy.ops.object.editmode_toggle()
@@ -1906,6 +1899,7 @@ class VIEW3D_MT_edit_mesh_edgetools(bpy.types.Menu):
     bl_label = "EdgeTools"
     
     def draw(self, context):
+        global integrated
         layout = self.layout
         
         layout.operator("mesh.edgetools_extend")
@@ -1920,6 +1914,12 @@ class VIEW3D_MT_edit_mesh_edgetools(bpy.types.Menu):
             layout.operator("mesh.edgetools_fillet")
             ## For internal testing ONLY:
             layout.operator("mesh.edgetools_ilf")
+        # If TinyCAD VTX exists, add it to the menu.
+        # @todo This does not work.
+        if integrated and bpy.app.debug:
+            layout.operator(EdgeIntersections.bl_idname, text="Edges V Intersection").mode = -1
+            layout.operator(EdgeIntersections.bl_idname, text="Edges T Intersection").mode = 0
+            layout.operator(EdgeIntersections.bl_idname, text="Edges X Intersection").mode = 1
 
 
 def menu_func(self, context):
@@ -1942,13 +1942,27 @@ classes = [VIEW3D_MT_edit_mesh_edgetools,
 
 # registering and menu integration
 def register():
+    global integrated
     if int(bpy.app.build_revision[0:5]) < 44800:
         print("Error in Edgetools:")
         print("This version of Blender does not support the necessary BMesh API.")
         print("Please download Blender 2.63 or newer.")
         return {'ERROR'}
+        
     for c in classes:
         bpy.utils.register_class(c)
+
+    # I would like this script to integrate the TinyCAD VTX menu options into
+    # the edge tools menu if it exists.  This should make the UI a little nicer
+    # for users.
+    # @todo Remove TinyCAD VTX menu entries and add them too EdgeTool's menu
+    import inspect, os.path
+
+    path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+    if os.path.isfile(path + "\mesh_edge_intersection_tools.py"):
+        print("EdgeTools UI integration test - TinyCAD VTX Found")
+        integrated = True
+    
     bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_func)
 
 
@@ -1956,6 +1970,7 @@ def register():
 def unregister():
     for c in classes:
         bpy.utils.unregister_class(c)
+
     bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_func)
 
 
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/__init__.py b/release/scripts/addons_contrib/mesh_extra_tools/__init__.py
index fd4e64a..8392e8d 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/__init__.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/__init__.py
@@ -43,7 +43,6 @@ if "bpy" in locals():
     imp.reload(mesh_polyredux)
     imp.reload(mesh_vertex_chamfer)
     imp.reload(mesh_mextrude_plus)
-    imp.reload(mesh_bevel_round)
 
 else:
     from . import mesh_bump
@@ -54,11 +53,9 @@ else:
     from . import mesh_polyredux
     from . import mesh_vertex_chamfer
     from . import mesh_mextrude_plus
-    from . import mesh_bevel_round
 
 import bpy
 
-
 class VIEW3D_MT_edit_mesh_extras(bpy.types.Menu):
     # Define the "Extras" menu
     bl_idname = "VIEW3D_MT_edit_mesh_extras"
@@ -67,61 +64,60 @@ class VIEW3D_MT_edit_mesh_extras(bpy.types.Menu):
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("mesh.bump",
-            text="Inset Extrude Bump")
-        layout.operator("fif.op0_id",
+        layout.operator("faceinfillet.op0_id",
             text="Face Inset Fillet")
-        layout.operator("mesh.mbevel",
-            text="Edge Bevel")
-        layout.operator("f.op0_id",
+        layout.operator("fillet.op0_id",
             text="Edge Fillet Plus")
-        layout.operator("normal.smooth",
-            text="Normal Smooth")
         layout.operator("object.mextrude",
             text="Multi Extrude")
-        layout.operator("mesh.polyredux",
-            text="Poly Redux")
+        layout.operator("mesh.bump",
+            text="Inset Extrude Bump")
+        layout.operator("mesh.mbevel",
+            text="Bevel Selected")
         layout.operator("mesh.vertex_chamfer",
             text="Vertex Chamfer")
-        layout.operator("mesh.bevel_round",
-            text="Bevel Round")
+        layout.operator("mesh.polyredux",
+            text="Poly Redux")
+        layout.operator("normal.smooth",
+            text="Normal Smooth")
 
 
 class ExtrasPanel(bpy.types.Panel):
     bl_label = 'Mesh Extra Tools'
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
+    bl_context = 'mesh_edit'
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw(self, context):
         layout = self.layout
         row = layout.split(0.80)
-        row.operator('mesh.bump', text = 'Inset Bump')
-        row.operator('help.bump', text = '?')
+        row.operator('faceinfillet.op0_id', text = 'Face Inset Fillet', icon = 'PLUGIN')
+        row.operator('help.face_inset', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('fif.op0_id', text = 'Face Inset Fillet')
-        row.operator('help.face_inset', text = '?')
+        row.operator('fillet.op0_id', text = 'Edge Fillet plus', icon = 'PLUGIN')
+        row.operator('help.edge_fillet', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('mesh.bevel_round', text = 'Bevel Round')
-        row.operator('help.bevelround', text = '?')
+        row.operator('object.mextrude', text = 'Multi Face Extrude', icon = 'PLUGIN')
+        row.operator('help.mextrude', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('mesh.mbevel', text = 'Edge Bevel')
-        row.operator('help.edge_bevel', text = '?')
+        row.operator('mesh.bump', text = 'Inset Bump', icon = 'PLUGIN')
+        row.operator('help.bump', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('f.op0_id', text = 'Edge Fillet plus')
-        row.operator('f.op1_id', text = '?')
+        row.operator('mesh.mbevel', text = 'Bevel Selected', icon = 'PLUGIN')
+        row.operator('help.edge_bevel', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('normal.smooth', text = 'Normal Smooth')
-        row.operator('help.normal_smooth', text = '?')
+        row.operator('mesh.vertex_chamfer', text = 'Vertex Chamfer' , icon = 'PLUGIN')
+        row.operator('help.vertexchamfer', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('mesh.polyredux', text = 'Poly Redux')
-        row.operator('help.polyredux', text = '?')
+        row.operator('mesh.polyredux', text = 'Poly Redux', icon = 'PLUGIN')
+        row.operator('help.polyredux', text = '', icon = 'INFO')
         row = layout.split(0.80)
-        row.operator('mesh.vertex_chamfer', text = 'Vertex Chamfer')
-        row.operator('help.vertexchamfer', text = '?')
-        row = layout.split(0.80)
-        row.operator('object.mextrude', text = 'Multi Face Extrude')
-        row.operator('help.mextrude', text = '?')
+        row.operator('normal.smooth', text = 'Normal Smooth', icon = 'PLUGIN')
+        row.operator('help.normal_smooth', text = '', icon = 'INFO')
+        row = layout.split(0.50)
+        row.operator('mesh.flip_normals', text = 'Normals Flip')
+        row.operator('mesh.remove_doubles', text = 'Remove Doubles')
 
 
 # Multi Extrude Panel
@@ -134,16 +130,16 @@ class ExtrudePanel(bpy.types.Panel):
 
     def draw(self, context):
         layout = self.layout
-        prop = layout.operator("wm.context_set_value", text="Face Select",
-            icon='FACESEL')
-        prop.value = "(False, False, True)"
-        prop.data_path = "tool_settings.mesh_select_mode"
-        layout.operator('object.mextrude')
-        layout.operator('mesh.bump')
-        layout.operator('object.mesh2bones')
+        row = layout.split(0.80)
+        row.operator('object.mextrude', text = 'Multi Face Extrude', icon = 'PLUGIN')
+        row.operator('help.mextrude', text = '', icon = 'INFO')
+        row = layout.split(0.80)
+        row.operator('object.mesh2bones', text = 'Add Armature', icon = 'PLUGIN')
+        row.operator('help.addarm', text = '', icon = 'INFO')
+
 # Define "Extras" menu
 def menu_func(self, context):
-    self.layout.menu("VIEW3D_MT_edit_mesh_extras", icon="PLUGIN")
+    self.layout.menu('VIEW3D_MT_edit_mesh_extras', icon='PLUGIN')
 
 
 def register():
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/face_inset_fillet.py b/release/scripts/addons_contrib/mesh_extra_tools/face_inset_fillet.py
index 2a1b307..bc4824e 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/face_inset_fillet.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/face_inset_fillet.py
@@ -18,21 +18,7 @@
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ***** END GPL LICENCE BLOCK *****
-
-# ------ ------
-bl_info = {
-    'name': 'face_inset_fillet',
-    'author': '',
-    'version': (0, 1, 7),
-    'blender': (2, 6, 3),
-    'api': 46962,
-    'location': 'View3D > Tool Shelf',
-    'description': '',
-    'warning': '',
-    'wiki_url': '',
-    'tracker_url': '',
-    'category': 'Mesh' }
-
+# based completely on addon by zmj100
 # ------ ------
 import bpy
 import bmesh
@@ -152,14 +138,13 @@ def f_(bme, list_0, opp, adj1, n_, out, radius, en0, kp):
                     bme.faces.new( [ dict_0[k_][kk], dict_0[k_][(kk + 1) % n3_], q_ ] )
                     bme.faces.index_update()
 
+
     del_ = [bme.faces.remove(f) for f in list_del]
     del del_
 
-
-
 # ------ operator 0 ------
-class fif_op0(bpy.types.Operator):
-    bl_idname = 'fif.op0_id'
+class faceinfillet_op0(bpy.types.Operator):
+    bl_idname = 'faceinfillet.op0_id'
     bl_label = 'Face Inset Fillet'
     bl_description = 'inset selected faces'
     bl_options = {'REGISTER', 'UNDO'}
@@ -228,30 +213,14 @@ class inset_help(bpy.types.Operator):
 	def draw(self, context):
 		layout = self.layout
 		layout.label('To use:')
-		layout.label('Select A face or Faces & inset.')
-		layout.label('Inset on a per face basis')
+		layout.label('Select a face or faces & inset.')
 		layout.label('Inset square, circle or outside.')
+		layout.label('To Help:')
+		layout.label('Circle: use remove doubles to tidy joins.')
+		layout.label('Outset: select & use normals flip before extruding.')
 	
 	def execute(self, context):
 		return {'FINISHED'}
 
 	def invoke(self, context, event):
-		return context.window_manager.invoke_popup(self, width = 300)
-'''
-# ------ ------
-class_list = [ fif_op0, fif_p0 ]
-
-# ------ register ------
-def register():
-    for c in class_list:
-        bpy.utils.register_class(c)
-
-# ------ unregister ------
-def unregister():
-    for c in class_list:
-        bpy.utils.unregister_class(c)
-
-# ------ ------
-if __name__ == "__main__":
-    register()
-'''
\ No newline at end of file
+		return context.window_manager.invoke_popup(self, width = 350)
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_round.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_round.py
deleted file mode 100644
index 78c86e1..0000000
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_round.py
+++ /dev/null
@@ -1,2972 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-# Ported from RoundCorner Ruby program for Sketchup by Fredo6
-# Fredo6 gave permission to port and distribute with Blender
-
-bl_info = {
-    "name": "Bevel Round",
-    "author": "Fredo6, Howard Trickey",
-    "version": (0, 1),
-    "blender": (2, 6, 3),
-    "location": "View3D > Tools",
-    "description": "Bevel selected edges, possibly rounded",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
-        "Scripts",
-    "tracker_url": "http://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=32582",
-    "category": "Mesh"}
-
-import math
-import functools
-import bpy
-import bmesh
-import mathutils
-from bpy.props import (BoolProperty,
-                       EnumProperty,
-                       IntProperty,
-                       FloatProperty,
-                       )
-from mathutils import Vector
-
-EPSILON = 1e-6
-
-class BevelRound(bpy.types.Operator):
-    bl_idname = "mesh.bevel_round"
-    bl_label = "Bevel Round"
-    bl_description = "Bevel selected edges, possibly rounded"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    bevel_kind = EnumProperty(name="Bevel Kind",
-        description="Style for beveling edges and corners",
-        items=[
-            ('ROUND', "Round",
-                "Round edges and corners"),
-            ('SHARP', "Sharp",
-                "Round edges, peaked corners"),
-            ('BEVEL', "Bevel",
-                "Flat edges and corners")
-            ],
-        default='BEVEL')
-
-    offset_amount = FloatProperty(name="Offset",
-        description="Amount to offset edges along faces",
-        default=0.2,
-        min=0.0,
-        max=1000.0,
-        soft_min=0.0,
-        soft_max=10.0,
-        unit='LENGTH')
-
-    segments = IntProperty(name="Segments",
-        description="How many segments on bevel profile",
-        min=1,
-        max=100,
-        default=1)
-
-    strict_offset = BoolProperty(name="Strict Offset",
-        description="Keep offset the same on all faces",
-        default=True)
-
-    rounding = BoolProperty(name="Inner Rounding",
-        description="Round inside faces at concave corners",
-        default=True)
-
-    @classmethod
-    def poll(cls, context):
-        obj = context.active_object
-        return (obj and obj.type == 'MESH' and context.mode == 'EDIT_MESH')
-
-    def draw(self, context):
-        layout = self.layout
-        box = layout.box()
-        box.label("Bevel Round Options:")
-        box.prop(self, "bevel_kind")
-        box.prop(self, "offset_amount")
-        box.prop(self, "segments")
-        box.prop(self, "strict_offset")
-        box.prop(self, "rounding")
-
-    def invoke(self, context, event):
-        self.action(context)
-        return {'FINISHED'}
-
-    def execute(self, context):
-        self.action(context)
-        return {'FINISHED'}
-
-    def action(self, context):
-        obj = bpy.context.active_object
-        bm = bmesh.from_edit_mesh(obj.data)
-        # make sure vert, edge, face indexes match their positions
-        bm.verts.index_update()
-        bm.edges.index_update()
-        bm.faces.index_update()
-        algo = BevelRoundAlgo(bm, self.bevel_kind, self.offset_amount,
-            self.segments, self.strict_offset, self.rounding)
-        algo.execute()
-        # Force mesh data recalculation
-        bpy.ops.object.editmode_toggle()
-        bpy.ops.object.editmode_toggle()
-
-class rbevel_help(bpy.types.Operator):
-	bl_idname = 'help.bevelround'
-	bl_label = ''
-
-	def draw(self, context):
-		layout = self.layout
-		layout.label('To use:')
-		layout.label('Select edges or faces to bevel with the option of rounded bevels.')
-		layout.label('best used on flat edges & simple edgeflow')
-		layout.label('may error if vert joins multiple edges/complex edge selection.')
-	
-	def execute(self, context):
-		return {'FINISHED'}
-
-	def invoke(self, context, event):
-		return context.window_manager.invoke_popup(self, width = 400)
-
-class BevelRoundAlgo(object):
-    def __init__(self, bm, kind, offset, num_seg, strict, round):
-        # The bmesh object
-        self.bm = bm
-
-        # How much to move offset edges
-        # (projected onto 90deg angle planes, unless strict_offset)
-        self.offset = offset
-
-        # How many segments in the profile of an edge
-        self.num_seg = num_seg
-
-        # Cache of profiles in standard position, keyed by "kind-numseg"
-        # Kind will be one of 'C' or 'P', for now
-        self.hsh_profile_pts = {}
-
-        # bmesh Edge index -> BEdge for it
-        # Will have one for all the edges in the bevel selection
-        self.hsh_ed = {}
-
-        # bmesh Vertex index -> BCorner for it
-        # Will have one for all ends of edges in hsh_ed
-        self.hsh_corners = {}
-
-        # bmesh Face index -> BFace for it
-        self.hsh_faces = {}
-
-        # List of [Vector, Vector], each a border line segment (for display only?)
-        self.lpt_borders = []
-
-        # Catenas are chains of edges with related offsets
-        # Each has eds, a list of BEdges;
-        #  chain, a list of [BEdge, face index]l
-        #  nbsmall: seems to be some kind of edge count
-        self.lst_catenas = []
-
-        # List of Vector, pivot points for star corners
-        self.lst_mark_points = []
-
-        # lst_triangulate is list of [vd, ed1, ed2, seg1, seg2]
-        # for each vd for a vert with only two edges and >=3 pairs
-        self.lst_triangulated = []
-
-        # List of BCorner, those signaled as errors (pair lines don't cross (?))
-        self.hsh_error_vertex = {}
-
-        # Edge index -> bmesh Edge for edges to bevel
-        self.hash_edges = {}
-
-        # hash_edges_extra : Edge index -> bmesh Edge added for valence >= 4 reasons
-        self.hash_edges_extra = {}
-
-        # Vertex index -> list of bmesh edges to bevel attached
-        self.hsh_vertex_edges = {}
-
-        # Vertex index -> list of all bmesh edges attached to it
-        self.hsh_vertex_info = {}
-
-        # Map from point to BMVert
-        self.points = Points(self.bm)
-
-        # Used to orient asymmetric corner mesh patterns
-        self.golden_axis = Vector([0.0, 0.0, 1.0])
-
-        # Profile spec for edges: [string, number]
-        # where string is 'C' for quarter circle, 'CR' for concave quarter circle,
-        # 'BZ' for Bezier, 'P' for 'perso' (?, some kind of multi-bezier).
-        # number is number of line segments in profile (so 1 means just
-        # a single straight line from start to end)
-        if kind == 'BEVEL':
-            self.profile_type = ['C', 1]
-            self.num_seg = 1
-        else:
-            self.profile_type = ['C', num_seg]
-
-        # Controls whether or not to use a round profile in certain disagreeing cases (?)
-        self.mode_profile = 1
-
-        # Corners come to peaks if mode_sharp
-        self.mode_sharp = True if kind == 'SHARP' else False
-
-        # Forces offset along faces to  be uniform rather than adjusted
-        # to make them uniform when projected on 90deg-meeting-faces
-        self.strict_offset = strict
-
-        # Should we round the edges in the faces themselves too?
-        self.mode_rounding = round
-
-    def execute(self):
-        bm = self.bm
-
-        # Add the bmesh edges and compute everything
-        # needed for bevel
-        self.build_model(bm)
-
-        # print("after build:")
-        # self.print()
-
-        # Initialization for geometry making
-        self.prepare_geometry()
-
-        # print("after prepare_geometry")
-        # self.print()
-
-        self.lst_corners = list(self.hsh_corners.values())
-        self.nb_corners = len(self.lst_corners) - 1
-        self.lst_eds = list(self.hsh_ed.values())
-        self.nb_eds = len(self.lst_eds) - 1
-        self.hsh_edge_erase = {}
-        self.nb_borders = len(self.lpt_borders) // 2 - 1
-
-        # Process geometry
-
-        self.lst_edge_erase = []
-        self.nb_edge_erase = -1
-
-        # Creating the rounding faces
-        for k in range(0, self.nb_eds + 1):
-            ed = self.lst_eds[k]
-            if ed.vmesh:
-                self.create_geometry_vmesh(ed.vmesh)
-
-        # Creating the triangulated  vmesh if any
-        self.create_geometry_vmesh(self.lst_vmesh_triangulated)
-        self.create_geometry_vborders(self.lst_vborders_triangulated)
-
-        # Creating the corner round faces
-        for k in range(0, self.nb_corners + 1):
-           vd = self.lst_corners[k]
-           if vd.vmesh:
-               self.create_geometry_vmesh(vd.vmesh)
-
-        # Creating the new faces
-        for fc in self.hsh_faces.values():
-            if not fc.anynew():
-                continue
-            lv = []
-            for i in range(len(fc.bmverts)):
-                npl = fc.newpts[i]
-                if npl:
-                    lv.extend(self.get_bmverts(npl))
-                else:
-                    lv.append(fc.bmverts[i])
-            self.bm.faces.new(lv)
-
-        # Deleting the unneeded geometry
-        for f in self.hsh_faces.values():
-            if f.face.is_valid:
-                if not f.anynew():
-                    continue
-                fedges = f.face.edges[::]
-                self.bm.faces.remove(f.face)
-                for e in fedges:
-                    if e.is_valid:
-                        if e.is_wire:
-                            self.bm.edges.remove(e)
-        for k in range(0, self.nb_corners + 1):
-            vd = self.lst_corners[k]
-            if len(vd.leds) == 1:
-                edge = vd.leds[0].edge
-                if edge.is_valid:
-                    self.bm.edges.remove(edge)
-            else:
-                # print("remove edges:", vd.vertex.link_edges)
-                pass  # is there stuff to do here?
-            if vd.vertex.is_valid:
-                self.bm.verts.remove(vd.vertex)
-
-    # Prepare the geometry
-    def prepare_geometry(self):
-        # Compute the corners
-        for vd in self.hsh_corners.values():
-            self.corner_compute(vd)
-
-        # Compute the edge roundings
-        for ed in self.hsh_ed.values():
-            self.compute_mesh_edge(ed)
-
-        # Compute the edge roundings for triangulated corners, if any
-        self.lst_vmesh_triangulated = []
-        self.lst_vborders_triangulated = []
-        for ll in self.lst_triangulated:
-            self.compute_mesh_edge_triangulated(ll[0], ll[1], ll[2], ll[3], ll[4])
-
-        # Compute the faces
-        for fc in self.hsh_faces.values():
-            self.compute_face(fc)
-
-    # Adds more edges if needed to make it so that for
-    # vertices of valence 4 or more, all edges are beveled if any are.
-    # Fills hsh_vertex_info for involved vertices with list of all bmesh
-    # edges attached to a vertex.
-    # Fills hsh_ed with BEdge for each edge to be beveled.
-    # Fills hsh_corners with BCorner for each vertex involved in each BEdge.
-    # Computes pairs at each BCorner.
-    # Add bmesh edges to be beveled and compute the other
-    # structures needed for the bevel.
-    def build_model(self, bm):
-        # Fill self.hash_edges with selected bmesh edges
-        # if they are acceptable (separate two faces, not-coplanar)
-        for bme in bm.edges:
-            if bme.select and self.acceptable_edge(bme):
-                self.hash_edges[bme.index] = bme
-
-        if len(self.hash_edges) == 0:
-            return
-
-       # Fill self.hash_vertex_edges[i] with list of
-       # bmesh edges attached to vertex with bmesh index i
-        self.hsh_vertex_edges = {}
-        for edge in self.hash_edges.values():
-            self.register_vertex(edge.verts[0], edge)
-            self.register_vertex(edge.verts[1], edge)
-
-        # Add extra edges needed to make valence
-        # >=4 verts have all edges beveled if any are.
-        # Extra edges go in self.hash_edges and
-        # self.hash_edges_extra.
-        self.hash_edges_extra = {}
-        for edge in self.hash_edges.values():
-            self.verify_vertex(edge.verts[0])
-            self.verify_vertex(edge.verts[1])
-        
-        # create BEdges in hsh_ed, BCorners in hsh_corners
-        for edge in self.hash_edges.values():
-            self.integrate_edge(edge)
-
-        # create BPairs in vd.pairs for each BCorner vd.
-        for vd in self.hsh_corners.values():
-            self.compute_pairs_at_vertex(vd)
-
-        # create BCatenas in ed.catenas for each BEdge ed.
-        self.catena_compute_all()
-        if self.strict_offset:
-            self.catena_offset_all()
-
-        self.lpt_borders = []
-        for ed in self.hsh_ed.values():
-            self.nsection = None
-            for pair in ed.pairs:
-                pair.ptcross = None
-            self.compute_borders(ed)
-
-        # Scan the corners to determine the roundings
-        self.corner_scan_all()
-
-        # Compute the faces orientation: tricky when # segments is odd
-        self.compute_face_orientation()
-
-        # Compute alone pairs in case of triangulation
-        self.evaluate_pair_triangulated()
-
-        # Compute the roundings
-        for vd in self.hsh_corners.values():
-            self.rounding_compute(vd)
-        for ed in self.hsh_ed.values():
-            self.compute_borders_for_display(ed)
-
-
-    def acceptable_edge(self, bme):
-        # algorithm requires that edges separate
-        # exactly two, non coplanar faces
-        if len(bme.link_faces) == 2:
-            f1 = bme.link_faces[0]
-            f2 = bme.link_faces[1]
-            return not parallel(f1.normal, f2.normal)
-        return False
-
-    def register_vertex(self, vertex, bme):
-        if vertex.index not in self.hsh_vertex_edges:
-            self.hsh_vertex_edges[vertex.index] = []
-        ledges = self.hsh_vertex_edges[vertex.index]
-        if bme not in ledges:
-            ledges.append(bme)
-        self.register_faces(vertex.link_faces)
-
-    def verify_vertex(self, vertex):
-        # algorithm requires that vertices with valence >= 4
-        # must have all edges included
-        if vertex.index not in self.hsh_vertex_info:
-            ledges = []
-            self.hsh_vertex_info[vertex.index] = list(vertex.link_edges)
-        ledges = self.hsh_vertex_info[vertex.index]  # list of bmesh edges
-        lsel = self.hsh_vertex_edges[vertex.index]
-        nsel = len(lsel)
-        if nsel <=3 or nsel == len(ledges):
-            return
-        # add extra edges
-        for bme in ledges:
-            if bme.index in self.hash_edges:
-                continue
-            # kind of an impasse if edge is unacceptable - oh well
-            if self.acceptable_edge(bme):
-                self.hash_edges[edge.index] = bme
-                self.register_vertex(edge.verts[0], bme)
-                self.register_vertex(edge.verts[1], bme)
-                self.hash_edges_extra[edge.index] = bme
-
-    def register_faces(self, faces):
-        for f in faces:
-            if f.index not in self.hsh_faces:
-                self.hsh_faces[f.index] = BFace(f)
-
-    # Evaluate and treat pairs at triangulated corners
-    def evaluate_pair_triangulated(self):
-        self.lst_triangulated = []
-        lalone = [ vd for vd in self.hsh_corners.values() \
-                   if len(vd.leds) == 2 and len(vd.pairs) >= 3 ]
-        for i, vd in enumerate(lalone):
-            ed1 = vd.leds[0]
-            ed2 = vd.leds[1]
-            pairs1 = [ pair for pair in vd.pairs if pair.alone and pair.leds[0] == ed1 ]
-            pairs2 = [ pair for pair in vd.pairs if pair.alone and pair.leds[0] == ed2 ]
-            if not pairs1 or not pairs2:
-                continue
-            ptcross10 = pairs1[0].ptcross
-            ptcross11 = pairs1[1].ptcross if len(pairs1) > 1 else None
-            ptcross20 = pairs2[0].ptcross
-            ptcross21 = pairs2[1].ptcross if len(pairs2) > 1 else None
-            if ptcross21 and (ptcross21 - ptcross10).length < (ptcross20 - ptcross10).length:
-                seg1 = [ptcross10, ptcross21]
-            else:
-                seg1 = [ptcross10, ptcross20]
-            seg2 = None
-            if ptcross11:
-                if ptcross21 and (ptcross21 - ptcross11).length < (ptcross20 - ptcross11).length:
-                    seg2 = [ptcross11, ptcross21]
-                else:
-                    seg2 = [ptcross11, ptcross20]
-            self.lpt_borders.extend(seg1)
-            if seg2:
-                self.lpt_borders.extend(seg2)
-            self.lst_triangulated.append([vd, ed1, ed2, seg1, seg2])
-
-    def integrate_edge(self, edge):
-        if not self.acceptable_edge(edge):
-            return None
-        index = edge.index
-        if index in self.hsh_ed:
-            return self.hsh_ed[index]
-        ed = BEdge(edge)
-        self.hsh_ed[index] = ed
-        ed.corners.append(self.create_corner(edge.verts[0], ed))
-        ed.corners.append(self.create_corner(edge.verts[1], ed))
-        return ed
-
-    def create_corner(self, vertex, ed):
-        index = vertex.index
-        if index not in self.hsh_corners:
-            vd = BCorner(vertex, ed)
-            self.hsh_corners[index] = vd
-        else:
-            vd = self.hsh_corners[index]
-            if ed not in vd.leds:
-                vd.leds.append(ed)
-        return vd
-
-    # vd should be for a vertex and one end of ed1's edge and face1
-    # should be one or the other of the faces incident to it.
-    # Similarly for ed2, face2 if present
-    def create_pair(self, vd, ed1, face1, ed2=None, face2=None):
-        edge1 = ed1.edge
-        edge2 = ed2.edge if ed2 else None
-        pair = BPair(vd, ed1, face1, ed2, face2)
-        vd.pairs.append(pair)
-        vertex = vd.vertex
-        iface1 = 0 if face1 == ed1.lfaces[0] else 1
-        ivtx = 0 if vertex == edge1.verts[0] else 1
-        ed1.pairs[iface1 + 2 * ivtx] = pair
-        if edge2:
-            iface2 = 0 if face2 == ed2.lfaces[0] else 1
-            ivtx = 0 if vertex == edge2.verts[0] else 1
-            if not ed2.pairs:
-                ed2.pairs = [None, None, None, None]
-            ed2.pairs[iface2 + 2 * ivtx] = pair
-            pair.monoface = (face1 == face2) or parallel(face1.normal, face2.normal)
-            if pair.monoface:
-                pair.convex = convex_at_vertex(vertex, face1, ed1.edge, ed2.edge, face2)
-                pair.vd.convex = pair.convex
-        # computing planes for cross points - special for termination corners
-        if pair.alone:
-            self.compute_edge_terms(pair, pair.ledges[0], pair.lfaces[0], pair.vd.vertex)
-        return pair
-
-    # Find the matching edges at a vertex
-    def compute_pairs_at_vertex(self, vd):
-        nb_edge = len(vd.leds)
-        if nb_edge == 1:
-            ed = vd.leds[0]
-            self.create_pair(vd, ed, ed.lfaces[0])
-            self.create_pair(vd, ed, ed.lfaces[1])
-        elif nb_edge == 2:
-            self.check_pair_2(vd, vd.leds[0], vd.leds[1])
-        else:
-            for i in range(0, nb_edge - 1):
-                for j in range(i+1, nb_edge):
-                    self.check_pair_N(vd, vd.leds[i], vd.leds[j], vd.leds)
-
-    # Find the common faces (or coplanar) to 2 edges when there are 2 at vertex.
-    # Makes a pair for the two edges matching when there's common or coplanar faces.
-    # Also makes pairs for the two edges matching when there's a common edge
-    # between them (and some convexity test I don't understand).
-    # Finally, makes an alone pair for any (edge, face) pairs not otherwise used.
-    def check_pair_2(self, vd, ed1, ed2):
-        edge1 = ed1.edge
-        edge2 = ed2.edge
-        faces1 = list(edge1.link_faces)
-        faces2 = list(edge2.link_faces)
-
-        # Finding faces on the same plane
-        for f1 in edge1.link_faces:
-            for f2 in edge2.link_faces:
-                if f1 == f2 or parallel(f1.normal, f2.normal):
-                    self.create_pair(vd, ed1, f1, ed2, f2)
-                    faces1.remove(f1)
-                    faces2.remove(f2)
-
-        # Finding faces with common edges
-        lf1 = []
-        lf2 = []
-        for f1 in faces1:
-            for f2 in faces2:
-                linter = list(set(f1.edges).intersection(set(f2.edges)))
-                if len(linter) > 0:
-                    e = linter[0]
-                    if not (convex_at_vertex(vd.vertex, f1, edge1, e) or \
-                            convex_at_vertex(vd.vertex, f2, edge2, e)):
-                        self.create_pair(vd, ed1, f1, ed2, f2)
-                        lf1.append(f1)
-                        lf2.append(f2)
-
-        # Creating alone pair if any unaffected faces left
-        for f1 in faces1:
-            if f1 not in lf1:
-                self.create_pair(vd, ed1, f1)
-        for f2 in faces2:
-            if f2 not in lf2:
-                self.create_pair(vd, ed2, f2)
-
-    # Find the common faces (or coplanar) to 2 edges when there are more than 2 total.
-    # Makes a pair for the the two edges matching the first of any common faces
-    # and returns if so.
-    # Else makes a pair matching up the two edges with faces that are parallel
-    # and returns if it finds one.
-    # Else makes a pair matching up the two edges with faces sharing an edge
-    # and that edge isn't in leds, and returns if it finds one.
-    # Otherwise makes no pair.
-    def check_pair_N(self, vd, ed1, ed2, leds):
-        edge1 = ed1.edge
-        edge2 = ed2.edge
-        if edge1 == edge2:
-            return
-        faces1 = list(edge1.link_faces)
-        faces2 = list(edge2.link_faces)
-        lfaces = list(set(faces1).intersection(set(faces2)))
-
-        # Common face found
-        if len(lfaces) >= 1:
-            return self.create_pair(vd, ed1, lfaces[0], ed2, lfaces[0])
-
-        # Finding faces that are on the same plane
-        for f1 in edge1.link_faces:
-            for f2 in edge2.link_faces:
-                if parallel(f1.normal, f2.normal):
-                    return self.create_pair(vd, ed1, f1, ed2, f2)
- 
-        # Check common edges
-        for f1 in faces1:
-            for f2 in faces2:
-                linter = list(set(f1.edges).intersection(set(f2.edges)))
-                if len(linter) > 0 and not find(leds, lambda ed: ed.edge == linter[0]):
-                    return self.create_pair(vd, ed1, f1, ed2, f2)
-                    
-    def compute_borders(self, ed):
-        pairs = ed.pairs
-        for i in range(0,4):
-            if pairs[i]:
-               self.compute_pair_ptcross(pairs[i])
-
-    # Compute the borders for display, including the rounding
-    def compute_borders_for_display(self, ed):
-        pairs = ed.pairs
-        lseg = []
-        lroundings = []
-        for i in [0, 2, 1, 3]:
-            pair = pairs[i]
-            lpt = pair.rounding
-            if lpt and len(lpt) > 0:
-                if on_line(lpt[0], [pair.ptcross, ed.vec]):
-                    pt = lpt[0]
-                else:
-                    pt = lpt[-1]
-            else:
-                pt = pair.ptcross
-            lseg.append(pt)
-        self.lpt_borders.extend(lseg)
-
-
-    # Compute and return the vector representing the border
-    def compute_edge_terms(self, pair, edge, face, vertex):
-        normal = face.normal
-        for e in vertex.link_edges:
-            if e == edge:
-                continue
-            for f in e.link_faces:
-                if f == face or parallel(f.normal, normal):
-                    pair.edge_terms.append(e)
-
-    # Compute the cross points for the pair
-    def compute_pair_ptcross(self, pair):
-        if pair.ptcross:
-            return
-        line1 = self.line_border(pair, 0)
-        if pair.alone:
-            pair.ptcross = self.find_intersect_edge_term(pair, line1)
-        else:
-            line2 = self.line_border(pair, 1)
-            if parallel(line1[1], line2[1]):
-                pair.ptcross = intersect_line_plane(line1,
-                        [pair.vd.vertex.co, line1[1]])
-            else:
-                pair.ptcross = intersect_line_line(line1, line2)
-                if not pair.ptcross:
-                    self.signal_error_vd(pair.vd)
-                    lpt = closest_points(line1, line2)
-                    pair.ptcross = lpt[0]
-
-    # Fine the best stop point for a standalone edge pair
-    def find_intersect_edge_term(self, pair, line):
-        ed = pair.leds[0]
-        lptinter = []
-        for edge in pair.edge_terms:
-            pt = intersect_edge_line(edge, line)
-            if pt:
-                lptinter.append(pt)
-        # if no intersection just take the orthogonal plane
-        if len(lptinter) == 0:
-            return intersect_line_plane(line, [pair.vd.vertex.co, ed.vec])
-        # sort the interesection point and take the farthest
-        ptmid = ed.ptmid
-        lptinter.sort(key = lambda p: (ptmid-p).length)
-        return lptinter[-1]
-
-    # Compute the line defining a border on  a face
-    # (Maybe don't need this function if not drawing borders)
-    def line_border(self, pair, iedge):
-        edge = pair.ledges[iedge]
-        ed = self.hsh_ed[edge.index]
-        face = pair.lfaces[iedge]
-        iface = 0 if face == ed.lfaces[0] else 1
-        offset = self.offset * ed.lfactors[iface]
-        vecin = normal_in_to_edge(edge, face)
-        pt = ed.ptmid + offset * vecin
-        return [pt, ed.vec]
-
-    # Compute the orthogonal profile for an edge at its midpoint
-    def compute_profile_edge(self, ed):
-        if ed.nsection:
-            return ed.nsection
-        offset1 = self.offset * ed.lfactors[0]
-        offset2 = self.offset * ed.lfactors[1]
-        vec1 = ed.lvecins[0]
-        vec2 = ed.lvecins[1]
-        ptcenter = ed.ptmid
-        profile = ['C', self.num_seg] if ed.round_profile else self.profile_type
-        section = self.profile_compute_by_offset(profile, ptcenter,
-                    vec1, offset1, vec2, offset2)
-        if not on_plane(section[0], face_plane(ed.facemain)):
-            section.reverse()
-        ed.nsection = section
-        return section
-
-    # Compute the section for an edge at corners
-    # The section will go from the facemain face to the non-facemain one.
-    def compute_sections_multi(self, ed, icorner):
-        vd = ed.corners[icorner]
-        vpos = vd.vertex.co
-        iA = 0 if ed.facemain == ed.lfaces[0] else 1
-        iB = 1 - iA
-        pairA = ed.pairs[2 * icorner + iA]
-        pairB = ed.pairs[2 * icorner + iB]
-
-        ptA = pairA.ptcross
-        ptB = pairB.ptcross
-
-        profile = ['C', self.num_seg] if ed.round_profile else self.profile_type
-
-        if len(vd.leds) <= 1:
-            vecA = ptA - vpos
-            vecB = ptB - vpos
-            offsetA = vecA.length
-            offsetB = vecB.length
-            section = self.profile_compute_by_offset(profile, vpos,
-                        vecA, offsetA, vecB, offsetB)
-        elif len(vd.leds) == 2:
-            vecA = ptA - vpos
-            vecB = ptB - vpos
-            section = self.profile_compute_by_vectors(profile,
-                        ptA, vecA, ptB, ed.vec.cross(vecB))
-        else:
-            edA = find(pairA.leds, lambda edd: edd != ed)
-            edB = find(pairB.leds, lambda edd: edd != ed)
-            vecA = edA.vec.copy()
-            if vecA.dot(edA.ptmid - vpos) < 0:
-                vecA.negate()
-            vecB = edB.vec.copy()
-            if vecB.dot(edB.ptmid - vpos) < 0:
-                vecB.negate()
-            section = self.profile_compute_by_vectors(profile,
-                        ptA, vecA, ptB, ed.vec.cross(vecB))
-
-        if not on_plane(section[0], face_plane(ed.facemain)):
-            section.reverse()
-        ed.cross_sections[icorner] = section
-        return section
-
-    # Construct the lattice for the rounding of an edge
-    def build_lattice(self, i, xsection1, xsection2, sh_section1, sh_section2):
-        if vec_approx_eq(xsection1[i], xsection2[i]):
-            lpts = [xsection1[i]]
-        else:
-            lpts = [xsection1[i], xsection2[i]]
-
-        if sh_section2 and sh_section2[i] and len(sh_section2[i]) > 0:
-            for pt in sh_section2[i]:
-                if not (vec_approx_eq(pt, xsection2[i]) or vec_approx_eq(pt, xsection2[i+1])):
-                    lpts.append(pt)
-
-        lpts.append(xsection2[i + 1])
-        if not vec_approx_eq(xsection2[i + 1], xsection1[i + 1]):
-            lpts.append(xsection1[i + 1])
-
-        if sh_section1 and sh_section1[i] and len(sh_section1[i]) > 0:
-            lpt1 = []
-            for pt in sh_section1[i]:
-                if not (vec_approx_eq(pt, xsection1[i]) or vec_approx_eq(pt, xsection1[i+1])):
-                    lpt1.append(pt)
-            lpt1.reverse()
-            lpts.extend(lpt1)
-
-        return lpts
-
-    # Compute the round border on an edge as a vmesh
-    def compute_mesh_edge(self, ed):
-        xsection1 = ed.cross_sections[0]
-        xsection2 = ed.cross_sections[1]
-        sh_section1 = ed.sharp_sections[0]
-        sh_section2 = ed.sharp_sections[1]
- 
-        nblat = len(xsection1) - 1
-        n2 = nblat // 2
-        n1 = nblat - n2
- 
-        # Part close to main face
-        face1 = ed.facemain
-        mesh1 = []
-        for i in range(0, n1):
-            mesh1.append(self.build_lattice(i, xsection1, xsection2, sh_section1, sh_section2))
-        if n1 > 0:
-            normalref1 = self.compute_normal_reference(ed, face1, xsection1[0], xsection1[1])
-
-        # Part close to the other face
-        face2 = ed.lfaces[1] if ed.lfaces[0] == ed.facemain else ed.lfaces[0]
-        mesh2 = []
-        for i in range(n1, nblat):
-            mesh2.append(self.build_lattice(i, xsection1, xsection2, sh_section1, sh_section2))
-        if n2 > 0:
-            normalref2 = self.compute_normal_reference(ed, face2, xsection1[n1+1], xsection1[n1])
-
-        # Creating the vmesh, single or double
-        ed.vmesh = []
-        if edge_reversed_in_face(ed.edge, face1) == edge_reversed_in_face(ed.edge, face2):
-            if n1 > 0:
-                ed.vmesh.append([mesh1, face1, normalref1])
-            if n2 > 0:
-                ed.vmesh.append([mesh2, face2, normalref2])
-        else:
-            ed.vmesh.append([mesh1 + mesh2, face1, normalref1])
-
-        # Creating the border edges
-        ed.vborders = []
-        ed.vborders.append([[xsection1[0], xsection2[0]], 'S'])
-        ed.vborders.append([[xsection1[-1], xsection2[-1]], 'S'])
-
-        # Termination edges
-        xs = [xsection1, xsection2]
-        for i in range(0, 2):
-            if len(ed.corners[i].leds) == 1:
-                ed.vborders.append([xs[i], 'P'])
-
-    def compute_mesh_edge_triangulated(self, vd, ed1, ed2, seg1, seg2):
-        icorner1 = 0 if ed1.corners[0] == vd else 1
-        icorner2 = 0 if ed2.corners[0] == vd else 1
-        xsection1 = ed1.cross_sections[icorner1]
-        xsection2 = ed2.cross_sections[icorner2]
-        reversed = (xsection1[0] - xsection2[0]).length > (xsection1[0] - xsection2[-1]).length and \
-                   (xsection1[-1] - xsection2[-1]).length >= (xsection1[-1] - xsection2[0]).length
-
-        nblat = len(xsection1) - 1
-        n2 = nblat // 2
-        n1 = nblat - n2
-
-        # Part close to main face
-        face1 = ed1.facemain
-        mesh1 = []
-        for i in range(0, n1):
-            mesh1.append(self.build_lattice(i, xsection1, xsection2, None, None))
-        if n1 > 0:
-            normalref1 = self.compute_normal_reference(ed1, face1, xsection1[0], xsection1[1])
-
-        # Part close to the other face
-        if reversed:
-            face2 = ed2.facemain
-        else:
-            face2 = find(ed2.lfaces, lambda f: f != ed2.facemain)
-        mesh2 = []
-        for i in range(0, nblat):
-            mesh1.append(self.build_lattice(i, xsection1, xsection2, None, None))
-        if n2 > 0:
-            normalref2 = self.compute_normal_reference(ed2, face2, xsection1[n1+1], xsection1[n1])
-
-        # Creating the vmesh, single or double
-        if n1 > 0:
-            self.lst_vmesh_triangulated.append([mesh1, face1, normalref1])
-        if n2 > 0:
-            self.lst_vmesh_triangulated.append([mesh2, face2, normalref2])
-
-        # Creating the border edges
-        if xsection1[0] != xsection2[0]:
-            self.lst_vborders_triangulated.append([[xsection1[0], xsection2[0]], 'S'])
-        if xsection1[-1] != xsection2[-1]:
-            self.lst_vborders_triangulated.append([[xsection1[-1], xsection2[-1]], 'S'])
-
-    def sort_corners_for_orientation(self, vda, vdb):
-        eda = vda.gold_ed
-        edb = vdb.gold_ed
-        if vda.convex:
-            return -1
-        if vdb.convex:
-            return 1
-        if eda and edb:
-            return  cmp(eda.golden, edb.golden)
-        elif eda:
-            return -1
-        elif edb:
-            return 1
-        else:
-            return 0
-
-    # Compute right orientation at corner
-    def orientation_at_corner(self, vd):
-        edgold = vd.gold_ed
-        if not edgold:
-            return
-        ledface = []
-        for ed in vd.leds:
-            for face in ed.lfaces:
-                if ed == edgold:
-                    continue
-                if self.ed_common_face(ed, face, edgold):
-                    iface = 0 if ed.lfaces[0] == face else 1
-                    ledface.append([ed, iface])
-                    break
-        main = 0 if find(ledface, lambda ll: ll[0].facemain) else 1
-        for ll in ledface:
-            ed = ll[0]
-            iface = ll[1]
-            iface2 = (iface + main) % 2
-            if not ed.facemain:
-                ed.facemain = ed.lfaces[iface2]
-            catena = ed.catenas[iface2]
-            if catena.nbsmall <= 0:
-                self.assign_ed_facemain(catena)
-            ed.catenas[iface].nbsmall += 1
-
-    # Find if 2 edges share a common face
-    def ed_common_face(self, ed0, face0, ed1):
-        for face in ed1.lfaces:
-            if parallel(face.normal, face0.normal):
-                return True
-        return False
-
-    # Compute all face orientations - needed for odd number of segments
-    def compute_face_orientation(self):
-        # Starting with the round corners
-        lcorners = list(self.hsh_corners.values())
-        lcorners.sort(key = functools.cmp_to_key(
-            lambda x, y : self.sort_corners_for_orientation(x,y)))
-
-        hsh = {}
-        for vd in lcorners:
-            if vd in hsh:
-                continue
-            hsh[vd] = True
-            edgold = vd.gold_ed
-            if not edgold:
-                continue
-            self.orientation_at_corner(vd)
-            vd2 = edgold.corners[1] if edgold.corners[0] == vd else edgold.corners[0]
-            if vd2 and vd2 not in hsh:
-                hsh[vd2] = True
-                self.orientation_at_corner(vd)
-
-        # Assigning the main faces to edge
-        for catena in self.lst_catenas:
-            if catena.nbsmall == 0:
-                self.assign_ed_facemain(catena)
-
-        # Remaining edges
-        for ed in self.hsh_ed.values():
-            if not ed.facemain:
-                ed.facemain = ed.lfaces[0]
-
-    # Propagate face orientation on a catena
-    def assign_ed_facemain(self, catena):
-        for ll in catena.chain:
-            ed = ll[0]
-            iface = ll[1]
-            other_catena = ed.catenas[1] if ed.catenas[0] == catena else ed.catenas[1]
-            if not ed.facemain:
-                ed.facemain = ed.lfaces[iface]
-            other_catena.nbsmall += 1
-
-    # Scan all corners for determining golden edges
-    def corner_scan_all(self):
-        # find golden edge if vd has valence 3 or 4
-        for vd in self.hsh_corners.values():
-            self.corner_scan_golden(vd)
-        # Final golden edge calc, for valence 3
-        for vd in self.hsh_corners.values():
-            self.corner_determine_golden(vd)
-
-        # For valence 3, which have round profile?
-        # (TODO: is it really necessary to do this twice?)
-        for vd in self.hsh_corners.values():
-            self.corner_round_profile(vd)
-        for vd in self.hsh_corners.values():
-            self.corner_round_profile(vd)
-
-    # Search and propagate the golden edges.
-    # Only assigns a value if valence is 3 or 4.
-    # In those caes, sets the vd.gold_ed to
-    # the corner's ed that is best for golden edge.
-    # When valence is 3, picks the golden edge
-    # (somehow) and sets the edge's aligned property
-    # to True if the other pairs edges intersect.
-    def corner_scan_golden(self, vd):
-        if len(vd.leds) == 4:
-            vd.leds.sort(key = functools.cmp_to_key(compare_gold_ed))
-            vd.gold_ed = vd.leds[0]
-
-        if len(vd.leds) != 3:
-            return
-
-        # Identifying convex corners
-        leds = vd.leds
-        pairs = vd.pairs
-        for pair in pairs:
-            ed1 = pair.leds[0]
-            ed2 = pair.leds[1]
-            ed0 = find(leds, lambda ed: ed != ed1 and ed != ed2)
-            if pair.convex:
-                ed0.golden = -1
-                vd.gold_ed = ed0
-            otherpairs = [p for p in pairs if p != pair]
-            if ed1 in otherpairs[0].leds:
-                pair1 = otherpairs[0]
-                pair2 = otherpairs[1]
-            else:
-                pair1 = otherpairs[1]
-                pair2 = otherpairs[0]
-            ed0.aligned = intersect_line_line(
-                [pair1.ptcross, ed1.vec],
-                [pair2.ptcross, ed2.vec])
-
-    # Compare two edges to determine which one has to be gold.
-    # If the vertex is convex, then the 'golden' member of the
-    # edge should be set to something to help compare.
-    # Else if the cosines of the angles the edges faces
-    # differ from 90 differ a lot then the one that
-    # is more acute wins.
-    # Else the one that is more closely aligned with the
-    # golden axis wins.
-    # Else the longer edge wins.
-    def compare_gold_ed(self, vd, eda, edb):
-        if vd.convex:
-            return cmp(eda.golden, edb.golden)
-        if eda.aligned and not edb.aligned:
-            return -1
-        elif edb.aligned and not eda.aligned:
-            return 1
-        cosa = eda.cos
-        cosb = edb.cos
-        val = 0 if abs(cosa - cosb) < 0.5 else cmp(cosa, cosb)
-        if val == 0:
-            val = -cmp(abs(eda.vec.dot(self.golden_axis)), abs(edb.vec.dot(self.golden_axis)))
-        if val == 0:
-            val = -cmp(eda.length, edb.length)
-        return val
-
-    # Determine the golden edge at a 3 edges corner
-    def corner_determine_golden(self, vd):
-        if len(vd.leds) != 3:
-            return
-        lsgold = vd.leds[::]
-        lsgold.sort(key = functools.cmp_to_key(lambda x, y: self.compare_gold_ed(vd, x, y)))
-        ed0 = lsgold[0]
-        if not vd.gold_ed:
-            vd.gold_ed = ed0
-        for pair in vd.pairs:
-            if ed0 in pair.leds:
-                continue
-            vd.round_pair = pair
-
-    # Calculate whether edges at a vertex should have a round profile
-    def corner_round_profile(self, vd):
-        if len(vd.leds) != 3:
-            return
-        ed0 = vd.gold_ed
-        ledothers = [ed for ed in vd.leds if ed != ed0]
-        ed1 = ledothers[0]
-        ed2 = ledothers[1]
- 
-        ed0.round_profile = self.use_round_profile(ed0)
-        if self.use_round_profile(ed1) or self.use_round_profile(ed2):
-            ed1.round_profile = True
-            ed2.round_profile = True
-
-    # Get the profiles for the edge depending on the hybrid settings
-    def use_round_profile(self, ed):
-        if ed.round_profile:
-            return True
-        if self.mode_profile == -1:
-            return False
-        elif self.mode_profile == 0:
-            return ed.golden == -1
-        else:
-            return ed.golden == -1 or ed.corners[0].gold_ed == ed or ed.corners[1].gold_ed == ed
- 
-    # Calculate rounding at corner, if applicable
-    def rounding_compute(self, vd):
-        if not self.mode_rounding:
-            return
-        if self.num_seg == 1 or (self.mode_sharp and not vd.convex) or len(vd.leds) !=3:
-            return
-        # Getting the golden edge and determining the metal pair
-        ed_gold = vd.gold_ed
-        pair_gold = find(vd.pairs, lambda pair: ed_gold not in pair.leds)
-        pair_silver = None
-        pair_bronze = None
-        ed_silver = None
-        ed_bronze = None
-        facemain = ed_gold.facemain
-        otherface = ed_gold.lfaces[1] if ed_gold.lfaces[0] == facemain else ed_gold.lfaces[0]
-        for pair in vd.pairs:
-            if pair == pair_gold:
-                continue
-            if on_plane(pair.ptcross, face_plane(facemain)):
-                pair_silver = pair
-                ed_silver = pair.leds[1] if pair.leds[0] == ed_gold else pair.leds[0]
-            else:
-                pair_bronze = pair
-                ed_bronze = pair.leds[1] if pair.leds[0] == ed_gold else pair.leds[0]
-        if not (pair_silver and pair_bronze):
-            return
-
-        # Calculate the planes for the golden edge
-        gold_ptcross = pair_gold.ptcross
-        plane_silver = [pair_silver.ptcross, ed_silver.vec]
-        line_silver = [gold_ptcross, ed_silver.vec]
-        plane_bronze = [pair_bronze, ed_bronze.vec]
-        line_bronze = [gold_ptcross, ed_bronze.vec]
-        pt_silver = intersect_line_plane([gold_ptcross, ed_silver.vec], [pair_silver.ptcross, ed_silver.vec])
-        pt_bronze = intersect_line_plane([gold_ptcross, ed_bronze.vec], [pair_bronze.ptcross, ed_bronze.vec])
-
-        # Rounding is not materialized
-        if not pt_silver or not pt_bronze or vec_approx_eq(pt_silver, pt_bronze) or \
-                vec_approx_eq(pt_silver, gold_ptcross) or vec_approx_eq(pt_bronze, gold_ptcross):
-            return
-
-
-        # Computing the rounding
-        vpos = vd.vertex.co
-        vec1 = ed_silver.ptmid - vpos
-        vec2 = ed_bronze.ptmid - vpos
-        normal2 = vec1.cross(vec2)
-        offset1 = (pt_silver - gold_ptcross).length
-        offset2 = (pt_bronze - gold_ptcross).length
-        pair_gold.rounding = self.profile_compute_by_offset(['C', self.num_seg],
-                gold_ptcross, vec1, offset1, vec2, offset2)
-
-    # Corner calculation
-    def corner_compute(self, vd):
-        mode_sharp = self.mode_sharp
-        n = len(vd.leds)
-        if n == 1 or n == 2:
-            self.corner_compute_12(vd)
-        elif n == 3:
-            if self.num_seg == 1:
-                self.corner_compute_3round(vd)
-            elif (not mode_sharp and self.num_seg != 1) or vd.convex:
-                self.corner_compute_3round(vd)
-            elif self.strict_offset:
-                self.corner_compute_any_sharp(vd)
-            else:
-                self.corner_compute_3sharp(vd)
-        elif n == 4:
-            if mode_sharp:
-                self.corner_compute_any_sharp(vd)
-            else:
-                self.corner_compute_round_4(vd)
-        else:
-            if mode_sharp:
-                self.corner_compute_any_sharp(vd)
-            else:
-                self.corner_compute_star(vd)
- 
-    # Compute a corner with 1 or 2 edges (sharp)
-    def corner_compute_12(self, vd):
-        for ed in vd.leds:
-            icorner = 0 if ed.corners[0] == vd else 1
-            section = self.compute_sections_multi(ed, icorner)
-            if len(vd.leds) == 1:
-                # Do we need an extra face between end of beveled
-                # edge and vd?  Usually yes, but not in certain cases.
-                # One case where we don't: if there are only 3 faces
-                # at the vertex and the 3rd face contains the
-                # beveled end completely.
-                needcornerface = True
-                vfaces = vd.vertex.link_faces
-                if len(vfaces) == 3:
-                    f3 = find(vfaces, lambda f: f != ed.lfaces[0] and f != ed.lfaces[1])
-                    if not f3:
-                        print("whoops, couldn't find 3rd face")
-                    bf3 = self.hsh_faces[f3.index]
-                    # test segment containment by containment of midpoint
-                    # in face - for this case, should be ok
-                    mid = section[0].lerp(section[1], 0.5)
-                    if bf3.contains_point(mid):
-                        needcornerface = False
-                if needcornerface:
-                    facepts = section + [vd.vertex.co]
-                    norm = ed.lfaces[0].normal + ed.lfaces[1].normal
-                    norm.normalize()
-                    vd.vmesh = [[[facepts], ed.lfaces[0], norm]]
- 
-    # Compute a round corner with 3 edges
-    def corner_compute_3round(self, vd):
-        leds = vd.leds
-
-        # Using the golden edge and compute the golden section0
-        # which is the profile for the end of the golden edge,
-        # going from its main face to its non-main face.
-        ed0 = vd.gold_ed
-        icorner0 = 0 if ed0.corners[0] == vd else 1
-        section0 = self.compute_sections_multi(ed0, icorner0)
-
-        # Computing the other edges
-        # Pair A is the one for ed0 going around its facemain
-        # Pair B is the remaining one
-        iA = 0 if ed0.facemain == ed0.lfaces[0] else 1
-        iB = 1 - iA
-        pairA = ed0.pairs[2 * icorner0 + iA]
-        pairB = ed0.pairs[2 * icorner0 + iB]
-        ed1 = find(pairA.leds, lambda ed: ed != ed0 and \
-                        self.ed_common_face(ed0, ed0.facemain, ed))
-        ed2 = find(pairB.leds, lambda ed: ed != ed0 and ed != ed1)
-        pair_other = find(vd.pairs, lambda pair: ed0 not in pair.leds)
-
-        # Computing the grid
-        # Make lpts be an array of sections, where the start points
-        # are the cross-point of the non-golden-edge pair (or, if that
-        # is rounded, the rounding points for that), and the end points
-        # are the points on the golden section (going from its facemain
-        # to the other face).
-        n0 = len(section0) - 1
-        origin = pair_other.ptcross
-        if pair_other.rounding:
-            lorigin = pair_other.rounding[::]
-            lorigin.reverse()
-        else:
-            lorigin = (n0+1) * [ None ]
-            for i in range(0, n0+1):
-                lorigin[i] = origin
-        vec0 = ed0.vec
-        if icorner0 == 1:
-            vec0 = vec0.copy()
-            vec0.negate()
-        normal = ed1.vec.cross(ed2.vec)
-        vec = origin - vd.vertex.co
-        lpts = []
-        profile = ['C', self.num_seg] if (ed1.round_profile or ed2.round_profile) \
-                else self.profile_type
-        for i in range(0, n0 + 1):
-            lpt = self.profile_compute_by_vectors(profile, section0[i],
-                vec0, lorigin[i], normal)
-            lpts.append(lpt)
-        icorner1 = 0 if ed1.corners[0] == vd else 1
-        icorner2 = 0 if ed2.corners[0] == vd else 1
-
-        # ed1 is the edge sharing the golden edge's facemain, so it
-        # gets the first section in lpts
-        section1 = lpts[0]
-        if not on_plane(section1[0], face_plane(ed1.facemain)):
-            section1 = section1[::]
-            section1.reverse()
-
-        # ed2 is the other of the non-golden pair, so it gets the last
-        # section in lpts
-        section2 = lpts[-1]
-        if not on_plane(section2[0], face_plane(ed2.facemain)):
-            section2 = section2[::]
-            section2.reverse()
-
-        ed1.cross_sections[icorner1] = section1
-        ed2.cross_sections[icorner2] = section2
-
-        # Constructing the mesh.
-        # Makes nseg strips of nseg quads (the first quad
-        # in the strip will really be a tri unless this corner has rounding).
-        # Strip i starts at the other-pair cross point (or the ith point on
-        # it, if rounded), and proceeds to end at the edge between
-        # (section0[i], section0[i+1]).
-        vmesh = []
-        lquads =[]
-        n = len(lpts) - 2
-        for i in range(0, n + 1):
-            pts1 = lpts[i]
-            pts2 = lpts[i + 1]
-            m = len(pts1) - 2
-            for j in range(0, m + 1):
-                if vec_approx_eq(pts1[j + 1], pts2[j + 1]):
-                    pts = [pts1[j], pts1[j + 1], pts2[j]]
-                elif vec_approx_eq(pts1[j], pts2[j]):
-                    pts = [pts1[j], pts1[j + 1], pts2[j + 1]]
-                else:
-                    pts = [pts1[j], pts1[j + 1], pts2[j + 1], pts2[j]]
-                lquads.append(pts)
-
-        nb = self.num_seg
-        n0 = nb // 2
-        odd = (nb % 2) != 0
-
-        # Triangle corner
-        if parallel(ed1.facemain.normal, ed0.facemain.normal):
-            n1 = n0 - 1
-            face1 = ed1.lfaces[1] if ed1.lfaces[0] == ed1.facemain else ed1.lfaces[0]
-        else:
-            n1 = n0 - 1 + odd
-            face1 = ed1.facemain
-        lq1 = []
-        for i in range(0, nb):
-            for j in range(0, n1 + 1):
-                lq1.append(lquads[i * nb + j])
-        if len(lq1) > 0:
-            quad = lquads[0]
-            normalref = self.compute_normal_reference(ed1, face1, quad[0], quad[1])
-            vmesh.append([lq1, face1, normalref])
-
-        # Side corner 1
-        lq2 = []
-        for i in range(0, n0 + odd):
-            for j in range(n1 + 1, nb):
-                lq2.append(lquads[i * nb + j])
-        if len(lq2) > 0:
-            quad = lquads[n1 + 1]
-            normalref = self.compute_normal_reference(ed1, ed0.facemain, quad[1], quad[0])
-            vmesh.append([lq2, ed0.facemain, normalref])
-
-        # Side corner 2
-        lq3 = []
-        for i in range(n0 + odd, nb):
-            for j in range(n1 + 1, nb):
-                lq3.append(lquads[i * nb + j])
-        if parallel(ed2.facemain.normal, face1.normal):
-            face2 = ed2.lfaces[1] if ed2.lfaces[0] == ed2.facemain else ed2.lfaces[0]
-        else:
-            face2 = ed2.lfaces[0] if ed2.lfaces[0] == ed2.facemain else ed2.lfaces[1]
-        if len(lq3) > 0:
-            quad = lquads[(n0 + odd) * nb + 1]
-            normalref = self.compute_normal_reference(ed2, face2, quad[1], quad[0])
-            vmesh.append([lq3, face2, normalref])
-
-        # Storing the mesh
-        vd.vmesh = vmesh
-
-    # Compute round corner for termination with 4 edges
-    def corner_compute_round_4(self, vd):
-        # Computing the cross sections for each edge
-        leds = vd.leds
-        for ed in leds:
-            icorner0 = 0 if ed.corners[0] == vd else 1
-            self.compute_sections_multi(ed, icorner0)
-
-        # picking one edge
-        ed0 = leds[0]
-
-        # looking for adjacent edges
-        oface0 = ed0.lfaces[1] if ed0.facemain == ed0.lfaces[0] else ed0.lfaces[0]
-        ed1 = find(leds, lambda ed: ed != ed0 and self.ed_common_face(ed0, ed0.facemain, ed))
-        ed2 = find(leds, lambda ed: ed != ed0 and ed != ed1 and \
-                        self.ed_common_face(ed0, oface, ed))
-        ed4 = find(leds, lambda ed: ed != ed0 and ed != ed1 and ed != ed2)
-
-        # orientation of the edges
-        icorner0 = 0 if ed0.corners[0] == vd else 1
-        icorner1 = 0 if ed1.corners[0] == vd else 1
-        icorner2 = 0 if ed2.corners[0] == vd else 1
-        icorner4 = 0 if ed4.corners[0] == vd else 1
-
-        xsection0 = ed0.cross_sections[icorner0]
-        xsection1 = ed1.cross_sections[icorner1]
-        xsection2 = ed2.cross_sections[icorner2]
-        xsection4 = ed4.cross_sections[icorner4]
- 
-        if xsection1[0] in xsection0:
-            xfirst = xsection0
-            xlast = xsection4
-        else:
-            xlast = xsection0
-            xfirst = xsection4
-
-        if xfirst[0] in xsection1:
-            xfirst = xfirst[::]
-            xfirst.reverse()
-        if xlast[0] in xsection1:
-            xlast = xlast[::]
-            xlast.reverse()
-        if (xsection2[0] - xsection1[0]).length > (xsection2[0] - xsection1[-1]).length and \
-            (xsection2[-1] - xsection1[0]).length < (xsection2[-1] - xsection1[-1]).length:
-            xsection2 = xsection2[::]
-            xsection2.reverse()
- 
-        # creating the grid sections
-        profile0 = ['C', self.num_seg] if ed0.round_profile else self.profile_type
-        vec1 = ed1.ptmid - vd.vertex.co
-        vec2 = ed2.ptmid - vd.vertex.co
-
-        lpts = [xfirst]
-        n = len(xsection1) - 2
-        n1 = n // 2
-        for i in range(1, n1 + 1):
-            norm = (xsection1[i + 1] - xsection1[i]).cross(vec1)
-            sec = self.profile_compute_by_vectors(profile0, xsection2[i], vec2,
-                    xsection1[i], norm)
-            sec.reverse()
-            lpts.append(sec)
-        for i in range(n1 + 1, n + 1):
-            norm = (xsection2[i + 1] - xsection2[i]).cross(vec2)
-            lpts.append(self.profile_compute_by_vectors(profile0, xsection1[i],
-                    vec1, xsection2[i], norm))
-        lpts.append(xlast)
-
-        # Constructing the vmesh
-        vmesh = []
-        lquads = []
-        n = len(lpts) - 2
-        for i in range(0, n + 1):
-            pts1 = lpts[i]
-            pts2 = lpts[i + 1]
-            m = len(pts1) - 2
-            for j in range(0, m + 1):
-                if vec_approx_eq(pts1[j + 1], pts2[j + 1]):
-                    pts = [pts1[j], pts1[j + 1], pts2[j]]
-                elif vec_approx_eq(pts1[j], pts2[j]):
-                    pts = [pts1[j], pts1[j + 1], pts2[j + 1]]
-                else:
-                    pts = [pts1[j], pts1[j + 1], pts2[j + 1], pts2[j]]
-                lquads.append(pts)
-
-        # List of faces
-        nb = self.num_seg
-        n0 = nb // 2
-        odd = (nb % 2) == 1
-
-        # First quadrant
-        quad = lquads[0]
-        pt = quad[0]
-        ll = self.locate_point_face_4(pt, ed0, ed1, ed2, ed4)
-        faceA = ll[0]
-        edA = ll[1]
-        edB = ll[2]
-        lq = []
-        ni = n0 + odd if parallel(faceA.normal, edB.facemain.normal) else n0
-        nj = n0 + odd if faceA == edA.facemain else n0
-        for i in range(0, ni):
-            for j in range(0, nj):
-                lq.append(lquads[i * nb + j])
-        if len(lq) > 0:
-            normalref = self.compute_normal_reference(edA, faceA, quad[0], quad[1])
-            vmesh.push([lq, faceA, normalref])
-
-        # second quadrant
-        quad = lquads[nb - 1]
-        pt = quad[1]
-        ll = self.locate_point_face_4(pt, ed0, ed1, ed2, ed4)
-        faceA = ll[0]
-        edA = ll[1]
-        edB = ll[2]
-        ni2 = n0 + odd if parallel(faceA.normal, edB.facemain.normal) else n0
-        for i in range(0, ni2):
-            for j in range(nj, nb):
-                lq.append(lquads[i * nb + j])
-        if len(lq) > 0:
-            normalref = self.compute_normal_reference(edA, faceA, quad[1], quad[2])
-            vmesh.append([lq, faceA, normalref])
-
-        # third quadrant
-        quad = lquads[nb * (nb - 1)]
-        pt = quad[3]
-        ll = self.locate_point_face_4(pt, ed0, ed1, ed2, ed4)
-        faceA = ll[0]
-        edA = ll[1]
-        edB = ll[2]
-        lq = []
-        nj = n0 + odd if faceA == edA.facemain else n0
-        for i in range(ni, nb):
-            for j in range(0, nj):
-                lq.append(lquads[i * nb + j])
-
-        if len(lq) > 0:
-            normalref = self.compute_normal_reference(edA, faceA, quad[0], quad[1])
-            vmesh.append([lq, faceA, normalref])
-
-        # fourth quadrant
-        quad = lquads[nb * nb - 1]
-        pt = quad[2]
-        ll = self.locate_point_face_4(pt, ed0, ed1, ed2, ed4)
-        faceA = ll[0]
-        edA = ll[1]
-        edB = ll[2]
-        lq = []
-        for i in range(ni2, nb):
-            for j in range(nj, nb):
-                lq.append(lquads[i * nb + j])
-        if len(lq) > 0:
-            normalref = self.compute_normal_reference(edA, faceA, quad[1], quad[0])
-            vmesh.append([lq, faceA, normalref])
-
-        # Storing the vmesh
-        vd.mesh = vmesh
-
-    # Locate on which edge is the given point
-    def locate_point_face_4(self, pt, ed0, ed1, ed2, ed4):
-        for ll in [[ed0, ed1], [ed0, ed2], [ed4, ed1], [ed4, ed2]]:
-            face = self.which_face_4(pt, ll[0], ll[1])
-            if face:
-                return [face] + ll
-        return None
-
-    # Determine on which face is a given point
-    def which_face_4(self, pt, eda, edb):
-        plane = [eda.ptmid, eda.vec.cross(edb.vec)]
-        if not on_plane(pt, plane):
-            return
-        for face in eda.lfaces:
-            if self.ed_common_face(eda, face, edb):
-                return face
-        return None
-
-    # Orthogonal section to an edge at a vertex
-    # Let ptA and ptB be the pair intersection points
-    # at for the edge at the vertex.
-    # Make a plane that goes through ptA and the
-    # average normal of the two planes for the edge.
-    # Calculate the cross section for the edge at the
-    # vertex and project onto the plane, and return that.
-    def orthogonal_section_ed(self, ed, vd):
-        # getting the pairs and cross points
-        icorner = 0 if ed.corners[0] == vd else 1
-        iA = 0 if ed.facemain == ed.lfaces[0] else 1
-        iB = 1 - iA
-        pairA = ed.pairs[2 * icorner + iA]
-        pairB = ed.pairs[2 * icorner + iB]
-        ptA = pairA.ptcross
-        ptB = pairB.ptcross
-        vf1 = ed.lfaces[0].normal
-        vf2 = ed.lfaces[1].normal
-        if vf1.dot(vf2) <= 0:
-            vf2 = vf2.copy()
-            vf2.negate()
-        vfmean = vf1.lerp(vf2, 0.5)
-
-        # computing the projection on plane
-        plane = [ptA, vfmean.cross(ptB - ptA)]
-        section = self.compute_profile_edge(ed)
-        ed.cross_sections[icorner] = [intersect_line_plane([pt, ed.vec], plane) \
-                                        for pt in section]
-        return ed.cross_sections[icorner]
-
-    # Compute a round corner with 5 or more edges -
-    # Triangulation of Rastapopoulos
-    def corner_compute_star(self, vd):
-        # Computing the cross sections for each edge
-        # These cross sections are at the corner but projected onto a plane
-        # (see comment for orthogonal_section_ed).
-        lsec = [[ed, self.orthogonal_section_ed(ed, vd)] for ed in vd.leds]
-
-        # Finding the pivot point and plane that best fit cross points
-        # ptpivot will be the point in the center of the star.
-        # It is fac (0.5) of the way between the corner vertex and
-        # a point on the best-fitting plane for points on the edge cross sections.
-        nb = self.num_seg // 2 + 1
-        lptcross = [ll[1][nb] for ll in lsec]
-        plane = fit_plane_to_points(lptcross)
-        vpos = vd.vertex.co
-        ptproj = project_to_plane(vpos, plane)
-        normal = vpos - ptproj
-        fac = 0.5
-        ptpivot = vpos.lerp(ptproj, fac)
-        self.lst_mark_points.append(ptpivot)
-
-        # Create the mesh
-        vmesh = []
-        profile0 = ['C', nb]
-        for ll in lsec:
-            ed = ll[0]
-            xsection = ll[1]
-            # For edge ed, take each point in the cross section and make a profile going
-            # from the pivot to that point, putting the results lpts.
-            lpts = [self.profile_compute_by_vectors(profile0, pt, (pt - vpos), ptpivot, normal) \
-                    for pt in xsection]
-            lquads = []
-            n = len(lpts) - 2
-            # For each i, use the pivot->point on edge cross section profile
-            # for i and i+1 to make tris and quads.  The first will be a tri.
-            for i in range(0, n + 1):
-                pts1 = lpts[i]
-                pts2 = lpts[i + 1]
-                m = len(pts1) - 2
-                for j in range(0, m + 1):
-                    if vec_approx_eq(pts1[j + 1], pts2[j + 1]):
-                        pts = [pts1[j], pts1[j + 1], pts2[j]]
-                    elif vec_approx_eq(pts1[j], pts2[j]):
-                        pts = [pts1[j], pts1[j + 1], pts2[j + 1]]
-                    else:
-                        pts = [pts1[j], pts1[j + 1], pts2[j + 1], pts2[j]]
-                    lquads.append(pts)
-
-            # Separating the vmesh in two parts
-            odd = (self.num_seg % 2) == 1
-            if odd == 0:
-                n1 = self.num_seg // 2 + odd
-                m1 = n1 * (nb + odd) - 1
-            else:
-                n1 = self.num_seg // 2 + odd + 1
-                m1 = n1 * (nb - odd)
-
-            quad = lquads[0]
-            faceref = ed.facemain
-            normalref = self.compute_normal_reference(ed, faceref, quad[1], quad[0])
-            vmesh.append([lquads[0:m1 + 1], faceref, normalref])
-
-            quad = lquads[-1]
-            faceref = ed.lfaces[1] if ed.lfaces[0] == ed.facemain else ed.lfaces[0]
-            normalref = self.compute_normal_reference(ed, faceref, quad[1], quad[0])
-            if m1 >= 0:
-                vmesh.append([lquads[m1 + 1:], faceref, normalref])
-
-        vd.vmesh = vmesh
-
-    # Compute a sharp corner with 3 edges in standardized offset mode
-    def corner_compute_3sharp(self, vd):
-        leds = vd.leds
-
-        # Calculating the bisecting planes
-        vpos = vd.vertex.co
-        lplanes = []
-        for pair in vd.pairs:
-            ed1 = pair.leds[0]
-            ed2 = pair.leds[1]
-            ed0 = find(leds, lambda ed: ed != ed1 and ed != ed2)
-            plane = plane_by_3_points(pair.ptcross, vpos, ed0.ptmid)
-            lplanes.append([ed0, plane])
-
-        # Calculating the intersections of edge profiles with stop planes
-        for ed in leds:
-            cross_section = []
-            section = compute_profile_edge(ed)
-            ptmid = ed.ptmid
-            vec = vpos - ptmid
-            icorner = 0 if ed.corners[0] == vd else 1
-            ed_planes = []
-            for ll in lplanes:
-                if ll[0] != ed:
-                    ed_planes.append(ll[1])
-            for pt in section:
-                pt1 = intersect_line_plane([pt, vec], ed_planes[0])
-                pt2 = intersect_line_plane([pt, vec], ed_planes[1])
-                cross_section.append(pt1 \
-                    if (pt1 - ptmid).length < (pt2 - ptmid).length else pt2)
-            if not on_plane(cross_section[0], plane(ed.facemain)):
-                cross_section.reverse()
-            ed.cross_sections[icorner] = cross_section
-
-        # Compute the corner triangle if the number of segments is odd
-        n = self.num_seg // 2
-        if n * 2 == self.num_seg:
-            return
-        lfaces = []
-        for ed in leds:
-            lfaces.append(ed.facemain)
-        face0 = lfaces[0]
-        if parallel(face0.normal, lfaces[1].normal):
-            ieds = [0, 1]
-        elif parallel(face0.normal, lfaces[2].normal):
-            ieds = [0, 2]
-        else:
-            ieds = [1, 2]
-        lpt = []
-        ed1 = leds[ieds[0]]
-        icorner1 = 0 if ed1.corners[0] == vd else 1
-        ed2 = leds[ieds[1]]
-        icorner2 = 0 if ed2.corners[0] == vd else 1
-
-        pt1 = ed1.cross_sections[icorner1][n]
-        pt2 = ed1.cross_sections[icorner1][n+1]
-        pt3 = ed2.cross_sections[icorner2][n+1]
-        if pt3 == pt1 or pt3 == pt2:
-            pt3 = ed2.cross_sections[icorner2][n]
-
-        lpt.extend([pt1, pt2, pt3]) # or should it be .append??
-        faceref = ed1.facemain
-        normalref = compute_normal_reference(ed1, faceref, pt1, pt2)
-        vd.mesh = [[[lpt], faceref, normalref]]
-
-    # Compute a sharp corner with any number of edges
-    def corner_compute_any_sharp(self, vd):
-        leds = vd.leds
-
-        hshcross = {}
-        for ed in leds:
-            hshcross[ed] = []
-
-        # Calculating the sections
-        for ed in leds:
-            self.intersection_any_sharp(vd, ed)
-
-        # Filtering the edge termination
-        # linter will be a hash from (ed, index in cross section for ed)
-        # to one of the intersection data calculated for ed at vd.
-        # We want the one that minimizes the length of the intersection
-        # to the point on the mid-point edge for the index.
-        linter = {}
-        for inter in vd.sharp_inter:
-            pt = inter[0]
-            ed0 = inter[1]
-            i0 = inter[2]
-            icorner0 = 0 if ed0.corners[0] == vd else 1
-            nsection0 = ed0.nsection
-            make_index_valid(ed0.cross_sections[icorner0], i0)
-            ptold = ed0.cross_sections[icorner0][i0]
-            if ptold and (pt - nsection0[i0]).length > (ptold - nsection0[i0]).length:
-                continue
-            ed0.cross_sections[icorner0][i0] = pt
-            make_index_valid(inter, 5)
-            inter[5] = 0
-            make_index_valid(hshcross[ed0], i0)
-            hshcross[ed0][i0] = [inter]
-            linter[(ed0, i0)] = inter
-
-        # Assigning the intermediate points
-        for inter in linter.values():
-            pt = inter[0]
-            ed1 = inter[3]
-            j1 = inter[4]
-            icorner1 = 0 if ed1.corners[0] == vd else 1
-            ptcross = ed1.cross_sections[icorner1][j1]
-            if vec_approx_eq(pt, ptcross):
-                continue
-            inter = inter[::]
-            line = [ptcross, ed1.cross_sections[icorner1][j1 + 1] - ptcross]
-
-            origin = ed1.cross_sections[icorner1][j1]
-            ptmid = ed1.cross_sections[icorner1][j1 + 1]
-            vec0 = origin - ptmid
-
-            inter[5] = vec0.angle(pt - ptmid)
-
-            hsh = hshcross[ed1][j1]
-            hsh.append(inter)
-            hsh.sort(key = lambda inter: inter[5])
-            make_index_valid(ed1.sharp_sections[icorner1], j1)
-            ed1.sharp_sections[icorner1][j1] = [inter[0] for inter in hsh]
-
-        # Identifying the holes
-        hsh_edplanes = {}
-        for ed in leds:
-            lcross = hshcross[ed]
-            n0 = len(lcross) - 2
-            for i in range(0, n0 + 1):
-                linter = lcross[i] + [lcross[i + 1][0]]
-                n1 = len(linter) - 2
-                for j in range(0, n1 + 1):
-                    inter1 = linter[j]
-                    inter2 = linter[j + 1]
-                    lled = []
-                    edc = None
-                    for edd in [inter1[1], inter1[3], inter2[1], inter2[3]]:
-                        if edd in lled:
-                            edc = edd
-                        else:
-                            lled.append(edd)
-                    if len(lled) > 2:
-                        self.lst_mark_points.extend([inter1[0], inter2[0]])
-                        pt = edc.nsection[i].lerp(edc.nsection[i + 1], 0.5)
-                        plane = [pt, (edc.nsection[i + 1] - edc.nsection[i]).cross(edc.vec)]
-                        key = (edc, i)
-                        hsh_edplanes[key] = [key, edc, i, plane, inter1[0], inter2[0]]
-                        self.lst_mark_points.append(pt)
-
-        # Finding the plane intersections
-        lst_loops = self.sharp_find_loops(hsh_edplanes)
-        for loop in lst_loops:
-            for i in range(0, len(loop)):
-                lst_insert = self.sharp_intersect_planes(vd, loop)
-                if lst_insert:
-                    for ll in lst_insert:
-                        self.sharp_insert_in_section(vd, ll[0], ll[1], ll[2])
-                    break
-
-    # Compute the section for an edge in Sharp mode at a vertex
-    # Sets vd.sharp_inter to a list of data about where lines on
-    # the cross section for ed0 intersect lines on segments
-    # of cross sections of other edges at vd.
-    # Each element of list is:
-    # [intersection pt, ed0, index in ed0's cross section,
-    #  ed1 (another edge), index in ed1's cross section]
-    def intersection_any_sharp(self, vd, ed0):
-        nsection0 = self.compute_profile_edge(ed0)
-        n0 = len(nsection0) - 1
-        vec0 = ed0.vec
-        for ed1 in vd.leds:
-            if ed1 == ed0:
-                continue
-            vec1 = ed1.vec
-            nsection1 = self.compute_profile_edge(ed1)
-            for i0 in range(0, n0 + 1):
-                pt0 = nsection0[i0]
-                line0 = [pt0, vec0]
-                for j1 in range(0, n0):
-                    pt = self.intersect_between_two_lines(line0, vec1,
-                                nsection1[j1], nsection1[j1+1])
-                    if pt:
-                        vd.sharp_inter.append([pt, ed0, i0, ed1, j1])
-
-    # Determine if a line cuts a segment defined by two points and a vector.
-    # line0 is the line we are trying to intersect.
-    # Two other lines are defined by direction v1 through points pt1A and pt1B.
-    # Where line0 intersections the plane defined by those other two lines,
-    # the segment in question is between the two lines at the closest points
-    # to the intersection point.
-    def intersect_between_two_lines(self, line0, vec1, pt1A, pt1B):
-        plane1 = [pt1A, (pt1B - pt1A).cross(vec1)]
-        pt = intersect_line_plane(line0, plane1)
-        if not pt:
-            return None
-        ptprojA = project_to_line(pt, [pt1A, vec1])
-        ptprojB = project_to_line(pt, [pt1B, vec1])
-        vA = ptprojA - pt
-        if vA.length < EPSILON:
-            return pt
-        vB = ptprojB - pt
-        if vB.length < EPSILON:
-            return pt
-        if vA.dot(vB) <= 0.0:
-            return pt
-        else:
-            return None
-
-    # Identify the loops in the holes
-    def sharp_find_loops(self, hsh_edplanes):
-        lplanes = hsh_edplanes.values()
-
-        # Loop on edges to det
-        hshed = {}
-        lst_loops = []
-        loop = []
-
-        while True:
-            # Resuming or continuing at current loop end, or initiating a new loop
-            if len(loop) > 0:
-                edp0 = loop[-1][1]
-                ptend = edp0[4] if edp0[5] == loop[-1][0] else edp0[5]
-            else:
-                edp0 = find(lplanes, lambda edp: edp[0] not in hshed)
-                if not edp0:
-                    break
-                ptend = edp0[5]
-                loop = [[edp0[4], edp0]]
-            hshed[edp0[0]] = 1
-
-            # Getting new segment
-            edp1 = find(lplanes, lambda edp: edp[0]!= edp0[0] and \
-                        (edp[0] not in hshed or hshed[edp[0]] != -1) and \
-                        (vec_approx_eq(edp[4], ptend) or vec_approx_eq(edp[5], ptend)))
-            if not edp1:
-                break
-
-            # Checking if segment was already set
-            for i, ll in enumerate(loop):
-                if ptend == ll[0]:
-                    newloop = [a[1] for a in loop[i:]]
-                    for edp in newloop:
-                        hshed[edp[0]] = -1
-                    lst_loops.append(newloop)
-                    loop[i:] = []
-                    edp1 = None
-
-            # New segment in loop
-            if edp1:
-                loop.append([ptend, edp1])
-
-        lst_loops.append([a[1] for a in loop if len(loop) > 0])
-        return lst_loops
-
-    # Determinethe intersection of planes for sharp corners.
-    # Progressive algorithm, based on heuristics
-    def sharp_intersect_planes(self, vd, lplanes):
-
-        # Sorting the planes by inclinations
-        # lplanes = self.sharp_sort_planes_by_inclination(vd, lplanes)
-
-        # Algorithm to explore intersections of planes by group of 3
-        n = len(lplanes)
-        for i0 in range(0, n):
-            lst_insert = []
-            lst_pt = []
-            for i in range(i0, n + i0):
-                icur = i0 % n
-                inext = (i + 1) % n
-                iprev = (i + 2) % n
-                lst_3planes = [lplanes[icur], lplanes[inext], lplanes[iprev]]
-                ptinter = self.sharp_compute_intersect_planes(vd, lplanes, lst_3planes)
-                if not ptinter:
-                    continue
-                lst_pt.append(ptinter)
-                for edp in lst_3planes:
-                    lst_insert.append([edp[1], edp[2], ptinter])
-                if len(lst_pt) == n - 2:
-                    for pt in lst_pt:
-                        self.lst_mark_points.append(pt)
-                    return lst_insert
-        return None
-
-    # Determine the intersection point between 3 planes, and check if valid
-    def sharp_compute_intersect_planes(self, vd, all_planes, lst_3planes):
-        # Computing the intersection of the 3 planes
-        planes = [edp[3] for edp in lst_3planes]
-        line = intersect_plane_plane(planes[0], planes[1])
-        if not line:
-            return None
-        ptinter = intersect_line_plane(line, planes[2])
-        if not ptinter:
-            return None
-        if len(all_planes) == 3:
-            return ptinter
-
-        # List of all other planes
-        otherplanes = [p for p in all_planes if p not in lst_3planes]
-
-        # Check if point is not 'above' otherplane
-        vpos = vd.vertex.co
-        for edp in otherplanes:
-            plane = edp[3]
-            if on_plane(ptinter, plane):
-                continue
-            vdproj = project_to_plane(vpos, plane)
-            ptproj = project_to_plane(ptinter, plane)
-            if (vdproj - vpos).dot(ptproj - ptinter) > 0:
-                # Above
-                return None
-        return ptinter
-
-    # Insert an intermediate point for the latte
-    def sharp_insert_in_section(self, vd, ed, j, ptinter):
-        icorner = 0 if ed.corners[0] == vd else 1
-        sharp_section = ed.sharp_sections[icorner][j]
-
-        # No point already in the intermediate section
-        if not (sharp_section and len(sharp_section) > 0):
-            ed.sharp_sections[icorner][j] = [ptinter]
-            return
-
-        # Inserting the point in the right place
-        ptmid = ed.cross_sections[icorner][j + 1]
-        vec0 = ed.cross_sections[icorner][j] - ptmid
-        angle0 = vec0.angle(ptinter - ptmid)
-        for i, pt in enumerate(sharp_section):
-            if pt == ptinter:
-                return
-            angle = vec0.angle(pt - ptmid)
-            if angle > angle0:
-                if i == 0:
-                    ed.sharp_sections[icorner][j] = [ptinter] + sharp_section
-                else:
-                    ed.sharp_sections[icorner][j] = sharp_section[0:i] + \
-                            [ptinter] + sharp_section[i:]
-                return
-        ed.sharp_section[icorner][j].append(ptinter)
-
-
-    # Compute the normal reference at a position of the edge or corner profile,
-    # This is done for the right orientation of faces created
-    def compute_normal_reference(self, ed, face, pt1, pt2):
-        iface = 0 if ed.lfaces[0] == face else 1
-        vy = ed.lvecins[iface] + face.normal
-        vec = pt2 - pt1
-        return vec.cross(vy)
-
-    def compute_face(self, fc):
-        f = fc.face
-        for i, bmv in enumerate(fc.bmverts):
-            if bmv.index in self.hsh_corners:
-                v = self.hsh_corners[bmv.index]
-                pr = self.pair_for_face(v.pairs, f)
-                if pr:
-                   fc.newpts[i] = [pr.ptcross]
-                else:
-                    # This is a face that is not adjacent to
-                    # a beveled edge, yet there is a beveled
-                    # edge going into this corner.
-                    # What to do depends on whether or
-                    # not this face is adjacent to a face
-                    # that is adjacent to a beveled edge.
-
-                    # One case is that this is a valence-three corner
-                    # with only one beveled edge,
-                    # and this is the third (unaffected) face.
-                    # We need to cut the corner off this face if
-                    # we are in the case where the beveled end
-                    # is in the plane of this face - we should have
-                    # a corner mesh, if so.
-                    # TODO: this corner cutting may happen even in
-                    # valence > 3 cases, but hard to do.
-                    if len(v.vertex.link_edges) == 3 and not v.vmesh:
-                       ed = v.leds[0]
-                       icorner = 0 if ed.corners[0] == v else 1
-                       section = ed.cross_sections[icorner]
-                       # Now need to find if we have to
-                       # reverse the section.
-                       # Find the pairs.
-                       e1 = f.loops[i].edge
-                       e2 = f.loops[i].link_loop_prev.edge
-                       for f1 in e1.link_faces:
-                           if f1 != f:
-                               pr1 = self.pair_for_face(v.pairs, f1)
-                               if pr1:
-                                   break
-                       for f2 in e2.link_faces:
-                           if f2 != f:
-                               pr2 = self.pair_for_face(v.pairs, f2)
-                               if pr2:
-                                   break
-                       if not pr1 or not pr2:
-                           print("whoops, couldn't find term face pairs")
-                           # just so we won't create a dup face:
-                           fc.newpts[i] = [v.vertex.co]
-                       else:
-                           if vec_approx_eq(pr2.ptcross, section[0]):
-                               fc.newpts[i] = section
-                           else:
-                               rsection = section[::]
-                               rsection.reverse()
-                               fc.newpts[i] = rsection
-                    elif len(v.vertex.link_edges) > 3:
-                        # Either or both of the edges into this vertex
-                        # may have been split because the adjacent face
-                        # was adjacent to a beveled edge.
-                        e1 = f.loops[i].edge
-                        f1 = find(e1.link_faces, lambda g: g != f)
-                        e2 = f.loops[i].link_loop_prev.edge
-                        f2 = find(e2.link_faces, lambda g: g != f)
-                        nco1 = None
-                        nco2 = None
-                        for ed in v.leds:
-                            if f in ed.lfaces:
-                                continue
-                            if f1 in ed.lfaces:
-                                pr1 = self.pair_for_face(v.pairs, f1)
-                                if pr1:
-                                    nco1 = pr1.ptcross
-                            if f2 in ed.lfaces:
-                                pr2 = self.pair_for_face(v.pairs, f2)
-                                if pr2:
-                                    nco2 = pr2.ptcross
-                        fc.newpts[i] = [v.vertex.co]
-                        if nco1:
-                            fc.newpts[i] = fc.newpts[i] + [nco1]
-                        if nco2:
-                            fc.newpts[i] = [nco2] + fc.newpts[i]
-
-    def pair_for_face(self, lpairs, f):
-        for pr in lpairs:
-            if pr.lfaces[0] == f:
-                return pr
-            if pr.lfaces[1] == f:
-                return pr
-        return None
-
-    # Catena calculations: chain of edges with related offsets
- 
-    # Compute the extension of a catena for an edge, and its face and corner
-    def catena_extend(self, catena, chain, ed, iface, icorner):
-        k = 2 * icorner + iface
-        if k >= len(ed.pairs):
-            return None  # shouldn't happen
-        pair = ed.pairs[k]
-        if not pair or pair.alone:
-            return None
-        # should only be two ed's in pair.leds,
-        # one is for ed, the other is ed2
-        ed2 = find(pair.leds, lambda edd: edd != ed)
-        n = 0
-        for i, pair2 in enumerate(ed2.pairs):
-            if pair2 == pair:
-                n = i
-                break
-        iface2 = n % 2
-        if ed2.catenas[iface2] == catena:
-            return None
-        icorner2 = (n - iface2) // 2
-        icorner2 = (icorner2 + 1) % 2
-        chain.append([ed2, iface2])
-        ed2.catenas[iface2] = catena
-        return [ed2, iface2, icorner2]
-
-    # Compute the half chain in a direction for an edge.
-    # This is the extension of the chain for (ed, iface) in the
-    # direction given by the end of the edge whose vertex
-    # has index icorner.
-    def catena_compute_half_by_face(self, catena, ed, iface, icorner):
-        chain = []
-        ll = [ed, iface, icorner]
-        while True:
-            ll = self.catena_extend(catena, chain, ll[0], ll[1], ll[2])
-            if not ll or ll[0] == ed:
-                break
-        return chain
-
-    # Compute the catena for an initial edge.
-    # The catena is for the edge ed as associated
-    # with the side of the edge indicated by index
-    # iface in its faces.
-    def catena_compute(self, ed, iface):
-        catena = BCatena()
-        self.lst_catenas.append(catena)
-        ed.catenas[iface] = catena
-        chain1 = self.catena_compute_half_by_face(catena, ed, iface, 0)
-        chain2 = []
-        if len(chain1) == 0 or chain1[-1] == None or chain1[-1][0] != ed:
-            chain2 = self.catena_compute_half_by_face(catena, ed, iface, 1)
-        chain2.reverse()
-        catena.chain = chain2 + [[ed, iface]] + chain1
-        return catena
-
-    # Compute all the catenas in the selection.
-    # There are two catenas for each BEdge: one for each incident face.
-    # The catena is a chain - list of [ed, face-index] pairs that
-    # traverse along matched-up pairs as computed at each vertex.
-    def catena_compute_all(self):
-        for ed in self.hsh_ed.values():
-            for iface in range(0, 2):
-                if ed.catenas[iface] is None:
-                    self.catena_compute(ed, iface)
-
-        # sorting the eds by angle
-        for i, catena in enumerate(self.lst_catenas):
-            catena.leds = [ll[0] for ll in catena.chain]
-            catena.leds.sort(key = functools.cmp_to_key(lambda ed1, ed2: cmp(ed1.cos, ed2.cos)))
-
-        # sorting the catenas
-        for i, catena in enumerate(self.lst_catenas):
-            self.catena_sort(catena)
-
-    def catena_offset_all(self):
-        for catena in self.lst_catenas:
-            icur = self.catena_begin_ed(catena)
-            while self.catena_propagate_offset_factors(catena, icur, 1):
-                icur += 1
-            while self.catena_propagate_offset_factors(catena, icur, -1):
-                icur -= 1
-
-    def catena_begin_ed(self, catena):
-        # Assigning 1 to the first edge in the sorted list
-        ed = catena.leds[0]
-        for icur, ll in enumerate(catena.chain):
-            if ll[0] == ed:
-                if self.strict_offset:
-                     ed.lfactors[ll[1]] = 1.0
-                return icur
- 
-    # Propagate the offset factors from an edge to the next one
-    def catena_propagate_offset_factors(self, catena, icur, incr):
-        chain = catena.chain
-
-        # Checking if end of chain
-        inext = icur + incr
-        if inext < 0 or inext >= len(catena.chain):
-            return False
-        llnext = catena.chain[inext]
- 
-        # Current edge
-        llcur = catena.chain[icur]
-        edcur = llcur[0]
-        ifacecur = llcur[1]
-        edgecur = edcur.edge
-        facecur = edcur.lfaces[ifacecur]
-        ptmidcur = edcur.ptmid
-        factorcur = edcur.lfactors[ifacecur]
-
-        # Next edge
-        ednext = llnext[0]
-        ifacenext = llnext[1]
-        edgenext = ednext.edge
-        facenext = ednext.lfaces[ifacenext]
-        ptmidnext = ednext.ptmid
-
-        # Computing the intersection of the two face planes
-        normalcur = facecur.normal
-        normalnext = facenext.normal
-        if parallel(normalcur, normalnext):
-            if self.strict_offset:
-                ednext.lfactors[ifacenext] = edcur.lfactors[ifacecur]
-            return True
-        lineinter = intersect_plane_plane([ptmidcur, normalcur], [ptmidnext, normalnext])
-
-        # Computing the intersection of the offset lines with the intersection of faces
-        ptcur = intersect_line_line(edcur.parallels[ifacecur], lineinter)
-        ptnext = intersect_line_line(ednext.parallels[ifacenext], lineinter)
-
-        # It is possible that the offset lines don't intersect the face intersection if
-        # either face is non-planar.
-        if not ptcur or not ptnext:
-            return False
-
-        # Common vertex
-        vertex = None
-        for v1 in edgecur.verts:
-            for v2 in edgenext.verts:
-                if v1 == v2:
-                    vertex = v1
-                    break
-        vpos = vertex.co
-
-        # Computing the factor for next edge
-        dcur = (ptcur - vpos).length
-        dnext = (ptnext - vpos).length
-        if self.strict_offset:
-            ednext.lfactors[ifacenext] = factorcur * dcur / dnext
-
-        return True
-
-    # ??? This is a complete no-op
-    def catena_sort(self, catena):
-        for ll in catena.chain:
-            ed = ll[0]
-            iface = ll[1]
-
-    # Create geometry for mesh borders
-    def create_geometry_vborders(self, vborders):
-        for vb in vborders:
-            lpt = vb[0]
-            style = vb[1]
-            # print("new edge:", V3(lpt[0]), V3(lpt[1]), "style:", style)
-            # style could be 'S' or 'P'
-            # 'S' means: apply prop_borders (?) to edges
-            # 'P' means: not soft or smooth
-
-    # Create geometry for mesh
-    def create_geometry_vmesh(self, vmesh):
-        for vm in vmesh:
-            faceref = vm[1]
-            normalref = vm[2]
-            # use faceref as example for material, etc.
-            allfaces = []
-            for lpt in vm[0]:
-                # print("new face:", LV3(lpt), "norm:", V3(normalref), "ref:", faceref)
-                bmverts = self.get_bmverts(lpt)
-                newf = self.bm.faces.new(bmverts)
-                allfaces.append(newf)
-            for lface in allfaces:
-                if normalref and allfaces[0] and allfaces[0].normal.dot(normalref) < 0:
-                    bmesh.utils.face_flip(lface)
-
-    def get_bmverts(self, ptlist):
-        return [ self.points.get_bmvert(p) for p in ptlist ]
-
-    # Signal errors in preparing the geometry
-    def signal_error_vd(self, vd):
-        if vd:
-            self.hsh_error_vertex[vd.vertex.index] = vd.vertex
-
-    # Profile methods
-
-    # Compute the transformed profile by indicating the start and end point,
-    # and the start vector and end face normal.
-    # The profile will go from pt2 to pt1, and the origin for the profile
-    # will be at the intersection of the line through pt1 in direction vec1
-    # and the plane containing pt2 with normal normal2.
-    def profile_compute_by_vectors(self, profile_type, pt1, vec1, pt2, normal2):
-        origin = intersect_line_plane([pt1, vec1], [pt2, normal2])
-        if not origin:
-            # Can happen if one of the faces is non-planar
-            # Just make an origin to avoid a crash
-            origin = pt1.lerp(pt2, 0.5) + (pt2 - pt1).length * Vector([0.1, 0.1, 0.2])
-        offset1 = (pt1 - origin).length
-        offset2 = (pt2 - origin).length
-        vec2 = pt2 - origin
-        return self.profile_compute_by_offset(profile_type, origin, vec1, offset1, vec2, offset2)
-
-    def profile_compute_by_vectors2(self, profile_type, pt1, vec1, pt2, vec2):
-        lpt = closest_points([pt1, vec1], [pt2, vec2])
-        origin = lpt[0].lerp(lpt[1], 0.5)
-        vec1 = pt1 - origin
-        vec2 = pt2 - origin
-        offset1 = vec1.length
-        offset2 = vec2.length
-        return self.profile_compute_by_offset(profile_type, origin, vec1, offset1, vec2, offset2)
-
-    # Compute the transformed profile by indicating the offsets and direction on faces.
-    # The origin is mapped to the 0,0 of the profile (e.g., the center of the circle
-    # for a quarter-circle profile).
-    # The start of the profile will be mapped to offset2 in the direction of vec2 from origin.
-    # The end of the profile will be mapped to offset1 in the direction of vec1 from the origin.
-    # (Think of vec1 -> the x-axis, vec2 -> y-axis, and profile goes from (0, 1) to (1, 0) in 2d).
-    def profile_compute_by_offset(self, profile_type, origin, vec1, offset1, vec2, offset2):
-        # Getting the nominal profile
-        pts = self.nominal_profile(profile_type)
-
-        # Transformation from golden normalized form:
-        # Takes nominal profile endpoints (0,1,0) and (1,0,0)
-        # to (0, offset1, 0) and (offset1, 0, 0) respectively
-        tsg = mathutils.Matrix([[0.0, -offset1, 0.0, offset1],
-                               [-offset1, 0.0, 0.0, offset1],
-                               [0.0, 0.0, 1.0, 0.0],
-                               [0.0, 0.0, 0.0, 1.0]])
-
-        # Scaling and shearing to adjust differences of offset and angle
-        angle = 0.5 * math.pi - vec1.angle(vec2, 0.0)
-        tgt = math.tan(angle)
-        fac = offset2 / offset1 * math.cos(angle)
-
-        # Stretch y by fac
-        ts = mathutils.Matrix([[1.0, 0.0, 0.0, 0.0],
-                               [0.0, fac, 0.0, 0.0],
-                               [0.0, 0.0, 1.0, 0.0],
-                               [0.0, 0.0, 1.0, 1.0]])
-
-        # Shear in x, by factor of tgt as move up in y
-        tsh = mathutils.Matrix([[1.0, tgt, 0.0, 0.0],
-                                [0.0, 1.0, 0.0, 0.0],
-                                [0.0, 0.0, 1.0, 0.0],
-                                [0.0, 0.0, 0.0, 1.0]])
-
-        # Transforming to match given coordinates at origin, vec1, vec2
-        normal = vec1.cross(vec2)
-        normal.normalize()
-        ux = vec1
-        ux.normalize()
-        uy = normal.cross(ux)
-        uz = normal
-        taxe = mathutils.Matrix()
-        taxe = mathutils.Matrix([[ux[0], uy[0], uz[0], origin[0]],
-                                 [ux[1], uy[1], uz[1], origin[1]],
-                                 [ux[2], uy[2], uz[2], origin[2]],
-                                 [0.0, 0.0, 0.0, 1.0]])
-        t = taxe * tsh * ts * tsg
-
-        # Performing the transformation
-        return [t * pt for pt in pts]
-
-    # Get the nominal profile and compute Nb of segment
-    def verify_profile(self, profile_type, numseg = None):
-        ty = profile_type
-        self.num_seg_lock = ty == 'P'
-        if numseg and not self.num_seg_lock:
-            self.profile_type[1] = numseg
-        pts = self.nominal_profile(self.profile_type)
-        self.num_seg = len(pts) - 1
-
-    # Get the nominal profile and compute Nb of segment
-    def nominal_profile(self, profile_type):
-        # Computing the normalized profile in X, Y
-        ty = profile_type[0]
-        param = profile_type[1]
-        key = ty + "-" + str(param)
-
-        # Standard profiles
-        if key in self.hsh_profile_pts:
-            pts = self.hsh_profile_pts[key]
-        else:
-            if ty == 'BZ':
-                pts = self.golden_bezier(param)
-            elif key == 'CR':
-                pts = self.golden_circular_reverse(param)
-            elif key == 'P':
-                pts = self.golden_perso(param)
-            else:
-                pts = self.golden_circular(param)
-            self.hsh_profile_pts[key] = pts
-        return pts
-
-    # Makes a quarter circle profile from
-    # (0, 1, 0) to (1, 0, 0) with nb_seg line segments
-    def golden_circular(self, nb_seg):
-        pts = []
-        anglesec = 0.5 * math.pi / nb_seg
-        for i in range(0, nb_seg + 1):
-            angle = anglesec * i
-            x = math.cos(angle)
-            y = math.sin(angle)
-            pts.append(Vector([x, y, 0.0]))
-        pts.reverse()
-        return pts
-
-    # Makes a a concave quarter circle profile from
-    # (0, 1, 0) to (1, 0, 0)
-    def golden_circular_reverse(self, nb_seg):
-        pts = []
-        anglesec = 0.5 * math.pi / nb_seg
-        for i in range(0, nb_seg + 1):
-            angle = anglesec * i
-            x = 1.0 - math.sin(angle)
-            y = 1.0 - math.cos(angle)
-            pts.append(Vector([x, y, 0.0]))
-        pts.reverse()
-        return pts
-
-    def golden_bezier(self, nb_seg):
-        pt1 = Vector([0.0, 1.0, 0.0])
-        pt2 = Vector([1.0, 1.0, 0.0])
-        pt3 = Vector([1.0, 0.0, 0.0])
-        ctrl_pts = [pt1, pt2, pt3]
-        # TODO: BezierCurve.compute(ctrl_pts, nb_seg)
-        return []
-
-    def golden_perso(self, fac):
-        pt1 = Vector([0.0, 1.0, 0.0])
-        pt2 = Vector([1.0, 1.0, 0.0])
-        pt3 = Vector([1.0, 0.0, 0.0])
-        pt4 = Vector([fac, fac, 0.0])
-        ctrl_pts = [pt1, pt2, pt3]
-        # TODO: BezierCurve.compute(ctrl_pts, 8)
-        ctrl_pts = [crv[3], pt4, crv[5]]
-        crv2 = BezierCurve.compute(ctrl_pts, 6)
-        crv = crv1[1:3] + crv2 + crv1[6:]
-        return crv
-
-    def print(self):  # XXX - better call something else
-        print("BevelRoundAlgo:")
-        print("offset", self.offset)
-        print("num_seg", self.num_seg)
-        print("hsh_ed:")
-        for i, ed in self.hsh_ed.items():
-            print("E%d ->" % i)
-            ed.print()
-        print("hsh_corners:")
-        for i, v in self.hsh_corners.items():
-            print("V%d ->"  % i)
-            v.print()
-        print("hsh_faces:")
-        for i, fc in self.hsh_faces.items():
-            print("F%d ->" % i)
-            fc.print()
-        print("lst_catenas", " ".join([str(cat) for cat in self.lst_catenas]))
-        print("lpt_borders:")
-        print("  ", " ".join([V3(p) for p in self.lpt_borders]))
-        print("hsh_profile_pts:")
-        for s, pts in self.hsh_profile_pts.items():
-            print(s, "->", LV3(pts))
-        print("lst_mark_points", self.lst_mark_points)
-        print("lst_triangulated", self.lst_triangulated)
-        print("hsh_error_vertex", self.hsh_error_vertex)
-        print("hash_edges", self.hash_edges)
-        print("hash_edges_extra", self.hash_edges_extra)
-        print("hsh_vertex_info", self.hsh_vertex_info)
-        print("profile_type", self.profile_type)
-        print("mode_profile", self.mode_profile)
-        print("mode_sharp", self.mode_sharp)
-        print("strict_offset", self.strict_offset)
-        print("mode_rounding", self.mode_rounding)
-
-
-# Wraps a bmesh edge involved in beveling
-class BEdge(object):
-    def __init__(self, edge):
-        self.edge = edge
-        self.index = edge.index
-        if len(edge.link_faces) != 2:
-            print("whoops, edge doesn't have exactly two faces")
-            return
-        face1 = edge.link_faces[0]
-        face2 = edge.link_faces[1]
-        self.lfaces = [face1, face2]
-        # lvecins are in face1, face2 planes, perp to edge, pointing in
-        self.lvecins = [normal_in_to_edge(edge, face1), normal_in_to_edge(edge, face2)]
-        # angle is deviation of two planes meeting angle from 90 degrees
-        # (positive angle: they meet at less than 90)
-        self.angle = 0.5 * math.pi - self.lvecins[0].angle(self.lvecins[1], 0.0)
-        self.cos = math.cos(self.angle)
-        # cosinv is the amount one should move along a face to have the
-        # same effect as moving 1.0 along the 90 degree-meeting face
-        self.cosinv = 1 / self.cos if abs(self.cos) >= 1e-2 else 100.0
-        self.lfactors = [self.cosinv, self.cosinv]
-        self.corners = []
-        # catenas is indexed by corner index (0 for first vert, 1 for second)
-        self.catenas = [None, None]
-        # pairs is indexed by 2 * (corner index) + face index
-        # each gives a pair matching the this to a corresponding
-        # (edge, corner index, face index) that this edge can continue to
-        self.pairs = [None, None, None, None]
-        self.cross_sections = [[], []]
-        self.sharp_sections = [[], []]
-        self.golden = 100
-        self.aligned = False
-        vxbeg = edge.verts[0]
-        vxend = edge.verts[1]
-        # vec is normalized edge direction and length is edge length
-        self.vec = vxend.co - vxbeg.co
-        self.length = self.vec.length
-        self.vec.normalize()
-        self.round_profile = False
-        # ptmid is the midpoint of the edge
-        self.ptmid = vxend.co.lerp(vxbeg.co, 0.5)
-        self.parallels = [[self.ptmid + vecin, self.vec] for vecin in self.lvecins]
-        self.loffset = [None, None]
-        self.profile = None
-        self.facemain = None
-        self.nsection = None
-        self.vmesh = None
-        self.vborders = None
-
-    def __str__(self):
-        return "ed%d" % self.index
-
-    def print(self):
-        print("BEdge", self.index)
-        print("  edge", V3(self.edge.verts[0].co), V3(self.edge.verts[1].co))
-        print("  lfaces", F(self.lfaces[0]), F(self.lfaces[1]))
-        print("  lvecins", V3(self.lvecins[0]), V3(self.lvecins[1]))
-        print("  angle %.3f" % self.angle)
-        print("  lfactors", ["%.3f" % fac for fac in self.lfactors])
-        print("  corners", [str(v) for v in self.corners])
-        print("  catenas", [str(cat) for cat in self.catenas])
-        print("  vec", V3(self.vec))
-        print("  ptmid", V3(self.ptmid))
-        print("  pairs: (icorner, iface) in (0,0), (0,1), (1,0), (1,1)")
-        for pair in self.pairs:
-            pair.print()
-        print("  parallels", [[V3(p), V3(n)] for (p,n) in self.parallels])
-        if self.cross_sections:
-            print("  cross_sections:")
-            for cs in self.cross_sections:
-                print("   ", LV3(cs))
-        if self.sharp_sections:
-            print("  sharp_sections:")
-            for cs in self.sharp_sections:
-                print("   ", cs)
-        print("  round_profile", self.round_profile)
-        print("  loffset", self.loffset)
-        print("  profile", self.profile)
-        print("  facemain", F(self.facemain))
-        print("  nsection", LV3(self.nsection))
-        if self.vmesh:
-            print("  vmesh:")
-            for vm in self.vmesh:
-                print("    face: faceref=%s, norm=%s" % (F(vm[1]), V3(vm[2])))
-                for lpt in vm[0]:
-                    print("     ", ",".join([V3(p) for p in lpt]))
-        if self.vborders:
-            print("  vborders:")
-            for vb in self.vborders:
-                if len(vb[0]) == 2:
-                    (p1, p2) = vb[0]
-                    print("    edge:", V3(p1), V3(p2), vb[1])
-
-
-# Wraps a bmesh vertex involved in beveling
-class BCorner(object):
-    def __init__(self, v, ed):
-        self.vertex = v
-        self.index = v.index
-        self.leds = [ed]
-        self.pairs = []
-        self.gold_ed = None
-        self.sharp_inter = []
-        self.round_pair = None
-        self.convex = None
-        self.vmesh = None
-
-    def __str__(self):
-        return "c%d" % self.index
-
-    def print(self):
-        print("BCorner", self.index)
-        print("  vertex", V3(self.vertex.co))
-        print("  leds", [str(ed) for ed in self.leds])
-        print("  pairs", [str(pair) for pair in self.pairs])
-        print("  gold_ed", self.gold_ed)
-        if self.sharp_inter:
-            print("  sharp_inter:")
-            for si in self.sharp_inter:
-                print(V3(si[0]), si[1], si[2], si[3], si[4])
-        print("  round_pair", self.round_pair)
-        print("  convex", self.convex)
-        if self.vmesh:
-            print("  vmesh:")
-            for vm in self.vmesh:
-                print("    face: faceref=%s, norm=%s" % (F(vm[1]), V3(vm[2])))
-                for lpt in vm[0]:
-                    print("     ", ",".join([V3(p) for p in lpt]))
-
-# Wraps a bmesh face involved in beveling
-class BFace(object):
-    def __init__(self, f):
-        self.face = f
-        self.index = f.index
-        self.bmverts = [lp.vert for lp in f.loops]
-        self.bmedges = [lp.edge for lp in f.loops]
-        self.edgereversed = [self.bmedges[i].verts[0] == self.bmverts[i] \
-            for i in range(0, len(self.bmverts))]
-        # for verts that change to one or more new points,
-        # self.newpts[i] is list of float triple for replacement
-        self.newpts = len(self.bmverts) * [None]
-
-    def anynew(self):
-        for p in self.newpts:
-            if p is not None:
-                return True
-        return False
-
-    # Probably should give access to C routine BM_face_point_inside_test
-    # but for now reimplement it here
-    def contains_point(self, v):
-        (ax, ay) = axis_dominant(self.face.normal)
-        co2 = Vector([v[ax], v[ay]])
-        cent = Vector([0.0, 0.0])
-        for l in self.face.loops:
-            v = l.vert.co
-            cent = cent + Vector([v[ax], v[ay]])
-        cent = cent / len(self.face.loops)
-        crosses = 0
-        onepluseps = 1.0 + EPSILON * 150.0
-        out = Vector([1e30, 1e30])
-        for l in self.face.loops:
-            vprev = l.link_loop_prev.vert.co
-            v = l.vert.co
-            v1 = (Vector([vprev[ax], vprev[ay]]) - cent) * onepluseps + cent
-            v2 = (Vector([v[ax], v[ay]]) - cent) * onepluseps + cent
-            if line_segments_cross(v1, v2, co2, out):
-                crosses += 1
-        return crosses % 2 != 0
-
-    def __str__(self):
-        return "f%d" % self.index
-
-    def print(self):
-        print("BFace", self.index)
-        print("  bmverts", [V(v) for v in self.bmverts])
-        print("  bmedges", [E(e) for e in self.bmedges])
-        print("  edgereversed", self.edgereversed)
-        print("  newpts", [LV3(pl) if pl else 'None' \
-            for pl in self.newpts])
-        
-
-# At vertices to be beveled, the incoming edges involved
-# in beveling are matched up in pairs (to be connected up).
-# There will be two pairs for such a matchup: one for each
-# face-side of the edge.
-# So (ed1, face1) is a BEdge and one of the bmesh faces
-# that is incident on it, and similarly for (ed2, face2).
-# Some edges won't get matched and are 'alone' pairs
-# with None for all of the second components.
-class BPair(object):
-    def __init__(self, vd, ed1, face1, ed2, face2):
-        edge1 = ed1.edge
-        edge2 = ed2.edge if ed2 else None
-        self.vd = vd
-        self.ledges = [edge1, edge2]
-        self.leds = [ed1, ed2]
-        self.lfaces = [face1, face2]
-        self.ptcross = None
-        self.edge_terms = []
-        self.monoface = True
-        self.convex = False
-        self.alone = not edge2
-        self.rounding = None
-        self.mode = None
-
-    def __str__(self):
-        if not self.alone:
-            return "pr2(%s,%s)(%s,%s)" % \
-                (self.leds[0], F(self.lfaces[0]), self.leds[1], F(self.lfaces[1]))
-        else:
-            return "pr1(%s,%s)" % (self.leds[0], F(self.lfaces[0]))
-
-    def print(self):
-        print("BPair", str(self))
-        print("  ptcross", V3(self.ptcross))
-        print("  edge_terms", [E(e) for e in self.edge_terms])
-        print("  monoface", self.monoface, "convex", self.convex,
-            "rounding", self.rounding, "mode", self.mode)
-
-# A catena is a chain - a list of [ed, face-index] pairs that
-# traverse along matched-up pairs as computed at each vertex.
-class BCatena(object):
-    def __init__(self):
-        self.chain = []
-        self.leds = []
-        self.nbsmall = 0
-
-    def __str__(self):
-        return "catena(" + \
-            " ".join(["(%s,%d)" % (p[0], p[1]) for p in self.chain]) + \
-            ", %d)" % self.nbsmall
-
-
-# distances less than about DISTTOL will be considered
-# essentially zero
-DISTTOL = 1e-4
-INVDISTTOL = 1e4
-
-class Points(object):
-    """Container of points without duplication, each mapped to a BMVert
-
-    Points are triples of floats.
-
-    Implementation:
-    In order to efficiently find duplicates, we quantize the points
-    to triples of ints and map from quantized triples to vertex
-    index.
-    """
-
-    def __init__(self, bm):
-        self.pos = []
-        self.bm = bm
-        self.invmap = dict()
-
-    def get_bmvert(self, p):
-        """Return the BMVert for the given point, making one if necessary.
-
-        Args:
-          p: 3-tuple of float - coordinates
-        Returns:
-          BMVert - the vertex of added (or existing) point
-        """
-
-        qp = tuple([int(round(v * INVDISTTOL)) for v in p])
-        if qp in self.invmap:
-            return self.invmap[qp]
-        else:
-            newv = self.bm.verts.new(p)
-            self.invmap[qp] = newv
-            self.pos.append(p)
-            return newv
-
-
-# Returns vector perpendicular to edge in face plane
-# pointing to the interior of the fac
-def normal_in_to_edge(edge, face):
-    pt1 = edge.verts[0].co
-    pt2 = edge.verts[1].co
-    vec = face.normal.cross(pt2 - pt1)
-    vec.normalize()
-    if edge_reversed_in_face(edge, face):
-        vec.negate()
-    return vec
-
-
-# Returns True if if two edges form a convex corner in face
-# at vertex
-def convex_at_vertex(vertex, face, edge1, edge2, face2=None):
-    vother1 = edge1.other_vert(vertex)
-    vec1 = vother1.co - vertex.co
-    vecin1 = normal_in_to_edge(edge1, face)
-    vecin2 = normal_in_to_edge(edge2, face2 if face2 else face)
-    # I don't understand this computation: seems to take dot
-    # product of two vectors that are the face normal (?)
-    return vec1.cross(vecin1).dot(vecin1.cross(vecin2)) >= 0
-
-
-# For the functions on 'planes' and 'lines':
-# A plane defined by [point-on-plane, plane-normal]
-# A line is defined by [point-on-line, line-direction-vector]
-
-
-# Return Vector that is point where line intersects plane,
-def intersect_line_plane(line, plane):
-    (lv, vec) = line
-    (pp, pnorm) = plane
-    return mathutils.geometry.intersect_line_plane(lv, lv + vec, pp, pnorm)
-
-
-# Return intersection point of the two lines, or None.
-def intersect_line_line(linea, lineb):
-    (av, avec) = linea
-    (bv, bvec) = lineb
-    (cv1, cv2) = mathutils.geometry.intersect_line_line(av, av + avec, bv, bv + bvec)
-    if vec_approx_eq(cv1, cv2):
-        return cv1
-    else:
-        return None
-
-
-# Return intersection line of two planes
-def intersect_plane_plane(plane1, plane2):
-    (pp1, pnorm1) = plane1
-    (pp2, pnorm2) = plane2
-    (a, b) = mathutils.geometry.intersect_plane_plane(pp1, pnorm1, pp2, pnorm2)
-    # seems like it returns (pt-on-line, line-dir)
-    return (a, b)
-
-# Return closes points of two lines as tuple of two.
-def closest_points(linea, lineb):
-    (av, avec) = linea
-    (bv, bvec) = lineb
-    return mathutils.geometry.intersect_line_line(av, av + avec, bv, bv + bvec)
-
-
-# Intersection where point must be between endpoints of edge
-def intersect_edge_line(edge, line):
-    pt = intersect_line_line([edge.verts[0].co, edge.verts[1].co - edge.verts[0].co], line)
-    if not pt:
-        return None
-    ptbeg = edge.verts[0].co
-    if vec_approx_eq(pt, ptbeg):
-        return pt
-    ptend = edge.verts[1].co
-    if vec_approx_eq(pt, ptend):
-        return pt
-    if (ptbeg-pt).dot(ptend-pt) < 0:
-        return pt
-    else:
-        return None
-
-
-# Project a point onto a plane
-def project_to_plane(point, plane):
-    (pco, pnorm) = plane
-    ptb = point + pnorm
-    return mathutils.geometry.intersect_line_plane(point, ptb, pco, pnorm)
-
-
-# Project a point onto a line
-def project_to_line(point, line):
-    (lv, lvec) = line
-    (ptproj, _) = mathutils.geometry.intersect_point_line(point, lv, lv + lvec)
-    return ptproj
-
-
-# Return the plane the best fits the points.
-# The right way to do this involves finding a singular value decomposition.
-# (search for "Orthogonal Distance Regression Planes").
-# For now, just use the centroid as point on the plane and
-# the average normal.
-def fit_plane_to_points(pts):
-    n = len(pts)
-    if n < 3:
-        return None
-    center = pts[0]
-    for i in range(1, n):
-        center = center + pts[i]
-    center = center / n
-    # Newell method for normal, pretending this is a polygon
-    sumx = 0.0
-    sumy = 0.0
-    sumz = 0.0
-    for i in range(0, n):
-        a = pts[i]
-        b = pts[(i + 1) % n]
-        sumx += (a[1] - b[1]) * (a[2] + b[2])
-        sumy += (a[2] - b[2]) * (a[0] + b[0])
-        sumz += (a[0] - b[0]) * (a[1] + b[1])
-    norm = mathutils.Vector([sumx, sumy, sumz])
-    norm.normalize()
-    return [center, norm]
-
-
-# Return True if point is on the plane
-def on_plane(point, plane):
-    (pp, pnorm) = plane
-    d = mathutils.geometry.distance_point_to_plane(point, pp, pnorm)
-    return abs(d) < EPSILON
-
-
-# Return True if point is on the line
-def on_line(point, line):
-    (lv, lvec) = line
-    (vint, _) = mathutils.geometry.intersect_point_line(point, lv, lv + lvec)
-    return (point-vint).length < EPSILON
-
-
-def parallel(v1, v2):
-    return abs(v1.cross(v2).length) < EPSILON
-
-
-# A plane is a [point-on-plane, normal-vec] tuple
-def face_plane(face):
-    return [face.verts[0].co, face.normal]
-
-
-# Return True if Vectors are approximately equal
-def vec_approx_eq(a, b):
-    return (a-b).length < EPSILON
-
-
-# Return True if edge points in CW direction around face
-# when viewed from the side the normal is pointing to
-def edge_reversed_in_face(edge, face):
-    for lp in face.loops:
-        if lp.edge == edge:
-            return lp.vert != edge.verts[0]
-    print("whoops, edge_reversed_in_face: edge not in face")
-    return False
-
-
-# Find the indices of axes which make for closest
-# alignment with vector axis, for a fast projection
-# of 3d -> 2d
-def axis_dominant(axis):
-    xn = abs(axis[0])
-    yn = abs(axis[1])
-    zn = abs(axis[2])
-    if zn >= xn and zn >= yn:
-        return (0, 1)
-    elif yn >= xn and yn >= zn:
-        return (0, 2)
-    else:
-        return (1, 2)
-
-
-# Return True if v3 is to the right of line v1v2
-# but False if v3 is the same as v1 or v2
-# (all points are 2d Vectors)
-def test_edge_side(v1, v2, v3):
-    inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0])
-    if inp < 0.0:
-        return False
-    elif inp < 0.0:
-        if v1 == v3 or v2 == v3:
-            return False
-    return True
-
-
-# Return True if two line segments cross each other
-# with careful attention to edge cases
-def line_segments_cross(v1, v2, v3, v4):
-    eps = EPSILON * 15
-    w1 = test_edge_side(v1, v3, v2)
-    w2 = test_edge_side(v2, v4, v1)
-    w3 = not test_edge_side(v1, v2, v3)
-    w4 = test_edge_side(v3, v2, v4)
-    w5 = not test_edge_side(v3, v1, v4)
-    if w1 == w2 == w3 == w4 == w5:
-        return True
-    mv1= (min(v1[0], v2[0]), min(v1[1], v2[1]))
-    mv2 = (max(v1[0], v2[0]), max(v1[1], v2[1]))
-    mv3= (min(v3[0], v4[0]), min(v3[1], v4[1]))
-    mv4 = (max(v3[0], v4[0]), max(v3[1], v4[1]))
-    if abs(v1[1] - v2[1]) < eps and abs(v3[1] - v4[1]) < eps and abs(v1[1] - v3[1]) < eps:
-        return (mv4[0] >= mv1[0] and mv3[0] <= mv2[0])
-    if abs(v1[0] - v2[0]) < eps and abs(v3[0] - v4[0]) < eps and abs(v1[0] - v3[0]) < eps:
-        return (mv4[1] >= mv1[1] and mv3[1] <= mv2[1])
-    return False
-
-
-# Three-way compare
-def cmp(a, b):
-    return (a > b) - (a < b)
-
-
-# A find-in-iterable function
-def find(iterable, func):
-    for x in iterable:
-        if func(x):
-            return x
-    return None
-
-# Grow a sequence, if necessary, with Nones, to make i a valid index
-def make_index_valid(s, i):
-    if i >= len(s):
-        s.extend((i - len(s) + 1) * [None])
-
-# for debug prints
-def V3(v):
-    return "None" if not v else "(%.2f,%.2f,%.2f)" % (v[0], v[1], v[2])
-
-def V2(v):
-    return "None" if not v else "(%.2f,%.2f)" % (v[0], v[1])
-
-def LV3(lv):
-    return "None" if not lv else ",".join([V3(v) for v in lv])
-
-def F(f):
-    return "None" if not f else "F%d" % f.index
-
-def E(e):
-    return "None" if not e else "E%d" % e.index
-
-def V(v):
-    return "None" if not v else "V%d" % v.index
-
-def printmat(mat, str):
-    print(str)
-    for i in range(0,4):
-        print("  |" + " ".join(["%5.2f" % mat[i][j] for j in range(0,4)]) + "|")
-
-
-def panel_func(self, context):
-    self.layout.label(text="Bevel Round:")
-    self.layout.operator("mesh.bevel_round", text="Bevel Round")
-
-
-def register():
-    bpy.utils.register_class(BevelRound)
-    bpy.types.VIEW3D_PT_tools_meshedit.append(panel_func)
-
-
-def unregister():
-    bpy.utils.unregister_class(BevelRound)
-    bpy.types.VIEW3D_PT_tools_meshedit.remove(panel_func)
-
-
-if __name__ == "__main__":
-    register()
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_witold.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_witold.py
index dccde77..30d8f17 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_witold.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_bevel_witold.py
@@ -89,19 +89,21 @@ class bevel_help(bpy.types.Operator):
 		layout = self.layout
 		layout.label('To use:')
 		layout.label('Select A edge or edges & bevel.')
-		layout.label('Simple Straight bevel')
 		layout.label('or Select 2 or more verices & bevel.')
+		layout.label('To Help:')
+		layout.label('best used on flat edges & simple edgeflow')
+		layout.label('may error if vert joins multiple edges/complex edge selection')
 	
 	def execute(self, context):
 		return {'FINISHED'}
 
 	def invoke(self, context, event):
-		return context.window_manager.invoke_popup(self, width = 300)
+		return context.window_manager.invoke_popup(self, width = 350)
 #--- ### Operator
 class Bevel(bpy.types.Operator):
     ''' Bevels selected edges of the mesh'''
     bl_idname = "mesh.mbevel" #it is not named mesh.bevel, to not confuse with the standard bevel in the future...
-    bl_label = "Edge Bevel"
+    bl_label = "Bevel Selected"
     bl_description = "Bevels selected edges"
     bl_options = {'REGISTER', 'UNDO'} #Set this options, if you want to update  
     #                                  parameters of this operator interactively 
@@ -112,7 +114,7 @@ class Bevel(bpy.types.Operator):
     width = FloatProperty(name="Width", description="Bevel width value (it is multiplied by 10^Exponent)", 
                           subtype = 'DISTANCE', default = 0.1, min = 0.0, 
                                                     step = 1, precision = 2)
-    exponent = IntProperty(name="Exponent", description="Order of magnitude of the bevel width (the power of 10)", default = 0)
+#    exponent = IntProperty(name="Exponent", description="Order of magnitude of the bevel width (the power of 10)", default = 0)
     
     use_scale = BoolProperty(name="Use object scale", description="Multiply bevel width by the scale of this object", default = False)
 
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bump.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_bump.py
index 9b11bb5..05402ec 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_bump.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_bump.py
@@ -186,14 +186,17 @@ class bump_help(bpy.types.Operator):
 		layout = self.layout
 		layout.label('To use:')
 		layout.label('Make a selection or selection of Faces ')
-		layout.label('Choose from the bump types in the menu.')
-		layout.label('Keep extrusions small to prevent overlapping.')
+		layout.label('Choose from the bump types in the menu')
+		layout.label('To Help:')
+		layout.label('Keep extrusions small to prevent overlapping')
+		layout.label('Do not select all faces')
+		layout.label('if using with create armature, enter object mode first')
 	
 	def execute(self, context):
 		return {'FINISHED'}
 
 	def invoke(self, context, event):
-		return context.window_manager.invoke_popup(self, width = 300)		
+		return context.window_manager.invoke_popup(self, width = 350)		
 '''
 def menu_func(self, context):
 	self.layout.operator(Bump_init.bl_idname, text="Bump")
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_filletplus.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_filletplus.py
index ad106f0..b277471 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_filletplus.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_filletplus.py
@@ -42,7 +42,7 @@ from math import cos, pi, degrees, sin, tan
 
 
 def list_clear_(l):
-	l[:] = []
+	del l[:]
 	return l
 
 def get_adj_v_(list_):
@@ -245,8 +245,8 @@ class f_p0(bpy.types.Panel):
 		row.operator('f.op1_id', text = '?')
 '''
 # ------ operator 0 ------
-class f_op0(bpy.types.Operator):
-	bl_idname = 'f.op0_id'
+class fillet_op0(bpy.types.Operator):
+	bl_idname = 'fillet.op0_id'
 	bl_label = 'Fillet'
 	bl_description = 'Fillet ajoining edges'
 	bl_options = {'REGISTER', 'UNDO'}
@@ -337,24 +337,26 @@ class f_op0(bpy.types.Operator):
 			return {'CANCELLED'}
 
 # ------ operator 1 ------
-class f_op1(bpy.types.Operator):
-	bl_idname = 'f.op1_id'
+class filletedgehelp(bpy.types.Operator):
+	bl_idname = 'help.edge_fillet'
 	bl_label = ''
 
 	def draw(self, context):
 		layout = self.layout
 		layout.label('To use:')
 		layout.label('Select two adjacent edges and press Fillet button.')
+		layout.label('To Help:')
+		layout.label('best used on flat plane.')
 	
 	def execute(self, context):
 		return {'FINISHED'}
 
 	def invoke(self, context, event):
-		return context.window_manager.invoke_popup(self, width = 400)
+		return context.window_manager.invoke_popup(self, width = 350)
 
 # ------ operator 2 ------
-class f_op2(bpy.types.Operator):
-	bl_idname = 'f.op2_id'
+class fillet_op2(bpy.types.Operator):
+	bl_idname = 'fillet.op2_id'
 	bl_label = ''
 
 	def execute(self, context):
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_mextrude_plus.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_mextrude_plus.py
index 706aebd..277b612 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_mextrude_plus.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_mextrude_plus.py
@@ -45,14 +45,15 @@ def vloc(self, r):
     return self.off * (1 + random.gauss(0, self.var1 / 3))
 
 def vrot(self,r):
-    random.seed(self.ran+r)
+    random.seed(self.ran + r)
     return Euler((radians(self.rotx) + random.gauss(0, self.var2 / 3), \
         radians(self.roty) + random.gauss(0, self.var2 / 3), \
         radians(self.rotz) + random.gauss(0,self.var2 / 3)), 'XYZ')
 
 def vsca(self, r):
     random.seed(self.ran + r)
-    return [self.sca * (1 + random.gauss(0, self.var3 / 3))] * 3
+    return self.sca * (1 + random.gauss(0, self.var3 / 3))
+
 # centroide de una seleccion de vertices
 def centro(ver):
     vvv = [v for v in ver if v.select]
@@ -84,7 +85,7 @@ class MExtrude(bpy.types.Operator):
     rotz = FloatProperty(name='Rot Z', min=-85, soft_min=-30, \
         soft_max=30, max=85, default=-0, description='Z rotation')
     sca = FloatProperty(name='Scale', min=0.1, soft_min=0.5, \
-        soft_max=1.2, max =2, default=.9, description='Scaling')
+        soft_max=1.2, max =2, default=1.0, description='Scaling')
     var1 = FloatProperty(name='Offset Var', min=-5, soft_min=-1, \
         soft_max=1, max=5, default=0, description='Offset variation')
     var2 = FloatProperty(name='Rotation Var', min=-5, soft_min=-1, \
@@ -98,7 +99,8 @@ class MExtrude(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        return (context.object and context.object.type == 'MESH')
+        obj = context.object
+        return (obj and obj.type == 'MESH')
 
     def draw(self, context):
         layout = self.layout
@@ -120,65 +122,53 @@ class MExtrude(bpy.types.Operator):
 
     def execute(self, context):
         obj = bpy.context.object
-        data, om, msv =  obj.data, obj.mode, []
-        msm = bpy.context.tool_settings.mesh_select_mode
+        data, om =  obj.data, obj.mode
         bpy.context.tool_settings.mesh_select_mode = [False, False, True]
 
-        # disable modifiers
-        for i in range(len(obj.modifiers)):
-            msv.append(obj.modifiers[i].show_viewport)
-            obj.modifiers[i].show_viewport = False
-
-        # isolate selection
+        # bmesh operations
         bpy.ops.object.mode_set()
-        bpy.ops.object.mode_set(mode='EDIT')
-        total = data.total_face_sel
-        try: bpy.ops.mesh.select_inverse()
-        except: bpy.ops.mesh.select_all(action='INVERT')
-        bpy.ops.object.vertex_group_assign(new=True)
-        bpy.ops.mesh.hide()
+        bm = bmesh.new()
+        bm.from_mesh(obj.data)
+        sel = [f for f in bm.faces if f.select]
 
         # faces loop
-        for i in range(total):
-            bpy.ops.object.editmode_toggle()
-            # is bmesh..?
-            try:
-                faces = data.polygons
-            except:
-                faces = data.faces
-            for f in faces:
-                if not f.hide:
-                    f.select = True
-                    break
-            norm = f.normal.copy()
-            rot, loc = vrot(self, i), vloc(self, i)
-            norm.rotate(obj.matrix_world.to_quaternion())
-            bpy.ops.object.editmode_toggle()
-
-            # extrude loop
-            for a in range(self.num):
-                norm.rotate(rot)
-                r2q = rot.to_quaternion()
-                bpy.ops.mesh.extrude_faces_move()
-                bpy.ops.transform.translate(value = norm * loc)
-                bpy.ops.transform.rotate(value = r2q.angle, axis = r2q.axis)
-                bpy.ops.transform.resize(value = vsca(self, i + a))
-            bpy.ops.object.vertex_group_remove_from()
-            bpy.ops.mesh.hide()
-
-        # keep just last faces selected
-        bpy.ops.mesh.reveal()
-        bpy.ops.object.vertex_group_deselect()
-        bpy.ops.object.vertex_group_remove()
-        bpy.ops.object.mode_set()
-
+        for i, of in enumerate(sel):
+            rot = vrot(self, i)
+            off = vloc(self, i)
+            of.normal_update()
+
+            # extrusion loop
+            for r in range(self.num):
+                nf = of.copy()
+                nf.normal_update()
+                no = nf.normal.copy()
+                ce = nf.calc_center_bounds()
+                s = vsca(self, i + r)
+
+                for v in nf.verts:
+                    v.co -= ce
+                    v.co.rotate(rot)
+                    v.co += ce + no * off
+                    v.co = v.co.lerp(ce, 1 - s)
+
+                # extrude code from TrumanBlending
+                for a, b in zip(of.loops, nf.loops):
+                    sf = bm.faces.new((a.vert, a.link_loop_next.vert, \
+                        b.link_loop_next.vert, b.vert))
+                    sf.normal_update()
+
+                bm.faces.remove(of)
+                of = nf
+
+        for v in bm.verts: v.select = False
+        for e in bm.edges: e.select = False
+        bm.to_mesh(obj.data)
+        obj.data.update()
 
         # restore user settings
-        for i in range(len(obj.modifiers)): 
-            obj.modifiers[i].show_viewport = msv[i]
-        bpy.context.tool_settings.mesh_select_mode = msm
         bpy.ops.object.mode_set(mode=om)
-        if not total:
+
+        if not len(sel):
             self.report({'INFO'}, 'Select one or more faces...')
         return{'FINISHED'}
 
@@ -191,14 +181,27 @@ class mextrude_help(bpy.types.Operator):
 		layout.label('To use:')
 		layout.label('Make a selection or selection of Faces.')
 		layout.label('Extrude, rotate extrusions & more.')
-		layout.label('For rigging capabilities, see Multi Extrude panel.')
-	
+		layout.label('For rigging capabilities, see Multi Extrude Plus panel.')
+	def invoke(self, context, event):
+		return context.window_manager.invoke_popup(self, width = 300)
+
+class addarm_help(bpy.types.Operator):
+	bl_idname = 'help.addarm'
+	bl_label = ''
+
+	def draw(self, context):
+		layout = self.layout
+		layout.label('To use:')
+		layout.label('With Multi extrude to rig extrusions.')
+		layout.label('Adds Empty to control rig.')
+		layout.label('Based on selected face/s & object center.')
+
 	def execute(self, context):
 		return {'FINISHED'}
 
 	def invoke(self, context, event):
 		return context.window_manager.invoke_popup(self, width = 300)
-		
+
 class BB(bpy.types.Operator):
     bl_idname = 'object.mesh2bones'
     bl_label = 'Create Armature'
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_polyredux.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_polyredux.py
index 96b9bba..c0d2cf8 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_polyredux.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_polyredux.py
@@ -70,7 +70,8 @@ class redux_help(bpy.types.Operator):
 		layout = self.layout
 		layout.label('To use:')
 		layout.label('Make a selection of verts or polygons to reduce.')
-		layout.label('works on whole mesh')
+		layout.label('works on whole mesh or selected')
+		layout.label('To Help:')
 		layout.label('Single operation, no parameters.')
 	
 	def execute(self, context):
diff --git a/release/scripts/addons_contrib/mesh_extra_tools/mesh_vertex_chamfer.py b/release/scripts/addons_contrib/mesh_extra_tools/mesh_vertex_chamfer.py
index 1cc3c7d..ac853d4 100644
--- a/release/scripts/addons_contrib/mesh_extra_tools/mesh_vertex_chamfer.py
+++ b/release/scripts/addons_contrib/mesh_extra_tools/mesh_vertex_chamfer.py
@@ -133,6 +133,7 @@ class chamfer_help(bpy.types.Operator):
 		layout.label('To use:')
 		layout.label('Make a selection or selection of verts ')
 		layout.label('Result is triangle chamfer, works on single vert.')
+		layout.label('To Help:')
 		layout.label('In some cases may need to press F to fill result.')
 	
 	def execute(self, context):
diff --git a/release/scripts/addons_contrib/mesh_face_info_select.py b/release/scripts/addons_contrib/mesh_face_info_select.py
index ceafb21..eb85b0d 100644
--- a/release/scripts/addons_contrib/mesh_face_info_select.py
+++ b/release/scripts/addons_contrib/mesh_face_info_select.py
@@ -60,11 +60,11 @@ class DATA_OP_facetype_select(bpy.types.Operator):
         context.tool_settings.mesh_select_mode=(False, False, True)
 
         if self.face_type == "3":
-            bpy.ops.mesh.select_by_number_vertices(number=3, type='EQUAL')
+            bpy.ops.mesh.select_face_by_sides(number=3, type='EQUAL')
         elif self.face_type == "4":
-            bpy.ops.mesh.select_by_number_vertices(number=4, type='EQUAL')
+            bpy.ops.mesh.select_face_by_sides(number=4, type='EQUAL')
         else:
-            bpy.ops.mesh.select_by_number_vertices(number=4, type='GREATER')
+            bpy.ops.mesh.select_face_by_sides(number=4, type='GREATER')
 
         return {'FINISHED'}
         
diff --git a/release/scripts/addons_contrib/mesh_fiber.py b/release/scripts/addons_contrib/mesh_fiber.py
index 4822b9e..51c0f7e 100644
--- a/release/scripts/addons_contrib/mesh_fiber.py
+++ b/release/scripts/addons_contrib/mesh_fiber.py
@@ -198,13 +198,14 @@ class FiberPanel(bpy.types.Panel):
 	bl_label = "Fiber"
 	bl_space_type = "VIEW_3D"
 	bl_region_type = "TOOLS"
-	
+	bl_options = {'DEFAULT_CLOSED'}
+
 	def draw(self, context):
 
 		scn = bpy.context.scene
 		layout = self.layout
 		
-		layout.label("Fiber Generator-	Version " + str(CurVersion))
+		layout.label("Fiber Generator-	Version " + str(CurVersion), icon = 'PLUGIN')
 	
 		row = layout.row()
 		row.operator("fiber.savepreset", text="Save Preset")
diff --git a/release/scripts/addons_contrib/mesh_select_tools/__init__.py b/release/scripts/addons_contrib/mesh_select_tools/__init__.py
new file mode 100644
index 0000000..48de4a5
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/__init__.py
@@ -0,0 +1,173 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# ##### END GPL LICENSE BLOCK #####
+# menu & updates by meta-androcto #
+# contributed to by Macouno, dustractor, liero, CoDEmanX, meta-androcto #
+
+bl_info = {
+    "name": "Select Tools",
+    "author": "Multiple Authors",
+    "version": (0, 3),
+    "blender": (2, 6, 4),
+    "location": "Editmode select menu",
+    "description": "Adds More vert/face/edge select modes.",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
+        "Scripts/",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=32877",
+    "category": "Mesh"}
+
+
+if "bpy" in locals():
+    import imp
+    imp.reload(mesh_select_by_direction)
+    imp.reload(mesh_select_by_edge_length)
+    imp.reload(mesh_select_by_pi)
+    imp.reload(mesh_select_by_type)
+    imp.reload(mesh_select_connected_faces)
+    imp.reload(mesh_select_innermost)
+    imp.reload(mesh_index_select)
+    imp.reload(mesh_selection_topokit)
+    imp.reload(mesh_info_select)
+else:
+    from . import mesh_select_by_direction
+    from . import mesh_select_by_edge_length
+    from . import mesh_select_by_pi
+    from . import mesh_select_by_type
+    from . import mesh_select_connected_faces
+    from . import mesh_select_innermost
+    from . import mesh_index_select
+    from . import mesh_selection_topokit
+    from . import mesh_info_select
+
+import bpy, bmesh
+
+class VIEW3D_MT_selectface_edit_mesh_add(bpy.types.Menu):
+    # Define the "Mesh_Select_Tools" menu
+    bl_idname = "mesh.face_select_tools"
+    bl_label = "Select by Face"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.label(text = 'Face Select')
+        layout.separator()
+        layout.operator("data.facetype_select", 
+            text="Triangles").face_type = "3"
+        layout.operator("data.facetype_select", 
+            text="Quads").face_type = "4"
+        layout.operator("data.facetype_select", 
+            text="Ngons").face_type = "5"
+        layout.separator()
+        layout.operator("mesh.select_vert_index",
+            text="By Face Index")
+        layout.operator("mesh.select_by_direction",
+            text="By Direction")
+        layout.operator("mesh.select_by_pi",
+            text="By Pi")
+        layout.operator("mesh.select_connected_faces",
+            text="By Connected Faces")
+        layout.operator("mesh.e2e_efe",
+            text="Neighbors by Face")
+        layout.operator("mesh.f2f_fvnef",
+            text="Neighbors by Vert not Edge")
+        layout.operator("mesh.conway",
+            text="Conway")
+
+class VIEW3D_MT_selectedge_edit_mesh_add(bpy.types.Menu):
+    # Define the "Mesh_Select_Tools" menu
+    bl_idname = "mesh.edge_select_tools"
+    bl_label = "Select by Edge"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.label(text = 'Edge Select')
+        layout.separator()
+        layout.operator("mesh.select_vert_index",
+            text="By Edge Index")
+        layout.operator("mesh.select_by_direction",
+            text="By Direction")
+        layout.operator("mesh.select_by_pi",
+            text="By Pi")
+        layout.operator("mesh.select_by_edge_length",
+            text="By Edge Length")
+        layout.separator()
+        layout.operator("mesh.e2e_eve",
+            text="Neighbors by Vert")
+        layout.operator("mesh.e2e_evfe",
+            text="Neighbors by Vert + Face")
+        layout.operator("mesh.e2e_efnve",
+            text="Lateral Neighbors")
+        layout.operator("mesh.e2e_evnfe",
+            text="Longitudinal Edges")
+#        layout.operator("mesh.je",
+#            text="only_edge_selection")
+			
+class VIEW3D_MT_selectvert_edit_mesh_add(bpy.types.Menu):
+    # Define the "Mesh_Select_Tools" menu
+    bl_idname = "mesh.vert_select_tools"
+    bl_label = "Select by Vert"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.label(text = 'Vert Select')
+        layout.separator()
+        layout.operator("mesh.select_vert_index",
+            text="By Vert Index")
+        layout.operator("mesh.select_by_direction",
+            text="By Direction")
+        layout.operator("mesh.select_by_pi",
+            text="By Pi")
+#        layout.operator("mesh.select_innermost",
+#            text="innermost")
+        layout.separator()
+        layout.operator("mesh.v2v_by_edge",
+            text="Neighbors by Edge")
+        layout.operator("mesh.e2e_eve",
+            text="Neighbors by Vert")
+        layout.operator("mesh.e2e_efe",
+            text="Neighbors by Face")
+        layout.operator("mesh.v2v_facewise",
+            text="Neighbors by Face - Edge")
+#        layout.operator("mesh.ie",
+#            text="inner_edge_selection")
+
+# Register all operators and panels
+
+# Define "Extras" menu
+def menu_func(self, context):
+    if context.tool_settings.mesh_select_mode[2]:
+        self.layout.menu("mesh.face_select_tools", icon="PLUGIN")
+    if context.tool_settings.mesh_select_mode[1]:
+        self.layout.menu("mesh.edge_select_tools", icon="PLUGIN")
+    if context.tool_settings.mesh_select_mode[0]:
+        self.layout.menu("mesh.vert_select_tools", icon="PLUGIN")
+
+
+def register():
+	bpy.utils.register_module(__name__)
+	bpy.types.VIEW3D_MT_select_edit_mesh.append(menu_func)
+
+def unregister():
+	bpy.utils.unregister_module(__name__)
+	bpy.types.VIEW3D_MT_select_edit_mesh.remove(menu_func)
+
+if __name__ == "__main__":
+	register()
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_extras.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_extras.py
new file mode 100644
index 0000000..9b317b8
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_extras.py
@@ -0,0 +1,274 @@
+import bpy, mathutils, math
+from mathutils import geometry
+
+# Get a matrix for the selected faces that you can use to do local transforms
+def get_selection_matrix(faces=False):
+	
+	me = bpy.context.active_object.data
+	
+	if not faces:
+		faces = get_selected_faces()
+	
+	yVec = mathutils.Vector()
+	zVec = mathutils.Vector()
+	
+	# Ok so we have a basic matrix, but lets base it more on the mesh!
+	for f in faces:
+			
+		v1 = me.vertices[f.vertices[0]].co
+		v2 = me.vertices[f.vertices[1]].co
+		edge = v2-v1
+		
+		yVec += edge
+		
+		if len(f.vertices) == 4:
+			v1 = me.vertices[f.vertices[2]].co
+			v2 = me.vertices[f.vertices[3]].co
+			edge = v1-v2
+			
+			yVec += edge
+		
+		zVec += mathutils.Vector(f.normal)
+					
+	if not yVec.length:
+		quat = zVec.to_track_quat('-Z', 'Y')
+		tMat = quat.to_matrix()
+		yVec = tMat[1]
+		yVec = yVec.normalized()
+	else:
+		yVec = yVec.normalized()
+	zVec = zVec.normalized()
+	
+	# Rotate yVec so it's 90 degrees to zVec
+	cross =yVec.cross(zVec)
+	vec = float(yVec.angle(zVec) - math.radians(90))
+	mat = mathutils.Matrix.Rotation(vec, 3, cross)
+	yVec =  (mat * yVec)
+	
+	xVec = yVec.cross(zVec)
+	
+	xVec = xVec.normalized()
+	
+	nMat = mathutils.Matrix((xVec, yVec, zVec))
+	
+	return nMat
+
+
+
+# Get the selection radius (minimum distance of an outer edge to the centre)
+def get_selection_radius():
+
+	ob = bpy.context.active_object
+
+	radius = 0.0
+	
+	# no use continueing if nothing is selected
+	if contains_selected_item(ob.data.polygons):
+	
+		# Find the center of the selection
+		cent = mathutils.Vector()
+		nr = 0
+		nonVerts = []
+		selVerts = []
+		for f in ob.data.polygons:
+			if f.select:
+				nr += 1
+				cent += f.center
+			else:
+				nonVerts.extend(f.vertices)
+				
+		cent /= nr
+		
+		chk = 0
+		
+		# Now that we know the center.. we can figure out how close the nearest point on an outer edge is
+		for e in get_selected_edges():
+		
+			nonSection = [v for v in e.vertices if v in nonVerts]
+			if len(nonSection):
+			
+				v0 = ob.data.vertices[e.vertices[0]].co
+				v1 = ob.data.vertices[e.vertices[1]].co
+				
+				# If there's more than 1 vert of this edge on the outside... we need the edge length to be long enough too!
+				if len(nonSection) > 1:
+					edge = v0 - v1
+					edgeRad = edge.length * 0.5
+					
+					if edgeRad < radius or not chk:
+						radius = edgeRad
+						chk += 1
+				
+				int = geometry.intersect_point_line(cent, v0, v1)
+				
+				rad = cent - int[0]
+				l = rad.length
+				
+				if l < radius or not chk:
+					radius = l
+					chk += 1
+					
+	return radius
+	
+	
+	
+# Get the average length of the outer edges of the current selection
+def get_shortest_outer_edge_length():
+
+	ob = bpy.context.active_object
+
+	min = False
+	me = ob.data
+	
+	delVerts = []
+	for f in me.faces:
+		if not f.select:
+			delVerts.extend(f.vertices)
+	selEdges = [e.vertices for e in me.edges if e.select]
+
+	if len(selEdges) and len(delVerts):
+		
+		for eVerts in selEdges:
+			
+			v0 = eVerts[0]
+			v1 = eVerts[1]
+			
+			if v0 in delVerts and v1 in delVerts:
+				ln = (me.vertices[v0].co - me.vertices[v1].co).length
+				if min is False or (ln > 0.0 and ln < min):
+					min = ln
+						
+	return min
+
+
+# Get the average length of the outer edges of the current selection
+def get_average_outer_edge_length():
+
+	ob = bpy.context.active_object
+
+	ave = 0.0
+	me = ob.data
+	
+	delFaces = [f.vertices for f  in me.faces if not f.select]
+	selEdges = [e.vertices for e in me.edges if e.select]
+
+	if len(selEdges) and len(delFaces):
+	
+		number = 0
+		
+		for eVerts in selEdges:
+			
+			v0 = eVerts[0]
+			v1 = eVerts[1]
+			
+			for fVerts in delFaces:
+				if v0 in fVerts and v1 in fVerts:
+					number += 1
+					ave += (me.vertices[v0].co - me.vertices[v1].co).length
+					break
+						
+		if number:
+			ave /= number
+			
+	return ave
+
+
+	
+# Get the selected (or deselected items)
+def get_selected(type='vertices',invert=False):
+	
+	mesh = bpy.context.active_object.data
+	
+	if type == 'vertices':
+		items = mesh.vertices
+	elif type == 'edges':
+		items = mesh.edges
+	else:
+		items = mesh.polygons
+		
+	if invert:
+		L = [i for i in items if not i.select]
+	else:
+		L = [i for i in items if i.select]
+	return L
+	
+	
+	
+# See if the mesh has something selected
+def has_selected(type='vertices',invert=False):
+	
+	mesh = bpy.context.active_object.data
+	
+	if type == 'vertices':
+		items = mesh.vertices
+	elif type == 'edges':
+		items = mesh.edges
+	else:
+		items = mesh.polygons
+		
+	for i in items:
+		if not invert and i.select:
+			return True
+		elif invert and not i.select:
+			return True
+			
+	return False
+		
+		
+
+# Get all the selected vertices (mode is selected or deselected)
+def get_selected_vertices(mode='selected'):
+
+	vertices = bpy.context.active_object.data.vertices
+
+	if mode == 'deselected':
+		L = [v for v in vertices if not v.select]
+	else:
+		L = [v for v in vertices if v.select]
+	return L
+	
+	
+	
+# Get all the selected edges (mode is selected or deselected)
+def get_selected_edges(mode='selected'):
+
+	edges = bpy.context.active_object.data.edges
+
+	if mode == 'deselected':
+		L = [e for e in edges if not e.select]
+	else:
+		L = [e for e in edges if e.select]
+	return L
+
+
+	
+# Get all the selected faces (mode is selected or deselected)
+def get_selected_faces(mode='selected'):
+	
+	polygons = bpy.context.active_object.data.polygons
+	
+	if mode == 'deselected':
+		L = [f for f in polygons if not f.select]
+	else:
+		L = [f for f in polygons if f.select]
+	return L
+	
+	
+	
+# See if there is at least one selected item in 'items'
+def contains_selected_item(items):
+
+	for item in items:
+		if item.select:
+			return True
+				
+	return False
+	
+
+
+
+
+
+	
+	
+		
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_index_select.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_index_select.py
new file mode 100644
index 0000000..9bc90d1
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_index_select.py
@@ -0,0 +1,182 @@
+bl_info = {
+    "name": "Select by index",
+    "author": "liero",
+    "version": (0, 2),
+    "blender": (2, 5, 5),
+    "api": 33333,
+    "location": "View3D > Tool Shelf",
+    "description": "Select mesh data by index / area / length / cursor",
+    "category": "Mesh"}
+
+import bpy, mathutils
+from mathutils import Vector
+
+class SelVert(bpy.types.Operator):
+    bl_idname = 'mesh.select_vert_index'
+    bl_label = 'Verts'
+    bl_description = 'Select vertices by index'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    indice = bpy.props.FloatProperty(name='Selected', default=0, min=0, max=100, description='Percentage of selected edges', precision = 2, subtype = 'PERCENTAGE')
+    delta = bpy.props.BoolProperty(name='Use Cursor', default=False, description='Select by Index / Distance to Cursor')
+    flip = bpy.props.BoolProperty(name='Reverse Order', default=False, description='Reverse selecting order')
+
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.type == 'MESH')
+
+    def draw(self, context):
+        layout = self.layout
+        layout.prop(self,'indice', slider=True)
+        layout.prop(self,'delta')
+        layout.prop(self,'flip')
+
+    def execute(self, context):
+        obj = bpy.context.object
+        mode = [a for a in bpy.context.tool_settings.mesh_select_mode]
+        if mode != [True, False, False]:
+            bpy.context.tool_settings.mesh_select_mode = [True, False, False]
+        ver = obj.data.vertices
+        loc = context.scene.cursor_location
+        sel = []
+        for v in ver:
+            d = v.co - loc
+            sel.append((d.length, v.index))
+        sel.sort()
+        if self.flip:
+            sel.reverse()
+        bpy.ops.object.mode_set()
+        valor = round(len(sel) / 100 * self.indice)
+        if self.delta:
+            for i in range(len(sel[:valor])):
+                ver[sel[i][1]].select = True
+        else:
+            for i in range(len(sel[:valor])):
+                if self.flip:
+                    ver[len(sel)-i-1].select = True
+                else:
+                    ver[i].select = True
+        bpy.ops.object.mode_set(mode='EDIT')
+        return {'FINISHED'}
+
+class SelEdge(bpy.types.Operator):
+    bl_idname = 'mesh.select_edge_index'
+    bl_label = 'Edges'
+    bl_description = 'Select edges by index'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    indice = bpy.props.FloatProperty(name='Selected', default=0, min=0, max=100, description='Percentage of selected edges', precision = 2, subtype = 'PERCENTAGE')
+    delta = bpy.props.BoolProperty(name='Use Edges Length', default=False, description='Select Edges by Index / Length')
+    flip = bpy.props.BoolProperty(name='Reverse Order', default=False, description='Reverse selecting order')
+
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.type == 'MESH')
+
+    def draw(self, context):
+        layout = self.layout
+        layout.prop(self,'indice', slider=True)
+        layout.prop(self,'delta')
+        layout.prop(self,'flip')
+
+    def execute(self, context):
+        obj = bpy.context.object
+        mode = [a for a in bpy.context.tool_settings.mesh_select_mode]
+        if mode != [False, True, False]:
+            bpy.context.tool_settings.mesh_select_mode = [False, True, False]
+        ver = obj.data.vertices
+        edg = obj.data.edges
+        sel = []
+        for e in edg:
+            d = ver[e.vertices[0]].co - ver[e.vertices[1]].co
+            sel.append((d.length, e.index))
+        sel.sort()
+        if self.flip:
+            sel.reverse()
+        bpy.ops.object.mode_set()
+        valor = round(len(sel) / 100 * self.indice)
+        if self.delta:
+            for i in range(len(sel[:valor])):
+                edg[sel[i][1]].select = True
+        else:
+            for i in range(len(sel[:valor])):
+                if self.flip:
+                    edg[len(sel)-i-1].select = True
+                else:
+                    edg[i].select = True
+        bpy.ops.object.mode_set(mode='EDIT')
+        return {'FINISHED'}
+
+class SelFace(bpy.types.Operator):
+    bl_idname = 'mesh.select_face_index'
+    bl_label = 'Faces'
+    bl_description = 'Select faces by index'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    indice = bpy.props.FloatProperty(name='Selected', default=0, min=0, max=100, description='Percentage of selected faces', precision = 2, subtype = 'PERCENTAGE')
+    delta = bpy.props.BoolProperty(name='Use Faces Area', default=False, description='Select Faces by Index / Area')
+    flip = bpy.props.BoolProperty(name='Reverse Order', default=False, description='Reverse selecting order')
+
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.type == 'MESH')
+
+    def draw(self, context):
+        layout = self.layout
+        layout.prop(self,'indice', slider=True)
+        layout.prop(self,'delta')
+        layout.prop(self,'flip')
+
+    def execute(self, context):
+        obj = bpy.context.object
+        mode = [a for a in bpy.context.tool_settings.mesh_select_mode]
+        if mode != [False, False, True]:
+            bpy.context.tool_settings.mesh_select_mode = [False, False, True]
+        fac = obj.data.polygons
+        sel = []
+        for f in fac:
+            sel.append((f.area, f.index))
+        sel.sort()
+        if self.flip:
+            sel.reverse()
+        print (sel)
+        bpy.ops.object.mode_set()
+        valor = round(len(sel) / 100 * self.indice)
+        if self.delta:
+            for i in range(len(sel[:valor])):
+                fac[sel[i][1]].select = True
+        else:
+            for i in range(len(sel[:valor])):
+                if self.flip:
+                    fac[len(sel)-i-1].select = True
+                else:
+                    fac[i].select = True
+        bpy.ops.object.mode_set(mode='EDIT')
+        return {'FINISHED'}
+
+class GUI(bpy.types.Panel):
+    bl_label = 'Select mesh data'
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    def draw(self, context):
+        layout = self.layout
+        row = layout.row(align=True)
+        row.operator('mesh.select_vert_index')
+        row.operator('mesh.select_edge_index')
+        row.operator('mesh.select_face_index')
+
+def register():
+    bpy.utils.register_class(SelVert)
+    bpy.utils.register_class(SelEdge)
+    bpy.utils.register_class(SelFace)
+    bpy.utils.register_class(GUI)
+
+def unregister():
+    bpy.utils.unregister_class(SelVert)
+    bpy.utils.unregister_class(SelEdge)
+    bpy.utils.unregister_class(SelFace)
+    bpy.utils.unregister_class(GUI)
+
+if __name__ == '__main__':
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_info_select.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_info_select.py
new file mode 100644
index 0000000..c97381e
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_info_select.py
@@ -0,0 +1,64 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# By CoDEmanX
+
+import bpy
+
+class DATA_PT_info_panel(bpy.types.Panel):
+    """Creates a face info / select panel in the Object properties window"""
+    bl_label = "Face info / select"
+    bl_idname = "DATA_PT_face_info"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "data"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(self, context):
+        return context.active_object is not None and context.active_object.type == 'MESH'
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.active_object
+        
+        info_str = ""
+        tris = quads = ngons = 0
+
+        for p in ob.data.polygons:
+            count = p.loop_total
+            if count == 3:
+                tris += 1
+            elif count == 4:
+                quads += 1
+            else:
+                ngons += 1
+
+        info_str = "  Ngons: %i  Quads: %i  Tris: %i" % (ngons, quads, tris)
+        
+        col = layout.column()
+        col.label(info_str, icon='MESH_DATA')
+
+        col = layout.column()
+        col.label("Select faces by type:")
+
+        row = layout.row()
+        row.operator("data.facetype_select", text="Ngons").face_type = "5"
+        row.operator("data.facetype_select", text="Quads").face_type = "4"
+        row.operator("data.facetype_select", text="Tris").face_type = "3"
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_direction.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_direction.py
new file mode 100644
index 0000000..9e2b10a
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_direction.py
@@ -0,0 +1,214 @@
+# mesh_select_by_direction.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Extrude a selection from a mesh multiple times
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+'''
+bl_info = {
+	"name": "Select by direction",
+	"author": "Dolf Veenvliet",
+	"version": 1,
+	"blender": (2, 5, 6),
+	"api": 31847,
+	"location": "View3D > Select",
+	"description": "Select all items whose normals face a certain direction",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+	
+"""
+Usage:
+
+Launch from from "Select -> By direction"
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+'''
+import bpy, mathutils, math
+from bpy.props import FloatVectorProperty, FloatProperty, BoolProperty, EnumProperty
+
+
+class Select_by_direction():
+
+	# Initialise the class
+	def __init__(self, context, direction, divergence, extend, space):
+	
+		self.ob = context.active_object
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		self.space = space
+		
+		# if we do stuff in global space we need to object matrix
+		if self.space == 'GLO':
+			direction = mathutils.Vector(direction) * mathutils.Matrix(self.ob.matrix_world.rotation_part()).invert()
+		else:
+			direction = mathutils.Vector(direction)
+			
+		direction = direction.normalized()
+		
+		vertSelect = bpy.context.tool_settings.mesh_select_mode[0]
+		edgeSelect = bpy.context.tool_settings.mesh_select_mode[1]
+		faceSelect = bpy.context.tool_settings.mesh_select_mode[2]
+		
+		if mathutils.Vector(direction).length:
+		
+			# Vert select
+			if vertSelect:
+			
+				hasSelected = self.hasSelected(self.ob.data.vertices)
+				
+				for v in self.ob.data.vertices:
+				
+					normal = v.normal
+				
+					s = self.selectCheck(v.select, hasSelected, extend)
+					d = self.deselectCheck(v.select, hasSelected, extend)
+					
+					if s or d:
+						angle = direction.angle(normal)
+				
+					# Check if the verts match any of the directions
+					if s and angle <= divergence:
+						v.select = True
+							
+					if d and angle > divergence:
+						v.select = False
+						
+			# Edge select
+			if edgeSelect:
+			
+				hasSelected = self.hasSelected(self.ob.data.edges)
+				
+				for e in self.ob.data.edges:
+				
+					s = self.selectCheck(e.select, hasSelected, extend)
+					d = self.deselectCheck(e.select, hasSelected, extend)
+						
+						
+					# Check if the edges match any of the directions
+					if s or d:
+						normal = self.ob.data.vertices[e.vertices[0]].normal
+						normal += self.ob.data.vertices[e.vertices[1]].normal
+						
+						angle =direction.angle(normal) 
+								
+								
+					if s and angle <= divergence:
+						e.select = True
+							
+					if d and angle > divergence:
+						e.select = False
+		
+			# Face select
+			if faceSelect:
+			
+				hasSelected = self.hasSelected(self.ob.data.polygons)
+			
+				# Loop through all the given faces
+				for f in self.ob.data.polygons:
+						
+					s = self.selectCheck(f.select, hasSelected, extend)
+					d = self.deselectCheck(f.select, hasSelected, extend)
+					
+					if s or d:
+						angle = direction.angle(f.normal) 
+					
+					# Check if the faces match any of the directions
+					if s and angle <= divergence:
+						f.select = True
+						
+					if d and angle > divergence:
+						f.select = False
+		
+		bpy.ops.object.mode_set(mode='EDIT')
+		
+		
+		
+	# See if the current item should be selected or not
+	def selectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is not selected we may want to select
+		if not isSelected:
+			
+			# If we are extending or nothing is selected we want to select
+			if extend or not hasSelected:
+				return True
+				
+		return False
+	
+	
+	
+	# See if the current item should be deselected or not
+	def deselectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is selected we may want to deselect
+		if isSelected:
+		
+			# If something is selected and we're not extending we want to deselect
+			if hasSelected and not extend:
+				return True
+
+		return False
+				
+		
+		
+	# See if there is at least one selected item
+	def hasSelected(self, items):
+	
+		for item in items:
+			if item.select:
+				return True
+					
+		return False
+		
+		
+		
+class Select_init(bpy.types.Operator):
+	'''Select all items with normals facing a certain direction'''
+	bl_idname = 'mesh.select_by_direction'
+	bl_label = 'Select by direction'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	direction = FloatVectorProperty(name="Direction", description="Direction as a vector", default=(0.0, 0.0, 1.0), min=-100.0, max=100.0, soft_min=-10.0, soft_max=10.0, step=100, precision=2)
+	
+	divergence = FloatProperty(name='Divergence', description='The nr of degrees the selection may differ from the vector', default=math.radians(30.0), min=0.0, max=math.radians(360.0), soft_min=0.0, soft_max=math.radians(360.0), step=math.radians(5000), precision=2, subtype='ANGLE')
+	
+	extend = BoolProperty(name='Extend', description='Extend the current selection', default=False)
+	
+	# The spaces we use
+	spaces=(('LOC', 'Local', ''),('GLO', 'Global', ''))
+	
+	space = EnumProperty(items=spaces, name='Space', description='The space to interpret the directions in', default='LOC')
+
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH')
+
+	def execute(self, context):
+		SELECT_DIRECTION = Select_by_direction(context, self.direction, self.divergence, self.extend, self.space) 
+		return {'FINISHED'}
+
+
+
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_edge_length.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_edge_length.py
new file mode 100644
index 0000000..af25e0e
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_edge_length.py
@@ -0,0 +1,219 @@
+# mesh_select_by_edge_length.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Extrude a selection from a mesh multiple times
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+'''
+bl_info = {
+	"name": "Select by edge length",
+	"author": "Dolf Veenvliet",
+	"version": 1,
+	"blender": (2, 5, 6),
+	"api": 31847,
+	"location": "View3D > Select",
+	"description": "Select all items whose scale/length/surface matches a certain edge length",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+	
+"""
+Usage:
+
+Launch from from "Select -> By edge length"
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+'''
+import bpy, mathutils, math
+from bpy.props import FloatProperty, BoolProperty, EnumProperty
+
+
+class Select_by_edge_length():
+
+	# Initialise the class
+	def __init__(self, context, edgeLength, bigger, smaller, extend, space):
+	
+		self.ob = context.active_object
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		self.space = space
+		self.obMat = self.ob.matrix_world
+		
+		# We ignore vert selections completely
+		#vertSelect = bpy.context.tool_settings.mesh_select_mode[0]
+		edgeSelect = bpy.context.tool_settings.mesh_select_mode[1]
+		faceSelect = bpy.context.tool_settings.mesh_select_mode[2]
+			
+					
+		# Edge select
+		if edgeSelect:
+		
+			hasSelected = self.hasSelected(self.ob.data.edges)
+			
+			for e in self.ob.data.edges:
+						
+				if  self.selectCheck(e.select, hasSelected, extend):
+				
+					len = self.getEdgeLength(e.vertices)
+					
+					if len == edgeLength or (bigger and len >= edgeLength) or (smaller and len <= edgeLength):
+						e.select = True
+					
+				if self.deselectCheck(e.select, hasSelected, extend):
+					len = self.getEdgeLength(e.vertices)
+					
+					if len != edgeLength and not (bigger and len >= edgeLength) and not (smaller and len <= edgeLength):
+						e.select = False
+	
+		# Face select
+		if faceSelect:
+		
+			hasSelected = self.hasSelected(self.ob.data.polygons)
+		
+			# Loop through all the given faces
+			for f in self.ob.data.polygons:
+					
+				# Check if the faces match any of the directions
+				if self.selectCheck(f.select, hasSelected, extend):
+				
+					min = 0.0
+					max = 0.0
+					
+					for i, e in enumerate(f.edge_keys):
+						len = self.getEdgeLength(e)
+						if not i:
+							min = len
+							max = len
+						elif len < min:
+							min = len
+						elif len > max:
+							max = len
+							
+					if (min == edgeLength and max == edgeLength) or (bigger and min >= edgeLength) or (smaller and max <= edgeLength):
+						f.select = True
+					
+				if self.deselectCheck(f.select, hasSelected, extend):
+				
+					min = 0.0
+					max = 0.0
+					
+					for i, e in enumerate(f.edge_keys):
+						len = self.getEdgeLength(e)
+						if not i:
+							min = len
+							max = len
+						elif len < min:
+							min = len
+						elif len > max:
+							max = len
+							
+					if (min != edgeLength and max != edgeLength) and not (bigger and  min >= edgeLength) and not (smaller and max <= edgeLength):
+						f.select = False
+		
+		
+		bpy.ops.object.mode_set(mode='EDIT')
+		
+		
+		
+	# Get the lenght of an edge, by giving this function all verts (2) in the edge
+	def getEdgeLength(self, verts):
+	
+		vec1 = self.ob.data.vertices[verts[0]].co
+		vec2 = self.ob.data.vertices[verts[1]].co
+				
+		vec = vec1 - vec2
+		
+		if self.space == 'GLO':
+			vec *= self.obMat
+		
+		return round(vec.length, 5)
+		
+		
+		
+	# See if the current item should be selected or not
+	def selectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is not selected we may want to select
+		if not isSelected:
+			
+			# If we are extending or nothing is selected we want to select
+			if extend or not hasSelected:
+				return True
+				
+		return False
+	
+	
+	
+	# See if the current item should be deselected or not
+	def deselectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is selected we may want to deselect
+		if isSelected:
+		
+			# If something is selected and we're not extending we want to deselect
+			if hasSelected and not extend:
+				return True
+
+		return False
+		
+		
+		
+	# See if there is at least one selected item
+	def hasSelected(self, items):
+	
+		for item in items:
+			if item.select:
+				return True
+					
+		return False
+		
+		
+		
+class Select_init(bpy.types.Operator):
+	'''Select all items with normals facing a certain direction'''
+	bl_idname = 'mesh.select_by_edge_length'
+	bl_label = 'Select by edge length'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	edgeLength = FloatProperty(name='Edge length', description='The scale in Blender units', default=1.0, min=0.0, max=1000.0, soft_min=0.0, soft_max=100.0, step=100, precision=2)
+	
+	bigger = BoolProperty(name='Bigger', description='Select items bigger than the size setting', default=False)
+	
+	smaller = BoolProperty(name='Smaller', description='Select items smaller than the size setting', default=False)
+	
+	extend = BoolProperty(name='Extend', description='Extend the current selection', default=False)
+	
+	# The spaces we use
+	spaces=(('LOC', 'Local', ''),('GLO', 'Global', ''))
+	
+	space = EnumProperty(items=spaces, name='Space', description='The space to interpret the directions in', default='LOC')
+
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH' and not bpy.context.tool_settings.mesh_select_mode[0])
+
+	def execute(self, context):
+		SELECT_EDGES = Select_by_edge_length(context, self.edgeLength, self.bigger, self.smaller, self.extend, self.space) 
+		return {'FINISHED'}
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_pi.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_pi.py
new file mode 100644
index 0000000..2019118
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_pi.py
@@ -0,0 +1,214 @@
+# mesh_select_by_pi.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Extrude a selection from a mesh multiple times
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+'''
+bl_info = {
+	"name": "Select by pi",
+	"author": "Dolf Veenvliet",
+	"version": 1,
+	"blender": (2, 5, 6),
+	"api": 31847,
+	"location": "View3D > Select",
+	"description": "Select fake random based on pi",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+	
+"""
+Usage:
+
+Launch from from "Select -> By pi"
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+'''
+import bpy
+from bpy.props import BoolProperty
+
+
+class Select_by_pi():
+
+	# Initialise the class
+	def __init__(self, context, e, invert, extend):
+	
+		self.ob = context.active_object
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		self.invert = invert
+		
+		# Make pi as a list of integers
+		if e:
+			self.pi = list('27182818284590452353602874713526624977572470936999')
+		else:
+			self.pi = list('31415926535897932384626433832795028841971693993751')
+		
+		self.piLen = len(self.pi)
+		self.piPos = 0
+		
+		vertSelect = bpy.context.tool_settings.mesh_select_mode[0]
+		edgeSelect = bpy.context.tool_settings.mesh_select_mode[1]
+		faceSelect = bpy.context.tool_settings.mesh_select_mode[2]
+		
+		# Vert select
+		if vertSelect:
+		
+			hasSelected = self.hasSelected(self.ob.data.vertices)
+			
+			for v in self.ob.data.vertices:
+			
+				s = self.selectCheck(v.select, hasSelected, extend)
+				d = self.deselectCheck(v.select, hasSelected, extend)
+			
+				# Check if the verts match any of the directions
+				if s and self.choose():
+					v.select = True
+						
+				if d and not self.choose():
+					v.select = False
+					
+		# Edge select
+		if edgeSelect:
+		
+			hasSelected = self.hasSelected(self.ob.data.edges)
+			
+			for e in self.ob.data.edges:
+			
+				s = self.selectCheck(e.select, hasSelected, extend)
+				d = self.deselectCheck(e.select, hasSelected, extend)
+					
+				if s and self.choose():
+					e.select = True
+						
+				if d and not self.choose():
+					e.select = False
+	
+		# Face select
+		if faceSelect:
+		
+			hasSelected = self.hasSelected(self.ob.data.polygons)
+		
+			# Loop through all the given faces
+			for f in self.ob.data.polygons:
+					
+				s = self.selectCheck(f.select, hasSelected, extend)
+				d = self.deselectCheck(f.select, hasSelected, extend)
+				
+				# Check if the faces match any of the directions
+				if s and self.choose():
+					f.select = True
+					
+				if d and not self.choose():
+					f.select = False
+	
+		bpy.ops.object.mode_set(mode='EDIT')
+	
+	
+	
+	# Choose by pi
+	def choose(self):
+		choice = True
+		
+		# We just choose the odd numbers
+		if int(self.pi[self.piPos]) % 2:
+			choice = False
+			
+		if self.invert:
+			if choice:
+				choice = False
+			else:
+				choice = True
+			
+		self.incrementPiPos()
+		return choice
+	
+	
+	
+	# Increment the pi position
+	def incrementPiPos(self):
+		self.piPos += 1
+		if self.piPos == self.piLen:
+			self.piPos = 0
+	
+	
+	
+	# See if the current item should be selected or not
+	def selectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is not selected we may want to select
+		if not isSelected:
+			
+			# If we are extending or nothing is selected we want to select
+			if extend or not hasSelected:
+				return True
+				
+		return False
+	
+	
+	
+	# See if the current item should be deselected or not
+	def deselectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is selected we may want to deselect
+		if isSelected:
+		
+			# If something is selected and we're not extending we want to deselect
+			if hasSelected and not extend:
+				return True
+
+		return False
+				
+		
+		
+	# See if there is at least one selected item
+	def hasSelected(self, items):
+	
+		for item in items:
+			if item.select:
+				return True
+					
+		return False
+		
+		
+		
+class Select_init(bpy.types.Operator):
+	'''Select faces based on pi'''
+	bl_idname = 'mesh.select_by_pi'
+	bl_label = 'Select by pi'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	e = BoolProperty(name='Use e', description='use e in stead of pi', default=False)
+	
+	invert = BoolProperty(name='Invert', description='Invert the selection result', default=False)
+	
+	extend = BoolProperty(name='Extend', description='Extend the current selection', default=False)
+
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH')
+
+	def execute(self, context):
+		SELECT_DIRECTION = Select_by_pi(context, self.e, self.invert, self.extend) 
+		return {'FINISHED'}
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_type.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_type.py
new file mode 100644
index 0000000..c75d6b5
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_by_type.py
@@ -0,0 +1,59 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# By CoDEmanX
+
+import bpy
+from bpy.props import EnumProperty, BoolProperty
+
+class DATA_OP_facetype_select(bpy.types.Operator):
+    """Select all faces of a certain type"""
+    bl_idname = "data.facetype_select"
+    bl_label = "Select by face type"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    face_type = EnumProperty(name="Select faces:",
+                             items = (("3","Triangles","Faces made up of 3 vertices"),
+                                      ("4","Quads","Faces made up of 4 vertices"),
+                                      ("5","Ngons","Faces made up of 5 and more vertices")),
+                             default = "5")
+
+    extend = BoolProperty(name="Extend", description="Extend Selection", default=False)
+
+    @classmethod
+    def poll(cls, context):
+        return context.active_object is not None and context.active_object.type == 'MESH'
+
+    def execute(self, context):
+
+        bpy.ops.object.mode_set(mode='EDIT')
+
+        if not self.extend:
+            bpy.ops.mesh.select_all(action='DESELECT')
+
+        context.tool_settings.mesh_select_mode=(False, False, True)
+
+        if self.face_type == "3":
+            bpy.ops.mesh.select_face_by_sides(number=3, type='EQUAL')
+        elif self.face_type == "4":
+            bpy.ops.mesh.select_face_by_sides(number=4, type='EQUAL')
+        else:
+            bpy.ops.mesh.select_face_by_sides(number=4, type='GREATER')
+
+        return {'FINISHED'}
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_checkered.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_checkered.py
new file mode 100644
index 0000000..f8ee204
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_checkered.py
@@ -0,0 +1,185 @@
+# mesh_select_checkered.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Extrude a selection from a mesh multiple times
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+bl_info = {
+	"name": "Select checkered",
+	"author": "Dolf Veenvliet",
+	"version": 1,
+	"blender": (2, 5, 6),
+	"api": 31847,
+	"location": "View3D > Select",
+	"description": "Select checkered",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+	
+"""
+Usage:
+
+Launch from from "Select -> checkered"
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+
+import bpy
+from bpy.props import BoolProperty
+
+
+class Select_checkered():
+
+	# Initialise the class
+	def __init__(self, context, invert, extend):
+	
+		self.ob = context.active_object
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		self.invert = invert
+		
+		self.selectedVerts = []
+		self.selectedFaces = []
+		self.deselectedFaces = []
+		
+		hasSelected = self.hasSelected(self.ob.data.polygons)
+	
+	
+		working = True
+		while working:
+		
+			working = False
+	
+			# Loop through all the given faces
+			for f in self.ob.data.polygons:
+			
+				if not f.index in self.selectedFaces and not f.index in self.deselectedFaces:
+					
+					choice = self.Choose(f)
+					
+					if choice != 'skip':
+					
+						s = self.selectCheck(f.select, hasSelected, extend)
+						d = self.deselectCheck(f.select, hasSelected, extend)
+					
+						# Check if the faces match any of the directions
+						if s and choice:
+							f.select = True
+							working = True
+							
+						if d and not choice:
+							f.select = False
+							working = True
+	
+		bpy.ops.object.mode_set(mode='EDIT')
+		
+	
+	
+	# Choose whether or not to select
+	def Choose(self, f):
+	
+		choice = 'skip'
+	
+		if not len(self.selectedFaces):
+			choice = True
+			self.selectedFaces.append(f.index)
+			self.selectedVerts.extend(f.vertices)
+		
+		else:
+			intersection = [v for v in f.vertices if v in self.selectedVerts]
+			
+			if len(intersection) == 1:
+				choice = True
+				self.selectedFaces.append(f.index)
+				self.selectedVerts.extend(f.vertices)
+				
+			elif len(intersection) == 2:
+				choice = False
+				self.deselectedFaces.append(f.index)
+	
+		if self.invert:
+			if choice:
+				choice = False
+			else:
+				choice = True
+		return choice
+	
+	
+	# See if the current item should be selected or not
+	def selectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is not selected we may want to select
+		if not isSelected:
+			
+			# If we are extending or nothing is selected we want to select
+			if extend or not hasSelected:
+				return True
+				
+		return False
+	
+	
+	
+	# See if the current item should be deselected or not
+	def deselectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is selected we may want to deselect
+		if isSelected:
+		
+			# If something is selected and we're not extending we want to deselect
+			if hasSelected and not extend:
+				return True
+
+		return False
+				
+		
+		
+	# See if there is at least one selected item
+	def hasSelected(self, items):
+	
+		for item in items:
+			if item.select:
+				return True
+					
+		return False
+		
+		
+		
+class Select_init(bpy.types.Operator):
+	'''Select faces based on pi'''
+	bl_idname = 'mesh.select_checkered'
+	bl_label = 'Select checkered'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	invert = BoolProperty(name='Invert', description='Invert the selection result', default=False)
+	
+	extend = BoolProperty(name='Extend', description='Extend the current selection', default=False)
+
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH')
+
+	def execute(self, context):
+		SELECT_DIRECTION = Select_checkered(context, self.invert, self.extend) 
+		return {'FINISHED'}
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_connected_faces.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_connected_faces.py
new file mode 100644
index 0000000..da3e612
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_connected_faces.py
@@ -0,0 +1,149 @@
+# mesh_select_connected_faces.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Extrude a selection from a mesh multiple times
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+'''
+bl_info = {
+	"name": "Select connected faces",
+	"author": "Dolf Veenvliet",
+	"version": 1,
+	"blender": (2, 5, 6),
+	"api": 31847,
+	"location": "View3D > Select",
+	"description": "Select all faces connected to the current selection",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+	
+"""
+Usage:
+
+Launch from from "Select -> Connected faces"
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+'''
+import bpy, mathutils, math
+from bpy.props import IntProperty, BoolProperty
+
+
+class Select_connected_faces():
+
+	# Initialise the class
+	def __init__(self, context, iterations, extend):
+	
+		self.ob = context.active_object
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		# Make a list of all selected vertices
+		selVerts = [v.index for v in self.ob.data.vertices if v.select]
+		
+		hasSelected = self.hasSelected(self.ob.data.polygons)
+		
+		for i in range(iterations):
+		
+			nextVerts = []
+		
+			for f in self.ob.data.polygons:
+			
+				if self.selectCheck(f.select, hasSelected, extend):
+				
+					for v in f.vertices:
+						if v in selVerts:
+							f.select = True
+
+					if f.select:
+						for v in f.vertices:
+							if v not in selVerts:
+								nextVerts.append(v)
+							
+				elif self.deselectCheck(f.select, hasSelected, extend):
+				
+					for v in f.vertices:
+						if v in selVerts:
+							f.select = False
+						
+							
+			selVerts = nextVerts
+		
+		bpy.ops.object.mode_set(mode='EDIT')
+		
+
+		
+	# See if the current item should be selected or not
+	def selectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is not selected we may want to select
+		if not isSelected:
+			return True
+				
+		return False
+	
+	
+	
+	# See if the current item should be deselected or not
+	def deselectCheck(self, isSelected, hasSelected, extend):
+	
+		# If the current item is selected we may want to deselect
+		if isSelected:
+		
+			# If something is selected and we're not extending we want to deselect
+			if hasSelected and not extend:
+				return True
+
+		return False
+		
+		
+		
+	# See if there is at least one selected item
+	def hasSelected(self, items):
+	
+		for item in items:
+			if item.select:
+				return True
+					
+		return False
+		
+		
+		
+class Select_init(bpy.types.Operator):
+	'''Select all faces connected to the current selection'''
+	bl_idname = 'mesh.select_connected_faces'
+	bl_label = 'Select connected faces'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	# Iterations
+	iterations = IntProperty(name='Iterations', default=1, min=0, max=1000, soft_min=0, soft_max=100)
+	
+	extend = BoolProperty(name='Extend', description='Extend the current selection', default=False)
+	
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH' and bpy.context.tool_settings.mesh_select_mode[0] == False and bpy.context.tool_settings.mesh_select_mode[1] == False and bpy.context.tool_settings.mesh_select_mode[2] == True)
+
+	def execute(self, context):
+		SELECT_CONNECTED = Select_connected_faces(context, self.iterations, self.extend) 
+		return {'FINISHED'}
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_select_innermost.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_innermost.py
new file mode 100644
index 0000000..a16241d
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_select_innermost.py
@@ -0,0 +1,139 @@
+# mesh_Select_innermost.py Copyright (C) 2011, Dolf Veenvliet
+#
+# Relaxes selected vertices while retaining the shape as much as possible
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+'''
+bl_info = {
+	"name": "Select innermost",
+	"author": "Dolf Veenvliet",
+	"version": (0,3),
+	"blender": (2, 5, 7),
+	"api": 35851,
+	"location": "Select > Innermost",
+	"description": "Select the innermost faces",
+	"warning": "",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Mesh"}
+
+"""
+Usage:
+
+Launch from "Select -> Innermost"
+
+
+Additional links:
+	Author Site: http://www.macouno.com
+	e-mail: dolf {at} macouno {dot} com
+"""
+'''
+import bpy
+from bpy.props import BoolProperty
+from . import mesh_extras
+
+# Grow stuff!
+class Select_innermost():
+
+	# Initialise the class
+	def __init__(self, context, invert):
+	
+		me = context.active_object.data
+		bpy.ops.object.mode_set(mode='OBJECT')
+		
+		oList = [f.index for f in mesh_extras.get_selected_faces()]
+		oLen = len(oList)
+		
+		# If no faces are selected, we just return
+		if not oLen:
+			bpy.ops.object.mode_set(mode='EDIT')
+			return
+		
+		# If all faces are selected, select nothing and return
+		if oLen == len(me.polygons):
+			bpy.ops.object.mode_set(mode='EDIT')
+			bpy.ops.mesh.select_all(action='DESELECT')
+			return
+		
+		fList = False
+		
+		# If we invert, we just want to select less once, and then we're done
+		if invert:
+			
+			bpy.ops.object.mode_set(mode='EDIT')
+			bpy.ops.mesh.select_less()
+			bpy.ops.object.mode_set(mode='OBJECT')
+			
+			fList = [f.index for f in mesh_extras.get_selected_faces()]
+			
+			# Only if there's now less selected do we change anything
+			if len(fList) < oLen:
+			
+				for f in me.polygons:
+					fIn = f.index
+					if fIn in oList and not fIn in fList:
+						f.select = True
+					else:
+						f.select = False
+						
+			bpy.ops.object.mode_set(mode='EDIT')
+			return
+			
+
+		# So now we can start and see what's up
+		while mesh_extras.contains_selected_item(me.polygons):
+				
+			if fList is False:
+				fList = oList
+			else:
+				fList = [f.index for f in mesh_extras.get_selected_faces()]
+			
+			bpy.ops.object.mode_set(mode='EDIT')
+			bpy.ops.mesh.select_less()
+			bpy.ops.object.mode_set(mode='OBJECT')
+			
+		if len(fList) < oLen:
+			for f in me.faces:
+				if f.index in fList:
+					f.select = True
+				else:
+					f.select = False
+		
+		bpy.ops.object.mode_set(mode='EDIT')
+		
+				
+
+class Select_innermost_init(bpy.types.Operator):
+	'''Select the innermost faces of the current selection'''
+	bl_idname = 'mesh.select_innermost'
+	bl_label = 'Select innermost'
+	bl_options = {'REGISTER', 'UNDO'}
+	
+	invert = BoolProperty(name='Invert', description='Invert the selection result (select outermost)', default=False)
+
+	@classmethod
+	def poll(cls, context):
+		obj = context.active_object
+		return (obj and obj.type == 'MESH')
+
+	def execute(self, context):
+		innermost = Select_innermost(context, self.invert)
+		return {'FINISHED'}
+
diff --git a/release/scripts/addons_contrib/mesh_select_tools/mesh_selection_topokit.py b/release/scripts/addons_contrib/mesh_select_tools/mesh_selection_topokit.py
new file mode 100644
index 0000000..91c8c26
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_select_tools/mesh_selection_topokit.py
@@ -0,0 +1,567 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+    "name": "Topokit 2",
+    "author": "dustractor",
+    "version": (2,0),
+    "blender": (2,6,0),
+    "api": 41935,
+    "location": "edit mesh vertices/edges/faces menus",
+    "description": "",
+    "warning": "",
+    "wiki_url": "",
+    "tracker_url": "",
+    "category": "Mesh"}
+
+
+import bpy
+# In between calls, this stores any data that is expensive or static,
+# matched to the size of the mesh and the id of the operator that created it
+cachedata = dict()
+# and the object keeps the key to the cachedata
+bpy.types.Object.tkkey = bpy.props.IntVectorProperty(size=4)
+
+# just a mix-in for the operators...
+class meshpoller:
+    @classmethod
+    def poll(self,context):
+        try:
+            assert context.active_object.type == "MESH"
+        except:
+            return False
+        finally:
+            return True
+
+#BEGIN VERTICES SECTION
+
+# This one works similarly to normal 'grow' (ctrl + NUMPAD_PLUS),
+# except the original selection is not part of the result,
+#
+#   0--0--0         0--1--0
+#   |  |  |         |  |  |
+#   0--1--0  -->    1--0--1
+#   |  |  |         |  |  |
+#   0--0--0         0--1--0
+#
+class MESH_OT_vneighbors_edgewise(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.v2v_by_edge"
+    bl_label = "Neighbors by Edge"
+    bl_options = {"REGISTER","UNDO"}
+    
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        next_state = bytearray(meshkey[0])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            vert_to_vert_map,prev_state = cachedata[meshkey]
+        else:
+            vert_to_vert_map = {i:{} for i in range(meshkey[0])}
+            for a,b in mesh.edge_keys:
+                vert_to_vert_map[a][b] = 1
+                vert_to_vert_map[b][a] = 1
+            obj.tkkey = meshkey
+            prev_state = None
+        if not prev_state:
+            selected_vert_indices = filter(lambda _:mesh.vertices[_].select,range(len(mesh.vertices)))
+        else:
+            selected_vert_indices = filter(lambda _:mesh.vertices[_].select and not prev_state[_],range(len(mesh.vertices)))
+        for v in selected_vert_indices:
+            for neighbor_index in vert_to_vert_map[v]:
+                next_state[neighbor_index] = True
+        mesh.vertices.foreach_set("select",next_state)
+        cachedata[meshkey] = (vert_to_vert_map,next_state)
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+# This one is an alternate / counterpart to the previous.
+# Think: diagonal opposite corners of a quad
+# NOTE: does not apply to a triangle, since verts have no 'opposite'
+#
+#   0--0--0     1--0--1
+#   |  |  |     |  |  |
+#   0--1--0 --> 0--0--0
+#   |  |  |     |  |  |
+#   0--0--0     1--0--1
+#
+class MESH_OT_vneighbors_facewise(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.v2v_facewise"
+    bl_label = "Neighbors by Face - Edge"
+    bl_options = {"REGISTER","UNDO"}
+    
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        next_state = bytearray(meshkey[0])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            vert_to_vert_map = cachedata[meshkey]
+        else:
+            vert_to_vert_map = {i:{} for i in range(meshkey[0])}
+            for a,b in mesh.edge_keys:
+                vert_to_vert_map[a][b] = 1
+                vert_to_vert_map[b][a] = 1
+            obj.tkkey = meshkey
+        faces = filter(lambda face:(len(face.vertices)==4) and (face.select == False),mesh.polygons)
+        for f in faces:
+            has = False
+            t = set()
+            for v in f.vertices:
+                if mesh.vertices[v].select:
+                    has = True
+                    t.update(vert_to_vert_map[v])
+            if has:
+                for v in f.vertices:
+                    if not mesh.vertices[v].select:
+                        if v not in t:
+                            next_state[v]=1 
+        mesh.vertices.foreach_set("select",next_state)
+        cachedata[meshkey] = vert_to_vert_map
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+def vvmenuitem(self,context):
+    self.layout.operator(MESH_OT_vneighbors_edgewise.bl_idname)
+    self.layout.operator(MESH_OT_vneighbors_facewise.bl_idname)
+    #for the sake of completeness, yes there is one alg missing - one for both...
+
+#END VERTICES SECTION
+#BEGIN EDGES SECTION
+
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--1--+--0--+   --->   +--0--+--0--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+class MESH_OT_eneighbors_shared_v_f(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.e2e_evfe"
+    bl_label = "Neighbors by Vert+Face"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        state_mask = bytearray(meshkey[1])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_to_edges_dict = cachedata
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            edge_to_edges_dict = {i:set() for i in range(len(mesh.edges))}
+            for f in mesh.polygons:
+                fed=[edge_key_to_index[k] for k in f.edge_keys]
+                for k in f.edge_keys:
+                    edge_to_edges_dict[edge_key_to_index[k]].update(fed)
+            obj.tkkey = meshkey
+        for e in filter(lambda _:mesh.edges[_].select,edge_to_edges_dict):
+            k1 = set(mesh.edges[e].key)
+            for n in edge_to_edges_dict[e]:
+                k2 = set(mesh.edges[n].key)
+                if not k1.isdisjoint(k2):
+                    state_mask[n] = True
+        for e in mesh.edges:
+            e.select ^= state_mask[e.index]
+        cachedata[meshkey] = edge_key_to_index
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--1--+--0--+   --->   +--1--+--0--+--1--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+class MESH_OT_eneighbors_shared_v(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.e2e_eve"
+    bl_label = "Neighbors by Vert"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        bpy.ops.object.mode_set(mode="OBJECT")
+        mesh = context.active_object.data
+        state_mask = bytearray(len(mesh.edges))
+        for e in mesh.edges:
+            state_mask[e.index] = mesh.vertices[e.vertices[0]].select ^ mesh.vertices[e.vertices[1]].select
+        mesh.edges.foreach_set('select',state_mask)
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+#   +--0--+--0--+--0--+          +--0--+--1--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--1--+--0--+   --->   +--0--+--0--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     1     1     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--0--+--0--+          +--0--+--1--+--0--+
+class MESH_OT_eneighbors_shared_f(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.e2e_efe"
+    bl_label = "Neighbors by Face"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_to_edges_dict = cachedata
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            edge_to_edges_dict = {i:set() for i in range(len(mesh.edges))}
+            for f in mesh.polygons:
+                fed=[edge_key_to_index[k] for k in f.edge_keys]
+                for k in f.edge_keys:
+                    edge_to_edges_dict[edge_key_to_index[k]].update(fed)
+            obj.tkkey = meshkey
+        state_mask,esel = (bytearray(meshkey[1]),bytearray(meshkey[1]))
+        mesh.edges.foreach_get('select',esel) 
+        for e in filter(lambda _:mesh.edges[_].select,range(meshkey[1])):
+            for n in edge_to_edges_dict[e]:
+                state_mask[n] = 1
+        for e in range(meshkey[1]):
+            esel[e] ^= state_mask[e]
+        mesh.edges.foreach_set('select',esel)
+        cachedata[meshkey] = edge_to_edges_dict
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+# notice that on these next two, the original selection stays
+#   +--0--+--0--+--0--+          +--0--+--1--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     0     0     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--1--+--0--+   --->   +--0--+--1--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     0     0     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--0--+--0--+          +--0--+--1--+--0--+
+class MESH_OT_eneighbors_shared_f_notv(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.e2e_efnve"
+    bl_label = "Lateral Neighbors"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        state_mask = bytearray(meshkey[1])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_to_face_map,edge_key_to_index = cachedata[meshkey]
+        else:   
+            edge_key_to_index = {}
+            edge_to_face_map = {i:set() for i in range(meshkey[1])}
+            for i,k in enumerate(mesh.edge_keys):
+                edge_key_to_index[k] = i
+            for f in mesh.polygons:
+                for k in f.edge_keys:
+                    edge_to_face_map[edge_key_to_index[k]].add(f.index)
+            obj.tkkey = meshkey
+        selected_edge_indices = filter(lambda _:mesh.edges[_].select,range(meshkey[1]))
+        for e in selected_edge_indices:
+            for f in edge_to_face_map[e]:
+                for k in mesh.polygons[f].edge_keys:
+                    hasv_in = False
+                    for v in mesh.edges[e].key:
+                        if v in k:
+                            hasv_in = True
+                    if hasv_in:
+                        continue
+                    else:
+                        state_mask[edge_key_to_index[k]] = True
+        for e in filter(lambda _:state_mask[_],range(meshkey[1])):
+            mesh.edges[e].select |= state_mask[e]
+        cachedata[meshkey] = (edge_to_face_map,edge_key_to_index)
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     0     0     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--1--+--0--+   --->   +--1--+--1--+--1--+
+#   |     |     |     |          |     |     |     |
+#   0     0     0     0          0     0     0     0
+#   |     |     |     |          |     |     |     |
+#   +--0--+--0--+--0--+          +--0--+--0--+--0--+
+class MESH_OT_eneighbors_shared_v_notf(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.e2e_evnfe"
+    bl_label = "Longitudinal Edges"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        state_mask = bytearray(meshkey[1])
+        vstate = bytearray(meshkey[0])
+        mesh.vertices.foreach_get('select',vstate)
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_to_face_map,vert_to_vert_map,edge_key_to_index = cachedata[meshkey]
+        else:
+            edge_key_to_index = {}
+            vert_to_vert_map = {i:set() for i in range(meshkey[0])}
+            edge_to_face_map = {i:set() for i in range(meshkey[1])}
+            for i,k in enumerate(mesh.edge_keys):
+                edge_key_to_index[k] = i
+                vert_to_vert_map[k[0]].add(k[1])
+                vert_to_vert_map[k[1]].add(k[0])
+            for f in mesh.polygons:
+                for k in f.edge_keys:
+                    edge_to_face_map[edge_key_to_index[k]].add(f.index)
+            obj.tkkey = meshkey
+        selected_edge_indices = filter(lambda _:mesh.edges[_].select,range(meshkey[1]))
+        for e in selected_edge_indices:
+            for v in mesh.edges[e].key:
+                state_mask[v] ^=1
+            for f in edge_to_face_map[e]:
+                for v in mesh.polygons[f].vertices:
+                    vstate[v] = 1
+        for v in filter(lambda _:state_mask[_],range(meshkey[1])):
+            for n in vert_to_vert_map[v]:
+                if not vstate[n] and (n != v):
+                    mesh.edges[edge_key_to_index[(min(v,n),max(v,n))]].select = True
+        cachedata[meshkey] = (edge_to_face_map,vert_to_vert_map,edge_key_to_index)
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+ 
+#deselects faces, leaving only edges selected
+class MESH_OT_just_the_edges(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.je"
+    bl_label = "Just the Edge Selection"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        state_mask = bytearray(meshkey[1])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_key_to_index = cachedata[meshkey]
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            obj.tkkey = meshkey
+        for f in filter(lambda _:mesh.polygons[_].select,range(meshkey[2])):
+            for k in mesh.polygons[f].edge_keys:
+                state_mask[edge_key_to_index[k]] = 1
+        for e in range(meshkey[1]):
+            mesh.edges[e].select ^= state_mask[e]
+        cachedata[meshkey] = edge_key_to_index
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+# deselects edges which are at the edge of a face-selection,
+# causing selection to 'shrink in'
+class MESH_OT_inner_edges(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.ie"
+    bl_label = "Inner Edge Selection"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        state_mask = bytearray(meshkey[1])
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_to_face_map = cachedata[meshkey]
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            edge_to_face_map = {i:set() for i in range(meshkey[1])}
+            for f in mesh.polygons:
+                for k in f.edge_keys:
+                    edge_to_face_map[edge_key_to_index[k]].add(f.index)
+            obj.tkkey = meshkey
+        for e in filter(lambda _:mesh.edges[_].select,range(meshkey[1])):
+            for f in edge_to_face_map[e]:
+                if mesh.polygons[f].select:
+                    state_mask[e] ^=1
+        for e in range(meshkey[1]):
+            mesh.edges[e].select ^= state_mask[e]
+        cachedata[meshkey] = edge_to_face_map
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+def eemenuitem(self,context):
+    self.layout.operator(MESH_OT_eneighbors_shared_v_f.bl_idname)
+    self.layout.operator(MESH_OT_eneighbors_shared_v.bl_idname)
+    self.layout.operator(MESH_OT_eneighbors_shared_f.bl_idname)
+    self.layout.operator(MESH_OT_eneighbors_shared_f_notv.bl_idname)
+    self.layout.operator(MESH_OT_eneighbors_shared_v_notf.bl_idname)
+    self.layout.operator(MESH_OT_just_the_edges.bl_idname)
+    self.layout.operator(MESH_OT_inner_edges.bl_idname)
+
+#END EDGES SECTION
+#BEGIN FACES SECTION
+
+# here is another one which functions very similarly to the ctrl+NUMPAD_PLUS 'growth'
+# but it deselects the original selection, of course.
+# This would be your checkerboard-type growth.
+#   [0][0][0]          [0][1][0] 
+#   [0][1][0]   --->   [1][0][1]
+#   [0][0][0]          [0][1][0]
+class MESH_OT_fneighbors_shared_e(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.f2f_fef"
+    bl_label = "Neighbors by Edge"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            face_to_face_map = cachedata[meshkey]
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            edge_to_face_map = {i:set() for i in range(meshkey[1])}
+            for f in mesh.polygons:
+                for k in f.edge_keys:
+                    edge_to_face_map[edge_key_to_index[k]].add(f.index)
+            face_to_face_map = {i:set() for i in range(meshkey[2])}
+            for f in mesh.polygons:
+                for k in f.edge_keys:
+                    face_to_face_map[f.index].update(edge_to_face_map[edge_key_to_index[k]])
+            obj.tkkey = meshkey
+        mask_state = bytearray(meshkey[2])
+        for f in filter(lambda _:mesh.polygons[_].select,range(meshkey[2])):
+            for n in face_to_face_map[f]:
+                mask_state[n] = True
+        for f in range(meshkey[2]):
+            mesh.polygons[f].select ^= mask_state[f]
+        cachedata[meshkey] = face_to_face_map
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+#   [0][0][0]          [1][0][1] 
+#   [0][1][0]   --->   [0][0][0]
+#   [0][0][0]          [1][0][1]
+class MESH_OT_fneighbors_shared_v_note(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.f2f_fvnef"
+    bl_label = "Neighbors by Vert not Edge"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            edge_key_to_index = cachedata[meshkey]
+        else:
+            edge_key_to_index = {k:i for i,k in enumerate(mesh.edge_keys)}
+            obj.tkkey = meshkey
+        state_mask = bytearray(meshkey[2])
+        face_verts = set()
+        for f in filter(lambda _:mesh.polygons[_].select,range(meshkey[2])):
+            face_verts.update(mesh.polygons[f].vertices)
+        for f in filter(lambda _:not mesh.polygons[_].select,range(meshkey[2])):
+            ct = 0
+            for v in mesh.polygons[f].vertices:
+                ct += (v in face_verts)
+            if ct == 1:
+                state_mask[f] = 1
+        mesh.polygons.foreach_set('select',state_mask)
+        cachedata[meshkey] = edge_key_to_index
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+
+# http://en.wikipedia.org/wiki/Conway's_Game_of_Life
+class MESH_OT_conway(meshpoller,bpy.types.Operator):
+    bl_idname = "mesh.conway"
+    bl_label = "Conway"
+    bl_options = {"REGISTER","UNDO"}
+    def execute(self,context):
+        global cachedata
+        bpy.ops.object.mode_set(mode="OBJECT")
+        obj = context.active_object
+        mesh = obj.data
+        meshkey = (len(mesh.vertices),len(mesh.edges),len(mesh.polygons),id(self))
+        if (meshkey == obj.tkkey) and (meshkey in cachedata):
+            vert_to_face_map = cachedata[meshkey]
+        else:
+            vert_to_face_map = {i:set() for i in range(meshkey[0])}
+            for f in mesh.polygons:
+                for v in f.vertices:
+                    vert_to_face_map[v].add(f.index)
+            obj.tkkey = meshkey
+        sel = set()
+        uns = set()
+        F = {i:set() for i in range(meshkey[2])}
+        for f in range(meshkey[2]):
+            for v in mesh.polygons[f].vertices:
+                for n in filter(lambda _: mesh.polygons[_].select and (_ != f),vert_to_face_map[v]):
+                    F[f].add(n)
+        for f in F:
+            if len(F[f]) == 3:
+                sel.add(f)
+            elif len(F[f]) != 2:
+                uns.add(f)
+        for f in range(meshkey[2]):
+            if f in sel:
+                mesh.polygons[f].select = True
+            if f in uns:
+                mesh.polygons[f].select = False
+        cachedata[meshkey] = vert_to_face_map
+        bpy.ops.object.mode_set(mode="EDIT")
+        return {"FINISHED"}
+
+        
+
+def ffmenuitem(self,context):
+    self.layout.operator(MESH_OT_fneighbors_shared_e.bl_idname)
+    self.layout.operator(MESH_OT_fneighbors_shared_v_note.bl_idname)
+    self.layout.operator(MESH_OT_conway.bl_idname)
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.VIEW3D_MT_edit_mesh_vertices.append(vvmenuitem)
+    bpy.types.VIEW3D_MT_edit_mesh_edges.append(eemenuitem)
+    bpy.types.VIEW3D_MT_edit_mesh_faces.append(ffmenuitem)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.VIEW3D_MT_edit_mesh_vertices.remove(vvmenuitem)
+    bpy.types.VIEW3D_MT_edit_mesh_edges.remove(eemenuitem)
+    bpy.types.VIEW3D_MT_edit_mesh_faces.remove(ffmenuitem)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/mesh_show_vgroup_weights.py b/release/scripts/addons_contrib/mesh_show_vgroup_weights.py
index 191fedb..5e2fff7 100644
--- a/release/scripts/addons_contrib/mesh_show_vgroup_weights.py
+++ b/release/scripts/addons_contrib/mesh_show_vgroup_weights.py
@@ -270,7 +270,7 @@ class RemoveFromVertexGroup(bpy.types.Operator):
         # Save current selection
         selected_verts = []
         for v in bm.verts:
-            if v.select == True:
+            if v.select is True:
                 selected_verts.append(v.index)
                 if v.index != self.vert_and_group[0]:
                     v.select = False
@@ -327,7 +327,7 @@ class AddToVertexGroup(bpy.types.Operator):
         # Save current selection
         selected_verts = []
         for v in bm.verts:
-            if v.select == True:
+            if v.select is True:
                 selected_verts.append(v.index)
                 if v.index != self.vertex:
                     v.select = False
diff --git a/release/scripts/addons_contrib/object_creaprim.py b/release/scripts/addons_contrib/object_creaprim.py
index 7bbec81..ab58bc3 100644
--- a/release/scripts/addons_contrib/object_creaprim.py
+++ b/release/scripts/addons_contrib/object_creaprim.py
@@ -183,7 +183,7 @@ def panel_func(self, context):
 	scn = bpy.context.scene
 		
 	self.layout.label(text="CreaPrim:")
-	self.layout.operator("object.creaprim", text="Create primitive")
+	self.layout.operator("object.creaprim", text="Create primitive", icon = 'PLUGIN')
 	self.layout.prop(scn, "Name")
 	self.layout.prop(scn, "Apply")
 
diff --git a/release/scripts/addons_contrib/object_render_wire.py b/release/scripts/addons_contrib/object_render_wire.py
index 76ba671..ea5c5d9 100644
--- a/release/scripts/addons_contrib/object_render_wire.py
+++ b/release/scripts/addons_contrib/object_render_wire.py
@@ -214,7 +214,7 @@ def create_wired_mesh(me2, me, thick):
     me2.tessfaces.foreach_set("vertices_raw", cfaces)
     me2.update(calc_edges=True)
 
-# panel containing tools
+# Add built in wireframe
 def wire_add(mallas):
     if mallas:
         bpy.ops.object.select_all(action='DESELECT')
@@ -225,19 +225,15 @@ def wire_add(mallas):
         for mod in obj.modifiers: obj.modifiers.remove(mod)
         bpy.ops.object.join()
         bpy.ops.object.mode_set(mode='EDIT')
-        bpy.ops.mesh.select_all(action='SELECT')
-        bpy.ops.mesh.delete(type='ONLY_FACE')
+        bpy.ops.mesh.wireframe(thickness=0.005)
         bpy.ops.object.mode_set()
-        bpy.ops.object.convert(target='CURVE')
+        for mat in obj.material_slots: bpy.ops.object.material_slot_remove()
         if 'wire_object' in sce.objects.keys():
             sce.objects.get('wire_object').data = obj.data
             sce.objects.get('wire_object').matrix_world = mallas[0].matrix_world
             sce.objects.unlink(obj)
         else:
             obj.name = 'wire_object'
-        obj.data.resolution_u = 1
-        obj.data.bevel_depth = 0.005
-        obj.data.fill_mode = 'FULL'
         obj.data.materials.append(bpy.data.materials.get('mat_wireobj'))
 
     return{'FINISHED'}
@@ -302,13 +298,13 @@ class SolidifyWireframe(bpy.types.Operator):
 		
 class WireMaterials(bpy.types.Operator):
     bl_idname = 'scene.wire_render'
-    bl_label = 'Create Materials'
+    bl_label = 'Apply Materials'
     bl_description = 'Set Up Materials for a Wire Render'
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
         wm = bpy.context.window_manager
-        scn = bpy.context.scene
+        sce = bpy.context.scene
 
         if 'mat_clay' not in bpy.data.materials:
             mat = bpy.data.materials.new('mat_clay')
@@ -322,7 +318,7 @@ class WireMaterials(bpy.types.Operator):
             mat.specular_intensity = 0
             mat.use_transparency = True
             mat.type = 'WIRE'
-            mat.offset_z = 0.1
+            mat.offset_z = 0.05
         else: mat = bpy.data.materials.get('mat_wire')
         mat.diffuse_color = wm.col_wire
         mat.use_shadeless = wm.shadeless_mat
@@ -331,12 +327,12 @@ class WireMaterials(bpy.types.Operator):
         except: pass
 
         if wm.selected_meshes: objetos = bpy.context.selected_objects
-        else: objetos = bpy.data.objects
+        else: objetos = sce.objects
 
-        mallas = [o for o in objetos if o.type == 'MESH' and o.is_visible(scn)]
+        mallas = [o for o in objetos if o.type == 'MESH' and o.is_visible(sce) and o.name != 'wire_object']
 
         for obj in mallas:
-            scn.objects.active = obj
+            sce.objects.active = obj
             print ('procesando >', obj.name)
             obj.show_wire = wm.wire_view
             for mat in obj.material_slots:
@@ -392,7 +388,7 @@ bpy.types.WindowManager.shadeless_mat = bpy.props.BoolProperty(name='Shadeless',
 bpy.types.WindowManager.col_clay = bpy.props.FloatVectorProperty(name='', description='Clay Color', default=(1.0, 0.9, 0.8), min=0, max=1, step=1, precision=3, subtype='COLOR_GAMMA', size=3)
 bpy.types.WindowManager.col_wire = bpy.props.FloatVectorProperty(name='', description='Wire Color', default=(0.1 ,0.0 ,0.0), min=0, max=1, step=1, precision=3, subtype='COLOR_GAMMA', size=3)
 bpy.types.WindowManager.wire_view = bpy.props.BoolProperty(name='Viewport Wires', default=False, description='Overlay wires display over solid in Viewports')
-bpy.types.WindowManager.wire_object = bpy.props.BoolProperty(name='Create Curve Object', default=False, description='Very slow! - Add a Wire Object to scene to be able to render wires in Cycles')
+bpy.types.WindowManager.wire_object = bpy.props.BoolProperty(name='Create Mesh Object', default=False, description='Add a Wire Object to scene to be able to render wires in Cycles')
 bpy.types.Scene.swThickness = bpy.props.FloatProperty(name="Thickness", description="Thickness of the skinned edges", default=0.01)
 bpy.types.Scene.swSelectNew = bpy.props.BoolProperty(name="Select wire", description="If checked, the wire object will be selected after creation", default=True)
 
diff --git a/release/scripts/addons_contrib/online_mat_lib/__init__.py b/release/scripts/addons_contrib/online_mat_lib/__init__.py
new file mode 100644
index 0000000..3b80a10
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/__init__.py
@@ -0,0 +1,3746 @@
+#  ***** BEGIN GPL LICENSE BLOCK *****
+#
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program.  If not, see http://www.gnu.org/licenses/
+#  or write to the Free Software Foundation, Inc., 51 Franklin Street,
+#  Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#  The Original Code is Copyright (C) 2012 by Peter Cassetta    ###
+#  All rights reserved.
+#
+#  Contact:                        matlib at peter.cassetta.info   ###
+#  Information:  http://peter.cassetta.info/material-library/   ###
+#
+#  The Original Code is: all of this file.
+#
+#  Contributor(s): Peter Cassetta.
+#
+#  ***** END GPL LICENSE BLOCK *****
+
+bl_info = {
+    "name": "Online Material Library",
+    "author": "Peter Cassetta",
+    "version": (0, 5),
+    "blender": (2, 6, 3),
+    "location": "Properties > Material > Online Material Library",
+    "description": "Browse and download materials from online CC0 libraries.",
+    "warning": "Beta version",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Material/Online_Material_Library",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=31802",
+    "category": "Material"}
+
+import bpy
+from bpy_extras.io_utils import ExportHelper
+import os.path
+import http.client
+import xml.dom.minidom
+
+library = ""
+#editions = [("Release0", "Release", "(recommended) Stable; gets updated with high-quality materials every one or two months."),
+#            ("Testing1", "Testing", "(online only) Volatile; gets updated with new materials continually."),
+#            ("Bundled2", "Bundled", "(offline only) Contains a small amount of materials bundled with this add-on.")]
+#bpy.types.Scene.mat_lib_edition = bpy.props.EnumProperty(name = "Library Edition", items = editions, description = "Choose an edition", options = {'SKIP_SAVE'})
+
+library_data = []
+update_data = ["Up-to-date.", ""]
+
+library_enum_items = [("peter.cassetta.info/material-library/release/", "Peter's Library - Release", "Stable library hosted on peter.cassetta.info (Default)"),
+                      ("peter.cassetta.info/material-library/testing/", "Peter's Library - Testing", "Continually updated library hosted on peter.cassetta.info (Online only)"),
+                      ("bundled", "Bundled Library", "The library bundled with this add-on (Offline only)")]
+bpy.types.Scene.mat_lib_library = bpy.props.EnumProperty(name = "Select library:", items = library_enum_items, description = "Choose a library", options = {'SKIP_SAVE'})
+
+working_mode = "none"
+mat_lib_host = ""
+mat_lib_location = ""
+mat_lib_cached_files = -1
+if os.path.exists(bpy.utils.user_resource('SCRIPTS', path="addons" + os.sep + "online_mat_lib" + os.sep + "material-library")):
+    mat_lib_folder = bpy.utils.user_resource('SCRIPTS', path="addons" + os.sep + "online_mat_lib" + os.sep + "material-library")
+elif os.path.exists(bpy.utils.script_paths()[0] + os.sep + "addons" + os.sep + "online_mat_lib" + os.sep + "material-library"):
+    mat_lib_folder = bpy.utils.script_paths()[0] + os.sep + "addons" + os.sep + "online_mat_lib" + os.sep + "material-library"
+elif bpy.utils.script_paths()[0] + os.sep + "addons_contrib" + os.sep + "online_mat_lib" + os.sep + "material-library":
+    mat_lib_folder = bpy.utils.script_paths()[0] + os.sep + "addons_contrib" + os.sep + "online_mat_lib" + os.sep + "material-library"
+else:
+    print("ONLINE MATERIAL LIBRARY -- MAJOR PROBLEM:"\
+    "COULD NOT LOCATE ADD-ON INSTALLATION PATH.")
+    mat_lib_folder = "error"
+
+mat_lib_contents = "Please refresh."
+mat_lib_category_filenames = []
+mat_lib_category_types = []
+mat_lib_category_names = []
+mat_lib_categories = 0
+
+category_contents = "None"
+category_name = ""
+category_filename = ""
+category_materials = 0
+
+category_type = "none"
+
+sub_category_contents = "None"
+sub_category_name = ""
+sub_category_filename = ""
+sub_category_categories = 0
+sub_category_names = []
+sub_category_filenames = []
+
+material_names = []
+material_filenames = []
+material_contributors = []
+material_ratings = []
+material_fireflies = []
+material_speeds = []
+material_complexities = []
+material_scripts = []
+material_images = []
+
+material_file_contents = ""
+
+current_material_number = -1
+current_material_cached = False
+current_material_previewed = False
+material_detail_view = "RENDER"
+preview_message = []
+node_message = []
+save_filename = ""
+script_stack = []
+osl_scripts = []
+
+bpy.types.Scene.mat_lib_auto_preview = bpy.props.BoolProperty(name = "Auto-download previews", description = "Automatically download material previews in online mode", default = True, options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_show_osl_materials = bpy.props.BoolProperty(name = "Show OSL materials", description = "Enable to show materials with OSL shading scripts", default = False, options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_show_textured_materials = bpy.props.BoolProperty(name = "Show textured materials", description = "Enable to show materials with image textures", default = True, options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_osl_only_trusted = bpy.props.BoolProperty(name = "Use OSL scripts from trusted sources only", description = "Disable to allow downloading OSL scripts from anywhere on the web (Not recommended)", default = True, options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_images_only_trusted = bpy.props.BoolProperty(name = "Use image textures from trusted sources only", description = "Disable to allow downloading image textures from anywhere on the web (Not recommended)", default = True, options = {'SKIP_SAVE'})
+
+bpy.types.Scene.mat_lib_bcm_write = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to write .bcm data to", default="bcm_file", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcm_read = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to read .bcm data from", default="bcm_file", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcm_name = bpy.props.StringProperty(name = "Material Name", description = "Specify a name for the new material", default="Untitled", options = {'SKIP_SAVE'})
+
+bpy.types.Scene.mat_lib_bcm_save_location = bpy.props.StringProperty(name = "Save location", description = "Directory to save .bcm files in", default=mat_lib_folder + os.sep + "my-materials" + os.sep, options = {'SKIP_SAVE'}, subtype="DIR_PATH")
+bpy.types.Scene.mat_lib_bcm_open_location = bpy.props.StringProperty(name = "Open location", description = "Location of .bcm file to open", default=mat_lib_folder + os.sep + "my-materials" + os.sep + "untitled.bcm", options = {'SKIP_SAVE'})
+
+category_enum_items = [("None0", "None", "No category selected")]
+bpy.types.Scene.mat_lib_material_category = bpy.props.EnumProperty(name = "", items = category_enum_items, description = "Choose a category", options = {'SKIP_SAVE'})
+prev_category = "None0"
+
+subcategory_enum_items = [("None0", "None", "No Subcategory Selected")]
+bpy.types.Scene.mat_lib_material_subcategory = bpy.props.EnumProperty(name = "", items = subcategory_enum_items, description = "Choose a subcategory", options = {'SKIP_SAVE'})
+
+class OnlineMaterialLibraryPanel(bpy.types.Panel):
+    """Creates a Panel in the Object properties window"""
+    bl_label = "Online Material Library"
+    bl_idname = "OnlineMaterialLibraryPanel"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "material"
+    
+    def draw(self, context):
+        global show_success_message
+        global show_success_message_timeout
+        global current_material_number
+        global mat_lib_contents
+        global prev_category
+        global save_filename
+        
+        layout = self.layout
+        
+        if context.scene.render.engine == "CYCLES":
+            #Cycles is enabled!
+            row = layout.row()
+            
+            if category_type is not "info" and category_type is not "settings" and category_type is not "tools":
+                if mat_lib_contents == "" or mat_lib_contents == "Please refresh.":
+                    if mat_lib_folder == "error":
+                        row.label(text="ERROR: Could not find installation path!", icon='ERROR')
+                    else:
+                        #Material Library Contents variable is empty -- show welcome message
+                        row.label(text="Online Material Library Add-on -- Version 0.5", icon='SMOOTH')
+                        
+                        row = layout.row()
+                        rowcol = row.column(align=True)
+                        rowcol.alignment = 'EXPAND'
+                        rowcol.prop(context.scene, "mat_lib_library", text="")
+                        
+                        rowcolrow = rowcol.row(align=True)
+                        rowcolrow.alignment = 'EXPAND'
+                        if "bundled" not in context.scene.mat_lib_library:
+                            rowcolrow.operator("material.libraryconnect", text="Connect", icon='WORLD').mode = "online"
+                        if "testing" not in context.scene.mat_lib_library:
+                            rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
+                    
+                elif working_mode is not "none":
+                    #We have a valid material library
+                    row = layout.row(align=True)
+                    row.alignment = 'EXPAND'
+                    row.prop(bpy.context.scene, "mat_lib_material_category")
+                else:
+                    #Could not retrive a valid material library
+                    row.label(text="Could not retrieve material library.", icon='CANCEL')
+                    row = layout.row()
+                    row.label(text=str(mat_lib_contents))
+                    row = layout.row()
+                    row.label(text="..." + str(mat_lib_contents)[-50:])
+                    
+                    row = layout.row()
+                    rowcol = row.column(align=True)
+                    rowcol.alignment = 'EXPAND'
+                    rowcol.prop(context.scene, "mat_lib_library", text="")
+                    
+                    rowcolrow = rowcol.row(align=True)
+                    rowcolrow.alignment = 'EXPAND'
+                    if "bundled" not in context.scene.mat_lib_library:
+                        rowcolrow.operator("material.libraryconnect", text="Attempt Reconnect", icon='WORLD').mode = "online"
+                    if "testing" not in context.scene.mat_lib_library:
+                        rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
+            
+            #Here we check if the user has changed the category, if so, update.
+            if prev_category != bpy.context.scene.mat_lib_material_category:
+                prev_category = bpy.context.scene.mat_lib_material_category
+                libraryCategoryUpdate()
+            
+            if category_type == "none":
+                #Not browsing category
+                if working_mode is not "none":
+                    row = layout.row()
+                    rowcol = row.column(align=True)
+                    rowcol.alignment = 'EXPAND'
+                    rowcol.prop(context.scene, "mat_lib_library", text="")
+                    
+                    rowcolrow = rowcol.row(align=True)
+                    rowcolrow.alignment = 'EXPAND'
+                    if "bundled" not in context.scene.mat_lib_library:
+                        if working_mode == "online":
+                            rowcolrow.operator("material.libraryconnect", text="Reconnect", icon='WORLD').mode = "online"
+                        else:
+                            rowcolrow.operator("material.libraryconnect", text="Connect", icon='WORLD').mode = "online"
+                    if "testing" not in context.scene.mat_lib_library:
+                        if working_mode == "offline":
+                            rowcolrow.operator("material.libraryconnect", text="Reload Library", icon='DISK_DRIVE').mode = "offline"
+                        else:
+                            rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
+                
+                row = layout.row(align=True)
+                row.alignment = 'EXPAND'
+                row.operator("material.libraryinfo", text="Info", icon='INFO')
+                row.operator("material.librarytools", text="Tools", icon='MODIFIER')
+                row.operator("material.librarysettings", text="Settings", icon='SETTINGS')
+                
+                if "Up-to-date." not in update_data[0]:
+                    row = layout.row()
+                    row.label(text=update_data[0])
+                    row.operator("wm.url_open", text="Get latest version", icon='WORLD').url = update_data[1]
+                    
+            elif category_type == "info":
+                row.label(text="Add-on Info", icon='INFO')
+                row.operator("material.libraryhome", text="", icon='LOOP_BACK')
+                
+                row = layout.row()
+                row.operator("wm.url_open", text="All materials are CC0 - learn more.", emboss=False).url = "http://creativecommons.org/publicdomain/zero/1.0/"
+                
+                row = layout.row()
+                row.operator("wm.url_open", text="Material previews generated with B.M.P.S.", emboss=False).url = "https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/rendering/cycles/bmps.blend"
+                row = layout.row()
+                row.operator("wm.url_open", text="B.M.P.S. created by Robin \"tuqueque\" Marín", emboss=False).url = "http://blenderartists.org/forum/showthread.php?151903-b.m.p.s.-1.5!"
+            
+            elif category_type == "settings":
+                row.label(text="Library Settings", icon='SETTINGS')
+                row.operator("material.libraryhome", text="", icon='LOOP_BACK')
+                
+                row = layout.row()
+                row.prop(bpy.context.scene, "mat_lib_auto_preview")
+                row = layout.row()
+                row.prop(bpy.context.scene, "mat_lib_osl_only_trusted")
+                row = layout.row()
+                row.prop(bpy.context.scene, "mat_lib_images_only_trusted")
+                
+                row = layout.row()
+                row.label(text="Cached data for active library:")
+                
+                row = layout.row()
+                if mat_lib_cached_files == 0:
+                    row.label(text="No cached files.")
+                elif mat_lib_cached_files == 1:
+                    row.label(text=str(mat_lib_cached_files) + " cached file.")
+                    row.operator("material.libraryclearcache", text="Clear Cache", icon='CANCEL')
+                elif mat_lib_cached_files != -1:
+                    row.label(text=str(mat_lib_cached_files) + " cached files.")
+                    row.operator("material.libraryclearcache", text="Clear Cache", icon='CANCEL')
+                else:
+                    row.label(text="Please select a library first.", icon="ERROR")
+            
+            elif category_type == "tools":
+                row.label(text="Material Tools", icon='MODIFIER')
+                row.operator("material.libraryhome", text="", icon='LOOP_BACK')
+                
+                row = layout.row()
+                row.label(text="Write material data to text as .bcm:")
+                
+                row = layout.row(align=True)
+                row.alignment = 'EXPAND'
+                row.prop(bpy.context.scene, "mat_lib_bcm_write", text="", icon="TEXT")
+                row.operator("material.libraryconvert", text="Write to text", icon='MATERIAL_DATA')
+                
+                row = layout.row()
+                row.label(text="Save material(s) as .bcm files:")
+                
+                row = layout.row()
+                col = row.column(align=True)
+                col.alignment = 'EXPAND'
+                colrow = col.row()
+                colrow.prop(context.scene, "mat_lib_bcm_save_location", text="")
+                colrow = col.row(align=True)
+                colrow.alignment = 'EXPAND'
+                colrow.operator("material.libraryconvert", text="Save active", icon='DISK_DRIVE').save_location = context.scene.mat_lib_bcm_save_location
+                save_button = colrow.operator("material.libraryconvert", text="Save all materials", icon='DISK_DRIVE')
+                save_button.save_location = context.scene.mat_lib_bcm_save_location
+                save_button.all_materials = True
+                
+                row = layout.row()
+                row.label(text="Open a local .bcm file:")
+                 
+                row = layout.row()
+                col = row.column(align=True)
+                col.alignment = 'EXPAND'
+                colrow = col.row()
+                colrow.prop(context.scene, "mat_lib_bcm_open_location", text="")
+                colrow.operator("buttons.file_browse", text="", icon='FILESEL').relative_path = False
+                colrow = col.row(align=True)
+                colrow.alignment = 'EXPAND'
+                colrow.operator("material.libraryadd", text="Add to materials", icon='ZOOMIN').open_location = context.scene.mat_lib_bcm_open_location
+                colrow.operator("material.libraryapply", text="Apply to active", icon='PASTEDOWN').open_location = context.scene.mat_lib_bcm_open_location
+                
+                row = layout.row()
+                row.label(text="Read .bcm data in a text block to a material:")
+                 
+                row = layout.row()
+                col = row.column(align=True)
+                col.alignment = 'EXPAND'
+                colrow = col.row()
+                colrow.prop(context.scene, "mat_lib_bcm_read", text="", icon='TEXT')
+                colrow = col.row()
+                colrow.prop(context.scene, "mat_lib_bcm_name", text="", icon='MATERIAL')
+                colrow = col.row(align=True)
+                colrow.alignment = 'EXPAND'
+                colrow.operator("material.libraryadd", text="Add to materials", icon='ZOOMIN').text_block = context.scene.mat_lib_bcm_read
+                colrow.operator("material.libraryapply", text="Apply to active", icon='PASTEDOWN').text_block = context.scene.mat_lib_bcm_read
+                
+            elif category_type == "category":
+                #Browsing category - show materials
+                row = layout.row()
+                matwrap = row.box()
+                i = 0
+                while i < category_materials:
+                    if i == current_material_number:
+                        matwraprow = matwrap.row()
+                        matwrapbox = matwraprow.box()
+                        matwrapboxrow = matwrapbox.row()
+                        matwrapboxrow.operator("material.libraryviewmaterial", text=material_names[i], icon='MATERIAL', emboss=False).material = i
+                        matwrapboxrowcol = matwrapboxrow.column()
+                        matwrapboxrowcolrow = matwrapboxrowcol.row()
+                        matwrapboxrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapboxrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapboxrowcol = matwrapboxrow.column()
+                        matwrapboxrowcolrow = matwrapboxrowcol.row()
+                        matwrapboxrowcolrowsplit = matwrapboxrowcolrow.split(percentage=0.8)
+                        matwrapboxrowcolrowsplitrow = matwrapboxrowcolrowsplit.row()
+                        
+                        #Ratings
+                        if material_ratings[i] == 0:
+                            matwrapboxrowcolrowsplitrow.operator("material.libraryviewmaterial", text="Unrated", emboss=False).material = i
+                        else:
+                            e = 0
+                            while e < material_ratings[i]:
+                                matwrapboxrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_ON', emboss=False).material = i
+                                e = e + 1
+                            
+                            if material_ratings[i] is not 5:    
+                                e = 0
+                                while e < (5 - material_ratings[i]):
+                                    matwrapboxrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_OFF', emboss=False).material = i
+                                    e = e + 1
+                    else:
+                        matwraprow = matwrap.row()
+                        matwrapcol = matwraprow.column()
+                        matwrapcolrow = matwrapcol.row()
+                        matwrapcolrow.operator("material.libraryviewmaterial", text=material_names[i], icon='MATERIAL', emboss=False).material = i
+                        matwrapcolrowcol = matwrapcolrow.column()
+                        matwrapcolrowcolrow = matwrapcolrowcol.row()
+                        matwrapcolrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapcolrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapcolrowcol = matwrapcolrow.column()
+                        matwrapcolrowcolrow = matwrapcolrowcol.row()
+                        matwrapcolrowcolrowsplit = matwrapcolrowcolrow.split(percentage=0.8)
+                        matwrapcolrowcolrowsplitrow = matwrapcolrowcolrowsplit.row()
+                        
+                        #Ratings
+                        if material_ratings[i] == 0:
+                            matwrapcolrowcolrowsplitrow.operator("material.libraryviewmaterial", text="Unrated", emboss=False).material = i
+                        else:
+                            e = 0
+                            while e < material_ratings[i]:
+                                matwrapcolrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_ON', emboss=False).material = i
+                                e = e + 1
+                            
+                            if material_ratings[i] is not 5:    
+                                e = 0
+                                while e < (5 - material_ratings[i]):
+                                    matwrapcolrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_OFF', emboss=False).material = i
+                                    e = e + 1
+                    i = i + 1
+                
+                if current_material_number is not -1:
+                    #Display selected material's info
+                    row = layout.row()
+                    infobox = row.box()
+                    inforow = infobox.row()
+                    
+                    #Material name
+                    inforow.label(text=(material_names[current_material_number]))
+                    
+                    #Preview download button
+                    if current_material_previewed == False:
+                        preview_button = inforow.operator("material.librarypreview", text="", icon='COLOR', emboss=False)
+                        preview_button.name = material_names[current_material_number]
+                        preview_button.filename = material_filenames[current_material_number]
+                    
+                    if library == "release":
+                        #Cache indicator/button
+                        if current_material_cached:
+                            inforow.label(text="", icon="SAVE_COPY")
+                        else:
+                            inforow.operator("material.librarycache", text="", icon="LONGDISPLAY", emboss=False).filename = material_filenames[current_material_number]
+                    
+                    #Close button
+                    inforow.operator("material.libraryviewmaterial", text="", icon='PANEL_CLOSE').material = -1
+                    
+                    #inforow = infobox.row()
+                    inforowsplit = infobox.split(percentage=0.5)
+                    
+                    #Display a preview
+                    if bpy.data.textures.find("mat_lib_preview_texture") == -1:
+                        bpy.data.textures.new("mat_lib_preview_texture", "IMAGE")
+                        preview_texture = bpy.data.textures["mat_lib_preview_texture"]
+                        inforowcol = inforowsplit.column()
+                        
+                        if material_contributors[current_material_number] != "Unknown" and material_contributors[current_material_number] != "Anonymous":
+                            inforowcolrow = inforowcol.row()
+                            inforowcolrow.label(text="By %s." % material_contributors[current_material_number])
+                        else:
+                            inforowcolrow = inforowcol.row()
+                            inforowcolrow.label(text="Author unknown.")
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.template_preview(preview_texture)
+                    else:
+                        preview_texture = bpy.data.textures['mat_lib_preview_texture']
+                        inforowcol = inforowsplit.column()
+                        if material_contributors[current_material_number] != "Unknown" and material_contributors[current_material_number] != "Anonymous":
+                            inforowcolrow = inforowcol.row()
+                            inforowcolrow.label(text="By %s." % material_contributors[current_material_number])
+                        else:
+                            inforowcolrow = inforowcol.row()
+                            inforowcolrow.label(text="Author unknown.")
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.template_preview(preview_texture)
+                    
+                    inforowcol = inforowsplit.column()
+                    inforowcolrow = inforowcol.row()
+                    inforowcolcol = inforowcol.column(align=True)
+                    inforowcolcol.alignment = 'EXPAND'
+                    inforowcolcolrow = inforowcolcol.row()
+                    if material_detail_view == 'RENDER':
+                        if material_fireflies[current_material_number] == "high":
+                            inforowcolcolrow.label(text="Firefly Level: High")
+                            inforowcolcolrow.label(text="", icon='PARTICLES')
+                        elif material_fireflies[current_material_number] == "medium":
+                            inforowcolcolrow.label(text="Firefly Level: Medium")
+                            inforowcolcolrow.label(text="", icon='MOD_PARTICLES')
+                        else:
+                            inforowcolcolrow.label(text="Firefly Level: Low")
+                        inforowcolcolrow = inforowcolcol.row()
+                            
+                        if material_complexities[current_material_number] == "simple":
+                            inforowcolcolrow.label(text="Complexity: Simple")
+                        elif material_complexities[current_material_number] == "intermediate":
+                            inforowcolcolrow.label(text="Complexity: Intermediate")
+                        elif material_complexities[current_material_number] == "complex":
+                            inforowcolcolrow.label(text="Complexity: Complex")
+                        inforowcolcolrow = inforowcolcol.row()
+                        
+                        if material_speeds[current_material_number] == "slow":
+                            inforowcolcolrow.label(text="Render Speed: Slow")
+                            inforowcolcolrow.label(text="", icon='PREVIEW_RANGE')
+                        elif material_speeds[current_material_number] == "fair":
+                            inforowcolcolrow.label(text="Render Speed: Fair")
+                            inforowcolcolrow.label(text="", icon='TIME')
+                        else:
+                            inforowcolcolrow.label(text="Render Speed: Good")
+                        inforowcolcolrow = inforowcolcol.row()
+                        details = inforowcolcolrow.row(align=True)
+                        details.alignment = 'RIGHT'
+                        detailshidden = details.row()
+                        detailshidden.enabled = False
+                        detailshidden.operator("material.librarydetailview", text="", icon='PLAY_REVERSE').mode = "PREVIOUS"
+                        details.operator("material.librarydetailview", text="", icon='PLAY').mode = "NEXT"
+                    elif material_detail_view == "DATA":
+                        if material_scripts[current_material_number] == "0":
+                            inforowcolcolrow.label(text="OSL Scripts: 0")
+                        else:
+                            inforowcolcolrow.label(text="OSL Scripts: %s" % material_scripts[current_material_number])
+                            inforowcolcolrow.label(text="", icon='TEXT')
+                        inforowcolcolrow = inforowcolcol.row()
+                    
+                        if material_images[current_material_number] == "0":
+                            inforowcolcolrow.label(text="Images: 0")
+                        else:
+                            inforowcolcolrow.label(text="Images: %s" % material_images[current_material_number])
+                            inforowcolcolrow.label(text="", icon='IMAGE_RGB')
+                            
+                        inforowcolcolrow = inforowcolcol.row()
+                        inforowcolcolrow.label(text=" ")
+                        
+                        inforowcolcolrow = inforowcolcol.row()
+                        details = inforowcolcolrow.row(align=True)
+                        details.alignment = 'RIGHT'
+                        details.operator("material.librarydetailview", text="", icon='PLAY_REVERSE').mode = "PREVIOUS"
+                        detailshidden = details.row()
+                        detailshidden.enabled = False
+                        detailshidden.operator("material.librarydetailview", text="", icon='PLAY').mode = "NEXT"
+                        
+                    inforowcolcolcol = inforowcolcol.column(align=True)
+                    inforowcolcolcol.alignment = 'EXPAND'
+                    functions = inforowcolcolcol.row()
+                    #Display "Add" button
+                    mat_button = functions.operator("material.libraryadd", text="Add to materials", icon='ZOOMIN')
+                    mat_button.mat_name = material_names[current_material_number]
+                    mat_button.filename = material_filenames[current_material_number]
+                    functions = inforowcolcolcol.row()
+                    
+                    #Display "Apply" button
+                    mat_button = functions.operator("material.libraryapply", text="Apply to active", icon='PASTEDOWN')
+                    mat_button.mat_name = material_names[current_material_number]
+                    mat_button.filename = material_filenames[current_material_number]
+                    functions = inforowcolcolcol.row()
+                    
+                    #Display "Save" button
+                    mat_button = functions.operator("material.librarysave", text="Save as...", icon='DISK_DRIVE')
+                    mat_button.filepath = mat_lib_folder + os.sep + "my-materials" + os.sep + material_filenames[current_material_number] + ".bcm"
+                    mat_button.filename = material_filenames[current_material_number]
+                    save_filename = material_filenames[current_material_number]
+                
+            elif category_type == "subcategory":
+                #Browsing subcategory - show materials
+                row = layout.row()
+                matwrap = row.box()
+                i = 0
+                while i < category_materials:
+                    if (i == current_material_number):
+                        matwraprow = matwrap.row()
+                        matwrapbox = matwraprow.box()
+                        matwrapboxrow = matwrapbox.row()
+                        matwrapboxrow.operator("material.libraryviewmaterial", text=material_names[i], icon='MATERIAL', emboss=False).material = i
+                        matwrapboxrowcol = matwrapboxrow.column()
+                        matwrapboxrowcolrow = matwrapboxrowcol.row()
+                        matwrapboxrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapboxrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapboxrowcol = matwrapboxrow.column()
+                        matwrapboxrowcolrow = matwrapboxrowcol.row()
+                        matwrapboxrowcolrowsplit = matwrapboxrowcolrow.split(percentage=0.8)
+                        matwrapboxrowcolrowsplitrow = matwrapboxrowcolrowsplit.row()
+                        
+                        #Ratings
+                        e = 0
+                        while e < material_ratings[i]:
+                            matwrapboxrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_ON', emboss=False).material = i
+                            e = e + 1
+                        
+                        if material_ratings[i] is not 5:    
+                            e = 0
+                            while e < (5 - material_ratings[i]):
+                                matwrapboxrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_OFF', emboss=False).material = i
+                                e = e + 1
+                    else:
+                        matwraprow = matwrap.row()
+                        matwrapcol = matwraprow.column()
+                        matwrapcolrow = matwrapcol.row()
+                        matwrapcolrow.operator("material.libraryviewmaterial", text=material_names[i], icon='MATERIAL', emboss=False).material = i
+                        matwrapcolrowcol = matwrapcolrow.column()
+                        matwrapcolrowcolrow = matwrapcolrowcol.row()
+                        matwrapcolrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapcolrowcolrow.operator("material.libraryviewmaterial", text="", icon='BLANK1', emboss=False).material = i
+                        matwrapcolrowcol = matwrapcolrow.column()
+                        matwrapcolrowcolrow = matwrapcolrowcol.row()
+                        matwrapcolrowcolrowsplit = matwrapcolrowcolrow.split(percentage=0.8)
+                        matwrapcolrowcolrowsplitrow = matwrapcolrowcolrowsplit.row()
+                        
+                        #Ratings
+                        e = 0
+                        while e < material_ratings[i]:
+                            matwrapcolrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_ON', emboss=False).material = i
+                            e = e + 1
+                        
+                        if material_ratings[i] is not 5:    
+                            e = 0
+                            while e < (5 - material_ratings[i]):
+                                matwrapcolrowcolrowsplitrow.operator("material.libraryviewmaterial", text="", icon='SOLO_OFF', emboss=False).material = i
+                                e = e + 1
+                    i = i + 1
+                    
+                if current_material_number is not -1:
+                    #Display selected material's info
+                    row = layout.row()
+                    infobox = row.box()
+                    inforow = infobox.row()
+                   
+                    inforow.label(text=material_names[current_material_number])
+                    if bpy.context.scene.mat_lib_auto_preview == False:
+                        mat_button = inforow.operator("material.librarypreview", text="", icon='IMAGE_COL')
+                        mat_button.name = material_names[current_material_number]
+                        mat_button.filename = material_filenames[current_material_number]
+                    inforow.operator("material.viewmaterial", text="", icon='PANEL_CLOSE').material = -1
+                    
+                    inforow = infobox.row()
+                    
+                    #Display a preview
+                    if bpy.data.textures.find("mat_lib_preview_texture") == -1:
+                        bpy.data.textures.new("mat_lib_preview_texture", "IMAGE")
+                        preview_texture = bpy.data.textures["mat_lib_preview_texture"]
+                        inforowcol = inforow.column(align=True)
+                        inforowcol.alignment = 'EXPAND'
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.operator("material.librarypreview", text="Preview Material", icon='IMAGE_COL')
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.template_preview(preview_texture)
+                    else:
+                        preview_texture = bpy.data.textures['mat_lib_preview_texture']
+                        inforowcol = inforow.column(align=True)
+                        inforowcol.alignment = 'EXPAND'
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.operator("material.librarypreview", text="Preview Material", icon='IMAGE_COL')
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.template_preview(preview_texture)
+                    
+                    inforowcol = inforow.column()
+                    inforowcolrow = inforowcol.row()
+                    if bpy.data.materials.find(material_names[current_material_number]) is not -1:
+                        inforowcolrow.label(text="Material exists", icon='ERROR')
+                    if material_contributors[current_material_number] == "Unknown" or material_contributors[current_material_number] == "Anonymous":
+                        inforowcolrow = inforowcol.row()
+                    else:
+                        inforowcolrow = inforowcol.row()
+                        inforowcolrow.label(text="By %s." % material_contributors[current_material_number])
+                        inforowcolrow = inforowcol.row()
+                    
+                    if bpy.data.materials.find(material_names[current_material_number]) is not -1:
+                        inforowcolrow.label(text="\"Add\" will overwrite.")
+                    inforowcolcol = inforowcol.column(align=True)
+                    inforowcolcol.alignment = 'EXPAND'
+                    
+                    
+                    #Display "Add" or "Overwrite" button
+                    mat_button = inforowcolcol.operator("material.libraryadd", text="Add to materials", icon='ZOOMIN')
+                    mat_button.name = material_names[current_material_number]
+                    mat_button.filename = material_filenames[current_material_number]
+                    
+                    #Display "Paste" button
+                    mat_button = inforowcolcol.operator("material.libraryapply", text="Apply to active", icon='PASTEDOWN')
+                    mat_button.name = bpy.context.object.active_material.name
+                    mat_button.filename = material_filenames[current_material_number]
+                    
+                    #Display "Save" button
+                    mat_button = inforowcolcol.operator("material.librarysave", text="Save to disk", icon='DISK_DRIVE')
+                    mat_button.name = bpy.context.object.active_material.name
+                    mat_button.filename = material_filenames[current_material_number]
+                    save_filename = material_filenames[current_material_number]
+        else:
+            #Dude, you gotta switch to Cycles to use this.
+            row = layout.row()
+            row.label(text="Sorry, Cycles only at the moment.",icon='ERROR')
+
+class libraryCategory:
+    def __init__(self, title, folder):
+        self.title = title
+        self.folder = folder
+        self.materials = []
+
+class libraryMaterial:
+    def __init__(self, name, href, contrib, stars, fireflies, speed, complexity, scripts, images):
+        self.name = name
+        self.href = href
+        self.contrib = contrib
+        self.stars = stars
+        self.fireflies = fireflies
+        self.speed = speed
+        self.complexity = complexity
+        self.scripts = scripts
+        self.images = images
+
+def handleCategories(categories):
+    for index, category in enumerate(categories):
+        handleCategory(category, index)
+
+def handleCategory(category, index):
+    if 'addon' in category.attributes:
+        needed_version = float(category.attributes['addon'].value)
+        this_version = bl_info["version"][0] + (bl_info["version"][1] / 10.0)
+        
+        #Check this addon's compatibility with this category
+        if needed_version > this_version:
+            print('\n\n-Category "' + category.attributes['title'].value + '" not used; its materials are for a newer version of this add-on.')
+            return
+    
+    if 'bl' in category.attributes:
+        bl_version = bpy.app.version[0] + (bpy.app.version[1] / 100)
+        
+        #Check Blender's compatibility with this category
+        if category.attributes['bl'].value[-1] == "-":
+            #This option is for if Blender's compatiblity
+            #with a category started only with a specific
+            #version, but has not yet ended; this will
+            #look like the following: bl="2.64-"
+            bl_lower = float(category.attributes['bl'].value[:-1])
+            if bl_lower > bl_version:
+                print('\n\n-Category "' + category.attributes['title'].value + '" was not used; its materials are not compatible with this version of Blender.')
+                return
+            
+        elif category.attributes['bl'].value[0] == "-":
+            #This option is for if Blender's compatiblity
+            #with a category ended at some point, and will
+            #look like the following: bl="-2.73"
+            bl_upper = float(category.attributes['bl'].value[1:])
+            if bl_upper < bl_version:
+                print('\n\n-Category "' + category.attributes['title'].value + '" was not used; its materials are not compatible with this version of Blender.')
+                return
+            
+        else:
+            #This option is for if Blender's compatiblity
+            #with a category started with a certain version,
+            #then ended with another; it will look
+            #like the following: bl="2.64-2.73"
+            bl_lower = float(category.attributes['bl'].value.split('-')[0])
+            bl_upper = float(category.attributes['bl'].value.split('-')[1])
+            if bl_upper < bl_version:
+                print('\n\n-Category "' + category.attributes['title'].value + '" was not used; its materials are not compatible with this version of Blender.')
+                return
+            elif bl_lower > bl_version:
+                print('\n\n-Category "' + category.attributes['title'].value + '" was not used; its materials are not compatible with this version of Blender.')
+                return
+    
+    if library is not "bundled":
+        if not os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value):
+            print("Folder \"/" + category.attributes['folder'].value + "/\" does not exist; creating now.")
+            if library == "composite":
+                os.mkdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category.attributes['folder'].value)
+            else:
+                os.mkdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value)
+        
+        if 'remove' in category.attributes:
+            if library == "composite":
+                if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category.attributes['folder'].value):
+                    for the_file in os.listdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category.attributes['folder'].value):
+                        file_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category.attributes['folder'].value + os.sep + the_file
+                        if os.path.isfile(file_path):
+                            os.remove(file_path)
+                        elif os.path.isdir(file_path):
+                            for sub_file in os.listdir(file_path):
+                                if os.path.isfile(file_path + sub_file):
+                                    os.remove(file_path + sub_file)
+                            os.rmdir(file_path)
+                    os.rmdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category.attributes['folder'].value)
+            else:
+                if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value):
+                    for the_file in os.listdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value):
+                        file_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value + os.sep + the_file
+                        if os.path.isfile(file_path):
+                            os.remove(file_path)
+                        elif os.path.isdir(file_path):
+                            for sub_file in os.listdir(file_path):
+                                if os.path.isfile(file_path + sub_file):
+                                    os.remove(file_path + sub_file)
+                            os.rmdir(file_path)
+                    os.rmdir(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category.attributes['folder'].value)
+                return
+    
+    print ('\n\n-Category "' + category.attributes['title'].value + '"; located in folder "/' + category.attributes['folder'].value + '/".')
+    library_data.append(libraryCategory(category.attributes['title'].value, category.attributes['folder'].value))
+    handleMaterials(category.getElementsByTagName("material"), index)
+
+def handleMaterials(materials, index):
+    for material in materials:
+        handleMaterial(material, index)
+
+def handleMaterial(material, index):
+    if 'addon' in material.attributes:
+        needed_version = float(material.attributes['addon'].value)
+        this_version = bl_info["version"][0] + (bl_info["version"][1] / 10.0)
+        
+        #Check this addon's compatibility with this material
+        if needed_version > this_version:
+            print('\n  -Material "' + material.attributes['name'].value + '" was not used, and is for a newer version of this add-on.')
+            return
+    
+    if 'bl' in material.attributes:
+        bl_version = bpy.app.version[0] + (bpy.app.version[1] / 100)
+        
+        #Check Blender's compatibility with this material
+        if material.attributes['bl'].value[-1] == "-":
+            #This option is for if Blender's compatiblity
+            #with a material started only with a specific
+            #version, but has not yet ended; this will
+            #look like the following: bl="2.64-"
+            bl_lower = float(material.attributes['bl'].value[:-1])
+            if bl_lower > bl_version:
+                print('\n  -Material "' + material.attributes['name'].value + '" was not used, and is not compatible with this version of Blender.')
+                return
+            
+        elif material.attributes['bl'].value[0] == "-":
+            #This option is for if Blender's compatiblity
+            #with a material ended at some point, and will
+            #look like the following: bl="-2.73"
+            bl_upper = float(material.attributes['bl'].value[1:])
+            if bl_upper < bl_version:
+                print('\n  -Material "' + material.attributes['name'].value + '" was not used, and is not compatible with this version of Blender.')
+                return
+            
+        else:
+            #This option is for if Blender's compatiblity
+            #with a material started with a certain version,
+            #then ended with another; it will
+            #look like the following: bl="2.64-2.73"
+            bl_lower = float(material.attributes['bl'].value.split('-')[0])
+            bl_upper = float(material.attributes['bl'].value.split('-')[1])
+            if bl_upper < bl_version:
+                print('\n  -Material "' + material.attributes['name'].value + '" was not used, and is not compatible with this version of Blender.')
+                return
+            elif bl_lower > bl_version:
+                print('\n  -Material "' + material.attributes['name'].value + '" was not used, and is not compatible with this version of Blender.')
+                return
+    
+    if 'by' in material.attributes:
+        contributor = material.attributes['by'].value
+    else:
+        contributor = "Unknown"
+    
+    if 'stars' in material.attributes:
+        stars = material.attributes['stars'].value
+    else:
+        stars = '0'
+    
+    if 'fireflies' in material.attributes:
+        fireflies = material.attributes['fireflies'].value
+    else:
+        fireflies = 'low'
+    
+    if 'speed' in material.attributes:
+        speed = material.attributes['speed'].value
+    else:
+        speed = 'good'
+    
+    if 'complexity' in material.attributes:
+        complexity = material.attributes['complexity'].value
+    else:
+        complexity = 'simple'
+    
+    if 'scripts' in material.attributes:
+        scripts = material.attributes['scripts'].value
+    else:
+        scripts = '0'
+    
+    if 'images' in material.attributes:
+        images = material.attributes['images'].value
+    else:
+        images = '0'
+    
+    library_data[index].materials.append(
+        libraryMaterial(
+        material.attributes['name'].value,
+        material.attributes['href'].value,
+        contributor,
+        int(stars),
+        fireflies,
+        speed,
+        complexity,
+        scripts,
+        images))
+    print ('\n  -Material "' + 
+        material.attributes['name'].value + 
+        '"\n    -Filename: "' + 
+        material.attributes['href'].value + 
+        '.bcm"\n    -Rating: ' + stars + 
+        ' stars\n    -Contributed by "' + 
+        contributor + '"')
+
+class LibraryConnect(bpy.types.Operator):
+    '''Connect to the material library'''
+    bl_idname = "material.libraryconnect"
+    bl_label = "Connect to the material library"
+    mode = bpy.props.StringProperty()
+
+    def execute(self, context):
+        global library_data
+        global library
+        global update_data
+        
+        global mat_lib_contents
+        global mat_lib_categories
+        global mat_lib_category_names
+        global mat_lib_category_types
+        global mat_lib_category_filenames
+        
+        global category_enum_items
+        global subcategory_enum_items
+        
+        global show_success_message
+        global show_success_message_timeout
+        
+        global prev_category
+        global mat_lib_host
+        global mat_lib_location
+        global working_mode
+        
+        if self.mode == "online":
+            mat_lib_host = context.scene.mat_lib_library[:context.scene.mat_lib_library.index("/")]
+            mat_lib_location = context.scene.mat_lib_library[(context.scene.mat_lib_library.index(mat_lib_host) + len(mat_lib_host)):]
+            print(mat_lib_host)
+            print(mat_lib_location)
+        elif "bundled" not in context.scene.mat_lib_library:
+            mat_lib_host = context.scene.mat_lib_library[:context.scene.mat_lib_library.index("/")]
+        
+        #Pre-create preview image
+        if not os.path.exists(mat_lib_folder + os.sep + "mat_lib_preview_image.jpg"):
+            f = open(mat_lib_folder + os.sep + "mat_lib_preview_image.jpg", 'w+b')
+            f.close()
+        
+        if self.mode == "online":
+            #Connect and download
+            connection = http.client.HTTPConnection(mat_lib_host)
+            connection.request("GET", mat_lib_location + "cycles/index.xml")
+            
+            if "release" in context.scene.mat_lib_library:
+                response = connection.getresponse().read()
+                
+                #Cache the index.xml file for offline use
+                library_file = open(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "index.xml"), mode="w+b")
+                library_file.write(response)
+                library_file.close()
+                
+                #Create /textures/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "textures")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "textures"))
+                
+                #Create /scripts/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "scripts")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "scripts"))
+                library = "release"
+            elif "testing" in context.scene.mat_lib_library:
+                response = connection.getresponse().read()
+                
+                #Create /textures/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "testing", "cycles", "textures")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "testing", "cycles", "textures"))
+                
+                #Create /scripts/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "testing", "cycles", "scripts")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "testing", "cycles", "scripts"))
+                library = "testing"
+            else:
+                response = connection.getresponse().read()
+                
+                #Cache the index.xml file for offline use
+                library_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + "index.xml", mode="w+b")
+                library_file.write(response)
+                library_file.close()
+                
+                #Create /textures/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures"))
+                
+                #Create /scripts/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts"))
+                library = "composite"
+                
+            #Convert the response to a string
+            mat_lib_contents = str(response)
+            
+            #Check for connection errors
+            if "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" not in mat_lib_contents:
+                self.report({'ERROR'}, "Error connecting; see console for details.")
+                print("Received following response from server:\n" + mat_lib_contents)
+                return {'CANCELLED'}
+            
+            #Format nicely
+            mat_lib_contents = mat_lib_contents.replace("b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>",'')
+            mat_lib_contents = mat_lib_contents.replace("\\r\\n",'')
+            mat_lib_contents = mat_lib_contents.replace("\\t",'')[:-1]
+            mat_lib_contents = mat_lib_contents.replace("\\",'')
+            
+        else:
+            if "release" in context.scene.mat_lib_library:
+                #Check for cached index.xml file
+                if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "release" + os.sep + "cycles" + os.sep + "index.xml"):
+                    library_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "release" + os.sep + "cycles" + os.sep + "index.xml", mode="r", encoding="UTF-8")
+                    mat_lib_contents = library_file.read()
+                    library_file.close()
+                else:
+                    self.report({'ERROR'}, "No cached library exists!")
+                    return {'CANCELLED'}
+                
+                #Create /textures/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "textures")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "textures"))
+                
+                #Create /scripts/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "scripts")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "release", "cycles", "scripts"))
+                library = "release"
+            elif context.scene.mat_lib_library == "bundled":
+                #Check for index.xml file
+                if os.path.exists(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + "index.xml"):
+                    library_file = open(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + "index.xml", mode="r", encoding="UTF-8")
+                    mat_lib_contents = library_file.read()
+                    library_file.close()
+                else:
+                    self.report({'ERROR'}, "Bundled library does not exist!")
+                    return {'CANCELLED'}
+                library = "bundled"
+            else:
+                #Check for cached index.xml file
+                if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + "index.xml"):
+                    library_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + "index.xml", mode="r", encoding="UTF-8")
+                    mat_lib_contents = library_file.read()
+                    library_file.close()
+                else:
+                    self.report({'ERROR'}, "No cached library exists!")
+                    return {'CANCELLED'}
+                
+                #Create /textures/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures"))
+                
+                #Create /scripts/ folder
+                if not os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts")):
+                    os.mkdir(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts"))
+                library = "composite"
+            
+            if '<?xml version="1.0" encoding="UTF-8"?>' not in mat_lib_contents:
+                self.report({'ERROR'}, "Cached XML file is invalid!")
+                return {'CANCELLED'}
+            
+            #Format nicely
+            mat_lib_contents = mat_lib_contents.replace('<?xml version="1.0" encoding="UTF-8"?>', '')
+            mat_lib_contents = mat_lib_contents.replace("\r\n",'')
+            mat_lib_contents = mat_lib_contents.replace("\n",'')
+            mat_lib_contents = mat_lib_contents.replace("\t",'')
+            mat_lib_contents = mat_lib_contents.replace("\\",'')
+        
+        #Clear important lists
+        library_data = []
+        mat_lib_category_names = []
+        mat_lib_category_types = []
+        mat_lib_category_filenames = []
+            
+        dom = xml.dom.minidom.parseString(mat_lib_contents)
+        
+        if self.mode == "online":
+            if library == "composite":
+                rev_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + "revision_data.ini", mode="r", encoding="UTF-8")
+                rev_data = rev_file.read()
+                rev_file.close()
+            else:
+                rev_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + "revision_data.ini", mode="r", encoding="UTF-8")
+                rev_data = rev_file.read()
+                rev_file.close()
+            
+            if "revision=" in rev_data:
+                revision = int(rev_data[9:])
+            else:
+                revision = -1
+                print("The revision_data.ini file is invalid; clearing cache and re-creating.")
+            
+            if revision is not int(dom.getElementsByTagName("library")[0].attributes['rev'].value):
+                bpy.ops.material.libraryclearcache()
+            
+            if library == "composite":
+                rev_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + "revision_data.ini", mode="w", encoding="UTF-8")
+            else:
+                rev_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + "revision_data.ini", mode="w", encoding="UTF-8")
+            rev_file.write("revision=" + dom.getElementsByTagName("library")[0].attributes['rev'].value)
+            rev_file.close()
+            
+            if 'addon' in dom.getElementsByTagName("library")[0].attributes:
+                current_version = float(dom.getElementsByTagName("library")[0].attributes['addon'].value)
+                this_version = bl_info["version"][0] + (bl_info["version"][1] / 10.0)
+                if current_version > this_version:
+                    update_data = ["Add-on is outdated.", dom.getElementsByTagName("library")[0].attributes['download'].value]
+        
+        print ("\n\n---Material Library---")
+        categories = dom.getElementsByTagName("category")
+        handleCategories(categories)
+        
+        for cat in library_data:
+            #Find category names
+            mat_lib_category_names.append(cat.title)
+            #Find category types
+            #NOTE: Will have to redo this.
+            #mat_lib_category_types = safeEval(mat_lib_contents[(mat_lib_contents.index('[types]') + 7):mat_lib_contents.index('[/types]')])
+            #Get category filenames
+            mat_lib_category_filenames.append(cat.folder)
+            
+        #Find amount of categories
+        mat_lib_categories = len(mat_lib_category_names)
+        
+        #Set enum items for category dropdown
+        category_enum_items = [("None0", "None", "No category selected")]
+        
+        i = 0
+        while i < mat_lib_categories:
+            print ("Adding category #%d" % (i + 1))
+            category_enum_items.append(((mat_lib_category_names[i] + str(i + 1)), mat_lib_category_names[i], (mat_lib_category_names[i] + " category")))
+            i = i + 1
+        bpy.types.Scene.mat_lib_material_category = bpy.props.EnumProperty(name = "", items = category_enum_items, description = "Choose a category")
+        bpy.context.scene.mat_lib_material_category = "None0";
+        
+        #No errors - set working mode
+        working_mode = self.mode
+        
+        self.report({'INFO'}, "Retrieved library!")
+        
+        return {'FINISHED'}
+
+class LibraryInfo(bpy.types.Operator):
+    '''Display add-on info'''
+    bl_idname = "material.libraryinfo"
+    bl_label = "Display add-on info"
+
+    def execute(self, context):
+        global category_type
+        
+        category_type = "info"
+        
+        return {'FINISHED'}
+
+class LibraryTools(bpy.types.Operator):
+    '''Display material tools'''
+    bl_idname = "material.librarytools"
+    bl_label = "Display material tools"
+
+    def execute(self, context):
+        global category_type
+        
+        category_type = "tools"
+        
+        return {'FINISHED'}
+
+class LibrarySettings(bpy.types.Operator):
+    '''Display add-on settings'''
+    bl_idname = "material.librarysettings"
+    bl_label = "Display add-on settings"
+
+    def execute(self, context):
+        global category_type
+        global mat_lib_cached_files
+        
+        category_type = "settings"
+        if library == "":
+            return {'FINISHED'}
+        elif library == "bundled":
+            return {'FINISHED'}
+        elif library == "composite":
+            cached_data_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep
+        else:
+            cached_data_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep
+        mat_lib_cached_files = 0
+        for root, dirs, files in os.walk(cached_data_path):
+            for name in files:
+                if ".jpg" in name.lower():
+                    mat_lib_cached_files += 1
+                elif ".png" in name.lower():
+                    mat_lib_cached_files += 1
+                elif ".osl" in name.lower():
+                    mat_lib_cached_files += 1
+                elif ".osl" in name.lower():
+                    mat_lib_cached_files += 1
+                elif ".bcm" in name:
+                    mat_lib_cached_files += 1
+        
+        return {'FINISHED'}
+
+class LibraryHome(bpy.types.Operator):
+    '''Go back'''
+    bl_idname = "material.libraryhome"
+    bl_label = "Go back"
+
+    def execute(self, context):
+        global category_type
+        
+        category_type = "none"
+        
+        return {'FINISHED'}
+
+def libraryCategoryUpdate():
+    print("Updating Material Category.")
+    #Check if the category is None
+    if bpy.context.scene.mat_lib_material_category != "None0":
+        #Selected category is not None; select category.        
+        
+        global category_contents
+        global category_name
+        global category_filename
+        global category_materials
+                
+        global material_names
+        global material_filenames
+        global material_contributors
+        global material_ratings
+        global material_fireflies
+        global material_speeds
+        global material_complexities
+        global material_scripts
+        global material_images
+        
+        global current_material_number
+                
+        global category_type
+    
+        i = 0
+        while i < len(category_enum_items):
+            if category_enum_items[i][0] == bpy.context.scene.mat_lib_material_category:
+                #Set category filename for refresh button
+                category_filename = mat_lib_category_filenames[i - 1]
+                #Set category name for header
+                category_name = mat_lib_category_names[i - 1]
+                category_index = i - 1
+            i = i + 1
+        
+        if True:
+            current_material_number = -1
+            
+            material_names = []
+            material_filenames = []
+            material_contributors = []
+            material_ratings = []
+            material_fireflies = []
+            material_speeds = []
+            material_complexities = []
+            material_scripts = []
+            material_images = []
+            
+            for mat in library_data[category_index].materials:
+                #Get material names
+                material_names.append(mat.name)
+                #Get material filenames
+                material_filenames.append(mat.href)
+                #Get material contributors
+                material_contributors.append(mat.contrib)
+                #Get material ratings
+                material_ratings.append(mat.stars)
+                #Get material firefly levels
+                material_fireflies.append(mat.fireflies)
+                #Get material render speeds
+                material_speeds.append(mat.speed)
+                #Get material complexities
+                material_complexities.append(mat.complexity)
+                #Get material image textures
+                material_images.append(mat.images)
+                #Get material OSL scripts
+                material_scripts.append(mat.scripts)
+            
+            #Set amount of materials in selected category
+            category_materials = len(material_names)
+        
+            category_type = "category"
+        
+        elif "parent" == "parent":
+            current_material_number = -1
+            #REWRITE, REWRITE...
+            #Find category names
+            #parent_category_names = safeEval(parent_category_contents[(parent_category_contents.index('[names]') + 7):parent_category_contents.index('[/names]')])
+            #
+            #Get category filenames
+            #parent_category_filenames = safeEval(parent_category_contents[(parent_category_contents.index('[filenames]') + 11):parent_category_contents.index('[/filenames]')])
+            #
+            #Set parent category name for header
+            #parent_category_name = self.name
+            #
+            #Set parent category filename
+            #parent_category_filename = self.filename
+            #
+            #Set amount of categories in parent category
+            #parent_category_categories = len(parent_category_names)
+            
+            category_type = "parent"
+        
+        elif "subcategory" == "subcategory":
+            current_material_number = -1
+            #ANOTHER REWRITE.
+            #Get material names
+            #material_names = safeEval(category_contents[(category_contents.index("[names]") + 7):category_contents.index("[/names]")])
+            #
+            #Get material filenames
+            #material_filenames = safeEval(category_contents[(category_contents.index("[filenames]") + 11):category_contents.index("[/filenames]")])
+            #
+            #Get material contributors
+            #material_contributors = safeEval(category_contents[(category_contents.index("[contributors]") + 14):category_contents.index("[/contributors]")])
+            #
+            #Get material ratings
+            #material_ratings = safeEval(category_contents[(category_contents.index("[ratings]") + 9):category_contents.index("[/ratings]")])
+            #
+            #Set category name for header
+            #category_name = self.name
+            #
+            #Set category filename for refresh button
+            #category_filename = self.filename
+            
+            #Set amount of materials in selected category
+            #category_materials = len(material_names)
+            
+            category_type = "subcategory"
+        
+        else:
+            self.report({'ERROR'}, "Invalid category! See console for details.")
+            print ("Invalid category!")
+            print (category_contents)
+    else:
+        #Selected category is None
+        parent_category_contents = "None"
+        category_contents = "None"
+        current_material_number = -1
+        category_type = "none"
+
+class ViewMaterial(bpy.types.Operator):
+    '''View material details'''
+    bl_idname = "material.libraryviewmaterial"
+    bl_label = "view material details"
+    material = bpy.props.IntProperty()
+    
+    def execute(self, context):
+        global current_material_number
+        global current_material_cached
+        global current_material_previewed
+        
+        if current_material_number == self.material:
+            if current_material_previewed:
+                current_material_previewed = True
+            else:
+                current_material_previewed = False
+        else:
+            current_material_previewed = False
+        
+        current_material_number = self.material
+        current_material_cached = False
+        
+        if self.material == -1:
+            return {'FINISHED'}
+        
+        if library == "composite":
+            if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + material_filenames[self.material] + ".bcm"):
+                current_material_cached = True
+        elif library != "bundled":
+            if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + material_filenames[self.material] + ".bcm"):
+                current_material_cached = True
+        
+        if context.scene.mat_lib_auto_preview == True:
+            print("Auto-download previews on.")
+            bpy.ops.material.librarypreview(name=material_names[self.material], filename=material_filenames[self.material])
+            self.report({preview_message[0]}, preview_message[1])
+        elif working_mode == "offline":
+            bpy.ops.material.librarypreview(name=material_names[self.material], filename=material_filenames[self.material])
+            self.report({preview_message[0]}, preview_message[1])
+        elif library == "composite":
+            if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep  + category_filename + os.sep + material_filenames[self.material] + ".jpg"):
+                bpy.ops.material.librarypreview(name=material_names[self.material], filename=material_filenames[self.material])
+                self.report({preview_message[0]}, preview_message[1])
+        else:
+            if os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep  + category_filename + os.sep + material_filenames[self.material] + ".jpg"):
+                bpy.ops.material.librarypreview(name=material_names[self.material], filename=material_filenames[self.material])
+                self.report({preview_message[0]}, preview_message[1])
+        return {'FINISHED'}
+
+class MaterialDetailView(bpy.types.Operator):
+    '''Change detail view'''
+    bl_idname = "material.librarydetailview"
+    bl_label = "change detail view"
+    mode = bpy.props.StringProperty()
+
+    def execute(self, context):
+        global material_detail_view
+        
+        if self.mode == "NEXT":
+            if material_detail_view == "RENDER":
+                material_detail_view = "DATA"
+        else:
+            if material_detail_view == "DATA":
+                material_detail_view = "RENDER"
+        return {'FINISHED'}
+            
+
+class LibraryClearCache(bpy.types.Operator):
+    '''Delete active library's cached previews and/or materials'''
+    bl_idname = "material.libraryclearcache"
+    bl_label = "delete cached previews and materials"
+    
+    def execute(self, context):
+        global mat_lib_cached_files
+        
+        
+        if library == "bundled":
+            self.report({'ERROR'}, "The bundled library is local only and contains no cached online data.")
+            return {'CANCELLED'}
+        if library == "composite":
+            for root, dirs, files in os.walk(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep):
+                for name in files:
+                    if name[-4:].lower() == ".jpg":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".png":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".osl":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".oso":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".bcm":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+        else:
+            for root, dirs, files in os.walk(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep):
+                for name in files:
+                    if name[-4:].lower() == ".jpg":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".png":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".osl":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".oso":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+                    elif name[-4:].lower() == ".bcm":
+                        print("Deleting \"" + os.path.join(root, name) + "\".")
+                        os.remove(os.path.join(root, name))
+        
+        if library == "":
+            return {'FINISHED'}
+        elif library == "bundled":
+            return {'FINISHED'}
+        elif library == "composite":
+            cached_data_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep
+        else:
+            cached_data_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep
+        mat_lib_cached_files = 0
+        for root, dirs, files in os.walk(cached_data_path):
+            for name in files:
+                if ".jpg" in name:
+                    mat_lib_cached_files += 1
+                elif ".bcm" in name:
+                    mat_lib_cached_files += 1
+        
+        self.report({'INFO'}, "Preview cache cleared.")
+        return {'FINISHED'}
+    
+class LibraryPreview(bpy.types.Operator):
+    '''Download preview'''
+    bl_idname = "material.librarypreview"
+    bl_label = "preview material"
+    name = bpy.props.StringProperty()
+    filename = bpy.props.StringProperty()
+        
+    def execute(self, context):
+        global parent_category_filename
+        global category_filename
+        global preview_message
+        global library
+        global current_material_previewed
+        
+        #Check for a cached preview
+        if library == "bundled":
+            image_path = mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep  + category_filename + os.sep + self.filename + ".jpg"
+        elif library == "composite":
+            image_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep  + category_filename + os.sep + self.filename + ".jpg"
+        else:
+            image_path = mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep  + category_filename + os.sep + self.filename + ".jpg"
+        
+        if os.path.exists(image_path):
+            #Cached preview exists
+            cached_image = open(image_path, 'r+b')
+            response = cached_image.read()
+            cached_image.close()
+            f = open(mat_lib_folder + os.sep + "mat_lib_preview_image.jpg", 'w+b')
+            f.write(response)
+            f.close()
+            
+        elif working_mode == "online":
+            #This preview doesn't exist yet; let's download it.
+            connection = http.client.HTTPConnection(mat_lib_host)
+            connection.request("GET", mat_lib_location + "cycles/" + category_filename + "/" + self.filename + ".jpg")
+            response = connection.getresponse().read()
+            f = open(mat_lib_folder + os.sep + "mat_lib_preview_image.jpg", 'w+b')
+            f.write(response)
+            f.close()
+            
+            #Cache this preview
+            f = open(image_path, 'w+b')
+            f.write(response)
+            f.close()
+            
+        else:
+            self.report({'WARNING'}, "Preview does not exist; cannot download in offline mode.")
+            preview_message = ['WARNING', "Preview does not exist; cannot download in offline mode."]
+            return {'CANCELLED'}
+        
+        #Check if has texture
+        if bpy.data.images.find("mat_lib_preview_image.jpg") == -1:
+            bpy.ops.image.open(filepath=mat_lib_folder + os.sep + "mat_lib_preview_image.jpg")
+        
+        if "mat_lib_preview_texture" not in bpy.data.textures:
+             bpy.data.textures.new("mat_lib_preview_texture", "IMAGE")
+        
+        if bpy.data.textures["mat_lib_preview_texture"].image != bpy.data.images["mat_lib_preview_image.jpg"]:
+            bpy.data.textures["mat_lib_preview_texture"].image = bpy.data.images["mat_lib_preview_image.jpg"]
+        
+        #Do everything possible to get Blender to reload the preview.
+        bpy.data.images["mat_lib_preview_image.jpg"].reload()
+        bpy.ops.wm.redraw_timer()
+        bpy.data.scenes[bpy.context.scene.name].update()
+        bpy.data.scenes[bpy.context.scene.name].frame_set(bpy.data.scenes[bpy.context.scene.name].frame_current)
+        
+        self.report({'INFO'}, "Preview applied.")
+        preview_message = ['INFO', "Preview applied."]
+        current_material_previewed = True
+        
+        return {'FINISHED'}
+
+class AddLibraryMaterial(bpy.types.Operator):
+    '''Add material to scene'''
+    bl_idname = "material.libraryadd"
+    bl_label = "add material to scene"
+    mat_name = bpy.props.StringProperty()
+    filename = bpy.props.StringProperty()
+    open_location = bpy.props.StringProperty()
+    text_block = bpy.props.StringProperty()
+    
+    def execute(self, context):
+        global material_file_contents
+        global library
+        global node_message
+        global current_material_cached
+        
+        if not bpy.context.active_object:
+            self.report({'ERROR'}, "No object selected!")
+        if self.open_location == "" and self.text_block == "":
+            if library == "composite" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = ""
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.filename = ""
+                    self.mat_name = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif library != "bundled" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = ""
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.filename = ""
+                    self.mat_name = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif library == "bundled" and os.path.exists(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.filename = ""
+                    self.mat_name = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif working_mode == "online":
+                connection = http.client.HTTPConnection(mat_lib_host)
+                connection.request("GET", mat_lib_location + "cycles/" + category_filename + "/" + self.filename + ".bcm")
+                response = connection.getresponse().read()
+                
+                #Cache material
+                if library == "composite":
+                    bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+                    bcm_file.write(response)
+                    bcm_file.close()
+                else:
+                    bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+                    bcm_file.write(response)
+                    bcm_file.close()
+                
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in str(response)[2:40]:
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    self.filename = ""
+                    return {'CANCELLED'}
+                material_file_contents = ""
+                material_file_contents = str(response)[str(response).index("<material"):str(response).index("/material>") + 10]
+            else:
+                self.report({'ERROR'}, "Material is not cached; cannot download in offline mode!")
+                return {'CANCELLED'}
+            print (material_file_contents)
+            mat_name = self.mat_name
+        elif self.open_location is not "":
+            if ".bcm" in self.open_location:
+                bcm_file = open(self.open_location, mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.open_location = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+                mat_name = ""
+                for word in self.open_location.split(os.sep)[-1][:-4].split("_"):
+                    if mat_name is not "":
+                        mat_name += " "
+                    mat_name += word.capitalize()
+            else:
+                self.report({'ERROR'}, "Not a .bcm file.")
+                self.open_location = ""
+                return {'CANCELLED'}
+        else:
+            if self.text_block in bpy.data.texts:
+                #Read from a text datablock
+                material_file_contents = bpy.data.texts[self.text_block].as_string()
+            else:
+                self.report({'ERROR'}, "Requested text block does not exist.")
+                self.text_block = ""
+                return {'CANCELLED'}
+                
+            #Check file for validitity
+            if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents[0:38]:
+                self.report({'ERROR'}, "Material data is either outdated or invalid.")
+                self.text_block = ""
+                return {'CANCELLED'}
+            mat_name = ""
+            
+            separator = ""
+            if context.scene.mat_lib_bcm_name is "":
+                separator = ""
+                if "_" in self.text_block:
+                    separator = "_"
+                elif "-" in self.text_block:
+                    separator = "-"
+                elif " " in self.text_block:
+                    separator = " "
+                    
+                if separator is not "":
+                    for word in self.text_block.split(separator):
+                        if mat_name is not "":
+                            mat_name += " "
+                        mat_name += word.capitalize()
+                else:
+                    mat_name = self.text_block
+            else:
+                mat_name = context.scene.mat_lib_bcm_name
+        
+        #Format nicely
+        material_file_contents = material_file_contents.replace('<?xml version="1.0" encoding="UTF-8"?>', '')
+        material_file_contents = material_file_contents.replace("\r\n",'')
+        material_file_contents = material_file_contents.replace("\n",'')
+        material_file_contents = material_file_contents.replace("\t",'')
+        material_file_contents = material_file_contents.replace("\\",'')
+        
+        #Create new material
+        new_mat = bpy.data.materials.new(mat_name)
+        new_mat.use_nodes = True
+        new_mat.node_tree.nodes.clear()
+        
+        #Parse file
+        dom = xml.dom.minidom.parseString(material_file_contents)
+        
+        #Create internal OSL scripts
+        scripts = dom.getElementsByTagName("script")
+        for s in scripts:
+            osl_datablock = bpy.data.texts.new(name=s.attributes['name'].value)
+            osl_text = s.toxml()[s.toxml().index(">"):s.toxml().rindex("<")]
+            osl_text = osl_text[1:].replace("<br/>","\n")
+            osl_datablock.write(osl_text)
+            osl_scripts.append(osl_datablock)
+        
+        #Add nodes
+        nodes = dom.getElementsByTagName("node")
+        addNodes(nodes, new_mat)
+        if node_message:
+            self.report({node_message[0]}, node_message[1])
+            node_message = []
+            self.mat_name = ""
+            self.filename = ""
+            self.open_location = ""
+            self.text_block = ""
+            return {'CANCELLED'}
+            
+        #Create links
+        links = dom.getElementsByTagName("link")
+        createLinks(links, new_mat)
+        
+        m = dom.getElementsByTagName("material")[0]
+        
+        #Set viewport color
+        new_mat.diffuse_color = color(m.attributes["view_color"].value)
+            
+        #Set sample-as-lamp-ness
+        if m.attributes["sample_lamp"].value == "True":
+            sample_lamp = True
+        else:
+            sample_lamp = False
+        new_mat.cycles.sample_as_light = sample_lamp
+        
+        self.mat_name = ""
+        self.filename = ""
+        self.open_location = ""
+        self.text_block = ""
+        self.report({'INFO'}, "Material added.")
+        current_material_cached = True
+        
+        return {'FINISHED'}
+
+class ApplyLibraryMaterial(bpy.types.Operator):
+    '''Apply to active material'''
+    bl_idname = "material.libraryapply"
+    bl_label = "Apply to active material"
+    mat_name = bpy.props.StringProperty()
+    filename = bpy.props.StringProperty()
+    open_location = bpy.props.StringProperty()
+    text_block = bpy.props.StringProperty()
+    
+    def execute(self, context):
+        global material_file_contents
+        global library
+        global node_message
+        global current_material_cached
+        global osl_scripts
+        
+        mat_name = ""
+        material_file_contents = ""
+        if not bpy.context.active_object:
+            self.report({'ERROR'}, "No object selected!")
+            return {'CANCELLED'}
+        if self.filename is not "":
+            if library == "composite" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.mat_name = ""
+                    self.filename = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif library != "bundled" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.mat_name = ""
+                    self.filename = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif library == "bundled" and os.path.exists(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm"):
+                bcm_file = open(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.mat_name = ""
+                    self.filename = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+            elif working_mode == "online":
+                connection = http.client.HTTPConnection(mat_lib_host)
+                connection.request("GET", mat_lib_location + "cycles/" + category_filename + "/" + self.filename + ".bcm")
+                response = connection.getresponse().read()
+                
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in str(response)[2:40]:
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    self.mat_name = ""
+                    self.filename = ""
+                    return {'CANCELLED'}
+                
+                #Cache material
+                if library == "composite":
+                    bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+                    bcm_file.write(response)
+                    bcm_file.close()
+                else:
+                    bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+                    bcm_file.write(response)
+                    bcm_file.close()
+                
+                material_file_contents = ""
+                material_file_contents = str(response)[str(response).index("<material"):str(response).index("/material>") + 10]
+            else:
+                self.report({'ERROR'}, "Material is not cached; cannot download in offline mode!")
+                self.mat_name = ""
+                self.filename = ""
+                return {'CANCELLED'}
+            mat_name = self.mat_name
+        elif self.open_location is not "":
+            if ".bcm" in self.open_location:
+                material_file_contents = ""
+                bcm_file = open(self.open_location, mode="r", encoding="UTF-8")
+                material_file_contents = bcm_file.read()
+                bcm_file.close()
+                
+                #Check file for validitity
+                if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents:
+                    self.open_location = ""
+                    self.report({'ERROR'}, "Material file is either outdated or invalid.")
+                    return {'CANCELLED'}
+                mat_name = ""
+                for word in self.open_location.split(os.sep)[-1][:-4].split("_"):
+                    if mat_name is not "":
+                        mat_name += " "
+                    mat_name += word.capitalize()
+            else:
+                self.open_location = ""
+                self.report({'ERROR'}, "Not a .bcm file.")
+                return {'CANCELLED'}
+        else:
+            if self.text_block in bpy.data.texts:
+                #Read from a text datablock
+                material_file_contents = ""
+                material_file_contents = bpy.data.texts[self.text_block].as_string()
+            else:
+                self.report({'ERROR'}, "Requested text block does not exist.")
+                self.text_block = "";
+                return {'CANCELLED'}
+            
+            #Check file for validitity
+            if '<?xml version="1.0" encoding="UTF-8"?>' not in material_file_contents[0:38]:
+                self.report({'ERROR'}, "Material data is either outdated or invalid.")
+                self.text_block = ""
+                return {'CANCELLED'}
+            if context.scene.mat_lib_bcm_name is "":
+                separator = ""
+                if "_" in self.text_block:
+                    separator = "_"
+                elif "-" in self.text_block:
+                    separator = "-"
+                elif " " in self.text_block:
+                    separator = " "
+                    
+                if separator is not "":
+                    for word in self.text_block.split(separator):
+                        if mat_name is not "":
+                            mat_name += " "
+                        mat_name += word.capitalize()
+                else:
+                    mat_name = self.text_block
+            else:
+                mat_name = context.scene.mat_lib_bcm_name
+        
+        
+        if context.active_object.active_material:
+            context.active_object.active_material.name = mat_name
+        else:
+            new_material = bpy.data.materials.new(mat_name)
+            if len(context.active_object.material_slots.keys()) is 0:
+                bpy.ops.object.material_slot_add()
+            context.active_object.material_slots[context.active_object.active_material_index].material = new_material
+        
+        #Prepare material for new nodes
+        context.active_object.active_material.use_nodes = True
+        context.active_object.active_material.node_tree.nodes.clear()
+        
+        #Format nicely
+        material_file_contents = material_file_contents.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", '')
+        material_file_contents = material_file_contents.replace("\r\n",'')
+        material_file_contents = material_file_contents.replace("\n",'')
+        material_file_contents = material_file_contents.replace("\t",'')
+        material_file_contents = material_file_contents.replace("\\",'')
+        
+        #Parse file
+        dom = xml.dom.minidom.parseString(material_file_contents)
+        
+        #Create internal OSL scripts
+        scripts = dom.getElementsByTagName("script")
+        for s in scripts:
+            osl_datablock = bpy.data.texts.new(name=s.attributes['name'].value)
+            osl_text = s.toxml()[s.toxml().index(">"):s.toxml().rindex("<")]
+            osl_text = osl_text[1:].replace("<br/>","\n")
+            osl_datablock.write(osl_text)
+            osl_scripts.append(osl_datablock)
+        
+        #Add nodes
+        nodes = dom.getElementsByTagName("node")
+        addNodes(nodes, context.active_object.active_material)
+        if node_message:
+            self.report({node_message[0]}, node_message[1])
+            node_message = []
+            self.mat_name = ""
+            self.filename = ""
+            self.open_location = ""
+            self.text_block = ""
+            return {'CANCELLED'}
+            
+        #Create links
+        links = dom.getElementsByTagName("link")
+        createLinks(links, context.active_object.active_material)
+        
+        m = dom.getElementsByTagName("material")[0]
+        
+        #Set viewport color
+        context.active_object.active_material.diffuse_color = color(m.attributes["view_color"].value)
+            
+        #Set sample-as-lamp-ness
+        if boolean(m.attributes["sample_lamp"].value):
+            sample_lamp = True
+        else:
+            sample_lamp = False
+        context.active_object.active_material.cycles.sample_as_light = sample_lamp
+        
+        self.mat_name = ""
+        self.filename = ""
+        self.open_location = ""
+        self.text_block = ""
+        self.report({'INFO'}, "Material applied.")
+        current_material_cached = True
+        
+        return {'FINISHED'}
+
+class CacheLibraryMaterial(bpy.types.Operator):
+    '''Cache material to disk'''
+    bl_idname = "material.librarycache"
+    bl_label = "cache material to disk"
+    filename = bpy.props.StringProperty()
+    
+    def execute(self, context):
+        global material_file_contents
+        global current_material_cached
+        
+        if working_mode == "online":
+            connection = http.client.HTTPConnection(mat_lib_host)
+            connection.request("GET", mat_lib_location + "cycles/" + category_filename + "/" + self.filename + ".bcm")
+            response = connection.getresponse().read()
+        else:
+            self.report({'ERROR'}, "Cannot cache material in offline mode.")
+            return {'CANCELLED'}
+        
+        material_file_contents = str(response)
+        if '<?xml version="1.0" encoding="UTF-8"?>' in material_file_contents[2:40]:
+            material_file_contents = material_file_contents[material_file_contents.index("<material"):(material_file_contents.rindex("</material>") + 11)]
+        else:
+            self.report({'ERROR'}, "Invalid material file.")
+            print(material_file_contents)
+            return {'CANCELLED'}
+        
+        #Parse file
+        dom = xml.dom.minidom.parseString(material_file_contents)
+        
+        #Create internal OSL scripts and cache image textures
+        nodes = dom.getElementsByTagName("node")
+        for node in nodes:
+            node_data = node.attributes
+            if node_data['type'].value == "TEX_IMAGE":
+                if node_data['image'].value:
+                    if "file://" in node_data['image'].value:
+                        self.report({'ERROR'}, "Cannot cache image texture located at %s." % node_data['image'].value)
+                    elif "http://" in node_data['image'].value:
+                        self.report({'ERROR'}, "Cannot cache image texture hosted at %s." % node_data['image'].value)
+                    else:
+                        ext = "." + node_data['image'].value.split(".")[-1]
+                        image_name = node_data['image'].value[:-4]
+                        
+                        if ext.lower() != ".jpg" and ext.lower() != ".png":
+                            node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                            return
+                            
+                        if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                        elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                        elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)
+                        elif working_mode == "online":
+                            connection = http.client.HTTPConnection(mat_lib_host)
+                            connection.request("GET", mat_lib_location + "cycles/textures/" + image_name + ext)
+                            response = connection.getresponse().read()
+                            
+                            #Cache image texture
+                            if library == "composite":
+                                image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                                image_file = open(image_filepath, mode="w+b")
+                                image_file.write(response)
+                                image_file.close()
+                            else:
+                                image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                                image_file = open(image_filepath, mode="w+b")
+                                image_file.write(response)
+                                image_file.close()
+                        else:
+                            node_message = ['ERROR', "The image texture, \"%s\", is not cached; cannot download in offline mode." % (image_name + ext)]
+                            image_filepath = ""
+            elif node_data['type'].value == "SCRIPT":
+                if node_data['script'].value:
+                    if "file://" in node_data['script'].value:
+                        self.report({'ERROR'}, "Cannot cache OSL script located at %s." % node_data['script'].value)
+                    elif "http://" in node_data['script'].value:
+                        self.report({'ERROR'}, "Cannot cache OSL script hosted at %s." % node_data['script'].value)
+                    else:
+                        ext = "." + node_data['script'].value.split(".")[-1]
+                        script_name = node_data['script'].value[:-4]
+                        
+                        if ext.lower() != ".osl" and ext.lower() != ".oso":
+                            node_message = ['ERROR', "The OSL script file referenced by this script node is not .osl or .oso; not downloading."]
+                            return
+                            
+                        if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                        elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                        elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)
+                        elif working_mode == "online":
+                            connection = http.client.HTTPConnection(mat_lib_host)
+                            connection.request("GET", mat_lib_location + "cycles/scripts/" + script_name + ext)
+                            response = connection.getresponse().read()
+                            
+                            #Cache image texture
+                            if library == "composite":
+                                script_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                                script_file = open(script_filepath, mode="w+b")
+                                script_file.write(response)
+                                script_file.close()
+                            else:
+                                script_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                                script_file = open(script_filepath, mode="w+b")
+                                script_file.write(response)
+                                script_file.close()
+                        else:
+                            node_message = ['ERROR', "The OSL script, \"%s\", is not cached; cannot download in offline mode." % (script_name + ext)]
+                            script_filepath = ""
+                    
+        
+        if library == "composite":
+            bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+            bcm_file.write(response)
+            bcm_file.close()
+        elif library != "bundled":
+            bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename + ".bcm", mode="w+b")
+            bcm_file.write(response)
+            bcm_file.close()
+        else:
+            self.report({'ERROR'}, "Cannot cache materials from this library.")
+            return {'CANCELLED'}
+            
+        current_material_cached = True
+        self.report({'INFO'}, "Material cached.")
+        return {'FINISHED'}
+
+class SaveLibraryMaterial(bpy.types.Operator, ExportHelper):
+    '''Save material to disk'''
+    bl_idname = "material.librarysave"
+    bl_label = "Save material to disk"
+    filepath = bpy.props.StringProperty()
+    filename = bpy.props.StringProperty()
+    
+    #ExportHelper uses this
+    filename_ext = ".bcm"
+
+    filter_glob = bpy.props.StringProperty(
+            default="*.bcm",
+            options={'HIDDEN'},
+            )
+    
+    def execute(self, context):
+        global material_file_contents
+        global save_filename
+        global current_material_cached
+        
+        if library == "composite" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + save_filename):
+            bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename, mode="r+b")
+            response = bcm_file.read()
+            bcm_file.close()
+        elif library != "bundled" and os.path.exists(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + save_filename):
+            bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename, mode="r+b")
+            response = bcm_file.read()
+            bcm_file.close()
+        elif library == "bundled" and os.path.exists(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + save_filename):
+            bcm_file = open(mat_lib_folder + os.sep + "bundled" + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename, mode="r+b")
+            response = bcm_file.read()
+            bcm_file.close()
+        elif working_mode == "online":
+            connection = http.client.HTTPConnection(mat_lib_host)
+            connection.request("GET", mat_lib_location + "cycles/" + category_filename + "/" + self.filename)
+            response = connection.getresponse().read()
+            
+            #Cache material
+            if library == "composite":
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename, mode="w+b")
+                bcm_file.write(response)
+                bcm_file.close()
+            else:
+                bcm_file = open(mat_lib_folder + os.sep + mat_lib_host + os.sep + library + os.sep + "cycles" + os.sep + category_filename + os.sep + self.filename, mode="w+b")
+                bcm_file.write(response)
+                bcm_file.close()
+        else:
+            self.report({'ERROR'}, "Material is not cached; cannot download in offline mode.")
+            return {'FINISHED'}
+        
+        material_file_contents = str(response)
+        
+        bcm_file = open(self.filepath, mode="w+b")
+        bcm_file.write(response)
+        bcm_file.close()
+        
+        if '<?xml version="1.0" encoding="UTF-8"?>' in material_file_contents[2:40]:
+            material_file_contents = material_file_contents[material_file_contents.index("<material"):(material_file_contents.rindex("</material>") + 11)]
+        else:
+            self.report({'ERROR'}, "Invalid material file.")
+            print(material_file_contents)
+            return {'CANCELLED'}
+        
+        #Parse file
+        dom = xml.dom.minidom.parseString(material_file_contents)
+        
+        bcm_file = open(self.filepath, mode="r", encoding="UTF-8")
+        material_file_contents = bcm_file.read()
+        bcm_file.close()
+        
+        #Create internal OSL scripts and cache image textures
+        nodes = dom.getElementsByTagName("node")
+        for node in nodes:
+            node_data = node.attributes
+            if node_data['type'].value == "TEX_IMAGE":
+                if node_data['image'].value:
+                    node_attributes = (
+                        node_data['image'].value,
+                        node_data['source'].value,
+                        node_data['color_space'].value,
+                        node_data['projection'].value,
+                        node_data['loc'].value)
+                    original_xml = ("<node type=\"TEX_IMAGE\" image=\"%s\" source=\"%s\" color_space=\"%s\" projection=\"%s\" loc=\"%s\" />" % node_attributes)
+                    if "file://" in node_data['image'].value:
+                        if os.path.exists(node_data['image'].value[7:]):
+                            image_file = open(node_data['image'].value[7:], mode="r+b")
+                            image_data = image_file.read()
+                            image_file.close()
+                            copied_image = open(self.filepath[:-len(self.filename)] + node_data['image'].value.split(os.sep)[-1], mode="w+b")
+                            copied_image.write(image_data)
+                            copied_image.close()
+                            image_location = ("file://" + self.filepath[:-len(self.filename)] + node_data['image'].value.split(os.sep)[-1])
+                        else:
+                            image_location = ""
+                    elif "http://" in node_data['image'].value:
+                        self.report({'ERROR'}, "Cannot save image texture hosted at %s." % node_data['image'].value)
+                        image_location = ""
+                    else:
+                        ext = "." + node_data['image'].value.split(".")[-1]
+                        image_name = node_data['image'].value[:-4]
+                        
+                        if ext.lower() != ".jpg" and ext.lower() != ".png":
+                            node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                            return
+                            
+                        if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                        elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                        elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)):
+                            image_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)
+                        elif working_mode == "online":
+                            connection = http.client.HTTPConnection(mat_lib_host)
+                            connection.request("GET", mat_lib_location + "cycles/textures/" + image_name + ext)
+                            response = connection.getresponse().read()
+                            
+                            #Cache image texture
+                            if library == "composite":
+                                image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                                image_file = open(image_filepath, mode="w+b")
+                                image_file.write(response)
+                                image_file.close()
+                            else:
+                                image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                                image_file = open(image_filepath, mode="w+b")
+                                image_file.write(response)
+                                image_file.close()
+                        else:
+                            node_message = ['ERROR', "The image texture, \"%s\", is not cached; cannot download in offline mode." % (image_name + ext)]
+                            image_filepath = ""
+                        image_location = ("file://" + self.filepath[:-len(self.filename)] + node_data['image'].value)
+                        
+                        if image_filepath:
+                            print(image_filepath)
+                            image_file = open(image_filepath, mode="r+b")
+                            image_data = image_file.read()
+                            image_file.close()
+                            saved_image = open(self.filepath[:-len(self.filename)] + node_data['image'].value, mode="w+b")
+                            saved_image.write(image_data)
+                            saved_image.close()
+                
+                    updated_xml = original_xml.replace(node_data['image'].value, image_location)
+                    material_file_contents = material_file_contents.replace(original_xml, updated_xml)
+            elif node_data['type'].value == "SCRIPT":
+                if node_data['script'].value:
+                    node_attributes = (
+                        node_data['mode'].value,
+                        node_data['script'].value,
+                        node_data['loc'].value)
+                    original_xml = ("<node type=\"SCRIPT\" mode=\"%s\" script=\"%s\" loc=\"%s\" />" % node_attributes)
+                    if "file://" in node_data['script'].value:
+                        if os.path.exists(node_data['script'].value[7:]):
+                            script_file = open(node_data['script'].value[7:], mode="r+b")
+                            script_data = script_file.read()
+                            script_file.close()
+                            copied_script = open(self.filepath[:-len(self.filename)] + node_data['script'].value.split(os.sep)[-1], mode="w+b")
+                            copied_script.write(script_data)
+                            copied_script.close()
+                            script_location = ("file://" + self.filepath[:-len(self.filename)] + node_data['script'].value.split(os.sep)[-1])
+                        else:
+                            script_location = ""
+                    elif "http://" in node_data['script'].value:
+                        self.report({'ERROR'}, "Cannot save OSL script hosted at %s." % node_data['script'].value)
+                        script_location = ""
+                    else:
+                        ext = "." + node_data['script'].value.split(".")[-1]
+                        script_name = node_data['script'].value[:-4]
+                        
+                        if ext.lower() != ".osl" and ext.lower() != ".oso":
+                            node_message = ['ERROR', "The OSL script file referenced by this script node is not .osl or .oso; not downloading."]
+                            return
+                            
+                        if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                        elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                        elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)):
+                            script_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)
+                        elif working_mode == "online":
+                            connection = http.client.HTTPConnection(mat_lib_host)
+                            connection.request("GET", mat_lib_location + "cycles/scripts/" + script_name + ext)
+                            response = connection.getresponse().read()
+                            
+                            #Cache OSL script
+                            if library == "composite":
+                                script_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                                script_file = open(script_filepath, mode="w+b")
+                                script_file.write(response)
+                                script_file.close()
+                            else:
+                                script_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                                script_file = open(script_filepath, mode="w+b")
+                                script_file.write(response)
+                                script_file.close()
+                        else:
+                            node_message = ['ERROR', "The OSL script, \"%s\", is not cached; cannot download in offline mode." % (script_name + ext)]
+                            script_filepath = ""
+                        
+                        if script_filepath:
+                            print(script_filepath)
+                            script_file = open(script_filepath, mode="r+b")
+                            script_data = script_file.read()
+                            script_file.close()
+                            saved_script = open(self.filepath[:-len(self.filename)] + node_data['script'].value, mode="w+b")
+                            saved_script.write(script_data)
+                            saved_script.close()
+                    
+                    updated_xml = original_xml.replace(node_data['script'].value, script_location)
+                    material_file_contents = material_file_contents.replace(original_xml, updated_xml)
+        
+        bcm_file = open(self.filepath, mode="w", encoding="UTF-8")
+        bcm_file.write(material_file_contents)
+        bcm_file.close()
+        
+        self.report({'INFO'}, "Material saved.")
+        current_material_cached = True
+        
+        return {'FINISHED'}
+
+def createLinks(links, mat):
+    node_tree = mat.node_tree
+    for dom_link in links:
+        link = {
+    "to": int(dom_link.attributes['to'].value),
+    "input": int(dom_link.attributes['input'].value),
+    "from": int(dom_link.attributes['from'].value),
+    "output": int(dom_link.attributes['output'].value)}
+        node_tree.links.new(
+    node_tree.nodes[link["to"]].inputs[link["input"]],
+    node_tree.nodes[link["from"]].outputs[link["output"]])
+
+def addNodes(nodes, mat):
+    global node_message
+    global osl_scripts
+    
+    for dom_node in nodes:
+        node_type = dom_node.attributes['type'].value
+        loc = dom_node.attributes['loc'].value
+        node_location = [int(loc[:loc.index(",")]), int(loc[(loc.index(",") + 1):])]
+        node_tree = mat.node_tree
+        node_data = dom_node.attributes
+        
+        #Below here checks the type of the node and adds the correct type
+        
+        #INPUT TYPES
+        #This is totally crafty, but some of these nodes actually
+        # store their values as their output's default value!
+        if node_type == "ATTRIBUTE":
+            print ("ATTRIBUTE")
+            node = node_tree.nodes.new(node_type)
+            node.attribute_name = node_data['attribute'].value
+        
+        elif node_type == "CAMERA":
+            print ("CAMERA")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "FRESNEL":
+            print ("FRESNEL")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['IOR'].default_value = float(node_data['ior'].value)
+                
+        elif node_type == "LAYER_WEIGHT":
+            print ("LAYER_WEIGHT")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Blend'].default_value = float(node_data['blend'].value)
+                
+        elif node_type == "LIGHT_PATH":
+            print ("LIGHT_PATH")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "NEW_GEOMETRY":
+            print ("NEW_GEOMETRY")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "OBJECT_INFO":
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            print ("OBJECT_INFO")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "PARTICLE_INFO":
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            print ("PARTICLE_INFO")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "RGB":
+            print ("RGB")
+            node = node_tree.nodes.new(node_type)
+            node.outputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "TANGENT":
+            print ("TANGENT")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.direction_type = node_data['direction'].value
+            node.axis = node_data['axis'].value
+        
+        elif node_type == "TEX_COORD":
+            print ("TEX_COORD")
+            node = node_tree.nodes.new(node_type)
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.64 and "dupli" in node_data:
+                node.from_dupli = boolean(node_data['dupli'].value)
+        
+        elif node_type == "VALUE":
+            print ("VALUE")
+            node = node_tree.nodes.new(node_type)
+            node.outputs['Value'].default_value = float(node_data['value'].value)
+            
+            #OUTPUT TYPES
+        elif node_type == "OUTPUT_LAMP":
+            print ("OUTPUT_LAMP")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "OUTPUT_MATERIAL":
+            print ("OUTPUT_MATERIAL")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "OUTPUT_WORLD":
+            print ("OUTPUT_WORLD")
+            node = node_tree.nodes.new(node_type)
+        
+            #SHADER TYPES
+        elif node_type == "ADD_SHADER":
+            print ("ADD_SHADER")
+            node = node_tree.nodes.new(node_type)
+            
+        elif node_type == "AMBIENT_OCCLUSION":
+            print ("AMBIENT_OCCLUSION")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "BACKGROUND":
+            print ("BACKGROUND")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Strength'].default_value = float(node_data['strength'].value)
+            
+        elif node_type == "BSDF_ANISOTROPIC":
+            print ("BSDF_ANISOTROPIC")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Roughness'].default_value = float(node_data['roughness'].value)
+            node.inputs['Anisotropy'].default_value = float(node_data['anisotropy'].value)
+            node.inputs['Rotation'].default_value = float(node_data['rotation'].value)
+            
+        elif node_type == "BSDF_DIFFUSE":
+            print ("BSDF_DIFFUSE")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Roughness'].default_value = float(node_data['roughness'].value)
+        
+        elif node_type == "BSDF_GLASS":
+            print ("BSDF_GLASS")
+            node = node_tree.nodes.new(node_type)
+            node.distribution = node_data['distribution'].value
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Roughness'].default_value = float(node_data['roughness'].value)
+            node.inputs['IOR'].default_value = float(node_data['ior'].value)
+            
+        elif node_type == "BSDF_GLOSSY":
+            print ("BSDF_GLOSSY")
+            node = node_tree.nodes.new(node_type)
+            node.distribution = node_data['distribution'].value
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Roughness'].default_value = float(node_data['roughness'].value)
+        
+        elif node_type == "BSDF_REFRACTION":
+            print ("BSDF_REFRACTION")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.distribution = node_data['distribution'].value
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Roughness'].default_value = float(node_data['roughness'].value)
+            node.inputs['IOR'].default_value = float(node_data['ior'].value)
+        
+        elif node_type == "BSDF_TRANSLUCENT":
+            print ("BSDF_TRANSLUCENT")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "BSDF_TRANSPARENT":
+            print ("BSDF_TRANSPARENT")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "BSDF_VELVET":
+            print ("BSDF_VELVET")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Sigma'].default_value = float(node_data['sigma'].value)
+        
+        elif node_type == "EMISSION":
+            print ("EMISSION")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Strength'].default_value = float(node_data['strength'].value)
+        
+        elif node_type == "HOLDOUT":
+            print ("HOLDOUT")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "MIX_SHADER":
+            print ("MIX_SHADER")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Fac'].default_value = float(node_data['fac'].value)
+        
+            #TEXTURE TYPES
+        elif node_type == "TEX_BRICK":
+            print ("TEX_BRICK")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.offset = float(node_data['offset'].value)
+            node.offset_frequency = float(node_data['offset_freq'].value)
+            node.squash = float(node_data['squash'].value)
+            node.squash_frequency = float(node_data['squash_freq'].value)
+            node.inputs['Color1'].default_value = color(node_data['color1'].value)
+            node.inputs['Color2'].default_value = color(node_data['color2'].value)
+            node.inputs['Mortar'].default_value = color(node_data['mortar'].value)
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            node.inputs['Mortar Size'].default_value = float(node_data['mortar_size'].value)
+            node.inputs['Bias'].default_value = float(node_data['bias'].value)
+            node.inputs['Brick Width'].default_value = float(node_data['width'].value)
+            node.inputs['Row Height'].default_value = float(node_data['height'].value)
+            
+        elif node_type == "TEX_CHECKER":
+            print ("TEX_CHECKER")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color1'].default_value = color(node_data['color1'].value)
+            node.inputs['Color2'].default_value = color(node_data['color2'].value)
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            
+        elif node_type == "TEX_ENVIRONMENT":
+            print ("TEX_ENVIRONMENT")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.color_space = node_data['color_space'].value
+            node.projection = node_data['projection'].value
+            if 'image' in node_data:
+                if "file://" in node_data['image'].value:
+                    image_filepath = node_data['image'].value[7:]
+                    image_name = node_data['image'].value.split(os.sep)[-1]
+                    image_datablock = bpy.data.images.new(name=image_name, width=4, height=4)
+                    image_datablock.source = node_data['source'].value
+                    image_datablock.filepath = image_filepath
+                    node.image = image_datablock
+                    if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                        node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                        node.image_user.frame_start = int(node_data['frame_start'].value)
+                        node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                        node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                        node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+                elif "http://" in node_data['image'].value and bpy.context.scene.mat_lib_images_only_trusted == False:
+                    ext = "." + node_data['image'].value.split(".")[-1]
+                    image_name = node_data['image'].value.split("/")[-1][:-4]
+                    image_host = node_data['image'].value[7:].split("/")[0]
+                    image_location = node_data['image'].value[(7 + len(image_host)):]
+                    
+                    if ext.lower() != ".jpg" and ext.lower() != ".png":
+                        node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                        return
+                    
+                    connection = http.client.HTTPConnection(image_host)
+                    connection.request("GET", image_location)
+                    response = connection.getresponse().read()
+                    #Save image texture
+                    image_filepath = os.path.join(mat_lib_folder, "my-materials", image_name + ext)
+                    image_file = open(image_filepath, mode="w+b")
+                    image_file.write(response)
+                    image_file.close()
+                    image_datablock = bpy.data.images.new(name=(image_name + ext), width=4, height=4)
+                    image_datablock.source = node_data['source'].value
+                    image_datablock.filepath = image_filepath
+                    node.image = image_datablock
+                    if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                        node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                        node.image_user.frame_start = int(node_data['frame_start'].value)
+                        node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                        node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                        node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+                else:
+                    ext = "." + node_data['image'].value.split(".")[-1]
+                    image_name = node_data['image'].value[:-4]
+                    
+                    if ext.lower() != ".jpg" and ext.lower() != ".png":
+                        node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                        return
+                        
+                    if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                    elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                    elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)
+                    elif working_mode == "online":
+                        connection = http.client.HTTPConnection(mat_lib_host)
+                        connection.request("GET", mat_lib_location + "cycles/textures/" + image_name + ext)
+                        response = connection.getresponse().read()
+                        
+                        #Cache image texture
+                        if library == "composite":
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                            image_file = open(image_filepath, mode="w+b")
+                            image_file.write(response)
+                            image_file.close()
+                        else:
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                            image_file = open(image_filepath, mode="w+b")
+                            image_file.write(response)
+                            image_file.close()
+                    else:
+                        node_message = ['ERROR', "The image texture, \"%s\", is not cached; cannot download in offline mode." % (image_name + ext)]
+                        image_filepath = ""
+                    if image_filepath != "":
+                        image_datablock = bpy.data.images.new(name=(image_name + ext), width=4, height=4)
+                        image_datablock.source = node_data['source'].value
+                        image_datablock.filepath = image_filepath
+                        node.image = image_datablock
+                        if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                            node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                            node.image_user.frame_start = int(node_data['frame_start'].value)
+                            node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                            node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                            node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+            
+        elif node_type == "TEX_GRADIENT":
+            print ("TEX_GRADIENT")
+            node = node_tree.nodes.new(node_type)
+            node.gradient_type = node_data['gradient'].value
+        
+        elif node_type == "TEX_IMAGE":
+            print ("TEX_IMAGE")
+            node = node_tree.nodes.new(node_type)
+            node.color_space = node_data['color_space'].value
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63 and "projection" in node_data:
+                node.projection = node_data['projection'].value
+            if 'image' in node_data:
+                if "file://" in node_data['image'].value:
+                    image_filepath = node_data['image'].value[7:]
+                    image_name = node_data['image'].value.split(os.sep)[-1]
+                    image_datablock = bpy.data.images.new(name=image_name, width=4, height=4)
+                    image_datablock.source = node_data['source'].value
+                    image_datablock.filepath = image_filepath
+                    node.image = image_datablock
+                    if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                        node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                        node.image_user.frame_start = int(node_data['frame_start'].value)
+                        node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                        node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                        node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+                elif "http://" in node_data['image'].value and bpy.context.scene.mat_lib_images_only_trusted == False:
+                    ext = "." + node_data['image'].value.split(".")[-1]
+                    image_name = node_data['image'].value.split("/")[-1][:-4]
+                    image_host = node_data['image'].value[7:].split("/")[0]
+                    image_location = node_data['image'].value[(7 + len(image_host)):]
+                    
+                    if ext.lower() != ".jpg" and ext.lower() != ".png":
+                        node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                        return
+                    
+                    connection = http.client.HTTPConnection(image_host)
+                    connection.request("GET", image_location)
+                    response = connection.getresponse().read()
+                    #Save image texture
+                    image_filepath = os.path.join(mat_lib_folder, "my-materials", image_name + ext)
+                    image_file = open(image_filepath, mode="w+b")
+                    image_file.write(response)
+                    image_file.close()
+                    image_datablock = bpy.data.images.new(name=(image_name + ext), width=4, height=4)
+                    image_datablock.source = node_data['source'].value
+                    image_datablock.filepath = image_filepath
+                    node.image = image_datablock
+                    if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                        node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                        node.image_user.frame_start = int(node_data['frame_start'].value)
+                        node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                        node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                        node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+                else:
+                    ext = "." + node_data['image'].value.split(".")[-1]
+                    image_name = node_data['image'].value[:-4]
+                    
+                    if ext.lower() != ".jpg" and ext.lower() != ".png":
+                        node_message = ['ERROR', "The image file referenced by this image texture node is not .jpg or .png; not downloading."]
+                        return
+                        
+                    if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                    elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                    elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)):
+                        image_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "textures", image_name + ext)
+                    elif working_mode == "online":
+                        connection = http.client.HTTPConnection(mat_lib_host)
+                        connection.request("GET", mat_lib_location + "cycles/textures/" + image_name + ext)
+                        response = connection.getresponse().read()
+                        
+                        #Cache image texture
+                        if library == "composite":
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "textures", image_name + ext)
+                            image_file = open(image_filepath, mode="w+b")
+                            image_file.write(response)
+                            image_file.close()
+                        else:
+                            image_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "textures", image_name + ext)
+                            image_file = open(image_filepath, mode="w+b")
+                            image_file.write(response)
+                            image_file.close()
+                    else:
+                        node_message = ['ERROR', "The image texture, \"%s\", is not cached; cannot download in offline mode." % (image_name + ext)]
+                        image_filepath = ""
+                    if image_filepath != "":
+                        image_datablock = bpy.data.images.new(name=(image_name + ext), width=4, height=4)
+                        image_datablock.source = node_data['source'].value
+                        image_datablock.filepath = image_filepath
+                        node.image = image_datablock
+                        if node_data['source'].value == 'MOVIE' or node_data['source'].value == 'SEQUENCE':
+                            node.image_user.frame_duration = int(node_data['frame_duration'].value)
+                            node.image_user.frame_start = int(node_data['frame_start'].value)
+                            node.image_user.frame_offset = int(node_data['frame_offset'].value)
+                            node.image_user.use_cyclic = boolean(node_data['cyclic'].value)
+                            node.image_user.use_auto_refresh = boolean(node_data['auto_refresh'].value)
+                
+        elif node_type == "TEX_MAGIC":
+            print ("TEX_MAGIC")
+            node = node_tree.nodes.new(node_type)
+            node.turbulence_depth = int(node_data['depth'].value)
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            node.inputs['Distortion'].default_value = float(node_data['distortion'].value)
+        
+        elif node_type == "TEX_MUSGRAVE":
+            print ("TEX_MUSGRAVE")
+            node = node_tree.nodes.new(node_type)
+            node.musgrave_type = node_data['musgrave'].value
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            node.inputs['Detail'].default_value = float(node_data['detail'].value)
+            node.inputs['Dimension'].default_value = float(node_data['dimension'].value)
+            node.inputs['Lacunarity'].default_value = float(node_data['lacunarity'].value)
+            node.inputs['Offset'].default_value = float(node_data['offset'].value)
+            node.inputs['Gain'].default_value = float(node_data['gain'].value)
+        
+        elif node_type == "TEX_NOISE":
+            print ("TEX_NOISE")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            node.inputs['Detail'].default_value = float(node_data['detail'].value)
+            node.inputs['Distortion'].default_value = float(node_data['distortion'].value)
+                        
+        elif node_type == "TEX_SKY":
+            print ("TEX_SKY")
+            node = node_tree.nodes.new(node_type)
+            node.sun_direction = vector(node_data['sun_direction'].value)
+            node.turbidity = float(node_data['turbidity'].value)
+        
+        elif node_type == "TEX_VORONOI":
+            print ("TEX_VORONOI")
+            node = node_tree.nodes.new(node_type)
+            node.coloring = node_data['coloring'].value
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+        
+        elif node_type == "TEX_WAVE":
+            print ("TEX_WAVE")
+            node = node_tree.nodes.new(node_type)
+            node.wave_type = node_data['wave'].value
+            node.inputs['Scale'].default_value = float(node_data['scale'].value)
+            node.inputs['Distortion'].default_value = float(node_data['distortion'].value)
+            node.inputs['Detail'].default_value = float(node_data['detail'].value)
+            node.inputs['Detail Scale'].default_value = float(node_data['detail_scale'].value)
+        
+            #COLOR TYPES
+        elif node_type == "BRIGHTCONTRAST":
+            print ("BRIGHTCONTRAST")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Bright'].default_value = float(node_data['bright'].value)
+            node.inputs['Contrast'].default_value = float(node_data['contrast'].value)
+        
+        elif node_type == "GAMMA":
+            print ("GAMMA")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            node.inputs['Gamma'].default_value = float(node_data['gamma'].value)
+        
+        elif node_type == "HUE_SAT":
+            print ("HUE_SAT")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Hue'].default_value = float(node_data['hue'].value)
+            node.inputs['Saturation'].default_value = float(node_data['saturation'].value)
+            node.inputs['Value'].default_value = float(node_data['value'].value)
+            node.inputs['Fac'].default_value = float(node_data['fac'].value)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            
+        elif node_type == "INVERT":
+            print ("INVERT")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Fac'].default_value = float(node_data['fac'].value)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "LIGHT_FALLOFF":
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            print ("LIGHT_FALLOFF")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Strength'].default_value = float(node_data['strength'].value)
+            node.inputs['Smooth'].default_value = float(node_data['smooth'].value)
+        
+        elif node_type == "MIX_RGB":
+            print ("MIX_RGB")
+            node = node_tree.nodes.new(node_type)
+            node.blend_type = node_data['blend_type'].value
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63 and "clamp" in node_data:
+                node.use_clamp = boolean(node_data['clamp'].value)
+            node.inputs['Fac'].default_value = float(node_data['fac'].value)
+            node.inputs['Color1'].default_value = color(node_data['color1'].value)
+            node.inputs['Color2'].default_value = color(node_data['color2'].value)
+        
+            #VECTOR TYPES
+        elif node_type == "BUMP":
+            print ("BUMP")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.inputs["Strength"].default_value = float(node_data['strength'].value)
+            
+        elif node_type == "MAPPING":
+            print ("MAPPING")
+            node = node_tree.nodes.new(node_type)
+            node.translation = vector(node_data['translation'].value)
+            node.rotation = vector(node_data['rotation'].value)
+            node.scale = vector(node_data['scale'].value)
+            if boolean(node_data['use_min'].value):
+                node.use_min = True
+                node.min = vector(node_data['min'].value)
+            if boolean(node_data['use_max'].value):
+                node.use_max = True
+                node.max = vector(node_data['max'].value)
+            node.inputs['Vector'].default_value = vector(node_data['vector'].value)
+        
+        elif node_type == "NORMAL":
+            print ("NORMAL")
+            node = node_tree.nodes.new(node_type)
+            node.outputs['Normal'].default_value = vector(node_data['vector_output'].value)
+            node.inputs['Normal'].default_value = vector(node_data['vector_input'].value)
+            
+        elif node_type == "NORMAL_MAP":
+            print ("NORMAL_MAP")
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            node = node_tree.nodes.new(node_type)
+            node.space = node_data['space'].value
+            node.uv_map = node_data['uv_map'].value
+            node.inputs["Strength"].default_value = float(node_data['strength'].value)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+            
+            #CONVERTOR TYPES
+        elif node_type == "COMBRGB":
+            print ("COMBRGB")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['R'].default_value = float(node_data['red'].value)
+            node.inputs['G'].default_value = float(node_data['green'].value)
+            node.inputs['B'].default_value = float(node_data['blue'].value)
+        
+        elif node_type == "MATH":
+            print ("MATH")
+            node = node_tree.nodes.new(node_type)
+            node.operation = node_data['operation'].value
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63 and "clamp" in node_data:
+                node.use_clamp = boolean(node_data['clamp'].value)
+            node.inputs[0].default_value = float(node_data['value1'].value)
+            node.inputs[1].default_value = float(node_data['value2'].value)
+        
+        elif node_type == "RGBTOBW":
+            print ("RGBTOBW")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Color'].default_value = color(node_data['color'].value)
+        
+        elif node_type == "SEPRGB":
+            print ("SEPRGB")
+            node = node_tree.nodes.new(node_type)
+            node.inputs['Image'].default_value = color(node_data['image'].value)
+        
+        elif node_type == "VALTORGB":
+            print ("VALTORGB")
+            node = node_tree.nodes.new(node_type)
+            node.color_ramp.interpolation = node_data['interpolation'].value
+            node.inputs['Fac'].default_value = float(node_data['fac'].value)
+            
+            #Delete the first stop which comes with the ramp by default
+            node.color_ramp.elements.remove(node.color_ramp.elements[0])
+            
+            # The first stop will be "stop1", so set i to 1
+            i = 1
+            while i <= int(node_data['stops'].value):
+                #Each color stop element is formatted like this:
+                #            stop1="0.35|rgba(1, 0.5, 0.8, 0.5)"
+                #The "|" separates the stop's position and color.
+                element_data = node_data[("stop" + str(i))].value.split('|')
+                if i == 1:
+                    element = node.color_ramp.elements[0]
+                    element.position = float(element_data[0])
+                else:
+                    element = node.color_ramp.elements.new(float(element_data[0]))
+                element.color = color(element_data[1])
+                i = i + 1
+            
+        elif node_type == "VECT_MATH":
+            print ("VECT_MATH")
+            node = node_tree.nodes.new(node_type)
+            node.operation = node_data['operation'].value
+            node.inputs[0].default_value = vector(node_data['vector1'].value)
+            node.inputs[1].default_value = vector(node_data['vector2'].value)
+            
+            #MISCELLANEOUS NODE TYPES
+        elif node_type == "FRAME":
+            #Don't attempt to add frame nodes in builds previous
+            #to rev51926, as Blender's nodes.new() operator was
+            #unable to add FRAME nodes. Was fixed with rev51926.
+            if int(bpy.app.build_revision.decode()) > 51925:
+                print("FRAME")
+                node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "REROUTE":
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.64:
+                node_message = ['ERROR', """The material file contains the node \"%s\".
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly.""" % node_type]
+                return
+            print ("REROUTE")
+            node = node_tree.nodes.new(node_type)
+        
+        elif node_type == "SCRIPT":
+            if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.65:
+                node_message = ['ERROR', """The material file contains an OSL script node.
+This node is not available in the Blender version you are currently using.
+You may need a newer version of Blender for this material to work properly."""]
+                return
+            print ("SCRIPT")
+            node = node_tree.nodes.new(node_type)
+            node.mode = node_data['mode'].value
+            if node_data['mode'] == 'EXTERNAL':
+                if 'script' in node_data:
+                    if "file://" in node_data['script'].value:
+                        node.filepath = node_data['script'].value[7:]
+                    elif "http://" in node_data['script'].value and bpy.context.scene.mat_lib_osl_only_trusted == False:
+                        ext = "." + node_data['script'].value.split(".")[-1]
+                        script_name = node_data['script'].value.split("/")[-1][:-4]
+                        osl_host = node_data['script'].value[7:].split("/")[0]
+                        script_location = node_data['script'].value[(7 + len(osl_host)):]
+                        
+                        if ext.lower() != ".osl" and ext.lower() != ".oso":
+                            node_message = ['ERROR', "The OSL script file referenced by this script node is not .osl or .oso; not downloading."]
+                            return
+                        
+                        connection = http.client.HTTPConnection(osl_host)
+                        connection.request("GET", script_location + script_name + ext)
+                        response = connection.getresponse().read()
+                        #Save OSL script
+                        osl_filepath = os.path.join(mat_lib_folder, "my-materials", script_name + ext)
+                        osl_file = open(osl_filepath, mode="w+b")
+                        osl_file.write(response)
+                        osl_file.close()
+                        node.filepath = osl_filepath
+                        
+                    else:
+                        ext = "." + node_data['script'].value.split(".")[-1]
+                        script_name = node_data['script'].value[:-4]
+                        
+                        if ext.lower() != ".osl" and ext.lower() != ".oso":
+                            node_message = ['ERROR', "The OSL script file referenced by this script node is not .osl or .oso; not downloading."]
+                            return
+                        
+                        if library == "composite" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)):
+                            osl_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                        elif library != "bundled" and os.path.exists(os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)):
+                            osl_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                        elif library == "bundled" and os.path.exists(os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)):
+                            osl_filepath = os.path.join(mat_lib_folder, "bundled", "cycles", "scripts", script_name + ext)
+                        elif working_mode == "online":
+                            connection = http.client.HTTPConnection(mat_lib_host)
+                            connection.request("GET", mat_lib_location + "cycles/scripts/" + script_name + ext)
+                            response = connection.getresponse().read()
+                            
+                            #Cache OSL script
+                            if library == "composite":
+                                osl_filepath = os.path.join(mat_lib_folder, mat_lib_host, "cycles", "scripts", script_name + ext)
+                                osl_file = open(osl_filepath, mode="w+b")
+                                osl_file.write(response)
+                                osl_file.close()
+                            else:
+                                osl_filepath = os.path.join(mat_lib_folder, mat_lib_host, library, "cycles", "scripts", script_name + ext)
+                                osl_file = open(osl_filepath, mode="w+b")
+                                osl_file.write(response)
+                                osl_file.close()
+                        else:
+                            node_message = ['ERROR', "The OSL script, \"%s\", is not cached; cannot download in offline mode." % (script_name + ext)]
+                            osl_filepath = ""
+                        node.filepath = osl_filepath
+            else:
+                if 'script' in node_data:
+                    node.script = osl_scripts[int(node_data['script'].value)]
+            
+        else:
+            node_message = ['ERROR', """The material file contains the node name \"%s\", which is not known.
+The material file may contain an error, or you may need to check for updates to this add-on.""" % node_type]
+            return
+        node.location = node_location
+        
+        #Give the node a custom label
+        if 'label' in node_data:
+            node.label = node_data['label'].value
+        
+        #Give the node a custom color
+        if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63:
+            if 'custom_color' in node_data:
+                node.use_custom_color = True
+                node.color = color(node_data['custom_color'].value)
+        
+        #Collapse node if needed
+        if 'hide' in node_data:
+            node.hide = boolean(node_data['hide'].value)
+
+def boolean(string):
+    if string == "True":
+        boolean = True
+    elif string == "False":
+        boolean = False
+    elif string == "true":
+        boolean = True
+    elif string == "false":
+        boolean = False
+    else:
+        print('Error converting string to a boolean')
+        return
+    return boolean
+
+def color(string):
+    if "rgba" in string:
+        colors = string[5:-1].replace(" ", "").split(",")
+        r = float(colors[0])
+        g = float(colors[1])
+        b = float(colors[2])
+        a = float(colors[3])
+        color = [r,g,b,a]
+    elif "rgb" in string:
+        colors = string[4:-1].replace(" ", "").split(",")
+        r = float(colors[0])
+        g = float(colors[1])
+        b = float(colors[2])
+        color = [r,g,b]
+    else:
+        print('Error converting string to a color')
+        return
+    return color
+
+def vector(string):
+    import mathutils
+    if "Vector" in string:
+        vectors = string[7:-1].replace(" ", "").split(",")
+        x = float(vectors[0])
+        y = float(vectors[1])
+        z = float(vectors[2])
+        vector = mathutils.Vector((x, y, z))
+    else:
+        print('Error converting string to a vector')
+        return
+    return vector
+
+class MaterialConvert(bpy.types.Operator):
+    '''Convert material(s) to the .bcm format'''
+    bl_idname = "material.libraryconvert"
+    bl_label = "Convert Cycles Material to .bcm"
+    save_location = bpy.props.StringProperty()
+    all_materials = bpy.props.BoolProperty()
+
+    def execute(self, context):
+        global material_file_contents
+        global script_stack
+        
+        if self.all_materials:
+            #For all_materials, access the materials with an index
+            mat = 0
+            loop_length = len(bpy.data.materials)
+        else:
+            if not context.active_object:
+                if not context.active_object.get("active_material"):
+                    self.save_location = ""
+                    self.all_materials = False
+                    self.report({'ERROR'}, "No material selected!")
+                    return {'CANCELLED'}
+                self.save_location = ""
+                self.all_materials = False
+                self.report({'ERROR'}, "No object selected!")
+                return {'CANCELLED'}
+            #For single materials, access the materials with a name
+            mat = context.active_object.active_material.name
+            loop_length = 1
+        
+        if self.save_location is "":
+            if context.scene.mat_lib_bcm_write is not "":
+                txt = context.scene.mat_lib_bcm_write
+            else:
+                txt = "bcm_file"
+            
+            if txt not in bpy.data.texts:
+                bpy.data.texts.new(txt)
+        
+        j = 0
+        while j < loop_length:
+            if self.save_location is not "":
+                if self.all_materials:
+                    filename = bpy.data.materials[mat].name.replace("(", "")
+                else:
+                    filename = mat.replace("(", "")
+                filename = filename.replace(")", "")
+                filename = filename.replace("!", "")
+                filename = filename.replace("@", "")
+                filename = filename.replace("#", "")
+                filename = filename.replace("$", "")
+                filename = filename.replace("%", "")
+                filename = filename.replace("&", "")
+                filename = filename.replace("*", "")
+                filename = filename.replace("/", "")
+                filename = filename.replace("|", "")
+                filename = filename.replace("\\", "")
+                filename = filename.replace("'", "")
+                filename = filename.replace("\"", "")
+                filename = filename.replace("?", "")
+                filename = filename.replace(";", "")
+                filename = filename.replace(":", "")
+                filename = filename.replace("[", "")
+                filename = filename.replace("]", "")
+                filename = filename.replace("{", "")
+                filename = filename.replace("}", "")
+                filename = filename.replace("`", "")
+                filename = filename.replace("~", "")
+                filename = filename.replace("+", "")
+                filename = filename.replace("=", "")
+                filename = filename.replace(".", "")
+                filename = filename.replace(",", "")
+                filename = filename.replace("<", "")
+                filename = filename.replace(">", "")
+                filename = filename.replace(" ", "_")
+                filename = filename.replace("-", "_")
+                filename = filename.lower()
+        
+            material_file_contents = ""
+            write('<?xml version="1.0" encoding="UTF-8"?>')
+            
+            red = smallFloat(bpy.data.materials[mat].diffuse_color.r)
+            green = smallFloat(bpy.data.materials[mat].diffuse_color.g)
+            blue = smallFloat(bpy.data.materials[mat].diffuse_color.b)
+            write("\n<material view_color=\"%s\"" % ("rgb(" + red + ", " + green + ", " + blue + ")"))
+            
+            write(" sample_lamp=\"" + str(bpy.data.materials[mat].cycles.sample_as_light) + "\">")
+            write("\n\t<nodes>")
+            
+            group_warning = False
+            frame_warning = False
+            for node in bpy.data.materials[mat].node_tree.nodes:
+                if "NodeGroup" in str(node.items):
+                    node_type = "GROUP"
+                    group_warning = True
+                    
+                elif node.type == 'FRAME' and int(bpy.app.build_revision.decode()) < 51926:
+                    #Don't attempt to write frame nodes in builds previous
+                    #to rev51926, as Blender's nodes.new() operator was
+                    #unable to add FRAME nodes. Was fixed with rev51926.
+                    frame_warning = True
+                    print("Skipping frame node; this Blender version will not support adding it back."\
+                        "\nFrame nodes are not supported on builds prior to rev51926.")
+                else:
+                    node_type = node.type
+                    #Write node opening bracket
+                    write("\n\t\t<node ")
+                    
+                    #Write node type
+                    write("type=\"%s\"" % node_type)
+                
+                    #Write node custom color
+                    if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63:
+                        if node.use_custom_color:
+                            r = smallFloat(node.color.r)
+                            g = smallFloat(node.color.g)
+                            b = smallFloat(node.color.b)
+                            write(" custom_color=\"%s\"" % ("rgb(" + r + ", " + g + ", " + b + ")"))
+                    
+                    #Write node label
+                    if node.label:
+                        write(" label=\"%s\"" % node.label)
+                    
+                    #Write node hidden-ness
+                    if node.hide:
+                        write(" hide=\"True\"")
+                        
+                    #Write node data
+                    writeNodeData(node)
+                    
+                    #Write node closing bracket
+                    write(" />")
+            
+            write("\n\t</nodes>")
+            
+            write("\n\t<links>")
+            writeNodeLinks(bpy.data.materials[mat].node_tree)
+            write("\n\t</links>")
+            if script_stack:
+                write("\n\t<scripts>")
+                i = 0
+                while i < len(script_stack):
+                    write("\n\t\t<script name=\"%s\" id=\"%s\">\n" % (script_stack[i], str(i)))
+                    first_line = True
+                    for l in bpy.data.texts[script_stack[i]].lines:
+                        if first_line == True:
+                            write(l.body)
+                            first_line = False
+                        else:
+                            write("<br />" + l.body)
+                    write("\n\t\t</script>")
+                    i += 1
+                write("\n\t</scripts>")
+                script_stack = []
+            write("\n</material>")
+            
+            if self.save_location == "":
+                if group_warning:
+                    self.report({'ERROR'}, "Material \"" + mat + "\" contains a group node (not supported). Please un-group the nodes and try again.")
+                else:
+                    bpy.data.texts[txt].clear()
+                    bpy.data.texts[txt].write(material_file_contents)
+                    if not self.all_materials:
+                        if frame_warning:
+                            self.report({'WARNING'}, "Material \"" + mat + "\" contains a frame node, which was skipped; see console for details.")
+                        else:
+                            self.report({'INFO'}, "Material \"" + mat + "\" written to Text \"" + txt + "\" as .bcm")
+            else:
+                if group_warning:
+                    self.report({'ERROR'}, "Material \"" + mat + "\" contains a group node (not supported). Please un-group the nodes and try again.")
+                else:
+                    print(context.scene.mat_lib_bcm_save_location + filename + ".bcm")
+                    bcm_file = open(context.scene.mat_lib_bcm_save_location + filename + ".bcm", mode="w", encoding="UTF-8")
+                    bcm_file.write(material_file_contents)
+                    bcm_file.close()
+                    if not self.all_materials:
+                        if frame_warning:
+                            self.report({'WARNING'}, "Material \"" + mat + "\" contains a frame node which was skipped; see console for details.")
+                            self.report({'WARNING'}, "Material \"" + mat + "\" contains a frame node which was skipped; see console for details.")
+                        else:
+                            self.report({'INFO'}, "Material \"" + mat + "\" saved to \"" + filename + ".bcm\"")
+            j += 1
+            if self.all_materials:
+                mat += 1
+        if self.all_materials and not group_warning and not frame_warning:
+            self.report({'INFO'}, "All materials successfully saved!")
+        
+        self.save_location = ""
+        self.all_materials = False
+        return {'FINISHED'}
+
+def writeNodeData(node):
+    global material_file_contents
+    global script_stack
+    
+    I = node.inputs
+    O = node.outputs
+    
+    if "NodeGroup" in str(node.items):
+        node_type = "GROUP"
+    else:
+        node_type = node.type
+        
+    if node_type == "GROUP":
+        print("GROUP NODE!")
+        write("ERROR: GROUP NODES NOT YET SUPPORTED.")
+        
+        #INPUT TYPES
+    elif node_type == "ATTRIBUTE":
+        print("ATTRIBUTE")
+        write(" attribute=\"%s\"" % node.attribute_name)
+    
+    elif node_type == "CAMERA":
+        print("CAMERA")
+        
+    elif node_type == "FRESNEL":
+        print("FRESNEL")
+        write(" ior=\"%s\"" % smallFloat(I['IOR'].default_value))
+    
+    elif node_type == "LAYER_WEIGHT":
+        print("LAYER_WEIGHT")
+        write(" blend=\"%s\"" % smallFloat(I['Blend'].default_value))
+    
+    elif node_type == "LIGHT_PATH":
+        print("LIGHT_PATH")
+    
+    elif node_type == "NEW_GEOMETRY":
+        print("NEW_GEOMETRY")
+    
+    elif node_type == "OBJECT_INFO":
+        print("OBJECT_INFO")
+    
+    elif node_type == "PARTICLE_INFO":
+        print("PARTICLE_INFO")
+    
+    elif node_type == "RGB":
+        print("RGB")
+        write(" color=\"%s\"" % rgba(O['Color'].default_value))
+    
+    elif node_type == "TANGENT":
+        print("TANGENT")
+        write(" direction=\"%s\"" % node.direction_type)
+        write(" axis=\"%s\"" % node.axis)
+    
+    elif node_type == "TEX_COORD":
+        print("TEX_COORD")
+        if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.64:
+            write(" dupli=\"%s\"" % node.from_dupli)
+        else:
+            write(" dupli=\"False\"")
+    
+    elif node_type == "VALUE":
+        print("VALUE")
+        write(" value=\"%s\"" % smallFloat(O['Value'].default_value))
+        
+        #OUTPUT TYPES
+    elif node_type == "OUTPUT_LAMP":
+        print("OUTPUT_LAMP")
+    
+    elif node_type == "OUTPUT_MATERIAL":
+        print("OUTPUT_MATERIAL")
+    
+    elif node_type == "OUTPUT_WORLD":
+        print("OUTPUT_WORLD")
+    
+        #SHADER TYPES
+    elif node_type == "ADD_SHADER":
+        print("ADD_SHADER")
+    
+    elif node_type == "AMBIENT_OCCLUSION":
+        print("AMBIENT_OCCLUSION")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+    
+    elif node_type == "BACKGROUND":
+        print("BACKGROUND")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" strength=\"%s\"" % smallFloat(I['Strength'].default_value))
+    
+    elif node_type == "BSDF_ANISOTROPIC":
+        print("BSDF_ANISOTROPIC")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" roughness=\"%s\"" % smallFloat(I['Roughness'].default_value))
+        write(" anisotropy=\"%s\"" % smallFloat(I['Anisotropy'].default_value))
+        write(" rotation=\"%s\"" % smallFloat(I['Rotation'].default_value))
+    
+    elif node_type == "BSDF_DIFFUSE":
+        print("BSDF_DIFFUSE")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" roughness=\"%s\"" % smallFloat(I['Roughness'].default_value))
+    
+    elif node_type == "BSDF_GLASS":
+        print("BSDF_GLASS")
+        write(" distribution=\"%s\"" % node.distribution)
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" roughness=\"%s\"" % smallFloat(I['Roughness'].default_value))
+        write(" ior=\"%s\"" % smallFloat(I['IOR'].default_value))
+    
+    elif node_type == "BSDF_GLOSSY":
+        print("BSDF_GLOSSY")
+        write(" distribution=\"%s\"" % node.distribution)
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" roughness=\"%s\"" % smallFloat(I['Roughness'].default_value))
+    
+    elif node_type == "BSDF_REFRACTION":
+        print("BSDF_REFRACTION")
+        write(" distribution=\"%s\"" % node.distribution)
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" roughness=\"%s\"" % smallFloat(I['Roughness'].default_value))
+        write(" ior=\"%s\"" % smallFloat(I['IOR'].default_value))
+    
+    elif node_type == "BSDF_TRANSLUCENT":
+        print("BSDF_TRANSLUCENT")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+    
+    elif node_type == "BSDF_TRANSPARENT":
+        print("BSDF_TRANSPARENT")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+    
+    elif node_type == "BSDF_VELVET":
+        print("BSDF_VELVET")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" sigma=\"%s\"" % smallFloat(I['Sigma'].default_value))
+    
+    elif node_type == "EMISSION":
+        print("EMISSION")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" strength=\"%s\"" % smallFloat(I['Strength'].default_value))
+    
+    elif node_type == "HOLDOUT":
+        print("HOLDOUT")
+    
+    elif node_type == "MIX_SHADER":
+        print("MIX_SHADER")
+        write(" fac=\"%s\"" % smallFloat(I['Fac'].default_value))
+        
+        #TEXTURE TYPES
+    elif node_type == "TEX_BRICK":
+        print ("TEX_BRICK")
+        write(" offset=\"%s\"" % smallFloat(node.offset))
+        write(" offset_freq=\"%s\"" % str(node.offset_frequency))
+        write(" squash=\"%s\"" % smallFloat(node.squash))
+        write(" squash_freq=\"%s\"" % str(node.squash_frequency))
+        write(" color1=\"%s\"" % rgba(I['Color1'].default_value))
+        write(" color2=\"%s\"" % rgba(I['Color2'].default_value))
+        write(" mortar=\"%s\"" % rgba(I['Mortar'].default_value))
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+        write(" mortar_size=\"%s\"" % smallFloat(I['Mortar Size'].default_value))
+        write(" bias=\"%s\"" % smallFloat(I['Bias'].default_value))
+        write(" width=\"%s\"" % smallFloat(I['Brick Width'].default_value))
+        write(" height=\"%s\"" % smallFloat(I['Row Height'].default_value))
+            
+    elif node_type == "TEX_CHECKER":
+        print("TEX_CHECKER")
+        write(" color1=\"%s\"" % rgba(I['Color1'].default_value))
+        write(" color2=\"%s\"" % rgba(I['Color2'].default_value))
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+    
+    elif node_type == "TEX_ENVIRONMENT":
+        print("TEX_ENVIRONMENT")
+        if node.image:
+            write(" image=\"file://%s\"" % os.path.realpath(bpy.path.abspath(node.image.filepath)))
+            write(" source=\"%s\"" % node.image.source)
+            if node.image.source == "SEQUENCE" or node.image.source == "MOVIE":
+                write(" frame_duration=\"%s\"" % str(node.image_user.frame_duration))
+                write(" frame_start=\"%s\"" % str(node.image_user.frame_start))
+                write(" frame_offset=\"%s\"" % str(node.image_user.frame_offset))
+                write(" cyclic=\"%s\"" % str(node.image_user.use_cyclic))
+                write(" auto_refresh=\"%s\"" % str(node.image_user.use_auto_refresh))
+        else:
+            write(" image=\"\"")
+        write(" color_space=\"%s\"" % node.color_space)
+        write(" projection=\"%s\"" % node.projection)
+    
+    elif node_type == "TEX_GRADIENT":
+        print("TEX_GRADIENT")
+        write(" gradient=\"%s\"" % node.gradient_type)
+    
+    elif node_type == "TEX_IMAGE":
+        print("TEX_IMAGE")
+        if node.image:
+            write(" image=\"file://%s\"" % os.path.realpath(bpy.path.abspath(node.image.filepath)))
+            write(" source=\"%s\"" % node.image.source)
+            if node.image.source == "SEQUENCE" or node.image.source == "MOVIE":
+                write(" frame_duration=\"%s\"" % str(node.image_user.frame_duration))
+                write(" frame_start=\"%s\"" % str(node.image_user.frame_start))
+                write(" frame_offset=\"%s\"" % str(node.image_user.frame_offset))
+                write(" cyclic=\"%s\"" % str(node.image_user.use_cyclic))
+                write(" auto_refresh=\"%s\"" % str(node.image_user.use_auto_refresh))
+        else:
+            write(" image=\"\"")
+        write(" color_space=\"%s\"" % node.color_space)
+        if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63:
+            write(" projection=\"%s\"" % node.projection)
+            if node.projection == "BOX":
+                write(" blend=\"%s\"" % smallFloat(node.projection_blend))
+        else:
+            write(" projection=\"FLAT\"")
+    
+    elif node_type == "TEX_MAGIC":
+        print("TEX_MAGIC")
+        write(" depth=\"%s\"" % str(node.turbulence_depth))
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+        write(" distortion=\"%s\"" % smallFloat(I['Distortion'].default_value))
+    
+    elif node_type == "TEX_MUSGRAVE":
+        print("TEX_MUSGRAVE")
+        write(" musgrave=\"%s\"" % node.musgrave_type)
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+        write(" detail=\"%s\"" % smallFloat(I['Detail'].default_value))
+        write(" dimension=\"%s\"" % smallFloat(I['Dimension'].default_value))
+        write(" lacunarity=\"%s\"" % smallFloat(I['Lacunarity'].default_value))
+        write(" offset=\"%s\"" % smallFloat(I['Offset'].default_value))
+        write(" gain=\"%s\"" % smallFloat(I['Gain'].default_value))
+    
+    elif node_type == "TEX_NOISE":
+        print("TEX_NOISE")
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+        write(" detail=\"%s\"" % smallFloat(I['Detail'].default_value))
+        write(" distortion=\"%s\"" % smallFloat(I['Distortion'].default_value))
+    
+    elif node_type == "TEX_SKY":
+        print("TEX_SKY")
+        write(" sun_direction=\"%s\"" % smallVector(node.sun_direction))
+        write(" turbidity=\"%s\"" % smallFloat(node.turbidity))
+    
+    elif node_type == "TEX_VORONOI":
+        print("TEX_VORONOI")
+        write(" coloring=\"%s\"" % node.coloring)
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+    
+    elif node_type == "TEX_WAVE":
+        print("TEX_WAVE")
+        write(" wave=\"%s\"" % node.wave_type)
+        write(" scale=\"%s\"" % smallFloat(I['Scale'].default_value))
+        write(" distortion=\"%s\"" % smallFloat(I['Distortion'].default_value))
+        write(" detail=\"%s\"" % smallFloat(I['Detail'].default_value))
+        write(" detail_scale=\"%s\"" % smallFloat(I['Detail Scale'].default_value))
+    
+        #COLOR TYPES
+    elif node_type == "BRIGHTCONTRAST":
+        print("BRIGHTCONTRAST")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" bright=\"%s\"" % smallFloat(I['Bright'].default_value))
+        write(" contrast=\"%s\"" % smallFloat(I['Contrast'].default_value))
+    
+    elif node_type == "GAMMA":
+        print("GAMMA")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        write(" gamma=\"%s\"" % smallFloat(I['Gamma'].default_value))
+    
+    elif node_type == "HUE_SAT":
+        print("HUE_SAT")
+        write(" hue=\"%s\"" % smallFloat(I['Hue'].default_value))
+        write(" saturation=\"%s\"" % smallFloat(I['Saturation'].default_value))
+        write(" value=\"%s\"" % smallFloat(I['Value'].default_value))
+        write(" fac=\"%s\"" % smallFloat(I['Fac'].default_value))
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+    
+    elif node_type == "LIGHT_FALLOFF":
+        print("LIGHT_FALLOFF")
+        write(" strength=\"%s\"" % smallFloat(I['Strength'].default_value))
+        write(" smooth=\"%s\"" % smallFloat(I['Smooth'].default_value))
+    
+    elif node_type == "MIX_RGB":
+        print("MIX_RGB")
+        write(" blend_type=\"%s\"" % node.blend_type)
+        if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63:
+            write(" use_clamp=\"%s\"" % str(node.use_clamp))
+        write(" fac=\"%s\"" % smallFloat(I['Fac'].default_value))
+        write(" color1=\"%s\"" % rgba(I[1].default_value))
+        write(" color2=\"%s\"" % rgba(I[2].default_value))
+    
+    elif node_type == "INVERT":
+        print("INVERT")
+        write(" fac=\"%s\"" % smallFloat(I['Fac'].default_value))
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        
+        #VECTOR TYPES
+    elif node_type == "BUMP":
+        print("BUMP")
+        write(" strength=\"%s\"" % smallFloat(I['Strength'].default_value))
+        
+    elif node_type == "MAPPING":
+        print("MAPPING")
+        write(" translation=\"%s\"" % smallVector(node.translation))
+        write(" rotation=\"%s\"" % smallVector(node.rotation))
+        write(" scale=\"%s\"" % smallVector(node.scale))
+        
+        write(" use_min=\"%s\"" % str(node.use_min))
+        if node.use_min:
+            write(" min=\"%s\"" % smallVector(node.min))
+        
+        write(" use_max=\"%s\"" % str(node.use_max))
+        if node.use_max:
+            write(" max=\"%s\"" % smallVector(node.max))
+        
+        vec = I[0].default_value
+        write(" vector=\"%s\"" % smallVector(I['Vector'].default_value))
+    
+    elif node_type == "NORMAL":
+        print("NORMAL")
+        write(" vector_output=\"%s\"" % smallVector(O['Normal'].default_value))
+        write(" vector_input=\"%s\"" % smallVector(I['Normal'].default_value))
+        
+    elif node_type == "NORMAL_MAP":
+        print("NORMAL_MAP")
+        write(" space=\"%s\"" % node.space)
+        write(" uv_map=\"%s\"" % node.uv_map)
+        write(" strength=\"%s\"" % smallFloat(I['Strength'].default_value))
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+        
+        #CONVERTER TYPES
+    elif node_type == "COMBRGB":
+        print("COMBRGB")
+        write(" red=\"%s\"" % smallFloat(I['R'].default_value))
+        write(" green=\"%s\"" % smallFloat(I['G'].default_value))
+        write(" blue=\"%s\"" % smallFloat(I['B'].default_value))
+    
+    elif node_type == "MATH":
+        print("MATH")
+        write(" operation=\"%s\"" % node.operation)
+        if bpy.app.version[0] + (bpy.app.version[1] / 100.0) > 2.63:
+            write(" use_clamp=\"%s\"" % str(node.use_clamp))
+        write(" value1=\"%s\"" % smallFloat(I[0].default_value))
+        write(" value2=\"%s\"" % smallFloat(I[1].default_value))
+        
+    elif node_type == "RGBTOBW":
+        print ("RGBTOBW")
+        write(" color=\"%s\"" % rgba(I['Color'].default_value))
+    
+    elif node_type == "SEPRGB":
+        print("SEPRGB")
+        write(" image=\"%s\"" % rgba(I['Image'].default_value))
+    
+    elif node_type == "VALTORGB":
+        print("VALTORGB")
+        write(" interpolation=\"%s\"" % str(node.color_ramp.interpolation))
+        write(" fac=\"%s\"" % smallFloat(I['Fac'].default_value))
+        write(" stops=\"%s\"" % str(len(node.color_ramp.elements)))
+        
+        k = 1
+        while k <= len(node.color_ramp.elements):
+            write(" stop%s=\"%s\"" % 
+            (str(k), 
+             (smallFloat(node.color_ramp.elements[k-1].position) +
+             "|" + 
+             rgba(node.color_ramp.elements[k-1].color))
+            ))
+            k += 1
+    
+    elif node_type == "VECT_MATH":
+        print("VECT_MATH")
+        write(" operation=\"%s\"" % node.operation)
+        write(" vector1=\"%s\"" % smallVector(I[0].default_value))
+        write(" vector2=\"%s\"" % smallVector(I[1].default_value))
+        
+        #MISCELLANEOUS NODE TYPES
+    elif node_type == "FRAME":
+        print("FRAME")
+    
+    elif node_type == "REROUTE":
+        print("REROUTE")
+    
+    elif node_type == "SCRIPT":
+        print("SCRIPT")
+        write(" mode=\"%s\"" % node.mode)
+        if node.mode == 'EXTERNAL':
+            if node.filepath:
+                write(" script=\"file://%s\"" % os.path.realpath(bpy.path.abspath(node.filepath)))
+        else:
+            if node.script:
+                write(" script=\"%s\"" % len(script_stack))
+                script_stack.append(node.script.name)
+        
+    else:
+        write(" ERROR: UNKNOWN NODE TYPE. ")
+        return
+    writeLocation(node)
+    
+def rgba(color):
+    red = smallFloat(color[0])
+    green = smallFloat(color[1])
+    blue = smallFloat(color[2])
+    alpha = smallFloat(color[3])
+    return ("rgba(" + red + ", " + green + ", " + blue + ", " + alpha + ")")
+
+def smallFloat(float):
+    if len(str(float)) < (6 + str(float).index(".")):
+        return str(float)
+    else:
+        return str(float)[:(6 + str(float).index("."))]
+
+def smallVector(vector):
+    return "Vector(" + smallFloat(vector[0]) + ", " + smallFloat(vector[1]) + ", " + smallFloat(vector[2]) + ")"
+
+def write (string):
+    global material_file_contents
+    material_file_contents += string
+
+def writeLocation(node):
+    global material_file_contents
+    #X location
+    x = str(int(node.location.x))
+    #Y location
+    y = str(int(node.location.y))
+    
+    material_file_contents += (" loc=\"" + x + ", " + y + "\"")
+    
+def writeNodeLinks(node_tree):
+    global material_file_contents
+    
+    #Loop through the links
+    i = 0
+    while i < len(node_tree.links):
+        material_file_contents += ("\n\t\t<link ")
+        
+        to_node_name = node_tree.links[i].to_node.name
+        #Loop through nodes to check name
+        e = 0
+        while e < len(node_tree.nodes):
+            #Write the index if name matches
+            if to_node_name == node_tree.nodes[e].name:
+                material_file_contents += "to=\"%d\"" % e
+                #Set input socket's name
+                to_socket = node_tree.links[i].to_socket.path_from_id()
+                material_file_contents += (" input=\"%s\"" % to_socket[(to_socket.index("inputs[") + 7):-1])
+                e = len(node_tree.nodes)
+            e = e + 1
+            
+        
+        from_node_name = node_tree.links[i].from_node.name
+        #Loop through nodes to check name
+        e = 0
+        while e < len(node_tree.nodes):
+            #Write the index if name matches
+            if from_node_name == node_tree.nodes[e].name:
+                material_file_contents += " from=\"%d\"" % e
+                #Set input socket's name
+                from_socket = node_tree.links[i].from_socket.path_from_id()
+                material_file_contents += (" output=\"%s\"" % from_socket[(from_socket.index("outputs[") + 8):-1])
+                e = len(node_tree.nodes)
+            e = e + 1
+        material_file_contents += (" />")
+        i = i + 1
+
+
+def register():
+    bpy.utils.register_class(OnlineMaterialLibraryPanel)
+    bpy.utils.register_class(LibraryConnect)
+    bpy.utils.register_class(LibraryInfo)
+    bpy.utils.register_class(LibrarySettings)
+    bpy.utils.register_class(LibraryTools)
+    bpy.utils.register_class(LibraryHome)
+    bpy.utils.register_class(ViewMaterial)
+    bpy.utils.register_class(MaterialDetailView)
+    bpy.utils.register_class(LibraryClearCache)
+    bpy.utils.register_class(LibraryPreview)
+    bpy.utils.register_class(AddLibraryMaterial)
+    bpy.utils.register_class(ApplyLibraryMaterial)
+    bpy.utils.register_class(CacheLibraryMaterial)
+    bpy.utils.register_class(SaveLibraryMaterial)
+    bpy.utils.register_class(MaterialConvert)
+
+
+def unregister():
+    bpy.utils.unregister_class(OnlineMaterialLibraryPanel)
+    bpy.utils.unregister_class(LibraryConnect)
+    bpy.utils.unregister_class(LibraryInfo)
+    bpy.utils.unregister_class(LibrarySettings)
+    bpy.utils.unregister_class(LibraryTools)
+    bpy.utils.unregister_class(LibraryHome)
+    bpy.utils.unregister_class(ViewMaterial)
+    bpy.utils.unregister_class(MaterialDetailView)
+    bpy.utils.unregister_class(LibraryClearCache)
+    bpy.utils.unregister_class(LibraryPreview)
+    bpy.utils.unregister_class(AddLibraryMaterial)
+    bpy.utils.unregister_class(ApplyLibraryMaterial)
+    bpy.utils.unregister_class(CacheLibraryMaterial)
+    bpy.utils.unregister_class(SaveLibraryMaterial)
+    bpy.utils.unregister_class(MaterialConvert)
+
+if __name__ == "__main__":
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.bcm
new file mode 100644
index 0000000..82a1a61
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.bcm
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.04252, 0.04410, 0.45153)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="750, 250" />
+		<node type="MIX_SHADER" fac="0.10000" loc="500, 250" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 0.0)" roughness="0.58398" loc="170, 250" />
+		<node type="LAYER_WEIGHT" blend="0.69998" loc="-20, 350" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.15000" color1="rgba(1.0, 1.0, 1.0, 0.0)" color2="rgba(1.0, 1.0, 1.0, 0.0)" loc="20, 140" />
+		<node type="RGB" color="rgba(0.0, 0.0, 0.46700, 0.0)" loc="-336, 352" />
+		<node type="RGB" color="rgba(0.80000, 0.80000, 0.80000, 0.0)" loc="-344, 150" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="1.70000" loc="303, 381" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 0.0)" roughness="0.00999" loc="195, 111" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="1" input="2" from="8" output="0" />
+		<link to="1" input="0" from="7" output="0" />
+		<link to="7" input="0" from="3" output="0" />
+		<link to="8" input="0" from="4" output="0" />
+		<link to="4" input="1" from="5" output="0" />
+		<link to="4" input="2" from="6" output="0" />
+		<link to="2" input="0" from="5" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.jpg
new file mode 100644
index 0000000..851a0c5
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/basic_blue.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.bcm
new file mode 100644
index 0000000..5c13bd8
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.bcm
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(1.0, 0.37373, 0.16895)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="1000, 250" />
+		<node type="MIX_SHADER" fac="0.05000" loc="750, 300" />
+		<node type="MIX_SHADER" fac="0.5" loc="500, 340" />
+		<node type="MATH" operation="LESS_THAN" use_clamp="False" value1="0.5" value2="0.25" loc="250, 500" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="10000.0" loc="0, 500" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="1.0" loc="250, 350" />
+		<node type="BRIGHTCONTRAST" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" bright="-0.89999" contrast="0.0" loc="-250, 350" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.15000" color1="rgba(0.80000, 0.80000, 0.80000, 1.0)" color2="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="0, 100" />
+		<node type="RGB" color="rgba(1.0, 0.13917, 0.0, 0.0)" loc="-464, -12" />
+		<node type="RGB" color="rgba(0.95332, 0.38194, 0.17285, 1.0)" loc="-469, 202" />
+		<node type="BSDF_GLOSSY" distribution="SHARP" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="493, 103" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.15000" loc="227, 106" />
+		<node type="BRIGHTCONTRAST" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" bright="-0.89999" contrast="0.0" loc="-220, -50" />
+		<node type="LAYER_WEIGHT" blend="0.89999" loc="-250, 149" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.15000" color1="rgba(0.80000, 0.80000, 0.80000, 1.0)" color2="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="39, 323" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="2" input="0" from="3" output="0" />
+		<link to="3" input="0" from="4" output="1" />
+		<link to="2" input="1" from="5" output="0" />
+		<link to="5" input="0" from="14" output="0" />
+		<link to="14" input="0" from="13" output="1" />
+		<link to="14" input="1" from="9" output="0" />
+		<link to="14" input="2" from="6" output="0" />
+		<link to="6" input="0" from="9" output="0" />
+		<link to="2" input="2" from="11" output="0" />
+		<link to="11" input="0" from="7" output="0" />
+		<link to="7" input="0" from="13" output="1" />
+		<link to="7" input="1" from="8" output="0" />
+		<link to="7" input="2" from="12" output="0" />
+		<link to="12" input="0" from="8" output="0" />
+		<link to="1" input="2" from="10" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.jpg
new file mode 100644
index 0000000..9f01f19
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_coral.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.bcm
new file mode 100644
index 0000000..8ae311c
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.bcm
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.48630, 0.39677, 0.10075)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="759, 69" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00999" loc="300, 12" />
+		<node type="MIX_SHADER" fac="0.02500" loc="504, 130" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.09999" loc="95, 13" />
+		<node type="MIX_SHADER" fac="0.05000" loc="300, 131" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.19999" loc="-115, 70" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.39999" loc="-209, -61" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-345, 69" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="0.0" contrast="0.0" loc="-523, -58" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="-0.39999" contrast="0.0" loc="-526, 71" />
+		<node type="FRESNEL" ior="8.0" loc="-884, 228" />
+		<node type="RGB" color="rgba(0.5, 0.15069, 0.0, 1.0)" loc="-785, 95" />
+		<node type="RGB" color="rgba(0.5, 0.43265, 0.09540, 1.0)" loc="-785, -95" />
+		<node type="MIX_SHADER" fac="0.09999" loc="89, 188" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="1.0" value2="0.5" loc="-509, 236" />
+		<node type="LAYER_WEIGHT" blend="0.80000" loc="-704, 229" />
+	</nodes>
+	<links>
+		<link to="7" input="1" from="9" output="0" />
+		<link to="7" input="2" from="8" output="0" />
+		<link to="15" input="0" from="10" output="0" />
+		<link to="7" input="0" from="14" output="0" />
+		<link to="14" input="1" from="15" output="1" />
+		<link to="6" input="0" from="7" output="0" />
+		<link to="0" input="0" from="2" output="0" />
+		<link to="9" input="0" from="11" output="0" />
+		<link to="8" input="0" from="12" output="0" />
+		<link to="2" input="2" from="1" output="0" />
+		<link to="2" input="1" from="4" output="0" />
+		<link to="4" input="2" from="3" output="0" />
+		<link to="4" input="1" from="13" output="0" />
+		<link to="13" input="2" from="5" output="0" />
+		<link to="13" input="1" from="6" output="0" />
+		<link to="5" input="0" from="9" output="0" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.jpg
new file mode 100644
index 0000000..c014eb3
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/dull_olive.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.bcm
new file mode 100644
index 0000000..985e11e
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.bcm
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.04379, 0.60201, 0.04091)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="250, 128" />
+		<node type="LAYER_WEIGHT" blend="0.15000" loc="-248, 328" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00999" loc="-233, -65" />
+		<node type="MIX_SHADER" fac="0.02999" loc="43, 125" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="5.0" loc="-489, 280" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.39999" loc="-501, 175" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29999" loc="-503, 40" />
+		<node type="MIX_SHADER" fac="0.5" loc="-314, 177" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="500.0" loc="-673, 291" />
+		<node type="BRIGHTCONTRAST" hide="True" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="-0.20000" contrast="0.0" loc="-668, 35" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="500.0" loc="-997, 303" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" color="rgba(0.10972, 0.5, 0.09735, 1.0)" loc="-1151, 127" />
+		<node type="HUE_SAT" label="Color Repeater" hue="0.5" saturation="1.0" value="1.0" fac="1.0" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="-877, 134" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="3" output="0" />
+		<link to="3" input="2" from="2" output="0" />
+		<link to="3" input="1" from="7" output="0" />
+		<link to="3" input="0" from="1" output="1" />
+		<link to="7" input="1" from="6" output="0" />
+		<link to="6" input="0" from="9" output="0" />
+		<link to="4" input="0" from="8" output="0" />
+		<link to="7" input="0" from="4" output="0" />
+		<link to="7" input="2" from="5" output="0" />
+		<link to="12" input="4" from="11" output="0" />
+		<link to="5" input="0" from="12" output="0" />
+		<link to="9" input="0" from="12" output="0" />
+		<link to="8" input="1" from="10" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.jpg
new file mode 100644
index 0000000..096753f
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_green.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.bcm
new file mode 100644
index 0000000..9580307
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.bcm
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.57112, 0.02518, 0.37123)" sample_lamp="True">
+	<nodes>
+		<node type="LAYER_WEIGHT" blend="0.32499" loc="170, 224" />
+		<node type="MIX_SHADER" fac="0.5" loc="172, 110" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29998" loc="-250, -24" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29998" loc="-248, 118" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="5.0" loc="-199, 237" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="500.0" loc="-380, 289" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="-0.20000" contrast="0.0" loc="-405, 111" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="-0.20000" contrast="0.0" loc="-409, -25" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.20000" loc="-697, -19" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="1.0" value2="0.5" loc="-832, -18" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.07500" loc="-832, 161" />
+		<node type="HOLDOUT" loc="-811, 220" />
+		<node type="FRESNEL" ior="1.95000" loc="-813, 302" />
+		<node type="MIX_SHADER" fac="0.5" loc="-617, 238" />
+		<node type="LAYER_WEIGHT" blend="0.89999" loc="-1001, -43" />
+		<node type="MIX_SHADER" fac="0.5" loc="-13, 76" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00999" loc="153, -19" />
+		<node type="MIX_SHADER" fac="0.03999" loc="346, 113" />
+		<node type="OUTPUT_MATERIAL" loc="513, 107" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="1.0" value2="-0.19999" loc="-559, -18" />
+		<node type="RGB" color="rgba(0.86887, 0.22238, 0.61303, 1.0)" loc="-777, -164" />
+		<node type="RGB" color="rgba(0.5, 0.13597, 0.45640, 1.0)" loc="-592, -162" />
+	</nodes>
+	<links>
+		<link to="15" input="1" from="3" output="0" />
+		<link to="3" input="0" from="6" output="0" />
+		<link to="4" input="0" from="5" output="0" />
+		<link to="15" input="0" from="4" output="0" />
+		<link to="15" input="2" from="2" output="0" />
+		<link to="17" input="2" from="16" output="0" />
+		<link to="17" input="0" from="0" output="0" />
+		<link to="13" input="1" from="11" output="0" />
+		<link to="13" input="2" from="10" output="0" />
+		<link to="13" input="0" from="12" output="0" />
+		<link to="1" input="1" from="15" output="0" />
+		<link to="1" input="2" from="13" output="0" />
+		<link to="1" input="0" from="4" output="0" />
+		<link to="17" input="1" from="1" output="0" />
+		<link to="2" input="0" from="7" output="0" />
+		<link to="9" input="1" from="14" output="1" />
+		<link to="8" input="0" from="9" output="0" />
+		<link to="19" input="0" from="8" output="0" />
+		<link to="7" input="1" from="19" output="0" />
+		<link to="18" input="0" from="17" output="0" />
+		<link to="7" input="0" from="21" output="0" />
+		<link to="6" input="0" from="20" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.jpg
new file mode 100644
index 0000000..3842f8d
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_purple.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.bcm
new file mode 100644
index 0000000..dd8ac29
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.bcm
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(1.0, 0.12743, 0.02028)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.03999" loc="403, 181" />
+		<node type="MIX_SHADER" fac="0.5" loc="235, 205" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00999" loc="213, 75" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="5.0" loc="13, 318" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29999" loc="12, 215" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.29999" loc="14, 82" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="500.0" loc="-172, 334" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-114, 177" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="-0.20000" contrast="0.0" loc="-329, 113" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="0.5" contrast="0.0" loc="-329, -14" />
+		<node type="OUTPUT_MATERIAL" loc="573, 175" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-111, 5" />
+		<node type="FRESNEL" ior="2.0" loc="-887, 225" />
+		<node type="RGB" color="rgba(1.0, 0.18256, 0.0, 1.0)" loc="-893, 103" />
+		<node type="RGB" color="rgba(0.5, 0.24046, 0.0, 1.0)" loc="-839, -105" />
+		<node type="RGB" color="rgba(0.75750, 0.50051, 0.0, 1.0)" loc="-655, -201" />
+		<node type="MATH" hide="True" operation="ADD" use_clamp="False" value1="0.10000" value2="0.5" loc="-501, -8" />
+		<node type="MATH" hide="True" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.20000" loc="-633, -7" />
+	</nodes>
+	<links>
+		<link to="1" input="1" from="4" output="0" />
+		<link to="7" input="1" from="8" output="0" />
+		<link to="0" input="1" from="1" output="0" />
+		<link to="3" input="0" from="6" output="0" />
+		<link to="1" input="0" from="3" output="0" />
+		<link to="1" input="2" from="5" output="0" />
+		<link to="10" input="0" from="0" output="0" />
+		<link to="0" input="2" from="2" output="0" />
+		<link to="4" input="0" from="7" output="0" />
+		<link to="5" input="0" from="11" output="0" />
+		<link to="11" input="2" from="9" output="0" />
+		<link to="11" input="1" from="8" output="0" />
+		<link to="16" input="1" from="17" output="0" />
+		<link to="5" input="1" from="16" output="0" />
+		<link to="7" input="0" from="12" output="0" />
+		<link to="11" input="0" from="12" output="0" />
+		<link to="17" input="0" from="12" output="0" />
+		<link to="7" input="2" from="15" output="0" />
+		<link to="9" input="0" from="14" output="0" />
+		<link to="8" input="0" from="13" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.jpg
new file mode 100644
index 0000000..0e42930
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/flaky_tangelo.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.bcm
new file mode 100644
index 0000000..f62e838
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.bcm
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(1.0, 0.46594, 0.03595)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.5" loc="92, 119" />
+		<node type="MIX_SHADER" fac="0.5" loc="427, 123" />
+		<node type="MIX_SHADER" fac="0.5" loc="756, 116" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="65, 385" />
+		<node type="MATH" operation="DIVIDE" use_clamp="False" value1="0.5" value2="2.0" loc="246, 351" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="1000.0" loc="-732, 197" />
+		<node type="INVERT" fac="1.0" color="rgba(0.0, 0.0, 0.0, 1.0)" loc="-548, 149" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="7.0" loc="-426, 136" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="-230, 141" />
+		<node type="FRESNEL" ior="1.20000" loc="-197, 436" />
+		<node type="LAYER_WEIGHT" blend="0.01999" loc="-194, 325" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.0" loc="91, -33" />
+		<node type="LAYER_WEIGHT" blend="0.5" loc="-447, 242" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.10000" loc="-433, -164" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.20000" loc="446, -70" />
+		<node type="FRESNEL" ior="1.10000" loc="465, 245" />
+		<node type="BSDF_DIFFUSE" color="rgba(1.0, 0.03999, 0.0, 1.0)" roughness="0.0" loc="-423, -11" />
+		<node type="RGB" custom_color="rgb(1.0, 0.80000, 0.5)" label="Gloss Color" color="rgba(1.0, 0.73231, 0.0, 1.0)" loc="-1138, 470" />
+		<node type="RGB" custom_color="rgb(1.0, 0.80000, 0.5)" label="Paint Color" color="rgba(1.0, 0.44275, 0.0, 1.0)" loc="-1127, 657" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Roughness" value="0.0" loc="-1142, 265" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Fresnel" value="1.29999" loc="-1142, 176" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Flake Size" value="1000.0" loc="-1142, -165" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Flake Spread" value="0.10000" loc="-1142, -342" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Flake Intensity" value="0.60000" loc="-1142, -254" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Blend" value="0.01999" loc="-1142, 94" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="1000.0" loc="-736, -4" />
+		<node type="OUTPUT_MATERIAL" loc="957, 98" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Gloss Roughness" value="0.0" loc="-1142, 8" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Gloss Spread" value="2.0" loc="-1142, -78" />
+	</nodes>
+	<links>
+		<link to="26" input="0" from="2" output="0" />
+		<link to="0" input="2" from="13" output="0" />
+		<link to="1" input="1" from="0" output="0" />
+		<link to="0" input="1" from="16" output="0" />
+		<link to="1" input="2" from="11" output="0" />
+		<link to="13" input="0" from="25" output="0" />
+		<link to="0" input="0" from="8" output="0" />
+		<link to="8" input="1" from="7" output="0" />
+		<link to="8" input="0" from="12" output="0" />
+		<link to="6" input="1" from="5" output="1" />
+		<link to="7" input="0" from="6" output="0" />
+		<link to="2" input="2" from="14" output="0" />
+		<link to="2" input="1" from="1" output="0" />
+		<link to="2" input="0" from="15" output="0" />
+		<link to="3" input="1" from="10" output="1" />
+		<link to="4" input="0" from="3" output="0" />
+		<link to="3" input="0" from="9" output="0" />
+		<link to="1" input="0" from="4" output="0" />
+		<link to="16" input="0" from="18" output="0" />
+		<link to="11" input="0" from="17" output="0" />
+		<link to="11" input="1" from="19" output="0" />
+		<link to="9" input="0" from="20" output="0" />
+		<link to="10" input="0" from="24" output="0" />
+		<link to="5" input="1" from="21" output="0" />
+		<link to="25" input="1" from="21" output="0" />
+		<link to="12" input="0" from="23" output="0" />
+		<link to="13" input="1" from="22" output="0" />
+		<link to="14" input="1" from="27" output="0" />
+		<link to="15" input="0" from="28" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.jpg
new file mode 100644
index 0000000..2b3c35d
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/glossy_yellow.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.bcm
new file mode 100644
index 0000000..331a94e
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.bcm
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.20428, 0.26886, 0.36288)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.85000" loc="455, 102" />
+		<node type="OUTPUT_MATERIAL" loc="660, 96" />
+		<node type="LAYER_WEIGHT" blend="0.89999" loc="-615, 152" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Spread" value="0.70000" loc="-883, 468" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Flake Size" value="600.0" loc="-921, 351" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.00499" loc="44, 203" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" color="rgba(0.0, 0.04970, 0.50288, 1.0)" loc="-987, 248" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" color="rgba(0.0, 0.0, 0.09989, 1.0)" loc="-987, 46" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" color="rgba(0.0, 1.0, 1.0, 1.0)" loc="-906, -174" />
+		<node type="GAMMA" hide="True" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="3.5" loc="-392, 240" />
+		<node type="MIX_SHADER" fac="0.75" loc="-415, 155" />
+		<node type="MIX_SHADER" fac="0.75" loc="-200, 157" />
+		<node type="LAYER_WEIGHT" blend="0.69999" loc="260, 317" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="600.0" loc="-615, 310" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.0, 0.04970, 0.50288, 1.0)" roughness="1.0" loc="-615, 47" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.0, 0.0, 0.09989, 1.0)" roughness="1.0" loc="-615, -70" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.0, 1.0, 1.0, 1.0)" roughness="0.30000" loc="-418, -74" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.0, 0.0, 0.00972, 1.0)" roughness="0.64999" loc="-211, -73" />
+		<node type="MIX_SHADER" fac="0.25" loc="44, 43" />
+		<node type="MIX_SHADER" fac="0.49999" loc="260, 105" />
+	</nodes>
+	<links>
+		<link to="9" input="0" from="13" output="1" />
+		<link to="1" input="0" from="0" output="0" />
+		<link to="0" input="0" from="12" output="1" />
+		<link to="19" input="2" from="18" output="0" />
+		<link to="0" input="1" from="19" output="0" />
+		<link to="0" input="2" from="17" output="0" />
+		<link to="10" input="2" from="15" output="0" />
+		<link to="10" input="1" from="14" output="0" />
+		<link to="10" input="0" from="2" output="1" />
+		<link to="11" input="2" from="16" output="0" />
+		<link to="11" input="1" from="10" output="0" />
+		<link to="11" input="0" from="9" output="0" />
+		<link to="19" input="1" from="5" output="0" />
+		<link to="14" input="0" from="6" output="0" />
+		<link to="12" input="0" from="3" output="0" />
+		<link to="13" input="1" from="4" output="0" />
+		<link to="16" input="0" from="8" output="0" />
+		<link to="15" input="0" from="7" output="0" />
+		<link to="18" input="1" from="11" output="0" />
+		<link to="18" input="2" from="17" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.jpg
new file mode 100644
index 0000000..d44a563
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/car-paint/metallic_blue.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.bcm
new file mode 100644
index 0000000..d6c8f55
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.bcm
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(1.0, 0.0, 0.0)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="300, 300" />
+		<node type="EMISSION" color="rgba(1.0, 0.0, 0.0, 1.0)" strength="30.0" loc="-189, 219" />
+		<node type="MIX_SHADER" fac="0.5" loc="70, 302" />
+		<node type="LAYER_WEIGHT" blend="0.89999" loc="-195, 431" />
+		<node type="EMISSION" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" strength="30.0" loc="-190, 326" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="2" output="0" />
+		<link to="2" input="0" from="3" output="1" />
+		<link to="2" input="1" from="4" output="0" />
+		<link to="2" input="2" from="1" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.jpg
new file mode 100644
index 0000000..b5f7178
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/blaster_bolt_red.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.bcm
new file mode 100644
index 0000000..5199153
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.bcm
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.84148, 0.74040, 0.00749)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="545, 173" />
+		<node type="NEW_GEOMETRY" loc="-759, 221" />
+		<node type="LIGHT_PATH" loc="-464, -35" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="1.0" loc="103, 86" />
+		<node type="EMISSION" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" strength="10.13210" loc="290, 179" />
+		<node type="MATH" operation="MAXIMUM" use_clamp="False" value1="0.5" value2="0.5" loc="-130, 30" />
+		<node type="VECT_MATH" operation="ADD" vector1="Vector(0.5, 0.5, 0.5)" vector2="Vector(0.5, 0.5, 0.5)" loc="-386, 202" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.47510, 0.01064, 0.00834, 1.0)" color2="rgba(0.88760, 0.81437, 0.00747, 1.0)" loc="-13, 254" />
+		<node type="TEX_COORD" loc="-776, 30" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="4" output="0" />
+		<link to="5" input="1" from="2" output="3" />
+		<link to="4" input="1" from="3" output="0" />
+		<link to="3" input="0" from="5" output="0" />
+		<link to="5" input="0" from="2" output="0" />
+		<link to="6" input="0" from="1" output="4" />
+		<link to="7" input="0" from="6" output="1" />
+		<link to="4" input="0" from="7" output="0" />
+		<link to="6" input="1" from="8" output="6" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.jpg
new file mode 100644
index 0000000..dd72be2
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/fake_shading.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.bcm
new file mode 100644
index 0000000..ee4ec58
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.37983, 0.37828, 0.79909)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="300, 300" />
+		<node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="-180, 225" />
+		<node type="LIGHT_PATH" loc="-742, 566" />
+		<node type="EMISSION" color="rgba(0.11494, 0.11202, 0.80000, 1.0)" strength="2.35998" loc="-351, 321" />
+		<node type="MIX_SHADER" fac="0.5" loc="40, 322" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="1.0" loc="-271, 490" />
+	</nodes>
+	<links>
+		<link to="4" input="1" from="3" output="0" />
+		<link to="0" input="0" from="4" output="0" />
+		<link to="4" input="2" from="1" output="0" />
+		<link to="5" input="1" from="2" output="1" />
+		<link to="5" input="0" from="2" output="0" />
+		<link to="4" input="0" from="5" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.jpg
new file mode 100644
index 0000000..7d96e82
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/invisible_light.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.bcm
new file mode 100644
index 0000000..6a244e4
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.bcm
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80220, 0.34073, 0.11822)" sample_lamp="False">
+	<nodes>
+		<node type="MATH" hide="True" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="345, 357" />
+		<node type="MATH" hide="True" operation="MINIMUM" use_clamp="False" value1="0.5" value2="1.0" loc="531, 370" />
+		<node type="MATH" hide="True" operation="SUBTRACT" use_clamp="False" value1="1.0" value2="0.5" loc="-61, 201" />
+		<node type="NEW_GEOMETRY" hide="True" loc="-247, 217" />
+		<node type="MIX_SHADER" hide="True" fac="0.5" loc="617, 462" />
+		<node type="BSDF_DIFFUSE" hide="True" color="rgba(0.80000, 0.21108, 0.0, 1.0)" roughness="0.0" loc="321, 442" />
+		<node type="BSDF_GLOSSY" hide="True" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.20000" loc="166, 480" />
+		<node type="BSDF_TRANSLUCENT" hide="True" color="rgba(0.80000, 0.50765, 0.23623, 1.0)" loc="599, 243" />
+		<node type="MIX_SHADER" hide="True" fac="0.5" loc="806, 329" />
+		<node type="OUTPUT_MATERIAL" hide="True" loc="996, 315" />
+		<node type="RGB" label="Subdermal Color" color="rgba(0.80000, 0.21108, 0.0, 1.0)" loc="-680, 555" />
+		<node type="VALUE" label="Specularity" value="0.5" loc="-670, 678" />
+		<node type="RGB" label="Epidermal Color" color="rgba(0.80000, 0.50765, 0.23623, 1.0)" loc="-680, 244" />
+		<node type="LIGHT_PATH" loc="-488, 505" />
+		<node type="MATH" hide="True" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-0.75199" loc="-258, 307" />
+		<node type="MATH" hide="True" operation="POWER" use_clamp="False" value1="2.71798" value2="0.5" loc="-104, 327" />
+		<node type="MATH" hide="True" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="68, 368" />
+		<node type="VALUE" label="Absorption Value" value="-0.75199" loc="-670, 351" />
+	</nodes>
+	<links>
+		<link to="14" input="0" from="13" output="7" />
+		<link to="15" input="1" from="14" output="0" />
+		<link to="2" input="1" from="3" output="6" />
+		<link to="16" input="0" from="13" output="0" />
+		<link to="0" input="0" from="16" output="0" />
+		<link to="0" input="1" from="2" output="0" />
+		<link to="1" input="0" from="0" output="0" />
+		<link to="8" input="0" from="1" output="0" />
+		<link to="9" input="0" from="8" output="0" />
+		<link to="4" input="2" from="5" output="0" />
+		<link to="4" input="1" from="6" output="0" />
+		<link to="8" input="2" from="7" output="0" />
+		<link to="8" input="1" from="4" output="0" />
+		<link to="5" input="0" from="10" output="0" />
+		<link to="4" input="0" from="11" output="0" />
+		<link to="14" input="1" from="17" output="0" />
+		<link to="7" input="0" from="12" output="0" />
+		<link to="16" input="1" from="15" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.jpg
new file mode 100644
index 0000000..eab220e
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/simulated_sss.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.bcm
new file mode 100644
index 0000000..1dca858
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.bcm
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.68979, 1.25306, 1.30810)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="1037, 349" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-0.03200" loc="-263, 445" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="303, 580" />
+		<node type="LIGHT_PATH" loc="-451, 602" />
+		<node type="MATH" operation="POWER" use_clamp="False" value1="25.0" value2="0.5" loc="-78, 443" />
+		<node type="NEW_GEOMETRY" loc="-265, 273" />
+		<node type="BSDF_GLASS" distribution="SHARP" color="rgba(1.0, 1.0, 1.0, 0.98518)" roughness="0.0" ior="1.0" loc="305, 256" />
+		<node type="EMISSION" color="rgba(0.09172, 0.17486, 0.80000, 1.0)" strength="52.49996" loc="308, 375" />
+		<node type="MATH" operation="MINIMUM" use_clamp="False" value1="0.5" value2="1.0" loc="526, 569" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Emission Color" color="rgba(0.09172, 0.17486, 0.80000, 1.0)" loc="-533, 413" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="1.0" value2="0.5" loc="-79, 257" />
+		<node type="MIX_SHADER" fac="0.5" loc="855, 373" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="88, 580" />
+		<node type="VALUE" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Brightness" value="40.0" loc="-527, 227" />
+	</nodes>
+	<links>
+		<link to="1" input="0" from="3" output="7" />
+		<link to="4" input="1" from="1" output="0" />
+		<link to="10" input="1" from="5" output="6" />
+		<link to="12" input="0" from="3" output="0" />
+		<link to="2" input="0" from="12" output="0" />
+		<link to="2" input="1" from="10" output="0" />
+		<link to="8" input="0" from="2" output="0" />
+		<link to="11" input="0" from="8" output="0" />
+		<link to="0" input="0" from="11" output="0" />
+		<link to="11" input="1" from="7" output="0" />
+		<link to="12" input="1" from="4" output="0" />
+		<link to="7" input="1" from="13" output="0" />
+		<link to="7" input="0" from="9" output="0" />
+		<link to="11" input="2" from="6" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.jpg
new file mode 100644
index 0000000..9f62bbd
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/effects/volumetric_light.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.bcm
new file mode 100644
index 0000000..08ee650
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.bcm
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.28012, 0.08883, 0.07812)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.86000" loc="250, 356" />
+		<node type="OUTPUT_MATERIAL" loc="517, 356" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.80000, 0.45208, 0.0, 1.0)" loc="25, 220" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.69998, 0.03863, 0.13707, 1.0)" roughness="0.0" loc="25, 356" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.24683, 0.5, 0.10869, 1.0)" color2="rgba(0.5, 0.42882, 0.0, 1.0)" loc="-158, 292" />
+		<node type="FRESNEL" ior="1.66733" loc="-412, 292" />
+	</nodes>
+	<links>
+		<link to="0" input="1" from="3" output="0" />
+		<link to="1" input="0" from="0" output="0" />
+		<link to="0" input="2" from="2" output="0" />
+		<link to="4" input="0" from="5" output="0" />
+		<link to="2" input="0" from="4" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.jpg
new file mode 100644
index 0000000..0da81b2
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/gummy_worm.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.bcm
new file mode 100644
index 0000000..4abaeca
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.bcm
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.30000, 0.10498, 0.04715)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="237, 123" />
+		<node type="MIX_SHADER" fac="0.85000" loc="37, 123" />
+		<node type="MIX_SHADER" fac="0.10000" loc="-165, 38" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.15053, 0.08335, 0.04656, 1.0)" roughness="0.31999" loc="-171, 186" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.14248, 0.04986, 0.02239, 1.0)" roughness="0.0" loc="-381, 106" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.19999, 0.11313, 0.08168, 1.0)" loc="-391, -4" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="1" from="3" output="0" />
+		<link to="1" input="2" from="2" output="0" />
+		<link to="2" input="1" from="4" output="0" />
+		<link to="2" input="2" from="5" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.jpg
new file mode 100644
index 0000000..cdc2138
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/milk_chocolate.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.bcm
new file mode 100644
index 0000000..d539d4a
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.bcm
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.68075, 0.03067, 0.04267)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="1000, 250" />
+		<node type="MIX_SHADER" fac="0.5" loc="700, 250" />
+		<node type="LAYER_WEIGHT" blend="0.15000" loc="400, 400" />
+		<node type="MIX_SHADER" fac="0.5" loc="400, 250" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.62673, 0.94107, 1.0)" roughness="0.10000" loc="400, 100" />
+		<node type="LAYER_WEIGHT" blend="0.10000" loc="100, 400" />
+		<node type="MIX_SHADER" fac="0.80000" loc="100, 250" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.54095, 0.72606, 1.0)" roughness="0.60000" loc="100, 100" />
+		<node type="BSDF_GLASS" distribution="SHARP" color="rgba(0.83876, 0.35837, 0.31907, 1.0)" roughness="0.0" ior="1.0" loc="-200, 325" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.96478, 0.21441, 0.25363, 1.0)" loc="-200, 175" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="0" from="2" output="0" />
+		<link to="1" input="1" from="3" output="0" />
+		<link to="1" input="2" from="4" output="0" />
+		<link to="3" input="0" from="5" output="0" />
+		<link to="3" input="1" from="6" output="0" />
+		<link to="3" input="2" from="7" output="0" />
+		<link to="6" input="1" from="8" output="0" />
+		<link to="6" input="2" from="9" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.jpg
new file mode 100644
index 0000000..1c5e323
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/food/raspberry.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.bcm
new file mode 100644
index 0000000..71c325e
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.bcm
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.10572, 0.13248, 0.47976)" sample_lamp="True">
+	<nodes>
+		<node type="NEW_GEOMETRY" loc="-247, 217" />
+		<node type="LIGHT_PATH" loc="-451, 561" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-0.68007" loc="-263, 461" />
+		<node type="MATH" operation="POWER" use_clamp="False" value1="2.71798" value2="0.5" loc="-78, 429" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="128, 489" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="345, 357" />
+		<node type="MATH" operation="MINIMUM" use_clamp="False" value1="0.5" value2="1.0" loc="528, 370" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" ior="1.45000" loc="834, 341" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.0, 0.08540, 1.0, 1.0)" color2="rgba(0.97188, 1.0, 0.97017, 1.0)" loc="692, 378" />
+		<node type="OUTPUT_MATERIAL" loc="1037, 349" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="1.0" value2="0.5" loc="-61, 201" />
+	</nodes>
+	<links>
+		<link to="3" input="1" from="2" output="0" />
+		<link to="10" input="1" from="0" output="6" />
+		<link to="4" input="0" from="3" output="0" />
+		<link to="4" input="1" from="1" output="0" />
+		<link to="9" input="0" from="7" output="0" />
+		<link to="5" input="0" from="4" output="0" />
+		<link to="5" input="1" from="10" output="0" />
+		<link to="6" input="0" from="5" output="0" />
+		<link to="8" input="0" from="6" output="0" />
+		<link to="7" input="0" from="8" output="0" />
+		<link to="2" input="0" from="1" output="7" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.jpg
new file mode 100644
index 0000000..da3e159
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/absorption.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.bcm
new file mode 100644
index 0000000..27f18e2
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.bcm
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.41442, 0.41442, 0.39642)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.5" loc="-99, 306" />
+		<node type="MIX_SHADER" fac="0.5" loc="-90, 7" />
+		<node type="LAYER_WEIGHT" blend="0.30000" loc="-522, 495" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.0, 0.12627, 0.80000, 1.0)" roughness="0.00999" loc="-318, 306" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.00999" ior="1.45000" loc="-318, -206" />
+		<node type="OUTPUT_MATERIAL" loc="390, 154" />
+		<node type="MIX_SHADER" fac="0.25" loc="120, 154" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.00999" ior="1.45000" loc="-318, 154" />
+		<node type="TEX_NOISE" scale="10.0" detail="2.0" distortion="0.0" loc="-675, 154" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.00999" loc="-318, -32" />
+		<node type="INVERT" fac="1.0" color="rgba(0.0, 0.0, 0.0, 1.0)" loc="-285, 467" />
+	</nodes>
+	<links>
+		<link to="5" input="0" from="6" output="0" />
+		<link to="0" input="1" from="3" output="0" />
+		<link to="0" input="0" from="10" output="0" />
+		<link to="9" input="0" from="8" output="0" />
+		<link to="0" input="2" from="7" output="0" />
+		<link to="6" input="1" from="0" output="0" />
+		<link to="1" input="1" from="9" output="0" />
+		<link to="1" input="2" from="4" output="0" />
+		<link to="6" input="2" from="1" output="0" />
+		<link to="3" input="0" from="8" output="0" />
+		<link to="10" input="1" from="2" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.jpg
new file mode 100644
index 0000000..b217b1c
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/iridescent.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.bcm
new file mode 100644
index 0000000..b358716
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.bcm
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.60382, 0.60382, 0.77582)" sample_lamp="True">
+	<nodes>
+		<node type="FRESNEL" ior="1.79999" loc="-676, 464" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.05000" ior="1.45000" loc="-123, 104" />
+		<node type="MIX_SHADER" fac="0.34999" loc="104, 214" />
+		<node type="ADD_SHADER" loc="-1113, 55" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.77942, 0.86935, 1.0, 1.0)" loc="-636, 364" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(1.0, 0.90754, 0.99431, 1.0)" loc="-626, 274" />
+		<node type="MIX_SHADER" fac="0.5" loc="-384, 439" />
+		<node type="ADD_SHADER" loc="-121, 453" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.31400, 0.31400, 0.31400, 1.0)" loc="-784, 87" />
+		<node type="OUTPUT_MATERIAL" loc="386, 181" />
+	</nodes>
+	<links>
+		<link to="9" input="0" from="2" output="0" />
+		<link to="6" input="0" from="0" output="0" />
+		<link to="2" input="2" from="1" output="0" />
+		<link to="6" input="1" from="4" output="0" />
+		<link to="6" input="2" from="5" output="0" />
+		<link to="7" input="0" from="6" output="0" />
+		<link to="2" input="1" from="7" output="0" />
+		<link to="7" input="1" from="8" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.jpg
new file mode 100644
index 0000000..2fdec98
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/lalique.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.bcm
new file mode 100644
index 0000000..efd2d0f
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.bcm
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.85013, 1.0, 0.80923)" sample_lamp="True">
+	<nodes>
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(0.96069, 1.0, 0.94998, 1.0)" roughness="0.00999" ior="1.51800" loc="62, 412" />
+		<node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="95, 230" />
+		<node type="OUTPUT_MATERIAL" loc="520, 292" />
+		<node type="MIX_SHADER" fac="0.0" loc="317, 296" />
+		<node type="LIGHT_PATH" loc="-189, 325" />
+	</nodes>
+	<links>
+		<link to="3" input="2" from="1" output="0" />
+		<link to="3" input="0" from="4" output="1" />
+		<link to="3" input="1" from="0" output="0" />
+		<link to="2" input="0" from="3" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.jpg
new file mode 100644
index 0000000..4064ca9
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/glass/soda_lime_common.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/index.xml b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/index.xml
new file mode 100644
index 0000000..fa6f149
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/index.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<library>
+	<category title="Car Paint" folder="car-paint" addon="0.4">
+		<material name="Basic Blue" href="basic_blue" stars="3" addon="0.4" />
+		<material name="Dull Coral" href="dull_coral" by="monsterdog" stars="4" addon="0.4" />
+		<material name="Dull Olive" href="dull_olive" stars="5" addon="0.4" />
+		<material name="Flaky Green" href="flaky_green" stars="5" fireflies="medium" addon="0.4" />
+		<material name="Flaky Purple" href="flaky_purple" stars="4" fireflies="medium" addon="0.4" />
+		<material name="Flaky Tangelo" href="flaky_tangelo" stars="5" fireflies="medium" addon="0.4" />
+		<material name="Glossy Yellow" href="glossy_yellow" stars="4" fireflies="medium" addon="0.4" />
+		<material name="Metallic Blue" href="metallic_blue" stars="5" addon="0.4" />
+	</category>
+	<category title="Effects" folder="effects" addon="0.4">
+		<material name="Blaster Bolt (Red)" href="blaster_bolt_red" stars="3" addon="0.4" />
+		<material name="Invisible Light" href="invisible_light" stars="4" addon="0.4" />
+		<material name="Fake Shading" href="fake_shading" by="Ace Dragon" stars="3" addon="0.4" />
+		<material name="Simulated SSS" href="simulated_sss" by="ZetShandow" stars="4" complexity="intermediate" addon="0.4" bl="2.64-" />
+		<material name="Volumetric Light" href="volumetric_light" by="ZetShandow" stars="4" complexity="intermediate" fireflies="medium" addon="0.4" bl="2.64-" />
+	</category>
+	<category title="Food" folder="food" addon="0.4">
+		<material name="Gummy Worm" href="gummy_worm" by="Jimmy Gunawan" stars="4" addon="0.4" />
+		<material name="Milk Chocolate" href="milk_chocolate" by="Peter Cassetta" stars="3" addon="0.4" />
+		<material name="Raspberry" href="raspberry" stars="4" addon="0.4" />
+	</category>
+	<category title="Glass" folder="glass" addon="0.4">
+		<material name="Absorption" href="absorption" by="ZetShandow" stars="4" fireflies="medium" addon="0.4" bl="2.64-" />
+		<material name="Iridescent" href="iridescent" by="moony" stars="5" fireflies="medium" speed="fair" addon="0.4" />
+		<material name="Lalique" href="lalique" by="moony" stars="4" addon="0.4" speed="medium" />
+		<material name="Soda-Lime (Common)" href="soda_lime_common" by="Peter Cassetta" stars="3" addon="0.4" />
+	</category>
+	<category title="Liquids" folder="liquids" addon="0.4">
+		<material name="Cranberry Juice" href="cranberry_juice" by="Peter Cassetta" stars="4" addon="0.4" />
+		<material name="Slime" href="slime" stars="3" addon="0.4" bl="2.64-" />
+		<material name="Soap Bubble" href="soap_bubble" by="moony" stars="4" fireflies="medium" speed="fair" addon="0.4" />
+	</category>
+	<category title="Metals" folder="metals" addon="0.4">
+		<material name="Bronze (Ancient)" href="bronze_ancient" stars="4" addon="0.4" />
+		<material name="Fool's Gold" href="fools_gold" stars="4" complexity="complex" addon="0.4" />
+		<material name="Galvanized Steel" href="galvanized_steel" by="moony" stars="4" fireflies="medium" addon="0.4" />
+	</category>
+	<category title="Nature" folder="nature" addon="0.4">
+		<material name="Pearl" href="pearl" by="moony" stars="4" addon="0.4" />
+		<material name="Forest" href="forest" by="Jonathan L" stars="4" complexity="complex" addon="0.4" />
+		<material name="Lava" href="lava" by="monsterdog" stars="4" complexity="intermediate" addon="0.4" />
+	</category>
+	<category title="Plastics" folder="plastics" addon="0.4">
+		<material name="Toy Brick (Red)" href="toy_brick_red" by="Peter Cassetta" stars="4" addon="0.4" />
+	</category>
+	<category title="Skin" folder="skin" addon="0.4">
+		<material name="Pox" href="pox" by="moony" stars="4" addon="0.4" />
+	</category>
+	<category title="Stones" folder="stones" addon="0.4">
+		<material name="Diamond" href="diamond" stars="3" fireflies="high" speed="slow" addon="0.4" />
+		<material name="Malachite" href="malachite" by="moony" stars="3" addon="0.4" />
+		<material name="Polished Haematite" href="polished_haematite" by="moony" stars="5" complexity="intermediate" addon="0.4" />
+	</category>
+	<category title="Synthetic" folder="synthetic" addon="0.4">
+		<material name="Carbon Fiber" href="carbon_fiber" stars="5" complexity="complex" addon="0.4" />
+		<material name="Carbon Fiber (Glossy)" href="carbon_fiber_glossy" stars="3" complexity="complex" addon="0.4" />
+		<material name="Polystyrene Foam" href="polystyrene_foam" by="Peter Cassetta" stars="4" complexity="intermediate" addon="0.4" />
+		<material name="Rubber" href="rubber" stars="3" addon="0.4" />
+	</category>
+	<category title="Textiles" folder="textiles" addon="0.4">
+		<material name="Denim" href="denim" by="Peter Cassetta" stars="4" complexity="complex" addon="0.4" />
+		<material name="Velvet (Edged)" href="velvet_edged" stars="4" addon="0.4" />
+		<material name="Weave Test" href="weave_test" by="niabot" stars="4" complexity="complex" addon="0.4" />
+		<material name="Woven Wool" href="woven_wool" by="meta-androcto" stars="3" addon="0.4" />
+	</category>
+	<category title="Wood" folder="wood" addon="0.4">
+		<material name="Polished Walnut" href="polished_walnut" by="Peter Cassetta" stars="4" complexity="intermediate" addon="0.4" />
+		<material name="Rough Pine" href="rough_pine" by="Peter Cassetta" stars="4" complexity="intermediate" addon="0.4" />
+		<material name="Rough Walnut" href="rough_walnut" by="Peter Cassetta" stars="3" complexity="intermediate" addon="0.4" />
+	</category>
+</library>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.bcm
new file mode 100644
index 0000000..1e9c634
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.bcm
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.87406, 0.02816, 0.03187)" sample_lamp="True">
+	<nodes>
+		<node type="LIGHT_PATH" loc="-236, 318" />
+		<node type="BSDF_TRANSPARENT" color="rgba(1.0, 0.37799, 0.37799, 1.0)" loc="95, 230" />
+		<node type="BSDF_GLASS" distribution="SHARP" color="rgba(1.0, 0.41999, 0.41999, 1.0)" roughness="0.00999" ior="1.35099" loc="62, 412" />
+		<node type="MIX_SHADER" fac="0.0" loc="294, 303" />
+		<node type="OUTPUT_MATERIAL" loc="520, 292" />
+	</nodes>
+	<links>
+		<link to="3" input="2" from="1" output="0" />
+		<link to="4" input="0" from="3" output="0" />
+		<link to="3" input="1" from="2" output="0" />
+		<link to="3" input="0" from="0" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.jpg
new file mode 100644
index 0000000..bc96ab6
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/cranberry_juice.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.bcm
new file mode 100644
index 0000000..c66af61
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.bcm
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.17464, 0.52099, 0.03071)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="286, 432" />
+		<node type="MIX_SHADER" fac="0.5" loc="67, 330" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.17583, 0.52207, 0.03054, 1.0)" roughness="0.0" loc="-151, 303" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.88750, 0.66609, 0.19976, 1.0)" roughness="0.5" loc="-157, 195" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="True" value1="0.5" value2="1.0" loc="-135, 463" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="-326, 470" />
+		<node type="TEX_MUSGRAVE" musgrave="FBM" scale="-5.10382" detail="2.0" dimension="2.0" lacunarity="1.0" offset="0.0" gain="1.0" loc="-584, 508" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="1.99999" loc="-590, 669" />
+		<node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.78539, 0.78539, 0.0)" scale="Vector(3.0, 3.0, 3.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-898, 505" />
+		<node type="TEX_COORD" loc="-1129, 475" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="2" from="3" output="0" />
+		<link to="0" input="2" from="4" output="0" />
+		<link to="1" input="0" from="4" output="0" />
+		<link to="8" input="0" from="9" output="0" />
+		<link to="5" input="0" from="7" output="1" />
+		<link to="4" input="0" from="5" output="0" />
+		<link to="5" input="1" from="6" output="1" />
+		<link to="6" input="0" from="8" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.jpg
new file mode 100644
index 0000000..39891cc
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/slime.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.bcm
new file mode 100644
index 0000000..5952423
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.bcm
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.75489, 0.68663, 0.79909)" sample_lamp="True">
+	<nodes>
+		<node type="LAYER_WEIGHT" blend="0.89999" loc="-651, 778" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.0, 0.0, 1.0)" roughness="0.0" loc="-655, 631" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.0, 1.0, 0.0, 1.0)" roughness="0.0" loc="-651, 471" />
+		<node type="LAYER_WEIGHT" blend="0.30000" loc="-201, 737" />
+		<node type="MIX_SHADER" fac="0.5" loc="-184, 520" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.0, 0.0, 1.0, 1.0)" roughness="0.0" loc="-188, 341" />
+		<node type="LAYER_WEIGHT" blend="0.39998" loc="123, 733" />
+		<node type="MIX_SHADER" fac="0.5" loc="123, 516" />
+		<node type="MIX_SHADER" fac="0.5" loc="469, 321" />
+		<node type="BSDF_TRANSPARENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="486, 76" />
+		<node type="MIX_SHADER" fac="0.5" loc="797, 265" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.0" ior="1.45000" loc="808, 486" />
+		<node type="FRESNEL" ior="1.45000" loc="864, 676" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.48350, 0.0, 0.80000, 1.0)" roughness="0.0" loc="131, 217" />
+		<node type="OUTPUT_MATERIAL" loc="1790, 301" />
+		<node type="MIX_SHADER" fac="0.89999" loc="1232, 271" />
+		<node type="MIX_SHADER" fac="0.89999" loc="1570, 333" />
+		<node type="LIGHT_PATH" loc="1364, 592" />
+		<node type="BSDF_TRANSPARENT" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="1254, 128" />
+	</nodes>
+	<links>
+		<link to="16" input="1" from="15" output="0" />
+		<link to="4" input="0" from="0" output="1" />
+		<link to="7" input="1" from="4" output="0" />
+		<link to="7" input="0" from="3" output="1" />
+		<link to="8" input="1" from="7" output="0" />
+		<link to="4" input="1" from="1" output="0" />
+		<link to="4" input="2" from="2" output="0" />
+		<link to="7" input="2" from="5" output="0" />
+		<link to="8" input="2" from="13" output="0" />
+		<link to="8" input="0" from="6" output="0" />
+		<link to="10" input="1" from="8" output="0" />
+		<link to="10" input="2" from="9" output="0" />
+		<link to="15" input="1" from="11" output="0" />
+		<link to="15" input="2" from="10" output="0" />
+		<link to="15" input="0" from="12" output="0" />
+		<link to="14" input="0" from="16" output="0" />
+		<link to="16" input="0" from="17" output="1" />
+		<link to="16" input="2" from="18" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.jpg
new file mode 100644
index 0000000..35b1d9e
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/liquids/soap_bubble.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.bcm
new file mode 100644
index 0000000..f9d75b4
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.bcm
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.30153, 0.11162, 0.05403)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="633, 386" />
+		<node type="NEW_GEOMETRY" loc="-202, 555" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.10000" loc="182, 374" />
+		<node type="LAYER_WEIGHT" blend="0.46500" loc="-12, 235" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.04357, 0.04357, 0.04357, 1.0)" roughness="0.03999" loc="-33, 129" />
+		<node type="MIX_SHADER" fac="0.5" loc="214, 171" />
+		<node type="MIX_SHADER" fac="0.5" loc="429, 338" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.06498" loc="-33, -2" />
+		<node type="RGB" color="rgba(0.85499, 0.28891, 0.15745, 1.0)" loc="-414, 435" />
+		<node type="RGB" color="rgba(0.79909, 0.43415, 0.07225, 1.0)" loc="-414, 228" />
+		<node type="RGB" color="rgba(0.09000, 0.04159, 0.01396, 1.0)" loc="-414, 39" />
+		<node type="VECT_MATH" operation="DOT_PRODUCT" vector1="Vector(0.5, 0.5, 0.5)" vector2="Vector(0.5, 0.5, 0.5)" loc="-39, 565" />
+		<node type="MATH" operation="POWER" use_clamp="False" value1="0.5" value2="4.0" loc="159, 548" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="6" output="0" />
+		<link to="11" input="0" from="1" output="1" />
+		<link to="11" input="1" from="1" output="4" />
+		<link to="12" input="0" from="11" output="1" />
+		<link to="6" input="0" from="12" output="0" />
+		<link to="6" input="1" from="2" output="0" />
+		<link to="5" input="1" from="4" output="0" />
+		<link to="5" input="2" from="7" output="0" />
+		<link to="6" input="2" from="5" output="0" />
+		<link to="5" input="0" from="3" output="1" />
+		<link to="4" input="0" from="8" output="0" />
+		<link to="7" input="0" from="9" output="0" />
+		<link to="2" input="0" from="10" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.jpg
new file mode 100644
index 0000000..a04b47a
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/bronze_ancient.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.bcm
new file mode 100644
index 0000000..7bfa065
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.bcm
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.94870, 0.50081, 0.05448)" sample_lamp="True">
+	<nodes>
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.68531, 0.15028, 1.0)" roughness="0.15000" loc="48, 300" />
+		<node type="TEX_NOISE" scale="68.99987" detail="2.40684" distortion="12.65606" loc="52, 156" />
+		<node type="MATH" operation="GREATER_THAN" use_clamp="False" value1="0.5" value2="0.81199" loc="253, 125" />
+		<node type="TEX_MUSGRAVE" musgrave="FBM" scale="860.48791" detail="2.37062" dimension="2.0" lacunarity="44.37200" offset="0.0" gain="1.0" loc="51, -35" />
+		<node type="TEX_MAGIC" depth="2" scale="519.49645" distortion="28.07604" loc="41, -279" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.26600" loc="621, -107" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="593, 125" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="774, 118" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-0.00400" loc="1052, -477" />
+		<node type="MATH" operation="SINE" use_clamp="False" value1="0.5" value2="2.43676" loc="762, -469" />
+		<node type="MATH" operation="TANGENT" use_clamp="False" value1="0.5" value2="0.52956" loc="909, -456" />
+		<node type="TEX_WAVE" wave="RINGS" scale="39.22412" distortion="21.16782" detail="2.31078" detail_scale="1.94421" loc="571, -411" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="954, 75" />
+		<node type="MATH" operation="SINE" use_clamp="False" value1="1.0" value2="0.5" loc="1603, -158" />
+		<node type="TEX_WAVE" wave="RINGS" scale="9.16790" distortion="9.56811" detail="2.04166" detail_scale="28.49596" loc="1318, -223" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.37356" value2="0.5" loc="1781, -163" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.05601" value2="0.5" loc="1959, -166" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="275.35241" loc="43, -465" />
+		<node type="VALUE" value="9.16800" loc="1210, -304" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="-89, 96" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="-100, -121" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="-90, -298" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="-97, -482" />
+		<node type="VALUE" value="39.22399" loc="421, -459" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="424, -548" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="1232, -456" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.00300" loc="1118, -164" />
+		<node type="TEX_MUSGRAVE" musgrave="MULTIFRACTAL" scale="504.95214" detail="2.26371" dimension="2.0" lacunarity="1.16760" offset="0.0" gain="1.0" loc="948, -170" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="1.0" value2="0.5" loc="806, -135" />
+		<node type="VALUE" value="504.95199" loc="831, -280" />
+		<node type="VALUE" value="0.5" loc="-532, 234" />
+		<node type="MATH" operation="GREATER_THAN" use_clamp="False" value1="0.5" value2="0.5" loc="442, -316" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="442, -108" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.30959" loc="282, -291" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-0.20536" loc="605, -259" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.01236" loc="395, 131" />
+		<node type="VALUE" value="314.93222" loc="-339, -542" />
+		<node type="VALUE" value="296.85839" loc="-364, -375" />
+		<node type="VALUE" value="860.48797" loc="-356, -205" />
+		<node type="VALUE" value="69.0" loc="-368, 0" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="2184, -23" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.84039" loc="2485, 56" />
+		<node type="OUTPUT_MATERIAL" loc="2715, 178" />
+	</nodes>
+	<links>
+		<link to="42" input="0" from="0" output="0" />
+		<link to="35" input="0" from="2" output="0" />
+		<link to="2" input="1" from="1" output="1" />
+		<link to="6" input="0" from="35" output="0" />
+		<link to="32" input="1" from="4" output="1" />
+		<link to="32" input="0" from="3" output="1" />
+		<link to="6" input="1" from="5" output="0" />
+		<link to="31" input="0" from="17" output="1" />
+		<link to="34" input="0" from="31" output="0" />
+		<link to="5" input="0" from="34" output="0" />
+		<link to="7" input="0" from="6" output="0" />
+		<link to="26" input="0" from="27" output="1" />
+		<link to="7" input="1" from="26" output="0" />
+		<link to="9" input="0" from="11" output="1" />
+		<link to="12" input="0" from="7" output="0" />
+		<link to="10" input="0" from="9" output="0" />
+		<link to="12" input="1" from="8" output="0" />
+		<link to="8" input="0" from="10" output="0" />
+		<link to="40" input="1" from="12" output="0" />
+		<link to="41" input="0" from="40" output="0" />
+		<link to="13" input="1" from="14" output="1" />
+		<link to="15" input="1" from="13" output="0" />
+		<link to="16" input="1" from="15" output="0" />
+		<link to="40" input="0" from="16" output="0" />
+		<link to="19" input="1" from="39" output="0" />
+		<link to="1" input="1" from="19" output="0" />
+		<link to="20" input="1" from="38" output="0" />
+		<link to="3" input="1" from="20" output="0" />
+		<link to="21" input="1" from="37" output="0" />
+		<link to="4" input="1" from="21" output="0" />
+		<link to="22" input="1" from="36" output="0" />
+		<link to="17" input="1" from="22" output="0" />
+		<link to="24" input="1" from="23" output="0" />
+		<link to="11" input="1" from="24" output="0" />
+		<link to="25" input="1" from="18" output="0" />
+		<link to="14" input="1" from="25" output="0" />
+		<link to="28" input="1" from="29" output="0" />
+		<link to="27" input="1" from="28" output="0" />
+		<link to="19" input="0" from="30" output="0" />
+		<link to="20" input="0" from="30" output="0" />
+		<link to="21" input="0" from="30" output="0" />
+		<link to="22" input="0" from="30" output="0" />
+		<link to="28" input="0" from="30" output="0" />
+		<link to="25" input="0" from="30" output="0" />
+		<link to="24" input="0" from="30" output="0" />
+		<link to="42" input="2" from="41" output="0" />
+		<link to="33" input="0" from="32" output="0" />
+		<link to="31" input="1" from="33" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.jpg
new file mode 100644
index 0000000..b76bdf5
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/fools_gold.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.bcm
new file mode 100644
index 0000000..5838eb9
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.bcm
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="878, 186" />
+		<node type="MIX_SHADER" fac="0.5" loc="592, 198" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.86666, 1.0, 1.0, 1.0)" roughness="0.20000" loc="390, 315" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.20000" loc="396, 109" />
+		<node type="MATH" operation="DIVIDE" use_clamp="False" value1="0.5" value2="5.0" loc="182, 188" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="15.0" loc="-702, -28" />
+		<node type="RGBTOBW" color="rgba(0.5, 0.5, 0.5, 1.0)" loc="-221, -66" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="0.5" loc="-19, -32" />
+		<node type="TEX_NOISE" scale="10.0" detail="2.0" distortion="0.0" loc="-687, 259" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="15.0" value2="4.0" loc="-893, 268" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.75" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-479, -20" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="-64, 307" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="1.0" loc="-271, 56" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="15.0" loc="-1242, 75" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="3" input="1" from="4" output="0" />
+		<link to="11" input="0" from="12" output="0" />
+		<link to="4" input="0" from="11" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="1" input="2" from="3" output="0" />
+		<link to="2" input="1" from="4" output="0" />
+		<link to="3" input="0" from="7" output="0" />
+		<link to="7" input="0" from="6" output="0" />
+		<link to="10" input="1" from="8" output="0" />
+		<link to="10" input="2" from="5" output="0" />
+		<link to="12" input="0" from="10" output="0" />
+		<link to="6" input="0" from="10" output="0" />
+		<link to="8" input="1" from="9" output="0" />
+		<link to="9" input="0" from="13" output="0" />
+		<link to="5" input="1" from="13" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.jpg
new file mode 100644
index 0000000..ad8ff45
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/metals/galvanized_steel.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.bcm
new file mode 100644
index 0000000..683282d
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.bcm
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+	<nodes>
+		<node type="BSDF_DIFFUSE" color="rgba(0.07457, 0.07457, 0.07457, 1.0)" roughness="0.0" loc="653, 127" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="300.0" loc="655, 6" />
+		<node type="OUTPUT_MATERIAL" loc="3169, 115" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.0, 0.15665, 0.0, 1.0)" roughness="1.0" loc="-358, 276" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.01193, 0.02232, 0.0, 1.0)" roughness="0.0" loc="-364, 166" />
+		<node type="MIX_SHADER" fac="0.5" loc="76, 296" />
+		<node type="MIX_SHADER" fac="0.5" loc="142, -51" />
+		<node type="MIX_SHADER" fac="0.5" loc="362, 387" />
+		<node type="TEX_NOISE" scale="75.0" detail="2.0" distortion="0.0" loc="-366, 464" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.01066, 0.02866, 0.00134, 1.0)" roughness="1.0" loc="-282, -179" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="952, 303" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="0.19999" contrast="1.0" loc="769, 417" />
+		<node type="TEX_NOISE" scale="10.0" detail="5.0" distortion="1.0" loc="530, 545" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="250.0" loc="1103, -226" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.08599, 0.19126, 0.00800, 1.0)" roughness="1.0" loc="-285, -301" />
+		<node type="MIX_SHADER" fac="0.5" loc="1355, 217" />
+		<node type="TEX_NOISE" scale="15.0" detail="5.0" distortion="0.0" loc="1386, 54" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="0.0" contrast="1.0" loc="1574, -19" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.0, 0.0, 0.0, 1.0)" color2="rgba(1.0, 1.0, 1.0, 1.0)" loc="1735, 547" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="1765, -133" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.0, 0.0, 0.0, 1.0)" color2="rgba(1.0, 1.0, 1.0, 1.0)" loc="2217, 3" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.01405, 0.03752, 0.01255, 1.0)" roughness="1.0" loc="64, 137" />
+		<node type="TEX_NOISE" scale="100.0" detail="2.0" distortion="5.0" loc="74, 532" />
+		<node type="MIX_SHADER" fac="0.5" loc="1956, 336" />
+		<node type="TEX_NOISE" scale="10.0" detail="5.0" distortion="0.5" loc="1296, 683" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="2.0" contrast="20.0" loc="1523, 638" />
+		<node type="BRIGHTCONTRAST" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="2.0" contrast="20.0" loc="2054, 46" />
+		<node type="TEX_NOISE" scale="10.0" detail="5.0" distortion="0.5" loc="1880, 138" />
+		<node type="HUE_SAT" hue="0.5" saturation="1.0" value="500.0" fac="1.0" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="1961, -95" />
+		<node type="TEX_NOISE" scale="300.0" detail="5.0" distortion="0.0" loc="1092, -25" />
+		<node type="INVERT" fac="1.0" color="rgba(0.0, 0.0, 0.0, 1.0)" loc="2494, -41" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.0, 0.0, 0.0, 1.0)" color2="rgba(1.0, 1.0, 1.0, 1.0)" loc="2370, -135" />
+		<node type="TEX_NOISE" scale="50.0" detail="5.0" distortion="0.0" loc="-355, 15" />
+	</nodes>
+	<links>
+		<link to="2" input="0" from="23" output="0" />
+		<link to="2" input="2" from="30" output="0" />
+		<link to="5" input="1" from="3" output="0" />
+		<link to="5" input="2" from="4" output="0" />
+		<link to="7" input="1" from="5" output="0" />
+		<link to="7" input="2" from="21" output="0" />
+		<link to="6" input="1" from="9" output="0" />
+		<link to="6" input="2" from="14" output="0" />
+		<link to="15" input="1" from="7" output="0" />
+		<link to="15" input="2" from="6" output="0" />
+		<link to="11" input="0" from="12" output="1" />
+		<link to="15" input="0" from="10" output="0" />
+		<link to="10" input="0" from="11" output="0" />
+		<link to="5" input="0" from="8" output="1" />
+		<link to="7" input="0" from="22" output="1" />
+		<link to="6" input="0" from="32" output="1" />
+		<link to="19" input="1" from="29" output="1" />
+		<link to="19" input="2" from="13" output="1" />
+		<link to="28" input="4" from="19" output="0" />
+		<link to="17" input="0" from="16" output="1" />
+		<link to="19" input="0" from="17" output="0" />
+		<link to="23" input="2" from="15" output="0" />
+		<link to="25" input="0" from="24" output="1" />
+		<link to="23" input="0" from="18" output="0" />
+		<link to="18" input="0" from="25" output="0" />
+		<link to="26" input="0" from="27" output="1" />
+		<link to="20" input="0" from="26" output="0" />
+		<link to="31" input="0" from="20" output="0" />
+		<link to="30" input="1" from="31" output="0" />
+		<link to="31" input="2" from="28" output="0" />
+		<link to="23" input="1" from="0" output="0" />
+		<link to="31" input="1" from="1" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.jpg
new file mode 100644
index 0000000..81b2db0
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/forest.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.bcm
new file mode 100644
index 0000000..cf89843
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.bcm
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.5" loc="87, 374" />
+		<node type="EMISSION" color="rgba(0.54981, 0.25838, 0.0, 1.0)" strength="1.0" loc="-100, 422" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="3.0" loc="-315, 423" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.25" loc="-321, 208" />
+		<node type="MIX_SHADER" fac="0.25" loc="-98, 291" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.75" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-317, 68" />
+		<node type="INVERT" fac="1.0" color="rgba(0.0, 0.0, 0.0, 1.0)" loc="-511, 26" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="5.0" loc="-709, 153" />
+		<node type="TEX_COORD" loc="-941, 183" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="50.0" loc="-709, 316" />
+		<node type="OUTPUT_MATERIAL" loc="285, 296" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.10000, 0.10000, 0.10000, 1.0)" roughness="0.0" loc="-317, 319" />
+	</nodes>
+	<links>
+		<link to="2" input="0" from="7" output="1" />
+		<link to="4" input="1" from="11" output="0" />
+		<link to="0" input="1" from="1" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="0" input="2" from="4" output="0" />
+		<link to="4" input="2" from="3" output="0" />
+		<link to="7" input="0" from="8" output="3" />
+		<link to="9" input="0" from="8" output="3" />
+		<link to="6" input="1" from="7" output="1" />
+		<link to="5" input="2" from="6" output="0" />
+		<link to="5" input="1" from="9" output="1" />
+		<link to="10" input="2" from="5" output="0" />
+		<link to="10" input="0" from="0" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.jpg
new file mode 100644
index 0000000..3836ed3
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/lava.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.bcm
new file mode 100644
index 0000000..759721a
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.bcm
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.76051, 0.76051, 0.56025)" sample_lamp="True">
+	<nodes>
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.99220, 0.81102, 1.0)" roughness="0.05000" loc="-556, 423" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.5" loc="-572, 29" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-572, -148" />
+		<node type="MIX_SHADER" fac="0.5" loc="-41, 177" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="-34, -3" />
+		<node type="MIX_SHADER" fac="0.5" loc="-291, 33" />
+		<node type="MIX_SHADER" fac="0.5" loc="-289, 253" />
+		<node type="BSDF_DIFFUSE" color="rgba(1.0, 0.99220, 0.81102, 1.0)" roughness="0.0" loc="-569, 231" />
+		<node type="MIX_SHADER" fac="0.10000" loc="191, 130" />
+		<node type="OUTPUT_MATERIAL" loc="451, 150" />
+	</nodes>
+	<links>
+		<link to="9" input="0" from="8" output="0" />
+		<link to="3" input="1" from="6" output="0" />
+		<link to="6" input="1" from="0" output="0" />
+		<link to="8" input="1" from="3" output="0" />
+		<link to="6" input="2" from="7" output="0" />
+		<link to="5" input="1" from="1" output="0" />
+		<link to="5" input="2" from="2" output="0" />
+		<link to="3" input="2" from="5" output="0" />
+		<link to="8" input="2" from="4" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.jpg
new file mode 100644
index 0000000..162b98f
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/nature/pearl.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.bcm
new file mode 100644
index 0000000..41f0350
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.bcm
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.99730, 0.01052, 0.01052)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="520, 292" />
+		<node type="MIX_SHADER" fac="0.87999" loc="320, 292" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.67269, 0.19188, 0.19725, 1.0)" roughness="0.11998" loc="120, 292" />
+		<node type="MIX_SHADER" fac="0.05000" loc="116, 157" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.74998, 0.22974, 0.23562, 1.0)" loc="-83, 13" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.91029, 0.00455, 0.00455, 1.0)" roughness="0.11999" loc="-80, 148" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="1" input="2" from="3" output="0" />
+		<link to="3" input="1" from="5" output="0" />
+		<link to="3" input="2" from="4" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.jpg
new file mode 100644
index 0000000..796fcbe
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/plastics/toy_brick_red.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.bcm
new file mode 100644
index 0000000..a2e2e5c
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.bcm
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="572, 314" />
+		<node type="VALTORGB" interpolation="B_SPLINE" fac="0.5" stops="3" stop1="0.0|rgba(1.0, 1.0, 1.0, 1.0)" stop2="0.09772|rgba(0.0, 0.0, 0.0, 1.0)" stop3="0.15454|rgba(0.0, 0.0, 0.0, 1.0)" loc="-1016, 194" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.86315, 0.73791, 0.65140, 1.0)" roughness="0.0" loc="-817, 539" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.13812, 0.12151, 1.0)" roughness="0.30000" loc="-474, 186" />
+		<node type="RGBTOBW" color="rgba(0.5, 0.5, 0.5, 1.0)" loc="-119, 17" />
+		<node type="MIX_SHADER" fac="0.20000" loc="-212, 252" />
+		<node type="MIX_SHADER" fac="0.5" loc="-14, 419" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.30000" loc="34, 69" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="10.0" loc="-1255, 93" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.86315, 0.73791, 0.65140, 1.0)" roughness="0.30000" loc="-864, 409" />
+		<node type="MIX_SHADER" fac="0.10000" loc="-397, 491" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.13812, 0.12151, 1.0)" roughness="0.10000" loc="-598, 23" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="6" output="0" />
+		<link to="0" input="2" from="7" output="0" />
+		<link to="1" input="0" from="8" output="0" />
+		<link to="4" input="0" from="1" output="0" />
+		<link to="6" input="0" from="1" output="0" />
+		<link to="10" input="1" from="2" output="0" />
+		<link to="6" input="1" from="10" output="0" />
+		<link to="10" input="2" from="9" output="0" />
+		<link to="7" input="0" from="4" output="0" />
+		<link to="5" input="1" from="3" output="0" />
+		<link to="6" input="2" from="5" output="0" />
+		<link to="5" input="2" from="11" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.jpg
new file mode 100644
index 0000000..93e7340
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/skin/pox.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.bcm
new file mode 100644
index 0000000..ef2d70c
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.bcm
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.85058, 0.84081, 0.85058)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="1.0" color1="rgba(0.0, 0.0, 1.0, 1.0)" color2="rgba(0.0, 0.0, 1.0, 1.0)" loc="-199, -49" />
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="1.0" color1="rgba(1.0, 0.0, 0.0, 1.0)" color2="rgba(0.0, 0.0, 1.0, 1.0)" loc="-199, 290" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(0.0, 0.0, 1.0, 1.0)" roughness="0.0" ior="1.44000" loc="-51, -51" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(1.0, 0.0, 0.0, 1.0)" roughness="0.0" ior="1.39999" loc="-51, 286" />
+		<node type="ADD_SHADER" loc="128, 236" />
+		<node type="ADD_SHADER" loc="297, 173" />
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="1.0" color1="rgba(0.0, 1.0, 0.0, 1.0)" color2="rgba(0.0, 0.0, 1.0, 1.0)" loc="-199, 119" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.10000" value2="0.10000" loc="-687, 119" />
+		<node type="SEPRGB" image="rgba(1.0, 1.0, 1.0, 1.0)" loc="-334, 119" />
+		<node type="BSDF_GLASS" distribution="BECKMANN" color="rgba(0.0, 1.0, 0.0, 1.0)" roughness="0.0" ior="2.46000" loc="-51, 119" />
+		<node type="ADD_SHADER" loc="466, 119" />
+		<node type="OUTPUT_MATERIAL" loc="642, 119" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="2.46000" value2="0.5" loc="-493, -67" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="2.46000" value2="0.5" loc="-493, 287" />
+	</nodes>
+	<links>
+		<link to="11" input="0" from="10" output="0" />
+		<link to="5" input="0" from="4" output="0" />
+		<link to="10" input="0" from="5" output="0" />
+		<link to="4" input="0" from="3" output="0" />
+		<link to="5" input="1" from="9" output="0" />
+		<link to="10" input="1" from="2" output="0" />
+		<link to="6" input="2" from="8" output="1" />
+		<link to="3" input="0" from="1" output="0" />
+		<link to="9" input="0" from="6" output="0" />
+		<link to="2" input="0" from="0" output="0" />
+		<link to="2" input="2" from="12" output="0" />
+		<link to="3" input="2" from="13" output="0" />
+		<link to="12" input="1" from="7" output="0" />
+		<link to="13" input="1" from="7" output="0" />
+		<link to="0" input="2" from="8" output="2" />
+		<link to="1" input="2" from="8" output="0" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.jpg
new file mode 100644
index 0000000..a16a4ff
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/diamond.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.bcm
new file mode 100644
index 0000000..340a5ef
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.bcm
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.08228, 0.33245, 0.09529)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.05000" loc="382, 116" />
+		<node type="MIX_SHADER" fac="0.5" loc="105, 116" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="105, -14" />
+		<node type="LAYER_WEIGHT" blend="0.10000" loc="105, 258" />
+		<node type="GAMMA" color="rgba(1.0, 1.0, 1.0, 1.0)" gamma="0.5" loc="-105, 301" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.08229, 0.33015, 0.09638, 1.0)" roughness="0.0" loc="-324, 116" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.0, 0.0, 0.0, 1.0)" roughness="0.25" loc="-324, -14" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="5.0" loc="-324, 301" />
+		<node type="MATH" operation="DIVIDE" use_clamp="False" value1="200.0" value2="4.0" loc="-613, 116" />
+		<node type="OUTPUT_MATERIAL" loc="590, 116" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="200.0" loc="-613, 301" />
+		<node type="VALUE" value="1.79999" loc="-791, 101" />
+		<node type="TEX_COORD" loc="-988, 301" />
+	</nodes>
+	<links>
+		<link to="9" input="0" from="0" output="0" />
+		<link to="1" input="1" from="5" output="0" />
+		<link to="0" input="1" from="1" output="0" />
+		<link to="1" input="2" from="6" output="0" />
+		<link to="4" input="0" from="7" output="0" />
+		<link to="1" input="0" from="4" output="0" />
+		<link to="0" input="2" from="2" output="0" />
+		<link to="0" input="0" from="3" output="0" />
+		<link to="7" input="0" from="10" output="1" />
+		<link to="7" input="1" from="8" output="0" />
+		<link to="10" input="1" from="11" output="0" />
+		<link to="8" input="0" from="11" output="0" />
+		<link to="10" input="0" from="12" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.jpg
new file mode 100644
index 0000000..98f79b6
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/malachite.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.bcm
new file mode 100644
index 0000000..a9e5699
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.bcm
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.16230, 0.15524, 0.16953)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="1054, 111" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.02451, 0.02451, 0.02451, 1.0)" roughness="0.0" loc="-197, 192" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.0, 0.0, 0.0, 1.0)" roughness="0.0" loc="-198, 48" />
+		<node type="MIX_SHADER" fac="0.75" loc="115, 181" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.07092, 0.16557, 0.28448, 1.0)" color2="rgba(0.31448, 0.09621, 0.09221, 1.0)" loc="-454, 211" />
+		<node type="TEX_VORONOI" coloring="CELLS" scale="50.0" loc="-736, 301" />
+		<node type="MIX_SHADER" fac="0.10000" loc="814, 122" />
+		<node type="LAYER_WEIGHT" blend="0.5" loc="519, 339" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.57559, 0.57559, 0.57559, 1.0)" roughness="0.0" loc="519, -99" />
+		<node type="MIX_SHADER" fac="0.30000" loc="519, 159" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.22966, 0.22966, 0.22966, 1.0)" roughness="0.10000" loc="115, -17" />
+		<node type="RGB" custom_color="rgb(0.24929, 0.58200, 1.0)" label="Fleck Color" color="rgba(0.07092, 0.16557, 0.28448, 1.0)" loc="-1162, 583" />
+		<node type="VALUE" label="Fleck Scale" value="50.0" loc="-1156, 98" />
+		<node type="RGB" custom_color="rgb(1.0, 0.30594, 0.29320)" label="Fleck Color" color="rgba(0.31448, 0.09621, 0.09221, 1.0)" loc="-1167, 388" />
+		<node type="VALUE" label="Bloom Size" value="0.10000" loc="-738, -90" />
+		<node type="RGB" label="Bloom Color" color="rgba(0.22966, 0.22966, 0.22966, 1.0)" loc="-982, 21" />
+		<node type="VALUE" label="Fresnel" value="0.5" loc="-872, 638" />
+		<node type="VALUE" label="Roughness" value="0.01999" loc="-652, -178" />
+		<node type="VALUE" label="Fleck Amount" value="0.75" loc="-1158, 192" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="6" output="0" />
+		<link to="3" input="1" from="1" output="0" />
+		<link to="4" input="0" from="5" output="1" />
+		<link to="1" input="0" from="4" output="0" />
+		<link to="9" input="1" from="3" output="0" />
+		<link to="3" input="2" from="2" output="0" />
+		<link to="6" input="1" from="9" output="0" />
+		<link to="6" input="2" from="8" output="0" />
+		<link to="6" input="0" from="7" output="0" />
+		<link to="9" input="2" from="10" output="0" />
+		<link to="3" input="0" from="18" output="0" />
+		<link to="4" input="1" from="11" output="0" />
+		<link to="4" input="2" from="13" output="0" />
+		<link to="5" input="1" from="12" output="0" />
+		<link to="10" input="0" from="15" output="0" />
+		<link to="7" input="0" from="16" output="0" />
+		<link to="10" input="1" from="14" output="0" />
+		<link to="8" input="1" from="17" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.jpg
new file mode 100644
index 0000000..8ac973c
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/stones/polished_haematite.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.bcm
new file mode 100644
index 0000000..53e8e0d
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.bcm
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.19176, 0.19176, 0.19176)" sample_lamp="True">
+	<nodes>
+		<node type="TEX_WAVE" wave="BANDS" scale="80.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-482, 181" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-108, 105" />
+		<node type="TEX_COORD" loc="-1132, -8" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(3.0, 1.5, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-711, 160" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 1.57079)" scale="Vector(1.0, 2.0, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-747, -45" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(4.0, 1.0, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-751, -228" />
+		<node type="TEX_WAVE" wave="BANDS" scale="30.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-462, -29" />
+		<node type="BSDF_GLOSSY" distribution="GGX" color="rgba(0.69505, 0.69505, 0.69505, 1.0)" roughness="0.20000" loc="-101, 252" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.04176, 0.04176, 0.04176, 1.0)" color2="rgba(0.00326, 0.00326, 0.00326, 1.0)" loc="-244, 330" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-103, 351" />
+		<node type="FRESNEL" ior="1.45000" loc="-101, 437" />
+		<node type="MIX_SHADER" fac="0.5" loc="101, 382" />
+		<node type="ADD_SHADER" loc="291, 346" />
+		<node type="OUTPUT_MATERIAL" loc="514, 280" />
+		<node type="BSDF_VELVET" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" sigma="0.20000" loc="95, 256" />
+		<node type="LAYER_WEIGHT" blend="0.5" loc="-426, 298" />
+		<node type="TEX_WAVE" wave="BANDS" scale="80.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-531, -248" />
+		<node type="TEX_CHECKER" color1="rgba(0.80000, 0.80000, 0.80000, 1.0)" color2="rgba(0.20000, 0.20000, 0.20000, 1.0)" scale="100.0" loc="289, 148" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-3, -147" />
+		<node type="TEX_WAVE" wave="BANDS" scale="30.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-264, -66" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Checker Scale" value="100.0" loc="-1003, 385" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.5, 0.5)" label="Large Scale" value="25.0" loc="-1080, 295" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.80000, 0.80000)" label="Small Scale" value="200.0" loc="-1090, 198" />
+	</nodes>
+	<links>
+		<link to="11" input="1" from="9" output="0" />
+		<link to="8" input="0" from="15" output="1" />
+		<link to="9" input="0" from="8" output="0" />
+		<link to="12" input="0" from="11" output="0" />
+		<link to="11" input="0" from="10" output="0" />
+		<link to="13" input="0" from="12" output="0" />
+		<link to="11" input="2" from="7" output="0" />
+		<link to="12" input="1" from="14" output="0" />
+		<link to="13" input="2" from="17" output="0" />
+		<link to="0" input="0" from="4" output="0" />
+		<link to="4" input="0" from="2" output="2" />
+		<link to="3" input="0" from="2" output="2" />
+		<link to="16" input="0" from="5" output="0" />
+		<link to="5" input="0" from="2" output="2" />
+		<link to="6" input="0" from="5" output="0" />
+		<link to="19" input="0" from="4" output="0" />
+		<link to="1" input="1" from="0" output="0" />
+		<link to="1" input="2" from="6" output="0" />
+		<link to="18" input="1" from="19" output="0" />
+		<link to="18" input="2" from="16" output="0" />
+		<link to="17" input="2" from="18" output="0" />
+		<link to="17" input="0" from="3" output="0" />
+		<link to="17" input="1" from="1" output="0" />
+		<link to="6" input="1" from="21" output="0" />
+		<link to="19" input="1" from="21" output="0" />
+		<link to="0" input="1" from="22" output="0" />
+		<link to="16" input="1" from="22" output="0" />
+		<link to="17" input="3" from="20" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.jpg
new file mode 100644
index 0000000..013709e
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.bcm
new file mode 100644
index 0000000..ba15bda
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.bcm
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.19999, 0.19999, 0.19999)" sample_lamp="True">
+	<nodes>
+		<node type="LAYER_WEIGHT" blend="0.5" loc="-356, 72" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.21049, 0.21049, 0.21049, 1.0)" color2="rgba(0.00326, 0.00326, 0.00326, 1.0)" loc="-186, 88" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="-58, 96" />
+		<node type="BSDF_VELVET" color="rgba(0.53048, 0.53048, 0.53048, 1.0)" sigma="0.10000" loc="-65, 0" />
+		<node type="MIX_SHADER" fac="0.5" loc="113, 161" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.15031, 0.15031, 0.15031, 1.0)" roughness="0.05000" loc="117, 26" />
+		<node type="MIX_SHADER" fac="0.5" loc="293, 86" />
+		<node type="OUTPUT_MATERIAL" loc="476, 82" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(3.0, 1.5, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1471, 150" />
+		<node type="TEX_WAVE" wave="BANDS" scale="80.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-1242, 171" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-868, 95" />
+		<node type="TEX_COORD" loc="-1892, -18" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 1.57079)" scale="Vector(1.0, 2.0, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1507, -55" />
+		<node type="MAPPING" hide="True" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 0.0)" scale="Vector(4.0, 1.0, 1.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1511, -238" />
+		<node type="TEX_WAVE" wave="BANDS" scale="30.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-1222, -39" />
+		<node type="TEX_WAVE" wave="BANDS" scale="80.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-1291, -258" />
+		<node type="TEX_WAVE" wave="BANDS" scale="30.0" distortion="0.0" detail="2.0" detail_scale="1.0" loc="-1024, -76" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Checker Scale" value="100.0" loc="-1763, 375" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.5, 0.5)" label="Large Scale" value="25.0" loc="-1840, 285" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.80000, 0.80000)" label="Small Scale" value="200.0" loc="-1850, 188" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.5, 0.5, 0.5, 1.0)" loc="-816, -98" />
+		<node type="TEX_CHECKER" color1="rgba(0.80000, 0.80000, 0.80000, 1.0)" color2="rgba(0.20000, 0.20000, 0.20000, 1.0)" scale="100.0" loc="-577, 152" />
+	</nodes>
+	<links>
+		<link to="1" input="0" from="0" output="1" />
+		<link to="2" input="0" from="1" output="0" />
+		<link to="4" input="1" from="2" output="0" />
+		<link to="6" input="1" from="4" output="0" />
+		<link to="7" input="0" from="6" output="0" />
+		<link to="6" input="2" from="5" output="0" />
+		<link to="4" input="2" from="3" output="0" />
+		<link to="9" input="0" from="12" output="0" />
+		<link to="12" input="0" from="11" output="2" />
+		<link to="8" input="0" from="11" output="2" />
+		<link to="15" input="0" from="13" output="0" />
+		<link to="13" input="0" from="11" output="2" />
+		<link to="14" input="0" from="13" output="0" />
+		<link to="16" input="0" from="12" output="0" />
+		<link to="10" input="1" from="9" output="0" />
+		<link to="10" input="2" from="14" output="0" />
+		<link to="20" input="1" from="16" output="0" />
+		<link to="20" input="2" from="15" output="0" />
+		<link to="21" input="2" from="20" output="0" />
+		<link to="21" input="0" from="8" output="0" />
+		<link to="21" input="1" from="10" output="0" />
+		<link to="14" input="1" from="18" output="0" />
+		<link to="16" input="1" from="18" output="0" />
+		<link to="9" input="1" from="19" output="0" />
+		<link to="15" input="1" from="19" output="0" />
+		<link to="21" input="3" from="17" output="0" />
+		<link to="0" input="0" from="21" output="0" />
+		<link to="4" input="0" from="21" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.jpg
new file mode 100644
index 0000000..2d2d243
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/carbon_fiber_glossy.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.bcm
new file mode 100644
index 0000000..94a6f79
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.bcm
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.94999, 0.97200, 1.0)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="717, 99" />
+		<node type="FRESNEL" ior="1.15999" loc="-90, 264" />
+		<node type="MIX_SHADER" fac="0.0" loc="-93, 175" />
+		<node type="BSDF_TRANSLUCENT" color="rgba(0.85499, 0.87512, 0.89999, 1.0)" loc="-332, 92" />
+		<node type="MATH" hide="True" operation="MULTIPLY" use_clamp="False" value1="16.0" value2="0.03999" loc="543, -7" />
+		<node type="TEX_VORONOI" coloring="INTENSITY" scale="20.0" loc="-329, -135" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.85499, 0.87512, 0.89999, 1.0)" roughness="0.0" loc="-333, 198" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.85499, 0.87512, 0.89999, 1.0)" roughness="0.77999" loc="-90, 47" />
+		<node type="RGB" custom_color="rgb(0.89999, 0.89999, 0.89999)" label="Color" color="rgba(0.85500, 0.87512, 0.89999, 1.0)" loc="-935, 174" />
+		<node type="TEX_NOISE" scale="20.0" detail="0.0" distortion="0.0" loc="-714, 73" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="20.0" loc="-899, -71" />
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="0.20000" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.85000, 0.85000, 0.85000, 1.0)" loc="-497, 283" />
+		<node type="MATH" hide="True" operation="DIVIDE" use_clamp="False" value1="-16.0" value2="0.03999" loc="81, -76" />
+		<node type="VALTORGB" interpolation="LINEAR" fac="0.5" stops="2" stop1="0.00909|rgba(1.0, 1.0, 1.0, 1.0)" stop2="0.24545|rgba(1.0, 1.0, 1.0, 0.60000)" loc="88, -132" />
+		<node type="MIX_SHADER" fac="0.20000" loc="399, 152" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="14" output="0" />
+		<link to="14" input="2" from="7" output="0" />
+		<link to="14" input="0" from="1" output="0" />
+		<link to="14" input="1" from="2" output="0" />
+		<link to="2" input="2" from="3" output="0" />
+		<link to="2" input="1" from="6" output="0" />
+		<link to="13" input="0" from="5" output="1" />
+		<link to="5" input="1" from="10" output="0" />
+		<link to="3" input="0" from="8" output="0" />
+		<link to="12" input="1" from="10" output="0" />
+		<link to="4" input="1" from="13" output="1" />
+		<link to="4" input="0" from="12" output="0" />
+		<link to="0" input="2" from="4" output="0" />
+		<link to="9" input="1" from="10" output="0" />
+		<link to="7" input="0" from="8" output="0" />
+		<link to="11" input="1" from="8" output="0" />
+		<link to="6" input="0" from="11" output="0" />
+		<link to="11" input="0" from="9" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.jpg
new file mode 100644
index 0000000..45b1d1e
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/polystyrene_foam.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.bcm
new file mode 100644
index 0000000..1c08cfa
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.02120, 0.02120, 0.02120)" sample_lamp="True">
+	<nodes>
+		<node type="BSDF_TRANSLUCENT" color="rgba(1.0, 1.0, 1.0, 1.0)" loc="-178, 225" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.06305, 0.06305, 0.06305, 1.0)" roughness="0.0" loc="-186, 341" />
+		<node type="RGB" color="rgba(0.01164, 0.01164, 0.01164, 1.0)" loc="-551, 376" />
+		<node type="OUTPUT_MATERIAL" loc="300, 300" />
+		<node type="ADD_SHADER" loc="43, 316" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.20000" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(1.0, 1.0, 1.0, 1.0)" loc="-354, 254" />
+	</nodes>
+	<links>
+		<link to="4" input="0" from="1" output="0" />
+		<link to="4" input="1" from="0" output="0" />
+		<link to="1" input="0" from="2" output="0" />
+		<link to="5" input="1" from="2" output="0" />
+		<link to="3" input="0" from="4" output="0" />
+		<link to="0" input="0" from="5" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.jpg
new file mode 100644
index 0000000..737661e
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/synthetic/rubber.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.bcm
new file mode 100644
index 0000000..d912f5f
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.bcm
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.27171, 0.51361, 0.98764)" sample_lamp="True">
+	<nodes>
+		<node type="RGB" custom_color="rgb(0.66071, 0.73312, 1.0)" label="Denim Color" color="rgba(0.03543, 0.15026, 0.37318, 1.0)" loc="-732, 193" />
+		<node type="TEX_COORD" hide="True" loc="-528, 124" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.30000, 0.30000)" label="Denim Scale" value="40.0" loc="-710, -60" />
+		<node type="TEX_WAVE" hide="True" wave="BANDS" scale="100.0" distortion="0.0" detail="0.0" detail_scale="1.0" loc="-129, -52" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.80000, 0.80000, 0.80000, 1.0)" roughness="0.0" loc="447, 60" />
+		<node type="OUTPUT_MATERIAL" loc="738, 0" />
+		<node type="BRIGHTCONTRAST" hide="True" color="rgba(1.0, 1.0, 1.0, 1.0)" bright="0.40000" contrast="-0.40000" loc="-202, 146" />
+		<node type="TEX_NOISE" hide="True" scale="100.0" detail="2.0" distortion="0.0" loc="-246, 90" />
+		<node type="MIX_RGB" hide="True" blend_type="MIX" use_clamp="False" fac="0.80000" color1="rgba(0.82981, 0.86596, 1.0, 1.0)" color2="rgba(0.06378, 0.15115, 0.47318, 1.0)" loc="36, 135" />
+		<node type="MIX_RGB" hide="True" blend_type="MIX" use_clamp="False" fac="0.80000" color1="rgba(0.52075, 0.62256, 1.0, 1.0)" color2="rgba(0.06378, 0.15115, 0.47318, 1.0)" loc="259, 92" />
+		<node type="MATH" hide="True" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="2.0" loc="-398, 18" />
+	</nodes>
+	<links>
+		<link to="3" input="0" from="1" output="2" />
+		<link to="5" input="0" from="4" output="0" />
+		<link to="7" input="0" from="1" output="2" />
+		<link to="8" input="2" from="0" output="0" />
+		<link to="6" input="0" from="0" output="0" />
+		<link to="10" input="0" from="2" output="0" />
+		<link to="3" input="1" from="2" output="0" />
+		<link to="7" input="1" from="10" output="0" />
+		<link to="4" input="0" from="9" output="0" />
+		<link to="5" input="2" from="3" output="1" />
+		<link to="9" input="2" from="8" output="0" />
+		<link to="8" input="1" from="6" output="0" />
+		<link to="9" input="1" from="0" output="0" />
+		<link to="9" input="0" from="7" output="1" />
+		<link to="8" input="0" from="3" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.jpg
new file mode 100644
index 0000000..3e1136d
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/denim.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.bcm
new file mode 100644
index 0000000..00c1064
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.bcm
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.07842, 0.72156)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="242, 136" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.5" loc="-253, 254" />
+		<node type="LAYER_WEIGHT" blend="0.80000" loc="-448, 227" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.01166, 0.0, 0.80000, 1.0)" roughness="0.0" loc="-444, 17" />
+		<node type="MIX_SHADER" fac="0.5" loc="-20, 136" />
+		<node type="BSDF_VELVET" color="rgba(0.80000, 0.07875, 0.71977, 1.0)" sigma="1.0" loc="-475, 114" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="4" output="0" />
+		<link to="4" input="0" from="1" output="0" />
+		<link to="1" input="0" from="2" output="0" />
+		<link to="4" input="1" from="5" output="0" />
+		<link to="4" input="2" from="3" output="0" />
+		<link to="1" input="1" from="2" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.jpg
new file mode 100644
index 0000000..b3d5cc0
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/velvet_edged.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.bcm
new file mode 100644
index 0000000..81930e1
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.bcm
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.80000, 0.80000, 0.80000)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_SHADER" fac="0.02999" loc="1649, 550" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(0.79909, 0.67243, 0.60382, 1.0)" roughness="0.40000" loc="1451, 489" />
+		<node type="MIX_SHADER" fac="0.69999" loc="1452, 608" />
+		<node type="BSDF_VELVET" color="rgba(0.79909, 0.67243, 0.60382, 1.0)" sigma="0.89999" loc="1243, 532" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.79909, 0.67058, 0.60566, 1.0)" roughness="0.69998" loc="1239, 630" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.79909, 0.51714, 0.32036, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="1011, 555" />
+		<node type="MATH" operation="MINIMUM" use_clamp="False" value1="0.5" value2="0.5" loc="434, 428" />
+		<node type="VALTORGB" interpolation="EASE" fac="0.5" stops="12" stop1="0.0|rgba(1.0, 1.0, 1.0, 0.0)" stop2="0.11362|rgba(1.0, 1.0, 1.0, 0.50182)" stop3="0.18181|rgba(1.0, 1.0, 1.0, 0.00234)" stop4="0.21363|rgba(1.0, 1.0, 1.0, 0.02219)" stop5="0.27272|rgba(1.0, 1.0, 1.0, 0.0)" stop6="0.34545|rgba(1.0, 1.0, 1.0, 0.58626)" stop7="0.41817|rgba(1.0, 1.0, 1.0, 0.02921)" stop8="0.51362|rgba(1.0, 1.0, 1.0, 0.0)" stop9="0.64090|rgba(1.0, 1.0, 1.0, 0.03826)" stop10="0.74545|rgba(1.0, 1.0, 1.0, 1.0)" stop11="0.85453|rgba(1.0, 1.0, 1.0, 0.02249)" stop12="1.0|rgba(1.0, 1.0, 1.0, 0.0)" loc="-140, 400" />
+		<node type="VALTORGB" interpolation="EASE" fac="0.5" stops="10" stop1="0.0|rgba(1.0, 1.0, 1.0, 0.0)" stop2="0.17272|rgba(1.0, 1.0, 1.0, 0.73825)" stop3="0.29998|rgba(1.0, 1.0, 1.0, 0.0)" stop4="0.34999|rgba(1.0, 1.0, 1.0, 0.02642)" stop5="0.43180|rgba(1.0, 1.0, 1.0, 0.05547)" stop6="0.57271|rgba(1.0, 1.0, 1.0, 0.72980)" stop7="0.72272|rgba(1.0, 1.0, 1.0, 0.03361)" stop8="0.81818|rgba(1.0, 1.0, 1.0, 0.0)" stop9="0.91817|rgba(1.0, 1.0, 1.0, 0.32451)" stop10="1.0|rgba(1.0, 1.0, 1.0, 0.0)" loc="-140, 196" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-2.0" loc="150, 222" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="291, 322" />
+		<node type="MATH" operation="DIVIDE" use_clamp="False" value1="0.5" value2="3.0" loc="838, 562" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="2.0" loc="645, 522" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.20000" loc="1049, 184" />
+		<node type="OUTPUT_MATERIAL" loc="1966, 237" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="0.5" value2="0.5" loc="-236, 531" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="30.09999" loc="-913, 464" />
+		<node type="TEX_NOISE" scale="5.0" detail="0.99998" distortion="0.0" loc="-1531, 185" />
+		<node type="TEX_COORD" loc="-1720, 315" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="30.09999" value2="10.0" loc="-1712, 109" />
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="0.99000" color1="rgba(0.5, 0.5, 0.5, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="-1350, 220" />
+		<node type="SEPRGB" image="rgba(0.80000, 0.80000, 0.80000, 1.0)" loc="-1068, 269" />
+		<node type="VECT_MATH" operation="ADD" vector1="Vector(0.5, 0.5, 0.5)" vector2="Vector(0.5, 0.5, 0.5)" loc="-1212, 292" />
+		<node type="MATH" operation="ROUND" use_clamp="False" value1="0.5" value2="0.0" loc="-641, 604" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="-787, 602" />
+		<node type="MATH" operation="SUBTRACT" use_clamp="False" value1="0.5" value2="0.5" loc="-279, 176" />
+		<node type="MATH" operation="ROUND" use_clamp="False" value1="0.5" value2="0.0" loc="-433, 323" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="-600, 341" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="30.09999" loc="-753, 159" />
+		<node type="MATH" operation="ADD" use_clamp="False" value1="0.5" value2="0.5" loc="-902, 159" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="10.0" loc="-1945, 425" />
+	</nodes>
+	<links>
+		<link to="14" input="0" from="0" output="0" />
+		<link to="14" input="2" from="13" output="0" />
+		<link to="9" input="0" from="8" output="1" />
+		<link to="2" input="2" from="3" output="0" />
+		<link to="2" input="1" from="4" output="0" />
+		<link to="10" input="0" from="7" output="1" />
+		<link to="10" input="1" from="9" output="0" />
+		<link to="13" input="0" from="6" output="0" />
+		<link to="6" input="1" from="10" output="0" />
+		<link to="6" input="0" from="7" output="1" />
+		<link to="0" input="2" from="1" output="0" />
+		<link to="17" input="0" from="18" output="2" />
+		<link to="20" input="1" from="17" output="0" />
+		<link to="22" input="0" from="18" output="2" />
+		<link to="22" input="1" from="20" output="0" />
+		<link to="21" input="0" from="22" output="0" />
+		<link to="17" input="1" from="19" output="0" />
+		<link to="0" input="1" from="2" output="0" />
+		<link to="7" input="0" from="15" output="0" />
+		<link to="8" input="0" from="25" output="0" />
+		<link to="29" input="1" from="21" output="1" />
+		<link to="4" input="0" from="5" output="0" />
+		<link to="3" input="0" from="5" output="0" />
+		<link to="1" input="0" from="5" output="0" />
+		<link to="11" input="0" from="12" output="0" />
+		<link to="5" input="0" from="11" output="0" />
+		<link to="12" input="0" from="6" output="0" />
+		<link to="16" input="0" from="21" output="0" />
+		<link to="15" input="0" from="23" output="0" />
+		<link to="15" input="1" from="16" output="0" />
+		<link to="23" input="0" from="24" output="0" />
+		<link to="24" input="0" from="16" output="0" />
+		<link to="28" input="0" from="29" output="0" />
+		<link to="25" input="0" from="26" output="0" />
+		<link to="25" input="1" from="28" output="0" />
+		<link to="26" input="0" from="27" output="0" />
+		<link to="27" input="0" from="28" output="0" />
+		<link to="19" input="0" from="30" output="0" />
+		<link to="16" input="1" from="30" output="0" />
+		<link to="29" input="0" from="21" output="0" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.jpg
new file mode 100644
index 0000000..bbda283
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/weave_test.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.bcm
new file mode 100644
index 0000000..cbc9b99
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.bcm
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.30507, 0.03297, 0.13513)" sample_lamp="True">
+	<nodes>
+		<node type="OUTPUT_MATERIAL" loc="500, 250" />
+		<node type="MIX_SHADER" fac="0.5" loc="250, 400" />
+		<node type="BSDF_DIFFUSE" color="rgba(0.48183, 0.00535, 0.0, 1.0)" roughness="0.20000" loc="0, 400" />
+		<node type="BSDF_VELVET" color="rgba(0.18002, 0.14034, 0.64183, 1.0)" sigma="1.0" loc="0, 250" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="-10.60000" loc="250, 100" />
+		<node type="TEX_MAGIC" depth="2" scale="20.94300" distortion="1.0" loc="0, 100" />
+	</nodes>
+	<links>
+		<link to="0" input="0" from="1" output="0" />
+		<link to="1" input="1" from="2" output="0" />
+		<link to="1" input="2" from="3" output="0" />
+		<link to="0" input="2" from="4" output="0" />
+		<link to="4" input="0" from="5" output="1" />
+	</links>
+</material>
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.jpg
new file mode 100644
index 0000000..fe70fc2
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/textiles/woven_wool.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.bcm
new file mode 100644
index 0000000..60d5be2
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.bcm
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.14084, 0.05520, 0.03290)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="1.0" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="-131, 606" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.23573, 0.23573, 0.23573, 1.0)" loc="-266, 606" />
+		<node type="LAYER_WEIGHT" blend="0.02999" loc="7, 606" />
+		<node type="MIX_SHADER" fac="0.64398" loc="263, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.75" loc="7, 447" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.13197, 0.04244, 0.02085, 1.0)" color2="rgba(0.04010, 0.01503, 0.00737, 1.0)" loc="-266, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.88691, 0.84328, 1.0)" roughness="0.34999" loc="7, 298" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.00200" loc="7, 162" />
+		<node type="TEX_WAVE" wave="RINGS" scale="0.69998" distortion="700.0" detail="4.0" detail_scale="0.25" loc="-474, 672" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.25" loc="-635, 505" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.69998" loc="-771, 557" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="5.0" loc="-809, 281" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="1.0" loc="-1140, 300" />
+		<node type="TEX_COORD" loc="-1490, 554" />
+		<node type="OUTPUT_MATERIAL" loc="460, 390" />
+		<node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 1.74532)" scale="Vector(2.0, 0.40000, 10.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1266, 611" />
+		<node type="TEX_WAVE" wave="BANDS" scale="5.0" distortion="30.0" detail="4.42378" detail_scale="5.0" loc="-563, 348" />
+	</nodes>
+	<links>
+		<link to="5" input="0" from="16" output="1" />
+		<link to="7" input="0" from="16" output="1" />
+		<link to="16" input="0" from="15" output="0" />
+		<link to="15" input="0" from="13" output="0" />
+		<link to="3" input="2" from="6" output="0" />
+		<link to="14" input="0" from="3" output="0" />
+		<link to="3" input="1" from="4" output="0" />
+		<link to="3" input="0" from="2" output="1" />
+		<link to="14" input="2" from="7" output="0" />
+		<link to="8" input="0" from="15" output="0" />
+		<link to="1" input="0" from="8" output="1" />
+		<link to="4" input="0" from="0" output="0" />
+		<link to="0" input="2" from="5" output="0" />
+		<link to="9" input="0" from="12" output="0" />
+		<link to="8" input="4" from="9" output="0" />
+		<link to="10" input="0" from="12" output="0" />
+		<link to="8" input="1" from="10" output="0" />
+		<link to="11" input="0" from="12" output="0" />
+		<link to="16" input="4" from="11" output="0" />
+		<link to="16" input="1" from="11" output="0" />
+		<link to="0" input="1" from="1" output="0" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.jpg
new file mode 100644
index 0000000..e4bcae1
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/polished_walnut.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.bcm
new file mode 100644
index 0000000..853b7f6
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.bcm
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.59719, 0.43964, 0.25415)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.71174, 0.58495, 0.47878, 1.0)" loc="-266, 606" />
+		<node type="LAYER_WEIGHT" blend="0.00498" loc="7, 606" />
+		<node type="MIX_SHADER" fac="0.64398" loc="263, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.80000" loc="7, 447" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.83196, 0.60834, 0.35504, 1.0)" color2="rgba(0.61368, 0.48484, 0.29545, 1.0)" loc="-266, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.88691, 0.84328, 1.0)" roughness="0.89999" loc="7, 298" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.02999" loc="7, 162" />
+		<node type="TEX_WAVE" wave="RINGS" scale="0.69998" distortion="750.0" detail="4.0" detail_scale="0.25" loc="-474, 672" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.27000" loc="-635, 505" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.69998" loc="-771, 557" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="5.09997" loc="-809, 281" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="1.0" loc="-1140, 300" />
+		<node type="TEX_COORD" loc="-1490, 554" />
+		<node type="OUTPUT_MATERIAL" loc="460, 390" />
+		<node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 1.74532)" scale="Vector(2.0, 0.40000, 10.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1266, 611" />
+		<node type="TEX_WAVE" wave="BANDS" scale="5.0" distortion="30.0" detail="4.42378" detail_scale="5.0" loc="-563, 348" />
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="0.80000" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="-131, 606" />
+	</nodes>
+	<links>
+		<link to="4" input="0" from="15" output="1" />
+		<link to="6" input="0" from="15" output="1" />
+		<link to="15" input="0" from="14" output="0" />
+		<link to="14" input="0" from="12" output="0" />
+		<link to="2" input="2" from="5" output="0" />
+		<link to="13" input="0" from="2" output="0" />
+		<link to="2" input="1" from="3" output="0" />
+		<link to="2" input="0" from="1" output="1" />
+		<link to="13" input="2" from="6" output="0" />
+		<link to="7" input="0" from="14" output="0" />
+		<link to="0" input="0" from="7" output="1" />
+		<link to="3" input="0" from="16" output="0" />
+		<link to="8" input="0" from="11" output="0" />
+		<link to="7" input="4" from="8" output="0" />
+		<link to="9" input="0" from="11" output="0" />
+		<link to="7" input="1" from="9" output="0" />
+		<link to="10" input="0" from="11" output="0" />
+		<link to="15" input="4" from="10" output="0" />
+		<link to="15" input="1" from="10" output="0" />
+		<link to="16" input="2" from="0" output="0" />
+		<link to="16" input="1" from="4" output="0" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.jpg
new file mode 100644
index 0000000..991bcf8
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_pine.jpg differ
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.bcm b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.bcm
new file mode 100644
index 0000000..207a053
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.bcm
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<material view_color="rgb(0.06847, 0.02518, 0.01520)" sample_lamp="True">
+	<nodes>
+		<node type="MIX_RGB" blend_type="MULTIPLY" use_clamp="False" fac="1.0" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.0, 0.0, 0.0, 1.0)" loc="-131, 606" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(1.0, 1.0, 1.0, 1.0)" color2="rgba(0.23573, 0.23573, 0.23573, 1.0)" loc="-266, 606" />
+		<node type="LAYER_WEIGHT" blend="0.00999" loc="7, 606" />
+		<node type="MIX_SHADER" fac="0.64398" loc="263, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 1.0, 1.0, 1.0)" roughness="0.80000" loc="7, 447" />
+		<node type="MIX_RGB" blend_type="MIX" use_clamp="False" fac="0.5" color1="rgba(0.13197, 0.04244, 0.02085, 1.0)" color2="rgba(0.04010, 0.01503, 0.00737, 1.0)" loc="-266, 447" />
+		<node type="BSDF_GLOSSY" distribution="BECKMANN" color="rgba(1.0, 0.88691, 0.84328, 1.0)" roughness="0.69998" loc="7, 298" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.02999" loc="7, 162" />
+		<node type="TEX_WAVE" wave="RINGS" scale="0.69998" distortion="700.0" detail="4.0" detail_scale="0.25" loc="-474, 672" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.25" loc="-635, 505" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="0.69998" loc="-771, 557" />
+		<node type="MATH" operation="MULTIPLY" use_clamp="False" value1="0.5" value2="5.0" loc="-809, 281" />
+		<node type="VALUE" custom_color="rgb(1.0, 0.10000, 0.10000)" label="Scale" value="1.0" loc="-1140, 300" />
+		<node type="TEX_COORD" loc="-1490, 554" />
+		<node type="OUTPUT_MATERIAL" loc="460, 390" />
+		<node type="MAPPING" translation="Vector(0.0, 0.0, 0.0)" rotation="Vector(0.0, 0.0, 1.74532)" scale="Vector(2.0, 0.40000, 10.0)" use_min="False" use_max="False" vector="Vector(0.0, 0.0, 0.0)" loc="-1266, 611" />
+		<node type="TEX_WAVE" wave="BANDS" scale="5.0" distortion="30.0" detail="4.42378" detail_scale="5.0" loc="-563, 348" />
+	</nodes>
+	<links>
+		<link to="5" input="0" from="16" output="1" />
+		<link to="7" input="0" from="16" output="1" />
+		<link to="16" input="0" from="15" output="0" />
+		<link to="15" input="0" from="13" output="0" />
+		<link to="3" input="2" from="6" output="0" />
+		<link to="14" input="0" from="3" output="0" />
+		<link to="3" input="1" from="4" output="0" />
+		<link to="3" input="0" from="2" output="1" />
+		<link to="14" input="2" from="7" output="0" />
+		<link to="8" input="0" from="15" output="0" />
+		<link to="1" input="0" from="8" output="1" />
+		<link to="4" input="0" from="0" output="0" />
+		<link to="0" input="2" from="5" output="0" />
+		<link to="9" input="0" from="12" output="0" />
+		<link to="8" input="4" from="9" output="0" />
+		<link to="10" input="0" from="12" output="0" />
+		<link to="8" input="1" from="10" output="0" />
+		<link to="11" input="0" from="12" output="0" />
+		<link to="16" input="4" from="11" output="0" />
+		<link to="16" input="1" from="11" output="0" />
+		<link to="0" input="1" from="1" output="0" />
+	</links>
+</material>
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.jpg b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.jpg
new file mode 100644
index 0000000..98c2699
Binary files /dev/null and b/release/scripts/addons_contrib/online_mat_lib/material-library/bundled/cycles/wood/rough_walnut.jpg differ
diff --git a/build_files/scons/config/Modules/__init__.py b/release/scripts/addons_contrib/online_mat_lib/material-library/mat_lib_preview_image.jpg
similarity index 100%
copy from build_files/scons/config/Modules/__init__.py
copy to release/scripts/addons_contrib/online_mat_lib/material-library/mat_lib_preview_image.jpg
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/my-materials/read-me.txt b/release/scripts/addons_contrib/online_mat_lib/material-library/my-materials/read-me.txt
new file mode 100644
index 0000000..33b816b
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/my-materials/read-me.txt
@@ -0,0 +1 @@
+This is the folder location for your personal saved materials.
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/release/cycles/revision_data.ini b/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/release/cycles/revision_data.ini
new file mode 100644
index 0000000..cac98a4
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/release/cycles/revision_data.ini
@@ -0,0 +1 @@
+revision=001
diff --git a/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/testing/cycles/revision_data.ini b/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/testing/cycles/revision_data.ini
new file mode 100644
index 0000000..cac98a4
--- /dev/null
+++ b/release/scripts/addons_contrib/online_mat_lib/material-library/peter.cassetta.info/testing/cycles/revision_data.ini
@@ -0,0 +1 @@
+revision=001
diff --git a/release/scripts/addons_contrib/oscurart_tools.py b/release/scripts/addons_contrib/oscurart_tools.py
index 09bb764..4a0934f 100644
--- a/release/scripts/addons_contrib/oscurart_tools.py
+++ b/release/scripts/addons_contrib/oscurart_tools.py
@@ -37,6 +37,8 @@ import bmesh
 import time
 import random
 
+#r06
+
 ## CREA PANELES EN TOOLS
 
 # VARIABLES DE ENTORNO
@@ -199,19 +201,25 @@ class OscPanelRender(OscPollRender, bpy.types.Panel):
 
         col.operator("file.create_batch_maker_osc", icon="LINENUMBERS_ON", text="Make Render Batch")
         colrow = col.row()
-        colrow.operator("render.render_layers_at_time_osc", icon="RENDER_STILL", text="All Scenes")
-        colrow.operator("render.render_layers_at_time_osc_cf", icon="RENDER_STILL", text="> Frame")
+        col.operator("file.create_batch_python", icon="LINENUMBERS_ON", text="Make Python Batch")
         colrow = col.row()
-        colrow.operator("render.render_current_scene_osc", icon="RENDER_STILL", text="Active Scene")
-        colrow.operator("render.render_current_scene_osc_cf", icon="RENDER_STILL", text="> Frame")
-        colrow = col.row(align=1)
-        colrow.prop(bpy.context.scene, "OscSelScenes", text="")
-        colrow.operator("render.render_selected_scenes_osc", icon="RENDER_STILL", text="Selected Scenes")
-        colrow.operator("render.render_selected_scenes_osc_cf", icon="RENDER_STILL", text="> Fame")
+        colrow.operator("render.render_all_scenes_osc", icon="RENDER_STILL", text="All Scenes").frametype=False
+        colrow.operator("render.render_all_scenes_osc", icon="RENDER_STILL", text="> Frame").frametype=True
+        colrow = col.row()
+        colrow.operator("render.render_current_scene_osc", icon="RENDER_STILL", text="Active Scene").frametype=False
+        colrow.operator("render.render_current_scene_osc", icon="RENDER_STILL", text="> Frame").frametype=True
+
 
         colrow = col.row(align=1)
         colrow.prop(bpy.context.scene, "rcPARTS", text="Render Crop Parts")
         colrow.operator("render.render_crop_osc", icon="RENDER_REGION")
+        
+        col = layout.column(align=1)
+        colrow = col.row(align=1)
+        colrow.prop(bpy.context.scene, "use_render_scene", text="")  
+        colrow.operator("render.render_selected_scenes_osc", icon="RENDER_STILL", text="Selected Scenes").frametype=False
+        colrow.operator("render.render_selected_scenes_osc", icon="RENDER_STILL", text="> Fame").frametype=True   
+   
 
 
 class OscPanelFiles(OscPollFiles, bpy.types.Panel):
@@ -248,7 +256,8 @@ class OscPanelOverrides(OscPollOverrides, bpy.types.Panel):
         col.label(text="Active Scene: " + bpy.context.scene.name)
         col.label(text="Example: [[Group,Material]]")
         col.prop(bpy.context.scene, '["OVERRIDE"]', text="")
-        col.operator("render.check_overrides", text="Check List", icon="ZOOM_ALL")       
+        col.operator("render.check_overrides", text="Check List", icon="ZOOM_ALL")
+        col.operator("render.overrides_on", text="On / Off", icon="QUIT")                
 
         boxcol=layout.box().column(align=1)
         boxcol.label(text="Danger Zone")
@@ -397,20 +406,36 @@ class SelectMenor (bpy.types.Operator):
 
 
 ##-----------------------------------CREATE SHAPES----------------
-class CreaShapes(bpy.types.Operator):
-    bl_idname = "mesh.split_lr_shapes_osc"
-    bl_label = "Split LR Shapes"
-    bl_options = {"REGISTER", "UNDO"}
-    def execute(self, context):
-        ## VARIABLES
-        ACTOBJ=bpy.context.active_object
-        LENKB=len(ACTOBJ.data.shape_keys.key_blocks)
 
-        ## RECORTO NOMBRES
+def DefSplitShapes(self,ACTIVESHAPE,LAYOUTCOMPAT):
+    #PASO A OBJECT MODE
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+    
+    ## VARIABLES
+    ACTOBJ=bpy.context.active_object
+    LENKB=len(ACTOBJ.data.shape_keys.key_blocks)
+    INDEX=ACTOBJ.active_shape_key_index    
+    
+    ## RECORTO NOMBRES
+    if not LAYOUTCOMPAT:
         for SHAPE in ACTOBJ.data.shape_keys.key_blocks:
             if len(SHAPE.name) > 7:
                 SHAPE.name=SHAPE.name[:8]
-
+ 
+    if ACTIVESHAPE:  
+        print(INDEX)
+        ACTOBJ.active_shape_key_index=INDEX          
+        AS=ACTOBJ.active_shape_key
+        AS.value=1
+        bpy.ops.object.shape_key_add(from_mix=True)
+        ACTOBJ.data.shape_keys.key_blocks[-1].name=AS.name[:8]+"_L"
+        ACTOBJ.data.shape_keys.key_blocks[-1].vertex_group="_L"
+        bpy.ops.object.shape_key_add(from_mix=True)
+        ACTOBJ.data.shape_keys.key_blocks[-1].name=AS.name[:8]+"_R"
+        ACTOBJ.data.shape_keys.key_blocks[-1].vertex_group="_R"
+        bpy.ops.object.shape_key_clear()
+           
+    else:     
         ## DUPLICO SHAPES Y CONECTO GRUPO
         for SHAPE in ACTOBJ.data.shape_keys.key_blocks[1:]:
             SHAPE.value=1
@@ -421,10 +446,26 @@ class CreaShapes(bpy.types.Operator):
             ACTOBJ.data.shape_keys.key_blocks[-1].name=SHAPE.name[:8]+"_R"
             ACTOBJ.data.shape_keys.key_blocks[-1].vertex_group="_R"
             bpy.ops.object.shape_key_clear()
+        ACTOBJ.active_shape_key_index=INDEX 
 
-        print("OPERACION TERMINADA")
-        return {'FINISHED'}
 
+class CreaShapes(bpy.types.Operator):
+    bl_idname = "mesh.split_lr_shapes_osc"
+    bl_label = "Split LR Shapes"
+    bl_options = {"REGISTER", "UNDO"}
+
+    @classmethod
+    def poll(cls, context):
+        return context.object is not None
+
+    activeshape=bpy.props.BoolProperty(name="Only Active Shape", default=False)  
+    layoutcompat=bpy.props.BoolProperty(name="Layout Compatible", default=False)
+
+    def execute(self, context):
+
+        DefSplitShapes(self,self.activeshape,self.layoutcompat)
+
+        return {'FINISHED'}
 
 ##----------------------------SHAPES LAYOUT-----------------------
 
@@ -643,21 +684,17 @@ class normalsOutside(bpy.types.Operator):
 
 
 
-##--------------------------------RENDER LAYER AT TIME----------------------------
-
+##-------------------------------- RENDER ALL SCENES ----------------------------
 
-def defRenderAll (FRAMETYPE):
-    
 
+def defRenderAll (frametype):
     LISTMAT=[]
     SCENES=bpy.data.scenes[:]
     ACTSCENE=bpy.context.scene
     FC=bpy.context.scene.frame_current
     FS=bpy.context.scene.frame_start
     FE=bpy.context.scene.frame_end
-
     print("---------------------")
-
     ## GUARDO MATERIALES DE OBJETOS EN GRUPOS
     for OBJECT in bpy.data.objects[:]:
         SLOTLIST=[]
@@ -670,27 +707,19 @@ def defRenderAll (FRAMETYPE):
 
         except:
             pass
-
-
     for SCENE in SCENES:
         PROPTOLIST=list(eval(SCENE['OVERRIDE']))
         CURSC= SCENE.name
         PATH = SCENE.render.filepath
         ENDPATH = PATH
         FILEPATH=bpy.data.filepath
-
-
-
         # CAMBIO SCENE
         bpy.context.window.screen.scene=SCENE
-
-        if FRAMETYPE == True:
+        if frametype == True:
             bpy.context.scene.frame_start=FC
             bpy.context.scene.frame_end=FC
             bpy.context.scene.frame_end=FC
             bpy.context.scene.frame_start=FC
-
-
         ## SETEO MATERIALES  DE OVERRIDES
         try:
             for OVERRIDE in PROPTOLIST:
@@ -700,41 +729,28 @@ def defRenderAll (FRAMETYPE):
                             SLOT.material=bpy.data.materials[OVERRIDE[1]]
         except:
             pass
-
-        if sys.platform.startswith("w"):
-            print("PLATFORM: WINDOWS")
-            SCENENAME=(FILEPATH.rsplit("\\")[-1])[:-6]
-        else:
-            print("PLATFORM:LINUX")
-            SCENENAME=(FILEPATH.rsplit("/")[-1])[:-6]
-
+        SCENENAME=os.path.basename(FILEPATH.rpartition(".")[0])
         LAYERLIST=[]
         for layer in SCENE.render.layers:
             if layer.use == 1:
                 LAYERLIST.append(layer)
-
         for layers in LAYERLIST:
             for rl in LAYERLIST:
                 rl.use= 0
-
             print("SCENE: "+CURSC)
             print("LAYER: "+layers.name)
             print("OVERRIDE: "+str(PROPTOLIST))
-
-            SCENE.render.filepath = PATH + "/" + SCENENAME + "/" + CURSC + "/" + layers.name + "/" + SCENENAME + "_" + SCENE.name + "_" + layers.name + "_"
+            SCENE.render.filepath = "%s/%s/%s/%s/%s_%s_%s_" % (PATH,SCENENAME,CURSC,layers.name,SCENENAME,SCENE.name,layers.name)
             SCENE.render.layers[layers.name].use = 1
             bpy.ops.render.render(animation=True, write_still=True, layer=layers.name, scene= SCENE.name)
-
             print("DONE")
             print("---------------------")
 
         ## REESTABLECE LOS LAYERS
         for layer in LAYERLIST:
             layer.use = 1
-
         ## RESTAURA EL PATH FINAL
         SCENE.render.filepath = ENDPATH
-
         #RESTAURO MATERIALES  DE OVERRIDES
         for OBJECT in LISTMAT:
             SLOTIND=0
@@ -745,7 +761,7 @@ def defRenderAll (FRAMETYPE):
             except:
                 print("OUT OF RANGE")
         # RESTAURO FRAMES
-        if FRAMETYPE == True:
+        if frametype == True:
             SCENE.frame_start=FS
             SCENE.frame_end=FE
             SCENE.frame_end=FE
@@ -755,42 +771,28 @@ def defRenderAll (FRAMETYPE):
 
 
 class renderAll (bpy.types.Operator):
-    bl_idname="render.render_layers_at_time_osc"
-    bl_label="Render layers at time"
+    bl_idname="render.render_all_scenes_osc"
+    bl_label="Render All Scenes"
 
-    FRAMETYPE=bpy.props.BoolProperty(default=False)
+    frametype=bpy.props.BoolProperty(default=False)
 
 
     def execute(self,context):
-        defRenderAll(self.FRAMETYPE)
+        defRenderAll(self.frametype)
         return {'FINISHED'}
 
-class renderAllCF (bpy.types.Operator):
-    bl_idname="render.render_layers_at_time_osc_cf"
-    bl_label="Render layers at time Current Frame"
-
-    FRAMETYPE=bpy.props.BoolProperty(default=True)
-
-
-    def execute(self,context):
-        defRenderAll(self.FRAMETYPE)
-        return {'FINISHED'}
 
 
 ##--------------------------------RENDER SELECTED SCENES----------------------------
 
 
-bpy.types.Scene.OscSelScenes = bpy.props.StringProperty(default="[]")
-
-
-def defRenderSelected(FRAMETYPE):
-
+bpy.types.Scene.use_render_scene = bpy.props.BoolProperty()
 
 
+def defRenderSelected(frametype):
     ACTSCENE = bpy.context.scene
     LISTMAT = []
     SCENES = bpy.data.scenes[:]
-    SCENELIST = eval(bpy.context.scene.OscSelScenes)
     FC = bpy.context.scene.frame_current
     FS = bpy.context.scene.frame_start
     FE = bpy.context.scene.frame_end
@@ -805,27 +807,21 @@ def defRenderSelected(FRAMETYPE):
                 LISTMAT.append((OBJECT,SLOTLIST))
         except:
             pass
-
-
     for SCENE in SCENES:
-        if SCENE.name in SCENELIST:
+        if SCENE.use_render_scene:
             PROPTOLIST = list(eval(SCENE['OVERRIDE']))
             CURSC = SCENE.name
             PATH = SCENE.render.filepath
             ENDPATH = PATH
             FILEPATH = bpy.data.filepath
-
             print("---------------------")
-
             # CAMBIO SCENE
             bpy.context.window.screen.scene = SCENE
-
-            if FRAMETYPE  ==  True:
+            if frametype  ==  True:
                 bpy.context.scene.frame_start = FC
                 bpy.context.scene.frame_end = FC
                 bpy.context.scene.frame_end = FC
                 bpy.context.scene.frame_start = FC
-
             ## SETEO MATERIALES  DE OVERRIDES
             try:
                 for OVERRIDE in PROPTOLIST:
@@ -835,41 +831,27 @@ def defRenderSelected(FRAMETYPE):
                                 SLOT.material=bpy.data.materials[OVERRIDE[1]]
             except:
                 pass
-
-            if sys.platform.startswith("w"):
-                print("PLATFORM: WINDOWS")
-                SCENENAME=(FILEPATH.rsplit("\\")[-1])[:-6]
-            else:
-                print("PLATFORM:LINUX")
-                SCENENAME=(FILEPATH.rsplit("/")[-1])[:-6]
-
+            SCENENAME=os.path.basename(FILEPATH.rpartition(".")[0])
             LAYERLIST=[]
             for layer in SCENE.render.layers:
                 if layer.use == 1:
                     LAYERLIST.append(layer)
-
             for layers in LAYERLIST:
                 for rl in LAYERLIST:
                     rl.use= 0
-
                 print("SCENE: "+CURSC)
                 print("LAYER: "+layers.name)
                 print("OVERRIDE: "+str(PROPTOLIST))
-
-                SCENE.render.filepath = PATH + "/" + SCENENAME + "/" + CURSC + "/" + layers.name + "/" + SCENENAME + "_" + SCENE.name + "_" + layers.name + "_"
+                SCENE.render.filepath = "%s/%s/%s/%s/%s_%s_%s_" % (PATH,SCENENAME,CURSC,layers.name,SCENENAME,SCENE.name,layers.name)
                 SCENE.render.layers[layers.name].use = 1
                 bpy.ops.render.render(animation=True, layer=layers.name, write_still=True, scene= SCENE.name)
-
                 print("DONE")
                 print("---------------------")
-
             ## REESTABLECE LOS LAYERS
             for layer in LAYERLIST:
                 layer.use = 1
-
             ## RESTAURA EL PATH FINAL
             SCENE.render.filepath = ENDPATH
-
             #RESTAURO MATERIALES  DE OVERRIDES
             for OBJECT in LISTMAT:
                 SLOTIND = 0
@@ -879,15 +861,12 @@ def defRenderSelected(FRAMETYPE):
                         SLOTIND += 1
                 except:
                     print("OUT OF RANGE")
-
             # RESTAURO FRAMES
-            if FRAMETYPE == True:
+            if frametype == True:
                 SCENE.frame_start = FS
                 SCENE.frame_end = FE
                 SCENE.frame_end = FE
                 SCENE.frame_start = FS
-
-
     # RESTAURO SCENE
     bpy.context.window.screen.scene = ACTSCENE
 
@@ -896,36 +875,26 @@ class renderSelected (bpy.types.Operator):
     bl_idname="render.render_selected_scenes_osc"
     bl_label="Render Selected Scenes"
 
-    FRAMETYPE=bpy.props.BoolProperty(default=False)
+    frametype=bpy.props.BoolProperty(default=False)
 
     def execute(self,context):
-        defRenderSelected(self.FRAMETYPE)
+        defRenderSelected(self.frametype)
         return {'FINISHED'}
 
-class renderSelectedCF (bpy.types.Operator):
-    bl_idname="render.render_selected_scenes_osc_cf"
-    bl_label="Render Selected Scenes Curent Frame"
 
-    FRAMETYPE=bpy.props.BoolProperty(default=True)
-
-    def execute(self,context):
-        defRenderSelected(self.FRAMETYPE)
-        return {'FINISHED'}
 
 
 ##--------------------------------RENDER CURRENT SCENE----------------------------
 
 
-def defRenderCurrent (FRAMETYPE):
+def defRenderCurrent (frametype):
     LISTMAT = []
     SCENE = bpy.context.scene
     FC = bpy.context.scene.frame_current
     FS = bpy.context.scene.frame_start
     FE = bpy.context.scene.frame_end
 
-
     print("---------------------")
-
     ## GUARDO MATERIALES DE OBJETOS EN GRUPOS
     for OBJECT in bpy.data.objects[:]:
         SLOTLIST = []
@@ -936,21 +905,16 @@ def defRenderCurrent (FRAMETYPE):
                 LISTMAT.append((OBJECT,SLOTLIST))
         except:
             pass
-
-
     PROPTOLIST = list(eval(SCENE['OVERRIDE']))
     CURSC = SCENE.name
     PATH = SCENE.render.filepath
     ENDPATH = PATH
     FILEPATH = bpy.data.filepath
-
-
-    if FRAMETYPE == True:
+    if frametype == True:
         bpy.context.scene.frame_start = FC
         bpy.context.scene.frame_end = FC
         bpy.context.scene.frame_end = FC
         bpy.context.scene.frame_start = FC
-
     ## SETEO MATERIALES  DE OVERRIDES
     try:
         for OVERRIDE in PROPTOLIST:
@@ -960,42 +924,27 @@ def defRenderCurrent (FRAMETYPE):
                         SLOT.material = bpy.data.materials[OVERRIDE[1]]
     except:
         pass
-
-    if sys.platform.startswith("w"):
-        print("PLATFORM: WINDOWS")
-        SCENENAME=(FILEPATH.rsplit("\\")[-1])[:-6]
-    else:
-        print("PLATFORM:LINUX")
-        SCENENAME=(FILEPATH.rsplit("/")[-1])[:-6]
-
+    SCENENAME=os.path.basename(FILEPATH.rpartition(".")[0])
     LAYERLIST=[]
     for layer in SCENE.render.layers:
         if layer.use == 1:
             LAYERLIST.append(layer)
-
     for layers in LAYERLIST:
         for rl in LAYERLIST:
             rl.use= 0
-
         print("SCENE: "+CURSC)
         print("LAYER: "+layers.name)
         print("OVERRIDE: "+str(PROPTOLIST))
-
-
-        SCENE.render.filepath = PATH + "/" + SCENENAME + "/" + CURSC + "/" + layers.name + "/" + SCENENAME + "_" + SCENE.name + "_" + layers.name + "_"
+        SCENE.render.filepath = "%s/%s/%s/%s/%s_%s_%s_" % (PATH,SCENENAME,CURSC,layers.name,SCENENAME,SCENE.name,layers.name)
         SCENE.render.layers[layers.name].use = 1
         bpy.ops.render.render(animation=True, layer=layers.name, write_still=1, scene= SCENE.name)
-
         print("DONE")
         print("---------------------")
-
     ## REESTABLECE LOS LAYERS
     for layer in LAYERLIST:
         layer.use = 1
-
     ## RESTAURA EL PATH FINAL
     SCENE.render.filepath = ENDPATH
-
     #RESTAURO MATERIALES  DE OVERRIDES
     for OBJECT in LISTMAT:
         SLOTIND = 0
@@ -1005,9 +954,8 @@ def defRenderCurrent (FRAMETYPE):
                 SLOTIND += 1
         except:
             print("FUERA DE RANGO")
-
     # RESTAURO FRAMES
-    if FRAMETYPE == True:
+    if frametype == True:
         SCENE.frame_start = FS
         SCENE.frame_end = FE
         SCENE.frame_end = FE
@@ -1018,32 +966,19 @@ class renderCurrent (bpy.types.Operator):
     bl_idname="render.render_current_scene_osc"
     bl_label="Render Current Scene"
 
-    FRAMETYPE=bpy.props.BoolProperty(default=False)
+    frametype=bpy.props.BoolProperty(default=False)
 
     def execute(self,context):
 
-        defRenderCurrent(self.FRAMETYPE)
+        defRenderCurrent(self.frametype)
 
         return {'FINISHED'}
 
 
-class renderCurrentCF (bpy.types.Operator):
-    bl_idname="render.render_current_scene_osc_cf"
-    bl_label="Render Current Scene Current Frame"
 
-    FRAMETYPE=bpy.props.BoolProperty(default=True)
-
-    def execute(self,context):
-
-        defRenderCurrent(self.FRAMETYPE)
-
-        return {'FINISHED'}
 
 
 ##--------------------------RENDER CROP----------------------
-## SETEO EL STATUS DEL PANEL PARA EL IF
-bpy.types.Scene.RcropStatus = bpy.props.BoolProperty(default=0)
-
 ## CREO DATA PARA EL SLIDER
 bpy.types.Scene.rcPARTS = bpy.props.IntProperty(default=0, min=2, max=50, step=1)
 
@@ -1053,105 +988,41 @@ class renderCrop (bpy.types.Operator):
     bl_label="Render Crop: Render!"
     def execute(self,context):
 
-
-
-        ##AVERIGUO EL SISTEMA
-        if sys.platform.startswith("w"):    
-            print("PLATFORM: WINDOWS")
-            VARSYSTEM= "\\"
-        else:
-            print("PLATFORM:LINUX")
-            VARSYSTEM= "/"
-
-
-        ## NOMBRE DE LA ESCENA
-        SCENENAME=(bpy.data.filepath.rsplit(VARSYSTEM)[-1]).rsplit(".")[0]
-
-        ## CREA ARRAY
-        PARTES = []
-        START = 1
+        FILEPATH = bpy.data.filepath
+        SCENENAME=os.path.basename(FILEPATH.rpartition(".")[0])
         PARTS = bpy.context.scene.rcPARTS
         PARTS = PARTS+1
-        while START < PARTS:
-            PARTES.append(START)
-            START = START+1
-        print(PARTES)
-
+        PARTES=[i for i in range(1,PARTS)]            
 
-        ##SETEO VARIABLE PARA LA FUNCION DE RENDER
         NUMERODECORTE=1
-
-        ##ESCENA ACTIVA
         SCACT = bpy.context.scene
-
-        ## SETEO CROP
-        bpy.data.scenes[SCACT.name].render.use_crop_to_border = 1
-        bpy.data.scenes[SCACT.name].render.use_border = 1
-
-        ##A VERIGUO RES EN Y
-        RESY = bpy.data.scenes[SCACT.name].render.resolution_y
-
-        ## AVERIGUO EL PATH DE LA ESCENA
-        OUTPUTFILEPATH = bpy.data.scenes[SCACT.name].render.filepath
-        bpy.context.scene.render.filepath = OUTPUTFILEPATH+bpy.context.scene.name
-
-
-        ## CUANTAS PARTES HARA
+        SCACT.render.use_crop_to_border = 1
+        SCACT.render.use_border = 1
+        RESY = SCACT.render.resolution_y
+        OUTPUTFILEPATH = SCACT.render.filepath
         LENPARTES = len(PARTES)
-
-        ## DIVIDE 1 SOBRE LA CANTIDAD DE PARTES
         DIVISOR = 1/PARTES[LENPARTES-1]
-
-        ## SETEA VARIABLE DEL MARCO MINIMO Y MAXIMO
         CMIN = 0
         CMAX = DIVISOR
-
-        ## REMUEVE EL ULTIMO OBJETO DEL ARRAY PARTES
         PARTESRESTADA = PARTES.pop(LENPARTES-1)
-
-        ## SETEA EL MINIMO Y EL MAXIMO CON LOS VALORES DE ARRIBA
-        bpy.data.scenes[SCACT.name].render.border_min_y = CMIN
-        bpy.data.scenes[SCACT.name].render.border_max_y = CMAX
-
-
-        ##SETEA EL OUTPUT PARA LA PRIMERA PARTE
-        OUTPUTFILEPATH+bpy.context.scene.name
-        bpy.context.scene.render.filepath = OUTPUTFILEPATH + SCENENAME + VARSYSTEM + SCENENAME + "_PART" + str(PARTES[0]) + "_"
-
-        ##RENDER PRIMERA PARTE
+        SCACT.render.border_min_y = CMIN
+        SCACT.render.border_max_y = CMAX
+        SCACT.render.filepath =  "%s/%s/%s_PART%s_" % (OUTPUTFILEPATH,SCENENAME,SCENENAME,str(PARTES[0]))
         bpy.ops.render.render(animation=True)
         bpy.context.scene.render.filepath
-
-        ##SUMO UN NUMERO AL CORTE
         NUMERODECORTE = NUMERODECORTE + 1
-
-
         ## RENDER!
         for PARTE in PARTES:
-            ## SUMA A LOS VALORES DEL CROP
             CMIN = CMIN + DIVISOR
             CMAX = CMAX + DIVISOR
-            print("EL CROP ES DE " + str(CMIN) + " A " + str(CMAX))
-            ## SETEA BORDE
-            bpy.data.scenes[SCACT.name].render.border_min_y = CMIN
-            bpy.data.scenes[SCACT.name].render.border_max_y = CMAX
-            ## SETEA EL OUTPUT
-            bpy.context.scene.render.filepath = OUTPUTFILEPATH + SCENENAME + VARSYSTEM + SCENENAME + "_PART" + str(NUMERODECORTE) + "_"
-            print("EL OUTPUT DE LA FUNCION ES " + bpy.context.scene.render.filepath)
-            ## PRINTEA EL NUMERO DE CORTE
-            print(PARTE)
-            ## RENDER
+            SCACT.render.border_min_y = CMIN
+            SCACT.render.border_max_y = CMAX
+            bpy.context.scene.render.filepath =  "%s%s/%s_PART%s_" % (OUTPUTFILEPATH,SCENENAME,SCENENAME,str(NUMERODECORTE))
             bpy.ops.render.render(animation=True)
-            ## SUMO NUMERO DE CORTE
             NUMERODECORTE = NUMERODECORTE + 1
 
-
-        ## REESTABLEZCO EL FILEPATH
-        bpy.context.scene.render.filepath = OUTPUTFILEPATH
-
-
-        print("RENDER TERMINADO")
-
+        SCACT.render.filepath = OUTPUTFILEPATH
+        SCACT.render.use_border = False
         return {'FINISHED'}
 
 
@@ -1618,7 +1489,7 @@ def defoscBatchMaker(TYPE):
                 os.chmod(RLATFILE, stat.S_IRWXU)  
             except:
                 print("** Oscurart Batch maker can not modify the permissions.")                             
-        FILESC.writelines("import bpy \nbpy.ops.render.render_layers_at_time_osc()\nbpy.ops.wm.quit_blender()")
+        FILESC.writelines("import bpy \nbpy.ops.render.render_all_scenes_osc()\nbpy.ops.wm.quit_blender()")
         FILESC.close()
     else:
         print("The All Python files Skips: Already exist!")   
@@ -1641,7 +1512,6 @@ class oscBatchMaker (bpy.types.Operator):
     bl_label = "Make render batch"
     bl_options = {'REGISTER', 'UNDO'}
 
-
     type = bpy.props.EnumProperty(
             name="Render Mode",
             description="Select Render Mode.",
@@ -2058,7 +1928,29 @@ class OscRestoreOverrides(bpy.types.Operator):
         return {'FINISHED'}
 
 
+OVERRIDESSTATUS = False
+
+    
+class OscOverridesOn(bpy.types.Operator):
+    bl_idname = "render.overrides_on"
+    bl_label = "Turn On Overrides"
+    bl_options = {"REGISTER", "UNDO"}
 
+    def execute (self, context):
+        
+        global OVERRIDESSTATUS
+        
+        if OVERRIDESSTATUS == False:
+            bpy.app.handlers.render_pre.append(DefOscApplyOverrides)
+            bpy.app.handlers.render_post.append(DefOscRestoreOverrides)  
+            OVERRIDESSTATUS = True
+            print("Overrides on!")
+        else:    
+            bpy.app.handlers.render_pre.remove(DefOscApplyOverrides)
+            bpy.app.handlers.render_post.remove(DefOscRestoreOverrides)    
+            OVERRIDESSTATUS = False
+            print("Overrides off!")           
+        return {'FINISHED'}  
 
 
 
@@ -2193,7 +2085,7 @@ def reSymSave (self):
     XML.close()
     SYMAP.clear()
 
-def reSymMesh (self, SELECTED):
+def reSymMesh (self, SELECTED, SIDE):
     
     bpy.ops.object.mode_set(mode='EDIT')
     
@@ -2211,9 +2103,20 @@ def reSymMesh (self, SELECTED):
     
     SYMAP = eval(XML.readlines()[0])    
     
-    if SELECTED:
-        for VERT in SYMAP:
-            if BM.verts[SYMAP[VERT]].select:
+    if SIDE == "+-":
+        if SELECTED:
+            for VERT in SYMAP:
+                if BM.verts[SYMAP[VERT]].select:
+                    if VERT == SYMAP[VERT]:
+                        BM.verts[VERT].co[0] = 0
+                        BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
+                        BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]            
+                    else:    
+                        BM.verts[VERT].co[0] = -BM.verts[SYMAP[VERT]].co[0]
+                        BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
+                        BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]        
+        else:    
+            for VERT in SYMAP:
                 if VERT == SYMAP[VERT]:
                     BM.verts[VERT].co[0] = 0
                     BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
@@ -2221,17 +2124,29 @@ def reSymMesh (self, SELECTED):
                 else:    
                     BM.verts[VERT].co[0] = -BM.verts[SYMAP[VERT]].co[0]
                     BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
-                    BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]        
-    else:    
-        for VERT in SYMAP:
-            if VERT == SYMAP[VERT]:
-                BM.verts[VERT].co[0] = 0
-                BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
-                BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]            
-            else:    
-                BM.verts[VERT].co[0] = -BM.verts[SYMAP[VERT]].co[0]
-                BM.verts[VERT].co[1] = BM.verts[SYMAP[VERT]].co[1]
-                BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]
+                    BM.verts[VERT].co[2] = BM.verts[SYMAP[VERT]].co[2]
+    else:
+        if SELECTED:
+            for VERT in SYMAP:
+                if BM.verts[VERT].select:
+                    if VERT == SYMAP[VERT]:
+                        BM.verts[SYMAP[VERT]].co[0] = 0
+                        BM.verts[SYMAP[VERT]].co[1] = BM.verts[VERT].co[1]
+                        BM.verts[SYMAP[VERT]].co[2] = BM.verts[VERT].co[2]            
+                    else:    
+                        BM.verts[SYMAP[VERT]].co[0] = -BM.verts[VERT].co[0]
+                        BM.verts[SYMAP[VERT]].co[1] = BM.verts[VERT].co[1]
+                        BM.verts[SYMAP[VERT]].co[2] = BM.verts[VERT].co[2]        
+        else:    
+            for VERT in SYMAP:
+                if VERT == SYMAP[VERT]:
+                    BM.verts[SYMAP[VERT]].co[0] = 0
+                    BM.verts[SYMAP[VERT]].co[1] = BM.verts[VERT].co[1]
+                    BM.verts[SYMAP[VERT]].co[2] = BM.verts[VERT].co[2]            
+                else:    
+                    BM.verts[SYMAP[VERT]].co[0] = -BM.verts[VERT].co[0]
+                    BM.verts[SYMAP[VERT]].co[1] = BM.verts[VERT].co[1]
+                    BM.verts[SYMAP[VERT]].co[2] = BM.verts[VERT].co[2]                        
     
     bpy.ops.object.mode_set(mode='OBJECT')
     bpy.ops.object.mode_set(mode='EDIT')
@@ -2257,8 +2172,16 @@ class OscResymMesh (bpy.types.Operator):
 
     selected=bpy.props.BoolProperty(default=False, name="Only Selected")
     
+    side = bpy.props.EnumProperty(
+            name="Side_",
+            description="Select Side.",
+            items=(('+-', "+X to -X", "+X to -X"),
+                   ('-+', "-X to +X", "-X to +X")),
+            default='+-',
+            )    
+    
     def execute (self, context):
-        reSymMesh(self, self.selected)
+        reSymMesh(self, self.selected,self.side)
         return {'FINISHED'}
     
 ##=============== DISTRIBUTE ======================    
@@ -2423,6 +2346,87 @@ class OscRemoveOverridesSlot (bpy.types.Operator):
 bpy.utils.register_class(OscTransferOverrides)
 bpy.utils.register_class(OscAddOverridesSlot)
 bpy.utils.register_class(OscRemoveOverridesSlot)
+
+## --------------------------------------PYTHON BATCH--------------------------------------------------------
+def defoscPythonBatchMaker(BATCHTYPE,SIZE):
+    # REVISO SISTEMA
+    if sys.platform.startswith("w"):
+        print("PLATFORM: WINDOWS")
+        SYSBAR = "\\"
+        EXTSYS = ".bat"
+        QUOTES = '"'
+    else:
+        print("PLATFORM:LINUX")
+        SYSBAR = "/"
+        EXTSYS = ".sh"    
+        QUOTES = ''
+    
+    # CREO VARIABLES
+    FILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0]
+    SHFILE = "%s%s%s_PythonSecureBatch.py"   % (bpy.data.filepath.rpartition(SYSBAR)[0],SYSBAR,FILENAME)
+    BATCHLOCATION = "%s%s%s%s"   % (bpy.data.filepath.rpartition(SYSBAR)[0],SYSBAR,FILENAME,EXTSYS)
+
+    FILEBATCH = open(SHFILE,"w")
+    
+    if EXTSYS == ".bat":
+        BATCHLOCATION=BATCHLOCATION.replace("\\","/")    
+    
+    # SI EL OUTPUT TIENE DOBLE BARRA LA REEMPLAZO
+    FRO=bpy.context.scene.render.filepath        
+    if bpy.context.scene.render.filepath.count("//"):
+        FRO=bpy.context.scene.render.filepath.replace("//", bpy.data.filepath.rpartition(SYSBAR)[0]+SYSBAR)         
+    if EXTSYS == ".bat":
+        FRO=FRO.replace("\\","/")        
+          
+        
+                 
+    #CREO BATCH
+    bpy.ops.file.create_batch_maker_osc(type=BATCHTYPE)
+    
+    SCRIPT = "import os \nREPITE= True \nBAT= '%s'\nSCENENAME ='%s' \nDIR='%s%s' \ndef RENDER():\n    os.system(BAT) \ndef CLEAN():\n    global REPITE\n    FILES  = [root+'/'+FILE for root, dirs, files in os.walk(os.getcwd()) if len(files) > 0 for FILE in files if FILE.count('~') == False]\n    RESPUESTA=False\n    for FILE in FILES:\n        if os.path.getsize(FILE) < %s:\n            os.remove(FILE)\n            RESPUESTA= True\n    if RESPUESTA:\n        REPITE=True\n    else:\n        REPITE=False\nREPITE=True\nwhile REPITE:\n    global REPITE\n    REPITE=False\n    RENDER()\n    os.chdir(DIR)\n    CLEAN()" % (BATCHLOCATION,FILENAME,FRO,FILENAME,SIZE)
+    
+    
+    # DEFINO ARCHIVO DE BATCH
+    FILEBATCH.writelines(SCRIPT)
+    FILEBATCH.close()  
+    
+    
+    # ARCHIVO CALL
+    CALLFILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0]
+    CALLFILE = "%s%s%s_CallPythonSecureBatch%s"   % (bpy.data.filepath.rpartition(SYSBAR)[0],SYSBAR,CALLFILENAME,EXTSYS)  
+    CALLFILEBATCH = open(CALLFILE,"w")  
+    
+    SCRIPT = "python %s" % (SHFILE)
+    CALLFILEBATCH.writelines(SCRIPT)
+    CALLFILEBATCH.close()
+    
+    if EXTSYS == ".sh":
+        try:
+            os.chmod(CALLFILE, stat.S_IRWXU)  
+            os.chmod(SHFILE, stat.S_IRWXU) 
+        except:
+            print("** Oscurart Batch maker can not modify the permissions.")      
+    
+    
+    
+class oscPythonBatchMaker (bpy.types.Operator):
+    bl_idname = "file.create_batch_python"
+    bl_label = "Make Batch Python"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    size = bpy.props.IntProperty(name="Size in Bytes", default=10, min=0)
+    
+    type = bpy.props.EnumProperty(
+            name="Render Mode",
+            description="Select Render Mode.",
+            items=(('osRlat', "All Scenes", "Render All Layers At Time"),
+                   ('osRSlat', "Selected Scenes", "Render Only The Selected Scenes")),
+            default='osRlat',
+            )
+
+    def execute(self,context):
+        defoscPythonBatchMaker(self.type, self.size)
+        return {'FINISHED'}
  
 ##======================================================================================FIN DE SCRIPTS
 
diff --git a/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py b/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py
index 5a73a47..068a2ef 100644
--- a/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py
+++ b/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py
@@ -14,12 +14,12 @@ SUBSURF_RELATIVE = True  # Make subsurf hotkeys work by relative
 bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
 
 # Basic transform keys
-TRANSLATE_KEY = 'R'
-ROTATE_KEY = 'E'
-SCALE_KEY = 'W'
+TRANSLATE_KEY = 'F'
+ROTATE_KEY = 'D'
+SCALE_KEY = 'S'
 
 # Specials Menu Key
-SPECIALS_MENU_KEY = 'ACCENT_GRAVE'
+SPECIALS_MENU_KEY = 'Q'
 
 
 ################################
@@ -69,6 +69,7 @@ class ModeSwitchMenu(bpy.types.Menu):
         layout.operator_enum("object.mode_set", "mode")
 bpy.utils.register_class(ModeSwitchMenu)
 
+
 # Temporary work around: Blender does not properly limit the mode switch menu
 # items until the first mode switch (e.g. mesh objects will show pose mode as
 # an option).
@@ -168,6 +169,34 @@ class SetEditMeshSelectMode(bpy.types.Operator):
 bpy.utils.register_class(SetEditMeshSelectMode)
 
 
+class MeshDeleteContextual(bpy.types.Operator):
+    """ Deletes mesh elements based on context instead
+        of forcing the user to select from a menu what
+        it should delete.
+    """
+    bl_idname = "mesh.delete_contextual"
+    bl_label = "Mesh Delete Contextual"
+    bl_options = {'UNDO'}
+    
+    @classmethod
+    def poll(cls, context):
+        return (context.active_object is not None) and (context.mode == "EDIT_MESH")
+    
+    def execute(self, context):
+        select_mode = context.tool_settings.mesh_select_mode
+        
+        if select_mode[0]:
+            bpy.ops.mesh.delete(type='VERT')
+        elif select_mode[1] and not select_mode[2]:
+            bpy.ops.mesh.delete(type='EDGE')
+        elif select_mode[2] and not select_mode[1]:
+            bpy.ops.mesh.delete(type='FACE')
+        else:
+            bpy.ops.mesh.delete(type='VERT')
+            
+        return {'FINISHED'}
+bpy.utils.register_class(MeshDeleteContextual)
+
 ###########
 # Keymaps
 ###########
@@ -533,9 +562,9 @@ def MapAdd_View3D_Global(kc):
     
 
     # Basics with mouse
-    kmi = km.keymap_items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS')
+    kmi = km.keymap_items.new('view3d.rotate', 'MIDDLEMOUSE', 'PRESS')
+    kmi = km.keymap_items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', shift=True)
     kmi = km.keymap_items.new('view3d.zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
-    kmi = km.keymap_items.new('view3d.rotate', 'MIDDLEMOUSE', 'PRESS', shift=True)
     #kmi = km.keymap_items.new('view3d.dolly', 'MIDDLEMOUSE', 'PRESS', shift=True, ctrl=True)
 
     # Basics with mouse wheel
@@ -674,7 +703,7 @@ def MapAdd_View3D_Global(kc):
     kmi.properties.align_active = True
 
     # Fly mode
-    kmi = km.keymap_items.new('view3d.fly', 'F', 'CLICK', shift=True)
+    #kmi = km.keymap_items.new('view3d.fly', 'F', 'CLICK', shift=True)
 
     # Misc
     kmi = km.keymap_items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'CLICK')
@@ -777,16 +806,16 @@ def MapAdd_View3D_Global(kc):
     #-----------------------
     
     # Grab, rotate scale
-    kmi = km.keymap_items.new('transform.translate', TRANSLATE_KEY, 'CLICK')
+    kmi = km.keymap_items.new('transform.translate', TRANSLATE_KEY, 'PRESS')
     #kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
-    kmi = km.keymap_items.new('transform.rotate', ROTATE_KEY, 'CLICK')
-    kmi = km.keymap_items.new('transform.resize', SCALE_KEY, 'CLICK')
+    kmi = km.keymap_items.new('transform.rotate', ROTATE_KEY, 'PRESS')
+    kmi = km.keymap_items.new('transform.resize', SCALE_KEY, 'PRESS')
 
     # Mirror, shear, warp, to-sphere
-    kmi = km.keymap_items.new('transform.mirror', 'M', 'CLICK', ctrl=True)
-    kmi = km.keymap_items.new('transform.shear', 'S', 'CLICK', shift=True, ctrl=True, alt=True)
-    kmi = km.keymap_items.new('transform.warp', 'W', 'CLICK', shift=True)
-    kmi = km.keymap_items.new('transform.tosphere', 'S', 'CLICK', shift=True, alt=True)
+    #kmi = km.keymap_items.new('transform.mirror', 'M', 'CLICK', ctrl=True)
+    #kmi = km.keymap_items.new('transform.shear', 'S', 'CLICK', shift=True, ctrl=True, alt=True)
+    #kmi = km.keymap_items.new('transform.warp', 'W', 'CLICK', shift=True)
+    #kmi = km.keymap_items.new('transform.tosphere', 'S', 'CLICK', shift=True, alt=True)
 
     #-------------------------
     # Transform texture space
@@ -829,6 +858,7 @@ def MapAdd_View3D_Global(kc):
     #--------
     # Layers
     #--------
+    """
     kmi = km.keymap_items.new('view3d.layers', 'ACCENT_GRAVE', 'CLICK')
     kmi.properties.nr = 0
     kmi = km.keymap_items.new('view3d.layers', 'ONE', 'CLICK', any=True)
@@ -851,19 +881,19 @@ def MapAdd_View3D_Global(kc):
     kmi.properties.nr = 9
     kmi = km.keymap_items.new('view3d.layers', 'ZERO', 'CLICK', any=True)
     kmi.properties.nr = 10
+    """
 
     #------------------
     # Viewport drawing
     #------------------
-    kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'CLICK')
+    kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS')
     kmi.properties.data_path = 'space_data.viewport_shade'
     kmi.properties.value_1 = 'SOLID'
     kmi.properties.value_2 = 'WIREFRAME'
-    kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'CLICK', alt=True)
+    
+    kmi = km.keymap_items.new('wm.context_menu_enum', 'Z', 'PRESS', alt=True)
     kmi.properties.data_path = 'space_data.viewport_shade'
-    kmi.properties.value_1 = 'TEXTURED'
-    kmi.properties.value_2 = 'SOLID'
-
+    
     #-------------
     # Pivot point
     #-------------
@@ -1014,18 +1044,18 @@ def MapAdd_View3D_ObjectMode(kc):
     kmi.properties.name = 'VIEW3D_MT_object_specials'
     
     # Subdivision surface shortcuts
-    kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
-    kmi.properties.level = 0
-    kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
-    kmi.properties.level = 1
-    kmi = km.keymap_items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
-    kmi.properties.level = 2
-    kmi = km.keymap_items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
-    kmi.properties.level = 3
-    kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
-    kmi.properties.level = 4
-    kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
-    kmi.properties.level = 5
+    #kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
+    #kmi.properties.level = 0
+    #kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
+    #kmi.properties.level = 1
+    #kmi = km.keymap_items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
+    #kmi.properties.level = 2
+    #kmi = km.keymap_items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
+    #kmi.properties.level = 3
+    #kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
+    #kmi.properties.level = 4
+    #kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
+    #kmi.properties.level = 5
 
 
 def MapAdd_View3D_MeshEditMode(kc):
@@ -1061,25 +1091,32 @@ def MapAdd_View3D_MeshEditMode(kc):
     #-----------
     
     # Shortest path
-    #kmi = km.keymap_items.new('mesh.select_shortest_path', 'RIGHTMOUSE', 'CLICK')
+    kmi = km.keymap_items.new('mesh.select_shortest_path', 'LEFTMOUSE', 'CLICK', alt=True) # Replace
+    # TODO: add, remove
     
     # Edge loop
     kmi = km.keymap_items.new('mesh.loop_select', 'LEFTMOUSE', 'DOUBLE_CLICK') # Replace
     kmi.properties.extend = False
-    kmi = km.keymap_items.new('mesh.loop_select', 'LEFTMOUSE', 'DOUBLE_CLICK', shift=True) # Extend (TODO: Add)
+    kmi.properties.deselect = False
+    kmi = km.keymap_items.new('mesh.loop_select', 'LEFTMOUSE', 'DOUBLE_CLICK', shift=True) # Add
     kmi.properties.extend = True
-    # TODO: Remove
+    kmi.properties.deselect = False
+    kmi = km.keymap_items.new('mesh.loop_select', 'LEFTMOUSE', 'DOUBLE_CLICK', ctrl=True) # Remove
+    kmi.properties.extend = False
+    kmi.properties.deselect = True
     
     # Edge ring
     kmi = km.keymap_items.new('mesh.edgering_select', 'LEFTMOUSE', 'DOUBLE_CLICK', alt=True) # Replace
     kmi.properties.extend = False
-    kmi = km.keymap_items.new('mesh.edgering_select', 'LEFTMOUSE', 'DOUBLE_CLICK', alt=True, shift=True) # Extend (TODO: Add)
+    kmi.properties.deselect = False
+    kmi = km.keymap_items.new('mesh.edgering_select', 'LEFTMOUSE', 'DOUBLE_CLICK', alt=True, shift=True) # Add
     kmi.properties.extend = True
-    # TODO: Remove
-        
-    
+    kmi.properties.deselect = False
+    kmi = km.keymap_items.new('mesh.edgering_select', 'LEFTMOUSE', 'DOUBLE_CLICK', alt=True, ctrl=True) # Remove
+    kmi.properties.extend = False
+    kmi.properties.deselect = True
     
-    kmi = km.keymap_items.new('mesh.select_all', 'A', 'CLICK')
+    kmi = km.keymap_items.new('mesh.select_all', 'A', 'PRESS')
     kmi.properties.action = 'TOGGLE'
     kmi = km.keymap_items.new('mesh.select_all', 'I', 'CLICK', ctrl=True)
     kmi.properties.action = 'INVERT'
@@ -1113,56 +1150,114 @@ def MapAdd_View3D_MeshEditMode(kc):
     kmi.properties.unselected = True
     kmi = km.keymap_items.new('mesh.reveal', 'H', 'CLICK', alt=True)
 
-    # Create
-    kmi = km.keymap_items.new('mesh.loopcut_slide', 'R', 'CLICK', ctrl=True)
-    kmi = km.keymap_items.new('mesh.knifetool', 'K', 'CLICK')
-    #kmi = km.keymap_items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'CLICK')
-    #kmi = km.keymap_items.new('wm.call_menu', 'E', 'CLICK', alt=True)
-    #kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
-    kmi = km.keymap_items.new('mesh.edge_face_add', 'F', 'CLICK')
-    kmi = km.keymap_items.new('mesh.vert_connect', 'J', 'CLICK')
-    kmi = km.keymap_items.new('mesh.spin', 'R', 'CLICK', alt=True)
-    kmi = km.keymap_items.new('mesh.fill', 'F', 'CLICK', alt=True)
-    kmi = km.keymap_items.new('mesh.beautify_fill', 'F', 'CLICK', shift=True, alt=True)
-    kmi = km.keymap_items.new('mesh.duplicate_move', 'D', 'CLICK', shift=True)
-    kmi = km.keymap_items.new('wm.call_menu', 'A', 'CLICK', shift=True)
+    #-----------------
+    # Create Geometry
+    #-----------------
+    
+    # Add Primitive
+    kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
     kmi.properties.name = 'INFO_MT_mesh_add'
+    
+    # Add edge and face / vertex connect
+    kmi = km.keymap_items.new('mesh.edge_face_add', 'C', 'CLICK')
+    kmi = kmi = km.keymap_items.new('mesh.vert_connect', 'C', 'CLICK', shift=True)
+    
+    kmi = km.keymap_items.new('mesh.fill', 'C', 'CLICK', alt=True)
+    kmi = km.keymap_items.new('mesh.beautify_fill', 'C', 'CLICK', alt=True, shift=True)
+    
+    # Subdivide
+    kmi = km.keymap_items.new('mesh.subdivide', 'W', 'CLICK')
+    
+    # Loop cut
+    kmi = km.keymap_items.new('mesh.loopcut_slide', 'T', 'CLICK')
+    
+    # Knife
+    kmi = km.keymap_items.new('mesh.knife_tool', 'K', 'CLICK')
+    
+    # Extrude
+    kmi = km.keymap_items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'CLICK')
+    kmi = km.keymap_items.new('wm.call_menu', 'E', 'CLICK', alt=True)
+    kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
+    
     kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
     kmi.properties.rotate_source = True
     kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', shift=True, ctrl=True)
     kmi.properties.rotate_source = False
+    
+    # Inset/Outset
+    kmi = km.keymap_items.new('mesh.inset', 'I', 'CLICK')
+    kmi.properties.use_outset = False
+    kmi = km.keymap_items.new('mesh.inset', 'I', 'CLICK', shift=True)
+    kmi.properties.use_outset = True
+    
+    # Bevel
+    kmi = km.keymap_items.new('mesh.bevel', 'B', 'CLICK')
 
-    # Delete
-    kmi = km.keymap_items.new('wm.call_menu', 'X', 'CLICK')
+    # Duplicate
+    kmi = km.keymap_items.new('mesh.duplicate_move', 'D', 'CLICK', shift=True)
+    
+    # Rip
+    kmi = km.keymap_items.new('mesh.rip_move', 'R', 'CLICK')
+    
+    # Split / Separate
+    kmi = km.keymap_items.new('mesh.split', 'Y', 'CLICK')
+    kmi = km.keymap_items.new('mesh.separate', 'Y', 'CLICK', shift=True)
+    
+
+    #-----------------
+    # Remove Geometry
+    #-----------------
+
+    # Delete/Dissolve
+    kmi = km.keymap_items.new('mesh.delete_contextual', 'X', 'CLICK')
+    kmi = km.keymap_items.new('mesh.delete_contextual', 'DEL', 'CLICK')
+    
+    kmi = km.keymap_items.new('mesh.dissolve', 'X', 'CLICK', shift=True)
+    kmi.properties.use_verts = True
+    kmi = km.keymap_items.new('mesh.dissolve', 'DEL', 'CLICK', shift=True)
+    kmi.properties.use_verts = True
+    
+    kmi = km.keymap_items.new('wm.call_menu', 'X', 'CLICK', alt=True)
     kmi.properties.name = 'VIEW3D_MT_edit_mesh_delete'
-    kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'CLICK')
+    kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'CLICK', alt=True)
     kmi.properties.name = 'VIEW3D_MT_edit_mesh_delete'
 
-    # Separate
-    kmi = km.keymap_items.new('mesh.rip_move', 'V', 'CLICK')
-    kmi = km.keymap_items.new('mesh.split', 'Y', 'CLICK')
-    kmi = km.keymap_items.new('mesh.separate', 'P', 'CLICK')
-
-    # Merge
+    # Merge/collapse
+    kmi = km.keymap_items.new('mesh.edge_collapse', 'M', 'CLICK')
     kmi = km.keymap_items.new('mesh.merge', 'M', 'CLICK', alt=True)
-
-    # Transform
+    
+    #-----------------
+    # Deform Geometry
+    #-----------------
+    
+    # Smooth
+    kmi = km.keymap_items.new('mesh.vertices_smooth', 'W', 'PRESS', shift=True)
+    
+    # Shrink / Fatten
     kmi = km.keymap_items.new('transform.shrink_fatten', 'S', 'CLICK', alt=True)
+    
+    #------
+    # Misc
+    #------
+    
+    # Vert/edge properties
     #kmi = km.keymap_items.new('transform.edge_crease', 'E', 'CLICK', shift=True)
-    kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'CLICK', ctrl=True)
-    kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'CLICK', shift=True, ctrl=True)
-    kmi.properties.use_beauty = False
-    kmi = km.keymap_items.new('mesh.tris_convert_to_quads', 'J', 'CLICK', alt=True)
+    
+    # Tri/quad conversion
+    #kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'CLICK', ctrl=True)
+    #kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'CLICK', shift=True, ctrl=True)
+    #kmi.properties.use_beauty = False
+    #kmi = km.keymap_items.new('mesh.tris_convert_to_quads', 'J', 'CLICK', alt=True)
 
     # Tool Menus
     kmi = km.keymap_items.new('wm.call_menu', SPECIALS_MENU_KEY, 'CLICK')
     kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
-    kmi = km.keymap_items.new('wm.call_menu', 'F', 'CLICK', ctrl=True)
-    kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
-    #kmi = km.keymap_items.new('wm.call_menu', 'E', 'CLICK', ctrl=True)
-    #kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
-    kmi = km.keymap_items.new('wm.call_menu', 'V', 'CLICK', ctrl=True)
+    kmi = km.keymap_items.new('wm.call_menu', 'ONE', 'CLICK', alt=True)
     kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices'
+    kmi = km.keymap_items.new('wm.call_menu', 'TWO', 'CLICK', alt=True)
+    kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
+    kmi = km.keymap_items.new('wm.call_menu', 'THREE', 'CLICK', alt=True)
+    kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
 
     # UV's
     kmi = km.keymap_items.new('wm.call_menu', 'U', 'CLICK')
@@ -1176,10 +1271,10 @@ def MapAdd_View3D_MeshEditMode(kc):
 
     # Subsurf shortcuts
     if SUBSURF_RELATIVE:
-        kmi = km.keymap_items.new('object.shift_subsurf_level', 'EQUAL', 'CLICK')
+        kmi = km.keymap_items.new('object.shift_subsurf_level', 'EQUAL', 'PRESS')
         kmi.properties.delta = 1
         kmi.properties.max = 4
-        kmi = km.keymap_items.new('object.shift_subsurf_level', 'MINUS', 'CLICK')
+        kmi = km.keymap_items.new('object.shift_subsurf_level', 'MINUS', 'PRESS')
         kmi.properties.delta = -1
         kmi.properties.min = 0
     else:
@@ -1204,27 +1299,6 @@ def MapAdd_View3D_MeshEditMode(kc):
     kmi.properties.name = 'VIEW3D_MT_vertex_group'
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 def MapAdd_ModalStandard(kc):
     """ Standard Modal Map
         Super basic modal stuff that applies globally in Blender.
@@ -1282,10 +1356,10 @@ def MapAdd_ModalTransform(kc):
     kmi = km.keymap_items.new_modal('PLANE_Y', 'Y', 'CLICK', shift=True)
     kmi = km.keymap_items.new_modal('PLANE_Z', 'Z', 'CLICK', shift=True)
 
-    # ???
-    #kmi = km.keymap_items.new_modal('TRANSLATE', TRANSLATE_KEY, 'CLICK')
-    #kmi = km.keymap_items.new_modal('ROTATE', ROTATE_KEY, 'CLICK')
-    #kmi = km.keymap_items.new_modal('RESIZE', SCALE_KEY, 'CLICK')
+    # Overrides ("No, really, actually translate") and trackball rotate
+    kmi = km.keymap_items.new_modal('TRANSLATE', TRANSLATE_KEY, 'PRESS')
+    kmi = km.keymap_items.new_modal('ROTATE', ROTATE_KEY, 'PRESS')
+    kmi = km.keymap_items.new_modal('RESIZE', SCALE_KEY, 'PRESS')
 
 
 def MapAdd_ModalBorderSelect(kc):
diff --git a/release/scripts/addons_contrib/render_clay.py b/release/scripts/addons_contrib/render_clay.py
index f03c4d0..677d1de 100644
--- a/release/scripts/addons_contrib/render_clay.py
+++ b/release/scripts/addons_contrib/render_clay.py
@@ -64,7 +64,7 @@ def Alternative_Clay(self, msg):
             if (mat.Mat_Clay):
                 i += 1
 
-    if msg == True:
+    if msg is True:
         if (i == 1):
             self.report({'INFO'}, "The material \"" + AM.name + "\" is set "\
                 "as Clay!")
diff --git a/release/scripts/addons_contrib/render_to_print.py b/release/scripts/addons_contrib/render_to_print.py
index f376752..075e0dd 100644
--- a/release/scripts/addons_contrib/render_to_print.py
+++ b/release/scripts/addons_contrib/render_to_print.py
@@ -113,7 +113,7 @@ paper_presets_data = {idname: paper_enum_parse(idname)
 
 def update_settings_cb(self, context):
     # annoying workaround for recursive call
-    if update_settings_cb.level == False:
+    if update_settings_cb.level is False:
         update_settings_cb.level = True
         pixels_from_print(self)
         update_settings_cb.level = False
diff --git a/release/scripts/addons_contrib/sequencer_extra_actions/exiftool.py b/release/scripts/addons_contrib/sequencer_extra_actions/exiftool.py
new file mode 100644
index 0000000..4ce6cd1
--- /dev/null
+++ b/release/scripts/addons_contrib/sequencer_extra_actions/exiftool.py
@@ -0,0 +1,327 @@
+# -*- coding: utf-8 -*-
+# PyExifTool <http://github.com/smarnach/pyexiftool>
+# Copyright 2012 Sven Marnach
+
+# This file is part of PyExifTool.
+#
+# PyExifTool is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PyExifTool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with PyExifTool.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+PyExifTool is a Python library to communicate with an instance of Phil
+Harvey's excellent ExifTool_ command-line application.  The library
+provides the class :py:class:`ExifTool` that runs the command-line
+tool in batch mode and features methods to send commands to that
+program, including methods to extract meta-information from one or
+more image files.  Since ``exiftool`` is run in batch mode, only a
+single instance needs to be launched and can be reused for many
+queries.  This is much more efficient than launching a separate
+process for every single query.
+
+.. _ExifTool: http://www.sno.phy.queensu.ca/~phil/exiftool/
+
+The source code can be checked out from the github repository with
+
+::
+
+    git clone git://github.com/smarnach/pyexiftool.git
+
+Alternatively, you can download a tarball_.  There haven't been any
+releases yet.
+
+.. _tarball: https://github.com/smarnach/pyexiftool/tarball/master
+
+PyExifTool is licenced under GNU GPL version 3 or later.
+
+Example usage::
+
+    import exiftool
+
+    files = ["a.jpg", "b.png", "c.tif"]
+    with exiftool.ExifTool() as et:
+        metadata = et.get_metadata_batch(files)
+    for d in metadata:
+        print("{:20.20} {:20.20}".format(d["SourceFile"],
+                                         d["EXIF:DateTimeOriginal"]))
+"""
+
+from __future__ import unicode_literals
+
+import sys
+import subprocess
+import os
+import json
+import warnings
+import codecs
+
+try:        # Py3k compatibility
+    basestring
+except NameError:
+    basestring = (bytes, str)
+
+executable = "exiftool"
+"""The name of the executable to run.
+
+If the executable is not located in one of the paths listed in the
+``PATH`` environment variable, the full path should be given here.
+"""
+
+# Sentinel indicating the end of the output of a sequence of commands.
+# The standard value should be fine.
+sentinel = b"{ready}"
+
+# The block size when reading from exiftool.  The standard value
+# should be fine, though other values might give better performance in
+# some cases.
+block_size = 4096
+
+# This code has been adapted from Lib/os.py in the Python source tree
+# (sha1 265e36e277f3)
+def _fscodec():
+    encoding = sys.getfilesystemencoding()
+    errors = "strict"
+    if encoding != "mbcs":
+        try:
+            codecs.lookup_error("surrogateescape")
+        except LookupError:
+            pass
+        else:
+            errors = "surrogateescape"
+
+    def fsencode(filename):
+        """
+        Encode filename to the filesystem encoding with 'surrogateescape' error
+        handler, return bytes unchanged. On Windows, use 'strict' error handler if
+        the file system encoding is 'mbcs' (which is the default encoding).
+        """
+        if isinstance(filename, bytes):
+            return filename
+        else:
+            return filename.encode(encoding, errors)
+
+    return fsencode
+
+fsencode = _fscodec()
+del _fscodec
+
+class ExifTool(object):
+    """Run the `exiftool` command-line tool and communicate to it.
+
+    You can pass the file name of the ``exiftool`` executable as an
+    argument to the constructor.  The default value ``exiftool`` will
+    only work if the executable is in your ``PATH``.
+
+    Most methods of this class are only available after calling
+    :py:meth:`start()`, which will actually launch the subprocess.  To
+    avoid leaving the subprocess running, make sure to call
+    :py:meth:`terminate()` method when finished using the instance.
+    This method will also be implicitly called when the instance is
+    garbage collected, but there are circumstance when this won't ever
+    happen, so you should not rely on the implicit process
+    termination.  Subprocesses won't be automatically terminated if
+    the parent process exits, so a leaked subprocess will stay around
+    until manually killed.
+
+    A convenient way to make sure that the subprocess is terminated is
+    to use the :py:class:`ExifTool` instance as a context manager::
+
+        with ExifTool() as et:
+            ...
+
+    .. warning:: Note that there is no error handling.  Nonsensical
+       options will be silently ignored by exiftool, so there's not
+       much that can be done in that regard.  You should avoid passing
+       non-existent files to any of the methods, since this will lead
+       to undefied behaviour.
+
+    .. py:attribute:: running
+
+       A Boolean value indicating whether this instance is currently
+       associated with a running subprocess.
+    """
+
+    def __init__(self, executable_=None):
+        if executable_ is None:
+            self.executable = executable
+        else:
+            self.executable = executable_
+        self.running = False
+
+    def start(self):
+        """Start an ``exiftool`` process in batch mode for this instance.
+
+        This method will issue a ``UserWarning`` if the subprocess is
+        already running.  The process is started with the ``-G`` and
+        ``-n`` as common arguments, which are automatically included
+        in every command you run with :py:meth:`execute()`.
+        """
+        if self.running:
+            warnings.warn("ExifTool already running; doing nothing.")
+            return
+        with open(os.devnull, "w") as devnull:
+            self._process = subprocess.Popen(
+                [self.executable, "-stay_open", "True",  "-@", "-",
+                 "-common_args", "-G", "-u", "-a", "-n"],
+                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+                stderr=devnull)
+        self.running = True
+
+    def terminate(self):
+        """Terminate the ``exiftool`` process of this instance.
+
+        If the subprocess isn't running, this method will do nothing.
+        """
+        if not self.running:
+            return
+        self._process.stdin.write(b"-stay_open\nFalse\n")
+        self._process.stdin.flush()
+        self._process.communicate()
+        del self._process
+        self.running = False
+
+    def __enter__(self):
+        self.start()
+        return self
+
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        self.terminate()
+
+    def __del__(self):
+        self.terminate()
+
+    def execute(self, *params):
+        """Execute the given batch of parameters with ``exiftool``.
+
+        This method accepts any number of parameters and sends them to
+        the attached ``exiftool`` process.  The process must be
+        running, otherwise ``ValueError`` is raised.  The final
+        ``-execute`` necessary to actually run the batch is appended
+        automatically; see the documentation of :py:meth:`start()` for
+        the common options.  The ``exiftool`` output is read up to the
+        end-of-output sentinel and returned as a raw ``bytes`` object,
+        excluding the sentinel.
+
+        The parameters must also be raw ``bytes``, in whatever
+        encoding exiftool accepts.  For filenames, this should be the
+        system's filesystem encoding.
+
+        .. note:: This is considered a low-level method, and should
+           rarely be needed by application developers.
+        """
+        if not self.running:
+            raise ValueError("ExifTool instance not running.")
+        self._process.stdin.write(b"\n".join(params + (b"-execute\n",)))
+        self._process.stdin.flush()
+        output = b""
+        fd = self._process.stdout.fileno()
+        while not output[-32:].strip().endswith(sentinel):
+            output += os.read(fd, block_size)
+        return output.strip()[:-len(sentinel)]
+
+    def execute_json(self, *params):
+        """Execute the given batch of parameters and parse the JSON output.
+
+        This method is similar to :py:meth:`execute()`.  It
+        automatically adds the parameter ``-j`` to request JSON output
+        from ``exiftool`` and parses the output.  The return value is
+        a list of dictionaries, mapping tag names to the corresponding
+        values.  All keys are Unicode strings with the tag names
+        including the ExifTool group name in the format <group>:<tag>.
+        The values can have multiple types.  All strings occurring as
+        values will be Unicode strings.  Each dictionary contains the
+        name of the file it corresponds to in the key ``"SourceFile"``.
+
+        The parameters to this function must be either raw strings
+        (type ``str`` in Python 2.x, type ``bytes`` in Python 3.x) or
+        Unicode strings (type ``unicode`` in Python 2.x, type ``str``
+        in Python 3.x).  Unicode strings will be encoded using
+        system's filesystem encoding.  This behaviour means you can
+        pass in filenames according to the convention of the
+        respective Python version – as raw strings in Python 2.x and
+        as Unicode strings in Python 3.x.
+        """
+        params = map(fsencode, params)
+        return json.loads(self.execute(b"-j", *params).decode("utf-8"))
+
+    def get_metadata_batch(self, filenames):
+        """Return all meta-data for the given files.
+
+        The return value will have the format described in the
+        documentation of :py:meth:`execute_json()`.
+        """
+        return self.execute_json(*filenames)
+
+    def get_metadata(self, filename):
+        """Return meta-data for a single file.
+
+        The returned dictionary has the format described in the
+        documentation of :py:meth:`execute_json()`.
+        """
+        return self.execute_json(filename)[0]
+
+    def get_tags_batch(self, tags, filenames):
+        """Return only specified tags for the given files.
+
+        The first argument is an iterable of tags.  The tag names may
+        include group names, as usual in the format <group>:<tag>.
+
+        The second argument is an iterable of file names.
+
+        The format of the return value is the same as for
+        :py:meth:`execute_json()`.
+        """
+        # Explicitly ruling out strings here because passing in a
+        # string would lead to strange and hard-to-find errors
+        if isinstance(tags, basestring):
+            raise TypeError("The argument 'tags' must be "
+                            "an iterable of strings")
+        if isinstance(filenames, basestring):
+            raise TypeError("The argument 'filenames' must be "
+                            "an iterable of strings")
+        params = ["-" + t for t in tags]
+        params.extend(filenames)
+        return self.execute_json(*params)
+
+    def get_tags(self, tags, filename):
+        """Return only specified tags for a single file.
+
+        The returned dictionary has the format described in the
+        documentation of :py:meth:`execute_json()`.
+        """
+        return self.get_tags_batch(tags, [filename])[0]
+
+    def get_tag_batch(self, tag, filenames):
+        """Extract a single tag from the given files.
+
+        The first argument is a single tag name, as usual in the
+        format <group>:<tag>.
+
+        The second argument is an iterable of file names.
+
+        The return value is a list of tag values or ``None`` for
+        non-existent tags, in the same order as ``filenames``.
+        """
+        data = self.get_tags_batch([tag], filenames)
+        result = []
+        for d in data:
+            d.pop("SourceFile")
+            result.append(next(iter(d.values()), None))
+        return result
+
+    def get_tag(self, tag, filename):
+        """Extract a single tag from a single file.
+
+        The return value is the value of the specified tag, or
+        ``None`` if this tag was not found in the file.
+        """
+        return self.get_tag_batch(tag, [filename])[0]
diff --git a/release/scripts/addons_contrib/sequencer_extra_actions/functions.py b/release/scripts/addons_contrib/sequencer_extra_actions/functions.py
index ccf7f10..34e7ccb 100644
--- a/release/scripts/addons_contrib/sequencer_extra_actions/functions.py
+++ b/release/scripts/addons_contrib/sequencer_extra_actions/functions.py
@@ -27,6 +27,23 @@ from bpy.props import BoolProperty
 from bpy.props import StringProperty
 
 
+imb_ext_image = [
+    # IMG
+    ".png", ".tga", ".bmp", ".jpg", ".jpeg", ".sgi", ".rgb",
+    ".rgba", ".tif", ".tiff", ".tx", ".jp2", ".hdr", ".dds",
+    ".dpx", ".cin", ".exr", ".rw2",
+    # IMG QT
+    ".gif", ".psd", ".pct", ".pict", ".pntg", ".qtif"]  
+
+
+imb_ext_movie = [
+    ".avi", ".flc", ".mov", ".movie", ".mp4", ".m4v", ".m2v",
+    ".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv",
+    ".dv", ".mpeg", ".mpg", ".mpg2", ".vob", ".mkv", ".flv",
+    ".divx", ".xvid", ".mxf",
+    ]    
+  
+
 # Functions
 
 def add_marker(text):
@@ -89,8 +106,8 @@ def getpathfrombrowser():
     try:
         params
     except UnboundLocalError:
-        print("no browser")
-        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        #print("no browser")
+        self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
         return {'CANCELLED'}
     path = params.directory
     return path
@@ -108,13 +125,13 @@ def getfilepathfrombrowser():
     try:
         params
     except UnboundLocalError:
-        print("no browser")
-        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        #print("no browser")
+        self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
         return {'CANCELLED'}
 
     if params.filename == '':
-        print("no file selected")
-        #self.report({'ERROR_INVALID_INPUT'}, 'No file selected')
+        #print("no file selected")
+        self.report({'ERROR_INVALID_INPUT'}, 'No file selected')
         return {'CANCELLED'}
     path = params.directory
     filename = params.filename
@@ -133,8 +150,8 @@ def setpathinbrowser(path, file):
     try:
         params
     except UnboundLocalError:
-        print("no browser")
-        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        #print("no browser")
+        self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
         return {'CANCELLED'}
 
     params.directory = path
diff --git a/release/scripts/addons_contrib/sequencer_extra_actions/operators_extra_actions.py b/release/scripts/addons_contrib/sequencer_extra_actions/operators_extra_actions.py
index 5e5c02c..19bfaef 100644
--- a/release/scripts/addons_contrib/sequencer_extra_actions/operators_extra_actions.py
+++ b/release/scripts/addons_contrib/sequencer_extra_actions/operators_extra_actions.py
@@ -34,6 +34,8 @@ from bpy.props import BoolProperty
 from bpy.props import StringProperty
 
 from . import functions
+from . import functions
+from . import exiftool
 
 
 # Initialization
@@ -872,7 +874,6 @@ class Sequencer_Extra_CopyProperties(bpy.types.Operator):
     ('crop', 'Input - Image Crop', ''),
     ('proxy', 'Proxy / Timecode', ''),
     ('strobe', 'Filter - Strobe', ''),
-    ('color_balance', 'Filter - Color Balance', ''),
     ('color_multiply', 'Filter - Multiply', ''),
     ('color_saturation', 'Filter - Saturation', ''),
     ('deinterlace', 'Filter - De-Interlace', ''),
@@ -959,18 +960,6 @@ class Sequencer_Extra_CopyProperties(bpy.types.Operator):
                         i.proxy.timecode = strip.proxy.timecode
                     elif self.prop == 'strobe':
                         i.strobe = strip.strobe
-                    elif self.prop == 'color_balance':
-                        i.use_color_balance = strip.use_color_balance
-                        i.use_color_balance = strip.use_color_balance
-                        i.color_balance.lift = strip.color_balance.lift
-                        i.color_balance.gamma = strip.color_balance.gamma
-                        i.color_balance.gain = strip.color_balance.gain
-                        p = strip.color_balance.invert_lift  # pep80
-                        i.color_balance.invert_lift = p
-                        p = strip.color_balance.invert_gamma  # pep80
-                        i.color_balance.invert_gamma = p
-                        p = strip.color_balance.invert_gain  # pep80
-                        i.color_balance.invert_gain = p
                     elif self.prop == 'color_multiply':
                         i.color_multiply = strip.color_multiply
                     elif self.prop == 'color_saturation':
@@ -1432,7 +1421,7 @@ class Sequencer_Extra_PlaceFromFileBrowserProxy(bpy.types.Operator):
                 strip.proxy.build_50 = self.build_50
                 strip.proxy.build_75 = self.build_75
                 strip.proxy.build_100 = self.build_100
-                print("----------------", proxypath)
+                #print("----------------", proxypath)
                 if os.path.isfile(proxypath):
                     strip.use_proxy_custom_file = True
                     strip.proxy.filepath = proxypath
@@ -1500,7 +1489,7 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
         
 
         if strip.type == 'MOVIE':
-            print("movie", strip.frame_start)
+            #print("movie", strip.frame_start)
             path = strip.filepath
             #print(path)
             data_exists = False
@@ -1519,7 +1508,7 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
                         - strip.animation_offset_start
                     tin = strip.frame_offset_start + strip.frame_start
                     tout = tin + strip.frame_final_duration
-                    print(newstrip.frame_start, strip.frame_start, tin, tout)
+                    #print(newstrip.frame_start, strip.frame_start, tin, tout)
                     functions.triminout(newstrip, tin, tout)
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading file')
@@ -1541,14 +1530,14 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
                     #clip.frame_final_duration = strip.frame_final_duration 
                     tin = strip.frame_offset_start + strip.frame_start
                     tout = tin + strip.frame_final_duration
-                    print(newstrip.frame_start, strip.frame_start, tin, tout)
+                    #print(newstrip.frame_start, strip.frame_start, tin, tout)
                     functions.triminout(clip, tin, tout)
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading file')
                     return {'CANCELLED'}
                  
         elif strip.type == 'IMAGE':
-            print("image")
+            #print("image")
             base_dir = bpy.path.abspath(strip.directory)
             scn.frame_current = strip.frame_start - strip.animation_offset_start
             # searching for the first frame of the sequencer. This is mandatory 
@@ -1556,14 +1545,14 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
             # avoiding to create a new movie clip if not needed
             filename = sorted(os.listdir(base_dir))[0]
             path = os.path.join(base_dir,filename)
-            print(path)
+            #print(path)
             data_exists = False
             for i in bpy.data.movieclips:
-                print(i.filepath, path)
+                #print(i.filepath, path)
                 if i.filepath == path:
                     data_exists = True
                     data = i
-            print(data_exists)
+            #print(data_exists)
             if data_exists == False:
                 try:
                     data = bpy.data.movieclips.load(filepath=path)
@@ -1576,7 +1565,7 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
                     clip = bpy.context.scene.sequence_editor.sequences[newstrip.name]
                     tin = strip.frame_offset_start + strip.frame_start
                     tout = tin + strip.frame_final_duration
-                    print(newstrip.frame_start, strip.frame_start, tin, tout)
+                    #print(newstrip.frame_start, strip.frame_start, tin, tout)
                     functions.triminout(clip, tin, tout)
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading filetin')
@@ -1598,7 +1587,7 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
                     #clip.frame_final_duration = strip.frame_final_duration 
                     tin = strip.frame_offset_start + strip.frame_start
                     tout = tin + strip.frame_final_duration
-                    print(newstrip.frame_start, strip.frame_start, tin, tout)
+                    #print(newstrip.frame_start, strip.frame_start, tin, tout)
                     functions.triminout(clip, tin, tout)
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading filete')
@@ -1612,4 +1601,62 @@ class Sequencer_Extra_CreateMovieclip(bpy.types.Operator):
         
 
         return {'FINISHED'}
+    
+    
+# READ EXIF DATA
+class Sequencer_Extra_ReadExifData(bpy.types.Operator):
+    # load exifdata from strip to scene['metadata'] property
+    bl_label = 'Read EXIF Data'
+    bl_idname = 'sequencerextra.read_exif'
+    bl_description = 'load exifdata from strip to metadata property in scene'
+    bl_options = {'REGISTER', 'UNDO'}
+    
 
+    
+    def execute(self, context):
+        
+        def getexifdata(strip):
+            
+            def getlist(lista):
+                for root, dirs, files in os.walk(path):
+                    for f in files:
+                        if "."+f.rpartition(".")[2].lower() in functions.imb_ext_image:
+                            lista.append(f)
+                        #if "."+f.rpartition(".")[2] in imb_ext_movie:
+                        #    lista.append(f)
+                strip.elements
+                
+                lista.sort()
+                return lista
+            
+            def getexifvalues(lista):
+                metadata=[]
+                with exiftool.ExifTool() as et:
+                    try:
+                        metadata = et.get_metadata_batch(lista)
+                    except UnicodeDecodeError as Err:
+                        print(Err)
+                return metadata
+            
+            #print("----------------------------")
+            
+            if strip.type == "IMAGE":
+                path = bpy.path.abspath(strip.directory)
+            if strip.type == "MOVIE":
+                path = bpy.path.abspath(strip.filepath.rpartition("/")[0])
+            os.chdir(path)
+            #get a list of files
+            lista = []
+            
+            for i in strip.elements:
+                lista.append(i.filename)
+            
+            return getexifvalues(lista)
+        
+        
+        sce = bpy.context.scene
+        frame=sce.frame_current
+        text= bpy.context.active_object
+        strip = context.scene.sequence_editor.active_strip
+        sce['metadata'] = getexifdata(strip)
+        return {'FINISHED'}
diff --git a/release/scripts/addons_contrib/sequencer_extra_actions/ui.py b/release/scripts/addons_contrib/sequencer_extra_actions/ui.py
index fd0c6ff..e08da67 100644
--- a/release/scripts/addons_contrib/sequencer_extra_actions/ui.py
+++ b/release/scripts/addons_contrib/sequencer_extra_actions/ui.py
@@ -158,3 +158,57 @@ def clip_clip_menu_func(self, context):
     self.layout.operator('clipextra.openfromfilebrowser',
     text='Open from File Browser', icon='PLUGIN')
     self.layout.separator()
+
+class ExifInfoPanel(bpy.types.Panel):
+    """Creates a Panel in the Object properties window"""
+    bl_label = "EXIF Info Panel"
+    bl_space_type = 'SEQUENCE_EDITOR'
+    bl_region_type = 'UI'
+    
+    @staticmethod
+    def has_sequencer(context):
+        return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
+
+    @classmethod
+    def poll(cls, context):
+        return cls.has_sequencer(context)
+
+    def draw_header(self, context):
+        layout = self.layout
+        layout.label(text="", icon="NLA")
+
+    def draw(self, context):
+        layout = self.layout
+        sce = context.scene
+        row = layout.row()
+        row.operator("sequencerextra.read_exif")
+        row = layout.row()
+        row.label(text="Exif Data!", icon='RENDER_REGION')
+        row = layout.row()
+        
+        try:
+            strip = context.scene.sequence_editor.active_strip
+        
+            f=strip.frame_start
+            frame=sce.frame_current
+            try:
+                if len(sce['metadata']) == 1:
+                    for d in sce['metadata'][0]:
+                        split = layout.split(percentage=0.5)
+                        col = split.column()
+                        row = col.row()
+                        col.label(text=d) 
+                        col = split.column()
+                        col.label(str(sce['metadata'][0][d]))
+                else:    
+                    for d in sce['metadata'][frame-f]:
+                        split = layout.split(percentage=0.5)
+                        col = split.column()
+                        row = col.row()
+                        col.label(text=d) 
+                        col = split.column()
+                        col.label(str(sce['metadata'][frame-f][d]))
+            except KeyError:
+                pass
+        except AttributeError:
+            pass
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py b/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py
index 4f94192..ef23ebb 100644
--- a/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py
+++ b/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py
@@ -3991,7 +3991,7 @@ class Cursor3DToolsSettings(bpy.types.PropertyGroup):
     
     cursor_visible = bpy.props.BoolProperty(
         name="Cursor visibility",
-        description="Cursor visibility",
+        description="Cursor visibility (causing bugs, commented out)",
         default=True)
     
     draw_guides = bpy.props.BoolProperty(
@@ -4102,7 +4102,7 @@ class TransformExtraOptions(bpy.types.Panel):
     bl_space_type = "VIEW_3D"
     bl_region_type = "UI"
     #bl_context = "object"
-    #bl_options = {'DEFAULT_CLOSED'}
+    bl_options = {'DEFAULT_CLOSED'}
     
     def draw(self, context):
         layout = self.layout
@@ -4158,7 +4158,10 @@ class Cursor3DTools(bpy.types.Panel):
         #row.prop(settings, "cursor_visible", text="", toggle=True,
         #         icon=('RESTRICT_VIEW_OFF' if settings.cursor_visible
         #               else 'RESTRICT_VIEW_ON'))
-        row.prop(settings, "cursor_visible", text="", toggle=True,
+        subrow = row.row()
+        subrow.enabled = False
+        subrow.alert = True
+        subrow.prop(settings, "cursor_visible", text="", toggle=True,
                  icon='RESTRICT_VIEW_OFF')
         row = row.split(1 / 3, align=True)
         row.prop(settings, "draw_N",
@@ -5160,7 +5163,10 @@ def draw_callback_view(self, context):
     
     cursor_save_location = Vector(bpy.context.space_data.cursor_location)
     if not settings.cursor_visible:
-        bpy.context.space_data.cursor_location = Vector([float('nan')] * 3)
+        # This is causing problems! See <http://projects.blender.org/
+        # tracker/index.php?func=detail&aid=33197&group_id=9&atid=498>
+        #bpy.context.space_data.cursor_location = Vector([float('nan')] * 3)
+        pass
 
 def draw_callback_header_px(self, context):
     r = context.region
diff --git a/release/scripts/addons_contrib/space_view3d_paint_bprojection.py b/release/scripts/addons_contrib/space_view3d_paint_bprojection.py
index 46330c2..9189999 100644
--- a/release/scripts/addons_contrib/space_view3d_paint_bprojection.py
+++ b/release/scripts/addons_contrib/space_view3d_paint_bprojection.py
@@ -9,6 +9,7 @@ bl_info = {
     "category": "Paint"}
 
 import bpy
+from bpy.app.handlers import persistent
 from bpy.types import Panel, Operator
 from bpy.props import IntProperty, FloatProperty, BoolProperty, IntVectorProperty, StringProperty, FloatVectorProperty, CollectionProperty
 from bpy_extras import view3d_utils
@@ -814,23 +815,23 @@ class AddBProjectionPlane(Operator):
             # XXX, this isnt future proof, DON'T USE INDEX's - campbell                    
             km = bpy.data.window_managers['WinMan'].keyconfigs['Blender'].keymaps['3D View']
             km.keymap_items[3-1].idname = 'view3d.rotate_view3d'
-            km.keymap_items[19-1].idname = 'view3d.zoom_view3d'
-            km.keymap_items[19-1].properties.delta = 1.0
-            km.keymap_items[20-1].idname = 'view3d.zoom_view3d'
-            km.keymap_items[20-1].properties.delta = -1.0
+            km.keymap_items[21-1].idname = 'view3d.zoom_view3d'
+            km.keymap_items[21-1].properties.delta = 1.0
+            km.keymap_items[22-1].idname = 'view3d.zoom_view3d'
+            km.keymap_items[22-1].properties.delta = -1.0
             km.keymap_items[4-1].idname = 'view3d.pan_view3d'
-            km.keymap_items[28-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[28-1].properties.view = 'FRONT'
-            km.keymap_items[30-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[30-1].properties.view = 'RIGHT'            
-            km.keymap_items[34-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[34-1].properties.view = 'TOP'
-            km.keymap_items[36-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[36-1].properties.view = 'BACK'
+            km.keymap_items[29-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[29-1].properties.view = 'FRONT'
+            km.keymap_items[31-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[31-1].properties.view = 'RIGHT'            
+            km.keymap_items[35-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[35-1].properties.view = 'TOP'
             km.keymap_items[37-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[37-1].properties.view = 'LEFT'            
+            km.keymap_items[37-1].properties.view = 'BACK'
             km.keymap_items[38-1].idname = 'view3d.preset_view3d'
-            km.keymap_items[38-1].properties.view = 'BOTTOM'                                   
+            km.keymap_items[38-1].properties.view = 'LEFT'            
+            km.keymap_items[39-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[39-1].properties.view = 'BOTTOM'                                   
             km = context.window_manager.keyconfigs.default.keymaps['Image Paint']
             kmi = km.keymap_items.new("object.intuitivescale", 'LEFTMOUSE', 'PRESS', shift=True)
                         
@@ -897,33 +898,8 @@ class RemoveBProjectionPlane(Operator):
             context.scene.objects.active = ob
             ob.select = True
             
-            km = bpy.data.window_managers['WinMan'].keyconfigs['Blender'].keymaps['3D View']
-            # ----------------------------------------------
-            # XXX, this isnt future proof, DON'T USE INDEX's - campbell
-            km.keymap_items[3-1].idname = 'view3d.rotate'
-            km.keymap_items[19-1].idname = 'view3d.zoom'
-            km.keymap_items[19-1].properties.delta = 1.0
-            km.keymap_items[20-1].idname = 'view3d.zoom'
-            km.keymap_items[20-1].properties.delta = -1.0
-            km.keymap_items[4-1].idname = 'view3d.move'
-            km.keymap_items[28-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[28-1].properties.type = 'FRONT'
-            km.keymap_items[30-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[30-1].properties.type = 'RIGHT'            
-            km.keymap_items[34-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[34-1].properties.type = 'TOP'
-            km.keymap_items[36-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[36-1].properties.type = 'BACK'
-            km.keymap_items[37-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[37-1].properties.type = 'LEFT'            
-            km.keymap_items[38-1].idname = 'view3d.viewnumpad'
-            km.keymap_items[38-1].properties.type = 'BOTTOM'            
-            
-            km = context.window_manager.keyconfigs.default.keymaps['Image Paint']
-            #to do
-            for kmi in (kmi for kmi in km.keymap_items if kmi.idname in {"object.intuitivescale", }):
-                    km.keymap_items.remove(kmi)
-            
+            reinitkey()
+                        
             '''tmp = context.object
             for ob in (ob for ob in bpy.data.objects if ob.type == 'MESH' and ob.hide == False and context.scene in ob.users_scene):
                 context.scene.objects.active = ob
@@ -945,6 +921,34 @@ class RemoveBProjectionPlane(Operator):
         
         return {'FINISHED'}
 
+def reinitkey():
+    km = bpy.data.window_managers['WinMan'].keyconfigs['Blender'].keymaps['3D View']
+    # ----------------------------------------------
+    # XXX, this isnt future proof, DON'T USE INDEX's - campbell
+    km.keymap_items[3-1].idname = 'view3d.rotate'
+    km.keymap_items[21-1].idname = 'view3d.zoom'
+    km.keymap_items[21-1].properties.delta = 1.0
+    km.keymap_items[22-1].idname = 'view3d.zoom'
+    km.keymap_items[22-1].properties.delta = -1.0
+    km.keymap_items[4-1].idname = 'view3d.move'
+    km.keymap_items[29-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[29-1].properties.type = 'FRONT'
+    km.keymap_items[31-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[31-1].properties.type = 'RIGHT'            
+    km.keymap_items[35-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[35-1].properties.type = 'TOP'
+    km.keymap_items[37-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[37-1].properties.type = 'BACK'
+    km.keymap_items[38-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[38-1].properties.type = 'LEFT'            
+    km.keymap_items[39-1].idname = 'view3d.viewnumpad'
+    km.keymap_items[39-1].properties.type = 'BOTTOM'            
+            
+    km = bpy.context.window_manager.keyconfigs.default.keymaps['Image Paint']
+    #to do
+    for kmi in (kmi for kmi in km.keymap_items if kmi.idname in {"object.intuitivescale", }):
+            km.keymap_items.remove(kmi)
+
 # Oprerator Class to remove what is no more needed    
 class ChangeObject(Operator):
     bl_idname = "object.change_object"
@@ -1062,6 +1066,7 @@ class RotateView3D(Operator):
     pan = Vector((0,0))
 
     key = ['']
+    block = 0
  
     first_time = True
     tmp_level = -1
@@ -1127,20 +1132,22 @@ class RotateView3D(Operator):
         ob = context.object
         em = bpy.data.objects['Empty for BProjection'] 
         reg = context.area.regions[4]        
-        if event.value == 'PRESS':
-            self.pan = Vector((event.mouse_region_x, event.mouse_region_y))
+            
                     
+        if event.type not in {'MOUSEMOVE','INBETWEEN_MOUSEMOVE'}:
+            self.pan = Vector((event.mouse_region_x, event.mouse_region_y))
             self.key = [event.type]
-
+            self.block = 1
+            
         if event.value == 'RELEASE':
-            self.key = [''] 
+            return {'FINISHED'}
 
         if event.type == 'MOUSEMOVE':                        
-            
-            if '' in self.key:
+            if self.block == 0:
                 self.tracball(context, event.mouse_region_x, event.mouse_region_y,ob.location)
                 align_to_view(context)
-                if self.first_time:
+                #to unlock the camera
+                if self.first_time:                    
                     rot_ang = context.user_preferences.view.rotation_angle            
                     context.user_preferences.view.rotation_angle = 0
                     bpy.ops.view3d.view_orbit(type='ORBITLEFT')
@@ -1148,52 +1155,53 @@ class RotateView3D(Operator):
                     bpy.ops.view3d.view_persportho()         
                     bpy.ops.view3d.view_persportho()
                     self.first_time = False
-          
-            deltax = event.mouse_region_x - round(self.pan.x)
-            deltay = event.mouse_region_y - round(self.pan.y)          
-
-            if 'G' in self.key:       
-                sd = context.space_data              
-                l =  sd.region_3d
-                vr = l.view_rotation.copy()
-                vr.invert()
-                
-                v_init = Vector((0.0,0.0,1.0))
-                
-                pos = [-deltax,-deltay]
-                v = view3d_utils.region_2d_to_location_3d(context.region, l, pos, v_init)
-                pos = [0,0]
-                vbl = view3d_utils.region_2d_to_location_3d(context.region, l, pos, v_init)        
-                loc = vbl - v            
-                loc.rotate(vr)
-                em.custom_location += loc              
-                                   
-            if 'S' in self.key:                
-                s = em.custom_scale
-                if em.custom_linkscale:
-                    em.custom_propscale += deltax/20
-                else:
-                    em.custom_scale = [s[0] + deltax/20, s[1] + deltay/20]
-                                          
-            if 'Z' in self.key:                
-                em.custom_location.z+=deltax/10
-                      
-            if 'R' in self.key:
-                em.custom_rotation+=deltax
+            else:          
+                deltax = event.mouse_region_x - round(self.pan.x)
+                deltay = event.mouse_region_y - round(self.pan.y)          
+     
+                if 'G' in self.key:     
+                    sd = context.space_data              
+                    l =  sd.region_3d
+                    vr = l.view_rotation.copy()
+                    vr.invert()
                     
-            if 'U' in self.key:
-                suv = em.custom_scaleuv
-                if em.custom_linkscaleuv:    
-                    em.custom_propscaleuv += deltax/50
-                else:
-                    em.custom_scaleuv= [suv[0] + deltax/50 , suv[1] + deltay/50]               
-
-            if 'Y' in self.key:       
-                ouv = em.custom_offsetuv
-                em.custom_offsetuv = [ouv[0] - deltax/50,ouv[1] - deltay/50] 
-
-            self.pan = Vector((event.mouse_region_x, event.mouse_region_y))
-            self.first_mouse = Vector((event.mouse_region_x, self.first_mouse.y))
+                    v_init = Vector((0.0,0.0,1.0))
+                    
+                    pos = [-deltax,-deltay]
+                    v = view3d_utils.region_2d_to_location_3d(context.region, l, pos, v_init)
+                    pos = [0,0]
+                    vbl = view3d_utils.region_2d_to_location_3d(context.region, l, pos, v_init)        
+                    loc = vbl - v 
+              
+                    loc.rotate(vr)
+                    em.custom_location += loc              
+                                       
+                if 'S' in self.key:                
+                    s = em.custom_scale
+                    if em.custom_linkscale:
+                        em.custom_propscale += deltax/20
+                    else:
+                        em.custom_scale = [s[0] + deltax/20, s[1] + deltay/20]
+                                              
+                if 'Z' in self.key:                
+                    em.custom_location.z+=deltax/10
+                          
+                if 'R' in self.key:
+                    em.custom_rotation+=deltax
+                        
+                if 'U' in self.key:
+                    suv = em.custom_scaleuv
+                    if em.custom_linkscaleuv:    
+                        em.custom_propscaleuv += deltax/50
+                    else:
+                        em.custom_scaleuv= [suv[0] + deltax/50 , suv[1] + deltay/50]               
+    
+                if 'Y' in self.key:       
+                    ouv = em.custom_offsetuv
+                    em.custom_offsetuv = [ouv[0] - deltax/50,ouv[1] - deltay/50] 
+    
+                self.pan = Vector((event.mouse_region_x, event.mouse_region_y))
+                
                         
         elif event.type == 'MIDDLEMOUSE'and event.value == 'RELEASE':
             if self.tmp_level > -1:
@@ -1207,7 +1215,7 @@ class RotateView3D(Operator):
             clear_props(context)
         
         if 'O' in self.key:
-            bpy.ops.object.change_object()            
+            bpy.ops.object.change_object()           
         return {'RUNNING_MODAL'}
     
     def execute(self, context):        
@@ -1216,6 +1224,7 @@ class RotateView3D(Operator):
         return{'FINISHED'}
 
     def invoke(self, context, event):
+        bpy.data.objects['Empty for BProjection']
         context.window_manager.modal_handler_add(self)
         self.first_mouse = Vector((event.mouse_region_x,event.mouse_region_y))
         self.first_time = True
@@ -1224,6 +1233,7 @@ class RotateView3D(Operator):
                 self.tmp_level = sub.levels
                 sub.levels = 0
         return {'RUNNING_MODAL'}
+            
 
 # Oprerator Class to pan the view3D
 class PanView3D(bpy.types.Operator):
@@ -1271,6 +1281,7 @@ class PanView3D(bpy.types.Operator):
         return {'RUNNING_MODAL'}
                 
     def invoke(self, context, event):
+        bpy.data.objects['Empty for BProjection']    
         context.window_manager.modal_handler_add(self)
         self.first_mouse.x = event.mouse_region_x
         self.first_mouse.y = event.mouse_region_y   
@@ -1280,7 +1291,7 @@ class PanView3D(bpy.types.Operator):
                 sub.levels = 0  
                       
         return {'RUNNING_MODAL'}
-
+        
     def execute(self, context):        
         align_to_view(context)  
         
@@ -1369,12 +1380,17 @@ class PresetView3D(Operator):
                     
         return {'FINISHED'}
 
+ at persistent
+def load_handler(dummy):
+    reinitkey()
+
 def register():
     bpy.utils.register_module(__name__)
     createcustomprops(bpy.context)
+    bpy.app.handlers.load_post.append(load_handler)
 
 def unregister():
     bpy.utils.unregister_module(__name__)
 
 if __name__ == "__main__":
-    register()
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/system_cycles_material_text_node.py b/release/scripts/addons_contrib/system_cycles_material_text_node.py
new file mode 100644
index 0000000..e1d5c54
--- /dev/null
+++ b/release/scripts/addons_contrib/system_cycles_material_text_node.py
@@ -0,0 +1,608 @@
+# system_cycles_material_text_node.py Copyright (C) 5-mar-2012, Silvio Falcinelli 
+#
+# 
+# special thanks to user blenderartists.org cmomoney  
+# 
+#
+# Show Information About the Blend.
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+bl_info = {
+    "name": "Cycles Auto Material Texures Node Editor",
+    "author": "Silvio Falcinelli",
+    "version": (0,5),
+    "blender": (2, 6, 2),
+    "api": 44136,
+    "location": "Properties > Material > Automatic Node Editor ",
+    "description": "automatic cycles texture map",
+    "warning": "beta",
+    "wiki_url": 'http://www.rendering3d.net/' \
+        'scripts/materialedior',
+    "tracker_url": "https://projects.blender.org/tracker/index.php?" \
+        "func=detail&aid=????",
+    "category": "System"}
+
+
+import bpy
+import math
+from math import log
+from math import pow
+from math import exp
+import os.path
+
+
+
+def AutoNodeOff():
+    mats = bpy.data.materials
+    for cmat in mats:
+        cmat.use_nodes=False
+    bpy.context.scene.render.engine='BLENDER_RENDER'
+
+
+def BakingText(tex,mode):
+    print('________________________________________')
+    print('INFO start bake texture ' + tex.name)
+    bpy.ops.object.mode_set(mode='OBJECT')
+    sc=bpy.context.scene
+    tmat=''
+    img=''
+    Robj=bpy.context.active_object
+    for n in bpy.data.materials:
+
+        if n.name=='TMP_BAKING':
+            tmat=n
+   
+    if not tmat:
+        tmat = bpy.data.materials.new('TMP_BAKING')
+        tmat.name="TMP_BAKING"
+    
+    
+    bpy.ops.mesh.primitive_plane_add()
+    tm=bpy.context.active_object
+    tm.name="TMP_BAKING"
+    tm.data.name="TMP_BAKING"
+    bpy.ops.object.select_pattern(extend=False, pattern="TMP_BAKING", case_sensitive=False)
+    sc.objects.active = tm
+    bpy.context.scene.render.engine='BLENDER_RENDER'
+    tm.data.materials.append(tmat)
+    if len(tmat.texture_slots.items()) == 0:
+        tmat.texture_slots.add()
+    tmat.texture_slots[0].texture_coords='UV'
+    tmat.texture_slots[0].use_map_alpha=True
+    tmat.texture_slots[0].texture = tex.texture
+    tmat.texture_slots[0].use_map_alpha=True
+    tmat.texture_slots[0].use_map_color_diffuse=False
+    tmat.use_transparency=True
+    tmat.alpha=0
+    tmat.use_nodes=False
+    tmat.diffuse_color=1,1,1
+    bpy.ops.object.mode_set(mode='EDIT')
+    bpy.ops.uv.unwrap()
+
+    for n in bpy.data.images:
+        if n.name=='TMP_BAKING':
+            n.user_clear()
+            bpy.data.images.remove(n)
+
+
+    if mode == "ALPHA" and tex.texture.type=='IMAGE':
+        sizeX=tex.texture.image.size[0]
+        sizeY=tex.texture.image.size[1]
+    else:
+        sizeX=600
+        sizeY=600
+    bpy.ops.image.new(name="TMP_BAKING", width=sizeX, height=sizeY, color=(0.0, 0.0, 0.0, 1.0), alpha=True, uv_test_grid=False, float=False)
+    bpy.data.screens['UV Editing'].areas[1].spaces[0].image = bpy.data.images["TMP_BAKING"]
+    sc.render.engine='BLENDER_RENDER'
+    img = bpy.data.images["TMP_BAKING"]
+    img=bpy.data.images.get("TMP_BAKING")
+    img.file_format = "JPEG"
+    if mode == "ALPHA" and tex.texture.type=='IMAGE':
+        img.filepath_raw = tex.texture.image.filepath + "_BAKING.jpg"
+
+    else:
+        img.filepath_raw = tex.texture.name + "_PTEXT.jpg"
+    
+    sc.render.bake_type = 'ALPHA'
+    sc.render.use_bake_selected_to_active = True
+    sc.render.use_bake_clear = True
+    bpy.ops.object.bake_image()
+    img.save()
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.delete() 
+    bpy.ops.object.select_pattern(extend=False, pattern=Robj.name, case_sensitive=False)           
+    sc.objects.active = Robj       
+    img.user_clear()
+    bpy.data.images.remove(img)
+    bpy.data.materials.remove(tmat)
+
+    print('INFO : end Bake ' + img.filepath_raw )
+    print('________________________________________')
+
+def AutoNode():
+    
+    mats = bpy.data.materials
+    sc = bpy.context.scene
+
+    for cmat in mats:
+
+        cmat.use_nodes=True
+        TreeNodes=cmat.node_tree
+        links = TreeNodes.links
+    
+        shader=''
+        shmix=''
+        shtsl=''
+        Add_Emission=''
+        Add_Translucent=''
+        Mix_Alpha=''        
+        sT=False
+        lock=True
+        
+        for n in TreeNodes.nodes:
+            if n.type == 'OUTPUT_MATERIAL':
+                if n.label == 'Lock':
+                    lock=False
+
+                    
+        if lock:        
+            for n in TreeNodes.nodes:
+                TreeNodes.nodes.remove(n)
+        
+     
+    
+            if not shader :
+                shader = TreeNodes.nodes.new('BSDF_DIFFUSE')    
+                shader.location = 0,470
+                 
+                shout = TreeNodes.nodes.new('OUTPUT_MATERIAL')
+                shout.location = 200,400          
+                links.new(shader.outputs[0],shout.inputs[0])
+                
+            textures = cmat.texture_slots
+            sM=True
+    
+            for tex in textures:
+                if tex:
+                    if tex.use:
+                        if tex.use_map_alpha:
+                            sM=False
+                            
+                            if sc.EXTRACT_ALPHA:
+                                
+                                if tex.texture.type =='IMAGE' and tex.texture.use_alpha: 
+                                    
+                                    if not os.path.exists(bpy.path.abspath(tex.texture.image.filepath + "_BAKING.jpg")) or sc.EXTRACT_OW:
+
+                                        BakingText(tex,'ALPHA')
+                                else:
+                                    if not tex.texture.type =='IMAGE': 
+                                    
+                                        if not os.path.exists(bpy.path.abspath(tex.texture.name + "_PTEXT.jpg")) or sc.EXTRACT_OW:
+    
+                                            BakingText(tex,'PTEXT')                                             
+                                    
+                            
+
+
+
+    
+            if  cmat.use_transparency and cmat.raytrace_transparency.ior == 1 and not cmat.raytrace_mirror.use  and sM:
+                if not shader.type == 'BSDF_TRANSPARENT':
+                    print("INFO:  Make TRANSPARENT shader node " + cmat.name)
+                    TreeNodes.nodes.remove(shader)
+                    shader = TreeNodes.nodes.new('BSDF_TRANSPARENT')    
+                    shader.location = 0,470
+                    links.new(shader.outputs[0],shout.inputs[0]) 
+    
+    
+    
+            if not cmat.raytrace_mirror.use and not cmat.use_transparency:
+                if not shader.type == 'BSDF_DIFFUSE':
+                    print("INFO:  Make DIFFUSE shader node" + cmat.name)
+                    TreeNodes.nodes.remove(shader)
+                    shader = TreeNodes.nodes.new('BSDF_DIFFUSE')    
+                    shader.location = 0,470
+                    links.new(shader.outputs[0],shout.inputs[0]) 
+                    
+                    
+    
+            if cmat.raytrace_mirror.use and cmat.raytrace_mirror.reflect_factor>0.001 and cmat.use_transparency:
+                if not shader.type == 'BSDF_GLASS':
+                    print("INFO:  Make GLASS shader node" + cmat.name)
+                    TreeNodes.nodes.remove(shader)
+                    shader = TreeNodes.nodes.new('BSDF_GLASS')  
+                    shader.location = 0,470
+                    links.new(shader.outputs[0],shout.inputs[0]) 
+    
+    
+    
+    
+            if cmat.raytrace_mirror.use and not cmat.use_transparency and cmat.raytrace_mirror.reflect_factor>0.001 :
+                if not shader.type == 'BSDF_GLOSSY':
+                    print("INFO:  Make MIRROR shader node" + cmat.name)
+                    TreeNodes.nodes.remove(shader)
+                    shader = TreeNodes.nodes.new('BSDF_GLOSSY') 
+                    shader.location = 0,520
+                    links.new(shader.outputs[0],shout.inputs[0]) 
+                    
+                    
+                            
+            if cmat.emit > 0.001 :
+                if not shader.type == 'EMISSION' and not cmat.raytrace_mirror.reflect_factor>0.001 and not cmat.use_transparency:
+                    print("INFO:  Mix EMISSION shader node" + cmat.name)
+                    TreeNodes.nodes.remove(shader)
+                    shader = TreeNodes.nodes.new('EMISSION')    
+                    shader.location = 0,450
+                    links.new(shader.outputs[0],shout.inputs[0])               
+                       
+                else:
+                    if not Add_Emission:
+                        print("INFO:  Add EMISSION shader node" + cmat.name)
+                        shout.location = 550,330
+                        Add_Emission = TreeNodes.nodes.new('ADD_SHADER')
+                        Add_Emission.location = 370,490
+                        
+                        shem = TreeNodes.nodes.new('EMISSION')
+                        shem.location = 180,380  
+                        
+                        links.new(Add_Emission.outputs[0],shout.inputs[0]) 
+                        links.new(shem.outputs[0],Add_Emission.inputs[1])
+                        links.new(shader.outputs[0],Add_Emission.inputs[0])
+                        
+                        shem.inputs['Color'].default_value=cmat.diffuse_color.r,cmat.diffuse_color.g,cmat.diffuse_color.b,1
+                        shem.inputs['Strength'].default_value=cmat.emit
+    
+                                   
+    
+    
+            if cmat.translucency > 0.001 : 
+                print("INFO:  Add BSDF_TRANSLUCENT shader node" + cmat.name)
+                shout.location = 770,330
+                Add_Translucent = TreeNodes.nodes.new('ADD_SHADER')
+                Add_Translucent.location = 580,490
+                        
+                shtsl = TreeNodes.nodes.new('BSDF_TRANSLUCENT')
+                shtsl.location = 400,350     
+                        
+                links.new(Add_Translucent.outputs[0],shout.inputs[0]) 
+                links.new(shtsl.outputs[0],Add_Translucent.inputs[1])
+    
+                
+                if Add_Emission:
+                    links.new(Add_Emission.outputs[0],Add_Translucent.inputs[0])
+     
+                    pass
+                else:
+    
+                    links.new(shader.outputs[0],Add_Translucent.inputs[0]) 
+                    pass               
+                shtsl.inputs['Color'].default_value=cmat.translucency, cmat.translucency,cmat.translucency,1                             
+          
+                       
+
+
+            shader.inputs['Color'].default_value=cmat.diffuse_color.r,cmat.diffuse_color.g,cmat.diffuse_color.b,1
+            
+            if shader.type=='BSDF_DIFFUSE':
+                shader.inputs['Roughness'].default_value=cmat.specular_intensity    
+                       
+            if shader.type=='BSDF_GLOSSY':
+                shader.inputs['Roughness'].default_value=1-cmat.raytrace_mirror.gloss_factor  
+                
+                
+            if shader.type=='BSDF_GLASS':
+                shader.inputs['Roughness'].default_value=1-cmat.raytrace_mirror.gloss_factor                   
+                shader.inputs['IOR'].default_value=cmat.raytrace_transparency.ior
+                
+                
+            if shader.type=='EMISSION':
+                shader.inputs['Strength'].default_value=cmat.emit              
+              
+                      
+                                  
+            textures = cmat.texture_slots
+            for tex in textures:
+                sT=False   
+                pText=''            
+                if tex:
+                    if tex.use:
+                        if tex.texture.type=='IMAGE':
+                            img = tex.texture.image
+                            shtext = TreeNodes.nodes.new('TEX_IMAGE')
+                            shtext.location = -200,400 
+                            shtext.image=img
+                            sT=True
+    
+
+               
+                            
+  
+                        if not tex.texture.type=='IMAGE':                           
+                            if sc.EXTRACT_PTEX:
+                                print('INFO : Extract Procedural Texture  ' )
+                                
+                                if not os.path.exists(bpy.path.abspath(tex.texture.name + "_PTEXT.jpg")) or sc.EXTRACT_OW:
+                                    BakingText(tex,'PTEX')    
+                                                     
+                                img=bpy.data.images.load(tex.texture.name + "_PTEXT.jpg")
+                                shtext = TreeNodes.nodes.new('TEX_IMAGE')
+                                shtext.location = -200,400 
+                                shtext.image=img                                
+                                sT=True
+                                                                     
+
+                if sT:
+                        if tex.use_map_color_diffuse :
+                            links.new(shtext.outputs[0],shader.inputs[0]) 
+                            
+                                                
+                        if tex.use_map_emit:                            
+                            if not Add_Emission:
+                                print("INFO:  Mix EMISSION + Texure shader node " + cmat.name)
+                                
+                                intensity=0.5+(tex.emit_factor / 2)
+                                
+                                shout.location = 550,330
+                                Add_Emission = TreeNodes.nodes.new('ADD_SHADER')
+                                Add_Emission.name="Add_Emission"
+                                Add_Emission.location = 370,490
+                                
+                                shem = TreeNodes.nodes.new('EMISSION')
+                                shem.location = 180,380  
+                                
+                                links.new(Add_Emission.outputs[0],shout.inputs[0]) 
+                                links.new(shem.outputs[0],Add_Emission.inputs[1])
+                                links.new(shader.outputs[0],Add_Emission.inputs[0])
+                                
+                                shem.inputs['Color'].default_value=cmat.diffuse_color.r,cmat.diffuse_color.g,cmat.diffuse_color.b,1
+                                shem.inputs['Strength'].default_value=intensity * 2
+
+                            links.new(shtext.outputs[0],shem.inputs[0]) 
+
+
+                        if tex.use_map_mirror:   
+                            links.new(shader.inputs[0],shtext.outputs[0]) 
+
+
+                        if tex.use_map_translucency:
+                            if not Add_Translucent:   
+                                print("INFO:  Add Translucency + Texure shader node " + cmat.name)
+                                
+                                intensity=0.5+(tex.emit_factor / 2)
+                                
+                                shout.location = 550,330
+                                Add_Translucent = TreeNodes.nodes.new('ADD_SHADER')
+                                Add_Translucent.name="Add_Translucent"
+                                Add_Translucent.location = 370,290
+                                
+                                shtsl = TreeNodes.nodes.new('BSDF_TRANSLUCENT')
+                                shtsl.location = 180,240     
+                                
+                                links.new(shtsl.outputs[0],Add_Translucent.inputs[1])
+                                
+                                if Add_Emission:
+                                    links.new(Add_Translucent.outputs[0],shout.inputs[0]) 
+                                    links.new(Add_Emission.outputs[0],Add_Translucent.inputs[0]) 
+                                    pass
+                                else:
+                                    links.new(Add_Translucent.outputs[0],shout.inputs[0]) 
+                                    links.new(shader.outputs[0],Add_Translucent.inputs[0])
+                                                            
+                            links.new(shtext.outputs[0],shtsl.inputs[0]) 
+                            
+
+                        if tex.use_map_alpha:
+                            if not Mix_Alpha:   
+                                print("INFO:  Mix Alpha + Texure shader node " + cmat.name)
+
+                                shout.location = 750,330
+                                Mix_Alpha = TreeNodes.nodes.new('MIX_SHADER')
+                                Mix_Alpha.name="Add_Alpha"
+                                Mix_Alpha.location = 570,290
+                                sMask = TreeNodes.nodes.new('BSDF_TRANSPARENT') 
+                                sMask.location = 250,180                                
+                                tMask = TreeNodes.nodes.new('TEX_IMAGE')
+                                tMask.location = -200,250
+
+                                if tex.texture.type=='IMAGE':
+                                    if tex.texture.use_alpha:
+                                        imask=bpy.data.images.load(img.filepath+"_BAKING.jpg")       
+                                    else:  
+                                        imask=bpy.data.images.load(img.filepath)   
+                                else:
+                                    imask=bpy.data.images.load(img.name)         
+                                      
+
+                                tMask.image = imask
+                                links.new(Mix_Alpha.inputs[0],tMask.outputs[0])
+                                links.new(shout.inputs[0],Mix_Alpha.outputs[0])
+                                links.new(sMask.outputs[0],Mix_Alpha.inputs[1])
+                                
+                                if not Add_Emission and not Add_Translucent:
+                                    links.new(Mix_Alpha.inputs[2],shader.outputs[0])
+                                
+                                if Add_Emission and not Add_Translucent:
+                                    links.new(Mix_Alpha.inputs[2],Add_Emission.outputs[0])  
+                                
+                                if Add_Translucent:
+                                    links.new(Mix_Alpha.inputs[2],Add_Translucent.outputs[0])                                    
+                                    
+                                    
+                            
+                        if tex.use_map_normal:
+                            t = TreeNodes.nodes.new('RGBTOBW')
+                            t.location = -0,300 
+                            links.new(t.outputs[0],shout.inputs[2]) 
+                            links.new(shtext.outputs[0],t.inputs[0])    
+    bpy.context.scene.render.engine='CYCLES'                                                      
+                                                     
+ 
+class mllock(bpy.types.Operator):
+    bl_idname = "ml.lock"
+    bl_label = "Lock"
+    bl_description = "Safe to overwrite of mssive BL conversion"
+    bl_register = True
+    bl_undo = True
+    @classmethod
+    def poll(cls, context):
+        return True
+    def execute(self, context):
+        cmat=bpy.context.selected_objects[0].active_material
+        TreeNodes=cmat.node_tree
+        links = TreeNodes.links
+        for n in TreeNodes.nodes:
+            if n.type == 'OUTPUT_MATERIAL':
+                if n.label == 'Lock':
+                    n.label=''
+                else:
+                    n.label='Lock'     
+
+
+
+
+        return {'FINISHED'}
+ 
+ 
+class mlrefresh(bpy.types.Operator):
+    bl_idname = "ml.refresh"
+    bl_label = "Refresh"
+    bl_description = "Refresh"
+    bl_register = True
+    bl_undo = True
+    @classmethod
+    def poll(cls, context):
+        return True
+    def execute(self, context):
+        AutoNode()
+        return {'FINISHED'}
+
+
+class mlrestore(bpy.types.Operator):
+    bl_idname = "ml.restore"
+    bl_label = "Restore"
+    bl_description = "Restore"
+    bl_register = True
+    bl_undo = True
+    @classmethod
+    def poll(cls, context):
+        return True
+    def execute(self, context):
+        AutoNodeOff()
+        return {'FINISHED'}
+
+from bpy.props import *
+sc = bpy.types.Scene
+sc.EXTRACT_ALPHA= BoolProperty(attr="EXTRACT_ALPHA",default= False)
+sc.EXTRACT_PTEX= BoolProperty(attr="EXTRACT_PTEX",default= False)
+sc.EXTRACT_OW= BoolProperty(attr="Overwrite",default= False)
+
+class OBJECT_PT_scenemassive(bpy.types.Panel):
+    bl_label = "Automatic Massive Material Nodes"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "material"
+    
+
+    def draw(self, context):
+        sc = context.scene
+        t=''
+        lock=''
+        try:
+            cmat=bpy.context.selected_objects[0].active_material
+            t="Material : " + cmat.name
+            
+            
+            TreeNodes=cmat.node_tree
+            links = TreeNodes.links
+        
+      
+            lock=False
+            
+            for n in TreeNodes.nodes:
+                if n.type == 'OUTPUT_MATERIAL':
+                    if n.label == 'Lock':
+                        lock=True          
+            
+            
+        except:
+            pass    
+        
+        ob_cols = []
+        db_cols = []
+        layout = self.layout
+        row = layout.row()
+        row.prop(sc,"EXTRACT_ALPHA",text='Extract Alpha Texture  (slow)',icon='FORCE_TEXTURE')
+        row = layout.row()
+        row.prop(sc,"EXTRACT_PTEX",text='Extract Procedural Texture (slow)',icon='FORCE_TEXTURE')        
+        row = layout.row()
+        row.prop(sc,"EXTRACT_OW",text='Extract Texture Overwrite') 
+        row = layout.row()
+        row = layout.row()
+        l_row = layout.row()
+        ob_cols.append(l_row.column())
+        layout.separator()
+        row = ob_cols[0].row() 
+        row.operator("ml.refresh", text='BLENDER > CYCLES', icon='TEXTURE')
+        layout.separator()
+        row = ob_cols[0].row() 
+        row.operator("ml.restore", text='BLENDER Mode  (Node Off)', icon='MATERIAL')        
+        layout.separator()
+        row = ob_cols[0].row() 
+        layout.separator()
+        layout.separator()
+        row = ob_cols[0].row() 
+        layout.separator()
+        row = ob_cols[0].row() 
+
+
+
+        if t:
+            row.label(text=t)
+            row.label(text='', icon='MATERIAL')
+            if lock:
+                row.operator("ml.lock", text="Lock" )
+            else:
+                row.operator("ml.lock", text="UnLock" ) 
+            
+        layout.separator()
+        row = ob_cols[0].row() 
+        layout.separator()          
+        row = ob_cols[0].row() 
+        layout.separator()
+        row = ob_cols[0].row() 
+        row.label(text="Ver 0,4 beta  blender 2.62 - 2.63    Silvio Falcinelli")
+        layout.separator()
+        row = ob_cols[0].row() 
+        row.label(text="wwww.rendering3d.net")
+
+
+ 
+def register():
+    bpy.utils.register_module(__name__)
+    pass
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    pass
+
+if __name__ == "__main__":
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons_contrib/ui_layer_manager.py b/release/scripts/addons_contrib/ui_layer_manager.py
index fe0654a..e682e7c 100644
--- a/release/scripts/addons_contrib/ui_layer_manager.py
+++ b/release/scripts/addons_contrib/ui_layer_manager.py
@@ -37,14 +37,12 @@ from bpy.props import StringProperty, BoolProperty, IntProperty, CollectionPrope
 
 EDIT = ["EDIT_MESH", "EDIT_CURVE", "EDIT_SURFACE", "EDIT_METABALL", "EDIT_TEXT", "EDIT_ARMATURE"]
 
-
 class LayerGroups(bpy.types.PropertyGroup):
     
     toggle    = BoolProperty(name="",default=False)
     
     lock    = BoolProperty(name="",default=False)
-   
-    
+
     layer_groups = BoolVectorProperty(name="Layer Groups", default = ([False]*20), size=20, subtype='LAYER')
     
     # A list of identifiers (colon-separated strings) which property’s controls should be displayed
@@ -58,7 +56,6 @@ bpy.types.Scene.layergroups = CollectionProperty(type=LayerGroups)
 # Unused, but this is needed for the TemplateList to work…
 bpy.types.Scene.layergroups_index = IntProperty(default=-1)
 
-
 class RemoveLayerGroup(bpy.types.Operator):
     '''Tooltip'''
     bl_idname = "object.layergroup_remove"
@@ -81,7 +78,6 @@ class RemoveLayerGroup(bpy.types.Operator):
         
         return {'FINISHED'}
 
-
 class AddLayerGroup(bpy.types.Operator):
     '''Tooltip'''
     bl_idname = "object.layergroup_add"
@@ -104,9 +100,7 @@ class AddLayerGroup(bpy.types.Operator):
         
         item = layergroups.add()
         index_number= str(index)
-        
-        
-        
+
         if len(index_number)==2:
             index_number = "0"+index_number
             if len(index_number)==3:
@@ -120,7 +114,6 @@ class AddLayerGroup(bpy.types.Operator):
         
         return {'FINISHED'}
 
-
 class LayerToggle(bpy.types.Operator):
     '''Visualize this Layer, Shift-Click to select multiple layers'''
     bl_idname = "object.layertoggle"
@@ -137,28 +130,20 @@ class LayerToggle(bpy.types.Operator):
     def poll(cls, context):
         
         return context.scene
-        
-    
+
     def execute(self, context):
-        
-        
+
         spacecheck = self.spacecheck
         scene = context.scene
         
         layerN = self.layerN
-        
-        
-        
-        
-        
-        
+
         if spacecheck:
             
             space = context.area.spaces.active
         else:
             space = context.scene
-        
-        
+
         if layerN==-1:
             index = self.index_group
             groups = scene.layergroups[index].layer_groups
@@ -171,16 +156,14 @@ class LayerToggle(bpy.types.Operator):
                 for i in range(0,20):
                     
                     union[i]= groups[i] or layers[i]
-                    
-                
+
                 space.layers=union  
                 layergroups.toggle=True
             else:
                 for i in range(0,20):
                     
                     union[i]=  not groups[i]  and layers[i]
-                    
-                
+
                 space.layers=union  
                 layergroups.toggle=False
                         
@@ -191,32 +174,25 @@ class LayerToggle(bpy.types.Operator):
                 if space.layers[layerN]:
                     toggle = False
                 else:
-            
-            
+
                     toggle= True                            
                 space.layers[layerN]=toggle
             
             else:
-                
-              
+
                 layer = [False]*20
                 layer[layerN]=True
                 space.layers=layer
-    #                   
-                
+
                 if space.layers[layerN]:
                     toggle = False   
-                        
-                
-            
+
         return {'FINISHED'}
     def invoke(self, context, event):
         self.shift = event.shift
         
         return self.execute(context)
 
-    
-    
 class MergeSelected(bpy.types.Operator):
     '''Move Selected Objects in this Layer Shift-Click to select multiple layers'''
     bl_idname = "object.mergeselected"
@@ -226,14 +202,12 @@ class MergeSelected(bpy.types.Operator):
     #layer number
     layerN = bpy.props.IntProperty()
 
-
     @classmethod
  
     def poll(cls, context):
         
         return context.scene
-        
-    
+
     def execute(self, context):
         
         layerN = self.layerN
@@ -258,24 +232,19 @@ class MergeSelected(bpy.types.Operator):
                         if obj.layers[layerN]:
                             toggle = False
                         else:
-                    
-                    
+
                             toggle= True                            
                         obj.layers[layerN]=toggle
                     
                     else:
-                        
-                      
+
                         layer = [False]*20
                         layer[layerN]=True
                         obj.layers=layer
-    #                   
-                        
+
                         if obj.layers[layerN]:
                             toggle = False   
-                    
-                
-            
+
         return {'FINISHED'}
     
     def invoke(self, context, event):
@@ -294,8 +263,7 @@ class LockSelected(bpy.types.Operator):
     
     #lock status
     lock = bpy.props.BoolProperty()
-    
-             
+
     index_group = bpy.props.IntProperty()
     
     @classmethod
@@ -303,8 +271,7 @@ class LockSelected(bpy.types.Operator):
     def poll(cls, context):
         
         return context.scene
-        
-    
+
     def execute(self, context):
         
         scene = context.scene
@@ -326,33 +293,23 @@ class LockSelected(bpy.types.Operator):
                     layers = obj.layers
                     
                     layergroup=[False]*20
-                    
-                    
-                    
+
                     for i in range (0,20):
                         layergroup[i]= layers[i] and groups[i]
                     
                     if True in layergroup:
                         obj.hide_select=not lock
                         obj.select=False
-                        
-                        
+
                         scene.layergroups[index].lock=not lock
-                        
-                        
-                
+
                 else:
                     if obj.layers[layerN]:
                         obj.hide_select=not lock
                         obj.select=False
-                
-                        
+
                         scene.LockLayer[layerN]= not lock
-               
-                
-     
-        
-            
+
         return {'FINISHED'}
 
 class SelectObjectsLayer(bpy.types.Operator):
@@ -362,8 +319,7 @@ class SelectObjectsLayer(bpy.types.Operator):
     
     select_obj = bpy.props.BoolProperty()
     layerN = bpy.props.IntProperty()
-    
-    
+
     @classmethod
     def poll(cls, context):
         return context.scene
@@ -380,45 +336,23 @@ class SelectObjectsLayer(bpy.types.Operator):
         if view_3d.layers_used[layerN]:
      
             for obj in context.scene.objects:
-                
-                
+
                 if obj.layers[layerN]:
                     i = i+1
                 if obj.layers[layerN] and obj.select:
                     s = s+1
-            
-            
+
             if s==i:
                 for obj in context.scene.objects:
                         
                     if obj.layers[layerN]:
                         obj.select=False
-                        
-                        
-                        
-                        
-                    
+
             else:
                 bpy.ops.object.select_by_layer(extend=True, layers=layerN+1)        
-                    
 
-                
-                
-    
-            
-                    
-            
-        
         return {'FINISHED'}
 
-
-
-
-            
-            
-        
-  
-
 class AllLayersSelect(bpy.types.Operator):
     '''Active all Layer in scene'''
     bl_idname = "scene.layersselect"
@@ -426,7 +360,6 @@ class AllLayersSelect(bpy.types.Operator):
     
     vis = bpy.props.BoolProperty()
 
-    
     @classmethod
     def poll(cls, context):
         return context.scene
@@ -442,12 +375,10 @@ class AllLayersSelect(bpy.types.Operator):
                 #check for lock camera and layer is active
         if view_3d.lock_camera_and_layers is True:
             space= scene
-            
-            
+
         else:
             space= view_3d         
-            
-            
+
         if not vis:
             for i in range (0,20):           
             
@@ -458,8 +389,7 @@ class AllLayersSelect(bpy.types.Operator):
                 #deselect the other...
                 else: 
                     space.layers[i]= False
-        
-        
+
         else:
             for i in range (0,20):     
                 #select all layer
@@ -470,9 +400,6 @@ class AllLayersSelect(bpy.types.Operator):
             space.layers[active]=True
         return {'FINISHED'}
 
-
-
-
 class LayerName(bpy.types.Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
@@ -510,8 +437,7 @@ class LayerName(bpy.types.Panel):
     
     #lock layer status
     bpy.types.Scene.LockLayer = bpy.props.BoolVectorProperty(name="Lock Layer", default = ([False]*20), size=20)
-    
-     
+
     #prop for show index
     bpy.types.Scene.LayerIndex = bpy.props.BoolProperty(name="Show Index", default=False)
    
@@ -523,7 +449,6 @@ class LayerName(bpy.types.Panel):
     #toggle for merge
     #bpy.types.Scene.MergeToggle = bpy.props.BoolVectorProperty(name="Merge Toggle", default = (False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False), size=20)
 
-    
     @classmethod
     def poll(self, context):
         try:
@@ -532,16 +457,9 @@ class LayerName(bpy.types.Panel):
             return False
 
     def draw(self, context):
-        
-        
-        
+
         scene = context.scene
-        
-            
-           
-        
-        
-        
+
         view_3d = context.area.spaces.active
                 #check for lock camera and layer is active
         if view_3d.lock_camera_and_layers is True:
@@ -553,15 +471,11 @@ class LayerName(bpy.types.Panel):
             spacecheck=True     
         
         #row = layout.row(align=True)
-        
-        
-        
-        
+
         vis=False
         allIcon='RESTRICT_VIEW_OFF'
         allText="Isolate active"
-        
-        
+
         #check if there is a layer off
         for layer in space.layers:
             
@@ -570,14 +484,9 @@ class LayerName(bpy.types.Panel):
                 allIcon='RESTRICT_VIEW_ON'
                 allText="All Visible"
 
-        
-        
         layout = self.layout
         column = layout.column()
         row = column.row()
-        
-        
-        
         col2= row.column()
            
         #lock camera and layers button 
@@ -598,54 +507,22 @@ class LayerName(bpy.types.Panel):
         
         col.alignment='RIGHT'
         col.prop(scene, "ExtraOptions", text="Options")
-        
-        
-        
+
         col1= row.column()  
-        
-        
+
         #show index        
         col1.prop(scene, "LayerIndex", text="Index")
         
         # hide empty
-        
-        
+
         if context.object:
             col1.alignment='RIGHT'
             col1.prop(scene, "LayerVisibility", toggle=False, text="Hide Empty")        
-        
-        
-        ##########
-        
-        
-        
-        
-        
-        
-        
-        
-               
-        
-        
 
-        
-        
-  
-        
+        ##########
 
-            
-            
-            
-            
-        
-        
         #list the layer
         for i in range(0,20): 
-            
-            
-            
-
-            
 
             #inizializing the icon 
             #lockIcon='UNLOCKED'            
@@ -685,25 +562,9 @@ class LayerName(bpy.types.Panel):
                 lockIcon= 'LOCKED'
             else:
                 lockIcon= 'UNLOCKED'
-           
-            
-            
-            
-            
+
             #check if there are Selected obj in the layer
-            
-            
-            
-            
-            
-            
-                
-           
-           
-            
-            
-            
-            
+
             #check if layer have some thing       
             if layer_used:
                
@@ -716,21 +577,12 @@ class LayerName(bpy.types.Panel):
                     if context.object.layers[i]:
                         
                         active = True     
-        
-            
+
             else:
                 scene.ObjectSelect[i]= True
-                
-                
-                        
-                        
 
-                                     
-                
-                
             if layer ==i:
-            
-               
+
                 #check for active layer and set the icon 
                 if view_3d.lock_camera_and_layers:
                    
@@ -740,8 +592,7 @@ class LayerName(bpy.types.Panel):
                 
                 if active:
                     iconUsed = 'LAYER_ACTIVE'
-                
-           
+
                 #set icon for layer view        
                 if view_3d.layers[layer]:
                     viewIcon = 'RESTRICT_VIEW_OFF'
@@ -749,7 +600,6 @@ class LayerName(bpy.types.Panel):
                 else:
                     viewIcon = 'RESTRICT_VIEW_ON'
                     noitem = False
-                
 
                 row2=column.row(align=True)
 #                if space==scene:
@@ -762,16 +612,12 @@ class LayerName(bpy.types.Panel):
 #                    viewemboss = True
                 
                 iconLayer=viewIcon
-                
-                
+
                 # layer index
                 if scene.LayerIndex:
                     
                     col6 = row2.column()
-                    
                     col6.scale_x=0.14
-                    
-                    
                     col6.label(text=str(i+1)+".")
                 
                 # visualization 
@@ -785,61 +631,38 @@ class LayerName(bpy.types.Panel):
                     used = colb6.operator("object.layertoggle", text="", icon= iconLayer, emboss=True)
                     used.layerN=i
                     used.spacecheck=spacecheck
-                
-            
-                   
-                
+
                 #text prop
                 s = "LayerName"+str(i+1)
                 colb3= row2.column()
                 colb3.prop(scene,s,text="",icon=iconAc)
-                
-                
-                
-                
-                
+
                 if extra:
-                    
-                        
-                        
-                    
-                    
-                         
+
                     #Select by type operator
                     colb4 = row2.column()
                     select = colb4.operator("object.selectobjectslayer", icon='RESTRICT_SELECT_OFF',text="", emboss=True ) 
                     select.layerN = i 
-                    
                     #select.select_obj= selobj
-                        
-                    
-                    
+
                     #lock operator 
                     colb5 = row2.column()   
                     lk = colb5.operator("object.lockselected", text="", emboss=True, icon= lockIcon)
                     
                     lk.layerN = i
                     lk.lock=lock
-                    
-                    
+
     #                #occuped layer
-                    
     #                colb6.label(text="", icon=iconUsed)
-                    
-                    
+
                     #merge layer
                     colb7 = row2.column()
                     merge = colb7.operator("object.mergeselected", text="", emboss=True, icon= iconUsed)
                     merge.layerN=i
-                
-                
-                
-                
+
                 if not scene.LayerVisibility:
                     if i==4 or i==9 or i==14 or i==19:
-                        row3 = column.row()
-                        
-                        
+                        row3 = column.row() 
                         row3.separator()
         if len(scene.objects)==0:            
             layout.label(text='No objects in scene')
@@ -849,8 +672,7 @@ class LayerGroupsUI(bpy.types.Panel):
     bl_label = "Layer Groups"
     bl_idname = "_PT_layer_group"
     bl_options = {'DEFAULT_CLOSED'}     
-    
-    
+
     @classmethod
     def poll(self, context):
         try:
@@ -859,17 +681,13 @@ class LayerGroupsUI(bpy.types.Panel):
             return False
 
     def draw(self, context):
-        
-        
-        
+
         scene = context.scene
         view_3d = context.area.spaces.active
-        #######################
-        
+
         #check for lock camera and layer is active
         if view_3d.lock_camera_and_layers is True:
             space= scene
-            
             spacecheck = False
         else:
             space= view_3d  
@@ -878,27 +696,18 @@ class LayerGroupsUI(bpy.types.Panel):
         
         index_group =  scene.layergroups_index   
         items =len(scene.layergroups) 
-        
         viewIcon = 'RESTRICT_VIEW_OFF'
-        
         layout = self.layout
-        
         row = layout.row()
-        
         row.template_list(context.scene, "layergroups", context.scene, "layergroups_index", rows=items)
-        
         col =row.column(align =True)
-                    
         add = col.operator("object.layergroup_add", icon='ZOOMIN', text="")        
         add.index= items
         add.layer= scene.layers               
         remove = col.operator("object.layergroup_remove", icon='ZOOMOUT', text="")
         remove.index_group= index_group         
         if index_group >= 0:
-             
-        
-                                
-            
+
             lock=scene.layergroups[index_group].lock
             toggle = scene.layergroups[index_group].toggle
             if lock:
@@ -910,8 +719,7 @@ class LayerGroupsUI(bpy.types.Panel):
             lk.index_group = index_group
             lk.lock=lock
             lk.layerN=-1
-            
-            
+
             #set icon for layer view        
             if toggle:
                 iconLayer = 'RESTRICT_VIEW_OFF'
@@ -927,9 +735,7 @@ class LayerGroupsUI(bpy.types.Panel):
 
             layout.prop(scene.layergroups[index_group], "layer_groups", text="", toggle=True)
             layout.prop(scene.layergroups[index_group], "name", text="Name:")
-                
-                    
-                    
+ 
 def register():
     
     bpy.utils.register_class(AddLayerGroup)
diff --git a/release/scripts/addons_contrib/uv_bake_texture_to_vcols.py b/release/scripts/addons_contrib/uv_bake_texture_to_vcols.py
deleted file mode 100644
index 6414a8b..0000000
--- a/release/scripts/addons_contrib/uv_bake_texture_to_vcols.py
+++ /dev/null
@@ -1,312 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-"""
-Bake UV-Texture to Vertex Colors Addon
-
-Contact:        p_boelens at msn.com
-Information:    http://projects.blender.org/tracker/index.php?func=detail&aid=28211
-
-Contributor(s): CoDEmanX.
-    
-All rights reserved.
-"""
-
-bl_info = {
-    "name": "Bake UV-Texture to Vertex Colors",
-    "description": "Bakes the colors of the active UV Texture to Vertex Colors. "
-                   "Uses the active object and creates new VCol layer.",
-    "author": "Patrick Boelens, CoDEmanX",
-    "version": (0, 4),
-    "blender": (2, 6, 3),
-    "location": "3D View > Vertex Paint > Toolshelf > Bake",
-    "warning": "Requires image texture, generated textures aren't supported.",
-    "wiki_url": "http://wiki.blender.org/index.php?title=Extensions:2.6/"
-                "Py/Scripts/UV/Bake_Texture_to_Vertex_Colors",
-    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=28211",
-    "category": "UV"}
-
-import bpy
-from bpy.props import BoolProperty, EnumProperty
-from math import fabs
-from colorsys import rgb_to_hsv, hsv_to_rgb
-
-class UV_OT_bake_texture_to_vcols(bpy.types.Operator):
-    bl_idname = "uv.bake_texture_to_vcols"
-    bl_label = "Bake UV-Texture to Vertex Colors"
-    bl_description = "Bake active UV-Texture to new Vertex Color layer (requires image texture)"
-    bl_options = {'REGISTER', 'UNDO'}
-       
-    mappingModes = [("CLIP", "Clip", "Don't affect vertices who's UV-coordinates are out of bounds."),
-                 ("REPEAT", "Repeat", "Tile the image so that each vertex is accounted for."),
-                 ("EXTEND", "Extend", "Extends the edges of the image to the UV-coordinates.")
-                 ]
-    
-    mappingMode = EnumProperty(items=mappingModes,
-                               default="CLIP",
-                               name="Mapping",
-                               description="The mode to use for baking vertices who's UV-coordinates are out of bounds.")
-    
-    blendingModes = [("MIX", "Mix", ""),
-                     ("ADD", "Add", ""),
-                     ("SUBTRACT", "Subtract", ""),
-                     ("MULTIPLY", "Multiply", ""),
-                     ("SCREEN", "Screen", ""),
-                     ("OVERLAY", "Overlay", ""),
-                     ("DIFFERENCE", "Difference", ""),
-                     ("DIVIDE", "Divide", ""),
-                     ("DARKEN", "Darken", ""),
-                     ("LIGHTEN", "Lighten", ""),
-                     ("HUE", "Hue", ""),
-                     ("SATURATION", "Saturation", ""),
-                     ("VALUE", "Value", ""),
-                     ("COLOR", "Color", ""),
-                     ("SOFT_LIGHT", "Soft Light", ""),
-                     ("LINEAR_LIGHT", "Linear Light", "")
-                    ]
-      
-    blendingMode = EnumProperty(items=blendingModes,
-                                default="MULTIPLY",
-                                name="Blend Type",
-                                description="The blending mode to use when baking")
-    
-    
-    mirror_x = BoolProperty(name="Mirror X", description="Mirror the image on the X-axis.")
-    mirror_y = BoolProperty(name="Mirror Y", description="Mirror the image on the Y-axis.")
-    
-    @classmethod
-    def poll(self, context):
-        return (context.object and
-                context.object.type == 'MESH' and 
-                context.mode != 'EDIT_MESH' and
-                context.object.data.uv_textures.active.data[0].image)
-
-    def execute(self, context):
-        obdata = context.object.data
-        loop_count = len(obdata.loops)
-        uv_tex = obdata.uv_textures.active.data[0]
-        image_size_x = uv_tex.image.size[0]
-        image_size_y = uv_tex.image.size[1]
-        
-        # Accessing this directly is far too slow. Copied to new array for massive performance-gain.
-        uv_pixels = uv_tex.image.pixels[:]
-            
-        if uv_tex.image.name not in obdata.vertex_colors:
-            obdata.vertex_colors.new(name=uv_tex.image.name)
-            
-        vertex_colors = obdata.vertex_colors[uv_tex.image.name]
-        obdata.vertex_colors.active = vertex_colors
-        
-        for i in range(loop_count):
-            co = obdata.uv_layers.active.data[i].uv
-            x_co = round(co[0] * (image_size_x - 1))
-            y_co = round(co[1] * (image_size_y - 1))
-            
-            if x_co < 0 or x_co >= image_size_x or y_co < 0 or y_co >= image_size_y:
-                if self.mappingMode == 'CLIP':
-                    continue
-
-                elif self.mappingMode == 'REPEAT':
-                    while x_co > image_size_x - 1:
-                        x_co -= image_size_x
-                    while x_co < 0:
-                        x_co += image_size_x
-                    while y_co > image_size_y - 1:
-                        y_co -= image_size_y
-                    while y_co < 0:
-                        y_co += image_size_y
-                
-                elif self.mappingMode == 'EXTEND':
-                    if x_co > image_size_x - 1:
-                        x_co = image_size_x - 1
-                    if x_co < 0:
-                        x_co = 0
-                    if y_co > image_size_y - 1:
-                        y_co = image_size_y - 1
-                    if y_co < 0:
-                        y_co = 0
-            
-            if self.mirror_x:
-                 x_co = image_size_x -1 - x_co
-                 
-            if self.mirror_y:
-                 y_co = image_size_y -1 - y_co
-                 
-            col_out = vertex_colors.data[i].color
-                
-            pixelNumber = (image_size_x * y_co) + x_co
-            r = uv_pixels[pixelNumber*4]
-            g = uv_pixels[(pixelNumber*4) + 1]
-            b = uv_pixels[(pixelNumber*4) + 2]
-            col_in = r, g, b
-            col_result = [r,g,b] #col_in = texture-color, col_out = existing/ 'base' color
-            
-            if self.blendingMode == 'MIX':
-                col_result = col_in
-                
-            elif self.blendingMode == 'ADD':
-                col_result[0] = col_in[0] + col_out[0]
-                col_result[1] = col_in[1] + col_out[1]
-                col_result[2] = col_in[2] + col_out[2]
-                
-            elif self.blendingMode == 'SUBTRACT':
-                col_result[0] = col_in[0] - col_out[0]
-                col_result[1] = col_in[1] - col_out[1]
-                col_result[2] = col_in[2] - col_out[2]
-                
-            elif self.blendingMode == 'MULTIPLY':
-                col_result[0] = col_in[0] * col_out[0]
-                col_result[1] = col_in[1] * col_out[1]
-                col_result[2] = col_in[2] * col_out[2]
-                
-            elif self.blendingMode == 'SCREEN':
-                col_result[0] = 1 - (1.0 - col_in[0]) * (1.0 - col_out[0])
-                col_result[1] = 1 - (1.0 - col_in[1]) * (1.0 - col_out[1])
-                col_result[2] = 1 - (1.0 - col_in[2]) * (1.0 - col_out[2])
-                
-            elif self.blendingMode == 'OVERLAY':
-                if col_out[0] < 0.5:
-                    col_result[0] = col_out[0] * (2.0 * col_in[0])
-                else:
-                    col_result[0] = 1.0 - (2.0 * (1.0 - col_in[0])) * (1.0 - col_out[0])
-                if col_out[1] < 0.5:
-                    col_result[1] = col_out[1] * (2.0 * col_in[1])
-                else:
-                    col_result[1] = 1.0 - (2.0 * (1.0 - col_in[1])) * (1.0 - col_out[1])
-                if col_out[2] < 0.5:
-                    col_result[2] = col_out[2] * (2.0 * col_in[2])
-                else:
-                    col_result[2] = 1.0 - (2.0 * (1.0 - col_in[2])) * (1.0 - col_out[2])
-                
-            elif self.blendingMode == 'DIFFERENCE':
-                col_result[0] = fabs(col_in[0] - col_out[0])
-                col_result[1] = fabs(col_in[1] - col_out[1])
-                col_result[2] = fabs(col_in[2] - col_out[2])
-                
-            elif self.blendingMode == 'DIVIDE':
-                if(col_in[0] != 0.0):
-                    col_result[0] = col_out[0]/ col_in[0]
-                if(col_in[1] != 0.0):
-                    col_result[0] = col_out[1]/ col_in[1]
-                if(col_in[2] != 0.0):
-                    col_result[2] = col_out[2]/ col_in[2]
-                
-            elif self.blendingMode == 'DARKEN':
-                if col_in[0] < col_out[0]:
-                    col_result[0] = col_in[0]
-                else:
-                    col_result[0] = col_out[0]
-                if col_in[1] < col_out[1]:
-                    col_result[1] = col_in[1]
-                else:
-                    col_result[1] = col_out[1]
-                if col_in[2] < col_out[2]:
-                    col_result[2] = col_in[2]
-                else:
-                    col_result[2] = col_out[2]
-                
-                
-            elif self.blendingMode == 'LIGHTEN':
-                if col_in[0] > col_out[0]:
-                    col_result[0] = col_in[0]
-                else:
-                    col_result[0] = col_out[0]
-                if col_in[1] > col_out[1]:
-                    col_result[1] = col_in[1]
-                else:
-                    col_result[1] = col_out[1]
-                if col_in[2] > col_out[2]:
-                    col_result[2] = col_in[2]
-                else:
-                    col_result[2] = col_out[2]
-                
-            elif self.blendingMode == 'HUE':
-                hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
-                hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
-                hue = hsv_in[0]
-                col_result = hsv_to_rgb(hue, hsv_out[1], hsv_out[2])
-                
-            elif self.blendingMode == 'SATURATION':
-                hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
-                hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
-                sat = hsv_in[1]
-                col_result = hsv_to_rgb(hsv_out[0], sat, hsv_out[2])
-                
-            elif self.blendingMode == 'VALUE':
-                hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
-                hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
-                val = hsv_in[2]
-                col_result = hsv_to_rgb(hsv_out[0], hsv_out[1], val)
-                
-            elif self.blendingMode == 'COLOR':
-                hsv_in = rgb_to_hsv(col_in[0], col_in[1], col_in[2])
-                hsv_out = rgb_to_hsv(col_out[0], col_out[1], col_out[2])
-                hue = hsv_in[0]
-                sat = hsv_in[1]
-                col_result = hsv_to_rgb(hue, sat, hsv_out[2])
-                
-            elif self.blendingMode == 'SOFT_LIGHT':
-                scr = 1 - (1.0 - col_in[0]) * (1.0 - col_out[0])
-                scg = 1 - (1.0 - col_in[1]) * (1.0 - col_out[1])
-                scb = 1 - (1.0 - col_in[2]) * (1.0 - col_out[2])
-                
-                col_result[0] = (1.0 - col_out[0]) * (col_in[0] * col_out[0]) + (col_out[0] * scr)
-                col_result[1] = (1.0 - col_out[1]) * (col_in[1] * col_out[1]) + (col_out[1] * scg)
-                col_result[2] = (1.0 - col_out[2]) * (col_in[2] * col_out[2]) + (col_out[2] * scb)
-                
-                
-            elif self.blendingMode == 'LINEAR_LIGHT':
-                if col_in[0] > 0.5:
-                    col_result[0] = col_out[0] + 2.0 * (col_in[0] - 0.5)
-                else:
-                    col_result[0] = col_out[0] + 2.0 * (col_in[0] - 1.0)
-                if col_in[1] > 0.5:
-                    col_result[1] = col_out[1] + 2.0 * (col_in[1] - 0.5)
-                else:
-                    col_result[1] = col_out[1] + 2.0 * (col_in[1] - 1.0)
-                if col_in[2] > 0.5:
-                    col_result[2] = col_out[2] + 2.0 * (col_in[2] - 0.5)
-                else:
-                    col_result[2] = col_out[2] + 2.0 * (col_in[2] - 1.0)
-            
-            vertex_colors.data[i].color = col_result
-    
-        return {'FINISHED'}
-
-class VIEW3D_PT_tools_uv_bake_texture_to_vcols(bpy.types.Panel):
-    bl_label = "Bake"
-    bl_space_type = "VIEW_3D"
-    bl_region_type = "TOOLS"
-    
-    @classmethod
-    def poll(self, context):
-        return(context.mode == 'PAINT_VERTEX')
-    
-    def draw(self, context):
-        layout = self.layout
-        layout.operator("uv.bake_texture_to_vcols", text="UV Texture to VCols")
-
-
-def register():
-    bpy.utils.register_module(__name__)
-
-def unregister():
-    bpy.utils.unregister_module(__name__)
-
-if __name__ == "__main__":
-    register()
\ No newline at end of file
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index ab68c94..6bf81d7 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -232,7 +232,6 @@ def enable(module_name, default_set=True, persistent=False):
 
     import os
     import sys
-    import imp
 
     def handle_error():
         import traceback
@@ -246,6 +245,7 @@ def enable(module_name, default_set=True, persistent=False):
         mtime_orig = getattr(mod, "__time__", 0)
         mtime_new = os.path.getmtime(mod.__file__)
         if mtime_orig != mtime_new:
+            import imp
             print("module changed on disk:", mod.__file__, "reloading...")
 
             try:
@@ -311,7 +311,7 @@ def disable(module_name, default_set=True):
     # possible this addon is from a previous session and didn't load a
     # module this time. So even if the module is not found, still disable
     # the addon in the user prefs.
-    if mod:
+    if mod and getattr(mod, "__addon_enabled__", False) is not False:
         mod.__addon_enabled__ = False
         mod.__addon_persistent = False
 
@@ -323,7 +323,8 @@ def disable(module_name, default_set=True):
             import traceback
             traceback.print_exc()
     else:
-        print("addon_utils.disable", module_name, "not loaded")
+        print("addon_utils.disable: %s not %s." %
+              (module_name, "disabled" if mod is None else "loaded"))
 
     # could be in more then once, unlikely but better do this just in case.
     addons = _bpy.context.user_preferences.addons
diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
index cf54584..7e9266d 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
@@ -33,8 +33,7 @@ from bl_i18n_utils import settings
 
 SOURCE_DIR = settings.SOURCE_DIR
 
-CUSTOM_PY_UI_FILES = [os.path.abspath(os.path.join(SOURCE_DIR, p))
-                      for p in settings.CUSTOM_PY_UI_FILES]
+CUSTOM_PY_UI_FILES = [os.path.abspath(os.path.join(SOURCE_DIR, p)) for p in settings.CUSTOM_PY_UI_FILES]
 FILE_NAME_MESSAGES = settings.FILE_NAME_MESSAGES
 COMMENT_PREFIX = settings.COMMENT_PREFIX
 CONTEXT_PREFIX = settings.CONTEXT_PREFIX
@@ -64,8 +63,7 @@ def check(check_ctxt, messages, key, msgsrc):
         if key in py_in_rna[1]:
             py_in_rna[0].add(key)
     if not_capitalized is not None:
-        if(key[1] not in NC_ALLOWED and key[1][0].isalpha() and
-           not key[1][0].isupper()):
+        if(key[1] not in NC_ALLOWED and key[1][0].isalpha() and not key[1][0].isupper()):
             not_capitalized.add(key)
     if end_point is not None:
         if key[1].strip().endswith('.'):
@@ -81,11 +79,9 @@ def dump_messages_rna(messages, check_ctxt):
     def classBlackList():
         blacklist_rna_class = [
                                # core classes
-                               "Context", "Event", "Function", "UILayout",
-                               "BlendData",
+                               "Context", "Event", "Function", "UILayout", "BlendData",
                                # registerable classes
-                               "Panel", "Menu", "Header", "RenderEngine",
-                               "Operator", "OperatorMacro", "Macro",
+                               "Panel", "Menu", "Header", "RenderEngine", "Operator", "OperatorMacro", "Macro",
                                "KeyingSetInfo", "UnknownType",
                                # window classes
                                "Window",
@@ -97,28 +93,22 @@ def dump_messages_rna(messages, check_ctxt):
         # extend with all internal operators
         # note that this uses internal api introspection functions
         # all possible operator names
-        op_ids = set(cls.bl_rna.identifier for cls in
-                     bpy.types.OperatorProperties.__subclasses__()) | \
-                 set(cls.bl_rna.identifier for cls in
-                     bpy.types.Operator.__subclasses__()) | \
-                 set(cls.bl_rna.identifier for cls in
-                     bpy.types.OperatorMacro.__subclasses__())
+        op_ids = set(cls.bl_rna.identifier for cls in bpy.types.OperatorProperties.__subclasses__()) | \
+                 set(cls.bl_rna.identifier for cls in bpy.types.Operator.__subclasses__()) | \
+                 set(cls.bl_rna.identifier for cls in bpy.types.OperatorMacro.__subclasses__())
 
         get_instance = __import__("_bpy").ops.get_instance
         path_resolve = type(bpy.context).__base__.path_resolve
         for idname in op_ids:
             op = get_instance(idname)
-            # XXX Do not skip INTERNAL's anymore, some of those ops
-            #     show up in UI now!
+            # XXX Do not skip INTERNAL's anymore, some of those ops show up in UI now!
 #            if 'INTERNAL' in path_resolve(op, "bl_options"):
 #                blacklist_rna_class.append(idname)
 
         # ---------------------------------------------------------------------
         # Collect builtin classes we don't need to doc
         blacklist_rna_class.append("Property")
-        blacklist_rna_class.extend(
-                [cls.__name__ for cls in
-                 bpy.types.Property.__subclasses__()])
+        blacklist_rna_class.extend([cls.__name__ for cls in bpy.types.Property.__subclasses__()])
 
         # ---------------------------------------------------------------------
         # Collect classes which are attached to collections, these are api
@@ -252,6 +242,12 @@ def dump_messages_rna(messages, check_ctxt):
         cls_list.sort(key=full_class_id)
         processed = 0
         for cls in cls_list:
+            # XXX translation_context of Operator sub-classes are not "good"!
+            #     So ignore those Operator sub-classes (anyway, will get the same from OperatorProperties
+            #     sub-classes!)...
+            if issubclass(cls, bpy.types.Operator):
+                continue
+
             walkClass(cls)
 #            classes.add(cls)
             # Recursively process subclasses.
@@ -389,6 +385,7 @@ def dump_messages_pytext(messages, check_ctxt):
 
 def dump_messages(do_messages, do_checks):
     import collections
+    import re
 
     def enable_addons():
         """For now, enable all official addons, before extracting msgids."""
@@ -419,21 +416,8 @@ def dump_messages(do_messages, do_checks):
                 getattr(cat, op).get_rna()
 
     # check for strings like ": %d"
-    ignore = ("%d", "%f", "%s", "%r",  # string formatting
-              "*", ".", "(", ")", "-", "/", "\\", "+", ":", "#", "%"
-              "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
-              "x",  # used on its own eg: 100x200
-              "X", "Y", "Z", "W",  # used alone. no need to include
-              )
-
-    def filter_message(msg):
-        msg_tmp = msg
-        for ign in ignore:
-            msg_tmp = msg_tmp.replace(ign, "")
-        if not msg_tmp.strip():
-            return True
-        # we could filter out different strings here
-        return False
+    ignore_reg = re.compile(r"^(?:[-*.()/\\+:%xWXYZ0-9]|%d|%f|%s|%r|\s)*$")
+    filter_message = ignore_reg.match
 
     messages = getattr(collections, 'OrderedDict', dict)()
 
@@ -503,7 +487,7 @@ def dump_messages(do_messages, do_checks):
                 message_file.write(key.replace("\n", "") + "\n")
                 num_written += 1
 
-        print("Written {} messages to: {} ({} were filtered out)." \
+        print("Written {} messages to: {} ({} were filtered out)."
               "".format(num_written, FILE_NAME_MESSAGES, num_filtered))
 
 
@@ -516,17 +500,13 @@ def main():
 
     import sys
     back_argv = sys.argv
+    # Get rid of Blender args!
     sys.argv = sys.argv[sys.argv.index("--") + 1:]
 
     import argparse
-    parser = argparse.ArgumentParser(description="Process UI messages " \
-                                                 "from inside Blender.")
-    parser.add_argument('-c', '--no_checks', default=True,
-                        action="store_false",
-                        help="No checks over UI messages.")
-    parser.add_argument('-m', '--no_messages', default=True,
-                        action="store_false",
-                        help="No export of UI messages.")
+    parser = argparse.ArgumentParser(description="Process UI messages from inside Blender.")
+    parser.add_argument('-c', '--no_checks', default=True, action="store_false", help="No checks over UI messages.")
+    parser.add_argument('-m', '--no_messages', default=True, action="store_false", help="No export of UI messages.")
     parser.add_argument('-o', '--output', help="Output messages file path.")
     args = parser.parse_args()
 
diff --git a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py
index a15bea9..533dded 100755
--- a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py
+++ b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py
@@ -39,6 +39,8 @@ except:
 TRUNK_PO_DIR = settings.TRUNK_PO_DIR
 BRANCHES_DIR = settings.BRANCHES_DIR
 
+IMPORT_LANGUAGES_SKIP = settings.IMPORT_LANGUAGES_SKIP
+
 RTL_PREPROCESS_FILE = settings.RTL_PREPROCESS_FILE
 
 PY3 = settings.PYTHON3_EXEC
@@ -63,7 +65,7 @@ def main():
         threshold = float(args.threshold) / 100.0
 
     for lang in os.listdir(BRANCHES_DIR):
-        if args.langs and lang not in args.langs:
+        if (args.langs and lang not in args.langs) or lang in IMPORT_LANGUAGES_SKIP:
             continue
         po = os.path.join(BRANCHES_DIR, lang, ".".join((lang, "po")))
         if os.path.exists(po):
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index d323dd3..c7414e8 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -31,10 +31,67 @@ import os.path
 # MISC
 ###############################################################################
 
+# The languages defined in Blender.
+LANGUAGES_CATEGORIES = (
+    # Min completeness level, UI english label.
+    ( 0.95, "Complete"),
+    ( 0.33, "In Progress"),
+    ( -1.0, "Starting"),
+)
+LANGUAGES = (
+    # ID, UI english label, ISO code.
+    ( 0, "Default (Default)", "DEFAULT"),
+    ( 1, "English (English)", "en_US"),
+    ( 2, "Japanese (日本語)", "ja_JP"),
+    ( 3, "Dutch (Nederlandse taal)", "nl_NL"),
+    ( 4, "Italian (Italiano)", "it_IT"),
+    ( 5, "German (Deutsch)", "de_DE"),
+    ( 6, "Finnish (Suomi)", "fi_FI"),
+    ( 7, "Swedish (Svenska)", "sv_SE"),
+    ( 8, "French (Français)", "fr_FR"),
+    ( 9, "Spanish (Español)", "es"),
+    (10, "Catalan (Català)", "ca_AD"),
+    (11, "Czech (Český)", "cs_CZ"),
+    (12, "Portuguese (Português)", "pt_PT"),
+    (13, "Simplified Chinese (简体中文)", "zh_CN"),
+    (14, "Traditional Chinese (繁體中文)", "zh_TW"),
+    (15, "Russian (Русский)", "ru_RU"),
+    (16, "Croatian (Hrvatski)", "hr_HR"),
+    (17, "Serbian (Српски)", "sr_RS"),
+    (18, "Ukrainian (Український)", "uk_UA"),
+    (19, "Polish (Polski)", "pl_PL"),
+    (20, "Romanian (Român)", "ro_RO"),
+    # Using the utf8 flipped form of Arabic (العربية).
+    (21, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"),
+    (22, "Bulgarian (Български)", "bg_BG"),
+    (23, "Greek (Ελληνικά)", "el_GR"),
+    (24, "Korean (한국 언어)", "ko_KR"),
+    (25, "Nepali (नेपाली)", "ne_NP"),
+    # Using the utf8 flipped form of Persian (فارسی).
+    (26, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"),
+    (27, "Indonesian (Bahasa indonesia)", "id_ID"),
+    (28, "Serbian Latin (Srpski latinica)", "sr_RS at latin"),
+    (29, "Kyrgyz (Кыргыз тили)", "ky_KG"),
+    (30, "Turkish (Türkçe)", "tr_TR"),
+    (31, "Hungarian (Magyar)", "hu_HU"),
+    (32, "Brazilian Portuguese (Português do Brasil)", "pt_BR"),
+    # Using the utf8 flipped form of Hebrew (עִבְרִית)).
+    (33, "Hebrew (תירִבְעִ)", "he_IL"),
+    (34, "Estonian (Eestlane)", "et_EE"),
+    (35, "Esperanto (Esperanto)", "eo"),
+    (36, "Spanish from Spain (Español de España)", "es_ES"),
+)
+
+# Name of language file used by Blender to generate translations' menu.
+LANGUAGES_FILE = "languages"
+
 # The min level of completeness for a po file to be imported from /branches
 # into /trunk, as a percentage. -1 means "import everything".
 IMPORT_MIN_LEVEL = -1
 
+# Languages in /branches we do not want to import in /trunk currently...
+IMPORT_LANGUAGES_SKIP = {'bg', 'ca', 'fi', 'el', 'ko', 'ne', 'pl', 'ro'}
+
 # The comment prefix used in generated messages.txt file.
 COMMENT_PREFIX = "#~ "
 
@@ -57,6 +114,9 @@ DOMAIN = "blender"
 # File type (ext) to parse.
 PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"}
 
+# Max number of contexts into a BLF_I18N_MSGID_MULTI_CTXT macro...
+PYGETTEXT_MAX_MULTI_CTXT = 16
+
 # Where to search contexts definitions, relative to SOURCE_DIR (defined below).
 PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont",
                                          "BLF_translation.h")
@@ -92,17 +152,34 @@ _str_whole_re = (
     # End of loop.
     "))*"
 )
-_ctxt_re = r"(?P<ctxt_raw>(?:" + _str_whole_re.format(_="_ctxt") + r")|(?:[A-Z_0-9]+))"
+_ctxt_re_gen = lambda uid : r"(?P<ctxt_raw{uid}>(?:".format(uid=uid) + \
+                            _str_whole_re.format(_="_ctxt{uid}".format(uid=uid)) + \
+                            r")|(?:[A-Z_0-9]+))"
+_ctxt_re = _ctxt_re_gen("")
 _msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")"
 PYGETTEXT_KEYWORDS = (() +
     tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it)
           for it in ("IFACE_", "TIP_", "N_")) +
+
     tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*" + _msg_re + r"\s*\)").format(it)
-          for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_"))
+          for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) + 
+
+    tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
+          for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf")) +
+
+    tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*,").format(it)
+          for it in ("BMO_error_raise",)) +
+
+    tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
+          for it in ("modifier_setError",)) +
+
+    tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" + \
+           r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it)
+          for it in ("BLF_I18N_MSGID_MULTI_CTXT",))
 )
 
 ESCAPE_RE = (
-    ('((?<!\\\\)"|(?<!\\\\)\\\\(?!\\\\|"))', r"\\\1"),
+    (r'((?<!\\)"|(?<!\\)\\(?!\\|"))', r"\\\1"),
     ('\t', r"\\t"),
 )
 
@@ -136,37 +213,8 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
     "iTaSC parameters",
     "vBVH",
     "rv",
-    "en_US",
-    "fr_FR",
-    "it_IT",
-    "ru_RU",
-    "zh_CN",
-    "es",
-    "zh_TW",
-    "ar_EG",
-    "pt",
-    "bg_BG",
-    "ca_AD",
-    "hr_HR",
-    "cs_CZ",
-    "nl_NL",
-    "fi_FI",
-    "de_DE",
-    "el_GR",
-    "id_ID",
-    "ja_JP",
-    "ky_KG",
-    "ko_KR",
-    "ne_NP",
-    "fa_IR",
-    "pl_PL",
-    "ro_RO",
-    "sr_RS",
-    "sr_RS at latin",
-    "sv_SE",
-    "uk_UA",
-    "tr_TR",
-    "hu_HU",
+    "et_EE",
+    "eo",
     "available with",                # Is part of multi-line msg.
     "virtual parents",               # Is part of multi-line msg.
     "description",                   # Addons' field. :/
@@ -178,6 +226,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
     "p0",
     "res",
 }
+WARN_MSGID_NOT_CAPITALIZED_ALLOWED |= set(lng[2] for lng in LANGUAGES)
 
 
 ###############################################################################
@@ -192,47 +241,35 @@ TOOLS_DIR = os.path.join(os.path.dirname(__file__))
 PYTHON3_EXEC = "python3"
 
 # The Blender executable!
-# This is just an example, you’ll most likely have to edit it in your
-# user_settings.py!
-BLENDER_EXEC = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..",
-                                            "blender"))
+# This is just an example, you’ll most likely have to edit it in your user_settings.py!
+BLENDER_EXEC = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "blender"))
 
-# The xgettext tool. You’ll likely have to edit it in your user_settings.py
-# if you’re under Windows.
+# The xgettext tool. You’ll likely have to edit it in your user_settings.py if you’re under Windows.
 GETTEXT_XGETTEXT_EXECUTABLE = "xgettext"
 
-# The gettext msgmerge tool. You’ll likely have to edit it in your
-# user_settings.py if you’re under Windows.
+# The gettext msgmerge tool. You’ll likely have to edit it in your user_settings.py if you’re under Windows.
 GETTEXT_MSGMERGE_EXECUTABLE = "msgmerge"
 
-# The gettext msgfmt "compiler". You’ll likely have to edit it in your
-# user_settings.py if you’re under Windows.
+# The gettext msgfmt "compiler". You’ll likely have to edit it in your user_settings.py if you’re under Windows.
 GETTEXT_MSGFMT_EXECUTABLE = "msgfmt"
 
-# The svn binary... You’ll likely have to edit it in your
-# user_settings.py if you’re under Windows.
+# The svn binary... You’ll likely have to edit it in your user_settings.py if you’re under Windows.
 SVN_EXECUTABLE = "svn"
 
 # The FriBidi C compiled library (.so under Linux, .dll under windows...).
-# You’ll likely have to edit it in your user_settings.py if you’re under
-# Windows., e.g. using the included one:
+# You’ll likely have to edit it in your user_settings.py if you’re under Windows., e.g. using the included one:
 #     FRIBIDI_LIB = os.path.join(TOOLS_DIR, "libfribidi.dll")
 FRIBIDI_LIB = "libfribidi.so.0"
 
-# The name of the (currently empty) file that must be present in a po's
-# directory to enable rtl-preprocess.
+# The name of the (currently empty) file that must be present in a po's directory to enable rtl-preprocess.
 RTL_PREPROCESS_FILE = "is_rtl"
 
 # The Blender source root path.
-# This is just an example, you’ll most likely have to override it in your
-# user_settings.py!
-SOURCE_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..",
-                                          "..", "..", "blender_msgs"))
+# This is just an example, you’ll most likely have to override it in your user_settings.py!
+SOURCE_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "..", "..", "blender_msgs"))
 
-# The bf-translation repository (you'll likely have to override this in your
-# user_settings.py).
-I18N_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..",
-                                        "..", "..", "i18n"))
+# The bf-translation repository (you'll likely have to override this in your user_settings.py).
+I18N_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "..", "..", "i18n"))
 
 # The /branches path (overriden in bf-translation's i18n_override_settings.py).
 BRANCHES_DIR = os.path.join(I18N_DIR, "branches")
@@ -252,12 +289,10 @@ FILE_NAME_MESSAGES = os.path.join(TRUNK_PO_DIR, "messages.txt")
 # The Blender source path to check for i18n macros.
 POTFILES_SOURCE_DIR = os.path.join(SOURCE_DIR, "source")
 
-# The "source" file storing which files should be processed by xgettext,
-# used to create FILE_NAME_POTFILES
+# The "source" file storing which files should be processed by xgettext, used to create FILE_NAME_POTFILES
 FILE_NAME_SRC_POTFILES = os.path.join(TRUNK_PO_DIR, "_POTFILES.in")
 
-# The final (generated) file storing which files
-# should be processed by xgettext.
+# The final (generated) file storing which files should be processed by xgettext.
 FILE_NAME_POTFILES = os.path.join(TRUNK_PO_DIR, "POTFILES.in")
 
 # The template messages file.
@@ -265,9 +300,7 @@ FILE_NAME_POT = os.path.join(TRUNK_PO_DIR, ".".join((DOMAIN, "pot")))
 
 # Other py files that should be searched for ui strings, relative to SOURCE_DIR.
 # Needed for Cycles, currently...
-CUSTOM_PY_UI_FILES = [os.path.join("intern", "cycles", "blender",
-                                   "addon", "ui.py"),
-                     ]
+CUSTOM_PY_UI_FILES = [os.path.join("intern", "cycles", "blender", "addon", "ui.py"),]
 
 
 # A cache storing validated msgids, to avoid re-spellchecking them.
diff --git a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
index 46b3691..fbe405a 100644
--- a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
+++ b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
@@ -37,10 +37,12 @@ dict_uimsgs = {
     "aren",  # aren't
     "betweens",  # yuck! in-betweens!
     "boolean", "booleans",
+    "couldn",  #couldn't
     "decrement",
     "derivate",
     "doesn",  # doesn't
     "fader",
+    "hasn",  # hasn't
     "hoc",  # ad-hoc
     "indices",
     "iridas",
@@ -75,6 +77,7 @@ dict_uimsgs = {
     "boxpack",
     "buffersize",
     "builtin", "builtins",
+    "bytecode",
     "chunksize",
     "de",
     "defocus",
@@ -89,7 +92,9 @@ dict_uimsgs = {
     "fullscreen",
     "gridline",
     "hemi",
+    "inbetween",
     "inscatter", "inscattering",
+    "libdata",
     "lightless",
     "lookup", "lookups",
     "mathutils",
@@ -101,6 +106,7 @@ dict_uimsgs = {
     "multires", "multiresolution",
     "multisampling",
     "multitexture",
+    "multiuser",
     "namespace",
     "keyconfig",
     "playhead",
@@ -143,6 +149,7 @@ dict_uimsgs = {
     "tilemode",
     "timestamp", "timestamps",
     "timestep", "timesteps",
+    "todo",
     "un",
     "unbake",
     "uncomment",
@@ -157,7 +164,7 @@ dict_uimsgs = {
     "unreacted",
     "unregister",
     "unselected",
-    "unsubdivided",
+    "unsubdivided", "unsubdivide",
     "unshadowed",
     "unspill",
     "unstitchable",
@@ -185,6 +192,7 @@ dict_uimsgs = {
     "selectability",
     "slurph",
     "stitchable",
+    "symmetrize",
     "trackability",
     "transmissivity",
     "rasterized", "rasterization",
@@ -230,6 +238,7 @@ dict_uimsgs = {
     "quat", "quats",
     "recalc", "recalcs",
     "refl",
+    "sel",
     "spec",
     "struct", "structs",
     "tex",
@@ -290,6 +299,7 @@ dict_uimsgs = {
     "crossfade",
     "deinterlace",
     "dropoff",
+    "dv",
     "eigenvectors",
     "equirectangular",
     "fisheye",
@@ -303,6 +313,7 @@ dict_uimsgs = {
     "midtones",
     "mipmap", "mipmaps", "mip",
     "ngon", "ngons",
+    "ntsc",
     "nurb", "nurbs",
     "perlin",
     "phong",
@@ -323,6 +334,7 @@ dict_uimsgs = {
     "ztransp",
 
     # Blender terms
+    "audaspace",
     "bbone",
     "breakdowner",
     "bspline",
@@ -347,6 +359,8 @@ dict_uimsgs = {
     "metaelement", "metaelements",
     "metastrip", "metastrips",
     "movieclip",
+    "mpoly",
+    "mtex",
     "nabla",
     "navmesh",
     "outliner",
@@ -362,6 +376,7 @@ dict_uimsgs = {
     "stucci",
     "sunsky",
     "subsurf",
+    "tessface", "tessfaces",
     "texface",
     "timeline", "timelines",
     "tosphere",
@@ -376,6 +391,7 @@ dict_uimsgs = {
     "catmull",
     "catrom",
     "chebychev",
+    "courant",
     "kutta",
     "lennard",
     "minkowski",
@@ -406,15 +422,18 @@ dict_uimsgs = {
     "dpi",
     "dvar",
     "dx",
+    "eo",
     "fh",
     "fov",
     "fft",
+    "futura",
     "gfx",
     "gl",
     "glsl",
     "gpl",
     "gpu", "gpus",
     "hc",
+    "hdc",
     "hdr",
     "hh", "mm", "ss", "ff",  # hh:mm:ss:ff timecode
     "hsv", "hsva",
@@ -425,6 +444,7 @@ dict_uimsgs = {
     "mux",
     "ndof",
     "ppc",
+    "precisa",
     "px",
     "qmc",
     "rgb", "rgba",
@@ -448,6 +468,7 @@ dict_uimsgs = {
     "dop",  # BLI K-Dop BVH
     "ik",
     "nla",
+    "py",
     "qbvh",
     "rna",
     "rvo",
@@ -485,6 +506,8 @@ dict_uimsgs = {
     "mtl",
     "ogg",
     "openjpeg",
+    "osl",
+    "oso",
     "piz",
     "png",
     "po",
diff --git a/release/scripts/modules/bl_i18n_utils/update_branches.py b/release/scripts/modules/bl_i18n_utils/update_branches.py
index 199b09a..4c38a2f 100755
--- a/release/scripts/modules/bl_i18n_utils/update_branches.py
+++ b/release/scripts/modules/bl_i18n_utils/update_branches.py
@@ -38,6 +38,8 @@ except:
 
 PY3 = settings.PYTHON3_EXEC
 
+FILE_NAME_POT = settings.FILE_NAME_POT
+
 
 def main():
     import argparse
@@ -71,16 +73,13 @@ def main():
     if t:
         ret = t
 
-    # Regenerate POTFILES.in.
-#    cmd = (PY3, "./update_potinput.py")
-#    t = subprocess.call(cmd)
-#    if t:
-#        ret = t
-
     # Generate a temp pot file.
-    dummy, potfile = tempfile.mkstemp(suffix=".pot",
-                                      prefix="blender_pot_")
-    os.close(dummy)
+    # Back to having a pot file in trunk/po. It's quite useful for translators that want to start
+    # a new translation and not not want to bother generating their own po from scratch!
+#    dummy, potfile = tempfile.mkstemp(suffix=".pot",
+#                                      prefix="blender_pot_")
+#    os.close(dummy)
+    potfile = FILE_NAME_POT
     cmd = [PY3, "./update_pot.py", "-i", msgfile, "-o", potfile]
     if not args.no_checks:
         cmd.append("-c")
diff --git a/release/scripts/modules/bl_i18n_utils/update_languages_menu.py b/release/scripts/modules/bl_i18n_utils/update_languages_menu.py
new file mode 100755
index 0000000..9b4cb20
--- /dev/null
+++ b/release/scripts/modules/bl_i18n_utils/update_languages_menu.py
@@ -0,0 +1,148 @@
+#!/usr/bin/python3
+
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# <pep8 compliant>
+
+# Update "languages" text file used by Blender at runtime to build translations menu.
+
+import os
+import sys
+import shutil
+
+try:
+    import settings
+    import utils
+except:
+    from . import (settings, utils)
+
+TRUNK_PO_DIR = settings.TRUNK_PO_DIR
+TRUNK_MO_DIR = settings.TRUNK_MO_DIR
+
+LANGUAGES_CATEGORIES = settings.LANGUAGES_CATEGORIES
+LANGUAGES = settings.LANGUAGES
+LANGUAGES_FILE = settings.LANGUAGES_FILE
+
+OK = 0
+MISSING = 1
+TOOLOW = 2
+FORBIDDEN = 3
+FLAG_MESSAGES = {
+    OK: "",
+    MISSING: "No translation yet!",
+    TOOLOW: "Not enough advanced to be included...",
+    FORBIDDEN: "Explicitly forbidden!",
+}
+
+def find_matching_po(languages, stats, forbidden):
+    """Match languages defined in LANGUAGES setting to relevant po, if possible!"""
+    ret = []
+    for uid, label, org_key, in languages:
+        key = org_key
+        if key not in stats:
+            # Try to simplify the key (eg from es_ES to es).
+            if '_' in org_key:
+                key = org_key[0:org_key.index('_')]
+            # For stuff like sr_SR at latin -> sr at latin...
+            if '@' in org_key:
+                key = key + org_key[org_key.index('@'):]
+        if key in stats:
+            if key in forbidden:
+                ret.append((stats[key], uid, label, org_key, FORBIDDEN))
+            else:
+                ret.append((stats[key], uid, label, org_key, OK))
+        else:
+            ret.append((0.0, uid, label, org_key, MISSING))
+    return ret
+
+def main():
+    import argparse
+    parser = argparse.ArgumentParser(description=""
+                        "Update 'languages' text file used by Blender at runtime to build translations menu.")
+    parser.add_argument('-m', '--min_translation', type=int, default=-100,
+                        help="Minimum level of translation, as a percentage "
+                             "(translations below this are commented out in menu).")
+    parser.add_argument('langs', metavar='ISO_code', nargs='*',
+                        help="Unconditionally exclude those languages from the menu.")
+    args = parser.parse_args()
+
+    ret = 0
+    min_trans = args.min_translation / 100.0
+    forbidden = set(args.langs)
+    # 'DEFAULT' and en_US are always valid, fully-translated "languages"!
+    stats = {"DEFAULT": 1.0, "en_US": 1.0}
+
+    # Get the "done level" of each po in trunk...
+    for po in os.listdir(TRUNK_PO_DIR):
+        if po.endswith(".po") and not po.endswith("_raw.po"):
+            lang = os.path.basename(po)[:-3]
+            u1, u2, _stats = utils.parse_messages(os.path.join(TRUNK_PO_DIR, po))
+            stats[lang] = _stats["trans_msg"] / _stats["tot_msg"]
+
+    # Generate languages file used by Blender's i18n system.
+    # First, match all entries in LANGUAGES to a lang in stats, if possible!
+    stats = find_matching_po(LANGUAGES, stats, forbidden)
+    limits = sorted(LANGUAGES_CATEGORIES, key=lambda it: it[0], reverse=True)
+    idx = 0
+    stats = sorted(stats, key=lambda it: it[0], reverse=True)
+    langs_cats = [[] for i in range(len(limits))]
+    highest_uid = 0
+    for prop, uid, label, key, flag in stats:
+        if prop < limits[idx][0]:
+            # Sub-sort languages by iso-codes.
+            langs_cats[idx].sort(key=lambda it: it[2])
+            idx += 1
+        if prop < min_trans and flag == OK:
+            flag = TOOLOW
+        langs_cats[idx].append((uid, label, key, flag))
+        if abs(uid) > highest_uid:
+            highest_uid = abs(uid)
+    # Sub-sort last group of languages by iso-codes!
+    langs_cats[idx].sort(key=lambda it: it[2])
+    with open(os.path.join(TRUNK_MO_DIR, LANGUAGES_FILE), 'w', encoding="utf-8") as f:
+        f.write("# File used by Blender to know which languages (translations) are available, \n")
+        f.write("# and to generate translation menu.\n")
+        f.write("#\n")
+        f.write("# File format:\n")
+        f.write("# ID:MENULABEL:ISOCODE\n")
+        f.write("# ID must be unique, except for 0 value (marks categories for menu).\n")
+        f.write("# Line starting with a # are comments!\n")
+        f.write("#\n")
+        f.write("# Automatically generated by bl_i18n_utils/update_languages_menu.py script.\n")
+        f.write("# Highest ID currently in use: {}\n".format(highest_uid))
+        for cat, langs_cat in zip(limits, langs_cats):
+            f.write("#\n")
+            # Write "category menu label"...
+            if langs_cat:
+                f.write("0:{}::\n".format(cat[1]))
+            else:
+                # Do not write the category if it has no language!
+                f.write("# Void category! #0:{}:\n".format(cat[1]))
+            # ...and all matching language entries!
+            for uid, label, key, flag in langs_cat:
+                if flag == OK:
+                    f.write("{}:{}:{}\n".format(uid, label, key))
+                else:
+                    # Non-existing, commented entry!
+                    f.write("# {} #{}:{}:{}\n".format(FLAG_MESSAGES[flag], uid, label, key))
+
+
+if __name__ == "__main__":
+    print("\n\n *** Running {} *** \n".format(__file__))
+    sys.exit(main())
diff --git a/release/scripts/modules/bl_i18n_utils/update_mo.py b/release/scripts/modules/bl_i18n_utils/update_mo.py
index 4a68f19..7f68736 100755
--- a/release/scripts/modules/bl_i18n_utils/update_mo.py
+++ b/release/scripts/modules/bl_i18n_utils/update_mo.py
@@ -69,9 +69,9 @@ def main():
                                                  "under {}.".format(TRUNK_MO_DIR))
     parser.add_argument('langs', metavar='ISO_code', nargs='*',
                         help="Restrict processed languages to those.")
-    parser.add_argument('po', help="Only process that po file (implies --mo).",
+    parser.add_argument('--po', help="Only process that po file (implies --mo).",
                         nargs='?')
-    parser.add_argument('mo', help="Mo file to generate (implies --po).",
+    parser.add_argument('--mo', help="Mo file to generate (implies --po).",
                         nargs='?')
     args = parser.parse_args()
 
@@ -97,6 +97,7 @@ def main():
                 t = process_po(po, lang)
                 if t:
                     ret = t
+
     return ret
 
 
diff --git a/release/scripts/modules/bl_i18n_utils/update_pot.py b/release/scripts/modules/bl_i18n_utils/update_pot.py
index f98fc5d..ecb5d83 100755
--- a/release/scripts/modules/bl_i18n_utils/update_pot.py
+++ b/release/scripts/modules/bl_i18n_utils/update_pot.py
@@ -38,6 +38,9 @@ except:
     from . import (settings, utils)
 
 
+LANGUAGES_CATEGORIES = settings.LANGUAGES_CATEGORIES
+LANGUAGES = settings.LANGUAGES
+
 COMMENT_PREFIX = settings.COMMENT_PREFIX
 COMMENT_PREFIX_SOURCE = settings.COMMENT_PREFIX_SOURCE
 CONTEXT_PREFIX = settings.CONTEXT_PREFIX
@@ -49,6 +52,7 @@ SRC_POTFILES = settings.FILE_NAME_SRC_POTFILES
 
 CONTEXT_DEFAULT = settings.CONTEXT_DEFAULT
 PYGETTEXT_ALLOWED_EXTS = settings.PYGETTEXT_ALLOWED_EXTS
+PYGETTEXT_MAX_MULTI_CTXT = settings.PYGETTEXT_MAX_MULTI_CTXT
 
 SVN_EXECUTABLE = settings.SVN_EXECUTABLE
 
@@ -76,6 +80,31 @@ clean_str = lambda s: "".join(m.group("clean") for m in _clean_str(s))
 
 
 def check_file(path, rel_path, messages):
+    def process_entry(ctxt, msg):
+        # Context.
+        if ctxt:
+            if ctxt in CONTEXTS:
+                ctxt = CONTEXTS[ctxt]
+            elif '"' in ctxt or "'" in ctxt:
+                ctxt = clean_str(ctxt)
+            else:
+                print("WARNING: raw context “{}” couldn’t be resolved!"
+                      "".format(ctxt))
+                ctxt = CONTEXT_DEFAULT
+        else:
+            ctxt = CONTEXT_DEFAULT
+        # Message.
+        if msg:
+            if '"' in msg or "'" in msg:
+                msg = clean_str(msg)
+            else:
+                print("WARNING: raw message “{}” couldn’t be resolved!"
+                      "".format(msg))
+                msg = ""
+        else:
+            msg = ""
+        return (ctxt, msg)
+
     with open(path, encoding="utf-8") as f:
         f = f.read()
         for srch in pygettexts:
@@ -83,62 +112,53 @@ def check_file(path, rel_path, messages):
             line = pos = 0
             while m:
                 d = m.groupdict()
-                # Context.
-                ctxt = d.get("ctxt_raw")
-                if ctxt:
-                    if ctxt in CONTEXTS:
-                        ctxt = CONTEXTS[ctxt]
-                    elif '"' in ctxt or "'" in ctxt:
-                        ctxt = clean_str(ctxt)
-                    else:
-                        print("WARNING: raw context “{}” couldn’t be resolved!"
-                              "".format(ctxt))
-                        ctxt = CONTEXT_DEFAULT
-                else:
-                    ctxt = CONTEXT_DEFAULT
-                # Message.
-                msg = d.get("msg_raw")
-                if msg:
-                    if '"' in msg or "'" in msg:
-                        msg = clean_str(msg)
-                    else:
-                        print("WARNING: raw message “{}” couldn’t be resolved!"
-                              "".format(msg))
-                        msg = ""
-                else:
-                    msg = ""
                 # Line.
                 line += f[pos:m.start()].count('\n')
-                # And we are done for this item!
-                messages.setdefault((ctxt, msg), []).append(":".join((rel_path, str(line))))
+                msg = d.get("msg_raw")
+                # First, try the "multi-contexts" stuff!
+                ctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(PYGETTEXT_MAX_MULTI_CTXT))
+                if ctxts[0]:
+                    for ctxt in ctxts:
+                        if not ctxt:
+                            break
+                        ctxt, _msg = process_entry(ctxt, msg)
+                        # And we are done for this item!
+                        messages.setdefault((ctxt, _msg), []).append(":".join((rel_path, str(line))))
+                else:
+                    ctxt = d.get("ctxt_raw")
+                    ctxt, msg = process_entry(ctxt, msg)
+                    # And we are done for this item!
+                    messages.setdefault((ctxt, msg), []).append(":".join((rel_path, str(line))))
                 pos = m.end()
                 line += f[m.start():pos].count('\n')
                 m = srch(f, pos)
 
 
 def py_xgettext(messages):
+    forbidden = set()
+    forced = set()
     with open(SRC_POTFILES) as src:
-        forbidden = set()
-        forced = set()
         for l in src:
             if l[0] == '-':
                 forbidden.add(l[1:].rstrip('\n'))
             elif l[0] != '#':
                 forced.add(l.rstrip('\n'))
-        for root, dirs, files in os.walk(POTFILES_DIR):
-            if "/.svn" in root:
+    for root, dirs, files in os.walk(POTFILES_DIR):
+        if "/.svn" in root:
+            continue
+        for fname in files:
+            if os.path.splitext(fname)[1] not in PYGETTEXT_ALLOWED_EXTS:
+                continue
+            path = os.path.join(root, fname)
+            rel_path = os.path.relpath(path, SOURCE_DIR)
+            if rel_path in forbidden:
                 continue
-            for fname in files:
-                if os.path.splitext(fname)[1] not in PYGETTEXT_ALLOWED_EXTS:
-                    continue
-                path = os.path.join(root, fname)
-                rel_path = os.path.relpath(path, SOURCE_DIR)
-                if rel_path in forbidden | forced:
-                    continue
-                check_file(path, rel_path, messages)
-        for path in forced:
-            if os.path.exists(path):
-                check_file(os.path.join(SOURCE_DIR, path), path, messages)
+            elif rel_path not in forced:
+                forced.add(rel_path)
+    for rel_path in sorted(forced):
+        path = os.path.join(SOURCE_DIR, rel_path)
+        if os.path.exists(path):
+            check_file(path, rel_path, messages)
 
 
 # Spell checking!
@@ -187,7 +207,7 @@ def get_svnrev():
 
 
 def gen_empty_pot():
-    blender_rev = get_svnrev()
+    blender_rev = get_svnrev().decode()
     utctime = time.gmtime()
     time_str = time.strftime("%Y-%m-%d %H:%M+0000", utctime)
     year_str = time.strftime("%Y", utctime)
@@ -231,8 +251,8 @@ def merge_messages(msgs, states, messages, do_checks, spell_cache):
 
 
 def main():
-    parser = argparse.ArgumentParser(description="Update blender.pot file " \
-                                                 "from messages.txt")
+    parser = argparse.ArgumentParser(description="Update blender.pot file from messages.txt and source code parsing, "
+                                                 "and performs some checks over msgids.")
     parser.add_argument('-w', '--warning', action="store_true",
                         help="Show warnings.")
     parser.add_argument('-i', '--input', metavar="File",
@@ -250,7 +270,7 @@ def main():
 
     print("Running fake py gettext…")
     # Not using any more xgettext, simpler to do it ourself!
-    messages = {}
+    messages = utils.new_messages()
     py_xgettext(messages)
     print("Finished, found {} messages.".format(len(messages)))
 
@@ -259,7 +279,6 @@ def main():
             spell_cache = pickle.load(f)
     else:
         spell_cache = set()
-    print(len(spell_cache))
 
     print("Generating POT file {}…".format(FILE_NAME_POT))
     msgs, states = gen_empty_pot()
@@ -268,7 +287,7 @@ def main():
 
     # add messages collected automatically from RNA
     print("\tMerging RNA messages from {}…".format(FILE_NAME_MESSAGES))
-    messages = {}
+    messages = utils.new_messages()
     with open(FILE_NAME_MESSAGES, encoding="utf-8") as f:
         srcs = []
         context = ""
@@ -290,11 +309,22 @@ def main():
     print("\tMerged {} messages ({} were already present)."
           "".format(num_added, num_present))
 
+    print("\tAdding languages labels...")
+    messages = {(CONTEXT_DEFAULT, lng[1]):
+                ("Languages’ labels from bl_i18n_utils/settings.py",)
+                for lng in LANGUAGES}
+    messages.update({(CONTEXT_DEFAULT, cat[1]):
+                     ("Language categories’ labels from bl_i18n_utils/settings.py",)
+                     for cat in LANGUAGES_CATEGORIES})
+    num_added, num_present = merge_messages(msgs, states, messages,
+                                            True, spell_cache)
+    tot_messages += num_added
+    print("\tAdded {} language messages.".format(num_added))
+
     # Write back all messages into blender.pot.
     utils.write_messages(FILE_NAME_POT, msgs, states["comm_msg"],
                          states["fuzzy_msg"])
 
-    print(len(spell_cache))
     if SPELL_CACHE and spell_cache:
         with open(SPELL_CACHE, 'wb') as f:
             pickle.dump(spell_cache, f)
diff --git a/release/scripts/modules/bl_i18n_utils/update_trunk.py b/release/scripts/modules/bl_i18n_utils/update_trunk.py
index b7f8f37..b84a227 100755
--- a/release/scripts/modules/bl_i18n_utils/update_trunk.py
+++ b/release/scripts/modules/bl_i18n_utils/update_trunk.py
@@ -35,34 +35,55 @@ import shutil
 
 try:
     import settings
+    import utils
 except:
-    from . import settings
+    from . import (settings, utils)
 
+BRANCHES_DIR = settings.BRANCHES_DIR
 TRUNK_PO_DIR = settings.TRUNK_PO_DIR
 TRUNK_MO_DIR = settings.TRUNK_MO_DIR
 
+LANGUAGES_CATEGORIES = settings.LANGUAGES_CATEGORIES
+LANGUAGES = settings.LANGUAGES
+LANGUAGES_FILE = settings.LANGUAGES_FILE
+
 PY3 = settings.PYTHON3_EXEC
 
 
+def find_matching_po(languages, stats):
+    """Match languages defined in LANGUAGES setting to relevant po, if possible!"""
+    ret = []
+    for uid, label, org_key in languages:
+        key = org_key
+        if key not in stats:
+            # Try to simplify the key (eg from es_ES to es).
+            if '_' in org_key:
+                key = org_key[0:org_key.index('_')]
+            if '@' in org_key:
+                key = key + org_key[org_key.index('@'):]
+        if key in stats:
+            ret.append((stats[key], uid, label, org_key))
+        else:
+            # Mark invalid entries, so that we can put them in the languages file,
+            # but commented!
+            ret.append((0.0, -uid, label, org_key))
+    return ret
+
 def main():
     import argparse
-    parser = argparse.ArgumentParser(description="" \
-                        "Update trunk from branches:\n" \
-                        "* Remove po’s in trunk.\n" \
-                        "* Copy po’s from branches advanced enough.\n" \
-                        "* Clean po’s in trunk.\n" \
-                        "* Compile po’s in trunk in mo’s, keeping " \
-                        "track of those failing.\n" \
-                        "* Remove po’s and mo’s (and their dir’s) that " \
-                        "failed to compile or are no more present in trunk.")
-    parser.add_argument('-t', '--threshold', type=int,
-                        help="Import threshold, as a percentage.")
-    parser.add_argument('-p', '--po', action="store_false",
-                        help="Do not remove failing po’s.")
-    parser.add_argument('-m', '--mo', action="store_false",
-                        help="Do not remove failing mo’s.")
-    parser.add_argument('langs', metavar='ISO_code', nargs='*',
-                        help="Restrict processed languages to those.")
+    parser = argparse.ArgumentParser(description=""
+                        "Update trunk from branches:\n"
+                        "* Remove po’s in trunk.\n"
+                        "* Copy po’s from branches advanced enough.\n"
+                        "* Clean po’s in trunk.\n"
+                        "* Compile po’s in trunk in mo’s, keeping track of those failing.\n"
+                        "* Remove po’s and mo’s (and their dir’s) that "
+                        "failed to compile or are no more present in trunk."
+                        "* Generate languages file used by Blender's i18n.")
+    parser.add_argument('-t', '--threshold', type=int, help="Import threshold, as a percentage.")
+    parser.add_argument('-p', '--po', action="store_true", help="Remove failing po’s.")
+    parser.add_argument('-m', '--mo', action="store_true", help="Remove failing mo’s.")
+    parser.add_argument('langs', metavar='ISO_code', nargs='*', help="Restrict processed languages to those.")
     args = parser.parse_args()
 
     ret = 0
@@ -89,12 +110,12 @@ def main():
 
     # Add in failed all mo’s no more having relevant po’s in trunk.
     for lang in os.listdir(TRUNK_MO_DIR):
-        if lang == ".svn":
+        if lang in {".svn", LANGUAGES_FILE}:
             continue  # !!!
         if not os.path.exists(os.path.join(TRUNK_PO_DIR, ".".join((lang, "po")))):
             failed.add(lang)
 
-    # Check and compile each po separatly, to keep track of those failing.
+    # Check and compile each po separately, to keep track of those failing.
     # XXX There should not be any failing at this stage, import step is
     #     supposed to have already filtered them out!
     for po in os.listdir(TRUNK_PO_DIR):
@@ -115,6 +136,13 @@ def main():
             if t:
                 ret = t
                 failed.add(lang)
+                continue
+
+    # Generate languages file used by Blender's i18n system.
+    cmd = [PY3, "./update_languages_menu.py"]
+    t = subprocess.call(cmd)
+    if t:
+        ret = t
 
     # Remove failing po’s, mo’s and related dir’s.
     for lang in failed:
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index 25b9daa..9481f75 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -41,6 +41,10 @@ def is_tooltip(msgid):
     return len(msgid) > 30
 
 
+def new_messages():
+    return getattr(collections, 'OrderedDict', dict)()
+
+
 def parse_messages(fname):
     """
     Returns a tupple (messages, states, stats).
@@ -78,7 +82,7 @@ def parse_messages(fname):
     msgctxt_lines = []
     comment_lines = []
 
-    messages = getattr(collections, 'OrderedDict', dict)()
+    messages = new_messages()
     translated_messages = set()
     fuzzy_messages = set()
     commented_messages = set()
@@ -282,7 +286,7 @@ def gen_empty_messages(blender_rev, time_str, year_str):
     """Generate an empty messages & state data (only header if present!)."""
     header_key = ("", "")
 
-    messages = getattr(collections, 'OrderedDict', dict)()
+    messages = new_messages()
     messages[header_key] = {
         "msgid_lines": [""],
         "msgctxt_lines": [],
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index 34beb60..52bf1c0 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -74,7 +74,7 @@ class BPyOpsSubMod(object):
 
     eg. bpy.ops.object
     """
-    __keys__ = ("module",)
+    __slots__ = ("module",)
 
     def __init__(self, module):
         self.module = module
@@ -111,7 +111,7 @@ class BPyOpsSubModOp(object):
     eg. bpy.ops.object.somefunc
     """
 
-    __keys__ = ("module", "func")
+    __slots__ = ("module", "func")
 
     def _get_doc(self):
         return op_as_string(self.idname())
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 573694f..4ad00eb 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -216,7 +216,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
         for mod in _global_loaded_modules:
             test_reload(mod)
 
-        _global_loaded_modules[:] = []
+        del _global_loaded_modules[:]
 
     for base_path in script_paths():
         for path_subdir in _script_module_dirs:
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py
index ad3cf8c..0166f95 100644
--- a/release/scripts/modules/bpy_extras/mesh_utils.py
+++ b/release/scripts/modules/bpy_extras/mesh_utils.py
@@ -223,7 +223,7 @@ def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
             else:
                 other_dir = None
 
-            ed_adj[:] = []
+            del ed_adj[:]
 
             flipped = False
 
@@ -235,22 +235,22 @@ def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
                     if other_dir and flipped is False:
                         flipped = True  # only flip the list once
                         context_loop.reverse()
-                        ed_adj[:] = []
+                        del ed_adj[:]
                         context_loop.append(other_dir)  # save 1 look-up
 
                         ed_adj = edges[context_loop[-1]]
                         if len(ed_adj) != 2:
-                            ed_adj[:] = []
+                            del ed_adj[:]
                             break
                     else:
-                        ed_adj[:] = []
+                        del ed_adj[:]
                         break
 
                 i = ed_adj.index(context_loop[-2])
                 context_loop.append(ed_adj[not  i])
 
                 # Dont look at this again
-                ed_adj[:] = []
+                del ed_adj[:]
 
     return edge_loops
 
@@ -325,10 +325,12 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
     fgon to create from existing verts.
 
     from_data: either a mesh, or a list/tuple of vectors.
-    indices: a list of indices to use this list is the ordered closed polyline
+    :arg indices: a list of indices to use this list is the ordered closed polyline
        to fill, and can be a subset of the data given.
-    fix_loops: If this is enabled polylines that use loops to make multiple
+    :type indices: list
+    :arg fix_loops: If this is enabled polylines that use loops to make multiple
        polylines are delt with correctly.
+    :type fix_loops: bool
     """
 
     from mathutils.geometry import tessellate_polygon
@@ -436,7 +438,7 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
             if s1[0][1] == s1[-1][1]:  # remove endpoints double
                 s1.pop()
 
-            s2[:] = []  # Empty this segment s2 so we don't use it again.
+            del s2[:]  # Empty this segment s2 so we don't use it again.
             return True
 
         joining_segments = True
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index b1de1fd..46731b8 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -187,3 +187,16 @@ class AddObjectHelper:
             name="Rotation",
             subtype='EULER',
             )
+
+
+def object_add_grid_scale(context):
+    """
+    Return scale which should be applied on object data to align it to grid scale
+    """
+
+    space_data = context.space_data
+
+    if space_data and space_data.type == 'VIEW_3D':
+        return space_data.grid_scale_unit
+
+    return 1.0
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 4cd823d..e42ae43 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -394,7 +394,7 @@ class Mesh(bpy_types.ID):
             p.vertices = f
             loop_index += loop_len
 
-        # if no edges - calculae them
+        # if no edges - calculate them
         if faces and (not edges):
             self.update(calc_edges=True)
 
diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index 18d448b..60dfa2b 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -294,8 +294,8 @@ def copy_as_script(context):
     sc = context.space_data
     lines = [
         "import bpy",
-        "import bpy.context as C",
-        "import bpy.data as D",
+        "from bpy import data as D",
+        "from bpy import context as C",
         "from mathutils import *",
         "from math import *",
         "",
diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py
index fc8e312..e21ccd0 100644
--- a/release/scripts/modules/rna_xml.py
+++ b/release/scripts/modules/rna_xml.py
@@ -178,7 +178,7 @@ def rna2xml(fw=print_ln,
         fw("%s</%s>\n" % (ident, value_type_name))
 
     # -------------------------------------------------------------------------
-    # needs re-workign to be generic
+    # needs re-working to be generic
 
     if root_node:
         fw("%s<%s>\n" % (root_ident, root_node))
diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml
index 805aa9b..0a77aa1 100644
--- a/release/scripts/presets/interface_theme/back_to_black.xml
+++ b/release/scripts/presets/interface_theme/back_to_black.xml
@@ -1,849 +1,852 @@
 <bpy>
   <Theme>
+    <user_interface>
+      <ThemeUserInterface icon_file=""
+                          icon_alpha="1"
+                          axis_x="#dc0000"
+                          axis_y="#00dc00"
+                          axis_z="#0000dc">
+        <wcol_regular>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_tool>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_tool>
+        <wcol_radio>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_text>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#e4e4e4"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_option>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#000000ff"
+                             text="#c7c7c7"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <wcol_toggle>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_num>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#2a2a2aff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_numslider>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#111111ff"
+                             item="#33406bff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_box>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_menu>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#2a2a2aff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_pulldown>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_menu_back>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_tooltip>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#191919e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#ffffff"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
+        <wcol_menu_item>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_scroll>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_progress>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_list_item>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#111111ff"
+                             inner_sel="#33406bff"
+                             item="#191919ff"
+                             text="#929292"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-100"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#56ff00"
+                                  inner_anim_sel="#56ff00"
+                                  inner_key="#fff400"
+                                  inner_key_sel="#fff400"
+                                  inner_driven="#b400ff"
+                                  inner_driven_sel="#9900e6"
+                                  blend="0.1">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <panel>
+          <ThemePanelColors header="#000000ff"
+                            show_header="FALSE">
+          </ThemePanelColors>
+        </panel>
+      </ThemeUserInterface>
+    </user_interface>
     <view_3d>
-      <ThemeView3D object_active="#ff8c19"
-                   editmesh_active="#ff020080"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_pose_active="#8cffff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
+      <ThemeView3D grid="#222222"
+                   panel="#a5a5a57f"
+                   wire="#888888"
+                   lamp="#c1d40028"
+                   speaker="#535353"
                    camera="#000000"
-                   camera_path="#5a5a5a"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#ffedf8"
-                   edge_seam="#db2512"
+                   empty="#000000"
+                   object_selected="#f15800"
+                   object_active="#ff8c19"
+                   object_grouped="#083008"
+                   object_grouped_active="#55bb55"
+                   transform="#ffffff"
+                   vertex="#72cfdd"
+                   vertex_select="#ff8500"
+                   vertex_size="3"
                    edge_select="#ffa000"
+                   edge_seam="#db2512"
                    edge_sharp="#ff2020"
+                   edge_crease="#cc0099"
                    edge_facesel="#6b6b6b"
-                   empty="#000000"
                    face="#73828f12"
-                   extra_face_angle="#00c900"
-                   extra_face_area="#fff000"
+                   face_select="#ffa4003c"
                    face_dot="#ffa900"
                    facedot_size="4"
-                   normal="#22dddd"
-                   face_select="#ffa4003c"
-                   handle_free="#7f7f7f"
-                   handle_sel_free="#3b3b3b"
-                   grid="#222222"
-                   lamp="#c1d40028"
-                   lastsel_point="#ffffff"
                    nurb_uline="#909000"
                    nurb_vline="#803060"
                    nurb_sel_uline="#f0ff40"
                    nurb_sel_vline="#f090a0"
-                   object_grouped="#083008"
-                   object_grouped_active="#55bb55"
-                   object_selected="#f15800"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   skin_root="#000000"
-                   speaker="#535353"
-                   transform="#ffffff"
+                   act_spline="#db2512"
+                   handle_free="#7f7f7f"
+                   handle_auto="#909000"
                    handle_vect="#409030"
+                   handle_align="#803060"
+                   handle_sel_free="#3b3b3b"
+                   handle_sel_auto="#f0ff40"
                    handle_sel_vect="#40c030"
-                   vertex="#72cfdd"
+                   handle_sel_align="#f090a0"
+                   lastsel_point="#ffffff"
+                   extra_edge_len="#ffedf8"
+                   extra_face_angle="#00c900"
+                   extra_face_area="#fff000"
+                   editmesh_active="#ff020080"
+                   normal="#22dddd"
                    vertex_normal="#2361dd"
-                   vertex_select="#ff8500"
-                   vertex_size="3"
-                   wire="#888888">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#0f0f0f">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeView3D>
-    </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#1b501b"
-                       disabled_marker="#7f0000"
-                       grid="#5e5e5e"
-                       handle_vertex="#e2e2e2"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#7f7f00"
-                       marker_outline="#0094af"
-                       path_after="#0000ff"
-                       path_before="#ff0000"
-                       selected_marker="#ffff00"
-                       strips="#0c0a0a"
-                       strips_selected="#ff8c00">
+                   bone_solid="#c8c8c8"
+                   bone_pose="#50c8ff"
+                   bone_pose_active="#8cffff"
+                   frame_current="#60c040"
+                   outline_width="1"
+                   bundle_solid="#c8c8c8"
+                   camera_path="#5a5a5a"
+                   skin_root="#000000">
         <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#070707"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#ffffff"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#0f0f0f"
                              title="#5d5d5d"
-                             back="#0d0d0d">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#cecece"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
                              text="#7d7d7d"
                              text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#0f0f0f">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#87b17d"
-                      channel_group="#4f6549"
-                      channels="#707070"
-                      channels_selected="#60c040"
-                      frame_current="#2a5c1c"
-                      dopesheet_channel="#52606e"
-                      dopesheet_subchannel="#7c8996"
-                      grid="#212121"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      summary="#00000000"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#080808">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#020202"
-                                 list_text="#ebebeb"
-                                 list_text_hi="#ffffff"
-                                 list_title="#2c2c2c">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
-    <file_browser>
-      <ThemeFileBrowser active_file="#b1b1b1"
-                        active_file_text="#ffffff"
-                        scroll_handle="#7f7070"
-                        scrollbar="#a0a0a0"
-                        selected_file="#354d66"
-                        tiles="#343434">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#000000"
                              button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#000000">
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#181818"
-                                 list_text="#5d5d5d"
-                                 list_text_hi="#ffffff"
-                                 list_title="#9e9e9e">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeFileBrowser>
-    </file_browser>
+      </ThemeView3D>
+    </view_3d>
     <graph_editor>
-      <ThemeGraphEditor active_channels_group="#87b17d"
-                        handle_align="#803060"
-                        handle_sel_align="#f090a0"
-                        handle_auto="#909000"
-                        handle_sel_auto="#f0ff40"
-                        handle_auto_clamped="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#6d6d6d"
-                        frame_current="#336622"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#808080"
-                        handle_sel_free="#808080"
-                        grid="#262626"
-                        handle_vertex="#808080"
-                        handle_vertex_select="#ff8500"
-                        handle_vertex_size="3"
-                        lastsel_point="#808080"
+      <ThemeGraphEditor grid="#262626"
                         panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
+                        window_sliders="#969696"
+                        channels_region="#6d6d6d"
                         vertex="#ffffff"
                         vertex_select="#ff8500"
                         vertex_size="3"
-                        window_sliders="#969696">
+                        handle_free="#808080"
+                        handle_auto="#909000"
+                        handle_vect="#409030"
+                        handle_align="#803060"
+                        handle_sel_free="#808080"
+                        handle_sel_auto="#f0ff40"
+                        handle_sel_vect="#40c030"
+                        handle_sel_align="#f090a0"
+                        handle_auto_clamped="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        lastsel_point="#808080"
+                        frame_current="#336622"
+                        handle_vertex="#808080"
+                        handle_vertex_select="#ff8500"
+                        handle_vertex_size="3"
+                        channel_group="#4f6549"
+                        active_channels_group="#87b17d"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996">
         <space>
-          <ThemeSpaceGeneric header="#000000"
+          <ThemeSpaceGeneric back="#0d0d0d"
+                             title="#5d5d5d"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#0d0d0d">
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#1a1a1a"
+                                 list_title="#000000"
                                  list_text="#bbbbbb"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeGraphEditor>
     </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#ffffff0a"
-                        face_dot="#ff8500"
-                        facedot_size="3"
-                        face_select="#ff85003c"
-                        scope_back="#050505ff"
-                        preview_stitch_active="#e1d2c323"
-                        preview_stitch_edge="#ff8500b2"
-                        preview_stitch_face="#1242b026"
-                        preview_stitch_stitchable="#00ff00ff"
-                        preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#ff85007f"
-                        vertex="#0f13bb"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
+    <file_browser>
+      <ThemeFileBrowser selected_file="#354d66"
+                        tiles="#343434"
+                        scrollbar="#a0a0a0"
+                        scroll_handle="#7f7070"
+                        active_file="#b1b1b1"
+                        active_file_text="#ffffff">
         <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#000000"
                              title="#5d5d5d"
-                             back="#000000">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo>
-        <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#adadad"
-                             header_text_hi="#ffffff"
-                             button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#9b9b9b"
+                             text="#7d7d7d"
                              text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#000000">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#070707">
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeLogicEditor>
-    </logic_editor>
+        <space_list>
+          <ThemeSpaceListGeneric list="#181818"
+                                 list_title="#9e9e9e"
+                                 list_text="#5d5d5d"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeFileBrowser>
+    </file_browser>
     <nla_editor>
-      <ThemeNLAEditor active_action="#00000000"
-                      frame_current="#2f6421"
-                      grid="#5e5e5e"
-                      meta_strips="#000000"
-                      meta_strips_selected="#000000"
+      <ThemeNLAEditor grid="#5e5e5e"
+                      view_sliders="#969696"
+                      active_action="#00000000"
                       active_action_unset="#00000000"
-                      sound_strips="#000000"
-                      sound_strips_selected="#000000"
                       strips="#aa8d8d"
                       strips_selected="#ff8c00"
                       transition_strips="#000000"
                       transition_strips_selected="#000000"
+                      meta_strips="#000000"
+                      meta_strips_selected="#000000"
+                      sound_strips="#000000"
+                      sound_strips_selected="#000000"
                       tweak="#000000"
                       tweak_duplicate="#000000"
-                      view_sliders="#969696">
+                      frame_current="#2f6421">
         <space>
-          <ThemeSpaceGeneric header="#000000"
+          <ThemeSpaceGeneric back="#0d0d0d"
+                             title="#585858"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c3c3c3"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#585858"
-                             back="#0d0d0d">
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#0c0c0c"
+                                 list_title="#383838"
                                  list_text="#d8d8d8"
-                                 list_text_hi="#ffffff"
-                                 list_title="#383838">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeNLAEditor>
     </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor node_active="#ffffff"
-                       converter_node="#113941"
-                       frame_node="#9a9b9ba0"
-                       group_node="#091a07"
-                       in_out_node="#273053"
-                       node_backdrop="#202030bc"
-                       node_selected="#ffffff"
-                       noodle_curving="5"
-                       operator_node="#0e3157"
-                       selected_text="#7f7070"
-                       wire_select="#0019ff"
-                       wire="#6eafff">
+    <dopesheet_editor>
+      <ThemeDopeSheet grid="#212121"
+                      value_sliders="#000000"
+                      view_sliders="#969696"
+                      channels="#707070"
+                      channels_selected="#60c040"
+                      channel_group="#4f6549"
+                      active_channels_group="#87b17d"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      frame_current="#2a5c1c"
+                      dopesheet_channel="#52606e"
+                      dopesheet_subchannel="#7c8996"
+                      summary="#00000000">
         <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#c7c7c7"
+          <ThemeSpaceGeneric back="#080808"
+                             title="#5d5d5d"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#000000">
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
-                                 list_text="#ffffff"
-                                 list_text_hi="#b8ffff"
-                                 list_title="#ffffff">
+          <ThemeSpaceListGeneric list="#020202"
+                                 list_title="#2c2c2c"
+                                 list_text="#ebebeb"
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner match="#245824"
-                     selected_highlight="#212844">
+      </ThemeDopeSheet>
+    </dopesheet_editor>
+    <image_editor>
+      <ThemeImageEditor vertex="#0f13bb"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        face="#ffffff0a"
+                        face_select="#ff85003c"
+                        face_dot="#ff8500"
+                        facedot_size="3"
+                        editmesh_active="#ffffff80"
+                        scope_back="#050505ff"
+                        preview_stitch_face="#1242b026"
+                        preview_stitch_edge="#ff8500b2"
+                        preview_stitch_vert="#ff85007f"
+                        preview_stitch_stitchable="#00ff00ff"
+                        preview_stitch_unstitchable="#ff0000ff"
+                        preview_stitch_active="#e1d2c323">
         <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#979797"
-                             header_text_hi="#ffffff"
-                             button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
-                             button_title="#c5c5c5"
-                             text="#cccccc"
+          <ThemeSpaceGeneric back="#000000"
+                             title="#5d5d5d"
+                             text="#7d7d7d"
                              text_hi="#ffffff"
-                             title="#9b9b9b"
-                             back="#070707">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#000000"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#7d7d7d"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#000000">
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeProperties>
-    </properties>
+      </ThemeImageEditor>
+    </image_editor>
     <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
+      <ThemeSequenceEditor grid="#282828"
+                           window_sliders="#a0a0a0"
+                           movie_strip="#516987"
                            movieclip_strip="#20208f"
-                           frame_current="#2f5f23"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#282828"
                            image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           preview_back="#000000"
                            scene_strip="#4e983e"
+                           audio_strip="#2e8f8f"
+                           effect_strip="#a9547c"
                            transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
+                           meta_strip="#6d9183"
+                           frame_current="#2f5f23"
+                           keyframe="#ff8500"
+                           draw_action="#50c8ff"
+                           preview_back="#000000">
         <space>
-          <ThemeSpaceGeneric header="#000000"
+          <ThemeSpaceGeneric back="#202020"
+                             title="#5d5d5d"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#000000"
                              header_text="#f3f3f3"
                              header_text_hi="#ffffff"
                              button="#020202"
-                             button_text="#dddddd"
-                             button_text_hi="#ffffff"
                              button_title="#bdbdbd"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#5d5d5d"
-                             back="#202020">
+                             button_text="#dddddd"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeSequenceEditor>
     </sequence_editor>
+    <properties>
+      <ThemeProperties panel="#828282">
+        <space>
+          <ThemeSpaceGeneric back="#000000"
+                             title="#5d5d5d"
+                             text="#7d7d7d"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeProperties>
+    </properties>
     <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       syntax_special="#969629"
-                       line_numbers_background="#191919"
+      <ThemeTextEditor line_numbers_background="#191919"
                        selected_text="#202020"
+                       cursor="#ff0000"
                        syntax_builtin="#cf3d99"
+                       syntax_special="#969629"
                        syntax_comment="#249d60"
-                       syntax_numbers="#3c68ff"
-                       syntax_string="#cc3535">
+                       syntax_string="#cc3535"
+                       syntax_numbers="#3c68ff">
+        <space>
+          <ThemeSpaceGeneric back="#050505"
+                             title="#9e9e9e"
+                             text="#ebebeb"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#b9b9b9"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#d8d8d8"
+                             button_text="#cccccc"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline grid="#272727"
+                     frame_current="#2e5820">
+        <space>
+          <ThemeSpaceGeneric back="#000000"
+                             title="#5d5d5d"
+                             text="#c7c7c7"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <node_editor>
+      <ThemeNodeEditor node_selected="#ffffff"
+                       node_active="#ffffff"
+                       wire="#6eafff"
+                       wire_select="#0019ff"
+                       selected_text="#7f7070"
+                       node_backdrop="#202030bc"
+                       in_out_node="#273053"
+                       converter_node="#113941"
+                       operator_node="#0e3157"
+                       group_node="#091a07"
+                       frame_node="#9a9b9ba0"
+                       noodle_curving="5">
+        <space>
+          <ThemeSpaceGeneric back="#000000"
+                             title="#5d5d5d"
+                             text="#7d7d7d"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#c7c7c7"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_title="#ffffff"
+                                 list_text="#ffffff"
+                                 list_text_hi="#b8ffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
         <space>
-          <ThemeSpaceGeneric header="#000000"
-                             header_text="#b9b9b9"
+          <ThemeSpaceGeneric back="#070707"
+                             title="#5d5d5d"
+                             text="#7d7d7d"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#cccccc"
-                             button_text_hi="#ffffff"
-                             button_title="#d8d8d8"
-                             text="#ebebeb"
-                             text_hi="#ffffff"
-                             title="#9e9e9e"
-                             back="#050505">
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#2e5820"
-                     grid="#272727">
+      </ThemeLogicEditor>
+    </logic_editor>
+    <outliner>
+      <ThemeOutliner match="#245824"
+                     selected_highlight="#212844">
         <space>
-          <ThemeSpaceGeneric header="#000000"
+          <ThemeSpaceGeneric back="#070707"
+                             title="#9b9b9b"
+                             text="#cccccc"
+                             text_hi="#ffffff"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
-                             text="#c7c7c7"
-                             text_hi="#ffffff"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric back="#000000"
                              title="#5d5d5d"
-                             back="#000000">
+                             text="#9b9b9b"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#adadad"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#2a2a2aff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#2a2a2aff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#000000ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#c7c7c7"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#000000ff"
-                            show_header="FALSE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#111111ff"
-                             item="#33406bff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#56ff00"
-                                  inner_anim_sel="#56ff00"
-                                  blend="0.1"
-                                  inner_driven="#b400ff"
-                                  inner_driven_sel="#9900e6"
-                                  inner_key="#fff400"
-                                  inner_key_sel="#fff400">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#e4e4e4"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#111111ff"
-                             inner_sel="#33406bff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="0"
-                             shadetop="-100"
-                             show_shaded="TRUE"
-                             text="#929292"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-        <wcol_tooltip>
-          <ThemeWidgetColors inner="#191919e6"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tooltip>
-      </ThemeUserInterface>
-    </user_interface>
+      </ThemeInfo>
+    </info>
     <user_preferences>
       <ThemeUserPreferences>
         <space>
-          <ThemeSpaceGeneric header="#000000"
+          <ThemeSpaceGeneric back="#000000"
+                             title="#5d5d5d"
+                             text="#7d7d7d"
+                             text_hi="#ffffff"
+                             header="#000000"
                              header_text="#979797"
                              header_text_hi="#ffffff"
                              button="#000000"
-                             button_text="#c3c3c3"
-                             button_text_hi="#ffffff"
                              button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <console>
+      <ThemeConsole line_output="#6080ff"
+                    line_input="#cecece"
+                    line_info="#00aa00"
+                    line_error="#dc6060"
+                    cursor="#dc6060">
+        <space>
+          <ThemeSpaceGeneric back="#0f0f0f"
+                             title="#5d5d5d"
                              text="#7d7d7d"
                              text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#000000"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeConsole>
+    </console>
+    <clip_editor>
+      <ThemeClipEditor marker_outline="#0094af"
+                       marker="#7f7f00"
+                       active_marker="#ffffff"
+                       selected_marker="#ffff00"
+                       disabled_marker="#7f0000"
+                       locked_marker="#7f7f7f"
+                       path_before="#ff0000"
+                       path_after="#0000ff"
+                       grid="#5e5e5e"
+                       frame_current="#1b501b"
+                       handle_vertex="#e2e2e2"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="4"
+                       strips="#0c0a0a"
+                       strips_selected="#ff8c00">
+        <space>
+          <ThemeSpaceGeneric back="#0d0d0d"
                              title="#5d5d5d"
-                             back="#000000">
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#070707"
+                             button_title="#c5c5c5"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeUserPreferences>
-    </user_preferences>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeClipEditor>
+    </clip_editor>
     <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
+      <ThemeBoneColorSet normal="#9a0000"
+                         select="#bd1111"
+                         active="#f70a0a"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
+      <ThemeBoneColorSet normal="#f74018"
+                         select="#f66913"
+                         active="#fa9900"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
+      <ThemeBoneColorSet normal="#1e9109"
+                         select="#59b70b"
+                         active="#83ef1d"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
+      <ThemeBoneColorSet normal="#0a3694"
+                         select="#3667df"
+                         active="#5ec1ef"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
+      <ThemeBoneColorSet normal="#a9294e"
+                         select="#c1416a"
+                         active="#f05d91"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
+      <ThemeBoneColorSet normal="#430c78"
+                         select="#543aa3"
+                         active="#8764d5"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
+      <ThemeBoneColorSet normal="#24785a"
+                         select="#3c9579"
+                         active="#6fb6ab"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
+      <ThemeBoneColorSet normal="#4b707c"
+                         select="#6a8691"
+                         active="#9bc2cd"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
+      <ThemeBoneColorSet normal="#f4c90c"
+                         select="#eec236"
+                         active="#f3ff00"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
+      <ThemeBoneColorSet normal="#1e2024"
+                         select="#484c56"
+                         active="#ffffff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
+      <ThemeBoneColorSet normal="#6f2f6a"
+                         select="#9845be"
+                         active="#d330d6"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
+      <ThemeBoneColorSet normal="#6c8e22"
+                         select="#7fb022"
+                         active="#bbef5b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
+      <ThemeBoneColorSet normal="#8d8d8d"
+                         select="#b0b0b0"
+                         active="#dedede"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
+      <ThemeBoneColorSet normal="#834326"
+                         select="#8b5811"
+                         active="#bd6a11"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
+      <ThemeBoneColorSet normal="#08310e"
+                         select="#1c430b"
+                         active="#34622b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
     </bone_color_sets>
   </Theme>
diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml
index 232276e..18ae307 100644
--- a/release/scripts/presets/interface_theme/blender_24x.xml
+++ b/release/scripts/presets/interface_theme/blender_24x.xml
@@ -1,849 +1,852 @@
 <bpy>
   <Theme>
+    <user_interface>
+      <ThemeUserInterface icon_file=""
+                          icon_alpha="1"
+                          axis_x="#dc0000"
+                          axis_y="#00dc00"
+                          axis_z="#0000dc">
+        <wcol_regular>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_tool>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#c6bab0ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_tool>
+        <wcol_radio>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#d0d0d0ff"
+                             inner_sel="#667677ff"
+                             item="#ffffffff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_text>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#aea8b2ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="10">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_option>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#aababbff"
+                             inner_sel="#667677ff"
+                             item="#ffffffff"
+                             text="#000000"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <wcol_toggle>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#d0d0d0ff"
+                             inner_sel="#7d7d7dff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="15"
+                             shadedown="-15">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_num>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#a1a1a1a4"
+                             inner_sel="#999999ff"
+                             item="#585858ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_numslider>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#808080ff"
+                             inner_sel="#999999ff"
+                             item="#d2d2d2ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-20"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_box>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#d4d4d4ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_menu>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#d0d0d0ff"
+                             inner_sel="#464646ff"
+                             item="#717171ff"
+                             text="#000000"
+                             text_sel="#cccccc"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_pulldown>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3f3f3fff"
+                             inner_sel="#7f7f7fff"
+                             item="#ffffffff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="15"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_menu_back>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#d2d2d2ff"
+                             inner_sel="#999999ff"
+                             item="#646464ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="-25"
+                             shadedown="25">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_tooltip>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#ffffddff"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
+        <wcol_menu_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#7f7f7fff"
+                             item="#ffffffff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_scroll>
+          <ThemeWidgetColors outline="#262626"
+                             inner="#b4b4b42e"
+                             inner_sel="#646464b4"
+                             item="#b4b4b4ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_progress>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#bebebeff"
+                             inner_sel="#646464b4"
+                             item="#444444ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_list_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#7f7f7fff"
+                             item="#000000ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#73be4c"
+                                  inner_anim_sel="#5aa633"
+                                  inner_key="#f0eb64"
+                                  inner_key_sel="#d7d34b"
+                                  inner_driven="#b400ff"
+                                  inner_driven_sel="#9900e6"
+                                  blend="0.5">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <panel>
+          <ThemePanelColors header="#00000019"
+                            show_header="FALSE">
+          </ThemePanelColors>
+        </panel>
+      </ThemeUserInterface>
+    </user_interface>
     <view_3d>
-      <ThemeView3D object_active="#ffbbff"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_pose_active="#8cffff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
+      <ThemeView3D grid="#5c5c5c"
+                   panel="#a5a5a5ff"
+                   wire="#000000"
+                   lamp="#00000028"
+                   speaker="#000000"
                    camera="#000000"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#e69632"
+                   empty="#000000"
+                   object_selected="#ff88ff"
+                   object_active="#ffbbff"
+                   object_grouped="#104010"
+                   object_grouped_active="#55bb55"
+                   transform="#ffffff"
+                   vertex="#ff70ff"
+                   vertex_select="#ffff70"
+                   vertex_size="2"
                    edge_select="#cece38"
+                   edge_seam="#e69632"
                    edge_sharp="#ff2020"
+                   edge_crease="#cc0099"
                    edge_facesel="#4b4b4b"
-                   empty="#000000"
                    face="#0032961e"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
+                   face_select="#c864c83c"
                    face_dot="#ff8a30"
                    facedot_size="4"
-                   normal="#22dddd"
-                   face_select="#c864c83c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#5c5c5c"
-                   lamp="#00000028"
-                   lastsel_point="#ffffff"
                    nurb_uline="#909000"
                    nurb_vline="#803060"
                    nurb_sel_uline="#f0ff40"
                    nurb_sel_vline="#f090a0"
-                   object_grouped="#104010"
-                   object_grouped_active="#55bb55"
-                   object_selected="#ff88ff"
-                   outline_width="1"
-                   panel="#a5a5a5ff"
-                   skin_root="#000000"
-                   speaker="#000000"
-                   transform="#ffffff"
+                   act_spline="#db2512"
+                   handle_free="#000000"
+                   handle_auto="#909000"
                    handle_vect="#409030"
+                   handle_align="#803060"
+                   handle_sel_free="#000000"
+                   handle_sel_auto="#f0ff40"
                    handle_sel_vect="#40c030"
-                   vertex="#ff70ff"
+                   handle_sel_align="#f090a0"
+                   lastsel_point="#ffffff"
+                   extra_edge_len="#200000"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   editmesh_active="#ffffff80"
+                   normal="#22dddd"
                    vertex_normal="#2361dd"
-                   vertex_select="#ffff70"
-                   vertex_size="2"
-                   wire="#000000">
+                   bone_solid="#c8c8c8"
+                   bone_pose="#50c8ff"
+                   bone_pose_active="#8cffff"
+                   frame_current="#60c040"
+                   outline_width="1"
+                   bundle_solid="#c8c8c8"
+                   camera_path="#000000"
+                   skin_root="#000000">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#b4b4b4"
-                             button_text="#5a5a5a"
-                             button_text_hi="#ffffff"
-                             button_title="#5a5a5a"
-                             text="#000000"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#757575"
                              title="#000000"
-                             back="#757575">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeView3D>
-    </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#60c040"
-                       disabled_marker="#7f0000"
-                       grid="#5e5e5e"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#7f7f00"
-                       marker_outline="#000000"
-                       path_after="#0000ff"
-                       path_before="#ff0000"
-                       selected_marker="#ffff00"
-                       strips="#0c0a0a"
-                       strips_selected="#ff8c00">
-        <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#757575">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#b4b4b4">
+                             button_title="#5a5a5a"
+                             button_text="#5a5a5a"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#87b17d"
-                      channel_group="#4f6549"
-                      channels="#707070"
-                      channels_selected="#60c040"
-                      frame_current="#60c040"
-                      dopesheet_channel="#52606e"
-                      dopesheet_subchannel="#7c8996"
-                      grid="#858585"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      summary="#00000000"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
+      </ThemeView3D>
+    </view_3d>
+    <graph_editor>
+      <ThemeGraphEditor grid="#818181"
+                        panel="#ffffff"
+                        window_sliders="#969696"
+                        channels_region="#707070"
+                        vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        handle_free="#000000"
+                        handle_auto="#909000"
+                        handle_vect="#409030"
+                        handle_align="#803060"
+                        handle_sel_free="#000000"
+                        handle_sel_auto="#f0ff40"
+                        handle_sel_vect="#40c030"
+                        handle_sel_align="#f090a0"
+                        handle_auto_clamped="#000000"
+                        handle_sel_auto_clamped="#000000"
+                        lastsel_point="#ffffff"
+                        frame_current="#60c040"
+                        handle_vertex="#000000"
+                        handle_vertex_select="#ff8500"
+                        handle_vertex_size="3"
+                        channel_group="#4f6549"
+                        active_channels_group="#87b17d"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#979797"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
+                             button="#727272"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#a0a0a0">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
+      </ThemeGraphEditor>
+    </graph_editor>
     <file_browser>
-      <ThemeFileBrowser active_file="#828282"
-                        active_file_text="#ffffff"
-                        scroll_handle="#7f7070"
+      <ThemeFileBrowser selected_file="#a0a0d0"
+                        tiles="#b4b4b4"
                         scrollbar="#a0a0a0"
-                        selected_file="#a0a0d0"
-                        tiles="#b4b4b4">
+                        scroll_handle="#7f7070"
+                        active_file="#828282"
+                        active_file_text="#ffffff">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#808080"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#0f0f0f"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#808080">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeFileBrowser>
     </file_browser>
-    <graph_editor>
-      <ThemeGraphEditor active_channels_group="#87b17d"
-                        handle_align="#803060"
-                        handle_sel_align="#f090a0"
-                        handle_auto="#909000"
-                        handle_sel_auto="#f0ff40"
-                        handle_auto_clamped="#000000"
-                        handle_sel_auto_clamped="#000000"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#818181"
-                        handle_vertex="#000000"
-                        handle_vertex_select="#ff8500"
-                        handle_vertex_size="3"
-                        lastsel_point="#ffffff"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3"
-                        window_sliders="#969696">
+    <nla_editor>
+      <ThemeNLAEditor grid="#5e5e5e"
+                      view_sliders="#969696"
+                      active_action="#00000000"
+                      active_action_unset="#00000000"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      transition_strips="#000000"
+                      transition_strips_selected="#000000"
+                      meta_strips="#000000"
+                      meta_strips_selected="#000000"
+                      sound_strips="#000000"
+                      sound_strips_selected="#000000"
+                      tweak="#000000"
+                      tweak_duplicate="#000000"
+                      frame_current="#60c040">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#757575"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
+                             button="#b4b4b4"
                              button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <dopesheet_editor>
+      <ThemeDopeSheet grid="#858585"
+                      value_sliders="#000000"
+                      view_sliders="#969696"
+                      channels="#707070"
+                      channels_selected="#60c040"
+                      channel_group="#4f6549"
+                      active_channels_group="#87b17d"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      frame_current="#60c040"
+                      dopesheet_channel="#52606e"
+                      dopesheet_subchannel="#7c8996"
+                      summary="#00000000">
+        <space>
+          <ThemeSpaceGeneric back="#a0a0a0"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#979797">
+                             header="#b4b4b4"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#b4b4b4"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
     <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
+      <ThemeImageEditor vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
                         face="#ffffff0a"
+                        face_select="#ff85003c"
                         face_dot="#ff8500"
                         facedot_size="3"
-                        face_select="#ff85003c"
+                        editmesh_active="#ffffff80"
                         scope_back="#b4b4b4ff"
-                        preview_stitch_active="#e1d2c323"
-                        preview_stitch_edge="#ff8500b2"
                         preview_stitch_face="#1242b026"
+                        preview_stitch_edge="#ff8500b2"
+                        preview_stitch_vert="#ff85007f"
                         preview_stitch_stitchable="#00ff00ff"
                         preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#ff85007f"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
+                        preview_stitch_active="#e1d2c323">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#353535"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#353535">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeImageEditor>
     </image_editor>
-    <info>
-      <ThemeInfo>
+    <sequence_editor>
+      <ThemeSequenceEditor grid="#404040"
+                           window_sliders="#a0a0a0"
+                           movie_strip="#516987"
+                           movieclip_strip="#20208f"
+                           image_strip="#6d5881"
+                           scene_strip="#4e983e"
+                           audio_strip="#2e8f8f"
+                           effect_strip="#a9547c"
+                           transition_strip="#a25f6f"
+                           meta_strip="#6d9183"
+                           frame_current="#60c040"
+                           keyframe="#ff8500"
+                           draw_action="#50c8ff"
+                           preview_back="#000000">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#949494"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#b4b4b4">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <properties>
+      <ThemeProperties panel="#828282">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#b4b4b4"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#b4b4b4">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor active_action="#00000000"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      meta_strips="#000000"
-                      meta_strips_selected="#000000"
-                      active_action_unset="#00000000"
-                      sound_strips="#000000"
-                      sound_strips_selected="#000000"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      transition_strips="#000000"
-                      transition_strips_selected="#000000"
-                      tweak="#000000"
-                      tweak_duplicate="#000000"
-                      view_sliders="#969696">
+      </ThemeProperties>
+    </properties>
+    <text_editor>
+      <ThemeTextEditor line_numbers_background="#818181"
+                       selected_text="#c67777"
+                       cursor="#ff0000"
+                       syntax_builtin="#800050"
+                       syntax_special="#5f5f00"
+                       syntax_comment="#006432"
+                       syntax_string="#640000"
+                       syntax_numbers="#0000c8">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#999999"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline grid="#5b5b5b"
+                     frame_current="#60c040">
+        <space>
+          <ThemeSpaceGeneric back="#999999"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#757575">
+                             header="#b4b4b4"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#b4b4b4"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#b4b4b4"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
+      </ThemeTimeline>
+    </timeline>
     <node_editor>
-      <ThemeNodeEditor node_active="#ffffff"
-                       converter_node="#686a75"
-                       frame_node="#9a9b9ba0"
-                       group_node="#69756e"
-                       in_out_node="#646464"
+      <ThemeNodeEditor node_selected="#ffffff"
+                       node_active="#ffffff"
+                       wire="#000000"
+                       wire_select="#ffffff"
+                       selected_text="#7f7070"
                        node_backdrop="#9b9b9ba0"
-                       node_selected="#ffffff"
-                       noodle_curving="5"
+                       in_out_node="#646464"
+                       converter_node="#686a75"
                        operator_node="#6c696f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
+                       group_node="#69756e"
+                       frame_node="#9a9b9ba0"
+                       noodle_curving="5">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#757575"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#757575">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeNodeEditor>
     </node_editor>
-    <outliner>
-      <ThemeOutliner match="#337f33"
-                     selected_highlight="#82878c">
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#b4b4b4"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
+      </ThemeLogicEditor>
+    </logic_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#999999"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#b4b4b4">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           movieclip_strip="#20208f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           preview_back="#000000"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
+      </ThemeOutliner>
+    </outliner>
+    <info>
+      <ThemeInfo>
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#b4b4b4"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#949494">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       syntax_special="#5f5f00"
-                       line_numbers_background="#818181"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_string="#640000">
+      </ThemeInfo>
+    </info>
+    <user_preferences>
+      <ThemeUserPreferences>
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#999999"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#5b5b5b">
+      </ThemeUserPreferences>
+    </user_preferences>
+    <console>
+      <ThemeConsole line_output="#000000"
+                    line_input="#ffffff"
+                    line_info="#00aa00"
+                    line_error="#dc6060"
+                    cursor="#dc6060">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#b4b4b4"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#d4d4d4ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#262626"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#7f7f7fff"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#d2d2d2ff"
-                             inner_sel="#999999ff"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="25"
-                             shadetop="-25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#7f7f7fff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#d0d0d0ff"
-                             inner_sel="#464646ff"
-                             item="#717171ff"
-                             outline="#262626"
-                             shadedown="-10"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#a1a1a1a4"
-                             inner_sel="#999999ff"
-                             item="#585858ff"
-                             outline="#262626"
-                             shadedown="0"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#aababbff"
-                             inner_sel="#667677ff"
-                             item="#ffffffff"
-                             outline="#262626"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000019"
-                            show_header="FALSE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#bebebeff"
-                             inner_sel="#646464b4"
-                             item="#444444ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#7f7f7fff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-10"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#d0d0d0ff"
-                             inner_sel="#667677ff"
-                             item="#ffffffff"
-                             outline="#262626"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#262626"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#b4b4b42e"
-                             inner_sel="#646464b4"
-                             item="#b4b4b4ff"
-                             outline="#262626"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#808080ff"
-                             inner_sel="#999999ff"
-                             item="#d2d2d2ff"
-                             outline="#262626"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#73be4c"
-                                  inner_anim_sel="#5aa633"
-                                  blend="0.5"
-                                  inner_driven="#b400ff"
-                                  inner_driven_sel="#9900e6"
-                                  inner_key="#f0eb64"
-                                  inner_key_sel="#d7d34b">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#aea8b2ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#262626"
-                             shadedown="10"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#d0d0d0ff"
-                             inner_sel="#7d7d7dff"
-                             item="#191919ff"
-                             outline="#262626"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#c6bab0ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#262626"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-        <wcol_tooltip>
-          <ThemeWidgetColors inner="#ffffddff"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tooltip>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences>
+      </ThemeConsole>
+    </console>
+    <clip_editor>
+      <ThemeClipEditor marker_outline="#000000"
+                       marker="#7f7f00"
+                       active_marker="#ffffff"
+                       selected_marker="#ffff00"
+                       disabled_marker="#7f0000"
+                       locked_marker="#7f7f7f"
+                       path_before="#ff0000"
+                       path_after="#0000ff"
+                       grid="#5e5e5e"
+                       frame_current="#60c040"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="4"
+                       strips="#0c0a0a"
+                       strips_selected="#ff8c00">
         <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
+          <ThemeSpaceGeneric back="#757575"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#b4b4b4"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeUserPreferences>
-    </user_preferences>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeClipEditor>
+    </clip_editor>
     <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
+      <ThemeBoneColorSet normal="#9a0000"
+                         select="#bd1111"
+                         active="#f70a0a"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
+      <ThemeBoneColorSet normal="#f74018"
+                         select="#f66913"
+                         active="#fa9900"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
+      <ThemeBoneColorSet normal="#1e9109"
+                         select="#59b70b"
+                         active="#83ef1d"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
+      <ThemeBoneColorSet normal="#0a3694"
+                         select="#3667df"
+                         active="#5ec1ef"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
+      <ThemeBoneColorSet normal="#a9294e"
+                         select="#c1416a"
+                         active="#f05d91"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
+      <ThemeBoneColorSet normal="#430c78"
+                         select="#543aa3"
+                         active="#8764d5"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
+      <ThemeBoneColorSet normal="#24785a"
+                         select="#3c9579"
+                         active="#6fb6ab"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
+      <ThemeBoneColorSet normal="#4b707c"
+                         select="#6a8691"
+                         active="#9bc2cd"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
+      <ThemeBoneColorSet normal="#f4c90c"
+                         select="#eec236"
+                         active="#f3ff00"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
+      <ThemeBoneColorSet normal="#1e2024"
+                         select="#484c56"
+                         active="#ffffff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
+      <ThemeBoneColorSet normal="#6f2f6a"
+                         select="#9845be"
+                         active="#d330d6"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
+      <ThemeBoneColorSet normal="#6c8e22"
+                         select="#7fb022"
+                         active="#bbef5b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
+      <ThemeBoneColorSet normal="#8d8d8d"
+                         select="#b0b0b0"
+                         active="#dedede"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
+      <ThemeBoneColorSet normal="#834326"
+                         select="#8b5811"
+                         active="#bd6a11"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
+      <ThemeBoneColorSet normal="#08310e"
+                         select="#1c430b"
+                         active="#34622b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
     </bone_color_sets>
   </Theme>
diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml
index 581f5ce..c10eb10 100644
--- a/release/scripts/presets/interface_theme/elsyiun.xml
+++ b/release/scripts/presets/interface_theme/elsyiun.xml
@@ -1,849 +1,852 @@
 <bpy>
   <Theme>
+    <user_interface>
+      <ThemeUserInterface icon_file=""
+                          icon_alpha="1"
+                          axis_x="#dc0000"
+                          axis_y="#00dc00"
+                          axis_z="#0000dc">
+        <wcol_regular>
+          <ThemeWidgetColors outline="#191919"
+                             inner="#4e4e4eff"
+                             inner_sel="#b67e3eff"
+                             item="#191919ff"
+                             text="#b8b8b8"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_tool>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#414141ff"
+                             inner_sel="#b67e3eff"
+                             item="#191919ff"
+                             text="#b8b8b8"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_tool>
+        <wcol_radio>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#414141ff"
+                             inner_sel="#b67e3eff"
+                             item="#ffffffff"
+                             text="#b8b8b8"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_text>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#7a8287ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_option>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#4e4e4eff"
+                             inner_sel="#a9753aff"
+                             item="#ffffffff"
+                             text="#b8b8b8"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <wcol_toggle>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#555555ff"
+                             inner_sel="#796348ff"
+                             item="#191919ff"
+                             text="#b8b8b8"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_num>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#414141ff"
+                             inner_sel="#999999ff"
+                             item="#7a7a7aff"
+                             text="#b8b8b8"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_numslider>
+          <ThemeWidgetColors outline="#303030"
+                             inner="#606068ff"
+                             inner_sel="#91919dff"
+                             item="#4b4b4bff"
+                             text="#a2a2a2"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_box>
+          <ThemeWidgetColors outline="#2a2a2a"
+                             inner="#4b4b4bff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="-7">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_menu>
+          <ThemeWidgetColors outline="#2c2c2c"
+                             inner="#444444ff"
+                             inner_sel="#464646ff"
+                             item="#7a7a7aff"
+                             text="#b8b8b8"
+                             text_sel="#cccccc"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_pulldown>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3f3f3fff"
+                             inner_sel="#f78805ff"
+                             item="#ffffffff"
+                             text="#b8b8b8"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="25"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_menu_back>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3b3b3bff"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#b8b8b8"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_tooltip>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#191919e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#ffffff"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
+        <wcol_menu_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#b67e3eff"
+                             item="#ffffffff"
+                             text="#b8b8b8"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="20">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_scroll>
+          <ThemeWidgetColors outline="#2d2d2d"
+                             inner="#6c707200"
+                             inner_sel="#646464b4"
+                             item="#414141ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_progress>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#bebebeff"
+                             inner_sel="#646464b4"
+                             item="#444444ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_list_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#a9753777"
+                             item="#000000ff"
+                             text="#e0e0e0"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#339900"
+                                  inner_anim_sel="#2b8000"
+                                  inner_key="#999300"
+                                  inner_key_sel="#666200"
+                                  inner_driven="#b400ff"
+                                  inner_driven_sel="#9900e6"
+                                  blend="0.5">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <panel>
+          <ThemePanelColors header="#00000019"
+                            show_header="FALSE">
+          </ThemePanelColors>
+        </panel>
+      </ThemeUserInterface>
+    </user_interface>
     <view_3d>
-      <ThemeView3D object_active="#ffc280"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_pose_active="#8cffff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
+      <ThemeView3D grid="#585858"
+                   panel="#a5a5a57f"
+                   wire="#000000"
+                   lamp="#00000028"
+                   speaker="#000000"
                    camera="#000000"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#db2512"
+                   empty="#000000"
+                   object_selected="#ff8500"
+                   object_active="#ffc280"
+                   object_grouped="#083008"
+                   object_grouped_active="#55bb55"
+                   transform="#ffffff"
+                   vertex="#657780"
+                   vertex_select="#ff7c00"
+                   vertex_size="3"
                    edge_select="#cb7027"
+                   edge_seam="#db2512"
                    edge_sharp="#00ffff"
+                   edge_crease="#cc0099"
                    edge_facesel="#4b4b4b"
-                   empty="#000000"
                    face="#00000036"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
+                   face_select="#a47c5b73"
                    face_dot="#be6925"
                    facedot_size="3"
-                   normal="#22dddd"
-                   face_select="#a47c5b73"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#585858"
-                   lamp="#00000028"
-                   lastsel_point="#ffffff"
                    nurb_uline="#909000"
                    nurb_vline="#803060"
                    nurb_sel_uline="#f0ff40"
                    nurb_sel_vline="#f090a0"
-                   object_grouped="#083008"
-                   object_grouped_active="#55bb55"
-                   object_selected="#ff8500"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   skin_root="#000000"
-                   speaker="#000000"
-                   transform="#ffffff"
+                   act_spline="#db2512"
+                   handle_free="#000000"
+                   handle_auto="#909000"
                    handle_vect="#409030"
+                   handle_align="#803060"
+                   handle_sel_free="#000000"
+                   handle_sel_auto="#f0ff40"
                    handle_sel_vect="#40c030"
-                   vertex="#657780"
+                   handle_sel_align="#f090a0"
+                   lastsel_point="#ffffff"
+                   extra_edge_len="#200000"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   editmesh_active="#ffffff80"
+                   normal="#22dddd"
                    vertex_normal="#2361dd"
-                   vertex_select="#ff7c00"
-                   vertex_size="3"
-                   wire="#000000">
+                   bone_solid="#c8c8c8"
+                   bone_pose="#50c8ff"
+                   bone_pose_active="#8cffff"
+                   frame_current="#60c040"
+                   outline_width="1"
+                   bundle_solid="#c8c8c8"
+                   camera_path="#000000"
+                   skin_root="#000000">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#000000"
+                             text="#b8b8b8"
+                             text_hi="#e9e9e9"
+                             header="#3b3b3b"
                              header_text="#b9b9b9"
                              header_text_hi="#ffffff"
                              button="#3b3b3b"
-                             button_text="#979797"
-                             button_text_hi="#ffffff"
                              button_title="#979797"
-                             text="#b8b8b8"
-                             text_hi="#e9e9e9"
-                             title="#000000"
-                             back="#4b4b4b">
+                             button_text="#979797"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeView3D>
     </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#60c040"
-                       disabled_marker="#7f0000"
-                       grid="#5e5e5e"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#7f7f00"
-                       marker_outline="#000000"
-                       path_after="#0000ff"
-                       path_before="#ff0000"
-                       selected_marker="#ffff00"
-                       strips="#0c0a0a"
-                       strips_selected="#ff8c00">
-        <space>
-          <ThemeSpaceGeneric header="#313131"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#393939">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#b8b8b8">
-        <space>
-          <ThemeSpaceGeneric header="#303030"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#202020">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#87b17d"
-                      channel_group="#4f6549"
-                      channels="#707070"
-                      channels_selected="#60c040"
-                      frame_current="#60c040"
-                      dopesheet_channel="#52606e"
-                      dopesheet_subchannel="#7c8996"
-                      grid="#585858"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      summary="#00000000"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaaaaa"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#4b4b4b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#3b3b3b"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
-    <file_browser>
-      <ThemeFileBrowser active_file="#828282"
-                        active_file_text="#fafafa"
-                        scroll_handle="#7f7070"
-                        scrollbar="#a0a0a0"
-                        selected_file="#755129"
-                        tiles="#3b3b3b">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#8b8b8b"
-                             header_text_hi="#ffffff"
-                             button="#303030"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#cacaca"
-                             text_hi="#0f0f0f"
-                             title="#8b8b8b"
-                             back="#4b4b4b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#3b3b3b"
-                                 list_text="#8b8b8b"
-                                 list_text_hi="#ffffff"
-                                 list_title="#8b8b8b">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeFileBrowser>
-    </file_browser>
     <graph_editor>
-      <ThemeGraphEditor active_channels_group="#87b17d"
-                        handle_align="#803060"
-                        handle_sel_align="#f090a0"
+      <ThemeGraphEditor grid="#585858"
+                        panel="#ffffff"
+                        window_sliders="#969696"
+                        channels_region="#707070"
+                        vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        handle_free="#000000"
                         handle_auto="#909000"
+                        handle_vect="#409030"
+                        handle_align="#803060"
+                        handle_sel_free="#000000"
                         handle_sel_auto="#f0ff40"
+                        handle_sel_vect="#40c030"
+                        handle_sel_align="#f090a0"
                         handle_auto_clamped="#994030"
                         handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
+                        lastsel_point="#ffffff"
                         frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#545d66"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#585858"
                         handle_vertex="#000000"
                         handle_vertex_select="#ff8500"
                         handle_vertex_size="4"
-                        lastsel_point="#ffffff"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3"
-                        window_sliders="#969696">
+                        channel_group="#4f6549"
+                        active_channels_group="#87b17d"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#545d66">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#8b8b8b"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
                              button_title="#8b8b8b"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#4b4b4b">
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_title="#8b8b8b"
                                  list_text="#8b8b8b"
-                                 list_text_hi="#ffffff"
-                                 list_title="#8b8b8b">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeGraphEditor>
     </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#a47c5b0a"
-                        face_dot="#ffffff"
-                        facedot_size="3"
-                        face_select="#a47c5b3c"
-                        scope_back="#303030ff"
-                        preview_stitch_active="#e1d2c323"
-                        preview_stitch_edge="#ff8500b2"
-                        preview_stitch_face="#1242b026"
-                        preview_stitch_stitchable="#00ff00ff"
-                        preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#ff85007f"
-                        vertex="#32adec"
-                        vertex_select="#be6925"
-                        vertex_size="3">
+    <file_browser>
+      <ThemeFileBrowser selected_file="#755129"
+                        tiles="#3b3b3b"
+                        scrollbar="#a0a0a0"
+                        scroll_handle="#7f7070"
+                        active_file="#828282"
+                        active_file_text="#fafafa">
         <space>
-          <ThemeSpaceGeneric header="#303030"
-                             header_text="#000000"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#8b8b8b"
+                             text="#cacaca"
+                             text_hi="#0f0f0f"
+                             header="#3b3b3b"
+                             header_text="#8b8b8b"
                              header_text_hi="#ffffff"
                              button="#303030"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#8b8b8b"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#4b4b4b">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo>
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#000000"
-                             button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#000000"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#000000"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#3b3b3b">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#3b3b3b">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeLogicEditor>
-    </logic_editor>
+        <space_list>
+          <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_title="#8b8b8b"
+                                 list_text="#8b8b8b"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeFileBrowser>
+    </file_browser>
     <nla_editor>
-      <ThemeNLAEditor active_action="#00000000"
-                      frame_current="#60c040"
-                      grid="#585858"
-                      meta_strips="#000000"
-                      meta_strips_selected="#000000"
+      <ThemeNLAEditor grid="#585858"
+                      view_sliders="#969696"
+                      active_action="#00000000"
                       active_action_unset="#00000000"
-                      sound_strips="#000000"
-                      sound_strips_selected="#000000"
                       strips="#0c0a0a"
                       strips_selected="#ff8c00"
                       transition_strips="#000000"
                       transition_strips_selected="#000000"
+                      meta_strips="#000000"
+                      meta_strips_selected="#000000"
+                      sound_strips="#000000"
+                      sound_strips_selected="#000000"
                       tweak="#000000"
                       tweak_duplicate="#000000"
-                      view_sliders="#969696">
+                      frame_current="#60c040">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#8b8b8b"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#4b4b4b">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeNLAEditor>
     </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor node_active="#ffffff"
-                       converter_node="#575675"
-                       frame_node="#9a9b9ba0"
-                       group_node="#1e7524"
-                       in_out_node="#e08706"
-                       node_backdrop="#9b9b9ba0"
-                       node_selected="#ffffff"
-                       noodle_curving="5"
-                       operator_node="#2c6f6f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
+    <dopesheet_editor>
+      <ThemeDopeSheet grid="#585858"
+                      value_sliders="#000000"
+                      view_sliders="#969696"
+                      channels="#707070"
+                      channels_selected="#60c040"
+                      channel_group="#4f6549"
+                      active_channels_group="#87b17d"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      frame_current="#60c040"
+                      dopesheet_channel="#52606e"
+                      dopesheet_subchannel="#7c8996"
+                      summary="#00000000">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#000000"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#dbdbdb"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#3b3b3b">
+                             button="#aaaaaa"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
+          <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner match="#337f33"
-                     selected_highlight="#82878c">
+      </ThemeDopeSheet>
+    </dopesheet_editor>
+    <image_editor>
+      <ThemeImageEditor vertex="#32adec"
+                        vertex_select="#be6925"
+                        vertex_size="3"
+                        face="#a47c5b0a"
+                        face_select="#a47c5b3c"
+                        face_dot="#ffffff"
+                        facedot_size="3"
+                        editmesh_active="#ffffff80"
+                        scope_back="#303030ff"
+                        preview_stitch_face="#1242b026"
+                        preview_stitch_edge="#ff8500b2"
+                        preview_stitch_vert="#ff85007f"
+                        preview_stitch_stitchable="#00ff00ff"
+                        preview_stitch_unstitchable="#ff0000ff"
+                        preview_stitch_active="#e1d2c323">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#8b8b8b"
+                             text="#8b8b8b"
+                             text_hi="#ffffff"
+                             header="#303030"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#cacaca"
+                             button="#303030"
+                             button_title="#8b8b8b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <sequence_editor>
+      <ThemeSequenceEditor grid="#818181"
+                           window_sliders="#a0a0a0"
+                           movie_strip="#516987"
+                           movieclip_strip="#20208f"
+                           image_strip="#6d5881"
+                           scene_strip="#4e983e"
+                           audio_strip="#2e8f8f"
+                           effect_strip="#a9547c"
+                           transition_strip="#a25f6f"
+                           meta_strip="#6d9183"
+                           frame_current="#60c040"
+                           keyframe="#ff8500"
+                           draw_action="#50c8ff"
+                           preview_back="#000000">
+        <space>
+          <ThemeSpaceGeneric back="#636363"
+                             title="#8b8b8b"
+                             text="#ffffff"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#4b4b4b">
+                             header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeOutliner>
-    </outliner>
+      </ThemeSequenceEditor>
+    </sequence_editor>
     <properties>
       <ThemeProperties panel="#828282">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#3b3b3b"
+                             title="#979797"
+                             text="#b8b8b8"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#727272"
-                             button_text="#b8b8b8"
-                             button_text_hi="#ffffff"
                              button_title="#b8b8b8"
-                             text="#b8b8b8"
-                             text_hi="#ffffff"
-                             title="#979797"
-                             back="#3b3b3b">
+                             button_text="#b8b8b8"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeProperties>
     </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           movieclip_strip="#20208f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#818181"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           preview_back="#000000"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
+    <text_editor>
+      <ThemeTextEditor line_numbers_background="#2e2e2e"
+                       selected_text="#4e4e8f"
+                       cursor="#8b8bff"
+                       syntax_builtin="#808bed"
+                       syntax_special="#c080d0"
+                       syntax_comment="#cd8b00"
+                       syntax_string="#ffcd8b"
+                       syntax_numbers="#f0ad6d">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#1e1e27"
+                             title="#8b8b8b"
+                             text="#cfbfad"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#ffffff"
+                             button_title="#8b8b8b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline grid="#5b5b5b"
+                     frame_current="#60c040">
+        <space>
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#000000"
+                             text="#b8b8b8"
                              text_hi="#ffffff"
+                             header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <node_editor>
+      <ThemeNodeEditor node_selected="#ffffff"
+                       node_active="#ffffff"
+                       wire="#000000"
+                       wire_select="#ffffff"
+                       selected_text="#7f7070"
+                       node_backdrop="#9b9b9ba0"
+                       in_out_node="#e08706"
+                       converter_node="#575675"
+                       operator_node="#2c6f6f"
+                       group_node="#1e7524"
+                       frame_node="#9a9b9ba0"
+                       noodle_curving="5">
+        <space>
+          <ThemeSpaceGeneric back="#3b3b3b"
                              title="#8b8b8b"
-                             back="#636363">
+                             text="#dbdbdb"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_title="#8b8b8b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#8b8bff"
-                       syntax_special="#c080d0"
-                       line_numbers_background="#2e2e2e"
-                       selected_text="#4e4e8f"
-                       syntax_builtin="#808bed"
-                       syntax_comment="#cd8b00"
-                       syntax_numbers="#f0ad6d"
-                       syntax_string="#ffcd8b">
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <logic_editor>
+      <ThemeLogicEditor panel="#3b3b3b">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#3b3b3b"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
                              button_title="#8b8b8b"
-                             text="#cfbfad"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#1e1e27">
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#5b5b5b">
+      </ThemeLogicEditor>
+    </logic_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#4b4b4b"
+                             title="#000000"
+                             text="#cacaca"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#b8b8b8"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#4b4b4b">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#4b4b4bff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#2a2a2a"
-                             shadedown="-7"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#a9753777"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="-10"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#e0e0e0"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#3b3b3bff"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#b67e3eff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="20"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#444444ff"
-                             inner_sel="#464646ff"
-                             item="#7a7a7aff"
-                             outline="#2c2c2c"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#414141ff"
-                             inner_sel="#999999ff"
-                             item="#7a7a7aff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#4e4e4eff"
-                             inner_sel="#a9753aff"
-                             item="#ffffffff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000019"
-                            show_header="FALSE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#bebebeff"
-                             inner_sel="#646464b4"
-                             item="#444444ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#f78805ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="25"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#414141ff"
-                             inner_sel="#b67e3eff"
-                             item="#ffffffff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#4e4e4eff"
-                             inner_sel="#b67e3eff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#6c707200"
-                             inner_sel="#646464b4"
-                             item="#414141ff"
-                             outline="#2d2d2d"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#606068ff"
-                             inner_sel="#91919dff"
-                             item="#4b4b4bff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#a2a2a2"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#339900"
-                                  inner_anim_sel="#2b8000"
-                                  blend="0.5"
-                                  inner_driven="#b400ff"
-                                  inner_driven_sel="#9900e6"
-                                  inner_key="#999300"
-                                  inner_key_sel="#666200">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#7a8287ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
+      </ThemeOutliner>
+    </outliner>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric back="#727272"
+                             title="#000000"
                              text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#555555ff"
-                             inner_sel="#796348ff"
-                             item="#191919ff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#414141ff"
-                             inner_sel="#b67e3eff"
-                             item="#191919ff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-        <wcol_tooltip>
-          <ThemeWidgetColors inner="#191919e6"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tooltip>
-      </ThemeUserInterface>
-    </user_interface>
+                             text_hi="#000000"
+                             header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#000000"
+                             button="#3b3b3b"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#000000">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
     <user_preferences>
       <ThemeUserPreferences>
         <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
+          <ThemeSpaceGeneric back="#3b3b3b"
+                             title="#000000"
+                             text="#b8b8b8"
+                             text_hi="#ffffff"
+                             header="#3b3b3b"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#b8b8b8"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#3b3b3b">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeUserPreferences>
     </user_preferences>
+    <console>
+      <ThemeConsole line_output="#b8b8b8"
+                    line_input="#ffffff"
+                    line_info="#00aa00"
+                    line_error="#dc6060"
+                    cursor="#dc6060">
+        <space>
+          <ThemeSpaceGeneric back="#202020"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#303030"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeConsole>
+    </console>
+    <clip_editor>
+      <ThemeClipEditor marker_outline="#000000"
+                       marker="#7f7f00"
+                       active_marker="#ffffff"
+                       selected_marker="#ffff00"
+                       disabled_marker="#7f0000"
+                       locked_marker="#7f7f7f"
+                       path_before="#ff0000"
+                       path_after="#0000ff"
+                       grid="#5e5e5e"
+                       frame_current="#60c040"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="4"
+                       strips="#0c0a0a"
+                       strips_selected="#ff8c00">
+        <space>
+          <ThemeSpaceGeneric back="#393939"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#313131"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeClipEditor>
+    </clip_editor>
     <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
+      <ThemeBoneColorSet normal="#9a0000"
+                         select="#bd1111"
+                         active="#f70a0a"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
+      <ThemeBoneColorSet normal="#f74018"
+                         select="#f66913"
+                         active="#fa9900"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
+      <ThemeBoneColorSet normal="#1e9109"
+                         select="#59b70b"
+                         active="#83ef1d"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
+      <ThemeBoneColorSet normal="#0a3694"
+                         select="#3667df"
+                         active="#5ec1ef"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
+      <ThemeBoneColorSet normal="#a9294e"
+                         select="#c1416a"
+                         active="#f05d91"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
+      <ThemeBoneColorSet normal="#430c78"
+                         select="#543aa3"
+                         active="#8764d5"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
+      <ThemeBoneColorSet normal="#24785a"
+                         select="#3c9579"
+                         active="#6fb6ab"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
+      <ThemeBoneColorSet normal="#4b707c"
+                         select="#6a8691"
+                         active="#9bc2cd"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
+      <ThemeBoneColorSet normal="#f4c90c"
+                         select="#eec236"
+                         active="#f3ff00"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
+      <ThemeBoneColorSet normal="#1e2024"
+                         select="#484c56"
+                         active="#ffffff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
+      <ThemeBoneColorSet normal="#6f2f6a"
+                         select="#9845be"
+                         active="#d330d6"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
+      <ThemeBoneColorSet normal="#6c8e22"
+                         select="#7fb022"
+                         active="#bbef5b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
+      <ThemeBoneColorSet normal="#8d8d8d"
+                         select="#b0b0b0"
+                         active="#dedede"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
+      <ThemeBoneColorSet normal="#834326"
+                         select="#8b5811"
+                         active="#bd6a11"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
+      <ThemeBoneColorSet normal="#08310e"
+                         select="#1c430b"
+                         active="#34622b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
     </bone_color_sets>
   </Theme>
diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml
index 6173058..ad514bb 100644
--- a/release/scripts/presets/interface_theme/hexagon.xml
+++ b/release/scripts/presets/interface_theme/hexagon.xml
@@ -1,849 +1,852 @@
 <bpy>
   <Theme>
+    <user_interface>
+      <ThemeUserInterface icon_file=""
+                          icon_alpha="1"
+                          axis_x="#dc0000"
+                          axis_y="#00dc00"
+                          axis_z="#0000dc">
+        <wcol_regular>
+          <ThemeWidgetColors outline="#191919"
+                             inner="#8d909fff"
+                             inner_sel="#859cb9ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_tool>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#8d909fff"
+                             inner_sel="#859cb9ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_tool>
+        <wcol_radio>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#8b8d9aff"
+                             inner_sel="#859cb9ff"
+                             item="#ffffffff"
+                             text="#000000"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_text>
+          <ThemeWidgetColors outline="#464646"
+                             inner="#9b9eadff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="25">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_option>
+          <ThemeWidgetColors outline="#464646"
+                             inner="#bbbbbbff"
+                             inner_sel="#777777ff"
+                             item="#ffffffff"
+                             text="#cecece"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <wcol_toggle>
+          <ThemeWidgetColors outline="#464646"
+                             inner="#afafafff"
+                             inner_sel="#859cb9ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#000000"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_num>
+          <ThemeWidgetColors outline="#464646"
+                             inner="#8d909fff"
+                             inner_sel="#999999ff"
+                             item="#5d5d5dff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_numslider>
+          <ThemeWidgetColors outline="#3f3f3f"
+                             inner="#b4b4b4ff"
+                             inner_sel="#999999ff"
+                             item="#b0b0b0ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-20"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_box>
+          <ThemeWidgetColors outline="#191919"
+                             inner="#80828eff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_menu>
+          <ThemeWidgetColors outline="#3d3d3d"
+                             inner="#555d6dff"
+                             inner_sel="#464646ff"
+                             item="#9d9d9dff"
+                             text="#ffffff"
+                             text_sel="#cccccc"
+                             show_shaded="TRUE"
+                             shadetop="15"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_pulldown>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3f3f3fff"
+                             inner_sel="#50c8ffff"
+                             item="#ffffffff"
+                             text="#d8d8d8"
+                             text_sel="#000000"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_menu_back>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#393c44eb"
+                             inner_sel="#2d2d2dff"
+                             item="#646464ff"
+                             text="#cecece"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="40"
+                             shadedown="-40">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_tooltip>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#191919e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#ffffff"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
+        <wcol_menu_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#69a5beff"
+                             item="#ffffffff"
+                             text="#d9d9d9"
+                             text_sel="#000000"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_scroll>
+          <ThemeWidgetColors outline="#4f5057"
+                             inner="#5050502e"
+                             inner_sel="#646464b4"
+                             item="#737a8eff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_progress>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#bebebeff"
+                             inner_sel="#646464b4"
+                             item="#444444ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_list_item>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#50c8ff62"
+                             item="#000000ff"
+                             text="#000000"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#73be4c"
+                                  inner_anim_sel="#5aa633"
+                                  inner_key="#f0eb64"
+                                  inner_key_sel="#d7d34b"
+                                  inner_driven="#b400ff"
+                                  inner_driven_sel="#9900e6"
+                                  blend="0.5">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <panel>
+          <ThemePanelColors header="#00000019"
+                            show_header="TRUE">
+          </ThemePanelColors>
+        </panel>
+      </ThemeUserInterface>
+    </user_interface>
     <view_3d>
-      <ThemeView3D object_active="#6ed8ff"
-                   editmesh_active="#00e8ff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_pose_active="#8cffff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
+      <ThemeView3D grid="#5e5e83"
+                   panel="#a5a5a5ff"
+                   wire="#000000"
+                   lamp="#00000028"
+                   speaker="#000000"
                    camera="#000000"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#e69632"
+                   empty="#000000"
+                   object_selected="#52c6ff"
+                   object_active="#6ed8ff"
+                   object_grouped="#104010"
+                   object_grouped_active="#55bb55"
+                   transform="#ffffff"
+                   vertex="#334cca"
+                   vertex_select="#0097da"
+                   vertex_size="3"
                    edge_select="#1151ce"
+                   edge_seam="#e69632"
                    edge_sharp="#ff2020"
+                   edge_crease="#cc0099"
                    edge_facesel="#4b4b4b"
-                   empty="#000000"
                    face="#affff418"
-                   extra_face_angle="#00008a"
-                   extra_face_area="#002000"
+                   face_select="#1151ce66"
                    face_dot="#4fc9ff"
                    facedot_size="3"
-                   normal="#00ffff"
-                   face_select="#1151ce66"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#5e5e83"
-                   lamp="#00000028"
-                   lastsel_point="#ffffff"
                    nurb_uline="#909000"
                    nurb_vline="#803060"
                    nurb_sel_uline="#f0ff40"
                    nurb_sel_vline="#f090a0"
-                   object_grouped="#104010"
-                   object_grouped_active="#55bb55"
-                   object_selected="#52c6ff"
-                   outline_width="1"
-                   panel="#a5a5a5ff"
-                   skin_root="#000000"
-                   speaker="#000000"
-                   transform="#ffffff"
+                   act_spline="#db2512"
+                   handle_free="#000000"
+                   handle_auto="#909000"
                    handle_vect="#409030"
+                   handle_align="#803060"
+                   handle_sel_free="#000000"
+                   handle_sel_auto="#f0ff40"
                    handle_sel_vect="#40c030"
-                   vertex="#334cca"
+                   handle_sel_align="#f090a0"
+                   lastsel_point="#ffffff"
+                   extra_edge_len="#200000"
+                   extra_face_angle="#00008a"
+                   extra_face_area="#002000"
+                   editmesh_active="#00e8ff80"
+                   normal="#00ffff"
                    vertex_normal="#2361dd"
-                   vertex_select="#0097da"
-                   vertex_size="3"
-                   wire="#000000">
+                   bone_solid="#c8c8c8"
+                   bone_pose="#50c8ff"
+                   bone_pose_active="#8cffff"
+                   frame_current="#60c040"
+                   outline_width="1"
+                   bundle_solid="#c8c8c8"
+                   camera_path="#000000"
+                   skin_root="#000000">
         <space>
-          <ThemeSpaceGeneric header="#646875"
+          <ThemeSpaceGeneric back="#7f818d"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#646875"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#6c717f"
-                             button_text="#d7d7d7"
-                             button_text_hi="#ffffff"
                              button_title="#eaeaea"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#7f818d">
+                             button_text="#d7d7d7"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeView3D>
     </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#60c040"
-                       disabled_marker="#7f0000"
-                       grid="#5e5e5e"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#7f7f00"
-                       marker_outline="#000000"
-                       path_after="#0000ff"
-                       path_before="#ff0000"
-                       selected_marker="#ffff00"
-                       strips="#0c0a0a"
-                       strips_selected="#ff8c00">
+    <graph_editor>
+      <ThemeGraphEditor grid="#58587c"
+                        panel="#ffffff"
+                        window_sliders="#969696"
+                        channels_region="#707070"
+                        vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        handle_free="#000000"
+                        handle_auto="#909000"
+                        handle_vect="#409030"
+                        handle_align="#803060"
+                        handle_sel_free="#000000"
+                        handle_sel_auto="#f0ff40"
+                        handle_sel_vect="#40c030"
+                        handle_sel_align="#f090a0"
+                        handle_auto_clamped="#000000"
+                        handle_sel_auto_clamped="#000000"
+                        lastsel_point="#ffffff"
+                        frame_current="#60c040"
+                        handle_vertex="#000000"
+                        handle_vertex_select="#ff8500"
+                        handle_vertex_size="3"
+                        channel_group="#4f6549"
+                        active_channels_group="#87b17d"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#7c7e88"
                              title="#000000"
-                             back="#7c7e88">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc0606"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#5c606c"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#6c717f"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#87b17d"
-                      channel_group="#4f6549"
-                      channels="#707070"
-                      channels_selected="#60c040"
-                      frame_current="#60c040"
-                      dopesheet_channel="#52606e"
-                      dopesheet_subchannel="#7c8996"
-                      grid="#58587c"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      summary="#00000000"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#5c606c"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#6c717f"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
+                             button="#646875"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#6c717f"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
+      </ThemeGraphEditor>
+    </graph_editor>
     <file_browser>
-      <ThemeFileBrowser active_file="#859cb9"
-                        active_file_text="#fafafa"
-                        scroll_handle="#7f7070"
+      <ThemeFileBrowser selected_file="#69a5be"
+                        tiles="#5c606c"
                         scrollbar="#a0a0a0"
-                        selected_file="#69a5be"
-                        tiles="#5c606c">
+                        scroll_handle="#7f7070"
+                        active_file="#859cb9"
+                        active_file_text="#fafafa">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#646875"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#0f0f0f"
+                             header="#5c606c"
                              header_text="#dddddd"
                              header_text_hi="#ffffff"
                              button="#6c717f"
-                             button_text="#d7d7d7"
-                             button_text_hi="#ffffff"
                              button_title="#d7d7d7"
-                             text="#000000"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#646875">
+                             button_text="#d7d7d7"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#6c717f"
+                                 list_title="#d7d7d7"
                                  list_text="#d7d7d7"
-                                 list_text_hi="#ffffff"
-                                 list_title="#d7d7d7">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeFileBrowser>
     </file_browser>
-    <graph_editor>
-      <ThemeGraphEditor active_channels_group="#87b17d"
-                        handle_align="#803060"
-                        handle_sel_align="#f090a0"
-                        handle_auto="#909000"
-                        handle_sel_auto="#f0ff40"
-                        handle_auto_clamped="#000000"
-                        handle_sel_auto_clamped="#000000"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#58587c"
-                        handle_vertex="#000000"
-                        handle_vertex_select="#ff8500"
-                        handle_vertex_size="3"
-                        lastsel_point="#ffffff"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3"
-                        window_sliders="#969696">
+    <nla_editor>
+      <ThemeNLAEditor grid="#5e5e5e"
+                      view_sliders="#969696"
+                      active_action="#00000000"
+                      active_action_unset="#00000000"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      transition_strips="#000000"
+                      transition_strips_selected="#000000"
+                      meta_strips="#000000"
+                      meta_strips_selected="#000000"
+                      sound_strips="#000000"
+                      sound_strips_selected="#000000"
+                      tweak="#000000"
+                      tweak_duplicate="#000000"
+                      frame_current="#60c040">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#646875"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <dopesheet_editor>
+      <ThemeDopeSheet grid="#58587c"
+                      value_sliders="#000000"
+                      view_sliders="#969696"
+                      channels="#707070"
+                      channels_selected="#60c040"
+                      channel_group="#4f6549"
+                      active_channels_group="#87b17d"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      frame_current="#60c040"
+                      dopesheet_channel="#52606e"
+                      dopesheet_subchannel="#7c8996"
+                      summary="#00000000">
+        <space>
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             header="#5c606c"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#6c717f"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#6c717f"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
     <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
+      <ThemeImageEditor vertex="#334cca"
+                        vertex_select="#50c8ff"
+                        vertex_size="3"
                         face="#ffffff0a"
+                        face_select="#50c8ff3c"
                         face_dot="#50c8ff"
                         facedot_size="3"
-                        face_select="#50c8ff3c"
+                        editmesh_active="#ffffff80"
                         scope_back="#646875ff"
-                        preview_stitch_active="#e1d2c323"
-                        preview_stitch_edge="#ff8500b2"
                         preview_stitch_face="#1242b026"
+                        preview_stitch_edge="#ff8500b2"
+                        preview_stitch_vert="#ff85007f"
                         preview_stitch_stitchable="#00ff00ff"
                         preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#ff85007f"
-                        vertex="#334cca"
-                        vertex_select="#50c8ff"
-                        vertex_size="3">
+                        preview_stitch_active="#e1d2c323">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#646875"
-                             button_text="#eeeeee"
-                             button_text_hi="#ffffff"
                              button_title="#eeeeee"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             button_text="#eeeeee"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeImageEditor>
     </image_editor>
-    <info>
-      <ThemeInfo>
+    <sequence_editor>
+      <ThemeSequenceEditor grid="#404040"
+                           window_sliders="#a0a0a0"
+                           movie_strip="#516987"
+                           movieclip_strip="#20208f"
+                           image_strip="#6d5881"
+                           scene_strip="#4e983e"
+                           audio_strip="#2e8f8f"
+                           effect_strip="#a9547c"
+                           transition_strip="#a25f6f"
+                           meta_strip="#6d9183"
+                           frame_current="#60c040"
+                           keyframe="#ff8500"
+                           draw_action="#50c8ff"
+                           preview_back="#000000">
         <space>
-          <ThemeSpaceGeneric header="#646875"
-                             header_text="#dddddd"
-                             header_text_hi="#ffffff"
-                             button="#b4b4b4"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
+          <ThemeSpaceGeneric back="#90929c"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#b4b4b4">
+                             header="#5c606c"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#646875"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <properties>
+      <ThemeProperties panel="#828282">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#646875"
+                             title="#ffffff"
+                             text="#e7e7e7"
+                             text_hi="#ffffff"
+                             header="#646875"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#6c717f"
-                             button_text="#d7d7d7"
-                             button_text_hi="#ffffff"
-                             button_title="#d7d7d7"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             button="#727272"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor active_action="#00000000"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      meta_strips="#000000"
-                      meta_strips_selected="#000000"
-                      active_action_unset="#00000000"
-                      sound_strips="#000000"
-                      sound_strips_selected="#000000"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      transition_strips="#000000"
-                      transition_strips_selected="#000000"
-                      tweak="#000000"
-                      tweak_duplicate="#000000"
-                      view_sliders="#969696">
+      </ThemeProperties>
+    </properties>
+    <text_editor>
+      <ThemeTextEditor line_numbers_background="#5a5e6a"
+                       selected_text="#c67777"
+                       cursor="#ff0000"
+                       syntax_builtin="#800050"
+                       syntax_special="#5f5f00"
+                       syntax_comment="#006432"
+                       syntax_string="#640000"
+                       syntax_numbers="#0000c8">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline grid="#58587c"
+                     frame_current="#60c040">
+        <space>
+          <ThemeSpaceGeneric back="#646875"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             header="#565863"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#5a5e6a"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#646875"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
+      </ThemeTimeline>
+    </timeline>
     <node_editor>
-      <ThemeNodeEditor node_active="#ffffff"
-                       converter_node="#686a84"
-                       frame_node="#9a9b9ba0"
-                       group_node="#69756e"
-                       in_out_node="#64647b"
+      <ThemeNodeEditor node_selected="#ffffff"
+                       node_active="#ffffff"
+                       wire="#000000"
+                       wire_select="#ffffff"
+                       selected_text="#7f7070"
                        node_backdrop="#9b9baca0"
-                       node_selected="#ffffff"
-                       noodle_curving="5"
+                       in_out_node="#64647b"
+                       converter_node="#686a84"
                        operator_node="#6c697e"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
+                       group_node="#69756e"
+                       frame_node="#9a9b9ba0"
+                       noodle_curving="5">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#a7a7a7"
+                                 list_title="#000000"
                                  list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeNodeEditor>
     </node_editor>
-    <outliner>
-      <ThemeOutliner match="#245824"
-                     selected_highlight="#212844">
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
         <space>
-          <ThemeSpaceGeneric header="#6c717f"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#e2e2e2"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#7c7e88"
                              title="#000000"
-                             back="#72747c">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#646875"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#e7e7e7"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#646875">
+                             button="#6c717f"
+                             button_title="#d7d7d7"
+                             button_text="#d7d7d7"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           movieclip_strip="#20208f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           preview_back="#000000"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
+      </ThemeLogicEditor>
+    </logic_editor>
+    <outliner>
+      <ThemeOutliner match="#245824"
+                     selected_highlight="#212844">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#72747c"
+                             title="#000000"
+                             text="#e2e2e2"
+                             text_hi="#ffffff"
+                             header="#6c717f"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
+                             button="#727272"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#90929c">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       syntax_special="#5f5f00"
-                       line_numbers_background="#5a5e6a"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_string="#640000">
+      </ThemeOutliner>
+    </outliner>
+    <info>
+      <ThemeInfo>
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#646875"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
+          <ThemeSpaceGeneric back="#b4b4b4"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             header="#646875"
+                             header_text="#dddddd"
+                             header_text_hi="#ffffff"
+                             button="#b4b4b4"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#58587c">
+      </ThemeInfo>
+    </info>
+    <user_preferences>
+      <ThemeUserPreferences>
         <space>
-          <ThemeSpaceGeneric header="#565863"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
-                             button="#5a5e6a"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
+                             button="#6c717f"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#646875">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#80828eff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#50c8ff62"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#393c44eb"
-                             inner_sel="#2d2d2dff"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-40"
-                             shadetop="40"
-                             show_shaded="FALSE"
-                             text="#cecece"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#69a5beff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#d9d9d9"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#555d6dff"
-                             inner_sel="#464646ff"
-                             item="#9d9d9dff"
-                             outline="#3d3d3d"
-                             shadedown="0"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#8d909fff"
-                             inner_sel="#999999ff"
-                             item="#5d5d5dff"
-                             outline="#464646"
-                             shadedown="0"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#bbbbbbff"
-                             inner_sel="#777777ff"
-                             item="#ffffffff"
-                             outline="#464646"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#cecece"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000019"
-                            show_header="TRUE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#bebebeff"
-                             inner_sel="#646464b4"
-                             item="#444444ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#50c8ffff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#d8d8d8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#8b8d9aff"
-                             inner_sel="#859cb9ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#8d909fff"
-                             inner_sel="#859cb9ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#5050502e"
-                             inner_sel="#646464b4"
-                             item="#737a8eff"
-                             outline="#4f5057"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#999999ff"
-                             item="#b0b0b0ff"
-                             outline="#3f3f3f"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#73be4c"
-                                  inner_anim_sel="#5aa633"
-                                  blend="0.5"
-                                  inner_driven="#b400ff"
-                                  inner_driven_sel="#9900e6"
-                                  inner_key="#f0eb64"
-                                  inner_key_sel="#d7d34b">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#9b9eadff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#464646"
-                             shadedown="25"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#afafafff"
-                             inner_sel="#859cb9ff"
-                             item="#191919ff"
-                             outline="#464646"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#8d909fff"
-                             inner_sel="#859cb9ff"
-                             item="#191919ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-        <wcol_tooltip>
-          <ThemeWidgetColors inner="#191919e6"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tooltip>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <console>
+      <ThemeConsole line_output="#000000"
+                    line_input="#ffffff"
+                    line_info="#00aa00"
+                    line_error="#dc0606"
+                    cursor="#dc6060">
         <space>
-          <ThemeSpaceGeneric header="#5c606c"
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#5c606c"
                              header_text="#000000"
                              header_text_hi="#ffffff"
                              button="#6c717f"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeConsole>
+    </console>
+    <clip_editor>
+      <ThemeClipEditor marker_outline="#000000"
+                       marker="#7f7f00"
+                       active_marker="#ffffff"
+                       selected_marker="#ffff00"
+                       disabled_marker="#7f0000"
+                       locked_marker="#7f7f7f"
+                       path_before="#ff0000"
+                       path_after="#0000ff"
+                       grid="#5e5e5e"
+                       frame_current="#60c040"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="4"
+                       strips="#0c0a0a"
+                       strips_selected="#ff8c00">
+        <space>
+          <ThemeSpaceGeneric back="#7c7e88"
+                             title="#000000"
                              text="#000000"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#7c7e88">
+                             header="#5c606c"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#646875"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeUserPreferences>
-    </user_preferences>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeClipEditor>
+    </clip_editor>
     <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
+      <ThemeBoneColorSet normal="#9a0000"
+                         select="#bd1111"
+                         active="#f70a0a"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
+      <ThemeBoneColorSet normal="#f74018"
+                         select="#f66913"
+                         active="#fa9900"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
+      <ThemeBoneColorSet normal="#1e9109"
+                         select="#59b70b"
+                         active="#83ef1d"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
+      <ThemeBoneColorSet normal="#0a3694"
+                         select="#3667df"
+                         active="#5ec1ef"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
+      <ThemeBoneColorSet normal="#a9294e"
+                         select="#c1416a"
+                         active="#f05d91"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
+      <ThemeBoneColorSet normal="#430c78"
+                         select="#543aa3"
+                         active="#8764d5"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
+      <ThemeBoneColorSet normal="#24785a"
+                         select="#3c9579"
+                         active="#6fb6ab"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
+      <ThemeBoneColorSet normal="#4b707c"
+                         select="#6a8691"
+                         active="#9bc2cd"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
+      <ThemeBoneColorSet normal="#f4c90c"
+                         select="#eec236"
+                         active="#f3ff00"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
+      <ThemeBoneColorSet normal="#1e2024"
+                         select="#484c56"
+                         active="#ffffff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
+      <ThemeBoneColorSet normal="#6f2f6a"
+                         select="#9845be"
+                         active="#d330d6"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
+      <ThemeBoneColorSet normal="#6c8e22"
+                         select="#7fb022"
+                         active="#bbef5b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
+      <ThemeBoneColorSet normal="#8d8d8d"
+                         select="#b0b0b0"
+                         active="#dedede"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
+      <ThemeBoneColorSet normal="#834326"
+                         select="#8b5811"
+                         active="#bd6a11"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
+      <ThemeBoneColorSet normal="#08310e"
+                         select="#1c430b"
+                         active="#34622b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
     </bone_color_sets>
   </Theme>
diff --git a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
index 05075f0..8f4a42b 100644
--- a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
+++ b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
@@ -1,849 +1,852 @@
 <bpy>
   <Theme>
+    <user_interface>
+      <ThemeUserInterface icon_file=""
+                          icon_alpha="1"
+                          axis_x="#dc0000"
+                          axis_y="#00dc00"
+                          axis_z="#0000dc">
+        <wcol_regular>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3c3b37ff"
+                             inner_sel="#131311ff"
+                             item="#cbc3bbff"
+                             text="#dfdfdf"
+                             text_sel="#dfdfdf"
+                             show_shaded="TRUE"
+                             shadetop="21"
+                             shadedown="-21">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_tool>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#3c3b37ff"
+                             inner_sel="#3c3b37ff"
+                             item="#cbc3bbff"
+                             text="#dfdbcf"
+                             text_sel="#f47421"
+                             show_shaded="TRUE"
+                             shadetop="17"
+                             shadedown="-17">
+          </ThemeWidgetColors>
+        </wcol_tool>
+        <wcol_radio>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#1a1a1aff"
+                             inner_sel="#6a3859ff"
+                             item="#3c3b37ff"
+                             text="#dfdbcf"
+                             text_sel="#dfdbcf"
+                             show_shaded="TRUE"
+                             shadetop="5"
+                             shadedown="-5">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_text>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#272725ff"
+                             inner_sel="#171717ff"
+                             item="#6a3859ff"
+                             text="#dfdbcf"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-10"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_option>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#272727ff"
+                             inner_sel="#080808ff"
+                             item="#fff8ecff"
+                             text="#84817e"
+                             text_sel="#dfdbcf"
+                             show_shaded="TRUE"
+                             shadetop="15"
+                             shadedown="-5">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <wcol_toggle>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#464640ff"
+                             inner_sel="#151515ff"
+                             item="#cbc3bbff"
+                             text="#c3bfb7"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="7"
+                             shadedown="-3">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_num>
+          <ThemeWidgetColors outline="#080808"
+                             inner="#3c3b37ff"
+                             inner_sel="#171717ff"
+                             item="#ffffffff"
+                             text="#dfdbcf"
+                             text_sel="#f47421"
+                             show_shaded="TRUE"
+                             shadetop="20"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_numslider>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#181818ff"
+                             inner_sel="#151515ff"
+                             item="#6a3859ff"
+                             text="#eeedeb"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="-22"
+                             shadedown="26">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_box>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#252522ff"
+                             inner_sel="#646464ff"
+                             item="#0d0d0dff"
+                             text="#eeedeb"
+                             text_sel="#eeedeb"
+                             show_shaded="TRUE"
+                             shadetop="-5"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_menu>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#3c3b37ff"
+                             inner_sel="#121212ff"
+                             item="#ffffffff"
+                             text="#dfdbcf"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_pulldown>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#3f3f3fff"
+                             inner_sel="#f47421ff"
+                             item="#ffffffff"
+                             text="#dddddd"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_menu_back>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#131312db"
+                             inner_sel="#2d2d2de6"
+                             item="#6a3859ff"
+                             text="#dddddd"
+                             text_sel="#dddddd"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_tooltip>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#191919e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             text="#ffffff"
+                             text_sel="#ff5d0d"
+                             show_shaded="FALSE"
+                             shadetop="25"
+                             shadedown="-20">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
+        <wcol_menu_item>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#00000000"
+                             inner_sel="#6a3859ff"
+                             item="#ffffffff"
+                             text="#a4a4a4"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="38"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_scroll>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#000000b4"
+                             inner_sel="#646464c6"
+                             item="#2e2d2aff"
+                             text="#cbc3bb"
+                             text_sel="#ffffff"
+                             show_shaded="TRUE"
+                             shadetop="10"
+                             shadedown="-10">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_progress>
+          <ThemeWidgetColors outline="#000000"
+                             inner="#00000000"
+                             inner_sel="#00000000"
+                             item="#00000000"
+                             text="#cbc3bb"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="0">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_list_item>
+          <ThemeWidgetColors outline="#0d0d0d"
+                             inner="#00000000"
+                             inner_sel="#6a3859ff"
+                             item="#cbc3bbff"
+                             text="#cbc3bb"
+                             text_sel="#ffffff"
+                             show_shaded="FALSE"
+                             shadetop="0"
+                             shadedown="1">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#308d00"
+                                  inner_anim_sel="#a7ff07"
+                                  inner_key="#105874"
+                                  inner_key_sel="#19b6ee"
+                                  inner_driven="#862074"
+                                  inner_driven_sel="#862074"
+                                  blend="0.1">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <panel>
+          <ThemePanelColors header="#00000000"
+                            show_header="TRUE">
+          </ThemePanelColors>
+        </panel>
+      </ThemeUserInterface>
+    </user_interface>
     <view_3d>
-      <ThemeView3D object_active="#f47421"
-                   editmesh_active="#ffffff80"
-                   act_spline="#ee4000"
-                   handle_align="#93237f"
-                   handle_sel_align="#f47421"
-                   handle_auto="#00c59a"
-                   handle_sel_auto="#f47421"
-                   bone_pose="#50c8ff"
-                   bone_pose_active="#8cffff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
+      <ThemeView3D grid="#3c3b37"
+                   panel="#a5a5a57f"
+                   wire="#93237f"
+                   lamp="#ffffff34"
+                   speaker="#93237f"
                    camera="#159dce"
-                   camera_path="#7dbd00"
-                   frame_current="#60c040"
-                   edge_crease="#ce33b8"
-                   extra_edge_len="#200000"
-                   edge_seam="#db4100"
+                   empty="#93237f"
+                   object_selected="#f15800"
+                   object_active="#f47421"
+                   object_grouped="#117211"
+                   object_grouped_active="#65d665"
+                   transform="#ffffff"
+                   vertex="#c96cb8"
+                   vertex_select="#f47421"
+                   vertex_size="2"
                    edge_select="#f47421"
+                   edge_seam="#db4100"
                    edge_sharp="#ff4c00"
+                   edge_crease="#ce33b8"
                    edge_facesel="#4b4b4b"
-                   empty="#93237f"
                    face="#75757512"
-                   extra_face_angle="#002000"
-                   extra_face_area="#0059ee"
+                   face_select="#f474213c"
                    face_dot="#f47421"
                    facedot_size="3"
-                   normal="#19b6ee"
-                   face_select="#f474213c"
-                   handle_free="#a5ca00"
-                   handle_sel_free="#f47421"
-                   grid="#3c3b37"
-                   lamp="#ffffff34"
-                   lastsel_point="#ffffff"
                    nurb_uline="#909000"
                    nurb_vline="#862074"
                    nurb_sel_uline="#f0ff40"
                    nurb_sel_vline="#d15d85"
-                   object_grouped="#117211"
-                   object_grouped_active="#65d665"
-                   object_selected="#f15800"
-                   outline_width="2"
-                   panel="#a5a5a57f"
-                   skin_root="#000000"
-                   speaker="#93237f"
-                   transform="#ffffff"
+                   act_spline="#ee4000"
+                   handle_free="#a5ca00"
+                   handle_auto="#00c59a"
                    handle_vect="#409030"
+                   handle_align="#93237f"
+                   handle_sel_free="#f47421"
+                   handle_sel_auto="#f47421"
                    handle_sel_vect="#82c036"
-                   vertex="#c96cb8"
+                   handle_sel_align="#f47421"
+                   lastsel_point="#ffffff"
+                   extra_edge_len="#200000"
+                   extra_face_angle="#002000"
+                   extra_face_area="#0059ee"
+                   editmesh_active="#ffffff80"
+                   normal="#19b6ee"
                    vertex_normal="#19b6ee"
-                   vertex_select="#f47421"
-                   vertex_size="2"
-                   wire="#93237f">
+                   bone_solid="#c8c8c8"
+                   bone_pose="#50c8ff"
+                   bone_pose_active="#8cffff"
+                   frame_current="#60c040"
+                   outline_width="2"
+                   bundle_solid="#c8c8c8"
+                   camera_path="#7dbd00"
+                   skin_root="#000000">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#9c9c9c"
+                             text="#9c9c9c"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#9c9c9c"
-                             button_text_hi="#ffffff"
                              button_title="#9c9c9c"
-                             text="#9c9c9c"
-                             text_hi="#ffffff"
-                             title="#9c9c9c"
-                             back="#131311">
+                             button_text="#9c9c9c"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeView3D>
     </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#f47421"
-                       disabled_marker="#7f0000"
-                       grid="#302e2c"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#76243b"
-                       marker_outline="#000000"
-                       path_after="#19b6ee"
-                       path_before="#ff5100"
-                       selected_marker="#d5ff00"
-                       strips="#0c0a0a"
-                       strips_selected="#ff8c00">
-        <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#9c9c9c"
-                             header_text_hi="#ffffff"
-                             button="#3c3b37"
-                             button_text="#ffffff"
-                             button_text_hi="#ffffff"
-                             button_title="#9c9c9c"
-                             text="#9c9c9c"
-                             text_hi="#ffffff"
-                             title="#9c9c9c"
-                             back="#131311">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#f47421"
-                    line_error="#ff0000"
-                    line_info="#f47421"
-                    line_input="#19b6ee"
-                    line_output="#97f500">
+    <graph_editor>
+      <ThemeGraphEditor grid="#3c3b37"
+                        panel="#ffffff"
+                        window_sliders="#95948f"
+                        channels_region="#707070"
+                        vertex="#ffffff"
+                        vertex_select="#f49600"
+                        vertex_size="4"
+                        handle_free="#a5ca00"
+                        handle_auto="#00c59a"
+                        handle_vect="#409030"
+                        handle_align="#93237f"
+                        handle_sel_free="#f49600"
+                        handle_sel_auto="#f49600"
+                        handle_sel_vect="#40c030"
+                        handle_sel_align="#f49600"
+                        handle_auto_clamped="#03aa60"
+                        handle_sel_auto_clamped="#f49600"
+                        lastsel_point="#fafafa"
+                        frame_current="#f58032"
+                        handle_vertex="#bbbbbb"
+                        handle_vertex_select="#f49600"
+                        handle_vertex_size="4"
+                        channel_group="#4f6549"
+                        active_channels_group="#87b17d"
+                        dopesheet_channel="#695c6e"
+                        dopesheet_subchannel="#7c8996">
         <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#acacac"
-                             header_text_hi="#ffffff"
-                             button="#3c3b37"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#9c9c9c"
+                             text="#e9e9e9"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#131311">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#a2b15c"
-                      channel_group="#4f6549"
-                      channels="#9c9c9c"
-                      channels_selected="#6592f5"
-                      frame_current="#f58032"
-                      dopesheet_channel="#64486e"
-                      dopesheet_subchannel="#877096"
-                      grid="#525252"
-                      long_key="#0c0a0a"
-                      long_key_selected="#f47421"
-                      summary="#00000000"
-                      value_sliders="#000000"
-                      view_sliders="#9c9c9c">
-        <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#cacaca"
+                             header="#464541"
+                             header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#9c9c9c"
-                             button_text_hi="#ffffff"
                              button_title="#9c9c9c"
-                             text="#e7e7e7"
-                             text_hi="#ffffff"
-                             title="#9c9c9c"
-                             back="#131311">
+                             button_text="#9c9c9c"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3c3b37"
+                                 list_title="#ffffff"
                                  list_text="#e2e2e2"
-                                 list_text_hi="#f47421"
-                                 list_title="#ffffff">
+                                 list_text_hi="#f47421">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
+      </ThemeGraphEditor>
+    </graph_editor>
     <file_browser>
-      <ThemeFileBrowser active_file="#eeedeb"
-                        active_file_text="#ffffff"
-                        scroll_handle="#7f7070"
+      <ThemeFileBrowser selected_file="#6b395a"
+                        tiles="#3c3b37"
                         scrollbar="#a0a0a0"
-                        selected_file="#6b395a"
-                        tiles="#3c3b37">
+                        scroll_handle="#7f7070"
+                        active_file="#eeedeb"
+                        active_file_text="#ffffff">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#b2b2b1"
+                             text_hi="#0f0f0f"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#b2b2b1"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#131311">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3c3b37"
+                                 list_title="#95948f"
                                  list_text="#95948f"
-                                 list_text_hi="#ffffff"
-                                 list_title="#95948f">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeFileBrowser>
     </file_browser>
-    <graph_editor>
-      <ThemeGraphEditor active_channels_group="#87b17d"
-                        handle_align="#93237f"
-                        handle_sel_align="#f49600"
-                        handle_auto="#00c59a"
-                        handle_sel_auto="#f49600"
-                        handle_auto_clamped="#03aa60"
-                        handle_sel_auto_clamped="#f49600"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#f58032"
-                        dopesheet_channel="#695c6e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#a5ca00"
-                        handle_sel_free="#f49600"
-                        grid="#3c3b37"
-                        handle_vertex="#bbbbbb"
-                        handle_vertex_select="#f49600"
-                        handle_vertex_size="4"
-                        lastsel_point="#fafafa"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
-                        vertex="#ffffff"
-                        vertex_select="#f49600"
-                        vertex_size="4"
-                        window_sliders="#95948f">
+    <nla_editor>
+      <ThemeNLAEditor grid="#5c5c52"
+                      view_sliders="#969696"
+                      active_action="#00000000"
+                      active_action_unset="#00000000"
+                      strips="#0c0a0a"
+                      strips_selected="#6b395a"
+                      transition_strips="#000000"
+                      transition_strips_selected="#000000"
+                      meta_strips="#000000"
+                      meta_strips_selected="#000000"
+                      sound_strips="#000000"
+                      sound_strips_selected="#000000"
+                      tweak="#000000"
+                      tweak_duplicate="#000000"
+                      frame_current="#f58032">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#9c9c9c"
-                             button_text_hi="#ffffff"
-                             button_title="#9c9c9c"
-                             text="#e9e9e9"
-                             text_hi="#ffffff"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#3c3b37"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <dopesheet_editor>
+      <ThemeDopeSheet grid="#525252"
+                      value_sliders="#000000"
+                      view_sliders="#9c9c9c"
+                      channels="#9c9c9c"
+                      channels_selected="#6592f5"
+                      channel_group="#4f6549"
+                      active_channels_group="#a2b15c"
+                      long_key="#0c0a0a"
+                      long_key_selected="#f47421"
+                      frame_current="#f58032"
+                      dopesheet_channel="#64486e"
+                      dopesheet_subchannel="#877096"
+                      summary="#00000000">
+        <space>
+          <ThemeSpaceGeneric back="#131311"
                              title="#9c9c9c"
-                             back="#131311">
+                             text="#e7e7e7"
+                             text_hi="#ffffff"
+                             header="#464541"
+                             header_text="#cacaca"
+                             header_text_hi="#ffffff"
+                             button="#3c3b37"
+                             button_title="#9c9c9c"
+                             button_text="#9c9c9c"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3c3b37"
+                                 list_title="#ffffff"
                                  list_text="#e2e2e2"
-                                 list_text_hi="#f47421"
-                                 list_title="#ffffff">
+                                 list_text_hi="#f47421">
           </ThemeSpaceListGeneric>
         </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
     <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
+      <ThemeImageEditor vertex="#000000"
+                        vertex_select="#f47421"
+                        vertex_size="3"
                         face="#ffffff0a"
+                        face_select="#ff85003c"
                         face_dot="#f47421"
                         facedot_size="3"
-                        face_select="#ff85003c"
+                        editmesh_active="#ffffff80"
                         scope_back="#3c3b37ff"
-                        preview_stitch_active="#e1d2c323"
-                        preview_stitch_edge="#ff8500b2"
                         preview_stitch_face="#1242b026"
+                        preview_stitch_edge="#ff8500b2"
+                        preview_stitch_vert="#ff85007f"
                         preview_stitch_stitchable="#00ff00ff"
                         preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#ff85007f"
-                        vertex="#000000"
-                        vertex_select="#f47421"
-                        vertex_size="3">
+                        preview_stitch_active="#e1d2c323">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#b9b9b9"
-                             button_text_hi="#ffffff"
                              button_title="#b1b1b1"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#131311">
+                             button_text="#b9b9b9"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
       </ThemeImageEditor>
     </image_editor>
-    <info>
-      <ThemeInfo>
+    <sequence_editor>
+      <ThemeSequenceEditor grid="#282828"
+                           window_sliders="#a0a0a0"
+                           movie_strip="#516987"
+                           movieclip_strip="#20208f"
+                           image_strip="#6d5881"
+                           scene_strip="#4e983e"
+                           audio_strip="#2e8f8f"
+                           effect_strip="#a9547c"
+                           transition_strip="#a25f6f"
+                           meta_strip="#6d9183"
+                           frame_current="#c06e11"
+                           keyframe="#f47421"
+                           draw_action="#50c8ff"
+                           preview_back="#000000">
         <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#3c3b37"
-                             button_text="#eeedeb"
-                             button_text_hi="#ffffff"
-                             button_title="#eeedeb"
-                             text="#eeedeb"
+          <ThemeSpaceGeneric back="#191919"
+                             title="#acacac"
+                             text="#acacac"
                              text_hi="#ffffff"
-                             title="#eeedeb"
-                             back="#3c3b37">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#acacac">
-        <space>
-          <ThemeSpaceGeneric header="#464541"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
-                             button="#353430"
+                             button="#3c3b37"
+                             button_title="#acacac"
                              button_text="#acacac"
-                             button_text_hi="#ffffff"
-                             button_title="#7d7d7d"
-                             text="#acacac"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#29001b">
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor active_action="#00000000"
-                      frame_current="#f58032"
-                      grid="#5c5c52"
-                      meta_strips="#000000"
-                      meta_strips_selected="#000000"
-                      active_action_unset="#00000000"
-                      sound_strips="#000000"
-                      sound_strips_selected="#000000"
-                      strips="#0c0a0a"
-                      strips_selected="#6b395a"
-                      transition_strips="#000000"
-                      transition_strips_selected="#000000"
-                      tweak="#000000"
-                      tweak_duplicate="#000000"
-                      view_sliders="#969696">
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <properties>
+      <ThemeProperties panel="#3c3b37">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#3c3b37"
+                             title="#acacac"
+                             text="#acacac"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
                              button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#131311">
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#3c3b37"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor node_active="#ffffff"
-                       converter_node="#93be00"
-                       frame_node="#9a9b9ba0"
-                       group_node="#19b6ee"
-                       in_out_node="#f40051"
-                       node_backdrop="#52524ed1"
-                       node_selected="#ffffff"
-                       noodle_curving="5"
-                       operator_node="#000000"
-                       selected_text="#7f7070"
-                       wire_select="#f4b696"
-                       wire="#f45b00">
+      </ThemeProperties>
+    </properties>
+    <text_editor>
+      <ThemeTextEditor line_numbers_background="#3c3b37"
+                       selected_text="#641f44"
+                       cursor="#f47421"
+                       syntax_builtin="#d6ff01"
+                       syntax_special="#33a500"
+                       syntax_comment="#249d60"
+                       syntax_string="#6e00ff"
+                       syntax_numbers="#972144">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#19b6ee"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
-                             button="#353430"
-                             button_text="#acacac"
-                             button_text_hi="#ffffff"
-                             button_title="#acacac"
+                             button="#191919"
+                             button_title="#64645e"
+                             button_text="#95948f"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline grid="#272727"
+                     frame_current="#f47421">
+        <space>
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#9c9c9c"
+                             text_hi="#ffffff"
+                             header="#464541"
+                             header_text="#acacac"
+                             header_text_hi="#ffffff"
+                             button="#3c3b37"
+                             button_title="#9c9c9c"
+                             button_text="#9c9c9c"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <node_editor>
+      <ThemeNodeEditor node_selected="#ffffff"
+                       node_active="#ffffff"
+                       wire="#f45b00"
+                       wire_select="#f4b696"
+                       selected_text="#7f7070"
+                       node_backdrop="#52524ed1"
+                       in_out_node="#f40051"
+                       converter_node="#93be00"
+                       operator_node="#000000"
+                       group_node="#19b6ee"
+                       frame_node="#9a9b9ba0"
+                       noodle_curving="5">
+        <space>
+          <ThemeSpaceGeneric back="#29001b"
+                             title="#000000"
                              text="#eeedeb"
                              text_hi="#cbcbcb"
-                             title="#000000"
-                             back="#29001b">
+                             header="#464541"
+                             header_text="#acacac"
+                             header_text_hi="#ffffff"
+                             button="#353430"
+                             button_title="#acacac"
+                             button_text="#acacac"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
           <ThemeSpaceListGeneric list="#3c3b37"
+                                 list_title="#acacac"
                                  list_text="#acacac"
-                                 list_text_hi="#ffffff"
-                                 list_title="#acacac">
+                                 list_text_hi="#ffffff">
           </ThemeSpaceListGeneric>
         </space_list>
       </ThemeNodeEditor>
     </node_editor>
+    <logic_editor>
+      <ThemeLogicEditor panel="#acacac">
+        <space>
+          <ThemeSpaceGeneric back="#29001b"
+                             title="#000000"
+                             text="#acacac"
+                             text_hi="#ffffff"
+                             header="#464541"
+                             header_text="#acacac"
+                             header_text_hi="#ffffff"
+                             button="#353430"
+                             button_title="#7d7d7d"
+                             button_text="#acacac"
+                             button_text_hi="#ffffff">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
     <outliner>
       <ThemeOutliner match="#337f33"
                      selected_highlight="#6a3859">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#3c3b37"
+                             title="#000000"
+                             text="#cccccc"
+                             text_hi="#f47421"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#000000"
-                             button_text_hi="#f47421"
                              button_title="#000000"
-                             text="#cccccc"
-                             text_hi="#f47421"
-                             title="#000000"
-                             back="#3c3b37">
+                             button_text="#000000"
+                             button_text_hi="#f47421">
           </ThemeSpaceGeneric>
         </space>
       </ThemeOutliner>
     </outliner>
-    <properties>
-      <ThemeProperties panel="#3c3b37">
+    <info>
+      <ThemeInfo>
         <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#acacac"
-                             header_text_hi="#ffffff"
-                             button="#3c3b37"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#acacac"
+          <ThemeSpaceGeneric back="#3c3b37"
+                             title="#eeedeb"
+                             text="#eeedeb"
                              text_hi="#ffffff"
-                             title="#acacac"
-                             back="#3c3b37">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           movieclip_strip="#20208f"
-                           frame_current="#c06e11"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#282828"
-                           image_strip="#6d5881"
-                           keyframe="#f47421"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           preview_back="#000000"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#acacac"
+                             header="#464541"
+                             header_text="#ffffff"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#acacac"
-                             button_text_hi="#ffffff"
-                             button_title="#acacac"
-                             text="#acacac"
-                             text_hi="#ffffff"
-                             title="#acacac"
-                             back="#191919">
+                             button_title="#eeedeb"
+                             button_text="#eeedeb"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#f47421"
-                       syntax_special="#33a500"
-                       line_numbers_background="#3c3b37"
-                       selected_text="#641f44"
-                       syntax_builtin="#d6ff01"
-                       syntax_comment="#249d60"
-                       syntax_numbers="#972144"
-                       syntax_string="#6e00ff">
+      </ThemeInfo>
+    </info>
+    <user_preferences>
+      <ThemeUserPreferences>
         <space>
-          <ThemeSpaceGeneric header="#464541"
-                             header_text="#acacac"
-                             header_text_hi="#ffffff"
-                             button="#191919"
-                             button_text="#95948f"
-                             button_text_hi="#ffffff"
-                             button_title="#64645e"
-                             text="#19b6ee"
-                             text_hi="#ffffff"
+          <ThemeSpaceGeneric back="#3c3b37"
                              title="#000000"
-                             back="#131311">
+                             text="#ccccc8"
+                             text_hi="#ffffff"
+                             header="#3c3b37"
+                             header_text="#d3d2cd"
+                             header_text_hi="#ffffff"
+                             button="#696965"
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#f47421"
-                     grid="#272727">
+      </ThemeUserPreferences>
+    </user_preferences>
+    <console>
+      <ThemeConsole line_output="#97f500"
+                    line_input="#19b6ee"
+                    line_info="#f47421"
+                    line_error="#ff0000"
+                    cursor="#f47421">
         <space>
-          <ThemeSpaceGeneric header="#464541"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             header="#464541"
                              header_text="#acacac"
                              header_text_hi="#ffffff"
                              button="#3c3b37"
-                             button_text="#9c9c9c"
-                             button_text_hi="#ffffff"
-                             button_title="#9c9c9c"
-                             text="#9c9c9c"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#131311">
+                             button_title="#000000"
+                             button_text="#000000"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#252522ff"
-                             inner_sel="#646464ff"
-                             item="#0d0d0dff"
-                             outline="#0d0d0d"
-                             shadedown="0"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#eeedeb"
-                             text_sel="#eeedeb">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#6a3859ff"
-                             item="#cbc3bbff"
-                             outline="#0d0d0d"
-                             shadedown="1"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#cbc3bb"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#131312db"
-                             inner_sel="#2d2d2de6"
-                             item="#6a3859ff"
-                             outline="#0d0d0d"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#dddddd"
-                             text_sel="#dddddd">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#6a3859ff"
-                             item="#ffffffff"
-                             outline="#0d0d0d"
-                             shadedown="0"
-                             shadetop="38"
-                             show_shaded="FALSE"
-                             text="#a4a4a4"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#3c3b37ff"
-                             inner_sel="#121212ff"
-                             item="#ffffffff"
-                             outline="#0d0d0d"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#dfdbcf"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#3c3b37ff"
-                             inner_sel="#171717ff"
-                             item="#ffffffff"
-                             outline="#080808"
-                             shadedown="-20"
-                             shadetop="20"
-                             show_shaded="TRUE"
-                             text="#dfdbcf"
-                             text_sel="#f47421">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#272727ff"
-                             inner_sel="#080808ff"
-                             item="#fff8ecff"
-                             outline="#0d0d0d"
-                             shadedown="-5"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#84817e"
-                             text_sel="#dfdbcf">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000000"
-                            show_header="TRUE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#00000000"
-                             item="#00000000"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#cbc3bb"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#f47421ff"
-                             item="#ffffffff"
-                             outline="#0d0d0d"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#dddddd"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#1a1a1aff"
-                             inner_sel="#6a3859ff"
-                             item="#3c3b37ff"
-                             outline="#000000"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#dfdbcf"
-                             text_sel="#dfdbcf">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#3c3b37ff"
-                             inner_sel="#131311ff"
-                             item="#cbc3bbff"
-                             outline="#000000"
-                             shadedown="-21"
-                             shadetop="21"
-                             show_shaded="TRUE"
-                             text="#dfdfdf"
-                             text_sel="#dfdfdf">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#000000b4"
-                             inner_sel="#646464c6"
-                             item="#2e2d2aff"
-                             outline="#000000"
-                             shadedown="-10"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#cbc3bb"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#181818ff"
-                             inner_sel="#151515ff"
-                             item="#6a3859ff"
-                             outline="#0d0d0d"
-                             shadedown="26"
-                             shadetop="-22"
-                             show_shaded="TRUE"
-                             text="#eeedeb"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#308d00"
-                                  inner_anim_sel="#a7ff07"
-                                  blend="0.1"
-                                  inner_driven="#862074"
-                                  inner_driven_sel="#862074"
-                                  inner_key="#105874"
-                                  inner_key_sel="#19b6ee">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#272725ff"
-                             inner_sel="#171717ff"
-                             item="#6a3859ff"
-                             outline="#0d0d0d"
-                             shadedown="0"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#dfdbcf"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#464640ff"
-                             inner_sel="#151515ff"
-                             item="#cbc3bbff"
-                             outline="#000000"
-                             shadedown="-3"
-                             shadetop="7"
-                             show_shaded="TRUE"
-                             text="#c3bfb7"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#3c3b37ff"
-                             inner_sel="#3c3b37ff"
-                             item="#cbc3bbff"
-                             outline="#000000"
-                             shadedown="-17"
-                             shadetop="17"
-                             show_shaded="TRUE"
-                             text="#dfdbcf"
-                             text_sel="#f47421">
-          </ThemeWidgetColors>
-        </wcol_tool>
-        <wcol_tooltip>
-          <ThemeWidgetColors inner="#191919e6"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ff5d0d">
-          </ThemeWidgetColors>
-        </wcol_tooltip>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences>
+      </ThemeConsole>
+    </console>
+    <clip_editor>
+      <ThemeClipEditor marker_outline="#000000"
+                       marker="#76243b"
+                       active_marker="#ffffff"
+                       selected_marker="#d5ff00"
+                       disabled_marker="#7f0000"
+                       locked_marker="#7f7f7f"
+                       path_before="#ff5100"
+                       path_after="#19b6ee"
+                       grid="#302e2c"
+                       frame_current="#f47421"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="4"
+                       strips="#0c0a0a"
+                       strips_selected="#ff8c00">
         <space>
-          <ThemeSpaceGeneric header="#3c3b37"
-                             header_text="#d3d2cd"
-                             header_text_hi="#ffffff"
-                             button="#696965"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#ccccc8"
+          <ThemeSpaceGeneric back="#131311"
+                             title="#9c9c9c"
+                             text="#9c9c9c"
                              text_hi="#ffffff"
-                             title="#000000"
-                             back="#3c3b37">
+                             header="#464541"
+                             header_text="#9c9c9c"
+                             header_text_hi="#ffffff"
+                             button="#3c3b37"
+                             button_title="#9c9c9c"
+                             button_text="#ffffff"
+                             button_text_hi="#ffffff">
           </ThemeSpaceGeneric>
         </space>
-      </ThemeUserPreferences>
-    </user_preferences>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_title="#000000"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeClipEditor>
+    </clip_editor>
     <bone_color_sets>
-      <ThemeBoneColorSet active="#f74700"
-                         show_colored_constraints="FALSE"
-                         normal="#9a2400"
-                         select="#bd3000">
+      <ThemeBoneColorSet normal="#9a2400"
+                         select="#bd3000"
+                         active="#f74700"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ff9248"
-                         show_colored_constraints="FALSE"
-                         normal="#ff5d06"
-                         select="#ff7b20">
+      <ThemeBoneColorSet normal="#ff5d06"
+                         select="#ff7b20"
+                         active="#ff9248"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#c9ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#7f9103"
-                         select="#a8b700">
+      <ThemeBoneColorSet normal="#7f9103"
+                         select="#a8b700"
+                         active="#c9ef1d"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#95f5ff"
-                         show_colored_constraints="FALSE"
-                         normal="#19a3d5"
-                         select="#00d9ee">
+      <ThemeBoneColorSet normal="#19a3d5"
+                         select="#00d9ee"
+                         active="#95f5ff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="TRUE"
-                         normal="#a9294e"
-                         select="#c1416a">
+      <ThemeBoneColorSet normal="#a9294e"
+                         select="#c1416a"
+                         active="#f05d91"
+                         show_colored_constraints="TRUE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
+      <ThemeBoneColorSet normal="#430c78"
+                         select="#543aa3"
+                         active="#8764d5"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
+      <ThemeBoneColorSet normal="#24785a"
+                         select="#3c9579"
+                         active="#6fb6ab"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
+      <ThemeBoneColorSet normal="#4b707c"
+                         select="#6a8691"
+                         active="#9bc2cd"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
+      <ThemeBoneColorSet normal="#f4c90c"
+                         select="#eec236"
+                         active="#f3ff00"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
+      <ThemeBoneColorSet normal="#1e2024"
+                         select="#484c56"
+                         active="#ffffff"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
+      <ThemeBoneColorSet normal="#6f2f6a"
+                         select="#9845be"
+                         active="#d330d6"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
+      <ThemeBoneColorSet normal="#6c8e22"
+                         select="#7fb022"
+                         active="#bbef5b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
+      <ThemeBoneColorSet normal="#8d8d8d"
+                         select="#b0b0b0"
+                         active="#dedede"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
+      <ThemeBoneColorSet normal="#834326"
+                         select="#8b5811"
+                         active="#bd6a11"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
+      <ThemeBoneColorSet normal="#08310e"
+                         select="#1c430b"
+                         active="#34622b"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
+      <ThemeBoneColorSet normal="#000000"
+                         select="#000000"
+                         active="#000000"
+                         show_colored_constraints="FALSE">
       </ThemeBoneColorSet>
     </bone_color_sets>
   </Theme>
diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py
index fe011a5..ec8efc8 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -133,42 +133,42 @@ kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
 kmi.properties.data_path = 'space_data.viewport_shade'
 kmi.properties.value_1 = 'TEXTURED'
 kmi.properties.value_2 = 'SOLID'
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE')
 kmi.properties.extend = False
 kmi.properties.center = False
 kmi.properties.object = False
 kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True)
 kmi.properties.extend = True
 kmi.properties.center = False
 kmi.properties.object = False
 kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True)
 kmi.properties.extend = False
 kmi.properties.center = True
 kmi.properties.object = False
 kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', alt=True)
 kmi.properties.extend = False
 kmi.properties.center = False
 kmi.properties.object = False
 kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True)
 kmi.properties.extend = True
 kmi.properties.center = True
 kmi.properties.object = False
 kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True, alt=True)
 kmi.properties.extend = False
 kmi.properties.center = True
 kmi.properties.object = False
 kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, alt=True)
 kmi.properties.extend = True
 kmi.properties.center = False
 kmi.properties.object = False
 kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True, alt=True)
 kmi.properties.extend = True
 kmi.properties.center = True
 kmi.properties.object = False
@@ -366,7 +366,7 @@ kmi = km.keymap_items.new('mesh.split', 'Y', 'PRESS')
 kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
 kmi = km.keymap_items.new('mesh.delete', 'X', 'PRESS')
 kmi = km.keymap_items.new('mesh.delete', 'DEL', 'PRESS')
-kmi = km.keymap_items.new('mesh.knifetool', 'LEFTMOUSE', 'PRESS', key_modifier='K')
+kmi = km.keymap_items.new('mesh.knife_tool', 'LEFTMOUSE', 'PRESS', key_modifier='K')
 # BMESH_TODO: midpoints for knife were moved to modal keymap
 #kmi = km.keymap_items.new('mesh.knifetool', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
 #kmi.properties.type = 'MIDPOINTS'
diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py
index 7da4d8a..552247f 100644
--- a/release/scripts/startup/bl_operators/add_mesh_torus.py
+++ b/release/scripts/startup/bl_operators/add_mesh_torus.py
@@ -133,13 +133,15 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
             )
 
     def execute(self, context):
+        grid_scale = object_utils.object_add_grid_scale(context)
+
         if self.use_abso is True:
             extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5
             self.major_radius = self.abso_minor_rad + extra_helper
             self.minor_radius = extra_helper
 
-        verts_loc, faces = add_torus(self.major_radius,
-                                     self.minor_radius,
+        verts_loc, faces = add_torus(self.major_radius * grid_scale,
+                                     self.minor_radius * grid_scale,
                                      self.major_segments,
                                      self.minor_segments)
 
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 0740692..ce328b8 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -224,7 +224,7 @@ class ProjectApply(Operator):
         image_name = ProjectEdit._proj_hack[0]  # TODO, deal with this nicer
 
         try:
-            image = bpy.data.images[image_name]
+            image = bpy.data.images[image_name, None]
         except KeyError:
             import traceback
             traceback.print_exc()
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 4e90f2e..9e449f3 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -665,15 +665,60 @@ class TransformsToDeltasAnim(Operator):
         return (obs is not None)
 
     def execute(self, context):
+        # map from standard transform paths to "new" transform paths
+        STANDARD_TO_DELTA_PATHS = {
+            "location"             : "delta_location",
+            "rotation_euler"       : "delta_rotation_euler",
+            "rotation_quaternion"  : "delta_rotation_quaternion",
+            #"rotation_axis_angle" : "delta_rotation_axis_angle",
+            "scale"                : "delta_scale"
+        }
+        DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
+        
+        # try to apply on each selected object
+        success = False
         for obj in context.selected_editable_objects:
-            # get animation data
             adt = obj.animation_data
             if (adt is None) or (adt.action is None):
                 self.report({'WARNING'},
                             "No animation data to convert on object: %r" %
                             obj.name)
                 continue
-
+            
+            # first pass over F-Curves: ensure that we don't have conflicting
+            # transforms already (e.g. if this was applied already) [#29110]
+            existingFCurves = {}
+            for fcu in adt.action.fcurves:
+                # get "delta" path - i.e. the final paths which may clash
+                path = fcu.data_path
+                if path in STANDARD_TO_DELTA_PATHS:
+                    # to be converted - conflicts may exist...
+                    dpath = STANDARD_TO_DELTA_PATHS[path]
+                elif path in DELTA_PATHS:
+                    # already delta - check for conflicts...
+                    dpath = path
+                else:
+                    # non-transform - ignore
+                    continue
+                    
+                # a delta path like this for the same index shouldn't
+                # exist already, otherwise we've got a conflict
+                if dpath in existingFCurves:
+                    # ensure that this index hasn't occurred before
+                    if fcu.array_index in existingFCurves[dpath]:
+                        # conflict
+                        self.report({'ERROR'},
+                            "Object '%r' already has '%r' F-Curve(s). Remove these before trying again" %
+                            (obj.name, dpath))
+                        return {'CANCELLED'}
+                    else:
+                        # no conflict here
+                        existingFCurves[dpath] += [fcu.array_index]
+                else:
+                    # no conflict yet
+                    existingFCurves[dpath] = [fcu.array_index]
+                
+            
             # if F-Curve uses standard transform path
             # just append "delta_" to this path
             for fcu in adt.action.fcurves:
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index 35b496b..cd0b63a 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -299,7 +299,6 @@ class QuickSmoke(Operator):
     style = EnumProperty(
             name="Smoke Style",
             items=(('STREAM', "Stream", ""),
-                   ('PUFF', "Puff", ""),
                    ('FIRE', "Fire", ""),
                    ),
             default='STREAM',
@@ -328,20 +327,9 @@ class QuickSmoke(Operator):
             bpy.ops.object.modifier_add(fake_context, type='SMOKE')
             obj.modifiers[-1].smoke_type = 'FLOW'
 
-            psys = obj.particle_systems[-1]
-            if self.style == 'PUFF':
-                psys.settings.frame_end = psys.settings.frame_start
-                psys.settings.emit_from = 'VOLUME'
-                psys.settings.distribution = 'RAND'
-            elif self.style == 'FIRE':
-                psys.settings.effector_weights.gravity = -1
-                psys.settings.lifetime = 5
-                psys.settings.count = 100000
-
-                obj.modifiers[-2].flow_settings.initial_velocity = True
-                obj.modifiers[-2].flow_settings.temperature = 2
-
-            psys.settings.use_render_emitter = self.show_flows
+            if self.style == 'FIRE':
+                obj.modifiers[-1].flow_settings.smoke_flow_type = 'FIRE'
+
             if not self.show_flows:
                 obj.draw_type = 'WIRE'
 
@@ -361,8 +349,6 @@ class QuickSmoke(Operator):
         bpy.ops.object.modifier_add(type='SMOKE')
         obj.modifiers[-1].smoke_type = 'DOMAIN'
         if self.style == 'FIRE':
-            obj.modifiers[-1].domain_settings.use_dissolve_smoke = True
-            obj.modifiers[-1].domain_settings.dissolve_speed = 20
             obj.modifiers[-1].domain_settings.use_high_resolution = True
 
         # create a volume material with a voxel data texture for the domain
@@ -373,6 +359,7 @@ class QuickSmoke(Operator):
         mat.type = 'VOLUME'
         mat.volume.density = 0
         mat.volume.density_scale = 5
+        mat.volume.step_size = 0.1
 
         tex = bpy.data.textures.new("Smoke Density", 'VOXEL_DATA')
         tex.voxel_data.domain_object = obj
@@ -381,29 +368,35 @@ class QuickSmoke(Operator):
         tex_slot.texture = tex
         tex_slot.use_map_color_emission = False
         tex_slot.use_map_density = True
+        tex_slot.use_map_color_reflection = True
 
-        # for fire add a second texture for emission and emission color
-        if self.style == 'FIRE':
-            mat.volume.emission = 5
-            tex = bpy.data.textures.new("Smoke Heat", 'VOXEL_DATA')
-            tex.voxel_data.domain_object = obj
-            tex.use_color_ramp = True
-
-            tex_slot = mat.texture_slots.add()
-            tex_slot.texture = tex
-
-            ramp = tex.color_ramp
-
-            elem = ramp.elements.new(0.333)
-            elem.color[0] = elem.color[3] = 1
-            elem.color[1] = elem.color[2] = 0
+        # for fire add a second texture for flame emission
+        mat.volume.emission_color = Vector((0.0, 0.0, 0.0))
+        tex = bpy.data.textures.new("Flame", 'VOXEL_DATA')
+        tex.voxel_data.domain_object = obj
+        tex.voxel_data.smoke_data_type = 'SMOKEFLAME'
+        tex.use_color_ramp = True
 
-            elem = ramp.elements.new(0.666)
-            elem.color[0] = elem.color[1] = elem.color[3] = 1
-            elem.color[2] = 0
+        tex_slot = mat.texture_slots.add()
+        tex_slot.texture = tex
 
-            mat.texture_slots[1].use_map_emission = True
-            mat.texture_slots[1].blend_type = 'MULTIPLY'
+        # add color ramp for flame color
+        ramp = tex.color_ramp
+        # dark orange
+        elem = ramp.elements.new(0.333)
+        elem.color[0] = 0.2
+        elem.color[1] = 0.03
+        elem.color[2] = 0
+        elem.color[3] = 1
+        # yellow glow
+        elem = ramp.elements.new(0.666)
+        elem.color[0] = elem.color[3] = 1
+        elem.color[1] = 0.65
+        elem.color[2] = 0.25
+
+        mat.texture_slots[1].use_map_density = True
+        mat.texture_slots[1].use_map_emission = True
+        mat.texture_slots[1].emission_factor = 5
 
         return {'FINISHED'}
 
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 5482912..ee9769d 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -185,10 +185,12 @@ class ExecutePreset(Operator):
 
     filepath = StringProperty(
             subtype='FILE_PATH',
+            options={'SKIP_SAVE'},
             )
     menu_idname = StringProperty(
             name="Menu ID Name",
             description="ID name of the menu this was called from",
+            options={'SKIP_SAVE'},
             )
 
     def execute(self, context):
@@ -504,7 +506,7 @@ class AddPresetKeyconfig(AddPresetBase, Operator):
 
 
 class AddPresetOperator(AddPresetBase, Operator):
-    """Add an Application Interaction Preset"""
+    """Add an Operator Preset"""
     bl_idname = "wm.operator_preset_add"
     bl_label = "Operator Preset"
     preset_menu = "WM_MT_operator_presets"
@@ -512,7 +514,7 @@ class AddPresetOperator(AddPresetBase, Operator):
     operator = StringProperty(
             name="Operator",
             maxlen=64,
-            options={'HIDDEN'},
+            options={'HIDDEN', 'SKIP_SAVE'},
             )
 
     preset_defines = [
@@ -552,6 +554,12 @@ class WM_MT_operator_presets(Menu):
 
     def draw(self, context):
         self.operator = context.active_operator.bl_idname
+
+        # dummy 'default' menu item
+        layout = self.layout
+        layout.operator("wm.operator_defaults")
+        layout.separator()
+
         Menu.draw_preset(self, context)
 
     @property
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
index 694412e..6d1f35f 100644
--- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
+++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
@@ -116,8 +116,12 @@ class PlayRenderedAnim(Operator):
         cmd = [player_path]
         # extra options, fps controls etc.
         if preset in {'BLENDER24', 'INTERNAL'}:
-            opts = ["-a", "-f", str(rd.fps), str(rd.fps_base),
-                    "-j", str(scene.frame_step), file]
+            opts = ["-a",
+                    "-f", str(rd.fps), str(rd.fps_base),
+                    "-s", str(scene.frame_start),
+                    "-e", str(scene.frame_end),
+                    "-j", str(scene.frame_step),
+                    file]
             cmd.extend(opts)
         elif preset == 'DJV':
             opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)]
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
index b60b525..727c4ad 100644
--- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -26,195 +26,124 @@ from bpy.types import Operator
 
 
 def extend(obj, operator, EXTEND_MODE):
-    from bpy_extras import mesh_utils
-
+    import bmesh
     me = obj.data
-    me_verts = me.vertices
-
     # script will fail without UVs
     if not me.uv_textures:
         me.uv_textures.new()
+    
+    bm = bmesh.from_edit_mesh(me)
+    
+    f_act = bm.faces.active
+    uv_act = bm.loops.layers.uv.active
+    
+    if f_act is None:
+        operator.report({'ERROR'}, "No active face")
+        return
+    elif len(f_act.verts) != 4:
+        operator.report({'ERROR'}, "Active face must be a quad")
+        return
 
-    # Toggle Edit mode
-    is_editmode = (obj.mode == 'EDIT')
-    if is_editmode:
-        bpy.ops.object.mode_set(mode='OBJECT')
-
-    #t = sys.time()
-    edge_average_lengths = {}
-
-    OTHER_INDEX = 2, 3, 0, 1
-
-    def extend_uvs(face_source, face_target, edge_key):
-        """
-        Takes 2 faces,
-        Projects its extends its UV coords onto the face next to it.
-        Both faces must share an edge
-        """
-
-        def face_edge_vs(vi):
-            vlen = len(vi)
-            return [(vi[i], vi[(i + 1) % vlen]) for i in range(vlen)]
-
-        vidx_source = face_source.vertices
-        vidx_target = face_target.vertices
-
-        uv_layer = me.uv_layers.active.data
-        uvs_source = [uv_layer[i].uv for i in face_source.loop_indices]
-        uvs_target = [uv_layer[i].uv for i in face_target.loop_indices]
-
-        # vertex index is the key, uv is the value
-
-        uvs_vhash_source = {vindex: uvs_source[i] for i, vindex in enumerate(vidx_source)}
-
-        uvs_vhash_target = {vindex: uvs_target[i] for i, vindex in enumerate(vidx_target)}
-
-        edge_idxs_source = face_edge_vs(vidx_source)
-        edge_idxs_target = face_edge_vs(vidx_target)
-
-        source_matching_edge = -1
-        target_matching_edge = -1
-
-        edge_key_swap = edge_key[1], edge_key[0]
-
-        try:
-            source_matching_edge = edge_idxs_source.index(edge_key)
-        except:
-            source_matching_edge = edge_idxs_source.index(edge_key_swap)
-        try:
-            target_matching_edge = edge_idxs_target.index(edge_key)
-        except:
-            target_matching_edge = edge_idxs_target.index(edge_key_swap)
-
-        edgepair_inner_source = edge_idxs_source[source_matching_edge]
-        edgepair_inner_target = edge_idxs_target[target_matching_edge]
-        edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
-        edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_matching_edge]]
-
-        if edge_idxs_source[source_matching_edge] == edge_idxs_target[target_matching_edge]:
-            iA = 0  # Flipped, most common
-            iB = 1
-        else:  # The normals of these faces must be different
-            iA = 1
-            iB = 0
+    faces = [f for f in bm.faces if f.select and len(f.verts) == 4]
+
+    for f in faces:
+        f.tag = False
+    f_act.tag = True
+
+
+    # our own local walker
+    def walk_face(f):
+        # all faces in this list must be tagged
+        f.tag = True
+        faces_a = [f]
+        faces_b = []
+
+        while faces_a:
+            for f in faces_a:
+                for l in f.loops:
+                    l_edge = l.edge
+                    if (l_edge.is_manifold is True) and (l_edge.seam is False):
+                        l_other = l.link_loop_radial_next
+                        f_other = l_other.face
+                        if not f_other.tag:
+                            yield (f, l, f_other)
+                            f_other.tag = True
+                            faces_b.append(f_other)
+            # swap
+            faces_a, faces_b = faces_b, faces_a
+            faces_b.clear()
+
+    def extrapolate_uv(fac,
+                       l_a_outer, l_a_inner,
+                       l_b_outer, l_b_inner):
+        l_b_inner[:] = l_a_inner
+        l_b_outer[:] = l_a_inner + ((l_a_inner - l_a_outer) * fac)
+
+    def apply_uv(f_prev, l_prev, f_next):
+        l_a = [None, None, None, None]
+        l_b = [None, None, None, None]
+        
+        l_a[0] = l_prev
+        l_a[1] = l_a[0].link_loop_next
+        l_a[2] = l_a[1].link_loop_next
+        l_a[3] = l_a[2].link_loop_next
+
+        #  l_b
+        #  +-----------+
+        #  |(3)        |(2)
+        #  |           |
+        #  |l_next(0)  |(1)
+        #  +-----------+
+        #        ^
+        #  l_a   |
+        #  +-----------+
+        #  |l_prev(0)  |(1)
+        #  |    (f)    |
+        #  |(3)        |(2)
+        #  +-----------+
+        #  copy from this face to the one above.
+
+        # get the other loops 
+        l_next = l_prev.link_loop_radial_next
+        if l_next.vert != l_prev.vert:
+            l_b[1] = l_next
+            l_b[0] = l_b[1].link_loop_next
+            l_b[3] = l_b[0].link_loop_next
+            l_b[2] = l_b[3].link_loop_next
+        else:
+            l_b[0] = l_next
+            l_b[1] = l_b[0].link_loop_next
+            l_b[2] = l_b[1].link_loop_next
+            l_b[3] = l_b[2].link_loop_next
 
-        # Set the target UV's touching source face, no tricky calculations needed,
-        uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
-        uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
+        l_a_uv = [l[uv_act].uv for l in l_a]
+        l_b_uv = [l[uv_act].uv for l in l_b]
 
-        # Set the 2 UV's on the target face that are not touching
-        # for this we need to do basic expanding on the source faces UV's
         if EXTEND_MODE == 'LENGTH':
+            a0, b0, c0 = l_a[3].vert.co, l_a[0].vert.co, l_b[3].vert.co
+            a1, b1, c1 = l_a[2].vert.co, l_a[1].vert.co, l_b[2].vert.co
 
-            try:  # divide by zero is possible
-                '''
-                measure the length of each face from the middle of each edge to the opposite
-                along the axis we are copying, use this
-                '''
-                i1a = edgepair_outer_target[iB]
-                i2a = edgepair_inner_target[iA]
-                if i1a > i2a:
-                    i1a, i2a = i2a, i1a
-
-                i1b = edgepair_outer_source[iB]
-                i2b = edgepair_inner_source[iA]
-                if i1b > i2b:
-                    i1b, i2b = i2b, i1b
-                # print edge_average_lengths
-                factor = edge_average_lengths[i1a, i2a][0] / edge_average_lengths[i1b, i2b][0]
-            except:
-                # Div By Zero?
-                factor = 1.0
-
-            uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + factor * (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
-            uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + factor * (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
-
+            d1 = (a0 - b0).length + (a1 - b1).length
+            d2 = (b0 - c0).length + (b1 - c1).length
+            try:
+                fac = d2 / d1
+            except ZeroDivisionError:
+                fac = 1.0
         else:
-            # same as above but with no factors
-            uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
-            uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
+            fac = 1.0
 
-    face_act = me.polygons.active
-    if face_act == -1:
-        operator.report({'ERROR'}, "No active face")
-        return
+        extrapolate_uv(fac,
+                       l_a_uv[3], l_a_uv[0],
+                       l_b_uv[3], l_b_uv[0])
 
-    face_sel = [f for f in me.polygons if len(f.vertices) == 4 and f.select]
+        extrapolate_uv(fac,
+                       l_a_uv[2], l_a_uv[1],
+                       l_b_uv[2], l_b_uv[1])
 
-    face_act_local_index = -1
-    for i, f in enumerate(face_sel):
-        if f.index == face_act:
-            face_act_local_index = i
-            break
+    for f_triple in walk_face(f_act):
+        apply_uv(*f_triple)
 
-    if face_act_local_index == -1:
-        operator.report({'ERROR'}, "Active face not selected")
-        return
-
-    # Modes
-    # 0 not yet searched for.
-    # 1:mapped, use search from this face - removed!
-    # 2:all siblings have been searched. don't search again.
-    face_modes = [0] * len(face_sel)
-    face_modes[face_act_local_index] = 1  # extend UV's from this face.
-
-    # Edge connectivity
-    edge_faces = {}
-    for i, f in enumerate(face_sel):
-        for edkey in f.edge_keys:
-            try:
-                edge_faces[edkey].append(i)
-            except:
-                edge_faces[edkey] = [i]
-
-    if EXTEND_MODE == 'LENGTH':
-        edge_loops = mesh_utils.edge_loops_from_tessfaces(me, face_sel, [ed.key for ed in me.edges if ed.use_seam])
-        me_verts = me.vertices
-        for loop in edge_loops:
-            looplen = [0.0]
-            for ed in loop:
-                edge_average_lengths[ed] = looplen
-                looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
-            looplen[0] = looplen[0] / len(loop)
-
-    # remove seams, so we don't map across seams.
-    for ed in me.edges:
-        if ed.use_seam:
-            # remove the edge pair if we can
-            try:
-                del edge_faces[ed.key]
-            except:
-                pass
-    # Done finding seams
-
-    # face connectivity - faces around each face
-    # only store a list of indices for each face.
-    face_faces = [[] for i in range(len(face_sel))]
-
-    for edge_key, faces in edge_faces.items():
-        if len(faces) == 2:  # Only do edges with 2 face users for now
-            face_faces[faces[0]].append((faces[1], edge_key))
-            face_faces[faces[1]].append((faces[0], edge_key))
-
-    # Now we know what face is connected to what other face, map them by connectivity
-    ok = True
-    while ok:
-        ok = False
-        for i in range(len(face_sel)):
-            if face_modes[i] == 1:  # searchable
-                for f_sibling, edge_key in face_faces[i]:
-                    if face_modes[f_sibling] == 0:
-                        face_modes[f_sibling] = 1  # mapped and search from.
-                        extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
-                        face_modes[i] = 1  # we can map from this one now.
-                        ok = True  # keep searching
-
-                face_modes[i] = 2  # don't search again
-
-    if is_editmode:
-        bpy.ops.object.mode_set(mode='EDIT')
-    else:
-        me.update_tag()
+    bmesh.update_edit_mesh(me, False)
 
 
 def main(context, operator):
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 526d78c..198b366 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -552,7 +552,7 @@ class LightMapPack(Operator):
     # Disable REGISTER flag for now because this operator might create new
     # images. This leads to non-proper operator redo because current undo
     # stack is local for edit mode and can not remove images created by this
-    # oprtator.
+    # operator.
     # Proper solution would be to make undo stack aware of such things,
     # but for now just disable redo. Keep undo here so unwanted changes to uv
     # coords might be undone.
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 9fa44ca..160ca5c 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -23,7 +23,7 @@ import bpy
 from bpy.types import Operator
 
 DEG_TO_RAD = 0.017453292519943295 # pi/180.0
-SMALL_NUM = 0.000000001
+SMALL_NUM = 0.0000001  # see bug [#31598] why we dont have smaller values
 BIG_NUM = 1e15
 
 global USER_FILL_HOLES
@@ -517,7 +517,7 @@ def mergeUvIslands(islandList):
                                     for uv in f.uv:
                                         uv+= offset
 
-                                sourceIsland[0][:] = [] # Empty
+                                del sourceIsland[0][:]  # Empty
 
 
                                 # Move edge loop into new and offset.
@@ -527,7 +527,7 @@ def mergeUvIslands(islandList):
                                      (e[0]+offset, e[1]+offset, e[2])\
                                 ) for e in sourceIsland[6] ] )
 
-                                sourceIsland[6][:] = [] # Empty
+                                del sourceIsland[6][:]  # Empty
 
                                 # Sort by edge length, reverse so biggest are first.
 
@@ -540,7 +540,7 @@ def mergeUvIslands(islandList):
                                 for p in sourceIsland[7]:
                                     p+= offset
 
-                                sourceIsland[7][:] = []
+                                del sourceIsland[7][:]
 
 
                                 # Decrement the efficiency
@@ -759,7 +759,7 @@ class thickface(object):
         self.v = [mesh_verts[i] for i in face.vertices]
         self.uv = [uv_layer[i].uv for i in face.loop_indices]
 
-        self.no = face.normal
+        self.no = face.normal.copy()
         self.area = face.area
         self.edge_keys = face.edge_keys
 
@@ -993,7 +993,7 @@ def main(context,
             if mostUniqueAngle < USER_PROJECTION_LIMIT_CONVERTED:
                 #print 'adding', mostUniqueAngle, USER_PROJECTION_LIMIT, len(newProjectMeshFaces)
                 # Now weight the vector to all its faces, will give a more direct projection
-                # if the face its self was not representive of the normal from surrounding faces.
+                # if the face its self was not representative of the normal from surrounding faces.
 
                 newProjectVec = tempMeshFaces[mostUniqueIndex].no
                 newProjectMeshFaces = [tempMeshFaces.pop(mostUniqueIndex)]
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index eac90a8..105b532 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -41,12 +41,17 @@ class MESH_OT_delete_edgeloop(Operator):
         return bpy.ops.transform.edge_slide.poll()
 
     def execute(self, context):
+        mesh = context.object.data
+        use_mirror_x = mesh.use_mirror_x
+        mesh.use_mirror_x = False
         if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
             bpy.ops.mesh.select_more()
             bpy.ops.mesh.remove_doubles()
-            return {'FINISHED'}
-
-        return {'CANCELLED'}
+            ret = {'FINISHED'}
+        else:
+            ret = {'CANCELLED'}
+        mesh.use_mirror_x = use_mirror_x
+        return ret
 
 rna_path_prop = StringProperty(
         name="Context Attributes",
@@ -1044,6 +1049,8 @@ class WM_OT_properties_edit(Operator):
 
         try:
             value_eval = eval(value)
+            # assert else None -> None, not "None", see [#33431]
+            assert(type(value_eval) in {str, float, int, bool, tuple, list})
         except:
             value_eval = value
 
@@ -1124,9 +1131,15 @@ class WM_OT_properties_add(Operator):
 
             return prop_new
 
-        property = unique_name(item.keys())
+        prop = unique_name(item.keys())
+
+        item[prop] = 1.0
+
+        # not essential, but without this we get [#31661]
+        prop_ui = rna_idprop_ui_prop_get(item, prop)
+        prop_ui["soft_min"] = prop_ui["min"] = 0.0
+        prop_ui["soft_max"] = prop_ui["max"] = 1.0
 
-        item[property] = 1.0
         return {'FINISHED'}
 
 
@@ -1284,7 +1297,7 @@ class WM_OT_blenderplayer_start(Operator):
             return {'CANCELLED'}
 
         filepath = os.path.join(bpy.app.tempdir, "game.blend")
-        bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
+        bpy.ops.wm.save_as_mainfile('EXEC_DEFAULT', filepath=filepath, copy=True)
         subprocess.call([player_path, filepath])
         return {'FINISHED'}
 
@@ -1668,7 +1681,7 @@ class WM_OT_theme_install(Operator):
 class WM_OT_addon_install(Operator):
     "Install an addon"
     bl_idname = "wm.addon_install"
-    bl_label = "Install Addon..."
+    bl_label = "Install from File..."
 
     overwrite = BoolProperty(
             name="Overwrite",
@@ -1773,12 +1786,6 @@ class WM_OT_addon_install(Operator):
 
             try:  # extract the file to "addons"
                 file_to_extract.extractall(path_addons)
-
-                # zip files can create this dir with metadata, don't need it
-                macosx_dir = os.path.join(path_addons, '__MACOSX')
-                if os.path.isdir(macosx_dir):
-                    shutil.rmtree(macosx_dir)
-
             except:
                 traceback.print_exc()
                 return {'CANCELLED'}
@@ -1822,8 +1829,11 @@ class WM_OT_addon_install(Operator):
         # in case a new module path was created to install this addon.
         bpy.utils.refresh_script_paths()
 
-        # TODO, should not be a warning.
-        #~ self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
+        # print message
+        msg = "Modules Installed from %r into %r (%s)" % (pyfile, path_addons, ", ".join(sorted(addons_new)))
+        print(msg)
+        self.report({'INFO'}, msg)
+
         return {'FINISHED'}
 
     def invoke(self, context, event):
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 09d866c..e4be84d 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -92,9 +92,10 @@ def register():
     def addon_filter_items(self, context):
         import addon_utils
 
-        items = [('All', "All", ""),
-                 ('Enabled', "Enabled", ""),
-                 ('Disabled', "Disabled", ""),
+        items = [('All', "All", "All Addons"),
+                 ('User', "User", "All Addons Installed by User"),
+                 ('Enabled', "Enabled", "All Enabled Addons"),
+                 ('Disabled', "Disabled", "All Disabled Addons"),
                  ]
 
         items_unique = set()
@@ -119,7 +120,7 @@ def register():
     WindowManager.addon_support = EnumProperty(
             items=[('OFFICIAL', "Official", "Officially supported"),
                    ('COMMUNITY', "Community", "Maintained by community developers"),
-                   ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"),
+                   ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
                    ],
             name="Support",
             description="Display support level",
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 50c34be..845beb0 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -239,7 +239,7 @@ class DATA_PT_ghost(ArmatureButtonsPanel, Panel):
 
 
 class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
-    bl_label = "iTaSC parameters"
+    bl_label = "Inverse Kinematics"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 1e70483..fdaee6b 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -244,74 +244,75 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
         pchan = ob.pose.bones[bone.name]
 
         row = layout.row()
-        row.prop(ob.pose, "ik_solver")
+
+        active = pchan.is_in_ik_chain
 
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_x", icon='LOCKED' if pchan.lock_ik_x else 'UNLOCKED', text="X")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
-        row.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
+        row.active = pchan.lock_ik_x is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_x", text="Limit")
-        sub.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_x is False and active
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_x", text="")
         sub.prop(pchan, "ik_max_x", text="")
-        sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and active
 
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
-        row.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
+        row.active = pchan.lock_ik_y is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_y", text="Limit")
-        sub.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_y is False and active
 
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_y", text="")
         sub.prop(pchan, "ik_max_y", text="")
-        sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and active
 
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         sub = split.row()
         sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
-        sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_z", text="Limit")
-        sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and active
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_z", text="")
         sub.prop(pchan, "ik_max_z", text="")
-        sub.active = pchan.lock_ik_z is False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and pchan.use_ik_limit_z and active
 
         split = layout.split(percentage=0.25)
         split.label(text="Stretch:")
         sub = split.row()
         sub.prop(pchan, "ik_stretch", text="", slider=True)
-        sub.active = pchan.is_in_ik_chain
+        sub.active = active
 
         if ob.pose.ik_solver == 'ITASC':
             split = layout.split()
             col = split.column()
             col.prop(pchan, "use_ik_rotation_control", text="Control Rotation")
-            col.active = pchan.is_in_ik_chain
+            col.active = active
             col = split.column()
             col.prop(pchan, "ik_rotation_weight", text="Weight", slider=True)
-            col.active = pchan.is_in_ik_chain
+            col.active = active
             # not supported yet
             #row = layout.row()
             #row.prop(pchan, "use_ik_linear_control", text="Joint Size")
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 49457b8..25cecc9 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -88,7 +88,8 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
             col.prop(cam, "ortho_scale")
 
         elif cam.type == 'PANO':
-            if context.scene.render.engine == 'CYCLES':
+            engine = context.scene.render.engine
+            if engine == 'CYCLES':
                 ccam = cam.cycles
                 col.prop(ccam, "panorama_type", text="Type")
                 if ccam.panorama_type == 'FISHEYE_EQUIDISTANT':
@@ -97,6 +98,13 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
                     row = layout.row()
                     row.prop(ccam, "fisheye_lens", text="Lens")
                     row.prop(ccam, "fisheye_fov")
+            elif engine == 'BLENDER_RENDER':
+                row = col.row()
+                if cam.lens_unit == 'MILLIMETERS':
+                    row.prop(cam, "lens")
+                elif cam.lens_unit == 'DEGREES':
+                    row.prop(cam, "angle")
+                row.prop(cam, "lens_unit", text="")
 
         split = layout.split()
 
@@ -134,8 +142,12 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
         if cam.sensor_fit == 'AUTO':
             col.prop(cam, "sensor_width", text="Size")
         else:
-            col.prop(cam, "sensor_width", text="Width")
-            col.prop(cam, "sensor_height", text="Height")
+            sub = col.column()
+            sub.active = cam.sensor_fit == 'HORIZONTAL'
+            sub.prop(cam, "sensor_width", text="Width")
+            sub = col.column()
+            sub.active = cam.sensor_fit == 'VERTICAL'
+            sub.prop(cam, "sensor_height", text="Height")
 
         col = split.column(align=True)
         col.prop(cam, "sensor_fit", text="")
@@ -175,7 +187,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
         col = split.column()
         col.prop(cam, "show_limits", text="Limits")
         col.prop(cam, "show_mist", text="Mist")
-        col.prop(cam, "show_title_safe", text="Title Safe")
+        col.prop(cam, "show_title_safe", text="Safe Areas")
         col.prop(cam, "show_sensor", text="Sensor")
         col.prop(cam, "show_name", text="Name")
 
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index a8f4aa3..7747ef4 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -174,11 +174,14 @@ class DATA_PT_geometry_curve(CurveButtonsPanel, Panel):
         col.prop(curve, "bevel_object", text="")
 
         col = layout.column(align=True)
-        col.active = (curve.bevel_object is not None)
-        col.prop(curve, "use_fill_caps")
         col.prop(curve, "bevel_factor_start")
         col.prop(curve, "bevel_factor_end")
 
+        row = col.row()
+        row.active = (curve.bevel_object is not None)
+        row.prop(curve, "use_fill_caps")
+        row.prop(curve, "use_map_taper")
+
 
 class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel):
     bl_label = "Path Animation"
diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py
index 769715e..71fdc1d 100644
--- a/release/scripts/startup/bl_ui/properties_data_lamp.py
+++ b/release/scripts/startup/bl_ui/properties_data_lamp.py
@@ -118,7 +118,7 @@ class DATA_PT_lamp(DataButtonsPanel, Panel):
 
 class DATA_PT_sunsky(DataButtonsPanel, Panel):
     bl_label = "Sky & Atmosphere"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0398cb3..62461d8 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -211,7 +211,22 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.row().prop(md, "deform_axis", expand=True)
 
     def DECIMATE(self, layout, ob, md):
-        layout.prop(md, "ratio")
+        row = layout.row()
+        row.prop(md, "decimate_type", expand=True)
+        decimate_type = md.decimate_type
+
+        if decimate_type == 'COLLAPSE':
+            layout.prop(md, "ratio")
+            row = layout.row()
+            row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+            row.prop(md, "invert_vertex_group")
+            layout.prop(md, "use_collapse_triangulate")
+        elif decimate_type == 'UNSUBDIV':
+            layout.prop(md, "iterations")
+        else:  # decimate_type == 'DISSOLVE':
+            layout.prop(md, "angle_limit")
+            layout.prop(md, "use_dissolve_boundaries")
+
         layout.label(text="Face Count" + ": %d" % md.face_count)
 
     def DISPLACE(self, layout, ob, md):
@@ -316,6 +331,28 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             row.operator("object.hook_select", text="Select")
             row.operator("object.hook_assign", text="Assign")
 
+    def LAPLACIANSMOOTH(self, layout, ob, md):
+        layout.prop(md, "iterations")
+        
+        split = layout.split(percentage=0.25)
+        
+        col = split.column()
+        col.label(text="Axis:")
+        col.prop(md, "use_x")
+        col.prop(md, "use_y")
+        col.prop(md, "use_z")
+        
+        col = split.column()
+        col.label(text="Lambda:")
+        col.prop(md, "lambda_factor", text="Factor")
+        col.prop(md, "lambda_border", text="Border")
+        
+        col.separator()
+        col.prop(md, "use_volume_preserve")
+        
+        layout.label(text="Vertex Group:")
+        layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
     def LATTICE(self, layout, ob, md):
         split = layout.split()
 
@@ -588,6 +625,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "wrap_method", text="")
 
         if md.wrap_method == 'PROJECT':
+            col.prop(md, "project_limit", text="Limit")
             split = layout.split(percentage=0.25)
 
             col = split.column()
@@ -605,8 +643,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             col.label(text="Cull Faces:")
             col.prop(md, "cull_face", expand=True)
 
-            layout.label(text="Auxiliary Target:")
-            layout.prop(md, "auxiliary_target", text="")
+            layout.prop(md, "auxiliary_target")
 
         elif md.wrap_method == 'NEAREST_SURFACEPOINT':
             layout.prop(md, "use_keep_above_surface")
@@ -992,5 +1029,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "use_y_symmetry")
         col.prop(md, "use_z_symmetry")
 
+    def TRIANGULATE(self, layout, ob, md):
+        layout.prop(md, "use_beauty")
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py
index 5ff49a7..bf0c9eb 100644
--- a/release/scripts/startup/bl_ui/properties_game.py
+++ b/release/scripts/startup/bl_ui/properties_game.py
@@ -190,6 +190,14 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             layout.operator("mesh.navmesh_reset")
             layout.operator("mesh.navmesh_clear")
 
+        if physics_type not in {'NO_COLLISION', 'OCCLUDE'}:
+            layout.separator()
+            split = layout.split()
+
+            col = split.column()
+            col.prop(game, "collision_group")
+            col = split.column()
+            col.prop(game, "collision_mask")
 
 class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
     bl_label = "Collision Bounds"
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 8eecbf4..951644d 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -753,6 +753,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, Panel):
         row = sub.row()
         row.active = bool(mat.light_group)
         row.prop(mat, "use_light_group_exclusive", text="Exclusive")
+        row.prop(mat, "use_light_group_local", text="Local")
 
         col = split.column()
         col.prop(mat, "use_face_texture")
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
index fba7bd8..eb09298 100644
--- a/release/scripts/startup/bl_ui/properties_object_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -88,7 +88,6 @@ class ConstraintButtonsPanel():
 
         col = split.column()
         col.prop(con, "chain_count")
-        col.prop(con, "use_target")
 
     def CHILD_OF(self, context, layout, con):
         self.target_template(layout, con)
@@ -135,7 +134,7 @@ class ConstraintButtonsPanel():
             layout.prop(con, "ik_type")
             getattr(self, 'IK_' + con.ik_type)(context, layout, con)
         else:
-            # Legacy IK constraint
+            # Standard IK constraint
             self.target_template(layout, con)
             layout.prop(con, "pole_target")
 
@@ -152,18 +151,27 @@ class ConstraintButtonsPanel():
             col.prop(con, "iterations")
             col.prop(con, "chain_count")
 
-            col.label(text="Weight:")
-            col.prop(con, "weight", text="Position", slider=True)
-            sub = col.column()
-            sub.active = con.use_rotation
-            sub.prop(con, "orient_weight", text="Rotation", slider=True)
-
             col = split.column()
             col.prop(con, "use_tail")
             col.prop(con, "use_stretch")
-            col.separator()
-            col.prop(con, "use_target")
-            col.prop(con, "use_rotation")
+
+            layout.label(text="Weight:")
+
+            split = layout.split()
+            col = split.column()
+            row = col.row(align=True)
+            row.prop(con, "use_location", text="")
+            sub = row.row()
+            sub.active = con.use_location
+            sub.prop(con, "weight", text="Position", slider=True)
+
+            col = split.column()
+            row = col.row(align=True)
+            row.prop(con, "use_rotation", text="")
+            sub = row.row()
+            sub.active = con.use_rotation
+            sub.prop(con, "orient_weight", text="Rotation", slider=True)
+
 
     def IK_COPY_POSE(self, context, layout, con):
         self.target_template(layout, con)
@@ -485,6 +493,8 @@ class ConstraintButtonsPanel():
         row.prop(con, "use_transform_limit")
         row.label()
 
+        self.space_template(layout, con)
+
     def STRETCH_TO(self, context, layout, con):
         self.target_template(layout, con)
 
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index f29589f..3f672d2 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -148,7 +148,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
             #row.label(text="Render")
 
             if part.is_fluid:
-                layout.label(text="{} fluid particles for this frame".format(str(part.count)))
+                layout.label(text="%d fluid particles for this frame" % part.count)
                 return
 
             row = col.row()
@@ -1124,7 +1124,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
 
     def draw(self, context):
         part = particle_get_settings(context)
-        effector_weights_ui(self, context, part.effector_weights)
+        effector_weights_ui(self, context, part.effector_weights, 'PSYS')
 
         if part.type == 'HAIR':
             row = self.layout.row()
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index e5db1ee..5a44294 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -197,7 +197,7 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         cloth = context.cloth.settings
-        effector_weights_ui(self, context, cloth.effector_weights)
+        effector_weights_ui(self, context, cloth.effector_weights, 'CLOTH')
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 00a35b2..405e877 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -133,7 +133,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
             row.prop(cache, "frame_end")
         if cachetype not in {'SMOKE', 'CLOTH', 'DYNAMIC_PAINT'}:
             row.prop(cache, "frame_step")
-            row.prop(cache, "use_quick_cache")
+            
         if cachetype != 'SMOKE':
             layout.label(text=cache.info)
 
@@ -179,7 +179,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
         col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
 
 
-def effector_weights_ui(self, context, weights):
+def effector_weights_ui(self, context, weights, weight_type):
     layout = self.layout
 
     layout.prop(weights, "group")
@@ -200,6 +200,8 @@ def effector_weights_ui(self, context, weights):
     col.prop(weights, "wind", slider=True)
     col.prop(weights, "curve_guide", slider=True)
     col.prop(weights, "texture", slider=True)
+    if weight_type != 'SMOKE':
+        col.prop(weights, "smokeflow", slider=True)
 
     col = split.column()
     col.prop(weights, "harmonic", slider=True)
diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
index fa37e9c..1df2936 100644
--- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
@@ -349,7 +349,7 @@ class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel):
 
             col = layout.column()
             col.active = surface.use_drip
-            effector_weights_ui(self, context, surface.effector_weights)
+            effector_weights_ui(self, context, surface.effector_weights, 'DYNAMIC_PAINT')
 
             layout.label(text="Surface Movement:")
             row = layout.row()
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py
index 6b5612d..933a9aa 100644
--- a/release/scripts/startup/bl_ui/properties_physics_field.py
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -112,6 +112,14 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
             col = split.column()
             col.prop(field, "use_object_coords")
             col.prop(field, "use_2d_force")
+        elif field.type == 'SMOKE_FLOW':
+            col = split.column()
+            col.prop(field, "strength")
+            col.prop(field, "flow")
+            col = split.column()
+            col.label(text="Domain Object:")
+            col.prop(field, "source_object", "")
+            col.prop(field, "use_smoke_density")
         else:
             basic_force_field_settings_ui(self, context, field)
 
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index acbaad4..ce5053f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -76,28 +76,40 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
         elif md.smoke_type == 'FLOW':
 
             flow = md.flow_settings
-
-            split = layout.split()
-
-            col = split.column()
-            col.prop(flow, "use_outflow")
-            col.label(text="Particle System:")
-            col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
-
-            sub = col.column()
-            sub.active = not md.flow_settings.use_outflow
-
-            sub.prop(flow, "initial_velocity", text="Initial Velocity")
-            sub = sub.column()
-            sub.active = flow.initial_velocity
-            sub.prop(flow, "velocity_factor", text="Multiplier")
-
-            sub = split.column()
-            sub.active = not md.flow_settings.use_outflow
-            sub.label(text="Initial Values:")
-            sub.prop(flow, "use_absolute")
-            sub.prop(flow, "density")
-            sub.prop(flow, "temperature")
+            
+            layout.prop(flow, "smoke_flow_type", expand=False)
+
+            if flow.smoke_flow_type != "OUTFLOW":
+                split = layout.split()
+                col = split.column()
+                col.label(text="Flow Source:")
+                col.prop(flow, "smoke_flow_source", expand=False, text="")
+                if flow.smoke_flow_source == "PARTICLES":
+                    col.label(text="Particle System:")
+                    col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
+                else:
+                    col.prop(flow, "surface_distance")
+                    col.prop(flow, "volume_density")
+
+                sub = col.column(align=True)
+
+                sub.prop(flow, "initial_velocity")
+                sub = sub.column()
+                sub.active = flow.initial_velocity
+                sub.prop(flow, "velocity_factor")
+                if flow.smoke_flow_source == "MESH":
+                    sub.prop(flow, "velocity_normal")
+                    #sub.prop(flow, "velocity_random")
+
+                sub = split.column()
+                sub.label(text="Initial Values:")
+                sub.prop(flow, "use_absolute")
+                if flow.smoke_flow_type in {'SMOKE', 'BOTH'}:
+                    sub.prop(flow, "density")
+                    sub.prop(flow, "temperature")
+                    sub.prop(flow, "smoke_color")
+                if flow.smoke_flow_type in {'FIRE', 'BOTH'}:
+                    sub.prop(flow, "fuel_amount")
 
         elif md.smoke_type == 'COLLISION':
             coll = md.coll_settings
@@ -106,36 +118,99 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
 
             col = split.column()
             col.prop(coll, "collision_type")
+            
+class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
+    bl_label = "Smoke Flow Advanced"
+    bl_options = {'DEFAULT_CLOSED'}
 
+    @classmethod
+    def poll(cls, context):
+        md = context.smoke
+        return md and (md.smoke_type == 'FLOW') and (md.flow_settings.smoke_flow_source == "MESH")
 
-class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
-    bl_label = "Smoke Groups"
+    def draw(self, context):
+        layout = self.layout
+        ob = context.object
+        flow = context.smoke.flow_settings
+        
+        split = layout.split()
+        col = split.column()
+
+        col.prop(flow, "use_texture")
+        sub = col.column()
+        sub.active = flow.use_texture
+        sub.prop(flow, "noise_texture", text="")
+        sub.label(text="Mapping:")
+        sub.prop(flow, "texture_map_type", expand=False, text="")
+        if flow.texture_map_type == "UV":
+            sub.prop_search(flow, "uv_layer", ob.data, "uv_textures", text="")
+        if flow.texture_map_type == "AUTO":
+            sub.prop(flow, "texture_size")
+        sub.prop(flow, "texture_offset")
+        
+        col = split.column()
+        col.label(text="Vertex Group:")
+        col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
+
+class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
+    bl_label = "Smoke Flames"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
         md = context.smoke
-        rd = context.scene.render
-        return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
+        return md and (md.smoke_type == 'DOMAIN')
 
     def draw(self, context):
         layout = self.layout
-
-        group = context.smoke.domain_settings
+        domain = context.smoke.domain_settings
 
         split = layout.split()
+        split.enabled = not domain.point_cache.is_baked
+
+        col = split.column(align=True)
+        col.label(text="Reaction:")
+        col.prop(domain, "burning_rate")
+        col.prop(domain, "flame_smoke")
+        col.prop(domain, "flame_vorticity")
+
+        col = split.column(align=True)
+        col.label(text="Temperatures:")
+        col.prop(domain, "flame_ignition")
+        col.prop(domain, "flame_max_temp")
+        col.prop(domain, "flame_smoke_color")
+        
+class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
+    bl_label = "Smoke Adaptive Domain"
+    bl_options = {'DEFAULT_CLOSED'}
 
-        col = split.column()
-        col.label(text="Flow Group:")
-        col.prop(group, "fluid_group", text="")
+    @classmethod
+    def poll(cls, context):
+        md = context.smoke
+        return md and (md.smoke_type == 'DOMAIN')
 
-        #col.label(text="Effector Group:")
-        #col.prop(group, "effector_group", text="")
+    def draw_header(self, context):
+        md = context.smoke.domain_settings
 
-        col = split.column()
-        col.label(text="Collision Group:")
-        col.prop(group, "collision_group", text="")
+        self.layout.prop(md, "use_adaptive_domain", text="")
 
+    def draw(self, context):
+        layout = self.layout
+
+        domain = context.smoke.domain_settings
+        layout.active = domain.use_adaptive_domain
+        
+        split = layout.split()
+        split.enabled = not domain.point_cache.is_baked
+ 
+        col = split.column(align=True)
+        col.label(text="Resolution:")
+        col.prop(domain, "additional_res")
+        col.prop(domain, "adapt_margin")
+
+        col = split.column(align=True)
+        col.label(text="Advanced:")
+        col.prop(domain, "adapt_threshold")
 
 class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
     bl_label = "Smoke High Resolution"
@@ -174,6 +249,32 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
 
         layout.prop(md, "show_high_resolution")
 
+class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
+    bl_label = "Smoke Groups"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        md = context.smoke
+        rd = context.scene.render
+        return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
+
+    def draw(self, context):
+        layout = self.layout
+        domain = context.smoke.domain_settings
+        
+        split = layout.split()
+
+        col = split.column()
+        col.label(text="Flow Group:")
+        col.prop(domain, "fluid_group", text="")
+
+        #col.label(text="Effector Group:")
+        #col.prop(domain, "effector_group", text="")
+
+        col = split.column()
+        col.label(text="Collision Group:")
+        col.prop(domain, "collision_group", text="")
 
 class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
     bl_label = "Smoke Cache"
@@ -209,7 +310,7 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         domain = context.smoke.domain_settings
-        effector_weights_ui(self, context, domain.effector_weights)
+        effector_weights_ui(self, context, domain.effector_weights, 'SMOKE')
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py
index a69e795..79d6765 100644
--- a/release/scripts/startup/bl_ui/properties_physics_softbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -231,7 +231,7 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel):
         md = context.soft_body
         softbody = md.settings
 
-        effector_weights_ui(self, context, softbody.effector_weights)
+        effector_weights_ui(self, context, softbody.effector_weights, 'SOFTBODY')
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 544462e..9814dd7 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -332,15 +332,17 @@ class RENDER_PT_performance(RenderButtonsPanel, Panel):
         split = layout.split()
 
         col = split.column()
-        col.label(text="Threads:")
-        col.row().prop(rd, "threads_mode", expand=True)
-        sub = col.column()
-        sub.enabled = rd.threads_mode == 'FIXED'
-        sub.prop(rd, "threads")
         sub = col.column(align=True)
-        sub.label(text="Tiles:")
-        sub.prop(rd, "parts_x", text="X")
-        sub.prop(rd, "parts_y", text="Y")
+        sub.label(text="Threads:")
+        sub.row().prop(rd, "threads_mode", expand=True)
+        subsub = sub.column()
+        subsub.enabled = rd.threads_mode == 'FIXED'
+        subsub.prop(rd, "threads")
+        
+        sub = col.column(align=True)
+        sub.label(text="Tile Size:")
+        sub.prop(rd, "tile_x", text="X")
+        sub.prop(rd, "tile_y", text="Y")
 
         col = split.column()
         col.label(text="Memory:")
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index 9e6bfe6..e623d03 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -149,20 +149,15 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel):
             col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
             col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
 
-        split = layout.split(percentage=0.65)
-        col = split.column()
-
         if tex_collection:
-            col.template_ID(idblock, "active_texture", new="texture.new")
+            layout.template_ID(idblock, "active_texture", new="texture.new")
         elif node:
-            col.template_ID(node, "texture", new="texture.new")
+            layout.template_ID(node, "texture", new="texture.new")
         elif idblock:
-            col.template_ID(idblock, "texture", new="texture.new")
+            layout.template_ID(idblock, "texture", new="texture.new")
 
         if pin_id:
-            col.template_ID(space, "pin_id")
-
-        col = split.column()
+            layout.template_ID(space, "pin_id")
 
         if tex:
             split = layout.split(percentage=0.2)
@@ -887,8 +882,12 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
                 col = split.column()
                 if tex.texture_coords in {'ORCO', 'UV'}:
                     col.prop(tex, "use_from_dupli")
+                    if (idblock.type == 'VOLUME' and tex.texture_coords == 'ORCO'):
+                        col.prop(tex, "use_map_to_bounds")
                 elif tex.texture_coords == 'OBJECT':
                     col.prop(tex, "use_from_original")
+                    if (idblock.type == 'VOLUME'):
+                        col.prop(tex, "use_map_to_bounds")
                 else:
                     col.label()
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index f7b9f59..cb88226 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -320,6 +320,13 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
         col.label(text="Refine:")
         col.prop(settings, "refine_intrinsics", text="")
 
+        col = layout.column(align=True)
+        col.active = not settings.use_tripod_solver
+        col.prop(settings, "use_fallback_reconstruction", text="Allow Fallback")
+        sub = col.column()
+        sub.active = settings.use_fallback_reconstruction
+        sub.prop(settings, "reconstruction_success_threshold")
+
 
 class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py
index 5ff1799..23d16c1 100644
--- a/release/scripts/startup/bl_ui/space_console.py
+++ b/release/scripts/startup/bl_ui/space_console.py
@@ -25,7 +25,7 @@ class CONSOLE_HT_header(Header):
     bl_space_type = 'CONSOLE'
 
     def draw(self, context):
-        layout = self.layout.row(align=True)
+        layout = self.layout.row()
 
         layout.template_header()
 
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 8e95533..5535070 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -29,6 +29,7 @@ from bpy.types import Header, Menu
 def dopesheet_filter(layout, context, genericFiltersOnly=False):
     dopesheet = context.space_data.dopesheet
     is_nla = context.area.type == 'NLA_EDITOR'
+    is_drivers = (context.area.type == 'GRAPH_EDITOR' and context.space_data.mode == 'DRIVERS')
 
     row = layout.row(align=True)
     row.prop(dopesheet, "show_only_selected", text="")
@@ -37,6 +38,9 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
     if is_nla:
         row.prop(dopesheet, "show_missing_nla", text="")
 
+    if is_drivers:
+        row.prop(dopesheet, "show_only_errors", text="")
+
     if not genericFiltersOnly:
         if bpy.data.groups:
             row = layout.row(align=True)
@@ -161,7 +165,6 @@ class DOPESHEET_MT_view(Menu):
         layout.operator("action.previewrange_set")
 
         layout.separator()
-        layout.operator("action.frame_jump")
         layout.operator("action.view_all")
         layout.operator("action.view_selected")
 
@@ -238,9 +241,9 @@ class DOPESHEET_MT_channel(Menu):
         layout.operator("anim.channels_delete")
 
         layout.separator()
-        layout.operator("anim.channels_setting_toggle")
-        layout.operator("anim.channels_setting_enable")
-        layout.operator("anim.channels_setting_disable")
+        layout.operator_menu_enum("anim.channels_setting_toggle", "type")
+        layout.operator_menu_enum("anim.channels_setting_enable", "type")
+        layout.operator_menu_enum("anim.channels_setting_disable", "type")
 
         layout.separator()
         layout.operator("anim.channels_editable_toggle")
@@ -272,6 +275,9 @@ class DOPESHEET_MT_key(Menu):
         layout.operator("action.keyframe_insert")
 
         layout.separator()
+        layout.operator("action.frame_jump")        
+        
+        layout.separator()
         layout.operator("action.duplicate_move")
         layout.operator("action.delete")
 
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 435b968..256545b 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -67,6 +67,7 @@ class FILEBROWSER_HT_header(Header):
                 row.label(params.filter_glob)
             else:
                 row.prop(params, "use_filter_blender", text="")
+                row.prop(params, "use_filter_backup", text="")
                 row.prop(params, "use_filter_image", text="")
                 row.prop(params, "use_filter_movie", text="")
                 row.prop(params, "use_filter_script", text="")
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 972b4eb..4cb6538 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -96,7 +96,6 @@ class GRAPH_MT_view(Menu):
         layout.operator("graph.previewrange_set")
 
         layout.separator()
-        layout.operator("graph.frame_jump")
         layout.operator("graph.view_all")
         layout.operator("graph.view_selected")
 
@@ -162,9 +161,9 @@ class GRAPH_MT_channel(Menu):
         layout.operator("anim.channels_delete")
 
         layout.separator()
-        layout.operator("anim.channels_setting_toggle")
-        layout.operator("anim.channels_setting_enable")
-        layout.operator("anim.channels_setting_disable")
+        layout.operator_menu_enum("anim.channels_setting_toggle", "type")
+        layout.operator_menu_enum("anim.channels_setting_enable", "type")
+        layout.operator_menu_enum("anim.channels_setting_disable", "type")
 
         layout.separator()
         layout.operator("anim.channels_editable_toggle")
@@ -199,6 +198,9 @@ class GRAPH_MT_key(Menu):
         layout.operator("graph.sound_bake")
 
         layout.separator()
+        layout.operator("graph.frame_jump")
+
+        layout.separator()
         layout.operator("graph.duplicate_move")
         layout.operator("graph.delete")
 
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 5302ad9..1ea20d9 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -249,6 +249,7 @@ class IMAGE_MT_uvs_weldalign(Menu):
         layout = self.layout
 
         layout.operator("uv.weld")  # W, 1
+        layout.operator("uv.remove_doubles")
         layout.operator_enum("uv.align", "axis")  # W, 2/3/4
 
 
@@ -413,7 +414,9 @@ class IMAGE_HT_header(Header):
 
             row = layout.row(align=True)
             row.prop(toolsettings, "use_snap", text="")
-            row.prop(toolsettings, "snap_target", text="")
+            row.prop(toolsettings, "snap_uv_element", text="", icon_only=True)
+            if toolsettings.snap_uv_element != 'INCREMENT':
+                row.prop(toolsettings, "snap_target", text="")
 
             mesh = context.edit_object.data
             layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
@@ -684,7 +687,7 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
 
         if brush:
             col = layout.column()
-            col.template_color_wheel(brush, "color", value_slider=True)
+            col.template_color_picker(brush, "color", value_slider=True)
             col.prop(brush, "color", text="")
 
             row = col.row(align=True)
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 9ab2a77..8df117e 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -112,8 +112,9 @@ class INFO_MT_file(Menu):
 
         layout.separator()
 
-        layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
+        layout.operator_context = 'EXEC_AREA' if  context.blend_data.is_saved else 'INVOKE_AREA'
+        layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
+
         layout.operator_context = 'INVOKE_AREA'
         layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
         layout.operator_context = 'INVOKE_AREA'
@@ -192,7 +193,7 @@ class INFO_MT_mesh_add(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = 'EXEC_REGION_WIN'
+        layout.operator_context = 'INVOKE_REGION_WIN'
         layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
         layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
         layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
@@ -372,7 +373,7 @@ class INFO_MT_help(Menu):
         layout = self.layout
 
         layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
-        layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-264"
+        layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-265"
         layout.separator()
 
         layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
diff --git a/release/scripts/startup/bl_ui/space_logic.py b/release/scripts/startup/bl_ui/space_logic.py
index 846169b..7303981 100644
--- a/release/scripts/startup/bl_ui/space_logic.py
+++ b/release/scripts/startup/bl_ui/space_logic.py
@@ -107,5 +107,10 @@ class LOGIC_MT_view(Menu):
 
         layout.operator("logic.properties", icon='MENU_PANEL')
 
+        layout.separator()
+
+        layout.operator("screen.area_dupli")
+        layout.operator("screen.screen_full_area")
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 5b7ecbf..c46b1c2 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -166,11 +166,19 @@ class NODE_MT_node(Menu):
         layout.operator("node.delete_reconnect")
 
         layout.separator()
+
+        layout.operator("node.join", text="Join in new Frame")
+        layout.operator("node.detach", text="Remove from Frame")
+
+        layout.separator()
+
         layout.operator("node.link_make")
         layout.operator("node.link_make", text="Make and Replace Links").replace = True
         layout.operator("node.links_cut")
+        layout.operator("node.links_detach")
 
         layout.separator()
+
         layout.operator("node.group_edit")
         layout.operator("node.group_ungroup")
         layout.operator("node.group_make")
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 4a41869..fdfd431 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -31,21 +31,21 @@ def act_strip(context):
 def draw_color_balance(layout, color_balance):
     col = layout.column()
     col.label(text="Lift:")
-    col.template_color_wheel(color_balance, "lift", value_slider=True, cubic=True)
+    col.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
     row = col.row()
     row.prop(color_balance, "lift", text="")
     row.prop(color_balance, "invert_lift", text="Inverse")
 
     col = layout.column()
     col.label(text="Gamma:")
-    col.template_color_wheel(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
+    col.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
     row = col.row()
     row.prop(color_balance, "gamma", text="")
     row.prop(color_balance, "invert_gamma", text="Inverse")
 
     col = layout.column()
     col.label(text="Gain:")
-    col.template_color_wheel(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
+    col.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
     row = col.row()
     row.prop(color_balance, "gain", text="")
     row.prop(color_balance, "invert_gain", text="Inverse")
@@ -601,6 +601,8 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
                 split.label(text="File:")
                 split.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
 
+            layout.prop(strip.colorspace_settings, "name")
+
             layout.operator("sequencer.change_path")
 
         elif seq_type == 'MOVIE':
@@ -608,6 +610,8 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
             split.label(text="Path:")
             split.prop(strip, "filepath", text="")
 
+            layout.prop(strip.colorspace_settings, "name")
+
             layout.prop(strip, "mpeg_preseek")
             layout.prop(strip, "stream_index")
 
@@ -703,8 +707,6 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
         layout.template_ID(strip, "scene")
 
         scene = strip.scene
-        if scene:
-            layout.prop(scene.render, "use_sequencer")
 
         layout.label(text="Camera Override")
         layout.template_ID(strip, "scene_camera")
@@ -860,7 +862,6 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
         render = context.scene.render
 
         col = layout.column()
-        col.active = False  # Currently only opengl preview works!
         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
         col = layout.column()
         #col.active = render.use_sequencer_gl_preview
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index eca9bc2..fa8752c 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -56,12 +56,17 @@ class TEXT_HT_header(Header):
         row.prop(st, "show_syntax_highlight", text="")
 
         if text:
-            row = layout.row()
-            row.operator("text.run_script")
+            osl = text.name.endswith(".osl") or text.name.endswith(".oso")
 
-            row = layout.row()
-            row.active = text.name.endswith(".py")
-            row.prop(text, "use_module")
+            if osl:
+                row = layout.row()
+                row.operator("node.shader_script_update")
+            else:
+                row = layout.row()
+                row.operator("text.run_script")
+
+                row = layout.row()
+                row.prop(text, "use_module")
 
             row = layout.row()
             if text.filepath:
@@ -132,9 +137,6 @@ class TEXT_PT_find(Panel):
         row.operator("text.replace_set_selected", text="", icon='TEXT')
         col.operator("text.replace")
 
-        # mark
-        layout.operator("text.mark_all")
-
         # settings
         layout.prop(st, "use_match_case")
         row = layout.row()
@@ -149,12 +151,7 @@ class TEXT_MT_view(Menu):
         layout = self.layout
 
         layout.operator("text.properties", icon='MENU_PANEL')
-
-        layout.separator()
-
-        layout.operator("screen.area_dupli")
-        layout.operator("screen.screen_full_area")
-
+        
         layout.separator()
 
         layout.operator("text.move",
@@ -164,6 +161,11 @@ class TEXT_MT_view(Menu):
                         text="Bottom of File",
                         ).type = 'FILE_BOTTOM'
 
+        layout.separator()
+
+        layout.operator("screen.area_dupli")
+        layout.operator("screen.screen_full_area")
+
 
 class TEXT_MT_text(Menu):
     bl_label = "Text"
@@ -211,17 +213,6 @@ class TEXT_MT_edit_select(Menu):
         layout.operator("text.select_line")
 
 
-class TEXT_MT_edit_markers(Menu):
-    bl_label = "Markers"
-
-    def draw(self, context):
-        layout = self.layout
-
-        layout.operator("text.markers_clear")
-        layout.operator("text.next_marker")
-        layout.operator("text.previous_marker")
-
-
 class TEXT_MT_format(Menu):
     bl_label = "Format"
 
@@ -285,7 +276,6 @@ class TEXT_MT_edit(Menu):
         layout.separator()
 
         layout.menu("TEXT_MT_edit_select")
-        layout.menu("TEXT_MT_edit_markers")
 
         layout.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
index ed1d2a0..cb9e244 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -127,6 +127,11 @@ class TIME_MT_view(Menu):
 
         layout.operator("marker.camera_bind")
 
+        layout.separator()
+
+        layout.operator("screen.area_dupli")
+        layout.operator("screen.screen_full_area")
+
 
 class TIME_MT_cache(Menu):
     bl_label = "Cache"
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index df30c3e..0bb25e9 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -92,7 +92,7 @@ class USERPREF_HT_header(Header):
             layout.operator("wm.keyconfig_import")
             layout.operator("wm.keyconfig_export")
         elif userpref.active_section == 'ADDONS':
-            layout.operator("wm.addon_install")
+            layout.operator("wm.addon_install", icon="FILESEL")
             layout.menu("USERPREF_MT_addons_dev_guides")
         elif userpref.active_section == 'THEMES':
             layout.operator("ui.reset_default_theme")
@@ -248,7 +248,7 @@ class USERPREF_PT_interface(Panel):
         col.prop(view, "show_splash")
 
         if os.name == "nt":
-            col.prop(view, "quit_dialog")
+            col.prop(view, "use_quit_dialog")
 
 
 class USERPREF_PT_edit(Panel):
@@ -299,9 +299,9 @@ class USERPREF_PT_edit(Panel):
         col.label(text="Grease Pencil:")
         col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
         col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
-        #~ col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
         col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
         col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
+        col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
         col.separator()
         col.separator()
         col.separator()
@@ -422,7 +422,7 @@ class USERPREF_PT_system(Panel):
         col.separator()
         col.separator()
 
-        if hasattr(system, "compute_device"):
+        if hasattr(system, "compute_device_type"):
             col.label(text="Compute Device:")
             col.row().prop(system, "compute_device_type", expand=True)
             sub = col.row()
@@ -442,10 +442,9 @@ class USERPREF_PT_system(Panel):
         col.label(text="Anisotropic Filtering")
         col.prop(system, "anisotropic_filter", text="")
         col.prop(system, "use_vertex_buffer_objects")
-        # Anti-aliasing is disabled as it breaks border/lasso select
-        #~ col.prop(system, "use_antialiasing")
         col.label(text="Window Draw Method:")
         col.prop(system, "window_draw_method", text="")
+        col.prop(system, "multi_sample", text="")
         col.label(text="Text Draw Options:")
         col.prop(system, "use_text_antialiasing")
         col.label(text="Textures:")
@@ -728,6 +727,29 @@ class USERPREF_PT_theme(Panel):
             colsub = padding.column()
             colsub.row().prop(ui, "header")
 
+            col.separator()
+            col.separator()
+
+            ui = theme.user_interface
+            col.label("Axis Colors:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "axis_x")
+            colsub.row().prop(ui, "axis_y")
+            colsub.row().prop(ui, "axis_z")
+            
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            
             layout.separator()
             layout.separator()
         elif theme.theme_area == 'BONE_COLOR_SETS':
@@ -823,6 +845,7 @@ class USERPREF_PT_file(Panel):
         col.prop(paths, "use_filter_files")
         col.prop(paths, "show_hidden_files_datablocks")
         col.prop(paths, "hide_recent_locations")
+        col.prop(paths, "hide_system_bookmarks")
         col.prop(paths, "show_thumbnails")
 
         col.separator()
@@ -1040,6 +1063,9 @@ class USERPREF_PT_addons(Panel):
         userpref = context.user_preferences
         used_ext = {ext.module for ext in userpref.addons}
 
+        userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
+        scripts_addons_folder  = bpy.utils.user_resource('SCRIPTS', "addons")
+        
         # collect the categories that can be filtered on
         addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(addon_utils.addons_fake_modules)]
 
@@ -1088,7 +1114,9 @@ class USERPREF_PT_addons(Panel):
             if     ((filter == "All") or
                     (filter == info["category"]) or
                     (filter == "Enabled" and is_enabled) or
-                    (filter == "Disabled" and not is_enabled)):
+                    (filter == "Disabled" and not is_enabled) or
+                    (filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
+                   ):
 
                 if search and search not in info["name"].lower():
                     if info["author"]:
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
index da49826..81d67aa 100644
--- a/release/scripts/startup/bl_ui/space_userpref_keymap.py
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -186,10 +186,10 @@ class InputKeyMapPanel:
                 sub = split.column()
                 subrow = sub.row(align=True)
 
-                if map_type in {'KEYBOARD', 'NDOF'}:
+                if map_type == 'KEYBOARD':
                     subrow.prop(kmi, "type", text="", event=True)
                     subrow.prop(kmi, "value", text="")
-                elif map_type == 'MOUSE':
+                elif map_type in {'MOUSE', 'NDOF'}:
                     subrow.prop(kmi, "type", text="")
                     subrow.prop(kmi, "value", text="")
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index d5648a6..b1dfc39 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -168,6 +168,8 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
 
         # generic...
         layout = self.layout
+        layout.operator("transform.shrink_fatten", text="Shrink Fatten")
+
         layout.separator()
 
         layout.operator("transform.translate", text="Move Texture Space").texture_space = True
@@ -356,6 +358,7 @@ class VIEW3D_MT_view(Menu):
 
         layout.operator("view3d.clip_border", text="Clipping Border...")
         layout.operator("view3d.zoom_border", text="Zoom Border...")
+        layout.operator("view3d.render_border", text="Render Border...")
 
         layout.separator()
 
@@ -571,7 +574,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
         layout.separator()
 
         layout.operator("mesh.select_random", text="Random")
-        layout.operator("mesh.select_nth", text="Every N Number of Verts")
+        layout.operator("mesh.select_nth")
         layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
         layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
         layout.operator("mesh.select_interior_faces", text="Interior Faces")
@@ -579,7 +582,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.select_by_number_vertices", text="By Number of Verts")
+        layout.operator("mesh.select_face_by_sides")
         if context.scene.tool_settings.mesh_select_mode[2] is False:
             layout.operator("mesh.select_non_manifold", text="Non Manifold")
         layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges")
@@ -968,8 +971,9 @@ class VIEW3D_MT_object_parent(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_menu_enum("object.parent_set", "type", text="Set")
-        layout.operator_menu_enum("object.parent_clear", "type", text="Clear")
+        layout.operator_enum("object.parent_set", "type")
+        layout.separator()
+        layout.operator_enum("object.parent_clear", "type")
 
 
 class VIEW3D_MT_object_track(Menu):
@@ -978,8 +982,9 @@ class VIEW3D_MT_object_track(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_menu_enum("object.track_set", "type", text="Set")
-        layout.operator_menu_enum("object.track_clear", "type", text="Clear")
+        layout.operator_enum("object.track_set", "type")
+        layout.separator()
+        layout.operator_enum("object.track_clear", "type")
 
 
 class VIEW3D_MT_object_group(Menu):
@@ -1247,6 +1252,7 @@ class VIEW3D_MT_paint_weight(Menu):
         layout.operator("object.vertex_group_clean", text="Clean")
         layout.operator("object.vertex_group_levels", text="Levels")
         layout.operator("object.vertex_group_blend", text="Blend")
+        layout.operator("object.vertex_group_transfer_weight", text="Transfer Weights")
         layout.operator("object.vertex_group_limit_total", text="Limit Total")
         layout.operator("object.vertex_group_fix", text="Fix Deforms")
 
@@ -1284,6 +1290,7 @@ class VIEW3D_MT_sculpt(Menu):
         layout.prop(sculpt, "show_low_resolution")
         layout.prop(sculpt, "show_brush")
         layout.prop(sculpt, "use_deform_only")
+        layout.prop(sculpt, "show_diffuse_color")
 
 
 class VIEW3D_MT_hide_mask(Menu):
@@ -1529,13 +1536,20 @@ class VIEW3D_MT_pose_group(Menu):
 
     def draw(self, context):
         layout = self.layout
-        layout.operator("pose.group_add")
-        layout.operator("pose.group_remove")
+        
+        pose = context.active_object.pose
 
-        layout.separator()
+        layout.operator_context = 'EXEC_AREA'
+        layout.operator("pose.group_assign", text="Assign to New Group").type = 0
+        if pose.bone_groups:
+            active_group = pose.bone_groups.active_index + 1
+            layout.operator("pose.group_assign", text="Assign to Group").type = active_group
+
+            layout.separator()
 
-        layout.operator("pose.group_assign")
-        layout.operator("pose.group_unassign")
+            #layout.operator_context = 'INVOKE_AREA'
+            layout.operator("pose.group_unassign")
+            layout.operator("pose.group_remove")
 
 
 class VIEW3D_MT_pose_ik(Menu):
@@ -1660,7 +1674,7 @@ class VIEW3D_MT_edit_mesh(Menu):
         layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
 
         layout.separator()
-
+        layout.operator("mesh.symmetrize")
         layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
         layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
         layout.operator("mesh.duplicate_move")
@@ -1702,6 +1716,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
         layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT'
         layout.operator("mesh.flip_normals")
         layout.operator("mesh.vertices_smooth", text="Smooth")
+        layout.operator("mesh.vertices_smooth_laplacian", text="Laplacian Smooth")
         layout.operator("mesh.inset")
         layout.operator("mesh.bevel", text="Bevel")
         layout.operator("mesh.bridge_edge_loops")
@@ -1711,6 +1726,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
         layout.operator("mesh.shape_propagate_to_all")
         layout.operator("mesh.select_vertex_path")
         layout.operator("mesh.sort_elements")
+        layout.operator("mesh.symmetrize")
 
 
 class VIEW3D_MT_edit_mesh_select_mode(Menu):
@@ -1720,18 +1736,9 @@ class VIEW3D_MT_edit_mesh_select_mode(Menu):
         layout = self.layout
 
         layout.operator_context = 'INVOKE_REGION_WIN'
-
-        props = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
-        props.value = "(True, False, False)"
-        props.data_path = "tool_settings.mesh_select_mode"
-
-        props = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
-        props.value = "(False, True, False)"
-        props.data_path = "tool_settings.mesh_select_mode"
-
-        props = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
-        props.value = "(False, False, True)"
-        props.data_path = "tool_settings.mesh_select_mode"
+        layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
+        layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
+        layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
 
 
 class VIEW3D_MT_edit_mesh_extrude(Menu):
@@ -1777,6 +1784,7 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
 
         layout.operator("mesh.merge")
         layout.operator("mesh.rip_move")
+        layout.operator("mesh.rip_move_fill")
         layout.operator("mesh.split")
         layout.operator_menu_enum("mesh.separate", "type")
         layout.operator("mesh.vert_connect")
@@ -1811,6 +1819,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
 
         layout.operator("mesh.edge_face_add")
         layout.operator("mesh.subdivide")
+        layout.operator("mesh.unsubdivide")
 
         layout.separator()
 
@@ -1829,8 +1838,8 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
-        layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
+        layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
+        layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
 
         layout.separator()
 
@@ -1879,13 +1888,13 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
+        layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
 
         layout.separator()
 
-        layout.operator_menu_enum("mesh.uvs_rotate", "direction")
+        layout.operator("mesh.uvs_rotate")
         layout.operator("mesh.uvs_reverse")
-        layout.operator_menu_enum("mesh.colors_rotate", "direction")
+        layout.operator("mesh.colors_rotate")
         layout.operator("mesh.colors_reverse")
 
 
@@ -1928,10 +1937,6 @@ class VIEW3D_MT_edit_mesh_dissolve(Menu):
 
         layout.separator()
 
-        layout.operator_enum("mesh.dissolve", "type")
-
-        layout.separator()
-
         layout.operator("mesh.dissolve_limited")
 
 
@@ -2146,6 +2151,7 @@ class VIEW3D_MT_edit_lattice(Menu):
         layout.menu("VIEW3D_MT_transform")
         layout.menu("VIEW3D_MT_mirror")
         layout.menu("VIEW3D_MT_snap")
+        layout.operator_menu_enum("lattice.flip", "axis")
 
         layout.separator()
 
@@ -2301,6 +2307,9 @@ class VIEW3D_PT_view3d_properties(Panel):
         subcol.label(text="Local Camera:")
         subcol.prop(view, "camera", text="")
 
+        col = layout.column(align=True)
+        col.prop(view, "use_render_border")
+
 
 class VIEW3D_PT_view3d_cursor(Panel):
     bl_space_type = 'VIEW_3D'
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index b0b8401..91132a7 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -633,7 +633,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 
         elif context.image_paint_object and brush:
             col = layout.column()
-            col.template_color_wheel(brush, "color", value_slider=True)
+            col.template_color_picker(brush, "color", value_slider=True)
             col.prop(brush, "color", text="")
 
             row = col.row(align=True)
@@ -681,7 +681,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
         # Vertex Paint Mode #
         elif context.vertex_paint_object and brush:
             col = layout.column()
-            col.template_color_wheel(brush, "color", value_slider=True)
+            col.template_color_picker(brush, "color", value_slider=True)
             col.prop(brush, "color", text="")
 
             row = col.row(align=True)
@@ -878,6 +878,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         layout.prop(sculpt, "show_low_resolution")
         layout.prop(sculpt, "show_brush")
         layout.prop(sculpt, "use_deform_only")
+        layout.prop(sculpt, "show_diffuse_color")
 
         layout.prop(sculpt, "input_samples")
 
@@ -967,7 +968,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
         col.operator("object.vertex_group_clean", text="Clean")
         col.operator("object.vertex_group_levels", text="Levels")
         col.operator("object.vertex_group_blend", text="Blend")
-        col.operator("object.vertex_group_transfer_weight", text="Transfer weight")
+        col.operator("object.vertex_group_transfer_weight", text="Transfer Weights")
         col.operator("object.vertex_group_limit_total", text="Limit Total")
         col.operator("object.vertex_group_fix", text="Fix Deforms")
 
@@ -1047,7 +1048,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
     @classmethod
     def poll(cls, context):
         brush = context.tool_settings.image_paint.brush
-        return (brush and brush.image_tool != 'SOFTEN')
+        return (brush is not None)
 
     def draw_header(self, context):
         ipaint = context.tool_settings.image_paint
diff --git a/release/scripts/templates/bmesh_simple.py b/release/scripts/templates/bmesh_simple.py
index 656febf..45e6b52 100644
--- a/release/scripts/templates/bmesh_simple.py
+++ b/release/scripts/templates/bmesh_simple.py
@@ -19,3 +19,4 @@ for v in bm.verts:
 
 # Finish up, write the bmesh back to the mesh
 bm.to_mesh(me)
+bm.free()  # free and prevent further access
diff --git a/release/scripts/templates/bmesh_simple_editmode.py b/release/scripts/templates/bmesh_simple_editmode.py
new file mode 100644
index 0000000..d79ba02
--- /dev/null
+++ b/release/scripts/templates/bmesh_simple_editmode.py
@@ -0,0 +1,23 @@
+# This example assumes we have a mesh object in edit-mode
+
+import bpy
+import bmesh
+
+# Get the active mesh
+obj = bpy.context.edit_object
+me = obj.data
+
+
+# Get a BMesh representation
+bm = bmesh.from_edit_mesh(me)
+
+bm.faces.active = None
+
+# Modify the BMesh, can do anything here...
+for v in bm.verts:
+    v.co.x += 1.0
+
+
+# Show the updates in the viewport
+# and recalculate n-gon tessellation.
+bmesh.update_edit_mesh(me, True)
diff --git a/release/scripts/templates/script_stub.py b/release/scripts/templates/script_stub.py
new file mode 100644
index 0000000..44c7b80
--- /dev/null
+++ b/release/scripts/templates/script_stub.py
@@ -0,0 +1,14 @@
+# This stub runs a python script relative to the currently open
+# blend file, useful when editing scripts externally.
+
+import bpy
+import os
+
+# Use your own script name here:
+filename = "my_script.py"
+
+filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename)
+global_namespace = {"__file__": filepath, "__name__": "__main__"}
+file = open(filepath, 'rb')
+exec(compile(file.read(), filepath, 'exec'), global_namespace)
+file.close()
diff --git a/release/scripts/templates/ui_panel.py b/release/scripts/templates/ui_panel.py
index 9ffa0cb..cacdb83 100644
--- a/release/scripts/templates/ui_panel.py
+++ b/release/scripts/templates/ui_panel.py
@@ -22,7 +22,7 @@ class LayoutDemoPanel(bpy.types.Panel):
         row.prop(scene, "frame_end")
 
         # Create an row where the buttons are aligned to each other.
-        layout.label(text=" Aligned Row")
+        layout.label(text=" Aligned Row:")
 
         row = layout.row(align=True)
         row.prop(scene, "frame_start")
@@ -39,9 +39,26 @@ class LayoutDemoPanel(bpy.types.Panel):
 
         # Second column, aligned
         col = split.column(align=True)
-        col.label(text="Column Two")
+        col.label(text="Column Two:")
         col.prop(scene, "frame_start")
         col.prop(scene, "frame_end")
+        
+        # Big render button
+        layout.label(text="Big Button:")
+        row = layout.row()
+        row.scale_y = 3.0
+        row.operator("render.render")
+        
+        # Different sizes in a row
+        layout.label(text="Different button sizes:")
+        row = layout.row(align=True)
+        row.operator("render.render")
+        
+        sub = row.row()
+        sub.scale_x = 2.0
+        sub.operator("render.render")
+        
+        row.operator("render.render")
 
 
 def register():
diff --git a/release/text/readme.html b/release/text/readme.html
index 40ea903..414a7d8 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -12,18 +12,18 @@
   </style>
 </head>
 <body>
-<p class="title"><b>Blender 2.64</b></p>
+<p class="title"><b>Blender 2.65</b></p>
 <p><br></p>
 <p class="header"><b>About</b></p>
 <p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows and FreeBSD and has a large world-wide community.</p>
 <p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
 <p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
 <p><br></p>
-<p class="header"><b>2.64</b></p>
-<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.64. This release is the fifth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-264/">More information about this release</a>.</p>
+<p class="header"><b>2.65</b></p>
+<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.65. This release is the sixth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-265/">More information about this release</a>.</p>
 <p><br></p>
 <p class="header"><b>Bugs</b></p>
-<p class="body">Although Blender 2.64 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
+<p class="body">Although Blender 2.65 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
 <p><br></p>
 <p class="header"><b>Package Contents</b></p>
 <p class="body">The downloaded Blender package includes:</p>
@@ -47,7 +47,7 @@
 <p class="header"><b>Links</b></p>
 <p class="body">Users:</p>
 <p class="body">	General information		<a href="http://www.blender.org">www.blender.org</a> <br>
-	Full release log 			<a href="http://www.blender.org/development/release-logs/blender-264/">www.blender.org/development/release-logs/blender-264/</a><br>
+	Full release log 			<a href="http://www.blender.org/development/release-logs/blender-265/">www.blender.org/development/release-logs/blender-265/</a><br>
 	Tutorials 			<a href="http://www.blender.org/education-help/">www.blender.org/education-help/</a>	<br>
 	Manual 			<a href="http://wiki.blender.org/index.php/Doc:2.6/Manual">wiki.blender.org/index.php/Doc:2.6/Manual</a><br>
 	User Forum 			<a href="http://www.blenderartists.org">www.blenderartists.org</a><br>
diff --git a/release/windows/contrib/vfapi/vfapi-plugin.c b/release/windows/contrib/vfapi/vfapi-plugin.c
index 8d63baa..99ca6c6 100644
--- a/release/windows/contrib/vfapi/vfapi-plugin.c
+++ b/release/windows/contrib/vfapi/vfapi-plugin.c
@@ -15,7 +15,6 @@
  *
  */
 
-
 #include <windows.h>
 #include <winbase.h>
 #include <stdio.h>
@@ -83,16 +82,16 @@ typedef	struct {
 } VF_ReadData_Audio,*LPVF_ReadData_Audio;
 
 typedef	struct {
-	DWORD	dwSize;			
-	HRESULT (__stdcall *OpenFile)( 
-		char *lpFileName, LPVF_FileHandle lpFileHandle );
+	DWORD	dwSize;
+	HRESULT (__stdcall *OpenFile)(
+	        char *lpFileName, LPVF_FileHandle lpFileHandle );
 	HRESULT (__stdcall *CloseFile)( VF_FileHandle hFileHandle );
 	HRESULT (__stdcall *GetFileInfo)( VF_FileHandle hFileHandle,
-					 LPVF_FileInfo lpFileInfo );
+	                                  LPVF_FileInfo lpFileInfo );
 	HRESULT (__stdcall *GetStreamInfo)( VF_FileHandle hFileHandle,
-					   DWORD dwStream,void *lpStreamInfo );
+	                                    DWORD dwStream,void *lpStreamInfo );
 	HRESULT (__stdcall *ReadData)( VF_FileHandle hFileHandle,
-				      DWORD dwStream,void *lpData ); 
+	                               DWORD dwStream,void *lpData );
 } VF_PluginFunc,*LPVF_PluginFunc;
 
 __declspec(dllexport) HRESULT vfGetPluginInfo( 
@@ -117,8 +116,9 @@ static unsigned long getipaddress(const char * ipaddr)
 	struct hostent  *host;
 	unsigned long   ip;
 
-	if (((ip = inet_addr(ipaddr)) == INADDR_NONE)
-	&& strcmp(ipaddr, "255.255.255.255") != 0) {
+	if (((ip = inet_addr(ipaddr)) == INADDR_NONE) &&
+	    strcmp(ipaddr, "255.255.255.255") != 0)
+	{
 		if ((host = gethostbyname(ipaddr)) != NULL) {
 			memcpy(&ip, host->h_addr, sizeof(ip));
 		}
@@ -382,7 +382,7 @@ HRESULT __stdcall VF_ReadDataFunc_Blen(
 
 	my_gets(s_in, buf, 256); /* 255 */
 
-	framebuf = (unsigned char*) v->lpData;
+	framebuf = (unsigned char *) v->lpData;
 
 	for (y = 0; y < height; y++) {
 		unsigned char *p = framebuf + v->lPitch * y;
@@ -419,6 +419,3 @@ __declspec(dllexport) HRESULT vfGetPluginFunc(
 
 	return VF_OK;
 }
-
-
-
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 15d8702..d6301b7 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -94,7 +94,7 @@ char *fcc_to_char(unsigned int fcc)
 	DEBUG_FCC[2] = (fcc >> 16) & 127;
 	DEBUG_FCC[3] = (fcc >> 24) & 127;
 
-	return DEBUG_FCC;	
+	return DEBUG_FCC;
 }
 
 char *tcc_to_char(unsigned int tcc)
@@ -104,7 +104,7 @@ char *tcc_to_char(unsigned int tcc)
 	DEBUG_FCC[2] = 0;
 	DEBUG_FCC[3] = 0;
 
-	return DEBUG_FCC;	
+	return DEBUG_FCC;
 }
 
 int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num)
@@ -302,7 +302,7 @@ int AVI_is_avi(const char *name)
 			
 			MEM_freeN(movie.streams);
 			fclose(movie.fp);
-			return 0;				
+			return 0;
 		}
 
 		movie.streams[temp].sh.Type = GET_FCC(movie.fp);
@@ -401,12 +401,12 @@ int AVI_is_avi(const char *name)
 					}
 				}
 
-			} 
+			}
 			if (j > 0) fseek(movie.fp, j, SEEK_CUR);
 		}
 		else fseek(movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
 
-		/* Walk to the next LIST */		
+		/* Walk to the next LIST */
 		while (GET_FCC(movie.fp) != FCC("LIST")) {
 			temp = GET_FCC(movie.fp);
 			if (temp < 0 || ftell(movie.fp) > movie.size) {
@@ -414,9 +414,9 @@ int AVI_is_avi(const char *name)
 				
 				MEM_freeN(movie.streams);
 				fclose(movie.fp);
-				return 0;				
+				return 0;
 			}
-			fseek(movie.fp, temp, SEEK_CUR);			
+			fseek(movie.fp, temp, SEEK_CUR);
 		}
 
 		fseek(movie.fp, -4L, SEEK_CUR);
@@ -592,12 +592,12 @@ AviError AVI_open_movie(const char *name, AviMovie *movie)
 					}
 				}
 
-			} 
+			}
 			if (j > 0) fseek(movie->fp, j, SEEK_CUR);
 		}
 		else fseek(movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
 		
-		/* Walk to the next LIST */		
+		/* Walk to the next LIST */
 		while (GET_FCC(movie->fp) != FCC("LIST")) {
 			temp = GET_FCC(movie->fp);
 			if (temp < 0 || ftell(movie->fp) > movie->size) {
@@ -665,13 +665,13 @@ AviError AVI_open_movie(const char *name, AviMovie *movie)
 			}
 		}
 
-/* Some AVI's have offset entries in absolute coordinates
- * instead of an offset from the movie beginning... this is...
- * wacky, but we need to handle it. The wacky offset always
- * starts at movi_offset it seems... so we'll check that.
- * Note the the offset needs an extra 4 bytes for some 
- * undetermined reason */
- 
+		/* Some AVI's have offset entries in absolute coordinates
+		 * instead of an offset from the movie beginning... this is...
+		 * wacky, but we need to handle it. The wacky offset always
+		 * starts at movi_offset it seems... so we'll check that.
+		 * Note the the offset needs an extra 4 bytes for some
+		 * undetermined reason */
+
 		if (movie->entries[0].Offset == movie->movi_offset)
 			movie->read_offset = 4;
 	}
@@ -827,7 +827,7 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...)
 		movie->streams[i].sh.right = 0;
 		movie->streams[i].sh.bottom = 0;
 
-		if (movie->streams[i].sh.Type == FCC("vids")) {	
+		if (movie->streams[i].sh.Type == FCC("vids")) {
 #if 0
 			if (movie->streams[i].format == AVI_FORMAT_MJPEG) {
 				movie->streams[i].sf = MEM_mallocN(sizeof(AviBitmapInfoHeader) +
diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c
index b98e03d..396f119 100644
--- a/source/blender/avi/intern/avi_mjpeg.c
+++ b/source/blender/avi/intern/avi_mjpeg.c
@@ -73,7 +73,7 @@ static void std_huff_tables(j_decompress_ptr dinfo)
 		0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
 	};
 	static const UINT8 val_dc_luminance[] =
-	{ 
+	{
 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
 	};
 
@@ -82,7 +82,7 @@ static void std_huff_tables(j_decompress_ptr dinfo)
 		0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
 	};
 	static const UINT8 val_dc_chrominance[] =
-	{ 
+	{
 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
 	};
 
@@ -91,7 +91,7 @@ static void std_huff_tables(j_decompress_ptr dinfo)
 		0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
 	};
 	static const UINT8 val_ac_luminance[] =
-	{ 
+	{
 		0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
 		0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
 		0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
@@ -119,7 +119,7 @@ static void std_huff_tables(j_decompress_ptr dinfo)
 		0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
 	};
 	static const UINT8 val_ac_chrominance[] =
-	{ 
+	{
 		0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
 		0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
 		0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
@@ -393,7 +393,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer,
 		numbytes = 0;
 		check_and_compress_jpeg(movie->streams[stream].sh.Quality / 100, buf + *size, buffer + (movie->header->Height / 2) * movie->header->Width * 3,  movie->header->Width, movie->header->Height / 2, bufsize / 2);
 	}
-	*size += numbytes;	
+	*size += numbytes;
 
 	MEM_freeN(buffer);
 	return buf;
diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c
index 61587e1..c6a78ec 100644
--- a/source/blender/avi/intern/avi_rgb.c
+++ b/source/blender/avi/intern/avi_rgb.c
@@ -86,7 +86,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
 				*(to++) = ((*pxl >> 10) & 0x1f) * 8;
 				*(to++) = ((*pxl >> 5) & 0x1f) * 8;
 				*(to++) = (*pxl & 0x1f) * 8;
-				pxl++;	
+				pxl++;
 			}
 		}
 
@@ -98,7 +98,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
 		buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
 	
 		rowstride = movie->header->Width * 3;
-		if (bits != 16) if (movie->header->Width % 2) rowstride++;
+		if ((bits != 16) && (movie->header->Width % 2)) rowstride++;
 	
 		for (y = 0; y < movie->header->Height; y++) {
 			memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index ce10951..6f348cc 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -109,6 +109,7 @@ float BLF_fixed_width(int fontid);
  * of the string, using the default font and both value
  * are multiplied by the aspect of the font.
  */
+void  BLF_width_and_height_default(const char *str, float *width, float *height);
 float BLF_width_default(const char *str);
 float BLF_height_default(const char *str);
 
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 278c45d..159d4b0 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -35,41 +35,45 @@
 
 #define TEXT_DOMAIN_NAME "blender"
 
-/* blf_translation.c  */
-
-#ifdef WITH_INTERNATIONAL
-unsigned char *BLF_get_unifont(int *unifont_size);
-void BLF_free_unifont(void);
-#endif
-
-const char *BLF_gettext(const char *msgid);
-const char *BLF_pgettext(const char *context, const char *message);
-
 /* blf_lang.c */
 
 /* Search the path directory to the locale files, this try all
  * the case for Linux, Win and Mac.
+ * Also dynamically builds locales and locales' menu from "languages" text file.
  */
 void BLF_lang_init(void);
 
+/* Free languages and locales_menu arrays created by BLF_lang_init. */
+void BLF_lang_free(void);
+
 /* Set the current locale. */
 void BLF_lang_set(const char *);
 /* Get the current locale (short code, e.g. es_ES). */
 const char *BLF_lang_get(void);
 
-/* Set the current encoding name. */
-void BLF_lang_encoding(const char *str);
+/* Get EnumPropertyItem's for translations menu. */
+struct EnumPropertyItem *BLF_RNA_lang_enum_properties(void);
+
+/* blf_translation.c  */
+
+#ifdef WITH_INTERNATIONAL
+unsigned char *BLF_get_unifont(int *unifont_size);
+void BLF_free_unifont(void);
+#endif
+
+const char *BLF_pgettext(const char *msgctxt, const char *msgid);
 
 /* translation */
 int BLF_translate_iface(void);
 int BLF_translate_tooltips(void);
-const char *BLF_translate_do_iface(const char *contex, const char *msgid);
-const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
+const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid);
+const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
 
 
 /* The "translation-marker" macro. */
 #define N_(msgid) msgid
 #define CTX_N_(context, msgid) msgid
+
 /* Those macros should be used everywhere in UI code. */
 #ifdef WITH_INTERNATIONAL
 /*	#define _(msgid) BLF_gettext(msgid) */
@@ -81,10 +85,17 @@ const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
 /*	#define _(msgid) msgid */
 	#define IFACE_(msgid) msgid
 	#define TIP_(msgid) msgid
-	#define CTX_IFACE_(context, msgid) msgid
-	#define CTX_TIP_(context, msgid) msgid
+	#define CTX_IFACE_(context, msgid) ((void)context, msgid)
+	#define CTX_TIP_(context, msgid)   ((void)context, msgid)
 #endif
 
+/* Helper macro, when we want to define a same msgid for multiple msgctxt...
+ * Does nothing in C, but is "parsed" by our i18n py tools.
+ * XXX Currently limited to at most 16 contexts at most
+ *     (but you can call it several times with the same msgid, should you need more contexts!).
+ */
+#define BLF_I18N_MSGID_MULTI_CTXT(msgid, ...)
+
 /******************************************************************************
  * All i18n contexts must be defined here.
  * This is a nice way to be sure not to use a context twice for different
@@ -97,8 +108,39 @@ const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
 /* Default context for operator names/labels. */
 #define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
 
-/* Audio disambiguation context. */
-#define BLF_I18NCONTEXT_AUDIO "Audio"
-
+/* ID-types contexts. */
+/* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
+#define BLF_I18NCONTEXT_ID_ACTION               "Action"
+#define BLF_I18NCONTEXT_ID_ARMATURE             "Armature"
+#define BLF_I18NCONTEXT_ID_BRUSH                "Brush"
+#define BLF_I18NCONTEXT_ID_CAMERA               "Camera"
+#define BLF_I18NCONTEXT_ID_CURVE                "Curve"
+#define BLF_I18NCONTEXT_ID_GPENCIL              "GPencil"
+#define BLF_I18NCONTEXT_ID_GROUP                "Group"
+#define BLF_I18NCONTEXT_ID_ID                   "ID"
+#define BLF_I18NCONTEXT_ID_IMAGE                "Image"
+/*#define BLF_I18NCONTEXT_ID_IPO                  "Ipo"*/ /* Deprecated */
+#define BLF_I18NCONTEXT_ID_SHAPEKEY             "Key"
+#define BLF_I18NCONTEXT_ID_LAMP                 "Lamp"
+#define BLF_I18NCONTEXT_ID_LIBRARY              "Library"
+#define BLF_I18NCONTEXT_ID_LATTICE              "Lattice"
+#define BLF_I18NCONTEXT_ID_MATERIAL             "Material"
+#define BLF_I18NCONTEXT_ID_METABALL             "Metaball"
+#define BLF_I18NCONTEXT_ID_MESH                 "Mesh"
+#define BLF_I18NCONTEXT_ID_NODETREE             "NodeTree"
+#define BLF_I18NCONTEXT_ID_OBJECT               "Object"
+#define BLF_I18NCONTEXT_ID_PARTICLESETTINGS     "ParticleSettings"
+#define BLF_I18NCONTEXT_ID_SCENE                "Scene"
+#define BLF_I18NCONTEXT_ID_SCREEN               "Screen"
+#define BLF_I18NCONTEXT_ID_SEQUENCE             "Sequence"
+#define BLF_I18NCONTEXT_ID_SPEAKER              "Speaker"
+#define BLF_I18NCONTEXT_ID_SOUND                "Sound"
+#define BLF_I18NCONTEXT_ID_TEXTURE              "Texture"
+#define BLF_I18NCONTEXT_ID_TEXT                 "Text"
+#define BLF_I18NCONTEXT_ID_VFONT                "VFont"
+#define BLF_I18NCONTEXT_ID_WORLD                "World"
+#define BLF_I18NCONTEXT_ID_WINDOWMANAGER        "WindowManager"
+#define BLF_I18NCONTEXT_ID_MOVIECLIP            "MovieClip"
+#define BLF_I18NCONTEXT_ID_MASK                 "Mask"
 
 #endif /* __BLF_TRANSLATION_H__ */
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index da60710..90baef1 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -25,10 +25,13 @@ set(INC
 	.
 	../blenkernel
 	../blenlib
+	../blenloader
 	../editors/include
 	../makesdna
+	../makesrna
 	../imbuf
 	../../../intern/guardedalloc
+	../../../intern/locale
 )
 
 set(INC_SYS
@@ -52,9 +55,6 @@ set(SRC
 )
 
 if(WITH_INTERNATIONAL)
-	list(APPEND INC_SYS
-		${GETTEXT_INCLUDE_DIRS}
-	)
 	add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
index d3c7b1c..c0591c8 100644
--- a/source/blender/blenfont/SConscript
+++ b/source/blender/blenfont/SConscript
@@ -4,10 +4,10 @@ Import ('env')
 
 sources = env.Glob('intern/*.c')
 
-incs = '. intern  #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../imbuf ../editors/include'
+incs = '. intern  #/intern/guardedalloc #/intern/locale ../blenkernel ../blenlib ../blenloader'
+incs += ' ../makesdna ../makesrna ../imbuf ../editors/include'
 incs += ' #/extern/glew/include'
 incs += ' ' + env['BF_FREETYPE_INC']
-incs += ' ' + env['BF_GETTEXT_INC']
 
 defs = ['GLEW_STATIC']
 
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 92fcb57..778b6c1 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -28,7 +28,6 @@
  *  \ingroup blf
  */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -69,7 +68,7 @@ static int global_font_dpi = 72;
 int blf_mono_font = -1;
 int blf_mono_font_render = -1;
 
-static FontBLF *BLF_get(int fontid)
+static FontBLF *blf_get(int fontid)
 {
 	if (fontid >= 0 && fontid < BLF_MAX_FONT)
 		return global_font[fontid];
@@ -141,6 +140,21 @@ static int blf_search_available(void)
 	return -1;
 }
 
+static int blf_global_font_init(void)
+{
+	if (global_font_default == -1) {
+		global_font_default = blf_search("default");
+	}
+
+	if (global_font_default == -1) {
+		printf("Warning: Can't find default font!\n");
+		return 0;
+	}
+	else {
+		return 1;
+	}
+}
+
 int BLF_load(const char *name)
 {
 	FontBLF *font;
@@ -219,7 +233,7 @@ int BLF_load_unique(const char *name)
 
 void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		blf_font_attach_from_mem(font, mem, mem_size);
@@ -311,7 +325,7 @@ void BLF_unload(const char *name)
 
 void BLF_enable(int fontid, int option)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->flags |= option;
@@ -320,7 +334,7 @@ void BLF_enable(int fontid, int option)
 
 void BLF_disable(int fontid, int option)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->flags &= ~option;
@@ -329,7 +343,7 @@ void BLF_disable(int fontid, int option)
 
 void BLF_enable_default(int option)
 {
-	FontBLF *font = BLF_get(global_font_default);
+	FontBLF *font = blf_get(global_font_default);
 
 	if (font) {
 		font->flags |= option;
@@ -338,7 +352,7 @@ void BLF_enable_default(int option)
 
 void BLF_disable_default(int option)
 {
-	FontBLF *font = BLF_get(global_font_default);
+	FontBLF *font = blf_get(global_font_default);
 
 	if (font) {
 		font->flags &= ~option;
@@ -347,7 +361,7 @@ void BLF_disable_default(int option)
 
 void BLF_aspect(int fontid, float x, float y, float z)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->aspect[0] = x;
@@ -358,7 +372,7 @@ void BLF_aspect(int fontid, float x, float y, float z)
 
 void BLF_matrix(int fontid, const double m[16])
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		memcpy(font->m, m, sizeof(font->m));
@@ -367,7 +381,7 @@ void BLF_matrix(int fontid, const double m[16])
 
 void BLF_position(int fontid, float x, float y, float z)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		float xa, ya, za;
@@ -416,7 +430,7 @@ void BLF_position(int fontid, float x, float y, float z)
 
 void BLF_size(int fontid, int size, int dpi)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		blf_font_size(font, size, dpi);
@@ -425,7 +439,7 @@ void BLF_size(int fontid, int size, int dpi)
 
 void BLF_blur(int fontid, int size)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->blur = size;
@@ -437,13 +451,8 @@ void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
 	if (!str)
 		return;
 
-	if (global_font_default == -1)
-		global_font_default = blf_search("default");
-
-	if (global_font_default == -1) {
-		printf("Warning: Can't found default font!!\n");
+	if (!blf_global_font_init())
 		return;
-	}
 
 	BLF_size(global_font_default, global_font_points, global_font_dpi);
 	BLF_position(global_font_default, x, y, z);
@@ -456,13 +465,8 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
 	if (!str)
 		return;
 
-	if (global_font_default == -1)
-		global_font_default = blf_search("default");
-
-	if (global_font_default == -1) {
-		printf("Warning: Can't found default font!!\n");
+	if (!blf_global_font_init())
 		return;
-	}
 
 	BLF_size(global_font_default, global_font_points, global_font_dpi);
 	BLF_position(global_font_default, x, y, z);
@@ -471,7 +475,7 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
 
 void BLF_rotation_default(float angle)
 {
-	FontBLF *font = BLF_get(global_font_default);
+	FontBLF *font = blf_get(global_font_default);
 
 	if (font) {
 		font->angle = angle;
@@ -543,7 +547,7 @@ static void blf_draw__end(GLint mode, GLint param)
 
 void BLF_draw(int fontid, const char *str, size_t len)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 	GLint mode, param;
 
 	if (font && font->glyph_cache) {
@@ -555,7 +559,7 @@ void BLF_draw(int fontid, const char *str, size_t len)
 
 void BLF_draw_ascii(int fontid, const char *str, size_t len)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 	GLint mode, param;
 
 	if (font && font->glyph_cache) {
@@ -567,7 +571,7 @@ void BLF_draw_ascii(int fontid, const char *str, size_t len)
 
 void BLF_boundbox(int fontid, const char *str, rctf *box)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		blf_font_boundbox(font, str, box);
@@ -576,16 +580,29 @@ void BLF_boundbox(int fontid, const char *str, rctf *box)
 
 void BLF_width_and_height(int fontid, const char *str, float *width, float *height)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		blf_font_width_and_height(font, str, width, height);
 	}
+	else {
+		*width = *height = 0.0f;
+	}
+}
+
+void BLF_width_and_height_default(const char *str, float *width, float *height)
+{
+	if (!blf_global_font_init()) {
+		*width = *height = 0.0f;
+		return;
+	}
+
+	BLF_width_and_height(global_font_default, str, width, height);
 }
 
 float BLF_width(int fontid, const char *str)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return blf_font_width(font, str);
@@ -596,7 +613,7 @@ float BLF_width(int fontid, const char *str)
 
 float BLF_fixed_width(int fontid)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return blf_font_fixed_width(font);
@@ -607,13 +624,8 @@ float BLF_fixed_width(int fontid)
 
 float BLF_width_default(const char *str)
 {
-	if (global_font_default == -1)
-		global_font_default = blf_search("default");
-
-	if (global_font_default == -1) {
-		printf("Error: Can't found default font!!\n");
+	if (!blf_global_font_init())
 		return 0.0f;
-	}
 
 	BLF_size(global_font_default, global_font_points, global_font_dpi);
 	return BLF_width(global_font_default, str);
@@ -621,7 +633,7 @@ float BLF_width_default(const char *str)
 
 float BLF_height(int fontid, const char *str)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return blf_font_height(font, str);
@@ -632,7 +644,7 @@ float BLF_height(int fontid, const char *str)
 
 float BLF_height_max(int fontid)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return font->glyph_cache->max_glyph_height;
@@ -643,7 +655,7 @@ float BLF_height_max(int fontid)
 
 float BLF_width_max(int fontid)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return font->glyph_cache->max_glyph_width;
@@ -654,7 +666,7 @@ float BLF_width_max(int fontid)
 
 float BLF_descender(int fontid)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return font->glyph_cache->descender;
@@ -665,7 +677,7 @@ float BLF_descender(int fontid)
 
 float BLF_ascender(int fontid)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache) {
 		return font->glyph_cache->ascender;
@@ -676,13 +688,8 @@ float BLF_ascender(int fontid)
 
 float BLF_height_default(const char *str)
 {
-	if (global_font_default == -1)
-		global_font_default = blf_search("default");
-
-	if (global_font_default == -1) {
-		printf("Error: Can't found default font!!\n");
+	if (!blf_global_font_init())
 		return 0.0f;
-	}
 
 	BLF_size(global_font_default, global_font_points, global_font_dpi);
 
@@ -691,7 +698,7 @@ float BLF_height_default(const char *str)
 
 void BLF_rotation(int fontid, float angle)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->angle = angle;
@@ -700,7 +707,7 @@ void BLF_rotation(int fontid, float angle)
 
 void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->clip_rec.xmin = xmin;
@@ -712,7 +719,7 @@ void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax)
 
 void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax)
 {
-	FontBLF *font = BLF_get(global_font_default);
+	FontBLF *font = blf_get(global_font_default);
 
 	if (font) {
 		font->clip_rec.xmin = xmin;
@@ -724,7 +731,7 @@ void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax)
 
 void BLF_shadow(int fontid, int level, float r, float g, float b, float a)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->shadow = level;
@@ -737,7 +744,7 @@ void BLF_shadow(int fontid, int level, float r, float g, float b, float a)
 
 void BLF_shadow_offset(int fontid, int x, int y)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->shadow_x = x;
@@ -747,7 +754,7 @@ void BLF_shadow_offset(int fontid, int x, int y)
 
 void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->buf_info.fbuf = fbuf;
@@ -761,7 +768,7 @@ void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int
 
 void BLF_buffer_col(int fontid, float r, float g, float b, float a)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font) {
 		font->buf_info.col[0] = r;
@@ -773,7 +780,7 @@ void BLF_buffer_col(int fontid, float r, float g, float b, float a)
 
 void BLF_draw_buffer(int fontid, const char *str)
 {
-	FontBLF *font = BLF_get(fontid);
+	FontBLF *font = blf_get(fontid);
 
 	if (font && font->glyph_cache && (font->buf_info.fbuf || font->buf_info.cbuf)) {
 		blf_font_buffer(font, str);
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index b694f1f..0ed4862 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -28,265 +28,219 @@
  */
 
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "BKE_global.h"
-
-#include "BLF_api.h"
-
 #include "BLF_translation.h" /* own include */
 
 #ifdef WITH_INTERNATIONAL
 
-#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#if defined(_WIN32)
-#include <windows.h>
-#endif
+#include "boost_locale_wrapper.h"
 
-#include "libintl.h"
+#include "BKE_global.h"
 
 #include "DNA_userdef_types.h"
 
-#include "DNA_listBase.h"
-#include "DNA_vec_types.h"
+#include "RNA_types.h"
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_linklist.h" /* linknode */
+#include "BLI_fileops.h"
+#include "BLI_linklist.h"
+#include "BLI_path_util.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
-#include "BLI_path_util.h"
-
-#define SYSTEM_ENCODING_DEFAULT "UTF-8"
-#define FONT_SIZE_DEFAULT 12
 
 /* Locale options. */
-static char global_messagepath[1024];
-static char global_language[32];
-static char global_encoding_name[32];
-
-/* Map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */
-static const char *locales[] = {
-	"", "",
-	"english", "en_US",
-	"japanese", "ja_JP",
-	"dutch", "nl_NL",
-	"italian", "it_IT",
-	"german", "de_DE",
-	"finnish", "fi_FI",
-	"swedish", "sv_SE",
-	"french", "fr_FR",
-	"spanish", "es",
-	"catalan", "ca_AD",
-	"czech", "cs_CZ",
-	"portuguese", "pt_PT",
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-	"Chinese (Simplified)_China.1252", "zh_CN",
-	"Chinese (Traditional)_China.1252", "zh_TW",
-#else
-	"chs", "zh_CN",
-	"cht", "zh_TW",
-#endif
-	"russian", "ru_RU",
-	"croatian", "hr_HR",
-	"serbian", "sr_RS",
-	"ukrainian", "uk_UA",
-	"polish", "pl_PL",
-	"romanian", "ro_RO",
-	"arabic", "ar_EG",
-	"bulgarian", "bg_BG",
-	"greek", "el_GR",
-	"korean", "ko_KR",
-	"nepali", "ne_NP",
-	"persian", "fa_IR",
-	"indonesian", "id_ID",
-	"serbian (latin)", "sr_RS at latin",
-	"kyrgyz", "ky_KG",
-	"turkish", "tr_TR",
-	"hungarian", "hu_HU",
-	"portuguese-brazilian", "pt_BR",
-	"hebrew", "he_IL",
-};
+static const char **locales = NULL;
+static int num_locales = 0;
+static EnumPropertyItem *locales_menu = NULL;
+static int num_locales_menu = 0;
 
-void BLF_lang_init(void)
-{
-	char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
+#define ULANGUAGE ((U.language >= 0 && U.language < num_locales) ? U.language : 0)
+#define LOCALE(_id) (locales ? locales[_id] : "")
 
-	BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
+static void free_locales(void)
+{
+	if (locales) {
+		int idx = num_locales_menu - 1; /* Last item does not need to be freed! */
+		while (idx--) {
+			MEM_freeN((void *)locales_menu[idx].identifier);
+			MEM_freeN((void *)locales_menu[idx].name);
+			MEM_freeN((void *)locales_menu[idx].description); /* Also frees locales's relevant value! */
+		}
 
-	if (messagepath) {
-		BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath));
+		MEM_freeN(locales);
+		locales = NULL;
 	}
-	else {
-		printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
-		global_messagepath[0] = '\0';
+	if (locales_menu) {
+		MEM_freeN(locales_menu);
+		locales_menu = NULL;
 	}
+	num_locales = num_locales_menu = 0;
 }
 
-/* Get LANG/LANGUAGE environment variable. */
-static void get_language_variable(const char *varname, char *var, const size_t maxlen)
+static void fill_locales(void)
 {
-	char *env = getenv(varname);
-
-	if (env) {
-		char *s;
+	char *languages_path = BLI_get_folder(BLENDER_DATAFILES, "locale");
+	LinkNode *lines = NULL, *line;
+	char *str;
+	int idx = 0;
+
+	free_locales();
+
+	BLI_join_dirfile(languages_path, FILE_MAX, languages_path, "languages");
+	line = lines = BLI_file_read_as_lines(languages_path);
+
+	/* This whole "parsing" code is a bit weak, in that it expects strictly formated input file...
+	 * Should not be a problem, though, as this file is script-generated! */
+
+	/* First loop to find highest locale ID */
+	while (line) {
+		int t;
+		str = (char*) line->link;
+		if (str[0] == '#' || str[0] == '\0') {
+			line = line->next;
+			continue; /* Comment or void... */
+		}
+		t = atoi(str);
+		if (t >= num_locales)
+			num_locales = t + 1;
+		num_locales_menu++;
+		line = line->next;
+	}
+	num_locales_menu++; /* The "closing" void item... */
+
+	/* And now, buil locales and locale_menu! */
+	locales_menu = MEM_callocN(num_locales_menu * sizeof(EnumPropertyItem), __func__);
+	line = lines;
+	/* Do not allocate locales with zero-sized mem, as LOCALE macro uses NULL locales as invalid marker! */
+	if (num_locales > 0) {
+		locales = MEM_callocN(num_locales * sizeof(char*), __func__);
+		while (line) {
+			int id;
+			char *loc, *sep1, *sep2, *sep3;
+
+			str = (char*) line->link;
+			if (str[0] == '#' || str[0] == '\0') {
+				line = line->next;
+				continue;
+			}
 
-		/* Store defaul locale. */
-		BLI_strncpy(var, env, maxlen);
+			id = atoi(str);
+			sep1 = strchr(str, ':');
+			if (sep1) {
+				sep1++;
+				sep2 = strchr(sep1, ':');
+				if (sep2) {
+					locales_menu[idx].value = id;
+					locales_menu[idx].icon = 0;
+					locales_menu[idx].name = BLI_strdupn(sep1, sep2 - sep1);
+
+					sep2++;
+					sep3 = strchr(sep2, ':');
+
+					if (sep3) {
+						locales_menu[idx].identifier = loc = BLI_strdupn(sep2, sep3 - sep2);
+					}
+					else {
+						locales_menu[idx].identifier = loc = BLI_strdup(sep2);
+					}
+
+					if (id == 0) {
+						/* The DEFAULT item... */
+						if (BLI_strnlen(loc, 2)) {
+							locales[id] = locales_menu[idx].description = BLI_strdup("");
+						}
+						/* Menu "label", not to be stored in locales! */
+						else {
+							locales_menu[idx].description = BLI_strdup("");
+						}
+					}
+					else {
+						locales[id] = locales_menu[idx].description = BLI_strdup(loc);
+					}
+					idx++;
+				}
+			}
 
-		/* Use first language as default. */
-		s = strchr(var, ':');
-		if (s)
-			s[0] = 0;
+			line = line->next;
+		}
 	}
+
+	/* Add closing item to menu! */
+	locales_menu[idx].identifier = NULL;
+	locales_menu[idx].value = locales_menu[idx].icon = 0;
+	locales_menu[idx].name = locales_menu[idx].description = "";
+
+	BLI_file_free_lines(lines);
 }
 
-/* Get language to be used based on locale (which might be empty when using default language) and
- * LANG environment variable.
- */
-static void get_language(const char *locale, const char *lang, char *language, const size_t maxlen)
+EnumPropertyItem *BLF_RNA_lang_enum_properties(void)
 {
-	if (locale[0]) {
-		BLI_strncpy(language, locale, maxlen);
-	}
-	else {
-		char *s;
+	return locales_menu;
+}
 
-		BLI_strncpy(language, lang, maxlen);
+void BLF_lang_init(void)
+{
+	char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
 
-		s = strchr(language, '.');
-		if (s)
-			s[0] = 0;
+	if (messagepath) {
+		bl_locale_init(messagepath, TEXT_DOMAIN_NAME);
+		fill_locales();
 	}
+	else {
+		printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
+	}
+}
+
+void BLF_lang_free(void)
+{
+	free_locales();
 }
 
-/* XXX WARNING!!! In osx somehow the previous function call jumps in this one??? (ton, ppc) */
 void BLF_lang_set(const char *str)
 {
-	char *locreturn;
-	const char *short_locale;
-	int ok = 1;
-	const char *long_locale = locales[2 * U.language];
+	int ulang = ULANGUAGE;
+	const char *short_locale = str ? str : LOCALE(ulang);
+	const char *short_locale_utf8 = NULL;
 
 	if ((U.transopts & USER_DOTRANSLATE) == 0)
 		return;
 
-	if (str)
-		short_locale = str;
-	else
-		short_locale = locales[2 * U.language + 1];
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-	if (short_locale) {
-		char *envStr;
-
-		if (U.language == 0) /* Use system setting. */
-			envStr = BLI_sprintfN("LANG=%s", getenv("LANG"));
-		else
-			envStr = BLI_sprintfN("LANG=%s", short_locale);
-
-		gettext_putenv(envStr);
-		MEM_freeN(envStr);
-	}
-
-	locreturn = setlocale(LC_ALL, long_locale);
-
-	if (locreturn == NULL) {
-		if (G.debug & G_DEBUG)
-			printf("Could not change locale to %s\n", long_locale);
-
-		ok = 0;
-	}
-#else
-	{
-		static char default_lang[64] = "\0";
-		static char default_language[64] = "\0";
-
-		if (default_lang[0] == 0)
-			get_language_variable("LANG", default_lang, sizeof(default_lang));
-
-		if (default_language[0] == 0)
-			get_language_variable("LANGUAGE", default_language, sizeof(default_language));
-
-		if (short_locale[0]) {
-			if (G.debug & G_DEBUG)
-				printf("Setting LANG= and LANGUAGE to %s\n", short_locale);
-
-			BLI_setenv("LANG", short_locale);
-			BLI_setenv("LANGUAGE", short_locale);
+	/* We want to avoid locales like '.UTF-8'! */
+	if (short_locale[0]) {
+		/* Hurrey! encoding needs to be placed *before* variant! */
+		char *variant = strchr(short_locale, '@');
+		if (variant) {
+			char *locale = BLI_strdupn(short_locale, variant - short_locale);
+			short_locale_utf8 = BLI_sprintfN("%s.UTF-8%s", locale, variant);
+			MEM_freeN(locale);
 		}
 		else {
-			if (G.debug & G_DEBUG)
-				printf("Setting LANG=%s and LANGUAGE=%s\n", default_lang, default_language);
-
-			BLI_setenv("LANG", default_lang);
-			BLI_setenv("LANGUAGE", default_language);
-		}
-
-		locreturn = setlocale(LC_ALL, short_locale);
-
-		if (locreturn == NULL) {
-			char *short_locale_utf8 = NULL;
-
-			if (short_locale[0]) {
-				short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
-				locreturn = setlocale(LC_ALL, short_locale_utf8);
-			}
-
-			if (locreturn == NULL) {
-				char language[65];
-
-				get_language(long_locale, default_lang, language, sizeof(language));
-
-				if (G.debug & G_DEBUG) {
-					if (short_locale[0])
-						printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
-					else
-						printf("Could not reset locale\n");
-
-					printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language);
-				}
-
-				/* Fallback to default settings. */
-				BLI_setenv("LANG", default_lang);
-				BLI_setenv("LANGUAGE", language);
-
-				locreturn = setlocale(LC_ALL, "");
-
-				ok = 0;
-			}
-
-			if (short_locale_utf8)
-				MEM_freeN(short_locale_utf8);
+			short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
 		}
 	}
-#endif
-
-	if (ok) {
-		/*printf("Change locale to %s\n", locreturn ); */
-		BLI_strncpy(global_language, locreturn, sizeof(global_language));
+	else {
+		short_locale_utf8 = short_locale;
 	}
 
-	setlocale(LC_NUMERIC, "C");
+	bl_locale_set(short_locale_utf8);
 
-	textdomain(TEXT_DOMAIN_NAME);
-	bindtextdomain(TEXT_DOMAIN_NAME, global_messagepath);
-	bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name);
+	if (short_locale[0]) {
+		MEM_freeN((void*)short_locale_utf8);
+	}
 }
 
 const char *BLF_lang_get(void)
 {
-	return locales[2 * U.language + 1];
+	int uilang = ULANGUAGE;
+	return LOCALE(uilang);
 }
 
-void BLF_lang_encoding(const char *str)
-{
-	BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name));
-	/* bind_textdomain_codeset(TEXT_DOMAIN_NAME, encoding_name); */
-}
+#undef LOCALE
+#undef ULANGUAGE
 
 #else /* ! WITH_INTERNATIONAL */
 
@@ -295,9 +249,8 @@ void BLF_lang_init(void)
 	return;
 }
 
-void BLF_lang_encoding(const char *str)
+void BLF_lang_free(void)
 {
-	(void)str;
 	return;
 }
 
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 9c863da..5d4b631 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -31,18 +31,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef WITH_INTERNATIONAL
-#include <libintl.h>
-#include <locale.h>
-
-#define GETTEXT_CONTEXT_GLUE "\004"
+#include "BLF_translation.h"
 
-/* needed for windows version of gettext */
-#ifndef LC_MESSAGES
-#  define LC_MESSAGES 1729
-#endif
+#ifdef WITH_INTERNATIONAL
 
-#endif
+#include "boost_locale_wrapper.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -52,11 +45,8 @@
 #include "BLI_path_util.h"
 #include "BLI_fileops.h"
 
-#include "BLF_translation.h"
-
 #include "DNA_userdef_types.h" /* For user settings. */
 
-#ifdef WITH_INTERNATIONAL
 static const char unifont_filename[] = "droidsans.ttf.gz";
 static unsigned char *unifont_ttf = NULL;
 static int unifont_size = 0;
@@ -90,55 +80,19 @@ void BLF_free_unifont(void)
 
 #endif
 
-const char *BLF_gettext(const char *msgid)
+const char *BLF_pgettext(const char *msgctxt, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-	if (msgid && msgid[0])
-		return gettext(msgid);
+	if (msgid && msgid[0]) {
+		return bl_locale_pgettext(msgctxt, msgid);
+	}
 	return "";
 #else
+	(void)msgctxt;
 	return msgid;
 #endif
 }
 
-const char *BLF_pgettext(const char *context, const char *message)
-{
-#ifdef WITH_INTERNATIONAL
-	char static_msg_ctxt_id[1024];
-	char *dynamic_msg_ctxt_id = NULL;
-	char *msg_ctxt_id;
-	const char *translation;
-
-	size_t overall_length = strlen(context) + strlen(message) + sizeof(GETTEXT_CONTEXT_GLUE) + 1;
-
-	if (!message || !context || !message[0])
-		return "";
-
-	if (overall_length > sizeof(static_msg_ctxt_id)) {
-		dynamic_msg_ctxt_id = malloc(overall_length);
-		msg_ctxt_id = dynamic_msg_ctxt_id;
-	}
-	else {
-		msg_ctxt_id = static_msg_ctxt_id;
-	}
-
-	sprintf(msg_ctxt_id, "%s%s%s", context, GETTEXT_CONTEXT_GLUE, message);
-
-	translation = (char *)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
-
-	if (dynamic_msg_ctxt_id)
-		free(dynamic_msg_ctxt_id);
-
-	if (translation == msg_ctxt_id)
-		translation = message;
-
-	return translation;
-#else
-	(void)context;
-	return message;
-#endif
-}
-
 int BLF_translate_iface(void)
 {
 #ifdef WITH_INTERNATIONAL
@@ -157,36 +111,32 @@ int BLF_translate_tooltips(void)
 #endif
 }
 
-const char *BLF_translate_do_iface(const char *context, const char *msgid)
+const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
 	if (BLF_translate_iface()) {
-		if (context)
-			return BLF_pgettext(context, msgid);
-		else
-			return BLF_gettext(msgid);
+		return BLF_pgettext(msgctxt, msgid);
 	}
-	else
+	else {
 		return msgid;
+	}
 #else
-	(void)context;
+	(void)msgctxt;
 	return msgid;
 #endif
 }
 
-const char *BLF_translate_do_tooltip(const char *context, const char *msgid)
+const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
 	if (BLF_translate_tooltips()) {
-		if (context)
-			return BLF_pgettext(context, msgid);
-		else
-			return BLF_gettext(msgid);
+		return BLF_pgettext(msgctxt, msgid);
 	}
-	else
+	else {
 		return msgid;
+	}
 #else
-	(void)context;
+	(void)msgctxt;
 	return msgid;
 #endif
 }
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index fa9223b..617c4cd 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -148,6 +148,11 @@ typedef enum DMDrawFlag {
 typedef enum DMDirtyFlag {
 	/* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */
 	DM_DIRTY_TESS_CDLAYERS = 1 << 0,
+	/* One of the MCOL layers have been updated, force updating of GPUDrawObject's colors buffer.
+	 * This is necessary with modern, VBO draw code, as e.g. in vpaint mode me->mcol may be updated
+	 * without actually rebuilding dm (hence by defautl keeping same GPUDrawObject, and same colors
+	 * buffer, which prevents update during a stroke!). */
+	DM_DIRTY_MCOL_UPDATE_DRAW = 1 << 1,
 } DMDirtyFlag;
 
 typedef struct DerivedMesh DerivedMesh;
@@ -223,6 +228,7 @@ struct DerivedMesh {
 	void *(*getVertData)(DerivedMesh * dm, int index, int type);
 	void *(*getEdgeData)(DerivedMesh * dm, int index, int type);
 	void *(*getTessFaceData)(DerivedMesh * dm, int index, int type);
+	void *(*getPolyData)(DerivedMesh * dm, int index, int type);
 
 	/** Return a pointer to the entire array of vert/edge/face custom data
 	 * from the derived mesh (this gives a pointer to the actual data, not
@@ -231,7 +237,8 @@ struct DerivedMesh {
 	void *(*getVertDataArray)(DerivedMesh * dm, int type);
 	void *(*getEdgeDataArray)(DerivedMesh * dm, int type);
 	void *(*getTessFaceDataArray)(DerivedMesh * dm, int type);
-	
+	void *(*getPolyDataArray)(DerivedMesh * dm, int type);
+
 	/** Retrieves the base CustomData structures for
 	 * verts/edges/tessfaces/loops/facdes*/
 	CustomData *(*getVertDataLayout)(DerivedMesh * dm);
@@ -493,6 +500,7 @@ void DM_add_poly_layer(struct DerivedMesh *dm, int type, int alloctype,
 void *DM_get_vert_data(struct DerivedMesh *dm, int index, int type);
 void *DM_get_edge_data(struct DerivedMesh *dm, int index, int type);
 void *DM_get_tessface_data(struct DerivedMesh *dm, int index, int type);
+void *DM_get_poly_data(struct DerivedMesh *dm, int index, int type);
 
 /* custom data layer access functions
  * return pointer to first data layer which matches type (a flat array)
@@ -701,4 +709,16 @@ void DM_debug_print(DerivedMesh *dm);
 void DM_debug_print_cdlayers(CustomData *cdata);
 #endif
 
+#ifdef __GNUC__
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
+	__attribute__((nonnull(1)))
+;
+#endif
+
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
+{
+	const int j = index_mf_to_mpoly[i];
+	return (j != ORIGINDEX_NONE) ? (index_mp_to_orig ? index_mp_to_orig[j] : j) : ORIGINDEX_NONE;
+}
+
 #endif
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 6b9de47..b0f372e 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -99,7 +99,7 @@ void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan);
 /* get_objectspace_bone_matrix has to be removed still */
 void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[][4], int root, int posed);
 void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]);
-void mat3_to_vec_roll(float mat[][3], float *vec, float *roll);
+void mat3_to_vec_roll(float mat[][3], float r_vec[3], float *r_roll);
 
 /* Common Conversions Between Co-ordinate Spaces */
 void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index e1c79f8..b624d0f 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -41,19 +41,18 @@ extern "C" {
 /* these lines are grep'd, watch out for our not-so-awesome regex
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
-#define BLENDER_VERSION         264
-#define BLENDER_SUBVERSION      2
+#define BLENDER_VERSION         265
+#define BLENDER_SUBVERSION      0
 
-/* 262 was the last editmesh release but its has compatibility code for bmesh data,
- * so set the minversion to 2.61 */
-#define BLENDER_MINVERSION      261
+/* 262 was the last editmesh release but it has compatibility code for bmesh data */
+#define BLENDER_MINVERSION      262
 #define BLENDER_MINSUBVERSION   0
 
 /* used by packaging tools */
 /* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR    a
+#define BLENDER_VERSION_CHAR    
 /* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE   alpha
+#define BLENDER_VERSION_CYCLE   release
 
 extern char versionstr[]; /* from blender.c */
 
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 67b21eb..8bfee83 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -99,7 +99,7 @@ typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
 
 struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v);
 void BME_free_transdata(struct BME_TransData_Head *td);
-struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle,
-                        BME_TransData_Head **rtd, int do_tessface);
+struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle,
+                        BME_TransData_Head **rtd);
 
 #endif
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index d7882d8..2b2497f 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -55,8 +55,10 @@ int CDDM_Check(struct DerivedMesh *dm);
  * data to not overwrite the original */
 struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob);
 
+struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps);
+
 /* creates a CDDerivedMesh from the given BMEditMesh */
-DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int use_mdisps, int use_tessface);
+DerivedMesh *CDDM_from_editbmesh(struct BMEditMesh *em, int use_mdisps, int use_tessface);
 
 /* merge verts  */
 DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap);
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 728f88b..96e05aa 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -63,8 +63,8 @@ void                curvemapping_set_black_white(struct CurveMapping *cumap, con
 #define CURVEMAP_SLOPE_POSITIVE 1
 void                    curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope);
 void                    curvemap_remove(struct CurveMap *cuma, const short flag);
-void                    curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
-struct CurveMapPoint    *curvemap_insert(struct CurveMap *cuma, float x, float y);
+int                     curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
+struct CurveMapPoint   *curvemap_insert(struct CurveMap *cuma, float x, float y);
 void                    curvemap_sethandle(struct CurveMap *cuma, int type);
 
 void                curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
@@ -88,7 +88,6 @@ int                 curvemapping_RGBA_does_something(const struct CurveMapping *
 void                curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array, int *size);
 
 /* non-const, these modify the curve */
-void                curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf);
 void                curvemapping_premultiply(struct CurveMapping *cumap, int restore);
 
 
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index e6161ce..536bbec 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -108,7 +108,7 @@ void BKE_nurb_free(struct Nurb *nu);
 struct Nurb *BKE_nurb_duplicate(struct Nurb *nu);
 
 void BKE_nurb_test2D(struct Nurb *nu);
-void BKE_nurb_minmax(struct Nurb *nu, float *min, float *max);
+void BKE_nurb_minmax(struct Nurb *nu, float min[3], float max[3]);
 
 void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
 void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 33361b9..4736e7b 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -80,6 +80,13 @@ void customData_mask_layers__print(CustomDataMask mask);
  * the below operations.
  */
 int CustomData_layer_has_math(struct CustomData *data, int layer_n);
+int CustomData_layer_has_interp(struct CustomData *data, int layer_n);
+
+/**
+ * Checks if any of the customdata layers has math.
+ */
+int CustomData_has_math(struct CustomData *data);
+int CustomData_has_interp(struct CustomData *data);
 
 /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
  * another, while not overwriting anything else (e.g. flags).  probably only
@@ -115,7 +122,10 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 void CustomData_bmesh_merge(struct CustomData *source, struct CustomData *dest, 
                             CustomDataMask mask, int alloctype, struct BMesh *bm, const char htype);
 
-/* frees data associated with a CustomData object (doesn't free the object
+/** NULL's all members and resets the typemap. */
+void CustomData_reset(struct CustomData *data);
+
+/** frees data associated with a CustomData object (doesn't free the object
  * itself, though)
  */
 void CustomData_free(struct CustomData *data, int totelem);
@@ -205,8 +215,8 @@ void CustomData_free_elem(struct CustomData *data, int index, int count);
 void CustomData_interp(const struct CustomData *source, struct CustomData *dest,
                        int *src_indices, float *weights, float *sub_weights,
                        int count, int dest_index);
-void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks, 
-                             float *weights, float *sub_weights, int count,
+void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks,
+                             const float *weights, const float *sub_weights, int count,
                              void *dest_block);
 
 
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 52a143d..8306da7 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -54,6 +54,7 @@ struct MDeformWeight    *defvert_verify_index(struct MDeformVert *dv, const int
 void                     defvert_add_index_notest(struct MDeformVert *dv, int defgroup, const float weight);
 void                     defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
 void                     defvert_clear(struct MDeformVert *dvert);
+int                      defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
 
 float  defvert_find_weight(const struct MDeformVert *dvert, const int defgroup);
 float  defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup);
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 2656495..f6276a6 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -130,8 +130,9 @@ enum {
 	G_DEBUG_FFMPEG =    (1 << 1),
 	G_DEBUG_PYTHON =    (1 << 2), /* extra python info */
 	G_DEBUG_EVENTS =    (1 << 3), /* input/window/screen events */
-	G_DEBUG_WM =        (1 << 4), /* operator, undo */
-	G_DEBUG_JOBS =      (1 << 5)  /* jobs time profiling */
+	G_DEBUG_HANDLERS =  (1 << 4), /* events handling */
+	G_DEBUG_WM =        (1 << 5), /* operator, undo */
+	G_DEBUG_JOBS =      (1 << 6)  /* jobs time profiling */
 };
 
 #define G_DEBUG_ALL  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS)
@@ -145,17 +146,17 @@ enum {
 #define G_FILE_ENABLE_ALL_FRAMES (1 << 3)               /* deprecated */
 #define G_FILE_SHOW_DEBUG_PROPS  (1 << 4)               /* deprecated */
 #define G_FILE_SHOW_FRAMERATE    (1 << 5)               /* deprecated */
-/* #define G_FILE_SHOW_PROFILE   (1 << 6) */			/* deprecated */
+/* #define G_FILE_SHOW_PROFILE   (1 << 6) */            /* deprecated */
 #define G_FILE_LOCK              (1 << 7)
 #define G_FILE_SIGN              (1 << 8)
-/* #define G_FILE_PUBLISH	     (1 << 9) */			/* deprecated */
+/* #define G_FILE_PUBLISH        (1 << 9) */            /* deprecated */
 #define G_FILE_NO_UI             (1 << 10)
-/* #define G_FILE_GAME_TO_IPO	 (1 << 11) */			/* deprecated */
+/* #define G_FILE_GAME_TO_IPO    (1 << 11) */           /* deprecated */
 #define G_FILE_GAME_MAT          (1 << 12)              /* deprecated */
-/* #define G_FILE_DISPLAY_LISTS	 (1 << 13) */			/* deprecated */
+/* #define G_FILE_DISPLAY_LISTS  (1 << 13) */           /* deprecated */
 #define G_FILE_SHOW_PHYSICS      (1 << 14)              /* deprecated */
 #define G_FILE_GAME_MAT_GLSL     (1 << 15)              /* deprecated */
-/* #define G_FILE_GLSL_NO_LIGHTS	 (1 << 16) */		/* deprecated */
+/* #define G_FILE_GLSL_NO_LIGHTS     (1 << 16) */       /* deprecated */
 #define G_FILE_GLSL_NO_SHADERS   (1 << 17)              /* deprecated */
 #define G_FILE_GLSL_NO_SHADOWS   (1 << 18)              /* deprecated */
 #define G_FILE_GLSL_NO_RAMPS     (1 << 19)              /* deprecated */
@@ -166,6 +167,9 @@ enum {
 #define G_FILE_RELATIVE_REMAP    (1 << 24)
 #define G_FILE_HISTORY           (1 << 25)
 #define G_FILE_MESH_COMPAT       (1 << 26)              /* BMesh option to save as older mesh format */
+#define G_FILE_SAVE_COPY         (1 << 27)              /* restore paths after editing them */
+
+#define G_FILE_FLAGS_RUNTIME (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_MESH_COMPAT | G_FILE_SAVE_COPY)
 
 /* G.windowstate */
 #define G_WINDOWSTATE_USERDEF       0
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h
index ebfbe94..9af0d96 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -30,9 +30,7 @@
 
 /** \file BKE_icons.h
  *  \ingroup bke
- */
-
-/*
+ *
  * Resizable Icons for Blender
  */
 
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 3cf4a2c..a9f6a61 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -154,6 +154,12 @@ __attribute__((nonnull))
 #endif
 ;
 
+void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite)
+#ifdef __GNUC__
+__attribute__((nonnull))
+#endif
+;
+
 /**
  * This function has a sanity check to make sure ID properties with the same name don't
  * get added to the group.
@@ -260,6 +266,12 @@ __attribute__((nonnull))
 #endif
 ;
 
+int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+#endif
+;
+
 int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
@@ -306,11 +318,16 @@ void IDP_FreeProperty(struct IDProperty *prop);
 /** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
 void IDP_UnlinkProperty(struct IDProperty *prop);
 
-#define IDP_Int(prop) ((prop)->data.val)
-#define IDP_Float(prop) (*(float *)&(prop)->data.val)
-#define IDP_String(prop) ((char *)(prop)->data.pointer)
-#define IDP_Array(prop) ((prop)->data.pointer)
-#define IDP_IDPArray(prop) ((IDProperty *)(prop)->data.pointer)
-#define IDP_Double(prop) (*(double *)&(prop)->data.val)
+#define IDP_Int(prop)                     ((prop)->data.val)
+#define IDP_Float(prop)        (*(float *)&(prop)->data.val)
+#define IDP_Double(prop)      (*(double *)&(prop)->data.val)
+#define IDP_String(prop)         ((char *) (prop)->data.pointer)
+#define IDP_Array(prop)                   ((prop)->data.pointer)
+#define IDP_IDPArray(prop) ((IDProperty *) (prop)->data.pointer)
+
+#ifdef DEBUG
+/* for printout only */
+void IDP_spit(IDProperty *prop);
+#endif
 
 #endif /* __BKE_IDPROP_H__ */
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 5e5f58f..1f9630d 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -48,6 +48,9 @@ struct Main;
 
 #define IMA_MAX_SPACE       64
 
+void   BKE_images_init(void);
+void   BKE_images_exit(void);
+
 /* call from library */
 void    BKE_image_free(struct Image *me);
 
@@ -127,19 +130,19 @@ enum {
 #define IMA_SIGNAL_SRC_CHANGE       5
 /* image-user gets a new image, check settings */
 #define IMA_SIGNAL_USER_NEW_IMAGE   6
+#define IMA_SIGNAL_COLORMANAGE      7
 
 #define IMA_CHAN_FLAG_BW    1
 #define IMA_CHAN_FLAG_RGB   2
 #define IMA_CHAN_FLAG_ALPHA 4
 
-/* depending Image type, and (optional) ImageUser setting it returns ibuf */
-/* always call to make signals work */
-struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
+/* checks whether there's an image buffer for given image and user */
+int BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser);
 
 /* same as above, but can be used to retrieve images being rendered in
  * a thread safe way, always call both acquire and release */
 struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r);
-void BKE_image_release_ibuf(struct Image *ima, void *lock);
+void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock);
 
 /* returns a new image or NULL if it can't load */
 struct Image *BKE_image_load(const char *filepath);
diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h
index 3acd4d1..244decf 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_lamp.h
@@ -37,6 +37,7 @@ extern "C" {
 #endif
 
 struct Lamp;
+struct Scene;
 
 struct Lamp *BKE_lamp_add(const char *name) WARN_UNUSED;
 struct Lamp *BKE_lamp_copy(struct Lamp *la) WARN_UNUSED;
@@ -44,6 +45,8 @@ struct Lamp *localize_lamp(struct Lamp *la) WARN_UNUSED;
 void BKE_lamp_make_local(struct Lamp *la);
 void BKE_lamp_free(struct Lamp *la);
 
+void lamp_drivers_update(struct Scene *scene, struct Lamp *la, float ctime);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index 31626ef..34baa48 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -46,7 +46,7 @@ struct Lattice *BKE_lattice_add(const char *name);
 struct Lattice *BKE_lattice_copy(struct Lattice *lt);
 void BKE_lattice_free(struct Lattice *lt);
 void BKE_lattice_make_local(struct Lattice *lt);
-void calc_lat_fudu(int flag, int res, float *fu, float *du);
+void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
 
 void init_latt_deform(struct Object *oblatt, struct Object *ob);
 void calc_latt_deform(struct Object *, float co[3], float weight);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 9175644..bc081b7 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -81,6 +81,7 @@ int set_listbasepointers(struct Main *main, struct ListBase **lb);
 
 void BKE_libblock_free(struct ListBase *lb, void *idv);
 void BKE_libblock_free_us(struct ListBase *lb, void *idv);
+void BKE_libblock_free_data(struct ID *id);
 void free_main(struct Main *mainvar);
 
 void tag_main_idcode(struct Main *mainvar, const short type, const short tag);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index c14085a..e53d0ef 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -130,7 +130,7 @@ struct Mesh *BKE_mesh_copy(struct Mesh *me);
 void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd);
 
 void BKE_mesh_make_local(struct Mesh *me);
-void BKE_mesh_boundbox_calc(struct Mesh *me, float *loc, float *size);
+void BKE_mesh_boundbox_calc(struct Mesh *me, float r_loc[3], float r_size[3]);
 void BKE_mesh_texspace_calc(struct Mesh *me);
 float *BKE_mesh_orco_verts_get(struct Object *ob);
 void   BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
@@ -283,15 +283,16 @@ typedef struct IndexNode {
 void create_vert_poly_map(MeshElemMap **map, int **mem,
                           const struct MPoly *mface, const struct MLoop *mloop,
                           int totvert, int totface, int totloop);
-	
+
 void create_vert_edge_map(MeshElemMap **map, int **mem,
-						  const struct MEdge *medge, int totvert, int totedge);
+                          const struct MEdge *medge, int totvert, int totedge);
 
 /* vertex level transformations & checks (no derived mesh) */
 
 int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]);
 int BKE_mesh_center_median(struct Mesh *me, float cent[3]);
 int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]);
+int BKE_mesh_center_centroid(struct Mesh *me, float cent[3]);
 void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys);
 
 /* mesh_validate.c */
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 3b675f3..2fa78b3 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -319,8 +319,8 @@ int           modifier_dependsOnTime(struct ModifierData *md);
 int           modifier_supportsMapping(struct ModifierData *md);
 int           modifier_couldBeCage(struct Scene *scene, struct ModifierData *md);
 int           modifier_isCorrectableDeformed(struct ModifierData *md);
-int           modifier_sameTopology(ModifierData *md);
-int           modifier_nonGeometrical(ModifierData *md);
+int           modifier_isSameTopology(ModifierData *md);
+int           modifier_isNonGeometrical(ModifierData *md);
 int           modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
 void          modifier_setError(struct ModifierData *md, const char *format, ...)
 #ifdef __GNUC__
@@ -352,6 +352,7 @@ int           modifiers_isParticleEnabled(struct Object *ob);
 
 struct Object *modifiers_isDeformedByArmature(struct Object *ob);
 struct Object *modifiers_isDeformedByLattice(struct Object *ob);
+struct Object *modifiers_isDeformedByCurve(struct Object *ob);
 int           modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
 int           modifiers_isCorrectableDeformed(struct Object *ob);
 void          modifier_freeTemporaryData(struct ModifierData *md);
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index 8fa20eb..bee2c37 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -48,7 +48,7 @@ struct Scene;
 void multires_customdata_delete(struct Mesh *me);
 
 void multires_set_tot_level(struct Object *ob,
-							struct MultiresModifierData *mmd, int lvl);
+                            struct MultiresModifierData *mmd, int lvl);
 
 void multires_mark_as_modified(struct Object *ob, enum MultiresModifiedFlags flags);
 
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index acd6f12..b8f168c 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -34,8 +34,6 @@
 
 #include "DNA_listBase.h"
 
-#include "RNA_types.h"
-
 /* not very important, but the stack solver likes to know a maximum */
 #define MAX_SOCKET	64
 
@@ -82,7 +80,7 @@ typedef struct bNodeSocketTemplate {
 	char name[64];	/* MAX_NAME */
 	float val1, val2, val3, val4;   /* default alloc value for inputs */
 	float min, max;
-	PropertySubType subtype;
+	int subtype;  /* would use PropertySubType but this is a bad level include to use RNA */
 	int flag;
 	
 	/* after this line is used internal only */
@@ -193,10 +191,8 @@ typedef struct bNodeType {
 	struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit);
 	void (*group_edit_clear)(struct bNode *node);
 	
-	/* Generate a temporary list of internal links (bNodeLink), for muting and disconnect operators.
-	 * Result must be freed by caller!
-	 */
-	ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node);
+	/* Update the internal links list, for muting and disconnect operators. */
+	void (*update_internal_links)(struct bNodeTree *, struct bNode *node);
 	
 	/* **** execution callbacks **** */
 	void *(*initexecfunc)(struct bNode *node);
@@ -247,6 +243,7 @@ typedef struct bNodeType {
 #define NODE_CLASS_PARTICLES		25
 #define NODE_CLASS_TRANSFORM		30
 #define NODE_CLASS_COMBINE			31
+#define NODE_CLASS_SCRIPT			32
 #define NODE_CLASS_SHADER 			40
 #define NODE_CLASS_LAYOUT			100
 
@@ -293,7 +290,7 @@ typedef struct bNodeTreeType {
 	int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
 
 	/* Default internal linking. */
-	ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node);
+	void (*update_internal_links)(struct bNodeTree *, struct bNode *node);
 } bNodeTreeType;
 
 /* ************** GENERIC API, TREES *************** */
@@ -317,6 +314,8 @@ void              ntreeUserIncrefID(struct bNodeTree *ntree);
 void              ntreeUserDecrefID(struct bNodeTree *ntree);
 
 
+struct bNodeTree *ntreeFromID(struct ID *id);
+
 void              ntreeMakeLocal(struct bNodeTree *ntree);
 int               ntreeHasType(struct bNodeTree *ntree, int type);
 void              ntreeUpdateTree(struct bNodeTree *ntree);
@@ -349,7 +348,7 @@ struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree, struct bNode *node
 void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
 void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
 
-void            nodeAddToPreview(struct bNode *node, float col[4], int x, int y, int do_manage);
+void            nodeAddToPreview(struct bNode *node, const float col[4], int x, int y, int do_manage);
 
 struct bNode	*nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 void            nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
@@ -389,6 +388,7 @@ struct bNode   *nodeGetActiveTexture(struct bNodeTree *ntree);
 
 void            nodeUpdate(struct bNodeTree *ntree, struct bNode *node);
 int             nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
+void            nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node);
 
 void            nodeFreePreview(struct bNode *node);
 
@@ -445,7 +445,7 @@ void            node_type_exec_new(struct bNodeType *ntype,
                                    void (*freeexecfunc)(struct bNode *node, void *nodedata),
                                    void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata,
                                                        struct bNodeStack **, struct bNodeStack **));
-void            node_type_internal_connect(struct bNodeType *ntype, ListBase (*internal_connect)(struct bNodeTree *, struct bNode *));
+void            node_type_internal_links(struct bNodeType *ntype, void (*update_internal_links)(struct bNodeTree *, struct bNode *));
 void            node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node,
                                                                       struct GPUNodeStack *in, struct GPUNodeStack *out));
 void            node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node,
@@ -456,8 +456,8 @@ void            node_type_compatibility(struct bNodeType *ntype, short compatibi
 /* ************** COMMON NODES *************** */
 
 #define NODE_GROUP		2
-#define NODE_FORLOOP	3
-#define NODE_WHILELOOP	4
+#define __NODE_FORLOOP	3	/* deprecated */
+#define __NODE_WHILELOOP	4	/* deprecated */
 #define NODE_FRAME		5
 #define NODE_REROUTE	6
 
@@ -551,6 +551,12 @@ struct ShadeResult;
 #define SH_NODE_OBJECT_INFO				167
 #define SH_NODE_PARTICLE_INFO           168
 #define SH_NODE_TEX_BRICK				169
+#define SH_NODE_BUMP					170
+#define SH_NODE_SCRIPT					171
+#define SH_NODE_AMBIENT_OCCLUSION		172
+#define SH_NODE_BSDF_REFRACTION			173
+#define SH_NODE_TANGENT					174
+#define SH_NODE_NORMAL_MAP				175
 
 /* custom defines options for Material node */
 #define SH_NODE_MAT_DIFF   1
@@ -698,6 +704,9 @@ void            ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
 #define CMP_NODE_BOKEHIMAGE     315
 #define CMP_NODE_BOKEHBLUR      316
 #define CMP_NODE_SWITCH         317
+#define CMP_NODE_PIXELATE       318
+
+#define CMP_NODE_MAP_RANGE	319
 
 /* channel toggles */
 #define CMP_CHAN_RGB		1
@@ -784,7 +793,9 @@ void ntreeTexCheckCyclics(struct bNodeTree *ntree);
 
 struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
 void ntreeTexEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
-int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, int osatex, short thread, struct Tex *tex, short which_output, int cfra, int preview, struct ShadeInput *shi, struct MTex *mtex);
+int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target,
+                     float coord[3], float dxt[3], float dyt[3], int osatex, const short thread,
+                     struct Tex *tex, short which_output, int cfra, int preview, struct ShadeInput *shi, struct MTex *mtex);
 
 
 /*************************************************/
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index a93e542..c452c17 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -94,6 +94,7 @@ typedef struct SculptSession {
 
 	/* PBVH acceleration structure */
 	struct PBVH *pbvh;
+	int show_diffuse_color;
 
 	/* Paiting on deformed mesh */
 	int modifiers_active; /* object is deformed with some modifiers */
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index b3e650b..ec03f53 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -257,7 +257,9 @@ void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4],
 
 void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
 
-void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache,
+                              float fuv[4], float foffset, float vec[3], float nor[3],
+                              float utan[3], float vtan[3], float orco[3], float ornor[3]);
 struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct ParticleSystem *psys);
 
 struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
@@ -282,8 +284,11 @@ void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, s
 int psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, int always);
 
 /* for anim.c */
-void psys_get_dupli_texture(struct ParticleSystem *psys, struct ParticleSettings *part, struct ParticleSystemModifierData *psmd, struct ParticleData *pa, struct ChildParticle *cpa, float *uv, float *orco);
-void psys_get_dupli_path_transform(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ChildParticle *cpa, struct ParticleCacheKey *cache, float mat[][4], float *scale);
+void psys_get_dupli_texture(struct ParticleSystem *psys, struct ParticleSettings *part,
+                            struct ParticleSystemModifierData *psmd, struct ParticleData *pa, struct ChildParticle *cpa,
+                            float uv[2], float orco[3]);
+void psys_get_dupli_path_transform(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ChildParticle *cpa,
+                                   struct ParticleCacheKey *cache, float mat[][4], float *scale);
 
 ParticleThread *psys_threads_create(struct ParticleSimulationData *sim);
 void psys_threads_free(ParticleThread *threads);
@@ -327,13 +332,17 @@ void psys_free_pdd(struct ParticleSystem *psys);
 
 float *psys_cache_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup);
 void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra);
-void psys_interpolate_face(struct MVert *mvert, struct MFace *mface, struct MTFace *tface, float (*orcodata)[3], float *uv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_interpolate_face(struct MVert *mvert, struct MFace *mface, struct MTFace *tface,
+                           float (*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3],
+                           float orco[3], float ornor[3]);
 float psys_particle_value_from_verts(struct DerivedMesh *dm, short from, struct ParticleData *pa, float *values);
-void psys_get_from_key(struct ParticleKey *key, float *loc, float *vel, float *rot, float *time);
+void psys_get_from_key(struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
 
 /* BLI_bvhtree_ray_cast callback */
 void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit);
-void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3], float ornor[3]);
+void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache,
+                         const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3],
+                         float orco[3], float ornor[3]);
 
 /* particle_system.c */
 void initialize_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, int p);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index c12e913..9927c7a 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -55,7 +55,12 @@ struct Text;
 #define SCE_COPY_LINK_DATA  3
 #define SCE_COPY_FULL       4
 
-#define SETLOOPER(_sce_basis, _sce_iter, _base) _sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, NULL); _base; _base = _setlooper_base_step(&_sce_iter, _base)
+/* Use as the contents of a 'for' loop: for (SETLOOPER(...)) { ... */
+#define SETLOOPER(_sce_basis, _sce_iter, _base)                               \
+	_sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, NULL);   \
+	_base;                                                                    \
+	_base = _setlooper_base_step(&_sce_iter, _base)
+
 struct Base *_setlooper_base_step(struct Scene **sce_iter, struct Base *base);
 
 void free_avicodecdata(struct AviCodecData *acd);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 8043168..88294cb 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -68,27 +68,27 @@ void BKE_sequence_iterator_begin(struct Editing *ed, SeqIterator *iter, int use_
 void BKE_sequence_iterator_next(SeqIterator *iter);
 void BKE_sequence_iterator_end(SeqIterator *iter);
 
-#define SEQP_BEGIN(ed, _seq)                                                  \
+#define SEQP_BEGIN(_ed, _seq)                                                 \
 	{                                                                         \
-		SeqIterator iter;                                                     \
-		for (BKE_sequence_iterator_begin(ed, &iter, 1);                       \
-		     iter.valid;                                                      \
-		     BKE_sequence_iterator_next(&iter))                               \
+		SeqIterator iter_macro;                                               \
+		for (BKE_sequence_iterator_begin(_ed, &iter_macro, 1);                \
+		     iter_macro.valid;                                                \
+		     BKE_sequence_iterator_next(&iter_macro))                         \
 		{                                                                     \
-			_seq = iter.seq;
+			_seq = iter_macro.seq;
 
 #define SEQ_BEGIN(ed, _seq)                                                   \
 	{                                                                         \
-		SeqIterator iter;                                                     \
-		for (BKE_sequence_iterator_begin(ed, &iter, 0);                       \
-		     iter.valid;                                                      \
-		     BKE_sequence_iterator_next(&iter))                               \
+		SeqIterator iter_macro;                                               \
+		for (BKE_sequence_iterator_begin(ed, &iter_macro, 0);                 \
+		     iter_macro.valid;                                                \
+		     BKE_sequence_iterator_next(&iter_macro))                         \
 		{                                                                     \
-			_seq = iter.seq;
+			_seq = iter_macro.seq;
 
 #define SEQ_END                                                               \
 		}                                                                     \
-		BKE_sequence_iterator_end(&iter);                                     \
+		BKE_sequence_iterator_end(&iter_macro);                               \
 	}
 
 typedef struct SeqRenderData {
@@ -248,7 +248,7 @@ void BKE_sequencer_cache_cleanup(void);
 struct ImBuf *BKE_sequencer_cache_get(SeqRenderData context, struct Sequence *seq, float cfra, seq_stripelem_ibuf_t type);
 
 /* passed ImBuf is properly refed, so ownership is *not* 
- * transfered to the cache.
+ * transferred to the cache.
  * you can pass the same ImBuf multiple times to the cache without problems.
  */
 
@@ -356,6 +356,7 @@ typedef struct SeqLoadInfo {
 typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *);
 
 struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine);
+void BKE_sequence_init_colorspace(struct Sequence *seq);
 
 struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
 struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index 1f824cc..3a9d2b8 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -35,8 +35,10 @@
 
 typedef float (*bresenham_callback)(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
 
-void smokeModifier_do(struct SmokeModifierData *smd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm);
+struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm);
 
+void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
+void smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
 void smokeModifier_free(struct SmokeModifierData *smd);
 void smokeModifier_reset(struct SmokeModifierData *smd);
 void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
@@ -44,5 +46,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd);
 void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData *tsmd);
 
 long long smoke_get_mem_req(int xres, int yres, int zres, int amplify);
+float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
+int smoke_get_data_flags(struct SmokeDomainSettings *sds);
 
 #endif /* __BKE_SMOKE_H__ */
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index 3b8d0ea..653f2a4 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -64,10 +64,10 @@ typedef enum {
 } SubsurfFlags;
 
 struct DerivedMesh *subsurf_make_derived_from_derived(
-    struct DerivedMesh *dm,
-    struct SubsurfModifierData *smd,
-    float (*vertCos)[3],
-    SubsurfFlags flags);
+        struct DerivedMesh *dm,
+        struct SubsurfModifierData *smd,
+        float (*vertCos)[3],
+        SubsurfFlags flags);
 
 void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
 
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 875903f..accac86 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -83,7 +83,7 @@ void	txt_sel_line		(struct Text *text);
 char*	txt_sel_to_buf		(struct Text *text);
 void	txt_insert_buf		(struct Text *text, const char *in_buffer);
 void	txt_print_undo		(struct Text *text);
-void	txt_undo_add_toop	(struct Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc);
+void	txt_undo_add_op		(struct Text *text, int op);
 void	txt_do_undo			(struct Text *text);
 void	txt_do_redo			(struct Text *text);
 void	txt_split_curline	(struct Text *text);
@@ -100,14 +100,6 @@ void	txt_move_lines		(struct Text *text, const int direction);
 void	txt_duplicate_line	(struct Text *text);
 int	setcurr_tab_spaces	(struct Text *text, int space);
 
-void	txt_add_marker						(struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);
-short	txt_clear_marker_region				(struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
-short	txt_clear_markers					(struct Text *text, int group, int flags);
-struct TextMarker	*txt_find_marker		(struct Text *text, struct TextLine *line, int curs, int group, int flags);
-struct TextMarker	*txt_find_marker_region	(struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
-struct TextMarker	*txt_prev_marker		(struct Text *text, struct TextMarker *marker);
-struct TextMarker	*txt_next_marker		(struct Text *text, struct TextMarker *marker);
-
 /* utility functions, could be moved somewhere more generic but are python/text related  */
 int text_check_bracket(const char ch);
 int text_check_delim(const char ch);
@@ -123,24 +115,6 @@ enum {
 
 /* Undo opcodes */
 
-/* Simple main cursor movement */
-#define UNDO_CLEFT		001
-#define UNDO_CRIGHT		002
-#define UNDO_CUP		003
-#define UNDO_CDOWN		004
-
-/* Simple selection cursor movement */
-#define UNDO_SLEFT		005
-#define UNDO_SRIGHT		006
-#define UNDO_SUP		007
-#define UNDO_SDOWN		010
-
-/* Complex movement (opcode is followed
- * by 4 character line ID + a 2 character
- * position ID and opcode (repeat)) */
-#define UNDO_CTO		011
-#define UNDO_STO		012
-
 /* Complex editing */
 /* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */
 /* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */
@@ -169,8 +143,6 @@ enum {
 #define UNDO_IBLOCK     030 /* Insert block */
 
 /* Misc */
-#define UNDO_SWAP       031	/* Swap cursors */
-
 #define UNDO_INDENT     032
 #define UNDO_UNINDENT   033
 #define UNDO_COMMENT    034
@@ -181,10 +153,6 @@ enum {
 
 #define UNDO_DUPLICATE  040
 
-/* Marker flags */
-#define TMARK_TEMP		0x01	/* Remove on non-editing events, don't save */
-#define TMARK_EDITALL	0x02	/* Edit all markers of the same group as one */
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index c14476a..eb7004b 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -80,7 +80,7 @@ int BKE_tracking_track_has_marker_at_frame(struct MovieTrackingTrack *track, int
 int BKE_tracking_track_has_enabled_marker_at_frame(struct MovieTrackingTrack *track, int framenr);
 
 void BKE_tracking_track_path_clear(struct MovieTrackingTrack *track, int ref_frame, int action);
-void BKE_tracking_tracks_join(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
+void BKE_tracking_tracks_join(struct MovieTracking *tracking, struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
 
 struct MovieTrackingTrack *BKE_tracking_track_get_named(struct MovieTracking *tracking,
                                                         struct MovieTrackingObject *object,
@@ -114,7 +114,7 @@ void BKE_tracking_marker_get_subframe_position(struct MovieTrackingTrack *track,
 
 /* **** Object **** */
 struct MovieTrackingObject *BKE_tracking_object_add(struct MovieTracking *tracking, const char *name);
-void BKE_tracking_object_delete(struct MovieTracking *tracking, struct MovieTrackingObject *object);
+int BKE_tracking_object_delete(struct MovieTracking *tracking, struct MovieTrackingObject *object);
 
 void BKE_tracking_object_unique_name(struct MovieTracking *tracking, struct MovieTrackingObject *object);
 
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 06f8b89..7c1e0e9 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -32,7 +32,11 @@
 extern "C" {
 #endif
 
-/* currently unused but we may want to add macros here for BKE later */
+#define BKE_BIT_TEST_SET(value, test, flag) \
+{                                           \
+	if (test) (value) |=  flag;             \
+	else      (value) &= ~flag;             \
+} (void)0
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 2a1ff49..2da9b40 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -193,8 +193,8 @@ set(SRC
 	BKE_lamp.h
 	BKE_lattice.h
 	BKE_library.h
-	BKE_mask.h
 	BKE_main.h
+	BKE_mask.h
 	BKE_material.h
 	BKE_mball.h
 	BKE_mesh.h
@@ -249,19 +249,19 @@ if(WITH_AUDASPACE)
 endif()
 
 if(WITH_BULLET)
-	list(APPEND INC
+	list(APPEND INC_SYS
 		../../../extern/bullet2/src
 	)
 	add_definitions(-DUSE_BULLET)
 endif()
 
-if(WITH_MOD_CLOTH_ELTOPO)
-	list(APPEND INC
-		../../../extern/eltopo
-		../../../extern/eltopo/eltopo3d
-	)
-	add_definitions(-DWITH_ELTOPO)
-endif()
+#if(WITH_MOD_CLOTH_ELTOPO)
+#	list(APPEND INC
+#		../../../extern/eltopo
+#		../../../extern/eltopo/eltopo3d
+#	)
+#	add_definitions(-DWITH_ELTOPO)
+#endif()
 
 if(WITH_IMAGE_OPENEXR)
 	add_definitions(-DWITH_OPENEXR)
@@ -356,12 +356,6 @@ if(WITH_MOD_OCEANSIM)
 	add_definitions(-DWITH_OCEANSIM)
 endif()
 
-if(WITH_MOD_DECIMATE)
-	list(APPEND INC
-		../../../intern/decimation/extern
-	)
-endif()
-
 if(WITH_MOD_BOOLEAN)
 	list(APPEND INC
 		../../../intern/bsp/extern
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index d1a35b1..22be2f7 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -4,13 +4,14 @@ import os
 
 sources = env.Glob('intern/*.c')
 sources.remove('intern' + os.sep + 'mask_rasterize.c')
+sources.remove('intern' + os.sep + 'mask_evaluate.c')
 sources.remove('intern' + os.sep + 'mask.c')
 
 sources_mask = env.Glob('intern/mask*.c')
 
 incs = '. #/intern/guardedalloc #/intern/memutil'
 incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
-incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
+incs += ' ../render/extern/include ../makesrna'
 incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers'
 incs += ' #/intern/iksolver/extern ../blenloader'
 incs += ' #/extern/bullet2/src'
@@ -40,11 +41,12 @@ if env['WITH_BF_PYTHON']:
     if env['BF_DEBUG']:
         defs.append('DEBUG')
 
+'''
 if env['WITH_BF_ELTOPO']:
     incs += ' #/extern/eltopo'
     incs += ' #/extern/eltopo/eltopo3d'
     defs.append('WITH_ELTOPO')
-        
+'''
 if env['WITH_BF_QUICKTIME']:
     incs += ' ../quicktime'
 
diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h
index 512b799..12c111f 100644
--- a/source/blender/blenkernel/depsgraph_private.h
+++ b/source/blender/blenkernel/depsgraph_private.h
@@ -61,7 +61,7 @@ typedef struct DagAdjList {
 typedef struct DagNode {
 	int color;
 	short type;
-	float x, y, k;	
+	float x, y, k;
 	void *ob;
 	void *first_ancestor;
 	int ancestor_count;
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 82ac073..cc20470 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -868,7 +868,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a
 		ss->oldVMap = ss->oldEMap = ss->oldFMap = NULL;
 		ss->lenTempArrays = 0;
 		ss->tempVerts = NULL;
-		ss->tempEdges = NULL;	
+		ss->tempEdges = NULL;
 
 		return ss;
 	}
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 9aaeb4c..d09bea0 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -51,8 +51,6 @@
 #include "BLI_utildefines.h"
 #include "BLI_linklist.h"
 
-#include "BLF_translation.h"
-
 #include "BKE_cdderivedmesh.h"
 #include "BKE_displist.h"
 #include "BKE_key.h"
@@ -267,9 +265,11 @@ void DM_init_funcs(DerivedMesh *dm)
 	dm->getVertData = DM_get_vert_data;
 	dm->getEdgeData = DM_get_edge_data;
 	dm->getTessFaceData = DM_get_tessface_data;
+	dm->getPolyData = DM_get_poly_data;
 	dm->getVertDataArray = DM_get_vert_data_layer;
 	dm->getEdgeDataArray = DM_get_edge_data_layer;
 	dm->getTessFaceDataArray = DM_get_tessface_data_layer;
+	dm->getPolyDataArray = DM_get_poly_data_layer;
 
 	bvhcache_init(&dm->bvhCache);
 }
@@ -289,6 +289,13 @@ void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
 	dm->needsFree = 1;
 	dm->auto_bump_scale = -1.0f;
 	dm->dirty = 0;
+
+	/* don't use CustomData_reset(...); because we dont want to touch customdata */
+	fill_vn_i(dm->vertData.typemap, CD_NUMTYPES, -1);
+	fill_vn_i(dm->edgeData.typemap, CD_NUMTYPES, -1);
+	fill_vn_i(dm->faceData.typemap, CD_NUMTYPES, -1);
+	fill_vn_i(dm->loopData.typemap, CD_NUMTYPES, -1);
+	fill_vn_i(dm->polyData.typemap, CD_NUMTYPES, -1);
 }
 
 void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
@@ -385,7 +392,7 @@ void DM_ensure_tessface(DerivedMesh *dm)
 	}
 
 	else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) {
-		BLI_assert(CustomData_has_layer(&dm->faceData, CD_POLYINDEX));
+		BLI_assert(CustomData_has_layer(&dm->faceData, CD_ORIGINDEX) || numTessFaces == 0);
 		DM_update_tessface_data(dm);
 	}
 
@@ -409,7 +416,7 @@ void DM_update_tessface_data(DerivedMesh *dm)
 	const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
 	const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
 
-	int *polyindex = CustomData_get_layer(fdata, CD_POLYINDEX);
+	int *polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
 
 	int mf_idx,
 	    totface = dm->getNumTessFaces(dm),
@@ -466,11 +473,11 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
 	int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
 	int did_shapekeys = 0;
 	
-	memset(&tmp.vdata, 0, sizeof(tmp.vdata));
-	memset(&tmp.edata, 0, sizeof(tmp.edata));
-	memset(&tmp.fdata, 0, sizeof(tmp.fdata));
-	memset(&tmp.ldata, 0, sizeof(tmp.ldata));
-	memset(&tmp.pdata, 0, sizeof(tmp.pdata));
+	CustomData_reset(&tmp.vdata);
+	CustomData_reset(&tmp.edata);
+	CustomData_reset(&tmp.fdata);
+	CustomData_reset(&tmp.ldata);
+	CustomData_reset(&tmp.pdata);
 
 	totvert = tmp.totvert = dm->getNumVerts(dm);
 	totedge = tmp.totedge = dm->getNumEdges(dm);
@@ -627,6 +634,12 @@ void *DM_get_tessface_data(DerivedMesh *dm, int index, int type)
 	return CustomData_get(&dm->faceData, index, type);
 }
 
+void *DM_get_poly_data(DerivedMesh *dm, int index, int type)
+{
+	return CustomData_get(&dm->polyData, index, type);
+}
+
+
 void *DM_get_vert_data_layer(DerivedMesh *dm, int type)
 {
 	if (type == CD_MVERT)
@@ -903,7 +916,7 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay
 	float (*orco)[3];
 	int free;
 
-	if (em) dm = CDDM_from_BMEditMesh(em, me, FALSE, FALSE);
+	if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 	else dm = CDDM_from_mesh(me, ob);
 
 	orco = get_orco_coords_dm(ob, em, layer, &free);
@@ -1146,119 +1159,64 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
 	ColorBand *coba = stored_cb; /* warning, not a local var */
 
 	unsigned char *wtcol_v;
-#if 0 /* See coment below. */
-	unsigned char *wtcol_f = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
-#endif
 	unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_PREVIEW_MLOOPCOL);
-#if 0 /* See coment below. */
-	MFace *mf = dm->getTessFaceArray(dm);
-#endif
 	MLoop *mloop = dm->getLoopArray(dm), *ml;
 	MPoly *mp = dm->getPolyArray(dm);
-#if 0
-	int numFaces = dm->getNumTessFaces(dm);
-#endif
 	int numVerts = dm->getNumVerts(dm);
 	int totloop;
 	int i, j;
 
-#if 0 /* See comment below */
-	  /* If no CD_PREVIEW_MCOL existed yet, add a new one! */
-	if (!wtcol_f)
-		wtcol_f = CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
-
-	if (wtcol_f) {
-		unsigned char *wtcol_f_step = wtcol_f;
-# else
-#if 0
-	/* XXX We have to create a CD_PREVIEW_MCOL, else it might sigsev (after a SubSurf mod, eg)... */
-	if (!dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL))
-		CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
-#endif
-
-	{
-#endif
-
-		/* Weights are given by caller. */
-		if (weights) {
-			float *w = weights;
-			/* If indices is not NULL, it means we do not have weights for all vertices,
-			 * so we must create them (and set them to zero)... */
-			if (indices) {
-				w = MEM_callocN(sizeof(float) * numVerts, "Temp weight array DM_update_weight_mcol");
-				i = num;
-				while (i--)
-					w[indices[i]] = weights[i];
-			}
-
-			/* Convert float weights to colors. */
-			wtcol_v = calc_colors_from_weights_array(numVerts, w);
-
-			if (indices)
-				MEM_freeN(w);
+	/* Weights are given by caller. */
+	if (weights) {
+		float *w = weights;
+		/* If indices is not NULL, it means we do not have weights for all vertices,
+		 * so we must create them (and set them to zero)... */
+		if (indices) {
+			w = MEM_callocN(sizeof(float) * numVerts, "Temp weight array DM_update_weight_mcol");
+			i = num;
+			while (i--)
+				w[indices[i]] = weights[i];
 		}
 
-		/* No weights given, take them from active vgroup(s). */
-		else
-			wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba);
-
-		/* Now copy colors in all face verts. */
-		/* first add colors to the tessellation faces */
-		/* XXX Why update that layer? We have to update WEIGHT_MLOOPCOL anyway, 
-		 *     and tessellation recreates mface layers from mloop/mpoly ones, so no
-		 *     need to fill WEIGHT_MCOL here. */
-#if 0
-		for (i = 0; i < numFaces; i++, mf++, wtcol_f_step += (4 * 4)) {
-			/*origindex being NULL means we're operating on original mesh data*/
-#if 0
-			unsigned int fidx = mf->v4 ? 3 : 2;
+		/* Convert float weights to colors. */
+		wtcol_v = calc_colors_from_weights_array(numVerts, w);
 
-#else   /* better zero out triangles 4th component. else valgrind complains when the buffer's copied */
-			unsigned int fidx;
-			if (mf->v4) {
-				fidx = 3;
-			}
-			else {
-				fidx = 2;
-				*(int *)(&wtcol_f_step[3 * 4]) = 0;
-			}
-#endif
+		if (indices)
+			MEM_freeN(w);
+	}
 
-			do {
-				copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4],
-				                (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]);
-			} while (fidx--);
-		}
-#endif
-		/*now add to loops, so the data can be passed through the modifier stack*/
-		/* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */
-		if (!wtcol_l) {
-			BLI_array_declare(wtcol_l);
-			totloop = 0;
-			for (i = 0; i < dm->numPolyData; i++, mp++) {
-				ml = mloop + mp->loopstart;
-
-				BLI_array_grow_items(wtcol_l, mp->totloop);
-				for (j = 0; j < mp->totloop; j++, ml++, totloop++) {
-					copy_v4_v4_char((char *)&wtcol_l[totloop],
-					                (char *)&wtcol_v[4 * ml->v]);
-				}
+	/* No weights given, take them from active vgroup(s). */
+	else
+		wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba);
+
+	/* now add to loops, so the data can be passed through the modifier stack */
+	/* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */
+	if (!wtcol_l) {
+		BLI_array_declare(wtcol_l);
+		totloop = 0;
+		for (i = 0; i < dm->numPolyData; i++, mp++) {
+			ml = mloop + mp->loopstart;
+
+			BLI_array_grow_items(wtcol_l, mp->totloop);
+			for (j = 0; j < mp->totloop; j++, ml++, totloop++) {
+				copy_v4_v4_char((char *)&wtcol_l[totloop],
+				                (char *)&wtcol_v[4 * ml->v]);
 			}
-			CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
 		}
-		else {
-			totloop = 0;
-			for (i = 0; i < dm->numPolyData; i++, mp++) {
-				ml = mloop + mp->loopstart;
+		CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
+	}
+	else {
+		totloop = 0;
+		for (i = 0; i < dm->numPolyData; i++, mp++) {
+			ml = mloop + mp->loopstart;
 
-				for (j = 0; j < mp->totloop; j++, ml++, totloop++) {
-					copy_v4_v4_char((char *)&wtcol_l[totloop],
-					                (char *)&wtcol_v[4 * ml->v]);
-				}
+			for (j = 0; j < mp->totloop; j++, ml++, totloop++) {
+				copy_v4_v4_char((char *)&wtcol_l[totloop],
+				                (char *)&wtcol_v[4 * ml->v]);
 			}
 		}
-		MEM_freeN(wtcol_v);
 	}
+	MEM_freeN(wtcol_v);
 
 	dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
 }
@@ -1270,7 +1228,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
 	int i, j, tot;
 	
 	if (!me->key)
-		return;	
+		return;
 	
 	tot = CustomData_number_of_layers(&dm->vertData, CD_SHAPEKEY);
 	for (i = 0; i < tot; i++) {
@@ -1375,7 +1333,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 	ModifierData *firstmd, *md, *previewmd = NULL;
 	CDMaskLink *datamasks, *curr;
 	/* XXX Always copying POLYINDEX, else tessellated data are no more valid! */
-	CustomDataMask mask, nextmask, append_mask = CD_MASK_POLYINDEX;
+	CustomDataMask mask, nextmask, append_mask = CD_MASK_ORIGINDEX;
 	float (*deformedVerts)[3] = NULL;
 	DerivedMesh *dm = NULL, *orcodm, *clothorcodm, *finaldm;
 	int numVerts = me->totvert;
@@ -1507,7 +1465,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		if (!modifier_isEnabled(scene, md, required_mode)) continue;
 		if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue;
 		if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
-			modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position."));
+			modifier_setError(md, "Modifier requires original data, bad stack position");
 			continue;
 		}
 		if (sculpt_mode && (!has_multires || multires_applied)) {
@@ -1520,7 +1478,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 			unsupported |= multires_applied;
 
 			if (unsupported) {
-				modifier_setError(md, "%s", TIP_("Not supported in sculpt mode."));
+				modifier_setError(md, "Not supported in sculpt mode");
 				continue;
 			}
 		}
@@ -1667,8 +1625,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 
 				nextmask &= ~CD_MASK_ORCO;
 				DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX |
-								 (mti->requiredDataMask ?
-								  mti->requiredDataMask(ob, md) : 0));
+				                 (mti->requiredDataMask ?
+				                  mti->requiredDataMask(ob, md) : 0));
 				ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE);
 
 				if (ndm) {
@@ -1803,7 +1761,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 #if 0
 		if (num_tessface == 0 && finaldm->getNumTessFaces(finaldm) == 0)
 #else
-		if (finaldm->getNumTessFaces(finaldm) == 0) /* || !CustomData_has_layer(&finaldm->faceData, CD_POLYINDEX)) */
+		if (finaldm->getNumTessFaces(finaldm) == 0) /* || !CustomData_has_layer(&finaldm->faceData, CD_ORIGINDEX)) */
 #endif
 		{
 			finaldm->recalcTessellation(finaldm);
@@ -1811,8 +1769,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		/* Even if tessellation is not needed, some modifiers might have modified CD layers
 		 * (like mloopcol or mloopuv), hence we have to update those. */
 		else if (finaldm->dirty & DM_DIRTY_TESS_CDLAYERS) {
-			/* A tessellation already exists, it should always have a CD_POLYINDEX. */
-			BLI_assert(CustomData_has_layer(&finaldm->faceData, CD_POLYINDEX));
+			/* A tessellation already exists, it should always have a CD_ORIGINDEX. */
+			BLI_assert(CustomData_has_layer(&finaldm->faceData, CD_ORIGINDEX));
 			DM_update_tessface_data(finaldm);
 		}
 		/* Need to watch this, it can cause issues, see bug [#29338]             */
@@ -1881,7 +1839,7 @@ int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *d
 
 	if (!modifier_isEnabled(scene, md, required_mode)) return 0;
 	if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
-		modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position."));
+		modifier_setError(md, "Modifier requires original data, bad stack position");
 		return 0;
 	}
 	
@@ -1976,7 +1934,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
 
 			}
 			else {
-				dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
+				dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 
 				if (deformedVerts) {
 					CDDM_apply_vert_coords(dm, deformedVerts);
@@ -2067,12 +2025,18 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
 	}
 	else if (dm) {
 		*final_r = dm;
-		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
+
+		/* once we support skipping normal calculation with modifiers we may want to add this back */
+#if 0	// was added for bmesh but is not needed
+		(*final_r)->calcNormals(*final_r);
+#endif
 	}
 	else if (!deformedVerts && cage_r && *cage_r) {
 		/* cage should already have up to date normals */
 		*final_r = *cage_r;
-		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
+#if 0	// was added for bmesh but is not needed
+		(*final_r)->calcNormals(*final_r);
+#endif
 	}
 	else {
 		/* this is just a copy of the editmesh, no need to calc normals */
@@ -2148,6 +2112,8 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
 	/* weight paint and face select need original indices because of selection buffer drawing */
 	int needMapping = (ob == obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)));
 
+	BLI_assert(ob->type == OB_MESH);
+
 	clear_mesh_caches(ob);
 
 	mesh_calc_modifiers(scene, ob, NULL, &ob->derivedDeform,
@@ -2249,8 +2215,16 @@ DerivedMesh *mesh_create_derived_view(Scene *scene, Object *ob, CustomDataMask d
 {
 	DerivedMesh *final;
 
+	/* XXX hack
+	 * psys modifier updates particle state when called during dupli-list generation,
+	 * which can lead to wrong transforms. This disables particle system modifier execution.
+	 */
+	ob->transflag |= OB_NO_PSYS_UPDATE;
+
 	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 0, 1, 0, dataMask, -1, 0, 0);
 
+	ob->transflag &= ~OB_NO_PSYS_UPDATE;
+
 	return final;
 }
 
@@ -2420,7 +2394,7 @@ static int GetNumVertsOfFace(const SMikkTSpaceContext *pContext, const int face_
 
 static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const int face_num, const int vert_index)
 {
-	//assert(vert_index>=0 && vert_index<4);
+	//assert(vert_index >= 0 && vert_index < 4);
 	SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 	const float *co = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].co;
 	copy_v3_v3(fPos, co);
@@ -2428,7 +2402,7 @@ static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const
 
 static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[], const int face_num, const int vert_index)
 {
-	//assert(vert_index>=0 && vert_index<4);
+	//assert(vert_index >= 0 && vert_index < 4);
 	SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 
 	if (pMesh->mtface != NULL) {
@@ -2443,7 +2417,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[]
 
 static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const int face_num, const int vert_index)
 {
-	//assert(vert_index>=0 && vert_index<4);
+	//assert(vert_index >= 0 && vert_index < 4);
 	SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 
 	const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH);
@@ -2473,7 +2447,7 @@ static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const i
 }
 static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
 {
-	//assert(vert_index>=0 && vert_index<4);
+	//assert(vert_index >= 0 && vert_index < 4);
 	SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 	float *pRes = pMesh->tangent[4 * face_num + iVert];
 	copy_v3_v3(pRes, fvTangent);
@@ -2484,15 +2458,11 @@ static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[
 void DM_add_tangent_layer(DerivedMesh *dm)
 {
 	/* mesh vars */
-	MTFace *mtface, *tf;
-	MFace *mface, *mf;
-	MVert *mvert, *v1, *v2, *v3, *v4;
-	MemArena *arena = NULL;
-	VertexTangent **vtangents = NULL;
+	MVert *mvert;
+	MTFace *mtface;
+	MFace *mface;
 	float (*orco)[3] = NULL, (*tangent)[4];
-	float *uv1, *uv2, *uv3, *uv4, *vtang;
-	float fno[3], tang[3], uv[4][2];
-	int i, j, len, mf_vi[4], totvert, totface, iCalcNewMethod;
+	int /* totvert, */ totface;
 	float *nors;
 
 	if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1)
@@ -2501,7 +2471,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 	nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
 
 	/* check we have all the needed layers */
-	totvert = dm->getNumVerts(dm);
+	/* totvert = dm->getNumVerts(dm); */ /* UNUSED */
 	totface = dm->getNumTessFaces(dm);
 
 	mvert = dm->getVertArray(dm);
@@ -2518,14 +2488,8 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 	DM_add_tessface_layer(dm, CD_TANGENT, CD_CALLOC, NULL);
 	tangent = DM_get_tessface_data_layer(dm, CD_TANGENT);
 	
-	/* allocate some space */
-	arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "tangent layer arena");
-	BLI_memarena_use_calloc(arena);
-	vtangents = MEM_callocN(sizeof(VertexTangent *) * totvert, "VertexTangent");
-
 	/* new computation method */
-	iCalcNewMethod = 1;
-	if (iCalcNewMethod != 0) {
+	{
 		SGLSLMeshToTangent mesh2tangent = {0};
 		SMikkTSpaceContext sContext = {0};
 		SMikkTSpaceInterface sInterface = {0};
@@ -2548,87 +2512,13 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 		sInterface.m_setTSpaceBasic = SetTSpace;
 
 		/* 0 if failed */
-		iCalcNewMethod = genTangSpaceDefault(&sContext);
+		genTangSpaceDefault(&sContext);
 	}
-
-	if (!iCalcNewMethod) {
-		/* sum tangents at connected vertices */
-		for (i = 0, tf = mtface, mf = mface; i < totface; mf++, tf++, i++) {
-			v1 = &mvert[mf->v1];
-			v2 = &mvert[mf->v2];
-			v3 = &mvert[mf->v3];
-
-			if (mf->v4) {
-				v4 = &mvert[mf->v4];
-				normal_quad_v3(fno, v4->co, v3->co, v2->co, v1->co);
-			}
-			else {
-				v4 = NULL;
-				normal_tri_v3(fno, v3->co, v2->co, v1->co);
-			}
-		
-			if (mtface) {
-				uv1 = tf->uv[0];
-				uv2 = tf->uv[1];
-				uv3 = tf->uv[2];
-				uv4 = tf->uv[3];
-			}
-			else {
-				uv1 = uv[0]; uv2 = uv[1]; uv3 = uv[2]; uv4 = uv[3];
-				map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
-				map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
-				map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
-				if (v4)
-					map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
-			}
-		
-			tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, fno, tang);
-			sum_or_add_vertex_tangent(arena, &vtangents[mf->v1], tang, uv1);
-			sum_or_add_vertex_tangent(arena, &vtangents[mf->v2], tang, uv2);
-			sum_or_add_vertex_tangent(arena, &vtangents[mf->v3], tang, uv3);
-		
-			if (mf->v4) {
-				v4 = &mvert[mf->v4];
-			
-				tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, fno, tang);
-				sum_or_add_vertex_tangent(arena, &vtangents[mf->v1], tang, uv1);
-				sum_or_add_vertex_tangent(arena, &vtangents[mf->v3], tang, uv3);
-				sum_or_add_vertex_tangent(arena, &vtangents[mf->v4], tang, uv4);
-			}
-		}
-	
-		/* write tangent to layer */
-		for (i = 0, tf = mtface, mf = mface; i < totface; mf++, tf++, i++, tangent += 4) {
-			len = (mf->v4) ? 4 : 3;
-
-			if (mtface == NULL) {
-				map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
-				map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
-				map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
-				if (len == 4)
-					map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
-			}
-		
-			mf_vi[0] = mf->v1;
-			mf_vi[1] = mf->v2;
-			mf_vi[2] = mf->v3;
-			mf_vi[3] = mf->v4;
-		
-			for (j = 0; j < len; j++) {
-				vtang = find_vertex_tangent(vtangents[mf_vi[j]], mtface ? tf->uv[j] : uv[j]);
-				normalize_v3_v3(tangent[j], vtang);
-				((float *) tangent[j])[3] = 1.0f;
-			}
-		}
-	}
-	
-	BLI_memarena_free(arena);
-	MEM_freeN(vtangents);
 }
 
 void DM_calc_auto_bump_scale(DerivedMesh *dm)
 {
-	/* int totvert= dm->getNumVerts(dm); */ /* UNUSED */
+	/* int totvert = dm->getNumVerts(dm); */ /* UNUSED */
 	int totface = dm->getNumTessFaces(dm);
 
 	MVert *mvert = dm->getVertArray(dm);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 66df7ec..dd27cc7 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -224,7 +224,7 @@ bActionGroup *get_active_actiongroup(bAction *act)
 {
 	bActionGroup *agrp = NULL;
 	
-	if (act && act->groups.first) {	
+	if (act && act->groups.first) {
 		for (agrp = act->groups.first; agrp; agrp = agrp->next) {
 			if (agrp->flag & AGRP_ACTIVE)
 				break;
@@ -301,7 +301,7 @@ bActionGroup *action_groups_add_new(bAction *act, const char name[])
 	
 	/* add to action, and validate */
 	BLI_addtail(&act->groups, agrp);
-	BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));	
+	BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
 	
 	/* return the new group */
 	return agrp;
@@ -380,7 +380,7 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
 void action_groups_remove_channel(bAction *act, FCurve *fcu)
 {
 	/* sanity checks */
-	if (ELEM(NULL, act, fcu))	
+	if (ELEM(NULL, act, fcu))
 		return;
 	
 	/* check if any group used this directly */
@@ -512,7 +512,7 @@ const char *BKE_pose_ikparam_get_name(bPose *pose)
 {
 	if (pose) {
 		switch (pose->iksolver) {
-			case IKSOLVER_LEGACY:
+			case IKSOLVER_STANDARD:
 				return NULL;
 			case IKSOLVER_ITASC:
 				return "bItasc";
@@ -587,7 +587,7 @@ void BKE_pose_ikparam_init(bPose *pose)
 			BKE_pose_itasc_init(itasc);
 			pose->ikparam = itasc;
 			break;
-		case IKSOLVER_LEGACY:
+		case IKSOLVER_STANDARD:
 		default:
 			pose->ikparam = NULL;
 			break;
@@ -906,8 +906,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 				calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE);
 				
 				/* compare to the running tally */
-				min = MIN2(min, nmin);
-				max = MAX2(max, nmax);
+				min = min_ff(min, nmin);
+				max = max_ff(max, nmax);
 				
 				foundvert = 1;
 			}
@@ -925,10 +925,10 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 						FMod_Limits *fmd = (FMod_Limits *)fcm->data;
 						
 						if (fmd->flag & FCM_LIMIT_XMIN) {
-							min = MIN2(min, fmd->rect.xmin);
+							min = min_ff(min, fmd->rect.xmin);
 						}
 						if (fmd->flag & FCM_LIMIT_XMAX) {
-							max = MAX2(max, fmd->rect.xmax);
+							max = max_ff(max, fmd->rect.xmax);
 						}
 					}
 					break;
@@ -955,7 +955,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 				foundmod = 1;
 			}
 		}
-	}	
+	}
 	
 	if (foundvert || foundmod) {
 		if (min == max) max += 1.0f;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 58d20ff..9a2462e 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -40,6 +40,8 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_group_types.h"
@@ -74,8 +76,8 @@
 /* --------------------- */
 /* forward declarations */
 
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
-                                       int level, short flag);
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4],
+                                       int persistent_id[MAX_DUPLI_RECUR], int level, int index, short flag);
 
 /* ******************************************************************** */
 /* Animation Visualization */
@@ -174,10 +176,10 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
 	/* avoid 0 size allocs */
 	if (avs->path_sf >= avs->path_ef) {
 		BKE_reportf(reports, RPT_ERROR,
-		            "Motion Path frame extents invalid for %s (%d to %d).%s\n",
+		            "Motion path frame extents invalid for %s (%d to %d)%s",
 		            (pchan) ? pchan->name : ob->id.name,
 		            avs->path_sf, avs->path_ef,
-		            (avs->path_sf == avs->path_ef) ? " Cannot have single-frame paths." : "");
+		            (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : "");
 		return NULL;
 	}
 
@@ -704,31 +706,45 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 #define DUPLILIST_FOR_RENDER	2
 #define DUPLILIST_ANIMATED		4
 
-static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int par_index, int type, short flag)
+static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay,
+                                     int persistent_id[MAX_DUPLI_RECUR], int level, int index, int type, short flag)
 {
 	DupliObject *dob = MEM_callocN(sizeof(DupliObject), "dupliobject");
-	
+	int i;
+
 	BLI_addtail(lb, dob);
 	dob->ob = ob;
 	copy_m4_m4(dob->mat, mat);
 	copy_m4_m4(dob->omat, ob->obmat);
 	dob->origlay = ob->lay;
-	dob->index = index;
-	dob->particle_index = par_index;
 	dob->type = type;
 	dob->animated = (type == OB_DUPLIGROUP) && (flag & DUPLILIST_ANIMATED);
 	ob->lay = lay;
+
+	/* set persistent id, which is an array with a persistent index for each level
+	 * (particle number, vertex number, ..). by comparing this we can find the same
+	 * dupli object between frames, which is needed for motion blur. last level
+	 * goes first in the array. */
+	dob->persistent_id[0] = index;
+	for (i = 1; i < level; i++)
+		dob->persistent_id[i] = persistent_id[level - 1 - i];
+	
+	/* metaballs never draw in duplis, they are instead merged into one by the basis
+	 * mball outside of the group. this does mean that if that mball is not in the
+	 * scene, they will not show up at all, limitation that should be solved once. */
+	if (ob->type == OB_MBALL)
+		dob->no_draw = TRUE;
 	
 	return dob;
 }
 
-static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index,
+static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int persistent_id[MAX_DUPLI_RECUR],
                             int level, short flag)
 {
 	DupliObject *dob;
 	Group *group;
 	GroupObject *go;
-	float mat[4][4], tmat[4][4];
+	float mat[4][4], tmat[4][4], id;
 	
 	if (ob->dup_group == NULL) return;
 	group = ob->dup_group;
@@ -748,7 +764,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
 	if (group_is_animated(ob, group))
 		flag |= DUPLILIST_ANIMATED;
 	
-	for (go = group->gobject.first; go; go = go->next) {
+	for (go = group->gobject.first, id = 0; go; go = go->next, id++) {
 		/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
 		if (go->ob != ob) {
 			
@@ -762,7 +778,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
 				mult_m4_m4m4(mat, ob->obmat, go->ob->obmat);
 			}
 			
-			dob = new_dupli_object(lb, go->ob, mat, ob->lay, 0, par_index, OB_DUPLIGROUP, flag);
+			dob = new_dupli_object(lb, go->ob, mat, ob->lay, persistent_id, level, id, OB_DUPLIGROUP, flag);
 
 			/* check the group instance and object layers match, also that the object visible flags are ok. */
 			if ((dob->origlay & group->layer) == 0 ||
@@ -771,20 +787,17 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
 			{
 				dob->no_draw = TRUE;
 			}
-			else {
-				dob->no_draw = FALSE;
-			}
 
 			if (go->ob->transflag & OB_DUPLI) {
 				copy_m4_m4(dob->ob->obmat, dob->mat);
-				object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, par_index, level + 1, flag);
+				object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, persistent_id, level + 1, id, flag);
 				copy_m4_m4(dob->ob->obmat, dob->omat);
 			}
 		}
 	}
 }
 
-static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, short flag)
+static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int persistent_id[MAX_DUPLI_RECUR], int level, short flag)
 {
 	extern int enable_cu_speed; /* object.c */
 	Object copyob;
@@ -822,7 +835,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_ind
 			ok = (ok < ob->dupon);
 		}
 		
-		if (ok) {	
+		if (ok) {
 			DupliObject *dob;
 			
 			/* WARNING: doing animation updates in this way is not terribly accurate, as the dependencies
@@ -832,7 +845,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_ind
 			BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */
 			BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra);
 			
-			dob = new_dupli_object(lb, ob, ob->obmat, ob->lay, scene->r.cfra, par_index, OB_DUPLIFRAMES, flag);
+			dob = new_dupli_object(lb, ob, ob->obmat, ob->lay, persistent_id, level, scene->r.cfra, OB_DUPLIFRAMES, flag);
 			copy_m4_m4(dob->omat, copyob.obmat);
 		}
 	}
@@ -863,7 +876,7 @@ typedef struct VertexDupliData {
 	Scene *scene;
 	Object *ob, *par;
 	float (*orco)[3];
-	int par_index;
+	int *persistent_id;
 } VertexDupliData;
 
 /* ------------- */
@@ -900,7 +913,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
 
 	origlay = vdd->ob->lay;
 	
-	dob = new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, vdd->par_index, OB_DUPLIVERTS, vdd->flag);
+	dob = new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, vdd->persistent_id, vdd->level, index, OB_DUPLIVERTS, vdd->flag);
 
 	/* restore the original layer so that each dupli will have proper dob->origlay */
 	vdd->ob->lay = origlay;
@@ -912,12 +925,12 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
 		float tmpmat[4][4];
 		copy_m4_m4(tmpmat, vdd->ob->obmat);
 		copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
-		object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->par_index, vdd->level + 1, vdd->flag);
+		object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->persistent_id, vdd->level + 1, index, vdd->flag);
 		copy_m4_m4(vdd->ob->obmat, tmpmat);
 	}
 }
 
-static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
+static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int persistent_id[MAX_DUPLI_RECUR],
                              int level, short flag)
 {
 	Object *ob, *ob_iter;
@@ -968,7 +981,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 	}
 	
 	/* Start looping on Scene OR Group objects */
-	while (base || go) { 
+	while (base || go) {
 		if (sce) {
 			ob_iter = base->object;
 			oblay = base->lay;
@@ -1002,7 +1015,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 					vdd.scene = scene;
 					vdd.par = par;
 					copy_m4_m4(vdd.pmat, pmat);
-					vdd.par_index = par_index;
+					vdd.persistent_id = persistent_id;
 					
 					/* mballs have a different dupli handling */
 					if (ob->type != OB_MBALL) ob->flag |= OB_DONE;  /* doesnt render */
@@ -1041,7 +1054,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 	dm->release(dm);
 }
 
-static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
+static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int persistent_id[MAX_DUPLI_RECUR],
                            int level, short flag)
 {
 	Object *ob, *ob_iter;
@@ -1102,7 +1115,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 	}
 	
 	/* Start looping on Scene OR Group objects */
-	while (base || go) { 
+	while (base || go) {
 		if (sce) {
 			ob_iter = base->object;
 			oblay = base->lay;
@@ -1184,7 +1197,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 						copy_m4_m4(tmat, obmat);
 						mul_m4_m4m3(obmat, tmat, mat);
 						
-						dob = new_dupli_object(lb, ob, obmat, par->lay, a, par_index, OB_DUPLIFACES, (flag & DUPLILIST_ANIMATED));
+						dob = new_dupli_object(lb, ob, obmat, par->lay, persistent_id, level, a, OB_DUPLIFACES, (flag & DUPLILIST_ANIMATED));
 						if (flag & DUPLILIST_FOR_RENDER) {
 							w = 1.0f / (float)mp->totloop;
 
@@ -1207,7 +1220,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 							float tmpmat[4][4];
 							copy_m4_m4(tmpmat, ob->obmat);
 							copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
-							object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, par_index, level + 1, flag);
+							object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, persistent_id, level + 1, a, flag);
 							copy_m4_m4(ob->obmat, tmpmat);
 						}
 					}
@@ -1227,7 +1240,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 	dm->release(dm);
 }
 
-static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int UNUSED(par_index), ParticleSystem *psys,
+static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int persistent_id[MAX_DUPLI_RECUR], ParticleSystem *psys,
                                    int level, short flag)
 {
 	GroupObject *go;
@@ -1242,8 +1255,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 	float ctime, pa_time, scale = 1.0f;
 	float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size = 0.0;
 	float (*obmat)[4], (*oldobmat)[4];
-	int a, b, counter, index, hair = 0;
+	int a, b, hair = 0;
 	int totpart, totchild, totgroup = 0 /*, pa_num */;
+	int dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene);
 
 	int no_draw_flag = PARS_UNEXIST;
 
@@ -1358,8 +1372,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 		else
 			a = totpart;
 
-		index = 0;
-		for (pa = psys->particles, counter = 0; a < totpart + totchild; a++, pa++, counter++) {
+		for (pa = psys->particles; a < totpart + totchild; a++, pa++) {
 			if (a < totpart) {
 				/* handle parent particle */
 				if (pa->flag & no_draw_flag)
@@ -1454,13 +1467,21 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 					else
 						copy_m4_m4(mat, tmat);
 
-					dob = new_dupli_object(lb, go->ob, mat, par->lay, counter, index, OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED));
+					dob = new_dupli_object(lb, go->ob, mat, par->lay, persistent_id, level, a, OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED));
+					dob->particle_system = psys;
 					copy_m4_m4(dob->omat, obcopylist[b].obmat);
 					if (flag & DUPLILIST_FOR_RENDER)
 						psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
 				}
 			}
 			else {
+				int dupli_type = OB_DUPLIPARTS;
+
+				/* blender internal needs this to be set to dupligroup to render
+				 * groups correctly, but we don't want this hack for cycles */
+				if(dupli_type_hack && GS(id->name) == ID_GR)
+					dupli_type = OB_DUPLIGROUP;
+
 				/* to give ipos in object correct offset */
 				BKE_object_where_is_calc_time(scene, ob, ctime - pa_time);
 
@@ -1514,14 +1535,12 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				if (part->draw & PART_DRAW_GLOBAL_OB)
 					add_v3_v3v3(mat[3], mat[3], vec);
 
-				dob = new_dupli_object(lb, ob, mat, ob->lay, counter, index, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED));
+				dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, dupli_type, (flag & DUPLILIST_ANIMATED));
+				dob->particle_system = psys;
 				copy_m4_m4(dob->omat, oldobmat);
 				if (flag & DUPLILIST_FOR_RENDER)
 					psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
 			}
-
-			/* only counts visible particles */
-			index++;
 		}
 
 		/* restore objects since they were changed in BKE_object_where_is_calc_time */
@@ -1568,7 +1587,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
 }
 
 
-static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_index, int level, short flag)
+static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int persistent_id[MAX_DUPLI_RECUR], int level, short flag)
 {
 	Object *ob, *obar[256] = {NULL};
 	Curve *cu;
@@ -1607,7 +1626,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_inde
 			copy_m4_m4(obmat, par->obmat);
 			copy_v3_v3(obmat[3], vec);
 			
-			new_dupli_object(lb, ob, obmat, par->lay, a, par_index, OB_DUPLIVERTS, flag);
+			new_dupli_object(lb, ob, obmat, par->lay, persistent_id, level, a, OB_DUPLIVERTS, flag);
 		}
 	}
 	
@@ -1616,8 +1635,8 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_inde
 
 /* ------------- */
 
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
-                                       int level, short flag)
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4],
+                                       int persistent_id[MAX_DUPLI_RECUR], int level, int index, short flag)
 {	
 	if ((ob->transflag & OB_DUPLI) == 0)
 		return;
@@ -1634,34 +1653,45 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 		}
 	}
 
+	/* keep track of persistent id */
+	if (level > 0)
+		persistent_id[level - 1] = index;
+
 	if (ob->transflag & OB_DUPLIPARTS) {
 		ParticleSystem *psys = ob->particlesystem.first;
-		for (; psys; psys = psys->next)
-			new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, psys, level + 1, flag);
+		int psysid = 0;
+
+		/* particle system take up one level in id, the particles another */
+		for (; psys; psys = psys->next, psysid++) {
+			persistent_id[level] = psysid;
+			new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, psys, level + 2, flag);
+		}
+
+		persistent_id[level] = 0;
 	}
 	else if (ob->transflag & OB_DUPLIVERTS) {
 		if (ob->type == OB_MESH) {
-			vertex_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, flag);
+			vertex_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, level + 1, flag);
 		}
 		else if (ob->type == OB_FONT) {
 			if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
-				font_duplilist(duplilist, scene, ob, par_index, level + 1, flag);
+				font_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag);
 			}
 		}
 	}
 	else if (ob->transflag & OB_DUPLIFACES) {
 		if (ob->type == OB_MESH)
-			face_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, flag);
+			face_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, level + 1, flag);
 	}
 	else if (ob->transflag & OB_DUPLIFRAMES) {
 		if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
-			frames_duplilist(duplilist, scene, ob, par_index, level + 1, flag);
+			frames_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag);
 		}
 	}
 	else if (ob->transflag & OB_DUPLIGROUP) {
 		DupliObject *dob;
 		
-		group_duplilist(duplilist, scene, ob, par_index, level + 1, flag); /* now recursive */
+		group_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag); /* now recursive */
 
 		if (level == 0) {
 			for (dob = duplilist->first; dob; dob = dob->next)
@@ -1669,6 +1699,10 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 					copy_m4_m4(dob->ob->obmat, dob->mat);
 		}
 	}
+
+	/* clear persistent id */
+	if (level > 0)
+		persistent_id[level - 1] = 0;
 }
 
 /* Returns a list of DupliObject
@@ -1676,13 +1710,14 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update, int for_render)
 {
 	ListBase *duplilist = MEM_mallocN(sizeof(ListBase), "duplilist");
+	int persistent_id[MAX_DUPLI_RECUR] = {0};
 	int flag = 0;
 
-	if(update) flag |= DUPLILIST_DO_UPDATE;
-	if(for_render) flag |= DUPLILIST_FOR_RENDER;
+	if (update)     flag |= DUPLILIST_DO_UPDATE;
+	if (for_render) flag |= DUPLILIST_FOR_RENDER;
 
 	duplilist->first = duplilist->last = NULL;
-	object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0, flag);
+	object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, persistent_id, 0, 0, flag);
 	return duplilist;
 }
 
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 5dae203..40b883e 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -188,9 +188,9 @@ short BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
 		else {
 			/* cannot set */
 			BKE_reportf(reports, RPT_ERROR,
-			            "Couldn't set Action '%s' onto ID '%s', as it doesn't have suitably rooted paths for this purpose",
-			            act->id.name + 2, id->name);
-			//ok = 0;
+			            "Could not set action '%s' onto ID '%s', as it does not have suitably rooted paths "
+			            "for this purpose", act->id.name + 2, id->name);
+			/* ok = 0; */
 		}
 	}
 	else {
@@ -419,7 +419,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha
 		/* should F-Curve be moved over?
 		 *	- we only need the start of the path to match basepath
 		 */
-		if (animpath_matches_basepath(fcu->rna_path, basepath)) {			
+		if (animpath_matches_basepath(fcu->rna_path, basepath)) {
 			bActionGroup *agrp = NULL;
 			
 			/* if grouped... */
@@ -574,7 +574,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
 	 */
 	if ( (prefixPtr && oldNamePtr) && (prefixPtr + prefixLen == oldNamePtr) ) {
 		/* if we haven't aren't able to resolve the path now, try again after fixing it */
-		if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) {		
+		if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) {
 			DynStr *ds = BLI_dynstr_new();
 			char *postfixPtr = oldNamePtr + oldNameLen;
 			char *newPath = NULL;
@@ -724,7 +724,7 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
 		/* pad the names with [" "] so that only exact matches are made */
 		oldN = BLI_sprintfN("[\"%s\"]", oldName);
 		newN = BLI_sprintfN("[\"%s\"]", newName);
-	} 
+	}
 	else {
 		oldN = BLI_sprintfN("[%d]", oldSubscript);
 		newN = BLI_sprintfN("[%d]", newSubscript);
@@ -781,7 +781,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u
 	ANIMDATA_NODETREE_IDS_CB(mainptr->tex.first, Tex);
 	
 	/* lamps */
-	ANIMDATA_IDS_CB(mainptr->lamp.first);
+	ANIMDATA_NODETREE_IDS_CB(mainptr->lamp.first, Lamp);
 	
 	/* materials */
 	ANIMDATA_NODETREE_IDS_CB(mainptr->mat.first, Material);
@@ -823,7 +823,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u
 	ANIMDATA_IDS_CB(mainptr->mask.first);
 	
 	/* worlds */
-	ANIMDATA_IDS_CB(mainptr->world.first);
+	ANIMDATA_NODETREE_IDS_CB(mainptr->world.first, World);
 
 	/* scenes */
 	ANIMDATA_NODETREE_IDS_CB(mainptr->scene.first, Scene);
@@ -868,7 +868,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
 	RENAMEFIX_ANIM_NODETREE_IDS(mainptr->tex.first, Tex);
 	
 	/* lamps */
-	RENAMEFIX_ANIM_IDS(mainptr->lamp.first);
+	RENAMEFIX_ANIM_NODETREE_IDS(mainptr->lamp.first, Lamp);
 	
 	/* materials */
 	RENAMEFIX_ANIM_NODETREE_IDS(mainptr->mat.first, Material);
@@ -910,7 +910,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
 	RENAMEFIX_ANIM_IDS(mainptr->mask.first);
 	
 	/* worlds */
-	RENAMEFIX_ANIM_IDS(mainptr->world.first);
+	RENAMEFIX_ANIM_NODETREE_IDS(mainptr->world.first, World);
 	
 	/* scenes */
 	RENAMEFIX_ANIM_NODETREE_IDS(mainptr->scene.first, Scene);
@@ -973,9 +973,8 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
 	/* allocate new KeyingSet */
 	ks = MEM_callocN(sizeof(KeyingSet), "KeyingSet");
 
-	BLI_strncpy(ks->idname, idname ? idname : name ? name : "KeyingSet", sizeof(ks->idname));
-
-	BLI_strncpy(ks->name, name ? name : idname ? idname : "Keying Set", sizeof(ks->name));
+	BLI_strncpy(ks->idname, (idname) ? idname : (name) ? name     : "KeyingSet",  sizeof(ks->idname));
+	BLI_strncpy(ks->name,   (name) ? name     : (idname) ? idname : "Keying Set", sizeof(ks->name));
 
 	ks->flag = flag;
 	ks->keyingflag = keyingflag;
@@ -983,10 +982,10 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
 	/* add KeyingSet to list */
 	BLI_addtail(list, ks);
 	
-	/* Make sure KeyingSet has a unique idname. */
+	/* Make sure KeyingSet has a unique idname */
 	BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, idname), sizeof(ks->idname));
 	
-	/* Make sure KeyingSet has a unique label (this helps with identification). */
+	/* Make sure KeyingSet has a unique label (this helps with identification) */
 	BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name));
 	
 	/* return new KeyingSet for further editing */
@@ -1239,7 +1238,7 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
 				if (new_ptr.type == &RNA_PoseBone) {
 					/* bone transforms - update pose (i.e. tag depsgraph) */
 					skip_updates_hack = 1;
-				}				
+				}
 				
 				if (skip_updates_hack == 0)
 					RNA_property_update_cache_add(&new_ptr, prop);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b87342f..1970df5 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -534,10 +534,12 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
 		mul_m4_v3(imat, h2);
 
 		/* if next bone is B-bone too, use average handle direction */
-		if (next->bone->segments > 1)
-			;
-		else
+		if (next->bone->segments > 1) {
+			/* pass */
+		}
+		else {
 			h2[1] -= length;
+		}
 		normalize_v3(h2);
 
 		/* find the next roll to interpolate as well */
@@ -945,7 +947,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
 			}
 		}
 
-		if (use_dverts || armature_def_nr >= 0) {
+		if (use_dverts || armature_def_nr != -1) {
 			if (dm)
 				dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
 			else if (dverts && i < target_totvert)
@@ -956,7 +958,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
 		else
 			dvert = NULL;
 
-		if (armature_def_nr >= 0 && dvert) {
+		if (armature_def_nr != -1 && dvert) {
 			armature_weight = defvert_find_weight(dvert, armature_def_nr);
 
 			if (invert_vgroup)
@@ -1423,19 +1425,20 @@ void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float
  * *************************************************************************** */
 /* Computes vector and roll based on a rotation.
  * "mat" must contain only a rotation, and no scaling. */
-void mat3_to_vec_roll(float mat[][3], float vec[3], float *roll)
+void mat3_to_vec_roll(float mat[][3], float r_vec[3], float *r_roll)
 {
-	if (vec)
-		copy_v3_v3(vec, mat[1]);
+	if (r_vec) {
+		copy_v3_v3(r_vec, mat[1]);
+	}
 
-	if (roll) {
+	if (r_roll) {
 		float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
 
 		vec_roll_to_mat3(mat[1], 0.0f, vecmat);
 		invert_m3_m3(vecmatinv, vecmat);
 		mul_m3_m3m3(rollmat, vecmatinv, mat);
 
-		*roll = (float)atan2(rollmat[2][0], rollmat[2][2]);
+		*r_roll = atan2f(rollmat[2][0], rollmat[2][2]);
 	}
 }
 
@@ -1459,7 +1462,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
 	 * so a value inbetween these is needed.
 	 *
 	 * was 0.000001, causes bug [#30438] (which is same as [#27675, imho).
-	 * Reseting it to org value seems to cause no more [#23954]...
+	 * Resetting it to org value seems to cause no more [#23954]...
 	 *
 	 * was 0.0000000000001, caused bug [#31333], smaller values give unstable
 	 * roll when toggling editmode again...
@@ -1590,7 +1593,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
 		
 		if (UNLIKELY(pchanp == NULL)) {
 			/* happens for proxies that become invalid because of a missing link
-			 * for regulat cases it shouldn't happen at all */
+			 * for regular cases it shouldn't happen at all */
 		}
 		else if (pchan->bone->layer & layer_protected) {
 			ListBase proxylocal_constraints = {NULL, NULL};
@@ -1819,8 +1822,15 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
 		 */
 
 		/* only happens on reload file, but violates depsgraph still... fix! */
-		if ((cu->path == NULL) || (cu->path->data == NULL))
+		if (ELEM(NULL, cu->path, cu->path->data)) {
 			BKE_displist_make_curveTypes(scene, ikData->tar, 0);
+			
+			/* path building may fail in EditMode after removing verts [#33268]*/
+			if (ELEM(NULL, cu->path, cu->path->data)) {
+				/* BLI_assert(cu->path != NULL); */
+				return;
+			}
+		}
 	}
 
 	/* find the root bone and the chain of bones from the root to the tip
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 197e38a..f0d201e 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -70,6 +70,7 @@
 #include "BKE_displist.h"
 #include "BKE_global.h"
 #include "BKE_idprop.h"
+#include "BKE_image.h"
 #include "BKE_ipo.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -113,13 +114,14 @@ void free_blender(void)
 	BKE_spacetypes_free();      /* after free main, it uses space callbacks */
 	
 	IMB_exit();
+	BKE_images_exit();
 
 	BLI_callback_global_finalize();
 
 	BKE_sequencer_cache_destruct();
 	IMB_moviecache_destruct();
 	
-	free_nodesystem();	
+	free_nodesystem();
 }
 
 void initglobals(void)
@@ -237,7 +239,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 	
 	/* free G.main Main database */
 //	CTX_wm_manager_set(C, NULL);
-	clear_global();	
+	clear_global();
 	
 	/* clear old property update cache, in case some old references are left dangling */
 	RNA_property_update_cache_free();
@@ -266,7 +268,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 		G.winpos = bfd->winpos;
 		G.displaymode = bfd->displaymode;
 		G.fileflags = bfd->fileflags;
-		CTX_wm_manager_set(C, bfd->main->wm.first);
+		CTX_wm_manager_set(C, G.main->wm.first);
 		CTX_wm_screen_set(C, bfd->curscreen);
 		CTX_data_scene_set(C, bfd->curscreen->scene);
 		CTX_wm_area_set(C, NULL);
@@ -276,7 +278,11 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 	
 	/* this can happen when active scene was lib-linked, and doesn't exist anymore */
 	if (CTX_data_scene(C) == NULL) {
-		CTX_data_scene_set(C, bfd->main->scene.first);
+		/* in case we don't even have a local scene, add one */
+		if (!G.main->scene.first)
+			BKE_scene_add("Scene");
+
+		CTX_data_scene_set(C, G.main->scene.first);
 		CTX_wm_screen(C)->scene = CTX_data_scene(C);
 		curscene = CTX_data_scene(C);
 	}
@@ -338,7 +344,7 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
 	    (main->minversionfile == BLENDER_VERSION &&
 	     main->minsubversionfile > BLENDER_SUBVERSION))
 	{
-		BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d, expect loss of data!",
+		BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary (%d.%d), expect loss of data!",
 		            main->minversionfile, main->minsubversionfile);
 	}
 
@@ -407,9 +413,9 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
 		}
 		else
 			setup_app_data(C, bfd, filepath);  // frees BFD
-	} 
+	}
 	else
-		BKE_reports_prependf(reports, "Loading %s failed: ", filepath);
+		BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath);
 		
 	return (bfd ? retval : BKE_READ_FILE_FAIL);
 }
@@ -485,7 +491,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
 	int success = 0, fileflags;
 	
 	/* This is needed so undoing/redoing doesn't crash with threaded previews going */
-	WM_jobs_stop_all(CTX_wm_manager(C));
+	WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
 
 	BLI_strncpy(mainstr, G.main->name, sizeof(mainstr));    /* temporal store */
 
@@ -612,7 +618,7 @@ void BKE_write_undo(bContext *C, const char *name)
 	}
 }
 
-/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
+/* 1 = an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
 void BKE_undo_step(bContext *C, int step)
 {
 	
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index a7d90f0..0495e72 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -102,7 +102,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
 		
 		buffer = MEM_mallocN(bytes, "readBitmapFontVersion0:buffer");
 		
-		index = 0;	
+		index = 0;
 		for (i = 0; i < bytes; i++) {
 			buffer[i] = rect[index];
 			index += step;
@@ -247,12 +247,13 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode)
 	return(current);
 }
 
-void matrixGlyph(ImBuf * ibuf, unsigned short unicode,
-		float *centerx, float *centery,
-		float *sizex,   float *sizey,
-		float *transx,  float *transy,
-		float *movex,   float *movey,
-		float *advance)
+void matrixGlyph(
+        ImBuf * ibuf, unsigned short unicode,
+        float *centerx, float *centery,
+        float *sizex,   float *sizey,
+        float *transx,  float *transy,
+        float *movex,   float *movey,
+        float *advance)
 {
 	int index;
 	bmFont *bmfont;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 79d5e09..b6f1b88 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -101,13 +101,15 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 				break;
 			}
 		}
-		else if (rule->type == eBoidRuleType_Goal && eob == bpa->ground)
-			; /* skip current object */
+		else if (rule->type == eBoidRuleType_Goal && eob == bpa->ground) {
+			/* skip current object */
+		}
 		else if (pd->forcefield == PFIELD_BOID && mul * pd->f_strength > 0.0f && get_effector_data(cur, &cur_efd, &epoint, 0)) {
 			float temp = mul * pd->f_strength * effector_falloff(cur, &cur_efd, &epoint, bbd->part->effector_weights);
 
-			if (temp == 0.0f)
-				; /* do nothing */
+			if (temp == 0.0f) {
+				/* do nothing */
+			}
 			else if (temp > priority) {
 				priority = temp;
 				eff = cur;
@@ -954,7 +956,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 	//	}
 	//}
 
-	bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
+	zero_v3(bbd->wanted_co);
+	bbd->wanted_speed = 0.0f;
 
 	/* create random seed for every particle & frame */
 	rand = (int)(PSYS_FRAND(psys->seed + p) * 1000);
@@ -988,7 +991,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 					add_v3_v3(wanted_co, bbd->wanted_co);
 					wanted_speed += bbd->wanted_speed;
 					n++;
-					bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
+					zero_v3(bbd->wanted_co);
+					bbd->wanted_speed = 0.0f;
 				}
 			}
 
@@ -1168,7 +1172,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
 			/* constrain direction with maximum angular velocity */
 			angle = saacos(dot_v3v3(old_dir, wanted_dir));
-			angle = minf(angle, val.max_ave);
+			angle = min_ff(angle, val.max_ave);
 
 			cross_v3_v3v3(nor, old_dir, wanted_dir);
 			axis_angle_to_quat(q, nor, angle);
@@ -1264,9 +1268,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		{
 			float grav[3];
 
-			grav[0]= 0.0f;
-			grav[1]= 0.0f;
-			grav[2]= bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f;
+			grav[0] = 0.0f;
+			grav[1] = 0.0f;
+			grav[2] = bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f;
 
 			/* don't take forward acceleration into account (better banking) */
 			if (dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) {
@@ -1307,9 +1311,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		{
 			float grav[3];
 
-			grav[0]= 0.0f;
-			grav[1]= 0.0f;
-			grav[2]= bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f;
+			grav[0] = 0.0f;
+			grav[1] = 0.0f;
+			grav[2] = bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f;
 
 
 			/* gather apparent gravity */
diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c
index be79077..461b945 100644
--- a/source/blender/blenkernel/intern/booleanops_mesh.c
+++ b/source/blender/blenkernel/intern/booleanops_mesh.c
@@ -142,7 +142,7 @@ CSG_AddMeshToBlender(
 
 	/* Create a new blender mesh object - using 'base' as
 	 * a template for the new object. */
-	ob_new=  AddNewBlenderMesh(mesh->base);
+	ob_new =  AddNewBlenderMesh(mesh->base);
 
 	me_new = ob_new->data;
 
@@ -180,7 +180,7 @@ CSG_PerformOp(
 
 	if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) {
 		return 0;
-	}	
+	}
 	if ((int_op_type < 1) || (int_op_type > 3)) return 0;
 
 	switch (int_op_type) {
@@ -203,8 +203,8 @@ CSG_PerformOp(
 			mesh1->m_face_iterator,
 			mesh1->m_vertex_iterator,
 			mesh2->m_face_iterator,
-			mesh2->m_vertex_iterator,		
-			InterpFaceVertexData	
+			mesh2->m_vertex_iterator,
+			InterpFaceVertexData
 		);
 	}
 	else {
@@ -215,8 +215,8 @@ CSG_PerformOp(
 			mesh1->m_face_iterator,
 			mesh1->m_vertex_iterator,
 			mesh2->m_face_iterator,
-			mesh2->m_vertex_iterator,		
-			InterpNoUserData	
+			mesh2->m_vertex_iterator,
+			InterpNoUserData
 		);
 	}
 
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index ce39eea..f310895 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -618,18 +618,18 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
 
 /* Unified Size and Strength */
 
-// XXX: be careful about setting size and unprojected radius
-// because they depend on one another
-// these functions do not set the other corresponding value
-// this can lead to odd behavior if size and unprojected
-// radius become inconsistent.
-// the biggest problem is that it isn't possible to change
-// unprojected radius because a view context is not
-// available.  my ussual solution to this is to use the
-// ratio of change of the size to change the unprojected
-// radius.  Not completely convinced that is correct.
-// In anycase, a better solution is needed to prevent
-// inconsistency.
+/* XXX: be careful about setting size and unprojected radius
+ * because they depend on one another
+ * these functions do not set the other corresponding value
+ * this can lead to odd behavior if size and unprojected
+ * radius become inconsistent.
+ * the biggest problem is that it isn't possible to change
+ * unprojected radius because a view context is not
+ * available.  my ussual solution to this is to use the
+ * ratio of change of the size to change the unprojected
+ * radius.  Not completely convinced that is correct.
+ * In anycase, a better solution is needed to prevent
+ * inconsistency. */
 
 void BKE_brush_size_set(Scene *scene, Brush *brush, int size)
 {
@@ -741,7 +741,7 @@ void BKE_brush_scale_unprojected_radius(float *unprojected_radius,
 }
 
 /* scale brush size to reflect a change in the brush's unprojected radius */
-void BKE_brush_scale_size(int *BKE_brush_size_get,
+void BKE_brush_scale_size(int *r_brush_size,
                           float new_unprojected_radius,
                           float old_unprojected_radius)
 {
@@ -749,7 +749,7 @@ void BKE_brush_scale_size(int *BKE_brush_size_get,
 	/* avoid division by zero */
 	if (old_unprojected_radius != 0)
 		scale /= new_unprojected_radius;
-	(*BKE_brush_size_get) = (int)((float)(*BKE_brush_size_get) * scale);
+	(*r_brush_size) = (int)((float)(*r_brush_size) * scale);
 }
 
 /* Brush Painting */
@@ -876,8 +876,8 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
 	/* not sure if it's actually needed or it's a mistake in coords/sizes
 	 * calculation in brush_painter_fixed_tex_partial_update(), but without this
 	 * limitation memory gets corrupted at fast strokes with quite big spacing (sergey) */
-	w = MIN2(w, ibuf->x);
-	h = MIN2(h, ibuf->y);
+	w = min_ii(w, ibuf->x);
+	h = min_ii(h, ibuf->y);
 
 	if (painter->cache.flt) {
 		for (; y < h; y++) {
@@ -1052,13 +1052,13 @@ void BKE_brush_painter_break_stroke(BrushPainter *painter)
 static void brush_pressure_apply(BrushPainter *painter, Brush *brush, float pressure)
 {
 	if (BKE_brush_use_alpha_pressure(painter->scene, brush))
-		brush_alpha_set(painter->scene, brush, maxf(0.0f, painter->startalpha * pressure));
+		brush_alpha_set(painter->scene, brush, max_ff(0.0f, painter->startalpha * pressure));
 	if (BKE_brush_use_size_pressure(painter->scene, brush))
-		BKE_brush_size_set(painter->scene, brush, maxf(1.0f, painter->startsize * pressure));
+		BKE_brush_size_set(painter->scene, brush, max_ff(1.0f, painter->startsize * pressure));
 	if (brush->flag & BRUSH_JITTER_PRESSURE)
-		brush->jitter = maxf(0.0f, painter->startjitter * pressure);
+		brush->jitter = max_ff(0.0f, painter->startjitter * pressure);
 	if (brush->flag & BRUSH_SPACING_PRESSURE)
-		brush->spacing = maxf(1.0f, painter->startspacing * (1.5f - pressure));
+		brush->spacing = max_ff(1.0f, painter->startspacing * (1.5f - pressure));
 }
 
 void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2])
@@ -1158,7 +1158,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p
 		/* compute brush spacing adapted to brush radius, spacing may depend
 		 * on pressure, so update it */
 		brush_pressure_apply(painter, brush, painter->lastpressure);
-		spacing = maxf(1.0f, radius) * brush->spacing * 0.01f;
+		spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f;
 
 		/* setup starting distance, direction vector and accumulated distance */
 		startdistance = painter->accumdistance;
@@ -1176,7 +1176,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p
 				t = step / len;
 				press = (1.0f - t) * painter->lastpressure + t * pressure;
 				brush_pressure_apply(painter, brush, press);
-				spacing = maxf(1.0f, radius) * brush->spacing * 0.01f;
+				spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f;
 
 				BKE_brush_jitter_pos(scene, brush, paintpos, finalpos);
 
@@ -1287,8 +1287,6 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side)
 
 		texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
 
-		BKE_image_get_ibuf(mtex->tex->ima, NULL);
-		
 		/*do normalized cannonical view coords for texture*/
 		for (y = -1.0, iy = 0; iy < side; iy++, y += step) {
 			for (x = -1.0, ix = 0; ix < side; ix++, x += step) {
diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c
index 7defa7e..088031e 100644
--- a/source/blender/blenkernel/intern/bullet.c
+++ b/source/blender/blenkernel/intern/bullet.c
@@ -54,7 +54,7 @@ BulletSoftBody *bsbNew(void)
 
 	
 	bsb->viterations	=	0;
-	bsb->piterations	=	2;	
+	bsb->piterations	=	2;
 	bsb->diterations	=	0;
 	bsb->citerations	=	4;
 	
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 32ae6d0..ad828a7 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -358,8 +358,8 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
  * BVH from meshs callbacks
  */
 
-// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
-// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
+/* Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
+ * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */
 static void mesh_faces_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
 {
 	const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata;
@@ -395,8 +395,8 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
 	} while (t2);
 }
 
-// Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
-// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
+/* Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
+ * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */
 static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
 {
 	const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata;
@@ -435,8 +435,8 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
 	} while (t2);
 }
 
-// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
-// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
+/* Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
+ * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */
 static void mesh_edges_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
 {
 	const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata;
@@ -463,12 +463,12 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3
 /*
  * BVH builders
  */
-// Builds a bvh tree.. where nodes are the vertexs of the given mesh
+/* Builds a bvh tree.. where nodes are the vertexs of the given mesh */
 BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
 {
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_VERTICES);
 
-	//Not in cache
+	/* Not in cache */
 	if (tree == NULL) {
 		int i;
 		int numVerts = mesh->getNumVerts(mesh);
@@ -484,7 +484,7 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 
 				BLI_bvhtree_balance(tree);
 
-				//Save on cache for later use
+				/* Save on cache for later use */
 //				printf("BVHTree built and saved on cache\n");
 				bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_VERTICES);
 			}
@@ -495,15 +495,15 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	}
 
 
-	//Setup BVHTreeFromMesh
+	/* Setup BVHTreeFromMesh */
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
 	if (data->tree) {
 		data->cached = TRUE;
 
-		//a NULL nearest callback works fine
-		//remeber the min distance to point is the same as the min distance to BV of point
+		/* a NULL nearest callback works fine
+		 * remeber the min distance to point is the same as the min distance to BV of point */
 		data->nearest_callback = NULL;
 		data->raycast_callback = NULL;
 
@@ -517,12 +517,12 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	return data->tree;
 }
 
-// Builds a bvh tree.. where nodes are the faces of the given mesh.
+/* Builds a bvh tree.. where nodes are the faces of the given mesh. */
 BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
 {
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_FACES);
 
-	//Not in cache
+	/* Not in cache */
 	if (tree == NULL) {
 		int i;
 		int numFaces = mesh->getNumTessFaces(mesh);
@@ -616,7 +616,7 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 				}
 				BLI_bvhtree_balance(tree);
 
-				//Save on cache for later use
+				/* Save on cache for later use */
 //				printf("BVHTree built and saved on cache\n");
 				bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_FACES);
 			}
@@ -627,7 +627,7 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	}
 
 
-	//Setup BVHTreeFromMesh
+	/* Setup BVHTreeFromMesh */
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
@@ -647,12 +647,12 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 
 }
 
-// Builds a bvh tree.. where nodes are the faces of the given mesh.
+/* Builds a bvh tree.. where nodes are the faces of the given mesh. */
 BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
 {
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_EDGES);
 
-	//Not in cache
+	/* Not in cache */
 	if (tree == NULL) {
 		int i;
 		int numEdges = mesh->getNumEdges(mesh);
@@ -672,7 +672,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 				}
 				BLI_bvhtree_balance(tree);
 
-				//Save on cache for later use
+				/* Save on cache for later use */
 //				printf("BVHTree built and saved on cache\n");
 				bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_EDGES);
 			}
@@ -683,7 +683,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	}
 
 
-	//Setup BVHTreeFromMesh
+	/* Setup BVHTreeFromMesh */
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
@@ -703,7 +703,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 
 }
 
-// Frees data allocated by a call to bvhtree_from_mesh_*.
+/* Frees data allocated by a call to bvhtree_from_mesh_*. */
 void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
 {
 	if (data->tree) {
@@ -728,7 +728,7 @@ static void bvhcacheitem_set_if_match(void *_cached, void *_search)
 	BVHCacheItem *search = (BVHCacheItem *)_search;
 
 	if (search->type == cached->type) {
-		search->tree = cached->tree;		
+		search->tree = cached->tree;
 	}
 } 
 
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index ed7ac0e..57c8891 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -151,7 +151,7 @@ float BKE_camera_object_dof_distance(Object *ob)
 	Camera *cam = (Camera *)ob->data; 
 	if (ob->type != OB_CAMERA)
 		return 0.0f;
-	if (cam->dof_ob) {	
+	if (cam->dof_ob) {
 		/* too simple, better to return the distance on the view axis only
 		 * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */
 		float mat[4][4], imat[4][4], obmat[4][4];
@@ -262,11 +262,13 @@ void BKE_camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView
 	}
 	else if (rv3d->persp == RV3D_ORTHO) {
 		/* orthographic view */
+		int sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
 		params->clipend *= 0.5f;    // otherwise too extreme low zbuffer quality
 		params->clipsta = -params->clipend;
 
 		params->is_ortho = TRUE;
-		params->ortho_scale = rv3d->dist;
+		/* make sure any changes to this match ED_view3d_radius_to_ortho_dist() */
+		params->ortho_scale = rv3d->dist * sensor_size / v3d->lens;
 		params->zoom = 2.0f;
 	}
 	else {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index b176ed4..54bbe4b 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -273,6 +273,8 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
 		cddm->pbvh = BLI_pbvh_new();
 		cddm->pbvh_draw = can_pbvh_draw(ob, dm);
 
+		pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color);
+
 		BKE_mesh_tessface_ensure(me);
 		
 		BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
@@ -379,7 +381,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
 				for (i = 0; i < dm->numTessFaceData; i++, mf++) {
 					if (!(mf->flag & ME_HIDE)) {
 						draw = 1;
-					} 
+					}
 					else {
 						draw = 0;
 					}
@@ -438,7 +440,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
 				    (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
 				{
 					draw = TRUE;
-				} 
+				}
 				else {
 					draw = FALSE;
 				}
@@ -486,7 +488,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
 			for (i = 0; i < dm->numEdgeData; i++, medge++) {
 				if (medge->flag & ME_LOOSEEDGE) {
 					draw = 1;
-				} 
+				}
 				else {
 					draw = 0;
 				}
@@ -552,7 +554,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
 
 				glShadeModel(shademodel = new_shademodel);
 				glBegin(glmode = new_glmode);
-			} 
+			}
 			
 			if (drawCurrentMat) {
 				if (shademodel == GL_FLAT) {
@@ -612,14 +614,29 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 	CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
 	MVert *mv = cddm->mvert;
 	MFace *mf = DM_get_tessface_data_layer(dm, CD_MFACE);
-	MCol *realcol = dm->getTessFaceDataArray(dm, CD_TEXTURE_MCOL);
 	float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
 	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
-	int i, j, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
-	int startFace = 0 /*, lastFlag = 0xdeadbeef */ /* UNUSED */;
-	MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
-	if (!mcol)
-		mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
+	MCol *mcol;
+	int i, orig;
+	int colType, startFace = 0;
+
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
+	colType = CD_TEXTURE_MCOL;
+	mcol = dm->getTessFaceDataArray(dm, colType);
+	if (!mcol) {
+		colType = CD_PREVIEW_MCOL;
+		mcol = dm->getTessFaceDataArray(dm, colType);
+	}
+	if (!mcol) {
+		colType = CD_MCOL;
+		mcol = dm->getTessFaceDataArray(dm, colType);
+	}
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -634,14 +651,31 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 				draw_option = drawParams(tf ? &tf[i] : NULL, (mcol != NULL), mf->mat_nr);
 			}
 			else {
-				if (index) {
-					orig = *index++;
-					if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; }
-					if (drawParamsMapped)       { draw_option = drawParamsMapped(userData, orig); }
-					else                        { if (nors) nors += 3; continue; }
+				if (index_mf_to_mpoly) {
+					orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i);
+					if (orig == ORIGINDEX_NONE) {
+						/* XXX, this is not really correct
+						 * it will draw the previous faces context for this one when we don't know its settings.
+						 * but better then skipping it altogether. - campbell */
+						draw_option = DM_DRAW_OPTION_NORMAL;
+					}
+					else if (drawParamsMapped) {
+						draw_option = drawParamsMapped(userData, orig);
+					}
+					else {
+						if (nors) {
+							nors += 3; continue;
+						}
+					}
+				}
+				else if (drawParamsMapped) {
+					draw_option = drawParamsMapped(userData, i);
+				}
+				else {
+					if (nors) {
+						nors += 3; continue;
+					}
 				}
-				else if (drawParamsMapped) { draw_option = drawParamsMapped(userData, i); }
-				else                       { if (nors) nors += 3; continue; }
 			}
 			
 			if (draw_option != DM_DRAW_OPTION_SKIP) {
@@ -697,42 +731,11 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 		}
 	}
 	else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
-		MCol *col = realcol;
-		if (!col)
-			col = mcol;
-
 		GPU_vertex_setup(dm);
 		GPU_normal_setup(dm);
 		GPU_uv_setup(dm);
-		if (col != NULL) {
-#if 0
-			if (realcol && dm->drawObject->colType == CD_TEXTURE_MCOL) {
-				col = 0;
-			}
-			else if (mcol && dm->drawObject->colType == CD_MCOL) {
-				col = 0;
-			}
-			
-			if (col != 0)
-#endif
-			{
-				unsigned char *colors = MEM_mallocN(dm->getNumTessFaces(dm) * 4 * 3 * sizeof(unsigned char), "cdDM_drawFacesTex_common");
-				for (i = 0; i < dm->getNumTessFaces(dm); i++) {
-					for (j = 0; j < 4; j++) {
-						/* bgr -> rgb is intentional (and stupid), but how its stored internally */
-						colors[i * 12 + j * 3] = col[i * 4 + j].b;
-						colors[i * 12 + j * 3 + 1] = col[i * 4 + j].g;
-						colors[i * 12 + j * 3 + 2] = col[i * 4 + j].r;
-					}
-				}
-				GPU_color3_upload(dm, colors);
-				MEM_freeN(colors);
-				if (realcol)
-					dm->drawObject->colType = CD_TEXTURE_MCOL;
-				else if (mcol)
-					dm->drawObject->colType = CD_MCOL;
-			}
-			GPU_color_setup(dm);
+		if (mcol) {
+			GPU_color_setup(dm, colType);
 		}
 
 		if (!GPU_buffer_legacy(dm)) {
@@ -753,15 +756,21 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 					draw_option = drawParams(tf ? &tf[actualFace] : NULL, (mcol != NULL), mf[actualFace].mat_nr);
 				}
 				else {
-					if (index) {
-						orig = index[actualFace];
-						if (orig == ORIGINDEX_NONE) continue;
-						if (drawParamsMapped)
+					if (index_mf_to_mpoly) {
+						orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, actualFace);
+						if (orig == ORIGINDEX_NONE) {
+							/* XXX, this is not really correct
+							 * it will draw the previous faces context for this one when we don't know its settings.
+							 * but better then skipping it altogether. - campbell */
+							draw_option = DM_DRAW_OPTION_NORMAL;
+						}
+						else if (drawParamsMapped) {
 							draw_option = drawParamsMapped(userData, orig);
+						}
 					}
-					else
-					if (drawParamsMapped)
+					else if (drawParamsMapped) {
 						draw_option = drawParamsMapped(userData, actualFace);
+					}
 				}
 
 				/* flush buffer if current triangle isn't drawable or it's last triangle */
@@ -779,7 +788,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 					int count = (i - startFace + (draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0)) * 3;
 
 					if (count) {
-						if (col)
+						if (mcol && draw_option != DM_DRAW_OPTION_NO_MCOL)
 							GPU_color_switch(1);
 						else
 							GPU_color_switch(0);
@@ -814,16 +823,30 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 	CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
 	MVert *mv = cddm->mvert;
 	MFace *mf = cddm->mface;
-	MCol *mc;
+	MCol *mcol;
 	float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL);
-	int useColors = flag & DM_DRAW_USE_COLORS;
-	int i, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+	int colType, useColors = flag & DM_DRAW_USE_COLORS;
+	int i, orig;
+
 
-	mc = DM_get_tessface_data_layer(dm, CD_ID_MCOL);
-	if (!mc)
-		mc = DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL);
-	if (!mc)
-		mc = DM_get_tessface_data_layer(dm, CD_MCOL);
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
+
+	colType = CD_ID_MCOL;
+	mcol = DM_get_tessface_data_layer(dm, colType);
+	if (!mcol) {
+		colType = CD_PREVIEW_MCOL;
+		mcol = DM_get_tessface_data_layer(dm, colType);
+	}
+	if (!mcol) {
+		colType = CD_MCOL;
+		mcol = DM_get_tessface_data_layer(dm, colType);
+	}
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -835,7 +858,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 			int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH);
 			DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
 
-			orig = (index == NULL) ? i : *index++;
+			orig = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i;
 			
 			if (orig == ORIGINDEX_NONE)
 				draw_option = setMaterial(mf->mat_nr + 1, NULL);
@@ -845,8 +868,8 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 			if (draw_option != DM_DRAW_OPTION_SKIP) {
 				unsigned char *cp = NULL;
 
-				if (useColors && mc)
-					cp = (unsigned char *)&mc[i * 4];
+				if (useColors && mcol)
+					cp = (unsigned char *)&mcol[i * 4];
 
 				/* no need to set shading mode to flat because
 				 *  normals are already used to change shading */
@@ -906,8 +929,9 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 		int prevstart = 0;
 		GPU_vertex_setup(dm);
 		GPU_normal_setup(dm);
-		if (useColors && mc)
-			GPU_color_setup(dm);
+		if (useColors && mcol) {
+			GPU_color_setup(dm, colType);
+		}
 		if (!GPU_buffer_legacy(dm)) {
 			int tottri = dm->drawObject->tot_triangle_point / 3;
 			glShadeModel(GL_SMOOTH);
@@ -934,7 +958,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 					if (i != tottri - 1)
 						next_actualFace = dm->drawObject->triangle_to_mface[i + 1];
 
-					orig = (index == NULL) ? actualFace : index[actualFace];
+					orig = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, actualFace) : actualFace;
 
 					if (orig == ORIGINDEX_NONE)
 						draw_option = setMaterial(mface->mat_nr + 1, NULL);
@@ -1039,7 +1063,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 	/* MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
 	float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
 	int a, b, do_draw, matnr, new_matnr;
-	int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	int orig;
+
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -1072,7 +1103,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 				continue;
 			}
 			else if (setDrawOptions) {
-				orig = (index) ? index[a] : a;
+				orig = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
 
 				if (orig == ORIGINDEX_NONE) {
 					/* since the material is set by setMaterial(), faces with no
@@ -1176,13 +1207,13 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 							datatypes[numdata].size = 2;
 							datatypes[numdata].type = GL_FLOAT;
 							numdata++;
-						}	
+						}
 						for (b = 0; b < attribs.totmcol; b++) {
 							datatypes[numdata].index = attribs.mcol[b].gl_index;
 							datatypes[numdata].size = 4;
 							datatypes[numdata].type = GL_UNSIGNED_BYTE;
 							numdata++;
-						}	
+						}
 						if (attribs.tottang) {
 							datatypes[numdata].index = attribs.tang.gl_index;
 							datatypes[numdata].size = 4;
@@ -1242,7 +1273,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 						col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
 						copy_v4_v4_char((char *)&varray[elementsize * curface * 3 + offset + elementsize * 2], (char *)col);
 						offset += sizeof(unsigned char) * 4;
-					}	
+					}
 					if (attribs.tottang) {
 						float *tang = attribs.tang.array[a * 4 + 0];
 						copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
@@ -1283,7 +1314,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 							col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
 							copy_v4_v4_char((char *)&varray[elementsize * curface * 3 + offset + elementsize * 2], (char *)col);
 							offset += sizeof(unsigned char) * 4;
-						}	
+						}
 						if (attribs.tottang) {
 							float *tang = attribs.tang.array[a * 4 + 2];
 							copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
@@ -1333,7 +1364,14 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 	MFace *mf = cddm->mface;
 	float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
 	int a, matnr, new_matnr;
-	int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	int orig;
+
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -1362,7 +1400,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 
 		/* skipping faces */
 		if (setFace) {
-			orig = (index) ? index[a] : a;
+			orig = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
 
 			if (orig != ORIGINDEX_NONE && !setFace(userData, orig))
 				continue;
@@ -1525,11 +1563,6 @@ void CDDM_recalc_tessellation_ex(DerivedMesh *dm, const int do_face_nor_cpy)
 	                                                   dm->numTessFaceData, dm->numLoopData, dm->numPolyData,
 	                                                   do_face_nor_cpy);
 
-	if (!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX)) {
-		int *polyIndex = CustomData_get_layer(&dm->faceData, CD_POLYINDEX);
-		CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_REFERENCE, polyIndex, dm->numTessFaceData);
-	}
-
 	cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
 
 	/* Tessellation recreated faceData, and the active layer indices need to get re-propagated
@@ -1641,7 +1674,6 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numTessFaces, int numLoops
 	CustomData_add_layer(&dm->vertData, CD_ORIGINDEX, CD_CALLOC, NULL, numVerts);
 	CustomData_add_layer(&dm->edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
 	CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_CALLOC, NULL, numTessFaces);
-	CustomData_add_layer(&dm->faceData, CD_POLYINDEX, CD_CALLOC, NULL, numTessFaces);
 	CustomData_add_layer(&dm->polyData, CD_ORIGINDEX, CD_CALLOC, NULL, numPolys);
 
 	CustomData_add_layer(&dm->vertData, CD_MVERT, CD_CALLOC, NULL, numVerts);
@@ -1665,7 +1697,6 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
 	DerivedMesh *dm = &cddm->dm;
 	CustomDataMask mask = CD_MASK_MESH & (~CD_MASK_MDISPS);
 	int alloctype;
-	int *polyindex = NULL;
 
 	/* this does a referenced copy, with an exception for fluidsim */
 
@@ -1680,7 +1711,7 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
 	                 mesh->totvert);
 	CustomData_merge(&mesh->edata, &dm->edgeData, mask, alloctype,
 	                 mesh->totedge);
-	CustomData_merge(&mesh->fdata, &dm->faceData, mask | CD_MASK_POLYINDEX, alloctype,
+	CustomData_merge(&mesh->fdata, &dm->faceData, mask | CD_MASK_ORIGINDEX, alloctype,
 	                 mesh->totface);
 	CustomData_merge(&mesh->ldata, &dm->loopData, mask, alloctype,
 	                 mesh->totloop);
@@ -1693,17 +1724,12 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
 	cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
 	cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
 
-	/* commented since even when CD_POLYINDEX was first added this line fails
+	/* commented since even when CD_ORIGINDEX was first added this line fails
 	 * on the default cube, (after editmode toggle too) - campbell */
 #if 0
-	BLI_assert(CustomData_has_layer(&cddm->dm.faceData, CD_POLYINDEX));
+	BLI_assert(CustomData_has_layer(&cddm->dm.faceData, CD_ORIGINDEX));
 #endif
 
-	polyindex = CustomData_get_layer(&dm->faceData, CD_POLYINDEX);
-	if (!CustomData_has_layer(&cddm->dm.faceData, CD_ORIGINDEX)) {
-		CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_REFERENCE, polyindex, mesh->totface);
-	}
-
 	return dm;
 }
 
@@ -1789,10 +1815,10 @@ DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase, int **orco
 }
 
 static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
-                                        int cdindex, BMLoop *l3[3],
+                                        int cdindex, const BMLoop *l3[3],
                                         int numCol, int numTex)
 {
-	BMLoop *l;
+	const BMLoop *l;
 	BMFace *f = l3[0]->f;
 	MTFace *texface;
 	MTexPoly *texpoly;
@@ -1835,13 +1861,16 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
 	}
 }
 
-DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdisps, int use_tessface)
+/* used for both editbmesh and bmesh */
+static DerivedMesh *cddm_from_bmesh_ex(struct BMesh *bm, int use_mdisps,
+                                       /* EditBMesh vars for use_tessface */
+                                       int use_tessface,
+                                       const int em_tottri, const BMLoop *(*em_looptris)[3]
+                                       )
 {
-	BMesh *bm = em->bm;
-
 	DerivedMesh *dm = CDDM_new(bm->totvert,
 	                           bm->totedge,
-	                           use_tessface ? em->tottri : 0,
+	                           use_tessface ? em_tottri : 0,
 	                           bm->totloop,
 	                           bm->totface);
 
@@ -1887,7 +1916,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
 	
 	/* add tessellation mface layers */
 	if (use_tessface) {
-		CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em->tottri);
+		CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em_tottri);
 	}
 
 	index = dm->getVertDataArray(dm, CD_ORIGINDEX);
@@ -1945,15 +1974,13 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
 
 	/* avoid this where possiblem, takes extra memory */
 	if (use_tessface) {
-		int *polyindex;
 
 		BM_mesh_elem_index_ensure(bm, BM_FACE);
 
-		polyindex = dm->getTessFaceDataArray(dm, CD_POLYINDEX);
 		index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
-		for (i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) {
+		for (i = 0; i < dm->numTessFaceData; i++, index++) {
 			MFace *mf = &mface[i];
-			BMLoop **l = em->looptris[i];
+			const BMLoop **l = em_looptris[i];
 			efa = l[0]->f;
 
 			mf->v1 = BM_elem_index_get(l[0]->v);
@@ -1963,8 +1990,8 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
 			mf->mat_nr = efa->mat_nr;
 			mf->flag = BM_face_flag_to_mflag(efa);
 
-			*index = add_orig ? BM_elem_index_get(efa) : *(int *)CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_ORIGINDEX);
-			*polyindex = BM_elem_index_get(efa);
+			/* map mfaces to polygons in the same cddm intentionally */
+			*index = BM_elem_index_get(efa);
 
 			loops_to_customdata_corners(bm, &dm->faceData, i, l, numCol, numTex);
 			test_index_face(mf, &dm->faceData, i, 3);
@@ -2003,6 +2030,20 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
 	return dm;
 }
 
+struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps)
+{
+	return cddm_from_bmesh_ex(bm, use_mdisps, FALSE,
+	                          /* these vars are for editmesh only */
+	                          0, NULL);
+}
+
+DerivedMesh *CDDM_from_editbmesh(BMEditMesh *em, int use_mdisps, int use_tessface)
+{
+	return cddm_from_bmesh_ex(em->bm, use_mdisps,
+	                          /* editmesh */
+	                          use_tessface, em->tottri, (const BMLoop *(*)[3])em->looptris);
+}
+
 static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
 {
 	CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm");
@@ -2017,6 +2058,7 @@ static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
 	source->getVertDataArray(source, CD_ORIGINDEX);
 	source->getEdgeDataArray(source, CD_ORIGINDEX);
 	source->getTessFaceDataArray(source, CD_ORIGINDEX);
+	source->getPolyDataArray(source, CD_ORIGINDEX);
 
 	/* this initializes dm, and copies all non mvert/medge/mface layers */
 	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces,
@@ -2071,6 +2113,7 @@ DerivedMesh *CDDM_from_template(DerivedMesh *source,
 	source->getVertDataArray(source, CD_ORIGINDEX);
 	source->getEdgeDataArray(source, CD_ORIGINDEX);
 	source->getTessFaceDataArray(source, CD_ORIGINDEX);
+	source->getPolyDataArray(source, CD_ORIGINDEX);
 
 	/* this does a copy of all non mvert/medge/mface layers */
 	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces, numLoops, numPolys);
@@ -2088,8 +2131,6 @@ DerivedMesh *CDDM_from_template(DerivedMesh *source,
 		CustomData_add_layer(&dm->edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
 	if (!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX))
 		CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_CALLOC, NULL, numTessFaces);
-	if (!CustomData_get_layer(&dm->faceData, CD_POLYINDEX))
-		CustomData_add_layer(&dm->faceData, CD_POLYINDEX, CD_CALLOC, NULL, numTessFaces);
 
 	cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
 	cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
@@ -2154,8 +2195,8 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals
 		CDDM_recalc_tessellation_ex(dm, FALSE);
 	}
 	else {
-		/* A tessellation already exists, it should always have a CD_POLYINDEX */
-		BLI_assert(CustomData_has_layer(&dm->faceData, CD_POLYINDEX));
+		/* A tessellation already exists, it should always have a CD_ORIGINDEX */
+		BLI_assert(CustomData_has_layer(&dm->faceData, CD_ORIGINDEX));
 		CustomData_free_layers(&dm->faceData, CD_NORMAL, dm->numTessFaceData);
 	}
 
@@ -2165,7 +2206,7 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals
 	/* calculate face normals */
 	BKE_mesh_calc_normals_mapping_ex(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm),
 	                                 dm->numLoopData, dm->numPolyData, NULL, cddm->mface, dm->numTessFaceData,
-	                                 CustomData_get_layer(&dm->faceData, CD_POLYINDEX), face_nors,
+	                                 CustomData_get_layer(&dm->faceData, CD_ORIGINDEX), face_nors,
 	                                 only_face_normals);
 
 	CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
@@ -2233,6 +2274,11 @@ void CDDM_calc_normals_tessface(DerivedMesh *dm)
  * this is a really horribly written function.  ger. - joeedh
  *
  * note, CDDM_recalc_tessellation has to run on the returned DM if you want to access tessfaces.
+ *
+ * Note: This function is currently only used by the Mirror modifier, so it
+ *       skips any faces that have all vertices merged (to avoid creating pairs
+ *       of faces sharing the same set of vertices). If used elsewhere, it may
+ *       be necessary to make this functionality optional.
  */
 DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
 {
@@ -2276,14 +2322,11 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
 			newv[i] = newv[vtargetmap[i]];
 		}
 	}
-	
-	/* find-replace merged vertices with target vertices */
-	ml = cddm->mloop;
-	for (i = 0; i < totloop; i++, ml++) {
-		if (vtargetmap[ml->v] != -1) {
-			ml->v = vtargetmap[ml->v];
-		}
-	}
+
+	/* Don't remap vertices in cddm->mloop, because we need to know the original
+	 * indices in order to skip faces with all vertices merged.
+	 * The "update loop indices..." section further down remaps vertices in mloop.
+	 */
 
 	/* now go through and fix edges and faces */
 	med = cddm->medge;
@@ -2317,6 +2360,24 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
 		
 		ml = cddm->mloop + mp->loopstart;
 
+		/* skip faces with all vertices merged */
+		{
+			int all_vertices_merged = TRUE;
+
+			for (j = 0; j < mp->totloop; j++, ml++) {
+				if (vtargetmap[ml->v] == -1) {
+					all_vertices_merged = FALSE;
+					break;
+				}
+			}
+
+			if (UNLIKELY(all_vertices_merged)) {
+				continue;
+			}
+		}
+
+		ml = cddm->mloop + mp->loopstart;
+
 		c = 0;
 		for (j = 0; j < mp->totloop; j++, ml++) {
 			med = cddm->medge + ml->e;
@@ -2339,7 +2400,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
 		BLI_array_append(oldp, i);
 	}
 	
-	/*create new cddm*/	
+	/*create new cddm*/
 	cddm2 = (CDDerivedMesh *) CDDM_from_template((DerivedMesh *)cddm, BLI_array_count(mvert), BLI_array_count(medge), 0, BLI_array_count(mloop), BLI_array_count(mpoly));
 	
 	/*update edge indices and copy customdata*/
@@ -2364,7 +2425,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
 		CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1);
 	}
 	
-	/*copy vertex customdata*/	
+	/*copy vertex customdata*/
 	mv = mvert;
 	for (i = 0; i < cddm2->dm.numVertData; i++, mv++) {
 		CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1);
@@ -2439,7 +2500,7 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
 	numEdges = BLI_edgehash_size(eh);
 
 	/* write new edges into a temporary CustomData */
-	memset(&edgeData, 0, sizeof(edgeData));
+	CustomData_reset(&edgeData);
 	CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
 	CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
 
@@ -2475,7 +2536,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
 	EdgeHashIterator *ehi;
 	MPoly *mp = cddm->mpoly;
 	MLoop *ml;
-	MEdge *med;
+	MEdge *med, *origmed;
 	EdgeHash *eh = BLI_edgehash_new();
 	int v1, v2;
 	int *eindex;
@@ -2504,10 +2565,11 @@ void CDDM_calc_edges(DerivedMesh *dm)
 	numEdges = BLI_edgehash_size(eh);
 
 	/* write new edges into a temporary CustomData */
-	memset(&edgeData, 0, sizeof(edgeData));
+	CustomData_reset(&edgeData);
 	CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
 	CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
 
+	origmed = cddm->medge;
 	med = CustomData_get_layer(&edgeData, CD_MEDGE);
 	index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
 
@@ -2518,8 +2580,14 @@ void CDDM_calc_edges(DerivedMesh *dm)
 		BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
 		j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
 
-		med->flag = ME_EDGEDRAW | ME_EDGERENDER;
-		*index = j == 0 ? ORIGINDEX_NONE : eindex[j - 1];
+		if (j == 0) {
+			med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+			*index = ORIGINDEX_NONE;
+		}
+		else {
+			med->flag = ME_EDGEDRAW | ME_EDGERENDER | origmed[j - 1].flag;
+			*index = eindex[j - 1];
+		}
 
 		BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
 	}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index da162ab..f1d73c7 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -41,8 +41,6 @@
 #include "BLI_utildefines.h"
 #include "BLI_linklist.h"
 
-#include "BLF_translation.h"
-
 #include "BKE_cdderivedmesh.h"
 #include "BKE_cloth.h"
 #include "BKE_effect.h"
@@ -331,7 +329,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
 	cache= clmd->point_cache;
 
 	/* initialize simulation data if it didn't exist already */
-	if (clmd->clothObject == NULL) {	
+	if (clmd->clothObject == NULL) {
 		if (!cloth_from_object(ob, clmd, result, framenr, 1)) {
 			BKE_ptcache_invalidate(cache);
 			return 0;
@@ -824,7 +822,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 	int i = 0;
 	MVert *mvert = NULL;
 	ClothVertex *verts = NULL;
-	float (*shapekey_rest)[3]= NULL;
+	float (*shapekey_rest)[3] = NULL;
 	float tnull[3] = {0, 0, 0};
 	Cloth *cloth = NULL;
 	float maxdist = 0;
@@ -845,7 +843,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 		clmd->clothObject->edgehash = NULL;
 	}
 	else if (!clmd->clothObject) {
-		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject."));
+		modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject");
 		return 0;
 	}
 
@@ -907,7 +905,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 
 	if ( !cloth_build_springs ( clmd, dm ) ) {
 		cloth_free_modifier ( clmd );
-		modifier_setError(&(clmd->modifier), "%s", TIP_("Can't build springs."));
+		modifier_setError(&(clmd->modifier), "Cannot build springs");
 		printf("cloth_free_modifier cloth_build_springs\n");
 		return 0;
 	}
@@ -949,7 +947,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
 	clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" );
 	if ( clmd->clothObject->verts == NULL ) {
 		cloth_free_modifier ( clmd );
-		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts."));
+		modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->verts");
 		printf("cloth_free_modifier clmd->clothObject->verts\n");
 		return;
 	}
@@ -959,7 +957,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
 	clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" );
 	if ( clmd->clothObject->mfaces == NULL ) {
 		cloth_free_modifier ( clmd );
-		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces."));
+		modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->mfaces");
 		printf("cloth_free_modifier clmd->clothObject->mfaces\n");
 		return;
 	}
@@ -1050,29 +1048,25 @@ static void cloth_update_springs( ClothModifierData *clmd )
 
 		spring->stiffness = 0.0f;
 
-		if(spring->type == CLOTH_SPRING_TYPE_STRUCTURAL)
-		{
+		if (spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
 			spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f;
 		}
-		else if(spring->type == CLOTH_SPRING_TYPE_SHEAR)
-		{
+		else if (spring->type == CLOTH_SPRING_TYPE_SHEAR) {
 			spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f;
 		}
-		else if(spring->type == CLOTH_SPRING_TYPE_BENDING)
-		{
+		else if (spring->type == CLOTH_SPRING_TYPE_BENDING) {
 			spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
 		}
-		else if(spring->type == CLOTH_SPRING_TYPE_GOAL)
-		{
+		else if (spring->type == CLOTH_SPRING_TYPE_GOAL) {
 			/* Warning: Appending NEW goal springs does not work because implicit solver would need reset! */
 
 			/* Activate / Deactivate existing springs */
-			if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[spring->ij].goal > ALMOST_ZERO))
+			if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) &&
+			    (cloth->verts[spring->ij].goal > ALMOST_ZERO))
 			{
 				spring->flags &= ~CLOTH_SPRING_FLAG_DEACTIVATE;
 			}
-			else
-			{
+			else {
 				spring->flags |= CLOTH_SPRING_FLAG_DEACTIVATE;
 			}
 		}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 6631afc..4641a02 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -198,6 +198,11 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
 	w3[0] = 1.0f - w1[0] - w2[0];
 }
 
+#ifdef __GNUC__
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
+
 DO_INLINE void collision_interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3 )
 {
 	zero_v3(to);
@@ -272,7 +277,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 
 			/* Decrease in magnitude of relative tangential velocity due to coulomb friction
 			 * in original formula "magrelVel" should be the "change of relative velocity in normal direction" */
-			magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
+			magtangent = min_ff(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
 
 			/* Apply friction impulse. */
 			if ( magtangent > ALMOST_ZERO ) {
@@ -312,8 +317,8 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 
 				/* stay on the safe side and clamp repulse */
 				if ( impulse > ALMOST_ZERO )
-					repulse = MIN2 ( repulse, 5.0*impulse );
-				repulse = MAX2 ( impulse, repulse );
+					repulse = min_ff( repulse, 5.0*impulse );
+				repulse = max_ff(impulse, repulse);
 
 				impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); /* original 2.0 / 0.25 */
 				VECADDMUL ( i1, collpair->normal,  impulse );
@@ -331,12 +336,12 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 			 * We don't use dt!! */
 			float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
 
-			float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
+			float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - (float)collpair->distance;
 			if ( d > ALMOST_ZERO) {
 				/* stay on the safe side and clamp repulse */
 				float repulse = d*1.0f/spf;
 
-				float impulse = repulse / ( 3.0 * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); /* original 2.0 / 0.25 */
+				float impulse = repulse / ( 3.0f * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); /* original 2.0 / 0.25 */
 
 				VECADDMUL ( i1, collpair->normal,  impulse );
 				VECADDMUL ( i2, collpair->normal,  impulse );
@@ -368,6 +373,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 	return result;
 }
 
+#ifdef __GNUC__
+#  pragma GCC diagnostic pop
+#endif
+
 //Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned
 static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
                                  BVHTreeOverlap *overlap, CollPair *collpair, float UNUSED(dt))
@@ -458,7 +467,8 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
 		distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO );
 #endif
 
-		if (distance <= (epsilon1 + epsilon2 + ALMOST_ZERO)) {
+		// distance -1 means no collision result
+		if (distance != -1.0 && (distance <= (double)(epsilon1 + epsilon2 + ALMOST_ZERO))) {
 			normalize_v3_v3(collpair->normal, collpair->vector);
 
 			collpair->distance = distance;
@@ -514,7 +524,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
 	if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision))
 		cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type);
 	
-	if (cmd) {	
+	if (cmd) {
 		/* extend array */
 		if (*numobj >= *maxobj) {
 			*maxobj *= 2;
@@ -533,7 +543,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
 		/* add objects */
 		for (go= group->gobject.first; go; go= go->next)
 			add_collision_object(objs, numobj, maxobj, go->ob, self, level+1, modifier_type);
-	}	
+	}
 }
 
 // return all collision objects in scene
@@ -579,7 +589,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
 	if (ob->pd && ob->pd->deflect)
 		cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
 	
-	if (cmd && cmd->bvhtree) {	
+	if (cmd && cmd->bvhtree) {
 		if (*objs == NULL)
 			*objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
 
@@ -737,8 +747,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, flo
 		collision_move_object ( collmd, step + dt, step );
 	}
 
-	do
-	{
+	do {
 		CollPair **collisions, **collisions_index;
 		
 		ret2 = 0;
@@ -869,7 +878,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, flo
 								VECADD ( verts[i].tx, verts[i].tx, temp );
 							}
 							else {
-								mul_v3_fl(temp, correction * -0.5);
+								mul_v3_fl(temp, correction * -0.5f);
 								VECADD ( verts[j].tx, verts[j].tx, temp );
 	
 								sub_v3_v3v3(verts[i].tx, verts[i].tx, temp);
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 1bd5786..529fe07 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -65,10 +65,10 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m
 	cumap->flag = CUMA_DO_CLIP;
 	if (tot == 4) cumap->cur = 3;   /* rhms, hack for 'col' curve? */
 	
-	clipminx = minf(minx, maxx);
-	clipminy = minf(miny, maxy);
-	clipmaxx = maxf(minx, maxx);
-	clipmaxy = maxf(miny, maxy);
+	clipminx = min_ff(minx, maxx);
+	clipminy = min_ff(miny, maxy);
+	clipmaxx = max_ff(minx, maxx);
+	clipmaxy = max_ff(miny, maxy);
 	
 	BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
 	cumap->clipr = cumap->curr;
@@ -85,7 +85,7 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m
 		cumap->cm[a].curve[0].y = miny;
 		cumap->cm[a].curve[1].x = maxx;
 		cumap->cm[a].curve[1].y = maxy;
-	}	
+	}
 
 	cumap->changed_timestamp = 0;
 }
@@ -160,7 +160,7 @@ void curvemapping_set_black_white_ex(const float black[3], const float white[3],
 	int a;
 
 	for (a = 0; a < 3; a++) {
-		const float delta = maxf(white[a] - black[a], 1e-5f);
+		const float delta = max_ff(white[a] - black[a], 1e-5f);
 		r_bwmul[a] = 1.0f / delta;
 	}
 }
@@ -182,14 +182,14 @@ void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], con
 /* ********** NOTE: requires curvemapping_changed() call after ******** */
 
 /* remove specified point */
-void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
+int curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
 {
 	CurveMapPoint *cmp;
 	int a, b, removed = 0;
 	
 	/* must have 2 points minimum */
 	if (cuma->totpoint <= 2)
-		return;
+		return FALSE;
 
 	cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points");
 
@@ -205,6 +205,7 @@ void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
 	MEM_freeN(cuma->curve);
 	cuma->curve = cmp;
 	cuma->totpoint -= removed;
+	return (removed != 0);
 }
 
 /* removes with flag set */
@@ -498,8 +499,8 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
 	bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr");
 	
 	for (a = 0; a < cuma->totpoint; a++) {
-		cuma->mintable = minf(cuma->mintable, cmp[a].x);
-		cuma->maxtable = maxf(cuma->maxtable, cmp[a].x);
+		cuma->mintable = min_ff(cuma->mintable, cmp[a].x);
+		cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x);
 		bezt[a].vec[1][0] = cmp[a].x;
 		bezt[a].vec[1][1] = cmp[a].y;
 		if (cmp[a].flag & CUMA_VECTOR)
@@ -555,7 +556,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
 				sub_v3_v3v3(bezt[a].vec[2], bezt[a].vec[1], vec);
 			}
 		}
-	}	
+	}
 	/* make the bezier curve */
 	if (cuma->table)
 		MEM_freeN(cuma->table);
@@ -690,13 +691,13 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
 		for (a = 0; a < cuma->totpoint; a++) {
 			if (cmp[a].flag & CUMA_SELECT) {
 				if (cmp[a].x < clipr->xmin)
-					dx = minf(dx, cmp[a].x - clipr->xmin);
+					dx = min_ff(dx, cmp[a].x - clipr->xmin);
 				else if (cmp[a].x > clipr->xmax)
-					dx = maxf(dx, cmp[a].x - clipr->xmax);
+					dx = max_ff(dx, cmp[a].x - clipr->xmax);
 				if (cmp[a].y < clipr->ymin)
-					dy = minf(dy, cmp[a].y - clipr->ymin);
+					dy = min_ff(dy, cmp[a].y - clipr->ymin);
 				else if (cmp[a].y > clipr->ymax)
-					dy = maxf(dy, cmp[a].y - clipr->ymax);
+					dy = max_ff(dy, cmp[a].y - clipr->ymax);
 			}
 		}
 		for (a = 0; a < cuma->totpoint; a++) {
@@ -731,7 +732,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
 		}
 		if (a != cuma->totpoint - 1)
 			curvemap_remove(cuma, 2);
-	}	
+	}
 	curvemap_make_table(cuma, clipr);
 }
 
@@ -835,64 +836,6 @@ void curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char ve
 	vecout_byte[2] = FTOCHAR(vecout[2]);
 }
 
-
-/* only used for image editor curves */
-void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
-{
-	ImBuf *tmpbuf;
-	int pixel;
-	float *pix_in;
-	float col[3];
-	int stride = 4;
-	float *pix_out;
-	
-	if (ibuf == NULL)
-		return;
-	if (ibuf->rect_float == NULL)
-		IMB_float_from_rect(ibuf);
-	else if (ibuf->rect == NULL)
-		imb_addrectImBuf(ibuf);
-	
-	if (!ibuf->rect || !ibuf->rect_float)
-		return;
-	
-	/* work on a temp buffer, so can color manage afterwards.
-	 * No worse off memory wise than comp nodes */
-	tmpbuf = IMB_dupImBuf(ibuf);
-	
-	curvemapping_premultiply(cumap, 0);
-	
-	pix_in = ibuf->rect_float;
-	pix_out = tmpbuf->rect_float;
-
-	if (ibuf->channels)
-		stride = ibuf->channels;
-	
-	for (pixel = ibuf->x * ibuf->y; pixel > 0; pixel--, pix_in += stride, pix_out += stride) {
-		if (stride < 3) {
-			col[0] = curvemap_evaluateF(cumap->cm, *pix_in);
-			
-			pix_out[1] = pix_out[2] = pix_out[3] = pix_out[0] = col[0];
-		}
-		else {
-			curvemapping_evaluate_premulRGBF(cumap, col, pix_in);
-			pix_out[0] = col[0];
-			pix_out[1] = col[1];
-			pix_out[2] = col[2];
-			if (stride > 3)
-				pix_out[3] = pix_in[3];
-			else
-				pix_out[3] = 1.f;
-		}
-	}
-	
-	IMB_rect_from_float(tmpbuf);
-	SWAP(unsigned int *, tmpbuf->rect, ibuf->rect);
-	IMB_freeImBuf(tmpbuf);
-	
-	curvemapping_premultiply(cumap, 1);
-}
-
 int curvemapping_RGBA_does_something(const CurveMapping *cumap)
 {
 	int a;
@@ -1065,8 +1008,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
                    const ColorManagedDisplaySettings *display_settings)
 {
 	int x, y, c;
-	unsigned int n, nl;
-	double div, divl;
+	unsigned int nl, na, nr, ng, nb;
+	double divl, diva, divr, divg, divb;
 	float *rf = NULL;
 	unsigned char *rc = NULL;
 	unsigned int *bin_lum, *bin_r, *bin_g, *bin_b, *bin_a;
@@ -1206,24 +1149,37 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
 			savedlines += 1;
 	}
 
+	/* test for nicer distribution even - non standard, leave it out for a while */
+#if 0
+	for (x = 0; x < 256; x++) {
+		bin_lum[x] = sqrt (bin_lum[x]);
+		bin_r[x] = sqrt(bin_r[x]);
+		bin_g[x] = sqrt(bin_g[x]);
+		bin_b[x] = sqrt(bin_b[x]);
+		bin_a[x] = sqrt(bin_a[x]);
+	}
+#endif
+	
 	/* convert hist data to float (proportional to max count) */
-	n = 0;
-	nl = 0;
+	nl = na = nr = nb = ng = 0;
 	for (x = 0; x < 256; x++) {
 		if (bin_lum[x] > nl) nl = bin_lum[x];
-		if (bin_r[x]   > n) n = bin_r[x];
-		if (bin_g[x]   > n) n = bin_g[x];
-		if (bin_b[x]   > n) n = bin_b[x];
-		if (bin_a[x]   > n) n = bin_a[x];
+		if (bin_r[x]   > nr) nr = bin_r[x];
+		if (bin_g[x]   > ng) ng = bin_g[x];
+		if (bin_b[x]   > nb) nb = bin_b[x];
+		if (bin_a[x]   > na) na = bin_a[x];
 	}
-	div = 1.0 / (double)n;
 	divl = 1.0 / (double)nl;
+	diva = 1.0 / (double)na;
+	divr = 1.0 / (double)nr;
+	divg = 1.0 / (double)ng;
+	divb = 1.0 / (double)nb;
 	for (x = 0; x < 256; x++) {
 		scopes->hist.data_luma[x] = bin_lum[x] * divl;
-		scopes->hist.data_r[x] = bin_r[x] * div;
-		scopes->hist.data_g[x] = bin_g[x] * div;
-		scopes->hist.data_b[x] = bin_b[x] * div;
-		scopes->hist.data_a[x] = bin_a[x] * div;
+		scopes->hist.data_r[x] = bin_r[x] * divr;
+		scopes->hist.data_g[x] = bin_g[x] * divg;
+		scopes->hist.data_b[x] = bin_b[x] * divb;
+		scopes->hist.data_a[x] = bin_a[x] * diva;
 	}
 	MEM_freeN(bin_lum);
 	MEM_freeN(bin_r);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index e3f7ae1..97d7508 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -84,15 +84,9 @@
 #include "BKE_movieclip.h"
 
 #ifdef WITH_PYTHON
-#include "BPY_extern.h"
+#  include "BPY_extern.h"
 #endif
 
-#ifndef M_PI
-#define M_PI        3.14159265358979323846
-#endif
-
-
-
 /* ************************ Constraints - General Utilities *************************** */
 /* These functions here don't act on any specific constraints, and are therefore should/will
  * not require any of the special function-pointers afforded by the relevant constraint 
@@ -221,51 +215,6 @@ void constraints_clear_evalob(bConstraintOb *cob)
 
 /* -------------- Space-Conversion API -------------- */
 
-#if 0 /* XXX Old code, does the same as one in armature.c, will remove it later. */
-static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4])
-{
-	if (pchan->parent) {
-		float offs_bone[4][4];
-
-		/* construct offs_bone the same way it is done in armature.c */
-		copy_m4_m3(offs_bone, pchan->bone->bone_mat);
-		copy_v3_v3(offs_bone[3], pchan->bone->head);
-		offs_bone[3][1] += pchan->bone->parent->length;
-
-		if (pchan->bone->flag & BONE_HINGE) {
-			/* pose_mat = par_pose-space_location * chan_mat */
-			float tmat[4][4];
-
-			/* the rotation of the parent restposition */
-			copy_m4_m4(tmat, pchan->bone->parent->arm_mat);
-
-			/* the location of actual parent transform */
-			copy_v3_v3(tmat[3], offs_bone[3]);
-			zero_v3(offs_bone[3]);
-			mul_m4_v3(pchan->parent->pose_mat, tmat[3]);
-
-			mult_m4_m4m4(diff_mat, tmat, offs_bone);
-		}
-		else {
-			/* pose_mat = par_pose_mat * bone_mat * chan_mat */
-			if (pchan->bone->flag & BONE_NO_SCALE) {
-				float tmat[4][4];
-				copy_m4_m4(tmat, pchan->parent->pose_mat);
-				normalize_m4(tmat);
-				mult_m4_m4m4(diff_mat, tmat, offs_bone);
-			}
-			else {
-				mult_m4_m4m4(diff_mat, pchan->parent->pose_mat, offs_bone);
-			}
-		}
-	}
-	else {
-		/* pose_mat = chan_mat * arm_mat */
-		copy_m4_m4(diff_mat, pchan->bone->arm_mat);
-	}
-}
-#endif
-
 /* This function is responsible for the correct transformations/conversions 
  * of a matrix from one space to another for constraint evaluation.
  * For now, this is only implemented for Objects and PoseChannels.
@@ -307,18 +256,6 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
 				else if (to == CONSTRAINT_SPACE_LOCAL) {
 					if (pchan->bone) {
 						BKE_armature_mat_pose_to_bone(pchan, mat, mat);
-#if 0  /* XXX Old code, will remove it later. */
-						constraint_pchan_diff_mat(pchan, diff_mat);
-
-						invert_m4_m4(imat, diff_mat);
-						mult_m4_m4m4(mat, imat, mat);
-
-						/* override with local location */
-						if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
-							BKE_armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat);
-							copy_v3_v3(mat[3], tempmat[3]);
-						}
-#endif
 					}
 				}
 				/* pose to local with parent */
@@ -336,24 +273,19 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
 				if (pchan->bone) {
 					/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
 					BKE_armature_mat_bone_to_pose(pchan, mat, mat);
-#if 0
-					constraint_pchan_diff_mat(pchan, diff_mat);
-
-					mult_m4_m4m4(mat, diff_mat, mat);
-#endif
 				}
 				
 				/* use pose-space as stepping stone for other spaces */
 				if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL)) {
 					/* call self with slightly different values */
 					constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
-				}				
+				}
 			}
 			break;
 			case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */
 			{
 				/* local + parent to pose */
-				if (pchan->bone) {					
+				if (pchan->bone) {
 					copy_m4_m4(diff_mat, pchan->bone->arm_mat);
 					mult_m4_m4m4(mat, mat, diff_mat);
 				}
@@ -432,7 +364,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
 	/* get DerivedMesh */
 	if (em) {
 		/* target is in editmode, so get a special derived mesh */
-		dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
+		dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 		freeDM = 1;
 	}
 	else {
@@ -604,15 +536,15 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
 				float tempmat[4][4], loc[3];
 				
 				/* interpolate along length of bone */
-				interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail);	
+				interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail);
 				
 				/* use interpolated distance for subtarget */
-				copy_m4_m4(tempmat, pchan->pose_mat);	
+				copy_m4_m4(tempmat, pchan->pose_mat);
 				copy_v3_v3(tempmat[3], loc);
 				
 				mult_m4_m4m4(mat, ob->obmat, tempmat);
 			}
-		} 
+		}
 		else
 			copy_m4_m4(mat, ob->obmat);
 			
@@ -976,11 +908,11 @@ static void vectomat(const float vec[3], const float target_up[3], short axis, s
 	else negate_v3(n);
 
 	/* n specifies the transformation of the track axis */
-	if (flags & TARGET_Z_UP) { 
+	if (flags & TARGET_Z_UP) {
 		/* target Z axis is the global up axis */
 		copy_v3_v3(u, target_up);
 	}
-	else { 
+	else {
 		/* world Z axis is the global up axis */
 		u[0] = 0;
 		u[1] = 0;
@@ -1034,7 +966,7 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
 		/* Get size property, since ob->size is only the object's own relative size, not its global one */
 		mat4_to_size(size, cob->matrix);
 		
-		/* Clear the object's rotation */ 	
+		/* Clear the object's rotation */
 		cob->matrix[0][0] = size[0];
 		cob->matrix[0][1] = 0;
 		cob->matrix[0][2] = 0;
@@ -1468,7 +1400,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U
 	
 	if (data->flag & LIMIT_XMIN) {
 		if (size[0] < data->xmin) 
-			size[0] = data->xmin;	
+			size[0] = data->xmin;
 	}
 	if (data->flag & LIMIT_XMAX) {
 		if (size[0] > data->xmax) 
@@ -1476,7 +1408,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U
 	}
 	if (data->flag & LIMIT_YMIN) {
 		if (size[1] < data->ymin) 
-			size[1] = data->ymin;	
+			size[1] = data->ymin;
 	}
 	if (data->flag & LIMIT_YMAX) {
 		if (size[1] > data->ymax) 
@@ -1484,7 +1416,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U
 	}
 	if (data->flag & LIMIT_ZMIN) {
 		if (size[2] < data->zmin) 
-			size[2] = data->zmin;	
+			size[2] = data->zmin;
 	}
 	if (data->flag & LIMIT_ZMAX) {
 		if (size[2] > data->zmax) 
@@ -2002,7 +1934,7 @@ static void pycon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTa
 			
 			/* this check is to make sure curve objects get updated on file load correctly.*/
 			if (cu->path == NULL || cu->path->data == NULL) /* only happens on reload file, but violates depsgraph still... fix! */
-				BKE_displist_make_curveTypes(cob->scene, ct->tar, 0);				
+				BKE_displist_make_curveTypes(cob->scene, ct->tar, 0);
 		}
 		
 		/* firstly calculate the matrix the normal way, then let the py-function override
@@ -2764,7 +2696,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 			default: /* should not happen, but in case*/
 				return;
 		} /* switch (data->volmode) */
-
+		
 		/* Clear the object's rotation and scale */
 		cob->matrix[0][0] = size[0] * scale[0];
 		cob->matrix[0][1] = 0;
@@ -2787,10 +2719,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 				/* othogonal to "new Y" "old X! plane */
 				cross_v3_v3v3(orth, vec, xx);
 				normalize_v3(orth);
-
+				
 				/* new Z*/
 				copy_v3_v3(totmat[2], orth);
-
+				
 				/* we decided to keep X plane*/
 				cross_v3_v3v3(xx, orth, vec);
 				normalize_v3_v3(totmat[0], xx);
@@ -2800,16 +2732,16 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 				/* othogonal to "new Y" "old Z! plane */
 				cross_v3_v3v3(orth, vec, zz);
 				normalize_v3(orth);
-
+				
 				/* new X */
 				negate_v3_v3(totmat[0], orth);
-
+				
 				/* we decided to keep Z */
 				cross_v3_v3v3(zz, orth, vec);
 				normalize_v3_v3(totmat[2], zz);
 				break;
 		} /* switch (data->plane) */
-
+		
 		mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
 	}
 }
@@ -2937,7 +2869,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
 			if (data->flag & MINMAX_STICKY) {
 				if (data->flag & MINMAX_STUCK) {
 					copy_v3_v3(obmat[3], data->cache);
-				} 
+				}
 				else {
 					copy_v3_v3(data->cache, obmat[3]);
 					data->flag |= MINMAX_STUCK;
@@ -2947,11 +2879,11 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
 				/* get out of localspace */
 				mult_m4_m4m4(tmat, ct->matrix, obmat);
 				copy_m4_m4(cob->matrix, tmat);
-			} 
-			else {			
+			}
+			else {
 				copy_v3_v3(cob->matrix[3], obmat[3]);
 			}
-		} 
+		}
 		else {
 			data->flag &= ~MINMAX_STUCK;
 		}
@@ -3291,7 +3223,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 		/* extract components of owner's matrix */
 		copy_v3_v3(loc, cob->matrix[3]);
 		mat4_to_eulO(eul, cob->rotOrder, cob->matrix);
-		mat4_to_size(size, cob->matrix);	
+		mat4_to_size(size, cob->matrix);
 		
 		/* determine where in range current transforms lie */
 		if (data->expo) {
@@ -3615,7 +3547,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 		cross_v3_v3v3(raxis, obvec, tarvec);
 		
 		rangle = dot_v3v3(obvec, tarvec);
-		rangle = acos(maxf(-1.0f, minf(1.0f, rangle)));
+		rangle = acos(max_ff(-1.0f, min_ff(1.0f, rangle)));
 		
 		/* construct rotation matrix from the axis-angle rotation found above 
 		 *	- this call takes care to make sure that the axis provided is a unit vector first
@@ -4663,7 +4595,7 @@ short proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
 		else {
 			/* FIXME: constraints on object-level are not handled well yet */
 			return 1;
-		}	
+		}
 	}
 	
 	return 0;
@@ -4703,7 +4635,7 @@ void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n,
 					unit_m4(cob->matrix);
 					unit_m4(cob->startmat);
 				}
-			}	
+			}
 			break;
 			case CONSTRAINT_OBTYPE_BONE: /* this may occur in some cases */
 			{
@@ -4839,7 +4771,7 @@ void solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
 		 *    since some constraints may not convert the solution back to the input space before blending
 		 *    but all are guaranteed to end up in good "worldspace" result
 		 */
-		/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka */
+		/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka (r.32105) */
 		if (enf < 1.0f) {
 			float solution[4][4];
 			copy_m4_m4(solution, cob->matrix);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index be81c70..ffb9313 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -44,6 +44,7 @@
 
 #include "BLI_listbase.h"
 #include "BLI_string.h"
+#include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -234,9 +235,8 @@ struct bContextDataResult {
 static void *ctx_wm_python_context_get(const bContext *C, const char *member, void *fall_through)
 {
 #ifdef WITH_PYTHON
-	bContextDataResult result;
-
-	if (C && CTX_py_dict_get(C)) {
+	if (UNLIKELY(C && CTX_py_dict_get(C))) {
+		bContextDataResult result;
 		memset(&result, 0, sizeof(bContextDataResult));
 		BPY_context_member_get((bContext *)C, member, &result);
 		if (result.ptr.data)
@@ -246,6 +246,10 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo
 	(void)C, (void)member;
 #endif
 
+	/* don't allow UI context access from non-main threads */
+	if (!BLI_thread_is_main())
+		return NULL;
+
 	return fall_through;
 }
 
@@ -265,6 +269,11 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
 //			return 1;
 	}
 #endif
+
+	/* don't allow UI context access from non-main threads */
+	if (!BLI_thread_is_main())
+		return done;
+
 	/* we check recursion to ensure that we do not get infinite
 	 * loops requesting data from ourselfs in a context callback */
 
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 0bda3b2..754a4fb 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -820,8 +820,8 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
 	/* this is for float inaccuracy */
 	if (t < knots[0])
 		t = knots[0];
-	else
-		if (t > knots[opp2]) t = knots[opp2];
+	else if (t > knots[opp2]) 
+		t = knots[opp2];
 
 	/* this part is order '1' */
 	o2 = order + 1;
@@ -1050,10 +1050,13 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
 	MEM_freeN(jend);
 }
 
+/**
+ * \param coord_array Has to be 3 * 4 * pntsu * resolu in size and zero-ed
+ * \param tilt_array   set when non-NULL
+ * \param radius_array set when non-NULL
+ */
 void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array,
                         int resolu, int stride)
-/* coord_array has to be 3*4*pntsu*resolu in size and zero-ed
- * tilt_array and radius_array will be written to if valid */
 {
 	BPoint *bp;
 	float u, ustart, uend, ustep, sumdiv;
@@ -1113,13 +1116,13 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
 			*fp = basisu[i] * bp->vec[3];
 			sumdiv += *fp;
 		}
-		if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
-				/* is normalizing needed? */
-				fp = sum;
-				for (i = istart; i <= iend; i++, fp++) {
-					*fp /= sumdiv;
-				}
+		if ((sumdiv != 0.0f) && (sumdiv < 0.999f || sumdiv > 1.001f)) {
+			/* is normalizing needed? */
+			fp = sum;
+			for (i = istart; i <= iend; i++, fp++) {
+				*fp /= sumdiv;
 			}
+		}
 
 		/* one! (1.0) real point */
 		fp = sum;
@@ -1476,7 +1479,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
 		}
 	}
 	else if (cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
-		;
+		/* pass */
 	}
 	else if (cu->ext2 == 0.0f) {
 		dl = MEM_callocN(sizeof(DispList), "makebevelcurve2");
@@ -1945,7 +1948,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
 
 		if (bl->poly == -1) { /* check its not cyclic */
 			/* skip the first point */
-			/* bevp0= bevp1; */
+			/* bevp0 = bevp1; */
 			bevp1 = bevp2;
 			bevp2++;
 			nr--;
@@ -1974,7 +1977,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
 			interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5);
 			normalize_qt(bevp1->quat);
 
-			/* bevp0= bevp1; */ /* UNUSED */
+			/* bevp0 = bevp1; */ /* UNUSED */
 			bevp1 = bevp2;
 			bevp2++;
 		}
@@ -2109,7 +2112,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 	BevPoint *bevp2, *bevp1, *bevp0; /* standard for all make_bevel_list_3D_* funcs */
 	int nr;
 
-	float bevp0_tan[3], cross_tmp[3];
+	float bevp0_tan[3];
 
 	bevel_list_calc_bisect(bl);
 	if (bl->poly == -1) /* check its not cyclic */
@@ -2123,6 +2126,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 
 	nr = bl->nr;
 	while (nr--) {
+		float cross_tmp[3];
 		cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
 		cross_v3_v3v3(bevp1->tan, cross_tmp, bevp1->dir);
 		normalize_v3(bevp1->tan);
@@ -2150,7 +2154,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 		normalize_v3(cross_tmp);
 		tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX - could be faster */
 
-		/* bevp0= bevp1; */ /* UNUSED */
+		/* bevp0 = bevp1; */ /* UNUSED */
 		bevp1 = bevp2;
 		bevp2++;
 	}
@@ -2477,8 +2481,8 @@ void BKE_curve_bevelList_make(Object *ob)
 				else
 					bevp2 = bevp1 + 1;
 
-				inp = (bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) +
-						(bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0]);
+				inp = ((bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) +
+				       (bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0]));
 
 				if (inp > 0.0f)
 					sd->dir = 1;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index efcc00c..b2f8db0 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -65,11 +65,20 @@
 /* number of layers to add when growing a CustomData object */
 #define CUSTOMDATA_GROW 5
 
+/* ensure typemap size is ok */
+BLI_STATIC_ASSERT(sizeof(((CustomData *)NULL)->typemap) /
+                  sizeof(((CustomData *)NULL)->typemap[0]) == CD_NUMTYPES,
+                  "size mismatch");
+
+
 /********************* Layer type information **********************/
 typedef struct LayerTypeInfo {
 	int size;          /* the memory size of one element of this layer's data */
-	const char *structname;  /* name of the struct used, for file writing */
-	int structnum;     /* number of structs per element, for file writing */
+
+	/** name of the struct used, for file writing */
+	const char *structname;
+	/** number of structs per element, for file writing */
+	int structnum;
 
 	/**
 	 * default layer name.
@@ -752,7 +761,7 @@ static void layerDoMinMax_mloopuv(void *data, void *vmin, void *vmax)
 {
 	MLoopUV *min = vmin, *max = vmax, *luv = data;
 
-	DO_MINMAX2(luv->uv, min->uv, max->uv);
+	minmax_v2v2_v2(min->uv, max->uv, luv->uv);
 }
 
 static void layerAdd_mloopuv(void *data1, void *data2)
@@ -824,7 +833,7 @@ static void layerDoMinMax_mloop_origspace(void *data, void *vmin, void *vmax)
 {
 	OrigSpaceLoop *min = vmin, *max = vmax, *luv = data;
 
-	DO_MINMAX2(luv->uv, min->uv, max->uv);
+	minmax_v2v2_v2(min->uv, max->uv, luv->uv);
 }
 
 static void layerAdd_mloop_origspace(void *data1, void *data2)
@@ -1055,8 +1064,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	/* 8: CD_NORMAL */
 	/* 3 floats per normal vector */
 	{sizeof(float) * 3, "vec3f", 1, NULL, NULL, NULL, NULL, NULL, NULL},
-	/* 9: CD_POLYINDEX */
-	{sizeof(int), "MIntProperty", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+	/* 9: CD_POLYINDEX (deprecated) */
+	{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 10: CD_PROP_FLT */
 	{sizeof(MFloatProperty), "MFloatProperty", 1, "Float", layerCopy_propFloat, NULL, NULL, NULL},
 	/* 11: CD_PROP_INT */
@@ -1076,7 +1085,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	 layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, 
 	 layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv},
 	/* 17: CD_MLOOPCOL */
-	{sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, 
+	{sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL,
 	 layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, 
 	 layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
 	/* 18: CD_TANGENT */
@@ -1174,7 +1183,7 @@ const CustomDataMask CD_MASK_DERIVEDMESH =
     CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_PREVIEW_MLOOPCOL |
     CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORCO | CD_MASK_TANGENT |
     CD_MASK_PREVIEW_MCOL | CD_MASK_NORMAL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
-    CD_MASK_ORIGINDEX | CD_MASK_POLYINDEX | CD_MASK_MVERT_SKIN;
+    CD_MASK_ORIGINDEX | CD_MASK_MVERT_SKIN;
 const CustomDataMask CD_MASK_BMESH =
     CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY |
     CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
@@ -1221,9 +1230,6 @@ void CustomData_update_typemap(CustomData *data)
 {
 	int i, lasttype = -1;
 
-	/* since we cant do in a pre-processor do here as an assert */
-	BLI_assert(sizeof(data->typemap) / sizeof(int) >= CD_NUMTYPES);
-
 	for (i = 0; i < CD_NUMTYPES; i++) {
 		data->typemap[i] = -1;
 	}
@@ -1236,6 +1242,13 @@ void CustomData_update_typemap(CustomData *data)
 	}
 }
 
+static int customdata_typemap_is_valid(const CustomData *data)
+{
+	CustomData data_copy = *data;
+	CustomData_update_typemap(&data_copy);
+	return (memcmp(data->typemap, data_copy.typemap, sizeof(data->typemap)) == 0);
+}
+
 void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
                       CustomDataMask mask, int alloctype, int totelem)
 {
@@ -1301,7 +1314,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
                      CustomDataMask mask, int alloctype, int totelem)
 {
-	memset(dest, 0, sizeof(*dest));
+	CustomData_reset(dest);
 
 	if (source->external)
 		dest->external = MEM_dupallocN(source->external);
@@ -1332,6 +1345,12 @@ static void CustomData_external_free(CustomData *data)
 	}
 }
 
+void CustomData_reset(CustomData *data)
+{
+	memset(data, 0, sizeof(*data));
+	fill_vn_i(data->typemap, CD_NUMTYPES, -1);
+}
+
 void CustomData_free(CustomData *data, int totelem)
 {
 	int i;
@@ -1343,8 +1362,7 @@ void CustomData_free(CustomData *data, int totelem)
 		MEM_freeN(data->layers);
 	
 	CustomData_external_free(data);
-	
-	memset(data, 0, sizeof(*data));
+	CustomData_reset(data);
 }
 
 static void customData_update_offsets(CustomData *data)
@@ -1363,9 +1381,10 @@ static void customData_update_offsets(CustomData *data)
 	CustomData_update_typemap(data);
 }
 
-int CustomData_get_layer_index(const CustomData *data, int type)
+/* to use when we're in the middle of modifying layers */
+static int CustomData_get_layer_index__notypemap(const CustomData *data, int type)
 {
-	int i; 
+	int i;
 
 	for (i = 0; i < data->totlayer; ++i)
 		if (data->layers[i].type == type)
@@ -1374,11 +1393,21 @@ int CustomData_get_layer_index(const CustomData *data, int type)
 	return -1;
 }
 
+/* -------------------------------------------------------------------- */
+/* index values to access the layers (offset from the layer start) */
+
+int CustomData_get_layer_index(const CustomData *data, int type)
+{
+	BLI_assert(customdata_typemap_is_valid(data));
+	return data->typemap[type];
+}
+
 int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
 {
 	int i = CustomData_get_layer_index(data, type);
 
 	if (i != -1) {
+		BLI_assert(i + n < data->totlayer);
 		i = (data->layers[i + n].type == type) ? (i + n) : (-1);
 	}
 
@@ -1398,91 +1427,62 @@ int CustomData_get_named_layer_index(const CustomData *data, int type, const cha
 
 int CustomData_get_active_layer_index(const CustomData *data, int type)
 {
-	if (!data->totlayer)
-		return -1;
-
-	if (data->typemap[type] != -1) {
-		return data->typemap[type] + data->layers[data->typemap[type]].active;
-	}
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? layer_index + data->layers[layer_index].active: -1;
 }
 
 int CustomData_get_render_layer_index(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return i + data->layers[i].active_rnd;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? layer_index + data->layers[layer_index].active_rnd : -1;
 }
 
 int CustomData_get_clone_layer_index(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return i + data->layers[i].active_clone;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? layer_index + data->layers[layer_index].active_clone : -1;
 }
 
 int CustomData_get_stencil_layer_index(const CustomData *data, int type)
 {
-	int i;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? layer_index + data->layers[layer_index].active_mask : -1;
+}
 
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return i + data->layers[i].active_mask;
 
-	return -1;
-}
+/* -------------------------------------------------------------------- */
+/* index values per layer type */
 
 int CustomData_get_active_layer(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return data->layers[i].active;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? data->layers[layer_index].active : -1;
 }
 
 int CustomData_get_render_layer(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return data->layers[i].active_rnd;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? data->layers[layer_index].active_rnd : -1;
 }
 
 int CustomData_get_clone_layer(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return data->layers[i].active_clone;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? data->layers[layer_index].active_clone : -1;
 }
 
 int CustomData_get_stencil_layer(const CustomData *data, int type)
 {
-	int i;
-
-	for (i = 0; i < data->totlayer; ++i)
-		if (data->layers[i].type == type)
-			return data->layers[i].active_mask;
-
-	return -1;
+	const int layer_index = data->typemap[type];
+	BLI_assert(customdata_typemap_is_valid(data));
+	return (layer_index != -1) ? data->layers[layer_index].active_mask : -1;
 }
 
 void CustomData_set_layer_active(CustomData *data, int type, int n)
@@ -1713,7 +1713,7 @@ int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
 
 	/* if layer was last of type in array, set new active layer */
 	if ((index >= data->totlayer) || (data->layers[index].type != type)) {
-		i = CustomData_get_layer_index(data, type);
+		i = CustomData_get_layer_index__notypemap(data, type);
 		
 		if (i >= 0)
 			for (; i < data->totlayer && data->layers[i].type == type; i++) {
@@ -1728,7 +1728,6 @@ int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
 		customData_resize(data, -CUSTOMDATA_GROW);
 
 	customData_update_offsets(data);
-	CustomData_update_typemap(data);
 
 	return 1;
 }
@@ -2358,7 +2357,9 @@ void CustomData_bmesh_free_block(CustomData *data, void **block)
 	const LayerTypeInfo *typeInfo;
 	int i;
 
-	if (!*block) return;
+	if (*block == NULL)
+		return;
+
 	for (i = 0; i < data->totlayer; ++i) {
 		if (!(data->layers[i].flag & CD_FLAG_NOFREE)) {
 			typeInfo = layerType_getInfo(data->layers[i].type);
@@ -2394,7 +2395,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
 	const LayerTypeInfo *typeInfo;
 	int dest_i, src_i;
 
-	if (!*dest_block) {
+	if (*dest_block == NULL) {
 		CustomData_bmesh_alloc_block(dest, dest_block);
 		if (*dest_block)
 			memset(*dest_block, 0, dest->totsize);
@@ -2475,10 +2476,49 @@ int CustomData_layer_has_math(struct CustomData *data, int layer_n)
 	if (typeInfo->equal && typeInfo->add && typeInfo->multiply && 
 	    typeInfo->initminmax && typeInfo->dominmax)
 	{
-		return 1;
+		return TRUE;
 	}
 	
-	return 0;
+	return FALSE;
+}
+
+int CustomData_layer_has_interp(struct CustomData *data, int layer_n)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
+
+	if (typeInfo->interp) {
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+int CustomData_has_math(struct CustomData *data)
+{
+	int i;
+
+	/* interpolates a layer at a time */
+	for (i = 0; i < data->totlayer; ++i) {
+		if (CustomData_layer_has_math(data, i)) {
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+int CustomData_has_interp(struct CustomData *data)
+{
+	int i;
+
+	/* interpolates a layer at a time */
+	for (i = 0; i < data->totlayer; ++i) {
+		if (CustomData_layer_has_interp(data, i)) {
+			return TRUE;
+		}
+	}
+
+	return FALSE;
 }
 
 /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
@@ -2578,8 +2618,8 @@ void CustomData_bmesh_set_layer_n(CustomData *data, void *block, int n, void *so
 		memcpy(dest, source, typeInfo->size);
 }
 
-void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights,
-                             float *sub_weights, int count, void *dest_block)
+void CustomData_bmesh_interp(CustomData *data, void **src_blocks, const float *weights,
+                             const float *sub_weights, int count, void *dest_block)
 {
 	int i, j;
 	void *source_buf[SOURCE_BUF_SIZE];
@@ -2614,7 +2654,7 @@ void CustomData_bmesh_set_default(CustomData *data, void **block)
 	const LayerTypeInfo *typeInfo;
 	int i;
 
-	if (!*block)
+	if (*block == NULL)
 		CustomData_bmesh_alloc_block(data, block);
 
 	for (i = 0; i < data->totlayer; ++i) {
@@ -2634,7 +2674,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
 	const LayerTypeInfo *typeInfo;
 	int dest_i, src_i, src_offset;
 
-	if (!*dest_block)
+	if (*dest_block == NULL)
 		CustomData_bmesh_alloc_block(dest, dest_block);
 	
 	/* copies a layer at a time */
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 4110d45..7c13ca3 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -278,7 +278,7 @@ void defvert_normalize_lock_map(MDeformVert *dvert, const char *lock_flags, cons
 			}
 		}
 
-		lock_iweight = maxf(0.0f, 1.0f - lock_iweight);
+		lock_iweight = max_ff(0.0f, 1.0f - lock_iweight);
 
 		if (tot_weight > 0.0f) {
 			/* paranoid, should be 1.0 but in case of float error clamp anyway */
@@ -431,7 +431,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
 		if (strcmp(name, dg->name)) {
 			flip_num = defgroup_name_index(ob, name);
 
-			if (flip_num >= 0) {
+			if (flip_num != -1) {
 				map[defgroup] = flip_num;
 				map[flip_num] = defgroup;
 			}
@@ -790,3 +790,23 @@ void defvert_clear(MDeformVert *dvert)
 
 	dvert->totweight = 0;
 }
+
+/**
+ * \return The first group index shared by both deform verts
+ * or -1 if none are found.
+ */
+int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b)
+{
+	if (dvert_a->totweight && dvert_b->totweight) {
+		MDeformWeight *dw = dvert_a->dw;
+		unsigned int i;
+
+		for (i = dvert_a->totweight; i != 0; i--, dw++) {
+			if (dw->weight > 0.0f && defvert_find_weight(dvert_b, dw->def_nr) > 0.0f) {
+				return dw->def_nr;
+			}
+		}
+	}
+
+	return -1;
+}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 31a6f76..3ed7593 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -45,6 +45,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_group_types.h"
+#include "DNA_lamp_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_key_types.h"
 #include "DNA_material_types.h"
@@ -150,8 +151,8 @@ void queue_delete(DagNodeQueue *queue)
 		MEM_freeN(temp);
 	}
 	
-	MEM_freeN(queue->freenodes);			
-	MEM_freeN(queue);			
+	MEM_freeN(queue->freenodes);
+	MEM_freeN(queue);
 }
 
 /* insert in queue, remove in front */
@@ -190,8 +191,8 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
 		}
 		queue->freenodes->count = DAGQUEUEALLOC;
 			
-		elem = queue->freenodes->first;	
-		queue->freenodes->first = elem->next;	
+		elem = queue->freenodes->first;
+		queue->freenodes->first = elem->next;
 	}
 	elem->next = NULL;
 	elem->node = node;
@@ -211,7 +212,7 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
 	DagNodeQueueElem *elem;
 	int i;
 
-	elem = queue->freenodes->first;	
+	elem = queue->freenodes->first;
 	if (elem != NULL) {
 		queue->freenodes->first = elem->next;
 		if (queue->freenodes->last == elem) {
@@ -235,8 +236,8 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
 		}
 		queue->freenodes->count = DAGQUEUEALLOC;
 			
-		elem = queue->freenodes->first;	
-		queue->freenodes->first = elem->next;	
+		elem = queue->freenodes->first;
+		queue->freenodes->first = elem->next;
 	}
 	elem->next = queue->first;
 	elem->node = node;
@@ -302,7 +303,7 @@ DagForest *dag_init(void)
 }
 
 /* isdata = object data... */
-// XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)...
+/* XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)... */
 static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node, int isdata)
 {
 	FCurve *fcu;
@@ -350,8 +351,8 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
 /* XXX: forward def for material driver handling... */
 static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma);
 
-/* recursive handling for material nodetree drivers */
-static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *node, bNodeTree *ntree)
+/* recursive handling for shader nodetree drivers */
+static void dag_add_shader_nodetree_driver_relations(DagForest *dag, DagNode *node, bNodeTree *ntree)
 {
 	bNode *n;
 
@@ -367,7 +368,7 @@ static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *
 				dag_add_material_driver_relations(dag, node, (Material *)n->id);
 			}
 			else if (n->type == NODE_GROUP) {
-				dag_add_material_nodetree_driver_relations(dag, node, (bNodeTree *)n->id);
+				dag_add_shader_nodetree_driver_relations(dag, node, (bNodeTree *)n->id);
 			}
 		}
 	}
@@ -386,21 +387,44 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
 		ma->id.flag |= LIB_DOIT;
 	
 	/* material itself */
-	if (ma->adt) {
+	if (ma->adt)
 		dag_add_driver_relation(ma->adt, dag, node, 1);
-	}
 
 	/* textures */
 	// TODO...
 	//dag_add_texture_driver_relations(DagForest *dag, DagNode *node, ID *id);
 
 	/* material's nodetree */
-	if (ma->nodetree) {
-		dag_add_material_nodetree_driver_relations(dag, node, ma->nodetree);
-	}
+	if (ma->nodetree)
+		dag_add_shader_nodetree_driver_relations(dag, node, ma->nodetree);
 }
 
-static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node)
+/* recursive handling for lamp drivers */
+static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *la)
+{
+	/* Prevent infinite recursion by checking (and tagging the lamp) as having been visited 
+	 * already (see build_dag()). This assumes la->id.flag & LIB_DOIT isn't set by anything else
+	 * in the meantime... [#32017]
+	 */
+	if (la->id.flag & LIB_DOIT)
+		return;
+	else
+		la->id.flag |= LIB_DOIT;
+	
+	/* lamp itself */
+	if (la->adt)
+		dag_add_driver_relation(la->adt, dag, node, 1);
+
+	/* textures */
+	// TODO...
+	//dag_add_texture_driver_relations(DagForest *dag, DagNode *node, ID *id);
+
+	/* lamp's nodetree */
+	if (la->nodetree)
+		dag_add_shader_nodetree_driver_relations(dag, node, la->nodetree);
+}
+
+static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node, int skip_forcefield)
 {
 	Base *base;
 	DagNode *node2;
@@ -411,7 +435,9 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
 		if ((base->lay & ob->lay) && base->object->pd) {
 			Object *ob1 = base->object;
 			if ((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
-				node2 = dag_get_node(dag, ob1);					
+				if (skip_forcefield && ob1->pd->forcefield == skip_forcefield)
+					continue;
+				node2 = dag_get_node(dag, ob1);
 				dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Collision");
 			}
 		}
@@ -443,7 +469,6 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	if (ob->type == OB_ARMATURE) {
 		if (ob->pose) {
 			bPoseChannel *pchan;
-			bConstraint *con;
 			
 			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 				for (con = pchan->constraints.first; con; con = con->next) {
@@ -464,7 +489,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 									if (ct->tar->type == OB_MESH)
 										node3->customdata_mask |= CD_MASK_MDEFORMVERT;
 								}
-								else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) 	
+								else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK))
 									dag_add_relation(dag, node3, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, cti->name);
 								else
 									dag_add_relation(dag, node3, node, DAG_RL_OB_DATA, cti->name);
@@ -570,12 +595,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	/* softbody collision  */
 	if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_LATTICE)) {
 		if (ob->particlesystem.first ||
-			modifiers_isModifierEnabled(ob, eModifierType_Softbody) ||
-			modifiers_isModifierEnabled(ob, eModifierType_Cloth) ||
-			modifiers_isModifierEnabled(ob, eModifierType_Smoke) ||
-			modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint))
+		    modifiers_isModifierEnabled(ob, eModifierType_Softbody) ||
+		    modifiers_isModifierEnabled(ob, eModifierType_Cloth) ||
+		    modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint))
 		{
-			dag_add_collision_field_relation(dag, scene, ob, node);  /* TODO: use effectorweight->group */
+			dag_add_collision_field_relation(dag, scene, ob, node, 0);  /* TODO: use effectorweight->group */
+		}
+		else if (modifiers_isModifierEnabled(ob, eModifierType_Smoke)) {
+			dag_add_collision_field_relation(dag, scene, ob, node, PFIELD_SMOKEFLOW);
 		}
 	}
 	
@@ -604,7 +631,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 			
 			if (mom != ob) {
 				node2 = dag_get_node(dag, mom);
-				dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball");  // mom depends on children!
+				dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball");  /* mom depends on children! */
 			}
 		}
 		break;
@@ -644,6 +671,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 			}
 		}
 	}
+	else if (ob->type == OB_LAMP) {
+		dag_add_lamp_driver_relations(dag, node, ob->data);
+	}
 	
 	/* particles */
 	psys = ob->particlesystem.first;
@@ -814,9 +844,10 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 	
 	/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later [#32017] */
 	tag_main_idcode(bmain, ID_MA, FALSE);
+	tag_main_idcode(bmain, ID_LA, FALSE);
 	
 	/* add base node for scene. scene is always the first node in DAG */
-	scenenode = dag_add_node(dag, sce);	
+	scenenode = dag_add_node(dag, sce);
 	
 	/* add current scene objects */
 	for (base = sce->base.first; base; base = base->next) {
@@ -870,7 +901,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 	}
 	
 	/* cycle detection and solving */
-	// solve_cycles(dag);	
+	// solve_cycles(dag);
 	
 	return dag;
 }
@@ -879,23 +910,23 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 void free_forest(DagForest *Dag) 
 {  /* remove all nodes and deps */
 	DagNode *tempN;
-	DagAdjList *tempA;	
+	DagAdjList *tempA;
 	DagAdjList *itA;
 	DagNode *itN = Dag->DagNode.first;
 	
 	while (itN) {
-		itA = itN->child;	
+		itA = itN->child;
 		while (itA) {
 			tempA = itA;
 			itA = itA->next;
-			MEM_freeN(tempA);			
+			MEM_freeN(tempA);
 		}
 		
-		itA = itN->parent;	
+		itA = itN->parent;
 		while (itA) {
 			tempA = itA;
 			itA = itA->next;
-			MEM_freeN(tempA);			
+			MEM_freeN(tempA);
 		}
 		
 		tempN = itN;
@@ -919,8 +950,8 @@ DagNode *dag_find_node(DagForest *forest, void *fob)
 	return NULL;
 }
 
-static int ugly_hack_sorry = 1;  // prevent type check
-static int dag_print_dependencies = 0; // debugging
+static int ugly_hack_sorry = 1;         /* prevent type check */
+static int dag_print_dependencies = 0;  /* debugging */
 
 /* no checking of existence, use dag_find_node first or dag_get_node */
 DagNode *dag_add_node(DagForest *forest, void *fob)
@@ -932,7 +963,7 @@ DagNode *dag_add_node(DagForest *forest, void *fob)
 		node->ob = fob;
 		node->color = DAG_WHITE;
 
-		if (ugly_hack_sorry) node->type = GS(((ID *) fob)->name);   // sorry, done for pose sorting
+		if (ugly_hack_sorry) node->type = GS(((ID *) fob)->name);  /* sorry, done for pose sorting */
 		if (forest->numNodes) {
 			((DagNode *) forest->DagNode.last)->next = node;
 			forest->DagNode.last = node;
@@ -1151,7 +1182,7 @@ static void dag_check_cycle(DagForest *dag)
 	for (node = dag->DagNode.first; node; node = node->next) {
 		while (node->parent) {
 			itA = node->parent->next;
-			MEM_freeN(node->parent);			
+			MEM_freeN(node->parent);
 			node->parent = itA;
 		}
 	}
@@ -1240,7 +1271,7 @@ void graph_bfs(void)
 				itA = itA->next;
 			}
 			if (pos[node->BFS_dist] > node->k) {
-				pos[node->BFS_dist] += 1;				
+				pos[node->BFS_dist] += 1;
 				node->k = (float) pos[node->BFS_dist];
 			}
 			else {
@@ -1301,7 +1332,7 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
 					pre_func(node->ob, data);
 				}
 				
-				else { // back or cross edge
+				else {  /* back or cross edge */
 					retval = 1;
 				}
 				itA = itA->next;
@@ -1332,7 +1363,7 @@ DagNodeQueue *graph_dfs(void)
 	/* int	is_cycle = 0; */ /* UNUSED */
 	/*
 	 *fprintf(stderr, "starting DFS\n ------------\n");
-	 */	
+	 */
 	nqueue = queue_create(DAGQUEUEALLOC);
 	retqueue = queue_create(MainDag->numNodes);
 	for (i = 0; i < 50; i++)
@@ -1384,7 +1415,7 @@ DagNodeQueue *graph_dfs(void)
 						break;
 					}
 					else {
-						if (itA->node->color == DAG_GRAY) { // back edge
+						if (itA->node->color == DAG_GRAY) {  /* back edge */
 							fprintf(stderr, "dfs back edge :%15s %15s\n", ((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
 							/* is_cycle = 1; */ /* UNUSED */
 						}
@@ -1462,7 +1493,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 	int retval = 0;
 	/*
 	 * fprintf(stderr, "starting DFS\n ------------\n");
-	 */	
+	 */
 	nqueue = queue_create(DAGQUEUEALLOC);
 	
 	/* Init
@@ -1516,7 +1547,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 //						}
 					}
 					itA = itA->next;
-				}			
+				}
 				
 				if (!skip) {
 					node = pop_queue(nqueue);
@@ -1535,7 +1566,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 }
 
 
-// used to get the obs owning a datablock
+/* used to get the obs owning a datablock */
 DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
 {
 	DagNode *node, *node1;
@@ -1546,7 +1577,7 @@ DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
 	if (node == NULL) {
 		return NULL;
 	}
-	else if (node->ancestor_count == 1) { // simple case
+	else if (node->ancestor_count == 1) {  /* simple case */
 		nqueue = queue_create(1);
 		push_queue(nqueue, node);
 	}
@@ -1555,7 +1586,7 @@ DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
 		
 		node1 = dag->DagNode.first;
 		do {
-			if (node1->DFS_fntm > node->DFS_fntm) { // a parent is finished after child. must check adj list
+			if (node1->DFS_fntm > node->DFS_fntm) {  /* a parent is finished after child. must check adj list */
 				itA = node->child;
 				while (itA != NULL) {
 					if ((itA->node == node) && (itA->type == DAG_RL_DATA)) {
@@ -1583,7 +1614,7 @@ DagNodeQueue *get_first_ancestors(struct DagForest   *dag, void *ob)
 	
 	node1 = dag->DagNode.first;
 	do {
-		if (node1->DFS_fntm > node->DFS_fntm) { 
+		if (node1->DFS_fntm > node->DFS_fntm) {
 			itA = node->child;
 			while (itA != NULL) {
 				if (itA->node == node) {
@@ -1595,10 +1626,10 @@ DagNodeQueue *get_first_ancestors(struct DagForest   *dag, void *ob)
 		node1 = node1->next;
 	} while (node1);
 	
-	return nqueue;	
+	return nqueue;
 }
 
-// standard DFS list
+/* standard DFS list */
 DagNodeQueue *get_all_childs(struct DagForest    *dag, void *ob)
 {
 	DagNode *node;
@@ -1609,7 +1640,7 @@ DagNodeQueue *get_all_childs(struct DagForest    *dag, void *ob)
 	int skip = 0;
 
 	nqueue = queue_create(DAGQUEUEALLOC);
-	retqueue = queue_create(dag->numNodes); // was MainDag... why? (ton)
+	retqueue = queue_create(dag->numNodes);  /* was MainDag... why? (ton) */
 	
 	node = dag->DagNode.first;
 	while (node) {
@@ -1619,8 +1650,8 @@ DagNodeQueue *get_all_childs(struct DagForest    *dag, void *ob)
 	
 	time = 1;
 	
-	node = dag_find_node(dag, ob);   // could be done in loop above (ton)
-	if (node) { // can be null for newly added objects
+	node = dag_find_node(dag, ob);  /* could be done in loop above (ton) */
+	if (node) {                     /* can be null for newly added objects */
 		
 		node->color = DAG_GRAY;
 		time++;
@@ -1641,9 +1672,9 @@ DagNodeQueue *get_all_childs(struct DagForest    *dag, void *ob)
 					push_stack(nqueue, itA->node);
 					skip = 1;
 					break;
-				} 
+				}
 				itA = itA->next;
-			}			
+			}
 			
 			if (!skip) {
 				node = pop_queue(nqueue);
@@ -1671,7 +1702,7 @@ short   are_obs_related(struct DagForest    *dag, void *ob1, void *ob2)
 	while (itA != NULL) {
 		if (itA->node->ob == ob2) {
 			return itA->node->type;
-		} 
+		}
 		itA = itA->next;
 	}
 	return DAG_NO_RELATION;
@@ -1699,7 +1730,7 @@ void graph_print_queue(DagNodeQueue *nqueue)
 	queueElem = nqueue->first;
 	while (queueElem) {
 		fprintf(stderr, "** %s %i %i-%i ", ((ID *) queueElem->node->ob)->name, queueElem->node->color, queueElem->node->DFS_dvtm, queueElem->node->DFS_fntm);
-		queueElem = queueElem->next;		
+		queueElem = queueElem->next;
 	}
 	fprintf(stderr, "\n");
 }
@@ -1719,7 +1750,7 @@ void graph_print_queue_dist(DagNodeQueue *nqueue)
 		fputc('|', stderr);
 		fputc('\n', stderr);
 		count = 0;
-		queueElem = queueElem->next;		
+		queueElem = queueElem->next;
 	}
 	fprintf(stderr, "\n");
 }
@@ -1857,14 +1888,14 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 				push_stack(nqueue, itA->node);
 				skip = 1;
 				break;
-			} 
+			}
 			itA = itA->next;
-		}			
+		}
 		
 		if (!skip) {
 			if (node) {
 				node = pop_queue(nqueue);
-				if (node->ob == sce)    // we are done
+				if (node->ob == sce)  /* we are done */
 					break;
 				node->color = DAG_BLACK;
 				
@@ -1876,7 +1907,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 					BLI_remlink(&sce->base, base);
 					BLI_addhead(&tempbase, base);
 				}
-			}	
+			}
 		}
 	}
 	
@@ -1909,13 +1940,13 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 static void lib_id_recalc_tag(Main *bmain, ID *id)
 {
 	id->flag |= LIB_ID_RECALC;
-	bmain->id_tag_update[id->name[0]] = 1;
+	DAG_id_type_tag(bmain, GS(id->name));
 }
 
 static void lib_id_recalc_data_tag(Main *bmain, ID *id)
 {
 	id->flag |= LIB_ID_RECALC_DATA;
-	bmain->id_tag_update[id->name[0]] = 1;
+	DAG_id_type_tag(bmain, GS(id->name));
 }
 
 /* node was checked to have lasttime != curtime and is if type ID_OB */
@@ -2021,7 +2052,7 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
 	for (itA = node->child; itA; itA = itA->next) {
 		if (itA->node->type == ID_OB) {
 			if (itA->node->lasttime != curtime) {
-				itA->lay = flush_layer_node(sce, itA->node, curtime);  // lay is only set once for each relation
+				itA->lay = flush_layer_node(sce, itA->node, curtime);  /* lay is only set once for each relation */
 			}
 			else itA->lay = itA->node->lay;
 			
@@ -2069,12 +2100,12 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
 	Base *base;
 	int lasttime;
 
-	firstnode = sce->theDag->DagNode.first;  // always scene node
+	firstnode = sce->theDag->DagNode.first;  /* always scene node */
 
 	for (itA = firstnode->child; itA; itA = itA->next)
 		itA->lay = 0;
 
-	sce->theDag->time++;    // so we know which nodes were accessed
+	sce->theDag->time++;  /* so we know which nodes were accessed */
 	lasttime = sce->theDag->time;
 
 	/* update layer flags in nodes */
@@ -2146,13 +2177,13 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
 		DAG_scene_sort(bmain, sce);
 	}
 	
-	firstnode = sce->theDag->DagNode.first;  // always scene node
+	firstnode = sce->theDag->DagNode.first;  /* always scene node */
 
 	/* first we flush the layer flags */
 	dag_scene_flush_layers(sce, lay);
 
 	/* then we use the relationships + layer info to flush update events */
-	sce->theDag->time++;    // so we know which nodes were accessed
+	sce->theDag->time++;  /* so we know which nodes were accessed */
 	lasttime = sce->theDag->time;
 	for (itA = firstnode->child; itA; itA = itA->next)
 		if (itA->node->lasttime != lasttime && itA->node->type == ID_OB)
@@ -2160,7 +2191,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
 
 	/* if update is not due to time change, do pointcache clears */
 	if (!time) {
-		sce->theDag->time++;    // so we know which nodes were accessed
+		sce->theDag->time++;  /* so we know which nodes were accessed */
 		lasttime = sce->theDag->time;
 		for (itA = firstnode->child; itA; itA = itA->next) {
 			if (itA->node->lasttime != lasttime && itA->node->type == ID_OB) {
@@ -2378,7 +2409,7 @@ static void dag_object_time_update_flags(Object *ob)
 				}
 			}
 		}
-	}		
+	}
 
 	if (ob->recalc & OB_RECALC_OB)
 		lib_id_recalc_tag(G.main, &ob->id);
@@ -2787,6 +2818,7 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time)
 void DAG_ids_clear_recalc(Main *bmain)
 {
 	ListBase *lbarray[MAX_LIBARRAY];
+	bNodeTree *ntree;
 	int a;
 
 	/* loop over all ID types */
@@ -2799,9 +2831,15 @@ void DAG_ids_clear_recalc(Main *bmain)
 		/* we tag based on first ID type character to avoid 
 		 * looping over all ID's in case there are no tags */
 		if (id && bmain->id_tag_update[id->name[0]]) {
-			for (; id; id = id->next)
+			for (; id; id = id->next) {
 				if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA))
 					id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+
+				/* some ID's contain semi-datablock nodetree */
+				ntree = ntreeFromID(id);
+				if (ntree && (ntree->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)))
+					ntree->id.flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+			}
 		}
 	}
 
@@ -2868,8 +2906,18 @@ void DAG_id_tag_update(ID *id, short flag)
 	}
 }
 
-void DAG_id_type_tag(struct Main *bmain, short idtype)
+void DAG_id_type_tag(Main *bmain, short idtype)
 {
+	if (idtype == ID_NT) {
+		/* stupid workaround so parent datablocks of nested nodetree get looped
+		 * over when we loop over tagged datablock types */
+		DAG_id_type_tag(bmain, ID_MA);
+		DAG_id_type_tag(bmain, ID_TE);
+		DAG_id_type_tag(bmain, ID_LA);
+		DAG_id_type_tag(bmain, ID_WO);
+		DAG_id_type_tag(bmain, ID_SCE);
+	}
+
 	bmain->id_tag_update[((char *)&idtype)[0]] = 1;
 }
 
@@ -2928,9 +2976,9 @@ void DAG_pose_sort(Object *ob)
 	int skip = 0;
 	
 	dag = dag_init();
-	ugly_hack_sorry = 0; // no ID structs
+	ugly_hack_sorry = 0;  /* no ID structs */
 
-	rootnode = dag_add_node(dag, NULL); // node->ob becomes NULL
+	rootnode = dag_add_node(dag, NULL);  /* node->ob becomes NULL */
 	
 	/* we add the hierarchy and the constraints */
 	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -2975,7 +3023,7 @@ void DAG_pose_sort(Object *ob)
 									dag_add_relation(dag, node2, node3, 0, "IK Constraint");
 									
 									segcount++;
-									if (segcount == data->rootbone || segcount > 255) break;  // 255 is weak
+									if (segcount == data->rootbone || segcount > 255) break;  /* 255 is weak */
 									parchan = parchan->parent;
 								}
 							}
@@ -3018,21 +3066,21 @@ void DAG_pose_sort(Object *ob)
 				push_stack(nqueue, itA->node);
 				skip = 1;
 				break;
-			} 
+			}
 			itA = itA->next;
-		}			
+		}
 		
 		if (!skip) {
 			if (node) {
 				node = pop_queue(nqueue);
-				if (node->ob == NULL)   // we are done
+				if (node->ob == NULL)  /* we are done */
 					break;
 				node->color = DAG_BLACK;
 				
 				/* put node in new list */
 				BLI_remlink(&pose->chanbase, node->ob);
 				BLI_addhead(&tempbase, node->ob);
-			}	
+			}
 		}
 	}
 	
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 10c9f30..083cb02 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -487,7 +487,7 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
 		}
 
 		/* XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { */
-		if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, FALSE))) {
+		if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, BLI_SCANFILL_CALC_REMOVE_DOUBLES))) {
 			if (tot) {
 				dlnew = MEM_callocN(sizeof(DispList), "filldisplist");
 				dlnew->type = DL_INDEX3;
@@ -630,7 +630,7 @@ static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dis
  * - first point left, last point right
  * - based on subdivided points in original curve, not on points in taper curve (still)
  */
-float BKE_displist_calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
+static float displist_calc_taper(Scene *scene, Object *taperobj, float fac)
 {
 	DispList *dl;
 
@@ -643,7 +643,6 @@ float BKE_displist_calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
 		dl = taperobj->disp.first;
 	}
 	if (dl) {
-		float fac = ((float)cur) / (float)(tot - 1);
 		float minx, dx, *fp;
 		int a;
 
@@ -671,6 +670,13 @@ float BKE_displist_calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
 	return 1.0;
 }
 
+float BKE_displist_calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
+{
+	float fac = ((float)cur) / (float)(tot - 1);
+
+	return displist_calc_taper(scene, taperobj, fac);
+}
+
 void BKE_displist_make_mball(Scene *scene, Object *ob)
 {
 	if (!ob || ob->type != OB_MBALL)
@@ -1240,7 +1246,7 @@ void BKE_displist_make_surf(Scene *scene, Object *ob, ListBase *dispbase,
 	}
 }
 
-static void rotateBevelPiece(Curve *cu, BevPoint *bevp, DispList *dlb, float widfac, float fac, float **data_r)
+static void rotateBevelPiece(Curve *cu, BevPoint *bevp, BevPoint *nbevp, DispList *dlb, float bev_blend, float widfac, float fac, float **data_r)
 {
 	float *fp, *data = *data_r;
 	int b;
@@ -1248,22 +1254,48 @@ static void rotateBevelPiece(Curve *cu, BevPoint *bevp, DispList *dlb, float wid
 	fp = dlb->verts;
 	for (b = 0; b < dlb->nr; b++, fp += 3, data += 3) {
 		if (cu->flag & CU_3D) {
-			float vec[3];
+			float vec[3], quat[4];
 
 			vec[0] = fp[1] + widfac;
 			vec[1] = fp[2];
 			vec[2] = 0.0;
 
-			mul_qt_v3(bevp->quat, vec);
+			if (nbevp == NULL) {
+				copy_v3_v3(data, bevp->vec);
+				copy_qt_qt(quat, bevp->quat);
+			}
+			else {
+				interp_v3_v3v3(data, bevp->vec, nbevp->vec, bev_blend);
+				interp_qt_qtqt(quat, bevp->quat, nbevp->quat, bev_blend);
+			}
+
+			mul_qt_v3(quat, vec);
 
-			data[0] = bevp->vec[0] + fac * vec[0];
-			data[1] = bevp->vec[1] + fac * vec[1];
-			data[2] = bevp->vec[2] + fac * vec[2];
+			data[0] += fac * vec[0];
+			data[1] += fac * vec[1];
+			data[2] += fac * vec[2];
 		}
 		else {
-			data[0] = bevp->vec[0] + fac * (widfac + fp[1]) * bevp->sina;
-			data[1] = bevp->vec[1] + fac * (widfac + fp[1]) * bevp->cosa;
-			data[2] = bevp->vec[2] + fac * fp[2];
+			float sina, cosa;
+
+			if (nbevp == NULL) {
+				copy_v3_v3(data, bevp->vec);
+				sina = bevp->sina;
+				cosa = bevp->cosa;
+			}
+			else {
+				interp_v3_v3v3(data, bevp->vec, nbevp->vec, bev_blend);
+
+				/* perhaps we need to interpolate angles instead. but the thing is
+				 * cosa and sina are not actually sine and cosine
+				 */
+				sina = nbevp->sina * bev_blend + bevp->sina * (1.0f - bev_blend);
+				cosa = nbevp->cosa * bev_blend + bevp->cosa * (1.0f - bev_blend);
+			}
+
+			data[0] += fac * (widfac + fp[1]) * sina;
+			data[1] += fac * (widfac + fp[1]) * cosa;
+			data[2] += fac * fp[2];
 		}
 	}
 
@@ -1386,8 +1418,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 						ListBase top_capbase = {NULL, NULL};
 
 						for (dlb = dlbev.first; dlb; dlb = dlb->next) {
-							const float bevfac1 = minf(cu->bevfac1, cu->bevfac2);
-							const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2);
+							const float bevfac1 = min_ff(cu->bevfac1, cu->bevfac2);
+							const float bevfac2 = max_ff(cu->bevfac1, cu->bevfac2);
 							float firstblend = 0.0f, lastblend = 0.0f;
 							int i, start, steps;
 
@@ -1399,8 +1431,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 							firstblend = 1.0f - (bevfac1 * (bl->nr - 1) - (int)(bevfac1 * (bl->nr - 1)));
 							lastblend  =         bevfac2 * (bl->nr - 1) - (int)(bevfac2 * (bl->nr - 1));
 
-							if (steps > bl->nr) {
-								steps = bl->nr;
+							if (start + steps > bl->nr) {
+								steps = bl->nr - start;
 								lastblend = 1.0f;
 							}
 
@@ -1438,7 +1470,29 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 										fac = bevp->radius;
 								}
 								else {
-									fac = BKE_displist_calc_taper(scene, cu->taperobj, i, bl->nr);
+									float len, taper_fac;
+
+									if (cu->flag & CU_MAP_TAPER) {
+										len = (steps - 3) + firstblend + lastblend;
+
+										if (a == 0)
+											taper_fac = 0.0f;
+										else if (a == steps - 1)
+											taper_fac = 1.0f;
+										else
+											taper_fac = ((float) a - (1.0f - firstblend)) / len;
+									}
+									else {
+										len = bl->nr - 1;
+										taper_fac = (float) i / len;
+
+										if (a == 0)
+											taper_fac += (1.0f - firstblend) / len;
+										else if (a == steps - 1)
+											taper_fac -= (1.0f - lastblend) / len;
+									}
+
+									fac = displist_calc_taper(scene, cu->taperobj, taper_fac);
 								}
 
 								if (bevp->split_tag) {
@@ -1446,27 +1500,12 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 								}
 
 								/* rotate bevel piece and write in data */
-								rotateBevelPiece(cu, bevp, dlb, widfac, fac, &data);
-
-								if (a == 1 || a == steps - 1) {
-									float *cur_fp = cur_data, *prev_fp = cur_data - 3 * dlb->nr;
-									int b;
-
-									for (b = 0; b < dlb->nr; b++, prev_fp += 3, cur_fp += 3) {
-										float cur[3], prev[3];
-
-										copy_v3_v3(cur, cur_fp);
-										copy_v3_v3(prev, prev_fp);
-
-										if (a == 1)
-											interp_v3_v3v3(prev, cur_fp, prev_fp, firstblend);
-										if (a == steps - 1)
-											interp_v3_v3v3(cur, prev_fp, cur_fp, lastblend);
-
-										copy_v3_v3(cur_fp, cur);
-										copy_v3_v3(prev_fp, prev);
-									}
-								}
+								if (a == 0)
+									rotateBevelPiece(cu, bevp, bevp + 1, dlb, 1.0f - firstblend, widfac, fac, &data);
+								else if (a == steps - 1)
+									rotateBevelPiece(cu, bevp, bevp - 1, dlb, 1.0f - lastblend, widfac, fac, &data);
+								else
+									rotateBevelPiece(cu, bevp, NULL, dlb, 0.0f, widfac, fac, &data);
 
 								if (cu->bevobj && (cu->flag & CU_FILL_CAPS)) {
 									if (a == 1)
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index d558485..ed85e5b 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -32,6 +32,8 @@
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
@@ -84,7 +86,12 @@
 #include "RE_shader_ext.h"
 
 #ifdef _OPENMP
-#include <omp.h>
+#  include <omp.h>
+#endif
+
+/* could enable at some point but for now there are far too many conversions */
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wdouble-promotion"
 #endif
 
 /* precalculated gaussian factors for 5x super sampling	*/
@@ -120,8 +127,16 @@ static int neighY[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 /* drying limits */
 #define MIN_WETNESS 0.001f
 #define MAX_WETNESS 5.0f
-/* dissolve macro */
-#define VALUE_DISSOLVE(VALUE, TIME, SCALE, LOG) (VALUE) = (LOG) ? (VALUE) *(pow(MIN_WETNESS, 1.0f / (1.2f * ((float)(TIME)) / (SCALE)))) : (VALUE) -1.0f / (TIME)*(SCALE)
+
+
+/* dissolve inline function */
+BLI_INLINE void value_dissolve(float *r_value, const float time, const float scale, const int is_log)
+{
+	*r_value = (is_log) ?
+	              (*r_value) * (powf(MIN_WETNESS, 1.0f / (1.2f * time / scale))) :
+	              (*r_value) - 1.0f / time * scale;
+}
+
 
 /***************************** Internal Structs ***************************/
 
@@ -569,7 +584,7 @@ static void scene_setSubframe(Scene *scene, float subframe)
 static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
 {
 	Base *base = NULL;
-	GroupObject *go = NULL;	
+	GroupObject *go = NULL;
 	Object *brushObj = NULL;
 	ModifierData *md = NULL;
 
@@ -757,7 +772,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
 		volume = td[0] * td[1] * td[2];
 
 		/* determine final grid size by trying to fit average 10.000 points per grid cell */
-		dim_factor = (float)pow(volume / ((double)sData->total_points / 10000.0), 1.0 / (double)axis);
+		dim_factor = (float)pow((double)volume / ((double)sData->total_points / 10000.0), 1.0 / (double)axis);
 
 		/* define final grid size using dim_factor, use min 3 for active axises */
 		for (i = 0; i < 3; i++) {
@@ -848,7 +863,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
 		grid->s_num = MEM_reallocN(grid->s_num, sizeof(int) * grid_cells);
 
 		if (error || !grid->s_num) {
-			setError(surface->canvas, "Not enough free memory.");
+			setError(surface->canvas, N_("Not enough free memory"));
 			freeGrid(sData);
 		}
 	}
@@ -1235,7 +1250,7 @@ static void dynamicPaint_allocateSurfaceType(DynamicPaintSurface *surface)
 			break;
 	}
 
-	if (sData->type_data == NULL) setError(surface->canvas, "Not enough free memory!");
+	if (sData->type_data == NULL) setError(surface->canvas, N_("Not enough free memory"));
 }
 
 static int surface_usesAdjDistance(DynamicPaintSurface *surface)
@@ -1292,7 +1307,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
 	if (!ad->n_index || !ad->n_num || !ad->n_target || !temp_data) {
 		dynamicPaint_freeAdjData(sData);
 		if (temp_data) MEM_freeN(temp_data);
-		setError(surface->canvas, "Not enough free memory.");
+		setError(surface->canvas, N_("Not enough free memory"));
 		return;
 	}
 
@@ -1762,10 +1777,10 @@ static DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd,
 						}
 
 						/* apply weights into a vertex group, if doesnt exists add a new layer */
-						if (defgrp_index >= 0 && !dvert && (surface->output_name[0] != '\0'))
+						if (defgrp_index != -1 && !dvert && (surface->output_name[0] != '\0'))
 							dvert = CustomData_add_layer_named(&result->vertData, CD_MDEFORMVERT, CD_CALLOC,
 							                                   NULL, sData->total_points, surface->output_name);
-						if (defgrp_index >= 0 && dvert) {
+						if (defgrp_index != -1 && dvert) {
 							int i;
 							for (i = 0; i < sData->total_points; i++) {
 								MDeformVert *dv = &dvert[i];
@@ -2165,8 +2180,10 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 	int *final_index;
 	int aa_samples;
 
-	if (!dm) return setError(canvas, "Canvas mesh not updated.");
-	if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats.");
+	if (!dm)
+		return setError(canvas, N_("Canvas mesh not updated"));
+	if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ)
+		return setError(canvas, N_("Cannot bake non-'image sequence' formats"));
 
 	numOfFaces = dm->getNumTessFaces(dm);
 	mface = dm->getTessFaceArray(dm);
@@ -2176,8 +2193,10 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 	tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
 
 	/* Check for validity	*/
-	if (!tface) return setError(canvas, "No UV data on canvas.");
-	if (surface->image_resolution < 16 || surface->image_resolution > 8192) return setError(canvas, "Invalid resolution.");
+	if (!tface)
+		return setError(canvas, N_("No UV data on canvas"));
+	if (surface->image_resolution < 16 || surface->image_resolution > 8192)
+		return setError(canvas, N_("Invalid resolution"));
 
 	w = h = surface->image_resolution;
 
@@ -2189,7 +2208,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 	/* Init data struct */
 	if (surface->data) dynamicPaint_freeSurfaceData(surface);
 	sData = surface->data = MEM_callocN(sizeof(PaintSurfaceData), "PaintSurfaceData");
-	if (!surface->data) return setError(canvas, "Not enough free memory.");
+	if (!surface->data)
+		return setError(canvas, N_("Not enough free memory"));
 
 	aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1;
 	tempPoints = (struct PaintUVPoint *) MEM_callocN(w * h * sizeof(struct PaintUVPoint), "Temp PaintUVPoint");
@@ -2547,7 +2567,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 			}
 		}
 	}
-	if (error == 1) setError(canvas, "Not enough free memory.");
+	if (error == 1)
+		setError(canvas, N_("Not enough free memory"));
 
 	if (faceBB) MEM_freeN(faceBB);
 	if (tempPoints) MEM_freeN(tempPoints);
@@ -2598,7 +2619,10 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
 	int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
 	char output_file[FILE_MAX];
 
-	if (!sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; }
+	if (!sData->type_data) {
+		setError(surface->canvas, N_("Image save failed: invalid surface"));
+		return;
+	}
 	/* if selected format is openexr, but current build doesnt support one */
 	#ifndef WITH_OPENEXR
 	if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
@@ -2612,7 +2636,10 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
 
 	/* Init image buffer	*/
 	ibuf = IMB_allocImBuf(surface->image_resolution, surface->image_resolution, 32, IB_rectfloat);
-	if (ibuf == NULL) { setError(surface->canvas, "Image save failed: Not enough free memory."); return; }
+	if (ibuf == NULL) {
+		setError(surface->canvas, N_("Image save failed: not enough free memory"));
+		return;
+	}
 
 	#pragma omp parallel for schedule(static)
 	for (index = 0; index < sData->total_points; index++) {
@@ -3339,7 +3366,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 							    (!hit_found || (brush->flags & MOD_DPAINT_INVERSE_PROX)))
 							{
 								float proxDist = -1.0f;
-								float hitCo[3];
+								float hitCo[3] = {0.0f, 0.0f, 0.0f};
 								short hQuad;
 								int face;
 
@@ -3696,6 +3723,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 					float smooth_range = smooth * (1.0f - strength), dist;
 					/* calculate max range that can have particles with higher influence than the nearest one */
 					float max_range = smooth - strength * smooth + solidradius;
+					/* Make gcc happy! */
+					dist = max_range;
 
 					particles = BLI_kdtree_range_search(tree, max_range, bData->realCoord[bData->s_pos[index]].v, NULL, &nearest);
 
@@ -4473,7 +4502,7 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
 					int i;
 					float dry_ratio, f_color[4];
 					float p_wetness = pPoint->wetness;
-					VALUE_DISSOLVE(pPoint->wetness, surface->dry_speed, timescale, (surface->flags & MOD_DPAINT_DRY_LOG));
+					value_dissolve(&pPoint->wetness, surface->dry_speed, timescale, (surface->flags & MOD_DPAINT_DRY_LOG));
 					if (pPoint->wetness < 0.0f) pPoint->wetness = 0.0f;
 
 					if (pPoint->wetness < surface->color_dry_threshold) {
@@ -4518,10 +4547,10 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
 			}
 
 			if (surface->flags & MOD_DPAINT_DISSOLVE) {
-				VALUE_DISSOLVE(pPoint->alpha, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
+				value_dissolve(&pPoint->alpha, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
 				if (pPoint->alpha < 0.0f) pPoint->alpha = 0.0f;
 
-				VALUE_DISSOLVE(pPoint->e_alpha, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
+				value_dissolve(&pPoint->e_alpha, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
 				if (pPoint->e_alpha < 0.0f) pPoint->e_alpha = 0.0f;
 			}
 		}
@@ -4533,7 +4562,7 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
 
 			float *point = &((float *)sData->type_data)[index];
 			/* log or linear */
-			VALUE_DISSOLVE(*point, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
+			value_dissolve(point, surface->diss_speed, timescale, (surface->flags & MOD_DPAINT_DISSOLVE_LOG));
 			if (*point < 0.0f) *point = 0.0f;
 		}
 	}
@@ -4649,7 +4678,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 			if (bData->realCoord) MEM_freeN(bData->realCoord);
 			if (canvas_verts) MEM_freeN(canvas_verts);
 
-			return setError(surface->canvas, "Not enough free memory.");
+			return setError(surface->canvas, N_("Not enough free memory"));
 		}
 
 		new_bdata = 1;
@@ -4811,7 +4840,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 	 */
 	{
 		Base *base = NULL;
-		GroupObject *go = NULL;	
+		GroupObject *go = NULL;
 		Object *brushObj = NULL;
 		ModifierData *md = NULL;
 
@@ -4878,7 +4907,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 					/* Apply brush on the surface depending on it's collision type */
 					/* Particle brush: */
 					if (brush->collision == MOD_DPAINT_COL_PSYS) {
-						if (brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER &&
+						if (brush->psys && brush->psys->part && ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID) &&
 						    psys_check_enabled(brushObj, brush->psys))
 						{
 
@@ -4934,7 +4963,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 			/* Allocate memory for surface previous points to read unchanged values from	*/
 			prevPoint = MEM_mallocN(sData->total_points * sizeof(struct PaintPoint), "PaintSurfaceDataCopy");
 			if (!prevPoint)
-				return setError(canvas, "Not enough free memory.");
+				return setError(canvas, N_("Not enough free memory"));
 
 			/* Prepare effects and get number of required steps */
 			steps = dynamicPaint_prepareEffectStep(surface, scene, ob, &force, timescale);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 8d430eb..321a61c 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -215,7 +215,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
 			/* complete the loop */
 			BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
 
-			totfilltri = BLI_scanfill_calc_ex(&sf_ctx, FALSE, efa->no);
+			totfilltri = BLI_scanfill_calc_ex(&sf_ctx, 0, efa->no);
 			BLI_array_grow_items(looptris, totfilltri);
 
 			for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 4f4bafd..1f6db19 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -54,6 +54,7 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
+#include "BLI_noise.h"
 #include "BLI_jitter.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
@@ -84,6 +85,7 @@
 #include "BKE_object.h"
 #include "BKE_particle.h"
 #include "BKE_scene.h"
+#include "BKE_smoke.h"
 
 
 #include "RE_render_ext.h"
@@ -137,6 +139,9 @@ PartDeflect *object_add_collision_fields(int type)
 		case PFIELD_TEXTURE:
 			pd->f_size = 1.0f;
 			break;
+		case PFIELD_SMOKEFLOW:
+			pd->f_flow = 1.0f;
+			break;
 	}
 	pd->flag = PFIELD_DO_LOCATION|PFIELD_DO_ROTATION;
 
@@ -161,7 +166,7 @@ void free_partdeflect(PartDeflect *pd)
 		pd->tex->id.us--;
 
 	if (pd->rng)
-		rng_free(pd->rng);
+		BLI_rng_free(pd->rng);
 
 	MEM_freeN(pd);
 }
@@ -170,9 +175,9 @@ static void precalculate_effector(EffectorCache *eff)
 {
 	unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
 	if (!eff->pd->rng)
-		eff->pd->rng = rng_new(eff->pd->seed + cfra);
+		eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra);
 	else
-		rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
+		BLI_rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
 
 	if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
 		Curve *cu= eff->ob->data;
@@ -200,7 +205,7 @@ static void precalculate_effector(EffectorCache *eff)
 		float old_vel[3];
 
 		BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra - 1.0f);
-		copy_v3_v3(old_vel, eff->ob->obmat[3]);	
+		copy_v3_v3(old_vel, eff->ob->obmat[3]);
 		BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra);
 		sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel);
 	}
@@ -450,8 +455,8 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
 // noise function for wind e.g.
 static float wind_func(struct RNG *rng, float strength)
 {
-	int random = (rng_getInt(rng)+1) % 128; // max 2357
-	float force = rng_getFloat(rng) + 1.0f;
+	int random = (BLI_rng_get_int(rng)+1) % 128; // max 2357
+	float force = BLI_rng_get_float(rng) + 1.0f;
 	float ret;
 	float sign = 0;
 	
@@ -713,8 +718,8 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
 		
 		if (eff->pd->forcefield == PFIELD_CHARGE) {
 			/* Only the charge of the effected particle is used for 
-			 * interaction, not fall-offs. If the fall-offs aren't the	
-			 * same this will be unphysical, but for animation this		
+			 * interaction, not fall-offs. If the fall-offs aren't the
+			 * same this will be unphysical, but for animation this
 			 * could be the wanted behavior. If you want physical
 			 * correctness the fall-off should be spherical 2.0 anyways.
 			 */
@@ -823,7 +828,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 {
 	PartDeflect *pd = eff->pd;
 	RNG *rng = pd->rng;
-	float force[3]={0, 0, 0};
+	float force[3] = {0, 0, 0};
 	float temp[3];
 	float fac;
 	float strength = pd->f_strength;
@@ -922,12 +927,27 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 
 			mul_v3_fl(force, -efd->falloff * fac * (strength * fac + damp));
 			break;
+		case PFIELD_SMOKEFLOW:
+			zero_v3(force);
+			if (pd->f_source) {
+				float density;
+				if ((density = smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
+					float influence = strength * efd->falloff;
+					if (pd->flag & PFIELD_SMOKE_DENSITY)
+						influence *= density;
+					mul_v3_fl(force, influence);
+					/* apply flow */
+					madd_v3_v3fl(total_force, point->vel, -pd->f_flow * influence);
+				}
+			}
+			break;
+
 	}
 
 	if (pd->flag & PFIELD_DO_LOCATION) {
 		madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec);
 
-		if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
+		if (ELEM3(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG, PFIELD_SMOKEFLOW)==0 && pd->f_flow != 0.0f) {
 			madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
 		}
 	}
@@ -993,12 +1013,14 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
 				if (efd.falloff > 0.0f)
 					efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
 
-				if (efd.falloff <= 0.0f)
-					;	/* don't do anything */
-				else if (eff->pd->forcefield == PFIELD_TEXTURE)
+				if (efd.falloff <= 0.0f) {
+					/* don't do anything */
+				}
+				else if (eff->pd->forcefield == PFIELD_TEXTURE) {
 					do_texture_effector(eff, &efd, point, force);
+				}
 				else {
-					float temp1[3]={0, 0, 0}, temp2[3];
+					float temp1[3] = {0, 0, 0}, temp2[3];
 					copy_v3_v3(temp1, force);
 
 					do_physical_effector(eff, &efd, point, force);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 2dbc63e..ec61311 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -504,14 +504,14 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
 						xmaxv = MAX3(xmaxv, bezt_last->vec[1][0],  bezt_last->vec[2][0]);
 					}
 					else {
-						xminv = minf(xminv, bezt_first->vec[1][0]);
-						xmaxv = maxf(xmaxv, bezt_last->vec[1][0]);
+						xminv = min_ff(xminv, bezt_first->vec[1][0]);
+						xmaxv = max_ff(xmaxv, bezt_last->vec[1][0]);
 					}
 				}
 			}
 			
 			/* only loop over keyframes to find extents for values if needed */
-			if (ymin || ymax) {	
+			if (ymin || ymax) {
 				BezTriple *bezt;
 				
 				for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
@@ -521,8 +521,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
 							ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
 						}
 						else {
-							yminv = minf(yminv, bezt->vec[1][1]);
-							ymaxv = maxf(ymaxv, bezt->vec[1][1]);
+							yminv = min_ff(yminv, bezt->vec[1][1]);
+							ymaxv = max_ff(ymaxv, bezt->vec[1][1]);
 						}
 						
 						foundvert = TRUE;
@@ -533,8 +533,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
 		else if (fcu->fpt) {
 			/* frame range can be directly calculated from end verts */
 			if (xmin || xmax) {
-				xminv = minf(xminv, fcu->fpt[0].vec[0]);
-				xmaxv = maxf(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
+				xminv = min_ff(xminv, fcu->fpt[0].vec[0]);
+				xmaxv = max_ff(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
 			}
 			
 			/* only loop over keyframes to find extents for values if needed */
@@ -591,15 +591,15 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end,
 			if (bezt_first) {
 				BLI_assert(bezt_last != NULL);
 				
-				min = minf(min, bezt_first->vec[1][0]);
-				max = maxf(max, bezt_last->vec[1][0]);
+				min = min_ff(min, bezt_first->vec[1][0]);
+				max = max_ff(max, bezt_last->vec[1][0]);
 				
 				foundvert = TRUE;
 			}
 		}
 		else if (fcu->fpt) {
-			min = minf(min, fcu->fpt[0].vec[0]);
-			max = maxf(max, fcu->fpt[fcu->totvert - 1].vec[0]);
+			min = min_ff(min, fcu->fpt[0].vec[0]);
+			max = max_ff(max, fcu->fpt[fcu->totvert - 1].vec[0]);
 			
 			foundvert = TRUE;
 		}
@@ -1039,7 +1039,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
 	if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
 		if (RNA_property_array_check(prop)) {
 			/* array */
-			if (index < RNA_property_array_length(&ptr, prop)) {	
+			if (index < RNA_property_array_length(&ptr, prop)) {
 				switch (RNA_property_type(prop)) {
 					case PROP_BOOLEAN:
 						value = (float)RNA_property_boolean_get_index(&ptr, prop, index);
@@ -1143,7 +1143,7 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
 			
 		/* stop here... */
 		return 0.0f;
-	}			
+	}
 	
 	/* use the final posed locations */
 	mat4_to_quat(q1, pchan->pose_mat);
@@ -1549,7 +1549,7 @@ ChannelDriver *fcurve_copy_driver(ChannelDriver *driver)
 	for (dvar = ndriver->variables.first; dvar; dvar = dvar->next) {
 		/* need to go over all targets so that we don't leave any dangling paths */
 		DRIVER_TARGETS_LOOPER(dvar) 
-		{	
+		{
 			/* make a copy of target's rna path if available */
 			if (dtar->rna_path)
 				dtar->rna_path = MEM_dupallocN(dtar->rna_path);
@@ -1832,7 +1832,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
 			return 1;
 		}
 		
-		return 0;	
+		return 0;
 	}
 }
 
@@ -1916,7 +1916,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 						cvalue = prevbezt->vec[1][1];
 					}
 				}
-			} 
+			}
 			else {
 				/* Use the first handle (earlier) of first BezTriple to calculate the
 				 * gradient and thus the value of the curve at evaltime
@@ -1968,7 +1968,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 						cvalue = lastbezt->vec[1][1];
 					}
 				}
-			} 
+			}
 			else {
 				/* Use the gradient of the second handle (later) of last BezTriple to calculate the
 				 * gradient and thus the value of the curve at evaltime
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 9be599a..efc9869 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -41,7 +41,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_fluidsim.h"
-#include "DNA_object_force.h" // for pointcache 
+#include "DNA_object_force.h" // for pointcache
 #include "DNA_object_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_scene_types.h" // N_T
@@ -66,14 +66,14 @@
 //-------------------------------------------------------------------------------
 
 void initElbeemMesh(struct Scene *scene, struct Object *ob,
-			int *numVertices, float **vertices,
-	  int *numTriangles, int **triangles,
-	  int useGlobalCoords, int modifierIndex)
+                    int *numVertices, float **vertices,
+                    int *numTriangles, int **triangles,
+                    int useGlobalCoords, int modifierIndex)
 {
 	DerivedMesh *dm = NULL;
 	MVert *mvert;
 	MFace *mface;
-	int countTris=0, i, totvert, totface;
+	int countTris = 0, i, totvert, totface;
 	float *verts;
 	int *tris;
 
@@ -87,35 +87,35 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
 	totface = dm->getNumTessFaces(dm);
 
 	*numVertices = totvert;
-	verts = MEM_callocN(totvert*3*sizeof(float), "elbeemmesh_vertices");
-	for (i=0; i<totvert; i++) {
-		copy_v3_v3(&verts[i*3], mvert[i].co);
-		if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); }
+	verts = MEM_callocN(totvert * 3 * sizeof(float), "elbeemmesh_vertices");
+	for (i = 0; i < totvert; i++) {
+		copy_v3_v3(&verts[i * 3], mvert[i].co);
+		if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i * 3]); }
 	}
 	*vertices = verts;
 
-	for (i=0; i<totface; i++) {
+	for (i = 0; i < totface; i++) {
 		countTris++;
 		if (mface[i].v4) { countTris++; }
 	}
 	*numTriangles = countTris;
-	tris = MEM_callocN(countTris*3*sizeof(int), "elbeemmesh_triangles");
+	tris = MEM_callocN(countTris * 3 * sizeof(int), "elbeemmesh_triangles");
 	countTris = 0;
-	for (i=0; i<totface; i++) {
+	for (i = 0; i < totface; i++) {
 		int face[4];
 		face[0] = mface[i].v1;
 		face[1] = mface[i].v2;
 		face[2] = mface[i].v3;
 		face[3] = mface[i].v4;
 
-		tris[countTris*3+0] = face[0];
-		tris[countTris*3+1] = face[1];
-		tris[countTris*3+2] = face[2];
+		tris[countTris * 3 + 0] = face[0];
+		tris[countTris * 3 + 1] = face[1];
+		tris[countTris * 3 + 2] = face[2];
 		countTris++;
 		if (face[3]) {
-			tris[countTris*3+0] = face[0];
-			tris[countTris*3+1] = face[2];
-			tris[countTris*3+2] = face[3];
+			tris[countTris * 3 + 0] = face[0];
+			tris[countTris * 3 + 1] = face[2];
+			tris[countTris * 3 + 2] = face[3];
 			countTris++;
 		}
 	}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 6832107..2b393b4 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -42,6 +42,7 @@
 #include "BLF_translation.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_noise.h"
 #include "BLI_math.h" /* windows needs for M_PI */
 #include "BLI_utildefines.h"
 
@@ -155,7 +156,7 @@ static void fcm_generator_verify(FModifier *fcm)
 						
 					/* free the old data */
 					MEM_freeN(data->coefficients);
-				}	
+				}
 				
 				/* set the new data */
 				data->coefficients = nc;
@@ -181,7 +182,7 @@ static void fcm_generator_verify(FModifier *fcm)
 						
 					/* free the old data */
 					MEM_freeN(data->coefficients);
-				}	
+				}
 				
 				/* set the new data */
 				data->coefficients = nc;
@@ -275,7 +276,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
 /* Built-In Function Generator F-Curve Modifier --------------------------- */
 
 /* This uses the general equation for equations:
- *   y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset
+ *   y = amplitude * fn(phase_multiplier * x + phase_offset) + y_offset
  *
  * where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients,
  * x is the evaluation 'time', and 'y' is the resultant value
@@ -315,7 +316,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
 	 * WARNING: must perform special argument validation hereto guard against crashes  
 	 */
 	switch (data->type) {
-		/* simple ones */			
+		/* simple ones */
 		case FCM_GENERATOR_FN_SIN: /* sine wave */
 			fn = sin;
 			break;
@@ -1021,7 +1022,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type)
 	fcm->data = MEM_callocN(fmi->size, fmi->structName);
 	
 	/* init custom settings if necessary */
-	if (fmi->new_data)	
+	if (fmi->new_data)
 		fmi->new_data(fcm->data);
 		
 	/* return modifier for further editing */
@@ -1098,7 +1099,7 @@ int remove_fmodifier(ListBase *modifiers, FModifier *fcm)
 	if (modifiers) {
 		BLI_freelinkN(modifiers, fcm);
 		return 1;
-	} 
+	}
 	else {
 		/* XXX this case can probably be removed some day, as it shouldn't happen... */
 		printf("remove_fmodifier() - no modifier stack given\n");
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 06b21fb..d463474 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -177,7 +177,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
 		}
 	}
 	
-	return vfont->data;	
+	return vfont->data;
 }
 
 VFont *BKE_vfont_load(Main *bmain, const char *name)
@@ -306,23 +306,23 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
 	nu2->bp = bp;
 
 	nu2->bp[0].vec[0] = x1;
-	nu2->bp[0].vec[1] = y1;	
+	nu2->bp[0].vec[1] = y1;
 	nu2->bp[0].vec[2] = 0;
 	nu2->bp[0].vec[3] = 1.0f;
 	nu2->bp[1].vec[0] = x2;
 	nu2->bp[1].vec[1] = y1;
-	nu2->bp[1].vec[2] = 0;	
+	nu2->bp[1].vec[2] = 0;
 	nu2->bp[1].vec[3] = 1.0f;
 	nu2->bp[2].vec[0] = x2;
-	nu2->bp[2].vec[1] = y2;	
+	nu2->bp[2].vec[1] = y2;
 	nu2->bp[2].vec[2] = 0;
 	nu2->bp[2].vec[3] = 1.0f;
 	nu2->bp[3].vec[0] = x1;
 	nu2->bp[3].vec[1] = y2;
-	nu2->bp[3].vec[2] = 0;	
+	nu2->bp[3].vec[2] = 0;
 	nu2->bp[3].vec[3] = 1.0f;
 	
-	BLI_addtail(&(cu->nurb), nu2);	
+	BLI_addtail(&(cu->nurb), nu2);
 
 }
 
@@ -545,7 +545,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
 	/* The VFont Data can not be found */
 	if (!vfd) {
 		if (mem)
-			MEM_freeN(mem);	
+			MEM_freeN(mem);
 		return NULL;
 	}
 
@@ -671,7 +671,7 @@ makebreak:
 
 			yof -= linedist;
 
-			maxlen = maxf(maxlen, (xof - tb->x / cu->fsize));
+			maxlen = max_ff(maxlen, (xof - tb->x / cu->fsize));
 			linedata[lnr] = xof - tb->x / cu->fsize;
 			linedata2[lnr] = cnr;
 			linedata3[lnr] = tb->w / cu->fsize;
@@ -731,7 +731,7 @@ makebreak:
 			if (ascii == 32) {
 				wsfac = cu->wordspace; 
 				wsnr++;
-			} 
+			}
 			else {
 				wsfac = 1.0f;
 			}
@@ -754,7 +754,7 @@ makebreak:
 	for (i = 0; i <= slen; i++, tmp++, ct++) {
 		ascii = *tmp;
 		if (ascii == '\n' || ascii == '\r' || ct->dobreak) cu->lines++;
-	}	
+	}
 
 	/* linedata is now: width of line
 	 * linedata2 is now: number of characters
@@ -792,7 +792,7 @@ makebreak:
 //				}
 				ct++;
 			}
-		} 
+		}
 		else if ((cu->spacemode == CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
 			float curofs = 0.0f;
 			for (i = 0; i <= slen; i++) {
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 76b00ff..a7d0152 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -517,7 +517,7 @@ void gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
 	if (ELEM(NULL, gpd, gpl)) 
 		return;
 	
-	/* free layer */	
+	/* free layer */
 	free_gpencil_frames(gpl);
 	BLI_freelinkN(&gpd->layers, gpl);
 }
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 634428d..20d874e 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -98,7 +98,7 @@ void BKE_group_unlink(Group *group)
 				base->object->flag &= ~OB_FROMGROUP;
 				base->flag &= ~OB_FROMGROUP;
 			}
-		}			
+		}
 		
 		for (srl = sce->r.layers.first; srl; srl = srl->next) {
 			if (srl->light_override == group)
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 30427a8..c3008d1 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -47,39 +47,40 @@ typedef struct {
 } IDType;
 
 /* plural need to match rna_main.c's MainCollectionDef */
+/* WARNING! Keep it in sync with i18n contexts in BLF_translation.h */
 static IDType idtypes[] = {
-	{ ID_AC,        "Action",   "actions",      IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_AR,        "Armature", "armatures",    IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_BR,        "Brush",    "brushes",      IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_CA,        "Camera",   "cameras",      IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_CU,        "Curve",    "curves",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_GD,        "GPencil",  "grease_pencil", IDTYPE_FLAGS_ISLINKABLE},  /* rename gpencil */
-	{ ID_GR,        "Group",    "groups",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_ID,        "ID",       "ids",          0}, /* plural is fake */
-	{ ID_IM,        "Image",    "images",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_IP,        "Ipo",      "ipos",         IDTYPE_FLAGS_ISLINKABLE},  /* deprecated */
-	{ ID_KE,        "Key",      "shape_keys",   0},
-	{ ID_LA,        "Lamp",     "lamps",        IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_LI,        "Library",  "libraries",    0},
-	{ ID_LT,        "Lattice",  "lattices",     IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_MA,        "Material", "materials",    IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_MB,        "Metaball", "metaballs",    IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_ME,        "Mesh",     "meshes",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_NT,        "NodeTree", "node_groups",  IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_OB,        "Object",   "objects",      IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_PA,        "ParticleSettings", "particles", 0},
-	{ ID_SCE,       "Scene",    "scenes",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_SCR,       "Screen",   "screens",      0},
-	{ ID_SEQ,       "Sequence", "sequences",    0}, /* not actually ID data */
-	{ ID_SPK,       "Speaker",  "speakers",     IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_SO,        "Sound",    "sounds",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_TE,        "Texture",  "textures",     IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_TXT,       "Text",     "texts",        IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_VF,        "VFont",    "fonts",        IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_WO,        "World",    "worlds",       IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_WM,        "WindowManager", "window_managers", 0},
-	{ ID_MC,        "MovieClip", "movieclips",  IDTYPE_FLAGS_ISLINKABLE},
-	{ ID_MSK,        "Mask",     "masks",       IDTYPE_FLAGS_ISLINKABLE},
+	{ ID_AC,     "Action",           "actions",         IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_AR,     "Armature",         "armatures",       IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_BR,     "Brush",            "brushes",         IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_CA,     "Camera",           "cameras",         IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_CU,     "Curve",            "curves",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_GD,     "GPencil",          "grease_pencil",   IDTYPE_FLAGS_ISLINKABLE }, /* rename gpencil */
+	{ ID_GR,     "Group",            "groups",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_ID,     "ID",               "ids",             0                       }, /* plural is fake */
+	{ ID_IM,     "Image",            "images",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_IP,     "Ipo",              "ipos",            IDTYPE_FLAGS_ISLINKABLE }, /* deprecated */
+	{ ID_KE,     "Key",              "shape_keys",      0                       },
+	{ ID_LA,     "Lamp",             "lamps",           IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_LI,     "Library",          "libraries",       0                       },
+	{ ID_LT,     "Lattice",          "lattices",        IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_MA,     "Material",         "materials",       IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_MB,     "Metaball",         "metaballs",       IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_MC,     "MovieClip",        "movieclips",      IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_ME,     "Mesh",             "meshes",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_MSK,    "Mask",             "masks",           IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_NT,     "NodeTree",         "node_groups",     IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_OB,     "Object",           "objects",         IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_PA,     "ParticleSettings", "particles",       0                       },
+	{ ID_SCE,    "Scene",            "scenes",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_SCR,    "Screen",           "screens",         0                       },
+	{ ID_SEQ,    "Sequence",         "sequences",       0                       }, /* not actually ID data */
+	{ ID_SPK,    "Speaker",          "speakers",        IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_SO,     "Sound",            "sounds",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_TE,     "Texture",          "textures",        IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_TXT,    "Text",             "texts",           IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_VF,     "VFont",            "fonts",           IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_WO,     "World",            "worlds",          IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_WM,     "WindowManager",    "window_managers", 0                       },
 };
 static int nidtypes = sizeof(idtypes) / sizeof(idtypes[0]);
 
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 8ceaab5..5dd0f08 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -492,6 +492,30 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
 	}
 }
 
+/*
+ * If a property is missing in \a dest, add it.
+ */
+void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite)
+{
+	IDProperty *prop;
+
+	if (do_overwrite) {
+		for (prop = src->data.group.first; prop; prop = prop->next) {
+			IDProperty *copy = IDP_CopyProperty(prop);
+			IDP_ReplaceInGroup(dest, copy);
+		}
+	}
+	else {
+		for (prop = src->data.group.first; prop; prop = prop->next) {
+			if (IDP_GetPropertyFromGroup(dest, prop->name) == NULL) {
+				IDProperty *copy = IDP_CopyProperty(prop);
+				dest->len++;
+				BLI_addtail(&dest->data.group, copy);
+			}
+		}
+	}
+}
+
 /* returns 0 if an id property with the same name exists and it failed,
  * or 1 if it succeeded in adding to the group.*/
 int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
@@ -608,60 +632,77 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
 	}
 }
 
-int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
+/**
+ * \param is_strict When FALSE treat missing items as a match */
+int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict)
 {
 	if (prop1 == NULL && prop2 == NULL)
 		return 1;
 	else if (prop1 == NULL || prop2 == NULL)
-		return 0;
+		return is_strict ? 0 : 1;
 	else if (prop1->type != prop2->type)
 		return 0;
 
-	if (prop1->type == IDP_INT)
-		return (IDP_Int(prop1) == IDP_Int(prop2));
-	else if (prop1->type == IDP_FLOAT)
-		return (IDP_Float(prop1) == IDP_Float(prop2));
-	else if (prop1->type == IDP_DOUBLE)
-		return (IDP_Double(prop1) == IDP_Double(prop2));
-	else if (prop1->type == IDP_STRING)
-		return ((prop1->len == prop2->len) && strncmp(IDP_String(prop1), IDP_String(prop2), prop1->len) == 0);
-	else if (prop1->type == IDP_ARRAY) {
-		if (prop1->len == prop2->len && prop1->subtype == prop2->subtype)
-			return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype] * prop1->len);
-		else
-			return 0;
-	}
-	else if (prop1->type == IDP_GROUP) {
-		IDProperty *link1, *link2;
-
-		if (BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
-			return 0;
-
-		for (link1 = prop1->data.group.first; link1; link1 = link1->next) {
-			link2 = IDP_GetPropertyFromGroup(prop2, link1->name);
-
-			if (!IDP_EqualsProperties(link1, link2))
+	switch (prop1->type) {
+		case IDP_INT:
+			return (IDP_Int(prop1) == IDP_Int(prop2));
+		case IDP_FLOAT:
+			return (IDP_Float(prop1) == IDP_Float(prop2));
+		case IDP_DOUBLE:
+			return (IDP_Double(prop1) == IDP_Double(prop2));
+		case IDP_STRING:
+			return ((prop1->len == prop2->len) && strncmp(IDP_String(prop1), IDP_String(prop2), prop1->len) == 0);
+		case IDP_ARRAY:
+			if (prop1->len == prop2->len && prop1->subtype == prop2->subtype) {
+				return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype] * prop1->len);
+			}
+			else {
 				return 0;
-		}
+			}
+		case IDP_GROUP:
+		{
+			IDProperty *link1, *link2;
 
-		return 1;
-	}
-	else if (prop1->type == IDP_IDPARRAY) {
-		IDProperty *array1 = IDP_IDPArray(prop1);
-		IDProperty *array2 = IDP_IDPArray(prop2);
-		int i;
+			if (is_strict && BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
+				return 0;
 
-		if (prop1->len != prop2->len)
-			return 0;
-		
-		for (i = 0; i < prop1->len; i++)
-			if (!IDP_EqualsProperties(&array1[i], &array2[i]))
+			for (link1 = prop1->data.group.first; link1; link1 = link1->next) {
+				link2 = IDP_GetPropertyFromGroup(prop2, link1->name);
+
+				if (!IDP_EqualsProperties_ex(link1, link2, is_strict))
+					return 0;
+			}
+
+			return 1;
+		}
+		case IDP_IDPARRAY:
+		{
+			IDProperty *array1 = IDP_IDPArray(prop1);
+			IDProperty *array2 = IDP_IDPArray(prop2);
+			int i;
+
+			if (prop1->len != prop2->len)
 				return 0;
+
+			for (i = 0; i < prop1->len; i++)
+				if (!IDP_EqualsProperties(&array1[i], &array2[i]))
+					return 0;
+			return 1;
+		}
+		default:
+			/* should never get here */
+			BLI_assert(0);
+			break;
 	}
-	
+
 	return 1;
 }
 
+int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
+{
+	return IDP_EqualsProperties_ex(prop1, prop2, TRUE);
+}
+
 /* 'val' is never NULL, don't check */
 IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
 {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c003a86..f09f128 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -100,6 +100,8 @@
 
 #include "WM_api.h"
 
+static SpinLock image_spin;
+
 /* max int, to indicate we don't store sequences in ibuf */
 #define IMA_NO_INDEX    0x7FEFEFEF
 
@@ -108,6 +110,16 @@
 #define IMA_INDEX_FRAME(index)          (index >> 10)
 #define IMA_INDEX_PASS(index)           (index & ~1023)
 
+void BKE_images_init(void)
+{
+	BLI_spin_init(&image_spin);
+}
+
+void BKE_images_exit(void)
+{
+	BLI_spin_end(&image_spin);
+}
+
 /* ******** IMAGE PROCESSING ************* */
 
 static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
@@ -168,13 +180,14 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
 
 void BKE_image_de_interlace(Image *ima, int odd)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	if (ibuf) {
 		if (odd)
 			de_interlace_st(ibuf);
 		else
 			de_interlace_ng(ibuf);
 	}
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 /* ***************** ALLOC & FREE, DATA MANAGING *************** */
@@ -260,8 +273,9 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
 	/* this function is intended to be thread safe. with IMA_NO_INDEX this
 	 * should be OK, but when iterating over the list this is more tricky
 	 * */
-	if (index == IMA_NO_INDEX)
+	if (index == IMA_NO_INDEX) {
 		return ima->ibufs.first;
+	}
 	else {
 		ImBuf *ibuf;
 
@@ -269,9 +283,9 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
 		for (ibuf = ima->ibufs.first; ibuf; ibuf = ibuf->next)
 			if (ibuf->index == index)
 				return ibuf;
-
-		return NULL;
 	}
+
+	return NULL;
 }
 
 /* no ima->ibuf anymore, but listbase */
@@ -534,7 +548,7 @@ int BKE_image_scale(Image *image, int width, int height)
 		ibuf->userflags |= IB_BITMAPDIRTY;
 	}
 
-	BKE_image_release_ibuf(image, lock);
+	BKE_image_release_ibuf(image, ibuf, lock);
 
 	return (ibuf != NULL);
 }
@@ -649,6 +663,13 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
 			BKE_image_buf_fill_color(rect, rect_float, width, height, color);
 	}
 
+	if (rect_float) {
+		/* both byte and float buffers are filling in sRGB space, need to linearize float buffer after BKE_image_buf_fill* functions */
+
+		IMB_buffer_float_from_float(rect_float, rect_float, ibuf->channels, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB,
+		                            ibuf->flags & IB_cm_predivide, ibuf->x, ibuf->y, ibuf->x, ibuf->x);
+	}
+
 	return ibuf;
 }
 
@@ -1063,6 +1084,7 @@ char BKE_imtype_valid_channels(const char imtype)
 		case R_IMF_IMTYPE_DDS:
 		case R_IMF_IMTYPE_JP2:
 		case R_IMF_IMTYPE_QUICKTIME:
+		case R_IMF_IMTYPE_DPX:
 			chan_flag |= IMA_CHAN_FLAG_ALPHA;
 	}
 
@@ -1091,10 +1113,11 @@ char BKE_imtype_valid_depths(const char imtype)
 			return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
 		case R_IMF_IMTYPE_MULTILAYER:
 			return R_IMF_CHAN_DEPTH_32;
-		/* eeh, cineone does some strange 10bits per channel */
+		/* eeh, cineon does some strange 10bits per channel */
 		case R_IMF_IMTYPE_DPX:
+			return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_10 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
 		case R_IMF_IMTYPE_CINEON:
-			return R_IMF_CHAN_DEPTH_12;
+			return R_IMF_CHAN_DEPTH_10;
 		case R_IMF_IMTYPE_JP2:
 			return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
 		/* most formats are 8bit only */
@@ -1559,7 +1582,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* also a little of space to the background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		/* and draw the text. */
 		BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1576,7 +1599,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* and space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.note);
@@ -1592,7 +1615,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* and space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.date);
@@ -1608,7 +1631,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* and space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.rendertime);
@@ -1623,7 +1646,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp,  display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1639,7 +1662,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1654,7 +1677,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1669,7 +1692,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.camera);
 
@@ -1682,7 +1705,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.cameralens);
 	}
@@ -1695,7 +1718,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1711,7 +1734,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 
 		/* extra space for background. */
 		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
-						  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
+		                  x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
 
 		BLF_position(mono, x, y + y_ofs, 0.0);
 		BLF_draw_buffer(mono, stamp_data.strip);
@@ -1825,9 +1848,33 @@ int BKE_imbuf_write(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 #ifdef WITH_CINEON
 	else if (imtype == R_IMF_IMTYPE_CINEON) {
 		ibuf->ftype = CINEON;
+		if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) {
+			ibuf->ftype |= CINEON_LOG;
+		}
+		if (imf->depth == R_IMF_CHAN_DEPTH_16) {
+			ibuf->ftype |= CINEON_16BIT;
+		}
+		else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
+			ibuf->ftype |= CINEON_12BIT;
+		}
+		else if (imf->depth == R_IMF_CHAN_DEPTH_10) {
+			ibuf->ftype |= CINEON_10BIT;
+		}
 	}
 	else if (imtype == R_IMF_IMTYPE_DPX) {
 		ibuf->ftype = DPX;
+		if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) {
+		  ibuf->ftype |= CINEON_LOG;
+		}
+		if (imf->depth == R_IMF_CHAN_DEPTH_16) {
+			ibuf->ftype |= CINEON_16BIT;
+		}
+		else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
+			ibuf->ftype |= CINEON_12BIT;
+		}
+		else if (imf->depth == R_IMF_CHAN_DEPTH_10) {
+			ibuf->ftype |= CINEON_10BIT;
+		}
 	}
 #endif
 	else if (imtype == R_IMF_IMTYPE_TARGA) {
@@ -2055,6 +2102,8 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
 	if (ima == NULL)
 		return;
 
+	BLI_spin_lock(&image_spin);
+
 	switch (signal) {
 		case IMA_SIGNAL_FREE:
 			image_free_buffers(ima);
@@ -2120,8 +2169,19 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
 				}
 			}
 			break;
+		case IMA_SIGNAL_COLORMANAGE:
+			image_free_buffers(ima);
+
+			ima->ok = 1;
+
+			if (iuser)
+				iuser->ok = 1;
+
+			break;
 	}
 
+	BLI_spin_unlock(&image_spin);
+
 	/* don't use notifiers because they are not 100% sure to succeeded
 	 * this also makes sure all scenes are accounted for. */
 	{
@@ -2285,7 +2345,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 
 	if (ibuf) {
 #ifdef WITH_OPENEXR
-		/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
+		/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_acquire_ibuf */
 		if (ibuf->ftype == OPENEXR && ibuf->userdata) {
 			image_create_multilayer(ima, ibuf, frame);
 			ima->type = IMA_TYPE_MULTILAYER;
@@ -2447,7 +2507,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 	}
 
 	if (ibuf) {
-		/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
+		/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_acquire_ibuf */
 		if (ibuf->ftype == OPENEXR && ibuf->userdata) {
 			image_create_multilayer(ima, ibuf, cfra);
 			ima->type = IMA_TYPE_MULTILAYER;
@@ -2617,11 +2677,21 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	/* free rect buffer if float buffer changes, so it can be recreated with
 	 * the updated result, and also in case we got byte buffer from sequencer,
 	 * so we don't keep reference to freed buffer */
-	if (ibuf->rect_float != rectf || rect || !rectf)
+	if (ibuf->rect_float != rectf || rect)
 		imb_freerectImBuf(ibuf);
 
-	if (rect)
+	if (rect) {
 		ibuf->rect = rect;
+	}
+	else {
+		/* byte buffer of render result has been freed, make sure image buffers
+		 * does not reference to this buffer anymore
+		 * need check for whether byte buffer was allocated and owned by image itself
+		 * or if it's reusing buffer from render result
+		 */
+		if ((ibuf->mall & IB_rect) == 0)
+			ibuf->rect = NULL;
+	}
 
 	if (rectf) {
 		ibuf->rect_float = rectf;
@@ -2706,38 +2776,32 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
 		 * a big bottleneck */
 	}
 
-	*frame_r = frame;
-	*index_r = index;
+	if (frame_r)
+		*frame_r = frame;
+
+	if (index_r)
+		*index_r = index;
 
 	return ibuf;
 }
 
-/* Checks optional ImageUser and verifies/creates ImBuf. */
-/* use this one if you want to get a render result in progress,
- * if not, use BKE_image_get_ibuf which doesn't require a release */
-ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
+/* Checks optional ImageUser and verifies/creates ImBuf.
+ *
+ * not thread-safe, so callee should worry about thread locks
+ */
+static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 {
 	ImBuf *ibuf = NULL;
 	float color[] = {0, 0, 0, 1};
 	int frame = 0, index = 0;
 
-	/* This function is intended to be thread-safe. It postpones the mutex lock
-	 * until it needs to load the image, if the image is already there it
-	 * should just get the pointer and return. The reason is that a lot of mutex
-	 * locks appears to be very slow on certain multicore macs, causing a render
-	 * with image textures to actually slow down as more threads are used.
-	 *
-	 * Note that all the image loading functions should also make sure they do
-	 * things in a threadsafe way for image_get_ibuf_threadsafe to work correct.
-	 * That means, the last two steps must be, 1) add the ibuf to the list and
-	 * 2) set ima/iuser->ok to 0 to IMA_OK_LOADED */
-
 	if (lock_r)
 		*lock_r = NULL;
 
 	/* quick reject tests */
 	if (ima == NULL)
 		return NULL;
+
 	if (iuser) {
 		if (iuser->ok == 0)
 			return NULL;
@@ -2745,95 +2809,71 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 	else if (ima->ok == 0)
 		return NULL;
 
-	/* try to get the ibuf without locking */
 	ibuf = image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
 
 	if (ibuf == NULL) {
-		/* couldn't get ibuf and image is not ok, so let's lock and try to
-		 * load the image */
-		BLI_lock_thread(LOCK_IMAGE);
-
-		/* need to check ok flag and loading ibuf again, because the situation
-		 * might have changed in the meantime */
-		if (iuser) {
-			if (iuser->ok == 0) {
-				BLI_unlock_thread(LOCK_IMAGE);
-				return NULL;
-			}
-		}
-		else if (ima->ok == 0) {
-			BLI_unlock_thread(LOCK_IMAGE);
-			return NULL;
+		/* we are sure we have to load the ibuf, using source and type */
+		if (ima->source == IMA_SRC_MOVIE) {
+			/* source is from single file, use flipbook to store ibuf */
+			ibuf = image_load_movie_file(ima, iuser, frame);
 		}
-
-		ibuf = image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
-
-		if (ibuf == NULL) {
-			/* we are sure we have to load the ibuf, using source and type */
-			if (ima->source == IMA_SRC_MOVIE) {
-				/* source is from single file, use flipbook to store ibuf */
-				ibuf = image_load_movie_file(ima, iuser, frame);
+		else if (ima->source == IMA_SRC_SEQUENCE) {
+			if (ima->type == IMA_TYPE_IMAGE) {
+				/* regular files, ibufs in flipbook, allows saving */
+				ibuf = image_load_sequence_file(ima, iuser, frame);
 			}
-			else if (ima->source == IMA_SRC_SEQUENCE) {
-				if (ima->type == IMA_TYPE_IMAGE) {
-					/* regular files, ibufs in flipbook, allows saving */
-					ibuf = image_load_sequence_file(ima, iuser, frame);
-				}
-				/* no else; on load the ima type can change */
-				if (ima->type == IMA_TYPE_MULTILAYER) {
-					/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
-					ibuf = image_load_sequence_multilayer(ima, iuser, frame);
-				}
+			/* no else; on load the ima type can change */
+			if (ima->type == IMA_TYPE_MULTILAYER) {
+				/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
+				ibuf = image_load_sequence_multilayer(ima, iuser, frame);
 			}
-			else if (ima->source == IMA_SRC_FILE) {
+		}
+		else if (ima->source == IMA_SRC_FILE) {
 
-				if (ima->type == IMA_TYPE_IMAGE)
-					ibuf = image_load_image_file(ima, iuser, frame);  /* cfra only for '#', this global is OK */
-				/* no else; on load the ima type can change */
-				if (ima->type == IMA_TYPE_MULTILAYER)
-					/* keeps render result, stores ibufs in listbase, allows saving */
-					ibuf = image_get_ibuf_multilayer(ima, iuser);
+			if (ima->type == IMA_TYPE_IMAGE)
+				ibuf = image_load_image_file(ima, iuser, frame);  /* cfra only for '#', this global is OK */
+			/* no else; on load the ima type can change */
+			if (ima->type == IMA_TYPE_MULTILAYER)
+				/* keeps render result, stores ibufs in listbase, allows saving */
+				ibuf = image_get_ibuf_multilayer(ima, iuser);
 
+		}
+		else if (ima->source == IMA_SRC_GENERATED) {
+			/* generated is: ibuf is allocated dynamically */
+			/* UV testgrid or black or solid etc */
+			if (ima->gen_x == 0) ima->gen_x = 1024;
+			if (ima->gen_y == 0) ima->gen_y = 1024;
+			ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
+			                     color, &ima->colorspace_settings);
+			image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+			ima->ok = IMA_OK_LOADED;
+		}
+		else if (ima->source == IMA_SRC_VIEWER) {
+			if (ima->type == IMA_TYPE_R_RESULT) {
+				/* always verify entirely, and potentially
+				 * returns pointer to release later */
+				ibuf = image_get_render_result(ima, iuser, lock_r);
 			}
-			else if (ima->source == IMA_SRC_GENERATED) {
-				/* generated is: ibuf is allocated dynamically */
-				/* UV testgrid or black or solid etc */
-				if (ima->gen_x == 0) ima->gen_x = 1024;
-				if (ima->gen_y == 0) ima->gen_y = 1024;
-				ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
-				                     color, &ima->colorspace_settings);
-				image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
-				ima->ok = IMA_OK_LOADED;
-			}
-			else if (ima->source == IMA_SRC_VIEWER) {
-				if (ima->type == IMA_TYPE_R_RESULT) {
-					/* always verify entirely, and potentially
-					 * returns pointer to release later */
-					ibuf = image_get_render_result(ima, iuser, lock_r);
-				}
-				else if (ima->type == IMA_TYPE_COMPOSITE) {
-					/* requires lock/unlock, otherwise don't return image */
-					if (lock_r) {
-						/* unlock in BKE_image_release_ibuf */
-						BLI_lock_thread(LOCK_VIEWER);
-						*lock_r = ima;
-
-						/* XXX anim play for viewer nodes not yet supported */
-						frame = 0; // XXX iuser?iuser->framenr:0;
-						ibuf = image_get_ibuf(ima, 0, frame);
-
-						if (!ibuf) {
-							/* Composite Viewer, all handled in compositor */
-							/* fake ibuf, will be filled in compositor */
-							ibuf = IMB_allocImBuf(256, 256, 32, IB_rect);
-							image_assign_ibuf(ima, ibuf, 0, frame);
-						}
+			else if (ima->type == IMA_TYPE_COMPOSITE) {
+				/* requires lock/unlock, otherwise don't return image */
+				if (lock_r) {
+					/* unlock in BKE_image_release_ibuf */
+					BLI_lock_thread(LOCK_VIEWER);
+					*lock_r = ima;
+
+					/* XXX anim play for viewer nodes not yet supported */
+					frame = 0; // XXX iuser?iuser->framenr:0;
+					ibuf = image_get_ibuf(ima, 0, frame);
+
+					if (!ibuf) {
+						/* Composite Viewer, all handled in compositor */
+						/* fake ibuf, will be filled in compositor */
+						ibuf = IMB_allocImBuf(256, 256, 32, IB_rect);
+						image_assign_ibuf(ima, ibuf, 0, frame);
 					}
 				}
 			}
 		}
-
-		BLI_unlock_thread(LOCK_IMAGE);
 	}
 
 	BKE_image_tag_time(ima);
@@ -2841,23 +2881,79 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 	return ibuf;
 }
 
-void BKE_image_release_ibuf(Image *ima, void *lock)
+/* return image buffer for given image and user
+ *
+ * - will lock render result if image type is render result and lock is not NULL
+ * - will return NULL if image type if render or composite result and lock is NULL
+ *
+ * references the result, BKE_image_release_ibuf should be used to de-reference
+ */
+ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
+{
+	ImBuf *ibuf;
+
+	BLI_spin_lock(&image_spin);
+
+	ibuf = image_acquire_ibuf(ima, iuser, lock_r);
+
+	if (ibuf)
+		IMB_refImBuf(ibuf);
+
+	BLI_spin_unlock(&image_spin);
+
+	return ibuf;
+}
+
+void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
 {
-	/* for getting image during threaded render / compositing, need to release */
-	if (lock == ima) {
-		BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
+	if (lock) {
+		/* for getting image during threaded render / compositing, need to release */
+		if (lock == ima) {
+			BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
+		}
+		else if (lock) {
+			RE_ReleaseResultImage(lock); /* render result */
+			BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
+		}
 	}
-	else if (lock) {
-		RE_ReleaseResultImage(lock); /* render result */
-		BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
+
+	if (ibuf) {
+		BLI_spin_lock(&image_spin);
+		IMB_freeImBuf(ibuf);
+		BLI_spin_unlock(&image_spin);
 	}
 }
 
-/* warning, this can allocate generated images */
-ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
+/* checks whether there's an image buffer for given image and user */
+int BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
 {
-	/* here (+fie_ima/2-1) makes sure that division happens correctly */
-	return BKE_image_acquire_ibuf(ima, iuser, NULL);
+	ImBuf *ibuf;
+
+	/* quick reject tests */
+	if (ima == NULL)
+		return FALSE;
+
+	if (iuser) {
+		if (iuser->ok == 0)
+			return FALSE;
+	}
+	else if (ima->ok == 0)
+		return FALSE;
+
+	ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
+
+	if (!ibuf) {
+		BLI_spin_lock(&image_spin);
+
+		ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
+
+		if (!ibuf)
+			ibuf = image_acquire_ibuf(ima, iuser, NULL);
+
+		BLI_spin_unlock(&image_spin);
+	}
+
+	return ibuf != NULL;
 }
 
 int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range)
@@ -2975,7 +3071,7 @@ int BKE_image_has_alpha(struct Image *image)
 
 	ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
 	planes = (ibuf ? ibuf->planes : 0);
-	BKE_image_release_ibuf(image, lock);
+	BKE_image_release_ibuf(image, ibuf, lock);
 
 	if (planes == 32)
 		return 1;
@@ -2999,7 +3095,7 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
 		*height = IMG_SIZE_FALLBACK;
 	}
 
-	BKE_image_release_ibuf(image, lock);
+	BKE_image_release_ibuf(image, ibuf, lock);
 }
 
 void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2])
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 37572ee..468a887 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -244,7 +244,7 @@ static void checker_board_color_tint(unsigned char *rect, float *rect_float, int
 			}
 			
 		}
-	}	
+	}
 }
 
 static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int width, int height, float blend)
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 2b23e84..90cd7bc 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -590,7 +590,7 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
 			for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++) {
 				muladd_fmatrix_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]);
 			}
-		}	
+		}
 #pragma omp section
 		{
 			for (i = 0; i < from[0].vcount+from[0].scount; i++) {
@@ -623,7 +623,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
+		add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
 	}
 
 }
@@ -634,7 +634,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
+		addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
 	}
 
 }
@@ -645,7 +645,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
+		subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
 	}
 
 }
@@ -656,7 +656,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
+		sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
 	}
 
 }
@@ -667,7 +667,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount; i++) {
-		sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);	
+		sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);
 	}
 
 }
@@ -678,7 +678,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
+		addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
 	}
 
 }
@@ -691,7 +691,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
 
 	/* process diagonal elements */
 	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS);	
+		subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS);
 	}
 
 }
@@ -711,7 +711,7 @@ static void update_matrixS(ClothVertex *verts, int numverts, fmatrix3x3 *S)
 	int i = 0;
 
 	/* Clear matrix from old vertex constraints */
-	for(i = 0; i < S[0].vcount; i++)
+	for (i = 0; i < S[0].vcount; i++)
 		S[i].c = S[i].r = 0;
 
 	/* Set new vertex constraints */
@@ -749,7 +749,7 @@ int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd)
 	id = (Implicit_Data *)MEM_callocN(sizeof(Implicit_Data), "implicit vecmat");
 	cloth->implicit = id;
 
-	/* process diagonal elements */		
+	/* process diagonal elements */
 	id->A = create_bfmatrix(cloth->numverts, cloth->numsprings);
 	id->dFdV = create_bfmatrix(cloth->numverts, cloth->numsprings);
 	id->dFdX = create_bfmatrix(cloth->numverts, cloth->numsprings);
@@ -844,41 +844,40 @@ int	implicit_free(ClothModifierData *clmd)
 
 DO_INLINE float fb(float length, float L)
 {
-	float x = length/L;
-	return (-11.541f*pow(x, 4)+34.193f*pow(x, 3)-39.083f*pow(x, 2)+23.116f*x-9.713f);
+	float x = length / L;
+	return (-11.541f * powf(x, 4) + 34.193f * powf(x, 3) - 39.083f * powf(x, 2) + 23.116f * x - 9.713f);
 }
 
 DO_INLINE float fbderiv(float length, float L)
 {
 	float x = length/L;
 
-	return (-46.164f*pow(x, 3)+102.579f*pow(x, 2)-78.166f*x+23.116f);
+	return (-46.164f * powf(x, 3) + 102.579f * powf(x, 2) - 78.166f * x + 23.116f);
 }
 
 DO_INLINE float fbstar(float length, float L, float kb, float cb)
 {
-	float tempfb = kb * fb(length, L);
-
-	float fbstar = cb * (length - L);
+	float tempfb_fl = kb * fb(length, L);
+	float fbstar_fl = cb * (length - L);
 	
-	if (tempfb < fbstar)
-		return fbstar;
+	if (tempfb_fl < fbstar_fl)
+		return fbstar_fl;
 	else
-		return tempfb;		
+		return tempfb_fl;
 }
 
 // function to calculae bending spring force (taken from Choi & Co)
 DO_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
 {
-	float tempfb = kb * fb(length, L);
-	float fbstar = cb * (length - L);
+	float tempfb_fl = kb * fb(length, L);
+	float fbstar_fl = cb * (length - L);
 
-	if (tempfb < fbstar) {
+	if (tempfb_fl < fbstar_fl) {
 		return cb;
 	}
 	else {
-		return kb * fbderiv(length, L);	
-	}	
+		return kb * fbderiv(length, L);
+	}
 }
 
 DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
@@ -918,7 +917,7 @@ static int  cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
 	cp_lfvector(d, r, numverts);
 
 	s = dot_lfvector(r, r, numverts);
-	starget = s * sqrt(conjgrad_epsilon);
+	starget = s * sqrtf(conjgrad_epsilon);
 
 	while (s>starget && conjgrad_loopcount < conjgrad_looplimit) {
 		// Mul(q, A, d); // q = A*d;
@@ -1149,9 +1148,9 @@ DO_INLINE void dfdx_spring_type1(float to[3][3], float extent[3], float length,
 	// dir is unit length direction, rest is spring's restlength, k is spring constant.
 	// return  (outerprod(dir, dir)*k + (I - outerprod(dir, dir))*(k - ((k*L)/length)));
 	float temp[3][3];
-	float temp1 = k*(1.0 - (L/length));	
+	float temp1 = k * (1.0f - (L / length));
 	
-	mul_fvectorT_fvectorS(temp, extent, extent, 1.0 / dot);
+	mul_fvectorT_fvectorS(temp, extent, extent, 1.0f / dot);
 	sub_fmatrix_fmatrix(to, I, temp);
 	mul_fmatrix_S(to, temp1);
 	
@@ -1219,7 +1218,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 	float stretch_force[3] = {0, 0, 0};
 	float bending_force[3] = {0, 0, 0};
 	float damping_force[3] = {0, 0, 0};
-	float nulldfdx[3][3]={ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
+	float nulldfdx[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
 	
 	float scaling = 0.0;
 
@@ -1247,7 +1246,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 		s->flags |= CSPRING_FLAG_DEACTIVATE;
 		return;
 	}
-	} 
+	}
 		*/
 		mul_fvector_S(dir, extent, 1.0f/length);
 	}
@@ -1308,7 +1307,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 		
 		VECADDS(s->f, s->f, extent, -k);
 		
-		mul_fvector_S(damping_force, dir, clmd->sim_parms->goalfrict * 0.01 * dot_v3v3(vel, dir));
+		mul_fvector_S(damping_force, dir, clmd->sim_parms->goalfrict * 0.01f * dot_v3v3(vel, dir));
 		VECADD(s->f, s->f, damping_force);
 		
 		// HERE IS THE PROBLEM!!!!
@@ -1319,10 +1318,10 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 		if (length < L) {
 			s->flags |= CLOTH_SPRING_FLAG_NEEDED;
 			
-			k = clmd->sim_parms->bending;	
+			k = clmd->sim_parms->bending;
 			
-			scaling = k + s->stiffness * ABS(clmd->sim_parms->max_bend-k);			
-			cb = k = scaling / (20.0*(clmd->sim_parms->avg_spring_len + FLT_EPSILON));
+			scaling = k + s->stiffness * ABS(clmd->sim_parms->max_bend-k);
+			cb = k = scaling / (20.0f * (clmd->sim_parms->avg_spring_len + FLT_EPSILON));
 
 			mul_fvector_S(bending_force, dir, fbstar(length, L, k, cb));
 			VECADD(s->f, s->f, bending_force);
@@ -1338,7 +1337,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
 		if (!(s->type & CLOTH_SPRING_TYPE_BENDING)) {
 			sub_fmatrix_fmatrix(dFdV[s->ij].m, dFdV[s->ij].m, s->dfdv);
 			sub_fmatrix_fmatrix(dFdV[s->kl].m, dFdV[s->kl].m, s->dfdv);
-			add_fmatrix_fmatrix(dFdV[s->matrix_index].m, dFdV[s->matrix_index].m, s->dfdv);	
+			add_fmatrix_fmatrix(dFdV[s->matrix_index].m, dFdV[s->matrix_index].m, s->dfdv);
 		}
 
 		VECADD(lF[s->ij], lF[s->ij], s->f);
@@ -1349,7 +1348,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
 		sub_fmatrix_fmatrix(dFdX[s->kl].m, dFdX[s->kl].m, s->dfdx);
 		sub_fmatrix_fmatrix(dFdX[s->ij].m, dFdX[s->ij].m, s->dfdx);
 		add_fmatrix_fmatrix(dFdX[s->matrix_index].m, dFdX[s->matrix_index].m, s->dfdx);
-	}	
+	}
 }
 
 
@@ -1357,15 +1356,15 @@ static void CalcFloat( float *v1, float *v2, float *v3, float *n)
 {
 	float n1[3], n2[3];
 
-	n1[0]= v1[0]-v2[0];
-	n2[0]= v2[0]-v3[0];
-	n1[1]= v1[1]-v2[1];
-	n2[1]= v2[1]-v3[1];
-	n1[2]= v1[2]-v2[2];
-	n2[2]= v2[2]-v3[2];
-	n[0]= n1[1]*n2[2]-n1[2]*n2[1];
-	n[1]= n1[2]*n2[0]-n1[0]*n2[2];
-	n[2]= n1[0]*n2[1]-n1[1]*n2[0];
+	n1[0] = v1[0]-v2[0];
+	n2[0] = v2[0]-v3[0];
+	n1[1] = v1[1]-v2[1];
+	n2[1] = v2[1]-v3[1];
+	n1[2] = v1[2]-v2[2];
+	n2[2] = v2[2]-v3[2];
+	n[0] = n1[1]*n2[2]-n1[2]*n2[1];
+	n[1] = n1[2]*n2[0]-n1[0]*n2[2];
+	n[2] = n1[0]*n2[1]-n1[1]*n2[0];
 }
 
 static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
@@ -1373,17 +1372,17 @@ static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
 	/* real cross! */
 	float n1[3], n2[3];
 
-	n1[0]= v1[0]-v3[0];
-	n1[1]= v1[1]-v3[1];
-	n1[2]= v1[2]-v3[2];
+	n1[0] = v1[0]-v3[0];
+	n1[1] = v1[1]-v3[1];
+	n1[2] = v1[2]-v3[2];
 
-	n2[0]= v2[0]-v4[0];
-	n2[1]= v2[1]-v4[1];
-	n2[2]= v2[2]-v4[2];
+	n2[0] = v2[0]-v4[0];
+	n2[1] = v2[1]-v4[1];
+	n2[2] = v2[2]-v4[2];
 
-	n[0]= n1[1]*n2[2]-n1[2]*n2[1];
-	n[1]= n1[2]*n2[0]-n1[0]*n2[2];
-	n[2]= n1[0]*n2[1]-n1[1]*n2[0];
+	n[0] = n1[1]*n2[2]-n1[2]*n2[1];
+	n[1] = n1[2]*n2[0]-n1[0]*n2[2];
+	n[2] = n1[0]*n2[1]-n1[1]*n2[0];
 }
 
 static float calculateVertexWindForce(float wind[3], float vertexnormal[3])  
@@ -1480,7 +1479,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 						colg[i][j][k].velocity[0] += vel[0];
 						colg[i][j][k].velocity[1] += vel[1];
 						colg[i][j][k].velocity[2] += vel[2];
-						colg[i][j][k].density += 1.0;
+						colg[i][j][k].density += 1.0f;
 					}
 				}
 			}
@@ -1514,7 +1513,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 		i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
 		j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
 		k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
-		if (i < 0 || j < 0 || k < 0 || i > 10 || j >= 10 || k >= 10)
+		if (i < 0 || j < 0 || k < 0 || i >= 10 || j >= 10 || k >= 10)
 			continue;
 
 		lF[v][0] += smoothfac * (grid[i][j][k].velocity[0] - lV[v][0]);
@@ -1545,7 +1544,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 	lfVector *winvec;
 	EffectedPoint epoint;
 
-	tm2[0][0]= tm2[1][1]= tm2[2][2]= -spring_air;
+	tm2[0][0] = tm2[1][1] = tm2[2][2] = -spring_air;
 	
 	/* global acceleration (gravitation) */
 	if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
@@ -1589,11 +1588,11 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 		}
 		
 		for (i = 0; i < cloth->numfaces; i++) {
-			float trinormal[3]={0, 0, 0}; // normalized triangle normal
-			float triunnormal[3]={0, 0, 0}; // not-normalized-triangle normal
-			float tmp[3]={0, 0, 0};
+			float trinormal[3] = {0, 0, 0}; // normalized triangle normal
+			float triunnormal[3] = {0, 0, 0}; // not-normalized-triangle normal
+			float tmp[3] = {0, 0, 0};
 			float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0;
-			factor *= 0.02;
+			factor *= 0.02f;
 			
 			// calculate face normal
 			if (mfaces[i].v4)
@@ -1629,9 +1628,9 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 		/* Hair has only edges */
 		if (cloth->numfaces == 0) {
 			ClothSpring *spring;
-			float edgevec[3]={0, 0, 0}; //edge vector
-			float edgeunnormal[3]={0, 0, 0}; // not-normalized-edge normal
-			float tmp[3]={0, 0, 0};
+			float edgevec[3] = {0, 0, 0}; //edge vector
+			float edgeunnormal[3] = {0, 0, 0}; // not-normalized-edge normal
+			float tmp[3] = {0, 0, 0};
 			float factor = 0.01;
 
 			search = cloth->springs;
@@ -1663,7 +1662,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 	while (search) {
 		// only handle active springs
 		ClothSpring *spring = search->link;
-		if( !(spring->flags & CLOTH_SPRING_FLAG_DEACTIVATE))
+		if (!(spring->flags & CLOTH_SPRING_FLAG_DEACTIVATE))
 			cloth_calc_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX, time);
 
 		search = search->next;
@@ -1731,8 +1730,8 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothMo
 	for (i=0; i<cloth->numverts; i++, cv++) {
 		copy_v3_v3(cos[i], cv->tx);
 		
-		if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) {
-			masses[i] = 1e+10;	
+		if (cv->goal == 1.0f || len_squared_v3v3(initial_cos[i], cv->tx) != 0.0f) {
+			masses[i] = 1e+10;
 		}
 		else {
 			masses[i] = cv->mass;
@@ -1759,18 +1758,18 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothMo
 			normalize_v3(vec);
 			
 			c = (len - spring->restlen);
-			if (c == 0.0)
+			if (c == 0.0f)
 				continue;
 			
-			l = c / ((1.0/masses[v1]) + (1.0/masses[v2]));
+			l = c / ((1.0f / masses[v1]) + (1.0f / masses[v2]));
 			
-			mul_v3_fl(vec, -(1.0/masses[v1])*l);
+			mul_v3_fl(vec, -(1.0f / masses[v1]) * l);
 			add_v3_v3(cos[v1], vec);
 	
 			sub_v3_v3v3(vec, cos[v2], cos[v1]);
 			normalize_v3(vec);
 			
-			mul_v3_fl(vec, -(1.0/masses[v2])*l);
+			mul_v3_fl(vec, -(1.0f / masses[v2]) * l);
 			add_v3_v3(cos[v2], vec);
 		}
 	}
@@ -1815,7 +1814,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase *
 				sub_v3_v3v3(id->V[i], verts[i].xconst, verts[i].xold);
 				// mul_v3_fl(id->V[i], clmd->sim_parms->stepsPerFrame);
 			}
-		}	
+		}
 	}
 	
 	while (step < tf) {
@@ -1840,7 +1839,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase *
 					mul_fvector_S(tvect, tvect, step+dt);
 					VECADD(tvect, tvect, verts[i].xold);
 					copy_v3_v3(id->Xnew[i], tvect);
-				}	
+				}
 			}
 			
 			copy_v3_v3(verts[i].txold, id->X[i]);
@@ -1898,7 +1897,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase *
 				cp_lfvector(id->V, id->Vnew, numverts);
 
 				// calculate 
-				cloth_calc_force(clmd, frame, id->F, id->X, id->V, id->dFdV, id->dFdX, effectors, step+dt, id->M);	
+				cloth_calc_force(clmd, frame, id->F, id->X, id->V, id->dFdV, id->dFdX, effectors, step+dt, id->M);
 				
 				simulate_implicit_euler(id->Vnew, id->X, id->V, id->F, id->dFdV, id->dFdX, dt / 2.0f, id->A, id->B, id->dV, id->S, id->z, id->olddV, id->P, id->Pinv, id->M, id->bigI);
 			}
@@ -1947,6 +1946,6 @@ void implicit_set_positions(ClothModifierData *clmd)
 		copy_v3_v3(id->V[i], verts[i].v);
 	}
 	if (G.debug_value > 0)
-		printf("implicit_set_positions\n");	
+		printf("implicit_set_positions\n");
 }
 
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 5216aef..59dd028 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -569,7 +569,7 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index)
 			return mtex_adrcodes_to_paths(adrcode, array_index);
 	}
 	
-	return NULL;	
+	return NULL;
 }
 
 /* Camera Types */
@@ -727,7 +727,7 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index)
 			return mtex_adrcodes_to_paths(adrcode, array_index);
 	}
 		
-	return NULL;	
+	return NULL;
 }
 
 /* Particle Types */
@@ -873,7 +873,7 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con
 			propname = "eval_time";
 			break;
 		
-		/* XXX problematic blocktypes */		
+		/* XXX problematic blocktypes */
 		case ID_SEQ: /* sequencer strip */
 			//SEQ_FAC1:
 			switch (adrcode) {
@@ -981,21 +981,21 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con
 static short adrcode_to_dtar_transchan(short adrcode)
 {
 	switch (adrcode) {
-		case OB_LOC_X:	
+		case OB_LOC_X:
 			return DTAR_TRANSCHAN_LOCX;
 		case OB_LOC_Y:
 			return DTAR_TRANSCHAN_LOCY;
 		case OB_LOC_Z:
 			return DTAR_TRANSCHAN_LOCZ;
 		
-		case OB_ROT_X:	
+		case OB_ROT_X:
 			return DTAR_TRANSCHAN_ROTX;
 		case OB_ROT_Y:
 			return DTAR_TRANSCHAN_ROTY;
 		case OB_ROT_Z:
 			return DTAR_TRANSCHAN_ROTZ;
 		
-		case OB_SIZE_X:	
+		case OB_SIZE_X:
 			return DTAR_TRANSCHAN_SCALEX;
 		case OB_SIZE_Y:
 			return DTAR_TRANSCHAN_SCALEX;
@@ -1359,8 +1359,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
 				
 				/* correct values for sequencer curves, that were not locked to frame */
 				if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
-					double mul = (seq->enddisp - seq->startdisp) / 100.0f;
-					double offset = seq->startdisp;
+					const float mul = (seq->enddisp - seq->startdisp) / 100.0f;
+					const float offset = seq->startdisp;
 					
 					dst->vec[0][0] *= mul;
 					dst->vec[0][0] += offset;
@@ -1645,7 +1645,7 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
 				/* by default, we now always extrapolate, while in the past this was optional */
 				if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0)
 					strip->extendmode = NLASTRIP_EXTEND_NOTHING;
-			}	
+			}
 			
 			/* try to add this strip to the current NLA-Track (i.e. the 'last' one on the stack atm) */
 			if (BKE_nlatrack_add_strip(nlt, strip) == 0) {
@@ -2093,7 +2093,7 @@ void do_versions_ipos_to_animato(Main *main)
 			bAction *new_act;
 			
 			/* add a new action for this, and convert all data into that action */
-			new_act = add_empty_action(id->name+2);
+			new_act = add_empty_action(id->name + 2);
 			ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers);
 			new_act->idroot = ipo->blocktype;
 		}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index b9bf2fd..782d796 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -389,7 +389,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl)
 			if (k1->next == NULL) k[0] = k1;
 			k1 = k1->next;
 		}
-		/* k1= k[1]; */ /* UNUSED */
+		/* k1 = k[1]; */ /* UNUSED */
 		t[0] = k[0]->pos;
 		t[1] += dpos;
 		t[2] = k[2]->pos + dpos;
@@ -609,7 +609,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
 			}
 		}
 		else k1 += start * key->elemsize;
-	}	
+	}
 	
 	if (mode == KEY_MODE_BEZTRIPLE) {
 		elemstr[0] = 1;
@@ -691,8 +691,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
 		if (nu->bp) {
 			step = nu->pntsu * nu->pntsv;
 
-			a1 = maxi(a, start);
-			a2 = mini(a + step, end);
+			a1 = max_ii(a, start);
+			a2 = min_ii(a + step, end);
 
 			if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
 		}
@@ -700,8 +700,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
 			step = 3 * nu->pntsu;
 
 			/* exception because keys prefer to work with complete blocks */
-			a1 = maxi(a, start);
-			a2 = mini(a + step, end);
+			a1 = max_ii(a, start);
+			a2 = min_ii(a + step, end);
 
 			if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
 		}
@@ -1043,7 +1043,7 @@ static float *get_weights_array(Object *ob, char *vgroup)
 	
 	/* find the group (weak loop-in-loop) */
 	defgrp_index = defgroup_name_index(ob, vgroup);
-	if (defgrp_index >= 0) {
+	if (defgrp_index != -1) {
 		float *weights;
 		int i;
 		
@@ -1217,7 +1217,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
 					remain = step;
 				}
 
-				count = mini(remain, estep);
+				count = min_ii(remain, estep);
 				if (mode == KEY_MODE_BEZTRIPLE) {
 					count += 3 - count % 3;
 				}
@@ -1268,7 +1268,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
 				do_key(a, a + 1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY);
 			else
 				cp_key(a, a + 1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
-		}		
+		}
 	}
 	else {
 		if (key->type == KEY_RELATIVE) {
@@ -1584,7 +1584,7 @@ void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
 	fp = kb->data;
 
 	tot = lt->pntsu * lt->pntsv * lt->pntsw;
-	tot = mini(kb->totelem, tot);
+	tot = min_ii(kb->totelem, tot);
 
 	for (a = 0; a < tot; a++, fp += 3, bp++) {
 		copy_v3_v3(bp->vec, fp);
@@ -1656,7 +1656,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
 
 	tot = BKE_nurbList_verts_count(nurb);
 
-	tot = mini(kb->totelem, tot);
+	tot = min_ii(kb->totelem, tot);
 
 	while (nu && tot > 0) {
 
@@ -1724,7 +1724,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
 	mvert = me->mvert;
 	fp = kb->data;
 
-	tot = mini(kb->totelem, me->totvert);
+	tot = min_ii(kb->totelem, me->totvert);
 
 	for (a = 0; a < tot; a++, fp += 3, mvert++) {
 		copy_v3_v3(mvert->co, fp);
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 4782d09..2f37db8 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -33,9 +33,12 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_anim_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
+#include "DNA_node_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 #include "DNA_texture_types.h"
 
 #include "BLI_listbase.h"
@@ -73,7 +76,7 @@ Lamp *BKE_lamp_add(const char *name)
 	la->soft = 3.0f;
 	la->compressthresh = 0.05f;
 	la->ray_samp = la->ray_sampy = la->ray_sampz = 1;
-	la->area_size = la->area_sizey = la->area_sizez = 1.0f;
+	la->area_size = la->area_sizey = la->area_sizez = 0.1f;
 	la->buffers = 1;
 	la->buftype = LA_SHADBUF_HALFWAY;
 	la->ray_samp_method = LA_SAMP_HALTON;
@@ -232,3 +235,38 @@ void BKE_lamp_free(Lamp *la)
 	la->id.icon_id = 0;
 }
 
+/* Calculate all drivers for lamps, see material_drivers_update for why this is a bad hack */
+
+static void lamp_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime)
+{
+	bNode *node;
+
+	/* nodetree itself */
+	if (ntree->adt && ntree->adt->drivers.first)
+		BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS);
+	
+	/* nodes */
+	for (node = ntree->nodes.first; node; node = node->next)
+		if (node->id && node->type == NODE_GROUP)
+			lamp_node_drivers_update(scene, (bNodeTree *)node->id, ctime);
+}
+
+void lamp_drivers_update(Scene *scene, Lamp *la, float ctime)
+{
+	/* Prevent infinite recursion by checking (and tagging the lamp) as having been visited already
+	 * (see BKE_scene_update_tagged()). This assumes la->id.flag & LIB_DOIT isn't set by anything else
+	 * in the meantime... [#32017] */
+	if (la->id.flag & LIB_DOIT)
+		return;
+	else
+		la->id.flag |= LIB_DOIT;
+	
+	/* lamp itself */
+	if (la->adt && la->adt->drivers.first)
+		BKE_animsys_evaluate_animdata(scene, &la->id, la->adt, ctime, ADT_RECALC_DRIVERS);
+	
+	/* nodes */
+	if (la->nodetree)
+		lamp_node_drivers_update(scene, la->nodetree, ctime);
+}
+
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index bb871f0..a15ca7c 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -64,19 +64,19 @@
 #include "BKE_deform.h"
 
 
-void calc_lat_fudu(int flag, int res, float *fu, float *du)
+void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
 {
 	if (res == 1) {
-		*fu = 0.0;
-		*du = 0.0;
+		*r_fu = 0.0;
+		*r_du = 0.0;
 	}
 	else if (flag & LT_GRID) {
-		*fu = -0.5f * (res - 1);
-		*du = 1.0f;
+		*r_fu = -0.5f * (res - 1);
+		*r_du = 1.0f;
 	}
 	else {
-		*fu = -1.0f;
-		*du = 2.0f / (res - 1);
+		*r_fu = -1.0f;
+		*r_du = 2.0f / (res - 1);
 	}
 }
 
@@ -348,7 +348,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight)
 	int ui, vi, wi, uu, vv, ww;
 
 	/* vgroup influence */
-	int defgroup_nr = -1;
+	int defgrp_index = -1;
 	float co_prev[3], weight_blend = 0.0f;
 	MDeformVert *dvert = BKE_lattice_deform_verts_get(ob);
 
@@ -357,7 +357,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight)
 	if (lt->latticedata == NULL) return;
 
 	if (lt->vgroup[0] && dvert) {
-		defgroup_nr = defgroup_name_index(ob, lt->vgroup);
+		defgrp_index = defgroup_name_index(ob, lt->vgroup);
 		copy_v3_v3(co_prev, co);
 	}
 
@@ -431,8 +431,8 @@ void calc_latt_deform(Object *ob, float co[3], float weight)
 
 							madd_v3_v3fl(co, &lt->latticedata[idx_u * 3], u);
 
-							if (defgroup_nr != -1)
-								weight_blend += (u * defvert_find_weight(dvert + idx_u, defgroup_nr));
+							if (defgrp_index != -1)
+								weight_blend += (u * defvert_find_weight(dvert + idx_u, defgrp_index));
 						}
 					}
 				}
@@ -440,7 +440,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight)
 		}
 	}
 
-	if (defgroup_nr != -1)
+	if (defgrp_index != -1)
 		interp_v3_v3v3(co, co_prev, co, weight_blend);
 
 }
@@ -669,9 +669,9 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 	
 	if (vgroup && vgroup[0] && use_vgroups) {
 		Mesh *me = target->data;
-		int index = defgroup_name_index(target, vgroup);
+		const int defgrp_index = defgroup_name_index(target, vgroup);
 
-		if (index != -1 && (me->dvert || dm)) {
+		if (defgrp_index != -1 && (me->dvert || dm)) {
 			MDeformVert *dvert = me->dvert;
 			float vec[3];
 			float weight;
@@ -681,7 +681,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 				dvert = me->dvert;
 				for (a = 0; a < numVerts; a++, dvert++) {
 					if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
-					weight = defvert_find_weight(dvert, index);
+					weight = defvert_find_weight(dvert, defgrp_index);
 	
 					if (weight > 0.0f) {
 						mul_m4_v3(cd.curvespace, vertexCos[a]);
@@ -699,7 +699,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 				for (a = 0; a < numVerts; a++, dvert++) {
 					if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 					
-					if (defvert_find_weight(dvert, index) > 0.0f) {
+					if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
 						mul_m4_v3(cd.curvespace, vertexCos[a]);
 						minmax_v3v3_v3(cd.dmin, cd.dmax, vertexCos[a]);
 					}
@@ -709,7 +709,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 				for (a = 0; a < numVerts; a++, dvert++) {
 					if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 					
-					weight = defvert_find_weight(dvert, index);
+					weight = defvert_find_weight(dvert, defgrp_index);
 	
 					if (weight > 0.0f) {
 						/* already in 'cd.curvespace', prev for loop */
@@ -815,16 +815,16 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
 	
 	if (vgroup && vgroup[0] && use_vgroups) {
 		Mesh *me = target->data;
-		int index = defgroup_name_index(target, vgroup);
+		const int defgrp_index = defgroup_name_index(target, vgroup);
 		float weight;
 
-		if (index >= 0 && (me->dvert || dm)) {
+		if (defgrp_index >= 0 && (me->dvert || dm)) {
 			MDeformVert *dvert = me->dvert;
 			
 			for (a = 0; a < numVerts; a++, dvert++) {
 				if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 
-				weight = defvert_find_weight(dvert, index);
+				weight = defvert_find_weight(dvert, defgrp_index);
 
 				if (weight > 0.0f)
 					calc_latt_deform(laOb, vertexCos[a], weight * fac);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 45364f5..eb0612a 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -796,6 +796,18 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata
 	}
 }
 
+void BKE_libblock_free_data(ID *id)
+{
+	Main *bmain = G.main;  /* should eventually be an arg */
+	
+	if (id->properties) {
+		IDP_FreeProperty(id->properties);
+		MEM_freeN(id->properties);
+	}
+	
+	/* this ID may be a driver target! */
+	BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
+}
 
 /* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */
 void BKE_libblock_free(ListBase *lb, void *idv)
@@ -904,15 +916,9 @@ void BKE_libblock_free(ListBase *lb, void *idv)
 			break;
 	}
 
-	if (id->properties) {
-		IDP_FreeProperty(id->properties);
-		MEM_freeN(id->properties);
-	}
-
 	BLI_remlink(lb, id);
 
-	/* this ID may be a driver target! */
-	BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
+	BKE_libblock_free_data(id);
 
 	MEM_freeN(id);
 }
@@ -992,7 +998,6 @@ void free_main(Main *mainvar)
 #endif
 		}
 	}
-	a = set_listbasepointers(mainvar, lbarray);
 
 	MEM_freeN(mainvar);
 }
@@ -1200,7 +1205,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
 	char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8];
 
 	/* make sure input name is terminated properly */
-	/* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */
+	/* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3] = 0; */
 	/* removed since this is only ever called from one place - campbell */
 
 	while (1) {
@@ -1515,7 +1520,9 @@ void test_idbutton(char *name)
 	/* search for id */
 	idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
 
-	if (idtest) if (new_id(lb, idtest, name) == 0) id_sort_by_name(lb, idtest);
+	if (idtest && (new_id(lb, idtest, name) == 0)) {
+		id_sort_by_name(lb, idtest);
+	}
 }
 
 void text_idbutton(struct ID *id, char *text)
@@ -1547,7 +1554,7 @@ void rename_id(ID *id, const char *name)
 	BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2);
 	lb = which_libbase(G.main, GS(id->name) );
 	
-	new_id(lb, id, name);				
+	new_id(lb, id, name);
 }
 
 void name_uiprefix_id(char *name, ID *id)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index aa19350..bda9240 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -378,8 +378,8 @@ float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point,
 
 				if (len_squared_v2(v1) > proj_eps_squared) {
 					ang1 = angle_v2v2(v1, n1);
-					if (ang1 > M_PI / 2.0f)
-						ang1 = M_PI  - ang1;
+					if (ang1 > (float)M_PI / 2.0f)
+						ang1 = (float)M_PI - ang1;
 
 					if (ang < 0.0f || ang1 < ang) {
 						ang = ang1;
@@ -405,8 +405,8 @@ float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point,
 
 				if (len_squared_v2(v2) > proj_eps_squared) {
 					ang2 = angle_v2v2(v2, n2);
-					if (ang2 > M_PI / 2.0f)
-						ang2 = M_PI  - ang2;
+					if (ang2 > (float)M_PI / 2.0f)
+						ang2 = (float)M_PI - ang2;
 
 					if (ang2 < ang) {
 						ang = ang2;
@@ -555,7 +555,7 @@ float BKE_mask_point_weight_scalar(MaskSpline *spline, MaskSplinePoint *point, c
 	if (!bezt_next) {
 		return bezt->weight;
 	}
-	else if (u <= 0.0) {
+	else if (u <= 0.0f) {
 		return bezt->weight;
 	}
 	else if (u >= 1.0f) {
@@ -576,7 +576,7 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const fl
 	if (!bezt_next) {
 		return bezt->weight;
 	}
-	else if (u <= 0.0) {
+	else if (u <= 0.0f) {
 		return bezt->weight;
 	}
 	else if (u >= 1.0f) {
@@ -1416,7 +1416,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do
 
 		for (spline = masklay->splines.first; spline; spline = spline->next) {
 			int i;
-			int has_auto = FALSE;
+			int need_handle_recalc = FALSE;
 
 			BKE_mask_spline_ensure_deform(spline);
 
@@ -1436,16 +1436,16 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do
 					add_v2_v2(point_deform->bezt.vec[2], delta);
 				}
 
-				if (point->bezt.h1 == HD_AUTO) {
-					has_auto = TRUE;
+				if (ELEM(point->bezt.h1, HD_AUTO, HD_VECT)) {
+					need_handle_recalc = TRUE;
 				}
 			}
 
-			/* if the spline has auto handles, these need to be recalculated after deformation */
-			if (has_auto) {
+			/* if the spline has auto or vector handles, these need to be recalculated after deformation */
+			if (need_handle_recalc) {
 				for (i = 0; i < spline->tot_point; i++) {
 					MaskSplinePoint *point_deform = &spline->points_deform[i];
-					if (point_deform->bezt.h1 == HD_AUTO) {
+					if (ELEM(point_deform->bezt.h1, HD_AUTO, HD_VECT)) {
 						BKE_mask_calc_handle_point(spline, point_deform);
 					}
 				}
@@ -1805,7 +1805,7 @@ static void interp_weights_uv_v2_calc(float r_uv[2], const float pt[2], const fl
 	float pt_on_line[2];
 	r_uv[0] = closest_to_line_v2(pt_on_line, pt, pt_a, pt_b);
 	r_uv[1] = (len_v2v2(pt_on_line, pt) / len_v2v2(pt_a, pt_b)) *
-	          ((line_point_side_v2(pt_a, pt_b, pt) < 0.0f) ? -1.0 : 1.0);  /* this line only sets the sign */
+	          ((line_point_side_v2(pt_a, pt_b, pt) < 0.0f) ? -1.0f : 1.0f);  /* this line only sets the sign */
 }
 
 
@@ -1955,5 +1955,5 @@ void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int coun
 
 int BKE_mask_get_duration(Mask *mask)
 {
-	return maxi(1, mask->efra - mask->sfra);
+	return max_ii(1, mask->efra - mask->sfra);
 }
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index 4a8601d..a2f6b3c 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -69,7 +69,7 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh
 	unsigned int i, resol = 1;
 
 	if (width != 0 && height != 0) {
-		max_segment = 1.0f / (float)maxi(width, height);
+		max_segment = 1.0f / (float)max_ii(width, height);
 	}
 
 	for (i = 0; i < spline->tot_point; i++) {
@@ -131,7 +131,7 @@ unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, i
 			if (u_diff > FLT_EPSILON) {
 				float jump = fabsf(w_diff / u_diff);
 
-				max_jump = MAX2(max_jump, jump);
+				max_jump = max_ff(max_jump, jump);
 			}
 
 			prev_u = point->uw[j].u;
@@ -245,7 +245,7 @@ static void feather_bucket_add_edge(FeatherEdgesBucket *bucket, int start, int e
 		}
 		else {
 			bucket->segments = MEM_reallocN(bucket->segments,
-					(alloc_delta + bucket->tot_segment) * sizeof(*bucket->segments));
+			                                (alloc_delta + bucket->tot_segment) * sizeof(*bucket->segments));
 		}
 
 		bucket->alloc_segment += alloc_delta;
@@ -289,10 +289,10 @@ static void feather_bucket_check_intersect(float (*feather_points)[2], int tot_f
 			/* collapse loop with smaller AABB */
 			for (k = 0; k < tot_feather_point; k++) {
 				if (k >= check_b && k <= cur_a) {
-					DO_MINMAX2(feather_points[k], min_a, max_a);
+					minmax_v2v2_v2(min_a, max_a, feather_points[k]);
 				}
 				else {
-					DO_MINMAX2(feather_points[k], min_b, max_b);
+					minmax_v2v2_v2(min_b, max_b, feather_points[k]);
 				}
 			}
 
@@ -379,7 +379,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe
 		int next = i + 1;
 		float delta;
 
-		DO_MINMAX2(feather_points[i], min, max);
+		minmax_v2v2_v2(min, max, feather_points[i]);
 
 		if (next == tot_feather_point) {
 			if (spline->flag & MASK_SPLINE_CYCLIC)
@@ -418,7 +418,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe
 
 	max_delta = MAX2(max_delta_x, max_delta_y);
 
-	buckets_per_side = MIN2(512, 0.9f / max_delta);
+	buckets_per_side = min_ii(512, 0.9f / max_delta);
 
 	if (buckets_per_side == 0) {
 		/* happens when some segment fills the whole bounding box across some of dimension */
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 13ad996..2fa928e 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -104,7 +104,7 @@
 
 /* for debugging add... */
 #ifndef NDEBUG
-/* 	printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]); \ */
+/* printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]); \ */
 #  define FACE_ASSERT(face, vert_max)                    \
 {                                                        \
 	unsigned int *_t = face;                             \
@@ -428,7 +428,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 		/* width and height of each bucket */
 		const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / layer->buckets_x;
 		const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / layer->buckets_y;
-		const float bucket_max_rad = (maxf(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON;
+		const float bucket_max_rad = (max_ff(bucket_size_x, bucket_size_y) * (float)M_SQRT2) + FLT_EPSILON;
 		const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
 
 		unsigned int *face = &layer->face_array[0][0];
@@ -451,10 +451,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 				const float *v2 = cos[face[1]];
 				const float *v3 = cos[face[2]];
 
-				xmin = minf(v1[0], minf(v2[0], v3[0]));
-				xmax = maxf(v1[0], maxf(v2[0], v3[0]));
-				ymin = minf(v1[1], minf(v2[1], v3[1]));
-				ymax = maxf(v1[1], maxf(v2[1], v3[1]));
+				xmin = min_ff(v1[0], min_ff(v2[0], v3[0]));
+				xmax = max_ff(v1[0], max_ff(v2[0], v3[0]));
+				ymin = min_ff(v1[1], min_ff(v2[1], v3[1]));
+				ymax = max_ff(v1[1], max_ff(v2[1], v3[1]));
 			}
 			else {
 				const float *v1 = cos[face[0]];
@@ -462,10 +462,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 				const float *v3 = cos[face[2]];
 				const float *v4 = cos[face[3]];
 
-				xmin = minf(v1[0], minf(v2[0], minf(v3[0], v4[0])));
-				xmax = maxf(v1[0], maxf(v2[0], maxf(v3[0], v4[0])));
-				ymin = minf(v1[1], minf(v2[1], minf(v3[1], v4[1])));
-				ymax = maxf(v1[1], maxf(v2[1], maxf(v3[1], v4[1])));
+				xmin = min_ff(v1[0], min_ff(v2[0], min_ff(v3[0], v4[0])));
+				xmax = max_ff(v1[0], max_ff(v2[0], max_ff(v3[0], v4[0])));
+				ymin = min_ff(v1[1], min_ff(v2[1], min_ff(v3[1], v4[1])));
+				ymax = max_ff(v1[1], max_ff(v2[1], max_ff(v3[1], v4[1])));
 			}
 
 
@@ -503,7 +503,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 							BLI_assert(bucket_index < bucket_tot);
 
 							/* check if the bucket intersects with the face */
-							/* note: there is a tradeoff here since checking box/tri intersections isn't
+							/* note: there is a trade off here since checking box/tri intersections isn't
 							 * as optimal as it could be, but checking pixels against faces they will never intersect
 							 * with is likely the greater slowdown here - so check if the cell intersects the face */
 							if (layer_bucket_isect_test(layer, face_index,
@@ -560,7 +560,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                                    const short do_feather)
 {
 	const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f};
-	const float pixel_size = 1.0f / MIN2(width, height);
+	const float pixel_size = 1.0f / (float)min_ii(width, height);
 	const float asp_xy[2] = {(do_aspect_correct && width > height) ? (float)height / (float)width  : 1.0f,
 	                         (do_aspect_correct && width < height) ? (float)width  / (float)height : 1.0f};
 
@@ -933,7 +933,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
 			}
 
 			/* main scan-fill */
-			sf_tri_tot = BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
+			sf_tri_tot = BLI_scanfill_calc_ex(&sf_ctx, 0, zvec);
 
 			face_array = MEM_mallocN(sizeof(*face_array) * (sf_tri_tot + tot_feather_quads), "maskrast_face_index");
 			face_index = 0;
@@ -1335,10 +1335,10 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
 				value -= value_layer;
 				break;
 			case MASK_BLEND_LIGHTEN:
-				value = maxf(value, value_layer);
+				value = max_ff(value, value_layer);
 				break;
 			case MASK_BLEND_DARKEN:
-				value = minf(value, value_layer);
+				value = min_ff(value, value_layer);
 				break;
 			case MASK_BLEND_MUL:
 				value *= value_layer;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index bea0e33..ea31795 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -38,6 +38,7 @@
 
 #include "DNA_anim_types.h"
 #include "DNA_curve_types.h"
+#include "DNA_group_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -214,7 +215,7 @@ Material *BKE_material_add(const char *name)
 	
 	init_material(ma);
 	
-	return ma;	
+	return ma;
 }
 
 /* XXX keep synced with next function */
@@ -903,7 +904,7 @@ short find_material_index(Object *ob, Material *ma)
 			break;
 	if (a < *totcolp)
 		return a + 1;
-	return 0;	   
+	return 0;
 }
 
 int object_add_material_slot(Object *ob)
@@ -969,7 +970,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 		ma->ambr = ma->amb * amb[0];
 		ma->ambg = ma->amb * amb[1];
 		ma->ambb = ma->amb * amb[2];
-	}	
+	}
 	/* will become or-ed result of all node modes */
 	ma->mode_l = ma->mode;
 	ma->mode_l &= ~MA_SHLESS;
@@ -980,6 +981,17 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 	/* parses the geom+tex nodes */
 	if (ma->nodetree && ma->use_nodes)
 		ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l);
+
+	/* local group override */
+	if ((ma->shade_flag & MA_GROUP_LOCAL) && ma->id.lib && ma->group && ma->group->id.lib) {
+		Group *group;
+
+		for (group = G.main->group.first; group; group = group->id.next) {
+			if (!group->id.lib && strcmp(group->id.name, ma->group->id.name) == 0) {
+				ma->group = group;
+			}
+		}
+	}
 }
 
 static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode, float *amb)
@@ -1147,7 +1159,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
 	
 /* ****************** */
 #if 0 /* UNUSED */
-static char colname_array[125][20]= {
+static char colname_array[125][20] = {
 "Black", "DarkRed", "HalfRed", "Red", "Red",
 "DarkGreen", "DarkOlive", "Brown", "Chocolate", "OrangeRed",
 "HalfGreen", "GreenOlive", "DryOlive", "Goldenrod", "DarkOrange",
@@ -1603,7 +1615,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall)
 	/* calculate the flag */
 	int flag = tf->mode;
 
-	/* options that change the material offline render */	
+	/* options that change the material offline render */
 	if (!convertall) {
 		flag &= ~TF_OBCOL;
 	}
@@ -1627,7 +1639,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall)
 /* set the material options based in the tface flag */
 static void decode_tfaceflag(Material *ma, int flag, int convertall)
 {
-	int alphablend;	
+	int alphablend;
 	GameSettings *game = &ma->game;
 
 	/* flag is shifted in 1 to make 0 != no flag yet (see encode_tfaceflag) */
@@ -1786,13 +1798,13 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
 			 * for now store the flag into the material and change light/tex/collision
 			 * store the flag as a negative number */
 			ma->game.flag = -flag;
-			id_us_min((ID *)ma);	
+			id_us_min((ID *)ma);
 		}
 		else printf("Error: Unable to create Material \"%s\" for Mesh \"%s\".", idname + 2, me->id.name + 2);
 	}
 
 	/* set as converted, no need to go bad to this face */
-	tf->mode |= TF_CONVERTED;	
+	tf->mode |= TF_CONVERTED;
 	return mat_nr;
 }
 
@@ -1845,7 +1857,7 @@ static void convert_tfacematerial(Main *main, Material *ma)
 				if (mat_new) {
 					/* rename the material*/
 					strcpy(mat_new->id.name, idname);
-					id_us_min((ID *)mat_new);	
+					id_us_min((ID *)mat_new);
 
 					mat_nr = mesh_addmaterial(me, mat_new);
 					decode_tfaceflag(mat_new, flag, 1);
@@ -2033,7 +2045,7 @@ int do_version_tface(Main *main, int fileload)
 				nowarning = 0;
 			}
 			else
-				convert_tfacematerial(main, ma);			continue;	
+				convert_tfacematerial(main, ma); continue;
 		}
 	
 		/* no conflicts in this material - 90% of cases
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 592101f..805e77c 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1319,12 +1319,16 @@ static void addtovertices(VERTICES *vertices, VERTEX v)
 
 static void vnormal(const float point[3], PROCESS *p, float r_no[3])
 {
-	float delta = 0.2f * p->delta;
-	float f = p->function(point[0], point[1], point[2]);
+	const float delta = 0.2f * p->delta;
+	const float f = p->function(point[0], point[1], point[2]);
 
 	r_no[0] = p->function(point[0] + delta, point[1], point[2]) - f;
 	r_no[1] = p->function(point[0], point[1] + delta, point[2]) - f;
 	r_no[2] = p->function(point[0], point[1], point[2] + delta) - f;
+
+#if 1
+	normalize_v3(r_no);
+#else
 	f = normalize_v3(r_no);
 	
 	if (0) {
@@ -1343,6 +1347,7 @@ static void vnormal(const float point[3], PROCESS *p, float r_no[3])
 			normalize_v3(r_no);
 		}
 	}
+#endif
 }
 
 
@@ -1500,7 +1505,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 	float f = 0.0f;
 
 	ml = G_mb.mainb[a];
-	f = 1.0 - (mb->thresh / ml->s);
+	f = 1.0f - (mb->thresh / ml->s);
 
 	/* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
 	 * visible alone ... but still can influence others MetaElements :-) */
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 1aaeebf..036f8f5 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -469,15 +469,17 @@ void free_dverts(MDeformVert *dvert, int totvert)
 
 static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
 {
-	if (free_customdata)
+	if (free_customdata) {
 		CustomData_free(&mesh->fdata, mesh->totface);
+	}
+	else {
+		CustomData_reset(&mesh->fdata);
+	}
 
 	mesh->mface = NULL;
 	mesh->mtface = NULL;
 	mesh->mcol = NULL;
 	mesh->totface = 0;
-
-	memset(&mesh->fdata, 0, sizeof(mesh->fdata));
 }
 
 Mesh *BKE_mesh_add(const char *name)
@@ -491,7 +493,13 @@ Mesh *BKE_mesh_add(const char *name)
 	me->texflag = ME_AUTOSPACE;
 	me->flag = ME_TWOSIDED;
 	me->drawflag = ME_DRAWEDGES | ME_DRAWFACES | ME_DRAWCREASES;
-	
+
+	CustomData_reset(&me->vdata);
+	CustomData_reset(&me->edata);
+	CustomData_reset(&me->fdata);
+	CustomData_reset(&me->pdata);
+	CustomData_reset(&me->ldata);
+
 	return me;
 }
 
@@ -576,7 +584,7 @@ static void expand_local_mesh(Mesh *me)
 
 		for (i = 0; i < me->pdata.totlayer; i++) {
 			if (me->pdata.layers[i].type == CD_MTEXPOLY) {
-				MTexPoly *txface = (MTexPoly *)me->fdata.layers[i].data;
+				MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
 
 				for (a = 0; a < me->totpoly; a++, txface++) {
 					/* special case: ima always local immediately */
@@ -735,7 +743,7 @@ float *BKE_mesh_orco_verts_get(Object *ob)
 	/* Get appropriate vertex coordinates */
 	vcos = MEM_callocN(sizeof(*vcos) * me->totvert, "orco mesh");
 	mvert = tme->mvert;
-	totvert = MIN2(tme->totvert, me->totvert);
+	totvert = min_ii(tme->totvert, me->totvert);
 
 	for (a = 0; a < totvert; a++, mvert++) {
 		copy_v3_v3(vcos[a], mvert->co);
@@ -2039,7 +2047,7 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata,
 		MDisps *ld = CustomData_get(ldata, loopstart, CD_MDISPS);
 		MDisps *fd = CustomData_get(fdata, findex, CD_MDISPS);
 		float (*disps)[3] = fd->disps;
-		int i, tot = mf->v4 ? 4 : 3;
+		int tot = mf->v4 ? 4 : 3;
 		int side, corners;
 
 		if (CustomData_external_test(fdata, CD_MDISPS)) {
@@ -2125,8 +2133,6 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
 	/* just in case some of these layers are filled in (can happen with python created meshes) */
 	CustomData_free(ldata, totloop_i);
 	CustomData_free(pdata, totpoly_i);
-	memset(ldata, 0, sizeof(*ldata));
-	memset(pdata, 0, sizeof(*pdata));
 
 	totpoly = totface_i;
 	mpoly = MEM_callocN(sizeof(MPoly) * totpoly, "mpoly converted");
@@ -2163,7 +2169,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
 		me->flag &= ~ME_FGON;
 	}
 
-	polyindex = CustomData_get_layer(fdata, CD_POLYINDEX);
+	polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
 
 	j = 0; /* current loop index */
 	ml = mloop;
@@ -2382,7 +2388,7 @@ void create_vert_poly_map(MeshElemMap **map, int **mem,
  * of edges that use that vertex as an endpoint. The lists are allocated
  * from one memory pool. */
 void create_vert_edge_map(MeshElemMap **map, int **mem,
-						  const MEdge *medge, int totvert, int totedge)
+                          const MEdge *medge, int totvert, int totedge)
 {
 	int i, *indices;
 
@@ -2505,12 +2511,9 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 	ScanFillContext sf_ctx;
 	ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first;
 	ScanFillFace *sf_tri;
-	int *mface_orig_index = NULL;
-	BLI_array_declare(mface_orig_index);
 	int *mface_to_poly_map = NULL;
 	BLI_array_declare(mface_to_poly_map);
 	int lindex[4]; /* only ever use 3 in this case */
-	int *poly_orig_index;
 	int poly_index, j, mface_index;
 
 	const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
@@ -2528,7 +2531,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 
 	mface_index = 0;
 	mp = mpoly;
-	poly_orig_index = CustomData_get_layer(pdata, CD_ORIGINDEX);
 	for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) {
 		if (mp->totloop < 3) {
 			/* do nothing */
@@ -2548,10 +2550,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 		mf->v4 = 0;                                                           \
 		mf->mat_nr = mp->mat_nr;                                              \
 		mf->flag = mp->flag;                                                  \
-		if (poly_orig_index) {                                                \
-			BLI_array_append(mface_orig_index,                                \
-		                     poly_orig_index[poly_index]);                    \
-		}                                                                     \
 		(void)0
 
 /* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */
@@ -2567,10 +2565,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 		mf->v4 = mp->loopstart + 3; /* EXCEPTION */                           \
 		mf->mat_nr = mp->mat_nr;                                              \
 		mf->flag = mp->flag;                                                  \
-		if (poly_orig_index) {                                                \
-			BLI_array_append(mface_orig_index,                                \
-		                     poly_orig_index[poly_index]);                    \
-		}                                                                     \
 		mf->edcode |= TESSFACE_IS_QUAD; /* EXCEPTION */                       \
 		(void)0
 
@@ -2613,13 +2607,10 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 			}
 			BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert_first);
 			
-			totfilltri = BLI_scanfill_calc(&sf_ctx, FALSE);
+			totfilltri = BLI_scanfill_calc(&sf_ctx, 0);
 			if (totfilltri) {
 				BLI_array_grow_items(mface_to_poly_map, totfilltri);
 				BLI_array_grow_items(mface, totfilltri);
-				if (poly_orig_index) {
-					BLI_array_grow_items(mface_orig_index, totfilltri);
-				}
 
 				for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next, mf++) {
 					mface_to_poly_map[mface_index] = poly_index;
@@ -2638,10 +2629,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 					mf->edcode |= TESSFACE_SCANFILL; /* tag for sorting loop indices */
 #endif
 
-					if (poly_orig_index) {
-						mface_orig_index[mface_index] = poly_orig_index[poly_index];
-					}
-
 					mface_index++;
 				}
 			}
@@ -2651,7 +2638,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 	}
 
 	CustomData_free(fdata, totface);
-	memset(fdata, 0, sizeof(CustomData));
 	totface = mface_index;
 
 
@@ -2659,23 +2645,13 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
 	if (LIKELY((MEM_allocN_len(mface) / sizeof(*mface)) != totface)) {
 		mface = MEM_reallocN(mface, sizeof(*mface) * totface);
 		mface_to_poly_map = MEM_reallocN(mface_to_poly_map, sizeof(*mface_to_poly_map) * totface);
-		if (mface_orig_index) {
-			mface_orig_index = MEM_reallocN(mface_orig_index, sizeof(*mface_orig_index) * totface);
-		}
 	}
 
 	CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface);
 
-	/* CD_POLYINDEX will contain an array of indices from tessfaces to the polygons
+	/* CD_ORIGINDEX will contain an array of indices from tessfaces to the polygons
 	 * they are directly tessellated from */
-	CustomData_add_layer(fdata, CD_POLYINDEX, CD_ASSIGN, mface_to_poly_map, totface);
-	if (mface_orig_index) {
-		/* If polys had a CD_ORIGINDEX layer, then the tessellated faces will get this
-		 * layer as well, pointing to polys from the original mesh (not the polys
-		 * that just got tessellated) */
-		CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_orig_index, totface);
-	}
-
+	CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_to_poly_map, totface);
 	CustomData_from_bmeshpoly(fdata, pdata, ldata, totface);
 
 	if (do_face_nor_cpy) {
@@ -2806,7 +2782,6 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 	}
 
 	CustomData_free(fdata, totface);
-	memset(fdata, 0, sizeof(CustomData));
 
 	totface = k;
 
@@ -3036,7 +3011,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
 		MLoop *l_iter = loopstart;
 		float area, polynorm_local[3], (*vertexcos)[3];
 		const float *no = polynormal ? polynormal : polynorm_local;
-		BLI_array_fixedstack_declare(vertexcos, BM_NGON_STACK_SIZE, mpoly->totloop, __func__);
+		BLI_array_fixedstack_declare(vertexcos, BM_DEFAULT_NGON_STACK_SIZE, mpoly->totloop, __func__);
 
 		/* pack vertex cos into an array for area_poly_v3 */
 		for (i = 0; i < mpoly->totloop; i++, l_iter++) {
@@ -3175,6 +3150,32 @@ int BKE_mesh_center_bounds(Mesh *me, float cent[3])
 	return 0;
 }
 
+int BKE_mesh_center_centroid(Mesh *me, float cent[3])
+{
+	int i = me->totpoly;
+	MPoly *mpoly;
+	float poly_area;
+	float total_area = 0.0f;
+	float poly_cent[3];
+	
+	zero_v3(cent);
+	
+	/* calculate a weighted average of polygon centroids */
+	for (mpoly = me->mpoly; i--; mpoly++) {
+		BKE_mesh_calc_poly_center(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent);
+		poly_area = BKE_mesh_calc_poly_area(mpoly, me->mloop + mpoly->loopstart, me->mvert, NULL);
+		
+		madd_v3_v3fl(cent, poly_cent, poly_area);
+		total_area += poly_area;
+	}
+	/* otherwise we get NAN for 0 polys */
+	if (me->totpoly) {
+		mul_v3_fl(cent, 1.0f / total_area);
+	}
+
+	return (me->totpoly != 0);
+}
+
 void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys)
 {
 	int i = me->totvert;
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 79e3fc1..128b9ae 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -228,7 +228,6 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
 	}
 
 	for (i = 1; i < totvert; i++, mv++) {
-		int j;
 		int fix_normal = TRUE;
 
 		for (j = 0; j < 3; j++) {
@@ -717,7 +716,6 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
 		MDeformVert *dv;
 		for (i = 0, dv = dverts; i < totvert; i++, dv++) {
 			MDeformWeight *dw;
-			unsigned int j;
 
 			for (j = 0, dw = dv->dw; j < dv->totweight; j++, dw++) {
 				/* note, greater then max defgroups is accounted for in our code, but not < 0 */
@@ -914,7 +912,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 {
 	CustomData edata;
 	EdgeHashIterator *ehi;
-	MPoly *mp = mesh->mpoly;
+	MPoly *mp;
 	MEdge *med, *med_orig;
 	EdgeHash *eh = BLI_edgehash_new();
 	int i, totedge, totpoly = mesh->totpoly;
@@ -932,7 +930,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 	}
 
 	/* mesh loops (bmesh only) */
-	for (i = 0; i < totpoly; i++, mp++) {
+	for (mp = mesh->mpoly, i = 0; i < totpoly; mp++, i++) {
 		MLoop *l = &mesh->mloop[mp->loopstart];
 		int j, l_prev = (l + (mp->totloop - 1))->v;
 		for (j = 0; j < mp->totloop; j++, l++) {
@@ -946,7 +944,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 	totedge = BLI_edgehash_size(eh);
 
 	/* write new edges into a temporary CustomData */
-	memset(&edata, 0, sizeof(edata));
+	CustomData_reset(&edata);
 	CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
 
 	med = CustomData_get_layer(&edata, CD_MEDGE);
@@ -970,8 +968,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 	if (mesh->totpoly) {
 		/* second pass, iterate through all loops again and assign
 		 * the newly created edges to them. */
-		MPoly *mp = mesh->mpoly;
-		for (i = 0; i < mesh->totpoly; i++, mp++) {
+		for (mp = mesh->mpoly, i = 0; i < mesh->totpoly; mp++, i++) {
 			MLoop *l = &mesh->mloop[mp->loopstart];
 			MLoop *l_prev = (l + (mp->totloop - 1));
 			int j;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index f072ed4..25b70ce 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -55,6 +55,8 @@
 #include "BLI_linklist.h"
 #include "BLI_string.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_cloth.h"
 #include "BKE_key.h"
 #include "BKE_multires.h"
@@ -247,24 +249,25 @@ int modifier_couldBeCage(struct Scene *scene, ModifierData *md)
 	        modifier_supportsMapping(md));
 }
 
-int modifier_sameTopology(ModifierData *md)
+int modifier_isSameTopology(ModifierData *md)
 {
 	ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 	return ELEM(mti->type, eModifierTypeType_OnlyDeform, eModifierTypeType_NonGeometrical);
 }
 
-int modifier_nonGeometrical(ModifierData *md)
+int modifier_isNonGeometrical(ModifierData *md)
 {
 	ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 	return (mti->type == eModifierTypeType_NonGeometrical);
 }
 
-void modifier_setError(ModifierData *md, const char *format, ...)
+void modifier_setError(ModifierData *md, const char *_format, ...)
 {
 	char buffer[512];
 	va_list ap;
+	const char *format = TIP_(_format);
 
-	va_start(ap, format);
+	va_start(ap, _format);
 	vsnprintf(buffer, sizeof(buffer), format, ap);
 	va_end(ap);
 	buffer[sizeof(buffer) - 1] = '\0';
@@ -494,8 +497,8 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
 
 	return md;
 }
-/* Takes an object and returns its first selected armature, else just its
- * armature
+
+/* Takes an object and returns its first selected armature, else just its armature
  * This should work for multiple armatures per object
  */
 Object *modifiers_isDeformedByArmature(Object *ob)
@@ -518,9 +521,8 @@ Object *modifiers_isDeformedByArmature(Object *ob)
 	return NULL;
 }
 
-/* Takes an object and returns its first selected lattice, else just its
- * lattice
- * This should work for multiple lattics per object
+/* Takes an object and returns its first selected lattice, else just its lattice
+ * This should work for multiple lattices per object
  */
 Object *modifiers_isDeformedByLattice(Object *ob)
 {
@@ -542,7 +544,28 @@ Object *modifiers_isDeformedByLattice(Object *ob)
 	return NULL;
 }
 
-
+/* Takes an object and returns its first selected curve, else just its curve
+ * This should work for multiple curves per object
+ */
+Object *modifiers_isDeformedByCurve(Object *ob)
+{
+	ModifierData *md = modifiers_getVirtualModifierList(ob);
+	CurveModifierData *cmd = NULL;
+	
+	/* return the first selected curve, this lets us use multiple curves */
+	for (; md; md = md->next) {
+		if (md->type == eModifierType_Curve) {
+			cmd = (CurveModifierData *) md;
+			if (cmd->object && (cmd->object->flag & SELECT))
+				return cmd->object;
+		}
+	}
+	
+	if (cmd) /* if were still here then return the last curve */
+		return cmd->object;
+	
+	return NULL;
+}
 
 int modifiers_usesArmature(Object *ob, bArmature *arm)
 {
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index dc3d4a8..381e435 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -55,6 +55,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 	BLI_array_declare(verts);
 	BLI_array_declare(edges);
 	int i, j, k, totvert, totedge /* , totface */ /* UNUSED */ ;
+	int is_init = (bm->totvert == 0) && (bm->totedge == 0) && (bm->totface == 0);
 
 	/*merge custom data layout*/
 	CustomData_bmesh_merge(&dm->vertData, &bm->vdata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_VERT);
@@ -78,9 +79,10 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 	/*do verts*/
 	mv = mvert = dm->dupVertArray(dm);
 	for (i = 0; i < totvert; i++, mv++) {
-		v = BM_vert_create(bm, mv->co, NULL);
+		v = BM_vert_create(bm, mv->co, NULL, BM_CREATE_SKIP_CD);
 		normal_short_to_float_v3(v->no, mv->no);
 		v->head.hflag = BM_vert_flag_from_mflag(mv->flag);
+		BM_elem_index_set(v, i); /* set_inline */
 
 		CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, &v->head.data);
 
@@ -89,13 +91,16 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 		vtable[i] = v;
 	}
 	MEM_freeN(mvert);
+	if (is_init) bm->elem_index_dirty &= ~BM_VERT;
 
 	/*do edges*/
 	me = medge = dm->dupEdgeArray(dm);
 	for (i = 0; i < totedge; i++, me++) {
-		e = BM_edge_create(bm, vtable[me->v1], vtable[me->v2], NULL, FALSE);
+		//BLI_assert(BM_edge_exists(vtable[me->v1], vtable[me->v2]) == NULL);
+		e = BM_edge_create(bm, vtable[me->v1], vtable[me->v2], NULL, BM_CREATE_SKIP_CD);
 
 		e->head.hflag = BM_edge_flag_from_mflag(me->flag);
+		BM_elem_index_set(e, i); /* set_inline */
 
 		CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->head.data);
 		etable[i] = e;
@@ -106,8 +111,10 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 		BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (float)me->bweight / 255.0f);
 	}
 	MEM_freeN(medge);
+	if (is_init) bm->elem_index_dirty &= ~BM_EDGE;
 
-	/*do faces*/
+	/* do faces */
+	/* note: i_alt is aligned with bmesh faces which may not always align with mpolys */
 	mp = dm->getPolyArray(dm);
 	mloop = dm->getLoopArray(dm);
 	face_normals = CustomData_get_layer(&dm->polyData, CD_NORMAL);  /* can be NULL */
@@ -127,13 +134,14 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 			edges[j] = etable[ml->e];
 		}
 
-		f = BM_face_create_ngon(bm, verts[0], verts[1], edges, mp->totloop, FALSE);
+		f = BM_face_create_ngon(bm, verts[0], verts[1], edges, mp->totloop, BM_CREATE_SKIP_CD);
 
 		if (UNLIKELY(f == NULL)) {
 			continue;
 		}
 
 		f->head.hflag = BM_face_flag_from_mflag(mp->flag);
+		BM_elem_index_set(f, bm->totface - 1); /* set_inline */
 		f->mat_nr = mp->mat_nr;
 
 		l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
@@ -151,6 +159,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
 			BM_face_normal_update(f);
 		}
 	}
+	if (is_init) bm->elem_index_dirty &= ~BM_FACE;
 
 	MEM_freeN(vtable);
 	MEM_freeN(etable);
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 0aa1f9e..4156b5b 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -520,6 +520,24 @@ static void movieclip_load_get_szie(MovieClip *clip)
 	}
 }
 
+static void detect_clip_source(MovieClip *clip)
+{
+	ImBuf *ibuf;
+	char name[FILE_MAX];
+
+	BLI_strncpy(name, clip->name, sizeof(name));
+	BLI_path_abs(name, G.main->name);
+
+	ibuf = IMB_testiffname(name, IB_rect | IB_multilayer);
+	if (ibuf) {
+		clip->source = MCLIP_SRC_SEQUENCE;
+		IMB_freeImBuf(ibuf);
+	}
+	else {
+		clip->source = MCLIP_SRC_MOVIE;
+	}
+}
+
 /* checks if image was already loaded, then returns same image
  * otherwise creates new.
  * does not load ibuf itself
@@ -565,10 +583,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
 	clip = movieclip_alloc(libname);
 	BLI_strncpy(clip->name, name, sizeof(clip->name));
 
-	if (BLI_testextensie_array(name, imb_ext_movie))
-		clip->source = MCLIP_SRC_MOVIE;
-	else
-		clip->source = MCLIP_SRC_SEQUENCE;
+	detect_clip_source(clip);
 
 	movieclip_load_get_szie(clip);
 	if (clip->lastsize[0]) {
@@ -616,11 +631,6 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
 	else
 		undistibuf = BKE_tracking_undistort_frame(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f);
 
-	if (undistibuf->userflags & IB_RECT_INVALID) {
-		ibuf->userflags &= ~IB_RECT_INVALID;
-		IMB_rect_from_float(undistibuf);
-	}
-
 	IMB_scaleImBuf(undistibuf, ibuf->x, ibuf->y);
 
 	return undistibuf;
@@ -1087,15 +1097,24 @@ void BKE_movieclip_reload(MovieClip *clip)
 	clip->tracking.stabilization.ok = FALSE;
 
 	/* update clip source */
-	if (BLI_testextensie_array(clip->name, imb_ext_movie))
-		clip->source = MCLIP_SRC_MOVIE;
-	else
-		clip->source = MCLIP_SRC_SEQUENCE;
+	detect_clip_source(clip);
 
 	clip->lastsize[0] = clip->lastsize[1] = 0;
 	movieclip_load_get_szie(clip);
 
 	movieclip_calc_length(clip);
+
+	/* same as for image update -- don't use notifiers because they are not 100% sure to succeeded
+	 * (node trees which are not currently visible wouldn't be refreshed)
+	 */
+	{
+		Scene *scene;
+		for (scene = G.main->scene.first; scene; scene = scene->id.next) {
+			if (scene->nodetree) {
+				nodeUpdateID(scene->nodetree, &clip->id);
+			}
+		}
+	}
 }
 
 void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClipScopes *scopes)
@@ -1157,13 +1176,16 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
 
 					search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, &undist_marker, TRUE, TRUE);
 
-					if (!search_ibuf->rect_float) {
-						/* sampling happens in float buffer */
-						IMB_float_from_rect(search_ibuf);
+					if (search_ibuf) {
+						if (!search_ibuf->rect_float) {
+							/* sampling happens in float buffer */
+							IMB_float_from_rect(search_ibuf);
+						}
+
+						scopes->track_search = search_ibuf;
 					}
 
 					scopes->undist_marker = undist_marker;
-					scopes->track_search = search_ibuf;
 
 					scopes->frame_width = ibuf->x;
 					scopes->frame_height = ibuf->y;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 591524e..c737dcc 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -984,7 +984,7 @@ static void grid_tangent(const CCGKey *key, int x, int y, int axis, CCGElem *gri
 
 /* Construct 3x3 tangent-space matrix in 'mat' */
 static void grid_tangent_matrix(float mat[3][3], const CCGKey *key,
-								int x, int y, CCGElem *grid)
+                                int x, int y, CCGElem *grid)
 {
 	grid_tangent(key, x, y, 0, grid, mat[0]);
 	normalize_v3(mat[0]);
@@ -1045,7 +1045,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
 
 	k = 0; /*current loop/mdisp index within the mloop array*/
 
-	#pragma omp parallel for private(i) if (totloop*gridSize*gridSize >= CCG_OMP_LIMIT)
+	#pragma omp parallel for private(i) if (totloop * gridSize * gridSize >= CCG_OMP_LIMIT)
 
 	for (i = 0; i < totpoly; ++i) {
 		const int numVerts = mpoly[i].totloop;
@@ -1161,7 +1161,6 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
 		int totlvl = ccgdm->multires.totlvl;
 		
 		if (lvl < totlvl) {
-			Mesh *me = ob->data;
 			DerivedMesh *lowdm, *cddm, *highdm;
 			CCGElem **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
 			CCGKey highGridKey, lowGridKey;
@@ -1326,7 +1325,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
 
 	k = 0; /*current loop/mdisp index within the mloop array*/
 
-	//#pragma omp parallel for private(i) if (dm->numLoopData*gridSize*gridSize >= CCG_OMP_LIMIT)
+	//#pragma omp parallel for private(i) if (dm->numLoopData * gridSize * gridSize >= CCG_OMP_LIMIT)
 
 	for (i = 0; i < dm->numPolyData; ++i) {
 		const int numVerts = mpoly[i].totloop;
@@ -1631,7 +1630,7 @@ void multires_free(Multires *mr)
 		}
 
 		while (lvl) {
-			multires_free_level(lvl);			
+			multires_free_level(lvl);
 			lvl = lvl->next;
 		}
 
@@ -2086,8 +2085,8 @@ void multires_load_old(Object *ob, Mesh *me)
 		CustomData_add_layer(&me->vdata, l->type, CD_REFERENCE, l->data, me->totvert);
 	for (i = 0, l = me->mr->fdata.layers; i < me->mr->fdata.totlayer; ++i, ++l)
 		CustomData_add_layer(&me->fdata, l->type, CD_REFERENCE, l->data, me->totface);
-	memset(&me->mr->vdata, 0, sizeof(CustomData));
-	memset(&me->mr->fdata, 0, sizeof(CustomData));
+	CustomData_reset(&me->mr->vdata);
+	CustomData_reset(&me->mr->fdata);
 
 	multires_load_old_vcols(me);
 	multires_load_old_face_flags(me);
@@ -2201,7 +2200,7 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
 	dGridSize = multires_side_tot[high_mmd.totlvl];
 	dSkip = (dGridSize - 1) / (gridSize - 1);
 
-	#pragma omp parallel for private(i) if (me->totface*gridSize*gridSize*4 >= CCG_OMP_LIMIT)
+	#pragma omp parallel for private(i) if (me->totface * gridSize * gridSize * 4 >= CCG_OMP_LIMIT)
 	for (i = 0; i < me->totpoly; ++i) {
 		const int numVerts = mpoly[i].totloop;
 		MDisps *mdisp = &mdisps[mpoly[i].loopstart];
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index a21878d..3bf5f86 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -36,44 +36,44 @@
 
 #include "DNA_meshdata_types.h"
 
-#include "BKE_navmesh_conversion.h"
-#include "BKE_cdderivedmesh.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
 
+#include "BKE_navmesh_conversion.h"
+#include "BKE_cdderivedmesh.h"
+
 #include "recast-capi.h"
 
-BLI_INLINE float area2(const float* a, const float* b, const float* c)
+BLI_INLINE float area2(const float *a, const float *b, const float *c)
 {
 	return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]);
 }
 
-BLI_INLINE int left(const float* a, const float* b, const float* c)
+BLI_INLINE int left(const float *a, const float *b, const float *c)
 {
 	return area2(a, b, c) < 0;
 }
 
-int polyNumVerts(const unsigned short* p, const int vertsPerPoly)
+int polyNumVerts(const unsigned short *p, const int vertsPerPoly)
 {
 	int i, nv = 0;
-	for (i=0; i<vertsPerPoly; i++) {
-		if (p[i]==0xffff)
+	for (i = 0; i < vertsPerPoly; i++) {
+		if (p[i] == 0xffff)
 			break;
 		nv++;
 	}
 	return nv;
 }
 
-int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* verts)
+int polyIsConvex(const unsigned short *p, const int vertsPerPoly, const float *verts)
 {
 	int j, nv = polyNumVerts(p, vertsPerPoly);
-	if (nv<3)
+	if (nv < 3)
 		return 0;
-	for (j=0; j<nv; j++) {
-		const float* v = &verts[3*p[j]];
-		const float* v_next = &verts[3*p[(j+1)%nv]];
-		const float* v_prev = &verts[3*p[(nv+j-1)%nv]];
+	for (j = 0; j < nv; j++) {
+		const float *v = &verts[3 * p[j]];
+		const float *v_next = &verts[3 * p[(j + 1) % nv]];
+		const float *v_prev = &verts[3 * p[(nv + j - 1) % nv]];
 		if (!left(v_prev, v, v_next))
 			return 0;
 
@@ -81,7 +81,8 @@ int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* v
 	return 1;
 }
 
-float distPointToSegmentSq(const float* point, const float* a, const float* b)
+/* XXX, could replace with #dist_to_line_segment_v3(), or add a squared version */
+float distPointToSegmentSq(const float point[3], const float a[3], const float b[3])
 {
 	float abx[3], dx[3];
 	float d, t;
@@ -89,24 +90,24 @@ float distPointToSegmentSq(const float* point, const float* a, const float* b)
 	sub_v3_v3v3(abx, b, a);
 	sub_v3_v3v3(dx, point, a);
 
-	d = abx[0]*abx[0]+abx[2]*abx[2];
-	t = abx[0]*dx[0]+abx[2]*dx[2];
+	d = abx[0] * abx[0] + abx[2] * abx[2];
+	t = abx[0] * dx[0] + abx[2] * dx[2];
 
-	if (d > 0)
+	if (d > 0.0f)
 		t /= d;
-	if (t < 0)
-		t = 0;
-	else if (t > 1)
-		t = 1;
-	dx[0] = a[0] + t*abx[0] - point[0];
-	dx[2] = a[2] + t*abx[2] - point[2];
-
-	return dx[0]*dx[0] + dx[2]*dx[2];
+	if (t < 0.0f)
+		t = 0.0f;
+	else if (t > 1.0f)
+		t = 1.0f;
+	dx[0] = a[0] + t * abx[0] - point[0];
+	dx[2] = a[2] + t * abx[2] - point[2];
+
+	return dx[0] * dx[0] + dx[2] * dx[2];
 }
 
-int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r, 
-									int *ntris_r, unsigned short **tris_r, int **trisToFacesMap_r,
-									int **recastData)
+int buildRawVertIndicesData(DerivedMesh *dm, int *nverts_r, float **verts_r,
+                            int *ntris_r, unsigned short **tris_r, int **trisToFacesMap_r,
+                            int **recastData)
 {
 	int vi, fi, triIdx;
 	int nverts, ntris;
@@ -117,49 +118,49 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
 	MFace *faces;
 
 	nverts = dm->getNumVerts(dm);
-	if (nverts>=0xffff) {
+	if (nverts >= 0xffff) {
 		printf("Converting navmesh: Error! Too many vertices. Max number of vertices %d\n", 0xffff);
 		return 0;
 	}
-	verts = MEM_callocN(sizeof(float)*3*nverts, "buildRawVertIndicesData verts");
+	verts = MEM_callocN(sizeof(float) * 3 * nverts, "buildRawVertIndicesData verts");
 	dm->getVertCos(dm, (float(*)[3])verts);
 
-	//flip coordinates
-	for (vi=0; vi<nverts; vi++) {
-		SWAP(float, verts[3*vi+1], verts[3*vi+2]);
+	/* flip coordinates */
+	for (vi = 0; vi < nverts; vi++) {
+		SWAP(float, verts[3 * vi + 1], verts[3 * vi + 2]);
 	}
 
-	//calculate number of tris
+	/* calculate number of tris */
 	nfaces = dm->getNumTessFaces(dm);
 	faces = dm->getTessFaceArray(dm);
 	ntris = nfaces;
-	for (fi=0; fi<nfaces; fi++) {
-		MFace* face = &faces[fi];
+	for (fi = 0; fi < nfaces; fi++) {
+		MFace *face = &faces[fi];
 		if (face->v4)
 			ntris++;
 	}
 
-	//copy and transform to triangles (reorder on the run)
-	trisToFacesMap = MEM_callocN(sizeof(int)*ntris, "buildRawVertIndicesData trisToFacesMap");
-	tris = MEM_callocN(sizeof(unsigned short)*3*ntris, "buildRawVertIndicesData tris");
+	/* copy and transform to triangles (reorder on the run) */
+	trisToFacesMap = MEM_callocN(sizeof(int) * ntris, "buildRawVertIndicesData trisToFacesMap");
+	tris = MEM_callocN(sizeof(unsigned short) * 3 * ntris, "buildRawVertIndicesData tris");
 	tri = tris;
 	triIdx = 0;
-	for (fi=0; fi<nfaces; fi++) {
-		MFace* face = &faces[fi];
-		tri[3*triIdx+0] = (unsigned short) face->v1;
-		tri[3*triIdx+1] = (unsigned short) face->v3;
-		tri[3*triIdx+2] = (unsigned short) face->v2;
-		trisToFacesMap[triIdx++]=fi;
+	for (fi = 0; fi < nfaces; fi++) {
+		MFace *face = &faces[fi];
+		tri[3 * triIdx + 0] = (unsigned short) face->v1;
+		tri[3 * triIdx + 1] = (unsigned short) face->v3;
+		tri[3 * triIdx + 2] = (unsigned short) face->v2;
+		trisToFacesMap[triIdx++] = fi;
 		if (face->v4) {
-			tri[3*triIdx+0] = (unsigned short) face->v1;
-			tri[3*triIdx+1] = (unsigned short) face->v4;
-			tri[3*triIdx+2] = (unsigned short) face->v3;
-			trisToFacesMap[triIdx++]=fi;
+			tri[3 * triIdx + 0] = (unsigned short) face->v1;
+			tri[3 * triIdx + 1] = (unsigned short) face->v4;
+			tri[3 * triIdx + 2] = (unsigned short) face->v3;
+			trisToFacesMap[triIdx++] = fi;
 		}
 	}
 
-	//carefully, recast data is just reference to data in derived mesh
-	*recastData = (int*)CustomData_get_layer(&dm->polyData, CD_RECAST);
+	/* carefully, recast data is just reference to data in derived mesh */
+	*recastData = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST);
 
 	*nverts_r = nverts;
 	*verts_r = verts;
@@ -170,122 +171,122 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
 	return 1;
 }
 
-int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys, 
-										  unsigned short* polys, const unsigned short* dmeshes, 
-										  const float* verts, const unsigned short* dtris, 
-										  const int* dtrisToPolysMap)
+int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
+                                  unsigned short *polys, const unsigned short *dmeshes,
+                                  const float *verts, const unsigned short *dtris,
+                                  const int *dtrisToPolysMap)
 {
 	int polyidx;
 	int capacity = vertsPerPoly;
-	unsigned short* newPoly = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPoly");
-	memset(newPoly, 0xff, sizeof(unsigned short)*capacity);
+	unsigned short *newPoly = MEM_callocN(sizeof(unsigned short) * capacity, "buildPolygonsByDetailedMeshes newPoly");
+	memset(newPoly, 0xff, sizeof(unsigned short) * capacity);
 
-	for (polyidx=0; polyidx<npolys; polyidx++) {
+	for (polyidx = 0; polyidx < npolys; polyidx++) {
 		size_t i;
 		int j, k;
 		int nv = 0;
-		//search border 
+		/* search border */
 		int tri, btri = -1;
 		int edge, bedge = -1;
-		int dtrisNum = dmeshes[polyidx*4+3];
-		int dtrisBase = dmeshes[polyidx*4+2];
-		unsigned char *traversedTris = MEM_callocN(sizeof(unsigned char)*dtrisNum, "buildPolygonsByDetailedMeshes traversedTris");
-		unsigned short* adjustedPoly;
+		int dtrisNum = dmeshes[polyidx * 4 + 3];
+		int dtrisBase = dmeshes[polyidx * 4 + 2];
+		unsigned char *traversedTris = MEM_callocN(sizeof(unsigned char) * dtrisNum, "buildPolygonsByDetailedMeshes traversedTris");
+		unsigned short *adjustedPoly;
 		int adjustedNv;
 		int allBorderTraversed;
 
-		for (j=0; j<dtrisNum && btri==-1;j++) {
-			int curpolytri = dtrisBase+j;
-			for (k=0; k<3; k++) {
-				unsigned short neighbortri = dtris[curpolytri*3*2+3+k];
-				if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
+		for (j = 0; j < dtrisNum && btri == -1; j++) {
+			int curpolytri = dtrisBase + j;
+			for (k = 0; k < 3; k++) {
+				unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k];
+				if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) {
 					btri = curpolytri;
 					bedge = k;
 					break;
 				}
-			}							
+			}
 		}
-		if (btri==-1 || bedge==-1) {
-			//can't find triangle with border edge
+		if (btri == -1 || bedge == -1) {
+			/* can't find triangle with border edge */
 			MEM_freeN(traversedTris);
 			MEM_freeN(newPoly);
 
 			return 0;
 		}
 
-		newPoly[nv++] = dtris[btri*3*2+bedge];
+		newPoly[nv++] = dtris[btri * 3 * 2 + bedge];
 		tri = btri;
-		edge = (bedge+1)%3;
-		traversedTris[tri-dtrisBase] = 1;
+		edge = (bedge + 1) % 3;
+		traversedTris[tri - dtrisBase] = 1;
 		while (tri != btri || edge != bedge) {
-			int neighbortri = dtris[tri*3*2+3+edge];
-			if (neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
-				if (nv==capacity) {
-					unsigned short* newPolyBig;
+			int neighbortri = dtris[tri * 3 * 2 + 3 + edge];
+			if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) {
+				if (nv == capacity) {
+					unsigned short *newPolyBig;
 					capacity += vertsPerPoly;
-					newPolyBig = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPolyBig");
-					memset(newPolyBig, 0xff, sizeof(unsigned short)*capacity);
-					memcpy(newPolyBig, newPoly, sizeof(unsigned short)*nv);
+					newPolyBig = MEM_callocN(sizeof(unsigned short) * capacity, "buildPolygonsByDetailedMeshes newPolyBig");
+					memset(newPolyBig, 0xff, sizeof(unsigned short) * capacity);
+					memcpy(newPolyBig, newPoly, sizeof(unsigned short) * nv);
 					MEM_freeN(newPoly);
-					newPoly = newPolyBig;			
+					newPoly = newPolyBig;
 				}
-				newPoly[nv++] = dtris[tri*3*2+edge];
-				//move to next edge					
-				edge = (edge+1)%3;
+				newPoly[nv++] = dtris[tri * 3 * 2 + edge];
+				/* move to next edge */
+				edge = (edge + 1) % 3;
 			}
 			else {
-				//move to next tri
+				/* move to next tri */
 				int twinedge = -1;
-				for (k=0; k<3; k++) {
-					if (dtris[neighbortri*3*2+3+k] == tri) {
+				for (k = 0; k < 3; k++) {
+					if (dtris[neighbortri * 3 * 2 + 3 + k] == tri) {
 						twinedge = k;
 						break;
 					}
 				}
-				if (twinedge==-1) {
+				if (twinedge == -1) {
 					printf("Converting navmesh: Error! Can't find neighbor edge - invalid adjacency info\n");
 					MEM_freeN(traversedTris);
 					goto returnLabel;
 				}
 				tri = neighbortri;
-				edge = (twinedge+1)%3;
-				traversedTris[tri-dtrisBase] = 1;
+				edge = (twinedge + 1) % 3;
+				traversedTris[tri - dtrisBase] = 1;
 			}
 		}
 
-		adjustedPoly = MEM_callocN(sizeof(unsigned short)*nv, "buildPolygonsByDetailedMeshes adjustedPoly");
+		adjustedPoly = MEM_callocN(sizeof(unsigned short) * nv, "buildPolygonsByDetailedMeshes adjustedPoly");
 		adjustedNv = 0;
-		for (i=0; i<nv; i++) {
-			unsigned short prev = newPoly[(nv+i-1)%nv];
+		for (i = 0; i < nv; i++) {
+			unsigned short prev = newPoly[(nv + i - 1) % nv];
 			unsigned short cur = newPoly[i];
-			unsigned short next = newPoly[(i+1)%nv];
-			float distSq = distPointToSegmentSq(&verts[3*cur], &verts[3*prev], &verts[3*next]);
+			unsigned short next = newPoly[(i + 1) % nv];
+			float distSq = distPointToSegmentSq(&verts[3 * cur], &verts[3 * prev], &verts[3 * next]);
 			static const float tolerance = 0.001f;
-			if (distSq>tolerance)
+			if (distSq > tolerance)
 				adjustedPoly[adjustedNv++] = cur;
 		}
-		memcpy(newPoly, adjustedPoly, adjustedNv*sizeof(unsigned short));
+		memcpy(newPoly, adjustedPoly, adjustedNv * sizeof(unsigned short));
 		MEM_freeN(adjustedPoly);
 		nv = adjustedNv;
 
 		allBorderTraversed = 1;
-		for (i=0; i<dtrisNum; i++) {
-			if (traversedTris[i]==0) {
-				//check whether it has border edges
-				int curpolytri = dtrisBase+i;
-				for (k=0; k<3; k++) {
-					unsigned short neighbortri = dtris[curpolytri*3*2+3+k];
-					if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
+		for (i = 0; i < dtrisNum; i++) {
+			if (traversedTris[i] == 0) {
+				/* check whether it has border edges */
+				int curpolytri = dtrisBase + i;
+				for (k = 0; k < 3; k++) {
+					unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k];
+					if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) {
 						allBorderTraversed = 0;
 						break;
 					}
 				}
-			}				
+			}
 		}
 
-		if (nv<=vertsPerPoly && allBorderTraversed) {
-			for (i=0; i<nv; i++) {
-				polys[polyidx*vertsPerPoly*2+i] = newPoly[i];
+		if (nv <= vertsPerPoly && allBorderTraversed) {
+			for (i = 0; i < nv; i++) {
+				polys[polyidx * vertsPerPoly * 2 + i] = newPoly[i];
 			}
 		}
 
@@ -298,21 +299,20 @@ returnLabel:
 	return 1;
 }
 
-struct SortContext
-{
-	const int* recastData;
-	const int* trisToFacesMap;
+struct SortContext {
+	const int *recastData;
+	const int *trisToFacesMap;
 };
 
-static int compareByData(void *ctx, const void * a, const void * b)
+static int compareByData(void *ctx, const void *a, const void *b)
 {
-	return (((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)a]] -
-	        ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)b]] );
+	return (((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int *)a]] -
+	        ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int *)b]]);
 }
 
-int buildNavMeshData(const int nverts, const float* verts, 
+int buildNavMeshData(const int nverts, const float *verts,
                      const int ntris, const unsigned short *tris,
-                     const int* recastData, const int* trisToFacesMap,
+                     const int *recastData, const int *trisToFacesMap,
                      int *ndtris_r, unsigned short **dtris_r,
                      int *npolys_r, unsigned short **dmeshes_r, unsigned short **polys_r,
                      int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r)
@@ -333,86 +333,86 @@ int buildNavMeshData(const int nverts, const float* verts,
 		return 0;
 	}
 
-	trisMapping = MEM_callocN(sizeof(int)*ntris, "buildNavMeshData trisMapping");
+	trisMapping = MEM_callocN(sizeof(int) * ntris, "buildNavMeshData trisMapping");
 
-	//sort the triangles by polygon idx
-	for (i=0; i<ntris; i++)
-		trisMapping[i]=i;
+	/* sort the triangles by polygon idx */
+	for (i = 0; i < ntris; i++)
+		trisMapping[i] = i;
 	context.recastData = recastData;
 	context.trisToFacesMap = trisToFacesMap;
 	recast_qsort(trisMapping, ntris, sizeof(int), &context, compareByData);
 
-	//search first valid triangle - triangle of convex polygon
+	/* search first valid triangle - triangle of convex polygon */
 	validTriStart = -1;
-	for (i=0; i< ntris; i++) {
-		if (recastData[trisToFacesMap[trisMapping[i]]]>0) {
+	for (i = 0; i < ntris; i++) {
+		if (recastData[trisToFacesMap[trisMapping[i]]] > 0) {
 			validTriStart = i;
 			break;
 		}
 	}
 
-	if (validTriStart<0) {
+	if (validTriStart < 0) {
 		printf("Converting navmesh: Error! No valid polygons in mesh\n");
 		MEM_freeN(trisMapping);
 		return 0;
 	}
 
-	ndtris = ntris-validTriStart;
-	//fill dtris to faces mapping
-	dtrisToTrisMap = MEM_callocN(sizeof(int)*ndtris, "buildNavMeshData dtrisToTrisMap");
-	memcpy(dtrisToTrisMap, &trisMapping[validTriStart], ndtris*sizeof(int));
+	ndtris = ntris - validTriStart;
+	/* fill dtris to faces mapping */
+	dtrisToTrisMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToTrisMap");
+	memcpy(dtrisToTrisMap, &trisMapping[validTriStart], ndtris * sizeof(int));
 	MEM_freeN(trisMapping);
 
-	//create detailed mesh triangles  - copy only valid triangles
-	//and reserve memory for adjacency info
-	dtris = MEM_callocN(sizeof(unsigned short)*3*2*ndtris, "buildNavMeshData dtris");
-	memset(dtris, 0xffff, sizeof(unsigned short)*3*2*ndtris);
-	for (i=0; i<ndtris; i++) {
-		memcpy(dtris+3*2*i, tris+3*dtrisToTrisMap[i], sizeof(unsigned short)*3);
+	/* create detailed mesh triangles  - copy only valid triangles
+	 * and reserve memory for adjacency info */
+	dtris = MEM_callocN(sizeof(unsigned short) * 3 * 2 * ndtris, "buildNavMeshData dtris");
+	memset(dtris, 0xffff, sizeof(unsigned short) * 3 * 2 * ndtris);
+	for (i = 0; i < ndtris; i++) {
+		memcpy(dtris + 3 * 2 * i, tris + 3 * dtrisToTrisMap[i], sizeof(unsigned short) * 3);
 	}
 
-	//create new recast data corresponded to dtris and renumber for continuous indices
+	/* create new recast data corresponded to dtris and renumber for continuous indices */
 	prevPolyIdx = -1;
 	newPolyIdx = 0;
-	dtrisToPolysMap = MEM_callocN(sizeof(int)*ndtris, "buildNavMeshData dtrisToPolysMap");
-	for (i=0; i<ndtris; i++) {
+	dtrisToPolysMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToPolysMap");
+	for (i = 0; i < ndtris; i++) {
 		curPolyIdx = recastData[trisToFacesMap[dtrisToTrisMap[i]]];
-		if (curPolyIdx!=prevPolyIdx) {
+		if (curPolyIdx != prevPolyIdx) {
 			newPolyIdx++;
-			prevPolyIdx=curPolyIdx;
+			prevPolyIdx = curPolyIdx;
 		}
 		dtrisToPolysMap[i] = newPolyIdx;
 	}
 
 
-	//build adjacency info for detailed mesh triangles
+	/* build adjacency info for detailed mesh triangles */
 	recast_buildMeshAdjacency(dtris, ndtris, nverts, 3);
 
-	//create detailed mesh description for each navigation polygon
-	npolys = dtrisToPolysMap[ndtris-1];
-	dmeshes = MEM_callocN(sizeof(unsigned short)*npolys*4, "buildNavMeshData dmeshes");
-	memset(dmeshes, 0, npolys*4*sizeof(unsigned short));
+	/* create detailed mesh description for each navigation polygon */
+	npolys = dtrisToPolysMap[ndtris - 1];
+	dmeshes = MEM_callocN(sizeof(unsigned short) * npolys * 4, "buildNavMeshData dmeshes");
+	memset(dmeshes, 0, npolys * 4 * sizeof(unsigned short));
 	dmesh = NULL;
 	prevpolyidx = 0;
-	for (i=0; i<ndtris; i++) {
+	for (i = 0; i < ndtris; i++) {
 		int curpolyidx = dtrisToPolysMap[i];
-		if (curpolyidx!=prevpolyidx) {
-			if (curpolyidx!=prevpolyidx+1) {
+		if (curpolyidx != prevpolyidx) {
+			if (curpolyidx != prevpolyidx + 1) {
 				printf("Converting navmesh: Error! Wrong order of detailed mesh faces\n");
 				return 0;
 			}
-			dmesh = dmesh==NULL ? dmeshes : dmesh+4;
-			dmesh[2] = (unsigned short)i;	//tbase
-			dmesh[3] = 0;	//tnum
+			dmesh = dmesh == NULL ? dmeshes : dmesh + 4;
+			dmesh[2] = (unsigned short)i;  /* tbase */
+			dmesh[3] = 0;  /* tnum */
 			prevpolyidx = curpolyidx;
 		}
 		dmesh[3]++;
 	}
 
-	//create navigation polygons
+	/* create navigation polygons */
 	vertsPerPoly = 6;
-	polys = MEM_callocN(sizeof(unsigned short)*npolys*vertsPerPoly*2, "buildNavMeshData polys");
-	memset(polys, 0xff, sizeof(unsigned short)*vertsPerPoly*2*npolys);
+	polys = MEM_callocN(sizeof(unsigned short) * npolys * vertsPerPoly * 2, "buildNavMeshData polys");
+	memset(polys, 0xff, sizeof(unsigned short) * vertsPerPoly * 2 * npolys);
 
 	buildPolygonsByDetailedMeshes(vertsPerPoly, npolys, polys, dmeshes, verts, dtris, dtrisToPolysMap);
 
@@ -429,16 +429,16 @@ int buildNavMeshData(const int nverts, const float* verts,
 }
 
 
-int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly, 
-										  int *nverts, float **verts,
-										  int *ndtris, unsigned short **dtris,
-										  int *npolys, unsigned short **dmeshes,
-										  unsigned short **polys, int **dtrisToPolysMap,
-										  int **dtrisToTrisMap, int **trisToFacesMap)
+int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly,
+                                  int *nverts, float **verts,
+                                  int *ndtris, unsigned short **dtris,
+                                  int *npolys, unsigned short **dmeshes,
+                                  unsigned short **polys, int **dtrisToPolysMap,
+                                  int **dtrisToTrisMap, int **trisToFacesMap)
 {
 	int res = 1;
-	int ntris = 0, *recastData=NULL;
-	unsigned short *tris=NULL;
+	int ntris = 0, *recastData = NULL;
+	unsigned short *tris = NULL;
 
 	res = buildRawVertIndicesData(dm, nverts, verts, &ntris, &tris, trisToFacesMap, &recastData);
 	if (!res) {
@@ -447,8 +447,8 @@ int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly,
 	}
 
 	res = buildNavMeshData(*nverts, *verts, ntris, tris, recastData, *trisToFacesMap,
-		ndtris, dtris, npolys, dmeshes, polys, vertsPerPoly,
-		dtrisToPolysMap, dtrisToTrisMap);
+	                       ndtris, dtris, npolys, dmeshes, polys, vertsPerPoly,
+	                       dtrisToPolysMap, dtrisToTrisMap);
 	if (!res) {
 		printf("Converting navmesh: Error! Can't get vertices and indices from mesh\n");
 		goto exit;
@@ -461,11 +461,11 @@ exit:
 	return res;
 }
 
-int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx)
+int polyFindVertex(const unsigned short *p, const int vertsPerPoly, unsigned short vertexIdx)
 {
 	int i, res = -1;
-	for (i=0; i<vertsPerPoly; i++) {
-		if (p[i]==0xffff)
+	for (i = 0; i < vertsPerPoly; i++) {
+		if (p[i] == 0xffff)
 			break;
 		if (p[i] == vertexIdx) {
 			res = i;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 9590160..6f58519 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -423,7 +423,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
 				return strip->actstart;
 			}
 			else {
-				/* - the 'fmod(..., actlength*scale)' is needed to get the repeats working
+				/* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
 				 * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
 				 */
 				return strip->actend - fmodf(cframe - strip->start, actlength * scale) / scale;
@@ -446,7 +446,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
 				return strip->actend;
 			}
 			else {
-				/* - the 'fmod(..., actlength*scale)' is needed to get the repeats working
+				/* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
 				 * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
 				 */
 				return strip->actstart + fmodf(cframe - strip->start, actlength * scale) / scale;
@@ -496,7 +496,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
 		case NLASTRIP_TYPE_CLIP: /* action-clip (default) */
 		default:
 			return nlastrip_get_frame_actionclip(strip, cframe, mode);
-	}	
+	}
 }
 
 
@@ -1162,7 +1162,7 @@ static short nlastrip_is_first(AnimData *adt, NlaStrip *strip)
 			if (ns->start < strip->start)
 				return 0;
 		}
-	}	
+	}
 	
 	/* should be first now */
 	return 1;
@@ -1491,7 +1491,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
 	/* add a new NLA strip to the track, which references the active action */
 	strip = add_nlastrip_to_stack(adt, adt->action);
 	
-	/* do other necessary work on strip */	
+	/* do other necessary work on strip */
 	if (strip) {
 		/* clear reference to action now that we've pushed it onto the stack */
 		id_us_min(&adt->action->id);
@@ -1545,7 +1545,7 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
 			/* now try to find active strip */
 			activeStrip = BKE_nlastrip_find_active(nlt);
 			break;
-		}	
+		}
 	}
 	
 	/* There are situations where we may have multiple strips selected and we want to enter tweakmode on all 
@@ -1563,7 +1563,7 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
 				activeStrip = BKE_nlastrip_find_active(nlt);
 				break;
 			}
-		}	
+		}
 	}
 	if ((activeTrack) && (activeStrip == NULL)) {
 		/* no active strip in active or last selected track; compromise for first selected (assuming only single)... */
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 8965488..17dcf34 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -38,9 +38,13 @@
 
 #include "DNA_action_types.h"
 #include "DNA_anim_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
 #include "DNA_node_types.h"
 #include "DNA_node_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_world_types.h"
 
 #include "BLI_string.h"
 #include "BLI_math.h"
@@ -147,6 +151,7 @@ static bNodeSocket *make_socket(bNodeTree *UNUSED(ntree), int in_out, const char
 	sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
 	sock->type = type;
 	sock->storage = NULL;
+	sock->flag |= SOCK_COLLAPSED;
 	
 	sock->default_value = node_socket_make_default_value(type);
 	node_socket_init_default_value(type, sock->default_value);
@@ -346,6 +351,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 {
 	bNode *nnode = MEM_callocN(sizeof(bNode), "dupli node");
 	bNodeSocket *sock, *oldsock;
+	bNodeLink *link, *oldlink;
 
 	*nnode = *node;
 	/* can be called for nodes outside a node tree (e.g. clipboard) */
@@ -385,6 +391,15 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 		sock->cache = NULL;
 	}
 	
+	BLI_duplicatelist(&nnode->internal_links, &node->internal_links);
+	oldlink = node->internal_links.first;
+	for (link = nnode->internal_links.first; link; link = link->next, oldlink = oldlink->next) {
+		link->fromnode = nnode;
+		link->tonode = nnode;
+		link->fromsock = link->fromsock->new_sock;
+		link->tosock = link->tosock->new_sock;
+	}
+	
 	/* don't increase node->id users, freenode doesn't decrement either */
 	
 	if (node->typeinfo->copystoragefunc)
@@ -392,7 +407,18 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 	
 	node->new_node = nnode;
 	nnode->new_node = NULL;
-	nnode->preview = NULL;
+	
+	/* only shader nodes get pleasant preview updating this way, compo uses own system */
+	if (node->preview) {
+		if (ntree && (ntree->type == NTREE_SHADER)) {
+			nnode->preview = MEM_dupallocN(node->preview);
+			if (node->preview->rect)
+				nnode->preview->rect = MEM_dupallocN(node->preview->rect);
+		}
+		else {
+			nnode->preview = NULL;
+		}
+	}
 	
 	if (ntree)
 		ntree->update |= NTREE_UPDATE_NODES;
@@ -523,15 +549,12 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
 void nodeInternalRelink(bNodeTree *ntree, bNode *node)
 {
 	bNodeLink *link, *link_next;
-	ListBase intlinks;
 	
-	if (!node->typeinfo->internal_connect)
+	if (node->internal_links.first == NULL)
 		return;
 	
-	intlinks = node->typeinfo->internal_connect(ntree, node);
-	
 	/* store link pointers in output sockets, for efficient lookup */
-	for (link = intlinks.first; link; link = link->next)
+	for (link = node->internal_links.first; link; link = link->next)
 		link->tosock->link = link;
 	
 	/* redirect downstream links */
@@ -565,8 +588,6 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node)
 		if (link->tonode == node)
 			nodeRemLink(ntree, link);
 	}
-	
-	BLI_freelistN(&intlinks);
 }
 
 void nodeToView(bNode *node, float x, float y, float *rx, float *ry)
@@ -713,7 +734,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_id_use
 		}
 
 		node->new_node = NULL;
-		/* nnode= */ nodeCopyNode(newtree, node);   /* sets node->new */
+		/* nnode = */ nodeCopyNode(newtree, node);   /* sets node->new */
 		
 		/* make sure we don't copy new nodes again! */
 		if (node == last)
@@ -818,7 +839,7 @@ void nodeFreePreview(bNode *node)
 			MEM_freeN(node->preview->rect);
 		MEM_freeN(node->preview);
 		node->preview = NULL;
-	}	
+	}
 }
 
 static void node_init_preview(bNode *node, int xsize, int ysize)
@@ -861,7 +882,7 @@ void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize)
 			node_init_preview(node, xsize, ysize);
 		if (node->type == NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
 			ntreeInitPreview((bNodeTree *)node->id, xsize, ysize);
-	}		
+	}
 }
 
 static void nodeClearPreview(bNode *node)
@@ -883,13 +904,13 @@ void ntreeClearPreview(bNodeTree *ntree)
 			nodeClearPreview(node);
 		if (node->type == NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
 			ntreeClearPreview((bNodeTree *)node->id);
-	}		
+	}
 }
 
 /* hack warning! this function is only used for shader previews, and 
  * since it gets called multiple times per pixel for Ztransp we only
  * add the color once. Preview gets cleared before it starts render though */
-void nodeAddToPreview(bNode *node, float col[4], int x, int y, int do_manage)
+void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_manage)
 {
 	bNodePreview *preview = node->preview;
 	if (preview) {
@@ -988,6 +1009,8 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
 		MEM_freeN(sock);
 	}
 
+	BLI_freelistN(&node->internal_links);
+
 	nodeFreePreview(node);
 
 	MEM_freeN(node);
@@ -999,6 +1022,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
 /* do not free ntree itself here, BKE_libblock_free calls this function too */
 void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user)
 {
+	bNodeTree *tntree;
 	bNode *node, *next;
 	bNodeSocket *sock;
 	
@@ -1055,6 +1079,14 @@ void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user)
 	for (sock = ntree->outputs.first; sock; sock = sock->next)
 		node_socket_free_default_value(sock->type, sock->default_value);
 	BLI_freelistN(&ntree->outputs);
+	
+	/* if ntree is not part of library, free the libblock data explicitly */
+	for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next)
+		if (tntree == ntree)
+			break;
+	if (tntree == NULL) {
+		BKE_libblock_free_data(&ntree->id);
+	}
 }
 /* same as ntreeFreeTree_ex but always manage users */
 void ntreeFreeTree(bNodeTree *ntree)
@@ -1126,6 +1158,18 @@ void ntreeSetOutput(bNodeTree *ntree)
 	 * might be different for editor or for "real" use... */
 }
 
+bNodeTree *ntreeFromID(ID *id)
+{
+	switch (GS(id->name)) {
+		case ID_MA: return ((Material*)id)->nodetree;
+		case ID_LA: return ((Lamp*)id)->nodetree;
+		case ID_WO: return ((World*)id)->nodetree;
+		case ID_TE: return ((Tex*)id)->nodetree;
+		case ID_SCE: return ((Scene*)id)->nodetree;
+		default: return NULL;
+	}
+}
+
 typedef struct MakeLocalCallData {
 	ID *group_id;
 	ID *new_id;
@@ -1557,11 +1601,11 @@ int BKE_node_clipboard_validate(void)
 
 	/* lists must be aligned */
 	BLI_assert(BLI_countlist(&node_clipboard.nodes) ==
-			   BLI_countlist(&node_clipboard.nodes_extra_info));
+	           BLI_countlist(&node_clipboard.nodes_extra_info));
 
 	for (node = node_clipboard.nodes.first, node_info = node_clipboard.nodes_extra_info.first;
-		 node;
-		 node = node->next, node_info = node_info->next)
+	     node;
+	     node = node->next, node_info = node_info->next)
 	{
 		/* validate the node against the stored node info */
 
@@ -1816,6 +1860,8 @@ void ntreeUpdateTree(bNodeTree *ntree)
 				ntreetype->update_node(ntree, node);
 			else if (node->typeinfo->updatefunc)
 				node->typeinfo->updatefunc(ntree, node);
+			
+			nodeUpdateInternalLinks(ntree, node);
 		}
 	}
 	
@@ -1853,6 +1899,9 @@ void nodeUpdate(bNodeTree *ntree, bNode *node)
 		ntreetype->update_node(ntree, node);
 	else if (node->typeinfo->updatefunc)
 		node->typeinfo->updatefunc(ntree, node);
+	
+	nodeUpdateInternalLinks(ntree, node);
+	
 	/* clear update flag */
 	node->update = 0;
 }
@@ -1892,9 +1941,21 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
 		}
 	}
 	
+	for (node = ntree->nodes.first; node; node = node->next) {
+		nodeUpdateInternalLinks(ntree, node);
+	}
+	
 	return change;
 }
 
+void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node)
+{
+	BLI_freelistN(&node->internal_links);
+	
+	if (node->typeinfo && node->typeinfo->update_internal_links)
+		node->typeinfo->update_internal_links(ntree, node);
+}
+
 
 /* ************* node type access ********** */
 
@@ -1967,7 +2028,7 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char
 
 	/* Default muting stuff. */
 	if (ttype)
-		ntype->internal_connect = ttype->internal_connect;
+		ntype->update_internal_links = ttype->update_internal_links;
 
 	/* default size values */
 	ntype->width = 140;
@@ -2063,9 +2124,9 @@ void node_type_exec_new(struct bNodeType *ntype,
 	ntype->newexecfunc = newexecfunc;
 }
 
-void node_type_internal_connect(bNodeType *ntype, ListBase (*internal_connect)(bNodeTree *, bNode *))
+void node_type_internal_links(bNodeType *ntype, void (*update_internal_links)(bNodeTree *, bNode *))
 {
-	ntype->internal_connect = internal_connect;
+	ntype->update_internal_links = update_internal_links;
 }
 
 void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out))
@@ -2109,8 +2170,6 @@ static void registerCompositNodes(bNodeTreeType *ttype)
 	register_node_type_reroute(ttype);
 	
 	register_node_type_cmp_group(ttype);
-//	register_node_type_cmp_forloop(ttype);
-//	register_node_type_cmp_whileloop(ttype);
 	
 	register_node_type_cmp_rlayers(ttype);
 	register_node_type_cmp_image(ttype);
@@ -2140,6 +2199,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
 	register_node_type_cmp_normal(ttype);
 	register_node_type_cmp_curve_vec(ttype);
 	register_node_type_cmp_map_value(ttype);
+	register_node_type_cmp_map_range(ttype);
 	register_node_type_cmp_normalize(ttype);
 	
 	register_node_type_cmp_filter(ttype);
@@ -2198,6 +2258,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
 	register_node_type_cmp_bokehimage(ttype);
 	register_node_type_cmp_bokehblur(ttype);
 	register_node_type_cmp_switch(ttype);
+	register_node_type_cmp_pixelate(ttype);
 
 	register_node_type_cmp_mask(ttype);
 	register_node_type_cmp_trackpos(ttype);
@@ -2209,8 +2270,6 @@ static void registerShaderNodes(bNodeTreeType *ttype)
 	register_node_type_reroute(ttype);
 	
 	register_node_type_sh_group(ttype);
-	//register_node_type_sh_forloop(ttype);
-	//register_node_type_sh_whileloop(ttype);
 
 	register_node_type_sh_output(ttype);
 	register_node_type_sh_material(ttype);
@@ -2246,16 +2305,23 @@ static void registerShaderNodes(bNodeTreeType *ttype)
 	register_node_type_sh_layer_weight(ttype);
 	register_node_type_sh_tex_coord(ttype);
 	register_node_type_sh_particle_info(ttype);
+	register_node_type_sh_bump(ttype);
+	register_node_type_sh_script(ttype);
+	register_node_type_sh_tangent(ttype);
+	register_node_type_sh_normal_map(ttype);
 
 	register_node_type_sh_background(ttype);
+	register_node_type_sh_bsdf_anisotropic(ttype);
 	register_node_type_sh_bsdf_diffuse(ttype);
 	register_node_type_sh_bsdf_glossy(ttype);
 	register_node_type_sh_bsdf_glass(ttype);
+	register_node_type_sh_bsdf_refraction(ttype);
 	register_node_type_sh_bsdf_translucent(ttype);
 	register_node_type_sh_bsdf_transparent(ttype);
 	register_node_type_sh_bsdf_velvet(ttype);
 	register_node_type_sh_emission(ttype);
 	register_node_type_sh_holdout(ttype);
+	register_node_type_sh_ambient_occlusion(ttype);
 	//register_node_type_sh_volume_transparent(ttype);
 	//register_node_type_sh_volume_isotropic(ttype);
 	register_node_type_sh_mix_shader(ttype);
@@ -2284,8 +2350,6 @@ static void registerTextureNodes(bNodeTreeType *ttype)
 	register_node_type_reroute(ttype);
 	
 	register_node_type_tex_group(ttype);
-//	register_node_type_tex_forloop(ttype);
-//	register_node_type_tex_whileloop(ttype);
 	
 	register_node_type_tex_math(ttype);
 	register_node_type_tex_mix_rgb(ttype);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 65ab97e..47ca502 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -196,18 +196,18 @@ int BKE_object_support_modifier_type_check(Object *ob, int modifier_type)
 	return TRUE;
 }
 
-void BKE_object_link_modifiers(struct Object *ob, struct Object *from)
+void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src)
 {
 	ModifierData *md;
-	BKE_object_free_modifiers(ob);
+	BKE_object_free_modifiers(ob_dst);
 
-	if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+	if (!ELEM5(ob_dst->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
 		/* only objects listed above can have modifiers and linking them to objects
 		 * which doesn't have modifiers stack is quite silly */
 		return;
 	}
 
-	for (md = from->modifiers.first; md; md = md->next) {
+	for (md = ob_src->modifiers.first; md; md = md->next) {
 		ModifierData *nmd = NULL;
 
 		if (ELEM4(md->type,
@@ -219,16 +219,18 @@ void BKE_object_link_modifiers(struct Object *ob, struct Object *from)
 			continue;
 		}
 
-		if (!BKE_object_support_modifier_type_check(ob, md->type))
+		if (!BKE_object_support_modifier_type_check(ob_dst, md->type))
 			continue;
 
 		nmd = modifier_new(md->type);
+		BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
 		modifier_copyData(md, nmd);
-		BLI_addtail(&ob->modifiers, nmd);
+		BLI_addtail(&ob_dst->modifiers, nmd);
+		modifier_unique_name(&ob_dst->modifiers, nmd);
 	}
 
-	BKE_object_copy_particlesystems(ob, from);
-	BKE_object_copy_softbody(ob, from);
+	BKE_object_copy_particlesystems(ob_dst, ob_src);
+	BKE_object_copy_softbody(ob_dst, ob_src);
 
 	/* TODO: smoke?, cloth? */
 }
@@ -300,11 +302,11 @@ void BKE_object_free(Object *ob)
 	
 	BKE_object_free_display(ob);
 	
-	/* disconnect specific data */
+	/* disconnect specific data, but not for lib data (might be indirect data, can get relinked) */
 	if (ob->data) {
 		ID *id = ob->data;
 		id->us--;
-		if (id->us == 0) {
+		if (id->us == 0 && id->lib == NULL) {
 			switch (ob->type) {
 				case OB_MESH:
 					BKE_mesh_unlink((Mesh *)id);
@@ -454,7 +456,7 @@ void BKE_object_unlink(Object *ob)
 				if (pchan->custom == ob)
 					pchan->custom = NULL;
 			}
-		} 
+		}
 		else if (ELEM(OB_MBALL, ob->type, obt->type)) {
 			if (BKE_mball_is_basis_for(obt, ob))
 				obt->recalc |= OB_RECALC_DATA;
@@ -689,8 +691,8 @@ void BKE_object_unlink(Object *ob)
 
 					if (so->treestore) {
 						TreeStoreElem *tselem = so->treestore->data;
-						int a;
-						for (a = 0; a < so->treestore->usedelem; a++, tselem++) {
+						int i;
+						for (i = 0; i < so->treestore->usedelem; i++, tselem++) {
 							if (tselem->id == (ID *)ob) tselem->id = NULL;
 						}
 					}
@@ -854,7 +856,9 @@ Object *BKE_object_add_only_object(int type, const char *name)
 	ob->step_height = 0.15f;
 	ob->jump_speed = 10.0f;
 	ob->fall_speed = 55.0f;
-	
+	ob->col_group = 0x01;
+	ob->col_mask = 0xff;
+
 	/* NT fluid sim defaults */
 	ob->fluidsimSettings = NULL;
 
@@ -1781,7 +1785,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
 	
 	/* Make sure the bone is still valid */
 	pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr);
-	if (!pchan) {
+	if (!pchan || !pchan->bone) {
 		printf("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name + 2, ob->parsubstr);
 		unit_m4(mat);
 		return;
@@ -2300,11 +2304,9 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short u
 				bPoseChannel *pchan;
 
 				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
-
-					if ((use_hidden == FALSE) && (PBONE_VISIBLE(arm, pchan->bone) == FALSE)) {
-						/* pass */
-					}
-					else {
+					/* XXX pchan->bone may be NULL for duplicated bones, see duplicateEditBoneObjects() comment
+					 *     (editarmature.c:2592)... Skip in this case too! */
+					if (pchan->bone && !((use_hidden == FALSE) && (PBONE_VISIBLE(arm, pchan->bone) == FALSE))) {
 						mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
 						minmax_v3v3_v3(min_r, max_r, vec);
 						mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
@@ -2573,9 +2575,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
 		if (ob->recalc & OB_RECALC_DATA) {
 			ID *data_id = (ID *)ob->data;
 			AnimData *adt = BKE_animdata_from_id(data_id);
-			float ctime = (float)scene->r.cfra; // XXX this is bad...
-			ListBase pidlist;
-			PTCacheID *pid;
+			float ctime = (float)scene->r.cfra;  /* XXX this is bad... */
 			
 			if (G.debug & G_DEBUG)
 				printf("recalcdata %s\n", ob->id.name + 2);
@@ -2656,6 +2656,8 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
 					}
 				}
 			}
+			else if (ob->type == OB_LAMP)
+				lamp_drivers_update(scene, ob->data, ctime);
 			
 			/* particles */
 			if (ob->particlesystem.first) {
@@ -2698,26 +2700,8 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
 						psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
 				}
 			}
-
-			/* check if quick cache is needed */
-			BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
-
-			for (pid = pidlist.first; pid; pid = pid->next) {
-				if ((pid->cache->flag & PTCACHE_BAKED) ||
-				    (pid->cache->flag & PTCACHE_QUICK_CACHE) == 0)
-				{
-					continue;
-				}
-
-				if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID) == 0) {
-					scene->physics_settings.quick_cache_step =
-					        scene->physics_settings.quick_cache_step ?
-					        mini(scene->physics_settings.quick_cache_step, pid->cache->step) :
-					        pid->cache->step;
-				}
-			}
-
-			BLI_freelistN(&pidlist);
+			
+			/* quick cache removed */
 		}
 
 		/* the no-group proxy case, we call update */
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 4f39219..e694a7e 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -183,7 +183,7 @@ MINLINE float catrom(float p0, float p1, float p2, float p3, float f)
 
 MINLINE float omega(float k, float depth)
 {
-	return sqrt(GRAVITY * k * tanh(k * depth));
+	return sqrtf(GRAVITY * k * tanhf(k * depth));
 }
 
 // modified Phillips spectrum
@@ -256,8 +256,8 @@ static void add_comlex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl
 
 static void mul_complex_f(fftw_complex res, fftw_complex cmpl, float f)
 {
-	res[0] = cmpl[0] * f;
-	res[1] = cmpl[1] * f;
+	res[0] = cmpl[0] * (double)f;
+	res[1] = cmpl[1] * (double)f;
 }
 
 static void mul_complex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2)
@@ -289,8 +289,8 @@ static void exp_complex(fftw_complex res, fftw_complex cmpl)
 {
 	float r = expf(cmpl[0]);
 
-	res[0] = cos(cmpl[1]) * r;
-	res[1] = sin(cmpl[1]) * r;
+	res[0] = cosf(cmpl[1]) * r;
+	res[1] = sinf(cmpl[1]) * r;
 }
 
 float BKE_ocean_jminus_to_foam(float jminus, float coverage)
@@ -462,7 +462,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j)
 	i = abs(i) % oc->_M;
 	j = abs(j) % oc->_N;
 
-	ocr->disp[1] = oc->_do_disp_y ? oc->_disp_y[i * oc->_N + j] : 0.0f;
+	ocr->disp[1] = oc->_do_disp_y ? (float)oc->_disp_y[i * oc->_N + j] : 0.0f;
 
 	if (oc->_do_chop) {
 		ocr->disp[0] = oc->_disp_x[i * oc->_N + j];
@@ -475,7 +475,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j)
 
 	if (oc->_do_normals) {
 		ocr->normal[0] = oc->_N_x[i * oc->_N + j];
-		ocr->normal[1] = oc->_N_y /*oc->_N_y[i*oc->_N+j] (MEM01)*/;
+		ocr->normal[1] = oc->_N_y  /* oc->_N_y[i * oc->_N + j] (MEM01) */;
 		ocr->normal[2] = oc->_N_z[i * oc->_N + j];
 
 		normalize_v3(ocr->normal);
@@ -546,7 +546,7 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
 						mul_complex_f(mul_param, mul_param, chop_amount);
 						mul_complex_c(mul_param, mul_param, minus_i);
 						mul_complex_c(mul_param, mul_param, o->_htilda[i * (1 + o->_N / 2) + j]);
-						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0 ? 0.0 : o->_kx[i] / o->_k[i * (1 + o->_N / 2) + j]));
+						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0f ? 0.0f : o->_kx[i] / o->_k[i * (1 + o->_N / 2) + j]));
 						init_complex(o->_fft_in_x[i * (1 + o->_N / 2) + j], real_c(mul_param), image_c(mul_param));
 					}
 				}
@@ -568,7 +568,7 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
 						mul_complex_f(mul_param, mul_param, chop_amount);
 						mul_complex_c(mul_param, mul_param, minus_i);
 						mul_complex_c(mul_param, mul_param, o->_htilda[i * (1 + o->_N / 2) + j]);
-						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0 ? 0.0 : o->_kz[j] / o->_k[i * (1 + o->_N / 2) + j]));
+						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0f ? 0.0f : o->_kz[j] / o->_k[i * (1 + o->_N / 2) + j]));
 						init_complex(o->_fft_in_z[i * (1 + o->_N / 2) + j], real_c(mul_param), image_c(mul_param));
 					}
 				}
@@ -589,7 +589,7 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
 
 						mul_complex_f(mul_param, mul_param, chop_amount);
 						mul_complex_c(mul_param, mul_param, o->_htilda[i * (1 + o->_N / 2) + j]);
-						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0 ? 0.0 : o->_kx[i] * o->_kx[i] / o->_k[i * (1 + o->_N / 2) + j]));
+						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0f ? 0.0f : o->_kx[i] * o->_kx[i] / o->_k[i * (1 + o->_N / 2) + j]));
 						init_complex(o->_fft_in_jxx[i * (1 + o->_N / 2) + j], real_c(mul_param), image_c(mul_param));
 					}
 				}
@@ -616,7 +616,7 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
 
 						mul_complex_f(mul_param, mul_param, chop_amount);
 						mul_complex_c(mul_param, mul_param, o->_htilda[i * (1 + o->_N / 2) + j]);
-						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0 ? 0.0 : o->_kz[j] * o->_kz[j] / o->_k[i * (1 + o->_N / 2) + j]));
+						mul_complex_f(mul_param, mul_param, (o->_k[i * (1 + o->_N / 2) + j] == 0.0f ? 0.0f : o->_kz[j] * o->_kz[j] / o->_k[i * (1 + o->_N / 2) + j]));
 						init_complex(o->_fft_in_jzz[i * (1 + o->_N / 2) + j], real_c(mul_param), image_c(mul_param));
 					}
 				}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 03342d0..dec49f4 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -201,7 +201,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
 
 	file = BLI_open(name, O_BINARY | O_RDONLY, 0);
 	if (file <= 0) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
+		BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path '%s' not found", name);
 	}
 	else {
 		filelen = BLI_file_descriptor_size(file);
@@ -238,7 +238,8 @@ void packAll(Main *bmain, ReportList *reports)
 				ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
 			}
 			else if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
-				BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name + 2);
+				BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported",
+				            ima->id.name + 2);
 			}
 		}
 	}
@@ -310,20 +311,20 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
 	file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
 	if (file >= 0) {
 		if (write(file, pf->data, pf->size) != pf->size) {
-			BKE_reportf(reports, RPT_ERROR, "Error writing file: %s", name);
+			BKE_reportf(reports, RPT_ERROR, "Error writing file '%s'", name);
 			ret_value = RET_ERROR;
 		}
 		close(file);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Error creating file: %s", name);
+		BKE_reportf(reports, RPT_ERROR, "Error creating file '%s'", name);
 		ret_value = RET_ERROR;
 	}
 	
 	if (remove_tmp) {
 		if (ret_value == RET_ERROR) {
 			if (BLI_rename(tempname, name) != 0) {
-				BKE_reportf(reports, RPT_ERROR, "Error restoring tempfile. Check files: '%s' '%s'", tempname, name);
+				BKE_reportf(reports, RPT_ERROR, "Error restoring temp file (check files '%s' '%s')", tempname, name);
 			}
 		}
 		else {
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 5a302cb..36f9604 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -36,6 +36,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_space_types.h"
 
 #include "BLI_bitmap.h"
 #include "BLI_utildefines.h"
@@ -87,6 +88,7 @@ Paint *paint_get_active(Scene *sce)
 Paint *paint_get_active_from_context(const bContext *C)
 {
 	Scene *sce = CTX_data_scene(C);
+	SpaceImage *sima;
 
 	if (sce) {
 		ToolSettings *ts = sce->toolsettings;
@@ -95,12 +97,12 @@ Paint *paint_get_active_from_context(const bContext *C)
 		if (sce->basact && sce->basact->object)
 			obact = sce->basact->object;
 
-		if (CTX_wm_space_image(C) != NULL) {
+		if ((sima = CTX_wm_space_image(C)) != NULL) {
 			if (obact && obact->mode == OB_MODE_EDIT) {
-				if (ts->use_uv_sculpt)
-					return &ts->uvsculpt->paint;
-				else
+				if (sima->mode == SI_MODE_PAINT)
 					return &ts->imapaint.paint;
+				else if (ts->use_uv_sculpt)
+					return &ts->uvsculpt->paint;
 			}
 			else {
 				return &ts->imapaint.paint;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 89dadcd..5f5a713 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -48,6 +48,7 @@
 #include "DNA_dynamicpaint_types.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_noise.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_kdtree.h"
@@ -335,7 +336,7 @@ void psys_check_group_weights(ParticleSettings *part)
 				BLI_addtail(&part->dupliweights, dw);
 			}
 
-			go = go->next;	
+			go = go->next;
 		}
 
 		dw = part->dupliweights.first;
@@ -560,7 +561,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
 			ob->transflag &= ~OB_DUPLIPARTS;
 
 		if (psys->part) {
-			psys->part->id.us--;		
+			psys->part->id.us--;
 			psys->part = NULL;
 		}
 
@@ -617,7 +618,10 @@ typedef struct ParticleRenderData {
 	int do_simplify;
 	int timeoffset;
 	ParticleRenderElem *elems;
-	int *origindex;
+
+	/* ORIGINDEX */
+	const int *index_mf_to_mpoly;
+	const int *index_mp_to_orig;
 } ParticleRenderData;
 
 static float psys_render_viewport_falloff(double rate, float dist, float width)
@@ -790,9 +794,13 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	float *facearea, (*facecenter)[3], size[3], fac, powrate, scaleclamp;
 	float co1[3], co2[3], co3[3], co4[3], lambda, arearatio, t, area, viewport;
 	double vprate;
-	int *origindex, *facetotvert;
+	int *facetotvert;
 	int a, b, totorigface, totface, newtot, skipped;
 
+	/* double lookup */
+	const int *index_mf_to_mpoly;
+	const int *index_mp_to_orig;
+
 	if (part->ren_as != PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
 		return tot;
 	if (!ctx->sim.psys->renderdata)
@@ -806,13 +814,18 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 
 	mvert = dm->getVertArray(dm);
 	mface = dm->getTessFaceArray(dm);
-	origindex = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	totface = dm->getNumTessFaces(dm);
 	totorigface = me->totpoly;
 
 	if (totface == 0 || totorigface == 0)
 		return tot;
 
+	index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
 	facearea = MEM_callocN(sizeof(float) * totorigface, "SimplifyFaceArea");
 	facecenter = MEM_callocN(sizeof(float[3]) * totorigface, "SimplifyFaceCenter");
 	facetotvert = MEM_callocN(sizeof(int) * totorigface, "SimplifyFaceArea");
@@ -823,20 +836,22 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 
 	data->do_simplify = TRUE;
 	data->elems = elems;
-	data->origindex = origindex;
+	data->index_mf_to_mpoly = index_mf_to_mpoly;
+	data->index_mp_to_orig  = index_mp_to_orig;
 
 	/* compute number of children per original face */
 	for (a = 0; a < tot; a++) {
-		b = (origindex) ? origindex[ctx->index[a]] : ctx->index[a];
-		if (b != -1)
+		b = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, ctx->index[a]) : ctx->index[a];
+		if (b != ORIGINDEX_NONE) {
 			elems[b].totchild++;
+		}
 	}
 
 	/* compute areas and centers of original faces */
 	for (mf = mface, a = 0; a < totface; a++, mf++) {
-		b = (origindex) ? origindex[a] : a;
+		b = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
 
-		if (b != -1) {
+		if (b != ORIGINDEX_NONE) {
 			copy_v3_v3(co1, mvert[mf->v1].co);
 			copy_v3_v3(co2, mvert[mf->v2].co);
 			copy_v3_v3(co3, mvert[mf->v3].co);
@@ -898,7 +913,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 			elem->scalemax = sqrt(elem->scalemax);
 
 			/* clamp scaling */
-			scaleclamp = MIN2(elem->totchild, 10.0f);
+			scaleclamp = (float)min_ii(elem->totchild, 10);
 			elem->scalemin = MIN2(scaleclamp, elem->scalemin);
 			elem->scalemax = MIN2(scaleclamp, elem->scalemax);
 
@@ -930,8 +945,9 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 
 	skipped = 0;
 	for (a = 0, newtot = 0; a < tot; a++) {
-		b = (origindex) ? origindex[ctx->index[a]] : ctx->index[a];
-		if (b != -1) {
+		b = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, ctx->index[a]) : ctx->index[a];
+
+		if (b != ORIGINDEX_NONE) {
 			if (elems[b].curchild++ < ceil(elems[b].lambda * elems[b].totchild)) {
 				ctx->index[newtot] = ctx->index[a];
 				ctx->skip[newtot] = skipped;
@@ -962,10 +978,10 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
 	data = psys->renderdata;
 	if (!data->do_simplify)
 		return 0;
-	
-	b = (data->origindex) ? data->origindex[cpa->num] : cpa->num;
-	if (b == -1)
+	b = (data->index_mf_to_mpoly) ? DM_origindex_mface_mpoly(data->index_mf_to_mpoly, data->index_mp_to_orig, cpa->num) : cpa->num;
+	if (b == ORIGINDEX_NONE) {
 		return 0;
+	}
 
 	elem = &data->elems[b];
 
@@ -1403,7 +1419,8 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
 /************************************************/
 /* interpolate a location on a face based on face coordinates */
 void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*orcodata)[3],
-                           float *w, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+                           float w[4], float vec[3], float nor[3], float utan[3], float vtan[3],
+                           float orco[3], float ornor[3])
 {
 	float *v1 = 0, *v2 = 0, *v3 = 0, *v4 = 0;
 	float e1[3], e2[3], s1, s2, t1, t2;
@@ -1622,17 +1639,22 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
 	Mesh *me = (Mesh *)ob->data;
 	MPoly *mpoly;
 	OrigSpaceFace *osface;
-	int *origindex;
 	int quad, findex, totface;
 	float uv[2], (*faceuv)[2];
 
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
 	mpoly = dm->getPolyArray(dm);
-	origindex = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	osface = dm->getTessFaceDataArray(dm, CD_ORIGSPACE);
 
 	totface = dm->getNumTessFaces(dm);
 	
-	if (osface == NULL || origindex == NULL) {
+	if (osface == NULL || index_mf_to_mpoly == NULL) {
 		/* Assume we don't need osface data */
 		if (index < totface) {
 			//printf("\tNO CD_ORIGSPACE, assuming not needed\n");
@@ -1666,7 +1688,8 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
 	}
 	else { /* if we have no node, try every face */
 		for (findex = 0; findex < totface; findex++) {
-			if (origindex[findex] == index) {
+			const int findex_orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, findex);
+			if (findex_orig == index) {
 				faceuv = osface[findex].uv;
 				quad = (mpoly[findex].totloop == 4);
 
@@ -1746,7 +1769,9 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
 }
 
 /* interprets particle data to get a point on a mesh in object space */
-void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3], float ornor[3])
+void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache,
+                         const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3],
+                         float orco[3], float ornor[3])
 {
 	float tmpnor[3], mapfw[4];
 	float (*orcodata)[3];
@@ -1842,7 +1867,9 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
 /*			Particles on a shape				*/
 /************************************************/
 /* ready for future use */
-static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index),
+                                   float *UNUSED(fuv), float vec[3], float nor[3], float utan[3], float vtan[3],
+                                   float orco[3], float ornor[3])
 {
 	/* TODO */
 	float zerovec[3] = {0.0f, 0.0f, 0.0f};
@@ -1868,7 +1895,9 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
 /************************************************/
 /*			Particles on emitter				*/
 /************************************************/
-void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache,
+                              float fuv[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3],
+                              float orco[3], float ornor[3])
 {
 	if (psmd) {
 		if (psmd->psys->part->distr == PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
@@ -2456,7 +2485,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
 		totthread = 1;
 	
 	for (i = 0; i < totthread; i++) {
-		threads[i].rng_path = rng_new(seed);
+		threads[i].rng_path = BLI_rng_new(seed);
 		threads[i].tot = totthread;
 	}
 
@@ -3298,7 +3327,7 @@ void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
 		to->time = to_time;
 	}
 }
-void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time)
+void psys_get_from_key(ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
 {
 	if (loc) copy_v3_v3(loc, key->co);
 	if (vel) copy_v3_v3(vel, key->vel);
@@ -3757,14 +3786,22 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
 	return 1;
 }
 
-#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)  \
-	if ((event & mtex->mapto) & type) { pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)                            \
+	if ((event & mtex->mapto) & type) {                                       \
+		pvalue = texture_value_blend(def, pvalue, value, texfac, blend);      \
+	} (void)0
 
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)  \
-	if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)                              \
+	if (event & type) {                                                       \
+		if (pvalue < 0.0f)                                                    \
+			pvalue = 1.0f + pvalue;                                           \
+		CLAMP(pvalue, 0.0f, 1.0f);                                            \
+	} (void)0
 
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)  \
-	if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)                           \
+	if (event & type) {                                                       \
+		CLAMP(pvalue, -1.0f, 1.0f);                                           \
+	} (void)0
 
 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
 {
@@ -3773,8 +3810,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
 	float value, rgba[4], texvec[3];
 
 	ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp =
-	                                                         ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
-	                                                                                                                      ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
+	ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
+	ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f;
 
 	ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
 	ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
@@ -4319,7 +4356,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 	if (pa) {
 		if (!always) {
 			if ((cfra < pa->time    && (part->flag & PART_UNBORN) == 0) ||
-			    (cfra > pa->dietime && (part->flag & PART_DIED)   == 0))
+			    (cfra >= pa->dietime && (part->flag & PART_DIED)  == 0))
 			{
 				return 0;
 			}
@@ -4414,7 +4451,9 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 	}
 }
 
-void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco)
+void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part,
+                            ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa,
+                            float uv[2], float orco[3])
 {
 	MFace *mface;
 	MTFace *mtface;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 154c8cc..90889d7 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -346,7 +346,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
 	if (!dm->deformedOnly) {
 		/* Will use later to speed up subsurf/derivedmesh */
 		LinkNode *node, *nodedmelem, **nodearray;
-		int totdmelem, totelem, i, *origindex;
+		int totdmelem, totelem, i, *origindex, *origindex_poly = NULL;
 
 		if (psys->part->from == PART_FROM_VERT) {
 			totdmelem= dm->getNumVerts(dm);
@@ -356,23 +356,38 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
 		else { /* FROM_FACE/FROM_VOLUME */
 			totdmelem= dm->getNumTessFaces(dm);
 			totelem= me->totpoly;
-			origindex= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+			origindex = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+			/* for face lookups we need the poly origindex too */
+			origindex_poly = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+			if (origindex_poly == NULL) {
+				origindex = NULL;
+			}
 		}
 	
 		nodedmelem= MEM_callocN(sizeof(LinkNode)*totdmelem, "psys node elems");
 		nodearray= MEM_callocN(sizeof(LinkNode *)*totelem, "psys node array");
 		
-		for (i=0, node=nodedmelem; i<totdmelem; i++, origindex++, node++) {
-			node->link= SET_INT_IN_POINTER(i);
+		for (i=0, node=nodedmelem; i<totdmelem; i++, node++) {
+			int origindex_final;
+			node->link = SET_INT_IN_POINTER(i);
+
+			/* may be vertex or face origindex */
+			origindex_final = origindex ? origindex[i] : ORIGINDEX_NONE;
+
+			/* if we have a poly source, do an index lookup */
+			if (origindex_poly && origindex_final != ORIGINDEX_NONE) {
+				origindex_final = origindex_poly[origindex_final];
+			}
 
-			if (*origindex != -1) {
-				if (nodearray[*origindex]) {
+			if (origindex_final != ORIGINDEX_NONE) {
+				if (nodearray[origindex_final]) {
 					/* prepend */
-					node->next = nodearray[*origindex];
-					nodearray[*origindex]= node;
+					node->next = nodearray[origindex_final];
+					nodearray[origindex_final] = node;
+				}
+				else {
+					nodearray[origindex_final] = node;
 				}
-				else
-					nodearray[*origindex]= node;
 			}
 		}
 		
@@ -452,13 +467,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 	mv++;
 
 	for (i=1; i<totvert; i++, mv++) {
-		min[0]=MIN2(min[0],mv->co[0]);
-		min[1]=MIN2(min[1],mv->co[1]);
-		min[2]=MIN2(min[2],mv->co[2]);
-
-		max[0]=MAX2(max[0],mv->co[0]);
-		max[1]=MAX2(max[1],mv->co[1]);
-		max[2]=MAX2(max[2],mv->co[2]);
+		minmax_v3v3_v3(min, max, mv->co);
 	}
 
 	sub_v3_v3v3(delta, max, min);
@@ -556,8 +565,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 							else /* store number of intersections */
 								(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
 						}
-						
-						if (mface->v4) {
+						else if (mface->v4) {
 							copy_v3_v3(v4, mvert[mface->v4].co);
 
 							if (isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
@@ -632,10 +640,10 @@ static void hammersley_create(float *out, int n, int seed, float amount)
 	double p, t, offs[2];
 	int k, kk;
 
-	rng = rng_new(31415926 + n + seed);
-	offs[0]= rng_getDouble(rng) + (double)amount;
-	offs[1]= rng_getDouble(rng) + (double)amount;
-	rng_free(rng);
+	rng = BLI_rng_new(31415926 + n + seed);
+	offs[0] = BLI_rng_get_double(rng) + (double)amount;
+	offs[1] = BLI_rng_get_double(rng) + (double)amount;
+	BLI_rng_free(rng);
 
 	for (k = 0; k < n; k++) {
 		t = 0;
@@ -643,8 +651,8 @@ static void hammersley_create(float *out, int n, int seed, float amount)
 			if (kk & 1) /* kk mod 2 = 1 */
 				t += p;
 
-		out[2*k + 0]= fmod((double)k/(double)n + offs[0], 1.0);
-		out[2*k + 1]= fmod(t + offs[1], 1.0);
+		out[2*k + 0] = fmod((double)k/(double)n + offs[0], 1.0);
+		out[2*k + 1] = fmod(t + offs[1], 1.0);
 	}
 }
 
@@ -661,13 +669,13 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
 	rad2= (float)(1.0f/((float)num));
 	rad3= (float)sqrt((float)num)/((float)num);
 
-	rng = rng_new(31415926 + num + seed2);
+	rng = BLI_rng_new(31415926 + num + seed2);
 	x= 0;
 		num2 = 2 * num;
 	for (i=0; i<num2; i+=2) {
 	
-		jit[i]= x + amount*rad1*(0.5f - rng_getFloat(rng));
-		jit[i+1]= i/(2.0f*num) + amount*rad1*(0.5f - rng_getFloat(rng));
+		jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng));
+		jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - BLI_rng_get_float(rng));
 		
 		jit[i]-= (float)floor(jit[i]);
 		jit[i+1]-= (float)floor(jit[i+1]);
@@ -684,7 +692,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
 		BLI_jitterate2(jit, jit2, num, rad2);
 	}
 	MEM_freeN(jit2);
-	rng_free(rng);
+	BLI_rng_free(rng);
 }
 
 static void psys_uv_to_w(float u, float v, int quad, float *w)
@@ -698,21 +706,21 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
 			u= 1.0f-u;
 	}
 
-	vert[0][0]= 0.0f; vert[0][1]= 0.0f; vert[0][2]= 0.0f;
-	vert[1][0]= 1.0f; vert[1][1]= 0.0f; vert[1][2]= 0.0f;
-	vert[2][0]= 1.0f; vert[2][1]= 1.0f; vert[2][2]= 0.0f;
+	vert[0][0] = 0.0f; vert[0][1] = 0.0f; vert[0][2] = 0.0f;
+	vert[1][0] = 1.0f; vert[1][1] = 0.0f; vert[1][2] = 0.0f;
+	vert[2][0] = 1.0f; vert[2][1] = 1.0f; vert[2][2] = 0.0f;
 
-	co[0]= u;
-	co[1]= v;
-	co[2]= 0.0f;
+	co[0] = u;
+	co[1] = v;
+	co[2] = 0.0f;
 
 	if (quad) {
-		vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f;
+		vert[3][0] = 0.0f; vert[3][1] = 1.0f; vert[3][2] = 0.0f;
 		interp_weights_poly_v3( w,vert, 4, co);
 	}
 	else {
 		interp_weights_poly_v3( w,vert, 3, co);
-		w[3]= 0.0f;
+		w[3] = 0.0f;
 	}
 }
 
@@ -804,8 +812,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 			}
 			break;
 		case PART_DISTR_RAND:
-			randu= rng_getFloat(thread->rng);
-			randv= rng_getFloat(thread->rng);
+			randu= BLI_rng_get_float(thread->rng);
+			randv= BLI_rng_get_float(thread->rng);
 			rng_skip_tot -= 2;
 
 			psys_uv_to_w(randu, randv, mface->v4, pa->fuv);
@@ -881,8 +889,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 
 		mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE);
 
-		randu= rng_getFloat(thread->rng);
-		randv= rng_getFloat(thread->rng);
+		randu= BLI_rng_get_float(thread->rng);
+		randv= BLI_rng_get_float(thread->rng);
 		rng_skip_tot -= 2;
 
 		psys_uv_to_w(randu, randv, mf->v4, cpa->fuv);
@@ -934,7 +942,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 	}
 
 	if (rng_skip_tot > 0) /* should never be below zero */
-		rng_skip(thread->rng, rng_skip_tot);
+		BLI_rng_skip(thread->rng, rng_skip_tot);
 }
 
 static void *distribute_threads_exec_cb(void *data)
@@ -951,12 +959,12 @@ static void *distribute_threads_exec_cb(void *data)
 
 		for (p=0; p<totpart; p++, cpa++) {
 			if (thread->ctx->skip) /* simplification skip */
-				rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]);
+				BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]);
 
 			if ((p+thread->num) % thread->tot == 0)
 				distribute_threads_exec(thread, NULL, cpa, p);
 			else /* thread skip */
-				rng_skip(thread->rng, PSYS_RND_DIST_SKIP);
+				BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP);
 		}
 	}
 	else {
@@ -973,8 +981,8 @@ static void *distribute_threads_exec_cb(void *data)
 static int *COMPARE_ORIG_INDEX = NULL;
 static int distribute_compare_orig_index(const void *p1, const void *p2)
 {
-	int index1 = COMPARE_ORIG_INDEX[*(const int*)p1];
-	int index2 = COMPARE_ORIG_INDEX[*(const int*)p2];
+	int index1 = COMPARE_ORIG_INDEX[*(const int *)p1];
+	int index2 = COMPARE_ORIG_INDEX[*(const int *)p2];
 
 	if (index1 < index2)
 		return -1;
@@ -1000,7 +1008,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
 
 		if (psys->child && totchild) {
 			for (p=0,cpa=psys->child; p<totchild; p++,cpa++) {
-				cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
+				cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3] = 0.0;
 				cpa->foffset= 0.0f;
 				cpa->parent=0;
 				cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0;
@@ -1011,7 +1019,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
 	else {
 		PARTICLE_P;
 		LOOP_PARTICLES {
-			pa->fuv[0]=pa->fuv[1]=pa->fuv[2]= pa->fuv[3]= 0.0;
+			pa->fuv[0] = pa->fuv[1] = pa->fuv[2] = pa->fuv[3] = 0.0;
 			pa->foffset= 0.0f;
 			pa->num= -1;
 		}
@@ -1113,7 +1121,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 
 		if (from == PART_FROM_VERT) {
 			MVert *mv= dm->getVertDataArray(dm, CD_MVERT);
-			float (*orcodata)[3]= dm->getVertDataArray(dm, CD_ORCO);
+			float (*orcodata)[3] = dm->getVertDataArray(dm, CD_ORCO);
 			int totvert = dm->getNumVerts(dm);
 
 			tree=BLI_kdtree_new(totvert);
@@ -1245,9 +1253,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	inv_totweight = (totweight > 0.f ? 1.f/totweight : 0.f);
 
 	/* Calculate cumulative weights */
-	element_sum[0]= 0.0f;
+	element_sum[0] = 0.0f;
 	for (i=0; i<totelem; i++)
-		element_sum[i+1]= element_sum[i] + element_weight[i] * inv_totweight;
+		element_sum[i+1] = element_sum[i] + element_weight[i] * inv_totweight;
 	
 	/* Finally assign elements to particles */
 	if ((part->flag&PART_TRAND) || (part->simplify_flag&PART_SIMPLIFY_ENABLE)) {
@@ -1256,9 +1264,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 		for (p=0; p<totpart; p++) {
 			/* In theory element_sum[totelem] should be 1.0, but due to float errors this is not necessarily always true, so scale pos accordingly. */
 			pos= BLI_frand() * element_sum[totelem];
-			particle_element[p]= distribute_binary_search(element_sum, totelem, pos);
-			particle_element[p]= MIN2(totelem-1, particle_element[p]);
-			jitter_offset[particle_element[p]]= pos;
+			particle_element[p] = distribute_binary_search(element_sum, totelem, pos);
+			particle_element[p] = MIN2(totelem-1, particle_element[p]);
+			jitter_offset[particle_element[p]] = pos;
 		}
 	}
 	else {
@@ -1269,16 +1277,16 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 		i= 0;
 
 		for (p=0; p<totpart; p++, pos+=step) {
-			while ((i < totelem) && (pos > element_sum[i+1]))
+			while ((i < totelem) && (pos > (double)element_sum[i + 1]))
 				i++;
 
-			particle_element[p]= MIN2(totelem-1, i);
+			particle_element[p] = MIN2(totelem-1, i);
 
 			/* avoid zero weight face */
 			if (p == totpart-1 && element_weight[particle_element[p]] == 0.0f)
-				particle_element[p]= particle_element[p-1];
+				particle_element[p] = particle_element[p-1];
 
-			jitter_offset[particle_element[p]]= pos;
+			jitter_offset[particle_element[p]] = pos;
 		}
 	}
 
@@ -1353,7 +1361,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	
 	seed= 31415926 + ctx->sim.psys->seed;
 	for (i=0; i<totthread; i++) {
-		threads[i].rng= rng_new(seed);
+		threads[i].rng= BLI_rng_new(seed);
 		threads[i].tot= totthread;
 	}
 
@@ -1492,9 +1500,9 @@ void psys_threads_free(ParticleThread *threads)
 	/* threads */
 	for (i=0; i<totthread; i++) {
 		if (threads[i].rng)
-			rng_free(threads[i].rng);
+			BLI_rng_free(threads[i].rng);
 		if (threads[i].rng_path)
-			rng_free(threads[i].rng_path);
+			BLI_rng_free(threads[i].rng_path);
 	}
 
 	MEM_freeN(ctx);
@@ -1583,7 +1591,7 @@ static void get_angular_velocity_vector(short avemode, ParticleKey *state, float
 	switch (avemode) {
 		case PART_AVE_VELOCITY:
 			copy_v3_v3(vec, state->vel);
-			break;	
+			break;
 		case PART_AVE_HORIZONTAL:
 		{
 			float zvec[3];
@@ -1622,9 +1630,9 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 	ParticleSystem *psys = sim->psys;
 	ParticleSettings *part;
 	ParticleTexture ptex;
-	float fac, phasefac, nor[3]={0,0,0},loc[3],vel[3]={0.0,0.0,0.0},rot[4],q2[4];
-	float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3]={0.0,0.0,0.0};
-	float x_vec[3]={1.0,0.0,0.0}, utan[3]={0.0,1.0,0.0}, vtan[3]={0.0,0.0,1.0}, rot_vec[3]={0.0,0.0,0.0};
+	float fac, phasefac, nor[3] = {0,0,0},loc[3],vel[3] = {0.0,0.0,0.0},rot[4],q2[4];
+	float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3] = {0.0,0.0,0.0};
+	float x_vec[3] = {1.0,0.0,0.0}, utan[3] = {0.0,1.0,0.0}, vtan[3] = {0.0,0.0,1.0}, rot_vec[3] = {0.0,0.0,0.0};
 	float q_phase[4];
 	int p = pa - psys->particles;
 	part=psys->part;
@@ -2132,16 +2140,22 @@ static void psys_update_effectors(ParticleSimulationData *sim)
 	precalc_guides(sim, sim->psys->effectors);
 }
 
-static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, void (*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), void *forcedata)
+static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration,
+                               void (*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse),
+                               void *forcedata)
 {
+#define ZERO_F43 {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}
+
 	ParticleKey states[5];
-	float force[3],acceleration[3],impulse[3],dx[4][3],dv[4][3],oldpos[3];
+	float force[3], acceleration[3], impulse[3], dx[4][3] = ZERO_F43, dv[4][3] = ZERO_F43, oldpos[3];
 	float pa_mass= (part->flag & PART_SIZEMASS ? part->mass * pa->size : part->mass);
 	int i, steps=1;
 	int integrator = part->integrator;
 
+#undef ZERO_F43
+
 	copy_v3_v3(oldpos, pa->state.co);
-	
+
 	/* Verlet integration behaves strangely with moving emitters, so do first step with euler. */
 	if (pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
 		integrator = PART_INT_EULER;
@@ -2537,7 +2551,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
 		madd_v3_v3fl(force, vec, -(pressure + near_pressure*q)*q);
 
 		/* Viscosity */
-		if (visc > 0.f	|| stiff_visc > 0.f) {		
+		if (visc > 0.f  || stiff_visc > 0.f) {
 			sub_v3_v3v3(dv, vel, state->vel);
 			u = dot_v3v3(vec, dv);
 
@@ -2736,7 +2750,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
 }
 static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep)
 {
-	float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac;
+	float rotfac, rot1[4], rot2[4] = {1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac;
 
 	if ((part->flag & PART_ROTATIONS) == 0) {
 		unit_qt(pa->state.rot);
@@ -3166,8 +3180,7 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay
 	if (col->hit == col->current && col->pce.index == index && col->pce.tot == 3)
 		return;
 
-	do
-	{	
+	do {
 		collision = collision_sphere_to_tri(col, ray->radius, &pce, &t);
 		if (col->pce.inside == 0) {
 			collision += collision_sphere_to_edges(col, ray->radius, &pce, &t);
@@ -4076,7 +4089,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 	{
 		FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim);
 		
-		if ( fluidmd && fluidmd->fss) { 
+		if ( fluidmd && fluidmd->fss) {
 			FluidsimSettings *fss= fluidmd->fss;
 			ParticleSettings *part = psys->part;
 			ParticleData *pa=NULL;
@@ -4121,7 +4134,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 				int ptype=0;
 	
 				gzread(gzf, &ptype, sizeof( ptype )); 
-				if (ptype&readMask) {
+				if (ptype & readMask) {
 					activeParts++;
 	
 					gzread(gzf, &(pa->size), sizeof(float));
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 8c0d19b..965a1e2 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -249,9 +249,9 @@ static int  ptcache_particle_write(int index, void *psys_v, void **data, int cfr
 	if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
 		return 0;
 
-	times[0]= pa->time;
-	times[1]= pa->dietime;
-	times[2]= pa->lifetime;
+	times[0] = pa->time;
+	times[1] = pa->dietime;
+	times[2] = pa->lifetime;
 
 	PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index);
 	PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co);
@@ -532,20 +532,31 @@ static int  ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra))
 	SmokeDomainSettings *sds = smd->domain;
 	
 	if (sds->fluid) {
-		return sds->res[0]*sds->res[1]*sds->res[2];
+		return sds->base_res[0]*sds->base_res[1]*sds->base_res[2];
 	}
 	else
 		return 0;
 }
+
+#define SMOKE_CACHE_VERSION "1.04"
+
 static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 {	
 	SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
 	SmokeDomainSettings *sds = smd->domain;
 	int ret = 0;
+	int fluid_fields = smoke_get_data_flags(sds);
+
+	/* version header */
+	ptcache_file_write(pf, SMOKE_CACHE_VERSION, 4, sizeof(char));
+	ptcache_file_write(pf, &fluid_fields, 1, sizeof(int));
+	ptcache_file_write(pf, &sds->active_fields, 1, sizeof(int));
+	ptcache_file_write(pf, &sds->res, 3, sizeof(int));
+	ptcache_file_write(pf, &sds->dx, 1, sizeof(float));
 	
 	if (sds->fluid) {
 		size_t res = sds->res[0]*sds->res[1]*sds->res[2];
-		float dt, dx, *dens, *densold, *heat, *heatold, *vx, *vy, *vz, *vxold, *vyold, *vzold;
+		float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
 		unsigned char *obstacles;
 		unsigned int in_len = sizeof(float)*(unsigned int)res;
 		unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer");
@@ -553,22 +564,40 @@ static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 		int mode=1;		// light
 		if (sds->cache_comp == SM_CACHE_HEAVY) mode=2;	// heavy
 
-		smoke_export(sds->fluid, &dt, &dx, &dens, &densold, &heat, &heatold, &vx, &vy, &vz, &vxold, &vyold, &vzold, &obstacles);
+		smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
 
 		ptcache_file_compressed_write(pf, (unsigned char *)sds->shadow, in_len, out, mode);
 		ptcache_file_compressed_write(pf, (unsigned char *)dens, in_len, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)densold, in_len, out, mode);	
-		ptcache_file_compressed_write(pf, (unsigned char *)heat, in_len, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)heatold, in_len, out, mode);
+		if (fluid_fields & SM_ACTIVE_HEAT) {
+			ptcache_file_compressed_write(pf, (unsigned char *)heat, in_len, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)heatold, in_len, out, mode);
+		}
+		if (fluid_fields & SM_ACTIVE_FIRE) {
+			ptcache_file_compressed_write(pf, (unsigned char *)flame, in_len, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)fuel, in_len, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)react, in_len, out, mode);
+		}
+		if (fluid_fields & SM_ACTIVE_COLORS) {
+			ptcache_file_compressed_write(pf, (unsigned char *)r, in_len, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)g, in_len, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)b, in_len, out, mode);
+		}
 		ptcache_file_compressed_write(pf, (unsigned char *)vx, in_len, out, mode);
 		ptcache_file_compressed_write(pf, (unsigned char *)vy, in_len, out, mode);
 		ptcache_file_compressed_write(pf, (unsigned char *)vz, in_len, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)vxold, in_len, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)vyold, in_len, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)vzold, in_len, out, mode);
 		ptcache_file_compressed_write(pf, (unsigned char *)obstacles, (unsigned int)res, out, mode);
 		ptcache_file_write(pf, &dt, 1, sizeof(float));
 		ptcache_file_write(pf, &dx, 1, sizeof(float));
+		ptcache_file_write(pf, &sds->p0, 3, sizeof(float));
+		ptcache_file_write(pf, &sds->p1, 3, sizeof(float));
+		ptcache_file_write(pf, &sds->dp0, 3, sizeof(float));
+		ptcache_file_write(pf, &sds->shift, 3, sizeof(int));
+		ptcache_file_write(pf, &sds->obj_shift_f, 3, sizeof(float));
+		ptcache_file_write(pf, &sds->obmat, 16, sizeof(float));
+		ptcache_file_write(pf, &sds->base_res, 3, sizeof(int));
+		ptcache_file_write(pf, &sds->res_min, 3, sizeof(int));
+		ptcache_file_write(pf, &sds->res_max, 3, sizeof(int));
+		ptcache_file_write(pf, &sds->active_color, 3, sizeof(float));
 
 		MEM_freeN(out);
 		
@@ -579,7 +608,7 @@ static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 		int res_big_array[3];
 		int res_big;
 		int res = sds->res[0]*sds->res[1]*sds->res[2];
-		float *dens, *densold, *tcu, *tcv, *tcw;
+		float *dens, *react, *fuel, *flame, *tcu, *tcv, *tcw, *r, *g, *b;
 		unsigned int in_len = sizeof(float)*(unsigned int)res;
 		unsigned int in_len_big;
 		unsigned char *out;
@@ -593,11 +622,20 @@ static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 
 		in_len_big = sizeof(float) * (unsigned int)res_big;
 
-		smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw);
+		smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
 
 		out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len_big), "pointcache_lzo_buffer");
 		ptcache_file_compressed_write(pf, (unsigned char *)dens, in_len_big, out, mode);
-		ptcache_file_compressed_write(pf, (unsigned char *)densold, in_len_big, out, mode);	
+		if (fluid_fields & SM_ACTIVE_FIRE) {
+			ptcache_file_compressed_write(pf, (unsigned char *)flame, in_len_big, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)fuel, in_len_big, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)react, in_len_big, out, mode);
+		}
+		if (fluid_fields & SM_ACTIVE_COLORS) {
+			ptcache_file_compressed_write(pf, (unsigned char *)r, in_len_big, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)g, in_len_big, out, mode);
+			ptcache_file_compressed_write(pf, (unsigned char *)b, in_len_big, out, mode);
+		}
 		MEM_freeN(out);
 
 		out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
@@ -615,34 +653,95 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
 {
 	SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
 	SmokeDomainSettings *sds = smd->domain;
+	char version[4];
+	int ch_res[3];
+	float ch_dx;
+	int fluid_fields = smoke_get_data_flags(sds);
+	int cache_fields = 0;
+	int active_fields = 0;
+	int reallocate = 0;
+
+	/* version header */
+	ptcache_file_read(pf, version, 4, sizeof(char));
+	if (strncmp(version, SMOKE_CACHE_VERSION, 4)) return 0;
+	/* fluid info */
+	ptcache_file_read(pf, &cache_fields, 1, sizeof(int));
+	ptcache_file_read(pf, &active_fields, 1, sizeof(int));
+	ptcache_file_read(pf, &ch_res, 3, sizeof(int));
+	ptcache_file_read(pf, &ch_dx, 1, sizeof(float));
+
+	/* check if resolution has changed */
+	if (sds->res[0] != ch_res[0] ||
+		sds->res[1] != ch_res[1] ||
+		sds->res[2] != ch_res[2]) {
+		if (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN)
+			reallocate = 1;
+		else
+			return 0;
+	}
+	/* check if active fields have changed */
+	if (fluid_fields != cache_fields ||
+		active_fields != sds->active_fields)
+		reallocate = 1;
+
+	/* reallocate fluid if needed*/
+	if (reallocate) {
+		sds->active_fields = active_fields | cache_fields;
+		smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
+		sds->dx = ch_dx;
+		VECCOPY(sds->res, ch_res);
+		sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2];
+		if (sds->flags & MOD_SMOKE_HIGHRES) {
+			smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
+		}
+	}
 	
 	if (sds->fluid) {
 		size_t res = sds->res[0]*sds->res[1]*sds->res[2];
-		float dt, dx, *dens, *densold, *heat, *heatold, *vx, *vy, *vz, *vxold, *vyold, *vzold;
+		float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
 		unsigned char *obstacles;
 		unsigned int out_len = (unsigned int)res * sizeof(float);
 		
-		smoke_export(sds->fluid, &dt, &dx, &dens, &densold, &heat, &heatold, &vx, &vy, &vz, &vxold, &vyold, &vzold, &obstacles);
+		smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
 
 		ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)densold, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)heat, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)heatold, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vx, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vy, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vz, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vxold, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vyold, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)vzold, out_len);
-		ptcache_file_compressed_read(pf, (unsigned char*)obstacles, (unsigned int)res);
+		ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len);
+		if (cache_fields & SM_ACTIVE_HEAT) {
+			ptcache_file_compressed_read(pf, (unsigned char *)heat, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)heatold, out_len);
+		}
+		if (cache_fields & SM_ACTIVE_FIRE) {
+			ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)fuel, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)react, out_len);
+		}
+		if (cache_fields & SM_ACTIVE_COLORS) {
+			ptcache_file_compressed_read(pf, (unsigned char *)r, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)g, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)b, out_len);
+		}
+		ptcache_file_compressed_read(pf, (unsigned char *)vx, out_len);
+		ptcache_file_compressed_read(pf, (unsigned char *)vy, out_len);
+		ptcache_file_compressed_read(pf, (unsigned char *)vz, out_len);
+		ptcache_file_compressed_read(pf, (unsigned char *)obstacles, (unsigned int)res);
 		ptcache_file_read(pf, &dt, 1, sizeof(float));
 		ptcache_file_read(pf, &dx, 1, sizeof(float));
-
-		if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
+		ptcache_file_read(pf, &sds->p0, 3, sizeof(float));
+		ptcache_file_read(pf, &sds->p1, 3, sizeof(float));
+		ptcache_file_read(pf, &sds->dp0, 3, sizeof(float));
+		ptcache_file_read(pf, &sds->shift, 3, sizeof(int));
+		ptcache_file_read(pf, &sds->obj_shift_f, 3, sizeof(float));
+		ptcache_file_read(pf, &sds->obmat, 16, sizeof(float));
+		ptcache_file_read(pf, &sds->base_res, 3, sizeof(int));
+		ptcache_file_read(pf, &sds->res_min, 3, sizeof(int));
+		ptcache_file_read(pf, &sds->res_max, 3, sizeof(int));
+		ptcache_file_read(pf, &sds->active_color, 3, sizeof(float));
+	}
+
+	if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
 			int res = sds->res[0]*sds->res[1]*sds->res[2];
 			int res_big, res_big_array[3];
-			float *dens, *densold, *tcu, *tcv, *tcw;
+			float *dens, *react, *fuel, *flame, *tcu, *tcv, *tcw, *r, *g, *b;
 			unsigned int out_len = sizeof(float)*(unsigned int)res;
 			unsigned int out_len_big;
 
@@ -650,16 +749,24 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
 			res_big = res_big_array[0]*res_big_array[1]*res_big_array[2];
 			out_len_big = sizeof(float) * (unsigned int)res_big;
 
-			smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw);
+			smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
 
-			ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len_big);
-			ptcache_file_compressed_read(pf, (unsigned char*)densold, out_len_big);
+			ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len_big);
+			if (cache_fields & SM_ACTIVE_FIRE) {
+				ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len_big);
+				ptcache_file_compressed_read(pf, (unsigned char *)fuel, out_len_big);
+				ptcache_file_compressed_read(pf, (unsigned char *)react, out_len_big);
+			}
+			if (cache_fields & SM_ACTIVE_COLORS) {
+				ptcache_file_compressed_read(pf, (unsigned char *)r, out_len_big);
+				ptcache_file_compressed_read(pf, (unsigned char *)g, out_len_big);
+				ptcache_file_compressed_read(pf, (unsigned char *)b, out_len_big);
+			}
 
-			ptcache_file_compressed_read(pf, (unsigned char*)tcu, out_len);
-			ptcache_file_compressed_read(pf, (unsigned char*)tcv, out_len);
-			ptcache_file_compressed_read(pf, (unsigned char*)tcw, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)tcu, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)tcv, out_len);
+			ptcache_file_compressed_read(pf, (unsigned char *)tcw, out_len);
 		}
-	}
 
 	return 1;
 }
@@ -753,7 +860,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
 			return 0;
 		}
 
-		ptcache_file_compressed_read(pf, (unsigned char*)surface->data->type_data, data_len*surface->data->total_points);
+		ptcache_file_compressed_read(pf, (unsigned char *)surface->data->type_data, data_len*surface->data->total_points);
 
 	}
 	return 1;
@@ -1257,7 +1364,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
 	if (mode == 1) {
 		LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
 		
-		r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);	
+		r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);
 		if (!(r == LZO_E_OK) || (out_len >= in_len))
 			compressed = 0;
 		else
@@ -1593,7 +1700,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 			for (i=0; i<BPHYS_TOT_DATA; i++) {
 				unsigned int out_len = pm->totpoint*ptcache_data_size[i];
 				if (pf->data_types & (1<<i))
-					ptcache_file_compressed_read(pf, (unsigned char*)(pm->data[i]), out_len);
+					ptcache_file_compressed_read(pf, (unsigned char *)(pm->data[i]), out_len);
 			}
 		}
 		else {
@@ -1624,7 +1731,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 			extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Pointcache extradata->data");
 
 			if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS)
-				ptcache_file_compressed_read(pf, (unsigned char*)(extra->data), extra->totdata*ptcache_extra_datasize[extra->type]);
+				ptcache_file_compressed_read(pf, (unsigned char *)(extra->data), extra->totdata*ptcache_extra_datasize[extra->type]);
 			else
 				ptcache_file_read(pf, extra->data, extra->totdata, ptcache_extra_datasize[extra->type]);
 
@@ -1681,7 +1788,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 				if (pm->data[i]) {
 					unsigned int in_len = pm->totpoint*ptcache_data_size[i];
 					unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer");
-					ptcache_file_compressed_write(pf, (unsigned char*)(pm->data[i]), in_len, out, pid->cache->compression);
+					ptcache_file_compressed_write(pf, (unsigned char *)(pm->data[i]), in_len, out, pid->cache->compression);
 					MEM_freeN(out);
 				}
 			}
@@ -1714,7 +1821,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 			if (pid->cache->compression) {
 				unsigned int in_len = extra->totdata * ptcache_extra_datasize[extra->type];
 				unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer");
-				ptcache_file_compressed_write(pf, (unsigned char*)(extra->data), in_len, out, pid->cache->compression);
+				ptcache_file_compressed_write(pf, (unsigned char *)(extra->data), in_len, out, pid->cache->compression);
 				MEM_freeN(out);
 			}
 			else {
@@ -1925,18 +2032,16 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra)
 		pid->cache->simframe = cfra2;
 	}
 
-	if ((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) {
-		cfrai = (int)cfra;
-		/* clear invalid cache frames so that better stuff can be simulated */
-		if (pid->cache->flag & PTCACHE_OUTDATED) {
-			BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai);
-		}
-		else if (pid->cache->flag & PTCACHE_FRAMES_SKIPPED) {
-			if (cfra <= pid->cache->last_exact)
-				pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED;
+	cfrai = (int)cfra;
+	/* clear invalid cache frames so that better stuff can be simulated */
+	if (pid->cache->flag & PTCACHE_OUTDATED) {
+		BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai);
+	}
+	else if (pid->cache->flag & PTCACHE_FRAMES_SKIPPED) {
+		if (cfra <= pid->cache->last_exact)
+			pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED;
 
-			BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai, pid->cache->last_exact));
-		}
+		BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai, pid->cache->last_exact));
 	}
 
 	return ret;
@@ -2167,7 +2272,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 	/* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */
 	switch (mode) {
 	case PTCACHE_CLEAR_ALL:
-	case PTCACHE_CLEAR_BEFORE:	
+	case PTCACHE_CLEAR_BEFORE:
 	case PTCACHE_CLEAR_AFTER:
 		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 			ptcache_path(pid, path);
@@ -2271,7 +2376,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 				}
 			}
 		}
-		if (pid->cache->cached_frames && cfra>=sta && cfra<=end)
+		if (pid->cache->cached_frames && cfra >= sta && cfra <= end)
 			pid->cache->cached_frames[cfra-sta] = 0;
 		break;
 	}
@@ -2358,7 +2463,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 		if (MEM_allocN_len(cache->cached_frames) != sizeof(char) * (cache->endframe-cache->startframe+1)) {
 			MEM_freeN(cache->cached_frames);
 			cache->cached_frames = NULL;
-		}	
+		}
 	}
 
 	if (cache->cached_frames==NULL && cache->endframe > cache->startframe) {
@@ -2431,8 +2536,6 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 
 	if (mode == PTCACHE_RESET_DEPSGRAPH) {
 		if (!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) {
-			if (cache->flag & PTCACHE_QUICK_CACHE)
-				clear= 1;
 
 			after= 1;
 		}
@@ -2466,10 +2569,12 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 			sbFreeSimulation(pid->calldata);
 		else if (pid->type == PTCACHE_TYPE_PARTICLES)
 			psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH);
+#if 0
 		else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
 			smokeModifier_reset(pid->calldata);
 		else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
 			smokeModifier_reset_turbulence(pid->calldata);
+#endif
 		else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
 			dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
 	}
@@ -2496,7 +2601,7 @@ int  BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
 	}
 
 	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
-		/* children or just redo can be calculated without reseting anything */
+		/* children or just redo can be calculated without resetting anything */
 		if (psys->recalc & PSYS_RECALC_REDO || psys->recalc & PSYS_RECALC_CHILD)
 			skip = 1;
 		/* Baked cloth hair has to be checked too, because we don't want to reset */
@@ -2720,6 +2825,8 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
 	return ptcaches_new->first;
 }
 
+/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on 
+ * every user action changing stuff, and then it runs a complete bake??? (ton) */
 
 /* Baking */
 void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene)
@@ -2903,7 +3010,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 					}
 
 					if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) &&
-					    ((cache->flag & PTCACHE_QUICK_CACHE)==0 || render || bake))
+					    (render || bake))
 					{
 						BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
 					}
@@ -3222,8 +3329,9 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 		cache->endframe = end;
 		cache->totpoint = 0;
 
-		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
-			; /*necessary info in every file*/
+		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) {
+			/* necessary info in every file */
+		}
 		/* read totpoint from info file (frame 0) */
 		else if (info) {
 			pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0);
@@ -3271,7 +3379,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 	if (cache->flag & PTCACHE_EXTERNAL) {
 		int cfra = cache->startframe;
 
-		for (; cfra<=cache->endframe; cfra++) {
+		for (; cfra <= cache->endframe; cfra++) {
 			if (BKE_ptcache_id_exist(pid, cfra))
 				totframes++;
 		}
@@ -3298,7 +3406,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 		else {
 			int cfra = cache->startframe;
 
-			for (; cfra<=cache->endframe; cfra++) {
+			for (; cfra <= cache->endframe; cfra++) {
 				if (BKE_ptcache_id_exist(pid, cfra))
 					totframes++;
 			}
@@ -3307,7 +3415,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 		}
 	}
 	else {
-		PTCacheMem *pm = cache->mem_cache.first;		
+		PTCacheMem *pm = cache->mem_cache.first;
 		float bytes = 0.0f;
 		int i, mb;
 		
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 3a66ec2..d925d73 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -34,6 +34,8 @@
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_report.h"
 #include "BKE_global.h" /* G.background only */
 
@@ -44,15 +46,24 @@
 static const char *report_type_str(int type)
 {
 	switch (type) {
-		case RPT_DEBUG: return "Debug";
-		case RPT_INFO: return "Info";
-		case RPT_OPERATOR: return "Operator";
-		case RPT_WARNING: return "Warning";
-		case RPT_ERROR: return "Error";
-		case RPT_ERROR_INVALID_INPUT: return "Invalid Input Error";
-		case RPT_ERROR_INVALID_CONTEXT: return "Invalid Context Error";
-		case RPT_ERROR_OUT_OF_MEMORY: return "Out Of Memory Error";
-		default: return "Undefined Type";
+		case RPT_DEBUG:
+			return TIP_("Debug");
+		case RPT_INFO:
+			return TIP_("Info");
+		case RPT_OPERATOR:
+			return TIP_("Operator");
+		case RPT_WARNING:
+			return TIP_("Warning");
+		case RPT_ERROR:
+			return TIP_("Error");
+		case RPT_ERROR_INVALID_INPUT:
+			return TIP_("Invalid Input Error");
+		case RPT_ERROR_INVALID_CONTEXT:
+			return TIP_("Invalid Context Error");
+		case RPT_ERROR_OUT_OF_MEMORY:
+			return TIP_("Out Of Memory Error");
+		default:
+			return TIP_("Undefined Type");
 	}
 }
 
@@ -87,10 +98,11 @@ void BKE_reports_clear(ReportList *reports)
 	reports->list.first = reports->list.last = NULL;
 }
 
-void BKE_report(ReportList *reports, ReportType type, const char *message)
+void BKE_report(ReportList *reports, ReportType type, const char *_message)
 {
 	Report *report;
 	int len;
+	const char *message = TIP_(_message);
 
 	/* in background mode always print otherwise there are cases the errors wont be displayed,
 	 * but still add to the report list since this is used for python exception handling */
@@ -114,14 +126,16 @@ void BKE_report(ReportList *reports, ReportType type, const char *message)
 	}
 }
 
-void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
+void BKE_reportf(ReportList *reports, ReportType type, const char *_format, ...)
 {
 	DynStr *ds;
 	Report *report;
 	va_list args;
+	const char *format = TIP_(_format);
 
 	if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
-		va_start(args, format);
+		printf("%s: ", report_type_str(type));
+		va_start(args, _format);
 		vprintf(format, args);
 		va_end(args);
 		fprintf(stdout, "\n"); /* otherise each report needs to include a \n */
@@ -132,7 +146,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
 		report = MEM_callocN(sizeof(Report), "Report");
 
 		ds = BLI_dynstr_new();
-		va_start(args, format);
+		va_start(args, _format);
 		BLI_dynstr_vappendf(ds, format, args);
 		va_end(args);
 
@@ -147,10 +161,11 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
 	}
 }
 
-void BKE_reports_prepend(ReportList *reports, const char *prepend)
+void BKE_reports_prepend(ReportList *reports, const char *_prepend)
 {
 	Report *report;
 	DynStr *ds;
+	const char *prepend = TIP_(_prepend);
 
 	if (!reports)
 		return;
@@ -169,18 +184,19 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend)
 	}
 }
 
-void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
+void BKE_reports_prependf(ReportList *reports, const char *_prepend, ...)
 {
 	Report *report;
 	DynStr *ds;
 	va_list args;
+	const char *prepend = TIP_(_prepend);
 
 	if (!reports)
 		return;
 
 	for (report = reports->list.first; report; report = report->next) {
 		ds = BLI_dynstr_new();
-		va_start(args, prepend);
+		va_start(args, _prepend);
 		BLI_dynstr_vappendf(ds, prepend, args);
 		va_end(args);
 
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 6c1fbbf..eb4e0d9 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -552,7 +552,7 @@ void set_sca_new_poins_ob(Object *ob)
 		if (sens->flag & SENS_NEW) {
 			for (a=0; a<sens->totlinks; a++) {
 				if (sens->links[a] && sens->links[a]->mynew)
-					sens->links[a]= sens->links[a]->mynew;
+					sens->links[a] = sens->links[a]->mynew;
 			}
 		}
 		sens= sens->next;
@@ -563,7 +563,7 @@ void set_sca_new_poins_ob(Object *ob)
 		if (cont->flag & CONT_NEW) {
 			for (a=0; a<cont->totlinks; a++) {
 				if ( cont->links[a] && cont->links[a]->mynew)
-					cont->links[a]= cont->links[a]->mynew;
+					cont->links[a] = cont->links[a]->mynew;
 			}
 		}
 		cont= cont->next;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 96e64f3..9bb2fb2 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -58,8 +58,10 @@
 
 #include "BKE_anim.h"
 #include "BKE_animsys.h"
+#include "BKE_action.h"
 #include "BKE_colortools.h"
 #include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
 #include "BKE_global.h"
 #include "BKE_group.h"
 #include "BKE_idprop.h"
@@ -115,6 +117,24 @@ void free_qtcodecdata(QuicktimeCodecData *qcd)
 	}
 }
 
+static void remove_sequencer_fcurves(Scene *sce)
+{
+	AnimData *adt = BKE_animdata_from_id(&sce->id);
+
+	if (adt && adt->action) {
+		FCurve *fcu, *nextfcu;
+		
+		for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) {
+			nextfcu = fcu->next;
+			
+			if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
+				action_groups_remove_channel(adt->action, fcu);
+				free_fcurve(fcu);
+			}
+		}
+	}
+}
+
 Scene *BKE_scene_copy(Scene *sce, int type)
 {
 	Scene *scen;
@@ -179,6 +199,10 @@ Scene *BKE_scene_copy(Scene *sce, int type)
 
 		BLI_strncpy(scen->sequencer_colorspace_settings.name, sce->sequencer_colorspace_settings.name,
 		            sizeof(scen->sequencer_colorspace_settings.name));
+
+		/* remove animation used by sequencer */
+		if (type != SCE_COPY_FULL)
+			remove_sequencer_fcurves(scen);
 	}
 
 	/* tool settings */
@@ -325,7 +349,7 @@ void BKE_scene_free(Scene *sce)
 		BKE_paint_free(&sce->toolsettings->imapaint.paint);
 
 		MEM_freeN(sce->toolsettings);
-		sce->toolsettings = NULL;	
+		sce->toolsettings = NULL;
 	}
 	
 	if (sce->theDag) {
@@ -368,8 +392,8 @@ Scene *BKE_scene_add(const char *name)
 	sce->r.ysch = 1080;
 	sce->r.xasp = 1;
 	sce->r.yasp = 1;
-	sce->r.xparts = 8;
-	sce->r.yparts = 8;
+	sce->r.tilex = 256;
+	sce->r.tiley = 256;
 	sce->r.mblur_samples = 1;
 	sce->r.filtertype = R_FILTER_MITCH;
 	sce->r.size = 50;
@@ -377,6 +401,7 @@ Scene *BKE_scene_add(const char *name)
 	sce->r.im_format.planes = R_IMF_PLANES_RGB;
 	sce->r.im_format.imtype = R_IMF_IMTYPE_PNG;
 	sce->r.im_format.quality = 90;
+	sce->r.im_format.compress = 90;
 
 	sce->r.displaymode = R_OUTPUT_AREA;
 	sce->r.framapto = 100;
@@ -436,7 +461,7 @@ Scene *BKE_scene_add(const char *name)
 	sce->toolsettings->cornertype = 1;
 	sce->toolsettings->degr = 90; 
 	sce->toolsettings->step = 9;
-	sce->toolsettings->turn = 1; 				
+	sce->toolsettings->turn = 1;
 	sce->toolsettings->extr_offs = 1; 
 	sce->toolsettings->doublimit = 0.001;
 	sce->toolsettings->segments = 32;
@@ -446,6 +471,7 @@ Scene *BKE_scene_add(const char *name)
 	sce->toolsettings->uvcalc_cubesize = 1.0f;
 	sce->toolsettings->uvcalc_mapdir = 1;
 	sce->toolsettings->uvcalc_mapalign = 1;
+	sce->toolsettings->uvcalc_margin = 0.001f;
 	sce->toolsettings->unwrapper = 1;
 	sce->toolsettings->select_thresh = 0.01f;
 	sce->toolsettings->jointrilimit = 0.8f;
@@ -957,7 +983,7 @@ float BKE_scene_frame_get_from_ctime(Scene *scene, const float frame)
 {
 	float ctime = frame;
 	ctime += scene->r.subframe;
-	ctime *= scene->r.framelen;	
+	ctime *= scene->r.framelen;
 	
 	return ctime;
 }
@@ -1018,8 +1044,10 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
 		if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
 			group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
 			
-		/* always update layer, so that animating layers works */
-		base->lay = ob->lay;
+		/* always update layer, so that animating layers works (joshua july 2010) */
+		/* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
+		 * (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
+		// base->lay = ob->lay;
 	}
 	
 	/* scene drivers... */
@@ -1041,12 +1069,13 @@ void BKE_scene_update_tagged(Main *bmain, Scene *scene)
 	/* flush recalc flags to dependencies */
 	DAG_ids_flush_tagged(bmain);
 
-	scene->physics_settings.quick_cache_step = 0;
+	/* removed calls to quick_cache, see pointcache.c */
 	
 	/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later 
 	 * when trying to find materials with drivers that need evaluating [#32017] 
 	 */
 	tag_main_idcode(bmain, ID_MA, FALSE);
+	tag_main_idcode(bmain, ID_LA, FALSE);
 
 	/* update all objects: drivers, matrices, displists, etc. flags set
 	 * by depgraph or manual, no layer check here, gets correct flushed
@@ -1064,10 +1093,6 @@ void BKE_scene_update_tagged(Main *bmain, Scene *scene)
 			BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0);
 	}
 	
-	/* quick point cache updates */
-	if (scene->physics_settings.quick_cache_step)
-		BKE_ptcache_quick_cache_all(bmain, scene);
-
 	/* notify editors and python about recalc */
 	BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST);
 	DAG_ids_check_recalc(bmain, scene, FALSE);
@@ -1116,6 +1141,12 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
 	BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
 	/*...done with recusrive funcs */
 
+	/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later 
+	 * when trying to find materials with drivers that need evaluating [#32017] 
+	 */
+	tag_main_idcode(bmain, ID_MA, FALSE);
+	tag_main_idcode(bmain, ID_LA, FALSE);
+
 	/* BKE_object_handle_update() on all objects, groups and sets */
 	scene_update_tagged_recursive(bmain, sce, sce);
 
@@ -1192,7 +1223,7 @@ int BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *s
 int get_render_subsurf_level(RenderData *r, int lvl)
 {
 	if (r->mode & R_SIMPLIFY)
-		return MIN2(r->simplify_subsurf, lvl);
+		return min_ii(r->simplify_subsurf, lvl);
 	else
 		return lvl;
 }
@@ -1208,7 +1239,7 @@ int get_render_child_particle_number(RenderData *r, int num)
 int get_render_shadow_samples(RenderData *r, int samples)
 {
 	if ((r->mode & R_SIMPLIFY) && samples > 0)
-		return MIN2(r->simplify_shadowsamples, samples);
+		return min_ii(r->simplify_shadowsamples, samples);
 	else
 		return samples;
 }
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 3351948..0b7fdaa 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -62,14 +62,14 @@ static void slice_get_byte_buffers(const SeqRenderData *context, const ImBuf *ib
 {
 	int offset = 4 * start_line * context->rectx;
 
-	*rect1 = (unsigned char*) ibuf1->rect + offset;
-	*rect_out = (unsigned char*) out->rect + offset;
+	*rect1 = (unsigned char *)ibuf1->rect + offset;
+	*rect_out = (unsigned char *)out->rect + offset;
 
 	if (ibuf2)
-		*rect2 = (unsigned char*) ibuf2->rect + offset;
+		*rect2 = (unsigned char *)ibuf2->rect + offset;
 
 	if (ibuf3)
-		*rect3 = (unsigned char*) ibuf3->rect + offset;
+		*rect3 = (unsigned char *)ibuf3->rect + offset;
 }
 
 static void slice_get_float_buffers(const SeqRenderData *context, const ImBuf *ibuf1, const ImBuf *ibuf2,
@@ -139,6 +139,9 @@ static ImBuf *prepare_effect_imbufs(SeqRenderData context, ImBuf *ibuf1, ImBuf *
 		IMB_rect_from_float(ibuf3);
 	}
 
+	if (out->rect_float)
+		IMB_colormanagement_assign_float_colorspace(out, context.scene->sequencer_colorspace_settings.name);
+
 	return out;
 }
 
@@ -600,7 +603,7 @@ static void makeGammaTables(float gamma)
 	color_step        = 1.0f / RE_GAMMA_TABLE_SIZE;
 	inv_color_step    = (float) RE_GAMMA_TABLE_SIZE; 
 
-	/* We could squeeze out the two range tables to gain some memory */	
+	/* We could squeeze out the two range tables to gain some memory */
 	for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
 		color_domain_table[i]    = i * color_step;
 		gamma_range_table[i]     = pow(color_domain_table[i], valid_gamma);
@@ -1178,7 +1181,7 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, float *r
 	fac3 = facf1;
 
 	/* formula:
-	 *		fac*(a*b) + (1-fac)*a  => fac*a*(b-1)+a
+	 * fac * (a * b) + (1 - fac) * a  =>  fac * a * (b - 1) + a
 	 */
 
 	while (y--) {
@@ -1353,7 +1356,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f
 				hyp2 = fabsf(angle * x + y + (-(yo - posy * 0.5f) - angle * (xo - posx * 0.5f))) * wipezone->pythangle;
 			}
 
-			hwidth = minf(hwidth, fabsf(b3 - b1) / 2.0f);
+			hwidth = min_ff(hwidth, fabsf(b3 - b1) / 2.0f);
 
 			if (b2 < b1 && b2 < b3) {
 				output = in_band(hwidth, hyp, 0, 1);
@@ -2373,7 +2376,7 @@ static ImBuf *do_solid_color(SeqRenderData context, Sequence *seq, float UNUSED(
 					rect[1] = col1[1];
 					rect[2] = col1[2];
 					rect[3] = 255;
-				}	
+				}
 			}
 		}
 
@@ -2609,7 +2612,7 @@ static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float *
 			*ymin = 0.0;
 			*ymax = seq->len;
 		}
-	}	
+	}
 }
 
 void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force)
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index b0dcad6..5b2e9f2 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -349,9 +349,9 @@ static void hue_correct_apply_threaded(int width, int height, unsigned char *rec
 			hsv_to_rgb(hsv[0], hsv[1], hsv[2], result, result + 1, result + 2);
 
 			if (mask_rect_float)
-					copy_v3_v3(mask, mask_rect_float + pixel_index);
+				copy_v3_v3(mask, mask_rect_float + pixel_index);
 			else if (mask_rect)
-					rgb_uchar_to_float(mask, mask_rect + pixel_index);
+				rgb_uchar_to_float(mask, mask_rect + pixel_index);
 
 			result[0] = pixel[0] * (1.0f - mask[0]) + result[0] * mask[0];
 			result[1] = pixel[1] * (1.0f - mask[1]) + result[1] * mask[1];
@@ -427,17 +427,17 @@ static void brightcontrast_apply_threaded(int width, int height, unsigned char *
 				unsigned char *pixel = rect + pixel_index;
 
 				for (c = 0; c < 3; c++) {
-					i = pixel[c];
+					i = (float) pixel[c] / 255.0f;
 					v = a * i + b;
 
 					if (mask_rect) {
 						unsigned char *m = mask_rect + pixel_index;
 						float t = (float) m[c] / 255.0f;
 
-						pixel[c] = pixel[c] * (1.0f - t) + v * t;
+						v = (float) pixel[c] * (1.0f - t) + v * t;
 					}
-					else
-						pixel[c] = v;
+
+					pixel[c] = FTOCHAR(v);
 				}
 			}
 			else if (rect_float) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 49ed7f8..acce374 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -53,6 +53,8 @@
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_animsys.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
@@ -507,8 +509,8 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase
 	 * since sound is played outside of evaluating the imbufs, */
 	for (seq = metaseq->seqbase.first; seq; seq = seq->next) {
 		if (seq->type == SEQ_TYPE_META) {
-			seq_update_sound_bounds_recursive_rec(scene, seq, maxi(start, metaseq_start(seq)),
-			                                      mini(end, metaseq_end(seq)));
+			seq_update_sound_bounds_recursive_rec(scene, seq, max_ii(start, metaseq_start(seq)),
+			                                      min_ii(end, metaseq_end(seq)));
 		}
 		else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) {
 			if (seq->scene_sound) {
@@ -674,8 +676,8 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
 
 			if (seq->anim) IMB_free_anim(seq->anim);
 
-			/* OCIO_TODO: support configurable input space for strips */
-			seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
+			seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+			                     seq->streamindex, seq->strip->colorspace_settings.name);
 
 			if (!seq->anim) {
 				return;
@@ -717,7 +719,7 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
 #ifdef WITH_AUDASPACE
 			if (!seq->sound)
 				return;
-			seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
+			seq->len = ceil((double)AUD_getInfo(seq->sound->playback_handle).length * FPS);
 			seq->len -= seq->anim_startofs;
 			seq->len -= seq->anim_endofs;
 			if (seq->len < 0) {
@@ -991,7 +993,7 @@ static float give_stripelem_index(Sequence *seq, float cfra)
 
 	if (seq->type & SEQ_TYPE_EFFECT) {
 		end = seq->enddisp;
-	} 
+	}
 
 	if (end < sta) {
 		return -1;
@@ -1172,8 +1174,8 @@ static void seq_open_anim_file(Sequence *seq)
 	                 seq->strip->dir, seq->strip->stripdata->name);
 	BLI_path_abs(name, G.main->name);
 	
-	/* OCIO_TODO: support configurable input space for strips */
-	seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
+	seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+	                     seq->streamindex, seq->strip->colorspace_settings.name);
 
 	if (seq->anim == NULL) {
 		return;
@@ -1299,7 +1301,6 @@ static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
 	}
 
 	if (BLI_exists(name)) {
-		/* OCIO_TODO: support configurable spaces for strips */
 		ImBuf *ibuf = IMB_loadiffname(name, IB_rect, NULL);
 
 		if (ibuf)
@@ -1344,7 +1345,6 @@ static void seq_proxy_build_frame(SeqRenderData context, Sequence *seq, int cfra
 
 	BLI_make_existing_file(name);
 
-	/* OCIO_TODO: support per-strip color space settings */
 	ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
 	if (ok == 0) {
 		perror(name);
@@ -1835,6 +1835,8 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
 		StripCrop c = {0};
 		StripTransform t = {0};
 		int sx, sy, dx, dy;
+		double xscale = 1.0;
+		double yscale = 1.0;
 
 		if (is_proxy_image) {
 			double f = seq_rendersize_to_scale_factor(context.preview_render_size);
@@ -1851,6 +1853,17 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
 			t = *seq->strip->transform;
 		}
 
+		xscale = context.scene->r.xsch ? ((double)context.rectx / (double)context.scene->r.xsch) : 1.0;
+		yscale = context.scene->r.ysch ? ((double)context.recty / (double)context.scene->r.ysch) : 1.0;
+
+		xscale /= (double)context.rectx / (double)ibuf->x;
+		yscale /= (double)context.recty / (double)ibuf->y;
+
+		c.left *= xscale; c.right *= xscale;
+		c.top *= yscale; c.bottom *= yscale;
+
+		t.xofs *= xscale; t.yofs *= yscale;
+
 		sx = ibuf->x - c.left - c.right;
 		sy = ibuf->y - c.top - c.bottom;
 		dx = sx;
@@ -1882,7 +1895,7 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
 
 			ibuf = i;
 		}
-	} 
+	}
 
 	if (seq->flag & SEQ_FLIPX) {
 		IMB_flipx(ibuf);
@@ -1978,7 +1991,7 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr, I
 
 		if (nr == 0) {
 			BKE_sequencer_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
-		} 
+		}
 
 		if (nr == seq->len - 1) {
 			BKE_sequencer_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
@@ -2337,11 +2350,16 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
 	 * -jahka
 	 */
 
-	int rendering = G.is_rendering;
-	int doseq;
-	int doseq_gl = G.is_rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
-	int have_seq = FALSE;
+	const short is_rendering = G.is_rendering;
+	const short is_background = G.background;
+	const int do_seq_gl = G.is_rendering ?
+	            0 /* (context.scene->r.seq_flag & R_SEQ_GL_REND) */ :
+	            (context.scene->r.seq_flag & R_SEQ_GL_PREV);
+	int do_seq;
+	// int have_seq = FALSE;  /* UNUSED */
+	int have_comp = FALSE;
 	Scene *scene;
+	int is_thread_main = BLI_thread_is_main();
 
 	/* don't refer to seq->scene above this point!, it can be NULL */
 	if (seq->scene == NULL) {
@@ -2351,26 +2369,28 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
 	scene = seq->scene;
 	frame = scene->r.sfra + nr + seq->anim_startofs;
 
-	have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
+	// have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;  /* UNUSED */
+	have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree;
 
 	oldcfra = scene->r.cfra;
 	scene->r.cfra = frame;
 
-	if (seq->scene_camera)	
+	if (seq->scene_camera) {
 		camera = seq->scene_camera;
-	else {	
+	}
+	else {
 		BKE_scene_camera_switch_update(scene);
 		camera = scene->camera;
 	}
 
-	if (have_seq == FALSE && camera == NULL) {
+	if (have_comp == FALSE && camera == NULL) {
 		scene->r.cfra = oldcfra;
 		return NULL;
 	}
 
 	/* prevent eternal loop */
-	doseq = context.scene->r.scemode & R_DOSEQ;
-	context.scene->r.scemode &= ~R_DOSEQ;
+	do_seq = context.scene->r.scemode & R_DOSEQ;
+	scene->r.scemode &= ~R_DOSEQ;
 	
 #ifdef DURIAN_CAMERA_SWITCH
 	/* stooping to new low's in hackyness :( */
@@ -2379,8 +2399,8 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
 #else
 	(void)oldmarkers;
 #endif
-	
-	if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq == 0) && camera) {
+
+	if ((sequencer_view3d_cb && do_seq_gl && camera) && is_thread_main) {
 		char err_out[256] = "unknown";
 		/* for old scened this can be uninitialized,
 		 * should probably be added to do_versions at some point if the functionality stays */
@@ -2399,15 +2419,23 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
 		Render *re = RE_GetRender(scene->id.name);
 		RenderResult rres;
 
-		/* XXX: this if can be removed when sequence preview rendering uses the job system */
-		if (rendering || context.scene != scene) {
+		/* XXX: this if can be removed when sequence preview rendering uses the job system
+		 *
+		 * disable rendered preview for sequencer while rendering -- it's very much possible
+		 * that preview render will went into conflict with final render
+		 *
+		 * When rendering from command line renderer is called from main thread, in this
+		 * case it's always safe to render scene here
+		 */
+		if (!is_thread_main || is_rendering == FALSE || is_background) {
 			if (re == NULL)
 				re = RE_NewRender(scene->id.name);
 			
+			BKE_scene_update_for_newframe(context.bmain, scene, scene->lay);
 			RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
 
 			/* restore previous state after it was toggled on & off by RE_BlenderFrame */
-			G.is_rendering = rendering;
+			G.is_rendering = is_rendering;
 		}
 		
 		RE_AcquireResultImage(re, &rres);
@@ -2434,7 +2462,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
 	}
 	
 	/* restore */
-	context.scene->r.scemode |= doseq;
+	scene->r.scemode |= do_seq;
 	
 	scene->r.cfra = oldcfra;
 
@@ -2521,8 +2549,7 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
 				BLI_path_abs(name, G.main->name);
 			}
 
-			/* OCIO_TODO: support configurable space for image strips */
-			if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect, NULL))) {
+			if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect, seq->strip->colorspace_settings.name))) {
 				/* we don't need both (speed reasons)! */
 				if (ibuf->rect_float && ibuf->rect)
 					imb_freerectImBuf(ibuf);
@@ -2825,7 +2852,7 @@ ImBuf *BKE_sequencer_give_ibuf(SeqRenderData context, float cfra, int chanshown)
 
 	count = BLI_countlist(&ed->metastack);
 	if ((chanshown < 0) && (count > 0)) {
-		count = MAX2(count + chanshown, 0);
+		count = max_ii(count + chanshown, 0);
 		seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
 	}
 	else {
@@ -3194,7 +3221,7 @@ int BKE_sequence_tx_get_final_left(Sequence *seq, int metaclip)
 {
 	if (metaclip && seq->tmp) {
 		/* return the range clipped by the parents range */
-		return maxi(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE));
+		return max_ii(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE));
 	}
 	else {
 		return (seq->start - seq->startstill) + seq->startofs;
@@ -3205,7 +3232,7 @@ int BKE_sequence_tx_get_final_right(Sequence *seq, int metaclip)
 {
 	if (metaclip && seq->tmp) {
 		/* return the range clipped by the parents range */
-		return mini(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE));
+		return min_ii(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE));
 	}
 	else {
 		return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
@@ -3457,7 +3484,7 @@ int BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_sc
 
 		for (seq = seqbasep->first; seq; seq = seq->next) {
 			if (seq->machine == orig_machine)
-				new_frame = MAX2(new_frame, seq->enddisp);
+				new_frame = max_ii(new_frame, seq->enddisp);
 		}
 
 		test->machine = orig_machine;
@@ -3482,10 +3509,10 @@ static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir)
 			for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) {
 				if (!seq_other->tmp && seq_overlap(seq, seq_other)) {
 					if (dir == 'L') {
-						offset = MIN2(offset, seq_other->startdisp - seq->enddisp);
+						offset = min_ii(offset, seq_other->startdisp - seq->enddisp);
 					}
 					else {
-						offset = MAX2(offset, seq_other->enddisp - seq->startdisp);
+						offset = max_ii(offset, seq_other->enddisp - seq->startdisp);
 					}
 				}
 			}
@@ -3670,26 +3697,26 @@ int BKE_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
 	char name[sizeof(seq_a->name)];
 
 	if (seq_a->len != seq_b->len) {
-		*error_str = "Strips must be the same length";
+		*error_str = N_("Strips must be the same length");
 		return 0;
 	}
 
-	/* type checking, could be more advanced but disalow sound vs non-sound copy */
+	/* type checking, could be more advanced but disallow sound vs non-sound copy */
 	if (seq_a->type != seq_b->type) {
 		if (seq_a->type == SEQ_TYPE_SOUND_RAM || seq_b->type == SEQ_TYPE_SOUND_RAM) {
-			*error_str = "Strips were not compatible";
+			*error_str = N_("Strips were not compatible");
 			return 0;
 		}
 
 		/* disallow effects to swap with non-effects strips */
 		if ((seq_a->type & SEQ_TYPE_EFFECT) != (seq_b->type & SEQ_TYPE_EFFECT)) {
-			*error_str = "Strips were not compatible";
+			*error_str = N_("Strips were not compatible");
 			return 0;
 		}
 
 		if ((seq_a->type & SEQ_TYPE_EFFECT) && (seq_b->type & SEQ_TYPE_EFFECT)) {
 			if (BKE_sequence_effect_get_num_inputs(seq_a->type) != BKE_sequence_effect_get_num_inputs(seq_b->type)) {
-				*error_str = "Strips must have the same number of inputs";
+				*error_str = N_("Strips must have the same number of inputs");
 				return 0;
 			}
 		}
@@ -3932,6 +3959,25 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine)
 	return seq;
 }
 
+void BKE_sequence_init_colorspace(Sequence *seq)
+{
+	if (seq->strip && seq->strip->stripdata) {
+		char name[FILE_MAX];
+		ImBuf *ibuf;
+
+		BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name);
+		BLI_path_abs(name, G.main->name);
+
+		/* initialize input color space */
+		if (seq->type == SEQ_TYPE_IMAGE) {
+			ibuf = IMB_loadiffname(name, IB_rect, seq->strip->colorspace_settings.name);
+
+			if (ibuf)
+				IMB_freeImBuf(ibuf);
+		}
+	}
+}
+
 /* NOTE: this function doesn't fill in image names */
 Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
 {
@@ -4001,7 +4047,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
 
 	/* basic defaults */
 	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
-	seq->len = ceil(info.length * FPS);
+	seq->len = (int)ceil((double)info.length * FPS);
 	strip->us = 1;
 
 	/* we only need 1 element to store the filename */
@@ -4038,14 +4084,14 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
 	Sequence *seq;  /* generic strip vars */
 	Strip *strip;
 	StripElem *se;
+	char colorspace[64] = "\0"; /* MAX_COLORSPACE_NAME */
 
 	struct anim *an;
 
 	BLI_strncpy(path, seq_load->path, sizeof(path));
 	BLI_path_abs(path, G.main->name);
 
-	/* OCIO_TODO: support configurable input space for strips */
-	an = openanim(path, IB_rect, 0, NULL);
+	an = openanim(path, IB_rect, 0, colorspace);
 
 	if (an == NULL)
 		return NULL;
@@ -4064,6 +4110,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
 	seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
 	strip->us = 1;
 
+	BLI_strncpy(seq->strip->colorspace_settings.name, colorspace, sizeof(seq->strip->colorspace_settings.name));
+
 	/* we only need 1 element for MOVIE strips */
 	strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
 
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 9a8bcaa..72db34d 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -56,35 +56,18 @@
 #include "BKE_mesh.h"
 #include "BKE_tessmesh.h"
 
-/* Util macros */
-#define OUT_OF_MEMORY() ((void)printf("Shrinkwrap: Out of memory\n"))
-
-/* Benchmark macros */
-#if !defined(_WIN32) && 0
-
-#include <sys/time.h>
-
-#define BENCH(a)	\
-	do {			\
-		double _t1, _t2;				\
-		struct timeval _tstart, _tend;	\
-		clock_t _clock_init = clock();	\
-		gettimeofday ( &_tstart, NULL);	\
-		(a);							\
-		gettimeofday ( &_tend, NULL);	\
-		_t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 );	\
-		_t2 = ( double )   _tend.tv_sec + ( double )   _tend.tv_usec/ ( 1000*1000 );	\
-		printf("%s: %fs (real) %fs (cpu)\n", #a, _t2-_t1, (float)(clock()-_clock_init)/CLOCKS_PER_SEC);\
-	} while (0)
-
+/* for timing... */
+#if 0
+#  include "PIL_time.h"
 #else
-
-#define BENCH(a)    (a)
-
+#  define TIMEIT_BENCH(expr, id) (expr)
 #endif
 
+/* Util macros */
+#define OUT_OF_MEMORY() ((void)printf("Shrinkwrap: Out of memory\n"))
+
 /* get derived mesh */
-//TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not?
+/* TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not? */
 DerivedMesh *object_get_derived_final(Object *ob)
 {
 	Mesh *me = ob->data;
@@ -143,13 +126,13 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 	BVHTreeNearest nearest  = NULL_BVHTreeNearest;
 
 
-	BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6));
+	TIMEIT_BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6), bvhtree_verts);
 	if (treeData.tree == NULL) {
 		OUT_OF_MEMORY();
 		return;
 	}
 
-	//Setup nearest
+	/* Setup nearest */
 	nearest.index = -1;
 	nearest.dist = FLT_MAX;
 #ifndef __APPLE__
@@ -159,10 +142,12 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 		float *co = calc->vertexCos[i];
 		float tmp_co[3];
 		float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
-		if (weight == 0.0f) continue;
+		if (weight == 0.0f) {
+			continue;
+		}
 
 
-		//Convert the vertex to tree coordinates
+		/* Convert the vertex to tree coordinates */
 		if (calc->vert) {
 			copy_v3_v3(tmp_co, calc->vert[i].co);
 		}
@@ -171,11 +156,11 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 		}
 		space_transform_apply(&calc->local2target, tmp_co);
 
-		//Use local proximity heuristics (to reduce the nearest search)
-		//
-		//If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
-		//so we can initiate the "nearest.dist" with the expected value to that last hit.
-		//This will lead in prunning of the search tree.
+		/* Use local proximity heuristics (to reduce the nearest search)
+		 *
+		 * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
+		 * so we can initiate the "nearest.dist" with the expected value to that last hit.
+		 * This will lead in prunning of the search tree. */
 		if (nearest.index != -1)
 			nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
 		else
@@ -184,23 +169,27 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 		BLI_bvhtree_find_nearest(treeData.tree, tmp_co, &nearest, treeData.nearest_callback, &treeData);
 
 
-		//Found the nearest vertex
+		/* Found the nearest vertex */
 		if (nearest.index != -1) {
-			//Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position
-			float dist = sasqrt(nearest.dist);
-			if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist) / dist;
+			/* Adjusting the vertex weight,
+			 * so that after interpolating it keeps a certain distance from the nearest position */
+			if (nearest.dist > FLT_EPSILON) {
+				const float dist = sqrtf(nearest.dist);
+				weight *= (dist - calc->keepDist) / dist;
+			}
 
-			//Convert the coordinates back to mesh coordinates
+			/* Convert the coordinates back to mesh coordinates */
 			copy_v3_v3(tmp_co, nearest.co);
 			space_transform_invert(&calc->local2target, tmp_co);
 
-			interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
+			interp_v3_v3v3(co, co, tmp_co, weight);  /* linear interpolation */
 		}
 	}
 
 	free_bvhtree_from_mesh(&treeData);
 }
 
+
 /*
  * This function raycast a single vertex and updates the hit if the "hit" is considered valid.
  * Returns TRUE if "hit" was updated.
@@ -209,16 +198,24 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
  *	MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored)
  *	MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored)
  */
-int normal_projection_project_vertex(char options, const float vert[3], const float dir[3], const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
+int normal_projection_project_vertex(char options, const float vert[3], const float dir[3],
+                                     const SpaceTransform *transf,
+                                     BVHTree *tree, BVHTreeRayHit *hit,
+                                     BVHTree_RayCastCallback callback, void *userdata)
 {
+	/* don't use this because this dist value could be incompatible
+	 * this value used by the callback for comparing prev/new dist values.
+	 * also, at the moment there is no need to have a corrected 'dist' value */
+// #define USE_DIST_CORRECT
+
 	float tmp_co[3], tmp_no[3];
 	const float *co, *no;
 	BVHTreeRayHit hit_tmp;
 
-	//Copy from hit (we need to convert hit rays from one space coordinates to the other
+	/* Copy from hit (we need to convert hit rays from one space coordinates to the other */
 	memcpy(&hit_tmp, hit, sizeof(hit_tmp));
 
-	//Apply space transform (TODO readjust dist)
+	/* Apply space transform (TODO readjust dist) */
 	if (transf) {
 		copy_v3_v3(tmp_co, vert);
 		space_transform_apply(transf, tmp_co);
@@ -228,7 +225,9 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
 		space_transform_apply_normal(transf, tmp_no);
 		no = tmp_no;
 
+#ifdef USE_DIST_CORRECT
 		hit_tmp.dist *= mat4_to_scale(((SpaceTransform *)transf)->local2target);
+#endif
 	}
 	else {
 		co = vert;
@@ -249,7 +248,7 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
 			/* apply backface */
 			const float dot = dot_v3v3(dir, hit_tmp.no);
 			if (((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
-			    ((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f))
+			    ((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)  && dot >= 0.0f))
 			{
 				return FALSE; /* Ignore hit */
 			}
@@ -258,9 +257,13 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
 		if (transf) {
 			/* Inverting space transform (TODO make coeherent with the initial dist readjust) */
 			space_transform_invert(transf, hit_tmp.co);
-			hit_tmp.dist = len_v3v3((float *)vert, hit_tmp.co);
+#ifdef USE_DIST_CORRECT
+			hit_tmp.dist = len_v3v3(vert, hit_tmp.co);
+#endif
 		}
 
+		BLI_assert(hit_tmp.dist <= hit->dist);
+
 		memcpy(hit, &hit_tmp, sizeof(hit_tmp));
 		return TRUE;
 	}
@@ -272,41 +275,47 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 {
 	int i;
 
-	//Options about projection direction
+	/* Options about projection direction */
 	const char use_normal   = calc->smd->shrinkOpts;
+	const float proj_limit_squared = calc->smd->projLimit * calc->smd->projLimit;
 	float proj_axis[3]      = {0.0f, 0.0f, 0.0f};
 
-	//Raycast and tree stuff
+	/* Raycast and tree stuff */
+
+	/** \note 'hit.dist' is kept in the targets space, this is only used
+	 * for finding the best hit, to get the real dist,
+	 * measure the len_v3v3() from the input coord to hit.co */
 	BVHTreeRayHit hit;
 	BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
 
-	//auxiliary target
+	/* auxiliary target */
 	DerivedMesh *auxMesh    = NULL;
 	BVHTreeFromMesh auxData = NULL_BVHTreeFromMesh;
 	SpaceTransform local2aux;
 
-	//If the user doesn't allows to project in any direction of projection axis
-	//then theres nothing todo.
+	/* If the user doesn't allows to project in any direction of projection axis
+	 * then theres nothing todo. */
 	if ((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0)
 		return;
 
 
-	//Prepare data to retrieve the direction in which we should project each vertex
+	/* Prepare data to retrieve the direction in which we should project each vertex */
 	if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
 		if (calc->vert == NULL) return;
 	}
 	else {
-		//The code supports any axis that is a combination of X,Y,Z
-		//although currently UI only allows to set the 3 different axis
+		/* The code supports any axis that is a combination of X,Y,Z
+		 * although currently UI only allows to set the 3 different axis */
 		if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) proj_axis[0] = 1.0f;
 		if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) proj_axis[1] = 1.0f;
 		if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) proj_axis[2] = 1.0f;
 
 		normalize_v3(proj_axis);
 
-		//Invalid projection direction
-		if (dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
-			return; 
+		/* Invalid projection direction */
+		if (len_squared_v3(proj_axis) < FLT_EPSILON) {
+			return;
+		}
 	}
 
 	if (calc->smd->auxTarget) {
@@ -316,7 +325,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 		SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget);
 	}
 
-	//After sucessufuly build the trees, start projection vertexs
+	/* After sucessufuly build the trees, start projection vertexs */
 	if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) &&
 	    (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
 	{
@@ -327,9 +336,11 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 		for (i = 0; i < calc->numVerts; ++i) {
 			float *co = calc->vertexCos[i];
 			float tmp_co[3], tmp_no[3];
-			float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
+			const float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
 
-			if (weight == 0.0f) continue;
+			if (weight == 0.0f) {
+				continue;
+			}
 
 			if (calc->vert) {
 				/* calc->vert contains verts from derivedMesh  */
@@ -351,28 +362,45 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 
 
 			hit.index = -1;
-			hit.dist = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that
+			hit.dist = 10000.0f; /* TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that */
 
-			//Project over positive direction of axis
+			/* Project over positive direction of axis */
 			if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) {
 
-				if (auxData.tree)
-					normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
+				if (auxData.tree) {
+					normal_projection_project_vertex(0, tmp_co, tmp_no,
+					                                 &local2aux, auxData.tree, &hit,
+					                                 auxData.raycast_callback, &auxData);
+				}
 
-				normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
+				normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no,
+				                                 &calc->local2target, treeData.tree, &hit,
+				                                 treeData.raycast_callback, &treeData);
 			}
 
-			//Project over negative direction of axis
-			if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1) {
+			/* Project over negative direction of axis */
+			if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR) {
 				float inv_no[3];
 				negate_v3_v3(inv_no, tmp_no);
 
-				if (auxData.tree)
-					normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
+				if (auxData.tree) {
+					normal_projection_project_vertex(0, tmp_co, inv_no,
+					                                 &local2aux, auxData.tree, &hit,
+					                                 auxData.raycast_callback, &auxData);
+				}
 
-				normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
+				normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no,
+				                                 &calc->local2target, treeData.tree, &hit,
+				                                 treeData.raycast_callback, &treeData);
 			}
 
+			/* don't set the initial dist (which is more efficient),
+			 * because its calculated in the targets space, we want the dist in our own space */
+			if (proj_limit_squared != 0.0f) {
+				if (len_squared_v3v3(hit.co, co) > proj_limit_squared) {
+					hit.index = -1;
+				}
+			}
 
 			if (hit.index != -1) {
 				madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist);
@@ -381,7 +409,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 		}
 	}
 
-	//free data structures
+	/* free data structures */
 	free_bvhtree_from_mesh(&treeData);
 	free_bvhtree_from_mesh(&auxData);
 }
@@ -399,19 +427,19 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 	BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
 	BVHTreeNearest nearest  = NULL_BVHTreeNearest;
 
-	//Create a bvh-tree of the given target
-	BENCH(bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 2, 6));
+	/* Create a bvh-tree of the given target */
+	TIMEIT_BENCH(bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 2, 6), bvhtree_faces);
 	if (treeData.tree == NULL) {
 		OUT_OF_MEMORY();
 		return;
 	}
 
-	//Setup nearest
+	/* Setup nearest */
 	nearest.index = -1;
 	nearest.dist = FLT_MAX;
 
 
-	//Find the nearest vertex
+	/* Find the nearest vertex */
 #ifndef __APPLE__
 #pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(calc,treeData) schedule(static)
 #endif
@@ -421,7 +449,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 		float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
 		if (weight == 0.0f) continue;
 
-		//Convert the vertex to tree coordinates
+		/* Convert the vertex to tree coordinates */
 		if (calc->vert) {
 			copy_v3_v3(tmp_co, calc->vert[i].co);
 		}
@@ -430,11 +458,11 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 		}
 		space_transform_apply(&calc->local2target, tmp_co);
 
-		//Use local proximity heuristics (to reduce the nearest search)
-		//
-		//If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
-		//so we can initiate the "nearest.dist" with the expected value to that last hit.
-		//This will lead in prunning of the search tree.
+		/* Use local proximity heuristics (to reduce the nearest search)
+		 *
+		 * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
+		 * so we can initiate the "nearest.dist" with the expected value to that last hit.
+		 * This will lead in prunning of the search tree. */
 		if (nearest.index != -1)
 			nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
 		else
@@ -442,24 +470,28 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 
 		BLI_bvhtree_find_nearest(treeData.tree, tmp_co, &nearest, treeData.nearest_callback, &treeData);
 
-		//Found the nearest vertex
+		/* Found the nearest vertex */
 		if (nearest.index != -1) {
 			if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) {
-				//Make the vertex stay on the front side of the face
+				/* Make the vertex stay on the front side of the face */
 				madd_v3_v3v3fl(tmp_co, nearest.co, nearest.no, calc->keepDist);
 			}
 			else {
-				//Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position
+				/* Adjusting the vertex weight,
+				 * so that after interpolating it keeps a certain distance from the nearest position */
 				float dist = sasqrt(nearest.dist);
-				if (dist > FLT_EPSILON)
-					interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist);  //linear interpolation
-				else
+				if (dist > FLT_EPSILON) {
+					/* linear interpolation */
+					interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist);
+				}
+				else {
 					copy_v3_v3(tmp_co, nearest.co);
+				}
 			}
 
-			//Convert the coordinates back to mesh coordinates
+			/* Convert the coordinates back to mesh coordinates */
 			space_transform_invert(&calc->local2target, tmp_co);
-			interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
+			interp_v3_v3v3(co, co, tmp_co, weight);  /* linear interpolation */
 		}
 	}
 
@@ -467,24 +499,25 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 }
 
 /* Main shrinkwrap function */
-void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
+void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedMesh *dm,
+                               float (*vertexCos)[3], int numVerts)
 {
 
 	DerivedMesh *ss_mesh    = NULL;
 	ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
 
-	//remove loop dependencies on derived meshs (TODO should this be done elsewhere?)
+	/* remove loop dependencies on derived meshs (TODO should this be done elsewhere?) */
 	if (smd->target == ob) smd->target = NULL;
 	if (smd->auxTarget == ob) smd->auxTarget = NULL;
 
 
-	//Configure Shrinkwrap calc data
+	/* Configure Shrinkwrap calc data */
 	calc.smd = smd;
 	calc.ob = ob;
 	calc.numVerts = numVerts;
 	calc.vertexCos = vertexCos;
 
-	//DeformVertex
+	/* DeformVertex */
 	calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name);
 	if (dm) {
 		calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
@@ -497,12 +530,12 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 	if (smd->target) {
 		calc.target = object_get_derived_final(smd->target);
 
-		//TODO there might be several "bugs" on non-uniform scales matrixs
-		//because it will no longer be nearest surface, not sphere projection
-		//because space has been deformed
+		/* TODO there might be several "bugs" on non-uniform scales matrixs
+		 * because it will no longer be nearest surface, not sphere projection
+		 * because space has been deformed */
 		SPACE_TRANSFORM_SETUP(&calc.local2target, ob, smd->target);
 
-		//TODO: smd->keepDist is in global units.. must change to local
+		/* TODO: smd->keepDist is in global units.. must change to local */
 		calc.keepDist = smd->keepDist;
 	}
 
@@ -511,15 +544,15 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 	calc.vgroup = defgroup_name_index(calc.ob, smd->vgroup_name);
 
 	if (dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) {
-		//Setup arrays to get vertexs positions, normals and deform weights
+		/* Setup arrays to get vertexs positions, normals and deform weights */
 		calc.vert   = dm->getVertDataArray(dm, CD_MVERT);
 		calc.dvert  = dm->getVertDataArray(dm, CD_MDEFORMVERT);
 
-		//Using vertexs positions/normals as if a subsurface was applied 
+		/* Using vertexs positions/normals as if a subsurface was applied */
 		if (smd->subsurfLevels) {
 			SubsurfModifierData ssmd = {{NULL}};
-			ssmd.subdivType = ME_CC_SUBSURF;        //catmull clark
-			ssmd.levels     = smd->subsurfLevels;   //levels
+			ssmd.subdivType = ME_CC_SUBSURF;        /* catmull clark */
+			ssmd.levels     = smd->subsurfLevels;   /* levels */
 
 			ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, NULL, (ob->mode & OB_MODE_EDIT) ? SUBSURF_IN_EDIT_MODE : 0);
 
@@ -532,31 +565,30 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 				}
 			}
 
-			//Just to make sure we are not leaving any memory behind
+			/* Just to make sure we are not leaving any memory behind */
 			assert(ssmd.emCache == NULL);
 			assert(ssmd.mCache == NULL);
 		}
 	}
 
-	//Projecting target defined - lets work!
+	/* Projecting target defined - lets work! */
 	if (calc.target) {
 		switch (smd->shrinkType) {
 			case MOD_SHRINKWRAP_NEAREST_SURFACE:
-				BENCH(shrinkwrap_calc_nearest_surface_point(&calc));
+				TIMEIT_BENCH(shrinkwrap_calc_nearest_surface_point(&calc), deform_surface);
 				break;
 
 			case MOD_SHRINKWRAP_PROJECT:
-				BENCH(shrinkwrap_calc_normal_projection(&calc));
+				TIMEIT_BENCH(shrinkwrap_calc_normal_projection(&calc), deform_project);
 				break;
 
 			case MOD_SHRINKWRAP_NEAREST_VERTEX:
-				BENCH(shrinkwrap_calc_nearest_vertex(&calc));
+				TIMEIT_BENCH(shrinkwrap_calc_nearest_vertex(&calc), deform_vertex);
 				break;
 		}
 	}
 
-	//free memory
+	/* free memory */
 	if (ss_mesh)
 		ss_mesh->release(ss_mesh);
 }
-
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 5e67e09..53dfbdc 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -51,18 +51,7 @@
 #include "BLI_kdtree.h"
 #include "BLI_kdopbvh.h"
 #include "BLI_utildefines.h"
-
-#include "BKE_bvhutils.h"
-#include "BKE_cdderivedmesh.h"
-#include "BKE_collision.h"
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_smoke.h"
-
+#include "BLI_voxel.h"
 
 #include "DNA_customdata_types.h"
 #include "DNA_group_types.h"
@@ -75,8 +64,20 @@
 #include "DNA_scene_types.h"
 #include "DNA_smoke_types.h"
 
+#include "BKE_bvhutils.h"
+#include "BKE_cdderivedmesh.h"
+#include "BKE_collision.h"
+#include "BKE_customdata.h"
+#include "BKE_deform.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_effect.h"
+#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
 #include "BKE_smoke.h"
 
+#include "RE_shader_ext.h"
+
 /* UNUSED so far, may be enabled later */
 /* #define USE_SMOKE_COLLISION_DM */
 
@@ -94,38 +95,38 @@ static LARGE_INTEGER liFrequency;
 static LARGE_INTEGER liStartTime;
 static LARGE_INTEGER liCurrentTime;
 
-static void tstart ( void )
+static void tstart(void)
 {
-	QueryPerformanceFrequency ( &liFrequency );
-	QueryPerformanceCounter ( &liStartTime );
+	QueryPerformanceFrequency(&liFrequency);
+	QueryPerformanceCounter(&liStartTime);
 }
-static void tend ( void )
+static void tend(void)
 {
-	QueryPerformanceCounter ( &liCurrentTime );
+	QueryPerformanceCounter(&liCurrentTime);
 }
-static double UNUSED_FUNCTION(tval)( void )
+static double tval(void)
 {
-	return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart ));
+	return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart) * (double)1000.0 / (double)liFrequency.QuadPart));
 }
 #else
 #include <sys/time.h>
 static struct timeval _tstart, _tend;
 static struct timezone tz;
-static void tstart ( void )
+static void tstart(void)
 {
-	gettimeofday ( &_tstart, &tz );
+	gettimeofday(&_tstart, &tz);
 }
-static void tend ( void )
+static void tend(void)
 {
-	gettimeofday ( &_tend,&tz );
+	gettimeofday(&_tend, &tz);
 }
 
-static double UNUSED_FUNCTION(tval)( void )
+static double UNUSED_FUNCTION(tval) (void)
 {
 	double t1, t2;
-	t1 = ( double ) _tstart.tv_sec*1000 + ( double ) _tstart.tv_usec/ ( 1000 );
-	t2 = ( double ) _tend.tv_sec*1000 + ( double ) _tend.tv_usec/ ( 1000 );
-	return t2-t1;
+	t1 = ( double ) _tstart.tv_sec * 1000 + ( double ) _tstart.tv_usec / (1000);
+	t2 = ( double ) _tend.tv_sec * 1000 + ( double ) _tend.tv_usec / (1000);
+	return t2 - t1;
 }
 #endif
 
@@ -134,608 +135,238 @@ struct Scene;
 struct DerivedMesh;
 struct SmokeModifierData;
 
-#define TRI_UVOFFSET (1./4.)
-
 // timestep default value for nice appearance 0.1f
 #define DT_DEFAULT 0.1f
 
-/* forward declerations */
-static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
-static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct);
-static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs);
+#define ADD_IF_LOWER_POS(a, b) (MIN2((a) + (b), MAX2((a), (b))))
+#define ADD_IF_LOWER_NEG(a, b) (MAX2((a) + (b), MIN2((a), (b))))
+#define ADD_IF_LOWER(a, b) (((b) > 0) ? ADD_IF_LOWER_POS((a), (b)) : ADD_IF_LOWER_NEG((a), (b)))
 
 #else /* WITH_SMOKE */
 
 /* Stubs to use when smoke is disabled */
-struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; }
-// struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; }
+struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype), int UNUSED(use_fire), int UNUSED(use_colors)) { return NULL; }
+//struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(dx), float *UNUSED(dtdef), int UNUSED(use_heat), int UNUSED(use_fire), int UNUSED(use_colors)) { return NULL; }
 void smoke_free(struct FLUID_3D *UNUSED(fluid)) {}
 float *smoke_get_density(struct FLUID_3D *UNUSED(fluid)) { return NULL; }
 void smoke_turbulence_free(struct WTURBULENCE *UNUSED(wt)) {}
 void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(strength)) {}
-void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {}
-long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; }
-void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {}
+void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity),
+                          int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color),
+                          float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {}
+struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; }
+float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
+void flame_get_spectrum(unsigned char *UNUSED(spec), int UNUSED(width), float UNUSED(t1), float UNUSED(t2)) {}
 
 #endif /* WITH_SMOKE */
 
 #ifdef WITH_SMOKE
 
-static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
+void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
 {
-	if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
-	{
-		size_t i;
-		float min[3] = {FLT_MAX, FLT_MAX, FLT_MAX}, max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
-		float size[3];
-		MVert *verts = dm->getVertArray(dm);
-		float scale = 0.0;
-		int res;		
-
-		res = smd->domain->maxres;
-
-		// get BB of domain
-		for(i = 0; i < dm->getNumVerts(dm); i++)
-		{
-			float tmp[3];
-
-			copy_v3_v3(tmp, verts[i].co);
-			mul_m4_v3(ob->obmat, tmp);
-
-			// min BB
-			min[0] = MIN2(min[0], tmp[0]);
-			min[1] = MIN2(min[1], tmp[1]);
-			min[2] = MIN2(min[2], tmp[2]);
-
-			// max BB
-			max[0] = MAX2(max[0], tmp[0]);
-			max[1] = MAX2(max[1], tmp[1]);
-			max[2] = MAX2(max[2], tmp[2]);
-		}
-
-		copy_v3_v3(smd->domain->p0, min);
-		copy_v3_v3(smd->domain->p1, max);
-
-		// calc other res with max_res provided
-		sub_v3_v3v3(size, max, min);
-
-		// prevent crash when initializing a plane as domain
-		if((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
-			return 0;
-
-		if(size[0] > size[1])
-		{
-			if(size[0] > size[2])
-			{
-				scale = res / size[0];
-				smd->domain->scale = size[0];
-				smd->domain->dx = 1.0f / res; 
-				smd->domain->res[0] = res;
-				smd->domain->res[1] = (int)(size[1] * scale + 0.5);
-				smd->domain->res[2] = (int)(size[2] * scale + 0.5);
-			}
-			else {
-				scale = res / size[2];
-				smd->domain->scale = size[2];
-				smd->domain->dx = 1.0f / res;
-				smd->domain->res[2] = res;
-				smd->domain->res[0] = (int)(size[0] * scale + 0.5);
-				smd->domain->res[1] = (int)(size[1] * scale + 0.5);
-			}
-		}
-		else {
-			if(size[1] > size[2])
-			{
-				scale = res / size[1];
-				smd->domain->scale = size[1];
-				smd->domain->dx = 1.0f / res; 
-				smd->domain->res[1] = res;
-				smd->domain->res[0] = (int)(size[0] * scale + 0.5);
-				smd->domain->res[2] = (int)(size[2] * scale + 0.5);
-			}
-			else {
-				scale = res / size[2];
-				smd->domain->scale = size[2];
-				smd->domain->dx = 1.0f / res;
-				smd->domain->res[2] = res;
-				smd->domain->res[0] = (int)(size[0] * scale + 0.5);
-				smd->domain->res[1] = (int)(size[1] * scale + 0.5);
-			}
-		}
-
-		// TODO: put in failsafe if res<=0 - dg
-
-		// dt max is 0.1
-		smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, DT_DEFAULT);
-		smd->time = scene->r.cfra;
-
-		if(smd->domain->flags & MOD_SMOKE_HIGHRES)
-		{
-			smd->domain->wt = smoke_turbulence_init(smd->domain->res, smd->domain->amplify + 1, smd->domain->noise);
-			smd->domain->res_wt[0] = smd->domain->res[0] * (smd->domain->amplify + 1);
-			smd->domain->res_wt[1] = smd->domain->res[1] * (smd->domain->amplify + 1);			
-			smd->domain->res_wt[2] = smd->domain->res[2] * (smd->domain->amplify + 1);			
-			smd->domain->dx_wt = smd->domain->dx / (smd->domain->amplify + 1);		
-		}
-
-		if(!smd->domain->shadow)
-			smd->domain->shadow = MEM_callocN(sizeof(float) * smd->domain->res[0] * smd->domain->res[1] * smd->domain->res[2], "SmokeDomainShadow");
-
-		smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta), &(smd->domain->time_scale), &(smd->domain->vorticity), &(smd->domain->border_collisions));
-
-		if(smd->domain->wt)	
-		{
-			smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
-		}
-		return 1;
-	}
-	else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
-	{
-		// handle flow object here
-		// XXX TODO
-
-		smd->time = scene->r.cfra;
-
-		return 1;
-	}
-	else if((smd->type & MOD_SMOKE_TYPE_COLL))
-	{
-		// todo: delete this when loading colls work -dg
-
-		if(!smd->coll)
-		{
-			smokeModifier_createType(smd);
-		}
-
-		if(!smd->coll->points)
-		{
-			// init collision points
-			SmokeCollSettings *scs = smd->coll;
-
-			smd->time = scene->r.cfra;
-
-			// copy obmat
-			copy_m4_m4(scs->mat, ob->obmat);
-			copy_m4_m4(scs->mat_old, ob->obmat);
-
-			DM_ensure_tessface(dm);
-			fill_scs_points(ob, dm, scs);
-		}
-
-		if(!smd->coll->bvhtree)
-		{
-			smd->coll->bvhtree = NULL; // bvhtree_build_from_smoke ( ob->obmat, dm->getTessFaceArray(dm), dm->getNumTessFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm), 0.0 );
-		}
-		return 1;
+	int use_heat = (sds->active_fields & SM_ACTIVE_HEAT);
+	int use_fire = (sds->active_fields & SM_ACTIVE_FIRE);
+	int use_colors = (sds->active_fields & SM_ACTIVE_COLORS);
+
+	if (free_old && sds->fluid)
+		smoke_free(sds->fluid);
+	if (!MIN3(res[0], res[1], res[2])) {
+		sds->fluid = NULL;
+		return;
 	}
-
-	return 2;
+	sds->fluid = smoke_init(res, dx, DT_DEFAULT, use_heat, use_fire, use_colors);
+	smoke_initBlenderRNA(sds->fluid, &(sds->alpha), &(sds->beta), &(sds->time_scale), &(sds->vorticity), &(sds->border_collisions),
+	                     &(sds->burning_rate), &(sds->flame_smoke), sds->flame_smoke_color, &(sds->flame_vorticity), &(sds->flame_ignition), &(sds->flame_max_temp));
+
+	/* reallocate shadow buffer */
+	if (sds->shadow)
+		MEM_freeN(sds->shadow);
+	sds->shadow = MEM_callocN(sizeof(float) * res[0] * res[1] * res[2], "SmokeDomainShadow");
 }
 
-static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
+void smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
 {
-	MVert *mvert = dm->getVertArray(dm);
-	MFace *mface = dm->getTessFaceArray(dm);
-	int i = 0, divs = 0;
-
-	// DG TODO: need to do this dynamically according to the domain object!
-	float cell_len = scs->dx;
-	int newdivs = 0;
-	int quads = 0, facecounter = 0;
+	int use_fire = (sds->active_fields & (SM_ACTIVE_HEAT | SM_ACTIVE_FIRE));
+	int use_colors = (sds->active_fields & SM_ACTIVE_COLORS);
 
-	// count quads
-	for(i = 0; i < dm->getNumTessFaces(dm); i++)
-	{
-		if(mface[i].v4)
-			quads++;
+	if (free_old && sds->wt)
+		smoke_turbulence_free(sds->wt);
+	if (!MIN3(res[0], res[1], res[2])) {
+		sds->wt = NULL;
+		return;
 	}
+	sds->wt = smoke_turbulence_init(res, sds->amplify + 1, sds->noise, use_fire, use_colors);
+	sds->res_wt[0] = res[0] * (sds->amplify + 1);
+	sds->res_wt[1] = res[1] * (sds->amplify + 1);
+	sds->res_wt[2] = res[2] * (sds->amplify + 1);
+	sds->dx_wt = dx / (sds->amplify + 1);
+	smoke_initWaveletBlenderRNA(sds->wt, &(sds->strength));
+}
 
-	scs->numtris = dm->getNumTessFaces(dm) + quads;
-	scs->tridivs = NULL;
-	calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface,  dm->getNumTessFaces(dm), scs->numtris, &(scs->tridivs), cell_len);
+/* convert global position to domain cell space */
+static void smoke_pos_to_cell(SmokeDomainSettings *sds, float pos[3])
+{
+	mul_m4_v3(sds->imat, pos);
+	sub_v3_v3(pos, sds->p0);
+	pos[0] *= 1.0f / sds->cell_size[0];
+	pos[1] *= 1.0f / sds->cell_size[1];
+	pos[2] *= 1.0f / sds->cell_size[2];
+}
 
-	// count triangle divisions
-	for(i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
-	{
-		divs += (scs->tridivs[3 * i] + 1) * (scs->tridivs[3 * i + 1] + 1) * (scs->tridivs[3 * i + 2] + 1);
-	}
+/* set domain resolution and dimensions from object derivedmesh */
+static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *ob, DerivedMesh *dm)
+{
+	size_t i;
+	float min[3] = {FLT_MAX, FLT_MAX, FLT_MAX}, max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
+	float size[3];
+	MVert *verts = dm->getVertArray(dm);
+	float scale = 0.0;
+	int res;
 
-	scs->points = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPoints");
-	scs->points_old = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPointsOld");
+	res = sds->maxres;
 
-	for(i = 0; i < dm->getNumVerts(dm); i++)
+	// get BB of domain
+	for (i = 0; i < dm->getNumVerts(dm); i++)
 	{
-		float tmpvec[3];
-		copy_v3_v3(tmpvec, mvert[i].co);
-		// mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
-		copy_v3_v3(&scs->points[i * 3], tmpvec);
+		// min BB
+		min[0] = MIN2(min[0], verts[i].co[0]);
+		min[1] = MIN2(min[1], verts[i].co[1]);
+		min[2] = MIN2(min[2], verts[i].co[2]);
+
+		// max BB
+		max[0] = MAX2(max[0], verts[i].co[0]);
+		max[1] = MAX2(max[1], verts[i].co[1]);
+		max[2] = MAX2(max[2], verts[i].co[2]);
 	}
-	
-	for(i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
-	{
-		int again = 0;
-		do
-		{
-			int j, k;
-			int divs1 = scs->tridivs[3 * facecounter + 0];
-			int divs2 = scs->tridivs[3 * facecounter + 1];
-			//int divs3 = scs->tridivs[3 * facecounter + 2];
-			float side1[3], side2[3], trinormorg[3], trinorm[3];
-			
-			if(again == 1 && mface[i].v4)
-			{
-				sub_v3_v3v3(side1,  mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co);
-				sub_v3_v3v3(side2,  mvert[ mface[i].v4 ].co, mvert[ mface[i].v1 ].co);
-			}
-			else {
-				sub_v3_v3v3(side1,  mvert[ mface[i].v2 ].co, mvert[ mface[i].v1 ].co);
-				sub_v3_v3v3(side2,  mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co);
-			}
 
-			cross_v3_v3v3(trinormorg, side1, side2);
-			normalize_v3(trinormorg);
-			copy_v3_v3(trinorm, trinormorg);
-			mul_v3_fl(trinorm, 0.25 * cell_len);
+	/* set domain bounds */
+	copy_v3_v3(sds->p0, min);
+	copy_v3_v3(sds->p1, max);
+	sds->dx = 1.0f / res;
 
-			for(j = 0; j <= divs1; j++)
-			{
-				for(k = 0; k <= divs2; k++)
-				{
-					float p1[3], p2[3], p3[3], p[3]={0,0,0}; 
-					const float uf = (float)(j + TRI_UVOFFSET) / (float)(divs1 + 0.0);
-					const float vf = (float)(k + TRI_UVOFFSET) / (float)(divs2 + 0.0);
-					float tmpvec[3];
-					
-					if(uf+vf > 1.0) 
-					{
-						// printf("bigger - divs1: %d, divs2: %d\n", divs1, divs2);
-						continue;
-					}
+	/* calculate domain dimensions */
+	sub_v3_v3v3(size, max, min);
+	copy_v3_v3(sds->cell_size, size);
+	mul_v3_v3(size, ob->size);
+	copy_v3_v3(sds->global_size, size);
+	copy_v3_v3(sds->dp0, min);
 
-					copy_v3_v3(p1, mvert[ mface[i].v1 ].co);
-					if(again == 1 && mface[i].v4)
-					{
-						copy_v3_v3(p2, mvert[ mface[i].v3 ].co);
-						copy_v3_v3(p3, mvert[ mface[i].v4 ].co);
-					}
-					else {
-						copy_v3_v3(p2, mvert[ mface[i].v2 ].co);
-						copy_v3_v3(p3, mvert[ mface[i].v3 ].co);
-					}
+	invert_m4_m4(sds->imat, ob->obmat);
 
-					mul_v3_fl(p1, (1.0-uf-vf));
-					mul_v3_fl(p2, uf);
-					mul_v3_fl(p3, vf);
-					
-					add_v3_v3v3(p, p1, p2);
-					add_v3_v3(p, p3);
-
-					if(newdivs > divs)
-						printf("mem problem\n");
-
-					// mMovPoints.push_back(p + trinorm);
-					add_v3_v3v3(tmpvec, p, trinorm);
-					// mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
-					copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec);
-					newdivs++;
-
-					if(newdivs > divs)
-						printf("mem problem\n");
-
-					// mMovPoints.push_back(p - trinorm);
-					copy_v3_v3(tmpvec, p);
-					sub_v3_v3(tmpvec, trinorm);
-					// mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
-					copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec);
-					newdivs++;
-				}
-			}
-
-			if(again == 0 && mface[i].v4)
-				again++;
-			else
-				again = 0;
-
-			facecounter++;
+	// prevent crash when initializing a plane as domain
+	if ((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
+		return;
 
-		} while(again!=0);
+	/* define grid resolutions from longest domain side */
+	if (size[0] > MAX2(size[1], size[2])) {
+		scale = res / size[0];
+		sds->scale = size[0] / ob->size[0];
+		sds->base_res[0] = res;
+		sds->base_res[1] = (int)(size[1] * scale + 0.5f);
+		sds->base_res[2] = (int)(size[2] * scale + 0.5f);
 	}
-
-	scs->numverts = dm->getNumVerts(dm);
-	// DG TODO: also save triangle count?
-
-	scs->numpoints = dm->getNumVerts(dm) + newdivs;
-
-	for(i = 0; i < scs->numpoints * 3; i++)
-	{
-		scs->points_old[i] = scs->points[i];
+	else if (size[1] > MAX2(size[0], size[2])) {
+		scale = res / size[1];
+		sds->scale = size[1] / ob->size[1];
+		sds->base_res[0] = (int)(size[0] * scale + 0.5f);
+		sds->base_res[1] = res;
+		sds->base_res[2] = (int)(size[2] * scale + 0.5f);
+	}
+	else {
+		scale = res / size[2];
+		sds->scale = size[2] / ob->size[2];
+		sds->base_res[0] = (int)(size[0] * scale + 0.5f);
+		sds->base_res[1] = (int)(size[1] * scale + 0.5f);
+		sds->base_res[2] = res;
 	}
-}
 
+	/* set cell size */
+	sds->cell_size[0] /= (float)sds->base_res[0];
+	sds->cell_size[1] /= (float)sds->base_res[1];
+	sds->cell_size[2] /= (float)sds->base_res[2];
+}
 
-static void fill_scs_points_anim(Object *UNUSED(ob), DerivedMesh *dm, SmokeCollSettings *scs)
+static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
 {
-	MVert *mvert = dm->getVertArray(dm);
-	MFace *mface = dm->getTessFaceArray(dm);
-	int quads = 0, numtris = 0, facecounter = 0;
-	unsigned int i = 0;
-	int divs = 0, newdivs = 0;
-	
-	// DG TODO: need to do this dynamically according to the domain object!
-	float cell_len = scs->dx;
-
-	// count quads
-	for(i = 0; i < dm->getNumTessFaces(dm); i++)
+	if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
 	{
-		if(mface[i].v4)
-			quads++;
-	}
+		SmokeDomainSettings *sds = smd->domain;
+		int res[3];
+		/* set domain dimensions from derivedmesh */
+		smoke_set_domain_from_derivedmesh(sds, ob, dm);
+		/* reset domain values */
+		zero_v3_int(sds->shift);
+		zero_v3(sds->shift_f);
+		add_v3_fl(sds->shift_f, 0.5f);
+		zero_v3(sds->prev_loc);
+		mul_m4_v3(ob->obmat, sds->prev_loc);
+
+		/* set resolutions */
+		if (smd->domain->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) {
+			res[0] = res[1] = res[2] = 1; /* use minimum res for adaptive init */
+		}
+		else {
+			VECCOPY(res, sds->base_res);
+		}
+		VECCOPY(sds->res, res);
+		sds->total_cells = sds->res[0] * sds->res[1] * sds->res[2];
+		sds->res_min[0] = sds->res_min[1] = sds->res_min[2] = 0;
+		VECCOPY(sds->res_max, res);
 
-	numtris = dm->getNumTessFaces(dm) + quads;
+		/* allocate fluid */
+		smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
 
-	// check if mesh changed topology
-	if(scs->numtris != numtris)
-		return;
-	if(scs->numverts != dm->getNumVerts(dm))
-		return;
+		smd->time = scene->r.cfra;
 
-	// update new positions
-	for(i = 0; i < dm->getNumVerts(dm); i++)
-	{
-		float tmpvec[3];
-		copy_v3_v3(tmpvec, mvert[i].co);
-		copy_v3_v3(&scs->points[i * 3], tmpvec);
-	}
+		/* allocate highres fluid */
+		if (sds->flags & MOD_SMOKE_HIGHRES) {
+			smoke_reallocate_highres_fluid(sds, sds->dx, sds->res, 0);
+		}
+		/* allocate shadow buffer */
+		if (!sds->shadow)
+			sds->shadow = MEM_callocN(sizeof(float) * sds->res[0] * sds->res[1] * sds->res[2], "SmokeDomainShadow");
 
-	// for every triangle // update div points
-	for(i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
+		return 1;
+	}
+	else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
 	{
-		int again = 0;
-		do
-		{
-			int j, k;
-			int divs1 = scs->tridivs[3 * facecounter + 0];
-			int divs2 = scs->tridivs[3 * facecounter + 1];
-			float srcside1[3], srcside2[3], destside1[3], destside2[3], src_trinormorg[3], dest_trinormorg[3], src_trinorm[3], dest_trinorm[3];
-			
-			if(again == 1 && mface[i].v4)
-			{
-				sub_v3_v3v3(srcside1,  &scs->points_old[mface[i].v3 * 3], &scs->points_old[mface[i].v1 * 3]);
-				sub_v3_v3v3(destside1,  &scs->points[mface[i].v3 * 3], &scs->points[mface[i].v1 * 3]);
-
-				sub_v3_v3v3(srcside2,  &scs->points_old[mface[i].v4 * 3], &scs->points_old[mface[i].v1 * 3]);
-				sub_v3_v3v3(destside2,  &scs->points[mface[i].v4 * 3], &scs->points[mface[i].v1 * 3]);
-			}
-			else {
-				sub_v3_v3v3(srcside1,  &scs->points_old[mface[i].v2 * 3], &scs->points_old[mface[i].v1 * 3]);
-				sub_v3_v3v3(destside1,  &scs->points[mface[i].v2 * 3], &scs->points[mface[i].v1 * 3]);
-
-				sub_v3_v3v3(srcside2,  &scs->points_old[mface[i].v3 * 3], &scs->points_old[mface[i].v1 * 3]);
-				sub_v3_v3v3(destside2,  &scs->points[mface[i].v3 * 3], &scs->points[mface[i].v1 * 3]);
-			}
-
-			cross_v3_v3v3(src_trinormorg, srcside1, srcside2);
-			cross_v3_v3v3(dest_trinormorg, destside1, destside2);
-
-			normalize_v3(src_trinormorg);
-			normalize_v3(dest_trinormorg);
-
-			copy_v3_v3(src_trinorm, src_trinormorg);
-			copy_v3_v3(dest_trinorm, dest_trinormorg);
-
-			mul_v3_fl(src_trinorm, 0.25 * cell_len);
-			mul_v3_fl(dest_trinorm, 0.25 * cell_len);
-
-			for(j = 0; j <= divs1; j++)
-			{
-				for(k = 0; k <= divs2; k++)
-				{
-					float src_p1[3], src_p2[3], src_p3[3], src_p[3]={0,0,0};
-					float dest_p1[3], dest_p2[3], dest_p3[3], dest_p[3]={0,0,0};
-					const float uf = (float)(j + TRI_UVOFFSET) / (float)(divs1 + 0.0);
-					const float vf = (float)(k + TRI_UVOFFSET) / (float)(divs2 + 0.0);
-					float src_tmpvec[3], dest_tmpvec[3];
-					
-					if(uf+vf > 1.0) 
-					{
-						// printf("bigger - divs1: %d, divs2: %d\n", divs1, divs2);
-						continue;
-					}
-
-					copy_v3_v3(src_p1, &scs->points_old[mface[i].v1 * 3]);
-					copy_v3_v3(dest_p1, &scs->points[mface[i].v1 * 3]);
-					if(again == 1 && mface[i].v4)
-					{
-						copy_v3_v3(src_p2, &scs->points_old[mface[i].v3 * 3]);
-						copy_v3_v3(dest_p2, &scs->points[mface[i].v3 * 3]);
-
-						copy_v3_v3(src_p3,&scs->points_old[mface[i].v4 * 3]);
-						copy_v3_v3(dest_p3, &scs->points[mface[i].v4 * 3]);
-					}
-					else {
-						copy_v3_v3(src_p2, &scs->points_old[mface[i].v2 * 3]);
-						copy_v3_v3(dest_p2, &scs->points[mface[i].v2 * 3]);
-						copy_v3_v3(src_p3, &scs->points_old[mface[i].v3 * 3]);
-						copy_v3_v3(dest_p3, &scs->points[mface[i].v3 * 3]);
-					}
-
-					mul_v3_fl(src_p1, (1.0-uf-vf));
-					mul_v3_fl(dest_p1, (1.0-uf-vf));
-
-					mul_v3_fl(src_p2, uf);
-					mul_v3_fl(dest_p2, uf);
-
-					mul_v3_fl(src_p3, vf);
-					mul_v3_fl(dest_p3, vf);
-
-					add_v3_v3v3(src_p, src_p1, src_p2);
-					add_v3_v3v3(dest_p, dest_p1, dest_p2);
-
-					add_v3_v3(src_p, src_p3);
-					add_v3_v3(dest_p, dest_p3);
-
-					if(newdivs > divs)
-						printf("mem problem\n");
-
-					// mMovPoints.push_back(p + trinorm);
-					add_v3_v3v3(src_tmpvec, src_p, src_trinorm);
-					add_v3_v3v3(dest_tmpvec, dest_p, dest_trinorm);
-
-					// mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
-					copy_v3_v3(&scs->points_old[3 * (dm->getNumVerts(dm) + newdivs)], src_tmpvec);
-					copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], dest_tmpvec);
-					newdivs++;
-
-					if(newdivs > divs)
-						printf("mem problem\n");
-
-					// mMovPoints.push_back(p - trinorm);
-					copy_v3_v3(src_tmpvec, src_p);
-					copy_v3_v3(dest_tmpvec, dest_p);
-
-					sub_v3_v3(src_tmpvec, src_trinorm);
-					sub_v3_v3(dest_tmpvec, dest_trinorm);
-
-					// mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
-					copy_v3_v3(&scs->points_old[3 * (dm->getNumVerts(dm) + newdivs)], src_tmpvec);
-					copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], dest_tmpvec);
-					newdivs++;
-				}
-			}
-
-			if(again == 0 && mface[i].v4)
-				again++;
-			else
-				again = 0;
-
-			facecounter++;
+		smd->time = scene->r.cfra;
 
-		} while(again!=0);
+		return 1;
 	}
-
-	// scs->numpoints = dm->getNumVerts(dm) + newdivs;
-
-}
-
-/*! init triangle divisions */
-static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len)
-{
-	// mTriangleDivs1.resize( faces.size() );
-	// mTriangleDivs2.resize( faces.size() );
-	// mTriangleDivs3.resize( faces.size() );
-
-	size_t i = 0, facecounter = 0;
-	float maxscale[3] = {1,1,1}; // = channelFindMaxVf(mcScale); get max scale value
-	float maxpart = ABS(maxscale[0]);
-	float scaleFac = 0;
-	float fsTri = 0;
-	if(ABS(maxscale[1])>maxpart) maxpart = ABS(maxscale[1]);
-	if(ABS(maxscale[2])>maxpart) maxpart = ABS(maxscale[2]);
-	scaleFac = 1.0 / maxpart;
-	// featureSize = mLevel[mMaxRefine].nodeSize
-	fsTri = cell_len * 0.75 * scaleFac; // fsTri = cell_len * 0.9;
-
-	if(*tridivs)
-		MEM_freeN(*tridivs);
-
-	*tridivs = MEM_callocN(sizeof(int) * numtris * 3, "Smoke_Tridivs");
-
-	for(i = 0, facecounter = 0; i < numfaces; i++) 
+	else if ((smd->type & MOD_SMOKE_TYPE_COLL))
 	{
-		float p0[3], p1[3], p2[3];
-		float side1[3];
-		float side2[3];
-		float side3[3];
-		int divs1=0, divs2=0, divs3=0;
-
-		copy_v3_v3(p0, verts[faces[i].v1].co);
-		mul_m4_v3(ob->obmat, p0);
-		copy_v3_v3(p1, verts[faces[i].v2].co);
-		mul_m4_v3(ob->obmat, p1);
-		copy_v3_v3(p2, verts[faces[i].v3].co);
-		mul_m4_v3(ob->obmat, p2);
-
-		sub_v3_v3v3(side1, p1, p0);
-		sub_v3_v3v3(side2, p2, p0);
-		sub_v3_v3v3(side3, p1, p2);
-
-		if(dot_v3v3(side1, side1) > fsTri*fsTri)
-		{ 
-			float tmp = normalize_v3(side1);
-			divs1 = (int)ceil(tmp/fsTri); 
-		}
-		if(dot_v3v3(side2, side2) > fsTri*fsTri)
-		{ 
-			float tmp = normalize_v3(side2);
-			divs2 = (int)ceil(tmp/fsTri); 
-			
-			/*		
-			// debug
-			if(i==0)
-				printf("b tmp: %f, fsTri: %f, divs2: %d\n", tmp, fsTri, divs2);
-			*/
-			
+		if (!smd->coll)
+		{
+			smokeModifier_createType(smd);
 		}
 
-		(*tridivs)[3 * facecounter + 0] = divs1;
-		(*tridivs)[3 * facecounter + 1] = divs2;
-		(*tridivs)[3 * facecounter + 2] = divs3;
-
-		// TODO quad case
-		if(faces[i].v4)
-		{
-			divs1=0, divs2=0, divs3=0;
-
-			facecounter++;
-			
-			copy_v3_v3(p0, verts[faces[i].v3].co);
-			mul_m4_v3(ob->obmat, p0);
-			copy_v3_v3(p1, verts[faces[i].v4].co);
-			mul_m4_v3(ob->obmat, p1);
-			copy_v3_v3(p2, verts[faces[i].v1].co);
-			mul_m4_v3(ob->obmat, p2);
-
-			sub_v3_v3v3(side1, p1, p0);
-			sub_v3_v3v3(side2, p2, p0);
-			sub_v3_v3v3(side3, p1, p2);
-
-			if(dot_v3v3(side1, side1) > fsTri*fsTri)
-			{ 
-				float tmp = normalize_v3(side1);
-				divs1 = (int)ceil(tmp/fsTri); 
-			}
-			if(dot_v3v3(side2, side2) > fsTri*fsTri)
-			{ 
-				float tmp = normalize_v3(side2);
-				divs2 = (int)ceil(tmp/fsTri); 
-			}
+		smd->time = scene->r.cfra;
 
-			(*tridivs)[3 * facecounter + 0] = divs1;
-			(*tridivs)[3 * facecounter + 1] = divs2;
-			(*tridivs)[3 * facecounter + 2] = divs3;
-		}
-		facecounter++;
+		return 1;
 	}
+
+	return 2;
 }
 
 #endif /* WITH_SMOKE */
 
 static void smokeModifier_freeDomain(SmokeModifierData *smd)
 {
-	if(smd->domain)
+	if (smd->domain)
 	{
-		if(smd->domain->shadow)
-				MEM_freeN(smd->domain->shadow);
-			smd->domain->shadow = NULL;
+		if (smd->domain->shadow)
+			MEM_freeN(smd->domain->shadow);
+		smd->domain->shadow = NULL;
 
-		if(smd->domain->fluid)
+		if (smd->domain->fluid)
 			smoke_free(smd->domain->fluid);
 
-		if(smd->domain->wt)
+		if (smd->domain->wt)
 			smoke_turbulence_free(smd->domain->wt);
 
-		if(smd->domain->effector_weights)
-				MEM_freeN(smd->domain->effector_weights);
+		if (smd->domain->effector_weights)
+			MEM_freeN(smd->domain->effector_weights);
 		smd->domain->effector_weights = NULL;
 
 		BKE_ptcache_free_list(&(smd->domain->ptcaches[0]));
@@ -748,16 +379,10 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd)
 
 static void smokeModifier_freeFlow(SmokeModifierData *smd)
 {
-	if(smd->flow)
+	if (smd->flow)
 	{
-/*
-		if(smd->flow->bvh)
-		{
-			free_bvhtree_from_mesh(smd->flow->bvh);
-			MEM_freeN(smd->flow->bvh);
-		}
-		smd->flow->bvh = NULL;
-*/
+		if (smd->flow->dm) smd->flow->dm->release(smd->flow->dm);
+		if (smd->flow->verts_old) MEM_freeN(smd->flow->verts_old);
 		MEM_freeN(smd->flow);
 		smd->flow = NULL;
 	}
@@ -765,40 +390,22 @@ static void smokeModifier_freeFlow(SmokeModifierData *smd)
 
 static void smokeModifier_freeCollision(SmokeModifierData *smd)
 {
-	if(smd->coll)
+	if (smd->coll)
 	{
 		SmokeCollSettings *scs = smd->coll;
 
-		if(scs->numpoints)
+		if (scs->numverts)
 		{
-			if(scs->points)
-			{
-				MEM_freeN(scs->points);
-				scs->points = NULL;
-			}
-			if(scs->points_old)
-			{
-				MEM_freeN(scs->points_old);
-				scs->points_old = NULL;
-			}
-			if(scs->tridivs)
+			if (scs->verts_old)
 			{
-				MEM_freeN(scs->tridivs);
-				scs->tridivs = NULL;
+				MEM_freeN(scs->verts_old);
+				scs->verts_old = NULL;
 			}
 		}
 
-		if(scs->bvhtree)
-		{
-			BLI_bvhtree_free(scs->bvhtree);
-			scs->bvhtree = NULL;
-		}
-
-#ifdef USE_SMOKE_COLLISION_DM
-		if(smd->coll->dm)
+		if (smd->coll->dm)
 			smd->coll->dm->release(smd->coll->dm);
 		smd->coll->dm = NULL;
-#endif
 
 		MEM_freeN(smd->coll);
 		smd->coll = NULL;
@@ -807,7 +414,7 @@ static void smokeModifier_freeCollision(SmokeModifierData *smd)
 
 void smokeModifier_reset_turbulence(struct SmokeModifierData *smd)
 {
-	if(smd && smd->domain && smd->domain->wt)
+	if (smd && smd->domain && smd->domain->wt)
 	{
 		smoke_turbulence_free(smd->domain->wt);
 		smd->domain->wt = NULL;
@@ -816,15 +423,15 @@ void smokeModifier_reset_turbulence(struct SmokeModifierData *smd)
 
 void smokeModifier_reset(struct SmokeModifierData *smd)
 {
-	if(smd)
+	if (smd)
 	{
-		if(smd->domain)
+		if (smd->domain)
 		{
-			if(smd->domain->shadow)
+			if (smd->domain->shadow)
 				MEM_freeN(smd->domain->shadow);
 			smd->domain->shadow = NULL;
 
-			if(smd->domain->fluid)
+			if (smd->domain->fluid)
 			{
 				smoke_free(smd->domain->fluid);
 				smd->domain->fluid = NULL;
@@ -833,39 +440,23 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
 			smokeModifier_reset_turbulence(smd);
 
 			smd->time = -1;
-
-			// printf("reset domain end\n");
+			smd->domain->total_cells = 0;
+			smd->domain->active_fields = 0;
 		}
-		else if(smd->flow)
+		else if (smd->flow)
 		{
-			/*
-			if(smd->flow->bvh)
-			{
-				free_bvhtree_from_mesh(smd->flow->bvh);
-				MEM_freeN(smd->flow->bvh);
-			}
-			smd->flow->bvh = NULL;
-			*/
+			if (smd->flow->verts_old) MEM_freeN(smd->flow->verts_old);
+			smd->flow->verts_old = NULL;
+			smd->flow->numverts = 0;
 		}
-		else if(smd->coll)
+		else if (smd->coll)
 		{
 			SmokeCollSettings *scs = smd->coll;
 
-			if(scs->numpoints && scs->points)
+			if (scs->numverts && scs->verts_old)
 			{
-				MEM_freeN(scs->points);
-				scs->points = NULL;
-			
-				if(scs->points_old)
-				{
-					MEM_freeN(scs->points_old);
-					scs->points_old = NULL;
-				}
-				if(scs->tridivs)
-				{
-					MEM_freeN(scs->tridivs);
-					scs->tridivs = NULL;
-				}
+				MEM_freeN(scs->verts_old);
+				scs->verts_old = NULL;
 			}
 		}
 	}
@@ -873,7 +464,7 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
 
 void smokeModifier_free(SmokeModifierData *smd)
 {
-	if(smd)
+	if (smd)
 	{
 		smokeModifier_freeDomain(smd);
 		smokeModifier_freeFlow(smd);
@@ -883,11 +474,11 @@ void smokeModifier_free(SmokeModifierData *smd)
 
 void smokeModifier_createType(struct SmokeModifierData *smd)
 {
-	if(smd)
+	if (smd)
 	{
-		if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+		if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 		{
-			if(smd->domain)
+			if (smd->domain)
 				smokeModifier_freeDomain(smd);
 
 			smd->domain = MEM_callocN(sizeof(SmokeDomainSettings), "SmokeDomain");
@@ -903,13 +494,12 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->domain->ptcaches[1].first = smd->domain->ptcaches[1].last = NULL;
 			/* set some standard values */
 			smd->domain->fluid = NULL;
-			smd->domain->wt = NULL;			
+			smd->domain->wt = NULL;
 			smd->domain->eff_group = NULL;
 			smd->domain->fluid_group = NULL;
 			smd->domain->coll_group = NULL;
 			smd->domain->maxres = 32;
-			smd->domain->amplify = 1;			
-			smd->domain->omega = 1.0;			
+			smd->domain->amplify = 1;
 			smd->domain->alpha = -0.001;
 			smd->domain->beta = 0.1;
 			smd->domain->time_scale = 1.0;
@@ -919,14 +509,28 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->domain->strength = 2.0;
 			smd->domain->noise = MOD_SMOKE_NOISEWAVE;
 			smd->domain->diss_speed = 5;
-			// init 3dview buffer
+			smd->domain->active_fields = 0;
+
+			smd->domain->adapt_margin = 4;
+			smd->domain->adapt_res = 0;
+			smd->domain->adapt_threshold = 0.02f;
+
+			smd->domain->burning_rate = 0.75f;
+			smd->domain->flame_smoke = 1.0f;
+			smd->domain->flame_vorticity = 0.5f;
+			smd->domain->flame_ignition = 1.25f;
+			smd->domain->flame_max_temp = 1.75f;
+			/* color */
+			smd->domain->flame_smoke_color[0] = 0.7f;
+			smd->domain->flame_smoke_color[1] = 0.7f;
+			smd->domain->flame_smoke_color[2] = 0.7f;
 
 			smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOWBIG;
 			smd->domain->effector_weights = BKE_add_effector_weights(NULL);
 		}
-		else if(smd->type & MOD_SMOKE_TYPE_FLOW)
+		else if (smd->type & MOD_SMOKE_TYPE_FLOW)
 		{
-			if(smd->flow)
+			if (smd->flow)
 				smokeModifier_freeFlow(smd);
 
 			smd->flow = MEM_callocN(sizeof(SmokeFlowSettings), "SmokeFlow");
@@ -934,31 +538,35 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->flow->smd = smd;
 
 			/* set some standard values */
-			smd->flow->density = 1.0;
-			smd->flow->temp = 1.0;
+			smd->flow->density = 1.0f;
+			smd->flow->fuel_amount = 1.0f;
+			smd->flow->temp = 1.0f;
 			smd->flow->flags = MOD_SMOKE_FLOW_ABSOLUTE;
-			smd->flow->vel_multi = 1.0;
+			smd->flow->vel_multi = 1.0f;
+			smd->flow->surface_distance = 1.5f;
+			smd->flow->source = MOD_SMOKE_FLOW_SOURCE_MESH;
+			smd->flow->texture_size = 1.0f;
+
+			smd->flow->color[0] = 0.7f;
+			smd->flow->color[1] = 0.7f;
+			smd->flow->color[2] = 0.7f;
 
+			smd->flow->dm = NULL;
 			smd->flow->psys = NULL;
 
 		}
-		else if(smd->type & MOD_SMOKE_TYPE_COLL)
+		else if (smd->type & MOD_SMOKE_TYPE_COLL)
 		{
-			if(smd->coll)
+			if (smd->coll)
 				smokeModifier_freeCollision(smd);
 
 			smd->coll = MEM_callocN(sizeof(SmokeCollSettings), "SmokeColl");
 
 			smd->coll->smd = smd;
-			smd->coll->points = NULL;
-			smd->coll->points_old = NULL;
-			smd->coll->tridivs = NULL;
-			smd->coll->vel = NULL;
-			smd->coll->numpoints = 0;
-			smd->coll->numtris = 0;
-			smd->coll->bvhtree = NULL;
+			smd->coll->verts_old = NULL;
+			smd->coll->numverts = 0;
 			smd->coll->type = 0; // static obstacle
-			smd->coll->dx = 1.0f / 50.0f;
+			smd->coll->dm = NULL;
 
 #ifdef USE_SMOKE_COLLISION_DM
 			smd->coll->dm = NULL;
@@ -971,39 +579,67 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 {
 	tsmd->type = smd->type;
 	tsmd->time = smd->time;
-	
+
 	smokeModifier_createType(tsmd);
 
 	if (tsmd->domain) {
-		tsmd->domain->maxres = smd->domain->maxres;
-		tsmd->domain->amplify = smd->domain->amplify;
-		tsmd->domain->omega = smd->domain->omega;
+		tsmd->domain->fluid_group = smd->domain->fluid_group;
+		tsmd->domain->coll_group = smd->domain->coll_group;
+
+		tsmd->domain->adapt_margin = smd->domain->adapt_margin;
+		tsmd->domain->adapt_res = smd->domain->adapt_res;
+		tsmd->domain->adapt_threshold = smd->domain->adapt_threshold;
+
 		tsmd->domain->alpha = smd->domain->alpha;
 		tsmd->domain->beta = smd->domain->beta;
+		tsmd->domain->amplify = smd->domain->amplify;
+		tsmd->domain->maxres = smd->domain->maxres;
 		tsmd->domain->flags = smd->domain->flags;
-		tsmd->domain->strength = smd->domain->strength;
+		tsmd->domain->viewsettings = smd->domain->viewsettings;
 		tsmd->domain->noise = smd->domain->noise;
 		tsmd->domain->diss_speed = smd->domain->diss_speed;
-		tsmd->domain->viewsettings = smd->domain->viewsettings;
-		tsmd->domain->fluid_group = smd->domain->fluid_group;
-		tsmd->domain->coll_group = smd->domain->coll_group;
+		tsmd->domain->strength = smd->domain->strength;
+
+		tsmd->domain->border_collisions = smd->domain->border_collisions;
 		tsmd->domain->vorticity = smd->domain->vorticity;
 		tsmd->domain->time_scale = smd->domain->time_scale;
-		tsmd->domain->border_collisions = smd->domain->border_collisions;
-		
+
+		tsmd->domain->burning_rate = smd->domain->burning_rate;
+		tsmd->domain->flame_smoke = smd->domain->flame_smoke;
+		tsmd->domain->flame_vorticity = smd->domain->flame_vorticity;
+		tsmd->domain->flame_ignition = smd->domain->flame_ignition;
+		tsmd->domain->flame_max_temp = smd->domain->flame_max_temp;
+		copy_v3_v3(tsmd->domain->flame_smoke_color, smd->domain->flame_smoke_color);
+
 		MEM_freeN(tsmd->domain->effector_weights);
 		tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
-	} 
+	}
 	else if (tsmd->flow) {
+		tsmd->flow->psys = smd->flow->psys;
+		tsmd->flow->noise_texture = smd->flow->noise_texture;
+
+		tsmd->flow->vel_multi = smd->flow->vel_multi;
+		tsmd->flow->vel_normal = smd->flow->vel_normal;
+		tsmd->flow->vel_random = smd->flow->vel_random;
+
 		tsmd->flow->density = smd->flow->density;
+		copy_v3_v3(tsmd->flow->color, smd->flow->color);
+		tsmd->flow->fuel_amount = smd->flow->fuel_amount;
 		tsmd->flow->temp = smd->flow->temp;
-		tsmd->flow->psys = smd->flow->psys;
+		tsmd->flow->volume_density = smd->flow->volume_density;
+		tsmd->flow->surface_distance = smd->flow->surface_distance;
+
+		tsmd->flow->texture_size = smd->flow->texture_size;
+		tsmd->flow->texture_offset = smd->flow->texture_offset;
+		BLI_strncpy(tsmd->flow->uvlayer_name, tsmd->flow->uvlayer_name, sizeof(tsmd->flow->uvlayer_name));
+		tsmd->flow->vgroup_density = smd->flow->vgroup_density;
+
 		tsmd->flow->type = smd->flow->type;
+		tsmd->flow->source = smd->flow->source;
+		tsmd->flow->texture_type = smd->flow->texture_type;
 		tsmd->flow->flags = smd->flow->flags;
-		tsmd->flow->vel_multi = smd->flow->vel_multi;
 	}
 	else if (tsmd->coll) {
-		;
 		/* leave it as initialized, collision settings is mostly caches */
 	}
 }
@@ -1011,24 +647,24 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 #ifdef WITH_SMOKE
 
 // forward decleration
-static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct);
+static void smoke_calc_transparency(SmokeDomainSettings *sds, Scene *scene);
 static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
 
 static int get_lamp(Scene *scene, float *light)
-{	
-	Base *base_tmp = NULL;	
+{
+	Base *base_tmp = NULL;
 	int found_lamp = 0;
 
 	// try to find a lamp, preferably local
-	for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) {
-		if(base_tmp->object->type == OB_LAMP) {
+	for (base_tmp = scene->base.first; base_tmp; base_tmp = base_tmp->next) {
+		if (base_tmp->object->type == OB_LAMP) {
 			Lamp *la = base_tmp->object->data;
 
-			if(la->type == LA_LOCAL) {
+			if (la->type == LA_LOCAL) {
 				copy_v3_v3(light, base_tmp->object->obmat[3]);
 				return 1;
 			}
-			else if(!found_lamp) {
+			else if (!found_lamp) {
 				copy_v3_v3(light, base_tmp->object->obmat[3]);
 				found_lamp = 1;
 			}
@@ -1038,48 +674,131 @@ static int get_lamp(Scene *scene, float *light)
 	return found_lamp;
 }
 
-static void smoke_calc_domain(Scene *UNUSED(scene), Object *UNUSED(ob), SmokeModifierData *UNUSED(smd))
+static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds, SmokeCollSettings *scs, unsigned char *obstacle_map, float *velocityX, float *velocityY, float *velocityZ, float dt)
 {
-#if 0
-	SmokeDomainSettings *sds = smd->domain;
-	GroupObject *go = NULL;			
-	Base *base = NULL;
-
-	/* do collisions, needs to be done before emission, so that smoke isn't emitted inside collision cells */
-	if(1)
+	if (!scs->dm) return;
 	{
-		unsigned int i;
-		Object **collobjs = NULL;
-		unsigned int numcollobj = 0;
-		collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj);
+		DerivedMesh *dm = NULL;
+		MVert *mvert = NULL;
+		MFace *mface = NULL;
+		BVHTreeFromMesh treeData = {0};
+		int numverts, i, z;
+
+		float surface_distance = 0.6;
+
+		float *vert_vel = NULL;
+		int has_velocity = 0;
+
+		tstart();
+
+		dm = CDDM_copy(scs->dm);
+		CDDM_calc_normals(dm);
+		mvert = dm->getVertArray(dm);
+		mface = dm->getTessFaceArray(dm);
+		numverts = dm->getNumVerts(dm);
+
+		// DG TODO
+		// if (scs->type > SM_COLL_STATIC)
+		// if line above is used, the code is in trouble if the object moves but is declared as "does not move"
 
-		for(i = 0; i < numcollobj; i++)
 		{
-			Object *collob= collobjs[i];
-			SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);		
-			
-			// check for active smoke modifier
-			// if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
-			// SmokeModifierData *smd2 = (SmokeModifierData *)md;
-
-			if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points && smd2->coll->points_old)
+			vert_vel = MEM_callocN(sizeof(float) * numverts * 3, "smoke_obs_velocity");
+
+			if (scs->numverts != numverts || !scs->verts_old) {
+				if (scs->verts_old) MEM_freeN(scs->verts_old);
+
+				scs->verts_old = MEM_callocN(sizeof(float) * numverts * 3, "smoke_obs_verts_old");
+				scs->numverts = numverts;
+			}
+			else {
+				has_velocity = 1;
+			}
+		}
+
+		/*	Transform collider vertices to
+		 *   domain grid space for fast lookups */
+		for (i = 0; i < numverts; i++) {
+			float n[3];
+			float co[3];
+
+			/* vert pos */
+			mul_m4_v3(coll_ob->obmat, mvert[i].co);
+			smoke_pos_to_cell(sds, mvert[i].co);
+
+			/* vert normal */
+			normal_short_to_float_v3(n, mvert[i].no);
+			mul_mat3_m4_v3(coll_ob->obmat, n);
+			mul_mat3_m4_v3(sds->imat, n);
+			normalize_v3(n);
+			normal_float_to_short_v3(mvert[i].no, n);
+
+			/* vert velocity */
+			VECADD(co, mvert[i].co, sds->shift);
+			if (has_velocity)
 			{
-				// ??? anything to do here?
+				sub_v3_v3v3(&vert_vel[i * 3], co, &scs->verts_old[i * 3]);
+				mul_v3_fl(&vert_vel[i * 3], sds->dx / dt);
+			}
+			copy_v3_v3(&scs->verts_old[i * 3], co);
+		}
 
-				// TODO: only something to do for ANIMATED obstacles: need to update positions
+		if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6)) {
+			#pragma omp parallel for schedule(static)
+			for (z = sds->res_min[2]; z < sds->res_max[2]; z++) {
+				int x, y;
+				for (x = sds->res_min[0]; x < sds->res_max[0]; x++)
+					for (y = sds->res_min[1]; y < sds->res_max[1]; y++) {
+						int index = smoke_get_index(x - sds->res_min[0], sds->res[0], y - sds->res_min[1], sds->res[1], z - sds->res_min[2]);
+
+						float ray_start[3] = {(float)x + 0.5f, (float)y + 0.5f, (float)z + 0.5f};
+						BVHTreeNearest nearest = {0};
+						nearest.index = -1;
+						nearest.dist = surface_distance * surface_distance; /* find_nearest uses squared distance */
+
+						/* find the nearest point on the mesh */
+						if (BLI_bvhtree_find_nearest(treeData.tree, ray_start, &nearest, treeData.nearest_callback, &treeData) != -1) {
+							float weights[4];
+							int v1, v2, v3, f_index = nearest.index;
+
+							/* calculate barycentric weights for nearest point */
+							v1 = mface[f_index].v1;
+							v2 = (nearest.flags & BVH_ONQUAD) ? mface[f_index].v3 : mface[f_index].v2;
+							v3 = (nearest.flags & BVH_ONQUAD) ? mface[f_index].v4 : mface[f_index].v3;
+							interp_weights_face_v3(weights, mvert[v1].co, mvert[v2].co, mvert[v3].co, NULL, nearest.co);
+
+							// DG TODO
+							if (has_velocity)
+							{
+								/* apply object velocity */
+								{
+									float hit_vel[3];
+									interp_v3_v3v3v3(hit_vel, &vert_vel[v1 * 3], &vert_vel[v2 * 3], &vert_vel[v3 * 3], weights);
+									velocityX[index] += hit_vel[0];
+									velocityY[index] += hit_vel[1];
+									velocityZ[index] += hit_vel[2];
+								}
+							}
+
+							/* tag obstacle cells */
+							obstacle_map[index] = 1;
 
+							if (has_velocity)
+								obstacle_map[index] |= 8;
+						}
+					}
 			}
 		}
+		/* free bvh tree */
+		free_bvhtree_from_mesh(&treeData);
+		dm->release(dm);
 
-		if(collobjs)
-			MEM_freeN(collobjs);
+		if (vert_vel) MEM_freeN(vert_vel);
 	}
-
-#endif
 }
 
 /* Animated obstacles: dx_step = ((x_new - x_old) / totalsteps) * substep */
-static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt, int substep, int totalsteps)
+static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt,
+                             int UNUSED(substep), int UNUSED(totalsteps))
 {
 	Object **collobjs = NULL;
 	unsigned int numcollobj = 0;
@@ -1092,437 +811,1087 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
 	float *velxOrig = smoke_get_velocity_x(sds->fluid);
 	float *velyOrig = smoke_get_velocity_y(sds->fluid);
 	float *velzOrig = smoke_get_velocity_z(sds->fluid);
-	// float *density = smoke_get_density(sds->fluid);
+	float *density = smoke_get_density(sds->fluid);
+	float *fuel = smoke_get_fuel(sds->fluid);
+	float *flame = smoke_get_flame(sds->fluid);
+	float *r = smoke_get_color_r(sds->fluid);
+	float *g = smoke_get_color_g(sds->fluid);
+	float *b = smoke_get_color_b(sds->fluid);
 	unsigned int z;
 
 	smoke_get_ob_velocity(sds->fluid, &velx, &vely, &velz);
 
 	// TODO: delete old obstacle flags
-	for(z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
+	for (z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
 	{
-		if(obstacles[z])
+		if (obstacles[z] & 8) // Do not delete static obstacles
 		{
-			// density[z] = 0;
+			obstacles[z] = 0;
+		}
 
+		velx[z] = 0;
+		vely[z] = 0;
+		velz[z] = 0;
+	}
+
+
+	collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj, eModifierType_Smoke);
+
+	// update obstacle tags in cells
+	for (collIndex = 0; collIndex < numcollobj; collIndex++)
+	{
+		Object *collob = collobjs[collIndex];
+		SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(collob, eModifierType_Smoke);
+
+		// DG TODO: check if modifier is active?
+
+		if ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll)
+		{
+			SmokeCollSettings *scs = smd2->coll;
+			obstacles_from_derivedmesh(collob, sds, scs, obstacles, velx, vely, velz, dt);
+		}
+	}
+
+	if (collobjs)
+		MEM_freeN(collobjs);
+
+	/* obstacle cells should not contain any velocity from the smoke simulation */
+	for (z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
+	{
+		if (obstacles[z])
+		{
 			velxOrig[z] = 0;
 			velyOrig[z] = 0;
 			velzOrig[z] = 0;
+			density[z] = 0;
+			if (fuel) {
+				fuel[z] = 0;
+				flame[z] = 0;
+			}
+			if (r) {
+				r[z] = 0;
+				g[z] = 0;
+				b[z] = 0;
+			}
+		}
+	}
+}
+
+
+typedef struct EmissionMap {
+	float *influence;
+	float *velocity;
+	int min[3], max[3], res[3];
+	int total_cells, valid;
+} EmissionMap;
+
+static void em_boundInsert(EmissionMap *em, float point[3])
+{
+	int i = 0;
+	if (!em->valid) {
+		VECCOPY(em->min, point);
+		VECCOPY(em->max, point);
+		em->valid = 1;
+	}
+	else {
+		for (; i < 3; i++) {
+			if (point[i] < em->min[i]) em->min[i] = (int)floor(point[i]);
+			if (point[i] > em->max[i]) em->max[i] = (int)ceil(point[i]);
+		}
+	}
+}
+
+static void clampBoundsInDomain(SmokeDomainSettings *sds, int min[3], int max[3], float *min_vel, float *max_vel, int margin, float dt)
+{
+	int i;
+	for (i = 0; i < 3; i++) {
+		int adapt = (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) ? sds->adapt_res : 0;
+		/* add margin */
+		min[i] -= margin;
+		max[i] += margin;
+
+		/* adapt to velocity */
+		if (min_vel && min_vel[i] < 0.0f) {
+			min[i] += (int)ceil(min_vel[i] * dt);
+		}
+		if (max_vel && max_vel[i] > 0.0f) {
+			max[i] += (int)ceil(max_vel[i] * dt);
+		}
+
+		/* clamp within domain max size */
+		CLAMP(min[i], -adapt, sds->base_res[i] + adapt);
+		CLAMP(max[i], -adapt, sds->base_res[i] + adapt);
+	}
+}
+
+static void em_allocateData(EmissionMap *em, int use_velocity) {
+	int i, res[3];
+
+	for (i = 0; i < 3; i++) {
+		res[i] = em->max[i] - em->min[i];
+		if (res[i] <= 0)
+			return;
+	}
+	em->total_cells = res[0] * res[1] * res[2];
+	copy_v3_v3_int(em->res, res);
+
+
+	em->influence = MEM_callocN(sizeof(float) * em->total_cells, "smoke_flow_influence");
+	if (use_velocity)
+		em->velocity = MEM_callocN(sizeof(float) * em->total_cells * 3, "smoke_flow_velocity");
+}
+
+static void em_freeData(EmissionMap *em) {
+	if (em->influence)
+		MEM_freeN(em->influence);
+	if (em->velocity)
+		MEM_freeN(em->velocity);
+}
+
+
+static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowSettings *sfs, EmissionMap *em, Scene *scene, float time, float dt)
+{
+	if (sfs && sfs->psys && sfs->psys->part && ELEM(sfs->psys->part->type, PART_EMITTER, PART_FLUID)) // is particle system selected
+	{
+		ParticleSimulationData sim;
+		ParticleSystem *psys = sfs->psys;
+		float *particle_pos;
+		float *particle_vel;
+		int totpart = psys->totpart, totchild;
+		int p = 0;
+		int valid_particles = 0;
+
+		sim.scene = scene;
+		sim.ob = flow_ob;
+		sim.psys = psys;
+
+		if (psys->part->type == PART_HAIR)
+		{
+			// TODO: PART_HAIR not supported whatsoever
+			totchild = 0;
+		}
+		else
+			totchild = psys->totchild * psys->part->disp / 100;
+
+		particle_pos = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "smoke_flow_particles");
+		particle_vel = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "smoke_flow_particles");
+
+		/* calculate local position for each particle */
+		for (p = 0; p < totpart + totchild; p++)
+		{
+			ParticleKey state;
+			float *pos;
+			if (p < totpart) {
+				if (psys->particles[p].flag & (PARS_NO_DISP | PARS_UNEXIST))
+					continue;
+			}
+			else {
+				/* handle child particle */
+				ChildParticle *cpa = &psys->child[p - totpart];
+				if (psys->particles[cpa->parent].flag & (PARS_NO_DISP | PARS_UNEXIST))
+					continue;
+			}
+
+			state.time = time;
+			if (psys_get_particle_state(&sim, p, &state, 0) == 0)
+				continue;
+
+			/* location */
+			pos = &particle_pos[valid_particles * 3];
+			copy_v3_v3(pos, state.co);
+			smoke_pos_to_cell(sds, pos);
+
+			/* velocity */
+			copy_v3_v3(&particle_vel[valid_particles * 3], state.vel);
+			mul_mat3_m4_v3(sds->imat, &particle_vel[valid_particles * 3]);
+
+			/* calculate emission map bounds */
+			em_boundInsert(em, pos);
+			valid_particles++;
+		}
+
+		/* set emission map */
+		clampBoundsInDomain(sds, em->min, em->max, NULL, NULL, 1, dt);
+		em_allocateData(em, sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY);
+
+		for (p = 0; p < valid_particles; p++)
+		{
+			int cell[3];
+			size_t i = 0;
+			size_t index = 0;
+			int badcell = 0;
+
+			/* 1. get corresponding cell */
+			cell[0] = floor(particle_pos[p * 3]) - em->min[0];
+			cell[1] = floor(particle_pos[p * 3 + 1]) - em->min[1];
+			cell[2] = floor(particle_pos[p * 3 + 2]) - em->min[2];
+			/* check if cell is valid (in the domain boundary) */
+			for (i = 0; i < 3; i++) {
+				if ((cell[i] > em->res[i] - 1) || (cell[i] < 0)) {
+					badcell = 1;
+					break;
+				}
+			}
+			if (badcell)
+				continue;
+			/* get cell index */
+			index = smoke_get_index(cell[0], em->res[0], cell[1], em->res[1], cell[2]);
+			/* Add influence to emission map */
+			em->influence[index] = 1.0f;
+			/* Uses particle velocity as initial velocity for smoke */
+			if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
+			{
+				VECADDFAC(&em->velocity[index * 3], &em->velocity[index * 3], &particle_vel[p * 3], sfs->vel_multi);
+			}
+		}   // particles loop
+
+		/* free data */
+		if (particle_pos)
+			MEM_freeN(particle_pos);
+		if (particle_vel)
+			MEM_freeN(particle_vel);
+	}
+}
+
+static void get_texture_value(Tex *texture, float tex_co[3], TexResult *texres)
+{
+	int result_type;
+
+	/* no node textures for now */
+	result_type = multitex_ext_safe(texture, tex_co, texres);
+
+	/* if the texture gave an RGB value, we assume it didn't give a valid
+	 * intensity, since this is in the context of modifiers don't use perceptual color conversion.
+	 * if the texture didn't give an RGB value, copy the intensity across
+	 */
+	if (result_type & TEX_RGB) {
+		texres->tin = (1.0f / 3.0f) * (texres->tr + texres->tg + texres->tb);
+	}
+	else {
+		copy_v3_fl(&texres->tr, texres->tin);
+	}
+}
+
+static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowSettings *sfs, EmissionMap *em, float dt)
+{
+	if (!sfs->dm) return;
+	{
+		DerivedMesh *dm = sfs->dm;
+		int defgrp_index = sfs->vgroup_density - 1;
+		MDeformVert *dvert = NULL;
+		MVert *mvert = NULL;
+		MVert *mvert_orig = NULL;
+		MFace *mface = NULL;
+		MTFace *tface = NULL;
+		BVHTreeFromMesh treeData = {0};
+		int numOfVerts, i, z;
+		float flow_center[3] = {0};
+
+		float *vert_vel = NULL;
+		int has_velocity = 0;
+
+		CDDM_calc_normals(dm);
+		mvert = dm->getVertArray(dm);
+		mvert_orig = dm->dupVertArray(dm);  /* copy original mvert and restore when done */
+		mface = dm->getTessFaceArray(dm);
+		numOfVerts = dm->getNumVerts(dm);
+		dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+		tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, sfs->uvlayer_name);
+
+		if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
+			vert_vel = MEM_callocN(sizeof(float) * numOfVerts * 3, "smoke_flow_velocity");
+
+			if (sfs->numverts != numOfVerts || !sfs->verts_old) {
+				if (sfs->verts_old) MEM_freeN(sfs->verts_old);
+				sfs->verts_old = MEM_callocN(sizeof(float) * numOfVerts * 3, "smoke_flow_verts_old");
+				sfs->numverts = numOfVerts;
+			}
+			else {
+				has_velocity = 1;
+			}
 		}
 
-		if(obstacles[z] & 8) // Do not delete static obstacles
-		{
-			obstacles[z] = 0;
+		/*	Transform dm vertices to
+		 *   domain grid space for fast lookups */
+		for (i = 0; i < numOfVerts; i++) {
+			float n[3];
+			/* vert pos */
+			mul_m4_v3(flow_ob->obmat, mvert[i].co);
+			smoke_pos_to_cell(sds, mvert[i].co);
+			/* vert normal */
+			normal_short_to_float_v3(n, mvert[i].no);
+			mul_mat3_m4_v3(flow_ob->obmat, n);
+			mul_mat3_m4_v3(sds->imat, n);
+			normalize_v3(n);
+			normal_float_to_short_v3(mvert[i].no, n);
+			/* vert velocity */
+			if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
+				float co[3];
+				VECADD(co, mvert[i].co, sds->shift);
+				if (has_velocity) {
+					sub_v3_v3v3(&vert_vel[i * 3], co, &sfs->verts_old[i * 3]);
+					mul_v3_fl(&vert_vel[i * 3], sds->dx / dt);
+				}
+				copy_v3_v3(&sfs->verts_old[i * 3], co);
+			}
+
+			/* calculate emission map bounds */
+			em_boundInsert(em, mvert[i].co);
 		}
+		mul_m4_v3(flow_ob->obmat, flow_center);
+		smoke_pos_to_cell(sds, flow_center);
+
+		/* set emission map */
+		clampBoundsInDomain(sds, em->min, em->max, NULL, NULL, sfs->surface_distance, dt);
+		em_allocateData(em, sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY);
+
+		if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6)) {
+			#pragma omp parallel for schedule(static)
+			for (z = em->min[2]; z < em->max[2]; z++) {
+				int x, y;
+				for (x = em->min[0]; x < em->max[0]; x++)
+					for (y = em->min[1]; y < em->max[1]; y++) {
+						int index = smoke_get_index(x - em->min[0], em->res[0], y - em->min[1], em->res[1], z - em->min[2]);
+
+						float ray_start[3] = {(float)x + 0.5f, (float)y + 0.5f, (float)z + 0.5f};
+						float ray_dir[3] = {1.0f, 0.0f, 0.0f};
+
+						BVHTreeRayHit hit = {0};
+						BVHTreeNearest nearest = {0};
+
+						float volume_factor = 0.0f;
+						float sample_str = 0.0f;
+
+						hit.index = -1;
+						hit.dist = 9999;
+						nearest.index = -1;
+						nearest.dist = sfs->surface_distance * sfs->surface_distance; /* find_nearest uses squared distance */
+
+						/* Check volume collision */
+						if (sfs->volume_density) {
+							if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) {
+								float dot = ray_dir[0] * hit.no[0] + ray_dir[1] * hit.no[1] + ray_dir[2] * hit.no[2];
+								/*  If ray and hit face normal are facing same direction
+								 *	hit point is inside a closed mesh. */
+								if (dot >= 0) {
+									/* Also cast a ray in opposite direction to make sure
+									 * point is at least surrounded by two faces */
+									negate_v3(ray_dir);
+									hit.index = -1;
+									hit.dist = 9999;
+
+									BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, treeData.raycast_callback, &treeData);
+									if (hit.index != -1) {
+										volume_factor = sfs->volume_density;
+										nearest.dist = hit.dist * hit.dist;
+									}
+								}
+							}
+						}
 
-		velx[z] = 0;
-		vely[z] = 0;
-		velz[z] = 0;
+						/* find the nearest point on the mesh */
+						if (BLI_bvhtree_find_nearest(treeData.tree, ray_start, &nearest, treeData.nearest_callback, &treeData) != -1) {
+							float weights[4];
+							int v1, v2, v3, f_index = nearest.index;
+							float n1[3], n2[3], n3[3], hit_normal[3];
+
+							/* emit from surface based on distance */
+							if (sfs->surface_distance) {
+								sample_str = sqrtf(nearest.dist) / sfs->surface_distance;
+								CLAMP(sample_str, 0.0f, 1.0f);
+								sample_str = pow(1.0f - sample_str, 0.5f);
+							}
+							else
+								sample_str = 0.0f;
+
+							/* calculate barycentric weights for nearest point */
+							v1 = mface[f_index].v1;
+							v2 = (nearest.flags & BVH_ONQUAD) ? mface[f_index].v3 : mface[f_index].v2;
+							v3 = (nearest.flags & BVH_ONQUAD) ? mface[f_index].v4 : mface[f_index].v3;
+							interp_weights_face_v3(weights, mvert[v1].co, mvert[v2].co, mvert[v3].co, NULL, nearest.co);
+
+							if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
+								/* apply normal directional velocity */
+								if (sfs->vel_normal) {
+									/* interpolate vertex normal vectors to get nearest point normal */
+									normal_short_to_float_v3(n1, mvert[v1].no);
+									normal_short_to_float_v3(n2, mvert[v2].no);
+									normal_short_to_float_v3(n3, mvert[v3].no);
+									interp_v3_v3v3v3(hit_normal, n1, n2, n3, weights);
+									normalize_v3(hit_normal);
+									/* apply normal directional and random velocity
+									 * - TODO: random disabled for now since it doesnt really work well as pressure calc smoothens it out... */
+									em->velocity[index * 3]   += hit_normal[0] * sfs->vel_normal * 0.25f;
+									em->velocity[index * 3 + 1] += hit_normal[1] * sfs->vel_normal * 0.25f;
+									em->velocity[index * 3 + 2] += hit_normal[2] * sfs->vel_normal * 0.25f;
+									/* TODO: for fire emitted from mesh surface we can use
+									 *  Vf = Vs + (Ps/Pf - 1)*S to model gaseous expansion from solid to fuel */
+								}
+								/* apply object velocity */
+								if (has_velocity && sfs->vel_multi) {
+									float hit_vel[3];
+									interp_v3_v3v3v3(hit_vel, &vert_vel[v1 * 3], &vert_vel[v2 * 3], &vert_vel[v3 * 3], weights);
+									em->velocity[index * 3]   += hit_vel[0] * sfs->vel_multi;
+									em->velocity[index * 3 + 1] += hit_vel[1] * sfs->vel_multi;
+									em->velocity[index * 3 + 2] += hit_vel[2] * sfs->vel_multi;
+								}
+							}
+
+							/* apply vertex group influence if used */
+							if (defgrp_index != -1 && dvert) {
+								float weight_mask = defvert_find_weight(&dvert[v1], defgrp_index) * weights[0] +
+								                    defvert_find_weight(&dvert[v2], defgrp_index) * weights[1] +
+								                    defvert_find_weight(&dvert[v3], defgrp_index) * weights[2];
+								sample_str *= weight_mask;
+							}
+
+							/* apply emission texture */
+							if ((sfs->flags & MOD_SMOKE_FLOW_TEXTUREEMIT) && sfs->noise_texture) {
+								float tex_co[3] = {0};
+								TexResult texres;
+
+								if (sfs->texture_type == MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO) {
+									tex_co[0] = ((float)(x - flow_center[0]) / sds->base_res[0]) / sfs->texture_size;
+									tex_co[1] = ((float)(y - flow_center[1]) / sds->base_res[1]) / sfs->texture_size;
+									tex_co[2] = ((float)(z - flow_center[2]) / sds->base_res[2] - sfs->texture_offset) / sfs->texture_size;
+								}
+								else if (tface) {
+									interp_v2_v2v2v2(tex_co, tface[f_index].uv[0], tface[f_index].uv[(nearest.flags & BVH_ONQUAD) ? 2 : 1],
+									                 tface[f_index].uv[(nearest.flags & BVH_ONQUAD) ? 3 : 2], weights);
+									/* map between -1.0f and 1.0f */
+									tex_co[0] = tex_co[0] * 2.0f - 1.0f;
+									tex_co[1] = tex_co[1] * 2.0f - 1.0f;
+									tex_co[2] = sfs->texture_offset;
+								}
+								texres.nor = NULL;
+								get_texture_value(sfs->noise_texture, tex_co, &texres);
+								sample_str *= texres.tin;
+							}
+						}
+
+						/* multiply initial velocity by emitter influence */
+						if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
+							mul_v3_fl(&em->velocity[index * 3], sample_str);
+						}
+
+						/* apply final influence based on volume factor */
+						em->influence[index] = MAX2(volume_factor, sample_str);
+					}
+			}
+		}
+		/* free bvh tree */
+		free_bvhtree_from_mesh(&treeData);
+		/* restore original mverts */
+		CustomData_set_layer(&dm->vertData, CD_MVERT, mvert_orig);
+		if (mvert)
+			MEM_freeN(mvert);
+
+		if (vert_vel) MEM_freeN(vert_vel);
 	}
+}
 
-	collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj, eModifierType_Smoke);
+static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], EmissionMap *emaps, unsigned int numflowobj, float dt)
+{
+	int min[3] = {32767, 32767, 32767}, max[3] = {-32767, -32767, -32767}, res[3];
+	int total_cells = 1, res_changed = 0, shift_changed = 0;
+	float min_vel[3], max_vel[3];
+	int x, y, z, i;
+	float *density = smoke_get_density(sds->fluid);
+	float *fuel = smoke_get_fuel(sds->fluid);
+	float *vx = smoke_get_velocity_x(sds->fluid);
+	float *vy = smoke_get_velocity_y(sds->fluid);
+	float *vz = smoke_get_velocity_z(sds->fluid);
+
+	INIT_MINMAX(min_vel, max_vel);
+
+	/* Calculate bounds for current domain content */
+	for (x = sds->res_min[0]; x <  sds->res_max[0]; x++)
+		for (y =  sds->res_min[1]; y <  sds->res_max[1]; y++)
+			for (z =  sds->res_min[2]; z <  sds->res_max[2]; z++)
+			{
+				int xn = x - new_shift[0];
+				int yn = y - new_shift[1];
+				int zn = z - new_shift[2];
+				int index = smoke_get_index(x - sds->res_min[0], sds->res[0], y - sds->res_min[1], sds->res[1], z - sds->res_min[2]);
+				float max_den = (fuel) ? MAX2(density[index], fuel[index]) : density[index];
+
+				/* content bounds (use shifted coordinates) */
+				if (max_den >= sds->adapt_threshold) {
+					if (min[0] > xn) min[0] = xn;
+					if (min[1] > yn) min[1] = yn;
+					if (min[2] > zn) min[2] = zn;
+					if (max[0] < xn) max[0] = xn;
+					if (max[1] < yn) max[1] = yn;
+					if (max[2] < zn) max[2] = zn;
+				}
+				/* velocity bounds */
+				if (min_vel[0] > vx[index]) min_vel[0] = vx[index];
+				if (min_vel[1] > vy[index]) min_vel[1] = vy[index];
+				if (min_vel[2] > vz[index]) min_vel[2] = vz[index];
+				if (max_vel[0] < vx[index]) max_vel[0] = vx[index];
+				if (max_vel[1] < vy[index]) max_vel[1] = vy[index];
+				if (max_vel[2] < vz[index]) max_vel[2] = vz[index];
+			}
 
-	// update obstacle tags in cells
-	for(collIndex = 0; collIndex < numcollobj; collIndex++)
+	/* also apply emission maps */
+	for (i = 0; i < numflowobj; i++)
 	{
-		Object *collob= collobjs[collIndex];
-		SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
+		EmissionMap *em = &emaps[i];
 
-		// DG TODO: check if modifier is active?
-		
-		if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points && smd2->coll->points_old)
-		{
-			SmokeCollSettings *scs = smd2->coll;
-			unsigned int i;
+		for (x = em->min[0]; x < em->max[0]; x++)
+			for (y = em->min[1]; y < em->max[1]; y++)
+				for (z = em->min[2]; z < em->max[2]; z++)
+				{
+					int index = smoke_get_index(x - em->min[0], em->res[0], y - em->min[1], em->res[1], z - em->min[2]);
+					float max_den = em->influence[index];
+
+					/* density bounds */
+					if (max_den >= sds->adapt_threshold) {
+						if (min[0] > x) min[0] = x;
+						if (min[1] > y) min[1] = y;
+						if (min[2] > z) min[2] = z;
+						if (max[0] < x) max[0] = x;
+						if (max[1] < y) max[1] = y;
+						if (max[2] < z) max[2] = z;
+					}
+					/* velocity bounds */
+					if (em->velocity) {
+						if (min_vel[0] > em->velocity[index * 3]) min_vel[0] = em->velocity[index * 3];
+						if (min_vel[1] > em->velocity[index * 3 + 1]) min_vel[1] = em->velocity[index * 3 + 1];
+						if (min_vel[2] > em->velocity[index * 3 + 2]) min_vel[2] = em->velocity[index * 3 + 2];
+						if (max_vel[0] < em->velocity[index * 3]) max_vel[0] = em->velocity[index * 3];
+						if (max_vel[1] < em->velocity[index * 3 + 1]) max_vel[1] = em->velocity[index * 3 + 1];
+						if (max_vel[2] < em->velocity[index * 3 + 2]) max_vel[2] = em->velocity[index * 3 + 2];
+					}
+				}
+	}
 
-			/*
-			// DG TODO: support static cobstacles, but basicly we could even support static + rigid with one set of code
-			if(scs->type > SM_COLL_STATIC)
-			*/
+	/* calculate new bounds based on these values */
+	clampBoundsInDomain(sds, min, max, min_vel, max_vel, sds->adapt_margin + 1, dt);
 
-			/* Handle collisions */
-			for(i = 0; i < scs->numpoints; i++)
-			{
-				// 1. get corresponding cell
-				int cell[3];
-				float pos[3], oldpos[3], vel[3];
-				float cPos[3], cOldpos[3]; /* current position in substeps */
-				int badcell = 0;
-				size_t index;
-				int j;
-
-				// translate local points into global positions
-				copy_v3_v3(cPos, &scs->points[3 * i]);
-				mul_m4_v3(scs->mat, cPos);
-				copy_v3_v3(pos, cPos);
-
-				copy_v3_v3(cOldpos, &scs->points_old[3 * i]);
-				mul_m4_v3(scs->mat_old, cOldpos);
-				copy_v3_v3(oldpos, cOldpos);
-
-				/* support for rigid bodies, armatures etc */
-				{
-					float tmp[3];
+	for (i = 0; i < 3; i++) {
+		/* calculate new resolution */
+		res[i] = max[i] - min[i];
+		total_cells *= res[i];
 
-					/* x_current = x_old + (x_new - x_old) * step_current / steps_total */
-					float mulStep = (float)(((float)substep) / ((float)totalsteps));
+		if (new_shift[i])
+			shift_changed = 1;
 
-					sub_v3_v3v3(tmp, cPos, cOldpos);
-					mul_v3_fl(tmp, mulStep);
-					add_v3_v3(cOldpos, tmp);
-				}
+		/* if no content set minimum dimensions */
+		if (res[i] <= 0) {
+			int j;
+			for (j = 0; j < 3; j++) {
+				min[j] = 0;
+				max[j] = 1;
+				res[j] = 1;
+			}
+			res_changed = 1;
+			total_cells = 1;
+			break;
+		}
+		if (min[i] != sds->res_min[i] || max[i] != sds->res_max[i])
+			res_changed = 1;
+	}
 
-				sub_v3_v3v3(vel, pos, oldpos);
-				/* Scale velocity to incorperate the object movement during this step */
-				mul_v3_fl(vel, 1.0 / (totalsteps * dt * sds->scale));
-				// mul_v3_fl(vel, 1.0 / dt);
+	if (res_changed || shift_changed) {
+		struct FLUID_3D *fluid_old = sds->fluid;
+		struct WTURBULENCE *turb_old = sds->wt;
+		/* allocate new fluid data */
+		smoke_reallocate_fluid(sds, sds->dx, res, 0);
+		if (sds->flags & MOD_SMOKE_HIGHRES) {
+			smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
+		}
 
-				// DG TODO: cap velocity to maxVelMag (or maxvel)
+		/* copy values from old fluid to new */
+		if (sds->total_cells > 1 && total_cells > 1) {
+			/* low res smoke */
+			float *o_dens, *o_react, *o_flame, *o_fuel, *o_heat, *o_heatold, *o_vx, *o_vy, *o_vz, *o_r, *o_g, *o_b;
+			float *n_dens, *n_react, *n_flame, *n_fuel, *n_heat, *n_heatold, *n_vx, *n_vy, *n_vz, *n_r, *n_g, *n_b;
+			float dummy;
+			unsigned char *dummy_p;
+			/* high res smoke */
+			int wt_res_old[3];
+			float *o_wt_dens, *o_wt_react, *o_wt_flame, *o_wt_fuel, *o_wt_tcu, *o_wt_tcv, *o_wt_tcw, *o_wt_r, *o_wt_g, *o_wt_b;
+			float *n_wt_dens, *n_wt_react, *n_wt_flame, *n_wt_fuel, *n_wt_tcu, *n_wt_tcv, *n_wt_tcw, *n_wt_r, *n_wt_g, *n_wt_b;
+
+			smoke_export(fluid_old, &dummy, &dummy, &o_dens, &o_react, &o_flame, &o_fuel, &o_heat, &o_heatold, &o_vx, &o_vy, &o_vz, &o_r, &o_g, &o_b, &dummy_p);
+			smoke_export(sds->fluid, &dummy, &dummy, &n_dens, &n_react, &n_flame, &n_fuel, &n_heat, &n_heatold, &n_vx, &n_vy, &n_vz, &n_r, &n_g, &n_b, &dummy_p);
+
+			if (sds->flags & MOD_SMOKE_HIGHRES) {
+				smoke_turbulence_export(turb_old, &o_wt_dens, &o_wt_react, &o_wt_flame, &o_wt_fuel, &o_wt_r, &o_wt_g, &o_wt_b, &o_wt_tcu, &o_wt_tcv, &o_wt_tcw);
+				smoke_turbulence_get_res(turb_old, wt_res_old);
+				smoke_turbulence_export(sds->wt, &n_wt_dens, &n_wt_react, &n_wt_flame, &n_wt_fuel, &n_wt_r, &n_wt_g, &n_wt_b, &n_wt_tcu, &n_wt_tcv, &n_wt_tcw);
+			}
 
-				// oldpos + velocity * dt = newpos
-				get_cell(sds->p0, sds->res, sds->dx*sds->scale, cOldpos /* use current position here instead of "pos" */, cell, 0);
 
-				// check if cell is valid (in the domain boundary)
-				for(j = 0; j < 3; j++)
-					if((cell[j] > sds->res[j] - 1) || (cell[j] < 0))
+			for (x = sds->res_min[0]; x < sds->res_max[0]; x++)
+				for (y = sds->res_min[1]; y < sds->res_max[1]; y++)
+					for (z = sds->res_min[2]; z < sds->res_max[2]; z++)
 					{
-						badcell = 1;
-						break;
-					}
-														
-				if(badcell)
-					continue;
+						/* old grid index */
+						int xo = x - sds->res_min[0];
+						int yo = y - sds->res_min[1];
+						int zo = z - sds->res_min[2];
+						int index_old = smoke_get_index(xo, sds->res[0], yo, sds->res[1], zo);
+						/* new grid index */
+						int xn = x - min[0] - new_shift[0];
+						int yn = y - min[1] - new_shift[1];
+						int zn = z - min[2] - new_shift[2];
+						int index_new = smoke_get_index(xn, res[0], yn, res[1], zn);
+
+						/* skip if outside new domain */
+						if (xn < 0 || xn >= res[0] ||
+						    yn < 0 || yn >= res[1] ||
+						    zn < 0 || zn >= res[2])
+							continue;
 
-				// 2. set cell values (heat, density and velocity)
-				index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
+						/* copy data */
+						n_dens[index_new] = o_dens[index_old];
+						/* heat */
+						if (n_heat && o_heat) {
+							n_heat[index_new] = o_heat[index_old];
+							n_heatold[index_new] = o_heatold[index_old];
+						}
+						/* fuel */
+						if (n_fuel && o_fuel) {
+							n_flame[index_new] = o_flame[index_old];
+							n_fuel[index_new] = o_fuel[index_old];
+							n_react[index_new] = o_react[index_old];
+						}
+						/* color */
+						if (o_r && n_r) {
+							n_r[index_new] = o_r[index_old];
+							n_g[index_new] = o_g[index_old];
+							n_b[index_new] = o_b[index_old];
+						}
+						n_vx[index_new] = o_vx[index_old];
+						n_vy[index_new] = o_vy[index_old];
+						n_vz[index_new] = o_vz[index_old];
 
-				// Don't overwrite existing obstacles
-				if(obstacles[index])
-					continue;
-												
-				// printf("cell[0]: %d, cell[1]: %d, cell[2]: %d\n", cell[0], cell[1], cell[2]);								
-				// printf("res[0]: %d, res[1]: %d, res[2]: %d, index: %d\n\n", sds->res[0], sds->res[1], sds->res[2], index);																	
-				obstacles[index] = 1 | 8 /* ANIMATED */;
+						if (sds->flags & MOD_SMOKE_HIGHRES && turb_old) {
+							int block_size = sds->amplify + 1;
+							int i, j, k;
+							/* old grid index */
+							int xx_o = xo * block_size;
+							int yy_o = yo * block_size;
+							int zz_o = zo * block_size;
+							/* new grid index */
+							int xx_n = xn * block_size;
+							int yy_n = yn * block_size;
+							int zz_n = zn * block_size;
+
+							n_wt_tcu[index_new] = o_wt_tcu[index_old];
+							n_wt_tcv[index_new] = o_wt_tcv[index_old];
+							n_wt_tcw[index_new] = o_wt_tcw[index_old];
+
+							for (i = 0; i < block_size; i++)
+								for (j = 0; j < block_size; j++)
+									for (k = 0; k < block_size; k++)
+									{
+										int big_index_old = smoke_get_index(xx_o + i, wt_res_old[0], yy_o + j, wt_res_old[1], zz_o + k);
+										int big_index_new = smoke_get_index(xx_n + i, sds->res_wt[0], yy_n + j, sds->res_wt[1], zz_n + k);
+										/* copy data */
+										n_wt_dens[big_index_new] = o_wt_dens[big_index_old];
+										if (n_wt_flame && o_wt_flame) {
+											n_wt_flame[big_index_new] = o_wt_flame[big_index_old];
+											n_wt_fuel[big_index_new] = o_wt_fuel[big_index_old];
+											n_wt_react[big_index_new] = o_wt_react[big_index_old];
+										}
+										if (n_wt_r && o_wt_r) {
+											n_wt_r[big_index_new] = o_wt_r[big_index_old];
+											n_wt_g[big_index_new] = o_wt_g[big_index_old];
+											n_wt_b[big_index_new] = o_wt_b[big_index_old];
+										}
+									}
+						}
+					}
+		}
+		smoke_free(fluid_old);
+		if (turb_old)
+			smoke_turbulence_free(turb_old);
+
+		/* set new domain dimensions */
+		VECCOPY(sds->res_min, min);
+		VECCOPY(sds->res_max, max);
+		VECCOPY(sds->res, res);
+		sds->total_cells = total_cells;
+	}
+}
 
-				if(len_v3(vel) > FLT_EPSILON)
-				{
-					// Collision object is moving
+BLI_INLINE void apply_outflow_fields(int index, float *density, float *heat, float *fuel, float *react, float *color_r, float *color_g, float *color_b)
+{
+	density[index] = 0.f;
+	if (heat) {
+		heat[index] = 0.f;
+	}
+	if (fuel) {
+		fuel[index] = 0.f;
+		react[index] = 0.f;
+	}
+	if (color_r) {
+		color_r[index] = 0.f;
+		color_g[index] = 0.f;
+		color_b[index] = 0.f;
+	}
+}
 
-					velx[index] = vel[0]; // use "+="?
-					vely[index] = vel[1];
-					velz[index] = vel[2];
-				}
-			}
+BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value, int index, float *density, float *heat, float *fuel, float *react, float *color_r, float *color_g, float *color_b)
+{
+	int absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
+	float dens_old = density[index];
+	// float fuel_old = (fuel) ? fuel[index] : 0.0f;  /* UNUSED */
+	float dens_flow = (sfs->type == MOD_SMOKE_FLOW_TYPE_FIRE) ? 0.0f : emission_value * sfs->density;
+	float fuel_flow = emission_value * sfs->fuel_amount;
+	/* add heat */
+	if (heat) {
+		heat[index] = MAX2(emission_value * sfs->temp, heat[index]);
+	}
+	/* absolute */
+	if (absolute_flow) {
+		if (sfs->type != MOD_SMOKE_FLOW_TYPE_FIRE) {
+			if (dens_flow > density[index])
+				density[index] = dens_flow;
+		}
+		if (sfs->type != MOD_SMOKE_FLOW_TYPE_SMOKE && fuel && fuel_flow) {
+			if (fuel_flow > fuel[index])
+				fuel[index] = fuel_flow;
+		}
+	}
+	/* additive */
+	else {
+		if (sfs->type != MOD_SMOKE_FLOW_TYPE_FIRE) {
+			density[index] += dens_flow;
+			CLAMP(density[index], 0.0f, 1.0f);
+		}
+		if (sfs->type != MOD_SMOKE_FLOW_TYPE_SMOKE && fuel && sfs->fuel_amount) {
+			fuel[index] += fuel_flow;
+			CLAMP(fuel[index], 0.0f, 10.0f);
 		}
 	}
 
-	if(collobjs)
-		MEM_freeN(collobjs);
+	/* set color */
+	if (color_r && dens_flow) {
+		float total_dens = density[index] / (dens_old + dens_flow);
+		color_r[index] = (color_r[index] + sfs->color[0] * dens_flow) * total_dens;
+		color_g[index] = (color_g[index] + sfs->color[1] * dens_flow) * total_dens;
+		color_b[index] = (color_b[index] + sfs->color[2] * dens_flow) * total_dens;
+	}
+
+	/* set fire reaction coordinate */
+	if (fuel && fuel[index]) {
+		/* instead of using 1.0 for all new fuel add slight falloff
+		 * to reduce flow blockiness */
+		float value = 1.0f - powf(1.0f - emission_value, 2.0f);
+
+		if (value > react[index]) {
+			float f = fuel_flow / fuel[index];
+			react[index] = value * f + (1.0f - f) * react[index];
+		}
+	}
 }
 
-static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sds, float time)
+static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sds, float time, float dt)
 {
 	Object **flowobjs = NULL;
+	EmissionMap *emaps = NULL;
 	unsigned int numflowobj = 0;
 	unsigned int flowIndex;
+	int new_shift[3] = {0};
+	int active_fields = sds->active_fields;
+
+	/* calculate domain shift for current frame if using adaptive domain */
+	if (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) {
+		int total_shift[3];
+		float frame_shift_f[3];
+		float ob_loc[3] = {0};
+
+		mul_m4_v3(ob->obmat, ob_loc);
+
+		VECSUB(frame_shift_f, ob_loc, sds->prev_loc);
+		copy_v3_v3(sds->prev_loc, ob_loc);
+		/* convert global space shift to local "cell" space */
+		mul_mat3_m4_v3(sds->imat, frame_shift_f);
+		frame_shift_f[0] = frame_shift_f[0] / sds->cell_size[0];
+		frame_shift_f[1] = frame_shift_f[1] / sds->cell_size[1];
+		frame_shift_f[2] = frame_shift_f[2] / sds->cell_size[2];
+		/* add to total shift */
+		VECADD(sds->shift_f, sds->shift_f, frame_shift_f);
+		/* convert to integer */
+		total_shift[0] = floor(sds->shift_f[0]);
+		total_shift[1] = floor(sds->shift_f[1]);
+		total_shift[2] = floor(sds->shift_f[2]);
+		VECSUB(new_shift, total_shift, sds->shift);
+		copy_v3_v3_int(sds->shift, total_shift);
+
+		/* calculate new domain boundary points so that smoke doesnt slide on sub-cell movement */
+		sds->p0[0] = sds->dp0[0] - sds->cell_size[0] * (sds->shift_f[0] - total_shift[0] - 0.5f);
+		sds->p0[1] = sds->dp0[1] - sds->cell_size[1] * (sds->shift_f[1] - total_shift[1] - 0.5f);
+		sds->p0[2] = sds->dp0[2] - sds->cell_size[2] * (sds->shift_f[2] - total_shift[2] - 0.5f);
+		sds->p1[0] = sds->p0[0] + sds->cell_size[0] * sds->base_res[0];
+		sds->p1[1] = sds->p0[1] + sds->cell_size[1] * sds->base_res[1];
+		sds->p1[2] = sds->p0[2] + sds->cell_size[2] * sds->base_res[2];
+	}
 
 	flowobjs = get_collisionobjects(scene, ob, sds->fluid_group, &numflowobj, eModifierType_Smoke);
 
-	// update obstacle tags in cells
-	for(flowIndex = 0; flowIndex < numflowobj; flowIndex++)
+	/* init emission maps for each flow */
+	emaps = MEM_callocN(sizeof(struct EmissionMap) * numflowobj, "smoke_flow_maps");
+
+	/* Prepare flow emission maps */
+	for (flowIndex = 0; flowIndex < numflowobj; flowIndex++)
 	{
-		Object *collob= flowobjs[flowIndex];
-		SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
+		Object *collob = flowobjs[flowIndex];
+		SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(collob, eModifierType_Smoke);
 
 		// check for initialized smoke object
-		if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)						
+		if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
 		{
 			// we got nice flow object
 			SmokeFlowSettings *sfs = smd2->flow;
+			EmissionMap *em = &emaps[flowIndex];
 
-			if(sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
-			{
-				ParticleSimulationData sim;
-				ParticleSystem *psys = sfs->psys;
-				int totpart=psys->totpart, totchild;
-				int p = 0;								
-				float *density = smoke_get_density(sds->fluid);								
-				float *bigdensity = smoke_turbulence_get_density(sds->wt);								
-				float *heat = smoke_get_heat(sds->fluid);								
-				float *velocity_x = smoke_get_velocity_x(sds->fluid);								
-				float *velocity_y = smoke_get_velocity_y(sds->fluid);								
-				float *velocity_z = smoke_get_velocity_z(sds->fluid);								
-				unsigned char *obstacle = smoke_get_obstacle(sds->fluid);							
-				// DG TODO UNUSED unsigned char *obstacleAnim = smoke_get_obstacle_anim(sds->fluid);
-				int bigres[3];
-				short absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
-				short high_emission_smoothing = bigdensity ? (sds->flags & MOD_SMOKE_HIGH_SMOOTH) : 0;
-
-				/*
-				* A temporary volume map used to store whole emissive
-				* area to be added to smoke density and interpolated
-				* for high resolution smoke.
-				*/
-				float *temp_emission_map = NULL;
-
-				sim.scene = scene;
-				sim.ob = collob;
-				sim.psys = psys;
-
-				// initialize temp emission map
-				if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
-				{
-					int i;
-					temp_emission_map = MEM_callocN(sizeof(float) * sds->res[0]*sds->res[1]*sds->res[2], "SmokeTempEmission");
-					// set whole volume to 0.0f
-					for (i=0; i<sds->res[0]*sds->res[1]*sds->res[2]; i++) {
-						temp_emission_map[i] = 0.0f;
-					}
-				}
+			if (sfs->source == MOD_SMOKE_FLOW_SOURCE_PARTICLES) {
+				emit_from_particles(collob, sds, sfs, em, scene, time, dt);
+			}
+			else {
+				emit_from_derivedmesh(collob, sds, sfs, em, dt);
+			}
 
-				// mostly copied from particle code								
-				if(psys->part->type==PART_HAIR)
-				{
-					/*
-					if(psys->childcache)
-					{
-					totchild = psys->totchildcache;
+			/* update required data fields */
+			if (em->total_cells && sfs->type != MOD_SMOKE_FLOW_TYPE_OUTFLOW) {
+				/* activate heat field if flow produces any heat */
+				if (sfs->temp) {
+					active_fields |= SM_ACTIVE_HEAT;
+				}
+				/* activate fuel field if flow adds any fuel */
+				if (sfs->type != MOD_SMOKE_FLOW_TYPE_SMOKE && sfs->fuel_amount) {
+					active_fields |= SM_ACTIVE_FIRE;
+				}
+				/* activate color field if flows add smoke with varying colors */
+				if (sfs->type != MOD_SMOKE_FLOW_TYPE_FIRE && sfs->density) {
+					if (!(active_fields & SM_ACTIVE_COLOR_SET)) {
+						copy_v3_v3(sds->active_color, sfs->color);
+						active_fields |= SM_ACTIVE_COLOR_SET;
+					}
+					else if (!equals_v3v3(sds->active_color, sfs->color)) {
+						active_fields |= SM_ACTIVE_COLORS;
 					}
-					else
-					*/
-
-					// TODO: PART_HAIR not supported whatsoever
-					totchild=0;
 				}
-				else
-					totchild=psys->totchild*psys->part->disp/100;
+			}
+		}
+	}
 
-				for(p=0; p<totpart+totchild; p++)								
-				{
-					int cell[3];
-					size_t i = 0;
-					size_t index = 0;
-					int badcell = 0;
-					ParticleKey state;
+	/* monitor active fields based on domain settings */
+	/* if domain has fire, activate new fields if required */
+	if (active_fields & SM_ACTIVE_FIRE) {
+		/* heat is always needed for fire */
+		active_fields |= SM_ACTIVE_HEAT;
+		/* also activate colors if domain smoke color differs from active color */
+		if (!(active_fields & SM_ACTIVE_COLOR_SET)) {
+			copy_v3_v3(sds->active_color, sds->flame_smoke_color);
+			active_fields |= SM_ACTIVE_COLOR_SET;
+		}
+		else if (!equals_v3v3(sds->active_color, sds->flame_smoke_color)) {
+			active_fields |= SM_ACTIVE_COLORS;
+		}
+	}
 
-					if(p < totpart)
-					{
-						if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
-							continue;
-					}
-					else {
-						/* handle child particle */
-						ChildParticle *cpa = &psys->child[p - totpart];
+	/* Adjust domain size if needed */
+	if (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) {
+		adjustDomainResolution(sds, new_shift, emaps, numflowobj, dt);
+	}
 
-						if(psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
-							continue;
-					}
+	/* Initialize new data fields if any */
+	if (active_fields & SM_ACTIVE_HEAT) {
+		smoke_ensure_heat(sds->fluid);
+	}
+	if (active_fields & SM_ACTIVE_FIRE) {
+		smoke_ensure_fire(sds->fluid, sds->wt);
+	}
+	if (active_fields & SM_ACTIVE_COLORS) {
+		/* initialize all smoke with "active_color" */
+		smoke_ensure_colors(sds->fluid, sds->wt, sds->active_color[0], sds->active_color[1], sds->active_color[2]);
+	}
+	sds->active_fields = active_fields;
 
-					state.time = time;
-					if(psys_get_particle_state(&sim, p, &state, 0) == 0)
-						continue;
+	/* Apply emission data */
+	if (sds->fluid) {
+		for (flowIndex = 0; flowIndex < numflowobj; flowIndex++)
+		{
+			Object *collob = flowobjs[flowIndex];
+			SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(collob, eModifierType_Smoke);
 
-					// copy_v3_v3(pos, pa->state.co);
-					// mul_m4_v3(ob->imat, pos);
-					// 1. get corresponding cell
-					get_cell(sds->p0, sds->res, sds->dx*sds->scale, state.co, cell, 0);																	
-					// check if cell is valid (in the domain boundary)									
-					for(i = 0; i < 3; i++)									
-					{										
-						if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))										
-						{											
-							badcell = 1;											
-							break;										
-						}									
-					}																			
-					if(badcell)										
-						continue;																		
-					// 2. set cell values (heat, density and velocity)									
-					index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);																		
-					if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) && !(obstacle[index])) // this is inflow
-					{										
-						// heat[index] += sfs->temp * 0.1;										
-						// density[index] += sfs->density * 0.1;
-						heat[index] = sfs->temp;
-
-						// Add emitter density to temp emission map
-						temp_emission_map[index] = sfs->density;
-
-						// Uses particle velocity as initial velocity for smoke
-						if(sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
-						{
-							velocity_x[index] = state.vel[0]*sfs->vel_multi;
-							velocity_y[index] = state.vel[1]*sfs->vel_multi;
-							velocity_z[index] = state.vel[2]*sfs->vel_multi;
-						}										
-					}									
-					else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow									
-					{										
-						heat[index] = 0.f;										
-						density[index] = 0.f;										
-						velocity_x[index] = 0.f;										
-						velocity_y[index] = 0.f;										
-						velocity_z[index] = 0.f;
-						// we need different handling for the high-res feature
-						if(bigdensity)
-						{
-							// init all surrounding cells according to amplification, too											
-							int i, j, k;
-							smoke_turbulence_get_res(sds->wt, bigres);
-
-							for(i = 0; i < sds->amplify + 1; i++)
-								for(j = 0; j < sds->amplify + 1; j++)
-									for(k = 0; k < sds->amplify + 1; k++)
-									{														
-										index = smoke_get_index((sds->amplify + 1)* cell[0] + i, bigres[0], (sds->amplify + 1)* cell[1] + j, bigres[1], (sds->amplify + 1)* cell[2] + k);														
-										bigdensity[index] = 0.f;													
-									}										
-						}
-					}
-				}	// particles loop
+			// check for initialized smoke object
+			if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+			{
+				// we got nice flow object
+				SmokeFlowSettings *sfs = smd2->flow;
+				EmissionMap *em = &emaps[flowIndex];
+
+				float *density = smoke_get_density(sds->fluid);
+				float *color_r = smoke_get_color_r(sds->fluid);
+				float *color_g = smoke_get_color_g(sds->fluid);
+				float *color_b = smoke_get_color_b(sds->fluid);
+				float *fuel = smoke_get_fuel(sds->fluid);
+				float *react = smoke_get_react(sds->fluid);
+				float *bigdensity = smoke_turbulence_get_density(sds->wt);
+				float *bigfuel = smoke_turbulence_get_fuel(sds->wt);
+				float *bigreact = smoke_turbulence_get_react(sds->wt);
+				float *bigcolor_r = smoke_turbulence_get_color_r(sds->wt);
+				float *bigcolor_g = smoke_turbulence_get_color_g(sds->wt);
+				float *bigcolor_b = smoke_turbulence_get_color_b(sds->wt);
+				float *heat = smoke_get_heat(sds->fluid);
+				float *velocity_x = smoke_get_velocity_x(sds->fluid);
+				float *velocity_y = smoke_get_velocity_y(sds->fluid);
+				float *velocity_z = smoke_get_velocity_z(sds->fluid);
+				//unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
+				// DG TODO UNUSED unsigned char *obstacleAnim = smoke_get_obstacle_anim(sds->fluid);
+				int bigres[3];
+				short high_emission_smoothing = (sds->flags & MOD_SMOKE_HIGH_SMOOTH);
+				float *velocity_map = em->velocity;
+				float *emission_map = em->influence;
 
-				// apply emission values
-				if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) 
-				{
-					// initialize variables
-					int ii, jj, kk, x, y, z, block_size;
-					size_t index, index_big;
+				int ii, jj, kk, gx, gy, gz, ex, ey, ez, dx, dy, dz, block_size;
+				size_t e_index, d_index, index_big;
 
-					smoke_turbulence_get_res(sds->wt, bigres);
-					block_size = sds->amplify + 1;	// high res block size
+				// loop through every emission map cell
+				for (gx = em->min[0]; gx < em->max[0]; gx++)
+					for (gy = em->min[1]; gy < em->max[1]; gy++)
+						for (gz = em->min[2]; gz < em->max[2]; gz++)
+						{
+							/* get emission map index */
+							ex = gx - em->min[0];
+							ey = gy - em->min[1];
+							ez = gz - em->min[2];
+							e_index = smoke_get_index(ex, em->res[0], ey, em->res[1], ez);
+							if (!emission_map[e_index]) continue;
+							/* get domain index */
+							dx = gx - sds->res_min[0];
+							dy = gy - sds->res_min[1];
+							dz = gz - sds->res_min[2];
+							d_index = smoke_get_index(dx, sds->res[0], dy, sds->res[1], dz);
+
+							if (sfs->type == MOD_SMOKE_FLOW_TYPE_OUTFLOW) { // outflow
+								apply_outflow_fields(d_index, density, heat, fuel, react, color_r, color_g, color_b);
+							}
+							else { // inflow
+								apply_inflow_fields(sfs, emission_map[e_index], d_index, density, heat, fuel, react, color_r, color_g, color_b);
+
+								/* initial velocity */
+								if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
+									velocity_x[d_index] = ADD_IF_LOWER(velocity_x[d_index], velocity_map[e_index * 3]);
+									velocity_y[d_index] = ADD_IF_LOWER(velocity_y[d_index], velocity_map[e_index * 3 + 1]);
+									velocity_z[d_index] = ADD_IF_LOWER(velocity_z[d_index], velocity_map[e_index * 3 + 2]);
+								}
+							}
 
-					// loop through every low res cell
-					for(x = 0; x < sds->res[0]; x++)
-						for(y = 0; y < sds->res[1]; y++)
-							for(z = 0; z < sds->res[2]; z++)													
-							{
+							/* loop through high res blocks if high res enabled */
+							if (bigdensity) {
 								// neighbor cell emission densities (for high resolution smoke smooth interpolation)
 								float c000, c001, c010, c011,  c100, c101, c110, c111;
 
-								c000 = (x>0 && y>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z-1)] : 0;
-								c001 = (x>0 && y>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z)] : 0;
-								c010 = (x>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z-1)] : 0;
-								c011 = (x>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z)] : 0;
+								smoke_turbulence_get_res(sds->wt, bigres);
+								block_size = sds->amplify + 1;  // high res block size
 
-								c100 = (y>0 && z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z-1)] : 0;
-								c101 = (y>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z)] : 0;
-								c110 = (z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z-1)] : 0;
-								c111 = temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z)]; // this cell
+								c000 = (ex > 0 && ey > 0 && ez > 0) ? emission_map[smoke_get_index(ex - 1, em->res[0], ey - 1, em->res[1], ez - 1)] : 0;
+								c001 = (ex > 0 && ey > 0) ? emission_map[smoke_get_index(ex - 1, em->res[0], ey - 1, em->res[1], ez)] : 0;
+								c010 = (ex > 0 && ez > 0) ? emission_map[smoke_get_index(ex - 1, em->res[0], ey, em->res[1], ez - 1)] : 0;
+								c011 = (ex > 0) ? emission_map[smoke_get_index(ex - 1, em->res[0], ey, em->res[1], ez)] : 0;
 
-								// get cell index
-								index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+								c100 = (ey > 0 && ez > 0) ? emission_map[smoke_get_index(ex, em->res[0], ey - 1, em->res[1], ez - 1)] : 0;
+								c101 = (ey > 0) ? emission_map[smoke_get_index(ex, em->res[0], ey - 1, em->res[1], ez)] : 0;
+								c110 = (ez > 0) ? emission_map[smoke_get_index(ex, em->res[0], ey, em->res[1], ez - 1)] : 0;
+								c111 = emission_map[smoke_get_index(ex, em->res[0], ey, em->res[1], ez)]; // this cell
 
-								// add emission to low resolution density
-								if (absolute_flow) 
-								{
-									if (temp_emission_map[index]>0) 
-										density[index] = temp_emission_map[index];
-								}
-								else 
-								{
-									density[index] += temp_emission_map[index];
+								for (ii = 0; ii < block_size; ii++)
+									for (jj = 0; jj < block_size; jj++)
+										for (kk = 0; kk < block_size; kk++)
+										{
 
-									if (density[index]>1) 
-										density[index]=1.0f;
-								}
+											float fx, fy, fz, interpolated_value;
+											int shift_x, shift_y, shift_z;
 
-								smoke_turbulence_get_res(sds->wt, bigres);
 
-								/* loop through high res blocks if high res enabled */
-								if (bigdensity)
-									for(ii = 0; ii < block_size; ii++)
-										for(jj = 0; jj < block_size; jj++)
-											for(kk = 0; kk < block_size; kk++)													
+											/*
+											 * Do volume interpolation if emitter smoothing
+											 * is enabled
+											 */
+											if (high_emission_smoothing)
 											{
-
-												float fx,fy,fz, interpolated_value;
-												int shift_x, shift_y, shift_z;
-
-
-												/*
-												* Do volume interpolation if emitter smoothing
-												* is enabled
-												*/
-												if (high_emission_smoothing) 
-												{
-													// convert block position to relative
-													// for interpolation smoothing
-													fx = (float)ii/block_size + 0.5f/block_size;
-													fy = (float)jj/block_size + 0.5f/block_size;
-													fz = (float)kk/block_size + 0.5f/block_size;
-
-													// calculate trilinear interpolation
-													interpolated_value = c000 * (1-fx) * (1-fy) * (1-fz) +
-														c100 * fx * (1-fy) * (1-fz) +
-														c010 * (1-fx) * fy * (1-fz) +
-														c001 * (1-fx) * (1-fy) * fz +
-														c101 * fx * (1-fy) * fz +
-														c011 * (1-fx) * fy * fz +
-														c110 * fx * fy * (1-fz) +
-														c111 * fx * fy * fz;
-
-
-													// add some contrast / sharpness
-													// depending on hi-res block size
-
-													interpolated_value = (interpolated_value-0.4f*sfs->density)*(block_size/2) + 0.4f*sfs->density;
-													if (interpolated_value<0.0f) interpolated_value = 0.0f;
-													if (interpolated_value>1.0f) interpolated_value = 1.0f;
-
-													// shift smoke block index
-													// (because pixel center is actually
-													// in halfway of the low res block)
-													shift_x = (x < 1) ? 0 : block_size/2;
-													shift_y = (y < 1) ? 0 : block_size/2;
-													shift_z = (z < 1) ? 0 : block_size/2;
+												/* get relative block position
+												 * for interpolation smoothing */
+												fx = (float)ii / block_size + 0.5f / block_size;
+												fy = (float)jj / block_size + 0.5f / block_size;
+												fz = (float)kk / block_size + 0.5f / block_size;
+
+												/* calculate trilinear interpolation */
+												interpolated_value = c000 * (1 - fx) * (1 - fy) * (1 - fz) +
+												                     c100 * fx * (1 - fy) * (1 - fz) +
+												                     c010 * (1 - fx) * fy * (1 - fz) +
+												                     c001 * (1 - fx) * (1 - fy) * fz +
+												                     c101 * fx * (1 - fy) * fz +
+												                     c011 * (1 - fx) * fy * fz +
+												                     c110 * fx * fy * (1 - fz) +
+												                     c111 * fx * fy * fz;
+
+
+												/* add some contrast / sharpness
+												 * depending on hi-res block size */
+												interpolated_value = (interpolated_value - 0.4f) * (block_size / 2) + 0.4f;
+												CLAMP(interpolated_value, 0.0f, 1.0f);
+
+												/* shift smoke block index
+												 * (because pixel center is actually
+												 * in halfway of the low res block) */
+												shift_x = (dx < 1) ? 0 : block_size / 2;
+												shift_y = (dy < 1) ? 0 : block_size / 2;
+												shift_z = (dz < 1) ? 0 : block_size / 2;
+											}
+											else {
+												/* without interpolation use same low resolution
+												 * block value for all hi-res blocks */
+												interpolated_value = c111;
+												shift_x = 0;
+												shift_y = 0;
+												shift_z = 0;
+											}
+
+											/* get shifted index for current high resolution block */
+											index_big = smoke_get_index(block_size * dx + ii - shift_x, bigres[0], block_size * dy + jj - shift_y, bigres[1], block_size * dz + kk - shift_z);
+
+											if (sfs->type == MOD_SMOKE_FLOW_TYPE_OUTFLOW) { // outflow
+												if (interpolated_value) {
+													apply_outflow_fields(index_big, bigdensity, NULL, bigfuel, bigreact, bigcolor_r, bigcolor_g, bigcolor_b);
 												}
-												else 
-												{
-													// without interpolation use same low resolution
-													// block value for all hi-res blocks
-													interpolated_value = c111;
-													shift_x = 0;
-													shift_y = 0;
-													shift_z = 0;
-												}
-
-												// get shifted index for current high resolution block
-												index_big = smoke_get_index(block_size * x + ii - shift_x, bigres[0], block_size * y + jj - shift_y, bigres[1], block_size * z + kk - shift_z);														
-
-												// add emission data to high resolution density
-												if (absolute_flow) 
-												{
-													if (interpolated_value > 0) 
-														bigdensity[index_big] = interpolated_value;
-												}
-												else 
-												{
-													bigdensity[index_big] += interpolated_value;
-
-													if (bigdensity[index_big]>1) 
-														bigdensity[index_big]=1.0f;
-												}
-											} // end of hires loop
-
-							} // end of low res loop
-
-							// free temporary emission map
-							if (temp_emission_map) 
-								MEM_freeN(temp_emission_map);
-
-				} // end emission
-			}
+											}
+											else { // inflow
+												apply_inflow_fields(sfs, interpolated_value, index_big, bigdensity, NULL, bigfuel, bigreact, bigcolor_r, bigcolor_g, bigcolor_b);
+											}
+										} // hires loop
+							}  // bigdensity
+						} // low res loop
+
+				// free emission maps
+				em_freeData(em);
+
+			} // end emission
 		}
 	}
 
-	if(flowobjs)
+	if (flowobjs)
 		MEM_freeN(flowobjs);
+	if (emaps)
+		MEM_freeN(emaps);
 }
 
 static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt))
 {
-	ListBase *effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
+	ListBase *effectors;
+	/* make sure smoke flow influence is 0.0f */
+	sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f;
+	effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
 
-	if(effectors)
+	if (effectors)
 	{
 		float *density = smoke_get_density(sds->fluid);
 		float *force_x = smoke_get_force_x(sds->fluid);
@@ -1532,223 +1901,269 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds,
 		float *velocity_y = smoke_get_velocity_y(sds->fluid);
 		float *velocity_z = smoke_get_velocity_z(sds->fluid);
 		unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
-		int x, y, z;
+		int x;
 
 		// precalculate wind forces
-		for(x = 0; x < sds->res[0]; x++)
-			for(y = 0; y < sds->res[1]; y++)
-				for(z = 0; z < sds->res[2]; z++)
-		{	
-			EffectedPoint epoint;
-			float voxelCenter[3] = {0,0,0}, vel[3] = {0,0,0}, retvel[3] = {0,0,0};
-			unsigned int index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
-
-			if((density[index] < FLT_EPSILON) || obstacle[index])					
-				continue;	
-
-			vel[0] = velocity_x[index];
-			vel[1] = velocity_y[index];
-			vel[2] = velocity_z[index];
-
-			voxelCenter[0] = sds->p0[0] + sds->dx * sds->scale * x + sds->dx * sds->scale * 0.5;
-			voxelCenter[1] = sds->p0[1] + sds->dx * sds->scale * y + sds->dx * sds->scale * 0.5;
-			voxelCenter[2] = sds->p0[2] + sds->dx * sds->scale * z + sds->dx * sds->scale * 0.5;
-
-			pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
-			pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
-
-			// TODO dg - do in force!
-			force_x[index] = MIN2(MAX2(-1.0, retvel[0] * 0.2), 1.0); 
-			force_y[index] = MIN2(MAX2(-1.0, retvel[1] * 0.2), 1.0); 
-			force_z[index] = MIN2(MAX2(-1.0, retvel[2] * 0.2), 1.0);
+		#pragma omp parallel for schedule(static)
+		for (x = 0; x < sds->res[0]; x++)
+		{
+			int y, z;
+			for (y = 0; y < sds->res[1]; y++)
+				for (z = 0; z < sds->res[2]; z++)
+				{
+					EffectedPoint epoint;
+					float mag;
+					float voxelCenter[3] = {0, 0, 0}, vel[3] = {0, 0, 0}, retvel[3] = {0, 0, 0};
+					unsigned int index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+
+					if ((density[index] < FLT_EPSILON) || obstacle[index])
+						continue;
+
+					vel[0] = velocity_x[index];
+					vel[1] = velocity_y[index];
+					vel[2] = velocity_z[index];
+
+					/* convert vel to global space */
+					mag = len_v3(vel);
+					mul_mat3_m4_v3(sds->obmat, vel);
+					normalize_v3(vel);
+					mul_v3_fl(vel, mag);
+
+					voxelCenter[0] = sds->p0[0] + sds->cell_size[0] * ((float)(x + sds->res_min[0]) + 0.5f);
+					voxelCenter[1] = sds->p0[1] + sds->cell_size[1] * ((float)(y + sds->res_min[1]) + 0.5f);
+					voxelCenter[2] = sds->p0[2] + sds->cell_size[2] * ((float)(z + sds->res_min[2]) + 0.5f);
+					mul_m4_v3(sds->obmat, voxelCenter);
+
+					pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
+					pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
+
+					/* convert retvel to local space */
+					mag = len_v3(retvel);
+					mul_mat3_m4_v3(sds->imat, retvel);
+					normalize_v3(retvel);
+					mul_v3_fl(retvel, mag);
+
+					// TODO dg - do in force!
+					force_x[index] = min_ff(max_ff(-1.0f, retvel[0] * 0.2f), 1.0f);
+					force_y[index] = min_ff(max_ff(-1.0f, retvel[1] * 0.2f), 1.0f);
+					force_z[index] = min_ff(max_ff(-1.0f, retvel[2] * 0.2f), 1.0f);
+				}
 		}
 	}
 
 	pdEndEffectors(&effectors);
 }
 
-static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps)
+static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps)
 {
+	SmokeDomainSettings *sds = smd->domain;
 	/* stability values copied from wturbulence.cpp */
 	const int maxSubSteps = 25;
 	float maxVel;
 	// maxVel should be 1.5 (1.5 cell max movement) * dx (cell size)
 
-	float dt = DT_DEFAULT;
+	float dt;
 	float maxVelMag = 0.0f;
 	int totalSubsteps;
 	int substep = 0;
 	float dtSubdiv;
+	float gravity[3] = {0.0f, 0.0f, -1.0f};
+	float gravity_mag;
 
-	SmokeDomainSettings *sds = smd->domain;
-
-	/* get max velocity and lower the dt value if it is too high */
-	size_t size= sds->res[0] * sds->res[1] * sds->res[2];
-
+#if 0  /* UNUSED */
+	   /* get max velocity and lower the dt value if it is too high */
+	size_t size = sds->res[0] * sds->res[1] * sds->res[2];
 	float *velX = smoke_get_velocity_x(sds->fluid);
 	float *velY = smoke_get_velocity_y(sds->fluid);
 	float *velZ = smoke_get_velocity_z(sds->fluid);
 	size_t i;
+#endif
 
-	/* adapt timestep for different framerates, dt = 0.1 is at 25fps */
-	dt *= (25.0f / fps);
+	/* update object state */
+	invert_m4_m4(sds->imat, ob->obmat);
+	copy_m4_m4(sds->obmat, ob->obmat);
+	smoke_set_domain_from_derivedmesh(sds, ob, domain_dm);
+
+	/* use global gravity if enabled */
+	if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+		copy_v3_v3(gravity, scene->physics_settings.gravity);
+		/* map default value to 1.0 */
+		mul_v3_fl(gravity, 1.0f / 9.810f);
+	}
+	/* convert gravity to domain space */
+	gravity_mag = len_v3(gravity);
+	mul_mat3_m4_v3(sds->imat, gravity);
+	normalize_v3(gravity);
+	mul_v3_fl(gravity, gravity_mag);
 
+	/* adapt timestep for different framerates, dt = 0.1 is at 25fps */
+	dt = DT_DEFAULT * (25.0f / fps);
 	// maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel
-	maxVel = (sds->dx * 5.0);
+	maxVel = (sds->dx * 5.0f);
 
-	for(i = 0; i < size; i++)
-	{
-		float vtemp = (velX[i]*velX[i]+velY[i]*velY[i]+velZ[i]*velZ[i]);
-		if(vtemp > maxVelMag)
+#if 0
+	for (i = 0; i < size; i++) {
+		float vtemp = (velX[i] * velX[i] + velY[i] * velY[i] + velZ[i] * velZ[i]);
+		if (vtemp > maxVelMag)
 			maxVelMag = vtemp;
 	}
+#endif
 
-	maxVelMag = sqrt(maxVelMag) * dt * sds->time_scale;
+	maxVelMag = sqrtf(maxVelMag) * dt * sds->time_scale;
 	totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */
 	totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
 	totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
 
 	/* Disable substeps for now, since it results in numerical instability */
-	totalSubsteps = 1.0f; 
+	totalSubsteps = 1.0f;
 
 	dtSubdiv = (float)dt / (float)totalSubsteps;
 
 	// printf("totalSubsteps: %d, maxVelMag: %f, dt: %f\n", totalSubsteps, maxVelMag, dt);
 
-	for(substep = 0; substep < totalSubsteps; substep++)
+	for (substep = 0; substep < totalSubsteps; substep++)
 	{
 		// calc animated obstacle velocities
+		update_flowsfluids(scene, ob, sds, smd->time, dtSubdiv);
 		update_obstacles(scene, ob, sds, dtSubdiv, substep, totalSubsteps);
-		update_flowsfluids(scene, ob, sds, smd->time);
-		update_effectors(scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt
 
-		smoke_step(sds->fluid, dtSubdiv);
+		if (sds->total_cells > 1) {
+			update_effectors(scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt
+			smoke_step(sds->fluid, gravity, dtSubdiv);
+		}
+	}
+}
 
-		// move animated obstacle: Done in update_obstacles() */
+static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
+{
+	DerivedMesh *result;
+	MVert *mverts;
+	MPoly *mpolys;
+	MLoop *mloops;
+	float min[3];
+	float max[3];
+	float *co;
+	MPoly *mp;
+	MLoop *ml;
+
+	int num_verts = 8;
+	int num_faces = 6;
+	int i;
+	float ob_loc[3] = {0};
+	float ob_cache_loc[3] = {0};
+
+	/* dont generate any mesh if there isnt any content */
+	if (sds->total_cells <= 1) {
+		num_verts = 0;
+		num_faces = 0;
+	}
 
-		// where to delete old obstacles from array? Done in update_obstacles() */
+	result = CDDM_new(num_verts, 0, 0, num_faces * 4, num_faces);
+	mverts = CDDM_get_verts(result);
+	mpolys = CDDM_get_polys(result);
+	mloops = CDDM_get_loops(result);
+
+
+	if (num_verts) {
+		/* volume bounds */
+		VECMADD(min, sds->p0, sds->cell_size, sds->res_min);
+		VECMADD(max, sds->p0, sds->cell_size, sds->res_max);
+
+		/* set vertices */
+		/* top slab */
+		co = mverts[0].co; co[0] = min[0]; co[1] = min[1]; co[2] = max[2];
+		co = mverts[1].co; co[0] = max[0]; co[1] = min[1]; co[2] = max[2];
+		co = mverts[2].co; co[0] = max[0]; co[1] = max[1]; co[2] = max[2];
+		co = mverts[3].co; co[0] = min[0]; co[1] = max[1]; co[2] = max[2];
+		/* bottom slab */
+		co = mverts[4].co; co[0] = min[0]; co[1] = min[1]; co[2] = min[2];
+		co = mverts[5].co; co[0] = max[0]; co[1] = min[1]; co[2] = min[2];
+		co = mverts[6].co; co[0] = max[0]; co[1] = max[1]; co[2] = min[2];
+		co = mverts[7].co; co[0] = min[0]; co[1] = max[1]; co[2] = min[2];
+
+		/* create faces */
+		/* top */
+		mp = &mpolys[0]; ml = &mloops[0 * 4]; mp->loopstart = 0 * 4; mp->totloop = 4;
+		ml[0].v = 0; ml[1].v = 1; ml[2].v = 2; ml[3].v = 3;
+		/* right */
+		mp = &mpolys[1]; ml = &mloops[1 * 4]; mp->loopstart = 1 * 4; mp->totloop = 4;
+		ml[0].v = 2; ml[1].v = 1; ml[2].v = 5; ml[3].v = 6;
+		/* bottom */
+		mp = &mpolys[2]; ml = &mloops[2 * 4]; mp->loopstart = 2 * 4; mp->totloop = 4;
+		ml[0].v = 7; ml[1].v = 6; ml[2].v = 5; ml[3].v = 4;
+		/* left */
+		mp = &mpolys[3]; ml = &mloops[3 * 4]; mp->loopstart = 3 * 4; mp->totloop = 4;
+		ml[0].v = 0; ml[1].v = 3; ml[2].v = 7; ml[3].v = 4;
+		/* front */
+		mp = &mpolys[4]; ml = &mloops[4 * 4]; mp->loopstart = 4 * 4; mp->totloop = 4;
+		ml[0].v = 3; ml[1].v = 2; ml[2].v = 6; ml[3].v = 7;
+		/* back */
+		mp = &mpolys[5]; ml = &mloops[5 * 4]; mp->loopstart = 5 * 4; mp->totloop = 4;
+		ml[0].v = 1; ml[1].v = 0; ml[2].v = 4; ml[3].v = 5;
+
+		/* calculate required shift to match domain's global position
+		 *  it was originally simulated at (if object moves without smoke step) */
+		invert_m4_m4(ob->imat, ob->obmat);
+		mul_m4_v3(ob->obmat, ob_loc);
+		mul_m4_v3(sds->obmat, ob_cache_loc);
+		VECSUB(sds->obj_shift_f, ob_cache_loc, ob_loc);
+		/* convert shift to local space and apply to vertices */
+		mul_mat3_m4_v3(ob->imat, sds->obj_shift_f);
+		/* apply */
+		for (i = 0; i < num_verts; i++) {
+			add_v3_v3(mverts[i].co, sds->obj_shift_f);
+		}
 	}
+
+
+	CDDM_calc_edges(result);
+	return result;
 }
 
-void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
-{	
-	if((smd->type & MOD_SMOKE_TYPE_FLOW))
+static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
+{
+	if ((smd->type & MOD_SMOKE_TYPE_FLOW))
 	{
-		if(scene->r.cfra >= smd->time)
+		if (scene->r.cfra >= smd->time)
 			smokeModifier_init(smd, ob, scene, dm);
 
-		if(scene->r.cfra > smd->time)
+		if (smd->flow->dm) smd->flow->dm->release(smd->flow->dm);
+		smd->flow->dm = CDDM_copy(dm);
+		DM_ensure_tessface(smd->flow->dm);
+
+		if (scene->r.cfra > smd->time)
 		{
-			// XXX TODO
 			smd->time = scene->r.cfra;
-
-			// rigid movement support
-			/*
-			copy_m4_m4(smd->flow->mat_old, smd->flow->mat);
-			copy_m4_m4(smd->flow->mat, ob->obmat);
-			*/
 		}
-		else if(scene->r.cfra < smd->time)
+		else if (scene->r.cfra < smd->time)
 		{
 			smd->time = scene->r.cfra;
 			smokeModifier_reset(smd);
 		}
 	}
-	else if(smd->type & MOD_SMOKE_TYPE_COLL)
+	else if (smd->type & MOD_SMOKE_TYPE_COLL)
 	{
-		/* Check if domain resolution changed */
-		/* DG TODO: can this be solved more elegant using dependancy graph? */
-		{
-			SmokeCollSettings *scs = smd->coll;
-			Base *base = scene->base.first;
-			int changed = 0;
-			float dx = FLT_MAX;
-			float scale = 1.0f;
-			int haveDomain = 0;
-
-			for ( ; base; base = base->next) 
-			{
-				SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(base->object, eModifierType_Smoke);
-
-				if (smd2 && (smd2->type & MOD_SMOKE_TYPE_DOMAIN) && smd2->domain)
-				{
-					SmokeDomainSettings *sds = smd2->domain;
-
-					if(sds->dx * sds->scale < dx)
-					{
-						dx = sds->dx;
-						scale = sds->scale;
-						changed = 1;
-					}
-
-					haveDomain = 1;
-				}
-			}
-
-			if(!haveDomain)
-				return;
-			
-			if(changed)
-			{
-				if(dx*scale != scs->dx)
-				{
-					scs->dx = dx*scale;
-					smokeModifier_reset(smd);
-				}
-			}
-		}
-
-		if(scene->r.cfra >= smd->time)
+		if (scene->r.cfra >= smd->time)
 			smokeModifier_init(smd, ob, scene, dm);
 
-		if(scene->r.cfra > smd->time)
+		if (smd->coll)
 		{
-			unsigned int i;
-			SmokeCollSettings *scs = smd->coll;
-			float *points_old = scs->points_old;
-			float *points = scs->points;
-			unsigned int numpoints = scs->numpoints; 
-
-			// XXX TODO <-- DG: what is TODO here?
-			smd->time = scene->r.cfra;
-
-			// rigid movement support
-			copy_m4_m4(scs->mat_old, scs->mat);
-			copy_m4_m4(scs->mat, ob->obmat);
-
-			if(scs->type != SM_COLL_ANIMATED) // if(not_animated)
-			{
-				// nothing to do, "mat" is already up to date
-			}
-			else
-			{
-				// XXX TODO: need to update positions + divs
-
-				if(scs->numverts != dm->getNumVerts(dm))
-				{
-					// DG TODO: reset modifier?
-					return;
-				}
-
-				for(i = 0; i < numpoints * 3; i++)
-				{
-					points_old[i] = points[i];
-				}
+			if (smd->coll->dm)
+				smd->coll->dm->release(smd->coll->dm);
 
-				DM_ensure_tessface(dm);
-				fill_scs_points_anim(ob, dm, scs);
-			}
+			smd->coll->dm = CDDM_copy(dm);
+			DM_ensure_tessface(smd->coll->dm);
 		}
-		else if(scene->r.cfra < smd->time)
+
+		smd->time = scene->r.cfra;
+		if (scene->r.cfra < smd->time)
 		{
-			smd->time = scene->r.cfra;
 			smokeModifier_reset(smd);
 		}
 	}
-	else if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+	else if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 	{
 		SmokeDomainSettings *sds = smd->domain;
-		float light[3];	
 		PointCache *cache = NULL;
 		PTCacheID pid;
 		int startframe, endframe, framenr;
@@ -1762,41 +2177,39 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 		BKE_ptcache_id_from_smoke(&pid, ob, smd);
 		BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
 
-		if(!smd->domain->fluid || framenr == startframe)
+		if (!smd->domain->fluid || framenr == startframe)
 		{
 			BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
+			smokeModifier_reset(smd);
 			BKE_ptcache_validate(cache, framenr);
 			cache->flag &= ~PTCACHE_REDO_NEEDED;
 		}
 
-		if(!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD)==0 && (cache->flag & PTCACHE_BAKED)==0)
+		if (!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD) == 0 && (cache->flag & PTCACHE_BAKED) == 0)
 			return;
 
 		smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD;
-
 		CLAMP(framenr, startframe, endframe);
 
 		/* If already viewing a pre/after frame, no need to reload */
 		if ((smd->time == framenr) && (framenr != scene->r.cfra))
 			return;
 
-		// printf("startframe: %d, framenr: %d\n", startframe, framenr);
-
-		if(smokeModifier_init(smd, ob, scene, dm)==0)
+		if (smokeModifier_init(smd, ob, scene, dm) == 0)
 		{
 			printf("bad smokeModifier_init\n");
 			return;
 		}
 
 		/* try to read from cache */
-		if(BKE_ptcache_read(&pid, (float)framenr) == PTCACHE_READ_EXACT) {
+		if (BKE_ptcache_read(&pid, (float)framenr) == PTCACHE_READ_EXACT) {
 			BKE_ptcache_validate(cache, framenr);
 			smd->time = framenr;
 			return;
 		}
-		
+
 		/* only calculate something when we advanced a single frame */
-		if(framenr != (int)smd->time+1)
+		if (framenr != (int)smd->time + 1)
 			return;
 
 		/* don't simulate if viewing start frame, but scene frame is not real start frame */
@@ -1805,54 +2218,48 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 
 		tstart();
 
-		smoke_calc_domain(scene, ob, smd);
-
 		/* if on second frame, write cache for first frame */
-		if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) {
+		if ((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) {
 			// create shadows straight after domain initialization so we get nice shadows for startframe, too
-			if(get_lamp(scene, light))
-				smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
+			smoke_calc_transparency(sds, scene);
 
-			if(sds->wt)
+			if (sds->wt && sds->total_cells > 1)
 			{
-				if(sds->flags & MOD_SMOKE_DISSOLVE)
+				if (sds->flags & MOD_SMOKE_DISSOLVE)
 					smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
 				smoke_turbulence_step(sds->wt, sds->fluid);
 			}
 
 			BKE_ptcache_write(&pid, startframe);
 		}
-		
+
 		// set new time
 		smd->time = scene->r.cfra;
 
 		/* do simulation */
 
-		// low res
-
 		// simulate the actual smoke (c++ code in intern/smoke)
 		// DG: interesting commenting this line + deactivating loading of noise files
-		if(framenr!=startframe)
+		if (framenr != startframe)
 		{
-			if(sds->flags & MOD_SMOKE_DISSOLVE)
+			if (sds->flags & MOD_SMOKE_DISSOLVE)
 				smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
-			
-			step(scene, ob, smd, scene->r.frs_sec / scene->r.frs_sec_base);
+
+			step(scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base);
 		}
 
 		// create shadows before writing cache so they get stored
-		if(get_lamp(scene, light))
-			smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
+		smoke_calc_transparency(sds, scene);
 
-		if(sds->wt)
+		if (sds->wt)
 		{
-			if(sds->flags & MOD_SMOKE_DISSOLVE)
+			if (sds->flags & MOD_SMOKE_DISSOLVE)
 				smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
 			smoke_turbulence_step(sds->wt, sds->fluid);
 		}
-	
+
 		BKE_ptcache_validate(cache, framenr);
-		if(framenr != startframe)
+		if (framenr != startframe)
 			BKE_ptcache_write(&pid, framenr);
 
 		tend();
@@ -1860,38 +2267,34 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 	}
 }
 
-static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct)
+struct DerivedMesh *smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
 {
-	const size_t index = smoke_get_index(pixel[0], res[0], pixel[1], res[1], pixel[2]);
+	smokeModifier_process(smd, scene, ob, dm);
 
-	// T_ray *= T_vox
-	*tRay *= exp(input[index]*correct);
-	
-	if(result[index] < 0.0f)	
+	/* return generated geometry for adaptive domain */
+	if (smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain &&
+	    smd->domain->flags & MOD_SMOKE_ADAPTIVE_DOMAIN &&
+	    smd->domain->base_res[0])
 	{
-// #pragma omp critical		
-		result[index] = *tRay;	
-	}	
-
-	return *tRay;
+		return createDomainGeometry(smd->domain, ob);
+	}
+	else return CDDM_copy(dm);
 }
 
-long long smoke_get_mem_req(int xres, int yres, int zres, int amplify)
+static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct)
 {
-	int totalCells = xres * yres * zres;
-	int amplifiedCells = totalCells * amplify * amplify * amplify;
-
-	// print out memory requirements
-	long long int coarseSize = sizeof(float) * totalCells * 22 +
-	sizeof(unsigned char) * totalCells;
+	const size_t index = smoke_get_index(pixel[0], res[0], pixel[1], res[1], pixel[2]);
 
-	long long int fineSize = sizeof(float) * amplifiedCells * 7 + // big grids
-	sizeof(float) * totalCells * 8 +     // small grids
-	sizeof(float) * 128 * 128 * 128;     // noise tile
+	// T_ray *= T_vox
+	*tRay *= expf(input[index] * correct);
 
-	long long int totalMB = (coarseSize + fineSize) / (1024 * 1024);
+	if (result[index] < 0.0f)
+	{
+// #pragma omp critical
+		result[index] = *tRay;
+	}
 
-	return totalMB;
+	return *tRay;
 }
 
 static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, float *tRay, bresenham_callback cb, float *result, float *input, int res[3], float correct)
@@ -1921,7 +2324,7 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
 		err_1 = dy2 - l;
 		err_2 = dz2 - l;
 		for (i = 0; i < l; i++) {
-			if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+			if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
 				break;
 			if (err_1 > 0) {
 				pixel[1] += y_inc;
@@ -1935,12 +2338,12 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
 			err_2 += dz2;
 			pixel[0] += x_inc;
 		}
-	} 
+	}
 	else if ((m >= l) && (m >= n)) {
 		err_1 = dx2 - m;
 		err_2 = dz2 - m;
 		for (i = 0; i < m; i++) {
-			if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+			if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
 				break;
 			if (err_1 > 0) {
 				pixel[0] += x_inc;
@@ -1954,12 +2357,12 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
 			err_2 += dz2;
 			pixel[1] += y_inc;
 		}
-	} 
+	}
 	else {
 		err_1 = dy2 - n;
 		err_2 = dx2 - n;
 		for (i = 0; i < n; i++) {
-			if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+			if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
 				break;
 			if (err_1 > 0) {
 				pixel[1] += y_inc;
@@ -1977,80 +2380,142 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
 	cb(result, input, res, pixel, tRay, correct);
 }
 
-static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct)
+static void smoke_calc_transparency(SmokeDomainSettings *sds, Scene *scene)
 {
-	float tmp[3];
-
-	sub_v3_v3v3(tmp, pos, p0);
-	mul_v3_fl(tmp, 1.0 / dx);
+	float bv[6] = {0};
+	float light[3];
+	int a, z, slabsize = sds->res[0] * sds->res[1], size = sds->res[0] * sds->res[1] * sds->res[2];
+	float *density = smoke_get_density(sds->fluid);
+	float correct = -7.0f * sds->dx;
 
-	if (correct) {
-		cell[0] = MIN2(res[0] - 1, MAX2(0, (int)floor(tmp[0])));
-		cell[1] = MIN2(res[1] - 1, MAX2(0, (int)floor(tmp[1])));
-		cell[2] = MIN2(res[2] - 1, MAX2(0, (int)floor(tmp[2])));
-	}
-	else {
-		cell[0] = (int)floor(tmp[0]);
-		cell[1] = (int)floor(tmp[1]);
-		cell[2] = (int)floor(tmp[2]);
-	}
-}
+	if (!get_lamp(scene, light)) return;
 
-static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct)
-{
-	float bv[6];
-	int a, z, slabsize=res[0]*res[1], size= res[0]*res[1]*res[2];
+	/* convert light pos to sim cell space */
+	mul_m4_v3(sds->imat, light);
+	light[0] = (light[0] - sds->p0[0]) / sds->cell_size[0] - 0.5f - (float)sds->res_min[0];
+	light[1] = (light[1] - sds->p0[1]) / sds->cell_size[1] - 0.5f - (float)sds->res_min[1];
+	light[2] = (light[2] - sds->p0[2]) / sds->cell_size[2] - 0.5f - (float)sds->res_min[2];
 
-	for(a=0; a<size; a++)
-		result[a]= -1.0f;
+	for (a = 0; a < size; a++)
+		sds->shadow[a] = -1.0f;
 
-	bv[0] = p0[0];
-	bv[1] = p1[0];
-	// y
-	bv[2] = p0[1];
-	bv[3] = p1[1];
-	// z
-	bv[4] = p0[2];
-	bv[5] = p1[2];
+	/* calculate domain bounds in sim cell space */
+	// 0,2,4 = 0.0f
+	bv[1] = (float)sds->res[0]; // x
+	bv[3] = (float)sds->res[1]; // y
+	bv[5] = (float)sds->res[2]; // z
 
 // #pragma omp parallel for schedule(static,1)
-	for(z = 0; z < res[2]; z++)
+	for (z = 0; z < sds->res[2]; z++)
 	{
-		size_t index = z*slabsize;
-		int x,y;
+		size_t index = z * slabsize;
+		int x, y;
 
-		for(y = 0; y < res[1]; y++)
-			for(x = 0; x < res[0]; x++, index++)
+		for (y = 0; y < sds->res[1]; y++)
+			for (x = 0; x < sds->res[0]; x++, index++)
 			{
 				float voxelCenter[3];
 				float pos[3];
 				int cell[3];
 				float tRay = 1.0;
 
-				if(result[index] >= 0.0f)					
-					continue;								
-				voxelCenter[0] = p0[0] + dx *  x + dx * 0.5;
-				voxelCenter[1] = p0[1] + dx *  y + dx * 0.5;
-				voxelCenter[2] = p0[2] + dx *  z + dx * 0.5;
+				if (sds->shadow[index] >= 0.0f)
+					continue;
+				voxelCenter[0] = (float)x;
+				voxelCenter[1] = (float)y;
+				voxelCenter[2] = (float)z;
 
-				// get starting position (in voxel coords)
-				if(BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
+				// get starting cell (light pos)
+				if (BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
 				{
-					// we're ouside
-					get_cell(p0, res, dx, pos, cell, 1);
+					// we're ouside -> use point on side of domain
+					cell[0] = (int)floor(pos[0]);
+					cell[1] = (int)floor(pos[1]);
+					cell[2] = (int)floor(pos[2]);
 				}
 				else {
-					// we're inside
-					get_cell(p0, res, dx, light, cell, 1);
+					// we're inside -> use light itself
+					cell[0] = (int)floor(light[0]);
+					cell[1] = (int)floor(light[1]);
+					cell[2] = (int)floor(light[2]);
 				}
+				/* clamp within grid bounds */
+				CLAMP(cell[0], 0, sds->res[0] - 1);
+				CLAMP(cell[1], 0, sds->res[1] - 1);
+				CLAMP(cell[2], 0, sds->res[2] - 1);
 
-				bresenham_linie_3D(cell[0], cell[1], cell[2], x, y, z, &tRay, cb, result, input, res, correct);
+				bresenham_linie_3D(cell[0], cell[1], cell[2], x, y, z, &tRay, calc_voxel_transp, sds->shadow, density, sds->res, correct);
 
 				// convention -> from a RGBA float array, use G value for tRay
 // #pragma omp critical
-				result[index] = tRay;			
+				sds->shadow[index] = tRay;
 			}
 	}
 }
 
+/* get smoke velocity and density at given coordinates
+ *  returns fluid density or -1.0f if outside domain*/
+float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
+{
+	SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
+	zero_v3(velocity);
+
+	if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && smd->domain->fluid) {
+		SmokeDomainSettings *sds = smd->domain;
+		float time_mult = 25.f * DT_DEFAULT;
+		float vel_mag;
+		float *velX = smoke_get_velocity_x(sds->fluid);
+		float *velY = smoke_get_velocity_y(sds->fluid);
+		float *velZ = smoke_get_velocity_z(sds->fluid);
+		float density = 0.0f, fuel = 0.0f;
+		float pos[3];
+		copy_v3_v3(pos, position);
+		smoke_pos_to_cell(sds, pos);
+
+		/* check if point is outside domain max bounds */
+		if (pos[0] < sds->res_min[0] || pos[1] < sds->res_min[1] || pos[2] < sds->res_min[2]) return -1.0f;
+		if (pos[0] > sds->res_max[0] || pos[1] > sds->res_max[1] || pos[2] > sds->res_max[2]) return -1.0f;
+
+		/* map pos between 0.0 - 1.0 */
+		pos[0] = (pos[0] - sds->res_min[0]) / ((float)sds->res[0]);
+		pos[1] = (pos[1] - sds->res_min[1]) / ((float)sds->res[1]);
+		pos[2] = (pos[2] - sds->res_min[2]) / ((float)sds->res[2]);
+
+
+		/* check if point is outside active area */
+		if (smd->domain->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) {
+			if (pos[0] < 0.0f || pos[1] < 0.0f || pos[2] < 0.0f) return 0.0f;
+			if (pos[0] > 1.0f || pos[1] > 1.0f || pos[2] > 1.0f) return 0.0f;
+		}
+
+		/* get interpolated velocity */
+		velocity[0] = BLI_voxel_sample_trilinear(velX, sds->res, pos) * sds->global_size[0] * time_mult;
+		velocity[1] = BLI_voxel_sample_trilinear(velY, sds->res, pos) * sds->global_size[1] * time_mult;
+		velocity[2] = BLI_voxel_sample_trilinear(velZ, sds->res, pos) * sds->global_size[2] * time_mult;
+
+		/* convert velocity direction to global space */
+		vel_mag = len_v3(velocity);
+		mul_mat3_m4_v3(sds->obmat, velocity);
+		normalize_v3(velocity);
+		mul_v3_fl(velocity, vel_mag);
+
+		/* use max value of fuel or smoke density */
+		density = BLI_voxel_sample_trilinear(smoke_get_density(sds->fluid), sds->res, pos);
+		if (smoke_has_fuel(sds->fluid)) {
+			fuel = BLI_voxel_sample_trilinear(smoke_get_fuel(sds->fluid), sds->res, pos);
+		}
+		return MAX2(density, fuel);
+	}
+	return -1.0f;
+}
+
+int smoke_get_data_flags(SmokeDomainSettings *sds) {
+	int flags = 0;
+	if (smoke_has_heat(sds->fluid)) flags |= SM_ACTIVE_HEAT;
+	if (smoke_has_fuel(sds->fluid)) flags |= SM_ACTIVE_FIRE;
+	if (smoke_has_colors(sds->fluid)) flags |= SM_ACTIVE_COLORS;
+
+	return flags;
+}
+
 #endif /* WITH_SMOKE */
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index f47c931..bb0cfe1 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1170,7 +1170,7 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float
 
 								*damp=df*tune*ob->pd->pdef_sbdamp;
 
-								df = 0.01f*exp(- 100.0f*df);
+								df = 0.01f * expf(-100.0f * df);
 								Vec3PlusStVec(force, -df, d_nvect);
 								deflected = 3;
 							}
@@ -1598,7 +1598,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
 					/*see if we have wind*/
 					if (do_effector) {
 						EffectedPoint epoint;
-						float speed[3]={0.0f, 0.0f, 0.0f};
+						float speed[3] = {0.0f, 0.0f, 0.0f};
 						float pos[3];
 						mid_v3_v3v3(pos, sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos);
 						mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec);
@@ -1749,8 +1749,8 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 	Object *ob= NULL;
 	GHash *hash;
 	GHashIterator *ihash;
-	float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], avel[3]={0.0, 0.0, 0.0},
-	      vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
+	float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], avel[3] = {0.0, 0.0, 0.0},
+	      vv1[3], vv2[3], vv3[3], vv4[3], coledge[3] = {0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
 	      outerforceaccu[3], innerforceaccu[3],
 	      facedist, /* n_mag, */ /* UNUSED */ force_mag_norm, minx, miny, minz, maxx, maxy, maxz,
 	      innerfacethickness = -0.5f, outerfacethickness = 0.2f,
@@ -2209,7 +2209,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 	bp = &sb->bpoint[ifirst];
 	for (bb=number_of_points_here; bb>0; bb--, bp++) {
 		/* clear forces  accumulator */
-		bp->force[0]= bp->force[1]= bp->force[2]= 0.0;
+		bp->force[0] = bp->force[1] = bp->force[2] = 0.0;
 		/* naive ball self collision */
 		/* needs to be done if goal snaps or not */
 		if (do_selfcollision) {
@@ -2304,8 +2304,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 			if (do_effector) {
 				EffectedPoint epoint;
 				float kd;
-				float force[3]= {0.0f, 0.0f, 0.0f};
-				float speed[3]= {0.0f, 0.0f, 0.0f};
+				float force[3] = {0.0f, 0.0f, 0.0f};
+				float speed[3] = {0.0f, 0.0f, 0.0f};
 				float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */
 				pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint);
 				pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
@@ -2557,7 +2557,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 		for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 			/* clear forces  accumulator */
-			bp->force[0]= bp->force[1]= bp->force[2]= 0.0;
+			bp->force[0] = bp->force[1] = bp->force[2] = 0.0;
 			if (nl_flags & NLF_BUILD) {
 				//int ia =3*(sb->totpoint-a);
 				//int op =3*sb->totpoint;
@@ -2712,8 +2712,8 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 				/* particle field & vortex */
 				if (do_effector) {
 					EffectedPoint epoint;
-					float force[3]= {0.0f, 0.0f, 0.0f};
-					float speed[3]= {0.0f, 0.0f, 0.0f};
+					float force[3] = {0.0f, 0.0f, 0.0f};
+					float speed[3] = {0.0f, 0.0f, 0.0f};
 					float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */
 					pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint);
 					pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
@@ -2905,7 +2905,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 	/* or heun ~ 2nd order runge-kutta steps, mode 1, 2 */
 	SoftBody *sb= ob->soft;	/* is supposed to be there */
 	BodyPoint *bp;
-	float dx[3]={0}, dv[3], aabbmin[3], aabbmax[3], cm[3]={0.0f, 0.0f, 0.0f};
+	float dx[3] = {0}, dv[3], aabbmin[3], aabbmax[3], cm[3] = {0.0f, 0.0f, 0.0f};
 	float timeovermass/*, freezeloc=0.00001f, freezeforce=0.00000000001f*/;
 	float maxerrpos= 0.0f, maxerrvel = 0.0f;
 	int a, fuzzy=0;
@@ -3194,7 +3194,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
 	- xxxx_to_softbody(Object *ob)      : a full (new) copy, creates SB geometry
 */
 
-static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex, float *target)
+static void get_scalar_from_vertexgroup(Object *ob, int vertID, int groupindex, float *target)
 /* result 0 on success, else indicates error number
 -- kind of *inverse* result defintion,
 -- but this way we can signal error condition to caller
@@ -3297,7 +3297,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 		if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { /* even this is a deprecated evil hack */
 		   /* I'd like to have it  .. if (sb->namedVG_Goal[0]) */
 
-			get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup-1), &bp->goal);
+			get_scalar_from_vertexgroup(ob, a, sb->vertgroup - 1, &bp->goal);
 			/* do this always, regardless successful read from vertex group */
 			/* this is where '2.5 every thing is animatable' goes wrong in the first place jow_go_for2_5 */
 			/* 1st coding action to take : move this to frame level */
@@ -3316,10 +3316,10 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 		 */
 
 		if (sb->namedVG_Mass[0]) {
-			int grp= defgroup_name_index (ob, sb->namedVG_Mass);
-			/* printf("VGN  %s %d\n", sb->namedVG_Mass, grp); */
-			if (grp > -1) {
-				get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->mass);
+			int defgrp_index = defgroup_name_index (ob, sb->namedVG_Mass);
+			/* printf("VGN  %s %d\n", sb->namedVG_Mass, defgrp_index); */
+			if (defgrp_index != -1) {
+				get_scalar_from_vertexgroup(ob, a, defgrp_index, &bp->mass);
 				/* 2.5  bp->mass = bp->mass * sb->nodemass; */
 				/* printf("bp->mass  %f\n", bp->mass); */
 
@@ -3329,10 +3329,10 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 		bp->springweight = 1.0f;
 
 		if (sb->namedVG_Spring_K[0]) {
-			int grp= defgroup_name_index (ob, sb->namedVG_Spring_K);
-			//printf("VGN  %s %d\n", sb->namedVG_Spring_K, grp);
-			if (grp > -1) {
-				get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->springweight);
+			int defgrp_index = defgroup_name_index (ob, sb->namedVG_Spring_K);
+			//printf("VGN  %s %d\n", sb->namedVG_Spring_K, defgrp_index);
+			if (defgrp_index  != -1) {
+				get_scalar_from_vertexgroup(ob, a, defgrp_index , &bp->springweight);
 				//printf("bp->springweight  %f\n", bp->springweight);
 
 			}
@@ -3865,7 +3865,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
 		copy_v3_v3(bp->origS, bp->pos);
 		copy_v3_v3(bp->origE, bp->pos);
 		copy_v3_v3(bp->origT, bp->pos);
-		bp->vec[0]= bp->vec[1]= bp->vec[2]= 0.0f;
+		bp->vec[0] = bp->vec[1] = bp->vec[2] = 0.0f;
 
 		/* the bp->prev*'s are for rolling back from a canceled try to propagate in time
 		 * adaptive step size algo in a nutshell:
@@ -4008,8 +4008,8 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 			}
 			loops++;
 			if (sb->solverflags & SBSO_MONITOR ) {
-				sct=PIL_check_seconds_timer();
-				if (sct-sst > 0.5f) printf("%3.0f%% \r", 100.0f*timedone/dtime);
+				sct = PIL_check_seconds_timer();
+				if (sct - sst > 0.5) printf("%3.0f%% \r", 100.0f * timedone / dtime);
 			}
 			/* ask for user break */
 			if (SB_localInterruptCallBack && SB_localInterruptCallBack()) break;
@@ -4045,7 +4045,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 
 	if (sb->solverflags & SBSO_MONITOR ) {
 		sct=PIL_check_seconds_timer();
-		if ((sct-sst > 0.5f) || (G.debug & G_DEBUG)) printf(" solver time %f sec %s\n", sct-sst, ob->id.name);
+		if ((sct - sst > 0.5) || (G.debug & G_DEBUG)) printf(" solver time %f sec %s\n", sct-sst, ob->id.name);
 	}
 }
 
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 385d1bb..af9d21d 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -353,17 +353,17 @@ void sound_load(struct Main *bmain, bSound *sound)
 		}
 // XXX unused currently
 #if 0
-		break;
+			break;
+		}
+		case SOUND_TYPE_BUFFER:
+			if (sound->child_sound && sound->child_sound->handle)
+				sound->handle = AUD_bufferSound(sound->child_sound->handle);
+			break;
+		case SOUND_TYPE_LIMITER:
+			if (sound->child_sound && sound->child_sound->handle)
+				sound->handle = AUD_limitSound(sound->child_sound, sound->start, sound->end);
+			break;
 	}
-	case SOUND_TYPE_BUFFER:
-		if (sound->child_sound && sound->child_sound->handle)
-			sound->handle = AUD_bufferSound(sound->child_sound->handle);
-		break;
-	case SOUND_TYPE_LIMITER:
-		if (sound->child_sound && sound->child_sound->handle)
-			sound->handle = AUD_limitSound(sound->child_sound, sound->start, sound->end);
-		break;
-}
 #endif
 		if (sound->flags & SOUND_FLAGS_MONO) {
 			void *handle = AUD_monoSound(sound->handle);
@@ -701,7 +701,7 @@ void sound_update_scene(struct Scene *scene)
 
 							if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) {
 								if (speaker->sound)
-									AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0);
+									AUD_moveSequence(strip->speaker_handle, (double)strip->start / FPS, -1, 0);
 								else {
 									AUD_removeSequence(scene->sound_scene, strip->speaker_handle);
 									strip->speaker_handle = NULL;
@@ -709,7 +709,9 @@ void sound_update_scene(struct Scene *scene)
 							}
 							else {
 								if (speaker->sound) {
-									strip->speaker_handle = AUD_addSequence(scene->sound_scene, speaker->sound->playback_handle, strip->start / FPS, -1, 0);
+									strip->speaker_handle = AUD_addSequence(scene->sound_scene,
+									                                        speaker->sound->playback_handle,
+									                                        (double)strip->start / FPS, -1, 0);
 									AUD_setRelativeSequence(strip->speaker_handle, 0);
 								}
 							}
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 0d1e227..be8b572 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -602,7 +602,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
 	}
 
 	mp = mpoly;
-	index = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
+	index = (int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
 	for (i = 0; i < dm->numPolyData; i++, mp++) {
 		CCGFace *f;
 
@@ -2706,6 +2706,30 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
 {
 	if (type == CD_ORIGINDEX) {
 		/* create origindex on demand to save memory */
+		int *origindex;
+
+		/* Avoid re-creation if the layer exists already */
+		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+		if (origindex) {
+			return origindex;
+		}
+
+		DM_add_tessface_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
+		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+
+		/* silly loop counting up */
+		range_vn_i(origindex, dm->getNumTessFaces(dm), 0);
+
+		return origindex;
+	}
+
+	return DM_get_tessface_data_layer(dm, type);
+}
+
+static void *ccgDM_get_poly_data_layer(DerivedMesh *dm, int type)
+{
+	if (type == CD_ORIGINDEX) {
+		/* create origindex on demand to save memory */
 		CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 		CCGSubSurf *ss = ccgdm->ss;
 		int *origindex;
@@ -2713,13 +2737,13 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
 		int gridFaces = ccgSubSurf_getGridSize(ss) - 1;
 
 		/* Avoid re-creation if the layer exists already */
-		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+		origindex = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
 		if (origindex) {
 			return origindex;
 		}
 
-		DM_add_tessface_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
-		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+		DM_add_poly_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
+		origindex = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
 
 		totface = ccgSubSurf_getNumFaces(ss);
 
@@ -2735,7 +2759,7 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
 		return origindex;
 	}
 
-	return DM_get_tessface_data_layer(dm, type);
+	return DM_get_poly_data_layer(dm, type);
 }
 
 static void *ccgDM_get_vert_data(DerivedMesh *dm, int index, int type)
@@ -2768,6 +2792,16 @@ static void *ccgDM_get_tessface_data(DerivedMesh *dm, int index, int type)
 	return DM_get_tessface_data(dm, index, type);
 }
 
+static void *ccgDM_get_poly_data(DerivedMesh *dm, int index, int type)
+{
+	if (type == CD_ORIGINDEX) {
+		/* ensure creation of CD_ORIGINDEX layer */
+		ccgDM_get_tessface_data_layer(dm, type);
+	}
+
+	return DM_get_poly_data(dm, index, type);
+}
+
 static int ccgDM_getNumGrids(DerivedMesh *dm)
 {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
@@ -2991,7 +3025,8 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
 			 * when the ccgdm gets remade, the assumption is that the topology
 			 * does not change. */
 			ccgdm_create_grids(dm);
-			BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void **)ccgdm->gridFaces);
+			BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void **)ccgdm->gridFaces,
+			                      ccgdm->gridFlagMats, ccgdm->gridHidden);
 		}
 
 		ccgdm->pbvh = ob->sculpt->pbvh;
@@ -3020,6 +3055,9 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
 		                    me->totface, me->totvert, &me->vdata);
 	}
 
+	if (ccgdm->pbvh)
+		pbvh_show_diffuse_color_set(ccgdm->pbvh, ob->sculpt->show_diffuse_color);
+
 	return ccgdm->pbvh;
 }
 
@@ -3095,7 +3133,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	}
 
 	/* We absolutely need that layer, else it's no valid tessellated data! */
-	polyidx = CustomData_add_layer(&ccgdm->dm.faceData, CD_POLYINDEX, CD_CALLOC,
+	polyidx = CustomData_add_layer(&ccgdm->dm.faceData, CD_ORIGINDEX, CD_CALLOC,
 	                               NULL, ccgSubSurf_getNumFinalFaces(ss));
 
 	ccgdm->dm.getMinMax = ccgDM_getMinMax;
@@ -3123,9 +3161,11 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	ccgdm->dm.getVertData = ccgDM_get_vert_data;
 	ccgdm->dm.getEdgeData = ccgDM_get_edge_data;
 	ccgdm->dm.getTessFaceData = ccgDM_get_tessface_data;
+	ccgdm->dm.getPolyData = ccgDM_get_poly_data;
 	ccgdm->dm.getVertDataArray = ccgDM_get_vert_data_layer;
 	ccgdm->dm.getEdgeDataArray = ccgDM_get_edge_data_layer;
 	ccgdm->dm.getTessFaceDataArray = ccgDM_get_tessface_data_layer;
+	ccgdm->dm.getPolyDataArray = ccgDM_get_poly_data_layer;
 	ccgdm->dm.getNumGrids = ccgDM_getNumGrids;
 	ccgdm->dm.getGridSize = ccgDM_getGridSize;
 	ccgdm->dm.getGridData = ccgDM_getGridData;
@@ -3224,8 +3264,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 
 	vertOrigIndex = DM_get_vert_data_layer(&ccgdm->dm, CD_ORIGINDEX);
 	/*edgeOrigIndex = DM_get_edge_data_layer(&ccgdm->dm, CD_ORIGINDEX);*/
-	faceOrigIndex = DM_get_tessface_data_layer(&ccgdm->dm, CD_ORIGINDEX);
 
+	faceOrigIndex = DM_get_tessface_data_layer(&ccgdm->dm, CD_ORIGINDEX);
 	polyOrigIndex = DM_get_poly_data_layer(&ccgdm->dm, CD_ORIGINDEX);
 
 #if 0
@@ -3363,7 +3403,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 					
 					/*set original index data*/
 					if (faceOrigIndex) {
-						*faceOrigIndex = origIndex;
+						/* reference the index in 'polyOrigIndex' */
+						*faceOrigIndex = faceNum;
 						faceOrigIndex++;
 					}
 					if (polyOrigIndex) {
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index 99e3359..ff9774f 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -47,6 +47,7 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
 static char *documentation = NULL;
 //static int doc_lines = 0;
 
+/* TODO, replace with  BLI_strncasecmp() */
 static int txttl_cmp(const char *first, const char *second, int len)
 {
 	int cmp, i;
@@ -113,19 +114,18 @@ short texttool_text_is_active(Text *text)
 
 void texttool_suggest_add(const char *name, char type)
 {
+	const int len = strlen(name);
+	int cmp;
 	SuggItem *newitem, *item;
-	int len, cmp;
 
-	newitem = MEM_mallocN(sizeof(SuggItem) + strlen(name) + 1, "SuggestionItem");
+	newitem = MEM_mallocN(sizeof(SuggItem) + len + 1, "SuggItem");
 	if (!newitem) {
 		printf("Failed to allocate memory for suggestion.\n");
 		return;
 	}
 
 	newitem->name = (char *) (newitem + 1);
-	len = strlen(name);
-	strncpy(newitem->name, name, len);
-	newitem->name[len] = '\0';
+	memcpy(newitem->name, name, len + 1);
 	newitem->type = type;
 	newitem->prev = newitem->next = NULL;
 
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 05d0705..322b77e 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -55,12 +55,15 @@
 #include "DNA_text_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_object_types.h"
+#include "DNA_node_types.h"
+#include "DNA_material_types.h"
 
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_text.h"
+#include "BKE_node.h"
 
 
 #ifdef WITH_PYTHON
@@ -93,17 +96,6 @@
  * If the user moves the cursor the st containing that cursor should
  * be popped ... other st's retain their own top location.
  *
- * Markers
- * --
- * The mrk->flags define the behavior and relationships between markers. The
- * upper two bytes are used to hold a group ID, the lower two are normal flags. If
- * TMARK_EDITALL is set the group ID defines which other markers should be edited.
- *
- * The mrk->clr field is used to visually group markers where the flags may not
- * match. A template system, for example, may allow editing of repeating tokens
- * (in one group) but include other marked positions (in another group) all in the
- * same template with the same color.
- *
  * Undo
  * --
  * Undo/Redo works by storing
@@ -133,8 +125,7 @@
 
 static void txt_pop_first(Text *text);
 static void txt_pop_last(Text *text);
-static void txt_undo_add_op(Text *text, int op);
-static void txt_undo_add_block(Text *text, int op, const char *buf);
+static void txt_undo_add_blockop(Text *text, int op, const char *buf);
 static void txt_delete_line(Text *text, TextLine *line);
 static void txt_delete_sel(Text *text);
 static void txt_make_dirty(Text *text);
@@ -172,7 +163,6 @@ void BKE_text_free(Text *text)
 	}
 	
 	BLI_freelistN(&text->lines);
-	BLI_freelistN(&text->markers);
 
 	if (text->name) MEM_freeN(text->name);
 	MEM_freeN(text->undo_buf);
@@ -200,7 +190,6 @@ Text *BKE_text_add(const char *name)
 		ta->flags |= TXT_TABSTOSPACES;
 
 	ta->lines.first = ta->lines.last = NULL;
-	ta->markers.first = ta->markers.last = NULL;
 
 	tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
 	tmp->line = (char *) MEM_mallocN(1, "textline_string");
@@ -314,7 +303,7 @@ int BKE_text_reload(Text *text)
 	
 	fseek(fp, 0L, SEEK_END);
 	len = ftell(fp);
-	fseek(fp, 0L, SEEK_SET);	
+	fseek(fp, 0L, SEEK_SET);
 
 	text->undo_pos = -1;
 	
@@ -370,7 +359,7 @@ int BKE_text_reload(Text *text)
 	text->curl = text->sell = text->lines.first;
 	text->curc = text->selc = 0;
 	
-	MEM_freeN(buffer);	
+	MEM_freeN(buffer);
 	return 1;
 }
 
@@ -396,7 +385,6 @@ Text *BKE_text_load(const char *file, const char *relpath)
 	ta->id.us = 1;
 
 	ta->lines.first = ta->lines.last = NULL;
-	ta->markers.first = ta->markers.last = NULL;
 	ta->curl = ta->sell = NULL;
 
 	if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE) == 0)
@@ -404,7 +392,7 @@ Text *BKE_text_load(const char *file, const char *relpath)
 
 	fseek(fp, 0L, SEEK_END);
 	len = ftell(fp);
-	fseek(fp, 0L, SEEK_SET);	
+	fseek(fp, 0L, SEEK_SET);
 
 	ta->name = MEM_mallocN(strlen(file) + 1, "text_name");
 	strcpy(ta->name, file);
@@ -469,7 +457,7 @@ Text *BKE_text_load(const char *file, const char *relpath)
 	ta->curl = ta->sell = ta->lines.first;
 	ta->curc = ta->selc = 0;
 	
-	MEM_freeN(buffer);	
+	MEM_freeN(buffer);
 
 	return ta;
 }
@@ -493,7 +481,6 @@ Text *BKE_text_copy(Text *ta)
 	tan->flags = ta->flags | TXT_ISDIRTY;
 	
 	tan->lines.first = tan->lines.last = NULL;
-	tan->markers.first = tan->markers.last = NULL;
 	tan->curl = tan->sell = NULL;
 	
 	tan->nlines = ta->nlines;
@@ -531,6 +518,9 @@ void BKE_text_unlink(Main *bmain, Text *text)
 	bController *cont;
 	bActuator *act;
 	bConstraint *con;
+	bNodeTree *ntree;
+	bNode *node;
+	Material *mat;
 	short update;
 
 	for (ob = bmain->object.first; ob; ob = ob->id.next) {
@@ -582,6 +572,28 @@ void BKE_text_unlink(Main *bmain, Text *text)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 	
+	/* nodes */
+	for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+		ntree = mat->nodetree;
+		if (!ntree)
+			continue;
+		for (node = ntree->nodes.first; node; node = node->next) {
+			if (node->type == SH_NODE_SCRIPT) {
+				Text *ntext = (Text *)node->id;
+				if (ntext == text) node->id = NULL;
+			}
+		}
+	}
+	
+	for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+		for (node = ntree->nodes.first; node; node = node->next) {
+			if (node->type == SH_NODE_SCRIPT) {
+				Text *ntext = (Text *)node->id;
+				if (ntext == text) node->id = NULL;
+			}
+		}
+	}
+	
 	/* text space */
 	for (scr = bmain->screen.first; scr; scr = scr->id.next) {
 		for (area = scr->areabase.first; area; area = area->next) {
@@ -683,7 +695,7 @@ void txt_clean_text(Text *text)
 	if (!text->lines.first) {
 		if (text->lines.last) text->lines.first = text->lines.last;
 		else text->lines.first = text->lines.last = txt_new_line(NULL);
-	} 
+	}
 	
 	if (!text->lines.last) text->lines.last = text->lines.first;
 
@@ -732,7 +744,7 @@ int txt_get_span(TextLine *from, TextLine *to)
 		if (!tmp) ret = 0;
 	}
 
-	return ret;	
+	return ret;
 }
 
 static void txt_make_dirty(Text *text)
@@ -757,23 +769,6 @@ static void txt_curs_sel(Text *text, TextLine ***linep, int **charp)
 	*linep = &text->sell; *charp = &text->selc;
 }
 
-static void txt_curs_first(Text *text, TextLine **linep, int *charp)
-{
-	if (text->curl == text->sell) {
-		*linep = text->curl;
-		if (text->curc < text->selc) *charp = text->curc;
-		else *charp = text->selc;
-	}
-	else if (txt_get_span(text->lines.first, text->curl) < txt_get_span(text->lines.first, text->sell)) {
-		*linep = text->curl;
-		*charp = text->curc;
-	}
-	else {
-		*linep = text->sell;
-		*charp = text->selc;
-	}
-}
-
 /*****************************/
 /* Cursor movement functions */
 /*****************************/
@@ -815,13 +810,11 @@ void txt_move_up(Text *text, short sel)
 {
 	TextLine **linep;
 	int *charp;
-	/* int old; */ /* UNUSED */
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
-	/* old = *charp; */ /* UNUSED */
 
 	if ((*linep)->prev) {
 		int index = txt_utf8_offset_to_index((*linep)->line, *charp);
@@ -829,8 +822,6 @@ void txt_move_up(Text *text, short sel)
 		if (index > txt_utf8_len((*linep)->line)) *charp = (*linep)->len;
 		else *charp = txt_utf8_index_to_offset((*linep)->line, index);
 		
-		if (!undoing)
-			txt_undo_add_op(text, sel ? UNDO_SUP : UNDO_CUP);
 	}
 	else {
 		txt_move_bol(text, sel);
@@ -843,22 +834,17 @@ void txt_move_down(Text *text, short sel)
 {
 	TextLine **linep;
 	int *charp;
-	/* int old; */ /* UNUSED */
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
-	/* old = *charp; */ /* UNUSED */
 
 	if ((*linep)->next) {
 		int index = txt_utf8_offset_to_index((*linep)->line, *charp);
 		*linep = (*linep)->next;
 		if (index > txt_utf8_len((*linep)->line)) *charp = (*linep)->len;
 		else *charp = txt_utf8_index_to_offset((*linep)->line, index);
-		
-		if (!undoing)
-			txt_undo_add_op(text, sel ? UNDO_SDOWN : UNDO_CDOWN);
 	}
 	else {
 		txt_move_eol(text, sel);
@@ -870,7 +856,7 @@ void txt_move_down(Text *text, short sel)
 void txt_move_left(Text *text, short sel) 
 {
 	TextLine **linep;
-	int *charp, oundoing = undoing;
+	int *charp;
 	int tabsize = 0, i = 0;
 	
 	if (!text) return;
@@ -878,8 +864,6 @@ void txt_move_left(Text *text, short sel)
 	else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
-	undoing = 1;
-
 	if (*charp == 0) {
 		if ((*linep)->prev) {
 			txt_move_up(text, sel);
@@ -911,30 +895,25 @@ void txt_move_left(Text *text, short sel)
 		}
 	}
 
-	undoing = oundoing;
-	if (!undoing) txt_undo_add_op(text, sel ? UNDO_SLEFT : UNDO_CLEFT);
-	
 	if (!sel) txt_pop_sel(text);
 }
 
 void txt_move_right(Text *text, short sel) 
 {
 	TextLine **linep;
-	int *charp, oundoing = undoing, do_tab = FALSE, i;
+	int *charp, do_tab = FALSE, i;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
-	undoing = 1;
-
 	if (*charp == (*linep)->len) {
 		if ((*linep)->next) {
 			txt_move_down(text, sel);
 			*charp = 0;
 		}
-	} 
+	}
 	else {
 		// do nice right only if there are only spaces
 		// spaces hardcoded in DNA_text_types.h
@@ -956,124 +935,103 @@ void txt_move_right(Text *text, short sel)
 		else (*charp) += BLI_str_utf8_size((*linep)->line + *charp);
 	}
 	
-	undoing = oundoing;
-	if (!undoing) txt_undo_add_op(text, sel ? UNDO_SRIGHT : UNDO_CRIGHT);
-
 	if (!sel) txt_pop_sel(text);
 }
 
 void txt_jump_left(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, oldc;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
-	oldc = *charp;
 
 	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
 	                         charp, STRCUR_DIR_PREV,
 	                         STRCUR_JUMP_DELIM);
 	
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) {
-		int span = txt_get_span(text->lines.first, *linep);
-		txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
-	}
 }
 
 void txt_jump_right(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, oldc;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
-	oldc = *charp;
 	
 	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
 	                         charp, STRCUR_DIR_NEXT,
 	                         STRCUR_JUMP_DELIM);
 	
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) {
-		int span = txt_get_span(text->lines.first, *linep);
-		txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
-	}
 }
 
 void txt_move_bol(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, old;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
-	old = *charp;
 	
 	*charp = 0;
 
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
 }
 
 void txt_move_eol(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, old;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
-	old = *charp;
-		
+
 	*charp = (*linep)->len;
 
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
 }
 
 void txt_move_bof(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, old;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
-	old = *charp;
 
 	*linep = text->lines.first;
 	*charp = 0;
 
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
 }
 
 void txt_move_eof(Text *text, short sel)
 {
 	TextLine **linep;
-	int *charp, old;
+	int *charp;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
-	old = *charp;
 
 	*linep = text->lines.last;
 	*charp = (*linep)->len;
 
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
 }
 
 void txt_move_toline(Text *text, unsigned int line, short sel)
@@ -1084,16 +1042,14 @@ void txt_move_toline(Text *text, unsigned int line, short sel)
 /* Moves to a certain byte in a line, not a certain utf8-character! */
 void txt_move_to(Text *text, unsigned int line, unsigned int ch, short sel)
 {
-	TextLine **linep, *oldl;
-	int *charp, oldc;
+	TextLine **linep;
+	int *charp;
 	unsigned int i;
 	
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
-	oldc = *charp;
-	oldl = *linep;
 	
 	*linep = text->lines.first;
 	for (i = 0; i < line; i++) {
@@ -1105,7 +1061,6 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, short sel)
 	*charp = ch;
 	
 	if (!sel) txt_pop_sel(text);
-	if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
 }
 
 /****************************/
@@ -1124,8 +1079,6 @@ static void txt_curs_swap(Text *text)
 	tmpc = text->curc;
 	text->curc = text->selc;
 	text->selc = tmpc;
-	
-	if (!undoing) txt_undo_add_op(text, UNDO_SWAP);
 }
 
 static void txt_pop_first(Text *text)
@@ -1136,12 +1089,6 @@ static void txt_pop_first(Text *text)
 	{
 		txt_curs_swap(text);
 	}
-
-	if (!undoing) txt_undo_add_toop(text, UNDO_STO,
-		                            txt_get_span(text->lines.first, text->sell),
-		                            text->selc,
-		                            txt_get_span(text->lines.first, text->curl),
-		                            text->curc);
 	
 	txt_pop_sel(text);
 }
@@ -1153,12 +1100,6 @@ static void txt_pop_last(Text *text)
 	{
 		txt_curs_swap(text);
 	}
-
-	if (!undoing) txt_undo_add_toop(text, UNDO_STO,
-		                            txt_get_span(text->lines.first, text->sell),
-		                            text->selc,
-		                            txt_get_span(text->lines.first, text->curl),
-		                            text->curc);
 	
 	txt_pop_sel(text);
 }
@@ -1194,9 +1135,7 @@ int txt_has_sel(Text *text)
 static void txt_delete_sel(Text *text)
 {
 	TextLine *tmpl;
-	TextMarker *mrk;
 	char *buf;
-	int move, lineno;
 	
 	if (!text) return;
 	if (!text->curl) return;
@@ -1208,33 +1147,11 @@ static void txt_delete_sel(Text *text)
 
 	if (!undoing) {
 		buf = txt_sel_to_buf(text);
-		txt_undo_add_block(text, UNDO_DBLOCK, buf);
+		txt_undo_add_blockop(text, UNDO_DBLOCK, buf);
 		MEM_freeN(buf);
 	}
 
 	buf = MEM_mallocN(text->curc + (text->sell->len - text->selc) + 1, "textline_string");
-	
-	if (text->curl != text->sell) {
-		txt_clear_marker_region(text, text->curl, text->curc, text->curl->len, 0, 0);
-		move = txt_get_span(text->curl, text->sell);
-	}
-	else {
-		mrk = txt_find_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
-		if (mrk && (mrk->start > text->curc || mrk->end < text->selc))
-			txt_clear_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
-		move = 0;
-	}
-
-	mrk = txt_find_marker_region(text, text->sell, text->selc - 1, text->sell->len, 0, 0);
-	if (mrk) {
-		lineno = mrk->lineno;
-		do {
-			mrk->lineno -= move;
-			if (mrk->start > text->curc) mrk->start -= text->selc - text->curc;
-			mrk->end -= text->selc - text->curc;
-			mrk = mrk->next;
-		} while (mrk && mrk->lineno == lineno);
-	}
 
 	strncpy(buf, text->curl->line, text->curc);
 	strcpy(buf + text->curc, text->sell->line + text->selc);
@@ -1376,7 +1293,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
 		int newc = (int)(s - tl->line);
 		txt_move_to(text, newl, newc, 0);
 		txt_move_to(text, newl, newc + strlen(findstr), 1);
-		return 1;				
+		return 1;
 	}
 	else
 		return 0;
@@ -1458,24 +1375,14 @@ char *txt_sel_to_buf(Text *text)
 		length += charl;
 		
 		buf[length] = 0;
-	}	
+	}
 
 	return buf;
 }
 
-static void txt_shift_markers(Text *text, int lineno, int count)
-{
-	TextMarker *marker;
-
-	for (marker = text->markers.first; marker; marker = marker->next)
-		if (marker->lineno >= lineno) {
-			marker->lineno += count;
-		}
-}
-
 void txt_insert_buf(Text *text, const char *in_buffer)
 {
-	int l = 0, u, len, lineno = -1, count = 0;
+	int l = 0, u, len;
 	size_t i = 0, j;
 	TextLine *add;
 	char *buffer;
@@ -1489,7 +1396,7 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 	buffer = BLI_strdupn(in_buffer, len);
 	len += txt_extended_ascii_as_utf8(&buffer);
 	
-	if (!undoing) txt_undo_add_block(text, UNDO_IBLOCK, buffer);
+	if (!undoing) txt_undo_add_blockop(text, UNDO_IBLOCK, buffer);
 
 	u = undoing;
 	undoing = 1;
@@ -1502,9 +1409,6 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 	else { undoing = u; MEM_freeN(buffer); return; }
 	i++;
 
-	/* Read as many full lines as we can */
-	lineno = txt_get_span(text->lines.first, text->curl);
-
 	while (i < len) {
 		l = 0;
 
@@ -1516,14 +1420,8 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 			add = txt_new_linen(buffer + (i - l), l);
 			BLI_insertlinkbefore(&text->lines, text->curl, add);
 			i++;
-			count++;
 		}
 		else {
-			if (count) {
-				txt_shift_markers(text, lineno, count);
-				count = 0;
-			}
-
 			for (j = i - l; j < i && j < len; )
 				txt_add_raw_char(text, BLI_str_utf8_as_unicode_step(buffer, &j));
 			break;
@@ -1532,10 +1430,6 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 	
 	MEM_freeN(buffer);
 
-	if (count) {
-		txt_shift_markers(text, lineno, count);
-	}
-
 	undoing = u;
 }
 
@@ -1571,6 +1465,7 @@ static void dump_buffer(Text *text)
 	while (i++ < text->undo_pos) printf("%d: %d %c\n", i, text->undo_buf[i], text->undo_buf[i]);
 }
 
+/* Note: this function is outdated and must be updated if needed for future use */
 void txt_print_undo(Text *text)
 {
 	int i = 0;
@@ -1587,37 +1482,7 @@ void txt_print_undo(Text *text)
 	while (i <= text->undo_pos) {
 		op = text->undo_buf[i];
 		
-		if (op == UNDO_CLEFT) {
-			ops = "Cursor left";
-		}
-		else if (op == UNDO_CRIGHT) {
-			ops = "Cursor right";
-		}
-		else if (op == UNDO_CUP) {
-			ops = "Cursor up";
-		}
-		else if (op == UNDO_CDOWN) {
-			ops = "Cursor down";
-		}
-		else if (op == UNDO_SLEFT) {
-			ops = "Selection left";
-		}
-		else if (op == UNDO_SRIGHT) {
-			ops = "Selection right";
-		}
-		else if (op == UNDO_SUP) {
-			ops = "Selection up";
-		}
-		else if (op == UNDO_SDOWN) {
-			ops = "Selection down";
-		}
-		else if (op == UNDO_STO) {
-			ops = "Selection ";
-		}
-		else if (op == UNDO_CTO) {
-			ops = "Cursor ";
-		}
-		else if (op == UNDO_INSERT_1) {
+		if (op == UNDO_INSERT_1) {
 			ops = "Insert ascii ";
 		}
 		else if (op == UNDO_INSERT_2) {
@@ -1653,9 +1518,6 @@ void txt_print_undo(Text *text)
 		else if (op == UNDO_DEL_4) {
 			ops = "Delete unicode ";
 		}
-		else if (op == UNDO_SWAP) {
-			ops = "Cursor swap";
-		}
 		else if (op == UNDO_DBLOCK) {
 			ops = "Delete text block";
 		}
@@ -1710,29 +1572,6 @@ void txt_print_undo(Text *text)
 				}
 			}
 		}
-		else if (op == UNDO_STO || op == UNDO_CTO) {
-			i++;
-
-			charp = text->undo_buf[i]; i++;
-			charp = charp + (text->undo_buf[i] << 8); i++;
-
-			linep = text->undo_buf[i]; i++;
-			linep = linep + (text->undo_buf[i] << 8); i++;
-			linep = linep + (text->undo_buf[i] << 16); i++;
-			linep = linep + (text->undo_buf[i] << 24); i++;
-			
-			printf("to <%d, %d> ", linep, charp);
-
-			charp = text->undo_buf[i]; i++;
-			charp = charp + (text->undo_buf[i] << 8); i++;
-
-			linep = text->undo_buf[i]; i++;
-			linep = linep + (text->undo_buf[i] << 8); i++;
-			linep = linep + (text->undo_buf[i] << 16); i++;
-			linep = linep + (text->undo_buf[i] << 24); i++;
-			
-			printf("from <%d, %d>", linep, charp);
-		}
 		else if (op == UNDO_DBLOCK || op == UNDO_IBLOCK) {
 			i++;
 
@@ -1783,16 +1622,6 @@ void txt_print_undo(Text *text)
 	}
 }
 
-static void txt_undo_add_op(Text *text, int op)
-{
-	if (!max_undo_test(text, 2))
-		return;
-	
-	text->undo_pos++;
-	text->undo_buf[text->undo_pos] = op;
-	text->undo_buf[text->undo_pos + 1] = 0;
-}
-
 static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) 
 {
 	undo_buf[*undo_pos] = (value) & 0xff;
@@ -1813,17 +1642,41 @@ static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int va
 	(*undo_pos)++;
 }
 
-static void txt_undo_add_block(Text *text, int op, const char *buf)
+/* store the cur cursor to the undo buffer */
+static void txt_undo_store_cur(Text *text)
+{
+	txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->curc);
+	txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->curl));
+}
+
+/* store the sel cursor to the undo buffer */
+static void txt_undo_store_sel(Text *text)
+{
+	txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->selc);
+	txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->sell));
+}
+
+/* store both cursors to the undo buffer */
+static void txt_undo_store_cursors(Text *text)
+{
+	txt_undo_store_cur(text);
+	txt_undo_store_sel(text);
+}
+
+/* store an operator along with a block of data */
+static void txt_undo_add_blockop(Text *text, int op, const char *buf)
 {
 	unsigned int length = strlen(buf);
 	
-	if (!max_undo_test(text, length + 11))
+	if (!max_undo_test(text, length + 11 + 12))
 		return;
 
 	text->undo_pos++;
 	text->undo_buf[text->undo_pos] = op;
 	text->undo_pos++;
 	
+	txt_undo_store_cursors(text);
+
 	txt_undo_store_uint32(text->undo_buf, &text->undo_pos, length);
 	
 	strncpy(text->undo_buf + text->undo_pos, buf, length);
@@ -1835,34 +1688,30 @@ static void txt_undo_add_block(Text *text, int op, const char *buf)
 	text->undo_buf[text->undo_pos + 1] = 0;
 }
 
-void txt_undo_add_toop(Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc)
+/* store a regular operator */
+void txt_undo_add_op(Text *text, int op)
 {
 	if (!max_undo_test(text, 15))
 		return;
 
-	if (froml == tol && fromc == toc) return;
-
 	text->undo_pos++;
 	text->undo_buf[text->undo_pos] = op;
 
 	text->undo_pos++;
 	
-	txt_undo_store_uint16(text->undo_buf, &text->undo_pos, fromc);
-	txt_undo_store_uint32(text->undo_buf, &text->undo_pos, froml);
-	txt_undo_store_uint16(text->undo_buf, &text->undo_pos, toc);
-	txt_undo_store_uint32(text->undo_buf, &text->undo_pos, tol);
+	txt_undo_store_cursors(text);
 		
 	text->undo_buf[text->undo_pos] = op;
-
 	text->undo_buf[text->undo_pos + 1] = 0;
 }
 
+/* store an operator for a single character */
 static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
 {
 	char utf8[BLI_UTF8_MAX];
 	size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8);
 	
-	if (!max_undo_test(text, 3 + utf8_size))
+	if (!max_undo_test(text, 3 + utf8_size + 12))
 		return;
 	
 	text->undo_pos++;
@@ -1871,6 +1720,8 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
 		text->undo_buf[text->undo_pos] = op_start + utf8_size - 1;
 		text->undo_pos++;
 		
+		txt_undo_store_cur(text);
+
 		for (i = 0; i < utf8_size; i++) {
 			text->undo_buf[text->undo_pos] = utf8[i];
 			text->undo_pos++;
@@ -1881,6 +1732,9 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
 	else {
 		text->undo_buf[text->undo_pos] = op_start + 3;
 		text->undo_pos++;
+
+		txt_undo_store_cursors(text);
+
 		txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c);
 		text->undo_buf[text->undo_pos] = op_start + 3;
 	}
@@ -1906,6 +1760,29 @@ static unsigned int txt_undo_read_uint32(const char *undo_buf, int *undo_pos)
 	return val;
 }
 
+/* read the cur cursor from the undo buffer */
+static void txt_undo_read_cur(const char *undo_buf, int *undo_pos, unsigned int *curln, unsigned short *curc)
+{
+	*curln = txt_undo_read_uint32(undo_buf, undo_pos);
+	*curc  = txt_undo_read_uint16(undo_buf, undo_pos);
+}
+
+/* read the sel cursor from the undo buffer */
+static void txt_undo_read_sel(const char *undo_buf, int *undo_pos, unsigned int *selln, unsigned short *selc)
+{
+	*selln = txt_undo_read_uint32(undo_buf, undo_pos);
+	*selc  = txt_undo_read_uint16(undo_buf, undo_pos);
+}
+
+/* read both cursors from the undo buffer */
+static void txt_undo_read_cursors(const char *undo_buf, int *undo_pos,
+                                  unsigned int *curln, unsigned short *curc,
+                                  unsigned int *selln, unsigned short *selc)
+{
+	txt_undo_read_sel(undo_buf, undo_pos, selln, selc);
+	txt_undo_read_cur(undo_buf, undo_pos, curln, curc);
+}
+
 static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, short bytes)
 {
 	unsigned int unicode;
@@ -1958,6 +1835,29 @@ static unsigned int txt_redo_read_uint32(const char *undo_buf, int *undo_pos)
 	return val;
 }
 
+/* redo read cur cursor from the undo buffer */
+static void txt_redo_read_cur(const char *undo_buf, int *undo_pos, unsigned int *curln, unsigned short *curc)
+{
+	*curc  = txt_redo_read_uint16(undo_buf, undo_pos);
+	*curln = txt_redo_read_uint32(undo_buf, undo_pos);
+}
+
+/* redo read sel cursor from the undo buffer */
+static void txt_redo_read_sel(const char *undo_buf, int *undo_pos, unsigned int *selln, unsigned short *selc)
+{
+	*selc  = txt_redo_read_uint16(undo_buf, undo_pos);
+	*selln = txt_redo_read_uint32(undo_buf, undo_pos);
+}
+
+/* redo read both cursors from the undo buffer */
+static void txt_redo_read_cursors(const char *undo_buf, int *undo_pos,
+                                  unsigned int *curln, unsigned short *curc,
+                                  unsigned int *selln, unsigned short *selc)
+{
+	txt_redo_read_cur(undo_buf, undo_pos, curln, curc);
+	txt_redo_read_sel(undo_buf, undo_pos, selln, selc);
+}
+
 static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, short bytes)
 {
 	unsigned int unicode;
@@ -1996,9 +1896,10 @@ void txt_do_undo(Text *text)
 {
 	int op = text->undo_buf[text->undo_pos];
 	unsigned int linep, i;
+	unsigned int uchar;
+	unsigned int curln, selln;
+	unsigned short curc, selc;
 	unsigned short charp;
-	TextLine *holdl;
-	int holdc, holdln;
 	char *buf;
 	
 	if (text->undo_pos < 0) {
@@ -2010,88 +1911,60 @@ void txt_do_undo(Text *text)
 	undoing = 1;
 	
 	switch (op) {
-		case UNDO_CLEFT:
-			txt_move_right(text, 0);
-			break;
+		case UNDO_INSERT_1:
+		case UNDO_INSERT_2:
+		case UNDO_INSERT_3:
+		case UNDO_INSERT_4:
+			text->undo_pos -= op - UNDO_INSERT_1 + 1;
 			
-		case UNDO_CRIGHT:
-			txt_move_left(text, 0);
-			break;
+			/* get and restore the cursors */
+			txt_undo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
 			
-		case UNDO_CUP:
-			txt_move_down(text, 0);
-			break;
+			txt_delete_char(text);
 			
-		case UNDO_CDOWN:
-			txt_move_up(text, 0);
-			break;
-
-		case UNDO_SLEFT:
-			txt_move_right(text, 1);
-			break;
-
-		case UNDO_SRIGHT:
-			txt_move_left(text, 1);
-			break;
-
-		case UNDO_SUP:
-			txt_move_down(text, 1);
+			text->undo_pos--;
 			break;
 
-		case UNDO_SDOWN:
-			txt_move_up(text, 1);
-			break;
-		
-		case UNDO_CTO:
-		case UNDO_STO:
-			text->undo_pos--;
-			text->undo_pos--;
-			text->undo_pos--;
-			text->undo_pos--;
-		
-			text->undo_pos--;
-			text->undo_pos--;
-		
-			linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
-			charp = txt_undo_read_uint16(text->undo_buf, &text->undo_pos);
-			
-			if (op == UNDO_CTO) {
-				txt_move_toline(text, linep, 0);
-				text->curc = charp;
-				txt_pop_sel(text);
-			}
-			else {
-				txt_move_toline(text, linep, 1);
-				text->selc = charp;
-			}
+		case UNDO_BS_1:
+		case UNDO_BS_2:
+		case UNDO_BS_3:
+		case UNDO_BS_4:
+			charp = op - UNDO_BS_1 + 1;
+			uchar = txt_undo_read_unicode(text->undo_buf, &text->undo_pos, charp);
 			
-			text->undo_pos--;
-			break;
+			/* get and restore the cursors */
+			txt_undo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
 			
-		case UNDO_INSERT_1: case UNDO_INSERT_2: case UNDO_INSERT_3: case UNDO_INSERT_4:
-			txt_backspace_char(text);
-			text->undo_pos -= op - UNDO_INSERT_1 + 1;
+			txt_add_char(text, uchar);
+
 			text->undo_pos--;
 			break;
 
-		case UNDO_BS_1: case UNDO_BS_2: case UNDO_BS_3: case UNDO_BS_4:
-			charp = op - UNDO_BS_1 + 1;
-			txt_add_char(text, txt_undo_read_unicode(text->undo_buf, &text->undo_pos, charp));
-			text->undo_pos--;
-			break;		
-			
-		case UNDO_DEL_1: case UNDO_DEL_2: case UNDO_DEL_3: case UNDO_DEL_4: 
+		case UNDO_DEL_1:
+		case UNDO_DEL_2:
+		case UNDO_DEL_3:
+		case UNDO_DEL_4:
 			charp = op - UNDO_DEL_1 + 1;
-			txt_add_char(text, txt_undo_read_unicode(text->undo_buf, &text->undo_pos, charp));
+			uchar = txt_undo_read_unicode(text->undo_buf, &text->undo_pos, charp);
+
+			/* get and restore the cursors */
+			txt_undo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
+
+			txt_add_char(text, uchar);
+
 			txt_move_left(text, 0);
-			text->undo_pos--;
-			break;
 
-		case UNDO_SWAP:
-			txt_curs_swap(text);
+			text->undo_pos--;
 			break;
 
 		case UNDO_DBLOCK:
+			/* length of the string in the buffer */
 			linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
 
 			buf = MEM_mallocN(linep + 1, "dblock buffer");
@@ -2100,34 +1973,33 @@ void txt_do_undo(Text *text)
 				text->undo_pos--;
 			}
 			buf[i] = 0;
-			
-			txt_curs_first(text, &holdl, &holdc);
-			holdln = txt_get_span(text->lines.first, holdl);
-			
-			txt_insert_buf(text, buf);			
-			MEM_freeN(buf);
-
-			text->curl = text->lines.first;
-			while (holdln > 0) {
-				if (text->curl->next)
-					text->curl = text->curl->next;
-					
-				holdln--;
-			}
-			text->curc = holdc;
 
+			/* skip over the length that was stored again */
 			text->undo_pos--;
 			text->undo_pos--;
 			text->undo_pos--; 
 			text->undo_pos--;
 
+			/* Get the cursor positions */
+			txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+
+			/* move cur to location that needs buff inserted */
+			txt_move_to(text, curln, curc, 0);
+			
+			txt_insert_buf(text, buf);
+			MEM_freeN(buf);
+
+			/* restore the cursors */
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
+
 			text->undo_pos--;
 			
 			break;
 
 		case UNDO_IBLOCK:
+			/* length of the string in the buffer */
 			linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
-			txt_delete_sel(text);
 			
 			/* txt_backspace_char removes utf8-characters, not bytes */
 			buf = MEM_mallocN(linep + 1, "iblock buffer");
@@ -2139,47 +2011,38 @@ void txt_do_undo(Text *text)
 			linep = txt_utf8_len(buf);
 			MEM_freeN(buf);
 			
-			while (linep > 0) {
-				txt_backspace_char(text);
-				linep--;
-			}
-			
+			/* skip over the length that was stored again */
 			text->undo_pos--;
 			text->undo_pos--;
-			text->undo_pos--; 
 			text->undo_pos--;
-			
 			text->undo_pos--;
+
+			/* get and restore the cursors */
+			txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+			
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
+			
+			if ((curln == selln) && (curc == selc)) {
+				for (i = 0; i < linep; i++)
+					txt_move_right(text, 1);
+			}
+			
+			txt_delete_selected(text);
 			
+			text->undo_pos--;
 			break;
 		case UNDO_INDENT:
 		case UNDO_UNINDENT:
 		case UNDO_COMMENT:
 		case UNDO_UNCOMMENT:
-			linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
-			//linep is now the end line of the selection
-			
-			charp = txt_undo_read_uint16(text->undo_buf, &text->undo_pos);
-			//charp is the last char selected or text->line->len
-			
-			//set the selection for this now
-			text->selc = charp;
-			text->sell = text->lines.first;
-			for (i = 0; i < linep; i++) {
-				text->sell = text->sell->next;
-			}
-			
-			linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
-			//first line to be selected
-			
-			charp = txt_undo_read_uint16(text->undo_buf, &text->undo_pos);
-			//first postion to be selected
-			text->curc = charp;
-			text->curl = text->lines.first;
-			for (i = 0; i < linep; i++) {
-				text->curl = text->curl->next;
-			}
-			
+		case UNDO_DUPLICATE:
+		case UNDO_MOVE_LINES_UP:
+		case UNDO_MOVE_LINES_DOWN:
+			/* get and restore the cursors */
+			txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
 			
 			if (op == UNDO_INDENT) {
 				txt_unindent(text);
@@ -2193,37 +2056,24 @@ void txt_do_undo(Text *text)
 			else if (op == UNDO_UNCOMMENT) {
 				txt_comment(text);
 			}
+			else if (op == UNDO_DUPLICATE) {
+				txt_delete_line(text, text->curl->next);
+			}
+			else if (op == UNDO_MOVE_LINES_UP) {
+				txt_move_lines(text, TXT_MOVE_LINE_DOWN);
+			}
+			else if (op == UNDO_MOVE_LINES_DOWN) {
+				txt_move_lines(text, TXT_MOVE_LINE_UP);
+			}
 			
 			text->undo_pos--;
 			break;
-		case UNDO_DUPLICATE:
-			txt_delete_line(text, text->curl->next);
-			break;
-		case UNDO_MOVE_LINES_UP:
-			txt_move_lines(text, TXT_MOVE_LINE_DOWN);
-			break;
-		case UNDO_MOVE_LINES_DOWN:
-			txt_move_lines(text, TXT_MOVE_LINE_UP);
-			break;
 		default:
 			//XXX error("Undo buffer error - resetting");
 			text->undo_pos = -1;
 			
 			break;
 	}
-
-	/* next undo step may need evaluating */
-	if (text->undo_pos >= 0) {
-		switch (text->undo_buf[text->undo_pos]) {
-			case UNDO_STO:
-				txt_do_undo(text);
-				txt_do_redo(text); /* selections need restoring */
-				break;
-			case UNDO_SWAP:
-				txt_do_undo(text); /* swaps should appear transparent */
-				break;
-		}
-	}
 	
 	undoing = 0;
 }
@@ -2231,11 +2081,14 @@ void txt_do_undo(Text *text)
 void txt_do_redo(Text *text)
 {
 	char op;
-	unsigned int linep, i;
-	unsigned short charp;
 	char *buf;
+	unsigned int linep;
+	unsigned short charp;
+	unsigned int uchar;
+	unsigned int curln, selln;
+	unsigned short curc, selc;
 	
-	text->undo_pos++;	
+	text->undo_pos++;
 	op = text->undo_buf[text->undo_pos];
 	
 	if (!op) {
@@ -2246,104 +2099,91 @@ void txt_do_redo(Text *text)
 	undoing = 1;
 
 	switch (op) {
-		case UNDO_CLEFT:
-			txt_move_left(text, 0);
-			break;
+		case UNDO_INSERT_1:
+		case UNDO_INSERT_2:
+		case UNDO_INSERT_3:
+		case UNDO_INSERT_4:
+			text->undo_pos++;
 			
-		case UNDO_CRIGHT:
-			txt_move_right(text, 0);
-			break;
+			/* get and restore the cursors */
+			txt_redo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
 			
-		case UNDO_CUP:
-			txt_move_up(text, 0);
-			break;
-			
-		case UNDO_CDOWN:
-			txt_move_down(text, 0);
-			break;
-
-		case UNDO_SLEFT:
-			txt_move_left(text, 1);
-			break;
-
-		case UNDO_SRIGHT:
-			txt_move_right(text, 1);
-			break;
-
-		case UNDO_SUP:
-			txt_move_up(text, 1);
-			break;
-
-		case UNDO_SDOWN:
-			txt_move_down(text, 1);
-			break;
-		
-		case UNDO_INSERT_1: case UNDO_INSERT_2: case UNDO_INSERT_3: case UNDO_INSERT_4:
-			text->undo_pos++;
 			charp = op - UNDO_INSERT_1 + 1;
-			txt_add_char(text, txt_redo_read_unicode(text->undo_buf, &text->undo_pos, charp));
-			break;
+			uchar = txt_redo_read_unicode(text->undo_buf, &text->undo_pos, charp);
 
-		case UNDO_BS_1: case UNDO_BS_2: case UNDO_BS_3: case UNDO_BS_4:
-			text->undo_pos++;
-			txt_backspace_char(text);
-			text->undo_pos += op - UNDO_BS_1 + 1;
+			txt_add_char(text, uchar);
 			break;
 
-		case UNDO_DEL_1: case UNDO_DEL_2: case UNDO_DEL_3: case UNDO_DEL_4:
+		case UNDO_BS_1:
+		case UNDO_BS_2:
+		case UNDO_BS_3:
+		case UNDO_BS_4:
 			text->undo_pos++;
-			txt_delete_char(text);
-			text->undo_pos += op - UNDO_DEL_1 + 1;
-			break;
 
-		case UNDO_SWAP:
-			txt_curs_swap(text);
-			txt_do_redo(text); /* swaps should appear transparent a*/
-			break;
+			/* get and restore the cursors */
+			txt_redo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
+
+			text->undo_pos += op - UNDO_BS_1 + 1;
 			
-		case UNDO_CTO:
-		case UNDO_STO:
-			text->undo_pos++;
-			text->undo_pos++;
+			/* move right so we backspace the correct char */
+			txt_move_right(text, 0);
+			txt_backspace_char(text);
 
-			text->undo_pos++;
-			text->undo_pos++;
-			text->undo_pos++;
-			text->undo_pos++;
+			break;
 
+		case UNDO_DEL_1:
+		case UNDO_DEL_2:
+		case UNDO_DEL_3:
+		case UNDO_DEL_4:
 			text->undo_pos++;
 
-			charp = txt_redo_read_uint16(text->undo_buf, &text->undo_pos);
-			linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos);
+			/* get and restore the cursors */
+			txt_redo_read_cur(text->undo_buf, &text->undo_pos, &curln, &curc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
 			
-			if (op == UNDO_CTO) {
-				txt_move_toline(text, linep, 0);
-				text->curc = charp;
-				txt_pop_sel(text);
-			}
-			else {
-				txt_move_toline(text, linep, 1);
-				text->selc = charp;
-			}
+			text->undo_pos += op - UNDO_DEL_1 + 1;
+
+			txt_delete_char(text);
 
 			break;
 
 		case UNDO_DBLOCK:
 			text->undo_pos++;
+
+			/* get and restore the cursors */
+			txt_redo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
+
+			/* length of the block */
 			linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos);
-			txt_delete_sel(text);
 			
 			text->undo_pos += linep;
 
+			/* skip over the length that was stored again */
 			text->undo_pos++;
 			text->undo_pos++;
 			text->undo_pos++; 
 			text->undo_pos++;
 			
+			txt_delete_sel(text);
+
 			break;
 
 		case UNDO_IBLOCK:
 			text->undo_pos++;
+
+			/* get and restore the cursors */
+			txt_redo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, curln, curc, 1);
+
+			/* length of the block */
 			linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos);
 
 			buf = MEM_mallocN(linep + 1, "iblock buffer");
@@ -2351,43 +2191,30 @@ void txt_do_redo(Text *text)
 			text->undo_pos += linep;
 			buf[linep] = 0;
 			
-			txt_insert_buf(text, buf);			
+			txt_insert_buf(text, buf);
 			MEM_freeN(buf);
 
+			/* skip over the length that was stored again */
 			text->undo_pos++;
 			text->undo_pos++;
 			text->undo_pos++; 
 			text->undo_pos++;
+
 			break;
 			
 		case UNDO_INDENT:
 		case UNDO_UNINDENT:
 		case UNDO_COMMENT:
 		case UNDO_UNCOMMENT:
+		case UNDO_DUPLICATE:
+		case UNDO_MOVE_LINES_UP:
+		case UNDO_MOVE_LINES_DOWN:
 			text->undo_pos++;
-			charp = txt_redo_read_uint16(text->undo_buf, &text->undo_pos);
-			//charp is the first char selected or 0
-			
-			linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos);
-			//linep is now the first line of the selection			
-			//set the selcetion for this now
-			text->curc = charp;
-			text->curl = text->lines.first;
-			for (i = 0; i < linep; i++) {
-				text->curl = text->curl->next;
-			}
-			
-			charp = txt_redo_read_uint16(text->undo_buf, &text->undo_pos);
-			//last postion to be selected
-			
-			linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos);
-			//Last line to be selected
-			
-			text->selc = charp;
-			text->sell = text->lines.first;
-			for (i = 0; i < linep; i++) {
-				text->sell = text->sell->next;
-			}
+
+			/* get and restore the cursors */
+			txt_redo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc);
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
 
 			if (op == UNDO_INDENT) {
 				txt_indent(text);
@@ -2401,15 +2228,28 @@ void txt_do_redo(Text *text)
 			else if (op == UNDO_UNCOMMENT) {
 				txt_uncomment(text);
 			}
-			break;
-		case UNDO_DUPLICATE:
-			txt_duplicate_line(text);
-			break;
-		case UNDO_MOVE_LINES_UP:
-			txt_move_lines(text, TXT_MOVE_LINE_UP);
-			break;
-		case UNDO_MOVE_LINES_DOWN:
-			txt_move_lines(text, TXT_MOVE_LINE_DOWN);
+			else if (op == UNDO_DUPLICATE) {
+				txt_duplicate_line(text);
+			}
+			else if (op == UNDO_MOVE_LINES_UP) {
+				/* offset the cursor by + 1 */
+				txt_move_to(text, curln + 1, curc, 0);
+				txt_move_to(text, selln + 1, selc, 1);
+
+				txt_move_lines(text, TXT_MOVE_LINE_UP);
+			}
+			else if (op == UNDO_MOVE_LINES_DOWN) {
+				/* offset the cursor by - 1 */
+				txt_move_to(text, curln - 1, curc, 0);
+				txt_move_to(text, selln - 1, selc, 1);
+
+				txt_move_lines(text, TXT_MOVE_LINE_DOWN);
+			}
+
+			/* re-restore the cursors since they got moved when redoing */
+			txt_move_to(text, curln, curc, 0);
+			txt_move_to(text, selln, selc, 1);
+
 			break;
 		default:
 			//XXX error("Undo buffer error - resetting");
@@ -2428,31 +2268,15 @@ void txt_do_redo(Text *text)
 void txt_split_curline(Text *text)
 {
 	TextLine *ins;
-	TextMarker *mrk;
 	char *left, *right;
-	int lineno = -1;
 	
 	if (!text) return;
 	if (!text->curl) return;
 
 	txt_delete_sel(text);
 
-	/* Move markers */
-
-	lineno = txt_get_span(text->lines.first, text->curl);
-	mrk = text->markers.first;
-	while (mrk) {
-		if (mrk->lineno == lineno && mrk->start > text->curc) {
-			mrk->lineno++;
-			mrk->start -= text->curc;
-			mrk->end -= text->curc;
-		}
-		else if (mrk->lineno > lineno) {
-			mrk->lineno++;
-		}
-		mrk = mrk->next;
-	}
-
+	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n');
+	
 	/* Make the two half strings */
 
 	left = MEM_mallocN(text->curc + 1, "textline_string");
@@ -2476,7 +2300,7 @@ void txt_split_curline(Text *text)
 	text->curl->format = NULL;
 	text->curl->len = text->curl->len - text->curc;
 	
-	BLI_insertlinkbefore(&text->lines, text->curl, ins);	
+	BLI_insertlinkbefore(&text->lines, text->curl, ins);
 	
 	text->curc = 0;
 	
@@ -2484,28 +2308,13 @@ void txt_split_curline(Text *text)
 	txt_clean_text(text);
 	
 	txt_pop_sel(text);
-	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n');
 }
 
 static void txt_delete_line(Text *text, TextLine *line)
 {
-	TextMarker *mrk = NULL, *nxt;
-	int lineno = -1;
-
 	if (!text) return;
 	if (!text->curl) return;
 
-	lineno = txt_get_span(text->lines.first, line);
-	mrk = text->markers.first;
-	while (mrk) {
-		nxt = mrk->next;
-		if (mrk->lineno == lineno)
-			BLI_freelinkN(&text->markers, mrk);
-		else if (mrk->lineno > lineno)
-			mrk->lineno--;
-		mrk = nxt;
-	}
-
 	BLI_remlink(&text->lines, line);
 	
 	if (line->line) MEM_freeN(line->line);
@@ -2520,25 +2329,12 @@ static void txt_delete_line(Text *text, TextLine *line)
 static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
 {
 	char *tmp;
-	TextMarker *mrk = NULL;
-	int lineno = -1;
-	
+
 	if (!text) return;
 	
 	if (!linea || !lineb) return;
 
-	mrk = txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
-	if (mrk) {
-		lineno = mrk->lineno;
-		do {
-			mrk->lineno--;
-			mrk->start += linea->len;
-			mrk->end += linea->len;
-			mrk = mrk->next;
-		} while (mrk && mrk->lineno == lineno);
-	}
-	if (lineno == -1) lineno = txt_get_span(text->lines.first, lineb);
-	
+
 	tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string");
 	
 	strcpy(tmp, linea->line);
@@ -2591,27 +2387,7 @@ void txt_delete_char(Text *text)
 	}
 	else { /* Just deleting a char */
 		size_t c_len = 0;
-		TextMarker *mrk;
 		c = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len);
-
-		mrk = txt_find_marker_region(text, text->curl, text->curc - c_len, text->curl->len, 0, 0);
-		if (mrk) {
-			int lineno = mrk->lineno;
-			if (mrk->end == text->curc) {
-				if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
-					txt_clear_markers(text, mrk->group, TMARK_TEMP);
-				}
-				else {
-					BLI_freelinkN(&text->markers, mrk);
-				}
-				return;
-			}
-			do {
-				if (mrk->start > text->curc) mrk->start -= c_len;
-				mrk->end -= c_len;
-				mrk = mrk->next;
-			} while (mrk && mrk->lineno == lineno);
-		}
 		
 		memmove(text->curl->line + text->curc, text->curl->line + text->curc + c_len, text->curl->len - text->curc - c_len + 1);
 
@@ -2655,28 +2431,8 @@ void txt_backspace_char(Text *text)
 	}
 	else { /* Just backspacing a char */
 		size_t c_len = 0;
-		TextMarker *mrk;
 		char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
 		c = BLI_str_utf8_as_unicode_and_size(prev, &c_len);
-
-		mrk = txt_find_marker_region(text, text->curl, text->curc - c_len, text->curl->len, 0, 0);
-		if (mrk) {
-			int lineno = mrk->lineno;
-			if (mrk->start == text->curc) {
-				if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
-					txt_clear_markers(text, mrk->group, TMARK_TEMP);
-				}
-				else {
-					BLI_freelinkN(&text->markers, mrk);
-				}
-				return;
-			}
-			do {
-				if (mrk->start > text->curc - c_len) mrk->start -= c_len;
-				mrk->end -= c_len;
-				mrk = mrk->next;
-			} while (mrk && mrk->lineno == lineno);
-		}
 		
 		/* source and destination overlap, don't use memcpy() */
 		memmove(text->curl->line + text->curc - c_len,
@@ -2718,9 +2474,7 @@ static void txt_convert_tab_to_spaces(Text *text)
 
 static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs)
 {
-	int lineno;
 	char *tmp, ch[BLI_UTF8_MAX];
-	TextMarker *mrk;
 	size_t add_len;
 	
 	if (!text) return 0;
@@ -2739,16 +2493,9 @@ static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs)
 
 	txt_delete_sel(text);
 	
+	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
+
 	add_len = BLI_str_utf8_from_unicode(add, ch);
-	mrk = txt_find_marker_region(text, text->curl, text->curc - 1, text->curl->len, 0, 0);
-	if (mrk) {
-		lineno = mrk->lineno;
-		do {
-			if (mrk->start > text->curc) mrk->start += add_len;
-			mrk->end += add_len;
-			mrk = mrk->next;
-		} while (mrk && mrk->lineno == lineno);
-	}
 	
 	tmp = MEM_mallocN(text->curl->len + add_len + 1, "textline_string");
 	
@@ -2765,7 +2512,6 @@ static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs)
 	txt_make_dirty(text);
 	txt_clean_text(text);
 
-	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
 	return 1;
 }
 
@@ -2796,10 +2542,7 @@ int txt_replace_char(Text *text, unsigned int add)
 
 	/* If text is selected or we're at the end of the line just use txt_add_char */
 	if (text->curc == text->curl->len || txt_has_sel(text) || add == '\n') {
-		int i = txt_add_char(text, add);
-		TextMarker *mrk = txt_find_marker(text, text->curl, text->curc, 0, 0);
-		if (mrk) BLI_freelinkN(&text->markers, mrk);
-		return i;
+		return txt_add_char(text, add);
 	}
 	
 	del = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &del_size);
@@ -2826,15 +2569,15 @@ int txt_replace_char(Text *text, unsigned int add)
 
 	/* Should probably create a new op for this */
 	if (!undoing) {
-		txt_undo_add_charop(text, UNDO_DEL_1, del);
 		txt_undo_add_charop(text, UNDO_INSERT_1, add);
+		txt_undo_add_charop(text, UNDO_DEL_1, del);
 	}
 	return 1;
 }
 
 void txt_indent(Text *text)
 {
-	int len, num;
+	int len, num, curc_old;
 	char *tmp;
 
 	const char *add = "\t";
@@ -2857,6 +2600,8 @@ void txt_indent(Text *text)
 		indentlen = spaceslen;
 	}
 
+	curc_old = text->curc;
+
 	num = 0;
 	while (TRUE) {
 		tmp = MEM_mallocN(text->curl->len + indentlen + 1, "textline_string");
@@ -2877,7 +2622,7 @@ void txt_indent(Text *text)
 		txt_clean_text(text);
 		
 		if (text->curl == text->sell) {
-			text->selc = text->sell->len;
+			text->selc += indentlen;
 			break;
 		}
 		else {
@@ -2885,14 +2630,16 @@ void txt_indent(Text *text)
 			num++;
 		}
 	}
-	text->curc = 0;
+	if (!curc_old) text->curc = 0;
+	else text->curc = curc_old + indentlen;
+
 	while (num > 0) {
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
 	if (!undoing) {
-		txt_undo_add_toop(text, UNDO_INDENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
+		txt_undo_add_op(text, UNDO_INDENT);
 	}
 }
 
@@ -2900,7 +2647,8 @@ void txt_unindent(Text *text)
 {
 	int num = 0;
 	const char *remove = "\t";
-	int indent = 1;
+	int indentlen = 1;
+	int unindented_first = FALSE;
 	
 	/* hardcoded: TXT_TABSIZE = 4 spaces: */
 	int spaceslen = TXT_TABSIZE;
@@ -2912,25 +2660,26 @@ void txt_unindent(Text *text)
 	/* insert spaces rather than tabs */
 	if (text->flags & TXT_TABSTOSPACES) {
 		remove = tab_to_spaces;
-		indent = spaceslen;
+		indentlen = spaceslen;
 	}
 
 	while (TRUE) {
 		int i = 0;
 		
-		if (BLI_strncasecmp(text->curl->line, remove, indent) == 0) {
+		if (BLI_strncasecmp(text->curl->line, remove, indentlen) == 0) {
+			if (num == 0) unindented_first = TRUE;
 			while (i < text->curl->len) {
-				text->curl->line[i] = text->curl->line[i + indent];
+				text->curl->line[i] = text->curl->line[i + indentlen];
 				i++;
 			}
-			text->curl->len -= indent;
+			text->curl->len -= indentlen;
 		}
 	
 		txt_make_dirty(text);
 		txt_clean_text(text);
 		
 		if (text->curl == text->sell) {
-			text->selc = text->sell->len;
+			if (i > 0) text->selc = MAX2(text->selc - indentlen, 0);
 			break;
 		}
 		else {
@@ -2939,14 +2688,16 @@ void txt_unindent(Text *text)
 		}
 		
 	}
-	text->curc = 0;
+
+	if (unindented_first) text->curc = MAX2(text->curc - indentlen, 0);
+
 	while (num > 0) {
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
 	if (!undoing) {
-		txt_undo_add_toop(text, UNDO_UNINDENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
+		txt_undo_add_op(text, UNDO_UNINDENT);
 	}
 }
 
@@ -2995,7 +2746,7 @@ void txt_comment(Text *text)
 	}
 	
 	if (!undoing) {
-		txt_undo_add_toop(text, UNDO_COMMENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
+		txt_undo_add_op(text, UNDO_COMMENT);
 	}
 }
 
@@ -3040,7 +2791,7 @@ void txt_uncomment(Text *text)
 	}
 	
 	if (!undoing) {
-		txt_undo_add_toop(text, UNDO_UNCOMMENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
+		txt_undo_add_op(text, UNDO_UNCOMMENT);
 	}
 }
 
@@ -3129,157 +2880,6 @@ int setcurr_tab_spaces(Text *text, int space)
 	return i;
 }
 
-/*********************************/
-/* Text marker utility functions */
-/*********************************/
-
-/* Creates and adds a marker to the list maintaining sorted order */
-void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags)
-{
-	TextMarker *tmp, *marker;
-
-	marker = MEM_mallocN(sizeof(TextMarker), "text_marker");
-	
-	marker->lineno = txt_get_span(text->lines.first, line);
-	marker->start = MIN2(start, end);
-	marker->end = MAX2(start, end);
-	marker->group = group;
-	marker->flags = flags;
-
-	marker->color[0] = color[0];
-	marker->color[1] = color[1];
-	marker->color[2] = color[2];
-	marker->color[3] = color[3];
-
-	for (tmp = text->markers.last; tmp; tmp = tmp->prev)
-		if (tmp->lineno < marker->lineno || (tmp->lineno == marker->lineno && tmp->start < marker->start))
-			break;
-
-	if (tmp) BLI_insertlinkafter(&text->markers, tmp, marker);
-	else BLI_addhead(&text->markers, marker);
-}
-
-/* Returns the first matching marker on the specified line between two points.
- * If the group or flags fields are non-zero the returned flag must be in the
- * specified group and have at least the specified flags set. */
-TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
-{
-	TextMarker *marker, *next;
-	int lineno = txt_get_span(text->lines.first, line);
-	
-	for (marker = text->markers.first; marker; marker = next) {
-		next = marker->next;
-
-		if      (group && marker->group != group) continue;
-		else if ((marker->flags & flags) != flags) continue;
-		else if (marker->lineno < lineno) continue;
-		else if (marker->lineno > lineno) break;
-
-		if ((marker->start == marker->end && start <= marker->start && marker->start <= end) ||
-		    (marker->start < end && marker->end > start))
-		{
-			return marker;
-		}
-	}
-	return NULL;
-}
-
-/* Clears all markers on the specified line between two points. If the group or
- * flags fields are non-zero the returned flag must be in the specified group
- * and have at least the specified flags set. */
-short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
-{
-	TextMarker *marker, *next;
-	int lineno = txt_get_span(text->lines.first, line);
-	short cleared = 0;
-	
-	for (marker = text->markers.first; marker; marker = next) {
-		next = marker->next;
-
-		if (group && marker->group != group) continue;
-		else if ((marker->flags & flags) != flags) continue;
-		else if (marker->lineno < lineno) continue;
-		else if (marker->lineno > lineno) break;
-
-		if ((marker->start == marker->end && start <= marker->start && marker->start <= end) ||
-		    (marker->start < end && marker->end > start))
-		{
-			BLI_freelinkN(&text->markers, marker);
-			cleared = 1;
-		}
-	}
-	return cleared;
-}
-
-/* Clears all markers in the specified group (if given) with at least the
- * specified flags set. Useful for clearing temporary markers (group = 0,
- * flags = TMARK_TEMP) */
-short txt_clear_markers(Text *text, int group, int flags)
-{
-	TextMarker *marker, *next;
-	short cleared = 0;
-	
-	for (marker = text->markers.first; marker; marker = next) {
-		next = marker->next;
-
-		if ((!group || marker->group == group) &&
-		    (marker->flags & flags) == flags)
-		{
-			BLI_freelinkN(&text->markers, marker);
-			cleared = 1;
-		}
-	}
-	return cleared;
-}
-
-/* Finds the marker at the specified line and cursor position with at least the
- * specified flags set in the given group (if non-zero). */
-TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags)
-{
-	TextMarker *marker;
-	int lineno = txt_get_span(text->lines.first, line);
-	
-	for (marker = text->markers.first; marker; marker = marker->next) {
-		if (group && marker->group != group) continue;
-		else if ((marker->flags & flags) != flags) continue;
-		else if (marker->lineno < lineno) continue;
-		else if (marker->lineno > lineno) break;
-
-		if (marker->start <= curs && curs <= marker->end)
-			return marker;
-	}
-	return NULL;
-}
-
-/* Finds the previous marker in the same group. If no other is found, the same
- * marker will be returned */
-TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
-{
-	TextMarker *tmp = marker;
-	while (tmp) {
-		if (tmp->prev) tmp = tmp->prev;
-		else tmp = text->markers.last;
-		if (tmp->group == marker->group)
-			return tmp;
-	}
-	return NULL; /* Only if (marker == NULL) */
-}
-
-/* Finds the next marker in the same group. If no other is found, the same
- * marker will be returned */
-TextMarker *txt_next_marker(Text *text, TextMarker *marker)
-{
-	TextMarker *tmp = marker;
-	while (tmp) {
-		if (tmp->next) tmp = tmp->next;
-		else tmp = text->markers.first;
-		if (tmp->group == marker->group)
-			return tmp;
-	}
-	return NULL; /* Only if (marker == NULL) */
-}
-
-
 /*******************************/
 /* Character utility functions */
 /*******************************/
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 9dd8318..6d0313f 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -571,7 +571,7 @@ void default_mtex(MTex *mtex)
 	mtex->size[1] = 1.0;
 	mtex->size[2] = 1.0;
 	mtex->tex = NULL;
-	mtex->texflag = MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE;
+	mtex->texflag = MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE | MTEX_MAPTO_BOUNDS;
 	mtex->colormodel = 0;
 	mtex->r = 1.0;
 	mtex->g = 0.0;
@@ -646,7 +646,7 @@ MTex *add_mtex_id(ID *id, int slot)
 	
 	if (slot == -1) {
 		/* find first free */
-		int i;		
+		int i;
 		for (i = 0; i < MAX_MTEX; i++) {
 			if (!mtex_ar[i]) {
 				slot = i;
@@ -909,8 +909,7 @@ void autotexname(Tex *tex)
 		if (tex->use_nodes) {
 			new_id(&bmain->tex, (ID *)tex, "Noddy");
 		}
-		else
-		if (tex->type == TEX_IMAGE) {
+		else if (tex->type == TEX_IMAGE) {
 			ima = tex->ima;
 			if (ima) {
 				BLI_strncpy(di, ima->name, sizeof(di));
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 7d2fd52..30b4840 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -51,6 +51,8 @@
 #include "BLI_string.h"
 #include "BLI_threads.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_global.h"
 #include "BKE_tracking.h"
 #include "BKE_movieclip.h"
@@ -171,6 +173,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
 	tracking->settings.default_search_size = 61;
 	tracking->settings.dist = 1;
 	tracking->settings.object_distance = 1;
+	tracking->settings.reconstruction_success_threshold = 1e-3;
 
 	tracking->stabilization.scaleinf = 1.0f;
 	tracking->stabilization.locinf = 1.0f;
@@ -221,7 +224,7 @@ void BKE_tracking_get_projection_matrix(MovieTracking *tracking, MovieTrackingOb
 	float viewfac, pixsize, left, right, bottom, top, clipsta, clipend;
 	float winmat[4][4];
 	float ycor =  1.0f / tracking->camera.pixel_aspect;
-	float shiftx, shifty, winside = MAX2(winx, winy);
+	float shiftx, shifty, winside = (float)min_ii(winx, winy);
 
 	BKE_tracking_camera_shift_get(tracking, winx, winy, &shiftx, &shifty);
 
@@ -631,7 +634,7 @@ void BKE_tracking_track_path_clear(MovieTrackingTrack *track, int ref_frame, int
 	}
 }
 
-void BKE_tracking_tracks_join(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
+void BKE_tracking_tracks_join(MovieTracking *tracking, MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
 {
 	int i = 0, a = 0, b = 0, tot;
 	MovieTrackingMarker *markers;
@@ -734,6 +737,8 @@ void BKE_tracking_tracks_join(MovieTrackingTrack *dst_track, MovieTrackingTrack
 	dst_track->markersnr = i;
 
 	MEM_freeN(markers);
+
+	BKE_tracking_dopesheet_tag_update(tracking);
 }
 
 MovieTrackingTrack *BKE_tracking_track_get_named(MovieTracking *tracking, MovieTrackingObject *object, const char *name)
@@ -995,8 +1000,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event)
 	if (event == CLAMP_PAT_DIM) {
 		for (a = 0; a < 2; a++) {
 			/* search shouldn't be resized smaller than pattern */
-			marker->search_min[a] = minf(pat_min[a], marker->search_min[a]);
-			marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]);
+			marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]);
+			marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]);
 		}
 	}
 	else if (event == CLAMP_PAT_POS) {
@@ -1020,8 +1025,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event)
 	else if (event == CLAMP_SEARCH_DIM) {
 		for (a = 0; a < 2; a++) {
 			/* search shouldn't be resized smaller than pattern */
-			marker->search_min[a] = minf(pat_min[a], marker->search_min[a]);
-			marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]);
+			marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]);
+			marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]);
 		}
 	}
 	else if (event == CLAMP_SEARCH_POS) {
@@ -1119,10 +1124,10 @@ void BKE_tracking_marker_pattern_minmax(const MovieTrackingMarker *marker, float
 {
 	INIT_MINMAX2(min, max);
 
-	DO_MINMAX2(marker->pattern_corners[0], min, max);
-	DO_MINMAX2(marker->pattern_corners[1], min, max);
-	DO_MINMAX2(marker->pattern_corners[2], min, max);
-	DO_MINMAX2(marker->pattern_corners[3], min, max);
+	minmax_v2v2_v2(min, max, marker->pattern_corners[0]);
+	minmax_v2v2_v2(min, max, marker->pattern_corners[1]);
+	minmax_v2v2_v2(min, max, marker->pattern_corners[2]);
+	minmax_v2v2_v2(min, max, marker->pattern_corners[3]);
 }
 
 void BKE_tracking_marker_get_subframe_position(MovieTrackingTrack *track, float framenr, float pos[2])
@@ -1185,17 +1190,17 @@ MovieTrackingObject *BKE_tracking_object_add(MovieTracking *tracking, const char
 	return object;
 }
 
-void BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *object)
+int BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *object)
 {
 	MovieTrackingTrack *track;
 	int index = BLI_findindex(&tracking->objects, object);
 
-	if (index < 0)
-		return;
+	if (index == -1)
+		return FALSE;
 
 	if (object->flag & TRACKING_OBJECT_CAMERA) {
 		/* object used for camera solving can't be deleted */
-		return;
+		return FALSE;
 	}
 
 	track = object->tracks.first;
@@ -1211,10 +1216,11 @@ void BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *ob
 
 	tracking->tot_object--;
 
-	if (index > 0)
+	if (index != 0)
 		tracking->objectnr = index - 1;
 	else
 		tracking->objectnr = 0;
+	return TRUE;
 }
 
 void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object)
@@ -1494,7 +1500,8 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
 			                                   ibuf->x, ibuf->y, overscan, ibuf->channels);
 		}
 
-		resibuf->userflags |= IB_RECT_INVALID;
+		if (ibuf->rect)
+			imb_freerectImBuf(ibuf);
 	}
 	else {
 		if (undistort) {
@@ -1512,9 +1519,8 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
 	(void) overscan;
 	(void) undistort;
 
-	if (ibuf->rect_float) {
-		resibuf->userflags |= IB_RECT_INVALID;
-	}
+	if (ibuf->rect_float && ibuf->rect)
+		imb_freerectImBuf(ibuf);
 #endif
 
 	return resibuf;
@@ -1618,6 +1624,9 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
 	double warped_position_x, warped_position_y;
 	float *mask = NULL;
 
+	if (num_samples_x <= 0 || num_samples_y <= 0)
+		return NULL;
+
 	pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat);
 
 	if (!search_ibuf->rect_float) {
@@ -1684,10 +1693,15 @@ ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mo
 
 	search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, anchored, disable_channels);
 
-	pattern_ibuf = BKE_tracking_sample_pattern(ibuf->x, ibuf->y, search_ibuf, track, marker,
-	                                           FALSE, num_samples_x, num_samples_y, NULL);
+	if (search_ibuf) {
+		pattern_ibuf = BKE_tracking_sample_pattern(ibuf->x, ibuf->y, search_ibuf, track, marker,
+		                                           FALSE, num_samples_x, num_samples_y, NULL);
 
-	IMB_freeImBuf(search_ibuf);
+		IMB_freeImBuf(search_ibuf);
+	}
+	else {
+		pattern_ibuf = NULL;
+	}
 
 	return pattern_ibuf;
 }
@@ -1712,6 +1726,9 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mov
 	w = (marker->search_max[0] - marker->search_min[0]) * ibuf->x;
 	h = (marker->search_max[1] - marker->search_min[1]) * ibuf->y;
 
+	if (w <= 0 || h <= 0)
+		return NULL;
+
 	searchibuf = IMB_allocImBuf(w, h, 32, ibuf->rect_float ? IB_rectfloat : IB_rect);
 
 	IMB_rectcpy(searchibuf, ibuf, 0, 0, x, y, w, h);
@@ -2136,7 +2153,7 @@ void BKE_tracking_context_sync(MovieTrackingContext *context)
 
 	context->sync_frame = newframe;
 
-	tracking->dopesheet.ok = FALSE;
+	BKE_tracking_dopesheet_tag_update(tracking);
 }
 
 void BKE_tracking_context_sync_user(const MovieTrackingContext *context, MovieClipUser *user)
@@ -2181,6 +2198,12 @@ static float *track_get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track,
 
 	searchibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, FALSE, TRUE);
 
+	if (!searchibuf) {
+		*width_r = 0;
+		*height_r = 0;
+		return NULL;
+	}
+
 	width = searchibuf->x;
 	height = searchibuf->y;
 
@@ -2343,10 +2366,10 @@ static int tracking_check_marker_margin(MovieTrackingTrack *track, MovieTracking
 	/* margin from frame boundaries */
 	BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
 	sub_v2_v2v2(dim, pat_max, pat_min);
-	margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f;
+	margin[0] = margin[1] = max_ff(dim[0], dim[1]) / 2.0f;
 
-	margin[0] = maxf(margin[0], (float)track->margin / frame_width);
-	margin[1] = maxf(margin[1], (float)track->margin / frame_height);
+	margin[0] = max_ff(margin[0], (float)track->margin / frame_width);
+	margin[1] = max_ff(margin[1], (float)track->margin / frame_height);
 
 	/* do not track markers which are too close to boundary */
 	if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] ||
@@ -2500,6 +2523,9 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
 				get_marker_coords_for_tracking(frame_width, frame_height, &track_context->marker, src_pixel_x, src_pixel_y);
 				get_marker_coords_for_tracking(frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
 
+				if (!patch_new || !track_context->search_area)
+					continue;
+
 				/* run the tracker! */
 				tracked = libmv_trackRegion(&options,
 				                            track_context->search_area,
@@ -2556,6 +2582,9 @@ typedef struct MovieReconstructContext {
 
 	TracksMap *tracks_map;
 
+	float success_threshold;
+	int use_fallback_reconstruction;
+
 	int sfra, efra;
 } MovieReconstructContext;
 
@@ -2785,7 +2814,7 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje
 		return TRUE;
 	}
 	else if (reconstruct_count_tracks_on_both_keyframes(tracking, object) < 8) {
-		BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction",
+		BLI_strncpy(error_msg, N_("At least 8 common tracks on both of keyframes are needed for reconstruction"),
 		            error_size);
 
 		return FALSE;
@@ -2793,7 +2822,7 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje
 
 	return TRUE;
 #else
-	BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size);
+	BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size);
 
 	(void) tracking;
 	(void) object;
@@ -2825,6 +2854,9 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
 	context->k2 = camera->k2;
 	context->k3 = camera->k3;
 
+	context->success_threshold = tracking->settings.reconstruction_success_threshold;
+	context->use_fallback_reconstruction = tracking->settings.reconstruction_flag & TRACKING_USE_FALLBACK_RECONSTRUCTION;
+
 	context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
 
 	track = tracksbase->first;
@@ -2846,10 +2878,10 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
 		}
 
 		if (first < track->markersnr - 1)
-			sfra = MIN2(sfra, first_marker->framenr);
+			sfra = min_ii(sfra, first_marker->framenr);
 
 		if (last >= 0)
-			efra = MAX2(efra, last_marker->framenr);
+			efra = max_ii(efra, last_marker->framenr);
 
 		tracks_map_insert(context->tracks_map, track, NULL);
 
@@ -2924,12 +2956,18 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
 		                                           reconstruct_update_solve_cb, &progressdata);
 	}
 	else {
+		struct libmv_reconstructionOptions options;
+
+		options.success_threshold = context->success_threshold;
+		options.use_fallback_reconstruction = context->use_fallback_reconstruction;
+
 		context->reconstruction = libmv_solveReconstruction(context->tracks,
 		                                                    context->keyframe1, context->keyframe2,
 		                                                    context->refine_flags,
 		                                                    context->focal_length,
 		                                                    context->principal_point[0], context->principal_point[1],
 		                                                    context->k1, context->k2, context->k3,
+		                                                    &options,
 		                                                    reconstruct_update_solve_cb, &progressdata);
 	}
 
@@ -2951,6 +2989,7 @@ int BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieTr
 	MovieTrackingReconstruction *reconstruction;
 
 	tracks_map_merge(context->tracks_map, tracking);
+	BKE_tracking_dopesheet_tag_update(tracking);
 
 	if (context->is_camera) {
 		reconstruction = &tracking->reconstruction;
@@ -3122,7 +3161,7 @@ static int stabilization_median_point_get(MovieTracking *tracking, int framenr,
 		if (track->flag & TRACK_USE_2D_STAB) {
 			MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
 
-			DO_MINMAX2(marker->pos, min, max);
+			minmax_v2v2_v2(min, max, marker->pos);
 
 			ok = TRUE;
 		}
@@ -3196,8 +3235,8 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i
 			if (track->flag & TRACK_USE_2D_STAB ||
 			    ((stab->flag & TRACKING_STABILIZE_ROTATION) && track == stab->rot_track))
 			{
-				sfra = MIN2(sfra, track->markers[0].framenr);
-				efra = MAX2(efra, track->markers[track->markersnr - 1].framenr);
+				sfra = min_ii(sfra, track->markers[0].framenr);
+				efra = max_ii(efra, track->markers[track->markersnr - 1].framenr);
 			}
 
 			track = track->next;
@@ -3273,7 +3312,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i
 
 						S = (-w * I - h * J) / (dx * I + dy * J + K);
 
-						scale = maxf(scale, S);
+						scale = max_ff(scale, S);
 					}
 				}
 			}
@@ -3282,7 +3321,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i
 		stab->scale = scale;
 
 		if (stab->maxscale > 0.0f)
-			stab->scale = minf(stab->scale, stab->maxscale);
+			stab->scale = min_ff(stab->scale, stab->maxscale);
 	}
 	else {
 		stab->scale = 1.0f;
@@ -3641,7 +3680,7 @@ static void channels_segments_calc(MovieTrackingDopesheetChannel *channel)
 			channel->segments[2 * segment] = start_marker->framenr;
 			channel->segments[2 * segment + 1] = start_marker->framenr + len;
 
-			channel->max_segment =  MAX2(channel->max_segment, len);
+			channel->max_segment = max_ii(channel->max_segment, len);
 			segment++;
 		}
 
@@ -3649,7 +3688,7 @@ static void channels_segments_calc(MovieTrackingDopesheetChannel *channel)
 	}
 }
 
-static void  tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, int inverse)
+static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, int inverse)
 {
 	MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
 
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 46836b1..84e1f29 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -259,7 +259,7 @@ static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0,
 
 
 static struct bUnitDef buNaturalRotDef[] = {
-	{"degree", "degrees",			"°", NULL, "Degrees",		M_PI/180.0, 0.0,	B_UNIT_DEF_NONE},
+	{"degree", "degrees",			"°", NULL, "Degrees",		M_PI / 180.0, 0.0,	B_UNIT_DEF_NONE},
 //	{"radian", "radians",			"r", NULL, "Radians",		1.0, 0.0,			B_UNIT_DEF_NONE},
 //	{"turn", "turns",				"t", NULL, "Turns",			1.0/(M_PI*2.0), 0.0,B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 434bfe1..4bde895 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -107,7 +107,7 @@ World *add_world(const char *name)
 	wrld->ao_indirect_energy = 1.0f;
 	wrld->ao_indirect_bounces = 1;
 	wrld->aobias = 0.05f;
-	wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;	
+	wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
 	wrld->ao_approx_error = 0.25f;
 	
 	wrld->preview = NULL;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 9f29cb8..d4428be 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
 	else format = AVI_FORMAT_MJPEG;
 
 	if (AVI_open_compress(name, avi, 1, format) != AVI_ERROR_NONE) {
-		BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file.");
+		BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file");
 		MEM_freeN(avi);
 		avi = NULL;
 		return 0;
@@ -175,8 +175,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
 
 	avi->interlace = 0;
 	avi->odd_fields = 0;
-/*  avi->interlace= rd->mode & R_FIELDS; */
-/*  avi->odd_fields= (rd->mode & R_ODDFIELD)?1:0; */
+/*  avi->interlace = rd->mode & R_FIELDS; */
+/*  avi->odd_fields = (rd->mode & R_ODDFIELD) ? 1 : 0; */
 	
 	printf("Created avi: %s\n", name);
 	return 1;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index ff1fdeb..0f861a7 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -111,6 +111,11 @@ static void delete_picture(AVFrame *f)
 	}
 }
 
+static int use_float_audio_buffer(int codec_id)
+{
+	return codec_id == CODEC_ID_AAC || codec_id == CODEC_ID_AC3 || codec_id == CODEC_ID_VORBIS;
+}
+
 #ifdef WITH_AUDASPACE
 static int write_audio_frame(void) 
 {
@@ -289,7 +294,7 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame *frame, ReportLis
 	}
 
 	if (!success)
-		BKE_report(reports, RPT_ERROR, "Error writing frame.");
+		BKE_report(reports, RPT_ERROR, "Error writing frame");
 
 	return success;
 }
@@ -307,7 +312,7 @@ static AVFrame *generate_video_frame(uint8_t *pixels, ReportList *reports)
 	if (c->pix_fmt != PIX_FMT_BGR32) {
 		rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height);
 		if (!rgb_frame) {
-			BKE_report(reports, RPT_ERROR, "Couldn't allocate temporary frame.");
+			BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame");
 			return NULL;
 		}
 	}
@@ -478,9 +483,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 		c->time_base.den = 2997;
 		c->time_base.num = 100;
 	}
-	else if ((double) ((int) rd->frs_sec_base) ==
-	         rd->frs_sec_base)
-	{
+	else if ((float) ((int) rd->frs_sec_base) == rd->frs_sec_base) {
 		c->time_base.den = rd->frs_sec;
 		c->time_base.num = (int) rd->frs_sec_base;
 	}
@@ -601,12 +604,14 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 
 /* Prepare an audio stream for the output file */
 
-static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of)
+static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of, char *error, int error_size)
 {
 	AVStream *st;
 	AVCodecContext *c;
 	AVCodec *codec;
 
+	error[0] = '\0';
+
 	st = av_new_stream(of, 1);
 	if (!st) return NULL;
 
@@ -618,6 +623,10 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
 	c->bit_rate = ffmpeg_audio_bitrate * 1000;
 	c->sample_fmt = AV_SAMPLE_FMT_S16;
 	c->channels = rd->ffcodecdata.audio_channels;
+	if (use_float_audio_buffer(codec_id)) {
+		c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
+		c->sample_fmt = AV_SAMPLE_FMT_FLT;
+	}
 	codec = avcodec_find_encoder(c->codec_id);
 	if (!codec) {
 		//XXX error("Couldn't find a valid audio codec");
@@ -628,6 +637,7 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
 
 	if (avcodec_open(c, codec) < 0) {
 		//XXX error("Couldn't initialize audio codec");
+		BLI_strncpy(error, IMB_ffmpeg_last_error(), error_size);
 		return NULL;
 	}
 
@@ -648,7 +658,12 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
 
 	audio_output_buffer = (uint8_t *) av_malloc(audio_outbuf_size);
 
-	audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(int16_t));
+	if (use_float_audio_buffer(codec_id)) {
+		audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(float));
+	}
+	else {
+		audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(int16_t));
+	}
 
 	audio_time = 0.0f;
 
@@ -695,12 +710,12 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 	
 	exts = get_file_extensions(ffmpeg_type);
 	if (!exts) {
-		BKE_report(reports, RPT_ERROR, "No valid formats found.");
+		BKE_report(reports, RPT_ERROR, "No valid formats found");
 		return 0;
 	}
 	fmt = av_guess_format(NULL, exts[0], NULL);
 	if (!fmt) {
-		BKE_report(reports, RPT_ERROR, "No valid formats found.");
+		BKE_report(reports, RPT_ERROR, "No valid formats found");
 		return 0;
 	}
 
@@ -795,7 +810,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 			if (error[0])
 				BKE_report(reports, RPT_ERROR, error);
 			else
-				BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
+				BKE_report(reports, RPT_ERROR, "Error initializing video stream");
 
 			av_dict_free(&opts);
 			return 0;
@@ -803,22 +818,25 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 	}
 
 	if (ffmpeg_audio_codec != CODEC_ID_NONE) {
-		audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of);
+		audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of, error, sizeof(error));
 		if (!audio_stream) {
-			BKE_report(reports, RPT_ERROR, "Error initializing audio stream.");
+			if (error[0])
+				BKE_report(reports, RPT_ERROR, error);
+			else
+				BKE_report(reports, RPT_ERROR, "Error initializing audio stream");
 			av_dict_free(&opts);
 			return 0;
 		}
 	}
 	if (!(fmt->flags & AVFMT_NOFILE)) {
 		if (avio_open(&of->pb, name, AVIO_FLAG_WRITE) < 0) {
-			BKE_report(reports, RPT_ERROR, "Could not open file for writing.");
+			BKE_report(reports, RPT_ERROR, "Could not open file for writing");
 			av_dict_free(&opts);
 			return 0;
 		}
 	}
 	if (avformat_write_header(of, NULL) < 0) {
-		BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination.");
+		BKE_report(reports, RPT_ERROR, "Could not initialize streams, probably unsupported codec combination");
 			av_dict_free(&opts);
 		return 0;
 	}
@@ -945,7 +963,12 @@ int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty,
 		AVCodecContext *c = audio_stream->codec;
 		AUD_DeviceSpecs specs;
 		specs.channels = c->channels;
-		specs.format = AUD_FORMAT_S16;
+		if (use_float_audio_buffer(c->codec_id)) {
+			specs.format = AUD_FORMAT_FLOAT32;
+		}
+		else {
+			specs.format = AUD_FORMAT_S16;
+		}
 		specs.rate = rd->ffcodecdata.audio_mixrate;
 		audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
 #ifdef FFMPEG_CODEC_TIME_BASE
@@ -982,7 +1005,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
 
 	PRINT("Writing frame %i, render width=%d, render height=%d\n", frame, rectx, recty);
 
-// why is this done before writing the video frame and again at end_ffmpeg?
+/* why is this done before writing the video frame and again at end_ffmpeg? */
 //	write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
 
 	if (video_stream) {
@@ -999,7 +1022,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
 	}
 
 #ifdef WITH_AUDASPACE
-	write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / rd->frs_sec_base));
+	write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / (double)rd->frs_sec_base));
 #endif
 	return success;
 }
@@ -1225,7 +1248,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
 		while (*param == ' ') param++;
 	}
 	
-	o = my_av_find_opt(&c, name, NULL, 0, 0);	
+	o = my_av_find_opt(&c, name, NULL, 0, 0);
 	if (!o) {
 		return 0;
 	}
@@ -1233,7 +1256,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
 		return 0;
 	}
 	if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
-		p = my_av_find_opt(&c, param, o->unit, 0, 0);	
+		p = my_av_find_opt(&c, param, o->unit, 0, 0);
 		if (p) {
 			prop = BKE_ffmpeg_property_add(rd, (char *) type, p - c.av_class->option, o - c.av_class->option);
 		}
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index d8fddb9..acbbcb0 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -118,13 +118,13 @@ int BKE_frameserver_start(struct Scene *scene, RenderData *UNUSED(rd), int rectx
 	(void)scene; /* unused */
 
 	if (!startup_socket_system()) {
-		BKE_report(reports, RPT_ERROR, "Can't startup socket system");
+		BKE_report(reports, RPT_ERROR, "Cannot startup socket system");
 		return 0;
 	}
 
 	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
 		shutdown_socket_system();
-		BKE_report(reports, RPT_ERROR, "Can't open socket");
+		BKE_report(reports, RPT_ERROR, "Cannot open socket");
 		return 0;
 	}
 
@@ -136,13 +136,13 @@ int BKE_frameserver_start(struct Scene *scene, RenderData *UNUSED(rd), int rectx
 
 	if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
 		shutdown_socket_system();
-		BKE_report(reports, RPT_ERROR, "Can't bind to socket");
+		BKE_report(reports, RPT_ERROR, "Cannot bind to socket");
 		return 0;
 	}
 
 	if (listen(sock, SOMAXCONN) < 0) {
 		shutdown_socket_system();
-		BKE_report(reports, RPT_ERROR, "Can't establish listen backlog");
+		BKE_report(reports, RPT_ERROR, "Cannot establish listen backlog");
 		return 0;
 	}
 	connsock = -1;
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index 84cfe89..a217783 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -77,11 +77,13 @@
 	    MEM_allocN_len(arr) / sizeof(*arr)                                    \
 )
 
+#define _bli_array_totalsize_static(arr)  \
+	(sizeof(_##arr##_static) / sizeof(*arr))
 
 #define BLI_array_totalsize(arr)  (                                           \
 	(size_t)                                                                  \
 	(((void *)(arr) == (void *)_##arr##_static && (void *)(arr) != NULL) ?    \
-	    (sizeof(_##arr##_static) / sizeof(*arr)) :                            \
+	    _bli_array_totalsize_static(arr) :                                    \
 	    BLI_array_totalsize_dyn(arr))                                         \
 )
 
@@ -93,8 +95,18 @@
  *
  * Allow for a large 'num' value when the new size is more then double
  * to allocate the exact sized array. */
-#define _bli_array_grow_items(arr, num)  (                                    \
-	(BLI_array_totalsize(arr) >= _##arr##_count + num) ?                      \
+
+/* grow an array by a specified number of items */
+#define BLI_array_grow_items(arr, num)  (                                     \
+	(((void *)(arr) == NULL) &&                                               \
+	 ((void *)(_##arr##_static) != NULL) &&                                   \
+	/* dont add _##arr##_count below because it must be zero */               \
+	 (_bli_array_totalsize_static(arr) >= _##arr##_count + num)) ?            \
+	/* we have an empty array and a static var big enough */                  \
+	((arr = (void *)_##arr##_static), (_##arr##_count += (num)))              \
+	    :                                                                     \
+	/* use existing static array or allocate */                               \
+	((BLI_array_totalsize(arr) >= _##arr##_count + num) ?                     \
 	    (_##arr##_count += num) :                                             \
 	    (                                                                     \
 	        (void) (_##arr##_tmp = MEM_callocN(                               \
@@ -115,14 +127,7 @@
 	        (void) (arr = _##arr##_tmp                                        \
 	                ),                                                        \
 	        (_##arr##_count += num)                                           \
-	    )                                                                     \
-)
-
-/* grow an array by a specified number of items */
-#define BLI_array_grow_items(arr, num)  (                                     \
-	((void *)(arr) == NULL && (void *)(_##arr##_static) != NULL) ?            \
-	    ((arr = (void *)_##arr##_static), (_##arr##_count += num)) :          \
-	    _bli_array_grow_items(arr, num)                                       \
+	    ))                                                                    \
 )
 
 /* returns length of array */
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 74b477b..03b7597 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -78,8 +78,6 @@ extern "C" {
 
 #include "BLI_rect.h"
 
-#include "BLI_noise.h"
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index a86b362..438bffb 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -48,6 +48,11 @@ void BLI_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVi
 void BLI_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
 int  BLI_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
 
+/* Functions for temp backup/restore of paths, path count must NOT change */
+void *BLI_bpath_list_backup(struct Main *bmain, const int flag);
+void  BLI_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
+void  BLI_bpath_list_free(void *ls_handle);
+
 #define BLI_BPATH_TRAVERSE_ABS             (1 << 0) /* convert paths to absolute */
 #define BLI_BPATH_TRAVERSE_SKIP_LIBRARY    (1 << 2) /* skip library paths */
 #define BLI_BPATH_TRAVERSE_SKIP_PACKED     (1 << 3) /* skip packed data */
diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h
index d04e544..bdde8db 100644
--- a/source/blender/blenlib/BLI_dlrbTree.h
+++ b/source/blender/blenlib/BLI_dlrbTree.h
@@ -46,7 +46,7 @@
 /* Basic Layout for a Node */
 typedef struct DLRBT_Node {
 	/* ListBase capabilities */
-	struct DLRBT_Node *next, *prev;		
+	struct DLRBT_Node *next, *prev;
 	
 	/* Tree Associativity settings */
 	struct DLRBT_Node *left, *right;
diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h
index 7cb2790..f48b1b0 100644
--- a/source/blender/blenlib/BLI_endian_switch.h
+++ b/source/blender/blenlib/BLI_endian_switch.h
@@ -29,8 +29,7 @@
 
 #ifdef __GNUC__
 #  define ATTR_ENDIAN_SWITCH \
-	__attribute__((nonnull(1))) \
-	__attribute__((pure))
+	__attribute__((nonnull(1)))
 #else
 #  define ATTR_ENDIAN_SWITCH
 #endif
diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h
index 6aa0405..358206f 100644
--- a/source/blender/blenlib/BLI_endian_switch_inline.h
+++ b/source/blender/blenlib/BLI_endian_switch_inline.h
@@ -38,57 +38,55 @@
 /* *** 16 *** */
 BLI_INLINE void BLI_endian_switch_int16(short *val)
 {
-	short tval = *val;
-	*val = (tval >> 8) |
-	       (tval << 8);
-
+	BLI_endian_switch_uint16((unsigned short *)val);
 }
 BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val)
 {
-	BLI_endian_switch_int16((short *)val);
+	unsigned short tval = *val;
+	*val = (tval >> 8) |
+	       (tval << 8);
 }
 
 
 /* *** 32 *** */
 BLI_INLINE void BLI_endian_switch_int32(int *val)
 {
-	int tval = *val;
+	BLI_endian_switch_uint32((unsigned int *)val);
+}
+BLI_INLINE void BLI_endian_switch_uint32(unsigned int *val)
+{
+	unsigned int tval = *val;
 	*val = ((tval >> 24))             |
 	       ((tval << 8) & 0x00ff0000) |
 	       ((tval >> 8) & 0x0000ff00) |
 	       ((tval << 24));
-
-}
-BLI_INLINE void BLI_endian_switch_uint32(unsigned int *val)
-{
-	BLI_endian_switch_int32((int *)val);
 }
 BLI_INLINE void BLI_endian_switch_float(float *val)
 {
-	BLI_endian_switch_int32((int *)val);
+	BLI_endian_switch_uint32((unsigned int *)val);
 }
 
 
 /* *** 64 *** */
 BLI_INLINE void BLI_endian_switch_int64(int64_t *val)
 {
-	int64_t tval = *val;
-	*val = ((tval >> 56)) |
-	       ((tval << 40) & 0x00ff000000000000l) |
-	       ((tval << 24) & 0x0000ff0000000000l) |
-	       ((tval <<  8) & 0x000000ff00000000l) |
-	       ((tval >>  8) & 0x00000000ff000000l) |
-	       ((tval >> 24) & 0x0000000000ff0000l) |
-	       ((tval >> 40) & 0x000000000000ff00l) |
-	       ((tval << 56));
+	BLI_endian_switch_uint64((uint64_t *)val);
 }
 BLI_INLINE void BLI_endian_switch_uint64(uint64_t *val)
 {
-	BLI_endian_switch_int64((int64_t *)val);
+	uint64_t tval = *val;
+	*val = ((tval >> 56)) |
+	       ((tval << 40) & 0x00ff000000000000ll) |
+	       ((tval << 24) & 0x0000ff0000000000ll) |
+	       ((tval <<  8) & 0x000000ff00000000ll) |
+	       ((tval >>  8) & 0x00000000ff000000ll) |
+	       ((tval >> 24) & 0x0000000000ff0000ll) |
+	       ((tval >> 40) & 0x000000000000ff00ll) |
+	       ((tval << 56));
 }
 BLI_INLINE void BLI_endian_switch_double(double *val)
 {
-	BLI_endian_switch_int64((int64_t *)val);
+	BLI_endian_switch_uint64((uint64_t *)val);
 }
 
 #endif  /* __BLI_ENDIAN_SWITCH_INLINE_H__ */
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index c26e6cd..7eac142 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -71,7 +71,7 @@ void   BLI_ghash_insert(GHash *gh, void *key, void *val);
 void  *BLI_ghash_lookup(GHash *gh, const void *key);
 int    BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
 void  *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
-int    BLI_ghash_haskey(GHash *gh, void *key);
+int    BLI_ghash_haskey(GHash *gh, const void *key);
 int    BLI_ghash_size(GHash *gh);
 
 /* *** */
diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h
index b378f2b..c0941e0 100644
--- a/source/blender/blenlib/BLI_heap.h
+++ b/source/blender/blenlib/BLI_heap.h
@@ -42,6 +42,7 @@ typedef void (*HeapFreeFP)(void *ptr);
 
 /* Creates a new heap. BLI_memarena is used for allocating nodes. Removed nodes
  * are recycled, so memory usage will not shrink. */
+Heap           *BLI_heap_new_ex(unsigned int tot_reserve);
 Heap           *BLI_heap_new(void);
 void            BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp);
 
@@ -53,10 +54,10 @@ HeapNode       *BLI_heap_insert(Heap *heap, float value, void *ptr);
 void            BLI_heap_remove(Heap *heap, HeapNode *node);
 
 /* Return 0 if the heap is empty, 1 otherwise. */
-int             BLI_heap_empty(Heap *heap);
+int             BLI_heap_is_empty(Heap *heap);
 
 /* Return the size of the heap. */
-int             BLI_heap_size(Heap *heap);
+unsigned int    BLI_heap_size(Heap *heap);
 
 /* Return the top node of the heap. This is the node with the lowest value. */
 HeapNode       *BLI_heap_top(Heap *heap);
@@ -68,5 +69,4 @@ void           *BLI_heap_popmin(Heap *heap);
 float           BLI_heap_node_value(HeapNode *heap);
 void           *BLI_heap_node_ptr(HeapNode *heap);
 
-#endif
-
+#endif  /* __BLI_HEAP_H__ */
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index c75334a..8441413 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -75,7 +75,7 @@ typedef struct BVHTreeRayHit {
 } BVHTreeRayHit;
 
 /* callback must update nearest in case it finds a nearest result */
-typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const float *co, BVHTreeNearest *nearest);
+typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest);
 
 /* callback must update hit in case it finds a nearest successful hit */
 typedef void (*BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit);
@@ -87,27 +87,31 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis);
 void BLI_bvhtree_free(BVHTree *tree);
 
 /* construct: first insert points, then call balance */
-int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints);
+int BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints);
 void BLI_bvhtree_balance(BVHTree *tree);
 
 /* update: first update points/nodes, then call update_tree to refit the bounding volumes */
-int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const float *co_moving, int numpoints);
+int BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints);
 void BLI_bvhtree_update_tree(BVHTree *tree);
 
 /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
 BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *result);
 
-float BLI_bvhtree_getepsilon(BVHTree *tree);
+float BLI_bvhtree_getepsilon(const BVHTree *tree);
 
-/* find nearest node to the given coordinates (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
-int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata);
+/* find nearest node to the given coordinates
+ * (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
+int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest,
+                             BVHTree_NearestPointCallback callback, void *userdata);
 
-int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
+int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit,
+                         BVHTree_RayCastCallback callback, void *userdata);
 
-float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3]);
+float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], const float light_end[3], float pos[3]);
 
 /* range query */
-int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata);
+int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius,
+                            BVHTree_RangeQuery callback, void *userdata);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index e905664..f9b52f3 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -56,7 +56,7 @@ void BLI_kdtree_balance(KDTree *tree);
 /* Find nearest returns index, and -1 if no node is found.
  * Find n nearest returns number of points found, with results in nearest.
  * Normal is optional, but if given will limit results to points in normal direction from co. */
-int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *nearest);
+int BLI_kdtree_find_nearest(KDTree *tree, const float co[3], const float nor[3], KDTreeNearest *nearest);
 int BLI_kdtree_find_n_nearest(KDTree *tree, int n, const float co[3], const float nor[3], KDTreeNearest *nearest);
 
 /* Range search returns number of points found, with results in nearest */
diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h
index 89c37da..db2fed4 100644
--- a/source/blender/blenlib/BLI_math.h
+++ b/source/blender/blenlib/BLI_math.h
@@ -58,6 +58,7 @@
 #include "BLI_math_rotation.h"
 #include "BLI_math_vector.h"
 #include "BLI_math_geom.h"
+#include "BLI_math_interp.h"
 
 #endif /* __BLI_MATH_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 6ee1498..69d6478 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -170,7 +170,7 @@
 } (void)0
 #endif
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_base_inline.c"
 #endif
 
@@ -188,8 +188,11 @@ MINLINE float sasqrt(float fac);
 
 MINLINE float interpf(float a, float b, float t);
 
-MINLINE float minf(float a, float b);
-MINLINE float maxf(float a, float b);
+MINLINE float min_ff(float a, float b);
+MINLINE float max_ff(float a, float b);
+
+MINLINE int min_ii(int a, int b);
+MINLINE int max_ii(int a, int b);
 
 MINLINE float signf(float f);
 
@@ -200,7 +203,7 @@ MINLINE int is_power_of_2_i(int n);
 MINLINE int power_of_2_max_i(int n);
 MINLINE int power_of_2_min_i(int n);
 
-MINLINE float shell_angle_to_dist(float angle);
+MINLINE float shell_angle_to_dist(const float angle);
 
 #if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
 extern double copysign(double x, double y);
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 7c8bf88..c71463d 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -121,7 +121,7 @@ MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3]
 
 void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_color_inline.c"
 #endif
 
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 107b688..cfd163d 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -36,7 +36,7 @@ extern "C" {
 
 #include "BLI_math_inline.h"
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_geom_inline.c"
 #endif
 
@@ -95,12 +95,6 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2]
 int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
 int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
 
-/* Returns the number of point of interests
- * 0 - lines are colinear
- * 1 - lines are coplanar, i1 is set to intersection
- * 2 - i1 and i2 are the nearest points on line 1 (v1, v2) and line 2 (v3, v4) respectively 
- * */
-
 int isect_line_line_v3(const float v1[3], const float v2[3],
                        const float v3[3], const float v4[3],
                        float i1[3], float i2[3]);
@@ -108,35 +102,13 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3],
                               const float v3[3], const float v4[3],
                               float vi[3], float *r_lambda);
 
-/* if clip is nonzero, will only return true if lambda is >= 0.0
- * (i.e. intersection point is along positive d)*/
 int isect_ray_plane_v3(const float p1[3], const float d[3],
                        const float v0[3], const float v1[3], const float v2[3],
                        float *r_lambda, const int clip);
 
-/**
- * Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
- * \param out The intersection point.
- * \param l1 The first point of the line.
- * \param l2 The second point of the line.
- * \param plane_co A point on the plane to intersect with.
- * \param plane_no The direction of the plane (does not need to be normalized).
- * \param no_flip When true, the intersection point will always be from l1 to l2, even if this is not on the plane.
- */
 int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
                         const float plane_co[3], const float plane_no[3], const short no_flip);
 
-/**
- * Intersect two planes, return a point on the intersection and a vector
- * that runs on the direction of the intersection.
- * Return error code is the same as 'isect_line_line_v3'.
- * \param r_isect_co The resulting intersection point.
- * \param r_isect_no The resulting vector of the intersection.
- * \param plane_a_co The point on the first plane.
- * \param plane_a_no The normal of the first plane.
- * \param plane_b_co The point on the second plane.
- * \param plane_b_no The normal of the second plane.
- */
 void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
                           const float plane_a_co[3], const float plane_a_no[3],
                           const float plane_b_co[3], const float plane_b_no[3]);
@@ -215,6 +187,10 @@ int barycentric_inside_triangle_v2(const float w[3]);
 void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
 void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);
 
+/* use to find the point of a UV on a face */
+void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]);
+void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3]);
+
 /***************************** View & Projection *****************************/
 
 void lookat_m4(float mat[4][4], float vx, float vy, 
@@ -250,14 +226,6 @@ void accumulate_vertex_normals_poly(float **vertnos, float polyno[3],
 
 /********************************* Tangents **********************************/
 
-typedef struct VertexTangent {
-	struct VertexTangent *next;
-	float tang[3], uv[2];
-} VertexTangent;
-
-float *find_vertex_tangent(VertexTangent *vtang, const float uv[2]);
-void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang,
-                               const float tang[3], const float uv[2]);
 void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2],
                      float co1[3], float co2[3], float co3[3], float n[3], float tang[3]);
 
@@ -291,6 +259,9 @@ float form_factor_hemi_poly(float p[3], float n[3],
 
 void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3]);
 
+MINLINE int max_axis_v3(const float vec[3]);
+MINLINE int min_axis_v3(const float vec[3]);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index ce43d5f..6dad446 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -35,9 +35,10 @@ extern "C" {
 #endif
 
 /* add platform/compiler checks here if it is not supported */
-#define __BLI_MATH_INLINE_H__
+/* all platforms support forcing inline so this is always enabled */
+#define BLI_MATH_DO_INLINE 1
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #  ifdef _MSC_VER
 #    define MINLINE static __forceinline
 #    define MALWAYS_INLINE MINLINE
diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h
new file mode 100644
index 0000000..2197576
--- /dev/null
+++ b/source/blender/blenlib/BLI_math_interp.h
@@ -0,0 +1,44 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BLI_MATH_INTERP
+#define BLI_MATH_INTERP
+
+void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height,
+                                  int components, float u, float v);
+
+void BLI_bicubic_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height,
+                                    int components, float u, float v);
+
+void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height,
+                                   int components, float u, float v);
+
+void BLI_bilinear_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height,
+                                     int components, float u, float v);
+
+#endif
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 8e9955b..f51bd1c 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -36,14 +36,18 @@ extern "C" {
 
 /********************************* Init **************************************/
 
-#define MAT4_UNITY {{ 1.0, 0.0, 0.0, 0.0}, \
-					{ 0.0, 1.0, 0.0, 0.0}, \
-					{ 0.0, 0.0, 1.0, 0.0}, \
-					{ 0.0, 0.0, 0.0, 1.0}}
+#define MAT4_UNITY  {      \
+	{ 1.0, 0.0, 0.0, 0.0}, \
+	{ 0.0, 1.0, 0.0, 0.0}, \
+	{ 0.0, 0.0, 1.0, 0.0}, \
+	{ 0.0, 0.0, 0.0, 1.0}  \
+}
 
-#define MAT3_UNITY {{ 1.0, 0.0, 0.0}, \
-					{ 0.0, 1.0, 0.0}, \
-					{ 0.0, 0.0, 1.0}}
+#define MAT3_UNITY  { \
+	{ 1.0, 0.0, 0.0}, \
+	{ 0.0, 1.0, 0.0}, \
+	{ 0.0, 0.0, 1.0}  \
+}
 
 void zero_m3(float R[3][3]);
 void zero_m4(float R[4][4]);
@@ -98,6 +102,9 @@ void mul_m3_fl(float R[3][3], float f);
 void mul_m4_fl(float R[4][4], float f);
 void mul_mat3_m4_fl(float R[4][4], float f);
 
+int invert_m3_ex(float m[3][3], const float epsilon);
+int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon);
+
 int invert_m3(float R[3][3]);
 int invert_m3_m3(float R[3][3], float A[3][3]);
 int invert_m4(float R[4][4]);
@@ -128,6 +135,7 @@ int is_orthonormal_m4(float mat[4][4]);
 
 int is_uniform_scaled_m3(float mat[3][3]);
 
+void adjoint_m2_m2(float R[2][2], float A[2][2]);
 void adjoint_m3_m3(float R[3][3], float A[3][3]);
 void adjoint_m4_m4(float R[4][4], float A[4][4]);
 
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index de1d423..f4572af 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -36,7 +36,7 @@ extern "C" {
 
 #include "BLI_math_inline.h"
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_vector_inline.c"
 #endif
 
@@ -67,6 +67,7 @@ MINLINE void copy_v2_v2_short(short r[2], const short a[2]);
 MINLINE void copy_v3_v3_short(short r[3], const short a[3]);
 MINLINE void copy_v4_v4_short(short r[4], const short a[4]);
 /* int */
+MINLINE void zero_v3_int(int r[3]);
 MINLINE void copy_v2_v2_int(int r[2], const int a[2]);
 MINLINE void copy_v3_v3_int(int r[3], const int a[3]);
 MINLINE void copy_v4_v4_int(int r[4], const int a[4]);
@@ -139,12 +140,16 @@ MINLINE void star_m3_v3(float rmat[3][3], float a[3]);
 
 MINLINE float len_squared_v2(const float v[2]);
 MINLINE float len_squared_v3(const float v[3]);
+MINLINE float len_manhattan_v2(const float v[2]);
+MINLINE float len_manhattan_v3(const float v[3]);
 MINLINE float len_v2(const float a[2]);
 MINLINE float len_v2v2(const float a[2], const float b[2]);
 MINLINE float len_squared_v2v2(const float a[2], const float b[2]);
+MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
+MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]);
+MINLINE float len_manhattan_v3v3(const float a[3], const float b[3]);
 MINLINE float len_v3(const float a[3]);
 MINLINE float len_v3v3(const float a[3], const float b[3]);
-MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
 
 MINLINE float normalize_v2(float r[2]);
 MINLINE float normalize_v2_v2(float r[2], const float a[2]);
@@ -164,6 +169,7 @@ void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const
 
 void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
 void mid_v2_v2v2(float r[2], const float a[2], const float b[2]);
+void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]);
 
 /********************************* Comparison ********************************/
 
@@ -221,6 +227,7 @@ MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
 MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
 
 void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
+void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]);
 
 void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist);
 void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist);
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index 810b3b5..59ecdb3 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -153,7 +153,8 @@ void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
 void BLI_pbvh_redraw_BB(PBVH * bvh, float bb_min[3], float bb_max[3]);
 void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface);
 void BLI_pbvh_grids_update(PBVH *bvh, struct CCGElem **grid_elems,
-                           struct DMGridAdjacency *gridadj, void **gridfaces);
+                           struct DMGridAdjacency *gridadj, void **gridfaces,
+                           struct DMFlagMat *flagmats, unsigned int **grid_hidden);
 
 /* vertex deformer */
 float (*BLI_pbvh_get_vertCos(struct PBVH *pbvh))[3];
@@ -263,5 +264,7 @@ void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes,  int *totnode);
 //void BLI_pbvh_node_BB_reset(PBVHNode *node);
 //void BLI_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
 
+void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color);
+
 #endif /* __BLI_PBVH_H__ */
 
diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h
new file mode 100644
index 0000000..e71a647
--- /dev/null
+++ b/source/blender/blenlib/BLI_quadric.h
@@ -0,0 +1,56 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Laurence Bourn, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BLI_QUADRIC_H__
+#define __BLI_QUADRIC_H__
+
+/** \file BLI_quadric.h
+ *  \ingroup bli
+ */
+
+typedef struct Quadric {
+	float a2, ab, ac, ad,
+	          b2, bc, bd,
+	              c2, cd,
+	                  d2;
+} Quadric;
+
+/* conversion */
+void  BLI_quadric_from_v3_dist(Quadric *q, const float v[3], const float offset);
+void  BLI_quadric_to_tensor_m3(const Quadric *q, float m[3][3]);
+void  BLI_quadric_to_vector_v3(const Quadric *q, float v[3]);
+
+void  BLI_quadric_clear(Quadric *q);
+
+/* math */
+void  BLI_quadric_add_qu_qu(Quadric *a, const Quadric *b);
+void  BLI_quadric_add_qu_ququ(Quadric *r, const Quadric *a, const Quadric *b);
+void  BLI_quadric_mul(Quadric *a, const float scalar);
+
+/* solve */
+float BLI_quadric_evaluate(const Quadric *q, const float v[3]);
+int   BLI_quadric_optimize(const Quadric *q, float v[3], const float epsilon);
+
+#endif /* __BLI_QUADRIC_H__ */
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index 7dd6c85..3bc9a3b 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -40,18 +40,18 @@
 struct RNG;
 typedef struct RNG RNG;
 
-struct RNG *rng_new(unsigned int seed);
-void        rng_free(struct RNG *rng);
+struct RNG *BLI_rng_new(unsigned int seed);
+void        BLI_rng_free(struct RNG *rng);
 
-void        rng_seed(struct RNG *rng, unsigned int seed);
-void rng_srandom(struct RNG *rng, unsigned int seed);
-int         rng_getInt(struct RNG *rng);
-double      rng_getDouble(struct RNG *rng);
-float       rng_getFloat(struct RNG *rng);
-void        rng_shuffleArray(struct RNG *rng, void *data, int elemSize, int numElems);
+void        BLI_rng_seed(struct RNG *rng, unsigned int seed);
+void        BLI_rng_srandom(struct RNG *rng, unsigned int seed);
+int         BLI_rng_get_int(struct RNG *rng);
+double      BLI_rng_get_double(struct RNG *rng);
+float       BLI_rng_get_float(struct RNG *rng);
+void        BLI_rng_shuffle_array(struct RNG *rng, void *data, int elemSize, int numElems);
 
 /** Note that skipping is as slow as generating n numbers! */
-void        rng_skip(struct RNG *rng, int n);
+void        BLI_rng_skip(struct RNG *rng, int n);
 
 /** Seed the random number generator */
 void    BLI_srand(unsigned int seed);
@@ -94,7 +94,4 @@ int     BLI_thread_rand(int thread);
 /** Allows up to BLENDER_MAX_THREADS threads to address */
 float   BLI_thread_frand(int thread);
 
-
-
-#endif
-
+#endif  /* __BLI_RAND_H__ */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index de4c2cf..f2e2609 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -33,6 +33,9 @@
  *  \ingroup bli
  */
 
+#include "DNA_vec_types.h"
+#include "BLI_utildefines.h"
+
 struct rctf;
 struct rcti;
 
@@ -66,9 +69,7 @@ int  BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]);
 int  BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y);
 int  BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]);
 int  BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]);
-#if 0 /* NOT NEEDED YET */
-int  BLI_rctf_isect_segment(struct rcti *rect, int s1[2], int s2[2]);
-#endif
+int  BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]);
 void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2);
 void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2);
 void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src);
@@ -77,17 +78,6 @@ void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src);
 void print_rctf(const char *str, const struct rctf *rect);
 void print_rcti(const char *str, const struct rcti *rect);
 
-/* hrmf, we need to work out this inline stuff */
-#if defined(_MSC_VER)
-#  define BLI_INLINE static __forceinline
-#elif defined(__GNUC__)
-#  define BLI_INLINE static inline __attribute((always_inline))
-#else
-/* #warning "MSC/GNUC defines not found, inline non-functional" */
-#  define BLI_INLINE static
-#endif
-
-#include "DNA_vec_types.h"
 BLI_INLINE float BLI_rcti_cent_x_fl(const struct rcti *rct) { return (float)(rct->xmin + rct->xmax) / 2.0f; }
 BLI_INLINE float BLI_rcti_cent_y_fl(const struct rcti *rct) { return (float)(rct->ymin + rct->ymax) / 2.0f; }
 BLI_INLINE int   BLI_rcti_cent_x(const struct rcti *rct) { return (rct->xmin + rct->xmax) / 2; }
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index a6b1943..c8fd72b 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -94,16 +94,25 @@ typedef struct ScanFillFace {
 struct ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]);
 struct ScanFillEdge *BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2);
 
+enum {
+	BLI_SCANFILL_CALC_QUADTRI_FASTPATH = (1 << 0),
+
+	/* note: using BLI_SCANFILL_CALC_REMOVE_DOUBLES
+	 * Assumes ordered edges, otherwise we risk an eternal loop
+	 * removing double verts. - campbell */
+	BLI_SCANFILL_CALC_REMOVE_DOUBLES   = (1 << 1),
+};
+
 int BLI_scanfill_begin(ScanFillContext *sf_ctx);
-int BLI_scanfill_calc(ScanFillContext *sf_ctx, const short do_quad_tri_speedup);
-int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup,
+int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag);
+int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag,
                          const float nor_proj[3]);
 void BLI_scanfill_end(ScanFillContext *sf_ctx);
 
 /* These callbacks are needed to make the lib finction properly */
 
 /**
- * Set a function taking a char* as argument to flag errors. If the
+ * Set a function taking a (char *) as argument to flag errors. If the
  * callback is not set, the error is discarded.
  * \param f The function to use as callback
  * \attention used in creator.c
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 666c74c..70c8977 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -74,7 +74,7 @@ __attribute__((nonnull))
  * \param str2 second string for append
  * \retval Returns dst
  */
-char *BLI_strdupcat(const char *str1, const char *str2)
+char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
@@ -91,7 +91,7 @@ __attribute__((nonnull))
  *   the size of dst)
  * \retval Returns dst
  */
-char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
+char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
@@ -107,7 +107,7 @@ __attribute__((nonnull))
  * Assume that the strings returned must be freed afterwards, and that the inputs will contain
  * data we want...
  */
-char *BLI_str_quoted_substrN(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
@@ -124,7 +124,7 @@ __attribute__((nonnull))
  * \param newText The text in the string to find and replace
  * \retval Returns the duplicated string
  */
-char *BLI_replacestr(char *str, const char *oldText, const char *newText)
+char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
@@ -134,7 +134,7 @@ __attribute__((nonnull))
 /*
  * Replacement for snprintf
  */
-size_t BLI_snprintf(char *buffer, size_t len, const char *format, ...)
+size_t BLI_snprintf(char *__restrict buffer, size_t len, const char *__restrict format, ...)
 #ifdef __GNUC__
 __attribute__ ((format(printf, 3, 4)))
 __attribute__((nonnull))
@@ -144,7 +144,7 @@ __attribute__((nonnull))
 /*
  * Replacement for vsnprintf
  */
-size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
 #ifdef __GNUC__
 __attribute__ ((format(printf, 3, 0)))
 #endif
@@ -154,7 +154,7 @@ __attribute__ ((format(printf, 3, 0)))
  * Print formatted string into a newly mallocN'd string
  * and return it.
  */
-char *BLI_sprintfN(const char *format, ...)
+char *BLI_sprintfN(const char *__restrict format, ...)
 #ifdef __GNUC__
 __attribute__ ((format(printf, 1, 2)))
 __attribute__((warn_unused_result))
@@ -162,7 +162,7 @@ __attribute__((nonnull))
 #endif
 ;
 
-size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
+size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
@@ -204,7 +204,7 @@ __attribute__((warn_unused_result))
 __attribute__((nonnull))
 #endif
 ;
-size_t BLI_strnlen(const char *str, size_t maxlen)
+size_t BLI_strnlen(const char *str, const size_t maxlen)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
@@ -216,12 +216,12 @@ __attribute__((nonnull))
 #endif
 ; /* time var is global */
 
-void BLI_ascii_strtolower(char *str, int len)
+void BLI_ascii_strtolower(char *str, const size_t len)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
 ;
-void BLI_ascii_strtoupper(char *str, int len)
+void BLI_ascii_strtoupper(char *str, const size_t len)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 56ed4be..ecbc4cb 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -31,16 +31,17 @@
 extern "C" {
 #endif
 
-char        *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
-char        *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy);
+char        *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy);
+char        *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy);
 int          BLI_utf8_invalid_byte(const char *str, int length);
 int          BLI_utf8_invalid_strip(char *str, int length);
 
 int          BLI_str_utf8_size(const char *p); /* warning, can return -1 on bad chars */
+int          BLI_str_utf8_size_safe(const char *p);
 /* copied from glib */
 unsigned int BLI_str_utf8_as_unicode(const char *p);
-unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index);
-unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index);
+unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index);
+unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index);
 size_t       BLI_str_utf8_from_unicode(unsigned int c, char *outbuf);
 
 char        *BLI_str_find_prev_char_utf8(const char *str, const char *p);
@@ -50,8 +51,9 @@ char        *BLI_str_prev_char_utf8(const char *p);
 /* wchar_t functions, copied from blenders own font.c originally */
 size_t       BLI_wstrlen_utf8(const wchar_t *src);
 size_t       BLI_strlen_utf8(const char *strc);
-size_t       BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy);
-size_t       BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy);
+size_t       BLI_strnlen_utf8(const char *start, const size_t maxlen);
+size_t       BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxcpy);
+size_t       BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst, const char *__restrict src, const size_t maxcpy);
 
 #define      BLI_UTF8_MAX 6
 #define      BLI_UTF8_ERR ((unsigned int)-1)
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 9cd801f..ec8e567 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -37,6 +37,10 @@ extern "C" {
 
 #include <pthread.h>
 
+#ifdef __APPLE__
+#include <libkern/OSAtomic.h>
+#endif
+
 /* for tables, button in UI, etc */
 #define BLENDER_MAX_THREADS     64
 
@@ -92,6 +96,19 @@ void BLI_mutex_lock(ThreadMutex *mutex);
 void BLI_mutex_unlock(ThreadMutex *mutex);
 void BLI_mutex_end(ThreadMutex *mutex);
 
+/* Spin Lock */
+
+#ifdef __APPLE__
+typedef OSSpinLock SpinLock;
+#else
+typedef pthread_spinlock_t SpinLock;
+#endif
+
+void BLI_spin_init(SpinLock *spin);
+void BLI_spin_lock(SpinLock *spin);
+void BLI_spin_unlock(SpinLock *spin);
+void BLI_spin_end(SpinLock *spin);
+
 /* Read/Write Mutex Lock */
 
 #define THREAD_LOCK_READ    1
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index beb5540..7c3b705 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -40,43 +40,22 @@
 #  define TRUE 1
 #endif
 
-
-#define ELEM(a, b, c)           ((a) == (b) || (a) == (c))
-#define ELEM3(a, b, c, d)       (ELEM(a, b, c) || (a) == (d) )
-#define ELEM4(a, b, c, d, e)    (ELEM(a, b, c) || ELEM(a, d, e) )
-#define ELEM5(a, b, c, d, e, f) (ELEM(a, b, c) || ELEM3(a, d, e, f) )
-#define ELEM6(a, b, c, d, e, f, g)      (ELEM(a, b, c) || ELEM4(a, d, e, f, g) )
-#define ELEM7(a, b, c, d, e, f, g, h)   (ELEM3(a, b, c, d) || ELEM4(a, e, f, g, h) )
-#define ELEM8(a, b, c, d, e, f, g, h, i)        (ELEM4(a, b, c, d, e) || ELEM4(a, f, g, h, i) )
-#define ELEM9(a, b, c, d, e, f, g, h, i, j)        (ELEM4(a, b, c, d, e) || ELEM5(a, f, g, h, i, j) )
-#define ELEM10(a, b, c, d, e, f, g, h, i, j, k)        (ELEM4(a, b, c, d, e) || ELEM6(a, f, g, h, i, j, k) )
-#define ELEM11(a, b, c, d, e, f, g, h, i, j, k, l)        (ELEM4(a, b, c, d, e) || ELEM7(a, f, g, h, i, j, k, l) )
-
-/* shift around elements */
-#define SHIFT3(type, a, b, c)  {                                              \
-		type tmp;                                                             \
-		tmp = a;                                                              \
-		a = c;                                                                \
-		c = b;                                                                \
-		b = tmp;                                                              \
-} (void)0
-#define SHIFT4(type, a, b, c, d)  {                                           \
-		type tmp;                                                             \
-		tmp = a;                                                              \
-		a = d;                                                                \
-		d = c;                                                                \
-		c = b;                                                                \
-		b = tmp;                                                              \
-} (void)0
+/* useful for finding bad use of min/max */
+#if 0
+/* gcc only */
+#  define _TYPECHECK(a, b)  ((void)(((typeof(a) *)0) == ((typeof(b) *)0)))
+#  define MIN2(x, y)          (_TYPECHECK(x, y), (((x) < (y) ? (x) : (y))))
+#  define MAX2(x, y)          (_TYPECHECK(x, y), (((x) > (y) ? (x) : (y))))
+#endif
 
 /* min/max */
-#define MIN2(x, y)               ( (x) < (y) ? (x) : (y) )
-#define MIN3(x, y, z)             MIN2(MIN2((x), (y)), (z) )
-#define MIN4(x, y, z, a)           MIN2(MIN2((x), (y)), MIN2((z), (a)) )
+#define MIN2(x, y)          ((x) < (y) ? (x) : (y))
+#define MIN3(x, y, z)       (MIN2(MIN2((x), (y)), (z)))
+#define MIN4(x, y, z, a)    (MIN2(MIN2((x), (y)), MIN2((z), (a))))
 
-#define MAX2(x, y)               ( (x) > (y) ? (x) : (y) )
-#define MAX3(x, y, z)             MAX2(MAX2((x), (y)), (z) )
-#define MAX4(x, y, z, a)           MAX2(MAX2((x), (y)), MAX2((z), (a)) )
+#define MAX2(x, y)          ((x) > (y) ? (x) : (y))
+#define MAX3(x, y, z)       (MAX2(MAX2((x), (y)), (z)))
+#define MAX4(x, y, z, a)    (MAX2(MAX2((x), (y)), MAX2((z), (a))))
 
 #define INIT_MINMAX(min, max) {                                               \
 		(min)[0] = (min)[1] = (min)[2] =  1.0e30f;                            \
@@ -116,24 +95,28 @@
 /* Causes warning:
  * incompatible types when assigning to type 'Foo' from type 'Bar'
  * ... the compiler optimizes away the temp var */
-#ifndef CHECK_TYPE
 #ifdef __GNUC__
 #define CHECK_TYPE(var, type)  {  \
 	__typeof(var) *__tmp;         \
 	__tmp = (type *)NULL;         \
 	(void)__tmp;                  \
 } (void)0
+
+#define CHECK_TYPE_PAIR(var_a, var_b)  {  \
+	__typeof(var_a) *__tmp;               \
+	__tmp = (__typeof(var_b) *)NULL;      \
+	(void)__tmp;                          \
+} (void)0
 #else
-#define CHECK_TYPE(var, type)
-#endif
+#  define CHECK_TYPE(var, type)
+#  define CHECK_TYPE_PAIR(var_a, var_b)
 #endif
 
 /* can be used in simple macros */
 #define CHECK_TYPE_INLINE(val, type) \
 	((void)(((type *)0) != (val)))
 
-#ifndef SWAP
-#  define SWAP(type, a, b)  {  \
+#define SWAP(type, a, b)  {    \
 	type sw_ap;                \
 	CHECK_TYPE(a, type);       \
 	CHECK_TYPE(b, type);       \
@@ -141,7 +124,53 @@
 	(a) = (b);                 \
 	(b) = sw_ap;               \
 } (void)0
-#endif
+
+/* swap with a temp value */
+#define SWAP_TVAL(tval, a, b)  {  \
+	CHECK_TYPE_PAIR(tval, a);     \
+	CHECK_TYPE_PAIR(tval, b);     \
+	(tval) = (a);                 \
+	(a) = (b);                    \
+	(b) = (tval);                 \
+} (void)0
+
+
+#define ELEM(a, b, c)           ((a) == (b) || (a) == (c))
+#define ELEM3(a, b, c, d)       (ELEM(a, b, c) || (a) == (d) )
+#define ELEM4(a, b, c, d, e)    (ELEM(a, b, c) || ELEM(a, d, e) )
+#define ELEM5(a, b, c, d, e, f) (ELEM(a, b, c) || ELEM3(a, d, e, f) )
+#define ELEM6(a, b, c, d, e, f, g)      (ELEM(a, b, c) || ELEM4(a, d, e, f, g) )
+#define ELEM7(a, b, c, d, e, f, g, h)   (ELEM3(a, b, c, d) || ELEM4(a, e, f, g, h) )
+#define ELEM8(a, b, c, d, e, f, g, h, i)        (ELEM4(a, b, c, d, e) || ELEM4(a, f, g, h, i) )
+#define ELEM9(a, b, c, d, e, f, g, h, i, j)        (ELEM4(a, b, c, d, e) || ELEM5(a, f, g, h, i, j) )
+#define ELEM10(a, b, c, d, e, f, g, h, i, j, k)        (ELEM4(a, b, c, d, e) || ELEM6(a, f, g, h, i, j, k) )
+#define ELEM11(a, b, c, d, e, f, g, h, i, j, k, l)        (ELEM4(a, b, c, d, e) || ELEM7(a, f, g, h, i, j, k, l) )
+
+/* shift around elements */
+#define SHIFT3(type, a, b, c)  {                                              \
+	type tmp;                                                                 \
+	CHECK_TYPE(a, type);                                                      \
+	CHECK_TYPE(b, type);                                                      \
+	CHECK_TYPE(c, type);                                                      \
+	tmp = a;                                                                  \
+	a = c;                                                                    \
+	c = b;                                                                    \
+	b = tmp;                                                                  \
+} (void)0
+
+#define SHIFT4(type, a, b, c, d)  {                                           \
+	type tmp;                                                                 \
+	CHECK_TYPE(a, type);                                                      \
+	CHECK_TYPE(b, type);                                                      \
+	CHECK_TYPE(c, type);                                                      \
+	CHECK_TYPE(d, type);                                                      \
+	tmp = a;                                                                  \
+	a = d;                                                                    \
+	d = c;                                                                    \
+	c = b;                                                                    \
+	b = tmp;                                                                  \
+} (void)0
+
 
 #define ABS(a)          ( (a) < 0 ? (-(a)) : (a) )
 
@@ -193,6 +222,11 @@
 		*(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (fac);                            \
 		*(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (fac);                            \
 } (void)0
+#define VECMADD(v1, v2, v3, v4) {                                             \
+		*(v1) =   *(v2)   + *(v3) * (*(v4));                                     \
+		*(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (*(v4 + 1));                         \
+		*(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (*(v4 + 2));                         \
+} (void)0
 #define VECSUBFAC(v1, v2, v3, fac) {                                          \
 		*(v1) =   *(v2)   - *(v3) * (fac);                                    \
 		*(v1 + 1) = *(v2 + 1) - *(v3 + 1) * (fac);                            \
@@ -223,6 +257,15 @@
 #define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0))
 #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0))
 
+/* unpack vector for args */
+#define UNPACK2(a)  ((a)[0]), ((a)[1])
+#define UNPACK3(a)  ((a)[0]), ((a)[1]), ((a)[2])
+#define UNPACK4(a)  ((a)[0]), ((a)[1]), ((a)[2]), ((a)[3])
+/* op may be '&' or '*' */
+#define UNPACK2OP(a, op)  op((a)[0]), op((a)[1])
+#define UNPACK3OP(a, op)  op((a)[0]), op((a)[1]), op((a)[2])
+#define UNPACK4OP(a, op)  op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3])
+
 /* array helpers */
 #define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot)                 \
 	(arr_dtype *)((char *)arr_start + (elem_size * (tot - 1)))
@@ -281,11 +324,13 @@
 /*little macro so inline keyword works*/
 #if defined(_MSC_VER)
 #  define BLI_INLINE static __forceinline
-#elif defined(__GNUC__)
-#  define BLI_INLINE static inline __attribute((always_inline))
 #else
-/* #warning "MSC/GNUC defines not found, inline non-functional" */
-#  define BLI_INLINE static
+#  if (defined(__APPLE__) && defined(__ppc__))
+/* static inline __attribute__ here breaks osx ppc gcc42 build */
+#    define BLI_INLINE static __attribute__((always_inline))
+#  else
+#    define BLI_INLINE static inline __attribute__((always_inline))
+#  endif
 #endif
 
 
@@ -321,6 +366,13 @@
 #  define BLI_assert(a) (void)0
 #endif
 
+#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))  /* gcc4.6+ only */
+#  define BLI_STATIC_ASSERT(a, msg) _Static_assert(a, msg);
+#else
+   /* TODO msvc, clang */
+#  define BLI_STATIC_ASSERT(a, msg)
+#endif
+
 /* hints for branch pradiction, only use in code that runs a _lot_ where */
 #ifdef __GNUC__
 #  define LIKELY(x)       __builtin_expect(!!(x), 1)
diff --git a/source/blender/blenlib/BLI_voronoi.h b/source/blender/blenlib/BLI_voronoi.h
index a67b01c..68d7398 100644
--- a/source/blender/blenlib/BLI_voronoi.h
+++ b/source/blender/blenlib/BLI_voronoi.h
@@ -49,7 +49,7 @@ typedef struct VoronoiEdge {
 	float left[2];			/* point on Voronoi place on the left side of edge */
 	float right[2];			/* point on Voronoi place on the right side of edge */
 
-	float f, g;				/* directional coeffitients satisfying equation y = f*x + g (edge lies on this line) */
+	float f, g;				/* directional coeffitients satisfying equation y = f * x + g (edge lies on this line) */
 
 	/* some edges consist of two parts, so we add the pointer to another part to connect them at the end of an algorithm */
 	struct VoronoiEdge *neighbour;
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 2836174..8a3b1c9 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -70,6 +70,7 @@ set(SRC
 	intern/math_color_inline.c
 	intern/math_geom.c
 	intern/math_geom_inline.c
+	intern/math_interp.c
 	intern/math_matrix.c
 	intern/math_rotation.c
 	intern/math_vector.c
@@ -78,6 +79,7 @@ set(SRC
 	intern/noise.c
 	intern/path_util.c
 	intern/pbvh.c
+	intern/quadric.c
 	intern/rand.c
 	intern/rct.c
 	intern/scanfill.c
@@ -90,8 +92,8 @@ set(SRC
 	intern/threads.c
 	intern/time.c
 	intern/uvproject.c
-	intern/voxel.c
 	intern/voronoi.c
+	intern/voxel.c
 	intern/winstuff.c
 
 	BLI_args.h
@@ -126,6 +128,7 @@ set(SRC
 	BLI_math_color.h
 	BLI_math_geom.h
 	BLI_math_inline.h
+	BLI_math_interp.h
 	BLI_math_matrix.h
 	BLI_math_rotation.h
 	BLI_math_vector.h
@@ -135,6 +138,7 @@ set(SRC
 	BLI_noise.h
 	BLI_path_util.h
 	BLI_pbvh.h
+	BLI_quadric.h
 	BLI_rand.h
 	BLI_rect.h
 	BLI_scanfill.h
@@ -171,3 +175,9 @@ if(WIN32)
 endif()
 
 blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
+
+if(MSVC)
+	# Quiet warning about inline math library files that do not export symbols.
+	# (normally you'd exclude from project, but we still want to see the files in MSVC)
+	set_target_properties(bf_blenlib PROPERTIES STATIC_LIBRARY_FLAGS /ignore:4221)
+endif()
diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h
index 288d2fe..c3e7e84 100644
--- a/source/blender/blenlib/PIL_time.h
+++ b/source/blender/blenlib/PIL_time.h
@@ -20,7 +20,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Campbell Barton
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -30,7 +30,6 @@
  *  \brief Platform independent time functions.
  */
 
- 
 #ifndef __PIL_TIME_H__
 #define __PIL_TIME_H__
 
@@ -61,20 +60,35 @@ void    PIL_sleep_ms(int ms);
 		double _timeit_##var = PIL_check_seconds_timer();                     \
 		printf("time start (" #var "):  " AT "\n");                           \
 		fflush(stdout);                                                       \
-		{ (void)0                                                             \
-
+		{ (void)0
 
 #define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
 
+#define TIMEIT_VALUE_PRINT(var)                                               \
+	{                                                                         \
+		printf("time update(" #var "): %.6f" "  " AT "\n", TIMEIT_VALUE(var));\
+		fflush(stdout);                                                       \
+	} (void)0
 
 #define TIMEIT_END(var)                                                       \
 	}                                                                         \
-	printf("time end   (" #var "): %.6f" "  " AT "\n",  TIMEIT_VALUE(var));   \
+	printf("time end   (" #var "): %.6f" "  " AT "\n", TIMEIT_VALUE(var));    \
 	fflush(stdout);                                                           \
-} (void)0                                                                     \
+} (void)0
+
+/**
+ * Given some function/expression:
+ *   TIMEIT_BENCH(some_function(), some_unique_description);
+ */
+#define TIMEIT_BENCH(expr, id)                                                \
+	{                                                                         \
+		TIMEIT_START(id);                                                     \
+		(expr);                                                               \
+		TIMEIT_END(id);                                                       \
+	} (void)0
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* !__PIL_TIME_H__ */
+#endif  /* !__PIL_TIME_H__ */
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 844407f..c409492 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -135,7 +135,7 @@ int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFre
 			BLI_mempool_free(gh->entrypool, e);
 
 			/* correct but 'e' isn't used before return */
-			/* e= n; *//*UNUSED*/
+			/* e = n; *//*UNUSED*/
 			if (p) p->next = n;
 			else   gh->buckets[hash] = n;
 
@@ -165,7 +165,7 @@ void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
 			BLI_mempool_free(gh->entrypool, e);
 
 			/* correct but 'e' isn't used before return */
-			/* e= n; *//*UNUSED*/
+			/* e = n; *//*UNUSED*/
 			if (p) p->next = n;
 			else   gh->buckets[hash] = n;
 
@@ -178,7 +178,7 @@ void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
 	return NULL;
 }
 
-int BLI_ghash_haskey(GHash *gh, void *key)
+int BLI_ghash_haskey(GHash *gh, const void *key)
 {
 	unsigned int hash = gh->hashfp(key) % gh->nbuckets;
 	Entry *e;
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index ee7d93e..dcc0286 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -40,9 +40,9 @@
 /***/
 
 struct HeapNode {
-	void *ptr;
-	float value;
-	int index;
+	void        *ptr;
+	float        value;
+	unsigned int index;
 };
 
 struct Heap {
@@ -54,48 +54,43 @@ struct Heap {
 	HeapNode **tree;
 };
 
+/* internal functions */
+
 #define HEAP_PARENT(i) ((i - 1) >> 1)
 #define HEAP_LEFT(i)   ((i << 1) + 1)
 #define HEAP_RIGHT(i)  ((i << 1) + 2)
 #define HEAP_COMPARE(a, b) (a->value < b->value)
-// #define HEAP_EQUALS(a, b) (a->value == b->value) // UNUSED
-#define HEAP_SWAP(heap, i, j) \
-	{                                                                            \
-		SWAP(int, heap->tree[i]->index, heap->tree[j]->index);                   \
-		SWAP(HeapNode *, heap->tree[i], heap->tree[j]);                          \
-	} (void)0
 
-/***/
+#if 0  /* UNUSED */
+#define HEAP_EQUALS(a, b) (a->value == b->value)
+#endif
 
-Heap *BLI_heap_new(void)
+BLI_INLINE void heap_swap(Heap *heap, const unsigned int i, const unsigned int j)
 {
-	Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
-	heap->bufsize = 1;
-	heap->tree = (HeapNode **)MEM_mallocN(sizeof(HeapNode *), "BLIHeapTree");
-	heap->arena = BLI_memarena_new(1 << 16, "heap arena");
 
-	return heap;
+#if 0
+	SWAP(unsigned int,  heap->tree[i]->index, heap->tree[j]->index);
+	SWAP(HeapNode *,    heap->tree[i],        heap->tree[j]);
+#else
+	HeapNode **tree = heap->tree;
+	union {
+		unsigned int  index;
+		HeapNode     *node;
+	} tmp;
+	SWAP_TVAL(tmp.index, tree[i]->index, tree[j]->index);
+	SWAP_TVAL(tmp.node,  tree[i],        tree[j]);
+#endif
 }
 
-void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
+static void heap_down(Heap *heap, unsigned int i)
 {
-	int i;
-
-	if (ptrfreefp)
-		for (i = 0; i < heap->size; i++)
-			ptrfreefp(heap->tree[i]->ptr);
+	/* size won't change in the loop */
+	const unsigned int size = heap->size;
 
-	MEM_freeN(heap->tree);
-	BLI_memarena_free(heap->arena);
-	MEM_freeN(heap);
-}
-
-static void BLI_heap_down(Heap *heap, int i)
-{
 	while (1) {
-		int size = heap->size, smallest;
-		int l = HEAP_LEFT(i);
-		int r = HEAP_RIGHT(i);
+		const unsigned int l = HEAP_LEFT(i);
+		const unsigned int r = HEAP_RIGHT(i);
+		unsigned int smallest;
 
 		smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i])) ? l : i;
 
@@ -105,46 +100,75 @@ static void BLI_heap_down(Heap *heap, int i)
 		if (smallest == i)
 			break;
 
-		HEAP_SWAP(heap, i, smallest);
+		heap_swap(heap, i, smallest);
 		i = smallest;
 	}
 }
 
-static void BLI_heap_up(Heap *heap, int i)
+static void heap_up(Heap *heap, unsigned int i)
 {
 	while (i > 0) {
-		int p = HEAP_PARENT(i);
+		const unsigned int p = HEAP_PARENT(i);
 
 		if (HEAP_COMPARE(heap->tree[p], heap->tree[i]))
 			break;
 
-		HEAP_SWAP(heap, p, i);
+		heap_swap(heap, p, i);
 		i = p;
 	}
 }
 
-HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
+
+/***/
+
+/* use when the size of the heap is known in advance */
+Heap *BLI_heap_new_ex(unsigned int tot_reserve)
 {
-	HeapNode *node;
+	Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
+	/* ensure we have at least one so we can keep doubling it */
+	heap->bufsize = MAX2(1, tot_reserve);
+	heap->tree = (HeapNode **)MEM_mallocN(heap->bufsize * sizeof(HeapNode *), "BLIHeapTree");
+	heap->arena = BLI_memarena_new(1 << 16, "heap arena");
 
-	if ((heap->size + 1) > heap->bufsize) {
-		int newsize = heap->bufsize * 2;
-		HeapNode **newtree;
+	return heap;
+}
+
+Heap *BLI_heap_new(void)
+{
+	return BLI_heap_new_ex(1);
+}
+
+void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
+{
+	unsigned int i;
+
+	if (ptrfreefp) {
+		for (i = 0; i < heap->size; i++) {
+			ptrfreefp(heap->tree[i]->ptr);
+		}
+	}
 
-		newtree = (HeapNode **)MEM_mallocN(newsize * sizeof(*newtree), __func__);
-		memcpy(newtree, heap->tree, sizeof(HeapNode *) * heap->size);
-		MEM_freeN(heap->tree);
+	MEM_freeN(heap->tree);
+	BLI_memarena_free(heap->arena);
+	MEM_freeN(heap);
+}
 
-		heap->tree = newtree;
-		heap->bufsize = newsize;
+HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
+{
+	HeapNode *node;
+
+	if (UNLIKELY((heap->size + 1) > heap->bufsize)) {
+		heap->bufsize *= 2;
+		heap->tree = MEM_reallocN(heap->tree, heap->bufsize * sizeof(*heap->tree));
 	}
 
 	if (heap->freenodes) {
 		node = heap->freenodes;
 		heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
 	}
-	else
+	else {
 		node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
+	}
 
 	node->value = value;
 	node->ptr = ptr;
@@ -154,17 +178,17 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 
 	heap->size++;
 
-	BLI_heap_up(heap, heap->size - 1);
+	heap_up(heap, heap->size - 1);
 
 	return node;
 }
 
-int BLI_heap_empty(Heap *heap)
+int BLI_heap_is_empty(Heap *heap)
 {
 	return (heap->size == 0);
 }
 
-int BLI_heap_size(Heap *heap)
+unsigned int BLI_heap_size(Heap *heap)
 {
 	return heap->size;
 }
@@ -181,13 +205,14 @@ void *BLI_heap_popmin(Heap *heap)
 	heap->tree[0]->ptr = heap->freenodes;
 	heap->freenodes = heap->tree[0];
 
-	if (heap->size == 1)
+	if (UNLIKELY(heap->size == 1)) {
 		heap->size--;
+	}
 	else {
-		HEAP_SWAP(heap, 0, heap->size - 1);
+		heap_swap(heap, 0, heap->size - 1);
 		heap->size--;
 
-		BLI_heap_down(heap, 0);
+		heap_down(heap, 0);
 	}
 
 	return ptr;
@@ -195,12 +220,12 @@ void *BLI_heap_popmin(Heap *heap)
 
 void BLI_heap_remove(Heap *heap, HeapNode *node)
 {
-	int i = node->index;
+	unsigned int i = node->index;
 
 	while (i > 0) {
-		int p = HEAP_PARENT(i);
+		unsigned int p = HEAP_PARENT(i);
 
-		HEAP_SWAP(heap, p, i);
+		heap_swap(heap, p, i);
 		i = p;
 	}
 
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index a86783f..6cf167b 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -43,6 +43,8 @@
 
 #define MAX_TREETYPE 32
 
+typedef unsigned char axis_t;
+
 typedef struct BVHNode {
 	struct BVHNode **children;
 	struct BVHNode *parent; /* some user defined traversed need that */
@@ -53,6 +55,7 @@ typedef struct BVHNode {
 	char main_axis; /* Axis used to split this node */
 } BVHNode;
 
+/* keep under 26 bytes for speed purposes */
 struct BVHTree {
 	BVHNode **nodes;
 	BVHNode *nodearray;     /* pre-alloc branch nodes */
@@ -61,16 +64,21 @@ struct BVHTree {
 	float epsilon;          /* epslion is used for inflation of the k-dop	   */
 	int totleaf;            /* leafs */
 	int totbranch;
+	axis_t start_axis, stop_axis;  /* KDOP_AXES array indices according to axis */
+	axis_t axis;              /* kdop type (6 => OBB, 7 => AABB, ...) */
 	char tree_type;         /* type of tree (4 => quadtree) */
-	char axis;              /* kdop type (6 => OBB, 7 => AABB, ...) */
-	char start_axis, stop_axis;  /* KDOP_AXES array indices according to axis */
 };
 
+/* optimization, ensure we stay small */
+BLI_STATIC_ASSERT((sizeof(void *) == 8 && sizeof(BVHTree) <= 48) ||
+                  (sizeof(void *) == 4 && sizeof(BVHTree) <= 32),
+                  "over sized");
+
 typedef struct BVHOverlapData {
 	BVHTree *tree1, *tree2; 
 	BVHTreeOverlap *overlap; 
 	int i, max_overlap; /* i is number of overlaps */
-	int start_axis, stop_axis;
+	axis_t start_axis, stop_axis;
 } BVHOverlapData;
 
 typedef struct BVHNearestData {
@@ -113,6 +121,15 @@ static float KDOP_AXES[13][3] = {
 	{0, 1.0, -1.0}
 };
 
+MINLINE axis_t min_axis(axis_t a, axis_t b)
+{
+	return (a < b) ? a : b;
+}
+MINLINE axis_t max_axis(axis_t a, axis_t b)
+{
+	return (b < a) ? a : b;
+}
+
 #if 0
 
 /*
@@ -269,7 +286,7 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis)
 }
 #endif
 
-static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) // returns Sortable
+static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis)  /* returns Sortable */
 {
 	if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) {
 		if ((a[hi])->bv[axis] < (a[mid])->bv[axis])
@@ -374,24 +391,25 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
 {
 	float newminmax;
 	float *bv = node->bv;
-	int i, k;
+	int k;
+	axis_t axis_iter;
 	
 	/* don't init boudings for the moving case */
 		if (!moving) {
-		for (i = tree->start_axis; i < tree->stop_axis; i++) {
-			bv[2 * i] = FLT_MAX;
-			bv[2 * i + 1] = -FLT_MAX;
+		for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+			bv[2 * axis_iter] = FLT_MAX;
+			bv[2 * axis_iter + 1] = -FLT_MAX;
 		}
 	}
 	
 	for (k = 0; k < numpoints; k++) {
 		/* for all Axes. */
-		for (i = tree->start_axis; i < tree->stop_axis; i++) {
-			newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[i]);
-			if (newminmax < bv[2 * i])
-				bv[2 * i] = newminmax;
-			if (newminmax > bv[(2 * i) + 1])
-				bv[(2 * i) + 1] = newminmax;
+		for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+			newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[axis_iter]);
+			if (newminmax < bv[2 * axis_iter])
+				bv[2 * axis_iter] = newminmax;
+			if (newminmax > bv[(2 * axis_iter) + 1])
+				bv[(2 * axis_iter) + 1] = newminmax;
 		}
 	}
 }
@@ -400,25 +418,25 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
 static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end)
 {
 	float newmin, newmax;
-	int i, j;
 	float *bv = node->bv;
+	int j;
+	axis_t axis_iter;
 
-	
-	for (i = tree->start_axis; i < tree->stop_axis; i++) {
-		bv[2 * i] = FLT_MAX;
-		bv[2 * i + 1] = -FLT_MAX;
+	for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+		bv[(2 * axis_iter)] = FLT_MAX;
+		bv[(2 * axis_iter) + 1] = -FLT_MAX;
 	}
 
 	for (j = start; j < end; j++) {
 		/* for all Axes. */
-		for (i = tree->start_axis; i < tree->stop_axis; i++) {
-			newmin = tree->nodes[j]->bv[(2 * i)];   
-			if ((newmin < bv[(2 * i)]))
-				bv[(2 * i)] = newmin;
- 
-			newmax = tree->nodes[j]->bv[(2 * i) + 1];
-			if ((newmax > bv[(2 * i) + 1]))
-				bv[(2 * i) + 1] = newmax;
+		for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+			newmin = tree->nodes[j]->bv[(2 * axis_iter)];
+			if ((newmin < bv[(2 * axis_iter)]))
+				bv[(2 * axis_iter)] = newmin;
+
+			newmax = tree->nodes[j]->bv[(2 * axis_iter) + 1];
+			if ((newmax > bv[(2 * axis_iter) + 1]))
+				bv[(2 * axis_iter) + 1] = newmax;
 		}
 	}
 
@@ -451,23 +469,24 @@ static char get_largest_axis(float *bv)
  * join the children on the parent BV */
 static void node_join(BVHTree *tree, BVHNode *node)
 {
-	int i, j;
-	
-	for (i = tree->start_axis; i < tree->stop_axis; i++) {
-		node->bv[2 * i] = FLT_MAX;
-		node->bv[2 * i + 1] = -FLT_MAX;
+	int i;
+	axis_t axis_iter;
+
+	for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+		node->bv[(2 * axis_iter)] = FLT_MAX;
+		node->bv[(2 * axis_iter) + 1] = -FLT_MAX;
 	}
 	
 	for (i = 0; i < tree->tree_type; i++) {
 		if (node->children[i]) {
-			for (j = tree->start_axis; j < tree->stop_axis; j++) {
+			for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
 				/* update minimum */
-				if (node->children[i]->bv[(2 * j)] < node->bv[(2 * j)])
-					node->bv[(2 * j)] = node->children[i]->bv[(2 * j)];
+				if (node->children[i]->bv[(2 * axis_iter)] < node->bv[(2 * axis_iter)])
+					node->bv[(2 * axis_iter)] = node->children[i]->bv[(2 * axis_iter)];
 
 				/* update maximum */
-				if (node->children[i]->bv[(2 * j) + 1] > node->bv[(2 * j) + 1])
-					node->bv[(2 * j) + 1] = node->children[i]->bv[(2 * j) + 1];
+				if (node->children[i]->bv[(2 * axis_iter) + 1] > node->bv[(2 * axis_iter) + 1])
+					node->bv[(2 * axis_iter) + 1] = node->children[i]->bv[(2 * axis_iter) + 1];
 			}
 		}
 		else
@@ -482,10 +501,12 @@ static void node_join(BVHTree *tree, BVHNode *node)
 static void bvhtree_print_tree(BVHTree *tree, BVHNode *node, int depth)
 {
 	int i;
+	axis_t axis_iter;
+
 	for (i = 0; i < depth; i++) printf(" ");
 	printf(" - %d (%ld): ", node->index, node - tree->nodearray);
-	for (i = 2 * tree->start_axis; i < 2 * tree->stop_axis; i++)
-		printf("%.3f ", node->bv[i]);
+	for (axis_iter = 2 * tree->start_axis; axis_iter < 2 * tree->stop_axis; axis_iter++)
+		printf("%.3f ", node->bv[axis_iter]);
 	printf("\n");
 
 	for (i = 0; i < tree->tree_type; i++)
@@ -645,10 +666,10 @@ static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index
  *    (looping elements, knowing if its a leaf or not.. etc...)
  */
 
-// This functions returns the number of branches needed to have the requested number of leafs.
+/* This functions returns the number of branches needed to have the requested number of leafs. */
 static int implicit_needed_branches(int tree_type, int leafs)
 {
-	return maxi(1, (leafs + tree_type - 3) / (tree_type - 1) );
+	return max_ii(1, (leafs + tree_type - 3) / (tree_type - 1) );
 }
 
 /*
@@ -724,7 +745,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 	/* Loop tree levels (log N) loops */
 	for (i = 1, depth = 1; i <= num_branches; i = i * tree_type + tree_offset, depth++) {
 		const int first_of_next_level = i * tree_type + tree_offset;
-		const int end_j = MIN2(first_of_next_level, num_branches + 1);  /* index of last branch on this level */
+		const int end_j = min_ii(first_of_next_level, num_branches + 1);  /* index of last branch on this level */
 		int j;
 
 		/* Loop all branches on this level */
@@ -810,7 +831,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 	/* tree epsilon must be >= FLT_EPSILON
 	 * so that tangent rays can still hit a bounding volume..
 	 * this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
-	epsilon = MAX2(FLT_EPSILON, epsilon);
+	epsilon = max_ff(FLT_EPSILON, epsilon);
 
 	if (tree) {
 		tree->epsilon = epsilon;
@@ -843,7 +864,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 		}
 
 
-		//Allocate arrays
+		/* Allocate arrays */
 		numnodes = maxsize + implicit_needed_branches(tree_type, maxsize) + tree_type;
 
 		tree->nodes = (BVHNode **)MEM_callocN(sizeof(BVHNode *) * numnodes, "BVHNodes");
@@ -876,7 +897,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 			return NULL;
 		}
 
-		//link the dynamic bv and child links
+		/* link the dynamic bv and child links */
 		for (i = 0; i < numnodes; i++) {
 			tree->nodearray[i].bv = tree->nodebv + i * axis;
 			tree->nodearray[i].children = tree->nodechild + i * tree_type;
@@ -921,9 +942,9 @@ void BLI_bvhtree_balance(BVHTree *tree)
 	/* bvhtree_info(tree); */
 }
 
-int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
+int BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
 {
-	int i;
+	axis_t axis_iter;
 	BVHNode *node = NULL;
 
 	/* insert should only possible as long as tree->totbranch is 0 */
@@ -942,9 +963,9 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
 	node->index = index;
 
 	/* inflate the bv with some epsilon */
-	for (i = tree->start_axis; i < tree->stop_axis; i++) {
-		node->bv[(2 * i)] -= tree->epsilon; /* minimum */
-		node->bv[(2 * i) + 1] += tree->epsilon; /* maximum */
+	for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+		node->bv[(2 * axis_iter)] -= tree->epsilon; /* minimum */
+		node->bv[(2 * axis_iter) + 1] += tree->epsilon; /* maximum */
 	}
 
 	return 1;
@@ -952,10 +973,10 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
 
 
 /* call before BLI_bvhtree_update_tree() */
-int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const float *co_moving, int numpoints)
+int BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints)
 {
-	int i;
 	BVHNode *node = NULL;
+	axis_t axis_iter;
 	
 	/* check if index exists */
 	if (index > tree->totleaf)
@@ -968,10 +989,10 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const flo
 	if (co_moving)
 		create_kdop_hull(tree, node, co_moving, numpoints, 1);
 	
-	// inflate the bv with some epsilon
-	for (i = tree->start_axis; i < tree->stop_axis; i++) {
-		node->bv[(2 * i)] -= tree->epsilon; // minimum 
-		node->bv[(2 * i) + 1] += tree->epsilon; // maximum 
+	/* inflate the bv with some epsilon */
+	for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) {
+		node->bv[(2 * axis_iter)]     -= tree->epsilon; /* minimum */
+		node->bv[(2 * axis_iter) + 1] += tree->epsilon; /* maximum */
 	}
 
 	return 1;
@@ -991,7 +1012,7 @@ void BLI_bvhtree_update_tree(BVHTree *tree)
 		node_join(tree, *index);
 }
 
-float BLI_bvhtree_getepsilon(BVHTree *tree)
+float BLI_bvhtree_getepsilon(const BVHTree *tree)
 {
 	return tree->epsilon;
 }
@@ -1001,7 +1022,7 @@ float BLI_bvhtree_getepsilon(BVHTree *tree)
  * BLI_bvhtree_overlap
  *
  * overlap - is it possible for 2 bv's to collide ? */
-static int tree_overlap(BVHNode *node1, BVHNode *node2, int start_axis, int stop_axis)
+static int tree_overlap(BVHNode *node1, BVHNode *node2, axis_t start_axis, axis_t stop_axis)
 {
 	float *bv1 = node1->bv;
 	float *bv2 = node2->bv;
@@ -1045,7 +1066,7 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
 					data->max_overlap *= 2;
 				}
 				
-				// both leafs, insert overlap!
+				/* both leafs, insert overlap! */
 				data->overlap[data->i].indexA = node1->index;
 				data->overlap[data->i].indexB = node2->index;
 
@@ -1075,27 +1096,31 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 	BVHTreeOverlap *overlap = NULL, *to = NULL;
 	BVHOverlapData **data;
 	
-	// check for compatibility of both trees (can't compare 14-DOP with 18-DOP)
+	/* check for compatibility of both trees (can't compare 14-DOP with 18-DOP) */
 	if ((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18))
 		return NULL;
 	
-	// fast check root nodes for collision before doing big splitting + traversal
-	if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis)))
+	/* fast check root nodes for collision before doing big splitting + traversal */
+	if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf],
+	                  min_axis(tree1->start_axis, tree2->start_axis),
+	                  min_axis(tree1->stop_axis, tree2->stop_axis)))
+	{
 		return NULL;
+	}
 
 	data = MEM_callocN(sizeof(BVHOverlapData *) * tree1->tree_type, "BVHOverlapData_star");
 	
 	for (j = 0; j < tree1->tree_type; j++) {
 		data[j] = (BVHOverlapData *)MEM_callocN(sizeof(BVHOverlapData), "BVHOverlapData");
 		
-		// init BVHOverlapData
-		data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * MAX2(tree1->totleaf, tree2->totleaf));
+		/* init BVHOverlapData */
+		data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * max_ii(tree1->totleaf, tree2->totleaf));
 		data[j]->tree1 = tree1;
 		data[j]->tree2 = tree2;
-		data[j]->max_overlap = MAX2(tree1->totleaf, tree2->totleaf);
+		data[j]->max_overlap = max_ii(tree1->totleaf, tree2->totleaf);
 		data[j]->i = 0;
-		data[j]->start_axis = MIN2(tree1->start_axis, tree2->start_axis);
-		data[j]->stop_axis  = MIN2(tree1->stop_axis,  tree2->stop_axis);
+		data[j]->start_axis = min_axis(tree1->start_axis, tree2->start_axis);
+		data[j]->stop_axis  = min_axis(tree1->stop_axis,  tree2->stop_axis);
 	}
 
 #pragma omp parallel for private(j) schedule(static)
@@ -1123,13 +1148,13 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 	return overlap;
 }
 
-//Determines the nearest point of the given node BV. Returns the squared distance to that point.
+/* Determines the nearest point of the given node BV. Returns the squared distance to that point. */
 static float calc_nearest_point(const float proj[3], BVHNode *node, float *nearest)
 {
 	int i;
 	const float *bv = node->bv;
 
-	//nearest on AABB hull
+	/* nearest on AABB hull */
 	for (i = 0; i != 3; i++, bv += 2) {
 		if (bv[0] > proj[i])
 			nearest[i] = bv[0];
@@ -1140,7 +1165,7 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare
 	}
 
 #if 0
-	//nearest on a general hull
+	/* nearest on a general hull */
 	copy_v3_v3(nearest, data->co);
 	for (i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv += 2)
 	{
@@ -1167,7 +1192,7 @@ typedef struct NodeDistance {
 
 } NodeDistance;
 
-// TODO: use a priority queue to reduce the number of nodes looked on
+/* TODO: use a priority queue to reduce the number of nodes looked on */
 static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node)
 {
 	if (node->totnode == 0) {
@@ -1179,7 +1204,7 @@ static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node)
 		}
 	}
 	else {
-		//Better heuristic to pick the closest node to dive on
+		/* Better heuristic to pick the closest node to dive on */
 		int i;
 		float nearest[3];
 
@@ -1259,7 +1284,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 				dfs_find_nearest_dfs(data, child);
 			}
 			else {
-				//adjust heap size
+				/* adjust heap size */
 				if ((heap_size >= max_heap_size) &&
 				    ADJUST_MEMORY(default_heap, (void **)&heap, heap_size + 1, &max_heap_size, sizeof(heap[0])) == FALSE)
 				{
@@ -1299,22 +1324,23 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 #endif
 
 
-int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
+int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest,
+                             BVHTree_NearestPointCallback callback, void *userdata)
 {
-	int i;
+	axis_t axis_iter;
 
 	BVHNearestData data;
 	BVHNode *root = tree->nodes[tree->totleaf];
 
-	//init data to search
+	/* init data to search */
 	data.tree = tree;
 	data.co = co;
 
 	data.callback = callback;
 	data.userdata = userdata;
 
-	for (i = data.tree->start_axis; i != data.tree->stop_axis; i++) {
-		data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]);
+	for (axis_iter = data.tree->start_axis; axis_iter != data.tree->stop_axis; axis_iter++) {
+		data.proj[axis_iter] = dot_v3v3(data.co, KDOP_AXES[axis_iter]);
 	}
 
 	if (nearest) {
@@ -1346,7 +1372,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
 
 
 /* Determines the distance that the ray must travel to hit the bounding volume of the given node */
-static float ray_nearest_hit(BVHRayCastData *data, const float *bv)
+static float ray_nearest_hit(BVHRayCastData *data, const float bv[6])
 {
 	int i;
 
@@ -1354,7 +1380,7 @@ static float ray_nearest_hit(BVHRayCastData *data, const float *bv)
 
 	for (i = 0; i != 3; i++, bv += 2) {
 		if (data->ray_dot_axis[i] == 0.0f) {
-			//axis aligned ray
+			/* axis aligned ray */
 			if (data->ray.origin[i] < bv[0] - data->ray.radius ||
 			    data->ray.origin[i] > bv[1] + data->ray.radius)
 			{
@@ -1384,7 +1410,7 @@ static float ray_nearest_hit(BVHRayCastData *data, const float *bv)
  * Based on Tactical Optimization of Ray/Box Intersection, by Graham Fyffe
  * [http://tog.acm.org/resources/RTNews/html/rtnv21n1.html#art9]
  *
- * TODO this doens't has data->ray.radius in consideration */
+ * TODO this doesn't take data->ray.radius into consideration */
 static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *node)
 {
 	const float *bv = node->bv;
@@ -1469,12 +1495,13 @@ static void iterative_raycast(BVHRayCastData *data, BVHNode *node)
 		}
 		else {
 			node = node->children[0];
-		}	
+		}
 	}
 }
 #endif
 
-int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
+int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit,
+                         BVHTree_RayCastCallback callback, void *userdata)
 {
 	int i;
 	BVHRayCastData data;
@@ -1524,14 +1551,14 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
 	return data.hit.index;
 }
 
-float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3])
+float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], const float light_end[3], float pos[3])
 {
 	BVHRayCastData data;
 	float dist = 0.0;
 
 	data.hit.dist = FLT_MAX;
 	
-	// get light direction
+	/* get light direction */
 	data.ray.direction[0] = light_end[0] - light_start[0];
 	data.ray.direction[1] = light_end[1] - light_start[1];
 	data.ray.direction[2] = light_end[2] - light_start[2];
@@ -1563,7 +1590,7 @@ float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const
 typedef struct RangeQueryData {
 	BVHTree *tree;
 	const float *center;
-	float radius;           //squared radius
+	float radius;  /* squared radius */
 
 	int hits;
 
@@ -1578,7 +1605,7 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
 {
 	if (node->totnode == 0) {
 #if 0   /*UNUSED*/
-		//Calculate the node min-coords (if the node was a point then this is the point coordinates)
+		/* Calculate the node min-coords (if the node was a point then this is the point coordinates) */
 		float co[3];
 		co[0] = node->bv[0];
 		co[1] = node->bv[2];
@@ -1591,7 +1618,7 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
 			float nearest[3];
 			float dist = calc_nearest_point(data->center, node->children[i], nearest);
 			if (dist < data->radius) {
-				//Its a leaf.. call the callback
+				/* Its a leaf.. call the callback */
 				if (node->children[i]->totnode == 0) {
 					data->hits++;
 					data->callback(data->userdata, node->children[i]->index, dist);
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 19985c5..dd6c25a 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -30,16 +30,12 @@
  *  \ingroup bli
  */
 
-
-
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
 #include "BLI_kdtree.h"
+#include "BLI_utildefines.h"
 
-#ifndef SWAP
-#  define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
-#endif
 
 typedef struct KDTreeNode {
 	struct KDTreeNode *left, *right;
@@ -132,7 +128,7 @@ void BLI_kdtree_balance(KDTree *tree)
 	tree->root = kdtree_balance(tree->nodes, tree->totnode, 0);
 }
 
-static float squared_distance(const float v2[3], const float v1[3], const float *UNUSED(n1), const float *n2)
+static float squared_distance(const float v2[3], const float v1[3], const float UNUSED(n1[3]), const float n2[3])
 {
 	float d[3], dist;
 
@@ -152,7 +148,7 @@ static float squared_distance(const float v2[3], const float v1[3], const float
 	return dist;
 }
 
-int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *nearest)
+int BLI_kdtree_find_nearest(KDTree *tree, const float co[3], const float nor[3], KDTreeNearest *nearest)
 {
 	KDTreeNode *root, *node, *min_node;
 	KDTreeNode **stack, *defaultstack[100];
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index 858eef0..688372b 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -502,7 +502,7 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node)
 /* ----- */
 
 /* Add the given data to the tree, and return the node added */
-// NOTE: for duplicates, the update_cb is called (if available), and the existing node is returned
+/* NOTE: for duplicates, the update_cb is called (if available), and the existing node is returned */
 DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, 
                              DLRBT_NAlloc_FP new_cb, DLRBT_NUpdate_FP update_cb, void *data)
 {
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index 1c70a61..8a97fdc 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -73,7 +73,7 @@ typedef struct BoxVert {
                         ((b)->v[BR]->x = (b)->v[TR]->x)
 #define UPDATE_V34Y(b)  ((b)->v[TL]->y = (b)->v[TR]->y); \
                         ((b)->v[BR]->y = (b)->v[BL]->y)
-						
+
 /* UNUSED */
 // #define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b)
 
@@ -96,7 +96,7 @@ typedef struct BoxVert {
       BOXTOP(b1)    - EPSILON <= BOXBOTTOM(b2))
 
 /* compiler should inline */
-static float maxf(const float a, const float b) { return b > a ? b : a; }
+static float max_ff(const float a, const float b) { return b > a ? b : a; }
 
 #if 0
 #define BOXDEBUG(b) \
@@ -133,8 +133,8 @@ static int vertex_sort(const void *p1, const void *p2)
 	v1 = vertarray + ((int *)p1)[0];
 	v2 = vertarray + ((int *)p2)[0];
 
-	a1 = maxf(v1->x + box_width, v1->y + box_height);
-	a2 = maxf(v2->x + box_width, v2->y + box_height);
+	a1 = max_ff(v1->x + box_width, v1->y + box_height);
+	a2 = max_ff(v2->x + box_width, v2->y + box_height);
 
 	/* sort largest to smallest */
 	if      (a1 > a2) return 1;
@@ -314,8 +314,8 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *
 					if (!isect) {
 
 						/* maintain the total width and height */
-						(*tot_width) = maxf(BOXRIGHT(box), (*tot_width));
-						(*tot_height) = maxf(BOXTOP(box), (*tot_height));
+						(*tot_width) = max_ff(BOXRIGHT(box), (*tot_width));
+						(*tot_height) = max_ff(BOXTOP(box), (*tot_height));
 
 						/* Place the box */
 						vert->free &= ~quad_flags[j];
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index f72b588..c650438 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -64,6 +64,8 @@
 #include "DNA_sequence_types.h"
 #include "DNA_sound_types.h"
 #include "DNA_text_types.h"
+#include "DNA_material_types.h"
+#include "DNA_node_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_vfont_types.h"
 #include "DNA_scene_types.h"
@@ -76,6 +78,7 @@
 #include "BKE_font.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_sequencer.h"
 #include "BKE_image.h" /* so we can check the image's type */
@@ -85,7 +88,7 @@ static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), co
 	ReportList *reports = (ReportList *)userdata;
 
 	if (!BLI_exists(path_src)) {
-		BKE_reportf(reports, RPT_WARNING, "Path Not Found \"%s\"", path_src);
+		BKE_reportf(reports, RPT_WARNING, "Path '%s' not found", path_src);
 	}
 
 	return FALSE;
@@ -122,7 +125,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
 			data->count_changed++;
 		}
 		else {
-			BKE_reportf(data->reports, RPT_WARNING, "Path cant be made relative \"%s\"", path_src);
+			BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made relative", path_src);
 			data->count_failed++;
 		}
 		return TRUE;
@@ -144,7 +147,7 @@ void BLI_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re
 	BLI_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
 
 	BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
-	            "Total files %d|Changed %d|Failed %d",
+	            "Total files %d | Changed %d | Failed %d",
 	            data.count_tot, data.count_changed, data.count_failed);
 }
 
@@ -164,7 +167,7 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
 			data->count_changed++;
 		}
 		else {
-			BKE_reportf(data->reports, RPT_WARNING, "Path cant be made absolute \"%s\"", path_src);
+			BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
 			data->count_failed++;
 		}
 		return TRUE;
@@ -187,13 +190,13 @@ void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re
 	BLI_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
 
 	BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
-	            "Total files %d|Changed %d|Failed %d",
+	            "Total files %d | Changed %d | Failed %d",
 	            data.count_tot, data.count_changed, data.count_failed);
 }
 
 /**
  * find this file recursively, use the biggest file so thumbnails don't get used by mistake
- * \param filename_new: the path will be copied here, caller must initialize as empyu string.
+ * \param filename_new: the path will be copied here, caller must initialize as empty string.
  * \param dirname: subdir to search
  * \param filename: set this filename
  * \param filesize: filesize for the file
@@ -279,13 +282,13 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
 
 	if (filesize == -1) { /* could not open dir */
 		BKE_reportf(data->reports, RPT_WARNING,
-		            "Could open directory \"%s\"",
+		            "Could not open directory '%s'",
 		            BLI_path_basename(data->searchdir));
 		return FALSE;
 	}
 	else if (found == FALSE) {
 		BKE_reportf(data->reports, RPT_WARNING,
-		            "Could not find \"%s\" in \"%s\"",
+		            "Could not find '%s' in '%s'",
 		            BLI_path_basename((char *)path_src), data->searchdir);
 		return FALSE;
 	}
@@ -382,7 +385,6 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
 /* Run visitor function 'visit' on all paths contained in 'id'. */
 void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
-	Image *ima;
 	const char *absbase = (flag & BLI_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
 
 	if ((flag & BLI_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
@@ -391,6 +393,8 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 
 	switch (GS(id->name)) {
 		case ID_IM:
+		{
+			Image *ima;
 			ima = (Image *)id;
 			if (ima->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
 				if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
@@ -398,15 +402,20 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 				}
 			}
 			break;
+		}
 		case ID_BR:
 		{
 			Brush *brush = (Brush *)id;
 			if (brush->icon_filepath[0]) {
 				rewrite_path_fixed(brush->icon_filepath, visit_cb, absbase, bpath_user_data);
 			}
+			break;
 		}
-		break;
 		case ID_OB:
+		{
+			Object *ob = (Object *)id;
+			ModifierData *md;
+			ParticleSystem *psys;
 
 #define BPATH_TRAVERSE_POINTCACHE(ptcaches)                                    \
 	{                                                                          \
@@ -421,62 +430,56 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 		}                                                                      \
 	} (void)0
 
-
-			{
-				Object *ob = (Object *)id;
-				ModifierData *md;
-				ParticleSystem *psys;
-
-				/* do via modifiers instead */
+			/* do via modifiers instead */
 #if 0
-				if (ob->fluidsimSettings) {
-					rewrite_path_fixed(ob->fluidsimSettings->surfdataPath, visit_cb, absbase, bpath_user_data);
-				}
+			if (ob->fluidsimSettings) {
+				rewrite_path_fixed(ob->fluidsimSettings->surfdataPath, visit_cb, absbase, bpath_user_data);
+			}
 #endif
 
-				for (md = ob->modifiers.first; md; md = md->next) {
-					if (md->type == eModifierType_Fluidsim) {
-						FluidsimModifierData *fluidmd = (FluidsimModifierData *)md;
-						if (fluidmd->fss) {
-							rewrite_path_fixed(fluidmd->fss->surfdataPath, visit_cb, absbase, bpath_user_data);
-						}
+			for (md = ob->modifiers.first; md; md = md->next) {
+				if (md->type == eModifierType_Fluidsim) {
+					FluidsimModifierData *fluidmd = (FluidsimModifierData *)md;
+					if (fluidmd->fss) {
+						rewrite_path_fixed(fluidmd->fss->surfdataPath, visit_cb, absbase, bpath_user_data);
 					}
-					else if (md->type == eModifierType_Smoke) {
-						SmokeModifierData *smd = (SmokeModifierData *)md;
-						if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
-							BPATH_TRAVERSE_POINTCACHE(smd->domain->ptcaches[0]);
-						}
-					}
-					else if (md->type == eModifierType_Cloth) {
-						ClothModifierData *clmd = (ClothModifierData *) md;
-						BPATH_TRAVERSE_POINTCACHE(clmd->ptcaches);
-					}
-					else if (md->type == eModifierType_Ocean) {
-						OceanModifierData *omd = (OceanModifierData *) md;
-						rewrite_path_fixed(omd->cachepath, visit_cb, absbase, bpath_user_data);
+				}
+				else if (md->type == eModifierType_Smoke) {
+					SmokeModifierData *smd = (SmokeModifierData *)md;
+					if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+						BPATH_TRAVERSE_POINTCACHE(smd->domain->ptcaches[0]);
 					}
 				}
-
-				if (ob->soft) {
-					BPATH_TRAVERSE_POINTCACHE(ob->soft->ptcaches);
+				else if (md->type == eModifierType_Cloth) {
+					ClothModifierData *clmd = (ClothModifierData *) md;
+					BPATH_TRAVERSE_POINTCACHE(clmd->ptcaches);
 				}
-
-				for (psys = ob->particlesystem.first; psys; psys = psys->next) {
-					BPATH_TRAVERSE_POINTCACHE(psys->ptcaches);
+				else if (md->type == eModifierType_Ocean) {
+					OceanModifierData *omd = (OceanModifierData *) md;
+					rewrite_path_fixed(omd->cachepath, visit_cb, absbase, bpath_user_data);
 				}
 			}
 
+			if (ob->soft) {
+				BPATH_TRAVERSE_POINTCACHE(ob->soft->ptcaches);
+			}
+
+			for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+				BPATH_TRAVERSE_POINTCACHE(psys->ptcaches);
+			}
+
 #undef BPATH_TRAVERSE_POINTCACHE
 
 			break;
+		}
 		case ID_SO:
 		{
 			bSound *sound = (bSound *)id;
 			if (sound->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
 				rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data);
 			}
+			break;
 		}
-		break;
 		case ID_TXT:
 			if (((Text *)id)->name) {
 				rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, bpath_user_data);
@@ -490,17 +493,49 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 					rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data);
 				}
 			}
+			break;
+		}
+		case ID_MA:
+		{
+			Material *ma = (Material *)id;
+			bNodeTree *ntree = ma->nodetree;
+
+			if (ntree) {
+				bNode *node;
+
+				for (node = ntree->nodes.first; node; node = node->next) {
+					if (node->type == SH_NODE_SCRIPT) {
+						NodeShaderScript *nss = (NodeShaderScript *)node->storage;
+						rewrite_path_fixed(nss->filepath, visit_cb, absbase, bpath_user_data);
+					}
+				}
+			}
+			break;
+		}
+		case ID_NT:
+		{
+			bNodeTree *ntree = (bNodeTree *)id;
+			bNode *node;
+
+			if (ntree->type == NTREE_SHADER) {
+				/* same as lines above */
+				for (node = ntree->nodes.first; node; node = node->next) {
+					if (node->type == SH_NODE_SCRIPT) {
+						NodeShaderScript *nss = (NodeShaderScript *)node->storage;
+						rewrite_path_fixed(nss->filepath, visit_cb, absbase, bpath_user_data);
+					}
+				}
+			}
+			break;
 		}
-		break;
 		case ID_TE:
 		{
 			Tex *tex = (Tex *)id;
 			if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) {
 				rewrite_path_fixed(tex->vd->source_path, visit_cb, absbase, bpath_user_data);
 			}
+			break;
 		}
-		break;
-
 		case ID_SCE:
 		{
 			Scene *scene = (Scene *)id;
@@ -539,30 +574,30 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 				}
 				SEQ_END
 			}
+			break;
 		}
-		break;
 		case ID_ME:
 		{
 			Mesh *me = (Mesh *)id;
 			if (me->ldata.external) {
 				rewrite_path_fixed(me->ldata.external->filename, visit_cb, absbase, bpath_user_data);
 			}
+			break;
 		}
-		break;
 		case ID_LI:
 		{
 			Library *lib = (Library *)id;
 			if (rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
 				BKE_library_filepath_set(lib, lib->name);
 			}
+			break;
 		}
-		break;
 		case ID_MC:
 		{
 			MovieClip *clip = (MovieClip *)id;
 			rewrite_path_fixed(clip->name, visit_cb, absbase, bpath_user_data);
+			break;
 		}
-		break;
 		default:
 			/* Nothing to do for other IDs that don't contain file paths. */
 			break;
@@ -618,3 +653,73 @@ int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat
 		return FALSE;
 	}
 }
+
+
+/* -------------------------------------------------------------------- */
+/**
+ * Backup/Restore/Free functions,
+ * \note These functions assume the data won't chane order.
+ */
+
+struct PathStore {
+	struct PathStore *next, *prev;
+} PathStore;
+
+static int bpath_list_append(void *userdata, char *UNUSED(path_dst), const char *path_src)
+{
+	/* store the path and string in a single alloc */
+	ListBase *ls = userdata;
+	size_t path_size = strlen(path_src) + 1;
+	struct PathStore *path_store = MEM_mallocN(sizeof(PathStore) + path_size, __func__);
+	char *filepath = (char *)(path_store + 1);
+
+	memcpy(filepath, path_src, path_size);
+	BLI_addtail(ls, path_store);
+	return FALSE;
+}
+
+static int bpath_list_restore(void *userdata, char *path_dst, const char *path_src)
+{
+	/* assume ls->first wont be NULL because the number of paths can't change!
+	 * (if they do caller is wrong) */
+	ListBase *ls = userdata;
+	struct PathStore *path_store = ls->first;
+	const char *filepath = (char *)(path_store + 1);
+	int ret;
+
+	if (strcmp(path_src, filepath) == 0) {
+		ret = FALSE;
+	}
+	else {
+		BLI_strncpy(path_dst, filepath, FILE_MAX);
+		ret = TRUE;
+	}
+
+	BLI_freelinkN(ls, path_store);
+	return ret;
+}
+
+/* return ls_handle */
+void *BLI_bpath_list_backup(Main *bmain, const int flag)
+{
+	ListBase *ls = MEM_callocN(sizeof(ListBase), __func__);
+
+	BLI_bpath_traverse_main(bmain, bpath_list_append, flag, ls);
+
+	return ls;
+}
+
+void BLI_bpath_list_restore(Main *bmain, const int flag, void *ls_handle)
+{
+	ListBase *ls = ls_handle;
+
+	BLI_bpath_traverse_main(bmain, bpath_list_restore, flag, ls);
+}
+
+void BLI_bpath_list_free(void *ls_handle)
+{
+	ListBase *ls = ls_handle;
+	BLI_assert(ls->first == NULL);  /* assumes we were used */
+	BLI_freelistN(ls);
+	MEM_freeN(ls);
+}
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index d58ccbb..4fb48d1 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -108,7 +108,7 @@ void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *v
 	eh->buckets[hash] = e;
 
 	if (++eh->nentries > eh->nbuckets * 3) {
-		EdgeEntry *e, **old = eh->buckets;
+		EdgeEntry **old = eh->buckets;
 		int i, nold = eh->nbuckets;
 
 		eh->nbuckets = _ehash_hashsizes[++eh->cursize];
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 8523927..0a87316 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -33,8 +33,8 @@
  */
 
 
-#ifdef WIN32
-#pragma warning (disable:4244)
+#ifdef _MSC_VER
+#  pragma warning (disable:4244)
 #endif
 
 #include <ft2build.h>
@@ -271,7 +271,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 					    (len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) &&
 					    (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) &&
 					    (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) >
-					     maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
+					     max_ff(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
 					          len_squared_v2v2(bezt->vec[1], bezt->vec[2]))))
 					{
 						bezt->h1 = bezt->h2 = HD_ALIGN;
@@ -282,7 +282,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 			}
 		}
 		if (npoints) MEM_freeN(npoints);
-		if (onpoints) MEM_freeN(onpoints);	
+		if (onpoints) MEM_freeN(onpoints);
 	}
 }
 
@@ -404,7 +404,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf)
 		lcode = charcode;
 	}
 
-	return vfd;	
+	return vfd;
 }
 
 
@@ -473,10 +473,10 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
 	VFontData *vfd = NULL;
 	int success = 0;
 
-	//init Freetype	
+	/* init Freetype */
 	err = FT_Init_FreeType(&library);
 	if (err) {
-		//XXX error("Failed to load the Freetype font library");
+		/* XXX error("Failed to load the Freetype font library"); */
 		return NULL;
 	}
 
@@ -486,7 +486,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
 		vfd = objfnt_to_ftvfontdata(pf);
 	}
 
-	//free Freetype
+	/* free Freetype */
 	FT_Done_FreeType(library);
 	
 	return vfd;
@@ -518,16 +518,16 @@ int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
 
 #if 0
 
-// Freetype2 Outline struct
+/* Freetype2 Outline struct */
 
 typedef struct  FT_Outline_
-  {
+{
 	short       n_contours;      /* number of contours in glyph        */
 	short       n_points;        /* number of points in the glyph      */
 
-	FT_Vector*  points;          /* the outline's points               */
-	char*       tags;            /* the points flags                   */
-	short*      contours;        /* the contour end points             */
+	FT_Vector  *points;          /* the outline's points               */
+	char       *tags;            /* the points flags                   */
+	short      *contours;        /* the contour end points             */
 
 	int         flags;           /* outline masks                      */
 } FT_Outline;
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 51d7cb5..a93bbd9 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -353,12 +353,12 @@ int BLI_isGraphCyclic(BGraph *graph)
 	/* Mark all nodes as not visited */
 	BLI_flagNodes(graph, 0);
 
-	/* detectCycles in subgraphs */	
+	/* detectCycles in subgraphs */
 	for (node = graph->nodes.first; node && value == 0; node = node->next) {
 		/* only for nodes in subgraphs that haven't been visited yet */
 		if (node->flag == 0) {
 			value = value || detectCycle(node, NULL);
-		}		
+		}
 	}
 	
 	return value;
@@ -639,11 +639,11 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
 
 		/* if not dispatching already and on last arc
 		 * Dispatch using current arc as last
-		 * */		
+		 */
 		if (dispatch == 0 && i == total - 1) {
 			last = i;
 			dispatch = 1;
-		} 
+		}
 		
 		if (dispatch) {
 			int sub_total = last - first + 1; 
@@ -796,7 +796,7 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
 	
 	/* count the number of branches in this symmetry group
 	 * and determinate the axis of symmetry
-	 *  */	
+	 */
 	for (i = 0; i < node->degree; i++) {
 		BArc *connectedArc = node->arcs[i];
 		
@@ -821,7 +821,7 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
 		handleRadialSymmetry(graph, node, depth, axis, limit);
 	}
 		
-	/* markdown secondary symetries */	
+	/* markdown secondary symetries */
 	for (i = 0; i < node->degree; i++) {
 		BArc *connectedArc = node->arcs[i];
 		
@@ -836,7 +836,7 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
 {
 	int i;
 
-	/* if arc is null, we start straight from a node */	
+	/* if arc is null, we start straight from a node */
 	if (arc) {
 		arc->symmetry_level = level;
 		
@@ -875,7 +875,7 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
 					/* not on the symmetry axis */
 					issymmetryAxis = 0;
 					break;
-				} 
+				}
 			}
 		}
 		
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index ad718ed..9f6f409 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -141,7 +141,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
 	if (listbase == NULL) return;
 	
 	/* empty list */
-	if (listbase->first == NULL) { 
+	if (listbase->first == NULL) {
 		
 		listbase->first = newlink;
 		listbase->last = newlink;
@@ -149,7 +149,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
 	}
 	
 	/* insert before first element */
-	if (prevlink == NULL) {	
+	if (prevlink == NULL) {
 		newlink->next = listbase->first;
 		newlink->prev = NULL;
 		newlink->next->prev = newlink;
@@ -203,14 +203,14 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
 	if (listbase == NULL) return;
 
 	/* empty list */
-	if (listbase->first == NULL) { 
+	if (listbase->first == NULL) {
 		listbase->first = newlink;
 		listbase->last = newlink;
 		return;
 	}
 	
 	/* insert at head of list */
-	if (prevlink == NULL) {	
+	if (prevlink == NULL) {
 		newlink->prev = NULL;
 		newlink->next = listbase->first;
 		((Link *)listbase->first)->prev = newlink;
@@ -238,14 +238,14 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
 	if (listbase == NULL) return;
 
 	/* empty list */
-	if (listbase->first == NULL) { 
+	if (listbase->first == NULL) {
 		listbase->first = newlink;
 		listbase->last = newlink;
 		return;
 	}
 	
 	/* insert at end of list */
-	if (nextlink == NULL) {	
+	if (nextlink == NULL) {
 		newlink->prev = listbase->last;
 		newlink->next = NULL;
 		((Link *)listbase->last)->next = newlink;
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 97fc431..b9866f9 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -27,6 +27,8 @@
  *  \ingroup bli
  */
 
+#ifndef __MATH_BASE_INLINE_C__
+#define __MATH_BASE_INLINE_C__
 
 #include <float.h>
 #include <stdio.h>
@@ -35,9 +37,6 @@
 
 #include "BLI_math.h"
 
-#ifndef __MATH_BASE_INLINE_C__
-#define __MATH_BASE_INLINE_C__
-
 /* A few small defines. Keep'em local! */
 #define SMALL_NUMBER  1.e-8f
 
@@ -59,34 +58,34 @@ MINLINE float saacos(float fac)
 {
 	if (fac <= -1.0f) return (float)M_PI;
 	else if (fac >= 1.0f) return 0.0;
-	else return (float)acos(fac);
+	else return acosf(fac);
 }
 
 MINLINE float saasin(float fac)
 {
 	if (fac <= -1.0f) return (float)-M_PI / 2.0f;
 	else if (fac >= 1.0f) return (float)M_PI / 2.0f;
-	else return (float)asin(fac);
+	else return asinf(fac);
 }
 
 MINLINE float sasqrt(float fac)
 {
 	if (fac <= 0.0f) return 0.0f;
-	return (float)sqrt(fac);
+	return sqrtf(fac);
 }
 
 MINLINE float saacosf(float fac)
 {
 	if (fac <= -1.0f) return (float)M_PI;
 	else if (fac >= 1.0f) return 0.0f;
-	else return (float)acosf(fac);
+	else return acosf(fac);
 }
 
 MINLINE float saasinf(float fac)
 {
 	if (fac <= -1.0f) return (float)-M_PI / 2.0f;
 	else if (fac >= 1.0f) return (float)M_PI / 2.0f;
-	else return (float)asinf(fac);
+	else return asinf(fac);
 }
 
 MINLINE float sasqrtf(float fac)
@@ -139,20 +138,39 @@ MINLINE int power_of_2_min_i(int n)
 	return n;
 }
 
-MINLINE float minf(float a, float b)
+MINLINE unsigned int highest_order_bit_i(unsigned int n)
+{
+	n |= (n >>  1);
+	n |= (n >>  2);
+	n |= (n >>  4);
+	n |= (n >>  8);
+	n |= (n >> 16);
+	return n - (n >> 1);
+}
+
+MINLINE unsigned short highest_order_bit_s(unsigned short n)
+{
+	n |= (n >>  1);
+	n |= (n >>  2);
+	n |= (n >>  4);
+	n |= (n >>  8);
+	return n - (n >> 1);
+}
+
+MINLINE float min_ff(float a, float b)
 {
 	return (a < b) ? a : b;
 }
-MINLINE float maxf(float a, float b)
+MINLINE float max_ff(float a, float b)
 {
 	return (a > b) ? a : b;
 }
 
-MINLINE int mini(int a, int b)
+MINLINE int min_ii(int a, int b)
 {
 	return (a < b) ? a : b;
 }
-MINLINE int maxi(int a, int b)
+MINLINE int max_ii(int a, int b)
 {
 	return (b < a) ? a : b;
 }
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index f520b23..4c8bd43 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -164,7 +164,11 @@ MINLINE void linearrgb_to_srgb_ushort4_predivide(unsigned short srgb[4], const f
 
 	for (i = 0; i < 3; ++i) {
 		t = linear[i] * inv_alpha;
-		srgb[i] = (t < 1.0f) ? (unsigned short) (to_srgb_table_lookup(t) * alpha) : FTOUSHORT(linearrgb_to_srgb(t) * alpha);
+		srgb[i] = (t <= 1.0f) ?
+		          /* warning - converts: float -> short -> float -> short */
+		          (unsigned short) (to_srgb_table_lookup(t) * alpha) :
+		          /* if FTOUSHORT was an inline function this could be done less confusingly */
+		          ((t = linearrgb_to_srgb(t) * alpha), FTOUSHORT(t));
 	}
 
 	srgb[3] = FTOUSHORT(linear[3]);
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 50cef03..74abd7e 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -404,8 +404,8 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
 			if (u > u2) SWAP(float, u, u2);
 
 			if (u > 1.0f + eps || u2 < -eps) return -1;  /* non-ovlerlapping segments */
-			else if (maxf(0.0f, u) == minf(1.0f, u2)) { /* one common point: can return result */
-				interp_v2_v2v2(vi, v1, v2, maxf(0, u));
+			else if (max_ff(0.0f, u) == min_ff(1.0f, u2)) { /* one common point: can return result */
+				interp_v2_v2v2(vi, v1, v2, max_ff(0, u));
 				return 1;
 			}
 		}
@@ -560,7 +560,8 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
 	}
 }
 
-/*
+/**
+ * \return
  * -1: collinear
  *  1: intersection
  */
@@ -758,6 +759,10 @@ int isect_ray_tri_v3(const float p1[3], const float d[3],
 	return 1;
 }
 
+/**
+ * if clip is nonzero, will only return true if lambda is >= 0.0
+ * (i.e. intersection point is along positive d)
+ */
 int isect_ray_plane_v3(const float p1[3], const float d[3],
                        const float v0[3], const float v1[3], const float v2[3],
                        float *r_lambda, const int clip)
@@ -876,6 +881,16 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
 	return 1;
 }
 
+/**
+ * Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
+ *
+ * \param out The intersection point.
+ * \param l1 The first point of the line.
+ * \param l2 The second point of the line.
+ * \param plane_co A point on the plane to intersect with.
+ * \param plane_no The direction of the plane (does not need to be normalized).
+ * \param no_flip When true, the intersection point will always be from l1 to l2, even if this is not on the plane.
+ */
 int isect_line_plane_v3(float out[3],
                         const float l1[3], const float l2[3],
                         const float plane_co[3], const float plane_no[3], const short no_flip)
@@ -921,7 +936,20 @@ int isect_line_plane_v3(float out[3],
 	}
 }
 
-/* note: return normal isn't unit length */
+/**
+ * Intersect two planes, return a point on the intersection and a vector
+ * that runs on the direction of the intersection.
+ * Return error code is the same as 'isect_line_line_v3'.
+ *
+ * \param r_isect_co The resulting intersection point.
+ * \param r_isect_no The resulting vector of the intersection.
+ * \param plane_a_co The point on the first plane.
+ * \param plane_a_no The normal of the first plane.
+ * \param plane_b_co The point on the second plane.
+ * \param plane_b_no The normal of the second plane.
+ *
+ * \note return normal isn't unit length
+ */
 void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
                           const float plane_a_co[3], const float plane_a_no[3],
                           const float plane_b_co[3], const float plane_b_no[3])
@@ -939,10 +967,10 @@ void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
 /* "Improved Collision detection and Response" */
 static int getLowestRoot(const float a, const float b, const float c, const float maxR, float *root)
 {
-	// Check if a solution exists
+	/* Check if a solution exists */
 	float determinant = b * b - 4.0f * a * c;
 
-	// If determinant is negative it means no solutions.
+	/* If determinant is negative it means no solutions. */
 	if (determinant >= 0.0f) {
 		/* calculate the two roots: (if determinant == 0 then
 		 * x1==x2 but lets disregard that slight optimization) */
@@ -950,24 +978,24 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
 		float r1 = (-b - sqrtD) / (2.0f * a);
 		float r2 = (-b + sqrtD) / (2.0f * a);
 
-		// Sort so x1 <= x2
+		/* Sort so x1 <= x2 */
 		if (r1 > r2)
 			SWAP(float, r1, r2);
 
-		// Get lowest root:
+		/* Get lowest root: */
 		if (r1 > 0.0f && r1 < maxR) {
 			*root = r1;
 			return 1;
 		}
 
-		// It is possible that we want x2 - this can happen
-		// if x1 < 0
+		/* It is possible that we want x2 - this can happen */
+		/* if x1 < 0 */
 		if (r2 > 0.0f && r2 < maxR) {
 			*root = r2;
 			return 1;
 		}
 	}
-	// No (valid) solutions
+	/* No (valid) solutions */
 	return 0;
 }
 
@@ -1080,7 +1108,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
 	}
 
 	/*---test edges---*/
-	sub_v3_v3v3(e3, v2, v1); //wasnt yet calculated
+	sub_v3_v3v3(e3, v2, v1);  /* wasnt yet calculated */
 
 
 	/*e1*/
@@ -1206,11 +1234,12 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
 	return 1;
 }
 
-/* Returns the number of point of interests
+/**
+ * \return The number of point of interests
  * 0 - lines are colinear
  * 1 - lines are coplanar, i1 is set to intersection
  * 2 - i1 and i2 are the nearest points on line 1 (v1, v2) and line 2 (v3, v4) respectively
- * */
+ */
 int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float i1[3], float i2[3])
 {
 	float a[3], b[3], c[3], ab[3], cb[3], dir1[3], dir2[3];
@@ -1344,7 +1373,7 @@ void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_start[3],
 
 /* Adapted from http://www.gamedev.net/community/forums/topic.asp?topic_id=459973 */
 int isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3],
-				   const float bb_max[3], float *tmin_out)
+                   const float bb_max[3], float *tmin_out)
 {
 	float bbox[2][3];
 	float tmin, tmax, tymin, tymax, tzmin, tzmax;
@@ -1424,9 +1453,16 @@ float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3
 float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
 {
 	float h[2], u[2];
+	float dot;
 	sub_v2_v2v2(u, l2, l1);
 	sub_v2_v2v2(h, p, l1);
+#if 0
 	return (dot_v2v2(u, h) / dot_v2v2(u, u));
+#else
+	/* better check for zero */
+	dot = dot_v2v2(u, u);
+	return (dot != 0.0f) ? (dot_v2v2(u, h) / dot) : 0.0f;
+#endif
 }
 
 /* ensure the distance between these points is no greater then 'dist'
@@ -1587,7 +1623,7 @@ void isect_point_face_uv_v2(const int isquad,
 	}
 }
 
-#if 0 // XXX this version used to be used in isect_point_tri_v2_int() and was called IsPointInTri2D
+#if 0  /* XXX this version used to be used in isect_point_tri_v2_int() and was called IsPointInTri2D */
 
 int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
 {
@@ -1777,7 +1813,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 	signed char ix;
 	signed char iy;
 
-	// if x1 == x2 or y1 == y2, then it does not matter what we set here
+	/* if x1 == x2 or y1 == y2, then it does not matter what we set here */
 	int delta_x = (x2 > x1 ? (ix = 1, x2 - x1) : (ix = -1, x1 - x2)) << 1;
 	int delta_y = (y2 > y1 ? (iy = 1, y2 - y1) : (iy = -1, y1 - y2)) << 1;
 
@@ -1786,7 +1822,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 	}
 
 	if (delta_x >= delta_y) {
-		// error may go below zero
+		/* error may go below zero */
 		int error = delta_y - (delta_x >> 1);
 
 		while (x1 != x2) {
@@ -1795,9 +1831,9 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 					y1 += iy;
 					error -= delta_x;
 				}
-				// else do nothing
+				/* else do nothing */
 			}
-			// else do nothing
+			/* else do nothing */
 
 			x1 += ix;
 			error += delta_y;
@@ -1808,7 +1844,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 		}
 	}
 	else {
-		// error may go below zero
+		/* error may go below zero */
 		int error = delta_x - (delta_y >> 1);
 
 		while (y1 != y2) {
@@ -1817,9 +1853,9 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 					x1 += ix;
 					error -= delta_y;
 				}
-				// else do nothing
+				/* else do nothing */
 			}
-			// else do nothing
+			/* else do nothing */
 
 			y1 += iy;
 			error += delta_x;
@@ -2323,18 +2359,18 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
 	                           (st2[0] * st3[1] - st2[1] * st3[0]) + (st3[0] * st0[1] - st3[1] * st0[0]);
 
 	/* X is 2D cross product (determinant)
-	 * A= (p0-p) X (p0-p3)*/
+	 * A = (p0 - p) X (p0 - p3)*/
 	const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]);
 
-	/* B= ( (p0-p) X (p1-p2) + (p1-p) X (p0-p3) ) / 2 */
-	const double b = 0.5 * (((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
-	                        ((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
+	/* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */
+	const double b = 0.5 * (double)(((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
+	                                ((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
 
 	/* C = (p1-p) X (p1-p2) */
 	const double fC = (st1[0] - st[0]) * (st1[1] - st2[1]) - (st1[1] - st[1]) * (st1[0] - st2[0]);
 	const double denom = a - 2 * b + fC;
 
-	// clear outputs
+	/* clear outputs */
 	zero_v2(r_uv);
 
 	if (IS_ZERO(denom) != 0) {
@@ -2364,12 +2400,39 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
 		}
 
 		if (IS_ZERO(denom) == 0)
-			r_uv[1] = (float)(((1.0f - r_uv[0]) * (st0[i] - st[i]) + r_uv[0] * (st1[i] - st[i])) / denom);
+			r_uv[1] = (float)((double)((1.0f - r_uv[0]) * (st0[i] - st[i]) + r_uv[0] * (st1[i] - st[i])) / denom);
 	}
 }
 
 #undef IS_ZERO
 
+/* reverse of the functions above */
+void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3])
+{
+	float vec[3];
+
+	copy_v3_v3(res, data[0]);
+	mul_v3_fl(res, (1 - u) * (1 - v));
+	copy_v3_v3(vec, data[1]);
+	mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
+	copy_v3_v3(vec, data[2]);
+	mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
+	copy_v3_v3(vec, data[3]);
+	mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
+}
+
+void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3])
+{
+	float vec[3];
+
+	copy_v3_v3(res, data[0]);
+	mul_v3_fl(res, u);
+	copy_v3_v3(vec, data[1]);
+	mul_v3_fl(vec, v); add_v3_v3(res, vec);
+	copy_v3_v3(vec, data[2]);
+	mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
+}
+
 /***************************** View & Projection *****************************/
 
 void orthographic_m4(float matrix[][4], const float left, const float right, const float bottom, const float top,
@@ -2650,7 +2713,7 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
 			const float *cur_edge = vdiffs[i];
 			const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
 
-			// accumulate
+			/* accumulate */
 			madd_v3_v3fl(vn[i], f_no, fac);
 			prev_edge = cur_edge;
 		}
@@ -2691,50 +2754,6 @@ void accumulate_vertex_normals_poly(float **vertnos, float polyno[3],
 
 /********************************* Tangents **********************************/
 
-/* For normal map tangents we need to detect uv boundaries, and only average
- * tangents in case the uvs are connected. Alternative would be to store 1
- * tangent per face rather than 4 per face vertex, but that's not compatible
- * with games */
-
-
-/* from BKE_mesh.h */
-#define STD_UV_CONNECT_LIMIT  0.0001f
-
-void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang, const float tang[3], const float uv[2])
-{
-	VertexTangent *vt;
-
-	/* find a tangent with connected uvs */
-	for (vt = *vtang; vt; vt = vt->next) {
-		if (fabsf(uv[0] - vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1] - vt->uv[1]) < STD_UV_CONNECT_LIMIT) {
-			add_v3_v3(vt->tang, tang);
-			return;
-		}
-	}
-
-	/* if not found, append a new one */
-	vt = BLI_memarena_alloc((MemArena *) arena, sizeof(VertexTangent));
-	copy_v3_v3(vt->tang, tang);
-	vt->uv[0] = uv[0];
-	vt->uv[1] = uv[1];
-
-	if (*vtang)
-		vt->next = *vtang;
-	*vtang = vt;
-}
-
-float *find_vertex_tangent(VertexTangent *vtang, const float uv[2])
-{
-	VertexTangent *vt;
-	static float nulltang[3] = {0.0f, 0.0f, 0.0f};
-
-	for (vt = vtang; vt; vt = vt->next)
-		if (fabsf(uv[0] - vt->uv[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1] - vt->uv[1]) < STD_UV_CONNECT_LIMIT)
-			return vt->tang;
-
-	return nulltang; /* shouldn't happen, except for nan or so */
-}
-
 void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3])
 {
 	float s1 = uv2[0] - uv1[0];
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index 0d4c797..ba9770e 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -27,11 +27,12 @@
  *  \ingroup bli
  */
 
+#ifndef __MATH_GEOM_INLINE_C__
+#define __MATH_GEOM_INLINE_C__
 
 #include "BLI_math.h"
 
-#ifndef __MATH_GEOM_INLINE_C__
-#define __MATH_GEOM_INLINE_C__
+#include <string.h>
 
 /****************************** Spherical Harmonics **************************/
 
@@ -137,4 +138,24 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f)
 	add_sh_shsh(r, r, tmp);
 }
 
+MINLINE int max_axis_v3(const float vec[3])
+{
+	const float x = vec[0];
+	const float y = vec[1];
+	const float z = vec[2];
+	return ((x > y) ?
+	       ((x > z) ? 0 : 2) :
+	       ((y > z) ? 1 : 2));
+}
+
+MINLINE int min_axis_v3(const float vec[3])
+{
+	const float x = vec[0];
+	const float y = vec[1];
+	const float z = vec[2];
+	return ((x < y) ?
+	       ((x < z) ? 0 : 2) :
+	       ((y < z) ? 1 : 2));
+}
+
 #endif /* __MATH_GEOM_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c
new file mode 100644
index 0000000..5a9e824
--- /dev/null
+++ b/source/blender/blenlib/intern/math_interp.c
@@ -0,0 +1,351 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+#include <math.h>
+
+#include "BLI_math.h"
+
+/**************************************************************************
+ *                            INTERPOLATIONS
+ *
+ * Reference and docs:
+ * http://wiki.blender.org/index.php/User:Damiles#Interpolations_Algorithms
+ ***************************************************************************/
+
+/* BICUBIC Interpolation functions
+ *  More info: http://wiki.blender.org/index.php/User:Damiles#Bicubic_pixel_interpolation
+ * function assumes out to be zero'ed, only does RGBA */
+
+static float P(float k)
+{
+	float p1, p2, p3, p4;
+	p1 = MAX2(k + 2.0f, 0);
+	p2 = MAX2(k + 1.0f, 0);
+	p3 = MAX2(k, 0);
+	p4 = MAX2(k - 1.0f, 0);
+	return (float)(1.0f / 6.0f) * (p1 * p1 * p1 - 4.0f * p2 * p2 * p2 + 6.0f * p3 * p3 * p3 - 4.0f * p4 * p4 * p4);
+}
+
+
+#if 0
+/* older, slower function, works the same as above */
+static float P(float k)
+{
+	return (float)(1.0f / 6.0f) * (pow(MAX2(k + 2.0f, 0), 3.0f) - 4.0f * pow(MAX2(k + 1.0f, 0), 3.0f) + 6.0f * pow(MAX2(k, 0), 3.0f) - 4.0f * pow(MAX2(k - 1.0f, 0), 3.0f));
+}
+#endif
+
+static void vector_from_float(const float *data, float vector[4], int components)
+{
+	if (components == 1) {
+		vector[0] = data[0];
+	}
+	else if (components == 3) {
+		copy_v3_v3(vector, data);
+	}
+	else {
+		copy_v4_v4(vector, data);
+	}
+}
+
+static void vector_from_byte(const unsigned char *data, float vector[4], int components)
+{
+	if (components == 1) {
+		vector[0] = data[0];
+	}
+	else if (components == 3) {
+		vector[0] = data[0];
+		vector[1] = data[1];
+		vector[2] = data[2];
+	}
+	else {
+		vector[0] = data[0];
+		vector[1] = data[1];
+		vector[2] = data[2];
+		vector[3] = data[3];
+	}
+}
+
+/* BICUBIC INTERPOLATION */
+BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const float *float_buffer,
+                                      unsigned char *byte_output, float *float_output, int width, int height,
+                                      int components, float u, float v)
+{
+	int i, j, n, m, x1, y1;
+	float a, b, w, wx, wy[4], out[4];
+
+	/* sample area entirely outside image? */
+	if (ceil(u) < 0 || floor(u) > width - 1 || ceil(v) < 0 || floor(v) > height - 1) {
+		return;
+	}
+
+	i = (int)floor(u);
+	j = (int)floor(v);
+	a = u - i;
+	b = v - j;
+
+	zero_v4(out);
+
+/* Optimized and not so easy to read */
+
+	/* avoid calling multiple times */
+	wy[0] = P(b - (-1));
+	wy[1] = P(b -  0);
+	wy[2] = P(b -  1);
+	wy[3] = P(b -  2);
+
+	for (n = -1; n <= 2; n++) {
+		x1 = i + n;
+		CLAMP(x1, 0, width - 1);
+		wx = P(n - a);
+		for (m = -1; m <= 2; m++) {
+			float data[4];
+
+			y1 = j + m;
+			CLAMP(y1, 0, height - 1);
+			/* normally we could do this */
+			/* w = P(n-a) * P(b-m); */
+			/* except that would call P() 16 times per pixel therefor pow() 64 times, better precalc these */
+			w = wx * wy[m + 1];
+
+			if (float_output) {
+				const float *float_data = float_buffer + width * y1 * components + components * x1;
+
+				vector_from_float(float_data, data, components);
+			}
+			else {
+				const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
+
+				vector_from_byte(byte_data, data, components);
+			}
+
+			if (components == 1) {
+				out[0] += data[0] * w;
+			}
+			else if (components == 3) {
+				out[0] += data[0] * w;
+				out[1] += data[1] * w;
+				out[2] += data[2] * w;
+			}
+			else {
+				out[0] += data[0] * w;
+				out[1] += data[1] * w;
+				out[2] += data[2] * w;
+				out[3] += data[3] * w;
+			}
+		}
+	}
+
+/* Done with optimized part */
+
+#if 0
+	/* older, slower function, works the same as above */
+	for (n = -1; n <= 2; n++) {
+		for (m = -1; m <= 2; m++) {
+			x1 = i + n;
+			y1 = j + m;
+			if (x1 > 0 && x1 < width && y1 > 0 && y1 < height) {
+				float data[4];
+
+				if (float_output) {
+					const float *float_data = float_buffer + width * y1 * components + components * x1;
+
+					vector_from_float(float_data, data, components);
+				}
+				else {
+					const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
+
+					vector_from_byte(byte_data, data, components);
+				}
+
+				if (components == 1) {
+					out[0] += data[0] * P(n - a) * P(b - m);
+				}
+				else if (components == 3) {
+					out[0] += data[0] * P(n - a) * P(b - m);
+					out[1] += data[1] * P(n - a) * P(b - m);
+					out[2] += data[2] * P(n - a) * P(b - m);
+				}
+				else {
+					out[0] += data[0] * P(n - a) * P(b - m);
+					out[1] += data[1] * P(n - a) * P(b - m);
+					out[2] += data[2] * P(n - a) * P(b - m);
+					out[3] += data[3] * P(n - a) * P(b - m);
+				}
+			}
+		}
+	}
+#endif
+
+	if (float_output) {
+		if (components == 1) {
+			float_output[0] = out[0];
+		}
+		else if (components == 3) {
+			copy_v3_v3(float_output, out);
+		}
+		else {
+			copy_v4_v4(float_output, out);
+		}
+	}
+	else {
+		if (components == 1) {
+			byte_output[0] = out[0];
+		}
+		else if (components == 3) {
+			byte_output[0] = out[0];
+			byte_output[1] = out[1];
+			byte_output[2] = out[2];
+		}
+		else {
+			byte_output[0] = out[0];
+			byte_output[1] = out[1];
+			byte_output[2] = out[2];
+			byte_output[3] = out[3];
+		}
+	}
+}
+
+void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height,
+                                  int components, float u, float v)
+{
+	bicubic_interpolation(NULL, buffer, NULL, output, width, height, components, u, v);
+}
+
+void BLI_bicubic_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height,
+                                    int components, float u, float v)
+{
+	bicubic_interpolation(buffer, NULL, output, NULL, width, height, components, u, v);
+}
+
+/* BILINEAR INTERPOLATION */
+BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const float *float_buffer,
+                                       unsigned char *byte_output, float *float_output, int width, int height,
+                                       int components, float u, float v)
+{
+	float a, b;
+	float a_b, ma_b, a_mb, ma_mb;
+	int y1, y2, x1, x2;
+
+	/* ImBuf in must have a valid rect or rect_float, assume this is already checked */
+
+	x1 = (int)floor(u);
+	x2 = (int)ceil(u);
+	y1 = (int)floor(v);
+	y2 = (int)ceil(v);
+
+	/* sample area entirely outside image? */
+	if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) {
+		return;
+	}
+
+	if (float_output) {
+		const float *row1, *row2, *row3, *row4;
+		float empty[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+		/* sample including outside of edges of image */
+		if (x1 < 0 || y1 < 0) row1 = empty;
+		else row1 = float_buffer + width * y1 * components + components * x1;
+
+		if (x1 < 0 || y2 > height - 1) row2 = empty;
+		else row2 = float_buffer + width * y2 * components + components * x1;
+
+		if (x2 > width - 1 || y1 < 0) row3 = empty;
+		else row3 = float_buffer + width * y1 * components + components * x2;
+
+		if (x2 > width - 1 || y2 > height - 1) row4 = empty;
+		else row4 = float_buffer + width * y2 * components + components * x2;
+
+		a = u - floorf(u);
+		b = v - floorf(v);
+		a_b = a * b; ma_b = (1.0f - a) * b; a_mb = a * (1.0f - b); ma_mb = (1.0f - a) * (1.0f - b);
+
+		if (components == 1) {
+			float_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+		}
+		else if (components == 3) {
+			float_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+			float_output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
+			float_output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
+		}
+		else {
+			float_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+			float_output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
+			float_output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
+			float_output[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
+		}
+	}
+	else {
+		const unsigned char *row1, *row2, *row3, *row4;
+		unsigned char empty[4] = {0, 0, 0, 0};
+
+		/* sample including outside of edges of image */
+		if (x1 < 0 || y1 < 0) row1 = empty;
+		else row1 = byte_buffer + width * y1 * components + components * x1;
+
+		if (x1 < 0 || y2 > height - 1) row2 = empty;
+		else row2 = byte_buffer + width * y2 * components + components * x1;
+
+		if (x2 > width - 1 || y1 < 0) row3 = empty;
+		else row3 = byte_buffer + width * y1 * components + components * x2;
+
+		if (x2 > width - 1 || y2 > height - 1) row4 = empty;
+		else row4 = byte_buffer + width * y2 * components + components * x2;
+
+		a = u - floorf(u);
+		b = v - floorf(v);
+		a_b = a * b; ma_b = (1.0f - a) * b; a_mb = a * (1.0f - b); ma_mb = (1.0f - a) * (1.0f - b);
+
+		if (components == 1) {
+			byte_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+		}
+		else if (components == 3) {
+			byte_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+			byte_output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
+			byte_output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
+		}
+		else {
+			byte_output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
+			byte_output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
+			byte_output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
+			byte_output[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
+		}
+	}
+}
+
+void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height,
+                                   int components, float u, float v)
+{
+	bilinear_interpolation(NULL, buffer, NULL, output, width, height, components, u, v);
+}
+
+void BLI_bilinear_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height,
+                                     int components, float u, float v)
+{
+	bilinear_interpolation(buffer, NULL, output, NULL, width, height, components, u, v);
+}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 1f61b37..38214f9 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -504,6 +504,51 @@ void sub_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
 			m1[i][j] = m2[i][j] - m3[i][j];
 }
 
+/* why not make this a standard part of the API? */
+static float determinant_m3_local(float m[3][3])
+{
+	return (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
+	        m[1][0] * (m[0][1] * m[2][2] - m[0][2] * m[2][1]) +
+	        m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
+}
+
+int invert_m3_ex(float m[3][3], const float epsilon)
+{
+	float tmp[3][3];
+	int success;
+
+	success = invert_m3_m3_ex(tmp, m, epsilon);
+	copy_m3_m3(m, tmp);
+
+	return success;
+}
+
+int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon)
+{
+	float det;
+	int a, b, success;
+
+	BLI_assert(epsilon >= 0.0f);
+
+	/* calc adjoint */
+	adjoint_m3_m3(m1, m2);
+
+	/* then determinant old matrix! */
+	det = determinant_m3_local(m2);
+
+	success = (fabsf(det) > epsilon);
+
+	if (LIKELY(det != 0.0f)) {
+		det = 1.0f / det;
+		for (a = 0; a < 3; a++) {
+			for (b = 0; b < 3; b++) {
+				m1[a][b] *= det;
+			}
+		}
+	}
+	return success;
+}
+
 int invert_m3(float m[3][3])
 {
 	float tmp[3][3];
@@ -524,17 +569,16 @@ int invert_m3_m3(float m1[3][3], float m2[3][3])
 	adjoint_m3_m3(m1, m2);
 
 	/* then determinant old matrix! */
-	det = (m2[0][0] * (m2[1][1] * m2[2][2] - m2[1][2] * m2[2][1]) -
-	       m2[1][0] * (m2[0][1] * m2[2][2] - m2[0][2] * m2[2][1]) +
-	       m2[2][0] * (m2[0][1] * m2[1][2] - m2[0][2] * m2[1][1]));
+	det = determinant_m3_local(m2);
 
-	success = (det != 0);
+	success = (det != 0.0f);
 
-	if (det == 0) det = 1;
-	det = 1 / det;
-	for (a = 0; a < 3; a++) {
-		for (b = 0; b < 3; b++) {
-			m1[a][b] *= det;
+	if (LIKELY(det != 0.0f)) {
+		det = 1.0f / det;
+		for (a = 0; a < 3; a++) {
+			for (b = 0; b < 3; b++) {
+				m1[a][b] *= det;
+			}
 		}
 	}
 
@@ -603,15 +647,15 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
 		if (temp == 0)
 			return 0;  /* No non-zero pivot */
 		for (k = 0; k < 4; k++) {
-			tempmat[i][k] = (float)(tempmat[i][k] / temp);
-			inverse[i][k] = (float)(inverse[i][k] / temp);
+			tempmat[i][k] = (float)((double)tempmat[i][k] / temp);
+			inverse[i][k] = (float)((double)inverse[i][k] / temp);
 		}
 		for (j = 0; j < 4; j++) {
 			if (j != i) {
 				temp = tempmat[j][i];
 				for (k = 0; k < 4; k++) {
-					tempmat[j][k] -= (float)(tempmat[i][k] * temp);
-					inverse[j][k] -= (float)(inverse[i][k] * temp);
+					tempmat[j][k] -= (float)((double)tempmat[i][k] * temp);
+					inverse[j][k] -= (float)((double)inverse[i][k] * temp);
 				}
 			}
 		}
@@ -945,8 +989,18 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
 	if (len != 0.0f) rmat[2][3] = mat[2][3] / len;
 }
 
+void adjoint_m2_m2(float m1[][2], float m[][2])
+{
+	BLI_assert(m1 != m);
+	m1[0][0] =  m[1][1];
+	m1[0][1] = -m[1][0];
+	m1[1][0] = -m[0][1];
+	m1[1][1] =  m[0][0];
+}
+
 void adjoint_m3_m3(float m1[][3], float m[][3])
 {
+	BLI_assert(m1 != m);
 	m1[0][0] = m[1][1] * m[2][2] - m[1][2] * m[2][1];
 	m1[0][1] = -m[0][1] * m[2][2] + m[0][2] * m[2][1];
 	m1[0][2] = m[0][1] * m[1][2] - m[0][2] * m[1][1];
@@ -1400,7 +1454,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 	int m = 4;
 	int n = 4;
 	int maxiter = 200;
-	int nu = minf(m, n);
+	int nu = min_ff(m, n);
 
 	float *work = work1;
 	float *e = work2;
@@ -1408,22 +1462,22 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 
 	int i = 0, j = 0, k = 0, p, pp, iter;
 
-	// Reduce A to bidiagonal form, storing the diagonal elements
-	// in s and the super-diagonal elements in e.
+	/* Reduce A to bidiagonal form, storing the diagonal elements
+	 * in s and the super-diagonal elements in e. */
 
-	int nct = minf(m - 1, n);
-	int nrt = maxf(0, minf(n - 2, m));
+	int nct = min_ff(m - 1, n);
+	int nrt = max_ff(0, min_ff(n - 2, m));
 
 	copy_m4_m4(A, A_);
 	zero_m4(U);
 	zero_v4(s);
 
-	for (k = 0; k < maxf(nct, nrt); k++) {
+	for (k = 0; k < max_ff(nct, nrt); k++) {
 		if (k < nct) {
 
-			// Compute the transformation for the k-th column and
-			// place the k-th diagonal in s[k].
-			// Compute 2-norm of k-th column without under/overflow.
+			/* Compute the transformation for the k-th column and
+			 * place the k-th diagonal in s[k].
+			 * Compute 2-norm of k-th column without under/overflow. */
 			s[k] = 0;
 			for (i = k; i < m; i++) {
 				s[k] = hypotf(s[k], A[i][k]);
@@ -1444,7 +1498,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		for (j = k + 1; j < n; j++) {
 			if ((k < nct) && (s[k] != 0.0f)) {
 
-				// Apply the transformation.
+				/* Apply the transformation. */
 
 				float t = 0;
 				for (i = k; i < m; i++) {
@@ -1456,24 +1510,24 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				}
 			}
 
-			// Place the k-th row of A into e for the
-			// subsequent calculation of the row transformation.
+			/* Place the k-th row of A into e for the */
+			/* subsequent calculation of the row transformation. */
 
 			e[j] = A[k][j];
 		}
 		if (k < nct) {
 
-			// Place the transformation in U for subsequent back
-			// multiplication.
+			/* Place the transformation in U for subsequent back
+			 * multiplication. */
 
 			for (i = k; i < m; i++)
 				U[i][k] = A[i][k];
 		}
 		if (k < nrt) {
 
-			// Compute the k-th row transformation and place the
-			// k-th super-diagonal in e[k].
-			// Compute 2-norm without under/overflow.
+			/* Compute the k-th row transformation and place the
+			 * k-th super-diagonal in e[k].
+			 * Compute 2-norm without under/overflow. */
 			e[k] = 0;
 			for (i = k + 1; i < n; i++) {
 				e[k] = hypotf(e[k], e[i]);
@@ -1493,7 +1547,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 			if ((k + 1 < m) & (e[k] != 0.0f)) {
 				float invek1;
 
-				// Apply the transformation.
+				/* Apply the transformation. */
 
 				for (i = k + 1; i < m; i++) {
 					work[i] = 0.0f;
@@ -1512,17 +1566,17 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				}
 			}
 
-			// Place the transformation in V for subsequent
-			// back multiplication.
+			/* Place the transformation in V for subsequent
+			 * back multiplication. */
 
 			for (i = k + 1; i < n; i++)
 				V[i][k] = e[i];
 		}
 	}
 
-	// Set up the final bidiagonal matrix or order p.
+	/* Set up the final bidiagonal matrix or order p. */
 
-	p = minf(n, m + 1);
+	p = min_ff(n, m + 1);
 	if (nct < n) {
 		s[nct] = A[nct][nct];
 	}
@@ -1534,7 +1588,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 	}
 	e[p - 1] = 0.0f;
 
-	// If required, generate U.
+	/* If required, generate U. */
 
 	for (j = nct; j < nu; j++) {
 		for (i = 0; i < m; i++) {
@@ -1570,7 +1624,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		}
 	}
 
-	// If required, generate V.
+	/* If required, generate V. */
 
 	for (k = n - 1; k >= 0; k--) {
 		if ((k < nrt) & (e[k] != 0.0f)) {
@@ -1591,7 +1645,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		V[k][k] = 1.0f;
 	}
 
-	// Main iteration loop for the singular values.
+	/* Main iteration loop for the singular values. */
 
 	pp = p - 1;
 	iter = 0;
@@ -1599,20 +1653,20 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 	while (p > 0) {
 		int kase = 0;
 
-		// Test for maximum iterations to avoid infinite loop
+		/* Test for maximum iterations to avoid infinite loop */
 		if (maxiter == 0)
 			break;
 		maxiter--;
 
-		// This section of the program inspects for
-		// negligible elements in the s and e arrays.  On
-		// completion the variables kase and k are set as follows.
-
-		// kase = 1	  if s(p) and e[k - 1] are negligible and k<p
-		// kase = 2	  if s(k) is negligible and k<p
-		// kase = 3	  if e[k - 1] is negligible, k<p, and
-		//               s(k), ..., s(p) are not negligible (qr step).
-		// kase = 4	  if e(p - 1) is negligible (convergence).
+		/* This section of the program inspects for
+		 * negligible elements in the s and e arrays.  On
+		 * completion the variables kase and k are set as follows.
+		 *
+		 * kase = 1	  if s(p) and e[k - 1] are negligible and k<p
+		 * kase = 2	  if s(k) is negligible and k<p
+		 * kase = 3	  if e[k - 1] is negligible, k<p, and
+		 *               s(k), ..., s(p) are not negligible (qr step).
+		 * kase = 4	  if e(p - 1) is negligible (convergence). */
 
 		for (k = p - 2; k >= -1; k--) {
 			if (k == -1) {
@@ -1653,11 +1707,11 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		}
 		k++;
 
-		// Perform the task indicated by kase.
+		/* Perform the task indicated by kase. */
 
 		switch (kase) {
 
-			// Deflate negligible s(p).
+			/* Deflate negligible s(p). */
 
 			case 1:
 			{
@@ -1683,7 +1737,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				break;
 			}
 
-			// Split at negligible s(k).
+			/* Split at negligible s(k). */
 
 			case 2:
 			{
@@ -1707,14 +1761,14 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				break;
 			}
 
-			// Perform one qr step.
+			/* Perform one qr step. */
 
 			case 3:
 			{
 
-				// Calculate the shift.
+				/* Calculate the shift. */
 
-				float scale = maxf(maxf(maxf(maxf(
+				float scale = max_ff(max_ff(max_ff(max_ff(
 				                   fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])),
 				                   fabsf(s[k])), fabsf(e[k]));
 				float invscale = 1.0f / scale;
@@ -1737,7 +1791,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				f = (sk + sp) * (sk - sp) + shift;
 				g = sk * ek;
 
-				// Chase zeros.
+				/* Chase zeros. */
 
 				for (j = k; j < p - 1; j++) {
 					float t = hypotf(f, g);
@@ -1779,12 +1833,12 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 				iter = iter + 1;
 				break;
 			}
-			// Convergence.
+			/* Convergence. */
 
 			case 4:
 			{
 
-				// Make the singular values positive.
+				/* Make the singular values positive. */
 
 				if (s[k] <= 0.0f) {
 					s[k] = (s[k] < 0.0f ? -s[k] : 0.0f);
@@ -1793,7 +1847,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 						V[i][k] = -V[i][k];
 				}
 
-				// Order the singular values.
+				/* Order the singular values. */
 
 				while (k < pp) {
 					float t;
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 53f2c1c..3069542 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -84,7 +84,7 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
  * \note:
  * Assumes a unit quaternion?
  *
- * in fact not, but you may wan't to use a unit quat, read on...
+ * in fact not, but you may want to use a unit quat, read on...
  *
  * Shortcut for 'q v q*' when \a v is actually a quaternion.
  * This removes the need for converting a vector to a quaternion,
@@ -234,7 +234,7 @@ void quat_to_mat4(float m[][4], const float q[4])
 	double q0, q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
 
 #ifdef DEBUG
-	if (!((q0 = dot_qtqt(q, q)) == 0.0f || (fabsf(q0 - 1.0) < QUAT_EPSILON))) {
+	if (!((q0 = dot_qtqt(q, q)) == 0.0 || (fabs(q0 - 1.0) < QUAT_EPSILON))) {
 		fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
 	}
 #endif
@@ -288,9 +288,9 @@ void mat3_to_quat(float q[4], float wmat[][3])
 		s = sqrt(tr);
 		q[0] = (float)s;
 		s = 1.0 / (4.0 * s);
-		q[1] = (float)((mat[1][2] - mat[2][1]) * s);
-		q[2] = (float)((mat[2][0] - mat[0][2]) * s);
-		q[3] = (float)((mat[0][1] - mat[1][0]) * s);
+		q[1] = (float)((double)(mat[1][2] - mat[2][1]) * s);
+		q[2] = (float)((double)(mat[2][0] - mat[0][2]) * s);
+		q[3] = (float)((double)(mat[0][1] - mat[1][0]) * s);
 	}
 	else {
 		if (mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
@@ -797,7 +797,7 @@ void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3])
 	float q[4];
 
 	/* use quaternions as intermediate representation */
-	// TODO: it would be nicer to go straight there...
+	/* TODO: it would be nicer to go straight there... */
 	mat3_to_quat(q, mat);
 	quat_to_axis_angle(axis, angle, q);
 }
@@ -808,7 +808,7 @@ void mat4_to_axis_angle(float axis[3], float *angle, float mat[4][4])
 	float q[4];
 
 	/* use quaternions as intermediate representation */
-	// TODO: it would be nicer to go straight there...
+	/* TODO: it would be nicer to go straight there... */
 	mat4_to_quat(q, mat);
 	quat_to_axis_angle(axis, angle, q);
 }
@@ -1077,11 +1077,11 @@ void compatible_eul(float eul[3], const float oldrot[3])
 	for (i = 0; i < 3; i++) {
 		deul[i] = eul[i] - oldrot[i];
 		if (deul[i] > pi_thresh) {
-			eul[i] -= floorf(( deul[i] / pi_x2) + 0.5) * pi_x2;
+			eul[i] -= floorf(( deul[i] / pi_x2) + 0.5f) * pi_x2;
 			deul[i] = eul[i] - oldrot[i];
 		}
 		else if (deul[i] < -pi_thresh) {
-			eul[i] += floorf((-deul[i] / pi_x2) + 0.5) * pi_x2;
+			eul[i] += floorf((-deul[i] / pi_x2) + 0.5f) * pi_x2;
 			deul[i] = eul[i] - oldrot[i];
 		}
 	}
@@ -1363,7 +1363,7 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, f
 	mat3_to_compatible_eulO(eul, oldrot, order, m);
 }
 /* rotate the given euler by the given angle on the specified axis */
-// NOTE: is this safe to do with different axis orders?
+/* NOTE: is this safe to do with different axis orders? */
 
 void rotate_eulO(float beul[3], const short order, char axis, float ang)
 {
@@ -1679,34 +1679,34 @@ void vec_apply_track(float vec[3], short axis)
 
 	switch (axis) {
 		case 0: /* pos-x */
-			/* vec[0]=  0.0; */
+			/* vec[0] =  0.0; */
 			vec[1] = tvec[2];
 			vec[2] = -tvec[1];
 			break;
 		case 1: /* pos-y */
-			/* vec[0]= tvec[0]; */
-			/* vec[1]=  0.0; */
-			/* vec[2]= tvec[2]; */
+			/* vec[0] = tvec[0]; */
+			/* vec[1] =  0.0; */
+			/* vec[2] = tvec[2]; */
 			break;
 		case 2: /* pos-z */
-			/* vec[0]= tvec[0]; */
-			/* vec[1]= tvec[1]; */
-			// vec[2]=  0.0; */
+			/* vec[0] = tvec[0]; */
+			/* vec[1] = tvec[1]; */
+			/* vec[2] =  0.0; */
 			break;
 		case 3: /* neg-x */
-			/* vec[0]=  0.0; */
+			/* vec[0] =  0.0; */
 			vec[1] = tvec[2];
 			vec[2] = -tvec[1];
 			break;
 		case 4: /* neg-y */
 			vec[0] = -tvec[2];
-			/* vec[1]=  0.0; */
+			/* vec[1] =  0.0; */
 			vec[2] = tvec[0];
 			break;
 		case 5: /* neg-z */
 			vec[0] = -tvec[0];
 			vec[1] = -tvec[1];
-			/* vec[2]=  0.0; */
+			/* vec[2] =  0.0; */
 			break;
 	}
 }
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 4196bab..812e2b3 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -115,6 +115,13 @@ void mid_v2_v2v2(float v[2], const float v1[2], const float v2[2])
 	v[1] = 0.5f * (v1[1] + v2[1]);
 }
 
+void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
+{
+	v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
+	v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
+	v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
+}
+
 /********************************** Angles ***********************************/
 
 /* Return the angle in radians between vecs 1-2 and 2-3 in radians
@@ -201,6 +208,13 @@ float angle_signed_v2v2(const float v1[2], const float v2[2])
 
 float angle_normalized_v3v3(const float v1[3], const float v2[3])
 {
+	/* double check they are normalized */
+#ifdef DEBUG
+	float test;
+	BLI_assert(fabsf((test = len_squared_v3(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+	BLI_assert(fabsf((test = len_squared_v3(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+#endif
+
 	/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
 	if (dot_v3v3(v1, v2) < 0.0f) {
 		float vec[3];
@@ -217,6 +231,13 @@ float angle_normalized_v3v3(const float v1[3], const float v2[3])
 
 float angle_normalized_v2v2(const float v1[2], const float v2[2])
 {
+	/* double check they are normalized */
+#ifdef DEBUG
+	float test;
+	BLI_assert(fabsf((test = len_squared_v2(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+	BLI_assert(fabsf((test = len_squared_v2(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+#endif
+
 	/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
 	if (dot_v2v2(v1, v2) < 0.0f) {
 		float vec[2];
@@ -401,6 +422,12 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[
 	const float costheta = cos(angle);
 	const float sintheta = sin(angle);
 
+	/* double check they are normalized */
+#ifdef DEBUG
+	float test;
+	BLI_assert(fabsf((test = len_squared_v3(axis)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+#endif
+
 	r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) +
 	       (((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) +
 	       (((1 - costheta) * axis[0] * axis[2] + axis[1] * sintheta) * p[2]);
@@ -451,6 +478,15 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
 	if (max[2] < vec[2]) max[2] = vec[2];
 }
 
+void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
+{
+	if (min[0] > vec[0]) min[0] = vec[0];
+	if (min[1] > vec[1]) min[1] = vec[1];
+
+	if (max[0] < vec[0]) max[0] = vec[0];
+	if (max[1] < vec[1]) max[1] = vec[1];
+}
+
 /** ensure \a v1 is \a dist from \a v2 */
 void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist)
 {
@@ -483,7 +519,7 @@ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int s
 	const float *array_pt_b = array_src_b + (size - 1);
 	int i = size;
 	while (i--) {
-		d += *(array_pt_a--) * *(array_pt_b--);
+		d += (double)(*(array_pt_a--) * *(array_pt_b--));
 	}
 	return d;
 }
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 2cfe999..3ede863 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -27,12 +27,11 @@
  *  \ingroup bli
  */
 
-
-#include "BLI_math.h"
-
 #ifndef __MATH_VECTOR_INLINE_C__
 #define __MATH_VECTOR_INLINE_C__
 
+#include "BLI_math.h"
+
 /********************************** Init *************************************/
 
 MINLINE void zero_v2(float r[2])
@@ -121,6 +120,13 @@ MINLINE void copy_v4_v4_char(char r[4], const char a[4])
 }
 
 /* short */
+MINLINE void zero_v3_int(int r[3])
+{
+	r[0] = 0;
+	r[1] = 0;
+	r[2] = 0;
+}
+
 MINLINE void copy_v2_v2_short(short r[2], const short a[2])
 {
 	r[0] = a[0];
@@ -561,6 +567,16 @@ MINLINE float len_squared_v3(const float v[3])
 	return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
 }
 
+MINLINE float len_manhattan_v2(const float v[2])
+{
+	return fabsf(v[0]) + fabsf(v[1]);
+}
+
+MINLINE float len_manhattan_v3(const float v[3])
+{
+	return fabsf(v[0]) + fabsf(v[1]) + fabsf(v[2]);
+}
+
 MINLINE float len_v2(const float v[2])
 {
 	return sqrtf(v[0] * v[0] + v[1] * v[1]);
@@ -588,20 +604,36 @@ MINLINE float len_squared_v2v2(const float a[2], const float b[2])
 	return dot_v2v2(d, d);
 }
 
-MINLINE float len_v3v3(const float a[3], const float b[3])
+MINLINE float len_squared_v3v3(const float a[3], const float b[3])
 {
 	float d[3];
 
 	sub_v3_v3v3(d, b, a);
-	return len_v3(d);
+	return dot_v3v3(d, d);
 }
 
-MINLINE float len_squared_v3v3(const float a[3], const float b[3])
+MINLINE float len_manhattan_v2v2(const float a[2], const float b[2])
+{
+	float d[2];
+
+	sub_v2_v2v2(d, b, a);
+	return len_manhattan_v2(d);
+}
+
+MINLINE float len_manhattan_v3v3(const float a[3], const float b[3])
 {
 	float d[3];
 
 	sub_v3_v3v3(d, b, a);
-	return dot_v3v3(d, d);
+	return len_manhattan_v3(d);
+}
+
+MINLINE float len_v3v3(const float a[3], const float b[3])
+{
+	float d[3];
+
+	sub_v3_v3v3(d, b, a);
+	return len_v3(d);
 }
 
 MINLINE float normalize_v2_v2(float r[2], const float a[2])
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 792bf92..f37e1e0 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -31,9 +31,9 @@
  */
 
 
-#ifdef _WIN32 	 
-#pragma warning (disable : 4244) // "conversion from double to float"
-#pragma warning (disable : 4305) // "truncation from const double to float" 
+#ifdef _MSC_VER
+#  pragma warning (disable:4244)  /* "conversion from double to float" */
+#  pragma warning (disable:4305)  /* "truncation from const double to float" */
 #endif
 
 #include <math.h>
@@ -301,8 +301,8 @@ static float newPerlin(float x, float y, float z)
 	u = npfade(x);      /* COMPUTE FADE CURVES */
 	v = npfade(y);      /* FOR EACH OF X,Y,Z. */
 	w = npfade(z);
-	A = hash[X  ]+Y;  AA = hash[A]+Z;  AB = hash[A+1]+Z;      /* HASH COORDINATES OF */
-	B = hash[X+1]+Y;  BA = hash[B]+Z;  BB = hash[B+1]+Z;      /* THE 8 CUBE CORNERS, */
+	A = hash[X    ] + Y;  AA = hash[A] + Z;  AB = hash[A + 1] + Z;      /* HASH COORDINATES OF */
+	B = hash[X + 1] + Y;  BA = hash[B] + Z;  BB = hash[B + 1] + Z;      /* THE 8 CUBE CORNERS, */
 	return lerp(w, lerp(v, lerp(u, grad(hash[AA   ],  x,     y,     z    ),   /* AND ADD */
 	                               grad(hash[BA   ],  x - 1, y,     z    )),  /* BLENDED */
 	                       lerp(u, grad(hash[AB   ],  x,     y - 1, z    ),   /* RESULTS */
@@ -398,7 +398,8 @@ static float orgBlenderNoise(float x, float y, float z)
 	h = hashvectf + 3 * hash[b21 + b11];
 	n += i * (h[0] * jx + h[1] * jy + h[2] * jz);
 
-	if (n < 0.0f) n = 0.0f; else if (n > 1.0f) n = 1.0f;
+	if      (n < 0.0f) n = 0.0f;
+	else if (n > 1.0f) n = 1.0f;
 	return n;
 }
 
@@ -456,16 +457,50 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr)
 
 /* ********************* FROM PERLIN HIMSELF: ******************** */
 
-static char p[512 + 2] = {
-	0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80, 0xB5, 0x40, 0x13, 0xB2, 0x22, 0x7E, 0x57,
-	0xBC, 0x7F, 0x6B, 0x9D, 0x86, 0x4C, 0xC8, 0xDB, 0x7C, 0xD5, 0x25, 0x4E, 0x5A, 0x55, 0x74, 0x50, 0xCD, 0xB3, 0x7A, 0xBB, 0xC3, 0xCB, 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98, 0xB, 0x96, 0xD3, 0x9E, 0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4, 0x24, 0x72, 0x49, 0x8C, 0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, 0x78, 0xCA, 0x1F, 0x1, 0xD7, 0x93, 0x11, 0xC1, 0x58, 0xA9, 0x31, 0xF9, 0x44, 0x6D,
-	0xBF, 0x33, 0x9C, 0x5F, 0x9, 0x94, 0xA3, 0x85, 0x6, 0xC6, 0x9A, 0x1E, 0x7B, 0x46, 0x15, 0x30, 0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F, 0x62, 0xAC, 0x4F, 0xC2, 0xC0, 0xE, 0xB1, 0x23, 0xA7, 0xDF, 0x47, 0xB0, 0x77, 0x69, 0x5, 0xE9, 0xE6, 0xE7, 0x76, 0x73, 0xF, 0xFE, 0x6E, 0x9B, 0x56, 0xEF, 0x12, 0xA5, 0x37, 0xFC, 0xAE, 0xD9, 0x3, 0x8E, 0xDD, 0x10, 0xB9, 0xCE, 0xC9, 0x8D,
-	0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4, 0xA, 0xCC, 0xD2, 0xE8, 0x43, 0x3D, 0x70, 0xB7, 0x2, 0x7D, 0x99, 0xD8, 0xD, 0x60, 0x8A, 0x4, 0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7, 0xE0, 0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D,
-	0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80, 0xB5, 0x40, 0x13, 0xB2, 0x22, 0x7E, 0x57,
-	0xBC, 0x7F, 0x6B, 0x9D, 0x86, 0x4C, 0xC8, 0xDB, 0x7C, 0xD5, 0x25, 0x4E, 0x5A, 0x55, 0x74, 0x50, 0xCD, 0xB3, 0x7A, 0xBB, 0xC3, 0xCB, 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98, 0xB, 0x96, 0xD3, 0x9E, 0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4, 0x24, 0x72, 0x49, 0x8C, 0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, 0x78, 0xCA, 0x1F, 0x1, 0xD7, 0x93, 0x11, 0xC1, 0x58, 0xA9, 0x31, 0xF9, 0x44, 0x6D,
-	0xBF, 0x33, 0x9C, 0x5F, 0x9, 0x94, 0xA3, 0x85, 0x6, 0xC6, 0x9A, 0x1E, 0x7B, 0x46, 0x15, 0x30, 0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F, 0x62, 0xAC, 0x4F, 0xC2, 0xC0, 0xE, 0xB1, 0x23, 0xA7, 0xDF, 0x47, 0xB0, 0x77, 0x69, 0x5, 0xE9, 0xE6, 0xE7, 0x76, 0x73, 0xF, 0xFE, 0x6E, 0x9B, 0x56, 0xEF, 0x12, 0xA5, 0x37, 0xFC, 0xAE, 0xD9, 0x3, 0x8E, 0xDD, 0x10, 0xB9, 0xCE, 0xC9, 0x8D,
-	0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4, 0xA, 0xCC, 0xD2, 0xE8, 0x43, 0x3D, 0x70, 0xB7, 0x2, 0x7D, 0x99, 0xD8, 0xD, 0x60, 0x8A, 0x4, 0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7, 0xE0, 0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D,
-	0xA2, 0xA0
+static const char p[512 + 2] = {
+	0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28,
+	0x1D, 0xED, 0x0,  0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D,
+	0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC,  0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8,
+	0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7,
+	0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80, 0xB5, 0x40, 0x13,
+	0xB2, 0x22, 0x7E, 0x57, 0xBC, 0x7F, 0x6B, 0x9D, 0x86, 0x4C, 0xC8, 0xDB,
+	0x7C, 0xD5, 0x25, 0x4E, 0x5A, 0x55, 0x74, 0x50, 0xCD, 0xB3, 0x7A, 0xBB,
+	0xC3, 0xCB, 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98, 0xB,  0x96, 0xD3, 0x9E,
+	0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4, 0x24, 0x72, 0x49, 0x8C,
+	0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, 0x78, 0xCA, 0x1F, 0x1,  0xD7, 0x93,
+	0x11, 0xC1, 0x58, 0xA9, 0x31, 0xF9, 0x44, 0x6D, 0xBF, 0x33, 0x9C, 0x5F,
+	0x9,  0x94, 0xA3, 0x85, 0x6,  0xC6, 0x9A, 0x1E, 0x7B, 0x46, 0x15, 0x30,
+	0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F, 0x62, 0xAC, 0x4F, 0xC2,
+	0xC0, 0xE,  0xB1, 0x23, 0xA7, 0xDF, 0x47, 0xB0, 0x77, 0x69, 0x5,  0xE9,
+	0xE6, 0xE7, 0x76, 0x73, 0xF,  0xFE, 0x6E, 0x9B, 0x56, 0xEF, 0x12, 0xA5,
+	0x37, 0xFC, 0xAE, 0xD9, 0x3,  0x8E, 0xDD, 0x10, 0xB9, 0xCE, 0xC9, 0x8D,
+	0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4, 0xA,  0xCC, 0xD2, 0xE8,
+	0x43, 0x3D, 0x70, 0xB7, 0x2,  0x7D, 0x99, 0xD8, 0xD,  0x60, 0x8A, 0x4,
+	0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7,  0xE0, 0x29, 0xA6, 0xC5, 0xE3,
+	0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD,
+	0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75,
+	0xA4, 0x88, 0xFB, 0x5D, 0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE,
+	0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0,  0xDE, 0x95, 0x2E, 0xDC, 0x3F,
+	0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC,  0x79, 0x32,
+	0xD1, 0x59, 0xF4, 0x8,  0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83,
+	0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8,
+	0x80, 0xB5, 0x40, 0x13, 0xB2, 0x22, 0x7E, 0x57, 0xBC, 0x7F, 0x6B, 0x9D,
+	0x86, 0x4C, 0xC8, 0xDB, 0x7C, 0xD5, 0x25, 0x4E, 0x5A, 0x55, 0x74, 0x50,
+	0xCD, 0xB3, 0x7A, 0xBB, 0xC3, 0xCB, 0xB6, 0xE2, 0xE4, 0xEC, 0xFD, 0x98,
+	0xB,  0x96, 0xD3, 0x9E, 0x5C, 0xA1, 0x64, 0xF1, 0x81, 0x61, 0xE1, 0xC4,
+	0x24, 0x72, 0x49, 0x8C, 0x90, 0x4B, 0x84, 0x34, 0x38, 0xAB, 0x78, 0xCA,
+	0x1F, 0x1,  0xD7, 0x93, 0x11, 0xC1, 0x58, 0xA9, 0x31, 0xF9, 0x44, 0x6D,
+	0xBF, 0x33, 0x9C, 0x5F, 0x9,  0x94, 0xA3, 0x85, 0x6,  0xC6, 0x9A, 0x1E,
+	0x7B, 0x46, 0x15, 0x30, 0x27, 0x2B, 0x1B, 0x71, 0x3C, 0x5B, 0xD6, 0x6F,
+	0x62, 0xAC, 0x4F, 0xC2, 0xC0, 0xE,  0xB1, 0x23, 0xA7, 0xDF, 0x47, 0xB0,
+	0x77, 0x69, 0x5,  0xE9, 0xE6, 0xE7, 0x76, 0x73, 0xF,  0xFE, 0x6E, 0x9B,
+	0x56, 0xEF, 0x12, 0xA5, 0x37, 0xFC, 0xAE, 0xD9, 0x3,  0x8E, 0xDD, 0x10,
+	0xB9, 0xCE, 0xC9, 0x8D, 0xDA, 0x2A, 0xBD, 0x68, 0x17, 0x9F, 0xBE, 0xD4,
+	0xA,  0xCC, 0xD2, 0xE8, 0x43, 0x3D, 0x70, 0xB7, 0x2,  0x7D, 0x99, 0xD8,
+	0xD,  0x60, 0x8A, 0x4,  0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7,  0xE0,
+	0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E,
+	0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A,
+	0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D, 0xA2, 0xA0
 };
 
 
@@ -1856,7 +1891,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
 		y *= lacunarity;
 		z *= lacunarity;
 		weight = signal * gain;
-		if (weight > 1.0f) weight = 1.0f; else if (weight < 0.0f) weight = 0.0f;
+		if      (weight > 1.0f) weight = 1.0f;
+		else if (weight < 0.0f) weight = 0.0f;
 		signal = offset - fabsf(noisefunc(x, y, z));
 		signal *= signal;
 		signal *= weight;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index cc482e2..444daf8 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -47,7 +47,7 @@
 #include "BLI_string_utf8.h"
 #include "BLI_utildefines.h"
 
-#include "BKE_blender.h"    // BLENDER_VERSION
+#include "BKE_blender.h"  /* BLENDER_VERSION */
 
 #include "GHOST_Path-api.h"
 
@@ -330,7 +330,7 @@ void BLI_cleanup_path(const char *relabase, char *dir)
 	if (strcmp(dir, ".") == 0) {  /* happens for example in FILE_MAIN */
 		get_default_root(dir);
 		return;
-	}	
+	}
 
 	while ( (start = strstr(dir, "\\..\\")) ) {
 		eind = start + strlen("\\..\\") - 1;
@@ -492,7 +492,7 @@ void BLI_path_rel(char *file, const char *relfile)
 		 */
 		if (*q != '/') {
 			while ( (q >= file) && (*q != '/') ) { --q; --p; }
-		} 
+		}
 		else if (*p != '/') {
 			while ( (p >= temp) && (*p != '/') ) { --p; --q; }
 		}
@@ -544,7 +544,7 @@ int BLI_parent_dir(char *path)
 	BLI_cleanup_dir(NULL, tmp);
 
 	if (!BLI_testextensie(tmp, parent_dir)) {
-		BLI_strncpy(path, tmp, sizeof(tmp));	
+		BLI_strncpy(path, tmp, sizeof(tmp));
 		return 1;
 	}
 	else {
@@ -691,7 +691,7 @@ int BLI_path_abs(char *path, const char *basepath)
 	 * of paths and solving some problems (and prevent potential future
 	 * ones) -jesterKing. */
 	BLI_char_switch(tmp, '\\', '/');
-	BLI_char_switch(base, '\\', '/');	
+	BLI_char_switch(base, '\\', '/');
 
 	/* Paths starting with // will get the blend file as their base,
 	 * this isn't standard in any os but is used in blender all over the place */
@@ -1300,7 +1300,7 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 	BLI_char_switch(file, '\\', '/');
 #endif
 
-	/* Resolve relative references */	
+	/* Resolve relative references */
 	if (relabase && dir[0] == '/' && dir[1] == '/') {
 		char *lslash;
 		
@@ -1321,7 +1321,7 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 		else { /* no drive specified */
 			   /* first option: get the drive from the relabase if it has one */
 			if (relabase && strlen(relabase) >= 2 && relabase[1] == ':') {
-				BLI_strncpy(string, relabase, 3);	
+				BLI_strncpy(string, relabase, 3);
 				string[2] = '\\';
 				string[3] = '\0';
 			}
@@ -1337,7 +1337,7 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 
 	strcat(string, dir);
 
-	/* Make sure string ends in one (and only one) slash */	
+	/* Make sure string ends in one (and only one) slash */
 	/* first trim all slashes from the end of the string */
 	sl = strlen(string);
 	while (sl > 0 && (string[sl - 1] == '/' || string[sl - 1] == '\\') ) {
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index d3d8d37..6fa6d86 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -157,6 +157,8 @@ struct PBVH {
 
 	/* flag are verts/faces deformed */
 	int deformed;
+
+	int show_diffuse_color;
 };
 
 #define STACK_FIXED_DEPTH   100
@@ -189,8 +191,8 @@ static void BB_expand(BB *bb, float co[3])
 {
 	int i;
 	for (i = 0; i < 3; ++i) {
-		bb->bmin[i] = minf(bb->bmin[i], co[i]);
-		bb->bmax[i] = maxf(bb->bmax[i], co[i]);
+		bb->bmin[i] = min_ff(bb->bmin[i], co[i]);
+		bb->bmax[i] = max_ff(bb->bmax[i], co[i]);
 	}
 }
 
@@ -199,8 +201,8 @@ static void BB_expand_with_bb(BB *bb, BB *bb2)
 {
 	int i;
 	for (i = 0; i < 3; ++i) {
-		bb->bmin[i] = minf(bb->bmin[i], bb2->bmin[i]);
-		bb->bmax[i] = maxf(bb->bmax[i], bb2->bmax[i]);
+		bb->bmin[i] = min_ff(bb->bmin[i], bb2->bmin[i]);
+		bb->bmax[i] = max_ff(bb->bmax[i], bb2->bmax[i]);
 	}
 }
 
@@ -663,7 +665,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
 	bvh->totgrid = totgrid;
 	bvh->gridkey = *key;
 	bvh->grid_hidden = grid_hidden;
-	bvh->leaf_limit = maxi(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
+	bvh->leaf_limit = max_ii(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
 
 	BB_reset(&cb);
 
@@ -1001,7 +1003,7 @@ static int update_search_cb(PBVHNode *node, void *data_v)
 
 	if (node->flag & PBVH_Leaf)
 		return (node->flag & flag);
-	
+
 	return 1;
 }
 
@@ -1165,7 +1167,8 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
 					                        bvh->grid_flag_mats,
 					                        node->prim_indices,
 					                        node->totprim,
-					                        &bvh->gridkey);
+					                        &bvh->gridkey,
+					                        bvh->show_diffuse_color);
 					break;
 				case PBVH_FACES:
 					GPU_update_mesh_buffers(node->draw_buffers,
@@ -1174,7 +1177,9 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
 					                        node->uniq_verts +
 					                        node->face_verts,
 					                        CustomData_get_layer(bvh->vdata,
-					                                             CD_PAINT_MASK));
+					                                             CD_PAINT_MASK),
+					                        node->face_vert_indices,
+					                        bvh->show_diffuse_color);
 					break;
 			}
 
@@ -1630,9 +1635,9 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
 	PlaneAABBIsect ret = ISECT_INSIDE;
 	int i, axis;
 	
-	for (i = 0; i < 4; ++i) { 
+	for (i = 0; i < 4; ++i) {
 		for (axis = 0; axis < 3; ++axis) {
-			if (planes[i][axis] > 0) { 
+			if (planes[i][axis] > 0) {
 				vmin[axis] = bb_min[axis];
 				vmax[axis] = bb_max[axis];
 			}
@@ -1646,7 +1651,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
 			return ISECT_OUTSIDE;
 		else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0)
 			ret = ISECT_INTERSECT;
-	} 
+	}
 
 	return ret;
 }
@@ -1667,11 +1672,23 @@ int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
 	return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
 }
 
+static void pbvh_node_check_diffuse_changed(PBVH *bvh, PBVHNode *node)
+{
+	if (!node->draw_buffers)
+		return;
+
+	if (GPU_buffers_diffuse_changed(node->draw_buffers, bvh->show_diffuse_color))
+		node->flag |= PBVH_UpdateDrawBuffers;
+}
+
 void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
                    DMSetMaterial setMaterial)
 {
 	PBVHNode **nodes;
-	int totnode;
+	int a, totnode;
+
+	for (a = 0; a < bvh->totnode; a++)
+		pbvh_node_check_diffuse_changed(bvh, &bvh->nodes[a]);
 
 	BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
 	                       &nodes, &totnode);
@@ -1690,11 +1707,22 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
 	}
 }
 
-void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces)
+void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces,
+                           DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
 {
+	int a;
+
 	bvh->grids = grids;
 	bvh->gridadj = gridadj;
 	bvh->gridfaces = gridfaces;
+
+	if (flagmats != bvh->grid_flag_mats || bvh->grid_hidden != grid_hidden) {
+		bvh->grid_flag_mats = flagmats;
+		bvh->grid_hidden = grid_hidden;
+
+		for (a = 0; a < bvh->totnode; ++a)
+			BLI_pbvh_node_mark_rebuild_draw(&bvh->nodes[a]);
+	}
 }
 
 float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]
@@ -1876,3 +1904,8 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
 	if (!vi->grids)
 		vi->vmask = CustomData_get_layer(bvh->vdata, CD_PAINT_MASK);
 }
+
+void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color)
+{
+	bvh->show_diffuse_color = show_diffuse_color;
+}
diff --git a/source/blender/blenlib/intern/quadric.c b/source/blender/blenlib/intern/quadric.c
new file mode 100644
index 0000000..b06534d
--- /dev/null
+++ b/source/blender/blenlib/intern/quadric.c
@@ -0,0 +1,126 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Laurence Bourn, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenlib/intern/quadric.c
+ *  \ingroup bli
+ *
+ * \note This isn't fully complete,
+ * possible there are other useful functions to add here.
+ *
+ * \note try to follow BLI_math naming convention here.
+ */
+
+//#include <string.h>
+
+#include "BLI_math.h"
+#include "BLI_quadric.h"  /* own include */
+
+
+#define QUADRIC_FLT_TOT (sizeof(Quadric) / sizeof(float))
+
+void BLI_quadric_from_v3_dist(Quadric *q, const float v[3], const float offset)
+{
+	q->a2 = v[0] * v[0];
+	q->b2 = v[1] * v[1];
+	q->c2 = v[2] * v[2];
+
+	q->ab = v[0] * v[1];
+	q->ac = v[0] * v[2];
+	q->bc = v[1] * v[2];
+
+	q->ad = v[0] * offset;
+	q->bd = v[1] * offset;
+	q->cd = v[2] * offset;
+
+	q->d2 = offset * offset;
+}
+
+void BLI_quadric_to_tensor_m3(const Quadric *q, float m[3][3])
+{
+	m[0][0] = q->a2;
+	m[0][1] = q->ab;
+	m[0][2] = q->ac;
+
+	m[1][0] = q->ab;
+	m[1][1] = q->b2;
+	m[1][2] = q->bc;
+
+	m[2][0] = q->ac;
+	m[2][1] = q->bc;
+	m[2][2] = q->c2;
+}
+
+void BLI_quadric_to_vector_v3(const Quadric *q, float v[3])
+{
+	v[0] = q->ad;
+	v[1] = q->bd;
+	v[2] = q->cd;
+}
+
+void BLI_quadric_clear(Quadric *q)
+{
+	memset(q, 0, sizeof(*q));
+}
+
+void BLI_quadric_add_qu_qu(Quadric *a, const Quadric *b)
+{
+	add_vn_vn((float *)a, (float *)b, QUADRIC_FLT_TOT);
+}
+
+void BLI_quadric_add_qu_ququ(Quadric *r, const Quadric *a, const Quadric *b)
+{
+	add_vn_vnvn((float *)r, (const float *)a, (const float *)b, QUADRIC_FLT_TOT);
+}
+
+void BLI_quadric_mul(Quadric *a, const float scalar)
+{
+	mul_vn_fl((float *)a, QUADRIC_FLT_TOT, scalar);
+}
+
+float BLI_quadric_evaluate(const Quadric *q, const float v[3])
+{
+	return  (v[0] * v[0] * q->a2 + 2.0f * v[0] * v[1] * q->ab + 2.0f * v[0] * v[2] * q->ac + 2.0f * v[0] * q->ad +
+	         v[1] * v[1] * q->b2 + 2.0f * v[1] * v[2] * q->bc + 2.0f * v[1] * q->bd +
+	         v[2] * v[2] * q->c2 + 2.0f * v[2] * q->cd +
+	         q->d2);
+}
+
+int BLI_quadric_optimize(const Quadric *q, float v[3], const float epsilon)
+{
+	float m[3][3];
+
+	BLI_quadric_to_tensor_m3(q, m);
+
+	if (invert_m3_ex(m, epsilon)) {
+		BLI_quadric_to_vector_v3(q, v);
+		mul_m3_v3(m, v);
+		negate_v3(v);
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 4435e9c..76d17f3 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -40,7 +40,7 @@
 #include "BLI_threads.h"
 #include "BLI_rand.h"
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
+#ifdef _MSC_VER
 typedef unsigned __int64 r_uint64;
 
 #define MULTIPLIER  0x5DEECE66Di64
@@ -64,51 +64,51 @@ struct RNG {
 	r_uint64 X;
 };
 
-RNG *rng_new(unsigned int seed)
+RNG *BLI_rng_new(unsigned int seed)
 {
 	RNG *rng = MEM_mallocN(sizeof(*rng), "rng");
 
-	rng_seed(rng, seed);
+	BLI_rng_seed(rng, seed);
 
 	return rng;
 }
 
-void rng_free(RNG *rng)
+void BLI_rng_free(RNG *rng)
 {
 	MEM_freeN(rng);
 }
 
-void rng_seed(RNG *rng, unsigned int seed)
+void BLI_rng_seed(RNG *rng, unsigned int seed)
 {
 	rng->X = (((r_uint64) seed) << 16) | LOWSEED;
 }
 
-void rng_srandom(RNG *rng, unsigned int seed)
+void BLI_rng_srandom(RNG *rng, unsigned int seed)
 {
-	rng_seed(rng, seed + hash[seed & 255]);
-	seed = rng_getInt(rng);
-	rng_seed(rng, seed + hash[seed & 255]);
-	seed = rng_getInt(rng);
-	rng_seed(rng, seed + hash[seed & 255]);
+	BLI_rng_seed(rng, seed + hash[seed & 255]);
+	seed = BLI_rng_get_int(rng);
+	BLI_rng_seed(rng, seed + hash[seed & 255]);
+	seed = BLI_rng_get_int(rng);
+	BLI_rng_seed(rng, seed + hash[seed & 255]);
 }
 
-int rng_getInt(RNG *rng)
+int BLI_rng_get_int(RNG *rng)
 {
 	rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK;
 	return (int) (rng->X >> 17);
 }
 
-double rng_getDouble(RNG *rng)
+double BLI_rng_get_double(RNG *rng)
 {
-	return (double) rng_getInt(rng) / 0x80000000;
+	return (double) BLI_rng_get_int(rng) / 0x80000000;
 }
 
-float rng_getFloat(RNG *rng)
+float BLI_rng_get_float(RNG *rng)
 {
-	return (float) rng_getInt(rng) / 0x80000000;
+	return (float) BLI_rng_get_int(rng) / 0x80000000;
 }
 
-void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
+void BLI_rng_shuffle_array(RNG *rng, void *data, int elemSize, int numElems)
 {
 	int i = numElems;
 	void *temp;
@@ -122,7 +122,7 @@ void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
 	/* XXX Shouldn't it rather be "while (i--) {" ?
 	 *     Else we have no guaranty first (0) element has a chance to be shuffled... --mont29 */
 	while (--i) {
-		int j = rng_getInt(rng) % numElems;
+		int j = BLI_rng_get_int(rng) % numElems;
 		if (i != j) {
 			void *iElem = (unsigned char *)data + i * elemSize;
 			void *jElem = (unsigned char *)data + j * elemSize;
@@ -135,12 +135,12 @@ void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
 	free(temp);
 }
 
-void rng_skip(RNG *rng, int n)
+void BLI_rng_skip(RNG *rng, int n)
 {
 	int i;
 
 	for (i = 0; i < n; i++)
-		rng_getInt(rng);
+		BLI_rng_get_int(rng);
 }
 
 /***/
@@ -150,28 +150,28 @@ static RNG theBLI_rng = {0};
 /* note, this one creates periodical patterns */
 void BLI_srand(unsigned int seed)
 {
-	rng_seed(&theBLI_rng, seed);
+	BLI_rng_seed(&theBLI_rng, seed);
 }
 
 /* using hash table to create better seed */
 void BLI_srandom(unsigned int seed)
 {
-	rng_srandom(&theBLI_rng, seed);
+	BLI_rng_srandom(&theBLI_rng, seed);
 }
 
 int BLI_rand(void)
 {
-	return rng_getInt(&theBLI_rng);
+	return BLI_rng_get_int(&theBLI_rng);
 }
 
 double BLI_drand(void)
 {
-	return rng_getDouble(&theBLI_rng);
+	return BLI_rng_get_double(&theBLI_rng);
 }
 
 float BLI_frand(void)
 {
-	return rng_getFloat(&theBLI_rng);
+	return BLI_rng_get_float(&theBLI_rng);
 }
 
 void BLI_fillrand(void *addr, int len)
@@ -179,16 +179,16 @@ void BLI_fillrand(void *addr, int len)
 	RNG rng;
 	unsigned char *p = addr;
 
-	rng_seed(&rng, (unsigned int) (PIL_check_seconds_timer() * 0x7FFFFFFF));
-	while (len--) *p++ = rng_getInt(&rng) & 0xFF;
+	BLI_rng_seed(&rng, (unsigned int) (PIL_check_seconds_timer() * 0x7FFFFFFF));
+	while (len--) *p++ = BLI_rng_get_int(&rng) & 0xFF;
 }
 
 void BLI_array_randomize(void *data, int elemSize, int numElems, unsigned int seed)
 {
 	RNG rng;
 
-	rng_seed(&rng, seed);
-	rng_shuffleArray(&rng, data, elemSize, numElems);
+	BLI_rng_seed(&rng, seed);
+	BLI_rng_shuffle_array(&rng, data, elemSize, numElems);
 }
 
 /* ********* for threaded random ************** */
@@ -200,20 +200,20 @@ void BLI_thread_srandom(int thread, unsigned int seed)
 	if (thread >= BLENDER_MAX_THREADS)
 		thread = 0;
 	
-	rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
-	seed = rng_getInt(&rng_tab[thread]);
-	rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
-	seed = rng_getInt(&rng_tab[thread]);
-	rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
+	BLI_rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
+	seed = BLI_rng_get_int(&rng_tab[thread]);
+	BLI_rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
+	seed = BLI_rng_get_int(&rng_tab[thread]);
+	BLI_rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
 }
 
 int BLI_thread_rand(int thread)
 {
-	return rng_getInt(&rng_tab[thread]);
+	return BLI_rng_get_int(&rng_tab[thread]);
 }
 
 float BLI_thread_frand(int thread)
 {
-	return rng_getFloat(&rng_tab[thread]);
+	return BLI_rng_get_float(&rng_tab[thread]);
 }
 
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index cab383b..ee073d5 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -102,16 +102,28 @@ int BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2])
 }
 
 /* based closely on 'isect_line_line_v2_int', but in modified so corner cases are treated as intersections */
-static int isect_segments(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
+static int isect_segments_i(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
 {
 	const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
-	if (div == 0.0f) {
+	if (div == 0.0) {
 		return 1; /* co-linear */
 	}
 	else {
 		const double labda = (double)((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
 		const double mu    = (double)((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
-		return (labda >= 0.0f && labda <= 1.0f && mu >= 0.0f && mu <= 1.0f);
+		return (labda >= 0.0 && labda <= 1.0 && mu >= 0.0 && mu <= 1.0);
+	}
+}
+static int isect_segments_fl(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+{
+	const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
+	if (div == 0.0) {
+		return 1; /* co-linear */
+	}
+	else {
+		const double labda = (double)((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
+		const double mu    = (double)((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
+		return (labda >= 0.0 && labda <= 1.0 && mu >= 0.0 && mu <= 1.0);
 	}
 }
 
@@ -134,14 +146,49 @@ int BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2])
 		/* diagonal: [/] */
 		tvec1[0] = rect->xmin; tvec1[1] = rect->ymin;
 		tvec2[0] = rect->xmin; tvec2[1] = rect->ymax;
-		if (isect_segments(s1, s2, tvec1, tvec2)) {
+		if (isect_segments_i(s1, s2, tvec1, tvec2)) {
+			return 1;
+		}
+
+		/* diagonal: [\] */
+		tvec1[0] = rect->xmin; tvec1[1] = rect->ymax;
+		tvec2[0] = rect->xmax; tvec2[1] = rect->ymin;
+		if (isect_segments_i(s1, s2, tvec1, tvec2)) {
+			return 1;
+		}
+
+		/* no intersection */
+		return 0;
+	}
+}
+
+int BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[2])
+{
+	/* first do outside-bounds check for both points of the segment */
+	if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0;
+	if (s1[0] > rect->xmax && s2[0] > rect->xmax) return 0;
+	if (s1[1] < rect->ymin && s2[1] < rect->ymin) return 0;
+	if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0;
+
+	/* if either points intersect then we definetly intersect */
+	if (BLI_rctf_isect_pt_v(rect, s1) || BLI_rctf_isect_pt_v(rect, s2)) {
+		return 1;
+	}
+	else {
+		/* both points are outside but may insersect the rect */
+		float tvec1[2];
+		float tvec2[2];
+		/* diagonal: [/] */
+		tvec1[0] = rect->xmin; tvec1[1] = rect->ymin;
+		tvec2[0] = rect->xmin; tvec2[1] = rect->ymax;
+		if (isect_segments_fl(s1, s2, tvec1, tvec2)) {
 			return 1;
 		}
 
 		/* diagonal: [\] */
 		tvec1[0] = rect->xmin; tvec1[1] = rect->ymax;
 		tvec2[0] = rect->xmax; tvec2[1] = rect->ymin;
-		if (isect_segments(s1, s2, tvec1, tvec2)) {
+		if (isect_segments_fl(s1, s2, tvec1, tvec2)) {
 			return 1;
 		}
 
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 7ae27b8..defe500 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -503,8 +503,7 @@ static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *tempe
 	}
 }
 
-
-static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
+static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
 {
 	ScanFillVertLink *sc = NULL, *sc1;
 	ScanFillVert *eve, *v1, *v2, *v3;
@@ -530,26 +529,28 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 #endif
 
 	/* STEP 0: remove zero sized edges */
-	eed = sf_ctx->filledgebase.first;
-	while (eed) {
-		if (equals_v2v2(eed->v1->xy, eed->v2->xy)) {
-			if (eed->v1->f == SF_VERT_ZERO_LEN && eed->v2->f != SF_VERT_ZERO_LEN) {
-				eed->v2->f = SF_VERT_ZERO_LEN;
-				eed->v2->tmp.v = eed->v1->tmp.v;
-			}
-			else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f != SF_VERT_ZERO_LEN) {
-				eed->v1->f = SF_VERT_ZERO_LEN;
-				eed->v1->tmp.v = eed->v2->tmp.v;
-			}
-			else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f == SF_VERT_ZERO_LEN) {
-				eed->v1->tmp.v = eed->v2->tmp.v;
-			}
-			else {
-				eed->v2->f = SF_VERT_ZERO_LEN;
-				eed->v2->tmp.v = eed->v1;
+	if (flag & BLI_SCANFILL_CALC_REMOVE_DOUBLES) {
+		eed = sf_ctx->filledgebase.first;
+		while (eed) {
+			if (equals_v2v2(eed->v1->xy, eed->v2->xy)) {
+				if (eed->v1->f == SF_VERT_ZERO_LEN && eed->v2->f != SF_VERT_ZERO_LEN) {
+					eed->v2->f = SF_VERT_ZERO_LEN;
+					eed->v2->tmp.v = eed->v1->tmp.v;
+				}
+				else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f != SF_VERT_ZERO_LEN) {
+					eed->v1->f = SF_VERT_ZERO_LEN;
+					eed->v1->tmp.v = eed->v2->tmp.v;
+				}
+				else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f == SF_VERT_ZERO_LEN) {
+					eed->v1->tmp.v = eed->v2->tmp.v;
+				}
+				else {
+					eed->v2->f = SF_VERT_ZERO_LEN;
+					eed->v2->tmp.v = eed->v1;
+				}
 			}
+			eed = eed->next;
 		}
-		eed = eed->next;
 	}
 
 	/* STEP 1: make using FillVert and FillEdge lists a sorted
@@ -572,28 +573,42 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 
 	qsort(sf_ctx->_scdata, verts, sizeof(ScanFillVertLink), vergscdata);
 
-	eed = sf_ctx->filledgebase.first;
-	while (eed) {
-		nexted = eed->next;
-		BLI_remlink(&sf_ctx->filledgebase, eed);
-		/* This code is for handling zero-length edges that get
-		 * collapsed in step 0. It was removed for some time to
-		 * fix trunk bug #4544, so if that comes back, this code
-		 * may need some work, or there will have to be a better
-		 * fix to #4544. */
-		if (eed->v1->f == SF_VERT_ZERO_LEN) {
-			v1 = eed->v1;
-			while ((eed->v1->f == SF_VERT_ZERO_LEN) && (eed->v1->tmp.v != v1) && (eed->v1 != eed->v1->tmp.v))
-				eed->v1 = eed->v1->tmp.v;
+	if (flag & BLI_SCANFILL_CALC_REMOVE_DOUBLES) {
+		for (eed = sf_ctx->filledgebase.first; eed; eed = nexted) {
+			nexted = eed->next;
+			BLI_remlink(&sf_ctx->filledgebase, eed);
+			/* This code is for handling zero-length edges that get
+			 * collapsed in step 0. It was removed for some time to
+			 * fix trunk bug #4544, so if that comes back, this code
+			 * may need some work, or there will have to be a better
+			 * fix to #4544.
+			 *
+			 * warning, this can hang on un-ordered edges, see: [#33281]
+			 * for now disable 'BLI_SCANFILL_CALC_REMOVE_DOUBLES' for ngons.
+			 */
+			if (eed->v1->f == SF_VERT_ZERO_LEN) {
+				v1 = eed->v1;
+				while ((eed->v1->f == SF_VERT_ZERO_LEN) && (eed->v1->tmp.v != v1) && (eed->v1 != eed->v1->tmp.v))
+					eed->v1 = eed->v1->tmp.v;
+			}
+			if (eed->v2->f == SF_VERT_ZERO_LEN) {
+				v2 = eed->v2;
+				while ((eed->v2->f == SF_VERT_ZERO_LEN) && (eed->v2->tmp.v != v2) && (eed->v2 != eed->v2->tmp.v))
+					eed->v2 = eed->v2->tmp.v;
+			}
+			if (eed->v1 != eed->v2) {
+				addedgetoscanlist(sf_ctx, eed, verts);
+			}
 		}
-		if (eed->v2->f == SF_VERT_ZERO_LEN) {
-			v2 = eed->v2;
-			while ((eed->v2->f == SF_VERT_ZERO_LEN) && (eed->v2->tmp.v != v2) && (eed->v2 != eed->v2->tmp.v))
-				eed->v2 = eed->v2->tmp.v;
+	}
+	else {
+		for (eed = sf_ctx->filledgebase.first; eed; eed = nexted) {
+			nexted = eed->next;
+			BLI_remlink(&sf_ctx->filledgebase, eed);
+			if (eed->v1 != eed->v2) {
+				addedgetoscanlist(sf_ctx, eed, verts);
+			}
 		}
-		if (eed->v1 != eed->v2) addedgetoscanlist(sf_ctx, eed, verts);
-
-		eed = nexted;
 	}
 #if 0
 	sc = scdata;
@@ -661,8 +676,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 				/* this happens with a serial of overlapping edges */
 				if (v1 == v2 || v2 == v3) break;
 				/* printf("test verts %x %x %x\n",v1,v2,v3); */
-				miny = minf(v1->xy[1], v3->xy[1]);
-				/*  miny= minf(v1->xy[1],v3->xy[1]); */
+				miny = min_ff(v1->xy[1], v3->xy[1]);
+				/*  miny = min_ff(v1->xy[1],v3->xy[1]); */
 				sc1 = sc + 1;
 				test = 0;
 
@@ -775,12 +790,12 @@ int BLI_scanfill_begin(ScanFillContext *sf_ctx)
 	return 1;
 }
 
-int BLI_scanfill_calc(ScanFillContext *sf_ctx, const short do_quad_tri_speedup)
+int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag)
 {
-	return BLI_scanfill_calc_ex(sf_ctx, do_quad_tri_speedup, NULL);
+	return BLI_scanfill_calc_ex(sf_ctx, flag, NULL);
 }
 
-int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3])
+int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3])
 {
 	/*
 	 * - fill works with its own lists, so create that first (no faces!)
@@ -810,30 +825,32 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedu
 		a += 1;
 	}
 
-	if (do_quad_tri_speedup && (a == 3)) {
-		eve = sf_ctx->fillvertbase.first;
+	if (flag & BLI_SCANFILL_CALC_QUADTRI_FASTPATH) {
+		if (a == 3) {
+			eve = sf_ctx->fillvertbase.first;
 
-		addfillface(sf_ctx, eve, eve->next, eve->next->next);
-		return 1;
-	}
-	else if (do_quad_tri_speedup && (a == 4)) {
-		float vec1[3], vec2[3];
-
-		eve = sf_ctx->fillvertbase.first;
-		/* no need to check 'eve->next->next->next' is valid, already counted */
-		/* use shortest diagonal for quad */
-		sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
-		sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
-
-		if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
 			addfillface(sf_ctx, eve, eve->next, eve->next->next);
-			addfillface(sf_ctx, eve->next->next, eve->next->next->next, eve);
+			return 1;
 		}
-		else {
-			addfillface(sf_ctx, eve->next, eve->next->next, eve->next->next->next);
-			addfillface(sf_ctx, eve->next->next->next, eve, eve->next);
+		else if (a == 4) {
+			float vec1[3], vec2[3];
+
+			eve = sf_ctx->fillvertbase.first;
+			/* no need to check 'eve->next->next->next' is valid, already counted */
+			/* use shortest diagonal for quad */
+			sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
+			sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
+
+			if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
+				addfillface(sf_ctx, eve, eve->next, eve->next->next);
+				addfillface(sf_ctx, eve->next->next, eve->next->next->next, eve);
+			}
+			else {
+				addfillface(sf_ctx, eve->next, eve->next->next, eve->next->next->next);
+				addfillface(sf_ctx, eve->next->next->next, eve, eve->next);
+			}
+			return 2;
 		}
-		return 2;
 	}
 
 	/* first test vertices if they are in edges */
@@ -985,12 +1002,12 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedu
 
 
 	/* CURRENT STATUS:
-	 * - eve->f       :1= availalble in edges
+	 * - eve->f       :1 = available in edges
 	 * - eve->xs      :polynumber
 	 * - eve->h       :amount of edges connected to vertex
 	 * - eve->tmp.v   :store! original vertex number
 	 * 
-	 * - eed->f       :1= boundary edge (optionally set by caller)
+	 * - eed->f       :1 = boundary edge (optionally set by caller)
 	 * - eed->poly_nr :poly number
 	 */
 
@@ -1091,7 +1108,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedu
 	for (a = 0; a < poly; a++) {
 		if (pf->edges > 1) {
 			splitlist(sf_ctx, &tempve, &temped, pf->nr);
-			totfaces += scanfill(sf_ctx, pf);
+			totfaces += scanfill(sf_ctx, pf, flag);
 		}
 		pf++;
 	}
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 92125c6..64bb503 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -43,8 +43,22 @@
 #define SMHASH_CELL_UNUSED  ((void *)0x7FFFFFFF)
 #define SMHASH_CELL_FREE    ((void *)0x7FFFFFFD)
 
-#define SMHASH_NONZERO(n) ((n) + !(n))
-#define SMHASH_NEXT(h, hoff) ABS(((h) + ((hoff = SMHASH_NONZERO(hoff * 2) + 1), hoff)))
+BLI_INLINE int smhash_nonzero(const int n)
+{
+	return n + !n;
+}
+
+BLI_INLINE int smhash_abs_i(const int n)
+{
+	return (n > 0) ? n : -n;
+}
+
+/* typically this re-assigns 'h' */
+#define SMHASH_NEXT(h, hoff)  ( \
+	CHECK_TYPE_INLINE(&(h),    int), \
+	CHECK_TYPE_INLINE(&(hoff), int), \
+	smhash_abs_i((h) + (((hoff) = smhash_nonzero((hoff) * 2) + 1), (hoff))) \
+	)
 
 extern unsigned int hashsizes[];
 
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 0d3f6ae..1358fdd 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -187,7 +187,7 @@ double BLI_dir_free_space(const char *dir)
 #endif
 
 #if defined(__sun__) || defined(__sun) || defined(__NetBSD__)
-	if (statvfs(name, &disk)) return(-1);	
+	if (statvfs(name, &disk)) return(-1);
 #elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
 	/* WARNING - This may not be supported by geeneric unix os's - Campbell */
 	if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
@@ -418,9 +418,9 @@ static void bli_adddirstrings(void)
 
 unsigned int BLI_dir_contents(const char *dirname,  struct direntry **filelist)
 {
-	// reset global variables
-	// memory stored in files is free()'d in
-	// filesel.c:freefilelist()
+	/* reset global variables
+	 * memory stored in files is free()'d in
+	 * filesel.c:freefilelist() */
 
 	actnum = totnum = 0;
 	files = NULL;
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 8501db7..f23f75f 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -41,6 +41,8 @@
 #include "BLI_dynstr.h"
 #include "BLI_string.h"
 
+#include "BLI_utildefines.h"
+
 char *BLI_strdupn(const char *str, const size_t len)
 {
 	char *n = MEM_mallocN(len + 1, "strdup");
@@ -54,7 +56,7 @@ char *BLI_strdup(const char *str)
 	return BLI_strdupn(str, strlen(str));
 }
 
-char *BLI_strdupcat(const char *str1, const char *str2)
+char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
 {
 	size_t len;
 	char *n;
@@ -67,10 +69,11 @@ char *BLI_strdupcat(const char *str1, const char *str2)
 	return n;
 }
 
-char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
+char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 {
 	size_t srclen = strlen(src);
 	size_t cpylen = (srclen > (maxncpy - 1)) ? (maxncpy - 1) : srclen;
+	BLI_assert(maxncpy != 0);
 	
 	memcpy(dst, src, cpylen);
 	dst[cpylen] = '\0';
@@ -78,10 +81,14 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
 	return dst;
 }
 
-size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
 {
 	size_t n;
 
+	BLI_assert(buffer != NULL);
+	BLI_assert(count > 0);
+	BLI_assert(format != NULL);
+
 	n = vsnprintf(buffer, count, format, arg);
 
 	if (n != -1 && n < count) {
@@ -94,7 +101,7 @@ size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg
 	return n;
 }
 
-size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
 {
 	size_t n;
 	va_list arg;
@@ -106,12 +113,14 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
 	return n;
 }
 
-char *BLI_sprintfN(const char *format, ...)
+char *BLI_sprintfN(const char *__restrict format, ...)
 {
 	DynStr *ds;
 	va_list arg;
 	char *n;
 
+	BLI_assert(format != NULL);
+
 	va_start(arg, format);
 
 	ds = BLI_dynstr_new();
@@ -130,10 +139,13 @@ char *BLI_sprintfN(const char *format, ...)
  * TODO: support more fancy string escaping. current code is primitive
  *    this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
  *    which is a useful reference. */
-size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
+size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 {
 	size_t len = 0;
-	while (len < maxlen) {
+
+	BLI_assert(maxncpy != 0);
+
+	while (len < maxncpy) {
 		switch (*src) {
 			case '\0':
 				goto escape_finish;
@@ -144,7 +156,7 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
 			case '\t':
 			case '\n':
 			case '\r':
-				if (len + 1 < maxlen) {
+				if (len + 1 < maxncpy) {
 					*dst++ = '\\';
 					len++;
 				}
@@ -180,7 +192,7 @@ escape_finish:
  *
  * TODO, return the offset and a length so as to avoid doing an allocation.
  */
-char *BLI_str_quoted_substrN(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
 {
 	size_t prefixLen = strlen(prefix);
 	char *startMatch, *endMatch;
@@ -201,7 +213,7 @@ char *BLI_str_quoted_substrN(const char *str, const char *prefix)
 
 /* A rather wasteful string-replacement utility, though this shall do for now...
  * Feel free to replace this with an even safe + nicer alternative */
-char *BLI_replacestr(char *str, const char *oldText, const char *newText)
+char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
 {
 	DynStr *ds = NULL;
 	size_t lenOld = strlen(oldText);
@@ -296,11 +308,12 @@ char *BLI_strcasestr(const char *s, const char *find)
 
 int BLI_strcasecmp(const char *s1, const char *s2)
 {
-	int i;
+	register int i;
+	register char c1, c2;
 
 	for (i = 0;; i++) {
-		char c1 = tolower(s1[i]);
-		char c2 = tolower(s2[i]);
+		c1 = tolower(s1[i]);
+		c2 = tolower(s2[i]);
 
 		if (c1 < c2) {
 			return -1;
@@ -318,11 +331,12 @@ int BLI_strcasecmp(const char *s1, const char *s2)
 
 int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
 {
-	int i;
+	register size_t i;
+	register char c1, c2;
 
 	for (i = 0; i < len; i++) {
-		char c1 = tolower(s1[i]);
-		char c2 = tolower(s2[i]);
+		c1 = tolower(s1[i]);
+		c2 = tolower(s2[i]);
 
 		if (c1 < c2) {
 			return -1;
@@ -341,15 +355,16 @@ int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
 /* natural string compare, keeping numbers in order */
 int BLI_natstrcmp(const char *s1, const char *s2)
 {
-	int d1 = 0, d2 = 0;
+	register int d1 = 0, d2 = 0;
+	register char c1, c2;
 
 	/* if both chars are numeric, to a strtol().
 	 * then increase string deltas as long they are 
 	 * numeric, else do a tolower and char compare */
 
 	while (1) {
-		char c1 = tolower(s1[d1]);
-		char c2 = tolower(s2[d2]);
+		c1 = tolower(s1[d1]);
+		c2 = tolower(s2[d2]);
 		
 		if (isdigit(c1) && isdigit(c2) ) {
 			int val1, val2;
@@ -374,7 +389,7 @@ int BLI_natstrcmp(const char *s1, const char *s2)
 			c2 = tolower(s2[d2]);
 		}
 	
-		/* first check for '.' so "foo.bar" comes before "foo 1.bar" */	
+		/* first check for '.' so "foo.bar" comes before "foo 1.bar" */
 		if (c1 == '.' && c2 != '.')
 			return -1;
 		if (c1 != '.' && c2 == '.')
@@ -413,27 +428,26 @@ void BLI_timestr(double _time, char *str)
 }
 
 /* determine the length of a fixed-size string */
-size_t BLI_strnlen(const char *str, size_t maxlen)
+size_t BLI_strnlen(const char *str, const size_t maxlen)
 {
 	const char *end = memchr(str, '\0', maxlen);
 	return end ? (size_t) (end - str) : maxlen;
 }
 
-void BLI_ascii_strtolower(char *str, int len)
+void BLI_ascii_strtolower(char *str, const size_t len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < len; i++)
 		if (str[i] >= 'A' && str[i] <= 'Z')
 			str[i] += 'a' - 'A';
 }
 
-void BLI_ascii_strtoupper(char *str, int len)
+void BLI_ascii_strtoupper(char *str, const size_t len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < len; i++)
 		if (str[i] >= 'a' && str[i] <= 'z')
 			str[i] -= 'a' - 'A';
 }
-
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index bab1442..65763f2 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -38,7 +38,7 @@
 
 typedef enum strCursorDelimType {
 	STRCUR_DELIM_NONE,
-	STRCUR_DELIM_ALPHA,
+	STRCUR_DELIM_ALPHANUMERIC,
 	STRCUR_DELIM_PUNCT,
 	STRCUR_DELIM_BRACE,
 	STRCUR_DELIM_OPERATOR,
@@ -47,21 +47,12 @@ typedef enum strCursorDelimType {
 	STRCUR_DELIM_OTHER
 } strCursorDelimType;
 
-/* return 1 if char ch is special character, otherwise return 0 */
-static strCursorDelimType test_special_char(const char *ch_utf8)
+static strCursorDelimType cursor_delim_type(const char *ch_utf8)
 {
 	/* for full unicode support we really need to have large lookup tables to figure
 	 * out whats what in every possible char set - and python, glib both have these. */
 	unsigned int uch = BLI_str_utf8_as_unicode(ch_utf8);
 
-	if ((uch >= 'a' && uch <= 'z') ||
-	    (uch >= 'A' && uch <= 'Z') ||
-	    (uch == '_') /* not quite correct but allow for python, could become configurable */
-	    )
-	{
-		return STRCUR_DELIM_ALPHA;
-	}
-
 	switch (uch) {
 		case ',':
 		case '.':
@@ -86,10 +77,11 @@ static strCursorDelimType test_special_char(const char *ch_utf8)
 		case '^':
 		case '*':
 		case '&':
+		case '|':
 			return STRCUR_DELIM_OPERATOR;
 
 		case '\'':
-		case '\"': // " - an extra closing one for Aligorith's text editor
+		case '\"':
 			return STRCUR_DELIM_QUOTE;
 
 		case ' ':
@@ -97,20 +89,22 @@ static strCursorDelimType test_special_char(const char *ch_utf8)
 			return STRCUR_DELIM_WHITESPACE;
 
 		case '\\':
-		case '!':
 		case '@':
 		case '#':
 		case '$':
 		case ':':
 		case ';':
 		case '?':
+		case '!':
+		case 0xA3:  /* pound */
+		case 0x80:  /* euro */
 			/* case '_': *//* special case, for python */
 			return STRCUR_DELIM_OTHER;
 
 		default:
 			break;
 	}
-	return STRCUR_DELIM_NONE;
+	return STRCUR_DELIM_ALPHANUMERIC; /* Not quite true, but ok for now */
 }
 
 int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
@@ -153,14 +147,14 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
 		BLI_str_cursor_step_next_utf8(str, maxlen, pos);
 
 		if (jump != STRCUR_JUMP_NONE) {
-			const strCursorDelimType is_special = (*pos) < maxlen ? test_special_char(&str[*pos]) : STRCUR_DELIM_NONE;
+			const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE;
 			/* jump between special characters (/,\,_,-, etc.),
-			 * look at function test_special_char() for complete
+			 * look at function cursor_delim_type() for complete
 			 * list of special character, ctr -> */
 			while ((*pos) < maxlen) {
 				if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
-					if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
-						break;
+					if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
+					break;
 				}
 				else {
 					break; /* unlikely but just in case */
@@ -172,13 +166,13 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
 		BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
 
 		if (jump != STRCUR_JUMP_NONE) {
-			const strCursorDelimType is_special = (*pos) > 1 ? test_special_char(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
+			const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
 			/* jump between special characters (/,\,_,-, etc.),
-			 * look at function test_special_char() for complete
+			 * look at function cursor_delim_type() for complete
 			 * list of special character, ctr -> */
 			while ((*pos) > 0) {
 				if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
-					if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
+					if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
 						break;
 				}
 				else {
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 17b9ed7..bf98f2a 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -33,8 +33,12 @@
 #include <string.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <stdio.h>
+#include <stdlib.h>
 
-#include "BLI_string_utf8.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_string_utf8.h"  /* own include */
 
 /* from libswish3, originally called u8_isvalid(),
  * modified to return the index of the bad character (byte index not utf).
@@ -124,15 +128,15 @@ utf8_error:
 
 int BLI_utf8_invalid_strip(char *str, int length)
 {
-	int bad_char, tot= 0;
+	int bad_char, tot = 0;
 
-	while ((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
+	while ((bad_char = BLI_utf8_invalid_byte(str, length)) != -1) {
 		str += bad_char;
 		length -= bad_char;
 
 		if (length == 0) {
 			/* last character bad, strip it */
-			*str= '\0';
+			*str = '\0';
 			tot++;
 			break;
 		}
@@ -153,22 +157,22 @@ int BLI_utf8_invalid_strip(char *str, int length)
  * note: this looks to be at odd's with 'trailingBytesForUTF8',
  * need to find out what gives here! - campbell */
 static const size_t utf8_skip_data[256] = {
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+	3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
 };
 
 #define BLI_STR_UTF8_CPY(dst, src, maxncpy)                                   \
 	{                                                                         \
 		size_t utf8_size;                                                     \
-		while (*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) {  \
+		while (*src != '\0' && (utf8_size = utf8_skip_data[*src]) < maxncpy) {\
 			maxncpy -= utf8_size;                                             \
-			switch (utf8_size) {                                               \
+			switch (utf8_size) {                                              \
 				case 6: *dst ++ = *src ++;                                    \
 				case 5: *dst ++ = *src ++;                                    \
 				case 4: *dst ++ = *src ++;                                    \
@@ -177,12 +181,14 @@ static const size_t utf8_skip_data[256] = {
 				case 1: *dst ++ = *src ++;                                    \
 			}                                                                 \
 		}                                                                     \
-		*dst= '\0';                                                           \
+		*dst = '\0';                                                          \
 	} (void)0
 
-char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
+char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
 {
-	char *dst_r= dst;
+	char *dst_r = dst;
+
+	BLI_assert(maxncpy != 0);
 
 	/* note: currently we don't attempt to deal with invalid utf8 chars */
 	BLI_STR_UTF8_CPY(dst, src, maxncpy);
@@ -190,7 +196,7 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
 	return dst_r;
 }
 
-char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
+char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
 {
 	while (*dst && maxncpy > 0) {
 		dst++;
@@ -207,14 +213,17 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
 /* --------------------------------------------------------------------------*/
 /* wchar_t / utf8 functions  */
 
-size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy)
+size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
 {
 	size_t len = 0;
-	while (*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
+
+	BLI_assert(maxncpy != 0);
+
+	while (*src && len < maxncpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
 		len += BLI_str_utf8_from_unicode(*src++, dst + len);
 	}
 
-	dst[len]= '\0';
+	dst[len] = '\0';
 
 	return len;
 }
@@ -231,33 +240,56 @@ size_t BLI_wstrlen_utf8(const wchar_t *src)
 	return len;
 }
 
-// utf8slen
+/* this is very close to 'BLI_str_utf8_size' functionality, perhaps we should de-duplicate */
+/* size of UTF-8 character in bytes */
+static size_t strlen_utf8_char(const char *strc)
+{
+	if ((*strc & 0xe0) == 0xc0) {
+		if ((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
+			return 2;
+	}
+	else if ((*strc & 0xf0) == 0xe0) {
+		if ((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00)
+			return 3;
+	}
+	else if ((*strc & 0xf8) == 0xf0) {
+		if ((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
+			return 4;
+	}
+
+	return 1;
+}
+
 size_t BLI_strlen_utf8(const char *strc)
 {
-	int len = 0;
+	int len;
 
-	while (*strc) {
-		if ((*strc & 0xe0) == 0xc0) {
-			if ((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
-				strc++;
-		}
-		else if ((*strc & 0xf0) == 0xe0) {
-			if ((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00)
-				strc += 2;
-		}
-		else if ((*strc & 0xf8) == 0xf0) {
-			if ((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
-				strc += 3;
-		}
+	for (len = 0; *strc; len++)
+		strc += strlen_utf8_char(strc);
 
-		strc++;
-		len++;
+	return len;
+}
+
+/**
+ * \param start the string to measure the length.
+ * \param maxlen the string length (in bytes)
+ * \return the unicode length (not in bytes!)
+ */
+size_t BLI_strnlen_utf8(const char *start, const size_t maxlen)
+{
+	const char *strc = start;
+	const char *strc_end = start + maxlen;
+
+	size_t len;
+
+	for (len = 0; *strc && strc < strc_end; len++) {
+		strc += strlen_utf8_char(strc);
 	}
 
 	return len;
 }
 
-size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxcpy)
+size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy)
 {
 	int len = 0;
 
@@ -265,16 +297,16 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
 		return 0;
 	}
 
-	while (*src_c && len < maxcpy) {
-		size_t step= 0;
-		unsigned int unicode= BLI_str_utf8_as_unicode_and_size(src_c, &step);
+	while (*src_c && len < maxncpy) {
+		size_t step = 0;
+		unsigned int unicode = BLI_str_utf8_as_unicode_and_size(src_c, &step);
 		if (unicode != BLI_UTF8_ERR) {
-			*dst_w= (wchar_t)unicode;
+			*dst_w = (wchar_t)unicode;
 			src_c += step;
 		}
 		else {
 			*dst_w = '?';
-			src_c= BLI_str_find_next_char_utf8(src_c, NULL);
+			src_c = BLI_str_find_next_char_utf8(src_c, NULL);
 		}
 		dst_w++;
 		len++;
@@ -285,12 +317,12 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
 /* end wchar_t / utf8 functions  */
 /* --------------------------------------------------------------------------*/
 
-/* copied from glib's gutf8.c */
+/* copied from glib's gutf8.c, added 'Err' arg */
 
 /* note, glib uses unsigned int for unicode, best we do the same,
  * though we don't typedef it - campbell */
 
-#define UTF8_COMPUTE(Char, Mask, Len)                                         \
+#define UTF8_COMPUTE(Char, Mask, Len, Err)                                    \
 	if (Char < 128) {                                                         \
 		Len = 1;                                                              \
 		Mask = 0x7f;                                                          \
@@ -316,7 +348,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
 		Mask = 0x01;                                                          \
 	}                                                                         \
 	else {                                                                    \
-		Len = -1;                                                             \
+		Len = Err;  /* -1 is the typical error value or 1 to skip */          \
 	} (void)0
 
 /* same as glib define but added an 'Err' arg */
@@ -339,7 +371,20 @@ int BLI_str_utf8_size(const char *p)
 	int mask = 0, len;
 	unsigned char c = (unsigned char) *p;
 
-	UTF8_COMPUTE (c, mask, len);
+	UTF8_COMPUTE (c, mask, len, -1);
+
+	(void)mask; /* quiet warning */
+
+	return len;
+}
+
+/* use when we want to skip errors */
+int BLI_str_utf8_size_safe(const char *p)
+{
+	int mask = 0, len;
+	unsigned char c = (unsigned char) *p;
+
+	UTF8_COMPUTE (c, mask, len, 1);
 
 	(void)mask; /* quiet warning */
 
@@ -349,10 +394,10 @@ int BLI_str_utf8_size(const char *p)
 /* was g_utf8_get_char */
 /**
  * BLI_str_utf8_as_unicode:
- * @p a pointer to Unicode character encoded as UTF-8
+ * \param p a pointer to Unicode character encoded as UTF-8
  *
  * Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
- * If @p does not point to a valid UTF-8 encoded character, results are
+ * If \a p does not point to a valid UTF-8 encoded character, results are
  * undefined. If you are not sure that the bytes are complete
  * valid Unicode characters, you should use g_utf8_get_char_validated()
  * instead.
@@ -365,7 +410,7 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
 	unsigned int result;
 	unsigned char c = (unsigned char) *p;
 
-	UTF8_COMPUTE (c, mask, len);
+	UTF8_COMPUTE (c, mask, len, -1);
 	if (len == -1)
 		return BLI_UTF8_ERR;
 	UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
@@ -374,13 +419,13 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
 }
 
 /* variant that increments the length */
-unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
+unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index)
 {
 	int i, mask = 0, len;
 	unsigned int result;
 	unsigned char c = (unsigned char) *p;
 
-	UTF8_COMPUTE (c, mask, len);
+	UTF8_COMPUTE (c, mask, len, -1);
 	if (len == -1)
 		return BLI_UTF8_ERR;
 	UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
@@ -390,20 +435,20 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
 
 /* another variant that steps over the index,
  * note, currently this also falls back to latin1 for text drawing. */
-unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
+unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index)
 {
 	int i, mask = 0, len;
 	unsigned int result;
 	unsigned char c;
 
 	p += *index;
-	c= (unsigned char) *p;
+	c = (unsigned char) *p;
 
-	UTF8_COMPUTE (c, mask, len);
+	UTF8_COMPUTE (c, mask, len, -1);
 	if (len == -1) {
 		/* when called with NULL end, result will never be NULL,
 		 * checks for a NULL character */
-		char *p_next= BLI_str_find_next_char_utf8(p, NULL);
+		char *p_next = BLI_str_find_next_char_utf8(p, NULL);
 		/* will never return the same pointer unless '\0',
 		 * eternal loop is prevented */
 		*index += (size_t)(p_next - p);
@@ -420,8 +465,8 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
 	 * characters */
 	UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
 	if (result == BLI_UTF8_ERR) {
-		len= 1;
-		result= *p;
+		len = 1;
+		result = *p;
 	}
 	/* end warning! */
 #else
@@ -491,14 +536,14 @@ size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf)
 /* was g_utf8_find_prev_char */
 /**
  * BLI_str_find_prev_char_utf8:
- * @str: pointer to the beginning of a UTF-8 encoded string
- * @p pointer to some position within @str
+ * \param str pointer to the beginning of a UTF-8 encoded string
+ * \param p pointer to some position within \a str
  *
- * Given a position @p with a UTF-8 encoded string @str, find the start
- * of the previous UTF-8 character starting before. @p Returns %NULL if no
- * UTF-8 characters are present in @str before @p
+ * Given a position \a p with a UTF-8 encoded string \a str, find the start
+ * of the previous UTF-8 character starting before. \a p Returns %NULL if no
+ * UTF-8 characters are present in \a str before \a p
  *
- * @p does not have to be at the beginning of a UTF-8 character. No check
+ * \a p does not have to be at the beginning of a UTF-8 character. No check
  * is made to see if the character found is actually valid other than
  * it starts with an appropriate byte.
  *
@@ -517,13 +562,13 @@ char * BLI_str_find_prev_char_utf8(const char *str, const char *p)
 /* was g_utf8_find_next_char */
 /**
  * BLI_str_find_next_char_utf8:
- * @p a pointer to a position within a UTF-8 encoded string
- * @end a pointer to the byte following the end of the string,
+ * \param p a pointer to a position within a UTF-8 encoded string
+ * \param end a pointer to the byte following the end of the string,
  * or %NULL to indicate that the string is nul-terminated.
  *
- * Finds the start of the next UTF-8 character in the string after @p
+ * Finds the start of the next UTF-8 character in the string after \a p
  *
- * @p does not have to be at the beginning of a UTF-8 character. No check
+ * \a p does not have to be at the beginning of a UTF-8 character. No check
  * is made to see if the character found is actually valid other than
  * it starts with an appropriate byte.
  *
@@ -549,13 +594,13 @@ char *BLI_str_find_next_char_utf8(const char *p, const char *end)
 /* was g_utf8_prev_char */
 /**
  * BLI_str_prev_char_utf8:
- * @p a pointer to a position within a UTF-8 encoded string
+ * \param p a pointer to a position within a UTF-8 encoded string
  *
- * Finds the previous UTF-8 character in the string before @p
+ * Finds the previous UTF-8 character in the string before \a p
  *
- * @p does not have to be at the beginning of a UTF-8 character. No check
+ * \a p does not have to be at the beginning of a UTF-8 character. No check
  * is made to see if the character found is actually valid other than
- * it starts with an appropriate byte. If @p might be the first
+ * it starts with an appropriate byte. If \a p might be the first
  * character of the string, you must use g_utf8_find_prev_char() instead.
  *
  * Return value: a pointer to the found character.
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 66527b9..146e1d5 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -400,6 +400,42 @@ void BLI_mutex_end(ThreadMutex *mutex)
 	pthread_mutex_destroy(mutex);
 }
 
+/* Spin Locks */
+
+void BLI_spin_init(SpinLock *spin)
+{
+#ifdef __APPLE__
+	*spin = OS_SPINLOCK_INIT;
+#else
+	pthread_spin_init(spin, 0);
+#endif
+}
+
+void BLI_spin_lock(SpinLock *spin)
+{
+#ifdef __APPLE__
+	OSSpinLockLock(spin);
+#else
+	pthread_spin_lock(spin);
+#endif
+}
+
+void BLI_spin_unlock(SpinLock *spin)
+{
+#ifdef __APPLE__
+	OSSpinLockUnlock(spin);
+#else
+	pthread_spin_unlock(spin);
+#endif
+}
+
+void BLI_spin_end(SpinLock *spin)
+{
+#ifndef __APPLE__
+	pthread_spin_destroy(spin);
+#endif
+}
+
 /* Read/Write Mutex Lock */
 
 void BLI_rw_mutex_init(ThreadRWMutex *mutex)
diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c
index bf9720f..078fc2c 100644
--- a/source/blender/blenlib/intern/time.c
+++ b/source/blender/blenlib/intern/time.c
@@ -44,7 +44,7 @@ double PIL_check_seconds_timer(void)
 		__int64 ifreq;
 		hasperfcounter = QueryPerformanceFrequency((LARGE_INTEGER *) &ifreq);
 		perffreq = (double) ifreq;
-	} 
+	}
 
 	if (hasperfcounter) {
 		__int64 count;
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 3030e54..601b07c 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -39,7 +39,7 @@
 #include "BLI_voronoi.h"
 #include "BLI_utildefines.h"
 
-#define VORONOI_EPS 1e-2
+#define VORONOI_EPS 1e-2f
 
 enum {
 	voronoiEventType_Site = 0,
@@ -259,9 +259,9 @@ static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, f
 	x2 = (-b - sqrtf(disc)) / (2 * a);
 
 	if (p[1] < r[1])
-		ry = maxf(x1, x2);
+		ry = max_ff(x1, x2);
 	else
-		ry = minf(x1, x2);
+		ry = min_ff(x1, x2);
 
 	return ry;
 }
@@ -490,9 +490,9 @@ static void voronoi_finishEdge(VoronoiProcess *process, VoronoiParabola *parabol
 	}
 
 	if (parabola->edge->direction[0] > 0.0f)
-		mx = MAX2(process->width, parabola->edge->start[0] + 10);
+		mx = max_ff(process->width, parabola->edge->start[0] + 10);
 	else
-		mx = MIN2(0.0, parabola->edge->start[0] - 10);
+		mx = min_ff(0.0f, parabola->edge->start[0] - 10.0f);
 
 	parabola->edge->end[0] = mx;
 	parabola->edge->end[1] = mx * parabola->edge->f + parabola->edge->g;
@@ -609,9 +609,9 @@ static int voronoi_getNextSideCoord(ListBase *edges, float coord[2], int dim, in
 static void voronoi_createBoundaryEdges(ListBase *edges, int width, int height)
 {
 	const float corners[4][2] = {{width - 1, 0.0f},
-								 {width - 1, height - 1},
-								 {0.0f, height - 1},
-								 {0.0f, 0.0f}};
+	                             {width - 1, height - 1},
+	                             {0.0f, height - 1},
+	                             {0.0f, 0.0f}};
 	int i, dim = 0, dir = 1;
 
 	float coord[2] = {0.0f, 0.0f};
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index bc775cb..5d58f9e 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -117,19 +117,19 @@ float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float c
 		const int zc[3] = {res[0] * res[1] * _clamp(z - 1, 0, res[2] - 1), res[0] * res[1] * _clamp(z, 0, res[2] - 1), res[0] * res[1] * _clamp(z + 1, 0, res[2] - 1)};
 
 		const float dx = xf - (float)x, dy = yf - (float)y, dz = zf - (float)z;
-		const float u[3] = {dx*(0.5f*dx - 1.f) + 0.5f, dx*(1.f - dx) + 0.5f, 0.5f*dx*dx};
-		const float v[3] = {dy*(0.5f*dy - 1.f) + 0.5f, dy*(1.f - dy) + 0.5f, 0.5f*dy*dy};
-		const float w[3] = {dz*(0.5f*dz - 1.f) + 0.5f, dz*(1.f - dz) + 0.5f, 0.5f*dz*dz};
+		const float u[3] = {dx * (0.5f * dx - 1.f) + 0.5f, dx * (1.0f - dx) + 0.5f, 0.5f * dx * dx};
+		const float v[3] = {dy * (0.5f * dy - 1.f) + 0.5f, dy * (1.0f - dy) + 0.5f, 0.5f * dy * dy};
+		const float w[3] = {dz * (0.5f * dz - 1.f) + 0.5f, dz * (1.0f - dz) + 0.5f, 0.5f * dz * dz};
 
 		return w[0] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] + u[2] * data[xc[2] + yc[0] + zc[0]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] ) )
-			 + w[1] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] ) )
-			 + w[2] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] ) );
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] ) )
+		     + w[1] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] )
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] ) )
+		     + w[2] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] )
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] ) );
 
 	}
 	return 0.f;
@@ -179,21 +179,21 @@ float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3]
 		}
 
 		return w[0] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] + u[2] * data[xc[2] + yc[0] + zc[0]] + u[3] * data[xc[3] + yc[0] + zc[0]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] + u[3] * data[xc[3] + yc[1] + zc[0]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] + u[3] * data[xc[3] + yc[2] + zc[0]] )
-						+ v[3] * ( u[0] * data[xc[0] + yc[3] + zc[0]] + u[1] * data[xc[1] + yc[3] + zc[0]] + u[2] * data[xc[2] + yc[3] + zc[0]] + u[3] * data[xc[3] + yc[3] + zc[0]] ) )
-			 + w[1] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] + u[3] * data[xc[3] + yc[0] + zc[1]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] + u[3] * data[xc[3] + yc[1] + zc[1]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] + u[3] * data[xc[3] + yc[2] + zc[1]] )
-						+ v[3] * ( u[0] * data[xc[0] + yc[3] + zc[1]] + u[1] * data[xc[1] + yc[3] + zc[1]] + u[2] * data[xc[2] + yc[3] + zc[1]] + u[3] * data[xc[3] + yc[3] + zc[1]] ) )
-			 + w[2] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] + u[3] * data[xc[3] + yc[0] + zc[2]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] + u[3] * data[xc[3] + yc[1] + zc[2]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] + u[3] * data[xc[3] + yc[2] + zc[2]] )
-						+ v[3] * ( u[0] * data[xc[0] + yc[3] + zc[2]] + u[1] * data[xc[1] + yc[3] + zc[2]] + u[2] * data[xc[2] + yc[3] + zc[2]] + u[3] * data[xc[3] + yc[3] + zc[2]] ) )
-			 + w[3] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[3]] + u[1] * data[xc[1] + yc[0] + zc[3]] + u[2] * data[xc[2] + yc[0] + zc[3]] + u[3] * data[xc[3] + yc[0] + zc[3]] )
-						+ v[1] * ( u[0] * data[xc[0] + yc[1] + zc[3]] + u[1] * data[xc[1] + yc[1] + zc[3]] + u[2] * data[xc[2] + yc[1] + zc[3]] + u[3] * data[xc[3] + yc[1] + zc[3]] )
-						+ v[2] * ( u[0] * data[xc[0] + yc[2] + zc[3]] + u[1] * data[xc[1] + yc[2] + zc[3]] + u[2] * data[xc[2] + yc[2] + zc[3]] + u[3] * data[xc[3] + yc[2] + zc[3]] )
-						+ v[3] * ( u[0] * data[xc[0] + yc[3] + zc[3]] + u[1] * data[xc[1] + yc[3] + zc[3]] + u[2] * data[xc[2] + yc[3] + zc[3]] + u[3] * data[xc[3] + yc[3] + zc[3]] ) );
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] + u[3] * data[xc[3] + yc[1] + zc[0]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] + u[3] * data[xc[3] + yc[2] + zc[0]] )
+		                + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[0]] + u[1] * data[xc[1] + yc[3] + zc[0]] + u[2] * data[xc[2] + yc[3] + zc[0]] + u[3] * data[xc[3] + yc[3] + zc[0]] ) )
+		     + w[1] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] + u[3] * data[xc[3] + yc[0] + zc[1]] )
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] + u[3] * data[xc[3] + yc[1] + zc[1]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] + u[3] * data[xc[3] + yc[2] + zc[1]] )
+		                + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[1]] + u[1] * data[xc[1] + yc[3] + zc[1]] + u[2] * data[xc[2] + yc[3] + zc[1]] + u[3] * data[xc[3] + yc[3] + zc[1]] ) )
+		     + w[2] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] + u[3] * data[xc[3] + yc[0] + zc[2]] )
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] + u[3] * data[xc[3] + yc[1] + zc[2]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] + u[3] * data[xc[3] + yc[2] + zc[2]] )
+		                + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[2]] + u[1] * data[xc[1] + yc[3] + zc[2]] + u[2] * data[xc[2] + yc[3] + zc[2]] + u[3] * data[xc[3] + yc[3] + zc[2]] ) )
+		     + w[3] * (   v[0] * ( u[0] * data[xc[0] + yc[0] + zc[3]] + u[1] * data[xc[1] + yc[0] + zc[3]] + u[2] * data[xc[2] + yc[0] + zc[3]] + u[3] * data[xc[3] + yc[0] + zc[3]] )
+		                + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[3]] + u[1] * data[xc[1] + yc[1] + zc[3]] + u[2] * data[xc[2] + yc[1] + zc[3]] + u[3] * data[xc[3] + yc[1] + zc[3]] )
+		                + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[3]] + u[1] * data[xc[1] + yc[2] + zc[3]] + u[2] * data[xc[2] + yc[2] + zc[3]] + u[3] * data[xc[3] + yc[2] + zc[3]] )
+		                + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[3]] + u[1] * data[xc[1] + yc[3] + zc[3]] + u[2] * data[xc[2] + yc[3] + zc[3]] + u[3] * data[xc[3] + yc[3] + zc[3]] ) );
 
 	}
 	return 0.f;
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index a0b31f8..68d9d74 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -293,7 +293,7 @@ void get_default_root(char *root)
 					root[3] = '\0';
 					if (GetFileAttributes(root) != 0xFFFFFFFF) {
 						rc = i;
-						break;			
+						break;
 					}
 				}
 			}
@@ -304,7 +304,7 @@ void get_default_root(char *root)
 				root[2] = '\\';
 				root[3] = '\0';
 			}
-		}		
+		}
 	}
 }
 
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 74df521..3c5812f 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -25,6 +25,7 @@
 
 set(INC 
 	.
+	../blenfont
 	../blenkernel
 	../blenlib
 	../makesdna
@@ -62,4 +63,8 @@ if(WITH_BUILDINFO)
 	add_definitions(-DWITH_BUILDINFO)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index 20b5607..49e8869 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -3,7 +3,7 @@ Import ('env')
 
 sources = env.Glob('intern/*.c')
 
-incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
+incs = '. #/intern/guardedalloc ../blenfont ../blenlib ../blenkernel'
 incs += ' ../makesdna ../editors/include'
 incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh ../imbuf'
 
@@ -11,6 +11,9 @@ incs += ' ' + env['BF_ZLIB_INC']
 
 defs = []
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30]) #, cc_compileflags=['/WX'] )
 else:
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index e917ccd..e9caa33 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -175,7 +175,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 		else if (bhead->code == DATA) {
 			if (looking) {
 				if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) {
-					prv = BLO_library_read_struct(fd, bhead, "PreviewImage");	
+					prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
 					if (prv) {
 						memcpy(new_prv, prv, sizeof(PreviewImage));
 						if (prv->rect[0]) {
@@ -183,7 +183,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							new_prv->rect[0] = MEM_callocN(new_prv->w[0] * new_prv->h[0] * sizeof(unsigned int), "prvrect");
 							bhead = blo_nextbhead(fd, bhead);
 							rect = (unsigned int *)(bhead + 1);
-							memcpy(new_prv->rect[0], rect, bhead->len);					
+							memcpy(new_prv->rect[0], rect, bhead->len);
 						}
 						else {
 							new_prv->rect[0] = NULL;
@@ -194,7 +194,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							new_prv->rect[1] = MEM_callocN(new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int), "prvrect");
 							bhead = blo_nextbhead(fd, bhead);
 							rect = (unsigned int *)(bhead + 1);
-							memcpy(new_prv->rect[1], rect, bhead->len);							
+							memcpy(new_prv->rect[1], rect, bhead->len);
 						}
 						else {
 							new_prv->rect[1] = NULL;
@@ -265,10 +265,10 @@ BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports)
 	if (fd) {
 		fd->reports = reports;
 		bfd = blo_read_file_internal(fd, filepath);
-		blo_freefiledata(fd);			
+		blo_freefiledata(fd);
 	}
 
-	return bfd;	
+	return bfd;
 }
 
 BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports)
@@ -280,10 +280,10 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports)
 	if (fd) {
 		fd->reports = reports;
 		bfd = blo_read_file_internal(fd, "");
-		blo_freefiledata(fd);			
+		blo_freefiledata(fd);
 	}
 
-	return bfd;	
+	return bfd;
 }
 
 BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFile *memfile, ReportList *reports)
@@ -332,10 +332,10 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
 		}
 		blo_join_main(&mainlist);
 		
-		blo_freefiledata(fd);			
+		blo_freefiledata(fd);
 	}
 
-	return bfd;	
+	return bfd;
 }
 
 void BLO_blendfiledata_free(BlendFileData *bfd)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 606fd48..203af1d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -105,6 +105,8 @@
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_anim.h"
 #include "BKE_action.h"
 #include "BKE_armature.h"
@@ -358,36 +360,39 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
 }
 
 /* for libdata, nr has ID code, no increment */
-static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib) 
+static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib)
 {
-	int i;
-	
-	if (addr == NULL) return NULL;
-	
+	if (addr == NULL) {
+		return NULL;
+	}
+
 	/* lasthit works fine for non-libdata, linking there is done in same sequence as writing */
 	if (onm->sorted) {
 		OldNew entry_s, *entry;
-		
+
 		entry_s.old = addr;
-		
+
 		entry = bsearch(&entry_s, onm->entries, onm->nentries, sizeof(OldNew), verg_oldnewmap);
 		if (entry) {
 			ID *id = entry->newp;
-			
+
 			if (id && (!lib || id->lib)) {
-				return entry->newp;
+				return id;
 			}
 		}
 	}
-	
-	for (i = 0; i < onm->nentries; i++) {
-		OldNew *entry = &onm->entries[i];
-		
-		if (entry->old == addr) {
-			ID *id = entry->newp;
-			
-			if (id && (!lib || id->lib)) {
-				return entry->newp;
+	else {
+		/* note, this can be a bottle neck when loading some files */
+		unsigned int nentries = (unsigned int)onm->nentries;
+		unsigned int i;
+		OldNew *entry;
+
+		for (i = 0, entry = onm->entries; i < nentries; i++, entry++) {
+			if (entry->old == addr) {
+				ID *id = id = entry->newp;
+				if (id && (!lib || id->lib)) {
+					return id;
+				}
 			}
 		}
 	}
@@ -816,7 +821,7 @@ static void decode_blender_header(FileData *fd)
 			/* is the file saved in a different endian
 			 * than we need ?
 			 */
-			if (((((char*)&remove_this_endian_test)[0]==1)?L_ENDIAN:B_ENDIAN) != ((header[8]=='v')?L_ENDIAN:B_ENDIAN)) {
+			if (((((char *)&remove_this_endian_test)[0] == 1) ? L_ENDIAN : B_ENDIAN) != ((header[8] == 'v') ? L_ENDIAN : B_ENDIAN)) {
 				fd->flags |= FD_FLAGS_SWITCH_ENDIAN;
 			}
 			
@@ -938,7 +943,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
 			if (chunkoffset+readsize > chunk->size)
 				readsize= chunk->size-chunkoffset;
 			
-			memcpy((char*)buffer + totread, chunk->buf + chunkoffset, readsize);
+			memcpy((char *)buffer + totread, chunk->buf + chunkoffset, readsize);
 			totread += readsize;
 			filedata->seek += readsize;
 			seek += readsize;
@@ -976,13 +981,13 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
 	
 	if (fd->flags & FD_FLAGS_FILE_OK) {
 		if (!read_file_dna(fd)) {
-			BKE_reportf(reports, RPT_ERROR, "Failed to read blend file: \"%s\", incomplete", fd->relabase);
+			BKE_reportf(reports, RPT_ERROR, "Failed to read blend file '%s', incomplete", fd->relabase);
 			blo_freefiledata(fd);
 			fd = NULL;
 		}
-	} 
+	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Failed to read blend file: \"%s\", not a blend file", fd->relabase);
+		BKE_reportf(reports, RPT_ERROR, "Failed to read blend file '%s', not a blend file", fd->relabase);
 		blo_freefiledata(fd);
 		fd = NULL;
 	}
@@ -999,7 +1004,8 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
 	gzfile = BLI_gzopen(filepath, "rb");
 	
 	if (gzfile == (gzFile)Z_NULL) {
-		BKE_reportf(reports, RPT_WARNING, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file");
+		BKE_reportf(reports, RPT_WARNING, "Unable to open '%s': %s",
+		            filepath, errno ? strerror(errno) : TIP_("unknown error reading file"));
 		return NULL;
 	}
 	else {
@@ -1017,7 +1023,7 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
 FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports)
 {
 	if (!mem || memsize<SIZEOFBLENDERHEADER) {
-		BKE_report(reports, RPT_WARNING, (mem)? "Unable to read": "Unable to open");
+		BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read"): TIP_("Unable to open"));
 		return NULL;
 	}
 	else {
@@ -1126,7 +1132,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 		/* the last part of the dir is a .blend file, no group follows */
 		*fd = '/'; /* put back the removed slash separating the dir and the .blend file name */
 	}
-	else {		
+	else {
 		char *gp = fd + 1; // in case we have a .blend file, gp points to the group
 		
 		/* Find the last slash */
@@ -1290,6 +1296,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
 			if (NULL == newimaadr(fd, ibuf)) {	/* so was restored */
 				BLI_remlink(&ima->ibufs, ibuf);
 				ima->bindcode = 0;
+				ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
 				ima->gputexture = NULL;
 			}
 		}
@@ -1628,6 +1635,19 @@ static void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endi
 {
 }
 
+/* ************ READ ID *************** */
+
+static void direct_link_id(FileData *fd, ID *id)
+{
+	/*link direct data of ID properties*/
+	if (id->properties) {
+		id->properties = newdataadr(fd, id->properties);
+		if (id->properties) { /* this case means the data was written incorrectly, it should not happen */
+			IDP_DirectLinkProperty(id->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+		}
+	}
+}
+
 /* ************ READ CurveMapping *************** */
 
 /* cuma itself has been read! */
@@ -1821,7 +1841,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
 			
 			for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
 				DRIVER_TARGETS_LOOPER(dvar)
-				{	
+				{
 					/* only relink if still used */
 					if (tarIndex < dvar->num_targets)
 						dtar->id = newlibadr(fd, id->lib, dtar->id); 
@@ -2389,6 +2409,8 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 	ntree->adt = newdataadr(fd, ntree->adt);
 	direct_link_animdata(fd, ntree->adt);
 	
+	ntree->id.flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
+
 	link_list(fd, &ntree->nodes);
 	for (node = ntree->nodes.first; node; node = node->next) {
 		node->typeinfo = NULL;
@@ -2396,6 +2418,14 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 		link_list(fd, &node->inputs);
 		link_list(fd, &node->outputs);
 		
+		link_list(fd, &node->internal_links);
+		for (link = node->internal_links.first; link; link = link->next) {
+			link->fromnode = newdataadr(fd, link->fromnode);
+			link->fromsock = newdataadr(fd, link->fromsock);
+			link->tonode = newdataadr(fd, link->tonode);
+			link->tosock = newdataadr(fd, link->tosock);
+		}
+		
 		if (node->type == CMP_NODE_MOVIEDISTORTION) {
 			node->storage = newmclipadr(fd, node->storage);
 		}
@@ -2404,8 +2434,18 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 		
 		if (node->storage) {
 			/* could be handlerized at some point */
-			if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
-				direct_link_curvemapping(fd, node->storage);
+			if (ntree->type==NTREE_SHADER) {
+				if (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB) {
+					direct_link_curvemapping(fd, node->storage);
+				}
+				else if (node->type==SH_NODE_SCRIPT) {
+					NodeShaderScript *nss = (NodeShaderScript *) node->storage;
+					nss->bytecode = newdataadr(fd, nss->bytecode);
+					nss->prop = newdataadr(fd, nss->prop);
+					if (nss->prop)
+						IDP_DirectLinkProperty(nss->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+				}
+			}
 			else if (ntree->type==NTREE_COMPOSIT) {
 				if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
 					direct_link_curvemapping(fd, node->storage);
@@ -2527,8 +2567,13 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
 				break;
 			case CONSTRAINT_TYPE_KINEMATIC:
 			{
+				bKinematicConstraint *data = con->data;
+
 				con->lin_error = 0.f;
 				con->rot_error = 0.f;
+
+				/* version patch for runtime flag, was not cleared in some case */
+				data->flag &= ~CONSTRAINT_IK_AUTO;
 			}
 			case CONSTRAINT_TYPE_CHILDOF:
 			{
@@ -2709,8 +2754,10 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
 		direct_link_curvemapping(fd, la->curfalloff);
 
 	la->nodetree= newdataadr(fd, la->nodetree);
-	if (la->nodetree)
+	if (la->nodetree) {
+		direct_link_id(fd, &la->nodetree->id);
 		direct_link_nodetree(fd, la->nodetree);
+	}
 	
 	la->preview = direct_link_preview_image(fd, la->preview);
 }
@@ -2773,7 +2820,7 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
 			
 			cp += 2;
 		}
-		data+= elemsize;
+		data += elemsize;
 	}
 }
 
@@ -2808,7 +2855,7 @@ static void lib_link_mball(FileData *fd, Main *main)
 			if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt);
 			
 			for (a = 0; a < mb->totcol; a++) 
-				mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]);
+				mb->mat[a] = newlibadr_us(fd, mb->id.lib, mb->mat[a]);
 			
 			mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX deprecated - old animation system
 			
@@ -2876,8 +2923,10 @@ static void direct_link_world(FileData *fd, World *wrld)
 	}
 	
 	wrld->nodetree = newdataadr(fd, wrld->nodetree);
-	if (wrld->nodetree)
+	if (wrld->nodetree) {
+		direct_link_id(fd, &wrld->nodetree->id);
 		direct_link_nodetree(fd, wrld->nodetree);
+	}
 	
 	wrld->preview = direct_link_preview_image(fd, wrld->preview);
 }
@@ -2936,7 +2985,6 @@ static void direct_link_text(FileData *fd, Text *text)
 #endif
 	
 	link_list(fd, &text->lines);
-	link_list(fd, &text->markers);
 	
 	text->curl = newdataadr(fd, text->curl);
 	text->sell = newdataadr(fd, text->sell);
@@ -2996,10 +3044,11 @@ static void direct_link_image(FileData *fd, Image *ima)
 		link_ibuf_list(fd, &ima->ibufs);
 	else
 		ima->ibufs.first = ima->ibufs.last = NULL;
-	
+
 	/* if not restored, we keep the binded opengl index */
 	if (ima->ibufs.first == NULL) {
 		ima->bindcode = 0;
+		ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
 		ima->gputexture = NULL;
 	}
 	
@@ -3043,7 +3092,7 @@ static void lib_link_curve(FileData *fd, Main *main)
 			cu->taperobj = newlibadr(fd, cu->id.lib, cu->taperobj);
 			cu->textoncurve = newlibadr(fd, cu->id.lib, cu->textoncurve);
 			cu->vfont = newlibadr_us(fd, cu->id.lib, cu->vfont);
-			cu->vfontb = newlibadr_us(fd, cu->id.lib, cu->vfontb);			
+			cu->vfontb = newlibadr_us(fd, cu->id.lib, cu->vfontb);
 			cu->vfonti = newlibadr_us(fd, cu->id.lib, cu->vfonti);
 			cu->vfontbi = newlibadr_us(fd, cu->id.lib, cu->vfontbi);
 			
@@ -3077,7 +3126,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 	cu->mat = newdataadr(fd, cu->mat);
 	test_pointer_array(fd, (void **)&cu->mat);
 	cu->str = newdataadr(fd, cu->str);
-	cu->strinfo= newdataadr(fd, cu->strinfo);	
+	cu->strinfo= newdataadr(fd, cu->strinfo);
 	cu->tb = newdataadr(fd, cu->tb);
 
 	if (cu->vfont == NULL) link_list(fd, &(cu->nurb));
@@ -3088,14 +3137,14 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 		if (cu->tb) {
 			memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox));
 			MEM_freeN(cu->tb);
-			cu->tb = tb;			
+			cu->tb = tb;
 		}
 		else {
 			cu->totbox = 1;
 			cu->actbox = 1;
 			cu->tb = tb;
 			cu->tb[0].w = cu->linewidth;
-		}		
+		}
 		if (cu->wordspace == 0.0f) cu->wordspace = 1.0f;
 	}
 
@@ -3184,8 +3233,10 @@ static void direct_link_texture(FileData *fd, Tex *tex)
 	tex->ot = newdataadr(fd, tex->ot);
 	
 	tex->nodetree = newdataadr(fd, tex->nodetree);
-	if (tex->nodetree)
+	if (tex->nodetree) {
+		direct_link_id(fd, &tex->nodetree->id);
 		direct_link_nodetree(fd, tex->nodetree);
+	}
 	
 	tex->preview = direct_link_preview_image(fd, tex->preview);
 	
@@ -3244,8 +3295,10 @@ static void direct_link_material(FileData *fd, Material *ma)
 	ma->ramp_spec = newdataadr(fd, ma->ramp_spec);
 	
 	ma->nodetree = newdataadr(fd, ma->nodetree);
-	if (ma->nodetree)
+	if (ma->nodetree) {
+		direct_link_id(fd, &ma->nodetree->id);
 		direct_link_nodetree(fd, ma->nodetree);
+	}
 	
 	ma->preview = direct_link_preview_image(fd, ma->preview);
 	ma->gpumaterial.first = ma->gpumaterial.last = NULL;
@@ -3260,7 +3313,7 @@ static const char *ptcache_data_struct[] = {
 	"", // BPHYS_DATA_ROTATION
 	"", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
 	"", // BPHYS_DATA_SIZE:
-	"", // BPHYS_DATA_TIMES:	
+	"", // BPHYS_DATA_TIMES:
 	"BoidData" // case BPHYS_DATA_BOIDS:
 };
 static void direct_link_pointcache(FileData *fd, PointCache *cache)
@@ -3335,6 +3388,8 @@ static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
 {
 	if (pd && pd->tex)
 		pd->tex = newlibadr_us(fd, id->lib, pd->tex);
+	if (pd && pd->f_source)
+		pd->f_source = newlibadr_us(fd, id->lib, pd->f_source);
 }
 
 static void lib_link_particlesettings(FileData *fd, Main *main)
@@ -3363,32 +3418,31 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 			if (part->dupliweights.first && part->dup_group) {
 				int index_ok = 0;
 				/* check for old files without indices (all indexes 0) */
-				dw = part->dupliweights.first;
 				if (part->dupliweights.first == part->dupliweights.last) {
 					/* special case for only one object in the group */
 					index_ok = 1;
 				}
-				else { 
-					for (; dw; dw=dw->next) {
+				else {
+					for (dw = part->dupliweights.first; dw; dw = dw->next) {
 						if (dw->index > 0) {
 							index_ok = 1;
 							break;
 						}
 					}
 				}
-				
+
 				if (index_ok) {
 					/* if we have indexes, let's use them */
-					dw = part->dupliweights.first;
-					for (; dw; dw=dw->next) {
+					for (dw = part->dupliweights.first; dw; dw = dw->next) {
 						GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index);
-						dw->ob = go ? go->ob : NULL;
+						dw->ob = go ? newlibadr(fd, part->id.lib, dw->ob) : NULL;
 					}
 				}
 				else {
 					/* otherwise try to get objects from own library (won't work on library linked groups) */
-					for (; dw; dw=dw->next)
+					for (dw = part->dupliweights.first; dw; dw = dw->next) {
 						dw->ob = newlibadr(fd, part->id.lib, dw->ob);
+					}
 				}
 			}
 			else {
@@ -3605,7 +3659,7 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
 
 static void lib_link_customdata_mtface(FileData *fd, Mesh *me, CustomData *fdata, int totface)
 {
-	int i;	
+	int i;
 	for (i = 0; i < fdata->totlayer; i++) {
 		CustomDataLayer *layer = &fdata->layers[i];
 		
@@ -3624,12 +3678,13 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata
 		
 		if (layer->type == CD_MTEXPOLY) {
 			MTexPoly *tf= layer->data;
-			int i;
+			int j;
 			
-			for (i = 0; i < totface; i++, tf++) {
+			for (j = 0; j < totface; j++, tf++) {
 				tf->tpage = newlibadr(fd, me->id.lib, tf->tpage);
-				if (tf->tpage && tf->tpage->id.us==0)
+				if (tf->tpage && tf->tpage->id.us == 0) {
 					tf->tpage->id.us = 1;
+				}
 			}
 		}
 	}
@@ -3688,7 +3743,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
 			/*
 			 * Re-tessellate, even if the polys were just created from tessfaces, this
 			 * is important because it:
-			 *  - fill the CD_POLYINDEX layer
+			 *  - fill the CD_ORIGINDEX layer
 			 *  - gives consistency of tessface between loading from a file and
 			 *    converting an edited BMesh back into a mesh (i.e. it replaces
 			 *    quad tessfaces in a loaded mesh immediately, instead of lazily
@@ -3783,7 +3838,7 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
 	/* annoying workaround for bug [#31079] loading legacy files with
 	 * no polygons _but_ have stale customdata */
 	if (UNLIKELY(count == 0 && data->layers == NULL && data->totlayer != 0)) {
-		memset(data, 0, sizeof(*data));
+		CustomData_reset(data);
 		return;
 	}
 	
@@ -4053,7 +4108,7 @@ static void lib_link_object(FileData *fd, Main *main)
 				if (paf->type == EFF_PARTICLE) {
 					paf->group = newlibadr_us(fd, ob->id.lib, paf->group);
 				}
-			}				
+			}
 			
 			for (sens = ob->sensors.first; sens; sens = sens->next) {
 				for (a = 0; a < sens->totlinks; a++)
@@ -4317,10 +4372,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 				if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
 					if (smd->domain->point_cache[1]) {
 						PointCache *cache = newdataadr(fd, smd->domain->point_cache[1]);
-						if (cache->flag & PTCACHE_FAKE_SMOKE)
-							; /* Smoke was already saved in "new format" and this cache is a fake one. */
-						else
+						if (cache->flag & PTCACHE_FAKE_SMOKE) {
+							/* Smoke was already saved in "new format" and this cache is a fake one. */
+						}
+						else {
 							printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n");
+						}
 						BKE_ptcache_free(cache);
 					}
 					smd->domain->ptcaches[1].first = NULL;
@@ -4333,6 +4390,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 				smd->coll = NULL;
 				smd->flow = newdataadr(fd, smd->flow);
 				smd->flow->smd = smd;
+				smd->flow->dm = NULL;
+				smd->flow->verts_old = NULL;
+				smd->flow->numverts = 0;
 				smd->flow->psys = newdataadr(fd, smd->flow->psys);
 			}
 			else if (smd->type == MOD_SMOKE_TYPE_COLL) {
@@ -4341,11 +4401,15 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 				smd->coll = newdataadr(fd, smd->coll);
 				if (smd->coll) {
 					smd->coll->smd = smd;
-					smd->coll->points = NULL;
-					smd->coll->numpoints = 0;
+					smd->coll->verts_old = NULL;
+					smd->coll->numverts = 0;
+					smd->coll->dm = NULL;
 				}
 				else {
 					smd->type = 0;
+					smd->flow = NULL;
+					smd->domain = NULL;
+					smd->coll = NULL;
 				}
 			}
 		}
@@ -4576,7 +4640,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 	direct_link_partdeflect(ob->pd);
 	ob->soft= newdataadr(fd, ob->soft);
 	if (ob->soft) {
-		SoftBody *sb = ob->soft;		
+		SoftBody *sb = ob->soft;
 		
 		sb->bpoint = NULL;	// init pointers so it gets rebuilt nicely
 		sb->bspring = NULL;
@@ -4753,8 +4817,7 @@ static void lib_link_scene(FileData *fd, Main *main)
 				base->object = newlibadr_us(fd, sce->id.lib, base->object);
 				
 				if (base->object == NULL) {
-					BKE_reportf_wrap(fd->reports, RPT_WARNING,
-					                 "LIB ERROR: Object lost from scene:'%s\'",
+					BKE_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB ERROR: object lost from scene: '%s'"),
 					                 sce->id.name + 2);
 					BLI_remlink(&sce->base, base);
 					if (base == sce->basact) sce->basact = NULL;
@@ -5020,7 +5083,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 					ed->seqbasep = (ListBase *)(poin+offset);
 				else
 					ed->seqbasep = &ed->seqbase;
-			}			
+			}
 			/* stack */
 			link_list(fd, &(ed->metastack));
 			
@@ -5054,7 +5117,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 	}
 	if (sce->r.ffcodecdata.properties) {
 		sce->r.ffcodecdata.properties = newdataadr(fd, sce->r.ffcodecdata.properties);
-		if (sce->r.ffcodecdata.properties) { 
+		if (sce->r.ffcodecdata.properties) {
 			IDP_DirectLinkProperty(sce->r.ffcodecdata.properties, 
 				(fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 		}
@@ -5065,8 +5128,10 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 	link_list(fd, &(sce->r.layers));
 	
 	sce->nodetree = newdataadr(fd, sce->nodetree);
-	if (sce->nodetree)
+	if (sce->nodetree) {
+		direct_link_id(fd, &sce->nodetree->id);
 		direct_link_nodetree(fd, sce->nodetree);
+	}
 
 	direct_link_view_settings(fd, &sce->view_settings);
 }
@@ -5980,11 +6045,11 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
 		if (newmain->curlib) {
 			if (BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) {
 				BKE_reportf_wrap(fd->reports, RPT_WARNING,
-				                 "Library '%s', '%s' had multiple instances, save and reload!",
+				                 TIP_("Library '%s', '%s' had multiple instances, save and reload!"),
 				                 lib->name, lib->filepath);
 				
 				change_idid_adr(fd->mainlist, fd, lib, newmain->curlib);
-//				change_idid_adr_fd(fd, lib, newmain->curlib);
+/*				change_idid_adr_fd(fd, lib, newmain->curlib); */
 				
 				BLI_remlink(&main->library, lib);
 				MEM_freeN(lib);
@@ -5998,8 +6063,10 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
 	BLI_strncpy(lib->filepath, lib->name, sizeof(lib->name));
 	cleanup_path(fd->relabase, lib->filepath);
 	
-//	printf("direct_link_library: name %s\n", lib->name);
-//	printf("direct_link_library: filename %s\n", lib->filename);
+#if 0
+	printf("direct_link_library: name %s\n", lib->name);
+	printf("direct_link_library: filename %s\n", lib->filename);
+#endif
 	
 	/* new main */
 	newmain= MEM_callocN(sizeof(Main), "directlink");
@@ -6436,6 +6503,8 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
 	bhead = read_data_into_oldnewmap(fd, bhead, allocname);
 	
 	/* init pointers direct data */
+	direct_link_id(fd, id);
+	
 	switch (GS(id->name)) {
 		case ID_WM:
 			direct_link_windowmanager(fd, (wmWindowManager *)id);
@@ -6532,14 +6601,6 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
 			break;
 	}
 	
-	/*link direct data of ID properties*/
-	if (id->properties) {
-		id->properties = newdataadr(fd, id->properties);
-		if (id->properties) { /* this case means the data was written incorrectly, it should not happen */
-			IDP_DirectLinkProperty(id->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-		}
-	}
-	
 	oldnewmap_free_unused(fd->datamap);
 	oldnewmap_clear(fd->datamap);
 	
@@ -6602,7 +6663,7 @@ void convert_tface_mt(FileData *fd, Main *main)
 		G.main = main;
 		
 		if (!(do_version_tface(main, 1))) {
-			BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console");
+			BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem (see error in console)");
 		}
 		
 		//XXX hack, material.c uses G.main allover the place, instead of main
@@ -6775,7 +6836,6 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
 static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
 {
 	bNode *node;
-	bNodeSocket *sock;
 	
 	for (node = ntree->nodes.first; node; node = node->next) {
 		if (node->type == CMP_NODE_OUTPUT_FILE) {
@@ -6852,6 +6912,7 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
 		}
 		else if (node->type==CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
 			NodeImageMultiFile *nimf = node->storage;
+			bNodeSocket *sock;
 			
 			/* CMP_NODE_OUTPUT_MULTI_FILE has been redeclared as CMP_NODE_OUTPUT_FILE */
 			node->type = CMP_NODE_OUTPUT_FILE;
@@ -7005,6 +7066,20 @@ static void do_version_ntree_dilateerode_264(void *UNUSED(data), ID *UNUSED(id),
 	}
 }
 
+static void do_version_ntree_defocus_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+	bNode *node;
+
+	for (node = ntree->nodes.first; node; node = node->next) {
+		if (node->type == CMP_NODE_DEFOCUS) {
+			NodeDefocus *data = node->storage;
+			if (data->maxblur == 0.0f) {
+				data->maxblur = 16.0f;
+			}
+		}
+	}
+}
+
 static void do_version_ntree_mask_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
 {
 	bNode *node;
@@ -7047,6 +7122,88 @@ static void do_version_ntree_tex_coord_from_dupli_264(void *UNUSED(data), ID *UN
 			node->flag |= NODE_OPTIONS;
 }
 
+static void do_version_node_cleanup_dynamic_sockets_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+	bNode *node;
+	bNodeSocket *sock;
+	
+	for (node = ntree->nodes.first; node; node = node->next) {
+		if (!ELEM(node->type, NODE_GROUP, CMP_NODE_IMAGE)) {
+			for (sock = node->inputs.first; sock; sock = sock->next)
+				sock->flag &= ~SOCK_DYNAMIC;
+			for (sock = node->outputs.first; sock; sock = sock->next)
+				sock->flag &= ~SOCK_DYNAMIC;
+		}
+	}
+}
+
+static void do_version_node_fix_internal_links_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+	bNode *node;
+	bNodeLink *link, *nextlink;
+	
+	for (node = ntree->nodes.first; node; node = node->next) {
+		for (link = node->internal_links.first; link; link = nextlink) {
+			nextlink = link->next;
+			if (!link->fromnode || !link->fromsock || !link->tonode || !link->tosock) {
+				BLI_remlink(&node->internal_links, link);
+			}
+		}
+	}
+}
+	
+static void do_version_logic_264(ListBase *regionbase)
+{
+	ARegion *ar;
+	
+	/* view settings for logic changed */
+	for (ar = regionbase->first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			if (ar->v2d.keeptot == 0) {
+				ar->v2d.maxzoom = 1.5f;
+				
+				ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT;
+				ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+				ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X;
+				ar->v2d.keepofs = V2D_KEEPOFS_Y;
+			}
+		}
+	}
+	
+
+}
+
+static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
+{
+	int i;
+
+	for (i = 0; i < track->markersnr; i++) {
+		MovieTrackingMarker *marker = &track->markers[i];
+
+		if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
+		    is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3]))
+			{
+				marker->pattern_corners[0][0] = track->pat_min[0];
+				marker->pattern_corners[0][1] = track->pat_min[1];
+
+				marker->pattern_corners[1][0] = track->pat_max[0];
+				marker->pattern_corners[1][1] = track->pat_min[1];
+
+				marker->pattern_corners[2][0] = track->pat_max[0];
+				marker->pattern_corners[2][1] = track->pat_max[1];
+
+				marker->pattern_corners[3][0] = track->pat_min[0];
+				marker->pattern_corners[3][1] = track->pat_max[1];
+			}
+
+		if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
+			copy_v2_v2(marker->search_min, track->search_min);
+			copy_v2_v2(marker->search_max, track->search_max);
+		}
+	}
+}
+
+
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
 	/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7160,9 +7317,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 								v3d->bundle_drawtype = OB_PLAINAXES;
 						}
 						else if (sl->spacetype == SPACE_CLIP) {
-							SpaceClip *sc = (SpaceClip *)sl;
-							if (sc->scopes.track_preview_height == 0)
-								sc->scopes.track_preview_height = 120;
+							SpaceClip *sclip = (SpaceClip *)sl;
+							if (sclip->scopes.track_preview_height == 0)
+								sclip->scopes.track_preview_height = 120;
 						}
 					}
 				}
@@ -7242,10 +7399,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					if ( (ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
 					     (ob->size[i]  == 0.0f))   /* cant scale the dsize to give a non zero result, so fallback to 1.0f */
 					{
-						ob->dscale[i]= 1.0f;
+						ob->dscale[i] = 1.0f;
 					}
 					else {
-						ob->dscale[i]= (ob->size[i] + ob->dsize[i]) / ob->size[i];
+						ob->dscale[i] = (ob->size[i] + ob->dsize[i]) / ob->size[i];
 					}
 				}
 			}
@@ -7370,8 +7527,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					prop = BKE_bproperty_object_get(ob, "Text");
 					if (prop) {
 						BKE_reportf_wrap(fd->reports, RPT_WARNING,
-						                 "Game property name conflict in object: \"%s\".\nText objects reserve the "
-						                 "[\"Text\"] game property to change their content through Logic Bricks.",
+						                 TIP_("Game property name conflict in object '%s':\ntext objects reserve the "
+						                      "['Text'] game property to change their content through logic bricks"),
 						                 ob->id.name + 2);
 					}
 				}
@@ -7564,13 +7721,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if (main->versionfile < 263) {
 		/* Default for old files is to save particle rotations to pointcache */
 		ParticleSettings *part;
-		for (part = main->particle.first; part; part = part->id.next)
+		for (part = main->particle.first; part; part = part->id.next) {
 			part->flag |= PART_ROTATIONS;
-		{
-			/* Default for old files is to save particle rotations to pointcache */
-			ParticleSettings *part;
-			for (part = main->particle.first; part; part = part->id.next)
-				part->flag |= PART_ROTATIONS;
 		}
 	}
 
@@ -7765,6 +7917,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 10)) {
 		{
 			Scene *scene;
+			bNodeTreeType *ntreetype;
 			// composite redesign
 			for (scene=main->scene.first; scene; scene=scene->id.next) {
 				if (scene->nodetree) {
@@ -7773,6 +7926,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					}
 				}
 			}
+			ntreetype = ntreeGetType(NTREE_COMPOSIT);
+	
+			if (ntreetype && ntreetype->foreach_nodetree)
+				ntreetype->foreach_nodetree(main, NULL, do_version_ntree_defocus_264);
+			
 		}
 
 		{
@@ -7814,32 +7972,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 			track = clip->tracking.tracks.first;
 			while (track) {
-				int i;
-
-				for (i = 0; i < track->markersnr; i++) {
-					MovieTrackingMarker *marker = &track->markers[i];
-
-					if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
-					    is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3]))
-					{
-						marker->pattern_corners[0][0] = track->pat_min[0];
-						marker->pattern_corners[0][1] = track->pat_min[1];
-
-						marker->pattern_corners[1][0] = track->pat_max[0];
-						marker->pattern_corners[1][1] = track->pat_min[1];
-
-						marker->pattern_corners[2][0] = track->pat_max[0];
-						marker->pattern_corners[2][1] = track->pat_max[1];
-
-						marker->pattern_corners[3][0] = track->pat_min[0];
-						marker->pattern_corners[3][1] = track->pat_max[1];
-					}
-
-					if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
-						copy_v2_v2(marker->search_min, track->search_min);
-						copy_v2_v2(marker->search_max, track->search_max);
-					}
-				}
+				do_versions_affine_tracker_track(track);
 
 				track = track->next;
 			}
@@ -7983,6 +8116,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			Mesh *me;
 			for (me = main->mesh.first; me; me = me->id.next) {
+				CustomData_update_typemap(&me->vdata);
 				CustomData_free_layers(&me->vdata, CD_MSTICKY, me->totvert);
 			}
 		}
@@ -8035,6 +8169,219 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 3)) {
+		/* smoke branch */
+		{
+			Object *ob;
+
+			for (ob = main->object.first; ob; ob = ob->id.next) {
+				ModifierData *md;
+				for (md = ob->modifiers.first; md; md = md->next) {
+					if (md->type == eModifierType_Smoke) {
+						SmokeModifierData *smd = (SmokeModifierData *)md;
+						if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
+							/* keep branch saves if possible */
+							if (!smd->domain->flame_max_temp) {
+								smd->domain->burning_rate = 0.75f;
+								smd->domain->flame_smoke = 1.0f;
+								smd->domain->flame_vorticity = 0.5f;
+								smd->domain->flame_ignition = 1.25f;
+								smd->domain->flame_max_temp = 1.75f;
+								smd->domain->adapt_threshold = 0.02f;
+								smd->domain->adapt_margin = 4;
+								smd->domain->flame_smoke_color[0] = 0.7f;
+								smd->domain->flame_smoke_color[1] = 0.7f;
+								smd->domain->flame_smoke_color[2] = 0.7f;
+							}
+						}
+						else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
+							if (!smd->flow->texture_size) {
+								smd->flow->fuel_amount = 1.0;
+								smd->flow->surface_distance = 1.5;
+								smd->flow->color[0] = 0.7f;
+								smd->flow->color[1] = 0.7f;
+								smd->flow->color[2] = 0.7f;
+								smd->flow->texture_size = 1.0f;
+							}
+						}
+					}
+				}
+			}
+		}
+
+		/* render border for viewport */
+		{
+			bScreen *sc;
+
+			for (sc = main->screen.first; sc; sc = sc->id.next) {
+				ScrArea *sa;
+				for (sa = sc->areabase.first; sa; sa = sa->next) {
+					SpaceLink *sl;
+					for (sl = sa->spacedata.first; sl; sl = sl->next) {
+						if (sl->spacetype == SPACE_VIEW3D) {
+							View3D *v3d = (View3D *)sl;
+							if (v3d->render_border.xmin == 0.0f && v3d->render_border.ymin == 0.0f &&
+							    v3d->render_border.xmax == 0.0f && v3d->render_border.ymax == 0.0f)
+							{
+								v3d->render_border.xmax = 1.0f;
+								v3d->render_border.ymax = 1.0f;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 4)) {
+		/* Fix for old node flags: Apparently the SOCK_DYNAMIC flag has been in use for other
+		 * purposes before and then removed and later reused for SOCK_DYNAMIC. This socket should
+		 * only be used by certain node types which don't use template lists, cleaning this up here.
+		 */
+		bNodeTreeType *ntreetype;
+		bNodeTree *ntree;
+		
+		ntreetype = ntreeGetType(NTREE_COMPOSIT);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+		ntreetype = ntreeGetType(NTREE_SHADER);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+		ntreetype = ntreeGetType(NTREE_TEXTURE);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+		
+		for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+			do_version_node_cleanup_dynamic_sockets_264(NULL, NULL, ntree);
+	}
+
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 5)) {
+		/* set a unwrapping margin and ABF by default */
+		Scene *scene;
+
+		for (scene=main->scene.first; scene; scene=scene->id.next) {
+			if (scene->toolsettings->uvcalc_margin == 0.0f) {
+				scene->toolsettings->uvcalc_margin = 0.001f;
+				scene->toolsettings->unwrapper = 0;
+			}
+		}
+	}
+
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 6)) {
+		/* Fix for bug #32982, internal_links list could get corrupted from r51630 onward.
+		 * Simply remove bad internal_links lists to avoid NULL pointers.
+		 */
+		bNodeTreeType *ntreetype;
+		bNodeTree *ntree;
+		
+		ntreetype = ntreeGetType(NTREE_COMPOSIT);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_internal_links_264);
+		ntreetype = ntreeGetType(NTREE_SHADER);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_internal_links_264);
+		ntreetype = ntreeGetType(NTREE_TEXTURE);
+		if (ntreetype && ntreetype->foreach_nodetree)
+			ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_internal_links_264);
+		
+		for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+			do_version_node_fix_internal_links_264(NULL, NULL, ntree);
+		
+	}
+	
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 6)) {
+		bScreen *sc;
+		
+		for (sc = main->screen.first; sc; sc = sc->id.next) {
+			ScrArea *sa;
+			for (sa = sc->areabase.first; sa; sa = sa->next) {
+				SpaceLink *sl;
+				if ( sa->spacetype == SPACE_LOGIC)
+					do_version_logic_264(&sa->regionbase);
+				
+				for (sl = sa->spacedata.first; sl; sl = sl->next) {
+					if (sl->spacetype == SPACE_LOGIC)
+						do_version_logic_264(&sl->regionbase);
+				}
+			}
+		}
+	}
+
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 7)) {
+		/* convert tiles size from resolution and number of tiles */
+		{
+			Scene *scene;
+
+			for (scene = main->scene.first; scene; scene = scene->id.next) {
+				if (scene->r.tilex == 0 || scene->r.tiley == 1) {
+					if (scene->r.xparts && scene->r.yparts) {
+						/* scene could be set for panoramic rendering, so clamp with the
+						 * lowest possible tile size value
+						 */
+						scene->r.tilex = max_ii(scene->r.xsch * scene->r.size / scene->r.xparts / 100, 8);
+						scene->r.tiley = max_ii(scene->r.ysch * scene->r.size / scene->r.yparts / 100, 8);
+					}
+					else {
+						/* happens when mixing using current trunk and previous release */
+						scene->r.tilex = scene->r.tiley = 64;
+					}
+				}
+			}
+		}
+
+		/* collision masks */
+		{
+			Object *ob;
+			for (ob = main->object.first; ob; ob = ob->id.next) {
+				if (ob->col_group == 0) {
+					ob->col_group = 0x01;
+					ob->col_mask = 0xff;
+				}
+			}
+		}
+
+		/* fallbck resection method settings */
+		{
+			MovieClip *clip;
+
+			for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+				if (clip->tracking.settings.reconstruction_success_threshold == 0.0f) {
+					clip->tracking.settings.reconstruction_success_threshold = 1e-3f;
+				}
+			}
+		}
+	}
+
+	if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 7)) {
+		MovieClip *clip;
+
+		for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+			MovieTrackingTrack *track;
+			MovieTrackingObject *object;
+
+			for (track = clip->tracking.tracks.first; track; track = track->next) {
+				do_versions_affine_tracker_track(track);
+			}
+
+			for (object = clip->tracking.objects.first; object; object = object->next) {
+				for (track = object->tracks.first; track; track = track->next) {
+					do_versions_affine_tracker_track(track);
+				}
+			}
+		}
+	}
+
+	if (main->versionfile < 265) {
+		Object *ob;
+		for (ob = main->object.first; ob; ob = ob->id.next) {
+			if (ob->step_height == 0.0f) {
+				ob->step_height = 0.15f;
+				ob->jump_speed = 10.0f;
+				ob->fall_speed = 55.0f;
+			}
+		}
+	}
+
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
 
@@ -8691,7 +9038,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
 	}
 	
 	expand_doit(fd, mainvar, cu->vfont);
-	expand_doit(fd, mainvar, cu->vfontb);	
+	expand_doit(fd, mainvar, cu->vfontb);
 	expand_doit(fd, mainvar, cu->vfonti);
 	expand_doit(fd, mainvar, cu->vfontbi);
 	expand_doit(fd, mainvar, cu->key);
@@ -9513,7 +9860,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
 	if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
 		blo_freefiledata(*fd);
 		*fd = NULL;
-	}	
+	}
 }
 
 void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag)
@@ -9568,8 +9915,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 				
 				if (fd == NULL) {
 					/* printf and reports for now... its important users know this */
-					BKE_reportf_wrap(basefd->reports, RPT_INFO,
-					                 "read library:  '%s', '%s'",
+					BKE_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read library:  '%s', '%s'"),
 					                 mainptr->curlib->filepath, mainptr->curlib->name);
 					
 					fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
@@ -9622,8 +9968,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 					else mainptr->curlib->filedata = NULL;
 					
 					if (fd == NULL) {
-						BKE_reportf_wrap(basefd->reports, RPT_WARNING,
-						                 "Can't find lib '%s'",
+						BKE_reportf_wrap(basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"),
 						                 mainptr->curlib->filepath);
 					}
 				}
@@ -9642,7 +9987,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 								append_id_part(fd, mainptr, id, &realid);
 								if (!realid) {
 									BKE_reportf_wrap(fd->reports, RPT_WARNING,
-									                 "LIB ERROR: %s:'%s' missing from '%s'",
+									                 TIP_("LIB ERROR: %s: '%s' missing from '%s'"),
 									                 BKE_idcode_to_name(GS(id->name)),
 									                 id->name+2, mainptr->curlib->filepath);
 								}
@@ -9674,7 +10019,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 				if (id->flag & LIB_READ) {
 					BLI_remlink(lbarray[a], id);
 					BKE_reportf_wrap(basefd->reports, RPT_WARNING,
-					                 "LIB ERROR: %s:'%s' unread libblock missing from '%s'",
+					                 TIP_("LIB ERROR: %s: '%s' unread lib block missing from '%s'"),
 					                 BKE_idcode_to_name(GS(id->name)), id->name + 2, mainptr->curlib->filepath);
 					change_idid_adr(mainlist, basefd, id, NULL);
 					
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index eaf725d..5d8a865 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -91,7 +91,7 @@ cleanup:
 	if (fd != -1)
 		close(fd);
 
-	return res;	
+	return res;
 }
 
 BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
@@ -104,7 +104,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
 	fd = BLI_open(path, O_BINARY | O_RDONLY, 0);
 
 	if (fd == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno));
+		BKE_reportf(reports, RPT_ERROR, "Unable to open '%s': %s", path, strerror(errno));
 		goto cleanup;
 	}
 	
@@ -115,18 +115,18 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
 	datastart = handle_read_msb_int(fd);
 
 	if (datastart == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (problem seeking)", path);
+		BKE_reportf(reports, RPT_ERROR, "Unable to read '%s' (problem seeking)", path);
 		goto cleanup;
 	}
 	else if (read(fd, buf, 8) != 8) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (truncated header)", path);
+		BKE_reportf(reports, RPT_ERROR, "Unable to read '%s' (truncated header)", path);
 		goto cleanup;
 	}
 	else if (memcmp(buf, "BRUNTIME", 8) != 0) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (not a blend file)", path);
+		BKE_reportf(reports, RPT_ERROR, "Unable to read '%s' (not a blend file)", path);
 		goto cleanup;
 	}
-	else {	
+	else {
 		//printf("starting to read runtime from %s at datastart %d\n", path, datastart);
 		lseek(fd, datastart, SEEK_SET);
 		bfd = blo_read_blendafterruntime(fd, path, actualsize - datastart, reports);
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index a3cfa44..1521739 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -32,7 +32,7 @@
 #include "zlib.h"
 
 #ifndef WIN32
-#  include <unistd.h> // for read close
+#  include <unistd.h>  /* for read close */
 #else
 #  include <io.h> // for open close read
 #  include "winsock2.h"
@@ -901,7 +901,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
 
 				ob->matbits = MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits");
 				for (a = 0; a < ob->totcol; a++)
-					ob->matbits[a] = ob->colbits & (1<<a);
+					ob->matbits[a] = (ob->colbits & (1<<a)) != 0;
 			}
 		}
 
@@ -1134,7 +1134,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
 		/* Add default gravity to scenes */
 		for (sce = main->scene.first; sce; sce = sce->id.next) {
 			if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
-			    len_v3(sce->physics_settings.gravity) == 0.0f)
+			    is_zero_v3(sce->physics_settings.gravity))
 			{
 				sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
 				sce->physics_settings.gravity[2] = -9.81f;
@@ -2062,7 +2062,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
 				{
 					brush->add_col[0] = 1.00f;
 					brush->add_col[1] = 0.39f;
- 					brush->add_col[2] = 0.39f;
+					brush->add_col[2] = 0.39f;
 				}
 
 				if (brush->sub_col[0] == 0 &&
@@ -2333,7 +2333,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
 		for (sc = main->screen.first; sc; sc = sc->id.next) {
 			if (sc->redraws_flag == 0) {
 				/* just initialize to default? */
-				// XXX: we could also have iterated through areas, and taken them from the first timeline available...
+				/* XXX: we could also have iterated through areas, and taken them from the first timeline available... */
 				sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
 			}
 		}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index d8333e7..8a56e3c 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1237,7 +1237,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
 					TFace *tf = &((TFace*) me->tface)[i];
 
 					for (j = 0; j < 4; j++) {
-						char *col = (char*) &tf->col[j];
+						char *col = (char *) &tf->col[j];
 
 						col[0] = 255;
 					}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 536376a..b010cae 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -197,7 +197,7 @@ static WriteData *writedata_new(int file)
 
 	if (wd == NULL) return NULL;
 
-	wd->sdna= DNA_sdna_from_data(DNAstr, DNAlen, 0);
+	wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
 
 	wd->file= file;
 
@@ -511,7 +511,7 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
 		writestruct(wd, DATA, "FCurve", 1, fcu);
 		
 		/* curve data */
-		if (fcu->bezt)  	
+		if (fcu->bezt)
 			writestruct(wd, DATA, "BezTriple", fcu->totvert, fcu->bezt);
 		if (fcu->fpt)
 			writestruct(wd, DATA, "FPoint", fcu->totvert, fcu->fpt);
@@ -720,18 +720,31 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
 			write_node_socket(wd, sock);
 		for (sock= node->outputs.first; sock; sock= sock->next)
 			write_node_socket(wd, sock);
-
+		
+		for (link = node->internal_links.first; link; link = link->next)
+			writestruct(wd, DATA, "bNodeLink", 1, link);
 		
 		if (node->storage) {
 			/* could be handlerized at some point, now only 1 exception still */
 			if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
 				write_curvemapping(wd, node->storage);
+			else if (ntree->type==NTREE_SHADER && node->type==SH_NODE_SCRIPT) {
+				NodeShaderScript *nss = (NodeShaderScript *)node->storage;
+				if (nss->bytecode)
+					writedata(wd, DATA, strlen(nss->bytecode)+1, nss->bytecode);
+				/* Write ID Properties -- and copy this comment EXACTLY for easy finding
+				 * of library blocks that implement this.*/
+				if (nss->prop)
+					IDP_WriteProperty(nss->prop, wd);
+				writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+			}
 			else if (ntree->type==NTREE_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
 				write_curvemapping(wd, node->storage);
 			else if (ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
 				write_curvemapping(wd, node->storage);
-			else if (ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
-				/* pass */;
+			else if (ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION) {
+				/* pass */
+			}
 			else
 				writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
 		}
@@ -776,13 +789,16 @@ typedef struct RenderInfo {
 	char scene_name[MAX_ID_NAME - 2];
 } RenderInfo;
 
-static void write_renderinfo(WriteData *wd, Main *mainvar)		/* for renderdeamon */
+/* was for historic render-deamon feature,
+ * now write because it can be easily extracted without
+ * reading the whole blend file */
+static void write_renderinfo(WriteData *wd, Main *mainvar)
 {
 	bScreen *curscreen;
 	Scene *sce;
 	RenderInfo data;
 
-	/* XXX in future, handle multiple windows with multiple screnes? */
+	/* XXX in future, handle multiple windows with multiple screens? */
 	current_screen_compat(mainvar, &curscreen);
 
 	for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
@@ -884,7 +900,7 @@ static const char *ptcache_data_struct[] = {
 	"", // BPHYS_DATA_ROTATION
 	"", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
 	"", // BPHYS_DATA_SIZE:
-	"", // BPHYS_DATA_TIMES:	
+	"", // BPHYS_DATA_TIMES:
 	"BoidData" // case BPHYS_DATA_BOIDS:
 };
 static const char *ptcache_extra_struct[] = {
@@ -1237,7 +1253,7 @@ static void write_constraints(WriteData *wd, ListBase *conlist)
 					break;
 				case CONSTRAINT_TYPE_SPLINEIK: 
 				{
-					bSplineIKConstraint *data= (bSplineIKConstraint*)con->data;
+					bSplineIKConstraint *data = (bSplineIKConstraint *)con->data;
 					
 					/* write points array */
 					writedata(wd, DATA, sizeof(float)*(data->numpoints), data->points);
@@ -1325,7 +1341,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 			writestruct(wd, DATA, "ClothCollSettings", 1, clmd->coll_parms);
 			writestruct(wd, DATA, "EffectorWeights", 1, clmd->sim_parms->effector_weights);
 			write_pointcaches(wd, &clmd->ptcaches);
-		} 
+		}
 		else if (md->type==eModifierType_Smoke) {
 			SmokeModifierData *smd = (SmokeModifierData*) md;
 			
@@ -1355,7 +1371,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 				writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow);
 			else if (smd->type & MOD_SMOKE_TYPE_COLL)
 				writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll);
-		} 
+		}
 		else if (md->type==eModifierType_Fluidsim) {
 			FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
 			
@@ -1383,7 +1399,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 				writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
 				writestruct(wd, DATA, "ColorBand", 1, pmd->brush->vel_ramp);
 			}
-		} 
+		}
 		else if (md->type==eModifierType_Collision) {
 			
 #if 0
@@ -1603,7 +1619,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
 			if (cu->vfont) {
 				writedata(wd, DATA, amount_of_chars(cu->str)+1, cu->str);
 				writestruct(wd, DATA, "CharInfo", cu->len+1, cu->strinfo);
-				writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb);				
+				writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb);
 			}
 			else {
 				/* is also the order of reading */
@@ -1725,9 +1741,10 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
 
 				writestruct(wd, DATA, structname, datasize, layer->data);
 			}
-			else
+			else {
 				printf("%s error: layer '%s':%d - can't be written to file\n",
 				       __func__, structname, layer->type);
+			}
 		}
 	}
 
@@ -1759,6 +1776,9 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
 				backup_mesh.totface = mesh->totface;
 				mesh->totface = 0;
 				/* -- */
+				backup_mesh.fdata = mesh->fdata;
+				memset(&mesh->fdata, 0, sizeof(mesh->fdata));
+				/* -- */
 #endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
 
 				writestruct(wd, ID_ME, "Mesh", 1, mesh);
@@ -1782,6 +1802,8 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
 				mesh->mface = backup_mesh.mface;
 				/* -- */
 				mesh->totface = backup_mesh.totface;
+				/* -- */
+				mesh->fdata = backup_mesh.fdata;
 #endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
 
 			}
@@ -1808,13 +1830,13 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
 				mesh->totloop = 0;
 				/* -- */
 				backup_mesh.fdata = mesh->fdata;
-				memset(&mesh->fdata, 0, sizeof(CustomData));
+				CustomData_reset(&mesh->fdata);
 				/* -- */
 				backup_mesh.pdata = mesh->pdata;
-				memset(&mesh->pdata, 0, sizeof(CustomData));
+				CustomData_reset(&mesh->pdata);
 				/* -- */
 				backup_mesh.ldata = mesh->ldata;
-				memset(&mesh->ldata, 0, sizeof(CustomData));
+				CustomData_reset(&mesh->ldata);
 				/* -- */
 				backup_mesh.edit_btmesh = mesh->edit_btmesh;
 				mesh->edit_btmesh = NULL;
@@ -2021,7 +2043,7 @@ static void write_materials(WriteData *wd, ListBase *idbase)
 				write_nodetree(wd, ma->nodetree);
 			}
 
-			write_previews(wd, ma->preview);			
+			write_previews(wd, ma->preview);
 		}
 		ma= ma->id.next;
 	}
@@ -2077,7 +2099,7 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
 			}
 			
 			if (la->curfalloff)
-				write_curvemapping(wd, la->curfalloff);	
+				write_curvemapping(wd, la->curfalloff);
 			
 			/* nodetree is integral part of lamps, no libdata */
 			if (la->nodetree) {
@@ -2300,7 +2322,7 @@ static void write_gpencils(WriteData *wd, ListBase *lb)
 					/* write strokes */
 					for (gps= gpf->strokes.first; gps; gps= gps->next) {
 						writestruct(wd, DATA, "bGPDstroke", 1, gps);
-						writestruct(wd, DATA, "bGPDspoint", gps->totpoints, gps->points);				
+						writestruct(wd, DATA, "bGPDspoint", gps->totpoints, gps->points);
 					}
 				}
 			}
@@ -2536,7 +2558,7 @@ static void write_bone(WriteData *wd, Bone *bone)
 	Bone*	cbone;
 
 	// PATCH for upward compatibility after 2.37+ armature recode
-	bone->size[0]= bone->size[1]= bone->size[2]= 1.0f;
+	bone->size[0] = bone->size[1] = bone->size[2] = 1.0f;
 		
 	// Write this bone
 	writestruct(wd, DATA, "Bone", 1, bone);
@@ -2585,7 +2607,6 @@ static void write_texts(WriteData *wd, ListBase *idbase)
 {
 	Text *text;
 	TextLine *tmp;
-	TextMarker *mrk;
 
 	text= idbase->first;
 	while (text) {
@@ -2609,13 +2630,6 @@ static void write_texts(WriteData *wd, ListBase *idbase)
 				writedata(wd, DATA, tmp->len+1, tmp->line);
 				tmp= tmp->next;
 			}
-
-			/* write markers */
-			mrk= text->markers.first;
-			while (mrk) {
-				writestruct(wd, DATA, "TextMarker", 1, mrk);
-				mrk= mrk->next;
-			}
 		}
 
 
@@ -2868,7 +2882,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
 	fg.winpos= G.winpos;
 
 	/* prevent to save this, is not good convention, and feature with concerns... */
-	fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP|G_FILE_MESH_COMPAT));
+	fg.fileflags= (fileflags & ~G_FILE_FLAGS_RUNTIME);
 
 	fg.globalf= G.f;
 	BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
@@ -2995,7 +3009,7 @@ static int do_history(const char *name, ReportList *reports)
 		if (BLI_rename(tempname1, tempname2)) {
 			BKE_report(reports, RPT_ERROR, "Unable to make version backup");
 			return 1;
-		}	
+		}
 		hisnr--;
 	}
 
@@ -3017,15 +3031,24 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 	char tempname[FILE_MAX+1];
 	int file, err, write_user_block;
 
+	/* path backup/restore */
+	void     *path_list_backup = NULL;
+	const int path_list_flag = (BLI_BPATH_TRAVERSE_SKIP_LIBRARY | BLI_BPATH_TRAVERSE_SKIP_MULTIFILE);
+
 	/* open temporary file, so we preserve the original in case we crash */
 	BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
 
 	file = BLI_open(tempname, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
 	if (file == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Can't open file %s for writing: %s.", tempname, strerror(errno));
+		BKE_reportf(reports, RPT_ERROR, "Cannot open file %s for writing: %s", tempname, strerror(errno));
 		return 0;
 	}
 
+	/* check if we need to backup and restore paths */
+	if (UNLIKELY((write_flags & G_FILE_RELATIVE_REMAP) && (G_FILE_SAVE_COPY & write_flags))) {
+		path_list_backup = BLI_bpath_list_backup(mainvar, path_list_flag);
+	}
+
 	/* remapping of relative paths to new file location */
 	if (write_flags & G_FILE_RELATIVE_REMAP) {
 		char dir1[FILE_MAX];
@@ -3061,6 +3084,11 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 	err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb);
 	close(file);
 
+	if (UNLIKELY(path_list_backup)) {
+		BLI_bpath_list_restore(mainvar, path_list_flag, path_list_backup);
+		BLI_bpath_list_free(path_list_backup);
+	}
+
 	if (err) {
 		BKE_report(reports, RPT_ERROR, strerror(errno));
 		remove(tempname);
@@ -3070,10 +3098,10 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 
 	/* file save to temporary file was successful */
 	/* now do reverse file history (move .blend1 -> .blend2, .blend -> .blend1) */
-	if (write_flags & G_FILE_HISTORY) { 
+	if (write_flags & G_FILE_HISTORY) {
 		int err_hist = do_history(filepath, reports);
 		if (err_hist) {
-			BKE_report(reports, RPT_ERROR, "Version backup failed. File saved with @");
+			BKE_report(reports, RPT_ERROR, "Version backup failed (file saved with @)");
 			return 0;
 		}
 	}
@@ -3090,23 +3118,23 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 		if (0==ret) {
 			/* now rename to real file name, and delete temp @ file too */
 			if (BLI_rename(gzname, filepath) != 0) {
-				BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @.");
+				BKE_report(reports, RPT_ERROR, "Cannot change old file (file saved with @)");
 				return 0;
 			}
 
 			BLI_delete(tempname, 0, 0);
 		}
 		else if (-1==ret) {
-			BKE_report(reports, RPT_ERROR, "Failed opening .gz file.");
+			BKE_report(reports, RPT_ERROR, "Failed opening .gz file");
 			return 0;
 		}
 		else if (-2==ret) {
-			BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression.");
+			BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression");
 			return 0;
 		}
 	}
 	else if (BLI_rename(tempname, filepath) != 0) {
-		BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @");
+		BKE_report(reports, RPT_ERROR, "Cannot change old file (file saved with @)");
 		return 0;
 	}
 
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 4bce7a6..2a23658 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -1,4 +1,3 @@
-# $Id: CMakeLists.txt 31746 2010-09-04 05:31:25Z joeedh $
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -26,10 +25,13 @@
 
 set(INC 
 	.
+	../blenfont
 	../blenkernel
 	../blenlib
 	../makesdna
 	../../../intern/guardedalloc
+	../../../extern/bullet2/src
+	../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -52,9 +54,13 @@ set(SRC
 	operators/bmo_mirror.c
 	operators/bmo_primitive.c
 	operators/bmo_removedoubles.c
+	operators/bmo_similar.c
+	operators/bmo_smooth_laplacian.c
+	operators/bmo_symmetrize.c
 	operators/bmo_subdivide.c
 	operators/bmo_subdivide.h
 	operators/bmo_triangulate.c
+	operators/bmo_unsubdivide.c
 	operators/bmo_utils.c
 	operators/bmo_wireframe.c
 
@@ -99,6 +105,12 @@ set(SRC
 	intern/bmesh_error.h
 
 	tools/BME_bevel.c
+	tools/bmesh_bevel.c
+	tools/bmesh_bevel.h
+	tools/bmesh_decimate_collapse.c
+	tools/bmesh_decimate_dissolve.c
+	tools/bmesh_decimate_unsubdivide.c
+	tools/bmesh_decimate.h
 
 	bmesh.h
 	bmesh_class.h
@@ -108,4 +120,12 @@ if(MSVC)
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
 endif()
 
+if(WITH_BULLET)
+	add_definitions(-DWITH_BULLET)
+endif()
+
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/bmesh/SConscript b/source/blender/bmesh/SConscript
index fb00aef..6765d57 100644
--- a/source/blender/bmesh/SConscript
+++ b/source/blender/bmesh/SConscript
@@ -9,11 +9,20 @@ sources += env.Glob('tools/*.c')
 
 incs = [
 	'./',
+	'../blenfont',
 	'../blenlib',
 	'../makesdna',
 	'../blenkernel',
 	'#/intern/guardedalloc',
-	]
+	'#/extern/bullet2/src',
+	'#/intern/opennl/extern',	]
 
 defs = []
+
+if env['WITH_BF_BULLET']:
+    defs.append('WITH_BULLET')
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( libname = 'bf_bmesh', sources = sources, includes = Split(incs), libtype = ['core','player'], defines=defs, priority=[100, 100], compileflags=cflags )
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 955b1a7..6257aa4 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -266,6 +266,9 @@ extern "C" {
 
 #include "intern/bmesh_inline.h"
 
+#include "tools/bmesh_decimate.h"
+#include "tools/bmesh_bevel.h"
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 3bd99b7..9d797c1 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -48,6 +48,8 @@ struct Object;
  * hrm. it doesn't but stull works ok, remove the comment above? - campbell.
  */
 
+// #pragma GCC diagnostic error "-Wpadded"
+
 /**
  * BMHeader
  *
@@ -69,10 +71,19 @@ typedef struct BMHeader {
 	            *   this is abused by various tools which set it dirty.
 	            * - For loops this is used for sorting during tessellation. */
 
-	char htype; /* element geometric type (verts/edges/loops/faces) */
-	char hflag; /* this would be a CD layer, see below */
+	char htype;    /* element geometric type (verts/edges/loops/faces) */
+	char hflag;    /* this would be a CD layer, see below */
+
+	/* internal use only!
+	 * note,.we are very picky about not bloating this struct
+	 * but in this case its padded up to 16 bytes anyway,
+	 * so adding a flag here gives no increase in size */
+	char api_flag;
+//	char _pad;
 } BMHeader;
 
+BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
+
 /* note: need some way to specify custom locations for custom data layers.  so we can
  * make them point directly into structs.  and some way to make it only happen to the
  * active layer, and properly update when switching active layers.*/
@@ -122,7 +133,10 @@ typedef struct BMLoop {
 /* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
 typedef struct BMElemF {
 	BMHeader head;
-	struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
+
+	/* keep directly after header,
+	 * optional array of flags, only used by the operator stack */
+	struct BMFlagLayer *oflags;
 } BMElemF;
 
 /* can cast anything to this, including BMLoop */
@@ -142,21 +156,24 @@ typedef struct BMFace {
 	BMHeader head;
 	struct BMFlagLayer *oflags; /* an array of flags, mostly used by the operator stack */
 
-	int len; /*includes all boundary loops*/
 #ifdef USE_BMESH_HOLES
 	int totbounds; /*total boundaries, is one plus the number of holes in the face*/
 	ListBase loops;
 #else
 	BMLoop *l_first;
 #endif
-	float no[3]; /*yes, we do store this here*/
+	int   len;   /* includes all boundary loops */
+	float no[3]; /* yes, we do store this here */
 	short mat_nr;
+//	short _pad[3];
 } BMFace;
 
 typedef struct BMFlagLayer {
-	short f, pflag; /* flags */
+	short f; /* flags */
 } BMFlagLayer;
 
+// #pragma GCC diagnostic ignored "-Wpadded"
+
 typedef struct BMesh {
 	int totvert, totedge, totloop, totface;
 	int totvertsel, totedgesel, totfacesel;
@@ -166,7 +183,7 @@ typedef struct BMesh {
 	 * valid flags are - BM_VERT | BM_EDGE | BM_FACE.
 	 * BM_LOOP isn't handled so far. */
 	char elem_index_dirty;
-	
+
 	/*element pools*/
 	struct BLI_mempool *vpool, *epool, *lpool, *fpool;
 
@@ -192,7 +209,7 @@ typedef struct BMesh {
 	
 	int walkers, totflags;
 	ListBase selected, error_stack;
-	
+
 	BMFace *act_face;
 
 	ListBase errorstack;
@@ -209,6 +226,7 @@ enum {
 };
 
 #define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
+#define BM_ALL_NOLOOP (BM_VERT | BM_EDGE | BM_FACE)
 
 /* BMHeader->hflag (char) */
 enum {
@@ -225,9 +243,8 @@ enum {
 
 	BM_ELEM_DRAW    = (1 << 5), /* edge display */
 
-	/* we have 1 spare flag which is awesome but since we're limited to 8
-	 * only add new flags with care! - campbell */
-	/* BM_ELEM_SPARE  = (1 << 6), */
+	/* spare tag, assumed dirty, use define in each function to name based on use */
+	// _BM_ELEM_TAG_ALT = (1 << 6),  // UNUSED
 
 	BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
                                      * since tools may want to tag verts and
@@ -244,10 +261,16 @@ enum {
 #  define BM_FACE_FIRST_LOOP(p) ((p)->l_first)
 #endif
 
-/* size to use for static arrays when dealing with NGons,
+/**
+ * size to use for stack arrays when dealing with NGons,
  * alloc after this limit is reached.
  * this value is rather arbitrary */
-#define BM_NGON_STACK_SIZE 32
+#define BM_DEFAULT_NGON_STACK_SIZE 32
+/**
+ * size to use for stack arrays dealing with connected mesh data
+ * verts of faces, edges of vert - etc.
+ * often used with #BM_iter_as_arrayN() */
+#define BM_DEFAULT_ITER_STACK_SIZE 16
 
 /* avoid inf loop, this value is arbitrary
  * but should not error on valid cases */
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index bc12130..8b7fac1 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -99,23 +99,23 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
 
 	if (nodouble) {
 		/* check if face exists or overlaps */
-		is_overlap = BM_face_exists(bm, verts, len, &f);
+		is_overlap = BM_face_exists(verts, len, &f);
 	}
 
 	/* make new face */
 	if ((f == NULL) && (!is_overlap)) {
 		BMEdge *edar[4] = {NULL};
-		edar[0] = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
-		edar[1] = BM_edge_create(bm, verts[1], verts[2], NULL, TRUE);
+		edar[0] = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE);
+		edar[1] = BM_edge_create(bm, verts[1], verts[2], NULL, BM_CREATE_NO_DOUBLE);
 		if (len == 4) {
-			edar[2] = BM_edge_create(bm, verts[2], verts[3], NULL, TRUE);
-			edar[3] = BM_edge_create(bm, verts[3], verts[0], NULL, TRUE);
+			edar[2] = BM_edge_create(bm, verts[2], verts[3], NULL, BM_CREATE_NO_DOUBLE);
+			edar[3] = BM_edge_create(bm, verts[3], verts[0], NULL, BM_CREATE_NO_DOUBLE);
 		}
 		else {
-			edar[2] = BM_edge_create(bm, verts[2], verts[0], NULL, TRUE);
+			edar[2] = BM_edge_create(bm, verts[2], verts[0], NULL, BM_CREATE_NO_DOUBLE);
 		}
 
-		f = BM_face_create(bm, verts, edar, len, FALSE);
+		f = BM_face_create(bm, verts, edar, len, 0);
 
 		if (example && f) {
 			BM_elem_attrs_copy(bm, bm, example, f);
@@ -171,12 +171,12 @@ void BM_face_copy_shared(BMesh *bm, BMFace *f)
  * #BM_face_create should be considered over this function as it
  * avoids some unnecessary work.
  */
-BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, int nodouble)
+BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, const int create_flag)
 {
 	BMEdge **edges2 = NULL;
-	BLI_array_staticdeclare(edges2, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(edges2, BM_DEFAULT_NGON_STACK_SIZE);
 	BMVert **verts = NULL;
-	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(verts, BM_DEFAULT_NGON_STACK_SIZE);
 	BMFace *f = NULL;
 	BMEdge *e;
 	BMVert *v, *ev1, *ev2;
@@ -187,8 +187,10 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
 	 *  _and_ the old bmesh_mf functions, so its kindof smashed together
 	 * - joeedh */
 
-	if (!len || !v1 || !v2 || !edges || !bm)
+	if (!len || !v1 || !v2 || !edges || !bm) {
+		BLI_assert(0);
 		return NULL;
+	}
 
 	/* put edges in correct order */
 	for (i = 0; i < len; i++) {
@@ -280,7 +282,7 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
 		BM_ELEM_API_FLAG_DISABLE(verts[i], _FLAG_MV);
 	}
 
-	f = BM_face_create(bm, verts, edges2, len, nodouble);
+	f = BM_face_create(bm, verts, edges2, len, create_flag);
 
 	/* clean up flags */
 	for (i = 0; i < len; i++) {
@@ -336,7 +338,7 @@ static int angle_index_pair_cmp(const void *e1, const void *e2)
  *
  * \note Since this is a vcloud there is no direction.
  */
-BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int nodouble)
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, const int create_flag)
 {
 	BMFace *f;
 
@@ -397,11 +399,11 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n
 
 		/* more of a weight then a distance */
 		far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */
-						  1.0f - fabsf(dot_v3v3(far_vec, far_cross_vec)) *
+		                  1.0f - fabsf(dot_v3v3(far_vec, far_cross_vec)) *
 
-						  /* second  we multiply by the distance
-						   * so points close to the center are not preferred */
-						  far_cross_dist);
+		                  /* second  we multiply by the distance
+		                   * so points close to the center are not preferred */
+		                  far_cross_dist);
 
 		if (far_cross_dist > far_cross_best || far_cross == NULL) {
 			far_cross = vert_arr[i]->co;
@@ -462,7 +464,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n
 
 	i_prev = totv - 1;
 	for (i = 0; i < totv; i++) {
-		edge_arr[i] = BM_edge_create(bm, vert_arr_map[i_prev], vert_arr_map[i], NULL, TRUE);
+		edge_arr[i] = BM_edge_create(bm, vert_arr_map[i_prev], vert_arr_map[i], NULL, BM_CREATE_NO_DOUBLE);
 
 		/* the edge may exist already and be attached to a face
 		 * in this case we can find the best winding to use for the new face */
@@ -491,7 +493,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n
 	/* --- */
 
 	/* create the face */
-	f = BM_face_create_ngon(bm, vert_arr_map[winding[0]], vert_arr_map[winding[1]], edge_arr, totv, nodouble);
+	f = BM_face_create_ngon(bm, vert_arr_map[winding[0]], vert_arr_map[winding[1]], edge_arr, totv, create_flag);
 
 	MEM_freeN(edge_arr);
 	MEM_freeN(vert_arr_map);
@@ -725,6 +727,7 @@ static void bm_vert_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
                                const BMVert *source_vertex, BMVert *target_vertex)
 {
 	if ((source_mesh == target_mesh) && (source_vertex == target_vertex)) {
+		BLI_assert(!"BMVert: source and targer match");
 		return;
 	}
 	copy_v3_v3(target_vertex->no, source_vertex->no);
@@ -737,6 +740,7 @@ static void bm_edge_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
                                const BMEdge *source_edge, BMEdge *target_edge)
 {
 	if ((source_mesh == target_mesh) && (source_edge == target_edge)) {
+		BLI_assert(!"BMEdge: source and targer match");
 		return;
 	}
 	CustomData_bmesh_free_block(&target_mesh->edata, &target_edge->head.data);
@@ -748,6 +752,7 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
                                const BMLoop *source_loop, BMLoop *target_loop)
 {
 	if ((source_mesh == target_mesh) && (source_loop == target_loop)) {
+		BLI_assert(!"BMLoop: source and targer match");
 		return;
 	}
 	CustomData_bmesh_free_block(&target_mesh->ldata, &target_loop->head.data);
@@ -759,6 +764,7 @@ static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
                                const BMFace *source_face, BMFace *target_face)
 {
 	if ((source_mesh == target_mesh) && (source_face == target_face)) {
+		BLI_assert(!"BMFace: source and targer match");
 		return;
 	}
 	copy_v3_v3(target_face->no, source_face->no);
@@ -781,8 +787,10 @@ void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *sour
 
 	BLI_assert(sheader->htype == theader->htype);
 
-	if (sheader->htype != theader->htype)
+	if (sheader->htype != theader->htype) {
+		BLI_assert(!"type mismatch");
 		return;
+	}
 
 	/* First we copy select */
 	if (BM_elem_flag_test((BMElem *)sheader, BM_ELEM_SELECT)) {
@@ -848,7 +856,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
 
 	v = BM_iter_new(&iter, bm_old, BM_VERTS_OF_MESH, NULL);
 	for (i = 0; v; v = BM_iter_step(&iter), i++) {
-		v2 = BM_vert_create(bm_new, v->co, NULL); /* copy between meshes so cant use 'example' argument */
+		v2 = BM_vert_create(bm_new, v->co, NULL, BM_CREATE_SKIP_CD); /* copy between meshes so cant use 'example' argument */
 		BM_elem_attrs_copy(bm_old, bm_new, v, v2);
 		vtable[i] = v2;
 		BM_elem_index_set(v, i); /* set_inline */
@@ -865,7 +873,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
 		e2 = BM_edge_create(bm_new,
 		                    vtable[BM_elem_index_get(e->v1)],
 		                    vtable[BM_elem_index_get(e->v2)],
-		                    e, FALSE);
+		                    e, BM_CREATE_SKIP_CD);
 
 		BM_elem_attrs_copy(bm_old, bm_new, e, e2);
 		etable[i] = e2;
@@ -901,7 +909,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
 			v2 = vtable[BM_elem_index_get(loops[0]->v)];
 		}
 
-		f2 = BM_face_create_ngon(bm_new, v, v2, edges, f->len, FALSE);
+		f2 = BM_face_create_ngon(bm_new, v, v2, edges, f->len, BM_CREATE_SKIP_CD);
 		if (UNLIKELY(f2 == NULL)) {
 			continue;
 		}
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index 29b8404..60c465e 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -36,9 +36,9 @@ BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, B
 
 void BM_face_copy_shared(BMesh *bm, BMFace *f);
 
-BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, int nodouble);
+BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, const int create_flag);
 
-BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, int nodouble);
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, const int create_flag);
 
 void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
 void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index d50c94d..14fab7a 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -28,12 +28,13 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math_vector.h"
-
-#include "BKE_DerivedMesh.h"
-
 #include "BLI_listbase.h"
 #include "BLI_array.h"
 
+#include "BLF_translation.h"
+
+#include "BKE_DerivedMesh.h"
+
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
@@ -53,7 +54,7 @@
 /**
  * \brief Main function for creating a new vertex.
  */
-BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
+BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, const eBMCreateFlag create_flag)
 {
 	BMVert *v = BLI_mempool_calloc(bm->vpool);
 
@@ -63,6 +64,9 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
 	BM_elem_index_set(v, -1); /* set_ok_invalid */
 #endif
 
+	/* disallow this flag for verts - its meaningless */
+	BLI_assert((create_flag & BM_CREATE_NO_DOUBLE) == 0);
+
 	bm->elem_index_dirty |= BM_VERT; /* may add to middle of the pool */
 
 	bm->totvert++;
@@ -75,19 +79,24 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
 	}
 
 	/* allocate flag */
-	v->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	if (bm->toolflagpool) {
+		v->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	}
 
-	CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
-	
-	if (example) {
-		int *keyi;
+	if (!(create_flag & BM_CREATE_SKIP_CD)) {
+		if (example) {
+			int *keyi;
 
-		BM_elem_attrs_copy(bm, bm, example, v);
+			BM_elem_attrs_copy(bm, bm, example, v);
 
-		/* exception: don't copy the original shapekey index */
-		keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
-		if (keyi) {
-			*keyi = ORIGINDEX_NONE;
+			/* exception: don't copy the original shapekey index */
+			keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
+			if (keyi) {
+				*keyi = ORIGINDEX_NONE;
+			}
+		}
+		else {
+			CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
 		}
 	}
 
@@ -102,11 +111,11 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
  * \note Duplicate edges are supported by the API however users should _never_ see them.
  * so unless you need a unique edge or know the edge won't exist, you should call with \a nodouble = TRUE
  */
-BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble)
+BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, const eBMCreateFlag create_flag)
 {
 	BMEdge *e;
 	
-	if (nodouble && (e = BM_edge_exists(v1, v2)))
+	if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2)))
 		return e;
 	
 	e = BLI_mempool_calloc(bm->epool);
@@ -124,27 +133,35 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example,
 	e->head.htype = BM_EDGE;
 	
 	/* allocate flag */
-	e->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	if (bm->toolflagpool) {
+		e->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	}
 
 	e->v1 = v1;
 	e->v2 = v2;
 	
-	BM_elem_flag_enable(e, BM_ELEM_SMOOTH);
-	
-	CustomData_bmesh_set_default(&bm->edata, &e->head.data);
+	BM_elem_flag_enable(e, BM_ELEM_SMOOTH | BM_ELEM_DRAW);
 	
 	bmesh_disk_edge_append(e, e->v1);
 	bmesh_disk_edge_append(e, e->v2);
 	
-	if (example)
-		BM_elem_attrs_copy(bm, bm, example, e);
+	if (!(create_flag & BM_CREATE_SKIP_CD)) {
+		if (example) {
+			BM_elem_attrs_copy(bm, bm, example, e);
+		}
+		else {
+			CustomData_bmesh_set_default(&bm->edata, &e->head.data);
+		}
+	}
+
 	
 	BM_CHECK_ELEMENT(e);
 
 	return e;
 }
 
-static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *example)
+static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f,
+                              const BMLoop *example, const eBMCreateFlag create_flag)
 {
 	BMLoop *l = NULL;
 
@@ -159,22 +176,24 @@ static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const
 
 	bm->totloop++;
 
-	if (example) {
-		CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, example->head.data, &l->head.data);
-	}
-	else {
-		CustomData_bmesh_set_default(&bm->ldata, &l->head.data);
+	if (!(create_flag & BM_CREATE_SKIP_CD)) {
+		if (example) {
+			CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, example->head.data, &l->head.data);
+		}
+		else {
+			CustomData_bmesh_set_default(&bm->ldata, &l->head.data);
+		}
 	}
 
 	return l;
 }
 
-static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte)
+static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte, const int create_flag)
 {
 #ifdef USE_BMESH_HOLES
 	BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
 #endif
-	BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL);
+	BMLoop *l = bm_loop_create(bm, startv, starte, f, starte->l, create_flag);
 	
 	bmesh_radial_append(starte, l);
 
@@ -194,8 +213,8 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
 {
 	BMVert **verts = NULL;
 	BMEdge **edges = NULL;
-	BLI_array_fixedstack_declare(verts, BM_NGON_STACK_SIZE, f->len, __func__);
-	BLI_array_fixedstack_declare(edges, BM_NGON_STACK_SIZE, f->len, __func__);
+	BLI_array_fixedstack_declare(verts, BM_DEFAULT_NGON_STACK_SIZE, f->len, __func__);
+	BLI_array_fixedstack_declare(edges, BM_DEFAULT_NGON_STACK_SIZE, f->len, __func__);
 	BMLoop *l_iter;
 	BMLoop *l_first;
 	BMLoop *l_copy;
@@ -206,7 +225,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
 	i = 0;
 	do {
 		if (copyverts) {
-			verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v);
+			verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0);
 		}
 		else {
 			verts[i] = l_iter->v;
@@ -229,7 +248,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
 				v1 = verts[(i + 1) % f->len];
 			}
 			
-			edges[i] = BM_edge_create(bm,  v1, v2, l_iter->e, FALSE);
+			edges[i] = BM_edge_create(bm,  v1, v2, l_iter->e, 0);
 		}
 		else {
 			edges[i] = l_iter->e;
@@ -237,7 +256,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
 		i++;
 	} while ((l_iter = l_iter->next) != l_first);
 	
-	f_copy = BM_face_create(bm, verts, edges, f->len, FALSE);
+	f_copy = BM_face_create(bm, verts, edges, f->len, BM_CREATE_SKIP_CD);
 	
 	BM_elem_attrs_copy(bm, bm, f, f_copy);
 	
@@ -258,7 +277,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
  * only create the face, since this calloc's the length is initialized to 0,
  * leave adding loops to the caller.
  */
-BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
+BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm, const eBMCreateFlag create_flag)
 {
 	BMFace *f;
 
@@ -277,9 +296,13 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
 	f->head.htype = BM_FACE;
 
 	/* allocate flag */
-	f->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	if (bm->toolflagpool) {
+		f->oflags = BLI_mempool_calloc(bm->toolflagpool);
+	}
 
-	CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
+	if (!(create_flag & BM_CREATE_SKIP_CD)) {
+		CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
+	}
 
 #ifdef USE_BMESH_HOLES
 	f->totbounds = 0;
@@ -291,7 +314,7 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
 /**
  * \brief Main face creation function
  */
-BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble)
+BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const eBMCreateFlag create_flag)
 {
 	BMFace *f = NULL;
 	BMLoop *l, *startl, *lastl;
@@ -302,9 +325,9 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
 		return NULL;
 	}
 
-	if (nodouble) {
+	if (create_flag & BM_CREATE_NO_DOUBLE) {
 		/* Check if face already exists */
-		overlap = BM_face_exists(bm, verts, len, &f);
+		overlap = BM_face_exists(verts, len, &f);
 		if (overlap) {
 			return f;
 		}
@@ -313,14 +336,14 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
 		}
 	}
 
-	f = bm_face_create__internal(bm);
+	f = bm_face_create__internal(bm, create_flag);
 
-	startl = lastl = bm_face_boundary_add(bm, f, verts[0], edges[0]);
+	startl = lastl = bm_face_boundary_add(bm, f, verts[0], edges[0], create_flag);
 	
 	startl->v = verts[0];
 	startl->e = edges[0];
 	for (i = 1; i < len; i++) {
-		l = bm_loop_create(bm, verts[i], edges[i], f, edges[i]->l);
+		l = bm_loop_create(bm, verts[i], edges[i], f, edges[i]->l, create_flag);
 		
 		l->f = f;
 		bmesh_radial_append(edges[i], l);
@@ -494,7 +517,9 @@ static void bm_kill_only_vert(BMesh *bm, BMVert *v)
 	if (v->head.data)
 		CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
 
-	BLI_mempool_free(bm->toolflagpool, v->oflags);
+	if (bm->toolflagpool) {
+		BLI_mempool_free(bm->toolflagpool, v->oflags);
+	}
 	BLI_mempool_free(bm->vpool, v);
 }
 
@@ -512,7 +537,9 @@ static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
 	if (e->head.data)
 		CustomData_bmesh_free_block(&bm->edata, &e->head.data);
 
-	BLI_mempool_free(bm->toolflagpool, e->oflags);
+	if (bm->toolflagpool) {
+		BLI_mempool_free(bm->toolflagpool, e->oflags);
+	}
 	BLI_mempool_free(bm->epool, e);
 }
 
@@ -533,7 +560,9 @@ static void bm_kill_only_face(BMesh *bm, BMFace *f)
 	if (f->head.data)
 		CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
 
-	BLI_mempool_free(bm->toolflagpool, f->oflags);
+	if (bm->toolflagpool) {
+		BLI_mempool_free(bm->toolflagpool, f->oflags);
+	}
 	BLI_mempool_free(bm->fpool, f);
 }
 
@@ -557,7 +586,7 @@ static void bm_kill_only_loop(BMesh *bm, BMLoop *l)
 void BM_face_edges_kill(BMesh *bm, BMFace *f)
 {
 	BMEdge **edges = NULL;
-	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(edges, BM_DEFAULT_NGON_STACK_SIZE);
 	BMLoop *l_iter;
 	BMLoop *l_first;
 	int i;
@@ -581,7 +610,7 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f)
 void BM_face_verts_kill(BMesh *bm, BMFace *f)
 {
 	BMVert **verts = NULL;
-	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(verts, BM_DEFAULT_NGON_STACK_SIZE);
 	BMLoop *l_iter;
 	BMLoop *l_first;
 	int i;
@@ -733,7 +762,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
 	const int do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
 	BMLoop *l_iter, *oldprev, *oldnext;
 	BMEdge **edar = NULL;
-	BLI_array_fixedstack_declare(edar, BM_NGON_STACK_SIZE, len, __func__);
+	BLI_array_fixedstack_declare(edar, BM_DEFAULT_NGON_STACK_SIZE, len, __func__);
 	int i, j, edok;
 
 	for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
@@ -810,7 +839,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
 int bmesh_loop_reverse(BMesh *bm, BMFace *f)
 {
 #ifdef USE_BMESH_HOLES
-	return bmesh_loop_reverse_loop(bm, f, f->loops.first);
+	return bm_loop_reverse_loop(bm, f, f->loops.first);
 #else
 	return bm_loop_reverse_loop(bm, f);
 #endif
@@ -936,9 +965,9 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del
 	BMEdge **edges = NULL;
 	BMEdge **deledges = NULL;
 	BMVert **delverts = NULL;
-	BLI_array_staticdeclare(edges,    BM_NGON_STACK_SIZE);
-	BLI_array_staticdeclare(deledges, BM_NGON_STACK_SIZE);
-	BLI_array_staticdeclare(delverts, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(edges,    BM_DEFAULT_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(deledges, BM_DEFAULT_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(delverts, BM_DEFAULT_NGON_STACK_SIZE);
 	BMVert *v1 = NULL, *v2 = NULL;
 	const char *err = NULL;
 	int i, tote = 0;
@@ -960,7 +989,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del
 			int rlen = count_flagged_radial(bm, l_iter, _FLAG_JF);
 
 			if (rlen > 2) {
-				err = "Input faces do not form a contiguous manifold region";
+				err = N_("Input faces do not form a contiguous manifold region");
 				goto error;
 			}
 			else if (rlen == 1) {
@@ -1020,10 +1049,10 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del
 	}
 
 	/* create region face */
-	newf = BM_face_create_ngon(bm, v1, v2, edges, tote, FALSE);
+	newf = tote ? BM_face_create_ngon(bm, v1, v2, edges, tote, 0) : NULL;
 	if (UNLIKELY(!newf || BMO_error_occurred(bm))) {
 		if (!BMO_error_occurred(bm))
-			err = "Invalid boundary region to join faces";
+			err = N_("Invalid boundary region to join faces");
 		goto error;
 	}
 
@@ -1126,7 +1155,7 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
 	BMLoopList *lst;
 #endif
 
-	f = bm_face_create__internal(bm);
+	f = bm_face_create__internal(bm, 0);
 
 #ifdef USE_BMESH_HOLES
 	lst = BLI_mempool_calloc(bm->looplistpool);
@@ -1143,6 +1172,8 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
 /**
  * \brief Split Face Make Edge (SFME)
  *
+ * \warning this is a low level function, most likely you want to use #BM_face_split()
+ *
  * Takes as input two vertices in a single face. An edge is created which divides the original face
  * into two distinct regions. One of the regions is assigned to the original face and it is closed off.
  * The second region has a new face assigned to it.
@@ -1186,13 +1217,15 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
 {
 #ifdef USE_BMESH_HOLES
 	BMLoopList *lst, *lst2;
+#else
+	int first_loop_f1;
 #endif
 
 	BMFace *f2;
 	BMLoop *l_iter, *l_first;
 	BMLoop *v1loop = NULL, *v2loop = NULL, *f1loop = NULL, *f2loop = NULL;
 	BMEdge *e;
-	int i, len, f1len, f2len, first_loop_f1;
+	int i, len, f1len, f2len;
 
 	/* verify that v1 and v2 are in face */
 	len = f->len;
@@ -1206,11 +1239,11 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
 	}
 
 	/* allocate new edge between v1 and v2 */
-	e = BM_edge_create(bm, v1, v2, example, nodouble);
+	e = BM_edge_create(bm, v1, v2, example, nodouble ? BM_CREATE_NO_DOUBLE : 0);
 
 	f2 = bm_face_create__sfme(bm, f);
-	f1loop = bm_loop_create(bm, v2, e, f, v2loop);
-	f2loop = bm_loop_create(bm, v1, e, f2, v1loop);
+	f1loop = bm_loop_create(bm, v2, e, f, v2loop, 0);
+	f2loop = bm_loop_create(bm, v1, e, f2, v1loop, 0);
 
 	f1loop->prev = v2loop->prev;
 	f2loop->prev = v1loop->prev;
@@ -1317,10 +1350,10 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
  * will be attached to that end and is returned in \a r_e.
  *
  * \par Examples:
+ *
  * <pre>
  *                     E
  *     Before: OV-------------TV
- *
  *                 E       RE
  *     After:  OV------NV-----TV
  * </pre>
@@ -1342,8 +1375,8 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 
 	valence2 = bmesh_disk_count(tv);
 
-	nv = BM_vert_create(bm, tv->co, tv);
-	ne = BM_edge_create(bm, nv, tv, e, FALSE);
+	nv = BM_vert_create(bm, tv->co, tv, 0);
+	ne = BM_edge_create(bm, nv, tv, e, 0);
 
 	bmesh_disk_edge_remove(ne, tv);
 	bmesh_disk_edge_remove(ne, nv);
@@ -1386,7 +1419,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 			nextl = nextl != nextl->radial_next ? nextl->radial_next : NULL;
 			bmesh_radial_loop_remove(l, NULL);
 
-			nl = bm_loop_create(bm, NULL, NULL, l->f, l);
+			nl = bm_loop_create(bm, NULL, NULL, l->f, l, 0);
 			nl->prev = l;
 			nl->next = (l->next);
 			nl->prev->next = nl;
@@ -1582,7 +1615,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
 
 				if (LIKELY(radlen)) {
 					BMLoop **loops = NULL;
-					BLI_array_fixedstack_declare(loops, BM_NGON_STACK_SIZE, radlen, __func__);
+					BLI_array_fixedstack_declare(loops, BM_DEFAULT_NGON_STACK_SIZE, radlen, __func__);
 
 					killoop = ke->l;
 
@@ -1603,10 +1636,10 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
 				BMESH_ASSERT(edok != FALSE);
 			}
 
-			/* deallocate edg */
+			/* deallocate edge */
 			bm_kill_only_edge(bm, ke);
 
-			/* deallocate verte */
+			/* deallocate vertex */
 			bm_kill_only_vert(bm, kv);
 
 			/* Validate disk cycle lengths of ov, tv are unchanged */
@@ -1615,7 +1648,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
 			edok = bmesh_disk_validate(valence2, tv->e, tv);
 			BMESH_ASSERT(edok != FALSE);
 
-			/* Validate loop cycle of all faces attached to oe */
+			/* Validate loop cycle of all faces attached to 'oe' */
 			for (i = 0, l = oe->l; i < radlen; i++, l = l->radial_next) {
 				BMESH_ASSERT(l->e == oe);
 				edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
@@ -1768,14 +1801,18 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
 	bmesh_disk_edge_remove(f1loop->e, f1loop->e->v2);
 	
 	/* deallocate edge and its two loops as well as f2 */
-	BLI_mempool_free(bm->toolflagpool, f1loop->e->oflags);
+	if (bm->toolflagpool) {
+		BLI_mempool_free(bm->toolflagpool, f1loop->e->oflags);
+	}
 	BLI_mempool_free(bm->epool, f1loop->e);
 	bm->totedge--;
 	BLI_mempool_free(bm->lpool, f1loop);
 	bm->totloop--;
 	BLI_mempool_free(bm->lpool, f2loop);
 	bm->totloop--;
-	BLI_mempool_free(bm->toolflagpool, f2->oflags);
+	if (bm->toolflagpool) {
+		BLI_mempool_free(bm->toolflagpool, f2->oflags);
+	}
 	BLI_mempool_free(bm->fpool, f2);
 	bm->totface--;
 	/* account for both above */
@@ -1796,35 +1833,47 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
  * Merges two verts into one (\a v into \a vtarget).
  *
  * \return Success
+ *
+ * \warning This does't work for collapsing edges,
+ * where \a v and \a vtarget are connected by an edge
+ * (assert checks for this case).
  */
-int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
+int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
 {
-	BMEdge *e;
-
+	void *loops_stack[BM_DEFAULT_ITER_STACK_SIZE];
 	BMLoop **loops;
 	int i, loops_tot;
 
+	BMEdge *e;
+
 	/* verts already spliced */
-	if (v == vtarget) {
+	if (v == v_target) {
 		return FALSE;
 	}
 
 	/* we can't modify the vert while iterating so first allocate an array of loops */
-	loops = BM_iter_as_arrayN(bm, BM_LOOPS_OF_VERT, v, &loops_tot);
-	for (i = 0; i < loops_tot; i++) {
-		loops[i]->v = vtarget;
+	loops = BM_iter_as_arrayN(bm, BM_LOOPS_OF_VERT, v, &loops_tot,
+	                          loops_stack, BM_DEFAULT_ITER_STACK_SIZE);
+
+	if (LIKELY(loops != NULL)) {
+		for (i = 0; i < loops_tot; i++) {
+			loops[i]->v = v_target;
+		}
+		if (loops != (BMLoop **)loops_stack) {
+			MEM_freeN(loops);
+		}
 	}
-	MEM_freeN(loops);
 
 	/* move all the edges from v's disk to vtarget's disk */
 	while ((e = v->e)) {
 		bmesh_disk_edge_remove(e, v);
-		bmesh_edge_swapverts(e, v, vtarget);
-		bmesh_disk_edge_append(e, vtarget);
+		bmesh_edge_swapverts(e, v, v_target);
+		bmesh_disk_edge_append(e, v_target);
+		BLI_assert(e->v1 != e->v2);
 	}
 
 	BM_CHECK_ELEMENT(v);
-	BM_CHECK_ELEMENT(vtarget);
+	BM_CHECK_ELEMENT(v_target);
 
 	/* v is unused now, and can be killed */
 	BM_vert_kill(bm, v);
@@ -1886,7 +1935,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
 	verts = MEM_callocN(sizeof(BMVert *) * maxindex, __func__);
 	verts[0] = v;
 	for (i = 1; i < maxindex; i++) {
-		verts[i] = BM_vert_create(bm, v->co, v);
+		verts[i] = BM_vert_create(bm, v->co, v, 0);
 	}
 
 	/* Replace v with the new verts in each group */
@@ -1990,27 +2039,32 @@ int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
  *
  * \note Edges must already have the same vertices.
  */
-int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget)
+int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
 {
 	BMLoop *l;
 
-	if (!BM_vert_in_edge(e, etarget->v1) || !BM_vert_in_edge(e, etarget->v2)) {
+	if (!BM_vert_in_edge(e, e_target->v1) || !BM_vert_in_edge(e, e_target->v2)) {
 		/* not the same vertices can't splice */
+
+		/* the caller should really make sure this doesn't happen ever
+		 * so assert on release builds */
+		BLI_assert(0);
+
 		return FALSE;
 	}
 
 	while (e->l) {
 		l = e->l;
-		BLI_assert(BM_vert_in_edge(etarget, l->v));
-		BLI_assert(BM_vert_in_edge(etarget, l->next->v));
+		BLI_assert(BM_vert_in_edge(e_target, l->v));
+		BLI_assert(BM_vert_in_edge(e_target, l->next->v));
 		bmesh_radial_loop_remove(l, e);
-		bmesh_radial_append(etarget, l);
+		bmesh_radial_append(e_target, l);
 	}
 
 	BLI_assert(bmesh_radial_length(e->l) == 0);
 
 	BM_CHECK_ELEMENT(e);
-	BM_CHECK_ELEMENT(etarget);
+	BM_CHECK_ELEMENT(e_target);
 
 	/* removes from disks too */
 	BM_edge_kill(bm, e);
@@ -2047,7 +2101,7 @@ int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
 		e->l = l_sep->radial_next;
 	}
 
-	ne = BM_edge_create(bm, e->v1, e->v2, e, FALSE);
+	ne = BM_edge_create(bm, e->v1, e->v2, e, 0);
 	bmesh_radial_loop_remove(l_sep, e);
 	bmesh_radial_append(ne, l_sep);
 	l_sep->e = ne;
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
index 4912879..5fd4a6e 100644
--- a/source/blender/bmesh/intern/bmesh_core.h
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -29,9 +29,18 @@
 
 BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges);
 
-BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example);
-BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble);
-BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble);
+typedef enum eBMCreateFlag {
+	/* faces and edges only */
+	BM_CREATE_NO_DOUBLE = (1 << 1),
+	/* Skip CustomData - for all element types data,
+	 * use if we immediately write customdata into the element so this skips copying from 'example'
+	 * args or setting defaults, speeds up conversion when data is converted all at once. */
+	BM_CREATE_SKIP_CD   = (1 << 2),
+} eBMCreateFlag;
+
+BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, const eBMCreateFlag create_flag);
+BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, const eBMCreateFlag create_flag);
+BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const eBMCreateFlag create_flag);
 
 void    BM_face_edges_kill(BMesh *bm, BMFace *f);
 void    BM_face_verts_kill(BMesh *bm, BMFace *f);
@@ -41,8 +50,8 @@ void    BM_edge_kill(BMesh *bm, BMEdge *e);
 void    BM_vert_kill(BMesh *bm, BMVert *v);
 
 int     bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep);
-int     BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget);
-int     BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget);
+int     BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
+int     BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
 
 int     bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
 
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
index 400f4a5..04b214f 100644
--- a/source/blender/bmesh/intern/bmesh_inline.h
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -37,6 +37,7 @@
 #define BM_elem_flag_set(      ele, hflag, val) _bm_elem_flag_set      (&(ele)->head, hflag, val)
 #define BM_elem_flag_toggle(   ele, hflag)      _bm_elem_flag_toggle   (&(ele)->head, hflag)
 #define BM_elem_flag_merge(    ele_a, ele_b)    _bm_elem_flag_merge    (&(ele_a)->head, &(ele_b)->head)
+#define BM_elem_flag_merge_into(ele, ele_a, ele_b)_bm_elem_flag_merge_into (&(ele)->head, &(ele_a)->head, &(ele_b)->head)
 
 BLI_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
 {
@@ -74,6 +75,11 @@ BLI_INLINE void _bm_elem_flag_merge(BMHeader *head_a, BMHeader *head_b)
 	head_a->hflag = head_b->hflag = head_a->hflag | head_b->hflag;
 }
 
+BLI_INLINE void _bm_elem_flag_merge_into(BMHeader *head, const BMHeader *head_a, const BMHeader *head_b)
+{
+	head->hflag = head_a->hflag | head_b->hflag;
+}
+
 /**
  * notes on #BM_elem_index_set(...) usage,
  * Set index is sometimes abused as temp storage, other times we cant be
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 12fcd51..caf9f3c 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -174,9 +174,9 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
 
 	void **blocks = NULL;
 	float (*cos)[3] = NULL, *w = NULL;
-	BLI_array_fixedstack_declare(cos,     BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(w,       BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(blocks,  BM_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(cos,     BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(w,       BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(blocks,  BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
 	int i;
 	
 	BM_elem_attrs_copy(bm, bm, source, target);
@@ -224,10 +224,8 @@ static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3],
 	/* computer center */
 	BM_face_calc_center_mean(l->f, cent);
 
-	add_v3_v3v3(p, l->prev->v->co, l->v->co);
-	mul_v3_fl(p, 0.5);
-	add_v3_v3v3(n, l->next->v->co, l->v->co);
-	mul_v3_fl(n, 0.5);
+	mid_v3_v3v3(p, l->prev->v->co, l->v->co);
+	mid_v3_v3v3(n, l->next->v->co, l->v->co);
 	
 	copy_v3_v3(v1, cent);
 	copy_v3_v3(v2, p);
@@ -257,7 +255,7 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int
 
 		f1 = fabsf(f1);
 		f2 = fabsf(f2);
-		f1 = minf(f1, f2);
+		f1 = min_ff(f1, f2);
 		CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON);
 	}
 	else {
@@ -345,9 +343,9 @@ static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float
 	float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
 	float eps = FLT_EPSILON * 4000;
 	
-	if (len_v3(l->v->no) == 0.0f)
+	if (is_zero_v3(l->v->no))
 		BM_vert_normal_update_all(l->v);
-	if (len_v3(tl->v->no) == 0.0f)
+	if (is_zero_v3(tl->v->no))
 		BM_vert_normal_update_all(tl->v);
 
 	compute_mdisp_quad(tl, v1, v2, v3, v4, e1, e2);
@@ -490,7 +488,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
 }
 
 /**
- * smoothes boundaries between multires grids,
+ * smooths boundaries between multires grids,
  * including some borders in adjacent faces
  */
 void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
@@ -525,8 +523,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
 
 		sides = (int)sqrt(mdp->totdisp);
 		for (y = 0; y < sides; y++) {
-			add_v3_v3v3(co1, mdn->disps[y * sides], mdl->disps[y]);
-			mul_v3_fl(co1, 0.5);
+			mid_v3_v3v3(co1, mdn->disps[y * sides], mdl->disps[y]);
 
 			copy_v3_v3(mdn->disps[y * sides], co1);
 			copy_v3_v3(mdl->disps[y], co1);
@@ -616,10 +613,10 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
 	void **vblocks = NULL;
 	float (*cos)[3] = NULL, co[3], *w = NULL;
 	float cent[3] = {0.0f, 0.0f, 0.0f};
-	BLI_array_fixedstack_declare(cos,      BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(w,        BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(blocks,   BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(vblocks,  BM_NGON_STACK_SIZE, do_vertex ? source->len : 0, __func__);
+	BLI_array_fixedstack_declare(cos,      BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(w,        BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(blocks,   BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(vblocks,  BM_DEFAULT_NGON_STACK_SIZE, do_vertex ? source->len : 0, __func__);
 	int i, ax, ay;
 
 	BM_elem_attrs_copy(bm, bm, source, target->f);
@@ -692,9 +689,9 @@ void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source)
 	void **blocks = NULL;
 	float (*cos)[3] = NULL, *w = NULL;
 	float cent[3] = {0.0f, 0.0f, 0.0f};
-	BLI_array_fixedstack_declare(cos,      BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(w,        BM_NGON_STACK_SIZE, source->len, __func__);
-	BLI_array_fixedstack_declare(blocks,   BM_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(cos,      BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(w,        BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
+	BLI_array_fixedstack_declare(blocks,   BM_DEFAULT_NGON_STACK_SIZE, source->len, __func__);
 	int i;
 
 	i = 0;
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index 726127f..c3f33eb 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -116,13 +116,34 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons
  *
  * Caller needs to free the array.
  */
-void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len)
+void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
+                        /* optional args to avoid an alloc (normally stack array) */
+                        void **stack_array, int stack_array_size)
 {
 	BMIter iter;
 
+	BLI_assert(stack_array_size == 0 || (stack_array_size && stack_array));
+
+	/* we can't rely on coun't being set */
+	switch (itype) {
+		case BM_VERTS_OF_MESH:
+			iter.count = bm->totvert;
+			break;
+		case BM_EDGES_OF_MESH:
+			iter.count = bm->totedge;
+			break;
+		case BM_FACES_OF_MESH:
+			iter.count = bm->totface;
+			break;
+		default:
+			break;
+	}
+
 	if (BM_iter_init(&iter, bm, itype, data) && iter.count > 0) {
 		BMElem *ele;
-		BMElem **array = MEM_mallocN(sizeof(ele) * iter.count, __func__);
+		BMElem **array = iter.count > stack_array_size ?
+		                 MEM_mallocN(sizeof(ele) * iter.count, __func__) :
+		                 stack_array;
 		int i = 0;
 
 		*r_len = iter.count;  /* set before iterating */
@@ -190,10 +211,10 @@ int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const
  */
 static void init_iterator(BMIter *iter)
 {
-	iter->firstvert = iter->nextvert = NULL;
-	iter->firstedge = iter->nextedge = NULL;
-	iter->firstloop = iter->nextloop = NULL;
-	iter->firstpoly = iter->nextpoly = NULL;
+//	iter->v_first = iter->v_next = NULL; // UNUSED
+	iter->e_first = iter->e_next = NULL;
+	iter->l_first = iter->l_next = NULL;
+//	iter->f_first = iter->f_next = NULL; // UNUSED
 	iter->ldata = NULL;
 }
 
@@ -229,6 +250,7 @@ void  *bmiter__vert_of_mesh_step(BMIter *iter)
 void  bmiter__edge_of_mesh_begin(BMIter *iter)
 {
 	BLI_mempool_iternew(iter->bm->epool, &iter->pooliter);
+	iter->count = iter->bm->totedge;  /* */
 }
 
 void  *bmiter__edge_of_mesh_step(BMIter *iter)
@@ -256,19 +278,19 @@ void  bmiter__edge_of_vert_begin(BMIter *iter)
 {
 	init_iterator(iter);
 	if (iter->vdata->e) {
-		iter->firstedge = iter->vdata->e;
-		iter->nextedge = iter->vdata->e;
+		iter->e_first = iter->vdata->e;
+		iter->e_next = iter->vdata->e;
 	}
 }
 
 void  *bmiter__edge_of_vert_step(BMIter *iter)
 {
-	BMEdge *current = iter->nextedge;
+	BMEdge *current = iter->e_next;
 
-	if (iter->nextedge)
-		iter->nextedge = bmesh_disk_edge_next(iter->nextedge, iter->vdata);
+	if (iter->e_next)
+		iter->e_next = bmesh_disk_edge_next(iter->e_next, iter->vdata);
 	
-	if (iter->nextedge == iter->firstedge) iter->nextedge = NULL;
+	if (iter->e_next == iter->e_first) iter->e_next = NULL;
 
 	return current;
 }
@@ -284,27 +306,27 @@ void  bmiter__face_of_vert_begin(BMIter *iter)
 	if (iter->vdata->e)
 		iter->count = bmesh_disk_facevert_count(iter->vdata);
 	if (iter->count) {
-		iter->firstedge = bmesh_disk_faceedge_find_first(iter->vdata->e, iter->vdata);
-		iter->nextedge = iter->firstedge;
-		iter->firstloop = bmesh_radial_faceloop_find_first(iter->firstedge->l, iter->vdata);
-		iter->nextloop = iter->firstloop;
+		iter->e_first = bmesh_disk_faceedge_find_first(iter->vdata->e, iter->vdata);
+		iter->e_next = iter->e_first;
+		iter->l_first = bmesh_radial_faceloop_find_first(iter->e_first->l, iter->vdata);
+		iter->l_next = iter->l_first;
 	}
 }
 void  *bmiter__face_of_vert_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->count && iter->nextloop) {
+	if (iter->count && iter->l_next) {
 		iter->count--;
-		iter->nextloop = bmesh_radial_faceloop_find_next(iter->nextloop, iter->vdata);
-		if (iter->nextloop == iter->firstloop) {
-			iter->nextedge = bmesh_disk_faceedge_find_next(iter->nextedge, iter->vdata);
-			iter->firstloop = bmesh_radial_faceloop_find_first(iter->nextedge->l, iter->vdata);
-			iter->nextloop = iter->firstloop;
+		iter->l_next = bmesh_radial_faceloop_find_next(iter->l_next, iter->vdata);
+		if (iter->l_next == iter->l_first) {
+			iter->e_next = bmesh_disk_faceedge_find_next(iter->e_next, iter->vdata);
+			iter->l_first = bmesh_radial_faceloop_find_first(iter->e_next->l, iter->vdata);
+			iter->l_next = iter->l_first;
 		}
 	}
 	
-	if (!iter->count) iter->nextloop = NULL;
+	if (!iter->count) iter->l_next = NULL;
 
 	return current ? current->f : NULL;
 }
@@ -322,27 +344,27 @@ void  bmiter__loop_of_vert_begin(BMIter *iter)
 	if (iter->vdata->e)
 		iter->count = bmesh_disk_facevert_count(iter->vdata);
 	if (iter->count) {
-		iter->firstedge = bmesh_disk_faceedge_find_first(iter->vdata->e, iter->vdata);
-		iter->nextedge = iter->firstedge;
-		iter->firstloop = bmesh_radial_faceloop_find_first(iter->firstedge->l, iter->vdata);
-		iter->nextloop = iter->firstloop;
+		iter->e_first = bmesh_disk_faceedge_find_first(iter->vdata->e, iter->vdata);
+		iter->e_next = iter->e_first;
+		iter->l_first = bmesh_radial_faceloop_find_first(iter->e_first->l, iter->vdata);
+		iter->l_next = iter->l_first;
 	}
 }
 void  *bmiter__loop_of_vert_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
 	if (iter->count) {
 		iter->count--;
-		iter->nextloop = bmesh_radial_faceloop_find_next(iter->nextloop, iter->vdata);
-		if (iter->nextloop == iter->firstloop) {
-			iter->nextedge = bmesh_disk_faceedge_find_next(iter->nextedge, iter->vdata);
-			iter->firstloop = bmesh_radial_faceloop_find_first(iter->nextedge->l, iter->vdata);
-			iter->nextloop = iter->firstloop;
+		iter->l_next = bmesh_radial_faceloop_find_next(iter->l_next, iter->vdata);
+		if (iter->l_next == iter->l_first) {
+			iter->e_next = bmesh_disk_faceedge_find_next(iter->e_next, iter->vdata);
+			iter->l_first = bmesh_radial_faceloop_find_first(iter->e_next->l, iter->vdata);
+			iter->l_next = iter->l_first;
 		}
 	}
 	
-	if (!iter->count) iter->nextloop = NULL;
+	if (!iter->count) iter->l_next = NULL;
 
 	
 	if (current) {
@@ -362,19 +384,19 @@ void  bmiter__loops_of_edge_begin(BMIter *iter)
 	/* note sure why this sets ldata ... */
 	init_iterator(iter);
 	
-	iter->firstloop = iter->nextloop = l;
+	iter->l_first = iter->l_next = l;
 }
 
 void  *bmiter__loops_of_edge_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->nextloop) {
-		iter->nextloop = iter->nextloop->radial_next;
+	if (iter->l_next) {
+		iter->l_next = iter->l_next->radial_next;
 	}
 
-	if (iter->nextloop == iter->firstloop) {
-		iter->nextloop = NULL;
+	if (iter->l_next == iter->l_first) {
+		iter->l_next = NULL;
 	}
 
 	if (current) {
@@ -393,23 +415,23 @@ void  bmiter__loops_of_loop_begin(BMIter *iter)
 	/* note sure why this sets ldata ... */
 	init_iterator(iter);
 
-	iter->firstloop = l;
-	iter->nextloop = iter->firstloop->radial_next;
+	iter->l_first = l;
+	iter->l_next = iter->l_first->radial_next;
 	
-	if (iter->nextloop == iter->firstloop)
-		iter->nextloop = NULL;
+	if (iter->l_next == iter->l_first)
+		iter->l_next = NULL;
 }
 
 void  *bmiter__loops_of_loop_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 	
-	if (iter->nextloop) {
-		iter->nextloop = iter->nextloop->radial_next;
+	if (iter->l_next) {
+		iter->l_next = iter->l_next->radial_next;
 	}
 
-	if (iter->nextloop == iter->firstloop) {
-		iter->nextloop = NULL;
+	if (iter->l_next == iter->l_first) {
+		iter->l_next = NULL;
 	}
 
 	if (current) {
@@ -428,20 +450,20 @@ void  bmiter__face_of_edge_begin(BMIter *iter)
 	init_iterator(iter);
 	
 	if (iter->edata->l) {
-		iter->firstloop = iter->edata->l;
-		iter->nextloop = iter->edata->l;
+		iter->l_first = iter->edata->l;
+		iter->l_next = iter->edata->l;
 	}
 }
 
 void  *bmiter__face_of_edge_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->nextloop) {
-		iter->nextloop = iter->nextloop->radial_next;
+	if (iter->l_next) {
+		iter->l_next = iter->l_next->radial_next;
 	}
 
-	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+	if (iter->l_next == iter->l_first) iter->l_next = NULL;
 
 	return current ? current->f : NULL;
 }
@@ -476,15 +498,15 @@ void  *bmiter__vert_of_edge_step(BMIter *iter)
 void  bmiter__vert_of_face_begin(BMIter *iter)
 {
 	init_iterator(iter);
-	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+	iter->l_first = iter->l_next = BM_FACE_FIRST_LOOP(iter->pdata);
 }
 
 void  *bmiter__vert_of_face_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
-	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+	if (iter->l_next) iter->l_next = iter->l_next->next;
+	if (iter->l_next == iter->l_first) iter->l_next = NULL;
 
 	return current ? current->v : NULL;
 }
@@ -496,15 +518,15 @@ void  *bmiter__vert_of_face_step(BMIter *iter)
 void  bmiter__edge_of_face_begin(BMIter *iter)
 {
 	init_iterator(iter);
-	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+	iter->l_first = iter->l_next = BM_FACE_FIRST_LOOP(iter->pdata);
 }
 
 void  *bmiter__edge_of_face_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
-	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+	if (iter->l_next) iter->l_next = iter->l_next->next;
+	if (iter->l_next == iter->l_first) iter->l_next = NULL;
 	
 	return current ? current->e : NULL;
 }
@@ -516,15 +538,15 @@ void  *bmiter__edge_of_face_step(BMIter *iter)
 void  bmiter__loop_of_face_begin(BMIter *iter)
 {
 	init_iterator(iter);
-	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+	iter->l_first = iter->l_next = BM_FACE_FIRST_LOOP(iter->pdata);
 }
 
 void  *bmiter__loop_of_face_step(BMIter *iter)
 {
-	BMLoop *current = iter->nextloop;
+	BMLoop *current = iter->l_next;
 
-	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
-	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+	if (iter->l_next) iter->l_next = iter->l_next->next;
+	if (iter->l_next == iter->l_first) iter->l_next = NULL;
 
 	return current;
 }
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index 8d0eeca..7291bca 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -95,23 +95,27 @@ extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX];
 	for (ele = BM_iter_new(iter, NULL, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++)
 
 /* Iterator Structure */
+/* note: some of these vars are not used,
+ * so they have beem commented to save stack space since this struct is used all over */
 typedef struct BMIter {
 	BLI_mempool_iter pooliter;
 
-	BMVert *firstvert, *nextvert, *vdata;
-	BMEdge *firstedge, *nextedge, *edata;
-	BMLoop *firstloop, *nextloop, *ldata, *l;
-	BMFace *firstpoly, *nextpoly, *pdata;
+	BMVert /* *v_first, *v_next, */ *vdata;
+	BMEdge *e_first, *e_next, *edata;
+	BMLoop *l_first, *l_next, *ldata;
+	BMFace /* *f_first, *f_next, */ *pdata;
 	BMesh *bm;
 	void (*begin)(struct BMIter *iter);
 	void *(*step)(struct BMIter *iter);
+#if 0
 	union {
 		void       *p;
 		int         i;
 		long        l;
 		float       f;
 	} filter;
-	int count;
+#endif
+	int count;  /* note, only some iterators set this, don't rely on it */
 	char itype;
 } BMIter;
 
@@ -121,7 +125,8 @@ __attribute__((warn_unused_result))
 #endif
 ;
 int     BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len);
-void   *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len)
+void   *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
+                          void **stack_array, int stack_array_size)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 #endif
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index e4a838f..9af65d7 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -584,8 +584,7 @@ void BM_editselection_center(BMEditSelection *ese, float r_center[3])
 	}
 	else if (ese->htype == BM_EDGE) {
 		BMEdge *eed = (BMEdge *)ese->ele;
-		add_v3_v3v3(r_center, eed->v1->co, eed->v2->co);
-		mul_v3_fl(r_center, 0.5);
+		mid_v3_v3v3(r_center, eed->v1->co, eed->v2->co);
 	}
 	else if (ese->htype == BM_FACE) {
 		BMFace *efa = (BMFace *)ese->ele;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 0d072da..590edc4 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -42,8 +42,8 @@
 #include "intern/bmesh_private.h"
 
 /* used as an extern, defined in bmesh.h */
-BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512};
-BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512};
+const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512};
+const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512};
 
 static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
 {
@@ -57,11 +57,47 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
 	                               bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER);
 
 #ifdef USE_BMESH_HOLES
-	bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE);
+	bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), 512, 512, 0);
 #endif
+}
 
-	/* allocate one flag pool that we don't get rid of. */
-	bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, 0);
+void BM_mesh_elem_toolflags_ensure(BMesh *bm)
+{
+	if (bm->toolflagpool == NULL) {
+		const int totflagpool_size = max_ii(512, bm->totvert + bm->totedge + bm->totface);
+		BLI_mempool *toolflagpool;
+
+		BMIter iter;
+		BMElemF *ele;
+		const char iter_types[3] = {BM_VERTS_OF_MESH,
+		                            BM_EDGES_OF_MESH,
+		                            BM_FACES_OF_MESH};
+
+		int i;
+
+		BLI_assert(bm->totflags == 0);
+
+		/* allocate one flag pool that we don't get rid of. */
+		toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), totflagpool_size, 512, 0);
+
+
+		for (i = 0; i < 3; i++) {
+			BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
+				ele->oflags = BLI_mempool_calloc(toolflagpool);
+			}
+		}
+
+		bm->toolflagpool = toolflagpool;
+		bm->totflags = 1;
+	}
+}
+
+void BM_mesh_elem_toolflags_clear(BMesh *bm)
+{
+	if (bm->toolflagpool) {
+		BLI_mempool_destroy(bm->toolflagpool);
+		bm->toolflagpool = NULL;
+	}
 }
 
 /**
@@ -73,7 +109,7 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
  *
  * \note ob is needed by multires
  */
-BMesh *BM_mesh_create(BMAllocTemplate *allocsize)
+BMesh *BM_mesh_create(const BMAllocTemplate *allocsize)
 {
 	/* allocate the structure */
 	BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
@@ -83,7 +119,12 @@ BMesh *BM_mesh_create(BMAllocTemplate *allocsize)
 
 	/* allocate one flag pool that we don't get rid of. */
 	bm->stackdepth = 1;
-	bm->totflags = 1;
+	bm->totflags = 0;
+
+	CustomData_reset(&bm->vdata);
+	CustomData_reset(&bm->edata);
+	CustomData_reset(&bm->ldata);
+	CustomData_reset(&bm->pdata);
 
 	return bm;
 }
@@ -138,7 +179,7 @@ void BM_mesh_data_free(BMesh *bm)
 	BLI_mempool_destroy(bm->fpool);
 
 	/* destroy flag pool */
-	BLI_mempool_destroy(bm->toolflagpool);
+	BM_mesh_elem_toolflags_clear(bm);
 
 #ifdef USE_BMESH_HOLES
 	BLI_mempool_destroy(bm->looplistpool);
@@ -165,6 +206,11 @@ void BM_mesh_clear(BMesh *bm)
 
 	bm->stackdepth = 1;
 	bm->totflags = 1;
+
+	CustomData_reset(&bm->vdata);
+	CustomData_reset(&bm->edata);
+	CustomData_reset(&bm->ldata);
+	CustomData_reset(&bm->pdata);
 }
 
 /**
@@ -295,7 +341,7 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from
 	/* switch multires data out of tangent space */
 	if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
 		BMEditMesh *em = BMEdit_Create(bm, FALSE);
-		DerivedMesh *dm = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
+		DerivedMesh *dm = CDDM_from_editbmesh(em, TRUE, FALSE);
 		MDisps *mdisps;
 		BMFace *f;
 		BMIter iter;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 8b6ef9a..8baba56 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -29,7 +29,9 @@
 
 struct BMAllocTemplate;
 
-BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize);
+void   BM_mesh_elem_toolflags_ensure(BMesh *bm);
+void   BM_mesh_elem_toolflags_clear(BMesh *bm);
+BMesh *BM_mesh_create(const struct BMAllocTemplate *allocsize);
 
 void   BM_mesh_free(BMesh *bm);
 void   BM_mesh_data_free(BMesh *bm);
@@ -55,7 +57,11 @@ typedef struct BMAllocTemplate {
 	int totvert, totedge, totloop, totface;
 } BMAllocTemplate;
 
-extern BMAllocTemplate bm_mesh_allocsize_default;
-extern BMAllocTemplate bm_mesh_chunksize_default;
+extern const BMAllocTemplate bm_mesh_allocsize_default;
+extern const BMAllocTemplate bm_mesh_chunksize_default;
+
+enum {
+	BM_MESH_CREATE_USE_TOOLFLAGS = (1 << 0)
+};
 
 #endif /* __BMESH_MESH_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index b0a9168..388d148 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -206,7 +206,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 	CustomData_bmesh_init_pool(&bm->pdata, me->totpoly, BM_FACE);
 
 	for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) {
-		v = BM_vert_create(bm, keyco && set_key ? keyco[i] : mvert->co, NULL);
+		v = BM_vert_create(bm, keyco && set_key ? keyco[i] : mvert->co, NULL, BM_CREATE_SKIP_CD);
 		BM_elem_index_set(v, i); /* set_ok */
 		vt[i] = v;
 
@@ -220,11 +220,11 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 
 		normal_short_to_float_v3(v->no, mvert->no);
 
-		BM_elem_float_data_set(&bm->vdata, v, CD_BWEIGHT, (float)mvert->bweight / 255.0f);
-
-		/* Copy Custom Dat */
+		/* Copy Custom Data */
 		CustomData_to_bmesh_block(&me->vdata, &bm->vdata, i, &v->head.data);
 
+		BM_elem_float_data_set(&bm->vdata, v, CD_BWEIGHT, (float)mvert->bweight / 255.0f);
+
 		/* set shapekey data */
 		if (me->key) {
 			/* set shape key original index */
@@ -254,7 +254,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 
 	medge = me->medge;
 	for (i = 0; i < me->totedge; i++, medge++) {
-		e = BM_edge_create(bm, vt[medge->v1], vt[medge->v2], NULL, FALSE);
+		e = BM_edge_create(bm, vt[medge->v1], vt[medge->v2], NULL, BM_CREATE_SKIP_CD);
 		BM_elem_index_set(e, i); /* set_ok */
 		et[i] = e;
 
@@ -312,7 +312,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 		}
 #endif
 
-		f = BM_face_create(bm, verts, fedges, mpoly->totloop, FALSE);
+		f = BM_face_create(bm, verts, fedges, mpoly->totloop, BM_CREATE_SKIP_CD);
 
 		if (UNLIKELY(f == NULL)) {
 			printf("%s: Warning! Bad face in mesh"
@@ -338,7 +338,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 		j = 0;
 		BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, j) {
 			/* Save index of correspsonding MLoop */
-			BM_elem_index_set(l, mpoly->loopstart + j); /* set_loop */
+			CustomData_to_bmesh_block(&me->ldata, &bm->ldata, mpoly->loopstart + j, &l->head.data);
 		}
 
 		/* Copy Custom Data */
@@ -347,23 +347,6 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
 
 	bm->elem_index_dirty &= ~BM_FACE; /* added in order, clear dirty flag */
 
-	{
-		BMIter fiter;
-		BMIter liter;
-
-		/* Copy over loop CustomData. Doing this in a separate loop isn't necessary
-		 * but is an optimization, to avoid copying a bunch of interpolated customdata
-		 * for each BMLoop (from previous BMLoops using the same edge), always followed
-		 * by freeing the interpolated data and overwriting it with data from the Mesh. */
-		BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
-			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
-				int li = BM_elem_index_get(l);
-				CustomData_to_bmesh_block(&me->ldata, &bm->ldata, li, &l->head.data);
-				BM_elem_index_set(l, 0); /* set_loop */
-			}
-		}
-	}
-
 	if (me->mselect && me->totselect != 0) {
 
 		BMVert **vert_array = MEM_callocN(sizeof(BMVert *) * bm->totvert,
@@ -536,7 +519,9 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
 	oldverts = me->mvert;
 
 	/* don't free this yet */
-	CustomData_set_layer(&me->vdata, CD_MVERT, NULL);
+	if (oldverts) {
+		CustomData_set_layer(&me->vdata, CD_MVERT, NULL);
+	}
 
 	/* free custom data */
 	CustomData_free(&me->vdata, me->totvert);
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index 3195899..8951606 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -118,7 +118,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
 		e = v->e;
 		do {
 			e = bmesh_disk_edge_next(e, v);
-			if (!(BM_edge_share_face_count(e, v->e))) {
+			if (!(BM_edge_share_face_check(e, v->e))) {
 				keepedge = e;
 				baseedge = v->e;
 				break;
@@ -130,6 +130,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
 	/* this code for handling 2 and 3-valence verts
 	 * may be totally bad */
 	if (keepedge == NULL && len == 3) {
+#if 0
 		/* handle specific case for three-valence.  solve it by
 		 * increasing valence to four.  this may be hackish. .  */
 		BMLoop *loop = e->l;
@@ -140,6 +141,14 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
 		if (!BM_disk_dissolve(bm, v)) {
 			return FALSE;
 		}
+#else
+		if (UNLIKELY(!BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE))) {
+			return FALSE;
+		}
+		else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, FALSE, TRUE))) {
+			return FALSE;
+		}
+#endif
 		return TRUE;
 	}
 	else if (keepedge == NULL && len == 2) {
@@ -188,8 +197,9 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
 			} while (e != v->e);
 		}
 
-		/* collapse the verte */
-		e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, TRUE, TRUE);
+		/* collapse the vertex */
+		/* note, the baseedge can be a boundary of manifold, use this as join_faces arg */
+		e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, !BM_edge_is_boundary(baseedge), TRUE);
 
 		if (!e) {
 			return FALSE;
@@ -428,7 +438,7 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
 			/* bmesh_semv returns in newe the edge going from newv to tv */
 			copy_v3_v3(newv->co, cos[i]);
 
-			/* interpolate the loop data for the loops with v==newv, using orig face */
+			/* interpolate the loop data for the loops with (v == newv), using orig face */
 			for (j = 0; j < 2; j++) {
 				BMEdge *e_iter = (j == 0) ? e : newe;
 				BMLoop *l_iter = e_iter->l;
@@ -461,9 +471,6 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
  * both collapse a vertex and return a new edge.
  * Except this takes a factor and merges custom data.
  *
- *  BMESH_TODO:
- *    Insert error checking for KV valance.
- *
  * \param bm The bmesh
  * \param ke The edge to collapse
  * \param kv The vertex  to collapse into the edge
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 362157a..58c6e05 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -47,9 +47,9 @@
  * "in" (e.g. edgefacein).  for three-type slots, use geom.
  *
  * for output slots, for single-type geometry slots, use the type name plus "out",
- * (e.g. vertout), for double-type slots, use the two type names plus "out",
- * (e.g. vertfaceout), for three-type slots, use geom.  note that you can also
- * use more esohteric names (e.g. skirtout) so long as the comment next to the
+ * (e.g. verts.out), for double-type slots, use the two type names plus "out",
+ * (e.g. vertfaces.out), for three-type slots, use geom.  note that you can also
+ * use more esohteric names (e.g. geom_skirt.out) so long as the comment next to the
  * slot definition tells you what types of elements are in it.
  *
  */
@@ -59,8 +59,10 @@
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
-/* ok, I'm going to write a little docgen script. so all
- * bmop comments must conform to the following template/rules:
+/* The formatting of these bmesh operators is parsed by
+ * 'doc/python_api/rst_from_bmesh_opdefines.py'
+ * for use in python docs, so reStructuredText may be used
+ * rather then doxygen syntax.
  *
  * template (py quotes used because nested comments don't work
  * on all C compilers):
@@ -79,230 +81,291 @@
  * so the first line is the "title" of the bmop.
  * subsequent line blocks separated by blank lines
  * are paragraphs.  individual descriptions of slots
- * would be extracted from comments
- * next to them, e.g.
+ * are extracted from comments next to them.
  *
- * {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output slot, boundary region
+ * eg:
+ *     {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},  """ output slot, boundary region """
  *
- * the doc generator would automatically detect the presence of "output slot"
- * and flag the slot as an output.  the same happens for "input slot".  also
- * note that "edges", "faces", "verts", "loops", and "geometry" are valid
- * substitutions for "slot".
+ * ... or:
  *
- * note that slots default to being input slots.
+ * """ output slot, boundary region """
+ *     {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ *
+ * Both are acceptable.
+ * note that '//' comments are ignored.
  */
 
 /*
- * Vertex Smooth
+ * Vertex Smooth.
  *
  * Smooths vertices by using a basic vertex averaging scheme.
  */
 static BMOpDefine bmo_smooth_vert_def = {
 	"smooth_vert",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
-	 {BMO_OP_SLOT_BOOL, "mirror_clip_x"}, /* set vertices close to the x axis before the operation to 0 */
-	 {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, /* set vertices close to the y axis before the operation to 0 */
-	 {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, /* set vertices close to the z axis before the operation to 0 */
-	 {BMO_OP_SLOT_FLT, "clipdist"}, /* clipping threshod for the above three slots */
-	 {BMO_OP_SLOT_BOOL, "use_axis_x"}, /* smooth vertices along X axis */
-	 {BMO_OP_SLOT_BOOL, "use_axis_y"}, /* smooth vertices along Y axis */
-	 {BMO_OP_SLOT_BOOL, "use_axis_z"}, /* smooth vertices along Z axis */
-	{0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* input vertices */
+	 {"mirror_clip_x", BMO_OP_SLOT_BOOL},   /* set vertices close to the x axis before the operation to 0 */
+	 {"mirror_clip_y", BMO_OP_SLOT_BOOL},   /* set vertices close to the y axis before the operation to 0 */
+	 {"mirror_clip_z", BMO_OP_SLOT_BOOL},   /* set vertices close to the z axis before the operation to 0 */
+	 {"clip_dist",  BMO_OP_SLOT_FLT},       /* clipping threshold for the above three slots */
+	 {"use_axis_x", BMO_OP_SLOT_BOOL},      /* smooth vertices along X axis */
+	 {"use_axis_y", BMO_OP_SLOT_BOOL},      /* smooth vertices along Y axis */
+	 {"use_axis_z", BMO_OP_SLOT_BOOL},      /* smooth vertices along Z axis */
+	{{'\0'}},
 	},
+	{{{'\0'}}},  /* no output */
 	bmo_smooth_vert_exec,
 	0
 };
 
 /*
- * Right-Hand Faces
+ * Vertext Smooth Laplacian.
  *
- * Computes an "outside" normal for the specified input faces.
+ * Smooths vertices by using Laplacian smoothing propose by.
+ * Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow.
  */
+static BMOpDefine bmo_smooth_laplacian_vert_def = {
+	"smooth_laplacian_vert",
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* input vertices */
+	 {"lambda", BMO_OP_SLOT_FLT},           /* lambda param */
+	 {"lambda_border", BMO_OP_SLOT_FLT},    /* lambda param in border */
+	 {"use_x", BMO_OP_SLOT_BOOL},           /* Smooth object along X axis */
+	 {"use_y", BMO_OP_SLOT_BOOL},           /* Smooth object along Y axis */
+	 {"use_z", BMO_OP_SLOT_BOOL},           /* Smooth object along Z axis */
+	 {"preserve_volume", BMO_OP_SLOT_BOOL}, /* Apply volume preservation after smooth */
+	{{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
+	bmo_smooth_laplacian_vert_exec,
+	0
+};
 
+/*
+ * Right-Hand Faces.
+ *
+ * Computes an "outside" normal for the specified input faces.
+ */
 static BMOpDefine bmo_recalc_face_normals_def = {
 	"recalc_face_normals",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
-	 {BMO_OP_SLOT_BOOL, "do_flip"}, /* internal flag, used by bmesh_rationalize_normals */
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {"use_flip", BMO_OP_SLOT_BOOL},  /* Reverse the result */
+	 {{'\0'}},
 	},
+	{{{'\0'}}},  /* no output */
 	bmo_recalc_face_normals_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Region Extend
+ * Region Extend.
  *
  * used to implement the select more/less tools.
  * this puts some geometry surrounding regions of
- * geometry in geom into geomout.
+ * geometry in geom into geom.out.
  *
- * if usefaces is 0 then geomout spits out verts and edges,
+ * if use_faces is 0 then geom.out spits out verts and edges,
  * otherwise it spits out faces.
  */
 static BMOpDefine bmo_region_extend_def = {
 	"region_extend",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output slot, computed boundary geometry. */
-	 {BMO_OP_SLOT_BOOL, "constrict"}, /* find boundary inside the regions, not outside. */
-	 {BMO_OP_SLOT_BOOL, "use_faces"}, /* extend from faces instead of edges */
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},     /* input geometry */
+	 {"use_constrict", BMO_OP_SLOT_BOOL},   /* find boundary inside the regions, not outside. */
+	 {"use_faces", BMO_OP_SLOT_BOOL},       /* extend from faces instead of edges */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
+	 {{'\0'}},
 	},
 	bmo_region_extend_exec,
 	0
 };
 
 /*
- * Edge Rotate
+ * Edge Rotate.
  *
  * Rotates edges topologically.  Also known as "spin edge" to some people.
- * Simple example: [/] becomes [|] then [\].
+ * Simple example: ``[/] becomes [|] then [\]``.
  */
 static BMOpDefine bmo_rotate_edges_def = {
 	"rotate_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly spun edges */
-	 {BMO_OP_SLOT_BOOL, "ccw"}, /* rotate edge counter-clockwise if true, othewise clockwise */
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
+	 {"use_ccw", BMO_OP_SLOT_BOOL},         /* rotate edge counter-clockwise if true, otherwise clockwise */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly spun edges */
+	 {{'\0'}},
 	},
 	bmo_rotate_edges_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Reverse Faces
+ * Reverse Faces.
  *
- * Reverses the winding (vertex order) of faces.  This has the effect of
- * flipping the normal.
+ * Reverses the winding (vertex order) of faces.
+ * This has the effect of flipping the normal.
  */
 static BMOpDefine bmo_reverse_faces_def = {
 	"reverse_faces",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {{'\0'}},
 	},
+	{{{'\0'}}},  /* no output */
 	bmo_reverse_faces_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Edge Bisect
+ * Edge Bisect.
  *
  * Splits input edges (but doesn't do anything else).
  * This creates a 2-valence vert.
  */
 static BMOpDefine bmo_bisect_edges_def = {
 	"bisect_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
-	 {BMO_OP_SLOT_INT, "numcuts"}, /* number of cuts */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, /* newly created vertices and edges */
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
+	 {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* newly created vertices and edges */
+	 {{'\0'}},
 	},
 	bmo_bisect_edges_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Mirror
+ * Mirror.
  *
  * Mirrors geometry along an axis.  The resulting geometry is welded on using
- * mergedist.  Pairs of original/mirrored vertices are welded using the mergedist
+ * merge_dist.  Pairs of original/mirrored vertices are welded using the merge_dist
  * parameter (which defines the minimum distance for welding to happen).
  */
-
 static BMOpDefine bmo_mirror_def = {
 	"mirror",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
-	 {BMO_OP_SLOT_MAT, "mat"}, /* matrix defining the mirror transformation */
-	 {BMO_OP_SLOT_FLT, "mergedist"}, /* maximum distance for merging.  does no merging if 0. */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "newout"}, /* output geometry, mirrored */
-	 {BMO_OP_SLOT_INT,         "axis"}, /* the axis to use, 0, 1, or 2 for x, y, z */
-	 {BMO_OP_SLOT_BOOL,        "mirror_u"}, /* mirror UVs across the u axis */
-	 {BMO_OP_SLOT_BOOL,        "mirror_v"}, /* mirror UVs across the v axis */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},     /* input geometry */
+	 {"matrix",          BMO_OP_SLOT_MAT},   /* matrix defining the mirror transformation */
+	 {"merge_dist",      BMO_OP_SLOT_FLT},   /* maximum distance for merging.  does no merging if 0. */
+	 {"axis",            BMO_OP_SLOT_INT},   /* the axis to use, 0, 1, or 2 for x, y, z */
+	 {"mirror_u",        BMO_OP_SLOT_BOOL},  /* mirror UVs across the u axis */
+	 {"mirror_v",        BMO_OP_SLOT_BOOL},  /* mirror UVs across the v axis */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry, mirrored */
+	 {{'\0'}},
+	},
 	bmo_mirror_exec,
 	0,
 };
 
 /*
- * Find Doubles
+ * Find Doubles.
  *
- * Takes input verts and find vertices they should weld to.  Outputs a
- * mapping slot suitable for use with the weld verts bmop.
+ * Takes input verts and find vertices they should weld to.
+ * Outputs a mapping slot suitable for use with the weld verts bmop.
  *
  * If keep_verts is used, vertices outside that set can only be merged
  * with vertices in that set.
  */
 static BMOpDefine bmo_find_doubles_def = {
 	"find_doubles",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "keep_verts"}, /* list of verts to keep */
-	 {BMO_OP_SLOT_FLT,         "dist"}, /* minimum distance */
-	 {BMO_OP_SLOT_MAPPING, "targetmapout"},
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
+	 {"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* list of verts to keep */
+	 {"dist",         BMO_OP_SLOT_FLT}, /* minimum distance */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"targetmap.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {{'\0'}},
+	},
 	bmo_find_doubles_exec,
 	0,
 };
 
 /*
- * Remove Doubles
+ * Remove Doubles.
  *
  * Finds groups of vertices closer then dist and merges them together,
  * using the weld verts bmop.
  */
 static BMOpDefine bmo_remove_doubles_def = {
 	"remove_doubles",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
-	 {BMO_OP_SLOT_FLT,         "dist"}, /* minimum distance */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
+	 {"dist",         BMO_OP_SLOT_FLT}, /* minimum distance */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_remove_doubles_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Auto Merge
+ * Auto Merge.
  *
- * Finds groups of vertices closer then dist and merges them together,
+ * Finds groups of vertices closer then **dist** and merges them together,
  * using the weld verts bmop.  The merges must go from a vert not in
- * verts to one in verts.
+ * **verts** to one in **verts**.
  */
 static BMOpDefine bmo_automerge_def = {
 	"automerge",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
-	 {BMO_OP_SLOT_FLT,         "dist"}, /* minimum distance */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
+	 {"dist",         BMO_OP_SLOT_FLT}, /* minimum distance */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_automerge_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Collapse Connected
+ * Collapse Connected.
  *
  * Collapses connected vertices
  */
 static BMOpDefine bmo_collapse_def = {
 	"collapse",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edge */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_collapse_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
-
 /*
- * Facedata point Merge
+ * Face-Data Point Merge.
  *
  * Merge uv/vcols at a specific vertex.
  */
 static BMOpDefine bmo_pointmerge_facedata_def = {
 	"pointmerge_facedata",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "snapv"}, /* snap verte */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* input vertices */
+	 {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},    /* snap vertex */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_pointmerge_facedata_exec,
 	0,
 };
 
 /*
- * Average Vertices Facevert Data
+ * Average Vertices Facevert Data.
  *
  * Merge uv/vcols associated with the input vertices at
  * the bounding box center. (I know, it's not averaging but
@@ -310,145 +373,189 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
  */
 static BMOpDefine bmo_average_vert_facedata_def = {
 	"average_vert_facedata",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertice */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_average_vert_facedata_exec,
 	0,
 };
 
 /*
- * Point Merge
+ * Point Merge.
  *
  * Merge verts together at a point.
  */
 static BMOpDefine bmo_pointmerge_def = {
 	"pointmerge",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
-	 {BMO_OP_SLOT_VEC,         "merge_co"},
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertice */
+	 {"merge_co",         BMO_OP_SLOT_VEC},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_pointmerge_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Collapse Connected UVs
+ * Collapse Connected UV's.
  *
  * Collapses connected UV vertices.
  */
 static BMOpDefine bmo_collapse_uvs_def = {
 	"collapse_uvs",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edge */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_collapse_uvs_exec,
 	0,
 };
 
 /*
- * Weld Verts
+ * Weld Verts.
  *
- * Welds verts together (kindof like remove doubles, merge, etc, all of which
+ * Welds verts together (kind-of like remove doubles, merge, etc, all of which
  * use or will use this bmop).  You pass in mappings from vertices to the vertices
  * they weld with.
  */
 static BMOpDefine bmo_weld_verts_def = {
 	"weld_verts",
-	{{BMO_OP_SLOT_MAPPING, "targetmap"}, /* maps welded vertices to verts they should weld to */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	/* maps welded vertices to verts they should weld to */
+	{{"targetmap", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_weld_verts_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Make Vertex
+ * Make Vertex.
  *
  * Creates a single vertex; this bmop was necessary
  * for click-create-vertex.
  */
 static BMOpDefine bmo_create_vert_def = {
 	"create_vert",
-	{{BMO_OP_SLOT_VEC, "co"},  /* the coordinate of the new vert */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "newvertout"},  /* the new vert */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"co", BMO_OP_SLOT_VEC},  /* the coordinate of the new vert */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* the new vert */
+	 {{'\0'}},
+	},
 	bmo_create_vert_exec,
 	0,
 };
 
 /*
- * Join Triangles
+ * Join Triangles.
  *
  * Tries to intelligently join triangles according
  * to various settings and stuff.
  */
 static BMOpDefine bmo_join_triangles_def = {
 	"join_triangles",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},    /* input geometry. */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},  /* joined faces */
-	 {BMO_OP_SLOT_BOOL, "cmp_sharp"},
-	 {BMO_OP_SLOT_BOOL, "cmp_uvs"},
-	 {BMO_OP_SLOT_BOOL, "cmp_vcols"},
-	 {BMO_OP_SLOT_BOOL, "cmp_materials"},
-	 {BMO_OP_SLOT_FLT, "limit"},
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input geometry. */
+	 {"cmp_sharp", BMO_OP_SLOT_BOOL},
+	 {"cmp_uvs", BMO_OP_SLOT_BOOL},
+	 {"cmp_vcols", BMO_OP_SLOT_BOOL},
+	 {"cmp_materials", BMO_OP_SLOT_BOOL},
+	 {"limit", BMO_OP_SLOT_FLT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},  /* joined faces */
+	 {{'\0'}},
+	},
 	bmo_join_triangles_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Contextual Create
+ * Contextual Create.
  *
- * This is basically fkey, it creates
+ * This is basically F-key, it creates
  * new faces from vertices, makes stuff from edge nets,
- * makes wire edges, etc.  It also dissolves
- * faces.
+ * makes wire edges, etc.  It also dissolves faces.
  *
  * Three verts become a triangle, four become a quad.  Two
  * become a wire edge.
  */
 static BMOpDefine bmo_contextual_create_def = {
 	"contextual_create",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry. */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},     /* newly-made face(s) */
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},     /* input geometry. */
+	 {"mat_nr",         BMO_OP_SLOT_INT},   /* material to use */
+	 {"use_smooth",        BMO_OP_SLOT_BOOL}, /* smooth to use */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */
 	/* note, this is for stand-alone edges only, not edges which are apart of newly created faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},     /* newly-made edge(s) */
-	 {BMO_OP_SLOT_INT,         "mat_nr"},      /* material to use */
-	 {BMO_OP_SLOT_BOOL,        "use_smooth"},  /* material to use */
-	 {0, /* null-terminating sentinel */}},
+	 {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */
+	 {{'\0'}},
+	},
 	bmo_contextual_create_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES,
 };
 
 /*
- * Bridge edge loops with faces
+ * Bridge edge loops with faces.
  */
 static BMOpDefine bmo_bridge_loops_def = {
 	"bridge_loops",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
-	 {BMO_OP_SLOT_BOOL,        "use_merge"},
-	 {BMO_OP_SLOT_FLT,         "merge_factor"},
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edge */
+	 {"use_merge",        BMO_OP_SLOT_BOOL},
+	 {"merge_factor",         BMO_OP_SLOT_FLT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
+	 {{'\0'}},
+	},
 	bmo_bridge_loops_exec,
 	0,
 };
 
+/*
+ * Edge Net Fill.
+ *
+ * Create faces defined by enclosed edges.
+ */
 static BMOpDefine bmo_edgenet_fill_def = {
 	"edgenet_fill",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
-	 {BMO_OP_SLOT_MAPPING,     "restrict"}, /* restricts edges to groups.  maps edges to integer */
-	 {BMO_OP_SLOT_BOOL,        "use_restrict"},
-	 {BMO_OP_SLOT_BOOL,        "use_fill_check"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */
-	 {BMO_OP_SLOT_MAPPING,     "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},     /* new face */
-	 {BMO_OP_SLOT_INT,         "mat_nr"},      /* material to use */
-	 {BMO_OP_SLOT_BOOL,        "use_smooth"},  /* material to use */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edge */
+	/* restricts edges to groups.  maps edges to integer */
+	 {"restrict",     BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_BOOL}},
+	 {"use_restrict",        BMO_OP_SLOT_BOOL},
+	 {"use_fill_check",        BMO_OP_SLOT_BOOL},
+	 {"exclude_faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* list of faces to ignore for manifold check */
+	 {"mat_nr",         BMO_OP_SLOT_INT},      /* material to use */
+	 {"use_smooth",        BMO_OP_SLOT_BOOL},  /* material to use */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	/* maps new faces to the group numbers they came from */
+	{{"face_groupmap.out",     BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},     /* new face */
+	 {{'\0'}},
+	},
 	bmo_edgenet_fill_exec,
 	0,
 };
 
 /*
- * Edgenet Prepare
+ * Edgenet Prepare.
  *
  * Identifies several useful edge loop cases and modifies them so
  * they'll become a face when edgenet_fill is called.  The cases covered are:
@@ -459,699 +566,997 @@ static BMOpDefine bmo_edgenet_fill_def = {
  */
 static BMOpDefine bmo_edgenet_prepare_def = {
 	"edgenet_prepare",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},    /* input edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},  /* new edges */
-	 {0, /* null-terminating sentinel */}},
-	bmo_edgenet_prepare,
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},  /* new edges */
+	 {{'\0'}},
+	},
+	bmo_edgenet_prepare_exec,
 	0,
 };
 
 /*
- * Rotate
+ * Rotate.
  *
- * Rotate vertices around a center, using a 3x3 rotation
- * matrix.  Equivalent of the old rotateflag function.
+ * Rotate vertices around a center, using a 3x3 rotation matrix.
  */
 static BMOpDefine bmo_rotate_def = {
 	"rotate",
-	{{BMO_OP_SLOT_VEC, "cent"},  /* center of rotation */
-	 {BMO_OP_SLOT_MAT, "mat"},   /* matrix defining rotation */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"},  /* input vertices */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"cent",            BMO_OP_SLOT_VEC},  /* center of rotation */
+	 {"matrix",          BMO_OP_SLOT_MAT},  /* matrix defining rotation */
+	 {"verts",           BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* input vertices */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_rotate_exec,
 	0,
 };
 
 /*
- * Translate
+ * Translate.
  *
- * Translate vertices by an offset.  Equivalent of the
- * old translateflag function.
+ * Translate vertices by an offset.
  */
 static BMOpDefine bmo_translate_def = {
 	"translate",
-	{{BMO_OP_SLOT_VEC, "vec"},  /* translation offset */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"},  /* input vertices */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"vec", BMO_OP_SLOT_VEC},  /* translation offset */
+	 {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* input vertices */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_translate_exec,
 	0,
 };
 
 /*
- * Scale
+ * Scale.
  *
  * Scales vertices by an offset.
  */
 static BMOpDefine bmo_scale_def = {
 	"scale",
-	{{BMO_OP_SLOT_VEC, "vec"},  /* scale factor */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"},  /* input vertices */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"vec", BMO_OP_SLOT_VEC},  /* scale factor */
+	 {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* input vertices */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_scale_exec,
 	0,
 };
 
 
 /*
- * Transform
+ * Transform.
  *
  * Transforms a set of vertices by a matrix.  Multiplies
  * the vertex coordinates with the matrix.
  */
 static BMOpDefine bmo_transform_def = {
 	"transform",
-	{{BMO_OP_SLOT_MAT, "mat"},  /* transform matrix */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"},  /* input vertices */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"matrix",          BMO_OP_SLOT_MAT},  /* transform matrix */
+	 {"verts",           BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* input vertices */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_transform_exec,
 	0,
 };
 
 /*
- * Object Load BMesh
+ * Object Load BMesh.
  *
  * Loads a bmesh into an object/mesh.  This is a "private"
  * bmop.
  */
 static BMOpDefine bmo_object_load_bmesh_def = {
 	"object_load_bmesh",
-	{{BMO_OP_SLOT_PTR, "scene"},
-	 {BMO_OP_SLOT_PTR, "object"},
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"scene", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_SCENE}},
+	 {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_object_load_bmesh_exec,
 	0,
 };
 
 
 /*
- * BMesh to Mesh
+ * BMesh to Mesh.
  *
  * Converts a bmesh to a Mesh.  This is reserved for exiting editmode.
  */
 static BMOpDefine bmo_bmesh_to_mesh_def = {
 	"bmesh_to_mesh",
-	{{BMO_OP_SLOT_PTR, "mesh"},    /* pointer to a mesh structure to fill in */
-	 {BMO_OP_SLOT_PTR, "object"},  /* pointer to an object structure */
-	 {BMO_OP_SLOT_BOOL, "notessellation"},  /* don't calculate mfaces */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{
+	/* pointer to a mesh structure to fill in */
+	 {"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}},
+	/* pointer to an object structure */
+	 {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
+	 {"skip_tessface", BMO_OP_SLOT_BOOL},  /* don't calculate mfaces */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_bmesh_to_mesh_exec,
 	0,
 };
 
 /*
- * Mesh to BMesh
+ * Mesh to BMesh.
  *
  * Load the contents of a mesh into the bmesh.  this bmop is private, it's
  * reserved exclusively for entering editmode.
  */
 static BMOpDefine bmo_mesh_to_bmesh_def = {
 	"mesh_to_bmesh",
-	{{BMO_OP_SLOT_PTR, "mesh"},    /* pointer to a Mesh structure */
-	 {BMO_OP_SLOT_PTR, "object"},  /* pointer to an Object structure */
-	 {BMO_OP_SLOT_BOOL, "set_shapekey"},  /* load active shapekey coordinates into verts */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{
+	/* pointer to a Mesh structure */
+	 {"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}},
+	/* pointer to an Object structure */
+	 {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
+	 {"use_shapekey", BMO_OP_SLOT_BOOL},  /* load active shapekey coordinates into verts */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_mesh_to_bmesh_exec,
 	0
 };
 
 /*
- * Individual Face Extrude
+ * Individual Face Extrude.
  *
  * Extrudes faces individually.
  */
 static BMOpDefine bmo_extrude_discrete_faces_def = {
 	"extrude_discrete_faces",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},     /* input faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},   /* output faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "skirtout"},  /* output skirt geometry, faces and edges */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},     /* input faces */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},   /* output faces */
+	 {{'\0'}},
+	},
 	bmo_extrude_discrete_faces_exec,
 	0
 };
 
 /*
- * Extrude Only Edges
+ * Extrude Only Edges.
  *
  * Extrudes Edges into faces, note that this is very simple, there's no fancy
  * winged extrusion.
  */
 static BMOpDefine bmo_extrude_edge_only_def = {
 	"extrude_edge_only",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},    /* input vertices */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},  /* output geometry */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input vertices */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},  /* output geometry */
+	 {{'\0'}},
+	},
 	bmo_extrude_edge_only_exec,
 	0
 };
 
 /*
- * Individual Vertex Extrude
+ * Individual Vertex Extrude.
  *
  * Extrudes wire edges from vertices.
  */
 static BMOpDefine bmo_extrude_vert_indiv_def = {
 	"extrude_vert_indiv",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},    /* input vertices */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},  /* output wire edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "vertout"},  /* output vertices */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* input vertices */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},  /* output wire edges */
+	 {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* output vertices */
+	 {{'\0'}},
+	},
 	bmo_extrude_vert_indiv_exec,
 	0
 };
 
+/*
+ * Connect Verts.
+ *
+ * Split faces by adding edges that connect **verts**.
+ */
 static BMOpDefine bmo_connect_verts_def = {
 	"connect_verts",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {{'\0'}},
+	},
 	bmo_connect_verts_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Extrude Faces.
+ *
+ * Extrude operator (does not transform)
+ */
 static BMOpDefine bmo_extrude_face_region_def = {
 	"extrude_face_region",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edgefacein"},
-	 {BMO_OP_SLOT_MAPPING, "exclude"},
-	 {BMO_OP_SLOT_BOOL, "alwayskeeporig"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},     /* edges and faces */
+	 {"edges_exclude", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}},
+	 {"use_keep_orig", BMO_OP_SLOT_BOOL},   /* keep original geometry */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_extrude_face_region_exec,
 	0
 };
 
+/*
+ * Dissolve Verts.
+ */
 static BMOpDefine bmo_dissolve_verts_def = {
 	"dissolve_verts",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_dissolve_verts_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Dissolve Edges.
+ */
 static BMOpDefine bmo_dissolve_edges_def = {
 	"dissolve_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
-	 {BMO_OP_SLOT_BOOL, "use_verts"},  /* dissolve verts left between only 2 edges. */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {"use_verts", BMO_OP_SLOT_BOOL},  /* dissolve verts left between only 2 edges. */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_dissolve_edges_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Dissolve Edge Loop.
+ */
 static BMOpDefine bmo_dissolve_edge_loop_def = {
 	"dissolve_edge_loop",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_dissolve_edgeloop_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Dissolve Faces.
+ */
 static BMOpDefine bmo_dissolve_faces_def = {
 	"dissolve_faces",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
-	 {BMO_OP_SLOT_BOOL, "use_verts"},  /* dissolve verts left between only 2 edges. */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {"use_verts", BMO_OP_SLOT_BOOL},  /* dissolve verts left between only 2 edges. */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_dissolve_faces_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Limited Dissolve.
+ *
+ * Dissolve planar faces and co-linear edges.
+ */
 static BMOpDefine bmo_dissolve_limit_def = {
 	"dissolve_limit",
-	{{BMO_OP_SLOT_FLT, "angle_limit"}, /* total rotation angle (degrees) */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edges"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
+	 {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL},
+	 {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
+	 {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_dissolve_limit_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Triangulate.
+ */
 static BMOpDefine bmo_triangulate_def = {
 	"triangulate",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},
-	 {BMO_OP_SLOT_MAPPING, "facemap"},
-	 {BMO_OP_SLOT_BOOL, "use_beauty"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {"use_beauty", BMO_OP_SLOT_BOOL},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
+	 {"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {{'\0'}},
+	},
 	bmo_triangulate_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Un-Subdivide.
+ *
+ * Reduce detail in geometry containing grids.
+ */
+static BMOpDefine bmo_unsubdivide_def = {
+	"unsubdivide",
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
+	 {"iterations", BMO_OP_SLOT_INT},
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
+	bmo_unsubdivide_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * Subdivide Edges.
+ *
+ * Advanced operator for subdividing edges
+ * with options for face patterns, smoothing and randomization.
+ */
 static BMOpDefine bmo_subdivide_edges_def = {
 	"subdivide_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
-	 {BMO_OP_SLOT_FLT, "smooth"},
-	 {BMO_OP_SLOT_FLT, "fractal"},
-	 {BMO_OP_SLOT_FLT, "along_normal"},
-	 {BMO_OP_SLOT_INT, "numcuts"},
-	 {BMO_OP_SLOT_INT, "seed"},
-	 {BMO_OP_SLOT_MAPPING, "custompatterns"},
-	 {BMO_OP_SLOT_MAPPING, "edgepercents"},
-
-	/* these next three can have multiple types of elements in them */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "outinner"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */
-
-	 {BMO_OP_SLOT_INT,  "quadcornertype"}, /* quad corner type, see bmesh_operators.h */
-	 {BMO_OP_SLOT_BOOL, "use_gridfill"},   /* fill in fully-selected faces with a grid */
-	 {BMO_OP_SLOT_BOOL, "use_singleedge"}, /* tessellate the case of one edge selected in a quad or triangle */
-	 {BMO_OP_SLOT_BOOL, "use_sphere"},     /* for making new primitives only */
-
-	 {0} /* null-terminating sentinel */,
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {"smooth", BMO_OP_SLOT_FLT},
+	 {"fractal", BMO_OP_SLOT_FLT},
+	 {"along_normal", BMO_OP_SLOT_FLT},
+	 {"cuts", BMO_OP_SLOT_INT},
+	 {"seed", BMO_OP_SLOT_INT},
+	 {"custom_patterns", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}},  /* uses custom pointers */
+	 {"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
+
+	 {"quad_corner_type",  BMO_OP_SLOT_INT}, /* quad corner type, see bmesh_operators.h */
+	 {"use_grid_fill", BMO_OP_SLOT_BOOL},   /* fill in fully-selected faces with a grid */
+	 {"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */
+	 {"use_only_quads", BMO_OP_SLOT_BOOL},  /* only subdivide quads (for loopcut) */
+	 {"use_sphere", BMO_OP_SLOT_BOOL},     /* for making new primitives only */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{/* these next three can have multiple types of elements in them */
+	 {"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* contains all output geometr */
+	 {{'\0'}},
 	},
 	bmo_subdivide_edges_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+/*
+ * Delete Geometry.
+ *
+ * Utility operator to delete geometry.
+ */
 static BMOpDefine bmo_delete_def = {
 	"delete",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
-	 {BMO_OP_SLOT_INT, "context"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"context", BMO_OP_SLOT_INT},  /* enum DEL_VERTS ... */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_delete_exec,
 	0
 };
 
+/*
+ * Duplicate Geometry.
+ *
+ * Utility operator to duplicate geometry,
+ * optionally into a destination mesh.
+ */
 static BMOpDefine bmo_duplicate_def = {
 	"duplicate",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "origout"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "newout"},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	/* destination bmesh, if NULL will use current on */
+	 {"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
 	/* facemap maps from source faces to dupe
 	 * faces, and from dupe faces to source faces */
-	 {BMO_OP_SLOT_MAPPING, "facemap"},
-	 {BMO_OP_SLOT_MAPPING, "boundarymap"},
-	 {BMO_OP_SLOT_MAPPING, "isovertmap"},
-	 {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
-	 {0} /* null-terminating sentinel */},
+	 {"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	{{'\0'}},
+	},
 	bmo_duplicate_exec,
 	0
 };
 
+/*
+ * Split Off Geometry.
+ *
+ * Disconnect geometry from adjacent edges and faces,
+ * optionally into a destination mesh.
+ */
 static BMOpDefine bmo_split_def = {
 	"split",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
-	 {BMO_OP_SLOT_MAPPING, "boundarymap"},
-	 {BMO_OP_SLOT_MAPPING, "isovertmap"},
-	 {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
-	 {BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. don't duplicate loose verts/edges */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	/* destination bmesh, if NULL will use current one */
+	 {"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}},
+	 {"use_only_faces", BMO_OP_SLOT_BOOL},  /* when enabled. don't duplicate loose verts/edges */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
+	 {{'\0'}},
+	},
 	bmo_split_exec,
 	0
 };
 
 /*
- * Spin
+ * Spin.
  *
  * Extrude or duplicate geometry a number of times,
  * rotating and possibly translating after each step
  */
 static BMOpDefine bmo_spin_def = {
 	"spin",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
-	 {BMO_OP_SLOT_VEC, "cent"}, /* rotation center */
-	 {BMO_OP_SLOT_VEC, "axis"}, /* rotation axis */
-	 {BMO_OP_SLOT_VEC, "dvec"}, /* translation delta per step */
-	 {BMO_OP_SLOT_FLT, "ang"}, /* total rotation angle (degrees) */
-	 {BMO_OP_SLOT_INT, "steps"}, /* number of steps */
-	 {BMO_OP_SLOT_BOOL, "do_dupli"}, /* duplicate or extrude? */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"cent", BMO_OP_SLOT_VEC},             /* rotation center */
+	 {"axis", BMO_OP_SLOT_VEC},             /* rotation axis */
+	 {"dvec", BMO_OP_SLOT_VEC},             /* translation delta per step */
+	 {"angle", BMO_OP_SLOT_FLT},            /* total rotation angle (radians) */
+	 {"steps", BMO_OP_SLOT_INT},            /* number of steps */
+	 {"use_duplicate", BMO_OP_SLOT_BOOL},   /* duplicate or extrude? */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* result of last step */
+	 {{'\0'}},
+	},
 	bmo_spin_exec,
 	0
 };
 
 
 /*
- * Similar faces search
+ * Similar Faces Search.
  *
  * Find similar faces (area/material/perimeter, ...).
  */
 static BMOpDefine bmo_similar_faces_def = {
 	"similar_faces",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
-	 {BMO_OP_SLOT_INT, "type"},			/* type of selection */
-	 {BMO_OP_SLOT_FLT, "thresh"},		/* threshold of selection */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {"type", BMO_OP_SLOT_INT},             /* type of selection */
+	 {"thresh", BMO_OP_SLOT_FLT},           /* threshold of selection */
+	 {"compare", BMO_OP_SLOT_INT},          /* comparison method */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},  /* output faces */
+	 {{'\0'}},
+	},
 	bmo_similar_faces_exec,
 	0
 };
 
 /*
- * Similar edges search
+ * Similar Edges Search.
  *
  *  Find similar edges (length, direction, edge, seam, ...).
  */
 static BMOpDefine bmo_similar_edges_def = {
 	"similar_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output edges */
-	 {BMO_OP_SLOT_INT, "type"},			/* type of selection */
-	 {BMO_OP_SLOT_FLT, "thresh"},		/* threshold of selection */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
+	 {"type", BMO_OP_SLOT_INT},             /* type of selection */
+	 {"thresh", BMO_OP_SLOT_FLT},           /* threshold of selection */
+	 {"compare", BMO_OP_SLOT_INT},          /* comparison method */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},  /* output edges */
+	 {{'\0'}},
+	},
 	bmo_similar_edges_exec,
 	0
 };
 
 /*
- * Similar vertices search
+ * Similar Verts Search.
  *
  * Find similar vertices (normal, face, vertex group, ...).
  */
 static BMOpDefine bmo_similar_verts_def = {
 	"similar_verts",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
-	 {BMO_OP_SLOT_INT, "type"},			/* type of selection */
-	 {BMO_OP_SLOT_FLT, "thresh"},		/* threshold of selection */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* input vertices */
+	 {"type", BMO_OP_SLOT_INT},             /* type of selection */
+	 {"thresh", BMO_OP_SLOT_FLT},           /* threshold of selection */
+	 {"compare", BMO_OP_SLOT_INT},          /* comparison method */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},  /* output vertices */
+	 {{'\0'}},
+	},
 	bmo_similar_verts_exec,
 	0
 };
 
 /*
- * uv rotation
- * cycle the uvs
+ * UV Rotation.
+ *
+ * Cycle the loop UV's
  */
 static BMOpDefine bmo_rotate_uvs_def = {
 	"rotate_uvs",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {BMO_OP_SLOT_INT, "dir"},			/* direction */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {"use_ccw", BMO_OP_SLOT_BOOL},         /* rotate counter-clockwise if true, otherwise clockwise */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{{'\0'}}},  /* no output */
 	bmo_rotate_uvs_exec,
 	0
 };
 
 /*
- * uv reverse
- * reverse the uvs
+ * UV Reverse.
+ *
+ * Reverse the UV's
  */
 static BMOpDefine bmo_reverse_uvs_def = {
 	"reverse_uvs",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_reverse_uvs_exec,
 	0
 };
 
 /*
- * color rotation
- * cycle the colors
+ * Color Rotation.
+ *
+ * Cycle the loop colors
  */
 static BMOpDefine bmo_rotate_colors_def = {
 	"rotate_colors",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {BMO_OP_SLOT_INT, "dir"},			/* direction */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {"use_ccw", BMO_OP_SLOT_BOOL},         /* rotate counter-clockwise if true, otherwise clockwise */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_rotate_colors_exec,
 	0
 };
 
 /*
- * color reverse
- * reverse the colors
+ * Color Reverse
+ *
+ * Reverse the loop colors.
  */
 static BMOpDefine bmo_reverse_colors_def = {
 	"reverse_colors",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {{'\0'}},
+	},
+	{{{'\0'}}},  /* no output */
 	bmo_reverse_colors_exec,
 	0
 };
 
 /*
- * Similar vertices search
+ * Shortest Path.
  *
- * Find similar vertices (normal, face, vertex group, ...).
+ * Select the shortest path between 2 verts.
  */
 static BMOpDefine bmo_shortest_path_def = {
 	"shortest_path",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "startv"}, /* start vertex */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "endv"}, /* end vertex */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
-	 {BMO_OP_SLOT_INT, "type"},			/* type of selection */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"vert_start", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},   /* start vertex */
+	 {"vert_end", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},     /* end vertex */
+	 {"type", BMO_OP_SLOT_INT},             /* type of selection */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
+	 {{'\0'}},
+	},
 	bmo_shortest_path_exec,
 	0
 };
 
 /*
- * Edge Split
+ * Edge Split.
  *
  * Disconnects faces along input edges.
  */
 static BMOpDefine bmo_split_edges_def = {
 	"split_edges",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* old output disconnected edges */
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
 	 /* needed for vertex rip so we can rip only half an edge at a boundary wich would otherwise split off */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* optional tag verts, use to have greater control of splits */
-	 {BMO_OP_SLOT_BOOL,        "use_verts"}, /* use 'verts' for splitting, else just find verts to split from edges */
-	 {0} /* null-terminating sentinel */},
+	 {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},    /* optional tag verts, use to have greater control of splits */
+	 {"use_verts",        BMO_OP_SLOT_BOOL}, /* use 'verts' for splitting, else just find verts to split from edges */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* old output disconnected edges */
+	 {{'\0'}},
+	},
 	bmo_split_edges_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Create Grid
+ * Create Grid.
  *
  * Creates a grid with a variable number of subdivisions
  */
 static BMOpDefine bmo_create_grid_def = {
 	"create_grid",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_INT,         "xsegments"}, /* number of x segments */
-	 {BMO_OP_SLOT_INT,         "ysegments"}, /* number of y segments */
-	 {BMO_OP_SLOT_FLT,         "size"}, /* size of the grid */
-	 {BMO_OP_SLOT_MAT,         "mat"}, /* matrix to multiply the new geometry with */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"x_segments",      BMO_OP_SLOT_INT},  /* number of x segments */
+	 {"y_segments",      BMO_OP_SLOT_INT},  /* number of y segments */
+	 {"size",            BMO_OP_SLOT_FLT},  /* size of the grid */
+	 {"matrix",          BMO_OP_SLOT_MAT},  /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_grid_exec,
 	0,
 };
 
 /*
- * Create UV Sphere
+ * Create UV Sphere.
  *
  * Creates a grid with a variable number of subdivisions
  */
 static BMOpDefine bmo_create_uvsphere_def = {
 	"create_uvsphere",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_INT,         "segments"}, /* number of u segments */
-	 {BMO_OP_SLOT_INT,         "revolutions"}, /* number of v segment */
-	 {BMO_OP_SLOT_FLT,         "diameter"}, /* diameter */
-	 {BMO_OP_SLOT_MAT,         "mat"}, /* matrix to multiply the new geometry with-- */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"u_segments",      BMO_OP_SLOT_INT}, /* number of u segments */
+	 {"v_segments",      BMO_OP_SLOT_INT}, /* number of v segment */
+	 {"diameter",        BMO_OP_SLOT_FLT}, /* diameter */
+	 {"matrix",          BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_uvsphere_exec,
 	0,
 };
 
 /*
- * Create Ico Sphere
+ * Create Ico-Sphere.
  *
  * Creates a grid with a variable number of subdivisions
  */
 static BMOpDefine bmo_create_icosphere_def = {
 	"create_icosphere",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_INT,         "subdivisions"}, /* how many times to recursively subdivide the sphere */
-	 {BMO_OP_SLOT_FLT,         "diameter"}, /* diameter */
-	 {BMO_OP_SLOT_MAT,         "mat"}, /* matrix to multiply the new geometry with */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"subdivisions",    BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */
+	 {"diameter",        BMO_OP_SLOT_FLT}, /* diameter */
+	 {"matrix",          BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_icosphere_exec,
 	0,
 };
 
 /*
- * Create Suzanne
+ * Create Suzanne.
  *
- * Creates a monkey.  Be wary.
+ * Creates a monkey (standard blender primitive).
  */
 static BMOpDefine bmo_create_monkey_def = {
 	"create_monkey",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_monkey_exec,
 	0,
 };
 
 /*
- * Create Cone
+ * Create Cone.
  *
  * Creates a cone with variable depth at both ends
  */
 static BMOpDefine bmo_create_cone_def = {
 	"create_cone",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
-	 {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
-	 {BMO_OP_SLOT_INT, "segments"},
-	 {BMO_OP_SLOT_FLT, "diameter1"}, /* diameter of one end */
-	 {BMO_OP_SLOT_FLT, "diameter2"}, /* diameter of the opposite */
-	 {BMO_OP_SLOT_FLT, "depth"}, /* distance between ends */
-	 {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"cap_ends",        BMO_OP_SLOT_BOOL},  /* whether or not to fill in the ends with faces */
+	 {"cap_tris",        BMO_OP_SLOT_BOOL},  /* fill ends with triangles instead of ngons */
+	 {"segments",        BMO_OP_SLOT_INT},
+	 {"diameter1",       BMO_OP_SLOT_FLT},  /* diameter of one end */
+	 {"diameter2",       BMO_OP_SLOT_FLT},  /* diameter of the opposite */
+	 {"depth",           BMO_OP_SLOT_FLT},  /* distance between ends */
+	 {"matrix",          BMO_OP_SLOT_MAT},  /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_cone_exec,
 	0,
 };
 
 /*
- * Creates a circle
+ * Creates a Circle.
  */
 static BMOpDefine bmo_create_circle_def = {
 	"create_circle",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
-	 {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
-	 {BMO_OP_SLOT_INT, "segments"},
-	 {BMO_OP_SLOT_FLT, "diameter"}, /* diameter of one end */
-	 {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"cap_ends",        BMO_OP_SLOT_BOOL},  /* whether or not to fill in the ends with faces */
+	 {"cap_tris",        BMO_OP_SLOT_BOOL},  /* fill ends with triangles instead of ngons */
+	 {"segments",        BMO_OP_SLOT_INT},
+	 {"diameter",        BMO_OP_SLOT_FLT},  /* diameter of one end */
+	 {"matrix",          BMO_OP_SLOT_MAT},  /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_circle_exec,
 	0,
 };
 
 /*
- * Create Cone
+ * Create Cube
  *
- * Creates a cone with variable depth at both ends
+ * Creates a cube.
  */
 static BMOpDefine bmo_create_cube_def = {
 	"create_cube",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
-	 {BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
-	 {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
-	 {0, /* null-terminating sentinel */}},
+	/* slots_in */
+	{{"size",            BMO_OP_SLOT_FLT},  /* size of the cube */
+	 {"matrix",          BMO_OP_SLOT_MAT},  /* matrix to multiply the new geometry with */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+	 {{'\0'}},
+	},
 	bmo_create_cube_exec,
 	0,
 };
 
 /*
- * Bevel
+ * Bevel.
  *
  * Bevels edges and vertices
  */
 static BMOpDefine bmo_bevel_def = {
 	"bevel",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "face_spans"}, /* new geometry */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "face_holes"}, /* new geometry */
-	 {BMO_OP_SLOT_BOOL, "use_lengths"}, /* grab edge lengths from a PROP_FLT customdata layer */
-	 {BMO_OP_SLOT_BOOL, "use_even"}, /* corner vert placement: use shell/angle calculations  */
-	 {BMO_OP_SLOT_BOOL, "use_dist"}, /* corner vert placement: evaluate percent as a distance,
-	                                  * modifier uses this. We could do this as another float setting */
-	 {BMO_OP_SLOT_INT, "lengthlayer"}, /* which PROP_FLT layer to us */
-	 {BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand beveled edge */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},     /* input edges and vertices */
+	 {"offset", BMO_OP_SLOT_FLT},           /* amount to offset beveled edge */
+	 {"segments", BMO_OP_SLOT_INT},         /* number of segments in bevel */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
+	 {{'\0'}},
+	},
+/* old bevel*/
+//	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
+//	 {"face_spans", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
+//	 {"face_holes", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
+//	 {"use_lengths", BMO_OP_SLOT_BOOL}, /* grab edge lengths from a PROP_FLT customdata layer */
+//	 {"use_even", BMO_OP_SLOT_BOOL}, /* corner vert placement: use shell/angle calculations  */
+//	 {"use_dist", BMO_OP_SLOT_BOOL}, /* corner vert placement: evaluate percent as a distance,
+//	                                  * modifier uses this. We could do this as another float setting */
+//	 {"lengthlayer", BMO_OP_SLOT_INT}, /* which PROP_FLT layer to us */
+//	 {"percent", BMO_OP_SLOT_FLT}, /* percentage to expand beveled edge */
+//	 {{'\0'}},
+//	},
+
 	bmo_bevel_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Beautify Fill
+ * Beautify Fill.
  *
- * Makes triangle a bit nicer
+ * Rotate edges to create more evenly spaced triangles.
  */
 static BMOpDefine bmo_beautify_fill_def = {
 	"beautify_fill",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "constrain_edges"}, /* edges that can't be flipped */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new flipped faces and edges */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
+	 {"constrain_edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can't be flipped */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new flipped faces and edges */
+	 {{'\0'}},
+	},
 	bmo_beautify_fill_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Triangle Fill
+ * Triangle Fill.
  *
  * Fill edges with triangles
  */
 static BMOpDefine bmo_triangle_fill_def = {
 	"triangle_fill",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new faces and edges */
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new faces and edges */
+	 {{'\0'}},
+	},
 	bmo_triangle_fill_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
 /*
- * Solidify
+ * Solidify.
  *
  * Turns a mesh into a shell with thickness
  */
 static BMOpDefine bmo_solidify_def = {
 	"solidify",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
-	 {BMO_OP_SLOT_FLT, "thickness"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
-	 {0}},
+	/* slots_in */
+	{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"thickness", BMO_OP_SLOT_FLT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_solidify_face_region_exec,
 	0
 };
 
 /*
- * Face Inset
+ * Face Inset.
  *
- * Extrudes faces individually.
+ * Inset or outset faces.
  */
 static BMOpDefine bmo_inset_def = {
 	"inset",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},   /* input faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
-	 {BMO_OP_SLOT_BOOL, "use_boundary"},
-	 {BMO_OP_SLOT_BOOL, "use_even_offset"},
-	 {BMO_OP_SLOT_BOOL, "use_relative_offset"},
-	 {BMO_OP_SLOT_FLT, "thickness"},
-	 {BMO_OP_SLOT_FLT, "depth"},
-	 {BMO_OP_SLOT_BOOL, "use_outset"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+	 {"use_boundary", BMO_OP_SLOT_BOOL},
+	 {"use_even_offset", BMO_OP_SLOT_BOOL},
+	 {"use_relative_offset", BMO_OP_SLOT_BOOL},
+	 {"thickness", BMO_OP_SLOT_FLT},
+	 {"depth", BMO_OP_SLOT_FLT},
+	 {"use_outset", BMO_OP_SLOT_BOOL},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
+	 {{'\0'}},
+	},
 	bmo_inset_exec,
 	0
 };
 
 /*
- * Wire Frame
+ * Wire Frame.
  *
- * Makes a wire copy of faces.
+ * Makes a wire-frame copy of faces.
  */
 static BMOpDefine bmo_wireframe_def = {
 	"wireframe",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},   /* input faces */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
-	 {BMO_OP_SLOT_BOOL, "use_boundary"},
-	 {BMO_OP_SLOT_BOOL, "use_even_offset"},
-	 {BMO_OP_SLOT_BOOL, "use_crease"},
-	 {BMO_OP_SLOT_FLT, "thickness"},
-	 {BMO_OP_SLOT_BOOL, "use_relative_offset"},
-	 {BMO_OP_SLOT_FLT, "depth"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},   /* input faces */
+	 {"use_boundary", BMO_OP_SLOT_BOOL},
+	 {"use_even_offset", BMO_OP_SLOT_BOOL},
+	 {"use_crease", BMO_OP_SLOT_BOOL},
+	 {"thickness", BMO_OP_SLOT_FLT},
+	 {"use_relative_offset", BMO_OP_SLOT_BOOL},
+	 {"depth", BMO_OP_SLOT_FLT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
+	 {{'\0'}},
+	},
 	bmo_wireframe_exec,
 	0
 };
 
 /*
- * Vertex Slide
+ * Vertex Slide.
  *
- * Translates vertes along an edge
+ * Translates verts along an edge
  */
 static BMOpDefine bmo_slide_vert_def = {
 	"slide_vert",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "vert"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "edge"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "vertout"},
-	 {BMO_OP_SLOT_FLT, "distance_t"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"vert", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},
+	 {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
+	 {"factor", BMO_OP_SLOT_FLT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
+	 {{'\0'}},
+	},
 	bmo_slide_vert_exec,
 	BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
+#ifdef WITH_BULLET
 /*
  * Convex Hull
  *
@@ -1160,7 +1565,7 @@ static BMOpDefine bmo_slide_vert_def = {
  * If 'use_existing_faces' is true, the hull will not output triangles
  * that are covered by a pre-existing face.
  *
- * All hull vertices, faces, and edges are added to 'geomout'. Any
+ * All hull vertices, faces, and edges are added to 'geom.out'. Any
  * input elements that end up inside the hull (i.e. are not used by an
  * output face) are added to the 'interior_geom' slot. The
  * 'unused_geom' slot will contain all interior geometry that is
@@ -1169,20 +1574,49 @@ static BMOpDefine bmo_slide_vert_def = {
  */
 static BMOpDefine bmo_convex_hull_def = {
 	"convex_hull",
-	{{BMO_OP_SLOT_ELEMENT_BUF, "input"},
-	 {BMO_OP_SLOT_BOOL, "use_existing_faces"},
-
-	 /* Outputs */
-	 {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "interior_geom"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "unused_geom"},
-	 {BMO_OP_SLOT_ELEMENT_BUF, "holes_geom"},
-	 {0} /* null-terminating sentinel */},
+	/* slots_in */
+	{{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"use_existing_faces", BMO_OP_SLOT_BOOL},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {{'\0'}},
+	},
 	bmo_convex_hull_exec,
 	0
 };
+#endif
 
-BMOpDefine *opdefines[] = {
+/*
+ * Symmetrize.
+ *
+ * Makes the mesh elements in the "input" slot symmetrical. Unlike
+ * normal mirroring, it only copies in one direction, as specified by
+ * the "direction" slot. The edges and faces that cross the plane of
+ * symmetry are split as needed to enforce symmetry.
+ *
+ * All new vertices, edges, and faces are added to the "geom.out" slot.
+ */
+static BMOpDefine bmo_symmetrize_def = {
+	"symmetrize",
+	/* slots_in */
+	{{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {"direction", BMO_OP_SLOT_INT},
+	 {{'\0'}},
+	},
+	/* slots_out */
+	{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
+	 {{'\0'}},
+	},
+	bmo_symmetrize_exec,
+	0
+};
+
+const BMOpDefine *bmo_opdefines[] = {
 	&bmo_automerge_def,
 	&bmo_average_vert_facedata_def,
 	&bmo_beautify_fill_def,
@@ -1194,7 +1628,9 @@ BMOpDefine *opdefines[] = {
 	&bmo_collapse_uvs_def,
 	&bmo_connect_verts_def,
 	&bmo_contextual_create_def,
+#ifdef WITH_BULLET
 	&bmo_convex_hull_def,
+#endif
 	&bmo_create_circle_def,
 	&bmo_create_cone_def,
 	&bmo_create_cube_def,
@@ -1241,18 +1677,20 @@ BMOpDefine *opdefines[] = {
 	&bmo_similar_verts_def,
 	&bmo_slide_vert_def,
 	&bmo_smooth_vert_def,
+	&bmo_smooth_laplacian_vert_def,
 	&bmo_solidify_def,
 	&bmo_spin_def,
 	&bmo_split_def,
 	&bmo_split_edges_def,
 	&bmo_subdivide_edges_def,
+	&bmo_symmetrize_def,
 	&bmo_transform_def,
 	&bmo_translate_def,
 	&bmo_triangle_fill_def,
 	&bmo_triangulate_def,
+	&bmo_unsubdivide_def,
 	&bmo_weld_verts_def,
 	&bmo_wireframe_def,
-
 };
 
-int bmesh_total_ops = (sizeof(opdefines) / sizeof(void *));
+const int bmo_opdefines_total = (sizeof(bmo_opdefines) / sizeof(void *));
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 0674103..7df9c94 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -91,15 +91,15 @@ BLI_INLINE void  _bmo_elem_flag_toggle(   BMesh *bm, BMFlagLayer *oflags, const
 
 /* slot type arrays are terminated by the last member
  * having a slot type of 0 */
-enum {
-	BMO_OP_SLOT_SENTINEL = 0,
+typedef enum eBMOpSlotType {
+	/* BMO_OP_SLOT_SENTINEL = 0, */
 	BMO_OP_SLOT_BOOL = 1,
 	BMO_OP_SLOT_INT = 2,
 	BMO_OP_SLOT_FLT = 3,
 
 	/* normally store pointers to object, scene,
 	 * _never_ store arrays corresponding to mesh elements with this */
-	BMO_OP_SLOT_PTR = 4,
+	BMO_OP_SLOT_PTR = 4,  /* requres subtype BMO_OP_SLOT_SUBTYPE_PTR_xxx */
 	BMO_OP_SLOT_MAT = 5,
 	BMO_OP_SLOT_VEC = 8,
 
@@ -108,38 +108,84 @@ enum {
 	 *
 	 * it's very important this remain a power of two */
 	BMO_OP_SLOT_ELEMENT_BUF = 9, /* list of verts/edges/faces */
-	BMO_OP_SLOT_MAPPING = 10 /* simple hash map */
-};
+	BMO_OP_SLOT_MAPPING = 10 /* simple hash map, requres subtype BMO_OP_SLOT_SUBTYPE_MAP_xxx */
+} eBMOpSlotType;
 #define BMO_OP_SLOT_TOTAL_TYPES 11
 
+/* don't overlap values to avoid confusion */
+typedef enum eBMOpSlotSubType_Elem {
+	/* use as flags */
+	BMO_OP_SLOT_SUBTYPE_ELEM_VERT = BM_VERT,
+	BMO_OP_SLOT_SUBTYPE_ELEM_EDGE = BM_EDGE,
+	BMO_OP_SLOT_SUBTYPE_ELEM_FACE = BM_FACE,
+	BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE = (BM_FACE << 1),
+} eBMOpSlotSubType_Elem;
+typedef enum eBMOpSlotSubType_Map {
+	BMO_OP_SLOT_SUBTYPE_MAP_EMPTY    = 64,  /* use as a set(), unused value */
+	BMO_OP_SLOT_SUBTYPE_MAP_ELEM     = 65,
+	BMO_OP_SLOT_SUBTYPE_MAP_FLT      = 66,
+	BMO_OP_SLOT_SUBTYPE_MAP_INT      = 67,
+	BMO_OP_SLOT_SUBTYPE_MAP_BOOL     = 68,
+	BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL = 69,  /* python can't convert these */
+} eBMOpSlotSubType_Map;
+typedef enum eBMOpSlotSubType_Ptr {
+	BMO_OP_SLOT_SUBTYPE_PTR_BMESH  = 100,
+	BMO_OP_SLOT_SUBTYPE_PTR_SCENE  = 101,
+	BMO_OP_SLOT_SUBTYPE_PTR_OBJECT = 102,
+	BMO_OP_SLOT_SUBTYPE_PTR_MESH   = 103,
+} eBMOpSlotSubType_Ptr;
+
+typedef union eBMOpSlotSubType_Union {
+	eBMOpSlotSubType_Elem elem;
+	eBMOpSlotSubType_Ptr ptr;
+	eBMOpSlotSubType_Map map;
+} eBMOpSlotSubType_Union;
+
 /* please ignore all these structures, don't touch them in tool code, except
  * for when your defining an operator with BMOpDefine.*/
 
 typedef struct BMOpSlot {
-	int slot_type;
+	const char *slot_name;  /* pointer to BMOpDefine.slot_args */
+	eBMOpSlotType          slot_type;
+	eBMOpSlotSubType_Union slot_subtype;
+
 	int len;
-	int flag;
-	int index; /* index within slot array */
+//	int flag;  /* UNUSED */
+//	int index; /* index within slot array */  /* UNUSED */
 	union {
 		int i;
 		float f;
 		void *p;
 		float vec[3];
-		void *buf;
+		void **buf;
 		GHash *ghash;
 	} data;
 } BMOpSlot;
 
-#define BMO_OP_MAX_SLOTS 16 /* way more than probably needed */
+/* mainly for use outside bmesh internal code */
+#define BMO_SLOT_AS_BOOL(slot)         ((slot)->data.i)
+#define BMO_SLOT_AS_INT(slot)          ((slot)->data.i)
+#define BMO_SLOT_AS_FLOAT(slot)        ((slot)->data.f)
+#define BMO_SLOT_AS_VECTOR(slot)       ((slot)->data.vec)
+#define BMO_SLOT_AS_MATRIX(slot )      ((float (*)[4])((slot)->data.p))
+#define BMO_SLOT_AS_BUFFER(slot )      ((slot)->data.buf)
+#define BMO_SLOT_AS_GHASH(slot )       ((slot)->data.ghash)
+
+#define BMO_ASSERT_SLOT_IN_OP(slot, op) \
+	BLI_assert(((slot >= (op)->slots_in)  && (slot < &(op)->slots_in[BMO_OP_MAX_SLOTS])) || \
+	           ((slot >= (op)->slots_out) && (slot < &(op)->slots_out[BMO_OP_MAX_SLOTS])))
+
+/* way more than probably needed, compiler complains if limit hit */
+#define BMO_OP_MAX_SLOTS 16
 
 typedef struct BMOperator {
+	struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS];
+	struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS];
+	void (*exec)(BMesh *bm, struct BMOperator *op);
+	struct MemArena *arena;
 	int type;
-	int slot_type;
 	int type_flag;
 	int flag;  /* runtime options */
-	struct BMOpSlot slot_args[BMO_OP_MAX_SLOTS];
-	void (*exec)(BMesh *bm, struct BMOperator *op);
-	struct MemArena *arena;
 } BMOperator;
 
 enum {
@@ -151,13 +197,15 @@ enum {
 #define MAX_SLOTNAME	32
 
 typedef struct BMOSlotType {
-	int type;
 	char name[MAX_SLOTNAME];
+	eBMOpSlotType          type;
+	eBMOpSlotSubType_Union subtype;
 } BMOSlotType;
 
 typedef struct BMOpDefine {
-	const char *name;
-	BMOSlotType slot_types[BMO_OP_MAX_SLOTS];
+	const char *opname;
+	BMOSlotType slot_types_in[BMO_OP_MAX_SLOTS];
+	BMOSlotType slot_types_out[BMO_OP_MAX_SLOTS];
 	void (*exec)(BMesh *bm, BMOperator *op);
 	int type_flag;
 } BMOpDefine;
@@ -192,43 +240,6 @@ int BMO_mesh_enabled_flag_count(BMesh *bm, const char htype, const short oflag);
 int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag);
 
 /*---------formatted operator initialization/execution-----------*/
-/*
- * this system is used to execute or initialize an operator,
- * using a formatted-string system.
- *
- * for example, BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES);
- * . . .will execute the delete operator, feeding in selected faces, deleting them.
- *
- * the basic format for the format string is:
- *   [operatorname] [slot_name]=%[code] [slot_name]=%[code]
- *
- * as in printf, you pass in one additional argument to the function
- * for every code.
- *
- * the formatting codes are:
- *    %d - put int in slot
- *    %f - put float in slot
- *    %p - put pointer in slot
- *    %h[f/e/v] - put elements with a header flag in slot.
- *                 the letters after %h define which element types to use,
- *             so e.g. %hf will do faces, %hfe will do faces and edges,
- *             %hv will do verts, etc.  must pass in at least one
- *             element type letter.
- *    %H[f/e/v] - same as %h, but tests if the flag is disabled
- *    %f[f/e/v] - same as %h, except it deals with tool flags instead of
- *                 header flags.
- *    %F[f/e/v] - same as %f, but tests if the flag is disabled
- *    %a[f/e/v] - pass all elements (of types specified by f/e/v) to the
- *                 slot.
- *    %e        - pass in a single element.
- *    %v - pointer to a float vector of length 3.
- *    %m[3/4] - matrix, 3/4 refers to the matrix size, 3 or 4.  the
- *              corresponding argument must be a pointer to
- *          a float matrix.
- *    %s - copy a slot from another op, instead of mapping to one
- *         argument, it maps to two, a pointer to an operator and
- *     a slot name.
- */
 void BMO_push(BMesh *bm, BMOperator *op);
 void BMO_pop(BMesh *bm);
 
@@ -245,15 +256,22 @@ int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...
 int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
 
 /* test whether a named slot exists */
-int BMO_slot_exists(BMOperator *op, const char *slot_name);
+int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
 
 /* get a pointer to a slot.  this may be removed layer on from the public API. */
-BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name);
+BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
 
 /* copies the data of a slot from one operator to another.  src and dst are the
  * source/destination slot codes, respectively. */
-void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op,
-                   const char *src, const char *dst);
+#define BMO_slot_copy(op_src, slots_src, slot_name_src,                       \
+                      op_dst, slots_dst, slot_name_dst)                       \
+	_bmo_slot_copy((op_src)->slots_src, slot_name_src,                        \
+	               (op_dst)->slots_dst, slot_name_dst,                        \
+	               (op_dst)->arena)
+
+void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+                    BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+                    struct MemArena *arena_dst);
 
 /* del "context" slot values, used for operator too */
 enum {
@@ -266,84 +284,112 @@ enum {
 	DEL_ONLYTAGGED
 };
 
+typedef enum {
+	BMO_SYMMETRIZE_NEGATIVE_X,
+	BMO_SYMMETRIZE_NEGATIVE_Y,
+	BMO_SYMMETRIZE_NEGATIVE_Z,
+
+	BMO_SYMMETRIZE_POSITIVE_X,
+	BMO_SYMMETRIZE_POSITIVE_Y,
+	BMO_SYMMETRIZE_POSITIVE_Z,
+} BMO_SymmDirection;
+
 void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);
 void BMO_op_flag_disable(BMesh *bm, BMOperator *op, const int op_flag);
 
-void  BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f);
-float BMO_slot_float_get(BMOperator *op, const char *slot_name);
-void  BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i);
-int   BMO_slot_int_get(BMOperator *op, const char *slot_name);
-void  BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i);
-int   BMO_slot_bool_get(BMOperator *op, const char *slot_name);
+void  BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f);
+float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void  BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
+int   BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void  BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
+int   BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len);
+
 
 /* don't pass in arrays that are supposed to map to elements this way.
  *
  * so, e.g. passing in list of floats per element in another slot is bad.
  * passing in, e.g. pointer to an editmesh for the conversion operator is fine
  * though. */
-void  BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p);
-void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name);
-void  BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3]);
-void  BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3]);
+void  BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p);
+void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void  BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3]);
+void  BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3]);
 
 /* only supports square mats */
 /* size must be 3 or 4; this api is meant only for transformation matrices.
  * note that internally the matrix is stored in 4x4 form, and it's safe to
  * call whichever BMO_Get_MatXXX function you want. */
-void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size);
-void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4]);
-void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3]);
+void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],  const char *slot_name, const float *mat, int size);
+void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4]);
+void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3]);
 
 void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, const short oflag);
 
 /* copies the values from another slot to the end of the output slot */
-void BMO_slot_buffer_append(BMOperator *output_op, const char *output_op_slot,
-                            BMOperator *other_op, const char *other_op_slot);
+#define BMO_slot_buffer_append(op_src, slots_src, slot_name_src,              \
+                               op_dst, slots_dst, slot_name_dst)              \
+	_bmo_slot_buffer_append((op_src)->slots_src, slot_name_src,               \
+	                        (op_dst)->slots_dst, slot_name_dst,               \
+	                        (op_dst)->arena)
+void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+                             BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+                             struct MemArena *arena_dst);
 
 /* puts every element of type 'type' (which is a bitmask) with tool
  * flag 'flag', into a slot. */
-void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
+                                       BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                        const char htype, const short oflag);
 
 /* puts every element of type 'type' (which is a bitmask) without tool
  * flag 'flag', into a slot. */
-void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
+                                        BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                         const char htype, const short oflag);
 
 /* tool-flags all elements inside an element slot array with flag flag. */
-void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_enable(BMesh *bm,
+                                 BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                  const char htype, const short oflag);
 /* clears tool-flag flag from all elements inside a slot array. */
-void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_disable(BMesh *bm,
+                                  BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                   const char htype, const short oflag);
 
 /* tool-flags all elements inside an element slot array with flag flag. */
-void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_enable(BMesh *bm,
+                                  BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                   const char htype, const char hflag, const char do_flush);
 /* clears tool-flag flag from all elements inside a slot array. */
-void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_disable(BMesh *bm,
+                                   BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                    const char htype, const char hflag, const char do_flush);
 
 /* puts every element of type 'type' (which is a bitmask) with header
  * flag 'flag', into a slot.  note: ignores hidden elements
  * (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
 void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
-                                        const char *slot_name,
+                                        BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                         const char htype, const char hflag);
 
 /* puts every element of type 'type' (which is a bitmask) without
  * header flag 'flag', into a slot.  note: ignores hidden elements
  * (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
 void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
-                                         const char *slot_name,
+                                         BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                          const char htype, const char hflag);
 
+void  BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele);
+void *BMO_slot_buffer_get_single(BMOpSlot *slot);
+
+
 /* counts number of elements inside a slot array. */
-int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slot_name);
-int BMO_slot_map_count(BMesh *bm, BMOperator *op, const char *slot_name);
+int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
 
-void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
-                         void *element, void *data, int len);
+void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
+                         const void *element, const void *data, const int len);
 
 /* Counts the number of edges with tool flag toolflag around
  */
@@ -351,23 +397,27 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag);
 
 /* flags all elements in a mapping.  note that the mapping must only have
  * bmesh elements in it.*/
-void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
-                          const char hflag, const short oflag);
+void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+                          const char *slot_name, const char hflag, const short oflag);
 
-void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len);
+void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+                            const char *slot_name, const int len);
 
-void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
-                              const char htype);
+void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+                              const char *slot_name, const char htype);
 
-/* this part of the API is used to iterate over element buffer or
+/**
+ * This part of the API is used to iterate over element buffer or
  * mapping slots.
  *
  * for example, iterating over the faces in a slot is:
  *
+ * \code{.c}
+ *
  *    BMOIter oiter;
  *    BMFace *f;
  *
- *    f = BMO_iter_new(&oiter, bm, some_operator, "slot_name", BM_FACE);
+ *    f = BMO_iter_new(&oiter, some_operator, "slot_name", BM_FACE);
  *    for (; f; f = BMO_iter_step(&oiter)) {
  *        /do something with the face
  *    }
@@ -388,6 +438,7 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
  *        //  *((void**)BMO_iter_map_value(&oiter));
  *        //or something like that.
  *    }
+ * \endcode
  */
 
 /* contents of this structure are private,
@@ -400,10 +451,11 @@ typedef struct BMOIter {
 	char restrictmask; /* bitwise '&' with BMHeader.htype */
 } BMOIter;
 
-void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name);
+void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
 
-void *BMO_iter_new(BMOIter *iter, BMesh *bm, BMOperator *op,
-                   const char *slot_name, const char restrictmask);
+void *BMO_iter_new(BMOIter *iter,
+                   BMOpSlot slot_args[BMO_OP_MAX_SLOTS],  const char *slot_name,
+                   const char restrictmask);
 void *BMO_iter_step(BMOIter *iter);
 
 /* returns a pointer to the key value when iterating over mappings.
@@ -416,8 +468,8 @@ void *BMO_iter_map_value_p(BMOIter *iter);
 /* use this for float mappings */
 float BMO_iter_map_value_f(BMOIter *iter);
 
-#define BMO_ITER(ele, iter, bm, op, slot_name, restrict)   \
-	for (ele = BMO_iter_new(iter, bm, op, slot_name, restrict); ele; ele = BMO_iter_step(iter))
+#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)   \
+	for (ele = BMO_iter_new(iter, slot_args, slot_name, restrict_flag); ele; ele = BMO_iter_step(iter))
 
 /******************* Inlined Functions********************/
 typedef void (*opexec)(BMesh *bm, BMOperator *op);
@@ -429,6 +481,9 @@ typedef struct BMOElemMapping {
 	int len;
 } BMOElemMapping;
 
+/* pointer after BMOElemMapping */
+#define BMO_OP_SLOT_MAPPING_DATA(var) (void *)(((BMOElemMapping *)var) + 1)
+
 extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
 
 #ifdef __cplusplus
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 16c2b8b..ad11601 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -69,16 +69,26 @@ BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const shor
 	oflags[bm->stackdepth - 1].f ^= oflag;
 }
 
-BLI_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slot_name,
-                                        void *element, int val)
+BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op, BMOpSlot *slot,
+                                        void *element, const int val)
 {
-	BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(int));
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INT);
+	BMO_slot_map_insert(op, slot, element, &val, sizeof(int));
 }
 
-BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slot_name,
-                                          void *element, float val)
+BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op, BMOpSlot *slot,
+                                        void *element, const int val)
 {
-	BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(float));
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
+	BLI_assert(val == FALSE || val == TRUE);
+	BMO_slot_map_insert(op, slot, element, &val, sizeof(int));
+}
+
+BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot *slot,
+                                          void *element, const float val)
+{
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
+	BMO_slot_map_insert(op, slot, element, &val, sizeof(float));
 }
 
 
@@ -87,62 +97,107 @@ BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char
  * do NOT use these for non-operator-api-allocated memory! instead
  * use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
 
-BLI_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slot_name,
-                                        void *element, void *val)
+BLI_INLINE void BMO_slot_map_ptr_insert(BMOperator *op, BMOpSlot *slot,
+                                        const void *element, void *val)
 {
-	BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(void *));
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL);
+	BMO_slot_map_insert(op, slot, element, &val, sizeof(void *));
 }
 
-BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name, void *element)
+BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot,
+                                        const void *element, void *val)
+{
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_ELEM);
+	BMO_slot_map_insert(op, slot, element, &val, sizeof(void *));
+}
+
+
+/* no values */
+BLI_INLINE void BMO_slot_map_empty_insert(BMOperator *op, BMOpSlot *slot,
+                                        const void *element)
+{
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_EMPTY);
+	BMO_slot_map_insert(op, slot, element, NULL, 0);
+}
+
+BLI_INLINE int BMO_slot_map_contains(BMOpSlot *slot, const void *element)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
 
 	/* sanity check */
-	if (!slot->data.ghash) return 0;
+	if (UNLIKELY(slot->data.ghash == NULL)) {
+		return 0;
+	}
 
 	return BLI_ghash_haskey(slot->data.ghash, element);
 }
 
-BLI_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
-                                       void *element)
+BLI_INLINE void *BMO_slot_map_data_get(BMOpSlot *slot, const void *element)
 {
 	BMOElemMapping *mapping;
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
 
 	/* sanity check */
-	if (!slot->data.ghash) return NULL;
+	if (UNLIKELY(slot->data.ghash == NULL)) {
+		return NULL;
+	}
 
 	mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element);
 
-	if (!mapping) return NULL;
+	if (!mapping) {
+		return NULL;
+	}
 
 	return mapping + 1;
 }
 
-BLI_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slot_name,
-                                        void *element)
+BLI_INLINE float BMO_slot_map_float_get(BMOpSlot *slot, const void *element)
 {
-	float *val = (float *) BMO_slot_map_data_get(bm, op, slot_name, element);
+	float *val;
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
+
+	val = (float *) BMO_slot_map_data_get(slot, element);
 	if (val) return *val;
 
 	return 0.0f;
 }
 
-BLI_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slot_name,
-                                    void *element)
+BLI_INLINE int BMO_slot_map_int_get(BMOpSlot *slot, const void *element)
 {
-	int *val = (int *) BMO_slot_map_data_get(bm, op, slot_name, element);
+	int *val;
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INT);
+
+	val = (int *) BMO_slot_map_data_get(slot, element);
 	if (val) return *val;
 
 	return 0;
 }
 
-BLI_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slot_name,
-                                      void *element)
+BLI_INLINE int BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
+{
+	int *val;
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
+
+	val = (int *) BMO_slot_map_data_get(slot, element);
+	BLI_assert(val == NULL || *val == FALSE || *val == TRUE);
+	if (val) return *val;
+
+	return 0;
+}
+
+BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
+{
+	void **val = (void **) BMO_slot_map_data_get(slot, element);
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL);
+	if (val) return *val;
+
+	return NULL;
+}
+
+BLI_INLINE void *BMO_slot_map_elem_get(BMOpSlot *slot, const void *element)
 {
-	void **val = (void **) BMO_slot_map_data_get(bm, op, slot_name, element);
+	void **val = (void **) BMO_slot_map_data_get(slot, element);
+	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_ELEM);
 	if (val) return *val;
 
 	return NULL;
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 2100cd2..5e51f5a 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -36,6 +36,8 @@
 #include "BLI_listbase.h"
 #include "BLI_array.h"
 
+#include "BLF_translation.h"
+
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
@@ -43,22 +45,22 @@
 static void bmo_flag_layer_alloc(BMesh *bm);
 static void bmo_flag_layer_free(BMesh *bm);
 static void bmo_flag_layer_clear(BMesh *bm);
-static int bmo_name_to_slotcode(BMOpDefine *def, const char *name);
-static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name);
+static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
+static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
 static int bmo_opname_to_opcode(const char *opname);
 
 static const char *bmo_error_messages[] = {
 	NULL,
-	"Self intersection error",
-	"Could not dissolve vert",
-	"Could not connect vertices",
-	"Could not traverse mesh",
-	"Could not dissolve faces",
-	"Could not dissolve vertices",
-	"Tessellation error",
-	"Can not deal with non-manifold geometry",
-	"Invalid selection",
-	"Internal mesh error",
+	N_("Self intersection error"),
+	N_("Could not dissolve vert"),
+	N_("Could not connect vertices"),
+	N_("Could not traverse mesh"),
+	N_("Could not dissolve faces"),
+	N_("Could not dissolve vertices"),
+	N_("Tessellation error"),
+	N_("Cannot deal with non-manifold geometry"),
+	N_("Invalid selection"),
+	N_("Internal mesh error"),
 };
 
 
@@ -78,7 +80,7 @@ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
 };
 
 /* Dummy slot so there is something to return when slot name lookup fails */
-static BMOpSlot BMOpEmptySlot = {0};
+// static BMOpSlot BMOpEmptySlot = {0};
 
 void BMO_op_flag_enable(BMesh *UNUSED(bm), BMOperator *op, const int op_flag)
 {
@@ -99,6 +101,8 @@ void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
 {
 	bm->stackdepth++;
 
+	BLI_assert(bm->totflags > 0);
+
 	/* add flag layer, if appropriate */
 	if (bm->stackdepth > 1)
 		bmo_flag_layer_alloc(bm);
@@ -121,6 +125,19 @@ void BMO_pop(BMesh *bm)
 	bm->stackdepth--;
 }
 
+
+/* use for both slot_types_in and slot_types_out */
+static void bmo_op_slots_init(const BMOSlotType *slot_types, BMOpSlot *slot_args)
+{
+	unsigned int i;
+	for (i = 0; slot_types[i].type; i++) {
+		slot_args[i].slot_name    = slot_types[i].name;
+		slot_args[i].slot_type    = slot_types[i].type;
+		slot_args[i].slot_subtype = slot_types[i].subtype;
+		// slot_args[i].index = i;  // UNUSED
+	}
+}
+
 /**
  * \brief BMESH OPSTACK INIT OP
  *
@@ -128,7 +145,7 @@ void BMO_pop(BMesh *bm)
  */
 void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
 {
-	int i, opcode = bmo_opname_to_opcode(opname);
+	int opcode = bmo_opname_to_opcode(opname);
 
 #ifdef DEBUG
 	BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
@@ -142,17 +159,15 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
 
 	memset(op, 0, sizeof(BMOperator));
 	op->type = opcode;
-	op->type_flag = opdefines[opcode]->type_flag;
+	op->type_flag = bmo_opdefines[opcode]->type_flag;
 	op->flag = flag;
 	
 	/* initialize the operator slot types */
-	for (i = 0; opdefines[opcode]->slot_types[i].type; i++) {
-		op->slot_args[i].slot_type = opdefines[opcode]->slot_types[i].type;
-		op->slot_args[i].index = i;
-	}
+	bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_in,  op->slots_in);
+	bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_out, op->slots_out);
 
 	/* callback */
-	op->exec = opdefines[opcode]->exec;
+	op->exec = bmo_opdefines[opcode]->exec;
 
 	/* memarena, used for operator's slot buffers */
 	op->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
@@ -170,7 +185,9 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
  */
 void BMO_op_exec(BMesh *bm, BMOperator *op)
 {
-	
+	/* allocate tool flags on demand */
+	BM_mesh_elem_toolflags_ensure(bm);
+
 	BMO_push(bm, op);
 
 	if (bm->stackdepth == 2)
@@ -183,6 +200,20 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
 	BMO_pop(bm);
 }
 
+static void bmo_op_slots_free(const BMOSlotType *slot_types, BMOpSlot *slot_args)
+{
+	BMOpSlot *slot;
+	unsigned int i;
+	for (i = 0; slot_types[i].type; i++) {
+		slot = &slot_args[i];
+		if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
+			if (slot->data.ghash) {
+				BLI_ghash_free(slot->data.ghash, NULL, NULL);
+			}
+		}
+	}
+}
+
 /**
  * \brief BMESH OPSTACK FINISH OP
  *
@@ -190,21 +221,13 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
  */
 void BMO_op_finish(BMesh *bm, BMOperator *op)
 {
-	BMOpSlot *slot;
-	int i;
-
-	for (i = 0; opdefines[op->type]->slot_types[i].type; i++) {
-		slot = &op->slot_args[i];
-		if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
-			if (slot->data.ghash)
-				BLI_ghash_free(slot->data.ghash, NULL, NULL);
-		}
-	}
+	bmo_op_slots_free(bmo_opdefines[op->type]->slot_types_in,  op->slots_in);
+	bmo_op_slots_free(bmo_opdefines[op->type]->slot_types_out, op->slots_out);
 
 	BLI_memarena_free(op->arena);
 
 #ifdef DEBUG
-	BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->name);
+	BM_ELEM_INDEX_VALIDATE(bm, "post bmo", bmo_opdefines[op->type]->opname);
 #else
 	(void)bm;
 #endif
@@ -215,9 +238,9 @@ void BMO_op_finish(BMesh *bm, BMOperator *op)
  *
  * \return Success if the slot if found.
  */
-int BMO_slot_exists(BMOperator *op, const char *slot_name)
+int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
 {
-	int slot_code = bmo_name_to_slotcode(opdefines[op->type], slot_name);
+	int slot_code = bmo_name_to_slotcode(slot_args, identifier);
 	return (slot_code >= 0);
 }
 
@@ -226,73 +249,118 @@ int BMO_slot_exists(BMOperator *op, const char *slot_name)
  *
  * Returns a pointer to the slot of type 'slot_code'
  */
-BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name)
+BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
 {
-	int slot_code = bmo_name_to_slotcode_check(opdefines[op->type], slot_name);
+	int slot_code = bmo_name_to_slotcode_check(slot_args, identifier);
 
-	if (slot_code < 0) {
-		return &BMOpEmptySlot;
+	if (UNLIKELY(slot_code < 0)) {
+		//return &BMOpEmptySlot;
+		BLI_assert(0);
+		return NULL;  /* better crash */
 	}
 
-	return &(op->slot_args[slot_code]);
+	return &slot_args[slot_code];
 }
 
 /**
  * \brief BMESH OPSTACK COPY SLOT
  *
+ * define used.
  * Copies data from one slot to another.
  */
-void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, const char *dst)
+void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+                    BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+                    struct MemArena *arena_dst)
 {
-	BMOpSlot *source_slot = BMO_slot_get(source_op, src);
-	BMOpSlot *dest_slot = BMO_slot_get(dest_op, dst);
+	BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
+	BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
 
-	if (source_slot == dest_slot)
+	if (slot_src == slot_dst)
 		return;
 
-	if (source_slot->slot_type != dest_slot->slot_type) {
-		/* possibly assert here? */
+	BLI_assert(slot_src->slot_type == slot_dst->slot_type);
+	if (slot_src->slot_type != slot_dst->slot_type) {
 		return;
 	}
 
-	if (dest_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
+	if (slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
 		/* do buffer copy */
-		dest_slot->data.buf = NULL;
-		dest_slot->len = source_slot->len;
-		if (dest_slot->len) {
-			const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[dest_slot->slot_type] * dest_slot->len;
-			dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, slot_alloc_size);
-			memcpy(dest_slot->data.buf, source_slot->data.buf, slot_alloc_size);
+		slot_dst->data.buf = NULL;
+		slot_dst->len = slot_src->len;
+		if (slot_dst->len) {
+			/* check dest has all flags enabled that the source has */
+			const eBMOpSlotSubType_Elem src_elem_flag = (slot_src->slot_subtype.elem & BM_ALL_NOLOOP);
+			const eBMOpSlotSubType_Elem dst_elem_flag = (slot_dst->slot_subtype.elem & BM_ALL_NOLOOP);
+
+			if ((src_elem_flag | dst_elem_flag) == dst_elem_flag) {
+				/* pass */
+			}
+			else {
+				/* check types */
+				const unsigned int tot = slot_src->len;
+				unsigned int i;
+				unsigned int out = 0;
+				BMElem **ele_src = (BMElem **)slot_src->data.buf;
+				for (i = 0; i < tot; i++, ele_src++) {
+					if ((*ele_src)->head.htype & dst_elem_flag) {
+						out++;
+					}
+				}
+				if (out != tot) {
+					slot_dst->len = out;
+				}
+			}
+
+			if (slot_dst->len) {
+				const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type] * slot_dst->len;
+				slot_dst->data.buf = BLI_memarena_alloc(arena_dst, slot_alloc_size);
+				if (slot_src->len == slot_dst->len) {
+					memcpy(slot_dst->data.buf, slot_src->data.buf, slot_alloc_size);
+				}
+				else {
+					/* only copy compatible elements */
+					const unsigned int tot = slot_src->len;
+					unsigned int i;
+					BMElem **ele_src = (BMElem **)slot_src->data.buf;
+					BMElem **ele_dst = (BMElem **)slot_dst->data.buf;
+					for (i = 0; i < tot; i++, ele_src++) {
+						if ((*ele_src)->head.htype & dst_elem_flag) {
+							*ele_dst = *ele_src;
+							ele_dst++;
+						}
+					}
+				}
+			}
 		}
 	}
-	else if (dest_slot->slot_type == BMO_OP_SLOT_MAPPING) {
+	else if (slot_dst->slot_type == BMO_OP_SLOT_MAPPING) {
 		GHashIterator it;
 		BMOElemMapping *srcmap, *dstmap;
 
 		/* sanity check */
-		if (!source_slot->data.ghash) {
+		if (!slot_src->data.ghash) {
 			return;
 		}
 
-		if (!dest_slot->data.ghash) {
-			dest_slot->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
+		if (!slot_dst->data.ghash) {
+			slot_dst->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
 		}
 
-		BLI_ghashIterator_init(&it, source_slot->data.ghash);
-		for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
-			  BLI_ghashIterator_step(&it))
+		for (BLI_ghashIterator_init(&it, slot_src->data.ghash);
+		     (srcmap = BLI_ghashIterator_getValue(&it));
+		     BLI_ghashIterator_step(&it))
 		{
-			dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
+			dstmap = BLI_memarena_alloc(arena_dst, sizeof(*dstmap) + srcmap->len);
 
 			dstmap->element = srcmap->element;
 			dstmap->len = srcmap->len;
-			memcpy(dstmap + 1, srcmap + 1, srcmap->len);
+			memcpy(BMO_OP_SLOT_MAPPING_DATA(dstmap), BMO_OP_SLOT_MAPPING_DATA(srcmap), srcmap->len);
 
-			BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
+			BLI_ghash_insert(slot_dst->data.ghash, dstmap->element, dstmap);
 		}
 	}
 	else {
-		dest_slot->data = source_slot->data;
+		slot_dst->data = slot_src->data;
 	}
 }
 
@@ -302,9 +370,9 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src,
  * Sets the value of a slot depending on it's type
  */
 
-void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
+void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
 	if (!(slot->slot_type == BMO_OP_SLOT_FLT))
 		return;
@@ -312,9 +380,9 @@ void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
 	slot->data.f = f;
 }
 
-void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
+void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
 	if (!(slot->slot_type == BMO_OP_SLOT_INT))
 		return;
@@ -322,9 +390,9 @@ void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
 	slot->data.i = i;
 }
 
-void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
+void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
 	if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
 		return;
@@ -333,9 +401,9 @@ void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
 }
 
 /* only supports square mats */
-void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size)
+void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float *mat, int size)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
 	if (!(slot->slot_type == BMO_OP_SLOT_MAT))
 		return;
@@ -352,33 +420,43 @@ void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, i
 	else {
 		fprintf(stderr, "%s: invalid size argument %d (bmesh internal error)\n", __func__, size);
 
-		memset(slot->data.p, 0, sizeof(float) * 4 * 4);
+		zero_m4(slot->data.p);
 	}
 }
 
-void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4])
+void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
 	if (!(slot->slot_type == BMO_OP_SLOT_MAT))
 		return;
 
-	copy_m4_m4(r_mat, (float (*)[4])slot->data.p);
+	if (slot->data.p) {
+		copy_m4_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
+	}
+	else {
+		unit_m4(r_mat);
+	}
 }
 
-void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3])
+void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3])
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
 	if (!(slot->slot_type == BMO_OP_SLOT_MAT))
 		return;
 
-	copy_m3_m4(r_mat, slot->data.p);
+	if (slot->data.p) {
+		copy_m3_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
+	}
+	else {
+		unit_m3(r_mat);
+	}
 }
 
-void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
+void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
 	if (!(slot->slot_type == BMO_OP_SLOT_PTR))
 		return;
@@ -386,9 +464,9 @@ void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
 	slot->data.p = p;
 }
 
-void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
+void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3])
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
 	if (!(slot->slot_type == BMO_OP_SLOT_VEC))
 		return;
@@ -397,9 +475,9 @@ void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
 }
 
 
-float BMO_slot_float_get(BMOperator *op, const char *slot_name)
+float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
 	if (!(slot->slot_type == BMO_OP_SLOT_FLT))
 		return 0.0f;
@@ -407,9 +485,9 @@ float BMO_slot_float_get(BMOperator *op, const char *slot_name)
 	return slot->data.f;
 }
 
-int BMO_slot_int_get(BMOperator *op, const char *slot_name)
+int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
 	if (!(slot->slot_type == BMO_OP_SLOT_INT))
 		return 0;
@@ -417,9 +495,9 @@ int BMO_slot_int_get(BMOperator *op, const char *slot_name)
 	return slot->data.i;
 }
 
-int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
+int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
 	if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
 		return 0;
@@ -427,10 +505,24 @@ int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
 	return slot->data.i;
 }
 
+/* if you want a copy of the elem buffer */
+void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len)
+{
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+	void *ret;
+
+	/* could add support for mapping type */
+	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+
+	ret = MEM_mallocN(sizeof(void **) * slot->len, __func__);
+	memcpy(ret, slot->data.buf, sizeof(void **) * slot->len);
+	*len = slot->len;
+	return ret;
+}
 
-void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
+void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
 	if (!(slot->slot_type == BMO_OP_SLOT_PTR))
 		return NULL;
@@ -438,9 +530,9 @@ void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
 	return slot->data.p;
 }
 
-void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3])
+void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3])
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
 	if (!(slot->slot_type == BMO_OP_SLOT_VEC))
 		return;
@@ -516,9 +608,9 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
 	}
 }
 
-int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
+int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
 	
 	/* check if its actually a buffer */
@@ -528,9 +620,9 @@ int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_na
 	return slot->len;
 }
 
-int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
+int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
 	
 	/* check if its actually a buffer */
@@ -543,24 +635,27 @@ int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
 /* inserts a key/value mapping into a mapping slot.  note that it copies the
  * value, it doesn't store a reference to it. */
 
-void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
-                         void *element, void *data, int len)
+void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
+                         const void *element, const void *data, const int len)
 {
 	BMOElemMapping *mapping;
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
+	BMO_ASSERT_SLOT_IN_OP(slot, op);
 
 	mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
 
 	mapping->element = (BMHeader *) element;
 	mapping->len = len;
-	memcpy(mapping + 1, data, len);
+	memcpy(BMO_OP_SLOT_MAPPING_DATA(mapping), data, len);
 
 	if (!slot->data.ghash) {
 		slot->data.ghash = BLI_ghash_ptr_new("bmesh slot map hash");
 	}
+	else {
+		BLI_assert(slot->data.ghash);
+	}
 
-	BLI_ghash_insert(slot->data.ghash, element, mapping);
+	BLI_ghash_insert(slot->data.ghash, (void *)element, mapping);
 }
 
 #if 0
@@ -580,7 +675,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
 		if (slot->len >= slot->size) {
 			slot->size = (slot->size + 1 + totadd) * 2;
 
-			allocsize = BMO_OPSLOT_TYPEINFO[opdefines[op->type]->slot_types[slot_code].type] * slot->size;
+			allocsize = BMO_OPSLOT_TYPEINFO[bmo_opdefines[op->type]->slot_types[slot_code].type] * slot->size;
 
 			tmp = slot->data.buf;
 			slot->data.buf = MEM_callocN(allocsize, "opslot dynamic array");
@@ -595,7 +690,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
 		slot->len += totadd;
 		slot->size = slot->len + 2;
 
-		allocsize = BMO_OPSLOT_TYPEINFO[opdefines[op->type]->slot_types[slot_code].type] * slot->len;
+		allocsize = BMO_OPSLOT_TYPEINFO[bmo_opdefines[op->type]->slot_types[slot_code].type] * slot->len;
 
 		tmp = slot->data.buf;
 		slot->data.buf = MEM_callocN(allocsize, "opslot dynamic array");
@@ -606,11 +701,11 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
 }
 #endif
 
-void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                           const char htype, const short oflag)
 {
 	GHashIterator it;
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BMElemF *ele_f;
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
@@ -626,18 +721,22 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
 	}
 }
 
-void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len)
+void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int len)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
-	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 
 	/* check if its actually a buffer */
 	if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
 		return NULL;
 	
 	slot->len = len;
-	if (len)
+	if (len) {
 		slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slot_type] * len);
+	}
+	else {
+		slot->data.buf = NULL;
+	}
+
 	return slot->data.buf;
 }
 
@@ -646,9 +745,10 @@ void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len
  *
  * Copies all elements of a certain type into an operator slot.
  */
-void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name, const char htype)
+void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+                              const char *slot_name, const char htype)
 {
-	BMOpSlot *output = BMO_slot_get(op, slot_name);
+	BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
 	int totelement = 0, i = 0;
 	
 	if (htype & BM_VERT) totelement += bm->totvert;
@@ -659,27 +759,27 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
 		BMIter iter;
 		BMHeader *ele;
 
-		BMO_slot_buffer_alloc(op, slot_name, totelement);
+		BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
 
 		/* TODO - collapse these loops into one */
 
 		if (htype & BM_VERT) {
 			BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
-				((BMHeader **)output->data.p)[i] = ele;
+				output->data.buf[i] = ele;
 				i++;
 			}
 		}
 
 		if (htype & BM_EDGE) {
 			BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
-				((BMHeader **)output->data.p)[i] = ele;
+				output->data.buf[i] = ele;
 				i++;
 			}
 		}
 
 		if (htype & BM_FACE) {
 			BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
-				((BMHeader **)output->data.p)[i] = ele;
+				output->data.buf[i] = ele;
 				i++;
 			}
 		}
@@ -692,11 +792,11 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
  * Copies elements of a certain type, which have a certain header flag
  * enabled/disabled into a slot for an operator.
  */
-static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                        const char htype, const char hflag,
                                        const short test_for_enabled)
 {
-	BMOpSlot *output = BMO_slot_get(op, slot_name);
+	BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
 	int totelement = 0, i = 0;
 	const int respecthide = (op->flag & BMO_FLAG_RESPECT_HIDE) != 0;
 
@@ -711,7 +811,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
 		BMIter iter;
 		BMElem *ele;
 
-		BMO_slot_buffer_alloc(op, slot_name, totelement);
+		BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
 
 		/* TODO - collapse these loops into one */
 
@@ -720,7 +820,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
 				if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
 				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
 				{
-					((BMElem **)output->data.p)[i] = ele;
+					output->data.buf[i] = ele;
 					i++;
 				}
 			}
@@ -731,7 +831,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
 				if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
 				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
 				{
-					((BMElem **)output->data.p)[i] = ele;
+					output->data.buf[i] = ele;
 					i++;
 				}
 			}
@@ -742,7 +842,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
 				if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
 				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
 				{
-					((BMElem **)output->data.p)[i] = ele;
+					output->data.buf[i] = ele;
 					i++;
 				}
 			}
@@ -753,46 +853,74 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
 	}
 }
 
-void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
+                                        BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                         const char htype, const char hflag)
 {
-	bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, TRUE);
+	bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, TRUE);
 }
 
-void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
+                                         BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                          const char htype, const char hflag)
 {
-	bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, FALSE);
+	bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, FALSE);
+}
+
+void BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele)
+{
+	BMO_ASSERT_SLOT_IN_OP(slot, op);
+	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
+	BLI_assert(slot->len == 0 || slot->len == 1);
+
+	BLI_assert(slot->slot_subtype.elem & ele->htype);
+
+	slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);  /* XXX, why 'x4' ? */
+	slot->len = 1;
+	*slot->data.buf = ele;
+}
+
+void *BMO_slot_buffer_get_single(BMOpSlot *slot)
+{
+	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
+	BLI_assert(slot->len == 0 || slot->len == 1);
+
+	return slot->len ? (BMHeader *)slot->data.buf[0] : NULL;
 }
 
 /**
  * Copies the values from another slot to the end of the output slot.
  */
-void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
-                            BMOperator *other_op, const char *other_slot_name)
+void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+                             BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+                             struct MemArena *arena_dst)
 {
-	BMOpSlot *output_slot = BMO_slot_get(output_op, output_slot_name);
-	BMOpSlot *other_slot = BMO_slot_get(other_op, other_slot_name);
+	BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
+	BMOpSlot *slot_src  = BMO_slot_get(slot_args_src,  slot_name_src);
 
-	BLI_assert(output_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
-	           other_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
+	           slot_src->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
 
-	if (output_slot->len == 0) {
+	if (slot_dst->len == 0) {
 		/* output slot is empty, copy rather than append */
-		BMO_slot_copy(other_op, output_op, other_slot_name, output_slot_name);
+		_bmo_slot_copy(slot_args_src, slot_name_src,
+		               slot_args_dst, slot_name_dst,
+		               arena_dst);
 	}
-	else if (other_slot->len != 0) {
-		int elem_size = BMO_OPSLOT_TYPEINFO[output_slot->slot_type];
-		int alloc_size = elem_size * (output_slot->len + other_slot->len);
+	else if (slot_src->len != 0) {
+		int elem_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type];
+		int alloc_size = elem_size * (slot_dst->len + slot_src->len);
 		/* allocate new buffer */
-		void *buf = BLI_memarena_alloc(output_op->arena, alloc_size);
+		void *buf = BLI_memarena_alloc(arena_dst, alloc_size);
 
 		/* copy slot data */
-		memcpy(buf, output_slot->data.buf, elem_size * output_slot->len);
-		memcpy(((char *)buf) + elem_size * output_slot->len, other_slot->data.buf, elem_size * other_slot->len);
+		memcpy(buf, slot_dst->data.buf, elem_size * slot_dst->len);
+		memcpy(((char *)buf) + elem_size * slot_dst->len, slot_src->data.buf, elem_size * slot_src->len);
 
-		output_slot->data.buf = buf;
-		output_slot->len += other_slot->len;
+		slot_dst->data.buf = buf;
+		slot_dst->len += slot_src->len;
 	}
 }
 
@@ -802,13 +930,15 @@ void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
  * Copies elements of a certain type, which have a certain flag set
  * into an output slot for an operator.
  */
-static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
+                                      BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                       const char htype, const short oflag,
                                       const short test_for_enabled)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	int totelement, i = 0;
 
+	BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
 	BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
 
 	if (test_for_enabled)
@@ -817,15 +947,16 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
 		totelement = BMO_mesh_disabled_flag_count(bm, htype, oflag);
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
 
 	if (totelement) {
 		BMIter iter;
 		BMHeader *ele;
 		BMHeader **ele_array;
 
-		BMO_slot_buffer_alloc(op, slot_name, totelement);
+		BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
 
-		ele_array = (BMHeader **)slot->data.p;
+		ele_array = (BMHeader **)slot->data.buf;
 
 		/* TODO - collapse these loops into one */
 
@@ -861,16 +992,18 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
 	}
 }
 
-void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
+                                       BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                        const char htype, const short oflag)
 {
-	bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, TRUE);
+	bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, TRUE);
 }
 
-void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
+                                        BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                         const char htype, const short oflag)
 {
-	bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, FALSE);
+	bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, FALSE);
 }
 
 /**
@@ -879,16 +1012,18 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *s
  * Header Flags elements in a slots buffer, automatically
  * using the selection API where appropriate.
  */
-void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_enable(BMesh *bm,
+                                  BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                   const char htype, const char hflag, const char do_flush)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
-	BMElem **data =  slot->data.p;
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+	BMElem **data =  (BMElem **)slot->data.buf;
 	int i;
 	const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
 	const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
 
 	for (i = 0; i < slot->len; i++, data++) {
 		if (!(htype & (*data)->head.htype))
@@ -912,16 +1047,18 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_na
  * Removes flags from elements in a slots buffer, automatically
  * using the selection API where appropriate.
  */
-void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_disable(BMesh *bm,
+                                   BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                    const char htype, const char hflag, const char do_flush)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
-	BMElem **data =  slot->data.p;
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+	BMElem **data =  (BMElem **)slot->data.buf;
 	int i;
 	const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
 	const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
 
 	for (i = 0; i < slot->len; i++, data++) {
 		if (!(htype & (*data)->head.htype))
@@ -963,14 +1100,16 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
  *
  * Flags elements in a slots buffer
  */
-void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_enable(BMesh *bm,
+                                 BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                  const char htype, const short oflag)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	BMHeader **data =  slot->data.p;
 	int i;
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
 
 	for (i = 0; i < slot->len; i++) {
 		if (!(htype & data[i]->htype))
@@ -985,14 +1124,16 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_nam
  *
  * Removes flags from elements in a slots buffer
  */
-void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_disable(BMesh *bm,
+                                  BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
                                   const char htype, const short oflag)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
-	BMHeader **data =  slot->data.p;
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+	BMHeader **data = (BMHeader **)slot->data.buf;
 	int i;
 
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+	BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
 
 	for (i = 0; i < slot->len; i++) {
 		if (!(htype & data[i]->htype))
@@ -1024,13 +1165,15 @@ static void bmo_flag_layer_alloc(BMesh *bm)
 	int i;
 
 	BMIter iter;
-	BLI_mempool *oldpool = bm->toolflagpool; 		/* old flag pool */
+	BLI_mempool *oldpool = bm->toolflagpool;  /* old flag pool */
 	BLI_mempool *newpool;
 	void *oldflags;
 
 	/* store memcpy size for reuse */
 	const size_t old_totflags_size = (bm->totflags * sizeof(BMFlagLayer));
-	
+
+	BLI_assert(oldpool != NULL);
+
 	bm->totflags++;
 
 	/* allocate new flag poo */
@@ -1042,18 +1185,21 @@ static void bmo_flag_layer_alloc(BMesh *bm)
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, old_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) {
 		oldflags = ele->oflags;
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, old_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) {
 		oldflags = ele->oflags;
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, old_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 
 	bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
@@ -1079,7 +1225,7 @@ static void bmo_flag_layer_free(BMesh *bm)
 	/* de-increment the totflags first.. */
 	bm->totflags--;
 	/* allocate new flag poo */
-	bm->toolflagpool = newpool = BLI_mempool_create(new_totflags_size, 512, 512, BLI_MEMPOOL_SYSMALLOC);
+	bm->toolflagpool = newpool = BLI_mempool_create(new_totflags_size, 512, 512, 0);
 	
 	/* now go through and memcpy all the flag */
 	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) {
@@ -1087,18 +1233,21 @@ static void bmo_flag_layer_free(BMesh *bm)
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, new_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) {
 		oldflags = ele->oflags;
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, new_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) {
 		oldflags = ele->oflags;
 		ele->oflags = BLI_mempool_calloc(newpool);
 		memcpy(ele->oflags, oldflags, new_totflags_size);
 		BM_elem_index_set(ele, i); /* set_inline */
+		BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
 	}
 
 	bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
@@ -1133,14 +1282,14 @@ static void bmo_flag_layer_clear(BMesh *bm)
 	bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
 }
 
-void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
+void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 	
 	if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
 		return NULL;
 
-	return slot->data.buf ? *(void **)slot->data.buf : NULL;
+	return slot->data.buf ? *slot->data.buf : NULL;
 }
 
 /**
@@ -1149,10 +1298,11 @@ void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
  * \param restrictmask restricts the iteration to certain element types
  * (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
  * over an element buffer (not a mapping). */
-void *BMO_iter_new(BMOIter *iter, BMesh *UNUSED(bm), BMOperator *op,
-                   const char *slot_name, const char restrictmask)
+void *BMO_iter_new(BMOIter *iter,
+                   BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
+                   const char restrictmask)
 {
-	BMOpSlot *slot = BMO_slot_get(op, slot_name);
+	BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
 
 	memset(iter, 0, sizeof(BMOIter));
 
@@ -1174,35 +1324,42 @@ void *BMO_iter_new(BMOIter *iter, BMesh *UNUSED(bm), BMOperator *op,
 
 void *BMO_iter_step(BMOIter *iter)
 {
-	if (iter->slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
-		BMHeader *h;
+	BMOpSlot *slot = iter->slot;
+	if (slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
+		BMHeader *ele;
 
-		if (iter->cur >= iter->slot->len) {
+		if (iter->cur >= slot->len) {
 			return NULL;
 		}
 
-		h = ((void **)iter->slot->data.buf)[iter->cur++];
-		while (!(iter->restrictmask & h->htype)) {
-			if (iter->cur >= iter->slot->len) {
+		ele = slot->data.buf[iter->cur++];
+		while (!(iter->restrictmask & ele->htype)) {
+			if (iter->cur >= slot->len) {
 				return NULL;
 			}
 
-			h = ((void **)iter->slot->data.buf)[iter->cur++];
+			ele = slot->data.buf[iter->cur++];
+			BLI_assert((ele == NULL) || (slot->slot_subtype.elem & ele->htype));
 		}
 
-		return h;
+		BLI_assert((ele == NULL) || (slot->slot_subtype.elem & ele->htype));
+
+		return ele;
 	}
-	else if (iter->slot->slot_type == BMO_OP_SLOT_MAPPING) {
+	else if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
 		BMOElemMapping *map;
 		void *ret = BLI_ghashIterator_getKey(&iter->giter);
 		map = BLI_ghashIterator_getValue(&iter->giter);
 		
-		iter->val = map + 1;
+		iter->val = BMO_OP_SLOT_MAPPING_DATA(map);
 
 		BLI_ghashIterator_step(&iter->giter);
 
 		return ret;
 	}
+	else {
+		BLI_assert(0);
+	}
 
 	return NULL;
 }
@@ -1241,7 +1398,9 @@ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
 	BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error");
 	
 	err->errorcode = errcode;
-	if (!msg) msg = bmo_error_messages[errcode];
+	if (!msg) {
+		msg = bmo_error_messages[errcode];
+	}
 	err->msg = msg;
 	err->op = owner;
 	
@@ -1284,24 +1443,26 @@ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
 
 #define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0)
 
-static int bmo_name_to_slotcode(BMOpDefine *def, const char *name)
+static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
 {
-	int i;
+	int i = 0;
 
-	for (i = 0; def->slot_types[i].type; i++) {
-		if (!strncmp(name, def->slot_types[i].name, MAX_SLOTNAME)) {
+	while (slot_args->slot_name) {
+		if (strncmp(identifier, slot_args->slot_name, MAX_SLOTNAME) == 0) {
 			return i;
 		}
+		slot_args++;
+		i++;
 	}
 
 	return -1;
 }
 
-static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name)
+static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
 {
-	int i = bmo_name_to_slotcode(def, name);
+	int i = bmo_name_to_slotcode(slot_args, identifier);
 	if (i < 0) {
-		fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, name);
+		fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, identifier);
 	}
 
 	return i;
@@ -1311,36 +1472,78 @@ static int bmo_opname_to_opcode(const char *opname)
 {
 	int i;
 
-	for (i = 0; i < bmesh_total_ops; i++) {
-		if (!strcmp(opname, opdefines[i]->name)) {
+	for (i = 0; i < bmo_opdefines_total; i++) {
+		if (!strcmp(opname, bmo_opdefines[i]->opname)) {
 			return i;
 		}
 	}
 
-	fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
+	fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
 	return -1;
 }
 
-/* Example:
- * BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT);
+/**
+ * \brief Format Strings for #BMOperator Initialization.
+ *
+ * This system is used to execute or initialize an operator,
+ * using a formatted-string system.
+ *
+ * The basic format for the format string is:
+ * `[operatorname] [slot_name]=%[code] [slot_name]=%[code]`
  *
- *  i - int
- *  b - boolean (same as int but 1/0 only)
- *  f - float
- *  hv - header flagged verts (hflag)
- *  he - header flagged edges (hflag)
- *  hf - header flagged faces (hflag)
- *  fv - flagged verts (oflag)
- *  fe - flagged edges (oflag)
- *  ff - flagged faces (oflag)
+ * Example:
  *
- * capitals - H, F to use the flag flipped (when the flag is off)
- * Hv, He, Hf, Fv, Fe, Ff,
+ * \code{.c}
+ *     BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ *                  "delete context=%i geom=%hv",
+ *                  DEL_ONLYFACES, BM_ELEM_SELECT);
+ * \endcode
+ *
+ *
+ * **Primitive Types**
+ * - `b` - boolean (same as int but 1/0 only). #BMO_OP_SLOT_BOOL
+ * - `i` - int. #BMO_OP_SLOT_INT
+ * - `f` - float. #BMO_OP_SLOT_FLT
+ * - `p` - pointer (normally to a Scene/Mesh/Object/BMesh). #BMO_OP_SLOT_PTR
+ * - `m3` - 3x3 matrix of floats. #BMO_OP_SLOT_MAT
+ * - `m4` - 4x4 matrix of floats. #BMO_OP_SLOT_MAT
+ * - `v` - 3D vector of floats. #BMO_OP_SLOT_VEC
+ *
+ *
+ * **Utility**
+ *
+ * Pass an existing slot which is copied to either an input or output slot.
+ * Taking the operator and slot-name pair of args.
+ * - `s` - slot_in (lower case)
+ * - `S` - slot_out (upper case)
+ *
+ *
+ * **Element Buffer** (#BMO_OP_SLOT_ELEMENT_BUF)
+ * - `e` - single element vert/edge/face (use with #BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE).
+ * - `av` - all verts
+ * - `ae` - all edges
+ * - `af` - all faces
+ * - `hv` - header flagged verts (hflag)
+ * - `he` - header flagged edges (hflag)
+ * - `hf` - header flagged faces (hflag)
+ * - `Hv` - header flagged verts (hflag off)
+ * - `He` - header flagged edges (hflag off)
+ * - `Hf` - header flagged faces (hflag off)
+ * - `fv` - flagged verts (oflag)
+ * - `fe` - flagged edges (oflag)
+ * - `ff` - flagged faces (oflag)
+ * - `Fv` - flagged verts (oflag off)
+ * - `Fe` - flagged edges (oflag off)
+ * - `Ff` - flagged faces (oflag off)
+ *
+ * \note The common v/e/f suffix can be mixed,
+ * so `avef` is can be used for all verts, edges and faces.
+ * Order is not important so `Hfev` is also valid (all unflagged verts, edges and faces).
  */
 
 int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
 {
-	BMOpDefine *def;
+//	BMOpDefine *def;
 	char *opname, *ofmt, *fmt;
 	char slot_name[64] = {0};
 	int i /*, n = strlen(fmt) */, stop /*, slot_code = -1 */, type, state;
@@ -1379,7 +1582,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
 	}
 
 	BMO_op_init(bm, op, flag, opname);
-	def = opdefines[i];
+//	def = bmo_opdefines[i];
 	
 	i = 0;
 	state = 1; /* 0: not inside slot_code name, 1: inside slot_code name */
@@ -1402,7 +1605,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
 
 			fmt[i] = 0;
 
-			if (bmo_name_to_slotcode_check(def, fmt) < 0) {
+			if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) {
 				GOTO_ERROR("name to slot code check failed");
 			}
 			
@@ -1428,47 +1631,55 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
 					else if (c == '4') size = 4;
 					else GOTO_ERROR("matrix size was not 3 or 4");
 
-					BMO_slot_mat_set(op, slot_name, va_arg(vlist, void *), size);
+					BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
 					state = 1;
 					break;
 				}
 				case 'v':
 				{
-					BMO_slot_vec_set(op, slot_name, va_arg(vlist, float *));
+					BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *));
 					state = 1;
 					break;
 				}
-				case 'e':
+				case 'e':  /* single vert/edge/face */
 				{
 					BMHeader *ele = va_arg(vlist, void *);
-					BMOpSlot *slot = BMO_slot_get(op, slot_name);
+					BMOpSlot *slot = BMO_slot_get(op->slots_in, slot_name);
 
-					slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
-					slot->len = 1;
-					*((void **)slot->data.buf) = ele;
+					BMO_slot_buffer_from_single(op, slot, ele);
 
 					state = 1;
 					break;
 				}
 				case 's':
+				case 'S':
 				{
-					BMOperator *op2 = va_arg(vlist, void *);
-					const char *slot_name2 = va_arg(vlist, char *);
+					BMOperator *op_other        = va_arg(vlist, void *);
+					const char *slot_name_other = va_arg(vlist, char *);
 
-					BMO_slot_copy(op2, op, slot_name2, slot_name);
+					if (*fmt == 's') {
+						BLI_assert(bmo_name_to_slotcode_check(op_other->slots_in, slot_name_other) != -1);
+						BMO_slot_copy(op_other, slots_in, slot_name_other,
+						              op,       slots_in, slot_name);
+					}
+					else {
+						BLI_assert(bmo_name_to_slotcode_check(op_other->slots_out, slot_name_other) != -1);
+						BMO_slot_copy(op_other, slots_out, slot_name_other,
+						              op,       slots_in, slot_name);
+					}
 					state = 1;
 					break;
 				}
 				case 'i':
-					BMO_slot_int_set(op, slot_name, va_arg(vlist, int));
+					BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int));
 					state = 1;
 					break;
 				case 'b':
-					BMO_slot_bool_set(op, slot_name, va_arg(vlist, int));
+					BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int));
 					state = 1;
 					break;
 				case 'p':
-					BMO_slot_ptr_set(op, slot_name, va_arg(vlist, void *));
+					BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *));
 					state = 1;
 					break;
 				case 'f':
@@ -1479,7 +1690,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
 					type = *fmt;
 
 					if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\0') {
-						BMO_slot_float_set(op, slot_name, va_arg(vlist, double));
+						BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double));
 					}
 					else {
 						htype = 0;
@@ -1501,19 +1712,19 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
 						}
 
 						if (type == 'h') {
-							BMO_slot_buffer_from_enabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
+							BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
 						}
 						else if (type == 'H') {
-							BMO_slot_buffer_from_disabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
+							BMO_slot_buffer_from_disabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
 						}
 						else if (type == 'a') {
-							BMO_slot_buffer_from_all(bm, op, slot_name, htype);
+							BMO_slot_buffer_from_all(bm, op, op->slots_in, slot_name, htype);
 						}
 						else if (type == 'f') {
-							BMO_slot_buffer_from_enabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
+							BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
 						}
 						else if (type == 'F') {
-							BMO_slot_buffer_from_disabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
+							BMO_slot_buffer_from_disabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
 						}
 					}
 
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index b1da8ec..d02b0dc 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -46,11 +46,18 @@ enum {
 	SUBDIV_SELECT_LOOPCUT
 };
 
+enum {
+	SIM_CMP_EQ = 0,
+	SIM_CMP_GT,
+	SIM_CMP_LT
+};
+
 /* similar face selection slot values */
 enum {
 	SIMFACE_MATERIAL = 201,
 	SIMFACE_IMAGE,
 	SIMFACE_AREA,
+	SIMFACE_SIDES,
 	SIMFACE_PERIMETER,
 	SIMFACE_NORMAL,
 	SIMFACE_COPLANAR
@@ -76,34 +83,22 @@ enum {
 	SIMVERT_EDGE
 };
 
-enum {
-	OPUVC_AXIS_X = 1,
-	OPUVC_AXIS_Y
-};
-
-enum {
-	DIRECTION_CW = 1,
-	DIRECTION_CCW
-};
-
 /* vertex path selection values */
 enum {
 	VPATH_SELECT_EDGE_LENGTH = 0,
 	VPATH_SELECT_TOPOLOGICAL
 };
 
-extern BMOpDefine *opdefines[];
-extern int bmesh_total_ops;
+extern const BMOpDefine *bmo_opdefines[];
+extern const int         bmo_opdefines_total;
 
 /*------specific operator helper functions-------*/
-
-struct Object;
-
 void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
                         float smooth, float fractal, float along_normal,
                         int numcuts,
                         int seltype, int cornertype,
-                        const short use_singleedge, const short use_gridfill,
+                        const short use_single_edge, const short use_grid_fill,
+                        const short use_only_quads,
                         int seed);
 
 #include "intern/bmesh_operator_api_inline.h"
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
index dc1bdaa..9175af1 100644
--- a/source/blender/bmesh/intern/bmesh_operators_private.h
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -61,7 +61,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op);
 void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op);
 void bmo_duplicate_exec(BMesh *bm, BMOperator *op);
 void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op);
-void bmo_edgenet_prepare(BMesh *bm, BMOperator *op);
+void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op);
@@ -91,15 +91,18 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op);
 void bmo_similar_verts_exec(BMesh *bm, BMOperator *op);
 void bmo_slide_vert_exec(BMesh *bm, BMOperator *op);
 void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op);
+void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op);
 void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op);
 void bmo_spin_exec(BMesh *bm, BMOperator *op);
 void bmo_split_edges_exec(BMesh *bm, BMOperator *op);
 void bmo_split_exec(BMesh *bm, BMOperator *op);
 void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op);
+void bmo_symmetrize_exec(BMesh *bm, BMOperator *op);
 void bmo_transform_exec(BMesh *bm, BMOperator *op);
 void bmo_translate_exec(BMesh *bm, BMOperator *op);
 void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op);
 void bmo_triangulate_exec(BMesh *bm, BMOperator *op);
+void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op);
 void bmo_weld_verts_exec(BMesh *bm, BMOperator *op);
 void bmo_wireframe_exec(BMesh *bm, BMOperator *op);
 
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index eb2b772..2e04718 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -162,7 +162,7 @@ float BM_face_calc_area(BMFace *f)
 	float area;
 	int i;
 
-	BLI_array_fixedstack_declare(verts, BM_NGON_STACK_SIZE, f->len, __func__);
+	BLI_array_fixedstack_declare(verts, BM_DEFAULT_NGON_STACK_SIZE, f->len, __func__);
 
 	BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
 		copy_v3_v3(verts[i], l->v->co);
@@ -313,7 +313,7 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
 
 	float up[3] = {0.0f, 0.0f, 1.0f}, axis[3], q[4];
 	float mat[3][3];
-	double angle;
+	float angle;
 	int i;
 
 	cross_v3_v3v3(axis, normal, up);
@@ -329,7 +329,7 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
 		axis[2] = 0.0f;
 	}
 
-	axis_angle_to_quat(q, axis, (float)angle);
+	axis_angle_to_quat(q, axis, angle);
 	quat_to_mat3(mat, q);
 
 	for (i = 0; i < nverts; i++)
@@ -507,8 +507,8 @@ static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3
 
 #define GETMIN2_AXIS(a, b, ma, mb, axis)   \
 	{                                      \
-		ma[axis] = minf(a[axis], b[axis]); \
-		mb[axis] = maxf(a[axis], b[axis]); \
+		ma[axis] = min_ff(a[axis], b[axis]); \
+		mb[axis] = max_ff(a[axis], b[axis]); \
 	} (void)0
 
 #define GETMIN2(a, b, ma, mb)          \
@@ -677,6 +677,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
 	BMLoop *l_first;
 
 	const float cos_threshold = 0.9f;
+	const float bias = 1.0f + 1e-6f;
 
 	if (f->len == 4) {
 		BMLoop *larr[4];
@@ -691,7 +692,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
 		/* pick 0/1 based on best lenth */
 		/* XXX Can't only rely on such test, also must check we do not get (too much) degenerated triangles!!! */
 		i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
-		     len_squared_v3v3(larr[1]->v->co, larr[3]->v->co))) != use_beauty);
+		     len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias)) != use_beauty);
 		i4 = (i + 3) % 4;
 		/* Check produced tris aren’t too flat/narrow...
 		 * Probably not the best test, but is quite efficient and should at least avoid null-area faces! */
@@ -965,8 +966,8 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
 	float fac1 = 1.0000001f, fac2 = 0.9f; //9999f; //0.999f;
 	int i, j, a = 0, clen;
 
-	BLI_array_fixedstack_declare(projverts, BM_NGON_STACK_SIZE, f->len,      "projvertsb");
-	BLI_array_fixedstack_declare(edgeverts, BM_NGON_STACK_SIZE * 2, len * 2, "edgevertsb");
+	BLI_array_fixedstack_declare(projverts, BM_DEFAULT_NGON_STACK_SIZE, f->len,      "projvertsb");
+	BLI_array_fixedstack_declare(edgeverts, BM_DEFAULT_NGON_STACK_SIZE * 2, len * 2, "edgevertsb");
 	
 	i = 0;
 	l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
@@ -994,8 +995,8 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
 
 	for (i = 0, l = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l = l->next) {
 		p1 = projverts[i];
-		out[0] = maxf(out[0], p1[0]);
-		out[1] = maxf(out[1], p1[1]);
+		out[0] = max_ff(out[0], p1[0]);
+		out[1] = max_ff(out[1], p1[1]);
 		/* out[2] = 0.0f; */ /* keep at zero */
 
 		p1[2] = 0.0f;
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index b3fe367..850e81b 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -56,15 +56,21 @@ int bmesh_elem_check(void *element, const char htype);
 int bmesh_radial_length(BMLoop *l);
 int bmesh_disk_count(BMVert *v);
 
-/* NOTE: ensure different parts of the API do not conflict
+/**
+ * Internal BMHeader.api_flag
+ * \note Ensure different parts of the API do not conflict
  * on using these internal flags!*/
-#define _FLAG_JF	1 /* join faces */
-#define _FLAG_MF	2 /* make face */
-#define _FLAG_MV	2 /* make face, vertex */
+enum {
+	_FLAG_JF       = (1 << 0),  /* join faces */
+	_FLAG_MF       = (1 << 1),  /* make face */
+	_FLAG_MV       = (1 << 1),  /* make face, vertex */
+	_FLAG_OVERLAP  = (1 << 2)   /* general overlap flag  */
+};
 
-#define BM_ELEM_API_FLAG_ENABLE(element, f)  ((element)->oflags[0].pflag |=  (f))
-#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f))
-#define BM_ELEM_API_FLAG_TEST(element, f)    ((element)->oflags[0].pflag &   (f))
+#define BM_ELEM_API_FLAG_ENABLE(element, f)  ((element)->head.api_flag |=  (f))
+#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->head.api_flag &= ~(f))
+#define BM_ELEM_API_FLAG_TEST(element, f)    ((element)->head.api_flag &   (f))
+#define BM_ELEM_API_FLAG_CLEAR(element)      ((element)->head.api_flag = 0)
 
 void calc_poly_plane(float (*verts)[3], const int nverts);
 void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index d850eb3..195c60c 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -39,8 +39,6 @@
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
-#define BM_OVERLAP (1 << 13)
-
 /**
  * Returns whether or not a given vertex is
  * is part of a given edge.
@@ -240,7 +238,7 @@ int BM_vert_in_face(BMFace *f, BMVert *v)
  * Compares the number of vertices in an array
  * that appear in a given face
  */
-int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
+int BM_verts_in_face(BMFace *f, BMVert **varr, int len)
 {
 	BMLoop *l_iter, *l_first;
 
@@ -251,7 +249,7 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
 	int i, count = 0;
 	
 	for (i = 0; i < len; i++) {
-		BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP);
+		BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP);
 	}
 
 #ifdef USE_BMESH_HOLES
@@ -266,14 +264,16 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
 #endif
 
 		do {
-			if (BMO_elem_flag_test(bm, l_iter->v, BM_OVERLAP)) {
+			if (BM_ELEM_API_FLAG_TEST(l_iter->v, _FLAG_OVERLAP)) {
 				count++;
 			}
 
 		} while ((l_iter = l_iter->next) != l_first);
 	}
 
-	for (i = 0; i < len; i++) BMO_elem_flag_disable(bm, varr[i], BM_OVERLAP);
+	for (i = 0; i < len; i++) {
+		BM_ELEM_API_FLAG_DISABLE(varr[i], _FLAG_OVERLAP);
+	}
 
 	return count;
 }
@@ -298,6 +298,14 @@ int BM_edge_in_face(BMFace *f, BMEdge *e)
 }
 
 /**
+ * Returns whether or not a given edge is is part of a given loop.
+ */
+int BM_edge_in_loop(BMEdge *e, BMLoop *l)
+{
+	return (l->e == e || l->prev->e == e);
+}
+
+/**
  * Returns whether or not two vertices are in
  * a given edge
  */
@@ -316,6 +324,97 @@ BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v)
 }
 
 /**
+ * Given a edge and a loop (assumes the edge is manifold). returns
+ * the other faces loop, sharing the same vertex.
+ *
+ * <pre>
+ * +-------------------+
+ * |                   |
+ * |                   |
+ * |l_other <-- return |
+ * +-------------------+ <-- A manifold edge between 2 faces
+ * |l    e  <-- edge   |
+ * |^ <-------- loop   |
+ * |                   |
+ * +-------------------+
+ * </pre>
+ */
+BMLoop *BM_edge_other_loop(BMEdge *e, BMLoop *l)
+{
+	BMLoop *l_other;
+
+	// BLI_assert(BM_edge_is_manifold(e));  // TOO strict, just check if we have another radial face
+	BLI_assert(e->l && e->l->radial_next != e->l);
+	BLI_assert(BM_vert_in_edge(e, l->v));
+
+	l_other = (l->e == e) ? l : l->prev;
+	l_other = l_other->radial_next;
+	BLI_assert(l_other->e == e);
+
+	if (l_other->v == l->v) {
+		/* pass */
+	}
+	else if (l_other->next->v == l->v) {
+		l_other = l_other->next;
+	}
+	else {
+		BLI_assert(0);
+	}
+
+	return l_other;
+}
+
+/**
+ * Utility function to step around a fan of loops,
+ * using an edge to mark the previous side.
+ *
+ * \note all edges must be manifold,
+ * once a non manifold edge is hit, return NULL.
+ *
+ * <pre>
+ *                ,.,-->|
+ *            _,-'      |
+ *          ,'          | (notice how 'e_step'
+ *         /            |  and 'l' define the
+ *        /             |  direction the arrow
+ *       |     return   |  points).
+ *       |     loop --> |
+ * ---------------------+---------------------
+ *         ^      l --> |
+ *         |            |
+ *  assign e_step       |
+ *                      |
+ *   begin e_step ----> |
+ *                      |
+ * </pre>
+ */
+
+BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
+{
+	BMEdge *e_prev = *e_step;
+	BMEdge *e_next;
+	if (l->e == e_prev) {
+		e_next = l->prev->e;
+	}
+	else if (l->prev->e == e_prev) {
+		e_next = l->e;
+	}
+	else {
+		BLI_assert(0);
+		return NULL;
+	}
+
+	if (BM_edge_is_manifold(e_next)) {
+		return BM_edge_other_loop((*e_step = e_next), l);
+	}
+	else {
+		return NULL;
+	}
+}
+
+
+
+/**
  * The function takes a vertex at the center of a fan and returns the opposite edge in the fan.
  * All edges in the fan must be manifold, otherwise return NULL.
  *
@@ -626,6 +725,47 @@ int BM_edge_is_boundary(BMEdge *e)
 #endif
 
 /**
+ * Returns the number of faces that are adjacent to both f1 and f2,
+ * \note Could be sped up a bit by not using iterators and by tagging
+ * faces on either side, then count the tags rather then searching.
+ */
+int BM_face_share_face_count(BMFace *f1, BMFace *f2)
+{
+	BMIter iter1, iter2;
+	BMEdge *e;
+	BMFace *f;
+	int count = 0;
+
+	BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
+		BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
+			if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2))
+				count++;
+		}
+	}
+
+	return count;
+}
+
+/**
+ * same as #BM_face_share_face_count but returns a bool
+ */
+int BM_face_share_face_check(BMFace *f1, BMFace *f2)
+{
+	BMIter iter1, iter2;
+	BMEdge *e;
+	BMFace *f;
+
+	BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
+		BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
+			if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2))
+				return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+/**
  *  Counts the number of edges two faces share (if any)
  */
 int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
@@ -645,9 +785,27 @@ int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
 }
 
 /**
+ *  Returns TRUE if the faces share an edge
+ */
+int BM_face_share_edge_check(BMFace *f1, BMFace *f2)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f1);
+	do {
+		if (bmesh_radial_face_find(l_iter->e, f2)) {
+			return TRUE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return FALSE;
+}
+
+/**
  *	Test if e1 shares any faces with e2
  */
-int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
+int BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)
 {
 	BMLoop *l;
 	BMFace *f;
@@ -666,9 +824,32 @@ int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
 }
 
 /**
+ *	Test if e1 shares any quad faces with e2
+ */
+int BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
+{
+	BMLoop *l;
+	BMFace *f;
+
+	if (e1->l && e2->l) {
+		l = e1->l;
+		do {
+			f = l->f;
+			if (f->len == 4) {
+				if (bmesh_radial_face_find(e2, f)) {
+					return TRUE;
+				}
+			}
+			l = l->radial_next;
+		} while (l != e1->l);
+	}
+	return FALSE;
+}
+
+/**
  *	Tests to see if e1 shares a vertex with e2
  */
-int BM_edge_share_vert_count(BMEdge *e1, BMEdge *e2)
+int BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2)
 {
 	return (e1->v1 == e2->v1 ||
 	        e1->v1 == e2->v2 ||
@@ -925,7 +1106,12 @@ float BM_vert_calc_shell_factor(BMVert *v)
 		accum_angle += face_angle;
 	}
 
-	return accum_shell / accum_angle;
+	if (accum_angle != 0.0f) {
+		return accum_shell / accum_angle;
+	}
+	else {
+		return 1.0f;
+	}
 }
 
 /**
@@ -946,7 +1132,12 @@ float BM_vert_calc_mean_tagged_edge_length(BMVert *v)
 		}
 	}
 
-	return length / (float)tot;
+	if (tot) {
+		return length / (float)tot;
+	}
+	else {
+		return 0.0f;
+	}
 }
 
 
@@ -1018,6 +1209,28 @@ BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2)
 }
 
 /**
+ * Returns an edge sharing the same vertices as this one.
+ * This isn't an invalid state but tools should clean up these cases before
+ * returning the mesh to the user.
+ */
+BMEdge *BM_edge_find_double(BMEdge *e)
+{
+	BMVert *v       = e->v1;
+	BMVert *v_other = e->v2;
+
+	BMEdge *e_iter;
+
+	e_iter = e;
+	while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e) {
+		if (UNLIKELY(BM_vert_in_edge(e_iter, v_other))) {
+			return e_iter;
+		}
+	}
+
+	return NULL;
+}
+
+/**
  * Given a set of vertices \a varr, find out if
  * all those vertices overlap an existing face.
  *
@@ -1027,7 +1240,7 @@ BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2)
  * \returns TRUE for overlap
  *
  */
-int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlapface)
+int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
 {
 	BMIter viter;
 	BMFace *f;
@@ -1035,7 +1248,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
 
 	for (i = 0; i < len; i++) {
 		BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
-			amount = BM_verts_in_face(bm, f, varr, len);
+			amount = BM_verts_in_face(f, varr, len);
 			if (amount >= len) {
 				if (r_overlapface) {
 					*r_overlapface = f;
@@ -1057,7 +1270,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
  * there is a face with exactly those vertices
  * (and only those vertices).
  */
-int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
+int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
 {
 	BMIter viter;
 	BMFace *f;
@@ -1065,7 +1278,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
 
 	for (i = 0; i < len; i++) {
 		BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
-			amount = BM_verts_in_face(bm, f, varr, len);
+			amount = BM_verts_in_face(f, varr, len);
 			if (amount == len && amount == f->len) {
 				if (r_existface) {
 					*r_existface = f;
@@ -1203,7 +1416,7 @@ int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
 int BM_face_exists_multi_edge(BMEdge **earr, int len)
 {
 	BMVert **varr;
-	BLI_array_fixedstack_declare(varr, BM_NGON_STACK_SIZE, len, __func__);
+	BLI_array_fixedstack_declare(varr, BM_DEFAULT_NGON_STACK_SIZE, len, __func__);
 
 	int ok;
 	int i, i_next;
@@ -1229,3 +1442,38 @@ int BM_face_exists_multi_edge(BMEdge **earr, int len)
 
 	return ok;
 }
+
+/* convenience functions for checking flags */
+int BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag)
+{
+	return (BM_elem_flag_test(e->v1, hflag) ||
+	        BM_elem_flag_test(e->v2, hflag));
+}
+
+int BM_face_is_any_vert_flag_test(BMFace *f, const char hflag)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		if (BM_elem_flag_test(l_iter->v, hflag)) {
+			return TRUE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+	return FALSE;
+}
+
+int BM_face_is_any_edge_flag_test(BMFace *f, const char hflag)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		if (BM_elem_flag_test(l_iter->e, hflag)) {
+			return TRUE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+	return FALSE;
+}
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index 36ffc29..7a18f69 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -28,9 +28,10 @@
  */
 
 int     BM_vert_in_face(BMFace *f, BMVert *v);
-int     BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
+int     BM_verts_in_face(BMFace *f, BMVert **varr, int len);
 
 int     BM_edge_in_face(BMFace *f, BMEdge *e);
+int     BM_edge_in_loop(BMEdge *e, BMLoop *l);
 
 int     BM_vert_in_edge(BMEdge *e, BMVert *v);
 int     BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
@@ -39,9 +40,11 @@ float   BM_edge_calc_length(BMEdge *e);
 int     BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
 int     BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
 BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
+BMLoop *BM_edge_other_loop(BMEdge *e, BMLoop *l);
 BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v);
 BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v);
 BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v);
+BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step);
 BMLoop *BM_vert_find_first_loop(BMVert *v);
 
 int     BM_vert_edge_count_nonwire(BMVert *v);
@@ -72,17 +75,23 @@ BMLoop *BM_face_find_shortest_loop(BMFace *f);
 BMLoop *BM_face_find_longest_loop(BMFace *f);
 
 BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
+BMEdge *BM_edge_find_double(BMEdge *e);
 
-int     BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
+int     BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_existface);
 
-int     BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
+int     BM_face_exists(BMVert **varr, int len, BMFace **r_existface);
 
 int     BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len);
 int     BM_face_exists_multi_edge(BMEdge **earr, int len);
 
+int     BM_face_share_face_count(BMFace *f1, BMFace *f2);
 int     BM_face_share_edge_count(BMFace *f1, BMFace *f2);
-int     BM_edge_share_face_count(BMEdge *e1, BMEdge *e2);
-int     BM_edge_share_vert_count(BMEdge *e1, BMEdge *e2);
+
+int     BM_face_share_face_check(BMFace *f1, BMFace *f2);
+int     BM_face_share_edge_check(BMFace *f1, BMFace *f2);
+int     BM_edge_share_face_check(BMEdge *e1, BMEdge *e2);
+int     BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2);
+int     BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2);
 
 BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2);
 BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v);
@@ -92,4 +101,8 @@ void    BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
 void    BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
                                  BMLoop *edge_loop);
 
+int BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag);
+int BM_face_is_any_vert_flag_test(BMFace *f, const char hflag);
+int BM_face_is_any_edge_flag_test(BMFace *f, const char hflag);
+
 #endif /* __BMESH_QUERIES_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 225ea6c..bb013e6 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -303,8 +303,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
 	if (!BM_vert_is_manifold(v)) {
 		BMW_reset(walker);
 		BMO_error_raise(walker->bm, NULL, BMERR_WALKER_FAILED,
-		                "Non-manifold vert "
-		                "while searching region boundary");
+		                "Non-manifold vert while searching region boundary");
 		return NULL;
 	}
 	
@@ -599,7 +598,7 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
 			}
 		}
 	}
-	else { 	/* WIRE EDGE */
+	else {  /* WIRE EDGE */
 		BMIter eiter;
 
 		/* match trunk: mark all connected wire edges */
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 10a9d51..126d0f4 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -15,7 +15,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor(s): Joseph Eagar.
+ * Contributor(s):
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -24,865 +24,38 @@
  *  \ingroup bmesh
  */
 
-#include "MEM_guardedalloc.h"
-
-#include "BLI_array.h"
-#include "BLI_math.h"
-#include "BLI_smallhash.h"
-
-#include "BKE_customdata.h"
+#include "BLI_utildefines.h"
 
 #include "bmesh.h"
 
 #include "intern/bmesh_operators_private.h" /* own include */
 
-#define BEVEL_FLAG	1
-#define BEVEL_DEL	2
-#define FACE_NEW	4
-#define EDGE_OLD	8
-#define FACE_OLD	16
-#define VERT_OLD	32
-#define FACE_SPAN	64
-#define FACE_HOLE	128
-
-typedef struct LoopTag {
-	BMVert *newv;
-} LoopTag;
-
-typedef struct EdgeTag {
-	BMVert *newv1, *newv2;
-} EdgeTag;
-
-static void calc_corner_co(BMLoop *l, const float fac, float r_co[3],
-                           const short do_dist, const short do_even)
-{
-	float  no[3], l_vec_prev[3], l_vec_next[3], l_co_prev[3], l_co[3], l_co_next[3], co_ofs[3];
-	int is_concave;
-
-	/* first get the prev/next verts */
-	if (l->f->len > 2) {
-		copy_v3_v3(l_co_prev, l->prev->v->co);
-		copy_v3_v3(l_co, l->v->co);
-		copy_v3_v3(l_co_next, l->next->v->co);
-
-		/* calculate normal */
-		sub_v3_v3v3(l_vec_prev, l_co_prev, l_co);
-		sub_v3_v3v3(l_vec_next, l_co_next, l_co);
-
-		cross_v3_v3v3(no, l_vec_prev, l_vec_next);
-		is_concave = dot_v3v3(no, l->f->no) > 0.0f;
-	}
-	else {
-		BMIter iter;
-		BMLoop *l2;
-		float up[3] = {0.0f, 0.0f, 1.0f};
-
-		copy_v3_v3(l_co_prev, l->prev->v->co);
-		copy_v3_v3(l_co, l->v->co);
-		
-		BM_ITER_ELEM (l2, &iter, l->v, BM_LOOPS_OF_VERT) {
-			if (l2->f != l->f) {
-				copy_v3_v3(l_co_next, BM_edge_other_vert(l2->e, l2->next->v)->co);
-				break;
-			}
-		}
-		
-		sub_v3_v3v3(l_vec_prev, l_co_prev, l_co);
-		sub_v3_v3v3(l_vec_next, l_co_next, l_co);
-
-		cross_v3_v3v3(no, l_vec_prev, l_vec_next);
-		if (dot_v3v3(no, no) == 0.0f) {
-			no[0] = no[1] = 0.0f; no[2] = -1.0f;
-		}
-		
-		is_concave = dot_v3v3(no, up) < 0.0f;
-	}
-
-
-	/* now calculate the new location */
-	if (do_dist) { /* treat 'fac' as distance */
-
-		normalize_v3(l_vec_prev);
-		normalize_v3(l_vec_next);
-
-		add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next);
-		if (UNLIKELY(normalize_v3(co_ofs) == 0.0f)) {  /* edges form a straight line */
-			cross_v3_v3v3(co_ofs, l_vec_prev, l->f->no);
-		}
-
-		if (do_even) {
-			negate_v3(l_vec_next);
-			mul_v3_fl(co_ofs, fac * shell_angle_to_dist(0.5f * angle_normalized_v3v3(l_vec_prev, l_vec_next)));
-			/* negate_v3(l_vec_next); */ /* no need unless we use again */
-		}
-		else {
-			mul_v3_fl(co_ofs, fac);
-		}
-	}
-	else { /* treat as 'fac' as a factor (0 - 1) */
-
-		/* not strictly necessary, balance vectors
-		 * so the longer edge doesn't skew the result,
-		 * gives nicer, move even output.
-		 *
-		 * Use the minimum rather then the middle value so skinny faces don't flip along the short axis */
-		float min_fac = minf(normalize_v3(l_vec_prev), normalize_v3(l_vec_next));
-		float angle;
-
-		if (do_even) {
-			negate_v3(l_vec_next);
-			angle = angle_normalized_v3v3(l_vec_prev, l_vec_next);
-			negate_v3(l_vec_next); /* no need unless we use again */
-		}
-		else {
-			angle = 0.0f;
-		}
-
-		mul_v3_fl(l_vec_prev, min_fac);
-		mul_v3_fl(l_vec_next, min_fac);
-
-		add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next);
-
-		if (UNLIKELY(is_zero_v3(co_ofs))) {
-			cross_v3_v3v3(co_ofs, l_vec_prev, l->f->no);
-			normalize_v3(co_ofs);
-			mul_v3_fl(co_ofs, min_fac);
-		}
-
-		/* done */
-		if (do_even) {
-			mul_v3_fl(co_ofs, (fac * 0.5f) * shell_angle_to_dist(0.5f * angle));
-		}
-		else {
-			mul_v3_fl(co_ofs, fac * 0.5f);
-		}
-	}
-
-	/* apply delta vec */
-	if (is_concave)
-		negate_v3(co_ofs);
-
-	add_v3_v3v3(r_co, co_ofs, l->v->co);
-}
-
-
-#define ETAG_SET(e, v, nv)  (                                                 \
-	(v) == (e)->v1 ?                                                          \
-		(etags[BM_elem_index_get((e))].newv1 = (nv)) :                        \
-		(etags[BM_elem_index_get((e))].newv2 = (nv))                          \
-	)
-
-#define ETAG_GET(e, v)  (                                                     \
-	(v) == (e)->v1 ?                                                          \
-		(etags[BM_elem_index_get((e))].newv1) :                               \
-		(etags[BM_elem_index_get((e))].newv2)                                 \
-	)
-
 void bmo_bevel_exec(BMesh *bm, BMOperator *op)
 {
-	BMOIter siter;
-	BMIter iter;
-	BMEdge *e;
-	BMVert *v;
-	BMFace **faces = NULL, *f;
-	LoopTag *tags = NULL, *tag;
-	EdgeTag *etags = NULL;
-	BMVert **verts = NULL;
-	BMEdge **edges = NULL;
-	BLI_array_declare(faces);
-	BLI_array_declare(tags);
-	BLI_array_declare(etags);
-	BLI_array_declare(verts);
-	BLI_array_declare(edges);
-	SmallHash hash;
-	float fac = BMO_slot_float_get(op, "percent");
-	const short do_even = BMO_slot_bool_get(op, "use_even");
-	const short do_dist = BMO_slot_bool_get(op, "use_dist");
-	int i, li, has_elens, HasMDisps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
-	
-	has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_bool_get(op, "use_lengths");
-	if (has_elens) {
-		li = BMO_slot_int_get(op, "lengthlayer");
-	}
-	
-	BLI_smallhash_init(&hash);
-	
-	BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
-		BMO_elem_flag_enable(bm, e, BEVEL_FLAG | BEVEL_DEL);
-		BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL);
-		BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL);
-		
-		if (BM_edge_face_count(e) < 2) {
-			BMO_elem_flag_disable(bm, e, BEVEL_DEL);
-			BMO_elem_flag_disable(bm, e->v1, BEVEL_DEL);
-			BMO_elem_flag_disable(bm, e->v2, BEVEL_DEL);
-		}
-#if 0
-		if (BM_edge_face_count(e) == 0) {
-			BMVert *verts[2] = {e->v1, e->v2};
-			BMEdge *edges[2] = {e, BM_edge_create(bm, e->v1, e->v2, e, 0)};
-			
-			BMO_elem_flag_enable(bm, edges[1], BEVEL_FLAG);
-			BM_face_create(bm, verts, edges, 2, FALSE);
-		}
-#endif
-	}
-	
-	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-		BMO_elem_flag_enable(bm, v, VERT_OLD);
-	}
-
-#if 0
-	//a bit of cleaner code that, alas, doens't work.
-	/* build edge tag */
-	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
-		if (BMO_elem_flag_test(bm, e->v1, BEVEL_FLAG) || BMO_elem_flag_test(bm, e->v2, BEVEL_FLAG)) {
-			BMIter liter;
-			BMLoop *l;
-			
-			if (!BMO_elem_flag_test(bm, e, EDGE_OLD)) {
-				BM_elem_index_set(e, BLI_array_count(etags)); /* set_dirty! */
-				BLI_array_grow_one(etags);
-				
-				BMO_elem_flag_enable(bm, e, EDGE_OLD);
-			}
-			
-			BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
-				BMLoop *l2;
-				BMIter liter2;
-				
-				if (BMO_elem_flag_test(bm, l->f, BEVEL_FLAG))
-					continue;
+	const float offset = BMO_slot_float_get(op->slots_in, "offset");
+	const int   seg    = BMO_slot_int_get(op->slots_in,   "segments");
 
-				BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
-					BM_elem_index_set(l2, BLI_array_count(tags)); /* set_loop */
-					BLI_array_grow_one(tags);
+	if (offset > 0) {
+		BMOIter siter;
+		BMEdge *e;
+		BMVert *v;
 
-					if (!BMO_elem_flag_test(bm, l2->e, EDGE_OLD)) {
-						BM_elem_index_set(l2->e, BLI_array_count(etags)); /* set_dirty! */
-						BLI_array_grow_one(etags);
-						
-						BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
-					}
-				}
+		/* first flush 'geom' into flags, this makes it possible to check connected data,
+		 * BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
+		BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
 
-				BMO_elem_flag_enable(bm, l->f, BEVEL_FLAG);
-				BLI_array_append(faces, l->f);
-			}
-		}
-		else {
-			BM_elem_index_set(e, -1); /* set_dirty! */
+		BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
+			BM_elem_flag_enable(v, BM_ELEM_TAG);
 		}
-	}
-#endif
-	
-	/* create and assign looptag structure */
-	BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
-		BMLoop *l;
-		BMIter liter;
 
-		BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL);
-		BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL);
-		
-		if (BM_edge_face_count(e) < 2) {
-			BMO_elem_flag_disable(bm, e, BEVEL_DEL);
-			BMO_elem_flag_disable(bm, e->v1, BEVEL_DEL);
-			BMO_elem_flag_disable(bm, e->v2, BEVEL_DEL);
-		}
-		
-		if (!BLI_smallhash_haskey(&hash, (intptr_t)e)) {
-			BLI_array_grow_one(etags);
-			BM_elem_index_set(e, BLI_array_count(etags) - 1); /* set_dirty! */
-			BLI_smallhash_insert(&hash, (intptr_t)e, NULL);
-			BMO_elem_flag_enable(bm, e, EDGE_OLD);
-		}
-		
-		/* find all faces surrounding e->v1 and, e->v2 */
-		for (i = 0; i < 2; i++) {
-			BM_ITER_ELEM (l, &liter, i ? e->v2:e->v1, BM_LOOPS_OF_VERT) {
-				BMLoop *l2;
-				BMIter liter2;
-				
-				/* see if we've already processed this loop's fac */
-				if (BLI_smallhash_haskey(&hash, (intptr_t)l->f))
-					continue;
-				
-				/* create tags for all loops in l-> */
-				BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
-					BLI_array_grow_one(tags);
-					BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */
-					
-					if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
-						BLI_array_grow_one(etags);
-						BM_elem_index_set(l2->e, BLI_array_count(etags) - 1); /* set_dirty! */
-						BLI_smallhash_insert(&hash, (intptr_t)l2->e, NULL);
-						BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
-					}
-				}
-
-				BLI_smallhash_insert(&hash, (intptr_t)l->f, NULL);
-				BMO_elem_flag_enable(bm, l->f, BEVEL_FLAG);
-				BLI_array_append(faces, l->f);
+		BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
+			if (BM_edge_is_manifold(e)) {
+				BM_elem_flag_enable(e, BM_ELEM_TAG);
 			}
 		}
-	}
 
-	bm->elem_index_dirty |= BM_EDGE;
-	
-	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-		BMIter eiter;
-		
-		if (!BMO_elem_flag_test(bm, v, BEVEL_FLAG))
-			continue;
-		
-		BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-			if (!BMO_elem_flag_test(bm, e, BEVEL_FLAG) && !ETAG_GET(e, v)) {
-				BMVert *v2;
-				float co[3];
-				
-				v2 = BM_edge_other_vert(e, v);
-				sub_v3_v3v3(co, v2->co, v->co);
-				if (has_elens) {
-					float elen = *(float *)CustomData_bmesh_get_n(&bm->edata, e->head.data, CD_PROP_FLT, li);
+		BM_mesh_bevel(bm, offset, seg);
 
-					normalize_v3(co);
-					mul_v3_fl(co, elen);
-				}
-				
-				mul_v3_fl(co, fac);
-				add_v3_v3(co, v->co);
-				
-				v2 = BM_vert_create(bm, co, v);
-				ETAG_SET(e, v, v2);
-			}
-		}
+		BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
 	}
-	
-	for (i = 0; i < BLI_array_count(faces); i++) {
-		BMLoop *l;
-		BMIter liter;
-		
-		BMO_elem_flag_enable(bm, faces[i], FACE_OLD);
-		
-		BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) {
-			float co[3];
-
-			if (BMO_elem_flag_test(bm, l->e, BEVEL_FLAG)) {
-				if (BMO_elem_flag_test(bm, l->prev->e, BEVEL_FLAG)) {
-					tag = tags + BM_elem_index_get(l);
-					calc_corner_co(l, fac, co, do_dist, do_even);
-					tag->newv = BM_vert_create(bm, co, l->v);
-				}
-				else {
-					tag = tags + BM_elem_index_get(l);
-					tag->newv = ETAG_GET(l->prev->e, l->v);
-					
-					if (!tag->newv) {
-						sub_v3_v3v3(co, l->prev->v->co, l->v->co);
-						if (has_elens) {
-							float elen = *(float *)CustomData_bmesh_get_n(&bm->edata, l->prev->e->head.data,
-							                                              CD_PROP_FLT, li);
-
-							normalize_v3(co);
-							mul_v3_fl(co, elen);
-						}
-
-						mul_v3_fl(co, fac);
-						add_v3_v3(co, l->v->co);
-
-						tag->newv = BM_vert_create(bm, co, l->v);
-						
-						ETAG_SET(l->prev->e, l->v, tag->newv);
-					}
-				}
-			}
-			else if (BMO_elem_flag_test(bm, l->v, BEVEL_FLAG)) {
-				tag = tags + BM_elem_index_get(l);
-				tag->newv = ETAG_GET(l->e, l->v);
-
-				if (!tag->newv) {
-					sub_v3_v3v3(co, l->next->v->co, l->v->co);
-					if (has_elens) {
-						float elen = *(float *)CustomData_bmesh_get_n(&bm->edata, l->e->head.data, CD_PROP_FLT, li);
-
-						normalize_v3(co);
-						mul_v3_fl(co, elen);
-					}
-					
-					mul_v3_fl(co, fac);
-					add_v3_v3(co, l->v->co);
-
-					tag = tags + BM_elem_index_get(l);
-					tag->newv = BM_vert_create(bm, co, l->v);
-					
-					ETAG_SET(l->e, l->v, tag->newv);
-				}
-			}
-			else {
-				tag = tags + BM_elem_index_get(l);
-				tag->newv = l->v;
-				BMO_elem_flag_disable(bm, l->v, BEVEL_DEL);
-			}
-		}
-	}
-	
-	/* create new faces inset from original face */
-	for (i = 0; i < BLI_array_count(faces); i++) {
-		BMLoop *l;
-		BMIter liter;
-		BMFace *f;
-		BMVert *lastv = NULL, *firstv = NULL;
-
-		BMO_elem_flag_enable(bm, faces[i], BEVEL_DEL);
-		
-		BLI_array_empty(verts);
-		BLI_array_empty(edges);
-		
-		BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) {
-			BMVert *v2;
-			
-			tag = tags + BM_elem_index_get(l);
-			BLI_array_append(verts, tag->newv);
-			
-			if (!firstv)
-				firstv = tag->newv;
-			
-			if (lastv) {
-				e = BM_edge_create(bm, lastv, tag->newv, l->e, TRUE);
-				BM_elem_attrs_copy(bm, bm, l->prev->e, e);
-				BLI_array_append(edges, e);
-			}
-			lastv = tag->newv;
-			
-			v2 = ETAG_GET(l->e, l->next->v);
-			
-			tag = &tags[BM_elem_index_get(l->next)];
-			if (!BMO_elem_flag_test(bm, l->e, BEVEL_FLAG) && v2 && v2 != tag->newv) {
-				BLI_array_append(verts, v2);
-				
-				e = BM_edge_create(bm, lastv, v2, l->e, TRUE);
-				BM_elem_attrs_copy(bm, bm, l->e, e);
-				
-				BLI_array_append(edges, e);
-				lastv = v2;
-			}
-		}
-		
-		e = BM_edge_create(bm, firstv, lastv, BM_FACE_FIRST_LOOP(faces[i])->e, TRUE);
-		if (BM_FACE_FIRST_LOOP(faces[i])->prev->e != e) {
-			BM_elem_attrs_copy(bm, bm, BM_FACE_FIRST_LOOP(faces[i])->prev->e, e);
-		}
-		BLI_array_append(edges, e);
-		
-		f = BM_face_create_ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), FALSE);
-		if (UNLIKELY(f == NULL)) {
-			printf("%s: could not make face!\n", __func__);
-			continue;
-		}
-
-		BMO_elem_flag_enable(bm, f, FACE_NEW);
-	}
-
-	for (i = 0; i < BLI_array_count(faces); i++) {
-		BMLoop *l;
-		BMIter liter;
-		int j;
-		
-		/* create quad spans between split edge */
-		BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) {
-			BMVert *v1 = NULL, *v2 = NULL, *v3 = NULL, *v4 = NULL;
-			
-			if (!BMO_elem_flag_test(bm, l->e, BEVEL_FLAG))
-				continue;
-			
-			v1 = tags[BM_elem_index_get(l)].newv;
-			v2 = tags[BM_elem_index_get(l->next)].newv;
-			if (l->radial_next != l) {
-				v3 = tags[BM_elem_index_get(l->radial_next)].newv;
-				if (l->radial_next->next->v == l->next->v) {
-					v4 = v3;
-					v3 = tags[BM_elem_index_get(l->radial_next->next)].newv;
-				}
-				else {
-					v4 = tags[BM_elem_index_get(l->radial_next->next)].newv;
-				}
-			}
-			else {
-				/* the loop is on a boundar */
-				v3 = l->next->v;
-				v4 = l->v;
-				
-				for (j = 0; j < 2; j++) {
-					BMIter eiter;
-					BMVert *v = j ? v4 : v3;
-
-					BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-						if (!BM_vert_in_edge(e, v3) || !BM_vert_in_edge(e, v4))
-							continue;
-						
-						if (!BMO_elem_flag_test(bm, e, BEVEL_FLAG) && BMO_elem_flag_test(bm, e, EDGE_OLD)) {
-							BMVert *vv;
-							
-							vv = ETAG_GET(e, v);
-							if (!vv || BMO_elem_flag_test(bm, vv, BEVEL_FLAG))
-								continue;
-							
-							if (j) {
-								v1 = vv;
-							}
-							else {
-								v2 = vv;
-							}
-							break;
-						}
-					}
-				}
-
-				BMO_elem_flag_disable(bm, v3, BEVEL_DEL);
-				BMO_elem_flag_disable(bm, v4, BEVEL_DEL);
-			}
-			
-			if (v1 != v2 && v2 != v3 && v3 != v4) {
-				BMIter liter2;
-				BMLoop *l2, *l3;
-				BMEdge *e1, *e2;
-				float d1, d2, *d3;
-				
-				f = BM_face_create_quad_tri(bm, v4, v3, v2, v1, l->f, TRUE);
-
-				e1 = BM_edge_exists(v4, v3);
-				e2 = BM_edge_exists(v2, v1);
-				BM_elem_attrs_copy(bm, bm, l->e, e1);
-				BM_elem_attrs_copy(bm, bm, l->e, e2);
-				
-				/* set edge lengths of cross edges as the average of the cross edges they're based o */
-				if (has_elens) {
-					/* angle happens not to be used. why? - not sure it just isn't - campbell.
-					 * leave this in in case we need to use it later */
-#if 0
-					float ang;
-#endif
-					e1 = BM_edge_exists(v1, v4);
-					e2 = BM_edge_exists(v2, v3);
-					
-					if (l->radial_next->v == l->v) {
-						l2 = l->radial_next->prev;
-						l3 = l->radial_next->next;
-					}
-					else {
-						l2 = l->radial_next->next;
-						l3 = l->radial_next->prev;
-					}
-					
-					d3 = CustomData_bmesh_get_n(&bm->edata, e1->head.data, CD_PROP_FLT, li);
-					d1 = *(float *)CustomData_bmesh_get_n(&bm->edata, l->prev->e->head.data, CD_PROP_FLT, li);
-					d2 = *(float *)CustomData_bmesh_get_n(&bm->edata, l2->e->head.data, CD_PROP_FLT, li);
-#if 0
-					ang = angle_v3v3v3(l->prev->v->co, l->v->co, BM_edge_other_vert(l2->e, l->v)->co);
-#endif
-					*d3 = (d1 + d2) * 0.5f;
-					
-					d3 = CustomData_bmesh_get_n(&bm->edata, e2->head.data, CD_PROP_FLT, li);
-					d1 = *(float *)CustomData_bmesh_get_n(&bm->edata, l->next->e->head.data, CD_PROP_FLT, li);
-					d2 = *(float *)CustomData_bmesh_get_n(&bm->edata, l3->e->head.data, CD_PROP_FLT, li);
-#if 0
-					ang = angle_v3v3v3(BM_edge_other_vert(l->next->e, l->next->v)->co, l->next->v->co,
-					                   BM_edge_other_vert(l3->e, l->next->v)->co);
-#endif
-					*d3 = (d1 + d2) * 0.5f;
-				}
-
-				if (UNLIKELY(f == NULL)) {
-					fprintf(stderr, "%s: face index out of range! (bmesh internal error)\n", __func__);
-					continue;
-				}
-				
-				BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_SPAN);
-				
-				/* un-tag edges in f for deletio */
-				BM_ITER_ELEM (l2, &liter2, f, BM_LOOPS_OF_FACE) {
-					BMO_elem_flag_disable(bm, l2->e, BEVEL_DEL);
-				}
-			}
-			else {
-				f = NULL;
-			}
-		}
-	}
-	
-	/* fill in holes at vertices */
-	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-		BMIter eiter;
-		BMVert *vv, *vstart = NULL, *lastv = NULL;
-		SmallHash tmphash;
-		int rad, insorig = 0, err = 0;
-
-		BLI_smallhash_init(&tmphash);
-
-		if (!BMO_elem_flag_test(bm, v, BEVEL_FLAG))
-			continue;
-		
-		BLI_array_empty(verts);
-		BLI_array_empty(edges);
-		
-		BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-			BMIter liter;
-			BMVert *v1 = NULL, *v2 = NULL;
-			BMLoop *l;
-			
-			if (BM_edge_face_count(e) < 2)
-				insorig = 1;
-			
-			if (BM_elem_index_get(e) == -1)
-				continue;
-			
-			rad = 0;
-			BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
-				if (!BMO_elem_flag_test(bm, l->f, FACE_OLD))
-					continue;
-				
-				rad++;
-				
-				tag = tags + BM_elem_index_get((l->v == v) ? l : l->next);
-				
-				if (!v1)
-					v1 = tag->newv;
-				else if (!v2)
-					v2 = tag->newv;
-			}
-			
-			if (rad < 2)
-				insorig = 1;
-			
-			if (!v1)
-				v1 = ETAG_GET(e, v);
-			if (!v2 || v1 == v2)
-				v2 = ETAG_GET(e, v);
-			
-			if (v1) {
-				if (!BLI_smallhash_haskey(&tmphash, (intptr_t)v1)) {
-					BLI_array_append(verts, v1);
-					BLI_smallhash_insert(&tmphash, (intptr_t)v1, NULL);
-				}
-				
-				if (v2 && v1 != v2 && !BLI_smallhash_haskey(&tmphash, (intptr_t)v2)) {
-					BLI_array_append(verts, v2);
-					BLI_smallhash_insert(&tmphash, (intptr_t)v2, NULL);
-				}
-			}
-		}
-		
-		if (!BLI_array_count(verts))
-			continue;
-		
-		if (insorig) {
-			BLI_array_append(verts, v);
-			BLI_smallhash_insert(&tmphash, (intptr_t)v, NULL);
-		}
-		
-		/* find edges that exist between vertices in verts.  this is basically
-		 * a topological walk of the edges connecting them */
-		vstart = vstart ? vstart : verts[0];
-		vv = vstart;
-		do {
-			BM_ITER_ELEM (e, &eiter, vv, BM_EDGES_OF_VERT) {
-				BMVert *vv2 = BM_edge_other_vert(e, vv);
-				
-				if (vv2 != lastv && BLI_smallhash_haskey(&tmphash, (intptr_t)vv2)) {
-					/* if we've go over the same vert twice, break out of outer loop */
-					if (BLI_smallhash_lookup(&tmphash, (intptr_t)vv2) != NULL) {
-						e = NULL;
-						err = 1;
-						break;
-					}
-					
-					/* use self pointer as ta */
-					BLI_smallhash_remove(&tmphash, (intptr_t)vv2);
-					BLI_smallhash_insert(&tmphash, (intptr_t)vv2, vv2);
-					
-					lastv = vv;
-					BLI_array_append(edges, e);
-					vv = vv2;
-					break;
-				}
-			}
-
-			if (e == NULL) {
-				break;
-			}
-		} while (vv != vstart);
-		
-		if (err) {
-			continue;
-		}
-
-		/* there may not be a complete loop of edges, so start again and make
-		 * final edge afterwards.  in this case, the previous loop worked to
-		 * find one of the two edges at the extremes. */
-		if (vv != vstart) {
-			/* undo previous taggin */
-			for (i = 0; i < BLI_array_count(verts); i++) {
-				BLI_smallhash_remove(&tmphash, (intptr_t)verts[i]);
-				BLI_smallhash_insert(&tmphash, (intptr_t)verts[i], NULL);
-			}
-
-			vstart = vv;
-			lastv = NULL;
-			BLI_array_empty(edges);
-			do {
-				BM_ITER_ELEM (e, &eiter, vv, BM_EDGES_OF_VERT) {
-					BMVert *vv2 = BM_edge_other_vert(e, vv);
-					
-					if (vv2 != lastv && BLI_smallhash_haskey(&tmphash, (intptr_t)vv2)) {
-						/* if we've go over the same vert twice, break out of outer loo */
-						if (BLI_smallhash_lookup(&tmphash, (intptr_t)vv2) != NULL) {
-							e = NULL;
-							err = 1;
-							break;
-						}
-						
-						/* use self pointer as ta */
-						BLI_smallhash_remove(&tmphash, (intptr_t)vv2);
-						BLI_smallhash_insert(&tmphash, (intptr_t)vv2, vv2);
-						
-						lastv = vv;
-						BLI_array_append(edges, e);
-						vv = vv2;
-						break;
-					}
-				}
-				if (e == NULL)
-					break;
-			} while (vv != vstart);
-			
-			if (!err) {
-				e = BM_edge_create(bm, vv, vstart, NULL, TRUE);
-				BLI_array_append(edges, e);
-			}
-		}
-		
-		if (err)
-			continue;
-		
-		if (BLI_array_count(edges) >= 3) {
-			BMFace *f;
-			
-			if (BM_face_exists(bm, verts, BLI_array_count(verts), &f))
-				continue;
-			
-			f = BM_face_create_ngon(bm, lastv, vstart, edges, BLI_array_count(edges), FALSE);
-			if (UNLIKELY(f == NULL)) {
-				fprintf(stderr, "%s: in bevel vert fill! (bmesh internal error)\n", __func__);
-			}
-			else {
-				BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_HOLE);
-			}
-		}
-		BLI_smallhash_release(&tmphash);
-	}
-	
-	/* copy over customdat */
-	for (i = 0; i < BLI_array_count(faces); i++) {
-		BMLoop *l;
-		BMIter liter;
-		BMFace *f = faces[i];
-		
-		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
-			BMLoop *l2;
-			BMIter liter2;
-			
-			tag = tags + BM_elem_index_get(l);
-			if (!tag->newv)
-				continue;
-			
-			BM_ITER_ELEM (l2, &liter2, tag->newv, BM_LOOPS_OF_VERT) {
-				if (!BMO_elem_flag_test(bm, l2->f, FACE_NEW) || (l2->v != tag->newv && l2->v != l->v))
-					continue;
-				
-				if (tag->newv != l->v || HasMDisps) {
-					BM_elem_attrs_copy(bm, bm, l->f, l2->f);
-					BM_loop_interp_from_face(bm, l2, l->f, TRUE, TRUE);
-				}
-				else {
-					BM_elem_attrs_copy(bm, bm, l->f, l2->f);
-					BM_elem_attrs_copy(bm, bm, l, l2);
-				}
-				
-				if (HasMDisps) {
-					BMLoop *l3;
-					BMIter liter3;
-					
-					BM_ITER_ELEM (l3, &liter3, l2->f, BM_LOOPS_OF_FACE) {
-						BM_loop_interp_multires(bm, l3, l->f);
-					}
-				}
-			}
-		}
-	}
-	
-	/* handle vertices along boundary edge */
-	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-		if (BMO_elem_flag_test(bm, v, VERT_OLD) &&
-		    BMO_elem_flag_test(bm, v, BEVEL_FLAG) &&
-		    !BMO_elem_flag_test(bm, v, BEVEL_DEL))
-		{
-			BMLoop *l;
-			BMLoop *lorig = NULL;
-			BMIter liter;
-			
-			BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
-				// BMIter liter2;
-				// BMLoop *l2 = l->v == v ? l : l->next, *l3;
-				
-				if (BMO_elem_flag_test(bm, l->f, FACE_OLD)) {
-					lorig = l;
-					break;
-				}
-			}
-			
-			if (!lorig)
-				continue;
-			
-			BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
-				BMLoop *l2 = l->v == v ? l : l->next;
-				
-				BM_elem_attrs_copy(bm, bm, lorig->f, l2->f);
-				BM_elem_attrs_copy(bm, bm, lorig, l2);
-			}
-		}
-	}
-#if 0
-	/* clean up any remaining 2-edged face */
-	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
-		if (f->len == 2) {
-			BMFace *faces[2] = {f, BM_FACE_FIRST_LOOP(f)->radial_next->f};
-			
-			if (faces[0] == faces[1])
-				BM_face_kill(bm, f);
-			else
-				BM_faces_join(bm, faces, 2);
-		}
-	}
-#endif
-
-	BMO_op_callf(bm, op->flag, "delete geom=%fv context=%i", BEVEL_DEL, DEL_VERTS);
-
-	/* clean up any edges that might not get properly delete */
-	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
-		if (BMO_elem_flag_test(bm, e, EDGE_OLD) && !e->l)
-			BMO_elem_flag_enable(bm, e, BEVEL_DEL);
-	}
-
-	BMO_op_callf(bm, op->flag, "delete geom=%fe context=%i", BEVEL_DEL, DEL_EDGES);
-	BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", BEVEL_DEL, DEL_FACES);
-	
-	BLI_smallhash_release(&hash);
-	BLI_array_free(tags);
-	BLI_array_free(etags);
-	BLI_array_free(verts);
-	BLI_array_free(edges);
-	BLI_array_free(faces);
-	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "face_spans", BM_FACE, FACE_SPAN);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "face_holes", BM_FACE, FACE_HOLE);
 }
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index fde475c..c7cd1e7 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -52,8 +52,10 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(verts_pair);
 	int i;
 	
-	BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_INPUT);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_INPUT);
 
+	/* BMESH_TODO, loop over vert faces:
+	 * faster then looping over all faces, then searching each for flagged verts*/
 	for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
 		BLI_array_empty(loops_split);
 		BLI_array_empty(verts_pair);
@@ -117,7 +119,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT);
 
 	BLI_array_free(loops_split);
 	BLI_array_free(verts_pair);
@@ -219,12 +221,12 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
 	int c = 0, cl1 = 0, cl2 = 0;
 
 	/* merge-bridge support */
-	const int   use_merge    = BMO_slot_bool_get(op, "use_merge");
-	const float merge_factor = BMO_slot_float_get(op, "merge_factor");
+	const int   use_merge    = BMO_slot_bool_get(op->slots_in,  "use_merge");
+	const float merge_factor = BMO_slot_float_get(op->slots_in, "merge_factor");
 
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
 
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		if (!BMO_elem_flag_test(bm, e, EDGE_DONE)) {
 			BMVert *v, *ov;
 			/* BMEdge *e2, *e3, *oe = e; */ /* UNUSED */
@@ -380,18 +382,19 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
 
 				/* compute summed length between vertices in forward direction */
 				len = 0.0f;
-				for (j = 0; j < lenv2; j++) {
+				for (j = 0; (j < lenv2) && (len < min); j++) {
 					len += len_v3v3(vv1[clamp_index(i + j, lenv1)]->co, vv2[j]->co);
 				}
 
 				if (len < min) {
 					min = len;
 					starti = i;
+					dir1 = 1;
 				}
 
 				/* compute summed length between vertices in backward direction */
 				len = 0.0f;
-				for (j = 0; j < lenv2; j++) {
+				for (j = 0; (j < lenv2) && (len < min); j++) {
 					len += len_v3v3(vv1[clamp_index(i - j, lenv1)]->co, vv2[j]->co);
 				}
 
@@ -425,8 +428,8 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
 		
 		/* merge loops of bridge faces */
 		if (use_merge) {
-			const int vert_len = mini(BLI_array_count(vv1), BLI_array_count(vv2)) - ((cl1 || cl2) ? 1 : 0);
-			const int edge_len = mini(BLI_array_count(ee1), BLI_array_count(ee2));
+			const int vert_len = min_ii(BLI_array_count(vv1), BLI_array_count(vv2)) - ((cl1 || cl2) ? 1 : 0);
+			const int edge_len = min_ii(BLI_array_count(ee1), BLI_array_count(ee2));
 
 			if (merge_factor <= 0.0f) {
 				/* 2 --> 1 */
@@ -523,7 +526,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_OUT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
 
 cleanup:
 	BLI_array_free(ee1);
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 731170f..aa69806 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -84,7 +84,7 @@ static int count_edge_faces(BMesh *bm, BMEdge *e);
 BLI_INLINE BMDiskLink *rs_edge_link_get(BMEdge *e, BMVert *v, EdgeData *e_data)
 {
 	return v == ((BMEdge *)e)->v1 ? &(((EdgeData *)e_data)->v1_disk_link) :
-	                                &(((EdgeData *)e_data)->v2_disk_link) ;
+	                                &(((EdgeData *)e_data)->v2_disk_link);
 }
 
 static int rotsys_append_edge(BMEdge *e, BMVert *v,
@@ -168,7 +168,7 @@ static void rotsys_reverse(BMEdge *UNUSED(e), BMVert *v, EdgeData *edata, VertDa
 	BMEdge **edges = NULL;
 	BMEdge *e_first;
 	BMEdge *e;
-	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(edges, BM_DEFAULT_NGON_STACK_SIZE);
 	int i, totedge;
 	
 	e = e_first = vdata[BM_elem_index_get(v)].e;
@@ -274,7 +274,7 @@ static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertDa
 			if (!ok || BLI_array_count(edges) < 3)
 				continue;
 			
-			f = BM_face_create_ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), TRUE);
+			f = BM_face_create_ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), BM_CREATE_NO_DOUBLE);
 			if (UNLIKELY(f == NULL)) {
 				continue;
 			}
@@ -359,10 +359,10 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
 	BMIter iter;
 	BMEdge *e;
 	BMEdge **edges = NULL;
-	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(edges, BM_DEFAULT_NGON_STACK_SIZE);
 	BMVert *v;
 	/* BMVert **verts = NULL; */
-	/* BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE); */ /* UNUSE */
+	/* BLI_array_staticdeclare(verts, BM_DEFAULT_NGON_STACK_SIZE); */ /* UNUSE */
 	int i;
 	
 	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@@ -611,11 +611,11 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
 			
 			v2 = BM_vert_create(bm, co, NULL);
 			BM_elem_index_set(v2, -1); /* set_dirty! */
-			//BM_edge_create(bm, cv, v2, NULL, FALSE);
+			//BM_edge_create(bm, cv, v2, NULL, 0);
 			
 			BM_vert_select_set(bm, v2, TRUE);
 			if (lastv) {
-				e2 = BM_edge_create(bm, lastv, v2, NULL, FALSE);
+				e2 = BM_edge_create(bm, lastv, v2, NULL, 0);
 				BM_edge_select_set(bm, e2, TRUE);
 			}
 			
@@ -741,7 +741,10 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
 	BMVert *startv;
 	BMVert *endv;
 	EPathNode *node;
-	int i, use_restrict = BMO_slot_bool_get(op, "use_restrict");
+	int i;
+	const int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
+	BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
+
 
 	startv = edata[BM_elem_index_get(edge)].ftag ? edge->v2 : edge->v1;
 	endv = edata[BM_elem_index_get(edge)].ftag ? edge->v1 : edge->v2;
@@ -769,7 +772,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
 				verts[i] = node->v;
 			}
 
-			if (BM_face_exists(bm, verts, i, &f)) {
+			if (BM_face_exists(verts, i, &f)) {
 				if (!BMO_elem_flag_test(bm, f, FACE_IGNORE)) {
 					BLI_ghash_remove(gh, endv, NULL, NULL);
 					continue;
@@ -806,12 +809,13 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
 				continue;
 			}
 			
-			if (use_restrict && BMO_slot_map_contains(bm, op, "restrict", e)) {
-				int group = BMO_slot_map_int_get(bm, op, "restrict", e);
-				
-				if (!(group & path->group)) {
-					v2 = NULL;
-					continue;
+			if (use_restrict) {
+				int *group = (int *)BMO_slot_map_data_get(slot_restrict, e);
+				if (group) {
+					if (!(*group & path->group)) {
+						v2 = NULL;
+						continue;
+					}
 				}
 			}
 
@@ -895,12 +899,14 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 	BMEdge **edges = NULL;
 	PathBase *pathbase;
 	BLI_array_declare(edges);
-	int use_restrict       = BMO_slot_bool_get(op, "use_restrict");
-	int use_fill_check     = BMO_slot_bool_get(op, "use_fill_check");
-	const short mat_nr     = BMO_slot_int_get(op,  "mat_nr");
-	const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
+	int use_restrict       = BMO_slot_bool_get(op->slots_in, "use_restrict");
+	int use_fill_check     = BMO_slot_bool_get(op->slots_in, "use_fill_check");
+	const short mat_nr     = BMO_slot_int_get(op->slots_in,  "mat_nr");
+	const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
 	int i, j, group = 0;
 	unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
+	BMOpSlot *slot_restrict          = BMO_slot_get(op->slots_in, "restrict");
+	BMOpSlot *slot_face_groupmap_out = BMO_slot_get(op->slots_out, "face_groupmap.out");
 
 	if (!bm->totvert || !bm->totedge)
 		return;
@@ -910,8 +916,8 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 	edata = MEM_callocN(sizeof(EdgeData) * bm->totedge, "EdgeData");
 	vdata = MEM_callocN(sizeof(VertData) * bm->totvert, "VertData");
 	
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
-	BMO_slot_buffer_flag_enable(bm, op, "excludefaces", BM_FACE, FACE_IGNORE);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "exclude_faces", BM_FACE, FACE_IGNORE);
 	
 	BM_mesh_elem_index_ensure(bm, BM_VERT);
 
@@ -932,14 +938,14 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 	bm->elem_index_dirty &= ~BM_EDGE;
 
 	init_rotsys(bm, edata, vdata);
-	
+
 	while (1) {
 		edge = NULL;
 		group = 0;
 		
-		BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 			/* if restrict is on, only start on faces in the restrict map */
-			if (use_restrict && !BMO_slot_map_contains(bm, op, "restrict", e))
+			if (use_restrict && !BMO_slot_map_contains(slot_restrict, e))
 				continue;
 
 			if (edata[BM_elem_index_get(e)].tag < 2) {
@@ -948,7 +954,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 				if (use_restrict) {
 					int i = 0, j = 0, gi = 0;
 					
-					group = BMO_slot_map_int_get(bm, op, "restrict", e);
+					group = BMO_slot_map_int_get(slot_restrict, e);
 					
 					for (i = 0; i < 30; i++) {
 						if (group & (1 << i)) {
@@ -1045,7 +1051,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 			    /* fairly expensive check - see if there are already faces filling this area */
 			    (BM_face_exists_multi_edge(edges, i) == FALSE))
 			{
-				f = BM_face_create_ngon(bm, v1, v2, edges, i, TRUE);
+				f = BM_face_create_ngon(bm, v1, v2, edges, i, BM_CREATE_NO_DOUBLE);
 				if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) {
 					BMO_elem_flag_enable(bm, f, FACE_NEW);
 					f->mat_nr = mat_nr;
@@ -1055,7 +1061,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 				}
 
 				if (use_restrict) {
-					BMO_slot_map_int_insert(bm, op, "faceout_groupmap", f, path->group);
+					BMO_slot_map_int_insert(op, slot_face_groupmap_out, f, path->group);
 				}
 			}
 		}
@@ -1063,7 +1069,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
 		edge_free_path(pathbase, path);
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
 
 	BLI_array_free(edges);
 	BLI_array_free(verts);
@@ -1092,7 +1098,7 @@ static BMEdge *edge_next(BMesh *bm, BMEdge *e)
 	return NULL;
 }
 
-void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
+void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
 	BMEdge *e;
@@ -1103,11 +1109,11 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 	int ok = 1;
 	int i, count;
 
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
 	
 	/* validate that each edge has at most one other tagged edge in the
 	 * disk cycle around each of it's vertices */
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		for (i = 0; i < 2; i++) {
 			count = BMO_vert_edge_flags_count(bm, i ? e->v2 : e->v1, EDGE_MARK);
 			if (count > 2) {
@@ -1129,7 +1135,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 	/* find connected loops within the input edge */
 	count = 0;
 	while (1) {
-		BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 			if (!BMO_elem_flag_test(bm, e, EDGE_VIS)) {
 				if (BMO_vert_edge_flags_count(bm, e->v1, EDGE_MARK) == 1 ||
 				    BMO_vert_edge_flags_count(bm, e->v2, EDGE_MARK) == 1)
@@ -1177,10 +1183,10 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 	}
 
 	if (edges1 && BLI_array_count(edges1) > 2 &&
-	    BM_edge_share_vert_count(edges1[0], edges1[BLI_array_count(edges1) - 1]))
+	    BM_edge_share_vert_check(edges1[0], edges1[BLI_array_count(edges1) - 1]))
 	{
 		if (edges2 && BLI_array_count(edges2) > 2 &&
-		    BM_edge_share_vert_count(edges2[0], edges2[BLI_array_count(edges2) - 1]))
+		    BM_edge_share_vert_check(edges2[0], edges2[BLI_array_count(edges2) - 1]))
 		{
 			BLI_array_free(edges1);
 			BLI_array_free(edges2);
@@ -1193,7 +1199,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 	}
 
 	if (edges2 && BLI_array_count(edges2) > 2 &&
-	    BM_edge_share_vert_count(edges2[0], edges2[BLI_array_count(edges2) - 1]))
+	    BM_edge_share_vert_check(edges2[0], edges2[BLI_array_count(edges2) - 1]))
 	{
 		edges2 = NULL;
 	}
@@ -1243,9 +1249,9 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 			SWAP(BMVert *, v3, v4);
 		}
 
-		e = BM_edge_create(bm, v1, v3, NULL, TRUE);
+		e = BM_edge_create(bm, v1, v3, NULL, BM_CREATE_NO_DOUBLE);
 		BMO_elem_flag_enable(bm, e, ELE_NEW);
-		e = BM_edge_create(bm, v2, v4, NULL, TRUE);
+		e = BM_edge_create(bm, v2, v4, NULL, BM_CREATE_NO_DOUBLE);
 		BMO_elem_flag_enable(bm, e, ELE_NEW);
 	}
 	else if (edges1) {
@@ -1255,12 +1261,12 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
 			v1 = BM_vert_in_edge(edges1[1], edges1[0]->v1) ? edges1[0]->v2 : edges1[0]->v1;
 			i  = BLI_array_count(edges1) - 1;
 			v2 = BM_vert_in_edge(edges1[i - 1], edges1[i]->v1) ? edges1[i]->v2 : edges1[i]->v1;
-			e  = BM_edge_create(bm, v1, v2, NULL, TRUE);
+			e  = BM_edge_create(bm, v1, v2, NULL, BM_CREATE_NO_DOUBLE);
 			BMO_elem_flag_enable(bm, e, ELE_NEW);
 		}
 	}
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_NEW);
 
 	BLI_array_free(edges1);
 	BLI_array_free(edges2);
@@ -1280,11 +1286,11 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 	BMEdge *e;
 	BMFace *f;
 	int totv = 0, tote = 0, totf = 0, amount;
-	const short mat_nr = BMO_slot_int_get(op, "mat_nr");
-	const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
+	const short mat_nr     = BMO_slot_int_get(op->slots_in,  "mat_nr");
+	const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
 
 	/* count number of each element type we were passe */
-	BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT | BM_EDGE | BM_FACE) {
+	BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) {
 		switch (h->htype) {
 			case BM_VERT: totv++; break;
 			case BM_EDGE: tote++; break;
@@ -1318,7 +1324,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 		int ok = TRUE;
 
 
-		BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
+		BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
 			/* count how many flagged edges this vertex uses */
 			int tot_edges = 0;
 			BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
@@ -1353,10 +1359,10 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 		}
 
 		if (ok == TRUE && v_free && v_a && v_b) {
-			e = BM_edge_create(bm, v_free, v_a, NULL, TRUE);
+			e = BM_edge_create(bm, v_free, v_a, NULL, BM_CREATE_NO_DOUBLE);
 			BMO_elem_flag_enable(bm, e, ELE_NEW);
 
-			e = BM_edge_create(bm, v_free, v_b, NULL, TRUE);
+			e = BM_edge_create(bm, v_free, v_b, NULL, BM_CREATE_NO_DOUBLE);
 			BMO_elem_flag_enable(bm, e, ELE_NEW);
 		}
 	}
@@ -1366,7 +1372,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 	/* call edgenet prepare op so additional face creation cases wore */
 	BMO_op_initf(bm, &op2, op->flag, "edgenet_prepare edges=%fe", ELE_NEW);
 	BMO_op_exec(bm, &op2);
-	BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
+	BMO_slot_buffer_flag_enable(bm, op2.slots_out, "edges.out", BM_EDGE, ELE_NEW);
 	BMO_op_finish(bm, &op2);
 
 	BMO_op_initf(bm, &op2, op->flag,
@@ -1376,8 +1382,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 	BMO_op_exec(bm, &op2);
 
 	/* return if edge net create did something */
-	if (BMO_slot_buffer_count(bm, &op2, "faceout")) {
-		BMO_slot_copy(&op2, op, "faceout", "faceout");
+	if (BMO_slot_buffer_count(op2.slots_out, "faces.out")) {
+		BMO_slot_copy(&op2, slots_out, "faces.out",
+		              op,   slots_out, "faces.out");
 		BMO_op_finish(bm, &op2);
 		return;
 	}
@@ -1389,8 +1396,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 	BMO_op_exec(bm, &op2);
 	
 	/* if we dissolved anything, then return */
-	if (BMO_slot_buffer_count(bm, &op2, "regionout")) {
-		BMO_slot_copy(&op2, op, "regionout", "faceout");
+	if (BMO_slot_buffer_count(op2.slots_out, "region.out")) {
+		BMO_slot_copy(&op2, slots_out, "region.out",
+		              op,   slots_out,  "faces.out");
 		BMO_op_finish(bm, &op2);
 		return;
 	}
@@ -1412,9 +1420,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 
 	if (amount == 2) {
 		/* create edge */
-		e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
+		e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE);
 		BMO_elem_flag_enable(bm, e, ELE_OUT);
-		BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
+		BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT);
 	}
 	else if (0) { /* nice feature but perhaps it should be a different tool? */
 
@@ -1453,14 +1461,14 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 				if (ese->htype == BM_VERT) {
 					v = (BMVert *)ese->ele;
 					if (v_prev) {
-						e = BM_edge_create(bm, v, v_prev, NULL, TRUE);
+						e = BM_edge_create(bm, v, v_prev, NULL, BM_CREATE_NO_DOUBLE);
 						BMO_elem_flag_enable(bm, e, ELE_OUT);
 					}
 					v_prev = v;
 				}
 			}
 		}
-		BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
+		BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT);
 		/* done creating edges */
 	}
 	else if (amount > 2) {
@@ -1470,12 +1478,12 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
 		BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
 		int i = 0;
 
-		BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
+		BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
 			vert_arr[i] = v;
 			i++;
 		}
 
-		f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, TRUE);
+		f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, BM_CREATE_NO_DOUBLE);
 
 		if (f) {
 			BMO_elem_flag_enable(bm, f, ELE_OUT);
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 84f6cb2..7c3bcd6 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -85,7 +85,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 	BMWalker regwalker;
 	int i;
 
-	int use_verts = BMO_slot_bool_get(op, "use_verts");
+	int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
 
 	if (use_verts) {
 		/* tag verts that start out with only 2 edges,
@@ -98,10 +98,10 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK);
 	
 	/* collect region */
-	BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
 
 		if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
 			continue;
@@ -184,7 +184,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 		goto cleanup;
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "regionout", BM_FACE, FACE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW);
 
 cleanup:
 	/* free/cleanup */
@@ -208,7 +208,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
 	int i;
 
 
-	BMO_ITER (e, &oiter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) {
 		if (BM_edge_face_pair(e, &fa, &fb)) {
 			BMO_elem_flag_enable(bm, e->v1, VERT_MARK);
 			BMO_elem_flag_enable(bm, e->v2, VERT_MARK);
@@ -237,7 +237,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
 	//BMO_op_initf(bm, &fop, "dissolve_faces faces=%ff", FACE_MARK);
 	//BMO_op_exec(bm, &fop);
 
-	//BMO_slot_copy(op, &fop, "regionout", "regionout");
+	//BMO_slot_copy(op, &fop, "region.out", "region.out");
 
 	//BMO_op_finish(bm, &fop);
 }
@@ -254,7 +254,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
 	BMIter viter;
 	BMVert *v;
 
-	int use_verts = BMO_slot_bool_get(op, "use_verts");
+	int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
 
 	if (use_verts) {
 		BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
@@ -262,7 +262,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (e, &eiter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &eiter, op->slots_in, "edges", BM_EDGE) {
 		BMFace *fa, *fb;
 
 		if (BM_edge_face_pair(e, &fa, &fb)) {
@@ -338,7 +338,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
 	BMFace *f;
 	/* int i; */
 
-	BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_MARK);
 	
 	for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
 		if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
@@ -477,182 +477,15 @@ void dummy_exec(BMesh *bm, BMOperator *op)
 #endif
 
 /* Limited Dissolve */
-
-#define UNIT_TO_ANGLE DEG2RADF(90.0f)
-#define ANGLE_TO_UNIT (1.0f / UNIT_TO_ANGLE)
-
-/* multiply vertex edge angle by face angle
- * this means we are not left with sharp corners between _almost_ planer faces
- * convert angles [0-PI/2] -> [0-1], multiply together, then convert back to radians. */
-static float bm_vert_edge_face_angle(BMVert *v)
-{
-	const float angle = BM_vert_calc_edge_angle(v);
-	/* note: could be either edge, it doesn't matter */
-	if (v->e && BM_edge_is_manifold(v->e)) {
-		return ((angle * ANGLE_TO_UNIT) * (BM_edge_calc_face_angle(v->e) * ANGLE_TO_UNIT)) * UNIT_TO_ANGLE;
-	}
-	else {
-		return angle;
-	}
-}
-
-#undef UNIT_TO_ANGLE
-#undef ANGLE_TO_UNIT
-
-typedef struct DissolveElemWeight {
-	BMHeader *ele;
-	float weight;
-} DissolveElemWeight;
-
-static int dissolve_elem_cmp(const void *a1, const void *a2)
-{
-	const struct DissolveElemWeight *d1 = a1, *d2 = a2;
-
-	if      (d1->weight > d2->weight) return  1;
-	else if (d1->weight < d2->weight) return -1;
-	return 0;
-}
-
 void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
 {
-	BMOpSlot *einput = BMO_slot_get(op, "edges");
-	BMOpSlot *vinput = BMO_slot_get(op, "verts");
+	BMOpSlot *einput = BMO_slot_get(op->slots_in, "edges");
+	BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
 	const float angle_max = (float)M_PI / 2.0f;
-	const float angle_limit = minf(angle_max, BMO_slot_float_get(op, "angle_limit"));
-	DissolveElemWeight *weight_elems = MEM_mallocN(MAX2(einput->len, vinput->len) *
-	                                               sizeof(DissolveElemWeight), __func__);
-	int i, tot_found;
-
-	BMIter iter;
-	BMEdge *e_iter;
-	BMEdge **earray;
-
-	int *vert_reverse_lookup;
-
-	BMEdge **einput_arr = (BMEdge **)einput->data.p;
-	BMVert **vinput_arr = (BMVert **)vinput->data.p;
-
-	/* --- first edges --- */
-
-	/* wire -> tag */
-	BM_ITER_MESH (e_iter, &iter, bm, BM_EDGES_OF_MESH) {
-		BM_elem_flag_set(e_iter, BM_ELEM_TAG, BM_edge_is_wire(e_iter));
-	}
-
-	/* go through and split edge */
-	for (i = 0, tot_found = 0; i < einput->len; i++) {
-		BMEdge *e = einput_arr[i];
-		const float angle = BM_edge_calc_face_angle(e);
-
-		if (angle < angle_limit) {
-			tot_found++;
-		}
-		weight_elems[i].ele = (BMHeader *)e;
-		weight_elems[i].weight = angle;
-	}
-
-	if (tot_found != 0) {
-		qsort(weight_elems, einput->len, sizeof(DissolveElemWeight), dissolve_elem_cmp);
-
-		for (i = 0; i < tot_found; i++) {
-			BMEdge *e = (BMEdge *)weight_elems[i].ele;
-
-			if (/* may have become non-manifold */
-			    BM_edge_is_manifold(e) &&
-			    /* check twice because cumulative effect could dissolve over angle limit */
-			    (BM_edge_calc_face_angle(e) < angle_limit))
-			{
-				BMFace *nf = BM_faces_join_pair(bm, e->l->f,
-				                                e->l->radial_next->f,
-				                                e,
-				                                FALSE); /* join faces */
-
-				/* there may be some errors, we don't mind, just move on */
-				if (nf) {
-					BM_face_normal_update(nf);
-				}
-				else {
-					BMO_error_clear(bm);
-				}
-			}
-		}
-	}
-
-	/* prepare for cleanup */
-	BM_mesh_elem_index_ensure(bm, BM_VERT);
-	vert_reverse_lookup = MEM_mallocN(sizeof(int) * bm->totvert, __func__);
-	fill_vn_i(vert_reverse_lookup, bm->totvert, -1);
-	for (i = 0, tot_found = 0; i < vinput->len; i++) {
-		BMVert *v = vinput_arr[i];
-		vert_reverse_lookup[BM_elem_index_get(v)] = i;
-	}
-
-	/* --- cleanup --- */
-	earray = MEM_mallocN(sizeof(BMEdge *) * bm->totedge, __func__);
-	BM_ITER_MESH_INDEX (e_iter, &iter, bm, BM_EDGES_OF_MESH, i) {
-		earray[i] = e_iter;
-	}
-	/* remove all edges/verts left behind from dissolving, NULL'ing the vertex array so we dont re-use */
-	for (i = bm->totedge - 1; i != -1; i--) {
-		e_iter = earray[i];
-
-		if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == FALSE)) {
-			/* edge has become wire */
-			int vidx_reverse;
-			BMVert *v1 = e_iter->v1;
-			BMVert *v2 = e_iter->v2;
-			BM_edge_kill(bm, e_iter);
-			if (v1->e == NULL) {
-				vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v1)];
-				if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
-				BM_vert_kill(bm, v1);
-			}
-			if (v2->e == NULL) {
-				vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v2)];
-				if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
-				BM_vert_kill(bm, v2);
-			}
-		}
-	}
-	MEM_freeN(vert_reverse_lookup);
-
-	MEM_freeN(earray);
-
-
-	/* --- second verts --- */
-	for (i = 0, tot_found = 0; i < vinput->len; i++) {
-		BMVert *v = vinput_arr[i];
-		const float angle = v ? bm_vert_edge_face_angle(v) : angle_limit;
-
-		if (angle < angle_limit) {
-			weight_elems[i].ele = (BMHeader *)v;
-			weight_elems[i].weight = angle;
-			tot_found++;
-		}
-		else {
-			weight_elems[i].ele = NULL;
-			weight_elems[i].weight = angle_max;
-		}
-	}
-
-	if (tot_found != 0) {
-		qsort(weight_elems, vinput->len, sizeof(DissolveElemWeight), dissolve_elem_cmp);
-
-		for (i = 0; i < tot_found; i++) {
-			BMVert *v = (BMVert *)weight_elems[i].ele;
-			if (/* topology changes may cause this to be un-collapsable */
-			    (BM_vert_edge_count(v) == 2) &&
-			    /* check twice because cumulative effect could dissolve over angle limit */
-			    bm_vert_edge_face_angle(v) < angle_limit)
-			{
-				BMEdge *ne = BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
-
-				if (ne && ne->l) {
-					BM_edge_normals_update(ne);
-				}
-			}
-		}
-	}
+	const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
+	const int do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
 
-	MEM_freeN(weight_elems);
+	BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries,
+	                             (BMVert **)BMO_SLOT_AS_BUFFER(vinput), vinput->len,
+	                             (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len);
 }
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 3227000..9a58d7a 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -49,7 +49,7 @@ static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *tar
 	BMVert *target_vertex = NULL;
 
 	/* Create a new vertex */
-	target_vertex = BM_vert_create(target_mesh, source_vertex->co, NULL);
+	target_vertex = BM_vert_create(target_mesh, source_vertex->co, NULL, BM_CREATE_SKIP_CD);
 	
 	/* Insert new vertex into the vert hash */
 	BLI_ghash_insert(vhash, source_vertex, target_vertex);
@@ -68,7 +68,9 @@ static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *tar
  *
  * Copy an existing edge from one bmesh to another.
  */
-static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
+static BMEdge *copy_edge(BMOperator *op,
+                         BMOpSlot *slot_boundarymap_out,
+                         BMesh *source_mesh,
                          BMEdge *source_edge, BMesh *target_mesh,
                          GHash *vhash, GHash *ehash)
 {
@@ -96,14 +98,13 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
 	target_vert2 = BLI_ghash_lookup(vhash, source_edge->v2);
 	
 	/* Create a new edge */
-	target_edge = BM_edge_create(target_mesh, target_vert1, target_vert2, NULL, FALSE);
+	target_edge = BM_edge_create(target_mesh, target_vert1, target_vert2, NULL, BM_CREATE_SKIP_CD);
 	
 	/* add to new/old edge map if necassary */
 	if (rlen < 2) {
 		/* not sure what non-manifold cases of greater then three
 		 * radial should do. */
-		BMO_slot_map_ptr_insert(source_mesh, op, "boundarymap",
-		                        source_edge, target_edge);
+		BMO_slot_map_elem_insert(op, slot_boundarymap_out, source_edge, target_edge);
 	}
 
 	/* Insert new edge into the edge hash */
@@ -124,7 +125,9 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
  * Copy an existing face from one bmesh to another.
  */
 
-static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
+static BMFace *copy_face(BMOperator *op,
+                         BMOpSlot *slot_facemap_out,
+                         BMesh *source_mesh,
                          BMFace *source_face, BMesh *target_mesh,
                          BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash)
 {
@@ -151,11 +154,11 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
 		vtar[i] = BLI_ghash_lookup(vhash, source_loop->v);
 		edar[i] = BLI_ghash_lookup(ehash, source_loop->e);
 	}
-	
+
 	/* create new face */
-	target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, FALSE);
-	BMO_slot_map_ptr_insert(source_mesh, op, "facemap", source_face, target_face);
-	BMO_slot_map_ptr_insert(source_mesh, op, "facemap", target_face, source_face);
+	target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, BM_CREATE_SKIP_CD);
+	BMO_slot_map_elem_insert(op, slot_facemap_out, source_face, target_face);
+	BMO_slot_map_elem_insert(op, slot_facemap_out, target_face, source_face);
 
 	BM_elem_attrs_copy(source_mesh, target_mesh, source_face, target_face);
 
@@ -181,7 +184,7 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
  * Internal Copy function.
  */
 
-static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
+static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst)
 {
 
 	BMVert *v = NULL, *v2;
@@ -196,22 +199,26 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
 	BMIter viter, eiter, fiter;
 	GHash *vhash, *ehash;
 
+	BMOpSlot *slot_boundary_map_out = BMO_slot_get(op->slots_out, "boundary_map.out");
+	BMOpSlot *slot_face_map_out     = BMO_slot_get(op->slots_out, "face_map.out");
+	BMOpSlot *slot_isovert_map_out  = BMO_slot_get(op->slots_out, "isovert_map.out");
+
 	/* initialize pointer hashes */
 	vhash = BLI_ghash_ptr_new("bmesh dupeops v");
 	ehash = BLI_ghash_ptr_new("bmesh dupeops e");
 
 	/* duplicate flagged vertices */
-	BM_ITER_MESH (v, &viter, source, BM_VERTS_OF_MESH) {
-		if (BMO_elem_flag_test(source, v, DUPE_INPUT) &&
-		    !BMO_elem_flag_test(source, v, DUPE_DONE))
+	BM_ITER_MESH (v, &viter, bm_src, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm_src, v, DUPE_INPUT) &&
+		    !BMO_elem_flag_test(bm_src, v, DUPE_DONE))
 		{
 			BMIter iter;
 			int isolated = 1;
 
-			v2 = copy_vertex(source, v, target, vhash);
+			v2 = copy_vertex(bm_src, v, bm_dst, vhash);
 
 			BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
-				if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
+				if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) {
 					isolated = 0;
 					break;
 				}
@@ -219,7 +226,7 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
 
 			if (isolated) {
 				BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
-					if (BMO_elem_flag_test(source, e, DUPE_INPUT)) {
+					if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT)) {
 						isolated = 0;
 						break;
 					}
@@ -227,49 +234,49 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
 			}
 
 			if (isolated) {
-				BMO_slot_map_ptr_insert(source, op, "isovertmap", v, v2);
+				BMO_slot_map_elem_insert(op, slot_isovert_map_out, v, v2);
 			}
 
-			BMO_elem_flag_enable(source, v, DUPE_DONE);
+			BMO_elem_flag_enable(bm_src, v, DUPE_DONE);
 		}
 	}
 
 	/* now we dupe all the edges */
-	BM_ITER_MESH (e, &eiter, source, BM_EDGES_OF_MESH) {
-		if (BMO_elem_flag_test(source, e, DUPE_INPUT) &&
-		    !BMO_elem_flag_test(source, e, DUPE_DONE))
+	BM_ITER_MESH (e, &eiter, bm_src, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT) &&
+		    !BMO_elem_flag_test(bm_src, e, DUPE_DONE))
 		{
 			/* make sure that verts are copied */
-			if (!BMO_elem_flag_test(source, e->v1, DUPE_DONE)) {
-				copy_vertex(source, e->v1, target, vhash);
-				BMO_elem_flag_enable(source, e->v1, DUPE_DONE);
+			if (!BMO_elem_flag_test(bm_src, e->v1, DUPE_DONE)) {
+				copy_vertex(bm_src, e->v1, bm_dst, vhash);
+				BMO_elem_flag_enable(bm_src, e->v1, DUPE_DONE);
 			}
-			if (!BMO_elem_flag_test(source, e->v2, DUPE_DONE)) {
-				copy_vertex(source, e->v2, target, vhash);
-				BMO_elem_flag_enable(source, e->v2, DUPE_DONE);
+			if (!BMO_elem_flag_test(bm_src, e->v2, DUPE_DONE)) {
+				copy_vertex(bm_src, e->v2, bm_dst, vhash);
+				BMO_elem_flag_enable(bm_src, e->v2, DUPE_DONE);
 			}
 			/* now copy the actual edge */
-			copy_edge(op, source, e, target, vhash, ehash);
-			BMO_elem_flag_enable(source, e, DUPE_DONE);
+			copy_edge(op, slot_boundary_map_out, bm_src, e, bm_dst, vhash, ehash);
+			BMO_elem_flag_enable(bm_src, e, DUPE_DONE);
 		}
 	}
 
 	/* first we dupe all flagged faces and their elements from source */
-	BM_ITER_MESH (f, &fiter, source, BM_FACES_OF_MESH) {
-		if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
+	BM_ITER_MESH (f, &fiter, bm_src, BM_FACES_OF_MESH) {
+		if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) {
 			/* vertex pass */
 			BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
-				if (!BMO_elem_flag_test(source, v, DUPE_DONE)) {
-					copy_vertex(source, v, target, vhash);
-					BMO_elem_flag_enable(source, v, DUPE_DONE);
+				if (!BMO_elem_flag_test(bm_src, v, DUPE_DONE)) {
+					copy_vertex(bm_src, v, bm_dst, vhash);
+					BMO_elem_flag_enable(bm_src, v, DUPE_DONE);
 				}
 			}
 
 			/* edge pass */
 			BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) {
-				if (!BMO_elem_flag_test(source, e, DUPE_DONE)) {
-					copy_edge(op, source, e, target, vhash, ehash);
-					BMO_elem_flag_enable(source, e, DUPE_DONE);
+				if (!BMO_elem_flag_test(bm_src, e, DUPE_DONE)) {
+					copy_edge(op, slot_boundary_map_out, bm_src, e, bm_dst, vhash, ehash);
+					BMO_elem_flag_enable(bm_src, e, DUPE_DONE);
 				}
 			}
 
@@ -280,8 +287,8 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
 			BLI_array_grow_items(vtar, f->len);
 			BLI_array_grow_items(edar, f->len);
 
-			copy_face(op, source, f, target, vtar, edar, vhash, ehash);
-			BMO_elem_flag_enable(source, f, DUPE_DONE);
+			copy_face(op, slot_face_map_out, bm_src, f, bm_dst, vtar, edar, vhash, ehash);
+			BMO_elem_flag_enable(bm_src, f, DUPE_DONE);
 		}
 	}
 	
@@ -317,23 +324,24 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
 void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
 {
 	BMOperator *dupeop = op;
-	BMesh *bm2 = BMO_slot_ptr_get(op, "dest");
+	BMesh *bm2 = BMO_slot_ptr_get(op->slots_in, "dest");
 	
 	if (!bm2)
 		bm2 = bm;
 
 	/* flag input */
-	BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
+	BMO_slot_buffer_flag_enable(bm, dupeop->slots_in, "geom", BM_ALL_NOLOOP, DUPE_INPUT);
 
 	/* use the internal copy function */
-	BKE_mesh_copy(dupeop, bm, bm2);
+	bmo_mesh_copy(dupeop, bm, bm2);
 	
 	/* Output */
 	/* First copy the input buffers to output buffers - original data */
-	BMO_slot_copy(dupeop, dupeop, "geom", "origout");
+	BMO_slot_copy(dupeop, slots_in,  "geom",
+	              dupeop, slots_out, "geom_orig.out");
 
 	/* Now alloc the new output buffers */
-	BMO_slot_buffer_from_enabled_flag(bm, dupeop, "newout", BM_ALL, DUPE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, dupeop, dupeop->slots_out, "geom.out", BM_ALL_NOLOOP, DUPE_NEW);
 }
 
 #if 0 /* UNUSED */
@@ -378,16 +386,17 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
 	BMOperator *splitop = op;
 	BMOperator dupeop;
 	BMOperator delop;
-	const short use_only_faces = BMO_slot_bool_get(op, "use_only_faces");
+	const short use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
 
 	/* initialize our sub-operator */
 	BMO_op_init(bm, &dupeop, op->flag, "duplicate");
 	BMO_op_init(bm, &delop, op->flag, "delete");
 	
-	BMO_slot_copy(splitop, &dupeop, "geom", "geom");
+	BMO_slot_copy(splitop, slots_in, "geom",
+	              &dupeop, slots_in, "geom");
 	BMO_op_exec(bm, &dupeop);
 	
-	BMO_slot_buffer_flag_enable(bm, splitop, "geom", BM_ALL, SPLIT_INPUT);
+	BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT);
 
 	if (use_only_faces) {
 		BMVert *v;
@@ -427,16 +436,22 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
 	}
 
 	/* connect outputs of dupe to delete, exluding keep geometry */
-	BMO_slot_int_set(&delop, "context", DEL_FACES);
-	BMO_slot_buffer_from_enabled_flag(bm, &delop, "geom", BM_ALL, SPLIT_INPUT);
+	BMO_slot_int_set(delop.slots_in, "context", DEL_FACES);
+	BMO_slot_buffer_from_enabled_flag(bm, &delop, delop.slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT);
 	
 	BMO_op_exec(bm, &delop);
 
 	/* now we make our outputs by copying the dupe output */
-	BMO_slot_copy(&dupeop, splitop, "newout", "geomout");
-	BMO_slot_copy(&dupeop, splitop, "boundarymap", "boundarymap");
-	BMO_slot_copy(&dupeop, splitop, "isovertmap", "isovertmap");
-	
+	BMO_slot_copy(&dupeop, slots_out, "geom.out",
+	              splitop, slots_out, "geom.out");
+
+	BMO_slot_copy(&dupeop, slots_out, "boundary_map.out",
+	              splitop, slots_out, "boundary_map.out");
+
+	BMO_slot_copy(&dupeop, slots_out, "isovert_map.out",
+	              splitop, slots_out, "isovert_map.out");
+
+
 	/* cleanup */
 	BMO_op_finish(bm, &delop);
 	BMO_op_finish(bm, &dupeop);
@@ -450,9 +465,9 @@ void bmo_delete_exec(BMesh *bm, BMOperator *op)
 	BMOperator *delop = op;
 
 	/* Mark Buffer */
-	BMO_slot_buffer_flag_enable(bm, delop, "geom", BM_ALL, DEL_INPUT);
+	BMO_slot_buffer_flag_enable(bm, delop->slots_in, "geom", BM_ALL_NOLOOP, DEL_INPUT);
 
-	BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op, "context"));
+	BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op->slots_in, "context"));
 
 #undef DEL_INPUT
 }
@@ -473,44 +488,47 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
 	float phi;
 	int steps, do_dupli, a, usedvec;
 
-	BMO_slot_vec_get(op, "cent", cent);
-	BMO_slot_vec_get(op, "axis", axis);
+	BMO_slot_vec_get(op->slots_in, "cent", cent);
+	BMO_slot_vec_get(op->slots_in, "axis", axis);
 	normalize_v3(axis);
-	BMO_slot_vec_get(op, "dvec", dvec);
+	BMO_slot_vec_get(op->slots_in, "dvec", dvec);
 	usedvec = !is_zero_v3(dvec);
-	steps = BMO_slot_int_get(op, "steps");
-	phi = BMO_slot_float_get(op, "ang") * DEG2RADF(1.0f) / steps;
-	do_dupli = BMO_slot_bool_get(op, "do_dupli");
+	steps    = BMO_slot_int_get(op->slots_in,   "steps");
+	phi      = BMO_slot_float_get(op->slots_in, "angle") / steps;
+	do_dupli = BMO_slot_bool_get(op->slots_in,  "use_duplicate");
 
 	axis_angle_to_mat3(rmat, axis, phi);
 
-	BMO_slot_copy(op, op, "geom", "lastout");
+	BMO_slot_copy(op, slots_in,  "geom",
+	              op, slots_out, "geom_last.out");
 	for (a = 0; a < steps; a++) {
 		if (do_dupli) {
-			BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%s", op, "lastout");
+			BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%S", op, "geom_last.out");
 			BMO_op_exec(bm, &dupop);
 			BMO_op_callf(bm, op->flag,
-			             "rotate cent=%v mat=%m3 verts=%s",
-			             cent, rmat, &dupop, "newout");
-			BMO_slot_copy(&dupop, op, "newout", "lastout");
+			             "rotate cent=%v matrix=%m3 verts=%S",
+			             cent, rmat, &dupop, "geom.out");
+			BMO_slot_copy(&dupop, slots_out, "geom.out",
+			              op,     slots_out, "geom_last.out");
 			BMO_op_finish(bm, &dupop);
 		}
 		else {
-			BMO_op_initf(bm, &extop, op->flag, "extrude_face_region edgefacein=%s",
-			             op, "lastout");
+			BMO_op_initf(bm, &extop, op->flag, "extrude_face_region geom=%S",
+			             op, "geom_last.out");
 			BMO_op_exec(bm, &extop);
 			BMO_op_callf(bm, op->flag,
-			             "rotate cent=%v mat=%m3 verts=%s",
-			             cent, rmat, &extop, "geomout");
-			BMO_slot_copy(&extop, op, "geomout", "lastout");
+			             "rotate cent=%v matrix=%m3 verts=%S",
+			             cent, rmat, &extop, "geom.out");
+			BMO_slot_copy(&extop, slots_out, "geom.out",
+			              op,     slots_out, "geom_last.out");
 			BMO_op_finish(bm, &extop);
 		}
 
 		if (usedvec) {
 			mul_m3_v3(rmat, dvec);
 			BMO_op_callf(bm, op->flag,
-			             "translate vec=%v verts=%s",
-			             dvec, op, "lastout");
+			             "translate vec=%v verts=%S",
+			             dvec, op, "geom_last.out");
 		}
 	}
 }
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
index 1f6689e..9e9e4b8 100644
--- a/source/blender/bmesh/operators/bmo_edgesplit.c
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -81,14 +81,14 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
 
 	/* single marked edges unconnected to any other marked edges
 	 * are illegal, go through and unmark them */
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		/* lame, but we don't want the count to exceed 255,
 		 * so just count to 2, its all we need */
 		unsigned char *vt;
 		vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
 		vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++;
 	}
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		if (vtouch[BM_elem_index_get(e->v1)] == 1 &&
 		    vtouch[BM_elem_index_get(e->v2)] == 1)
 		{
@@ -104,13 +104,13 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
 	BMEdge *e;
-	const int use_verts = BMO_slot_bool_get(op, "use_verts");
+	const int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
 
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_SEAM);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_SEAM);
 
 	if (use_verts) {
 		/* this slows down the operation but its ok because the modifier doesn't use */
-		BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_SEAM);
+		BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_SEAM);
 
 		/* prevent one edge having both verts unflagged
 		 * we could alternately disable these edges, either way its a corner case.
@@ -118,7 +118,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 		 * This is needed so we don't split off the edge but then none of its verts which
 		 * would leave a duplicate edge.
 		 */
-		BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 			if (UNLIKELY((BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE &&
 			              (BMO_elem_flag_test(bm, e->v2, VERT_SEAM) == FALSE))))
 			{
@@ -130,7 +130,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 
 	bm_edgesplit_validate_seams(bm, op);
 
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
 			/* this flag gets copied so we can be sure duplicate edges get it too (important) */
 			BM_elem_flag_enable(e, BM_ELEM_INTERNAL_TAG);
@@ -146,7 +146,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 	}
 
 	if (use_verts) {
-		BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 			if (BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE) {
 				BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
 			}
@@ -156,7 +156,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
 			if (BM_elem_flag_test(e->v1, BM_ELEM_TAG)) {
 				BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
@@ -169,5 +169,5 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_hflag(bm, op, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
+	BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG);
 }
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 81cad27..065a1b5 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -60,18 +60,18 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(edges);
 	int i;
 
-	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
 		BLI_array_empty(edges);
 		BLI_array_grow_items(edges, f->len);
 
 		i = 0;
 		firstv = lastv = NULL;
 		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
-			v = BM_vert_create(bm, l->v->co, l->v);
+			v = BM_vert_create(bm, l->v->co, l->v, 0);
 
 			/* skip on the first iteration */
 			if (lastv) {
-				e = BM_edge_create(bm, lastv, v, l->e, FALSE);
+				e = BM_edge_create(bm, lastv, v, l->e, 0);
 				edges[i++] = e;
 			}
 
@@ -81,14 +81,14 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
 		}
 
 		/* this fits in the array because we skip one in the loop above */
-		e = BM_edge_create(bm, v, firstv, laste, FALSE);
+		e = BM_edge_create(bm, v, firstv, laste, 0);
 		edges[i++] = e;
 
 		BMO_elem_flag_enable(bm, f, EXT_DEL);
 
-		f2 = BM_face_create_ngon(bm, firstv, BM_edge_other_vert(edges[0], firstv), edges, f->len, FALSE);
+		f2 = BM_face_create_ngon(bm, firstv, BM_edge_other_vert(edges[0], firstv), edges, f->len, 0);
 		if (UNLIKELY(f2 == NULL)) {
-			BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Extrude failed; could not create face");
+			BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Extrude failed: could not create face");
 			BLI_array_free(edges);
 			return;
 		}
@@ -122,7 +122,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
 	BMO_op_callf(bm, op->flag,
 	             "delete geom=%ff context=%i",
 	             EXT_DEL, DEL_ONLYFACES);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, EXT_KEEP);
 }
 
 /**
@@ -132,46 +132,36 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
  * This function won't crash if its not but won't work right either.
  * \a e_b is the new edge.
  *
- * \note this function could be exposed as an api call if other areas need it,
- * so far only extrude does.
+ * \note The edge this face comes from needs to be from the first and second verts fo the face.
+ * The caller must ensure this else we will copy from the wrong source.
  */
-static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e_a, BMEdge *e_b)
+static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f)
 {
-	/* 'a' is the starting edge #e, 'b' is the final edge #newedge */
-	BMLoop *l_dst_a = BM_face_edge_share_loop(f, e_a);
-	BMLoop *l_dst_b = BM_face_edge_share_loop(f, e_b);
-	/* we could only have a face on one-or the other edges,
-	 * check if either side of the face has an adjacent face */
-	BMLoop *l_src_1;
-	BMLoop *l_src_2;
-
-	/* there is no l_src_b */
-
-	/* sanity */
-	BLI_assert(l_dst_a->f == l_dst_b->f);
-
-	if (l_dst_a != l_dst_a->radial_next) {
-		l_src_1 = l_dst_a->radial_next;
-		l_src_2 = l_src_1->next;
-	}
-	else if (l_dst_b != l_dst_b->radial_next) {
-		l_src_2 = l_dst_b->radial_next;
-		l_src_1 = l_src_2->next;
-	}
-	else {
-		/* no new faces on either edge, nothing to copy from */
+	/* edge we are extruded from */
+	BMLoop *l_first_0 = BM_FACE_FIRST_LOOP(f);
+	BMLoop *l_first_1 = l_first_0->next;
+	BMLoop *l_first_2 = l_first_1->next;
+	BMLoop *l_first_3 = l_first_2->next;
+
+	BMLoop *l_other_0;
+	BMLoop *l_other_1;
+
+	if (UNLIKELY(l_first_0 == l_first_0->radial_next)) {
 		return;
 	}
 
-	BM_elem_attrs_copy(bm, bm, l_src_1->f, l_dst_a->f);
-	BM_elem_flag_disable(f, BM_ELEM_HIDDEN); /* possibly we copy from a hidden face */
+	l_other_0 = BM_edge_other_loop(l_first_0->e, l_first_0);
+	l_other_1 = BM_edge_other_loop(l_first_0->e, l_first_1);
 
 	/* copy data */
-	BM_elem_attrs_copy(bm, bm, l_src_2, l_dst_a);
-	BM_elem_attrs_copy(bm, bm, l_src_2, l_dst_b->next);
+	BM_elem_attrs_copy(bm, bm, l_other_0->f, f);
+	BM_elem_flag_disable(f, BM_ELEM_HIDDEN);  /* possibly we copy from a hidden face */
 
-	BM_elem_attrs_copy(bm, bm, l_src_1, l_dst_a->next);
-	BM_elem_attrs_copy(bm, bm, l_src_1, l_dst_b);
+	BM_elem_attrs_copy(bm, bm, l_other_0, l_first_0);
+	BM_elem_attrs_copy(bm, bm, l_other_0, l_first_3);
+
+	BM_elem_attrs_copy(bm, bm, l_other_1, l_first_1);
+	BM_elem_attrs_copy(bm, bm, l_other_1, l_first_2);
 }
 
 /* Disable the skin root flag on the input vert, assumes that the vert
@@ -188,11 +178,10 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
 	BMOperator dupeop;
-	BMVert *v1, *v2, *v3, *v4;
-	BMEdge *e, *e2;
 	BMFace *f;
+	BMEdge *e, *e_new;
 	
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		BMO_elem_flag_enable(bm, e, EXT_INPUT);
 		BMO_elem_flag_enable(bm, e->v1, EXT_INPUT);
 		BMO_elem_flag_enable(bm, e->v2, EXT_INPUT);
@@ -203,33 +192,34 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
 
 	/* disable root flag on all new skin nodes */
 	if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
-		BMO_ITER(v1, &siter, bm, &dupeop, "newout", BM_VERT) {
-			bm_extrude_disable_skin_root(bm, v1);
+		BMVert *v;
+		BMO_ITER(v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
+			bm_extrude_disable_skin_root(bm, v);
 		}
 	}
 
-	for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
-		e2 = BMO_iter_map_value(&siter);
-		e2 = *(BMEdge **)e2;
+	for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundary_map.out", 0); e; e = BMO_iter_step(&siter)) {
+		BMVert *f_verts[4];
+		e_new = *(BMEdge **)BMO_iter_map_value(&siter);
 
 		if (e->l && e->v1 != e->l->v) {
-			v1 = e->v1;
-			v2 = e->v2;
-			v3 = e2->v2;
-			v4 = e2->v1;
+			f_verts[0] = e->v1;
+			f_verts[1] = e->v2;
+			f_verts[2] = e_new->v2;
+			f_verts[3] = e_new->v1;
 		}
 		else {
-			v1 = e2->v1;
-			v2 = e2->v2;
-			v3 = e->v2;
-			v4 = e->v1;
+			f_verts[0] = e->v2;
+			f_verts[1] = e->v1;
+			f_verts[2] = e_new->v1;
+			f_verts[3] = e_new->v2;
 		}
 		/* not sure what to do about example face, pass NULL for now */
-		f = BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
-		bm_extrude_copy_face_loop_attributes(bm, f, e, e2);
+		f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, FALSE);
+		bm_extrude_copy_face_loop_attributes(bm, f);
 		
 		if (BMO_elem_flag_test(bm, e, EXT_INPUT))
-			e = e2;
+			e = e_new;
 		
 		BMO_elem_flag_enable(bm, f, EXT_KEEP);
 		BMO_elem_flag_enable(bm, e, EXT_KEEP);
@@ -240,7 +230,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
 
 	BMO_op_finish(bm, &dupeop);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, EXT_KEEP);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, EXT_KEEP);
 }
 
 void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
@@ -250,19 +240,19 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
 	BMEdge *e;
 	const int has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN);
 
-	for (v = BMO_iter_new(&siter, bm, op, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
-		dupev = BM_vert_create(bm, v->co, v);
+	for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
+		dupev = BM_vert_create(bm, v->co, v, 0);
 		if (has_vskin)
 			bm_extrude_disable_skin_root(bm, v);
 
-		e = BM_edge_create(bm, v, dupev, NULL, FALSE);
+		e = BM_edge_create(bm, v, dupev, NULL, 0);
 
 		BMO_elem_flag_enable(bm, e, EXT_KEEP);
 		BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, EXT_KEEP);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EXT_KEEP);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, EXT_KEEP);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EXT_KEEP);
 }
 
 void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
@@ -270,19 +260,21 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
 	BMOperator dupeop, delop;
 	BMOIter siter;
 	BMIter iter, fiter, viter;
-	BMEdge *e, *newedge;
-	BMVert *verts[4], *v, *v2;
+	BMEdge *e, *e_new;
+	BMVert *v, *v2;
 	BMFace *f;
 	int found, fwd, delorig = FALSE;
+	BMOpSlot *slot_facemap_out;
+	BMOpSlot *slot_edges_exclude;
 
 	/* initialize our sub-operators */
 	BMO_op_init(bm, &dupeop, op->flag, "duplicate");
 	
-	BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_EDGE | BM_FACE, EXT_INPUT);
 	
 	/* if one flagged face is bordered by an un-flagged face, then we delete
 	 * original geometry unless caller explicitly asked to keep it. */
-	if (!BMO_slot_bool_get(op, "alwayskeeporig")) {
+	if (!BMO_slot_bool_get(op->slots_in, "use_keep_orig")) {
 		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 
 			int edge_face_tot;
@@ -349,18 +341,21 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
 		             EXT_DEL, DEL_ONLYTAGGED);
 	}
 
-	BMO_slot_copy(op, &dupeop, "edgefacein", "geom");
+	BMO_slot_copy(op,      slots_in, "geom",
+	              &dupeop, slots_in, "geom");
 	BMO_op_exec(bm, &dupeop);
 
 	/* disable root flag on all new skin nodes */
 	if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
-		BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
+		BMO_ITER(v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
 			bm_extrude_disable_skin_root(bm, v);
 		}
 	}
 
-	if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT))
-		bm->act_face = BMO_slot_map_ptr_get(bm, &dupeop, "facemap", bm->act_face);
+	slot_facemap_out = BMO_slot_get(dupeop.slots_out, "face_map.out");
+	if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT)) {
+		bm->act_face = BMO_slot_map_elem_get(slot_facemap_out, bm->act_face);
+	}
 
 	if (delorig) {
 		BMO_op_exec(bm, &delop);
@@ -375,12 +370,15 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 	
-	BMO_slot_copy(&dupeop, op, "newout", "geomout");
+	BMO_slot_copy(&dupeop, slots_out, "geom.out",
+	              op,      slots_out, "geom.out");
 
-	for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
+	slot_edges_exclude = BMO_slot_get(op->slots_in, "edges_exclude");
+	for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundary_map.out", 0); e; e = BMO_iter_step(&siter)) {
+		BMVert *f_verts[4];
 
 		/* this should always be wire, so this is mainly a speedup to avoid map lookup */
-		if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
+		if (BM_edge_is_wire(e) && BMO_slot_map_contains(slot_edges_exclude, e)) {
 			BMVert *v1 = e->v1, *v2 = e->v2;
 
 			/* The original edge was excluded,
@@ -396,43 +394,43 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
 			continue;
 		}
 
-		newedge = *(BMEdge **)BMO_iter_map_value(&siter);
+		e_new = *(BMEdge **)BMO_iter_map_value(&siter);
 
-		if (!newedge) {
+		if (!e_new) {
 			continue;
 		}
 
 		/* orient loop to give same normal as a loop of newedge
 		 * if it exists (will be an extruded face),
 		 * else same normal as a loop of e, if it exists */
-		if (!newedge->l)
+		if (!e_new->l)
 			fwd = !e->l || !(e->l->v == e->v1);
 		else
-			fwd = (newedge->l->v == newedge->v1);
+			fwd = (e_new->l->v == e_new->v1);
 
 		
 		if (fwd) {
-			verts[0] = e->v1;
-			verts[1] = e->v2;
-			verts[2] = newedge->v2;
-			verts[3] = newedge->v1;
+			f_verts[0] = e->v1;
+			f_verts[1] = e->v2;
+			f_verts[2] = e_new->v2;
+			f_verts[3] = e_new->v1;
 		}
 		else {
-			verts[3] = e->v1;
-			verts[2] = e->v2;
-			verts[1] = newedge->v2;
-			verts[0] = newedge->v1;
+			f_verts[0] = e->v2;
+			f_verts[1] = e->v1;
+			f_verts[2] = e_new->v1;
+			f_verts[3] = e_new->v2;
 		}
 
 		/* not sure what to do about example face, pass NULL for now */
-		f = BM_face_create_quad_tri_v(bm, verts, 4, NULL, FALSE);
-		bm_extrude_copy_face_loop_attributes(bm, f, e, newedge);
+		f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, FALSE);
+		bm_extrude_copy_face_loop_attributes(bm, f);
 	}
 
 	/* link isolated vert */
-	for (v = BMO_iter_new(&siter, bm, &dupeop, "isovertmap", 0); v; v = BMO_iter_step(&siter)) {
+	for (v = BMO_iter_new(&siter, dupeop.slots_out, "isovert_map.out", 0); v; v = BMO_iter_step(&siter)) {
 		v2 = *((void **)BMO_iter_map_value(&siter));
-		BM_edge_create(bm, v, v2, v->e, TRUE);
+		BM_edge_create(bm, v, v2, v->e, BM_CREATE_NO_DOUBLE);
 	}
 
 	/* cleanup */
@@ -604,10 +602,10 @@ static void solidify_add_thickness(BMesh *bm, const float dist)
 
 	/* array for passing verts to angle_poly_v3 */
 	float **verts = NULL;
-	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(verts, BM_DEFAULT_NGON_STACK_SIZE);
 	/* array for receiving angles from angle_poly_v3 */
 	float *face_angles = NULL;
-	BLI_array_staticdeclare(face_angles, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(face_angles, BM_DEFAULT_NGON_STACK_SIZE);
 
 	BM_mesh_elem_index_ensure(bm, BM_VERT);
 
@@ -656,25 +654,28 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
 	BMOperator reverseop;
 	float thickness;
 
-	thickness = BMO_slot_float_get(op, "thickness");
+	thickness = BMO_slot_float_get(op->slots_in, "thickness");
 
 	/* Flip original faces (so the shell is extruded inward) */
 	BMO_op_init(bm, &reverseop, op->flag, "reverse_faces");
-	BMO_slot_copy(op, &reverseop, "geom", "faces");
+	BMO_slot_copy(op,         slots_in, "geom",
+	              &reverseop, slots_in, "faces");
 	BMO_op_exec(bm, &reverseop);
 	BMO_op_finish(bm, &reverseop);
 
 	/* Extrude the region */
-	BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region alwayskeeporig=%b", TRUE);
-	BMO_slot_copy(op, &extrudeop, "geom", "edgefacein");
+	BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region use_keep_orig=%b", TRUE);
+	BMO_slot_copy(op,         slots_in, "geom",
+	              &extrudeop, slots_in, "geom");
 	BMO_op_exec(bm, &extrudeop);
 
 	/* Push the verts of the extruded faces inward to create thickness */
-	BMO_slot_buffer_flag_enable(bm, &extrudeop, "geomout", BM_FACE, FACE_MARK);
+	BMO_slot_buffer_flag_enable(bm, extrudeop.slots_out, "geom.out", BM_FACE, FACE_MARK);
 	calc_solidify_normals(bm);
 	solidify_add_thickness(bm, thickness);
 
-	BMO_slot_copy(&extrudeop, op, "geomout", "geomout");
+	BMO_slot_copy(&extrudeop, slots_out, "geom.out",
+	              op,         slots_out, "geom.out");
 
 	BMO_op_finish(bm, &extrudeop);
 }
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index d97d901..e2da4f4 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -24,19 +24,17 @@
  *  \ingroup bmesh
  */
 
+#ifdef WITH_BULLET
+
 #include "MEM_guardedalloc.h"
 
+#include "BLI_array.h"
 #include "BLI_ghash.h"
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
-/*XXX: This operator doesn't work well (at all?) for flat surfaces with
- * >3 sides - creating overlapping faces at times.
- * An easy workaround is to add in some noise but this is
- * weak and unreliable, ideally this would detect flat surfaces
- * (possibly making them into ngons) - see
- */
+#include "Bullet-C-Api.h"
 
 /* XXX: using 128 for totelem and pchunk of mempool, no idea what good
  * values would be though */
@@ -46,21 +44,15 @@
 
 #include "intern/bmesh_operators_private.h"  /* own include */
 
-#define HULL_EPSILON_FLT 0.0001f
-/* values above 0.0001 cause errors, see below for details, don't increase
- * without checking against bug [#32027] */
-#define HULL_EPSILON_DOT_FLT 0.00000001f
-
 /* Internal operator flags */
 typedef enum {
 	HULL_FLAG_INPUT =           (1 << 0),
-	HULL_FLAG_TETRA_VERT =      (1 << 1),
 	
-	HULL_FLAG_INTERIOR_ELE =    (1 << 2),
-	HULL_FLAG_OUTPUT_GEOM =     (1 << 3),
+	HULL_FLAG_INTERIOR_ELE =    (1 << 1),
+	HULL_FLAG_OUTPUT_GEOM =     (1 << 2),
 	
-	HULL_FLAG_DEL =             (1 << 4),
-	HULL_FLAG_HOLE =            (1 << 5)
+	HULL_FLAG_DEL =             (1 << 3),
+	HULL_FLAG_HOLE =            (1 << 4)
 } HullFlags;
 
 /* Store hull triangles separate from BMesh faces until the end; this
@@ -72,63 +64,6 @@ typedef struct HullTriangle {
 	int skip;
 } HullTriangle;
 
-/* These edges define the hole created in the hull by deleting faces
- * that can "see" a new vertex (the boundary edges then form the edge
- * of a new triangle fan that has the new vertex as its center) */
-typedef struct HullBoundaryEdge {
-	struct HullBoundaryEdge *next, *prev;
-	BMVert *v[2];
-} HullBoundaryEdge;
-
-
-
-/*************************** Boundary Edges ***************************/
-
-static int edge_match(BMVert *e1_v1, BMVert *e1_v2, BMVert *e2[2])
-{
-	return (e1_v1 == e2[0] && e1_v2 == e2[1]) ||
-	       (e1_v1 == e2[1] && e1_v2 == e2[0]);
-}
-
-/* Returns true if the edge (e1, e2) is already in edges; that edge is
- * deleted here as well. if not found just returns 0 */
-static int check_for_dup(ListBase *edges, BLI_mempool *pool,
-                         BMVert *v1, BMVert *v2)
-{
-	HullBoundaryEdge *e, *e_next;
-
-	for (e = edges->first; e; e = e_next) {
-		e_next = e->next;
-
-		if (edge_match(v1, v2, e->v)) {
-			/* remove the interior edge */
-			BLI_remlink(edges, e);
-			BLI_mempool_free(pool, e);
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
-static void expand_boundary_edges(ListBase *edges, BLI_mempool *edge_pool,
-                                  const HullTriangle *t)
-{
-	HullBoundaryEdge *e_new;
-	int i;
-
-	/* Insert each triangle edge into the boundary list; if any of
-	 * its edges are already in there, remove the edge entirely */
-	for (i = 0; i < 3; i++) {
-		if (!check_for_dup(edges, edge_pool, t->v[i], t->v[(i + 1) % 3])) {
-			e_new = BLI_mempool_calloc(edge_pool);
-			e_new->v[0] = t->v[i];
-			e_new->v[1] = t->v[(i + 1) % 3];
-			BLI_addtail(edges, e_new);
-		}
-	}
-}
-
 
 
 /*************************** Hull Triangles ***************************/
@@ -152,75 +87,6 @@ static void hull_add_triangle(BMesh *bm, GHash *hull_triangles, BLI_mempool *poo
 	normal_tri_v3(t->no, v1->co, v2->co, v3->co);
 }
 
-static int hull_point_tri_side(const HullTriangle *t, const float co[3])
-{
-	/* Added epsilon to fix bug [#31941], improves output when some
-	 * vertices are nearly coplanar. Might need further tweaking for
-	 * other cases though.
-	 * ...
-	 * Update: epsilon of 0.0001 causes [#32027], use HULL_EPSILON_DOT_FLT
-	 * and give it a much smaller value
-	 * */
-	float p[3], d;
-	sub_v3_v3v3(p, co, t->v[0]->co);
-	d = dot_v3v3(t->no, p);
-	if      (d < -HULL_EPSILON_DOT_FLT) return -1;
-	else if (d >  HULL_EPSILON_DOT_FLT) return  1;
-	else return 0;
-}
-
-/* Get all hull triangles that vertex 'v' is outside of */
-static GHash *hull_triangles_v_outside(GHash *hull_triangles, const BMVert *v)
-{
-	GHash *outside;
-	GHashIterator iter;
-
-	outside = BLI_ghash_ptr_new("outside");
-
-	GHASH_ITER (iter, hull_triangles) {
-		HullTriangle *t = BLI_ghashIterator_getKey(&iter);
-		
-		if (hull_point_tri_side(t, v->co) > 0)
-			BLI_ghash_insert(outside, t, NULL);
-	}
-
-	return outside;
-}
-
-/* For vertex 'v', find which triangles must be deleted to extend the
- * hull; find the boundary edges of that hole so that it can be filled
- * with connections to the new vertex, and update the hull_triangles
- * to delete the marked triangles */
-static void add_point(BMesh *bm, GHash *hull_triangles, BLI_mempool *hull_pool,
-                      BLI_mempool *edge_pool, GHash *outside, BMVert *v)
-{
-	ListBase edges = {NULL, NULL};
-	HullBoundaryEdge *e, *e_next;
-	GHashIterator iter;
-
-	GHASH_ITER (iter, outside) {
-		HullTriangle *t = BLI_ghashIterator_getKey(&iter);
-		int i;
-		
-		expand_boundary_edges(&edges, edge_pool, t);
-
-		/* Mark triangle's vertices as interior */
-		for (i = 0; i < 3; i++)
-			BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_INTERIOR_ELE);
-		
-		/* Delete the triangle */
-		BLI_ghash_remove(hull_triangles, t, NULL, NULL);
-		BLI_mempool_free(hull_pool, t);
-	}
-
-	/* Fill hole boundary with triangles to new point */
-	for (e = edges.first; e; e = e_next) {
-		e_next = e->next;
-		hull_add_triangle(bm, hull_triangles, hull_pool, e->v[0], e->v[1], v);
-		BLI_mempool_free(edge_pool, e);
-	}
-}
-
 static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e)
 {
 	BMIter iter;
@@ -243,33 +109,62 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
 	
 	GHASH_ITER (iter, hull_triangles) {
 		HullTriangle *t = BLI_ghashIterator_getKey(&iter);
+		int i;
 
 		if (!t->skip) {
 			BMEdge *edges[3] = {
-				BM_edge_create(bm, t->v[0], t->v[1], NULL, TRUE),
-				BM_edge_create(bm, t->v[1], t->v[2], NULL, TRUE),
-				BM_edge_create(bm, t->v[2], t->v[0], NULL, TRUE)
+				BM_edge_create(bm, t->v[0], t->v[1], NULL, BM_CREATE_NO_DOUBLE),
+				BM_edge_create(bm, t->v[1], t->v[2], NULL, BM_CREATE_NO_DOUBLE),
+				BM_edge_create(bm, t->v[2], t->v[0], NULL, BM_CREATE_NO_DOUBLE)
 			};
 			BMFace *f, *example = NULL;
-			int i;
 
-			/* Look for an adjacent face that existed before the hull */
-			for (i = 0; i < 3; i++) {
-				if (!example)
-					example = hull_find_example_face(bm, edges[i]);
+			if (BM_face_exists(t->v, 3, &f)) {
+				/* If the operator is run with "use_existing_faces"
+				 * disabled, but an output face in the hull is the
+				 * same as a face in the existing mesh, it should not
+				 * be marked as unused or interior. */
+				BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
+				BMO_elem_flag_disable(bm, f, HULL_FLAG_HOLE);
+				BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
 			}
+			else {
+				/* Look for an adjacent face that existed before the hull */
+				for (i = 0; i < 3; i++) {
+					if (!example)
+						example = hull_find_example_face(bm, edges[i]);
+				}
 
-			f = BM_face_create_quad_tri_v(bm, t->v, 3, example, FALSE);
-			BM_face_copy_shared(bm, f);
-
-			/* Mark face/verts/edges for 'geomout' slot and select */
+				/* Create new hull face */
+				f = BM_face_create_quad_tri_v(bm, t->v, 3, example, TRUE);
+				BM_face_copy_shared(bm, f);
+			}
+			/* Mark face for 'geom.out' slot and select */
 			BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
 			BM_face_select_set(bm, f, TRUE);
+
+			/* Mark edges for 'geom.out' slot */
 			for (i = 0; i < 3; i++) {
-				BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
 				BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM);
 			}
 		}
+		else {
+			/* Mark input edges for 'geom.out' slot */
+			for (i = 0; i < 3; i++) {
+				const int next = (i == 2 ? 0 : i + 1);
+				BMEdge *e = BM_edge_exists(t->v[i], t->v[next]);
+				if (e &&
+					BMO_elem_flag_test(bm, e, HULL_FLAG_INPUT) &&
+					!BMO_elem_flag_test(bm, e, HULL_FLAG_HOLE)) {
+					BMO_elem_flag_enable(bm, e, HULL_FLAG_OUTPUT_GEOM);
+				}
+			}
+		}
+
+		/* Mark verts for 'geom.out' slot */
+		for (i = 0; i < 3; i++) {
+			BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
+		}
 	}
 }
 
@@ -362,158 +257,6 @@ static void hull_final_edges_free(HullFinalEdges *final_edges)
 
 
 
-/************************* Initial Tetrahedron ************************/
-
-static void hull_add_tetrahedron(BMesh *bm, GHash *hull_triangles, BLI_mempool *pool,
-                                 BMVert *tetra[4])
-{
-	float center[3];
-	int i, indices[4][3] = {
-		{0, 1, 2},
-		{0, 2, 3},
-		{1, 0, 3},
-		{2, 1, 3}
-	};
-
-	/* Calculate center */
-	zero_v3(center);
-	for (i = 0; i < 4; i++)
-		add_v3_v3(center, tetra[i]->co);
-	mul_v3_fl(center, 0.25f);
-
-	for (i = 0; i < 4; i++) {
-		BMVert *v1 = tetra[indices[i][0]];
-		BMVert *v2 = tetra[indices[i][1]];
-		BMVert *v3 = tetra[indices[i][2]];
-		float no[3], d[3];
-
-		normal_tri_v3(no, v1->co, v2->co, v3->co);
-		sub_v3_v3v3(d, center, v1->co);
-		if (dot_v3v3(no, d) > 0)
-			SWAP(BMVert *, v1, v3);
-
-		hull_add_triangle(bm, hull_triangles, pool, v1, v2, v3);
-	}
-}
-
-/* For each axis, get the minimum and maximum input vertices */
-static void hull_get_min_max(BMesh *bm, BMOperator *op,
-                             BMVert *min[3], BMVert *max[3])
-{
-	BMOIter oiter;
-	BMVert *v;
-
-	min[0] = min[1] = min[2] = NULL;
-	max[0] = max[1] = max[2] = NULL;
-
-	BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
-		int i;
-		
-		for (i = 0; i < 3; i++) {
-			if (!min[i] || v->co[i] < min[i]->co[i])
-				min[i] = v;
-			if (!max[i] || v->co[i] > max[i]->co[i])
-				max[i] = v;
-		}
-	}
-}
-
-/* Returns true if input is coplanar */
-static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op,
-                                       BMVert *tetra[4])
-{
-	BMVert *min[3], *max[3], *v;
-	BMOIter oiter;
-	float widest_axis_len, largest_dist, plane_normal[3];
-	int i, j, widest_axis;
-	
-	tetra[0] = tetra[1] = tetra[2] = tetra[3] = NULL;
-	hull_get_min_max(bm, op, min, max);
-
-	/* Check for flat axis */
-	for (i = 0; i < 3; i++) {
-		if (min[i] == max[i]) {
-			return TRUE;
-		}
-	}
-
-	/* Find widest axis */
-	widest_axis_len = 0.0f;
-	widest_axis = 0; /* set here in the unlikey case this isn't set below */
-	for (i = 0; i < 3; i++) {
-		float len = (max[i]->co[i] - min[i]->co[i]);
-		if (len >= widest_axis_len) {
-			widest_axis_len = len;
-			widest_axis = i;
-		}
-	}
-
-	/* Use widest axis for first two points */
-	tetra[0] = min[widest_axis];
-	tetra[1] = max[widest_axis];
-	BMO_elem_flag_enable(bm, tetra[0], HULL_FLAG_TETRA_VERT);
-	BMO_elem_flag_enable(bm, tetra[1], HULL_FLAG_TETRA_VERT);
-
-	/* Choose third vertex farthest from existing line segment */
-	largest_dist = 0;
-	for (i = 0; i < 3; i++) {
-		BMVert *v;
-		float dist;
-
-		if (i == widest_axis)
-			continue;
-
-		v = min[i];
-		for (j = 0; j < 2; j++) {
-			dist = dist_to_line_segment_v3(v->co, tetra[0]->co, tetra[1]->co);
-			if (dist > largest_dist) {
-				largest_dist = dist;
-				tetra[2] = v;
-			}
-
-			v = max[i];
-		}
-	}
-
-	if (tetra[2]) {
-		BMO_elem_flag_enable(bm, tetra[2], HULL_FLAG_TETRA_VERT);
-	}
-	else {
-		return TRUE;
-	}
-
-	/* Check for colinear vertices */
-	if (largest_dist < HULL_EPSILON_FLT)
-		return TRUE;
-
-	/* Choose fourth point farthest from existing plane */
-	largest_dist = 0;
-	normal_tri_v3(plane_normal, tetra[0]->co, tetra[1]->co, tetra[2]->co);
-	BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
-		if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) {
-			float dist = fabsf(dist_to_plane_v3(v->co, tetra[0]->co, plane_normal));
-			if (dist > largest_dist) {
-				largest_dist = dist;
-				tetra[3] = v;
-			}
-		}
-	}
-
-	if (tetra[3]) {
-		BMO_elem_flag_enable(bm, tetra[3], HULL_FLAG_TETRA_VERT);
-	}
-	else {
-		return TRUE;
-	}
-
-	if (largest_dist < HULL_EPSILON_FLT)
-		return TRUE;
-
-	return FALSE;
-}
-
-
-
 /**************************** Final Output ****************************/
 
 static void hull_remove_overlapping(BMesh *bm, GHash *hull_triangles,
@@ -561,14 +304,14 @@ static void hull_mark_interior_elements(BMesh *bm, BMOperator *op,
 	BMOIter oiter;
 
 	/* Check for interior edges too */
-	BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+	BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
 		if (!hull_final_edges_lookup(final_edges, e->v1, e->v2))
 			BMO_elem_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
 	}
 
 	/* Mark all input faces as interior, some may be unmarked in
 	 * hull_remove_overlapping() */
-	BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+	BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
 		BMO_elem_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
 	}
 }
@@ -585,7 +328,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
 	 * interior (i.e. were already part of the input, but not part of
 	 * the hull), but that aren't also used by elements outside the
 	 * input set */
-	BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
+	BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
 		if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
 			int del = TRUE;
 		
@@ -608,7 +351,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+	BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
 		if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
 			int del = TRUE;
 
@@ -624,7 +367,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+	BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
 		if (BMO_elem_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE))
 			BMO_elem_flag_enable(bm, f, HULL_FLAG_DEL);
 	}
@@ -639,10 +382,10 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
 
 	/* Unmark any hole faces if they are isolated or part of a
 	 * border */
-	BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+	BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
 		if (BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
 			BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
-				if (BM_edge_face_count(e) == 1) {
+				if (BM_edge_is_boundary(e)) {
 					BMO_elem_flag_disable(bm, f, HULL_FLAG_HOLE);
 					break;
 				}
@@ -650,49 +393,180 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	/* Mark edges too if all adjacent faces are holes */
-	BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+	/* Mark edges too if all adjacent faces are holes and the edge is
+	 * not already isolated */
+	BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
 		int hole = TRUE;
+		int any_faces = FALSE;
 		
 		BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
+			any_faces = TRUE;
 			if (!BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
 				hole = FALSE;
 				break;
 			}
 		}
 
-		if (hole)
+		if (hole && any_faces)
 			BMO_elem_flag_enable(bm, e, HULL_FLAG_HOLE);
 	}
 }
 
+static int hull_input_vert_count(BMOperator *op)
+{
+	BMOIter oiter;
+	BMVert *v;
+	int count = 0;
+
+	BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
+		count++;
+	}
+
+	return count;
+}
+
+static BMVert **hull_input_verts_copy(BMOperator *op,
+                                      const int num_input_verts)
+{
+	BMOIter oiter;
+	BMVert *v;
+	BMVert **input_verts = MEM_callocN(sizeof(*input_verts) *
+	                                   num_input_verts, AT);
+	int i = 0;
+
+	BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
+		input_verts[i++] = v;
+	}
+
+	return input_verts;
+}
+
+static float (*hull_verts_for_bullet(BMVert **input_verts,
+                                     const int num_input_verts))[3]
+{
+	float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, AT);
+	int i;
+
+	for (i = 0; i < num_input_verts; i++) {
+		copy_v3_v3(coords[i], input_verts[i]->co);
+	}
+
+	return coords;
+}
+
+static BMVert **hull_verts_from_bullet(plConvexHull hull,
+                                       BMVert **input_verts,
+                                       const int num_input_verts)
+{
+	const int num_verts = plConvexHullNumVertices(hull);
+	BMVert **hull_verts = MEM_mallocN(sizeof(*hull_verts) *
+	                                  num_verts, AT);
+	int i;
+
+	for (i = 0; i < num_verts; i++) {
+		float co[3];
+		int original_index;
+		plConvexHullGetVertex(hull, i, co, &original_index);
+
+		if (original_index >= 0 && original_index < num_input_verts) {
+			hull_verts[i] = input_verts[original_index];
+		}
+		else
+			BLI_assert(!"Unexpected new vertex in hull output");
+	}
+
+	return hull_verts;
+}
+
+static void hull_from_bullet(BMesh *bm, BMOperator *op,
+                             GHash *hull_triangles,
+                             BLI_mempool *pool)
+{
+	int *fvi = NULL;
+	BLI_array_declare(fvi);
+
+	BMVert **input_verts;
+	float (*coords)[3];
+	BMVert **hull_verts;
+
+	plConvexHull hull;
+	int i, count = 0;
+
+	const int num_input_verts = hull_input_vert_count(op);
+
+	input_verts = hull_input_verts_copy(op, num_input_verts);
+	coords = hull_verts_for_bullet(input_verts, num_input_verts);
+
+	hull = plConvexHullCompute(coords, num_input_verts);
+	hull_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts);
+	
+	count = plConvexHullNumFaces(hull);
+	for (i = 0; i < count; i++) {
+		const int len = plConvexHullGetFaceSize(hull, i);
+
+		if (len > 2) {
+			BMVert *fv[3];
+			int j;
+
+			/* Get face vertex indices */
+			BLI_array_empty(fvi);
+			BLI_array_grow_items(fvi, len);
+			plConvexHullGetFaceVertices(hull, i, fvi);
+
+			/* Note: here we throw away any NGons from Bullet and turn
+			 * them into triangle fans. Would be nice to use these
+			 * directly, but will have to wait until HullTriangle goes
+			 * away (TODO) */
+			fv[0] = hull_verts[fvi[0]];
+			for (j = 2; j < len; j++) {
+				fv[1] = hull_verts[fvi[j - 1]];
+				fv[2] = hull_verts[fvi[j]];
+
+				hull_add_triangle(bm, hull_triangles, pool,
+				                  fv[0], fv[1], fv[2]);
+			}
+		}
+	}
+
+	BLI_array_free(fvi);
+	MEM_freeN(hull_verts);
+	MEM_freeN(coords);
+	MEM_freeN(input_verts);
+}
+
+/* Check that there are at least three vertices in the input */
+static int hull_num_input_verts_is_ok(BMOperator *op)
+{
+	BMOIter oiter;
+	BMVert *v;
+	int partial_num_verts = 0;
+
+	BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
+		partial_num_verts++;
+		if (partial_num_verts >= 3)
+			break;
+	}
+
+	return (partial_num_verts >= 3);
+}
+
 void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
 {
 	HullFinalEdges *final_edges;
-	BLI_mempool *hull_pool, *edge_pool;
-	BMVert *v, *tetra[4];
+	BLI_mempool *hull_pool;
 	BMElemF *ele;
 	BMOIter oiter;
 	GHash *hull_triangles;
 
-	/* Verify that at least four verts in the input */
-	if (BMO_slot_get(op, "input")->len < 4) {
-		BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
-		                "Requires at least four vertices");
-		return;
-	}
-
-	/* Initialize the convex hull by building a tetrahedron. A
-	 * degenerate tetrahedron can cause problems, so report error and
-	 * fail if the result is coplanar */
-	if (hull_find_large_tetrahedron(bm, op, tetra)) {
+	/* Verify that at least three verts in the input */
+	if (!hull_num_input_verts_is_ok(op)) {
 		BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
-		                "Input vertices are coplanar");
+		                "Requires at least three vertices");
 		return;
 	}
 
 	/* Tag input elements */
-	BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL) {
+	BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) {
 		BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT);
 		
 		/* Mark all vertices as interior to begin with */
@@ -700,32 +574,17 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
 			BMO_elem_flag_enable(bm, ele, HULL_FLAG_INTERIOR_ELE);
 	}
 
-	edge_pool = BLI_mempool_create(sizeof(HullBoundaryEdge), 128, 128, 0);
 	hull_pool = BLI_mempool_create(sizeof(HullTriangle), 128, 128, 0);
 	hull_triangles = BLI_ghash_ptr_new("hull_triangles");
 
-	/* Add tetrahedron triangles */
-	hull_add_tetrahedron(bm, hull_triangles, hull_pool, tetra);
+	hull_from_bullet(bm, op, hull_triangles, hull_pool);
 
-	/* Expand hull to cover new vertices outside the existing hull */
-	BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
-		if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) {
-			GHash *outside = hull_triangles_v_outside(hull_triangles, v);
-			if (BLI_ghash_size(outside)) {
-				/* Expand hull and delete interior triangles */
-				add_point(bm, hull_triangles, hull_pool, edge_pool, outside, v);
-			}
-			BLI_ghash_free(outside, NULL, NULL);
-		}
-	}
-
-	BLI_mempool_destroy(edge_pool);
 	final_edges = hull_final_edges(hull_triangles);
 	
 	hull_mark_interior_elements(bm, op, final_edges);
 
 	/* Remove hull triangles covered by an existing face */
-	if (BMO_slot_bool_get(op, "use_existing_faces")) {
+	if (BMO_slot_bool_get(op->slots_in, "use_existing_faces")) {
 		hull_remove_overlapping(bm, hull_triangles, final_edges);
 
 		hull_tag_holes(bm, op);
@@ -744,21 +603,23 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
 
 	/* Output slot of input elements that ended up inside the hull
 	 * rather than part of it */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL,
-	                                  HULL_FLAG_INTERIOR_ELE);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_interior.out",
+	                                  BM_ALL_NOLOOP, HULL_FLAG_INTERIOR_ELE);
 
 	/* Output slot of input elements that ended up inside the hull and
 	 * are are unused by other geometry. */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "unused_geom", BM_ALL,
-	                                  HULL_FLAG_DEL);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_unused.out",
+	                                  BM_ALL_NOLOOP, HULL_FLAG_DEL);
 
 	/* Output slot of faces and edges that were in the input and on
 	 * the hull (useful for cases like bridging where you want to
 	 * delete some input geometry) */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "holes_geom", BM_ALL,
-	                                  HULL_FLAG_HOLE);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_holes.out",
+	                                  BM_ALL_NOLOOP, HULL_FLAG_HOLE);
 
 	/* Output slot of all hull vertices, faces, and edges */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
-	                                  HULL_FLAG_OUTPUT_GEOM);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out",
+	                                  BM_ALL_NOLOOP, HULL_FLAG_OUTPUT_GEOM);
 }
+
+#endif  /* WITH_BULLET */
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index 132d705..cef1181 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -92,13 +92,13 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
 
 void bmo_inset_exec(BMesh *bm, BMOperator *op)
 {
-	const int use_outset          = BMO_slot_bool_get(op, "use_outset");
-	const int use_boundary        = BMO_slot_bool_get(op, "use_boundary") && (use_outset == FALSE);
-	const int use_even_offset     = BMO_slot_bool_get(op, "use_even_offset");
+	const int use_outset          = BMO_slot_bool_get(op->slots_in, "use_outset");
+	const int use_boundary        = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == FALSE);
+	const int use_even_offset     = BMO_slot_bool_get(op->slots_in, "use_even_offset");
 	const int use_even_boundry    = use_even_offset; /* could make own option */
-	const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
-	const float thickness         = BMO_slot_float_get(op, "thickness");
-	const float depth             = BMO_slot_float_get(op, "depth");
+	const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
+	const float thickness         = BMO_slot_float_get(op->slots_in, "thickness");
+	const float depth             = BMO_slot_float_get(op->slots_in, "depth");
 
 	int edge_info_len = 0;
 
@@ -113,11 +113,11 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
 
 	if (use_outset == FALSE) {
 		BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
-		BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+		BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
 	}
 	else {
 		BM_mesh_elem_hflag_enable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
-		BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+		BMO_slot_buffer_hflag_disable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
 	}
 
 	/* first count all inset edges we will split */
@@ -181,7 +181,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
 
 		if (es->e_new == es->e_old) { /* happens on boundary edges */
 			/* take care here, we're creating this double edge which _must_ have its verts replaced later on */
-			es->e_old = BM_edge_create(bm, es->e_new->v1, es->e_new->v2, es->e_new, FALSE);
+			es->e_old = BM_edge_create(bm, es->e_new->v1, es->e_new->v2, es->e_new, 0);
 		}
 
 		/* store index back to original in 'edge_info' */
@@ -205,7 +205,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
 		v1 = BM_vert_create(bm, tvec, NULL);
 		v2 = BM_vert_create(bm, tvec, NULL);
 		madd_v3_v3fl(v2->co, es->no, 0.1f);
-		BM_edge_create(bm, v1, v2, NULL, FALSE);
+		BM_edge_create(bm, v1, v2, NULL, 0);
 	}
 #endif
 
@@ -477,11 +477,48 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
 		/* copy for loop data, otherwise UV's and vcols are no good.
 		 * tiny speedup here we could be more clever and copy from known adjacent data
 		 * also - we could attempt to interpolate the loop data, this would be much slower but more useful too */
+#if 0
+		/* don't use this because face boundaries have no adjacent loops and won't be filled in.
+		 * instead copy from the opposite side with the code below */
 		BM_face_copy_shared(bm, f);
+#else
+		{
+			/* 2 inner loops on the edge between the new face and the original */
+			BMLoop *l_a;
+			BMLoop *l_b;
+			BMLoop *l_a_other;
+			BMLoop *l_b_other;
+
+			l_a = BM_FACE_FIRST_LOOP(f);
+			l_b = l_a->next;
+
+			/* we know this side has a radial_next because of the order of created verts in the quad */
+			l_a_other = BM_edge_other_loop(l_a->e, l_a);
+			l_b_other = BM_edge_other_loop(l_a->e, l_b);
+			BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
+			BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
+
+			/* step around to the opposite side of the quad - warning, this may have no other edges! */
+			l_a = l_a->next->next;
+			l_b = l_a->next;
+			if (!BM_edge_is_boundary(l_a->e)) {
+				/* same as above */
+				l_a_other = BM_edge_other_loop(l_a->e, l_a);
+				l_b_other = BM_edge_other_loop(l_a->e, l_b);
+				BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
+				BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
+			}
+			else {  /* boundary edges have no useful data to copy from, use opposite side of face */
+				/* swap a<->b intentionally */
+				BM_elem_attrs_copy(bm, bm, l_a_other, l_b);
+				BM_elem_attrs_copy(bm, bm, l_b_other, l_a);
+			}
+		}
+#endif
 	}
 
 	/* we could flag new edges/verts too, is it useful? */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
 
 	/* cheap feature to add depth to the inset */
 	if (depth != 0.0f) {
@@ -514,7 +551,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
 		BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
 
 		/* tag face verts */
-		BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+		BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
 			BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
 				BM_elem_flag_enable(v, BM_ELEM_TAG);
 			}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 7191aa7..1e18a83 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -199,29 +199,30 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
 {
 	BMIter iter, liter;
 	BMOIter siter;
-	BMFace *f1, *f2;
+	BMFace *f;
 	BMLoop *l;
 	BMEdge *e;
 	BLI_array_declare(jedges);
 	JoinEdge *jedges = NULL;
-	int do_sharp = BMO_slot_bool_get(op, "cmp_sharp");
-	int do_uv    = BMO_slot_bool_get(op, "cmp_uvs");
+	int do_sharp = BMO_slot_bool_get(op->slots_in, "cmp_sharp");
+	int do_uv    = BMO_slot_bool_get(op->slots_in, "cmp_uvs");
 	int do_tf    = do_uv;  /* texture face, make make its own option eventually */
-	int do_vcol  = BMO_slot_bool_get(op, "cmp_vcols");
-	int do_mat   = BMO_slot_bool_get(op, "cmp_materials");
-	float limit  = BMO_slot_float_get(op, "limit");
+	int do_vcol  = BMO_slot_bool_get(op->slots_in, "cmp_vcols");
+	int do_mat   = BMO_slot_bool_get(op->slots_in, "cmp_materials");
+	float limit  = BMO_slot_float_get(op->slots_in, "limit");
 	int i, totedge;
 
 	/* flag all edges of all input face */
-	BMO_ITER (f1, &siter, bm, op, "faces", BM_FACE) {
-		BMO_elem_flag_enable(bm, f1, FACE_INPUT);
-		BM_ITER_ELEM (l, &liter, f1, BM_LOOPS_OF_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
+		BMO_elem_flag_enable(bm, f, FACE_INPUT);
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 			BMO_elem_flag_enable(bm, l->e, EDGE_MARK);
 		}
 	}
 
 	/* unflag edges that are invalid; e.g. aren't surrounded by triangle */
 	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMFace *f1, *f2;
 		if (!BMO_elem_flag_test(bm, e, EDGE_MARK))
 			continue;
 
@@ -300,6 +301,8 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
 	}
 
 	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMFace *f1, *f2;
+
 		if (!BMO_elem_flag_test(bm, e, EDGE_CHOSEN))
 			continue;
 
@@ -310,6 +313,8 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
 
 	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 		if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			BMFace *f1, *f2;
+
 			/* ok, this edge wasn't merged, check if it's
 			 * in a 2-tri-pair island, and if so merg */
 
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index c4b988a..4b897a2 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -53,9 +53,9 @@
 
 void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
 {
-	Object *ob = BMO_slot_ptr_get(op, "object");
-	Mesh *me = BMO_slot_ptr_get(op, "mesh");
-	int set_key = BMO_slot_bool_get(op, "set_shapekey");
+	Object *ob  = BMO_slot_ptr_get(op->slots_in,  "object");
+	Mesh *me    = BMO_slot_ptr_get(op->slots_in,  "mesh");
+	int set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
 
 	BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
 
@@ -66,20 +66,20 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
 
 void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
 {
-	Object *ob = BMO_slot_ptr_get(op, "object");
+	Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
 	/* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
 	Mesh *me = ob->data;
 
 	BMO_op_callf(bm, op->flag,
-	             "bmesh_to_mesh mesh=%p object=%p notessellation=%b",
+	             "bmesh_to_mesh mesh=%p object=%p skip_tessface=%b",
 	             me, ob, TRUE);
 }
 
 void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
 {
-	Mesh *me = BMO_slot_ptr_get(op, "mesh");
+	Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
 	/* Object *ob = BMO_slot_ptr_get(op, "object"); */
-	int dotess = !BMO_slot_bool_get(op, "notessellation");
+	int dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
 
 	BM_mesh_bm_to_me(bm, me, dotess);
 }
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index c6b228b..61b061d 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -50,27 +50,28 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
 	float mtx[4][4];
 	float imtx[4][4];
 	float scale[3] = {1.0f, 1.0f, 1.0f};
-	float dist = BMO_slot_float_get(op, "mergedist");
+	float dist = BMO_slot_float_get(op->slots_in, "merge_dist");
 	int i, ototvert /*, ototedge */;
-	int axis = BMO_slot_int_get(op, "axis");
-	int mirroru = BMO_slot_bool_get(op, "mirror_u");
-	int mirrorv = BMO_slot_bool_get(op, "mirror_v");
+	int axis = BMO_slot_int_get(op->slots_in, "axis");
+	int mirroru = BMO_slot_bool_get(op->slots_in, "mirror_u");
+	int mirrorv = BMO_slot_bool_get(op->slots_in, "mirror_v");
+	BMOpSlot *slot_targetmap;
 
 	ototvert = bm->totvert;
 	/* ototedge = bm->totedge; */ /* UNUSED */
 	
-	BMO_slot_mat4_get(op, "mat", mtx);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mtx);
 	invert_m4_m4(imtx, mtx);
 	
 	BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom");
 	BMO_op_exec(bm, &dupeop);
 	
-	BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, ELE_NEW);
+	BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW);
 
 	/* create old -> new mappin */
 	i = 0;
 	/* v2 = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); */ /* UNUSED */
-	BMO_ITER (v, &siter, bm, &dupeop, "newout", BM_VERT) {
+	BMO_ITER (v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
 		BLI_array_grow_one(vmap);
 		vmap[i] = v;
 		/* v2 = BM_iter_step(&iter); */ /* UNUSED */
@@ -80,16 +81,18 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
 
 	/* feed old data to transform bmo */
 	scale[axis] = -1.0f;
-	BMO_op_callf(bm, op->flag, "transform verts=%fv mat=%m4", ELE_NEW, mtx);
+	BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx);
 	BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale);
-	BMO_op_callf(bm, op->flag, "transform verts=%fv mat=%m4", ELE_NEW, imtx);
+	BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx);
 	
 	BMO_op_init(bm, &weldop, op->flag, "weld_verts");
 
+	slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+
 	v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
 	for (i = 0; i < ototvert; i++) {
-		if (ABS(v->co[axis]) <= dist) {
-			BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", vmap[i], v);
+		if (fabsf(v->co[axis]) <= dist) {
+			BMO_slot_map_elem_insert(&weldop, slot_targetmap, vmap[i], v);
 		}
 		v = BM_iter_step(&iter);
 	}
@@ -101,7 +104,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
 		int totlayer;
 		BMIter liter;
 
-		BMO_ITER (f, &siter, bm, &dupeop, "newout", BM_FACE) {
+		BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) {
 			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 				totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV);
 				for (i = 0; i < totlayer; i++) {
@@ -120,7 +123,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
 	BMO_op_finish(bm, &weldop);
 	BMO_op_finish(bm, &dupeop);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "newout", BM_ALL, ELE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW);
 
 	BLI_array_free(vmap);
 	BLI_array_free(emap);
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index 30561e4..c582f71 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -227,16 +227,17 @@ static signed char monkeyf[250][4] = {
 
 void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
 {
+	const float dia = BMO_slot_float_get(op->slots_in, "size");
+	const int tot = max_ii(2, BMO_slot_int_get(op->slots_in, "x_segments"));
+	const int seg = max_ii(2, BMO_slot_int_get(op->slots_in, "y_segments"));
+
 	BMOperator bmop, prevop;
 	BMVert *eve, *preveve;
 	BMEdge *e;
-	float vec[3], mat[4][4], phi, phid, dia = BMO_slot_float_get(op, "size");
-	int a, tot = BMO_slot_int_get(op, "xsegments"), seg = BMO_slot_int_get(op, "ysegments");
-
-	if (tot < 2) tot = 2;
-	if (seg < 2) seg = 2;
+	float vec[3], mat[4][4], phi, phid;
+	int a;
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	/* one segment first: the X axis */
 	phi = 1.0f;
@@ -247,11 +248,11 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
 		vec[2] = 0.0f;
 		mul_m4_v3(mat, vec);
 
-		eve = BM_vert_create(bm, vec, NULL);
+		eve = BM_vert_create(bm, vec, NULL, 0);
 		BMO_elem_flag_enable(bm, eve, VERT_MARK);
 
 		if (a != 0) {
-			e = BM_edge_create(bm, preveve, eve, NULL, TRUE);
+			e = BM_edge_create(bm, preveve, eve, NULL, BM_CREATE_NO_DOUBLE);
 			BMO_elem_flag_enable(bm, e, EDGE_ORIG);
 		}
 
@@ -267,39 +268,43 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
 
 	for (a = 0; a < seg - 1; a++) {
 		if (a) {
-			BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
+			BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geom.out");
 			BMO_op_exec(bm, &bmop);
 			BMO_op_finish(bm, &prevop);
 
-			BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+			BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
 		}
 		else {
 			BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
 			BMO_op_exec(bm, &bmop);
-			BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+			BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
 		}
 
-		BMO_op_callf(bm, op->flag, "translate vec=%v verts=%s", vec, &bmop, "geomout");
+		BMO_op_callf(bm, op->flag, "translate vec=%v verts=%S", vec, &bmop, "geom.out");
 		prevop = bmop;
 	}
 
 	if (a)
 		BMO_op_finish(bm, &bmop);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 {
+	const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+	const int seg = BMO_slot_int_get(op->slots_in, "u_segments");
+	const int tot = BMO_slot_int_get(op->slots_in, "v_segments");
+
 	BMOperator bmop, prevop;
 	BMVert *eve, *preveve;
 	BMEdge *e;
 	BMIter iter;
 	float vec[3], mat[4][4], cmat[3][3], phi, q[4];
-	float phid, dia = BMO_slot_float_get(op, "diameter");
-	int a, seg = BMO_slot_int_get(op, "segments"), tot = BMO_slot_int_get(op, "revolutions");
+	float phid;
+	int a;
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	phid = 2.0f * (float)M_PI / tot;
 	/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
@@ -312,11 +317,11 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 		vec[0] = -dia * sinf(phi);
 		vec[1] = 0.0;
 		vec[2] = dia * cosf(phi);
-		eve = BM_vert_create(bm, vec, NULL);
+		eve = BM_vert_create(bm, vec, NULL, 0);
 		BMO_elem_flag_enable(bm, eve, VERT_MARK);
 
 		if (a != 0) {
-			e = BM_edge_create(bm, preveve, eve, NULL, FALSE);
+			e = BM_edge_create(bm, preveve, eve, NULL, 0);
 			BMO_elem_flag_enable(bm, e, EDGE_ORIG);
 		}
 
@@ -333,7 +338,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 
 	for (a = 0; a < seg; a++) {
 		if (a) {
-			BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
+			BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geom.out");
 			BMO_op_exec(bm, &bmop);
 			BMO_op_finish(bm, &prevop);
 		}
@@ -342,8 +347,8 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 			BMO_op_exec(bm, &bmop);
 		}
 
-		BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
-		BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
+		BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
+		BMO_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out");
 		
 		prevop = bmop;
 	}
@@ -365,7 +370,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 		len2 = len_v3v3(vec, vec2);
 
 		/* use shortest segment length divided by 3 as merge threshold */
-		BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
+		BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, min_ff(len, len2) / 3.0f);
 	}
 
 	/* and now do imat */
@@ -375,31 +380,34 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
 {
+	const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+	const float dia_div = dia / 200.0f;
+	const int subdiv = BMO_slot_int_get(op->slots_in, "subdivisions");
+
 	BMVert *eva[12];
 	BMVert *v;
 	BMIter liter;
 	BMIter viter;
 	BMLoop *l;
 	float vec[3], mat[4][4] /* , phi, phid */;
-	float dia = BMO_slot_float_get(op, "diameter");
-	int a, subdiv = BMO_slot_int_get(op, "subdivisions");
+	int a;
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	/* phid = 2.0f * (float)M_PI / subdiv; */ /* UNUSED */
 	/* phi = 0.25f * (float)M_PI; */         /* UNUSED */
 
-	dia /= 200.0f;
+
 	for (a = 0; a < 12; a++) {
-		vec[0] = dia * icovert[a][0];
-		vec[1] = dia * icovert[a][1];
-		vec[2] = dia * icovert[a][2];
-		eva[a] = BM_vert_create(bm, vec, NULL);
+		vec[0] = dia_div * icovert[a][0];
+		vec[1] = dia_div * icovert[a][1];
+		vec[2] = dia_div * icovert[a][2];
+		eva[a] = BM_vert_create(bm, vec, NULL, 0);
 
 		BMO_elem_flag_enable(bm, eva[a], VERT_MARK);
 	}
@@ -421,22 +429,20 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
 		BMO_elem_flag_enable(bm, eftemp, FACE_MARK);
 	}
 
-	dia *= 200.0f;
-
 	if (subdiv > 1) {
 		BMOperator bmop;
 
 		BMO_op_initf(bm, &bmop, op->flag,
 		             "subdivide_edges edges=%fe "
 		             "smooth=%f "
-		             "numcuts=%i "
-		             "use_gridfill=%b use_sphere=%b",
+		             "cuts=%i "
+		             "use_grid_fill=%b use_sphere=%b",
 		             EDGE_MARK, dia, (1 << (subdiv - 1)) - 1,
 		             TRUE, TRUE);
 
 		BMO_op_exec(bm, &bmop);
-		BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
-		BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_EDGE, EDGE_MARK);
+		BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
+		BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_EDGE, EDGE_MARK);
 		BMO_op_finish(bm, &bmop);
 	}
 
@@ -447,7 +453,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
@@ -457,19 +463,19 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
 	float mat[4][4];
 	int i;
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	for (i = 0; i < monkeynv; i++) {
 		float v[3];
 
 		v[0] = (monkeyv[i][0] + 127) / 128.0, v[1] = monkeyv[i][1] / 128.0, v[2] = monkeyv[i][2] / 128.0;
 
-		tv[i] = BM_vert_create(bm, v, NULL);
+		tv[i] = BM_vert_create(bm, v, NULL, 0);
 		BMO_elem_flag_enable(bm, tv[i], VERT_MARK);
 
 		tv[monkeynv + i] = (fabsf(v[0] = -v[0]) < 0.001f) ?
 		                   tv[i] :
-		                   (eve = BM_vert_create(bm, v, NULL), mul_m4_v3(mat, eve->co), eve);
+		                   (eve = BM_vert_create(bm, v, NULL, 0), mul_m4_v3(mat, eve->co), eve);
 
 		BMO_elem_flag_enable(bm, tv[monkeynv + i], VERT_MARK);
 
@@ -494,24 +500,25 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
 
 	MEM_freeN(tv);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 
 void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
 {
+	const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+	const int segs = BMO_slot_int_get(op->slots_in, "segments");
+	const int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+	const int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
+
 	BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
 	float vec[3], mat[4][4], phi, phid;
-	float dia = BMO_slot_float_get(op, "diameter");
-	int segs = BMO_slot_int_get(op, "segments");
-	int cap_ends = BMO_slot_bool_get(op, "cap_ends");
-	int cap_tris = BMO_slot_bool_get(op, "cap_tris");
 	int a;
 	
 	if (!segs)
 		return;
 	
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	phid = 2.0f * (float)M_PI / segs;
 	phi = 0;
@@ -520,7 +527,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
 		zero_v3(vec);
 		mul_m4_v3(mat, vec);
 		
-		cent1 = BM_vert_create(bm, vec, NULL);
+		cent1 = BM_vert_create(bm, vec, NULL, 0);
 		BMO_elem_flag_enable(bm, cent1, VERT_MARK);
 	}
 
@@ -530,12 +537,12 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
 		vec[1] = dia * cosf(phi);
 		vec[2] = 0.0f;
 		mul_m4_v3(mat, vec);
-		v1 = BM_vert_create(bm, vec, NULL);
+		v1 = BM_vert_create(bm, vec, NULL, 0);
 
 		BMO_elem_flag_enable(bm, v1, VERT_MARK);
 		
 		if (lastv1)
-			BM_edge_create(bm, v1, lastv1, NULL, FALSE);
+			BM_edge_create(bm, v1, lastv1, NULL, 0);
 		
 		if (a && cap_ends) {
 			BMFace *f;
@@ -553,7 +560,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
 	if (!a)
 		return;
 
-	BM_edge_create(bm, lastv1, firstv1, NULL, FALSE);
+	BM_edge_create(bm, firstv1, lastv1, NULL, 0);
 
 	if (cap_ends) {
 		BMFace *f;
@@ -566,25 +573,25 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
 		BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
 	}
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
 {
 	BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2;
 	float vec[3], mat[4][4], phi, phid;
-	float dia1 = BMO_slot_float_get(op, "diameter1");
-	float dia2 = BMO_slot_float_get(op, "diameter2");
-	float depth = BMO_slot_float_get(op, "depth");
-	int segs = BMO_slot_int_get(op, "segments");
-	int cap_ends = BMO_slot_bool_get(op, "cap_ends");
-	int cap_tris = BMO_slot_bool_get(op, "cap_tris");
+	float dia1 = BMO_slot_float_get(op->slots_in, "diameter1");
+	float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
+	float depth = BMO_slot_float_get(op->slots_in, "depth");
+	int segs = BMO_slot_int_get(op->slots_in, "segments");
+	int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+	int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
 	int a;
 	
 	if (!segs)
 		return;
 	
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	phid = 2.0f * (float)M_PI / segs;
 	phi = 0;
@@ -595,13 +602,13 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
 		vec[2] = -depth;
 		mul_m4_v3(mat, vec);
 		
-		cent1 = BM_vert_create(bm, vec, NULL);
+		cent1 = BM_vert_create(bm, vec, NULL, 0);
 
 		vec[0] = vec[1] = 0.0f;
 		vec[2] = depth;
 		mul_m4_v3(mat, vec);
 		
-		cent2 = BM_vert_create(bm, vec, NULL);
+		cent2 = BM_vert_create(bm, vec, NULL, 0);
 
 		BMO_elem_flag_enable(bm, cent1, VERT_MARK);
 		BMO_elem_flag_enable(bm, cent2, VERT_MARK);
@@ -612,13 +619,13 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
 		vec[1] = dia1 * cosf(phi);
 		vec[2] = -depth;
 		mul_m4_v3(mat, vec);
-		v1 = BM_vert_create(bm, vec, NULL);
+		v1 = BM_vert_create(bm, vec, NULL, 0);
 
 		vec[0] = dia2 * sinf(phi);
 		vec[1] = dia2 * cosf(phi);
 		vec[2] = depth;
 		mul_m4_v3(mat, vec);
-		v2 = BM_vert_create(bm, vec, NULL);
+		v2 = BM_vert_create(bm, vec, NULL, 0);
 
 		BMO_elem_flag_enable(bm, v1, VERT_MARK);
 		BMO_elem_flag_enable(bm, v2, VERT_MARK);
@@ -662,15 +669,15 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
 	BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
 
 	BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
 
 void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
 {
 	BMVert *v1, *v2, *v3, *v4, *v5, *v6, *v7, *v8;
-	float vec[3], mat[4][4], off = BMO_slot_float_get(op, "size") / 2.0f;
+	float vec[3], mat[4][4], off = BMO_slot_float_get(op->slots_in, "size") / 2.0f;
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
 	if (!off) off = 0.5f;
 
@@ -678,56 +685,56 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
 	vec[1] = -off;
 	vec[2] = -off;
 	mul_m4_v3(mat, vec);
-	v1 = BM_vert_create(bm, vec, NULL);
+	v1 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v1, VERT_MARK);
 
 	vec[0] = -off;
 	vec[1] = off;
 	vec[2] = -off;
 	mul_m4_v3(mat, vec);
-	v2 = BM_vert_create(bm, vec, NULL);
+	v2 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v2, VERT_MARK);
 
 	vec[0] = off;
 	vec[1] = off;
 	vec[2] = -off;
 	mul_m4_v3(mat, vec);
-	v3 = BM_vert_create(bm, vec, NULL);
+	v3 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v3, VERT_MARK);
 
 	vec[0] = off;
 	vec[1] = -off;
 	vec[2] = -off;
 	mul_m4_v3(mat, vec);
-	v4 = BM_vert_create(bm, vec, NULL);
+	v4 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v4, VERT_MARK);
 
 	vec[0] = -off;
 	vec[1] = -off;
 	vec[2] = off;
 	mul_m4_v3(mat, vec);
-	v5 = BM_vert_create(bm, vec, NULL);
+	v5 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v5, VERT_MARK);
 
 	vec[0] = -off;
 	vec[1] = off;
 	vec[2] = off;
 	mul_m4_v3(mat, vec);
-	v6 = BM_vert_create(bm, vec, NULL);
+	v6 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v6, VERT_MARK);
 
 	vec[0] = off;
 	vec[1] = off;
 	vec[2] = off;
 	mul_m4_v3(mat, vec);
-	v7 = BM_vert_create(bm, vec, NULL);
+	v7 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v7, VERT_MARK);
 
 	vec[0] = off;
 	vec[1] = -off;
 	vec[2] = off;
 	mul_m4_v3(mat, vec);
-	v8 = BM_vert_create(bm, vec, NULL);
+	v8 = BM_vert_create(bm, vec, NULL, 0);
 	BMO_elem_flag_enable(bm, v8, VERT_MARK);
 
 	/* the four sides */
@@ -740,5 +747,5 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
 	BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
 	BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index d3e98dd..87e26f1 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -36,7 +36,7 @@
 
 #include "intern/bmesh_operators_private.h" /* own include */
 
-static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
+static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot *slot_targetmap)
 {
 	BMIter liter;
 	BMLoop *l;
@@ -44,7 +44,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
 	int split = FALSE;
 
 	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
-		v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", l->v);
+		v2 = BMO_slot_map_elem_get(slot_targetmap, l->v);
 		/* ok: if v2 is NULL (e.g. not in the map) then it's
 		 *     a target vert, otherwise it's a double */
 		if ((v2 && BM_vert_in_face(f, v2)) &&
@@ -61,8 +61,8 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
 		BMLoop *nl;
 		BMFace *f2 = BM_face_split(bm, f, doub, v2, &nl, NULL, FALSE);
 
-		remdoubles_splitface(f, bm, op);
-		remdoubles_splitface(f2, bm, op);
+		remdoubles_splitface(f, bm, op, slot_targetmap);
+		remdoubles_splitface(f2, bm, op, slot_targetmap);
 	}
 }
 
@@ -106,10 +106,11 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(loops);
 	BMFace *f, *f2;
 	int a, b;
+	BMOpSlot *slot_targetmap = BMO_slot_get(op->slots_in, "targetmap");
 
 	/* mark merge verts for deletion */
 	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-		if ((v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v))) {
+		if ((v2 = BMO_slot_map_elem_get(slot_targetmap, v))) {
 			BMO_elem_flag_enable(bm, v, ELE_DEL);
 
 			/* merge the vertex flags, else we get randomly selected/unselected verts */
@@ -120,13 +121,13 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
 	/* check if any faces are getting their own corners merged
 	 * together, split face if so */
 	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
-		remdoubles_splitface(f, bm, op);
+		remdoubles_splitface(f, bm, op, slot_targetmap);
 	}
 
 	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 		if (BMO_elem_flag_test(bm, e->v1, ELE_DEL) || BMO_elem_flag_test(bm, e->v2, ELE_DEL)) {
-			v = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v1);
-			v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v2);
+			v  = BMO_slot_map_elem_get(slot_targetmap, e->v1);
+			v2 = BMO_slot_map_elem_get(slot_targetmap, e->v2);
 			
 			if (!v) v = e->v1;
 			if (!v2) v2 = e->v2;
@@ -135,7 +136,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
 				BMO_elem_flag_enable(bm, e, EDGE_COL);
 			}
 			else if (!BM_edge_exists(v, v2)) {
-				BM_edge_create(bm, v, v2, e, TRUE);
+				BM_edge_create(bm, v, v2, e, BM_CREATE_NO_DOUBLE);
 			}
 
 			BMO_elem_flag_enable(bm, e, ELE_DEL);
@@ -174,10 +175,10 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
 			v = l->v;
 			v2 = l->next->v;
 			if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
-				v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
+				v = BMO_slot_map_elem_get(slot_targetmap, v);
 			}
 			if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
-				v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+				v2 = BMO_slot_map_elem_get(slot_targetmap, v2);
 			}
 			
 			e2 = v != v2 ? BM_edge_exists(v, v2) : NULL;
@@ -207,13 +208,13 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
 		v2 = loops[1]->v;
 
 		if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
-			v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
+			v = BMO_slot_map_elem_get(slot_targetmap, v);
 		}
 		if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
-			v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+			v2 = BMO_slot_map_elem_get(slot_targetmap, v2);
 		}
 		
-		f2 = BM_face_create_ngon(bm, v, v2, edges, a, TRUE);
+		f2 = BM_face_create_ngon(bm, v, v2, edges, a, BM_CREATE_NO_DOUBLE);
 		if (f2 && (f2 != f)) {
 			BM_elem_attrs_copy(bm, bm, f, f2);
 
@@ -257,19 +258,19 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
 	BMIter iter;
-	BMVert *v, *snapv;
+	BMVert *v, *vert_snap;
 	BMLoop *l, *firstl = NULL;
 	float fac;
 	int i, tot;
 
-	snapv = BMO_iter_new(&siter, bm, op, "snapv", BM_VERT);
-	tot = BM_vert_face_count(snapv);
+	vert_snap = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_snap"));
+	tot = BM_vert_face_count(vert_snap);
 
 	if (!tot)
 		return;
 
 	fac = 1.0f / tot;
-	BM_ITER_ELEM (l, &iter, snapv, BM_LOOPS_OF_VERT) {
+	BM_ITER_ELEM (l, &iter, vert_snap, BM_LOOPS_OF_VERT) {
 		if (!firstl) {
 			firstl = l;
 		}
@@ -290,7 +291,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
 		BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
 			if (l == firstl) {
 				continue;
@@ -318,7 +319,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
 		type = bm->ldata.layers[i].type;
 		CustomData_data_initminmax(type, &min, &max);
 
-		BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
 			BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
 				block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
 				CustomData_data_dominmax(type, block, &min, &max);
@@ -329,7 +330,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
 		CustomData_data_multiply(type, &max, 0.5f);
 		CustomData_data_add(type, &min, &max);
 
-		BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
 			BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
 				block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
 				CustomData_data_copy_value(type, &min, block);
@@ -342,21 +343,24 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
 {
 	BMOperator weldop;
 	BMOIter siter;
-	BMVert *v, *snapv = NULL;
+	BMVert *v, *vert_snap = NULL;
 	float vec[3];
+	BMOpSlot *slot_targetmap;
 	
-	BMO_slot_vec_get(op, "merge_co", vec);
+	BMO_slot_vec_get(op->slots_in, "merge_co", vec);
 
 	//BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
 	BMO_op_init(bm, &weldop, op->flag, "weld_verts");
-	
-	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
-		if (!snapv) {
-			snapv = v;
-			copy_v3_v3(snapv->co, vec);
+
+	slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
+		if (!vert_snap) {
+			vert_snap = v;
+			copy_v3_v3(vert_snap->co, vec);
 		}
 		else {
-			BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", v, snapv);
+			BMO_slot_map_elem_insert(&weldop, slot_targetmap, v, vert_snap);
 		}
 	}
 
@@ -371,13 +375,15 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
 	BMIter iter;
 	BMEdge *e, **edges = NULL;
 	BLI_array_declare(edges);
-	float min[3], max[3];
+	float min[3], max[3], center[3];
 	int i, tot;
+	BMOpSlot *slot_targetmap;
 	
 	BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
 	BMO_op_init(bm, &weldop, op->flag, "weld_verts");
+	slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
 
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
 
 	BMW_init(&walker, bm, BMW_SHELL,
 	         BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
@@ -400,18 +406,17 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
 			minmax_v3v3_v3(min, max, e->v2->co);
 		}
 
-		add_v3_v3v3(min, min, max);
-		mul_v3_fl(min, 0.5f);
+		mid_v3_v3v3(center, min, max);
 
 		/* snap edges to a point.  for initial testing purposes anyway */
 		for (i = 0; i < tot; i++) {
-			copy_v3_v3(edges[i]->v1->co, min);
-			copy_v3_v3(edges[i]->v2->co, min);
+			copy_v3_v3(edges[i]->v1->co, center);
+			copy_v3_v3(edges[i]->v2->co, center);
 			
 			if (edges[i]->v1 != edges[0]->v1)
-				BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);
+				BMO_slot_map_elem_insert(&weldop, slot_targetmap, edges[i]->v1, edges[0]->v1);
 			if (edges[i]->v2 != edges[0]->v1)
-				BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v2, edges[0]->v1);
+				BMO_slot_map_elem_insert(&weldop, slot_targetmap, edges[i]->v2, edges[0]->v1);
 		}
 	}
 	
@@ -437,7 +442,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
 	/* clear all short flags */
 	BMO_mesh_flag_disable_all(bm, op, BM_ALL, (1 << 16) - 1);
 
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
 
 	BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
 	         BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
@@ -487,82 +492,85 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
 	}
 }
 
-static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname)
+static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
+                                      BMOperator *optarget, BMOpSlot *optarget_slot)
 {
-	BMOIter oiter;
-	BMVert *v, *v2;
-	BMVert **verts = NULL;
-	BLI_array_declare(verts);
-	float dist, dist3;
-	int i, j, len, keepvert = 0;
-
-	dist = BMO_slot_float_get(op, "dist");
-	dist3 = dist * 3.0f;
-
-	i = 0;
-	BMO_ITER (v, &oiter, bm, op, "verts", BM_VERT) {
-		BLI_array_grow_one(verts);
-		verts[i++] = v;
-	}
+	BMVert  **verts;
+	int       verts_len;
+
+	int i, j, keepvert = 0;
+
+	const float dist  = BMO_slot_float_get(op->slots_in, "dist");
+	const float dist3 = dist * 3.0f;
 
 	/* Test whether keep_verts arg exists and is non-empty */
-	if (BMO_slot_exists(op, "keep_verts")) {
-		keepvert = BMO_iter_new(&oiter, bm, op, "keep_verts", BM_VERT) != NULL;
+	if (BMO_slot_exists(op->slots_in, "keep_verts")) {
+		BMOIter oiter;
+		keepvert = BMO_iter_new(&oiter, op->slots_in, "keep_verts", BM_VERT) != NULL;
 	}
 
+	/* get the verts as an array we can sort */
+	verts = BMO_slot_as_arrayN(op->slots_in, "verts", &verts_len);
+
 	/* sort by vertex coordinates added together */
-	qsort(verts, BLI_array_count(verts), sizeof(void *), vergaverco);
+	qsort(verts, verts_len, sizeof(BMVert *), vergaverco);
 
 	/* Flag keep_verts */
 	if (keepvert) {
-		BMO_slot_buffer_flag_enable(bm, op, "keep_verts", BM_VERT, VERT_KEEP);
+		BMO_slot_buffer_flag_enable(bm, op->slots_in, "keep_verts", BM_VERT, VERT_KEEP);
 	}
 
-	len = BLI_array_count(verts);
-	for (i = 0; i < len; i++) {
-		v = verts[i];
-		if (BMO_elem_flag_test(bm, v, VERT_DOUBLE)) {
+	for (i = 0; i < verts_len; i++) {
+		BMVert *v_check = verts[i];
+
+		if (BMO_elem_flag_test(bm, v_check, VERT_DOUBLE)) {
 			continue;
 		}
 
-		for (j = i + 1; j < len; j++) {
-			v2 = verts[j];
+		for (j = i + 1; j < verts_len; j++) {
+			BMVert *v_other = verts[j];
 
 			/* Compare sort values of the verts using 3x tolerance (allowing for the tolerance
 			 * on each of the three axes). This avoids the more expensive length comparison
 			 * for most vertex pairs. */
-			if ((v2->co[0] + v2->co[1] + v2->co[2]) - (v->co[0] + v->co[1] + v->co[2]) > dist3)
+			if ((v_other->co[0] + v_other->co[1] + v_other->co[2]) -
+			    (v_check->co[0] + v_check->co[1] + v_check->co[2]) > dist3)
+			{
 				break;
+			}
 
 			if (keepvert) {
-				if (BMO_elem_flag_test(bm, v2, VERT_KEEP) == BMO_elem_flag_test(bm, v, VERT_KEEP))
+				if (BMO_elem_flag_test(bm, v_other, VERT_KEEP) == BMO_elem_flag_test(bm, v_check, VERT_KEEP))
 					continue;
 			}
 
-			if (compare_len_v3v3(v->co, v2->co, dist)) {
+			if (compare_len_v3v3(v_check->co, v_other->co, dist)) {
 
 				/* If one vert is marked as keep, make sure it will be the target */
-				if (BMO_elem_flag_test(bm, v2, VERT_KEEP)) {
-					SWAP(BMVert *, v, v2);
+				if (BMO_elem_flag_test(bm, v_other, VERT_KEEP)) {
+					SWAP(BMVert *, v_check, v_other);
 				}
 
-				BMO_elem_flag_enable(bm, v2, VERT_DOUBLE);
-				BMO_elem_flag_enable(bm, v, VERT_TARGET);
+				BMO_elem_flag_enable(bm, v_other, VERT_DOUBLE);
+				BMO_elem_flag_enable(bm, v_check, VERT_TARGET);
 
-				BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v2, v);
+				BMO_slot_map_elem_insert(optarget, optarget_slot, v_other, v_check);
 			}
 		}
 	}
 
-	BLI_array_free(verts);
+	MEM_freeN(verts);
 }
 
 void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
 {
 	BMOperator weldop;
+	BMOpSlot *slot_targetmap;
 
 	BMO_op_init(bm, &weldop, op->flag, "weld_verts");
-	bmesh_find_doubles_common(bm, op, &weldop, "targetmap");
+	slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+	bmesh_find_doubles_common(bm, op,
+	                          &weldop, slot_targetmap);
 	BMO_op_exec(bm, &weldop);
 	BMO_op_finish(bm, &weldop);
 }
@@ -570,7 +578,10 @@ void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
 
 void bmo_find_doubles_exec(BMesh *bm, BMOperator *op)
 {
-	bmesh_find_doubles_common(bm, op, op, "targetmapout");
+	BMOpSlot *slot_targetmap_out;
+	slot_targetmap_out = BMO_slot_get(op->slots_out, "targetmap.out");
+	bmesh_find_doubles_common(bm, op,
+	                          op, slot_targetmap_out);
 }
 
 void bmo_automerge_exec(BMesh *bm, BMOperator *op)
@@ -582,7 +593,7 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
 	/* The "verts" input sent to this op is the set of verts that
 	 * can be merged away into any other verts. Mark all other verts
 	 * as VERT_KEEP. */
-	BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_IN);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_IN);
 	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
 		if (!BMO_elem_flag_test(bm, v, VERT_IN)) {
 			BMO_elem_flag_enable(bm, v, VERT_KEEP);
@@ -592,12 +603,14 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
 	/* Search for doubles among all vertices, but only merge non-VERT_KEEP
 	 * vertices into VERT_KEEP vertices. */
 	BMO_op_initf(bm, &findop, op->flag, "find_doubles verts=%av keep_verts=%fv", VERT_KEEP);
-	BMO_slot_copy(op, &findop, "dist", "dist");
+	BMO_slot_copy(op,      slots_in, "dist",
+	              &findop, slots_in, "dist");
 	BMO_op_exec(bm, &findop);
 
 	/* weld the vertices */
 	BMO_op_init(bm, &weldop, op->flag, "weld_verts");
-	BMO_slot_copy(&findop, &weldop, "targetmapout", "targetmap");
+	BMO_slot_copy(&findop, slots_out, "targetmap.out",
+	              &weldop, slots_in,  "targetmap");
 	BMO_op_exec(bm, &weldop);
 
 	BMO_op_finish(bm, &findop);
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
new file mode 100644
index 0000000..548e1ad
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -0,0 +1,614 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Joseph Eagar, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_similar.c
+ *  \ingroup bmesh
+ *
+ * bmesh operators to select based on
+ * comparisons with the existing selection.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BLI_math.h"
+
+#include "BKE_customdata.h"
+#include "BKE_deform.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h"  /* own include */
+
+/* in fact these could all be the same */
+
+/*
+ * extra face data (computed data)
+ */
+typedef struct SimSel_FaceExt {
+	BMFace  *f;             /* the face */
+	float    c[3];          /* center */
+	union {
+		float   area;       /* area */
+		float   perim;      /* perimeter */
+		float   d;          /* 4th component of plane (the first three being the normal) */
+		struct Image *t;    /* image pointer */
+	};
+} SimSel_FaceExt;
+
+static int bm_sel_similar_cmp_fl(const float delta, const float thresh, const int compare)
+{
+	switch (compare) {
+		case SIM_CMP_EQ:
+			return (fabsf(delta) <= thresh);
+		case SIM_CMP_GT:
+			return ((delta + thresh) >= 0.0f);
+		case SIM_CMP_LT:
+			return ((delta - thresh) <= 0.0f);
+		default:
+			BLI_assert(0);
+			return 0;
+	}
+}
+
+static int bm_sel_similar_cmp_i(const int delta, const int compare)
+{
+	switch (compare) {
+		case SIM_CMP_EQ:
+			return (delta == 0);
+		case SIM_CMP_GT:
+			return (delta > 0);
+		case SIM_CMP_LT:
+			return (delta < 0);
+		default:
+			BLI_assert(0);
+			return 0;
+	}
+}
+
+/*
+ * Select similar faces, the choices are in the enum in source/blender/bmesh/bmesh_operators.h
+ * We select either similar faces based on material, image, area, perimeter, normal, or the coplanar faces
+ */
+void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
+{
+#define FACE_MARK	1
+
+	BMIter fm_iter;
+	BMFace *fs, *fm;
+	BMOIter fs_iter;
+	int num_sels = 0, num_total = 0, i = 0, idx = 0;
+	float angle = 0.0f;
+	SimSel_FaceExt *f_ext = NULL;
+	int *indices = NULL;
+	float t_no[3];	/* temporary normal */
+	const int type = BMO_slot_int_get(op->slots_in, "type");
+	const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
+	const float thresh_radians = thresh * (float)M_PI;
+	const int compare = BMO_slot_int_get(op->slots_in, "compare");
+
+	/* initial_elem - other_elem */
+	float delta_fl;
+	int   delta_i;
+
+	num_total = BM_mesh_elem_count(bm, BM_FACE);
+
+	/*
+	 * The first thing to do is to iterate through all the the selected items and mark them since
+	 * they will be in the selection anyway.
+	 * This will increase performance, (especially when the number of originally selected faces is high)
+	 * so the overall complexity will be less than $O(mn)$ where is the total number of selected faces,
+	 * and n is the total number of faces
+	 */
+	BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
+		if (!BMO_elem_flag_test(bm, fs, FACE_MARK)) {	/* is this really needed ? */
+			BMO_elem_flag_enable(bm, fs, FACE_MARK);
+			num_sels++;
+		}
+	}
+
+	/* allocate memory for the selected faces indices and for all temporary faces */
+	indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
+	f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c");
+
+	/* loop through all the faces and fill the faces/indices structure */
+	BM_ITER_MESH (fm, &fm_iter, bm, BM_FACES_OF_MESH) {
+		f_ext[i].f = fm;
+		if (BMO_elem_flag_test(bm, fm, FACE_MARK)) {
+			indices[idx] = i;
+			idx++;
+		}
+		i++;
+	}
+
+	/*
+	 * Save us some computation burden: In case of perimeter/area/coplanar selection we compute
+	 * only once.
+	 */
+	if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE) {
+		for (i = 0; i < num_total; i++) {
+			switch (type) {
+				case SIMFACE_PERIMETER:
+					/* set the perimeter */
+					f_ext[i].perim = BM_face_calc_perimeter(f_ext[i].f);
+					break;
+
+				case SIMFACE_COPLANAR:
+					/* compute the center of the polygon */
+					BM_face_calc_center_mean(f_ext[i].f, f_ext[i].c);
+
+					/* normalize the polygon normal */
+					copy_v3_v3(t_no, f_ext[i].f->no);
+					normalize_v3(t_no);
+
+					/* compute the plane distance */
+					f_ext[i].d = dot_v3v3(t_no, f_ext[i].c);
+					break;
+
+				case SIMFACE_AREA:
+					f_ext[i].area = BM_face_calc_area(f_ext[i].f);
+					break;
+
+				case SIMFACE_IMAGE:
+					f_ext[i].t = NULL;
+					if (CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY)) {
+						MTexPoly *mtpoly = CustomData_bmesh_get(&bm->pdata, f_ext[i].f->head.data, CD_MTEXPOLY);
+						f_ext[i].t = mtpoly->tpage;
+					}
+					break;
+			}
+		}
+	}
+
+	/* now select the rest (if any) */
+	for (i = 0; i < num_total; i++) {
+		fm = f_ext[i].f;
+		if (!BMO_elem_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) {
+			int cont = TRUE;
+			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+				fs = f_ext[indices[idx]].f;
+				switch (type) {
+					case SIMFACE_MATERIAL:
+						if (fm->mat_nr == fs->mat_nr) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_IMAGE:
+						if (f_ext[i].t == f_ext[indices[idx]].t) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_NORMAL:
+						angle = angle_normalized_v3v3(fs->no, fm->no);	/* if the angle between the normals -> 0 */
+						if (angle <= thresh_radians) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_COPLANAR:
+						angle = angle_normalized_v3v3(fs->no, fm->no); /* angle -> 0 */
+						if (angle <= thresh_radians) { /* and dot product difference -> 0 */
+							delta_fl = f_ext[i].d - f_ext[indices[idx]].d;
+							if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+								BMO_elem_flag_enable(bm, fm, FACE_MARK);
+								cont = FALSE;
+							}
+						}
+						break;
+
+					case SIMFACE_AREA:
+						delta_fl = f_ext[i].area - f_ext[indices[idx]].area;
+						if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_SIDES:
+						delta_i = fm->len - fs->len;
+						if (bm_sel_similar_cmp_i(delta_i, compare)) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_PERIMETER:
+						delta_fl = f_ext[i].perim - f_ext[indices[idx]].perim;
+						if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+					default:
+						BLI_assert(0);
+				}
+			}
+		}
+	}
+
+	MEM_freeN(f_ext);
+	MEM_freeN(indices);
+
+	/* transfer all marked faces to the output slot */
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_MARK);
+#undef FACE_MARK
+}
+
+/**************************************************************************** *
+ * Similar Edges
+ **************************************************************************** */
+
+/*
+ * extra edge information
+ */
+typedef struct SimSel_EdgeExt {
+	BMEdge *e;
+	union {
+		float dir[3];
+		float angle;            /* angle between the face */
+	};
+
+	union {
+		float length;           /* edge length */
+		int   faces;            /* faces count */
+	};
+} SimSel_EdgeExt;
+
+/*
+ * select similar edges: the choices are in the enum in source/blender/bmesh/bmesh_operators.h
+ * choices are length, direction, face, ...
+ */
+void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
+{
+#define EDGE_MARK	1
+
+	BMOIter es_iter;	/* selected edges iterator */
+	BMIter e_iter;		/* mesh edges iterator */
+	BMEdge *es;		/* selected edge */
+	BMEdge *e;		/* mesh edge */
+	int idx = 0, i = 0 /* , f = 0 */;
+	int *indices = NULL;
+	SimSel_EdgeExt *e_ext = NULL;
+	// float *angles = NULL;
+	float angle;
+
+	int num_sels = 0, num_total = 0;
+	const int type = BMO_slot_int_get(op->slots_in, "type");
+	const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
+	const int compare = BMO_slot_int_get(op->slots_in, "compare");
+
+	/* initial_elem - other_elem */
+	float delta_fl;
+	int   delta_i;
+
+	/* sanity checks that the data we need is available */
+	switch (type) {
+		case SIMEDGE_CREASE:
+			if (!CustomData_has_layer(&bm->edata, CD_CREASE)) {
+				return;
+			}
+			break;
+		case SIMEDGE_BEVEL:
+			if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) {
+				return;
+			}
+			break;
+	}
+
+	num_total = BM_mesh_elem_count(bm, BM_EDGE);
+
+	/* iterate through all selected edges and mark them */
+	BMO_ITER (es, &es_iter, op->slots_in, "edges", BM_EDGE) {
+		BMO_elem_flag_enable(bm, es, EDGE_MARK);
+		num_sels++;
+	}
+
+	/* allocate memory for the selected edges indices and for all temporary edges */
+	indices = (int *)MEM_callocN(sizeof(int) * num_sels, __func__);
+	e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, __func__);
+
+	/* loop through all the edges and fill the edges/indices structure */
+	BM_ITER_MESH (e, &e_iter, bm, BM_EDGES_OF_MESH) {
+		e_ext[i].e = e;
+		if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			indices[idx] = i;
+			idx++;
+		}
+		i++;
+	}
+
+	/* save us some computation time by doing heavy computation once */
+	if (type == SIMEDGE_LENGTH || type == SIMEDGE_FACE || type == SIMEDGE_DIR || type == SIMEDGE_FACE_ANGLE) {
+		for (i = 0; i < num_total; i++) {
+			switch (type) {
+				case SIMEDGE_LENGTH:	/* compute the length of the edge */
+					e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
+					break;
+
+				case SIMEDGE_DIR:		/* compute the direction */
+					sub_v3_v3v3(e_ext[i].dir, e_ext[i].e->v1->co, e_ext[i].e->v2->co);
+					normalize_v3(e_ext[i].dir);
+					break;
+
+				case SIMEDGE_FACE:		/* count the faces around the edge */
+					e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
+					break;
+
+				case SIMEDGE_FACE_ANGLE:
+					e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
+					if (e_ext[i].faces == 2)
+						e_ext[i].angle = BM_edge_calc_face_angle(e_ext[i].e);
+					break;
+			}
+		}
+	}
+
+	/* select the edges if any */
+	for (i = 0; i < num_total; i++) {
+		e = e_ext[i].e;
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+			int cont = TRUE;
+			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+				es = e_ext[indices[idx]].e;
+				switch (type) {
+					case SIMEDGE_LENGTH:
+						delta_fl = e_ext[i].length - e_ext[indices[idx]].length;
+						if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+							BMO_elem_flag_enable(bm, e, EDGE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMEDGE_DIR:
+						/* compute the angle between the two edges */
+						angle = angle_normalized_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir);
+
+						if (angle > (float)(M_PI / 2.0)) /* use the smallest angle between the edges */
+							angle = fabsf(angle - (float)M_PI);
+
+						if (angle / (float)(M_PI / 2.0) <= thresh) {
+							BMO_elem_flag_enable(bm, e, EDGE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMEDGE_FACE:
+						delta_i = e_ext[i].faces - e_ext[indices[idx]].faces;
+						if (bm_sel_similar_cmp_i(delta_i, compare)) {
+							BMO_elem_flag_enable(bm, e, EDGE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMEDGE_FACE_ANGLE:
+						if (e_ext[i].faces == 2) {
+							if (e_ext[indices[idx]].faces == 2) {
+								if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
+									BMO_elem_flag_enable(bm, e, EDGE_MARK);
+									cont = FALSE;
+								}
+							}
+						}
+						else {
+							cont = FALSE;
+						}
+						break;
+
+					case SIMEDGE_CREASE:
+						{
+							float *c1, *c2;
+
+							c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
+							c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
+							delta_fl = *c1 - *c2;
+
+							if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+								BMO_elem_flag_enable(bm, e, EDGE_MARK);
+								cont = FALSE;
+							}
+						}
+						break;
+
+					case SIMEDGE_BEVEL:
+						{
+							float *c1, *c2;
+
+							c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BWEIGHT);
+							c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_BWEIGHT);
+							delta_fl = *c1 - *c2;
+
+							if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
+								BMO_elem_flag_enable(bm, e, EDGE_MARK);
+								cont = FALSE;
+							}
+						}
+						break;
+
+					case SIMEDGE_SEAM:
+						if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) {
+							BMO_elem_flag_enable(bm, e, EDGE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMEDGE_SHARP:
+						if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) {
+							BMO_elem_flag_enable(bm, e, EDGE_MARK);
+							cont = FALSE;
+						}
+						break;
+					default:
+						BLI_assert(0);
+				}
+			}
+		}
+	}
+
+	MEM_freeN(e_ext);
+	MEM_freeN(indices);
+
+	/* transfer all marked edges to the output slot */
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_MARK);
+
+#undef EDGE_MARK
+}
+
+/**************************************************************************** *
+ * Similar Vertices
+ **************************************************************************** */
+
+typedef struct SimSel_VertExt {
+	BMVert *v;
+	union {
+		int num_faces; /* adjacent faces */
+		int num_edges; /* adjacent edges */
+		MDeformVert *dvert; /* deform vertex */
+	};
+} SimSel_VertExt;
+
+/*
+ * select similar vertices: the choices are in the enum in source/blender/bmesh/bmesh_operators.h
+ * choices are normal, face, vertex group...
+ */
+void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
+{
+#define VERT_MARK	1
+
+	BMOIter vs_iter;	/* selected verts iterator */
+	BMIter v_iter;		/* mesh verts iterator */
+	BMVert *vs;		/* selected vertex */
+	BMVert *v;			/* mesh vertex */
+	SimSel_VertExt *v_ext = NULL;
+	int *indices = NULL;
+	int num_total = 0, num_sels = 0, i = 0, idx = 0;
+	const int type = BMO_slot_int_get(op->slots_in, "type");
+	const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
+	const float thresh_radians = thresh * (float)M_PI;
+	const int compare = BMO_slot_int_get(op->slots_in, "compare");
+
+	/* initial_elem - other_elem */
+//	float delta_fl;
+	int   delta_i;
+
+	num_total = BM_mesh_elem_count(bm, BM_VERT);
+
+	/* iterate through all selected edges and mark them */
+	BMO_ITER (vs, &vs_iter, op->slots_in, "verts", BM_VERT) {
+		BMO_elem_flag_enable(bm, vs, VERT_MARK);
+		num_sels++;
+	}
+
+	/* allocate memory for the selected vertices indices and for all temporary vertices */
+	indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
+	v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra");
+
+	/* loop through all the vertices and fill the vertices/indices structure */
+	BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) {
+		v_ext[i].v = v;
+		if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
+			indices[idx] = i;
+			idx++;
+		}
+
+		switch (type) {
+			case SIMVERT_FACE:
+				/* calling BM_vert_face_count every time is time consumming, so call it only once per vertex */
+				v_ext[i].num_faces = BM_vert_face_count(v);
+				break;
+
+			case SIMVERT_VGROUP:
+				if (CustomData_has_layer(&(bm->vdata), CD_MDEFORMVERT)) {
+					v_ext[i].dvert = CustomData_bmesh_get(&bm->vdata, v_ext[i].v->head.data, CD_MDEFORMVERT);
+				}
+				else {
+					v_ext[i].dvert = NULL;
+				}
+				break;
+			case SIMVERT_EDGE:
+				v_ext[i].num_edges = BM_vert_edge_count(v);
+				break;
+		}
+
+		i++;
+	}
+
+	/* select the vertices if any */
+	for (i = 0; i < num_total; i++) {
+		v = v_ext[i].v;
+		if (!BMO_elem_flag_test(bm, v, VERT_MARK) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
+			int cont = TRUE;
+			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+				vs = v_ext[indices[idx]].v;
+				switch (type) {
+					case SIMVERT_NORMAL:
+						/* compare the angle between the normals */
+						if (angle_normalized_v3v3(v->no, vs->no) <= thresh_radians) {
+							BMO_elem_flag_enable(bm, v, VERT_MARK);
+							cont = FALSE;
+						}
+						break;
+					case SIMVERT_FACE:
+						/* number of adjacent faces */
+						delta_i = v_ext[i].num_faces - v_ext[indices[idx]].num_faces;
+						if (bm_sel_similar_cmp_i(delta_i, compare)) {
+							BMO_elem_flag_enable(bm, v, VERT_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMVERT_VGROUP:
+						if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
+							if (defvert_find_shared(v_ext[i].dvert, v_ext[indices[idx]].dvert) != -1) {
+								BMO_elem_flag_enable(bm, v, VERT_MARK);
+								cont = FALSE;
+							}
+						}
+						break;
+					case SIMVERT_EDGE:
+						/* number of adjacent edges */
+						delta_i = v_ext[i].num_edges - v_ext[indices[idx]].num_edges;
+						if (bm_sel_similar_cmp_i(delta_i, compare)) {
+							BMO_elem_flag_enable(bm, v, VERT_MARK);
+							cont = FALSE;
+						}
+						break;
+					default:
+						BLI_assert(0);
+				}
+			}
+		}
+	}
+
+	MEM_freeN(indices);
+	MEM_freeN(v_ext);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
+
+#undef VERT_MARK
+}
diff --git a/source/blender/bmesh/operators/bmo_slide.c b/source/blender/bmesh/operators/bmo_slide.c
index 0036f09..ea9f9bf 100644
--- a/source/blender/bmesh/operators/bmo_slide.c
+++ b/source/blender/bmesh/operators/bmo_slide.c
@@ -53,29 +53,26 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
 	int selected_edges = 0;
 
 	/* Get slide amount */
-	const float distance_t = BMO_slot_float_get(op, "distance_t");
+	const float factor = BMO_slot_float_get(op->slots_in, "factor");
 
 	/* Get start vertex */
-	vertex = BMO_iter_new(&oiter, bm, op, "vert", BM_VERT);
-
+	vertex = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert"));
 
 	if (!vertex) {
 		if (G.debug & G_DEBUG) {
 			fprintf(stderr, "slide_vert: No vertex selected...");
 		}
-		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
+		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide error: invalid selection");
 		return;
 	}
 
+	/* BMESH_TODO - this is odd, it only uses one edge, why take a list at all? */
 	/* Count selected edges */
-	BMO_ITER (h, &oiter, bm, op, "edge", BM_VERT | BM_EDGE) {
-		switch (h->htype) {
-			case BM_EDGE:
-				selected_edges++;
-				/* Mark all selected edges (cast BMHeader->BMEdge) */
-				BMO_elem_flag_enable(bm, (BMElemF *)h, EDGE_MARK);
-				break;
-		}
+	BMO_ITER (h, &oiter, op->slots_in, "edges", BM_EDGE) {
+		selected_edges++;
+		/* Mark all selected edges (cast BMHeader->BMEdge) */
+		BMO_elem_flag_enable(bm, (BMElemF *)h, EDGE_MARK);
+		break;
 	}
 
 	/* Only allow sliding if an edge is selected */
@@ -83,7 +80,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
 		if (G.debug & G_DEBUG) {
 			fprintf(stderr, "slide_vert: select a single edge\n");
 		}
-		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
+		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide error: invalid selection");
 		return;
 	}
 
@@ -104,11 +101,11 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
 		BMO_elem_flag_enable(bm, vertex, VERT_MARK);
 
 		/* Interpolate */
-		interp_v3_v3v3(vertex->co, vertex->co, other->co, distance_t);
+		interp_v3_v3v3(vertex->co, vertex->co, other->co, factor);
 	}
 
 	/* Return the new edge. The same previously marked with VERT_MARK */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 	return;
 }
 
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
new file mode 100644
index 0000000..4a367a8
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -0,0 +1,620 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Alexander Pinzon
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_smooth_laplacian.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_array.h"
+#include "BLI_heap.h"
+#include "BLI_math.h"
+#include "BLI_math_geom.h"
+#include "BLI_smallhash.h"
+
+#include "BKE_customdata.h"
+#include "BKE_mesh.h"
+
+#include "bmesh.h"
+
+#include "ONL_opennl.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+// #define SMOOTH_LAPLACIAN_AREA_FACTOR 4.0f  /* UNUSED */
+// #define SMOOTH_LAPLACIAN_EDGE_FACTOR 2.0f  /* UNUSED */
+#define SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE 1.8f
+#define SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE 0.15f
+
+struct BLaplacianSystem {
+	float *eweights;        /* Length weights per Edge */
+	float (*fweights)[3];   /* Cotangent weights per face */
+	float *ring_areas;      /* Total area per ring*/
+	float *vlengths;        /* Total sum of lengths(edges) per vertice*/
+	float *vweights;        /* Total sum of weights per vertice*/
+	int numEdges;           /* Number of edges*/
+	int numFaces;           /* Number of faces*/
+	int numVerts;           /* Number of verts*/
+	short *zerola;          /* Is zero area or length*/
+
+	/* Pointers to data*/
+	BMesh *bm;
+	BMOperator *op;
+	NLContext *context;
+
+	/*Data*/
+	float min_area;
+};
+typedef struct BLaplacianSystem LaplacianSystem;
+
+static float compute_volume(BMesh *bm);
+static float cotan_weight(float *v1, float *v2, float *v3);
+static int vert_is_boundary(BMVert *v);
+static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts);
+static void init_laplacian_matrix(LaplacianSystem *sys);
+static void delete_laplacian_system(LaplacianSystem *sys);
+static void delete_void_pointer(void *data);
+static void fill_laplacian_matrix(LaplacianSystem *sys);
+static void memset_laplacian_system(LaplacianSystem *sys, int val);
+static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int preserve_volume);
+static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez);
+
+static void delete_void_pointer(void *data)
+{
+	if (data) {
+		MEM_freeN(data);
+		data = NULL;
+	}
+}
+
+static void delete_laplacian_system(LaplacianSystem *sys)
+{
+	delete_void_pointer(sys->eweights);
+	delete_void_pointer(sys->fweights);
+	delete_void_pointer(sys->ring_areas);
+	delete_void_pointer(sys->vlengths);
+	delete_void_pointer(sys->vweights);
+	delete_void_pointer(sys->zerola);
+	if (sys->context) {
+		nlDeleteContext(sys->context);
+	}
+	sys->bm = NULL;
+	sys->op = NULL;
+	MEM_freeN(sys);
+}
+
+static void memset_laplacian_system(LaplacianSystem *sys, int val)
+{
+	memset(sys->eweights,     val, sizeof(float) * sys->numEdges);
+	memset(sys->fweights,     val, sizeof(float) * sys->numFaces * 3);
+	memset(sys->ring_areas,   val, sizeof(float) * sys->numVerts);
+	memset(sys->vlengths,     val, sizeof(float) * sys->numVerts);
+	memset(sys->vweights,     val, sizeof(float) * sys->numVerts);
+	memset(sys->zerola,       val, sizeof(short) * sys->numVerts);
+}
+
+static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts)
+{
+	LaplacianSystem *sys;
+	sys = MEM_callocN(sizeof(LaplacianSystem), "ModLaplSmoothSystem");
+	sys->numEdges = a_numEdges;
+	sys->numFaces = a_numFaces;
+	sys->numVerts = a_numVerts;
+
+	sys->eweights =  MEM_callocN(sizeof(float) * sys->numEdges, "ModLaplSmoothEWeight");
+	if (!sys->eweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->fweights =  MEM_callocN(sizeof(float) * 3 * sys->numFaces, "ModLaplSmoothFWeight");
+	if (!sys->fweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->ring_areas =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothRingAreas");
+	if (!sys->ring_areas) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->vlengths =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothVlengths");
+	if (!sys->vlengths) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->vweights =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothVweights");
+	if (!sys->vweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->zerola =  MEM_callocN(sizeof(short) * sys->numVerts, "ModLaplSmoothZeloa");
+	if (!sys->zerola) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	return sys;
+}
+
+/* Compute weigth between vertice v_i and all your neighbors
+ * weight between v_i and v_neighbor
+ * Wij = cot(alpha) + cot(beta) / (4.0 * total area of all faces  * sum all weight)
+ *        v_i *
+ *          / | \
+ *         /  |  \
+ *  v_beta*   |   * v_alpha
+ *         \  |  /
+ *          \ | /
+ *            * v_neighbor
+ */
+
+static void init_laplacian_matrix(LaplacianSystem *sys)
+{
+	float areaf;
+	float *v1, *v2, *v3, *v4;
+	float w1, w2, w3, w4;
+	int i, j;
+	int has_4_vert;
+	unsigned int idv1, idv2, idv3, idv4, idv[4];
+	BMEdge *e;
+	BMFace *f;
+	BMIter eiter;
+	BMIter fiter;
+	BMIter vi;
+	BMVert *vn;
+	BMVert *vf[4];
+
+	BM_ITER_MESH_INDEX (e, &eiter, sys->bm, BM_EDGES_OF_MESH, j) {
+		if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e)) {
+			v1 = e->v1->co;
+			v2 =  e->v2->co;
+			idv1 = BM_elem_index_get(e->v1);
+			idv2 = BM_elem_index_get(e->v2);
+
+			w1 = len_v3v3(v1, v2);
+			if (w1 > sys->min_area) {
+				w1 = 1.0f / w1;
+				i = BM_elem_index_get(e);
+				sys->eweights[i] = w1;
+				sys->vlengths[idv1] += w1;
+				sys->vlengths[idv2] += w1;
+			}
+			else {
+				sys->zerola[idv1] = 1;
+				sys->zerola[idv2] = 1;
+			}
+		}
+	}
+
+	BM_ITER_MESH (f, &fiter, sys->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+
+			BM_ITER_ELEM_INDEX (vn, &vi, f, BM_VERTS_OF_FACE, i) {
+				vf[i] = vn;
+			}
+			has_4_vert = (i == 4) ? 1 : 0;
+			idv1 = BM_elem_index_get(vf[0]);
+			idv2 = BM_elem_index_get(vf[1]);
+			idv3 = BM_elem_index_get(vf[2]);
+			idv4 = has_4_vert ? BM_elem_index_get(vf[3]) : 0;
+
+			v1 = vf[0]->co;
+			v2 = vf[1]->co;
+			v3 = vf[2]->co;
+			v4 = has_4_vert ? vf[3]->co : 0;
+
+			if (has_4_vert) {
+				areaf = area_quad_v3(v1, v2, v3, v4);
+			}
+			else {
+				areaf = area_tri_v3(v1, v2, v3);
+			}
+
+			if (fabsf(areaf) < sys->min_area) {
+				sys->zerola[idv1] = 1;
+				sys->zerola[idv2] = 1;
+				sys->zerola[idv3] = 1;
+				if (has_4_vert) sys->zerola[idv4] = 1;
+			}
+
+			sys->ring_areas[idv1] += areaf;
+			sys->ring_areas[idv2] += areaf;
+			sys->ring_areas[idv3] += areaf;
+			if (has_4_vert) sys->ring_areas[idv4] += areaf;
+
+			if (has_4_vert) {
+
+				idv[0] = idv1;
+				idv[1] = idv2;
+				idv[2] = idv3;
+				idv[3] = idv4;
+
+				for (j = 0; j < 4; j++) {
+					idv1 = idv[j];
+					idv2 = idv[(j + 1) % 4];
+					idv3 = idv[(j + 2) % 4];
+					idv4 = idv[(j + 3) % 4];
+
+					v1 = vf[j]->co;
+					v2 = vf[(j + 1) % 4]->co;
+					v3 = vf[(j + 2) % 4]->co;
+					v4 = vf[(j + 3) % 4]->co;
+
+					w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2);
+					w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3);
+					w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1);
+
+					sys->vweights[idv1] += (w2 + w3 + w4) / 4.0f;
+				}
+			}
+			else {
+				i = BM_elem_index_get(f);
+
+				w1 = cotan_weight(v1, v2, v3);
+				w2 = cotan_weight(v2, v3, v1);
+				w3 = cotan_weight(v3, v1, v2);
+
+				sys->fweights[i][0] += w1;
+				sys->fweights[i][1] += w2;
+				sys->fweights[i][2] += w3;
+
+				sys->vweights[idv1] += w2 + w3;
+				sys->vweights[idv2] += w1 + w3;
+				sys->vweights[idv3] += w1 + w2;
+			}
+		}
+	}
+}
+
+static void fill_laplacian_matrix(LaplacianSystem *sys)
+{
+	float *v1, *v2, *v3, *v4;
+	float w2, w3, w4;
+	int i, j;
+	int has_4_vert;
+	unsigned int idv1, idv2, idv3, idv4, idv[4];
+
+	BMEdge *e;
+	BMFace *f;
+	BMIter eiter;
+	BMIter fiter;
+	BMIter vi;
+	BMVert *vn;
+	BMVert *vf[4];
+
+	BM_ITER_MESH (f, &fiter, sys->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+			BM_ITER_ELEM_INDEX (vn, &vi, f, BM_VERTS_OF_FACE, i) {
+				vf[i] = vn;
+			}
+			has_4_vert = (i == 4) ? 1 : 0;
+			if (has_4_vert) {
+				idv[0] = BM_elem_index_get(vf[0]);
+				idv[1] = BM_elem_index_get(vf[1]);
+				idv[2] = BM_elem_index_get(vf[2]);
+				idv[3] = BM_elem_index_get(vf[3]);
+				for (j = 0; j < 4; j++) {
+					idv1 = idv[j];
+					idv2 = idv[(j + 1) % 4];
+					idv3 = idv[(j + 2) % 4];
+					idv4 = idv[(j + 3) % 4];
+
+					v1 = vf[j]->co;
+					v2 = vf[(j + 1) % 4]->co;
+					v3 = vf[(j + 2) % 4]->co;
+					v4 = vf[(j + 3) % 4]->co;
+
+					w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2);
+					w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3);
+					w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1);
+
+					w2 = w2 / 4.0f;
+					w3 = w3 / 4.0f;
+					w4 = w4 / 4.0f;
+
+					if (!vert_is_boundary(vf[j]) && sys->zerola[idv1] == 0) {
+						nlMatrixAdd(idv1, idv2, w2 * sys->vweights[idv1]);
+						nlMatrixAdd(idv1, idv3, w3 * sys->vweights[idv1]);
+						nlMatrixAdd(idv1, idv4, w4 * sys->vweights[idv1]);
+					}
+				}
+			}
+			else {
+				idv1 = BM_elem_index_get(vf[0]);
+				idv2 = BM_elem_index_get(vf[1]);
+				idv3 = BM_elem_index_get(vf[2]);
+				/* Is ring if number of faces == number of edges around vertice*/
+				i = BM_elem_index_get(f);
+				if (!vert_is_boundary(vf[0]) && sys->zerola[idv1] == 0) {
+					nlMatrixAdd(idv1, idv2, sys->fweights[i][2] * sys->vweights[idv1]);
+					nlMatrixAdd(idv1, idv3, sys->fweights[i][1] * sys->vweights[idv1]);
+				}
+				if (!vert_is_boundary(vf[1]) && sys->zerola[idv2] == 0) {
+					nlMatrixAdd(idv2, idv1, sys->fweights[i][2] * sys->vweights[idv2]);
+					nlMatrixAdd(idv2, idv3, sys->fweights[i][0] * sys->vweights[idv2]);
+				}
+				if (!vert_is_boundary(vf[2]) && sys->zerola[idv3] == 0) {
+					nlMatrixAdd(idv3, idv1, sys->fweights[i][1] * sys->vweights[idv3]);
+					nlMatrixAdd(idv3, idv2, sys->fweights[i][0] * sys->vweights[idv3]);
+				}
+			}
+		}
+	}
+	BM_ITER_MESH (e, &eiter, sys->bm, BM_EDGES_OF_MESH) {
+		if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e) ) {
+			v1 = e->v1->co;
+			v2 =  e->v2->co;
+			idv1 = BM_elem_index_get(e->v1);
+			idv2 = BM_elem_index_get(e->v2);
+			if (sys->zerola[idv1] == 0 && sys->zerola[idv2] == 0) {
+				i = BM_elem_index_get(e);
+				nlMatrixAdd(idv1, idv2, sys->eweights[i] * sys->vlengths[idv1]);
+				nlMatrixAdd(idv2, idv1, sys->eweights[i] * sys->vlengths[idv2]);
+			}
+		}
+	}
+}
+
+static float cotan_weight(float *v1, float *v2, float *v3)
+{
+	float a[3], b[3], c[3], clen;
+
+	sub_v3_v3v3(a, v2, v1);
+	sub_v3_v3v3(b, v3, v1);
+	cross_v3_v3v3(c, a, b);
+
+	clen = len_v3(c);
+
+	if (clen == 0.0f)
+		return 0.0f;
+
+	return dot_v3v3(a, b) / clen;
+}
+
+static int vert_is_boundary(BMVert *v)
+{
+	BMEdge *ed;
+	BMFace *f;
+	BMIter ei;
+	BMIter fi;
+	BM_ITER_ELEM (ed, &ei, v, BM_EDGES_OF_VERT) {
+		if (BM_edge_is_boundary(ed)) {
+			return 1;
+		}
+	}
+	BM_ITER_ELEM (f, &fi, v, BM_FACES_OF_VERT) {
+		if (!BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+			return 1;
+		}
+	}
+	return 0;
+}
+
+static float compute_volume(BMesh *bm)
+{
+	float vol = 0.0f;
+	float x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4;
+	int i;
+	BMFace *f;
+	BMIter fiter;
+	BMIter vi;
+	BMVert *vn;
+	BMVert *vf[4];
+
+	BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM_INDEX (vn, &vi, f, BM_VERTS_OF_FACE, i) {
+			vf[i] = vn;
+		}
+		x1 = vf[0]->co[0];
+		y1 = vf[0]->co[1];
+		z1 = vf[0]->co[2];
+
+		x2 = vf[1]->co[0];
+		y2 = vf[1]->co[1];
+		z2 = vf[1]->co[2];
+
+		x3 = vf[2]->co[0];
+		y3 = vf[2]->co[1];
+		z3 = vf[2]->co[2];
+
+		vol += (1.0f / 6.0f) * (0.0f - x3 * y2 * z1 + x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3);
+
+		if (i == 4) {
+			x4 = vf[3]->co[0];
+			y4 = vf[3]->co[1];
+			z4 = vf[3]->co[2];
+			vol += (1.0f / 6.0f) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
+		}
+	}
+	return fabs(vol);
+}
+
+static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez)
+{
+	float beta;
+	BMOIter siter;
+	BMVert *v;
+
+	if (vend != 0.0f) {
+		beta  = pow(vini / vend, 1.0f / 3.0f);
+		BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
+			if (usex) {
+				v->co[0] *= beta;
+			}
+			if (usey) {
+				v->co[1] *= beta;
+			}
+			if (usez) {
+				v->co[2] *= beta;
+			}
+
+		}
+	}
+}
+
+static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int preserve_volume)
+{
+	int m_vertex_id;
+	float leni, lene;
+	float vini, vend;
+	float *vi1, *vi2, ve1[3], ve2[3];
+	unsigned int idv1, idv2;
+	BMOIter siter;
+	BMVert *v;
+	BMEdge *e;
+	BMIter eiter;
+
+	BM_ITER_MESH  (e, &eiter, sys->bm, BM_EDGES_OF_MESH) {
+		idv1 = BM_elem_index_get(e->v1);
+		idv2 = BM_elem_index_get(e->v2);
+		vi1 = e->v1->co;
+		vi2 =  e->v2->co;
+		ve1[0] = nlGetVariable(0, idv1);
+		ve1[1] = nlGetVariable(1, idv1);
+		ve1[2] = nlGetVariable(2, idv1);
+		ve2[0] = nlGetVariable(0, idv2);
+		ve2[1] = nlGetVariable(1, idv2);
+		ve2[2] = nlGetVariable(2, idv2);
+		leni = len_v3v3(vi1, vi2);
+		lene = len_v3v3(ve1, ve2);
+		if (lene > leni * SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE || lene < leni * SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE) {
+			sys->zerola[idv1] = 1;
+			sys->zerola[idv2] = 1;
+		}
+	}
+
+	if (preserve_volume) {
+		vini = compute_volume(sys->bm);
+	}
+	BMO_ITER (v, &siter, sys->op->slots_in, "verts", BM_VERT) {
+		m_vertex_id = BM_elem_index_get(v);
+		if (sys->zerola[m_vertex_id] == 0) {
+			if (usex) {
+				v->co[0] =  nlGetVariable(0, m_vertex_id);
+			}
+			if (usey) {
+				v->co[1] =  nlGetVariable(1, m_vertex_id);
+			}
+			if (usez) {
+				v->co[2] =  nlGetVariable(2, m_vertex_id);
+			}
+		}
+	}
+	if (preserve_volume) {
+		vend = compute_volume(sys->bm);
+		volume_preservation(sys->op, vini, vend, usex, usey, usez);
+	}
+
+}
+
+void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
+{
+	int i;
+	int m_vertex_id;
+	int usex, usey, usez, preserve_volume;
+	float lambda, lambda_border;
+	float w;
+	BMOIter siter;
+	BMVert *v;
+	LaplacianSystem *sys;
+
+	if (bm->totface == 0) return;
+	sys = init_laplacian_system(bm->totedge, bm->totface, bm->totvert);
+	if (!sys) return;
+	sys->bm = bm;
+	sys->op = op;
+
+	memset_laplacian_system(sys, 0);
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+	lambda = BMO_slot_float_get(op->slots_in, "lambda");
+	lambda_border = BMO_slot_float_get(op->slots_in, "lambda_border");
+	sys->min_area = 0.00001f;
+	usex = BMO_slot_bool_get(op->slots_in, "use_x");
+	usey = BMO_slot_bool_get(op->slots_in, "use_y");
+	usez = BMO_slot_bool_get(op->slots_in, "use_z");
+	preserve_volume = BMO_slot_bool_get(op->slots_in, "preserve_volume");
+
+
+	nlNewContext();
+	sys->context = nlGetCurrent();
+
+	nlSolverParameteri(NL_NB_VARIABLES, bm->totvert);
+	nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
+	nlSolverParameteri(NL_NB_ROWS, bm->totvert);
+	nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 3);
+
+	nlBegin(NL_SYSTEM);
+	for (i = 0; i < bm->totvert; i++) {
+		nlLockVariable(i);
+	}
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
+		m_vertex_id = BM_elem_index_get(v);
+		nlUnlockVariable(m_vertex_id);
+		nlSetVariable(0, m_vertex_id, v->co[0]);
+		nlSetVariable(1, m_vertex_id, v->co[1]);
+		nlSetVariable(2, m_vertex_id, v->co[2]);
+	}
+
+	nlBegin(NL_MATRIX);
+	init_laplacian_matrix(sys);
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
+		m_vertex_id = BM_elem_index_get(v);
+		nlRightHandSideAdd(0, m_vertex_id, v->co[0]);
+		nlRightHandSideAdd(1, m_vertex_id, v->co[1]);
+		nlRightHandSideAdd(2, m_vertex_id, v->co[2]);
+		i = m_vertex_id;
+		if (sys->zerola[i] == 0) {
+			w = sys->vweights[i] * sys->ring_areas[i];
+			sys->vweights[i] = (w == 0.0f) ? 0.0f : -lambda  / (4.0f * w);
+			w = sys->vlengths[i];
+			sys->vlengths[i] = (w == 0.0f) ? 0.0f : -lambda_border  * 2.0f / w;
+
+			if (!vert_is_boundary(v)) {
+				nlMatrixAdd(i, i,  1.0f + lambda / (4.0f * sys->ring_areas[i]));
+			}
+			else {
+				nlMatrixAdd(i, i,  1.0f + lambda_border * 2.0f);
+			}
+		}
+		else {
+			nlMatrixAdd(i, i, 1.0f);
+		}
+	}
+	fill_laplacian_matrix(sys);
+
+	nlEnd(NL_MATRIX);
+	nlEnd(NL_SYSTEM);
+
+	if (nlSolveAdvanced(NULL, NL_TRUE) ) {
+		validate_solution(sys, usex, usey, usez, preserve_volume);
+	}
+
+	delete_laplacian_system(sys);
+}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 4ec3d34..7407eb4 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -54,7 +54,7 @@
 #define ELE_SPLIT	16
 
 /* see bug [#32665], 0.00005 means a we get face splits at a little under 1.0 degrees */
-#define FLT_FACE_SPLIT_EPSILON 0.00005
+#define FLT_FACE_SPLIT_EPSILON 0.00005f
 
 /*
  * NOTE: beauty has been renamed to flag!
@@ -165,7 +165,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
 	}
 
 	/* apply the new difference to the rest of the shape keys,
-	 * note that this doent take rotations into account, we _could_ support
+	 * note that this dosn't take rotations into account, we _could_ support
 	 * this by getting the normals and coords for each shape key and
 	 * re-calculate the smooth value for each but this is quite involved.
 	 * for now its ok to simply apply the difference IMHO - campbell */
@@ -225,8 +225,9 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
 	BMVert *ev;
 	float percent, percent2 = 0.0f;
 
-	if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1)
-		percent = BMO_slot_map_float_get(bm, params->op, "edgepercents", edge);
+	if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1) {
+		percent = BMO_slot_map_float_get(params->slot_edge_percents, edge);
+	}
 	else {
 		percent = 1.0f / (float)(totpoint + 1 - curpoint);
 		percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
@@ -714,21 +715,22 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	BMFace *face;
 	BLI_array_declare(verts);
 	float smooth, fractal, along_normal;
-	int use_sphere, cornertype, use_singleedge, use_gridfill;
+	int use_sphere, cornertype, use_single_edge, use_grid_fill, use_only_quads;
 	int skey, seed, i, j, matched, a, b, numcuts, totesel;
 	
-	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
 	
-	numcuts = BMO_slot_int_get(op, "numcuts");
-	seed = BMO_slot_int_get(op, "seed");
-	smooth = BMO_slot_float_get(op, "smooth");
-	fractal = BMO_slot_float_get(op, "fractal");
-	along_normal = BMO_slot_float_get(op, "along_normal");
-	cornertype = BMO_slot_int_get(op, "quadcornertype");
-
-	use_singleedge = BMO_slot_bool_get(op, "use_singleedge");
-	use_gridfill   = BMO_slot_bool_get(op, "use_gridfill");
-	use_sphere     = BMO_slot_bool_get(op, "use_sphere");
+	numcuts = BMO_slot_int_get(op->slots_in, "cuts");
+	seed = BMO_slot_int_get(op->slots_in, "seed");
+	smooth = BMO_slot_float_get(op->slots_in, "smooth");
+	fractal = BMO_slot_float_get(op->slots_in, "fractal");
+	along_normal = BMO_slot_float_get(op->slots_in, "along_normal");
+	cornertype = BMO_slot_int_get(op->slots_in, "quad_corner_type");
+
+	use_single_edge = BMO_slot_bool_get(op->slots_in, "use_single_edge");
+	use_grid_fill = BMO_slot_bool_get(op->slots_in, "use_grid_fill");
+	use_only_quads = BMO_slot_bool_get(op->slots_in, "use_only_quads");
+	use_sphere = BMO_slot_bool_get(op->slots_in, "use_sphere");
 	
 	BLI_srandom(seed);
 	
@@ -746,7 +748,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 			break;
 	}
 	
-	if (use_singleedge) {
+	if (use_single_edge) {
 		patterns[0] = &quad_1edge;
 		patterns[2] = &tri_1edge;
 	}
@@ -755,7 +757,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		patterns[2] = NULL;
 	}
 
-	if (use_gridfill) {
+	if (use_grid_fill) {
 		patterns[3] = &quad_4edge;
 		patterns[5] = &tri_3edge;
 	}
@@ -774,10 +776,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	}
 
 	/* first go through and tag edges */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
 
 	params.numcuts = numcuts;
 	params.op = op;
+	params.slot_edge_percents   = BMO_slot_get(op->slots_in, "edge_percents");
+	params.slot_custom_patterns = BMO_slot_get(op->slots_in, "custom_patterns");
 	params.smooth = smooth;
 	params.seed = seed;
 	params.fractal = fractal;
@@ -790,10 +794,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	params.off[1] = (float)BLI_drand() * 200.0f;
 	params.off[2] = (float)BLI_drand() * 200.0f;
 	
-	BMO_slot_map_to_flag(bm, op, "custompatterns",
+	BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns",
 	                     BM_FACE, FACE_CUSTOMFILL);
 
-	BMO_slot_map_to_flag(bm, op, "edgepercents",
+	BMO_slot_map_to_flag(bm, op->slots_in, "edge_percents",
 	                     BM_EDGE, EDGE_PERCENT);
 
 
@@ -801,6 +805,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		BMEdge *e1 = NULL, *e2 = NULL;
 		float vec1[3], vec2[3];
 
+		/* skip non-quads if requested */
+		if (use_only_quads && face->len != 4)
+			continue;
+
 		/* figure out which pattern to use */
 
 		BLI_array_empty(edges);
@@ -825,7 +833,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		}
 
 		/* make sure the two edges have a valid angle to each other */
-		if (totesel == 2 && BM_edge_share_vert_count(e1, e2)) {
+		if (totesel == 2 && BM_edge_share_vert_check(e1, e2)) {
 			sub_v3_v3v3(vec1, e1->v2->co, e1->v1->co);
 			sub_v3_v3v3(vec2, e2->v2->co, e2->v1->co);
 			normalize_v3(vec1);
@@ -837,8 +845,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		}
 
 		if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) {
-			pat = BMO_slot_map_data_get(bm, op,
-			                            "custompatterns", face);
+			pat = BMO_slot_map_data_get(params.slot_custom_patterns, face);
 			for (i = 0; i < pat->len; i++) {
 				matched = 1;
 				for (j = 0; j < pat->len; j++) {
@@ -910,11 +917,11 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	einput = BMO_slot_get(op, "edges");
+	einput = BMO_slot_get(op->slots_in, "edges");
 
 	/* go through and split edges */
 	for (i = 0; i < einput->len; i++) {
-		edge = ((BMEdge **)einput->data.p)[i];
+		edge = einput->data.buf[i];
 		bm_subdivide_multicut(bm, edge, &params, edge->v1, edge->v2);
 	}
 
@@ -982,7 +989,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 				 * This edge pair could be used by more then one face,
 				 * in this case it used to (2.63), split both faces along the same verts
 				 * while it could be calculated which face should do the split,
-				 * its ambigious, so in this case we're better off to skip them as exceptional cases
+				 * it's ambiguous, so in this case we're better off to skip them as exceptional cases
 				 * and not try to be clever guessing which face to cut up.
 				 *
 				 * To avoid this case we need to check:
@@ -1075,10 +1082,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	BLI_array_free(loops_split);
 	BLI_array_free(loops);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_inner.out", BM_ALL_NOLOOP, ELE_INNER);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL_NOLOOP, ELE_SPLIT);
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
 }
 
 /* editmesh-emulating function */
@@ -1086,7 +1093,8 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
                         float smooth, float fractal, float along_normal,
                         int numcuts,
                         int seltype, int cornertype,
-                        const short use_singleedge, const short use_gridfill,
+                        const short use_single_edge, const short use_grid_fill,
+                        const short use_only_quads,
                         int seed)
 {
 	BMOperator op;
@@ -1095,15 +1103,17 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
 	BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
 	             "subdivide_edges edges=%he "
 	             "smooth=%f fractal=%f along_normal=%f "
-	             "numcuts=%i "
-	             "quadcornertype=%i "
-	             "use_singleedge=%b use_gridfill=%b "
+	             "cuts=%i "
+	             "quad_corner_type=%i "
+	             "use_single_edge=%b use_grid_fill=%b "
+	             "use_only_quads=%b "
 	             "seed=%i",
 	             edge_hflag,
 	             smooth, fractal, along_normal,
 	             numcuts,
 	             cornertype,
-	             use_singleedge, use_gridfill,
+	             use_single_edge, use_grid_fill,
+	             use_only_quads,
 	             seed);
 	
 	BMO_op_exec(bm, &op);
@@ -1112,7 +1122,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
 		BMOIter iter;
 		BMElem *ele;
 
-		for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
+		for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
 			BM_elem_select_set(bm, ele, TRUE);
 		}
 	}
@@ -1123,7 +1133,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
 		/* deselect input */
 		BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
 
-		for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
+		for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
 			BM_elem_select_set(bm, ele, TRUE);
 
 			if (ele->head.htype == BM_VERT) {
@@ -1158,8 +1168,9 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
 	SubDParams params = {0};
 	int skey;
 	
-	params.numcuts = BMO_slot_int_get(op, "numcuts");
+	params.numcuts = BMO_slot_int_get(op->slots_in, "cuts");
 	params.op = op;
+	params.slot_edge_percents = BMO_slot_get(op->slots_in, "edge_percents");
 	
 	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
 	skey = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY) - 1;
@@ -1167,11 +1178,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
 	params.origkey = skey;
 
 	/* go through and split edges */
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		bm_subdivide_multicut(bm, e, &params, e->v1, e->v2);
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL_NOLOOP, ELE_SPLIT);
 
 	BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
 }
diff --git a/source/blender/bmesh/operators/bmo_subdivide.h b/source/blender/bmesh/operators/bmo_subdivide.h
index d4b926b..529075a 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.h
+++ b/source/blender/bmesh/operators/bmo_subdivide.h
@@ -39,6 +39,8 @@ typedef struct SubDParams {
 	int seed;
 	int origkey; /* shapekey holding displaced vertex coordinates for current geometry */
 	BMOperator *op;
+	BMOpSlot *slot_edge_percents;  /* BMO_slot_get(params->op->slots_in, "edge_percents"); */
+	BMOpSlot *slot_custom_patterns;  /* BMO_slot_get(params->op->slots_in, "custom_patterns"); */
 	float off[3];
 } SubDParams;
 
diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c
new file mode 100644
index 0000000..248c726
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_symmetrize.c
@@ -0,0 +1,670 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Nicholas Bishop
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_operators_private.h"
+
+enum {
+	SYMM_OUTPUT_GEOM = (1 << 0)
+};
+
+/* Note: don't think there's much need to make these user-adjustable? */
+#define SYMM_AXIS_THRESHOLD 0.00002f
+#define SYMM_VERT_THRESHOLD 0.00002f
+
+typedef enum {
+	/* Coordinate lies on the side being copied from */
+	SYMM_SIDE_KEEP,
+	/* Coordinate lies on the side being copied from and within the
+	 * axis threshold */
+	SYMM_SIDE_AXIS,
+	/* Coordinate lies on the side being copied to */
+	SYMM_SIDE_KILL
+} SymmSide;
+
+typedef struct {
+	BMesh *bm;
+	BMOperator *op;
+
+	int axis;
+	BMO_SymmDirection direction;
+
+	/* Maps from input vertices to their mirrors. If the vertex
+	 * doesn't have a mirror, it's not in this map. If the vertex is
+	 * within the axis threshold, it's mapped to itself. */
+	GHash *vert_symm_map;
+
+	/* Edges that cross the symmetry plane and are asymmetric get
+	 * split. This map goes from input edges to output vertices. If an
+	 * edge is not split, it's not in this map. */
+	GHash *edge_split_map;
+} Symm;
+
+/* Return which side the coordinate lies on */
+static SymmSide symm_co_side(const Symm *symm,
+                             const float *co)
+{
+	float comp = co[symm->axis];
+	if (ELEM3(symm->direction,
+	          BMO_SYMMETRIZE_NEGATIVE_X,
+	          BMO_SYMMETRIZE_NEGATIVE_Y,
+	          BMO_SYMMETRIZE_NEGATIVE_Z))
+	{
+		comp = -comp;
+	}
+
+	if (comp >= 0) {
+		if (comp < SYMM_AXIS_THRESHOLD)
+			return SYMM_SIDE_AXIS;
+		else
+			return SYMM_SIDE_KEEP;
+	}
+	else
+		return SYMM_SIDE_KILL;
+}
+
+/* Output vertices and the vert_map array */
+static void symm_verts_mirror(Symm *symm)
+{
+	BMOIter oiter;
+	BMVert *src_v, *dst_v;
+
+	symm->vert_symm_map = BLI_ghash_ptr_new(AT);
+
+	BMO_ITER (src_v, &oiter, symm->op->slots_in, "input", BM_VERT) {
+		SymmSide side = symm_co_side(symm, src_v->co);
+		float co[3];
+
+		switch (side) {
+			case SYMM_SIDE_KEEP:
+				/* The vertex is outside the axis area; output its mirror */
+				copy_v3_v3(co, src_v->co);
+				co[symm->axis] = -co[symm->axis];
+
+				dst_v = BM_vert_create(symm->bm, co, src_v, 0);
+				BMO_elem_flag_enable(symm->bm, dst_v, SYMM_OUTPUT_GEOM);
+				BLI_ghash_insert(symm->vert_symm_map, src_v, dst_v);
+				break;
+
+			case SYMM_SIDE_AXIS:
+				/* The vertex is within the axis area, snap to center */
+				src_v->co[symm->axis] = 0;
+				/* Vertex isn't copied, map to itself */
+				BLI_ghash_insert(symm->vert_symm_map, src_v, src_v);
+				break;
+
+			case SYMM_SIDE_KILL:
+				/* The vertex does not lie in the half-space being
+				 * copied from, nothing to do */
+				break;
+		}
+	}
+}
+
+static int symm_edge_crosses_axis(const Symm *symm, const BMEdge *e)
+{
+	const int sides[2] = {symm_co_side(symm, e->v1->co),
+		                  symm_co_side(symm, e->v2->co)};
+
+	return ((sides[0] != SYMM_SIDE_AXIS) &&
+	        (sides[1] != SYMM_SIDE_AXIS) &&
+	        (sides[0] != sides[1]));
+}
+
+/* Output edge split vertices for asymmetric edges and the edge_splits
+ * mapping array */
+static void symm_split_asymmetric_edges(Symm *symm)
+{
+	BMOIter oiter;
+	BMEdge *e;
+
+	symm->edge_split_map = BLI_ghash_ptr_new(AT);
+
+	BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
+		float flipped[3];
+
+		copy_v3_v3(flipped, e->v1->co);
+		flipped[symm->axis] = -flipped[symm->axis];
+
+		if (symm_edge_crosses_axis(symm, e) &&
+		    (!compare_v3v3(e->v2->co, flipped, SYMM_VERT_THRESHOLD)))
+		{
+			/* Endpoints lie on opposite sides and are asymmetric */
+
+			BMVert *v;
+			float lambda = 0, edge_dir[3], co[3];
+			float plane_co[3][3][3] = {
+				/* axis == 0 */
+				{{0, 0, 0}, {0, 1, 0}, {0, 0, 1}},
+				/* axis == 1 */
+				{{0, 0, 0}, {1, 0, 0}, {0, 0, 1}},
+				/* axis == 2 */
+				{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}},
+			};
+			int r;
+
+			/* Find intersection of edge with symmetry plane */
+			sub_v3_v3v3(edge_dir, e->v2->co, e->v1->co);
+			normalize_v3(edge_dir);
+			r = isect_ray_plane_v3(e->v1->co,
+			                       edge_dir,
+			                       plane_co[symm->axis][0],
+			                       plane_co[symm->axis][1],
+			                       plane_co[symm->axis][2],
+			                       &lambda, TRUE);
+			BLI_assert(r);
+
+			madd_v3_v3v3fl(co, e->v1->co, edge_dir, lambda);
+			co[symm->axis] = 0;
+
+			/* Edge is asymmetric, split it with a new vertex */
+			v = BM_vert_create(symm->bm, co, e->v1, 0);
+			BMO_elem_flag_enable(symm->bm, v, SYMM_OUTPUT_GEOM);
+			BLI_ghash_insert(symm->edge_split_map, e, v);
+		}
+	}
+}
+
+static void symm_mirror_edges(Symm *symm)
+{
+	BMOIter oiter;
+	BMEdge *e;
+
+	BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
+		BMVert *v1 = NULL, *v2 = NULL;
+		BMEdge *e_new;
+
+		v1 = BLI_ghash_lookup(symm->vert_symm_map, e->v1);
+		v2 = BLI_ghash_lookup(symm->vert_symm_map, e->v2);
+
+		if (v1 && v2) {
+			e_new = BM_edge_create(symm->bm, v1, v2, e, BM_CREATE_NO_DOUBLE);
+			BMO_elem_flag_enable(symm->bm, e_new, SYMM_OUTPUT_GEOM);
+		}
+		else if (v1 || v2) {
+			if (BLI_ghash_haskey(symm->edge_split_map, e)) {
+				BMVert *v_split = BLI_ghash_lookup(symm->edge_split_map, e);
+
+				/* Output the keep side of the split edge */
+				if (!v1) {
+					e_new = BM_edge_create(symm->bm, v_split, e->v2, e, BM_CREATE_NO_DOUBLE);
+					BMO_elem_flag_enable(symm->bm, e_new, SYMM_OUTPUT_GEOM);
+					v1 = v_split;
+				}
+				else {
+					e_new = BM_edge_create(symm->bm, e->v1, v_split, e, BM_CREATE_NO_DOUBLE);
+					BMO_elem_flag_enable(symm->bm, e_new, SYMM_OUTPUT_GEOM);
+					v2 = v_split;
+				}
+
+				/* Output the kill side of the split edge */
+				e_new = BM_edge_create(symm->bm, v1, v2, e, BM_CREATE_NO_DOUBLE);
+				BMO_elem_flag_enable(symm->bm, e_new, SYMM_OUTPUT_GEOM);
+			}
+		}
+	}
+}
+
+/****************************** SymmPoly ******************************/
+
+typedef struct {
+	/* Indices into the source mvert array (or -1 if not in that array) */
+	BMVert **src_verts;
+	/* Indices into the destination mvert array, these are vertices
+	 * created by an edge split (-1 for vertices not created by edge
+	 * split) */
+	BMVert **edge_verts;
+
+	/* Number of vertices in the polygon */
+	int len;
+
+	/* True only if none of the polygon's edges were split */
+	int already_symmetric;
+
+	BMFace *src_face;
+} SymmPoly;
+
+static void symm_poly_with_splits(const Symm *symm,
+                                  BMFace *f,
+                                  SymmPoly *out)
+{
+	BMIter iter;
+	BMLoop *l;
+	int i;
+
+	out->src_face = f;
+
+	/* Count vertices and check for edge splits */
+	out->len = f->len;
+	out->already_symmetric = TRUE;
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+		if (BLI_ghash_haskey(symm->edge_split_map, l->e)) {
+			out->len++;
+			out->already_symmetric = FALSE;
+		}
+	}
+
+	i = 0;
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+		BMVert *split = BLI_ghash_lookup(symm->edge_split_map, l->e);
+
+		out->src_verts[i] = l->v;
+		out->edge_verts[i] = NULL;
+		i++;
+
+		if (split) {
+			out->src_verts[i] = NULL;
+			out->edge_verts[i] = split;
+			i++;
+		}
+	}
+}
+
+static const float *symm_poly_co(const SymmPoly *sp, int v)
+{
+	if (sp->src_verts[v])
+		return sp->src_verts[v]->co;
+	else if (sp->edge_verts[v])
+		return sp->edge_verts[v]->co;
+	else
+		return NULL;
+}
+
+static SymmSide symm_poly_co_side(const Symm *symm,
+                                  const SymmPoly *sp,
+                                  int v)
+{
+	return symm_co_side(symm, symm_poly_co(sp, v));
+}
+
+/* Return the index of the vertex in the destination array at corner
+ * 'v' of the polygon, or -1 if not in that array */
+static BMVert *symm_poly_dst(const SymmPoly *sp, int v)
+{
+	if (sp->edge_verts[v])
+		return sp->edge_verts[v];
+	else if (sp->src_verts[v])
+		return sp->src_verts[v];
+	else
+		return NULL;
+}
+
+/* Same as above, but returns the index of the mirror if available, or
+ * the same index if on the axis, or -1 otherwise */
+static BMVert *symm_poly_mirror_dst(const Symm *symm,
+                                    const SymmPoly *sp,
+                                    int v)
+{
+	if (sp->edge_verts[v])
+		return sp->edge_verts[v];
+	else if (sp->src_verts[v]) {
+		if (BLI_ghash_haskey(symm->vert_symm_map, sp->src_verts[v]))
+			return BLI_ghash_lookup(symm->vert_symm_map, sp->src_verts[v]);
+		else
+			return sp->src_verts[v];
+	}
+	else
+		return NULL;
+}
+
+static int symm_poly_next_crossing(const Symm *symm,
+                                   const SymmPoly *sp,
+                                   int start,
+                                   int *l1,
+                                   int *l2)
+{
+	int i;
+
+	for (i = 0; i < sp->len; i++) {
+		(*l1) = (start + i) % sp->len;
+		(*l2) = ((*l1) + 1) % sp->len;
+
+		if ((symm_poly_co_side(symm, sp, *l1) == SYMM_SIDE_KILL) ^
+		    (symm_poly_co_side(symm, sp, *l2) == SYMM_SIDE_KILL))
+		{
+			return TRUE;
+		}
+	}
+
+	BLI_assert(!"symm_poly_next_crossing failed");
+	return FALSE;
+}
+
+static BMFace *symm_face_create_v(BMesh *bm, BMFace *example,
+                                  BMVert **fv, BMEdge **fe, int len)
+{
+	BMFace *f_new;
+	int i;
+
+	for (i = 0; i < len; i++) {
+		int j = (i + 1) % len;
+		fe[i] = BM_edge_exists(fv[i], fv[j]);
+		if (!fe[i]) {
+			fe[i] = BM_edge_create(bm, fv[i], fv[j], NULL, 0);
+			BMO_elem_flag_enable(bm, fe[i], SYMM_OUTPUT_GEOM);
+		}
+	}
+	f_new = BM_face_create(bm, fv, fe, len, BM_CREATE_NO_DOUBLE);
+	if (example)
+		BM_elem_attrs_copy(bm, bm, example, f_new);
+	BM_face_select_set(bm, f_new, TRUE);
+	BMO_elem_flag_enable(bm, f_new, SYMM_OUTPUT_GEOM);
+	return f_new;
+}
+
+static void symm_mesh_output_poly_zero_splits(Symm *symm,
+                                              SymmPoly *sp,
+                                              BMVert **fv,
+                                              BMEdge **fe,
+                                              int segment_len,
+                                              int start)
+{
+	int i, j;
+
+	j = 0;
+
+	/* Output the keep side of the input polygon */
+	for (i = 0; i < segment_len; i++) {
+		const int offset = (start + i) % sp->len;
+		BLI_assert(sp->src_verts[offset]);
+		fv[j++] = sp->src_verts[offset];
+	}
+
+	/* Output the kill side of the polygon */
+	for (i = segment_len - 1; i >= 0; i--) {
+		const int offset = (start + i) % sp->len;
+
+		if (symm_poly_co_side(symm, sp, offset) == SYMM_SIDE_KEEP) {
+			BLI_assert(sp->src_verts[offset]);
+			fv[j++] = BLI_ghash_lookup(symm->vert_symm_map,
+			                           sp->src_verts[offset]);
+		}
+	}
+
+	symm_face_create_v(symm->bm, sp->src_face, fv, fe, j);
+}
+
+static void symm_mesh_output_poly_with_splits(Symm *symm,
+                                              SymmPoly *sp,
+                                              BMVert **fv,
+                                              BMEdge **fe,
+                                              int segment_len,
+                                              int start)
+{
+	int i;
+
+	/* Output the keep side of the input polygon */
+
+	for (i = 0; i < segment_len; i++) {
+		const int offset = (start + i) % sp->len;
+		BMVert *v = symm_poly_dst(sp, offset);
+
+		BLI_assert(v);
+
+		fv[i] = v;
+	}
+
+	symm_face_create_v(symm->bm, sp->src_face, fv, fe, segment_len);
+
+	/* Output the kill side of the input polygon */
+
+	for (i = 0; i < segment_len; i++) {
+		const int offset = (start + i) % sp->len;
+		BMVert *v = symm_poly_mirror_dst(symm, sp, offset);
+
+		fv[segment_len - i - 1] = v;
+
+	}
+
+	symm_face_create_v(symm->bm, sp->src_face, fv, fe, segment_len);
+}
+
+static void symm_mirror_polygons(Symm *symm)
+{
+	BMOIter oiter;
+	BMFace *f;
+	BMVert **pv = NULL;
+	BMVert **fv = NULL;
+	BMEdge **fe = NULL;
+	BLI_array_declare(pv);
+	BLI_array_declare(fv);
+	BLI_array_declare(fe);
+
+	BMO_ITER (f, &oiter, symm->op->slots_in, "input", BM_FACE) {
+		BMIter iter;
+		BMLoop *l;
+		int mirror_all = TRUE, ignore_all = TRUE;
+
+		/* Check if entire polygon can be mirrored or ignored */
+		BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+			const SymmSide side = symm_co_side(symm, l->v->co);
+			if (side == SYMM_SIDE_KILL)
+				mirror_all = FALSE;
+			else if (side == SYMM_SIDE_KEEP)
+				ignore_all = FALSE;
+		}
+
+		if (mirror_all) {
+			int i;
+
+			/* Make a mirrored copy of the polygon */
+
+			BLI_array_empty(fv);
+			BLI_array_empty(fe);
+			BLI_array_grow_items(fv, f->len);
+			BLI_array_grow_items(fe, f->len);
+
+			i = f->len;
+			BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+				i--;
+
+				if (symm_co_side(symm, l->v->co) == SYMM_SIDE_KEEP)
+					fv[i] = BLI_ghash_lookup(symm->vert_symm_map, l->v);
+				else
+					fv[i] = l->v;
+			}
+
+			symm_face_create_v(symm->bm, f, fv, fe, f->len);
+		}
+		else if (ignore_all) {
+			BM_face_kill(symm->bm, f);
+		}
+		else {
+			SymmPoly sp;
+			int l1, l2, l3, l4;
+			int double_l2, double_l3;
+			int segment_len;
+
+			BLI_array_empty(pv);
+			BLI_array_grow_items(pv, f->len * 4);
+			sp.src_verts = pv;
+			sp.edge_verts = pv + f->len * 2;
+			symm_poly_with_splits(symm, f, &sp);
+
+			/* Find first loop edge crossing the axis */
+			symm_poly_next_crossing(symm, &sp, 0, &l1, &l2);
+
+			/* If crossing isn't kill to keep, find the next one */
+			if (symm_poly_co_side(symm, &sp, l1) != SYMM_SIDE_KILL) {
+				symm_poly_next_crossing(symm, &sp, l2, &l1, &l2);
+			}
+
+			/* Find next crossing (keep to kill) */
+			symm_poly_next_crossing(symm, &sp, l2, &l3, &l4);
+
+			if (l2 == l3)
+				segment_len = 0;
+			else if (l2 < l3)
+				segment_len = l3 - l2 + 1;
+			else
+				segment_len = (sp.len - l2 + 1) + l3;
+
+			double_l2 = symm_poly_co_side(symm, &sp, l2) == SYMM_SIDE_KEEP;
+			double_l3 = symm_poly_co_side(symm, &sp, l3) == SYMM_SIDE_KEEP;
+
+			/* Calculate number of new polygons/loops */
+			if (segment_len == 0) {
+			}
+			else if (sp.already_symmetric) {
+				int new_loops;
+
+				if (double_l2 && double_l3)
+					new_loops = segment_len * 2;
+				else if (!double_l2 && !double_l3)
+					new_loops = segment_len * 2 - 2;
+				else
+					new_loops = segment_len * 2 - 1;
+
+				BLI_array_empty(fv);
+				BLI_array_empty(fe);
+				BLI_array_grow_items(fv, new_loops);
+				BLI_array_grow_items(fe, new_loops);
+
+				symm_mesh_output_poly_zero_splits(symm, &sp,
+				                                  fv, fe,
+				                                  segment_len, l2);
+				BM_face_kill(symm->bm, f);
+			}
+			else if (!double_l2 && !double_l3) {
+				BLI_array_empty(fv);
+				BLI_array_empty(fe);
+				BLI_array_grow_items(fv, segment_len);
+				BLI_array_grow_items(fe, segment_len);
+
+				symm_mesh_output_poly_with_splits(symm, &sp,
+				                                  fv, fe,
+				                                  segment_len,
+				                                  l2);
+
+				BM_face_kill(symm->bm, f);
+			}
+			else {
+				BLI_array_empty(fv);
+				BLI_array_empty(fe);
+				BLI_array_grow_items(fv, segment_len);
+				BLI_array_grow_items(fe, segment_len);
+
+				symm_mesh_output_poly_with_splits(symm, &sp,
+				                                  fv, fe,
+				                                  segment_len,
+				                                  l2);
+
+				BM_face_kill(symm->bm, f);
+
+				/* Output bridge triangle */
+
+				BLI_array_empty(fv);
+				BLI_array_empty(fe);
+				BLI_array_grow_items(fv, 3);
+				BLI_array_grow_items(fe, 3);
+
+				if (double_l2) {
+					fv[0] = symm_poly_dst(&sp, l2);
+					fv[1] = symm_poly_mirror_dst(symm, &sp, l2);
+					fv[2] = symm_poly_dst(&sp, l3);
+				}
+				else if (double_l3) {
+					fv[0] = symm_poly_dst(&sp, l3);
+					fv[1] = symm_poly_mirror_dst(symm, &sp, l3);
+					fv[2] = symm_poly_dst(&sp, l2);
+				}
+
+				BLI_assert(fv[0] && fv[1] && fv[2]);
+
+				symm_face_create_v(symm->bm, NULL, fv, fe, 3);
+			}
+		}
+	}
+
+	BLI_array_free(pv);
+	BLI_array_free(fv);
+	BLI_array_free(fe);
+}
+
+/* Remove unused edges and vertices from the side being copied to */
+static void symm_kill_unused(Symm *symm)
+{
+	BMOIter oiter;
+	BMEdge *e;
+	BMVert *v;
+
+	/* Kill unused edges */
+	BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
+		const int crosses = symm_edge_crosses_axis(symm, e);
+		const int symmetric = (crosses &&
+		                       (!BLI_ghash_haskey(symm->edge_split_map, e)));
+
+		if (((symm_co_side(symm, e->v1->co) == SYMM_SIDE_KILL) ||
+		     (symm_co_side(symm, e->v2->co) == SYMM_SIDE_KILL)) &&
+		    !symmetric)
+		{
+			/* The edge might be used by a face outside the input set */
+			if (BM_edge_is_wire(e))
+				BM_edge_kill(symm->bm, e);
+		}
+	}
+
+	/* Kill unused vertices */
+	BMO_ITER (v, &oiter, symm->op->slots_in, "input", BM_VERT) {
+		if (symm_co_side(symm, v->co) == SYMM_SIDE_KILL) {
+			if (BM_vert_edge_count(v) == 0)
+				BM_vert_kill(symm->bm, v);
+		}
+	}
+}
+
+void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
+{
+	Symm symm;
+	BMO_SymmDirection direction = BMO_slot_int_get(op->slots_in, "direction");
+
+	symm.bm = bm;
+	symm.op = op;
+	symm.axis = (ELEM(direction,
+	                  BMO_SYMMETRIZE_NEGATIVE_X,
+	                  BMO_SYMMETRIZE_POSITIVE_X) ? 0 :
+	             ELEM(direction,
+	                  BMO_SYMMETRIZE_NEGATIVE_Y,
+	                  BMO_SYMMETRIZE_POSITIVE_Y) ? 1 :
+	             ELEM(direction,
+	                  BMO_SYMMETRIZE_NEGATIVE_Z,
+	                  BMO_SYMMETRIZE_POSITIVE_Z) ? 2 : 0);
+	symm.direction = direction;
+
+	symm_verts_mirror(&symm);
+	symm_split_asymmetric_edges(&symm);
+	symm_mirror_edges(&symm);
+	symm_mirror_polygons(&symm);
+	symm_kill_unused(&symm);
+
+	BLI_ghash_free(symm.vert_symm_map, NULL, NULL);
+	BLI_ghash_free(symm.edge_split_map, NULL, NULL);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out",
+	                                  BM_ALL_NOLOOP, SYMM_OUTPUT_GEOM);
+}
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index de87647..d20d01a 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -52,9 +52,10 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
 	float (*projectverts)[3] = NULL;
 	BLI_array_declare(projectverts);
 	int i;
-	const int use_beauty = BMO_slot_bool_get(op, "use_beauty");
+	const int use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
+	BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out");
 
-	for (face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
+	for (face = BMO_iter_new(&siter, op->slots_in, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
 
 		BLI_array_empty(projectverts);
 		BLI_array_empty(newfaces);
@@ -64,16 +65,14 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
 
 		BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
 
-		BMO_slot_map_ptr_insert(bm, op, "facemap", face, face);
+		BMO_slot_map_elem_insert(op, slot_facemap_out, face, face);
 		for (i = 0; newfaces[i]; i++) {
-			BMO_slot_map_ptr_insert(bm, op, "facemap",
-			                        newfaces[i], face);
-
+			BMO_slot_map_elem_insert(op, slot_facemap_out, newfaces[i], face);
 		}
 	}
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_NEW);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
 	
 	BLI_array_free(projectverts);
 	BLI_array_free(newfaces);
@@ -87,9 +86,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
 	BMEdge *e;
 	int stop = 0;
 	
-	BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", BM_EDGE, EDGE_MARK);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "constrain_edges", BM_EDGE, EDGE_MARK);
 	
-	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
 		if (f->len == 3) {
 			BMO_elem_flag_enable(bm, f, FACE_MARK);
 		}
@@ -152,7 +151,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
 }
 
 void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
@@ -170,7 +169,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 	
 	BLI_scanfill_begin(&sf_ctx);
 	
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		BMO_elem_flag_enable(bm, e, EDGE_MARK);
 		
 		if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
@@ -191,7 +190,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 		/* sf_edge->tmp.p = e; */ /* UNUSED */
 	}
 	
-	BLI_scanfill_calc(&sf_ctx, FALSE);
+	BLI_scanfill_calc(&sf_ctx, 0);
 	
 	for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
 		BMFace *f = BM_face_create_quad_tri(bm,
@@ -214,8 +213,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 	/* clean up fill */
 	BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
 	BMO_op_exec(bm, &bmop);
-	BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
+	BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, ELE_NEW);
 	BMO_op_finish(bm, &bmop);
 	
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
 }
diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.c b/source/blender/bmesh/operators/bmo_unsubdivide.c
new file mode 100644
index 0000000..fae7db3
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_unsubdivide.c
@@ -0,0 +1,59 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_unsubdivide.c
+ *  \ingroup bmesh
+ */
+
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+/* - BMVert.flag & BM_ELEM_TAG:  shows we touched this vert
+ * - BMVert.index == -1:         shows we will remove this vert
+ */
+void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
+{
+	BMVert *v;
+	BMIter iter;
+
+	const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
+
+	BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
+	BMVert **vinput_arr = (BMVert **)vinput->data.buf;
+	int v_index;
+
+	/* tag verts */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		BM_elem_flag_disable(v, BM_ELEM_TAG);
+	}
+	for (v_index = 0; v_index < vinput->len; v_index++) {
+		v = vinput_arr[v_index];
+		BM_elem_flag_enable(v, BM_ELEM_TAG);
+	}
+
+	/* do all the real work here */
+	BM_mesh_decimate_unsubdivide_ex(bm, iterations, TRUE);
+}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 88ed125..64dbf0c 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -45,21 +45,21 @@ void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
 {
 	float vec[3];
 
-	BMO_slot_vec_get(op, "co", vec);
+	BMO_slot_vec_get(op->slots_in, "co", vec);
 
-	BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL), 1);
-	BMO_slot_buffer_from_enabled_flag(bm, op, "newvertout", BM_VERT, 1);
+	BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL, 0), 1);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vert.out", BM_VERT, 1);
 }
 
-void bmo_transform_exec(BMesh *bm, BMOperator *op)
+void bmo_transform_exec(BMesh *UNUSED(bm), BMOperator *op)
 {
 	BMOIter iter;
 	BMVert *v;
 	float mat[4][4];
 
-	BMO_slot_mat4_get(op, "mat", mat);
+	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
 
-	BMO_ITER (v, &iter, bm, op, "verts", BM_VERT) {
+	BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) {
 		mul_m4_v3(mat, v->co);
 	}
 }
@@ -68,33 +68,33 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op)
 {
 	float mat[4][4], vec[3];
 	
-	BMO_slot_vec_get(op, "vec", vec);
+	BMO_slot_vec_get(op->slots_in, "vec", vec);
 
 	unit_m4(mat);
 	copy_v3_v3(mat[3], vec);
 
-	BMO_op_callf(bm, op->flag, "transform mat=%m4 verts=%s", mat, op, "verts");
+	BMO_op_callf(bm, op->flag, "transform matrix=%m4 verts=%s", mat, op, "verts");
 }
 
 void bmo_scale_exec(BMesh *bm, BMOperator *op)
 {
 	float mat[3][3], vec[3];
 	
-	BMO_slot_vec_get(op, "vec", vec);
+	BMO_slot_vec_get(op->slots_in, "vec", vec);
 
 	unit_m3(mat);
 	mat[0][0] = vec[0];
 	mat[1][1] = vec[1];
 	mat[2][2] = vec[2];
 
-	BMO_op_callf(bm, op->flag, "transform mat=%m3 verts=%s", mat, op, "verts");
+	BMO_op_callf(bm, op->flag, "transform matrix=%m3 verts=%s", mat, op, "verts");
 }
 
 void bmo_rotate_exec(BMesh *bm, BMOperator *op)
 {
 	float vec[3];
 	
-	BMO_slot_vec_get(op, "cent", vec);
+	BMO_slot_vec_get(op->slots_in, "cent", vec);
 	
 	/* there has to be a proper matrix way to do this, but
 	 * this is how editmesh did it and I'm too tired to think
@@ -102,7 +102,7 @@ void bmo_rotate_exec(BMesh *bm, BMOperator *op)
 	mul_v3_fl(vec, -1.0f);
 	BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec);
 
-	BMO_op_callf(bm, op->flag, "transform mat=%s verts=%s", op, "mat", op, "verts");
+	BMO_op_callf(bm, op->flag, "transform matrix=%s verts=%s", op, "matrix", op, "verts");
 
 	mul_v3_fl(vec, -1.0f);
 	BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec);
@@ -113,7 +113,7 @@ void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
 	BMOIter siter;
 	BMFace *f;
 
-	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
 		BM_face_normal_flip(bm, f);
 	}
 }
@@ -122,8 +122,8 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
 	BMEdge *e, *e2;
-	int ccw = BMO_slot_bool_get(op, "ccw");
-	int is_single = BMO_slot_buffer_count(bm, op, "edges") == 1;
+	const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
+	const int is_single = BMO_slot_buffer_count(op->slots_in, "edges") == 1;
 	short check_flag = is_single ?
 	            BM_EDGEROT_CHECK_EXISTS :
 	            BM_EDGEROT_CHECK_EXISTS | BM_EDGEROT_CHECK_DEGENERATE;
@@ -131,7 +131,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
 #define EDGE_OUT   1
 #define FACE_TAINT 1
 
-	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		/**
 		 * this ends up being called twice, could add option to not to call check in
 		 * #BM_edge_rotate to get some extra speed */
@@ -144,7 +144,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
 				    BMO_elem_flag_test(bm, fb, FACE_TAINT) == FALSE)
 				{
 
-					if (!(e2 = BM_edge_rotate(bm, e, ccw, check_flag))) {
+					if (!(e2 = BM_edge_rotate(bm, e, use_ccw, check_flag))) {
 #if 0
 						BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
 						return;
@@ -162,7 +162,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT);
 
 #undef EDGE_OUT
 #undef FACE_TAINT
@@ -180,7 +180,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
 	BMOIter siter;
 
 	if (!usefaces) {
-		BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+		BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
 			BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
 				if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
 					if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
@@ -202,7 +202,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
 		BMFace *f, *f2;
 		BMLoop *l;
 
-		BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
+		BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
 			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 				BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
 					if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
@@ -224,7 +224,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
 	BMOIter siter;
 
 	if (!usefaces) {
-		BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+		BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
 			BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
 				if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
 					if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
@@ -248,7 +248,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
 		BMFace *f, *f2;
 		BMLoop *l;
 
-		BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
+		BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
 			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 				BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
 					if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
@@ -265,24 +265,24 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
 
 void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
 {
-	int use_faces = BMO_slot_bool_get(op, "use_faces");
-	int constrict = BMO_slot_bool_get(op, "constrict");
+	int use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
+	int constrict = BMO_slot_bool_get(op->slots_in, "use_constrict");
 
-	BMO_slot_buffer_flag_enable(bm, op, "geom", BM_ALL, SEL_ORIG);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_ALL_NOLOOP, SEL_ORIG);
 
 	if (constrict)
 		bmo_region_extend_constrict(bm, op, use_faces);
 	else
 		bmo_region_extend_extend(bm, op, use_faces);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, SEL_FLAG);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, SEL_FLAG);
 }
 
 /********* righthand faces implementation ****** */
 
 #define FACE_VIS	1
 #define FACE_FLAG	2
-#define FACE_MARK	4
+// #define FACE_MARK	4  /* UNUSED */
 #define FACE_FLIP	8
 
 /* NOTE: these are the original recalc_face_normals comment in editmesh_mods.c,
@@ -314,15 +314,15 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(fstack);
 	BMLoop *l, *l2;
 	float maxx, maxx_test, cent[3];
-	int i, i_max, flagflip = BMO_slot_bool_get(op, "do_flip");
+	int i, i_max, flagflip = BMO_slot_bool_get(op->slots_in, "use_flip");
 
 	startf = NULL;
 	maxx = -1.0e10;
 	
-	BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_FLAG);
+	BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG);
 
 	/* find a starting face */
-	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
 
 		/* clear dirty flag */
 		BM_elem_flag_disable(f, BM_ELEM_TAG);
@@ -405,7 +405,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
 	BLI_array_free(fstack);
 
 	/* check if we have faces yet to do.  if so, recurse */
-	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
 		if (!BMO_elem_flag_test(bm, f, FACE_VIS)) {
 			bmo_recalc_face_normals_exec(bm, op);
 			break;
@@ -413,7 +413,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
 	}
 }
 
-void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
+void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
 {
 	BMOIter siter;
 	BMIter iter;
@@ -421,20 +421,20 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
 	BMEdge *e;
 	BLI_array_declare(cos);
 	float (*cos)[3] = NULL;
-	float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
+	float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
 	int i, j, clipx, clipy, clipz;
 	int xaxis, yaxis, zaxis;
 	
-	clipx = BMO_slot_bool_get(op, "mirror_clip_x");
-	clipy = BMO_slot_bool_get(op, "mirror_clip_y");
-	clipz = BMO_slot_bool_get(op, "mirror_clip_z");
+	clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
+	clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
+	clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
 
-	xaxis = BMO_slot_bool_get(op, "use_axis_x");
-	yaxis = BMO_slot_bool_get(op, "use_axis_y");
-	zaxis = BMO_slot_bool_get(op, "use_axis_z");
+	xaxis = BMO_slot_bool_get(op->slots_in, "use_axis_x");
+	yaxis = BMO_slot_bool_get(op->slots_in, "use_axis_y");
+	zaxis = BMO_slot_bool_get(op->slots_in, "use_axis_z");
 
 	i = 0;
-	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
 		BLI_array_grow_one(cos);
 		co = cos[i];
 		
@@ -454,18 +454,18 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
 		mul_v3_fl(co, 1.0f / (float)j);
 		mid_v3_v3v3(co, co, v->co);
 
-		if (clipx && fabsf(v->co[0]) <= clipdist)
+		if (clipx && fabsf(v->co[0]) <= clip_dist)
 			co[0] = 0.0f;
-		if (clipy && fabsf(v->co[1]) <= clipdist)
+		if (clipy && fabsf(v->co[1]) <= clip_dist)
 			co[1] = 0.0f;
-		if (clipz && fabsf(v->co[2]) <= clipdist)
+		if (clipz && fabsf(v->co[2]) <= clip_dist)
 			co[2] = 0.0f;
 
 		i++;
 	}
 
 	i = 0;
-	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+	BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
 		if (xaxis)
 			v->co[0] = cos[i][0];
 		if (yaxis)
@@ -479,556 +479,21 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
 	BLI_array_free(cos);
 }
 
-/*
- * compute the fake surface of an ngon
- * This is done by decomposing the ngon into triangles who share the centroid of the ngon
- * while this method is far from being exact, it should guarantee an invariance.
- *
- * NOTE: This should probably go to bmesh_polygon.c
- */
-static float ngon_fake_area(BMFace *f)
-{
-	BMIter  liter;
-	BMLoop *l;
-	int     num_verts = 0;
-	float   v[3], sv[3], c[3];
-	float   area = 0.0f;
-
-	BM_face_calc_center_mean(f, c);
-
-	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
-		if (num_verts == 0) {
-			copy_v3_v3(v, l->v->co);
-			copy_v3_v3(sv, l->v->co);
-			num_verts++;
-		}
-		else {
-			area += area_tri_v3(v, c, l->v->co);
-			copy_v3_v3(v, l->v->co);
-			num_verts++;
-		}
-	}
-
-	area += area_tri_v3(v, c, sv);
-
-	return area;
-}
-
-/*
- * extra face data (computed data)
- */
-typedef struct SimSel_FaceExt {
-	BMFace  *f;             /* the face */
-	float    c[3];          /* center */
-	union {
-		float   area;       /* area */
-		float   perim;      /* perimeter */
-		float   d;          /* 4th component of plane (the first three being the normal) */
-		struct Image *t;    /* image pointer */
-	};
-} SimSel_FaceExt;
-
-/*
- * Select similar faces, the choices are in the enum in source/blender/bmesh/bmesh_operators.h
- * We select either similar faces based on material, image, area, perimeter, normal, or the coplanar faces
- */
-void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
-{
-	BMIter fm_iter;
-	BMFace *fs, *fm;
-	BMOIter fs_iter;
-	int num_sels = 0, num_total = 0, i = 0, idx = 0;
-	float angle = 0.0f;
-	SimSel_FaceExt *f_ext = NULL;
-	int *indices = NULL;
-	float t_no[3];	/* temporary normal */
-	int type = BMO_slot_int_get(op, "type");
-	const float thresh = BMO_slot_float_get(op, "thresh");
-	const float thresh_radians = thresh * (float)M_PI;
-
-	num_total = BM_mesh_elem_count(bm, BM_FACE);
-
-	/*
-	 * The first thing to do is to iterate through all the the selected items and mark them since
-	 * they will be in the selection anyway.
-	 * This will increase performance, (especially when the number of originally selected faces is high)
-	 * so the overall complexity will be less than $O(mn)$ where is the total number of selected faces,
-	 * and n is the total number of faces
-	 */
-	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
-		if (!BMO_elem_flag_test(bm, fs, FACE_MARK)) {	/* is this really needed ? */
-			BMO_elem_flag_enable(bm, fs, FACE_MARK);
-			num_sels++;
-		}
-	}
-
-	/* allocate memory for the selected faces indices and for all temporary faces */
-	indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
-	f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c");
-
-	/* loop through all the faces and fill the faces/indices structure */
-	BM_ITER_MESH (fm, &fm_iter, bm, BM_FACES_OF_MESH) {
-		f_ext[i].f = fm;
-		if (BMO_elem_flag_test(bm, fm, FACE_MARK)) {
-			indices[idx] = i;
-			idx++;
-		}
-		i++;
-	}
-
-	/*
-	 * Save us some computation burden: In case of perimeter/area/coplanar selection we compute
-	 * only once.
-	 */
-	if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE) {
-		for (i = 0; i < num_total; i++) {
-			switch (type) {
-				case SIMFACE_PERIMETER:
-					/* set the perimeter */
-					f_ext[i].perim = BM_face_calc_perimeter(f_ext[i].f);
-					break;
-
-				case SIMFACE_COPLANAR:
-					/* compute the center of the polygon */
-					BM_face_calc_center_mean(f_ext[i].f, f_ext[i].c);
-
-					/* normalize the polygon normal */
-					copy_v3_v3(t_no, f_ext[i].f->no);
-					normalize_v3(t_no);
-
-					/* compute the plane distance */
-					f_ext[i].d = dot_v3v3(t_no, f_ext[i].c);
-					break;
-
-				case SIMFACE_AREA:
-					f_ext[i].area = ngon_fake_area(f_ext[i].f);
-					break;
-
-				case SIMFACE_IMAGE:
-					f_ext[i].t = NULL;
-					if (CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY)) {
-						MTexPoly *mtpoly = CustomData_bmesh_get(&bm->pdata, f_ext[i].f->head.data, CD_MTEXPOLY);
-						f_ext[i].t = mtpoly->tpage;
-					}
-					break;
-			}
-		}
-	}
-
-	/* now select the rest (if any) */
-	for (i = 0; i < num_total; i++) {
-		fm = f_ext[i].f;
-		if (!BMO_elem_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) {
-			int cont = TRUE;
-			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
-				fs = f_ext[indices[idx]].f;
-				switch (type) {
-					case SIMFACE_MATERIAL:
-						if (fm->mat_nr == fs->mat_nr) {
-							BMO_elem_flag_enable(bm, fm, FACE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMFACE_IMAGE:
-						if (f_ext[i].t == f_ext[indices[idx]].t) {
-							BMO_elem_flag_enable(bm, fm, FACE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMFACE_NORMAL:
-						angle = angle_normalized_v3v3(fs->no, fm->no);	/* if the angle between the normals -> 0 */
-						if (angle <= thresh_radians) {
-							BMO_elem_flag_enable(bm, fm, FACE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMFACE_COPLANAR:
-						angle = angle_normalized_v3v3(fs->no, fm->no); /* angle -> 0 */
-						if (angle <= thresh_radians) { /* and dot product difference -> 0 */
-							if (fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh) {
-								BMO_elem_flag_enable(bm, fm, FACE_MARK);
-								cont = FALSE;
-							}
-						}
-						break;
-
-					case SIMFACE_AREA:
-						if (fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh) {
-							BMO_elem_flag_enable(bm, fm, FACE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMFACE_PERIMETER:
-						if (fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh) {
-							BMO_elem_flag_enable(bm, fm, FACE_MARK);
-							cont = FALSE;
-						}
-						break;
-				}
-			}
-		}
-	}
-
-	MEM_freeN(f_ext);
-	MEM_freeN(indices);
-
-	/* transfer all marked faces to the output slot */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_MARK);
-}
-
-/**************************************************************************** *
- * Similar Edges
- **************************************************************************** */
-#define EDGE_MARK 1
-
-/*
- * extra edge information
- */
-typedef struct SimSel_EdgeExt {
-	BMEdge *e;
-	union {
-		float dir[3];
-		float angle;            /* angle between the face */
-	};
-
-	union {
-		float length;           /* edge length */
-		int   faces;            /* faces count */
-	};
-} SimSel_EdgeExt;
-
-/*
- * select similar edges: the choices are in the enum in source/blender/bmesh/bmesh_operators.h
- * choices are length, direction, face, ...
- */
-void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
-{
-	BMOIter es_iter;	/* selected edges iterator */
-	BMIter e_iter;		/* mesh edges iterator */
-	BMEdge *es;		/* selected edge */
-	BMEdge *e;		/* mesh edge */
-	int idx = 0, i = 0 /* , f = 0 */;
-	int *indices = NULL;
-	SimSel_EdgeExt *e_ext = NULL;
-	// float *angles = NULL;
-	float angle;
-
-	int num_sels = 0, num_total = 0;
-	int type = BMO_slot_int_get(op, "type");
-	const float thresh = BMO_slot_float_get(op, "thresh");
-
-	/* sanity checks that the data we need is available */
-	switch (type) {
-		case SIMEDGE_CREASE:
-			if (!CustomData_has_layer(&bm->edata, CD_CREASE)) {
-				return;
-			}
-			break;
-		case SIMEDGE_BEVEL:
-			if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) {
-				return;
-			}
-			break;
-	}
-
-	num_total = BM_mesh_elem_count(bm, BM_EDGE);
-
-	/* iterate through all selected edges and mark them */
-	BMO_ITER (es, &es_iter, bm, op, "edges", BM_EDGE) {
-		BMO_elem_flag_enable(bm, es, EDGE_MARK);
-		num_sels++;
-	}
-
-	/* allocate memory for the selected edges indices and for all temporary edges */
-	indices = (int *)MEM_callocN(sizeof(int) * num_sels, __func__);
-	e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, __func__);
-
-	/* loop through all the edges and fill the edges/indices structure */
-	BM_ITER_MESH (e, &e_iter, bm, BM_EDGES_OF_MESH) {
-		e_ext[i].e = e;
-		if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
-			indices[idx] = i;
-			idx++;
-		}
-		i++;
-	}
-
-	/* save us some computation time by doing heavy computation once */
-	if (type == SIMEDGE_LENGTH || type == SIMEDGE_FACE || type == SIMEDGE_DIR || type == SIMEDGE_FACE_ANGLE) {
-		for (i = 0; i < num_total; i++) {
-			switch (type) {
-				case SIMEDGE_LENGTH:	/* compute the length of the edge */
-					e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
-					break;
-
-				case SIMEDGE_DIR:		/* compute the direction */
-					sub_v3_v3v3(e_ext[i].dir, e_ext[i].e->v1->co, e_ext[i].e->v2->co);
-					normalize_v3(e_ext[i].dir);
-					break;
-
-				case SIMEDGE_FACE:		/* count the faces around the edge */
-					e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
-					break;
-
-				case SIMEDGE_FACE_ANGLE:
-					e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
-					if (e_ext[i].faces == 2)
-						e_ext[i].angle = BM_edge_calc_face_angle(e_ext[i].e);
-					break;
-			}
-		}
-	}
-
-	/* select the edges if any */
-	for (i = 0; i < num_total; i++) {
-		e = e_ext[i].e;
-		if (!BMO_elem_flag_test(bm, e, EDGE_MARK) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
-			int cont = TRUE;
-			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
-				es = e_ext[indices[idx]].e;
-				switch (type) {
-					case SIMEDGE_LENGTH:
-						if (fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh) {
-							BMO_elem_flag_enable(bm, e, EDGE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMEDGE_DIR:
-						/* compute the angle between the two edges */
-						angle = angle_normalized_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir);
-
-						if (angle > (float)(M_PI / 2.0)) /* use the smallest angle between the edges */
-							angle = fabsf(angle - (float)M_PI);
-
-						if (angle / (float)(M_PI / 2.0) <= thresh) {
-							BMO_elem_flag_enable(bm, e, EDGE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMEDGE_FACE:
-						if (e_ext[i].faces == e_ext[indices[idx]].faces) {
-							BMO_elem_flag_enable(bm, e, EDGE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMEDGE_FACE_ANGLE:
-						if (e_ext[i].faces == 2) {
-							if (e_ext[indices[idx]].faces == 2) {
-								if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
-									BMO_elem_flag_enable(bm, e, EDGE_MARK);
-									cont = FALSE;
-								}
-							}
-						}
-						else {
-							cont = FALSE;
-						}
-						break;
-
-					case SIMEDGE_CREASE:
-						{
-							float *c1, *c2;
-
-							c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
-							c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
-
-							if (fabsf(*c1 - *c2) <= thresh) {
-								BMO_elem_flag_enable(bm, e, EDGE_MARK);
-								cont = FALSE;
-							}
-						}
-						break;
-
-					case SIMEDGE_BEVEL:
-						{
-							float *c1, *c2;
-
-							c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BWEIGHT);
-							c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_BWEIGHT);
-
-							if (fabsf(*c1 - *c2) <= thresh) {
-								BMO_elem_flag_enable(bm, e, EDGE_MARK);
-								cont = FALSE;
-							}
-						}
-						break;
-
-					case SIMEDGE_SEAM:
-						if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) {
-							BMO_elem_flag_enable(bm, e, EDGE_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMEDGE_SHARP:
-						if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) {
-							BMO_elem_flag_enable(bm, e, EDGE_MARK);
-							cont = FALSE;
-						}
-						break;
-				}
-			}
-		}
-	}
-
-	MEM_freeN(e_ext);
-	MEM_freeN(indices);
-
-	/* transfer all marked edges to the output slot */
-	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_MARK);
-}
-
-/**************************************************************************** *
- * Similar Vertices
- **************************************************************************** */
-#define VERT_MARK	1
-
-typedef struct SimSel_VertExt {
-	BMVert *v;
-	union {
-		int num_faces; /* adjacent faces */
-		int num_edges; /* adjacent edges */
-		MDeformVert *dvert; /* deform vertex */
-	};
-} SimSel_VertExt;
-
-/*
- * select similar vertices: the choices are in the enum in source/blender/bmesh/bmesh_operators.h
- * choices are normal, face, vertex group...
- */
-void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
-{
-	BMOIter vs_iter;	/* selected verts iterator */
-	BMIter v_iter;		/* mesh verts iterator */
-	BMVert *vs;		/* selected vertex */
-	BMVert *v;			/* mesh vertex */
-	SimSel_VertExt *v_ext = NULL;
-	int *indices = NULL;
-	int num_total = 0, num_sels = 0, i = 0, idx = 0;
-	int type = BMO_slot_int_get(op, "type");
-	const float thresh = BMO_slot_float_get(op, "thresh");
-	const float thresh_radians = thresh * (float)M_PI;
-
-	num_total = BM_mesh_elem_count(bm, BM_VERT);
-
-	/* iterate through all selected edges and mark them */
-	BMO_ITER (vs, &vs_iter, bm, op, "verts", BM_VERT) {
-		BMO_elem_flag_enable(bm, vs, VERT_MARK);
-		num_sels++;
-	}
-
-	/* allocate memory for the selected vertices indices and for all temporary vertices */
-	indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
-	v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra");
-
-	/* loop through all the vertices and fill the vertices/indices structure */
-	BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) {
-		v_ext[i].v = v;
-		if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
-			indices[idx] = i;
-			idx++;
-		}
-
-		switch (type) {
-			case SIMVERT_FACE:
-				/* calling BM_vert_face_count every time is time consumming, so call it only once per vertex */
-				v_ext[i].num_faces = BM_vert_face_count(v);
-				break;
-
-			case SIMVERT_VGROUP:
-				if (CustomData_has_layer(&(bm->vdata), CD_MDEFORMVERT)) {
-					v_ext[i].dvert = CustomData_bmesh_get(&bm->vdata, v_ext[i].v->head.data, CD_MDEFORMVERT);
-				}
-				else {
-					v_ext[i].dvert = NULL;
-				}
-				break;
-			case SIMVERT_EDGE:
-				v_ext[i].num_edges = BM_vert_edge_count(v);
-				break;
-		}
-
-		i++;
-	}
-
-	/* select the vertices if any */
-	for (i = 0; i < num_total; i++) {
-		v = v_ext[i].v;
-		if (!BMO_elem_flag_test(bm, v, VERT_MARK) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
-			int cont = TRUE;
-			for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
-				vs = v_ext[indices[idx]].v;
-				switch (type) {
-					case SIMVERT_NORMAL:
-						/* compare the angle between the normals */
-						if (angle_normalized_v3v3(v->no, vs->no) <= thresh_radians) {
-							BMO_elem_flag_enable(bm, v, VERT_MARK);
-							cont = FALSE;
-						}
-						break;
-					case SIMVERT_FACE:
-						/* number of adjacent faces */
-						if (v_ext[i].num_faces == v_ext[indices[idx]].num_faces) {
-							BMO_elem_flag_enable(bm, v, VERT_MARK);
-							cont = FALSE;
-						}
-						break;
-
-					case SIMVERT_VGROUP:
-						if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
-							int v1, v2;
-							for (v1 = 0; v1 < v_ext[i].dvert->totweight && cont == 1; v1++) {
-								for (v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++) {
-									if (v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr) {
-										BMO_elem_flag_enable(bm, v, VERT_MARK);
-										cont = FALSE;
-										break;
-									}
-								}
-							}
-						}
-						break;
-					case SIMVERT_EDGE:
-						/* number of adjacent edges */
-						if (v_ext[i].num_edges == v_ext[indices[idx]].num_edges) {
-							BMO_elem_flag_enable(bm, v, VERT_MARK);
-							cont = FALSE;
-						}
-						break;
-				}
-			}
-		}
-	}
-
-	MEM_freeN(indices);
-	MEM_freeN(v_ext);
-
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
-}
-
 /**************************************************************************** *
  * Cycle UVs for a face
  **************************************************************************** */
 
 void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
 {
-	BMOIter fs_iter;	/* selected faces iterator */
-	BMFace *fs;	/* current face */
-	BMIter l_iter;	/* iteration loop */
-	// int n;
+	BMOIter fs_iter;  /* selected faces iterator */
+	BMFace *fs;       /* current face */
+	BMIter l_iter;    /* iteration loop */
 
-	int dir = BMO_slot_int_get(op, "dir");
+	const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
 
-	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
 		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
-			if (dir == DIRECTION_CW) { /* same loops direction */
+			if (use_ccw == FALSE) {  /* same loops direction */
 				BMLoop *lf;	/* current face loops */
 				MLoopUV *f_luv; /* first face loop uv */
 				float p_uv[2];	/* previous uvs */
@@ -1052,7 +517,7 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
 
 				copy_v2_v2(f_luv->uv, p_uv);
 			}
-			else if (dir == DIRECTION_CCW) { /* counter loop direction */
+			else { /* counter loop direction */
 				BMLoop *lf;	/* current face loops */
 				MLoopUV *p_luv; /* previous loop uv */
 				MLoopUV *luv;
@@ -1077,7 +542,6 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
 			}
 		}
 	}
-
 }
 
 /**************************************************************************** *
@@ -1092,7 +556,7 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(uvs);
 	float (*uvs)[2] = NULL;
 
-	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
 		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
 			BMLoop *lf;	/* current face loops */
 			int i;
@@ -1126,16 +590,15 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
 
 void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
 {
-	BMOIter fs_iter;	/* selected faces iterator */
-	BMFace *fs;	/* current face */
-	BMIter l_iter;	/* iteration loop */
-	// int n;
+	BMOIter fs_iter;  /* selected faces iterator */
+	BMFace *fs;       /* current face */
+	BMIter l_iter;    /* iteration loop */
 
-	int dir = BMO_slot_int_get(op, "dir");
+	const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
 
-	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
 		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
-			if (dir == DIRECTION_CW) { /* same loops direction */
+			if (use_ccw == FALSE) {  /* same loops direction */
 				BMLoop *lf;	/* current face loops */
 				MLoopCol *f_lcol; /* first face loop color */
 				MLoopCol p_col;	/* previous color */
@@ -1159,7 +622,7 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
 
 				*f_lcol = p_col;
 			}
-			else if (dir == DIRECTION_CCW) { /* counter loop direction */
+			else {  /* counter loop direction */
 				BMLoop *lf;	/* current face loops */
 				MLoopCol *p_lcol; /* previous loop color */
 				MLoopCol *lcol;
@@ -1198,7 +661,7 @@ void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
 	BLI_array_declare(cols);
 	MLoopCol *cols = NULL;
 
-	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
 		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
 			BMLoop *lf;	/* current face loops */
 			int i;
@@ -1234,25 +697,22 @@ typedef struct ElemNode {
 	HeapNode *hn;	/* heap node */
 } ElemNode;
 
+#define VERT_MARK	1
+
 void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
 {
-	BMOIter vs_iter /* , vs2_iter */;	/* selected verts iterator */
 	BMIter v_iter;		/* mesh verts iterator */
-	BMVert *vs, *sv, *ev;	/* starting vertex, ending vertex */
+	BMVert *sv, *ev;	/* starting vertex, ending vertex */
 	BMVert *v;		/* mesh vertex */
 	Heap *h = NULL;
 
 	ElemNode *vert_list = NULL;
 
 	int num_total = 0 /*, num_sels = 0 */, i = 0;
-	int type = BMO_slot_int_get(op, "type");
+	const int type = BMO_slot_int_get(op->slots_in, "type");
 
-	BMO_ITER (vs, &vs_iter, bm, op, "startv", BM_VERT) {
-		sv = vs;
-	}
-	BMO_ITER (vs, &vs_iter, bm, op, "endv", BM_VERT) {
-		ev = vs;
-	}
+	sv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_start"));
+	ev = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_end"));
 
 	num_total = BM_mesh_elem_count(bm, BM_VERT);
 
@@ -1284,7 +744,7 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
 		vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
 	}
 
-	while (!BLI_heap_empty(h)) {
+	while (!BLI_heap_is_empty(h)) {
 		BMEdge *e;
 		BMIter e_i;
 		float v_weight;
@@ -1330,5 +790,5 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
 	BLI_heap_free(h, NULL);
 	MEM_freeN(vert_list);
 
-	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
 }
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
index d572a1c..7401704 100644
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ b/source/blender/bmesh/operators/bmo_wireframe.c
@@ -77,39 +77,60 @@ static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3
 		}
 	}
 
-	l_a = bm_edge_tag_faceloop(e_a);
-	l_b = bm_edge_tag_faceloop(e_b);
+	if (e_a && e_b) {
+		l_a = bm_edge_tag_faceloop(e_a);
+		l_b = bm_edge_tag_faceloop(e_b);
+
+		/* average edge face normal */
+		add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
+
+		/* average edge direction */
+		v_a = BM_edge_other_vert(e_a, v);
+		v_b = BM_edge_other_vert(e_b, v);
+
+		sub_v3_v3v3(tvec_a, v->co, v_a->co);
+		sub_v3_v3v3(tvec_b, v_b->co, v->co);
+		normalize_v3(tvec_a);
+		normalize_v3(tvec_b);
+		add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
+
+		/* check are we flipped the right way */
+		BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
+		BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
+		add_v3_v3(tvec_a, tvec_b);
+
+		*r_va_other = v_a;
+		*r_vb_other = v_b;
+	}
+	else {
+		/* degenerate case - vertex connects a boundary edged face to other faces,
+		 * so we have only one boundary face - only use it for calculations */
+		l_a = bm_edge_tag_faceloop(e_a);
 
-	/* average edge face normal */
-	add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
+		copy_v3_v3(no_face, l_a->f->no);
 
-	/* average edge direction */
-	v_a = BM_edge_other_vert(e_a, v);
-	v_b = BM_edge_other_vert(e_b, v);
+		/* edge direction */
+		v_a = BM_edge_other_vert(e_a, v);
+		v_b = NULL;
 
-	sub_v3_v3v3(tvec_a, v->co, v_a->co);
-	sub_v3_v3v3(tvec_b, v_b->co, v->co);
-	normalize_v3(tvec_a);
-	normalize_v3(tvec_b);
-	add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
+		sub_v3_v3v3(no_edge, v->co, v_a->co);
 
+		/* check are we flipped the right way */
+		BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
+
+		*r_va_other = NULL;
+		*r_vb_other = NULL;
+	}
 
 	/* find the normal */
 	cross_v3_v3v3(r_no, no_edge, no_face);
 	normalize_v3(r_no);
 
-	/* check are we flipped the right way */
-	BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
-	BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
-	add_v3_v3(tvec_a, tvec_b);
-
 	if (dot_v3v3(r_no, tvec_a) > 0.0f) {
 		negate_v3(r_no);
 	}
 
 	copy_v3_v3(r_no_face, no_face);
-	*r_va_other = v_a;
-	*r_vb_other = v_b;
 }
 
 /* check if we are the only tagged loop-face around this edge */
@@ -134,12 +155,12 @@ extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
 
 void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 {
-	const int use_boundary        = BMO_slot_bool_get(op,  "use_boundary");
-	const int use_even_offset     = BMO_slot_bool_get(op,  "use_even_offset");
-	const int use_relative_offset = BMO_slot_bool_get(op,  "use_relative_offset");
-	const int use_crease          = (BMO_slot_bool_get(op,  "use_crease") &&
+	const int use_boundary        = BMO_slot_bool_get(op->slots_in,  "use_boundary");
+	const int use_even_offset     = BMO_slot_bool_get(op->slots_in,  "use_even_offset");
+	const int use_relative_offset = BMO_slot_bool_get(op->slots_in,  "use_relative_offset");
+	const int use_crease          = (BMO_slot_bool_get(op->slots_in,  "use_crease") &&
 	                                 CustomData_has_layer(&bm->edata, CD_CREASE));
-	const float depth             = BMO_slot_float_get(op, "thickness");
+	const float depth             = BMO_slot_float_get(op->slots_in, "thickness");
 	const float inset             = depth;
 
 	const int totvert_orig = bm->totvert;
@@ -184,7 +205,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 	/* setup tags, all faces and verts will be tagged which will be duplicated */
 	BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
 
-	BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
 		verts_loop_tot += f_src->len;
 		BM_elem_flag_enable(f_src, BM_ELEM_TAG);
 		BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
@@ -206,9 +227,9 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 			}
 
 			madd_v3_v3v3fl(tvec, v_src->co, v_src->no, -fac);
-			verts_neg[i] = BM_vert_create(bm, tvec, v_src);
+			verts_neg[i] = BM_vert_create(bm, tvec, v_src, 0);
 			madd_v3_v3v3fl(tvec, v_src->co, v_src->no,  fac);
-			verts_pos[i] = BM_vert_create(bm, tvec, v_src);
+			verts_pos[i] = BM_vert_create(bm, tvec, v_src, 0);
 		}
 		else {
 			/* could skip this */
@@ -230,7 +251,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 	verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
 	verts_loop_tot = 0; /* count up again */
 
-	BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
 		BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
 			BM_elem_index_set(l, verts_loop_tot); /* set_loop */
 
@@ -246,7 +267,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 			}
 
 			madd_v3_v3v3fl(tvec, l->v->co, tvec, fac);
-			verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v);
+			verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v, 0);
 
 
 			if (use_boundary) {
@@ -269,16 +290,18 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 							/* similar to code above but different angle calc */
 							fac = inset;
 							if (use_even_offset) {
-								fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
-								                                                                  l_pair[i]->v->co,
-								                                                                  vb_other->co,
-								                                                                  no_face)) * 0.5f);
+								if (va_other) {  /* for verts with only one boundary edge - this will be NULL */
+									fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
+									                                                                  l_pair[i]->v->co,
+									                                                                  vb_other->co,
+									                                                                  no_face)) * 0.5f);
+								}
 							}
 							if (use_relative_offset) {
 								fac *= verts_relfac[BM_elem_index_get(l_pair[i]->v)];
 							}
 							madd_v3_v3v3fl(tvec, l_pair[i]->v->co, tvec, fac);
-							verts_boundary[BM_elem_index_get(l_pair[i]->v)] = BM_vert_create(bm, tvec, l_pair[i]->v);
+							verts_boundary[BM_elem_index_get(l_pair[i]->v)] = BM_vert_create(bm, tvec, l_pair[i]->v, 0);
 						}
 					}
 				}
@@ -288,7 +311,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 		}
 	}
 
-	BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+	BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
 		BM_elem_flag_disable(f_src, BM_ELEM_TAG);
 		BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
 			BMFace *f_new;
@@ -400,5 +423,5 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
 	MEM_freeN(verts_pos);
 	MEM_freeN(verts_loop);
 
-	BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, BM_ELEM_TAG);
+	BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
 }
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index 98f270a..3f2ca21 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -689,8 +689,16 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM
 		         BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) &&
 		         !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_BEVEL))
 		{
-			max = 1.0f;
-			l = BME_bevel_vert(bm, l, value, options, up_vec, td);
+			/* avoid making double vertices [#33438] */
+			BME_TransData *vtd;
+			vtd = BME_get_transdata(td, l->v);
+			if (vtd->weight == 0.0f) {
+				BMO_elem_flag_disable(bm, l->v, BME_BEVEL_BEVEL);
+			}
+			else {
+				max = 1.0f;
+				l = BME_bevel_vert(bm, l, value, options, up_vec, td);
+			}
 		}
 	}
 
@@ -1096,10 +1104,9 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
 	return bm;
 }
 
-BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle,
-                 BME_TransData_Head **rtd, int do_tessface)
+BMesh *BME_bevel(BMesh *bm, float value, int res, int options, int defgrp_index, float angle,
+                 BME_TransData_Head **rtd)
 {
-	BMesh *bm = em->bm;
 	BMVert *v;
 	BMIter iter;
 
@@ -1111,10 +1118,13 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
 	td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE);
 	/* recursion math courtesy of Martin Poirier (theeth) */
 	for (i = 0; i < res - 1; i++) {
-		if (i == 0) fac += 1.0 / 3.0; else fac += 1.0 / (3.0 * i * 2.0);
+		if (i == 0) fac += 1.0 / 3.0;
+		else        fac += 1.0 / (3.0 * i * 2.0);
 	}
 	d = 1.0 / fac;
 
+	BM_mesh_elem_toolflags_ensure(bm);
+
 	for (i = 0; i < res || (res == 0 && i == 0); i++) {
 		BMO_push(bm, NULL);
 		BME_bevel_initialize(bm, options, defgrp_index, angle, td);
@@ -1126,12 +1136,6 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
 		BMO_pop(bm);
 	}
 
-	/* possibly needed when running as a tool (which is no longer functional)
-	 * but keep as an option for now */
-	if (do_tessface) {
-		BMEdit_RecalcTessellation(em);
-	}
-
 	/* interactive preview? */
 	if (rtd) {
 		*rtd = td;
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
new file mode 100644
index 0000000..9125800
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -0,0 +1,1835 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s):
+ *         Joseph Eagar,
+ *         Aleksandr Mokhov,
+ *         Howard Trickey,
+ *         Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_bevel.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+#include "BLI_memarena.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+
+
+
+/* experemental - Campbell */
+// #define USE_ALTERNATE_ADJ
+
+#define BEVEL_EPSILON  1e-6
+
+/* for testing */
+// #pragma GCC diagnostic error "-Wpadded"
+
+/* Constructed vertex, sometimes later instantiated as BMVert */
+typedef struct NewVert {
+	BMVert *v;
+	float co[3];
+//	int _pad;
+} NewVert;
+
+struct BoundVert;
+
+/* Data for one end of an edge involved in a bevel */
+typedef struct EdgeHalf {
+	struct EdgeHalf *next, *prev;   /* in CCW order */
+	BMEdge *e;                  /* original mesh edge */
+	BMFace *fprev;              /* face between this edge and previous, if any */
+	BMFace *fnext;              /* face between this edge and next, if any */
+	struct BoundVert *leftv;    /* left boundary vert (looking along edge to end) */
+	struct BoundVert *rightv;   /* right boundary vert, if beveled */
+	short is_bev;               /* is this edge beveled? */
+	short is_rev;               /* is e->v2 the vertex at this end? */
+	int   seg;                  /* how many segments for the bevel */
+	float offset;               /* offset for this edge */
+//	int _pad;
+} EdgeHalf;
+
+/* An element in a cyclic boundary of a Vertex Mesh (VMesh) */
+typedef struct BoundVert {
+	struct BoundVert *next, *prev;  /* in CCW order */
+	NewVert nv;
+	EdgeHalf *efirst;   /* first of edges attached here: in CCW order */
+	EdgeHalf *elast;
+	EdgeHalf *ebev;     /* beveled edge whose left side is attached here, if any */
+	int index;          /* used for vmesh indexing */
+//	int _pad;
+} BoundVert;
+
+/* Mesh structure replacing a vertex */
+typedef struct VMesh {
+	NewVert *mesh;           /* allocated array - size and structure depends on kind */
+	BoundVert *boundstart;   /* start of boundary double-linked list */
+	int count;               /* number of vertices in the boundary */
+	int seg;                 /* common # of segments for segmented edges */
+	enum {
+		M_NONE,         /* no polygon mesh needed */
+		M_POLY,         /* a simple polygon */
+		M_ADJ,          /* "adjacent edges" mesh pattern */
+//		M_CROSS,        /* "cross edges" mesh pattern */
+		M_TRI_FAN,      /* a simple polygon - fan filled */
+		M_QUAD_STRIP,   /* a simple polygon - cut into paralelle strips */
+	} mesh_kind;
+//	int _pad;
+} VMesh;
+
+/* Data for a vertex involved in a bevel */
+typedef struct BevVert {
+	BMVert *v;          /* original mesh vertex */
+	int edgecount;          /* total number of edges around the vertex */
+	int selcount;           /* number of selected edges around the vertex */
+	EdgeHalf *edges;        /* array of size edgecount; CCW order from vertex normal side */
+	VMesh *vmesh;           /* mesh structure for replacing vertex */
+} BevVert;
+
+/* Bevel parameters and state */
+typedef struct BevelParams {
+	/* hash of BevVert for each vertex involved in bevel
+	 * GHash: (key=(BMVert *), value=(BevVert *)) */
+	GHash    *vert_hash;
+	MemArena *mem_arena;    /* use for all allocs while bevel runs, if we need to free we can switch to mempool */
+
+	float offset;           /* blender units to offset each side of a beveled edge */
+	int seg;                /* number of segments in beveled edge profile */
+} BevelParams;
+
+// #pragma GCC diagnostic ignored "-Wpadded"
+
+//#include "bevdebug.c"
+
+/* Make a new BoundVert of the given kind, insert it at the end of the circular linked
+ * list with entry point bv->boundstart, and return it. */
+static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const float co[3])
+{
+	BoundVert *ans = (BoundVert *)BLI_memarena_alloc(mem_arena, sizeof(BoundVert));
+
+	copy_v3_v3(ans->nv.co, co);
+	if (!vm->boundstart) {
+		ans->index = 0;
+		vm->boundstart = ans;
+		ans->next = ans->prev = ans;
+	}
+	else {
+		BoundVert *tail = vm->boundstart->prev;
+		ans->index = tail->index + 1;
+		ans->prev = tail;
+		ans->next = vm->boundstart;
+		tail->next = ans;
+		vm->boundstart->prev = ans;
+	}
+	vm->count++;
+	return ans;
+}
+
+/* Mesh verts are indexed (i, j, k) where
+ * i = boundvert index (0 <= i < nv)
+ * j = ring index (0 <= j <= ns2)
+ * k = segment index (0 <= k <= ns)
+ * Not all of these are used, and some will share BMVerts */
+static NewVert *mesh_vert(VMesh *vm, int i, int j, int k)
+{
+	int nj = (vm->seg / 2) + 1;
+	int nk = vm->seg + 1;
+
+	return &vm->mesh[i * nk * nj  + j * nk + k];
+}
+
+static void create_mesh_bmvert(BMesh *bm, VMesh *vm, int i, int j, int k, BMVert *eg)
+{
+	NewVert *nv = mesh_vert(vm, i, j, k);
+	nv->v = BM_vert_create(bm, nv->co, eg, 0);
+}
+
+static void copy_mesh_vert(VMesh *vm, int ito, int jto, int kto,
+                           int ifrom, int jfrom, int kfrom)
+{
+	NewVert *nvto, *nvfrom;
+
+	nvto = mesh_vert(vm, ito, jto, kto);
+	nvfrom = mesh_vert(vm, ifrom, jfrom, kfrom);
+	nvto->v = nvfrom->v;
+	copy_v3_v3(nvto->co, nvfrom->co);
+}
+
+/* find the EdgeHalf in bv's array that has edge bme */
+static EdgeHalf *find_edge_half(BevVert *bv, BMEdge *bme)
+{
+	int i;
+
+	for (i = 0; i < bv->edgecount; i++) {
+		if (bv->edges[i].e == bme)
+			return &bv->edges[i];
+	}
+	return NULL;
+}
+
+/* Return the next EdgeHalf after from_e that is beveled.
+ * If from_e is NULL, find the first beveled edge. */
+static EdgeHalf *next_bev(BevVert *bv, EdgeHalf *from_e)
+{
+	EdgeHalf *e;
+
+	if (from_e == NULL)
+		from_e = &bv->edges[bv->edgecount - 1];
+	e = from_e;
+	do {
+		if (e->is_bev) {
+			return e;
+		}
+	} while ((e = e->next) != from_e);
+	return NULL;
+}
+
+/* find the BevVert corresponding to BMVert bmv */
+static BevVert *find_bevvert(BevelParams *bp, BMVert *bmv)
+{
+	return BLI_ghash_lookup(bp->vert_hash, bmv);
+}
+
+/* Return a good respresentative face (for materials, etc.) for faces
+ * created around/near BoundVert v */
+static BMFace *boundvert_rep_face(BoundVert *v)
+{
+	BMFace *fans = NULL;
+	BMFace *firstf = NULL;
+	BMEdge *e1, *e2;
+	BMFace *f1, *f2;
+	BMIter iter1, iter2;
+
+	BLI_assert(v->efirst != NULL && v->elast != NULL);
+	e1 = v->efirst->e;
+	e2 = v->elast->e;
+	BM_ITER_ELEM (f1, &iter1, e1, BM_FACES_OF_EDGE) {
+		if (!firstf)
+			firstf = f1;
+		BM_ITER_ELEM (f2, &iter2, e2, BM_FACES_OF_EDGE) {
+			if (f1 == f2) {
+				fans = f1;
+				break;
+			}
+		}
+	}
+	if (!fans)
+		fans = firstf;
+
+	return fans;
+}
+
+/**
+ * Make ngon from verts alone.
+ * Make sure to properly copy face attributes and do custom data interpolation from
+ * example face, facerep.
+ *
+ * \note ALL face creation goes through this function, this is important to keep!
+ */
+static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, const int totv, BMFace *facerep)
+{
+	BMIter iter;
+	BMLoop *l;
+	BMFace *f;
+
+	if (totv == 3) {
+		f = BM_face_create_quad_tri_v(bm, vert_arr, 3, facerep, FALSE);
+	}
+	else if (totv == 4) {
+		f = BM_face_create_quad_tri_v(bm, vert_arr, 4, facerep, FALSE);
+	}
+	else {
+		int i;
+		BMEdge **ee = NULL;
+		BLI_array_fixedstack_declare(ee, BM_DEFAULT_NGON_STACK_SIZE, totv, __func__);
+
+		for (i = 0; i < totv; i++) {
+			ee[i] = BM_edge_create(bm, vert_arr[i], vert_arr[(i + 1) % totv], NULL, BM_CREATE_NO_DOUBLE);
+		}
+		f = BM_face_create_ngon(bm, vert_arr[0], vert_arr[1], ee, totv, 0);
+		BLI_array_fixedstack_free(ee);
+	}
+	if (facerep && f) {
+		int has_mdisps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
+		BM_elem_attrs_copy(bm, bm, facerep, f);
+		BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+			BM_loop_interp_from_face(bm, l, facerep, TRUE, TRUE);
+			if (has_mdisps)
+				BM_loop_interp_multires(bm, l, facerep);
+		}
+	}
+
+	/* not essential for bevels own internal logic,
+	 * this is done so the operator can select newly created faces */
+	if (f) {
+		BM_elem_flag_enable(f, BM_ELEM_TAG);
+	}
+
+	return f;
+}
+
+static BMFace *bev_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
+                                   BMFace *facerep)
+{
+	BMVert *varr[4] = {v1, v2, v3, v4};
+	return bev_create_ngon(bm, varr, v4 ? 4 : 3, facerep);
+}
+
+/*
+ * Calculate the meeting point between the offset edges for e1 and e2, putting answer in meetco.
+ * e1 and e2 share vertex v and face f (may be NULL) and viewed from the normal side of
+ * the bevel vertex,  e1 precedes e2 in CCW order.
+ * If on_right is true, offset edge is on right of both edges, where e1 enters v and
+ * e2 leave it. If on_right is false, then the offset edge is on the left.
+ * When offsets are equal, the new point is on the edge bisector, with length offset/sin(angle/2),
+ * but if the offsets are not equal (allowing for this, as bevel modifier has edge weights that may
+ * lead to different offsets) then meeting point can be found be intersecting offset lines.
+ */
+static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
+                        int on_right, float meetco[3])
+{
+	float dir1[3], dir2[3], norm_v[3], norm_perp1[3], norm_perp2[3],
+	      off1a[3], off1b[3], off2a[3], off2b[3], isect2[3];
+
+	/* get direction vectors for two offset lines */
+	sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
+	sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co);
+
+	if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+		/* special case: e1 and e2 are parallel; put offset point perp to both, from v.
+		 * need to find a suitable plane.
+		 * if offsets are different, we're out of luck: just use e1->offset */
+		if (f)
+			copy_v3_v3(norm_v, f->no);
+		else
+			copy_v3_v3(norm_v, v->no);
+		cross_v3_v3v3(norm_perp1, dir1, norm_v);
+		normalize_v3(norm_perp1);
+		copy_v3_v3(off1a, v->co);
+		madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+		copy_v3_v3(meetco, off1a);
+	}
+	else {
+		/* get normal to plane where meet point should be */
+		cross_v3_v3v3(norm_v, dir2, dir1);
+		normalize_v3(norm_v);
+		if (!on_right)
+			negate_v3(norm_v);
+
+		/* get vectors perp to each edge, perp to norm_v, and pointing into face */
+		if (f) {
+			copy_v3_v3(norm_v, f->no);
+		}
+		cross_v3_v3v3(norm_perp1, dir1, norm_v);
+		cross_v3_v3v3(norm_perp2, dir2, norm_v);
+		normalize_v3(norm_perp1);
+		normalize_v3(norm_perp2);
+
+		/* get points that are offset distances from each line, then another point on each line */
+		copy_v3_v3(off1a, v->co);
+		madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+		add_v3_v3v3(off1b, off1a, dir1);
+		copy_v3_v3(off2a, v->co);
+		madd_v3_v3fl(off2a, norm_perp2, e2->offset);
+		add_v3_v3v3(off2b, off2a, dir2);
+
+		/* intersect the lines; by construction they should be on the same plane and not parallel */
+		if (!isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2)) {
+			BLI_assert(!"offset_meet failure");
+			copy_v3_v3(meetco, off1a);  /* just to do something */
+		}
+	}
+}
+
+/* Like offset_meet, but here f1 and f2 must not be NULL and give the
+ * planes in which to run the offset lines.
+ * They may not meet exactly: the offsets for the edges may be different
+ * or both the planes and the lines may be angled so that they can't meet.
+ * In that case, pick a close point on emid, which should be the dividing
+ * edge between the two planes.
+ * TODO: should have a global 'offset consistency' prepass to adjust offset
+ * widths so that all edges have the same offset at both ends. */
+static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
+                                 BMVert *v, BMFace *f1, BMFace *f2, float meetco[3])
+{
+	float dir1[3], dir2[3], dirmid[3], norm_perp1[3], norm_perp2[3],
+	      off1a[3], off1b[3], off2a[3], off2b[3], isect2[3], co[3],
+	      f1no[3], f2no[3];
+	int iret;
+
+	BLI_assert(f1 != NULL && f2 != NULL);
+
+	/* get direction vectors for two offset lines */
+	sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
+	sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co);
+	sub_v3_v3v3(dirmid, BM_edge_other_vert(emid->e, v)->co, v->co);
+
+	/* get directions into offset planes */
+	/* calculate face normals at corner in case faces are nonplanar */
+	cross_v3_v3v3(f1no, dirmid, dir1);
+	cross_v3_v3v3(f2no, dirmid, dir2);
+	cross_v3_v3v3(norm_perp1, dir1, f1no);
+	normalize_v3(norm_perp1);
+	cross_v3_v3v3(norm_perp2, dir2, f2no);
+	normalize_v3(norm_perp2);
+
+	/* get points that are offset distances from each line, then another point on each line */
+	copy_v3_v3(off1a, v->co);
+	madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+	sub_v3_v3v3(off1b, off1a, dir1);
+	copy_v3_v3(off2a, v->co);
+	madd_v3_v3fl(off2a, norm_perp2, e2->offset);
+	add_v3_v3v3(off2b, off2a, dir2);
+
+	if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+		/* lines are parallel; off1a is a good meet point */
+		copy_v3_v3(meetco, off1a);
+	}
+	else {
+		iret = isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2);
+		if (iret == 0) {
+			/* lines colinear: another test says they are parallel. so shouldn't happen */
+			copy_v3_v3(meetco, off1a);
+		}
+		else if (iret == 2) {
+			/* lines are not coplanar; meetco and isect2 are nearest to first and second lines */
+			if (len_v3v3(meetco, isect2) > 100.0f * (float)BEVEL_EPSILON) {
+				/* offset lines don't meet: project average onto emid; this is not ideal (see TODO above) */
+				mid_v3_v3v3(co, meetco, isect2);
+				closest_to_line_v3(meetco, co, v->co, BM_edge_other_vert(emid->e, v)->co);
+			}
+		}
+		/* else iret == 1 and the lines are coplanar so meetco has the intersection */
+	}
+}
+
+/* Offset by e->offset in plane with normal plane_no, on left if left==TRUE,
+ * else on right.  If no is NULL, choose an arbitrary plane different
+ * from eh's direction. */
+static void offset_in_plane(EdgeHalf *e, const float plane_no[3], int left, float r[3])
+{
+	float dir[3], no[3], fdir[3];
+	BMVert *v;
+
+	v = e->is_rev ? e->e->v2 : e->e->v1;
+
+	sub_v3_v3v3(dir, BM_edge_other_vert(e->e, v)->co, v->co);
+	normalize_v3(dir);
+	if (plane_no) {
+		copy_v3_v3(no, plane_no);
+	}
+	else {
+		zero_v3(no);
+		if (fabs(dir[0]) < fabs(dir[1]))
+			no[0] = 1.0f;
+		else
+			no[1] = 1.0f;
+	}
+	if (left)
+		cross_v3_v3v3(fdir, dir, no);
+	else
+		cross_v3_v3v3(fdir, no, dir);
+	normalize_v3(fdir);
+	copy_v3_v3(r, v->co);
+	madd_v3_v3fl(r, fdir, e->offset);
+}
+
+/* Calculate coordinates of a point a distance d from v on e->e and return it in slideco */
+static void slide_dist(EdgeHalf *e, BMVert *v, float d, float slideco[3])
+{
+	float dir[3], len;
+
+	sub_v3_v3v3(dir, v->co, BM_edge_other_vert(e->e, v)->co);
+	len = normalize_v3(dir);
+	if (d > len)
+		d = len - (float)(50.0 * BEVEL_EPSILON);
+	copy_v3_v3(slideco, v->co);
+	madd_v3_v3fl(slideco, dir, -d);
+}
+
+/* Calculate the point on e where line (co_a, co_b) comes closest to and return it in projco */
+static void project_to_edge(BMEdge *e, const float co_a[3], const float co_b[3], float projco[3])
+{
+	float otherco[3];
+
+	if (!isect_line_line_v3(e->v1->co, e->v2->co, co_a, co_b, projco, otherco)) {
+		BLI_assert(!"project meet failure");
+		copy_v3_v3(projco, e->v1->co);
+	}
+}
+
+/* return 1 if a and b are in CCW order on the normal side of f,
+ * and -1 if they are reversed, and 0 if there is no shared face f */
+static int bev_ccw_test(BMEdge *a, BMEdge *b, BMFace *f)
+{
+	BMLoop *la, *lb;
+
+	if (!f)
+		return 0;
+	la = BM_face_edge_share_loop(f, a);
+	lb = BM_face_edge_share_loop(f, b);
+	if (!la || !lb)
+		return 0;
+	return lb->next == la ? 1 : -1;
+}
+
+#ifdef USE_ALTERNATE_ADJ
+
+static void vmesh_cent(VMesh *vm, float r_cent[3])
+{
+	BoundVert *v;
+	zero_v3(r_cent);
+
+	v = vm->boundstart;
+	do {
+		add_v3_v3(r_cent, v->nv.co);
+	} while ((v = v->next) != vm->boundstart);
+	mul_v3_fl(r_cent, 1.0f / (float)vm->count);
+}
+
+/**
+ *
+ * This example shows a tri fan of quads,
+ * but could be an NGon fan of quads too.
+ * <pre>
+ *      The whole triangle   X
+ *      represents the      / \
+ *      new bevel face.    /   \
+ *                        /     \
+ *       Split into      /       \
+ *       a quad fan.    /         \
+ *                     /           \
+ *                    /             \
+ *                   /               \
+ *          co_prev +-.             .-+
+ *                 /   `-._     _.-'   \
+ *                / co_cent`-+-'        \
+ *               /           |           \
+ * Quad of      /            |            \
+ * interest -- / ---> X      |             \
+ *            /              |              \
+ *           /               |               \
+ *          /         co_next|                \
+ * co_orig +-----------------+-----------------+
+ *
+ *         For each quad, calcualte UV's based on the following:
+ *           U = k    / (vm->seg * 2)
+ *           V = ring / (vm->seg * 2)
+ *           quad = (co_orig, co_prev, co_cent, co_next)
+ *           ... note that co_cent is the same for all quads in the fan.
+ * </pre>
+ *
+ */
+
+static void get_point_uv(float uv[2],
+                         /* all these args are int's originally
+                          * but pass as floats to the function */
+                         const float seg, const float ring, const float k)
+{
+	uv[0] = (ring / seg) * 2.0f;
+	uv[1] = (k    / seg) * 2.0f;
+}
+
+/* TODO: make this a lot smarter!,
+ * this is the main reason USE_ALTERNATE_ADJ isn't so good right now :S */
+static float get_point_uv_factor(const float uv[2])
+{
+	return sinf(1.0f - max_ff(uv[0], uv[1]) / 2.0f);
+}
+
+static void get_point_on_round_edge(const float uv[2],
+                                    float quad[4][3],
+                                    float r_co[3])
+{
+	interp_bilinear_quad_v3(quad, uv[0], uv[1], r_co);
+}
+
+#else  /* USE_ALTERNATE_ADJ */
+
+/* Fill matrix r_mat so that a point in the sheared parallelogram with corners
+ * va, vmid, vb (and the 4th that is implied by it being a parallelogram)
+ * is transformed to the unit square by multiplication with r_mat.
+ * If it can't be done because the parallelogram is degenerate, return FALSE
+ * else return TRUE.
+ * Method:
+ * Find vo, the origin of the parallelogram with other three points va, vmid, vb.
+ * Also find vd, which is in direction normal to parallelogram and 1 unit away
+ * from the origin.
+ * The quarter circle in first quadrant of unit square will be mapped to the
+ * quadrant of a sheared ellipse in the parallelgram, using a matrix.
+ * The matrix mat is calculated to map:
+ *    (0,1,0) -> va
+ *    (1,1,0) -> vmid
+ *    (1,0,0) -> vb
+ *    (0,1,1) -> vd
+ * We want M to make M*A=B where A has the left side above, as columns
+ * and B has the right side as columns - both extended into homogeneous coords.
+ * So M = B*(Ainverse).  Doing Ainverse by hand gives the code below.
+*/
+static int make_unit_square_map(const float va[3], const float vmid[3], const float vb[3],
+                                float r_mat[4][4])
+{
+	float vo[3], vd[3], vb_vmid[3], va_vmid[3], vddir[3];
+
+	sub_v3_v3v3(va_vmid, vmid, va);
+	sub_v3_v3v3(vb_vmid, vmid, vb);
+	if (fabsf(angle_v3v3(va_vmid, vb_vmid) - (float)M_PI) > 100.f *(float)BEVEL_EPSILON) {
+		sub_v3_v3v3(vo, va, vb_vmid);
+		cross_v3_v3v3(vddir, vb_vmid, va_vmid);
+		normalize_v3(vddir);
+		add_v3_v3v3(vd, vo, vddir);
+
+		/* The cols of m are: {vmid - va, vmid - vb, vmid + vd - va -vb, va + vb - vmid;
+		 * blender transform matrices are stored such that m[i][*] is ith column;
+		 * the last elements of each col remain as they are in unity matrix */
+		sub_v3_v3v3(&r_mat[0][0], vmid, va);
+		r_mat[0][3] = 0.0f;
+		sub_v3_v3v3(&r_mat[1][0], vmid, vb);
+		r_mat[1][3] = 0.0f;
+		add_v3_v3v3(&r_mat[2][0], vmid, vd);
+		sub_v3_v3(&r_mat[2][0], va);
+		sub_v3_v3(&r_mat[2][0], vb);
+		r_mat[2][3] = 0.0f;
+		add_v3_v3v3(&r_mat[3][0], va, vb);
+		sub_v3_v3(&r_mat[3][0], vmid);
+		r_mat[3][3] = 1.0f;
+
+		return TRUE;
+	}
+	else
+		return FALSE;
+}
+
+/*
+ * Find the point (/n) of the way around the round profile for e,
+ * where start point is va, midarc point is vmid, and end point is vb.
+ * Return the answer in profileco.
+ * If va -- vmid -- vb is approximately a straight line, just
+ * interpolate along the line.
+ */
+static void get_point_on_round_edge(EdgeHalf *e, int k,
+                                    const float va[3], const float vmid[3], const float vb[3],
+                                    float r_co[3])
+{
+	float p[3], angle;
+	float m[4][4];
+	int n = e->seg;
+
+	if (make_unit_square_map(va, vmid, vb, m)) {
+		/* Find point k/(e->seg) along quarter circle from (0,1,0) to (1,0,0) */
+		angle = (float)M_PI * (float)k / (2.0f * (float)n);  /* angle from y axis */
+		p[0] = sinf(angle);
+		p[1] = cosf(angle);
+		p[2] = 0.0f;
+		mul_v3_m4v3(r_co, m, p);
+	}
+	else {
+		/* degenerate case: profile is a line */
+		interp_v3_v3v3(r_co, va, vb, (float)k / (float)n);
+	}
+}
+
+/* Calculate a snapped point to the transformed profile of edge e, extended as
+ * in a cylinder-like surface in the direction of e.
+ * co is the point to snap and is modified in place.
+ * va and vb are the limits of the profile (with peak on e). */
+static void snap_to_edge_profile(EdgeHalf *e, const float va[3], const float vb[3],
+                                 float co[3])
+{
+	float m[4][4], minv[4][4];
+	float edir[3], va0[3], vb0[3], vmid0[3], p[3], snap[3];
+
+	sub_v3_v3v3(edir, e->e->v1->co, e->e->v2->co);
+	normalize_v3(edir);
+
+	/* project va and vb onto plane P, with normal edir and containing co */
+	closest_to_plane_v3(va0, co, edir, va);
+	closest_to_plane_v3(vb0, co, edir, vb);
+	project_to_edge(e->e, va0, vb0, vmid0);
+	if (make_unit_square_map(va0, vmid0, vb0, m)) {
+		/* Transform co and project it onto the unit circle.
+		 * Projecting is in fact just normalizing the transformed co */
+		if (!invert_m4_m4(minv, m)) {
+			/* shouldn't happen, by angle test and construction of vd */
+			BLI_assert(!"failed inverse during profile snap");
+			return;
+		}
+		mul_v3_m4v3(p, minv, co);
+		normalize_v3(p);
+		mul_v3_m4v3(snap, m, p);
+		copy_v3_v3(co, snap);
+	}
+	else {
+		/* planar case: just snap to line va--vb */
+		closest_to_line_segment_v3(p, co, va, vb);
+		copy_v3_v3(co, p);
+	}
+}
+
+#endif  /* !USE_ALTERNATE_ADJ */
+
+/* Make a circular list of BoundVerts for bv, each of which has the coordinates
+ * of a vertex on the the boundary of the beveled vertex bv->v.
+ * Also decide on the mesh pattern that will be used inside the boundary.
+ * Doesn't make the actual BMVerts */
+static void build_boundary(MemArena *mem_arena, BevVert *bv)
+{
+	EdgeHalf *efirst, *e;
+	BoundVert *v;
+	VMesh *vm;
+	float co[3];
+	const float  *no;
+	float lastd;
+
+	e = efirst = next_bev(bv, NULL);
+	vm = bv->vmesh;
+
+	BLI_assert(bv->edgecount >= 2);  /* since bevel edges incident to 2 faces */
+
+	if (bv->edgecount == 2 && bv->selcount == 1) {
+		/* special case: beveled edge meets non-beveled one at valence 2 vert */
+		no = e->fprev ? e->fprev->no : (e->fnext ? e->fnext->no : NULL);
+		offset_in_plane(e, no, TRUE, co);
+		v = add_new_bound_vert(mem_arena, vm, co);
+		v->efirst = v->elast = v->ebev = e;
+		e->leftv = v;
+		no = e->fnext ? e->fnext->no : (e->fprev ? e->fprev->no : NULL);
+		offset_in_plane(e, no, FALSE, co);
+		v = add_new_bound_vert(mem_arena, vm, co);
+		v->efirst = v->elast = e;
+		e->rightv = v;
+		/* make artifical extra point along unbeveled edge, and form triangle */
+		slide_dist(e->next, bv->v, e->offset, co);
+		v = add_new_bound_vert(mem_arena, vm, co);
+		v->efirst = v->elast = e->next;
+		e->next->leftv = e->next->rightv = v;
+		/* could use M_POLY too, but tri-fan looks nicer)*/
+		vm->mesh_kind = M_TRI_FAN;
+		return;
+	}
+
+	lastd = e->offset;
+	vm->boundstart = NULL;
+	do {
+		if (e->is_bev) {
+			/* handle only left side of beveled edge e here: next iteration should do right side */
+			if (e->prev->is_bev) {
+				BLI_assert(e->prev != e);  /* see: wire edge special case */
+				offset_meet(e->prev, e, bv->v, e->fprev, TRUE, co);
+				v = add_new_bound_vert(mem_arena, vm, co);
+				v->efirst = e->prev;
+				v->elast = v->ebev = e;
+				e->leftv = v;
+				e->prev->rightv = v;
+			}
+			else {
+				/* e->prev is not beveled */
+				if (e->prev->prev->is_bev) {
+					BLI_assert(e->prev->prev != e); /* see: edgecount 2, selcount 1 case */
+					/* find meet point between e->prev->prev and e and attach e->prev there */
+					offset_in_two_planes(e->prev->prev, e, e->prev, bv->v,
+					                     e->prev->prev->fnext, e->fprev, co);
+					v = add_new_bound_vert(mem_arena, vm, co);
+					v->efirst = e->prev->prev;
+					v->elast = v->ebev = e;
+					e->leftv = v;
+					e->prev->leftv = v;
+					e->prev->prev->rightv = v;
+				}
+				else {
+					/* neither e->prev nor e->prev->prev are beveled: make on-edge on e->prev */
+					offset_meet(e->prev, e, bv->v, e->fprev, TRUE, co);
+					v = add_new_bound_vert(mem_arena, vm, co);
+					v->efirst = e->prev;
+					v->elast = v->ebev = e;
+					e->leftv = v;
+					e->prev->leftv = v;
+				}
+			}
+			lastd = len_v3v3(bv->v->co, v->nv.co);
+		}
+		else {
+			/* e is not beveled */
+			if (e->next->is_bev) {
+				/* next iteration will place e between beveled previous and next edges */
+				/* do nothing... */
+			}
+			else if (e->prev->is_bev) {
+				/* on-edge meet between e->prev and e */
+				offset_meet(e->prev, e, bv->v, e->fprev, TRUE, co);
+				v = add_new_bound_vert(mem_arena, vm, co);
+				v->efirst = e->prev;
+				v->elast = e;
+				e->leftv = v;
+				e->prev->rightv = v;
+			}
+			else {
+				/* None of e->prev, e, e->next are beveled.
+				 * could either leave alone or add slide points to make
+				 * one polygon around bv->v.  For now, we choose latter.
+				 * Could slide to make an even bevel plane but for now will
+				 * just use last distance a meet point moved from bv->v. */
+				slide_dist(e, bv->v, lastd, co);
+				v = add_new_bound_vert(mem_arena, vm, co);
+				v->efirst = v->elast = e;
+				e->leftv = v;
+			}
+		}
+	} while ((e = e->next) != efirst);
+
+	BLI_assert(vm->count >= 2);
+	if (vm->count == 2 && bv->edgecount == 3) {
+		vm->mesh_kind = M_NONE;
+	}
+	else if (bv->selcount == 2) {
+		vm->mesh_kind = M_QUAD_STRIP;
+	}
+	else if (efirst->seg == 1 || bv->selcount == 1) {
+		if (vm->count == 3 && bv->selcount == 1) {
+			vm->mesh_kind = M_TRI_FAN;
+		}
+		else {
+			vm->mesh_kind = M_POLY;
+		}
+	}
+	else {
+		vm->mesh_kind = M_ADJ;
+	}
+}
+
+/*
+ * Given that the boundary is built and the boundary BMVerts have been made,
+ * calculate the positions of the interior mesh points for the M_ADJ pattern,
+ * then make the BMVerts and the new faces. */
+static void bevel_build_rings(BMesh *bm, BevVert *bv)
+{
+	int k, ring, i, n, ns, ns2, nn;
+	VMesh *vm = bv->vmesh;
+	BoundVert *v, *vprev, *vnext;
+	NewVert *nv, *nvprev, *nvnext;
+	EdgeHalf *e1, *e2, *epipe;
+	BMVert *bmv, *bmv1, *bmv2, *bmv3, *bmv4;
+	BMFace *f;
+	float co[3], coa[3], cob[3], midco[3];
+	float va_pipe[3], vb_pipe[3];
+
+#ifdef USE_ALTERNATE_ADJ
+	/* ordered as follows (orig, prev, center, next)*/
+	float quad_plane[4][3];
+	float quad_orig[4][3];
+#endif
+
+
+#ifdef USE_ALTERNATE_ADJ
+	/* the rest are initialized inline, this remains the same for all */
+	vmesh_cent(vm, quad_plane[2]);
+	copy_v3_v3(quad_orig[2], bv->v->co);
+#endif
+
+	n = vm->count;
+	ns = vm->seg;
+	ns2 = ns / 2;
+	BLI_assert(n > 2 && ns > 1);
+
+	/* special case: two beveled edges are in line and share a face, making a "pipe" */
+	epipe = NULL;
+	if (bv->selcount > 2) {
+		for (e1 = &bv->edges[0]; epipe == NULL && e1 != &bv->edges[bv->edgecount]; e1++) {
+			if (e1->is_bev) {
+				for (e2 = &bv->edges[0]; e2 != &bv->edges[bv->edgecount]; e2++) {
+					if (e1 != e2 && e2->is_bev) {
+						if ((e1->fnext == e2->fprev) || (e1->fprev == e2->fnext)) {
+							float dir1[3], dir2[3];
+							sub_v3_v3v3(dir1, bv->v->co, BM_edge_other_vert(e1->e, bv->v)->co);
+							sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, bv->v)->co, bv->v->co);
+							if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+								epipe = e1;
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/* Make initial rings, going between points on neighbors.
+	 * After this loop, will have coords for all (i, r, k) where
+	 * BoundVert for i has a bevel, 0 <= r <= ns2, 0 <= k <= ns */
+	for (ring = 1; ring <= ns2; ring++) {
+		v = vm->boundstart;
+
+		do {
+			i = v->index;
+			if (v->ebev) {
+				/* get points coords of points a and b, on outer rings
+				 * of prev and next edges, k away from this edge */
+				vprev = v->prev;
+				vnext = v->next;
+
+				if (vprev->ebev)
+					nvprev = mesh_vert(vm, vprev->index, 0, ns - ring);
+				else
+					nvprev = mesh_vert(vm, vprev->index, 0, ns);
+				copy_v3_v3(coa, nvprev->co);
+				nv = mesh_vert(vm, i, ring, 0);
+				copy_v3_v3(nv->co, coa);
+				nv->v = nvprev->v;
+
+				if (vnext->ebev)
+					nvnext = mesh_vert(vm, vnext->index, 0, ring);
+				else
+					nvnext = mesh_vert(vm, vnext->index, 0, 0);
+				copy_v3_v3(cob, nvnext->co);
+				nv = mesh_vert(vm, i, ring, ns);
+				copy_v3_v3(nv->co, cob);
+				nv->v = nvnext->v;
+
+#ifdef USE_ALTERNATE_ADJ
+				/* plane */
+				copy_v3_v3(quad_plane[0], v->nv.co);
+				mid_v3_v3v3(quad_plane[1], v->nv.co, v->prev->nv.co);
+				/* quad[2] is set */
+				mid_v3_v3v3(quad_plane[3], v->nv.co, v->next->nv.co);
+
+				/* orig */
+				copy_v3_v3(quad_orig[0], v->nv.co);  /* only shared location between 2 quads */
+				project_to_edge(v->ebev->prev->e, v->nv.co, v->prev->nv.co, quad_orig[1]);
+				project_to_edge(v->ebev->e,       v->nv.co, v->next->nv.co, quad_orig[3]);
+
+				//bl_debug_draw_quad_add(UNPACK4(quad_plane));
+				//bl_debug_draw_quad_add(UNPACK4(quad_orig));
+#endif
+
+#ifdef USE_ALTERNATE_ADJ
+				for (k = 1; k < ns; k++) {
+					float uv[2];
+					float fac;
+					float co_plane[3];
+					float co_orig[3];
+
+					get_point_uv(uv, v->ebev->seg, ring, k);
+					get_point_on_round_edge(uv, quad_plane, co_plane);
+					get_point_on_round_edge(uv, quad_orig,  co_orig);
+					fac = get_point_uv_factor(uv);
+					interp_v3_v3v3(co, co_plane, co_orig, fac);
+					copy_v3_v3(mesh_vert(vm, i, ring, k)->co, co);
+				}
+#else
+				/* TODO: better calculation of new midarc point? */
+				project_to_edge(v->ebev->e, coa, cob, midco);
+
+				for (k = 1; k < ns; k++) {
+					get_point_on_round_edge(v->ebev, k, coa, midco, cob, co);
+					copy_v3_v3(mesh_vert(vm, i, ring, k)->co, co);
+				}
+
+				if (v->ebev == epipe) {
+					/* save profile extremes for later snapping */
+					copy_v3_v3(va_pipe, mesh_vert(vm, i, 0, 0)->co);
+					copy_v3_v3(vb_pipe, mesh_vert(vm, i, 0, ns)->co);
+				}
+#endif
+			}
+		} while ((v = v->next) != vm->boundstart);
+	}
+
+	/* Now make sure cross points of rings share coordinates and vertices.
+	 * After this loop, will have BMVerts for all (i, r, k) where
+	 * i is for a BoundVert that is beveled and has either a predecessor or
+	 * successor BoundVert beveled too, and
+	 * for odd ns: 0 <= r <= ns2, 0 <= k <= ns
+	 * for even ns: 0 <= r < ns2, 0 <= k <= ns except k=ns2 */
+	v = vm->boundstart;
+	do {
+		i = v->index;
+		if (v->ebev) {
+			vprev = v->prev;
+			vnext = v->next;
+			if (vprev->ebev) {
+				for (ring = 1; ring <= ns2; ring++) {
+					for (k = 1; k <= ns2; k++) {
+						if (ns % 2 == 0 && (k == ns2 || ring == ns2))
+							continue;  /* center line is special case: do after the rest are done */
+						nv = mesh_vert(vm, i, ring, k);
+						nvprev = mesh_vert(vm, vprev->index, k, ns - ring);
+						mid_v3_v3v3(co, nv->co, nvprev->co);
+						if (epipe)
+							snap_to_edge_profile(epipe, va_pipe, vb_pipe, co);
+
+#ifndef USE_ALTERNATE_ADJ
+						copy_v3_v3(nv->co, co);
+#endif
+						BLI_assert(nv->v == NULL && nvprev->v == NULL);
+						create_mesh_bmvert(bm, vm, i, ring, k, bv->v);
+						copy_mesh_vert(vm, vprev->index, k, ns - ring, i, ring, k);
+					}
+				}
+				if (!vprev->prev->ebev) {
+					for (ring = 1; ring <= ns2; ring++) {
+						for (k = 1; k <= ns2; k++) {
+							if (ns % 2 == 0 && (k == ns2 || ring == ns2))
+								continue;
+							create_mesh_bmvert(bm, vm, vprev->index, ring, k, bv->v);
+						}
+					}
+				}
+				if (!vnext->ebev) {
+					for (ring = 1; ring <= ns2; ring++) {
+						for (k = ns - ns2; k < ns; k++) {
+							if (ns % 2 == 0 && (k == ns2 || ring == ns2))
+								continue;
+							create_mesh_bmvert(bm, vm, i, ring, k, bv->v);
+						}
+					}
+				}
+			}
+		}
+	} while ((v = v->next) != vm->boundstart);
+
+	if (ns % 2 == 0) {
+		/* Do special case center lines.
+		 * This loop makes verts for (i, ns2, k) for 1 <= k <= ns-1, k!=ns2
+		 * and for (i, r, ns2) for 1 <= r <= ns2-1,
+		 * whenever i is in a sequence of at least two beveled verts */
+		v = vm->boundstart;
+		do {
+			i = v->index;
+			if (v->ebev) {
+				vprev = v->prev;
+				vnext = v->next;
+				for (k = 1; k < ns2; k++) {
+					nv = mesh_vert(vm, i, k, ns2);
+					if (vprev->ebev)
+						nvprev = mesh_vert(vm, vprev->index, ns2, ns - k);
+					if (vnext->ebev)
+						nvnext = mesh_vert(vm, vnext->index, ns2, k);
+					if (vprev->ebev && vnext->ebev) {
+						mid_v3_v3v3v3(co, nvprev->co, nv->co, nvnext->co);
+						if (epipe)
+							snap_to_edge_profile(epipe, va_pipe, vb_pipe, co);
+#ifndef USE_ALTERNATE_ADJ
+						copy_v3_v3(nv->co, co);
+#endif
+						create_mesh_bmvert(bm, vm, i, k, ns2, bv->v);
+						copy_mesh_vert(vm, vprev->index, ns2, ns - k, i, k, ns2);
+						copy_mesh_vert(vm, vnext->index, ns2, k, i, k, ns2);
+
+					}
+					else if (vprev->ebev) {
+						mid_v3_v3v3(co, nvprev->co, nv->co);
+						if (epipe)
+							snap_to_edge_profile(epipe, va_pipe, vb_pipe, co);
+#ifndef USE_ALTERNATE_ADJ
+						copy_v3_v3(nv->co, co);
+#endif
+						create_mesh_bmvert(bm, vm, i, k, ns2, bv->v);
+						copy_mesh_vert(vm, vprev->index, ns2, ns - k, i, k, ns2);
+
+						create_mesh_bmvert(bm, vm, i, ns2, ns - k, bv->v);
+					}
+					else if (vnext->ebev) {
+						mid_v3_v3v3(co, nv->co, nvnext->co);
+						if (epipe)
+							snap_to_edge_profile(epipe, va_pipe, vb_pipe, co);
+#ifndef USE_ALTERNATE_ADJ
+						copy_v3_v3(nv->co, co);
+#endif
+						create_mesh_bmvert(bm, vm, i, k, ns2, bv->v);
+						copy_mesh_vert(vm, vnext->index, ns2, k, i, k, ns2);
+
+						create_mesh_bmvert(bm, vm, i, ns2, k, bv->v);
+					}
+				}
+			}
+		} while ((v = v->next) != vm->boundstart);
+
+		/* center point need to be average of all centers of rings */
+		/* TODO: this is wrong if not all verts have ebev: could have
+		 * several disconnected sections of mesh. */
+		zero_v3(midco);
+		nn = 0;
+		v = vm->boundstart;
+		do {
+			i = v->index;
+			if (v->ebev) {
+				nv = mesh_vert(vm, i, ns2, ns2);
+				add_v3_v3(midco, nv->co);
+				nn++;
+			}
+		} while ((v = v->next) != vm->boundstart);
+		mul_v3_fl(midco, 1.0f / nn);
+		if (epipe)
+			snap_to_edge_profile(epipe, va_pipe, vb_pipe, midco);
+		bmv = BM_vert_create(bm, midco, NULL, 0);
+		v = vm->boundstart;
+		do {
+			i = v->index;
+			if (v->ebev) {
+				nv = mesh_vert(vm, i, ns2, ns2);
+				copy_v3_v3(nv->co, midco);
+				nv->v = bmv;
+			}
+		} while ((v = v->next) != vm->boundstart);
+	}
+
+	/* Make the ring quads */
+	for (ring = 0; ring < ns2; ring++) {
+		v = vm->boundstart;
+		do {
+			i = v->index;
+			f = boundvert_rep_face(v);
+			if (v->ebev && (v->prev->ebev || v->next->ebev)) {
+				for (k = 0; k < ns2 + (ns % 2); k++) {
+					bmv1 = mesh_vert(vm, i, ring, k)->v;
+					bmv2 = mesh_vert(vm, i, ring, k + 1)->v;
+					bmv3 = mesh_vert(vm, i, ring + 1, k + 1)->v;
+					bmv4 = mesh_vert(vm, i, ring + 1, k)->v;
+					BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
+					if (bmv3 == bmv4 || bmv1 == bmv4)
+						bmv4 = NULL;
+					bev_create_quad_tri(bm, bmv1, bmv2, bmv3, bmv4, f);
+				}
+			}
+			else if (v->prev->ebev && v->prev->prev->ebev) {
+				/* finish off a sequence of beveled edges */
+				i = v->prev->index;
+				f = boundvert_rep_face(v->prev);
+				for (k = ns2 + (ns % 2); k < ns; k++) {
+					bmv1 = mesh_vert(vm, i, ring, k)->v;
+					bmv2 = mesh_vert(vm, i, ring, k + 1)->v;
+					bmv3 = mesh_vert(vm, i, ring + 1, k + 1)->v;
+					bmv4 = mesh_vert(vm, i, ring + 1, k)->v;
+					BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
+					if (bmv2 == bmv3) {
+						bmv3 = bmv4;
+						bmv4 = NULL;
+					}
+					bev_create_quad_tri(bm, bmv1, bmv2, bmv3, bmv4, f);
+				}
+			}
+		} while ((v = v->next) != vm->boundstart);
+	}
+
+	/* Make center ngon if odd number of segments and fully beveled */
+	if (ns % 2 == 1 && vm->count == bv->selcount) {
+		BMVert **vv = NULL;
+		BLI_array_declare(vv);
+
+		v = vm->boundstart;
+		do {
+			i = v->index;
+			BLI_assert(v->ebev);
+			BLI_array_append(vv, mesh_vert(vm, i, ns2, ns2)->v);
+		} while ((v = v->next) != vm->boundstart);
+		f = boundvert_rep_face(vm->boundstart);
+		bev_create_ngon(bm, vv, BLI_array_count(vv), f);
+
+		BLI_array_free(vv);
+	}
+
+	/* Make 'rest-of-vmesh' polygon if not fully beveled */
+	if (vm->count > bv->selcount) {
+		int j;
+		BMVert **vv = NULL;
+		BLI_array_declare(vv);
+
+		v = vm->boundstart;
+		f = boundvert_rep_face(v);
+		j = 0;
+		do {
+			i = v->index;
+			if (v->ebev) {
+				if (!v->prev->ebev) {
+					for (k = 0; k < ns2; k++) {
+						bmv1 = mesh_vert(vm, i, ns2, k)->v;
+						if (!bmv1)
+							bmv1 = mesh_vert(vm, i, 0, k)->v;
+						if (!(j > 0 && bmv1 == vv[j - 1])) {
+							BLI_assert(bmv1 != NULL);
+							BLI_array_append(vv, bmv1);
+							j++;
+						}
+					}
+				}
+				bmv1 = mesh_vert(vm, i, ns2, ns2)->v;
+				if (!bmv1)
+					bmv1 = mesh_vert(vm, i, 0, ns2)->v;
+				if (!(j > 0 && bmv1 == vv[j - 1])) {
+					BLI_assert(bmv1 != NULL);
+					BLI_array_append(vv, bmv1);
+					j++;
+				}
+				if (!v->next->ebev) {
+					for (k = ns - ns2; k < ns; k++) {
+						bmv1 = mesh_vert(vm, i, ns2, k)->v;
+						if (!bmv1)
+							bmv1 = mesh_vert(vm, i, 0, k)->v;
+						if (!(j > 0 && bmv1 == vv[j - 1])) {
+							BLI_assert(bmv1 != NULL);
+							BLI_array_append(vv, bmv1);
+							j++;
+						}
+					}
+				}
+			}
+			else {
+				BLI_assert(mesh_vert(vm, i, 0, 0)->v != NULL);
+				BLI_array_append(vv, mesh_vert(vm, i, 0, 0)->v);
+				j++;
+			}
+		} while ((v = v->next) != vm->boundstart);
+		if (vv[0] == vv[j - 1])
+			j--;
+		bev_create_ngon(bm, vv, j, f);
+
+		BLI_array_free(vv);
+	}
+}
+
+static BMFace *bevel_build_poly_ex(BMesh *bm, BevVert *bv)
+{
+	BMFace *f;
+	int n, k;
+	VMesh *vm = bv->vmesh;
+	BoundVert *v;
+	BMVert **vv = NULL;
+	BLI_array_declare(vv);
+
+	v = vm->boundstart;
+	n = 0;
+	do {
+		/* accumulate vertices for vertex ngon */
+		BLI_array_append(vv, v->nv.v);
+		n++;
+		if (v->ebev && v->ebev->seg > 1) {
+			for (k = 1; k < v->ebev->seg; k++) {
+				BLI_array_append(vv, mesh_vert(vm, v->index, 0, k)->v);
+				n++;
+			}
+		}
+	} while ((v = v->next) != vm->boundstart);
+	if (n > 2) {
+		f = bev_create_ngon(bm, vv, n, boundvert_rep_face(v));
+	}
+	else {
+		f = NULL;
+	}
+	BLI_array_free(vv);
+	return f;
+}
+
+static void bevel_build_poly(BMesh *bm, BevVert *bv)
+{
+	bevel_build_poly_ex(bm, bv);
+}
+
+static void bevel_build_trifan(BMesh *bm, BevVert *bv)
+{
+	BMFace *f;
+	BLI_assert(next_bev(bv, NULL)->seg == 1 || bv->selcount == 1);
+
+	f = bevel_build_poly_ex(bm, bv);
+
+	if (f) {
+		/* we have a polygon which we know starts at the previous vertex, make it into a fan */
+		BMLoop *l_fan = BM_FACE_FIRST_LOOP(f)->prev;
+		BMVert *v_fan = l_fan->v;
+
+		while (f->len > 3) {
+			BMLoop *l_new;
+			BMFace *f_new;
+			BLI_assert(v_fan == l_fan->v);
+			f_new = BM_face_split(bm, f, l_fan->v, l_fan->next->next->v, &l_new, NULL, FALSE);
+
+			if (f_new->len > f->len) {
+				f = f_new;
+				if      (l_new->v       == v_fan) { l_fan = l_new; }
+				else if (l_new->next->v == v_fan) { l_fan = l_new->next; }
+				else if (l_new->prev->v == v_fan) { l_fan = l_new->prev; }
+				else { BLI_assert(0); }
+			}
+			else {
+				if      (l_fan->v       == v_fan) { l_fan = l_fan; }
+				else if (l_fan->next->v == v_fan) { l_fan = l_fan->next; }
+				else if (l_fan->prev->v == v_fan) { l_fan = l_fan->prev; }
+				else { BLI_assert(0); }
+			}
+		}
+	}
+}
+
+static void bevel_build_quadstrip(BMesh *bm, BevVert *bv)
+{
+	BMFace *f;
+	BLI_assert(bv->selcount == 2);
+
+	f = bevel_build_poly_ex(bm, bv);
+
+	if (f) {
+		/* we have a polygon which we know starts at this vertex, make it into strips */
+		EdgeHalf *eh_a = bv->vmesh->boundstart->elast;
+		EdgeHalf *eh_b = next_bev(bv, eh_a->next);  /* since (selcount == 2) we know this is valid */
+		BMLoop *l_a = BM_face_vert_share_loop(f, eh_a->rightv->nv.v);
+		BMLoop *l_b = BM_face_vert_share_loop(f, eh_b->leftv->nv.v);
+		int split_count = bv->vmesh->seg + 1;  /* ensure we don't walk past the segments */
+
+		while (f->len > 4 && split_count > 0) {
+			BMLoop *l_new;
+			BLI_assert(l_a->f == f);
+			BLI_assert(l_b->f == f);
+
+			if (l_a-> v == l_b->v || l_a->next == l_b) {
+				/* l_a->v and l_b->v can be the same or such that we'd make a 2-vertex poly */
+				l_a = l_a->prev;
+				l_b = l_b->next;
+			}
+			else {
+				BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE);
+				f = l_new->f;
+
+				/* walk around the new face to get the next verts to split */
+				l_a = l_new->prev;
+				l_b = l_new->next->next;
+			}
+			split_count--;
+		}
+	}
+}
+
+/* Given that the boundary is built, now make the actual BMVerts
+ * for the boundary and the interior of the vertex mesh. */
+static void build_vmesh(MemArena *mem_arena, BMesh *bm, BevVert *bv)
+{
+	VMesh *vm = bv->vmesh;
+	BoundVert *v, *weld1, *weld2;
+	int n, ns, ns2, i, k, weld;
+	float *va, *vb, co[3];
+
+#ifdef USE_ALTERNATE_ADJ
+	/* ordered as follows (orig, prev, center, next)*/
+	float quad_plane[4][3];
+	float quad_orig_a[4][3];
+	float quad_orig_b[4][3];
+	const int is_odd = (vm->seg % 2);
+#else
+	float midco[3];
+#endif
+
+#ifdef USE_ALTERNATE_ADJ
+	/* the rest are initialized inline, this remains the same for all */
+	/* NOTE; in this usage we only interpolate on the 'V' so cent and next points are unused (2,3)*/
+	vmesh_cent(vm, quad_plane[2]);
+	copy_v3_v3(quad_orig_a[2], bv->v->co);
+	copy_v3_v3(quad_orig_b[2], bv->v->co);
+#endif
+
+	n = vm->count;
+	ns = vm->seg;
+	ns2 = ns / 2;
+
+	vm->mesh = (NewVert *)BLI_memarena_alloc(mem_arena, n * (ns2 + 1) * (ns + 1) * sizeof(NewVert));
+
+	/* special case: two beveled ends welded together */
+	weld = (bv->selcount == 2) && (vm->count == 2);
+	weld1 = weld2 = NULL;   /* will hold two BoundVerts involved in weld */
+
+	/* make (i, 0, 0) mesh verts for all i */
+	v = vm->boundstart;
+	do {
+		i = v->index;
+		copy_v3_v3(mesh_vert(vm, i, 0, 0)->co, v->nv.co);
+		create_mesh_bmvert(bm, vm, i, 0, 0, bv->v);
+		v->nv.v = mesh_vert(vm, i, 0, 0)->v;
+		if (weld && v->ebev) {
+			if (!weld1)
+				weld1 = v;
+			else
+				weld2 = v;
+		}
+	} while ((v = v->next) != vm->boundstart);
+
+	/* copy other ends to (i, 0, ns) for all i, and fill in profiles for beveled edges */
+	v = vm->boundstart;
+	do {
+		i = v->index;
+		copy_mesh_vert(vm, i, 0, ns, v->next->index, 0, 0);
+		if (v->ebev) {
+
+#ifdef USE_ALTERNATE_ADJ
+			copy_v3_v3(quad_plane[0], v->nv.co);
+			mid_v3_v3v3(quad_plane[1], v->nv.co, v->prev->nv.co);
+			/* quad[2] is set */
+			mid_v3_v3v3(quad_plane[3], v->nv.co, v->next->nv.co);
+
+			/* orig 'A' */
+			copy_v3_v3(quad_orig_a[0], v->nv.co);  /* only shared location between 2 quads */
+			project_to_edge(v->ebev->prev->e, v->nv.co, v->prev->nv.co, quad_orig_a[1]);
+			project_to_edge(v->ebev->e,       v->nv.co, v->next->nv.co, quad_orig_a[3]);
+
+			/* orig 'B' */
+			copy_v3_v3(quad_orig_b[3], v->next->nv.co);  /* only shared location between 2 quads */
+			project_to_edge(v->ebev->prev->e, v->nv.co, v->prev->nv.co, quad_orig_b[1]);
+			project_to_edge(v->ebev->e,       v->nv.co, v->next->nv.co, quad_orig_b[0]);
+
+			//bl_debug_draw_quad_add(UNPACK4(quad_plane));
+			//bl_debug_draw_quad_add(UNPACK4(quad_orig_a));
+			//bl_debug_draw_quad_add(UNPACK4(quad_orig_b));
+#endif  /* USE_ALTERNATE_ADJ */
+
+#ifdef USE_ALTERNATE_ADJ
+			for (k = 1; k < ns; k++) {
+				float uv[2];
+				float fac;
+				float co_plane[3];
+				float co_orig[3];
+
+				/* quad_plane */
+				get_point_uv(uv, v->ebev->seg, 0, k);
+				get_point_on_round_edge(uv, quad_plane, co_plane);
+
+				/* quad_orig */
+				/* each half has different UV's */
+				if (k <= ns2) {
+					get_point_uv(uv, v->ebev->seg, 0, k);
+					get_point_on_round_edge(uv, quad_orig_a, co_orig);
+				}
+				else {
+					get_point_uv(uv, v->ebev->seg, 0, (k - ns2) - (is_odd ? 0.5f : 0.0f));
+					get_point_on_round_edge(uv, quad_orig_b, co_orig);
+					uv[1] = 1.0f - uv[1];  /* so we can get the factor */
+				}
+				fac = get_point_uv_factor(uv);
+
+				/* done. interp */
+				interp_v3_v3v3(co, co_plane, co_orig, fac);
+				copy_v3_v3(mesh_vert(vm, i, 0, k)->co, co);
+				if (!weld)
+					create_mesh_bmvert(bm, vm, i, 0, k, bv->v);
+			}
+#else  /* USE_ALTERNATE_ADJ */
+			va = mesh_vert(vm, i, 0, 0)->co;
+			vb = mesh_vert(vm, i, 0, ns)->co;
+			project_to_edge(v->ebev->e, va, vb, midco);
+			for (k = 1; k < ns; k++) {
+				get_point_on_round_edge(v->ebev, k, va, midco, vb, co);
+				copy_v3_v3(mesh_vert(vm, i, 0, k)->co, co);
+				if (!weld)
+					create_mesh_bmvert(bm, vm, i, 0, k, bv->v);
+			}
+#endif  /* !USE_ALTERNATE_ADJ */
+		}
+	} while ((v = v->next) != vm->boundstart);
+
+	if (weld) {
+		vm->mesh_kind = M_NONE;
+		for (k = 1; k < ns; k++) {
+			va = mesh_vert(vm, weld1->index, 0, k)->co;
+			vb = mesh_vert(vm, weld2->index, 0, ns - k)->co;
+			mid_v3_v3v3(co, va, vb);
+			copy_v3_v3(mesh_vert(vm, weld1->index, 0, k)->co, co);
+			create_mesh_bmvert(bm, vm, weld1->index, 0, k, bv->v);
+		}
+		for (k = 1; k < ns; k++)
+			copy_mesh_vert(vm, weld2->index, 0, ns - k, weld1->index, 0, k);
+	}
+
+	switch (vm->mesh_kind) {
+		case M_NONE:
+			/* do nothing */
+			break;
+		case M_POLY:
+			bevel_build_poly(bm, bv);
+			break;
+		case M_ADJ:
+			bevel_build_rings(bm, bv);
+			break;
+		case M_TRI_FAN:
+			bevel_build_trifan(bm, bv);
+			break;
+		case M_QUAD_STRIP:
+			bevel_build_quadstrip(bm, bv);
+			break;
+	}
+}
+
+/* take care, this flag isn't cleared before use, it just so happens that its not set */
+#define BM_BEVEL_EDGE_TAG_ENABLE(bme)  BM_elem_flag_enable(  (bme)->l, BM_ELEM_TAG)
+#define BM_BEVEL_EDGE_TAG_DISABLE(bme) BM_elem_flag_disable( (bme)->l, BM_ELEM_TAG)
+#define BM_BEVEL_EDGE_TAG_TEST(bme)    BM_elem_flag_test(    (bme)->l, BM_ELEM_TAG)
+
+/*
+ * Construction around the vertex
+ */
+static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
+{
+	BMEdge *bme;
+	BevVert *bv;
+	BMEdge *bme2, *unflagged_bme;
+	BMFace *f;
+	BMIter iter, iter2;
+	EdgeHalf *e;
+	int i, found_shared_face, ccw_test_sum;
+	int nsel = 0;
+	int ntot = 0;
+
+	/* Gather input selected edges.
+	 * Only bevel selected edges that have exactly two incident faces.
+	 */
+
+	BM_ITER_ELEM (bme, &iter, v, BM_EDGES_OF_VERT) {
+		if (BM_elem_flag_test(bme, BM_ELEM_TAG)) {
+			BLI_assert(BM_edge_is_manifold(bme));
+			nsel++;
+		}
+		ntot++;
+	}
+
+	if (nsel == 0) {
+		/* signal this vert isn't being beveled */
+		BM_elem_flag_disable(v, BM_ELEM_TAG);
+		return;
+	}
+
+	/* avoid calling BM_vert_edge_count since we loop over edges already */
+	// ntot = BM_vert_edge_count(v);
+	// BLI_assert(ntot == BM_vert_edge_count(v));
+
+	bv = (BevVert *)BLI_memarena_alloc(bp->mem_arena, (sizeof(BevVert)));
+	bv->v = v;
+	bv->edgecount = ntot;
+	bv->selcount = nsel;
+	bv->edges = (EdgeHalf *)BLI_memarena_alloc(bp->mem_arena, ntot * sizeof(EdgeHalf));
+	bv->vmesh = (VMesh *)BLI_memarena_alloc(bp->mem_arena, sizeof(VMesh));
+	bv->vmesh->seg = bp->seg;
+	BLI_ghash_insert(bp->vert_hash, v, bv);
+
+	/* add edges to bv->edges in order that keeps adjacent edges sharing
+	 * a face, if possible */
+	i = 0;
+	bme = v->e;
+	BM_BEVEL_EDGE_TAG_ENABLE(bme);
+	e = &bv->edges[0];
+	e->e = bme;
+	for (i = 0; i < ntot; i++) {
+		if (i > 0) {
+			/* find an unflagged edge bme2 that shares a face f with previous bme */
+			found_shared_face = 0;
+			unflagged_bme = NULL;
+			BM_ITER_ELEM (bme2, &iter, v, BM_EDGES_OF_VERT) {
+				if (BM_BEVEL_EDGE_TAG_TEST(bme2))
+					continue;
+				if (!unflagged_bme)
+					unflagged_bme = bme2;
+				BM_ITER_ELEM (f, &iter2, bme2, BM_FACES_OF_EDGE) {
+					if (BM_face_edge_share_loop(f, bme)) {
+						found_shared_face = 1;
+						break;
+					}
+				}
+				if (found_shared_face)
+					break;
+			}
+			e = &bv->edges[i];
+			if (found_shared_face) {
+				e->e = bme2;
+				e->fprev = f;
+				bv->edges[i - 1].fnext = f;
+			}
+			else {
+				e->e = unflagged_bme;
+			}
+		}
+		bme = e->e;
+		BM_BEVEL_EDGE_TAG_ENABLE(bme);
+		if (BM_elem_flag_test(bme, BM_ELEM_TAG)) {
+			e->is_bev = TRUE;
+			e->seg = bp->seg;
+		}
+		else {
+			e->is_bev = FALSE;
+			e->seg = 0;
+		}
+		e->is_rev = (bme->v2 == v);
+		e->offset = e->is_bev ? bp->offset : 0.0f;
+	}
+	/* find wrap-around shared face */
+	BM_ITER_ELEM (f, &iter2, bme, BM_FACES_OF_EDGE) {
+		if (BM_face_edge_share_loop(f, bv->edges[0].e)) {
+			if (bv->edges[0].fnext == f)
+				continue;   /* if two shared faces, want the other one now */
+			bv->edges[ntot - 1].fnext = f;
+			bv->edges[0].fprev = f;
+			break;
+		}
+	}
+
+	/* do later when we loop over edges */
+#if 0
+	/* clear BEVEL_EDGE_TAG now that we are finished with it*/
+	for (i = 0; i < ntot; i++) {
+		BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[i].e);
+	}
+#endif
+
+	/* if edge array doesn't go CCW around vertex from average normal side,
+	 * reverse the array, being careful to reverse face pointers too */
+	if (ntot > 1) {
+		ccw_test_sum = 0;
+		for (i = 0; i < ntot; i++)
+			ccw_test_sum += bev_ccw_test(bv->edges[i].e, bv->edges[(i + 1) % ntot].e,
+			                             bv->edges[i].fnext);
+		if (ccw_test_sum < 0) {
+			for (i = 0; i <= (ntot / 2) - 1; i++) {
+				SWAP(EdgeHalf, bv->edges[i], bv->edges[ntot - i - 1]);
+				SWAP(BMFace *, bv->edges[i].fprev, bv->edges[i].fnext);
+				SWAP(BMFace *, bv->edges[ntot - i - 1].fprev, bv->edges[ntot - i - 1].fnext);
+			}
+			if (ntot % 2 == 1) {
+				i = ntot / 2;
+				SWAP(BMFace *, bv->edges[i].fprev,  bv->edges[i].fnext);
+			}
+		}
+	}
+
+	for (i = 0, e = bv->edges; i < ntot; i++, e++) {
+		e->next = &bv->edges[(i + 1) % ntot];
+		e->prev = &bv->edges[(i + ntot - 1) % ntot];
+		BM_BEVEL_EDGE_TAG_DISABLE(e->e);
+	}
+
+	build_boundary(bp->mem_arena, bv);
+	build_vmesh(bp->mem_arena, bm, bv);
+}
+
+/* Face f has at least one beveled vertex.  Rebuild f */
+static int bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
+{
+	BMIter liter;
+	BMLoop *l, *lprev;
+	BevVert *bv;
+	BoundVert *v, *vstart, *vend;
+	EdgeHalf *e, *eprev;
+	VMesh *vm;
+	int i, k;
+	int do_rebuild = FALSE;
+	BMVert *bmv;
+	BMVert **vv = NULL;
+	BLI_array_staticdeclare(vv, BM_DEFAULT_NGON_STACK_SIZE);
+
+	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+		if (BM_elem_flag_test(l->v, BM_ELEM_TAG)) {
+			lprev = l->prev;
+			bv = find_bevvert(bp, l->v);
+			e = find_edge_half(bv, l->e);
+			eprev = find_edge_half(bv, lprev->e);
+			BLI_assert(e != NULL && eprev != NULL);
+			vstart = eprev->leftv;
+			if (e->is_bev)
+				vend = e->rightv;
+			else
+				vend = e->leftv;
+			v = vstart;
+			vm = bv->vmesh;
+			BLI_array_append(vv, v->nv.v);
+			while (v != vend) {
+				if (vm->mesh_kind == M_NONE && v->ebev && v->ebev->seg > 1 && v->ebev != e && v->ebev != eprev) {
+					/* case of 3rd face opposite a beveled edge, with no vmesh */
+					i = v->index;
+					e = v->ebev;
+					for (k = 1; k < e->seg; k++) {
+						bmv = mesh_vert(vm, i, 0, k)->v;
+						BLI_array_append(vv, bmv);
+					}
+				}
+				v = v->prev;
+				BLI_array_append(vv, v->nv.v);
+			}
+
+			do_rebuild = TRUE;
+		}
+		else {
+			BLI_array_append(vv, l->v);
+		}
+	}
+	if (do_rebuild) {
+		BMFace *f_new = bev_create_ngon(bm, vv, BLI_array_count(vv), f);
+
+		/* don't select newly created boundary faces... */
+		if (f_new) {
+			BM_elem_flag_disable(f_new, BM_ELEM_TAG);
+		}
+	}
+
+	BLI_array_free(vv);
+	return do_rebuild;
+}
+
+/* All polygons touching v need rebuilding because beveling v has made new vertices */
+static void bevel_rebuild_existing_polygons(BMesh *bm, BevelParams *bp, BMVert *v)
+{
+	void    *faces_stack[BM_DEFAULT_ITER_STACK_SIZE];
+	int      faces_len, f_index;
+	BMFace **faces = BM_iter_as_arrayN(bm, BM_FACES_OF_VERT, v, &faces_len,
+	                                   faces_stack, BM_DEFAULT_ITER_STACK_SIZE);
+
+	if (LIKELY(faces != NULL)) {
+		for (f_index = 0; f_index < faces_len; f_index++) {
+			BMFace *f = faces[f_index];
+			if (bev_rebuild_polygon(bm, bp, f)) {
+				BM_face_kill(bm, f);
+			}
+		}
+
+		if (faces != (BMFace **)faces_stack) {
+			MEM_freeN(faces);
+		}
+	}
+}
+
+
+/*
+ * Build the polygons along the selected Edge
+ */
+static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
+{
+	BevVert *bv1, *bv2;
+	BMVert *bmv1, *bmv2, *bmv3, *bmv4, *bmv1i, *bmv2i, *bmv3i, *bmv4i;
+	VMesh *vm1, *vm2;
+	EdgeHalf *e1, *e2;
+	BMFace *f1, *f2, *f;
+	int k, nseg, i1, i2;
+
+	if (!BM_edge_is_manifold(bme))
+		return;
+
+	bv1 = find_bevvert(bp, bme->v1);
+	bv2 = find_bevvert(bp, bme->v2);
+
+	BLI_assert(bv1 && bv2);
+
+	e1 = find_edge_half(bv1, bme);
+	e2 = find_edge_half(bv2, bme);
+
+	BLI_assert(e1 && e2);
+
+	/*   v4             v3
+	 *    \            /
+	 *     e->v1 - e->v2
+	 *    /            \
+	 *   v1             v2
+	 */
+	nseg = e1->seg;
+	BLI_assert(nseg > 0 && nseg == e2->seg);
+
+	bmv1 = e1->leftv->nv.v;
+	bmv4 = e1->rightv->nv.v;
+	bmv2 = e2->rightv->nv.v;
+	bmv3 = e2->leftv->nv.v;
+
+	BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
+
+	f1 = boundvert_rep_face(e1->leftv);
+	f2 = boundvert_rep_face(e1->rightv);
+
+	if (nseg == 1) {
+		bev_create_quad_tri(bm, bmv1, bmv2, bmv3, bmv4, f1);
+	}
+	else {
+		i1 = e1->leftv->index;
+		i2 = e2->leftv->index;
+		vm1 = bv1->vmesh;
+		vm2 = bv2->vmesh;
+		bmv1i = bmv1;
+		bmv2i = bmv2;
+		for (k = 1; k <= nseg; k++) {
+			bmv4i = mesh_vert(vm1, i1, 0, k)->v;
+			bmv3i = mesh_vert(vm2, i2, 0, nseg - k)->v;
+			f = (k <= nseg / 2 + (nseg % 2)) ? f1 : f2;
+			bev_create_quad_tri(bm, bmv1i, bmv2i, bmv3i, bmv4i, f);
+			bmv1i = bmv4i;
+			bmv2i = bmv3i;
+		}
+	}
+}
+
+/**
+ * - Currently only bevels BM_ELEM_TAG'd verts and edges.
+ *
+ * - Newly created faces are BM_ELEM_TAG'd too,
+ *   the caller needs to ensure this is cleared before calling
+ *   if its going to use this face tag.
+ *
+ * \warning all tagged edges _must_ be manifold.
+ */
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments)
+{
+	BMIter iter;
+	BMVert *v;
+	BMEdge *e;
+	BevelParams bp = {NULL};
+
+	bp.offset = offset;
+	bp.seg    = segments;
+
+	if (bp.offset > 0) {
+		/* primary alloc */
+		bp.vert_hash = BLI_ghash_ptr_new(__func__);
+		bp.mem_arena = BLI_memarena_new((1 << 16), __func__);
+		BLI_memarena_use_calloc(bp.mem_arena);
+
+		/* The analysis of the input vertices and execution additional constructions */
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				bevel_vert_construct(bm, &bp, v);
+			}
+		}
+
+		/* Build polygons for edges */
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+				bevel_build_edge_polygons(bm, &bp, e);
+			}
+		}
+
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				bevel_rebuild_existing_polygons(bm, &bp, v);
+			}
+		}
+
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				BLI_assert(find_bevvert(&bp, v) != NULL);
+				BM_vert_kill(bm, v);
+			}
+		}
+
+		/* primary free */
+		BLI_ghash_free(bp.vert_hash, NULL, NULL);
+		BLI_memarena_free(bp.mem_arena);
+	}
+}
diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h
new file mode 100644
index 0000000..a80e4f3
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -0,0 +1,32 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_BEVEL_H__
+#define __BMESH_BEVEL_H__
+
+/** \file blender/bmesh/tools/bmesh_bevel.h
+ *  \ingroup bmesh
+ */
+
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments);
+
+#endif /* __BMESH_BEVEL_H__ */
diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h
new file mode 100644
index 0000000..4a557c2
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_decimate.h
@@ -0,0 +1,44 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_DECIMATE_H__
+#define __BMESH_DECIMATE_H__
+
+/** \file blender/bmesh/tools/bmesh_decimate.h
+ *  \ingroup bmesh
+ */
+
+void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const int do_triangulate);
+
+void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int tag_only);
+void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations);
+
+void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries,
+                                  BMVert **vinput_arr, const int vinput_len,
+                                  BMEdge **einput_arr, const int einput_len);
+void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries);
+
+/* these weights are accumulated so too high values may reach 'inf' too quickly */
+#define BM_MESH_DECIM_WEIGHT_MAX 100000.0f
+#define BM_MESH_DECIM_WEIGHT_EPS (1.0f / BM_MESH_DECIM_WEIGHT_MAX)
+
+#endif /* __BMESH_DECIMATE_H__ */
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
new file mode 100644
index 0000000..7c054d8
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
@@ -0,0 +1,1044 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_decimate_collapse.c
+ *  \ingroup bmesh
+ *
+ * BMesh decimator that uses an edge collapse method.
+ */
+
+#include <stddef.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+
+#include "BLI_math.h"
+#include "BLI_quadric.h"
+#include "BLI_heap.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+#include "bmesh_decimate.h"  /* own include */
+
+#include "../intern/bmesh_structure.h"
+
+/* defines for testing */
+#define USE_CUSTOMDATA
+#define USE_TRIANGULATE
+#define USE_VERT_NORMAL_INTERP  /* has the advantage that flipped faces don't mess up vertex normals */
+
+/* these checks are for rare cases that we can't avoid since they are valid meshes still */
+#define USE_SAFETY_CHECKS
+
+#define BOUNDARY_PRESERVE_WEIGHT 100.0f
+#define OPTIMIZE_EPS 0.01f  /* FLT_EPSILON is too small, see [#33106] */
+#define COST_INVALID FLT_MAX
+
+typedef enum CD_UseFlag {
+	CD_DO_VERT = (1 << 0),
+	CD_DO_EDGE = (1 << 1),
+	CD_DO_LOOP = (1 << 2)
+} CD_UseFlag;
+
+
+/* BMesh Helper Functions
+ * ********************** */
+
+/**
+ * \param vquadrics must be calloc'd
+ */
+static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics)
+{
+	BMIter iter;
+	BMFace *f;
+	BMEdge *e;
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMLoop *l_first;
+		BMLoop *l_iter;
+
+		const float *co = BM_FACE_FIRST_LOOP(f)->v->co;
+		const float *no = f->no;
+		const float offset = -dot_v3v3(no, co);
+		Quadric q;
+
+		BLI_quadric_from_v3_dist(&q, no, offset);
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			BLI_quadric_add_qu_qu(&vquadrics[BM_elem_index_get(l_iter->v)], &q);
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+
+	/* boundary edges */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (UNLIKELY(BM_edge_is_boundary(e))) {
+			float edge_vector[3];
+			float edge_cross[3];
+			sub_v3_v3v3(edge_vector, e->v2->co, e->v1->co);
+			f = e->l->f;
+			cross_v3_v3v3(edge_cross, edge_vector, f->no);
+
+			if (normalize_v3(edge_cross) > FLT_EPSILON) {
+				Quadric q;
+				BLI_quadric_from_v3_dist(&q, edge_cross, -dot_v3v3(edge_cross, e->v1->co));
+				BLI_quadric_mul(&q, BOUNDARY_PRESERVE_WEIGHT);
+
+				BLI_quadric_add_qu_qu(&vquadrics[BM_elem_index_get(e->v1)], &q);
+				BLI_quadric_add_qu_qu(&vquadrics[BM_elem_index_get(e->v2)], &q);
+			}
+		}
+	}
+}
+
+
+static void bm_decim_calc_target_co(BMEdge *e, float optimize_co[3],
+                                    const Quadric *vquadrics)
+{
+	/* compute an edge contration target for edge 'e'
+	 * this is computed by summing it's vertices quadrics and
+	 * optimizing the result. */
+	Quadric q;
+
+	BLI_quadric_add_qu_ququ(&q,
+	                        &vquadrics[BM_elem_index_get(e->v1)],
+	                        &vquadrics[BM_elem_index_get(e->v2)]);
+
+
+	if (BLI_quadric_optimize(&q, optimize_co, OPTIMIZE_EPS)) {
+		return;  /* all is good */
+	}
+	else {
+		mid_v3_v3v3(optimize_co, e->v1->co, e->v2->co);
+	}
+}
+
+static int bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_co[3])
+{
+	BMIter liter;
+	BMLoop *l;
+	unsigned int i;
+
+	for (i = 0; i < 2; i++) {
+		/* loop over both verts */
+		BMVert *v = *((&e->v1) + i);
+
+		BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+			if (l->e != e && l->prev->e != e) {
+				float *co_prev = l->prev->v->co;
+				float *co_next = l->next->v->co;
+				float cross_exist[3];
+				float cross_optim[3];
+
+#if 1
+				float vec_other[3];  /* line between the two outer verts, re-use for both cross products */
+				float vec_exist[3];  /* before collapse */
+				float vec_optim[3];  /* after collapse */
+
+				sub_v3_v3v3(vec_other, co_prev, co_next);
+				sub_v3_v3v3(vec_exist, co_prev, v->co);
+				sub_v3_v3v3(vec_optim, co_prev, optimize_co);
+
+				cross_v3_v3v3(cross_exist, vec_other, vec_exist);
+				cross_v3_v3v3(cross_optim, vec_other, vec_optim);
+
+				/* normalize isn't really needed, but ensures the value at a unit we can compare against */
+				normalize_v3(cross_exist);
+				normalize_v3(cross_optim);
+#else
+				normal_tri_v3(cross_exist, v->co,       co_prev, co_next);
+				normal_tri_v3(cross_optim, optimize_co, co_prev, co_next);
+#endif
+
+				/* use a small value rather then zero so we don't flip a face in multiple steps
+				 * (first making it zero area, then flipping again)*/
+				if (dot_v3v3(cross_exist, cross_optim) <= FLT_EPSILON) {
+					//printf("no flip\n");
+					return TRUE;
+				}
+			}
+		}
+	}
+
+	return FALSE;
+}
+
+static void bm_decim_build_edge_cost_single(BMEdge *e,
+                                            const Quadric *vquadrics, const float *vweights,
+                                            Heap *eheap, HeapNode **eheap_table)
+{
+	const Quadric *q1, *q2;
+	float optimize_co[3];
+	float cost;
+
+	if (eheap_table[BM_elem_index_get(e)]) {
+		BLI_heap_remove(eheap, eheap_table[BM_elem_index_get(e)]);
+	}
+
+	/* check we can collapse, some edges we better not touch */
+	if (BM_edge_is_boundary(e)) {
+		if (e->l->f->len == 3) {
+			/* pass */
+		}
+		else {
+			/* only collapse tri's */
+			eheap_table[BM_elem_index_get(e)] = NULL;
+			return;
+		}
+	}
+	else if (BM_edge_is_manifold(e)) {
+		if ((e->l->f->len == 3) && (e->l->radial_next->f->len == 3)) {
+			/* pass */
+		}
+		else {
+			/* only collapse tri's */
+			eheap_table[BM_elem_index_get(e)] = NULL;
+			return;
+		}
+	}
+	else {
+		eheap_table[BM_elem_index_get(e)] = NULL;
+		return;
+	}
+
+	if (vweights) {
+		if ((vweights[BM_elem_index_get(e->v1)] >= BM_MESH_DECIM_WEIGHT_MAX) &&
+		    (vweights[BM_elem_index_get(e->v2)] >= BM_MESH_DECIM_WEIGHT_MAX))
+		{
+			/* skip collapsing this edge */
+			eheap_table[BM_elem_index_get(e)] = NULL;
+			return;
+		}
+	}
+	/* end sanity check */
+
+
+	bm_decim_calc_target_co(e, optimize_co, vquadrics);
+
+	q1 = &vquadrics[BM_elem_index_get(e->v1)];
+	q2 = &vquadrics[BM_elem_index_get(e->v2)];
+
+	if (vweights == NULL) {
+		cost = (BLI_quadric_evaluate(q1, optimize_co) +
+		        BLI_quadric_evaluate(q2, optimize_co));
+	}
+	else {
+		/* add 1.0 so planar edges are still weighted against */
+		cost = (((BLI_quadric_evaluate(q1, optimize_co) + 1.0f) * vweights[BM_elem_index_get(e->v1)]) +
+		        ((BLI_quadric_evaluate(q2, optimize_co) + 1.0f) * vweights[BM_elem_index_get(e->v2)]));
+	}
+	// print("COST %.12f\n");
+
+	eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, cost, e);
+}
+
+
+/* use this for degenerate cases - add back to the heap with an invalid cost,
+ * this way it may be calculated again if surrounding geometry changes */
+static void bm_decim_invalid_edge_cost_single(BMEdge *e,
+                                              Heap *eheap, HeapNode **eheap_table)
+{
+	BLI_assert(eheap_table[BM_elem_index_get(e)] == NULL);
+	eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, COST_INVALID, e);
+}
+
+static void bm_decim_build_edge_cost(BMesh *bm,
+                                     const Quadric *vquadrics, const float *vweights,
+                                     Heap *eheap, HeapNode **eheap_table)
+{
+	BMIter iter;
+	BMEdge *e;
+	unsigned int i;
+
+	BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
+		eheap_table[i] = NULL;  /* keep sanity check happy */
+		bm_decim_build_edge_cost_single(e, vquadrics, vweights, eheap, eheap_table);
+	}
+}
+
+#ifdef USE_TRIANGULATE
+/* Temp Triangulation
+ * ****************** */
+
+/**
+ * To keep things simple we can only collapse edges on triangulated data
+ * (limitation with edge collapse and error calculation functions).
+ *
+ * But to avoid annoying users by only giving triangle results, we can
+ * triangulate, keeping a reference between the faces, then join after
+ * if the edges don't collapse, this will also allow more choices when
+ * collapsing edges so even has some advantage over decimating quads
+ * directly.
+ *
+ * \return TRUE if any faces were triangulated.
+ */
+
+static int bm_decim_triangulate_begin(BMesh *bm)
+{
+	BMIter iter;
+	BMFace *f;
+	// int has_quad;  // could optimize this a little
+	int has_cut = FALSE;
+
+	BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
+
+	/* first clear loop index values */
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMLoop *l_iter;
+		BMLoop *l_first;
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			BM_elem_index_set(l_iter, -1);
+		} while ((l_iter = l_iter->next) != l_first);
+
+		// has_quad |= (f->len == 4)
+	}
+
+	/* adding new faces as we loop over faces
+	 * is normally best avoided, however in this case its not so bad because any face touched twice
+	 * will already be triangulated*/
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (f->len == 4) {
+			BMLoop *f_l[4];
+			BMLoop *l_a, *l_b;
+
+			{
+				BMLoop *l_iter = BM_FACE_FIRST_LOOP(f);
+
+				f_l[0] = l_iter; l_iter = l_iter->next;
+				f_l[1] = l_iter; l_iter = l_iter->next;
+				f_l[2] = l_iter; l_iter = l_iter->next;
+				f_l[3] = l_iter;
+			}
+
+			if (len_squared_v3v3(f_l[0]->v->co, f_l[2]->v->co) <
+			    len_squared_v3v3(f_l[1]->v->co, f_l[3]->v->co))
+			{
+				l_a = f_l[0];
+				l_b = f_l[2];
+			}
+			else {
+				l_a = f_l[1];
+				l_b = f_l[3];
+			}
+
+#ifdef USE_SAFETY_CHECKS
+			if (BM_edge_exists(l_a->v, l_b->v) == FALSE)
+#endif
+			{
+				BMFace *f_new;
+				BMLoop *l_new;
+
+				/* warning, NO_DOUBLE option here isn't handled as nice as it could be
+				 * - if there is a quad that has a free standing edge joining it along
+				 * where we want to split the face, there isnt a good way we can handle this.
+				 * currently that edge will get removed when joining the tris back into a quad. */
+				f_new = BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE);
+
+				if (f_new) {
+					/* the value of this doesn't matter, only that the 2 loops match and have unique values */
+					const int f_index = BM_elem_index_get(f);
+
+					/* since we just split theres only ever 2 loops */
+					BLI_assert(BM_edge_is_manifold(l_new->e));
+
+					BM_elem_index_set(l_new, f_index);
+					BM_elem_index_set(l_new->radial_next, f_index);
+
+					BM_face_normal_update(f);
+					BM_face_normal_update(f_new);
+
+					has_cut = TRUE;
+				}
+			}
+		}
+	}
+
+	BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
+
+	if (has_cut) {
+		/* now triangulation is done we need to correct index values */
+		BM_mesh_elem_index_ensure(bm, BM_EDGE | BM_FACE);
+	}
+
+	return has_cut;
+}
+
+static void bm_decim_triangulate_end(BMesh *bm)
+{
+	/* decimation finished, now re-join */
+	BMIter iter;
+	BMEdge *e;
+
+	/* boundary edges */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMLoop *l_a, *l_b;
+		if (BM_edge_loop_pair(e, &l_a, &l_b)) {
+			const int l_a_index = BM_elem_index_get(l_a);
+			if (l_a_index != -1) {
+				const int l_b_index = BM_elem_index_get(l_b);
+				if (l_a_index == l_b_index) {
+					if (LIKELY(l_a->f->len == 3 && l_b->f->len == 3)) {
+						if (l_a->v != l_b->v) {  /* if this is the case, faces have become flipped */
+							/* check we are not making a degenerate quad */
+							BMVert *vquad[4] = {
+								e->v1,
+								BM_vert_in_edge(e, l_a->next->v) ? l_a->prev->v : l_a->next->v,
+								e->v2,
+								BM_vert_in_edge(e, l_b->next->v) ? l_b->prev->v : l_b->next->v,
+							};
+
+							BLI_assert(ELEM3(vquad[0], vquad[1], vquad[2], vquad[3]) == FALSE);
+							BLI_assert(ELEM3(vquad[1], vquad[0], vquad[2], vquad[3]) == FALSE);
+							BLI_assert(ELEM3(vquad[2], vquad[1], vquad[0], vquad[3]) == FALSE);
+							BLI_assert(ELEM3(vquad[3], vquad[1], vquad[2], vquad[0]) == FALSE);
+
+							if (is_quad_convex_v3(vquad[0]->co, vquad[1]->co, vquad[2]->co, vquad[3]->co)) {
+								/* highly unlikely to fail, but prevents possible double-ups */
+								BMFace *f[2] = {l_a->f, l_b->f};
+								BM_faces_join(bm, f, 2, TRUE);
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+}
+
+#endif  /* USE_TRIANGULATE */
+
+/* Edge Collapse Functions
+ * *********************** */
+
+#ifdef USE_CUSTOMDATA
+
+/**
+ * \param v is the target to merge into.
+ */
+static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_clear, BMVert *v_other,
+                                             const float customdata_fac)
+{
+	/* these don't need to be updated, since they will get removed when the edge collapses */
+	BMLoop *l_clear, *l_other;
+	const int is_manifold = BM_edge_is_manifold(l->e);
+	int side;
+
+	/* l defines the vert to collapse into  */
+
+	/* first find the loop of 'v_other' thats attached to the face of 'l' */
+	if (l->v == v_clear) {
+		l_clear = l;
+		l_other = l->next;
+	}
+	else {
+		l_clear = l->next;
+		l_other = l;
+	}
+
+	BLI_assert(l_clear->v == v_clear);
+	BLI_assert(l_other->v == v_other);
+	(void)v_other;  /* quiet warnings for release */
+
+	/* now we have both corners of the face 'l->f' */
+	for (side = 0; side < 2; side++) {
+		int is_seam = FALSE;
+		void *src[2];
+		BMFace *f_exit = is_manifold ? l->radial_next->f : NULL;
+		BMEdge *e_prev = l->e;
+		BMLoop *l_first;
+		BMLoop *l_iter;
+		float w[2];
+
+		if (side == 0) {
+			l_iter = l_first = l_clear;
+			src[0] = l_clear->head.data;
+			src[1] = l_other->head.data;
+
+			w[0] = customdata_fac;
+			w[1] = 1.0f - customdata_fac;
+		}
+		else {
+			l_iter = l_first = l_other;
+			src[0] = l_other->head.data;
+			src[1] = l_clear->head.data;
+
+			w[0] = 1.0f - customdata_fac;
+			w[1] = customdata_fac;
+		}
+
+		// print_v2("weights", w);
+
+		/* WATCH IT! - should NOT reference (_clear or _other) vars for this while loop */
+
+		/* walk around the fan using 'e_prev' */
+		while (((l_iter = BM_vert_step_fan_loop(l_iter, &e_prev)) != l_first) && (l_iter != NULL)) {
+			int i;
+			/* quit once we hit the opposite face, if we have one */
+			if (f_exit && UNLIKELY(f_exit == l_iter->f)) {
+				break;
+			}
+
+			/* break out unless we find a match */
+			is_seam = TRUE;
+
+			/* ok. we have a loop. now be smart with it! */
+			for (i = 0; i < bm->ldata.totlayer; i++) {
+				if (CustomData_layer_has_math(&bm->ldata, i)) {
+					const int offset = bm->ldata.layers[i].offset;
+					const int type = bm->ldata.layers[i].type;
+					void *cd_src, *cd_iter;
+
+					/* todo, make nicer macros for this */
+					cd_src = (char *)src[0] + offset;
+					// cd_dst = (char *)src[1] + offset;  // UNUSED
+					cd_iter  = (char *)l_iter->head.data  + offset;
+
+					/* detect seams */
+					if (CustomData_data_equals(type, cd_src, cd_iter)) {
+						CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, l_iter->head.data);
+						is_seam = FALSE;
+					}
+				}
+			}
+
+			if (is_seam) {
+				break;
+			}
+		}
+	}
+}
+#endif  /* USE_CUSTOMDATA */
+
+/**
+ * Check if the collapse will result in a degenerate mesh,
+ * that is - duplicate edges or faces.
+ *
+ * This situation could be checked for when calculating collapse cost
+ * however its quite slow and a degenerate collapse could eventuate
+ * after the cost is calculated, so instead, check just before collapsing.
+ */
+
+static void bm_edge_tag_enable(BMEdge *e)
+{
+	BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+	BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
+	if (e->l) {
+		BM_elem_flag_enable(e->l->f, BM_ELEM_TAG);
+		if (e->l != e->l->radial_next) {
+			BM_elem_flag_enable(e->l->radial_next->f, BM_ELEM_TAG);
+		}
+	}
+}
+
+static void bm_edge_tag_disable(BMEdge *e)
+{
+	BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+	BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+	if (e->l) {
+		BM_elem_flag_disable(e->l->f, BM_ELEM_TAG);
+		if (e->l != e->l->radial_next) {
+			BM_elem_flag_disable(e->l->radial_next->f, BM_ELEM_TAG);
+		}
+	}
+}
+
+static int bm_edge_tag_test(BMEdge *e)
+{
+	/* is the edge or one of its faces tagged? */
+	return (BM_elem_flag_test(e->v1, BM_ELEM_TAG) ||
+	        BM_elem_flag_test(e->v2, BM_ELEM_TAG) ||
+	        (e->l && (BM_elem_flag_test(e->l->f, BM_ELEM_TAG) ||
+	                  (e->l != e->l->radial_next &&
+	                  BM_elem_flag_test(e->l->radial_next->f, BM_ELEM_TAG))))
+	        );
+}
+
+/* takes the edges loop */
+BLI_INLINE int bm_edge_is_manifold_or_boundary(BMLoop *l)
+{
+#if 0
+	/* less optimized version of check below */
+	return (BM_edge_is_manifold(l->e) || BM_edge_is_boundary(l->e);
+#else
+	/* if the edge is a boundary it points to its self, else this must be a manifold */
+	return LIKELY(l) && LIKELY(l->radial_next->radial_next == l);
+#endif
+}
+
+static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
+{
+	/* simply check that there is no overlap between faces and edges of each vert,
+	 * (excluding the 2 faces attached to 'e' and 'e' its self) */
+
+	BMEdge *e_iter;
+
+	/* clear flags on both disks */
+	e_iter = e_first;
+	do {
+		if (!bm_edge_is_manifold_or_boundary(e_iter->l)) {
+			return TRUE;
+		}
+		bm_edge_tag_disable(e_iter);
+	} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v1)) != e_first);
+
+	e_iter = e_first;
+	do {
+		if (!bm_edge_is_manifold_or_boundary(e_iter->l)) {
+			return TRUE;
+		}
+		bm_edge_tag_disable(e_iter);
+	} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v2)) != e_first);
+
+	/* now enable one side... */
+	e_iter = e_first;
+	do {
+		bm_edge_tag_enable(e_iter);
+	} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v1)) != e_first);
+
+	/* ... except for the edge we will collapse, we know thats shared,
+	 * disable this to avoid false positive. We could be smart and never enable these
+	 * face/edge tags in the first place but easier to do this */
+	// bm_edge_tag_disable(e_first);
+	/* do inline... */
+	{
+#if 0
+		BMIter iter;
+		BMIter liter;
+		BMLoop *l;
+		BMVert *v;
+		BM_ITER_ELEM (l, &liter, e_first, BM_LOOPS_OF_EDGE) {
+			BM_elem_flag_disable(l->f, BM_ELEM_TAG);
+			BM_ITER_ELEM (v, &iter, l->f, BM_VERTS_OF_FACE) {
+				BM_elem_flag_disable(v, BM_ELEM_TAG);
+			}
+		}
+#else
+		/* we know each face is a triangle, no looping/iterators needed here */
+
+		BMLoop *l_radial;
+		BMLoop *l_face;
+
+		l_radial = e_first->l;
+		l_face = l_radial;
+		BLI_assert(l_face->f->len == 3);
+		BM_elem_flag_disable(l_face->f, BM_ELEM_TAG);
+		BM_elem_flag_disable((l_face = l_radial)->v,     BM_ELEM_TAG);
+		BM_elem_flag_disable((l_face = l_face->next)->v, BM_ELEM_TAG);
+		BM_elem_flag_disable((         l_face->next)->v, BM_ELEM_TAG);
+		l_face = l_radial->radial_next;
+		if (l_radial != l_face) {
+			BLI_assert(l_face->f->len == 3);
+			BM_elem_flag_disable(l_face->f, BM_ELEM_TAG);
+			BM_elem_flag_disable((l_face = l_radial->radial_next)->v, BM_ELEM_TAG);
+			BM_elem_flag_disable((l_face = l_face->next)->v,          BM_ELEM_TAG);
+			BM_elem_flag_disable((         l_face->next)->v,          BM_ELEM_TAG);
+		}
+#endif
+	}
+
+	/* and check for overlap */
+	e_iter = e_first;
+	do {
+		if (bm_edge_tag_test(e_iter)) {
+			return TRUE;
+		}
+	} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v2)) != e_first);
+
+	return FALSE;
+}
+
+/**
+ * special, highly limited edge collapse function
+ * intended for speed over flexibiliy.
+ * can only collapse edges connected to (1, 2) tris.
+ *
+ * Important - dont add vert/edge/face data on collapsing!
+ *
+ * \param e_clear_other let caller know what edges we remove besides \a e_clear
+ * \param customdata_flag merge factor, scales from 0 - 1 ('v_clear' -> 'v_other')
+ */
+static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2],
+#ifdef USE_CUSTOMDATA
+                            const CD_UseFlag customdata_flag,
+                            const float customdata_fac
+#else
+                            const CD_UseFlag UNUSED(customdata_flag),
+                            const float UNUSED(customdata_fac)
+#endif
+                            )
+{
+	BMVert *v_other;
+
+	v_other = BM_edge_other_vert(e_clear, v_clear);
+	BLI_assert(v_other != NULL);
+
+	if (BM_edge_is_manifold(e_clear)) {
+		BMLoop *l_a, *l_b;
+		BMEdge *e_a_other[2], *e_b_other[2];
+		int ok;
+
+		ok = BM_edge_loop_pair(e_clear, &l_a, &l_b);
+
+		BLI_assert(ok == TRUE);
+		BLI_assert(l_a->f->len == 3);
+		BLI_assert(l_b->f->len == 3);
+
+		/* keep 'v_clear' 0th */
+		if (BM_vert_in_edge(l_a->prev->e, v_clear)) {
+			e_a_other[0] = l_a->prev->e;
+			e_a_other[1] = l_a->next->e;
+		}
+		else {
+			e_a_other[1] = l_a->prev->e;
+			e_a_other[0] = l_a->next->e;
+		}
+
+		if (BM_vert_in_edge(l_b->prev->e, v_clear)) {
+			e_b_other[0] = l_b->prev->e;
+			e_b_other[1] = l_b->next->e;
+		}
+		else {
+			e_b_other[1] = l_b->prev->e;
+			e_b_other[0] = l_b->next->e;
+		}
+
+		BLI_assert(BM_edge_share_vert(e_a_other[0], e_b_other[0]));
+		BLI_assert(BM_edge_share_vert(e_a_other[1], e_b_other[1]));
+
+		/* we could assert this case, but better just bail out */
+#if 0
+		BLI_assert(e_a_other[0] != e_b_other[0]);
+		BLI_assert(e_a_other[0] != e_b_other[1]);
+		BLI_assert(e_b_other[0] != e_a_other[0]);
+		BLI_assert(e_b_other[0] != e_a_other[1]);
+#endif
+		/* not totally common but we want to avoid */
+		if (ELEM(e_a_other[0], e_b_other[0], e_b_other[1]) ||
+		    ELEM(e_a_other[1], e_b_other[0], e_b_other[1]))
+		{
+			return FALSE;
+		}
+
+		r_e_clear_other[0] = BM_elem_index_get(e_a_other[0]);
+		r_e_clear_other[1] = BM_elem_index_get(e_b_other[0]);
+
+#ifdef USE_CUSTOMDATA
+		/* before killing, do customdata */
+		if (customdata_flag & CD_DO_VERT) {
+			BM_data_interp_from_verts(bm, v_other, v_clear, v_other, customdata_fac);
+		}
+		if (customdata_flag & CD_DO_EDGE) {
+			BM_data_interp_from_edges(bm, e_a_other[1], e_a_other[0], e_a_other[1], customdata_fac);
+			BM_data_interp_from_edges(bm, e_b_other[1], e_b_other[0], e_b_other[1], customdata_fac);
+		}
+		if (customdata_flag & CD_DO_LOOP) {
+			bm_edge_collapse_loop_customdata(bm, e_clear->l,              v_clear, v_other, customdata_fac);
+			bm_edge_collapse_loop_customdata(bm, e_clear->l->radial_next, v_clear, v_other, customdata_fac);
+		}
+#endif
+
+		BM_edge_kill(bm, e_clear);
+
+		v_other->head.hflag |= v_clear->head.hflag;
+		BM_vert_splice(bm, v_clear, v_other);
+
+		e_a_other[1]->head.hflag |= e_a_other[0]->head.hflag;
+		e_b_other[1]->head.hflag |= e_b_other[0]->head.hflag;
+		BM_edge_splice(bm, e_a_other[0], e_a_other[1]);
+		BM_edge_splice(bm, e_b_other[0], e_b_other[1]);
+
+		// BM_mesh_validate(bm);
+
+		return TRUE;
+	}
+	else if (BM_edge_is_boundary(e_clear)) {
+		/* same as above but only one triangle */
+		BMLoop *l_a;
+		BMEdge *e_a_other[2];
+
+		l_a = e_clear->l;
+
+		BLI_assert(l_a->f->len == 3);
+
+		/* keep 'v_clear' 0th */
+		if (BM_vert_in_edge(l_a->prev->e, v_clear)) {
+			e_a_other[0] = l_a->prev->e;
+			e_a_other[1] = l_a->next->e;
+		}
+		else {
+			e_a_other[1] = l_a->prev->e;
+			e_a_other[0] = l_a->next->e;
+		}
+
+		r_e_clear_other[0] = BM_elem_index_get(e_a_other[0]);
+		r_e_clear_other[1] = -1;
+
+#ifdef USE_CUSTOMDATA
+		/* before killing, do customdata */
+		if (customdata_flag & CD_DO_VERT) {
+			BM_data_interp_from_verts(bm, v_other, v_clear, v_other, customdata_fac);
+		}
+		if (customdata_flag & CD_DO_EDGE) {
+			BM_data_interp_from_edges(bm, e_a_other[1], e_a_other[0], e_a_other[1], customdata_fac);
+		}
+		if (customdata_flag & CD_DO_LOOP) {
+			bm_edge_collapse_loop_customdata(bm, e_clear->l, v_clear, v_other, customdata_fac);
+		}
+#endif
+
+		BM_edge_kill(bm, e_clear);
+
+		v_other->head.hflag |= v_clear->head.hflag;
+		BM_vert_splice(bm, v_clear, v_other);
+
+		e_a_other[1]->head.hflag |= e_a_other[0]->head.hflag;
+		BM_edge_splice(bm, e_a_other[0], e_a_other[1]);
+
+		// BM_mesh_validate(bm);
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+
+/* collapse e the edge, removing e->v2 */
+static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
+                                   Quadric *vquadrics, float *vweights,
+                                   Heap *eheap, HeapNode **eheap_table,
+                                   const CD_UseFlag customdata_flag)
+{
+	int e_clear_other[2];
+	BMVert *v_other = e->v1;
+	int v_clear_index = BM_elem_index_get(e->v2);  /* the vert is removed so only store the index */
+	float optimize_co[3];
+	float customdata_fac;
+
+#ifdef USE_VERT_NORMAL_INTERP
+	float v_clear_no[3];
+	copy_v3_v3(v_clear_no, e->v2->no);
+#endif
+
+	/* disallow collapsing which results in degenerate cases */
+	if (UNLIKELY(bm_edge_collapse_is_degenerate_topology(e))) {
+		bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);  /* add back with a high cost */
+		return;
+	}
+
+	bm_decim_calc_target_co(e, optimize_co, vquadrics);
+
+	/* check if this would result in an overlapping face */
+	if (UNLIKELY(bm_edge_collapse_is_degenerate_flip(e, optimize_co))) {
+		bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);  /* add back with a high cost */
+		return;
+	}
+
+	/* use for customdata merging */
+	if (LIKELY(compare_v3v3(e->v1->co, e->v2->co, FLT_EPSILON) == FALSE)) {
+		customdata_fac = line_point_factor_v3(optimize_co, e->v1->co, e->v2->co);
+#if 0
+		/* simple test for stupid collapse */
+		if (customdata_fac < 0.0 - FLT_EPSILON || customdata_fac > 1.0f + FLT_EPSILON) {
+			return;
+		}
+#endif
+	}
+	else {
+		/* avoid divide by zero */
+		customdata_fac = 0.5f;
+	}
+
+	if (bm_edge_collapse(bm, e, e->v2, e_clear_other, customdata_flag, customdata_fac)) {
+		/* update collapse info */
+		int i;
+
+		if (vweights) {
+			vweights[BM_elem_index_get(v_other)] += vweights[v_clear_index];
+		}
+
+		e = NULL;  /* paranoid safety check */
+
+		copy_v3_v3(v_other->co, optimize_co);
+
+		/* remove eheap */
+		for (i = 0; i < 2; i++) {
+			/* highly unlikely 'eheap_table[ke_other[i]]' would be NULL, but do for sanity sake */
+			if ((e_clear_other[i] != -1) && (eheap_table[e_clear_other[i]] != NULL)) {
+				BLI_heap_remove(eheap, eheap_table[e_clear_other[i]]);
+				eheap_table[e_clear_other[i]] = NULL;
+			}
+		}
+
+		/* update vertex quadric, add kept vertex from killed vertex */
+		BLI_quadric_add_qu_qu(&vquadrics[BM_elem_index_get(v_other)], &vquadrics[v_clear_index]);
+
+		/* update connected normals */
+
+		/* in fact face normals are not used for progressive updates, no need to update them */
+		// BM_vert_normal_update_all(v);
+#ifdef USE_VERT_NORMAL_INTERP
+		interp_v3_v3v3(v_other->no, v_other->no, v_clear_no, customdata_fac);
+		normalize_v3(v_other->no);
+#else
+		BM_vert_normal_update(v_other);
+#endif
+
+
+		/* update error costs and the eheap */
+		if (LIKELY(v_other->e)) {
+			BMEdge *e_iter;
+			BMEdge *e_first;
+			e_iter = e_first = v_other->e;
+			do {
+				BLI_assert(BM_edge_find_double(e_iter) == NULL);
+				bm_decim_build_edge_cost_single(e_iter, vquadrics, vweights, eheap, eheap_table);
+			} while ((e_iter = bmesh_disk_edge_next(e_iter, v_other)) != e_first);
+		}
+
+		/* this block used to be disabled,
+		 * but enable now since surrounding faces may have been
+		 * set to COST_INVALID because of a face overlap that no longer occurs */
+#if 1
+		/* optional, update edges around the vertex face fan */
+		{
+			BMIter liter;
+			BMLoop *l;
+			BM_ITER_ELEM (l, &liter, v_other, BM_LOOPS_OF_VERT) {
+				if (l->f->len == 3) {
+					BMEdge *e_outer;
+					if (BM_vert_in_edge(l->prev->e, l->v))
+						e_outer = l->next->e;
+					else
+						e_outer = l->prev->e;
+
+					BLI_assert(BM_vert_in_edge(e_outer, l->v) == FALSE);
+
+					bm_decim_build_edge_cost_single(e_outer, vquadrics, vweights, eheap, eheap_table);
+				}
+			}
+		}
+		/* end optional update */
+#endif
+	}
+	else {
+		/* add back with a high cost */
+		bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);
+	}
+}
+
+
+/* Main Decimate Function
+ * ********************** */
+
+/**
+ * \brief BM_mesh_decimate
+ * \param bm The mesh
+ * \param factor face count multiplier [0 - 1]
+ * \param vweights Optional array of vertex  aligned weights [0 - 1],
+ *        a vertex group is the usual source for this.
+ */
+void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const int do_triangulate)
+{
+	Heap *eheap;             /* edge heap */
+	HeapNode **eheap_table;  /* edge index aligned table pointing to the eheap */
+	Quadric *vquadrics;      /* vert index aligned quadrics */
+	int tot_edge_orig;
+	int face_tot_target;
+	int use_triangulate;
+
+	CD_UseFlag customdata_flag = 0;
+
+#ifdef USE_TRIANGULATE
+	/* temp convert quads to triangles */
+	use_triangulate = bm_decim_triangulate_begin(bm);
+#endif
+
+
+	/* alloc vars */
+	vquadrics = MEM_callocN(sizeof(Quadric) * bm->totvert, __func__);
+	/* since some edges may be degenerate, we might be over allocing a little here */
+	eheap = BLI_heap_new_ex(bm->totedge);
+	eheap_table = MEM_callocN(sizeof(HeapNode *) * bm->totedge, __func__);
+	tot_edge_orig = bm->totedge;
+
+
+	/* build initial edge collapse cost data */
+	bm_decim_build_quadrics(bm, vquadrics);
+
+	bm_decim_build_edge_cost(bm, vquadrics, vweights, eheap, eheap_table);
+
+	face_tot_target = bm->totface * factor;
+	bm->elem_index_dirty |= BM_FACE | BM_EDGE | BM_VERT;
+
+
+#ifdef USE_CUSTOMDATA
+	/* initialize customdata flag, we only need math for loops */
+	if (CustomData_has_interp(&bm->vdata))  customdata_flag |= CD_DO_VERT;
+	if (CustomData_has_interp(&bm->edata))  customdata_flag |= CD_DO_EDGE;
+	if (CustomData_has_math(&bm->ldata))    customdata_flag |= CD_DO_LOOP;
+#endif
+
+	/* iterative edge collapse and maintain the eheap */
+	while ((bm->totface > face_tot_target) &&
+	       (BLI_heap_is_empty(eheap) == FALSE) &&
+	       (BLI_heap_node_value(BLI_heap_top(eheap)) != COST_INVALID))
+	{
+		// const float value = BLI_heap_node_value(BLI_heap_top(eheap));
+		BMEdge *e = BLI_heap_popmin(eheap);
+		BLI_assert(BM_elem_index_get(e) < tot_edge_orig);  /* handy to detect corruptions elsewhere */
+
+		// printf("COST %.10f\n", value);
+
+		/* under normal conditions wont be accessed again,
+		 * but NULL just incase so we don't use freed node */
+		eheap_table[BM_elem_index_get(e)] = NULL;
+
+		bm_decim_edge_collapse(bm, e, vquadrics, vweights, eheap, eheap_table, customdata_flag);
+	}
+
+
+#ifdef USE_TRIANGULATE
+	if (do_triangulate == FALSE) {
+		/* its possible we only had triangles, skip this step in that case */
+		if (LIKELY(use_triangulate)) {
+			/* temp convert quads to triangles */
+			bm_decim_triangulate_end(bm);
+		}
+	}
+#endif
+
+	/* free vars */
+	MEM_freeN(vquadrics);
+	MEM_freeN(eheap_table);
+	BLI_heap_free(eheap, NULL);
+
+	/* testing only */
+	// BM_mesh_validate(bm);
+
+	(void)tot_edge_orig;  /* quiet release build warning */
+}
diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
new file mode 100644
index 0000000..f67f01e
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
@@ -0,0 +1,240 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_decimate_dissolve.c
+ *  \ingroup bmesh
+ *
+ * BMesh decimator that dissolves flat areas into polygons (ngons).
+ */
+
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "bmesh_decimate.h"  /* own include */
+
+#define UNIT_TO_ANGLE DEG2RADF(90.0f)
+#define ANGLE_TO_UNIT (1.0f / UNIT_TO_ANGLE)
+
+/* multiply vertex edge angle by face angle
+ * this means we are not left with sharp corners between _almost_ planer faces
+ * convert angles [0-PI/2] -> [0-1], multiply together, then convert back to radians. */
+static float bm_vert_edge_face_angle(BMVert *v)
+{
+	const float angle = BM_vert_calc_edge_angle(v);
+	/* note: could be either edge, it doesn't matter */
+	if (v->e && BM_edge_is_manifold(v->e)) {
+		return ((angle * ANGLE_TO_UNIT) * (BM_edge_calc_face_angle(v->e) * ANGLE_TO_UNIT)) * UNIT_TO_ANGLE;
+	}
+	else {
+		return angle;
+	}
+}
+
+#undef UNIT_TO_ANGLE
+#undef ANGLE_TO_UNIT
+
+typedef struct DissolveElemWeight {
+	BMHeader *ele;
+	float weight;
+} DissolveElemWeight;
+
+static int dissolve_elem_cmp(const void *a1, const void *a2)
+{
+	const struct DissolveElemWeight *d1 = a1, *d2 = a2;
+
+	if      (d1->weight > d2->weight) return  1;
+	else if (d1->weight < d2->weight) return -1;
+	return 0;
+}
+
+void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries,
+                                  BMVert **vinput_arr, const int vinput_len,
+                                  BMEdge **einput_arr, const int einput_len)
+{
+	const float angle_max = (float)M_PI / 2.0f;
+	DissolveElemWeight *weight_elems = MEM_mallocN(max_ii(einput_len, vinput_len) *
+	                                               sizeof(DissolveElemWeight), __func__);
+	int i, tot_found;
+
+	BMIter iter;
+	BMEdge *e_iter;
+	BMEdge **earray;
+
+	int *vert_reverse_lookup;
+
+	/* --- first edges --- */
+
+	/* wire -> tag */
+	BM_ITER_MESH (e_iter, &iter, bm, BM_EDGES_OF_MESH) {
+		BM_elem_flag_set(e_iter, BM_ELEM_TAG, BM_edge_is_wire(e_iter));
+	}
+
+	/* go through and split edge */
+	for (i = 0, tot_found = 0; i < einput_len; i++) {
+		BMEdge *e = einput_arr[i];
+		const float angle = BM_edge_calc_face_angle(e);
+
+		if (angle < angle_limit) {
+			tot_found++;
+		}
+		weight_elems[i].ele = (BMHeader *)e;
+		weight_elems[i].weight = angle;
+	}
+
+	if (tot_found != 0) {
+		qsort(weight_elems, einput_len, sizeof(DissolveElemWeight), dissolve_elem_cmp);
+
+		for (i = 0; i < tot_found; i++) {
+			BMEdge *e = (BMEdge *)weight_elems[i].ele;
+
+			if (/* may have become non-manifold */
+			    BM_edge_is_manifold(e) &&
+			    /* check twice because cumulative effect could dissolve over angle limit */
+			    (BM_edge_calc_face_angle(e) < angle_limit))
+			{
+				BMFace *nf = BM_faces_join_pair(bm, e->l->f,
+				                                e->l->radial_next->f,
+				                                e,
+				                                FALSE); /* join faces */
+
+				/* there may be some errors, we don't mind, just move on */
+				if (nf) {
+					BM_face_normal_update(nf);
+				}
+				else {
+					BMO_error_clear(bm);
+				}
+			}
+		}
+	}
+
+	/* prepare for cleanup */
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+	vert_reverse_lookup = MEM_mallocN(sizeof(int) * bm->totvert, __func__);
+	fill_vn_i(vert_reverse_lookup, bm->totvert, -1);
+	for (i = 0, tot_found = 0; i < vinput_len; i++) {
+		BMVert *v = vinput_arr[i];
+		vert_reverse_lookup[BM_elem_index_get(v)] = i;
+	}
+
+	/* --- cleanup --- */
+	earray = MEM_mallocN(sizeof(BMEdge *) * bm->totedge, __func__);
+	BM_ITER_MESH_INDEX (e_iter, &iter, bm, BM_EDGES_OF_MESH, i) {
+		earray[i] = e_iter;
+	}
+	/* remove all edges/verts left behind from dissolving, NULL'ing the vertex array so we dont re-use */
+	for (i = bm->totedge - 1; i != -1; i--) {
+		e_iter = earray[i];
+
+		if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == FALSE)) {
+			/* edge has become wire */
+			int vidx_reverse;
+			BMVert *v1 = e_iter->v1;
+			BMVert *v2 = e_iter->v2;
+			BM_edge_kill(bm, e_iter);
+			if (v1->e == NULL) {
+				vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v1)];
+				if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
+				BM_vert_kill(bm, v1);
+			}
+			if (v2->e == NULL) {
+				vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v2)];
+				if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
+				BM_vert_kill(bm, v2);
+			}
+		}
+	}
+	MEM_freeN(vert_reverse_lookup);
+
+	MEM_freeN(earray);
+
+
+	/* --- second verts --- */
+	if (do_dissolve_boundaries) {
+		/* simple version of the branch below, sincve we will dissolve _all_ verts that use 2 edges */
+		for (i = 0; i < vinput_len; i++) {
+			BMVert *v = vinput_arr[i];
+			if (LIKELY(v != NULL) &&
+			    BM_vert_edge_count(v) == 2)
+			{
+				BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
+			}
+		}
+	}
+	else {
+		for (i = 0, tot_found = 0; i < vinput_len; i++) {
+			BMVert *v = vinput_arr[i];
+			const float angle = v ? bm_vert_edge_face_angle(v) : angle_limit;
+
+			if (angle < angle_limit) {
+				weight_elems[i].ele = (BMHeader *)v;
+				weight_elems[i].weight = angle;
+				tot_found++;
+			}
+			else {
+				weight_elems[i].ele = NULL;
+				weight_elems[i].weight = angle_max;
+			}
+		}
+
+		if (tot_found != 0) {
+			qsort(weight_elems, vinput_len, sizeof(DissolveElemWeight), dissolve_elem_cmp);
+
+			for (i = 0; i < tot_found; i++) {
+				BMVert *v = (BMVert *)weight_elems[i].ele;
+				if (LIKELY(v != NULL) &&
+				    /* topology changes may cause this to be un-collapsable */
+				    (BM_vert_edge_count(v) == 2) &&
+				    /* check twice because cumulative effect could dissolve over angle limit */
+				    bm_vert_edge_face_angle(v) < angle_limit)
+				{
+					BMEdge *ne = BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
+
+					if (ne && ne->l) {
+						BM_edge_normals_update(ne);
+					}
+				}
+			}
+		}
+	}
+
+	MEM_freeN(weight_elems);
+}
+
+void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries)
+{
+	int vinput_len;
+	int einput_len;
+
+	BMVert **vinput_arr = BM_iter_as_arrayN(bm, BM_VERTS_OF_MESH, NULL, &vinput_len, NULL, 0);
+	BMEdge **einput_arr = BM_iter_as_arrayN(bm, BM_EDGES_OF_MESH, NULL, &einput_len, NULL, 0);
+
+	BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries,
+	                             vinput_arr, vinput_len,
+	                             einput_arr, einput_len);
+
+	MEM_freeN(vinput_arr);
+	MEM_freeN(einput_arr);
+}
diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
new file mode 100644
index 0000000..acdab25
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
@@ -0,0 +1,344 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_decimate_unsubdivide.c
+ *  \ingroup bmesh
+ *
+ * BMesh decimator that uses a grid un-subdivide method.
+ */
+
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+
+static int bm_vert_dissolve_fan_test(BMVert *v)
+{
+	/* check if we should walk over these verts */
+	BMIter iter;
+	BMEdge *e;
+
+	unsigned int tot_edge = 0;
+	unsigned int tot_edge_boundary = 0;
+	unsigned int tot_edge_manifold = 0;
+	unsigned int tot_edge_wire     = 0;
+
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		if (BM_edge_is_boundary(e)) {
+			tot_edge_boundary++;
+		}
+		else if (BM_edge_is_manifold(e)) {
+			tot_edge_manifold++;
+		}
+		else if (BM_edge_is_wire(e)) {
+			tot_edge_wire++;
+		}
+		tot_edge++;
+	}
+
+	if ((tot_edge == 4) && (tot_edge_boundary == 0) && (tot_edge_manifold == 4)) {
+		return TRUE;
+	}
+	else if ((tot_edge == 3) && (tot_edge_boundary == 0) && (tot_edge_manifold == 3)) {
+		return TRUE;
+	}
+	else if ((tot_edge == 3) && (tot_edge_boundary == 2) && (tot_edge_manifold == 1)) {
+		return TRUE;
+	}
+	else if ((tot_edge == 2) && (tot_edge_wire == 2)) {
+		return TRUE;
+	}
+	return FALSE;
+}
+
+static int bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
+{
+	/* collapse under 2 conditions.
+	 * - vert connects to 4 manifold edges (and 4 faces).
+	 * - vert connecrs to 1 manifold edge, 2 boundary edges (and 2 faces).
+	 *
+	 * This covers boundary verts of a quad grid and center verts.
+	 * note that surrounding faces dont have to be quads.
+	 */
+
+	BMIter iter;
+	BMEdge *e;
+
+	unsigned int tot_loop = 0;
+	unsigned int tot_edge = 0;
+	unsigned int tot_edge_boundary = 0;
+	unsigned int tot_edge_manifold = 0;
+	unsigned int tot_edge_wire     = 0;
+
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		if (BM_edge_is_boundary(e)) {
+			tot_edge_boundary++;
+		}
+		else if (BM_edge_is_manifold(e)) {
+			tot_edge_manifold++;
+		}
+		else if (BM_edge_is_wire(e)) {
+			tot_edge_wire++;
+		}
+		tot_edge++;
+	}
+
+	if (tot_edge == 2) {
+		/* check for 2 wire verts only */
+		if (tot_edge_wire == 2) {
+			return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+		}
+	}
+	else if (tot_edge == 4) {
+		/* check for 4 faces surrounding */
+		if (tot_edge_boundary == 0 && tot_edge_manifold == 4) {
+			/* good to go! */
+			tot_loop = 4;
+		}
+	}
+	else if (tot_edge == 3) {
+		/* check for 2 faces surrounding at a boundary */
+		if (tot_edge_boundary == 2 && tot_edge_manifold == 1) {
+			/* good to go! */
+			tot_loop = 2;
+		}
+		else if (tot_edge_boundary == 0 && tot_edge_manifold == 3) {
+			/* good to go! */
+			tot_loop = 3;
+		}
+	}
+
+	if (tot_loop) {
+		BMLoop *f_loop[4];
+		unsigned int i;
+
+		/* ensure there are exactly tot_loop loops */
+		BLI_assert(BM_iter_at_index(bm, BM_LOOPS_OF_VERT, v, tot_loop) == NULL);
+		BM_iter_as_array(bm, BM_LOOPS_OF_VERT, v, (void **)f_loop, tot_loop);
+
+		for (i = 0; i < tot_loop; i++) {
+			BMLoop *l = f_loop[i];
+			if (l->f->len > 3) {
+				BMLoop *l_new;
+				BLI_assert(l->prev->v != l->next->v);
+				BM_face_split(bm, l->f, l->prev->v, l->next->v, &l_new, NULL, TRUE);
+				BM_elem_flag_merge_into(l_new->e, l->e, l->prev->e);
+			}
+		}
+
+		return BM_vert_dissolve(bm, v);
+	}
+
+	return FALSE;
+}
+
+enum {
+	VERT_INDEX_DO_COLLAPSE  = -1,
+	VERT_INDEX_INIT         =  0,
+	VERT_INDEX_IGNORE       =  1
+};
+
+// #define USE_WALKER  /* gives uneven results, disable for now */
+
+/* - BMVert.flag & BM_ELEM_TAG:  shows we touched this vert
+ * - BMVert.index == -1:         shows we will remove this vert
+ */
+
+/**
+ * \param tag_only so we can call this from an operator */
+void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int tag_only)
+{
+#ifdef USE_WALKER
+#  define ELE_VERT_TAG 1
+#else
+	BMVert **vert_seek_a = MEM_mallocN(sizeof(BMVert *) * bm->totvert, __func__);
+	BMVert **vert_seek_b = MEM_mallocN(sizeof(BMVert *) * bm->totvert, __func__);
+	unsigned vert_seek_a_tot = 0;
+	unsigned vert_seek_b_tot = 0;
+#endif
+
+	BMVert *v;
+	BMIter iter;
+
+	const unsigned int offset = 0;
+	const unsigned int nth = 2;
+
+	int iter_step;
+
+	/* if tag_only is set, we assyme the caller knows what verts to tag
+	 * needed for the operator */
+	if (tag_only == FALSE) {
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			BM_elem_flag_enable(v, BM_ELEM_TAG);
+		}
+	}
+
+	for (iter_step = 0; iter_step < iterations; iter_step++) {
+		int iter_done;
+
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG) && bm_vert_dissolve_fan_test(v)) {
+#ifdef USE_WALKER
+				BMO_elem_flag_enable(bm, v, ELE_VERT_TAG);
+#endif
+				BM_elem_index_set(v, VERT_INDEX_INIT);  /* set_dirty! */
+			}
+			else {
+				BM_elem_index_set(v, VERT_INDEX_IGNORE);  /* set_dirty! */
+			}
+		}
+		/* done with selecting tagged verts */
+
+
+		/* main loop, keep tagging until we can't tag any more islands */
+		while (TRUE) {
+#ifdef USE_WALKER
+			BMWalker walker;
+#else
+			unsigned int depth = 1;
+			unsigned int i;
+#endif
+			BMVert *v_first = NULL;
+			BMVert *v;
+
+			/* we could avoid iterating from the start each time */
+			BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+				if (v->e && (BM_elem_index_get(v) == VERT_INDEX_INIT)) {
+#ifdef USE_WALKER
+					if (BMO_elem_flag_test(bm, v, ELE_VERT_TAG))
+#endif
+					{
+						/* check again incase the topology changed */
+						if (bm_vert_dissolve_fan_test(v)) {
+							v_first = v;
+						}
+						break;
+					}
+				}
+			}
+			if (v_first == NULL) {
+				break;
+			}
+
+#ifdef USE_WALKER
+			/* Walk over selected elements starting at active */
+			BMW_init(&walker, bm, BMW_CONNECTED_VERTEX,
+			         ELE_VERT_TAG, BMW_MASK_NOP, BMW_MASK_NOP,
+			         BMW_FLAG_NOP, /* don't use BMW_FLAG_TEST_HIDDEN here since we want to desel all */
+			         BMW_NIL_LAY);
+
+			BLI_assert(walker.order == BMW_BREADTH_FIRST);
+			for (v = BMW_begin(&walker, v_first); v != NULL; v = BMW_step(&walker)) {
+				/* Deselect elements that aren't at "nth" depth from active */
+				if (BM_elem_index_get(v) == VERT_INDEX_INIT) {
+					if ((offset + BMW_current_depth(&walker)) % nth) {
+						/* tag for removal */
+						BM_elem_index_set(v, VERT_INDEX_DO_COLLAPSE);  /* set_dirty! */
+					}
+					else {
+						/* works better to allow these verts to be checked again */
+						//BM_elem_index_set(v, VERT_INDEX_IGNORE);  /* set_dirty! */
+					}
+				}
+			}
+			BMW_end(&walker);
+#else
+
+			BM_elem_index_set(v_first, (offset + depth) % nth ? VERT_INDEX_IGNORE : VERT_INDEX_DO_COLLAPSE);  /* set_dirty! */
+
+			vert_seek_b_tot = 0;
+			vert_seek_b[vert_seek_b_tot++] = v_first;
+
+			while (TRUE) {
+				BMEdge *e;
+
+				if ((offset + depth) % nth) {
+					vert_seek_a_tot = 0;
+					for (i = 0; i < vert_seek_b_tot; i++) {
+						v = vert_seek_b[i];
+						BLI_assert(BM_elem_index_get(v) == VERT_INDEX_IGNORE);
+						BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+							BMVert *v_other = BM_edge_other_vert(e, v);
+							if (BM_elem_index_get(v_other) == VERT_INDEX_INIT) {
+								BM_elem_index_set(v_other, VERT_INDEX_DO_COLLAPSE);  /* set_dirty! */
+								vert_seek_a[vert_seek_a_tot++] = v_other;
+							}
+						}
+					}
+					if (vert_seek_a_tot == 0) {
+						break;
+					}
+				}
+				else {
+					vert_seek_b_tot = 0;
+					for (i = 0; i < vert_seek_a_tot; i++) {
+						v = vert_seek_a[i];
+						BLI_assert(BM_elem_index_get(v) == VERT_INDEX_DO_COLLAPSE);
+						BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+							BMVert *v_other = BM_edge_other_vert(e, v);
+							if (BM_elem_index_get(v_other) == VERT_INDEX_INIT) {
+								BM_elem_index_set(v_other, VERT_INDEX_IGNORE);  /* set_dirty! */
+								vert_seek_b[vert_seek_b_tot++] = v_other;
+							}
+						}
+					}
+					if (vert_seek_b_tot == 0) {
+						break;
+					}
+				}
+
+				depth++;
+			}
+#endif  /* USE_WALKER */
+
+		}
+
+		/* now we tagged all verts -1 for removal, lets loop over and rebuild faces */
+		iter_done = FALSE;
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_index_get(v) == VERT_INDEX_DO_COLLAPSE) {
+				iter_done |= bm_vert_dissolve_fan(bm, v);
+			}
+		}
+
+		if (iter_done == FALSE) {
+			break;
+		}
+	}
+
+	bm->elem_index_dirty |= BM_VERT;
+
+#ifndef USE_WALKER
+	MEM_freeN(vert_seek_a);
+	MEM_freeN(vert_seek_b);
+#endif
+}
+
+void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations)
+{
+	BM_mesh_decimate_unsubdivide_ex(bm, iterations, FALSE);
+}
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 0e8ead6..26b5edf 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -184,7 +184,7 @@ std::string AnimationExporter::getObjectBoneName(Object *ob, const FCurve *fcu)
 
 	if (boneName != NULL)
 		return /*id_name(ob) + "_" +*/ std::string(boneName);
-	else		
+	else
 		return id_name(ob);
 }
 
@@ -265,7 +265,7 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
 		MEM_freeN(eul);
 		MEM_freeN(eul_axis);
 	}
-	else if(!strcmp(transformName, "lens") && (ob->type == OB_CAMERA)) {
+	else if (!strcmp(transformName, "lens") && (ob->type == OB_CAMERA)) {
 		output_id = create_lens_source_from_fcurve((Camera *) ob->data, COLLADASW::InputSemantic::OUTPUT, fcu, anim_id);
 	}
 	else {
@@ -584,8 +584,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
 			values[0] = convert_time(bezt->vec[0][0]);
 			if (bezt->ipo != BEZT_IPO_BEZ) {
 				// We're in a mixed interpolation scenario, set zero as it's irrelevant but value might contain unused data
-				values[0] = 0;	
-				values[1] = 0; 	
+				values[0] = 0;
+				values[1] = 0;
 			}
 			else if (is_rotation) {
 				values[1] = RAD2DEGF(bezt->vec[0][1]);
@@ -600,8 +600,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
 			values[0] = convert_time(bezt->vec[2][0]);
 			if (bezt->ipo != BEZT_IPO_BEZ) {
 				// We're in a mixed interpolation scenario, set zero as it's irrelevant but value might contain unused data
-				values[0] = 0;	
-				values[1] = 0;	
+				values[0] = 0;
+				values[1] = 0;
 			}
 			else if (is_rotation) {
 				values[1] = RAD2DEGF(bezt->vec[2][1]);
@@ -634,11 +634,11 @@ std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemanti
 	switch (semantic) {
 		case COLLADASW::InputSemantic::INPUT:
 		case COLLADASW::InputSemantic::OUTPUT:
-			source.setAccessorStride(1);			
+			source.setAccessorStride(1);
 			break;
 		case COLLADASW::InputSemantic::IN_TANGENT:
 		case COLLADASW::InputSemantic::OUT_TANGENT:
-			source.setAccessorStride(2);			
+			source.setAccessorStride(2);
 			break;
 		default:
 			break;
@@ -1082,13 +1082,13 @@ std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, co
 			break;
 		case 6:
 			tm_name = "diffuse";
-			break;	
+			break;
 		case 7:
 			tm_name = "transparency";
-			break;	
+			break;
 		case 8:
 			tm_name = "index_of_refraction";
-			break;	
+			break;
 
 		default:
 			tm_name = "";
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 7fd3976..349930d 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -35,10 +35,19 @@ extern "C"
 #include "DNA_armature_types.h"
 #include "DNA_material_types.h"
 
+#include "BLI_math.h"
+#include "BLI_string.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
 #include "BKE_DerivedMesh.h"
 #include "BKE_fcurve.h"
 #include "BKE_animsys.h"
 #include "BKE_scene.h"
+#include "BKE_action.h" // pose functions
+#include "BKE_armature.h"
+#include "BKE_object.h"
+
 #ifdef NAN_BUILDINFO
 extern char build_rev[];
 #endif
@@ -46,14 +55,6 @@ extern char build_rev[];
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_action.h" // pose functions
-#include "BKE_armature.h"
-#include "BKE_object.h"
-
-#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_listbase.h"
-
 #include "RNA_access.h"
 
 #include "COLLADASWSource.h"
@@ -122,7 +123,7 @@ protected:
 
 	float convert_angle(float angle);
 
-	std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic);	
+	std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic);
 
 	void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
 							   COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform);
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index b2748a5..44e74e3 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -136,7 +136,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 							bez.ipo = BEZT_IPO_BEZ;
 						else 
 							bez.ipo = BEZT_IPO_CONST;
-						//bez.h1 = bez.h2 = HD_AUTO; 	
+						//bez.h1 = bez.h2 = HD_AUTO;
 					}
 					else {
 						bez.h1 = bez.h2 = HD_AUTO; 
@@ -617,7 +617,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
 		//Add the curves of the current animation to the object
 		for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
 			FCurve *fcu = *iter;
-			BLI_addtail(AnimCurves, fcu);	
+			BLI_addtail(AnimCurves, fcu);
 		}
 	}
 
@@ -844,7 +844,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& a
  * This function returns the aspet ration from the Collada camera.
  *
  * Note:COLLADA allows to specify either XFov, or YFov alone. 
- * In tghat case the aspect ratio can be determined from 
+ * In that case the aspect ratio can be determined from
  * the viewport aspect ratio (which is 1:1 ?)
  * XXX: check this: its probably wrong!
  * If both values are specified, then the aspect ration is simply xfov/yfov
@@ -854,14 +854,13 @@ static const double get_aspect_ratio(const COLLADAFW::Camera *camera)
 {
 	double aspect =  camera->getAspectRatio().getValue();
 
-	if(aspect == 0)
-	{
+	if (aspect == 0) {
 		const double yfov   =  camera->getYFov().getValue();
 
-		if(yfov == 0)
-			aspect=1; // assume yfov and xfov are equal
-		else
-		{
+		if (yfov == 0) {
+			aspect = 1; // assume yfov and xfov are equal
+		}
+		else {
 			const double xfov   =  camera->getXFov().getValue();
 			if (xfov==0)
 				aspect = 1;
@@ -885,7 +884,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
 	COLLADAFW::Node *root = root_map.find(uid) == root_map.end() ? node : root_map[uid];
 
 	Object *ob;
-	if(is_joint)
+	if (is_joint)
 		ob = armature_importer->get_armature_for_joint(root);
 	else
 		ob = object_map.find(uid) == object_map.end() ? NULL : object_map.find(uid)->second;
@@ -938,7 +937,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
 					if (is_matrix) {
 						apply_matrix_curves(ob, animcurves, root, node,  transform);
 					}
-					else {				
+					else {
 
 						if (is_joint) {
 
@@ -1094,7 +1093,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
 					}
 				}
 			}
-		}	
+		}
 	}
 }
 
@@ -1114,8 +1113,8 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurv
 		for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
 			FCurve *fcu = *iter;
 
-			fcurve_deg_to_rad(fcu);		 
-		}					
+			fcurve_deg_to_rad(fcu);
+		}
 	}
 
 
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index db61692..293b992 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -169,7 +169,7 @@ public:
 
 	int setAnimType ( const COLLADAFW::Animatable * prop, int type, int addition);
 	
-	void modify_fcurve(std::vector<FCurve*>* curves, const char* rna_path, int array_index );
+	void modify_fcurve(std::vector<FCurve*>* curves, const char *rna_path, int array_index );
 	void unused_fcurve(std::vector<FCurve*>* curves );
 	// prerequisites:
 	// animlist_map - map animlist id -> animlist
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 30e9bac..134fd63 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -346,7 +346,7 @@ void ArmatureExporter::export_controller(Object *ob, Object *ob_arm)
 
 	if (this->export_settings->apply_modifiers) {
 		me = bc_to_mesh_apply_modifiers(scene, ob, this->export_settings->export_mesh_type);
-	} 
+	}
 	else {
 		me = (Mesh *)ob->data;
 	}
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index eead453..a6b3728 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -104,7 +104,7 @@ private:
 #endif
 
 	void create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild,
-					 float parent_mat[][4], bArmature *arm);
+	                 float parent_mat[][4], bArmature *arm);
 
 	void create_unskinned_bone(COLLADAFW::Node *node, EditBone *parent, int totchild,
 	                           float parent_mat[][4], Object * ob_arm);
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 3b7a38e..0091df3 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -70,7 +70,7 @@ set(SRC
 	collada_utils.cpp
 
 	AnimationImporter.h
-	AnimationExporter.h	
+	AnimationExporter.h
 	ArmatureExporter.h
 	ArmatureImporter.h
 	CameraExporter.h
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index bd7ad16..c491326 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -79,36 +79,38 @@ extern "C"
 #include "DNA_modifier_types.h"
 #include "DNA_userdef_types.h"
 
-#include "BKE_DerivedMesh.h"
-#include "BKE_fcurve.h"
-#include "BKE_animsys.h"
 #include "BLI_path_util.h"
 #include "BLI_fileops.h"
-#include "ED_keyframing.h"
-#ifdef WITH_BUILDINFO
-extern char build_rev[];
-#endif
-
-#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
 
+#include "BKE_DerivedMesh.h"
+#include "BKE_action.h" // pose functions
+#include "BKE_animsys.h"
+#include "BKE_armature.h"
 #include "BKE_blender.h" // version info
-#include "BKE_scene.h"
+#include "BKE_fcurve.h"
 #include "BKE_global.h"
+#include "BKE_image.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
-#include "BKE_action.h" // pose functions
-#include "BKE_armature.h"
-#include "BKE_image.h"
 #include "BKE_object.h"
+#include "BKE_scene.h"
 
-#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_listbase.h"
+#include "ED_keyframing.h"
+#ifdef WITH_BUILDINFO
+extern char build_rev[];
+#endif
+
+#include "MEM_guardedalloc.h"
 
 #include "RNA_access.h"
 }
 
 #include "collada_internal.h"
+#include "collada_utils.h"
 #include "DocumentExporter.h"
 
 extern bool bc_has_object_type(LinkNode *export_set, short obtype);
diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h
index 0562008..84c0610 100644
--- a/source/blender/collada/DocumentExporter.h
+++ b/source/blender/collada/DocumentExporter.h
@@ -40,7 +40,7 @@ class DocumentExporter
  public:
 	DocumentExporter(const ExportSettings *export_settings);
 	void exportCurrentScene(Scene *sce);
-	void exportScenes(const char* filename);
+	void exportScenes(const char *filename);
 private:
 	const ExportSettings *export_settings;
 };
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index f37f065..084f71e 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -311,7 +311,7 @@ bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene)
 Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera, Scene *sce)
 {
 	const COLLADAFW::UniqueId& cam_uid = camera->getInstanciatedObjectId();
-	if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) {	
+	if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) {
 		// fprintf(stderr, "Couldn't find camera by UID.\n");
 		return NULL;
 	}
@@ -329,7 +329,7 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
 Object *DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
 {
 	const COLLADAFW::UniqueId& lamp_uid = lamp->getInstanciatedObjectId();
-	if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {	
+	if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {
 		fprintf(stderr, "Couldn't find lamp by UID.\n");
 		return NULL;
 	}
@@ -524,7 +524,7 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
 	}
 	// if node has child nodes write them
 	COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
-	for (unsigned int i = 0; i < child_nodes.getCount(); i++) {	
+	for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
 		write_node(child_nodes[i], node, sce, ob, is_library_node);
 	}
 }
@@ -552,8 +552,8 @@ bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScen
 }
 
 /** When this method is called, the writer must handle all nodes contained in the 
-* library nodes.
-* \return The writer should return true, if writing succeeded, false otherwise.*/
+ * library nodes.
+ * \return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes)
 {
 	if (mImportStage != General)
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index e878a5a..d54b8db 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -81,8 +81,8 @@ public:
 	/**
 	 * This method will be called if an error in the loading process occurred and the loader cannot
 	 * continue to load. The writer should undo all operations that have been performed.
-	\param errorMessage A message containing informations about the error that occurred.
-	*/
+	 * \param errorMessage A message containing informations about the error that occurred.
+	 */
 	void cancel(const COLLADAFW::String& errorMessage);
 
 	/** This is the method called. The writer hast to prepare to receive data.*/
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index dd59fb9..e4a654d 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -255,7 +255,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 	if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
 		cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
 		ep.setSpecular(cot, false, "specular");
-	}	
+	}
 
 	// XXX make this more readable if possible
 
@@ -381,7 +381,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 	}
 
 	std::set<Image *>::iterator uv_t_iter;
-	for(uv_t_iter = uv_textures.begin(); uv_t_iter != uv_textures.end(); uv_t_iter++ ) {
+	for (uv_t_iter = uv_textures.begin(); uv_t_iter != uv_textures.end(); uv_t_iter++ ) {
 		Image *ima = *uv_t_iter;
 		std::string key(id_name(ima));
 		key = translate_id(key);
@@ -405,7 +405,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 	ep.closeProfile();
 	if (twoSided)
 		mSW->appendTextBlock("<extra><technique profile=\"MAX3D\"><double_sided>1</double_sided></technique></extra>");
-	closeEffect();	
+	closeEffect();
 }
 
 COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index e2332b7..f33f0fa 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -38,6 +38,8 @@
 #include "DNA_meshdata_types.h"
 
 extern "C" {
+	#include "BLI_utildefines.h"
+
 	#include "BKE_DerivedMesh.h"
 	#include "BKE_main.h"
 	#include "BKE_global.h"
@@ -78,7 +80,7 @@ void GeometryExporter::operator()(Object *ob)
 	Mesh *me;
 	if (this->export_settings->apply_modifiers) {
 		me = bc_to_mesh_apply_modifiers(mScene, ob, this->export_settings->export_mesh_type);
-	} 
+	}
 	else {
 		me = (Mesh *)ob->data;
 	}
@@ -364,7 +366,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
 	//appends data to <float_array>
 	int i = 0;
 	for (i = 0; i < totverts; i++) {
-		source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);			
+		source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);
 	}
 	
 	source.finish();
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index a15dadd..aba290f 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -61,8 +61,8 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
 
 	if (not_yet_exported) {
 
-		ImBuf *imbuf       = BKE_image_get_ibuf(image, NULL);
-		if(!imbuf) {
+		ImBuf *imbuf       = BKE_image_acquire_ibuf(image, NULL, NULL);
+		if (!imbuf) {
 			fprintf(stderr, "Collada export: image does not exist:\n%s\n", image->name);
 			return;
 		}
@@ -147,6 +147,8 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
 		img.add(mSW);
 		fprintf(stdout, "Collada export: Added image: %s\n", export_file);
 		mImages.push_back(translated_name);
+
+		BKE_image_release_ibuf(image, imbuf, NULL);
 	}
 }
 
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index 5a1d8b7..4aece99 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -70,7 +70,7 @@ void MaterialsExporter::operator()(Material *ma, Object *ob)
 {
 	std::string name(id_name(ma));
 
-	openMaterial(get_material_id(ma), get_material_id(ma));
+	openMaterial(get_material_id(ma), translate_id(name));
 
 	std::string efid = translate_id(name) + "-effect";
 	addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 47ee35f..de8d1e8 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -478,7 +478,7 @@ void MeshImporter::allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_t
 	int total_facecount = 0;
 
 	// collect edge_count and face_count from all parts
-	for (int i = 0; i < prim_arr.getCount(); i++) {		
+	for (int i = 0; i < prim_arr.getCount(); i++) {
 		COLLADAFW::MeshPrimitive *mp = prim_arr[i];
 		int type = mp->getPrimitiveType();
 		switch (type) {
@@ -506,7 +506,7 @@ unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) {
 	int loose_edge_count = 0;
 
 	// collect edge_count and face_count from all parts
-	for (int i = 0; i < prim_arr.getCount(); i++) {		
+	for (int i = 0; i < prim_arr.getCount(); i++) {
 		COLLADAFW::MeshPrimitive *mp = prim_arr[i];
 		int type = mp->getPrimitiveType();
 		switch (type) {
@@ -589,7 +589,7 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
 				for (int i = 0; i < edge_count; i++, med++) {
 					med->bweight = 0;
 					med->crease  = 0;
-					med->flag    = 0;
+					med->flag   |= ME_LOOSEEDGE;
 					med->v1      = indices[2 * i];
 					med->v2      = indices[2 * i + 1];
 				}
@@ -998,7 +998,7 @@ static bool bc_has_same_material_configuration(Object *ob1, Object *ob2)
 	if (ob1->totcol != ob2->totcol) return false; // not same number of materials
 	if (ob1->totcol == 0) return false; // no material at all
 	
-	for(int index=0; index < ob1->totcol; index++) {
+	for (int index=0; index < ob1->totcol; index++) {
 		if (ob1->matbits[index] != ob2->matbits[index]) return false; // shouldn't happen
 		if (ob1->matbits[index] == 0) return false; // shouldn't happen
 		if (ob1->mat[index] != ob2->mat[index]) return false; // different material assignment
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 4aaff02..6d239ae 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -24,9 +24,13 @@
  *  \ingroup collada
  */
 
+extern "C" {
+	#include "BLI_utildefines.h"
+	#include "BKE_object.h"
+}
+
 #include "SceneExporter.h"
 #include "collada_utils.h"
-#include "BKE_object.h"
 
 SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings)
 	: COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm), export_settings(export_settings)
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index d10cd73..6179358 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -84,7 +84,7 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[
 	COLLADAFW::Rotate *ro = (COLLADAFW::Rotate *)tm;
 	COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
 	const float angle = (float)DEG2RAD(ro->getRotationAngle());
-	const float ax[] = {axis[0], axis[1], axis[2]};
+	const float ax[] = {(float)axis[0], (float)axis[1], (float)axis[2]};
 	// float quat[4];
 	// axis_angle_to_quat(quat, axis, angle);
 	// quat_to_mat4(m, quat);
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index c1f75f9..6eec6a1 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -88,6 +88,7 @@ extern std::string translate_id(const std::string &id);
 
 extern std::string id_name(void *id);
 
+extern std::string get_geometry_id(Object *ob);
 extern std::string get_geometry_id(Object *ob, bool use_instantiation);
 
 extern std::string get_light_id(Object *ob);
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 018d66c..7bdda38 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -35,7 +35,6 @@
 #include "collada_utils.h"
 
 extern "C" {
-
 #include "DNA_modifier_types.h"
 #include "DNA_customdata_types.h"
 #include "DNA_object_types.h"
@@ -44,6 +43,7 @@ extern "C" {
 #include "DNA_armature_types.h"
 
 #include "BLI_math.h"
+#include "BLI_linklist.h"
 
 #include "BKE_context.h"
 #include "BKE_customdata.h"
@@ -51,10 +51,7 @@ extern "C" {
 #include "BKE_object.h"
 #include "BKE_mesh.h"
 #include "BKE_scene.h"
-
 #include "BKE_DerivedMesh.h"
-#include "BLI_linklist.h"
-
 
 #include "WM_api.h" // XXX hrm, see if we can do without this
 #include "WM_types.h"
@@ -142,7 +139,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e
 {
 	Mesh *tmpmesh;
 	CustomDataMask mask = CD_MASK_MESH;
-	DerivedMesh *dm;
+	DerivedMesh *dm = NULL;
 	switch (export_mesh_type) {
 		case BC_MESH_TYPE_VIEW: {
 			dm = mesh_create_derived_view(scene, ob, mask);
@@ -154,7 +151,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e
 		}
 	}
 
-	tmpmesh             = BKE_mesh_add("ColladaMesh"); // name is not important here
+	tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here
 	DM_to_mesh(dm, tmpmesh, ob);
 	dm->release(dm);
 	return tmpmesh;
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index b521157..b8990c3 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -35,18 +35,19 @@
 #include <vector>
 #include <map>
 
+extern "C" {
 #include "DNA_object_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_customdata_types.h"
 #include "DNA_texture_types.h"
-#include "BKE_context.h"
-#include "BKE_object.h"
-
 #include "DNA_scene_types.h"
 
-extern "C" {
-#include "BKE_DerivedMesh.h"
 #include "BLI_linklist.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_context.h"
+#include "BKE_object.h"
+#include "BKE_DerivedMesh.h"
 }
 
 #include "ExportSettings.h"
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 9932ed1..8259cb6 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -1,4 +1,3 @@
-# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -268,10 +267,17 @@ set(SRC
 	nodes/COM_MathNode.h
 	nodes/COM_MapValueNode.cpp
 	nodes/COM_MapValueNode.h
+	nodes/COM_MapRangeNode.cpp
+	nodes/COM_MapRangeNode.h
 
 	operations/COM_NormalizeOperation.cpp
 	operations/COM_NormalizeOperation.h
 
+	nodes/COM_PixelateNode.cpp
+	nodes/COM_PixelateNode.h
+	operations/COM_PixelateOperation.cpp
+	operations/COM_PixelateOperation.h
+
 	# Filter nodes
 	nodes/COM_BilateralBlurNode.cpp
 	nodes/COM_BilateralBlurNode.h
@@ -568,6 +574,8 @@ set(SRC
 	operations/COM_SetAlphaOperation.h
 	operations/COM_MapValueOperation.cpp
 	operations/COM_MapValueOperation.h
+	operations/COM_MapRangeOperation.cpp
+	operations/COM_MapRangeOperation.h
 
 	# Distort operation
 	operations/COM_TranslateOperation.h
@@ -650,6 +658,6 @@ list(APPEND INC
 	${CMAKE_CURRENT_BINARY_DIR}/operations
 )
 data_to_c(${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl
-          ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC)
+		  ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC)
 
 blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 71067ac..9c4a32f 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -83,6 +83,7 @@
 #include "COM_LuminanceMatteNode.h"
 #include "COM_MapUVNode.h"
 #include "COM_MapValueNode.h"
+#include "COM_MapRangeNode.h"
 #include "COM_MaskNode.h"
 #include "COM_MathNode.h"
 #include "COM_MixNode.h"
@@ -119,6 +120,7 @@
 #include "COM_ViewLevelsNode.h"
 #include "COM_ViewerNode.h"
 #include "COM_ZCombineNode.h"
+#include "COM_PixelateNode.h"
 
 Node *Converter::convert(bNode *b_node, bool fast)
 {
@@ -350,6 +352,9 @@ Node *Converter::convert(bNode *b_node, bool fast)
 		case CMP_NODE_MAP_VALUE:
 			node = new MapValueNode(b_node);
 			break;
+		case CMP_NODE_MAP_RANGE:
+			node = new MapRangeNode(b_node);
+			break;
 		case CMP_NODE_TRANSFORM:
 			node = new TransformNode(b_node);
 			break;
@@ -390,6 +395,9 @@ Node *Converter::convert(bNode *b_node, bool fast)
 			node = new TrackPositionNode(b_node);
 			break;
 		/* not inplemented yet */
+		case CMP_NODE_PIXELATE:
+			node = new PixelateNode(b_node);
+			break;
 		default:
 			node = new MuteNode(b_node);
 			break;
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 5c89170..ffc3628 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -204,7 +204,7 @@ void ExecutionGroup::determineNumberOfChunks()
 		this->m_numberOfXChunks = 1;
 		this->m_numberOfYChunks = 1;
 		this->m_numberOfChunks = 1;
-	} 
+	}
 	else {
 		const float chunkSizef = this->m_chunkSize;
 		this->m_numberOfXChunks = ceil(this->m_width / chunkSizef);
@@ -352,7 +352,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
 				startEvaluated = true;
 				numberEvaluated++;
 
-				WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
+				if (bTree->update_draw)
+					bTree->update_draw(bTree->udh);
 			}
 			else if (state == COM_ES_SCHEDULED) {
 				finished = false;
@@ -475,10 +476,10 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area
 	int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
 	int minychunk = floor(area->ymin / chunkSizef);
 	int maxychunk = ceil((area->ymax - 1) / chunkSizef);
-	minxchunk = MAX2(minxchunk, 0);
-	minychunk = MAX2(minychunk, 0);
-	maxxchunk = MIN2(maxxchunk, this->m_numberOfXChunks);
-	maxychunk = MIN2(maxychunk, this->m_numberOfYChunks);
+	minxchunk = max(minxchunk, 0);
+	minychunk = max(minychunk, 0);
+	maxxchunk = min(maxxchunk, (int)this->m_numberOfXChunks);
+	maxychunk = min(maxychunk, (int)this->m_numberOfYChunks);
 
 	bool result = true;
 	for (indexx = minxchunk; indexx < maxxchunk; indexx++) {
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index c7a7d06..00104c2 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -193,7 +193,7 @@ private:
 	
 	/**
 	 * @brief try to schedule a specific chunk.
-	 * @note scheduling succeeds when all input requirements are met and the chunks hasen't been scheduled yet.
+	 * @note scheduling succeeds when all input requirements are met and the chunks hasn't been scheduled yet.
 	 * @param graph
 	 * @param xChunk
 	 * @param yChunk
@@ -245,7 +245,7 @@ public:
 	
 	/**
 	 * @brief add an operation to this ExecutionGroup
-	 * @note this method will add input of the operations recursivly
+	 * @note this method will add input of the operations recursively
 	 * @note this method can create multiple ExecutionGroup's
 	 * @param system
 	 * @param operation
@@ -369,7 +369,7 @@ public:
 	/**
 	 * @brief this method determines the MemoryProxy's where this execution group depends on.
 	 * @note After this method determineDependingAreaOfInterest can be called to determine
-	 * @note the area of the MemoryProxy.creator thas has to be executed.
+	 * @note the area of the MemoryProxy.creator that has to be executed.
 	 * @param memoryProxies result
 	 */
 	void determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index a13717c..1ec4ac7 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -25,6 +25,7 @@
 #include <sstream>
 
 #include "PIL_time.h"
+#include "BLI_utildefines.h"
 #include "BKE_node.h"
 
 #include "COM_Converter.h"
@@ -50,7 +51,7 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re
 	this->m_context.setbNodeTree(editingtree);
 	this->m_context.setFastCalculation(fastcalculation);
 	bNode *gnode;
-	for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) {
+	for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = gnode->next) {
 		if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) {
 			this->m_context.setActivegNode(gnode);
 			break;
@@ -240,12 +241,37 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
 	}
 }
 
+#ifndef NDEBUG
+/* if this fails, there are still connection to/from this node,
+ * which have not been properly relinked to operations!
+ */
+static void debug_check_node_connections(Node *node)
+{
+	/* note: connected inputs are not checked here,
+	 * it would break quite a lot and such inputs are ignored later anyway
+	 */
+#if 0
+	for (int i = 0; i < node->getNumberOfInputSockets(); ++i) {
+		BLI_assert(!node->getInputSocket(i)->isConnected());
+	}
+#endif
+	for (int i = 0; i < node->getNumberOfOutputSockets(); ++i) {
+		BLI_assert(!node->getOutputSocket(i)->isConnected());
+	}
+}
+#else
+/* stub */
+#define debug_check_node_connections(node)
+#endif
+
 void ExecutionSystem::convertToOperations()
 {
 	unsigned int index;
 	for (index = 0; index < this->m_nodes.size(); index++) {
 		Node *node = (Node *)this->m_nodes[index];
 		node->convertToOperations(this, &this->m_context);
+
+		debug_check_node_connections(node);
 	}
 
 	for (index = 0; index < this->m_connections.size(); index++) {
@@ -315,6 +341,16 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection)
 	this->m_connections.push_back(connection);
 }
 
+void ExecutionSystem::removeSocketConnection(SocketConnection *connection)
+{
+	for (vector<SocketConnection *>::iterator it = m_connections.begin(); it != m_connections.end(); ++it) {
+		if (*it == connection) {
+			this->m_connections.erase(it);
+			return;
+		}
+	}
+}
+
 
 void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const
 {
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 56a60bf..25f0610 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -189,6 +189,11 @@ public:
 	void addSocketConnection(SocketConnection *connection);
 
 	/**
+	 * Remove a socket connection from the system.
+	 */
+	void removeSocketConnection(SocketConnection *connection);
+
+	/**
 	 * @brief Convert all nodes to operations
 	 */
 	void convertToOperations();
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
index 33a5caf..506bd42 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
@@ -51,7 +51,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star
 	while (node != NULL) {
 		Node *nnode = addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation());
 		nnode->setbNodeGroup(groupnode);
-		node = (bNode *)node->next;
+		node = node->next;
 	}
 
 	NodeRange node_range(nodes.begin() + nodes_start, nodes.end());
@@ -60,7 +60,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star
 	bNodeLink *nodelink = (bNodeLink *)tree->links.first;
 	while (nodelink != NULL) {
 		addNodeLink(node_range, links, nodelink);
-		nodelink = (bNodeLink *)nodelink->next;
+		nodelink = nodelink->next;
 	}
 
 	/* Expand group nodes */
diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp
index a9c280e..2493d4e 100644
--- a/source/blender/compositor/intern/COM_InputSocket.cpp
+++ b/source/blender/compositor/intern/COM_InputSocket.cpp
@@ -122,6 +122,17 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket,  int editorNode
 	}
 }
 
+void InputSocket::unlinkConnections(ExecutionSystem *system)
+{
+	SocketConnection *connection = getConnection();
+	if (connection) {
+		system->removeSocketConnection(connection);
+		connection->getFromSocket()->removeConnection(connection);
+		setConnection(NULL);
+		delete connection;
+	}
+}
+
 bool InputSocket::isStatic()
 {
 	if (isConnected()) {
diff --git a/source/blender/compositor/intern/COM_InputSocket.h b/source/blender/compositor/intern/COM_InputSocket.h
index 2594790..5cd4cf3 100644
--- a/source/blender/compositor/intern/COM_InputSocket.h
+++ b/source/blender/compositor/intern/COM_InputSocket.h
@@ -87,17 +87,11 @@ public:
 	/**
 	 * @brief determine the resolution of this data going through this socket
 	 * @param resolution the result of this operation
-	 * @param preferredResolution the preferrable resolution as no resolution could be determined
+	 * @param preferredResolution the preferable resolution as no resolution could be determined
 	 */
 	void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
 	
 	/**
-	 * @brief Notifies the Input of the data type (via a SocketConnection)
-	 * @param datatype the datatype to evaluate
-	 */
-	void notifyActualInputType(DataType datatype);
-	
-	/**
 	 * @brief move all connections of this input socket to another socket
 	 * only use this method when already checked the availability of a SocketConnection
 	 * @param relinkToSocket the socket to move to connections to
@@ -114,7 +108,8 @@ public:
 	void relinkConnections(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
 	
 	/**
-	 * @brief move all connections of this input socket to another socket
+	 * @brief add a connection of this input socket to another socket
+	 * @warning make sure to remove the original connection with \a unlinkConnections afterward.
 	 * @param relinkToSocket the socket to move to connections to
 	 * @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
 	 * @param system ExecutionSystem to update to
@@ -122,6 +117,13 @@ public:
 	void relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
 	
 	/**
+	 * @brief remove all connections of this input socket.
+	 * @warning \a relinkConnectionsDuplicate should be used to ensure this socket is still connected.
+	 * @param system ExecutionSystem to update to
+	 */
+	void unlinkConnections(ExecutionSystem *system);
+	
+	/**
 	 * @brief set the resize mode
 	 * @param resizeMode the new resize mode.
 	 */
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index bdbe21f..357a4c1 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -160,7 +160,7 @@ void MemoryBuffer::writePixel(int x, int y, const float color[4])
 	if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
 	    y >= this->m_rect.ymin && y < this->m_rect.ymax)
 	{
-		const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
+		const int offset = (this->m_chunkWidth * (y - this->m_rect.ymin) + x - this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
 		copy_v4_v4(&this->m_buffer[offset], color);
 	}
 }
@@ -170,7 +170,7 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4])
 	if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
 	    y >= this->m_rect.ymin && y < this->m_rect.ymax)
 	{
-		const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
+		const int offset = (this->m_chunkWidth * (y - this->m_rect.ymin) + x - this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
 		add_v4_v4(&this->m_buffer[offset], color);
 	}
 }
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 5922b0e..d49bb5f 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -51,7 +51,7 @@ Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
 			if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
 			
 			this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
-			input = (bNodeSocket *)input->next;
+			input = input->next;
 		}
 		bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
 		while (output != NULL) {
@@ -60,14 +60,14 @@ Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
 			if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
 			
 			this->addOutputSocket(dt, output);
-			output = (bNodeSocket *)output->next;
+			output = output->next;
 		}
 	}
 }
 
 void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
 {
-	bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
+	bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
 	SetValueOperation *operation = new SetValueOperation();
 	bNodeSocketValueFloat *val = (bNodeSocketValueFloat *)bSock->default_value;
 	operation->setValue(val->value);
@@ -114,7 +114,7 @@ SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSock
 
 void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
 {
-	bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
+	bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
 	SetColorOperation *operation = new SetColorOperation();
 	bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)bSock->default_value;
 	operation->setChannel1(val->value[0]);
@@ -127,7 +127,7 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket
 
 void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
 {
-	bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
+	bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
 	bNodeSocketValueVector *val = (bNodeSocketValueVector *)bSock->default_value;
 	SetVectorOperation *operation = new SetVectorOperation();
 	operation->setX(val->value[0]);
@@ -137,18 +137,26 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
 	graph->addOperation(operation);
 }
 
-/* when a node has no valid data (missing image or group pointer) */
+NodeOperation *Node::convertToOperations_invalid_index(ExecutionSystem *graph, int index)
+{
+	const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
+	SetColorOperation *operation = new SetColorOperation();
+	operation->setChannels(warning_color);
+
+	/* link the operation */
+	this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
+	graph->addOperation(operation);
+	return operation;
+}
+
+/* when a node has no valid data (missing image / group pointer, or missing renderlayer from EXR) */
 void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context)
 {
 	/* this is a really bad situation - bring on the pink! - so artists know this is bad */
-	const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
 	int index;
 	vector<OutputSocket *> &outputsockets = this->getOutputSockets();
 	for (index = 0; index < outputsockets.size(); index++) {
-		SetColorOperation *operation = new SetColorOperation();
-		this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
-		operation->setChannels(warning_color);
-		graph->addOperation(operation);
+		convertToOperations_invalid_index(graph, index);
 	}
 }
 
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index 468a95e..c098d6d 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -106,6 +106,10 @@ public:
 	void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
 	
 	/**
+	 * Create dummy warning operation, use when we can't get the source data.
+	 */
+	NodeOperation *convertToOperations_invalid_index(ExecutionSystem *graph, int index);
+	/**
 	 * when a node has no valid data (missing image or a group nodes ID pointer is NULL)
 	 * call this function from #convertToOperations, this way the node sockets are converted
 	 * into valid outputs, without this the compositor system gets confused and crashes, see [#32490]
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index 4ae114b..a05c37e 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -126,7 +126,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
 	else {
 		rcti tempOutput;
 		bool first = true;
-		for (int i = 0 ; i < getNumberOfInputSockets() ; i ++) {
+		for (int i = 0; i < getNumberOfInputSockets(); i ++) {
 			NodeOperation * inputOperation = this->getInputOperation(i);
 			if (inputOperation && inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) {
 				if (first) {
@@ -137,10 +137,10 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
 					first = false;
 				}
 				else {
-					output->xmin = MIN2(output->xmin, tempOutput.xmin);
-					output->ymin = MIN2(output->ymin, tempOutput.ymin);
-					output->xmax = MAX2(output->xmax, tempOutput.xmax);
-					output->ymax = MAX2(output->ymax, tempOutput.ymax);
+					output->xmin = min(output->xmin, tempOutput.xmin);
+					output->ymin = min(output->ymin, tempOutput.ymin);
+					output->xmax = max(output->xmax, tempOutput.xmax);
+					output->ymax = max(output->ymax, tempOutput.ymax);
 				}
 			}
 		}
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index dfa22a2..f856d8e 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -77,7 +77,7 @@ private:
 	ThreadMutex m_mutex;
 	
 	/**
-	 * @brief reference to the editing bNodeTree only used for break callback
+	 * @brief reference to the editing bNodeTree, used for break and update callback
 	 */
 	const bNodeTree *m_btree;
 
@@ -94,7 +94,7 @@ public:
 	 * @brief determine the resolution of this node
 	 * @note this method will not set the resolution, this is the responsibility of the caller
 	 * @param resolution the result of this operation
-	 * @param preferredResolution the preferrable resolution as no resolution could be determined
+	 * @param preferredResolution the preferable resolution as no resolution could be determined
 	 */
 	virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
 
@@ -163,7 +163,10 @@ public:
 	 * @param clMemToCleanUp all created cl_mem references must be added to this list. Framework will clean this after execution
 	 * @param clKernelsToCleanUp all created cl_kernel references must be added to this list. Framework will clean this after execution
 	 */
-	virtual void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
+	virtual void executeOpenCL(OpenCLDevice *device,
+	                           MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+	                           MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+	                           list<cl_kernel> *clKernelsToCleanUp) {}
 	virtual void deinitExecution();
 
 	bool isResolutionSet() {
@@ -244,6 +247,10 @@ public:
 		return this->m_btree->test_break(this->m_btree->tbh);
 	}
 
+	inline void updateDraw() {
+		if (this->m_btree->update_draw)
+			this->m_btree->update_draw(this->m_btree->udh);
+	}
 protected:
 	NodeOperation();
 
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index d23ed24..d5da079 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -74,7 +74,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
 {
 	cl_int error;
 	
-	MemoryBuffer *result = (MemoryBuffer *)reader->getInputMemoryBuffer(inputMemoryBuffers);
+	MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers);
 
 	const cl_image_format imageFormat = {
 		CL_RGBA,
diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp
index f23a489..50e9b75 100644
--- a/source/blender/compositor/intern/COM_OutputSocket.cpp
+++ b/source/blender/compositor/intern/COM_OutputSocket.cpp
@@ -54,6 +54,16 @@ void OutputSocket::addConnection(SocketConnection *connection)
 	this->m_connections.push_back(connection);
 }
 
+void OutputSocket::removeConnection(SocketConnection *connection)
+{
+	for (vector<SocketConnection *>::iterator it = m_connections.begin(); it != m_connections.end(); ++it) {
+		if (*it == connection) {
+			m_connections.erase(it);
+			return;
+		}
+	}
+}
+
 void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
 {
 	if (isConnected()) {
diff --git a/source/blender/compositor/intern/COM_OutputSocket.h b/source/blender/compositor/intern/COM_OutputSocket.h
index c6b7993..709005a 100644
--- a/source/blender/compositor/intern/COM_OutputSocket.h
+++ b/source/blender/compositor/intern/COM_OutputSocket.h
@@ -50,6 +50,7 @@ public:
 	OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex);
 	OutputSocket(OutputSocket *from);
 	void addConnection(SocketConnection *connection);
+	void removeConnection(SocketConnection *connection);
 	SocketConnection *getConnection(unsigned int index) { return this->m_connections[index]; }
 	const int isConnected() const;
 	int isOutputSocket() const;
@@ -57,7 +58,7 @@ public:
 	/**
 	 * @brief determine the resolution of this socket
 	 * @param resolution the result of this operation
-	 * @param preferredResolution the preferrable resolution as no resolution could be determined
+	 * @param preferredResolution the preferable resolution as no resolution could be determined
 	 */
 	void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
 	
diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h
index 953a164..2bb124a 100644
--- a/source/blender/compositor/intern/COM_WorkPackage.h
+++ b/source/blender/compositor/intern/COM_WorkPackage.h
@@ -44,7 +44,7 @@ private:
 	unsigned int m_chunkNumber;
 public:
 	/**
-	 * @constructor
+	 * constructor
 	 * @param group the ExecutionGroup
 	 * @param chunkNumber the number of the chunk
 	 */
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index eb9c26d..724abb5 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -106,13 +106,11 @@ void **g_highlightedNodesRead;
 
 void COM_startReadHighlights()
 {
-	if (!g_highlightInitialized)
-	{
+	if (!g_highlightInitialized) {
 		return;
 	}
 	
-	if (g_highlightedNodesRead) 
-	{
+	if (g_highlightedNodesRead) {
 		MEM_freeN(g_highlightedNodesRead);
 	}
 	
@@ -332,10 +330,10 @@ void WorkScheduler::initialize(bool use_opencl)
 				const char *cl_str[2] = {datatoc_COM_OpenCLKernels_cl, NULL};
 				g_program = clCreateProgramWithSource(g_context, 1, cl_str, 0, &error);
 				error = clBuildProgram(g_program, numberOfDevices, cldevices, 0, 0, 0);
-				if (error != CL_SUCCESS) { 
+				if (error != CL_SUCCESS) {
 					cl_int error2;
 					size_t ret_val_size = 0;
-					printf("CLERROR[%d]: %s\n", error, clewErrorString(error));	
+					printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
 					error2 = clGetProgramBuildInfo(g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
 					if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
 					char *build_log = (char *)MEM_mallocN(sizeof(char) * ret_val_size + 1, __func__);
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index 4f120ea..6a4987c 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -31,6 +31,7 @@
 #include "COM_FastGaussianBlurOperation.h"
 #include "COM_MathBaseOperation.h"
 #include "COM_SetValueOperation.h"
+#include "COM_GammaCorrectOperation.h"
 
 BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
 {
@@ -48,16 +49,17 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
 	const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
 	
 	CompositorQuality quality = context->getQuality();
-	
+	NodeOperation *input_operation = NULL, *output_operation = NULL;
+
 	if (data->filtertype == R_FILTER_FAST_GAUSS) {
 		FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation();
 		operationfgb->setData(data);
 		operationfgb->setbNode(editorNode);
-		this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), 0, graph);
 		this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
-		this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
 		graph->addOperation(operationfgb);
-		addPreviewOperation(graph, context, operationfgb->getOutputSocket());
+
+		input_operation = operationfgb;
+		output_operation = operationfgb;
 	}
 	else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
 		MathAddOperation *clamp = new MathAddOperation();
@@ -93,48 +95,68 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
 		operation->setData(data);
 		operation->setbNode(editorNode);
 		operation->setQuality(quality);
-		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
 		addLink(graph, operationy->getOutputSocket(), operation->getInputSocket(1));
 		graph->addOperation(operation);
-		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-		addPreviewOperation(graph, context, operation->getOutputSocket());
+
+		output_operation = operation;
+		input_operation = operation;
 	}
 	else if (!data->bokeh) {
 		GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
 		operationx->setData(data);
 		operationx->setbNode(editorNode);
 		operationx->setQuality(quality);
-		this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
 		this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph);
 		graph->addOperation(operationx);
 		GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
 		operationy->setData(data);
 		operationy->setbNode(editorNode);
 		operationy->setQuality(quality);
-		this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
+
 		graph->addOperation(operationy);
 		addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
 		addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
-		addPreviewOperation(graph, context, operationy->getOutputSocket());
 
 		if (!connectedSizeSocket) {
 			operationx->setSize(size);
 			operationy->setSize(size);
 		}
+
+		input_operation = operationx;
+		output_operation = operationy;
 	}
 	else {
 		GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
 		operation->setData(data);
 		operation->setbNode(editorNode);
-		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
 		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
 		operation->setQuality(quality);
 		graph->addOperation(operation);
-		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-		addPreviewOperation(graph, context, operation->getOutputSocket());
 
 		if (!connectedSizeSocket) {
 			operation->setSize(size);
 		}
+
+		input_operation = operation;
+		output_operation = operation;
+	}
+
+	if (data->gamma) {
+		GammaCorrectOperation *correct = new GammaCorrectOperation();
+		GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
+
+		this->getInputSocket(0)->relinkConnections(correct->getInputSocket(0), 0, graph);
+		addLink(graph, correct->getOutputSocket(), input_operation->getInputSocket(0));
+		addLink(graph, output_operation->getOutputSocket(), inverse->getInputSocket(0));
+		this->getOutputSocket()->relinkConnections(inverse->getOutputSocket());
+		graph->addOperation(correct);
+		graph->addOperation(inverse);
+
+		addPreviewOperation(graph, context, inverse->getOutputSocket());
+	}
+	else {
+		this->getInputSocket(0)->relinkConnections(input_operation->getInputSocket(0), 0, graph);
+		this->getOutputSocket()->relinkConnections(output_operation->getOutputSocket());
+		addPreviewOperation(graph, context, output_operation->getOutputSocket());
 	}
 }
diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
index 70aeee8..254dfb7 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
@@ -35,7 +35,7 @@ void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorCon
 	}
 	else {
 		operation = new ConvertKeyToPremulOperation();
-	} 
+	}
 
 	this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
 	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp
index b80a3e0..f09bb7e 100644
--- a/source/blender/compositor/nodes/COM_CropNode.cpp
+++ b/source/blender/compositor/nodes/COM_CropNode.cpp
@@ -40,7 +40,7 @@ void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
 		operation = new CropImageOperation();
 	}
 	else {
-		operation = new CropOperation();	
+		operation = new CropOperation();
 	}
 	operation->setCropSettings(cropSettings);
 	operation->setRelative(relative);
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index 5cfc29e..0fb7ea7 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -79,7 +79,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
 		CompositorQuality quality = context->getQuality();
 
 		/* initialize node data */
-		NodeBlurData *data = (NodeBlurData *)&this->m_alpha_blur;
+		NodeBlurData *data = &this->m_alpha_blur;
 		memset(data, 0, sizeof(*data));
 		data->filtertype = R_FILTER_GAUSS;
 
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
index 9b55b80..29e10db 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
@@ -50,7 +50,7 @@ void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, Composi
 	ChangeHSVOperation *changeHSV = new ChangeHSVOperation();
 	MixBlendOperation *blend = new MixBlendOperation();
 
-	colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 0, graph);
+	colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
 	addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
 	addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
 	addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 4ebd28d..4293e34 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -73,7 +73,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 	/* force a load, we assume iuser index will be set OK anyway */
 	if (image && image->type == IMA_TYPE_MULTILAYER) {
 		bool is_multilayer_ok = false;
-		BKE_image_get_ibuf(image, imageuser);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
 		if (image->rr) {
 			RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
 			if (rl) {
@@ -83,6 +83,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 				is_multilayer_ok = true;
 
 				for (index = 0; index < numberOfOutputs; index++) {
+					NodeOperation *operation = NULL;
 					socket = this->getOutputSocket(index);
 					if (socket->isConnected() || index == 0) {
 						bNodeSocket *bnodeSocket = socket->getbNodeSocket();
@@ -91,7 +92,6 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 						
 						RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
 						if (rpass) {
-							NodeOperation *operation = NULL;
 							imageuser->pass = passindex;
 							switch (rpass->channels) {
 								case 1:
@@ -105,19 +105,25 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 								case 4:
 									operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
 									break;
-
 								default:
-									/* XXX add a dummy operation? */
+									/* dummy operation is added below */
 									break;
 							}
+
 							if (index == 0 && operation) {
 								addPreviewOperation(graph, context, operation->getOutputSocket());
 							}
 						}
 					}
+
+					/* incase we can't load the layer */
+					if (operation == NULL) {
+						convertToOperations_invalid_index(graph, index);
+					}
 				}
 			}
 		}
+		BKE_image_release_ibuf(image, ibuf, NULL);
 
 		/* without this, multilayer that fail to load will crash blender [#32490] */
 		if (is_multilayer_ok == false) {
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp
index 6bc9afb..51ea291 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -151,7 +151,7 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext
 	CompositorQuality quality = context->getQuality();
 
 	/* initialize node data */
-	NodeBlurData *data = (NodeBlurData *)&this->m_alpha_blur;
+	NodeBlurData *data = &this->m_alpha_blur;
 	memset(data, 0, sizeof(*data));
 	data->filtertype = R_FILTER_GAUSS;
 
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
new file mode 100644
index 0000000..232be3d
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Dalai Felinto
+ *		Daniel Salazar
+ */
+
+#include "COM_MapRangeNode.h"
+
+#include "COM_MapRangeOperation.h"
+#include "COM_ExecutionSystem.h"
+
+MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode)
+{
+	/* pass */
+}
+
+void MapRangeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+	InputSocket *valueSocket = this->getInputSocket(0);
+	InputSocket *sourceMinSocket = this->getInputSocket(1);
+	InputSocket *sourceMaxSocket = this->getInputSocket(2);
+	InputSocket *destMinSocket = this->getInputSocket(3);
+	InputSocket *destMaxSocket = this->getInputSocket(4);
+	OutputSocket *outputSocket = this->getOutputSocket(0);
+
+	MapRangeOperation *operation = new MapRangeOperation();
+
+	valueSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+	sourceMinSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
+	sourceMaxSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
+	destMinSocket->relinkConnections(operation->getInputSocket(3), 3, graph);
+	destMaxSocket->relinkConnections(operation->getInputSocket(4), 4, graph);
+	outputSocket->relinkConnections(operation->getOutputSocket(0));
+
+	operation->setUseClamp(this->getbNode()->custom1);
+
+	graph->addOperation(operation);
+}
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h
new file mode 100644
index 0000000..6667720
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Dalai Felinto
+ *		Daniel Salazar
+ */
+
+#ifndef __COM_MAPRANGENODE_H__
+#define __COM_MAPRANGENODE_H__
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+/**
+ * @brief MapRangeNode
+ * @ingroup Node
+ */
+class MapRangeNode : public Node {
+public:
+	MapRangeNode(bNode *editorNode);
+	void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+};
+
+#endif  /* __COM_MAPRANGENODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
index 1821844..de12fff 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ b/source/blender/compositor/nodes/COM_MuteNode.cpp
@@ -43,6 +43,10 @@ void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
 		if (input->getDataType() == output->getDataType()) {
 			if (input->isConnected()) {
 				output->relinkConnections(input->getConnection()->getFromSocket(), false);
+				/* output connections have been redirected,
+				 * remove the input connection to completely unlink the node.
+				 */
+				input->unlinkConnections(graph);
 				return;
 			}
 		}
@@ -108,27 +112,16 @@ void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
 	/* mute node is also used for unknown nodes and couple of nodes in fast mode
 	 * can't use generic routines in that case
 	 */
-	if ((editorNode->flag & NODE_MUTED) && editorNode->typeinfo->internal_connect) {
+	if (editorNode->flag & NODE_MUTED) {
 		vector<InputSocket *> &inputsockets = this->getInputSockets();
 		vector<OutputSocket *> relinkedsockets;
-		bNodeTree *editorTree;
 		SocketMap socketMap;
-		ListBase intlinks;
 		bNodeLink *link;
 
-		if (this->getbNodeGroup()) {
-			editorTree = (bNodeTree *) getbNodeGroup()->id;
-		}
-		else {
-			editorTree = (bNodeTree *) context->getbNodeTree();
-		}
-
-		intlinks = editorNode->typeinfo->internal_connect(editorTree, editorNode);
-
 		this->fillSocketMap<OutputSocket>(outputsockets, socketMap);
 		this->fillSocketMap<InputSocket>(inputsockets, socketMap);
 
-		for (link = (bNodeLink *) intlinks.first; link; link = link->next) {
+		for (link = (bNodeLink *) editorNode->internal_links.first; link; link = link->next) {
 			if (link->fromnode == editorNode) {
 				InputSocket *fromSocket = (InputSocket *) socketMap.find(link->fromsock)->second;
 				OutputSocket *toSocket = (OutputSocket *) socketMap.find(link->tosock)->second;
@@ -170,8 +163,6 @@ void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
 					createDefaultOutput(graph, output);
 			}
 		}
-
-		BLI_freelistN(&intlinks);
 	}
 	else {
 		for (unsigned int index = 0; index < outputsockets.size(); index++) {
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp
index e00e71e..fbfff83 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalNode.cpp
@@ -41,9 +41,14 @@ void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
 	SetVectorOperation *operationSet = new SetVectorOperation();
 	bNodeSocket *insock = (bNodeSocket *)editorNode->outputs.first;
 	bNodeSocketValueVector *dval = (bNodeSocketValueVector *)insock->default_value;
-	operationSet->setX(dval->value[0]);
-	operationSet->setY(dval->value[1]);
-	operationSet->setZ(dval->value[2]);
+	float normal[3];
+
+	/* animation can break normalization, this restores it */
+	normalize_v3_v3(normal, dval->value);
+
+	operationSet->setX(normal[0]);
+	operationSet->setY(normal[1]);
+	operationSet->setZ(normal[2]);
 	operationSet->setW(0.0f);
 	
 	outputSocket->relinkConnections(operationSet->getOutputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index 921b9e6..3b1871b 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -41,6 +41,12 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
 		 * otherwise, it overwrites the output files just
 		 * scrubbing through the timeline when the compositor updates.
 		 */
+		
+		/* still, need to unlink input sockets to remove the node from the graph completely */
+		int num_inputs = getNumberOfInputSockets();
+		for (int i = 0; i < num_inputs; ++i) {
+			getInputSocket(i)->unlinkConnections(graph);
+		}
 		return;
 	}
 	
diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cpp b/source/blender/compositor/nodes/COM_PixelateNode.cpp
new file mode 100644
index 0000000..f1c7c61
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_PixelateNode.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ *		Jeroen Bakker
+ *		Monique Dewanchand
+ */
+
+#include "COM_PixelateNode.h"
+
+#include "COM_PixelateOperation.h"
+#include "COM_ExecutionSystem.h"
+
+PixelateNode::PixelateNode(bNode *editorNode) : Node(editorNode)
+{
+	/* pass */
+}
+
+void PixelateNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+	InputSocket *inputSocket = this->getInputSocket(0);
+	OutputSocket *outputSocket = this->getOutputSocket(0);
+	DataType datatype = inputSocket->getDataType();
+	if (inputSocket->isConnected()) {
+		SocketConnection * connection = inputSocket->getConnection();
+		OutputSocket* otherOutputSocket = connection->getFromSocket();
+		datatype = otherOutputSocket->getDataType();
+	}
+
+	PixelateOperation *operation = new PixelateOperation(datatype);
+	inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+	outputSocket->relinkConnections(operation->getOutputSocket(0));
+	graph->addOperation(operation);
+}
diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h
new file mode 100644
index 0000000..c142d2d
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_PixelateNode.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Jeroen Bakker 
+ *		Monique Dewanchand
+ */
+
+#ifndef _COM_PixelateNode_h_
+#define _COM_PixelateNode_h_
+
+#include "COM_Node.h"
+
+/**
+ * @brief PixelateNode
+ * @ingroup Node
+ */
+class PixelateNode : public Node {
+public:
+	PixelateNode(bNode *editorNode);
+	void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+};
+
+#endif
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index c51782b..6f7bd33 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -26,6 +26,7 @@
 #include "COM_ExecutionSystem.h"
 #include "BKE_node.h"
 #include "COM_SetValueOperation.h"
+#include "COM_SetSamplerOperation.h"
 
 ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode)
 {
@@ -38,7 +39,9 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 	InputSocket *inputXSocket = this->getInputSocket(1);
 	InputSocket *inputYSocket = this->getInputSocket(2);
 	OutputSocket *outputSocket = this->getOutputSocket(0);
+	BaseScaleOperation *scaleoperation = NULL;
 	bNode *bnode = this->getbNode();
+
 	switch (bnode->custom1) {
 		case CMP_SCALE_RELATIVE: {
 			ScaleOperation *operation = new ScaleOperation();
@@ -46,8 +49,8 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 			inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
 			inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
 			inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
-			outputSocket->relinkConnections(operation->getOutputSocket(0));
-			graph->addOperation(operation);
+
+			scaleoperation = operation;
 		}
 		break;
 		case CMP_SCALE_SCENEPERCENT: {
@@ -57,9 +60,9 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 			inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
 			addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1));
 			addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2));
-			outputSocket->relinkConnections(operation->getOutputSocket(0));
 			graph->addOperation(scaleFactorOperation);
-			graph->addOperation(operation);
+
+			scaleoperation = operation;
 		}
 		break;
 
@@ -75,9 +78,9 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 			operation->setNewWidth(rd->xsch * rd->size / 100.0f);
 			operation->setNewHeight(rd->ysch * rd->size / 100.0f);
 			inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
-			outputSocket->relinkConnections(operation->getOutputSocket(0));
 			operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
-			graph->addOperation(operation);
+
+			scaleoperation = operation;
 		}
 		break;
 
@@ -87,9 +90,12 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 			inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
 			inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
 			inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
-			outputSocket->relinkConnections(operation->getOutputSocket(0));
-			graph->addOperation(operation);
+
+			scaleoperation = operation;
 		}
 		break;
 	}
+
+	outputSocket->relinkConnections(scaleoperation->getOutputSocket(0));
+	graph->addOperation(scaleoperation);
 }
diff --git a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
index 67ac6ff..7fcdeba 100644
--- a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
@@ -70,4 +70,7 @@ void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorCon
 		outputASocket->relinkConnections(operation->getOutputSocket(0));
 		graph->addOperation(operation);
 	}
+	
+	/* remove the original connection to the node, this has been duplicated for all operations */
+	imageSocket->unlinkConnections(graph);
 }
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
index b28ee3e..a579503 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
@@ -72,6 +72,8 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
 	addLink(graph, scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1));
 	addLink(graph, scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2));
 	
+	scaleOperation->setSampler((PixelSampler)this->getbNode()->custom1);
+	
 	addLink(graph, scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
 	addLink(graph, angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1));
 	rotateOperation->setDoDegree2RadConversion(false);
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
index 6bb873e..a515bfc 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
@@ -24,6 +24,7 @@
 #include "COM_ExecutionSystem.h"
 #include "COM_CalculateMeanOperation.h"
 #include "COM_CalculateStandardDeviationOperation.h"
+#include "COM_SetValueOperation.h"
 
 ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode)
 {
@@ -64,5 +65,18 @@ void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorConte
 			graph->addOperation(operation);
 		}
 	}
+	else {
+		SetValueOperation *meanOutput = new SetValueOperation();
+		SetValueOperation *stdDevOutput = new SetValueOperation();
+
+		meanOutput->setValue(0.0f);
+		stdDevOutput->setValue(0.0f);
+
+		this->getOutputSocket(0)->relinkConnections(meanOutput->getOutputSocket());
+		this->getOutputSocket(1)->relinkConnections(stdDevOutput->getOutputSocket());
+
+		graph->addOperation(meanOutput);
+		graph->addOperation(stdDevOutput);
+	}
 }
 	
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index d67e9e2..f44470a 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -52,8 +52,7 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
 	viewerOperation->setDisplaySettings(context->getDisplaySettings());
 
 	viewerOperation->setResolutionInputSocketIndex(0);
-	if (!imageSocket->isConnected())
-	{
+	if (!imageSocket->isConnected()) {
 		if (alphaSocket->isConnected()) {
 			viewerOperation->setResolutionInputSocketIndex(1);
 		}
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h
index 37483d3..74ca6b7 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h
@@ -59,6 +59,9 @@ public:
 
 	void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
 	
-	void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
+	void executeOpenCL(OpenCLDevice *device,
+	                   MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+	                   MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+	                   list<cl_kernel> *clKernelsToCleanUp);
 };
 #endif
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
index 152b107..a8e8cb9 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
@@ -100,7 +100,7 @@ void ColorSpillOperation::executePixel(float output[4], float x, float y, PixelS
 	}
 	else {
 		copy_v4_v4(output, input);
-	}	
+	}
 }
 float ColorSpillOperation::calculateMapValue(float fac, float *input)
 {
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index 88289f1..f39a28b 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -64,8 +64,8 @@ void ConvertDepthToRadiusOperation::initExecution()
 	this->m_inverseFocalDistance = 1.0f / focalDistance;
 	this->m_aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
 	this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
-	float minsz = min(getWidth(), getHeight());
-	this->m_dof_sp = (float)minsz / ((cam_sensor / 2.0f) / this->m_cam_lens);    // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
+	const float minsz = min(getWidth(), getHeight());
+	this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens);    // <- == aspect * min(img->x, img->y) / tan(0.5f * fov);
 
 	if (this->m_blurPostOperation) {
 		m_blurPostOperation->setSigma(min(m_aperture * 128.0f, this->m_maxRadius));
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index c33bd25..4f9cd77 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -36,25 +36,34 @@ void CropBaseOperation::updateArea()
 	SocketReader *inputReference = this->getInputSocketReader(0);
 	float width = inputReference->getWidth();
 	float height = inputReference->getHeight();
-	if (this->m_relative) {
-		this->m_settings->x1 = width * this->m_settings->fac_x1;
-		this->m_settings->x2 = width * this->m_settings->fac_x2;
-		this->m_settings->y1 = height * this->m_settings->fac_y1;
-		this->m_settings->y2 = height * this->m_settings->fac_y2;
-	}
-	if (width <= this->m_settings->x1 + 1)
-		this->m_settings->x1 = width - 1;
-	if (height <= this->m_settings->y1 + 1)
-		this->m_settings->y1 = height - 1;
-	if (width <= this->m_settings->x2 + 1)
-		this->m_settings->x2 = width - 1;
-	if (height <= this->m_settings->y2 + 1)
-		this->m_settings->y2 = height - 1;
 	
-	this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
-	this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
-	this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
-	this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
+	if (width > 0.0f && height > 0.0f) {
+		if (this->m_relative) {
+			this->m_settings->x1 = width * this->m_settings->fac_x1;
+			this->m_settings->x2 = width * this->m_settings->fac_x2;
+			this->m_settings->y1 = height * this->m_settings->fac_y1;
+			this->m_settings->y2 = height * this->m_settings->fac_y2;
+		}
+		if (width <= this->m_settings->x1 + 1)
+			this->m_settings->x1 = width - 1;
+		if (height <= this->m_settings->y1 + 1)
+			this->m_settings->y1 = height - 1;
+		if (width <= this->m_settings->x2 + 1)
+			this->m_settings->x2 = width - 1;
+		if (height <= this->m_settings->y2 + 1)
+			this->m_settings->y2 = height - 1;
+		
+		this->m_xmax = max(this->m_settings->x1, this->m_settings->x2) + 1;
+		this->m_xmin = min(this->m_settings->x1, this->m_settings->x2);
+		this->m_ymax = max(this->m_settings->y1, this->m_settings->y2) + 1;
+		this->m_ymin = min(this->m_settings->y1, this->m_settings->y2);
+	}
+	else {
+		this->m_xmax = 0;
+		this->m_xmin = 0;
+		this->m_ymax = 0;
+		this->m_ymin = 0;
+	}
 }
 
 void CropBaseOperation::initExecution()
@@ -110,5 +119,10 @@ void CropImageOperation::determineResolution(unsigned int resolution[2], unsigne
 
 void CropImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
-	this->m_inputOperation->read(output, (x + this->m_xmin), (y + this->m_ymin), sampler);
+	if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight())  {
+		this->m_inputOperation->read(output, (x + this->m_xmin), (y + this->m_ymin), sampler);
+	}
+	else {
+		zero_v4(output);
+	}
 }
diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h
index ddc7f85..d2f2b15 100644
--- a/source/blender/compositor/operations/COM_CropOperation.h
+++ b/source/blender/compositor/operations/COM_CropOperation.h
@@ -37,7 +37,7 @@ protected:
 	
 	void updateArea();
 public:
-	CropBaseOperation();	
+	CropBaseOperation();
 	void initExecution();
 	void deinitExecution();
 	void setCropSettings(NodeTwoXYs *settings) { this->m_settings = settings; }
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index 9c09c9b..f0fffa7 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -344,28 +344,28 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
 			for (y = 0; y < bheight; y++) {
 				for (x = 0; x < bwidth - 1; x++) {
 					p = rectf + (bwidth * y + x);
-					*p = MAX2(*p, *(p + 1));
+					*p = max(*p, *(p + 1));
 				}
 			}
 		
 			for (y = 0; y < bheight; y++) {
 				for (x = bwidth - 1; x >= 1; x--) {
 					p = rectf + (bwidth * y + x);
-					*p = MAX2(*p, *(p - 1));
+					*p = max(*p, *(p - 1));
 				}
 			}
 		
 			for (x = 0; x < bwidth; x++) {
 				for (y = 0; y < bheight - 1; y++) {
 					p = rectf + (bwidth * y + x);
-					*p = MAX2(*p, *(p + bwidth));
+					*p = max(*p, *(p + bwidth));
 				}
 			}
 		
 			for (x = 0; x < bwidth; x++) {
 				for (y = bheight - 1; y >= 1; y--) {
 					p = rectf + (bwidth * y + x);
-					*p = MAX2(*p, *(p - bwidth));
+					*p = max(*p, *(p - bwidth));
 				}
 			}
 		}
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 31608c8..1723da1 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -92,8 +92,8 @@ void DisplaceOperation::executePixel(float output[4], int x, int y, void *data)
 	dxt = p_dx - d_dx;
 	dyt = p_dy - d_dy;
 
-	dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
-	dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
+	dxt = signf(dxt) * max_ff(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
+	dyt = signf(dyt) * max_ff(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
 
 	/* EWA filtering (without nearest it gets blurry with NO distortion) */
 	this->m_inputColorProgram->read(output, u, v, dxt, dyt, COM_PS_NEAREST);
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 2b2928c..9231261 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -128,8 +128,8 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign
 	
 	// XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
 	//     so just skiping blur along faulty direction if src's def is below that limit!
-	if (src_width < 3) xy &= ~(int) 1;
-	if (src_height < 3) xy &= ~(int) 2;
+	if (src_width < 3) xy &= ~1;
+	if (src_height < 3) xy &= ~2;
 	if (xy < 1) return;
 	
 	// see "Recursive Gabor Filtering" by Young/VanVliet
@@ -190,7 +190,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign
 } (void)0
 	
 	// intermediate buffers
-	sz = MAX2(src_width, src_height);
+	sz = max(src_width, src_height);
 	X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
 	Y = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
 	W = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");
@@ -230,6 +230,7 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() : NodeOperation
 	this->m_iirgaus = NULL;
 	this->m_inputprogram = NULL;
 	this->m_sigma = 1.0f;
+	this->m_overlay = 0;
 	setComplex(true);
 }
 
@@ -281,7 +282,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
 		if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
 			float *src = newBuf->getBuffer();
 			float *dst = copy->getBuffer();
-			for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
 				if (*src < *dst) {
 					*dst = *src;
 				}
@@ -290,7 +291,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
 		else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
 			float *src = newBuf->getBuffer();
 			float *dst = copy->getBuffer();
-			for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
 				if (*src > *dst) {
 					*dst = *src;
 				}
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
index af990f4..8f92dc0 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
@@ -48,15 +48,13 @@ void GammaCorrectOperation::executePixel(float output[4], float x, float y, Pixe
 	output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
 	output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
 	output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
-
-	inputColor[0] *= inputColor[3];
-	inputColor[1] *= inputColor[3];
-	inputColor[2] *= inputColor[3];
-
-	output[0] = inputColor[0];
-	output[1] = inputColor[1];
-	output[2] = inputColor[2];
 	output[3] = inputColor[3];
+
+	if (inputColor[3] > 0.0f) {
+		output[0] *= inputColor[3];
+		output[1] *= inputColor[3];
+		output[2] *= inputColor[3];
+	}
 }
 
 void GammaCorrectOperation::deinitExecution()
@@ -89,15 +87,13 @@ void GammaUncorrectOperation::executePixel(float output[4], float x, float y, Pi
 	output[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
 	output[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
 	output[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
-
-	inputColor[0] *= inputColor[3];
-	inputColor[1] *= inputColor[3];
-	inputColor[2] *= inputColor[3];
-
-	output[0] = inputColor[0];
-	output[1] = inputColor[1];
-	output[2] = inputColor[2];
 	output[3] = inputColor[3];
+
+	if (inputColor[3] > 0.0f) {
+		output[0] *= inputColor[3];
+		output[1] *= inputColor[3];
+		output[2] *= inputColor[3];
+	}
 }
 
 void GammaUncorrectOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 8c5e5fa..0efead7 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -102,12 +102,12 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
 	int bufferstarty = inputBuffer->getRect()->ymin;
 
 	int miny = y;
-	int maxy = y;
+	// int maxy = y;  // UNUSED
 	int minx = x - this->m_rad;
-	int maxx = x + this->m_rad;
+	int maxx = x + this->m_rad;  // UNUSED
 	miny = max(miny, inputBuffer->getRect()->ymin);
 	minx = max(minx, inputBuffer->getRect()->xmin);
-	maxy = min(maxy, inputBuffer->getRect()->ymax);
+	// maxy = min(maxy, inputBuffer->getRect()->ymax);
 	maxx = min(maxx, inputBuffer->getRect()->xmax);
 
 	/* *** this is the main part which is different to 'GaussianXBlurOperation'  *** */
@@ -123,7 +123,7 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
 	float value_max = finv_test(buffer[(x * 4) + (y * 4 * bufferwidth)], do_invert); /* init with the current color to avoid unneeded lookups */
 	float distfacinv_max = 1.0f; /* 0 to 1 */
 
-	for (int nx = minx; nx < maxx; nx += step) {
+	for (int nx = minx; nx <= maxx; nx += step) {
 		const int index = (nx - x) + this->m_rad;
 		float value = finv_test(buffer[bufferindex], do_invert);
 		float multiplier;
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index 1977155..1f9cc8e 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -104,11 +104,11 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
 	int miny = y - this->m_rad;
 	int maxy = y + this->m_rad;
 	int minx = x;
-	int maxx = x;
+	// int maxx = x;  // UNUSED
 	miny = max(miny, inputBuffer->getRect()->ymin);
 	minx = max(minx, inputBuffer->getRect()->xmin);
-	maxy = min(maxy, inputBuffer->getRect()->ymax);
-	maxx = min(maxx, inputBuffer->getRect()->xmax);
+	maxy = min(maxy, inputBuffer->getRect()->ymax - 1);
+	// maxx = min(maxx, inputBuffer->getRect()->xmax);
 
 	/* *** this is the main part which is different to 'GaussianYBlurOperation'  *** */
 	int step = getStep();
@@ -121,7 +121,7 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
 	float value_max = finv_test(buffer[(x * 4) + (y * 4 * bufferwidth)], do_invert); /* init with the current color to avoid unneeded lookups */
 	float distfacinv_max = 1.0f; /* 0 to 1 */
 
-	for (int ny = miny; ny < maxy; ny += step) {
+	for (int ny = miny; ny <= maxy; ny += step) {
 		int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
 
 		const int index = (ny - y) + this->m_rad;
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index a9bcb2d..2d662c1 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -236,7 +236,7 @@ void GaussianBlurReferenceOperation::initExecution()
 	
 	/* horizontal */
 	m_radx = (float)this->m_data->sizex;
-	int imgx = getWidth()/2;
+	int imgx = getWidth() / 2;
 	if (m_radx > imgx)
 		m_radx = imgx;
 	else if (m_radx < 1)
@@ -245,7 +245,7 @@ void GaussianBlurReferenceOperation::initExecution()
 
 	/* vertical */
 	m_rady = (float)this->m_data->sizey;
-	int imgy = getHeight()/2;
+	int imgy = getHeight() / 2;
 	if (m_rady > imgy)
 		m_rady = imgy;
 	else if (m_rady < 1)
@@ -257,7 +257,7 @@ void GaussianBlurReferenceOperation::initExecution()
 void GaussianBlurReferenceOperation::updateGauss()
 {
 	int i;
-	int x = MAX2(m_radx, m_rady);
+	int x = max(m_radx, m_rady);
 	this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array");
 	for (i = 0; i < x; i++) {
 		m_maintabs[i] = make_gausstab(i + 1);
@@ -327,11 +327,11 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
 void GaussianBlurReferenceOperation::deinitExecution()
 {
 	int x, i;
-	x = MAX2(m_radx, m_rady);
+	x = max(this->m_radx, this->m_rady);
 	for (i = 0; i < x; i++) {
-		MEM_freeN(m_maintabs[i]);
+		MEM_freeN(this->m_maintabs[i]);
 	}
-	MEM_freeN(m_maintabs);
+	MEM_freeN(this->m_maintabs);
 	BlurBaseOperation::deinitExecution();
 }
 
@@ -344,8 +344,8 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu
 		return true;
 	}
 	else {
-		int addx = this->m_data->sizex+2;
-		int addy = this->m_data->sizey+2;
+		int addx = this->m_data->sizex + 2;
+		int addy = this->m_data->sizey + 2;
 		newInput.xmax = input->xmax + addx;
 		newInput.xmin = input->xmin - addx;
 		newInput.ymax = input->ymax + addy;
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 3ab60a1..573a194 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -85,18 +85,18 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d
 	int bufferstarty = inputBuffer->getRect()->ymin;
 
 	int miny = y;
-	int maxy = y;
+	// int maxy = y;  // UNUSED
 	int minx = x - this->m_rad;
 	int maxx = x + this->m_rad;
 	miny = max(miny, inputBuffer->getRect()->ymin);
 	minx = max(minx, inputBuffer->getRect()->xmin);
-	maxy = min(maxy, inputBuffer->getRect()->ymax);
-	maxx = min(maxx, inputBuffer->getRect()->xmax);
+	// maxy = min(maxy, inputBuffer->getRect()->ymax);
+	maxx = min(maxx, inputBuffer->getRect()->xmax - 1);
 
 	int step = getStep();
 	int offsetadd = getOffsetAdd();
 	int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth);
-	for (int nx = minx, index = (minx - x) + this->m_rad; nx < maxx; nx += step, index += step) {
+	for (int nx = minx, index = (minx - x) + this->m_rad; nx <= maxx; nx += step, index += step) {
 		const float multiplier = this->m_gausstab[index];
 		madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
 		multiplier_accum += multiplier;
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 7ab00b2..0c0a4d8 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -87,16 +87,16 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d
 	int miny = y - this->m_rad;
 	int maxy = y + this->m_rad;
 	int minx = x;
-	int maxx = x;
+	// int maxx = x;  // UNUSED
 	miny = max(miny, inputBuffer->getRect()->ymin);
 	minx = max(minx, inputBuffer->getRect()->xmin);
-	maxy = min(maxy, inputBuffer->getRect()->ymax);
-	maxx = min(maxx, inputBuffer->getRect()->xmax);
+	maxy = min(maxy, inputBuffer->getRect()->ymax - 1);
+	// maxx = min(maxx, inputBuffer->getRect()->xmax);
 
 	int index;
 	int step = getStep();
-	const int bufferIndexx = ((minx - bufferstartx) * 4) ;
-	for (int ny = miny; ny < maxy; ny += step) {
+	const int bufferIndexx = ((minx - bufferstartx) * 4);
+	for (int ny = miny; ny <= maxy; ny += step) {
 		index = (ny - y) + this->m_rad;
 		int bufferindex = bufferIndexx + ((ny - bufferstarty) * 4 * bufferwidth);
 		const float multiplier = this->m_gausstab[index];
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index efdf013..592ad11 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -86,8 +86,8 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
 				fREAL *data_nbd = &data_n[bd];
 				fREAL *data_bd = &data[bd];
 				for (k = bl; k < len; k += istep) {
-					t1 = fc * data_n[k] + fs * data_nbd[k];
-					t2 = fs * data_n[k] - fc * data_nbd[k];
+					t1 = fc * (double)data_n[k] + fs * (double)data_nbd[k];
+					t2 = fs * (double)data_n[k] - fc * (double)data_nbd[k];
 					data_n[k] = data[k] - t1;
 					data_nbd[k] = data_bd[k] - t2;
 					data[k] += t1;
@@ -395,7 +395,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
 			// linear window good enough here, visual result counts, not scientific analysis
 			//w = (1.f-fabs(u))*(1.f-fabs(v));
 			// actually, Hanning window is ok, cos^2 for some reason is slower
-			w = (0.5f + 0.5f * cos((double)u * M_PI)) * (0.5f + 0.5f * cos((double)v * M_PI));
+			w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI));
 			mul_v3_fl(fcol, w);
 			ckrn->writePixel(x, y, fcol);
 		}
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index ace0423..c4f8b3a 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -79,9 +79,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
 	sc = 2.13;
 	isc = -0.97;
 	for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
-		v = (float)(y + 0.5f) / (float)gbuf->getHeight();
+		v = ((float)y + 0.5f) / (float)gbuf->getHeight();
 		for (x = 0; x < gbuf->getWidth(); x++) {
-			u = (float)(x + 0.5f) / (float)gbuf->getWidth();
+			u = ((float)x + 0.5f) / (float)gbuf->getWidth();
 			s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f;
 			tbuf1->readCubic(c, s * gbuf->getWidth(), t * gbuf->getHeight());
 			sm = smoothMask(s, t);
@@ -100,9 +100,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
 	memset(tbuf1->getBuffer(), 0, tbuf1->getWidth() * tbuf1->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float));
 	for (n = 1; n < settings->iter && (!breaked); n++) {
 		for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
-			v = (float)(y + 0.5f) / (float)gbuf->getHeight();
+			v = ((float)y + 0.5f) / (float)gbuf->getHeight();
 			for (x = 0; x < gbuf->getWidth(); x++) {
-				u = (float)(x + 0.5f) / (float)gbuf->getWidth();
+				u = ((float)x + 0.5f) / (float)gbuf->getWidth();
 				tc[0] = tc[1] = tc[2] = 0.f;
 				for (p = 0; p < 4; p++) {
 					np = (n << 2) + p;
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index fb3efbb..8455711 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -65,8 +65,9 @@ ImBuf *BaseImageOperation::getImBuf()
 {
 	ImBuf *ibuf;
 	
-	ibuf = BKE_image_get_ibuf(this->m_image, this->m_imageUser);
+	ibuf = BKE_image_acquire_ibuf(this->m_image, this->m_imageUser, NULL);
 	if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
+		BKE_image_release_ibuf(this->m_image, ibuf, NULL);
 		return NULL;
 	}
 	
@@ -93,6 +94,7 @@ void BaseImageOperation::initExecution()
 void BaseImageOperation::deinitExecution()
 {
 	this->m_imageBuffer = NULL;
+	BKE_image_release_ibuf(this->m_image, this->m_buffer, NULL);
 }
 
 void BaseImageOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
@@ -106,6 +108,8 @@ void BaseImageOperation::determineResolution(unsigned int resolution[2], unsigne
 		resolution[0] = stackbuf->x;
 		resolution[1] = stackbuf->y;
 	}
+
+	BKE_image_release_ibuf(this->m_image, stackbuf, NULL);
 }
 
 void ImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 70d4d98..81ca06c 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -133,9 +133,9 @@ void InpaintSimpleOperation::calc_manhatten_distance()
 			if (this->get_pixel(i, j)[3] < 1.0f) {
 				r = width + height;
 				if (i > 0) 
-					r = mini(r, m[j * width + i - 1] + 1);
+					r = min_ii(r, m[j * width + i - 1] + 1);
 				if (j > 0) 
-					r = mini(r, m[(j - 1) * width + i] + 1);
+					r = min_ii(r, m[(j - 1) * width + i] + 1);
 			}
 			m[j * width + i] = r;
 		}
@@ -146,9 +146,9 @@ void InpaintSimpleOperation::calc_manhatten_distance()
 			int r = m[j * width + i];
 			
 			if (i + 1 < width) 
-				r = mini(r, m[j * width + i + 1] + 1);
+				r = min_ii(r, m[j * width + i + 1] + 1);
 			if (j + 1 < height) 
-				r = mini(r, m[(j + 1) * width + i] + 1);
+				r = min_ii(r, m[(j + 1) * width + i] + 1);
 			
 			m[j * width + i] = r;
 			
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index 4426666..01f5c03 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -28,18 +28,6 @@
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 
-static int get_pixel_primary_channel(float *pixel)
-{
-	float max_value = MAX3(pixel[0], pixel[1], pixel[2]);
-
-	if (max_value == pixel[0])
-		return 0;
-	else if (max_value == pixel[1])
-		return 1;
-
-	return 2;
-}
-
 KeyingDespillOperation::KeyingDespillOperation() : NodeOperation()
 {
 	this->addInputSocket(COM_DT_COLOR);
@@ -73,12 +61,12 @@ void KeyingDespillOperation::executePixel(float output[4], float x, float y, Pix
 	this->m_pixelReader->read(pixelColor, x, y, sampler);
 	this->m_screenReader->read(screenColor, x, y, sampler);
 
-	int screen_primary_channel = get_pixel_primary_channel(screenColor);
-	int other_1 = (screen_primary_channel + 1) % 3;
-	int other_2 = (screen_primary_channel + 2) % 3;
+	const int screen_primary_channel = max_axis_v3(screenColor);
+	const int other_1 = (screen_primary_channel + 1) % 3;
+	const int other_2 = (screen_primary_channel + 2) % 3;
 
-	int min_channel = MIN2(other_1, other_2);
-	int max_channel = MAX2(other_1, other_2);
+	const int min_channel = min(other_1, other_2);
+	const int max_channel = max(other_1, other_2);
 
 	float average_value, amount;
 
@@ -87,7 +75,8 @@ void KeyingDespillOperation::executePixel(float output[4], float x, float y, Pix
 
 	copy_v4_v4(output, pixelColor);
 
-	if (this->m_despillFactor * amount > 0) {
-		output[screen_primary_channel] = pixelColor[screen_primary_channel] - this->m_despillFactor * amount;
+	const float amount_despill = this->m_despillFactor * amount;
+	if (amount_despill > 0.0f) {
+		output[screen_primary_channel] = pixelColor[screen_primary_channel] - amount_despill;
 	}
 }
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index 35138cf..baeacb5 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -28,27 +28,15 @@
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 
-static int get_pixel_primary_channel(float pixelColor[4])
+static float get_pixel_saturation(const float pixelColor[4], float screen_balance, int primary_channel)
 {
-	float max_value = MAX3(pixelColor[0], pixelColor[1], pixelColor[2]);
+	const int other_1 = (primary_channel + 1) % 3;
+	const int other_2 = (primary_channel + 2) % 3;
 
-	if (max_value == pixelColor[0])
-		return 0;
-	else if (max_value == pixelColor[1])
-		return 1;
+	const int min_channel = min(other_1, other_2);
+	const int max_channel = max(other_1, other_2);
 
-	return 2;
-}
-
-static float get_pixel_saturation(float pixelColor[4], float screen_balance, int primary_channel)
-{
-	int other_1 = (primary_channel + 1) % 3;
-	int other_2 = (primary_channel + 2) % 3;
-
-	int min_channel = MIN2(other_1, other_2);
-	int max_channel = MAX2(other_1, other_2);
-
-	float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
+	const float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
 
 	return (pixelColor[primary_channel] - val) * fabsf(1.0f - val);
 }
@@ -85,13 +73,13 @@ void KeyingOperation::executePixel(float output[4], float x, float y, PixelSampl
 	this->m_pixelReader->read(pixelColor, x, y, sampler);
 	this->m_screenReader->read(screenColor, x, y, sampler);
 
-	int primary_channel = get_pixel_primary_channel(screenColor);
+	const int primary_channel = max_axis_v3(screenColor);
 
 	if (pixelColor[primary_channel] > 1.0f) {
 		/* overexposure doesn't happen on screen itself and usually happens
 		 * on light sources in the shot, this need to be checked separately
 		 * because saturation and falloff calculation is based on the fact
-		 * that pixels are not overexposured
+		 * that pixels are not overexposed
 		 */
 		output[0] = 1.0f;
 	}
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index c9b129d..201dc99 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -151,21 +151,24 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
 		pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
 
 		zero_v3(site->color);
-		for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
-			if (pattern_ibuf->rect_float) {
-				add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
-			}
-			else {
-				unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
 
-				site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
-				site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
-				site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+		if (pattern_ibuf) {
+			for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
+				if (pattern_ibuf->rect_float) {
+					add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
+				}
+				else {
+					unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
+
+					site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
+					site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
+					site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+				}
 			}
-		}
 
-		mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
-		IMB_freeImBuf(pattern_ibuf);
+			mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
+			IMB_freeImBuf(pattern_ibuf);
+		}
 
 		site->co[0] = pos[0] * width;
 		site->co[1] = pos[1] * height;
@@ -199,9 +202,9 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
 
 			INIT_MINMAX2(min, max);
 
-			DO_MINMAX2(a->co, min, max);
-			DO_MINMAX2(b->co, min, max);
-			DO_MINMAX2(c->co, min, max);
+			minmax_v2v2_v2(min, max, a->co);
+			minmax_v2v2_v2(min, max, b->co);
+			minmax_v2v2_v2(min, max, c->co);
 
 			rect->xmin = min[0];
 			rect->ymin = min[1];
diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
new file mode 100644
index 0000000..1fe74ad
--- /dev/null
+++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Dalai Felinto
+ *		Daniel Salazar
+ */
+
+#include "COM_MapRangeOperation.h"
+
+MapRangeOperation::MapRangeOperation() : NodeOperation()
+{
+	this->addInputSocket(COM_DT_VALUE);
+	this->addInputSocket(COM_DT_VALUE);
+	this->addInputSocket(COM_DT_VALUE);
+	this->addInputSocket(COM_DT_VALUE);
+	this->addInputSocket(COM_DT_VALUE);
+	this->addOutputSocket(COM_DT_VALUE);
+	this->m_inputOperation = NULL;
+	this->m_useClamp = FALSE;
+}
+
+void MapRangeOperation::initExecution()
+{
+	this->m_inputOperation = this->getInputSocketReader(0);
+	this->m_sourceMinOperation = this->getInputSocketReader(1);
+	this->m_sourceMaxOperation = this->getInputSocketReader(2);
+	this->m_destMinOperation = this->getInputSocketReader(3);
+	this->m_destMaxOperation = this->getInputSocketReader(4);
+}
+
+/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
+#define BLENDER_ZMAX 10000.0f
+
+void MapRangeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+	float inputs[8]; /* includes the 5 inputs + 3 pads */
+	float value;
+	float source_min, source_max;
+	float dest_min, dest_max;
+
+	this->m_inputOperation->read(inputs, x, y, sampler);
+	this->m_sourceMinOperation->read(inputs + 1, x, y, sampler);
+	this->m_sourceMaxOperation->read(inputs + 2, x, y, sampler);
+	this->m_destMinOperation->read(inputs + 3, x, y, sampler);
+	this->m_destMaxOperation->read(inputs + 4, x, y, sampler);
+	
+	value = inputs[0];
+	source_min = inputs[1];
+	source_max = inputs[2];
+	dest_min = inputs[3];
+	dest_max = inputs[4];
+
+	if (value >= -BLENDER_ZMAX && value <= BLENDER_ZMAX) {
+		value = (value - source_min) / (source_max - source_min);
+		value = dest_min + value * (dest_max - dest_min);
+	}
+	else if (value > BLENDER_ZMAX)
+		value = dest_max;
+	else
+		value = dest_min;
+
+	if (this->m_useClamp) {
+		if (dest_max > dest_min) {
+			CLAMP(value, dest_min, dest_max);
+		}
+		else {
+			CLAMP(value, dest_max, dest_min);
+		}
+	}
+
+	output[0] = value;
+}
+
+void MapRangeOperation::deinitExecution()
+{
+	this->m_inputOperation = NULL;
+	this->m_sourceMinOperation = NULL;
+	this->m_sourceMaxOperation = NULL;
+	this->m_destMinOperation = NULL;
+	this->m_destMaxOperation = NULL;
+}
diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h
new file mode 100644
index 0000000..00dfc68
--- /dev/null
+++ b/source/blender/compositor/operations/COM_MapRangeOperation.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Dalai Felinto
+ *		Daniel Salazar
+ */
+
+#ifndef _COM_MapRangeOperation_h
+#define _COM_MapRangeOperation_h
+#include "COM_NodeOperation.h"
+#include "DNA_texture_types.h"
+
+/**
+ * this program converts an input color to an output value.
+ * it assumes we are in sRGB color space.
+ */
+class MapRangeOperation : public NodeOperation {
+private:
+	/**
+	 * Cached reference to the inputProgram
+	 */
+	SocketReader *m_inputOperation;
+	SocketReader *m_sourceMinOperation;
+	SocketReader *m_sourceMaxOperation;
+	SocketReader *m_destMinOperation;
+	SocketReader *m_destMaxOperation;
+
+	bool m_useClamp;
+public:
+	/**
+	 * Default constructor
+	 */
+	MapRangeOperation();
+	
+	/**
+	 * the inner loop of this program
+	 */
+	void executePixel(float output[4], float x, float y, PixelSampler sampler);
+	
+	/**
+	 * Initialize the execution
+	 */
+	void initExecution();
+	
+	/**
+	 * Deinitialize the execution
+	 */
+	void deinitExecution();
+	
+	/**
+	 * Clamp the output
+	 */
+	void setUseClamp(bool value) { this->m_useClamp = value; }
+	
+};
+#endif
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 36b3f20..ba1059c 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -73,7 +73,7 @@ void MaskOperation::initExecution()
 
 				for (masklay = (MaskLayer *)mask_temp->masklayers.first;
 				     masklay;
-				     masklay = (MaskLayer *)masklay->next)
+				     masklay = masklay->next)
 				{
 					masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, this->m_frame_number);
 					BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index b492d06..febfa96 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -45,7 +45,7 @@ protected:
 	 */
 	MathBaseOperation();
 
-	void clampIfNeeded(float *color);
+	void clampIfNeeded(float color[4]);
 public:
 	/**
 	 * the inner loop of this program
diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h
index 4b466d1..88d1d00 100644
--- a/source/blender/compositor/operations/COM_MixBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MixBaseOperation.h
@@ -40,7 +40,7 @@ protected:
 	bool m_valueAlphaMultiply;
 	bool m_useClamp;
 
-	inline void clampIfNeeded(float *color)
+	inline void clampIfNeeded(float color[4])
 	{
 		if (m_useClamp) {
 			CLAMP(color[0], 0.0f, 1.0f);
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index a3e00e9..68a61df 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -33,8 +33,7 @@ vector<DistortionCache *> s_cache;
 
 void deintializeDistortionCache(void) 
 {
-	while (s_cache.size()>0)
-	{
+	while (s_cache.size() > 0) {
 		DistortionCache * cache = s_cache.back();
 		s_cache.pop_back();
 		delete cache;
@@ -51,6 +50,7 @@ MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperat
 	this->m_cache = NULL;
 	this->m_distortion = distortion;
 }
+
 void MovieDistortionOperation::initExecution()
 {
 	this->m_inputOperation = this->getInputSocketReader(0);
@@ -61,8 +61,7 @@ void MovieDistortionOperation::initExecution()
 		BKE_movieclip_user_set_frame(&clipUser, this->m_framenumber);
 		BKE_movieclip_get_size(this->m_movieClip, &clipUser, &calibration_width, &calibration_height);
 
-		for (unsigned int i = 0; i < s_cache.size(); i++) 
-		{
+		for (unsigned int i = 0; i < s_cache.size(); i++) {
 			DistortionCache *c = (DistortionCache *)s_cache[i];
 			if (c->isCacheFor(this->m_movieClip, this->m_width, this->m_height,
 			                  calibration_width, calibration_height, this->m_distortion))
@@ -86,15 +85,12 @@ void MovieDistortionOperation::deinitExecution()
 {
 	this->m_inputOperation = NULL;
 	this->m_movieClip = NULL;
-	while (s_cache.size() > COM_DISTORTIONCACHE_MAXSIZE) 
-	{
+	while (s_cache.size() > COM_DISTORTIONCACHE_MAXSIZE) {
 		double minTime = PIL_check_seconds_timer();
 		vector<DistortionCache*>::iterator minTimeIterator = s_cache.begin();
-		for (vector<DistortionCache*>::iterator it = s_cache.begin(); it < s_cache.end(); it ++) 
-		{
+		for (vector<DistortionCache*>::iterator it = s_cache.begin(); it < s_cache.end(); it ++) {
 			DistortionCache * cache = *it;
-			if (cache->getTimeLastUsage()<minTime) 
-			{
+			if (cache->getTimeLastUsage() < minTime) {
 				minTime = cache->getTimeLastUsage();
 				minTimeIterator = it;
 			}
@@ -110,21 +106,9 @@ void MovieDistortionOperation::executePixel(float output[4], float x, float y, P
 	if (this->m_cache != NULL) {
 		float u, v;
 		this->m_cache->getUV(&this->m_movieClip->tracking, x, y, &u, &v);
-		this->m_inputOperation->read(output, u, v, sampler);
-	} 
+		this->m_inputOperation->read(output, u, v, COM_PS_BILINEAR);
+	}
 	else {
-		this->m_inputOperation->read(output, x, y, sampler);
+		this->m_inputOperation->read(output, x, y, COM_PS_BILINEAR);
 	}
 }
-
-bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
-{
-	rcti newInput;
-	
-	newInput.xmax = input->xmax + 100;
-	newInput.xmin = input->xmin - 100;
-	newInput.ymax = input->ymax + 100;
-	newInput.ymin = input->ymin - 100;
-	
-	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
-}
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index f3eeb2f..9f8aa06 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -115,10 +115,10 @@ public:
 
 			if (!this->m_bufferCalculated[offset]) {
 				//float overscan = 0.0f;
-				float w = (float)this->m_width /* / (1 + overscan) */;
-				float h = (float)this->m_height /* / (1 + overscan) */;
-				float aspx = (float)w / this->m_calibration_width;
-				float aspy = (float)h / this->m_calibration_height;
+				const float w = (float)this->m_width /* / (1 + overscan) */;
+				const float h = (float)this->m_height /* / (1 + overscan) */;
+				const float aspx = w / (float)this->m_calibration_width;
+				const float aspy = h / (float)this->m_calibration_height;
 				float in[2];
 				float out[2];
 
@@ -155,7 +155,6 @@ protected:
 
 public:
 	MovieDistortionOperation(bool distortion);
-	bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
 	void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
 	void initExecution();
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index 5f7ac6b..f81b50e 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -43,6 +43,12 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data)
 	this->m_imageReader->read(output, x, y, NULL);
 
 	output[0] = (output[0] - minmult->x) * minmult->y;
+
+	/* clamp infinities */
+	if (output[0] > 1.0f)
+		output[0] = 1.0f;
+	else if (output[0] < 0.0f)
+		output[0] = 0.0f;
 }
 
 void NormalizeOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index 4d366a8..36205bb 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -33,7 +33,7 @@ __kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only ima
                               __read_only image2d_t bokehImage, __write_only image2d_t output, 
                               int2 offsetInput, int2 offsetOutput, int radius, int step, int2 dimension, int2 offset) 
 {
-	int2 coords = {get_global_id(0), get_global_id(1)}; 
+	int2 coords = {get_global_id(0), get_global_id(1)};
 	coords += offset;
 	float tempBoundingBox;
 	float4 color = {0.0f,0.0f,0.0f,0.0f};
@@ -54,10 +54,10 @@ __kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only ima
 		float2 uv;
 		int2 inputXy;
 		
-		for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny +=step, inputXy.y+=step) {
+		for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny += step, inputXy.y += step) {
 			uv.y = ((realCoordinate.y-ny)/radius2)*bokehImageDim.y+bokehImageCenter.y;
 			
-			for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx +=step, inputXy.x+=step) {
+			for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx += step, inputXy.x += step) {
 				uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;
 				bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
 				color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);
@@ -124,7 +124,7 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
 						}
 					}
 				}
-			} 
+			}
 		}
 
 		color = color_accum * (1.0f / multiplier_accum);
@@ -148,7 +148,7 @@ __kernel void dilateKernel(__read_only image2d_t inputImage,  __write_only image
                            int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension, 
                            int2 offset)
 {
-	int2 coords = {get_global_id(0), get_global_id(1)}; 
+	int2 coords = {get_global_id(0), get_global_id(1)};
 	coords += offset;
 	const int2 realCoordinate = coords + offsetOutput;
 
@@ -179,7 +179,7 @@ __kernel void erodeKernel(__read_only image2d_t inputImage,  __write_only image2
                            int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension, 
                            int2 offset)
 {
-	int2 coords = {get_global_id(0), get_global_id(1)}; 
+	int2 coords = {get_global_id(0), get_global_id(1)};
 	coords += offset;
 	const int2 realCoordinate = coords + offsetOutput;
 
@@ -210,7 +210,7 @@ __kernel void directionalBlurKernel(__read_only image2d_t inputImage,  __write_o
                            int2 offsetOutput, int iterations, float scale, float rotation, float2 translate,
                            float2 center, int2 offset)
 {
-	int2 coords = {get_global_id(0), get_global_id(1)}; 
+	int2 coords = {get_global_id(0), get_global_id(1)};
 	coords += offset;
 	const int2 realCoordinate = coords + offsetOutput;
 
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index b3c2df7..7d05202 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -94,8 +94,8 @@ static void write_buffer_rect(rcti *rect, const bNodeTree *tree,
 
 
 OutputSingleLayerOperation::OutputSingleLayerOperation(
-    const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path,
-    const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings)
+        const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path,
+        const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings)
 {
 	this->m_rd = rd;
 	this->m_tree = tree;
@@ -149,7 +149,7 @@ void OutputSingleLayerOperation::deinitExecution()
 		else
 			printf("Saved: %s\n", filename);
 		
-		IMB_freeImBuf(ibuf);	
+		IMB_freeImBuf(ibuf);
 	}
 	this->m_outputBuffer = NULL;
 	this->m_imageInput = NULL;
diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cpp b/source/blender/compositor/operations/COM_PixelateOperation.cpp
new file mode 100644
index 0000000..89e7f00
--- /dev/null
+++ b/source/blender/compositor/operations/COM_PixelateOperation.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ *		Jeroen Bakker
+ *		Monique Dewanchand
+ */
+
+#include "COM_PixelateOperation.h"
+
+PixelateOperation::PixelateOperation(DataType datatype) : NodeOperation()
+{
+	this->addInputSocket(datatype);
+	this->addOutputSocket(datatype);
+	this->setResolutionInputSocketIndex(0);
+	this->m_inputOperation = NULL;
+}
+
+void PixelateOperation::initExecution()
+{
+	this->m_inputOperation = this->getInputSocketReader(0);
+}
+
+void PixelateOperation::deinitExecution()
+{
+	this->m_inputOperation = NULL;
+}
+
+void PixelateOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+	float nx = round(x);
+	float ny = round(y);
+	this->m_inputOperation->read(output, nx, ny, sampler);
+}
+
diff --git a/source/blender/compositor/operations/COM_PixelateOperation.h b/source/blender/compositor/operations/COM_PixelateOperation.h
new file mode 100644
index 0000000..83603a5
--- /dev/null
+++ b/source/blender/compositor/operations/COM_PixelateOperation.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ *		Jeroen Bakker
+ *		Monique Dewanchand
+ */
+
+#ifndef _COM_PixelateOperation_h_
+#define _COM_PixelateOperation_h_
+
+#include "COM_NodeOperation.h"
+
+/**
+ * @brief Pixelate operation
+ *
+ * The Tile compositor is by default sub-pixel accurate.
+ * For some setups you don want this.
+ * This operation will remove the sub-pixel accuracy
+ */
+class PixelateOperation : public NodeOperation {
+private:
+	/**
+	 * @brief cached reference to the input operation
+	 */
+	SocketReader *m_inputOperation;
+public:
+	/**
+	 * @brief PixelateOperation
+	 * @param dataType the datatype to create this operator for (saves datatype conversions)
+	 */
+	PixelateOperation(DataType dataType);
+
+	/**
+	 * @brief initialization of the execution
+	 */
+	void initExecution();
+
+	/**
+	 * @brief de-initialization of the execution
+	 */
+	void deinitExecution();
+
+	/**
+	 * @brief executePixel
+	 * @param output result
+	 * @param x x-coordinate
+	 * @param y y-coordinate
+	 * @param sampler sampler
+	 */
+	void executePixel(float output[4], float x, float y, PixelSampler sampler);
+};
+
+#endif
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index d92fe04..5cc02a1 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -81,7 +81,7 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in
 	}
 	else {
 		rcti dispInput;
-		BLI_rcti_init(&dispInput, 0,5,0,5);
+		BLI_rcti_init(&dispInput, 0, 5, 0, 5);
 		if (this->getInputOperation(1)->determineDependingAreaOfInterest(&dispInput, readOperation, output)) {
 			return true;
 		}
@@ -104,7 +104,7 @@ void ProjectorLensDistortionOperation::updateDispersion()
 		float result[4];
 		this->getInputSocketReader(1)->read(result, 1, 1, COM_PS_NEAREST);
 		this->m_dispersion = result[0];
-		this->m_kr = 0.25f * maxf(minf(this->m_dispersion, 1.0f), 0.0f);
+		this->m_kr = 0.25f * max_ff(min_ff(this->m_dispersion, 1.0f), 0.0f);
 		this->m_kr2 = this->m_kr * 20;
 		this->m_dispersionAvailable = true;
 	}
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
index a4015c6..2ca4996 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
@@ -69,6 +69,46 @@ void RenderLayersBaseProg::initExecution()
 	}
 }
 
+void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler)
+{
+	unsigned int offset;
+	int ix, iy;
+	int width = this->getWidth(), height = this->getHeight();
+
+	switch (sampler) {
+		case COM_PS_NEAREST:
+			ix = x;
+			iy = y;
+			offset = (iy * width + ix) * this->m_elementsize;
+
+			if (this->m_elementsize == 1)
+				output[0] = this->m_inputBuffer[offset];
+			else if (this->m_elementsize == 3)
+				copy_v3_v3(output, &this->m_inputBuffer[offset]);
+			else
+				copy_v4_v4(output, &this->m_inputBuffer[offset]);
+
+			break;
+
+		case COM_PS_BILINEAR:
+			BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
+			break;
+
+		case COM_PS_BICUBIC:
+			BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
+			break;
+	}
+
+	if (this->m_elementsize == 1) {
+		output[1] = 0.0f;
+		output[2] = 0.0f;
+		output[3] = 0.0f;
+	}
+	else if (this->m_elementsize == 3) {
+		output[3] = 1.0f;
+	}
+}
+
 void RenderLayersBaseProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
 	int ix = x;
@@ -78,20 +118,7 @@ void RenderLayersBaseProg::executePixel(float output[4], float x, float y, Pixel
 		zero_v4(output);
 	}
 	else {
-		unsigned int offset = (iy * this->getWidth() + ix) * this->m_elementsize;
-		if (this->m_elementsize == 1) {
-			output[0] = this->m_inputBuffer[offset];
-			output[1] = 0.0f;
-			output[2] = 0.0f;
-			output[3] = 0.0f;
-		}
-		else if (this->m_elementsize == 3) {
-			copy_v3_v3(output, &this->m_inputBuffer[offset]);
-			output[3] = 1.0f;
-		}
-		else {
-			copy_v4_v4(output, &this->m_inputBuffer[offset]);
-		}
+		doInterpolation(output, x, y, sampler);
 	}
 }
 
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
index ea57d4b..3916862 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
@@ -80,6 +80,7 @@ protected:
 	 */
 	inline float *getInputBuffer() { return this->m_inputBuffer; }
 
+	void doInterpolation(float output[4], float x, float y, PixelSampler sampler);
 public:
 	/**
 	 * setter for the scene field. Will be called from
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index 276b2f5..9e8f5af 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -29,7 +29,16 @@
  * note: use bilinear because bicubic makes fuzzy even when not scaling at all (1:1)
  */
 
-ScaleOperation::ScaleOperation() : NodeOperation()
+BaseScaleOperation::BaseScaleOperation()
+{
+#ifdef USE_FORCE_BILINEAR
+	m_sampler = (int) COM_PS_BILINEAR;
+#else
+	m_sampler = -1;
+#endif
+}
+
+ScaleOperation::ScaleOperation() : BaseScaleOperation()
 {
 	this->addInputSocket(COM_DT_COLOR);
 	this->addInputSocket(COM_DT_VALUE);
@@ -59,22 +68,20 @@ void ScaleOperation::deinitExecution()
 
 void ScaleOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
-#ifdef USE_FORCE_BILINEAR
-	sampler = COM_PS_BILINEAR;
-#endif
+	PixelSampler effective_sampler = getEffectiveSampler(sampler);
 
 	float scaleX[4];
 	float scaleY[4];
 
-	this->m_inputXOperation->read(scaleX, x, y, sampler);
-	this->m_inputYOperation->read(scaleY, x, y, sampler);
+	this->m_inputXOperation->read(scaleX, x, y, effective_sampler);
+	this->m_inputYOperation->read(scaleY, x, y, effective_sampler);
 
 	const float scx = scaleX[0];
 	const float scy = scaleY[0];
 
 	float nx = this->m_centerX + (x - this->m_centerX) / scx;
 	float ny = this->m_centerY + (y - this->m_centerY) / scy;
-	this->m_inputOperation->read(output, nx, ny, sampler);
+	this->m_inputOperation->read(output, nx, ny, effective_sampler);
 }
 
 bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -94,12 +101,12 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
 	newInput.ymax = this->m_centerY + (input->ymax - this->m_centerY) / scy;
 	newInput.ymin = this->m_centerY + (input->ymin - this->m_centerY) / scy;
 
-	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+	return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
 
 // SCALE ABSOLUTE
-ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation()
+ScaleAbsoluteOperation::ScaleAbsoluteOperation() : BaseScaleOperation()
 {
 	this->addInputSocket(COM_DT_COLOR);
 	this->addInputSocket(COM_DT_VALUE);
@@ -129,15 +136,13 @@ void ScaleAbsoluteOperation::deinitExecution()
 
 void ScaleAbsoluteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
-#ifdef USE_FORCE_BILINEAR
-	sampler = COM_PS_BILINEAR;
-#endif
+	PixelSampler effective_sampler = getEffectiveSampler(sampler);
 
 	float scaleX[4];
 	float scaleY[4];
 
-	this->m_inputXOperation->read(scaleX, x, y, sampler);
-	this->m_inputYOperation->read(scaleY, x, y, sampler);
+	this->m_inputXOperation->read(scaleX, x, y, effective_sampler);
+	this->m_inputYOperation->read(scaleY, x, y, effective_sampler);
 
 	const float scx = scaleX[0]; // target absolute scale
 	const float scy = scaleY[0]; // target absolute scale
@@ -151,7 +156,7 @@ void ScaleAbsoluteOperation::executePixel(float output[4], float x, float y, Pix
 	float nx = this->m_centerX + (x - this->m_centerX) / relativeXScale;
 	float ny = this->m_centerY + (y - this->m_centerY) / relativeYScale;
 
-	this->m_inputOperation->read(output, nx, ny, sampler);
+	this->m_inputOperation->read(output, nx, ny, effective_sampler);
 }
 
 bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -176,12 +181,12 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
 	newInput.ymax = this->m_centerY + (input->ymax - this->m_centerY) / relateveYScale;
 	newInput.ymin = this->m_centerY + (input->ymin - this->m_centerY) / relateveYScale;
 
-	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+	return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
 
 // Absolute fixed siez
-ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation()
+ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation()
 {
 	this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
 	this->addOutputSocket(COM_DT_COLOR);
@@ -250,17 +255,15 @@ void ScaleFixedSizeOperation::deinitExecution()
 
 void ScaleFixedSizeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
-#ifdef USE_FORCE_BILINEAR
-	sampler = COM_PS_BILINEAR;
-#endif
+	PixelSampler effective_sampler = getEffectiveSampler(sampler);
 
 	if (this->m_is_offset) {
 		float nx = ((x - this->m_offsetX) * this->m_relX);
 		float ny = ((y - this->m_offsetY) * this->m_relY);
-		this->m_inputOperation->read(output, nx, ny, sampler);
+		this->m_inputOperation->read(output, nx, ny, effective_sampler);
 	}
 	else {
-		this->m_inputOperation->read(output, x * this->m_relX, y * this->m_relY, sampler);
+		this->m_inputOperation->read(output, x * this->m_relX, y * this->m_relY, effective_sampler);
 	}
 }
 
@@ -273,7 +276,7 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, Read
 	newInput.ymax = input->ymax * this->m_relY;
 	newInput.ymin = input->ymin * this->m_relY;
 
-	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+	return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
 void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
@@ -281,7 +284,7 @@ void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2], un
 	unsigned int nr[2];
 	nr[0] = this->m_newWidth;
 	nr[1] = this->m_newHeight;
-	NodeOperation::determineResolution(resolution, nr);
+	BaseScaleOperation::determineResolution(resolution, nr);
 	resolution[0] = this->m_newWidth;
 	resolution[1] = this->m_newHeight;
 }
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h
index 4239ff0..f42cdbd 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.h
+++ b/source/blender/compositor/operations/COM_ScaleOperation.h
@@ -25,7 +25,19 @@
 
 #include "COM_NodeOperation.h"
 
-class ScaleOperation : public NodeOperation {
+class BaseScaleOperation : public NodeOperation {
+public:
+	void setSampler(PixelSampler sampler) { this->m_sampler = (int) sampler; }
+
+protected:
+	BaseScaleOperation();
+
+	PixelSampler getEffectiveSampler(PixelSampler sampler) { return (m_sampler == -1) ? sampler : (PixelSampler) m_sampler;  }
+
+	int m_sampler;
+};
+
+class ScaleOperation : public BaseScaleOperation {
 private:
 	SocketReader *m_inputOperation;
 	SocketReader *m_inputXOperation;
@@ -41,7 +53,7 @@ public:
 	void deinitExecution();
 };
 
-class ScaleAbsoluteOperation : public NodeOperation {
+class ScaleAbsoluteOperation : public BaseScaleOperation {
 	SocketReader *m_inputOperation;
 	SocketReader *m_inputXOperation;
 	SocketReader *m_inputYOperation;
@@ -57,7 +69,7 @@ public:
 	void deinitExecution();
 };
 
-class ScaleFixedSizeOperation : public NodeOperation {
+class ScaleFixedSizeOperation : public BaseScaleOperation {
 	SocketReader *m_inputOperation;
 	int m_newWidth;
 	int m_newHeight;
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index 193ab66..d2c6c83 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -98,7 +98,7 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
 			const float sd = 1.0f / (float)ds;
 
 			for (z = 0; z < ds; ++z) {
-				const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
+				const float tz = (z + (jit ? BLI_frand() : 0.5f)) * sd;
 				t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot;
 				d = 1.0f / (1.0f + sqrtf(t));
 				const float nx = (u * d + 0.5f) * width - 0.5f;
@@ -116,7 +116,7 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
 			const float sd = 1.0f / (float)ds;
 
 			for (z = 0; z < ds; ++z) {
-				const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
+				const float tz = (z + (jit ? BLI_frand() : 0.5f)) * sd;
 				t = 1.0f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
 				d = 1.0f / (1.0f + sqrtf(t));
 				const float nx = (u * d + 0.5f) * width - 0.5f;
@@ -226,7 +226,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
 		UPDATE_INPUT;
 		determineUV(coords, input->xmax, input->ymin);
 		UPDATE_INPUT;
-	} 
+	}
 	else {
 		determineUV(coords, input->xmin, input->ymin, 1.0f, 1.0f);
 		newInput.xmin = coords[0];
@@ -268,11 +268,11 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
 
 void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion)
 {
-	this->m_kg = maxf(minf(distortion, 1.0f), -0.999f);
+	this->m_kg = max_ff(min_ff(distortion, 1.0f), -0.999f);
 	// smaller dispersion range for somewhat more control
-	const float d = 0.25f * maxf(minf(dispersion, 1.0f), 0.0f);
-	this->m_kr = maxf(minf((this->m_kg + d), 1.0f), -0.999f);
-	this->m_kb = maxf(minf((this->m_kg - d), 1.0f), -0.999f);
+	const float d = 0.25f * max_ff(min_ff(dispersion, 1.0f), 0.0f);
+	this->m_kr = max_ff(min_ff((this->m_kg + d), 1.0f), -0.999f);
+	this->m_kb = max_ff(min_ff((this->m_kg - d), 1.0f), -0.999f);
 	this->m_maxk = MAX3(this->m_kr, this->m_kg, this->m_kb);
 	this->m_sc = (this->m_data->fit && (this->m_maxk > 0.0f)) ? (1.0f / (1.0f + 2.0f * this->m_maxk)) :
 	                                                            (1.0f / (1.0f +        this->m_maxk));
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
index d41d1c1..8b52883 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
@@ -92,7 +92,7 @@ void TrackPositionOperation::initExecution()
 			}
 			else if (this->m_position == POSITION_RELATIVE_FRAME) {
 				int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(this->m_movieClip,
-						this->m_relativeFrame);
+				                                                                    this->m_relativeFrame);
 
 				marker = BKE_tracking_marker_get(track, relative_clip_framenr);
 				copy_v2_v2(this->m_relativePos, marker->pos);
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 7ccc910..61720c7 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -118,7 +118,7 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y,
 
 #ifdef COM_DEFOCUS_SEARCH
 	float search[4];
-	this->m_inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, NULL);
+	this->m_inputSearchProgram->read(search, x / InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, NULL);
 	int minx = search[0];
 	int miny = search[1];
 	int maxx = search[2];
@@ -192,13 +192,13 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
 	cl_int maxBlur;
 	cl_float threshold = this->m_threshold;
 	
-	MemoryBuffer *sizeMemoryBuffer = (MemoryBuffer *)this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers);
+	MemoryBuffer *sizeMemoryBuffer = this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers);
 
 	const float max_dim = max(m_width, m_height);
 	cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
 
 	maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue() * scalar;
-	maxBlur = MIN2(maxBlur, this->m_maxBlur);
+	maxBlur = min(maxBlur, this->m_maxBlur);
 
 	device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
 	device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 1,  -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram);
@@ -298,9 +298,9 @@ voi *InverseSearchRadiusOperation::initializeTileData(rcti *rect)
 			int rx = x * DIVIDER;
 			int ry = y * DIVIDER;
 			buffer[offset] = MAX2(rx - m_maxBlur, 0);
-			buffer[offset+1] = MAX2(ry- m_maxBlur, 0);
-			buffer[offset+2] = MIN2(rx+DIVIDER + m_maxBlur, width);
-			buffer[offset+3] = MIN2(ry+DIVIDER + m_maxBlur, height);
+			buffer[offset + 1] = MAX2(ry - m_maxBlur, 0);
+			buffer[offset + 2] = MIN2(rx + DIVIDER + m_maxBlur, width);
+			buffer[offset + 3] = MIN2(ry + DIVIDER + m_maxBlur, height);
 			offset += 4;
 		}
 	}
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index d9ca131..d5f2c28 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -79,8 +79,7 @@ void ViewerBaseOperation::initImage()
 		BLI_unlock_thread(LOCK_DRAW_IMAGE);
 	}
 
-	if (m_doDepthBuffer) 
-	{
+	if (m_doDepthBuffer) {
 		addzbuffloatImBuf(ibuf);
 	}
 	BLI_unlock_thread(LOCK_DRAW_IMAGE);
@@ -88,28 +87,23 @@ void ViewerBaseOperation::initImage()
 	/* now we combine the input with ibuf */
 	this->m_outputBuffer = ibuf->rect_float;
 
-	/* needed for display buffer update
-	 *
-	 * no need to lock / reference the image buffer because it's seems
-	 * to be the single place which changes buffers of viewer image
-	 * which is this node
-	 */
+	/* needed for display buffer update */
 	this->m_ibuf = ibuf;
 
-	if (m_doDepthBuffer)
-	{
+	if (m_doDepthBuffer) {
 		this->m_depthBuffer = ibuf->zbuf_float;
 	}
 
-	BKE_image_release_ibuf(this->m_image, this->m_lock);
+	BKE_image_release_ibuf(this->m_image, this->m_ibuf, this->m_lock);
 }
+
 void ViewerBaseOperation:: updateImage(rcti *rect)
 {
 	IMB_partial_display_buffer_update(this->m_ibuf, this->m_outputBuffer, NULL, getWidth(), 0, 0,
 	                                  this->m_viewSettings, this->m_displaySettings,
-	                                  rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+	                                  rect->xmin, rect->ymin, rect->xmax, rect->ymax, FALSE);
 
-	WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
+	this->updateDraw();
 }
 
 void ViewerBaseOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index 576d5da..d1ac7d7 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -96,7 +96,7 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 			if (m_depthInput) {
 				this->m_depthInput->read(depth, x, y, COM_PS_NEAREST);
 				depthbuffer[offset] = depth[0];
-			} 
+			}
 
 			offset ++;
 			offset4 += 4;
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index 273c10b..17c8f4d 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -110,7 +110,8 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 	memoryBuffer->setCreatedState();
 }
 
-void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer)
+void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti *rect, unsigned int chunkNumber,
+                                               MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer)
 {
 	float *outputFloatBuffer = outputBuffer->getBuffer();
 	cl_int error;
diff --git a/source/blender/datatoc/datatoc.c b/source/blender/datatoc/datatoc.c
index a7da037..379658b 100644
--- a/source/blender/datatoc/datatoc.c
+++ b/source/blender/datatoc/datatoc.c
@@ -49,7 +49,6 @@ static char *basename(char *string)
 int main(int argc, char **argv)
 {
 	FILE *fpin,  *fpout;
-	char sizest[256];
 	long size;
 	int i;
 
@@ -79,8 +78,6 @@ int main(int argc, char **argv)
 	for (i = 0; i < (int)strlen(argv[1]); i++)
 		if (argv[1][i] == '.') argv[1][i] = '_';
 
-	sprintf(sizest, "%d", (int)size);
-
 	fpout = fopen(argv[2], "w");
 	if (!fpout) {
 		fprintf(stderr, "Unable to open output <%s>\n", argv[2]);
@@ -88,7 +85,7 @@ int main(int argc, char **argv)
 	}
 
 	fprintf(fpout, "/* DataToC output of file <%s> */\n\n", argv[1]);
-	fprintf(fpout, "int datatoc_%s_size = %s;\n", argv[1], sizest);
+	fprintf(fpout, "int datatoc_%s_size = %d;\n", argv[1], (int)size);
 	fprintf(fpout, "char datatoc_%s[] = {\n", argv[1]);
 	while (size--) {
 		/* if we want to open in an editor
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 1998daf..9ceecd6 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -752,7 +752,7 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[
 		
 		/* highlight only for active */
 		if (ale->flag & AGRP_ACTIVE)
-			copy_v3_v3_char((char *)cp, agrp->cs.active);
+			copy_v3_v3_char((char *)cp, agrp->cs.select);
 		else
 			copy_v3_v3_char((char *)cp, agrp->cs.solid);
 		
@@ -1186,7 +1186,7 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
 			if (ma->adt)
 				return GET_ACF_FLAG_PTR(ma->adt->flag, type);
 			else
-				return NULL;	
+				return NULL;
 		
 		default: /* unsupported */
 			return NULL;
@@ -1263,7 +1263,7 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
 			if (la->adt)
 				return GET_ACF_FLAG_PTR(la->adt->flag, type);
 			else
-				return NULL;	
+				return NULL;
 		
 		default: /* unsupported */
 			return NULL;
@@ -1347,7 +1347,7 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
 			if (tex->adt)
 				return GET_ACF_FLAG_PTR(tex->adt->flag, type);
 			else
-				return NULL;	
+				return NULL;
 		
 		default: /* unsupported */
 			return NULL;
@@ -3251,7 +3251,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
 	/* get the flag and the pointer to that flag */
 	flag = acf->setting_flag(ac, setting, &negflag);
 	ptr = acf->setting_ptr(ale, setting, &ptrsize);
-	/* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */
+	/* enabled = ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */
 	
 	/* get the base icon for the setting */
 	switch (setting) {
@@ -3266,13 +3266,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
 			break;
 			
 		case ACHANNEL_SETTING_EXPAND: /* expanded triangle */
-			//icon= ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
+			//icon = ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
 			icon = ICON_TRIA_RIGHT;
 			tooltip = "Make channels grouped under this channel visible";
 			break;
 			
 		case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */
-			//icon= ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED);
+			//icon = ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED);
 			icon = ICON_LAYER_USED;
 			tooltip = "NLA Track is the only one evaluated for the AnimData block it belongs to";
 			break;
@@ -3281,13 +3281,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
 		
 		case ACHANNEL_SETTING_PROTECT: /* protected lock */
 			// TODO: what about when there's no protect needed?
-			//icon= ((enabled)? ICON_LOCKED : ICON_UNLOCKED);
+			//icon = ((enabled)? ICON_LOCKED : ICON_UNLOCKED);
 			icon = ICON_UNLOCKED;
 			tooltip = "Editability of keyframes for this channel";
 			break;
 			
 		case ACHANNEL_SETTING_MUTE: /* muted speaker */
-			//icon= ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF);
+			//icon = ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF);
 			icon = ICON_MUTE_IPO_OFF;
 			
 			if (ale->type == ALE_FCURVE) 
@@ -3370,7 +3370,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
 	y = (ymaxc - yminc) / 2 + yminc;
 	ymid = y - 7;
 	/* y-coordinates for text is only 4 down from middle */
-	/* ytext= y - 4; */
+	/* ytext = y - 4; */
 	
 	/* no button backdrop behind icons */
 	uiBlockSetEmboss(block, UI_EMBOSSN);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index d35f39a..fe83620 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -464,7 +464,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
 				
 				/* store this level as the 'old' level now */
 				prevLevel = level;
-			}	
+			}
 			/* if the level is 'greater than' (i.e. less important) than the previous level... */
 			else if (level > prevLevel) {
 				/* if previous level was a base-level (i.e. 0 offset / root of one hierarchy),
@@ -600,7 +600,7 @@ static int animedit_poll_channels_nla_tweakmode_off(bContext *C)
 	if (ELEM3(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
 		return 0;
 	
-	/* NLA TweakMode test */	
+	/* NLA TweakMode test */
 	if (sa->spacetype == SPACE_NLA) {
 		if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON))
 			return 0;
@@ -794,7 +794,7 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
 			FCurve *fcu = (FCurve *)channel;
 			
 			is_sel = SEL_FCU(fcu);
-		}	
+		}
 		break;
 		case ANIMTYPE_NLATRACK:
 		{
@@ -910,7 +910,7 @@ static void rearrange_nla_channels(bAnimContext *UNUSED(ac), AnimData *adt, shor
 	if (rearrange_func == NULL)
 		return;
 	
-	/* only consider NLA data if it's accessible */	
+	/* only consider NLA data if it's accessible */
 	//if (EXPANDED_DRVD(adt) == 0)
 	//	return;
 	
@@ -931,7 +931,7 @@ static void rearrange_driver_channels(bAnimContext *UNUSED(ac), AnimData *adt, s
 	if (rearrange_func == NULL)
 		return;
 	
-	/* only consider drivers if they're accessible */	
+	/* only consider drivers if they're accessible */
 	if (EXPANDED_DRVD(adt) == 0)
 		return;
 	
@@ -1560,6 +1560,8 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
 /* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
 static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
 	ot->name = "Enable Channel Setting";
 	ot->idname = "ANIM_OT_channels_setting_enable";
@@ -1575,13 +1577,16 @@ static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
 	
 	/* props */
 	/* flag-setting mode */
-	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
+	prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN);
 	/* setting to set */
 	ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 /* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
 static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
 	ot->name = "Disable Channel Setting";
 	ot->idname = "ANIM_OT_channels_setting_disable";
@@ -1597,13 +1602,16 @@ static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
 	
 	/* props */
 	/* flag-setting mode */
-	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
+	prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
 	/* setting to set */
 	ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 
 static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
 	ot->name = "Toggle Channel Setting";
 	ot->idname = "ANIM_OT_channels_setting_toggle";
@@ -1619,13 +1627,16 @@ static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
 	
 	/* props */
 	/* flag-setting mode */
-	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
+	prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
 	/* setting to set */
 	ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 
 static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
 	ot->name = "Toggle Channel Editability";
 	ot->idname = "ANIM_OT_channels_editable_toggle";
@@ -1642,7 +1653,8 @@ static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
 	/* flag-setting mode */
 	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
 	/* setting to set */
-	RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
+	prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
 }
 
 /* ********************** Expand Channels Operator *********************** */
@@ -2206,7 +2218,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
 			}
 			
 			notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
-		}	
+	}
 		break;
 		
 		case ANIMTYPE_GROUP: 
@@ -2219,7 +2231,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
 				agrp->flag ^= AGRP_SELECTED;
 			}
 			else if (selectmode == -1) {
-				/* select all in group (and deselect everthing else) */	
+				/* select all in group (and deselect everthing else) */
 				FCurve *fcu;
 				
 				/* deselect all other channels */
@@ -2228,7 +2240,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
 				/* only select channels in group and group itself */
 				for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next)
 					fcu->flag |= FCURVE_SELECTED;
-				agrp->flag |= AGRP_SELECTED;					
+				agrp->flag |= AGRP_SELECTED;
 			}
 			else {
 				/* select group by itself */
@@ -2306,7 +2318,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
 				/* invert selection status of this layer only */
 				gpl->flag ^= GP_LAYER_SELECT;
 			}
-			else {	
+			else {
 				/* select layer by itself */
 				ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
 				gpl->flag |= GP_LAYER_SELECT;
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 620f5de..0f0584a 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -261,8 +261,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d)
 		/* only draw two separate 'curtains' if there's no overlap between them */
 		if (PSFRA < PEFRA) {
 			glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
-			glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);	
-		} 
+			glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+		}
 		else {
 			glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
 		}
@@ -381,7 +381,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
 						return RAD2DEGF(1.0f);  /* radians to degrees */
 				}
 			}
-
+			
 			/* TODO: other rotation types here as necessary */
 		}
 	}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 8b0593d..5e215fb 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -175,7 +175,7 @@ static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
 			return 1;
 			
 		case SACTCONT_MASK: /* Mask */ /* XXX review how this mode is handled... */
-{
+		{
 			/* TODO, other methods to get the mask */
 			// Sequence *seq = BKE_sequencer_active_get(ac->scene);
 			//MovieClip *clip = ac->scene->clip;
@@ -189,7 +189,7 @@ static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
 			
 			ac->mode = saction->mode;
 			return 1;
-}
+		}
 		case SACTCONT_DOPESHEET: /* DopeSheet */
 			/* update scene-pointer (no need to check for pinning yet, as not implemented) */
 			saction->ads.source = (ID *)ac->scene;
@@ -682,7 +682,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
 				ale->datatype = ALE_ACT;
 				
 				ale->adt = BKE_animdata_from_id(data);
-			}	
+			}
 			break;
 			case ANIMTYPE_DSSPK:
 			{
@@ -811,7 +811,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
 					}
 					ale->datatype = (ale->key_data) ? ALE_FCURVE : ALE_NONE;
 				}
-			}	
+			}
 			break;
 			
 			case ANIMTYPE_GPLAYER:
@@ -911,14 +911,16 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
 		/* only consider if F-Curve involves sequence_editor.sequences */
 		if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
 			Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
-			Sequence *seq;
+			Sequence *seq = NULL;
 			char *seq_name;
-			
-			/* get strip name, and check if this strip is selected */
-			seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
-			seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
-			if (seq_name) MEM_freeN(seq_name);
-			
+
+			if (ed) {
+				/* get strip name, and check if this strip is selected */
+				seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
+				seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
+				if (seq_name) MEM_freeN(seq_name);
+			}
+
 			/* can only add this F-Curve if it is selected */
 			if (ads->filterflag & ADS_FILTER_ONLYSEL) {
 				if ((seq == NULL) || (seq->flag & SELECT) == 0)
@@ -980,6 +982,27 @@ static short skip_fcurve_with_name(bDopeSheet *ads, FCurve *fcu, ID *owner_id)
 	return 1;
 }
 
+/* Check if F-Curve has errors and/or is disabled 
+ * > returns: (bool) True if F-Curve has errors/is disabled
+ */
+static short fcurve_has_errors(FCurve *fcu)
+{
+	/* F-Curve disabled - path eval error */
+	if (fcu->flag & FCURVE_DISABLED) {
+		return 1;
+	}
+	
+	/* driver? */
+	if (fcu->driver) {
+		/* for now, just check if the entire thing got disabled... */
+		if (fcu->driver->flag & DRIVER_FLAG_INVALID)
+			return 1;
+	}
+	
+	/* no errors found */
+	return 0;
+}
+
 /* find the next F-Curve that is usable for inclusion */
 static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
 {
@@ -1002,7 +1025,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro
 				if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
 					continue;
 			}
-		}	
+		}
 		
 		/* only include if visible (Graph Editor check, not channels check) */
 		if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
@@ -1018,6 +1041,13 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro
 								continue;
 						}
 						
+						/* error-based filtering... */
+						if ((ads) && (ads->filterflag & ADS_FILTER_ONLY_ERRORS)) {
+							/* skip if no errors... */
+							if (fcurve_has_errors(fcu) == 0)
+								continue;
+						}
+						
 						/* this F-Curve can be used, so return it */
 						return fcu;
 					}
@@ -1183,7 +1213,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
 		 */
 		if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) || (adt->action)) {
 			/* there isn't really anything editable here, so skip if need editable */
-			if ((filter_mode & ANIMFILTER_FOREDIT) == 0) { 
+			if ((filter_mode & ANIMFILTER_FOREDIT) == 0) {
 				/* just add the action track now (this MUST appear for drawing)
 				 *	- as AnimData may not have an action, we pass a dummy pointer just to get the list elem created, then
 				 *	  overwrite this with the real value - REVIEW THIS...
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 5295950..d8e3349 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -89,7 +89,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
 			 *		i.e. Bone1.Location.X, or Object.Location.X
 			 *	2) <array-index> <property-name> (<struct name>)
 			 *		i.e. X Location (Bone1), or X Location (Object)
-			 *	
+			 *
 			 * Currently, option 2 is in use, to try and make it easier to quickly identify F-Curves (it does have
 			 * problems with looking rather odd though). Option 1 is better in terms of revealing a consistent sense of 
 			 * hierarchy though, which isn't so clear with option 2.
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 895aaec..1b98079 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -150,7 +150,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
 				break;
 					
 				case TFM_TIME_SCALE:
-				{	
+				{
 					/* rescale the distance between the marker and the current frame */
 					marker->frame = cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
 					changed++;
@@ -249,7 +249,7 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
 					min = (float)marker->frame;
 				if (marker->frame > max)
 					max = (float)marker->frame;
-			}	
+			}
 		}
 	}
 	
@@ -278,7 +278,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
 			return;
 		}
 		else if (ce->cfra > marker->frame) break;
-	}	
+	}
 	
 	cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
 	if (ce) BLI_insertlinkbefore(lb, ce, cen);
@@ -360,7 +360,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
 	glScalef(1.0f / xscale, 1.0f, 1.0f);
 	
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);			
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
 	/* vertical line - dotted */
 #ifdef DURIAN_CAMERA_SWITCH
@@ -522,7 +522,7 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent
 	else if (op->type->exec)
 		retval = op->type->exec(C, op);
 	else
-		BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!");
+		BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!");
 		
 	/* return status modifications - for now, make this spacetype dependent as above */
 	if (sa->spacetype != SPACE_TIME) {
@@ -706,8 +706,13 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *e
 }
 
 /* note, init has to be called succesfully */
-static void ed_marker_move_apply(wmOperator *op)
+static void ed_marker_move_apply(bContext *C, wmOperator *op)
 {
+#ifdef DURIAN_CAMERA_SWITCH
+	bScreen *sc = CTX_wm_screen(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *camera = scene->camera;
+#endif
 	MarkerMove *mm = op->customdata;
 	TimeMarker *marker;
 	int a, offs;
@@ -719,17 +724,27 @@ static void ed_marker_move_apply(wmOperator *op)
 			a++;
 		}
 	}
+
+	WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
+	WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
+	
+#ifdef DURIAN_CAMERA_SWITCH
+	/* so we get view3d redraws */
+	BKE_scene_camera_switch_update(scene);
+
+	if (camera != scene->camera) {
+		BKE_screen_view3d_scene_sync(sc);
+		WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
+	}
+#endif
 }
 
 /* only for modal */
 static int ed_marker_move_cancel(bContext *C, wmOperator *op)
 {
 	RNA_int_set(op->ptr, "frames", 0);
-	ed_marker_move_apply(op);
-	ed_marker_move_exit(C, op);	
-	
-	WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
-	WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
+	ed_marker_move_apply(C, op);
+	ed_marker_move_exit(C, op);
 
 	return OPERATOR_CANCELLED;
 }
@@ -789,7 +804,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 				
 				offs = (int)fac;
 				RNA_int_set(op->ptr, "frames", offs);
-				ed_marker_move_apply(op);
+				ed_marker_move_apply(C, op);
 				
 				/* cruft below is for header print */
 				for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
@@ -821,7 +836,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 				}
 				else {
 					/* we only print the offset */
-					if (mm->slink->spacetype == SPACE_TIME) { 
+					if (mm->slink->spacetype == SPACE_TIME) {
 						SpaceTime *stime = (SpaceTime *)mm->slink;
 						if (stime->flag & TIME_DRAWFRAMES) 
 							BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs);
@@ -840,29 +855,29 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 					}
 				}
 				
-				WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
-				WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
 				ED_area_headerprint(CTX_wm_area(C), str);
 			}
 	}
 
 	if (evt->val == KM_PRESS) {
-		float vec;
-		char str_tx[NUM_STR_REP_LEN];
-		
 		if (handleNumInput(&mm->num, evt)) {
-			applyNumInput(&mm->num, &vec);
-			outputNumInput(&mm->num, str_tx);
-			
-			RNA_int_set(op->ptr, "frames", vec);
-			ed_marker_move_apply(op);
-			// ed_marker_header_update(C, op, str, (int)vec[0]);
+			char str_tx[NUM_STR_REP_LEN];
+			float value = RNA_int_get(op->ptr, "frames");
+			applyNumInput(&mm->num, &value);
+
+			if (hasNumInput(&mm->num)) {
+				outputNumInput(&mm->num, str_tx);
+			}
+			else {
+				BLI_snprintf(str_tx, sizeof(str_tx), "%d", (int)value);
+			}
+
+			RNA_int_set(op->ptr, "frames", value);
+			ed_marker_move_apply(C, op);
+			// ed_marker_header_update(C, op, str, (int)value);
 			// strcat(str, str_tx);
 			BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
 			ED_area_headerprint(CTX_wm_area(C), str);
-			
-			WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
-			WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
 		}
 	}
 
@@ -872,7 +887,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 static int ed_marker_move_exec(bContext *C, wmOperator *op)
 {
 	if (ed_marker_move_init(C, op)) {
-		ed_marker_move_apply(op);
+		ed_marker_move_apply(C, op);
 		ed_marker_move_exit(C, op);
 		return OPERATOR_FINISHED;
 	}
@@ -1030,7 +1045,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
 	x = evt->x - ar->winrct.xmin;
 	y = evt->y - ar->winrct.ymin;
 	
-	UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);	
+	UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
 	
 	cfra = ED_markers_find_nearest_marker_time(markers, viewx);
 	
@@ -1377,7 +1392,7 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
 	}
 
 	if (scene_to == CTX_data_scene(C)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't re-link markers into the same scene");
+		BKE_report(op->reports, RPT_ERROR, "Cannot re-link markers into the same scene");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1394,6 +1409,11 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
+static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+	return ed_markers_opwrap_invoke_custom(C, op, evt, WM_menu_invoke);
+}
+
 static void MARKER_OT_make_links_scene(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
@@ -1405,7 +1425,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = ed_marker_make_links_scene_exec;
-	ot->invoke = ed_markers_opwrap_invoke;
+	ot->invoke = ed_marker_make_links_scene_invoke_wrapper;
 	ot->poll = ed_markers_poll_selected_markers;
 
 	/* flags */
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index f2711ec..ca036a8 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -172,7 +172,7 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
 	ot->poll = change_frame_poll;
 	
 	/* flags */
-	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO | OPTYPE_GRAB_POINTER;
 
 	/* rna */
 	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 672e11a..25833c1 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -91,7 +91,7 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
 	adt = BKE_animdata_from_id(id);
 	if ((adt == NULL) && (add))
 		adt = BKE_id_add_animdata(id);
-	if (adt == NULL) { 
+	if (adt == NULL) {
 		/* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */
 		return NULL;
 	}
@@ -147,7 +147,7 @@ short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int ar
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
 		BKE_reportf(reports, RPT_ERROR, 
-		            "Could not add Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+		            "Could not add driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
 		            id->name, rna_path);
 		return 0;
 	}
@@ -310,7 +310,7 @@ short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int a
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
 		BKE_reportf(reports, RPT_ERROR,
-		            "Could not find Driver to copy, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+		            "Could not find driver to copy, as RNA path is invalid for the given ID (ID = %s, path = %s)",
 		            id->name, rna_path);
 		return 0;
 	}
@@ -357,14 +357,14 @@ short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
 		BKE_reportf(reports, RPT_ERROR,
-		            "Could not paste Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+		            "Could not paste driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
 		            id->name, rna_path);
 		return 0;
 	}
 	
 	/* if the buffer is empty, cannot paste... */
 	if (channeldriver_copypaste_buf == NULL) {
-		BKE_report(reports, RPT_ERROR, "Paste Driver: No Driver to paste");
+		BKE_report(reports, RPT_ERROR, "Paste driver: no driver to paste");
 		return 0;
 	}
 	
@@ -478,7 +478,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op)
 		char *path = get_driver_path_hack(C, &ptr, prop);
 		short flags = CREATEDRIVER_WITH_DEFAULT_DVAR;
 		
-		if (path) {			
+		if (path) {
 			success += ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON);
 			
 			MEM_freeN(path);
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 30e4d85..79a4c9a 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -111,6 +111,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 	uiBlock *block;
 	uiBut *but;
 	PointerRNA ptr;
+	short bwidth = width - 30; /* max button width */
 	
 	/* init the RNA-pointer */
 	RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
@@ -119,10 +120,10 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 	/* col = uiLayoutColumn(layout, TRUE); */ /* UNUSED */
 	block = uiLayoutGetBlock(layout);
 	uiBlockBeginAlign(block);
-	but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width - 30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
+	but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
 	uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
-		
-	uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, width - 30, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
+	
+	uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
 	uiBlockEndAlign(block);
 	
 	/* now add settings for individual modes */
@@ -132,50 +133,62 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 			float *cp = NULL;
 			char xval[32];
 			unsigned int i;
+			int maxXWidth;
 			
 			/* draw polynomial order selector */
 			row = uiLayoutRow(layout, FALSE);
 			block = uiLayoutGetBlock(row);
-			but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width - 30, 19,
+			but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, bwidth, 20,
 			                &data->poly_order, 1, 100, 0, 0,
 			                TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
 			uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
 			
 			
+			/* calculate maximum width of label for "x^n" labels */
+			if (data->arraysize > 2) {
+				BLI_snprintf(xval, sizeof(xval), "x^%u", data->arraysize);
+				maxXWidth = UI_GetStringWidth(xval) + 10; /* XXX: UI_GetStringWidth is not accurate */
+			}
+			else {
+				/* basic size (just "x") */
+				maxXWidth = 15; 
+			}
+			
 			/* draw controls for each coefficient and a + sign at end of row */
 			row = uiLayoutRow(layout, TRUE);
 			block = uiLayoutGetBlock(row);
 			
 			cp = data->coefficients;
 			for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
-				/* To align with first line */
+				/* To align with first line... */
 				if (i)
-					uiDefBut(block, LABEL, 1, "   ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
+					uiDefBut(block, LABEL, 1, "   ", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
 				else
-					uiDefBut(block, LABEL, 1, "y =", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
+					uiDefBut(block, LABEL, 1, "y =", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
+				
 				/* coefficient */
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 150, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, bwidth / 2, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
 				          10, 3, TIP_("Coefficient for polynomial"));
 				
 				/* 'x' param (and '+' if necessary) */
 				if (i == 0)
-					strcpy(xval, "");
+					BLI_strncpy(xval, "", sizeof(xval));
 				else if (i == 1)
-					strcpy(xval, "x");
+					BLI_strncpy(xval, "x", sizeof(xval));
 				else
-					sprintf(xval, "x^%u", i);
-				uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
+					BLI_snprintf(xval, sizeof(xval), "x^%u", i);
+				uiDefBut(block, LABEL, 1, xval, 0, 0, maxXWidth, 20, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
 				
 				if ( (i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2) ) {
-					uiDefBut(block, LABEL, 1, "+", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
+					uiDefBut(block, LABEL, 1, "+", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
 					
 					/* next coefficient on a new row */
 					row = uiLayoutRow(layout, TRUE);
 					block = uiLayoutGetBlock(row);
 				}
 				else {
-					/* For alignement in UI! */
-					uiDefBut(block, LABEL, 1, " ", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
+					/* For alignment in UI! */
+					uiDefBut(block, LABEL, 1, " ", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
 				}
 			}
 			break;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 6c9105d..e520a95 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -322,7 +322,7 @@ static void nupdate_abk_bezt(void *node, void *data)
 	/* just add the BezTriple to the buffer if there's space, or allocate a new one */
 	if (abk->numBezts >= MAX_ABK_BUFSIZE) {
 		// TODO: need to allocate new array to cater...
-		//bezts_extra= MEM_callocN(...);
+		//bezts_extra = MEM_callocN(...);
 		if (G.debug & G_DEBUG)
 			printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples\n");
 	}
@@ -345,7 +345,7 @@ static BezTriple *abk_get_bezt_with_value(ActBeztColumn *abk, float value)
 		return NULL;
 	
 	/* look over each BezTriple in this container */
-	for (i = 0; i < abk->numBezts; i++) {		
+	for (i = 0; i < abk->numBezts; i++) {
 		/* only do exact match for now... */
 		if (/*i >= MAX_ABK_BUFSIZE*/ 0) {
 			// TODO: this case needs special handling
@@ -582,7 +582,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
 	}
 	
 	/* tweak size of keyframe shape according to type of keyframe 
-	 * - 'proper' keyframes have key_type=0, so get drawn at full size
+	 * - 'proper' keyframes have key_type = 0, so get drawn at full size
 	 */
 	hsize -= 0.5f * key_type;
 	
@@ -960,7 +960,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
 
 	if (fcu && fcu->totvert && fcu->bezt) {
 		/* apply NLA-mapping (if applicable) */
-		if (adt)	
+		if (adt)
 			ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
 		
 		/* if getting long keyframes too, grab the BezTriples in a BST for 
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index b277d0e..015c266 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -154,7 +154,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
 	if (fcu_cb)
 		fcu_cb(fcu);
 	
-	/* done */	
+	/* done */
 	return 0;
 }
 
@@ -639,7 +639,7 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be
 		if (ELEM3(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1 = HD_ALIGN;
 		if (ELEM3(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2 = HD_ALIGN;
 	}
-	return 0;	
+	return 0;
 }
 
 /* value to snap to is stored in the custom data -> first float value slot */
@@ -880,7 +880,7 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
 	switch (code) {
 		case BEZT_IPO_CONST: /* constant */
 			return set_bezt_constant;
-		case BEZT_IPO_LIN: /* linear */	
+		case BEZT_IPO_LIN: /* linear */
 			return set_bezt_linear;
 		default: /* bezier */
 			return set_bezt_bezier;
@@ -930,7 +930,7 @@ KeyframeEditFunc ANIM_editkeyframes_keytype(short code)
 		case BEZT_KEYTYPE_JITTER: /* jitter keyframe */
 			return set_keytype_jitter;
 			
-		case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */	
+		case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */
 		default:
 			return set_keytype_keyframe;
 	}
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index b5c0555..9249b91 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -188,7 +188,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
 	
 	/* make a copy of the old BezTriples, and clear F-Curve */
 	old_bezts = fcu->bezt;
-	totCount = fcu->totvert;	
+	totCount = fcu->totvert;
 	fcu->bezt = NULL;
 	fcu->totvert = 0;
 	
@@ -256,7 +256,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
 					insert_vert_fcurve(fcu, cur[0], cur[1], 0);
 				}
 			}
-			else {	
+			else {
 				/* add if value doesn't equal that of previous */
 				if (IS_EQT(cur[1], prev[1], thresh) == 0) {
 					/* add new keyframe */
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0454e88..8ba330e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -43,6 +43,8 @@
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
@@ -106,7 +108,7 @@ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
 	}
 		
 	/* only if including settings from the autokeying mode... */
-	if (incl_mode) { 
+	if (incl_mode) {
 		/* keyframing mode - only replace existing keyframes */
 		if (IS_AUTOKEY_MODE(scene, EDITKEYS)) 
 			flag |= INSERTKEY_REPLACE;
@@ -129,7 +131,7 @@ bAction *verify_adt_action(ID *id, short add)
 	adt = BKE_animdata_from_id(id);
 	if ((adt == NULL) && (add))
 		adt = BKE_id_add_animdata(id);
-	if (adt == NULL) { 
+	if (adt == NULL) {
 		/* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */
 		printf("ERROR: Couldn't add AnimData (ID = %s)\n", (id) ? (id->name) : "<None>");
 		return NULL;
@@ -238,7 +240,7 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
 		i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace);
 		
 		/* replace an existing keyframe? */
-		if (replace) {			
+		if (replace) {
 			/* sanity check: 'i' may in rare cases exceed arraylen */
 			if ((i >= 0) && (i < fcu->totvert)) {
 				/* just change the values when replacing, so as to not overwrite handles */
@@ -410,12 +412,12 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
 		float prevPosi = 0.0f, prevVal = 0.0f;
 		float beztPosi = 0.0f, beztVal = 0.0f;
 			
-		/* get current time+value */	
+		/* get current time+value */
 		beztPosi = bezt->vec[1][0];
 		beztVal = bezt->vec[1][1];
 			
 		if (prev) {
-			/* there is a keyframe before the one currently being examined */		
+			/* there is a keyframe before the one currently being examined */
 			
 			/* get previous time+value */
 			prevPosi = prev->vec[1][0];
@@ -477,10 +479,10 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
 	
 	/* Frame in which to add a new-keyframe occurs after all other keys
 	 * -> If there are at least two existing keyframes, then if the values of the
-	 *	 last two keyframes and the new-keyframe match, the last existing keyframe
-	 *	 gets deleted as it is no longer required.
+	 *    last two keyframes and the new-keyframe match, the last existing keyframe
+	 *    gets deleted as it is no longer required.
 	 * -> Otherwise, a keyframe is just added. 1.0 is added so that fake-2nd-to-last
-	 *	 keyframe is not equal to last keyframe.
+	 *    keyframe is not equal to last keyframe.
 	 */
 	bezt = (fcu->bezt + (fcu->totvert - 1));
 	valA = bezt->vec[1][1];
@@ -787,14 +789,15 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
 	/* F-Curve not editable? */
 	if (fcurve_is_keyframable(fcu) == 0) {
 		BKE_reportf(reports, RPT_ERROR, 
-		            "F-Curve with path = '%s' [%d] cannot be keyframed. Ensure that it is not locked or sampled. Also, try removing F-Modifiers",
+		            "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
+		            "and try removing F-Modifiers",
 		            fcu->rna_path, fcu->array_index);
 		return 0;
 	}
 	
 	/* if no property given yet, try to validate from F-Curve info */
 	if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
-		BKE_report(reports, RPT_ERROR, "No RNA-pointer available to retrieve values for keyframing from");
+		BKE_report(reports, RPT_ERROR, "No RNA pointer available to retrieve values for keyframing from");
 		return 0;
 	}
 	if (prop == NULL) {
@@ -803,10 +806,10 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
 		/* try to get property we should be affecting */
 		if ((RNA_path_resolve(&ptr, fcu->rna_path, &tmp_ptr, &prop) == 0) || (prop == NULL)) {
 			/* property not found... */
-			const char *idname = (ptr.id.data) ? ((ID *)ptr.id.data)->name : "<No ID-Pointer>";
+			const char *idname = (ptr.id.data) ? ((ID *)ptr.id.data)->name : TIP_("<No ID pointer>");
 			
 			BKE_reportf(reports, RPT_ERROR,
-			            "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+			            "Could not insert keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
 			            idname, fcu->rna_path);
 			return 0;
 		}
@@ -906,15 +909,15 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 	
 	/* validate pointer first - exit if failure */
 	if (id == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "No ID-block to insert keyframe in (Path = %s)", rna_path);
+		BKE_reportf(reports, RPT_ERROR, "No ID block to insert keyframe in (path = %s)", rna_path);
 		return 0;
 	}
 	
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
 		BKE_reportf(reports, RPT_ERROR,
-		            "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
-		            (id) ? id->name : "<Missing ID-Block>", rna_path);
+		            "Could not insert keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
+		            (id) ? id->name : TIP_("<Missing ID block>"), rna_path);
 		return 0;
 	}
 	
@@ -927,7 +930,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 		
 		if (act == NULL) {
 			BKE_reportf(reports, RPT_ERROR, 
-			            "Could not insert keyframe, as this type does not support animation data (ID = %s, Path = %s)",
+			            "Could not insert keyframe, as this type does not support animation data (ID = %s, path = %s)",
 			            id->name, rna_path);
 			return 0;
 		}
@@ -937,7 +940,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 	}
 	
 	/* key entire array convenience method */
-	if (array_index == -1) { 
+	if (array_index == -1) {
 		array_index = 0;
 		array_index_max = RNA_property_array_length(&ptr, prop);
 		
@@ -997,14 +1000,16 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 	
 	/* sanity checks */
 	if (ELEM(NULL, id, adt)) {
-		BKE_report(reports, RPT_ERROR, "No ID-Block and/Or AnimData to delete keyframe from");
+		BKE_report(reports, RPT_ERROR, "No ID block and/or AnimData to delete keyframe from");
 		return 0;
 	}
 	
 	/* validate pointer first - exit if failure */
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
-		BKE_reportf(reports, RPT_ERROR, "Could not delete keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)", id->name, rna_path);
+		BKE_reportf(reports, RPT_ERROR,
+		            "Could not delete keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
+		            id->name, rna_path);
 		return 0;
 	}
 	
@@ -1023,13 +1028,13 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 			cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
 		}
 		else {
-			BKE_reportf(reports, RPT_ERROR, "No Action to delete keyframes from for ID = %s\n", id->name);
+			BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s", id->name);
 			return 0;
 		}
 	}
 	
 	/* key entire array convenience method */
-	if (array_index == -1) { 
+	if (array_index == -1) {
 		array_index = 0;
 		array_index_max = RNA_property_array_length(&ptr, prop);
 		
@@ -1059,7 +1064,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
 		
 		/* try to find index of beztriple to get rid of */
 		i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
-		if (found) {			
+		if (found) {
 			/* delete the key at the index (will sanity check + do recalc afterwards) */
 			delete_fcurve_key(fcu, i, 1);
 			
@@ -1096,14 +1101,16 @@ static short clear_keyframe(ReportList *reports, ID *id, bAction *act, const cha
 
 	/* sanity checks */
 	if (ELEM(NULL, id, adt)) {
-		BKE_report(reports, RPT_ERROR, "No ID-Block and/Or AnimData to delete keyframe from");
+		BKE_report(reports, RPT_ERROR, "No ID block and/or AnimData to delete keyframe from");
 		return 0;
 	}
 
 	/* validate pointer first - exit if failure */
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
-		BKE_reportf(reports, RPT_ERROR, "Could not clear keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)", id->name, rna_path);
+		BKE_reportf(reports, RPT_ERROR,
+		            "Could not clear keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
+		            id->name, rna_path);
 		return 0;
 	}
 
@@ -1119,7 +1126,7 @@ static short clear_keyframe(ReportList *reports, ID *id, bAction *act, const cha
 			act = adt->action;
 		}
 		else {
-			BKE_reportf(reports, RPT_ERROR, "No Action to delete keyframes from for ID = %s\n", id->name);
+			BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s", id->name);
 			return 0;
 		}
 	}
@@ -1222,30 +1229,30 @@ static int insert_key_exec(bContext *C, wmOperator *op)
 		
 	/* report failures */
 	if (ks == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No active Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "No active keying set");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* try to insert keyframes for the channels specified by KeyingSet */
 	success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
 	if (G.debug & G_DEBUG)
-		BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes\n", ks->name, success);
+		BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes", ks->name, success);
 	
 	/* report failure or do updates? */
 	if (success == MODIFYKEY_INVALID_CONTEXT) {
-		BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
 		return OPERATOR_CANCELLED;
 	}
 	else if (success) {
 		/* if the appropriate properties have been set, make a note that we've inserted something */
 		if (RNA_boolean_get(op->ptr, "confirm_success"))
-			BKE_reportf(op->reports, RPT_INFO, "Successfully added %d Keyframes for KeyingSet '%s'", success, ks->name);
+			BKE_reportf(op->reports, RPT_INFO, "Successfully added %d keyframes for keying set '%s'", success, ks->name);
 		
 		/* send notifiers that keyframes have been changed */
 		WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
 	}
 	else
-		BKE_report(op->reports, RPT_WARNING, "Keying Set failed to insert any keyframes");
+		BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes");
 	
 	/* send updates */
 	DAG_ids_flush_update(bmain, 0);
@@ -1389,19 +1396,19 @@ static int delete_key_exec(bContext *C, wmOperator *op)
 	
 	/* report failure or do updates? */
 	if (success == MODIFYKEY_INVALID_CONTEXT) {
-		BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
 		return OPERATOR_CANCELLED;
 	}
 	else if (success) {
 		/* if the appropriate properties have been set, make a note that we've inserted something */
 		if (RNA_boolean_get(op->ptr, "confirm_success"))
-			BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d Keyframes for KeyingSet '%s'", success, ks->name);
+			BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d keyframes for keying set '%s'", success, ks->name);
 		
 		/* send notifiers that keyframes have been changed */
 		WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
 	}
 	else
-		BKE_report(op->reports, RPT_WARNING, "Keying Set failed to remove any keyframes");
+		BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes");
 	
 	/* send updates */
 	DAG_ids_flush_update(bmain, 0);
@@ -1626,7 +1633,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
 		else {
 			if (G.debug & G_DEBUG)
 				printf("Button Insert-Key: no path to property\n");
-			BKE_report(op->reports, RPT_WARNING, "Failed to resolve path to property. Try using a Keying Set instead");
+			BKE_report(op->reports, RPT_WARNING, "Failed to resolve path to property, try using a keying set instead");
 		}
 	}
 	else if (G.debug & G_DEBUG) {
@@ -1856,7 +1863,7 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
 		/* binarysearch_bezt_index will set replace to be 0 or 1
 		 * - obviously, 1 represents a match
 		 */
-		if (replace) {			
+		if (replace) {
 			/* sanity check: 'i' may in rare cases exceed arraylen */
 			if ((i >= 0) && (i < fcu->totvert))
 				return 1;
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 04fd7f6..28db7bf 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -161,11 +161,11 @@ static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
 	 *	- return error if it doesn't exist
 	 */
 	if (scene->active_keyingset == 0) {
-		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove");
+		BKE_report(op->reports, RPT_ERROR, "No active keying set to remove");
 		return OPERATOR_CANCELLED;
 	}
 	else if (scene->active_keyingset < 0) {
-		BKE_report(op->reports, RPT_ERROR, "Cannot remove built in Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "Cannot remove built in keying set");
 		return OPERATOR_CANCELLED;
 	}
 	else
@@ -209,7 +209,7 @@ static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
 	 *	- return error if it doesn't exist
 	 */
 	if (scene->active_keyingset == 0) {
-		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to add empty path to");
+		BKE_report(op->reports, RPT_ERROR, "No active keying set to add empty path to");
 		return OPERATOR_CANCELLED;
 	}
 	else
@@ -258,12 +258,12 @@ static int remove_active_ks_path_exec(bContext *C, wmOperator *op)
 			ks->active_path--;
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR, "No active Keying Set Path to remove");
+			BKE_report(op->reports, RPT_ERROR, "No active keying set path to remove");
 			return OPERATOR_CANCELLED;
 		}
 	}
 	else {
-		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove a path from");
+		BKE_report(op->reports, RPT_ERROR, "No active keying set to remove a path from");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -322,11 +322,12 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
 		scene->active_keyingset = BLI_countlist(&scene->keyingsets);
 	}
 	else if (scene->active_keyingset < 0) {
-		BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in keying set");
 		return OPERATOR_CANCELLED;
 	}
-	else
+	else {
 		ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
+	}
 	
 	/* try to add to keyingset using property retrieved from UI */
 	uiContextActiveProperty(C, &ptr, &prop, &index);
@@ -360,9 +361,10 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
 	if (success) {
 		/* send updates */
 		DAG_ids_flush_update(bmain, 0);
-		
-		/* for now, only send ND_KEYS for KeyingSets */
 		WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
+		
+		/* show notification/report header, so that users notice that something changed */
+		BKE_reportf(op->reports, RPT_INFO, "Property added to Keying Set: '%s'", ks->name);
 	}
 	
 	return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
@@ -377,7 +379,7 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
 	
 	/* callbacks */
 	ot->exec = add_keyingset_button_exec; 
-	//op->poll= ???
+	//op->poll = ???
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -404,15 +406,16 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
 	 *	- return error if it doesn't exist
 	 */
 	if (scene->active_keyingset == 0) {
-		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove property from");
+		BKE_report(op->reports, RPT_ERROR, "No active keying set to remove property from");
 		return OPERATOR_CANCELLED;
 	}
 	else if (scene->active_keyingset < 0) {
-		BKE_report(op->reports, RPT_ERROR, "Cannot remove property from built in Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "Cannot remove property from built in keying set");
 		return OPERATOR_CANCELLED;
 	}
-	else
+	else {
 		ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
+	}
 	
 	/* try to add to keyingset using property retrieved from UI */
 	uiContextActiveProperty(C, &ptr, &prop, &index);
@@ -425,7 +428,7 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
 			
 			/* try to find a path matching this description */
 			ksp = BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
-
+			
 			if (ksp) {
 				BKE_keyingset_free_path(ks, ksp);
 				success = 1;
@@ -440,9 +443,10 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
 	if (success) {
 		/* send updates */
 		DAG_ids_flush_update(bmain, 0);
-		
-		/* for now, only send ND_KEYS for KeyingSets */
 		WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
+		
+		/* show warning */
+		BKE_report(op->reports, RPT_INFO, "Property removed from Keying Set");
 	}
 	
 	return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
@@ -457,7 +461,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
 	
 	/* callbacks */
 	ot->exec = remove_keyingset_button_exec; 
-	//op->poll= ???
+	//op->poll = ???
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -891,11 +895,13 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
 				ksi->iter(ksi, C, ks);
 				
 			/* if we don't have any paths now, then this still qualifies as invalid context */
+			// FIXME: we need some error conditions (to be retrieved from the iterator why this failed!)
 			if (ks->paths.first == NULL)
 				return MODIFYKEY_INVALID_CONTEXT;
 		}
 		else {
 			/* poll callback tells us that KeyingSet is useless in current context */
+			// FIXME: the poll callback needs to give us more info why
 			return MODIFYKEY_INVALID_CONTEXT;
 		}
 	}
@@ -947,7 +953,7 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
 		/* skip path if no ID pointer is specified */
 		if (ksp->id == NULL) {
 			BKE_reportf(reports, RPT_WARNING,
-			            "Skipping path in Keying Set, as it has no ID (KS = '%s', Path = '%s'[%d])",
+			            "Skipping path in keying set, as it has no ID (KS = '%s', path = '%s[%d]')",
 			            ks->name, ksp->rna_path, ksp->array_index);
 			continue;
 		}
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index c19904d..7c5b75e 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -88,7 +88,7 @@ void ED_operatortypes_armature(void)
 	WM_operatortype_append(ARMATURE_OT_armature_layers);
 	WM_operatortype_append(ARMATURE_OT_bone_layers);
 
-	/* SKETCH */	
+	/* SKETCH */
 	WM_operatortype_append(SKETCH_OT_gesture);
 	WM_operatortype_append(SKETCH_OT_delete);
 	WM_operatortype_append(SKETCH_OT_draw_stroke);
@@ -221,7 +221,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	/* Already part of view3d select */
 	//WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
 
-	/* sketch poll checks mode */	
+	/* sketch poll checks mode */
 	WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
 	WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
 	kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ffdced3..e801d36 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -117,14 +117,14 @@ void ED_armature_sync_selection(ListBase *edbo)
 			else
 				ebo->flag &= ~BONE_SELECTED;
 		}
-	}				
+	}
 }
 
 void ED_armature_validate_active(struct bArmature *arm)
 {
 	EditBone *ebone = arm->act_edbone;
 
-	if (ebone) { 
+	if (ebone) {
 		if (ebone->flag & BONE_HIDDEN_A)
 			arm->act_edbone = NULL;
 	}
@@ -304,7 +304,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
 		eBone->ease2 = curBone->ease2;
 		eBone->rad_head = curBone->rad_head;
 		eBone->rad_tail = curBone->rad_tail;
-		eBone->segments = curBone->segments;		
+		eBone->segments = curBone->segments;
 		eBone->layer = curBone->layer;
 
 		if (curBone->prop)
@@ -654,7 +654,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
 	if (ob->type != OB_ARMATURE)
 		return OPERATOR_CANCELLED;
 	if (BKE_object_obdata_is_libdata(ob)) {
-		BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); //error_libdata();
+		BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); /* error_libdata(); */
 		return OPERATOR_CANCELLED;
 	}
 
@@ -666,7 +666,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
 		           "transforms stored are relative to the old rest pose");
 
 	/* Get editbones of active armature to alter */
-	ED_armature_to_edit(ob);	
+	ED_armature_to_edit(ob);
 	
 	/* get pose of active object and move it out of posemode */
 	pose = ob->pose;
@@ -897,7 +897,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
 			/* make tar armature be new parent */
 			ob->parent = tarArm;
 		}
-	}	
+	}
 }
 
 /* join armature exec is exported for use in object->join objects operator... */
@@ -1113,7 +1113,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
 				}
 			}
 		}
-	}	
+	}
 }
 
 /* Helper function for armature separating - remove certain bones from the given armature 
@@ -1440,7 +1440,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *ev
 	/* Select parents */
 	for (curBone = bone; curBone; curBone = next) {
 		/* ignore bone if cannot be selected */
-		if ((curBone->flag & BONE_UNSELECTABLE) == 0) { 
+		if ((curBone->flag & BONE_UNSELECTABLE) == 0) {
 			// XXX old cruft! use notifiers instead
 			//select_actionchannel_by_name (ob->action, curBone->name, !(shift));
 			
@@ -1493,7 +1493,7 @@ void POSE_OT_select_linked(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
-	/* props */	
+	/* props */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
 }
 
@@ -1550,7 +1550,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
 					bone = curBone;
 					break;
 				}
-				else { 
+				else {
 					bone = NULL;
 					break;
 				}
@@ -2099,7 +2099,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 			}
 
 			sub_v3_v3v3(nor, ebone->tail, ebone->head);
-			vec_roll_to_mat3(nor, ebone->roll, mat);			
+			vec_roll_to_mat3(nor, ebone->roll, mat);
 			copy_v3_v3(vec, mat[2]);
 		}
 		else { /* Axis */
@@ -2687,7 +2687,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
 				updateDuplicateSubtarget(eBone, arm->edbo, obedit);
 			}
 		}
-	} 
+	}
 	
 	/* correct the active bone */
 	if (arm->act_edbone) {
@@ -2802,7 +2802,7 @@ static void fill_add_joint(EditBone *ebo, short eb_tail, ListBase *points)
 	}
 	
 	for (ebp = points->first; ebp; ebp = ebp->next) {
-		if (equals_v3v3(ebp->vec, vec)) {			
+		if (equals_v3v3(ebp->vec, vec)) {
 			if (eb_tail) {
 				if ((ebp->head_owner) && (ebp->head_owner->parent == ebo)) {
 					/* so this bone's tail owner is this bone */
@@ -2886,7 +2886,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
 		mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d));
 		
 		/* Create a bone */
-		/* newbone= */ add_points_bone(obedit, ebp->vec, curs);
+		/* newbone = */ add_points_bone(obedit, ebp->vec, curs);
 	}
 	else if (count == 2) {
 		EditBonePoint *ebp, *ebp2;
@@ -2969,8 +2969,8 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
 		}
 	}
 	else {
-		// FIXME.. figure out a method for multiple bones
-		BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d\n", count);
+		/* FIXME.. figure out a method for multiple bones */
+		BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d", count);
 		BLI_freelistN(&points);
 		return OPERATOR_CANCELLED;
 	}
@@ -3150,7 +3150,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op)
 			
 			/* put back link */
 			BLI_insertlinkbefore(&chains, nchain, chain);
-		}		
+		}
 		
 		armature_tag_unselect(arm);
 		
@@ -3301,7 +3301,9 @@ static void hide_unselected_armature_bones(Scene *scene)
 	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
 		bArmature *arm = obedit->data;
 		if (EBONE_VISIBLE(arm, ebone)) {
-			if (ebone->flag & (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL)) ;
+			if (ebone->flag & (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL)) {
+				/* pass */
+			}
 			else {
 				ebone->flag |= BONE_HIDDEN_A;
 			}
@@ -3457,7 +3459,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
 			
 			/* Deselect the old bone */
 			ebone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
-		}		
+		}
 	}
 	/* if only one bone, make this one active */
 	if (totbone == 1 && first) arm->act_edbone = first;
@@ -3567,16 +3569,16 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
 	Object *obedit = CTX_data_edit_object(C);
 	bArmature *arm = obedit->data;
 	EditBone *newbone, *tbone;
-	int numcuts, i;
+	int cuts, i;
 	
 	/* there may not be a number_cuts property defined (for 'simple' subdivide) */
-	numcuts = RNA_int_get(op->ptr, "number_cuts");
+	cuts = RNA_int_get(op->ptr, "number_cuts");
 	
 	/* loop over all editable bones */
 	// XXX the old code did this in reverse order though!
 	CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
 	{
-		for (i = numcuts + 1; i > 1; i--) {
+		for (i = cuts + 1; i > 1; i--) {
 			/* compute cut ratio first */
 			float cutratio = 1.0f / (float)i;
 			float cutratioI = 1.0f - cutratio;
@@ -3681,7 +3683,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 			parent = ebo->parent;
 			
 			/* only if selected and editable */
-			if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {				
+			if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
 				/* swap head and tail coordinates */
 				SWAP(float, ebo->head[0], ebo->tail[0]);
 				SWAP(float, ebo->head[1], ebo->tail[1]);
@@ -3721,7 +3723,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	
 	/* free chains */
-	BLI_freelistN(&chains);	
+	BLI_freelistN(&chains);
 
 	armature_tag_unselect(arm);
 
@@ -3778,7 +3780,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
 		}
 	}
 	
-	if (mode == ARM_PAR_CONNECT) {	
+	if (mode == ARM_PAR_CONNECT) {
 		/* Connected: Child bones will be moved to the parent tip */
 		selbone->flag |= BONE_CONNECTED;
 		sub_v3_v3v3(offset, actbone->tail, selbone->head);
@@ -3823,7 +3825,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
 	
 	/* there must be an active bone */
 	if (actbone == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Bone");
+		BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
 		return OPERATOR_CANCELLED;
 	}
 	else if (arm->flag & ARM_MIRROR_EDIT) {
@@ -3893,7 +3895,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
 	{
 		if (ebone != actbone) {
 			if (ebone->parent != actbone) allchildbones = 1;
-		}	
+		}
 	}
 	CTX_DATA_END;
 
@@ -3901,7 +3903,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
 	
 	/* ob becomes parent, make the associated menus */
 	if (allchildbones)
-		uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET);	
+		uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET);
 		
 	uiPupMenuEnd(C, pup);
 	
@@ -3994,7 +3996,7 @@ static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 			ebone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 		}
 	}
-	CTX_DATA_END;	
+	CTX_DATA_END;
 
 	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
 	
@@ -4055,7 +4057,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
 			}
 		}
 	}
-	CTX_DATA_END;	
+	CTX_DATA_END;
 
 	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
 	
@@ -4217,7 +4219,7 @@ static int armature_select_similar_exec(bContext *C, wmOperator *op)
 
 	/* Check for active bone */
 	if (ebone_act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Bone");
+		BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -4295,7 +4297,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
 						break;
 					}
 					
-				} 
+				}
 				else { // BONE_SELECT_CHILD
 					chbone = editbone_get_child(arm, curbone, 1);
 					if (chbone == NULL) continue;
@@ -4409,7 +4411,7 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
 	
 	/* there must be an active bone */
 	if (actbone == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Bone");
+		BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
 		return OPERATOR_CANCELLED;
 	}
 	else if (arm->flag & ARM_MIRROR_EDIT) {
@@ -4566,7 +4568,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
 					nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 					arm->act_bone = nearBone;
 				}
-			}	
+			}
 		}
 		
 		if (ob_act) {
@@ -5118,7 +5120,7 @@ static void pchan_clear_rot(bPoseChannel *pchan)
 			}
 		}
 	}       /* Duplicated in source/blender/editors/object/object_transform.c */
-	else { 
+	else {
 		if (pchan->rotmode == ROT_MODE_QUAT) {
 			unit_qt(pchan->quat);
 		}
@@ -5152,7 +5154,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
 	
 	/* sanity checks */
 	if (ELEM(NULL, clear_func, default_ksName)) {
-		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform func or Keying Set Name");
+		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform function or keying set name");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -5544,7 +5546,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldnam
 			
 			if (cti->flush_constraint_targets)
 				cti->flush_constraint_targets(curcon, &targets, 0);
-		}	
+		}
 	}
 }
 
@@ -5631,7 +5633,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
 				}
 			}
 			
-			if (modifiers_usesArmature(ob, arm)) { 
+			if (modifiers_usesArmature(ob, arm)) {
 				bDeformGroup *dg = defgroup_find_name(ob, oldname);
 				if (dg) {
 					BLI_strncpy(dg->name, newname, MAXBONENAME);
@@ -5959,7 +5961,7 @@ float arcLengthRatio(ReebArc *arc)
 		embedLength = arcLength;
 	}
 	
-	return embedLength / arcLength;	
+	return embedLength / arcLength;
 }
 
 EditBone *test_subdivideByLength(Scene *scene, Object *obedit, ReebArc *arc, ReebNode *head, ReebNode *tail)
@@ -6060,7 +6062,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 			arc->flag = 1; /* mark arc direction */
 		}
 		
-		/* Loop over subdivision methods */	
+		/* Loop over subdivision methods */
 		for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) {
 			switch (scene->toolsettings->skgen_subdivisions[i]) {
 				case SKGEN_SUB_LENGTH:
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 23dd3b1..d9c7e78 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -55,7 +55,7 @@ void setBoneRollFromNormal(EditBone *bone, const float no[3], float UNUSED(invma
 	if (no != NULL && !is_zero_v3(no)) {
 		float normal[3];
 
-		copy_v3_v3(normal, no);	
+		copy_v3_v3(normal, no);
 		mul_m3_v3(tmat, normal);
 		
 		bone->roll = ED_rollBoneToVector(bone, normal, FALSE);
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index fad06f0..68cfc7f 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -191,7 +191,7 @@ static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4]
 		
 		if (previous->bone) {
 			sub_v3_v3v3(vec_first, previous->bone->tail, previous->bone->head);
-		} 
+		}
 		else if (previous->prev->bone) {
 			sub_v3_v3v3(vec_first, edge->bone->head, previous->prev->bone->tail);
 		}
@@ -653,7 +653,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
 		
 		sub_v3_v3v3(offset, ctrl->bone->head, link->head);
 
-		/* if root matches, check for direction too */		
+		/* if root matches, check for direction too */
 		if (dot_v3v3(offset, offset) < 0.0001f) {
 			float vbone[3], vparent[3];
 			
@@ -802,7 +802,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
 			}
 		}
 		
-		/* if not found yet, check child */		
+		/* if not found yet, check child */
 		if (found == 0) {
 			RigArc *arc;
 			RigArc *best_arc = NULL;
@@ -863,7 +863,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
 									/* SET bone link to ctrl corresponding to pchan */
 									RigControl *link = BLI_ghash_lookup(rg->controls_map, pchan->name);
 
-									/* if owner is a control bone, link with it */									
+									/* if owner is a control bone, link with it */
 									if (link && link->link) {
 										RIG_parentControl(ctrl, link->bone);
 										found = 1;
@@ -876,7 +876,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
 								cti->flush_constraint_targets(con, &targets, 0);
 						}
 					}
-				}			
+				}
 
 				if (found == 0) {
 					/* check if parent is already linked */
@@ -1319,12 +1319,12 @@ void RIG_printArc(RigGraph *rg, RigArc *arc)
 	for (edge = arc->edges.first; edge; edge = edge->next) {
 		printf("\tinner joints %0.3f %0.3f %0.3f\n", edge->tail[0], edge->tail[1], edge->tail[2]);
 		printf("\t\tlength %f\n", edge->length);
-		printf("\t\tangle %f\n", edge->angle * 180 / M_PI);
+		printf("\t\tangle %f\n", edge->angle * (float)(180 / M_PI));
 		if (edge->bone) {
 			printf("\t\t%s\n", edge->bone->name);
 			RIG_printLinkedCtrl(rg, edge->bone, 3);
 		}
-	}	
+	}
 	printf("symmetry level: %i flag: %i group %i\n", arc->symmetry_level, arc->symmetry_flag, arc->symmetry_group);
 
 	RIG_printNode((RigNode *)arc->tail, "tail");
@@ -1336,7 +1336,7 @@ void RIG_printGraph(RigGraph *rg)
 
 	printf("---- ARCS ----\n");
 	for (arc = rg->arcs.first; arc; arc = arc->next) {
-		RIG_printArc(rg, arc);	
+		RIG_printArc(rg, arc);
 		printf("\n");
 	}
 
@@ -1345,7 +1345,7 @@ void RIG_printGraph(RigGraph *rg)
 	}
 	else {
 		printf("HEAD NODE: NONE\n");
-	}	
+	}
 }
 
 /*******************************************************************************************************/
@@ -1584,7 +1584,7 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
 				repositionTailControl(rigg, ctrl_child);
 			}
 		}
-	}	
+	}
 }
 
 static void repositionTailControl(RigGraph *rigg, RigControl *ctrl)
@@ -1840,7 +1840,7 @@ static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_
 	length2 = normalize_v3(vec_second);
 
 
-	/* Angle cost */	
+	/* Angle cost */
 	if (edge->prev) {
 		sub_v3_v3v3(vec_first, vec1, vec0); 
 		normalize_v3(vec_first);
@@ -1962,7 +1962,6 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
 	ReebArcIterator arc_iter;
 	BArcIterator *iter = (BArcIterator *)&arc_iter;
 	RigEdge *edge;
-	EmbedBucket *bucket = NULL;
 	ReebNode *node_start, *node_end;
 	ReebArc *earc = iarc->link_mesh;
 	float angle_weight = 1.0; // GET FROM CONTEXT
@@ -1996,8 +1995,6 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
 
 	/* equal number of joints and potential position, just fill them in */
 	if (nb_joints == earc->bcount) {
-		int i;
-		
 		/* init with first values */
 		for (i = 0; i < nb_joints; i++) {
 			best_positions[i] = i + 1;
@@ -2011,7 +2008,6 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
 		MemoNode *result;
 #endif
 		float **positions_cache = MEM_callocN(sizeof(float *) * (nb_positions + 2), "positions cache");
-		int i;
 		
 		positions_cache[0] = node_start->p;
 		positions_cache[nb_positions + 1] = node_end->p;
@@ -2053,7 +2049,7 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
 	{
 		float *no = NULL;
 		if (i < nb_joints) {
-			bucket = IT_peek(iter, best_positions[i]);
+			EmbedBucket *bucket = IT_peek(iter, best_positions[i]);
 			vec1 = bucket->p;
 			no = bucket->no;
 		}
@@ -2139,7 +2135,7 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
 			no = node_end->no;
 		}
 
-		/* no need to move virtual edges (space between unconnected bones) */		
+		/* no need to move virtual edges (space between unconnected bones) */
 		if (edge->bone) {
 			repositionBone(C, rigg, edge, vec0, vec1, no);
 		}
@@ -2177,7 +2173,7 @@ void *exec_retargetArctoArc(void *param)
 	RetargetParam *p = (RetargetParam *)param;
 	RigGraph *rigg = p->rigg;
 	RigArc *iarc = p->iarc;
-	bContext *C = p->context;	
+	bContext *C = p->context;
 	RigNode *inode_start = p->inode_start;
 	ReebArc *earc = iarc->link_mesh;
 	
@@ -2226,7 +2222,7 @@ static void matchMultiResolutionNode(RigGraph *rigg, RigNode *inode, ReebNode *t
 		enode = enode->link_down;
 		reebg = BIF_graphForMultiNode(rigg->link_mesh, enode); /* replace with call to link_down once that exists */
 		eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, NULL, 0) % SHAPE_LEVELS;
-	} 
+	}
 }
 
 static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
@@ -2277,7 +2273,7 @@ static void matchMultiResolutionArc(RigGraph *rigg, RigNode *start_node, RigArc
 		reebg = reebg->link_up;
 		enode = next_earc->head;
 		eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, (BArc *)next_earc, 1) % SHAPE_LEVELS;
-	} 
+	}
 
 	next_earc->flag = ARC_USED;
 	next_iarc->link_mesh = next_earc;
@@ -2307,7 +2303,7 @@ static void matchMultiResolutionStartingNode(RigGraph *rigg, ReebGraph *reebg, R
 		enode = reebg->nodes.first;
 		
 		eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, NULL, 0) % SHAPE_LEVELS;
-	} 
+	}
 
 	inode->link_mesh = enode;
 }
@@ -2604,7 +2600,7 @@ void BIF_retargetArmature(bContext *C)
 	
 	ED_undo_push(C, "Retarget Skeleton");
 
-	// XXX	
+	// XXX
 //	allqueue(REDRAWVIEW3D, 0);
 }
 
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 68d8a8d..f9cf4a2 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -440,7 +440,7 @@ static void sk_cancelStroke(SK_Sketch *sketch)
 
 static float sk_clampPointSize(SK_Point *pt, float size)
 {
-	return MAX2(size * pt->size, size / 2);
+	return max_ff(size * pt->size, size / 2);
 }
 
 static void sk_drawPoint(GLUquadric *quad, SK_Point *pt, float size)
@@ -2104,15 +2104,15 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
 	if (sketch->depth_peels.first != NULL)
 	{
 		float colors[8][3] = {
-								{1, 0, 0},
-								{0, 1, 0},
-								{0, 0, 1},
-								{1, 1, 0},
-								{1, 0, 1},
-								{0, 1, 1},
-								{1, 1, 1},
-								{0, 0, 0}
-							};
+			{1, 0, 0},
+			{0, 1, 0},
+			{0, 0, 1},
+			{1, 1, 0},
+			{1, 0, 1},
+			{0, 1, 1},
+			{1, 1, 1},
+			{0, 0, 0}
+		};
 		DepthPeel *p;
 		GLUquadric *quad = gluNewQuadric();
 		gluQuadricNormals(quad, GLU_SMOOTH);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index e7efd79..9152ea8 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -53,7 +53,6 @@
 #include "BKE_modifier.h"
 #include "BKE_mesh.h"
 
-
 #ifdef RIGID_DEFORM
 #include "BLI_polardecomp.h"
 #endif
@@ -563,7 +562,7 @@ static void heat_set_H(LaplacianSystem *sys, int vertex)
 
 	/* compute H entry */
 	if (numclosest > 0) {
-		mindist = maxf(mindist, 1e-4f);
+		mindist = max_ff(mindist, 1e-4f);
 		h = numclosest * C_WEIGHT / (mindist * mindist);
 	}
 	else
@@ -794,7 +793,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 			}
 		}
 		else if (*err_str == NULL) {
-			*err_str = "Bone Heat Weighting: failed to find solution for one or more bones";
+			*err_str = N_("Bone Heat Weighting: failed to find solution for one or more bones");
 			break;
 		}
 
@@ -1195,7 +1194,7 @@ static int meshdeform_tri_intersect(const float orig[3], const float end[3], con
 }
 
 static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
- {
+{
 	void **data = userdata;
 	MeshDeformBind *mdb = data[1];
 	MFace *mface = data[0], *mf;
@@ -1210,7 +1209,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
 	if (mf->v4)
 		copy_v3_v3(face[3], mdb->cagecos[mf->v4]);
 	
- 	add_v3_v3v3(end, isec->start, isec->vec);
+	add_v3_v3v3(end, isec->start, isec->vec);
 	
 	if (!meshdeform_tri_intersect(ray->origin, end, face[0], face[1], face[2], co, uvw)) 
 		if (!mf->v4 || !meshdeform_tri_intersect(ray->origin, end, face[0], face[2], face[3], co, uvw))
@@ -1221,13 +1220,13 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
 	else
 		normal_quad_v3(no, face[0], face[1], face[2], face[3]);
 	
-	dist = len_v3v3(ray->origin, co)/len_v3(isec->vec);
+	dist = len_v3v3(ray->origin, co) / len_v3(isec->vec);
 	if (dist < hit->dist) {
 		hit->index = index;
 		hit->dist = dist;
 		copy_v3_v3(hit->co, co);
 		
-		isec->isect = dot_v3v3(no, ray->direction) <= 0.0;
+		isec->isect = (dot_v3v3(no, ray->direction) <= 0.0f);
 		isec->labda = dist;
 		isec->face = mf;
 	}
@@ -1257,7 +1256,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
 	if (BLI_bvhtree_ray_cast(mdb->bvhtree, isect_mdef.start, isect_mdef.vec,
 	                         0.0, &hit, harmonic_ray_callback, data) != -1)
 	{
- 		len= isect_mdef.labda;
+		len = isect_mdef.labda;
 		isect_mdef.face = mface = mface1 + hit.index;
 
 		/* create MDefBoundIsect */
@@ -1722,7 +1721,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 			}
 		}
 		else {
-			modifier_setError(&mmd->modifier, "%s", TIP_("Failed to find bind solution (increase precision?)."));
+			modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?)");
 			error("Mesh Deform: failed to find bind solution.");
 			break;
 		}
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 3139894..3fd65de 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -105,7 +105,7 @@ typedef struct tPoseSlideOp {
 	int nextFrame;      /* frame after current frame (blend-to) */
 	
 	int mode;           /* sliding mode (ePoseSlide_Modes) */
-	int flag;           // unused for now, but can later get used for storing runtime settings....
+	int flag;           /* unused for now, but can later get used for storing runtime settings.... */
 	
 	float percentage;   /* 0-1 value for determining the influence of whatever is relevant */
 } tPoseSlideOp;
@@ -486,7 +486,7 @@ static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
 				pose_slide_apply_vec3(pso, pfl, pchan->eul, "rotation_euler");
 			}
 			else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
-				// TODO: need to figure out how to do this!
+				/* TODO: need to figure out how to do this! */
 			}
 			else {
 				/* quaternions - use quaternion blending */
@@ -538,7 +538,7 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
 			break;
 		
 		default:
-			// unknown
+			/* unknown */
 			strcpy(mode_str, "Sliding-Tool");
 			break;
 	}
@@ -606,7 +606,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p
 	}
 	
 	/* initial apply for operator... */
-	// TODO: need to calculate percentage for initial round too...
+	/* TODO: need to calculate percentage for initial round too... */
 	pose_slide_apply(C, pso);
 	
 	/* depsgraph updates + redraws */
@@ -1152,7 +1152,7 @@ static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu,
 		}
 		
 		/* just flatten handles, since values will now be the same either side... */
-		// TODO: perhaps a fade-out modulation of the value is required here (optional once again)?
+		/* TODO: perhaps a fade-out modulation of the value is required here (optional once again)? */
 		bezt->vec[0][1] = bezt->vec[1][1] = bezt->vec[2][1] = refVal;
 		
 		/* select keyframe to indicate that it's been changed */
@@ -1247,13 +1247,13 @@ void POSE_OT_propagate(wmOperatorType *ot)
 	
 	/* callbacks */
 	ot->exec = pose_propagate_exec;
-	ot->poll = ED_operator_posemode; // XXX: needs selected bones!
+	ot->poll = ED_operator_posemode;  /* XXX: needs selected bones! */
 	
 	/* flag */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	// TODO: add "fade out" control for tapering off amount of propagation as time goes by?
+	/* TODO: add "fade out" control for tapering off amount of propagation as time goes by? */
 	ot->prop = RNA_def_enum(ot->srna, "mode", terminate_items, POSE_PROPAGATE_SMART_HOLDS, "Terminate Mode", "Method used to determine when to stop propagating pose to keyframes");
 	RNA_def_float(ot->srna, "end_frame", 250.0, FLT_MIN, FLT_MAX, "End Frame", "Frame to stop propagating frames to (for 'Before Frame' mode)", 1.0, 250.0);
 }
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index e2e3c49..f3c3239 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -274,7 +274,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con
 		/* check if paths match */
 		if (strcmp(path, fcu->rna_path) == 0)
 			return ld;
-	}	
+	}
 	
 	/* none found */
 	return NULL;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index eea7424..ae3d496 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -298,7 +298,7 @@ static int poselib_sanitize_exec(bContext *C, wmOperator *op)
 	
 	/* validate action */
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_WARNING, "No Action to validate");
+		BKE_report(op->reports, RPT_WARNING, "No action to validate");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -547,7 +547,7 @@ static int poselib_remove_exec(bContext *C, wmOperator *op)
 
 	/* check if valid poselib */
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
+		BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -562,7 +562,7 @@ static int poselib_remove_exec(bContext *C, wmOperator *op)
 	/* get index (and pointer) of pose to remove */
 	marker = BLI_findlink(&act->markers, marker_index);
 	if (marker == NULL) {
-		BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", marker_index);
+		BKE_reportf(op->reports, RPT_ERROR, "Invalid pose specified %d", marker_index);
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -628,14 +628,14 @@ static int poselib_rename_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 	
 	/* check if valid poselib */
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
+		BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* get index (and pointer) of pose to remove */
 	marker = BLI_findlink(&act->markers, act->active_marker - 1);
 	if (marker == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
+		BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -657,14 +657,14 @@ static int poselib_rename_exec(bContext *C, wmOperator *op)
 	
 	/* check if valid poselib */
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
+		BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* get index (and pointer) of pose to remove */
 	marker = BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose"));
 	if (marker == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
+		BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -871,7 +871,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld)
 	if (pld->marker)
 		frame = pld->marker->frame;
 	else
-		return;	
+		return;
 	
 	
 	/* init settings for testing groups for keyframes */
@@ -887,7 +887,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld)
 			/* has keyframe on this frame, so try to get a PoseChannel with this name */
 			pchan = BKE_pose_channel_find_name(pose, agrp->name);
 			
-			if (pchan) {	
+			if (pchan) {
 				short ok = 0;
 				
 				/* check if this bone should get any animation applied */
@@ -1079,7 +1079,7 @@ static void poselib_preview_get_next(tPoseLib_PreviewData *pld, int step)
 		}
 		
 		/* check if any matches */
-		if (pld->searchp.first == NULL) { 
+		if (pld->searchp.first == NULL) {
 			pld->marker = NULL;
 			return;
 		}
@@ -1152,7 +1152,7 @@ static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, unsigned sh
 				poselib_preview_get_next(pld, 1);
 				pld->redraw = PL_PREVIEW_REDRAWALL;
 				return;
-			}	
+			}
 			break;
 			
 		case DELKEY:
@@ -1424,12 +1424,12 @@ static void poselib_preview_init_data(bContext *C, wmOperator *op)
 	
 	/* check if valid poselib */
 	if (ELEM3(NULL, pld->ob, pld->pose, pld->arm)) {
-		BKE_report(op->reports, RPT_ERROR, "PoseLib is only for Armatures in PoseMode");
+		BKE_report(op->reports, RPT_ERROR, "Pose lib is only for armatures in pose mode");
 		pld->state = PL_PREVIEW_ERROR;
 		return;
 	}
 	if (pld->act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Object doesn't have a valid PoseLib");
+		BKE_report(op->reports, RPT_ERROR, "Object does not have a valid pose lib");
 		pld->state = PL_PREVIEW_ERROR;
 		return;
 	}
@@ -1438,10 +1438,10 @@ static void poselib_preview_init_data(bContext *C, wmOperator *op)
 			/* just use first one then... */
 			pld->marker = pld->act->markers.first;
 			if (pose_index > -2) 
-				BKE_report(op->reports, RPT_WARNING, "PoseLib had no active pose");
+				BKE_report(op->reports, RPT_WARNING, "Pose lib had no active pose");
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR, "PoseLib has no poses to preview/apply");
+			BKE_report(op->reports, RPT_ERROR, "Pose lib has no poses to preview/apply");
 			pld->state = PL_PREVIEW_ERROR;
 			return;
 		}
@@ -1639,7 +1639,7 @@ void POSELIB_OT_browse_interactive(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 	
-	/* properties */	
+	/* properties */
 	// TODO: make the pose_index into a proper enum instead of a cryptic int...
 	ot->prop = RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
 	
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 189b2e9..576e598 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -105,7 +105,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
 	Object *ob = base->object;
 	
 	if (ob->id.lib) {
-		BKE_report(reports, RPT_WARNING, "Can't pose libdata");
+		BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
 		return;
 	}
 	
@@ -134,7 +134,7 @@ void ED_armature_exit_posemode(bContext *C, Base *base)
 		ob->mode &= ~OB_MODE_POSE;
 		
 		WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
-	}	
+	}
 }
 
 /* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */
@@ -500,7 +500,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
 						found = 1;
 						break;
 					}
-				} 
+				}
 				else { /* direction == BONE_SELECT_CHILD */
 					/* the child member is only assigned to connected bones, see [#30340] */
 #if 0
@@ -992,7 +992,7 @@ static void pose_copy_menu(Scene *scene)
 				}
 			}
 		}
-	} 
+	}
 	else { /* constraints, optional (note: max we can have is 24 constraints) */
 		bConstraint *con, *con_back;
 		int const_toggle[24] = {0}; /* XXX, initialize as 0 to quiet errors */
@@ -1018,7 +1018,7 @@ static void pose_copy_menu(Scene *scene)
 				con_back = con->next;
 				BLI_freelinkN(&const_copy, con);
 				con = con_back;
-			} 
+			}
 			else
 				con = con->next;
 		}
@@ -1035,7 +1035,7 @@ static void pose_copy_menu(Scene *scene)
 				 * appending to list of constraints for this channel
 				 */
 				copy_constraints(&tmp_constraints, &const_copy, TRUE);
-				if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {					
+				if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
 					/* add proxy-local tags */
 					for (con = tmp_constraints.first; con; con = con->next)
 						con->flag |= CONSTRAINT_PROXY_LOCAL;
@@ -1097,7 +1097,7 @@ static void set_pose_keys(Object *ob)
 		for (chan = ob->pose->chanbase.first; chan; chan = chan->next) {
 			Bone *bone = chan->bone;
 			if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer))
-				chan->flag |= POSE_KEY;	
+				chan->flag |= POSE_KEY;
 			else
 				chan->flag &= ~POSE_KEY;
 		}
@@ -1236,7 +1236,7 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
 	
 	/* sanity checking */
 	if (ELEM(NULL, ob, ob->pose)) {
-		BKE_report(op->reports, RPT_ERROR, "No Pose to Copy");
+		BKE_report(op->reports, RPT_ERROR, "No pose to copy");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1399,7 +1399,7 @@ void POSE_OT_group_remove(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Remove Bone Group";
 	ot->idname = "POSE_OT_group_remove";
-	ot->description = "Removes the active bone group";
+	ot->description = "Remove the active bone group";
 	
 	/* api callbacks */
 	ot->exec = pose_group_remove_exec;
@@ -1511,7 +1511,7 @@ void POSE_OT_group_assign(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_int(ot->srna, "type", 0, 0, 10, "Bone Group Index", "", 0, INT_MAX);
+	RNA_def_int(ot->srna, "type", 0, 0, INT_MAX, "Bone Group Index", "", 0, 10);
 }
 
 
@@ -1916,7 +1916,7 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
 	Object *ob = CTX_data_active_object(C);
 	int mode = RNA_enum_get(op->ptr, "type");
 	
-	/* set rotation mode of selected bones  */	
+	/* set rotation mode of selected bones  */
 	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
 	{
 		pchan->rotmode = mode;
@@ -2100,7 +2100,7 @@ static int pose_bone_layers_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 {
 	int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 	
-	/* get layers that are active already */	
+	/* get layers that are active already */
 	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
 	{
 		short bit;
@@ -2299,10 +2299,10 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op)
 		 * just pose values should change, so this should be fine 
 		 */
 		bPose *dummyPose = NULL;
-		Object workob = {{0}}; 
+		Object workob = {{0}};
 		bPoseChannel *pchan;
 		
-		/* execute animation step for current frame using a dummy copy of the pose */		
+		/* execute animation step for current frame using a dummy copy of the pose */
 		BKE_pose_copy_data(&dummyPose, ob->pose, 0);
 		
 		BLI_strncpy(workob.id.name, "OB<ClearTfmWorkOb>", sizeof(workob.id.name));
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 00f88a6..b1bf13d 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -340,7 +340,7 @@ static ReebArc *copyArc(ReebGraph *rg, ReebArc *arc)
 	cp_arc->edges.first = NULL;
 	cp_arc->edges.last = NULL;
 
-	/* copy buckets */	
+	/* copy buckets */
 	cp_arc->buckets = MEM_callocN(sizeof(EmbedBucket) * cp_arc->bcount, "embed bucket");
 	memcpy(cp_arc->buckets, arc->buckets, sizeof(EmbedBucket) * cp_arc->bcount);
 	
@@ -377,7 +377,7 @@ static ReebGraph *copyReebGraph(ReebGraph *rg, int level)
 	cp_rg->link_up = rg;
 	cp_rg->multi_level = level;
 
-	/* Copy nodes */	
+	/* Copy nodes */
 	for (node = rg->nodes.first; node; node = node->next)
 	{
 		ReebNode *cp_node = copyNode(cp_rg, node);
@@ -889,7 +889,7 @@ static void calculateArcLength(ReebArc *arc)
 		vec0 = vec1;
 	}
 	
-	arc->length += len_v3v3(arc->tail->p, vec1);	
+	arc->length += len_v3v3(arc->tail->p, vec1);
 }
 
 static void calculateGraphLength(ReebGraph *rg)
@@ -948,7 +948,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count)
 			bucket1 = IT_next(iter1);
 			bucket2 = IT_next(iter2);
 		
-			/* Make sure they both start at the same value */	
+			/* Make sure they both start at the same value */
 			while (bucket1 && bucket2 && bucket1->val < bucket2->val) {
 				bucket1 = IT_next(iter1);
 			}
@@ -1005,7 +1005,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count)
 			bucket1 = IT_next(iter1);
 			bucket2 = IT_next(iter2);
 		
-			/* Make sure they both start at the same value */	
+			/* Make sure they both start at the same value */
 			while (bucket1 && bucket1->val < bucket2->val) {
 				bucket1 = IT_next(iter1);
 			}
@@ -1016,7 +1016,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count)
 	
 	
 			for (; bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
-				/* copy and mirror back to bucket2 */			
+				/* copy and mirror back to bucket2 */
 				bucket2->nv = bucket1->nv;
 				copy_v3_v3(bucket2->p, bucket1->p);
 				BLI_mirrorAlongAxis(bucket2->p, node->p, normal);
@@ -1062,7 +1062,7 @@ void REEB_AxialSymmetry(BNode *root_node, BNode *node1, BNode *node2, struct BAr
 		bucket1 = IT_next(iter1);
 		bucket2 = IT_next(iter2);
 	
-		/* Make sure they both start at the same value */	
+		/* Make sure they both start at the same value */
 		while (bucket1 && bucket1->val < bucket2->val) {
 			bucket1 = IT_next(iter1);
 		}
@@ -1080,7 +1080,7 @@ void REEB_AxialSymmetry(BNode *root_node, BNode *node1, BNode *node2, struct BAr
 			/* add bucket2 in bucket1 */
 			interp_v3_v3v3(bucket1->p, bucket1->p, bucket2->p, (float)bucket2->nv / (float)(bucket1->nv));
 
-			/* copy and mirror back to bucket2 */			
+			/* copy and mirror back to bucket2 */
 			bucket2->nv = bucket1->nv;
 			copy_v3_v3(bucket2->p, bucket1->p);
 			BLI_mirrorAlongAxis(bucket2->p, root_node->p, nor);
@@ -1212,7 +1212,7 @@ static void reweightArc(ReebGraph *rg, ReebArc *arc, ReebNode *start_node, float
 		reweightArc(rg, next_arc, node, end_weight);
 	}
 
-	/* update only if needed */	
+	/* update only if needed */
 	if (arc->head->weight != start_weight || arc->tail->weight != end_weight)
 	{
 		old_weight = arc->head->weight; /* backup head weight, other arcs need it intact, it will be fixed by the source arc */
@@ -1318,7 +1318,7 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs)
 			}
 			
 			joined = 1;
-		}		
+		}
 	}
 	
 	return joined;
@@ -1450,7 +1450,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
 				arc->tail = newNode;
 			}
 
-			// Remove looped arcs			
+			// Remove looped arcs
 			if (arc->head == arc->tail) {
 				// v1 or v2 was already newNode, since we're removing an arc, decrement degree
 				NodeDegreeDecrement(rg, newNode);
@@ -1648,7 +1648,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
 	BLI_sortlist(&rg->arcs, compareArcs);
 
 #ifdef DEBUG_REEB
-	{	
+	{
 		EditFace *efa;
 		for (efa = G.editMesh->faces.first; efa; efa = efa->next) {
 			efa->tmp.fp = -1;
@@ -1731,7 +1731,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
 				efa->tmp.fp = saacos(fabs(angle));
 #endif
 #else
-				add_v3_v3(avg_vec, efa->n);		
+				add_v3_v3(avg_vec, efa->n);
 #endif
 			}
 
@@ -1873,7 +1873,7 @@ static int compareVerts(const void *a, const void *b)
 		value = 1;
 	}
 
-	return value;		
+	return value;
 }
 
 static void spreadWeight(EditMesh *em)
@@ -1947,7 +1947,7 @@ void REEB_exportGraph(ReebGraph *rg, int count)
 		
 		fprintf(f, "angle %0.3f %0.3f %0.3f %0.3f %i\n", p[0], p[1], p[2], arc->angle, BLI_ghash_size(arc->faces));
 		exportNode(f, "v2", arc->tail);
-	}	
+	}
 	
 	fclose(f);
 }
@@ -1983,7 +1983,7 @@ void removeNormalNodes(ReebGraph *rg)
 
 				/* If arcs are one after the other */
 				if (arc->head == connectedArc->tail) {
-					/* remove furthest arc */		
+					/* remove furthest arc */
 					if (arc->tail->weight < connectedArc->head->weight) {
 						mergeConnectedArcs(rg, arc, connectedArc);
 						nextArc = arc->next;
@@ -2006,7 +2006,7 @@ void removeNormalNodes(ReebGraph *rg)
 				
 				/* If arcs are one after the other */
 				if (arc->tail == connectedArc->head) {
-					/* remove furthest arc */		
+					/* remove furthest arc */
 					if (arc->head->weight < connectedArc->tail->weight) {
 						mergeConnectedArcs(rg, arc, connectedArc);
 						nextArc = arc->next;
@@ -2092,7 +2092,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
 				
 				newEdge->nextEdge = e;
 
-				// if edge was the first in the list, point the edit edge to the new reeb edge instead.							
+				// if edge was the first in the list, point the edit edge to the new reeb edge instead.
 				if (*p == e) {
 					*p = (void *)newEdge;
 				}
@@ -2289,12 +2289,12 @@ static ReebEdge *createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
 		arc->faces = BLI_ghash_ptr_new("createArc gh");
 		
 		if (node1->weight <= node2->weight) {
-			v1 = node1;	
-			v2 = node2;	
+			v1 = node1;
+			v2 = node2;
 		}
 		else {
-			v1 = node2;	
-			v2 = node1;	
+			v1 = node2;
+			v2 = node1;
 		}
 		
 		arc->head = v1;
@@ -2857,7 +2857,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 		/* Apply dijkstra spf for each selected vert */
 		for (eve = em->verts.first; eve; eve = eve->next) {
 			if (eve->f & SELECT) {
-				shortestPathsFromVert(em, eve, indexed_edges);				
+				shortestPathsFromVert(em, eve, indexed_edges);
 			}
 		}
 		
@@ -2927,7 +2927,7 @@ static void initIteratorFct(ReebArcIterator *iter)
 	iter->next = nextBucket;
 	iter->nextN = nextNBucket;
 	iter->previous = previousBucket;
-	iter->stopped = iteratorStopped;	
+	iter->stopped = iteratorStopped;
 }
 
 static void setIteratorValues(ReebArcIterator *iter, EmbedBucket *bucket)
@@ -3419,7 +3419,7 @@ void REEB_draw()
 		
 		if (G.scene->toolsettings->skgen_options & SKGEN_DISP_EMBED)
 		{
-			glColor3f(1, 1, 1);				
+			glColor3f(1, 1, 1);
 			glBegin(GL_POINTS);
 			glVertex3fv(arc->head->p);
 			glVertex3fv(arc->tail->p);
diff --git a/source/blender/editors/armature/reeb.h b/source/blender/editors/armature/reeb.h
index bb8b300..b0e1fd3 100644
--- a/source/blender/editors/armature/reeb.h
+++ b/source/blender/editors/armature/reeb.h
@@ -114,7 +114,7 @@ typedef struct ReebArc {
 	int bcount;
 	struct EmbedBucket *buckets;
 
-	struct GHash *faces;	
+	struct GHash *faces;
 	float angle;
 	struct ReebArc *link_up; /* for multi resolution filtering, points to higher levels */
 } ReebArc;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index d22b9f2..23fed4c 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -162,9 +162,9 @@ static short select_beztriple(BezTriple *bezt, short selstatus, short flag, shor
 				bezt->f1 |= flag;
 				bezt->f2 |= flag;
 				bezt->f3 |= flag;
-				return 1;			
+				return 1;
 			}
-			else { /* deselects */	
+			else { /* deselects */
 				bezt->f1 &= ~flag; 
 				bezt->f2 &= ~flag; 
 				bezt->f3 &= ~flag; 
@@ -1069,7 +1069,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 	Nurb *nu = editnurb->nurbs.first;
 	CVKeyIndex *keyIndex;
 	char rna_path[64], orig_rna_path[64];
-	AnimData *ad = BKE_animdata_from_id(&cu->id);
+	AnimData *adt = BKE_animdata_from_id(&cu->id);
 	ListBase curves = {NULL, NULL};
 	FCurve *fcu, *next;
 
@@ -1089,14 +1089,14 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 						char handle_path[64], orig_handle_path[64];
 						BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_left", orig_rna_path);
 						BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_right", rna_path);
-						fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
+						fcurve_path_rename(adt, orig_handle_path, handle_path, orig_curves, &curves);
 
 						BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_right", orig_rna_path);
 						BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_left", rna_path);
-						fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
+						fcurve_path_rename(adt, orig_handle_path, handle_path, orig_curves, &curves);
 					}
 
-					fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+					fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
 
 					keyIndex->nu_index = nu_index;
 					keyIndex->pt_index = pt_index;
@@ -1116,7 +1116,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 				if (keyIndex) {
 					BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].points[%d]", nu_index, pt_index);
 					BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
-					fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+					fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
 
 					keyIndex->nu_index = nu_index;
 					keyIndex->pt_index = pt_index;
@@ -1140,7 +1140,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 			char *ch = strchr(fcu->rna_path, '.');
 
 			if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
-				fcurve_remove(ad, orig_curves, fcu);
+				fcurve_remove(adt, orig_curves, fcu);
 		}
 	}
 
@@ -1156,7 +1156,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 		if (keyIndex) {
 			BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d]", nu_index);
 			BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d]", keyIndex->nu_index);
-			fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+			fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
 		}
 
 		nu_index++;
@@ -1168,7 +1168,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 	for (fcu = orig_curves->first; fcu; fcu = next) {
 		next = fcu->next;
 
-		if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(ad, orig_curves, fcu);
+		if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(adt, orig_curves, fcu);
 		else BLI_addtail(&curves, fcu);
 	}
 
@@ -1178,14 +1178,14 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 /* return 0 if animation data wasn't changed, 1 otherwise */
 int ED_curve_updateAnimPaths(Curve *cu)
 {
-	AnimData *ad = BKE_animdata_from_id(&cu->id);
+	AnimData *adt = BKE_animdata_from_id(&cu->id);
 
 	if (!curve_is_animated(cu)) return 0;
 
-	if (ad->action)
-		curve_rename_fcurves(cu, &ad->action->curves);
+	if (adt->action)
+		curve_rename_fcurves(cu, &adt->action->curves);
 
-	curve_rename_fcurves(cu, &ad->drivers);
+	curve_rename_fcurves(cu, &adt->drivers);
 
 	return 1;
 }
@@ -1361,7 +1361,7 @@ static int separate_exec(bContext *C, wmOperator *op)
 	oldedit = oldcu->editnurb;
 
 	if (oldcu->key) {
-		BKE_report(op->reports, RPT_ERROR, "Can't separate a curve with vertex keys");
+		BKE_report(op->reports, RPT_ERROR, "Cannot separate a curve with vertex keys");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2063,7 +2063,7 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
 					bp->weight = weight;
 			}
 		}
-	}	
+	}
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -2115,7 +2115,7 @@ static int set_radius_exec(bContext *C, wmOperator *op)
 					bp->radius = radius;
 			}
 		}
-	}	
+	}
 
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 	DAG_id_tag_update(obedit->data, 0);
@@ -2408,7 +2408,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
 	
 	for (nu = editnurb->first; nu; nu = nu->next) {
 		lastsel = 0;
-		if (nu->type == CU_BEZIER) {			
+		if (nu->type == CU_BEZIER) {
 			a = nu->pntsu;
 			bezt = nu->bezt;
 			if (next < 0) bezt = &nu->bezt[a - 1];
@@ -2425,7 +2425,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
 					bezt += next;
 					lastsel = 0;
 				}
-				/* move around in zigzag way so that we go through each */				
+				/* move around in zigzag way so that we go through each */
 				bezt -= (next - next / abs(next));
 			}
 		}
@@ -2440,7 +2440,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
 					if (!(bp->f1 & SELECT) || (selstatus == 0)) {
 						short sel = select_bpoint(bp, selstatus, 1, VISIBLE);
 						if ((sel == 1) && (cont == 0)) lastsel = 1;
-					}			
+					}
 				}
 				else {
 					bp += next;
@@ -2706,7 +2706,7 @@ static int hide_exec(bContext *C, wmOperator *op)
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	return OPERATOR_FINISHED;	
+	return OPERATOR_FINISHED;
 }
 
 void CURVE_OT_hide(wmOperatorType *ot)
@@ -2767,7 +2767,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	return OPERATOR_FINISHED;	
+	return OPERATOR_FINISHED;
 }
 
 void CURVE_OT_reveal(wmOperatorType *ot)
@@ -3091,7 +3091,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				nu->pntsv = (number_cuts + 1) * nu->pntsv - number_cuts;
 				BKE_nurb_knot_calc_u(nu);
 				BKE_nurb_knot_calc_v(nu);
-			} /* End of 'if (sel == nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
+			} /* End of 'if (sel == nu->pntsu * nu->pntsv)' (subdivide entire NURB) */
 			else {
 				/* subdivide in v direction? */
 				sel = 0;
@@ -3200,7 +3200,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 	DAG_id_tag_update(obedit->data, 0);
 
-	return OPERATOR_FINISHED;	
+	return OPERATOR_FINISHED;
 }
 
 void CURVE_OT_subdivide(wmOperatorType *ot)
@@ -3226,12 +3226,12 @@ void CURVE_OT_subdivide(wmOperatorType *ot)
 
 /******************** find nearest ************************/
 
-static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
 {
-	struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; int dist, hpoint, select, mval[2]; } *data = userData;
+	struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; float dist; int hpoint, select; float mval_fl[2]; } *data = userData;
 
 	short flag;
-	short temp;
+	float dist_test;
 
 	if (bp) {
 		flag = bp->f1;
@@ -3248,12 +3248,12 @@ static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp,
 		}
 	}
 
-	temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
-	if ((flag & 1) == data->select) temp += 5;
-	if (bezt && beztindex == 1) temp += 3;  /* middle points get a small disadvantage */
+	dist_test = len_manhattan_v2v2(data->mval_fl, screen_co);
+	if ((flag & SELECT) == data->select) dist_test += 5.0f;
+	if (bezt && beztindex == 1) dist_test += 3.0f;  /* middle points get a small disadvantage */
 
-	if (temp < data->dist) {
-		data->dist = temp;
+	if (dist_test < data->dist) {
+		data->dist = dist_test;
 
 		data->bp = bp;
 		data->bezt = bezt;
@@ -3267,16 +3267,16 @@ static short findnearestNurbvert(ViewContext *vc, short sel, const int mval[2],
 	/* (sel == 1): selected gets a disadvantage */
 	/* in nurb and bezt or bp the nearest is written */
 	/* return 0 1 2: handlepunt */
-	struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; int dist, hpoint, select, mval[2]; } data = {NULL};
+	struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; float dist; int hpoint, select; float mval_fl[2]; } data = {NULL};
 
 	data.dist = 100;
 	data.hpoint = 0;
 	data.select = sel;
-	data.mval[0] = mval[0];
-	data.mval[1] = mval[1];
+	data.mval_fl[0] = mval[0];
+	data.mval_fl[1] = mval[1];
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-	nurbs_foreachScreenVert(vc, findnearestNurbvert__doClosest, &data);
+	nurbs_foreachScreenVert(vc, findnearestNurbvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	*nurb = data.nurb;
 	*bezt = data.bezt;
@@ -3501,7 +3501,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
 	int changed = 0, type = RNA_enum_get(op->ptr, "type");
 
 	if (type == CU_CARDINAL || type == CU_BSPLINE) {
-		BKE_report(op->reports, RPT_ERROR, "Not implemented yet");
+		BKE_report(op->reports, RPT_ERROR, "Not yet implemented");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -3678,10 +3678,12 @@ static int is_u_selected(Nurb *nu, int u)
 	/* what about resolu == 2? */
 	bp = &nu->bp[u];
 	for (v = 0; v < nu->pntsv - 1; v++, bp += nu->pntsu) {
-		if (v) if (bp->f1 & SELECT) return 1;
+		if ((v != 0) && (bp->f1 & SELECT)) {
+			return TRUE;
+		}
 	}
 	
-	return 0;
+	return FALSE;
 }
 
 typedef struct NurbSort {
@@ -3833,7 +3835,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
 	}
 	
 	if (nu1->pntsv != nu2->pntsv) {
-		BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
+		BKE_report(op->reports, RPT_ERROR, "Resolution does not match");
 		return;
 	}
 	
@@ -3943,7 +3945,7 @@ static int merge_nurb(bContext *C, wmOperator *op)
 	}
 	
 	if (ok == 0) {
-		BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
+		BKE_report(op->reports, RPT_ERROR, "Resolution does not match");
 		BLI_freelistN(&nsortbase);
 		return OPERATOR_CANCELLED;
 	}
@@ -4123,7 +4125,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 	}
 
 	if (!ok) {
-		BKE_report(op->reports, RPT_ERROR, "Can't make segment");
+		BKE_report(op->reports, RPT_ERROR, "Cannot make segment");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -4376,7 +4378,7 @@ static int spin_exec(bContext *C, wmOperator *op)
 		unit_m4(viewmat);
 	
 	if (!spin_nurb(viewmat, obedit, axis, cent)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't spin");
+		BKE_report(op->reports, RPT_ERROR, "Cannot spin");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -4421,7 +4423,7 @@ void CURVE_OT_spin(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
-	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
+	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -FLT_MAX, FLT_MAX, "Axis", "Axis in global view space", -1.0f, 1.0f);
 }
 
 /***************** add vertex operator **********************/
@@ -5252,10 +5254,10 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
 						tempbp = bp + 1;
 						if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, 1, VISIBLE);
 						if (sel) {
-							bp++;	
+							bp++;
 							a--;
 						}
-					}				
+					}
 				}
 
 				bp++;
@@ -5313,8 +5315,8 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 				if ((bp->hide == 0) && (bp->f1 & SELECT)) {
 					sel = 0;
 									
-					/* check if neighbors have been selected */	
-					/* edges of surface are an exception */	
+					/* check if neighbors have been selected */
+					/* edges of surface are an exception */
 					if ((a + 1) % nu->pntsu == 0) sel++;
 					else {
 						bp--;
@@ -5346,7 +5348,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 					if (sel != 4) {
 						select_bpoint(bp, DESELECT, 1, VISIBLE); 
 						selbpoints[a] = 1;
-					}									
+					}
 				}
 				else lastsel = 0;
 					
@@ -5360,7 +5362,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 		for (nu = editnurb->first; nu; nu = nu->next) {
 			lastsel = 0;
 			/* check what type of curve/nurb it is */
-			if (nu->type == CU_BEZIER) {			
+			if (nu->type == CU_BEZIER) {
 				a = nu->pntsu;
 				bezt = nu->bezt;
 				while (a--) {
@@ -5368,10 +5370,10 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 						if (lastsel == 1) sel = 1;
 						else sel = 0;
 												
-						/* check if neighbors have been selected */						
-						/* first and last are exceptions */					
+						/* check if neighbors have been selected */
+						/* first and last are exceptions */
 						if (a == nu->pntsu - 1) sel++;
-						else { 
+						else {
 							bezt--;
 							if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++;
 							bezt++;
@@ -5385,14 +5387,14 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 						}
 
 						if (sel != 2) {
-							select_beztriple(bezt, DESELECT, 1, VISIBLE);	
+							select_beztriple(bezt, DESELECT, 1, VISIBLE);
 							lastsel = 1;
 						}
 						else lastsel = 0;
 					}
 					else lastsel = 0;
 						
-					bezt++;	
+					bezt++;
 				}
 			}
 			else {
@@ -5403,9 +5405,9 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 						if (lastsel != 0) sel = 1;
 						else sel = 0;
 						
-						/* first and last are exceptions */					
+						/* first and last are exceptions */
 						if (a == nu->pntsu * nu->pntsv - 1) sel++;
-						else { 
+						else {
 							bp--;
 							if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
 							bp++;
@@ -5419,9 +5421,9 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 						}
 											
 						if (sel != 2) {
-							select_bpoint(bp, DESELECT, 1, VISIBLE); 	
+							select_bpoint(bp, DESELECT, 1, VISIBLE);
 							lastsel = 1;
-						}				
+						}
 						else lastsel = 0;
 					}
 					else lastsel = 0;
@@ -5482,7 +5484,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
 					select_bpoint(bp, SELECT, 1, VISIBLE); 
 				bp++;
 			}
-		}		
+		}
 	}
 }
 
@@ -5624,10 +5626,10 @@ static int select_nth_exec(bContext *C, wmOperator *op)
 
 	if (!CU_select_nth(obedit, nth)) {
 		if (obedit->type == OB_SURF) {
-			BKE_report(op->reports, RPT_ERROR, "Surface hasn't got active point");
+			BKE_report(op->reports, RPT_ERROR, "Surface has not got active point");
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR, "Curve hasn't got active point");
+			BKE_report(op->reports, RPT_ERROR, "Curve has not got active point");
 		}
 
 		return OPERATOR_CANCELLED;
@@ -5641,8 +5643,8 @@ static int select_nth_exec(bContext *C, wmOperator *op)
 void CURVE_OT_select_nth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Select Nth";
-	ot->description = "";
+	ot->name = "Checker Deselect";
+	ot->description = "Deselect every other vertex";
 	ot->idname = "CURVE_OT_select_nth";
 
 	/* api callbacks */
@@ -5652,7 +5654,7 @@ void CURVE_OT_select_nth(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
+	RNA_def_int(ot->srna, "nth", 2, 2, INT_MAX, "Nth Selection", "", 2, 100);
 }
 
 /********************** add duplicate operator *********************/
@@ -6464,9 +6466,9 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type
 						bp->vec[0] += fac * grid;
 						fac = (float)b - 1.5f;
 						bp->vec[1] += fac * grid;
-						if (a == 1 || a == 2) if (b == 1 || b == 2) {
-								bp->vec[2] += grid;
-							}
+						if ((a == 1 || a == 2) && (b == 1 || b == 2)) {
+							bp->vec[2] += grid;
+						}
 						mul_m4_v3(mat, bp->vec);
 						bp->vec[3] = 1.0;
 						bp++;
@@ -6486,12 +6488,7 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type
 				vec[0] = vec[1] = 0.0;
 				vec[2] = -grid;
 
-				if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
-					/* pass */
-				}
-				else {
-					mul_mat3_m4_v3(mat, vec);
-				}
+				mul_mat3_m4_v3(mat, vec);
 
 				translateflagNurb(editnurb, 1, vec);
 				extrudeflagNurb(cu->editnurb, 1);
@@ -6632,7 +6629,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 		if (obedit == NULL || obedit->type != OB_SURF) {
 			obedit = ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer);
 			newob = 1;
-		} 
+		}
 		else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
 	}
 
@@ -6652,7 +6649,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 	if (newob && enter_editmode)
 		ED_undo_push(C, "Enter Editmode");
 
-	ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
+	ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, TRUE);
 
 	nu = add_nurbs_primitive(C, obedit, mat, type, newob);
 	editnurb = object_editcurve_get(obedit);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index b379ce6..257dfca 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -94,7 +94,8 @@ static char findaccent(char char1, unsigned int code)
 	}
 	else if (char1 == 'c') {
 		if (code == ',') new = 231;
-		if (code == '|') new = 162;
+		else if (code == '|') new = 162;
+		else if (code == 'o') new = 169;
 	}
 	else if (char1 == 'e') {
 		if (code == '`') new = 232;
@@ -120,10 +121,18 @@ static char findaccent(char char1, unsigned int code)
 		else if (code == '/') new = 248;
 		else if (code == '-') new = 186;
 		else if (code == 'e') new = 143;
+		else if (code == 'c') new = 169;
+		else if (code == 'r') new = 174;
+	}
+	else if (char1 == 'r') {
+		if (code == 'o') new = 174;
 	}
 	else if (char1 == 's') {
 		if (code == 's') new = 167;
 	}
+	else if (char1 == 't') {
+		if (code == 'm') new = 153;
+	}
 	else if (char1 == 'u') {
 		if (code == '`') new = 249;
 		else if (code == 39) new = 250;
@@ -310,7 +319,7 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
 		lastlorem = ED_lorem;
 	
 	insert_into_textbuf(obedit, '\n');
-	insert_into_textbuf(obedit, '\n');	
+	insert_into_textbuf(obedit, '\n');
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -458,7 +467,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
 		nchars += strlen(tmp->line) + 1;
 
 	if (cu->str) MEM_freeN(cu->str);
-	if (cu->strinfo) MEM_freeN(cu->strinfo);	
+	if (cu->strinfo) MEM_freeN(cu->strinfo);
 
 	cu->str = MEM_callocN(nchars + 4, "str");
 	cu->strinfo = MEM_callocN((nchars + 4) * sizeof(CharInfo), "strinfo");
@@ -757,7 +766,7 @@ static int paste_selection(Object *obedit, ReportList *reports)
 
 	/* Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT */
 	if (cu->len + len <= MAXTEXT) {
-		if (len) {	
+		if (len) {
 			int size = (cu->len * sizeof(wchar_t)) - (cu->pos * sizeof(wchar_t)) + sizeof(wchar_t);
 			memmove(ef->textbuf + cu->pos + len, ef->textbuf + cu->pos, size);
 			memcpy(ef->textbuf + cu->pos, ef->copybuf, len * sizeof(wchar_t));
@@ -835,7 +844,7 @@ static int move_cursor(bContext *C, int type, int select)
 				if (ef->textbuf[cu->pos - 1] == '\n') break;
 				if (ef->textbufinfo[cu->pos - 1].flag & CU_CHINFO_WRAP) break;
 				cu->pos--;
-			}		
+			}
 			cursmove = FO_CURS;
 			break;
 			
@@ -868,7 +877,7 @@ static int move_cursor(bContext *C, int type, int select)
 			cursmove = FO_CURS;
 			break;
 
-		case NEXT_CHAR:	
+		case NEXT_CHAR:
 			if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
 			cu->pos++;
 			cursmove = FO_CURS;
@@ -1251,8 +1260,12 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 		else
 			ascii = 9;
 	}
-	else if (event == BACKSPACEKEY)
-		ascii = 0;
+	
+	if (event == BACKSPACEKEY) {
+		if (alt && cu->len != 0 && cu->pos > 0)
+			accentcode = 1;
+		return OPERATOR_PASS_THROUGH;
+	}
 
 	if (val && (ascii || evt->utf8_buf[0])) {
 		/* handle case like TAB (== 9) */
@@ -1263,44 +1276,25 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 		         (evt->utf8_buf[0]))
 		{
 
-			if (evt->utf8_buf[0]) {
-				BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1);
-				ascii = inserted_text[0];
-				insert_into_textbuf(obedit, ascii);
-				accentcode = 0;
-			}
-			else if (accentcode) {
+			if (accentcode) {
 				if (cu->pos > 0) {
 					inserted_text[0] = findaccent(ef->textbuf[cu->pos - 1], ascii);
 					ef->textbuf[cu->pos - 1] = inserted_text[0];
 				}
 				accentcode = 0;
 			}
-			else if (cu->len < MAXTEXT - 1) {
-				if (alt) {
-					/* might become obsolete, apple has default values for this, other OS's too? */
-					if (ascii == 't') ascii = 137;
-					else if (ascii == 'c') ascii = 169;
-					else if (ascii == 'f') ascii = 164;
-					else if (ascii == 'g') ascii = 176;
-					else if (ascii == 'l') ascii = 163;
-					else if (ascii == 'r') ascii = 174;
-					else if (ascii == 's') ascii = 223;
-					else if (ascii == 'y') ascii = 165;
-					else if (ascii == '.') ascii = 138;
-					else if (ascii == '1') ascii = 185;
-					else if (ascii == '2') ascii = 178;
-					else if (ascii == '3') ascii = 179;
-					else if (ascii == '%') ascii = 139;
-					else if (ascii == '?') ascii = 191;
-					else if (ascii == '!') ascii = 161;
-					else if (ascii == 'x') ascii = 215;
-					else if (ascii == '>') ascii = 187;
-					else if (ascii == '<') ascii = 171;
-				}
-
-				inserted_text[0] = ascii;
+			else if (evt->utf8_buf[0]) {
+				BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1);
+				ascii = inserted_text[0];
+				insert_into_textbuf(obedit, ascii);
+				accentcode = 0;
+			}
+			else if (ascii) {
 				insert_into_textbuf(obedit, ascii);
+				accentcode = 0;
+			}
+			else {
+				BLI_assert(0);
 			}
 			
 			kill_selection(obedit, 1);
@@ -1312,12 +1306,6 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 			text_update_edited(C, scene, obedit, 1, FO_EDIT);
 		}
 	}
-	else if (val && event == BACKSPACEKEY) {
-		if (alt && cu->len != 0 && cu->pos > 0)
-			accentcode = 1;
-
-		return OPERATOR_PASS_THROUGH;
-	}
 	else
 		return OPERATOR_PASS_THROUGH;
 
@@ -1330,7 +1318,8 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 	}
 
 	/* reset property? */
-	accentcode = 0;
+	if (val == 0)
+		accentcode = 0;
 	
 	return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 3b26c46..11e0758 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -98,8 +98,8 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
 	if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
 		return;
 	
-	/* if drawing a single point, draw it larger */	
-	if (totpoints == 1) {		
+	/* if drawing a single point, draw it larger */
+	if (totpoints == 1) {
 		/* draw point */
 		glBegin(GL_POINTS);
 		glVertex2iv(&points->x);
@@ -315,7 +315,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
 				s0[1] = (pt1->y / 100 * winy) + offsy;
 				s1[0] = (pt2->x / 100 * winx) + offsx;
 				s1[1] = (pt2->y / 100 * winy) + offsy;
-			}		
+			}
 			
 			/* calculate gradient and normal - 'angle'=(ny/nx) */
 			m1[1] = s1[1] - s0[1];
@@ -331,7 +331,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
 			if (i == 0) {
 				/* draw start cap first 
 				 *	- make points slightly closer to center (about halfway across) 
-				 */				
+				 */
 				mt[0] = m2[0] * pthick * 0.5f;
 				mt[1] = m2[1] * pthick * 0.5f;
 				sc[0] = s0[0] - (m1[0] * pthick * 0.75f);
@@ -382,7 +382,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
 				if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick) == 0)) {
 					mt[0] += (mb[0] * dfac);
 					mt[1] += (mb[1] * dfac);
-				}	
+				}
 				
 				/* calculate points for start of segment */
 				t0[0] = s0[0] - mt[0];
@@ -420,7 +420,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
 				
 				/* draw end cap as last step 
 				 *	- make points slightly closer to center (about halfway across) 
-				 */				
+				 */
 				mt[0] = m2[0] * pthick * 0.5f;
 				mt[1] = m2[1] * pthick * 0.5f;
 				sc[0] = s1[0] + (m1[0] * pthick * 0.75f);
@@ -531,7 +531,7 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int
 #endif
 			}
 		}
-		else if (gps->totpoints > 1)	
+		else if (gps->totpoints > 1)
 			gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy);
 	}
 }
@@ -611,7 +611,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
 					}
 					else 
 						break;
-				}	
+				}
 				
 				/* restore alpha */
 				glColor4fv(color);
@@ -661,11 +661,11 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
 
 /* ----- Grease Pencil Sketches Drawing API ------ */
 
-// ............................
-// XXX 
-//	We need to review the calls below, since they may be/are not that suitable for
-//	the new ways that we intend to be drawing data...
-// ............................
+/* ............................
+ * XXX
+ *	We need to review the calls below, since they may be/are not that suitable for
+ *	the new ways that we intend to be drawing data...
+ * ............................ */
 
 /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
 void draw_gpencil_2dimage(const bContext *C)
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index b69db00..aee97f4 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -49,6 +49,7 @@
 #include "ED_anim_api.h"
 #include "ED_gpencil.h"
 #include "ED_keyframes_edit.h"
+#include "ED_markers.h"
 
 #include "gpencil_intern.h"
 
@@ -393,7 +394,7 @@ void paste_gpdata(Scene *scene)
 				ScrArea *sa;
 				
 				/* get area that gp-data comes from */
-				//sa= gpencil_data_findowner((bGPdata *)ale->owner);	
+				//sa = gpencil_data_findowner((bGPdata *)ale->owner);
 				sa = NULL;
 				
 				/* this should be the right frame... as it may be a pre-existing frame, 
@@ -460,11 +461,12 @@ void paste_gpdata(Scene *scene)
 	/* undo and redraw stuff */
 	BIF_undo_push("Paste Grease Pencil Frames");
 }
+#endif /* XXX disabled until Grease Pencil code stabilises again... */
 
 /* -------------------------------------- */
 /* Snap Tools */
 
-static short snap_gpf_nearest(bGPDframe *gpf, Scene *scene)
+static short snap_gpf_nearest(bGPDframe *gpf, Scene *UNUSED(scene))
 {
 	if (gpf->flag & GP_FRAME_SELECT)
 		gpf->framenum = (int)(floor(gpf->framenum + 0.5));
@@ -475,7 +477,7 @@ static short snap_gpf_nearestsec(bGPDframe *gpf, Scene *scene)
 {
 	float secf = (float)FPS;
 	if (gpf->flag & GP_FRAME_SELECT)
-		gpf->framenum = (int)(floor(gpf->framenum / secf + 0.5f) * secf);
+		gpf->framenum = (int)(floorf(gpf->framenum / secf + 0.5f) * secf);
 	return 0;
 }
 
@@ -489,33 +491,32 @@ static short snap_gpf_cframe(bGPDframe *gpf, Scene *scene)
 static short snap_gpf_nearmarker(bGPDframe *gpf, Scene *scene)
 {
 	if (gpf->flag & GP_FRAME_SELECT)
-		gpf->framenum = (int)find_nearest_marker_time(&scene->markers, (float)gpf->framenum);
+		gpf->framenum = (int)ED_markers_find_nearest_marker_time(&scene->markers, (float)gpf->framenum);
 	return 0;
 }
 
-
 /* snap selected frames to ... */
-void snap_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
+void ED_gplayer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode)
 {
 	switch (mode) {
-		case 1: /* snap to nearest frame */
+		case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */
 			ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest);
 			break;
-		case 2: /* snap to current frame */
+		case SNAP_KEYS_CURFRAME: /* snap to current frame */
 			ED_gplayer_frames_looper(gpl, scene, snap_gpf_cframe);
 			break;
-		case 3: /* snap to nearest marker */
+		case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */
 			ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearmarker);
 			break;
-		case 4: /* snap to nearest second */
+		case SNAP_KEYS_NEARSEC: /* snap to nearest second */
 			ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearestsec);
 			break;
 		default: /* just in case */
-			ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest);
 			break;
 	}
 }
 
+#if 0 /* XXX disabled until grease pencil code stabilises again */
 /* -------------------------------------- */
 /* Mirror Tools */
 
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 46df8ba..e9ca739 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -40,8 +40,10 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
+#include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
+#include "DNA_anim_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_object_types.h"
 #include "DNA_node_types.h"
@@ -51,14 +53,19 @@
 #include "DNA_view3d_types.h"
 #include "DNA_gpencil_types.h"
 
+#include "BKE_animsys.h"
 #include "BKE_context.h"
 #include "BKE_curve.h"
+#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
+#include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_library.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_tracking.h"
 
+#include "UI_interface.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -71,6 +78,7 @@
 #include "ED_gpencil.h"
 #include "ED_view3d.h"
 #include "ED_clip.h"
+#include "ED_keyframing.h"
 
 #include "gpencil_intern.h"
 
@@ -131,11 +139,11 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 				return &sseq->gpd;
 			}
 			break;
-
+			
 			case SPACE_IMAGE: /* Image/UV Editor */
 			{
 				SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
-
+				
 				/* for now, Grease Pencil data is associated with the space... */
 				/* XXX our convention for everything else is to link to data though... */
 				if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceImageEditor, sima, ptr);
@@ -151,19 +159,19 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 				if (clip) {
 					if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
 						MovieTrackingTrack *track = BKE_tracking_track_get_active(&clip->tracking);
-
+						
 						if (!track)
 							return NULL;
-
+						
 						if (ptr)
 							RNA_pointer_create(&clip->id, &RNA_MovieTrackingTrack, track, ptr);
-
+						
 						return &track->gpd;
 					}
 					else {
 						if (ptr)
 							RNA_id_pointer_create(&clip->id, ptr);
-
+						
 						return &clip->gpd;
 					}
 				}
@@ -212,7 +220,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
 	
 	if (gpd_ptr == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go");
+		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -260,7 +268,7 @@ static int gp_data_unlink_exec(bContext *C, wmOperator *op)
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
 	
 	if (gpd_ptr == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go");
+		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -299,7 +307,7 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
 	
 	/* if there's no existing Grease-Pencil data there, add some */
 	if (gpd_ptr == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go");
+		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
 		return OPERATOR_CANCELLED;
 	}
 	if (*gpd_ptr == NULL)
@@ -348,7 +356,7 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op)
 	
 	/* if there's no existing Grease-Pencil data there, add some */
 	if (gpd == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
+		BKE_report(op->reports, RPT_ERROR, "No grease pencil data");
 		return OPERATOR_CANCELLED;
 	}
 	if (ELEM(NULL, gpl, gpf)) {
@@ -387,6 +395,14 @@ enum {
 	GP_STROKECONVERT_CURVE,
 };
 
+/* Defines for possible timing modes */
+enum {
+	GP_STROKECONVERT_TIMING_NONE = 1,
+	GP_STROKECONVERT_TIMING_LINEAR = 2,
+	GP_STROKECONVERT_TIMING_FULL = 3,
+	GP_STROKECONVERT_TIMING_CUSTOMGAP = 4,
+};
+
 /* RNA enum define */
 static EnumPropertyItem prop_gpencil_convertmodes[] = {
 	{GP_STROKECONVERT_PATH, "PATH", 0, "Path", ""},
@@ -394,6 +410,31 @@ static EnumPropertyItem prop_gpencil_convertmodes[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = {
+	{GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"},
+	{GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"},
+	{0, NULL, 0, NULL, NULL},
+};
+
+static EnumPropertyItem prop_gpencil_convert_timingmodes[] = {
+	{GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"},
+	{GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"},
+	{GP_STROKECONVERT_TIMING_FULL, "FULL", 0, "Original", "Use the original timing, gaps included"},
+	{GP_STROKECONVERT_TIMING_CUSTOMGAP, "CUSTOMGAP", 0, "Custom Gaps",
+	                                    "Use the original timing, but with custom gap lengths (in frames)"},
+	{0, NULL, 0, NULL, NULL},
+};
+
+static EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+                                                  int *free)
+{
+	*free = FALSE;
+	if (RNA_boolean_get(ptr, "use_timing_data")) {
+		return prop_gpencil_convert_timingmodes;
+	}
+	return prop_gpencil_convert_timingmodes_restricted;
+}
+
 /* --- */
 
 /* convert the coordinates from the given stroke point into 3d-coordinates 
@@ -430,7 +471,7 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
 				mvalf[1] = (float)pt->y / 100.0f * ar->winy;
 			}
 		}
-
+		
 		/* convert screen coordinate to 3d coordinates 
 		 *	- method taken from editview.c - mouse_cursor() 
 		 */
@@ -440,47 +481,510 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
 
 /* --- */
 
-/* convert stroke to 3d path */
-static void gp_stroke_to_path(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect)
+/* temp struct for gp_stroke_path_animation() */
+typedef struct tGpTimingData {
+	/* Data set from operator settings */
+	int mode;
+	int frame_range; /* Number of frames evaluated for path animation */
+	int start_frame, end_frame;
+	int realtime; /* A bool, actually, will overwrite end_frame in case of Original or CustomGap timing... */
+	float gap_duration, gap_randomness; /* To be used with CustomGap mode*/
+	int seed;
+
+	/* Data set from points, used to compute final timing FCurve */
+	int num_points, cur_point;
+
+	/* Distances */
+	float *dists;
+	float tot_dist;
+
+	/* Times */
+	float *times; /* Note: Gap times will be negative! */
+	float tot_time, gap_tot_time;
+	double inittime;
+} tGpTimingData;
+
+/* init point buffers for timing data */
+static void _gp_timing_data_set_nbr(tGpTimingData *gtd, int nbr)
 {
-	bGPDspoint *pt;
-	Nurb *nu;
-	BPoint *bp;
+	float *tmp;
+
+	BLI_assert(nbr > gtd->num_points);
+	
+	/* distances */
+	tmp = gtd->dists;
+	gtd->dists = MEM_callocN(sizeof(float) * nbr, __func__);
+	if (tmp) {
+		memcpy(gtd->dists, tmp, sizeof(float) * gtd->num_points);
+		MEM_freeN(tmp);
+	}
+	
+	/* times */
+	tmp = gtd->times;
+	gtd->times = MEM_callocN(sizeof(float) * nbr, __func__);
+	if (tmp) {
+		memcpy(gtd->times, tmp, sizeof(float) * gtd->num_points);
+		MEM_freeN(tmp);
+	}
+
+	gtd->num_points = nbr;
+}
+
+/* add stroke point to timing buffers */
+static void gp_timing_data_add_point(tGpTimingData *gtd, double stroke_inittime, float time, float delta_dist)
+{
+	if (time < 0.0f) {
+		/* This is a gap, negative value! */
+		gtd->times[gtd->cur_point] = -(((float)(stroke_inittime - gtd->inittime)) + time);
+		gtd->tot_time = -gtd->times[gtd->cur_point];
+		
+		gtd->gap_tot_time += gtd->times[gtd->cur_point] - gtd->times[gtd->cur_point - 1];
+	}
+	else {
+		gtd->times[gtd->cur_point] = (((float)(stroke_inittime - gtd->inittime)) + time);
+		gtd->tot_time = (gtd->times[gtd->cur_point]);
+	}
+	
+	gtd->tot_dist += delta_dist;
+	gtd->dists[gtd->cur_point] = gtd->tot_dist;
+	
+	gtd->cur_point++;
+}
+
+/* In frames! Binary search for FCurve keys have a threshold of 0.01, so we can't set
+ * arbitrarily close points - this is esp. important with NoGaps mode!
+ */
+#define MIN_TIME_DELTA 0.02f
+
+/* Loop over next points to find the end of the stroke, and compute */
+static int gp_find_end_of_stroke_idx(tGpTimingData *gtd, int idx, int nbr_gaps, int *nbr_done_gaps,
+                                     float tot_gaps_time, float delta_time, float *next_delta_time)
+{
+	int j;
+	
+	for (j = idx + 1; j < gtd->num_points; j++) {
+		if (gtd->times[j] < 0) {
+			gtd->times[j] = -gtd->times[j];
+			if (gtd->mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
+				/* In this mode, gap time between this stroke and the next should be 0 currently...
+				 * So we have to compute its final duration!
+				 */
+				if (gtd->gap_randomness > 0.0f) {
+					/* We want gaps that are in gtd->gap_duration +/- gtd->gap_randomness range,
+					 * and which sum to exactly tot_gaps_time...
+					 */
+					int rem_gaps = nbr_gaps - (*nbr_done_gaps);
+					if (rem_gaps < 2) {
+						/* Last gap, just give remaining time! */
+						*next_delta_time = tot_gaps_time;
+					}
+					else {
+						float delta, min, max;
+						
+						/* This code ensures that if the first gaps have been shorter than average gap_duration,
+						 * next gaps will tend to be longer (i.e. try to recover the lateness), and vice-versa!
+						 */
+						delta = delta_time - (gtd->gap_duration * (*nbr_done_gaps));
+						
+						/* Clamp min between [-gap_randomness, 0.0], with lower delta giving higher min */
+						min = -gtd->gap_randomness - delta;
+						CLAMP(min, -gtd->gap_randomness, 0.0f);
+						
+						/* Clamp max between [0.0, gap_randomness], with lower delta giving higher max */
+						max = gtd->gap_randomness - delta;
+						CLAMP(max, 0.0f, gtd->gap_randomness);
+						*next_delta_time += gtd->gap_duration + (BLI_frand() * (max - min)) + min;
+					}
+				}
+				else {
+					*next_delta_time += gtd->gap_duration;
+				}
+			}
+			(*nbr_done_gaps)++;
+			break;
+		}
+	}
+
+	return j - 1;
+}
+
+static void gp_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, int *nbr_gaps, float *tot_gaps_time)
+{
+	int i;
+	float delta_time = 0.0f;
+
+	for (i = 0; i < gtd->num_points; i++) {
+		if (gtd->times[i] < 0 && i) {
+			(*nbr_gaps)++;
+			gtd->times[i] = -gtd->times[i] - delta_time;
+			delta_time += gtd->times[i] - gtd->times[i - 1];
+			gtd->times[i] = -gtd->times[i - 1]; /* Temp marker, values *have* to be different! */
+		}
+		else {
+			gtd->times[i] -= delta_time;
+		}
+	}
+	gtd->tot_time -= delta_time;
+
+	*tot_gaps_time = (float)(*nbr_gaps) * gtd->gap_duration;
+	gtd->tot_time += *tot_gaps_time;
+	if (G.debug & G_DEBUG) {
+		printf("%f, %f, %f, %d\n", gtd->tot_time, delta_time, *tot_gaps_time, *nbr_gaps);
+	}
+	if (gtd->gap_randomness > 0.0f) {
+		BLI_srandom(gtd->seed);
+	}
+}
+
+static void gp_stroke_path_animation_add_keyframes(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu,
+                                                   Curve *cu, tGpTimingData *gtd, float time_range,
+                                                   int nbr_gaps, float tot_gaps_time)
+{
+	/* Use actual recorded timing! */
+	float time_start = (float)gtd->start_frame;
+
+	float last_valid_time = 0.0f;
+	int end_stroke_idx = -1, start_stroke_idx = 0;
+	float end_stroke_time = 0.0f;
+
+	/* CustomGaps specific */
+	float delta_time = 0.0f, next_delta_time = 0.0f;
+	int nbr_done_gaps = 0;
+
 	int i;
+	float cfra;
+
+	/* This is a bit tricky, as:
+	 * - We can't add arbitrarily close points on FCurve (in time).
+	 * - We *must* have all "caps" points of all strokes in FCurve, as much as possible!
+	 */
+	for (i = 0; i < gtd->num_points; i++) {
+		/* If new stroke... */
+		if (i > end_stroke_idx) {
+			start_stroke_idx = i;
+			delta_time = next_delta_time;
+			/* find end of that new stroke */
+			end_stroke_idx = gp_find_end_of_stroke_idx(gtd, i, nbr_gaps, &nbr_done_gaps,
+			                                           tot_gaps_time, delta_time, &next_delta_time);
+			/* This one should *never* be negative! */
+			end_stroke_time = time_start + ((gtd->times[end_stroke_idx] + delta_time) / gtd->tot_time * time_range);
+		}
+		
+		/* Simple proportional stuff... */
+		cu->ctime = gtd->dists[i] / gtd->tot_dist * cu->pathlen;
+		cfra = time_start + ((gtd->times[i] + delta_time) / gtd->tot_time * time_range);
+		
+		/* And now, the checks about timing... */
+		if (i == start_stroke_idx) {
+			/* If first point of a stroke, be sure it's enough ahead of last valid keyframe, and
+			 * that the end point of the stroke is far enough!
+			 * In case it is not, we keep the end point...
+			 * Note that with CustomGaps mode, this is here we set the actual gap timing!
+			 */
+			if ((end_stroke_time - last_valid_time) > MIN_TIME_DELTA * 2) {
+				if ((cfra - last_valid_time) < MIN_TIME_DELTA) {
+					cfra = last_valid_time + MIN_TIME_DELTA;
+				}
+				insert_keyframe_direct(reports, ptr, prop, fcu, cfra, INSERTKEY_FAST);
+				last_valid_time = cfra;
+			}
+			else if (G.debug & G_DEBUG) {
+				printf("\t Skipping start point %d, too close from end point %d\n", i, end_stroke_idx);
+			}
+		}
+		else if (i == end_stroke_idx) {
+			/* Always try to insert end point of a curve (should be safe enough, anyway...) */
+			if ((cfra - last_valid_time) < MIN_TIME_DELTA) {
+				cfra = last_valid_time + MIN_TIME_DELTA;
+			}
+			insert_keyframe_direct(reports, ptr, prop, fcu, cfra, INSERTKEY_FAST);
+			last_valid_time = cfra;
+		}
+		else {
+			/* Else ("middle" point), we only insert it if it's far enough from last keyframe,
+			 * and also far enough from (not yet added!) end_stroke keyframe!
+			 */
+			if ((cfra - last_valid_time) > MIN_TIME_DELTA && (end_stroke_time - cfra) > MIN_TIME_DELTA) {
+				insert_keyframe_direct(reports, ptr, prop, fcu, cfra, INSERTKEY_FAST);
+				last_valid_time = cfra;
+			}
+			else if (G.debug & G_DEBUG) {
+				printf("\t Skipping \"middle\" point %d, too close from last added point or end point %d\n",
+				       i, end_stroke_idx);
+			}
+		}
+	}
+}
 
-	/* create new 'nurb' within the curve */
-	nu = (Nurb *)MEM_callocN(sizeof(Nurb), "gpstroke_to_path(nurb)");
+static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu, tGpTimingData *gtd)
+{
+	Scene *scene = CTX_data_scene(C);
+	bAction *act;
+	FCurve *fcu;
+	PointerRNA ptr;
+	PropertyRNA *prop = NULL;
+	int nbr_gaps = 0, i;
+	
+	if (gtd->mode == GP_STROKECONVERT_TIMING_NONE)
+		return;
+	
+	/* gap_duration and gap_randomness are in frames, but we need seconds!!! */
+	gtd->gap_duration = FRA2TIME(gtd->gap_duration);
+	gtd->gap_randomness = FRA2TIME(gtd->gap_randomness);
 	
-	nu->pntsu = gps->totpoints;
-	nu->pntsv = 1;
-	nu->orderu = gps->totpoints;
-	nu->flagu = CU_NURB_ENDPOINT;
-	nu->resolu = 32;
+	/* Enable path! */
+	cu->flag |= CU_PATH;
+	cu->pathlen = gtd->frame_range;
 	
-	nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * gps->totpoints, "bpoints");
+	/* Get RNA pointer to read/write path time values */
+	RNA_id_pointer_create((ID *)cu, &ptr);
+	prop = RNA_struct_find_property(&ptr, "eval_time");
+	
+	/* Ensure we have an F-Curve to add keyframes to */
+	act = verify_adt_action((ID *)cu, TRUE);
+	fcu = verify_fcurve(act, NULL, &ptr, "eval_time", 0, TRUE);
+	
+	if (G.debug & G_DEBUG) {
+		printf("%s: tot len: %f\t\ttot time: %f\n", __func__, gtd->tot_dist, gtd->tot_time);
+		for (i = 0; i < gtd->num_points; i++) {
+			printf("\tpoint %d:\t\tlen: %f\t\ttime: %f\n", i, gtd->dists[i], gtd->times[i]);
+		}
+	}
+	
+	if (gtd->mode == GP_STROKECONVERT_TIMING_LINEAR) {
+		float cfra;
+		
+		/* Linear extrapolation! */
+		fcu->extend = FCURVE_EXTRAPOLATE_LINEAR;
+		
+		cu->ctime = 0.0f;
+		cfra = (float)gtd->start_frame;
+		insert_keyframe_direct(reports, ptr, prop, fcu, cfra, INSERTKEY_FAST);
+		
+		cu->ctime = cu->pathlen;
+		if (gtd->realtime) {
+			cfra += (float)TIME2FRA(gtd->tot_time); /* Seconds to frames */
+		}
+		else {
+			cfra = (float)gtd->end_frame;
+		}
+		insert_keyframe_direct(reports, ptr, prop, fcu, cfra, INSERTKEY_FAST);
+	}
+	else {
+		/* Use actual recorded timing! */
+		float time_range;
+		
+		/* CustomGaps specific */
+		float tot_gaps_time = 0.0f;
+		
+		/* Pre-process gaps, in case we don't want to keep their original timing */
+		if (gtd->mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
+			gp_stroke_path_animation_preprocess_gaps(gtd, &nbr_gaps, &tot_gaps_time);
+		}
+		
+		if (gtd->realtime) {
+			time_range = (float)TIME2FRA(gtd->tot_time); /* Seconds to frames */
+		}
+		else {
+			time_range = (float)(gtd->end_frame - gtd->start_frame);
+		}
+		
+		if (G.debug & G_DEBUG) {
+			printf("GP Stroke Path Conversion: Starting keying!\n");
+		}
+		
+		gp_stroke_path_animation_add_keyframes(reports, ptr, prop, fcu, cu, gtd, time_range,
+		                                       nbr_gaps, tot_gaps_time);
+	}
+	
+	/* As we used INSERTKEY_FAST mode, we need to recompute all curve's handles now */
+	calchandles_fcurve(fcu);
+	
+	if (G.debug & G_DEBUG) {
+		printf("%s: \ntot len: %f\t\ttot time: %f\n", __func__, gtd->tot_dist, gtd->tot_time);
+		for (i = 0; i < gtd->num_points; i++) {
+			printf("\tpoint %d:\t\tlen: %f\t\ttime: %f\n", i, gtd->dists[i], gtd->times[i]);
+		}
+		printf("\n\n");
+	}
+	
+	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+	
+	/* send updates */
+	DAG_id_tag_update(&cu->id, 0);
+}
+
+#undef MIN_TIME_DELTA
+
+#define GAP_DFAC 0.05f
+#define WIDTH_CORR_FAC 0.1f
+#define BEZT_HANDLE_FAC 0.3f
+
+/* convert stroke to 3d path */
+static void gp_stroke_to_path(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
+                              float minmax_weights[2], float rad_fac, int stitch, tGpTimingData *gtd)
+{
+	bGPDspoint *pt;
+	Nurb *nu = (curnu) ? *curnu : NULL;
+	BPoint *bp, *prev_bp = NULL;
+	const int do_gtd = (gtd->mode != GP_STROKECONVERT_TIMING_NONE);
+	int i, old_nbp = 0;
+
+	/* create new 'nurb' or extend current one within the curve */
+	if (nu) {
+		old_nbp = nu->pntsu;
+		
+		/* If stitch, the first point of this stroke is already present in current nu.
+		 * Else, we have to add to additional points to make the zero-radius link between strokes.
+		 */
+		BKE_nurb_points_add(nu, gps->totpoints + (stitch ? -1 : 2));
+	}
+	else {
+		nu = (Nurb *)MEM_callocN(sizeof(Nurb), "gpstroke_to_path(nurb)");
+		
+		nu->pntsu = gps->totpoints;
+		nu->pntsv = 1;
+		nu->orderu = 2; /* point-to-point! */
+		nu->type = CU_NURBS;
+		nu->flagu = CU_NURB_ENDPOINT;
+		nu->resolu = cu->resolu;
+		nu->resolv = cu->resolv;
+		nu->knotsu = NULL;
+		
+		nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "bpoints");
+		
+		stitch = FALSE; /* Security! */
+	}
+
+	if (do_gtd) {
+		_gp_timing_data_set_nbr(gtd, nu->pntsu);
+	}
+
+	/* If needed, make the link between both strokes with two zero-radius additional points */
+	/* About "zero-radius" point interpolations:
+	 * - If we have at least two points in current curve (most common case), we linearly extrapolate
+	 *   the last segment to get the first point (p1) position and timing.
+	 * - If we do not have those (quite odd, but may happen), we linearly interpolate the last point
+	 *   with the first point of the current stroke.
+	 * The same goes for the second point, first segment of the current stroke is "negatively" extrapolated
+	 * if it exists, else (if the stroke is a single point), linear interpolation with last curve point...
+	 */
+	if (curnu && !stitch && old_nbp) {
+		float p1[3], p2[3], p[3], next_p[3];
+		float delta_time;
+
+		prev_bp = NULL;
+		if ((old_nbp > 1) && gps->prev && (gps->prev->totpoints > 1)) {
+			/* Only use last curve segment if previous stroke was not a single-point one! */
+			prev_bp = nu->bp + old_nbp - 2;
+		}
+		bp = nu->bp + old_nbp - 1;
+		
+		/* XXX We do this twice... Not sure it's worth to bother about this! */
+		gp_strokepoint_convertcoords(C, gps, gps->points, p, subrect);
+		if (prev_bp) {
+			interp_v3_v3v3(p1, prev_bp->vec, bp->vec, 1.0f + GAP_DFAC);
+		}
+		else {
+			interp_v3_v3v3(p1, bp->vec, p, GAP_DFAC);
+		}
+		
+		if (gps->totpoints > 1) {
+			/* XXX We do this twice... Not sure it's worth to bother about this! */
+			gp_strokepoint_convertcoords(C, gps, gps->points + 1, next_p, subrect);
+			interp_v3_v3v3(p2, p, next_p, -GAP_DFAC);
+		}
+		else {
+			interp_v3_v3v3(p2, p, bp->vec, GAP_DFAC);
+		}
+		
+		/* First point */
+		bp++;
+		copy_v3_v3(bp->vec, p1);
+		bp->vec[3] = 1.0f;
+		bp->f1 = SELECT;
+		minmax_weights[0] = bp->radius = bp->weight = 0.0f;
+		if (do_gtd) {
+			if (prev_bp) {
+				delta_time = gtd->tot_time + (gtd->tot_time - gtd->times[gtd->cur_point - 1]) * GAP_DFAC;
+			}
+			else {
+				delta_time = gtd->tot_time + (((float)(gps->inittime - gtd->inittime)) - gtd->tot_time) * GAP_DFAC;
+			}
+			gp_timing_data_add_point(gtd, gtd->inittime, delta_time, len_v3v3((bp - 1)->vec, p1));
+		}
+		
+		/* Second point */
+		bp++;
+		copy_v3_v3(bp->vec, p2);
+		bp->vec[3] = 1.0f;
+		bp->f1 = SELECT;
+		minmax_weights[0] = bp->radius = bp->weight = 0.0f;
+		if (do_gtd) {
+			/* This negative delta_time marks the gap! */
+			if (gps->totpoints > 1) {
+				delta_time = ((gps->points + 1)->time - gps->points->time) * -GAP_DFAC;
+			}
+			else {
+				delta_time = -(((float)(gps->inittime - gtd->inittime)) - gtd->tot_time) * GAP_DFAC;
+			}
+			gp_timing_data_add_point(gtd, gps->inittime, delta_time, len_v3v3(p1, p2));
+		}
+		
+		old_nbp += 2;
+	}
+	if (old_nbp && do_gtd) {
+		prev_bp = nu->bp + old_nbp - 1;
+	}
 	
 	/* add points */
-	for (i = 0, pt = gps->points, bp = nu->bp; i < gps->totpoints; i++, pt++, bp++) {
+	for (i = (stitch) ? 1 : 0, pt = gps->points + ((stitch) ? 1 : 0), bp = nu->bp + old_nbp;
+	     i < gps->totpoints;
+	     i++, pt++, bp++)
+	{
 		float p3d[3];
+		float width = pt->pressure * gpl->thickness * WIDTH_CORR_FAC;
 		
 		/* get coordinates to add at */
 		gp_strokepoint_convertcoords(C, gps, pt, p3d, subrect);
 		copy_v3_v3(bp->vec, p3d);
+		bp->vec[3] = 1.0f;
 		
 		/* set settings */
 		bp->f1 = SELECT;
-		bp->radius = bp->weight = pt->pressure * gpl->thickness;
+		bp->radius = width * rad_fac;
+		bp->weight = width;
+		CLAMP(bp->weight, 0.0f, 1.0f);
+		if (bp->weight < minmax_weights[0]) {
+			minmax_weights[0] = bp->weight;
+		}
+		else if (bp->weight > minmax_weights[1]) {
+			minmax_weights[1] = bp->weight;
+		}
+		
+		/* Update timing data */
+		if (do_gtd) {
+			gp_timing_data_add_point(gtd, gps->inittime, pt->time, (prev_bp) ? len_v3v3(prev_bp->vec, p3d) : 0.0f);
+		}
+		prev_bp = bp;
 	}
 	
 	/* add nurb to curve */
-	BLI_addtail(&cu->nurb, nu);
+	if (!curnu || !*curnu) {
+		BLI_addtail(&cu->nurb, nu);
+	}
+	if (curnu) {
+		*curnu = nu;
+	}
+	
+	BKE_nurb_knot_calc_u(nu);
 }
 
 static int gp_camera_view_subrect(bContext *C, rctf *subrect)
 {
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar = CTX_wm_region(C);
-
+	
 	if (v3d) {
 		RegionView3D *rv3d = ar->regiondata;
 		
@@ -491,48 +995,178 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
 			return 1;
 		}
 	}
-
+	
 	return 0;
 }
 
 /* convert stroke to 3d bezier */
-static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect)
+static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
+                                float minmax_weights[2], float rad_fac, int stitch, tGpTimingData *gtd)
 {
 	bGPDspoint *pt;
-	Nurb *nu;
-	BezTriple *bezt;
-	int i, tot;
+	Nurb *nu = (curnu) ? *curnu : NULL;
+	BezTriple *bezt, *prev_bezt = NULL;
+	int i, tot, old_nbezt = 0;
 	float p3d_cur[3], p3d_prev[3], p3d_next[3];
+	const int do_gtd = (gtd->mode != GP_STROKECONVERT_TIMING_NONE);
+	
+	/* create new 'nurb' or extend current one within the curve */
+	if (nu) {
+		old_nbezt = nu->pntsu;
+		/* If we do stitch, first point of current stroke is assumed the same as last point of previous stroke,
+		 * so no need to add it.
+		 * If no stitch, we want to add two additional points to make a "zero-radius" link between both strokes.
+		 */
+		BKE_nurb_bezierPoints_add(nu, gps->totpoints + ((stitch) ? -1 : 2));
+	}
+	else {
+		nu = (Nurb *)MEM_callocN(sizeof(Nurb), "gpstroke_to_bezier(nurb)");
+		
+		nu->pntsu = gps->totpoints;
+		nu->resolu = 12;
+		nu->resolv = 12;
+		nu->type = CU_BEZIER;
+		nu->bezt = (BezTriple *)MEM_callocN(gps->totpoints * sizeof(BezTriple), "bezts");
+		
+		stitch = FALSE; /* Security! */
+	}
 
-	/* create new 'nurb' within the curve */
-	nu = (Nurb *)MEM_callocN(sizeof(Nurb), "gpstroke_to_bezier(nurb)");
-
-	nu->pntsu = gps->totpoints;
-	nu->resolu = 12;
-	nu->resolv = 12;
-	nu->type = CU_BEZIER;
-	nu->bezt = (BezTriple *)MEM_callocN(gps->totpoints * sizeof(BezTriple), "bezts");
+	if (do_gtd) {
+		_gp_timing_data_set_nbr(gtd, nu->pntsu);
+	}
 
 	tot = gps->totpoints;
 
 	/* get initial coordinates */
 	pt = gps->points;
 	if (tot) {
-		gp_strokepoint_convertcoords(C, gps, pt, p3d_cur, subrect);
+		gp_strokepoint_convertcoords(C, gps, pt, (stitch) ? p3d_prev : p3d_cur, subrect);
 		if (tot > 1) {
-			gp_strokepoint_convertcoords(C, gps, pt + 1, p3d_next, subrect);
+			gp_strokepoint_convertcoords(C, gps, pt + 1, (stitch) ? p3d_cur : p3d_next, subrect);
+		}
+		if (stitch && tot > 2) {
+			gp_strokepoint_convertcoords(C, gps, pt + 2, p3d_next, subrect);
 		}
 	}
 
+	/* If needed, make the link between both strokes with two zero-radius additional points */
+	if (curnu && old_nbezt) {
+		/* Update last point's second handle */
+		if (stitch) {
+			float h2[3];
+			bezt = nu->bezt + old_nbezt - 1;
+			interp_v3_v3v3(h2, bezt->vec[1], p3d_cur, BEZT_HANDLE_FAC);
+			copy_v3_v3(bezt->vec[2], h2);
+			pt++;
+		}
+		
+		/* Create "link points" */
+		/* About "zero-radius" point interpolations:
+		 * - If we have at least two points in current curve (most common case), we linearly extrapolate
+		 *   the last segment to get the first point (p1) position and timing.
+		 * - If we do not have those (quite odd, but may happen), we linearly interpolate the last point
+		 *   with the first point of the current stroke.
+		 * The same goes for the second point, first segment of the current stroke is "negatively" extrapolated
+		 * if it exists, else (if the stroke is a single point), linear interpolation with last curve point...
+		 */
+		else {
+			float h1[3], h2[3], p1[3], p2[3];
+			float delta_time;
+			
+			prev_bezt = NULL;
+			if (old_nbezt > 1 && gps->prev && gps->prev->totpoints > 1) {
+				/* Only use last curve segment if previous stroke was not a single-point one! */
+				prev_bezt = nu->bezt + old_nbezt - 2;
+			}
+			bezt = nu->bezt + old_nbezt - 1;
+			if (prev_bezt) {
+				interp_v3_v3v3(p1, prev_bezt->vec[1], bezt->vec[1], 1.0f + GAP_DFAC);
+			}
+			else {
+				interp_v3_v3v3(p1, bezt->vec[1], p3d_cur, GAP_DFAC);
+			}
+			if (tot > 1) {
+				interp_v3_v3v3(p2, p3d_cur, p3d_next, -GAP_DFAC);
+			}
+			else {
+				interp_v3_v3v3(p2, p3d_cur, bezt->vec[1], GAP_DFAC);
+			}
+			
+			/* Second handle of last point */
+			interp_v3_v3v3(h2, bezt->vec[1], p1, BEZT_HANDLE_FAC);
+			copy_v3_v3(bezt->vec[2], h2);
+			
+			/* First point */
+			interp_v3_v3v3(h1, p1, bezt->vec[1], BEZT_HANDLE_FAC);
+			interp_v3_v3v3(h2, p1, p2, BEZT_HANDLE_FAC);
+			
+			bezt++;
+			copy_v3_v3(bezt->vec[0], h1);
+			copy_v3_v3(bezt->vec[1], p1);
+			copy_v3_v3(bezt->vec[2], h2);
+			bezt->h1 = bezt->h2 = HD_FREE;
+			bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+			minmax_weights[0] = bezt->radius = bezt->weight = 0.0f;
+			
+			if (do_gtd) {
+				if (prev_bezt) {
+					delta_time = gtd->tot_time + (gtd->tot_time - gtd->times[gtd->cur_point - 1]) * GAP_DFAC;
+				}
+				else {
+					delta_time = gtd->tot_time + (((float)(gps->inittime - gtd->inittime)) - gtd->tot_time) * GAP_DFAC;
+				}
+				gp_timing_data_add_point(gtd, gtd->inittime, delta_time, len_v3v3((bezt - 1)->vec[1], p1));
+			}
+			
+			/* Second point */
+			interp_v3_v3v3(h1, p2, p1, BEZT_HANDLE_FAC);
+			interp_v3_v3v3(h2, p2, p3d_cur, BEZT_HANDLE_FAC);
+			
+			bezt++;
+			copy_v3_v3(bezt->vec[0], h1);
+			copy_v3_v3(bezt->vec[1], p2);
+			copy_v3_v3(bezt->vec[2], h2);
+			bezt->h1 = bezt->h2 = HD_FREE;
+			bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+			minmax_weights[0] = bezt->radius = bezt->weight = 0.0f;
+			
+			if (do_gtd) {
+				/* This negative delta_time marks the gap! */
+				if (tot > 1) {
+					delta_time = ((gps->points + 1)->time - gps->points->time) * -GAP_DFAC;
+				}
+				else {
+					delta_time = -(((float)(gps->inittime - gtd->inittime)) - gtd->tot_time) * GAP_DFAC;
+				}
+				gp_timing_data_add_point(gtd, gps->inittime, delta_time, len_v3v3(p1, p2));
+			}
+			
+			old_nbezt += 2;
+			copy_v3_v3(p3d_prev, p2);
+		}
+	}
+	if (old_nbezt && do_gtd) {
+		prev_bezt = nu->bezt + old_nbezt - 1;
+	}
+	
 	/* add points */
-	for (i = 0, bezt = nu->bezt; i < tot; i++, pt++, bezt++) {
+	for (i = stitch ? 1 : 0, bezt = nu->bezt + old_nbezt; i < tot; i++, pt++, bezt++) {
 		float h1[3], h2[3];
+		float width = pt->pressure * gpl->thickness * WIDTH_CORR_FAC;
 		
-		if (i) interp_v3_v3v3(h1, p3d_cur, p3d_prev, 0.3);
-		else interp_v3_v3v3(h1, p3d_cur, p3d_next, -0.3);
+		if (i || old_nbezt) {
+			interp_v3_v3v3(h1, p3d_cur, p3d_prev, BEZT_HANDLE_FAC);
+		}
+		else {
+			interp_v3_v3v3(h1, p3d_cur, p3d_next, -BEZT_HANDLE_FAC);
+		}
 		
-		if (i < tot - 1) interp_v3_v3v3(h2, p3d_cur, p3d_next, 0.3);
-		else interp_v3_v3v3(h2, p3d_cur, p3d_prev, -0.3);
+		if (i < tot - 1) {
+			interp_v3_v3v3(h2, p3d_cur, p3d_next, BEZT_HANDLE_FAC);
+		}
+		else {
+			interp_v3_v3v3(h2, p3d_cur, p3d_prev, -BEZT_HANDLE_FAC);
+		}
 		
 		copy_v3_v3(bezt->vec[0], h1);
 		copy_v3_v3(bezt->vec[1], p3d_cur);
@@ -541,7 +1175,20 @@ static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cu
 		/* set settings */
 		bezt->h1 = bezt->h2 = HD_FREE;
 		bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
-		bezt->radius = bezt->weight = pt->pressure * gpl->thickness * 0.1f;
+		bezt->radius = width * rad_fac;
+		bezt->weight = width;
+		CLAMP(bezt->weight, 0.0f, 1.0f);
+		if (bezt->weight < minmax_weights[0]) {
+			minmax_weights[0] = bezt->weight;
+		}
+		else if (bezt->weight > minmax_weights[1]) {
+			minmax_weights[1] = bezt->weight;
+		}
+		
+		/* Update timing data */
+		if (do_gtd) {
+			gp_timing_data_add_point(gtd, gps->inittime, pt->time, prev_bezt ? len_v3v3(prev_bezt->vec[1], p3d_cur) : 0.0f);
+		}
 		
 		/* shift coord vects */
 		copy_v3_v3(p3d_prev, p3d_cur);
@@ -550,31 +1197,103 @@ static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cu
 		if (i + 2 < tot) {
 			gp_strokepoint_convertcoords(C, gps, pt + 2, p3d_next, subrect);
 		}
+		
+		prev_bezt = bezt;
 	}
-
+	
 	/* must calculate handles or else we crash */
 	BKE_nurb_handles_calc(nu);
 
-	/* add nurb to curve */
-	BLI_addtail(&cu->nurb, nu);
+	if (!curnu || !*curnu) {
+		BLI_addtail(&cu->nurb, nu);
+	}
+	if (curnu) {
+		*curnu = nu;
+	}
+}
+
+#undef GAP_DFAC
+#undef WIDTH_CORR_FAC
+#undef BEZT_HANDLE_FAC
+
+static void gp_stroke_finalize_curve_endpoints(Curve *cu)
+{
+	/* start */
+	Nurb *nu = cu->nurb.first;
+	int i = 0;
+	if (nu->bezt) {
+		BezTriple *bezt = nu->bezt;
+		if (bezt) {
+			bezt[i].weight = bezt[i].radius = 0.0f;
+		}
+	}
+	else if (nu->bp) {
+		BPoint *bp = nu->bp;
+		if (bp) {
+			bp[i].weight = bp[i].radius = 0.0f;
+		}
+	}
+	
+	/* end */
+	nu = cu->nurb.last;
+	i = nu->pntsu - 1;
+	if (nu->bezt) {
+		BezTriple *bezt = nu->bezt;
+		if (bezt) {
+			bezt[i].weight = bezt[i].radius = 0.0f;
+		}
+	}
+	else if (nu->bp) {
+		BPoint *bp = nu->bp;
+		if (bp) {
+			bp[i].weight = bp[i].radius = 0.0f;
+		}
+	}
+}
+
+static void gp_stroke_norm_curve_weights(Curve *cu, float minmax_weights[2])
+{
+	Nurb *nu;
+	const float delta = minmax_weights[0];
+	const float fac = 1.0f / (minmax_weights[1] - delta);
+	int i;
+	
+	for (nu = cu->nurb.first; nu; nu = nu->next) {
+		if (nu->bezt) {
+			BezTriple *bezt = nu->bezt;
+			for (i = 0; i < nu->pntsu; i++, bezt++) {
+				bezt->weight = (bezt->weight - delta) * fac;
+			}
+		}
+		else if (nu->bp) {
+			BPoint *bp = nu->bp;
+			for (i = 0; i < nu->pntsu; i++, bp++) {
+				bp->weight = (bp->weight - delta) * fac;
+			}
+		}
+	}
 }
 
 /* convert a given grease-pencil layer to a 3d-curve representation (using current view if appropriate) */
-static void gp_layer_to_curve(bContext *C, bGPdata *gpd, bGPDlayer *gpl, short mode)
+static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, int mode,
+                              int norm_weights, float rad_fac, int link_strokes, tGpTimingData *gtd)
 {
 	Scene *scene = CTX_data_scene(C);
 	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
-	bGPDstroke *gps;
+	bGPDstroke *gps, *prev_gps = NULL;
 	Object *ob;
 	Curve *cu;
+	Nurb *nu = NULL;
+	Base *base = BASACT, *newbase = NULL;
+	float minmax_weights[2] = {1.0f, 0.0f};
 
 	/* camera framing */
 	rctf subrect, *subrect_ptr = NULL;
-
+	
 	/* error checking */
 	if (ELEM3(NULL, gpd, gpl, gpf))
 		return;
-		
+	
 	/* only convert if there are any strokes on this layer's frame to convert */
 	if (gpf->strokes.first == NULL)
 		return;
@@ -583,7 +1302,7 @@ static void gp_layer_to_curve(bContext *C, bGPdata *gpd, bGPDlayer *gpl, short m
 	if (gp_camera_view_subrect(C, &subrect)) {
 		subrect_ptr = &subrect;
 	}
-
+	
 	/* init the curve object (remove rotation and get curve data from it)
 	 *	- must clear transforms set on object, as those skew our results
 	 */
@@ -597,24 +1316,125 @@ static void gp_layer_to_curve(bContext *C, bGPdata *gpd, bGPDlayer *gpl, short m
 	rename_id((ID *)ob, gpl->info);
 	rename_id((ID *)cu, gpl->info);
 	
+	gtd->inittime = ((bGPDstroke *)gpf->strokes.first)->inittime;
+	
 	/* add points to curve */
 	for (gps = gpf->strokes.first; gps; gps = gps->next) {
+		/* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached,
+		 * and stitch them to previous one.
+		 */
+		int stitch = FALSE;
+		
+		if (prev_gps) {
+			bGPDspoint *pt1 = prev_gps->points + prev_gps->totpoints - 1;
+			bGPDspoint *pt2 = gps->points;
+			
+			if ((pt1->x == pt2->x) && (pt1->y == pt2->y)) {
+				stitch = TRUE;
+			}
+		}
+		
+		/* Decide whether we connect this stroke to previous one */
+		if (!(stitch || link_strokes)) {
+			nu = NULL;
+		}
+		
 		switch (mode) {
 			case GP_STROKECONVERT_PATH: 
-				gp_stroke_to_path(C, gpl, gps, cu, subrect_ptr);
+				gp_stroke_to_path(C, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch, gtd);
 				break;
 			case GP_STROKECONVERT_CURVE:
-				gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr);
+				gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch, gtd);
 				break;
 			default:
 				BLI_assert(!"invalid mode");
 				break;
 		}
+		prev_gps = gps;
+	}
+
+	/* If link_strokes, be sure first and last points have a zero weight/size! */
+	if (link_strokes)
+		gp_stroke_finalize_curve_endpoints(cu);
+
+	/* Update curve's weights, if needed */
+	if (norm_weights && ((minmax_weights[0] > 0.0f) || (minmax_weights[1] < 1.0f)))
+		gp_stroke_norm_curve_weights(cu, minmax_weights);
+
+	/* Create the path animation, if needed */
+	gp_stroke_path_animation(C, reports, cu, gtd);
+
+	/* Reset original object as active, else we can't edit operator's settings!!! */
+	/* set layers OK */
+	newbase = BASACT;
+	if (base) {
+		newbase->lay = base->lay;
+		ob->lay = newbase->lay;
+	}
+	
+	/* restore, BKE_object_add sets active */
+	BASACT = base;
+	if (base) {
+		base->flag |= SELECT;
 	}
 }
 
 /* --- */
 
+/* Check a GP layer has valid timing data! Else, most timing options are hidden in the operator.
+ * op may be NULL.
+ */
+static int gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op)
+{
+	Scene *scene = CTX_data_scene(C);
+	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
+	bGPDstroke *gps = gpf->strokes.first;
+	bGPDspoint *pt;
+	double base_time, cur_time, prev_time = -1.0;
+	int i, valid = TRUE;
+	
+	do {
+		base_time = cur_time = gps->inittime;
+		if (cur_time <= prev_time) {
+			valid = FALSE;
+			break;
+		}
+		
+		prev_time = cur_time;
+		for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+			cur_time = base_time + (double)pt->time;
+			/* First point of a stroke should have the same time as stroke's inittime,
+			 * so it's the only case where equality is allowed!
+			 */
+			if ((i && cur_time <= prev_time) || (cur_time < prev_time)) {
+				valid = FALSE;
+				break;
+			}
+			prev_time = cur_time;
+		}
+		
+		if (!valid) {
+			break;
+		}
+	} while ((gps = gps->next));
+	
+	if (op) {
+		RNA_boolean_set(op->ptr, "use_timing_data", valid);
+	}
+	return valid;
+}
+
+/* Check end_frame is always > start frame! */
+static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
+{
+	int start_frame = RNA_int_get(ptr, "start_frame");
+	int end_frame = RNA_int_get(ptr, "end_frame");
+	
+	if (end_frame <= start_frame) {
+		RNA_int_set(ptr, "end_frame", start_frame + 1);
+	}
+}
+
 static int gp_convert_poll(bContext *C)
 {
 	bGPdata *gpd = gpencil_data_get_active(C);
@@ -627,45 +1447,204 @@ static int gp_convert_poll(bContext *C)
 
 static int gp_convert_layer_exec(bContext *C, wmOperator *op)
 {
+	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_timing_data");
 	bGPdata *gpd = gpencil_data_get_active(C);
 	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 	Scene *scene = CTX_data_scene(C);
 	int mode = RNA_enum_get(op->ptr, "type");
-
+	int norm_weights = RNA_boolean_get(op->ptr, "use_normalize_weights");
+	float rad_fac = RNA_float_get(op->ptr, "radius_multiplier");
+	int link_strokes = RNA_boolean_get(op->ptr, "use_link_strokes");
+	int valid_timing;
+	tGpTimingData gtd;
+	
 	/* check if there's data to work with */
 	if (gpd == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data to work on");
 		return OPERATOR_CANCELLED;
 	}
-
-	gp_layer_to_curve(C, gpd, gpl, mode);
-
+	
+	if (!RNA_property_is_set(op->ptr, prop) && !gp_convert_check_has_valid_timing(C, gpl, op)) {
+		BKE_report(op->reports, RPT_WARNING,
+		           "Current Grease Pencil strokes have no valid timing data, most timing options will be hidden!");
+	}
+	valid_timing = RNA_property_boolean_get(op->ptr, prop);
+	
+	gtd.mode = RNA_enum_get(op->ptr, "timing_mode");
+	/* Check for illegal timing mode! */
+	if (!valid_timing && !ELEM(gtd.mode, GP_STROKECONVERT_TIMING_NONE, GP_STROKECONVERT_TIMING_LINEAR)) {
+		gtd.mode = GP_STROKECONVERT_TIMING_LINEAR;
+		RNA_enum_set(op->ptr, "timing_mode", gtd.mode);
+	}
+	if (!link_strokes) {
+		gtd.mode = GP_STROKECONVERT_TIMING_NONE;
+	}
+	
+	/* grab all relevant settings */
+	gtd.frame_range = RNA_int_get(op->ptr, "frame_range");
+	gtd.start_frame = RNA_int_get(op->ptr, "start_frame");
+	gtd.realtime = valid_timing ? RNA_boolean_get(op->ptr, "use_realtime") : FALSE;
+	gtd.end_frame = RNA_int_get(op->ptr, "end_frame");
+	gtd.gap_duration = RNA_float_get(op->ptr, "gap_duration");
+	gtd.gap_randomness = RNA_float_get(op->ptr, "gap_randomness");
+	gtd.gap_randomness = min_ff(gtd.gap_randomness, gtd.gap_duration);
+	gtd.seed = RNA_int_get(op->ptr, "seed");
+	gtd.num_points = gtd.cur_point = 0;
+	gtd.dists = gtd.times = NULL;
+	gtd.tot_dist = gtd.tot_time = gtd.gap_tot_time = 0.0f;
+	gtd.inittime = 0.0;
+	
+	/* perform conversion */
+	gp_layer_to_curve(C, op->reports, gpd, gpl, mode, norm_weights, rad_fac, link_strokes, &gtd);
+	
+	/* free temp memory */
+	if (gtd.dists) {
+		MEM_freeN(gtd.dists);
+		gtd.dists = NULL;
+	}
+	if (gtd.times) {
+		MEM_freeN(gtd.times);
+		gtd.times = NULL;
+	}
+	
 	/* notifiers */
 	WM_event_add_notifier(C, NC_OBJECT | NA_ADDED, NULL);
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
-
+	
 	/* done */
 	return OPERATOR_FINISHED;
 }
 
+static int gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+{
+	const char *prop_id = RNA_property_identifier(prop);
+	int link_strokes = RNA_boolean_get(ptr, "use_link_strokes");
+	int timing_mode = RNA_enum_get(ptr, "timing_mode");
+	int realtime = RNA_boolean_get(ptr, "use_realtime");
+	float gap_duration = RNA_float_get(ptr, "gap_duration");
+	float gap_randomness = RNA_float_get(ptr, "gap_randomness");
+	int valid_timing = RNA_boolean_get(ptr, "use_timing_data");
+	
+	/* Always show those props */
+	if (strcmp(prop_id, "type") == 0 ||
+	    strcmp(prop_id, "use_normalize_weights") == 0 ||
+	    strcmp(prop_id, "radius_multiplier") == 0 ||
+	    strcmp(prop_id, "use_link_strokes") == 0)
+	{
+		return TRUE;
+	}
+	
+	/* Never show this prop */
+	if (strcmp(prop_id, "use_timing_data") == 0)
+		return FALSE;
+
+	if (link_strokes) {
+		/* Only show when link_stroke is TRUE */
+		if (strcmp(prop_id, "timing_mode") == 0)
+			return TRUE;
+		
+		if (timing_mode != GP_STROKECONVERT_TIMING_NONE) {
+			/* Only show when link_stroke is TRUE and stroke timing is enabled */
+			if (strcmp(prop_id, "frame_range") == 0 ||
+			    strcmp(prop_id, "start_frame") == 0)
+			{
+				return TRUE;
+			}
+			
+			/* Only show if we have valid timing data! */
+			if (valid_timing && strcmp(prop_id, "use_realtime") == 0)
+				return TRUE;
+			
+			/* Only show if realtime or valid_timing is FALSE! */
+			if ((!realtime || !valid_timing) && strcmp(prop_id, "end_frame") == 0)
+				return TRUE;
+			
+			if (valid_timing && timing_mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
+				/* Only show for custom gaps! */
+				if (strcmp(prop_id, "gap_duration") == 0)
+					return TRUE;
+				
+				/* Only show randomness for non-null custom gaps! */
+				if (strcmp(prop_id, "gap_randomness") == 0 && (gap_duration > 0.0f))
+					return TRUE;
+				
+				/* Only show seed for randomize action! */
+				if (strcmp(prop_id, "seed") == 0 && (gap_duration > 0.0f) && (gap_randomness > 0.0f))
+					return TRUE;
+			}
+		}
+	}
+
+	/* Else, hidden! */
+	return FALSE;
+}
+
+static void gp_convert_ui(bContext *C, wmOperator *op)
+{
+	uiLayout *layout = op->layout;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	PointerRNA ptr;
+
+	RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+
+	/* Main auto-draw call */
+	uiDefAutoButsRNA(layout, &ptr, gp_convert_draw_check_prop, '\0');
+}
+
 void GPENCIL_OT_convert(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
 	ot->name = "Convert Grease Pencil";
 	ot->idname = "GPENCIL_OT_convert";
-	ot->description = "Convert the active Grease Pencil layer to a new Object";
-	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	ot->description = "Convert the active Grease Pencil layer to a new Curve Object";
 	
 	/* callbacks */
 	ot->invoke = WM_menu_invoke;
 	ot->exec = gp_convert_layer_exec;
 	ot->poll = gp_convert_poll;
+	ot->ui = gp_convert_ui;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_convertmodes, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_convertmodes, 0, "Type", "Which type of curve to convert to");
+	
+	RNA_def_boolean(ot->srna, "use_normalize_weights", TRUE, "Normalize Weight",
+	                "Normalize weight (set from stroke width)");
+	RNA_def_float(ot->srna, "radius_multiplier", 1.0f, 0.0f, 1000.0f, "Radius Fac",
+	              "Multiplier for the points' radii (set from stroke width)", 0.0f, 10.0f);
+	RNA_def_boolean(ot->srna, "use_link_strokes", TRUE, "Link Strokes",
+	                "Whether to link strokes with zero-radius sections of curves");
+	
+	prop = RNA_def_enum(ot->srna, "timing_mode", prop_gpencil_convert_timingmodes, GP_STROKECONVERT_TIMING_FULL,
+	                    "Timing Mode", "How to use timing data stored in strokes");
+	RNA_def_enum_funcs(prop, rna_GPConvert_mode_items);
+	
+	RNA_def_int(ot->srna, "frame_range", 100, 1, 10000, "Frame Range",
+	            "The duration of evaluation of the path control curve", 1, 1000);
+	RNA_def_int(ot->srna, "start_frame", 1, 1, 100000, "Start Frame",
+	            "The start frame of the path control curve", 1, 100000);
+	RNA_def_boolean(ot->srna, "use_realtime", FALSE, "Realtime",
+	                "Whether the path control curve reproduces the drawing in realtime, starting from Start Frame");
+	prop = RNA_def_int(ot->srna, "end_frame", 250, 1, 100000, "End Frame",
+	                   "The end frame of the path control curve (if Realtime is not set)", 1, 100000);
+	RNA_def_property_update_runtime(prop, gp_convert_set_end_frame);
+	
+	RNA_def_float(ot->srna, "gap_duration", 0.0f, 0.0f, 10000.0f, "Gap Duration",
+	              "Custom Gap mode: (Average) length of gaps, in frames "
+	              "(Note: Realtime value, will be scaled if Realtime is not set)", 0.0f, 1000.0f);
+	RNA_def_float(ot->srna, "gap_randomness", 0.0f, 0.0f, 10000.0f, "Gap Randomness",
+	              "Custom Gap mode: Number of frames that gap lengths can vary", 0.0f, 1000.0f);
+	RNA_def_int(ot->srna, "seed", 0, 0, 1000, "Random Seed",
+	            "Custom Gap mode: Random generator seed", 0, 100);
+				
+	/* Note: Internal use, this one will always be hidden by UI code... */
+	prop = RNA_def_boolean(ot->srna, "use_timing_data", FALSE, "Has Valid Timing",
+	                       "Whether the converted Grease Pencil layer has valid timing data (internal use)");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /* ************************************************ */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index c07f0db..8fdca73 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -39,6 +39,8 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
+#include "PIL_time.h"
+
 #include "BKE_gpencil.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -98,6 +100,14 @@ typedef struct tGPsdata {
 	
 	short radius;       /* radius of influence for eraser */
 	short flags;        /* flags that can get set during runtime */
+	
+	/* These need to be doubles, as (at least under unix) they are in seconds since epoch,
+	 * float (and its 7 digits precision) is definitively not enough here!
+	 * double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least.
+	 */
+	double inittime;    /* Used when converting to path */
+	double curtime;     /* Used when converting to path */
+	double ocurtime;    /* Used when converting to path */
 
 	float imat[4][4];   /* inverted transformation matrix applying when converting coords from screen-space
 	                     * to region space */
@@ -201,7 +211,7 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3])
 	float *fp = give_cursor(p->scene, v3d);
 	
 	/* the reference point used depends on the owner... */
-#if 0 // XXX: disabled for now, since we can't draw relative to the owner yet
+#if 0 /* XXX: disabled for now, since we can't draw relative to the owner yet */
 	if (p->ownerPtr.type == &RNA_Object) {
 		Object *ob = (Object *)p->ownerPtr.data;
 		
@@ -249,7 +259,7 @@ static short gp_stroke_filtermval(tGPsdata *p, const int mval[2], int pmval[2])
 }
 
 /* convert screen-coordinates to buffer-coordinates */
-// XXX this method needs a total overhaul!
+/* XXX this method needs a total overhaul! */
 static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3], float *depth)
 {
 	bGPdata *gpd = p->gpd;
@@ -310,7 +320,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
 }
 
 /* add current stroke-point to buffer (returns whether point was successfully added) */
-static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
+static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure, double curtime)
 {
 	bGPdata *gpd = p->gpd;
 	tGPspoint *pt;
@@ -325,6 +335,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 			/* store settings */
 			copy_v2_v2_int(&pt->x, mval);
 			pt->pressure = pressure;
+			pt->time = (float)(curtime - p->inittime);
 			
 			/* increment buffer size */
 			gpd->sbuffer_size++;
@@ -338,6 +349,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 			/* store settings */
 			copy_v2_v2_int(&pt->x, mval);
 			pt->pressure = pressure;
+			pt->time = (float)(curtime - p->inittime);
 			
 			/* if this is just the second point we've added, increment the buffer size
 			 * so that it will be drawn properly...
@@ -361,6 +373,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 		/* store settings */
 		copy_v2_v2_int(&pt->x, mval);
 		pt->pressure = pressure;
+		pt->time = (float)(curtime - p->inittime);
 		
 		/* increment counters */
 		gpd->sbuffer_size++;
@@ -378,10 +391,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 		/* store settings */
 		copy_v2_v2_int(&pt->x, mval);
 		pt->pressure = pressure;
+		pt->time = (float)(curtime - p->inittime);
 		
 		/* if there's stroke for this poly line session add (or replace last) point
 		 * to stroke. This allows to draw lines more interactively (see new segment
-		 * during mouse slide, i.e.) 
+		 * during mouse slide, e.g.)
 		 */
 		if (gp_stroke_added_check(p)) {
 			bGPDstroke *gps = p->gpf->strokes.last;
@@ -410,8 +424,9 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
 			gp_stroke_convertcoords(p, &pt->x, &pts->x, NULL);
 			
-			/* copy pressure */
+			/* copy pressure and time */
 			pts->pressure = pt->pressure;
+			pts->time = pt->time;
 		}
 		
 		/* increment counters */
@@ -425,18 +440,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
 	return GP_STROKEADD_INVALID;
 }
 
-
-/* temp struct for gp_stroke_smooth() */
-typedef struct tGpSmoothCo {
-	int x;
-	int y;
-} tGpSmoothCo;
-
 /* smooth a stroke (in buffer) before storing it */
 static void gp_stroke_smooth(tGPsdata *p)
 {
 	bGPdata *gpd = p->gpd;
-	tGpSmoothCo *smoothArray, *spc;
+	tGPspoint *spt, tmp_spt[3];
 	int i = 0, cmx = gpd->sbuffer_size;
 	
 	/* only smooth if smoothing is enabled, and we're not doing a straight line */
@@ -447,30 +455,28 @@ static void gp_stroke_smooth(tGPsdata *p)
 	if ((cmx <= 2) || (gpd->sbuffer == NULL))
 		return;
 	
-	/* create a temporary smoothing coordinates buffer, use to store calculated values to prevent sequential error */
-	smoothArray = MEM_callocN(sizeof(tGpSmoothCo) * cmx, "gp_stroke_smooth smoothArray");
+	/* Calculate smoothing coordinates using weighted-averages 
+	 * WARNING: we do NOT smooth first and last points (to avoid shrinkage)
+	 */
+	spt = (tGPspoint *)gpd->sbuffer;
 	
-	/* first pass: calculate smoothing coordinates using weighted-averages */
-	for (i = 0, spc = smoothArray; i < gpd->sbuffer_size; i++, spc++) {
-		const tGPspoint *pc = (((tGPspoint *)gpd->sbuffer) + i);
-		const tGPspoint *pb = (i - 1 > 0) ? (pc - 1) : (pc);
-		const tGPspoint *pa = (i - 2 > 0) ? (pc - 2) : (pb);
-		const tGPspoint *pd = (i + 1 < cmx) ? (pc + 1) : (pc);
+	/* This (tmp_spt) small array stores the last two points' original coordinates, 
+	 * as we don't want to use already averaged ones! It is used as a cyclic buffer...
+	 */
+	tmp_spt[0] = *spt;
+	for (i = 1, spt++; i < cmx - 1; i++, spt++) {
+		const tGPspoint *pc = spt;
+		const tGPspoint *pb = &tmp_spt[(i - 1) % 3];
+		const tGPspoint *pa = (i - 1 > 0) ? (&tmp_spt[(i - 2) % 3]) : (pb);
+		const tGPspoint *pd = pc + 1;
 		const tGPspoint *pe = (i + 2 < cmx) ? (pc + 2) : (pd);
 		
-		spc->x = (int)(0.1 * pa->x + 0.2 * pb->x + 0.4 * pc->x + 0.2 * pd->x + 0.1 * pe->x);
-		spc->y = (int)(0.1 * pa->y + 0.2 * pb->y + 0.4 * pc->y + 0.2 * pd->y + 0.1 * pe->y);
-	}
-	
-	/* second pass: apply smoothed coordinates */
-	for (i = 0, spc = smoothArray; i < gpd->sbuffer_size; i++, spc++) {
-		tGPspoint *pc = (((tGPspoint *)gpd->sbuffer) + i);
+		/* Store current point's original state for the two next points! */
+		tmp_spt[i % 3] = *spt;
 		
-		copy_v2_v2_int(&pc->x, &spc->x);
+		spt->x = (int)(0.1 * pa->x + 0.2 * pb->x + 0.4 * pc->x + 0.2 * pd->x + 0.1 * pe->x);
+		spt->y = (int)(0.1 * pa->y + 0.2 * pb->y + 0.4 * pc->y + 0.2 * pd->y + 0.1 * pe->y);
 	}
-	
-	/* free temp array */
-	MEM_freeN(smoothArray);
 }
 
 /* simplify a stroke (in buffer) before storing it 
@@ -492,7 +498,7 @@ static void gp_stroke_simplify(tGPsdata *p)
 	/* don't simplify if less than 4 points in buffer */
 	if ((num_points <= 4) || (old_points == NULL))
 		return;
-		
+	
 	/* clear buffer (but don't free mem yet) so that we can write to it 
 	 *	- firstly set sbuffer to NULL, so a new one is allocated
 	 *	- secondly, reset flag after, as it gets cleared auto
@@ -509,17 +515,21 @@ static void gp_stroke_simplify(tGPsdata *p)
 		co[0] += (float)(old_points[offs].x * sfac); \
 		co[1] += (float)(old_points[offs].y * sfac); \
 		pressure += old_points[offs].pressure * sfac; \
+		time += old_points[offs].time * sfac; \
 	} (void)0
 	
+	/* XXX Here too, do not lose start and end points! */
+	gp_stroke_addpoint(p, &old_points->x, old_points->pressure, p->inittime + (double)old_points->time);
 	for (i = 0, j = 0; i < num_points; i++) {
 		if (i - j == 3) {
-			float co[2], pressure;
+			float co[2], pressure, time;
 			int mco[2];
 			
 			/* initialize values */
-			co[0] = 0;
-			co[1] = 0;
-			pressure = 0;
+			co[0] = 0.0f;
+			co[1] = 0.0f;
+			pressure = 0.0f;
+			time = 0.0f;
 			
 			/* using macro, calculate new point */
 			GP_SIMPLIFY_AVPOINT(j, -0.25f);
@@ -532,11 +542,13 @@ static void gp_stroke_simplify(tGPsdata *p)
 			mco[1] = (int)co[1];
 			
 			/* ignore return values on this... assume to be ok for now */
-			gp_stroke_addpoint(p, mco, pressure);
+			gp_stroke_addpoint(p, mco, pressure, p->inittime + (double)time);
 			
 			j += 2;
 		}
-	} 
+	}
+	gp_stroke_addpoint(p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure,
+	                   p->inittime + (double)old_points[num_points - 1].time);
 	
 	/* free old buffer */
 	MEM_freeN(old_points);
@@ -571,13 +583,14 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 	
 	/* special case for poly line -- for already added stroke during session
 	 * coordinates are getting added to stroke immediately to allow more
-	 * interactive behavior */
+	 * interactive behavior
+	 */
 	if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
 		if (gp_stroke_added_check(p)) {
 			return;
 		}
 	}
-
+	
 	/* allocate memory for a new stroke */
 	gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
 	
@@ -585,13 +598,14 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 	gps->totpoints = totelem;
 	gps->thickness = p->gpl->thickness;
 	gps->flag = gpd->sbuffer_sflag;
+	gps->inittime = p->inittime;
 	
 	/* allocate enough memory for a continuous array for storage points */
 	gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
-
+	
 	/* set pointer to first non-initialized point */
 	pt = gps->points + (gps->totpoints - totelem);
-
+	
 	/* copy points from the buffer to the stroke */
 	if (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT) {
 		/* straight lines only -> only endpoints */
@@ -602,8 +616,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
 			gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL);
 			
-			/* copy pressure */
+			/* copy pressure and time */
 			pt->pressure = ptc->pressure;
+			pt->time = ptc->time;
 			
 			pt++;
 		}
@@ -615,8 +630,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
 			gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL);
 			
-			/* copy pressure */
+			/* copy pressure and time */
 			pt->pressure = ptc->pressure;
+			pt->time = ptc->time;
 		}
 	}
 	else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
@@ -626,8 +642,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 		/* convert screen-coordinates to appropriate coordinates (and store them) */
 		gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL);
 		
-		/* copy pressure */
+		/* copy pressure and time */
 		pt->pressure = ptc->pressure;
+		pt->time = ptc->time;
 	}
 	else {
 		float *depth_arr = NULL;
@@ -699,14 +716,15 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
 			gp_stroke_convertcoords(p, &ptc->x, &pt->x, depth_arr ? depth_arr + i : NULL);
 			
-			/* copy pressure */
+			/* copy pressure and time */
 			pt->pressure = ptc->pressure;
+			pt->time = ptc->time;
 		}
 		
 		if (depth_arr)
 			MEM_freeN(depth_arr);
 	}
-
+	
 	/* add stroke to frame */
 	BLI_addtail(&p->gpf->strokes, gps);
 	gp_stroke_added_enable(p);
@@ -719,7 +737,7 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
 {
 	bGPDspoint *pt_tmp = gps->points;
 	bGPDstroke *gsn = NULL;
-
+	
 	/* if stroke only had two points, get rid of stroke */
 	if (gps->totpoints == 2) {
 		/* free stroke points, then stroke */
@@ -729,7 +747,7 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
 		/* nothing left in stroke, so stop */
 		return 1;
 	}
-
+	
 	/* if last segment, just remove segment from the stroke */
 	else if (i == gps->totpoints - 2) {
 		/* allocate new points array, and assign most of the old stroke there */
@@ -743,7 +761,7 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
 		/* nothing left in stroke, so stop */
 		return 1;
 	}
-
+	
 	/* if first segment, just remove segment from the stroke */
 	else if (i == 0) {
 		/* allocate new points array, and assign most of the old stroke there */
@@ -751,13 +769,32 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
 		gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
 		memcpy(gps->points, pt_tmp + 1, sizeof(bGPDspoint) * gps->totpoints);
 		
+		/* We must adjust timings!
+		 * Each point's timing data is a delta from stroke's inittime, so as we erase the first
+		 * point of the stroke, we have to offset this inittime and all remaining points' delta values.
+		 * This way we get a new stroke with exactly the same timing as if user had started drawing from
+		 * the second point...
+		 */
+		{
+			bGPDspoint *pts;
+			float delta = pt_tmp[1].time;
+			int j;
+			
+			gps->inittime += (double)delta;
+			
+			pts = gps->points;
+			for (j = 0; j < gps->totpoints; j++, pts++) {
+				pts->time -= delta;
+			}
+		}
+		
 		/* free temp buffer */
 		MEM_freeN(pt_tmp);
 		
 		/* no break here, as there might still be stuff to remove in this stroke */
 		return 0;
 	}
-
+	
 	/* segment occurs in 'middle' of stroke, so split */
 	else {
 		/* duplicate stroke, and assign 'later' data to that stroke */
@@ -769,6 +806,25 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
 		gsn->points = MEM_callocN(sizeof(bGPDspoint) * gsn->totpoints, "gp_stroke_points");
 		memcpy(gsn->points, pt_tmp + i, sizeof(bGPDspoint) * gsn->totpoints);
 		
+		/* We must adjust timings of this new stroke!
+		 * Each point's timing data is a delta from stroke's inittime, so as we erase the first
+		 * point of the stroke, we have to offset this inittime and all remaing points' delta values.
+		 * This way we get a new stroke with exactly the same timing as if user had started drawing from
+		 * the second point...
+		 */
+		{
+			bGPDspoint *pts;
+			float delta = pt_tmp[i].time;
+			int j;
+			
+			gsn->inittime += (double)delta;
+			
+			pts = gsn->points;
+			for (j = 0; j < gsn->totpoints; j++, pts++) {
+				pts->time -= delta;
+			}
+		}
+		
 		/* adjust existing stroke  */
 		gps->totpoints = i;
 		gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
@@ -787,11 +843,16 @@ static short gp_stroke_eraser_strokeinside(const int mval[], const int UNUSED(mv
                                            int rad, int x0, int y0, int x1, int y1)
 {
 	/* simple within-radius check for now */
-	if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1))
-		return 1;
+	const float mval_fl[2]     = {mval[0], mval[1]};
+	const float screen_co_a[2] = {x0, y0};
+	const float screen_co_b[2] = {x1, y1};
+	
+	if (edge_inside_circle(mval_fl, rad, screen_co_a, screen_co_b)) {
+		return TRUE;
+	}
 	
 	/* not inside */
-	return 0;
+	return FALSE;
 } 
 
 static void gp_point_to_xy(ARegion *ar, View2D *v2d, rctf *subrect, bGPDstroke *gps, bGPDspoint *pt,
@@ -826,7 +887,7 @@ static void gp_point_to_xy(ARegion *ar, View2D *v2d, rctf *subrect, bGPDstroke *
 
 
 /* eraser tool - evaluation per stroke */
-// TODO: this could really do with some optimization (KD-Tree/BVH?)
+/* TODO: this could really do with some optimization (KD-Tree/BVH?) */
 static void gp_stroke_eraser_dostroke(tGPsdata *p,
                                       const int mval[], const int mvalo[],
                                       short rad, const rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
@@ -845,7 +906,6 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 		gp_point_to_xy(p->ar, p->v2d, p->subrect, gps, gps->points, &x0, &y0);
 		
 		/* do boundbox check first */
-
 		if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) {
 			/* only check if point is inside */
 			if (((x0 - mval[0]) * (x0 - mval[0]) + (y0 - mval[1]) * (y0 - mval[1])) <= rad * rad) {
@@ -855,7 +915,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 			}
 		}
 	}
-	else {	
+	else {
 		/* loop over the points in the stroke, checking for intersections 
 		 *  - an intersection will require the stroke to be split
 		 */
@@ -863,10 +923,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 			/* get points to work with */
 			pt1 = gps->points + i;
 			pt2 = gps->points + i + 1;
-
+			
 			gp_point_to_xy(p->ar, p->v2d, p->subrect, gps, pt1, &x0, &y0);
 			gp_point_to_xy(p->ar, p->v2d, p->subrect, gps, pt2, &x1, &y1);
-
+			
 			/* check that point segment of the boundbox of the eraser stroke */
 			if (((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) ||
 			    ((!ELEM(V2D_IS_CLIPPED, x1, y1)) && BLI_rcti_isect_pt(rect, x1, y1))) {
@@ -914,11 +974,11 @@ static void gp_session_validatebuffer(tGPsdata *p)
 	
 	/* clear memory of buffer (or allocate it if starting a new session) */
 	if (gpd->sbuffer) {
-		//printf("\t\tGP - reset sbuffer\n");
+		/* printf("\t\tGP - reset sbuffer\n"); */
 		memset(gpd->sbuffer, 0, sizeof(tGPspoint) * GP_STROKE_BUFFER_MAX);
 	}
 	else {
-		//printf("\t\tGP - allocate sbuffer\n");
+		/* printf("\t\tGP - allocate sbuffer\n"); */
 		gpd->sbuffer = MEM_callocN(sizeof(tGPspoint) * GP_STROKE_BUFFER_MAX, "gp_session_strokebuffer");
 	}
 	
@@ -927,6 +987,9 @@ static void gp_session_validatebuffer(tGPsdata *p)
 	
 	/* reset flags */
 	gpd->sbuffer_sflag = 0;
+
+	/* reset inittime */
+	p->inittime = 0.0;
 }
 
 /* (re)init new painting data */
@@ -954,8 +1017,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
 		/* supported views first */
 		case SPACE_VIEW3D:
 		{
-			// View3D *v3d= curarea->spacedata.first;
-			// RegionView3D *rv3d= ar->regiondata;
+			/* View3D *v3d = curarea->spacedata.first; */
+			/* RegionView3D *rv3d = ar->regiondata; */
 			
 			/* set current area 
 			 *	- must verify that region data is 3D-view (and not something else)
@@ -971,10 +1034,10 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
 			}
 		}
 		break;
-
+		
 		case SPACE_NODE:
 		{
-			//SpaceNode *snode= curarea->spacedata.first;
+			/* SpaceNode *snode = curarea->spacedata.first; */
 			
 			/* set current area */
 			p->sa = curarea;
@@ -1002,7 +1065,7 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
 		break;
 		case SPACE_IMAGE:
 		{
-			//SpaceImage *sima= curarea->spacedata.first;
+			/* SpaceImage *sima = curarea->spacedata.first; */
 			
 			/* set the current area */
 			p->sa = curarea;
@@ -1067,7 +1130,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
 	
 	if (ED_gpencil_session_active() == 0) {
 		/* initialize undo stack,
-		 * also, existing undo stack would make buffer drawn */
+		 * also, existing undo stack would make buffer drawn
+		 */
 		gpencil_undo_init(p->gpd);
 	}
 	
@@ -1102,7 +1166,7 @@ static void gp_session_cleanup(tGPsdata *p)
 	
 	/* free stroke buffer */
 	if (gpd->sbuffer) {
-		//printf("\t\tGP - free sbuffer\n");
+		/* printf("\t\tGP - free sbuffer\n"); */
 		MEM_freeN(gpd->sbuffer);
 		gpd->sbuffer = NULL;
 	}
@@ -1110,6 +1174,7 @@ static void gp_session_cleanup(tGPsdata *p)
 	/* clear flags */
 	gpd->sbuffer_size = 0;
 	gpd->sbuffer_sflag = 0;
+	p->inittime = 0.0;
 }
 
 /* init new stroke */
@@ -1205,7 +1270,7 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
 					/* make strokes be drawn in screen space */
 					p->gpd->sbuffer_sflag &= ~GP_STROKE_2DSPACE;
 					p->gpd->flag &= ~GP_DATA_VIEWALIGN;
-				}	
+				}
 				else
 					p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
 			}
@@ -1254,7 +1319,8 @@ static void gp_paint_strokeend(tGPsdata *p)
 static void gp_paint_cleanup(tGPsdata *p)
 {
 	/* p->gpd==NULL happens when stroke failed to initialize,
-	 * for example. when GP is hidden in current space (sergey) */
+	 * for example when GP is hidden in current space (sergey)
+	 */
 	if (p->gpd) {
 		/* finish off a stroke */
 		gp_paint_strokeend(p);
@@ -1302,7 +1368,7 @@ static void gpencil_draw_toggle_eraser_cursor(bContext *C, tGPsdata *p, short en
 	else if (enable) {
 		/* enable cursor */
 		p->erasercursor = WM_paint_cursor_activate(CTX_wm_manager(C), 
-		                                           NULL, // XXX
+		                                           NULL, /* XXX */
 		                                           gpencil_draw_eraser, p);
 	}
 }
@@ -1337,7 +1403,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 		gp_session_cleanup(p);
 		
 		/* finally, free the temp data */
-		MEM_freeN(p);	
+		MEM_freeN(p);
 	}
 	
 	op->customdata = NULL;
@@ -1443,16 +1509,26 @@ static void gpencil_draw_apply(wmOperator *op, tGPsdata *p)
 	/* only add current point to buffer if mouse moved (even though we got an event, it might be just noise) */
 	else if (gp_stroke_filtermval(p, p->mval, p->mvalo)) {
 		/* try to add point */
-		short ok = gp_stroke_addpoint(p, p->mval, p->pressure);
+		short ok = gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime);
 		
 		/* handle errors while adding point */
 		if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) {
 			/* finish off old stroke */
 			gp_paint_strokeend(p);
+			/* And start a new one!!! Else, projection errors! */
+			gp_paint_initstroke(p, p->paintmode);
 			
 			/* start a new stroke, starting from previous point */
-			gp_stroke_addpoint(p, p->mvalo, p->opressure);
-			gp_stroke_addpoint(p, p->mval, p->pressure);
+			/* XXX Must manually reset inittime... */
+			/* XXX We only need to reuse previous point if overflow! */
+			if (ok == GP_STROKEADD_OVERFLOW) {
+				p->inittime = p->ocurtime;
+				gp_stroke_addpoint(p, p->mvalo, p->opressure, p->ocurtime);
+			}
+			else {
+				p->inittime = p->curtime;
+			}
+			gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime);
 		}
 		else if (ok == GP_STROKEADD_INVALID) {
 			/* the painting operation cannot continue... */
@@ -1468,6 +1544,7 @@ static void gpencil_draw_apply(wmOperator *op, tGPsdata *p)
 		p->mvalo[0] = p->mval[0];
 		p->mvalo[1] = p->mval[1];
 		p->opressure = p->pressure;
+		p->ocurtime = p->curtime;
 	}
 }
 
@@ -1478,13 +1555,14 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
 	PointerRNA itemptr;
 	float mousef[2];
 	int tablet = 0;
-
+	
 	/* convert from window-space to area-space mouse coordinates
-	 * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding... 
+	 * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
 	 */
 	p->mval[0] = event->mval[0] + 1;
 	p->mval[1] = event->mval[1] + 1;
-
+	p->curtime = PIL_check_seconds_timer();
+	
 	/* handle pressure sensitivity (which is supplied by tablets) */
 	if (event->custom == EVT_DATA_TABLET) {
 		wmTabletData *wmtab = event->customdata;
@@ -1492,8 +1570,8 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
 		tablet = (wmtab->Active != EVT_TABLET_NONE);
 		p->pressure = wmtab->Pressure;
 		
-		//if (wmtab->Active == EVT_TABLET_ERASER)
-		// TODO... this should get caught by the keymaps which call drawing in the first place
+		/* if (wmtab->Active == EVT_TABLET_ERASER) */
+		/* TODO... this should get caught by the keymaps which call drawing in the first place */
 	}
 	else
 		p->pressure = 1.0f;
@@ -1514,14 +1592,17 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
 		p->mvalo[0] = p->mval[0];
 		p->mvalo[1] = p->mval[1];
 		p->opressure = p->pressure;
+		p->inittime = p->ocurtime = p->curtime;
 		
 		/* special exception here for too high pressure values on first touch in
-		 *  windows for some tablets, then we just skip first touch ..  
+		 *  windows for some tablets, then we just skip first touch...
 		 */
 		if (tablet && (p->pressure >= 0.99f))
 			return;
 	}
 	
+	RNA_float_set(&itemptr, "time", p->curtime - p->inittime);
+	
 	/* apply the current latest drawing point */
 	gpencil_draw_apply(op, p);
 	
@@ -1536,18 +1617,18 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
 {
 	tGPsdata *p = NULL;
 	
-	//printf("GPencil - Starting Re-Drawing\n");
+	/* printf("GPencil - Starting Re-Drawing\n"); */
 	
 	/* try to initialize context data needed while drawing */
 	if (!gpencil_draw_init(C, op)) {
 		if (op->customdata) MEM_freeN(op->customdata);
-		//printf("\tGP - no valid data\n");
+		/* printf("\tGP - no valid data\n"); */
 		return OPERATOR_CANCELLED;
 	}
 	else
 		p = op->customdata;
 	
-	//printf("\tGP - Start redrawing stroke\n");
+	/* printf("\tGP - Start redrawing stroke\n"); */
 	
 	/* loop over the stroke RNA elements recorded (i.e. progress of mouse movement),
 	 * setting the relevant values in context at each step, then applying
@@ -1556,20 +1637,21 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
 	{
 		float mousef[2];
 		
-		//printf("\t\tGP - stroke elem\n");
+		/* printf("\t\tGP - stroke elem\n"); */
 		
 		/* get relevant data for this point from stroke */
 		RNA_float_get_array(&itemptr, "mouse", mousef);
 		p->mval[0] = (int)mousef[0];
 		p->mval[1] = (int)mousef[1];
 		p->pressure = RNA_float_get(&itemptr, "pressure");
+		p->curtime = (double)RNA_float_get(&itemptr, "time") + p->inittime;
 		
 		if (RNA_boolean_get(&itemptr, "is_start")) {
 			/* if first-run flag isn't set already (i.e. not true first stroke),
 			 * then we must terminate the previous one first before continuing
 			 */
 			if ((p->flags & GP_PAINTFLAG_FIRSTRUN) == 0) {
-				// TODO: both of these ops can set error-status, but we probably don't need to worry
+				/* TODO: both of these ops can set error-status, but we probably don't need to worry */
 				gp_paint_strokeend(p);
 				gp_paint_initstroke(p, p->paintmode);
 			}
@@ -1582,6 +1664,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
 			p->mvalo[0] = p->mval[0];
 			p->mvalo[1] = p->mval[1];
 			p->opressure = p->pressure;
+			p->ocurtime = p->curtime;
 		}
 		
 		/* apply this data as necessary now (as per usual) */
@@ -1589,7 +1672,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
 	}
 	RNA_END;
 	
-	//printf("\tGP - done\n");
+	/* printf("\tGP - done\n"); */
 	
 	/* cleanup */
 	gpencil_draw_exit(C, op);
@@ -1635,7 +1718,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	
 	/* set cursor */
 	if (p->paintmode == GP_PAINTMODE_ERASER)
-		WM_cursor_modal(win, BC_CROSSCURSOR);  // XXX need a better cursor
+		WM_cursor_modal(win, BC_CROSSCURSOR);  /* XXX need a better cursor */
 	else
 		WM_cursor_modal(win, BC_PAINTBRUSHCURSOR);
 	
@@ -1643,9 +1726,9 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	 * painting should start immediately. Otherwise, this was called from a toolbar, in which
 	 * case we should wait for the mouse to be clicked.
 	 */
-	if (event->type) {
+	if (event->val == KM_PRESS) {
 		/* hotkey invoked - start drawing */
-		//printf("\tGP - set first spot\n");
+		/* printf("\tGP - set first spot\n"); */
 		p->status = GP_STATUS_PAINTING;
 		
 		/* handle the initial drawing - i.e. for just doing a simple dot */
@@ -1653,7 +1736,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 	else {
 		/* toolbar invoked - don't start drawing yet... */
-		//printf("\tGP - hotkey invoked... waiting for click-drag\n");
+		/* printf("\tGP - hotkey invoked... waiting for click-drag\n"); */
 	}
 	
 	WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
@@ -1672,7 +1755,7 @@ static int gpencil_area_exists(bContext *C, ScrArea *sa_test)
 static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
 {
 	tGPsdata *p = op->customdata;
-
+	
 	/* we must check that we're still within the area that we're set up to work from
 	 * otherwise we could crash (see bug #20586)
 	 */
@@ -1680,20 +1763,20 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
 		printf("\t\t\tGP - wrong area execution abort!\n");
 		p->status = GP_STATUS_ERROR;
 	}
-
-	//printf("\t\tGP - start stroke\n");
-
+	
+	/* printf("\t\tGP - start stroke\n"); */
+	
 	/* we may need to set up paint env again if we're resuming */
 	/* XXX: watch it with the paintmode! in future,
 	 *      it'd be nice to allow changing paint-mode when in sketching-sessions */
 	/* XXX: with tablet events, we may event want to check for eraser here, for nicer tablet support */
-
+	
 	if (gp_session_initdata(C, p))
 		gp_paint_initstroke(p, p->paintmode);
-
+	
 	if (p->status != GP_STATUS_ERROR)
 		p->status = GP_STATUS_PAINTING;
-
+	
 	return op->customdata;
 }
 
@@ -1718,7 +1801,7 @@ static void gpencil_stroke_end(wmOperator *op)
 static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	tGPsdata *p = op->customdata;
-	int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */
+	int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */
 	
 	/* if (event->type == NDOF_MOTION)
 	 *    return OPERATOR_PASS_THROUGH;
@@ -1730,8 +1813,19 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 	 * the stroke is converted to 3D only after
 	 * it is finished. This approach should work
 	 * better in tools that immediately apply
-	 * in 3D space. */
+	 * in 3D space.
+	 */
 
+	/* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */
+	if (ISKEYBOARD(event->type)) {
+		if (ELEM4(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY)) {
+			/* allow some keys - for frame changing: [#33412] */
+		}
+		else {
+			estate = OPERATOR_RUNNING_MODAL;
+		}
+	}
+	
 	//printf("\tGP - handle modal event...\n");
 	
 	/* exit painting mode (and/or end current stroke) 
@@ -1739,7 +1833,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 	 */
 	if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) {
 		/* exit() ends the current stroke before cleaning up */
-		//printf("\t\tGP - end of paint op + end of stroke\n");
+		/* printf("\t\tGP - end of paint op + end of stroke\n"); */
 		p->status = GP_STATUS_DONE;
 		estate = OPERATOR_FINISHED;
 	}
@@ -1763,7 +1857,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 			
 			if (sketch) {
 				/* end stroke only, and then wait to resume painting soon */
-				//printf("\t\tGP - end stroke only\n");
+				/* printf("\t\tGP - end stroke only\n"); */
 				gpencil_stroke_end(op);
 				
 				/* we've just entered idling state, so this event was processed (but no others yet) */
@@ -1773,7 +1867,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 				WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
 			}
 			else {
-				//printf("\t\tGP - end of stroke + op\n");
+				/* printf("\t\tGP - end of stroke + op\n"); */
 				p->status = GP_STATUS_DONE;
 				estate = OPERATOR_FINISHED;
 			}
@@ -1785,7 +1879,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 			if (p->status == GP_STATUS_ERROR) {
 				estate = OPERATOR_CANCELLED;
 			}
-		} 
+		}
 		else {
 			p->status = GP_STATUS_IDLING;
 		}
@@ -1796,7 +1890,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 		/* handle painting mouse-movements? */
 		if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) {
 			/* handle drawing event */
-			//printf("\t\tGP - add point\n");
+			/* printf("\t\tGP - add point\n"); */
 			gpencil_draw_apply_event(op, event);
 			
 			/* finish painting operation if anything went wrong just now */
@@ -1806,7 +1900,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 			}
 			else {
 				/* event handled, so just tag as running modal */
-				//printf("\t\t\t\tGP - add point handled!\n");
+				/* printf("\t\t\t\tGP - add point handled!\n"); */
 				estate = OPERATOR_RUNNING_MODAL;
 			}
 		}
@@ -1817,7 +1911,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 			/* just resize the brush (local version)
 			 * TODO: fix the hardcoded size jumps (set to make a visible difference) and hardcoded keys
 			 */
-			//printf("\t\tGP - resize eraser\n");
+			/* printf("\t\tGP - resize eraser\n"); */
 			switch (event->type) {
 				case WHEELUPMOUSE: /* larger */
 				case PADPLUSKEY:
@@ -1883,10 +1977,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
 /* ------------------------------- */
 
 static EnumPropertyItem prop_gpencil_drawmodes[] = {
-	{GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""},
-	{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""},
-	{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""},
-	{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""},
+	{GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", "Draw freehand stroke(s)"},
+	{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"},
+	{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"},
+	{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", "Erase Grease Pencil strokes"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -1908,7 +2002,7 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 	
 	/* settings for drawing */
-	RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements");
 	
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 1d461f7..5cc1eca 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -56,6 +56,7 @@ struct wmKeyConfig;
 typedef struct tGPspoint {
 	int x, y;               /* x and y coordinates of cursor (in relative to area) */
 	float pressure;         /* pressure of tablet at this point */
+	float time;             /* Time relative to stroke start (used when converting to path) */
 } tGPspoint;
 
 
@@ -96,12 +97,13 @@ void  ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode
 void  ED_gplayer_frames_delete(struct bGPDlayer *gpl);
 void  ED_gplayer_frames_duplicate(struct bGPDlayer *gpl);
 
+void  ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode);
+
 #if 0
 void free_gpcopybuf(void);
 void copy_gpdata(void);
 void paste_gpdata(void);
 
-void snap_gplayer_frames(struct bGPDlayer *gpl, short mode);
 void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode);
 #endif
 
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index a50b339..9b726ce 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -49,7 +49,7 @@ void          ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sim
 
 int ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]);
 struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r);
-void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock);
+void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock);
 int ED_space_image_has_buffer(struct SpaceImage *sima);
 
 void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index dc40b68..6644f59 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -83,13 +83,14 @@ void  ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mod
 void ED_masklayer_frames_delete(struct MaskLayer *masklay);
 void ED_masklayer_frames_duplicate(struct MaskLayer *masklay);
 
+void ED_masklayer_snap_frames(struct MaskLayer *masklay, struct Scene *scene, short mode);
+
 #if 0
 void free_gpcopybuf(void);
 void copy_gpdata(void);
 void paste_gpdata(void);
 
- void snap_masklayer_frames(struct MaskLayer *masklay, short mode);
- void mirror_masklayer_frames(struct MaskLayer *masklay, short mode);
+void mirror_masklayer_frames(struct MaskLayer *masklay, short mode);
 #endif
 
 #endif /* __ED_MASK_H__ */
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 5ce6db9..1321765 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -38,7 +38,7 @@ struct wmKeyConfig;
 void ED_operatortypes_metaball(void);
 void ED_keymap_metaball(struct wmKeyConfig *keyconf);
 
-struct MetaElem *add_metaball_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newname);
+struct MetaElem *add_metaball_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], float dia, int type, int newname);
 
 int mouse_mball(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
 
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 093872c..865da8f 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -61,6 +61,7 @@ struct BMEditMesh;
 struct BMEditSelection;
 struct BMesh;
 struct BMVert;
+struct BMLoop;
 struct MLoopCol;
 struct BMEdge;
 struct BMFace;
@@ -118,6 +119,7 @@ void EDBM_update_generic(struct bContext *C, struct BMEditMesh *em, const short
 
 struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands);
 void                 EDBM_uv_element_map_free(struct UvElementMap *vmap);
+struct UvElement *ED_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l);
 
 int              EDBM_mtexpoly_check(struct BMEditMesh *em);
 struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy, int selected);
@@ -142,15 +144,20 @@ int  EDBM_backbuf_border_mask_init(struct ViewContext *vc, const int mcords[][2]
                                    short xmin, short ymin, short xmax, short ymax);
 int  EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
 
-struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, int *dist, short sel, short strict);
-struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, int *dist);
-struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, int *dist);
+struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, float *r_dist, const short sel, const short strict);
+struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, float *r_dist);
+struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, float *r_dist);
 
 int  EDBM_select_pick(struct bContext *C, const int mval[2], short extend, short deselect, short toggle);
 
 void EDBM_selectmode_set(struct BMEditMesh *em);
 void EDBM_selectmode_convert(struct BMEditMesh *em, const short selectmode_old, const short selectmode_new);
 
+/* user access this */
+int EDBM_selectmode_toggle(struct bContext *C, const short selectmode_new,
+                           const int action, const int use_extend, const int use_expand);
+
+
 void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
 
 void EDBM_select_toggle_all(struct BMEditMesh *em);
@@ -248,7 +255,7 @@ void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int c
 int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
 int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me);
-int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum);
+int ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum);
 int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
 int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 9836d69..0d0b8d8 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -35,22 +35,31 @@
 extern "C" {
 #endif
 
+struct BMEdge;
+struct BMFace;
+struct BMVert;
+struct BPoint;
 struct Base;
-struct bConstraint;
-struct bContext;
-struct bPoseChannel;
+struct BezTriple;
 struct Curve;
+struct EditBone;
 struct EnumPropertyItem;
 struct ID;
 struct KeyBlock;
 struct Lattice;
 struct Main;
 struct Mesh;
+struct MetaElem;
 struct ModifierData;
+struct Nurb;
 struct Object;
 struct ReportList;
 struct Scene;
 struct View3D;
+struct ViewContext;
+struct bConstraint;
+struct bContext;
+struct bPoseChannel;
 struct wmEvent;
 struct wmKeyConfig;
 struct wmKeyMap;
@@ -82,8 +91,10 @@ typedef enum eParentType {
 	PAR_TRIA
 } eParentType;
 
+#ifdef __RNA_TYPES_H__
 extern struct EnumPropertyItem prop_clear_parent_types[];
 extern struct EnumPropertyItem prop_make_parent_types[];
+#endif
 
 int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob,
                          struct Object *par, int partype, int xmirror, int keep_transform);
@@ -123,7 +134,8 @@ void ED_object_location_from_view(struct bContext *C, float loc[3]);
 void ED_object_rotation_from_view(struct bContext *C, float rot[3]);
 void ED_object_base_init_transform(struct bContext *C, struct Base *base, const float loc[3], const float rot[3]);
 float ED_object_new_primitive_matrix(struct bContext *C, struct Object *editob,
-                                     const float loc[3], const float rot[3], float primmat[][4]);
+                                     const float loc[3], const float rot[3], float primmat[][4],
+                                     int apply_diameter);
 
 void ED_object_add_generic_props(struct wmOperatorType *ot, int do_editmode);
 int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op,  float loc[3], float rot[3],
@@ -183,7 +195,7 @@ int ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, int include
 
 int ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
 
-/* ibject_select.c */
+/* object_select.c */
 void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
 
 #ifdef __cplusplus
@@ -191,4 +203,3 @@ void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
 #endif
 
 #endif /* __ED_OBJECT_H__ */
-
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 527ebb6..9f42fd0 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -94,7 +94,7 @@ typedef struct AZone {
 	/* for draw */
 	short x1, y1, x2, y2;
 	/* for clip */
-	rcti rect;	
+	rcti rect;
 } AZone;
 
 /* actionzone type */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index f71133d..f15f241 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -37,6 +37,7 @@ struct BMEdge;
 struct BMFace;
 struct BMVert;
 struct BPoint;
+struct Base;
 struct BezTriple;
 struct BezTriple;
 struct BoundBox;
@@ -50,9 +51,12 @@ struct Nurb;
 struct Object;
 struct RegionView3D;
 struct Scene;
+struct ScrArea;
 struct View3D;
 struct ViewContext;
 struct bContext;
+struct bPoseChannel;
+struct bScreen;
 struct bglMats;
 struct rcti;
 struct wmOperator;
@@ -80,24 +84,8 @@ typedef struct ViewDepths {
 	char damaged;
 } ViewDepths;
 
-/* enum for passing to foreach functions to test RV3D_CLIPPING */
-typedef enum eV3DClipTest {
-	V3D_CLIP_TEST_OFF =            0, /* clipping is off */
-	V3D_CLIP_TEST_RV3D_CLIPPING =  1, /* clip single points */
-	V3D_CLIP_TEST_REGION =         2  /* use for edges to check if both verts are in the view, but not RV3D_CLIPPING */
-} eV3DClipTest;
-
 float *give_cursor(struct Scene *scene, struct View3D *v3d);
 
-int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
-
-void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
-void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
-void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
-
-void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
 void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist);
 void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist);
 
@@ -112,11 +100,6 @@ void  ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
 /* Projection */
 #define IS_CLIPPED        12000
 
-/* TODO, these functions work quite differently, we should make them behave in a uniform way
- * otherwise we can't be sure bugs are not added when we need to move from short->float types for eg
- * - Campbell */
-
-
 /* return values for ED_view3d_project_...() */
 typedef enum {
 	V3D_PROJ_RET_OK   = 0,
@@ -133,50 +116,97 @@ typedef enum {
 	V3D_PROJ_TEST_CLIP_WIN   = (1 << 1),
 } eV3DProjTest;
 
+#define V3D_PROJ_TEST_CLIP_DEFAULT (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN)
+#define V3D_PROJ_TEST_ALL          (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN)
+
+
+/* view3d_iterators.c */
+
+/* foreach iterators */
+void mesh_foreachScreenVert(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index),
+        void *userData, const eV3DProjTest clip_flag);
+void mesh_foreachScreenEdge(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2],
+                     int index),
+        void *userData, const eV3DProjTest clip_flag);
+void mesh_foreachScreenFace(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index),
+        void *userData, const eV3DProjTest clip_flag);
+void nurbs_foreachScreenVert(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt,
+                     int beztindex, const float screen_co[2]),
+        void *userData, const eV3DProjTest clip_flag);
+void mball_foreachScreenElem(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct MetaElem *ml, const float screen_co[2]),
+        void *userData, const eV3DProjTest clip_flag);
+void lattice_foreachScreenVert(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BPoint *bp,
+                     const float screen_co[2]),
+        void *userData, const eV3DProjTest clip_flag);
+void armature_foreachScreenBone(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct EditBone *ebone,
+                     const float screen_co_a[2], const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag);
+void pose_foreachScreenBone(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct bPoseChannel *pchan,
+                     const float screen_co_a[2], const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag);
+/* *** end iterators *** */
+
+
+/* view3d_project.c */
+void ED_view3d_project_float_v2_m4(const struct ARegion *a, const float co[3], float r_co[2], float mat[4][4]);
+void ED_view3d_project_float_v3_m4(struct ARegion *a, const float co[3], float r_co[3], float mat[4][4]);
+
+eV3DProjStatus ED_view3d_project_base(struct ARegion *ar, struct Base *base);
 
 /* *** short *** */
 eV3DProjStatus ED_view3d_project_short_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                          const float co[3], short r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_global(struct ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_object(struct ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag);
+                                          const float co[3], short r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_short_global(struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_short_object(struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
 
 /* *** int *** */
 eV3DProjStatus ED_view3d_project_int_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], int r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_global(struct ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_object(struct ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag);
+                                        const float co[3], int r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_int_global(struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_int_object(struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
 
 /* *** float *** */
 eV3DProjStatus ED_view3d_project_float_ex(struct ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], float r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_global(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_object(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
+                                        const float co[3], float r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_float_global(struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
+eV3DProjStatus ED_view3d_project_float_object(struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
 
-void ED_view3d_project_float_v2_m4(const struct ARegion *a, const float co[3], float r_co[2], float mat[4][4]);
-void ED_view3d_project_float_v3_m4(struct ARegion *a, const float co[3], float r_co[3], float mat[4][4]);
+int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
+void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
+void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
+void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
+void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
+void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
+void ED_view3d_win_to_segment(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+int  ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
+void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z);
+
+/* end */
 
-/* Base's get their own function since its a common operation */
-eV3DProjStatus ED_view3d_project_base(struct ARegion *ar, struct Base *base);
 
-void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z);
 
 int  ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
 int  ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend);
-void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
 void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift);
 void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
 
-/* drawobject.c iterators */
-void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, eV3DClipTest clipVerts);
-void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, eV3DClipTest clipVerts);
-void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct BMFace *efa, int x, int y, int index), void *userData);
-void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt, int beztindex, int x, int y), void *userData);
-void mball_foreachScreenElem(struct ViewContext *vc, void (*func)(void *userData, struct MetaElem *ml, int x, int y), void *userData);
-void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
-void armature_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct EditBone *ebone, int x0, int y0, int x1, int y1), void *userData);
-void pose_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct bPoseChannel *pchan, int x0, int y0, int x1, int y1), void *userData);
-
-
 void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect);
 void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
 int  ED_view3d_clipping_test(struct RegionView3D *rv3d, const float vec[3], const int is_local);
@@ -186,12 +216,16 @@ void ED_view3d_clipping_disable(void);
 
 float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]);
 
+float ED_view3d_radius_to_persp_dist(const float angle, const float radius);
+float ED_view3d_radius_to_ortho_dist(const float lens, const float radius);
+
 void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]);
 
 /* backbuffer select and draw support */
 void view3d_validate_backbuf(struct ViewContext *vc);
 struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
-unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict,
+unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2], int size,
+                                        unsigned int min, unsigned int max, float *dist, short strict,
                                         void *handle, unsigned int (*indextest)(void *handle, unsigned int index));
 unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
 
@@ -215,7 +249,7 @@ int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], cons
 void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
 
 /* XXX should move to BLI_math */
-int edge_inside_circle(int centx, int centy, int rad, int x1, int y1, int x2, int y2);
+int edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]);
 
 /* get 3d region from context, also if mouse is in header or toolbar */
 struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
@@ -228,6 +262,7 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d);
 int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
 
 int ED_view3d_context_activate(struct bContext *C);
+void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d);
 void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
                               int winx, int winy, float viewmat[][4], float winmat[][4], int do_bgpic, int colormanage_background);
 
@@ -259,6 +294,10 @@ struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
 void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
 void ED_view3D_background_image_clear(struct View3D *v3d);
 
+#define VIEW3D_MARGIN 1.4f
+float ED_view3d_offset_distance(float mat[4][4], float ofs[3]);
+
+float ED_scene_grid_scale(struct Scene *scene, const char **grid_unit);
 float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit);
 
 /* view matrix properties utilities */
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index ef7b8ed..99f7f08 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -94,10 +94,10 @@ DEF_ICON(LINK)
 DEF_ICON(INLINK)
 DEF_ICON(PLUGIN)
 	
-	/* various ui */	
+	/* various ui */
 DEF_ICON(HELP)
 DEF_ICON(GHOST_ENABLED)
-DEF_ICON(COLOR)
+DEF_ICON(COLOR)  /* see COLOR_RED/GREEN/BLUE */
 DEF_ICON(LINKED)
 DEF_ICON(UNLINKED)
 DEF_ICON(HAND)
@@ -428,9 +428,11 @@ DEF_ICON(CURVE_PATH)
 	DEF_ICON(BLANK646)
 	DEF_ICON(BLANK647)
 	DEF_ICON(BLANK648)
-	DEF_ICON(BLANK649)
-	DEF_ICON(BLANK650)
-	DEF_ICON(BLANK651)
+#endif
+DEF_ICON(COLOR_RED)
+DEF_ICON(COLOR_GREEN)
+DEF_ICON(COLOR_BLUE)
+#ifndef DEF_ICON_BLANK_SKIP
 	DEF_ICON(BLANK652)
 	DEF_ICON(BLANK653)
 	DEF_ICON(BLANK654)
@@ -450,8 +452,8 @@ DEF_ICON(FORCE_CURVE)
 DEF_ICON(FORCE_BOID)
 DEF_ICON(FORCE_TURBULENCE)
 DEF_ICON(FORCE_DRAG)
+DEF_ICON(FORCE_SMOKEFLOW)
 #ifndef DEF_ICON_BLANK_SKIP
-	DEF_ICON(BLANK672)
 	DEF_ICON(BLANK673)
 	DEF_ICON(BLANK674)
 	DEF_ICON(BLANK675)
@@ -593,6 +595,7 @@ DEF_ICON(MOD_REMESH)
 DEF_ICON(MOD_OCEAN)
 DEF_ICON(MOD_WARP)
 DEF_ICON(MOD_SKIN)
+DEF_ICON(MOD_TRIANGULATE)
 #ifndef DEF_ICON_BLANK_SKIP
 	DEF_ICON(BLANK166)
 	DEF_ICON(BLANK167)
@@ -606,7 +609,6 @@ DEF_ICON(MOD_SKIN)
 	DEF_ICON(BLANK175)
 	DEF_ICON(BLANK176)
 	DEF_ICON(BLANK177)
-	DEF_ICON(BLANK177b)
 #endif
 	
 	/* ANIMATION */
@@ -799,13 +801,12 @@ DEF_ICON(NDOF_TRANS)
 DEF_ICON(LAYER_USED)
 DEF_ICON(LAYER_ACTIVE)
 #ifndef DEF_ICON_BLANK_SKIP
+	/* available */
 	DEF_ICON(BLANK254)
 	DEF_ICON(BLANK255)
 	DEF_ICON(BLANK256)
 	DEF_ICON(BLANK257)
 	DEF_ICON(BLANK257b)
-
-	/* available */
 	DEF_ICON(BLANK258)
 	DEF_ICON(BLANK259)
 	DEF_ICON(BLANK260)
@@ -890,8 +891,8 @@ DEF_ICON(FORWARD)
 	DEF_ICON(BLANK313)
 	DEF_ICON(BLANK314)
 	DEF_ICON(BLANK315)
-	DEF_ICON(BLANK316)
 #endif
+DEF_ICON(FILE_BACKUP)
 DEF_ICON(DISK_DRIVE)
 	
 	/* SHADING / TEXT */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 5d2709f..2dc552d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -106,9 +106,9 @@ typedef struct uiLayout uiLayout;
 /* uiBlock->flag (controls) */
 #define UI_BLOCK_LOOP           1
 #define UI_BLOCK_REDRAW         2
-#define UI_BLOCK_RET_1          4       /* XXX 2.5 not implemented */
+#define UI_BLOCK_SEARCH_MENU    4
 #define UI_BLOCK_NUMSELECT      8
-/*#define UI_BLOCK_ENTER_OK		16*/ /*UNUSED*/
+#define UI_BLOCK_NO_WIN_CLIP    16      /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */
 #define UI_BLOCK_CLIPBOTTOM     32
 #define UI_BLOCK_CLIPTOP        64
 #define UI_BLOCK_MOVEMOUSE_QUIT 128
@@ -542,7 +542,7 @@ typedef struct uiStringInfo {
 /* Note: Expects pointers to uiStringInfo structs as parameters.
  *       Will fill them with translated strings, when possible.
  *       Strings in uiStringInfo must be MEM_freeN'ed by caller. */
-void uiButGetStrInfo(struct bContext *C, uiBut *but, int nbr, ...);
+void uiButGetStrInfo(struct bContext *C, uiBut *but, ...);
 
 /* Edit i18n stuff. */
 /* Name of the main py op from i18n addon. */
@@ -615,7 +615,8 @@ int     uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int
 /* bfunc gets search item *poin as arg2, or if NULL the old string */
 void    uiButSetSearchFunc(uiBut *but,        uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc, void *active);
 /* height in pixels, it's using hardcoded values still */
-int     uiSearchBoxhHeight(void);
+int     uiSearchBoxHeight(void);
+int     uiSearchBoxWidth(void);
 
 void    uiBlockSetHandleFunc(uiBlock *block,    uiBlockHandleFunc func, void *arg);
 void    uiBlockSetButmFunc(uiBlock *block,    uiMenuHandleFunc func, void *arg);
@@ -807,7 +808,7 @@ void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *p
 void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
 void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
 void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush);
-void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
+void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
 void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
                       PointerRNA *used_ptr, const char *used_propname, int active_layer);
 void uiTemplateGameStates(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
@@ -816,6 +817,7 @@ void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *pt
 void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
 void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
 void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
+void uiOperatorSearch_But(uiBut *but);
 void uiTemplateOperatorSearch(uiLayout *layout);
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
 void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index e879a01..f4e921e 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -215,7 +215,11 @@ enum {
 	TH_NLA_META,
 	TH_NLA_META_SEL,
 	TH_NLA_SOUND,
-	TH_NLA_SOUND_SEL
+	TH_NLA_SOUND_SEL,
+	
+	TH_AXIS_X,		/* X/Y/Z Axis */
+	TH_AXIS_Y,
+	TH_AXIS_Z
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d442ce1..ce82e06 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -238,7 +238,7 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
 		bt->rect.xmax = bt->rect.xmin + i + block->bounds;
 		
 		if (col == lastcol) {
-			bt->rect.xmax = maxf(bt->rect.xmax, offset + block->minbounds);
+			bt->rect.xmax = max_ff(bt->rect.xmax, offset + block->minbounds);
 		}
 
 		ui_check_but(bt);  /* clips text again */
@@ -275,7 +275,7 @@ void ui_bounds_block(uiBlock *block)
 		block->rect.ymax += block->bounds;
 	}
 
-	block->rect.xmax = block->rect.xmin + maxf(BLI_rctf_size_x(&block->rect), block->minbounds);
+	block->rect.xmax = block->rect.xmin + max_ff(BLI_rctf_size_x(&block->rect), block->minbounds);
 
 	/* hardcoded exception... but that one is annoying with larger safety */ 
 	bt = block->buttons.first;
@@ -527,7 +527,7 @@ static void ui_draw_links(uiBlock *block)
 					foundselectline = TRUE;
 			}
 		}
-	}	
+	}
 
 	/* Draw any active lines (lines with either button being hovered over).
 	 * Do this last so they appear on top of inactive lines. */
@@ -539,7 +539,7 @@ static void ui_draw_links(uiBlock *block)
 						ui_draw_linkline(line, !foundselectline);
 				}
 			}
-		}	
+		}
 	}
 }
 
@@ -581,7 +581,7 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
 			if (line->from == newbut)
 				line->from = oldbut;
 		}
-	}		
+	}
 	
 	/* check all other button links */
 	for (but = block->buttons.first; but; but = but->next) {
@@ -610,28 +610,28 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
 		if (ui_but_equals_old(oldbut, but)) {
 			if (oldbut->active) {
 #if 0
-//				but->flag= oldbut->flag;
+//				but->flag = oldbut->flag;
 #else
 				/* exception! redalert flag can't be update from old button. 
 				 * perhaps it should only copy specific flags rather than all. */
-//				but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT);
+//				but->flag = (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT);
 #endif
-//				but->active= oldbut->active;
-//				but->pos= oldbut->pos;
-//				but->ofs= oldbut->ofs;
-//				but->editstr= oldbut->editstr;
-//				but->editval= oldbut->editval;
-//				but->editvec= oldbut->editvec;
-//				but->editcoba= oldbut->editcoba;
-//				but->editcumap= oldbut->editcumap;
-//				but->selsta= oldbut->selsta;
-//				but->selend= oldbut->selend;
-//				but->softmin= oldbut->softmin;
-//				but->softmax= oldbut->softmax;
-//				but->linkto[0]= oldbut->linkto[0];
-//				but->linkto[1]= oldbut->linkto[1];
+//				but->active = oldbut->active;
+//				but->pos = oldbut->pos;
+//				but->ofs = oldbut->ofs;
+//				but->editstr = oldbut->editstr;
+//				but->editval = oldbut->editval;
+//				but->editvec = oldbut->editvec;
+//				but->editcoba = oldbut->editcoba;
+//				but->editcumap = oldbut->editcumap;
+//				but->selsta = oldbut->selsta;
+//				but->selend = oldbut->selend;
+//				but->softmin = oldbut->softmin;
+//				but->softmax = oldbut->softmax;
+//				but->linkto[0] = oldbut->linkto[0];
+//				but->linkto[1] = oldbut->linkto[1];
 				found = 1;
-//				oldbut->active= NULL;
+//				oldbut->active = NULL;
 			
 				/* move button over from oldblock to new block */
 				BLI_remlink(&oldblock->buttons, oldbut);
@@ -1270,7 +1270,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
 					(*(link->ppoin))[b] = (*(link->ppoin))[a];
 					b++;
 				}
-			}	
+			}
 			(*(link->totlink))--;
 		}
 	}
@@ -1303,7 +1303,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
 
 		if (RNA_property_type(prop) == PROP_FLOAT) {
 			tot = RNA_property_array_length(&but->rnapoin, prop);
-			tot = MIN2(tot, 3);
+			tot = min_ii(tot, 3);
 
 			for (a = 0; a < tot; a++)
 				vec[a] = RNA_property_float_get_index(&but->rnapoin, prop, a);
@@ -1348,7 +1348,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
 			int a;
 
 			tot = RNA_property_array_length(&but->rnapoin, prop);
-			tot = MIN2(tot, 3);
+			tot = min_ii(tot, 3);
 
 			for (a = 0; a < tot; a++) {
 				RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]);
@@ -1391,7 +1391,7 @@ int ui_is_but_unit(uiBut *but)
 		return 0;
 #endif
 	
-	/* for now disable time unit conversion */	
+	/* for now disable time unit conversion */
 	if (unit_type == PROP_UNIT_TIME)
 		return 0;
 
@@ -1464,16 +1464,16 @@ double ui_get_but_val(uiBut *but)
 			case 'S': value = hsv[1]; break;
 			case 'V': value = hsv[2]; break;
 		}
-	} 
+	}
 	else if (but->pointype == UI_BUT_POIN_CHAR) {
 		value = *(char *)but->poin;
 	}
 	else if (but->pointype == UI_BUT_POIN_SHORT) {
 		value = *(short *)but->poin;
-	} 
+	}
 	else if (but->pointype == UI_BUT_POIN_INT) {
 		value = *(int *)but->poin;
-	} 
+	}
 	else if (but->pointype == UI_BUT_POIN_FLOAT) {
 		value = *(float *)but->poin;
 	}
@@ -1528,7 +1528,9 @@ void ui_set_but_val(uiBut *but, double value)
 		 * so leave this unset */
 		value = UI_BUT_VALUE_UNSET;
 	}
-	else if (but->pointype == 0) ;
+	else if (but->pointype == 0) {
+		/* pass */
+	}
 	else if (but->type == HSVSLI) {
 		float *fp, hsv[3];
 		
@@ -1675,7 +1677,7 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
 {
 	if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
 		PropertyType type;
-		char *buf = NULL;
+		const char *buf = NULL;
 		int buf_len;
 
 		type = RNA_property_type(but->rnaprop);
@@ -1684,19 +1686,30 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
 			/* RNA string */
 			buf = RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
 		}
+		else if (type == PROP_ENUM) {
+			/* RNA enum */
+			int value = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
+			if (RNA_property_enum_name(but->block->evil_C, &but->rnapoin, but->rnaprop, value, &buf)) {
+				BLI_strncpy(str, buf, maxlen);
+				buf = str;
+			}
+		}
 		else if (type == PROP_POINTER) {
 			/* RNA pointer */
 			PointerRNA ptr = RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
 			buf = RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len);
 		}
+		else {
+			BLI_assert(0);
+		}
 
 		if (!buf) {
 			str[0] = '\0';
 		}
 		else if (buf && buf != str) {
 			/* string was too long, we have to truncate */
-			memcpy(str, buf, MIN2(maxlen, buf_len + 1));
-			MEM_freeN(buf);
+			memcpy(str, buf, MIN2(maxlen, (size_t)buf_len + 1));
+			MEM_freeN((void *)buf);
 		}
 	}
 	else if (but->type == IDPOIN) {
@@ -1721,8 +1734,9 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
 		BLI_strncpy(str, but->poin, maxlen);
 		return;
 	}
-	else if (ui_but_anim_expression_get(but, str, maxlen))
-		;  /* driver expression */
+	else if (ui_but_anim_expression_get(but, str, maxlen)) {
+		/* driver expression */
+	}
 	else {
 		/* number editing */
 		double value;
@@ -1838,6 +1852,17 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
 
 				return 0;
 			}
+			else if (type == PROP_ENUM) {
+				int value;
+				if (RNA_property_enum_value(but->block->evil_C, &but->rnapoin, but->rnaprop, str, &value)) {
+					RNA_property_enum_set(&but->rnapoin, but->rnaprop, value);
+					return 1;
+				}
+				return 0;
+			}
+			else {
+				BLI_assert(0);
+			}
 		}
 	}
 	else if (but->type == IDPOIN) {
@@ -1899,8 +1924,9 @@ void ui_set_but_default(bContext *C, short all)
 
 static double soft_range_round_up(double value, double max)
 {
-	/* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
-	double newmax = pow(10.0, ceil(log(value) / M_LN10));
+	/* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, ..
+	 * checking for 0.0 prevents floating point exceptions */
+	double newmax = (value != 0.0) ? pow(10.0, ceil(log(value) / M_LN10)) : 0.0;
 
 	if (newmax * 0.2 >= max && newmax * 0.2 >= value)
 		return newmax * 0.2;
@@ -1912,8 +1938,9 @@ static double soft_range_round_up(double value, double max)
 
 static double soft_range_round_down(double value, double max)
 {
-	/* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
-	double newmax = pow(10.0, floor(log(value) / M_LN10));
+	/* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, ..
+	 * checking for 0.0 prevents floating point exceptions */
+	double newmax = (value != 0.0) ? pow(10.0, floor(log(value) / M_LN10)) : 0.0;
 
 	if (newmax * 5.0 <= max && newmax * 5.0 <= value)
 		return newmax * 5.0;
@@ -1944,8 +1971,8 @@ void ui_set_but_soft_range(uiBut *but, double value)
 			RNA_property_int_ui_range(&but->rnapoin, but->rnaprop, &imin, &imax, &istep);
 			softmin = (imin == INT_MIN) ? -1e4 : imin;
 			softmax = (imin == INT_MAX) ? 1e4 : imax;
-			/*step= istep;*/ /*UNUSED*/
-			/*precision= 1;*/ /*UNUSED*/
+			/*step = istep;*/ /*UNUSED*/
+			/*precision = 1;*/ /*UNUSED*/
 
 			if (array_len >= 2) {
 				int value_range[2];
@@ -1961,8 +1988,8 @@ void ui_set_but_soft_range(uiBut *but, double value)
 			RNA_property_float_ui_range(&but->rnapoin, but->rnaprop, &fmin, &fmax, &fstep, &fprecision);
 			softmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin;
 			softmax = (fmax == FLT_MAX) ? (float)1e4 : fmax;
-			/*step= fstep;*/ /*UNUSED*/
-			/*precision= fprecision;*/ /*UNUSED*/
+			/*step = fstep;*/ /*UNUSED*/
+			/*precision = fprecision;*/ /*UNUSED*/
 
 			if (array_len >= 2) {
 				float value_range[2];
@@ -2003,7 +2030,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
 
 static void ui_free_link(uiLink *link)
 {
-	if (link) {	
+	if (link) {
 		BLI_freelistN(&link->lines);
 		MEM_freeN(link);
 	}
@@ -2052,7 +2079,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
 	uiBut *but;
 
 	while ( (but = block->buttons.first) ) {
-		BLI_remlink(&block->buttons, but);	
+		BLI_remlink(&block->buttons, but);
 		ui_free_but(C, but);
 	}
 
@@ -2253,7 +2280,7 @@ void ui_check_but(uiBut *but)
 	
 	
 	/* safety is 4 to enable small number buttons (like 'users') */
-	// okwidth= -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED
+	// okwidth = -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED
 	
 	/* name: */
 	switch (but->type) {
@@ -2395,7 +2422,7 @@ void uiBlockBeginAlign(uiBlock *block)
 	/* if other align was active, end it */
 	if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
 
-	block->flag |= UI_BUT_ALIGN_DOWN;	
+	block->flag |= UI_BUT_ALIGN_DOWN;
 	block->alignnr++;
 
 	/* buttons declared after this call will get this align nr */ // XXX flag?
@@ -2419,7 +2446,7 @@ void uiBlockEndAlign(uiBlock *block)
 
 int ui_but_can_align(uiBut *but)
 {
-	return !ELEM3(but->type, LABEL, OPTION, OPTIONN);
+	return !ELEM4(but->type, LABEL, OPTION, OPTIONN, SEPR);
 }
 
 static void ui_block_do_align_but(uiBut *first, short nr)
@@ -2436,7 +2463,7 @@ static void ui_block_do_align_but(uiBut *first, short nr)
 		}
 	}
 
-	/* rows==0: 1 row, cols==0: 1 column */
+	/* rows == 0: 1 row, cols == 0: 1 column */
 	
 	/* note;  how it uses 'flag' in loop below (either set it, or OR it) is confusing */
 	for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) {
@@ -2480,7 +2507,9 @@ static void ui_block_do_align_but(uiBut *first, short nr)
 				if (rows > 0) {
 					uiBut *bt = but;
 					while (bt && bt->alignnr == nr) {
-						if (bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next) == 0) break;
+						if (bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next) == 0) {
+							break;
+						}
 						bt = bt->next;
 					}
 					if (bt == NULL || bt->alignnr != nr) flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT;
@@ -2714,9 +2743,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
 	}
 
 	/* keep track of UI_interface.h */
-	if (ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM)) ;
-	else if (ELEM(but->type, SCROLL, SEPR /* , FTPREVIEW */ )) ;
-	else if (but->type >= SEARCH_MENU) ;
+	if      (ELEM9(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM, SCROLL, SEPR /* , FTPREVIEW */)) {}
+	else if (but->type >= SEARCH_MENU) {}
 	else but->flag |= UI_BUT_UNDO;
 
 	BLI_addtail(&block->buttons, but);
@@ -2750,7 +2778,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
 
 
 static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
-							 int x, int y, short width, short height,
+                             int x, int y, short width, short height,
                              PointerRNA *ptr, PropertyRNA *prop, int index,
                              float min, float max, float a1, float a2,  const char *tip)
 {
@@ -2798,6 +2826,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
 			EnumPropertyItem *item;
 			int i, totitem, free;
 
+			/* TODO, translate after getting the item, saves many lookups */
 			RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
 			for (i = 0; i < totitem; i++) {
 				if (item[i].identifier[0] && item[i].value == (int)max) {
@@ -3768,16 +3797,16 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but)
 	wm_event_add(win, &event);
 }
 
-void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
+void uiButGetStrInfo(bContext *C, uiBut *but, ...)
 {
 	va_list args;
+	uiStringInfo *si;
 
 	EnumPropertyItem *items = NULL, *item = NULL;
 	int totitems, free_items = FALSE;
 
-	va_start(args, nbr);
-	while (nbr--) {
-		uiStringInfo *si = (uiStringInfo *) va_arg(args, void *);
+	va_start(args, but);
+	while ((si = (uiStringInfo *) va_arg(args, void *))) {
 		int type = si->type;
 		char *tmp = NULL;
 
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 010df0c..4d96ad8 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -160,13 +160,13 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
 	/* get current color, needs to be outside of glBegin/End */
 	glGetFloatv(GL_CURRENT_COLOR, color);
 
-	/* 'shade' defines strength of shading */	
-	coltop[0]  = minf(1.0f, color[0] + shadetop);
-	coltop[1]  = minf(1.0f, color[1] + shadetop);
-	coltop[2]  = minf(1.0f, color[2] + shadetop);
-	coldown[0] = maxf(0.0f, color[0] + shadedown);
-	coldown[1] = maxf(0.0f, color[1] + shadedown);
-	coldown[2] = maxf(0.0f, color[2] + shadedown);
+	/* 'shade' defines strength of shading */
+	coltop[0]  = min_ff(1.0f, color[0] + shadetop);
+	coltop[1]  = min_ff(1.0f, color[1] + shadetop);
+	coltop[2]  = min_ff(1.0f, color[2] + shadetop);
+	coldown[0] = max_ff(0.0f, color[0] + shadedown);
+	coldown[1] = max_ff(0.0f, color[1] + shadedown);
+	coldown[2] = max_ff(0.0f, color[2] + shadedown);
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(mode);
@@ -269,13 +269,13 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
 	/* get current color, needs to be outside of glBegin/End */
 	glGetFloatv(GL_CURRENT_COLOR, color);
 
-	/* 'shade' defines strength of shading */	
-	colLeft[0]  = minf(1.0f, color[0] + shadeLeft);
-	colLeft[1]  = minf(1.0f, color[1] + shadeLeft);
-	colLeft[2]  = minf(1.0f, color[2] + shadeLeft);
-	colRight[0] = maxf(0.0f, color[0] + shadeRight);
-	colRight[1] = maxf(0.0f, color[1] + shadeRight);
-	colRight[2] = maxf(0.0f, color[2] + shadeRight);
+	/* 'shade' defines strength of shading */
+	colLeft[0]  = min_ff(1.0f, color[0] + shadeLeft);
+	colLeft[1]  = min_ff(1.0f, color[1] + shadeLeft);
+	colLeft[2]  = min_ff(1.0f, color[2] + shadeLeft);
+	colRight[0] = max_ff(0.0f, color[0] + shadeRight);
+	colRight[1] = max_ff(0.0f, color[1] + shadeRight);
+	colRight[2] = max_ff(0.0f, color[2] + shadeRight);
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(mode);
@@ -510,7 +510,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	if (G.selfont && BKE_vfont_is_builtin(G.selfont) == FALSE) {
 		/* Is the font file packed, if so then use the packed file */
 		if (G.selfont->packedfile) {
-			pf = G.selfont->packedfile;		
+			pf = G.selfont->packedfile;
 			FTF_SetFont(pf->data, pf->size, 14.0);
 		}
 		else {
@@ -608,7 +608,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 		ey -= buth;
 		sx = rect->xmin;
 		ex = rect->xmin + butw;
-	}	
+	}
 	glShadeModel(GL_FLAT);
 
 	/* Return Font Settings to original */
@@ -643,7 +643,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor)
 	
 	/* scale widget */
 	scaler_x1 = rect->xmin + BLI_rctf_size_x(rect) / 2 - SCOPE_RESIZE_PAD;
-	scaler_x2 = rect->xmin + BLI_rctf_size_y(rect) / 2 + SCOPE_RESIZE_PAD;
+	scaler_x2 = rect->xmin + BLI_rctf_size_x(rect) / 2 + SCOPE_RESIZE_PAD;
 	
 	glColor4f(0.f, 0.f, 0.f, 0.25f);
 	fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4);
@@ -1221,7 +1221,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 			glColor3ub(255, 255, 255);
 			glVertex2fv(v2);
 			glVertex2fv(v3);
-		}	
+		}
 	}
 	glEnd();
 
@@ -1597,17 +1597,15 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
 		                                            &scopes->undist_marker, scopes->use_track_mask,
 		                                            width, height, scopes->track_pos);
 
-		if (tmpibuf->rect_float)
-			IMB_rect_from_float(tmpibuf);
-
-		/* XXX: for debug only
-		 * tmpibuf->ftype = PNG;
-		 * IMB_saveiff(tmpibuf, "sample.png", IB_rect); */
+		if (tmpibuf) {
+			if (tmpibuf->rect_float)
+				IMB_rect_from_float(tmpibuf);
 
-		if (tmpibuf->rect)
-			scopes->track_preview = tmpibuf;
-		else
-			IMB_freeImBuf(tmpibuf);
+			if (tmpibuf->rect)
+				scopes->track_preview = tmpibuf;
+			else
+				IMB_freeImBuf(tmpibuf);
+		}
 	}
 
 	if (!ok && scopes->track_preview) {
@@ -1707,7 +1705,7 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s
 	glVertex2f(maxx, miny - shadsize);
 	glEnd();
 	
-	/* bottom quad */		
+	/* bottom quad */
 	glBegin(GL_POLYGON);
 	glColor4ub(0, 0, 0, alpha);
 	glVertex2f(minx + 0.3f * shadsize, miny);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index f798f0b..b80025e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -279,12 +279,7 @@ static int ui_is_a_warp_but(uiBut *but)
 
 static float ui_mouse_scale_warp_factor(const short shift)
 {
-	if (U.uiflag & USER_CONTINUOUS_MOUSE) {
-		return shift ? 0.05f : 1.0f;
-	}
-	else {
-		return 1.0f;
-	}
+	return shift ? 0.05f : 1.0f;
 }
 
 static void ui_mouse_scale_warp(uiHandleButtonData *data,
@@ -292,16 +287,11 @@ static void ui_mouse_scale_warp(uiHandleButtonData *data,
                                 float *r_mx, float *r_my,
                                 const short shift)
 {
-	if (U.uiflag & USER_CONTINUOUS_MOUSE) {
-		const float fac = ui_mouse_scale_warp_factor(shift);
-		/* slow down the mouse, this is fairly picky */
-		*r_mx = (data->dragstartx * (1.0f - fac) + mx * fac);
-		*r_my = (data->dragstarty * (1.0f - fac) + my * fac);
-	}
-	else {
-		*r_mx = mx;
-		*r_my = my;
-	}
+	const float fac = ui_mouse_scale_warp_factor(shift);
+	
+	/* slow down the mouse, this is fairly picky */
+	*r_mx = (data->dragstartx * (1.0f - fac) + mx * fac);
+	*r_my = (data->dragstarty * (1.0f - fac) + my * fac);
 }
 
 /* file selectors are exempt from utf-8 checks */
@@ -704,7 +694,7 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
 	
 	BLI_rcti_rctf_copy(&rect, &but->rect);
 	
-	if (but->imb) { 
+	if (but->imb) {
 		/* use button size itself */
 	}
 	else if (but->flag & UI_ICON_LEFT) {
@@ -774,7 +764,7 @@ static void ui_delete_active_linkline(uiBlock *block)
 									(*(link->ppoin))[b] = (*(link->ppoin))[a];
 									b++;
 								}
-							}	
+							}
 							(*(link->totlink))--;
 						}
 					}
@@ -1063,7 +1053,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 			break;
 		case HSVSLI:
 			break;
-		case TOG3:	
+		case TOG3:
 			ui_apply_but_TOG3(C, but, data);
 			break;
 		case MENU:
@@ -1109,10 +1099,10 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 		case INLINK:
 			ui_apply_but_LINK(C, but, data);
 			break;
-		case BUT_IMAGE:	
+		case BUT_IMAGE:
 			ui_apply_but_IMAGE(C, but, data);
 			break;
-		case HISTOGRAM:	
+		case HISTOGRAM:
 			ui_apply_but_HISTOGRAM(C, but, data);
 			break;
 		case WAVEFORM:
@@ -1299,6 +1289,71 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 	}
 }
 
+/* ************************ password text ******************************
+ *
+ * Functions to convert password strings that should not be displayed
+ * to asterisk representation (e.g. mysecretpasswd -> *************)
+ *
+ * It converts every UTF-8 character to an asterisk, and also remaps
+ * the cursor position and selection start/end.
+ *
+ * Note: remaping is used, because password could contain UTF-8 characters.
+ *
+ */
+
+static int ui_text_position_from_hidden(uiBut *but, int pos)
+{
+	const char *strpos;
+	int i;
+
+	for (i = 0, strpos = but->drawstr; i < pos; i++)
+		strpos = BLI_str_find_next_char_utf8(strpos, NULL);
+	
+	return (strpos - but->drawstr);
+}
+
+static int ui_text_position_to_hidden(uiBut *but, int pos)
+{
+	return BLI_strnlen_utf8(but->drawstr, pos);
+}
+
+void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore)
+{
+	if (!(but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_PASSWORD))
+		return;
+
+	if (restore) {
+		/* restore original string */
+		BLI_strncpy(but->drawstr, password_str, UI_MAX_DRAW_STR);
+
+		/* remap cursor positions */
+		if (but->pos >= 0) {
+			but->pos = ui_text_position_from_hidden(but, but->pos);
+			but->selsta = ui_text_position_from_hidden(but, but->selsta);
+			but->selend = ui_text_position_from_hidden(but, but->selend);
+		}
+	}
+	else {
+		/* convert text to hidden test using asterisks (e.g. pass -> ****) */
+		int i, len = BLI_strlen_utf8(but->drawstr);
+
+		/* remap cursor positions */
+		if (but->pos >= 0) {
+			but->pos = ui_text_position_to_hidden(but, but->pos);
+			but->selsta = ui_text_position_to_hidden(but, but->selsta);
+			but->selend = ui_text_position_to_hidden(but, but->selend);
+		}
+
+		/* save original string */
+		BLI_strncpy(password_str, but->drawstr, UI_MAX_DRAW_STR);
+
+		for (i = 0; i < len; i++)
+			but->drawstr[i] = '*';
+		but->drawstr[i] = '\0';
+	}
+}
+
+
 /* ************* in-button text selection/editing ************* */
 
 
@@ -1322,13 +1377,15 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
 	uiStyle *style = UI_GetStyle();  // XXX pass on as arg
 	uiFontStyle *fstyle = &style->widget;
 	int startx = but->rect.xmin;
-	char *origstr;
+	char *origstr, password_str[UI_MAX_DRAW_STR];
 
 	uiStyleFontSet(fstyle);
 
 	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
+	ui_button_text_password_hide(password_str, but, FALSE);
+
 	origstr = MEM_callocN(sizeof(char) * data->maxlen, "ui_textedit origstr");
 	
 	BLI_strncpy(origstr, but->drawstr, data->maxlen);
@@ -1343,7 +1400,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
 	}
 	
 	/* mouse dragged outside the widget to the left */
-	if (x < startx && but->ofs > 0) {	
+	if (x < startx && but->ofs > 0) {
 		int i = but->ofs;
 
 		origstr[but->ofs] = 0;
@@ -1407,6 +1464,8 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
 	if (fstyle->kerning == 1)
 		BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
+	ui_button_text_password_hide(password_str, but, TRUE);
+
 	MEM_freeN(origstr);
 }
 
@@ -1587,7 +1646,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
 				but->pos -= step;
 				changed = 1;
 			}
-		} 
+		}
 	}
 
 	return changed;
@@ -1676,7 +1735,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
 		if (cut)
 			if ((but->selend - but->selsta) > 0)
 				changed = ui_textedit_delete_selection(but, data);
-	} 
+	}
 
 	return changed;
 }
@@ -1715,7 +1774,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
 	/* optional searchbox */
 	if (but->type == SEARCH_MENU) {
 		data->searchbox = ui_searchbox_create(C, data->region, but);
-		ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */
+		ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
 	}
 	
 	ui_check_but(but);
@@ -2157,7 +2216,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
 	}
 
 	/* this makes adjacent blocks auto open from now on */
-	//if (but->block->auto_open ==0 ) but->block->auto_open = 1;
+	//if (but->block->auto_open == 0) but->block->auto_open = 1;
 }
 
 static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -2254,7 +2313,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
 		ED_region_tag_redraw(data->region);
 			
 		if (event->val == KM_PRESS) {
-			if (ISHOTKEY(event->type)) { 
+			if (ISHOTKEY(event->type)) {
 				
 				if (WM_key_event_string(event->type)[0])
 					ui_set_but_val(but, event->type);
@@ -2935,7 +2994,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 					data->value = temp;
 				else
 					data->cancel = TRUE;
-			} 
+			}
 			else {
 				if (f < tempf) tempf -= 0.01f;
 				else tempf += 0.01f;
@@ -2961,7 +3020,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 
 static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my /*, click= 0 */;
+	int mx, my /*, click = 0 */;
 	int retval = WM_UI_HANDLER_CONTINUE;
 	int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
 	
@@ -3237,7 +3296,7 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
 
 	ui_get_but_vectorf(but, rgb);
 
-	if (color_profile && (int)but->a1)
+	if (color_profile && (int)but->a1 != UI_GRAD_SV)
 		ui_block_to_display_space_v3(but->block, rgb);
 
 	rgb_to_hsv_compat_v(rgb, hsv);
@@ -3283,7 +3342,7 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
 
 	hsv_to_rgb_v(hsv, rgb);
 
-	if (color_profile && (int)but->a1)
+	if (color_profile && ((int)but->a1 != UI_GRAD_SV))
 		ui_block_to_scene_linear_v3(but->block, rgb);
 
 	copy_v3_v3(data->vec, rgb);
@@ -3309,7 +3368,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
 
 	ui_get_but_vectorf(but, rgb);
 
-	if (color_profile && (int)but->a1)
+	if (color_profile && (int)but->a1 != UI_GRAD_SV)
 		ui_block_to_display_space_v3(but->block, rgb);
 
 	rgb_to_hsv_compat_v(rgb, hsv);
@@ -3336,7 +3395,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
 		case UI_GRAD_V:
 			hsv[2] += ndof->ry * sensitivity;
 			break;
-		case UI_GRAD_V_ALT:	
+		case UI_GRAD_V_ALT:
 			/* vertical 'value' strip */
 			
 			/* exception only for value strip - use the range set in but->min/max */
@@ -3349,7 +3408,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
 
 	hsv_to_rgb_v(hsv, rgb);
 
-	if (color_profile && (int)but->a1)
+	if (color_profile && (int)but->a1 != UI_GRAD_SV)
 		ui_block_to_scene_linear_v3(but->block, rgb);
 
 	copy_v3_v3(data->vec, rgb);
@@ -3460,7 +3519,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float
 		data->ungrab_mval[0] = mx_fl;
 		data->ungrab_mval[1] = my_fl;
 		{	/* clamp */
-			const float radius = minf(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f;
+			const float radius = min_ff(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f;
 			const float cent[2] = {BLI_rctf_cent_x(&but->rect), BLI_rctf_cent_y(&but->rect)};
 			const float len = len_v2v2(cent, data->ungrab_mval);
 			if (len > radius) {
@@ -3747,8 +3806,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
 
 	zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr);
 	zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr);
-	/* offsx= cumap->curr.xmin; */
-	/* offsy= cumap->curr.ymin; */
+	/* offsx = cumap->curr.xmin; */
+	/* offsy = cumap->curr.ymin; */
 
 	if (snap) {
 		float d[2];
@@ -3904,7 +3963,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
 
 						changed = 1;
 						
-						/* reset cmp back to the curve points again, rather than drawing segments */		
+						/* reset cmp back to the curve points again, rather than drawing segments */
 						cmp = cuma->curve;
 						
 						/* find newly added point and make it 'sel' */
@@ -4008,7 +4067,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
 	}
 	else {
 		/* scale histogram values (dy / 10 for better control) */
-		const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f;
+		const float yfac = min_ff(powf(hist->ymax, 2.0f), 1.0f) * 0.5f;
 		hist->ymax += (dy * 0.1f) * yfac;
 	
 		/* 0.1 allows us to see HDR colors up to 10 */
@@ -4078,7 +4137,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
 	Scopes *scopes = (Scopes *)but->poin;
 	/* rcti rect; */
 	int changed = 1;
-	float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
+	float /* dx, */ dy /* , yfac =1.0f */; /* UNUSED */
 
 	/* BLI_rcti_rctf_copy(&rect, &but->rect); */
 
@@ -4508,11 +4567,11 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
 	int kmi_id;
 	
 	/* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
-	km = WM_keymap_guess_opname(C, but->optype->idname);		
+	km = WM_keymap_guess_opname(C, but->optype->idname);
 	kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
 	kmi_id = kmi->id;
 
-	/* copy properties, prop can be NULL for reset */	
+	/* copy properties, prop can be NULL for reset */
 	if (prop)
 		prop = IDP_CopyProperty(prop);
 	WM_keymap_properties_reset(kmi, prop);
@@ -4520,14 +4579,13 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
 	/* update and get pointers again */
 	WM_keyconfig_update(wm);
 
-	km = WM_keymap_guess_opname(C, but->optype->idname);		
+	km = WM_keymap_guess_opname(C, but->optype->idname);
 	kmi = WM_keymap_item_find_id(km, kmi_id);
 
 	RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
 
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
 	uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
-	uiBlockSetFlag(block, UI_BLOCK_RET_1);
 	uiBlockSetDirection(block, UI_CENTER);
 
 	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
@@ -4575,7 +4633,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
 	uiPopupMenu *pup;
 	uiLayout *layout;
 	int length;
-	char *name;
+	const char *name;
 	uiStringInfo label = {BUT_GET_LABEL, NULL};
 
 /*	if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
@@ -4583,7 +4641,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
 	
 	button_timers_tooltip_remove(C, but);
 
-	uiButGetStrInfo(C, but, 1, &label);
+	uiButGetStrInfo(C, but, &label, NULL);
 	name = label.strinfo;
 
 	pup = uiPupMenuBegin(C, name, ICON_NONE);
@@ -4865,14 +4923,10 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 	if (but->flag & UI_BUT_DISABLED)
 		return WM_UI_HANDLER_CONTINUE;
 
-	if ((data->state == BUTTON_STATE_HIGHLIGHT) &&
-	    /* check prevval because of modal operators [#24016],
-	     * modifier check is to allow Ctrl+C for copy.
-	     * if this causes other problems, remove this check and suffer the bug :) - campbell */
-	    ((event->prevval != KM_PRESS) || (ISKEYMODIFIER(event->prevtype)) || (event->type == EVT_DROP)))
-	{
+	if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) {
 		/* handle copy-paste */
 		if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && (event->ctrl || event->oskey)) {
+			
 			ui_but_copy_paste(C, but, data, (event->type == CKEY) ? 'c' : 'v');
 			return WM_UI_HANDLER_BREAK;
 		}
@@ -4954,7 +5008,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				return WM_UI_HANDLER_BREAK;
 			}
-		} 
+		}
 		else if (but->pointype && but->poin == NULL) {
 			/* there's a pointer needed */
 			BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str);
@@ -5986,38 +6040,22 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 		switch (event->type) {
 			case MOUSEMOVE:
 			{
-				/* if the mouse is over the button, do nothing */
-				if (ui_mouse_inside_button(data->region, but, event->x, event->y)) {
-					break;
-				}
+				uiBut *bt;
 
-				/* if the mouse is over the menu, also do nothing */
 				if (data->menu && data->menu->region) {
 					if (ui_mouse_inside_region(data->menu->region, event->x, event->y)) {
 						break;
 					}
-					else {
-						/* make a rectangle between the menu and the button that opened it,
-						 * this avoids any space between them exiting the popup. see [#29072] - campbell */
-						rctf rct_all = but->rect;
-						rctf rct_win;
-
-						ui_block_to_window_fl(ar, block, &rct_all.xmin, &rct_all.ymin);
-						ui_block_to_window_fl(ar, block, &rct_all.xmax, &rct_all.ymax);
-
-						BLI_rctf_rcti_copy(&rct_win, &data->menu->region->winrct);
-						BLI_rctf_union(&rct_all, &rct_win);
-
-						if (BLI_rctf_isect_pt(&rct_all, event->x, event->y)) {
-							break;
-						}
-					}
 				}
 
-				if (but->type != COLOR) {  /* exception */
-					data->cancel = TRUE;
+				bt = ui_but_find_mouse_over(ar, event->x, event->y);
+				
+				if (bt && bt->active != data) {
+					if (but->type != COLOR) {  /* exception */
+						data->cancel = TRUE;
+					}
+					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
-				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				break;
 			}
 		}
@@ -6027,7 +6065,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 	}
 	else {
 		retval = ui_do_button(C, block, but, event);
-		// retval= WM_UI_HANDLER_BREAK; XXX why ? 
+		// retval = WM_UI_HANDLER_BREAK; XXX why ?
 	}
 
 	if (data->state == BUTTON_STATE_EXIT) {
@@ -6243,67 +6281,75 @@ static char ui_menu_scroll_test(uiBlock *block, int my)
 {
 	if (block->flag & (UI_BLOCK_CLIPTOP | UI_BLOCK_CLIPBOTTOM)) {
 		if (block->flag & UI_BLOCK_CLIPTOP) 
-			if (my > block->rect.ymax - 14)
+			if (my > block->rect.ymax - UI_MENU_SCROLL_MOUSE)
 				return 't';
 		if (block->flag & UI_BLOCK_CLIPBOTTOM)
-			if (my < block->rect.ymin + 14)
+			if (my < block->rect.ymin + UI_MENU_SCROLL_MOUSE)
 				return 'b';
 	}
 	return 0;
 }
 
-static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
+static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my, uiBut *to_bt)
 {
-	char test = ui_menu_scroll_test(block, my);
-	
-	if (test) {
-		uiBut *b1 = block->buttons.first;
-		uiBut *b2 = block->buttons.last;
-		uiBut *bnext;
-		uiBut *bprev;
-		int dy = 0;
-		
-		/* get first and last visible buttons */
-		while (b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
-			b1 = ui_but_next(b1);
-		while (b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
-			b2 = ui_but_prev(b2);
-		/* skips separators */
-		bnext = ui_but_next(b1);
-		bprev = ui_but_prev(b2);
+	uiBut *bt;
+	float dy = 0.0f;
+
+	if (to_bt) {
+		/* scroll to activated button */
+		if (block->flag & UI_BLOCK_CLIPTOP) {
+			if (to_bt->rect.ymax > block->rect.ymax - UI_MENU_SCROLL_ARROW)
+				dy = block->rect.ymax - to_bt->rect.ymax - UI_MENU_SCROLL_ARROW;
+		}
+		if (block->flag & UI_BLOCK_CLIPBOTTOM) {
+			if (to_bt->rect.ymin < block->rect.ymin + UI_MENU_SCROLL_ARROW)
+				dy = block->rect.ymin - to_bt->rect.ymin + UI_MENU_SCROLL_ARROW;
+		}
+	}
+	else {
+		/* scroll when mouse over arrow buttons */
+		char test = ui_menu_scroll_test(block, my);
+
+		if (test == 't')
+			dy = -UI_UNIT_Y; /* scroll to the top */
+		else if (test == 'b')
+			dy = UI_UNIT_Y; /* scroll to the bottom */
+	}
+
+	if (dy != 0.0f) {
+		if (dy < 0.0f) {
+			/* stop at top item, extra 0.5 unit Y makes it snap nicer */
+			float ymax = -FLT_MAX;
+
+			for (bt = block->buttons.first; bt; bt = bt->next)
+				ymax = max_ff(ymax, bt->rect.ymax);
+
+			if (ymax + dy - UI_UNIT_Y*0.5f < block->rect.ymax - UI_MENU_SCROLL_PAD)
+				dy = block->rect.ymax - ymax - UI_MENU_SCROLL_PAD;
+		}
+		else {
+			/* stop at bottom item, extra 0.5 unit Y makes it snap nicer */
+			float ymin = FLT_MAX;
+
+			for (bt = block->buttons.first; bt; bt = bt->next)
+				ymin = min_ff(ymin, bt->rect.ymin);
+
+			if (ymin + dy + UI_UNIT_Y*0.5f > block->rect.ymin + UI_MENU_SCROLL_PAD)
+				dy = block->rect.ymin - ymin + UI_MENU_SCROLL_PAD;
+		}
+
+		/* apply scroll offset */
+		for (bt = block->buttons.first; bt; bt = bt->next) {
+			bt->rect.ymin += dy;
+			bt->rect.ymax += dy;
+		}
+
+		/* set flags again */
+		ui_popup_block_scrolltest(block);
 		
-		if (bnext == NULL || bprev == NULL)
-			return 0;
+		ED_region_tag_redraw(ar);
 		
-		if (test == 't') {
-			/* bottom button is first button */
-			if (b1->rect.ymin < b2->rect.ymin)
-				dy = bnext->rect.ymin - b1->rect.ymin;
-			/* bottom button is last button */
-			else 
-				dy = bprev->rect.ymin - b2->rect.ymin;
-		}
-		else if (test == 'b') {
-			/* bottom button is first button */
-			if (b1->rect.ymin < b2->rect.ymin)
-				dy = b1->rect.ymin - bnext->rect.ymin;
-			/* bottom button is last button */
-			else 
-				dy = b2->rect.ymin - bprev->rect.ymin;
-		}
-		if (dy) {
-			
-			for (b1 = block->buttons.first; b1; b1 = b1->next) {
-				b1->rect.ymin -= dy;
-				b1->rect.ymax -= dy;
-			}
-			/* set flags again */
-			ui_popup_block_scrolltest(block);
-			
-			ED_region_tag_redraw(ar);
-			
-			return 1;
-		}
+		return 1;
 	}
 	
 	return 0;
@@ -6339,7 +6385,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 	}
 	else if (event->type == TIMER) {
 		if (event->customdata == menu->scrolltimer)
-			ui_menu_scroll(ar, block, my);
+			ui_menu_scroll(ar, block, my, NULL);
 	}
 	else {
 		/* for ui_mouse_motion_towards_block */
@@ -6380,7 +6426,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 					break;
 
 				/* opening sublevels of pulldowns */
-				case RIGHTARROWKEY:	
+				case RIGHTARROWKEY:
 					if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
 
 						PASS_EVENT_TO_PARENT_IF_NONACTIVE;
@@ -6434,8 +6480,10 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 										but = ui_but_next(but);
 								}
 
-								if (but)
+								if (but) {
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
+									ui_menu_scroll(ar, block, my, but);
+								}
 							}
 
 							if (!but) {
@@ -6461,6 +6509,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 
 								if (bt) {
 									ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);
+									ui_menu_scroll(ar, block, my, bt);
 								}
 							}
 						}
@@ -6567,7 +6616,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 				case YKEY:
 				case ZKEY:
 				{
-					if ((event->val   == KM_PRESS) &&
+					if ((event->val  == KM_PRESS || event->val == KM_DBL_CLICK) &&
 					    (event->shift == FALSE) &&
 					    (event->ctrl  == FALSE) &&
 					    (event->oskey == FALSE))
@@ -6621,7 +6670,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 				}
 			}
 
-			if (menu->menuretval) ;
+			if (menu->menuretval) {
+				/* pass */
+			}
 			else if (event->type == ESCKEY && event->val == KM_PRESS) {
 				/* esc cancels this and all preceding menus */
 				menu->menuretval = UI_RETURN_CANCEL;
@@ -6773,9 +6824,13 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
 	/* now handle events for our own menu */
 	if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
 		if (submenu && submenu->menuretval) {
+			int do_ret_out_parent = (submenu->menuretval & UI_RETURN_OUT_PARENT);
 			retval = ui_handle_menu_return_submenu(C, event, menu);
-			/* we may wan't to quit the submenu and handle the even in this menu */
-			if ((retval == WM_UI_HANDLER_BREAK) && (submenu->menuretval & UI_RETURN_OUT_PARENT)) {
+			submenu = NULL;  /* hint not to use this, it may be freed by call above */
+			(void)submenu;
+			/* we may wan't to quit the submenu and handle the even in this menu,
+			 * if its important to use it, check 'data->menu' first */
+			if ((retval == WM_UI_HANDLER_BREAK) && do_ret_out_parent) {
 				retval = ui_handle_menu_event(C, event, menu, level);
 			}
 		}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 0921107..bb0cc11 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -142,7 +142,7 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
 	new_icon = MEM_callocN(sizeof(Icon), "texicon");
 
 	new_icon->obj = NULL; /* icon is not for library object */
-	new_icon->type = 0;	
+	new_icon->type = 0;
 
 	di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
 	di->type = type;
@@ -852,7 +852,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco
 		if (G.debug & G_DEBUG)
 			printf("%s: no preview image for this ID: %s\n", __func__, id->name);
 		return;
-	}	
+	}
 
 	icon_create_rect(prv_img, size);
 
@@ -982,8 +982,8 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 	if (!di) {
 		di = icon_create_drawinfo();
 	
-		icon->drawinfo = di;		
-		icon->drawinfo_free = UI_icons_free_drawinfo;		
+		icon->drawinfo = di;
+		icon->drawinfo_free = UI_icons_free_drawinfo;
 	}
 	
 	/* scale width and height according to aspect */
@@ -994,13 +994,13 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 		/* vector icons use the uiBlock transformation, they are not drawn
 		 * with untransformed coordinates like the other icons */
 		di->data.vector.func((int)x, (int)y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f); 
-	} 
+	}
 	else if (di->type == ICON_TYPE_TEXTURE) {
 		icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y,
 		                  di->data.texture.w, di->data.texture.h, alpha, rgb);
 	}
 	else if (di->type == ICON_TYPE_BUFFER) {
-		/* it is a builtin icon */		
+		/* it is a builtin icon */
 		iimg = di->data.buffer.image;
 
 		if (!iimg->rect) return;  /* something has gone wrong! */
@@ -1010,7 +1010,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 	else if (di->type == ICON_TYPE_PREVIEW) {
 		PreviewImage *pi = BKE_previewimg_get((ID *)icon->obj);
 
-		if (pi) {			
+		if (pi) {
 			/* no create icon on this level in code */
 			if (!pi->rect[size]) return;  /* something has gone wrong! */
 			
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index b4b0686..23d3810 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -97,6 +97,11 @@ typedef enum {
 	UI_WTYPE_PROGRESSBAR
 } uiWidgetTypeEnum;
 
+/* menu scrolling */
+#define UI_MENU_SCROLL_ARROW	12
+#define UI_MENU_SCROLL_MOUSE	(UI_MENU_SCROLL_ARROW + 2)
+#define UI_MENU_SCROLL_PAD		4
+
 /* panel limits */
 #define UI_PANEL_MINX   100
 #define UI_PANEL_MINY   70
@@ -160,7 +165,8 @@ struct uiBut {
 	int flag, drawflag;
 	eButType         type;
 	eButPointerType  pointype;
-	short bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
+	short bit, bitnr, retval, strwidth, alignnr;
+	short ofs, pos, selsta, selend;
 
 	char *str;
 	char strdata[UI_MAX_NAME_STR];
@@ -170,7 +176,25 @@ struct uiBut {
 
 	char *poin;
 	float hardmin, hardmax, softmin, softmax;
-	float a1, a2;
+
+	/* both these values use depends on the button type
+	 * (polymorphic struct or union would be nicer for this stuff) */
+
+	/* (type == COLOR),      Use UI_GRAD_* values.
+	 * (type == NUM),        Use to store RNA 'step' value, for dragging and click-step.
+	 * (type == LABEL),      Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!).
+	 * (type == SCROLL)      Use as scroll size.
+	 * (type == SEARCH_MENU) Use as number or rows.
+	 */
+	float a1;
+
+	/* (type == HSVCIRCLE ), Use to store the luminosity.
+	 * (type == NUM),        Use to store RNA 'precision' value, for dragging and click-step.
+	 * (type == LABEL),      If (a1 == 1.0f) use a2 as a blending factor.
+	 * (type == SEARCH_MENU) Use as number or columns.
+	 */
+	float a2;
+
 	float aspect;
 	unsigned char col[4];
 
@@ -334,7 +358,7 @@ struct uiBlock {
 
 	char color_profile;         /* color profile for correcting linear colors for display */
 
-	char *display_device;       /* display devide name used to display this block,
+	char *display_device;       /* display device name used to display this block,
 	                             * used by color widgets to transform colors from/to scene linear
 	                             */
 };
@@ -484,6 +508,7 @@ extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut
 extern void ui_button_active_free(const struct bContext *C, uiBut *but);
 extern int ui_button_is_active(struct ARegion *ar);
 extern int ui_button_open_menu_direction(uiBut *but);
+extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore);
 
 /* interface_widgets.c */
 void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 8e30b31..9759c22 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -41,6 +41,7 @@
 #include "BLI_string.h"
 #include "BLI_rect.h"
 #include "BLI_utildefines.h"
+#include "BLI_math.h"
 
 #include "BLF_translation.h"
 
@@ -67,6 +68,8 @@
 #define EM_SEPR_X       6
 #define EM_SEPR_Y       6
 
+// #define USE_OP_RESET_BUT  // we may want to make this optional, disable for now.
+
 #define UI_OPERATOR_ERROR_RET(_ot, _opname, return_statement)                 \
 	if (ot == NULL) {                                                         \
 		ui_item_disabled(layout, _opname);                                    \
@@ -427,7 +430,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
 				but->type = NUMSLI;
 		}
 	}
-	else if (subtype == PROP_DIRECTION) {
+	else if (subtype == PROP_DIRECTION && !expand) {
 		uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X * 3, UI_UNIT_Y * 3, ptr, prop, 0, 0, 0, -1, -1, NULL);
 	}
 	else {
@@ -1313,7 +1316,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
 				BLI_addtail(items_list, cis);
 			}
 			MEM_freeN(name);
-		}			
+		}
 
 		i++;
 	}
@@ -1376,11 +1379,17 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
 	/* turn button into search button */
 	if (searchprop) {
 		but->type = SEARCH_MENU;
-		but->hardmax = MAX2(but->hardmax, 256);
+		but->hardmax = MAX2(but->hardmax, 256.0f);
 		but->rnasearchpoin = *searchptr;
 		but->rnasearchprop = searchprop;
 		but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
 
+		if (RNA_property_type(prop) == PROP_ENUM) {
+			/* XXX, this will have a menu string,
+			 * but in this case we just want the text */
+			but->str[0] = 0;
+		}
+
 		uiButSetSearchFunc(but, rna_search_cb, but, NULL, NULL);
 	}
 }
@@ -1398,13 +1407,14 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
 	prop = RNA_struct_find_property(ptr, propname);
 
 	if (!prop) {
-		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+		RNA_warning("property not found: %s.%s",
+		            RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 	
 	type = RNA_property_type(prop);
-	if (!ELEM(type, PROP_POINTER, PROP_STRING)) {
-		RNA_warning("Property %s must be a pointer or string", propname);
+	if (!ELEM3(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) {
+		RNA_warning("Property %s must be a pointer, string or enum", propname);
 		return;
 	}
 
@@ -1412,11 +1422,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
 
 
 	if (!searchprop) {
-		RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
+		RNA_warning("search collection property not found: %s.%s",
+		            RNA_struct_identifier(searchptr->type), searchpropname);
 		return;
 	}
 	else if (RNA_property_type(searchprop) != PROP_COLLECTION) {
-		RNA_warning("search collection property is not a collection type: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
+		RNA_warning("search collection property is not a collection type: %s.%s",
+		            RNA_struct_identifier(searchptr->type), searchpropname);
 		return;
 	}
 
@@ -1449,6 +1461,11 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
 
 	menu.type = mt;
 	menu.layout = layout;
+
+	if (G.debug & G_DEBUG_WM) {
+		printf("%s: opening menu \"%s\"\n", __func__, mt->idname);
+	}
+
 	mt->draw(C, &menu);
 }
 
@@ -1708,7 +1725,7 @@ static void ui_litem_layout_row(uiLayout *litem)
 	int x, y, w, tot, totw, neww, itemw, minw, itemh, offset;
 	int fixedw, freew, fixedx, freex, flag = 0, lastw = 0;
 
-	/* x= litem->x; */ /* UNUSED */
+	/* x = litem->x; */ /* UNUSED */
 	y = litem->y;
 	w = litem->w;
 	totw = 0;
@@ -1774,7 +1791,7 @@ static void ui_litem_layout_row(uiLayout *litem)
 
 		if (item->flag) {
 			/* fixed minimum size items */
-			itemw = ui_item_fit(minw, fixedx, fixedw, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
+			itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, NULL);
 			fixedx += itemw;
 		}
 		else {
@@ -1932,8 +1949,8 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
 			return;
 		}
 
-		flow->totcol = MAX2(litem->root->emw / maxw, 1);
-		flow->totcol = MIN2(flow->totcol, totitem);
+		flow->totcol = max_ii(litem->root->emw / maxw, 1);
+		flow->totcol = min_ii(flow->totcol, totitem);
 	}
 	else
 		flow->totcol = flow->number;
@@ -1953,9 +1970,9 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
 		ui_item_size(item, &itemw, &itemh);
 
 		y -= itemh + style->buttonspacey;
-		miny = MIN2(miny, y);
+		miny = min_ii(miny, y);
 		emy -= itemh;
-		maxw = MAX2(itemw, maxw);
+		maxw = max_ii(itemw, maxw);
 
 		/* decide to go to next one */
 		if (col < flow->totcol - 1 && emy <= -emh) {
@@ -2007,7 +2024,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
 		emy -= itemh;
 		ui_item_position(item, x + offset, y, itemw, itemh);
 		y -= style->buttonspacey;
-		miny = MIN2(miny, y);
+		miny = min_ii(miny, y);
 
 		/* decide to go to next one */
 		if (col < flow->totcol - 1 && emy <= -emh) {
@@ -2038,8 +2055,8 @@ static void ui_litem_estimate_absolute(uiLayout *litem)
 		ui_item_offset(item, &itemx, &itemy);
 		ui_item_size(item, &itemw, &itemh);
 
-		minx = MIN2(minx, itemx);
-		miny = MIN2(miny, itemy);
+		minx = min_ii(minx, itemx);
+		miny = min_ii(miny, itemy);
 
 		litem->w = MAX2(litem->w, itemx + itemw);
 		litem->h = MAX2(litem->h, itemy + itemh);
@@ -2064,11 +2081,11 @@ static void ui_litem_layout_absolute(uiLayout *litem)
 		ui_item_offset(item, &itemx, &itemy);
 		ui_item_size(item, &itemw, &itemh);
 
-		minx = MIN2(minx, itemx);
-		miny = MIN2(miny, itemy);
+		minx = min_ii(minx, itemx);
+		miny = min_ii(miny, itemy);
 
-		totw = MAX2(totw, itemx + itemw);
-		toth = MAX2(toth, itemy + itemh);
+		totw = max_ii(totw, itemx + itemw);
+		toth = max_ii(toth, itemy + itemh);
 	}
 
 	totw -= minx;
@@ -2834,10 +2851,12 @@ const char *uiLayoutIntrospect(uiLayout *layout)
 	return str;
 }
 
+#ifdef USE_OP_RESET_BUT
 static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt, void *UNUSED(arg_dummy2))
 {
 	WM_operator_properties_reset((wmOperator *)op_pt);
 }
+#endif
 
 /* this function does not initialize the layout, functions can be called on the layout before and after */
 void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
@@ -2905,6 +2924,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
 		}
 	}
 
+#ifdef USE_OP_RESET_BUT
 	/* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled
 	 * but this is not so important if this button is drawn in those cases
 	 * (which isn't all that likely anyway) - campbell */
@@ -2919,6 +2939,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
 		                       NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
 		uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL);
 	}
+#endif
 
 	/* set various special settings for buttons */
 	{
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e4e2598..e57e52d 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -807,8 +807,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
 	}
 
 	if (text == NULL) {
-		BKE_reportf(op->reports, RPT_WARNING,
-		            "file: '%s' can't be opened", filepath);
+		BKE_reportf(op->reports, RPT_WARNING, "File '%s' cannot be opened", filepath);
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -820,8 +819,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
 			st->text = text;
 		}
 		else {
-			BKE_reportf(op->reports, RPT_INFO,
-			            "See '%s' in the text editor", text->id.name + 2);
+			BKE_reportf(op->reports, RPT_INFO, "See '%s' in the text editor", text->id.name + 2);
 		}
 
 		txt_move_toline(text, line - 1, FALSE);
@@ -857,8 +855,8 @@ static int editsource_exec(bContext *C, wmOperator *op)
 		     !BLI_ghashIterator_isDone(&ghi);
 		     BLI_ghashIterator_step(&ghi))
 		{
-			uiBut *but = BLI_ghashIterator_getKey(&ghi);
-			if (but && ui_editsource_uibut_match(&ui_editsource_info->but_orig, but)) {
+			uiBut *but_key = BLI_ghashIterator_getKey(&ghi);
+			if (but_key && ui_editsource_uibut_match(&ui_editsource_info->but_orig, but_key)) {
 				but_store = BLI_ghashIterator_getValue(&ghi);
 				break;
 			}
@@ -872,14 +870,12 @@ static int editsource_exec(bContext *C, wmOperator *op)
 				                           but_store->py_dbg_ln);
 			}
 			else {
-				BKE_report(op->reports, RPT_ERROR,
-				           "Active button isn't from a script, cant edit source.");
+				BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source");
 				ret = OPERATOR_CANCELLED;
 			}
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR,
-			           "Active button match can't be found.");
+			BKE_report(op->reports, RPT_ERROR, "Active button match cannot be found");
 			ret = OPERATOR_CANCELLED;
 		}
 
@@ -964,7 +960,6 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
 		const char *root = U.i18ndir;
 		const char *uilng = BLF_lang_get();
 
-		const int bufs_nbr = 10;
 		uiStringInfo but_label = {BUT_GET_LABEL, NULL};
 		uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL};
 		uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
@@ -977,25 +972,25 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
 		uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL};
 
 		if (!BLI_is_dir(root)) {
-			BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' \"Translation Branches "
-			                                   "Directory\" path to a valid directory.");
+			BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches "
+			                                   "Directory' path to a valid directory");
 			return OPERATOR_CANCELLED;
 		}
 		if (!WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0)) {
-			BKE_reportf(op->reports, RPT_ERROR, "Could not find operator \"%s\"! Please enable ui_translate addon "
-			                                    "in the User Preferences.", EDTSRC_I18N_OP_NAME);
+			BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate addon "
+			                                    "in the User Preferences", EDTSRC_I18N_OP_NAME);
 			return OPERATOR_CANCELLED;
 		}
 		/* Try to find a valid po file for current language... */
 		edittranslation_find_po_file(root, uilng, popath, FILE_MAX);
 /*		printf("po path: %s\n", popath);*/
 		if (popath[0] == '\0') {
-			BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s.", uilng, root);
+			BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s", uilng, root);
 			return OPERATOR_CANCELLED;
 		}
 
-		uiButGetStrInfo(C, but, bufs_nbr, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
-		                &rna_struct, &rna_prop, &rna_enum, &rna_ctxt);
+		uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
+		                &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
 
 		WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME);
 		RNA_string_set(&ptr, "lang", uilng);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 49e96be..2b170ea 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -240,7 +240,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
 						}
 					}
 				}
-			} 
+			}
 		}
 	}
 
@@ -545,7 +545,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 	if (!(panel->flag & PNL_CLOSEDX)) {
 		ui_draw_aligned_panel_header(style, block, &headrect, 'h');
 		
-		/* itemrect smaller */	
+		/* itemrect smaller */
 		itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
 		itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect);
 		itemrect.ymin = headrect.ymin;
@@ -594,7 +594,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 	/* draw collapse icon */
 	UI_ThemeColor(TH_TEXT);
 	
-	/* itemrect smaller */	
+	/* itemrect smaller */
 	itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
 	itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
 	itemrect.ymin = headrect.ymin;
@@ -814,8 +814,8 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
 				pa_sizey = pa->ofsy + get_panel_size_y(pa);
 			}
 
-			sizex = MAX2(sizex, pa_sizex);
-			sizey = MIN2(sizey, pa_sizey);
+			sizex = max_ii(sizex, pa_sizex);
+			sizey = min_ii(sizey, pa_sizey);
 		}
 	}
 
@@ -831,7 +831,7 @@ static void ui_do_animate(const bContext *C, Panel *panel)
 	float fac;
 
 	fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
-	fac = minf(sqrt(fac), 1.0f);
+	fac = min_ff(sqrt(fac), 1.0f);
 
 	/* for max 1 second, interpolate positions */
 	if (uiAlignPanelStep(sa, ar, fac, 0)) {
@@ -895,7 +895,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
 				panew->paneltab = NULL;
 				ED_region_tag_redraw(ar); /* the buttons panew were not made */
 			}
-		}	
+		}
 	}
 
 	/* re-align, possibly with animation */
@@ -1200,7 +1200,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 
 								ED_region_tag_redraw(ar);
 								retval = WM_UI_HANDLER_BREAK;
-							}						
+							}
 						}
 					}
 #endif
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 4dafb4b..c13aade 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -46,6 +46,8 @@
 
 #include "BKE_context.h"
 #include "BKE_screen.h"
+#include "BKE_idcode.h"
+#include "BKE_global.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -213,7 +215,7 @@ static MenuData *decompose_menu_string(const char *str)
 				else {
 					menudata_add_item(md, nitem, nretval, nicon, 0);
 					nretval = md->nitems + 1;
-				} 
+				}
 				
 				nitem = NULL;
 				nicon = 0;
@@ -425,7 +427,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 	rctf rect_fl;
 	rcti rect_i;
 
-	const int nbr_info = 6;
 	uiStringInfo but_tip = {BUT_GET_TIP, NULL};
 	uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
 	uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL};
@@ -439,50 +440,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 	/* create tooltip data */
 	data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
 
-	uiButGetStrInfo(C, but, nbr_info, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop);
+	uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop, NULL);
 
 	/* special case, enum rna buttons only have enum item description,
 	 * use general enum description too before the specific one */
-#if 0
-	if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
-		const char *descr = RNA_property_description(but->rnaprop);
-		if (descr && descr[0]) {
-			BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0]));
-			data->color_id[data->totline] = UI_TIP_LC_MAIN;
-			data->totline++;
-		}
-
-		if (ELEM(but->type, ROW, MENU)) {
-			EnumPropertyItem *item;
-			int totitem, free;
-			int value = (but->type == ROW) ? (int)but->hardmax : (int)ui_get_but_val(but);
-
-			RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
-
-			for (i = 0; i < totitem; i++) {
-				if (item[i].identifier[0] && item[i].value == value) {
-					if (item[i].description && item[i].description[0]) {
-						BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s",
-						             item[i].name, item[i].description);
-						data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
-						data->totline++;
-					}
-					break;
-				}
-			}
 
-			if (free) {
-				MEM_freeN(item);
-			}
-		}
-	}
-	
-	if (but->tip && but->tip[0] != '\0') {
-		BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
-		data->color_id[data->totline] = UI_TIP_LC_MAIN;
-		data->totline++;
-	}
-#else
 	/* Tip */
 	if (but_tip.strinfo) {
 		BLI_strncpy(data->lines[data->totline], but_tip.strinfo, sizeof(data->lines[0]));
@@ -496,29 +458,13 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 		data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
 		data->totline++;
 	}
-#endif
-
-#if 0
-	if (but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
-		/* operator keymap (not menus, they already have it) */
-		prop = (but->opptr) ? but->opptr->data : NULL;
 
-		if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
-		                                 buf, sizeof(buf)))
-		{
-			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf);
-			data->color_id[data->totline] = UI_TIP_LC_NORMAL;
-			data->totline++;
-		}
-	}
-#else
 	/* Op shortcut */
 	if (op_keymap.strinfo) {
 		BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), op_keymap.strinfo);
 		data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 		data->totline++;
 	}
-#endif
 
 	if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
 		/* full string */
@@ -552,15 +498,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 				data->totline++;
 			}
 		}
-#if 0
-		/* rna info */
-		if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
-			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"),
-			             RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
-			data->color_id[data->totline] = UI_TIP_LC_PYTHON;
-			data->totline++;
-		}
-#endif
+
 		if (but->rnapoin.id.data) {
 			ID *id = but->rnapoin.id.data;
 			if (id->lib && id->lib->name) {
@@ -602,30 +540,55 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 			}
 		}
 	}
-#if 0
-	else if (ELEM(but->type, MENU, PULLDOWN)) {
-		if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
-			MenuType *mt = uiButGetMenuType(but);
-			if (mt) {
-				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname);
-				data->color_id[data->totline] = UI_TIP_LC_PYTHON;
-				data->totline++;
-			}
-		}
-	}
-#else
 	if ((U.flag & USER_TOOLTIPS_PYTHON) == 0 && !but->optype && rna_struct.strinfo) {
-		if (rna_prop.strinfo)
+		if (rna_prop.strinfo) {
 			/* Struct and prop */
 			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
-			             TIP_("Python: %s.%s"), rna_struct.strinfo, rna_prop.strinfo);
-		else
+			             TIP_("Python: %s.%s"),
+			             rna_struct.strinfo, rna_prop.strinfo);
+		}
+		else {
 			/* Only struct (e.g. menus) */
-			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), rna_struct.strinfo);
+			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
+			             TIP_("Python: %s"), rna_struct.strinfo);
+		}
 		data->color_id[data->totline] = UI_TIP_LC_PYTHON;
 		data->totline++;
+
+		if (but->rnapoin.id.data) {
+			/* this could get its own 'BUT_GET_...' type */
+			PointerRNA *ptr = &but->rnapoin;
+			PropertyRNA *prop = but->rnaprop;
+			ID *id = ptr->id.data;
+
+			char *id_path;
+			char *data_path = NULL;
+
+			/* never fails */
+			id_path = RNA_path_from_ID_python(id);
+
+			if (ptr->id.data && ptr->data && prop) {
+				data_path = RNA_path_from_ID_to_property(ptr, prop);
+			}
+
+			if (data_path) {
+				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
+				             "%s.%s",  /* no need to translate */
+				             id_path, data_path);
+				MEM_freeN(data_path);
+			}
+			else if (prop) {
+				/* can't find the path. be explicit in our ignorance "..." */
+				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
+				             "%s ... %s",  /* no need to translate */
+				             id_path, rna_prop.strinfo ? rna_prop.strinfo : RNA_property_identifier(prop));
+			}
+			MEM_freeN(id_path);
+
+			data->color_id[data->totline] = UI_TIP_LC_PYTHON;
+			data->totline++;
+		}
 	}
-#endif
 
 	/* Free strinfo's... */
 	if (but_tip.strinfo)
@@ -641,7 +604,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 	if (rna_prop.strinfo)
 		MEM_freeN(rna_prop.strinfo);
 
-	assert(data->totline < MAX_TOOLTIP_LINES);
+	BLI_assert(data->totline < MAX_TOOLTIP_LINES);
 	
 	if (data->totline == 0) {
 		MEM_freeN(data);
@@ -670,7 +633,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
 	for (a = 0, fontw = 0, fonth = 0; a < data->totline; a++) {
 		w = BLF_width(data->fstyle.uifont_id, data->lines[a]);
-		fontw = MAX2(fontw, w);
+		fontw = max_ff(fontw, (float)w);
 		fonth += (a == 0) ? h : h + TIP_MARGIN_Y;
 	}
 
@@ -825,11 +788,17 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon
 	return 1;
 }
 
-int uiSearchBoxhHeight(void)
+int uiSearchBoxHeight(void)
 {
 	return SEARCH_ITEMS * UI_UNIT_Y + 2 * MENU_TOP;
 }
 
+int uiSearchBoxWidth(void)
+{
+	/* was hardcoded at 150 */
+	return 9 * UI_UNIT_X;
+}
+
 /* ar is the search box itself */
 static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
 {
@@ -1159,7 +1128,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 	
 	/* special case, hardcoded feature, not draw backdrop when called from menus,
 	 * assume for design that popup already added it */
-	if (but->block->flag & UI_BLOCK_LOOP)
+	if (but->block->flag & UI_BLOCK_SEARCH_MENU)
 		data->noback = 1;
 	
 	if (but->a1 > 0 && but->a2 > 0) {
@@ -1169,7 +1138,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 	}
 	
 	/* compute position */
-	if (but->block->flag & UI_BLOCK_LOOP) {
+	if (but->block->flag & UI_BLOCK_SEARCH_MENU) {
 		/* this case is search menu inside other menu */
 		/* we copy region size */
 
@@ -1190,10 +1159,11 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 		}
 	}
 	else {
+		const int searchbox_width = uiSearchBoxWidth();
 		rect_fl.xmin = but->rect.xmin - 5;   /* align text with button */
 		rect_fl.xmax = but->rect.xmax + 5;   /* symmetrical */
 		rect_fl.ymax = but->rect.ymin;
-		rect_fl.ymin = rect_fl.ymax - uiSearchBoxhHeight();
+		rect_fl.ymin = rect_fl.ymax - uiSearchBoxHeight();
 
 		ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
 		ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
@@ -1201,8 +1171,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 		BLI_rctf_translate(&rect_fl, ofsx, ofsy);
 	
 		/* minimal width */
-		if (BLI_rctf_size_x(&rect_fl) < 150) {
-			rect_fl.xmax = rect_fl.xmin + 150;  /* XXX arbitrary */
+		if (BLI_rctf_size_x(&rect_fl) < searchbox_width) {
+			rect_fl.xmax = rect_fl.xmin + searchbox_width;
 		}
 		
 		/* copy to int, gets projected if possible too */
@@ -1408,8 +1378,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 			dir1 &= (UI_TOP | UI_DOWN);
 		}
 
-		if (dir2 == 0) if (dir1 == UI_LEFT || dir1 == UI_RIGHT) dir2 = UI_DOWN;
-		if (dir2 == 0) if (dir1 == UI_TOP || dir1 == UI_DOWN) dir2 = UI_LEFT;
+		if ((dir2 == 0) && (dir1 == UI_LEFT || dir1 == UI_RIGHT)) dir2 = UI_DOWN;
+		if ((dir2 == 0) && (dir1 == UI_TOP  || dir1 == UI_DOWN))  dir2 = UI_LEFT;
 		
 		/* no space at all? don't change */
 		if (left || right) {
@@ -1463,7 +1433,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 		if (top == 0 && down == 0) {
 			if (dir1 == UI_LEFT || dir1 == UI_RIGHT) {
 				/* align with bottom of screen */
-				// yof= ysize; (not with menu scrolls)
+				// yof = ysize; (not with menu scrolls)
 			}
 		}
 		
@@ -1548,7 +1518,11 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
 static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 {
 	int winx, winy;
-	
+
+	if (block->flag & UI_BLOCK_NO_WIN_CLIP) {
+		return;
+	}
+
 	wm_window_get_size(window, &winx, &winy);
 	
 	if (block->rect.xmin < MENU_SHADOW_SIDE)
@@ -1565,8 +1539,6 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 void ui_popup_block_scrolltest(uiBlock *block)
 {
 	uiBut *bt;
-	/* Knowing direction is necessary for multi-column menus... */
-	int is_flip = (block->direction & UI_TOP) && !(block->flag & UI_BLOCK_NO_FLIP);
 	
 	block->flag &= ~(UI_BLOCK_CLIPBOTTOM | UI_BLOCK_CLIPTOP);
 	
@@ -1576,29 +1548,27 @@ void ui_popup_block_scrolltest(uiBlock *block)
 	if (block->buttons.first == block->buttons.last)
 		return;
 	
-	/* mark buttons that are outside boundary and the ones next to it for arrow(s) */
+	/* mark buttons that are outside boundary */
 	for (bt = block->buttons.first; bt; bt = bt->next) {
 		if (bt->rect.ymin < block->rect.ymin) {
 			bt->flag |= UI_SCROLLED;
 			block->flag |= UI_BLOCK_CLIPBOTTOM;
-			/* make space for arrow */
-			if (bt->rect.ymax < block->rect.ymin + 10) {
-				if (is_flip && bt->next && bt->next->rect.ymin > bt->rect.ymin)
-					bt->next->flag |= UI_SCROLLED;
-				else if (!is_flip && bt->prev && bt->prev->rect.ymin > bt->rect.ymin)
-					bt->prev->flag |= UI_SCROLLED;
-			}
 		}
 		if (bt->rect.ymax > block->rect.ymax) {
 			bt->flag |= UI_SCROLLED;
 			block->flag |= UI_BLOCK_CLIPTOP;
-			/* make space for arrow */
-			if (bt->rect.ymin > block->rect.ymax - 10) {
-				if (!is_flip && bt->next && bt->next->rect.ymax < bt->rect.ymax)
-					bt->next->flag |= UI_SCROLLED;
-				else if (is_flip && bt->prev && bt->prev->rect.ymax < bt->rect.ymax)
-					bt->prev->flag |= UI_SCROLLED;
-			}
+		}
+	}
+
+	/* mark buttons overlapping arrows, if we have them */
+	for (bt = block->buttons.first; bt; bt = bt->next) {
+		if (block->flag & UI_BLOCK_CLIPBOTTOM) {
+			if (bt->rect.ymin < block->rect.ymin + UI_MENU_SCROLL_ARROW)
+				bt->flag |= UI_SCROLLED;
+		}
+		if (block->flag & UI_BLOCK_CLIPTOP) {
+			if (bt->rect.ymax > block->rect.ymax - UI_MENU_SCROLL_ARROW)
+				bt->flag |= UI_SCROLLED;
 		}
 	}
 }
@@ -1950,7 +1920,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3])
 			else if (bt->str[0] == 'V') {
 				ui_set_but_val(bt, hsv[2]);
 			}
-		}		
+		}
 
 		ui_check_but(bt);
 	}
@@ -2253,13 +2223,11 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_
 		show_picker = (but->block->flag & UI_BLOCK_POPUP) == 0;
 	}
 	
-	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
-	
 	copy_v3_v3(handle->retvec, but->editvec);
 	
 	uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker);
 	
-	block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1;
+	block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT;
 	uiBoundsBlock(block, 10);
 	
 	block->block_event_func = ui_picker_small_wheel_cb;
@@ -2377,7 +2345,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	
 	if (pup->popup) {
-		uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT | UI_BLOCK_RET_1);
+		uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT);
 		uiBlockSetDirection(block, direction);
 
 		/* offset the mouse position, possibly based on earlier selection */
@@ -2396,7 +2364,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
 			 * on the first item */
 			offset[0] = 0;
 			for (bt = block->buttons.first; bt; bt = bt->next)
-				offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect)));
+				offset[0] = min_ii(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect)));
 
 			offset[1] = 1.5 * UI_UNIT_Y;
 		}
@@ -2506,6 +2474,9 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
 	pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
 	pup->block->puphash = ui_popup_menu_hash(title);
 	pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
+
+	/* note, this intentionally differs from the menu & submenu default because many operators
+	 * use popups like this to select one of their options - where having invoke doesn't make sense */
 	uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
 
 	/* create in advance so we can let buttons point to retval already */
@@ -2674,14 +2645,18 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
 	ds = BLI_dynstr_new();
 
 	for (report = reports->list.first; report; report = report->next) {
-		if (report->type < reports->printlevel)
-			;  /* pass */
-		else if (report->type >= RPT_ERROR)
+		if (report->type < reports->printlevel) {
+			/* pass */
+		}
+		else if (report->type >= RPT_ERROR) {
 			BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
-		else if (report->type >= RPT_WARNING)
+		}
+		else if (report->type >= RPT_WARNING) {
 			BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
-		else if (report->type >= RPT_INFO)
+		}
+		else if (report->type >= RPT_INFO) {
 			BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message);
+		}
 	}
 
 	str = BLI_dynstr_get_cstring(ds);
@@ -2713,6 +2688,10 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
 	menu.layout = layout;
 	menu.type = mt;
 
+	if (G.debug & G_DEBUG_WM) {
+		printf("%s: opening menu \"%s\"\n", __func__, idname);
+	}
+
 	mt->draw(C, &menu);
 
 	uiPupMenuEnd(C, pup);
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index acf7712..7e7db6a 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -348,7 +348,7 @@ void uiStyleInit(void)
 #else
 			font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
 #endif
-		}		
+		}
 		else {
 			font->blf_id = BLF_load(font->filename);
 			if (font->blf_id == -1)
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5f9722d..f7a53c6 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -175,7 +175,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
 	idptr = RNA_property_pointer_get(&template.ptr, template.prop);
 
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU);
 	
 	/* preview thumbnails */
 	if (template.prv_rows > 0 && template.prv_cols > 0) {
@@ -185,21 +185,24 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
 		/* fake button, it holds space for search items */
 		uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
 		
-		but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
+		but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19,
+		                     template.prv_rows, template.prv_cols, "");
 		uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
 	}
 	/* list view */
 	else {
+		const int searchbox_width  = uiSearchBoxWidth();
+		const int searchbox_height = uiSearchBoxHeight();
 		/* fake button, it holds space for search items */
-		uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+		uiDefBut(block, LABEL, 0, "", 10, 15, searchbox_width, searchbox_height, NULL, 0, 0, 0, 0, NULL);
 		
-		but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
+		but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, searchbox_width, UI_UNIT_Y - 1, 0, 0, "");
 		uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
 	}
 		
 	
 	uiBoundsBlock(block, 6);
-	uiBlockSetDirection(block, UI_DOWN);	
+	uiBlockSetDirection(block, UI_DOWN);
 	uiEndBlock(C, block);
 	
 	/* give search-field focus */
@@ -315,33 +318,68 @@ static const char *template_id_browse_tip(StructRNA *type)
 	if (type) {
 		switch (RNA_type_to_ID_code(type)) {
 			case ID_SCE: return N_("Browse Scene to be linked");
-			case ID_OB: return N_("Browse Object to be linked");
-			case ID_ME: return N_("Browse Mesh Data to be linked");
-			case ID_CU: return N_("Browse Curve Data to be linked");
-			case ID_MB: return N_("Browse Metaball Data to be linked");
-			case ID_MA: return N_("Browse Material to be linked");
-			case ID_TE: return N_("Browse Texture to be linked");
-			case ID_IM: return N_("Browse Image to be linked");
-			case ID_LT: return N_("Browse Lattice Data to be linked");
-			case ID_LA: return N_("Browse Lamp Data to be linked");
-			case ID_CA: return N_("Browse Camera Data to be linked");
-			case ID_WO: return N_("Browse World Settings to be linked");
+			case ID_OB:  return N_("Browse Object to be linked");
+			case ID_ME:  return N_("Browse Mesh Data to be linked");
+			case ID_CU:  return N_("Browse Curve Data to be linked");
+			case ID_MB:  return N_("Browse Metaball Data to be linked");
+			case ID_MA:  return N_("Browse Material to be linked");
+			case ID_TE:  return N_("Browse Texture to be linked");
+			case ID_IM:  return N_("Browse Image to be linked");
+			case ID_LT:  return N_("Browse Lattice Data to be linked");
+			case ID_LA:  return N_("Browse Lamp Data to be linked");
+			case ID_CA:  return N_("Browse Camera Data to be linked");
+			case ID_WO:  return N_("Browse World Settings to be linked");
 			case ID_SCR: return N_("Choose Screen lay-out");
 			case ID_TXT: return N_("Browse Text to be linked");
 			case ID_SPK: return N_("Browse Speaker Data to be linked");
-			case ID_SO: return N_("Browse Sound to be linked");
-			case ID_AR: return N_("Browse Armature data to be linked");
-			case ID_AC: return N_("Browse Action to be linked");
-			case ID_NT: return N_("Browse Node Tree to be linked");
-			case ID_BR: return N_("Browse Brush to be linked");
-			case ID_PA: return N_("Browse Particle System to be linked");
-			case ID_GD: return N_("Browse Grease Pencil Data to be linked");
+			case ID_SO:  return N_("Browse Sound to be linked");
+			case ID_AR:  return N_("Browse Armature data to be linked");
+			case ID_AC:  return N_("Browse Action to be linked");
+			case ID_NT:  return N_("Browse Node Tree to be linked");
+			case ID_BR:  return N_("Browse Brush to be linked");
+			case ID_PA:  return N_("Browse Particle System to be linked");
+			case ID_GD:  return N_("Browse Grease Pencil Data to be linked");
 		}
 	}
 	return N_("Browse ID data to be linked");
 }
 
-static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, const char *newop, const char *openop, const char *unlinkop)
+/* Return a type-based i18n context, needed e.g. by "New" button.
+ * In most languages, this adjective takes different form based on gender of type name...
+ */
+static const char *template_id_context(StructRNA *type)
+{
+	if (type) {
+		switch (RNA_type_to_ID_code(type)) {
+			case ID_SCE: return BLF_I18NCONTEXT_ID_SCENE;
+			case ID_OB:  return BLF_I18NCONTEXT_ID_OBJECT;
+			case ID_ME:  return BLF_I18NCONTEXT_ID_MESH;
+			case ID_CU:  return BLF_I18NCONTEXT_ID_CURVE;
+			case ID_MB:  return BLF_I18NCONTEXT_ID_METABALL;
+			case ID_MA:  return BLF_I18NCONTEXT_ID_MATERIAL;
+			case ID_TE:  return BLF_I18NCONTEXT_ID_TEXTURE;
+			case ID_IM:  return BLF_I18NCONTEXT_ID_IMAGE;
+			case ID_LT:  return BLF_I18NCONTEXT_ID_LATTICE;
+			case ID_LA:  return BLF_I18NCONTEXT_ID_LAMP;
+			case ID_CA:  return BLF_I18NCONTEXT_ID_CAMERA;
+			case ID_WO:  return BLF_I18NCONTEXT_ID_WORLD;
+			case ID_SCR: return BLF_I18NCONTEXT_ID_SCREEN;
+			case ID_TXT: return BLF_I18NCONTEXT_ID_TEXT;
+			case ID_SPK: return BLF_I18NCONTEXT_ID_SPEAKER;
+			case ID_SO:  return BLF_I18NCONTEXT_ID_SOUND;
+			case ID_AR:  return BLF_I18NCONTEXT_ID_ARMATURE;
+			case ID_AC:  return BLF_I18NCONTEXT_ID_ACTION;
+			case ID_NT:  return BLF_I18NCONTEXT_ID_NODETREE;
+			case ID_BR:  return BLF_I18NCONTEXT_ID_BRUSH;
+			case ID_PA:  return BLF_I18NCONTEXT_ID_PARTICLESETTINGS;
+			case ID_GD:  return BLF_I18NCONTEXT_ID_GPENCIL;
+		}
+	}
+	return BLF_I18NCONTEXT_DEFAULT;
+}
+
+static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag,
+                        const char *newop, const char *openop, const char *unlinkop)
 {
 	uiBut *but;
 	uiBlock *block;
@@ -349,6 +387,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 	// ListBase *lb; // UNUSED
 	ID *id, *idfrom;
 	int editable = RNA_property_editable(&template->ptr, template->prop);
+	const char *i18n_ctxt = template_id_context(type);
 
 	idptr = RNA_property_pointer_get(&template->ptr, template->prop);
 	id = idptr.data;
@@ -400,19 +439,20 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 
 		//text_idbutton(id, name);
 		name[0] = '\0';
-		but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL);
+		but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y,
+		                &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
 		uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
 		if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
 
 		if (id->lib) {
 			if (id->flag & LIB_INDIRECT) {
-				but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
-				                   TIP_("Indirect library datablock, cannot change"));
+				but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+				                   NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change"));
 				uiButSetFlag(but, UI_BUT_DISABLED);
 			}
 			else {
-				but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
-				                   TIP_("Direct linked library datablock, click to make local"));
+				but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+				                   NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local"));
 				if (!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
 					uiButSetFlag(but, UI_BUT_DISABLED);
 			}
@@ -425,7 +465,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 
 			BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
 
-			but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
+			but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y,
+			               NULL, 0, 0, 0, 0,
 			               TIP_("Display number of users of this data (click to make a single-user copy)"));
 
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
@@ -450,12 +491,39 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 	if (flag & UI_ID_ADD_NEW) {
 		int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
 		
+		/* i18n markup, does nothing! */
+		BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_DEFAULT,
+		                                 BLF_I18NCONTEXT_ID_SCENE,
+		                                 BLF_I18NCONTEXT_ID_OBJECT,
+		                                 BLF_I18NCONTEXT_ID_MESH,
+		                                 BLF_I18NCONTEXT_ID_CURVE,
+		                                 BLF_I18NCONTEXT_ID_METABALL,
+		                                 BLF_I18NCONTEXT_ID_MATERIAL,
+		                                 BLF_I18NCONTEXT_ID_TEXTURE,
+		                                 BLF_I18NCONTEXT_ID_IMAGE,
+		                                 BLF_I18NCONTEXT_ID_LATTICE,
+		                                 BLF_I18NCONTEXT_ID_LAMP,
+		                                 BLF_I18NCONTEXT_ID_CAMERA,
+		                                 BLF_I18NCONTEXT_ID_WORLD,
+		                                 BLF_I18NCONTEXT_ID_SCREEN,
+		                                 BLF_I18NCONTEXT_ID_TEXT);
+		BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_ID_SPEAKER,
+		                                 BLF_I18NCONTEXT_ID_SOUND,
+		                                 BLF_I18NCONTEXT_ID_ARMATURE,
+		                                 BLF_I18NCONTEXT_ID_ACTION,
+		                                 BLF_I18NCONTEXT_ID_NODETREE,
+		                                 BLF_I18NCONTEXT_ID_BRUSH,
+		                                 BLF_I18NCONTEXT_ID_PARTICLESETTINGS,
+		                                 BLF_I18NCONTEXT_ID_GPENCIL);
+		
 		if (newop) {
-			but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
+			but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
+			                        (id) ? "" : CTX_IFACE_(i18n_ctxt, "New"), 0, 0, w, UI_UNIT_Y, NULL);
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
 		}
 		else {
-			but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id) ? "" : IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+			but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(i18n_ctxt, "New"),
+			                       0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
 		}
 
@@ -467,11 +535,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 		int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
 		
 		if (openop) {
-			but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL);
+			but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
+			                        0, 0, w, UI_UNIT_Y, NULL);
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
 		}
 		else {
-			but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+			but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
+			                       NULL, 0, 0, 0, 0, NULL);
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
 		}
 
@@ -488,7 +558,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 		}
 		else {
 			but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
-			                   TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"));
+			                   TIP_("Unlink datablock "
+			                        "(Shift + Click to set users to zero, data will then not be saved)"));
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
 
 			if (RNA_property_flag(template->prop) & PROP_NEVER_NULL)
@@ -505,7 +576,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 	uiBlockEndAlign(block);
 }
 
-static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
+static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+                           const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
 {
 	TemplateID *template;
 	PropertyRNA *prop;
@@ -545,19 +617,24 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
 	MEM_freeN(template);
 }
 
-void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
+void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+                  const char *openop, const char *unlinkop)
 {
-	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0);
+	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
+	               UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0);
 }
 
-void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
+void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+                        const char *openop, const char *unlinkop)
 {
 	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME, 0, 0);
 }
 
-void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols)
+void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+                         const char *openop, const char *unlinkop, int rows, int cols)
 {
-	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols);
+	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
+	               UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols);
 }
 
 /************************ ID Chooser Template ***************************/
@@ -567,7 +644,8 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
  * - propname: property identifier for property that ID-pointer gets stored to
  * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used
  */
-void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, const char *text)
+void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
+                     const char *text)
 {
 	PropertyRNA *propID, *propType;
 	uiLayout *row;
@@ -580,7 +658,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
 		RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
-	if (!propType || RNA_property_type(propType) != PROP_ENUM) { 
+	if (!propType || RNA_property_type(propType) != PROP_ENUM) {
 		RNA_warning("pointer-type property not found: %s.%s", RNA_struct_identifier(ptr->type), proptypename);
 		return;
 	}
@@ -614,7 +692,8 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
  * - propname: property identifier for property that path gets stored to
  * - root_ptr: struct that path gets built from
  */
-void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), const char *text)
+void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
+                           const char *text)
 {
 	PropertyRNA *propPath;
 	uiLayout *row;
@@ -707,7 +786,7 @@ static int modifier_can_delete(ModifierData *md)
 	return 1;
 }
 
-/* Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
+/* Check whether Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
 static int modifier_is_simulation(ModifierData *md)
 {
 	/* Physic Tab */
@@ -779,7 +858,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 		uiBlockBeginAlign(block);
 		/* Softbody not allowed in this situation, enforce! */
 		if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
-		     (md->type != eModifierType_Surface) )
+		    (md->type != eModifierType_Surface) )
 		{
 			uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
 			uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
@@ -791,7 +870,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 		if (ob->type == OB_MESH) {
 			if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) {
 				/* -- convert to rna ? */
-				but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+				but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0,
+				                       UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
 				                       TIP_("Apply modifier to editing cage during Edit mode"));
 				if (index < cageIndex)
 					uiButSetFlag(but, UI_BUT_DISABLED);
@@ -802,7 +882,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 
 				/* place holder button */
 				uiBlockSetEmboss(block, UI_EMBOSSN);
-				but = uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL);
+				but = uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y,
+				                   NULL, 0.0, 0.0, 0.0, 0.0, NULL);
 				uiButSetFlag(but, UI_BUT_DISABLED);
 				uiBlockSetEmboss(block, UI_EMBOSS);
 			}
@@ -812,7 +893,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 			if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
 				/* add disabled pre-tessellated button, so users could have
 				 * message for this modifiers */
-				but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+				but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
+				                       UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
 				                       TIP_("This modifier could be applied on splines' points only"));
 				uiButSetFlag(but, UI_BUT_DISABLED);
 			}
@@ -866,15 +948,20 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 				uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
 				uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA);
 				
-				if (modifier_sameTopology(md) && !modifier_nonGeometrical(md))
-					uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0, "apply_as", MODIFIER_APPLY_SHAPE);
+				if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
+					uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0,
+					            "apply_as", MODIFIER_APPLY_SHAPE);
+				}
 			}
 			
 			uiBlockClearButLock(block);
 			uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
 			
-			if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke))
+			if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
+			           eModifierType_Cloth, eModifierType_Smoke))
+			{
 				uiItemO(row, IFACE_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy");
+			}
 		}
 		
 		/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
@@ -1046,8 +1133,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 		
 		/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
-		uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
-		uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
+		uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 244, yco, 19, 19,
+		             NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
+		uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 262, yco, 19, 19,
+		             NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
 		
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
@@ -1076,7 +1165,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 		
 		/* enabled */
 		uiBlockSetEmboss(block, UI_EMBOSSN);
-		uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
+		uiItemR(row, &ptr, "mute", 0, "",
+		        (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		
 		uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
@@ -1221,7 +1311,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
 			else ma = (Material *)pparent;
 			
 			/* Create RNA Pointer */
-			RNA_pointer_create(id, &RNA_Material, ma, &material_ptr);
+			RNA_pointer_create(&ma->id, &RNA_Material, ma, &material_ptr);
 
 			col = uiLayoutColumn(row, TRUE);
 			uiLayoutSetScaleX(col, 1.5);
@@ -1233,14 +1323,22 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
 			RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
 			
 			uiLayoutRow(layout, TRUE);
-			uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
-			if (GS(parent->name) == ID_MA)
-				uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
-			else if (GS(parent->name) == ID_LA)
-				uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
-			else if (GS(parent->name) == ID_WO)
-				uiDefButS(block, ROW, B_MATPRV, IFACE_("World"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
-			uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
+			uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+			          pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
+			if (GS(parent->name) == ID_MA) {
+				uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+				          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+			}
+			else if (GS(parent->name) == ID_LA) {
+				uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+				          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+			}
+			else if (GS(parent->name) == ID_WO) {
+				uiDefButS(block, ROW, B_MATPRV, IFACE_("World"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+				          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+			}
+			uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+			          pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
 			
 			/* Alpha button for texture preview */
 			if (*pr_texture != TEX_PR_OTHER) {
@@ -1281,7 +1379,7 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
 
 	if (colorband_element_add(coba, pos)) {
 		rna_update_cb(C, cb_v, NULL);
-		ED_undo_push(C, "Add colorband");	
+		ED_undo_push(C, "Add colorband");
 	}
 }
 
@@ -1330,7 +1428,8 @@ static void colorband_update_cb(bContext *UNUSED(C), void *bt_v, void *coba_v)
 }
 
 /* offset aligns from bottom, standard width 300, height 115 */
-static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb)
+static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba,
+                                    int xoffs, int yoffs, RNAUpdateCb *cb)
 {
 	uiBut *bt;
 	uiLayout *row;
@@ -1349,13 +1448,16 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
 
 
 	/* XXX, todo for later - convert to operator - campbell */
-	bt = uiDefBut(block, BUT, 0, "F",        95 + xoffs, line1_y, 20, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip colorband"));
+	bt = uiDefBut(block, BUT, 0, "F",        95 + xoffs, line1_y, 20, UI_UNIT_Y,
+	              NULL, 0, 0, 0, 0, TIP_("Flip colorband"));
 	uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
 
-	uiDefButS(block, NUM, 0,        "",             120 + xoffs, line1_y, 80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop"));
+	uiDefButS(block, NUM, 0, "", 120 + xoffs, line1_y, 80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)),
+	          0, 0, TIP_("Choose active color stop"));
 
-	bt = uiDefButS(block, MENU, 0,       IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
-	               210 + xoffs, line1_y, 90, UI_UNIT_Y,      &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops"));
+	bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
+	               210 + xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
+	               TIP_("Set interpolation between color stops"));
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 	uiBlockEndAlign(block);
 
@@ -1391,10 +1493,11 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
 	bt = uiDefBut(block, BUT, 0, IFACE_("Add"), xs, butr->ymin + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0,
 	              TIP_("Add a new color stop to the colorband"));
 	uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
-	bt = uiDefBut(block, BUT, 0, IFACE_("Delete"), xs + 2.0f * unit, butr->ymin + UI_UNIT_Y, 1.5f * unit, UI_UNIT_Y,    NULL, 0, 0, 0, 0,
-	              TIP_("Delete the active position"));
+	bt = uiDefBut(block, BUT, 0, IFACE_("Delete"), xs + 2.0f * unit, butr->ymin + UI_UNIT_Y, 1.5f * unit, UI_UNIT_Y,
+	              NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
 	uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
-	bt = uiDefBut(block, BUT, 0, "F",        xs + 3.5f * unit, butr->ymin + UI_UNIT_Y, 0.5f * unit, UI_UNIT_Y,  NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
+	bt = uiDefBut(block, BUT, 0, "F", xs + 3.5f * unit, butr->ymin + UI_UNIT_Y, 0.5f * unit, UI_UNIT_Y,
+	              NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
 	uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
 	uiBlockEndAlign(block);
 
@@ -1405,8 +1508,8 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
 		uiItemR(layout, &ptr, "color", 0, "", ICON_NONE);
 	}
 
-	bt = uiDefButS(block, MENU, 0, TIP_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
-	               xs + 10.0f * unit, butr->ymin + UI_UNIT_Y, unit * 4, UI_UNIT_Y,     &coba->ipotype, 0.0, 0.0, 0, 0,
+	bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
+	               xs + 10.0f * unit, butr->ymin + UI_UNIT_Y, unit * 4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
 	               TIP_("Set interpolation between color stops"));
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
@@ -1416,7 +1519,8 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
 	uiBlockEndAlign(block);
 }
 
-static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
+static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr,
+                                     int small, RNAUpdateCb *cb)
 {
 	if (small)
 		colorband_buttons_small(layout, block, coba, butr, cb);
@@ -1485,7 +1589,8 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
 
 	hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
 
-	bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist,
+	              0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
 	MEM_freeN(cb);
@@ -1522,7 +1627,8 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
 	
 	scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
 
-	bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes,
+	              0, 0, 0, 0, "");
 	(void)bt;  /* UNUSED */
 	
 	MEM_freeN(cb);
@@ -1559,7 +1665,8 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
 
 	scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
 	
-	bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
+	              scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 	
 	MEM_freeN(cb);
@@ -1658,10 +1765,14 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
 	uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
 
 	uiBlockBeginAlign(block);
-	uiDefButF(block, NUM, 0, IFACE_("Min X "),   0, 4 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
-	uiDefButF(block, NUM, 0, IFACE_("Min Y "),   0, 3 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
-	uiDefButF(block, NUM, 0, IFACE_("Max X "),   0, 2 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
-	uiDefButF(block, NUM, 0, IFACE_("Max Y "),   0, UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
+	uiDefButF(block, NUM, 0, IFACE_("Min X "),   0, 4 * UI_UNIT_Y, width, UI_UNIT_Y,
+	          &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
+	uiDefButF(block, NUM, 0, IFACE_("Min Y "),   0, 3 * UI_UNIT_Y, width, UI_UNIT_Y,
+	          &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
+	uiDefButF(block, NUM, 0, IFACE_("Max X "),   0, 2 * UI_UNIT_Y, width, UI_UNIT_Y,
+	          &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
+	uiDefButF(block, NUM, 0, IFACE_("Max Y "),   0, UI_UNIT_Y, width, UI_UNIT_Y,
+	          &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
 
 	uiBlockSetDirection(block, UI_RIGHT);
 
@@ -1710,12 +1821,18 @@ static uiBlock *curvemap_tools_func(bContext *C, ARegion *ar, void *cumap_v)
 	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
 
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"),         0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"),      0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"),            0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"),  0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"),    0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"),            0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"),          0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"),       0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"),         0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"),   0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"),         0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
 	uiBlockSetDirection(block, UI_RIGHT);
 	uiTextBoundsBlock(block, 50);
@@ -1732,10 +1849,14 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_
 	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
 
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"),     0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"),  0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"),        0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"),        0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"),    0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"),   0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"),   0, yco -= UI_UNIT_Y,
+	                 menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
 	uiBlockSetDirection(block, UI_RIGHT);
 	uiTextBoundsBlock(block, 50);
@@ -1775,7 +1896,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
 }
 
 /* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
-static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, int brush, RNAUpdateCb *cb)
+static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels,
+                                    int brush, RNAUpdateCb *cb)
 {
 	CurveMapping *cumap = ptr->data;
 	CurveMap *cm = &cumap->cm[cumap->cur];
@@ -1899,10 +2021,16 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
 	}
 
 	if (cmp) {
+		const float range_clamp[2]   = {0.0f, 1.0f};
+		const float range_unclamp[2] = {-1000.0f, 1000.0f};  /* arbitrary limits here */
+		const float *range = (cumap->flag & CUMA_DO_CLIP) ? range_clamp : range_unclamp;
+
 		uiLayoutRow(layout, TRUE);
 		uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap);
-		bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, "");
-		bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, "");
+		bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+		               &cmp->x, range[0], range[1], 1, 5, "");
+		bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y,
+		               &cmp->y, range[0], range[1], 1, 5, "");
 	}
 
 	/* black/white levels */
@@ -1951,29 +2079,48 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
 	MEM_freeN(cb);
 }
 
-/********************* ColorWheel Template ************************/
+/********************* ColorPicker Template ************************/
 
 #define WHEEL_SIZE  100
 
-void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
+/* This template now follows User Preference for type - name is not correct anymore... */
+void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider,
+                           int lock, int lock_luminosity, int cubic)
 {
 	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	uiBlock *block = uiLayoutGetBlock(layout);
 	uiLayout *col, *row;
-	uiBut *but;
+	uiBut *but = NULL;
 	float softmin, softmax, step, precision;
-	
+
 	if (!prop) {
 		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
 	RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
-	
-	col = uiLayoutColumn(layout, FALSE);
+
+	col = uiLayoutColumn(layout, TRUE);
 	row = uiLayoutRow(col, TRUE);
-	
-	but = uiDefButR_prop(block, HSVCIRCLE, 0, "",   0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+
+	switch (U.color_picker_type) {
+		case USER_CP_CIRCLE:
+			but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+			                     -1, 0.0, 0.0, 0, 0, "");
+			break;
+		case USER_CP_SQUARE_SV:
+			but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+			                     -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
+			break;
+		case USER_CP_SQUARE_HS:
+			but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+			                     -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
+			break;
+		case USER_CP_SQUARE_HV:
+			but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+			                     -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
+			break;
+	}
 
 	if (lock) {
 		but->flag |= UI_BUT_COLOR_LOCK;
@@ -1989,10 +2136,31 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
 	if (cubic)
 		but->flag |= UI_BUT_COLOR_CUBIC;
 
-	uiItemS(row);
 	
-	if (value_slider)
-		uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+	if (value_slider) {
+		switch (U.color_picker_type) {
+			case USER_CP_CIRCLE:
+				uiItemS(row);
+				uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+				               -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+				break;
+			case USER_CP_SQUARE_SV:
+				uiItemS(col);
+				uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+				               -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
+				break;
+			case USER_CP_SQUARE_HS:
+				uiItemS(col);
+				uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+				               -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
+				break;
+			case USER_CP_SQUARE_HV:
+				uiItemS(col);
+				uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+				               -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
+				break;
+		}
+	}
 }
 
 /********************* Layer Buttons Template ************************/
@@ -2150,7 +2318,8 @@ void uiTemplateGameStates(uiLayout *layout, PointerRNA *ptr, const char *propnam
 				else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state))
 					icon = ICON_LAYER_USED;
 				
-				but = uiDefIconButR_prop(block, ICONTOG, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, state, 0, 0, -1, -1, sca_state_name_get(ob, state));
+				but = uiDefIconButR_prop(block, ICONTOG, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop,
+				                         state, 0, 0, -1, -1, sca_state_name_get(ob, state));
 				uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state));
 				but->type = TOG;
 			}
@@ -2198,7 +2367,8 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
 	return rnaicon;
 }
 
-static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id)
+static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i,
+                          int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id)
 {
 	uiBlock *block = uiLayoutGetBlock(layout);
 	uiBut *but;
@@ -2212,7 +2382,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 	/* list item behind label & other buttons */
 	sub = uiLayoutRow(overlap, FALSE);
 
-	but = uiDefButR_prop(block, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+	but = uiDefButR_prop(block, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop,
+	                     0, 0, i, 0, 0, "");
 	uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
 
 	sub = uiLayoutRow(overlap, FALSE);
@@ -2229,7 +2400,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 	if (itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
 		uiItemL(sub, name, icon);
 		uiBlockSetEmboss(block, UI_EMBOSSN);
-		uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render", 0, 0, 0, 0, 0, NULL);
+		uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render",
+		              0, 0, 0, 0, 0, NULL);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
 	else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
@@ -2322,7 +2494,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 		uiItemL(sub, name_final, icon);
 		if (dynamicPaint_surfaceHasColorPreview(surface)) {
 			uiBlockSetEmboss(block, UI_EMBOSSN);
-			uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
+			uiDefIconButR(block, OPTION, 0,
+			              (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
 			              0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
 			uiBlockSetEmboss(block, UI_EMBOSS);
 		}
@@ -2411,7 +2584,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 	}
 }
 
-void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
+void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr,
+                    const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
 {
 	PropertyRNA *prop = NULL, *activeprop;
 	PropertyType type, activetype;
@@ -2487,7 +2661,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 					row = uiLayoutRow(col, FALSE);
 
 				icon = list_item_icon_get(C, &itemptr, rnaicon, 1);
-				but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+				but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr,
+				                         activeprop, 0, 0, i, 0, 0, "");
 				uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
 				
 
@@ -2529,7 +2704,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 
 		/* next/prev button */
 		BLI_snprintf(numstr, sizeof(numstr), "%d :", i);
-		but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
+		but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, activeptr,
+		                             activeprop, 0, 0, 0, 0, 0, "");
 		if (i == 0)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 	}
@@ -2586,7 +2762,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 		/* add scrollbar */
 		if (len > items) {
 			col = uiLayoutColumn(row, FALSE);
-			uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll, 0, len - items, items, 0, "");
+			uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll,
+			          0, len - items, items, 0, "");
 		}
 	}
 }
@@ -2608,6 +2785,9 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
 	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
 		wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
 
+		if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0)
+			continue;
+
 		if (BLI_strcasestr(ot->name, str)) {
 			if (WM_operator_poll((bContext *)C, ot)) {
 				char name[256];
@@ -2633,6 +2813,11 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
 	BLI_ghashIterator_free(iter);
 }
 
+void uiOperatorSearch_But(uiBut *but)
+{
+	uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
+}
+
 void uiTemplateOperatorSearch(uiLayout *layout)
 {
 	uiBlock *block;
@@ -2643,7 +2828,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
 	uiBlockSetCurLayout(block, layout);
 
 	but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, 0, "");
-	uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
+	uiOperatorSearch_But(but);
 }
 
 /************************* Running Jobs Template **************************/
@@ -2733,19 +2918,19 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
 		ui_abs = uiLayoutAbsolute(layout, FALSE);
 		(void)ui_abs;  /* UNUSED */
 		
-		uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 
-		             0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
+		uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8,
+		             NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
 		uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), 
 		         UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress"));
 		
 		uiLayoutRow(layout, FALSE);
 	}
 	if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
-		uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
-		                 TIP_("Stop screencast"));
+		uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y,
+		                 NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop screencast"));
 	if (screen->animtimer)
-		uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
-		                 TIP_("Stop animation playback"));
+		uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, 100, UI_UNIT_Y,
+		                 NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop animation playback"));
 }
 
 /************************* Reports for Last Operator Template **************************/
@@ -2774,8 +2959,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 	block = uiLayoutGetBlock(ui_abs);
 	
 	width = BLF_width(style->widget.uifont_id, report->message);
-	width = MIN2(rti->widthfac * width, width);
-	width = MAX2(width, 10);
+	width = min_ii((int)(rti->widthfac * width), width);
+	width = max_ii(width, 10);
 	
 	/* make a box around the report to make it stand out */
 	uiBlockBeginAlign(block);
@@ -2784,7 +2969,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 	rgb_float_to_uchar(but->col, rti->col);
 	but->col[3] = 255;
 
-	but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+	but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+	               NULL, 0.0f, 0.0f, 0, 0, "");
 	but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale);
 	but->col[3] = 255;
 
@@ -2805,14 +2991,15 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 
 	if (reports->list.first != reports->list.last)
-		uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0,
-		              UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
+		uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X,
+		              UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
 	else
 		uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
 
 	uiBlockSetEmboss(block, UI_EMBOSS);
 	
-	uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+	uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+	         NULL, 0.0f, 0.0f, 0, 0, "");
 }
 
 /********************************* Keymap *************************************/
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0e1fd87..c4b80f0 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -345,7 +345,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
 	const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
 	                  (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
 
-	minsize = mini(BLI_rcti_size_x(rect) * hnum,
+	minsize = min_ii(BLI_rcti_size_x(rect) * hnum,
 	               BLI_rcti_size_y(rect) * vnum);
 	
 	if (2.0f * rad > minsize)
@@ -491,7 +491,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
 	float centx, centy, sizex, sizey, minsize;
 	int a, i1 = 0, i2 = 1;
 	
-	minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
+	minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
 	
 	/* center position and size */
 	centx = (float)rect->xmin + 0.5f * minsize;
@@ -501,16 +501,16 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
 	if (where == 'r') {
 		centx = (float)rect->xmax - 0.5f * minsize;
 		sizex = -sizex;
-	}	
+	}
 	else if (where == 't') {
 		centy = (float)rect->ymax - 0.5f * minsize;
 		sizey = -sizey;
 		i2 = 0; i1 = 1;
-	}	
+	}
 	else if (where == 'b') {
 		sizex = -sizex;
 		i2 = 0; i1 = 1;
-	}	
+	}
 	
 	for (a = 0; a < 3; a++) {
 		tria->vec[a][0] = sizex * num_tria_vert[a][i1] + centx;
@@ -526,7 +526,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
 	float centx, centy, sizex, sizey, minsize;
 	int a, i1 = 0, i2 = 1;
 	
-	minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
+	minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
 	
 	/* center position and size */
 	centx = (float)rect->xmin + 0.5f * minsize;
@@ -536,16 +536,16 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
 	if (where == 'r') {
 		centx = (float)rect->xmax - 0.5f * minsize;
 		sizex = -sizex;
-	}	
+	}
 	else if (where == 't') {
 		centy = (float)rect->ymax - 0.5f * minsize;
 		sizey = -sizey;
 		i2 = 0; i1 = 1;
-	}	
+	}
 	else if (where == 'b') {
 		sizex = -sizex;
 		i2 = 0; i1 = 1;
-	}	
+	}
 	
 	for (a = 0; a < 16; a++) {
 		tria->vec[a][0] = sizex * scroll_circle_vert[a][i1] + centx;
@@ -572,12 +572,12 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
 	/* center position and size */
 	centx = rect->xmax - 0.5f * BLI_rcti_size_y(rect);
 	centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect);
-	size = 0.4f * BLI_rcti_size_y(rect);
+	size = 0.4f * (float)BLI_rcti_size_y(rect);
 	
 	/* XXX exception */
 	asp = ((float)BLI_rcti_size_x(rect)) / ((float)BLI_rcti_size_y(rect));
 	if (asp > 1.2f && asp < 2.6f)
-		centx = rect->xmax - 0.3f * BLI_rcti_size_y(rect);
+		centx = rect->xmax - 0.4f * (float)BLI_rcti_size_y(rect);
 	
 	for (a = 0; a < 6; a++) {
 		tria->vec[a][0] = size * menu_tria_vert[a][0] + centx;
@@ -651,8 +651,8 @@ static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert
 	for (a = 0; a < totvert; a++) {
 		quad_strip[a * 2][0] = wtb->outer_v[a][0];
 		quad_strip[a * 2][1] = wtb->outer_v[a][1];
-		quad_strip[a * 2 + 1][0] = wtb->outer_v[a][0];
-		quad_strip[a * 2 + 1][1] = wtb->outer_v[a][1] - 1.0f;
+		quad_strip[a * 2 + 1][0] = wtb->inner_v[a][0];
+		quad_strip[a * 2 + 1][1] = wtb->inner_v[a][1];
 	}
 }
 
@@ -878,7 +878,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
 	aspect = but->block->aspect;
 	if (aspect != but->aspect) {
 		/* prevent scaling up icon in pupmenu */
-		if (aspect < 1.0f) {			
+		if (aspect < 1.0f) {
 			height = UI_DPI_ICON_SIZE;
 			aspect = 1.0f;
 			
@@ -1044,6 +1044,8 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 				ui_text_clip_give_prev_off(but);
 			len = strlen(but->drawstr);
 			bytes = BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
+			if (bytes < 0)
+				bytes = 1;
 			but->drawstr[len - bytes] = 0;
 		}
 
@@ -1276,9 +1278,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 /* draws text and icons for buttons */
 static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
 {
-	if (but == NULL) {
+	char password_str[UI_MAX_DRAW_STR];
+
+	if (but == NULL)
 		return;
-	}
+
+	ui_button_text_password_hide(password_str, but, FALSE);
 
 	/* clip but->drawstr to fit in available space */
 	if (but->editstr && but->pos >= 0) {
@@ -1337,6 +1342,8 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 		widget_draw_text(fstyle, wcol, but, rect);
 
 	}
+
+	ui_button_text_password_hide(password_str, but, TRUE);
 }
 
 
@@ -1852,7 +1859,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
 	else if (direction == UI_DOWN) {
 		roundboxalign = (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
 		rect->ymin -= 4.0;
-	} 
+	}
 	else if (direction == UI_TOP) {
 		roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
 		rect->ymax += 4.0;
@@ -1895,7 +1902,7 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec
 	/* duplication of code... well, simple is better now */
 	const float centx = BLI_rcti_cent_x_fl(rect);
 	const float centy = BLI_rcti_cent_y_fl(rect);
-	const float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
+	const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
 	const float m_delta[2] = {mx - centx, my - centy};
 	const float dist_squared = len_squared_v2(m_delta);
 
@@ -1910,7 +1917,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
 
 	const float centx = BLI_rcti_cent_x_fl(rect);
 	const float centy = BLI_rcti_cent_y_fl(rect);
-	float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
+	float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
 
 	/* gouraud triangle fan */
 	const float *hsv_ptr = ui_block_hsv_get(but->block);
@@ -1995,7 +2002,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
 /* draws in resolution of 20x4 colors */
 void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha)
 {
-	const float color_step = (type == UI_GRAD_H) ? 0.02 : 0.05f;
+	const float color_step = (type == UI_GRAD_H) ? 0.02f : 0.05f;
 	int a;
 	float h = hsv[0], s = hsv[1], v = hsv[2];
 	float dx, dy, sx1, sx2, sy;
@@ -2052,7 +2059,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
 	
 	/* old below */
 	
-	for (dx = 0.0f; dx < 1.0f; dx += color_step) {
+	for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */
 		/* previous color */
 		copy_v3_v3(col0[0], col1[0]);
 		copy_v3_v3(col0[1], col1[1]);
@@ -2107,7 +2114,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
 		sx1 = rect->xmin +  dx               * BLI_rcti_size_x(rect);
 		sx2 = rect->xmin + (dx + color_step) * BLI_rcti_size_x(rect);
 		sy = rect->ymin;
-		dy = BLI_rcti_size_y(rect) / 3.0;
+		dy = (float)BLI_rcti_size_y(rect) / 3.0f;
 		
 		glBegin(GL_QUADS);
 		for (a = 0; a < 3; a++, sy += dy) {
@@ -2364,7 +2371,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
 		wtb.emboss = 0; /* only emboss once */
 		
 		/* exception for progress bar */
-		if (state & UI_SCROLL_NO_OUTLINE)	
+		if (state & UI_SCROLL_NO_OUTLINE)
 			SWAP(short, outline, wtb.outline);
 		
 		round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
@@ -2388,7 +2395,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
 		
 		if (state & UI_SCROLL_NO_OUTLINE)
 			SWAP(short, outline, wtb.outline);
-	}	
+	}
 }
 
 static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
@@ -2402,7 +2409,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 	value = ui_get_but_val(but);
 
 	size = (but->softmax + but->a1 - but->softmin);
-	size = MAX2(size, 2);
+	size = max_ff(size, 2.0f);
 	
 	/* position */
 	rect1 = *rect;
@@ -2423,7 +2430,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 
 			if (rect1.xmax > rect->xmax) {
 				rect1.xmax = rect->xmax;
-				rect1.xmin = maxi(rect1.xmax - min, rect->xmin);
+				rect1.xmin = max_ii(rect1.xmax - min, rect->xmin);
 			}
 		}
 	}
@@ -2440,7 +2447,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 
 			if (rect1.ymax > rect->ymax) {
 				rect1.ymax = rect->ymax;
-				rect1.ymin = MAX2(rect1.ymax - min, rect->ymin);
+				rect1.ymin = max_ii(rect1.ymax - min, rect->ymin);
 			}
 		}
 	}
@@ -2616,6 +2623,11 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 	
 }
 
+static void widget_normal(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
+{
+	ui_draw_but_NORMAL(but, wcol, rect);
+}
+
 static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
 {
 	if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
@@ -2627,7 +2639,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
 		/* rounded */
 		round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f);
 		widgetbase_draw(&wtb, wcol);
-	}	
+	}
 }
 
 
@@ -2662,8 +2674,8 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
 	
 	widgetbase_draw(&wtb, wcol);
 	
-	/* text space */
-	rect->xmax -= BLI_rcti_size_y(rect);
+	/* text space, arrows are about 0.6 height of button */
+	rect->xmax -= (6 * BLI_rcti_size_y(rect)) / 10;
 }
 
 static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -3023,6 +3035,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 			break;
 			
 		case UI_WTYPE_NORMAL:
+			wt.custom = widget_normal;
 			break;
 
 		case UI_WTYPE_SCROLL:
@@ -3094,14 +3107,10 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
 	if (but->active) {
 		int direction = ui_button_open_menu_direction(but);
 
-		if (direction == UI_TOP)
-			roundbox &= ~(UI_CNR_TOP_RIGHT|UI_CNR_TOP_LEFT);
-		else if (direction == UI_DOWN)
-			roundbox &= ~(UI_CNR_BOTTOM_RIGHT|UI_CNR_BOTTOM_LEFT);
-		else if (direction == UI_LEFT)
-			roundbox &= ~(UI_CNR_TOP_LEFT|UI_CNR_BOTTOM_LEFT);
-		else if (direction == UI_RIGHT)
-			roundbox &= ~(UI_CNR_TOP_RIGHT|UI_CNR_BOTTOM_RIGHT);
+		if      (direction == UI_TOP)   roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT);
+		else if (direction == UI_DOWN)  roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
+		else if (direction == UI_LEFT)  roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
+		else if (direction == UI_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
 	}
 
 	return roundbox;
@@ -3266,7 +3275,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 				
 			case BUT_NORMAL:
-				ui_draw_but_NORMAL(but, &tui->wcol_regular, rect);
+				wt = widget_type(UI_WTYPE_NORMAL);
 				break;
 				
 			case BUT_IMAGE:
@@ -3350,7 +3359,7 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
 			glColor3ubv((unsigned char *)wt->wcol.text);
 			UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v');
 		}
-	}	
+	}
 }
 
 uiWidgetColors *ui_tooltip_get_theme(void)
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 1efb243..fa5d580 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -236,7 +236,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
 					cp = ts->shade2; break;
 				case TH_HILITE:
 					cp = ts->hilite; break;
-
+				
 				case TH_GRID:
 					cp = ts->grid; break;
 				case TH_WIRE:
@@ -510,6 +510,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
 				case TH_NLA_SOUND_SEL:
 					cp = ts->nla_sound_sel;
 					break;
+					
+				case TH_AXIS_X:
+					cp = btheme->tui.xaxis; break;
+				case TH_AXIS_Y:
+					cp = btheme->tui.yaxis; break;
+				case TH_AXIS_Z:
+					cp = btheme->tui.zaxis; break;
 			}
 		}
 	}
@@ -651,13 +658,18 @@ void ui_theme_init_default(void)
 		strcpy(btheme->name, "Default");
 	}
 	
-	UI_SetTheme(0, 0);  // make sure the global used in this file is set
+	UI_SetTheme(0, 0);  /* make sure the global used in this file is set */
 
 	/* UI buttons */
 	ui_widget_color_init(&btheme->tui);
+	
 	btheme->tui.iconfile[0] = 0;
 	btheme->tui.panel.show_header = FALSE;
 	rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
+	
+	rgba_char_args_set(btheme->tui.xaxis, 220,   0,   0, 255);
+	rgba_char_args_set(btheme->tui.yaxis,   0, 220,   0, 255);
+	rgba_char_args_set(btheme->tui.zaxis,   0,   0, 220, 255);
 
 	/* Bone Color Sets */
 	ui_theme_init_boneColorSets(btheme);
@@ -808,9 +820,9 @@ void ui_theme_init_default(void)
 	rgba_char_args_set_fl(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
 	rgba_char_args_set(btheme->tfile.text,  250, 250, 250, 255);
 	rgba_char_args_set(btheme->tfile.text_hi, 15, 15, 15, 255);
-	rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255);    // bookmark/ui regions
-	rgba_char_args_set(btheme->tfile.active, 130, 130, 130, 255); // selected files
-	rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
+	rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255);  /* bookmark/ui regions */
+	rgba_char_args_set(btheme->tfile.active, 130, 130, 130, 255); /* selected files */
+	rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255);  /* selected files */
 	
 	rgba_char_args_set(btheme->tfile.grid,  250, 250, 250, 255);
 	rgba_char_args_set(btheme->tfile.image, 250, 250, 250, 255);
@@ -891,7 +903,7 @@ void ui_theme_init_default(void)
 	btheme->ttime = btheme->tv3d;
 	rgba_char_args_set_fl(btheme->ttime.back,   0.45, 0.45, 0.45, 1.0);
 	rgba_char_args_set_fl(btheme->ttime.grid,   0.36, 0.36, 0.36, 1.0);
-	rgba_char_args_set(btheme->ttime.shade1,  173, 173, 173, 255);      // sliders
+	rgba_char_args_set(btheme->ttime.shade1,  173, 173, 173, 255);      /* sliders */
 	
 	/* space node, re-uses syntax color storage */
 	btheme->tnode = btheme->tv3d;
@@ -932,7 +944,7 @@ void ui_theme_init_default(void)
 
 void UI_SetTheme(int spacetype, int regionid)
 {
-	if (spacetype == 0) { // called for safety, when delete themes
+	if (spacetype == 0) {  /* called for safety, when delete themes */
 		theme_active = U.themes.first;
 		theme_spacetype = SPACE_VIEW3D;
 		theme_regionid = RGN_TYPE_WINDOW;
@@ -950,7 +962,7 @@ bTheme *UI_GetTheme(void)
 	return U.themes.first;
 }
 
-// for space windows only
+/* for space windows only */
 void UI_ThemeColor(int colorid)
 {
 	const unsigned char *cp;
@@ -960,7 +972,7 @@ void UI_ThemeColor(int colorid)
 
 }
 
-// plus alpha
+/* plus alpha */
 void UI_ThemeColor4(int colorid)
 {
 	const unsigned char *cp;
@@ -970,7 +982,7 @@ void UI_ThemeColor4(int colorid)
 
 }
 
-// set the color with offset for shades
+/* set the color with offset for shades */
 void UI_ThemeColorShade(int colorid, int offset)
 {
 	int r, g, b;
@@ -1003,7 +1015,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
 	glColor4ub(r, g, b, a);
 }
 
-// blend between to theme colors, and set it
+/* blend between to theme colors, and set it */
 void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
 {
 	int r, g, b;
@@ -1020,7 +1032,7 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
 	glColor3ub(r, g, b);
 }
 
-// blend between to theme colors, shade it, and set it
+/* blend between to theme colors, shade it, and set it */
 void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
 {
 	int r, g, b;
@@ -1041,7 +1053,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
 	glColor3ub(r, g, b);
 }
 
-// blend between to theme colors, shade it, and set it
+/* blend between to theme colors, shade it, and set it */
 void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset)
 {
 	int r, g, b, a;
@@ -1065,28 +1077,26 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
 }
 
 
-// get individual values, not scaled
+/* get individual values, not scaled */
 float UI_GetThemeValuef(int colorid)
 {
 	const unsigned char *cp;
 	
 	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	return ((float)cp[0]);
-
 }
 
-// get individual values, not scaled
+/* get individual values, not scaled */
 int UI_GetThemeValue(int colorid)
 {
 	const unsigned char *cp;
 	
 	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	return ((int) cp[0]);
-
 }
 
 
-// get the color, range 0.0-1.0
+/* get the color, range 0.0-1.0 */
 void UI_GetThemeColor3fv(int colorid, float col[3])
 {
 	const unsigned char *cp;
@@ -1108,7 +1118,7 @@ void UI_GetThemeColor4fv(int colorid, float col[4])
 	col[3] = ((float)cp[3]) / 255.0f;
 }
 
-// get the color, range 0.0-1.0, complete with shading offset
+/* get the color, range 0.0-1.0, complete with shading offset */
 void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
 {
 	int r, g, b;
@@ -1147,7 +1157,7 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
 	col[2] = b;
 }
 
-// get the color, in char pointer
+/* get the color, in char pointer */
 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
 {
 	const unsigned char *cp;
@@ -1158,7 +1168,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
 	col[2] = cp[2];
 }
 
-// get the color, in char pointer
+/* get the color, in char pointer */
 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
 {
 	const unsigned char *cp;
@@ -1181,7 +1191,7 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
 	col[3] = cp[3];
 }
 
-// blends and shades between two char color pointers
+/* blends and shades between two char color pointers */
 void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset)
 {
 	int r, g, b;
@@ -1214,7 +1224,7 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in
 	col[2] = b;
 }
 
-// get a 3 byte color, blended and shaded between two other char color pointers
+/* get a 3 byte color, blended and shaded between two other char color pointers */
 void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3],
                                   float fac, int offset)
 {
@@ -1244,21 +1254,20 @@ void UI_ThemeClearColor(int colorid)
 
 void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
 {
+	unsigned char col[3];
+	
 	switch (axis) {
 		case 'X':
-			dst_col[0] = src_col[0] > 219 ? 255 : src_col[0] + 36;
-			dst_col[1] = src_col[1] < 26 ? 0 : src_col[1] - 26;
-			dst_col[2] = src_col[2] < 26 ? 0 : src_col[2] - 26;
+			UI_GetThemeColor3ubv(TH_AXIS_X, col);
+			UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
 			break;
 		case 'Y':
-			dst_col[0] = src_col[0] < 46 ? 0 : src_col[0] - 36;
-			dst_col[1] = src_col[1] > 189 ? 255 : src_col[1] + 66;
-			dst_col[2] = src_col[2] < 46 ? 0 : src_col[2] - 36;
+			UI_GetThemeColor3ubv(TH_AXIS_Y, col);
+			UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
 			break;
 		case 'Z':
-			dst_col[0] = src_col[0] < 26 ? 0 : src_col[0] - 26;
-			dst_col[1] = src_col[1] < 26 ? 0 : src_col[1] - 26;
-			dst_col[2] = src_col[2] > 209 ? 255 : src_col[2] + 46;
+			UI_GetThemeColor3ubv(TH_AXIS_Z, col);
+			UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
 			break;
 		default:
 			BLI_assert(!"invalid axis arg");
@@ -1360,7 +1369,7 @@ void init_userdef_do_versions(void)
 				btheme->ttime = btheme->tv3d;
 				rgba_char_args_set_fl(btheme->ttime.back,   0.45, 0.45, 0.45, 1.0);
 				rgba_char_args_set_fl(btheme->ttime.grid,   0.36, 0.36, 0.36, 1.0);
-				rgba_char_args_set(btheme->ttime.shade1,  173, 173, 173, 255);      // sliders
+				rgba_char_args_set(btheme->ttime.shade1,  173, 173, 173, 255);  /* sliders */
 			}
 			if (btheme->text.syntaxn[3] == 0) {
 				rgba_char_args_set(btheme->text.syntaxn,    0, 0, 200, 255);    /* Numbers  Blue*/
@@ -1946,6 +1955,16 @@ void init_userdef_do_versions(void)
 				rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
 		}
 	}
+	
+	if (bmain->versionfile < 264 || (bmain->versionfile == 264 && bmain->subversionfile < 9)) {
+		bTheme *btheme;
+		
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_set(btheme->tui.xaxis, 220,   0,   0, 255);
+			rgba_char_args_set(btheme->tui.yaxis,   0, 220,   0, 255);
+			rgba_char_args_set(btheme->tui.zaxis,   0,   0, 220, 255);
+		}
+	}
 
 	/* GL Texture Garbage Collection (variable abused above!) */
 	if (U.textimeout == 0) {
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 47bee92..f1a3f59 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -299,7 +299,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
 			/* other view types are completely defined using their own settings already */
 			default:
 				/* we don't do anything here, as settings should be fine, but just make sure that rect */
-				break;	
+				break;
 		}
 	}
 	
@@ -476,8 +476,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 				if (winy < v2d->oldwiny) {
 					float temp = v2d->oldwiny - winy;
 					
-					cur->ymin += temp;
-					cur->ymax += temp;
+					if (v2d->align & V2D_ALIGN_NO_NEG_Y) {
+						cur->ymin -= temp;
+						cur->ymax -= temp;
+					}
+					else { /* Assume V2D_ALIGN_NO_POS_Y or combination */
+						cur->ymin += temp;
+						cur->ymax += temp;
+					}
 				}
 
 			}
@@ -593,7 +599,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 			if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
 				/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
 				temp = BLI_rctf_cent_x(tot);
-				diff = curheight * 0.5f;
+				diff = curwidth * 0.5f;
 				
 				cur->xmin = temp - diff;
 				cur->xmax = temp + diff;
@@ -1089,7 +1095,7 @@ static void step_to_grid(float *step, int *power, int unit)
 		}
 		
 		/* prevents printing 1.0 2.0 3.0 etc */
-		if (rem == 1.0f) (*power)++;	
+		if (rem == 1.0f) (*power)++;
 	}
 	else {
 		if (rem < 2.0f) rem = 2.0f;
@@ -1100,7 +1106,7 @@ static void step_to_grid(float *step, int *power, int unit)
 		
 		(*power)++;
 		/* prevents printing 1.0, 2.0, 3.0, etc. */
-		if (rem == 10.0f) (*power)++;	
+		if (rem == 10.0f) (*power)++;
 	}
 }
 
@@ -1256,7 +1262,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
 		vec2[1] = vec1[1] -= 0.5f * grid->dy;
 		step++;
 		
-		if (flag & V2D_HORIZONTAL_FINELINES) { 
+		if (flag & V2D_HORIZONTAL_FINELINES) {
 			UI_ThemeColorShade(TH_GRID, 16);
 			for (a = 0; a < step; a++) {
 				glBegin(GL_LINE_STRIP);
@@ -1487,7 +1493,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d,
 		
 		/* check whether sliders can disappear due to the full-range being used */
 		if (v2d->keeptot) {
-			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { 
+			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
 				v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
 				scrollers->horfull = 1;
 			}
@@ -1529,7 +1535,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d,
 
 		/* check whether sliders can disappear due to the full-range being used */
 		if (v2d->keeptot) {
-			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { 
+			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
 				v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
 				scrollers->vertfull = 1;
 			}
@@ -1682,7 +1688,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 					if (fac < hor.xmin + 10)
 						continue;
 					
-					switch (vs->xunits) {							
+					switch (vs->xunits) {
 						case V2D_UNIT_FRAMES:       /* frames (as whole numbers)*/
 							scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
 							break;
@@ -1797,7 +1803,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 				
 				BLF_disable_default(BLF_ROTATION);
 			}
-		}	
+		}
 	}
 	
 }
@@ -2066,7 +2072,7 @@ short UI_view2d_mouse_in_scrollers(const bContext *C, View2D *v2d, int x, int y)
 	}
 	if (scroll & V2D_SCROLL_VERTICAL) {
 		if (IN_2D_VERT_SCROLL(v2d, co)) return 'v';
-	}	
+	}
 	
 	/* not found */
 	return 0;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 8be2667..48a1f8b 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -642,7 +642,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
 				
 				v2d->cur.ymin += ofs + dy;
 				v2d->cur.ymax += ofs - dy;
-			} 
+			}
 			else {
 				v2d->cur.ymin += dy;
 				v2d->cur.ymax -= dy;
@@ -827,6 +827,11 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 	dx = RNA_float_get(op->ptr, "deltax");
 	dy = RNA_float_get(op->ptr, "deltay");
 
+	if (U.uiflag & USER_ZOOM_INVERT) {
+		dx *= -1;
+		dy *= -1;
+	}
+	
 	/* continuous zoom shouldn't move that fast... */
 	if (U.viewzoom == USER_ZOOM_CONT) { // XXX store this setting as RNA prop?
 		double time = PIL_check_seconds_timer();
@@ -849,12 +854,12 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 				float mval_faci = 1.0f - mval_fac;
 				float ofs = (mval_fac * dx) - (mval_faci * dx);
 				
-				v2d->cur.xmin -= ofs + dx;
-				v2d->cur.xmax -= ofs - dx;
+				v2d->cur.xmin += ofs + dx;
+				v2d->cur.xmax += ofs - dx;
 			}
 			else {
-				v2d->cur.xmin -= dx;
-				v2d->cur.xmax += dx;
+				v2d->cur.xmin += dx;
+				v2d->cur.xmax -= dx;
 			}
 		}
 	}
@@ -868,12 +873,12 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 				float mval_faci = 1.0f - mval_fac;
 				float ofs = (mval_fac * dy) - (mval_faci * dy);
 				
-				v2d->cur.ymin -= ofs + dy;
-				v2d->cur.ymax -= ofs - dy;
+				v2d->cur.ymin += ofs + dy;
+				v2d->cur.ymax += ofs - dy;
 			}
 			else {
-				v2d->cur.ymin -= dy;
-				v2d->cur.ymax += dy;
+				v2d->cur.ymin += dy;
+				v2d->cur.ymax -= dy;
 			}
 		}
 	}
@@ -941,7 +946,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		/* As we have only 1D information (magnify value), feed both axes
 		 * with magnify information that is stored in x axis 
 		 */
-		fac = 0.01f * (event->prevx - event->x);
+		fac = 0.01f * (event->x - event->prevx);
 		dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f;
 		dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
 
@@ -951,7 +956,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		view_zoomdrag_apply(C, op);
 		view_zoomdrag_exit(C, op);
 		return OPERATOR_FINISHED;
-	}	
+	}
 	
 	/* set initial settings */
 	vzd->lastx = event->x;
@@ -1044,11 +1049,6 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 		}
 		
 		/* set transform amount, and add current deltas to stored total delta (for redo) */
-		if (U.uiflag & USER_ZOOM_INVERT) {
-			dx *= -1;
-			dy *= -1;
-		}
-
 		RNA_float_set(op->ptr, "deltax", dx);
 		RNA_float_set(op->ptr, "deltay", dy);
 
@@ -1065,7 +1065,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 		
 		/* apply zooming */
 		view_zoomdrag_apply(C, op);
-	} 
+	}
 	else if (event->type == vzd->invoke_event || event->type == ESCKEY) {
 		if (event->val == KM_RELEASE) {
 			
@@ -1243,16 +1243,16 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
 
 	for (i = 0; i < 2; i++) {
 		/* axis translation normalized to scale */
-		tfac = fabsf(cent_a[i] - cent_b[i]) / minf(size_a[i], size_b[i]);
-		fac_max = maxf(fac_max, tfac);
+		tfac = fabsf(cent_a[i] - cent_b[i]) / min_ff(size_a[i], size_b[i]);
+		fac_max = max_ff(fac_max, tfac);
 		if (fac_max >= 1.0f) break;
 
 		/* axis scale difference, x2 so doubling or half gives 1.0f */
-		tfac = (1.0f - (minf(size_a[i], size_b[i]) / maxf(size_a[i], size_b[i]))) * 2.0f;
-		fac_max = maxf(fac_max, tfac);
+		tfac = (1.0f - (min_ff(size_a[i], size_b[i]) / max_ff(size_a[i], size_b[i]))) * 2.0f;
+		fac_max = max_ff(fac_max, tfac);
 		if (fac_max >= 1.0f) break;
 	}
-	return minf(fac_max, 1.0f);
+	return min_ff(fac_max, 1.0f);
 }
 
 /* will start timer if appropriate */
@@ -1469,7 +1469,7 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
 	else if (in_min)
 		return SCROLLHANDLE_MIN;
 	else if (out_min)
-		return SCROLLHANDLE_MIN_OUTSIDE;			  
+		return SCROLLHANDLE_MIN_OUTSIDE;
 	else if (out_max)
 		return SCROLLHANDLE_MAX_OUTSIDE;
 	
@@ -1751,7 +1751,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 				
 				/* can't catch this event for ourselves, so let it go to someone else? */
 				return OPERATOR_PASS_THROUGH;
-			}			
+			}
 		}
 		
 		/* zone is also inappropriate if scroller is not visible... */
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 0ec9932..ba93206 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -143,7 +143,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 		return OPERATOR_FINISHED;
 	}
 	else {
-		BKE_report(op->reports, RPT_WARNING, "Export file not created.");
+		BKE_report(op->reports, RPT_WARNING, "Export file not created");
 		return OPERATOR_CANCELLED;
 	}
 }
@@ -307,7 +307,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
 	RNA_string_get(op->ptr, "filepath", filename);
 	if (collada_import(C, filename)) return OPERATOR_FINISHED;
 
-	BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document. Please see console for error log.");
+	BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
 
 	return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index a254a6a..e43c8a2 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -46,6 +46,7 @@
 #include "WM_types.h"
 
 #include "ED_mask.h"  /* own include */
+#include "ED_screen.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -97,7 +98,7 @@ static int find_nearest_diff_point(const bContext *C, Mask *mask, const float no
 				                                                          &tot_diff_point);
 
 				if (diff_points) {
-					int i, tot_point;
+					int j, tot_point;
 					unsigned int tot_feather_point;
 					float *feather_points = NULL, *points;
 
@@ -114,26 +115,26 @@ static int find_nearest_diff_point(const bContext *C, Mask *mask, const float no
 						tot_point = tot_diff_point;
 					}
 
-					for (i = 0; i < tot_point - 1; i++) {
+					for (j = 0; j < tot_point - 1; j++) {
 						float cur_dist, a[2], b[2];
 
-						a[0] = points[2 * i] * scalex;
-						a[1] = points[2 * i + 1] * scaley;
+						a[0] = points[2 * j] * scalex;
+						a[1] = points[2 * j + 1] * scaley;
 
-						b[0] = points[2 * i + 2] * scalex;
-						b[1] = points[2 * i + 3] * scaley;
+						b[0] = points[2 * j + 2] * scalex;
+						b[1] = points[2 * j + 3] * scaley;
 
 						cur_dist = dist_to_line_segment_v2(co, a, b);
 
 						if (cur_dist < dist) {
 							if (tangent)
-								sub_v2_v2v2(tangent, &diff_points[2 * i + 2], &diff_points[2 * i]);
+								sub_v2_v2v2(tangent, &diff_points[2 * j + 2], &diff_points[2 * j]);
 
 							point_masklay = masklay;
 							point_spline = spline;
 							point = use_deform ? &spline->points[(cur_point - spline->points_deform)] : cur_point;
 							dist = cur_dist;
-							u = (float)i / tot_point;
+							u = (float)j / tot_point;
 
 						}
 					}
@@ -562,6 +563,11 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
 
 	float co[2];
 
+	if (mask == NULL) {
+		/* if there's no active mask, create one */
+		mask = ED_mask_new(C, NULL);
+	}
+
 	masklay = BKE_mask_layer_active(mask);
 
 	if (masklay && masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
@@ -647,7 +653,7 @@ void MASK_OT_add_vertex(wmOperatorType *ot)
 	/* api callbacks */
 	ot->exec = add_vertex_exec;
 	ot->invoke = add_vertex_invoke;
-	ot->poll = ED_maskedit_mask_poll;
+	ot->poll = ED_operator_mask;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index a60b771..74cdf4c 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -20,6 +20,7 @@
  *
  *
  * Contributor(s): Blender Foundation,
+ *                 Campbell Barton,
  *                 Sergey Sharybin
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -41,7 +42,9 @@
 #include "DNA_mask_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_object_types.h"   /* SELECT */
+#include "DNA_space_types.h"
 
+#include "ED_clip.h"
 #include "ED_mask.h"  /* own include */
 #include "ED_space_api.h"
 #include "BIF_gl.h"
@@ -120,13 +123,22 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline)
 }
 #endif
 
+static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], float co[2])
+{
+	BKE_mask_coord_to_movieclip(sc->clip, &sc->user, r_co, co);
+	ED_clip_point_undistorted_pos(sc, r_co, r_co);
+	BKE_mask_coord_from_movieclip(sc->clip, &sc->user, r_co, r_co);
+}
+
 /* return non-zero if spline is selected */
-static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
+static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline *spline,
                                const char UNUSED(draw_flag), const char draw_type)
 {
 	const int is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0;
 	unsigned char rgb_spline[4];
 	MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	int undistort = FALSE;
 
 	int i, hsize, tot_feather_point;
 	float (*feather_points)[2], (*fp)[2];
@@ -134,6 +146,9 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
 	if (!spline->tot_point)
 		return;
 
+	if (sc)
+		undistort = sc->clip && sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
+
 	/* TODO, add this to sequence editor */
 	hsize = 4; /* UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE); */
 
@@ -151,8 +166,14 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
 		int j;
 
 		for (j = 0; j < point->tot_uw + 1; j++) {
+			float feather_point[2];
 			int sel = FALSE;
 
+			copy_v2_v2(feather_point, *fp);
+
+			if (undistort)
+				mask_point_undistort_pos(sc, feather_point, feather_point);
+
 			if (j == 0) {
 				sel = MASKPOINT_ISSEL_ANY(point);
 			}
@@ -171,7 +192,7 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
 			}
 
 			glBegin(GL_POINTS);
-			glVertex2fv(*fp);
+			glVertex2fv(feather_point);
 			glEnd();
 
 			fp++;
@@ -188,11 +209,17 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
 		BezTriple *bezt = &point_deform->bezt;
 
 		float handle[2];
-		float *vert = bezt->vec[1];
+		float vert[2];
 		int has_handle = BKE_mask_point_has_handle(point);
 
+		copy_v2_v2(vert, bezt->vec[1]);
 		BKE_mask_point_handle(point_deform, handle);
 
+		if (undistort) {
+			mask_point_undistort_pos(sc, vert, vert);
+			mask_point_undistort_pos(sc, handle, handle);
+		}
+
 		/* draw handle segment */
 		if (has_handle) {
 
@@ -265,7 +292,7 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r
 	}
 }
 
-static void mask_draw_curve_type(MaskSpline *spline, float (*points)[2], int tot_point,
+static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*orig_points)[2], int tot_point,
                                  const short is_feather, const short is_smooth, const short is_active,
                                  const unsigned char rgb_spline[4], const char draw_type)
 {
@@ -273,6 +300,22 @@ static void mask_draw_curve_type(MaskSpline *spline, float (*points)[2], int tot
 	const unsigned char rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
 //	const unsigned char rgb_white[4] = {0xff, 0xff, 0xff, 0xff};
 	unsigned char rgb_tmp[4];
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	float (*points)[2] = orig_points;
+
+	if (sc) {
+		int undistort = sc->clip && sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
+
+		if (undistort) {
+			int i;
+
+			points = MEM_callocN(2 * tot_point * sizeof(float), "undistorthed mask curve");
+
+			for (i = 0; i < tot_point; i++) {
+				mask_point_undistort_pos(sc, points[i], orig_points[i]);
+			}
+		}
+	}
 
 	glEnableClientState(GL_VERTEX_ARRAY);
 	glVertexPointer(2, GL_FLOAT, 0, points);
@@ -347,8 +390,6 @@ static void mask_draw_curve_type(MaskSpline *spline, float (*points)[2], int tot
 			glVertexPointer(2, GL_FLOAT, 0, points);
 			glDrawArrays(draw_method, 0, tot_point);
 
-			glDrawArrays(draw_method, 0, tot_point);
-
 			if (is_smooth == FALSE && is_feather) {
 				glDisable(GL_BLEND);
 			}
@@ -358,14 +399,16 @@ static void mask_draw_curve_type(MaskSpline *spline, float (*points)[2], int tot
 
 	glDisableClientState(GL_VERTEX_ARRAY);
 
+	if (points != orig_points)
+		MEM_freeN(points);
 }
 
-static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
+static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline *spline,
                               const char draw_flag, const char draw_type,
                               const short is_active,
                               int width, int height)
 {
-	const unsigned int resol = maxi(BKE_mask_spline_feather_resolution(spline, width, height),
+	const unsigned int resol = max_ii(BKE_mask_spline_feather_resolution(spline, width, height),
 	                                BKE_mask_spline_resolution(spline, width, height));
 
 	unsigned char rgb_tmp[4];
@@ -395,7 +438,7 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
 
 	/* draw feather */
 	mask_spline_feather_color_get(masklay, spline, is_spline_sel, rgb_tmp);
-	mask_draw_curve_type(spline, feather_points, tot_feather_point,
+	mask_draw_curve_type(C, spline, feather_points, tot_feather_point,
 	                     TRUE, is_smooth, is_active,
 	                     rgb_tmp, draw_type);
 
@@ -414,7 +457,7 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
 		}
 
 		/* same as above */
-		mask_draw_curve_type(spline, feather_points, tot_feather_point,
+		mask_draw_curve_type(C, spline, feather_points, tot_feather_point,
 		                     TRUE, is_smooth, is_active,
 		                     rgb_tmp, draw_type);
 	}
@@ -423,7 +466,7 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
 
 	/* draw main curve */
 	mask_spline_color_get(masklay, spline, is_spline_sel, rgb_tmp);
-	mask_draw_curve_type(spline, diff_points, tot_diff_point,
+	mask_draw_curve_type(C, spline, diff_points, tot_diff_point,
 	                     FALSE, is_smooth, is_active,
 	                     rgb_tmp, draw_type);
 	MEM_freeN(diff_points);
@@ -436,7 +479,7 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
 	(void)draw_type;
 }
 
-static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type,
+static void draw_masklays(const bContext *C, Mask *mask, const char draw_flag, const char draw_type,
                           int width, int height)
 {
 	MaskLayer *masklay;
@@ -453,13 +496,13 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
 		for (spline = masklay->splines.first; spline; spline = spline->next) {
 
 			/* draw curve itself first... */
-			draw_spline_curve(masklay, spline, draw_flag, draw_type, is_active, width, height);
+			draw_spline_curve(C, masklay, spline, draw_flag, draw_type, is_active, width, height);
 
 //			draw_spline_parents(masklay, spline);
 
 			if (!(masklay->restrictflag & MASK_RESTRICT_SELECT)) {
 				/* ...and then handles over the curve so they're nicely visible */
-				draw_spline_points(masklay, spline, draw_flag, draw_type);
+				draw_spline_points(C, masklay, spline, draw_flag, draw_type);
 			}
 
 			/* show undeform for testing */
@@ -467,9 +510,9 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
 				void *back = spline->points_deform;
 
 				spline->points_deform = NULL;
-				draw_spline_curve(masklay, spline, draw_flag, draw_type, is_active, width, height);
+				draw_spline_curve(C, masklay, spline, draw_flag, draw_type, is_active, width, height);
 //				draw_spline_parents(masklay, spline);
-				draw_spline_points(masklay, spline, draw_flag, draw_type);
+				draw_spline_points(C, masklay, spline, draw_flag, draw_type);
 				spline->points_deform = back;
 			}
 		}
@@ -489,7 +532,7 @@ void ED_mask_draw(const bContext *C,
 
 	ED_mask_get_size(sa, &width, &height);
 
-	draw_masklays(mask, draw_flag, draw_type, width, height);
+	draw_masklays(C, mask, draw_flag, draw_type, width, height);
 }
 
 /* sets up the opengl context.
@@ -500,7 +543,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
                          const float aspx, const float aspy,
                          const short do_scale_applied, const short do_post_draw,
                          float stabmat[4][4], /* optional - only used by clip */
-                         const bContext *C    /* optional - only used when do_post_draw is set */
+                         const bContext *C    /* optional - only used when do_post_draw is set or called from clip editor */
                          )
 {
 	struct View2D *v2d = &ar->v2d;
@@ -536,7 +579,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
 	y += v2d->tot.ymin * zoomy;
 
 	/* frame the image */
-	maxdim = maxf(width, height);
+	maxdim = max_ff(width, height);
 	if (width == height) {
 		xofs = yofs = 0;
 	}
@@ -559,7 +602,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
 	}
 
 	/* draw! */
-	draw_masklays(mask, draw_flag, draw_type, width, height);
+	draw_masklays(C, mask, draw_flag, draw_type, width, height);
 
 	if (do_post_draw) {
 		ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c
index 561ad00..707622f 100644
--- a/source/blender/editors/mask/mask_editaction.c
+++ b/source/blender/editors/mask/mask_editaction.c
@@ -18,13 +18,13 @@
  * The Original Code is Copyright (C) 2008, Blender Foundation
  * This is a new part of Blender
  *
- * Contributor(s): Joshua Leung
+ * Contributor(s): Campbell Barton
  *
  * ***** END GPL LICENSE BLOCK *****
  */
 
 /** \file blender/editors/mask/mask_editaction.c
- *  \ingroup edgpencil
+ *  \ingroup edmask
  */
 
 #include <stdio.h>
@@ -49,17 +49,18 @@
 #include "ED_anim_api.h"
 #include "ED_keyframes_edit.h"
 #include "ED_mask.h"  /* own include */
+#include "ED_markers.h"
 
 /* ***************************************** */
 /* NOTE ABOUT THIS FILE:
- *  This file contains code for editing Grease Pencil data in the Action Editor
- *  as a 'keyframes', so that a user can adjust the timing of Grease Pencil drawings.
- *  Therefore, this file mostly contains functions for selecting Grease-Pencil frames.
+ *  This file contains code for editing Mask data in the Action Editor
+ *  as a 'keyframes', so that a user can adjust the timing of Mask shapekeys.
+ *  Therefore, this file mostly contains functions for selecting Mask frames (shapekeys).
  */
 /* ***************************************** */
 /* Generics - Loopers */
 
-/* Loops over the gp-frames for a gp-layer, and applies the given callback */
+/* Loops over the mask-frames for a mask-layer, and applies the given callback */
 short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *))
 {
 	MaskLayerShape *masklay_shape;
@@ -82,7 +83,7 @@ short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*maskl
 /* ****************************************** */
 /* Data Conversion Tools */
 
-/* make a listing all the gp-frames in a layer as cfraelems */
+/* make a listing all the mask-frames in a layer as cfraelems */
 void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short onlysel)
 {
 	MaskLayerShape *masklay_shape;
@@ -92,7 +93,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short only
 	if (ELEM(NULL, masklay, elems))
 		return;
 
-	/* loop through gp-frames, adding */
+	/* loop through mask-frames, adding */
 	for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
 		if ((onlysel == 0) || (masklay_shape->flag & MASK_SHAPE_SELECT)) {
 			ce = MEM_callocN(sizeof(CfraElem), "CfraElem");
@@ -127,7 +128,7 @@ short ED_masklayer_frame_select_check(MaskLayer *masklay)
 	return 0;
 }
 
-/* helper function - select gp-frame based on SELECT_* mode */
+/* helper function - select mask-frame based on SELECT_* mode */
 static void masklayshape_select(MaskLayerShape *masklay_shape, short select_mode)
 {
 	if (masklay_shape == NULL)
@@ -223,7 +224,7 @@ void ED_masklayer_frames_delete(MaskLayer *masklay)
 	}
 }
 
-/* Duplicate selected frames from given gp-layer */
+/* Duplicate selected frames from given mask-layer */
 void ED_masklayer_frames_duplicate(MaskLayer *masklay)
 {
 	MaskLayerShape *masklay_shape, *gpfn;
@@ -249,3 +250,57 @@ void ED_masklayer_frames_duplicate(MaskLayer *masklay)
 		}
 	}
 }
+
+/* -------------------------------------- */
+/* Snap Tools */
+
+static short snap_masklayer_nearest(MaskLayerShape *masklay_shape, Scene *UNUSED(scene))
+{
+	if (masklay_shape->flag & MASK_SHAPE_SELECT)
+		masklay_shape->frame = (int)(floor(masklay_shape->frame + 0.5));
+	return 0;
+}
+
+static short snap_masklayer_nearestsec(MaskLayerShape *masklay_shape, Scene *scene)
+{
+	float secf = (float)FPS;
+	if (masklay_shape->flag & MASK_SHAPE_SELECT)
+		masklay_shape->frame = (int)(floorf(masklay_shape->frame / secf + 0.5f) * secf);
+	return 0;
+}
+
+static short snap_masklayer_cframe(MaskLayerShape *masklay_shape, Scene *scene)
+{
+	if (masklay_shape->flag & MASK_SHAPE_SELECT)
+		masklay_shape->frame = (int)CFRA;
+	return 0;
+}
+
+static short snap_masklayer_nearmarker(MaskLayerShape *masklay_shape, Scene *scene)
+{
+	if (masklay_shape->flag & MASK_SHAPE_SELECT)
+		masklay_shape->frame = (int)ED_markers_find_nearest_marker_time(&scene->markers, (float)masklay_shape->frame);
+	return 0;
+}
+
+/* snap selected frames to ... */
+void ED_masklayer_snap_frames(MaskLayer *masklay, Scene *scene, short mode)
+{
+	switch (mode) {
+		case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */
+			ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearest);
+			break;
+		case SNAP_KEYS_CURFRAME: /* snap to current frame */
+			ED_masklayer_frames_looper(masklay, scene, snap_masklayer_cframe);
+			break;
+		case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */
+			ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearmarker);
+			break;
+		case SNAP_KEYS_NEARSEC: /* snap to nearest second */
+			ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearestsec);
+			break;
+		default: /* just in case */
+			break;
+	}
+}
+
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index ffd4afc..fcfcfb2 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -33,6 +33,7 @@
 #define __MASK_INTERN_H__
 
 struct bContext;
+struct Mask;
 struct wmEvent;
 struct wmOperatorType;
 
@@ -43,6 +44,8 @@ void MASK_OT_add_vertex(struct wmOperatorType *ot);
 void MASK_OT_add_feather_vertex(struct wmOperatorType *ot);
 
 /* mask_ops.c */
+struct Mask *ED_mask_new(struct bContext *C, const char *name);
+
 void MASK_OT_new(struct wmOperatorType *ot);
 void MASK_OT_layer_new(struct wmOperatorType *ot);
 void MASK_OT_layer_remove(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 88fbb91..35f85f3 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -258,13 +258,10 @@ int ED_mask_feather_find_nearest(const bContext *C, Mask *mask, float normal_co[
 
 /******************** create new mask *********************/
 
-static int mask_new_exec(bContext *C, wmOperator *op)
+Mask *ED_mask_new(bContext *C, const char *name)
 {
 	ScrArea *sa = CTX_wm_area(C);
 	Mask *mask;
-	char name[MAX_ID_NAME - 2];
-
-	RNA_string_get(op->ptr, "name", name);
 
 	mask = BKE_mask_new(name);
 
@@ -290,6 +287,17 @@ static int mask_new_exec(bContext *C, wmOperator *op)
 		}
 	}
 
+	return mask;
+}
+
+static int mask_new_exec(bContext *C, wmOperator *op)
+{
+	char name[MAX_ID_NAME - 2];
+
+	RNA_string_get(op->ptr, "name", name);
+
+	ED_mask_new(C, name);
+
 	return OPERATOR_FINISHED;
 }
 
@@ -483,15 +491,15 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
 		customdata->uw = uw;
 
 		if (uw) {
-			float co[2];
+			float co_uw[2];
 			float weight_scalar = BKE_mask_point_weight_scalar(spline, point, uw->u);
 
 			customdata->weight = uw->w;
 			customdata->weight_scalar = weight_scalar;
-			BKE_mask_point_segment_co(spline, point, uw->u, co);
+			BKE_mask_point_segment_co(spline, point, uw->u, co_uw);
 			BKE_mask_point_normal(spline, point, uw->u, customdata->no);
 
-			madd_v2_v2v2fl(customdata->feather, co, customdata->no, uw->w * weight_scalar);
+			madd_v2_v2v2fl(customdata->feather, co_uw, customdata->no, uw->w * weight_scalar);
 		}
 		else {
 			BezTriple *bezt = &point->bezt;
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 69cfdf4..cd1a477 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -34,6 +34,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_rect.h"
 #include "BLI_lasso.h"
+#include "BLI_math.h"
 
 #include "BKE_context.h"
 #include "BKE_mask.h"
@@ -557,7 +558,7 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
 		select = !RNA_boolean_get(op->ptr, "deselect");
 		do_lasso_select_mask(C, mcords, mcords_tot, select);
 
-		MEM_freeN(mcords);
+		MEM_freeN((void *)mcords);
 
 		return OPERATOR_FINISHED;
 	}
@@ -622,7 +623,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
 	/* compute ellipse and position in unified coordinates */
 	ED_mask_get_size(sa, &width, &height);
 	ED_mask_zoom(sa, ar, &zoomx, &zoomy);
-	width = height = MAX2(width, height);
+	width = height = max_ii(width, height);
 
 	ellipse[0] = width * zoomx / radius;
 	ellipse[1] = height * zoomy / radius;
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 246c323..c51d2cf 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -21,6 +21,7 @@
 set(INC
 	../include
 	../uvedit
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader
@@ -68,4 +69,12 @@ if(WITH_GAMEENGINE)
 	)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
+if(WITH_BULLET)
+	add_definitions(-DWITH_BULLET)
+endif()
+
 blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript
index b3aba97..91ffdc9 100644
--- a/source/blender/editors/mesh/SConscript
+++ b/source/blender/editors/mesh/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
 
 defs = []
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../gpu ../../blenloader'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
@@ -24,4 +24,10 @@ if env['WITH_BF_GAMEENGINE']:
 else:
     sources.remove('mesh_navmesh.c')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+if env['WITH_BF_BULLET']:
+    defs.append('WITH_BULLET')
+
 env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), defs, libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 429b214..4350c00 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -85,7 +85,7 @@ void paintface_flush_flags(Object *ob)
 	 *  - Final derived polys => Final derived tessfaces
 	 */
 
-	if ((index_array = CustomData_get_layer(&me->fdata, CD_POLYINDEX))) {
+	if ((index_array = CustomData_get_layer(&me->fdata, CD_ORIGINDEX))) {
 		faces = me->mface;
 		totface = me->totface;
 		
@@ -109,7 +109,7 @@ void paintface_flush_flags(Object *ob)
 		}
 	}
 
-	if ((index_array = CustomData_get_layer(&dm->faceData, CD_POLYINDEX))) {
+	if ((index_array = CustomData_get_layer(&dm->faceData, CD_ORIGINDEX))) {
 		polys = dm->getPolyArray(dm);
 		faces = dm->getTessFaceArray(dm);
 		totface = dm->getNumTessFaces(dm);
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 0cf4ac4..4a425c8 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -55,6 +55,8 @@
 
 /* ********* add primitive operators ************* */
 
+/* BMESH_TODO: 'state' is not a good name, should be flipped and called 'was_editmode',
+ * or at least something more descriptive */
 static Object *make_prim_init(bContext *C, const char *idname,
                               float *dia, float mat[][4],
                               int *state, const float loc[3], const float rot[3], const unsigned int layer)
@@ -73,7 +75,7 @@ static Object *make_prim_init(bContext *C, const char *idname,
 		*state = 1;
 	}
 
-	*dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
+	*dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, FALSE);
 
 	return obedit;
 }
@@ -81,15 +83,17 @@ static Object *make_prim_init(bContext *C, const char *idname,
 static void make_prim_finish(bContext *C, Object *obedit, int *state, int enter_editmode)
 {
 	BMEditMesh *em = BMEdit_FromObject(obedit);
+	const int exit_editmode = (*state && !enter_editmode);
 
 	/* Primitive has all verts selected, use vert select flush
 	 * to push this up to edges & faces. */
 	EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
 
-	EDBM_update_generic(C, em, TRUE);
+	/* only recalc editmode tessface if we are staying in editmode */
+	EDBM_update_generic(C, em, !exit_editmode);
 
 	/* userdef */
-	if (*state && !enter_editmode) {
+	if (exit_editmode) {
 		ED_object_exit_editmode(C, EM_FREEDATA); /* adding EM_DO_UNDO messes up operator redo */
 	}
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
@@ -108,8 +112,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
 	obedit = make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer);
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout",
-	                              "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat))
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+	                              "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4", 1, 1, dia, mat))
 	{
 		return OPERATOR_CANCELLED;
 	}
@@ -149,7 +153,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
 	obedit = make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, dia * 2.0f)) {
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", mat, dia * 2.0f)) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -198,8 +202,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
 	obedit = make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout",
-	                              "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4",
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+	                              "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4",
 	                              RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"),
 	                              cap_end, cap_tri, mat))
 	{
@@ -221,6 +225,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_circle_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_circle_exec;
 	ot->poll = ED_operator_scene_editable;
 
@@ -253,8 +258,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
 	em = BMEdit_FromObject(obedit);
 
 	if (!EDBM_op_call_and_selectf(
-	        em, op, "vertout",
-	        "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4",
+	        em, op, "verts.out",
+	        "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4",
 	        RNA_int_get(op->ptr, "vertices"),
 	        RNA_float_get(op->ptr, "radius"),
 	        RNA_float_get(op->ptr, "radius"),
@@ -279,6 +284,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_cylinder_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_cylinder_exec;
 	ot->poll = ED_operator_scene_editable;
 
@@ -313,8 +319,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
 	em = BMEdit_FromObject(obedit);
 
 	if (!EDBM_op_call_and_selectf(
-	        em, op, "vertout",
-	        "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4",
+	        em, op, "verts.out",
+	        "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4",
 	        RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"),
 	        RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat))
 	{
@@ -336,6 +342,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_cone_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_cone_exec;
 	ot->poll = ED_operator_scene_editable;
 
@@ -368,11 +375,11 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
 	obedit = make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer);
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout",
-	                              "create_grid xsegments=%i ysegments=%i size=%f mat=%m4",
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+	                              "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4",
 	                              RNA_int_get(op->ptr, "x_subdivisions"),
 	                              RNA_int_get(op->ptr, "y_subdivisions"),
-	                              RNA_float_get(op->ptr, "size") * dia, mat))
+	                              RNA_float_get(op->ptr, "size"), mat))
 	{
 		return OPERATOR_CANCELLED;
 	}
@@ -392,6 +399,7 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_grid_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_grid_exec;
 	ot->poll = ED_operator_scene_editable;
 
@@ -420,10 +428,14 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
 	if (!view_aligned)
 		rot[0] += (float)M_PI / 2.0f;
 
-	obedit = make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer);
+	obedit = make_prim_init(C, "Suzanne", &dia, mat, &state, loc, rot, layer);
+	mat[0][0] *= dia;
+	mat[1][1] *= dia;
+	mat[2][2] *= dia;
+
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_monkey mat=%m4", mat)) {
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_monkey matrix=%m4", mat)) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -462,8 +474,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
 	obedit = make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer);
 	em = BMEdit_FromObject(obedit);
 
-	if (!EDBM_op_call_and_selectf(em, op, "vertout",
-	                              "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4",
+	if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+	                              "create_uvsphere u_segments=%i v_segments=%i diameter=%f matrix=%m4",
 	                              RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"),
 	                              RNA_float_get(op->ptr, "size"), mat))
 	{
@@ -472,7 +484,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
 
 	make_prim_finish(C, obedit, &state, enter_editmode);
 
-	return OPERATOR_FINISHED;	
+	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
@@ -485,6 +497,7 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_uv_sphere_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_uvsphere_exec;
 	ot->poll = ED_operator_scene_editable;
 
@@ -514,8 +527,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
 	em = BMEdit_FromObject(obedit);
 
 	if (!EDBM_op_call_and_selectf(
-	        em, op, "vertout",
-	        "create_icosphere subdivisions=%i diameter=%f mat=%m4",
+	        em, op, "verts.out",
+	        "create_icosphere subdivisions=%i diameter=%f matrix=%m4",
 	        RNA_int_get(op->ptr, "subdivisions"),
 	        RNA_float_get(op->ptr, "size"), mat))
 	{
@@ -537,6 +550,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
 	ot->idname = "MESH_OT_primitive_ico_sphere_add";
 
 	/* api callbacks */
+	ot->invoke = WM_operator_view3d_distance_invoke;
 	ot->exec = add_primitive_icosphere_exec;
 	ot->poll = ED_operator_scene_editable;
 
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index e84fa90..8e39779 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -157,13 +157,13 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
 
 
 		if (flag & BMBVH_RESPECT_SELECT) {
-			/* note, the arrays wont allign now! take care */
+			/* note, the arrays wont align now! take care */
 			if (!BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_SELECT)) {
 				continue;
 			}
 		}
 		else if (flag & BMBVH_RESPECT_HIDDEN) {
-			/* note, the arrays wont allign now! take care */
+			/* note, the arrays wont align now! take care */
 			if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) {
 				continue;
 			}
@@ -399,14 +399,13 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
 	const float mval_f[2] = {ar->winx / 2.0f,
 	                         ar->winy / 2.0f};
 
-	ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end);
+	ED_view3d_win_to_segment(ar, v3d, mval_f, origin, end);
 	
 	invert_m4_m4(invmat, obedit->obmat);
 	mul_m4_v3(invmat, origin);
 
 	copy_v3_v3(co1, e->v1->co);
-	add_v3_v3v3(co2, e->v1->co, e->v2->co);
-	mul_v3_fl(co2, 0.5f);
+	mid_v3_v3v3(co2, e->v1->co, e->v2->co);
 	copy_v3_v3(co3, e->v2->co);
 	
 	scale_point(co1, co2, 0.99);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 4f4fc27..a59c491 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -181,6 +181,7 @@ typedef struct KnifeTool_OpData {
 	char select_result;  /* set on initialization */
 
 	short is_ortho;
+	float ortho_extent;
 	float clipsta, clipend;
 
 	enum {
@@ -206,8 +207,12 @@ typedef struct KnifeTool_OpData {
 
 static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f);
 
+#if 0
 static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2],
                                  float r_origin[3], float r_ray[3]);
+#endif
+static void knife_input_ray_segment(KnifeTool_OpData *kcd, const int mval_i[2], const float ofs,
+                                    float r_origin[3], float r_dest[3]);
 
 static void knife_update_header(bContext *C, KnifeTool_OpData *kcd)
 {
@@ -378,14 +383,13 @@ static void knife_start_cut(KnifeTool_OpData *kcd)
 
 	if (kcd->prev.vert == NULL && kcd->prev.edge == NULL && is_zero_v3(kcd->prev.cage)) {
 		/* Make prevcage a point on the view ray to mouse closest to a point on model: choose vertex 0 */
-		float origin[3], ray[3], co[3];
+		float origin[3], origin_ofs[3];
 		BMVert *v0;
 
-		knife_input_ray_cast(kcd, kcd->curr.mval, origin, ray);
-		add_v3_v3v3(co, origin, ray);
+		knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs);
 		v0 = BM_vert_at_index(kcd->em->bm, 0);
 		if (v0) {
-			closest_to_line_v3(kcd->prev.cage, v0->co, co, origin);
+			closest_to_line_v3(kcd->prev.cage, v0->co, origin_ofs, origin);
 			copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */
 			copy_v3_v3(kcd->curr.cage, kcd->prev.cage);
 			copy_v3_v3(kcd->curr.co, kcd->prev.co);
@@ -1164,7 +1168,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
 
 	/* for comparing distances, error of intersection depends on triangle scale.
 	 * need to scale down before squaring for accurate comparison */
-	const float depsilon = (KNIFE_FLT_EPS / 2.0f) * len_v3_tri_side_max(v1, v2, v3);
+	const float depsilon = (FLT_EPSILON / 2.0f) * len_v3_tri_side_max(v1, v2, v3);
 	const float depsilon_squared = depsilon * depsilon;
 
 	copy_v3_v3(cos + 0, v1);
@@ -1177,7 +1181,6 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
 	result = results = BLI_bvhtree_overlap(tree, tree2, &tot);
 
 	for (i = 0; i < tot; i++, result++) {
-		float p[3];
 		BMLoop *l1;
 		BMFace *hitf;
 		ListBase *lst;
@@ -1196,7 +1199,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
 			}
 
 			if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, NULL)) {
-				float no[3], view[3], sp[3];
+				float p[3], no[3], view[3], sp[3];
 
 				interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
 
@@ -1211,6 +1214,11 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
 				{
 					continue;
 				}
+				if ((kcd->vc.rv3d->rflag & RV3D_CLIPPING) &&
+				    ED_view3d_clipping_test(kcd->vc.rv3d, p, TRUE))
+				{
+					continue;
+				}
 
 				knife_project_v3(kcd, p, sp);
 				ED_view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
@@ -1311,6 +1319,22 @@ static void knife_bgl_get_mats(KnifeTool_OpData *UNUSED(kcd), bglMats *mats)
 	//copy_m4_m4(mats->projection, kcd->vc.rv3d->winmat);
 }
 
+/* Calculate maximum excursion (doubled) from (0,0,0) of mesh */
+static void calc_ortho_extent(KnifeTool_OpData *kcd)
+{
+	BMIter iter;
+	BMVert *v;
+	BMesh* bm = kcd->em->bm;
+	float max_xyz = 0.0f;
+	int i;
+
+	BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) {
+		for (i = 0; i < 3; i++)
+			max_xyz = max_ff(max_xyz, fabs(v->co[i]));
+	}
+	kcd->ortho_extent = 2 * max_xyz;
+}
+
 /* Finds visible (or all, if cutting through) edges that intersects the current screen drag line */
 static void knife_find_line_hits(KnifeTool_OpData *kcd)
 {
@@ -1353,8 +1377,10 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
 	 * (which may involve using doubles everywhere!),
 	 * limit the distance between these points */
 	if (kcd->is_ortho) {
-		limit_dist_v3(v1, v3, 200.0f);
-		limit_dist_v3(v2, v4, 200.0f);
+		if (kcd->ortho_extent == 0.0f)
+			calc_ortho_extent(kcd);
+		limit_dist_v3(v1, v3, kcd->ortho_extent + 10.0f);
+		limit_dist_v3(v2, v4, kcd->ortho_extent + 10.0f);
 	}
 
 	BLI_smallhash_init(ehash);
@@ -1384,6 +1410,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
 	BLI_smallhash_release(ehash);
 }
 
+/* this works but gives numeric problems [#33400] */
+#if 0
 static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2],
                                  float r_origin[3], float r_ray[3])
 {
@@ -1414,17 +1442,41 @@ static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2],
 	mul_m4_v3(kcd->ob->imat, r_origin);
 	mul_m3_v3(imat, r_ray);
 }
+#endif
+
+static void knife_input_ray_segment(KnifeTool_OpData *kcd, const int mval_i[2], const float ofs,
+                                    float r_origin[3], float r_origin_ofs[3])
+{
+	bglMats mats;
+	float mval[2];
+
+	knife_bgl_get_mats(kcd, &mats);
+
+	mval[0] = (float)mval_i[0];
+	mval[1] = (float)mval_i[1];
+
+	/* unproject to find view ray */
+	ED_view3d_unproject(&mats, r_origin,     mval[0], mval[1], 0.0f);
+	ED_view3d_unproject(&mats, r_origin_ofs, mval[0], mval[1], ofs);
+
+	/* transform into object space */
+	invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
+
+	mul_m4_v3(kcd->ob->imat, r_origin);
+	mul_m4_v3(kcd->ob->imat, r_origin_ofs);
+}
 
 static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float cageco[3], int *is_space)
 {
 	BMFace *f;
-	int dist = KMAXDIST;
+	float dist = KMAXDIST;
 	float origin[3];
+	float origin_ofs[3];
 	float ray[3];
 
 	/* unproject to find view ray */
-	knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
-	add_v3_v3v3(co, origin, ray);
+	knife_input_ray_segment(kcd, kcd->vc.mval, 1.0f, origin, origin_ofs);
+	sub_v3_v3v3(ray, origin_ofs, origin);
 
 	f = BMBVH_RayCast(kcd->bmbvh, origin, ray, co, cageco);
 
@@ -1475,12 +1527,7 @@ static int knife_sample_screen_density(KnifeTool_OpData *kcd, float radius)
 				dis = len_v2v2(kfv->sco, sco);
 				if (dis < radius) {
 					if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-						float vec[3];
-
-						copy_v3_v3(vec, kfv->cageco);
-						mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
-						if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+						if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
 							c++;
 						}
 					}
@@ -1506,7 +1553,7 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize)
 	if (density < 1.0f)
 		density = 1.0f;
 
-	return minf(maxsize / (density * 0.5f), maxsize);
+	return min_ff(maxsize / (density * 0.5f), maxsize);
 }
 
 /* p is closest point on edge to the mouse cursor */
@@ -1547,13 +1594,10 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
 			dis = dist_to_line_segment_v2(sco, kfe->v1->sco, kfe->v2->sco);
 			if (dis < curdis && dis < maxdist) {
 				if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-					float labda = labda_PdistVL2Dfl(sco, kfe->v1->sco, kfe->v2->sco);
+					float labda = line_point_factor_v2(sco, kfe->v1->sco, kfe->v2->sco);
 					float vec[3];
 
-					vec[0] = kfe->v1->cageco[0] + labda * (kfe->v2->cageco[0] - kfe->v1->cageco[0]);
-					vec[1] = kfe->v1->cageco[1] + labda * (kfe->v2->cageco[1] - kfe->v1->cageco[1]);
-					vec[2] = kfe->v1->cageco[2] + labda * (kfe->v2->cageco[2] - kfe->v1->cageco[2]);
-					mul_m4_v3(kcd->vc.obedit->obmat, vec);
+					interp_v3_v3v3(vec, kfe->v1->cageco, kfe->v2->cageco, labda);
 
 					if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
 						cure = kfe;
@@ -1645,12 +1689,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
 				dis = len_v2v2(kfv->sco, sco);
 				if (dis < curdis && dis < maxdist) {
 					if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-						float vec[3];
-
-						copy_v3_v3(vec, kfv->cageco);
-						mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
-						if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+						if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
 							curv = kfv;
 							curdis = dis;
 						}
@@ -1749,12 +1788,12 @@ static int knife_update_active(KnifeTool_OpData *kcd)
 	 * Note that drawing lines in `free-space` isn't properly supported
 	 * but theres no guarantee (0, 0, 0) has any geometry either - campbell */
 	if (kcd->curr.vert == NULL && kcd->curr.edge == NULL) {
-		float origin[3], ray[3], co[3];
+		float origin[3];
+		float origin_ofs[3];
 
-		knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
-		add_v3_v3v3(co, origin, ray);
+		knife_input_ray_segment(kcd, kcd->vc.mval, 1.0f, origin, origin_ofs);
 
-		closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, co, origin);
+		closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, origin_ofs, origin);
 	}
 
 	if (kcd->mode == MODE_DRAGGING) {
@@ -1804,7 +1843,7 @@ static void remerge_faces(KnifeTool_OpData *kcd)
 	BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", FACE_NEW, BOUNDARY);
 
 	BMO_op_exec(bm, &bmop);
-	BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE, FACE_NEW);
+	BMO_slot_buffer_flag_enable(bm, &bmop, "geom.out", BM_FACE, FACE_NEW);
 
 	BMO_op_finish(bm, &bmop);
 
@@ -1946,7 +1985,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
 			kfe->e = NULL;
 		}
 
-		kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, TRUE);
+		kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, BM_CREATE_NO_DOUBLE);
 		BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
 
 		for (ref = kfe->faces.first; ref; ref = ref->next) {
@@ -2048,7 +2087,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
 			}
 		}
 
-		BLI_scanfill_calc(&sf_ctx, FALSE);
+		BLI_scanfill_calc(&sf_ctx, 0);
 
 		for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
 			BMVert *v1 = sf_tri->v3->tmp.p, *v2 = sf_tri->v2->tmp.p, *v3 = sf_tri->v1->tmp.p;
@@ -2554,8 +2593,8 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha
 	int nco = BLI_countlist(chain) - 1;
 	float (*cos)[3] = NULL;
 	KnifeVert **kverts;
-	BLI_array_fixedstack_declare(cos, BM_NGON_STACK_SIZE, nco, __func__);
-	BLI_array_fixedstack_declare(kverts, BM_NGON_STACK_SIZE, nco, __func__);
+	BLI_array_fixedstack_declare(cos, BM_DEFAULT_NGON_STACK_SIZE, nco, __func__);
+	BLI_array_fixedstack_declare(kverts, BM_DEFAULT_NGON_STACK_SIZE, nco, __func__);
 
 	kfe = ((Ref *)chain->first)->ref;
 	v1 = kfe->v1->v ? kfe->v1->v : kfe->v2->v;
@@ -3066,6 +3105,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	Object *obedit = CTX_data_edit_object(C);
 	KnifeTool_OpData *kcd = op->customdata;
+	int do_refresh = FALSE;
 
 	if (!obedit || obedit->type != OB_MESH || BMEdit_FromObject(obedit) != kcd->em) {
 		knifetool_exit(C, op);
@@ -3074,6 +3114,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 	}
 
 	view3d_operator_needs_opengl(C);
+	ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d);  /* needed to initialize clipping */
 
 	if (kcd->mode == MODE_PANNING)
 		kcd->mode = kcd->prevmode;
@@ -3105,6 +3146,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 				knife_update_active(kcd);
 				knife_update_header(C, kcd);
 				ED_region_tag_redraw(kcd->ar);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODAL_MIDPOINT_OFF:
 				kcd->snap_midpoints = 0;
@@ -3113,25 +3155,29 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 				knife_update_active(kcd);
 				knife_update_header(C, kcd);
 				ED_region_tag_redraw(kcd->ar);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODEL_IGNORE_SNAP_ON:
 				ED_region_tag_redraw(kcd->ar);
 				kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = 1;
 				knife_update_header(C, kcd);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODEL_IGNORE_SNAP_OFF:
 				ED_region_tag_redraw(kcd->ar);
 				kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = 0;
 				knife_update_header(C, kcd);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODAL_ANGLE_SNAP_TOGGLE:
 				kcd->angle_snapping = !kcd->angle_snapping;
 				knife_update_header(C, kcd);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODAL_CUT_THROUGH_TOGGLE:
 				kcd->cut_through = !kcd->cut_through;
-				knifetool_update_mval(kcd, event->mval);  /* refresh knife path */
 				knife_update_header(C, kcd);
+				do_refresh = TRUE;
 				break;
 			case KNF_MODAL_NEW_CUT:
 				ED_region_tag_redraw(kcd->ar);
@@ -3184,6 +3230,12 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 		}
 	}
 
+	if (do_refresh) {
+		/* we don't really need to update mval,
+		 * but this happens to be the best way to refresh at the moment */
+		knifetool_update_mval(kcd, event->mval);
+	}
+
 	/* keep going until the user confirms */
 	return OPERATOR_RUNNING_MODAL;
 }
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index c0a36e2..dec45b7 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -261,7 +261,11 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, int select)
 		lasteed = eed;
 	}
 	
-	if (lasteed != startedge && BM_edge_share_face_count(lasteed, startedge)) {
+#ifdef BMW_EDGERING_NGON
+	if (lasteed != startedge && BM_edge_share_face_check(lasteed, startedge)) {
+#else
+	if (lasteed != startedge && BM_edge_share_quad_check(lasteed, startedge)) {
+#endif
 		v[1][0] = v[0][0];
 		v[1][1] = v[0][1];
 
@@ -307,7 +311,13 @@ static void ringsel_find_edge(RingSelOpData *lcd, int cuts)
 static void ringsel_finish(bContext *C, wmOperator *op)
 {
 	RingSelOpData *lcd = op->customdata;
-	int cuts = RNA_int_get(op->ptr, "number_cuts");
+	const int cuts = RNA_int_get(op->ptr, "number_cuts");
+	const float smoothness = 0.292f * RNA_float_get(op->ptr, "smoothness");
+#ifdef BMW_EDGERING_NGON
+	const int use_only_quads = FALSE;
+#else
+	const int use_only_quads = TRUE;
+#endif
 
 	if (lcd->eed) {
 		BMEditMesh *em = lcd->em;
@@ -319,9 +329,10 @@ static void ringsel_finish(bContext *C, wmOperator *op)
 			 * Note though that it will break edgeslide in this specific case.
 			 * See [#31939]. */
 			BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
-			                   0.0f, 0.0f, 0.0f,
+			                   smoothness, 0.0f, 0.0f,
 			                   cuts,
-			                   SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, TRUE, 0);
+			                   SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, TRUE,
+			                   use_only_quads, 0);
 
 			/* force edge slide to edge select mode in in face select mode */
 			if (em->selectmode & SCE_SELECT_FACE) {
@@ -413,13 +424,14 @@ static int ringcut_cancel(bContext *C, wmOperator *op)
 
 static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 {
+	ScrArea *sa = CTX_wm_area(C);
 	Object *obedit = CTX_data_edit_object(C);
 	RingSelOpData *lcd;
 	BMEdge *edge;
-	int dist = 75;
+	float dist = 75.0f;
 
 	if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
-		BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display");
+		BKE_report(op->reports, RPT_WARNING, "Loop cut does not work well on deformed edit mesh display");
 	
 	view3d_operator_needs_opengl(C);
 
@@ -438,13 +450,17 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 		lcd->eed = edge;
 		ringsel_find_edge(lcd, 1);
 	}
-	ED_area_headerprint(CTX_wm_area(C), "Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts");
+	ED_area_headerprint(sa,
+	                    "Select a ring to be cut, "
+	                    "use mouse-wheel or page-up/down for number of cuts, "
+	                    "Hold Alt for smooth");
 	
 	return OPERATOR_RUNNING_MODAL;
 }
 
 static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
+	float smoothness = RNA_float_get(op->ptr, "smoothness");
 	int cuts = RNA_int_get(op->ptr, "number_cuts");
 	RingSelOpData *lcd = op->customdata;
 	int show_cuts = 0;
@@ -491,11 +507,17 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
 		case WHEELUPMOUSE:  /* change number of cuts */
 			if (event->val == KM_RELEASE)
 				break;
-
-			cuts++;
-			RNA_int_set(op->ptr, "number_cuts", cuts);
-			ringsel_find_edge(lcd, cuts);
-			show_cuts = TRUE;
+			if (event->alt == 0) {
+				cuts++;
+				RNA_int_set(op->ptr, "number_cuts", cuts);
+				ringsel_find_edge(lcd, cuts);
+				show_cuts = TRUE;
+			}
+			else {
+				smoothness = min_ff(smoothness + 0.05f, 4.0f);
+				RNA_float_set(op->ptr, "smoothness", smoothness);
+				show_cuts = TRUE;
+			}
 			
 			ED_region_tag_redraw(lcd->ar);
 			break;
@@ -505,15 +527,22 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
 			if (event->val == KM_RELEASE)
 				break;
 
-			cuts = MAX2(cuts - 1, 0);
-			RNA_int_set(op->ptr, "number_cuts", cuts);
-			ringsel_find_edge(lcd, cuts);
-			show_cuts = TRUE;
+			if (event->alt == 0) {
+				cuts = max_ii(cuts - 1, 0);
+				RNA_int_set(op->ptr, "number_cuts", cuts);
+				ringsel_find_edge(lcd, cuts);
+				show_cuts = TRUE;
+			}
+			else {
+				smoothness = max_ff(smoothness - 0.05f, 0.0f);
+				RNA_float_set(op->ptr, "smoothness", smoothness);
+				show_cuts = TRUE;
+			}
 			
 			ED_region_tag_redraw(lcd->ar);
 			break;
 		case MOUSEMOVE: { /* mouse moved somewhere to select another loop */
-			int dist = 75;
+			float dist = 75.0f;
 			BMEdge *edge;
 
 			lcd->vc.mval[0] = event->mval[0];
@@ -527,15 +556,15 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 			ED_region_tag_redraw(lcd->ar);
 			break;
-		}			
+		}
 	}
 	
 	/* using the keyboard to input the number of cuts */
 	if (event->val == KM_PRESS) {
 		/* init as zero so backspace clears */
-		float value = 0.0f;
 		
 		if (handleNumInput(&lcd->num, event)) {
+			float value = RNA_int_get(op->ptr, "number_cuts");
 			applyNumInput(&lcd->num, &value);
 			
 			/* allow zero so you can backspace and type in a value
@@ -552,7 +581,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
 	
 	if (show_cuts) {
 		char buf[64];
-		BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d", cuts);
+		BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d, Smooth: %.2f (Alt)", cuts, smoothness);
 		ED_area_headerprint(CTX_wm_area(C), buf);
 	}
 	
@@ -604,4 +633,7 @@ void MESH_OT_loopcut(wmOperatorType *ot)
 	prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
 	/* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+	prop = RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor", 0.0f, 4.0f);
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 0b3d178..2ecc20b 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -55,19 +55,59 @@
 
 #include "mesh_intern.h"
 
-/* helper to find edge for edge_rip */
-static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
-                                   const float co1[3], const float co2[3], const float mvalf[2])
+/**
+ * helper to find edge for edge_rip,
+ *
+ * \param inset is used so we get some useful distance
+ * when comparing multiple edges that meet at the same
+ * point and would result in the same distance.
+ */
+#define INSET_DEFAULT 0.00001f
+static float edbm_rip_edgedist(ARegion *ar, float mat[][4],
+                               const float co1[3], const float co2[3], const float mvalf[2],
+                               const float inset)
 {
 	float vec1[2], vec2[2];
 
 	ED_view3d_project_float_v2_m4(ar, co1, vec1, mat);
 	ED_view3d_project_float_v2_m4(ar, co2, vec2, mat);
 
+	if (inset != 0.0f) {
+		const float dist = inset / len_v2v2(vec1, vec2);
+		interp_v2_v2v2(vec1, vec1, vec2, dist);
+		interp_v2_v2v2(vec2, vec2, vec1, dist);
+	}
+
 	/* TODO: use dist_squared_to_line_segment_v2() looks like we only ever use for comparison */
 	return dist_to_line_segment_v2(mvalf, vec1, vec2);
 }
 
+#if 0
+static float edbm_rip_linedist(ARegion *ar, float mat[][4],
+                               const float co1[3], const float co2[3], const float mvalf[2])
+{
+	float vec1[2], vec2[2];
+
+	ED_view3d_project_float_v2_m4(ar, co1, vec1, mat);
+	ED_view3d_project_float_v2_m4(ar, co2, vec2, mat);
+
+	return dist_to_line_v2(mvalf, vec1, vec2);
+}
+#endif
+
+/* calculaters a point along the loop tangent which can be used to measure against edges */
+static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3])
+{
+	BM_loop_calc_face_tangent(l, l_mid_co);
+
+	/* scale to average of surrounding edge size, only needs to be approx, but should
+	 * be roughly equivalent to the check below which uses the middle of the edge. */
+	mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
+
+	add_v3_v3(l_mid_co, l->v->co);
+}
+
+
 static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
                                         ARegion *ar,
                                         float projectMat[4][4], const float fmval[2])
@@ -237,7 +277,6 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
 
 		uid_start = uid;
 		while ((e = edbm_ripsel_edge_mark_step(v_step, uid))) {
-			BM_elem_flag_disable(e, BM_ELEM_SMOOTH);
 			v_step = BM_edge_other_vert((e_step = e), v_step);
 			uid++; /* only different line */
 			tot++;
@@ -254,7 +293,6 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
 		v_step = e_first->v1;
 
 		while ((e = edbm_ripsel_edge_mark_step(v_step, uid))) {
-			BM_elem_flag_disable(e, BM_ELEM_SMOOTH);
 			v_step = BM_edge_other_vert((e_step = e), v_step);
 			uid--; /* only different line */
 			tot++;
@@ -344,6 +382,145 @@ static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs,
 }
 /* --- end 'ripsel' selection handling code --- */
 
+
+/* --- face-fill code --- */
+/**
+ * return an un-ordered array of loop pairs
+ * use for rebuilding face-fill
+ *
+ * \note the method currenly used fails for edges with 3+ face users and gives
+ *       nasty holes in the mesh, there isnt a good way of knowing ahead of time
+ *       which loops will be split apart (its possible to figure out but quite involved).
+ *       So for now this is a known limitation of current rip-fill option.
+ */
+
+typedef struct UnorderedLoopPair {
+	BMLoop *l_pair[2];
+	char    flag;
+} UnorderedLoopPair;
+enum {
+	ULP_FLIP_0 = (1 << 0),
+	ULP_FLIP_1 = (1 << 1)
+};
+
+static UnorderedLoopPair *edbm_tagged_loop_pairs_to_fill(BMesh *bm)
+{
+	BMIter iter;
+	BMEdge *e;
+
+	unsigned int total_tag = 0;
+	/* count tags, could be pre-calculated */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+			total_tag++;
+		}
+	}
+
+	if (total_tag) {
+		UnorderedLoopPair *uloop_pairs = MEM_mallocN(total_tag * sizeof(UnorderedLoopPair), __func__);
+		UnorderedLoopPair *ulp = uloop_pairs;
+
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+				BMLoop *l1, *l2;
+				if (BM_edge_loop_pair(e, &l1, &l2)) {
+					BMVert *v_cmp = l1->e->v1;
+					ulp->flag = (((l1->v != v_cmp) ? ULP_FLIP_0 : 0) |
+					             ((l2->v == v_cmp) ? ULP_FLIP_1 : 0));
+				}
+				else {
+					ulp->flag = 0;
+				}
+				ulp->l_pair[0] = l1;
+				ulp->l_pair[1] = l2;
+
+				ulp++;
+			}
+		}
+
+		return uloop_pairs;
+	}
+	else {
+		return NULL;
+	}
+}
+
+static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *uloop_pairs)
+{
+	UnorderedLoopPair *ulp;
+	unsigned int total_tag = MEM_allocN_len(uloop_pairs) / sizeof(UnorderedLoopPair);
+	unsigned int i;
+
+	for (i = 0, ulp = uloop_pairs; i < total_tag; i++, ulp++) {
+		if ((ulp->l_pair[0]    && ulp->l_pair[1]) &&
+		    (ulp->l_pair[0]->e != ulp->l_pair[1]->e))
+		{
+			 /* time has come to make a face! */
+			BMVert *v_shared = BM_edge_share_vert(ulp->l_pair[0]->e, ulp->l_pair[1]->e);
+			BMFace *f, *f_example = ulp->l_pair[0]->f;
+			BMLoop *l_iter;
+			BMVert *f_verts[4];
+
+			if (v_shared == NULL) {
+				/* quad */
+				f_verts[0] = ulp->l_pair[0]->e->v1;
+				f_verts[1] = ulp->l_pair[1]->e->v1;
+				f_verts[2] = ulp->l_pair[1]->e->v2;
+				f_verts[3] = ulp->l_pair[0]->e->v2;
+
+				if (ulp->flag & ULP_FLIP_0) {
+					SWAP(BMVert *, f_verts[0], f_verts[3]);
+				}
+				if (ulp->flag & ULP_FLIP_1) {
+					SWAP(BMVert *, f_verts[1], f_verts[2]);
+				}
+			}
+			else {
+				/* tri */
+				f_verts[0] = v_shared;
+				f_verts[1] = BM_edge_other_vert(ulp->l_pair[0]->e, v_shared);
+				f_verts[2] = BM_edge_other_vert(ulp->l_pair[1]->e, v_shared);
+				f_verts[3] = NULL;
+
+				/* don't use the flip flags */
+				if (v_shared == ulp->l_pair[0]->v) {
+					SWAP(BMVert *, f_verts[0], f_verts[1]);
+				}
+			}
+
+			/* face should never exist */
+			BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
+
+			f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, FALSE);
+
+			l_iter = BM_FACE_FIRST_LOOP(f);
+
+			if (f_verts[3]) {
+				BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+				BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); l_iter = l_iter->next;
+				BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); l_iter = l_iter->next;
+				BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter);
+			}
+			else {
+				if (v_shared == f_verts[0]) {
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter);
+				}
+				else {
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next;
+					BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter);
+				}
+			}
+
+		}
+	}
+}
+
+/* --- end 'face-fill' code --- */
+
+
 static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
 {
 	BMOperator bmop;
@@ -366,6 +543,8 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
  */
 static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 {
+	const int do_fill = RNA_boolean_get(op->ptr, "use_fill");
+	UnorderedLoopPair *fill_uloop_pairs = NULL;
 	Object *obedit = CTX_data_edit_object(C);
 	ARegion *ar = CTX_wm_region(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -388,7 +567,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 	ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
 
 	/* find selected vert - same some time and check history first */
-	if (BM_select_history_active_get(em->bm, &ese) && ese.htype == BM_VERT) {
+	if (BM_select_history_active_get(bm, &ese) && ese.htype == BM_VERT) {
 		v = (BMVert *)ese.ele;
 	}
 	else {
@@ -417,7 +596,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 			totboundary_edge += (is_boundary != 0 || BM_edge_is_wire(e));
 			if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
 				if (is_boundary == FALSE && BM_edge_is_manifold(e)) {
-					d = edbm_rip_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval);
+					d = edbm_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT);
 					if (d < dist) {
 						dist = d;
 						e2 = e;
@@ -426,6 +605,42 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 			}
 		}
 
+		/* if we are ripping a single vertex from 3 faces,
+		 * then measure the distance to the face corner as well as the edge */
+		if (BM_vert_face_count(v) == 3 &&
+		    BM_vert_edge_count(v) == 3)
+		{
+			BMEdge *e_all[3];
+			BMLoop *l_all[3];
+			int i1, i2;
+
+			BM_iter_as_array(bm, BM_EDGES_OF_VERT, v, (void **)e_all, 3);
+			BM_iter_as_array(bm, BM_LOOPS_OF_VERT, v, (void **)l_all, 3);
+
+			/* not do a loop similar to the one above, but test against loops */
+			for (i1 = 0; i1 < 3; i1++) {
+				/* consider wire as boundary for this purpose,
+				 * otherwise we can't a face away from a wire edge */
+				float l_mid_co[3];
+				l = l_all[i1];
+				edbm_calc_loop_co(l, l_mid_co);
+				d = edbm_rip_edgedist(ar, projectMat, l->v->co, l_mid_co, fmval, INSET_DEFAULT);
+
+				if (d < dist) {
+					dist = d;
+
+					/* find the edge that is not in this loop */
+					e2 = NULL;
+					for (i2 = 0; i2 < 3; i2++) {
+						if (!BM_edge_in_loop(e_all[i2], l)) {
+							e2 = e_all[i2];
+							break;
+						}
+					}
+					BLI_assert(e2 != NULL);
+				}
+			}
+		}
 	}
 
 	/* should we go ahead with edge rip or do we need to do special case, split off vertex?:
@@ -459,7 +674,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 			int vi_best = 0;
 
 			if (ese.ele) {
-				BM_select_history_remove(em->bm, ese.ele);
+				BM_select_history_remove(bm, ese.ele);
 			}
 
 			dist = FLT_MAX;
@@ -473,14 +688,9 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 					BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
 						if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
 							float l_mid_co[3];
-							BM_loop_calc_face_tangent(l, l_mid_co);
+							edbm_calc_loop_co(l, l_mid_co);
 
-							/* scale to average of surrounding edge size, only needs to be approx, but should
-							 * be roughly equivalent to the check below which uses the middle of the edge. */
-							mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
-							add_v3_v3(l_mid_co, v->co);
-
-							d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);
+							d = edbm_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT);
 
 							if (d < dist) {
 								dist = d;
@@ -496,7 +706,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 							float e_mid_co[3];
 							mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
 
-							d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval);
+							d = edbm_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT);
 
 							if (d < dist) {
 								dist = d;
@@ -512,7 +722,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 			BM_vert_select_set(bm, v, TRUE);
 
 			if (ese.ele) {
-				BM_select_history_store(em->bm, v);
+				BM_select_history_store(bm, v);
 			}
 
 			/* splice all others back together */
@@ -543,39 +753,65 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 		return OPERATOR_CANCELLED;
 	}
 
+	/* *** Execute the split! *** */
+	/* unlike edge split, for single vertex split we only use the operator in one of the cases
+	 * but both allocate fill */
+
 	/* rip two adjacent edges */
 	if (BM_edge_is_boundary(e2) || BM_vert_face_count(v) == 2) {
+		/* Don't run the edge split operator in this case */
+
+		BM_elem_flag_enable(e2, BM_ELEM_TAG);  /* only for face-fill (we don't call the operator) */
+
+		/* keep directly before edgesplit */
+		if (do_fill) {
+			fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
+		}
+
 		l = e2->l;
 		ripvert = BM_face_vert_separate(bm, l->f, v);
 
 		BLI_assert(ripvert);
 		if (!ripvert) {
+			if (fill_uloop_pairs) MEM_freeN(fill_uloop_pairs);
 			return OPERATOR_CANCELLED;
 		}
 	}
-	else if (BM_edge_is_manifold(e2)) {
-		l = e2->l;
-		e = BM_face_other_edge_loop(l->f, e2, v)->e;
-		BM_elem_flag_enable(e, BM_ELEM_TAG);
+	else {
+		if (BM_edge_is_manifold(e2)) {
+			l = e2->l;
+			e = BM_face_other_edge_loop(l->f, e2, v)->e;
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
+
+			l = e2->l->radial_next;
+			e = BM_face_other_edge_loop(l->f, e2, v)->e;
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
+		}
+		else {
+			/* looks like there are no split edges, we could just return/report-error? - Campbell */
+		}
+
+		/* keep directly before edgesplit */
+		if (do_fill) {
+			fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
+		}
 
-		l = e2->l->radial_next;
-		e = BM_face_other_edge_loop(l->f, e2, v)->e;
-		BM_elem_flag_enable(e, BM_ELEM_TAG);
+		if (!edbm_rip_call_edgesplit(em, op)) {
+			if (fill_uloop_pairs) MEM_freeN(fill_uloop_pairs);
+			return OPERATOR_CANCELLED;
+		}
 	}
 
 	dist = FLT_MAX;
 
-	if (!edbm_rip_call_edgesplit(em, op)) {
-		return OPERATOR_CANCELLED;
-	}
-	else {
+	{
 		/* --- select which vert --- */
 		BMVert *v_best = NULL;
 		float l_prev_co[3], l_next_co[3], l_corner_co[3];
 		float scale;
 
 		dist = FLT_MAX;
-		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
 			if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
 				/* disable by default, re-enable winner at end */
 				BM_vert_select_set(bm, v, FALSE);
@@ -593,7 +829,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 					add_v3_v3v3(l_corner_co, l_prev_co, l_next_co);
 					add_v3_v3(l_corner_co, l->v->co);
 
-					d = edbm_rip_rip_edgedist(ar, projectMat, l->v->co, l_corner_co, fmval);
+					d = edbm_rip_edgedist(ar, projectMat, l->v->co, l_corner_co, fmval, INSET_DEFAULT);
 					if (d < dist) {
 						v_best = v;
 						dist = d;
@@ -605,11 +841,17 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
 		if (v_best) {
 			BM_vert_select_set(bm, v_best, TRUE);
 			if (ese.ele) {
-				BM_select_history_store(em->bm, v_best);
+				BM_select_history_store(bm, v_best);
 			}
 		}
 	}
 
+	if (do_fill && fill_uloop_pairs) {
+		edbm_tagged_loop_pairs_do_fill_faces(bm, fill_uloop_pairs);
+		MEM_freeN(fill_uloop_pairs);
+	}
+
+
 	if (totvert_orig == bm->totvert) {
 		BKE_report(op->reports, RPT_ERROR, "No vertices could be ripped");
 		return OPERATOR_CANCELLED;
@@ -623,6 +865,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
  */
 static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 {
+	const int do_fill = RNA_boolean_get(op->ptr, "use_fill");
+	UnorderedLoopPair *fill_uloop_pairs = NULL;
 	Object *obedit = CTX_data_edit_object(C);
 	ARegion *ar = CTX_wm_region(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -633,25 +877,25 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 	BMEdge *e, *e2;
 	BMVert *v;
 	const int totedge_orig = bm->totedge;
-	int i;
 	float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
 
-	int totedge;
-	int all_minifold;
-
 	EdgeLoopPair *eloop_pairs;
 
 	ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
 
-	/* important this runs on the original selection, before tempering with tagging */
+	/* important this runs on the original selection, before tampering with tagging */
 	eloop_pairs = edbm_ripsel_looptag_helper(bm);
 
 	/* expand edge selection */
 	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		int all_manifold;
+		int totedge_manifold;  /* manifold, visible edges */
+		int i;
+
 		e2 = NULL;
 		i = 0;
-		totedge = 0;
-		all_minifold = TRUE;
+		totedge_manifold = 0;
+		all_manifold = TRUE;
 		BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
 
 			if (!BM_edge_is_wire(e) &&
@@ -663,22 +907,25 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 					e2 = e;
 					i++;
 				}
-				totedge++;
+				totedge_manifold++;
 			}
 
 			/** #BM_vert_other_disk_edge has no hidden checks so don't check hidden here */
-			if ((all_minifold == TRUE) && (BM_edge_is_manifold(e) == FALSE)) {
-				all_minifold = FALSE;
+			if ((all_manifold == TRUE) && (BM_edge_is_manifold(e) == FALSE)) {
+				all_manifold = FALSE;
 			}
 		}
 
 		/* single edge, extend */
 		if (i == 1 && e2->l) {
-			if ((totedge == 4) || (all_minifold == FALSE)) {
+			/* note: if the case of 3 edges has one change in loop stepping,
+			 * if this becomes more involved we may be better off splitting
+			 * the 3 edge case into its own else-if branch */
+			if ((totedge_manifold == 4 || totedge_manifold == 3) || (all_manifold == FALSE)) {
 				BMLoop *l_a = e2->l;
 				BMLoop *l_b = l_a->radial_next;
 
-				/* find the best face to follow, this what the edge won't point away from
+				/* find the best face to follow, this way the edge won't point away from
 				 * the mouse when there are more then 4 (takes the shortest face fan around) */
 				l = (edbm_rip_edge_side_measure(e2, l_a, ar, projectMat, fmval) <
 				     edbm_rip_edge_side_measure(e2, l_b, ar, projectMat, fmval)) ? l_a : l_b;
@@ -688,9 +935,12 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 				 * not crashing but adds duplicate edge. */
 				if (BM_edge_is_manifold(l->e)) {
 					l = l->radial_next;
-					l = BM_face_other_edge_loop(l->f, l->e, v);
+
+					if (totedge_manifold != 3)
+						l = BM_face_other_edge_loop(l->f, l->e, v);
 
 					if (l) {
+						BLI_assert(!BM_elem_flag_test(l->e, BM_ELEM_TAG));
 						BM_elem_flag_enable(l->e, BM_ELEM_TAG);
 					}
 				}
@@ -699,13 +949,20 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 				e = BM_vert_other_disk_edge(v, e2);
 
 				if (e) {
+					BLI_assert(!BM_elem_flag_test(e, BM_ELEM_TAG));
 					BM_elem_flag_enable(e, BM_ELEM_TAG);
 				}
 			}
 		}
 	}
 
+	/* keep directly before edgesplit */
+	if (do_fill) {
+		fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
+	}
+
 	if (!edbm_rip_call_edgesplit(em, op)) {
+		if (fill_uloop_pairs) MEM_freeN(fill_uloop_pairs);
 		return OPERATOR_CANCELLED;
 	}
 
@@ -718,6 +975,11 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
 	                            ar, projectMat, fmval);
 	MEM_freeN(eloop_pairs);
 
+	if (do_fill && fill_uloop_pairs) {
+		edbm_tagged_loop_pairs_do_fill_faces(bm, fill_uloop_pairs);
+		MEM_freeN(fill_uloop_pairs);
+	}
+
 	if (totedge_orig == bm->totedge) {
 		BKE_report(op->reports, RPT_ERROR, "No edges could be ripped");
 		return OPERATOR_CANCELLED;
@@ -740,12 +1002,12 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	int ret;
 
 	/* running in face mode hardly makes sense, so convert to region loop and rip */
-	if (em->bm->totfacesel) {
+	if (bm->totfacesel) {
 		/* highly nifty but hard to support since the operator can fail and we're left
 		 * with modified selection */
 		// WM_operator_name_call(C, "MESH_OT_region_to_loop", WM_OP_INVOKE_DEFAULT, NULL);
 
-		BKE_report(op->reports, RPT_ERROR, "Can't rip selected faces");
+		BKE_report(op->reports, RPT_ERROR, "Cannot rip selected faces");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -760,7 +1022,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	 */
 
 	/* BM_ELEM_SELECT --> BM_ELEM_TAG */
-	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 		BM_elem_flag_set(e, BM_ELEM_TAG, BM_elem_flag_test(e, BM_ELEM_SELECT));
 	}
 
@@ -804,5 +1066,6 @@ void MESH_OT_rip(wmOperatorType *ot)
 
 	/* to give to transform */
 	Transform_Properties(ot, P_PROPORTIONAL);
-	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+	RNA_def_boolean(ot->srna, "mirror", FALSE, "Mirror Editing", "");
+	RNA_def_boolean(ot->srna, "use_fill", FALSE, "Fill", "Fill the ripped region");
 }
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 680d15e..3335f03 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -56,7 +56,9 @@
 
 #include "ED_mesh.h"
 #include "ED_screen.h"
+#include "ED_util.h"
 #include "ED_uvedit.h"
+#include "ED_object.h"
 #include "ED_view3d.h"
 
 #include "BIF_gl.h"
@@ -67,6 +69,7 @@
 
 #include "mesh_intern.h"
 
+#include "UI_resources.h"
 
 /* ****************************** MIRROR **************** */
 
@@ -330,9 +333,9 @@ int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
 	
 }
 
-static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y, int index)
+static void findnearestvert__doClosest(void *userData, BMVert *eve, const float screen_co[2], int index)
 {
-	struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; BMVert *closest; } *data = userData;
+	struct { float mval_fl[2], pass, select, strict; float dist, lastIndex, closestIndex; BMVert *closest; } *data = userData;
 
 	if (data->pass == 0) {
 		if (index <= data->lastIndex)
@@ -344,18 +347,18 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y
 	}
 
 	if (data->dist > 3) {
-		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+		float dist_test = len_manhattan_v2v2(data->mval_fl, screen_co);
 		if (BM_elem_flag_test(eve, BM_ELEM_SELECT) == data->select) {
 			if (data->strict == 1) {
 				return;
 			}
 			else {
-				temp += 5;
+				dist_test += 5;
 			}
 		}
 
-		if (temp < data->dist) {
-			data->dist = temp;
+		if (dist_test < data->dist) {
+			data->dist = dist_test;
 			data->closest = eve;
 			data->closestIndex = index;
 		}
@@ -382,10 +385,10 @@ static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int
  *      if 0, unselected vertice are given the bias
  * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased 
  */
-BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short strict)
+BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const short sel, const short strict)
 {
 	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
-		int distance;
+		float distance;
 		unsigned int index;
 		BMVert *eve;
 		
@@ -400,8 +403,8 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short stri
 		
 		eve = BM_vert_at_index(vc->em->bm, index - 1);
 		
-		if (eve && distance < *dist) {
-			*dist = distance;
+		if (eve && distance < *r_dist) {
+			*r_dist = distance;
 			return eve;
 		}
 		else {
@@ -410,7 +413,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short stri
 			
 	}
 	else {
-		struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; BMVert *closest; } data;
+		struct { float mval_fl[2], pass, select, strict; float dist, lastIndex, closestIndex; BMVert *closest; } data;
 		static int lastSelectedIndex = 0;
 		static BMVert *lastSelected = NULL;
 		
@@ -420,10 +423,10 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short stri
 		}
 
 		data.lastIndex = lastSelectedIndex;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
+		data.mval_fl[0] = vc->mval[0];
+		data.mval_fl[1] = vc->mval[1];
 		data.select = sel;
-		data.dist = *dist;
+		data.dist = *r_dist;
 		data.strict = strict;
 		data.closest = NULL;
 		data.closestIndex = 0;
@@ -432,14 +435,14 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short stri
 
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 		if (data.dist > 3) {
 			data.pass = 1;
-			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 
-		*dist = data.dist;
+		*r_dist = data.dist;
 		lastSelected = data.closest;
 		lastSelectedIndex = data.closestIndex;
 
@@ -447,33 +450,13 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short stri
 	}
 }
 
-/* returns labda for closest distance v1 to line-piece v2 - v3 */
-float labda_PdistVL2Dfl(const float v1[2], const float v2[2], const float v3[2])
-{
-	float rc[2], len;
-	
-	rc[0] = v3[0] - v2[0];
-	rc[1] = v3[1] - v2[1];
-	len = rc[0] * rc[0] + rc[1] * rc[1];
-	if (len == 0.0f)
-		return 0.0f;
-	
-	return (rc[0] * (v1[0] - v2[0]) + rc[1] * (v1[1] - v2[1])) / len;
-}
-
 /* note; uses v3d, so needs active 3d window */
-static void findnearestedge__doClosest(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
+static void findnearestedge__doClosest(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int UNUSED(index))
 {
-	struct { ViewContext vc; float mval[2]; int dist; BMEdge *closest; } *data = userData;
-	float v1[2], v2[2];
+	struct { ViewContext vc; float mval_fl[2]; float dist; BMEdge *closest; } *data = userData;
 	int distance;
-		
-	v1[0] = x0;
-	v1[1] = y0;
-	v2[0] = x1;
-	v2[1] = y1;
-		
-	distance = dist_to_line_segment_v2(data->mval, v1, v2);
+
+	distance = dist_to_line_segment_v2(data->mval_fl, screen_co_a, screen_co_b);
 		
 	if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
 		distance += 5;
@@ -481,7 +464,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, int x0, int
 
 	if (distance < data->dist) {
 		if (data->vc.rv3d->rflag & RV3D_CLIPPING) {
-			float labda = labda_PdistVL2Dfl(data->mval, v1, v2);
+			float labda = line_point_factor_v2(data->mval_fl, screen_co_a, screen_co_b);
 			float vec[3];
 
 			vec[0] = eed->v1->co[0] + labda * (eed->v2->co[0] - eed->v1->co[0]);
@@ -499,11 +482,11 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, int x0, int
 		}
 	}
 }
-BMEdge *EDBM_edge_find_nearest(ViewContext *vc, int *dist)
+BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
 {
 
 	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
-		int distance;
+		float distance;
 		unsigned int index;
 		BMEdge *eed;
 		
@@ -512,8 +495,8 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, int *dist)
 		index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
 		eed = BM_edge_at_index(vc->em->bm, index - 1);
 		
-		if (eed && distance < *dist) {
-			*dist = distance;
+		if (eed && distance < *r_dist) {
+			*r_dist = distance;
 			return eed;
 		}
 		else {
@@ -521,36 +504,37 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, int *dist)
 		}
 	}
 	else {
-		struct { ViewContext vc; float mval[2]; int dist; BMEdge *closest; } data;
+		struct { ViewContext vc; float mval_fl[2]; float dist; BMEdge *closest; } data;
 
 		data.vc = *vc;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
-		data.dist = *dist;
+		data.mval_fl[0] = vc->mval[0];
+		data.mval_fl[1] = vc->mval[1];
+		data.dist = *r_dist;
 		data.closest = NULL;
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, V3D_CLIP_TEST_REGION);
+		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, V3D_PROJ_TEST_CLIP_WIN);
 
-		*dist = data.dist;
+		*r_dist = data.dist;
 		return data.closest;
 	}
 }
 
-static void findnearestface__getDistance(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
+static void findnearestface__getDistance(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
 {
-	struct { short mval[2]; int dist; BMFace *toFace; } *data = userData;
+	struct { float mval_fl[2]; float dist; BMFace *toFace; } *data = userData;
 
 	if (efa == data->toFace) {
-		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+		const float dist_test = len_manhattan_v2v2(data->mval_fl, screen_co);
 
-		if (temp < data->dist)
-			data->dist = temp;
+		if (dist_test < data->dist) {
+			data->dist = dist_test;
+		}
 	}
 }
-static void findnearestface__doClosest(void *userData, BMFace *efa, int x, int y, int index)
+static void findnearestface__doClosest(void *userData, BMFace *efa, const float screen_co[2], int index)
 {
-	struct { short mval[2], pass; int dist, lastIndex, closestIndex; BMFace *closest; } *data = userData;
+	struct { float mval_fl[2], pass; float dist, lastIndex, closestIndex; BMFace *closest; } *data = userData;
 
 	if (data->pass == 0) {
 		if (index <= data->lastIndex)
@@ -562,17 +546,17 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, int x, int y
 	}
 
 	if (data->dist > 3) {
-		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+		const float dist_test = len_manhattan_v2v2(data->mval_fl, screen_co);
 
-		if (temp < data->dist) {
-			data->dist = temp;
+		if (dist_test < data->dist) {
+			data->dist = dist_test;
 			data->closest = efa;
 			data->closestIndex = index;
 		}
 	}
 }
 
-BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
+BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
 {
 
 	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
@@ -585,17 +569,17 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
 		efa = BM_face_at_index(vc->em->bm, index - 1);
 		
 		if (efa) {
-			struct { short mval[2]; int dist; BMFace *toFace; } data;
+			struct { float mval_fl[2]; float dist; BMFace *toFace; } data;
 
-			data.mval[0] = vc->mval[0];
-			data.mval[1] = vc->mval[1];
+			data.mval_fl[0] = vc->mval[0];
+			data.mval_fl[1] = vc->mval[1];
 			data.dist = 0x7FFF;     /* largest short */
 			data.toFace = efa;
 
-			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data);
+			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
-			if (vc->em->selectmode == SCE_SELECT_FACE || data.dist < *dist) {   /* only faces, no dist check */
-				*dist = data.dist;
+			if ((vc->em->selectmode == SCE_SELECT_FACE) || (data.dist < *r_dist)) {  /* only faces, no dist check */
+				*r_dist = data.dist;
 				return efa;
 			}
 		}
@@ -603,7 +587,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
 		return NULL;
 	}
 	else {
-		struct { short mval[2], pass; int dist, lastIndex, closestIndex; BMFace *closest; } data;
+		struct { float mval_fl[2], pass; float dist, lastIndex, closestIndex; BMFace *closest; } data;
 		static int lastSelectedIndex = 0;
 		static BMFace *lastSelected = NULL;
 
@@ -613,23 +597,23 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
 		}
 
 		data.lastIndex = lastSelectedIndex;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
-		data.dist = *dist;
+		data.mval_fl[0] = vc->mval[0];
+		data.mval_fl[1] = vc->mval[1];
+		data.dist = *r_dist;
 		data.closest = NULL;
 		data.closestIndex = 0;
 		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
 		data.pass = 0;
-		mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
+		mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
-		if (data.dist > 3) {
+		if (data.dist > 3.0f) {
 			data.pass = 1;
 			ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
+			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 
-		*dist = data.dist;
+		*r_dist = data.dist;
 		lastSelected = data.closest;
 		lastSelectedIndex = data.closestIndex;
 
@@ -645,7 +629,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
 static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
 {
 	BMEditMesh *em = vc->em;
-	int dist = 75;
+	float dist = 75.0f;
 	
 	*r_eve = NULL;
 	*r_eed = NULL;
@@ -675,6 +659,13 @@ static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed,
 }
 
 /* ****************  SIMILAR "group" SELECTS. FACE, EDGE AND VERTEX ************** */
+static EnumPropertyItem prop_similar_compare_types[] = {
+	{SIM_CMP_EQ, "EQUAL", 0, "Equal", ""},
+	{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
+	{SIM_CMP_LT, "LESS", 0, "Less", ""},
+
+	{0, NULL, 0, NULL, NULL}
+};
 
 static EnumPropertyItem prop_similar_types[] = {
 	{SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""},
@@ -694,6 +685,7 @@ static EnumPropertyItem prop_similar_types[] = {
 	{SIMFACE_MATERIAL, "MATERIAL", 0, "Material", ""},
 	{SIMFACE_IMAGE, "IMAGE", 0, "Image", ""},
 	{SIMFACE_AREA, "AREA", 0, "Area", ""},
+	{SIMFACE_SIDES, "SIDES", 0, "Polygon Sides", ""},
 	{SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
 	{SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
 	{SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
@@ -710,11 +702,14 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
 	BMOperator bmop;
 
 	/* get the type from RNA */
-	int type = RNA_enum_get(op->ptr, "type");
-	float thresh = RNA_float_get(op->ptr, "threshold");
+	const int type = RNA_enum_get(op->ptr, "type");
+	const float thresh = RNA_float_get(op->ptr, "threshold");
+	const int compare = RNA_enum_get(op->ptr, "compare");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "similar_faces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+	EDBM_op_init(em, &bmop, op,
+	             "similar_faces faces=%hf type=%i thresh=%f compare=%i",
+	             BM_ELEM_SELECT, type, thresh, compare);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -723,7 +718,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
 	/* select the output */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 
 	/* finish the operator */
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -748,11 +743,14 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
 	BMOperator bmop;
 
 	/* get the type from RNA */
-	int type = RNA_enum_get(op->ptr, "type");
-	float thresh = RNA_float_get(op->ptr, "threshold");
+	const int type = RNA_enum_get(op->ptr, "type");
+	const float thresh = RNA_float_get(op->ptr, "threshold");
+	const int compare = RNA_enum_get(op->ptr, "compare");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "similar_edges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+	EDBM_op_init(em, &bmop, op,
+	             "similar_edges edges=%he type=%i thresh=%f compare=%i",
+	             BM_ELEM_SELECT, type, thresh, compare);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -761,7 +759,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
 	/* select the output */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
 	EDBM_selectmode_flush(em);
 
 	/* finish the operator */
@@ -789,11 +787,14 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
 	BMEditMesh *em = BMEdit_FromObject(ob);
 	BMOperator bmop;
 	/* get the type from RNA */
-	int type = RNA_enum_get(op->ptr, "type");
+	const int type = RNA_enum_get(op->ptr, "type");
 	float thresh = RNA_float_get(op->ptr, "threshold");
+	const int compare = RNA_enum_get(op->ptr, "compare");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "similar_verts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+	EDBM_op_init(em, &bmop, op,
+	             "similar_verts verts=%hv type=%i thresh=%f compare=%i",
+	             BM_ELEM_SELECT, type, thresh, compare);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -802,7 +803,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
 	/* select the output */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
 
 	/* finish the operator */
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -822,7 +823,7 @@ static int edbm_select_similar_exec(bContext *C, wmOperator *op)
 	ToolSettings *ts = CTX_data_tool_settings(C);
 	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "threshold");
 
-	int type = RNA_enum_get(op->ptr, "type");
+	const int type = RNA_enum_get(op->ptr, "type");
 
 	if (!RNA_property_is_set(op->ptr, prop)) {
 		RNA_property_float_set(op->ptr, prop, ts->select_thresh);
@@ -833,7 +834,7 @@ static int edbm_select_similar_exec(bContext *C, wmOperator *op)
 
 	if      (type < 100) return similar_vert_select_exec(C, op);
 	else if (type < 200) return similar_edge_select_exec(C, op);
-	else return similar_face_select_exec(C, op);
+	else                 return similar_face_select_exec(C, op);
 }
 
 static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop),
@@ -897,7 +898,77 @@ void MESH_OT_select_similar(wmOperatorType *ot)
 	prop = ot->prop = RNA_def_enum(ot->srna, "type", prop_similar_types, SIMVERT_NORMAL, "Type", "");
 	RNA_def_enum_funcs(prop, select_similar_type_itemf);
 
-	RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.01, 1.0);
+	RNA_def_enum(ot->srna, "compare", prop_similar_compare_types, SIM_CMP_EQ, "Compare", "");
+
+	RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.0, 1.0);
+}
+
+
+/* ****************  Mode Select *************** */
+
+static int edbm_select_mode_exec(bContext *C, wmOperator *op)
+{
+	const int type       = RNA_enum_get(op->ptr,    "type");
+	const int action     = RNA_enum_get(op->ptr,    "action");
+	const int use_extend = RNA_boolean_get(op->ptr, "use_extend");
+	const int use_expand = RNA_boolean_get(op->ptr, "use_expand");
+
+	if (EDBM_selectmode_toggle(C, type, action, use_extend, use_expand)) {
+		return OPERATOR_FINISHED;
+	}
+	else {
+		return OPERATOR_CANCELLED;
+	}
+}
+
+static int edbm_select_mode_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	// RNA_enum_set(op->ptr, "type");  /* type must be set already */
+	RNA_boolean_set(op->ptr, "use_extend", event->shift);
+	RNA_boolean_set(op->ptr, "use_expand", event->ctrl);
+	return edbm_select_mode_exec(C, op);
+}
+
+void MESH_OT_select_mode(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+
+	static EnumPropertyItem elem_items[] = {
+		{SCE_SELECT_VERTEX, "VERT", ICON_VERTEXSEL, "Vertices", ""},
+		{SCE_SELECT_EDGE,   "EDGE", ICON_EDGESEL, "Edges", ""},
+		{SCE_SELECT_FACE,   "FACE", ICON_FACESEL, "Faces", ""},
+		{0, NULL, 0, NULL, NULL},
+	};
+
+	static EnumPropertyItem actions_items[] = {
+		{0, "DISABLE", 0, "Disable", "Disable selected markers"},
+		{1, "ENABLE", 0, "Enable", "Enable selected markers"},
+		{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	/* identifiers */
+	ot->name = "Select Mode";
+	ot->idname = "MESH_OT_select_mode";
+	ot->description = "Change selection mode";
+
+	/* api callbacks */
+	ot->invoke = edbm_select_mode_invoke;
+	ot->exec = edbm_select_mode_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* properties */
+	prop = RNA_def_boolean(ot->srna, "use_extend", FALSE, "Extend", "");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "use_expand", FALSE, "Expand", "");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	ot->prop = prop = RNA_def_enum(ot->srna, "type", elem_items, 0, "Type", "");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+	RNA_def_enum(ot->srna, "action", actions_items, 2, "Action", "Selection action to execute");
 }
 
 /* ***************************************************** */
@@ -998,13 +1069,13 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
 
 /* ***************** loop select (non modal) ************** */
 
-static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
+static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short deselect, short toggle, short ring)
 {
 	ViewContext vc;
 	BMEditMesh *em;
 	BMEdge *eed;
 	int select = TRUE;
-	int dist = 50;
+	float dist = 50.0f;
 	float mvalf[2];
 
 	em_setup_viewcontext(C, &vc);
@@ -1017,14 +1088,20 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
 
 	eed = EDBM_edge_find_nearest(&vc, &dist);
 	if (eed) {
-		if (extend == 0) {
+		if (extend == 0 && deselect == 0 && toggle == 0) {
 			EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 		}
 	
-		if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+		if (extend) {
+			select = TRUE;
+		}
+		else if (deselect) {
+			select = FALSE;
+		}
+		else if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
 			select = TRUE;
 		}
-		else if (extend) {
+		else if (toggle) {
 			select = FALSE;
 		}
 
@@ -1117,6 +1194,8 @@ static int edbm_select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	view3d_operator_needs_opengl(C);
 	
 	mouse_mesh_loop(C, event->mval, RNA_boolean_get(op->ptr, "extend"),
+	                RNA_boolean_get(op->ptr, "deselect"),
+	                RNA_boolean_get(op->ptr, "toggle"),
 	                RNA_boolean_get(op->ptr, "ring"));
 	
 	/* cannot do tweaks for as long this keymap is after transform map */
@@ -1139,6 +1218,8 @@ void MESH_OT_loop_select(wmOperatorType *ot)
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Extend the selection");
+	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+	RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
 	RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring");
 }
 
@@ -1157,64 +1238,74 @@ void MESH_OT_edgering_select(wmOperatorType *ot)
 	ot->flag = OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+	RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
 	RNA_def_boolean(ot->srna, "ring", 1, "Select Ring", "Select ring");
 }
 
-/* ******************* edgetag_shortest_path and helpers ****************** */
+/* ******************* generic tag_shortest_path and helpers ****************** */
 
-static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BMVert *v)
+static float step_cost_3_v3(const float v1[3], const float v2[3], const float v3[3])
 {
-	BMVert *v1 = (e1->v1 == v) ? e1->v2 : e1->v1;
-	BMVert *v2 = (e2->v1 == v) ? e2->v2 : e2->v1;
 	float cost, d1[3], d2[3];
 
+
 	/* The cost is based on the simple sum of the length of the two edgees... */
-	sub_v3_v3v3(d1, v->co, v1->co);
-	sub_v3_v3v3(d2, v2->co, v->co);
-	cost = len_v3(d1);
-	cost += len_v3(d2);
+	sub_v3_v3v3(d1, v2, v1);
+	sub_v3_v3v3(d2, v3, v2);
+	cost = normalize_v3(d1) + normalize_v3(d2);
 
 	/* but is biased to give higher values to sharp turns, so that it will take
 	 * paths with fewer "turns" when selecting between equal-weighted paths between
 	 * the two edges */
-	cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2))));
+	cost = cost * (1.0f + 0.5f * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))));
 
 	return cost;
 }
 
-static void edgetag_add_adjacent(BMEditMesh *em, SmallHash *visithash, Heap *heap, int mednum, int vertnum, 
-                                 int *nedges, int *edges, int *prevedge, float *cost)
-{
-	BMEdge *e1 = EDBM_edge_at_index(em, mednum);
-	BMVert *v = EDBM_vert_at_index(em, vertnum);
-	int startadj, endadj = nedges[vertnum + 1];
-
-	for (startadj = nedges[vertnum]; startadj < endadj; startadj++) {
-		int adjnum = edges[startadj];
-		BMEdge *e2 = EDBM_edge_at_index(em, adjnum);
-		float newcost;
-		float cutcost;
+/* ******************* edgetag_shortest_path and helpers ****************** */
 
-		if (BLI_smallhash_haskey(visithash, (uintptr_t)e2))
-			continue;
+static float edgetag_cut_cost(BMEdge *e1, BMEdge *e2, BMVert *v)
+{
+	BMVert *v1 = BM_edge_other_vert(e1, v);
+	BMVert *v2 = BM_edge_other_vert(e2, v);
+	return step_cost_3_v3(v1->co, v->co, v2->co);
+}
 
-		cutcost = edgetag_cut_cost(em, e1, e2, v);
-		newcost = cost[mednum] + cutcost;
+static void edgetag_add_adjacent(Heap *heap, BMEdge *e1, BMEdge **edges_prev, float *cost)
+{
+	BMIter viter;
+	BMVert *v;
 
-		if (cost[adjnum] > newcost) {
-			cost[adjnum] = newcost;
-			prevedge[adjnum] = mednum;
-			BLI_heap_insert(heap, newcost, SET_INT_IN_POINTER(adjnum));
+	BMIter eiter;
+	BMEdge *e2;
+
+	const int e1_index = BM_elem_index_get(e1);
+
+	BM_ITER_ELEM (v, &viter, e1, BM_VERTS_OF_EDGE) {
+		BM_ITER_ELEM (e2, &eiter, v, BM_EDGES_OF_VERT) {
+			if (!BM_elem_flag_test(e2, BM_ELEM_TAG)) {
+				/* we know 'e2' is not visited, check it out! */
+				const int e2_index = BM_elem_index_get(e2);
+				const float cost_cut = edgetag_cut_cost(e1, e2, v);
+				const float cost_new = cost[e1_index] + cost_cut;
+
+				if (cost[e2_index] > cost_new) {
+					cost[e2_index] = cost_new;
+					edges_prev[e2_index] = e1;
+					BLI_heap_insert(heap, cost_new, e2);
+				}
+			}
 		}
 	}
 }
 
-static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val)
+static void edgetag_context_set(BMesh *bm, Scene *scene, BMEdge *e, int val)
 {
 	
 	switch (scene->toolsettings->edge_mode) {
 		case EDGE_MODE_SELECT:
-			BM_edge_select_set(em->bm, e, val);
+			BM_edge_select_set(bm, e, val);
 			break;
 		case EDGE_MODE_TAG_SEAM:
 			BM_elem_flag_set(e, BM_ELEM_SEAM, val);
@@ -1223,98 +1314,66 @@ static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val
 			BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val);
 			break;
 		case EDGE_MODE_TAG_CREASE:
-		{
-			float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
-			*crease = (val) ? 1.0f : 0.0f;
+			BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (val) ? 1.0f : 0.0f);
 			break;
-		}
 		case EDGE_MODE_TAG_BEVEL:
-		{
-			float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
-			*bweight = (val) ? 1.0f : 0.0f;
+			BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (val) ? 1.0f : 0.0f);
 			break;
-		}
 	}
 }
 
-static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e)
+static int edgetag_context_check(Scene *scene, BMesh *bm, BMEdge *e)
 {
 	switch (scene->toolsettings->edge_mode) {
 		case EDGE_MODE_SELECT:
-			return BM_elem_flag_test(e, BM_ELEM_SELECT) ? 1 : 0;
+			return BM_elem_flag_test(e, BM_ELEM_SELECT) ? TRUE : FALSE;
 		case EDGE_MODE_TAG_SEAM:
 			return BM_elem_flag_test(e, BM_ELEM_SEAM);
 		case EDGE_MODE_TAG_SHARP:
 			return !BM_elem_flag_test(e, BM_ELEM_SMOOTH);
 		case EDGE_MODE_TAG_CREASE:
-			return BM_elem_float_data_get(&em->bm->edata, e, CD_CREASE) ? 1 : 0;
+			return BM_elem_float_data_get(&bm->edata, e, CD_CREASE) ? TRUE : FALSE;
 		case EDGE_MODE_TAG_BEVEL:
-			return BM_elem_float_data_get(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0;
+			return BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT) ? TRUE : FALSE;
 	}
 	return 0;
 }
 
-static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, BMEdge *target)
+static int edgetag_shortest_path(Scene *scene, BMesh *bm, BMEdge *e_src, BMEdge *e_dst)
 {
+	/* BM_ELEM_TAG flag is used to store visited edges */
 	BMEdge *e;
-	BMIter iter;
+	BMIter eiter;
 	Heap *heap;
-	SmallHash visithash;
 	float *cost;
-	int i, totvert = 0, totedge = 0, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
-	int targetnum;
-
-	BLI_smallhash_init(&visithash);
+	BMEdge **edges_prev;
+	int i, totedge;
 
 	/* note, would pass BM_EDGE except we are looping over all edges anyway */
-	BM_mesh_elem_index_ensure(em->bm, BM_VERT /* | BM_EDGE */);
+	BM_mesh_elem_index_ensure(bm, BM_VERT /* | BM_EDGE */);
 
-	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
-		if (BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
-			BLI_smallhash_insert(&visithash, (uintptr_t)e, NULL);
+	BM_ITER_MESH_INDEX (e, &eiter, bm, BM_EDGES_OF_MESH, i) {
+		if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE) {
+			BM_elem_flag_disable(e, BM_ELEM_TAG);
+		}
+		else {
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
 		}
 
-		BM_elem_index_set(e, totedge); /* set_inline */
-		totedge++;
+		BM_elem_index_set(e, i); /* set_inline */
 	}
-	em->bm->elem_index_dirty &= ~BM_EDGE;
+	bm->elem_index_dirty &= ~BM_EDGE;
 
 	/* alloc */
-	totvert = em->bm->totvert;
-	nedges = MEM_callocN(sizeof(*nedges) * totvert + 1, "SeamPathNEdges");
-	edges = MEM_mallocN(sizeof(*edges) * totedge * 2, "SeamPathEdges");
-	prevedge = MEM_mallocN(sizeof(*prevedge) * totedge, "SeamPathPrevious");
+	totedge = bm->totedge;
+	edges_prev = MEM_callocN(sizeof(*edges_prev) * totedge, "SeamPathPrevious");
 	cost = MEM_mallocN(sizeof(*cost) * totedge, "SeamPathCost");
 
-	/* count edges, compute adjacent edges offsets and fill adjacent */
-	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
-		nedges[BM_elem_index_get(e->v1) + 1]++;
-		nedges[BM_elem_index_get(e->v2) + 1]++;
-	}
-
-	for (i = 1; i < totvert; i++) {
-		int newswap = nedges[i + 1];
-		nedges[i + 1] = nedgeswap + nedges[i];
-		nedgeswap = newswap;
-	}
-	nedges[0] = nedges[1] = 0;
-
-	i = 0;
-	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
-		edges[nedges[BM_elem_index_get(e->v1) + 1]++] = i;
-		edges[nedges[BM_elem_index_get(e->v2) + 1]++] = i;
-
-		cost[i] = 1e20f;
-		prevedge[i] = -1;
-		i++;
-	}
+	fill_vn_fl(cost, totedge, 1e20f);
 
 	/*
 	 * Arrays are now filled as follows:
 	 *
-	 *	nedges[n] = sum of the # of edges incident to all vertices numbered 0 through n - 1
-	 *	edges[edges[n]..edges[n - 1]] = the indices of of the edges incident to vertex n
-	 *
 	 * As the search continues, prevedge[n] will be the previous edge on the shortest
 	 * path found so far to edge n. The visitedhash will of course contain entries
 	 * for edges that have been visited, cost[n] will contain the length of the shortest
@@ -1325,61 +1384,46 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B
 
 	/* regular dijkstra shortest path, but over edges instead of vertices */
 	heap = BLI_heap_new();
-	BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(BM_elem_index_get(source)));
-	cost[BM_elem_index_get(source)] = 0.0f;
-	EDBM_index_arrays_init(em, 1, 1, 0);
-	targetnum = BM_elem_index_get(target);
+	BLI_heap_insert(heap, 0.0f, e_src);
+	cost[BM_elem_index_get(e_src)] = 0.0f;
 
-	while (!BLI_heap_empty(heap)) {
-		mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap));
-		e = EDBM_edge_at_index(em, mednum);
+	e = NULL;
 
-		if (mednum == targetnum)
-			break;
-
-		if (BLI_smallhash_haskey(&visithash, (uintptr_t)e))
-			continue;
+	while (!BLI_heap_is_empty(heap)) {
+		e = BLI_heap_popmin(heap);
 
-		BLI_smallhash_insert(&visithash, (uintptr_t)e, NULL);
+		if (e == e_dst)
+			break;
 
-		edgetag_add_adjacent(em, &visithash, heap, mednum, BM_elem_index_get(e->v1), nedges, edges, prevedge, cost);
-		edgetag_add_adjacent(em, &visithash, heap, mednum, BM_elem_index_get(e->v2), nedges, edges, prevedge, cost);
+		if (!BM_elem_flag_test(e, BM_ELEM_TAG)) {
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
+			edgetag_add_adjacent(heap, e, edges_prev, cost);
+		}
 	}
 	
-	if (mednum == targetnum) {
-		short allseams = 1;
+	if (e == e_dst) {
+		short all_set = TRUE;
 
 		/* Check whether the path is already completely tagged.
 		 * if it is, the tags will be cleared instead of set. */
-		mednum = targetnum;
+		e = e_dst;
 		do {
-			e = EDBM_edge_at_index(em, mednum);
-			if (!edgetag_context_check(scene, em, e)) {
-				allseams = 0;
+			if (!edgetag_context_check(scene, bm, e)) {
+				all_set = FALSE;
 				break;
 			}
-			mednum = prevedge[mednum];
-		} while (mednum != BM_elem_index_get(source));
+		} while ((e = edges_prev[BM_elem_index_get(e)]));
 
 		/* Follow path back and source and add or remove tags */
-		mednum = targetnum;
+		e = e_dst;
 		do {
-			e = EDBM_edge_at_index(em, mednum);
-			if (allseams)
-				edgetag_context_set(em, scene, e, 0);
-			else
-				edgetag_context_set(em, scene, e, 1);
-			mednum = prevedge[mednum];
-		} while (mednum != -1);
+			edgetag_context_set(bm, scene, e, !all_set);
+		} while ((e = edges_prev[BM_elem_index_get(e)]));
 	}
 
-	EDBM_index_arrays_free(em);
-	MEM_freeN(nedges);
-	MEM_freeN(edges);
-	MEM_freeN(prevedge);
+	MEM_freeN(edges_prev);
 	MEM_freeN(cost);
 	BLI_heap_free(heap, NULL);
-	BLI_smallhash_release(&visithash);
 
 	return 1;
 }
@@ -1387,21 +1431,15 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B
 /* ******************* mesh shortest path select, uses prev-selected edge ****************** */
 
 /* since you want to create paths with multiple selects, it doesn't have extend option */
-static int mouse_mesh_shortest_path(bContext *C, int mval[2])
+static int mouse_mesh_shortest_path_edge(bContext *C, ViewContext *vc)
 {
-	ViewContext vc;
-	BMEditMesh *em;
-	BMEdge *e;
-	int dist = 50;
-	
-	em_setup_viewcontext(C, &vc);
-	vc.mval[0] = mval[0];
-	vc.mval[1] = mval[1];
-	em = vc.em;
+	BMEditMesh *em = vc->em;
+	BMEdge *e_dst;
+	float dist = 75.0f;
 	
-	e = EDBM_edge_find_nearest(&vc, &dist);
-	if (e) {
-		Mesh *me = vc.obedit->data;
+	e_dst = EDBM_edge_find_nearest(vc, &dist);
+	if (e_dst) {
+		Mesh *me = vc->obedit->data;
 		int path = 0;
 		
 		if (em->bm->selected.last) {
@@ -1410,8 +1448,8 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2])
 			if (ese && ese->htype == BM_EDGE) {
 				BMEdge *e_act;
 				e_act = (BMEdge *)ese->ele;
-				if (e_act != e) {
-					if (edgetag_shortest_path(vc.scene, em, e_act, e)) {
+				if (e_act != e_dst) {
+					if (edgetag_shortest_path(vc->scene, em->bm, e_act, e_dst)) {
 						BM_select_history_remove(em->bm, e_act);
 						path = 1;
 					}
@@ -1419,29 +1457,29 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2])
 			}
 		}
 		if (path == 0) {
-			int act = (edgetag_context_check(vc.scene, em, e) == 0);
-			edgetag_context_set(em, vc.scene, e, act); /* switch the edge option */
+			int act = (edgetag_context_check(vc->scene, em->bm, e_dst) == 0);
+			edgetag_context_set(em->bm, vc->scene, e_dst, act); /* switch the edge option */
 		}
 		
 		EDBM_selectmode_flush(em);
 
 		/* even if this is selected it may not be in the selection list */
-		if (edgetag_context_check(vc.scene, em, e) == 0)
-			BM_select_history_remove(em->bm, e);
+		if (edgetag_context_check(vc->scene, em->bm, e_dst) == 0)
+			BM_select_history_remove(em->bm, e_dst);
 		else
-			BM_select_history_store(em->bm, e);
+			BM_select_history_store(em->bm, e_dst);
 	
 		/* force drawmode for mesh */
 		switch (CTX_data_tool_settings(C)->edge_mode) {
 			
 			case EDGE_MODE_TAG_SEAM:
 				me->drawflag |= ME_DRAWSEAMS;
-				ED_uvedit_live_unwrap(vc.scene, vc.obedit);
+				ED_uvedit_live_unwrap(vc->scene, vc->obedit);
 				break;
 			case EDGE_MODE_TAG_SHARP:
 				me->drawflag |= ME_DRAWSHARP;
 				break;
-			case EDGE_MODE_TAG_CREASE:	
+			case EDGE_MODE_TAG_CREASE:
 				me->drawflag |= ME_DRAWCREASES;
 				break;
 			case EDGE_MODE_TAG_BEVEL:
@@ -1459,17 +1497,229 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2])
 }
 
 
+/* ******************* facetag_shortest_path and helpers ****************** */
+
+
+static float facetag_cut_cost(BMFace *f1, BMFace *f2, BMEdge *e)
+{
+	float f1_cent[3];
+	float f2_cent[3];
+	float e_cent[3];
+
+	BM_face_calc_center_mean(f1, f1_cent);
+	BM_face_calc_center_mean(f2, f2_cent);
+	mid_v3_v3v3(e_cent, e->v1->co, e->v2->co);
+
+	return step_cost_3_v3(f1_cent, e_cent, f2_cent);
+}
+
+static void facetag_add_adjacent(Heap *heap, BMFace *f1, BMFace **faces_prev, float *cost)
+{
+	BMIter liter;
+	BMLoop *l2;
+	BMFace *f2;
+
+	const int f1_index = BM_elem_index_get(f1);
+
+	/* loop over faces of face, but do so by first looping over loops */
+	BM_ITER_ELEM (l2, &liter, f1, BM_LOOPS_OF_FACE) {
+		BMLoop *l_first;
+		BMLoop *l_iter;
+
+		l_iter = l_first = l2;
+		do {
+			f2 = l_iter->f;
+			if (!BM_elem_flag_test(f2, BM_ELEM_TAG)) {
+				/* we know 'f2' is not visited, check it out! */
+				const int f2_index = BM_elem_index_get(f2);
+				const float cost_cut = facetag_cut_cost(f1, f2, l_iter->e);
+				const float cost_new = cost[f1_index] + cost_cut;
+
+				if (cost[f2_index] > cost_new) {
+					cost[f2_index] = cost_new;
+					faces_prev[f2_index] = f1;
+					BLI_heap_insert(heap, cost_new, f2);
+				}
+			}
+		} while ((l_iter = l_iter->radial_next) != l_first);
+	}
+}
+
+static void facetag_context_set(BMesh *bm, Scene *UNUSED(scene), BMFace *f, int val)
+{
+	BM_face_select_set(bm, f, val);
+}
+
+static int facetag_context_check(Scene *UNUSED(scene), BMesh *UNUSED(bm), BMFace *f)
+{
+	return BM_elem_flag_test(f, BM_ELEM_SELECT) ? 1 : 0;
+}
+
+static int facetag_shortest_path(Scene *scene, BMesh *bm, BMFace *f_src, BMFace *f_dst)
+{
+	/* BM_ELEM_TAG flag is used to store visited edges */
+	BMFace *f;
+	BMIter fiter;
+	Heap *heap;
+	float *cost;
+	BMFace **faces_prev;
+	int i, totface;
+
+	/* note, would pass BM_EDGE except we are looping over all faces anyway */
+	// BM_mesh_elem_index_ensure(bm, BM_VERT /* | BM_EDGE */); // NOT NEEDED FOR FACETAG
+
+	BM_ITER_MESH_INDEX (f, &fiter, bm, BM_FACES_OF_MESH, i) {
+		if (BM_elem_flag_test(f, BM_ELEM_HIDDEN) == FALSE) {
+			BM_elem_flag_disable(f, BM_ELEM_TAG);
+		}
+		else {
+			BM_elem_flag_enable(f, BM_ELEM_TAG);
+		}
+
+		BM_elem_index_set(f, i); /* set_inline */
+	}
+	bm->elem_index_dirty &= ~BM_FACE;
+
+	/* alloc */
+	totface = bm->totface;
+	faces_prev = MEM_callocN(sizeof(*faces_prev) * totface, "SeamPathPrevious");
+	cost = MEM_mallocN(sizeof(*cost) * totface, "SeamPathCost");
+
+	fill_vn_fl(cost, totface, 1e20f);
+
+	/*
+	 * Arrays are now filled as follows:
+	 *
+	 * As the search continues, faces_prev[n] will be the previous face on the shortest
+	 * path found so far to face n. The visitedhash will of course contain entries
+	 * for faces that have been visited, cost[n] will contain the length of the shortest
+	 * path to face n found so far, Finally, heap is a priority heap which is built on the
+	 * the same data as the cost array, but inverted: it is a worklist of faces prioritized
+	 * by the shortest path found so far to the face.
+	 */
+
+	/* regular dijkstra shortest path, but over faces instead of vertices */
+	heap = BLI_heap_new();
+	BLI_heap_insert(heap, 0.0f, f_src);
+	cost[BM_elem_index_get(f_src)] = 0.0f;
+
+	f = NULL;
+
+	while (!BLI_heap_is_empty(heap)) {
+		f = BLI_heap_popmin(heap);
+
+		if (f == f_dst)
+			break;
+
+		if (!BM_elem_flag_test(f, BM_ELEM_TAG)) {
+			BM_elem_flag_enable(f, BM_ELEM_TAG);
+			facetag_add_adjacent(heap, f, faces_prev, cost);
+		}
+	}
+
+	if (f == f_dst) {
+		short all_set = TRUE;
+
+		/* Check whether the path is already completely tagged.
+		 * if it is, the tags will be cleared instead of set. */
+		f = f_dst;
+		do {
+			if (!facetag_context_check(scene, bm, f)) {
+				all_set = FALSE;
+				break;
+			}
+		} while ((f = faces_prev[BM_elem_index_get(f)]));
+
+		/* Follow path back and source and add or remove tags */
+		f = f_dst;
+		do {
+			facetag_context_set(bm, scene, f, !all_set);
+		} while ((f = faces_prev[BM_elem_index_get(f)]));
+	}
+
+	MEM_freeN(faces_prev);
+	MEM_freeN(cost);
+	BLI_heap_free(heap, NULL);
+
+	return 1;
+}
+
+static int mouse_mesh_shortest_path_face(bContext *C, ViewContext *vc)
+{
+	BMEditMesh *em = vc->em;
+	BMFace *f_dst;
+	float dist = 75.0f;
+
+	f_dst = EDBM_face_find_nearest(vc, &dist);
+	if (f_dst) {
+		int path = 0;
+		BMFace *f_act = BM_active_face_get(em->bm, FALSE, TRUE);
+
+		if (f_act) {
+			if (f_act != f_dst) {
+				if (facetag_shortest_path(vc->scene, em->bm, f_act, f_dst)) {
+					BM_select_history_remove(em->bm, f_act);
+					path = 1;
+				}
+			}
+		}
+		if (path == 0) {
+			int act = (facetag_context_check(vc->scene, em->bm, f_dst) == 0);
+			facetag_context_set(em->bm, vc->scene, f_dst, act); /* switch the face option */
+		}
+
+		EDBM_selectmode_flush(em);
+
+		/* even if this is selected it may not be in the selection list */
+		if (facetag_context_check(vc->scene, em->bm, f_dst) == 0)
+			BM_select_history_remove(em->bm, f_dst);
+		else
+			BM_select_history_store(em->bm, f_dst);
+
+		BM_active_face_set(em->bm, f_dst);
+
+		EDBM_update_generic(C, em, FALSE);
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+
+/* ******************* operator for edge and face tag ****************** */
+
 static int edbm_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
-	
+	ViewContext vc;
+	BMEditMesh *em;
+
 	view3d_operator_needs_opengl(C);
 
-	if (mouse_mesh_shortest_path(C, event->mval)) {
-		return OPERATOR_FINISHED;
+	em_setup_viewcontext(C, &vc);
+	vc.mval[0] = event->mval[0];
+	vc.mval[1] = event->mval[1];
+	em = vc.em;
+
+	if (em->selectmode & SCE_SELECT_EDGE) {
+		if (mouse_mesh_shortest_path_edge(C, &vc)) {
+			return OPERATOR_FINISHED;
+		}
+		else {
+			return OPERATOR_PASS_THROUGH;
+		}
 	}
-	else {
-		return OPERATOR_PASS_THROUGH;
+	else if (em->selectmode & SCE_SELECT_FACE) {
+		if (mouse_mesh_shortest_path_face(C, &vc)) {
+			return OPERATOR_FINISHED;
+		}
+		else {
+			return OPERATOR_PASS_THROUGH;
+		}
 	}
+
+	return OPERATOR_PASS_THROUGH;
 }
 
 static int edbm_shortest_path_select_poll(bContext *C)
@@ -1477,7 +1727,7 @@ static int edbm_shortest_path_select_poll(bContext *C)
 	if (ED_operator_editmesh_region_view3d(C)) {
 		Object *obedit = CTX_data_edit_object(C);
 		BMEditMesh *em = BMEdit_FromObject(obedit);
-		return (em->selectmode & SCE_SELECT_EDGE) != 0;
+		return (em->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE)) != 0;
 	}
 	return 0;
 }
@@ -1607,7 +1857,7 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
 			vc.obedit->actcol = efa->mat_nr + 1;
 			vc.em->mat_nr = efa->mat_nr;
 
-			WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
+			WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
 
 		}
 
@@ -1699,56 +1949,146 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
 	BMFace *efa;
 	BMIter iter;
 
+	/* first tag-to-select, then select --- this avoids a feedback loop */
+
 	/* have to find out what the selectionmode was previously */
 	if (selectmode_old == SCE_SELECT_VERTEX) {
 		if (selectmode_new == SCE_SELECT_EDGE) {
-			/* select all edges associated with every selected vertex */
-			eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
-			for (; eed; eed = BM_iter_step(&iter)) {
-				if ((BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
-				     BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)))
-				{
+			/* select all edges associated with every selected vert */
+			BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+				BM_elem_flag_set(eed, BM_ELEM_TAG, BM_edge_is_any_vert_flag_test(eed, BM_ELEM_SELECT));
+			}
+
+			BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+				if (BM_elem_flag_test(eed, BM_ELEM_TAG)) {
 					BM_edge_select_set(em->bm, eed, TRUE);
 				}
 			}
-		}		
+		}
 		else if (selectmode_new == SCE_SELECT_FACE) {
-			BMIter liter;
-			BMLoop *l;
-
-			/* select all faces associated with every selected vertex */
-			efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
-			for (; efa; efa = BM_iter_step(&iter)) {
-				l = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
-				for (; l; l = BM_iter_step(&liter)) {
-					if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) {
-						BM_face_select_set(em->bm, efa, TRUE);
-						break;
-					}
+			/* select all faces associated with every selected vert */
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				BM_elem_flag_set(efa, BM_ELEM_TAG, BM_face_is_any_vert_flag_test(efa, BM_ELEM_SELECT));
+			}
+
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+					BM_face_select_set(em->bm, efa, TRUE);
 				}
 			}
 		}
 	}
 	else if (selectmode_old == SCE_SELECT_EDGE) {
 		if (selectmode_new == SCE_SELECT_FACE) {
-			BMIter liter;
-			BMLoop *l;
-
-			/* select all faces associated with every selected vertex */
-			efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
-			for (; efa; efa = BM_iter_step(&iter)) {
-				l = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
-				for (; l; l = BM_iter_step(&liter)) {
-					if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) {
-						BM_face_select_set(em->bm, efa, TRUE);
-						break;
-					}
+			/* select all faces associated with every selected edge */
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				BM_elem_flag_set(efa, BM_ELEM_TAG, BM_face_is_any_edge_flag_test(efa, BM_ELEM_SELECT));
+			}
+
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+					BM_face_select_set(em->bm, efa, TRUE);
 				}
 			}
 		}
 	}
 }
 
+/* user facing function, does notification and undo push */
+int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
+                           const int action, const int use_extend, const int use_expand)
+{
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = NULL;
+	int ret = FALSE;
+
+	if (obedit && obedit->type == OB_MESH) {
+		em = BMEdit_FromObject(obedit);
+	}
+
+	if (em == NULL) {
+		return ret;
+	}
+
+	switch (action) {
+		case -1:
+			/* already set */
+			break;
+		case 0:  /* disable */
+			/* check we have something to do */
+			if ((em->selectmode & selectmode_new) == 0) {
+				return FALSE;
+			}
+			em->selectmode &= ~selectmode_new;
+			break;
+		case 1:  /* enable */
+			/* check we have something to do */
+			if ((em->selectmode & selectmode_new) != 0) {
+				return FALSE;
+			}
+			em->selectmode |= selectmode_new;
+			break;
+		case 2:  /* toggle */
+			/* can't disable this flag if its the only one set */
+			if (em->selectmode == selectmode_new) {
+				return FALSE;
+			}
+			em->selectmode ^= selectmode_new;
+			break;
+		default:
+			BLI_assert(0);
+	}
+
+	switch (selectmode_new) {
+		case SCE_SELECT_VERTEX:
+			if (use_extend == 0 || em->selectmode == 0)
+				em->selectmode = SCE_SELECT_VERTEX;
+			ts->selectmode = em->selectmode;
+			EDBM_selectmode_set(em);
+			ret = TRUE;
+			break;
+		case SCE_SELECT_EDGE:
+			if (use_extend == 0 || em->selectmode == 0) {
+				if (use_expand) {
+					const short selmode_max = highest_order_bit_s(ts->selectmode);
+					if (selmode_max == SCE_SELECT_VERTEX) {
+						EDBM_selectmode_convert(em, selmode_max, SCE_SELECT_EDGE);
+					}
+				}
+				em->selectmode = SCE_SELECT_EDGE;
+			}
+			ts->selectmode = em->selectmode;
+			EDBM_selectmode_set(em);
+			ret = TRUE;
+			break;
+		case SCE_SELECT_FACE:
+			if (use_extend == 0 || em->selectmode == 0) {
+				if (use_expand) {
+					const short selmode_max = highest_order_bit_s(ts->selectmode);
+					if (ELEM(selmode_max, SCE_SELECT_VERTEX, SCE_SELECT_EDGE)) {
+						EDBM_selectmode_convert(em, selmode_max, SCE_SELECT_FACE);
+					}
+				}
+
+				em->selectmode = SCE_SELECT_FACE;
+			}
+			ts->selectmode = em->selectmode;
+			EDBM_selectmode_set(em);
+			ret = TRUE;
+			break;
+		default:
+			BLI_assert(0);
+			break;
+	}
+
+	if (ret == TRUE) {
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+		WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
+	}
+
+	return ret;
+}
 
 void EDBM_deselect_by_material(BMEditMesh *em, const short index, const short select)
 {
@@ -1896,6 +2236,8 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *
 			return OPERATOR_CANCELLED;
 
 		if (limit) {
+			/* grr, shouldn't need to alloc BMO flags here */
+			BM_mesh_elem_toolflags_ensure(bm);
 			/* hflag no-seam --> bmo-tag */
 			BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 				/* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */
@@ -1988,6 +2330,8 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
 		}
 
 		if (limit) {
+			/* grr, shouldn't need to alloc BMO flags here */
+			BM_mesh_elem_toolflags_ensure(bm);
 			BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 				/* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */
 				BMO_elem_flag_set(bm, e, BM_ELEM_SELECT, !BM_elem_flag_test(e, BM_ELEM_SEAM));
@@ -2008,6 +2352,10 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
 			}
 		}
 		BMW_end(&walker);
+
+		if (limit) {
+			BM_mesh_elem_toolflags_clear(bm);
+		}
 	}
 	else {
 		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -2153,6 +2501,9 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h
 			break;
 	}
 
+	/* grr, shouldn't need to alloc BMO flags here */
+	BM_mesh_elem_toolflags_ensure(bm);
+
 	/* Walker restrictions uses BMO flags, not header flags,
 	 * so transfer BM_ELEM_SELECT from HFlags onto a BMO flag layer. */
 	BMO_push(bm, NULL);
@@ -2169,11 +2520,19 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h
 	         BMW_FLAG_NOP, /* don't use BMW_FLAG_TEST_HIDDEN here since we want to desel all */
 	         BMW_NIL_LAY);
 
+	/* use tag to avoid touching the same verts twice */
+	BM_ITER_MESH (ele, &iter, bm, itertype) {
+		BM_elem_flag_disable(ele, BM_ELEM_TAG);
+	}
+
 	BLI_assert(walker.order == BMW_BREADTH_FIRST);
 	for (ele = BMW_begin(&walker, h_act); ele != NULL; ele = BMW_step(&walker)) {
-		/* Deselect elements that aren't at "nth" depth from active */
-		if ((offset + BMW_current_depth(&walker)) % nth) {
-			BM_elem_select_set(bm, ele, FALSE);
+		if (!BM_elem_flag_test(ele, BM_ELEM_TAG)) {
+			/* Deselect elements that aren't at "nth" depth from active */
+			if ((offset + BMW_current_depth(&walker)) % nth) {
+				BM_elem_select_set(bm, ele, FALSE);
+			}
+			BM_elem_flag_enable(ele, BM_ELEM_TAG);
 		}
 	}
 	BMW_end(&walker);
@@ -2285,9 +2644,9 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op)
 void MESH_OT_select_nth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Select Nth";
+	ot->name = "Checker Deselect";
 	ot->idname = "MESH_OT_select_nth";
-	ot->description = "Select every Nth element starting from a selected vertex, edge or face";
+	ot->description = "Deselect every Nth element starting from a selected vertex, edge or face";
 
 	/* api callbacks */
 	ot->exec = edbm_select_nth_exec;
@@ -2296,8 +2655,8 @@ void MESH_OT_select_nth(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
-	RNA_def_int(ot->srna, "offset", 0, 0, 100, "Offset", "", 0, INT_MAX);
+	RNA_def_int(ot->srna, "nth", 2, 2, INT_MAX, "Nth Selection", "", 2, 100);
+	RNA_def_int(ot->srna, "offset", 0, 0, INT_MAX, "Offset", "", 0, 100);
 }
 
 void em_setup_viewcontext(bContext *C, ViewContext *vc)
@@ -2468,7 +2827,7 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
 	 */
 	
 	if (em->selectmode == SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode");
+		BKE_report(op->reports, RPT_ERROR, "Does not work in face selection mode");
 		return OPERATOR_CANCELLED;
 	}
 	
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index eaf0c14..4fbe9c2 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -34,6 +34,8 @@
 #include "BLI_array.h"
 #include "BLI_math.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_report.h"
 #include "BKE_tessmesh.h"
@@ -113,11 +115,11 @@ static int vtx_slide_init(bContext *C, wmOperator *op)
 	/* Custom data */
 	VertexSlideOp *vso;
 
-	const char *header_str = "Vertex Slide: Hover over an edge and left-click to select slide edge. "
-	                         "Left-Shift: Midpoint Snap, Left-Alt: Snap, Left-Ctrl: Snap&Merge";
+	const char *header_str = TIP_("Vertex Slide: Hover over an edge and left-click to select slide edge. "
+	                              "Left-Shift: Midpoint Snap, Left-Alt: Snap, Left-Ctrl: Snap & Merge");
 
 	if (!obedit) {
-		BKE_report(op->reports, RPT_ERROR, "Vertex Slide Error: Not object in context");
+		BKE_report(op->reports, RPT_ERROR, "Vertex slide error: no object in context");
 		return FALSE;
 	}
 
@@ -126,7 +128,7 @@ static int vtx_slide_init(bContext *C, wmOperator *op)
 
 	/* Is there a starting vertex  ? */
 	if (ese == NULL || (ese->htype != BM_VERT && ese->htype != BM_EDGE)) {
-		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide Error: Select a (single) vertex");
+		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex slide error: select a (single) vertex");
 		return FALSE;
 	}
 
@@ -177,7 +179,7 @@ static int vtx_slide_init(bContext *C, wmOperator *op)
 
 	/* Init frame */
 	if (!vtx_slide_set_frame(vso)) {
-		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide: Can't find starting vertex!");
+		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex slide error: cannot find starting vertex!");
 		vtx_slide_exit(C, op);
 		return FALSE;
 	}
@@ -409,7 +411,8 @@ static void vtx_slide_find_edge(VertexSlideOp *vso, wmEvent *event)
 	/* Nearest edge */
 	BMEdge *nst_edge = NULL;
 
-	const float mval_float[] = { (float)event->mval[0], (float)event->mval[1]};
+	const float mval_float[2] = {(float)event->mval[0],
+	                             (float)event->mval[1]};
 
 	/* Set mouse coords */
 	copy_v2_v2_int(vso->view_context->mval, event->mval);
@@ -692,7 +695,7 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
 	BMOperator bmop;
 	BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
 
-	float distance_t = 0.0f;
+	float factor = 0.0f;
 
 	/* Invoked modally? */
 	if (op->type->modal == edbm_vertex_slide_modal && op->customdata) {
@@ -708,17 +711,17 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
 			BM_select_history_store(em->bm, vso->start_vtx);
 			ese = (BMEditSelection *)em->bm->selected.last;
 		}
-		distance_t = vso->distance;
-		RNA_float_set(op->ptr, "distance_t", distance_t);
+		factor = vso->distance;
+		RNA_float_set(op->ptr, "factor", factor);
 	}
 	else {
 		/* Get Properties */
-		distance_t = RNA_float_get(op->ptr, "distance_t");
+		factor = RNA_float_get(op->ptr, "factor");
 	}
 
 	/* Is there a starting vertex  ? */
 	if ((ese == NULL) || (ese->htype != BM_VERT && ese->htype != BM_EDGE)) {
-		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide Error: Select a (single) vertex");
+		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex slide error: select a (single) vertex");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -726,8 +729,8 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
 
 	/* Prepare operator */
 	if (!EDBM_op_init(em, &bmop, op,
-	                  "slide_vert vert=%e edge=%hev distance_t=%f",
-	                  start_vert, BM_ELEM_SELECT, distance_t))
+	                  "slide_vert vert=%e edges=%he factor=%f",
+	                  start_vert, BM_ELEM_SELECT, factor))
 	{
 		return OPERATOR_CANCELLED;
 	}
@@ -735,10 +738,10 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
 	BMO_op_exec(bm, &bmop);
 
 	/* Deselect the input edges */
-	BMO_slot_buffer_hflag_disable(bm, &bmop, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
 
 	/* Select the output vert */
-	BMO_slot_buffer_hflag_enable(bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
 
 	/* Flush the select buffers */
 	EDBM_selectmode_flush(em);
@@ -784,7 +787,7 @@ void MESH_OT_vert_slide(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* Properties for vertex slide */
-	prop = RNA_def_float(ot->srna, "distance_t", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "Distance", -5.0f, 5.0f);
+	prop = RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "Distance", -5.0f, 5.0f);
 	RNA_def_property_ui_range(prop, -5.0f, 5.0f, 0.1, 4);
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 891e148..ad10771 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -41,7 +41,9 @@
 #include "RNA_define.h"
 #include "RNA_access.h"
 
+#include "BLI_array.h"
 #include "BLI_blenlib.h"
+#include "BLI_noise.h"
 #include "BLI_math.h"
 #include "BLI_rand.h"
 
@@ -49,6 +51,7 @@
 #include "BKE_context.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_depsgraph.h"
+#include "BKE_mesh.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_texture.h"
@@ -69,9 +72,12 @@
 #include "RE_render_ext.h"
 
 #include "UI_interface.h"
+#include "UI_resources.h"
 
 #include "mesh_intern.h"
 
+#define MVAL_PIXEL_MARGIN  5.0f
+
 /* allow accumulated normals to form a new direction but don't
  * accept direct opposite directions else they will cancel each other out */
 static void add_normal_aligned(float nor[3], const float add[3])
@@ -103,7 +109,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
 	                   smooth, fractal, along_normal,
 	                   cuts,
 	                   SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),
-	                   RNA_boolean_get(op->ptr, "quadtri"), TRUE,
+	                   RNA_boolean_get(op->ptr, "quadtri"), TRUE, FALSE,
 	                   RNA_int_get(op->ptr, "seed"));
 
 	EDBM_update_generic(C, em, TRUE);
@@ -153,6 +159,51 @@ void MESH_OT_subdivide(wmOperatorType *ot)
 }
 
 
+static int edbm_unsubdivide_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+
+	int iterations = RNA_int_get(op->ptr, "iterations");
+
+	EDBM_op_init(em, &bmop, op,
+	             "unsubdivide verts=%hv iterations=%i", BM_ELEM_SELECT, iterations);
+
+	BMO_op_exec(em->bm, &bmop);
+
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return 0;
+	}
+
+	if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
+		EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);  /* need to flush vert->face first */
+	}
+	EDBM_selectmode_flush(em);
+
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_unsubdivide(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Un-Subdivide";
+	ot->description = "UnSubdivide selected edges & faces";
+	ot->idname = "MESH_OT_unsubdivide";
+
+	/* api callbacks */
+	ot->exec = edbm_unsubdivide_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* props */
+	RNA_def_int(ot->srna, "iterations", 2, 1, INT_MAX, "Iterations", "Number of times to unsubdivide", 1, 100);
+}
+
 void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
 {
 	Object *obedit = em->ob;
@@ -192,7 +243,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
 
 	BMO_op_exec(em->bm, &bmop);
 	
-	BMO_ITER (f, &siter, em->bm, &bmop, "faceout", BM_FACE) {
+	BMO_ITER (f, &siter, bmop.slots_out, "faces.out", BM_FACE) {
 		BM_face_select_set(em->bm, f, TRUE);
 
 		/* set face vertex normals to face normal */
@@ -205,7 +256,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
 		return 0;
 	}
 
-	return 's'; // s is shrink/fatten
+	return 's';  /* s is shrink/fatten */
 }
 
 /* extrudes individual edges */
@@ -219,13 +270,13 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
 	BMO_op_exec(em->bm, &bmop);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return 0;
 	}
 
-	return 'n'; // n is normal grab
+	return 'n';  /* n is normal grab */
 }
 
 /* extrudes individual vertices */
@@ -236,16 +287,16 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char
 	EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
 
 	/* deselect original verts */
-	BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
 
 	BMO_op_exec(em->bm, &bmop);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return 0;
 	}
 
-	return 'g'; // g is grab
+	return 'g';  /* g is grab */
 }
 
 static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
@@ -258,9 +309,12 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
 	BMFace *f;
 	ModifierData *md;
 	BMElem *ele;
+	BMOpSlot *slot_edges_exclude;
 	
 	BMO_op_init(bm, &extop, BMO_FLAG_DEFAULTS, "extrude_face_region");
-	BMO_slot_buffer_from_enabled_hflag(bm, &extop, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
+	BMO_slot_buffer_from_enabled_hflag(bm, &extop, extop.slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE, hflag);
+
+	slot_edges_exclude = BMO_slot_get(extop.slots_in, "edges_exclude");
 
 	/* If a mirror modifier with clipping is on, we need to adjust some 
 	 * of the cases above to handle edges on the line of symmetry.
@@ -300,21 +354,21 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
 							if ((fabsf(co1[0]) < mmd->tolerance) &&
 							    (fabsf(co2[0]) < mmd->tolerance))
 							{
-								BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+								BMO_slot_map_empty_insert(&extop, slot_edges_exclude, edge);
 							}
 						}
 						if (mmd->flag & MOD_MIR_AXIS_Y) {
 							if ((fabsf(co1[1]) < mmd->tolerance) &&
 							    (fabsf(co2[1]) < mmd->tolerance))
 							{
-								BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+								BMO_slot_map_empty_insert(&extop, slot_edges_exclude, edge);
 							}
 						}
 						if (mmd->flag & MOD_MIR_AXIS_Z) {
 							if ((fabsf(co1[2]) < mmd->tolerance) &&
 							    (fabsf(co2[2]) < mmd->tolerance))
 							{
-								BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+								BMO_slot_map_empty_insert(&extop, slot_edges_exclude, edge);
 							}
 						}
 					}
@@ -329,7 +383,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
 
 	zero_v3(nor);
 	
-	BMO_ITER (ele, &siter, bm, &extop, "geomout", BM_ALL) {
+	BMO_ITER (ele, &siter, extop.slots_out, "geom.out", BM_ALL) {
 		BM_elem_select_set(bm, ele, TRUE);
 
 		if (ele->head.htype == BM_FACE) {
@@ -399,7 +453,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
 
 	for (a = 0; a < steps; a++) {
 		edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
-		//BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
+		//BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "extrude_face_region geom=%hef", BM_ELEM_SELECT);
 		BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
 		             "translate vec=%v verts=%hv",
 		             (float *)dvec, BM_ELEM_SELECT);
@@ -429,8 +483,8 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
-	RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, FLT_MAX);
-	RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, INT_MAX);
+	RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, FLT_MAX, "Offset", "", 0.0f, 100.0f);
+	RNA_def_int(ot->srna, "steps", 10, 0, INT_MAX, "Steps", "", 0, 180);
 }
 
 /* generic extern called extruder */
@@ -837,7 +891,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
 		}
 		
 		if (rot_src) {
-			EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3",
+			EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v matrix=%m3",
 			              BM_ELEM_SELECT, cent, mat);
 
 			/* also project the source, for retopo workflow */
@@ -846,7 +900,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
 		}
 
 		edbm_extrude_edge(vc.obedit, vc.em, BM_ELEM_SELECT, nor);
-		EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3",
+		EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v matrix=%m3",
 		              BM_ELEM_SELECT, cent, mat);
 		EDBM_op_callf(vc.em, op, "translate verts=%hv vec=%v",
 		              BM_ELEM_SELECT, min);
@@ -865,7 +919,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
 		EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min);
 		BMO_op_exec(vc.em->bm, &bmop);
 
-		BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
+		BMO_ITER (v1, &oiter, bmop.slots_out, "vert.out", BM_VERT) {
 			BM_vert_select_set(vc.em->bm, v1, TRUE);
 		}
 
@@ -1060,8 +1114,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
 	}
 	
 	BMO_op_exec(em->bm, &bmop);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -1211,14 +1265,17 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	BMO_op_exec(bm, &bmop);
-	len = BMO_slot_get(&bmop, "edgeout")->len;
+	len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
-	
-	EDBM_update_generic(C, em, TRUE);
+	else {
+		EDBM_selectmode_flush(em);  /* so newly created edges get the selection state from the vertex */
 
-	return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+		EDBM_update_generic(C, em, TRUE);
+
+		return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+	}
 }
 
 void MESH_OT_vert_connect(wmOperatorType *ot)
@@ -1248,7 +1305,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	BMO_op_exec(bm, &bmop);
-	len = BMO_slot_get(&bmop, "edgeout")->len;
+	len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
@@ -1286,7 +1343,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
 	BMO_op_exec(em->bm, &bmop);
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -1352,8 +1409,8 @@ void MESH_OT_flip_normals(wmOperatorType *ot)
 }
 
 static const EnumPropertyItem direction_items[] = {
-	{DIRECTION_CW, "CW", 0, "Clockwise", ""},
-	{DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""},
+	{FALSE, "CW", 0, "Clockwise", ""},
+	{TRUE, "CCW", 0, "Counter Clockwise", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -1365,7 +1422,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
 	BMOperator bmop;
 	BMEdge *eed;
 	BMIter iter;
-	const int do_ccw = RNA_enum_get(op->ptr, "direction") == 1;
+	const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
 	int tot = 0;
 
 	if (em->bm->totedgesel == 0) {
@@ -1395,17 +1452,17 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
 		BKE_report(op->reports, RPT_ERROR, "Could not find any selected edges that can be rotated");
 		return OPERATOR_CANCELLED;
 	}
-	
-	EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
+
+	EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he use_ccw=%b", BM_ELEM_TAG, use_ccw);
 
 	/* avoids leaving old verts selected which can be a problem running multiple times,
 	 * since this means the edges become selected around the face which then attempt to rotate */
-	BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
 
 	BMO_op_exec(em->bm, &bmop);
 	/* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
-	BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
 	EDBM_selectmode_flush(em);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -1432,7 +1489,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around");
+	RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
 }
 
 
@@ -1500,7 +1557,7 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
 	
 	/* doflip has to do with bmesh_rationalize_normals, it's an internal
 	 * thing */
-	if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
+	if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, TRUE))
 		return OPERATOR_CANCELLED;
 
 	if (RNA_boolean_get(op->ptr, "inside"))
@@ -1537,7 +1594,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
 	ModifierData *md;
 	int mirrx = FALSE, mirry = FALSE, mirrz = FALSE;
 	int i, repeat;
-	float clipdist = 0.0f;
+	float clip_dist = 0.0f;
 
 	int xaxis = RNA_boolean_get(op->ptr, "xaxis");
 	int yaxis = RNA_boolean_get(op->ptr, "yaxis");
@@ -1563,7 +1620,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
 				if (mmd->flag & MOD_MIR_AXIS_Z)
 					mirrz = TRUE;
 
-				clipdist = mmd->tolerance;
+				clip_dist = mmd->tolerance;
 			}
 		}
 	}
@@ -1574,9 +1631,9 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
 	
 	for (i = 0; i < repeat; i++) {
 		if (!EDBM_op_callf(em, op,
-		                   "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f "
+		                   "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clip_dist=%f "
 		                   "use_axis_x=%b use_axis_y=%b use_axis_z=%b",
-		                   BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist, xaxis, yaxis, zaxis))
+		                   BM_ELEM_SELECT, mirrx, mirry, mirrz, clip_dist, xaxis, yaxis, zaxis))
 		{
 			return OPERATOR_CANCELLED;
 		}
@@ -1607,12 +1664,94 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
+	RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Number of times to smooth the mesh", "", 1, 100);
 	RNA_def_boolean(ot->srna, "xaxis", 1, "X-Axis", "Smooth along the X axis");
 	RNA_def_boolean(ot->srna, "yaxis", 1, "Y-Axis", "Smooth along the Y axis");
 	RNA_def_boolean(ot->srna, "zaxis", 1, "Z-Axis", "Smooth along the Z axis");
 }
 
+static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int usex = TRUE, usey = TRUE, usez = TRUE, preserve_volume = TRUE;
+	int i, repeat;
+	float lambda;
+	float lambda_border;
+	BMIter fiter;
+	BMFace *f;
+
+	/* Check if select faces are triangles	*/
+	BM_ITER_MESH (f, &fiter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+			if (f->len > 4) {
+				BKE_report(op->reports, RPT_WARNING, "Selected faces must be triangles or quads");
+				return OPERATOR_CANCELLED;
+			}	
+		}
+	}
+
+	/* mirror before smooth */
+	if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
+		EDBM_verts_mirror_cache_begin(em, TRUE);
+	}
+
+	repeat = RNA_int_get(op->ptr, "repeat");
+	lambda = RNA_float_get(op->ptr, "lambda");
+	lambda_border = RNA_float_get(op->ptr, "lambda_border");
+	usex = RNA_boolean_get(op->ptr, "use_x");
+	usey = RNA_boolean_get(op->ptr, "use_y");
+	usez = RNA_boolean_get(op->ptr, "use_z");
+	preserve_volume = RNA_boolean_get(op->ptr, "preserve_volume");
+	if (!repeat)
+		repeat = 1;
+	
+	for (i = 0; i < repeat; i++) {
+		if (!EDBM_op_callf(em, op,
+		                   "smooth_laplacian_vert verts=%hv lambda=%f lambda_border=%f use_x=%b use_y=%b use_z=%b preserve_volume=%b",
+		                   BM_ELEM_SELECT, lambda, lambda_border, usex, usey, usez, preserve_volume))
+		{
+			return OPERATOR_CANCELLED;
+		}
+	}
+
+	/* apply mirror */
+	if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
+		EDBM_verts_mirror_apply(em, BM_ELEM_SELECT, 0);
+		EDBM_verts_mirror_cache_end(em);
+	}
+
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Laplacian Smooth Vertex";
+	ot->description = "Laplacian smooth of selected vertices";
+	ot->idname = "MESH_OT_vertices_smooth_laplacian";
+	
+	/* api callbacks */
+	ot->exec = edbm_do_smooth_laplacian_vertex_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	RNA_def_int(ot->srna, "repeat", 1, 1, 200,
+	            "Number of iterations to smooth the mesh", "", 1, 200);
+	RNA_def_float(ot->srna, "lambda", 0.00005f, 0.0000001f, 1000.0f,
+	              "Lambda factor", "", 0.0000001f, 1000.0f);
+	RNA_def_float(ot->srna, "lambda_border", 0.00005f, 0.0000001f, 1000.0f,
+	              "Lambda factor in border", "", 0.0000001f, 1000.0f);
+	RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along	X axis");
+	RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along	Y axis");
+	RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along	Z axis");
+	RNA_def_boolean(ot->srna, "preserve_volume", 1, "Preserve Volume", "Apply volume preservation after smooth");
+}
+
 /********************** Smooth/Solid Operators *************************/
 
 static void mesh_set_smooth_faces(BMEditMesh *em, short smooth)
@@ -1693,10 +1832,10 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
 	BMOperator bmop;
 
 	/* get the direction from RNA */
-	int dir = RNA_enum_get(op->ptr, "direction");
+	const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+	EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -1742,10 +1881,10 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
 	BMOperator bmop;
 
 	/* get the direction from RNA */
-	int dir = RNA_enum_get(op->ptr, "direction");
+	const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+	EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -1801,7 +1940,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around");
+	RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
 }
 
 //void MESH_OT_uvs_mirror(wmOperatorType *ot)
@@ -1838,7 +1977,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CCW, "Direction", "Direction to rotate edge around");
+	RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
 }
 
 void MESH_OT_colors_reverse(wmOperatorType *ot)
@@ -1879,7 +2018,7 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
 		return OPERATOR_CANCELLED;
 	
 	if (uvmerge) {
-		if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv snapv=%e", BM_ELEM_SELECT, mergevert))
+		if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv vert_snap=%e", BM_ELEM_SELECT, mergevert))
 			return OPERATOR_CANCELLED;
 	}
 
@@ -2039,7 +2178,7 @@ void MESH_OT_merge(wmOperatorType *ot)
 	/* properties */
 	ot->prop = RNA_def_enum(ot->srna, "type", merge_type_items, 3, "Type", "Merge method to use");
 	RNA_def_enum_funcs(ot->prop, merge_type_itemf);
-	RNA_def_boolean(ot->srna, "uvs", 1, "UVs", "Move UVs according to merge");
+	RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge");
 }
 
 
@@ -2048,7 +2187,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BMEdit_FromObject(obedit);
 	BMOperator bmop;
-	const float mergedist = RNA_float_get(op->ptr, "mergedist");
+	const float threshold = RNA_float_get(op->ptr, "threshold");
 	int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
 	int totvert_orig = em->bm->totvert;
 	int count;
@@ -2056,7 +2195,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
 	if (use_unselected) {
 		EDBM_op_init(em, &bmop, op,
 		             "automerge verts=%hv dist=%f",
-		             BM_ELEM_SELECT, mergedist);
+		             BM_ELEM_SELECT, threshold);
 		BMO_op_exec(em->bm, &bmop);
 
 		if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -2066,10 +2205,10 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
 	else {
 		EDBM_op_init(em, &bmop, op,
 		             "find_doubles verts=%hv dist=%f",
-		             BM_ELEM_SELECT, mergedist);
+		             BM_ELEM_SELECT, threshold);
 		BMO_op_exec(em->bm, &bmop);
 
-		if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
+		if (!EDBM_op_callf(em, op, "weld_verts targetmap=%S", &bmop, "targetmap.out")) {
 			BMO_op_finish(em->bm, &bmop);
 			return OPERATOR_CANCELLED;
 		}
@@ -2080,7 +2219,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
 	}
 	
 	count = totvert_orig - em->bm->totvert;
-	BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count == 1) ? "ex" : "ices");
+	BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count);
 
 	EDBM_update_generic(C, em, TRUE);
 
@@ -2101,8 +2240,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	RNA_def_float(ot->srna, "mergedist", 0.0001f, 0.000001f, 50.0f, 
-	              "Merge Distance",
+	RNA_def_float(ot->srna, "threshold", 0.0001f, 0.000001f, 50.0f,  "Merge Distance",
 	              "Minimum distance between elements to merge", 0.00001, 10.0);
 	RNA_def_boolean(ot->srna, "use_unselected", 0, "Unselected", "Merge selected to other unselected vertices");
 }
@@ -2165,12 +2303,14 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
 	}
 
 	if (svert == NULL || evert == NULL) {
-		BKE_report(op->reports, RPT_WARNING, "Path Selection requires that two vertices be selected");
+		BKE_report(op->reports, RPT_WARNING, "Path selection requires two vertices to be selected");
 		return OPERATOR_CANCELLED;
 	}
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-	EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", svert, evert, type);
+	EDBM_op_init(em, &bmop, op,
+	             "shortest_path vert_start=%e vert_end=%e type=%i",
+	             svert, evert, type);
 
 	/* execute the operator */
 	BMO_op_exec(em->bm, &bmop);
@@ -2179,7 +2319,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
 	/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
 
 	/* select the output */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
 
 	/* finish the operator */
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -2304,7 +2444,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
 	totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY);
 	if (totshape == 0 || shape < 0 || shape >= totshape)
 		return OPERATOR_CANCELLED;
-	
+
 	/* get shape key - needed for finding reference shape (for add mode only) */
 	if (key) {
 		kb = BLI_findlink(&key->block, shape);
@@ -2371,6 +2511,22 @@ static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr),  Prop
 	return item;
 }
 
+static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op)
+{
+	uiLayout *layout = op->layout;
+	PointerRNA ptr;
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = obedit->data;
+	PointerRNA ptr_key;
+
+	RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+	RNA_id_pointer_create((ID *)me->key, &ptr_key);
+
+	uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", "", ICON_SHAPEKEY_DATA);
+	uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE);
+	uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE);
+}
+
 void MESH_OT_blend_from_shape(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
@@ -2383,7 +2539,8 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = edbm_blend_from_shape_exec;
-	ot->invoke = WM_operator_props_popup;
+//	ot->invoke = WM_operator_props_popup_call;  /* disable because search popup closes too easily */
+	ot->ui = edbm_blend_from_shape_ui;
 	ot->poll = ED_operator_editmesh;
 
 	/* flags */
@@ -2496,13 +2653,13 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
 	/* deselect only the faces in the region to be solidified (leave wire
 	 * edges and loose verts selected, as there will be no corresponding
 	 * geometry selected below) */
-	BMO_slot_buffer_hflag_disable(bm, &bmop, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
 
 	/* run the solidify operator */
 	BMO_op_exec(bm, &bmop);
 
 	/* select the newly generated faces */
-	BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -2659,21 +2816,21 @@ static float bm_edge_seg_isect(const float sco_a[2], const float sco_b[2],
 				m1 = MAXSLOPE;
 				b1 = x12;
 			}
-			x2max = maxf(x21, x22) + 0.001f; /* prevent missed edges   */
-			x2min = minf(x21, x22) - 0.001f; /* due to round off error */
-			y2max = maxf(y21, y22) + 0.001f;
-			y2min = minf(y21, y22) - 0.001f;
+			x2max = max_ff(x21, x22) + 0.001f; /* prevent missed edges   */
+			x2min = min_ff(x21, x22) - 0.001f; /* due to round off error */
+			y2max = max_ff(y21, y22) + 0.001f;
+			y2min = min_ff(y21, y22) - 0.001f;
 			
 			/* Found an intersect,  calc intersect point */
 			if (m1 == m2) { /* co-incident lines */
 				/* cut at 50% of overlap area */
-				x1max = maxf(x11, x12);
-				x1min = minf(x11, x12);
-				xi = (minf(x2max, x1max) + maxf(x2min, x1min)) / 2.0f;
+				x1max = max_ff(x11, x12);
+				x1min = min_ff(x11, x12);
+				xi = (min_ff(x2max, x1max) + max_ff(x2min, x1min)) / 2.0f;
 				
-				y1max = maxf(y11, y12);
-				y1min = minf(y11, y12);
-				yi = (minf(y2max, y1max) + maxf(y2min, y1min)) / 2.0f;
+				y1max = max_ff(y11, y12);
+				y1min = min_ff(y11, y12);
+				yi = (min_ff(y2max, y1max) + max_ff(y2min, y1min)) / 2.0f;
 			}
 			else if (m2 == MAXSLOPE) {
 				xi = x22;
@@ -2713,7 +2870,7 @@ static float bm_edge_seg_isect(const float sco_a[2], const float sco_b[2],
 				
 				break;
 			}
-		}	
+		}
 		lastdist = dist;
 	}
 	return perc;
@@ -2734,6 +2891,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 	float isect = 0.0f;
 	int len = 0, isected, i;
 	short numcuts = 1, mode = RNA_int_get(op->ptr, "type");
+	BMOpSlot *slot_edge_percents;
 
 	/* allocd vars */
 	float (*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2];
@@ -2788,6 +2946,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 	}
 
 	/* store percentage of edge cut for KNIFE_EXACT here.*/
+	slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents");
 	for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) {
 		int is_cut = FALSE;
 		if (BM_elem_flag_test(be, BM_ELEM_SELECT)) {
@@ -2800,9 +2959,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 
 				if (isect != 0.0f) {
 					if (mode != KNIFE_MULTICUT && mode != KNIFE_MIDPOINT) {
-						BMO_slot_map_float_insert(bm, &bmop,
-						                          "edgepercents",
-						                          be, isect);
+						BMO_slot_map_float_insert(&bmop, slot_edge_percents, be, isect);
 					}
 				}
 			}
@@ -2817,16 +2974,16 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 	MEM_freeN(mouse_path);
 
 
-	BMO_slot_buffer_from_enabled_flag(bm, &bmop, "edges", BM_EDGE, ELE_EDGE_CUT);
+	BMO_slot_buffer_from_enabled_flag(bm, &bmop, bmop.slots_in, "edges", BM_EDGE, ELE_EDGE_CUT);
 
 	if (mode == KNIFE_MIDPOINT) numcuts = 1;
-	BMO_slot_int_set(&bmop, "numcuts", numcuts);
+	BMO_slot_int_set(bmop.slots_in, "cuts", numcuts);
 
-	BMO_slot_int_set(&bmop, "quadcornertype", SUBD_STRAIGHT_CUT);
-	BMO_slot_bool_set(&bmop, "use_singleedge", FALSE);
-	BMO_slot_bool_set(&bmop, "use_gridfill", FALSE);
+	BMO_slot_int_set(bmop.slots_in, "quad_corner_type", SUBD_STRAIGHT_CUT);
+	BMO_slot_bool_set(bmop.slots_in, "use_single_edge", FALSE);
+	BMO_slot_bool_set(bmop.slots_in, "use_grid_fill", FALSE);
 
-	BMO_slot_float_set(&bmop, "radius", 0);
+	BMO_slot_float_set(bmop.slots_in, "radius", 0);
 	
 	BMO_op_exec(bm, &bmop);
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -2872,6 +3029,8 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh
 	BMesh *bm_new;
 
 	bm_new = BM_mesh_create(&bm_mesh_allocsize_default);
+	BM_mesh_elem_toolflags_ensure(bm_new);  /* needed for 'duplicate' bmo */
+
 	CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
 	CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
 	CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
@@ -3078,7 +3237,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
 	}
 	else {
 		if (type == 0) {
-			BKE_report(op->reports, RPT_ERROR, "Selecton not supported in object mode");
+			BKE_report(op->reports, RPT_ERROR, "Selection not supported in object mode");
 			return OPERATOR_CANCELLED;
 		}
 
@@ -3167,7 +3326,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
 	BMO_op_exec(em->bm, &bmop);
 	
 	/* select new geometry */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
 	
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -3359,7 +3518,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BMEdit_FromObject(obedit);
 	BMesh *bm = em->bm;
-	float angle_limit = RNA_float_get(op->ptr, "angle_limit");
+	const float angle_limit = RNA_float_get(op->ptr, "angle_limit");
+	const int use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries");
 
 	char dissolve_flag;
 
@@ -3395,8 +3555,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
 	}
 
 	if (!EDBM_op_callf(em, op,
-	                   "dissolve_limit edges=%he verts=%hv angle_limit=%f",
-	                   dissolve_flag, dissolve_flag, angle_limit))
+	                   "dissolve_limit edges=%he verts=%hv angle_limit=%f use_dissolve_boundaries=%b",
+	                   dissolve_flag, dissolve_flag, angle_limit, use_dissolve_boundaries))
 	{
 		return OPERATOR_CANCELLED;
 	}
@@ -3423,8 +3583,10 @@ void MESH_OT_dissolve_limited(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	prop = RNA_def_float_rotation(ot->srna, "angle_limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
-	                              "Max Angle", "Angle Limit in Degrees", 0.0f, DEG2RADF(180.0f));
+	                              "Max Angle", "Angle limit", 0.0f, DEG2RADF(180.0f));
 	RNA_def_property_float_default(prop, DEG2RADF(15.0f));
+	RNA_def_boolean(ot->srna, "use_dissolve_boundaries", 0, "All Boundaries",
+	                "Dissolve all vertices inbetween face boundaries");
 }
 
 static int edbm_split_exec(bContext *C, wmOperator *op)
@@ -3436,7 +3598,7 @@ static int edbm_split_exec(bContext *C, wmOperator *op)
 	EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
 	BMO_op_exec(em->bm, &bmop);
 	BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
@@ -3474,14 +3636,14 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
 	float cent[3], axis[3], imat[3][3];
 	float d[3] = {0.0f, 0.0f, 0.0f};
 	int steps, dupli;
-	float degr;
+	float angle;
 
 	RNA_float_get_array(op->ptr, "center", cent);
 	RNA_float_get_array(op->ptr, "axis", axis);
 	steps = RNA_int_get(op->ptr, "steps");
-	degr = RNA_float_get(op->ptr, "degrees");
+	angle = RNA_float_get(op->ptr, "angle");
 	//if (ts->editbutflag & B_CLOCKWISE)
-	degr = -degr;
+	angle = -angle;
 	dupli = RNA_boolean_get(op->ptr, "dupli");
 
 	/* undo object transformation */
@@ -3491,14 +3653,14 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
 	mul_m3_v3(imat, axis);
 
 	if (!EDBM_op_init(em, &spinop, op,
-	                  "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b",
-	                  BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli))
+	                  "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
+	                  BM_ELEM_SELECT, cent, axis, d, steps, angle, dupli))
 	{
 		return OPERATOR_CANCELLED;
 	}
 	BMO_op_exec(bm, &spinop);
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-	BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
 	if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
@@ -3523,6 +3685,8 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 
 void MESH_OT_spin(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name = "Spin";
 	ot->description = "Extrude selected vertices in a circle around the cursor in indicated viewport";
@@ -3539,10 +3703,11 @@ void MESH_OT_spin(wmOperatorType *ot)
 	/* props */
 	RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, INT_MAX);
 	RNA_def_boolean(ot->srna, "dupli", 0, "Dupli", "Make Duplicates");
-	RNA_def_float(ot->srna, "degrees", 90.0f, -FLT_MAX, FLT_MAX, "Degrees", "Degrees", -360.0f, 360.0f);
+	prop = RNA_def_float(ot->srna, "angle", DEG2RADF(90.0f), -FLT_MAX, FLT_MAX, "Angle", "Angle", DEG2RADF(-360.0f), DEG2RADF(360.0f));
+	RNA_def_property_subtype(prop, PROP_ANGLE);
 
 	RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
-	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
+	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -FLT_MAX, FLT_MAX, "Axis", "Axis in global view space", -1.0f, 1.0f);
 
 }
 
@@ -3577,15 +3742,11 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
 	v1 = NULL;
 	v2 = NULL;
 	for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); eve; eve = BM_iter_step(&iter)) {
-
 		valence = 0;
-
 		for (eed = BM_iter_new(&eiter, em->bm, BM_EDGES_OF_VERT, eve); eed; eed = BM_iter_step(&eiter)) {
-
 			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
 				valence++;
 			}
-
 		}
 
 		if (valence == 1) {
@@ -3615,14 +3776,14 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
 		negate_v3(dvec);
 
 	if (!EDBM_op_init(em, &spinop, op,
-	                  "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b",
+	                  "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
 	                  BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns, FALSE))
 	{
 		return OPERATOR_CANCELLED;
 	}
 	BMO_op_exec(bm, &spinop);
 	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-	BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
 	if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
@@ -3666,34 +3827,40 @@ void MESH_OT_screw(wmOperatorType *ot)
 
 	RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX,
 	                     "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
-	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f,
-	                     "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
+	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -FLT_MAX, FLT_MAX,
+	                     "Axis", "Axis in global view space", -1.0f, 1.0f);
 }
 
-static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op)
+static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op)
 {
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BMEdit_FromObject(obedit);
 	BMFace *efa;
 	BMIter iter;
-	int numverts = RNA_int_get(op->ptr, "number");
-	int type = RNA_enum_get(op->ptr, "type");
+	const int numverts = RNA_int_get(op->ptr, "number");
+	const int type = RNA_enum_get(op->ptr, "type");
 
 	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 
-		int select = 0;
+		int select;
 
-		if (type == 0 && efa->len < numverts) {
-			select = 1;
-		}
-		else if (type == 1 && efa->len == numverts) {
-			select = 1;
-		}
-		else if (type == 2 && efa->len > numverts) {
-			select = 1;
-		}
-		else if (type == 3 && efa->len != numverts) {
-			select = 1;
+		switch (type) {
+			case 0:
+				select = (efa->len < numverts);
+				break;
+			case 1:
+				select = (efa->len == numverts);
+				break;
+			case 2:
+				select = (efa->len > numverts);
+				break;
+			case 3:
+				select = (efa->len != numverts);
+				break;
+			default:
+				BLI_assert(0);
+				select = FALSE;
+				break;
 		}
 
 		if (select) {
@@ -3707,7 +3874,7 @@ static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
+void MESH_OT_select_face_by_sides(wmOperatorType *ot)
 {
 	static const EnumPropertyItem type_items[] = {
 		{0, "LESS", 0, "Less Than", ""},
@@ -3718,12 +3885,12 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name = "Select by Number of Vertices";
-	ot->description = "Select vertices or faces by vertex count";
-	ot->idname = "MESH_OT_select_by_number_vertices";
+	ot->name = "Select Faces by Sides";
+	ot->description = "Select vertices or faces by the number of polygon sides";
+	ot->idname = "MESH_OT_select_face_by_sides";
 	
 	/* api callbacks */
-	ot->exec = edbm_select_by_number_vertices_exec;
+	ot->exec = edbm_select_face_by_sides_exec;
 	ot->poll = ED_operator_editmesh;
 	
 	/* flags */
@@ -3851,8 +4018,8 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
 	char *pblock[3] = {NULL, NULL, NULL}, *pb;
 	BMElemSort *sblock[3] = {NULL, NULL, NULL}, *sb;
 	int *map[3] = {NULL, NULL, NULL}, *mp;
-	int totelem[3] = {0, 0, 0}, tot;
-	int affected[3] = {0, 0, 0}, aff;
+	int totelem[3] = {0, 0, 0};
+	int affected[3] = {0, 0, 0};
 	int i, j;
 
 	if (!(types && flag && action))
@@ -4227,8 +4394,8 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
 		if (pb && sb && !map[j]) {
 			char *p_blk;
 			BMElemSort *s_blk;
-			tot = totelem[j];
-			aff = affected[j];
+			int tot = totelem[j];
+			int aff = affected[j];
 
 			qsort(sb, aff, sizeof(BMElemSort), bmelemsort_comp);
 
@@ -4277,7 +4444,7 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op)
 
 	if (ELEM(action, SRT_VIEW_ZAXIS, SRT_VIEW_XAXIS)) {
 		if (rv3d == NULL) {
-			BKE_report(op->reports, RPT_ERROR, "View not found, can't sort by view axis");
+			BKE_report(op->reports, RPT_ERROR, "View not found, cannot sort by view axis");
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -4458,13 +4625,18 @@ void MESH_OT_noise(wmOperatorType *ot)
 	RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f);
 }
 
+#define NEW_BEVEL 1
+
 typedef struct {
 	BMEditMesh *em;
 	BMBackup mesh_backup;
+#ifndef NEW_BEVEL
 	float *weights;
 	int li;
+#endif
 	int mcenter[2];
 	float initial_length;
+	float pixel_size;  /* use when mouse input is interpreted as spatial distance */
 	int is_modal;
 	NumInput num_input;
 	float shift_factor; /* The current factor when shift is pressed. Negative when shift not active. */
@@ -4474,13 +4646,25 @@ typedef struct {
 
 static void edbm_bevel_update_header(wmOperator *op, bContext *C)
 {
+#ifdef NEW_BEVEL
+	static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), offset: %s, segments: %d";
+#else
 	static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %s, Use Dist (D): %s: Use Even (E): %s";
+	BevelData *opdata = op->customdata;
+#endif
 
 	char msg[HEADER_LENGTH];
 	ScrArea *sa = CTX_wm_area(C);
-	BevelData *opdata = op->customdata;
 
 	if (sa) {
+#ifdef NEW_BEVEL
+		char offset_str[NUM_STR_REP_LEN];
+		BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
+		BLI_snprintf(msg, HEADER_LENGTH, str,
+		             offset_str,
+		             RNA_int_get(op->ptr, "segments")
+		            );
+#else
 		char factor_str[NUM_STR_REP_LEN];
 		if (hasNumInput(&opdata->num_input))
 			outputNumInput(&opdata->num_input, factor_str);
@@ -4491,11 +4675,13 @@ static void edbm_bevel_update_header(wmOperator *op, bContext *C)
 		             RNA_boolean_get(op->ptr, "use_dist") ? "On" : "Off",
 		             RNA_boolean_get(op->ptr, "use_even") ? "On" : "Off"
 		            );
+#endif
 
 		ED_area_headerprint(sa, msg);
 	}
 }
 
+#ifndef NEW_BEVEL
 static void edbm_bevel_recalc_weights(wmOperator *op)
 {
 	float df, s, ftot;
@@ -4523,15 +4709,20 @@ static void edbm_bevel_recalc_weights(wmOperator *op)
 
 	mul_vn_fl(opdata->weights, recursion, 1.0f / (float)ftot);
 }
+#endif
 
 static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
 {
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BMEdit_FromObject(obedit);
+#ifdef NEW_BEVEL
+	BevelData *opdata;
+#else
 	BMIter iter;
 	BMEdge *eed;
 	BevelData *opdata;
 	int li;
+#endif
 	
 	if (em == NULL) {
 		return 0;
@@ -4539,6 +4730,7 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
 
 	op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator");
 
+#ifndef NEW_BEVEL
 	BM_data_layer_add(em->bm, &em->bm->edata, CD_PROP_FLT);
 	li = CustomData_number_of_layers(&em->bm->edata, CD_PROP_FLT) - 1;
 	
@@ -4548,10 +4740,12 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
 		
 		*dv = d;
 	}
-	
-	opdata->em = em;
+
 	opdata->li = li;
 	opdata->weights = NULL;
+#endif
+	
+	opdata->em = em;
 	opdata->is_modal = is_modal;
 	opdata->shift_factor = -1.0f;
 
@@ -4561,7 +4755,9 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
 	/* avoid the cost of allocating a bm copy */
 	if (is_modal)
 		opdata->mesh_backup = EDBM_redo_state_store(em);
+#ifndef NEW_BEVEL
 	edbm_bevel_recalc_weights(op);
+#endif
 
 	return 1;
 }
@@ -4571,6 +4767,35 @@ static int edbm_bevel_calc(bContext *C, wmOperator *op)
 	BevelData *opdata = op->customdata;
 	BMEditMesh *em = opdata->em;
 	BMOperator bmop;
+#ifdef NEW_BEVEL
+	float offset = RNA_float_get(op->ptr, "offset");
+	int segments = RNA_int_get(op->ptr, "segments");
+
+	/* revert to original mesh */
+	if (opdata->is_modal) {
+		EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE);
+	}
+
+	if (!EDBM_op_init(em, &bmop, op,
+		              "bevel geom=%hev offset=%f segments=%i",
+		              BM_ELEM_SELECT, offset, segments))
+	{
+		return 0;
+	}
+
+	BMO_op_exec(em->bm, &bmop);
+
+	if (offset != 0.0f) {
+		/* not essential, but we may have some loose geometry that
+		 * won't get bevel'd and better not leave it selected */
+		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+		BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+	}
+
+	/* no need to de-select existing geometry */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE))
+		return 0;
+#else
 	int i;
 
 	float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */;
@@ -4598,6 +4823,7 @@ static int edbm_bevel_calc(bContext *C, wmOperator *op)
 		if (!EDBM_op_finish(em, &bmop, op, TRUE))
 			return 0;
 	}
+#endif
 	
 	EDBM_mesh_normals_update(opdata->em);
 	
@@ -4615,10 +4841,12 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
 	if (sa) {
 		ED_area_headerprint(sa, NULL);
 	}
+#ifndef NEW_BEVEL
 	BM_data_layer_free_n(opdata->em->bm, &opdata->em->bm->edata, CD_PROP_FLT, opdata->li);
 
 	if (opdata->weights)
 		MEM_freeN(opdata->weights);
+#endif
 	if (opdata->is_modal) {
 		EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE);
 	}
@@ -4662,8 +4890,10 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op)
 static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	/* TODO make modal keymap (see fly mode) */
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	BevelData *opdata;
 	float mlen[2];
+	float center_3d[3];
 
 	if (!edbm_bevel_init(C, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -4672,7 +4902,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	opdata = op->customdata;
 
 	/* initialize mouse values */
-	if (!calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter)) {
+	if (!calculateTransformCenter(C, V3D_CENTROID, center_3d, opdata->mcenter)) {
 		/* in this case the tool will likely do nothing,
 		 * ideally this will never happen and should be checked for above */
 		opdata->mcenter[0] = opdata->mcenter[1] = 0;
@@ -4680,6 +4910,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	mlen[0] = opdata->mcenter[0] - event->mval[0];
 	mlen[1] = opdata->mcenter[1] - event->mval[1];
 	opdata->initial_length = len_v2(mlen);
+	opdata->pixel_size = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f;
 
 	edbm_bevel_update_header(op, C);
 
@@ -4693,15 +4924,73 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	return OPERATOR_RUNNING_MODAL;
 }
 
+static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event)
+{
+	BevelData *opdata = op->customdata;
+#ifdef NEW_BEVEL
+	int use_dist = TRUE;
+#else
+	int use_dist =  RNA_boolean_get(op->ptr, "use_dist");
+#endif
+	float mdiff[2];
+	float factor;
+
+	mdiff[0] = opdata->mcenter[0] - event->mval[0];
+	mdiff[1] = opdata->mcenter[1] - event->mval[1];
+
+	if (use_dist) {
+		factor = ((len_v2(mdiff) - MVAL_PIXEL_MARGIN) - opdata->initial_length) * opdata->pixel_size;
+	}
+	else {
+		factor = (len_v2(mdiff) - MVAL_PIXEL_MARGIN) / opdata->initial_length;
+		factor = factor - 1.0f;  /* a different kind of buffer where nothing happens */
+	}
+
+	/* Fake shift-transform... */
+	if (event->shift) {
+		if (opdata->shift_factor < 0.0f) {
+#ifdef NEW_BEVEL
+			opdata->shift_factor = RNA_float_get(op->ptr, "factor");
+#else
+			opdata->shift_factor = RNA_float_get(op->ptr, "percent");
+#endif
+		}
+		factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor;
+	}
+	else if (opdata->shift_factor >= 0.0f)
+		opdata->shift_factor = -1.0f;
+
+	/* clamp differently based on distance/factor */
+	if (use_dist) {
+		if (factor < 0.0f) factor = 0.0f;
+	}
+	else {
+		CLAMP(factor, 0.0f, 1.0f);
+	}
+
+	return factor;
+}
+
 static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	BevelData *opdata = op->customdata;
+	int segments = RNA_int_get(op->ptr, "segments");
 
 	if (event->val == KM_PRESS) {
 		/* Try to handle numeric inputs... */
-		float factor;
+#ifdef NEW_BEVEL
 
 		if (handleNumInput(&opdata->num_input, event)) {
+			float value = RNA_float_get(op->ptr, "offset");
+			applyNumInput(&opdata->num_input, &value);
+			RNA_float_set(op->ptr, "offset", value);
+			edbm_bevel_calc(C, op);
+			edbm_bevel_update_header(op, C);
+			return OPERATOR_RUNNING_MODAL;
+		}
+#else
+		if (handleNumInput(&opdata->num_input, event)) {
+			float factor = RNA_float_get(op->ptr, "percent");
 			applyNumInput(&opdata->num_input, &factor);
 			CLAMP(factor, 0.0f, 1.0f);
 			RNA_float_set(op->ptr, "percent", factor);
@@ -4710,6 +4999,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
 			edbm_bevel_update_header(op, C);
 			return OPERATOR_RUNNING_MODAL;
 		}
+#endif
 	}
 
 	switch (event->type) {
@@ -4720,26 +5010,12 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 		case MOUSEMOVE:
 			if (!hasNumInput(&opdata->num_input)) {
-				float factor;
-				float mdiff[2];
-
-				mdiff[0] = opdata->mcenter[0] - event->mval[0];
-				mdiff[1] = opdata->mcenter[1] - event->mval[1];
-
-				factor = opdata->initial_length / -len_v2(mdiff) + 1.0f;
-
-				/* Fake shift-transform... */
-				if (event->shift) {
-					if (opdata->shift_factor < 0.0f)
-						opdata->shift_factor = RNA_float_get(op->ptr, "percent");
-					factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor;
-				}
-				else if (opdata->shift_factor >= 0.0f)
-					opdata->shift_factor = -1.0f;
-
-				CLAMP(factor, 0.0f, 1.0f);
-
+				const float factor = edbm_bevel_mval_factor(op, event);
+#ifdef NEW_BEVEL
+				RNA_float_set(op->ptr, "offset", factor);
+#else
 				RNA_float_set(op->ptr, "percent", factor);
+#endif
 
 				edbm_bevel_calc(C, op);
 				edbm_bevel_update_header(op, C);
@@ -4753,6 +5029,30 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
 			edbm_bevel_exit(C, op);
 			return OPERATOR_FINISHED;
 
+#ifdef NEW_BEVEL
+		case WHEELUPMOUSE:  /* change number of segments */
+		case PAGEUPKEY:
+			if (event->val == KM_RELEASE)
+				break;
+
+			segments++;
+			RNA_int_set(op->ptr, "segments", segments);
+			edbm_bevel_calc(C, op);
+			edbm_bevel_update_header(op, C);
+			break;
+
+		case WHEELDOWNMOUSE:  /* change number of segments */
+		case PAGEDOWNKEY:
+			if (event->val == KM_RELEASE)
+				break;
+
+			segments = max_ii(segments - 1, 1);
+			RNA_int_set(op->ptr, "segments", segments);
+			edbm_bevel_calc(C, op);
+			edbm_bevel_update_header(op, C);
+			break;
+
+#else
 		case EKEY:
 			if (event->val == KM_PRESS) {
 				int use_even =  RNA_boolean_get(op->ptr, "use_even");
@@ -4768,10 +5068,16 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
 				int use_dist =  RNA_boolean_get(op->ptr, "use_dist");
 				RNA_boolean_set(op->ptr, "use_dist", !use_dist);
 
+				{
+					const float factor = edbm_bevel_mval_factor(op, event);
+					RNA_float_set(op->ptr, "percent", factor);
+				}
+
 				edbm_bevel_calc(C, op);
 				edbm_bevel_update_header(op, C);
 			}
 			break;
+#endif
 	}
 
 	return OPERATOR_RUNNING_MODAL;
@@ -4794,12 +5100,18 @@ void MESH_OT_bevel(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
 
+#ifdef NEW_BEVEL
+	RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f);
+	RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8);
+#else
+	/* take note, used as a factor _and_ a distance depending on 'use_dist' */
 	RNA_def_float(ot->srna, "percent", 0.0f, -FLT_MAX, FLT_MAX, "Percentage", "", 0.0f, 1.0f);
 	/* XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users. */
 /*	RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8); */
 
 	RNA_def_boolean(ot->srna, "use_even", FALSE, "Even",     "Calculate evenly spaced bevel");
 	RNA_def_boolean(ot->srna, "use_dist", FALSE, "Distance", "Interpret the percent in blender units");
+#endif
 
 }
 
@@ -4820,7 +5132,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
 	/* when merge is used the edges are joined and remain selected */
 	if (use_merge == FALSE) {
 		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-		BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+		BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 	}
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -4858,8 +5170,9 @@ typedef struct {
 	float old_depth;
 	int mcenter[2];
 	int modify_depth;
-	int is_modal;
 	float initial_length;
+	float pixel_size;  /* use when mouse input is interpreted as spatial distance */
+	int is_modal;
 	int shift;
 	float shift_amount;
 	BMBackup backup;
@@ -4992,11 +5305,11 @@ static int edbm_inset_calc(bContext *C, wmOperator *op)
 	if (use_select_inset) {
 		/* deselect original faces/verts */
 		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-		BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+		BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 	}
 	else {
 		BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE);
-		BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE);
+		BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, FALSE);
 		/* re-select faces so the verts and edges get selected too */
 		BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_SELECT);
 	}
@@ -5025,15 +5338,17 @@ static int edbm_inset_exec(bContext *C, wmOperator *op)
 
 static int edbm_inset_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	InsetData *opdata;
 	float mlen[2];
+	float center_3d[3];
 
 	edbm_inset_init(C, op, TRUE);
 
 	opdata = op->customdata;
 
 	/* initialize mouse values */
-	if (!calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter)) {
+	if (!calculateTransformCenter(C, V3D_CENTROID, center_3d, opdata->mcenter)) {
 		/* in this case the tool will likely do nothing,
 		 * ideally this will never happen and should be checked for above */
 		opdata->mcenter[0] = opdata->mcenter[1] = 0;
@@ -5041,6 +5356,7 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	mlen[0] = opdata->mcenter[0] - event->mval[0];
 	mlen[1] = opdata->mcenter[1] - event->mval[1];
 	opdata->initial_length = len_v2(mlen);
+	opdata->pixel_size = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f;
 
 	edbm_inset_calc(C, op);
 
@@ -5056,11 +5372,12 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 	if (event->val == KM_PRESS) {
 		/* Try to handle numeric inputs... */
-		float amounts[2];
 
 		if (handleNumInput(&opdata->num_input, event)) {
+			float amounts[2] = {RNA_float_get(op->ptr, "thickness"),
+			                    RNA_float_get(op->ptr, "depth")};
 			applyNumInput(&opdata->num_input, amounts);
-			amounts[0] = maxf(amounts[0], 0.0f);
+			amounts[0] = max_ff(amounts[0], 0.0f);
 			RNA_float_set(op->ptr, "thickness", amounts[0]);
 			RNA_float_set(op->ptr, "depth", amounts[1]);
 
@@ -5090,9 +5407,9 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
 				mdiff[1] = opdata->mcenter[1] - event->mval[1];
 
 				if (opdata->modify_depth)
-					amount = opdata->old_depth + opdata->initial_length / len_v2(mdiff) - 1.0f;
+					amount = opdata->old_depth     + ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
 				else
-					amount = opdata->old_thickness - opdata->initial_length / len_v2(mdiff) + 1.0f;
+					amount = opdata->old_thickness - ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
 
 				/* Fake shift-transform... */
 				if (opdata->shift)
@@ -5101,7 +5418,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
 				if (opdata->modify_depth)
 					RNA_float_set(op->ptr, "depth", amount);
 				else {
-					amount = maxf(amount, 0.0f);
+					amount = max_ff(amount, 0.0f);
 					RNA_float_set(op->ptr, "thickness", amount);
 				}
 
@@ -5250,7 +5567,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
 
 	if (use_replace) {
 		BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
-		BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+		BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
 
 		BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
 		             "delete geom=%hvef context=%i",
@@ -5258,7 +5575,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
 	}
 
 	BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 
 	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
@@ -5299,6 +5616,7 @@ void MESH_OT_wireframe(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "use_replace",         TRUE, "Replace", "Remove original faces");
 }
 
+#ifdef WITH_BULLET
 static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
 {
 	Object *obedit = CTX_data_edit_object(C);
@@ -5320,8 +5638,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
 	
 	/* Delete unused vertices, edges, and faces */
 	if (RNA_boolean_get(op->ptr, "delete_unused")) {
-		if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
-		                   &bmop, "unused_geom", DEL_ONLYTAGGED))
+		if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
+		                   &bmop, "geom_unused.out", DEL_ONLYTAGGED))
 		{
 			EDBM_op_finish(em, &bmop, op, TRUE);
 			return OPERATOR_CANCELLED;
@@ -5330,8 +5648,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
 
 	/* Delete hole edges/faces */
 	if (RNA_boolean_get(op->ptr, "make_holes")) {
-		if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
-		                   &bmop, "holes_geom", DEL_ONLYTAGGED))
+		if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
+		                   &bmop, "geom_holes.out", DEL_ONLYTAGGED))
 		{
 			EDBM_op_finish(em, &bmop, op, TRUE);
 			return OPERATOR_CANCELLED;
@@ -5340,8 +5658,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
 
 	/* Merge adjacent triangles */
 	if (RNA_boolean_get(op->ptr, "join_triangles")) {
-		if (!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f",
-		                   &bmop, "geomout",
+		if (!EDBM_op_callf(em, op, "join_triangles faces=%S limit=%f",
+		                   &bmop, "geom.out",
 		                   RNA_float_get(op->ptr, "limit")))
 		{
 			EDBM_op_finish(em, &bmop, op, TRUE);
@@ -5392,3 +5710,55 @@ void MESH_OT_convex_hull(wmOperatorType *ot)
 
 	join_triangle_props(ot);
 }
+#endif
+
+static int mesh_symmetrize_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+
+	EDBM_op_init(em, &bmop, op, "symmetrize input=%hvef direction=%i",
+	             BM_ELEM_SELECT, RNA_enum_get(op->ptr, "direction"));
+	BMO_op_exec(em->bm, &bmop);
+
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+	else {
+		EDBM_update_generic(C, em, TRUE);
+		EDBM_selectmode_flush(em);
+		return OPERATOR_FINISHED;
+	}
+}
+
+void MESH_OT_symmetrize(struct wmOperatorType *ot)
+{
+	static EnumPropertyItem axis_direction_items[] = {
+		{BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""},
+		{BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""},
+
+		{BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""},
+		{BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""},
+
+		{BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""},
+		{BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""},
+		{0, NULL, 0, NULL, NULL},
+	};
+
+	/* identifiers */
+	ot->name = "Symmetrize";
+	ot->description = "Enforce symmetry (both form and topological) across an axis";
+	ot->idname = "MESH_OT_symmetrize";
+
+	/* api callbacks */
+	ot->exec = mesh_symmetrize_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	ot->prop = RNA_def_enum(ot->srna, "direction", axis_direction_items,
+	                        BMO_SYMMETRIZE_NEGATIVE_X,
+	                        "Direction", "Which sides to copy from and to");
+}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 537d463..2cf6358 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -263,11 +263,13 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
 	return EDBM_op_finish(em, &bmop, op, TRUE);
 }
 
-int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...)
+int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...)
 {
+	BMOpSlot *slot_select_out;
 	BMesh *bm = em->bm;
 	BMOperator bmop;
 	va_list list;
+	char hflag;
 
 	va_start(list, fmt);
 
@@ -283,9 +285,12 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selects
 
 	BMO_op_exec(bm, &bmop);
 
+	slot_select_out = BMO_slot_get(bmop.slots_out, select_slot_out);
+	hflag = slot_select_out->slot_subtype.elem & BM_ALL_NOLOOP;
+
 	BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
 
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, hflag, BM_ELEM_SELECT, TRUE);
 
 	va_end(list);
 	return EDBM_op_finish(em, &bmop, op, TRUE);
@@ -494,11 +499,11 @@ void EDBM_select_more(BMEditMesh *em)
 	int use_faces = em->selectmode == SCE_SELECT_FACE;
 
 	BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
-	             "region_extend geom=%hvef constrict=%b use_faces=%b",
+	             "region_extend geom=%hvef use_constrict=%b use_faces=%b",
 	             BM_ELEM_SELECT, FALSE, use_faces);
 	BMO_op_exec(em->bm, &bmop);
 	/* don't flush selection in edge/vertex mode  */
-	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
 	BMO_op_finish(em->bm, &bmop);
 
 	EDBM_select_flush(em);
@@ -510,11 +515,11 @@ void EDBM_select_less(BMEditMesh *em)
 	int use_faces = em->selectmode == SCE_SELECT_FACE;
 
 	BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
-	             "region_extend geom=%hvef constrict=%b use_faces=%b",
+	             "region_extend geom=%hvef use_constrict=%b use_faces=%b",
 	             BM_ELEM_SELECT, TRUE, use_faces);
 	BMO_op_exec(em->bm, &bmop);
 	/* don't flush selection in edge/vertex mode  */
-	BMO_slot_buffer_hflag_disable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+	BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
 	BMO_op_finish(em->bm, &bmop);
 
 	EDBM_selectmode_flush(em);
@@ -1012,6 +1017,19 @@ void EDBM_uv_element_map_free(UvElementMap *element_map)
 	}
 }
 
+UvElement *ED_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l)
+{
+	UvElement *element;
+
+	element = map->vert[BM_elem_index_get(l->v)];
+
+	for (; element; element = element->next)
+		if (element->face == efa)
+			return element;
+
+	return NULL;
+}
+
 /* last_sel, use em->act_face otherwise get the last selected face in the editselections
  * at the moment, last_sel is mainly useful for making sure the space image dosnt flicker */
 MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, int sloppy, int selected)
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 735492c..e9906f8 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -235,7 +235,8 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 	}
 }
 
-int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum)
+/* without bContext, called in uvedit */
+int ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
 {
 	BMEditMesh *em = me->edit_btmesh;
 	MLoopUV *luv;
@@ -338,7 +339,6 @@ int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int laye
 	BLI_array_free(polylengths);
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return 1;
 }
@@ -348,7 +348,11 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
 	/* could be ldata or pdata */
 	CustomData *pdata = GET_CD_DATA(me, pdata);
 	const int layernum = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
-	return ED_mesh_uv_loop_reset_ex(C, me, layernum);
+	int retval = ED_mesh_uv_loop_reset_ex(me, layernum);
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+	
+	return retval;
 }
 
 /* note: keep in sync with ED_mesh_color_add */
@@ -419,7 +423,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
 
 	/* don't overwrite our copied coords */
 	if (is_init == FALSE) {
-		ED_mesh_uv_loop_reset_ex(C, me, layernum_dst);
+		ED_mesh_uv_loop_reset_ex(me, layernum_dst);
 	}
 
 	DAG_id_tag_update(&me->id, 0);
@@ -593,7 +597,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	
 	/* Check context */
 	if (base == NULL || base->object->type != OB_MESH) {
-		BKE_report(op->reports, RPT_ERROR, "Not an Object or Mesh");
+		BKE_report(op->reports, RPT_ERROR, "Not an object or mesh");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -610,7 +614,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 	
 	if (!ima) {
-		BKE_report(op->reports, RPT_ERROR, "Not an Image");
+		BKE_report(op->reports, RPT_ERROR, "Not an image");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -902,7 +906,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
 	 * so rather then add poly-index layer and calculate normals for it
 	 * calculate normals only for the mvert's. - campbell */
 #ifdef USE_BMESH_MPOLY_NORMALS
-	polyindex = CustomData_get_layer(&mesh->fdata, CD_POLYINDEX);
+	polyindex = CustomData_get_layer(&mesh->fdata, CD_ORIGINDEX);
 	/* add a normals layer for tessellated faces, a tessface normal will
 	 * contain the normal of the poly the face was tessellated from. */
 	face_nors = CustomData_add_layer(&mesh->fdata, CD_NORMAL, CD_CALLOC, NULL, mesh->totface);
@@ -947,6 +951,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
 
 	/* scan the input list and insert the new vertices */
 
+	/* set default flags */
 	mvert = &mesh->mvert[mesh->totvert];
 	for (i = 0; i < len; i++, mvert++)
 		mvert->flag |= SELECT;
@@ -1124,7 +1129,7 @@ static void mesh_remove_faces(Mesh *mesh, int len)
 void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add geometry in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot add geometry in edit mode");
 		return;
 	}
 
@@ -1140,12 +1145,12 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
 void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessfaces in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessfaces in edit mode");
 		return;
 	}
 
 	if (mesh->mpoly) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessfaces to a mesh that already has polygons");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessfaces to a mesh that already has polygons");
 		return;
 	}
 
@@ -1155,7 +1160,7 @@ void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot add edges in edit mode");
 		return;
 	}
 
@@ -1165,7 +1170,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot add vertices in edit mode");
 		return;
 	}
 
@@ -1175,11 +1180,11 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot remove faces in edit mode");
 		return;
 	}
 	else if (count > mesh->totface) {
-		BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
+		BKE_report(reports, RPT_ERROR, "Cannot remove more faces than the mesh contains");
 		return;
 	}
 
@@ -1189,11 +1194,11 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
 		return;
 	}
 	else if (count > mesh->totedge) {
-		BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
+		BKE_report(reports, RPT_ERROR, "Cannot remove more edges than the mesh contains");
 		return;
 	}
 
@@ -1203,11 +1208,11 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
+		BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
 		return;
 	}
 	else if (count > mesh->totvert) {
-		BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
+		BKE_report(reports, RPT_ERROR, "Cannot remove more vertices than the mesh contains");
 		return;
 	}
 
@@ -1217,7 +1222,7 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add loops in edit mode.");
+		BKE_report(reports, RPT_ERROR, "Cannot add loops in edit mode");
 		return;
 	}
 
@@ -1227,7 +1232,7 @@ void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
 void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add polys in edit mode.");
+		BKE_report(reports, RPT_ERROR, "Cannot add polygons in edit mode");
 		return;
 	}
 
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 2676316..e335c90 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -80,9 +80,6 @@ int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
 void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
 void EDBM_stats_update(struct BMEditMesh *em);
 
-/* TODO, move to math_geometry.c */
-float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3]);
-
 /* ******************** editface.c */
 
 void MESH_OT_separate(struct wmOperatorType *ot);
@@ -121,7 +118,7 @@ void MESH_OT_select_linked(struct wmOperatorType *ot);
 void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
 void MESH_OT_hide(struct wmOperatorType *ot);
 void MESH_OT_reveal(struct wmOperatorType *ot);
-void MESH_OT_select_by_number_vertices(struct wmOperatorType *ot);
+void MESH_OT_select_face_by_sides(struct wmOperatorType *ot);
 void MESH_OT_select_loose_verts(struct wmOperatorType *ot);
 void MESH_OT_select_mirror(struct wmOperatorType *ot);
 void MESH_OT_normals_make_consistent(struct wmOperatorType *ot);
@@ -129,11 +126,13 @@ void MESH_OT_faces_select_linked_flat(struct wmOperatorType *ot);
 void MESH_OT_edges_select_sharp(struct wmOperatorType *ot);
 void MESH_OT_select_shortest_path(struct wmOperatorType *ot);
 void MESH_OT_select_similar(struct wmOperatorType *ot);
+void MESH_OT_select_mode(struct wmOperatorType *ot);
 void MESH_OT_select_random(struct wmOperatorType *ot);
 void MESH_OT_loop_multi_select(struct wmOperatorType *ot);
 void MESH_OT_mark_seam(struct wmOperatorType *ot);
 void MESH_OT_mark_sharp(struct wmOperatorType *ot);
 void MESH_OT_vertices_smooth(struct wmOperatorType *ot);
+void MESH_OT_vertices_smooth_laplacian(struct wmOperatorType *ot);
 void MESH_OT_noise(struct wmOperatorType *ot);
 void MESH_OT_flip_normals(struct wmOperatorType *ot);
 void MESH_OT_solidify(struct wmOperatorType *ot);
@@ -144,6 +143,7 @@ extern struct EnumPropertyItem *corner_type_items;
 
 void MESH_OT_merge(struct wmOperatorType *ot);
 void MESH_OT_subdivide(struct wmOperatorType *ot);
+void MESH_OT_unsubdivide(struct wmOperatorType *ot);
 void MESH_OT_remove_doubles(struct wmOperatorType *ot);
 void MESH_OT_spin(struct wmOperatorType *ot);
 void MESH_OT_screw(struct wmOperatorType *ot);
@@ -214,6 +214,8 @@ void MESH_OT_vert_slide(struct wmOperatorType *ot);
 
 void MESH_OT_convex_hull(struct wmOperatorType *ot);
 
+void MESH_OT_symmetrize(struct wmOperatorType *ot);
+
 /* ******************* mesh_navmesh.c */
 void MESH_OT_navmesh_make(struct wmOperatorType *ot);
 void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 88b1f19..83a1261 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -209,7 +209,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 	triflags = MEM_callocN(sizeof(unsigned char) * ntris, "buildNavMesh triflags");
 
 	/* Find triangles which are walkable based on their slope and rasterize them */
-	recast_markWalkableTriangles(RAD2DEG(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags);
+	recast_markWalkableTriangles(RAD2DEGF(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags);
 	recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid);
 	MEM_freeN(triflags);
 
@@ -341,7 +341,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 		co[1] = bmin[1] + v[1] * ch;
 		co[2] = bmin[2] + v[2] * cs;
 		SWAP(float, co[1], co[2]);
-		BM_vert_create(em->bm, co, NULL);
+		BM_vert_create(em->bm, co, NULL, 0);
 	}
 
 	/* create custom data layer to save polygon idx */
@@ -372,7 +372,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 		for (j = nv; j < ndv; j++) {
 			copy_v3_v3(co, &dverts[3 * (vbase + j)]);
 			SWAP(float, co[1], co[2]);
-			BM_vert_create(em->bm, co, NULL);
+			BM_vert_create(em->bm, co, NULL, 0);
 		}
 
 		EDBM_index_arrays_init(em, 1, 0, 0);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 3ac8719..a413a60 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -68,12 +68,13 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_select_random);
 	WM_operatortype_append(MESH_OT_hide);
 	WM_operatortype_append(MESH_OT_reveal);
-	WM_operatortype_append(MESH_OT_select_by_number_vertices);
+	WM_operatortype_append(MESH_OT_select_face_by_sides);
 	WM_operatortype_append(MESH_OT_select_loose_verts);
 	WM_operatortype_append(MESH_OT_select_mirror);
 	WM_operatortype_append(MESH_OT_normals_make_consistent);
 	WM_operatortype_append(MESH_OT_merge);
 	WM_operatortype_append(MESH_OT_subdivide);
+	WM_operatortype_append(MESH_OT_unsubdivide);
 	WM_operatortype_append(MESH_OT_faces_select_linked_flat);
 	WM_operatortype_append(MESH_OT_edges_select_sharp);
 	WM_operatortype_append(MESH_OT_primitive_plane_add);
@@ -128,10 +129,12 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_edge_face_add);
 	WM_operatortype_append(MESH_OT_select_shortest_path);
 	WM_operatortype_append(MESH_OT_select_similar);
+	WM_operatortype_append(MESH_OT_select_mode);
 	WM_operatortype_append(MESH_OT_loop_multi_select);
 	WM_operatortype_append(MESH_OT_mark_seam);
 	WM_operatortype_append(MESH_OT_mark_sharp);
 	WM_operatortype_append(MESH_OT_vertices_smooth);
+	WM_operatortype_append(MESH_OT_vertices_smooth_laplacian);
 	WM_operatortype_append(MESH_OT_noise);
 	WM_operatortype_append(MESH_OT_flip_normals);
 	WM_operatortype_append(MESH_OT_rip);
@@ -164,7 +167,11 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_wireframe);
 	WM_operatortype_append(MESH_OT_edge_split);
 
+#ifdef WITH_BULLET
 	WM_operatortype_append(MESH_OT_convex_hull);
+#endif
+
+	WM_operatortype_append(MESH_OT_symmetrize);
 
 #ifdef WITH_GAMEENGINE
 	WM_operatortype_append(MESH_OT_navmesh_make);
@@ -209,7 +216,17 @@ void ED_operatormacros_mesh(void)
 
 	ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", "Rip polygons and move the result",
 	                                  OPTYPE_UNDO | OPTYPE_REGISTER);
-	WM_operatortype_macro_define(ot, "MESH_OT_rip");
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
+	RNA_boolean_set(otmacro->ptr, "use_fill", FALSE);
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	RNA_enum_set(otmacro->ptr, "proportional", 0);
+	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+
+	/* annoying we can't pass 'use_fill' through the macro */
+	ot = WM_operatortype_append_macro("MESH_OT_rip_move_fill", "Rip Fill", "Rip-fill polygons and move the result",
+	                                  OPTYPE_UNDO | OPTYPE_REGISTER);
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
+	RNA_boolean_set(otmacro->ptr, "use_fill", TRUE);
 	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
@@ -261,13 +278,21 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	/* standard mouse selection goes via space_view3d */
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+	RNA_boolean_set(kmi->ptr, "toggle", FALSE);
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
-	RNA_boolean_set(kmi->ptr, "extend", TRUE);
+	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+	RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+	RNA_boolean_set(kmi->ptr, "toggle", FALSE);
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT | KM_CTRL, 0);
-	RNA_boolean_set(kmi->ptr, "extend", TRUE);
+	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+	RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
 	WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 
@@ -324,6 +349,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
 
 	WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "MESH_OT_rip_move_fill", VKEY, KM_PRESS, KM_ALT, 0);
+
 	WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
 
 	WM_keymap_add_item(keymap, "TRANSFORM_OT_shrink_fatten", SKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index f265113..c0b6327 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -113,7 +113,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 	CustomData vdata, edata, fdata, ldata, pdata;
 
 	if (scene->obedit) {
-		BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode");
+		BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -161,10 +161,13 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 	}
 	
 	if (totvert > MESH_MAX_VERTS) {
-		BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert);
-		return OPERATOR_CANCELLED;		
+		BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is %ld", totvert, MESH_MAX_VERTS);
+		return OPERATOR_CANCELLED;
 	}
 
+	/* remove tessface to ensure we don't old references to invalid faces */
+	BKE_mesh_tessface_clear(me);
+
 	/* new material indices and material array */
 	matar = MEM_callocN(sizeof(void *) * totmat, "join_mesh matar");
 	if (totmat) matmap = MEM_callocN(sizeof(int) * totmat, "join_mesh matmap");
@@ -264,7 +267,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 
 							/* adjust settings to fit (allocate a new data-array) */
 							kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey");
-							kbn->totelem = totvert;	
+							kbn->totelem = totvert;
 		
 							/* XXX 2.5 Animato */
 #if 0
@@ -296,12 +299,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 
 
 	/* setup new data for destination mesh */
-	memset(&vdata, 0, sizeof(vdata));
-	memset(&edata, 0, sizeof(edata));
-	memset(&fdata, 0, sizeof(fdata));
-	memset(&ldata, 0, sizeof(ldata));
-	memset(&pdata, 0, sizeof(pdata));
-	
+	CustomData_reset(&vdata);
+	CustomData_reset(&edata);
+	CustomData_reset(&fdata);
+	CustomData_reset(&ldata);
+	CustomData_reset(&pdata);
+
 	mvert = CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
 	medge = CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
 	mloop = CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
@@ -513,7 +516,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 	me->ldata = ldata;
 	me->pdata = pdata;
 
-	mesh_update_customdata_pointers(me, TRUE); /* BMESH_TODO, check if this arg can be failse, non urgent - campbell */
+	/* tessface data removed above, no need to update */
+	mesh_update_customdata_pointers(me, FALSE);
 	
 	/* old material array */
 	for (a = 1; a <= ob->totcol; a++) {
@@ -843,7 +847,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char m
 				minmax_v3v3_v3(min, max, eve->co);
 			}
 		}
-		else {		
+		else {
 			MVert *mvert;
 			int a;
 			
@@ -878,7 +882,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char m
 				mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (intptr_t)(eve));
 			}
 		}
-		else {		
+		else {
 			MVert *mvert;
 			int a;
 			
@@ -1192,7 +1196,7 @@ int ED_mesh_pick_face(bContext *C, Mesh *me, const int mval[2], unsigned int *in
 		/* sample rect to increase chances of selecting, so that when clicking
 		 * on an edge in the backbuf, we can still select a face */
 
-		int dummy_dist;
+		float dummy_dist;
 		*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totpoly + 1, &dummy_dist, 0, NULL, NULL);
 	}
 	else {
@@ -1277,7 +1281,7 @@ int ED_mesh_pick_vert(bContext *C, Mesh *me, const int mval[2], unsigned int *in
 		/* sample rect to increase chances of selecting, so that when clicking
 		 * on an face in the backbuf, we can still select a vert */
 
-		int dummy_dist;
+		float dummy_dist;
 		*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert + 1, &dummy_dist, 0, NULL, NULL);
 	}
 	else {
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index e906368..8633a7a 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -98,7 +98,7 @@ void load_editMball(Object *UNUSED(obedit))
 }
 
 /* Add metaelem primitive to metaball object (which is in edit mode) */
-MetaElem *add_metaball_primitive(bContext *UNUSED(C), Object *obedit, float mat[4][4], int type, int UNUSED(newname))
+MetaElem *add_metaball_primitive(bContext *UNUSED(C), Object *obedit, float mat[4][4], float dia, int type, int UNUSED(newname))
 {
 	MetaBall *mball = (MetaBall *)obedit->data;
 	MetaElem *ml;
@@ -111,6 +111,7 @@ MetaElem *add_metaball_primitive(bContext *UNUSED(C), Object *obedit, float mat[
 	}
 	
 	ml = BKE_mball_element_add(mball, type);
+	ml->rad *= dia;
 	copy_v3_v3(&ml->x, mat[3]);
 
 	ml->flag |= SELECT;
@@ -123,7 +124,6 @@ MetaElem *add_metaball_primitive(bContext *UNUSED(C), Object *obedit, float mat[
 /* Select or deselect all MetaElements */
 static int mball_select_all_exec(bContext *C, wmOperator *op)
 {
-	//Scene *scene= CTX_data_scene(C);
 	Object *obedit = CTX_data_edit_object(C);
 	MetaBall *mb = (MetaBall *)obedit->data;
 	MetaElem *ml;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 43a32cd..7c4a547 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -136,6 +136,7 @@ static EnumPropertyItem field_type_items[] = {
 	{PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
 	{PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", ""},
 	{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""},
+	{PFIELD_SMOKEFLOW, "SMOKE", ICON_FORCE_SMOKEFLOW, "Smoke Flow", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -185,7 +186,8 @@ void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3],
 /* Uses context to figure out transform for primitive.
  * Returns standard diameter. */
 float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
-                                     const float loc[3], const float rot[3], float primmat[][4])
+                                     const float loc[3], const float rot[3], float primmat[][4],
+                                     int apply_diameter)
 {
 	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
@@ -208,8 +210,17 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
 	invert_m3_m3(imat, mat);
 	mul_m3_v3(imat, primmat[3]);
 
-	if (v3d)
-		return ED_view3d_grid_scale(scene, v3d, NULL);
+	{
+		const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL);
+
+		if (apply_diameter) {
+			primmat[0][0] *= dia;
+			primmat[1][1] *= dia;
+			primmat[2][2] *= dia;
+		}
+
+		return dia;
+	}
 
 	return 1.0f;
 }
@@ -260,7 +271,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float loc[3], fl
 		if (RNA_struct_property_is_set(op->ptr, "enter_editmode") && enter_editmode)
 			*enter_editmode = RNA_boolean_get(op->ptr, "enter_editmode");
 		else {
-			*enter_editmode = U.flag & USER_ADD_EDITMODE;
+			*enter_editmode = (U.flag & USER_ADD_EDITMODE) != 0;
 			RNA_boolean_set(op->ptr, "enter_editmode", *enter_editmode);
 		}
 	}
@@ -356,7 +367,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa
 	Scene *scene = CTX_data_scene(C);
 	Object *ob;
 
-	/* For as long scene has editmode... */
+	/* for as long scene has editmode... */
 	if (CTX_data_edit_object(C)) 
 		ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);  /* freedata, and undo */
 
@@ -441,7 +452,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
 		rename_id(&ob->id, "CurveGuide");
 		((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
 		ED_object_enter_editmode(C, 0);
-		ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
+		ED_object_new_primitive_matrix(C, ob, loc, rot, mat, FALSE);
 		BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, ob, mat, CU_NURBS | CU_PRIM_PATH, 1));
 		if (!enter_editmode)
 			ED_object_exit_editmode(C, EM_FREEDATA);
@@ -546,6 +557,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
 	unsigned int layer;
 	float loc[3], rot[3];
 	float mat[4][4];
+	float dia;
 
 	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
@@ -557,9 +569,9 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
 	else
 		DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
 
-	ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
+	dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, FALSE);
 
-	add_metaball_primitive(C, obedit, mat, RNA_enum_get(op->ptr, "type"), newob);
+	add_metaball_primitive(C, obedit, mat, dia, RNA_enum_get(op->ptr, "type"), newob);
 
 	/* userdef */
 	if (newob && !enter_editmode) {
@@ -821,8 +833,6 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
 /* only used as menu */
 void OBJECT_OT_group_instance_add(wmOperatorType *ot)
 {
-	PropertyRNA *prop;
-
 	/* identifiers */
 	ot->name = "Add Group Instance";
 	ot->description = "Add a dupligroup instance";
@@ -837,9 +847,8 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
-	RNA_def_enum_funcs(prop, RNA_group_itemf);
-	ot->prop = prop;
+	ot->prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
+	RNA_def_enum_funcs(ot->prop, RNA_group_itemf);
 	ED_object_add_generic_props(ot, FALSE);
 }
 
@@ -1112,13 +1121,13 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 		basen->object = ob;
 
 		/* make sure apply works */
-		BKE_free_animdata(&ob->id);	
+		BKE_free_animdata(&ob->id);
 		ob->adt = NULL;
 
 		ob->parent = NULL;
 		ob->constraints.first = ob->constraints.last = NULL;
 		ob->disp.first = ob->disp.last = NULL;
-		ob->transflag &= ~OB_DUPLI;	
+		ob->transflag &= ~OB_DUPLI;
 		ob->lay = base->lay;
 
 		copy_m4_m4(ob->obmat, dob->mat);
@@ -1127,7 +1136,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 		if (dupli_gh)
 			BLI_ghash_insert(dupli_gh, dob, ob);
 		if (parent_gh)
-			BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, SET_INT_IN_POINTER(dob->index)), ob);
+			BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, SET_INT_IN_POINTER(dob->persistent_id[0])), ob);
 	}
 
 	if (use_hierarchy) {
@@ -1141,7 +1150,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 
 			/* find parent that was also made real */
 			if (ob_src_par) {
-				GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, SET_INT_IN_POINTER(dob->index));
+				GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, SET_INT_IN_POINTER(dob->persistent_id[0]));
 				ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
 				BLI_ghashutil_pairfree(pair);
 			}
@@ -1398,7 +1407,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 			 * cases this doesnt give correct results (when MDEF is used for eg)
 			 */
 			dm = mesh_get_derived_final(scene, newob, CD_MASK_MESH);
-			/* dm= mesh_create_derived_no_deform(ob1, NULL);	this was called original (instead of get_derived). man o man why! (ton) */
+			// dm = mesh_create_derived_no_deform(ob1, NULL);  /* this was called original (instead of get_derived). man o man why! (ton) */
 
 			DM_to_mesh(dm, newob->data, newob);
 
@@ -1564,7 +1573,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 		/* delete original if needed */
 		if (basedel) {
 			if (!keep_original)
-				ED_base_object_free_and_unlink(bmain, scene, basedel);	
+				ED_base_object_free_and_unlink(bmain, scene, basedel);
 
 			basedel = NULL;
 		}
@@ -2048,11 +2057,11 @@ static int join_exec(bContext *C, wmOperator *op)
 	Object *ob = CTX_data_active_object(C);
 
 	if (scene->obedit) {
-		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
+		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 	else if (BKE_object_obdata_is_libdata(ob)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2102,11 +2111,11 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
 	Object *ob = CTX_data_active_object(C);
 
 	if (scene->obedit) {
-		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
+		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 	else if (BKE_object_obdata_is_libdata(ob)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 6d12437..e144c38 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -114,7 +114,7 @@ typedef struct {
 } MultiresBakeRender;
 
 typedef void (*MPassKnownData)(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data,
-                               const int face_index, const int lvl, const float st[2],
+                               ImBuf *ibuf, const int face_index, const int lvl, const float st[2],
                                float tangmat[3][3], const int x, const int y);
 
 typedef void * (*MInitBakeData)(MultiresBakeRender *bkr, Image *ima);
@@ -133,6 +133,7 @@ typedef struct {
 	DerivedMesh *lores_dm, *hires_dm;
 	int lvl;
 	void *bake_data;
+	ImBuf *ibuf;
 	MPassKnownData pass_data;
 } MResolvePixelData;
 
@@ -150,11 +151,13 @@ typedef struct {
 	float height_min, height_max;
 	Image *ima;
 	DerivedMesh *ssdm;
-	const int *origindex;
+	const int *orig_index_mf_to_mpoly;
+	const int *orig_index_mp_to_orig;
 } MHeightBakeData;
 
 typedef struct {
-	const int *origindex;
+	const int *orig_index_mf_to_mpoly;
+	const int *orig_index_mp_to_orig;
 } MNormalBakeData;
 
 static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index)
@@ -255,7 +258,7 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
 	/* sequence end */
 
 	data->pass_data(data->lores_dm, data->hires_dm, data->bake_data,
-	                data->face_index, data->lvl, st, to_tang, x, y);
+	                data->ibuf, data->face_index, data->lvl, st, to_tang, x, y);
 }
 
 static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y)
@@ -366,7 +369,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, MPassKnownData
                              MInitBakeData initBakeData, MApplyBakeData applyBakeData, MFreeBakeData freeBakeData)
 {
 	DerivedMesh *dm = bkr->lores_dm;
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	const int lvl = bkr->lvl;
 	const int tot_face = dm->getNumTessFaces(dm);
 	MVert *mvert = dm->getVertArray(dm);
@@ -412,6 +415,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, MPassKnownData
 				continue;
 
 			data.face_index = f;
+			data.ibuf = ibuf;
 
 			/* might support other forms of diagonal splits later on such as
 			 * split by shortest diagonal.*/
@@ -447,32 +451,8 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, MPassKnownData
 		if (freeBakeData)
 			freeBakeData(data.bake_data);
 	}
-}
 
-static void interp_bilinear_quad_data(float data[4][3], float u, float v, float res[3])
-{
-	float vec[3];
-
-	copy_v3_v3(res, data[0]);
-	mul_v3_fl(res, (1 - u) * (1 - v));
-	copy_v3_v3(vec, data[1]);
-	mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
-	copy_v3_v3(vec, data[2]);
-	mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
-	copy_v3_v3(vec, data[3]);
-	mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
-}
-
-static void interp_barycentric_tri_data(float data[3][3], float u, float v, float res[3])
-{
-	float vec[3];
-
-	copy_v3_v3(res, data[0]);
-	mul_v3_fl(res, u);
-	copy_v3_v3(vec, data[1]);
-	mul_v3_fl(vec, v); add_v3_v3(res, vec);
-	copy_v3_v3(vec, data[2]);
-	mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 /* mode = 0: interpolate normals,
@@ -505,10 +485,12 @@ static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float
 		copy_v3_v3(data[3], CCG_grid_elem_co(key, grid, x0, y1));
 	}
 
-	interp_bilinear_quad_data(data, u, v, res);
+	interp_bilinear_quad_v3(data, u, v, res);
 }
 
-static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex,  const int lvl, const int face_index, const float u, const float v, float co[3], float n[3])
+static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm,
+                           const int *index_mf_to_mpoly, const int *index_mp_to_orig,
+                           const int lvl, const int face_index, const float u, const float v, float co[3], float n[3])
 {
 	MFace mface;
 	CCGElem **grid_data;
@@ -532,7 +514,7 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
 	}
 	else {
 		int side = (1 << (lvl - 1)) + 1;
-		int grid_index = origindex[face_index];
+		int grid_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, face_index);
 		int loc_offs = face_index % (1 << (2 * lvl));
 		int cell_index = loc_offs % ((side - 1) * (side - 1));
 		int cell_side = (grid_size - 1) / (side - 1);
@@ -575,7 +557,7 @@ static void interp_bilinear_mface(DerivedMesh *dm, MFace *mface, const float u,
 		dm->getVertCo(dm, mface->v4, data[3]);
 	}
 
-	interp_bilinear_quad_data(data, u, v, res);
+	interp_bilinear_quad_v3(data, u, v, res);
 }
 
 /* mode = 0: interpolate normals,
@@ -595,13 +577,13 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float
 		dm->getVertCo(dm, mface->v3, data[2]);
 	}
 
-	interp_barycentric_tri_data(data, u, v, res);
+	interp_barycentric_tri_v3(data, u, v, res);
 }
 
 static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
 {
 	MHeightBakeData *height_data;
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	DerivedMesh *lodm = bkr->lores_dm;
 
 	height_data = MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData");
@@ -628,7 +610,10 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
 		}
 	}
 
-	height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+	height_data->orig_index_mf_to_mpoly = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+	height_data->orig_index_mp_to_orig = lodm->getPolyDataArray(lodm, CD_ORIGINDEX);
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 
 	return (void *)height_data;
 }
@@ -640,7 +625,8 @@ static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
 
 	normal_data = MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
 
-	normal_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+	normal_data->orig_index_mf_to_mpoly = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+	normal_data->orig_index_mp_to_orig = lodm->getPolyDataArray(lodm, CD_ORIGINDEX);
 
 	return (void *)normal_data;
 }
@@ -655,7 +641,7 @@ static void free_normal_data(void *bake_data)
 static void apply_heights_data(void *bake_data)
 {
 	MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
-	ImBuf *ibuf = BKE_image_get_ibuf(height_data->ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(height_data->ima, NULL, NULL);
 	int x, y, i;
 	float height, *heights = height_data->heights;
 	float min = height_data->height_min, max = height_data->height_max;
@@ -687,6 +673,8 @@ static void apply_heights_data(void *bake_data)
 	}
 
 	ibuf->userflags = IB_RECT_INVALID | IB_DISPLAY_BUFFER_INVALID;
+
+	BKE_image_release_ibuf(height_data->ima, ibuf, NULL);
 }
 
 static void free_heights_data(void *bake_data)
@@ -707,13 +695,11 @@ static void free_heights_data(void *bake_data)
  *     mesh to make texture smoother) let's call this point p0 and n.
  *   - height wound be dot(n, p1-p0) */
 static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data,
-                                   const int face_index, const int lvl, const float st[2],
+                                   ImBuf *ibuf, const int face_index, const int lvl, const float st[2],
                                    float UNUSED(tangmat[3][3]), const int x, const int y)
 {
 	MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
 	MFace mface;
-	Image *ima = mtface[face_index].tpage;
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
 	MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
 	float uv[2], *st0, *st1, *st2, *st3;
 	int pixel = ibuf->x * y + x;
@@ -735,10 +721,14 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	CLAMP(uv[0], 0.0f, 1.0f);
 	CLAMP(uv[1], 0.0f, 1.0f);
 
-	get_ccgdm_data(lores_dm, hires_dm, height_data->origindex, lvl, face_index, uv[0], uv[1], p1, 0);
+	get_ccgdm_data(lores_dm, hires_dm,
+	               height_data->orig_index_mf_to_mpoly, height_data->orig_index_mf_to_mpoly,
+	               lvl, face_index, uv[0], uv[1], p1, 0);
 
 	if (height_data->ssdm) {
-		get_ccgdm_data(lores_dm, height_data->ssdm, height_data->origindex, 0, face_index, uv[0], uv[1], p0, n);
+		get_ccgdm_data(lores_dm, height_data->ssdm,
+		               height_data->orig_index_mf_to_mpoly, height_data->orig_index_mf_to_mpoly,
+		               0, face_index, uv[0], uv[1], p0, n);
 	}
 	else {
 		lores_dm->getTessFace(lores_dm, face_index, &mface);
@@ -780,13 +770,11 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
  *   - multiply it by tangmat
  *   - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */
 static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data,
-                                   const int face_index, const int lvl, const float st[2],
+                                   ImBuf *ibuf, const int face_index, const int lvl, const float st[2],
                                    float tangmat[3][3], const int x, const int y)
 {
 	MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
 	MFace mface;
-	Image *ima = mtface[face_index].tpage;
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
 	MNormalBakeData *normal_data = (MNormalBakeData *)bake_data;
 	float uv[2], *st0, *st1, *st2, *st3;
 	int pixel = ibuf->x * y + x;
@@ -808,7 +796,9 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	CLAMP(uv[0], 0.0f, 1.0f);
 	CLAMP(uv[1], 0.0f, 1.0f);
 
-	get_ccgdm_data(lores_dm, hires_dm, normal_data->origindex, lvl, face_index, uv[0], uv[1], NULL, n);
+	get_ccgdm_data(lores_dm, hires_dm,
+	               normal_data->orig_index_mf_to_mpoly, normal_data->orig_index_mp_to_orig,
+	               lvl, face_index, uv[0], uv[1], NULL, n);
 
 	mul_v3_m3v3(vec, tangmat, n);
 	normalize_v3(vec);
@@ -867,7 +857,7 @@ static void bake_images(MultiresBakeRender *bkr)
 
 	for (link = bkr->image.first; link; link = link->next) {
 		Image *ima = (Image *)link->data;
-		ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 		if (ibuf->x > 0 && ibuf->y > 0) {
 			ibuf->userdata = MEM_callocN(ibuf->y * ibuf->x, "MultiresBake imbuf mask");
@@ -883,6 +873,8 @@ static void bake_images(MultiresBakeRender *bkr)
 			}
 		}
 
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+
 		ima->id.flag |= LIB_DOIT;
 	}
 }
@@ -893,14 +885,14 @@ static void finish_images(MultiresBakeRender *bkr)
 
 	for (link = bkr->image.first; link; link = link->next) {
 		Image *ima = (Image *)link->data;
-		ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 		if (ibuf->x <= 0 || ibuf->y <= 0)
 			continue;
 
 		RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, bkr->bake_filter);
 
-		ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;;
+		ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;
 
 		if (ibuf->rect_float)
 			ibuf->userflags |= IB_RECT_INVALID;
@@ -914,6 +906,8 @@ static void finish_images(MultiresBakeRender *bkr)
 			MEM_freeN(ibuf->userdata);
 			ibuf->userdata = NULL;
 		}
+
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 }
 
@@ -937,7 +931,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 		ob = base->object;
 
 		if (ob->type != OB_MESH) {
-			BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh");
+			BKE_report(op->reports, RPT_ERROR, "Baking of multires data only works with an active mesh object");
 
 			ok = 0;
 			break;
@@ -966,6 +960,12 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 			break;
 		}
 
+		if (mmd->lvl == 0) {
+			BKE_report(op->reports, RPT_ERROR, "Multires data baking is not supported for preview subdivision level 0");
+
+			break;
+		}
+
 		if (!me->mtpoly) {
 			BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
 
@@ -982,10 +982,10 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 					ok = 0;
 				}
 				else {
-					ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+					ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 					if (!ibuf) {
-						BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer");
+						BKE_report(op->reports, RPT_ERROR, "Baking should happen to image with image buffer");
 
 						ok = 0;
 					}
@@ -999,6 +999,8 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 						if (!ok)
 							BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type");
 					}
+
+					BKE_image_release_ibuf(ima, ibuf, NULL);
 				}
 			}
 		}
@@ -1030,8 +1032,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
 
 		tmp_mmd.lvl = *lvl;
 		tmp_mmd.sculptlvl = *lvl;
-		dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
-		                                        0);
+		dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
 		cddm->release(cddm);
 	}
 
@@ -1051,8 +1052,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
 
 	tmp_mmd.lvl = mmd->totlvl;
 	tmp_mmd.sculptlvl = mmd->totlvl;
-	dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
-	                                        0);
+	dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
 	cddm->release(cddm);
 
 	return dm;
@@ -1071,10 +1071,12 @@ static void clear_images(MTFace *mtface, int totface)
 		Image *ima = mtface[a].tpage;
 
 		if ((ima->id.flag & LIB_DOIT) == 0) {
-			ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+			ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 			IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
 			ima->id.flag |= LIB_DOIT;
+
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 	}
 
@@ -1366,20 +1368,23 @@ static void finish_bake_internal(BakeRender *bkr)
 		if (bkr->prev_r_raytrace == 0)
 			bkr->scene->r.mode &= ~R_RAYTRACE;
 
-
 	/* force OpenGL reload and mipmap recalc */
 	for (ima = G.main->image.first; ima; ima = ima->id.next) {
-		ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
-
-		if (bkr->result == BAKE_RESULT_OK) {
-			if (ima->ok == IMA_OK_LOADED) {
-				if (ibuf) {
-					if (ibuf->userflags & IB_BITMAPDIRTY) {
-						ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
-						GPU_free_image(ima);
-						imb_freemipmapImBuf(ibuf);
-					}
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
+
+		/* some of the images could have been changed during bake,
+		 * so recreate mipmaps regardless bake result status
+		 */
+		if (ima->ok == IMA_OK_LOADED) {
+			if (ibuf) {
+				if (ibuf->userflags & IB_BITMAPDIRTY) {
+					GPU_free_image(ima);
+					imb_freemipmapImBuf(ibuf);
 				}
+
+				/* invalidate display buffers for changed images */
+				if (ibuf->userflags & IB_BITMAPDIRTY)
+					ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
 			}
 		}
 
@@ -1390,6 +1395,8 @@ static void finish_bake_internal(BakeRender *bkr)
 				ibuf->userdata = NULL;
 			}
 		}
+
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 }
 
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 56f2426..f78e120 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -494,9 +494,9 @@ static void test_constraints(Object *owner, bPoseChannel *pchan)
 								/* auto-set 'Path' setting on curve so this works  */
 								cu->flag |= CU_PATH;
 							}
-						}						
+						}
 					}
-				}	
+				}
 				
 				/* free any temporary targets */
 				if (cti->flush_constraint_targets)
@@ -593,7 +593,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
 	
 	if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
 		list = &ob->constraints;
-	} 
+	}
 	else if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
 		bPoseChannel *pchan = BKE_pose_channel_active(ob);
 		if (pchan)
@@ -807,7 +807,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
 	/* despite 3 layers of checks, we may still not be able to find a constraint */
 	if (data == NULL) {
 		printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
+		BKE_report(op->reports, RPT_ERROR, "Could not find constraint data for Child-Of Set Inverse");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -853,7 +853,7 @@ static int childof_clear_inverse_exec(bContext *C, wmOperator *op)
 	bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
 	
 	if (data == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
+		BKE_report(op->reports, RPT_ERROR, "Child Of constraint not found");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1028,7 +1028,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
 	/* despite 3 layers of checks, we may still not be able to find a constraint */
 	if (data == NULL) {
 		printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
+		BKE_report(op->reports, RPT_ERROR, "Could not find constraint data for Child-Of Set Inverse");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1073,7 +1073,7 @@ static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op)
 	bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
 
 	if (data == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
+		BKE_report(op->reports, RPT_ERROR, "Child Of constraint not found");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1628,15 +1628,15 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
 		return OPERATOR_CANCELLED;
 	}
 	if ((type == CONSTRAINT_TYPE_RIGIDBODYJOINT) && (list != &ob->constraints)) {
-		BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint Constraint can only be added to Objects");
+		BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint constraint can only be added to objects");
 		return OPERATOR_CANCELLED;
 	}
 	if ((type == CONSTRAINT_TYPE_KINEMATIC) && ((!pchan) || (list != &pchan->constraints))) {
-		BKE_report(op->reports, RPT_ERROR, "IK Constraint can only be added to Bones");
+		BKE_report(op->reports, RPT_ERROR, "IK constraint can only be added to bones");
 		return OPERATOR_CANCELLED;
 	}
 	if ((type == CONSTRAINT_TYPE_SPLINEIK) && ((!pchan) || (list != &pchan->constraints))) {
-		BKE_report(op->reports, RPT_ERROR, "Spline IK Constraint can only be added to Bones");
+		BKE_report(op->reports, RPT_ERROR, "Spline IK constraint can only be added to bones");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1856,7 +1856,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
 	
 	/* must have active bone */
 	if (ELEM(NULL, ob, pchan)) {
-		BKE_report(op->reports, RPT_ERROR, "Must have active bone to add IK Constraint to");
+		BKE_report(op->reports, RPT_ERROR, "Must have an active bone to add IK constraint to");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1865,7 +1865,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
 		if (con->type == CONSTRAINT_TYPE_KINEMATIC) break;
 	}
 	if (con) {
-		BKE_report(op->reports, RPT_ERROR, "Bone already has IK Constraint");
+		BKE_report(op->reports, RPT_ERROR, "Bone already has an IK constraint");
 		return OPERATOR_CANCELLED;
 	}
 	
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 43c6c33..d39e348 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -201,7 +201,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
 					ED_base_object_activate(C, NULL);
 				}
 			}
-		}	
+		}
 	}
 	CTX_DATA_END;
 
@@ -550,7 +550,8 @@ static int editmode_toggle_poll(bContext *C)
 	if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
 		return 0;
 
-	if (ob->restrictflag & OB_RESTRICT_VIEW)
+	/* if hidden but in edit mode, we still display */
+	if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT))
 		return 0;
 
 	return (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
@@ -684,7 +685,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
 			if (TESTBASELIB(v3d, base)) {
 				
 				/* first: free all logic */
-				free_sensors(&base->object->sensors);				
+				free_sensors(&base->object->sensors);
 				unlink_controllers(&base->object->controllers);
 				free_controllers(&base->object->controllers);
 				unlink_actuators(&base->object->actuators);
@@ -885,7 +886,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						id_us_plus((ID *)cu1->vfonti);
 						if (cu1->vfontbi) cu1->vfontbi->id.us--;
 						cu1->vfontbi = cu->vfontbi;
-						id_us_plus((ID *)cu1->vfontbi);						
+						id_us_plus((ID *)cu1->vfontbi);
 
 						BKE_vfont_to_curve(bmain, scene, base->object, 0); /* needed? */
 
@@ -988,7 +989,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 							cu1->flag |= CU_UV_ORCO;
 						else
 							cu1->flag &= ~CU_UV_ORCO;
-					}		
+					}
 				}
 				else if (event == 29) { /* protected bits */
 					base->object->protectflag = ob->protectflag;
@@ -1380,7 +1381,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d)
 						if (ma->mtex[b] && ma->mtex[b]->tex) {
 							tex = ma->mtex[b]->tex;
 							if (tex->type == TEX_IMAGE && tex->ima) {
-								ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, NULL);
+								ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, NULL, NULL);
 								
 								/* texturespace */
 								space = 1.0;
@@ -1401,7 +1402,9 @@ static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d)
 								else ob->size[1] = ob->size[0] * y / x;
 								
 								done = TRUE;
-								DAG_id_tag_update(&ob->id, OB_RECALC_OB);								
+								DAG_id_tag_update(&ob->id, OB_RECALC_OB);
+
+								BKE_image_release_ibuf(tex->ima, ibuf, NULL);
 							}
 						}
 						if (done) break;
@@ -1795,7 +1798,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	{
 		if (ob != ob_iter) {
 			/* first: free all logic */
-			free_sensors(&ob_iter->sensors);				
+			free_sensors(&ob_iter->sensors);
 			unlink_controllers(&ob_iter->controllers);
 			free_controllers(&ob_iter->controllers);
 			unlink_actuators(&ob_iter->actuators);
@@ -1864,7 +1867,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
 			ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0];
 			ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1];
 			ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2];
-			ob_iter->collision_boundtype = ob->collision_boundtype;			
+			ob_iter->collision_boundtype = ob->collision_boundtype;
 			ob_iter->margin = ob->margin;
 			ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
 			if (ob->restrictflag & OB_RESTRICT_RENDER) 
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index cca37cf..a3bf27a 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -195,7 +195,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
 		}
 	}
 	
-	if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
+	if (!ok) BKE_report(op->reports, RPT_ERROR, "Active object contains no groups");
 	
 	DAG_scene_sort(bmain, scene);
 	WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
@@ -211,7 +211,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
 	ot->idname = "GROUP_OT_objects_remove_active";
 	
 	/* api callbacks */
-	ot->exec = objects_remove_active_exec;	
+	ot->exec = objects_remove_active_exec;
 	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
@@ -333,7 +333,7 @@ void GROUP_OT_create(wmOperatorType *ot)
 	ot->idname = "GROUP_OT_create";
 	
 	/* api callbacks */
-	ot->exec = group_create_exec;	
+	ot->exec = group_create_exec;
 	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index a6afe6b..caeff1e 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -442,7 +442,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
 	ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
 
 	if (!ok) {
-		BKE_report(reports, RPT_ERROR, "Requires selected vertices or active Vertex Group");
+		BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group");
 		return FALSE;
 	}
 
@@ -515,12 +515,12 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
 	CTX_DATA_END;
 	
 	if (!obsel) {
-		BKE_report(op->reports, RPT_ERROR, "Can't add hook with no other selected objects");
+		BKE_report(op->reports, RPT_ERROR, "Cannot add hook with no other selected objects");
 		return OPERATOR_CANCELLED;
 	}
 
 	if (use_bone && obsel->type != OB_ARMATURE) {
-		BKE_report(op->reports, RPT_ERROR, "Can't add hook bone for a non armature object");
+		BKE_report(op->reports, RPT_ERROR, "Cannot add hook bone for a non armature object");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -590,7 +590,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
 
 	hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
 	if (!hmd) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier");
+		BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -667,13 +667,13 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
 	if (ptr.data) {     /* if modifier context is available, use that */
 		ob = ptr.id.data;
 		hmd = ptr.data;
-	} 
+	}
 	else {          /* use the provided property */
 		ob = CTX_data_edit_object(C);
 		hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
 	}
 	if (!ob || !hmd) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier");
+		BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -735,13 +735,13 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
 	if (ptr.data) {  /* if modifier context is available, use that */
 		ob = ptr.id.data;
 		hmd = ptr.data;
-	} 
+	}
 	else {  /* use the provided property */
 		ob = CTX_data_edit_object(C);
 		hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
 	}
 	if (!ob || !hmd) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier");
+		BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -793,13 +793,13 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
 	if (ptr.data) {     /* if modifier context is available, use that */
 		ob = ptr.id.data;
 		hmd = ptr.data;
-	} 
+	}
 	else {          /* use the provided property */
 		ob = CTX_data_edit_object(C);
 		hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
 	}
 	if (!ob || !hmd) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier");
+		BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -855,13 +855,13 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
 	if (ptr.data) {     /* if modifier context is available, use that */
 		ob = ptr.id.data;
 		hmd = ptr.data;
-	} 
+	}
 	else {          /* use the provided property */
 		ob = CTX_data_edit_object(C);
 		hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
 	}
 	if (!ob || !hmd) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier");
+		BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
 		return OPERATOR_CANCELLED;
 	}
 	
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 727286c..0be9c92 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -138,6 +138,7 @@ void OBJECT_OT_hook_recenter(struct wmOperatorType *ot);
 /* object_lattice.c */
 void LATTICE_OT_select_all(struct wmOperatorType *ot);
 void LATTICE_OT_make_regular(struct wmOperatorType *ot);
+void LATTICE_OT_flip(struct wmOperatorType *ot);
 
 /* object_group.c */
 void GROUP_OT_create(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 1f7be0b..4aa2e82 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -46,6 +46,7 @@
 #include "DNA_scene_types.h"
 
 #include "RNA_access.h"
+#include "RNA_define.h"
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
@@ -167,7 +168,7 @@ void load_editLatt(Object *obedit)
 	}
 }
 
-/************************** Operators *************************/
+/************************** Select All Operator *************************/
 
 void ED_setflagsLatt(Object *obedit, int flag)
 {
@@ -254,6 +255,8 @@ void LATTICE_OT_select_all(wmOperatorType *ot)
 	WM_operator_properties_select_all(ot);
 }
 
+/************************** Make Regular Operator *************************/
+
 static int make_regular_poll(bContext *C)
 {
 	Object *ob;
@@ -300,18 +303,265 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
+/************************** Flip Verts Operator *************************/
+
+/* flipping options */
+typedef enum eLattice_FlipAxes {
+	LATTICE_FLIP_U = 0,
+	LATTICE_FLIP_V = 1,
+	LATTICE_FLIP_W = 2
+} eLattice_FlipAxes;
+
+/* Helper macro for accessing item at index (u, v, w) 
+ * < lt: (Lattice)
+ * < U: (int) u-axis coordinate of point
+ * < V: (int) v-axis coordinate of point
+ * < W: (int) w-axis coordinate of point
+ * < dimU: (int) number of points per row or number of columns (U-Axis)
+ * < dimV: (int) number of rows (V-Axis)
+ * > returns: (BPoint *) pointer to BPoint at this index
+ */
+#define LATTICE_PT(lt, U, V, W, dimU, dimV)       \
+	( (lt)->def               +                   \
+	  ((dimU) * (dimV)) * (W) +                   \
+	  (dimU) * (V)            +                   \
+	  (U)                                         \
+	)
+	
+/* Flip midpoint value so that relative distances between midpoint and neighbour-pair is maintained
+ * ! Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes)
+ * - Helper for lattice_flip_exec()
+ */
+static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
+{
+	BPoint *bp;
+	float diff;
+	
+	/* just the point in the middle (unpaired) */
+	bp = LATTICE_PT(lt, u, v, w, lt->pntsu, lt->pntsv);
+	
+	/* flip over axis */
+	diff = mid - bp->vec[axis];
+	bp->vec[axis] = mid + diff;
+}
+
+/* Swap pairs of lattice points along a specified axis
+ * - Helper for lattice_flip_exec()
+ */
+static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
+{
+	BPoint *bpA, *bpB;
+	
+	int numU = lt->pntsu;
+	int numV = lt->pntsv;
+	int numW = lt->pntsw;
+	
+	int u0 = u, u1 = u;
+	int v0 = v, v1 = v;
+	int w0 = w, w1 = w;
+	
+	/* get pair index by just overriding the relevant pair-value
+	 * - "-1" else buffer overflow
+	 */
+	switch (axis) {
+		case LATTICE_FLIP_U:
+			u1 = numU - u - 1;
+			break;
+		case LATTICE_FLIP_V:
+			v1 = numV - v - 1;
+			break;
+		case LATTICE_FLIP_W:
+			w1 = numW - w - 1;
+			break;
+	}
+	
+	/* get points to operate on */
+	bpA = LATTICE_PT(lt, u0, v0, w0, numU, numV);
+	bpB = LATTICE_PT(lt, u1, v1, w1, numU, numV);
+	
+	/* Swap all coordinates, so that flipped coordinates belong to
+	 * the indices on the correct side of the lattice.
+	 *
+	 *   Coords:  (-2 4) |0| (3 4)   --> (3 4) |0| (-2 4) 
+	 *   Indices:  (0,L)     (1,R)   --> (0,L)     (1,R)
+	 */
+	swap_v3_v3(bpA->vec, bpB->vec);
+	
+	/* However, we need to mirror the coordinate values on the axis we're dealing with,
+	 * otherwise we'd have effectively only rotated the points around. If we don't do this,
+	 * we'd just be reimplementing the naive mirroring algorithm, which causes unwanted deforms
+	 * such as flipped normals, etc.
+	 *
+	 *   Coords:  (3 4) |0| (-2 4)  --\   
+	 *                                 \-> (-3 4) |0| (2 4)
+	 *   Indices: (0,L)     (1,R)   -->     (0,L)     (1,R)
+	 */
+	lattice_flip_point_value(lt, u0, v0, w0, mid, axis);
+	lattice_flip_point_value(lt, u1, v1, w1, mid, axis);
+}
+	
+static int lattice_flip_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	Lattice *lt;
+	
+	eLattice_FlipAxes axis = RNA_enum_get(op->ptr, "axis");
+	int numU, numV, numW;
+	int totP;
+	
+	float mid = 0.0f;
+	short isOdd = 0;
+	
+	/* get lattice - we need the "edit lattice" from the lattice... confusing... */
+	lt = (Lattice *)obedit->data;
+	lt = lt->editlatt->latt;
+	
+	numU = lt->pntsu;
+	numV = lt->pntsv;
+	numW = lt->pntsw;
+	totP = numU * numV * numW;
+	
+	/* First Pass: determine midpoint - used for flipping center verts if there are odd number of points on axis */
+	switch (axis) {
+		case LATTICE_FLIP_U:
+			isOdd = numU & 1;
+			break;
+		case LATTICE_FLIP_V:
+			isOdd = numV & 1;
+			break;
+		case LATTICE_FLIP_W:
+			isOdd = numW & 1;
+			break;
+			
+		default:
+			printf("lattice_flip(): Unknown flipping axis (%d)\n", axis);
+			return OPERATOR_CANCELLED;
+	}
+	
+	if (isOdd) {
+		BPoint *bp;
+		float avgInv = 1.0f / (float)totP;
+		int i;
+		
+		/* midpoint calculation - assuming that u/v/w are axis-aligned */
+		for (i = 0, bp = lt->def; i < totP; i++, bp++) {
+			mid += bp->vec[axis] * avgInv;
+		}
+	}
+	
+	/* Second Pass: swap pairs of vertices per axis, assuming they are all sorted */
+	switch (axis) {
+		case LATTICE_FLIP_U:
+		{
+			int u, v, w;
+			
+			/* v/w strips - front to back, top to bottom */
+			for (w = 0; w < numW; w++) {
+				for (v = 0; v < numV; v++) {
+					/* swap coordinates of pairs of vertices on u */
+					for (u = 0; u < (numU / 2); u++) {
+						lattice_swap_point_pairs(lt, u, v, w, mid, axis);
+					}
+					
+					/* flip u-coordinate of midpoint (i.e. unpaired point on u) */
+					if (isOdd) {
+						u = (numU / 2);
+						lattice_flip_point_value(lt, u, v, w, mid, axis);
+					}
+				}
+			}
+		}
+		break;
+		case LATTICE_FLIP_V:
+		{
+			int u, v, w;
+			
+			/* u/w strips - front to back, left to right */
+			for (w = 0; w < numW; w++) {
+				for (u = 0; u < numU; u++) {
+					/* swap coordinates of pairs of vertices on v */
+					for (v = 0; v < (numV / 2); v++) {
+						lattice_swap_point_pairs(lt, u, v, w, mid, axis);
+					}
+					
+					/* flip v-coordinate of midpoint (i.e. unpaired point on v) */
+					if (isOdd) {
+						v = (numV / 2);
+						lattice_flip_point_value(lt, u, v, w, mid, axis);
+					}
+				}
+			}
+		}
+		break;
+		case LATTICE_FLIP_W:
+		{
+			int u, v, w;
+			
+			for (v = 0; v < numV; v++) {
+				for (u = 0; u < numU; u++) {
+					/* swap coordinates of pairs of vertices on w */
+					for (w = 0; w < (numW / 2); w++) {
+						lattice_swap_point_pairs(lt, u, v, w, mid, axis);
+					}
+					
+					/* flip w-coordinate of midpoint (i.e. unpaired point on w) */
+					if (isOdd) {
+						w = (numW / 2);
+						lattice_flip_point_value(lt, u, v, w, mid, axis);
+					}
+				}
+			}
+		}
+		break;
+		
+		default: /* shouldn't happen, but just in case */
+			break;
+	}
+	
+	/* updates */
+	DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+	
+	return OPERATOR_FINISHED;
+}
+
+void LATTICE_OT_flip(wmOperatorType *ot)
+{
+	static EnumPropertyItem flip_items[] = {
+		{LATTICE_FLIP_U, "U", 0, "U (X) Axis", ""},
+		{LATTICE_FLIP_V, "V", 0, "V (Y) Axis", ""},
+		{LATTICE_FLIP_W, "W", 0, "W (Z) Axis", ""},
+		{0, NULL, 0, NULL, NULL}};
+	
+	/* identifiers */
+	ot->name = "Flip (Distortion Free)";
+	ot->description = "Mirror all control points without inverting the lattice deform";
+	ot->idname = "LATTICE_OT_flip";
+	
+	/* api callbacks */
+	ot->poll = ED_operator_editlattice;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = lattice_flip_exec;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* properties */
+	ot->prop = RNA_def_enum(ot->srna, "axis", flip_items, LATTICE_FLIP_U, "Flip Axis", "Coordinates along this axis get flipped");
+}
+
 /****************************** Mouse Selection *************************/
 
-static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y)
+static void findnearestLattvert__doClosest(void *userData, BPoint *bp, const float screen_co[2])
 {
-	struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData;
-	float temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+	struct { BPoint *bp; float dist; int select; float mval_fl[2]; } *data = userData;
+	float dist_test = len_manhattan_v2v2(data->mval_fl, screen_co);
 	
-	if ((bp->f1 & SELECT) == data->select)
-		temp += 5;
+	if ((bp->f1 & SELECT) && data->select)
+		dist_test += 5.0f;
 
-	if (temp < data->dist) {
-		data->dist = temp;
+	if (dist_test < data->dist) {
+		data->dist = dist_test;
 
 		data->bp = bp;
 	}
@@ -319,18 +569,18 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in
 
 static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
 {
-	/* sel==1: selected gets a disadvantage */
+	/* (sel == 1): selected gets a disadvantage */
 	/* in nurb and bezt or bp the nearest is written */
 	/* return 0 1 2: handlepunt */
-	struct { BPoint *bp; short dist, select; int mval[2]; } data = {NULL};
+	struct { BPoint *bp; float dist; int select; float mval_fl[2]; } data = {NULL};
 
 	data.dist = 100;
 	data.select = sel;
-	data.mval[0] = mval[0];
-	data.mval[1] = mval[1];
+	data.mval_fl[0] = mval[0];
+	data.mval_fl[1] = mval[1];
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-	lattice_foreachScreenVert(vc, findnearestLattvert__doClosest, &data);
+	lattice_foreachScreenVert(vc, findnearestLattvert__doClosest, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	return data.bp;
 }
@@ -341,7 +591,7 @@ int mouse_lattice(bContext *C, const int mval[2], int extend, int deselect, int
 	BPoint *bp = NULL;
 
 	view3d_set_viewcontext(C, &vc);
-	bp = findnearestLattvert(&vc, mval, 1);
+	bp = findnearestLattvert(&vc, mval, TRUE);
 
 	if (bp) {
 		if (extend) {
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index d75ef78..7d3d686 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -99,13 +99,13 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
 	
 	/* only geometry objects should be able to get modifiers [#25291] */
 	if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
-		BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name + 2);
+		BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to object '%s'", ob->id.name + 2);
 		return NULL;
 	}
 	
 	if (mti->flags & eModifierTypeFlag_Single) {
 		if (modifiers_findByType(ob, type)) {
-			BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed");
+			BKE_report(reports, RPT_WARNING, "Only one modifier of this type is allowed");
 			return NULL;
 		}
 	}
@@ -555,8 +555,8 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
 		Key *key = me->key;
 		KeyBlock *kb;
 		
-		if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
-			BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
+		if (!modifier_isSameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
+			BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to shapes");
 			return 0;
 		}
 		
@@ -604,7 +604,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
 		MultiresModifierData *mmd = find_multires_modifier_before(scene, md);
 
 		if (me->key && mti->type != eModifierTypeType_NonGeometrical) {
-			BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
+			BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to a mesh with shape keys");
 			return 0;
 		}
 
@@ -681,13 +681,20 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
 	int prev_mode;
 
 	if (scene->obedit) {
-		BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode");
+		BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in edit mode");
 		return 0;
 	}
 	else if (((ID *) ob->data)->us > 1) {
 		BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
 		return 0;
 	}
+	else if ((ob->mode & OB_MODE_SCULPT) &&
+	         (find_multires_modifier_before(scene, md)) &&
+	         (modifier_isSameTopology(md) == FALSE))
+	{
+		BKE_report(reports, RPT_ERROR, "Constructive modifier cannot be applied to multi-res data in sculpt mode");
+		return 0;
+	}
 
 	if (md != ob->modifiers.first)
 		BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected");
@@ -1000,7 +1007,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 	int apply_as = RNA_enum_get(op->ptr, "apply_as");
-	
+
 	if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
 		return OPERATOR_CANCELLED;
 	}
@@ -1242,7 +1249,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
 	CTX_DATA_END;
 
 	if (!secondob) {
-		BKE_report(op->reports, RPT_ERROR, "Second selected mesh object require to copy shape from");
+		BKE_report(op->reports, RPT_ERROR, "Second selected mesh object required to copy shape from");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 65d0c96..d19277d 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -211,6 +211,7 @@ void ED_operatortypes_object(void)
 
 	WM_operatortype_append(LATTICE_OT_select_all);
 	WM_operatortype_append(LATTICE_OT_make_regular);
+	WM_operatortype_append(LATTICE_OT_flip);
 
 	WM_operatortype_append(OBJECT_OT_group_add);
 	WM_operatortype_append(OBJECT_OT_group_link);
@@ -392,7 +393,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0);
 
-	// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
+	/* XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith */
 	WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
 	WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
@@ -424,6 +425,8 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 
 	WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
 	
+	WM_keymap_add_item(keymap, "LATTICE_OT_flip", FKEY, KM_PRESS, KM_CTRL, 0);
+	
 	/* menus */
 	WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
 
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 446c0a5..0988a19 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -423,29 +423,92 @@ void OBJECT_OT_proxy_make(wmOperatorType *ot)
 
 /********************** Clear Parent Operator ******************* */
 
+typedef enum eObClearParentTypes {
+	CLEAR_PARENT_ALL = 0,
+	CLEAR_PARENT_KEEP_TRANSFORM,
+	CLEAR_PARENT_INVERSE
+} eObClearParentTypes;
+
 EnumPropertyItem prop_clear_parent_types[] = {
-	{0, "CLEAR", 0, "Clear Parent", ""},
-	{1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation", ""},
-	{2, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""},
+	{CLEAR_PARENT_ALL, "CLEAR", 0, "Clear Parent", ""},
+	{CLEAR_PARENT_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation", ""},
+	{CLEAR_PARENT_INVERSE, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
-void ED_object_parent_clear(Object *ob, int type)
+/* Helper for ED_object_parent_clear() - Remove deform-modifiers associated with parent */
+static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
 {
+	if (ELEM3(par->type, OB_ARMATURE, OB_LATTICE, OB_CURVE)) {
+		ModifierData *md, *mdn;
+		
+		/* assume that we only need to remove the first instance of matching deform modifier here */
+		for (md = ob->modifiers.first; md; md = mdn) {
+			short free = FALSE;
+			
+			mdn = md->next;
+			
+			/* need to match types (modifier + parent) and references */
+			if ((md->type == eModifierType_Armature) && (par->type == OB_ARMATURE)) {
+				ArmatureModifierData *amd = (ArmatureModifierData *)md;
+				if (amd->object == par) {
+					free = TRUE;
+				}
+			}
+			else if ((md->type == eModifierType_Lattice) && (par->type == OB_LATTICE)) {
+				LatticeModifierData *lmd = (LatticeModifierData *)md;
+				if (lmd->object == par) {
+					free = TRUE;
+				}
+			}
+			else if ((md->type == eModifierType_Curve) && (par->type == OB_CURVE)) {
+				CurveModifierData *cmd = (CurveModifierData *)md;
+				if (cmd->object == par) {
+					free = TRUE;
+				}
+			}
+			
+			/* free modifier if match */
+			if (free) {
+				BLI_remlink(&ob->modifiers, md);
+				modifier_free(md);
+			}
+		}
+	}
+}
 
+void ED_object_parent_clear(Object *ob, int type)
+{
 	if (ob->parent == NULL)
 		return;
+	
+	switch (type) {
+		case CLEAR_PARENT_ALL:
+		{
+			/* for deformers, remove corresponding modifiers to prevent a large number of modifiers building up */
+			object_remove_parent_deform_modifiers(ob, ob->parent);
+			
+			/* clear parenting relationship completely */
+			ob->parent = NULL;
+		}
+		break;
 		
-	if (type == 0) {
-		ob->parent = NULL;
-	}
-	else if (type == 1) {
-		ob->parent = NULL;
-		BKE_object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
-	}
-	else if (type == 2)
-		unit_m4(ob->parentinv);
+		case CLEAR_PARENT_KEEP_TRANSFORM:
+		{
+			/* remove parent, and apply the parented transform result as object's local transforms */
+			ob->parent = NULL;
+			BKE_object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
+		}
+		break;
 		
+		case CLEAR_PARENT_INVERSE:
+		{
+			/* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state) is cleared */
+			unit_m4(ob->parentinv);
+		}
+		break;
+	}
+	
 	ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
 }
 
@@ -559,13 +622,13 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
 			/* fall back on regular parenting now (for follow only) */
 			if (partype == PAR_FOLLOW)
 				partype = PAR_OBJECT;
-		}		
+		}
 	}
 	else if (partype == PAR_BONE) {
 		pchan = BKE_pose_channel_active(par);
 		
 		if (pchan == NULL) {
-			BKE_report(reports, RPT_ERROR, "No active Bone");
+			BKE_report(reports, RPT_ERROR, "No active bone");
 			return 0;
 		}
 	}
@@ -580,8 +643,8 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
 
 			/* apply transformation of previous parenting */
 			if (keep_transform) {
-				 /* was removed because of bug [#23577],
-				  * but this can be handy in some cases too [#32616], so make optional */
+				/* was removed because of bug [#23577],
+				 * but this can be handy in some cases too [#32616], so make optional */
 				BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
 			}
 
@@ -604,25 +667,40 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
 				 * NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers
 				 */
 				ob->partype = PAROBJECT; /* note, dna define, not operator property */
-				//ob->partype= PARSKEL; /* note, dna define, not operator property */
+				//ob->partype = PARSKEL; /* note, dna define, not operator property */
 				
-				/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
+				/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses 
+				 * - We need to ensure that the modifier we're adding doesn't already exist, so we check this by
+				 *   assuming that the parent is selected too...
+				 */
 				// XXX currently this should only happen for meshes, curves, surfaces, and lattices - this stuff isn't available for metas yet
 				if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
 					ModifierData *md;
 					
 					switch (partype) {
 						case PAR_CURVE: /* curve deform */
-							md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
-							((CurveModifierData *)md)->object = par;
+							if ( modifiers_isDeformedByCurve(ob) != par) {
+								md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
+								if (md) {
+									((CurveModifierData *)md)->object = par;
+								}
+							}
 							break;
 						case PAR_LATTICE: /* lattice deform */
-							md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
-							((LatticeModifierData *)md)->object = par;
+							if (modifiers_isDeformedByLattice(ob) != par) {
+								md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
+								if (md) {
+									((LatticeModifierData *)md)->object = par;
+								}
+							}
 							break;
 						default: /* armature deform */
-							md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
-							((ArmatureModifierData *)md)->object = par;
+							if (modifiers_isDeformedByArmature(ob) != par) {
+								md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
+								if (md) {
+									((ArmatureModifierData *)md)->object = par;
+								}
+							}
 							break;
 					}
 				}
@@ -958,7 +1036,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
 	int type = RNA_enum_get(op->ptr, "type");
 
 	if (CTX_data_edit_object(C)) {
-		BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
+		BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 	CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -1182,7 +1260,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
 			base->object->lay = lay;
 			base->object->flag &= ~SELECT;
 			base->flag &= ~SELECT;
-			/* if (base->object->type==OB_LAMP) is_lamp = TRUE; */
+			/* if (base->object->type == OB_LAMP) is_lamp = TRUE; */
 		}
 		CTX_DATA_END;
 	}
@@ -1195,7 +1273,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
 			local = base->lay & 0xFF000000;
 			base->lay = lay + local;
 			base->object->lay = lay;
-			/* if (base->object->type==OB_LAMP) is_lamp = TRUE; */
+			/* if (base->object->type == OB_LAMP) is_lamp = TRUE; */
 		}
 		CTX_DATA_END;
 	}
@@ -1272,17 +1350,17 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
 	Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
 
 	if (scene_to == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't find scene");
+		BKE_report(op->reports, RPT_ERROR, "Could not find scene");
 		return OPERATOR_CANCELLED;
 	}
 
 	if (scene_to == CTX_data_scene(C)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
+		BKE_report(op->reports, RPT_ERROR, "Cannot link objects into the same scene");
 		return OPERATOR_CANCELLED;
 	}
 
 	if (scene_to->id.lib) {
-		BKE_report(op->reports, RPT_ERROR, "Can't link objects into a linked scene");
+		BKE_report(op->reports, RPT_ERROR, "Cannot link objects into a linked scene");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1632,7 +1710,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 						break;
 					case OB_MESH:
 						ob->data = BKE_mesh_copy(ob->data);
-						//me= ob->data;
+						//me = ob->data;
 						//if (me && me->key)
 						//	ipo_idnew(me->key->ipo);	/* drivers */
 						break;
@@ -2070,7 +2148,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
 	
 	DAG_ids_flush_update(bmain, 0);
 	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
-	WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma);
+	WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
 	
 	return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 4ed14c3..2aa737d 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -425,7 +425,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
 	
 	ob = OBACT;
 	if (ob == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No Active Object");
+		BKE_report(op->reports, RPT_ERROR, "No active object");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -608,11 +608,11 @@ static short select_grouped_group(bContext *C, Object *ob)  /* Select objects in
 
 	for (i = 0; i < group_count; i++) {
 		group = ob_groups[i];
-		uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name);
+		uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name + 2);
 	}
 
 	uiPupMenuEnd(C, pup);
-	return changed; // The operator already handle this!
+	return changed;  /* The operator already handle this! */
 }
 
 static short select_grouped_object_hooks(bContext *C, Object *ob)
@@ -754,8 +754,8 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
 		return 0;
 	
 	/* select each object that Keying Set refers to */
-	// TODO: perhaps to be more in line with the rest of these, we should only take objects 
-	// if the passed in object is included in this too
+	/* TODO: perhaps to be more in line with the rest of these, we should only take objects
+	 * if the passed in object is included in this too */
 	CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
 	{
 		/* only check for this object if it isn't selected already, to limit time wasted */
@@ -800,7 +800,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
 	
 	ob = OBACT;
 	if (ob == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No Active Object");
+		BKE_report(op->reports, RPT_ERROR, "No active object");
 		return OPERATOR_CANCELLED;
 	}
 	
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index cfd4945..6a511d4 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -137,9 +137,11 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
 	}
 	
 	if (key->totkey == 0) {
-		if (GS(key->from->name) == ID_ME) ((Mesh *)key->from)->key = NULL;
-		else if (GS(key->from->name) == ID_CU) ((Curve *)key->from)->key = NULL;
-		else if (GS(key->from->name) == ID_LT) ((Lattice *)key->from)->key = NULL;
+		switch (GS(key->from->name)) {
+			case ID_ME: ((Mesh *)key->from)->key    = NULL; break;
+			case ID_CU: ((Curve *)key->from)->key   = NULL; break;
+			case ID_LT: ((Lattice *)key->from)->key = NULL; break;
+		}
 
 		BKE_libblock_free_us(&(bmain->key), key);
 	}
@@ -162,15 +164,15 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
 	kb = BLI_findlink(&key->block, ob->shapenr - 1);
 
 	if (kb) {
-		int i1, i2;
-		float *fp1, *fp2;
-		float tvec[3];
 		char *tag_elem = MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
 
 
 		if (ob->type == OB_MESH) {
 			Mesh *me = ob->data;
 			MVert *mv;
+			int i1, i2;
+			float *fp1, *fp2;
+			float tvec[3];
 
 			mesh_octree_table(ob, NULL, NULL, 's');
 
@@ -211,7 +213,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
 			/* currently editmode isn't supported by mesh so
 			 * ignore here for now too */
 
-			/* if (lt->editlatt) lt= lt->editlatt->latt; */
+			/* if (lt->editlatt) lt = lt->editlatt->latt; */
 
 			for (w = 0; w < lt->pntsw; w++) {
 				for (v = 0; v < lt->pntsv; v++) {
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1b08235..900bf57 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -171,7 +171,7 @@ static void object_clear_rot(Object *ob)
 			}
 		}
 	}                        // Duplicated in source/blender/editors/armature/editarmature.c
-	else { 
+	else {
 		if (ob->rotmode == ROT_MODE_QUAT) {
 			unit_qt(ob->quat);
 			unit_qt(ob->dquat);
@@ -217,7 +217,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
 	
 	/* sanity checks */
 	if (ELEM(NULL, clear_func, default_ksName)) {
-		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform func or Keying Set Name");
+		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform function or keying set name");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -381,8 +381,8 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 {
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
-	float rsmat[3][3], tmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
-	int a, change = 1;
+	float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
+	int change = 1;
 	
 	/* first check if we can execute */
 	CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -390,19 +390,19 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 
 		if (ob->type == OB_MESH) {
 			if (ID_REAL_USERS(ob->data) > 1) {
-				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing");
+				BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user mesh, doing nothing");
 				change = 0;
 			}
 		}
 		else if (ob->type == OB_ARMATURE) {
 			if (ID_REAL_USERS(ob->data) > 1) {
-				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing");
+				BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user armature, doing nothing");
 				change = 0;
 			}
 		}
 		else if (ob->type == OB_LATTICE) {
 			if (ID_REAL_USERS(ob->data) > 1) {
-				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user lattice, doing nothing");
+				BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user lattice, doing nothing");
 				change = 0;
 			}
 		}
@@ -410,18 +410,19 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 			Curve *cu;
 
 			if (ID_REAL_USERS(ob->data) > 1) {
-				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing");
+				BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user curve, doing nothing");
 				change = 0;
 			}
 
 			cu = ob->data;
 
 			if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
-				BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing");
+				BKE_report(reports, RPT_ERROR,
+				           "Neither rotation nor location could be applied to a 2D curve, doing nothing");
 				change = 0;
 			}
 			if (cu->key) {
-				BKE_report(reports, RPT_ERROR, "Can't apply to a curve with vertex keys, doing nothing");
+				BKE_report(reports, RPT_ERROR, "Cannot apply to a curve with vertex keys, doing nothing");
 				change = 0;
 			}
 		}
@@ -464,6 +465,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 			copy_v3_v3(mat[3], ob->loc);
 
 			if (!(apply_scale && apply_rot)) {
+				float tmat[3][3];
 				/* correct for scale and rotation that is still applied */
 				BKE_object_to_mat3(ob, obmat);
 				invert_m3_m3(iobmat, obmat);
@@ -476,6 +478,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 		if (ob->type == OB_MESH) {
 			Mesh *me = ob->data;
 			MVert *mvert;
+			int a;
 
 			if (apply_scale)
 				multiresModifier_scale_disp(scene, ob);
@@ -518,6 +521,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 			Nurb *nu;
 			BPoint *bp;
 			BezTriple *bezt;
+			int a;
 
 			scale = mat3_to_scale(rsmat);
 
@@ -650,7 +654,8 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
 enum {
 	GEOMETRY_TO_ORIGIN = 0,
 	ORIGIN_TO_GEOMETRY,
-	ORIGIN_TO_CURSOR
+	ORIGIN_TO_CURSOR,
+	ORIGIN_TO_CENTER_OF_MASS
 };
 
 static int object_origin_set_exec(bContext *C, wmOperator *op)
@@ -667,7 +672,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 	int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
 
 	if (obedit && centermode != GEOMETRY_TO_ORIGIN) {
-		BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
+		BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -781,6 +786,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				Mesh *me = ob->data;
 
 				if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+				else if (centermode == ORIGIN_TO_CENTER_OF_MASS) { BKE_mesh_center_centroid(me, cent); }
 				else if (around == V3D_CENTROID) { BKE_mesh_center_median(me, cent); }
 				else { BKE_mesh_center_bounds(me, cent); }
 
@@ -848,7 +854,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 				if (ID_REAL_USERS(arm) > 1) {
 #if 0
-					BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature");
+					BKE_report(op->reports, RPT_ERROR, "Cannot apply to a multi user armature");
 					return;
 #endif
 					tot_multiuser_arm_error++;
@@ -861,7 +867,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 					tot_change++;
 					arm->id.flag |= LIB_DOIT;
-					/* do_inverse_offset= TRUE; */ /* docenter_armature() handles this */
+					/* do_inverse_offset = TRUE; */ /* docenter_armature() handles this */
 
 					BKE_object_where_is_calc(scene, ob);
 					BKE_pose_where_is(scene, ob); /* needed for bone parents */
@@ -896,10 +902,17 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 			/* offset other selected objects */
 			if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
+				CollectionPointerLink *ctx_link_other;
+				float obmat[4][4];
+
 				/* was the object data modified
 				 * note: the functions above must set 'cent' */
+
+				/* convert the offset to parent space */
+				BKE_object_to_mat4(ob, obmat);
 				copy_v3_v3(centn, cent);
-				mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */
+				mul_mat3_m4_v3(obmat, centn); /* omit translation part */
+
 				add_v3_v3(ob->loc, centn);
 
 				BKE_object_where_is_calc(scene, ob);
@@ -910,8 +923,16 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				ignore_parent_tx(bmain, scene, ob);
 				
 				/* other users? */
-				CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects)
+				//CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects)
+				//{
+
+				/* use existing context looper */
+				for (ctx_link_other = ctx_data_list.first;
+				     ctx_link_other;
+				     ctx_link_other = ctx_link_other->next)
 				{
+					Object *ob_other = ctx_link_other->ptr.data;
+
 					if ((ob_other->flag & OB_DONE) == 0 &&
 					    ((ob->data && (ob->data == ob_other->data)) ||
 					     (ob->dup_group == ob_other->dup_group &&
@@ -931,7 +952,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 						ignore_parent_tx(bmain, scene, ob_other);
 					}
 				}
-				CTX_DATA_END;
+				//CTX_DATA_END;
 			}
 		}
 	}
@@ -948,9 +969,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 	/* Warn if any errors occurred */
 	if (tot_lib_error + tot_multiuser_arm_error) {
-		BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
+		BKE_reportf(op->reports, RPT_WARNING, "%i object(s) not centered, %i changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
 		if (tot_lib_error)
-			BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects", tot_lib_error);
+			BKE_reportf(op->reports, RPT_WARNING, "|%i linked library object(s)", tot_lib_error);
 		if (tot_multiuser_arm_error)
 			BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)", tot_multiuser_arm_error);
 	}
@@ -966,6 +987,8 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
 		                     "Move object origin to center of object geometry"},
 		{ORIGIN_TO_CURSOR, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor",
 		                   "Move object origin to position of the 3D cursor"},
+		{ORIGIN_TO_CENTER_OF_MASS, "ORIGIN_CENTER_OF_MASS", 0, "Origin to Center of Mass",
+		                           "Move object origin to the object center of mass (assuming uniform density)"},
 		{0, NULL, 0, NULL, NULL}
 	};
 	
@@ -992,4 +1015,3 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
 	ot->prop = RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", "");
 	RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", "");
 }
-
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index dea7eb9..1b135c0 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -138,21 +138,12 @@ bDeformGroup *ED_vgroup_add(Object *ob)
 
 void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup) 
 {
-	bDeformGroup *dg = (bDeformGroup *)ob->defbase.first;
-
-	while (dg) {
-		if (dg == defgroup)
-			break;
-		dg = dg->next;
-	}
-
-	if (dg == NULL)
-		return;
+	BLI_assert(BLI_findindex(&ob->defbase, defgroup) != -1);
 
 	if (ED_vgroup_object_is_edit_mode(ob))
-		vgroup_delete_edit_mode(ob, dg);
+		vgroup_delete_edit_mode(ob, defgroup);
 	else
-		vgroup_delete_object_mode(ob, dg);
+		vgroup_delete_object_mode(ob, defgroup);
 }
 
 void ED_vgroup_clear(Object *ob)
@@ -405,46 +396,41 @@ typedef enum WT_Method {
 
 typedef enum WT_ReplaceMode {
 	WT_REPLACE_ALL_WEIGHTS = 1,
-	WT_REPLACE_EMPTY_WEIGHTS = 2,
-	WT_REPLACE_SELECTED_WEIGHTS = 3
+	WT_REPLACE_EMPTY_WEIGHTS = 2
 } WT_ReplaceMode;
 
 static EnumPropertyItem WT_vertex_group_mode_item[] = {
-    {WT_REPLACE_ACTIVE_VERTEX_GROUP, "WT_REPLACE_ACTIVE_VERTEX_GROUP", 1, "Active", "Transfer active vertex group from selected to active mesh."},
-    {WT_REPLACE_ALL_VERTEX_GROUPS, "WT_REPLACE_ALL_VERTEX_GROUPS", 1, "All", "Transfer all vertex groups from selected to active mesh."},
-    {0, NULL, 0, NULL, NULL}
+	{WT_REPLACE_ACTIVE_VERTEX_GROUP, "WT_REPLACE_ACTIVE_VERTEX_GROUP", 0, "Active", "Transfer active vertex group from selected to active mesh"},
+	{WT_REPLACE_ALL_VERTEX_GROUPS, "WT_REPLACE_ALL_VERTEX_GROUPS", 0, "All", "Transfer all vertex groups from selected to active mesh"},
+	{0, NULL, 0, NULL, NULL}
 };
 
 static EnumPropertyItem WT_method_item[] = {
-    {WT_BY_INDEX, "WT_BY_INDEX", 1, "Vertex index", "Copy for identical meshes."},
-    {WT_BY_NEAREST_VERTEX, "WT_BY_NEAREST_VERTEX", 1, "Nearest vertex", "Copy weight from closest vertex."},
-    {WT_BY_NEAREST_FACE, "WT_BY_NEAREST_FACE", 1, "Nearest face", "Barycentric interpolation from nearest face."},
-    {WT_BY_NEAREST_VERTEX_IN_FACE, "WT_BY_NEAREST_VERTEX_IN_FACE", 1, "Nearest vertex in face", "Copy weight from closest vertex in nearest face."},
-    {0, NULL, 0, NULL, NULL}
+	{WT_BY_INDEX, "WT_BY_INDEX", 0, "Vertex index", "Copy for identical meshes"},
+	{WT_BY_NEAREST_VERTEX, "WT_BY_NEAREST_VERTEX", 0, "Nearest vertex", "Copy weight from closest vertex"},
+	{WT_BY_NEAREST_FACE, "WT_BY_NEAREST_FACE", 0, "Nearest face", "Barycentric interpolation from nearest face"},
+	{WT_BY_NEAREST_VERTEX_IN_FACE, "WT_BY_NEAREST_VERTEX_IN_FACE", 0, "Nearest vertex in face", "Copy weight from closest vertex in nearest face"},
+	{0, NULL, 0, NULL, NULL}
 };
 
 static EnumPropertyItem WT_replace_mode_item[] = {
-    {WT_REPLACE_ALL_WEIGHTS, "WT_REPLACE_ALL_WEIGHTS", 1, "All", "Overwrites all weights."},
-    {WT_REPLACE_EMPTY_WEIGHTS, "WT_REPLACE_EMPTY_WEIGHTS", 1, "Empty", "Adds weights to vertices with no weight."},
-    {WT_REPLACE_SELECTED_WEIGHTS, "WT_REPLACE_SELECTED_WEIGHTS", 1, "Selected", "Replace selected weights."},
-    {0, NULL, 0, NULL, NULL}
+	{WT_REPLACE_ALL_WEIGHTS, "WT_REPLACE_ALL_WEIGHTS", 0, "All", "Overwrite all weights"},
+	{WT_REPLACE_EMPTY_WEIGHTS, "WT_REPLACE_EMPTY_WEIGHTS", 0, "Empty", "Add weights to vertices with no weight"},
+	{0, NULL, 0, NULL, NULL}
 };
 
 /*copy weight*/
-static void vgroup_transfer_weight(MVert *mv_dst, float *weight_dst, float weight_src, WT_ReplaceMode replace_mode)
+static void vgroup_transfer_weight(float *r_weight_dst, const float weight_src, const WT_ReplaceMode replace_mode)
 {
 	switch (replace_mode) {
-
 		case WT_REPLACE_ALL_WEIGHTS:
-			*weight_dst = weight_src;
+			*r_weight_dst = weight_src;
 			break;
 
 		case WT_REPLACE_EMPTY_WEIGHTS:
-			if (*weight_dst == 0) *weight_dst = weight_src;
-			break;
-
-		case WT_REPLACE_SELECTED_WEIGHTS:
-			if (mv_dst->flag & SELECT) *weight_dst = weight_src;
+			if (*r_weight_dst == 0.0f) {
+				*r_weight_dst = weight_src;
+			}
 			break;
 
 		default:
@@ -469,9 +455,10 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 	int dv_tot_src, dv_tot_dst, i, v_index, index_dst, index_src, index_nearest, index_nearest_vertex;
 	unsigned int f_index;
 	float weight, tmp_weight[4], tmp_co[3], normal[3], tmp_mat[4][4], dist_v1, dist_v2, dist_v3, dist_v4;
+	const int use_vert_sel = vertex_group_use_vert_sel(ob_dst);
 
 	/* create new and overwrite vertex group on destination without data */
-	if (!defgroup_find_name(ob_dst, dg_src->name) || replace_mode == WT_REPLACE_ALL_WEIGHTS) {
+	if (!defgroup_find_name(ob_dst, dg_src->name)) {
 		ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_src->name));
 		ED_vgroup_add_name(ob_dst, dg_src->name);
 	}
@@ -486,7 +473,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 
 	/* sanity check */
 	if (!me_src->dvert) {
-		BKE_reportf(op->reports, RPT_ERROR, "Transfer failed. Source mesh does not have any vertex groups");
+		BKE_report(op->reports, RPT_ERROR, "Transfer failed (source mesh does not have any vertex groups)");
 		return 0;
 	}
 
@@ -495,7 +482,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 
 	/* get vertex group arrays */
 	ED_vgroup_give_parray(ob_src->data, &dv_array_src, &dv_tot_src, FALSE);
-	ED_vgroup_give_parray(ob_dst->data, &dv_array_dst, &dv_tot_dst, FALSE);
+	ED_vgroup_give_parray(ob_dst->data, &dv_array_dst, &dv_tot_dst, use_vert_sel);
 
 	/* get indexes of vertex groups */
 	index_src = BLI_findindex(&ob_src->defbase, dg_src);
@@ -511,9 +498,13 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 
 	/* clear weights */
 	if (replace_mode == WT_REPLACE_ALL_WEIGHTS) {
-		for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++) {
-			dw_dst = defvert_verify_index(*dv_dst, index_dst);
-			if (dw_dst) (*dw_dst).weight = 0;
+		for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++) {
+
+			if (*dv_dst == NULL) continue;
+
+			dw_dst = defvert_find_index(*dv_dst, index_dst);
+			/* remove vertex from group */
+			if (dw_dst) defvert_remove_group(*dv_dst, dw_dst);
 		}
 	}
 
@@ -528,18 +519,22 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 				if (dv_array_src) MEM_freeN(dv_array_src);
 				if (dv_array_dst) MEM_freeN(dv_array_dst);
 				dmesh_src->release(dmesh_src);
-				BKE_reportf(op->reports, RPT_ERROR, "Transfer failed. Indices are not matching");
+				BKE_report(op->reports, RPT_ERROR, "Transfer failed (indices are not matching)");
 				return 0;
 			}
 
 			/* loop through the vertices*/
-			for(i = 0, dv_src = dv_array_src, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, dv_src++, mv_src++) {
+			for (i = 0, dv_src = dv_array_src, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, dv_src++, mv_src++, mv_dst++) {
+
+				if (*dv_dst == NULL) {
+					continue;
+				}
 
 				/* copy weight */
 				dw_src = defvert_find_index(*dv_src, index_src);
 				if (dw_src && dw_src->weight) {
 					dw_dst = defvert_verify_index(*dv_dst, index_dst);
-					vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode);
+					vgroup_transfer_weight(&dw_dst->weight, dw_src->weight, replace_mode);
 				}
 			}
 			break;
@@ -549,11 +544,15 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 			bvhtree_from_mesh_verts(&tree_mesh_vertices_src, dmesh_src, FLT_EPSILON, 2, 6);
 
 			/* loop trough vertices */
-			for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++){
+			for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
+
+				if (*dv_dst == NULL) {
+					continue;
+				}
 
 				/* reset nearest */
 				nearest.dist = FLT_MAX;
-				/* With current binary tree its marginally faster to start searching at the top, as opposed to previous search. */
+				/* with current binary tree its marginally faster to start searching at the top, as opposed to previous search. */
 				nearest.index = -1;
 
 				/* transform into target space */
@@ -567,7 +566,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 				dw_src = defvert_find_index(dv_array_src[nearest.index], index_src);
 				if (dw_src && dw_src->weight) {
 					dw_dst = defvert_verify_index(*dv_dst, index_dst);
-					vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode);
+					vgroup_transfer_weight(&dw_dst->weight, dw_src->weight, replace_mode);
 				}
 			}
 
@@ -584,11 +583,15 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 			bvhtree_from_mesh_faces(&tree_mesh_faces_src, dmesh_src, FLT_EPSILON, 2, 6);
 
 			/* loop through the vertices */
-			for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
+			for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
+
+				if (*dv_dst == NULL) {
+					continue;
+				}
 
 				/* reset nearest */
 				nearest.dist = FLT_MAX;
-				/* With current binary tree its marginally faster to start searching at the top, as opposed to previous search. */
+				/* with current binary tree its marginally faster to start searching at the top, as opposed to previous search. */
 				nearest.index = -1;
 
 				/* transform into target space */
@@ -623,7 +626,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 				/* copy weight that are not NULL including weight value 0. Existing target weights are overwritten prior to this in relevant cases. */
 				if (weight > 0) {
 					dw_dst = defvert_verify_index(*dv_dst, index_dst);
-					vgroup_transfer_weight(mv_dst, &dw_dst->weight, weight, replace_mode);
+					vgroup_transfer_weight(&dw_dst->weight, weight, replace_mode);
 				}
 			}
 
@@ -640,7 +643,11 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 			bvhtree_from_mesh_faces(&tree_mesh_faces_src, dmesh_src, FLT_EPSILON, 2, 6);
 
 			/* loop through the vertices */
-			for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++){
+			for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
+
+				if (*dv_dst == NULL) {
+					continue;
+				}
 
 				/* reset nearest */
 				nearest.dist = FLT_MAX;
@@ -677,7 +684,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
 				dw_src = defvert_find_index(dv_array_src[index_nearest_vertex], index_src);
 				if (dw_src && dw_src->weight) {
 					dw_dst = defvert_verify_index(*dv_dst, index_dst);
-					vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode);
+					vgroup_transfer_weight(&dw_dst->weight, dw_src->weight, replace_mode);
 				}
 			}
 
@@ -838,25 +845,26 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
 static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
 {
 	MDeformVert *dv = NULL;
-	BMVert *eve;
-	Mesh *me;
 
 	/* get the deform vertices corresponding to the vertnum */
 	if (ob->type == OB_MESH) {
-		me = ob->data;
+		Mesh *me = ob->data;
 
 		if (me->edit_btmesh) {
-			eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
+			/* warning, this lookup is _not_ fast */
+			BMVert *eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
 			if (!eve) {
 				return 0.0f;
 			}
 			dv = CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 		}
 		else {
-			if (vertnum >= me->totvert) {
-				return 0.0f;
+			if (me->dvert) {
+				if (vertnum >= me->totvert) {
+					return 0.0f;
+				}
+				dv = &me->dvert[vertnum];
 			}
-			dv = &me->dvert[vertnum];
 		}
 	}
 	else if (ob->type == OB_LATTICE) {
@@ -902,7 +910,6 @@ void ED_vgroup_select_by_name(Object *ob, const char *name)
 static void vgroup_select_verts(Object *ob, int select)
 {
 	const int def_nr = ob->actdef - 1;
-	MDeformVert *dv;
 
 	if (!BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -918,7 +925,7 @@ static void vgroup_select_verts(Object *ob, int select)
 
 			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
 				if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
-					dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+					MDeformVert *dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 					if (defvert_find_index(dv, def_nr)) {
 						BM_vert_select_set(em->bm, eve, select);
 					}
@@ -926,7 +933,7 @@ static void vgroup_select_verts(Object *ob, int select)
 			}
 
 			/* this has to be called, because this function operates on vertices only */
-			if (select) EDBM_select_flush(em);  // vertices to edges/faces
+			if (select) EDBM_select_flush(em);  /* vertices to edges/faces */
 			else EDBM_deselect_flush(em);
 		}
 		else {
@@ -955,6 +962,7 @@ static void vgroup_select_verts(Object *ob, int select)
 		Lattice *lt = vgroup_edit_lattice(ob);
 		
 		if (lt->dvert) {
+			MDeformVert *dv;
 			BPoint *bp;
 			int a, tot;
 			
@@ -1046,7 +1054,7 @@ static void vgroup_normalize(Object *ob)
 
 			dw = defvert_find_index(dv, def_nr);
 			if (dw) {
-				weight_max = MAX2(dw->weight, weight_max);
+				weight_max = max_ff(dw->weight, weight_max);
 			}
 		}
 
@@ -1158,23 +1166,24 @@ static void getVerticalAndHorizontalChange(const float norm[3], float d, const f
                                            const float start[3], float distToStart,
                                            float *end, float (*changes)[2], float *dists, int index)
 {
-	// A=Q-((Q-P).N)N
-	// D = (a*x0 + b*y0 +c*z0 +d)
+	/* A = Q - ((Q - P).N)N
+	 * D = (a * x0 + b * y0 +c * z0 + d) */
 	float projA[3], projB[3];
 
 	closest_to_plane_v3(projA, coord, norm, start);
 	closest_to_plane_v3(projB, coord, norm, end);
-	// (vertical and horizontal refer to the plane's y and xz respectively)
-	// vertical distance
+	/* (vertical and horizontal refer to the plane's y and xz respectively)
+	 * vertical distance */
 	dists[index] = dot_v3v3(norm, end) + d;
-	// vertical change
+	/* vertical change */
 	changes[index][0] = dists[index] - distToStart;
 	//printf("vc %f %f\n", distance(end, projB, 3)-distance(start, projA, 3), changes[index][0]);
-	// horizontal change
+	/* horizontal change */
 	changes[index][1] = len_v3v3(projA, projB);
 }
 
-// I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc)
+/* I need the derived mesh to be forgotten so the positions are recalculated
+ * with weight changes (see dm_deform_recalc) */
 static void dm_deform_clear(DerivedMesh *dm, Object *ob)
 {
 	if (ob->derivedDeform && (ob->derivedDeform) == dm) {
@@ -1295,7 +1304,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 				}
 			}
 		}
-		// sort the changes by the vertical change
+		/* sort the changes by the vertical change */
 		for (k = 0; k < totweight; k++) {
 			float tf;
 			int ti;
@@ -1307,7 +1316,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 					bestIndex = i;
 				}
 			}
-			// switch with k
+			/* switch with k */
 			if (bestIndex != k) {
 				ti = upDown[k];
 				upDown[k] = upDown[bestIndex];
@@ -1634,11 +1643,11 @@ static void vgroup_blend(Object *ob, const float fac)
 					/* i1 is always the selected one */
 					if (sel1) {
 						i1 = BM_elem_index_get(eed->v1);
-						/* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */
+						/* i2 = BM_elem_index_get(eed->v2); */ /* UNUSED */
 						eve = eed->v2;
 					}
 					else {
-						/* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */
+						/* i2 = BM_elem_index_get(eed->v1); */ /* UNUSED */
 						i1 = BM_elem_index_get(eed->v2);
 						eve = eed->v1;
 					}
@@ -2435,7 +2444,6 @@ static void vgroup_delete_all(Object *ob)
 /* only in editmode */
 static void vgroup_assign_verts(Object *ob, const float weight)
 {
-	MDeformVert *dv;
 	const int def_nr = ob->actdef - 1;
 
 	if (!BLI_findlink(&ob->defbase, def_nr))
@@ -2455,6 +2463,7 @@ static void vgroup_assign_verts(Object *ob, const float weight)
 			/* Go through the list of editverts and assign them */
 			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
 				if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+					MDeformVert *dv;
 					MDeformWeight *dw;
 					dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
 					dw = defvert_verify_index(dv, def_nr);
@@ -2489,6 +2498,7 @@ static void vgroup_assign_verts(Object *ob, const float weight)
 	}
 	else if (ob->type == OB_LATTICE) {
 		Lattice *lt = vgroup_edit_lattice(ob);
+		MDeformVert *dv;
 		BPoint *bp;
 		int a, tot;
 
@@ -2564,7 +2574,7 @@ static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ED_vgroup_add(ob);
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 	
 	return OPERATOR_FINISHED;
@@ -2595,7 +2605,7 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
 		vgroup_delete(ob);
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 	
 	return OPERATOR_FINISHED;
@@ -2761,7 +2771,7 @@ static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	vgroup_duplicate(ob);
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -3109,7 +3119,7 @@ static int vertex_group_limit_total_exec(bContext *C, wmOperator *op)
 		return OPERATOR_FINISHED;
 	}
 	else {
-		BKE_reportf(op->reports, RPT_WARNING, "No vertex groups limited");
+		BKE_report(op->reports, RPT_WARNING, "No vertex groups limited");
 
 		/* note, would normally return cancelled, except we want the redo
 		 * UI to show up for users to change */
@@ -3122,7 +3132,7 @@ void OBJECT_OT_vertex_group_limit_total(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Limit Number of Weights per Vertex";
 	ot->idname = "OBJECT_OT_vertex_group_limit_total";
-	ot->description = "Limits deform weights associated with a vertex to a specified number by removing lowest weights";
+	ot->description = "Limit deform weights associated with a vertex to a specified number by removing lowest weights";
 
 	/* api callbacks */
 	ot->poll = vertex_group_poll;
@@ -3189,7 +3199,7 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
 
 				DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
 				WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, base->object);
-				WM_event_add_notifier(C, NC_GEOM | ND_DATA, base->object->data);
+				WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, base->object->data);
 
 				retval = OPERATOR_FINISHED;
 			}
@@ -3231,7 +3241,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
 
 	if ((change == 0 && fail == 0) || fail) {
 		BKE_reportf(op->reports, RPT_ERROR,
-		            "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices",
+		            "Copy VGroups to Selected warning, %d done, %d failed (object data must have matching indices)",
 		            change, fail);
 	}
 
@@ -3316,7 +3326,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_transfer_weight(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Transfer weight";
+	ot->name = "Transfer Weights";
 	ot->idname = "OBJECT_OT_vertex_group_transfer_weight";
 	ot->description = "Transfer weight paint to active from selected mesh";
 
@@ -3346,7 +3356,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
 	ob->actdef = nr + 1;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+	WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -3452,7 +3462,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
 			}
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR, "Editmode lattice isn't supported yet");
+			BKE_report(op->reports, RPT_ERROR, "Editmode lattice is not supported yet");
 			MEM_freeN(sort_map_update);
 			return OPERATOR_CANCELLED;
 		}
@@ -3510,7 +3520,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
 
 	if (ret != OPERATOR_CANCELLED) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-		WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+		WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
 	}
 
 	if (name_array) MEM_freeN(name_array);
@@ -3565,7 +3575,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
 
 	if (ret != OPERATOR_CANCELLED) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-		WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+		WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
 	}
 
 	return ret;
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 4d43c61..da12a26 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -20,6 +20,7 @@
 
 set(INC
 	../include
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader
@@ -54,4 +55,8 @@ if(WITH_OPENMP)
 	add_definitions(-DPARALLEL=1)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript
index 9fe6cff..fffe05d 100644
--- a/source/blender/editors/physics/SConscript
+++ b/source/blender/editors/physics/SConscript
@@ -3,12 +3,12 @@ Import ('env')
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../gpu ../../blenloader ../../bmesh'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
 
-defs = ''
+defs = []
 
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
@@ -17,9 +17,11 @@ if env['OURPLATFORM'] == 'linux':
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
-
 if env['OURPLATFORM'] == 'darwin':
     if env['WITH_BF_OPENMP']:
-       defs += ' PARALLEL=1'
+       defs.append('PARALLEL=1')
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
 
-env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), Split(defs), libtype=['core'], priority=[45] )
+env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), defs, libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 70fe87e..c51b3ca 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -26,6 +26,8 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_dynamicpaint_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
@@ -73,9 +75,9 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
 
 	/* set preview for this surface only and set active */
 	canvas->active_sur = 0;
-	for (surface=surface->prev; surface; surface=surface->prev) {
-				surface->flags &= ~MOD_DPAINT_PREVIEW;
-				canvas->active_sur++;
+	for (surface = surface->prev; surface; surface = surface->prev) {
+		surface->flags &= ~MOD_DPAINT_PREVIEW;
+		canvas->active_sur++;
 	}
 
 	return OPERATOR_FINISHED;
@@ -94,26 +96,26 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
 	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	DynamicPaintModifierData *pmd = NULL;
-	Object *cObject = ED_object_context(C);
+	Object *obj_ctx = ED_object_context(C);
 	DynamicPaintCanvasSettings *canvas;
 	DynamicPaintSurface *surface;
-	int id=0;
+	int id = 0;
 
 	/* Make sure we're dealing with a canvas */
-	pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
+	pmd = (DynamicPaintModifierData *)modifiers_findByType(obj_ctx, eModifierType_DynamicPaint);
 	if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
 
 	canvas = pmd->canvas;
 	surface = canvas->surfaces.first;
 
 	/* find active surface and remove it */
-	for (; surface; surface=surface->next) {
+	for (; surface; surface = surface->next) {
 		if (id == canvas->active_sur) {
 				canvas->active_sur -= 1;
 				dynamicPaint_freeSurface(surface);
@@ -123,8 +125,8 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	dynamicPaint_resetPreview(canvas);
-	DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
+	DAG_id_tag_update(&obj_ctx->id, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx);
 
 	return OPERATOR_FINISHED;
 }
@@ -142,7 +144,7 @@ void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
 	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int type_toggle_exec(bContext *C, wmOperator *op)
@@ -151,7 +153,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
 	Object *cObject = ED_object_context(C);
 	Scene *scene = CTX_data_scene(C);
 	DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
-	int type= RNA_enum_get(op->ptr, "type");
+	int type = RNA_enum_get(op->ptr, "type");
 
 	if (!pmd) return OPERATOR_CANCELLED;
 
@@ -170,7 +172,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
 	
 	/* update dependency */
 	DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
+	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject);
 	DAG_scene_sort(CTX_data_main(C), scene);
 
 	return OPERATOR_FINISHED;
@@ -190,10 +192,10 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
 	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	prop= RNA_def_enum(ot->srna, "type", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
+	prop = RNA_def_enum(ot->srna, "type", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
 	ot->prop = prop;
 }
 
@@ -203,7 +205,7 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
 	Scene *scene = CTX_data_scene(C);
 	DynamicPaintSurface *surface;
 	DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
-	int output= RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */
+	int output = RNA_enum_get(op->ptr, "output");  /* currently only 1/0 */
 
 	if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
 	surface = get_activeSurface(pmd->canvas);
@@ -258,7 +260,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
 	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	ot->prop = RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", "");
@@ -274,13 +276,16 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
 static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surface, Object *cObject)
 {
 	DynamicPaintCanvasSettings *canvas = surface->canvas;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	wmWindow *win = CTX_wm_window(C);
 	int frame = 1;
 	int frames;
 
 	frames = surface->end_frame - surface->start_frame + 1;
-	if (frames <= 0) {BLI_strncpy(canvas->error, "No frames to bake.", sizeof(canvas->error)); return 0;}
+	if (frames <= 0) {
+		BLI_strncpy(canvas->error, N_("No frames to bake"), sizeof(canvas->error));
+		return 0;
+	}
 
 	/* Set frame to start point (also inits modifier data) */
 	frame = surface->start_frame;
@@ -291,7 +296,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
 	if (!dynamicPaint_createUVSurface(surface)) return 0;
 
 	/* Loop through selected frames */
-	for (frame=surface->start_frame; frame<=surface->end_frame; frame++) {
+	for (frame = surface->start_frame; frame <= surface->end_frame; frame++) {
 		float progress = (frame - surface->start_frame) / (float)frames * 100;
 		surface->current_frame = frame;
 
@@ -346,7 +351,6 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 	Object *ob = ED_object_context(C);
 	int status = 0;
 	double timer = PIL_check_seconds_timer();
-	char result_str[80];
 	DynamicPaintSurface *surface;
 
 	/*
@@ -354,14 +358,14 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 	 */
 	pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
 	if (!pmd) {
-		BKE_report(op->reports, RPT_ERROR, "Bake Failed: No Dynamic Paint modifier found.");
+		BKE_report(op->reports, RPT_ERROR, "Bake failed: no Dynamic Paint modifier found");
 		return 0;
 	}
 
 	/* Make sure we're dealing with a canvas */
 	canvas = pmd->canvas;
 	if (!canvas) {
-		BKE_report(op->reports, RPT_ERROR, "Bake Failed: Invalid Canvas.");
+		BKE_report(op->reports, RPT_ERROR, "Bake failed: invalid canvas");
 		return 0;
 	}
 	surface = get_activeSurface(canvas);
@@ -381,23 +385,20 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 	/* Bake was successful:
 	 *  Report for ended bake and how long it took */
 	if (status) {
-		/* Format time string	*/
+		/* Format time string */
 		char time_str[30];
 		double time = PIL_check_seconds_timer() - timer;
 		BLI_timestr(time, time_str);
 
 		/* Show bake info */
-		BLI_snprintf(result_str, sizeof(result_str), "Bake Complete! (%s)", time_str);
-		BKE_report(op->reports, RPT_INFO, result_str);
+		BKE_reportf(op->reports, RPT_INFO, "Bake complete! (%s)", time_str);
 	}
 	else {
-		if (strlen(canvas->error)) { /* If an error occured */
-			BLI_snprintf(result_str, sizeof(result_str), "Bake Failed: %s", canvas->error);
-			BKE_report(op->reports, RPT_ERROR, result_str);
+		if (strlen(canvas->error)) { /* If an error occurred */
+			BKE_reportf(op->reports, RPT_ERROR, "Bake failed: %s", canvas->error);
 		}
-		else {	/* User canceled the bake */
-			BLI_strncpy(result_str, "Baking Cancelled!", sizeof(result_str));
-			BKE_report(op->reports, RPT_WARNING, result_str);
+		else { /* User canceled the bake */
+			BKE_report(op->reports, RPT_WARNING, "Baking canceled!");
 		}
 	}
 
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index aff66b2..dc309ec 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -273,7 +273,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
 	/* there must be at least one state */
 	if (!part->boids->states.first) {
 		state = boid_new_state(part->boids);
-		BLI_addtail(&part->boids->states, state);	
+		BLI_addtail(&part->boids->states, state);
 	}
 	else
 		state = part->boids->states.first;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 1010c0e..f575429 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -401,6 +401,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
 static int key_test_depth(PEData *data, const float co[3], const int screen_co[2])
 {
 	View3D *v3d= data->vc.v3d;
+	ViewDepths *vd = data->vc.rv3d->depths;
 	double ux, uy, uz;
 	float depth;
 
@@ -428,12 +429,15 @@ static int key_test_depth(PEData *data, const float co[3], const int screen_co[2
 	/* view3d_validate_backbuf(&data->vc); */
 	glReadPixels(screen_co[0], screen_co[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
 #else /* faster to use depths, these are calculated in PE_set_view3d_data */
-	{
-		ViewDepths *vd = data->vc.rv3d->depths;
-		assert(vd && vd->depths);
+
+	/* check if screen_co is within bounds because brush_cut uses out of screen coords */
+	if (screen_co[0] >= 0 && screen_co[0] < vd->w && screen_co[1] >= 0 && screen_co[1] < vd->h) {
+		BLI_assert(vd && vd->depths);
 		/* we know its not clipped */
 		depth = vd->depths[screen_co[1] * vd->w + screen_co[0]];
 	}
+	else
+		return 0;
 #endif
 
 	if ((float)uz - 0.00001f > depth)
@@ -603,7 +607,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 	ParticleSystemModifierData *psmd = NULL;
 	ParticleEditSettings *pset= PE_settings(data->scene);
 	POINT_P; KEY_K;
-	float mat[4][4]= MAT4_UNITY, imat[4][4]= MAT4_UNITY;
+	float mat[4][4] = MAT4_UNITY, imat[4][4] = MAT4_UNITY;
 
 	if (edit->psys)
 		psmd= psys_get_modifier(data->ob, edit->psys);
@@ -673,7 +677,7 @@ static void foreach_point(PEData *data, ForPointFunc func)
 	PTCacheEdit *edit = data->edit;
 	POINT_P;
 
-	LOOP_POINTS { 
+	LOOP_POINTS {
 		func(data, p);
 	}
 }
@@ -744,15 +748,15 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 		psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
 		copy_v3_v3(co, key->co);
 		mul_m4_v3(mat, co);
-		co[0]= -co[0];
+		co[0] = -co[0];
 
 		index= BLI_kdtree_find_nearest(tree, co, NULL, &nearest);
 
 		/* this needs a custom threshold still, duplicated for editmode mirror */
 		if (index != -1 && index != p && (nearest.dist <= 0.0002f))
-			edit->mirror_cache[p]= index;
+			edit->mirror_cache[p] = index;
 		else
-			edit->mirror_cache[p]= -1;
+			edit->mirror_cache[p] = -1;
 	}
 
 	/* make sure mirrors are in two directions */
@@ -760,7 +764,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 		if (edit->mirror_cache[p]) {
 			index= edit->mirror_cache[p];
 			if (edit->mirror_cache[index] != p)
-				edit->mirror_cache[p]= -1;
+				edit->mirror_cache[p] = -1;
 		}
 	}
 
@@ -829,7 +833,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 	for (k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
 		copy_v3_v3(mhkey->co, hkey->co);
 		mul_m4_v3(mat, mhkey->co);
-		mhkey->co[0]= -mhkey->co[0];
+		mhkey->co[0] = -mhkey->co[0];
 		mul_m4_v3(immat, mhkey->co);
 
 		if (key->flag & PEK_TAG)
@@ -986,9 +990,9 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
 	PTCacheEditKey *key;
 	int j, k;
 	float tlen;
-	float dv0[3]= {0.0f, 0.0f, 0.0f};
-	float dv1[3]= {0.0f, 0.0f, 0.0f};
-	float dv2[3]= {0.0f, 0.0f, 0.0f};
+	float dv0[3] = {0.0f, 0.0f, 0.0f};
+	float dv1[3] = {0.0f, 0.0f, 0.0f};
+	float dv2[3] = {0.0f, 0.0f, 0.0f};
 
 	if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
 		return;
@@ -1003,12 +1007,12 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
 			if (pset->flag & PE_LOCK_FIRST) {
 				key= point->keys + 1;
 				k= 1;
-				dv1[0]= dv1[1]= dv1[2]= 0.0;
+				dv1[0] = dv1[1] = dv1[2] = 0.0;
 			}
 			else {
 				key= point->keys;
 				k= 0;
-				dv0[0]= dv0[1]= dv0[2]= 0.0;
+				dv0[0] = dv0[1] = dv0[2] = 0.0;
 			}
 
 			for (; k<point->totkey; k++, key++) {
@@ -1527,8 +1531,8 @@ static int select_linked_exec(bContext *C, wmOperator *op)
 	int location[2];
 
 	RNA_int_get_array(op->ptr, "location", location);
-	mval[0]= location[0];
-	mval[1]= location[1];
+	mval[0] = location[0];
+	mval[1] = location[1];
 
 	PE_set_view3d_data(C, &data);
 	data.mval= mval;
@@ -1643,7 +1647,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, short
 	ParticleSystem *psys = edit->psys;
 	ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
 	POINT_P; KEY_K;
-	float co[3], mat[4][4]= MAT4_UNITY;
+	float co[3], mat[4][4] = MAT4_UNITY;
 	int screen_co[2];
 
 	PEData data;
@@ -2414,7 +2418,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
 	if (totremoved == 0)
 		return OPERATOR_CANCELLED;
 
-	BKE_reportf(op->reports, RPT_INFO, "Remove %d double particles", totremoved);
+	BKE_reportf(op->reports, RPT_INFO, "Removed %d double particles", totremoved);
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
@@ -2437,7 +2441,8 @@ void PARTICLE_OT_remove_doubles(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_float(ot->srna, "threshold", 0.0002f, 0.0f, FLT_MAX, "Threshold", "Threshold distance withing which particles are removed", 0.00001f, 0.1f);
+	RNA_def_float(ot->srna, "threshold", 0.0002f, 0.0f, FLT_MAX,
+	              "Merge Distance", "Threshold distance withing which particles are removed", 0.00001f, 0.1f);
 }
 
 
@@ -2535,7 +2540,7 @@ static void toggle_particle_cursor(bContext *C, int enable)
 
 enum { DEL_PARTICLE, DEL_KEY };
 
-static EnumPropertyItem delete_type_items[]= {
+static EnumPropertyItem delete_type_items[] = {
 	{DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
 	{DEL_KEY, "KEY", 0, "Key", ""},
 	{0, NULL, 0, NULL, NULL}};
@@ -2691,10 +2696,10 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 
 			/* rotate weights according to vertex index rotation */
 			rotation= mirrorfaces[pa->num*2+1];
-			newpa->fuv[0]= pa->fuv[2];
-			newpa->fuv[1]= pa->fuv[1];
-			newpa->fuv[2]= pa->fuv[0];
-			newpa->fuv[3]= pa->fuv[3];
+			newpa->fuv[0] = pa->fuv[2];
+			newpa->fuv[1] = pa->fuv[1];
+			newpa->fuv[2] = pa->fuv[0];
+			newpa->fuv[3] = pa->fuv[3];
 			while (rotation-- > 0)
 				if (me->mface[pa->num].v4) {
 					SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]);
@@ -3088,9 +3093,9 @@ static void intersect_dm_quad_weights(const float v1[3], const float v2[3], cons
 	copy_v3_v3(vert[2], v3);
 	copy_v3_v3(vert[3], v4);
 
-	co[0]= v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3];
-	co[1]= v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3];
-	co[2]= v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
+	co[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3];
+	co[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3];
+	co[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
 
 	interp_weights_poly_v3(w, vert, 4, co);
 }
@@ -3198,10 +3203,10 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
 			if (isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)) {
 				if (cur_d<*min_d) {
 					*min_d=cur_d;
-					min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
-					min_w[1]= cur_uv[0];
-					min_w[2]= cur_uv[1];
-					min_w[3]= 0.0f;
+					min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];
+					min_w[1] = cur_uv[0];
+					min_w[2] = cur_uv[1];
+					min_w[3] = 0.0f;
 					if (mface->v4)
 						intersect_dm_quad_weights(v1, v2, v3, v4, min_w);
 					*min_face=i;
@@ -3212,10 +3217,10 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
 				if (isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)) {
 					if (cur_d<*min_d) {
 						*min_d=cur_d;
-						min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
-						min_w[1]= 0.0f;
-						min_w[2]= cur_uv[0];
-						min_w[3]= cur_uv[1];
+						min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];
+						min_w[1] = 0.0f;
+						min_w[2] = cur_uv[0];
+						min_w[3] = cur_uv[1];
 						intersect_dm_quad_weights(v1, v2, v3, v4, min_w);
 						*min_face=i;
 						intersect=1;
@@ -3274,8 +3279,8 @@ static int brush_add(PEData *data, short number)
 			}
 		}
 
-		mco[0]= data->mval[0] + dmx;
-		mco[1]= data->mval[1] + dmy;
+		mco[0] = data->mval[0] + dmx;
+		mco[1] = data->mval[1] + dmy;
 		ED_view3d_win_to_segment_clip(data->vc.ar, data->vc.v3d, mco, co1, co2);
 
 		mul_m4_v3(imat, co1);
@@ -3368,11 +3373,11 @@ static int brush_add(PEData *data, short number)
 				maxd= ptn[maxw-1].dist;
 				
 				for (w=0; w<maxw; w++) {
-					weight[w]= (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
+					weight[w] = (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
 					totw += weight[w];
 				}
 				for (;w<3; w++) {
-					weight[w]= 0.0f;
+					weight[w] = 0.0f;
 				}
 
 				for (w=0; w<maxw; w++)
@@ -3506,15 +3511,15 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 	flip= RNA_boolean_get(itemptr, "pen_flip");
 
 	if (bedit->first) {
-		bedit->lastmouse[0]= mouse[0];
-		bedit->lastmouse[1]= mouse[1];
+		bedit->lastmouse[0] = mouse[0];
+		bedit->lastmouse[1] = mouse[1];
 	}
 
 	dx= mouse[0] - bedit->lastmouse[0];
 	dy= mouse[1] - bedit->lastmouse[1];
 
-	mval[0]= mouse[0];
-	mval[1]= mouse[1];
+	mval[0] = mouse[0];
+	mval[1] = mouse[1];
 
 
 	/* disable locking temporatily for disconnected hair */
@@ -3529,7 +3534,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 		view3d_operator_needs_opengl(C);
 		selected= (short)count_selected_keys(scene, edit);
 
-		dmax = maxf(fabsf(dx), fabsf(dy));
+		dmax = max_ff(fabsf(dx), fabsf(dy));
 		tot_steps = dmax/(0.2f * brush->size) + 1;
 
 		dx /= (float)tot_steps;
@@ -3639,7 +3644,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 					data.mval= mval;
 					data.rad= (float)brush->size;
 
-					data.vec[0]= data.vec[1]= data.vec[2]= 0.0f;
+					data.vec[0] = data.vec[1] = data.vec[2] = 0.0f;
 					data.tot= 0;
 
 					data.smoothfac= brush->strength;
@@ -3693,8 +3698,8 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 			WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
 		}
 
-		bedit->lastmouse[0]= mouse[0];
-		bedit->lastmouse[1]= mouse[1];
+		bedit->lastmouse[0] = mouse[0];
+		bedit->lastmouse[1] = mouse[1];
 		bedit->first= 0;
 	}
 
@@ -4109,7 +4114,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
 		LOOP_SELECTED_KEYS {
 			copy_v3_v3(co, key->co);
 			mul_m4_v3(mat, co);
-			DO_MINMAX(co, min, max);		
+			DO_MINMAX(co, min, max);
 			ok= 1;
 		}
 	}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index a17d84a..221aad2 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -110,11 +110,14 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
 
 	/* possible this isn't the active object
 	 * object_remove_particle_system() clears the mode on the last psys
-	 * */
-	if (mode_orig & OB_MODE_PARTICLE_EDIT)
-		if ((ob->mode & OB_MODE_PARTICLE_EDIT)==0)
-			if (scene->basact && scene->basact->object==ob)
+	 */
+	if (mode_orig & OB_MODE_PARTICLE_EDIT) {
+		if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
+			if (scene->basact && scene->basact->object == ob) {
 				WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
+			}
+		}
+	}
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 315386a..5304c64 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -196,10 +196,10 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char
 	int i, j;
 	int channelSize = paramsize; 
 
-	if (entries==3) {
+	if (entries == 3) {
 		elbeemSimplifyChannelVec3(channel, &channelSize);
 	}
-	else if (entries==1) {
+	else if (entries == 1) {
 		elbeemSimplifyChannelFloat(channel, &channelSize);
 	}
 	else {
@@ -211,10 +211,10 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char
 		fprintf(file, "        ");
 		for (j=0;j <= entries;j++) {  // also print time value
 			fprintf(file, " %f ", channel[i*(entries + 1) + j]);
-			if (j==entries-1) { fprintf(file, "  "); }
-		} 
+			if (j == entries-1) { fprintf(file, "  "); }
+		}
 		fprintf(file, "\n");
-	} 
+	}
 
 	fprintf(file,  "      ;\n");
 }
@@ -242,7 +242,7 @@ static void init_time(FluidsimSettings *domainSettings, FluidAnimChannels *chann
 	channels->timeAtFrame[0] = channels->timeAtFrame[1] = domainSettings->animStart; // start at index 1
 	
 	for (i=2; i <= channels->length; i++) {
-		channels->timeAtFrame[i] = channels->timeAtFrame[i-1] + channels->aniFrameTime;
+		channels->timeAtFrame[i] = channels->timeAtFrame[i - 1] + (float)channels->aniFrameTime;
 	}
 }
 
@@ -402,7 +402,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 	}
 	
 	/* now we loop over the frames and fill the allocated channels with data */
-	for (i=0; i<channels->length; i++) {
+	for (i=0; i < channels->length; i++) {
 		FluidObject *fobj;
 		float viscosity, gravity[3];
 		float timeAtFrame, time;
@@ -426,7 +426,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 		/* Domain time */
 		// TODO: have option for not running sim, time mangling, in which case second case comes in handy
 		if (channels->DomainTime) {
-			time = get_fluid_rate(domainSettings) * channels->aniFrameTime;
+			time = get_fluid_rate(domainSettings) * (float)channels->aniFrameTime;
 			timeAtFrame = channels->timeAtFrame[i] + time;
 			
 			channels->timeAtFrame[i+1] = timeAtFrame;
@@ -446,7 +446,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 		for (fobj=fobjects->first; fobj; fobj=fobj->next) {
 			Object *ob = fobj->object;
 			FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
-			float active= (float)(fluidmd->fss->flag & OB_FLUIDSIM_ACTIVE);
+			float active= (float) ((fluidmd->fss->flag & OB_FLUIDSIM_ACTIVE) > 0 ? 1 : 0);
 			float rot_d[3] = {0.f, 0.f, 0.f}, old_rot[3] = {0.f, 0.f, 0.f};
 			
 			if (ELEM(fluidmd->fss->type, OB_FLUIDSIM_DOMAIN, OB_FLUIDSIM_PARTICLE))
@@ -456,17 +456,19 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 			/* get the rotation from ob->obmat rather than ob->rot to account for parent animations */
 			if (i) {
 				copy_v3_v3(old_rot, fobj->Rotation + 4*(i-1));
-				mul_v3_fl(old_rot, -M_PI/180.f);
+				mul_v3_fl(old_rot, (float)-M_PI / 180.f);
 			}
 
 			mat4_to_compatible_eulO(rot_d, old_rot, 0, ob->obmat);
-			mul_v3_fl(rot_d, -180.f/M_PI);
+			mul_v3_fl(rot_d, -180.0f / (float)M_PI);
 			
 			set_channel(fobj->Translation, timeAtFrame, ob->loc, i, CHANNEL_VEC);
 			set_channel(fobj->Rotation, timeAtFrame, rot_d, i, CHANNEL_VEC);
 			set_channel(fobj->Scale, timeAtFrame, ob->size, i, CHANNEL_VEC);
 			set_channel(fobj->Active, timeAtFrame, &active, i, CHANNEL_FLOAT);
 			set_channel(fobj->InitialVelocity, timeAtFrame, &fluidmd->fss->iniVelx, i, CHANNEL_VEC);
+
+			// printf("Active: %f, Frame: %f\n", active, timeAtFrame);
 			
 			if (fluidmd->fss->type == OB_FLUIDSIM_CONTROL) {
 				set_channel(fobj->AttractforceStrength, timeAtFrame, &fluidmd->fss->attractforceStrength, i, CHANNEL_FLOAT);
@@ -527,7 +529,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
 		if ( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) {
 			fsmesh.channelInitialVel = fobj->InitialVelocity;
 			fsmesh.localInivelCoords = ((fluidmd->fss->typeFlags & OB_FSINFLOW_LOCALCOORD)?1:0);
-		} 
+		}
 		
 		if (fluidmd->fss->typeFlags & OB_FSBND_NOSLIP)
 			fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
@@ -574,7 +576,8 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
 			fsmesh.channelScale            = NULL;
 			
 			/* Override user settings, only noslip is supported here! */
-			fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
+			if (fsmesh.type != OB_FLUIDSIM_CONTROL)
+				fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
 		}
 		
 		elbeemAddMesh(&fsmesh);
@@ -593,7 +596,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 
 	for (base=scene->base.first; base; base= base->next) {
 		Object *ob = base->object;
-		FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);			
+		FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
 
 		/* only find objects with fluid modifiers */
 		if (!fluidmdtmp || ob->type != OB_MESH) continue;
@@ -627,7 +630,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 		return 0;
 	}
 	
-	if (channelObjCount>=255) {
+	if (channelObjCount >= 255) {
 		BKE_report(reports, RPT_ERROR, "Cannot bake with more then 256 objects");
 		return 0;
 	}
@@ -648,7 +651,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetFile, char *debugStrBuffer)
 {
 	FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsDomain, eModifierType_Fluidsim);
-	FluidsimSettings *domainSettings= fluidmd->fss;	
+	FluidsimSettings *domainSettings= fluidmd->fss;
 	FILE *fileCfg;
 	int dirExist = 0;
 	char newSurfdataPath[FILE_MAX]; /* modified output settings */
@@ -673,7 +676,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
 	// check selected directory
 	// simply try to open cfg file for writing to test validity of settings
 	fileCfg = BLI_fopen(targetFile, "w");
-	if (fileCfg) { 
+	if (fileCfg) {
 		dirExist = 1; fclose(fileCfg); 
 		// remove cfg dummy from  directory test
 		BLI_delete(targetFile, 0, 0);
@@ -902,7 +905,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	/* make sure it corresponds to startFrame setting (old: noFrames = scene->r.efra - scene->r.sfra +1) */;
 	noFrames = scene->r.efra - 0;
 	if (noFrames<=0) {
-		BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings");
+		BKE_report(reports, RPT_ERROR, "No frames to export (check your animation range settings)");
 		fluidbake_free_data(channels, fobjects, fsset, fb);
 		return 0;
 	}
@@ -944,8 +947,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 		if (domainSettings->resolutionxyz>128) {
 			gridlevels = 2;
 		}
-		else
-		if (domainSettings->resolutionxyz>64) {
+		else if (domainSettings->resolutionxyz > 64) {
 			gridlevels = 1;
 		}
 		else {
@@ -962,8 +964,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	
 	/* ******** prepare output file paths ******** */
 	outStringsChanged = fluid_init_filepaths(fsDomain, targetDir, targetFile, debugStrBuffer);
-	channels->length = scene->r.efra;
-	channels->aniFrameTime = (domainSettings->animEnd - domainSettings->animStart)/(double)noFrames;
+	channels->length = scene->r.efra; // DG TODO: why using endframe and not "noFrames" here? .. because "noFrames" is buggy too? (not using sfra)
+	channels->aniFrameTime = (double)((double)domainSettings->animEnd - (double)domainSettings->animStart) / (double)noFrames;
 	
 	/* ******** initialize and allocate animation channels ******** */
 	fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects);
@@ -1050,7 +1052,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	fsset->generateVertexVectors = (domainSettings->domainNovecgen==0);
 
 	// init blender domain transform matrix
-	{ int j; 
+	{ int j;
 	for (i=0; i<4; i++) {
 		for (j=0; j<4; j++) {
 			fsset->surfaceTrafo[i*4+j] = invDomMat[j][i];
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 89ddfe0..fb99d29 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -61,7 +61,7 @@ static void operatortypes_particle(void)
 	WM_operatortype_append(PARTICLE_OT_rekey);
 	WM_operatortype_append(PARTICLE_OT_subdivide);
 	WM_operatortype_append(PARTICLE_OT_remove_doubles);
-	WM_operatortype_append(PARTICLE_OT_weight_set);	
+	WM_operatortype_append(PARTICLE_OT_weight_set);
 	WM_operatortype_append(PARTICLE_OT_delete);
 	WM_operatortype_append(PARTICLE_OT_mirror);
 
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 218ae62..bbce94b 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -325,9 +325,9 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	for (pid=pidlist.first; pid; pid=pid->next) {
 		if (pid->cache == cache) {
-			PointCache *cache = BKE_ptcache_add(pid->ptcaches);
-			cache->step = pid->default_step;
-			*(pid->cache_ptr) = cache;
+			PointCache *cache_new = BKE_ptcache_add(pid->ptcaches);
+			cache_new->step = pid->default_step;
+			*(pid->cache_ptr) = cache_new;
 			break;
 		}
 	}
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index c08ea2b..f8154f4 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -80,11 +80,10 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
 	float *rectf = NULL;
 	int ymin, ymax, xmin, xmax;
 	int rymin, rxmin;
-	/* unsigned char *rectc; */  /* UNUSED */
 
 	/* if renrect argument, we only refresh scanlines */
 	if (renrect) {
-		/* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
+		/* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */
 		if (rr->renlay == NULL || renrect->ymax >= rr->recty)
 			return;
 
@@ -143,11 +142,10 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
 		imb_addrectImBuf(ibuf);
 	
 	rectf += 4 * (rr->rectx * ymin + xmin);
-	/* rectc = (unsigned char *)(ibuf->rect + ibuf->x * rymin + rxmin); */  /* UNUSED */
 
 	IMB_partial_display_buffer_update(ibuf, rectf, NULL, rr->rectx, rxmin, rymin,
 	                                  &scene->view_settings, &scene->display_settings,
-	                                  rxmin, rymin, rxmin + xmax, rymin + ymax);
+	                                  rxmin, rymin, rxmin + xmax, rymin + ymax, TRUE);
 }
 
 /* ****************************** render invoking ***************** */
@@ -204,7 +202,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
 	screen_render_scene_layer_set(op, mainp, &scene, &srl);
 
 	if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
+		BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -297,7 +295,11 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
 		if (rs->tothalo) spos += sprintf(spos, "Ha:%d ", rs->tothalo);
 		if (rs->totstrand) spos += sprintf(spos, "St:%d ", rs->totstrand);
 		if (rs->totlamp) spos += sprintf(spos, "La:%d ", rs->totlamp);
-		spos += sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
+
+		if (rs->mem_peak == 0.0f)
+			spos += sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
+		else
+			spos += sprintf(spos, "Mem:%.2fM, Peak: %.2fM ", rs->mem_used, rs->mem_peak);
 
 		if (rs->curfield)
 			spos += sprintf(spos, "Field %d ", rs->curfield);
@@ -373,7 +375,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
 		/* make jobs timer to send notifier */
 		*(rj->do_update) = TRUE;
 	}
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 }
 
 static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
@@ -495,12 +497,12 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 
 	if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
+		BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
 		return OPERATOR_CANCELLED;
-	}	
+	}
 	
-	/* stop all running jobs, currently previews frustrate Render */
-	WM_jobs_stop_all(CTX_wm_manager(C));
+	/* stop all running jobs, except screen one. currently previews frustrate Render */
+	WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
 
 	/* get main */
 	if (G.debug_value == 101) {
@@ -551,13 +553,20 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	rj->win = CTX_wm_window(C);
 	rj->srl = srl;
 	rj->camera_override = camera_override;
-	rj->lay = (v3d) ? v3d->lay : scene->lay;
+	rj->lay = scene->lay;
 	rj->anim = is_animation;
 	rj->write_still = is_write_still && !is_animation;
 	rj->iuser.scene = scene;
 	rj->iuser.ok = 1;
 	rj->reports = op->reports;
 
+	if (v3d) {
+		rj->lay = v3d->lay;
+
+		if (v3d->localvd)
+			rj->lay |= v3d->localvd->lay;
+	}
+
 	/* setup job */
 	if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
 	else name = "Render";
@@ -609,6 +618,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 /* contextual render, using current scene, view3d? */
 void RENDER_OT_render(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name = "Render";
 	ot->description = "Render active scene";
@@ -623,7 +634,9 @@ void RENDER_OT_render(wmOperatorType *ot)
 
 	RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
 	RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
-	RNA_def_string(ot->srna, "layer", "", RE_MAXNAME, "Render Layer", "Single render layer to re-render (used only when animation is disabled)");
-	RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME - 2, "Scene", "Scene to render, current scene if not specified");
+	prop = RNA_def_string(ot->srna, "layer", "", RE_MAXNAME, "Render Layer", "Single render layer to re-render (used only when animation is disabled)");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME - 2, "Scene", "Scene to render, current scene if not specified");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 85ae923..73f8abd 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -171,11 +171,13 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 		}
 	}
 	else if (view_context) {
+		ED_view3d_draw_offscreen_init(scene, v3d);
+
 		GPU_offscreen_bind(oglrender->ofs); /* bind */
 
 		/* render 3d view */
 		if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
-			/*int is_ortho= scene->r.mode & R_ORTHO;*/
+			/*int is_ortho = scene->r.mode & R_ORTHO;*/
 			camera = v3d->camera;
 			RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
 			
@@ -189,7 +191,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 			else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
 		}
 
-		if ((scene->r.mode & R_OSA) == 0) { 
+		if ((scene->r.mode & R_OSA) == 0) {
 			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE, FALSE);
 			GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
 		}
@@ -286,7 +288,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 		}
 	}
 	
-	BKE_image_release_ibuf(oglrender->ima, lock);
+	BKE_image_release_ibuf(oglrender->ima, ibuf, lock);
 }
 
 static int screen_opengl_render_init(bContext *C, wmOperator *op)
@@ -306,7 +308,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 	char err_out[256] = "unknown";
 
 	if (G.background) {
-		BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)");
+		BKE_report(op->reports, RPT_ERROR, "Cannot use OpenGL render in background mode (no opengl context)");
 		return 0;
 	}
 
@@ -327,12 +329,12 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 	}
 
 	if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
+		BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
 		return 0;
 	}
 
-	/* stop all running jobs, currently previews frustrate Render */
-	WM_jobs_stop_all(CTX_wm_manager(C));
+	/* stop all running jobs, except screen one. currently previews frustrate Render */
+	WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
 
 	/* create offscreen buffer */
 	sizex = (scene->r.size * scene->r.xsch) / 100;
@@ -342,7 +344,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 	ofs = GPU_offscreen_create(sizex, sizey, err_out);
 
 	if (!ofs) {
-		BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
+		BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer, %s", err_out);
 		return 0;
 	}
 
@@ -479,7 +481,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 	Main *bmain = CTX_data_main(C);
 	OGLRender *oglrender = op->customdata;
 	Scene *scene = oglrender->scene;
-	ImBuf *ibuf;
+	ImBuf *ibuf, *ibuf_save = NULL;
 	void *lock;
 	char name[FILE_MAX];
 	int ok = 0;
@@ -547,47 +549,46 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 	if (ibuf) {
 		int needs_free = FALSE;
 
-		if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) {
-			ImBuf *colormanage_ibuf;
+		ibuf_save = ibuf;
 
-			colormanage_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings,
-			                                                       &scene->display_settings, &scene->r.im_format);
+		if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) {
+			ibuf_save = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings,
+			                                                &scene->display_settings, &scene->r.im_format);
 
-			// IMB_freeImBuf(ibuf); /* owned by the image */
-			ibuf = colormanage_ibuf;
 			needs_free = TRUE;
 		}
 
 		/* color -> grayscale */
 		/* editing directly would alter the render view */
 		if (scene->r.im_format.planes == R_IMF_PLANES_BW) {
-			 ImBuf *ibuf_bw = IMB_dupImBuf(ibuf);
+			ImBuf *ibuf_bw = IMB_dupImBuf(ibuf_save);
 			IMB_color_to_bw(ibuf_bw);
 
 			if (needs_free)
-				IMB_freeImBuf(ibuf);
+				IMB_freeImBuf(ibuf_save);
 
-			ibuf = ibuf_bw;
+			ibuf_save = ibuf_bw;
 		}
 		else {
 			/* this is lightweight & doesnt re-alloc the buffers, only do this
 			 * to save the correct bit depth since the image is always RGBA */
-			ImBuf *ibuf_cpy = IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.im_format.planes, 0);
-			ibuf_cpy->rect = ibuf->rect;
-			ibuf_cpy->rect_float = ibuf->rect_float;
-			ibuf_cpy->zbuf_float = ibuf->zbuf_float;
+			ImBuf *ibuf_cpy = IMB_allocImBuf(ibuf_save->x, ibuf_save->y, scene->r.im_format.planes, 0);
+
+			ibuf_cpy->rect = ibuf_save->rect;
+			ibuf_cpy->rect_float = ibuf_save->rect_float;
+			ibuf_cpy->zbuf_float = ibuf_save->zbuf_float;
 
 			if (needs_free) {
-				ibuf_cpy->mall = ibuf->mall;
-				ibuf->mall = 0;
-				IMB_freeImBuf(ibuf);
+				ibuf_cpy->mall = ibuf_save->mall;
+				ibuf_save->mall = 0;
+				IMB_freeImBuf(ibuf_save);
 			}
 
-			ibuf = ibuf_cpy;
+			ibuf_save = ibuf_cpy;
 		}
 
 		if (is_movie) {
-			ok = oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int *)ibuf->rect,
+			ok = oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int *)ibuf_save->rect,
 			                                 oglrender->sizex, oglrender->sizey, oglrender->reports);
 			if (ok) {
 				printf("Append frame %d", scene->r.cfra);
@@ -595,7 +596,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 			}
 		}
 		else {
-			ok = BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format);
+			ok = BKE_imbuf_write_stamp(scene, camera, ibuf_save, name, &scene->r.im_format);
 
 			if (ok == 0) {
 				printf("Write error: cannot save %s\n", name);
@@ -607,11 +608,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 			}
 		}
 
-		/* imbuf knows which rects are not part of ibuf */
-		IMB_freeImBuf(ibuf);
+		if (needs_free)
+			IMB_freeImBuf(ibuf_save);
 	}
 
-	BKE_image_release_ibuf(oglrender->ima, lock);
+	BKE_image_release_ibuf(oglrender->ima, ibuf, lock);
 
 	/* movie stats prints have no line break */
 	printf("\n");
@@ -716,7 +717,7 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	// no redraw needed, we leave state as we entered it
+	/* no redraw needed, we leave state as we entered it */
 //	ED_update_for_newframe(C, 1);
 	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, CTX_data_scene(C));
 
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 8170674..a864fe3 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -237,6 +237,14 @@ static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
 	return 0;
 }
 
+static Scene *preview_get_scene(void)
+{
+	if (pr_main == NULL) return NULL;
+	
+	return pr_main->scene.first;
+}
+
+
 /* call this with a pointer to initialize preview scene */
 /* call this with NULL to restore assigned ID pointers in preview scene */
 static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPreview *sp)
@@ -244,9 +252,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 	Scene *sce;
 	Base *base;
 	
-	if (pr_main == NULL) return NULL;
-	
-	sce = pr_main->scene.first;
+	sce = preview_get_scene();
 	if (sce) {
 		
 		/* this flag tells render to not execute depsgraph or ipos etc */
@@ -266,23 +272,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 		BKE_color_managed_view_settings_copy(&sce->view_settings, &scene->view_settings);
 		
 		/* prevent overhead for small renders and icons (32) */
-		if (id && sp->sizex < 40)
-			sce->r.xparts = sce->r.yparts = 1;
-		else
-			sce->r.xparts = sce->r.yparts = 4;
+		if (id && sp->sizex < 40) {
+			sce->r.tilex = sce->r.tiley = 64;
+		}
+		else {
+			sce->r.tilex = sce->r.xsch / 4;
+			sce->r.tiley = sce->r.ysch / 4;
+		}
 		
 		/* exception: don't apply render part of display transform for texture previews or icons */
 		if ((id && sp->pr_method == PR_ICON_RENDER) || id_type == ID_TE) {
-			ColorManagedDisplaySettings *display_settings = &sce->display_settings;
-			ColorManagedViewSettings *view_settings = &sce->view_settings;
-
-			const char *default_view_name = IMB_colormanagement_view_get_default_name(display_settings->display_device);
-
-			view_settings->exposure = 0.0f;
-			view_settings->gamma = 1.0f;
-			view_settings->flag &= ~COLORMANAGE_VIEW_USE_CURVES;
-
-			BLI_strncpy(view_settings->view_transform, default_view_name, sizeof(view_settings->view_transform));
+			BKE_scene_disable_color_management(sce);
 		}
 		
 		if ((id && sp->pr_method == PR_ICON_RENDER) && id_type != ID_WO)
@@ -350,7 +350,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 				if (sp->pr_method == PR_ICON_RENDER) {
 					if (mat->material_type == MA_TYPE_HALO) {
 						sce->lay = 1 << MA_FLAT;
-					} 
+					}
 					else {
 						sce->lay = 1 << MA_SPHERE_A;
 					}
@@ -377,7 +377,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 					if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
 						/* don't use assign_material, it changed mat->id.us, which shows in the UI */
 						Material ***matar = give_matarar(base->object);
-						int actcol = MAX2(base->object->actcol - 1, 0);
+						int actcol = max_ii(base->object->actcol - 1, 0);
 
 						if (matar && actcol < base->object->totcol)
 							(*matar)[actcol] = mat;
@@ -395,7 +395,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 				tex = localize_texture(origtex);
 				sp->texcopy = tex;
 				BLI_addtail(&pr_main->tex, tex);
-			}			
+			}
 			sce->lay = 1 << MA_TEXTURE;
 			
 			for (base = sce->base.first; base; base = base->next) {
@@ -527,8 +527,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
 		
 		if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) {
 
-			newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
-			newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty);
+			newrect->xmax = max_ii(newrect->xmax, rect->xmin + rres.rectx + offx);
+			newrect->ymax = max_ii(newrect->ymax, rect->ymin + rres.recty);
 
 			if (rres.rectx && rres.recty) {
 				/* temporary conversion to byte for drawing */
@@ -550,7 +550,7 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
 					 *            color managed as well?
 					 */
 					IMB_buffer_byte_from_float(rect_byte, rres.rectf,
-					                           4, dither, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, do_predivide,
+					                           4, dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, do_predivide,
 					                           rres.rectx, rres.recty, rres.rectx, rres.rectx);
 				}
 
@@ -606,7 +606,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
 		if (ok == 0) {
 			ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
 		}
-	}	
+	}
 }
 
 /* **************************** new shader preview system ****************** */
@@ -658,7 +658,7 @@ static void shader_preview_updatejob(void *spv)
 				if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
 					ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
 			}
-		}		
+		}
 	}
 }
 
@@ -671,8 +671,23 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 	char name[32];
 	int sizex;
 	
+	/* in case of split preview, use border render */
+	if (split) {
+		if (first) sizex = sp->sizex / 2;
+		else sizex = sp->sizex - sp->sizex / 2;
+	}
+	else sizex = sp->sizex;
+	
+	/* we have to set preview variables first */
+	sce = preview_get_scene();
+	if (sce) {
+		sce->r.xsch = sizex;
+		sce->r.ysch = sp->sizey;
+		sce->r.size = 100;
+	}
+	
 	/* get the stuff from the builtin preview dbase */
-	sce = preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
+	sce = preview_prepare_scene(sp->scene, id, idtype, sp);
 	if (sce == NULL) return;
 	
 	if (!split || first) sprintf(name, "Preview %p", sp->owner);
@@ -700,17 +715,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 		sce->r.mode |= R_OSA;
 	}
 
-	/* in case of split preview, use border render */
-	if (split) {
-		if (first) sizex = sp->sizex / 2;
-		else sizex = sp->sizex - sp->sizex / 2;
-	}
-	else sizex = sp->sizex;
-
-	/* allocates or re-uses render result */
-	sce->r.xsch = sizex;
-	sce->r.ysch = sp->sizey;
-	sce->r.size = 100;
 
 	/* callbacs are cleared on GetRender() */
 	if (ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
@@ -818,7 +822,7 @@ static void shader_preview_free(void *customdata)
 		
 		/* get rid of copied world */
 		BLI_remlink(&pr_main->world, sp->worldcopy);
-		BKE_world_free_ex(sp->worldcopy, FALSE);
+		BKE_world_free_ex(sp->worldcopy, TRUE); /* [#32865] - we need to unlink the texture copies, unlike for materials */
 		
 		properties = IDP_GetProperties((ID *)sp->worldcopy, FALSE);
 		if (properties) {
@@ -870,7 +874,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
 		scaledx = (float)w;
 		scaledy =  ( (float)ima->y / (float)ima->x) * (float)w;
 	}
-	else {			
+	else {
 		scaledx =  ( (float)ima->x / (float)ima->y) * (float)h;
 		scaledy = (float)h;
 	}
@@ -930,13 +934,15 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
 		/* elubie: this needs to be changed: here image is always loaded if not
 		 * already there. Very expensive for large images. Need to find a way to 
 		 * only get existing ibuf */
-		ibuf = BKE_image_get_ibuf(ima, &iuser);
+		ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
 		if (ibuf == NULL || ibuf->rect == NULL)
 			return;
 		
 		icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
 
 		*do_update = TRUE;
+
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 	else if (idtype == ID_BR) {
 		Brush *br = (Brush *)id;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 8bdd4e5..eef5e70 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -747,7 +747,11 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
 	
 	/* properties */
-	prop = RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] (use -1 to skip a face)", 0.0f, 0.0f);
+	prop = RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f,
+	                           "File layout",
+	                           "Flat array describing the X,Y position of each cube face in the output image, "
+	                           "where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] "
+	                           "(use -1 to skip a face)", 0.0f, 0.0f);
 	RNA_def_property_flag(prop, PROP_HIDDEN);
 
 	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_SAVE,
@@ -861,7 +865,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
 
 	paste_matcopybuf(ma);
 
-	WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_DRAW, ma);
+	WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
 
 	return OPERATOR_FINISHED;
 }
@@ -1023,7 +1027,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 
 	paste_mtex_copybuf(id);
 
-	WM_event_add_notifier(C, NC_TEXTURE | ND_SHADING_DRAW, NULL);
+	WM_event_add_notifier(C, NC_TEXTURE | ND_SHADING_LINKS, NULL);
 
 	return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index cd55b91..1ed1cbb 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -58,12 +58,15 @@
 #include "GPU_material.h"
 
 #include "RE_engine.h"
+#include "RE_pipeline.h"
 
 #include "ED_node.h"
 #include "ED_render.h"
 
 #include "render_intern.h"  // own include
 
+extern Material defmaterial;
+
 /***************************** Render Engines ********************************/
 
 void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
@@ -74,12 +77,19 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
 	bScreen *sc;
 	ScrArea *sa;
 	ARegion *ar;
+	static int recursive_check = FALSE;
 
 	/* don't do this render engine update if we're updating the scene from
 	 * other threads doing e.g. rendering or baking jobs */
 	if (!BLI_thread_is_main())
 		return;
 
+	/* don't call this recursively for frame updates */
+	if (recursive_check)
+		return;
+	
+	recursive_check = TRUE;
+
 	C = CTX_create();
 	CTX_data_main_set(C, bmain);
 	CTX_data_scene_set(C, scene);
@@ -114,6 +124,8 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
 	}
 
 	CTX_free(C);
+
+	recursive_check = FALSE;
 }
 
 void ED_render_engine_area_exit(ScrArea *sa)
@@ -144,10 +156,16 @@ void ED_render_engine_changed(Main *bmain)
 	/* on changing the render engine type, clear all running render engines */
 	bScreen *sc;
 	ScrArea *sa;
+	Scene *scene;
 
 	for (sc = bmain->screen.first; sc; sc = sc->id.next)
 		for (sa = sc->areabase.first; sa; sa = sa->next)
 			ED_render_engine_area_exit(sa);
+
+	RE_FreePersistentData();
+
+	for (scene = bmain->scene.first; scene; scene = scene->id.next)
+		ED_render_id_flush_update(bmain, &scene->id);
 }
 
 /***************************** Updates ***********************************
@@ -238,6 +256,27 @@ static void material_changed(Main *bmain, Material *ma)
 	}
 }
 
+static void lamp_changed(Main *bmain, Lamp *la)
+{
+	Object *ob;
+	Material *ma;
+
+	/* icons */
+	BKE_icon_changed(BKE_icon_getid(&la->id));
+
+	/* glsl */
+	for (ob = bmain->object.first; ob; ob = ob->id.next)
+		if (ob->data == la && ob->gpulamp.first)
+			GPU_lamp_free(ob);
+
+	for (ma = bmain->mat.first; ma; ma = ma->id.next)
+		if (ma->gpumaterial.first)
+			GPU_material_free(ma);
+
+	if (defmaterial.gpumaterial.first)
+		GPU_material_free(&defmaterial);
+}
+
 static void texture_changed(Main *bmain, Tex *tex)
 {
 	Material *ma;
@@ -270,16 +309,14 @@ static void texture_changed(Main *bmain, Tex *tex)
 	/* find lamps */
 	for (la = bmain->lamp.first; la; la = la->id.next) {
 		if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) {
-			/* pass */
+			lamp_changed(bmain, la);
 		}
 		else if (la->nodetree && nodes_use_tex(la->nodetree, tex)) {
-			/* pass */
+			lamp_changed(bmain, la);
 		}
 		else {
 			continue;
 		}
-
-		BKE_icon_changed(BKE_icon_getid(&la->id));
 	}
 
 	/* find worlds */
@@ -308,24 +345,6 @@ static void texture_changed(Main *bmain, Tex *tex)
 	}
 }
 
-static void lamp_changed(Main *bmain, Lamp *la)
-{
-	Object *ob;
-	Material *ma;
-
-	/* icons */
-	BKE_icon_changed(BKE_icon_getid(&la->id));
-
-	/* glsl */
-	for (ob = bmain->object.first; ob; ob = ob->id.next)
-		if (ob->data == la && ob->gpulamp.first)
-			GPU_lamp_free(ob);
-
-	for (ma = bmain->mat.first; ma; ma = ma->id.next)
-		if (ma->gpumaterial.first)
-			GPU_material_free(ma);
-}
-
 static void world_changed(Main *bmain, World *wo)
 {
 	Material *ma;
@@ -337,6 +356,9 @@ static void world_changed(Main *bmain, World *wo)
 	for (ma = bmain->mat.first; ma; ma = ma->id.next)
 		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
+
+	if (defmaterial.gpumaterial.first)
+		GPU_material_free(&defmaterial);
 }
 
 static void image_changed(Main *bmain, Image *ima)
@@ -365,10 +387,19 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
 	for (ma = bmain->mat.first; ma; ma = ma->id.next)
 		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
+
+	if (defmaterial.gpumaterial.first)
+		GPU_material_free(&defmaterial);
 }
 
 void ED_render_id_flush_update(Main *bmain, ID *id)
 {
+	/* this can be called from render or baking thread when a python script makes
+	 * changes, in that case we don't want to do any editor updates, and making
+	 * GPU changes is not possible because OpenGL only works in the main thread */
+	if (!BLI_thread_is_main())
+		return;
+
 	switch (GS(id->name)) {
 		case ID_MA:
 			material_changed(bmain, (Material *)id);
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 01c0169..5ec7f4d 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -220,7 +220,6 @@ void render_view_open(bContext *C, int mx, int my)
 		else {
 			/* Leave it alone so the image editor will just go back from
 			 * full screen to the original tiled setup */
-			;
 		}
 	}
 }
@@ -282,7 +281,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 	if (wincur->screen->temp) {
 		wm_window_lower(wincur);
 	}
-	else { 
+	else {
 		wmWindow *win, *winshow;
 		ScrArea *sa = find_area_showing_r_result(C, &winshow);
 		
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index ad9b0f6..f30e0ab 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -390,7 +390,7 @@ void ED_area_overdraw(bContext *C)
 				az->do_draw = FALSE;
 			}
 		}
-	}	
+	}
 	glDisable(GL_BLEND);
 	
 }
@@ -465,11 +465,11 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
 	if (ar->drawrct.xmin == ar->drawrct.xmax)
 		ar->drawrct = winrct;
 	else {
-		/* extra clip for safety */
-		ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin);
-		ar->drawrct.ymin = MAX2(winrct.ymin, ar->drawrct.ymin);
-		ar->drawrct.xmax = MIN2(winrct.xmax, ar->drawrct.xmax);
-		ar->drawrct.ymax = MIN2(winrct.ymax, ar->drawrct.ymax);
+		/* extra clip for safety (intersect the rects, could use API func) */
+		ar->drawrct.xmin = max_ii(winrct.xmin, ar->drawrct.xmin);
+		ar->drawrct.ymin = max_ii(winrct.ymin, ar->drawrct.ymin);
+		ar->drawrct.xmax = min_ii(winrct.xmax, ar->drawrct.xmax);
+		ar->drawrct.ymax = min_ii(winrct.ymax, ar->drawrct.ymax);
 	}
 	
 	/* note; this sets state, so we can use wmOrtho and friends */
@@ -533,10 +533,7 @@ void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
 		}
 		else if (ar->drawrct.xmin != ar->drawrct.xmax) {
 			/* partial redraw already set, expand region */
-			ar->drawrct.xmin = MIN2(ar->drawrct.xmin, rct->xmin);
-			ar->drawrct.ymin = MIN2(ar->drawrct.ymin, rct->ymin);
-			ar->drawrct.xmax = MAX2(ar->drawrct.xmax, rct->xmax);
-			ar->drawrct.ymax = MAX2(ar->drawrct.ymax, rct->ymax);
+			BLI_rcti_union(&ar->drawrct, rct);
 		}
 	}
 }
@@ -1260,19 +1257,15 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
 		}
 		else {
 			/* prevent uiblocks to run */
-			uiFreeBlocks(NULL, &ar->uiblocks);	
+			uiFreeBlocks(NULL, &ar->uiblocks);
 		}
-		
-		/* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */
-		if (ar->regiontype == RGN_TYPE_HEADER)
-			ar->v2d.flag &= ~V2D_IS_INITIALISED;
 	}
 }
 
 /* externally called for floating regions like menus */
 void ED_region_init(bContext *C, ARegion *ar)
 {
-//	ARegionType *at= ar->type;
+//	ARegionType *at = ar->type;
 	
 	/* refresh can be called before window opened */
 	region_subwindow(CTX_wm_window(C), ar);
@@ -1414,7 +1407,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
 			/* put in front of list */
 			BLI_remlink(&sa->spacedata, sl);
 			BLI_addhead(&sa->spacedata, sl);
-		} 
+		}
 		else {
 			/* new space */
 			if (st) {
@@ -1457,7 +1450,8 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
 			ED_area_newspace(C, sa, sl->next->spacetype);
 	}
 	else {
-		ED_area_newspace(C, sa, SPACE_INFO);
+		/* no change */
+		return;
 	}
 	ED_area_tag_redraw(sa);
 
@@ -1670,11 +1664,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 		v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
 		v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
 		
-		/* don't jump back when panels close or hide */
-		if (!newcontext)
-			y = MAX2(-y, -v2d->cur.ymin);
-		else
-			y = -y;
+		/* ensure tot is set correctly, to keep views on bottons, with sliders */
+		y = min_ii(y, v2d->cur.ymin);
+		y = -y;
 	}
 	else {
 		/* for now, allow scrolling in both directions (since layouts are optimized for vertical,
@@ -1688,7 +1680,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 
 		/* don't jump back when panels close or hide */
 		if (!newcontext)
-			x = MAX2(x, v2d->cur.xmax);
+			x = max_ii(x, v2d->cur.xmax);
 		y = -y;
 	}
 
@@ -1741,7 +1733,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
 	int maxco, xco, yco;
 	int headery = ED_area_headersize();
 
-	/* clear */	
+	/* clear */
 	UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL);
 	glClear(GL_COLOR_BUFFER_BIT);
 	
@@ -1778,7 +1770,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
 	}
 
 	/* always as last  */
-	UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot));
+	UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, headery);
 
 	/* restore view matrix? */
 	UI_view2d_view_restore(C);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 24053d7..ce2d045 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -600,8 +600,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 	/* The maximum pixel amounts the image can be cropped
 	 * at the lower left without exceeding the origin.
 	 */
-	int off_x = floor(MAX2(ix, 0));
-	int off_y = floor(MAX2(iy, 0));
+	int off_x = floor(max_ff(ix, 0.0f));
+	int off_y = floor(max_ff(iy, 0.0f));
 
 	/* The zoomed space coordinate of the raster position
 	 * (starting at the lower left most unclipped pixel).
@@ -625,8 +625,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 	 * covers the entire screen).
 	 */
 	glGetFloatv(GL_SCISSOR_BOX, scissor);
-	draw_w = mini(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
-	draw_h = mini(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
+	draw_w = min_ii(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
+	draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
 
 	if (draw_w > 0 && draw_h > 0) {
 		int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 352039c..a516603 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -194,7 +194,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 							CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
 					}
 				}
-			}	
+			}
 			CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 			return 1;
 		}
@@ -236,7 +236,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 							CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
 					}
 				}
-			}	
+			}
 			CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 			return 1;
 		}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 2e17230..60aad14 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -36,6 +36,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_userdef_types.h"
 
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
@@ -271,7 +272,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
 			
 			if (abs(my - se->v1->vec.y) <= 2 && mx >= min && mx <= max)
 				return se;
-		} 
+		}
 		else {
 			short min, max;
 			min = MIN2(se->v1->vec.y, se->v2->vec.y);
@@ -631,10 +632,8 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 	max[0] = max[1] = 0.0f;
 	
 	for (sv = sc->vertbase.first; sv; sv = sv->next) {
-		min[0] = MIN2(min[0], sv->vec.x);
-		min[1] = MIN2(min[1], sv->vec.y);
-		max[0] = MAX2(max[0], sv->vec.x);
-		max[1] = MAX2(max[1], sv->vec.y);
+		const float fv[2] = {(float)sv->vec.x, (float)sv->vec.y};
+		minmax_v2v2_v2(min, max, fv);
 	}
 	
 	/* always make 0.0 left under */
@@ -875,7 +874,7 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
 	glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
 	glEnable(GL_BLEND);
 	/* value 181 was hardly computed: 181~105 */
-	glColor4ub(255, 255, 255, 50);		
+	glColor4ub(255, 255, 255, 50);
 	/* draw_join_shape(sa, dir); */
 	glRecti(sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y);
 	glDisable(GL_BLEND);
@@ -1066,7 +1065,7 @@ static void screen_refresh_headersizes(void)
 	for (st = lb->first; st; st = st->next) {
 		ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
 		if (art) art->prefsizey = ED_area_headersize();
-	}		
+	}
 }
 
 /* make this screen usable */
@@ -1320,7 +1319,7 @@ int ED_screen_area_active(const bContext *C)
 		for (ar = sa->regionbase.first; ar; ar = ar->next)
 			if (ar->swinid == sc->subwinactive)
 				return 1;
-	}	
+	}
 	return 0;
 }
 
@@ -1453,10 +1452,10 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
 			
 			if (scene != sc->scene) {
 				/* all areas endlocalview */
-				// XXX	ScrArea *sa= sc->areabase.first;
+				// XXX	ScrArea *sa = sc->areabase.first;
 				//	while (sa) {
 				//		endlocalview(sa);
-				//		sa= sa->next;
+				//		sa = sa->next;
 				//	}
 				sc->scene = scene;
 			}
@@ -1733,7 +1732,7 @@ void ED_refresh_viewport_fps(bContext *C)
 		fpsi->redrawtime = fpsi->lredrawtime;
 		fpsi->lredrawtime = animtimer->ltime;
 	}
-	else {	
+	else {
 		/* playback stopped or shouldn't be running */
 		if (scene->fps_info)
 			MEM_freeN(scene->fps_info);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index c64a4a3..67d4af9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -192,7 +192,7 @@ int ED_operator_region_view3d_active(bContext *C)
 		return TRUE;
 
 	CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
-	return FALSE;	
+	return FALSE;
 }
 
 /* generic for any view2d which uses anim_ops */
@@ -256,7 +256,7 @@ int ED_operator_node_active(bContext *C)
 	return 0;
 }
 
-// XXX rename
+/* XXX rename */
 int ED_operator_graphedit_active(bContext *C)
 {
 	return ed_spacetype_test(C, SPACE_IPO);
@@ -293,29 +293,35 @@ int ED_operator_console_active(bContext *C)
 	return ed_spacetype_test(C, SPACE_CONSOLE);
 }
 
+static int ed_object_hidden(Object *ob)
+{
+	/* if hidden but in edit mode, we still display, can happen with animation */
+	return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT));
+}
+
 int ED_operator_object_active(bContext *C)
 {
 	Object *ob = ED_object_active_context(C);
-	return ((ob != NULL) && !(ob->restrictflag & OB_RESTRICT_VIEW));
+	return ((ob != NULL) && !ed_object_hidden(ob));
 }
 
 int ED_operator_object_active_editable(bContext *C)
 {
 	Object *ob = ED_object_active_context(C);
-	return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW));
+	return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob));
 }
 
 int ED_operator_object_active_editable_mesh(bContext *C)
 {
 	Object *ob = ED_object_active_context(C);
-	return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
+	return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
 	        (ob->type == OB_MESH) && !(((ID *)ob->data)->lib));
 }
 
 int ED_operator_object_active_editable_font(bContext *C)
 {
 	Object *ob = ED_object_active_context(C);
-	return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
+	return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
 	        (ob->type == OB_FONT));
 }
 
@@ -580,7 +586,7 @@ static int actionzone_area_poll(bContext *C)
 		for (az = sa->actionzones.first; az; az = az->next)
 			if (BLI_rcti_isect_pt(&az->rect, x, y))
 				return 1;
-	}	
+	}
 	return 0;
 }
 
@@ -628,6 +634,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
 		event.type = EVT_ACTIONZONE_AREA;
 	else
 		event.type = EVT_ACTIONZONE_REGION;
+	event.val = 0;
 	event.customdata = op->customdata;
 	event.customdatafree = TRUE;
 	op->customdata = NULL;
@@ -701,7 +708,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
 		case ESCKEY:
 			actionzone_exit(op);
 			return OPERATOR_CANCELLED;
-		case LEFTMOUSE:				
+		case LEFTMOUSE:
 			actionzone_exit(op);
 			return OPERATOR_CANCELLED;
 			
@@ -969,18 +976,18 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller
 			
 			/* if top or down edge selected, test height */
 			if (sa->v1->flag && sa->v4->flag)
-				*bigger = MIN2(*bigger, y1);
+				*bigger = min_ii(*bigger, y1);
 			else if (sa->v2->flag && sa->v3->flag)
-				*smaller = MIN2(*smaller, y1);
+				*smaller = min_ii(*smaller, y1);
 		}
 		else {
 			int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX;
 			
 			/* if left or right edge selected, test width */
 			if (sa->v1->flag && sa->v2->flag)
-				*bigger = MIN2(*bigger, x1);
+				*bigger = min_ii(*bigger, x1);
 			else if (sa->v3->flag && sa->v4->flag)
-				*smaller = MIN2(*smaller, x1);
+				*smaller = min_ii(*smaller, x1);
 		}
 	}
 }
@@ -1341,7 +1348,7 @@ static int area_split_apply(bContext *C, wmOperator *op)
 		WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
 		
 		return 1;
-	}		
+	}
 	
 	return 0;
 }
@@ -1691,7 +1698,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	AZone *az;
 	
 	if (event->type != EVT_ACTIONZONE_REGION) {
-		BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");	
+		BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1855,7 +1862,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
 			break;
 			
 		case ESCKEY:
-			;
+			break;
 	}
 	
 	return OPERATOR_RUNNING_MODAL;
@@ -2071,15 +2078,23 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
 
 /* ************** switch screen operator ***************************** */
 
+static int screen_set_is_ok(bScreen *screen, bScreen *screen_prev)
+{
+	return ((screen->winid == 0)    &&
+	        (screen->full == 0)     &&
+	        (screen != screen_prev) &&
+	        (screen->id.name[2] != '.' || !(U.uiflag & USER_HIDE_DOT)));
+}
 
 /* function to be called outside UI context, or for redo */
 static int screen_set_exec(bContext *C, wmOperator *op)
 {
+	Main *bmain = CTX_data_main(C);
 	bScreen *screen = CTX_wm_screen(C);
 	bScreen *screen_prev = screen;
 	
 	ScrArea *sa = CTX_wm_area(C);
-	int tot = BLI_countlist(&CTX_data_main(C)->screen);
+	int tot = BLI_countlist(&bmain->screen);
 	int delta = RNA_int_get(op->ptr, "delta");
 	
 	/* temp screens are for userpref or render display */
@@ -2089,17 +2104,19 @@ static int screen_set_exec(bContext *C, wmOperator *op)
 	if (delta == 1) {
 		while (tot--) {
 			screen = screen->id.next;
-			if (screen == NULL) screen = CTX_data_main(C)->screen.first;
-			if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
+			if (screen == NULL) screen = bmain->screen.first;
+			if (screen_set_is_ok(screen, screen_prev)) {
 				break;
+			}
 		}
 	}
 	else if (delta == -1) {
 		while (tot--) {
 			screen = screen->id.prev;
-			if (screen == NULL) screen = CTX_data_main(C)->screen.last;
-			if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
+			if (screen == NULL) screen = bmain->screen.last;
+			if (screen_set_is_ok(screen, screen_prev)) {
 				break;
+			}
 		}
 	}
 	else {
@@ -2359,14 +2376,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 			ScrArea *sa = screen_areahascursor(sc, event->x, event->y);
 			int dir;
 			
-			if (sa) {					
+			if (sa) {
 				if (jd->sa1 != sa) {
 					dir = area_getorientation(jd->sa1, sa);
 					if (dir >= 0) {
 						if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
 						jd->sa2 = sa;
 						jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
-					} 
+					}
 					else {
 						/* we are not bordering on the previously selected area 
 						 * we check if area has common border with the one marked for removal
@@ -2380,14 +2397,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 							jd->sa2 = sa;
 							if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
 							if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
-						} 
+						}
 						else {
 							if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
 							jd->sa2 = NULL;
 						}
 					}
 					WM_event_add_notifier(C, NC_WINDOW, NULL);
-				} 
+				}
 				else {
 					/* we are back in the area previously selected for keeping 
 					 * we swap the areas if possible to allow user to choose */
@@ -2402,7 +2419,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 						if (dir < 0) {
 							printf("oops, didn't expect that!\n");
 						}
-					} 
+					}
 					else {
 						dir = area_getorientation(jd->sa1, sa);
 						if (dir >= 0) {
@@ -2716,6 +2733,8 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 		
 		/* lock views and set them */
 		if (sa->spacetype == SPACE_VIEW3D) {
+			View3D *v3d = sa->spacedata.first;
+
 			/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
 			 * otherwise when restoring rv3d->localvd the 'viewquat' won't
 			 * match the 'view', set on entering localview See: [#26315],
@@ -2743,7 +2762,15 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 			
 			ar = ar->next;
 			rv3d = ar->regiondata;
-			rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
+
+			/* check if we have a camera */
+			if (v3d->camera) {
+				rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
+			}
+			else {
+				rv3d->view = RV3D_VIEW_PERSPORTHO; rv3d->persp = RV3D_PERSP;
+			}
+
 			ED_view3d_lock(rv3d);
 			view3d_localview_update_rv3d(rv3d);
 		}
@@ -2827,7 +2854,7 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
 		/* don't do anything if no region */
 		if (ar == NULL)
 			return OPERATOR_CANCELLED;
-	}	
+	}
 	
 	/* copied from SCREEN_OT_region_flip */
 	if (ar->alignment == RGN_ALIGN_TOP)
@@ -2861,6 +2888,38 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
 	ot->flag = 0;
 }
 
+
+
+/* ************** show menus operator ***************************** */
+
+/* show/hide header text menus */
+static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	ScrArea *sa = CTX_wm_area(C);
+
+	sa->flag = sa->flag ^ HEADER_NO_PULLDOWN;
+
+	ED_area_tag_redraw(CTX_wm_area(C));
+	WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);	
+
+	return OPERATOR_FINISHED;
+}
+
+
+static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Show/Hide Header Menus";
+	ot->idname = "SCREEN_OT_header_toggle_menus";
+	ot->description = "Show or hide the header pulldown menus";
+	
+	/* api callbacks */
+	ot->exec = header_toggle_menus_exec;
+	ot->poll = ED_operator_areaactive;
+	ot->flag = 0;
+}
+
+
 /* ************** header tools operator ***************************** */
 void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
 {
@@ -2873,6 +2932,11 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN
 	else
 		uiItemO(layout, IFACE_("Flip to Top"), ICON_NONE, "SCREEN_OT_header_flip");
 
+	if (sa->flag & HEADER_NO_PULLDOWN)
+		uiItemO(layout, IFACE_("Show Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus");
+	else
+		uiItemO(layout, IFACE_("Hide Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus");
+
 	uiItemS(layout);
 
 	/* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
@@ -3025,7 +3089,11 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 		}
 		else {
 			if (sync) {
-				int step = floor((wt->duration - sad->last_duration) * FPS);
+				/* note: this is very simplistic,
+				 * its has problem that it may skip too many frames.
+				 * however at least this gives a less jittery playback */
+				const int step = max_ii(1, floor((wt->duration - sad->last_duration) * FPS));
+
 				/* skip frames */
 				if (sad->flag & ANIMPLAY_FLAG_REVERSE)
 					scene->r.cfra -= step;
@@ -3094,11 +3162,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 			for (sa = window->screen->areabase.first; sa; sa = sa->next) {
 				ARegion *ar;
 				for (ar = sa->regionbase.first; ar; ar = ar->next) {
-					if (ar == sad->ar)
+					if (ar == sad->ar) {
 						ED_region_tag_redraw(ar);
-					else
-					if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws))
+					}
+					else if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) {
 						ED_region_tag_redraw(ar);
+					}
 				}
 				
 				if (match_area_with_refresh(sa->spacetype, sad->refresh))
@@ -3115,7 +3184,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 		/* recalculate the timestep for the timer now that we've finished calculating this,
 		 * since the frames-per-second value may have been changed
 		 */
-		// TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this?
+		/* TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? */
 		wt->timestep = (1.0 / FPS);
 		
 		return OPERATOR_FINISHED;
@@ -3165,7 +3234,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
 	else {
 		int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */
 		
-		if (mode == 1) // XXX only play audio forwards!?
+		if (mode == 1)  /* XXX only play audio forwards!? */
 			sound_play_scene(scene);
 		
 		ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode);
@@ -3417,7 +3486,7 @@ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Delete Screen"; //was scene
+	ot->name = "Delete Screen";  /* was scene */
 	ot->description = "Delete active screen";
 	ot->idname = "SCREEN_OT_delete";
 	
@@ -3537,6 +3606,7 @@ void ED_operatortypes_screen(void)
 	WM_operatortype_append(SCREEN_OT_region_scale);
 	WM_operatortype_append(SCREEN_OT_region_flip);
 	WM_operatortype_append(SCREEN_OT_header_flip);
+	WM_operatortype_append(SCREEN_OT_header_toggle_menus);
 	WM_operatortype_append(SCREEN_OT_header_toolbox);
 	WM_operatortype_append(SCREEN_OT_screen_set);
 	WM_operatortype_append(SCREEN_OT_screen_full_area);
@@ -3564,7 +3634,7 @@ void ED_operatortypes_screen(void)
 	/* tools shared by more space types */
 	WM_operatortype_append(ED_OT_undo);
 	WM_operatortype_append(ED_OT_undo_push);
-	WM_operatortype_append(ED_OT_redo);	
+	WM_operatortype_append(ED_OT_redo);
 	WM_operatortype_append(ED_OT_undo_history);
 	
 }
@@ -3734,7 +3804,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0);
 	
 	/* Alternative keys for animation and sequencer playing */
-#if 0 // XXX: disabled for restoring later... bad implementation
+#if 0 /* XXX: disabled for restoring later... bad implementation */
 	keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
 	kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index aeae79a..ca85daa 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -35,6 +35,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+#include "BLI_math.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -52,6 +53,7 @@
 #include "BKE_writeavi.h"
 
 #include "BIF_gl.h"
+#include "BIF_glutil.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -214,7 +216,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 		WM_event_add_fileselect(C, op);
 	
 		return OPERATOR_RUNNING_MODAL;
-	}	
+	}
 	return OPERATOR_CANCELLED;
 }
 
@@ -278,6 +280,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
 typedef struct ScreenshotJob {
 	Main *bmain;
 	Scene *scene;
+	wmWindowManager *wm;
 	unsigned int *dumprect;
 	int x, y, dumpsx, dumpsy;
 	short *stop;
@@ -365,7 +368,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 				
 				if (ok == 0) {
 					printf("Write error: cannot save %s\n", name);
-					BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
+					BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s", name);
 					break;
 				}
 				else {
@@ -374,7 +377,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 				}
 				
 				/* imbuf knows which rects are not part of ibuf */
-				IMB_freeImBuf(ibuf);	
+				IMB_freeImBuf(ibuf);
 			}
 			
 			MEM_freeN(sj->dumprect);
@@ -395,6 +398,54 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 	BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
 }
 
+/* Helper callback for drawing the cursor itself */
+static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUSED(p_ptr))
+{
+	
+	glPushMatrix();
+	
+	glTranslatef((float)x, (float)y, 0.0f);
+	
+	
+	glEnable(GL_LINE_SMOOTH);
+	glEnable(GL_BLEND);
+	
+	glColor4ub(0, 0, 0, 32);
+	glutil_draw_filled_arc(0.0, M_PI * 2.0, 20, 40);
+	
+	glColor4ub(255, 255, 255, 128);
+	glutil_draw_lined_arc(0.0, M_PI * 2.0, 20, 40);
+	
+	glDisable(GL_BLEND);
+	glDisable(GL_LINE_SMOOTH);
+	
+	glPopMatrix();
+}
+
+/* Turn brush cursor in 3D view on/off */
+static void screencast_cursor_toggle(wmWindowManager *wm, short enable)
+{
+	static void *cursor = NULL;
+	
+	if (cursor && !enable) {
+		/* clear cursor */
+		WM_paint_cursor_end(wm, cursor);
+		cursor = NULL;
+	}
+	else if (enable) {
+		/* enable cursor */
+		cursor = WM_paint_cursor_activate(wm, NULL, screencast_draw_cursor, NULL);
+	}
+}
+
+static void screenshot_endjob(void *sjv)
+{
+	ScreenshotJob *sj = sjv;
+	
+	screencast_cursor_toggle(sj->wm, 0);
+}
+
+
 static int screencast_exec(bContext *C, wmOperator *op)
 {
 	bScreen *screen = CTX_wm_screen(C);
@@ -408,7 +459,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
 		sj->y = 0;
 		sj->dumpsx = win->sizex;
 		sj->dumpsy = win->sizey;
-	} 
+	}
 	else {
 		ScrArea *curarea = CTX_wm_area(C);
 		sj->x = curarea->totrct.xmin;
@@ -418,15 +469,18 @@ static int screencast_exec(bContext *C, wmOperator *op)
 	}
 	sj->bmain = CTX_data_main(C);
 	sj->scene = CTX_data_scene(C);
-
+	sj->wm = CTX_wm_manager(C);
+	
 	BKE_reports_init(&sj->reports, RPT_PRINT);
 
 	/* setup job */
 	WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
 	WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
-	WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, NULL);
+	WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, screenshot_endjob);
+	
+	WM_jobs_start(sj->wm, wm_job);
 	
-	WM_jobs_start(CTX_wm_manager(C), wm_job);
+	screencast_cursor_toggle(sj->wm, 1);
 	
 	WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
 	
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index e3d714b..5e23a14 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -340,7 +340,6 @@ static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,
 {
 	Scene *scene = CTX_data_scene(C);
 	Paint *paint = paint_get_active_from_context(C);
-	Brush *brush = paint_brush(paint);
 	float window[2];
 	int hit;
 
@@ -350,6 +349,7 @@ static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,
 	if (vc->obact->sculpt && vc->obact->sculpt->pbvh &&
 	    sculpt_stroke_get_location(C, location, window))
 	{
+		Brush *brush = paint_brush(paint);
 		*pixel_radius =
 		    project_brush_radius(vc,
 		                         BKE_brush_unprojected_radius_get(scene, brush),
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c6aaae6..b704414 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -109,30 +109,36 @@
 #include "paint_intern.h"
 
 /* Defines and Structs */
+/* FTOCHAR as inline function */
+BLI_INLINE unsigned char f_to_char(const float val)
+{
+	return FTOCHAR(val);
+}
+
 
 #define IMAPAINT_CHAR_TO_FLOAT(c) ((c) / 255.0f)
 
 #define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f)  {                                   \
-	(c)[0]= FTOCHAR((f)[0]);                                                  \
-	(c)[1]= FTOCHAR((f)[1]);                                                  \
-	(c)[2]= FTOCHAR((f)[2]);                                                  \
+	(c)[0] = f_to_char((f)[0]);                                               \
+	(c)[1] = f_to_char((f)[1]);                                               \
+	(c)[2] = f_to_char((f)[2]);                                               \
 } (void)0
 #define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f)  {                                  \
-	(c)[0]= FTOCHAR((f)[0]);                                                  \
-	(c)[1]= FTOCHAR((f)[1]);                                                  \
-	(c)[2]= FTOCHAR((f)[2]);                                                  \
-	(c)[3]= FTOCHAR((f)[3]);                                                  \
+	(c)[0] = f_to_char((f)[0]);                                               \
+	(c)[1] = f_to_char((f)[1]);                                               \
+	(c)[2] = f_to_char((f)[2]);                                               \
+	(c)[3] = f_to_char((f)[3]);                                               \
 } (void)0
 #define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c)  {                                   \
-	(f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
-	(f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
-	(f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
+	(f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
+	(f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
+	(f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
 } (void)0
 #define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c)  {                                  \
-	(f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
-	(f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
-	(f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
-	(f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]);                                   \
+	(f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
+	(f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
+	(f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
+	(f)[3] = IMAPAINT_CHAR_TO_FLOAT((c)[3]);                                   \
 } (void)0
 
 #define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b)
@@ -173,7 +179,7 @@ typedef struct ImagePaintState {
 } ImagePaintState;
 
 typedef struct ImagePaintPartialRedraw {
-	int x1, y1, x2, y2;
+	int x1, y1, x2, y2;  /* XXX, could use 'rcti' */
 	int enabled;
 } ImagePaintPartialRedraw;
 
@@ -288,9 +294,11 @@ typedef struct ProjPaintState {
 	char *vertFlags;                    /* store options per vert, now only store if the vert is pointing away from the view */
 	int buckets_x;                      /* The size of the bucket grid, the grid span's screenMin/screenMax so you can paint outsize the screen or with 2 brushes at once */
 	int buckets_y;
-	
+
 	ProjPaintImage *projImages;
 	
+	int pixel_sizeof;           /* result of project_paint_pixel_sizeof(), constant per stroke */
+
 	int image_tot;              /* size of projectImages array */
 	
 	float (*screenCoords)[4];   /* verts projected into floating point screen space */
@@ -379,6 +387,18 @@ typedef struct ProjPixelClone {
 	PixelStore clonepx;
 } ProjPixelClone;
 
+/* blur, store surrounding colors */
+#define PROJ_PIXEL_SOFTEN_TOT 4
+/* blur picking offset (in screenspace) */
+#define PROJ_PIXEL_SOFTEN_OFS_PX 1.0f
+
+static const float proj_pixel_soften_v2[PROJ_PIXEL_SOFTEN_TOT][2] = {
+	{-PROJ_PIXEL_SOFTEN_OFS_PX,                         0.0f},
+	{ 0.0f,                        -PROJ_PIXEL_SOFTEN_OFS_PX},
+	{ 0.0f,                         PROJ_PIXEL_SOFTEN_OFS_PX},
+	{ PROJ_PIXEL_SOFTEN_OFS_PX,                         0.0f},
+};
+
 /* Finish projection painting structs */
 
 typedef struct UndoImageTile {
@@ -480,7 +500,7 @@ static void image_undo_restore(bContext *C, ListBase *lb)
 			ima = BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
 		}
 
-		ibuf = BKE_image_get_ibuf(ima, NULL);
+		ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 		if (ima && ibuf && strcmp(tile->ibufname, ibuf->name) != 0) {
 			/* current ImBuf filename was changed, probably current frame
@@ -488,19 +508,27 @@ static void image_undo_restore(bContext *C, ListBase *lb)
 			 * full image user (which isn't so obvious, btw) try to find ImBuf with
 			 * matched file name in list of already loaded images */
 
+			BKE_image_release_ibuf(ima, ibuf, NULL);
+
 			ibuf = BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name));
 		}
 
-		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
+		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) {
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 			continue;
+		}
 
-		if (ima->gen_type != tile->gen_type || ima->source != tile->source)
+		if (ima->gen_type != tile->gen_type || ima->source != tile->source) {
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 			continue;
+		}
 
 		use_float = ibuf->rect_float ? 1 : 0;
 
-		if (use_float != tile->use_float)
+		if (use_float != tile->use_float) {
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 			continue;
+		}
 
 		undo_copy_tile(tile, tmpibuf, ibuf, 1);
 
@@ -510,6 +538,8 @@ static void image_undo_restore(bContext *C, ListBase *lb)
 		if (ibuf->mipmap[0])
 			ibuf->userflags |= IB_MIPMAP_INVALID;  /* force mipmap recreatiom */
 		ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 
 	IMB_freeImBuf(tmpibuf);
@@ -626,7 +656,7 @@ static float VecZDepthPersp(const float pt[2],
 	 * barycentric_weights_v2 would return, in this case its easiest just to
 	 * undo the 4th axis division and make it unit-sum
 	 *
-	 * don't call barycentric_weights_v2() becaue our callers expect 'w'
+	 * don't call barycentric_weights_v2() because our callers expect 'w'
 	 * to be weighted from the perspective */
 	w_tmp[0] = w[0] * v1[3];
 	w_tmp[1] = w[1] * v2[3];
@@ -783,7 +813,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
 	else {
 		//xi = (int)((uv[0]*ibuf->x) + 0.5f);
 		//yi = (int)((uv[1]*ibuf->y) + 0.5f);
-		//if (xi<0 || xi>=ibuf->x  ||  yi<0 || yi>=ibuf->y) return 0;
+		//if (xi < 0 || xi >= ibuf->x  ||  yi < 0 || yi >= ibuf->y) return 0;
 		
 		/* wrap */
 		xi = ((int)(uv[0] * ibuf->x)) % ibuf->x;
@@ -903,7 +933,7 @@ static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *buc
 			else
 				isect_ret = project_paint_occlude_ptv(pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v2], ps->screenCoords[mf->v3], w, ps->is_ortho);
 
-			/* Note, if isect_ret==-1 then we don't want to test the other side of the quad */
+			/* Note, if (isect_ret == -1) then we don't want to test the other side of the quad */
 			if (isect_ret == 0 && mf->v4) {
 				if (do_clip)
 					isect_ret = project_paint_occlude_ptv_clip(ps, mf, pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v3], ps->screenCoords[mf->v4], 1);
@@ -942,7 +972,7 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
 	
 	if (y_diff < 0.000001f) {
 		*x_isect = (p1[0] + p2[0]) * 0.5f;
-		return ISECT_TRUE;		
+		return ISECT_TRUE;
 	}
 	
 	if (p1[1] > y_level && p2[1] < y_level) {
@@ -975,7 +1005,7 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
 	
 	if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */
 		*y_isect = (p1[0] + p2[0]) * 0.5f;
-		return ISECT_TRUE;		
+		return ISECT_TRUE;
 	}
 	
 	if (p1[0] > x_level && p2[0] < x_level) {
@@ -1003,7 +1033,7 @@ static int cmp_uv(const float vec2a[2], const float vec2b[2])
 	float ya = (float)fmodf(vec2a[1], 1.0f);
 	
 	float xb = (float)fmodf(vec2b[0], 1.0f);
-	float yb = (float)fmodf(vec2b[1], 1.0f);	
+	float yb = (float)fmodf(vec2b[1], 1.0f);
 	
 	if (xa < 0.0f) xa += 1.0f;
 	if (ya < 0.0f) ya += 1.0f;
@@ -1029,11 +1059,11 @@ static int pixel_bounds_uv(
 	
 	INIT_MINMAX2(min_uv, max_uv);
 	
-	DO_MINMAX2(uv1, min_uv, max_uv);
-	DO_MINMAX2(uv2, min_uv, max_uv);
-	DO_MINMAX2(uv3, min_uv, max_uv);
+	minmax_v2v2_v2(min_uv, max_uv, uv1);
+	minmax_v2v2_v2(min_uv, max_uv, uv2);
+	minmax_v2v2_v2(min_uv, max_uv, uv3);
 	if (is_quad)
-		DO_MINMAX2(uv4, min_uv, max_uv);
+		minmax_v2v2_v2(min_uv, max_uv, uv4);
 	
 	bounds_px->xmin = (int)(ibuf_x * min_uv[0]);
 	bounds_px->ymin = (int)(ibuf_y * min_uv[1]);
@@ -1059,7 +1089,7 @@ static int pixel_bounds_array(float (*uv)[2], rcti *bounds_px, const int ibuf_x,
 	INIT_MINMAX2(min_uv, max_uv);
 	
 	while (tot--) {
-		DO_MINMAX2((*uv), min_uv, max_uv);
+		minmax_v2v2_v2(min_uv, max_uv, (*uv));
 		uv++;
 	}
 	
@@ -1378,8 +1408,8 @@ static float project_paint_uvpixel_mask(
 		Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_stencil, face_index);
 		const MTFace *tf_other = ps->dm_mtface_stencil + face_index;
 		
-		if (other_tpage && (ibuf_other = BKE_image_get_ibuf(other_tpage, NULL))) {
-			/* BKE_image_get_ibuf - TODO - this may be slow */
+		if (other_tpage && (ibuf_other = BKE_image_acquire_ibuf(other_tpage, NULL, NULL))) {
+			/* BKE_image_acquire_ibuf - TODO - this may be slow */
 			unsigned char rgba_ub[4];
 			float rgba_f[4];
 			
@@ -1391,7 +1421,9 @@ static float project_paint_uvpixel_mask(
 			else { /* from char to float */
 				mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) / (256 * 3.0f)) * (rgba_ub[3] / 256.0f);
 			}
-			
+
+			BKE_image_release_ibuf(other_tpage, ibuf_other, NULL);
+
 			if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
 				mask = (1.0f - mask);
 
@@ -1491,6 +1523,16 @@ static float project_paint_uvpixel_mask(
 	return mask;
 }
 
+static int project_paint_pixel_sizeof(const short tool)
+{
+	if ((tool == PAINT_TOOL_CLONE) || (tool == PAINT_TOOL_SMEAR)) {
+		return sizeof(ProjPixelClone);
+	}
+	else {
+		return sizeof(ProjPixel);
+	}
+}
+
 /* run this function when we know a bucket's, face's pixel can be initialized,
  * return the ProjPixel which is added to 'ps->bucketRect[bucket_index]' */
 static ProjPixel *project_paint_uvpixel_init(
@@ -1506,33 +1548,23 @@ static ProjPixel *project_paint_uvpixel_init(
         const float w[3])
 {
 	ProjPixel *projPixel;
-	short size;
-	
+
 	/* wrap pixel location */
 	x_px = x_px % ibuf->x;
 	if (x_px < 0) x_px += ibuf->x;
 	y_px = y_px % ibuf->y;
 	if (y_px < 0) y_px += ibuf->y;
-	
-	if (ps->tool == PAINT_TOOL_CLONE) {
-		size = sizeof(ProjPixelClone);
-	}
-	else if (ps->tool == PAINT_TOOL_SMEAR) {
-		size = sizeof(ProjPixelClone);
-	}
-	else {
-		size = sizeof(ProjPixel);
-	}
-	
-	projPixel = (ProjPixel *)BLI_memarena_alloc(arena, size);
+
+	BLI_assert(ps->pixel_sizeof == project_paint_pixel_sizeof(ps->tool));
+	projPixel = (ProjPixel *)BLI_memarena_alloc(arena, ps->pixel_sizeof);
 	//memset(projPixel, 0, size);
 	
 	if (ibuf->rect_float) {
 		projPixel->pixel.f_pt = ibuf->rect_float + ((x_px + y_px * ibuf->x) * 4);
-		projPixel->origColor.f[0] = projPixel->newColor.f[0] = projPixel->pixel.f_pt[0];  
-		projPixel->origColor.f[1] = projPixel->newColor.f[1] = projPixel->pixel.f_pt[1];  
-		projPixel->origColor.f[2] = projPixel->newColor.f[2] = projPixel->pixel.f_pt[2];  
-		projPixel->origColor.f[3] = projPixel->newColor.f[3] = projPixel->pixel.f_pt[3];  
+		projPixel->origColor.f[0] = projPixel->newColor.f[0] = projPixel->pixel.f_pt[0];
+		projPixel->origColor.f[1] = projPixel->newColor.f[1] = projPixel->pixel.f_pt[1];
+		projPixel->origColor.f[2] = projPixel->newColor.f[2] = projPixel->pixel.f_pt[2];
+		projPixel->origColor.f[3] = projPixel->newColor.f[3] = projPixel->pixel.f_pt[3];
 	}
 	else {
 		projPixel->pixel.ch_pt = ((unsigned char *)ibuf->rect + ((x_px + y_px * ibuf->x) * 4));
@@ -1559,8 +1591,8 @@ static ProjPixel *project_paint_uvpixel_init(
 			Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_clone, face_index);
 			const MTFace *tf_other = ps->dm_mtface_clone + face_index;
 			
-			if (other_tpage && (ibuf_other = BKE_image_get_ibuf(other_tpage, NULL))) {
-				/* BKE_image_get_ibuf - TODO - this may be slow */
+			if (other_tpage && (ibuf_other = BKE_image_acquire_ibuf(other_tpage, NULL, NULL))) {
+				/* BKE_image_acquire_ibuf - TODO - this may be slow */
 				
 				if (ibuf->rect_float) {
 					if (ibuf_other->rect_float) { /* from float to float */
@@ -1582,6 +1614,8 @@ static ProjPixel *project_paint_uvpixel_init(
 						project_face_pixel(tf_other, ibuf_other, w, side, ((ProjPixelClone *)projPixel)->clonepx.ch, NULL);
 					}
 				}
+
+				BKE_image_release_ibuf(other_tpage, ibuf_other, NULL);
 			}
 			else {
 				if (ibuf->rect_float) {
@@ -1860,7 +1894,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
 		/* lower left out of radius test */
 		if (cent[1] < bucket_bounds->ymin) {
 			return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
-		} 
+		}
 		/* top left test */
 		else if (cent[1] > bucket_bounds->ymax) {
 			return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
@@ -1870,7 +1904,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
 		/* lower right out of radius test */
 		if (cent[1] < bucket_bounds->ymin) {
 			return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
-		} 
+		}
 		/* top right test */
 		else if (cent[1] > bucket_bounds->ymax) {
 			return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
@@ -2111,7 +2145,7 @@ static void project_bucket_clip_face(
 				if ((inside_bucket_flag & ISECT_2) == 0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
 				if ((inside_bucket_flag & ISECT_3) == 0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
 			}
-		}	
+		}
 		
 		if ((inside_bucket_flag & (ISECT_3 | ISECT_1)) != (ISECT_3 | ISECT_1)) {
 			if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
@@ -2394,7 +2428,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	tf_uv_pxoffset[1][1] = tf->uv[1][1] - yhalfpx;
 	
 	tf_uv_pxoffset[2][0] = tf->uv[2][0] - xhalfpx;
-	tf_uv_pxoffset[2][1] = tf->uv[2][1] - yhalfpx;	
+	tf_uv_pxoffset[2][1] = tf->uv[2][1] - yhalfpx;
 	
 	if (mf->v4) {
 		vCo[3] = ps->dm_mvert[mf->v4].co;
@@ -2554,7 +2588,6 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 			float (*outset_uv)[2] = ps->faceSeamUVs[face_index];
 			float insetCos[4][3]; /* inset face coords.  NOTE!!! ScreenSace for ortho, Worldspace in prespective view */
 
-			float fac;
 			float *vCoSS[4]; /* vertex screenspace coords */
 			
 			float bucket_clip_edges[2][2]; /* store the screenspace coords of the face, clipped by the bucket's screen aligned rectangle */
@@ -2636,6 +2669,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 									
 									/* test we're inside uvspace bucket and triangle bounds */
 									if (isect_point_quad_v2(uv, seam_subsection[0], seam_subsection[1], seam_subsection[2], seam_subsection[3])) {
+										float fac;
 										
 										/* We need to find the closest point along the face edge,
 										 * getting the screen_px_from_*** wont work because our actual location
@@ -2670,9 +2704,9 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 #if 1
 												/* get the UV on the line since we want to copy the pixels from there for bleeding */
 												float uv_close[2];
-												float fac = closest_to_line_v2(uv_close, uv, tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2]);
-												if      (fac < 0.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx1]);
-												else if (fac > 1.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx2]);
+												float uv_fac = closest_to_line_v2(uv_close, uv, tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2]);
+												if      (uv_fac < 0.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx1]);
+												else if (uv_fac > 1.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx2]);
 
 												if (side) {
 													barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[2], tf_uv_pxoffset[3], uv_close, w);
@@ -2683,16 +2717,16 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 #else											/* this is buggy with quads, don't use for now */
 
 												/* Cheat, we know where we are along the edge so work out the weights from that */
-												fac = fac1 + (fac * (fac2 - fac1));
+												uv_fac = fac1 + (uv_fac * (fac2 - fac1));
 
 												w[0] = w[1] = w[2] = 0.0;
 												if (side) {
-													w[fidx1 ? fidx1 - 1 : 0] = 1.0f - fac;
-													w[fidx2 ? fidx2 - 1 : 0] = fac;
+													w[fidx1 ? fidx1 - 1 : 0] = 1.0f - uv_fac;
+													w[fidx2 ? fidx2 - 1 : 0] = uv_fac;
 												}
 												else {
-													w[fidx1] = 1.0f - fac;
-													w[fidx2] = fac;
+													w[fidx1] = 1.0f - uv_fac;
+													w[fidx2] = uv_fac;
 												}
 #endif
 											}
@@ -2906,7 +2940,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
 	fidx = mf->v4 ? 3 : 2;
 	do {
 		vCoSS = ps->screenCoords[*(&mf->v1 + fidx)];
-		DO_MINMAX2(vCoSS, min, max);
+		minmax_v2v2_v2(min, max, vCoSS);
 	} while (fidx--);
 	
 	project_paint_bucket_bounds(ps, min, max, bucketMin, bucketMax);
@@ -3171,7 +3205,7 @@ static void project_paint_begin(ProjPaintState *ps)
 			/* screen space, not clamped */
 			projScreenCo[0] = (float)(ps->winx / 2.0f) + (ps->winx / 2.0f) * projScreenCo[0];
 			projScreenCo[1] = (float)(ps->winy / 2.0f) + (ps->winy / 2.0f) * projScreenCo[1];
-			DO_MINMAX2(projScreenCo, ps->screenMin, ps->screenMax);
+			minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
 		}
 	}
 	else {
@@ -3186,7 +3220,7 @@ static void project_paint_begin(ProjPaintState *ps)
 				projScreenCo[0] = (float)(ps->winx / 2.0f) + (ps->winx / 2.0f) * projScreenCo[0] / projScreenCo[3];
 				projScreenCo[1] = (float)(ps->winy / 2.0f) + (ps->winy / 2.0f) * projScreenCo[1] / projScreenCo[3];
 				projScreenCo[2] = projScreenCo[2] / projScreenCo[3]; /* Use the depth for bucket point occlusion */
-				DO_MINMAX2(projScreenCo, ps->screenMin, ps->screenMax);
+				minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
 			}
 			else {
 				/* TODO - deal with cases where 1 side of a face goes behind the view ?
@@ -3388,7 +3422,7 @@ static void project_paint_begin(ProjPaintState *ps)
 				
 				image_index = BLI_linklist_index(image_LinkList, tpage);
 				
-				if (image_index == -1 && BKE_image_get_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */
+				if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */
 					BLI_linklist_append(&image_LinkList, tpage);
 					image_index = ps->image_tot;
 					ps->image_tot++;
@@ -3411,7 +3445,7 @@ static void project_paint_begin(ProjPaintState *ps)
 	for (node = image_LinkList, i = 0; node; node = node->next, i++, projIma++) {
 		projIma->ima = node->link;
 		projIma->touch = 0;
-		projIma->ibuf = BKE_image_get_ibuf(projIma->ima, NULL);
+		projIma->ibuf = BKE_image_acquire_ibuf(projIma->ima, NULL, NULL);
 		projIma->partRedrawRect =  BLI_memarena_alloc(arena, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
 		memset(projIma->partRedrawRect, 0, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
 	}
@@ -3432,12 +3466,13 @@ static void project_paint_begin_clone(ProjPaintState *ps, int mouse[2])
 		mul_m4_v4(ps->projectMat, projCo);
 		ps->cloneOffset[0] = mouse[0] - ((float)(ps->winx / 2.0f) + (ps->winx / 2.0f) * projCo[0] / projCo[3]);
 		ps->cloneOffset[1] = mouse[1] - ((float)(ps->winy / 2.0f) + (ps->winy / 2.0f) * projCo[1] / projCo[3]);
-	}	
+	}
 }	
 
 static void project_paint_end(ProjPaintState *ps)
 {
 	int a;
+	ProjPaintImage *projIma;
 	
 	/* build undo data from original pixel colors */
 	if (U.uiflag & USER_GLOBALUNDO) {
@@ -3525,7 +3560,14 @@ static void project_paint_end(ProjPaintState *ps)
 		if (tmpibuf_float) IMB_freeImBuf(tmpibuf_float);
 	}
 	/* done calculating undo data */
-	
+
+	/* dereference used image buffers */
+	for (a = 0, projIma = ps->projImages; a < ps->image_tot; a++, projIma++) {
+		BKE_image_release_ibuf(projIma->ima, projIma->ibuf, NULL);
+	}
+
+	BKE_image_release_ibuf(ps->reproject_image, ps->reproject_ibuf, NULL);
+
 	MEM_freeN(ps->screenCoords);
 	MEM_freeN(ps->bucketRect);
 	MEM_freeN(ps->bucketFaces);
@@ -3561,7 +3603,7 @@ static void project_paint_end(ProjPaintState *ps)
 		ps->dm->release(ps->dm);
 }
 
-/* 1= an undo, -1 is a redo. */
+/* 1 = an undo, -1 is a redo. */
 static void partial_redraw_array_init(ImagePaintPartialRedraw *pr)
 {
 	int tot = PROJ_BOUNDBOX_SQUARED;
@@ -3583,11 +3625,11 @@ static int partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPar
 {
 	int touch = 0;
 	while (tot--) {
-		pr->x1 = MIN2(pr->x1, pr_other->x1);
-		pr->y1 = MIN2(pr->y1, pr_other->y1);
+		pr->x1 = min_ii(pr->x1, pr_other->x1);
+		pr->y1 = min_ii(pr->y1, pr_other->y1);
 		
-		pr->x2 = MAX2(pr->x2, pr_other->x2);
-		pr->y2 = MAX2(pr->y2, pr_other->y2);
+		pr->x2 = max_ii(pr->x2, pr_other->x2);
+		pr->y2 = max_ii(pr->y2, pr_other->y2);
 		
 		if (pr->x2 != -1)
 			touch = 1;
@@ -3814,15 +3856,97 @@ static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, fl
 	BLI_linklist_prepend_arena(smearPixels_f, (void *)projPixel, smearArena);
 }
 
+/* do_projectpaint_soften for float & byte
+ */
+static float inv_pow2(float f)
+{
+	f = 1.0f - f;
+	f = f * f;
+	return 1.0f - f;
+}
+
+static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *softenArena, LinkNode **softenPixels)
+{
+	unsigned int accum_tot = 0;
+	unsigned int i;
+
+	float *rgba = projPixel->newColor.f;
+
+	/* sigh, alpha values tend to need to be a _lot_ stronger with blur */
+	mask  = inv_pow2(mask);
+	alpha = inv_pow2(alpha);
+
+	/* rather then painting, accumulate surrounding colors */
+	zero_v4(rgba);
+
+	for (i = 0; i < PROJ_PIXEL_SOFTEN_TOT; i++) {
+		float co_ofs[2];
+		float rgba_tmp[4];
+		sub_v2_v2v2(co_ofs, projPixel->projCoSS, proj_pixel_soften_v2[i]);
+		if (project_paint_PickColor(ps, co_ofs, rgba_tmp, NULL, TRUE)) {
+			add_v4_v4(rgba, rgba_tmp);
+			accum_tot++;
+		}
+	}
+
+	if (LIKELY(accum_tot != 0)) {
+		mul_v4_fl(rgba, 1.0f / (float)accum_tot);
+		blend_color_mix_float(rgba, projPixel->pixel.f_pt, rgba, alpha);
+		if (mask < 1.0f) blend_color_mix_float(rgba, projPixel->origColor.f, rgba, mask);
+		BLI_linklist_prepend_arena(softenPixels, (void *)projPixel, softenArena);
+	}
+}
+
+static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *softenArena, LinkNode **softenPixels)
+{
+	unsigned int accum_tot = 0;
+	unsigned int i;
+
+	float rgba[4];  /* convert to byte after */
+
+	/* sigh, alpha values tend to need to be a _lot_ stronger with blur */
+	mask  = inv_pow2(mask);
+	alpha = inv_pow2(alpha);
+
+	/* rather then painting, accumulate surrounding colors */
+	zero_v4(rgba);
+
+	for (i = 0; i < PROJ_PIXEL_SOFTEN_TOT; i++) {
+		float co_ofs[2];
+		float rgba_tmp[4];
+		sub_v2_v2v2(co_ofs, projPixel->projCoSS, proj_pixel_soften_v2[i]);
+		if (project_paint_PickColor(ps, co_ofs, rgba_tmp, NULL, TRUE)) {
+			add_v4_v4(rgba, rgba_tmp);
+			accum_tot++;
+		}
+	}
+
+	if (LIKELY(accum_tot != 0)) {
+		unsigned char *rgba_ub = projPixel->newColor.ch;
+
+		mul_v4_fl(rgba, 1.0f / (float)accum_tot);
+		IMAPAINT_FLOAT_RGBA_TO_CHAR(rgba_ub, rgba);
+
+		blend_color_mix(rgba_ub, projPixel->pixel.ch_pt, rgba_ub, (int)(alpha * 255));
+		if (mask != 1.0f) blend_color_mix(rgba_ub, projPixel->origColor.ch, rgba_ub, (int)(mask * 255));
+		BLI_linklist_prepend_arena(softenPixels, (void *)projPixel, softenArena);
+	}
+}
+
+BLI_INLINE void rgba_float_to_uchar__mul_v3(unsigned char rgba_ub[4], const float rgba[4], const float rgb[3])
+{
+	rgba_ub[0] = f_to_char(rgba[0] * rgb[0]);
+	rgba_ub[1] = f_to_char(rgba[1] * rgb[1]);
+	rgba_ub[2] = f_to_char(rgba[2] * rgb[2]);
+	rgba_ub[3] = f_to_char(rgba[3]);
+}
+
 static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, const float rgba[4], float alpha, float mask)
 {
 	unsigned char rgba_ub[4];
 	
 	if (ps->is_texbrush) {
-		rgba_ub[0] = FTOCHAR(rgba[0] * ps->brush->rgb[0]);
-		rgba_ub[1] = FTOCHAR(rgba[1] * ps->brush->rgb[1]);
-		rgba_ub[2] = FTOCHAR(rgba[2] * ps->brush->rgb[2]);
-		rgba_ub[3] = FTOCHAR(rgba[3]);
+		rgba_float_to_uchar__mul_v3(rgba_ub, rgba, ps->brush->rgb);
 	}
 	else {
 		IMAPAINT_FLOAT_RGB_TO_CHAR(rgba_ub, ps->brush->rgb);
@@ -3912,6 +4036,10 @@ static void *do_projectpaint_thread(void *ph_v)
 	LinkNode *smearPixels = NULL;
 	LinkNode *smearPixels_f = NULL;
 	MemArena *smearArena = NULL; /* mem arena for this brush projection only */
+
+	LinkNode *softenPixels = NULL;
+	LinkNode *softenPixels_f = NULL;
+	MemArena *softenArena = NULL; /* mem arena for this brush projection only */
 	
 	if (tool == PAINT_TOOL_SMEAR) {
 		pos_ofs[0] = pos[0] - lastpos[0];
@@ -3919,6 +4047,9 @@ static void *do_projectpaint_thread(void *ph_v)
 		
 		smearArena = BLI_memarena_new(1 << 16, "paint smear arena");
 	}
+	else if (tool == PAINT_TOOL_SOFTEN) {
+		softenArena = BLI_memarena_new(1 << 16, "paint soften arena");
+	}
 	
 	/* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
 	
@@ -4032,11 +4163,11 @@ static void *do_projectpaint_thread(void *ph_v)
 							/* end copy */
 
 							last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index;
-							last_partial_redraw_cell->x1 = MIN2(last_partial_redraw_cell->x1, projPixel->x_px);
-							last_partial_redraw_cell->y1 = MIN2(last_partial_redraw_cell->y1, projPixel->y_px);
+							last_partial_redraw_cell->x1 = min_ii(last_partial_redraw_cell->x1, (int)projPixel->x_px);
+							last_partial_redraw_cell->y1 = min_ii(last_partial_redraw_cell->y1, (int)projPixel->y_px);
 
-							last_partial_redraw_cell->x2 = MAX2(last_partial_redraw_cell->x2, projPixel->x_px + 1);
-							last_partial_redraw_cell->y2 = MAX2(last_partial_redraw_cell->y2, projPixel->y_px + 1);
+							last_partial_redraw_cell->x2 = max_ii(last_partial_redraw_cell->x2, (int)projPixel->x_px + 1);
+							last_partial_redraw_cell->y2 = max_ii(last_partial_redraw_cell->y2, (int)projPixel->y_px + 1);
 
 							
 							switch (tool) {
@@ -4058,6 +4189,10 @@ static void *do_projectpaint_thread(void *ph_v)
 									if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co);
 									else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co);
 									break;
+								case PAINT_TOOL_SOFTEN:
+									if (is_floatbuf) do_projectpaint_soften_f(ps, projPixel, alpha, mask, softenArena, &softenPixels_f);
+									else do_projectpaint_soften(ps, projPixel, alpha, mask, softenArena, &softenPixels);
+									break;
 								default:
 									if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask, use_color_correction);
 									else do_projectpaint_draw(ps, projPixel, rgba, alpha, mask);
@@ -4092,7 +4227,21 @@ static void *do_projectpaint_thread(void *ph_v)
 		
 		BLI_memarena_free(smearArena);
 	}
-	
+	else if (tool == PAINT_TOOL_SOFTEN) {
+
+		for (node = softenPixels; node; node = node->next) { /* this wont run for a float image */
+			projPixel = node->link;
+			*projPixel->pixel.uint_pt = projPixel->newColor.uint;
+		}
+
+		for (node = softenPixels_f; node; node = node->next) {
+			projPixel = node->link;
+			copy_v4_v4(projPixel->pixel.f_pt, projPixel->newColor.f);
+		}
+
+		BLI_memarena_free(softenArena);
+	}
+
 	return NULL;
 }
 
@@ -4100,7 +4249,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp
 {
 	/* First unpack args from the struct */
 	ProjPaintState *ps = (ProjPaintState *)state;
-	int touch_any = 0;	
+	int touch_any = 0;
 	
 	ProjectHandle handles[BLENDER_MAX_THREADS];
 	ListBase threads;
@@ -4133,7 +4282,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp
 		/* image bounds */
 		for (i = 0; i < ps->image_tot; i++) {
 			handles[a].projImages[i].partRedrawRect = (ImagePaintPartialRedraw *)BLI_memarena_alloc(ps->arena_mt[a], sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
-			memcpy(handles[a].projImages[i].partRedrawRect, ps->projImages[i].partRedrawRect, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);			
+			memcpy(handles[a].projImages[i].partRedrawRect, ps->projImages[i].partRedrawRect, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
 		}
 
 		if (ps->thread_tot > 1)
@@ -4222,10 +4371,10 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
 		imapaintpartial.enabled = 1;
 	}
 	else {
-		imapaintpartial.x1 = MIN2(imapaintpartial.x1, x);
-		imapaintpartial.y1 = MIN2(imapaintpartial.y1, y);
-		imapaintpartial.x2 = MAX2(imapaintpartial.x2, x + w);
-		imapaintpartial.y2 = MAX2(imapaintpartial.y2, y + h);
+		imapaintpartial.x1 = min_ii(imapaintpartial.x1, x);
+		imapaintpartial.y1 = min_ii(imapaintpartial.y1, y);
+		imapaintpartial.x2 = max_ii(imapaintpartial.x2, x + w);
+		imapaintpartial.y2 = max_ii(imapaintpartial.y2, y + h);
 	}
 
 	w = ((x + w - 1) >> IMAPAINT_TILE_BITS);
@@ -4249,7 +4398,7 @@ static void imapaint_image_update(Scene *scene, SpaceImage *sima, Image *image,
 		IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect, ibuf->x, 0, 0,
 		                                  &scene->view_settings, &scene->display_settings,
 		                                  imapaintpartial.x1, imapaintpartial.y1,
-		                                  imapaintpartial.x2, imapaintpartial.y2);
+		                                  imapaintpartial.x2, imapaintpartial.y2, FALSE);
 	}
 	else {
 		ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
@@ -4545,7 +4694,7 @@ static int texpaint_break_stroke(float *prevuv, float *fwuv, float *bkuv, float
 
 static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, s->sima ? &s->sima->iuser : NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, s->sima ? &s->sima->iuser : NULL, NULL);
 	
 	/* verify that we can paint and set canvas */
 	if (ima == NULL) {
@@ -4554,7 +4703,7 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 	else if (ima->packedfile && ima->rr) {
 		s->warnpackedfile = ima->id.name + 2;
 		return 0;
-	}	
+	}
 	else if (ibuf && ibuf->channels != 4) {
 		s->warnmultifile = ima->id.name + 2;
 		return 0;
@@ -4568,10 +4717,12 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 	/* set clone canvas */
 	if (s->tool == PAINT_TOOL_CLONE) {
 		ima = s->brush->clone.image;
-		ibuf = BKE_image_get_ibuf(ima, s->sima ? &s->sima->iuser : NULL);
+		ibuf = BKE_image_acquire_ibuf(ima, s->sima ? &s->sima->iuser : NULL, NULL);
 		
-		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
+		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) {
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 			return 0;
+		}
 
 		s->clonecanvas = ibuf;
 
@@ -4586,13 +4737,15 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 	return 1;
 }
 
-static void imapaint_canvas_free(ImagePaintState *UNUSED(s))
+static void imapaint_canvas_free(ImagePaintState *s)
 {
+	BKE_image_release_ibuf(s->image, s->canvas, NULL);
+	BKE_image_release_ibuf(s->brush->clone.image, s->clonecanvas, NULL);
 }
 
 static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter, Image *image, short texpaint, float *uv, double time, int update, float pressure)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(image, s->sima ? &s->sima->iuser : NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(image, s->sima ? &s->sima->iuser : NULL, NULL);
 	float pos[2];
 	int is_data;
 
@@ -4612,9 +4765,13 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
 	if (BKE_brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, is_data == FALSE)) {
 		if (update)
 			imapaint_image_update(s->scene, s->sima, image, ibuf, texpaint);
+		BKE_image_release_ibuf(image, ibuf, NULL);
 		return 1;
 	}
-	else return 0;
+	else {
+		BKE_image_release_ibuf(image, ibuf, NULL);
+		return 0;
+	}
 }
 
 static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, const int prevmval[2], const int mval[2], double time, float pressure)
@@ -4632,7 +4789,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 			ImBuf *ibuf;
 			
 			newimage = imapaint_face_image(s, newfaceindex);
-			ibuf = BKE_image_get_ibuf(newimage, s->sima ? &s->sima->iuser : NULL);
+			ibuf = BKE_image_acquire_ibuf(newimage, s->sima ? &s->sima->iuser : NULL, NULL);
 
 			if (ibuf && ibuf->rect)
 				imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv);
@@ -4640,6 +4797,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 				newimage = NULL;
 				newuv[0] = newuv[1] = 0.0f;
 			}
+
+			BKE_image_release_ibuf(newimage, ibuf, NULL);
 		}
 		else
 			newuv[0] = newuv[1] = 0.0f;
@@ -4842,6 +5001,10 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
 	ps->tool = brush->imagepaint_tool;
 	ps->blend = brush->blend;
 
+	/* sizeof ProjPixel, since we alloc this a _lot_ */
+	ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
+	BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
+
 	ps->is_airbrush = (brush->flag & BRUSH_AIRBRUSH) ? 1 : 0;
 	ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
 
@@ -4907,13 +5070,6 @@ static int texture_paint_init(bContext *C, wmOperator *op)
 
 	pop->first = 1;
 	op->customdata = pop;
-	
-	/* XXX: Soften tool does not support projection painting atm, so just disable
-	 *      projection for this brush */
-	if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
-		settings->imapaint.flag |= IMAGEPAINT_PROJECT_DISABLE;
-		pop->restore_projection = 1;
-	}
 
 	/* initialize from context */
 	if (CTX_wm_region_view3d(C)) {
@@ -5048,7 +5204,7 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 		pop->prevmouse[1] = mouse[1];
 
 	}
-	else { 
+	else {
 		redraw = imapaint_paint_stroke(&pop->vc, &pop->s, pop->painter, pop->mode == PAINT_MODE_3D, pop->prevmouse, mouse, time, pressure);
 		pop->prevmouse[0] = mouse[0];
 		pop->prevmouse[1] = mouse[1];
@@ -5066,7 +5222,7 @@ static void paint_brush_exit_tex(Brush *brush)
 		MTex *mtex = &brush->mtex;
 		if (mtex->tex && mtex->tex->nodetree)
 			ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1);
-	}	
+	}
 }
 
 static void paint_exit(bContext *C, wmOperator *op)
@@ -5266,10 +5422,12 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
 	if (!rv3d) {
 		SpaceImage *sima = CTX_wm_space_image(C);
 		ARegion *ar = CTX_wm_region(C);
-		
-		ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
 
-		return 1;
+		if (sima->mode == SI_MODE_PAINT) {
+			ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
+
+			return 1;
+		}
 	}
 
 	*zoomx = *zoomy = 1;
@@ -5285,24 +5443,21 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 #define PX_SIZE_FADE_MIN 4.0f
 
 	Scene *scene = CTX_data_scene(C);
-	//Brush *brush= image_paint_brush(C);
+	//Brush *brush = image_paint_brush(C);
 	Paint *paint = paint_get_active_from_context(C);
 	Brush *brush = paint_brush(paint);
 
 	if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
-		ToolSettings *ts;
 		float zoomx, zoomy;
 		const float size = (float)BKE_brush_size_get(scene, brush);
 		short use_zoom;
 		float pixel_size;
 		float alpha = 0.5f;
 
-		ts = scene->toolsettings;
-		use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy) &&
-		           !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT));
+		use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy);
 
 		if (use_zoom) {
-			pixel_size = size * maxf(zoomx, zoomy);
+			pixel_size = size * max_ff(zoomx, zoomy);
 		}
 		else {
 			pixel_size = size;
@@ -5654,7 +5809,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	
 	if (BKE_object_obdata_is_libdata(ob)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -5767,7 +5922,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
 	}
 
 	ps.reproject_image = image;
-	ps.reproject_ibuf = BKE_image_get_ibuf(image, NULL);
+	ps.reproject_ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 
 	if (ps.reproject_ibuf == NULL || ps.reproject_ibuf->rect == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Image data could not be found");
@@ -5890,7 +6045,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
 	if (!ibuf) {
 		/* Mostly happens when OpenGL offscreen buffer was failed to create, */
 		/* but could be other reasons. Should be handled in the future. nazgul */
-		BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer: %s", err_out);
+		BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer: %s", err_out);
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 39a9530..40dcb92 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -93,7 +93,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
 	Scene *scene = CTX_data_scene(C);
 	Paint  *paint =  paint_get_active_from_context(C);
 	struct Brush  *brush =  paint_brush(paint);
-	// Object *ob=     CTX_data_active_object(C);
+	// Object *ob = CTX_data_active_object(C);
 	float scalar = RNA_float_get(op->ptr, "scalar");
 
 	if (brush) {
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 2ae24db..9ebeb61 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -195,7 +195,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
 
 /* Returns zero if no sculpt changes should be made, non-zero otherwise */
 static int paint_smooth_stroke(PaintStroke *stroke, float output[2],
-							   const PaintSample *sample)
+                               const PaintSample *sample)
 {
 	output[0] = sample->mouse[0];
 	output[1] = sample->mouse[1];
@@ -255,7 +255,7 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
 			if (pressure > FLT_EPSILON) {
 				/* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel
 				 * causing very high step sizes, hanging blender [#32381] */
-				const float size_clamp = maxf(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure);
+				const float size_clamp = max_ff(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure);
 				scale = (size_clamp * stroke->brush->spacing / 50.0f) / length;
 				if (scale > FLT_EPSILON) {
 					mul_v2_fl(vec, scale);
@@ -406,10 +406,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 	paint_stroke_add_sample(p, stroke, event->x, event->y);
 	paint_stroke_sample_average(stroke, &sample_average);
 
-	// let NDOF motion pass through to the 3D view so we can paint and rotate simultaneously!
-	// this isn't perfect... even when an extra MOUSEMOVE is spoofed, the stroke discards it
-	// since the 2D deltas are zero -- code in this file needs to be updated to use the
-	// post-NDOF_MOTION MOUSEMOVE
+	/* let NDOF motion pass through to the 3D view so we can paint and rotate simultaneously!
+	 * this isn't perfect... even when an extra MOUSEMOVE is spoofed, the stroke discards it
+	 * since the 2D deltas are zero -- code in this file needs to be updated to use the
+	 * post-NDOF_MOTION MOUSEMOVE */
 	if (event->type == NDOF_MOTION)
 		return OPERATOR_PASS_THROUGH;
 
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index b367951..cb4b634 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -248,19 +248,25 @@ static void imapaint_tri_weights(Object *ob,
 void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const int xy[2], float uv[2])
 {
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
-	const int *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	MTFace *tface = dm->getTessFaceDataArray(dm, CD_MTFACE), *tf;
 	int numfaces = dm->getNumTessFaces(dm), a, findex;
 	float p[2], w[3], absw, minabsw;
 	MFace mf;
 	MVert mv[4];
 
+	/* double lookup */
+	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
 	minabsw = 1e10;
 	uv[0] = uv[1] = 0.0;
 
 	/* test all faces in the derivedmesh with the original index of the picked face */
 	for (a = 0; a < numfaces; a++) {
-		findex = index ? index[a] : a;
+		findex = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
 
 		if (findex == faceindex) {
 			dm->getTessFace(dm, a, &mf);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 6b3017b..94b0010 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -79,6 +79,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "GPU_buffers.h"
 
 #include "ED_armature.h"
 #include "ED_mesh.h"
@@ -106,18 +107,42 @@ static int vertex_paint_use_fast_update_check(Object *ob)
 /* if the polygons from the mesh and the 'derivedFinal' match
  * we can assume that no modifiers are applied and that its worth adding tessellated faces
  * so 'vertex_paint_use_fast_update_check()' returns TRUE */
-static int vertex_paint_use_tessface_check(Object *ob)
+static int vertex_paint_use_tessface_check(Object *ob, Mesh *me)
 {
 	DerivedMesh *dm = ob->derivedFinal;
 
-	if (dm) {
-		Mesh *me = BKE_mesh_from_object(ob);
-		return (me->mpoly == CustomData_get_layer(&dm->faceData, CD_MPOLY));
+	if (me && dm) {
+		return (me->mpoly == CustomData_get_layer(&dm->polyData, CD_MPOLY));
 	}
 
 	return FALSE;
 }
 
+static void update_tessface_data(Object *ob, Mesh *me)
+{
+	if (vertex_paint_use_tessface_check(ob, me)) {
+		/* assume if these exist, that they are up to date & valid */
+		if (!me->mcol || !me->mface) {
+			/* should always be true */
+			/* XXX Why this clearing? tessface_calc will reset it anyway! */
+#if 0
+			if (me->mcol) {
+				memset(me->mcol, 255, 4 * sizeof(MCol) * me->totface);
+			}
+#endif
+
+			/* create tessfaces because they will be used for drawing & fast updates */
+			BKE_mesh_tessface_calc(me); /* does own call to update pointers */
+		}
+	}
+	else {
+		if (me->totface) {
+			/* this wont be used, theres no need to keep it */
+			BKE_mesh_tessface_clear(me);
+		}
+	}
+
+}
 /* polling - retrieve whether cursor should be set or operator should be done */
 
 /* Returns true if vertex paint mode is active */
@@ -326,29 +351,12 @@ static void make_vertexcol(Object *ob)  /* single ob */
 			CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface);
 		}
 		if (!me->mloopcol) {
-			CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop);	
+			CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop);
 		}
 		mesh_update_customdata_pointers(me, TRUE);
 	}
 
-	if (vertex_paint_use_tessface_check(ob)) {
-		/* assume if these exist, that they are up to date & valid */
-		if (!me->mcol || !me->mface) {
-			/* should always be true */
-			if (me->mcol) {
-				memset(me->mcol, 255, 4 * sizeof(MCol) * me->totface);
-			}
-
-			/* create tessfaces because they will be used for drawing & fast updates */
-			BKE_mesh_tessface_calc(me); /* does own call to update pointers */
-		}
-	}
-	else {
-		if (me->totface) {
-			/* this wont be used, theres no need to keep it */
-			BKE_mesh_tessface_clear(me);
-		}
-	}
+	update_tessface_data(ob, me);
 
 	//if (shade)
 	//	shadeMeshMCol(scene, ob, me);
@@ -1526,7 +1534,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 				if (total_changed > 1 && do_multipaint) {
 					float undo_change = get_mp_change(ndv, defbase_tot, defbase_sel, left_over);
 					multipaint_selection(ndv, defbase_tot, undo_change, defbase_sel);
-				}	
+				}
 				/* or designatedw is still -1 put weight back as evenly as possible */
 				else {
 					redistribute_change(ndv, defbase_tot, change_status, 2, -2, left_over, total_changed, do_auto_normalize);
@@ -1535,7 +1543,6 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 		}
 		else {
 			/* reset the weights */
-			unsigned int i;
 			MDeformWeight *dw_old = odv->dw;
 			MDeformWeight *dw_new = ndv->dw;
 
@@ -2049,7 +2056,6 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU
 	Object *ob = CTX_data_active_object(C);
 	struct WPaintData *wpd;
 	Mesh *me;
-	bDeformGroup *dg;
 
 	float mat[4][4], imat[4][4];
 	
@@ -2098,12 +2104,14 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU
 		return FALSE;
 	}
 
-	/* check if we are attempting to paint onto a locked vertex group,
-	 * and other options disallow it from doing anything useful */
-	dg = BLI_findlink(&ob->defbase, (ob->actdef - 1));
-	if (dg->flag & DG_LOCK_WEIGHT) {
-		BKE_report(op->reports, RPT_WARNING, "Active group is locked, aborting");
-		return FALSE;
+	{
+		/* check if we are attempting to paint onto a locked vertex group,
+		 * and other options disallow it from doing anything useful */
+		bDeformGroup *dg = BLI_findlink(&ob->defbase, (ob->actdef - 1));
+		if (dg->flag & DG_LOCK_WEIGHT) {
+			BKE_report(op->reports, RPT_WARNING, "Active group is locked, aborting");
+			return FALSE;
+		}
 	}
 
 	/* ALLOCATIONS! no return after this line */
@@ -2564,7 +2572,7 @@ static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
 
 	vd->polyfacemap = BLI_memarena_alloc(vd->polyfacemap_arena, sizeof(ListBase) * me->totpoly);
 
-	origIndex = CustomData_get_layer(&me->fdata, CD_POLYINDEX);
+	origIndex = CustomData_get_layer(&me->fdata, CD_ORIGINDEX);
 	mf = me->mface;
 
 	if (!origIndex)
@@ -2600,7 +2608,12 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl
 		make_vertexcol(ob);
 	if (me->mloopcol == NULL)
 		return OPERATOR_CANCELLED;
-	
+
+	/* Update tessface data if needed
+	 * Added here too because e.g. switching to/from edit mode would remove tessface data,
+	 * yet "fast_update" could still be used! */
+	update_tessface_data(ob, me);
+
 	/* make mode data storage */
 	vpd = MEM_callocN(sizeof(struct VPaintData), "VPaintData");
 	paint_stroke_set_mode_data(stroke, vpd);
@@ -2616,9 +2629,11 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl
 	if (vertex_paint_use_fast_update_check(ob)) {
 		vpaint_build_poly_facemap(vpd, me);
 		vpd->use_fast_update = TRUE;
+/*		printf("Fast update!\n");*/
 	}
 	else {
 		vpd->use_fast_update = FALSE;
+/*		printf("No fast update!\n");*/
 	}
 
 	/* for filtering */
@@ -2632,14 +2647,6 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl
 	return 1;
 }
 
-static void copy_lcol_to_mcol(MCol *mcol, const MLoopCol *lcol)
-{
-	mcol->a = lcol->a;
-	mcol->r = lcol->r;
-	mcol->g = lcol->g;
-	mcol->b = lcol->b;
-}
-
 static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
                               const unsigned int index, const float mval[2],
                               const float brush_size_pressure, const float brush_alpha_pressure)
@@ -2707,11 +2714,18 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
 			ml = me->mloop + mpoly->loopstart;
 			mlc = me->mloopcol + mpoly->loopstart;
 			for (j = 0; j < mpoly->totloop; j++, ml++, mlc++) {
-				if      (ml->v == mf->v1)            copy_lcol_to_mcol(mc + 0, mlc);
-				else if (ml->v == mf->v2)            copy_lcol_to_mcol(mc + 1, mlc);
-				else if (ml->v == mf->v3)            copy_lcol_to_mcol(mc + 2, mlc);
-				else if (mf->v4 && ml->v == mf->v4)  copy_lcol_to_mcol(mc + 3, mlc);
-
+				if (ml->v == mf->v1) {
+					MESH_MLOOPCOL_TO_MCOL(mlc, mc + 0);
+				}
+				else if (ml->v == mf->v2) {
+					MESH_MLOOPCOL_TO_MCOL(mlc, mc + 1);
+				}
+				else if (ml->v == mf->v3) {
+					MESH_MLOOPCOL_TO_MCOL(mlc, mc + 2);
+				}
+				else if (mf->v4 && ml->v == mf->v4) {
+					MESH_MLOOPCOL_TO_MCOL(mlc, mc + 3);
+				}
 			}
 		}
 	}
@@ -2792,6 +2806,10 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 		 * avoid this if we can! */
 		DAG_id_tag_update(ob->data, 0);
 	}
+	else if (!GPU_buffer_legacy(ob->derivedFinal)) {
+		/* If using new VBO drawing, mark mcol as dirty to force colors gpu buffer refresh! */
+		ob->derivedFinal->dirty |= DM_DIRTY_MCOL_UPDATE_DRAW;
+	}
 }
 
 static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index e03c2fb..e2ed777 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3076,6 +3076,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
 	MultiresModifierData *mmd = sculpt_multires_active(scene, ob);
 
 	ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob);
+	ss->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
 
 	if (need_mask) {
 		if (mmd == NULL) {
@@ -3130,6 +3131,8 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
 	ss->pbvh = dm->getPBVH(ob, dm);
 	ss->pmap = (need_pmap && dm->getPolyMap) ? dm->getPolyMap(ob, dm) : NULL;
 
+	pbvh_show_diffuse_color_set(ss->pbvh, ss->show_diffuse_color);
+
 	if (ss->modifiers_active) {
 		if (!ss->orig_cos) {
 			int a;
@@ -3353,7 +3356,10 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
 	sculpt_init_mirror_clipping(ob, ss);
 
 	/* Initial mouse location */
-	copy_v2_v2(ss->cache->initial_mouse, mouse);
+	if (mouse)
+		copy_v2_v2(ss->cache->initial_mouse, mouse);
+	else
+		zero_v2(ss->cache->initial_mouse);
 
 	mode = RNA_enum_get(op->ptr, "mode");
 	cache->invert = mode == BRUSH_STROKE_INVERT;
@@ -3513,7 +3519,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
 		if (tool == SCULPT_TOOL_GRAB)
 			copy_v3_v3(sd->anchored_location, cache->true_location);
 		else if (tool == SCULPT_TOOL_THUMB)
-			copy_v3_v3(sd->anchored_location, cache->orig_grab_location);			
+			copy_v3_v3(sd->anchored_location, cache->orig_grab_location);
 
 		if (ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) {
 			/* location stays the same for finding vertices in brush radius */
@@ -3536,8 +3542,6 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 	StrokeCache *cache = ss->cache;
 	Brush *brush = paint_brush(&sd->paint);
 
-	int dx, dy;
-
 	/* RNA_float_get_array(ptr, "location", cache->traced_location); */
 
 	if (cache->first_time ||
@@ -3606,8 +3610,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 	if (brush->flag & BRUSH_ANCHORED) {
 		int hit = 0;
 
-		dx = cache->mouse[0] - cache->initial_mouse[0];
-		dy = cache->mouse[1] - cache->initial_mouse[1];
+		const float dx = cache->mouse[0] - cache->initial_mouse[0];
+		const float dy = cache->mouse[1] - cache->initial_mouse[1];
 
 		sd->anchored_size = cache->pixel_radius = sqrt(dx * dx + dy * dy);
 
@@ -3617,8 +3621,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 			float halfway[2];
 			float out[3];
 
-			halfway[0] = (float)dx * 0.5f + cache->initial_mouse[0];
-			halfway[1] = (float)dy * 0.5f + cache->initial_mouse[1];
+			halfway[0] = dx * 0.5f + cache->initial_mouse[0];
+			halfway[1] = dy * 0.5f + cache->initial_mouse[1];
 
 			if (sculpt_stroke_get_location(C, out, halfway)) {
 				copy_v3_v3(sd->anchored_location, out);
@@ -3665,8 +3669,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 	sculpt_update_brush_delta(sd, ob, brush);
 
 	if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
-		dx = cache->mouse[0] - cache->initial_mouse[0];
-		dy = cache->mouse[1] - cache->initial_mouse[1];
+		const float dx = cache->mouse[0] - cache->initial_mouse[0];
+		const float dy = cache->mouse[1] - cache->initial_mouse[1];
 
 		cache->vertex_rotation = -atan2f(dx, dy) * cache->bstrength;
 
@@ -3760,6 +3764,7 @@ int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2])
 	mval[0] = mouse[0] - vc.ar->winrct.xmin;
 	mval[1] = mouse[1] - vc.ar->winrct.ymin;
 
+	/* TODO: what if the segment is totally clipped? (return == 0) */
 	ED_view3d_win_to_segment_clip(vc.ar, vc.v3d, mval, ray_start, ray_end);
 
 	invert_m4_m4(obimat, ob->obmat);
@@ -3889,8 +3894,8 @@ static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
                                     const float mouse[2])
 {
 	/* Don't start the stroke until mouse goes over the mesh.
-	 * note: event will only be null when re-executing the saved stroke. */
-	if (over_mesh(C, op, mouse[0], mouse[1])) {
+	 * note: mouse will only be null when re-executing the saved stroke. */
+	if (!mouse || over_mesh(C, op, mouse[0], mouse[1])) {
 		Object *ob = CTX_data_active_object(C);
 		SculptSession *ss = ob->sculpt;
 		Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -4153,7 +4158,7 @@ int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
 	 * isn't one already */
 	if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
 		GridPaintMask *gmask;
-		int level = MAX2(1, mmd->sculptlvl);
+		int level = max_ii(1, mmd->sculptlvl);
 		int gridsize = ccg_gridsize(level);
 		int gridarea = gridsize * gridsize;
 		int i, j;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index b204fc7..1b3fd24 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -99,7 +99,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
 	Object *ob = CTX_data_active_object(C);
 	SculptSession *ss = ob->sculpt;
 	MVert *mvert;
-	int *index, i, j;	
+	int *index, i, j;
 	
 	if (unode->maxvert) {
 		/* regular mesh restore */
@@ -224,7 +224,7 @@ static int sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNode
 	SculptSession *ss = ob->sculpt;
 	MVert *mvert;
 	float *vmask;
-	int *index, i, j;	
+	int *index, i, j;
 	
 	if (unode->maxvert) {
 		/* regular mesh restore */
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 10adeb3..9bd7d2a 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -98,7 +98,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
 	/* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
 	UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
 	
-	/* loop through channels, and set up drawing depending on their type  */	
+	/* loop through channels, and set up drawing depending on their type  */
 	{   /* first pass: just the standard GL-drawing for backdrop + text */
 		y = (float)ACHANNEL_FIRST;
 		
@@ -189,7 +189,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
 
 	/* if in NLA there's a strip active, map the view */
 	if (ac->datatype == ANIMCONT_ACTION) {
-		/* adt= ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */
+		/* adt = ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */
 		
 		/* start and end of action itself */
 		calc_action_range(ac->data, &act_start, &act_end, 0);
@@ -307,7 +307,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
 		
 		/*	Increment the step */
 		y -= ACHANNEL_STEP;
-	}		
+	}
 	glDisable(GL_BLEND);
 	
 	/* Draw keyframes 
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index cd036d7..a80d425 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -52,6 +52,7 @@
 
 #include "BKE_action.h"
 #include "BKE_fcurve.h"
+#include "BKE_global.h"
 #include "BKE_nla.h"
 #include "BKE_context.h"
 #include "BKE_report.h"
@@ -132,7 +133,7 @@ void ACTION_OT_new(wmOperatorType *ot)
 	
 	/* api callbacks */
 	ot->exec = act_new_exec;
-	// NOTE: this is used in the NLA too...
+	/* NOTE: this is used in the NLA too... */
 	//ot->poll = ED_operator_action_active;
 	
 	/* flags */
@@ -234,8 +235,8 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
 	int filter;
 	
 	/* get data to filter, from Action or Dopesheet */
-	// XXX: what is sel doing here?!
-	//      Commented it, was breaking things (eg. the "auto preview range" tool).
+	/* XXX: what is sel doing here?!
+	 *      Commented it, was breaking things (eg. the "auto preview range" tool). */
 	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL *//*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
@@ -254,8 +255,9 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
 
 				/* find gp-frame which is less than or equal to cframe */
 				for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-					*min = MIN2(*min, gpf->framenum);
-					*max = MAX2(*max, gpf->framenum);
+					const float framenum = (float)gpf->framenum;
+					*min = min_ff(*min, framenum);
+					*max = max_ff(*max, framenum);
 				}
 			}
 			else if (ale->datatype == ALE_MASKLAY) {
@@ -267,8 +269,9 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
 				     masklay_shape;
 				     masklay_shape = masklay_shape->next)
 				{
-					*min = MIN2(*min, masklay_shape->frame);
-					*max = MAX2(*max, masklay_shape->frame);
+					const float framenum = (float)masklay_shape->frame;
+					*min = min_ff(*min, framenum);
+					*max = max_ff(*max, framenum);
 				}
 			}
 			else {
@@ -284,8 +287,8 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
 				}
 
 				/* try to set cur using these values, if they're more extreme than previously set values */
-				*min = MIN2(*min, tmin);
-				*max = MAX2(*max, tmax);
+				*min = min_ff(*min, tmin);
+				*max = max_ff(*max, tmax);
 			}
 		}
 		
@@ -491,9 +494,9 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 
 	/* copy keyframes */
-	if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
+	if (ac.datatype == ANIMCONT_GPENCIL) {
 		/* FIXME... */
-		BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode");
+		BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for grease pencil mode");
 		return OPERATOR_CANCELLED;
 	}
 	else if (ac.datatype == ANIMCONT_MASK) {
@@ -502,7 +505,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	else {
-		if (copy_action_keys(&ac)) {	
+		if (copy_action_keys(&ac)) {
 			BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer");
 			return OPERATOR_CANCELLED;
 		}
@@ -542,8 +545,8 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
 	
 	/* paste keyframes */
 	if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
-		// FIXME...
-		BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil or Mask mode");
+		/* FIXME... */
+		BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for grease pencil or mask mode");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -588,7 +591,7 @@ void ACTION_OT_paste(wmOperatorType *ot)
 static EnumPropertyItem prop_actkeys_insertkey_types[] = {
 	{1, "ALL", 0, "All Channels", ""},
 	{2, "SEL", 0, "Only Selected Channels", ""},
-	{3, "GROUP", 0, "In Active Group", ""}, // xxx not in all cases
+	{3, "GROUP", 0, "In Active Group", ""},  /* XXX not in all cases */
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -976,8 +979,8 @@ void ACTION_OT_sample(wmOperatorType *ot)
 
 /* defines for set extrapolation-type for selected keyframes tool */
 static EnumPropertyItem prop_actkeys_expo_types[] = {
-	{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", ""},
-	{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", ""},
+	{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", "Values on endpoint keyframes are held"},
+	{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", "Straight-line slope of end segments are extended past the endpoint keyframes"},
 	
 	{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
 	{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
@@ -1010,7 +1013,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
 			if (mode == MAKE_CYCLIC_EXPO) {
 				/* only add if one doesn't exist */
 				if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) {
-					// TODO: add some more preset versions which set different extrapolation options?
+					/* TODO: add some more preset versions which set different extrapolation options? */
 					add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES);
 				}
 			}
@@ -1306,6 +1309,15 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot)
 
 /* ***************** Jump to Selected Frames Operator *********************** */
 
+static int actkeys_framejump_poll(bContext *C)
+{
+	/* prevent changes during render */
+	if (G.is_rendering)
+		return 0;
+
+	return ED_operator_action_active(C);
+}
+
 /* snap current-frame indicator to 'average time' of selected keyframe */
 static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -1319,7 +1331,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 	
-	/* init edit data */	
+	/* init edit data */
 	/* loop over action data, averaging values */
 	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
 	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -1353,13 +1365,13 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_frame_jump(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Jump to Frame";
+	ot->name = "Jump to Keyframes";
 	ot->idname = "ACTION_OT_frame_jump";
-	ot->description = "Set the current frame to the average frame of the selected keyframes";
+	ot->description = "Set the current frame to the average frame value of selected keyframes";
 	
 	/* api callbacks */
 	ot->exec = actkeys_framejump_exec;
-	ot->poll = ED_operator_action_active;
+	ot->poll = actkeys_framejump_poll;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1369,13 +1381,13 @@ void ACTION_OT_frame_jump(wmOperatorType *ot)
 
 /* defines for snap keyframes tool */
 static EnumPropertyItem prop_actkeys_snap_types[] = {
-	{ACTKEYS_SNAP_CFRA, "CFRA", 0, "Current frame", 
+	{ACTKEYS_SNAP_CFRA, "CFRA", 0, "Current frame",
 	 "Snap selected keyframes to the current frame"},
-	{ACTKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", 
+	{ACTKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame",
 	 "Snap selected keyframes to the nearest (whole) frame (use to fix accidental sub-frame offsets)"},
-	{ACTKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", 
+	{ACTKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second",
 	 "Snap selected keyframes to the nearest second"},
-	{ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", 
+	{ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker",
 	 "Snap selected keyframes to the nearest marker"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -1410,15 +1422,20 @@ static void snap_action_keys(bAnimContext *ac, short mode)
 	for (ale = anim_data.first; ale; ale = ale->next) {
 		AnimData *adt = ANIM_nla_mapping_get(ac, ale);
 		
-		if (adt) {
+		if (ale->type == ANIMTYPE_GPLAYER) {
+			ED_gplayer_snap_frames(ale->data, ac->scene, mode);
+		}
+		else if (ale->type == ANIMTYPE_MASKLAYER) {
+			ED_masklayer_snap_frames(ale->data, ac->scene, mode);
+		}
+		else if (adt) {
 			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 
 			ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
 			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
-		//else if (ale->type == ACTTYPE_GPLAYER)
-		//	snap_gplayer_frames(ale->data, mode);
-		else 
+		else {
 			ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
+		}
 	}
 	
 	BLI_freelistN(&anim_data);
@@ -1434,11 +1451,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
 	/* get editor data */
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
-		
-	// XXX...
-	if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
-		return OPERATOR_PASS_THROUGH;
-		
+	
 	/* get snapping mode */
 	mode = RNA_enum_get(op->ptr, "type");
 	
@@ -1446,7 +1459,8 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
 	snap_action_keys(&ac, mode);
 	
 	/* validate keyframes after editing */
-	ANIM_editkeyframes_refresh(&ac);
+	if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+		ANIM_editkeyframes_refresh(&ac);
 	
 	/* set notifier that keyframes have changed */
 	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
@@ -1477,11 +1491,11 @@ void ACTION_OT_snap(wmOperatorType *ot)
 
 /* defines for mirror keyframes tool */
 static EnumPropertyItem prop_actkeys_mirror_types[] = {
-	{ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", 
+	{ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame",
 	 "Flip times of selected keyframes using the current frame as the mirror line"},
-	{ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", 
+	{ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0",
 	 "Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
-	{ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", 
+	{ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
 	 "Flip times of selected keyframes using the first selected marker as the reference point"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -1502,7 +1516,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
 	ked.scene = ac->scene;
 	
 	/* for 'first selected marker' mode, need to find first selected marker first! */
-	// XXX should this be made into a helper func in the API?
+	/* XXX should this be made into a helper func in the API? */
 	if (mode == ACTKEYS_MIRROR_MARKER) {
 		TimeMarker *marker = ED_markers_get_first_selected(ac->markers);
 		
@@ -1548,7 +1562,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 		
-	// XXX...
+	/* XXX... */
 	if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
 		return OPERATOR_PASS_THROUGH;
 		
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index c684ae1..10085d8 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -111,7 +111,7 @@ enum {
 	ACTKEYS_SNAP_CFRA = 1,
 	ACTKEYS_SNAP_NEAREST_FRAME,
 	ACTKEYS_SNAP_NEAREST_SECOND,
-	ACTKEYS_SNAP_NEAREST_MARKER,	
+	ACTKEYS_SNAP_NEAREST_MARKER,
 } eActKeys_Snap_Mode;
 
 /* defines for mirror keyframes 
@@ -121,7 +121,7 @@ enum {
 	ACTKEYS_MIRROR_CFRA = 1,
 	ACTKEYS_MIRROR_YAXIS,
 	ACTKEYS_MIRROR_XAXIS,
-	ACTKEYS_MIRROR_MARKER,	
+	ACTKEYS_MIRROR_MARKER,
 } eActKeys_Mirror_Mode;
 	
 /* ***************************************** */
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index e4a161e..cca71bb 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -168,9 +168,8 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
 	
 	
 	/* action_edit.c */
-	/* snap - current frame to selected keys */
-	// TODO: maybe since this is called jump, we're better to have it on <something>-J?
-	WM_keymap_add_item(keymap, "ACTION_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+	/* jump to selected keyframes */
+	WM_keymap_add_item(keymap, "ACTION_OT_frame_jump", GKEY, KM_PRESS, KM_CTRL, 0);
 		
 	/* menu + single-step transform */
 	WM_keymap_add_item(keymap, "ACTION_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 5da348b..d0f76c2 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -763,7 +763,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
 	if (leftright == ACTKEYS_LRSEL_LEFT) {
 		ked.f1 = MINAFRAMEF;
 		ked.f2 = (float)(CFRA + 0.1f);
-	} 
+	}
 	else {
 		ked.f1 = (float)(CFRA - 0.1f);
 		ked.f2 = MAXFRAMEF;
@@ -785,7 +785,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
 			ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
 			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
-		else if (ale->type == ANIMTYPE_GPLAYER)	
+		else if (ale->type == ANIMTYPE_GPLAYER)
 			ED_gplayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode);
 		else if (ale->type == ANIMTYPE_MASKLAYER)
 			ED_masklayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode);
@@ -869,7 +869,7 @@ static int actkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent
 		UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 		if (x < CFRA)
 			RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT);
-		else 	
+		else
 			RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_RIGHT);
 	}
 	
@@ -1081,7 +1081,7 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
 			/* dopesheet summary covers everything */
 			summary_to_keylist(ac, &anim_keys, NULL);
 		}
-		else if (ale->type == ANIMTYPE_GROUP) { 
+		else if (ale->type == ANIMTYPE_GROUP) {
 			// TODO: why don't we just give groups key_data too?
 			bActionGroup *agrp = (bActionGroup *)ale->data;
 			agroup_to_keylist(adt, agrp, &anim_keys, NULL);
@@ -1144,7 +1144,7 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
 					
 					agrp->flag |= AGRP_SELECTED;
 					ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
-				}	
+				}
 				else if (ale->type == ANIMTYPE_FCURVE) {
 					FCurve *fcu = ale->data;
 					
@@ -1210,7 +1210,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
 		return OPERATOR_CANCELLED;
 		
 	/* get useful pointers from animation context data */
-	/* ar= ac.ar; */ /* UNUSED */
+	/* ar = ac.ar; */ /* UNUSED */
 
 	/* select mode is either replace (deselect all, then add) or add/extend */
 	if (RNA_boolean_get(op->ptr, "extend"))
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 2e92b1e..c5f3cce 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -129,7 +129,7 @@ static SpaceLink *action_new(const bContext *C)
 /* not spacelink itself */
 static void action_free(SpaceLink *UNUSED(sl))
 {	
-//	SpaceAction *saction= (SpaceAction *) sl;
+//	SpaceAction *saction = (SpaceAction *) sl;
 }
 
 
@@ -377,7 +377,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn)
 				ED_area_tag_refresh(sa);
 			break;
 		case NC_SCENE:
-			switch (wmn->data) {	
+			switch (wmn->data) {
 				case ND_OB_ACTIVE:  /* selection changed, so force refresh to flush (needs flag set to do syncing) */
 				case ND_OB_SELECT:
 					saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
@@ -433,7 +433,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn)
 					saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
 					ED_area_tag_refresh(sa);
 					break;
-			}			
+			}
 			break;
 		case NC_WINDOW:
 			if (saction->flag & SACTION_TEMP_NEEDCHANSYNC) {
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 2cbcbcd..35344f2 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -193,7 +193,7 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf)
 typedef struct RegionDrawCB {
 	struct RegionDrawCB *next, *prev;
 	
-	void (*draw)(const struct bContext *, struct ARegion *, void *);	
+	void (*draw)(const struct bContext *, struct ARegion *, void *);
 	void *customdata;
 	
 	int type;
@@ -239,7 +239,7 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
 	for (rdc = ar->type->drawcalls.first; rdc; rdc = rdc->next) {
 		if (rdc->type == type)
 			rdc->draw(C, ar, rdc->customdata);
-	}		
+	}
 }
 
 
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index c41d252..2a5b64c 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -236,7 +236,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
 			if (ma) {
 				RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
 				path->len++;
-			}			
+			}
 			return 1;
 		}
 	}
@@ -680,9 +680,9 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
 /************************* Context Callback ************************/
 
 const char *buttons_context_dir[] = {
-	"world", "object", "mesh", "armature", "lattice", "curve",
+	"texture_slot", "world", "object", "mesh", "armature", "lattice", "curve",
 	"meta_ball", "lamp", "speaker", "camera", "material", "material_slot",
-	"texture", "texture_slot", "texture_user", "bone", "edit_bone",
+	"texture", "texture_user", "bone", "edit_bone",
 	"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
 	"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL
 };
@@ -697,7 +697,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 
 	/* here we handle context, getting data from precomputed path */
 	if (CTX_data_dir(member)) {
-		CTX_data_dir_set(result, buttons_context_dir);
+		/* in case of new shading system we skip texture_slot, complex python
+		 * UI script logic depends on checking if this is available */
+		if (sbuts->texuser)
+			CTX_data_dir_set(result, buttons_context_dir + 1);
+		else
+			CTX_data_dir_set(result, buttons_context_dir);
 		return 1;
 	}
 	else if (CTX_data_equals(member, "world")) {
@@ -817,12 +822,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		ButsContextTexture *ct = sbuts->texuser;
 		PointerRNA *ptr;
 
-		if (ct)
-			return 0;  /* new shading system */
-
 		if ((ptr = get_pointer_type(path, &RNA_Material))) {
 			Material *ma = ptr->data;
 
+			if (ct)
+				return 0;  /* new shading system */
+
 			/* if we have a node material, get slot from material in material node */
 			if (ma && ma->use_nodes && ma->nodetree) {
 				/* if there's an active texture node in the node tree,
@@ -843,12 +848,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		else if ((ptr = get_pointer_type(path, &RNA_Lamp))) {
 			Lamp *la = ptr->data;
 
+			if (ct)
+				return 0;  /* new shading system */
+
 			if (la)
 				CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]);
 		}
 		else if ((ptr = get_pointer_type(path, &RNA_World))) {
 			World *wo = ptr->data;
 
+			if (ct)
+				return 0;  /* new shading system */
+
 			if (wo)
 				CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]);
 		}
@@ -889,7 +900,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		else
 			CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL);
 		return 1;
-	}	
+	}
 	else if (CTX_data_equals(member, "particle_settings")) {
 		/* only available when pinned */
 		PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings);
@@ -900,7 +911,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		}
 		else {
 			/* get settings from active particle system instead */
-			PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSystem);
+			ptr = get_pointer_type(path, &RNA_ParticleSystem);
 			
 			if (ptr && ptr->data) {
 				ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index c8cf69e..d40426a 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -162,7 +162,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	char *str;
 
 	if (CTX_wm_space_file(C)) {
-		BKE_report(op->reports, RPT_ERROR, "Can't activate a file selector, one already open");
+		BKE_report(op->reports, RPT_ERROR, "Cannot activate a file selector, one already open");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -207,7 +207,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		 * user-prefs exception - campbell */
 		if (RNA_struct_find_property(op->ptr, "relative_path")) {
 			if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
-				/* annoying exception!, if were dealign with the user prefs, default relative to be off */
+				/* annoying exception!, if were dealing with the user prefs, default relative to be off */
 				RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U));
 			}
 		}
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 0e82d86..abfefba 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -248,7 +248,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
 
 void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
 {
-	/* gatheravailable texture users in context. runs on every draw of
+	/* gather available texture users in context. runs on every draw of
 	 * properties editor, before the buttons are created. */
 	ButsContextTexture *ct = sbuts->texuser;
 	Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 3322949..c98d213 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -297,6 +297,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 					buttons_area_redraw(sa, BCONTEXT_PHYSICS);
 				case ND_SHADING:
 				case ND_SHADING_DRAW:
+				case ND_SHADING_LINKS:
 					/* currently works by redraws... if preview is set, it (re)starts job */
 					sbuts->preview = 1;
 					break;
@@ -319,11 +320,12 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 			switch (wmn->data) {
 				case ND_SHADING:
 				case ND_SHADING_DRAW:
+				case ND_SHADING_LINKS:
 				case ND_NODES:
 					/* currently works by redraws... if preview is set, it (re)starts job */
 					sbuts->preview = 1;
 					break;
-			}					
+			}
 			break;
 		case NC_WORLD:
 			buttons_area_redraw(sa, BCONTEXT_WORLD);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index d7936c1..9cf389c 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -213,7 +213,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
 	x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
 
 	UI_ThemeColor(TH_CFRAME);
-	glRecti(x, 0, x + framelen, 8);
+	glRecti(x, 0, x + ceilf(framelen), 8);
 
 	clip_draw_curfra_label(sc->user.framenr, x, 8.0f);
 
@@ -252,7 +252,6 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
                                   int width, int height, float zoomx, float zoomy)
 {
 	int x, y;
-	MovieClip *clip = ED_space_clip_get_clip(sc);
 
 	/* find window pixel coordinates of origin */
 	UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
@@ -306,6 +305,15 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
 
 		IMB_display_buffer_release(cache_handle);
 	}
+}
+
+static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
+{
+	int x, y;
+	MovieClip *clip = ED_space_clip_get_clip(sc);
+
+	/* find window pixel coordinates of origin */
+	UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
 
 	/* draw boundary border for frame if stabilization is enabled */
 	if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
@@ -716,7 +724,7 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker)
 
 		cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
 
-		len = minf(cur_len, len);
+		len = min_ff(cur_len, len);
 	}
 
 	return len;
@@ -788,11 +796,11 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 	dy = 6.0f / height / sc->zoom;
 
 	side = get_shortest_pattern_side(marker);
-	patdx = minf(dx * 2.0f / 3.0f, side / 6.0f);
-	patdy = minf(dy * 2.0f / 3.0f, side * width / height / 6.0f);
+	patdx = min_ff(dx * 2.0f / 3.0f, side / 6.0f);
+	patdy = min_ff(dy * 2.0f / 3.0f, side * width / height / 6.0f);
 
-	searchdx = minf(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f);
-	searchdy = minf(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f);
+	searchdx = min_ff(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f);
+	searchdy = min_ff(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f);
 
 	px[0] = 1.0f / sc->zoom / width / sc->scale;
 	px[1] = 1.0f / sc->zoom / height / sc->scale;
@@ -1276,7 +1284,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
 			BKE_tracking_undistort_v2(tracking, pos, tpos);
 
-			DO_MINMAX2(tpos, min, max);
+			minmax_v2v2_v2(min, max, tpos);
 		}
 
 		copy_v2_v2(pos, min);
@@ -1469,6 +1477,7 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
 	}
 
 	if (width && height) {
+		draw_stabilization_border(sc, ar, width, height, zoomx, zoomy);
 		draw_tracking_tracks(sc, ar, clip, width, height, zoomx, zoomy);
 		draw_distortion(sc, ar, clip, width, height, zoomx, zoomy);
 	}
@@ -1488,7 +1497,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
 
 	if (onlyv2d) {
 		/* if manual calibration is used then grease pencil data is already
-		 * drawed in draw_distortion */
+		 * drawn in draw_distortion */
 		if ((sc->flag & SC_MANUAL_CALIBRATION) == 0 || sc->mode != SC_MODE_DISTORTION) {
 			glPushMatrix();
 			glMultMatrixf(sc->unistabmat);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 167353e..1a62af3 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -44,6 +44,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
+#include "BLI_string.h"
 #include "BLI_rect.h"
 
 #include "GPU_extensions.h"
@@ -348,7 +349,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
 
 				mul_v3_m4v3(pos, sc->stabmat, pos);
 
-				DO_MINMAX2(pos, min, max);
+				minmax_v2v2_v2(min, max, pos);
 
 				ok = TRUE;
 			}
@@ -394,7 +395,7 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
 		zoomx = (float)width / w / aspx;
 		zoomy = (float)height / h / aspy;
 
-		newzoom = 1.0f / power_of_2(1.0f / minf(zoomx, zoomy));
+		newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy));
 
 		if (fit || sc->zoom > newzoom)
 			sc->zoom = newzoom;
@@ -692,7 +693,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign
 		context->start_frame = clip->start_frame;
 		context->frame_offset = clip->frame_offset;
 
-		strcpy(context->colorspace, clip->colorspace_settings.name);
+		BLI_strncpy(context->colorspace, clip->colorspace_settings.name, sizeof(context->colorspace));
 	}
 	else {
 		/* displaying exactly the same image which was loaded t oa texture,
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 5c338f3..4e53f34 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -41,6 +41,8 @@
 #include "BLI_math.h"
 #include "BLI_rect.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_report.h"
@@ -180,7 +182,7 @@ static int open_exec(bContext *C, wmOperator *op)
 		BLI_join_dirfile(str, sizeof(str), dir_only, file_only);
 	}
 	else {
-		BKE_reportf(op->reports, RPT_ERROR, "No files selected to be opened");
+		BKE_report(op->reports, RPT_ERROR, "No files selected to be opened");
 
 		return OPERATOR_CANCELLED;
 	}
@@ -195,8 +197,8 @@ static int open_exec(bContext *C, wmOperator *op)
 		if (op->customdata)
 			MEM_freeN(op->customdata);
 
-		BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str,
-		            errno ? strerror(errno) : "Unsupported movie clip format");
+		BKE_reportf(op->reports, RPT_ERROR, "Cannot read '%s': %s", str,
+		            errno ? strerror(errno) : TIP_("unsupported movie clip format"));
 
 		return OPERATOR_CANCELLED;
 	}
@@ -514,9 +516,14 @@ static int view_zoom_exec(bContext *C, wmOperator *op)
 static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	if (event->type == MOUSEZOOM) {
-		float factor;
+		float delta, factor;
+
+		delta = event->x - event->prevx + event->y - event->prevy;
+
+		if (U.uiflag & USER_ZOOM_INVERT)
+			delta *= -1;
 
-		factor = 1.0f + (event->x - event->prevx + event->y - event->prevy) / 300.0f;
+		factor = 1.0f + delta / 300.0f;
 		RNA_float_set(op->ptr, "factor", factor);
 
 		sclip_zoom_set_factor_exec(C, event, factor);
@@ -533,11 +540,16 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	ViewZoomData *vpd = op->customdata;
-	float factor;
+	float delta, factor;
 
 	switch (event->type) {
 		case MOUSEMOVE:
-			factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f;
+			delta = event->x - vpd->x + event->y - vpd->y;
+
+			if (U.uiflag & USER_ZOOM_INVERT)
+				delta *= -1;
+
+			factor = 1.0f + delta / 300.0f;
 			RNA_float_set(op->ptr, "factor", factor);
 			sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
 			ED_region_tag_redraw(CTX_wm_region(C));
@@ -579,7 +591,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
 	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 
 	/* properties */
-	RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
+	RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX,
 	              "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
 }
 
@@ -700,7 +712,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
 	ot->poll = ED_space_clip_view_clip_poll;
 
 	/* properties */
-	RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
+	RNA_def_float(ot->srna, "ratio", 0.0f, -FLT_MAX, FLT_MAX,
 	              "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
 }
 
@@ -735,7 +747,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
 		zoomx = (float) width / (w + 2 * margin);
 		zoomy = (float) height / (h + 2 * margin);
 
-		sclip_zoom_set(C, minf(zoomx, zoomy), NULL);
+		sclip_zoom_set(C, min_ff(zoomx, zoomy), NULL);
 	}
 	else {
 		if ((w >= width || h >= height) && (width > 0 && height > 0)) {
@@ -743,7 +755,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
 			zoomy = (float) height / h;
 
 			/* find the zoom value that will fit the image in the image space */
-			sclip_zoom_set(C, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL);
+			sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL);
 		}
 		else
 			sclip_zoom_set(C, 1.0f, NULL);
@@ -1053,7 +1065,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 
 	if (clip->anim) {
 		pj->index_context = IMB_anim_index_rebuild_context(clip->anim, clip->proxy.build_tc_flag,
-					clip->proxy.build_size_flag, clip->proxy.quality);
+		                                                   clip->proxy.build_size_flag, clip->proxy.quality);
 	}
 
 	WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index ddc624b..d7a9b1c 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -63,11 +63,12 @@
 
 #include "clip_intern.h"    // own include
 
-void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack *track, void *userdata,
-		void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord,
-		              int scene_framenr, float val),
-		void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord),
-		void (*segment_end)(void *userdata))
+void clip_graph_tracking_values_iterate_track(
+        SpaceClip *sc, MovieTrackingTrack *track, void *userdata,
+        void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord,
+                     int scene_framenr, float val),
+        void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord),
+        void (*segment_end)(void *userdata))
 {
 	MovieClip *clip = ED_space_clip_get_clip(sc);
 	int width, height, coord;
@@ -122,11 +123,12 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack
 	}
 }
 
-void clip_graph_tracking_values_iterate(SpaceClip *sc, int selected_only, int include_hidden, void *userdata,
-		void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-		             int coord, int scene_framenr, float val),
-		void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord),
-		void (*segment_end)(void *userdata))
+void clip_graph_tracking_values_iterate(
+        SpaceClip *sc, int selected_only, int include_hidden, void *userdata,
+        void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker,
+                     int coord, int scene_framenr, float val),
+        void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord),
+        void (*segment_end)(void *userdata))
 {
 	MovieClip *clip = ED_space_clip_get_clip(sc);
 	MovieTracking *tracking = &clip->tracking;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index ffe4762..77e2a1b 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1028,17 +1028,14 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
 static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
 {
 	SpaceClip *sc = CTX_wm_space_clip(C);
-	MovieClip *clip = ED_space_clip_get_clip(sc);
-	float x1, y1, w, h;
+	float x1, y1, w, h, aspx, aspy;
 	int width, height, winx, winy;
 
 	ED_space_clip_get_size(sc, &width, &height);
+	ED_space_clip_get_aspect(sc, &aspx, &aspy);
 
-	w = width;
-	h = height;
-
-	if (clip)
-		h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
+	w = width * aspx;
+	h = height * aspy;
 
 	winx = BLI_rcti_size_x(&ar->winrct) + 1;
 	winy = BLI_rcti_size_y(&ar->winrct) + 1;
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 8dc28bb..a29524d 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -154,7 +154,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX,
+	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
 	                     "Location", "Location of marker on frame", -1.0f, 1.0f);
 }
 
@@ -372,8 +372,8 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
 	dx = size / width / sc->zoom;
 	dy = size / height / sc->zoom;
 
-	dx = minf(dx, (max[0] - min[0]) / 6.0f);
-	dy = minf(dy, (max[1] - min[1]) / 6.0f);
+	dx = min_ff(dx, (max[0] - min[0]) / 6.0f);
+	dy = min_ff(dy, (max[1] - min[1]) / 6.0f);
 
 	return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) &&
 	       IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy);
@@ -424,14 +424,14 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker,
 
 		cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
 
-		len = minf(cur_len, len);
+		len = min_ff(cur_len, len);
 	}
 
 	dx = 12.0f / width / sc->zoom;
 	dy = 12.0f / height / sc->zoom;
 
-	dx = minf(dx, len * 2.0f / 3.0f);
-	dy = minf(dy, len * width / height * 2.0f / 3.0f);
+	dx = min_ff(dx, len * 2.0f / 3.0f);
+	dy = min_ff(dy, len * width / height * 2.0f / 3.0f);
 
 	for (i = 0; i < 4; i++) {
 		float crn[2];
@@ -462,8 +462,8 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
 	dx = 12.0f / width / sc->zoom;
 	dy = 12.0f / height / sc->zoom;
 
-	dx = minf(dx, (pat_max[0] - pat_min[0]) / 2.0f);
-	dy = minf(dy, (pat_max[1] - pat_min[1]) / 2.0f);
+	dx = min_ff(dx, (pat_max[0] - pat_min[0]) / 2.0f);
+	dy = min_ff(dy, (pat_max[1] - pat_min[1]) / 2.0f);
 
 	return co[0] >= pos[0] - dx && co[0] <= pos[0] + dx && co[1] >= pos[1] - dy && co[1] <= pos[1] + dy;
 }
@@ -855,8 +855,8 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 						vec[0] *= data->width;
 						vec[1] *= data->height;
 
-						data->corners[a][0] = (vec[0] * cos(angle) - vec[1] * sin(angle)) / data->width;
-						data->corners[a][1] = (vec[1] * cos(angle) + vec[0] * sin(angle)) / data->height;
+						data->corners[a][0] = (vec[0] * cosf(angle) - vec[1] * sinf(angle)) / data->width;
+						data->corners[a][1] = (vec[1] * cosf(angle) + vec[0] * sinf(angle)) / data->height;
 					}
 
 					BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
@@ -1018,7 +1018,7 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit
 					if (frames_limit == 0)
 						frames_limit = track->frames_limit;
 					else
-						frames_limit = MIN2(frames_limit, track->frames_limit);
+						frames_limit = min_ii(frames_limit, (int)track->frames_limit);
 				}
 			}
 		}
@@ -1396,11 +1396,10 @@ static void solve_camera_freejob(void *scv)
 	}
 
 	solved = BKE_tracking_reconstruction_finish(scj->context, tracking);
-
 	if (!solved)
-		BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
+		BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct (see console for details)");
 	else
-		BKE_reportf(scj->reports, RPT_INFO, "Average re-projection error %.3f", tracking->reconstruction.error);
+		BKE_reportf(scj->reports, RPT_INFO, "Average re-projection error: %.3f", tracking->reconstruction.error);
 
 	/* set currently solved clip as active for scene */
 	if (scene->clip)
@@ -1410,7 +1409,7 @@ static void solve_camera_freejob(void *scv)
 	id_us_plus(&clip->id);
 
 	/* set blender camera focal length so result would look fine there */
-	if (scene->camera) {
+	if (scene->camera && scene->camera->data && GS(((ID *) scene->camera->data)->name) == ID_CA) {
 		Camera *camera = (Camera *)scene->camera->data;
 		int width, height;
 
@@ -2766,7 +2765,7 @@ static int join_tracks_exec(bContext *C, wmOperator *op)
 		next = track->next;
 
 		if (TRACK_VIEW_SELECTED(sc, track) && track != act_track) {
-			BKE_tracking_tracks_join(act_track, track);
+			BKE_tracking_tracks_join(tracking, act_track, track);
 
 			if (tracking->stabilization.rot_track == track)
 				tracking->stabilization.rot_track = act_track;
@@ -2945,6 +2944,19 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
 
 /********************** add 2d stabilization tracks operator *********************/
 
+static int stabilize_2d_poll(bContext *C)
+{
+	if (ED_space_clip_tracking_poll(C)) {
+		SpaceClip *sc = CTX_wm_space_clip(C);
+		MovieClip *clip = ED_space_clip_get_clip(sc);
+		MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(&clip->tracking);
+
+		return tracking_object->flag & TRACKING_OBJECT_CAMERA;
+	}
+
+	return FALSE;
+}
+
 static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	SpaceClip *sc = CTX_wm_space_clip(C);
@@ -2986,7 +2998,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = stabilize_2d_add_exec;
-	ot->poll = ED_space_clip_tracking_poll;
+	ot->poll = stabilize_2d_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3046,7 +3058,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = stabilize_2d_remove_exec;
-	ot->poll = ED_space_clip_tracking_poll;
+	ot->poll = stabilize_2d_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3089,7 +3101,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = stabilize_2d_select_exec;
-	ot->poll = ED_space_clip_tracking_poll;
+	ot->poll = stabilize_2d_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3126,7 +3138,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = stabilize_2d_set_rotation_exec;
-	ot->poll = ED_space_clip_tracking_poll;
+	ot->poll = stabilize_2d_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3372,7 +3384,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
 	object = BKE_tracking_object_get_active(tracking);
 
 	if (object->flag & TRACKING_OBJECT_CAMERA) {
-		BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking can't be deleted");
+		BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking cannot be deleted");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 4f62d3f..b8e162b 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -107,7 +107,7 @@ static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx
 {
 	float dist = dist_to_crns(co, pos, crns);
 
-	return dist < maxf(epsx, epsy);
+	return dist < max_ff(epsx, epsy);
 }
 
 static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track)
@@ -128,8 +128,8 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *
 	epsy = MIN4(pat_min[1] - marker->search_min[1], marker->search_max[1] - pat_max[1],
 	            fabsf(pat_min[1]), fabsf(pat_max[1])) / 2;
 
-	epsx = maxf(epsx, 2.0f / width);
-	epsy = maxf(epsy, 2.0f / height);
+	epsx = max_ff(epsx, 2.0f / width);
+	epsy = max_ff(epsy, 2.0f / height);
 
 	if (sc->flag & SC_SHOW_MARKER_SEARCH) {
 		if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy))
@@ -291,7 +291,6 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		MovieTrackingTrack *track = tracking_marker_check_slide(C, event, NULL, NULL, NULL);
 
 		if (track) {
-			SpaceClip *sc = CTX_wm_space_clip(C);
 			MovieClip *clip = ED_space_clip_get_clip(sc);
 
 			clip->tracking.act_track = track;
@@ -477,7 +476,7 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
 		select = !RNA_boolean_get(op->ptr, "deselect");
 		do_lasso_select_marker(C, mcords, mcords_tot, select);
 
-		MEM_freeN(mcords);
+		MEM_freeN((void *)mcords);
 
 		return OPERATOR_FINISHED;
 	}
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 4c2f0ac..a215b47 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -84,7 +84,7 @@ typedef struct ConsoleDrawContext {
 #if 0 /* used by textview, may use later */
 	int *xy; // [2]
 	int *sel; // [2]
-	int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start. 
+	int *pos_pick;  /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */
 	int *mval; // [2]
 	int draw;
 #endif
@@ -94,12 +94,14 @@ void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_du
 {
 	/* fake the edit line being in the scroll buffer */
 	ConsoleLine *cl = sc->history.last;
+	int prompt_len = strlen(sc->prompt);
+	
 	cl_dummy->type = CONSOLE_LINE_INPUT;
-	cl_dummy->len = cl_dummy->len_alloc = strlen(sc->prompt) + cl->len;
+	cl_dummy->len = prompt_len + cl->len;
 	cl_dummy->len_alloc = cl_dummy->len + 1;
 	cl_dummy->line = MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
-	memcpy(cl_dummy->line, sc->prompt, (cl_dummy->len_alloc - cl->len));
-	memcpy(cl_dummy->line + ((cl_dummy->len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
+	memcpy(cl_dummy->line, sc->prompt, prompt_len);
+	memcpy(cl_dummy->line + prompt_len, cl->line, cl->len + 1);
 	BLI_addtail(&sc->scrollback, cl_dummy);
 }
 void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy) 
@@ -144,7 +146,8 @@ static int console_textview_line_get(struct TextViewContext *tvc, const char **l
 	ConsoleLine *cl = (ConsoleLine *)tvc->iter;
 	*line = cl->line;
 	*len = cl->len;
-
+	// printf("'%s' %d\n", *line, cl->len);
+	BLI_assert(cl->line[cl->len] == '\0' && (cl->len == 0 || cl->line[cl->len - 1] != '\0'));
 	return 1;
 }
 
@@ -158,12 +161,13 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
 		const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
 		const int prompt_len = strlen(sc->prompt);
 		const int cursor_loc = cl->cursor + prompt_len;
+		const int line_len = cl->len + prompt_len;
 		int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
 		int pen[2];
 		xy[1] += tvc->lheight / 6;
 
 		/* account for wrapping */
-		if (cl->len < tvc->console_width) {
+		if (line_len < tvc->console_width) {
 			/* simple case, no wrapping */
 			pen[0] = tvc->cwidth * cursor_loc;
 			pen[1] = -2;
@@ -171,7 +175,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
 		else {
 			/* wrap */
 			pen[0] = tvc->cwidth * (cursor_loc % tvc->console_width);
-			pen[1] = -2 + (((cl->len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight);
+			pen[1] = -2 + (((line_len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight);
 		}
 
 		/* cursor */
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 7efcbcc..36716ae 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -39,6 +39,7 @@
 #include "BLI_string.h"
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
+#include "BLI_math.h"
 
 #include "BKE_context.h"
 #include "BKE_text.h" /* only for character utility funcs */
@@ -156,10 +157,9 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
 	ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
 	
 	if (from) {
-		ci->line = BLI_strdup(from->line);
-		ci->len = strlen(ci->line);
-		ci->len_alloc = ci->len;
-		
+		BLI_assert(strlen(from->line) == from->len);
+		ci->line = BLI_strdupn(from->line, from->len);
+		ci->len = ci->len_alloc = from->len;
 		ci->cursor = from->cursor;
 		ci->type = from->type;
 	}
@@ -173,10 +173,8 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
 	return ci;
 }
 
-static ConsoleLine *console_history_add(const bContext *C, ConsoleLine *from)
+static ConsoleLine *console_history_add(SpaceConsole *sc, ConsoleLine *from)
 {
-	SpaceConsole *sc = CTX_wm_space_console(C);
-	
 	return console_lb_add__internal(&sc->history, from);
 }
 
@@ -216,7 +214,7 @@ ConsoleLine *console_history_verify(const bContext *C)
 	SpaceConsole *sc = CTX_wm_space_console(C);
 	ConsoleLine *ci = sc->history.last;
 	if (ci == NULL)
-		ci = console_history_add(C, NULL);
+		ci = console_history_add(sc, NULL);
 	
 	return ci;
 }
@@ -446,10 +444,12 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
 
 	console_line_verify_length(ci, ci->len + len);
 
-	memmove(ci->line + len, ci->line, ci->len);
+	memmove(ci->line + len, ci->line, ci->len + 1);
 	memset(ci->line, ' ', len);
 	ci->len += len;
+	BLI_assert(ci->len >= 0);
 	console_line_cursor_set(ci, ci->cursor + len);
+	console_select_offset(sc, len);
 
 	console_textview_update_rect(sc, ar);
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -495,9 +495,10 @@ static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
 
 	memmove(ci->line, ci->line + len, (ci->len - len) + 1);
 	ci->len -= len;
-	console_line_cursor_set(ci, ci->cursor - len);
+	BLI_assert(ci->len >= 0);
 
-	//console_select_offset(sc, -4);
+	console_line_cursor_set(ci, ci->cursor - len);
+	console_select_offset(sc, -len);
 
 	console_textview_update_rect(sc, ar);
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -554,6 +555,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
 				if (stride) {
 					memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
 					ci->len -= stride;
+					BLI_assert(ci->len >= 0);
 					done = TRUE;
 				}
 			}
@@ -570,6 +572,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
 					ci->cursor -= stride; /* same as above */
 					memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
 					ci->len -= stride;
+					BLI_assert(ci->len >= 0);
 					done = TRUE;
 				}
 			}
@@ -580,7 +583,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	else {
-		console_select_offset(sc, -1);
+		console_select_offset(sc, -stride);
 	}
 
 	console_textview_update_rect(sc, ar);
@@ -617,8 +620,9 @@ static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_CANCELLED;
 	}
 
-	console_history_add(C, ci);
-	console_history_add(C, NULL);
+	console_history_add(sc, ci);
+	console_history_add(sc, NULL);
+	console_select_offset(sc, -ci->len);
 
 	console_textview_update_rect(sc, ar);
 
@@ -650,7 +654,7 @@ static int console_clear_exec(bContext *C, wmOperator *op)
 	short scrollback = RNA_boolean_get(op->ptr, "scrollback");
 	short history = RNA_boolean_get(op->ptr, "history");
 	
-	/*ConsoleLine *ci= */ console_history_verify(C);
+	/*ConsoleLine *ci = */ console_history_verify(C);
 	
 	if (scrollback) { /* last item in mistory */
 		while (sc->scrollback.first)
@@ -721,7 +725,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
 		while ((cl = console_history_find(sc, ci->line, ci)))
 			console_history_free(sc, cl);
 
-		console_history_add(C, (ConsoleLine *)sc->history.last);
+		console_history_add(sc, (ConsoleLine *)sc->history.last);
 	}
 	
 	ci = sc->history.last;
@@ -803,7 +807,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
 	ot->poll = ED_operator_console_active;
 	
 	/* properties */
-	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");	
+	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
 	RNA_def_int(ot->srna, "current_character", 0, 0, INT_MAX, "Cursor", "The index of the cursor", 0, 10000);
 	RNA_def_boolean(ot->srna, "remove_duplicates", 0, "Remove Duplicates", "Remove duplicate items in the history");
 }
@@ -904,8 +908,8 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
 
 	for (cl = sc->scrollback.first; cl; cl = cl->next) {
 		if (sel[0] <= cl->len && sel[1] >= 0) {
-			int sta = MAX2(sel[0], 0);
-			int end = MIN2(sel[1], cl->len);
+			int sta = max_ii(sel[0], 0);
+			int end = min_ii(sel[1], cl->len);
 
 			if (BLI_dynstr_get_len(buf_dyn))
 				BLI_dynstr_append(buf_dyn, "\n");
@@ -1050,7 +1054,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve
 
 static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
 {
-//	SpaceConsole *sc= CTX_wm_space_console(C);
+//	SpaceConsole *sc = CTX_wm_space_console(C);
 	SetConsoleCursor *scu = op->customdata;
 
 #if 0
@@ -1067,7 +1071,7 @@ static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
 static int console_modal_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	SpaceConsole *sc = CTX_wm_space_console(C);
-//	ARegion *ar= CTX_wm_region(C);
+//	ARegion *ar = CTX_wm_region(C);
 	SetConsoleCursor *scu;
 
 	op->customdata = MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor");
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index b7ef278..be8febd 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -91,7 +91,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
 	ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
 
 	/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-	//ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM);
+	//ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
 
 	return (SpaceLink *)sconsole;
 }
@@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
 
 static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-//	SpaceConsole *sc= CTX_wm_space_console(C);
+//	SpaceConsole *sc = CTX_wm_space_console(C);
 	if (drag->type == WM_DRAG_ID)
 		return 1;
 	return 0;
@@ -170,21 +170,18 @@ static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event
 
 static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
-	char text[64];
+	char *text;
 	ID *id = drag->poin;
-	char id_esc[(sizeof(id->name) - 2) * 2];
-
-	BLI_strescape(id_esc, id->name + 2, sizeof(id_esc));
-
-	BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
 
 	/* copy drag path to properties */
+	text = RNA_path_from_ID_python(id);
 	RNA_string_set(drop->ptr, "text", text);
+	MEM_freeN(text);
 }
 
 static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-//    SpaceConsole *sc= CTX_wm_space_console(C);
+	// SpaceConsole *sc = CTX_wm_space_console(C);
 	if (drag->type == WM_DRAG_PATH)
 		return 1;
 	return 0;
@@ -359,7 +356,7 @@ static void console_header_area_draw(const bContext *C, ARegion *ar)
 
 static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
-	// SpaceInfo *sinfo= sa->spacedata.first;
+	// SpaceInfo *sinfo = sa->spacedata.first;
 
 	/* context changes */
 	switch (wmn->category) {
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 55e7599..fb438ae 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -257,21 +257,23 @@ static int get_file_icon(struct direntry *file)
 	else if (file->flags & BLENDERFILE)
 		return ICON_FILE_BLEND;
 	else if (file->flags & BLENDERFILE_BACKUP)
-		return ICON_FILE_BLEND;
+		return ICON_FILE_BACKUP;
 	else if (file->flags & IMAGEFILE)
 		return ICON_FILE_IMAGE;
 	else if (file->flags & MOVIEFILE)
 		return ICON_FILE_MOVIE;
 	else if (file->flags & PYSCRIPTFILE)
 		return ICON_FILE_SCRIPT;
-	else if (file->flags & SOUNDFILE) 
+	else if (file->flags & SOUNDFILE)
 		return ICON_FILE_SOUND;
-	else if (file->flags & FTFONTFILE) 
+	else if (file->flags & FTFONTFILE)
 		return ICON_FILE_FONT;
-	else if (file->flags & BTXFILE) 
+	else if (file->flags & BTXFILE)
 		return ICON_FILE_BLANK;
-	else if (file->flags & COLLADAFILE) 
+	else if (file->flags & COLLADAFILE)
 		return ICON_FILE_BLANK;
+	else if (file->flags & TEXTFILE)
+		return ICON_FILE_TEXT;
 	else
 		return ICON_FILE_BLANK;
 }
@@ -280,7 +282,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
 {
 	uiBut *but;
 	int x, y;
-	/*float alpha=1.0f;*/
+	// float alpha = 1.0f;
 	
 	x = sx;
 	y = sy - height;
@@ -494,7 +496,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
 		sx += (int)(v2d->tot.xmin + 2.0f);
 		sy = (int)(v2d->tot.ymax - sy);
 
-		file = filelist_file(files, i);	
+		file = filelist_file(files, i);
 		
 		UI_ThemeColor4(TH_TEXT);
 
@@ -544,7 +546,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
 		if (params->display == FILE_SHORTDISPLAY) {
 			sx += (int)layout->column_widths[COLUMN_NAME] + 12;
 			if (!(file->type & S_IFDIR)) {
-				file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);	
+				file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
 				sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
 			}
 		}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 7a364eb..763b187 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -554,7 +554,7 @@ int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
 {
 	View2D *v2d = &ar->v2d;
 	FileSelectParams *params;
-	int numfiles, origfile;	
+	int numfiles, origfile;
 
 	if (sfile == NULL || sfile->files == NULL) return 0;
 
@@ -849,7 +849,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
 			file_change_dir(C, 0);
 			WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
 		}
-	}		
+	}
 	
 	return OPERATOR_FINISHED;
 
@@ -942,7 +942,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
 		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
 		file_change_dir(C, 1);
-	}		
+	}
 	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
 
 	return OPERATOR_FINISHED;
@@ -1105,7 +1105,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
 	if (generate_name) {
 		/* create a new, non-existing folder name */
 		if (!new_folder_path(sfile->params->dir, path, name)) {
-			BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder name");
+			BKE_report(op->reports, RPT_ERROR, "Could not create new folder name");
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -1114,9 +1114,9 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
 	BLI_dir_create_recursive(path);
 
 	if (!BLI_exists(path)) {
-		BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder");
+		BKE_report(op->reports, RPT_ERROR, "Could not create new folder");
 		return OPERATOR_CANCELLED;
-	} 
+	}
 
 	/* now remember file to jump into editing */
 	BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
@@ -1427,11 +1427,11 @@ static int file_rename_poll(bContext *C)
 	SpaceFile *sfile = CTX_wm_space_file(C);
 
 	if (sfile && sfile->params) {
-		if (sfile->params->active_file < 0) { 
+		if (sfile->params->active_file < 0) {
 			poll = 0;
 		}
 		else {
-			char dir[FILE_MAX], group[FILE_MAX];	
+			char dir[FILE_MAX], group[FILE_MAX];
 			if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
 		}
 	}
@@ -1460,11 +1460,11 @@ static int file_delete_poll(bContext *C)
 	struct direntry *file;
 
 	if (sfile && sfile->params) {
-		if (sfile->params->active_file < 0) { 
+		if (sfile->params->active_file < 0) {
 			poll = 0;
 		}
 		else {
-			char dir[FILE_MAX], group[FILE_MAX];	
+			char dir[FILE_MAX], group[FILE_MAX];
 			if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
 			file = filelist_file(sfile->files, sfile->params->active_file);
 			if (file && S_ISDIR(file->type)) poll = 0;
@@ -1485,7 +1485,7 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	file = filelist_file(sfile->files, sfile->params->active_file);
 	BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
-	BLI_delete(str, 0, 0);	
+	BLI_delete(str, 0, 0);
 	ED_fileselect_clear(C, sfile);
 	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
 	
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index a705490..a159c88 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -135,6 +135,16 @@ static void file_panel_system(const bContext *C, Panel *pa)
 		file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0);
 }
 
+static void file_panel_system_bookmarks(const bContext *C, Panel *pa)
+{
+	SpaceFile *sfile = CTX_wm_space_file(C);
+
+	if (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS) ) {
+		file_panel_category(C, pa, FS_CATEGORY_SYSTEM_BOOKMARKS, &sfile->systemnr, ICON_BOOKMARKS, 0);
+	}
+
+}
+
 static void file_panel_bookmarks(const bContext *C, Panel *pa)
 {
 	SpaceFile *sfile = CTX_wm_space_file(C);
@@ -193,7 +203,7 @@ static void file_panel_operator(const bContext *C, Panel *pa)
 {
 	SpaceFile *sfile = CTX_wm_space_file(C);
 	wmOperator *op = sfile->op;
-	// int empty= 1, flag;
+	// int empty = 1, flag;
 	
 	uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
 
@@ -212,6 +222,12 @@ void file_panels_register(ARegionType *art)
 	pt->draw = file_panel_system;
 	BLI_addtail(&art->paneltypes, pt);
 
+	pt = MEM_callocN(sizeof(PanelType), "spacetype file system bookmarks");
+	strcpy(pt->idname, "FILE_PT_system_bookmarks");
+	strcpy(pt->label, N_("System Bookmarks"));
+	pt->draw = file_panel_system_bookmarks;
+	BLI_addtail(&art->paneltypes, pt);
+
 	pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks");
 	strcpy(pt->idname, "FILE_PT_bookmarks");
 	strcpy(pt->label, N_("Bookmarks"));
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index ce522ec..a49b754 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -143,7 +143,8 @@ typedef struct FolderList {
 #define SPECIAL_IMG_FONTFILE 8
 #define SPECIAL_IMG_UNKNOWNFILE 9
 #define SPECIAL_IMG_LOADING 10
-#define SPECIAL_IMG_MAX SPECIAL_IMG_LOADING + 1
+#define SPECIAL_IMG_BACKUP 11
+#define SPECIAL_IMG_MAX SPECIAL_IMG_BACKUP + 1
 
 static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
 
@@ -300,7 +301,7 @@ static int is_hidden_file(const char *filename, short hide_dot)
 			if ( (len > 0) && (filename[len - 1] == '~') ) {
 				is_hidden = 1;  /* ignore file~ */
 			}
-		} 
+		}
 	}
 	else {
 		if (((filename[0] == '.') && (filename[1] == 0) )) {
@@ -360,7 +361,7 @@ void filelist_filter(FileList *filelist)
 		struct direntry *file = &filelist->filelist[i];
 		if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) {
 			num_filtered++;
-		} 
+		}
 	}
 	
 	if (filelist->fidx) {
@@ -420,7 +421,7 @@ void filelist_free_icons(void)
 	}
 }
 
-//-----------------FOLDERLIST (previous/next) --------------//
+/* -----------------FOLDERLIST (previous/next) -------------- */
 ListBase *folderlist_new(void)
 {
 	ListBase *p = MEM_callocN(sizeof(ListBase), "folderlist");
@@ -520,7 +521,7 @@ static void filelist_read_main(struct FileList *filelist);
 static void filelist_read_library(struct FileList *filelist);
 static void filelist_read_dir(struct FileList *filelist);
 
-//------------------FILELIST------------------------//
+/* ------------------FILELIST------------------------ */
 FileList *filelist_new(short type)
 {
 	FileList *p = MEM_callocN(sizeof(FileList), "filelist");
@@ -557,7 +558,7 @@ void filelist_free(struct FileList *filelist)
 	}
 
 	for (i = 0; i < filelist->numfiles; ++i) {
-		if (filelist->filelist[i].image) {			
+		if (filelist->filelist[i].image) {
 			IMB_freeImBuf(filelist->filelist[i].image);
 		}
 		filelist->filelist[i].image = NULL;
@@ -573,7 +574,7 @@ void filelist_free(struct FileList *filelist)
 	
 	filelist->numfiles = 0;
 	free(filelist->filelist);
-	filelist->filelist = NULL;	
+	filelist->filelist = NULL;
 	filelist->filter = 0;
 	filelist->filter_glob[0] = '\0';
 	filelist->numfiltered = 0;
@@ -683,6 +684,9 @@ ImBuf *filelist_geticon(struct FileList *filelist, int index)
 	else if (file->flags & IMAGEFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING];
 	}
+	else if (file->flags & BLENDERFILE_BACKUP) {
+		ibuf = gSpecialFileImages[SPECIAL_IMG_BACKUP];
+	}
 
 	return ibuf;
 }
@@ -740,6 +744,7 @@ void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob
 	BLI_strncpy(filelist->filter_glob, filter_glob, sizeof(filelist->filter_glob));
 }
 
+/* would recognize .blend as well */
 static int file_is_blend_backup(const char *str)
 {
 	short a, b;
@@ -781,6 +786,7 @@ static int file_extension_type(const char *relname)
 	}
 	else if (BLI_testextensie(relname, ".txt")  ||
 	         BLI_testextensie(relname, ".glsl") ||
+	         BLI_testextensie(relname, ".osl")  ||
 	         BLI_testextensie(relname, ".data"))
 	{
 		return TEXTFILE;
@@ -791,7 +797,7 @@ static int file_extension_type(const char *relname)
 	         BLI_testextensie(relname, ".otf") ||
 	         BLI_testextensie(relname, ".otc"))
 	{
-		return FTFONTFILE;			
+		return FTFONTFILE;
 	}
 	else if (BLI_testextensie(relname, ".btx")) {
 		return BTXFILE;
@@ -802,14 +808,14 @@ static int file_extension_type(const char *relname)
 	else if (BLI_testextensie_array(relname, imb_ext_image) ||
 	         (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt)))
 	{
-		return IMAGEFILE;			
+		return IMAGEFILE;
 	}
 	else if (BLI_testextensie_array(relname, imb_ext_movie)) {
-		return MOVIEFILE;			
+		return MOVIEFILE;
 	}
 	else if (BLI_testextensie_array(relname, imb_ext_audio)) {
 		return SOUNDFILE;
-	} 
+	}
 	return 0;
 }
 
@@ -817,8 +823,10 @@ int ED_file_extension_icon(const char *relname)
 {
 	int type = file_extension_type(relname);
 	
-	if (type == BLENDERFILE || type == BLENDERFILE_BACKUP)
+	if (type == BLENDERFILE)
 		return ICON_FILE_BLEND;
+	else if (type == BLENDERFILE_BACKUP)
+		return ICON_FILE_BACKUP;
 	else if (type == IMAGEFILE)
 		return ICON_FILE_IMAGE;
 	else if (type == MOVIEFILE)
@@ -833,6 +841,8 @@ int ED_file_extension_icon(const char *relname)
 		return ICON_FILE_BLANK;
 	else if (type == COLLADAFILE)
 		return ICON_FILE_BLANK;
+	else if (type == TEXTFILE)
+		return ICON_FILE_TEXT;
 	
 	return ICON_FILE_BLANK;
 }
@@ -934,7 +944,7 @@ void filelist_parent(struct FileList *filelist)
 void filelist_select_file(struct FileList *filelist, int index, FileSelType select, unsigned int flag, FileCheckType check)
 {
 	struct direntry *file = filelist_file(filelist, index);
-	if (file != NULL) {	
+	if (file != NULL) {
 		int check_ok = 0; 
 		switch (check) {
 			case CHECK_DIRS:
@@ -969,7 +979,7 @@ void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType
 	/* select all valid files between first and last indicated */
 	if ( (sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered) ) {
 		int current_file;
-		for (current_file = sel->first; current_file <= sel->last; current_file++) {	
+		for (current_file = sel->first; current_file <= sel->last; current_file++) {
 			filelist_select_file(filelist, current_file, select, flag, check);
 		}
 	}
@@ -1036,7 +1046,7 @@ void filelist_from_library(struct FileList *filelist)
 	struct ImBuf *ima;
 	int ok, i, nprevs, nnames, idcode;
 	char filename[FILE_MAX];
-	char dir[FILE_MAX], group[GROUP_MAX];	
+	char dir[FILE_MAX], group[GROUP_MAX];
 	
 	/* name test */
 	ok = filelist_islibrary(filelist, dir, group);
@@ -1225,21 +1235,22 @@ void filelist_from_main(struct FileList *filelist)
 			if (ok) {
 				if (!filelist->hide_dot || id->name[2] != '.') {
 					memset(files, 0, sizeof(struct direntry));
-					if (id->lib == NULL)
+					if (id->lib == NULL) {
 						files->relname = BLI_strdup(id->name + 2);
+					}
 					else {
-						files->relname = MEM_mallocN(FILE_MAX + 32, "filename for lib");
-						sprintf(files->relname, "%s | %s", id->lib->name, id->name + 2);
+						files->relname = MEM_mallocN(FILE_MAX + (MAX_ID_NAME - 2),     "filename for lib");
+						BLI_snprintf(files->relname, FILE_MAX + (MAX_ID_NAME - 2) + 3, "%s | %s", id->lib->name, id->name + 2);
 					}
 					files->type |= S_IFREG;
-#if 0               // XXXXX TODO show the selection status of the objects
+#if 0               /* XXXXX TODO show the selection status of the objects */
 					if (!filelist->has_func) { /* F4 DATA BROWSE */
 						if (idcode == ID_OB) {
 							if ( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE;
 						}
 						else if (idcode == ID_SCE) {
 							if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
-						}					
+						}
 					}
 #endif
 					files->nr = totbl + 1;
@@ -1248,10 +1259,10 @@ void filelist_from_main(struct FileList *filelist)
 					if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
 						files->flags |= IMAGEFILE;
 					}
-					if (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d", id->us);
-					else if (id->lib) BLI_snprintf(files->extra, sizeof(files->extra), "L    %d", id->us);
-					else if (fake) BLI_snprintf(files->extra, sizeof(files->extra), "F    %d", id->us);
-					else BLI_snprintf(files->extra, sizeof(files->extra), "      %d", id->us);
+					if      (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d",    id->us);
+					else if (id->lib)         BLI_snprintf(files->extra, sizeof(files->extra), "L    %d",  id->us);
+					else if (fake)            BLI_snprintf(files->extra, sizeof(files->extra), "F    %d",  id->us);
+					else                      BLI_snprintf(files->extra, sizeof(files->extra), "      %d", id->us);
 					
 					if (id->lib) {
 						if (totlib == 0) firstlib = files;
@@ -1300,7 +1311,7 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float
 		if (limg->flags & IMAGEFILE) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
 		}
-		else if (limg->flags & BLENDERFILE) {
+		else if (limg->flags & (BLENDERFILE | BLENDERFILE_BACKUP)) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
 		}
 		else if (limg->flags & MOVIEFILE) {
@@ -1357,7 +1368,7 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
 	tj->filelist = filelist;
 	for (idx = 0; idx < filelist->numfiles; idx++) {
 		if (!filelist->filelist[idx].image) {
-			if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE)) ) {
+			if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) {
 				FileImage *limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
 				BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX);
 				limg->index = idx;
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 1fa89e5..778a3f4 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -94,6 +94,9 @@ FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile)
 	return sfile->params;
 }
 
+/**
+ * \note RNA_struct_property_is_set_ex is used here because we wan't
+ *       the previously used settings to be used here rather then overriding them */
 short ED_fileselect_set_params(SpaceFile *sfile)
 {
 	FileSelectParams *params;
@@ -124,7 +127,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		else
 			params->type = FILE_SPECIAL;
 
-		if (is_filepath && RNA_struct_property_is_set(op->ptr, "filepath")) {
+		if (is_filepath && RNA_struct_property_is_set_ex(op->ptr, "filepath", FALSE)) {
 			char name[FILE_MAX];
 			RNA_string_get(op->ptr, "filepath", name);
 			if (params->type == FILE_LOADLIB) {
@@ -136,12 +139,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 			}
 		}
 		else {
-			if (is_directory && RNA_struct_property_is_set(op->ptr, "directory")) {
+			if (is_directory && RNA_struct_property_is_set_ex(op->ptr, "directory", FALSE)) {
 				RNA_string_get(op->ptr, "directory", params->dir);
 				sfile->params->file[0] = '\0';
 			}
 
-			if (is_filename && RNA_struct_property_is_set(op->ptr, "filename")) {
+			if (is_filename && RNA_struct_property_is_set_ex(op->ptr, "filename", FALSE)) {
 				RNA_string_get(op->ptr, "filename", params->file);
 			}
 		}
@@ -161,12 +164,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		params->filter = 0;
 		if (RNA_struct_find_property(op->ptr, "filter_blender"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
+		if (RNA_struct_find_property(op->ptr, "filter_backup"))
+			params->filter |= RNA_boolean_get(op->ptr, "filter_backup") ? BLENDERFILE_BACKUP : 0;
 		if (RNA_struct_find_property(op->ptr, "filter_image"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
 		if (RNA_struct_find_property(op->ptr, "filter_movie"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
-		if (RNA_struct_find_property(op->ptr, "filter_text"))
-			params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
 		if (RNA_struct_find_property(op->ptr, "filter_python"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
 		if (RNA_struct_find_property(op->ptr, "filter_font"))
@@ -228,7 +231,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		}
 
 		if (is_relative_path) {
-			if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
+			if (!RNA_struct_property_is_set_ex(op->ptr, "relative_path", FALSE)) {
 				RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
 			}
 		}
@@ -307,7 +310,7 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const rcti *r
 		CLAMP(rowmin, 0, layout->rows - 1);
 		CLAMP(colmax, 0, layout->columns - 1);
 		CLAMP(rowmax, 0, layout->rows - 1);
-	} 
+	}
 	
 	if ((colmin > layout->columns - 1) || (rowmin > layout->rows - 1)) {
 		sel.first = -1;
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 66cda30..a5647c0 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -80,9 +80,9 @@ struct _FSMenuEntry {
 
 typedef struct FSMenu {
 	FSMenuEntry *fsmenu_system;
+	FSMenuEntry *fsmenu_system_bookmarks;
 	FSMenuEntry *fsmenu_bookmarks;
 	FSMenuEntry *fsmenu_recent;
-
 } FSMenu;
 
 static FSMenu *g_fsmenu = NULL;
@@ -103,6 +103,9 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu *fsmenu, FSMenuCategory ca
 		case FS_CATEGORY_SYSTEM:
 			fsm_head = fsmenu->fsmenu_system;
 			break;
+		case FS_CATEGORY_SYSTEM_BOOKMARKS:
+			fsm_head = fsmenu->fsmenu_system_bookmarks;
+			break;
 		case FS_CATEGORY_BOOKMARKS:
 			fsm_head = fsmenu->fsmenu_bookmarks;
 			break;
@@ -119,6 +122,9 @@ static void fsmenu_set_category(struct FSMenu *fsmenu, FSMenuCategory category,
 		case FS_CATEGORY_SYSTEM:
 			fsmenu->fsmenu_system = fsm_head;
 			break;
+		case FS_CATEGORY_SYSTEM_BOOKMARKS:
+			fsmenu->fsmenu_system_bookmarks = fsm_head;
+			break;
 		case FS_CATEGORY_BOOKMARKS:
 			fsmenu->fsmenu_bookmarks = fsm_head;
 			break;
@@ -336,9 +342,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 		/* Adding Desktop and My Documents */
 		if (read_bookmarks) {
 			SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0);
-			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0);
-			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 		}
 	}
 #else
@@ -371,26 +377,26 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 		home = getenv("HOME");
 		if (read_bookmarks && home) {
 			BLI_snprintf(line, 256, "%s/", home);
-			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			BLI_snprintf(line, 256, "%s/Desktop/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 			BLI_snprintf(line, 256, "%s/Documents/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 			BLI_snprintf(line, 256, "%s/Pictures/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 			BLI_snprintf(line, 256, "%s/Music/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 			BLI_snprintf(line, 256, "%s/Movies/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 		}
 #else
@@ -450,7 +456,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 			
 			
 			FSRefMakePath(&dir, path, FILE_MAX);
-			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED);
+			if (strcmp((char *)path, "/home") && strcmp((char *)path, "/net")) {
+				/* /net and /home are meaningless on OSX, home folders are stored in /Users */
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED);
+			}
 		}
 		
 		/* Finally get user favorite places */
@@ -473,7 +482,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 				
 				if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII))
 					continue;
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 				
 				CFRelease(pathString);
 				CFRelease(cfURL);
@@ -491,10 +500,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
 		if (read_bookmarks && home) {
 			BLI_snprintf(line, FILE_MAXDIR, "%s/", home);
-			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home);
 			if (BLI_exists(line)) {
-				fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED);
+				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED);
 			}
 		}
 
@@ -564,13 +573,17 @@ void fsmenu_refresh_system_category(struct FSMenu *fsmenu)
 	fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM);
 	fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM, NULL);
 
+	fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
+	fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, NULL);
+
 	/* Add all entries to system category */
-	fsmenu_read_system(fsmenu, FALSE);
+	fsmenu_read_system(fsmenu, TRUE);
 }
 
 void fsmenu_free(struct FSMenu *fsmenu)
 {
 	fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM);
+	fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
 	fsmenu_free_category(fsmenu, FS_CATEGORY_BOOKMARKS);
 	fsmenu_free_category(fsmenu, FS_CATEGORY_RECENT);
 	MEM_freeN(fsmenu);
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 3073057..1b69eb0 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -39,6 +39,7 @@
 
 typedef enum FSMenuCategory {
 	FS_CATEGORY_SYSTEM,
+	FS_CATEGORY_SYSTEM_BOOKMARKS,
 	FS_CATEGORY_BOOKMARKS,
 	FS_CATEGORY_RECENT
 } FSMenuCategory;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 4fe4ad1..be037a0 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -198,7 +198,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
 		params->active_file = -1; // added this so it opens nicer (ton)
 	}
 	filelist_hidedot(sfile->files, params->flag & FILE_HIDE_DOT);
-	filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0);	
+	filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0);
 	filelist_setfilter_types(sfile->files, params->filter_glob);
 
 	if (filelist_empty(sfile->files)) {
@@ -481,7 +481,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
 	ED_region_panels_init(wm, ar);
 
 	/* own keymaps */
-	keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);	
+	keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -505,7 +505,7 @@ static void file_header_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	ED_region_header_init(ar);
 	
-	keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);	
+	keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -598,7 +598,7 @@ void ED_spacetype_file(void)
 	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
 	art->init = file_header_area_init;
 	art->draw = file_header_area_draw;
-	// art->listener= file_header_area_listener;
+	// art->listener = file_header_area_listener;
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: ui */
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 0d56b02..483348d 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -77,7 +77,7 @@
 
 static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
 {
-	//Scene *scene= CTX_data_scene(C);
+	//Scene *scene = CTX_data_scene(C);
 	
 	switch (event) {
 
@@ -148,6 +148,7 @@ static void graph_panel_view(const bContext *C, Panel *pa)
 	row = uiLayoutSplit(sub, 0.7f, TRUE);
 	uiItemR(row, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
 	uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_CFRA);
+	
 	row = uiLayoutSplit(sub, 0.7f, TRUE);
 	uiItemR(row, &spaceptr, "cursor_position_y", 0, IFACE_("Cursor Y"), ICON_NONE);
 	uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_VALUE);
@@ -298,7 +299,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
 		if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) {
 			/* determine the unit for this property */
 			unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop));
-		}		
+		}
 		
 		/* interpolation */
 		col = uiLayoutColumn(layout, FALSE);
@@ -308,44 +309,43 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
 		 *  - we use the button-versions of the calls so that we can attach special update handlers
 		 *    and unit conversion magic that cannot be achieved using a purely RNA-approach
 		 */
-		// XXX: 
 		col = uiLayoutColumn(layout, TRUE);
 		/* keyframe itself */
 		{
 			uiItemL(col, IFACE_("Key:"), ICON_NONE);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, IFACE_("Frame"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, IFACE_("Value"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
 			uiButSetUnitType(but, unit);
 		}
-
+		
 		/* previous handle - only if previous was Bezier interpolation */
 		if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) {
 			uiItemL(col, IFACE_("Left Handle:"), ICON_NONE);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
 			uiButSetUnitType(but, unit);
 		}
-
+		
 		/* next handle - only if current is Bezier interpolation */
 		if (bezt->ipo == BEZT_IPO_BEZ) {
 			uiItemL(col, IFACE_("Right Handle:"), ICON_NONE);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
-
+			
 			but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			                &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
@@ -407,7 +407,7 @@ static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
 	if (ELEM(NULL, id, fcu))
 		return;
 	
-	/* call API method to remove this driver  */	
+	/* call API method to remove this driver  */
 	ANIM_remove_driver(reports, id, fcu->rna_path, fcu->array_index, 0);
 }
 
@@ -437,7 +437,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE
 	ChannelDriver *driver = fcu->driver;
 	
 	/* clear invalid flags */
-	fcu->flag &= ~FCURVE_DISABLED; // XXX?
+	fcu->flag &= ~FCURVE_DISABLED;
 	driver->flag &= ~DRIVER_FLAG_INVALID;
 }
 
@@ -467,7 +467,6 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
 	uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
 	
 	/* Target Property */
-	// TODO: make this less technical...
 	if (dtar->id) {
 		PointerRNA root_ptr;
 		
@@ -630,12 +629,12 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 
 		/* errors? */
 		if (driver->flag & DRIVER_FLAG_INVALID)
-			uiItemL(col, IFACE_("ERROR: invalid Python expression"), ICON_ERROR);
+			uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_ERROR);
 	}
 	else {
 		/* errors? */
 		if (driver->flag & DRIVER_FLAG_INVALID)
-			uiItemL(col, IFACE_("ERROR: invalid target channel(s)"), ICON_ERROR);
+			uiItemL(col, IFACE_("ERROR: Invalid target channel(s)"), ICON_ERROR);
 	}
 		
 	col = uiLayoutColumn(pa->layout, TRUE);
@@ -706,16 +705,26 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 				graph_panel_driverVar__transChan(box, ale->id, dvar);
 				break;
 		}
-
+		
 		/* value of variable */
 		if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
 			char valBuf[32];
-
+			
 			box = uiLayoutBox(col);
 			row = uiLayoutRow(box, TRUE);
 			uiItemL(row, IFACE_("Value:"), ICON_NONE);
+			
+			if ((dvar->type == DVAR_TYPE_ROT_DIFF) ||
+			    (dvar->type == DVAR_TYPE_TRANSFORM_CHAN &&
+			     dvar->targets[0].transChan >= DTAR_TRANSCHAN_ROTX &&
+			     dvar->targets[0].transChan < DTAR_TRANSCHAN_SCALEX))
+			{
+				BLI_snprintf(valBuf, sizeof(valBuf), "%.3f (%4.1f°)", dvar->curval, RAD2DEGF(dvar->curval));
+			}
+			else {
+				BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
+			}
 
-			BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
 			uiItemL(row, valBuf, ICON_NONE);
 		}
 	}
@@ -724,8 +733,8 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	MEM_freeN(ale);
 }
 
-/* ******************* f-modifiers ******************************** */
-/* all the drawing code is in editors/animation/fmodifier_ui.c */
+/* ******************* F-Modifiers ******************************** */
+/* All the drawing code is in editors/animation/fmodifier_ui.c */
 
 #define B_FMODIFIER_REDRAW      20
 
@@ -757,7 +766,9 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
 		row = uiLayoutRow(pa->layout, FALSE);
 		block = uiLayoutGetBlock(row);
 		
-		// XXX for now, this will be a operator button which calls a 'add modifier' operator
+		/* this is an operator button which calls a 'add modifier' operator... 
+		 * a menu might be nicer but would be tricky as we need some custom filtering
+		 */
 		uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"),
 		          10, 0, 150, 20, TIP_("Adds a new F-Curve Modifier for the active F-Curve"));
 		
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index ef2e56a..f665b97 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -83,7 +83,7 @@ static float fcurve_display_alpha(FCurve *fcu)
 
 /* Envelope -------------- */
 
-// TODO: draw a shaded poly showing the region of influence too!!!
+/* TODO: draw a shaded poly showing the region of influence too!!! */
 static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 {
 	FMod_Envelope *env = (FMod_Envelope *)fcm->data;
@@ -101,13 +101,13 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 		
 	glVertex2f(v2d->cur.xmin, env->midval + env->max);
 	glVertex2f(v2d->cur.xmax, env->midval + env->max);
-	glEnd(); // GL_LINES
+	glEnd();  /* GL_LINES */
 	setlinestyle(0);
 	
 	/* set size of vertices (non-adjustable for now) */
 	glPointSize(2.0f);
 	
-	// for now, point color is fixed, and is white
+	/* for now, point color is fixed, and is white */
 	glColor3f(1.0f, 1.0f, 1.0f);
 	
 	/* we use bgl points not standard gl points, to workaround vertex 
@@ -123,7 +123,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 			glVertex2f(fed->time, fed->max);
 		}
 	}
-	bglEnd(); // GL_POINTS
+	bglEnd();  /* GL_POINTS */
 	
 	glPointSize(1.0f);
 }
@@ -160,13 +160,13 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo),
 			}
 			else {
 				/* no check for selection here, as curve is not editable... */
-				// XXX perhaps we don't want to even draw points?   maybe add an option for that later
+				/* XXX perhaps we don't want to even draw points?   maybe add an option for that later */
 				bglVertex3fv(bezt->vec[1]);
 			}
 		}
 	}
 	
-	bglEnd(); // GL_POINTS
+	bglEnd();  /* GL_POINTS */
 }
 
 
@@ -262,7 +262,7 @@ static void set_fcurve_vertex_color(FCurve *fcu, short sel)
 		/* Curve's points ARE BEING edited */
 		if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset); 
 		else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
-	} 
+	}
 	else {
 		/* Curve's points CANNOT BE edited */
 		if (sel) UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, alphaOffset);
@@ -318,7 +318,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
 	        )
 	{
 		return 0;
-	} 
+	}
 	else {
 		return 1;
 	}
@@ -404,7 +404,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
 		}
 	}
 	
-	glEnd(); // GL_LINES 
+	glEnd();  /* GL_LINES */
 }
 
 /* Samples ---------------- */
@@ -428,7 +428,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc
 			
 		glVertex2f(-0.7f, +0.7f);
 		glVertex2f(+0.7f, -0.7f);
-		glEnd(); // GL_LINES
+		glEnd();  /* GL_LINES */
 		
 		glEndList();
 	}
@@ -515,7 +515,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
 	 *  chosen here is just the coarsest value which still looks reasonable...
 	 */
 	/* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */
-	// TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted?
+	/* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */
 	samplefreq = dx / U.v2d_min_gridsize;
 	if (samplefreq < 0.00001f) samplefreq = 0.00001f;
 	
@@ -561,7 +561,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
 		if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
 			/* just extend across the first keyframe's value */
 			v[1] = prevfpt->vec[1];
-		} 
+		}
 		else {
 			/* extrapolate linear dosnt use the handle, use the next points center instead */
 			fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]);
@@ -599,7 +599,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
 		if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
 			/* based on last keyframe's value */
 			v[1] = prevfpt->vec[1];
-		} 
+		}
 		else {
 			/* extrapolate linear dosnt use the handle, use the previous points center instead */
 			fpt = prevfpt - 1;
@@ -642,13 +642,13 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 		if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
 			/* just extend across the first keyframe's value */
 			v1[1] = prevbezt->vec[1][1];
-		} 
+		}
 		else if (prevbezt->ipo == BEZT_IPO_LIN) {
 			/* extrapolate linear dosnt use the handle, use the next points center instead */
 			fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
 			if (fac) fac = 1.0f / fac;
 			v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
-		} 
+		}
 		else {
 			/* based on angle of handle 1 (relative to keyframe) */
 			fac = (prevbezt->vec[0][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
@@ -667,7 +667,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 	}
 	
 	/* draw curve between first and last keyframe (if there are enough to do so) */
-	// TODO: optimize this to not have to calc stuff out of view too?
+	/* TODO: optimize this to not have to calc stuff out of view too? */
 	while (b--) {
 		if (prevbezt->ipo == BEZT_IPO_CONST) {
 			/* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
@@ -691,7 +691,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 			 */
 			
 			/* resol depends on distance between points (not just horizontal) OR is a fixed high res */
-			// TODO: view scale should factor into this someday too...
+			/* TODO: view scale should factor into this someday too... */
 			if (fcu->driver) 
 				resol = 32;
 			else 
@@ -705,7 +705,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 			}
 			else {
 				/* clamp resolution to max of 32 */
-				// NOTE: higher values will crash
+				/* NOTE: higher values will crash */
 				if (resol > 32) resol = 32;
 				
 				v1[0] = prevbezt->vec[1][0];
@@ -748,14 +748,14 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
 		if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
 			/* based on last keyframe's value */
 			v1[1] = prevbezt->vec[1][1];
-		} 
+		}
 		else if (prevbezt->ipo == BEZT_IPO_LIN) {
 			/* extrapolate linear dosnt use the handle, use the previous points center instead */
 			bezt = prevbezt - 1;
 			fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
 			if (fac) fac = 1.0f / fac;
 			v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
-		} 
+		}
 		else {
 			/* based on angle of handle 1 (relative to keyframe) */
 			fac = (prevbezt->vec[2][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
@@ -852,7 +852,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
 			}
 			if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) {
 				/* muted curves are drawn in a grayish hue */
-				// XXX should we have some variations?
+				/* XXX should we have some variations? */
 				UI_ThemeColorShade(TH_HEADER, 50);
 			}
 			else {
@@ -971,7 +971,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
 	height = (float)((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2));
 	UI_view2d_totRect_set(v2d, ar->winx, height);
 	
-	/* loop through channels, and set up drawing depending on their type  */	
+	/* loop through channels, and set up drawing depending on their type  */
 	{   /* first pass: just the standard GL-drawing for backdrop + text */
 		y = (float)ACHANNEL_FIRST;
 		
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index c5fa64d..21b0ed9 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -56,6 +56,7 @@
 #include "BLF_translation.h"
 
 #include "BKE_fcurve.h"
+#include "BKE_global.h"
 #include "BKE_nla.h"
 #include "BKE_context.h"
 #include "BKE_report.h"
@@ -332,7 +333,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
 		ChannelDriver *driver = fcu->driver;
 		FPoint *fpt;
 		float unitFac;
-		int cfra;		
+		int cfra;
 		
 		/* disable driver so that it don't muck up the sampling process */
 		fcu->driver = NULL;
@@ -724,7 +725,7 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	
 	/* copy keyframes */
-	if (copy_graph_keys(&ac)) {	
+	if (copy_graph_keys(&ac)) {
 		BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer");
 		return OPERATOR_CANCELLED;
 	}
@@ -1143,9 +1144,9 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
 	                                  RNA_float_get(op->ptr, "attack"),
 	                                  RNA_float_get(op->ptr, "release"),
 	                                  RNA_float_get(op->ptr, "threshold"),
-	                                  RNA_boolean_get(op->ptr, "accumulate"),
+	                                  RNA_boolean_get(op->ptr, "use_accumulate"),
 	                                  RNA_boolean_get(op->ptr, "use_additive"),
-	                                  RNA_boolean_get(op->ptr, "square"),
+	                                  RNA_boolean_get(op->ptr, "use_square"),
 	                                  RNA_float_get(op->ptr, "sthreshold"),
 	                                  FPS, &sbi.length);
 
@@ -1225,15 +1226,27 @@ void GRAPH_OT_sound_bake(wmOperatorType *ot)
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE,
 	                               WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
-	RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00);
-	RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00);
-	RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1);
-	RNA_def_float(ot->srna, "release", 0.2, 0.0, 5.0, "Release time", "", 0.01, 0.2);
-	RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.01, 0.1);
-	RNA_def_boolean(ot->srna, "accumulate", 0, "Accumulate", "");
-	RNA_def_boolean(ot->srna, "use_additive", 0, "Additive", "");
-	RNA_def_boolean(ot->srna, "square", 0, "Square", "");
-	RNA_def_float(ot->srna, "sthreshold", 0.1, 0.0, 1.0, "Square Threshold", "", 0.01, 0.1);
+	RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency",
+	              "Cutoff frequency of a high-pass filter that is applied to the audio data", 0.1, 1000.00);
+	RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency",
+	              "Cutoff frequency of a low-pass filter that is applied to the audio data", 0.1, 1000.00);
+	RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time",
+	              "Value for the hull curve calculation that tells how fast the hull curve can rise "
+	              "(the lower the value the steeper it can rise)", 0.01, 0.1);
+	RNA_def_float(ot->srna, "release", 0.2, 0.0, 5.0, "Release time",
+	              "Value for the hull curve calculation that tells how fast the hull curve can fall "
+	              "(the lower the value the steeper it can fall)", 0.01, 0.2);
+	RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold",
+	              "Minimum amplitude value needed to influence the hull curve", 0.01, 0.1);
+	RNA_def_boolean(ot->srna, "use_accumulate", 0, "Accumulate",
+	                "Only the positive differences of the hull curve amplitudes are summarized to produce the output");
+	RNA_def_boolean(ot->srna, "use_additive", 0, "Additive",
+	                "The amplitudes of the hull curve are summarized (or, when Accumulate is enabled, "
+	                "both positive and negative differences are accumulated)");
+	RNA_def_boolean(ot->srna, "use_square", 0, "Square",
+	                "The output is a square curve (negative values always result in -1, and positive ones in 1)");
+	RNA_def_float(ot->srna, "sthreshold", 0.1, 0.0, 1.0, "Square Threshold",
+	              "Square only: all values with an absolute amplitude lower than that result in 0", 0.01, 0.1);
 }
 
 /* ******************** Sample Keyframes Operator *********************** */
@@ -1309,8 +1322,8 @@ void GRAPH_OT_sample(wmOperatorType *ot)
 
 /* defines for set extrapolation-type for selected keyframes tool */
 static EnumPropertyItem prop_graphkeys_expo_types[] = {
-	{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", ""},
-	{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", ""},
+	{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", "Values on endpoint keyframes are held"},
+	{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", "Straight-line slope of end segments are extended past the endpoint keyframes"},
 	
 	{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
 	{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
@@ -1614,7 +1627,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
 		else if (ELEM3(fcu->array_index, 0, 1, 2) == 0) {
 			BKE_reportf(op->reports, RPT_WARNING,
 			            "Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)",
-			            (ale->id) ? ale->id->name : "<No ID>", fcu->rna_path, fcu->array_index);
+			            (ale->id) ? ale->id->name : TIP_("<No ID>"), fcu->rna_path, fcu->array_index);
 			continue;
 		}
 		
@@ -1711,13 +1724,16 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
 	/* updates + finishing warnings */
 	if (failed == groups) {
 		BKE_report(op->reports, RPT_ERROR, 
-		           "No Euler Rotations could be corrected, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected");
+		           "No Euler Rotations could be corrected, ensure each rotation has keys for all components, "
+		           "and that F-Curves for these are in consecutive XYZ order and selected");
 		return OPERATOR_CANCELLED;
 	}
 	else {
 		if (failed) {
 			BKE_report(op->reports, RPT_ERROR,
-			           "Some Euler Rotations couldn't be corrected due to missing/unselected/out-of-order F-Curves, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected");
+			           "Some Euler Rotations could not be corrected due to missing/unselected/out-of-order F-Curves, "
+			           "ensure each rotation has keys for all components, and that F-Curves for these are in "
+			           "consecutive XYZ order and selected");
 		}
 		
 		/* validate keyframes after editing */
@@ -1748,6 +1764,15 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot)
 
 /* ***************** Jump to Selected Frames Operator *********************** */
 
+static int graphkeys_framejump_poll(bContext *C)
+{
+	/* prevent changes during render */
+	if (G.is_rendering)
+		return 0;
+
+	return graphop_visible_keyframes_poll(C);
+}
+
 /* snap current-frame indicator to 'average time' of selected keyframe */
 static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -1808,13 +1833,13 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_frame_jump(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Jump to Frame";
+	ot->name = "Jump to Keyframes";
 	ot->idname = "GRAPH_OT_frame_jump";
-	ot->description = "Set the current frame to the average frame of the selected keyframes";
+	ot->description = "Place the cursor on the midpoint of selected keyframes";
 	
 	/* api callbacks */
 	ot->exec = graphkeys_framejump_exec;
-	ot->poll = graphop_visible_keyframes_poll;
+	ot->poll = graphkeys_framejump_poll;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1824,17 +1849,17 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot)
 
 /* defines for snap keyframes tool */
 static EnumPropertyItem prop_graphkeys_snap_types[] = {
-	{GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame", 
+	{GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame",
 	 "Snap selected keyframes to the current frame"},
-	{GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value", 
+	{GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value",
 	 "Set values of selected keyframes to the cursor value (Y/Horizontal component)"},
-	{GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", 
+	{GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame",
 	 "Snap selected keyframes to the nearest (whole) frame (use to fix accidental sub-frame offsets)"},
-	{GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", 
+	{GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second",
 	 "Snap selected keyframes to the nearest second"},
-	{GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", 
+	{GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker",
 	 "Snap selected keyframes to the nearest marker"},
-	{GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles", 
+	{GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles",
 	 "Flatten handles for a smoother transition"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -1938,15 +1963,15 @@ void GRAPH_OT_snap(wmOperatorType *ot)
 
 /* defines for mirror keyframes tool */
 static EnumPropertyItem prop_graphkeys_mirror_types[] = {
-	{GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", 
+	{GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame",
 	 "Flip times of selected keyframes using the current frame as the mirror line"},
-	{GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", 
+	{GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value",
 	 "Flip values of selected keyframes using the cursor value (Y/Horizontal component) as the mirror line"},
-	{GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", 
+	{GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0",
 	 "Flip times of selected keyframes, effectively reversing the order they appear in"},
-	{GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", 
+	{GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0",
 	 "Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
-	{GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", 
+	{GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
 	 "Flip times of selected keyframes using the first selected marker as the reference point"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -2181,7 +2206,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
 		if (fcm)
 			set_active_fmodifier(&fcu->modifiers, fcm);
 		else {
-			BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added, see console for details");
+			BKE_report(op->reports, RPT_ERROR, "Modifier could not be added (see console for details)");
 			break;
 		}
 	}
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index eb65716..b2dbf76 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -123,7 +123,7 @@ enum {
 	GRAPHKEYS_SNAP_CFRA = 1,
 	GRAPHKEYS_SNAP_NEAREST_FRAME,
 	GRAPHKEYS_SNAP_NEAREST_SECOND,
-	GRAPHKEYS_SNAP_NEAREST_MARKER,	
+	GRAPHKEYS_SNAP_NEAREST_MARKER,
 	GRAPHKEYS_SNAP_HORIZONTAL,
 	GRAPHKEYS_SNAP_VALUE,
 } eGraphKeys_Snap_Mode;
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 08b13b4..54b417e 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -39,6 +39,7 @@
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
+#include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_sound.h"
 
@@ -66,6 +67,15 @@
  *	2) Value Indicator (stored per Graph Editor instance)
  */
 
+static int graphview_cursor_poll(bContext *C)
+{
+	/* prevent changes during render */
+	if (G.is_rendering)
+		return 0;
+
+	return ED_operator_graphedit_active(C);
+}
+
 /* Set the new frame number */
 static void graphview_cursor_apply(bContext *C, wmOperator *op)
 {
@@ -172,7 +182,7 @@ static void GRAPH_OT_cursor_set(wmOperatorType *ot)
 	ot->exec = graphview_cursor_exec;
 	ot->invoke = graphview_cursor_invoke;
 	ot->modal = graphview_cursor_modal;
-	ot->poll = ED_operator_graphedit_active;
+	ot->poll = graphview_cursor_poll;
 	
 	/* flags */
 	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
@@ -346,9 +356,8 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
 	
 	
 	/* graph_edit.c */
-	/* snap - current frame to selected keys */
-	// TODO: maybe since this is called jump, we're better to have it on <something>-J?
-	WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+	/* jump to selected keyframes */
+	WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", GKEY, KM_PRESS, KM_CTRL, 0);
 		
 	/* menu + single-step transform */
 	WM_keymap_add_item(keymap, "GRAPH_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index e2fc165..978b322 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -757,7 +757,7 @@ static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short
 	if (leftright == GRAPHKEYS_LRSEL_LEFT) {
 		ked.f1 = MINAFRAMEF;
 		ked.f2 = (float)(CFRA + 0.1f);
-	} 
+	}
 	else {
 		ked.f1 = (float)(CFRA - 0.1f);
 		ked.f2 = MAXFRAMEF;
@@ -835,7 +835,7 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEven
 		UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 		if (x < CFRA)
 			RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
-		else 	
+		else
 			RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
 	}
 	
@@ -1113,7 +1113,7 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
 	nvi = find_nearest_fcurve_vert(ac, mval);
 	
 	/* check if anything to select */
-	if (nvi == NULL)	
+	if (nvi == NULL)
 		return;
 	
 	/* deselect all other curves? */
@@ -1241,7 +1241,7 @@ static void graphkeys_mselect_column(bAnimContext *ac, const int mval[2], short
 	nvi = find_nearest_fcurve_vert(ac, mval);
 	
 	/* check if anything to select */
-	if (nvi == NULL)	
+	if (nvi == NULL)
 		return;
 	
 	/* get frame number on which elements should be selected */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index a4611cf..fa7c6bd 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -441,7 +441,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
 				ED_area_tag_refresh(sa);
 			break;
 		case NC_SCENE:
-			switch (wmn->data) {	
+			switch (wmn->data) {
 				case ND_OB_ACTIVE:  /* selection changed, so force refresh to flush (needs flag set to do syncing)  */
 				case ND_OB_SELECT:
 					sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
@@ -461,7 +461,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
 					ED_area_tag_refresh(sa);
 					break;
 				case ND_TRANSFORM:
-					break; /*do nothing*/					
+					break; /*do nothing*/
 					
 				default: /* just redrawing the view will do */
 					ED_area_tag_redraw(sa);
@@ -563,13 +563,13 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
 					
 					switch (fcu->array_index) {
 						case 0:
-							col[0] = 1.0f; col[1] = 0.0f; col[2] = 0.0f;
+							UI_GetThemeColor3fv(TH_AXIS_X, col);
 							break;
 						case 1:
-							col[0] = 0.0f; col[1] = 1.0f; col[2] = 0.0f;
+							UI_GetThemeColor3fv(TH_AXIS_Y, col);
 							break;
 						case 2:
-							col[0] = 0.0f; col[1] = 0.0f; col[2] = 1.0f;
+							UI_GetThemeColor3fv(TH_AXIS_Z, col);
 							break;
 						default:
 							/* 'unknown' color - bluish so as to not conflict with handles */
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 59416dc..0a3db59 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -191,7 +191,7 @@ void image_preview_event(int event)
 		waitcursor(0);
 		
 		WM_event_add_notifier(C, NC_IMAGE, ima_v);
-	}	
+	}
 }
 
 
@@ -593,7 +593,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 		if (ima->source == IMA_SRC_VIEWER) {
 			ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
 			image_info(scene, iuser, ima, ibuf, str);
-			BKE_image_release_ibuf(ima, lock);
+			BKE_image_release_ibuf(ima, ibuf, lock);
 
 			uiItemL(layout, ima->id.name + 2, ICON_NONE);
 			uiItemL(layout, str, ICON_NONE);
@@ -663,7 +663,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 				if (compact == 0) {
 					ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
 					image_info(scene, iuser, ima, ibuf, str);
-					BKE_image_release_ibuf(ima, lock);
+					BKE_image_release_ibuf(ima, ibuf, lock);
 					uiItemL(layout, str, ICON_NONE);
 				}
 			}
@@ -724,6 +724,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 				col = uiLayoutColumn(split, TRUE);
 				uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
 				uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
+				
 				uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
 
 				uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -759,9 +760,10 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man
 	uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
 
 	/* only display depth setting if multiple depths can be used */
-	if ((ELEM6(depth_ok,
+	if ((ELEM7(depth_ok,
 	           R_IMF_CHAN_DEPTH_1,
 	           R_IMF_CHAN_DEPTH_8,
+	           R_IMF_CHAN_DEPTH_10,
 	           R_IMF_CHAN_DEPTH_12,
 	           R_IMF_CHAN_DEPTH_16,
 	           R_IMF_CHAN_DEPTH_24,
@@ -801,9 +803,13 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man
 		uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE);
 	}
 
+	if (imf->imtype == R_IMF_IMTYPE_DPX) {
+		uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
+	}
+
 	if (imf->imtype == R_IMF_IMTYPE_CINEON) {
 #if 1
-		uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma: 1.0"), ICON_NONE);
+		uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
 #else
 		uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
 		uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 04566af..d565e6f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -578,7 +578,7 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
 	}
 	else {
 		/* assume that UI_view2d_restore(C) has been called... */
-		//SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
+		//SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
 		
 		/* draw grease-pencil ('screen' strokes) */
 		draw_gpencil_view2d(C, 0);
@@ -652,7 +652,7 @@ static unsigned char *get_alpha_clone_image(const bContext *C, Scene *scene, int
 	if (!brush || !brush->clone.image)
 		return NULL;
 	
-	ibuf = BKE_image_get_ibuf(brush->clone.image, NULL);
+	ibuf = BKE_image_acquire_ibuf(brush->clone.image, NULL, NULL);
 
 	if (!ibuf)
 		return NULL;
@@ -660,6 +660,7 @@ static unsigned char *get_alpha_clone_image(const bContext *C, Scene *scene, int
 	display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
 
 	if (!display_buffer) {
+		BKE_image_release_ibuf(brush->clone.image, ibuf, NULL);
 		IMB_display_buffer_release(cache_handle);
 
 		return NULL;
@@ -669,8 +670,10 @@ static unsigned char *get_alpha_clone_image(const bContext *C, Scene *scene, int
 
 	IMB_display_buffer_release(cache_handle);
 
-	if (!rect)
+	if (!rect) {
+		BKE_image_release_ibuf(brush->clone.image, ibuf, NULL);
 		return NULL;
+	}
 
 	*width = ibuf->x;
 	*height = ibuf->y;
@@ -684,6 +687,8 @@ static unsigned char *get_alpha_clone_image(const bContext *C, Scene *scene, int
 		cp += 4;
 	}
 
+	BKE_image_release_ibuf(brush->clone.image, ibuf, NULL);
+
 	return rect;
 }
 
@@ -791,7 +796,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
 			xoffs = scene->r.disprect.xmin;
 			yoffs = scene->r.disprect.ymin;
 			glColor3ub(0, 0, 0);
-			calc_image_view(sima, 'f');	
+			calc_image_view(sima, 'f');
 			myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
 			glRectf(0.0f, 0.0f, 1.0f, 1.0f);
 			glLoadIdentity();
@@ -799,7 +804,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
 	}
 #endif
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 
 	if (show_viewer) {
 		BLI_unlock_thread(LOCK_DRAW_IMAGE);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 2f01483..c4e2230 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -79,7 +79,7 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i
 		BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
 
 	if (sima->image && ID_REAL_USERS(sima->image) <= 0)
-		sima->image->id.us = MAX2(sima->image->id.us, 0) + 1;
+		sima->image->id.us = max_ii(sima->image->id.us, 0) + 1;
 
 	if (obedit)
 		WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
@@ -98,7 +98,7 @@ void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask)
 
 	/* weak, but same as image/space */
 	if (sima->mask_info.mask && ID_REAL_USERS(sima->mask_info.mask) <= 0)
-		sima->mask_info.mask->id.us = MAX2(sima->mask_info.mask->id.us, 0) + 1;
+		sima->mask_info.mask->id.us = max_ii(sima->mask_info.mask->id.us, 0) + 1;
 
 	if (C) {
 		WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
@@ -117,8 +117,12 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
 #endif
 		ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, lock_r);
 
-		if (ibuf && (ibuf->rect || ibuf->rect_float))
-			return ibuf;
+		if (ibuf) {
+			if (ibuf->rect || ibuf->rect_float)
+				return ibuf;
+
+			BKE_image_release_ibuf(sima->image, ibuf, NULL);
+		}
 	}
 	else
 		*lock_r = NULL;
@@ -126,10 +130,10 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
 	return NULL;
 }
 
-void ED_space_image_release_buffer(SpaceImage *sima, void *lock)
+void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
 {
 	if (sima && sima->image)
-		BKE_image_release_ibuf(sima->image, lock);
+		BKE_image_release_ibuf(sima->image, ibuf, lock);
 }
 
 int ED_space_image_has_buffer(SpaceImage *sima)
@@ -140,7 +144,7 @@ int ED_space_image_has_buffer(SpaceImage *sima)
 
 	ibuf = ED_space_image_acquire_buffer(sima, &lock);
 	has_buffer = (ibuf != NULL);
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 
 	return has_buffer;
 }
@@ -175,7 +179,7 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
 		*height = IMG_SIZE_FALLBACK;
 	}
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 }
 
 void ED_space_image_get_size_fl(SpaceImage *sima, float size[2])
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 4f57b22..0d0fdc6 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -39,6 +39,8 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_object_types.h"
 #include "DNA_node_types.h"
 #include "DNA_packedFile_types.h"
@@ -79,6 +81,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "PIL_time.h"
+
 #include "image_intern.h"
 
 /******************** view navigation utilities *********************/
@@ -165,7 +169,7 @@ static int space_image_file_exists_poll(bContext *C)
 				ret = TRUE;
 			}
 		}
-		ED_space_image_release_buffer(sima, lock);
+		ED_space_image_release_buffer(sima, ibuf, lock);
 
 		return ret;
 	}
@@ -183,7 +187,7 @@ static int space_image_poll(bContext *C)
 int space_image_main_area_poll(bContext *C)
 {
 	SpaceImage *sima = CTX_wm_space_image(C);
-	// XXX ARegion *ar= CTX_wm_region(C);
+	// XXX ARegion *ar = CTX_wm_region(C);
 
 	if (sima)
 		return 1;  // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
@@ -365,10 +369,18 @@ void IMAGE_OT_view_pan(wmOperatorType *ot)
 /********************** view zoom operator *********************/
 
 typedef struct ViewZoomData {
-	float x, y;
+	float origx, origy;
 	float zoom;
 	int event_type;
 	float location[2];
+
+	/* needed for continuous zoom */
+	wmTimer *timer;
+	double timer_lastdraw;
+
+	/* */
+	SpaceImage *sima;
+	ARegion *ar;
 } ViewZoomData;
 
 static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
@@ -380,13 +392,22 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
 	op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData");
 	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
 
-	vpd->x = event->x;
-	vpd->y = event->y;
+	vpd->origx = event->x;
+	vpd->origy = event->y;
 	vpd->zoom = sima->zoom;
 	vpd->event_type = event->type;
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
 
+	if (U.viewzoom == USER_ZOOM_CONT) {
+		/* needs a timer to continue redrawing */
+		vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+		vpd->timer_lastdraw = PIL_check_seconds_timer();
+	}
+
+	vpd->sima = sima;
+	vpd->ar = ar;
+
 	WM_event_add_modal_handler(C, op);
 }
 
@@ -400,6 +421,9 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
 
+	if (vpd->timer)
+		WM_event_remove_timer(CTX_wm_manager(C), vpd->timer->win, vpd->timer);
+
 	WM_cursor_restore(CTX_wm_window(C));
 	MEM_freeN(op->customdata);
 }
@@ -425,16 +449,27 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
+enum {
+	VIEW_PASS = 0,
+	VIEW_APPLY,
+	VIEW_CONFIRM
+};
+
 static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	if (event->type == MOUSEZOOM) {
 		SpaceImage *sima = CTX_wm_space_image(C);
 		ARegion *ar = CTX_wm_region(C);
-		float factor, location[2];
+		float delta, factor, location[2];
 
 		UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
 
-		factor = 1.0f + (event->x - event->prevx + event->y - event->prevy) / 300.0f;
+		delta = event->x - event->prevx + event->y - event->prevy;
+
+		if (U.uiflag & USER_ZOOM_INVERT)
+			delta *= -1;
+
+		factor = 1.0f + delta / 300.0f;
 		RNA_float_set(op->ptr, "factor", factor);
 		sima_zoom_set(sima, ar, sima->zoom * factor, location);
 		ED_region_tag_redraw(CTX_wm_region(C));
@@ -447,26 +482,72 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 }
 
+static void image_zoom_apply(ViewZoomData *vpd, wmOperator *op, const int x, const int y, const short viewzoom, const short zoom_invert)
+{
+	float factor;
+
+	if (viewzoom == USER_ZOOM_CONT) {
+		double time = PIL_check_seconds_timer();
+		float time_step = (float)(time - vpd->timer_lastdraw);
+		float fac;
+		float zfac;
+
+		if (U.uiflag & USER_ZOOM_HORIZ) {
+			fac = (float)(x - vpd->origx);
+		}
+		else {
+			fac = (float)(y - vpd->origy);
+		}
+
+		if (zoom_invert) {
+			fac = -fac;
+		}
+
+		/* oldstyle zoom */
+		zfac = 1.0f + ((fac / 20.0f) * time_step);
+		vpd->timer_lastdraw = time;
+		/* this is the final zoom, but instead make it into a factor */
+		//zoom = vpd->sima->zoom * zfac;
+		factor = (vpd->sima->zoom * zfac) / vpd->zoom;
+	}
+	else {
+		/* for now do the same things for scale and dolly */
+		float delta = x - vpd->origx + y - vpd->origy;
+
+		if (zoom_invert)
+			delta *= -1.0f;
+
+		factor = 1.0f + delta / 300.0f;
+	}
+
+	RNA_float_set(op->ptr, "factor", factor);
+	sima_zoom_set(vpd->sima, vpd->ar, vpd->zoom * factor, vpd->location);
+	ED_region_tag_redraw(vpd->ar);
+}
+
 static int image_view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima = CTX_wm_space_image(C);
-	ARegion *ar = CTX_wm_region(C);
 	ViewZoomData *vpd = op->customdata;
-	float factor;
+	short event_code = VIEW_PASS;
 
-	switch (event->type) {
-		case MOUSEMOVE:
-			factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f;
-			RNA_float_set(op->ptr, "factor", factor);
-			sima_zoom_set(sima, ar, vpd->zoom * factor, vpd->location);
-			ED_region_tag_redraw(CTX_wm_region(C));
-			break;
-		default:
-			if (event->type == vpd->event_type && event->val == KM_RELEASE) {
-				image_view_zoom_exit(C, op, 0);
-				return OPERATOR_FINISHED;
-			}
-			break;
+	/* execute the events */
+	if (event->type == TIMER && event->customdata == vpd->timer) {
+		/* continuous zoom */
+		event_code = VIEW_APPLY;
+	}
+	else if (event->type == MOUSEMOVE) {
+		event_code = VIEW_APPLY;
+	}
+	else if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+		event_code = VIEW_CONFIRM;
+	}
+
+	if (event_code == VIEW_APPLY) {
+		image_zoom_apply(vpd, op, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
+	}
+	else if (event_code == VIEW_CONFIRM) {
+		image_view_zoom_exit(C, op, 0);
+		return OPERATOR_FINISHED;
 	}
 
 	return OPERATOR_RUNNING_MODAL;
@@ -496,7 +577,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
 	ot->flag = OPTYPE_BLOCKING;
 	
 	/* properties */
-	RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
+	RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX,
 	              "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
 }
 
@@ -541,7 +622,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
 		sima->xof += pan_x;
 		sima->yof += pan_y;
 
-		ED_region_tag_redraw(ar);	
+		ED_region_tag_redraw(ar);
 
 		return OPERATOR_FINISHED;
 	}
@@ -589,7 +670,7 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 		/* find the zoom value that will fit the image in the image space */
 		zoomx = width / w;
 		zoomy = height / h;
-		sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL);
+		sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL);
 	}
 	else
 		sima_zoom_set(sima, ar, 1.0f, NULL);
@@ -606,7 +687,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "View All";
 	ot->idname = "IMAGE_OT_view_all";
-	ot->description = "View the whole picture";
+	ot->description = "View the entire image";
 	
 	/* api callbacks */
 	ot->exec = image_view_all_exec;
@@ -793,14 +874,14 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "View Zoom Ratio";
 	ot->idname = "IMAGE_OT_view_zoom_ratio";
-	ot->description = "Set zoom ration of the view";
+	ot->description = "Set zoom ratio of the view";
 	
 	/* api callbacks */
 	ot->exec = image_view_zoom_ratio_exec;
 	ot->poll = space_image_main_area_poll;
 	
 	/* properties */
-	RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
+	RNA_def_float(ot->srna, "ratio", 0.0f, -FLT_MAX, FLT_MAX,
 	              "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
 }
 
@@ -848,7 +929,8 @@ static int image_open_exec(bContext *C, wmOperator *op)
 
 	if (!ima) {
 		if (op->customdata) MEM_freeN(op->customdata);
-		BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", str, errno ? strerror(errno) : "Unsupported image format");
+		BKE_reportf(op->reports, RPT_ERROR, "Cannot read '%s': %s",
+		            str, errno ? strerror(errno) : TIP_("unsupported image format"));
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1137,7 +1219,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
 		else {
 			simopts->im_format.imtype = BKE_ftype_to_imtype(ibuf->ftype);
 		}
-		//simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+		//simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
 		simopts->im_format.quality = ibuf->ftype & 0xff;
 
 		BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -1175,7 +1257,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
 		BKE_color_managed_view_settings_copy(&simopts->im_format.view_settings, &scene->view_settings);
 	}
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 
 	return (ibuf != NULL);
 }
@@ -1259,8 +1341,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 			BKE_image_release_renderresult(scene, ima);
 		}
 		else {
-			if (BKE_imbuf_write_as(colormanaged_ibuf, simopts->filepath, &simopts->im_format, save_copy))
-			{
+			if (BKE_imbuf_write_as(colormanaged_ibuf, simopts->filepath, &simopts->im_format, save_copy)) {
 				ok = TRUE;
 			}
 		}
@@ -1304,7 +1385,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 			}
 		}
 		else {
-			BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", simopts->filepath);
+			BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s", simopts->filepath);
 		}
 
 
@@ -1316,7 +1397,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 			IMB_freeImBuf(colormanaged_ibuf);
 	}
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 }
 
 static void image_save_as_free(wmOperator *op)
@@ -1486,7 +1567,7 @@ static int image_save_exec(bContext *C, wmOperator *op)
 		save_image_doit(C, sima, op, &simopts, FALSE);
 	}
 	else {
-		BKE_reportf(op->reports, RPT_ERROR, "Can not save image, path '%s' is not writable", simopts.filepath);
+		BKE_reportf(op->reports, RPT_ERROR, "Cannot save image, path '%s' is not writable", simopts.filepath);
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1527,7 +1608,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
 	}
 
 	if (sima->image->type == IMA_TYPE_MULTILAYER) {
-		BKE_report(op->reports, RPT_ERROR, "Can't save multilayer sequences");
+		BKE_report(op->reports, RPT_ERROR, "Cannot save multilayer sequences");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1549,7 +1630,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
 	BLI_strncpy(di, ibuf->name, FILE_MAX);
 	BLI_splitdirstring(di, fi);
 	
-	BKE_reportf(op->reports, RPT_INFO, "%d Image(s) will be saved in %s", tot, di);
+	BKE_reportf(op->reports, RPT_INFO, "%d image(s) will be saved in %s", tot, di);
 
 	for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next) {
 		if (ibuf->userflags & IB_BITMAPDIRTY) {
@@ -1563,7 +1644,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
 				break;
 			}
 
-			BKE_reportf(op->reports, RPT_INFO, "Saved: %s\n", ibuf->name);
+			BKE_reportf(op->reports, RPT_INFO, "Saved %s", ibuf->name);
 			ibuf->userflags &= ~IB_BITMAPDIRTY;
 		}
 	}
@@ -1673,16 +1754,24 @@ static int image_new_exec(bContext *C, wmOperator *op)
 		RNA_property_pointer_set(&ptr, prop, idptr);
 		RNA_property_update(C, &ptr, prop);
 	}
-	else if (sima)
+	else if (sima) {
 		ED_space_image_set(sima, scene, obedit, ima);
+	}
+	else {
+		Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+		if (tex && tex->type == TEX_IMAGE) {
+			tex->ima = ima;
+			ED_area_tag_redraw(CTX_wm_area(C));
+		}
+	}
 
-	// XXX other users?
 	BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE);
 	
 	return OPERATOR_FINISHED;
 }
 
 /* XXX, Ton is not a fan of OK buttons but using this function to avoid undo/redo bug while in mesh-editmode, - campbell */
+/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */
 static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	return WM_operator_props_dialog_popup(C, op, 300, 100);
@@ -1723,17 +1812,14 @@ void IMAGE_OT_new(wmOperatorType *ot)
 static int image_invert_poll(bContext *C)
 {
 	Image *ima = CTX_data_edit_image(C);
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
-	
-	if (ibuf != NULL)
-		return 1;
-	return 0;
+
+	return BKE_image_has_ibuf(ima, NULL);
 }
 
 static int image_invert_exec(bContext *C, wmOperator *op)
 {
 	Image *ima = CTX_data_edit_image(C);
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 	/* flags indicate if this channel should be inverted */
 	const short r = RNA_boolean_get(op->ptr, "invert_r");
@@ -1772,6 +1858,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
 		}
 	}
 	else {
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1780,6 +1867,9 @@ static int image_invert_exec(bContext *C, wmOperator *op)
 		ibuf->userflags |= IB_MIPMAP_INVALID;
 
 	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	return OPERATOR_FINISHED;
 }
 
@@ -1828,14 +1918,14 @@ static int image_pack_exec(bContext *C, wmOperator *op)
 {
 	struct Main *bmain = CTX_data_main(C);
 	Image *ima = CTX_data_edit_image(C);
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	int as_png = RNA_boolean_get(op->ptr, "as_png");
 
 	if (!image_pack_test(C, op))
 		return OPERATOR_CANCELLED;
 	
 	if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
-		BKE_report(op->reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG");
+		BKE_report(op->reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1845,30 +1935,38 @@ static int image_pack_exec(bContext *C, wmOperator *op)
 		ima->packedfile = newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
 
 	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
-	
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	return OPERATOR_FINISHED;
 }
 
 static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	Image *ima = CTX_data_edit_image(C);
-	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf;
 	uiPopupMenu *pup;
 	uiLayout *layout;
 	int as_png = RNA_boolean_get(op->ptr, "as_png");
 
 	if (!image_pack_test(C, op))
 		return OPERATOR_CANCELLED;
-	
+
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
+
 	if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
 		pup = uiPupMenuBegin(C, "OK", ICON_QUESTION);
 		layout = uiPupMenuLayout(pup);
 		uiItemBooleanO(layout, "Can't pack edited image from disk. Pack as internal PNG?", ICON_NONE, op->idname, "as_png", 1);
 		uiPupMenuEnd(C, pup);
 
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+
 		return OPERATOR_CANCELLED;
 	}
 
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	return image_pack_exec(C, op);
 }
 
@@ -2012,7 +2110,7 @@ int ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], floa
 	int ret = FALSE;
 
 	if (ibuf == NULL) {
-		ED_space_image_release_buffer(sima, lock);
+		ED_space_image_release_buffer(sima, ibuf, lock);
 		return FALSE;
 	}
 
@@ -2038,7 +2136,7 @@ int ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], floa
 		}
 	}
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 	return ret;
 }
 
@@ -2054,7 +2152,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 	CurveMapping *curve_mapping = scene->view_settings.curve_mapping;
 
 	if (ibuf == NULL) {
-		ED_space_image_release_buffer(sima, lock);
+		ED_space_image_release_buffer(sima, ibuf, lock);
 		info->draw = 0;
 		return;
 	}
@@ -2155,7 +2253,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 		info->draw = 0;
 	}
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 	ED_area_tag_redraw(CTX_wm_area(C));
 }
 
@@ -2246,12 +2344,12 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
 	float x1f, y1f, x2f, y2f;
 	
 	if (ibuf == NULL) {
-		ED_space_image_release_buffer(sima, lock);
+		ED_space_image_release_buffer(sima, ibuf, lock);
 		return OPERATOR_CANCELLED;
 	}
 	/* hmmmm */
 	if (ibuf->channels < 3) {
-		ED_space_image_release_buffer(sima, lock);
+		ED_space_image_release_buffer(sima, ibuf, lock);
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -2268,7 +2366,7 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
 	/* reset y zoom */
 	hist->ymax = 1.0f;
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 	
 	ED_area_tag_redraw(CTX_wm_area(C));
 	
@@ -2353,8 +2451,8 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
 	
 	WM_cursor_time(CTX_wm_window(C), scene->r.cfra);
 
-	// XXX scene->nodetree->test_break= blender_test_break;
-	// XXX scene->nodetree->test_break= NULL;
+	// XXX scene->nodetree->test_break = blender_test_break;
+	// XXX scene->nodetree->test_break = NULL;
 	
 	BKE_image_all_free_anim_ibufs(scene->r.cfra);
 	ntreeCompositTagAnimated(scene->nodetree);
@@ -2363,11 +2461,13 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
 
 	ED_area_tag_redraw(CTX_wm_area(C));
 	
-	ibuf = BKE_image_get_ibuf(sima->image, &sima->iuser);
+	ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, NULL);
 	/* save memory in flipbooks */
 	if (ibuf)
 		imb_freerectfloatImBuf(ibuf);
-	
+
+	BKE_image_release_ibuf(sima->image, ibuf, NULL);
+
 	scene->r.cfra++;
 
 	return (scene->r.cfra <= rcd->efra);
@@ -2420,8 +2520,7 @@ static int image_record_composite_exec(bContext *C, wmOperator *op)
 	if (!image_record_composite_init(C, op))
 		return OPERATOR_CANCELLED;
 	
-	while (image_record_composite_apply(C, op))
-		;
+	while (image_record_composite_apply(C, op)) {}
 	
 	image_record_composite_exit(C, op);
 	
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 7f53f37..ea69677 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -457,7 +457,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
 				ED_area_tag_redraw(sa);
 			}
 			break;
-		case NC_SPACE:	
+		case NC_SPACE:
 			if (wmn->data == ND_SPACE_IMAGE) {
 				image_scopes_tag_refresh(sa);
 				ED_area_tag_redraw(sa);
@@ -550,7 +550,7 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
 	int width, height, winx, winy;
 	
 #if 0
-	if (image_preview_active(curarea, &width, &height)) ;
+	if (image_preview_active(curarea, &width, &height)) {}
 	else
 #endif
 	ED_space_image_get_size(sima, &width, &height);
@@ -780,7 +780,7 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar)
 		}
 		scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
 	}
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 	
 	ED_region_panels(C, ar, 1, NULL, -1);
 }
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 35e19bc..5830c45 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -136,7 +136,7 @@ static int report_textview_skip__internal(TextViewContext *tvc)
 
 static int report_textview_begin(TextViewContext *tvc)
 {
-	// SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+	// SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
 	ReportList *reports = (ReportList *)tvc->arg2;
 
 	tvc->lheight = 14; //sc->lheight;
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 805ff17..48b5eaf 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -87,10 +87,14 @@ static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	// first check for dirty images
 	for (ima = bmain->image.first; ima; ima = ima->id.next) {
 		if (ima->ibufs.first) { /* XXX FIX */
-			ibuf = BKE_image_get_ibuf(ima, NULL);
+			ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 			
-			if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
+			if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) {
+				BKE_image_release_ibuf(ima, ibuf, NULL);
 				break;
+			}
+
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 	}
 
@@ -124,7 +128,7 @@ static const EnumPropertyItem unpack_all_method_items[] = {
 	{PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write files to current directory (overwrite existing files)", ""},
 	{PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use files in original location (create when necessary)", ""},
 	{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write files to original location (overwrite existing files)", ""},
-	{PF_KEEP, "KEEP", 0, "Disable AutoPack, keep all packed files", ""},
+	{PF_KEEP, "KEEP", 0, "Disable Auto-pack, keep all packed files", ""},
 	/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
 	{0, NULL, 0, NULL, NULL}};
 
@@ -150,7 +154,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 	count = countPackedFiles(bmain);
 	
 	if (!count) {
-		BKE_report(op->reports, RPT_WARNING, "No packed files. Autopack disabled");
+		BKE_report(op->reports, RPT_WARNING, "No packed files (auto-pack disabled)");
 		G.fileflags &= ~G_AUTOPACK;
 		return OPERATOR_CANCELLED;
 	}
@@ -196,7 +200,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
 	Main *bmain = CTX_data_main(C);
 
 	if (!G.relbase_valid) {
-		BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file");
+		BKE_report(op->reports, RPT_WARNING, "Cannot set relative paths with an unsaved blend file");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -229,7 +233,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
 	Main *bmain = CTX_data_main(C);
 
 	if (!G.relbase_valid) {
-		BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file");
+		BKE_report(op->reports, RPT_WARNING, "Cannot set absolute paths with an unsaved blend file");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 2324f73..049a50f 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -68,9 +68,9 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo))
 // TODO, get this working again!
 static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
 {
-//	SpaceInfo *sc= CTX_wm_space_info(C);
-//	ReportList *reports= CTX_wm_reports(C);
-//	int report_mask= info_report_mask(sc);
+//	SpaceInfo *sc = CTX_wm_space_info(C);
+//	ReportList *reports = CTX_wm_reports(C);
+//	int report_mask = info_report_mask(sc);
 //	Report *report;
 
 #if 0
@@ -223,7 +223,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
 	int extend = RNA_boolean_get(op->ptr, "extend");
 	Report *report_min, *report_max, *report;
 
-	//View2D *v2d= UI_view2d_fromcontext(C);
+	//View2D *v2d = UI_view2d_fromcontext(C);
 
 
 	rcti rect;
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 034c382..cba0a80 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -58,6 +58,7 @@
 #include "UI_view2d.h"
 
 #include "info_intern.h"  /* own include */
+#include "BLO_readfile.h"
 
 /* ******************** default callbacks for info space ***************** */
 
@@ -93,7 +94,7 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
 	ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
 
 	/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-	//ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM);
+	//ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
 	
 	return (SpaceLink *)sinfo;
 }
@@ -228,7 +229,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar)
 
 static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
-	// SpaceInfo *sinfo= sa->spacedata.first;
+	// SpaceInfo *sinfo = sa->spacedata.first;
 
 	/* context changes */
 	switch (wmn->category) {
@@ -249,7 +250,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
 			if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
 				ED_region_tag_redraw(ar);
 			break;
-		case NC_WM:	
+		case NC_WM:
 			if (wmn->data == ND_JOB)
 				ED_region_tag_redraw(ar);
 			break;
@@ -257,7 +258,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
 			if (wmn->data == ND_RENDER_RESULT)
 				ED_region_tag_redraw(ar);
 			break;
-		case NC_SPACE:	
+		case NC_SPACE:
 			if (wmn->data == ND_SPACE_INFO)
 				ED_region_tag_redraw(ar);
 			break;
@@ -271,11 +272,16 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
 static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
 {
 	struct RecentFile *recent;
+	char file [FILE_MAX];
 	uiLayout *layout = menu->layout;
 	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
 	if (G.recent_files.first) {
 		for (recent = G.recent_files.first; (recent); recent = recent->next) {
-			uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+			BLI_split_file_part(recent->filepath, file, sizeof(file));
+			if (BLO_has_bfile_extension(file))
+				uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+			else
+				uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath);
 		}
 	}
 	else {
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 4ba1962..f454b1d 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -36,8 +36,6 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
-
-
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
@@ -66,8 +64,8 @@ typedef struct ConsoleDrawContext {
 static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
 {
 	if (sel[0] <= str_len_draw && sel[1] >= 0) {
-		int sta = MAX2(sel[0], 0);
-		int end = MIN2(sel[1], str_len_draw);
+		int sta = max_ii(sel[0], 0);
+		int end = min_ii(sel[1], str_len_draw);
 
 		glEnable(GL_POLYGON_STIPPLE);
 		glPolygonStipple(stipple_halftone);
@@ -128,7 +126,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 		return 1;
 	}
 
-	if (str_len > cdc->console_width) { /* wrap? */
+	if (tot_lines > 1) { /* wrap? */
 		const int initial_offset = ((tot_lines - 1) * cdc->console_width);
 		const char *line_stride = str + initial_offset;  /* advance to the last line and draw it first */
 		
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt
index 8859d1d..13e6f94 100644
--- a/source/blender/editors/space_logic/CMakeLists.txt
+++ b/source/blender/editors/space_logic/CMakeLists.txt
@@ -48,4 +48,8 @@ if(WITH_GAMEENGINE)
 	add_definitions(-DWITH_GAMEENGINE)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript
index 6beb3ec..e63d88e 100644
--- a/source/blender/editors/space_logic/SConscript
+++ b/source/blender/editors/space_logic/SConscript
@@ -3,7 +3,7 @@ Import ('env')
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../makesrna ../interface ../../blenloader'
 
@@ -12,4 +12,7 @@ defs = []
 if env['WITH_BF_GAMEENGINE']:
     defs.append('WITH_GAMEENGINE')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_game', sources, Split(incs), defs, libtype=['core'], priority=[120] )
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index abdfa0e..e898a1b 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -52,8 +52,8 @@
 
 static int logic_properties(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= logic_has_buttons_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = logic_has_buttons_region(sa);
 	
 	if (ar)
 		ED_region_toggle_hidden(C, ar);
@@ -100,9 +100,9 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
 
 static int cut_links_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	float mcoords[256][2];
-	int i= 0;
+	int i = 0;
 	
 	RNA_BEGIN (op->ptr, itemptr, "path")
 	{
@@ -113,7 +113,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 		                         (int)loc[0], (int)loc[1],
 		                         &mcoords[i][0], &mcoords[i][1]);
 		i++;
-		if (i>= 256) break;
+		if (i >= 256) break;
 	}
 	RNA_END;
 
@@ -121,23 +121,23 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 		uiBlock *block;
 		uiLinkLine *line, *nline;
 		uiBut *but;
-		for (block= ar->uiblocks.first; block; block= block->next) {
-			but= block->buttons.first;
+		for (block = ar->uiblocks.first; block; block = block->next) {
+			but = block->buttons.first;
 			while (but) {
 				if (but->type==LINK && but->link) {
-					for (line= but->link->lines.first; line; line= nline) {
-						nline= line->next;
+					for (line = but->link->lines.first; line; line = nline) {
+						nline = line->next;
 
 						if (cut_links_intersect(line, mcoords, i)) {
 							ui_delete_linkline(line, but);
 						}
 					}
 				}
-				but= but->next;
+				but = but->next;
 			}
 		}
 		return OPERATOR_FINISHED;
-	}	
+	}
 	return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
 }
 
@@ -159,7 +159,7 @@ void LOGIC_OT_links_cut(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
 	/* internal */
 	RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index f2013e4..74be7c4 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -138,7 +138,7 @@ static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **o
 	*ob = edit_object_property_get(C, op);
 	if (!*ob) return NULL;
 	
-	sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name));	
+	sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name));
 	return sens;
 }
 
@@ -177,7 +177,7 @@ static bController *edit_controller_property_get(bContext *C, wmOperator *op, Ob
 	*ob = edit_object_property_get(C, op);
 	if (!*ob) return NULL;
 	
-	cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name));	
+	cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name));
 	return cont;
 }
 
@@ -216,7 +216,7 @@ static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object
 	*ob = edit_object_property_get(C, op);
 	if (!*ob) return NULL;
 	
-	act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name));	
+	act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name));
 	return act;
 }
 
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 5d7ff77..5a8a7ce 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -56,6 +56,7 @@
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_sca.h"
+#include "BKE_screen.h"
 
 #include "ED_util.h"
 
@@ -63,7 +64,10 @@
 
 #include "BIF_gl.h"
 
+#include "BLF_translation.h"
+
 #include "UI_interface.h"
+#include "UI_view2d.h"
 
 #include "RNA_access.h"
 
@@ -102,8 +106,8 @@ static int vergname(const void *v1, const void *v2)
 {
 	char **x1, **x2;
 	
-	x1= (char **)v1;
-	x2= (char **)v2;
+	x1 = (char **)v1;
+	x2 = (char **)v2;
 	
 	return BLI_natstrcmp(*x1, *x2);
 }
@@ -134,7 +138,7 @@ void make_unique_prop_names(bContext *C, char *str)
 		propcount+= BLI_countlist(&ob->sensors);
 		propcount+= BLI_countlist(&ob->controllers);
 		propcount+= BLI_countlist(&ob->actuators);
-	}	
+	}
 	if (propcount==0) {
 		if (idar) MEM_freeN(idar);
 		return;
@@ -149,22 +153,22 @@ void make_unique_prop_names(bContext *C, char *str)
 		ob= (Object *)idar[a];
 		prop= ob->prop.first;
 		while (prop) {
-			names[nr++]= prop->name;
+			names[nr++] = prop->name;
 			prop= prop->next;
 		}
 		sens= ob->sensors.first;
 		while (sens) {
-			names[nr++]= sens->name;
+			names[nr++] = sens->name;
 			sens= sens->next;
 		}
 		cont= ob->controllers.first;
 		while (cont) {
-			names[nr++]= cont->name;
+			names[nr++] = cont->name;
 			cont= cont->next;
 		}
 		act= ob->actuators.first;
 		while (act) {
-			names[nr++]= act->name;
+			names[nr++] = act->name;
 			act= act->next;
 		}
 	}
@@ -524,7 +528,7 @@ static const char *actuator_name(int type)
 	case ACT_ARMATURE:
 		return "Armature";
 	case ACT_STEERING:
-		return "Steering";		
+		return "Steering";
 	}
 	return "unknown";
 }
@@ -678,7 +682,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 				ob= ob->id.next;
 			}
 		}
-	} 
+	}
 	
 	/* now we count */
 	ob= bmain->object.first;
@@ -687,8 +691,8 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 		ob= ob->id.next;
 	}
 
-	if (*count==0) return NULL;
-	if (*count>24) *count= 24;		/* temporal */
+	if (*count == 0) return NULL;
+	if (*count > 24) *count = 24;  /* temporal */
 	
 	idar= MEM_callocN((*count)*sizeof(void *), "idar");
 	
@@ -697,16 +701,16 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 
 	/* make the active object always the first one of the list */
 	if (obact) {
-		idar[0]= (ID *)obact;
+		idar[0] = (ID *)obact;
 		nr++;
 	}
 
 	while (ob) {
 		if ((ob->scavisflag) && (ob != obact)) {
-			idar[nr]= (ID *)ob;
+			idar[nr] = (ID *)ob;
 			nr++;
 		}
-		if (nr>=24) break;
+		if (nr >= 24) break;
 		ob= ob->id.next;
 	}
 	
@@ -768,11 +772,11 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
 	block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
 	uiBlockSetButmFunc(block, do_sensor_menu, NULL);
 	
-	uiDefBut(block, BUTM, 1, "Show Objects",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-	uiDefBut(block, BUTM, 1, "Hide Objects",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 	uiDefBut(block, SEPR, 0, "",	0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
-	uiDefBut(block, BUTM, 1, "Show Sensors",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
-	uiDefBut(block, BUTM, 1, "Hide Sensors",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Sensors"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Sensors"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
 
 	uiBlockSetDirection(block, UI_TOP);
 	uiEndBlock(C, block);
@@ -817,11 +821,11 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
 	block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
 	uiBlockSetButmFunc(block, do_controller_menu, NULL);
 	
-	uiDefBut(block, BUTM, 1, "Show Objects",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-	uiDefBut(block, BUTM, 1, "Hide Objects",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 	uiDefBut(block, SEPR, 0, "",					0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
-	uiDefBut(block, BUTM, 1, "Show Controllers",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
-	uiDefBut(block, BUTM, 1, "Hide Controllers",	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Controllers"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Controllers"),	0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
 
 	uiBlockSetDirection(block, UI_TOP);
 	uiEndBlock(C, block);
@@ -866,11 +870,11 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
 	block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
 	uiBlockSetButmFunc(block, do_actuator_menu, NULL);
 	
-	uiDefBut(block, BUTM, 1, "Show Objects",	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-	uiDefBut(block, BUTM, 1, "Hide Objects",	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 	uiDefBut(block, SEPR, 0, "",	0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
-	uiDefBut(block, BUTM, 1, "Show Actuators",	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
-	uiDefBut(block, BUTM, 1, "Hide Actuators",	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Show Actuators"),	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
+	uiDefBut(block, BUTM, 1, IFACE_("Hide Actuators"),	0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
 
 	uiBlockSetDirection(block, UI_TOP);
 	uiEndBlock(C, block);
@@ -901,7 +905,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c
 	/* use this for a fake extra empy space around the buttons */
 	uiDefBut(block, LABEL, 0, "",			-5, -5, 200, 34, NULL, 0, 0, 0, 0, "");
 	
-	for (offset=0; offset<15; offset+=5) {
+	for (offset=0; offset<15; offset += 5) {
 		uiBlockBeginAlign(block);
 		for (stbit=0; stbit<5; stbit++) {
 			but = uiDefButBitI(block, TOG, (1<<(stbit+offset)), (stbit+offset), "",	(short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, "");
@@ -981,13 +985,13 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
 	sub = uiLayoutRow(row, FALSE);
 	uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") ||
 	                        RNA_boolean_get(ptr, "use_pulse_false_level")));
-	uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE);
+	uiItemR(sub, ptr, "frequency", 0, IFACE_("Freq"), ICON_NONE);
 	
 	row = uiLayoutRow(split, TRUE);
 	uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 	uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 	
-	uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE);
+	uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, IFACE_("Invert"), ICON_NONE);
 }
 /* sensors in alphabetical order */
 
@@ -1010,7 +1014,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
 	uiLayout *row;
 
 	if (ob->type != OB_ARMATURE) {
-		uiItemL(layout, "Sensor only available for armatures", ICON_NONE);
+		uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE);
 		return;
 	}
 
@@ -1112,7 +1116,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
 	uiLayout *row, *col;
 
 	row = uiLayoutRow(layout, FALSE);
-	uiItemL(row, "Key:", ICON_NONE);
+	uiItemL(row, IFACE_("Key:"), ICON_NONE);
 	col = uiLayoutColumn(row, FALSE);
 	uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
 	uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
@@ -1122,11 +1126,11 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
 	col = uiLayoutColumn(layout, FALSE);
 	uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
 	row = uiLayoutRow(col, FALSE);
-	uiItemL(row, "First Modifier:", ICON_NONE);
+	uiItemL(row, IFACE_("First Modifier:"), ICON_NONE);
 	uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE);
 	
 	row = uiLayoutRow(col, FALSE);
-	uiItemL(row, "Second Modifier:", ICON_NONE);
+	uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE);
 	uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE);
 
 	RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
@@ -1312,7 +1316,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
 		uiItemR(row, ptr, "type", 0, "", ICON_NONE);
 		uiItemR(row, ptr, "name", 0, "", ICON_NONE);
 		/* XXX provisory for Blender 2.50Beta */
-		uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
+		uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)"));
 	}
 	else {
 		uiItemL(row, controller_name(cont->type), ICON_NONE);
@@ -1480,7 +1484,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
 	PropertyRNA *bones_prop = NULL;
 
 	if (ob->type != OB_ARMATURE) {
-		uiItemL(layout, "Actuator only available for armatures", ICON_NONE);
+		uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE);
 		return;
 	}
 	
@@ -1586,7 +1590,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
 
 			row = uiLayoutRow(layout, FALSE);
 			col = uiLayoutColumn(row, TRUE);
-			uiItemL(col, "Range:", ICON_NONE);
+			uiItemL(col, IFACE_("Range:"), ICON_NONE);
 			uiItemR(col, ptr, "range", 0, "", ICON_NONE);
 
 			col = uiLayoutColumn(row, TRUE);
@@ -1684,7 +1688,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
 			break;
 		case ACT_EDOB_REPLACE_MESH:
 			if (ob->type != OB_MESH) {
-				uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
+				uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
 				break;
 			}
 			split = uiLayoutSplit(layout, 0.6, FALSE);
@@ -1702,7 +1706,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
 			break;
 		case ACT_EDOB_DYNAMICS:
 			if (ob->type != OB_MESH) {
-				uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
+				uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
 				break;
 			}
 			uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE);
@@ -1772,7 +1776,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
 	uiLayout *split, *row, *col, *sub;
 	int physics_type;
 
-	ob = (Object *)ptr->id.data;	
+	ob = (Object *)ptr->id.data;
 	RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
 	physics_type = RNA_enum_get(&settings_ptr, "physics_type");
 	
@@ -1790,8 +1794,8 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
 			uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
 			uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 			
-			if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {			
-				uiItemL(layout, "Dynamic Object Settings:", ICON_NONE);
+			if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {
+				uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE);
 				split = uiLayoutSplit(layout, 0.9, FALSE);
 				row = uiLayoutRow(split, FALSE);
 				uiItemR(row, ptr, "force", 0, NULL, ICON_NONE);
@@ -1941,7 +1945,7 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
 			break;
 
 		case ACT_RANDOM_BOOL_UNIFORM:
-			uiItemL(row, "Choose between true and false, 50% chance each", ICON_NONE);
+			uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE);
 			break;
 
 		case ACT_RANDOM_BOOL_BERNOUILLI:
@@ -2004,7 +2008,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
 	uiLayout *row;
 
 	if (ob->type != OB_MESH) {
-		uiItemL(layout, "Actuator only available for mesh objects", ICON_NONE);
+		uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE);
 		return;
 	}
 
@@ -2042,7 +2046,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
 
 	uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
 	if (!RNA_pointer_get(ptr, "sound").data) {
-		uiItemL(layout, "Select a sound from the list or load a new one", ICON_NONE);
+		uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE);
 		return;
 	}
 	uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
@@ -2206,15 +2210,13 @@ void logic_buttons(bContext *C, ARegion *ar)
 	SpaceLogic *slogic= CTX_wm_space_logic(C);
 	Object *ob= CTX_data_active_object(C);
 	ID **idar;
-	
 	PointerRNA logic_ptr, settings_ptr, object_ptr;
-	
 	uiLayout *layout, *row, *box;
 	uiBlock *block;
 	uiBut *but;
 	char uiblockstr[32];
 	short a, count;
-	int xco, yco, width;
+	int xco, yco, width, height;
 	
 	if (ob==NULL) return;
 	
@@ -2268,15 +2270,15 @@ void logic_buttons(bContext *C, ARegion *ar)
 	
 	/* ****************** Controllers ****************** */
 	
-	xco= 420; yco= 170; width= 300;
+	xco= 420; yco= -10; width= 300;
 	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
 	row = uiLayoutRow(layout, TRUE);
 	
-	uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
+	uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
 	
-	uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, "Sel", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, IFACE_("Act"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, IFACE_("Link"), ICON_NONE);
 
 	for (a=0; a<count; a++) {
 		bController *cont;
@@ -2299,11 +2301,11 @@ void logic_buttons(bContext *C, ARegion *ar)
 		uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
 
 		row = uiLayoutRow(split, TRUE);
-		uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
+		uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers"));
 
 		RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 		uiLayoutSetContextPointer(row, "object", &object_ptr);
-		uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE);
+		uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", IFACE_("Add Controller"), ICON_NONE);
 
 		if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
 
@@ -2311,8 +2313,8 @@ void logic_buttons(bContext *C, ARegion *ar)
 			split = uiLayoutSplit(box, 0.2f, FALSE);
 
 			col = uiLayoutColumn(split, FALSE);
-			uiItemL(col, "Visible", ICON_NONE);
-			uiItemL(col, "Initial", ICON_NONE);
+			uiItemL(col, IFACE_("Visible"), ICON_NONE);
+			uiItemL(col, IFACE_("Initial"), ICON_NONE);
 
 			subsplit = uiLayoutSplit(split, 0.85f, FALSE);
 			col = uiLayoutColumn(subsplit, FALSE);
@@ -2371,20 +2373,20 @@ void logic_buttons(bContext *C, ARegion *ar)
 		}
 	}
 	uiBlockLayoutResolve(block, NULL, &yco);	/* stores final height in yco */
-	
+	height = yco;
 	
 	/* ****************** Sensors ****************** */
 	
-	xco= 10; yco= 170; width= 340;
+	xco= 10; yco= -10; width= 340;
 	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
 	row = uiLayoutRow(layout, TRUE);
 	
-	uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
+	uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
 	
-	uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, "Sel", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, "Act", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, IFACE_("Act"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, IFACE_("Link"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, IFACE_("State"), ICON_NONE);
 	
 	for (a=0; a<count; a++) {
 		bSensor *sens;
@@ -2396,11 +2398,11 @@ void logic_buttons(bContext *C, ARegion *ar)
 		if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
 
 		row = uiLayoutRow(layout, TRUE);
-		uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+		uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors"));
 
 		RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 		uiLayoutSetContextPointer(row, "object", &object_ptr);
-		uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE);
+		uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", IFACE_("Add Sensor"), ICON_NONE);
 		
 		if ((ob->scaflag & OB_SHOWSENS) == 0) continue;
 		
@@ -2440,19 +2442,20 @@ void logic_buttons(bContext *C, ARegion *ar)
 		}
 	}
 	uiBlockLayoutResolve(block, NULL, &yco);	/* stores final height in yco */
+	height = MIN2(height, yco);
 	
 	/* ****************** Actuators ****************** */
 	
-	xco= 800; yco= 170; width= 340;
+	xco= 800; yco= -10; width= 340;
 	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
 	row = uiLayoutRow(layout, TRUE);
 	
-	uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
+	uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco-10, yco, 300, UI_UNIT_Y, "");		/* replace this with uiLayout stuff later */
 	
-	uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, "Sel", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, "Act", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NONE);
-	uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, IFACE_("Act"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, IFACE_("Link"), ICON_NONE);
+	uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, IFACE_("State"), ICON_NONE);
 	
 	for (a=0; a<count; a++) {
 		bActuator *act;
@@ -2466,11 +2469,11 @@ void logic_buttons(bContext *C, ARegion *ar)
 		}
 
 		row = uiLayoutRow(layout, TRUE);
-		uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+		uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators"));
 
 		RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 		uiLayoutSetContextPointer(row, "object", &object_ptr);
-		uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE);
+		uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", IFACE_("Add Actuator"), ICON_NONE);
 
 		if ((ob->scaflag & OB_SHOWACT) == 0) continue;
 		
@@ -2511,13 +2514,21 @@ void logic_buttons(bContext *C, ARegion *ar)
 		}
 	}
 	uiBlockLayoutResolve(block, NULL, &yco);	/* stores final height in yco */
+	height = MIN2(height, yco);
+
+	UI_view2d_totRect_set(&ar->v2d, 1150, height);
 	
-	
+	/* set the view */
+	UI_view2d_view_ortho(&ar->v2d);
+
 	uiComposeLinks(block);
 	
 	uiEndBlock(C, block);
 	uiDrawBlock(C, block);
 	
+	/* restore view matrix */
+	UI_view2d_view_restore(C);
+	
 	if (idar) MEM_freeN(idar);
 }
 
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 1a50f72..4cd5321 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -62,20 +62,20 @@ ARegion *logic_has_buttons_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
 	if (ar) return ar;
 	
 	/* add subdiv level; after header */
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
 
 	/* is error! */
-	if (ar==NULL) return NULL;
+	if (ar == NULL) return NULL;
 	
 	arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
 	
 	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
-	arnew->regiontype= RGN_TYPE_UI;
-	arnew->alignment= RGN_ALIGN_LEFT;
+	arnew->regiontype = RGN_TYPE_UI;
+	arnew->alignment = RGN_ALIGN_LEFT;
 	
 	arnew->flag = RGN_FLAG_HIDDEN;
 	
@@ -84,8 +84,9 @@ ARegion *logic_has_buttons_region(ScrArea *sa)
 
 /* ******************** default callbacks for image space ***************** */
 
-static SpaceLink *logic_new(const bContext *UNUSED(C))
+static SpaceLink *logic_new(const bContext *C)
 {
+	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar;
 	SpaceLogic *slogic;
 	
@@ -93,10 +94,10 @@ static SpaceLink *logic_new(const bContext *UNUSED(C))
 	slogic->spacetype= SPACE_LOGIC;
 	
 	/* default options */
-	slogic->scaflag =	(BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) 	|
-						(BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) 	|
-						(BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK)		|
-						(BUTS_SENS_STATE|BUTS_ACT_STATE);
+	slogic->scaflag = ((BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) |
+	                   (BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) |
+	                   (BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK)    |
+	                   (BUTS_SENS_STATE|BUTS_ACT_STATE));
 	
 	
 	/* header */
@@ -120,28 +121,26 @@ static SpaceLink *logic_new(const bContext *UNUSED(C))
 	ar->regiontype= RGN_TYPE_WINDOW;
 
 	ar->v2d.tot.xmin =  0.0f;
-	ar->v2d.tot.ymin =  0.0f;
-	ar->v2d.tot.xmax = 1280;
-	ar->v2d.tot.ymax = 240.0f;
+	ar->v2d.tot.ymax =  0.0f;
+	ar->v2d.tot.xmax = 1150.0f;
+	ar->v2d.tot.ymin = ( 1150.0f/(float)sa->winx ) * (float)-sa->winy;
 	
-	ar->v2d.cur.xmin =  0.0f;
-	ar->v2d.cur.ymin =  0.0f;
-	ar->v2d.cur.xmax = 1280.0f;
-	ar->v2d.cur.ymax = 240.0f;
+	ar->v2d.cur = ar->v2d.tot;
 	
-	ar->v2d.min[0]= 1.0f;
-	ar->v2d.min[1]= 1.0f;
+	ar->v2d.min[0] = 1.0f;
+	ar->v2d.min[1] = 1.0f;
 	
-	ar->v2d.max[0]= 32000.0f;
-	ar->v2d.max[1]= 32000.0f;
+	ar->v2d.max[0] = 32000.0f;
+	ar->v2d.max[1] = 32000.0f;
 	
-	ar->v2d.minzoom= 0.5f;
-	ar->v2d.maxzoom= 1.21f;
-	
-	ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-	ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
-	ar->v2d.keeptot= 0;
+	ar->v2d.minzoom = 0.5f;
+	ar->v2d.maxzoom = 1.5f;
 	
+	ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+	ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT;
+	ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+	ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X;
+	ar->v2d.keepofs = V2D_KEEPOFS_Y;
 	
 	return (SpaceLink *)slogic;
 }
@@ -183,6 +182,9 @@ static void logic_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
+	
+	WM_keymap_add_item(keymap, "VIEW2D_OT_reset", HOMEKEY, KM_PRESS, 0, 0);
+
 }
 
 static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
@@ -234,7 +236,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
 	wmKeyMap *keymap;
 	
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
+	
 	/* own keymaps */
 	keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
@@ -259,7 +261,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar)
 	UI_view2d_view_restore(C);
 	
 	/* scrollers */
-	scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+	scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
 	UI_view2d_scrollers_free(scrollers);
 	
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 18e9830..d75946c 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -71,7 +71,7 @@
 
 static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event)
 {
-	//Scene *scene= CTX_data_scene(C);
+	//Scene *scene = CTX_data_scene(C);
 	
 	switch (event) {
 
@@ -156,7 +156,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
 						found = -1;
 					}
 				}
-			}	
+			}
 			break;
 		}
 		
@@ -242,7 +242,7 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
 	if (!nla_panel_context(C, &adt_ptr, NULL, NULL))
 		return;
 
-	/* adt= adt_ptr.data; */
+	/* adt = adt_ptr.data; */
 	
 	block = uiLayoutGetBlock(layout);
 	uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
@@ -405,7 +405,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
 	uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE);
 	
 	sub = uiLayoutColumn(col, TRUE);
-	uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence"));	
+	uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence"));
 	uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE);
 
 	col = uiLayoutColumn(layout, TRUE);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index b3a869e..95e75d0 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -199,7 +199,7 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor
 			}
 			
 			notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
-		}	
+		}
 		break;
 			
 		case ANIMTYPE_NLATRACK:
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 92f014f..fd999bf 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -163,7 +163,7 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col
 			/* normal, unselected strip - use (hardly noticeable) blue tinge */
 			UI_GetThemeColor3fv(TH_NLA_TRANSITION, color);
 		}
-	}	
+	}
 	else if (strip->type == NLASTRIP_TYPE_META) {
 		/* Meta Clip */
 		// TODO: should temporary metas get different colors too?
@@ -528,7 +528,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
 	 */
 	v2d->tot.ymin = (float)(-height);
 	
-	/* loop through channels, and set up drawing depending on their type  */	
+	/* loop through channels, and set up drawing depending on their type  */
 	y = (float)(-NLACHANNEL_HEIGHT(snla));
 	
 	for (ale = anim_data.first; ale; ale = ale->next) {
@@ -628,7 +628,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
 	bAnimListElem *ale;
 	float x = 0.0f;
 	
-	/* loop through channels, and set up drawing depending on their type  */	
+	/* loop through channels, and set up drawing depending on their type  */
 	for (ale = anim_data->first; ale; ale = ale->next) {
 		const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
 		const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
@@ -709,7 +709,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
 					// draw backdrops only...
 					ANIM_channel_draw(ac, ale, yminc, ymaxc);
 					break;
-			}	
+			}
 			
 			/* if special types, draw manually for now... */
 			if (do_draw) {
@@ -737,7 +737,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
 								/* even more */
 								offset = 21;
 								indent = 1;
-							}	
+							}
 							break;
 								
 							default:
@@ -775,7 +775,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
 						glColor3fv(color);
 					}
 					else {
-						float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3 : 1.0f;
+						float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
 						glColor4f(color[0], color[1], color[2], alpha);
 					}
 					
@@ -849,8 +849,6 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
 				
 				/* draw NLA-action line 'status-icons' - only when there's an action */
 				if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) {
-					AnimData *adt = ale->adt;
-					
 					offset += 16;
 					
 					/* now draw some indicator icons  */
@@ -938,7 +936,7 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		glEnable(GL_BLEND);
 		
-		/* loop through channels, and set up drawing depending on their type  */	
+		/* loop through channels, and set up drawing depending on their type  */
 		for (ale = anim_data.first; ale; ale = ale->next) {
 			const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
 			const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 950060d..3740c3f 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -121,9 +121,9 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op)
 	
 	/* if no blocks, popup error? */
 	if (anim_data.first == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweakmode for");
+		BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for");
 		return OPERATOR_CANCELLED;
-	}	
+	}
 	
 	/* for each AnimData block with NLA-data, try setting it in tweak-mode */
 	for (ale = anim_data.first; ale; ale = ale->next) {
@@ -147,7 +147,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op)
 		WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
 	}
 	else {
-		BKE_report(op->reports, RPT_ERROR, "No active strip(s) to enter tweakmode on");
+		BKE_report(op->reports, RPT_ERROR, "No active strip(s) to enter tweak mode on");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -190,9 +190,9 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
 	
 	/* if no blocks, popup error? */
 	if (anim_data.first == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweakmode for");
+		BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for");
 		return OPERATOR_CANCELLED;
-	}	
+	}
 	
 	/* for each AnimData block with NLA-data, try exitting tweak-mode */
 	for (ale = anim_data.first; ale; ale = ale->next) {
@@ -266,8 +266,8 @@ static void get_nlastrip_extents(bAnimContext *ac, float *min, float *max, const
 				/* only consider selected strips? */
 				if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) {
 					/* extend range if appropriate */
-					*min = minf(*min, strip->start);
-					*max = maxf(*max, strip->end);
+					*min = min_ff(*min, strip->start);
+					*max = max_ff(*max, strip->end);
 				}
 			}
 		}
@@ -398,14 +398,16 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
 	act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
 	
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
+		BKE_report(op->reports, RPT_ERROR, "No valid action to add");
 		//printf("Add strip - actname = '%s'\n", actname);
 		return OPERATOR_CANCELLED;
 	}
 	else if (act->idroot == 0) {
 		/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
 		BKE_reportf(op->reports, RPT_WARNING,
-		            "Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
+		            "Action '%s' does not specify what datablocks it can be used on "
+		            "(try setting the 'ID Root Type' setting from the Datablocks Editor "
+		            "for this action to avoid future problems)",
 		            act->id.name + 2);
 	}
 	
@@ -431,7 +433,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
 		 */
 		if ((act->idroot) && (act->idroot != GS(ale->id->name))) {
 			BKE_reportf(op->reports, RPT_ERROR, 
-			            "Couldn't add action '%s' as it cannot be used relative to ID-blocks of type '%s'",
+			            "Could not add action '%s' as it cannot be used relative to ID-blocks of type '%s'",
 			            act->id.name + 2, ale->id->name);
 			continue;
 		}
@@ -1362,7 +1364,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
 					           "Cannot swap selected strips as they will not be able to fit in their new places");
 				}
 				else {
-					BKE_reportf(op->reports, RPT_WARNING, 	
+					BKE_reportf(op->reports, RPT_WARNING,
 					            "Cannot swap '%s' and '%s' as one or both will not be able to fit in their new places",
 					            sa->name, sb->name);
 				}
@@ -2021,7 +2023,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
 				set_active_fmodifier(&strip->modifiers, fcm);
 			else {
 				BKE_reportf(op->reports, RPT_ERROR,
-				            "Modifier couldn't be added to (%s : %s) (see console for details)",
+				            "Modifier could not be added to (%s : %s) (see console for details)",
 				            nlt->name, strip->name);
 			}
 		}
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 3a74d0b..54ade82 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -256,7 +256,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap)
 	WM_keymap_add_item(keymap, "NLA_OT_meta_remove", GKEY, KM_PRESS, KM_ALT, 0);
 		
 	/* duplicate */
-	WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);	
+	WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
 		
 	/* delete */
 	WM_keymap_add_item(keymap, "NLA_OT_delete", XKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 79be0d0..97553b7 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -390,7 +390,7 @@ static void nlaedit_select_leftright(bContext *C, bAnimContext *ac, short leftri
 	if (leftright == NLAEDIT_LRSEL_LEFT) {
 		xmin = MINAFRAMEF;
 		xmax = (float)(CFRA + 0.1f);
-	} 
+	}
 	else {
 		xmin = (float)(CFRA - 0.1f);
 		xmax = MAXFRAMEF;
@@ -471,7 +471,7 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent
 		UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 		if (x < CFRA)
 			RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT);
-		else 	
+		else
 			RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
 	}
 	
@@ -582,7 +582,7 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
 		ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
 		
 		/* Highlight NLA-Track */
-		if (ale->type == ANIMTYPE_NLATRACK) {	
+		if (ale->type == ANIMTYPE_NLATRACK) {
 			NlaTrack *nlt = (NlaTrack *)ale->data;
 			
 			nlt->flag |= NLATRACK_SELECTED;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 470f821..92edac3 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -108,6 +108,43 @@ static void node_socket_button_default(const bContext *C, uiBlock *block,
 	}
 }
 
+static void node_socket_button_string(const bContext *C, uiBlock *block,
+                                       bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+                                       const char *name, int x, int y, int width)
+{
+	if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
+		node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
+	else {
+		PointerRNA ptr;
+		uiBut *bt;
+
+		SpaceNode *snode = CTX_wm_space_node(C);
+		const char *ui_name = IFACE_(name);
+		float slen;
+
+		UI_ThemeColor(TH_TEXT);
+		slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt;
+		while (slen > (width * 0.5f) && *ui_name) {
+			ui_name = BLI_str_find_next_char_utf8(ui_name, NULL);
+			slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt;
+		}
+
+		RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
+		
+		if (name[0] == '\0')
+			slen = 0.0;
+		
+		bt = uiDefButR(block, TEX, B_NODE_EXEC, "",
+		               x, y + 1, width - slen, NODE_DY - 2,
+		               &ptr, "default_value", 0, 0, 0, -1, -1, "");
+		if (node)
+			uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+		
+		if (slen > 0.0f)
+			uiDefBut(block, LABEL, 0, IFACE_(name), x + (width - slen), y + 2, slen, NODE_DY - 2, NULL, 0, 0, 0, 0, "");
+	}
+}
+
 typedef struct SocketComponentMenuArgs {
 	PointerRNA ptr;
 	int x, y, width;
@@ -209,9 +246,9 @@ static void node_draw_output_default(const bContext *C, uiBlock *block,
 	
 	if (*ui_name) {
 		uiDefBut(block, LABEL, 0, ui_name,
-				 (int)(sock->locx - slen), (int)(sock->locy - 9.0f),
-				 (short)slen, (short)NODE_DY,
-				 NULL, 0, 0, 0, 0, "");
+		         (int)(sock->locx - slen), (int)(sock->locy - 9.0f),
+		         (short)slen, (short)NODE_DY,
+		         NULL, 0, 0, 0, 0, "");
 	}
 }
 
@@ -282,7 +319,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr
 	RNA_property_collection_lookup_int(ptr, prop, 0, &sockptr);
 	
 	col = uiLayoutColumn(layout, FALSE);
-	uiTemplateColorWheel(col, &sockptr, "default_value", 1, 0, 0, 0);
+	uiTemplateColorPicker(col, &sockptr, "default_value", 1, 0, 0, 0);
 	uiItemR(col, &sockptr, "default_value", 0, "", ICON_NONE);
 }
 
@@ -361,29 +398,15 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
 	uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
 }
 
-static void node_normal_cb(bContext *C, void *ntree_v, void *node_v)
-{
-	Main *bmain = CTX_data_main(C);
-
-	ED_node_generic_update(bmain, ntree_v, node_v);
-	WM_event_add_notifier(C, NC_NODE | NA_EDITED, ntree_v);
-}
-
 static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
-	uiBlock *block = uiLayoutAbsoluteBlock(layout);
-	bNodeTree *ntree = ptr->id.data;
-	bNode *node = ptr->data;
-	rctf *butr = &node->butr;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 	bNodeSocket *sock = node->outputs.first;     /* first socket stores normal */
-	float *nor = ((bNodeSocketValueVector *)sock->default_value)->value;
-	uiBut *bt;
-	
-	bt = uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
-	               (int)butr->xmin, (int)butr->xmin,
-	               (short)BLI_rctf_size_x(butr), (short)BLI_rctf_size_x(butr),
-	               nor, 0.0f, 1.0f, 0, 0, "");
-	uiButSetFunc(bt, node_normal_cb, ntree, node);
+	PointerRNA sockptr;
+
+	RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &sockptr);
+	uiItemR(layout, &sockptr, "default_value", 0, "", ICON_NONE);
 }
 #if 0 /* not used in 2.5x yet */
 static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
@@ -486,8 +509,9 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
 		bNodeSocket *sock, *gsock;
 		float locx, locy;
 		rctf *rect = &gnode->totr;
-		float node_group_frame = U.dpi * NODE_GROUP_FRAME / 72;
-		float group_header = 26 * U.dpi / 72;
+		const float dpi_fac = UI_DPI_ICON_FAC;
+		const float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
+		const float group_header = 26 * dpi_fac;
 		int counter;
 		int dy;
 		
@@ -664,7 +688,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
 static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode,
                               bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
 {
-	const float dpi_fac = U.dpi / 72.0f;
+	const float dpi_fac = UI_DPI_ICON_FAC;
 	bNodeTree *ngroup = (bNodeTree *)gnode->id;
 	bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type);
 	uiBut *bt;
@@ -776,9 +800,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 		uiLayout *layout;
 		PointerRNA ptr;
 		rctf rect = gnode->totr;
-		const float dpi_fac = U.dpi / 72.0f;
-		float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
-		float group_header = 26 * dpi_fac;
+		const float dpi_fac = UI_DPI_ICON_FAC;
+		const float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
+		const float group_header = 26 * dpi_fac;
 		
 		int index;
 		
@@ -834,7 +858,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	
 		layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
 		                       (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))),
-		                       mini((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
+		                       min_ii((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
 		RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
 		uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL);
 		uiBlockLayoutResolve(gnode->block, NULL, NULL);
@@ -895,11 +919,6 @@ static void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
 	uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL);
 }
 
-static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
-{
-	uiItemR(layout, ptr, "max_iterations", 0, NULL, ICON_NONE);
-}
-
 /* XXX Does a bounding box update by iterating over all children.
  * Not ideal to do this in every draw call, but doing as transform callback doesn't work,
  * since the child node totr rects are not updated properly at that point.
@@ -1179,16 +1198,6 @@ static void node_common_set_butfunc(bNodeType *ntype)
 			ntype->drawfunc = node_draw_group;
 			ntype->drawupdatefunc = node_update_group;
 			break;
-		case NODE_FORLOOP:
-//			ntype->uifunc= node_common_buts_group;
-			ntype->drawfunc = node_draw_group;
-			ntype->drawupdatefunc = node_update_group;
-			break;
-		case NODE_WHILELOOP:
-			ntype->uifunc = node_common_buts_whileloop;
-			ntype->drawfunc = node_draw_group;
-			ntype->drawupdatefunc = node_update_group;
-			break;
 		case NODE_FRAME:
 			ntype->drawfunc = node_draw_frame;
 			ntype->drawupdatefunc = node_update_frame;
@@ -1394,16 +1403,85 @@ static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), Po
 	uiItemR(layout, ptr, "from_dupli", 0, NULL, 0);
 }
 
+static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	uiItemR(layout, ptr, "space", 0, "", 0);
+
+	if (RNA_enum_get(ptr, "space") == SHD_NORMAL_MAP_TANGENT) {
+		PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+		if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+			PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+			uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_textures", "", ICON_NONE);
+		}
+		else
+			uiItemR(layout, ptr, "uv_map", 0, "", 0);
+	}
+}
+
+static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	uiLayout *split, *row;
+
+	split = uiLayoutSplit(layout, 0.0f, FALSE);
+
+	uiItemR(split, ptr, "direction_type", 0, "", 0);
+
+	row = uiLayoutRow(split, FALSE);
+
+	if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) {
+		PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+		if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+			PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+			uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_textures", "", ICON_NONE);
+		}
+		else
+			uiItemR(row, ptr, "uv_map", 0, "", 0);
+	}
+	else
+		uiItemR(row, ptr, "axis", UI_ITEM_R_EXPAND, NULL, 0);
+}
+
 static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
 	uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE);
 }
 
+static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+	uiLayout *row;
+
+	row = uiLayoutRow(layout, FALSE);
+	uiItemR(row, ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+	row = uiLayoutRow(layout, TRUE);
+
+	if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL)
+		uiItemR(row, ptr, "script", 0, "", ICON_NONE);
+	else
+		uiItemR(row, ptr, "filepath", 0, "", ICON_NONE);
+
+	uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update");
+}
+
+static void node_shader_buts_script_details(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	uiItemS(layout);
+
+	node_shader_buts_script(layout, C, ptr);
+
+#if 0  /* not implemented yet */
+	if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL)
+		uiItemR(layout, ptr, "use_auto_update", 0, NULL, ICON_NONE);
+#endif
+}
+
 /* only once called */
 static void node_shader_set_butfunc(bNodeType *ntype)
 {
 	switch (ntype->type) {
-		/* case NODE_GROUP:	 note, typeinfo for group is generated... see "XXX ugly hack" */
+		/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
 
 		case SH_NODE_MATERIAL:
 		case SH_NODE_MATERIAL_EXT:
@@ -1478,10 +1556,21 @@ static void node_shader_set_butfunc(bNodeType *ntype)
 		case SH_NODE_TEX_COORD:
 			ntype->uifunc = node_shader_buts_tex_coord;
 			break;
+		case SH_NODE_NORMAL_MAP:
+			ntype->uifunc = node_shader_buts_normal_map;
+			break;
+		case SH_NODE_TANGENT:
+			ntype->uifunc = node_shader_buts_tangent;
+			break;
 		case SH_NODE_BSDF_GLOSSY:
 		case SH_NODE_BSDF_GLASS:
+		case SH_NODE_BSDF_REFRACTION:
 			ntype->uifunc = node_shader_buts_glossy;
 			break;
+		case SH_NODE_SCRIPT:
+			ntype->uifunc = node_shader_buts_script;
+			ntype->uifuncbut = node_shader_buts_script_details;
+			break;
 	}
 }
 
@@ -1785,6 +1874,14 @@ static void node_composit_buts_double_edge_mask(uiLayout *layout, bContext *UNUS
 	uiItemR(col, ptr, "edge_mode", 0, "", ICON_NONE);
 }
 
+static void node_composit_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+	uiLayout *col;
+
+	col = uiLayoutColumn(layout, TRUE);
+	uiItemR(col, ptr, "use_clamp", 0, NULL, ICON_NONE);
+}
+
 static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
 	uiLayout *sub, *col;
@@ -2156,17 +2253,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
 	
 		split = uiLayoutSplit(layout, 0.0f, FALSE);
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "lift", 1, 1, 0, 1);
+		uiTemplateColorPicker(col, ptr, "lift", 1, 1, 0, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "lift", 0, NULL, ICON_NONE);
 		
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "gamma", 1, 1, 1, 1);
+		uiTemplateColorPicker(col, ptr, "gamma", 1, 1, 1, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "gamma", 0, NULL, ICON_NONE);
 		
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "gain", 1, 1, 1, 1);
+		uiTemplateColorPicker(col, ptr, "gain", 1, 1, 1, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "gain", 0, NULL, ICON_NONE);
 
@@ -2175,17 +2272,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
 		
 		split = uiLayoutSplit(layout, 0.0f, FALSE);
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "offset", 1, 1, 0, 1);
+		uiTemplateColorPicker(col, ptr, "offset", 1, 1, 0, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "offset", 0, NULL, ICON_NONE);
 		
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "power", 1, 1, 0, 1);
+		uiTemplateColorPicker(col, ptr, "power", 1, 1, 0, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "power", 0, NULL, ICON_NONE);
 		
 		col = uiLayoutColumn(split, FALSE);
-		uiTemplateColorWheel(col, ptr, "slope", 1, 1, 0, 1);
+		uiTemplateColorPicker(col, ptr, "slope", 1, 1, 0, 1);
 		row = uiLayoutRow(col, FALSE);
 		uiItemR(row, ptr, "slope", 0, NULL, ICON_NONE);
 	}
@@ -2197,23 +2294,23 @@ static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUS
 
 	if (RNA_enum_get(ptr, "correction_method") == 0) {
 
-		uiTemplateColorWheel(layout, ptr, "lift", 1, 1, 0, 1);
+		uiTemplateColorPicker(layout, ptr, "lift", 1, 1, 0, 1);
 		uiItemR(layout, ptr, "lift", 0, NULL, ICON_NONE);
 
-		uiTemplateColorWheel(layout, ptr, "gamma", 1, 1, 1, 1);
+		uiTemplateColorPicker(layout, ptr, "gamma", 1, 1, 1, 1);
 		uiItemR(layout, ptr, "gamma", 0, NULL, ICON_NONE);
 
-		uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1);
+		uiTemplateColorPicker(layout, ptr, "gain", 1, 1, 1, 1);
 		uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE);
 	}
 	else {
-		uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1);
+		uiTemplateColorPicker(layout, ptr, "offset", 1, 1, 0, 1);
 		uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
 
-		uiTemplateColorWheel(layout, ptr, "power", 1, 1, 0, 1);
+		uiTemplateColorPicker(layout, ptr, "power", 1, 1, 0, 1);
 		uiItemR(layout, ptr, "power", 0, NULL, ICON_NONE);
 
-		uiTemplateColorWheel(layout, ptr, "slope", 1, 1, 0, 1);
+		uiTemplateColorPicker(layout, ptr, "slope", 1, 1, 0, 1);
 		uiItemR(layout, ptr, "slope", 0, NULL, ICON_NONE);
 	}
 }
@@ -2595,7 +2692,7 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point
 
 static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
-	/* bNode *node= ptr->data; */ /* UNUSED */
+	/* bNode *node = ptr->data; */ /* UNUSED */
 
 	uiItemR(layout, ptr, "blur_pre", 0, NULL, ICON_NONE);
 	uiItemR(layout, ptr, "screen_balance", 0, NULL, ICON_NONE);
@@ -2654,7 +2751,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN
 static void node_composit_set_butfunc(bNodeType *ntype)
 {
 	switch (ntype->type) {
-		/* case NODE_GROUP:	 note, typeinfo for group is generated... see "XXX ugly hack" */
+		/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
 
 		case CMP_NODE_IMAGE:
 			ntype->uifunc = node_composit_buts_image;
@@ -2723,6 +2820,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
 		case CMP_NODE_MAP_VALUE:
 			ntype->uifunc = node_composit_buts_map_value;
 			break;
+		case CMP_NODE_MAP_RANGE:
+			ntype->uifunc = node_composit_buts_map_range;
+			break;
 		case CMP_NODE_TIME:
 			ntype->uifunc = node_buts_time;
 			break;
@@ -3072,6 +3172,9 @@ void ED_node_init_butfuncs(void)
 				case SOCK_BOOLEAN:
 					stype->buttonfunc = node_socket_button_default;
 					break;
+				case SOCK_STRING:
+					stype->buttonfunc = node_socket_button_string;
+					break;
 				case SOCK_VECTOR:
 					stype->buttonfunc = node_socket_button_components;
 					break;
@@ -3098,7 +3201,6 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
 		void *lock;
 		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 		if (ibuf) {
-			SpaceNode *snode = CTX_wm_space_node(C);
 			float x, y; 
 			unsigned char *display_buffer;
 			void *cache_handle;
@@ -3198,7 +3300,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
 			glPopMatrix();
 		}
 
-		BKE_image_release_ibuf(ima, lock);
+		BKE_image_release_ibuf(ima, ibuf, lock);
 	}
 }
 
@@ -3211,7 +3313,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 	
 	if (snode->flag & SNODE_BACKDRAW) {
 		Image *ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
-		ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 		if (ibuf) {
 			int x, y;
 			float zoom = 1.0;
@@ -3227,7 +3329,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 				float zoomx, zoomy;
 				zoomx = (float)sa->winx / ibuf->x;
 				zoomy = (float)sa->winy / ibuf->y;
-				zoom = minf(zoomx, zoomy);
+				zoom = min_ff(zoomx, zoomy);
 			}
 			
 			x = (sa->winx - zoom * ibuf->x) / 2 + snode->xof;
@@ -3247,6 +3349,8 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 			glPopMatrix();
 			glMatrixMode(GL_MODELVIEW);
 			glPopMatrix();
+
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 	}
 }
@@ -3558,7 +3662,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
 			}
 			do_shaded = TRUE;
 			do_triple = TRUE;
-		}				
+		}
 		else {
 			th_col1 = TH_REDALERT;
 		}
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 99d49fa..96ac716 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -31,10 +31,15 @@
 
 #include <errno.h>
 
+#include "MEM_guardedalloc.h"
+
 #include "DNA_node_types.h"
 
+#include "BLI_listbase.h"
 #include "BLI_math.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_image.h"
 #include "BKE_library.h"
@@ -131,14 +136,105 @@ static int add_reroute_intersect_check(bNodeLink *link, float mcoords[][2], int
 	return 0;
 }
 
+typedef struct bNodeSocketLink {
+	struct bNodeSocketLink *next, *prev;
+	
+	struct bNodeSocket *sock;
+	struct bNodeLink *link;
+	float point[2];
+} bNodeSocketLink;
+
+static bNodeSocketLink *add_reroute_insert_socket_link(ListBase *lb, bNodeSocket *sock, bNodeLink *link, float point[2])
+{
+	bNodeSocketLink *socklink, *prev;
+	
+	socklink = MEM_callocN(sizeof(bNodeSocketLink), "socket link");
+	socklink->sock = sock;
+	socklink->link = link;
+	copy_v2_v2(socklink->point, point);
+	
+	for (prev = lb->last; prev; prev = prev->prev) {
+		if (prev->sock == sock)
+			break;
+	}
+	BLI_insertlinkafter(lb, prev, socklink);
+	return socklink;
+}
+
+static bNodeSocketLink *add_reroute_do_socket_section(bContext *C, bNodeSocketLink *socklink, int in_out)
+{
+	SpaceNode *snode = CTX_wm_space_node(C);
+	bNodeTree *ntree = snode->edittree;
+	bNode *reroute_node = NULL;
+	bNodeSocket *cursock = socklink->sock;
+	float insert_point[2];
+	int num_links;
+	
+	zero_v2(insert_point);
+	num_links = 0;
+	
+	while (socklink && socklink->sock == cursock) {
+		if (!(socklink->link->flag & NODE_LINK_TEST)) {
+			socklink->link->flag |= NODE_LINK_TEST;
+			
+			/* create the reroute node for this cursock */
+			if (!reroute_node) {
+				bNodeTemplate ntemp;
+				ntemp.type = NODE_REROUTE;
+				reroute_node = nodeAddNode(ntree, &ntemp);
+				
+				/* add a single link to/from the reroute node to replace multiple links */
+				if (in_out == SOCK_OUT) {
+					nodeAddLink(ntree, socklink->link->fromnode, socklink->link->fromsock, reroute_node, reroute_node->inputs.first);
+				}
+				else {
+					nodeAddLink(ntree, reroute_node, reroute_node->outputs.first, socklink->link->tonode, socklink->link->tosock);
+				}
+			}
+			
+			/* insert the reroute node into the link */
+			if (in_out == SOCK_OUT) {
+				socklink->link->fromnode = reroute_node;
+				socklink->link->fromsock = reroute_node->outputs.first;
+			}
+			else {
+				socklink->link->tonode = reroute_node;
+				socklink->link->tosock = reroute_node->inputs.first;
+			}
+			
+			add_v2_v2(insert_point, socklink->point);
+			++num_links;
+		}
+		socklink = socklink->next;
+	}
+	
+	if (num_links > 0) {
+		bNode *gnode = node_tree_get_editgroup(snode->nodetree);
+		
+		/* average cut point from shared links */
+		mul_v2_fl(insert_point, 1.0f / num_links);
+		
+		if (gnode) {
+			nodeFromView(gnode, insert_point[0], insert_point[1], &reroute_node->locx, &reroute_node->locy);
+		}
+		else {
+			reroute_node->locx = insert_point[0];
+			reroute_node->locy = insert_point[1];
+		}
+	}
+	
+	return socklink;
+}
+
 static int add_reroute_exec(bContext *C, wmOperator *op)
 {
 	SpaceNode *snode = CTX_wm_space_node(C);
 	ARegion *ar = CTX_wm_region(C);
-	bNode *gnode = node_tree_get_editgroup(snode->nodetree);
+	bNodeTree *ntree = snode->edittree;
 	float mcoords[256][2];
 	int i = 0;
-
+	
+	/* Get the cut path */
 	RNA_BEGIN(op->ptr, itemptr, "path")
 	{
 		float loc[2];
@@ -152,46 +248,52 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
 	RNA_END;
 
 	if (i > 1) {
+		ListBase output_links, input_links;
 		bNodeLink *link;
-		float insertPoint[2];
-
-		for (link = snode->edittree->links.first; link; link = link->next) {
-			if (add_reroute_intersect_check(link, mcoords, i, insertPoint)) {
-				bNodeTemplate ntemp;
-				bNode *rerouteNode;
-
-				/* always first */
-				ED_preview_kill_jobs(C);
-
-				node_deselect_all(snode);
-
-				ntemp.type = NODE_REROUTE;
-				rerouteNode = nodeAddNode(snode->edittree, &ntemp);
-				if (gnode) {
-					nodeFromView(gnode, insertPoint[0], insertPoint[1], &rerouteNode->locx, &rerouteNode->locy);
-				}
-				else {
-					rerouteNode->locx = insertPoint[0];
-					rerouteNode->locy = insertPoint[1];
-				}
-
-				nodeAddLink(snode->edittree, link->fromnode, link->fromsock, rerouteNode, rerouteNode->inputs.first);
-				link->fromnode = rerouteNode;
-				link->fromsock = rerouteNode->outputs.first;
-
-				/* always last */
-				ntreeUpdateTree(snode->edittree);
-				snode_notify(C, snode);
-				snode_dag_update(C, snode);
-
-				return OPERATOR_FINISHED; // add one reroute at the time.
+		bNodeSocketLink *socklink;
+		float insert_point[2];
+		
+		/* always first */
+		ED_preview_kill_jobs(C);
+		
+		node_deselect_all(snode);
+		
+		/* Find cut links and sort them by sockets */
+		output_links.first = output_links.last = NULL;
+		input_links.first = input_links.last = NULL;
+		for (link = ntree->links.first; link; link = link->next) {
+			if (add_reroute_intersect_check(link, mcoords, i, insert_point)) {
+				add_reroute_insert_socket_link(&output_links, link->fromsock, link, insert_point);
+				add_reroute_insert_socket_link(&input_links, link->tosock, link, insert_point);
+				
+				/* Clear flag */
+				link->flag &= ~NODE_LINK_TEST;
 			}
 		}
-
-		return OPERATOR_CANCELLED;
-
+		
+		/* Create reroute nodes for intersected links.
+		 * Only one reroute if links share the same input/output socket.
+		 */
+		socklink = output_links.first;
+		while (socklink) {
+			socklink = add_reroute_do_socket_section(C, socklink, SOCK_OUT);
+		}
+		socklink = input_links.first;
+		while (socklink) {
+			socklink = add_reroute_do_socket_section(C, socklink, SOCK_IN);
+		}
+		
+		BLI_freelistN(&output_links);
+		BLI_freelistN(&input_links);
+		
+		/* always last */
+		ntreeUpdateTree(ntree);
+		snode_notify(C, snode);
+		snode_dag_update(C, snode);
+		
+		return OPERATOR_FINISHED;
 	}
-
+	
 	return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
 }
 
@@ -240,7 +342,8 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 		ima = BKE_image_load_exists(path);
 
 		if (!ima) {
-			BKE_reportf(op->reports, RPT_ERROR, "Can't read image: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported format");
+			BKE_reportf(op->reports, RPT_ERROR, "Cannot read image '%s': %s",
+			            path, errno ? strerror(errno) : TIP_("unsupported format"));
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -250,7 +353,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 		ima = (Image *)BKE_libblock_find_name(ID_IM, name);
 
 		if (!ima) {
-			BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name);
+			BKE_reportf(op->reports, RPT_ERROR, "Image '%s' not found", name);
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -283,6 +386,9 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 	node->id = (ID *)ima;
 	id_us_plus(node->id);
 
+	BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
+
 	snode_notify(C, snode);
 	snode_dag_update(C, snode);
 
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 379e998..72461cf 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -101,7 +101,7 @@ void ED_node_changed_update(ID *id, bNode *node)
 			nodeUpdateID(nodetree, node->id);
 
 		WM_main_add_notifier(NC_SCENE | ND_NODES, id);
-	}			
+	}
 	else if (treetype == NTREE_TEXTURE) {
 		DAG_id_tag_update(id, 0);
 		WM_main_add_notifier(NC_TEXTURE | ND_NODES, id);
@@ -391,7 +391,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 	node->totr.xmin = locx;
 	node->totr.xmax = locx + node->width;
 	node->totr.ymax = locy;
-	node->totr.ymin = minf(dy, locy - 2 * NODE_DY);
+	node->totr.ymin = min_ff(dy, locy - 2 * NODE_DY);
 	
 	/* Set the block bounds to clip mouse events from underlying nodes.
 	 * Add a margin for sockets on each side.
@@ -506,25 +506,16 @@ int node_get_colorid(bNode *node)
 /* note: in node_edit.c is similar code, for untangle node */
 static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 {
-	ListBase links;
 	bNodeLink *link;
 
-	if (node->typeinfo->internal_connect == NULL)
-		return;
-
-	/* Get default muting links. */
-	links = node->typeinfo->internal_connect(snode->edittree, node);
-
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
 
-	for (link = links.first; link; link = link->next)
+	for (link = node->internal_links.first; link; link = link->next)
 		node_draw_link_bezier(v2d, snode, link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE);
 
 	glDisable(GL_BLEND);
 	glDisable(GL_LINE_SMOOTH);
-
-	BLI_freelistN(&links);
 }
 
 /* this might have some more generic use */
@@ -668,7 +659,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	bNodeSocket *sock;
 	rctf *rct = &node->totr;
 	float iconofs;
-	/* float socket_size= NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
+	/* float socket_size = NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
 	float iconbutw = 0.8f * UI_UNIT_X;
 	int color_id = node_get_colorid(node);
 	char showname[128]; /* 128 used below */
@@ -852,7 +843,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 	rctf *rct = &node->totr;
 	float dx, centy = BLI_rctf_cent_y(rct);
 	float hiddenrad = BLI_rctf_size_y(rct) / 2.0f;
-	float socket_size = NODE_SOCKSIZE * U.dpi / 72;
+	float socket_size = NODE_SOCKSIZE * UI_DPI_ICON_FAC;
 	int color_id = node_get_colorid(node);
 	char showname[128]; /* 128 is used below */
 	
@@ -915,7 +906,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 	
 	/* disable lines */
 	if (node->flag & NODE_MUTED)
-		node_draw_mute_line(&ar->v2d, snode, node);	
+		node_draw_mute_line(&ar->v2d, snode, node);
 	
 	if (node->flag & SELECT) 
 		UI_ThemeColor(TH_SELECT);
@@ -932,7 +923,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 		         (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
 		         (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY,
 		         NULL, 0, 0, 0, 0, "");
-	}	
+	}
 
 	/* scale widget thing */
 	UI_ThemeColorShade(color_id, -10);
@@ -1108,7 +1099,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 	/* aspect+font, set each time */
 	snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx;
 	snode->aspect_sqrt = sqrtf(snode->aspect);
-	// XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
+	// XXX snode->curfont = uiSetCurFont_ext(snode->aspect);
 
 	/* grid */
 	UI_view2d_multi_grid_draw(v2d, 25.0f, 5, 2);
@@ -1138,7 +1129,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 #ifdef WITH_COMPOSITOR
 		if (snode->nodetree->type == NTREE_COMPOSIT) {
 			COM_startReadHighlights();
-		} 
+		}
 #endif
 
 		node_draw_nodetree(C, ar, snode, snode->nodetree);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 64a8d96..f757345 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -35,6 +35,7 @@
 #include "DNA_material_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
+#include "DNA_text_types.h"
 #include "DNA_world_types.h"
 
 #include "BLI_math.h"
@@ -54,6 +55,7 @@
 #include "BKE_scene.h"
 #include "BKE_texture.h"
 
+#include "RE_engine.h"
 #include "RE_pipeline.h"
 
 
@@ -84,6 +86,7 @@ typedef struct CompoJob {
 	short *stop;
 	short *do_update;
 	float *progress;
+	short need_sync;
 } CompoJob;
 
 /* called by compo, only to check job 'stop' value */
@@ -100,8 +103,17 @@ static int compo_breakjob(void *cjv)
 	        );
 }
 
+/* called by compo, wmJob sends notifier, old compositor system only */
+static void compo_statsdrawjob(void *cjv, char *UNUSED(str))
+{
+	CompoJob *cj = cjv;
+	
+	*(cj->do_update) = TRUE;
+	cj->need_sync = TRUE;
+}
+
 /* called by compo, wmJob sends notifier */
-static void compo_redrawjob(void *cjv, char *UNUSED(str))
+static void compo_redrawjob(void *cjv)
 {
 	CompoJob *cj = cjv;
 	
@@ -131,8 +143,15 @@ static void compo_initjob(void *cjv)
 static void compo_updatejob(void *cjv)
 {
 	CompoJob *cj = cjv;
-	
-	ntreeLocalSync(cj->localtree, cj->ntree);
+
+	if (cj->need_sync) {
+		/* was used by old compositor system only */
+		ntreeLocalSync(cj->localtree, cj->ntree);
+
+		cj->need_sync = FALSE;
+	}
+
+	WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
 }
 
 static void compo_progressjob(void *cjv, float progress)
@@ -159,11 +178,13 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
 
 	ntree->test_break = compo_breakjob;
 	ntree->tbh = cj;
-	ntree->stats_draw = compo_redrawjob;
+	ntree->stats_draw = compo_statsdrawjob;
 	ntree->sdh = cj;
 	ntree->progress = compo_progressjob;
 	ntree->prh = cj;
-	
+	ntree->update_draw = compo_redrawjob;
+	ntree->udh = cj;
+
 	// XXX BIF_store_spare();
 	
 	ntreeCompositExecTree(ntree, &cj->scene->r, 0, 1, &scene->view_settings, &scene->display_settings);  /* 1 is do_previews */
@@ -175,7 +196,7 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
 }
 
 /**
- * \param sa_owner is the owner of the job,
+ * \param scene_owner is the owner of the job,
  * we don't use it for anything else currently so could also be a void pointer,
  * but for now keep it an 'Scene' for consistency.
  *
@@ -1622,7 +1643,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
 
 	for (node = snode->edittree->nodes.first; node; node = node->next) {
 		/* Only allow muting of nodes having a mute func! */
-		if ((node->flag & SELECT) && node->typeinfo->internal_connect) {
+		if ((node->flag & SELECT) && node->typeinfo->update_internal_links) {
 			node->flag ^= NODE_MUTED;
 			snode_update(snode, node);
 		}
@@ -1935,7 +1956,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	bNodeTree *ntree = snode->edittree;
 	bNode *gnode = node_tree_get_editgroup(snode->nodetree);
 	float gnode_x = 0.0f, gnode_y = 0.0f;
-	bNode *node, *new_node;
+	bNode *node;
 	bNodeLink *link, *newlink;
 
 	ED_preview_kill_jobs(C);
@@ -1950,6 +1971,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	for (node = ntree->nodes.first; node; node = node->next) {
 		if (node->flag & SELECT) {
+			bNode *new_node;
 			new_node = nodeCopyNode(NULL, node);
 			BKE_node_clipboard_add_node(new_node);
 		}
@@ -1971,7 +1993,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
 			}
 
 			/* transform to basic view space. child node location is relative to parent */
-			if (!new_node->parent) {	
+			if (!new_node->parent) {
 				new_node->locx += gnode_x;
 				new_node->locy += gnode_y;
 			}
@@ -2136,3 +2158,120 @@ void NODE_OT_clipboard_paste(wmOperatorType *ot)
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
+
+/* ********************** Shader Script Update ******************/
+
+typedef struct ScriptUpdateData {
+	RenderEngine *engine;
+	RenderEngineType *type;
+
+	Text *text;
+	int found;
+} ScriptUpdateData;
+
+static int node_shader_script_update_poll(bContext *C)
+{
+	Scene *scene = CTX_data_scene(C);
+	RenderEngineType *type = RE_engines_find(scene->r.engine);
+	bNode *node;
+	Text *text;
+
+	/* test if we have a render engine that supports shaders scripts */
+	if (!(type && type->update_script_node))
+		return 0;
+
+	/* see if we have a shader script node in context */
+	node = CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript).data;
+	if (node && node->type == SH_NODE_SCRIPT) {
+		NodeShaderScript *nss = node->storage;
+
+		if (node->id || nss->filepath[0]) {
+			return 1;
+		}
+	}
+
+	/* see if we have a text datablock in context */
+	text = CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data;
+	if (text)
+		return 1;
+
+	/* we don't check if text datablock is actually in use, too slow for poll */
+
+	return 0;
+}
+
+static void node_shader_script_update_text(void *data_, ID *UNUSED(id), bNodeTree *ntree)
+{
+	ScriptUpdateData *data = (ScriptUpdateData *)data_;
+	bNode *node;
+
+	/* update each script that is using this text datablock */
+	for (node = ntree->nodes.first; node; node = node->next) {
+		if (node->type == NODE_GROUP) {
+			node_shader_script_update_text(data_, NULL, (bNodeTree *)node->id);
+		}
+		else if (node->type == SH_NODE_SCRIPT && node->id == &data->text->id) {
+			data->type->update_script_node(data->engine, ntree, node);
+			data->found = TRUE;
+		}
+	}
+}
+
+static int node_shader_script_update_exec(bContext *C, wmOperator *op)
+{
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	ScriptUpdateData data;
+	PointerRNA nodeptr = CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript);
+
+	/* setup render engine */
+	data.type = RE_engines_find(scene->r.engine);
+	data.engine = RE_engine_create(data.type);
+	data.engine->reports = op->reports;
+	data.text = NULL;
+	data.found = FALSE;
+
+	if (nodeptr.data) {
+		/* update single node */
+		bNodeTree *ntree = nodeptr.id.data;
+		bNode *node = nodeptr.data;
+
+		data.type->update_script_node(data.engine, ntree, node);
+
+		data.found = TRUE;
+	}
+	else {
+		/* update all nodes using text datablock */
+		data.text = CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data;
+
+		if (data.text) {
+			bNodeTreeType *ntreetype = ntreeGetType(NTREE_SHADER);
+
+			if (ntreetype && ntreetype->foreach_nodetree)
+				ntreetype->foreach_nodetree(bmain, &data, node_shader_script_update_text);
+
+			if (!data.found)
+				BKE_report(op->reports, RPT_INFO, "Text not used by any node, no update done");
+		}
+	}
+
+	RE_engine_free(data.engine);
+
+	return (data.found)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+}
+
+void NODE_OT_shader_script_update(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Script Node Update";
+	ot->description = "Update shader script node with new sockets and options from the script";
+	ot->idname = "NODE_OT_shader_script_update";
+
+	/* api callbacks */
+	ot->exec = node_shader_script_update_exec;
+	ot->poll = node_shader_script_update_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index b76cc05..4dd9c89 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -29,13 +29,18 @@
  *  \ingroup spnode
  */
 
+#include <stdlib.h>
+
 #include "MEM_guardedalloc.h"
 
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_anim_types.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_rect.h"
+#include "BLI_math.h"
 
 #include "BKE_action.h"
 #include "BKE_animsys.h"
@@ -583,7 +588,7 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
 		ntreeUpdateTree(snode->nodetree);
 	}
 	else {
-		BKE_report(op->reports, RPT_WARNING, "Can't ungroup");
+		BKE_report(op->reports, RPT_WARNING, "Cannot ungroup");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -755,13 +760,13 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
 	switch (type) {
 		case NODE_GS_COPY:
 			if (!node_group_separate_selected(snode->nodetree, gnode, 1)) {
-				BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
+				BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
 				return OPERATOR_CANCELLED;
 			}
 			break;
 		case NODE_GS_MOVE:
 			if (!node_group_separate_selected(snode->nodetree, gnode, 0)) {
-				BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
+				BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
 				return OPERATOR_CANCELLED;
 			}
 			break;
@@ -865,7 +870,7 @@ static void node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min,
 		if (node == gnode)
 			continue;
 		if (node->flag & NODE_SELECT) {
-			DO_MINMAX2((&node->locx), min, max);
+			minmax_v2v2_v2(min, max, &node->locx);
 		}
 	}
 }
@@ -875,7 +880,7 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
 	bNodeTree *ngroup = (bNodeTree *)gnode->id;
 	bNodeLink *link, *linkn;
 	bNode *node, *nextn;
-	bNodeSocket *gsock;
+	bNodeSocket *gsock, *sock;
 	ListBase anim_basepaths = {NULL, NULL};
 	float min[2], max[2];
 
@@ -982,8 +987,42 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
 		}
 	}
 
+	/* auto-add interface for "solo" nodes */
+	node = ((bNodeTree *)gnode->id)->nodes.first;
+	if (node && !node->next) {
+		for (sock = node->inputs.first; sock; sock = sock->next) {
+			int skip = FALSE;
+			
+			for (link = ((bNodeTree *)gnode->id)->links.first; link; link = link->next)
+				if (link->tosock == sock)
+					skip = TRUE;
+
+			if (skip == TRUE)
+				continue;
+
+			gsock = node_group_expose_socket(ngroup, sock, SOCK_IN);
+			node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock);
+			nodeAddLink(ngroup, NULL, gsock, node, sock);
+		}
+
+		for (sock = node->outputs.first; sock; sock = sock->next) {
+			int skip = FALSE;
+			
+			for (link = ((bNodeTree *)gnode->id)->links.first; link; link = link->next)
+				if (link->fromsock == sock)
+					skip = TRUE;
+
+			if (skip == TRUE)
+				continue;
+
+			gsock = node_group_expose_socket(ngroup, sock, SOCK_OUT);
+			node_group_add_extern_socket(ntree, &gnode->outputs, SOCK_OUT, gsock);
+			nodeAddLink(ngroup, NULL, gsock, node, sock);
+		}
+	}
+
 	/* update of the group tree */
-	ngroup->update |= NTREE_UPDATE;
+	ngroup->update |= NTREE_UPDATE | NTREE_UPDATE_LINKS;
 	/* update of the tree containing the group instance node */
 	ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS;
 
@@ -1036,7 +1075,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
 	int type = RNA_enum_get(op->ptr, "type");
 
 	if (snode->edittree != snode->nodetree) {
-		BKE_report(op->reports, RPT_WARNING, "Can not add a new Group in a Group");
+		BKE_report(op->reports, RPT_WARNING, "Cannot add a new group in a group");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1049,7 +1088,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
 		}
 
 		if (gnode) {
-			BKE_report(op->reports, RPT_WARNING, "Can not add RenderLayer in a Group");
+			BKE_report(op->reports, RPT_WARNING, "Cannot add a Render Layers node in a group");
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -1062,21 +1101,21 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
 				gnode = node_group_make_from_selected(snode->nodetree);
 			}
 			else {
-				BKE_report(op->reports, RPT_WARNING, "Can not make Group");
+				BKE_report(op->reports, RPT_WARNING, "Cannot make group");
 				return OPERATOR_CANCELLED;
 			}
 			break;
 		case NODE_GM_INSERT:
 			gnode = nodeGetActive(snode->nodetree);
 			if (!gnode || gnode->type != NODE_GROUP) {
-				BKE_report(op->reports, RPT_WARNING, "No active Group node");
+				BKE_report(op->reports, RPT_WARNING, "No active group node");
 				return OPERATOR_CANCELLED;
 			}
 			if (node_group_make_test(snode->nodetree, gnode)) {
 				node_group_make_insert_selected(snode->nodetree, gnode);
 			}
 			else {
-				BKE_report(op->reports, RPT_WARNING, "Can not insert into Group");
+				BKE_report(op->reports, RPT_WARNING, "Cannot insert into group");
 				return OPERATOR_CANCELLED;
 			}
 			break;
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 5ab698c..e82917f 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -138,12 +138,6 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
 			case NODE_GROUP:
 				ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type);
 				break;
-			case NODE_FORLOOP:
-				ntemp.ngroup = ntreeAddTree("For Loop", snode->treetype, ntemp.type);
-				break;
-			case NODE_WHILELOOP:
-				ntemp.ngroup = ntreeAddTree("While Loop", snode->treetype, ntemp.type);
-				break;
 			default:
 				ntemp.ngroup = NULL;
 		}
@@ -199,15 +193,11 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
 		/* XXX hack: negative numbers used for empty group types */
 		if (node_tree_has_type(ntree->type, NODE_GROUP))
 			uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
-		if (node_tree_has_type(ntree->type, NODE_FORLOOP))
-			uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP);
-		if (node_tree_has_type(ntree->type, NODE_WHILELOOP))
-			uiItemV(layout, IFACE_("New While Loop"), 0, -NODE_WHILELOOP);
 		uiItemS(layout);
 		
 		for (ngroup = bmain->nodetree.first, event = 0; ngroup; ngroup = ngroup->id.next, ++event) {
 			/* only use group trees */
-			if (ngroup->type == ntree->type && ELEM3(ngroup->nodetype, NODE_GROUP, NODE_FORLOOP, NODE_WHILELOOP)) {
+			if (ngroup->type == ntree->type && ngroup->nodetype == NODE_GROUP) {
 				uiItemV(layout, ngroup->id.name + 2, 0, event);
 			}
 		}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 36ebddc..45509e0 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -206,6 +206,8 @@ void NODE_OT_output_file_move_active_socket(struct wmOperatorType *ot);
 void NODE_OT_clipboard_copy(struct wmOperatorType *ot);
 void NODE_OT_clipboard_paste(struct wmOperatorType *ot);
 
+void NODE_OT_shader_script_update(struct wmOperatorType *ot);
+
 extern const char *node_context_dir[];
 
 // XXXXXX
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 560ef9e..64e5f67 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -117,6 +117,8 @@ void node_operatortypes(void)
 	
 	WM_operatortype_append(NODE_OT_clipboard_copy);
 	WM_operatortype_append(NODE_OT_clipboard_paste);
+	
+	WM_operatortype_append(NODE_OT_shader_script_update);
 }
 
 void ED_operatormacros_node(void)
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index fec7366..7fa48c4 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -136,7 +136,7 @@ static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, in
 	int a = 0;
 
 	for (sock = node->inputs.first; sock; sock = sock->next) {
-		maxtype = MAX2(sock->type, maxtype);
+		maxtype = max_ii(sock->type, maxtype);
 	}
 
 	/* find sockets of higher 'types' first (i.e. image) */
@@ -1368,7 +1368,7 @@ static bNodeSocket *socket_best_match(ListBase *sockets)
 
 	/* find type range */
 	for (sock = sockets->first; sock; sock = sock->next)
-		maxtype = MAX2(sock->type, maxtype);
+		maxtype = max_ii(sock->type, maxtype);
 
 	/* try all types, starting from 'highest' (i.e. colors, vectors, values) */
 	for (type = maxtype; type >= 0; --type) {
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index b0916a5..a3efa15 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -593,7 +593,7 @@ static int node_lasso_select_exec(bContext *C, wmOperator *op)
 		select = !RNA_boolean_get(op->ptr, "deselect");
 		do_lasso_select_node(C, mcords, mcords_tot, select);
 
-		MEM_freeN(mcords);
+		MEM_freeN((void *)mcords);
 
 		return OPERATOR_FINISHED;
 	}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 3d93a6c..23f4e94 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -122,6 +122,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to
 		return;
 
 	nodeRemLink(ntree, sock_to->link);
+	sock_to->flag |= SOCK_COLLAPSED;
 
 	nodeUpdate(ntree, node_to);
 	ntreeUpdateTree(ntree);
@@ -136,6 +137,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN
 		return;
 
 	node_remove_linked(ntree, sock_to->link->fromnode);
+	sock_to->flag |= SOCK_COLLAPSED;
 
 	nodeUpdate(ntree, node_to);
 	ntreeUpdateTree(ntree);
@@ -147,7 +149,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN
 static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to, bNodeTemplate *ntemp, int sock_num)
 {
 	bNode *node_from;
-	bNodeSocket *sock_from;
+	bNodeSocket *sock_from_tmp;
 	bNode *node_prev = NULL;
 
 	/* unlink existing node */
@@ -183,8 +185,9 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
 	nodeSetActive(ntree, node_from);
 
 	/* add link */
-	sock_from = BLI_findlink(&node_from->outputs, sock_num);
-	nodeAddLink(ntree, node_from, sock_from, node_to, sock_to);
+	sock_from_tmp = BLI_findlink(&node_from->outputs, sock_num);
+	nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to);
+	sock_to->flag &= ~SOCK_COLLAPSED;
 
 	/* copy input sockets from previous node */
 	if (node_prev && node_from != node_prev) {
@@ -289,8 +292,7 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
 			BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);
 
 		if (node->inputs.first == NULL &&
-		    node->outputs.first != node->outputs.last &&
-		    !(node->typeinfo->flag & NODE_OPTIONS))
+		    node->outputs.first != node->outputs.last)
 		{
 			BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", IFACE_(node_name), IFACE_(sock->link->fromsock->name));
 		}
@@ -613,7 +615,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 		/* input linked to a node */
 		uiTemplateNodeLink(split, ntree, node, input);
 
-		if (!(input->flag & SOCK_COLLAPSED)) {
+		if (depth == 0 || !(input->flag & SOCK_COLLAPSED)) {
 			if (depth == 0)
 				uiItemS(layout);
 
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index ccf5c4b..f386657 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -241,7 +241,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 
 	if (ibuf == NULL) {
-		BKE_image_release_ibuf(ima, lock);
+		BKE_image_release_ibuf(ima, ibuf, lock);
 		return OPERATOR_CANCELLED;
 	}
 
@@ -255,7 +255,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	nvm->ymin = -(ar->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
 	nvm->ymax =  (ar->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
@@ -330,6 +330,12 @@ typedef struct ImageSampleInfo {
 
 	unsigned char col[4];
 	float colf[4];
+	
+	int z;
+	float zf;
+
+	int *zp;
+	float *zfp;
 
 	int draw;
 	int color_manage;
@@ -343,8 +349,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
 	if (info->draw) {
 		ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels,
 		                   info->x, info->y, info->col, info->colf,
-		                   NULL, NULL /* zbuf - unused for nodes */
-		                   );
+		                   info->zp, info->zfp);
 	}
 }
 
@@ -398,7 +403,7 @@ int ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float
 		}
 	}
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 
 	return ret;
 }
@@ -443,6 +448,9 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 		info->draw = 1;
 		info->channels = ibuf->channels;
 
+		info->zp = NULL;
+		info->zfp = NULL;
+
 		if (ibuf->rect) {
 			cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
 
@@ -468,6 +476,15 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 
 			info->color_manage = TRUE;
 		}
+		
+		if (ibuf->zbuf) {
+			info->z = ibuf->zbuf[y * ibuf->x + x];
+			info->zp = &info->z;
+		}
+		if (ibuf->zbuf_float) {
+			info->zf = ibuf->zbuf_float[y * ibuf->x + x];
+			info->zfp = &info->zf;
+		}
 
 		ED_node_sample_set(info->colf);
 	}
@@ -476,7 +493,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 		ED_node_sample_set(NULL);
 	}
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 
 	ED_area_tag_redraw(CTX_wm_area(C));
 }
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index b70d66f..f7e0d51 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -111,7 +111,6 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
 	BLI_addtail(&snode->regionbase, ar);
 	ar->regiontype = RGN_TYPE_UI;
 	ar->alignment = RGN_ALIGN_RIGHT;
-	ar->flag = RGN_FLAG_HIDDEN;
 
 	/* main area */
 	ar = MEM_callocN(sizeof(ARegion), "main area for node");
@@ -194,6 +193,8 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
 					ED_area_tag_refresh(sa);
 				else if (wmn->data == ND_SHADING_DRAW)
 					ED_area_tag_refresh(sa);
+				else if (wmn->data == ND_SHADING_LINKS)
+					ED_area_tag_refresh(sa);
 				else if (wmn->action == NA_ADDED && snode->edittree)
 					nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
 
@@ -254,6 +255,15 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
 				}
 			}
 			break;
+
+		case NC_MOVIECLIP:
+			if (wmn->action == NA_EDITED) {
+				if (type == NTREE_COMPOSIT) {
+					if (nodeUpdateID(snode->nodetree, wmn->reference))
+						ED_area_tag_refresh(sa);
+				}
+			}
+			break;
 	}
 }
 
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index d2e4742..d37cb4b 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -36,6 +36,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
 
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -92,7 +93,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
 {
 	TreeElement *te = lb->first;
 	while (te) {
-//		TreeStoreElem *tselem= TREESTORE(te);
+//		TreeStoreElem *tselem = TREESTORE(te);
 		
 		// XXX fixme... te->xend is not set yet
 		if (!TSELEM_OPEN(tselem, soops)) {
@@ -238,9 +239,9 @@ static int group_select_flag(Group *gr)
 
 void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
 {	
-	Scene *scene = (Scene *)poin;		
+	Scene *scene = (Scene *)poin;
 	GroupObject *gob;
-	Group *gr = (Group *)poin2; 	
+	Group *gr = (Group *)poin2;
 
 	if (group_restrict_flag(gr, flag)) {
 		for (gob = gr->gobject.first; gob; gob = gob->next) {
@@ -309,7 +310,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
 					WM_event_add_notifier(C, NC_SCENE, NULL); break;
 				default:
 					WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break;
-			}					
+			}
 			/* Check the library target exists */
 			if (te->idcode == ID_LI) {
 				Library *lib = (Library *)tselem->id;
@@ -627,16 +628,16 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
 	search[0] = 0;
 	
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU);
 	
 	/* fake button, it holds space for search items */
-	uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+	uiDefBut(block, LABEL, 0, "", 10, 15, uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
 	
 	but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, "");
 	uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot);
 	
 	uiBoundsBlock(block, 6);
-	uiBlockSetDirection(block, UI_DOWN);	
+	uiBlockSetDirection(block, UI_DOWN);
 	uiEndBlock(C, block);
 	
 	event = *(win->eventstate);  /* XXX huh huh? make api call */
@@ -1000,6 +1001,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 					case eModifierType_Bevel:
 						UI_icon_draw(x, y, ICON_MOD_BEVEL); break;
 					case eModifierType_Smooth:
+					case eModifierType_LaplacianSmooth:
 						UI_icon_draw(x, y, ICON_MOD_SMOOTH); break;
 					case eModifierType_SimpleDeform:
 						UI_icon_draw(x, y, ICON_MOD_SIMPLEDEFORM); break;
@@ -1036,11 +1038,13 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 						UI_icon_draw(x, y, ICON_MOD_WARP); break;
 					case eModifierType_Skin:
 						UI_icon_draw(x, y, ICON_MOD_SKIN); break;
+					case eModifierType_Triangulate:
+						UI_icon_draw(x, y, ICON_MOD_TRIANGULATE); break;
 
 					/* Default */
 					case eModifierType_None:
 					case eModifierType_ShapeKey:
-			        case NUM_MODIFIER_TYPES:
+					case NUM_MODIFIER_TYPES:
 						UI_icon_draw(x, y, ICON_DOT); break;
 				}
 				break;
@@ -1251,7 +1255,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i
 	
 	for (ten = te->subtree.first; ten; ten = ten->next) {
 		outliner_set_coord_tree_element(soops, ten, startx + UI_UNIT_X, starty);
-	}	
+	}
 }
 
 
@@ -1396,7 +1400,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 				UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT);
 			glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
 			offsx += UI_UNIT_X;
-		}		
+		}
 		glDisable(GL_BLEND);
 		
 		/* name */
@@ -1433,7 +1437,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 				}
 			}
 		}
-	}	
+	}
 	/* store coord and continue, we need coordinates for elements outside view too */
 	te->xs = (float)startx;
 	te->ys = (float)*starty;
@@ -1444,7 +1448,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		
 		for (ten = te->subtree.first; ten; ten = ten->next)
 			outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx + UI_UNIT_X, starty);
-	}	
+	}
 	else {
 		for (ten = te->subtree.first; ten; ten = ten->next)
 			outliner_set_coord_tree_element(soops, te, startx, starty);
@@ -1648,7 +1652,7 @@ void draw_outliner(const bContext *C)
 		 
 		/* get actual width of column 1 */
 		outliner_rna_width(soops, &soops->tree, &sizex_rna, 0);
-		sizex_rna = MAX2(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX);
+		sizex_rna = max_ii(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX);
 		
 		/* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */
 		if (soops->outlinevis == SO_KEYMAP) 
@@ -1701,7 +1705,7 @@ void draw_outliner(const bContext *C)
 	}
 
 	/* draw edit buttons if nessecery */
-	outliner_buttons(C, block, ar, soops, &soops->tree);	
+	outliner_buttons(C, block, ar, soops, &soops->tree);
 
 	uiEndBlock(C, block);
 	uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 2ec2309..d11a8ed 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -81,7 +81,7 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te)
 	
 	for (te = te->parent; te; te = te->parent) {
 		tselem = TREESTORE(te);
-		if (tselem->flag & TSE_CLOSED) { 
+		if (tselem->flag & TSE_CLOSED) {
 			tselem->flag &= ~TSE_CLOSED;
 			retval = 1;
 		}
@@ -197,10 +197,10 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem,
 	}
 	else if (tselem->id->lib) {
 		// XXX						error_libdata();
-	} 
+	}
 	else if (te->idcode == ID_LI && te->parent) {
 		BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
-	} 
+	}
 	else {
 		tselem->flag |= TSE_TEXTBUT;
 		ED_region_tag_redraw(ar);
@@ -368,12 +368,14 @@ void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *
 
 static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
 {
+	Main *bmain = CTX_data_main(C);
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 	Scene *scene = CTX_data_scene(C);
 	ARegion *ar = CTX_wm_region(C);
 	
 	outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
 	
+	DAG_id_type_tag(bmain, ID_OB);
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene);
 	ED_region_tag_redraw(ar);
 	
@@ -464,11 +466,13 @@ void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
 
 static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
 {
+	Main *bmain = CTX_data_main(C);
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 	Scene *scene = CTX_data_scene(C);
 	
 	outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
 	
+	DAG_id_type_tag(bmain, ID_OB);
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene);
 	
 	return OPERATOR_FINISHED;
@@ -726,7 +730,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
 	
 	/* determine which type of search to do */
 	if (again && last_find) {
-		/* no popup panel - previous + user wanted to search for next after previous */		
+		/* no popup panel - previous + user wanted to search for next after previous */
 		BLI_strncpy(name, soops->search_string, sizeof(name));
 		flags = soops->search_flags;
 		
@@ -742,7 +746,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
 		/* pop up panel - no previous, or user didn't want search after previous */
 		name[0] = '\0';
 // XXX		if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) {
-//			te= outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound);
+//			te = outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound);
 //		}
 //		else return; /* XXX RETURN! XXX */
 	}
@@ -782,7 +786,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
 	}
 	else {
 		/* no tree-element found */
-		BKE_report(reports, RPT_WARNING, "Not found: %s", name);
+		BKE_reportf(reports, RPT_WARNING, "Not found: %s", name);
 	}
 }
 #endif
@@ -832,6 +836,8 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
 
 void OUTLINER_OT_show_one_level(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name = "Show/Hide One Level";
 	ot->idname = "OUTLINER_OT_show_one_level";
@@ -844,7 +850,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
 	/* no undo or registry, UI option */
 	
 	/* properties */
-	RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep");
+	prop = RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /* Show Hierarchy ----------------------------------------------- */
@@ -994,7 +1001,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 					char buf[128], *name;
 					
 					temnext = (TreeElement *)(ld->next->data);
-					/* tsenext= TREESTORE(temnext); */ /* UNUSED */
+					/* tsenext = TREESTORE(temnext); */ /* UNUSED */
 					
 					nextptr = &temnext->rnaptr;
 					name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
@@ -1340,7 +1347,7 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
 	
 	/* check for invalid states */
 	if (ks == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Keying Set");
+		BKE_report(op->reports, RPT_ERROR, "Operation requires an active keying set");
 		return OPERATOR_CANCELLED;
 	}
 	if (soutliner == NULL)
@@ -1854,8 +1861,8 @@ static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		assign_material(ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
 
 		DAG_ids_flush_update(bmain, 0);
-		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));		
-		WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma);
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+		WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
 
 		return OPERATOR_FINISHED;
 	}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 823de61..0b585e1 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -222,7 +222,7 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
 		}
 	}
 	if (set) {
-		WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
+		WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
 	}
 	return 0;
 }
@@ -236,7 +236,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 	
 	if (ob == NULL) return 0;  // no active object
 	
-	/*tselem= TREESTORE(te);*/ /*UNUSED*/
+	/*tselem = TREESTORE(te);*/ /*UNUSED*/
 	
 	/* find buttons area (note, this is undefined really still, needs recode in blender) */
 	/* XXX removed finding sbuts */
@@ -250,8 +250,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 
 		if (set) {
 			if (sbuts) {
-				// XXX sbuts->tabo= TAB_SHADING_TEX;	// hack from header_buttonswin.c
-				// XXX sbuts->texfrom= 1;
+				// XXX sbuts->tabo = TAB_SHADING_TEX;	// hack from header_buttonswin.c
+				// XXX sbuts->texfrom = 1;
 			}
 // XXX			extern_set_butspace(F6KEY, 0);	// force shading buttons texture
 			wrld->texact = te->index;
@@ -264,8 +264,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 		Lamp *la = (Lamp *)tselemp->id;
 		if (set) {
 			if (sbuts) {
-				// XXX sbuts->tabo= TAB_SHADING_TEX;	// hack from header_buttonswin.c
-				// XXX sbuts->texfrom= 2;
+				// XXX sbuts->tabo = TAB_SHADING_TEX;	// hack from header_buttonswin.c
+				// XXX sbuts->texfrom = 2;
 			}
 // XXX			extern_set_butspace(F6KEY, 0);	// force shading buttons texture
 			la->texact = te->index;
@@ -280,8 +280,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 		Material *ma = (Material *)tselemp->id;
 		if (set) {
 			if (sbuts) {
-				//sbuts->tabo= TAB_SHADING_TEX;	// hack from header_buttonswin.c
-				// XXX sbuts->texfrom= 0;
+				//sbuts->tabo = TAB_SHADING_TEX;	// hack from header_buttonswin.c
+				// XXX sbuts->texfrom = 0;
 			}
 // XXX			extern_set_butspace(F6KEY, 0);	// force shading buttons texture
 			ma->texact = (char)te->index;
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 09df1d5..3b83279 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -158,11 +158,16 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl
 		totcol = mb->totcol;
 		matar = mb->mat;
 	}
+	else {
+		BLI_assert(0);
+	}
 
-	for (a = 0; a < totcol; a++) {
-		if (a == te->index && matar[a]) {
-			matar[a]->id.us--;
-			matar[a] = NULL;
+	if (LIKELY(matar != NULL)) {
+		for (a = 0; a < totcol; a++) {
+			if (a == te->index && matar[a]) {
+				matar[a]->id.us--;
+				matar[a] = NULL;
+			}
 		}
 	}
 }
@@ -811,7 +816,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
 					ED_undo_push(C, "Unlink world");
 					break;
 				default:
-					BKE_report(op->reports, RPT_WARNING, "Not Yet");
+					BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
 					break;
 			}
 		}
@@ -844,7 +849,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
 					break;
 					
 				default:
-					BKE_report(op->reports, RPT_WARNING, "Not Yet");
+					BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
 					break;
 			}
 		}
@@ -974,15 +979,15 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
 	act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
 	
 	if (act == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
+		BKE_report(op->reports, RPT_ERROR, "No valid action to add");
 		return OPERATOR_CANCELLED;
 	}
 	else if (act->idroot == 0) {
 		/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
 		BKE_reportf(op->reports, RPT_WARNING,
-		            "Action '%s' does not specify what datablocks it can be used on. "
-		            "Try setting the 'ID Root Type' setting from the Datablocks Editor "
-		            "for this Action to avoid future problems",
+		            "Action '%s' does not specify what datablocks it can be used on "
+		            "(try setting the 'ID Root Type' setting from the Datablocks Editor "
+		            "for this action to avoid future problems)",
 		            act->id.name + 2);
 	}
 	
@@ -1202,6 +1207,7 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
 			break;
 			
 		default:
+			BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
 			break;
 	}
 	
@@ -1274,12 +1280,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
 			else {
 				if (datalevel == TSE_ANIM_DATA)
 					WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL);
-				else if (datalevel == TSE_DRIVER_BASE)
-					/* do nothing... no special ops needed yet */;
-				else if (ELEM3(datalevel, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS))
-					/*WM_operator_name_call(C, "OUTLINER_OT_renderdata_operation", WM_OP_INVOKE_REGION_WIN, NULL)*/;
-				else
+				else if (datalevel == TSE_DRIVER_BASE) {
+					/* do nothing... no special ops needed yet */
+				}
+				else if (ELEM3(datalevel, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS)) {
+					/*WM_operator_name_call(C, "OUTLINER_OT_renderdata_operation", WM_OP_INVOKE_REGION_WIN, NULL)*/
+				}
+				else {
 					WM_operator_name_call(C, "OUTLINER_OT_data_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+				}
 			}
 		}
 		
@@ -1301,11 +1310,13 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 	TreeElement *te;
 	float fmval[2];
-	
+
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
 	
 	for (te = soops->tree.first; te; te = te->next) {
-		if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
+		if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) {
+			break;
+		}
 	}
 	
 	return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index ef05421..e691028 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -133,7 +133,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
 }
 
 /* XXX - THIS FUNCTION IS INCREDIBLY SLOW
- * ... it can bring blenders tools and viewport to a grinding halt becuase of searching
+ * ... it can bring blenders tools and viewport to a grinding halt because of searching
  * for duplicate items every times they are added.
  *
  * TODO (possible speedups)
@@ -553,16 +553,16 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 			
 			if (md->type == eModifierType_Lattice) {
 				outliner_add_element(soops, &te->subtree, ((LatticeModifierData *) md)->object, te, TSE_LINKED_OB, 0);
-			} 
+			}
 			else if (md->type == eModifierType_Curve) {
 				outliner_add_element(soops, &te->subtree, ((CurveModifierData *) md)->object, te, TSE_LINKED_OB, 0);
-			} 
+			}
 			else if (md->type == eModifierType_Armature) {
 				outliner_add_element(soops, &te->subtree, ((ArmatureModifierData *) md)->object, te, TSE_LINKED_OB, 0);
-			} 
+			}
 			else if (md->type == eModifierType_Hook) {
 				outliner_add_element(soops, &te->subtree, ((HookModifierData *) md)->object, te, TSE_LINKED_OB, 0);
-			} 
+			}
 			else if (md->type == eModifierType_ParticleSystem) {
 				TreeElement *ten;
 				ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys;
@@ -590,7 +590,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 	
 	/* duplicated group */
 	if (ob->dup_group)
-		outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);	
+		outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
 }
 
 // can be inlined if necessary
@@ -731,7 +731,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 		case ID_AC:
 		{
 			// XXX do we want to be exposing the F-Curves here?
-			//bAction *act= (bAction *)id;
+			//bAction *act = (bAction *)id;
 		}
 		break;
 		case ID_AR:
@@ -1148,7 +1148,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
 		}
 
 		if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
-			/* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
+			/* ch = */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
 		p = p->next;
 	}
 }
@@ -1531,7 +1531,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 		while (seq) {
 			op = need_add_seq_dup(seq);
 			if (op == 1) {
-				/* ten= */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
+				/* ten = */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
 			}
 			else if (op == 0) {
 				ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
@@ -1569,7 +1569,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 		wmKeyMap *km;
 		
 		for (km = wm->defaultconf->keymaps.first; km; km = km->next) {
-			/* ten= */ outliner_add_element(soops, &soops->tree, (void *)km, NULL, TSE_KEYMAP, 0);
+			/* ten = */ outliner_add_element(soops, &soops->tree, (void *)km, NULL, TSE_KEYMAP, 0);
 		}
 	}
 	else {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 6cfc3f9..ecc09a3 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -326,19 +326,14 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			break;
 		case NC_MATERIAL:
 			switch (wmn->data) {
-				case ND_SHADING:
-				case ND_SHADING_DRAW:
+				case ND_SHADING_LINKS:
 					ED_region_tag_redraw(ar);
 					break;
 			}
 			break;
-		case NC_TEXTURE:
-			ED_region_tag_redraw(ar);
-			break;
 		case NC_GEOM:
 			switch (wmn->data) {
-				case ND_DATA:
-					/* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */
+				case ND_VERTEX_GROUP:
 					ED_region_tag_redraw(ar);
 					break;
 			}
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index c1f7fc9..f108d9f 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -57,4 +57,8 @@ if(WITH_AUDASPACE)
 	add_definitions(-DWITH_AUDASPACE)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript
index ec06eac..bc72786 100644
--- a/source/blender/editors/space_sequencer/SConscript
+++ b/source/blender/editors/space_sequencer/SConscript
@@ -3,12 +3,17 @@ Import ('env')
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../blenfont ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../makesrna ../../blenloader ../../blenfont'
 incs += ' #/intern/audaspace/intern'
 
+defs = []
+
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
-env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core'], priority=[100] )
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), defs, libtype=['core'], priority=[100] )
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index ff895c0..8155f9d 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -325,7 +325,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
 	clip = BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip"));
 	
 	if (clip == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "MovieClip not found");
+		BKE_report(op->reports, RPT_ERROR, "Movie clip not found");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -553,7 +553,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
 	}
 
 	if (seq_load.tot_success == 0) {
-		BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path);
+		BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", seq_load.path);
 		return OPERATOR_CANCELLED;
 	}
 
@@ -719,7 +719,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 			seq->endstill = seq_load.end_frame - seq_load.start_frame;
 		}
 	}
-	
+
+	BKE_sequence_init_colorspace(seq);
+
 	BKE_sequence_calc_disp(scene, seq);
 
 	BKE_sequencer_sort(scene);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7bec530..1a84efa 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -285,8 +285,8 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
 		drawmeta_stipple(1);
 
 	for (seq = seqm->seqbase.first; seq; seq = seq->next) {
-		chan_min = MIN2(chan_min, seq->machine);
-		chan_max = MAX2(chan_max, seq->machine);
+		chan_min = min_ii(chan_min, seq->machine);
+		chan_max = max_ii(chan_max, seq->machine);
 	}
 
 	chan_range = (chan_max - chan_min) + 1;
@@ -355,7 +355,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
 	y2 = seq->machine + SEQ_STRIP_OFSTOP;
 
 	/* set up co-ordinates/dimensions for either left or right handle */
-	if (direction == SEQ_LEFTHANDLE) {	
+	if (direction == SEQ_LEFTHANDLE) {
 		rx1 = x1;
 		rx2 = x1 + handsize_clamped * 0.75f;
 		
@@ -415,7 +415,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
 			y1 = y2 + 0.05f;
 		}
 		UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
-	}	
+	}
 }
 
 static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
@@ -810,7 +810,7 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val)
 
 	/* if mouse over a sequence && LEFTMOUSE */
 	if (val) {
-// XXX		special_seq_update= find_nearest_seq(&x);
+// XXX		special_seq_update = find_nearest_seq(&x);
 	}
 	else special_seq_update = NULL;
 }
@@ -822,6 +822,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
 	int rectx, recty;
 	float render_size = 0.0;
 	float proxy_size = 100.0;
+	short is_break = G.is_break;
 
 	render_size = sseq->render_size;
 	if (render_size == 0) {
@@ -840,6 +841,11 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
 
 	context = BKE_sequencer_new_render_data(bmain, scene, rectx, recty, proxy_size);
 
+	/* sequencer could start rendering, in this case we need to be sure it wouldn't be canceled
+	 * by Esc pressed somewhere in the past
+	 */
+	G.is_break = FALSE;
+
 	if (special_seq_update)
 		ibuf = BKE_sequencer_give_ibuf_direct(context, cfra + frame_ofs, special_seq_update);
 	else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
@@ -847,6 +853,9 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
 	else
 		ibuf = BKE_sequencer_give_ibuf_threaded(context, cfra + frame_ofs, sseq->chanshown);
 
+	/* restore state so real rendering would be canceled (if needed) */
+	G.is_break = is_break;
+
 	return ibuf;
 }
 
@@ -913,6 +922,13 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 	unsigned char *display_buffer;
 	void *cache_handle = NULL;
 
+	if (G.is_rendering == FALSE) {
+		/* stop all running jobs, except screen one. currently previews frustrate Render
+		 * needed to make so sequencer's rendering doesn't conflict with compositor
+		 */
+		WM_jobs_kill_type(CTX_wm_manager(C), WM_JOB_TYPE_COMPOSITE);
+	}
+
 	render_size = sseq->render_size;
 	if (render_size == 0) {
 		render_size = scene->r.size;
@@ -1189,7 +1205,7 @@ static void draw_seq_backdrop(View2D *v2d)
 	glRectf(v2d->cur.xmin,  -1.0,  v2d->cur.xmax,  1.0);
 
 	/* Alternating horizontal stripes */
-	i = maxi(1, ((int)v2d->cur.ymin) - 1);
+	i = max_ii(1, ((int)v2d->cur.ymin) - 1);
 
 	glBegin(GL_QUADS);
 	while (i < v2d->cur.ymax) {
@@ -1208,7 +1224,7 @@ static void draw_seq_backdrop(View2D *v2d)
 	glEnd();
 	
 	/* Darker lines separating the horizontal bands */
-	i = maxi(1, ((int)v2d->cur.ymin) - 1);
+	i = max_ii(1, ((int)v2d->cur.ymin) - 1);
 	UI_ThemeColor(TH_GRID);
 	
 	glBegin(GL_LINES);
@@ -1240,8 +1256,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
 			/* boundbox and selection tests for NOT drawing the strip... */
 			if ((seq->flag & SELECT) != sel) continue;
 			else if (seq == last_seq) continue;
-			else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
-			else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
+			else if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
+			else if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
 			else if (seq->machine + 1.0f < v2d->cur.ymin) continue;
 			else if (seq->machine > v2d->cur.ymax) continue;
 			
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 459a8d5..e7f77db 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -46,6 +46,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_threads.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_scene_types.h"
 #include "DNA_userdef_types.h"
 
@@ -507,7 +509,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
 	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
 			if (seq->type == SEQ_TYPE_SOUND_RAM && BKE_sequence_effect_get_num_inputs(type) != 0) {
-				*error_str = "Can't apply effects to audio sequence strips";
+				*error_str = N_("Cannot apply effects to audio sequence strips");
 				return 0;
 			}
 			if ((seq != activeseq) && (seq != seq2)) {
@@ -515,7 +517,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
 				else if (seq1 == NULL) seq1 = seq;
 				else if (seq3 == NULL) seq3 = seq;
 				else {
-					*error_str = "Can't apply effect to more than 3 sequence strips";
+					*error_str = N_("Cannot apply effect to more than 3 sequence strips");
 					return 0;
 				}
 			}
@@ -537,21 +539,21 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
 			return 1; /* succsess */
 		case 1:
 			if (seq2 == NULL) {
-				*error_str = "Need at least one selected sequence strip";
+				*error_str = N_("At least one selected sequence strip is needed");
 				return 0;
 			}
 			if (seq1 == NULL) seq1 = seq2;
 			if (seq3 == NULL) seq3 = seq2;
 		case 2:
 			if (seq1 == NULL || seq2 == NULL) {
-				*error_str = "Need 2 selected sequence strips";
+				*error_str = N_("2 selected sequence strips are needed");
 				return 0;
 			}
 			if (seq3 == NULL) seq3 = seq2;
 	}
 	
 	if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
-		*error_str = "TODO: in what cases does this happen?";
+		*error_str = N_("TODO: in what cases does this happen?");
 		return 0;
 	}
 	
@@ -680,7 +682,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
 		seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
 	}
 	
-	if (seqn) { 
+	if (seqn) {
 		seqn->flag |= SELECT;
 			
 		/* Second Strip! */
@@ -701,7 +703,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
 			seqn->anim_startofs += cutframe - ts.start;
 			seqn->anim_endofs = ts.anim_endofs;
 			seqn->endstill = ts.endstill;
-		}				
+		}
 		
 		/* strips with extended stillframes after */
 		else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
@@ -773,7 +775,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
 		seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
 	}
 	
-	if (seqn) { 
+	if (seqn) {
 		seqn->flag |= SELECT;
 			
 		/* Second Strip! */
@@ -791,7 +793,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
 			seqn->startofs = cutframe - ts.start;
 			seqn->endofs = ts.endofs;
 			seqn->endstill = ts.endstill;
-		}				
+		}
 		
 		/* strips with extended stillframes after */
 		else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
@@ -1056,7 +1058,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
 		{
 			if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
 				/* simple but no anim update */
-				/* seq->start= snap_frame-seq->startofs+seq->startstill; */
+				/* seq->start = snap_frame-seq->startofs+seq->startstill; */
 
 				BKE_sequence_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start);
 			}
@@ -1384,7 +1386,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
 	    seq_is_predecessor(seq2, last_seq) ||
 	    seq_is_predecessor(seq3, last_seq))
 	{
-		BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed");
+		BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: no cycles allowed");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1574,7 +1576,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
 	Scene *scene = (Scene *)arg_pt;
 	char name[sizeof(seq->name) - 2];
 
-	strcpy(name, seq->name + 2);
+	BLI_strncpy_utf8(name, seq->name + 2, sizeof(name));
 	BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
 	BKE_sequencer_dupe_animdata(scene, name, seq->name + 2);
 	return 1;
@@ -1684,7 +1686,7 @@ static int sequencer_delete_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	if (ar->regiontype == RGN_TYPE_WINDOW) {
 		/* bounding box of 30 pixels is used for markers shortcuts,
-		 * prevent conflict with markers shortcurts here
+		 * prevent conflict with markers shortcuts here
 		 */
 		if (event->mval[1] <= 30)
 			return OPERATOR_PASS_THROUGH;
@@ -1848,12 +1850,13 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
 	
 	/* api callbacks */
 	ot->exec = sequencer_separate_images_exec;
+	ot->invoke = WM_operator_props_popup;
 	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	RNA_def_int(ot->srna, "length", 1, 1, 1000, "Length", "Length of each frame", 1, INT_MAX);
+	RNA_def_int(ot->srna, "length", 1, 1, INT_MAX, "Length", "Length of each frame", 1, 1000);
 }
 
 
@@ -1952,7 +1955,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
 	while (seq) {
 		next = seq->next;
 		if (seq != seqm && (seq->flag & SELECT)) {
-			channel_max = MAX2(seq->machine, channel_max);
+			channel_max = max_ii(seq->machine, channel_max);
 			BLI_remlink(ed->seqbasep, seq);
 			BLI_addtail(&seqm->seqbase, seq);
 		}
@@ -2129,7 +2132,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
 		zoomY = ((float)height) / ((float)imgheight);
 		sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY;
 
-		sseq->zoom = 1.0f / power_of_2(1 / minf(zoomX, zoomY));
+		sseq->zoom = 1.0f / power_of_2(1 / min_ff(zoomX, zoomY));
 	}
 	else {
 		sseq->zoom = 1.0f;
@@ -2188,7 +2191,7 @@ void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot)
 	ot->poll = ED_operator_sequencer_active;
 
 	/* properties */
-	RNA_def_float(ot->srna, "ratio", 1.0f, 0.0f, FLT_MAX,
+	RNA_def_float(ot->srna, "ratio", 1.0f, -FLT_MAX, FLT_MAX,
 	              "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
 }
 
@@ -2255,11 +2258,11 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 
 	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
-			xmin = MIN2(xmin, seq->startdisp);
-			xmax = MAX2(xmax, seq->enddisp);
+			xmin = min_ii(xmin, seq->startdisp);
+			xmax = max_ii(xmax, seq->enddisp);
 
-			ymin = MIN2(ymin, seq->machine);
-			ymax = MAX2(ymax, seq->machine);
+			ymin = min_ii(ymin, seq->machine);
+			ymax = max_ii(ymax, seq->machine);
 		}
 	}
 
@@ -2402,6 +2405,15 @@ static int strip_jump_internal(Scene *scene,
 	return change;
 }
 
+static int sequencer_strip_jump_poll(bContext *C)
+{
+	/* prevent changes during render */
+	if (G.is_rendering)
+		return 0;
+
+	return sequencer_edit_poll(C);
+}
+
 /* jump frame to edit point operator */
 static int sequencer_strip_jump_exec(bContext *C, wmOperator *op)
 {
@@ -2428,7 +2440,7 @@ void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = sequencer_strip_jump_exec;
-	ot->poll = sequencer_edit_poll;
+	ot->poll = sequencer_strip_jump_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2620,7 +2632,6 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene = CTX_data_scene(C);
 	Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
-	Sequence *seq;
 
 	ListBase nseqbase = {NULL, NULL};
 
@@ -2656,8 +2667,11 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
 	seqbase_clipboard_frame = scene->r.cfra;
 
 	/* Need to remove anything that references the current scene */
-	for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
-		seq_copy_del_sound(scene, seq);
+	{
+		Sequence *seq;
+		for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
+			seq_copy_del_sound(scene, seq);
+		}
 	}
 
 	return OPERATOR_FINISHED;
@@ -2740,7 +2754,7 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
 	const char *error_msg;
 
 	if (BKE_sequencer_active_get_pair(scene, &seq_act, &seq_other) == 0) {
-		BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
+		BKE_report(op->reports, RPT_ERROR, "Please select two strips");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2903,7 +2917,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
 	}
 
 	if (*seq_1 == NULL || *seq_2 == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap");
+		BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap");
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -3040,7 +3054,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 		seq->anim_startofs = seq->anim_endofs = 0;
 
 		/* correct start/end frames so we don't move
-		 * important not to set seq->len= len; allow the function to handle it */
+		 * important not to set seq->len = len; allow the function to handle it */
 		BKE_sequence_reload_new_file(scene, seq, TRUE);
 
 		BKE_sequence_calc(scene, seq);
@@ -3071,8 +3085,12 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN
 {
 	Scene *scene = CTX_data_scene(C);
 	Sequence *seq = BKE_sequencer_active_get(scene);
+	char filepath[FILE_MAX];
+
+	BLI_join_dirfile(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name);
 
 	RNA_string_set(op->ptr, "directory", seq->strip->dir);
+	RNA_string_set(op->ptr, "filepath",  filepath);
 
 	/* set default display depending on seq type */
 	if (seq->type == SEQ_TYPE_IMAGE) {
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index be33b78..192f45a 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -353,7 +353,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		}
 		else {
 			/* deselect_markers(0, 0); */ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */
-			marker->flag |= SELECT;				
+			marker->flag |= SELECT;
 		}
 		
 	}
@@ -399,7 +399,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		}
 	}
 	else {
-		// seq= find_nearest_seq(scene, v2d, &hand, mval);
+		// seq = find_nearest_seq(scene, v2d, &hand, mval);
 
 		act_orig = ed->act_seq;
 
@@ -414,8 +414,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 					BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
 				}
 			}
-			else
-			if (seq->type == SEQ_TYPE_SOUND_RAM) {
+			else if (seq->type == SEQ_TYPE_SOUND_RAM) {
 				if (seq->strip) {
 					BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
 				}
@@ -1167,7 +1166,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
 	extend = RNA_boolean_get(op->ptr, "extend");
 
 	if (actseq == NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No Active Sequence!");
+		BKE_report(op->reports, RPT_ERROR, "No active sequence!");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 7bfe58c..e8d4701 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -311,7 +311,7 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl)
 	SpaceSeq *sseqn = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
-// XXX	sseq->gpd= gpencil_data_duplicate(sseq->gpd);
+// XXX	sseq->gpd = gpencil_data_duplicate(sseq->gpd);
 
 	return (SpaceLink *)sseqn;
 }
@@ -363,7 +363,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
 
 static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
 {
-//	ScrArea *sa= CTX_wm_area(C);
+//	ScrArea *sa = CTX_wm_area(C);
 	
 	/* NLE - strip editing timeline interface */
 	draw_timeline_seq(C, ar);
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index ead7de9..9cc407f 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -54,4 +54,8 @@ if(WITH_PYTHON)
 	add_definitions(-DWITH_PYTHON)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_text "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_text/SConscript b/source/blender/editors/space_text/SConscript
index 6ad6427..3735645 100644
--- a/source/blender/editors/space_text/SConscript
+++ b/source/blender/editors/space_text/SConscript
@@ -10,4 +10,7 @@ incs += ' ../../python ../../makesrna ../../blenfont ../../blenloader'
 if env['WITH_BF_PYTHON']:
     defs.append('WITH_PYTHON')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_text', sources, Split(incs), defs, libtype=['core'], priority=[95] )
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 501e1ca..d74e326 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -196,10 +196,6 @@ static void text_operatortypes(void)
 	WM_operatortype_append(TEXT_OT_unindent);
 	WM_operatortype_append(TEXT_OT_indent);
 
-	WM_operatortype_append(TEXT_OT_markers_clear);
-	WM_operatortype_append(TEXT_OT_next_marker);
-	WM_operatortype_append(TEXT_OT_previous_marker);
-
 	WM_operatortype_append(TEXT_OT_select_line);
 	WM_operatortype_append(TEXT_OT_select_all);
 	WM_operatortype_append(TEXT_OT_select_word);
@@ -227,7 +223,6 @@ static void text_operatortypes(void)
 	WM_operatortype_append(TEXT_OT_find_set_selected);
 	WM_operatortype_append(TEXT_OT_replace);
 	WM_operatortype_append(TEXT_OT_replace_set_selected);
-	WM_operatortype_append(TEXT_OT_mark_all);
 
 	WM_operatortype_append(TEXT_OT_to_3d_object);
 
@@ -431,7 +426,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar)
 {
 	/* draw entirely, view changes should be handled here */
 	SpaceText *st = CTX_wm_space_text(C);
-	//View2D *v2d= &ar->v2d;
+	//View2D *v2d = &ar->v2d;
 	
 	/* clear and setup matrix */
 	UI_ThemeClearColor(TH_BACK);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index a68524f..46ab2d9 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -95,7 +95,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c)
 static int text_font_draw_character_utf8(SpaceText *st, int x, int y, const char *c)
 {
 	char str[BLI_UTF8_MAX + 1];
-	size_t len = BLI_str_utf8_size(c);
+	size_t len = BLI_str_utf8_size_safe(c);
 	memcpy(str, c, len);
 	str[len] = '\0';
 
@@ -158,7 +158,7 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
 			in++;
 		}
 		else {
-			size_t len = BLI_str_utf8_size(in);
+			size_t len = BLI_str_utf8_size_safe(in);
 			flatten_string_append(fs, in, r, len);
 			in += len;
 			total++;
@@ -342,7 +342,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 		if (*str == '\\') {
 			*fmt = prev; fmt++; str++;
 			if (*str == '\0') break;
-			*fmt = prev; fmt++; str += BLI_str_utf8_size(str);
+			*fmt = prev; fmt++; str += BLI_str_utf8_size_safe(str);
 			continue;
 		}
 		/* Handle continuations */
@@ -363,14 +363,14 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 			}
 
 			*fmt = 'l';
-			str += BLI_str_utf8_size(str) - 1;
+			str += BLI_str_utf8_size_safe(str) - 1;
 		}
 		/* Not in a string... */
 		else {
 			/* Deal with comments first */
 			if (prev == '#' || *str == '#') {
 				*fmt = '#';
-				str += BLI_str_utf8_size(str) - 1;
+				str += BLI_str_utf8_size_safe(str) - 1;
 			}
 			else if (*str == '"' || *str == '\'') {
 				/* Strings */
@@ -399,7 +399,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 					*fmt = 'n';
 				}
 				else {
-					str += BLI_str_utf8_size(str) - 1;
+					str += BLI_str_utf8_size_safe(str) - 1;
 					*fmt = 'q';
 				}
 			/* Punctuation */
@@ -407,7 +407,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 				*fmt = '!';
 			/* Identifiers and other text (no previous ws. or delims. so text continues) */
 			else if (prev == 'q') {
-				str += BLI_str_utf8_size(str) - 1;
+				str += BLI_str_utf8_size_safe(str) - 1;
 				*fmt = 'q';
 			}
 			/* Not ws, a digit, punct, or continuing text. Must be new, check for special words */
@@ -427,7 +427,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 					*fmt = prev;
 				}
 				else {
-					str += BLI_str_utf8_size(str) - 1;
+					str += BLI_str_utf8_size_safe(str) - 1;
 					*fmt = 'q';
 				}
 			}
@@ -575,7 +575,7 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
 		end = max;
 		chop = 1;
 		*offc = 0;
-		for (i = 0, j = 0; linep->line[j]; j += BLI_str_utf8_size(linep->line + j)) {
+		for (i = 0, j = 0; linep->line[j]; j += BLI_str_utf8_size_safe(linep->line + j)) {
 			int chars;
 
 			/* Mimic replacement of tabs */
@@ -640,7 +640,7 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
 	*offc = 0;
 	cursin = txt_utf8_offset_to_index(linein->line, cursin);
 
-	for (i = 0, j = 0; linein->line[j]; j += BLI_str_utf8_size(linein->line + j)) {
+	for (i = 0, j = 0; linein->line[j]; j += BLI_str_utf8_size_safe(linein->line + j)) {
 
 		/* Mimic replacement of tabs */
 		ch = linein->line[j];
@@ -685,7 +685,7 @@ int text_get_char_pos(SpaceText *st, const char *line, int cur)
 {
 	int a = 0, i;
 	
-	for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size(line + i)) {
+	for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size_safe(line + i)) {
 		if (line[i] == '\t')
 			a += st->tabnumber - a % st->tabnumber;
 		else
@@ -698,7 +698,7 @@ static const char *txt_utf8_get_nth(const char *str, int n)
 {
 	int pos = 0;
 	while (str[pos] && n--) {
-		pos += BLI_str_utf8_size(str + pos);
+		pos += BLI_str_utf8_size_safe(str + pos);
 	}
 	return str + pos;
 }
@@ -719,7 +719,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 	start = 0; mstart = 0;
 	end = max; mend = txt_utf8_get_nth(str, max) - str;
 	
-	for (i = 0, mi = 0; str[mi]; i++, mi += BLI_str_utf8_size(str + mi)) {
+	for (i = 0, mi = 0; str[mi]; i++, mi += BLI_str_utf8_size_safe(str + mi)) {
 		if (i - start >= max) {
 			/* skip hidden part of line */
 			if (skip) {
@@ -730,11 +730,11 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 			}
 
 			/* Draw the visible portion of text on the overshot line */
-			for (a = start, ma = mstart; a < end; a++, ma += BLI_str_utf8_size(str + ma)) {
+			for (a = start, ma = mstart; a < end; a++, ma += BLI_str_utf8_size_safe(str + ma)) {
 				if (st->showsyntax && format) format_draw_color(format[a]);
 				x += text_font_draw_character_utf8(st, x, y, str + ma);
 			}
-			y -= st->lheight;
+			y -= st->lheight + TXT_LINE_SPACING;
 			x = basex;
 			lines++;
 			start = end; mstart = mend;
@@ -748,7 +748,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 	}
 
 	/* Draw the remaining text */
-	for (a = start, ma = mstart; str[ma] && y > 0; a++, ma += BLI_str_utf8_size(str + ma)) {
+	for (a = start, ma = mstart; str[ma] && y > 0; a++, ma += BLI_str_utf8_size_safe(str + ma)) {
 		if (st->showsyntax && format)
 			format_draw_color(format[a]);
 
@@ -786,7 +786,7 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
 			for (a = 0; a < amount; a++) {
 				format_draw_color(format[a]);
 				x += text_font_draw_character_utf8(st, x, y, in + str_shift);
-				str_shift += BLI_str_utf8_size(in + str_shift);
+				str_shift += BLI_str_utf8_size_safe(in + str_shift);
 			}
 		}
 		else text_font_draw(st, x, y, in);
@@ -1016,7 +1016,7 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
 	lines = 1;
 	start = 0;
 	end = max;
-	for (i = 0, j = 0; str[j]; j += BLI_str_utf8_size(str + j)) {
+	for (i = 0, j = 0; str[j]; j += BLI_str_utf8_size_safe(str + j)) {
 		/* Mimic replacement of tabs */
 		ch = str[j];
 		if (ch == '\t') {
@@ -1070,40 +1070,6 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
 	return drawcache->total_lines;
 }
 
-/* Move pointer to first visible line (top) */
-static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
-{
-	Text *text = st->text;
-	TextLine *pline = text->lines.first;
-	int i = st->top, lineno = 0;
-
-	text_update_drawcache(st, ar);
-
-	if (wrap_top) *wrap_top = 0;
-
-	if (st->wordwrap) {
-		while (i > 0 && pline) {
-			int lines = text_get_visible_lines_no(st, lineno);
-
-			if (i - lines < 0) {
-				if (wrap_top) *wrap_top = i;
-				break;
-			}
-			else {
-				pline = pline->next;
-				i -= lines;
-				lineno++;
-			}
-		}
-	}
-	else {
-		for (i = st->top; pline->next && i > 0; i--)
-			pline = pline->next;
-	}
-
-	return pline;
-}
-
 /************************ draw scrollbar *****************************/
 
 static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
@@ -1139,7 +1105,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 	barheight = (ltexth > 0) ? (st->viewlines * pix_available) / ltexth : 0;
 	pix_bardiff = 0;
 	if (barheight < 20) {
-		pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */	
+		pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */
 		barheight = 20;
 	}
 	barstart = (ltexth > 0) ? ((pix_available - pix_bardiff) * st->top) / ltexth : 0;
@@ -1166,9 +1132,9 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 		/* the scrollbar is non-linear sized */
 		if (pix_bardiff > 0) {
 			/* the start of the highlight is in the current viewport */
-			if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) { 
+			if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
 				/* speed the progresion of the start of the highlight through the scrollbar */
-				hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines); 	
+				hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines);
 			}
 			else if (lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
 				/* push hl start down */
@@ -1179,35 +1145,35 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 				hlstart = barstart;
 			}
 
-			if (hlend <= hlstart) { 
+			if (hlend <= hlstart) {
 				hlend = hlstart + 2;
 			}
 
 			/* the end of the highlight is in the current viewport */
-			if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) { 
+			if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) {
 				/* speed the progresion of the end of the highlight through the scrollbar */
 				hlend = (((pix_available - pix_bardiff) * lhlend) / ltexth) + (pix_bardiff * (lhlend - st->top) / st->viewlines);
 			}
 			else if (lhlend < st->top && hlend >= barstart - 2 && hlend < barstart + barheight) {
 				/* push hl end up */
 				hlend = barstart;
-			}					
+			}
 			else if (lhlend > st->top + st->viewlines && lhlstart < st->top + st->viewlines && hlend < barstart + barheight) {
 				/* fill out end */
 				hlend = barstart + barheight;
 			}
 
-			if (hlend <= hlstart) { 
+			if (hlend <= hlstart) {
 				hlstart = hlend - 2;
-			}	
-		}	
+			}
+		}
 	}
 	else {
 		hlstart = 0;
 		hlend = 0;
 	}
 
-	if (hlend - hlstart < 2) { 
+	if (hlend - hlstart < 2) {
 		hlend = hlstart + 2;
 	}
 	
@@ -1232,7 +1198,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
 	uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0);
 
 	uiSetRoundBox(UI_CNR_ALL);
-	rad = 0.4f * mini(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll));
+	rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll));
 	UI_GetThemeColor3ubv(TH_HILITE, col);
 	col[3] = 48;
 	glColor4ubv(col);
@@ -1241,90 +1207,6 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
 	glDisable(GL_BLEND);
 }
 
-/************************** draw markers **************************/
-
-static void draw_markers(SpaceText *st, ARegion *ar)
-{
-	Text *text = st->text;
-	TextMarker *marker, *next;
-	TextLine *top, *line;
-	int offl, offc, i, x1, x2, y1, y2, x, y;
-	int topi, topy;
-
-	/* Move pointer to first visible line (top) */
-	top = first_visible_line(st, ar, NULL);
-	topi = BLI_findindex(&text->lines, top);
-
-	topy = txt_get_span(text->lines.first, top);
-
-	for (marker = text->markers.first; marker; marker = next) {
-		next = marker->next;
-
-		/* invisible line (before top) */
-		if (marker->lineno < topi) continue;
-
-		line = BLI_findlink(&text->lines, marker->lineno);
-
-		/* Remove broken markers */
-		if (marker->end > line->len || marker->start > marker->end) {
-			BLI_freelinkN(&text->markers, marker);
-			continue;
-		}
-
-		wrap_offset(st, ar, line, marker->start, &offl, &offc);
-		y1 = txt_get_span(top, line) - st->top + offl + topy;
-		x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc;
-
-		wrap_offset(st, ar, line, marker->end, &offl, &offc);
-		y2 = txt_get_span(top, line) - st->top + offl + topy;
-		x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc;
-
-		/* invisible part of line (before top, after last visible line) */
-		if (y2 < 0 || y1 > st->top + st->viewlines) continue;
-
-		glColor3ubv(marker->color);
-		x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-		y = ar->winy - 3;
-
-		if (y1 == y2) {
-			y -= y1 * st->lheight;
-			glBegin(GL_LINE_LOOP);
-			glVertex2i(x + x2 * st->cwidth + 1, y);
-			glVertex2i(x + x1 * st->cwidth - 2, y);
-			glVertex2i(x + x1 * st->cwidth - 2, y - st->lheight);
-			glVertex2i(x + x2 * st->cwidth + 1, y - st->lheight);
-			glEnd();
-		}
-		else {
-			y -= y1 * st->lheight;
-			glBegin(GL_LINE_STRIP);
-			glVertex2i(ar->winx, y);
-			glVertex2i(x + x1 * st->cwidth - 2, y);
-			glVertex2i(x + x1 * st->cwidth - 2, y - st->lheight);
-			glVertex2i(ar->winx, y - st->lheight);
-			glEnd();
-			y -= st->lheight;
-
-			for (i = y1 + 1; i < y2; i++) {
-				glBegin(GL_LINES);
-				glVertex2i(x, y);
-				glVertex2i(ar->winx, y);
-				glVertex2i(x, y - st->lheight);
-				glVertex2i(ar->winx, y - st->lheight);
-				glEnd();
-				y -= st->lheight;
-			}
-
-			glBegin(GL_LINE_STRIP);
-			glVertex2i(x, y);
-			glVertex2i(x + x2 * st->cwidth + 1, y);
-			glVertex2i(x + x2 * st->cwidth + 1, y - st->lheight);
-			glVertex2i(x, y - st->lheight);
-			glEnd();
-		}
-	}
-}
-
 /*********************** draw documentation *******************************/
 
 static void draw_documentation(SpaceText *st, ARegion *ar)
@@ -1355,7 +1237,7 @@ static void draw_documentation(SpaceText *st, ARegion *ar)
 		x += SUGG_LIST_WIDTH * st->cwidth + 50;
 	}
 
-	/* top= */ /* UNUSED */ y = ar->winy - st->lheight * l - 2;
+	/* top = */ /* UNUSED */ y = ar->winy - st->lheight * l - 2;
 	boxw = DOC_WIDTH * st->cwidth + 20;
 	boxh = (DOC_HEIGHT + 1) * st->lheight;
 
@@ -1494,6 +1376,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 	Text *text = st->text;
 	int vcurl, vcurc, vsell, vselc, hidden = 0;
 	int x, y, w, i;
+	int lheight = st->lheight + TXT_LINE_SPACING;
 
 	/* Draw the selection */
 	if (text->curl != text->sell || text->curc != text->selc) {
@@ -1514,11 +1397,11 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 		y = ar->winy - 2;
 
 		if (vcurl == vsell) {
-			y -= vcurl * st->lheight;
+			y -= vcurl * lheight;
 			if (vcurc < vselc)
-				glRecti(x + vcurc * st->cwidth - 1, y, x + vselc * st->cwidth, y - st->lheight);
+				glRecti(x + vcurc * st->cwidth - 1, y, x + vselc * st->cwidth, y - lheight + TXT_LINE_SPACING);
 			else
-				glRecti(x + vselc * st->cwidth - 1, y, x + vcurc * st->cwidth, y - st->lheight);
+				glRecti(x + vselc * st->cwidth - 1, y, x + vcurc * st->cwidth, y - lheight + TXT_LINE_SPACING);
 		}
 		else {
 			int froml, fromc, tol, toc;
@@ -1532,12 +1415,12 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 				fromc = vselc; toc = vcurc;
 			}
 
-			y -= froml * st->lheight;
-			glRecti(x + fromc * st->cwidth - 1, y, ar->winx, y - st->lheight); y -= st->lheight;
+			y -= froml * lheight;
+			glRecti(x + fromc * st->cwidth - 1, y, ar->winx, y - lheight); y -= lheight;
 			for (i = froml + 1; i < tol; i++)
-				glRecti(x - 4, y, ar->winx, y - st->lheight),  y -= st->lheight;
+				glRecti(x - 4, y, ar->winx, y - lheight),  y -= lheight;
 
-			glRecti(x - 4, y, x + toc * st->cwidth, y - st->lheight);  y -= st->lheight;
+			glRecti(x - 4, y, x + toc * st->cwidth, y - lheight + TXT_LINE_SPACING);  y -= lheight;
 		}
 	}
 	else {
@@ -1561,12 +1444,12 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 
 			wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc);
 
-			y1 = ar->winy - 2 - (vsell - offl) * st->lheight;
-			y2 = y1 - st->lheight * visible_lines + 1;
+			y1 = ar->winy - 2 - (vsell - offl) * lheight;
+			y2 = y1 - lheight * visible_lines + 1;
 		}
 		else {
-			y1 = ar->winy - 2 - vsell * st->lheight;
-			y2 = y1 - st->lheight + 1;
+			y1 = ar->winy - 2 - vsell * lheight;
+			y2 = y1 - lheight + 1;
 		}
 
 		if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */
@@ -1577,7 +1460,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 			
 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 			glEnable(GL_BLEND);
-			glRecti(x1 - 4, y1, x2, y2);
+			glRecti(x1 - 4, y1, x2, y2 + TXT_LINE_SPACING);
 			glDisable(GL_BLEND);
 		}
 	}
@@ -1586,20 +1469,21 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 		/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
 		x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
 		x += vselc * st->cwidth;
-		y = ar->winy - 2 - vsell * st->lheight;
+		y = ar->winy - 2 - vsell * lheight;
 		
 		if (st->overwrite) {
 			char ch = text->sell->line[text->selc];
 			
+			y += TXT_LINE_SPACING;
 			w = st->cwidth;
 			if (ch == '\t') w *= st->tabnumber - (vselc + st->left) % st->tabnumber;
 			
 			UI_ThemeColor(TH_HILITE);
-			glRecti(x, y - st->lheight - 1, x + w, y - st->lheight + 1);
+			glRecti(x, y - lheight - 1, x + w, y - lheight + 1);
 		}
 		else {
 			UI_ThemeColor(TH_HILITE);
-			glRecti(x - 1, y, x + 1, y - st->lheight);
+			glRecti(x - 1, y, x + 1, y - lheight + TXT_LINE_SPACING);
 		}
 	}
 }
@@ -1639,7 +1523,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 	if (b > 0) {
 		/* opening bracket, search forward for close */
 		fc++;
-		c += BLI_str_utf8_size(linep->line + c);
+		c += BLI_str_utf8_size_safe(linep->line + c);
 		while (linep) {
 			while (c < linep->len) {
 				if (linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
@@ -1657,7 +1541,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 					}
 				}
 				fc++;
-				c += BLI_str_utf8_size(linep->line + c);
+				c += BLI_str_utf8_size_safe(linep->line + c);
 			}
 			if (endl) break;
 			linep = linep->next;
@@ -1702,7 +1586,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 	if (!endl || endc == -1)
 		return;
 
-	UI_ThemeColor(TH_HILITE);	
+	UI_ThemeColor(TH_HILITE);
 	x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
 	y = ar->winy - st->lheight;
 
@@ -1714,8 +1598,8 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 	if (viewc >= 0) {
 		viewl = txt_get_span(text->lines.first, startl) - st->top + offl;
 
-		text_font_draw_character(st, x + viewc * st->cwidth, y - viewl * st->lheight, ch);
-		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * st->lheight, ch);
+		text_font_draw_character(st, x + viewc * st->cwidth, y - viewl * (st->lheight + TXT_LINE_SPACING), ch);
+		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * (st->lheight + TXT_LINE_SPACING), ch);
 	}
 
 	/* draw closing bracket */
@@ -1726,8 +1610,8 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 	if (viewc >= 0) {
 		viewl = txt_get_span(text->lines.first, endl) - st->top + offl;
 
-		text_font_draw_character(st, x + viewc * st->cwidth, y - viewl * st->lheight, ch);
-		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * st->lheight, ch);
+		text_font_draw_character(st, x + viewc * st->cwidth, y - viewl * (st->lheight + TXT_LINE_SPACING), ch);
+		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * (st->lheight + TXT_LINE_SPACING), ch);
 	}
 }
 
@@ -1743,7 +1627,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 	int wraplinecount = 0, wrap_skip = 0;
 	int margin_column_x;
 
-	if (st->lheight) st->viewlines = (int)ar->winy / st->lheight;
+	if (st->lheight) st->viewlines = (int)ar->winy / (st->lheight + TXT_LINE_SPACING);
 	else st->viewlines = 0;
 
 	/* if no text, nothing to do */
@@ -1789,7 +1673,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 
 	text_font_begin(st);
 	st->cwidth = BLF_fixed_width(mono);
-	st->cwidth = MAX2(st->cwidth, 1);
+	st->cwidth = MAX2(st->cwidth, (char)1);
 
 	/* draw line numbers background */
 	if (st->showlinenrs) {
@@ -1832,14 +1716,14 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 		if (st->wordwrap) {
 			/* draw word wrapped text */
 			int lines = text_draw_wrapped(st, tmp->line, x, y, winx - x, tmp->format, wrap_skip);
-			y -= lines * st->lheight;
+			y -= lines * (st->lheight + TXT_LINE_SPACING);
 		}
 		else {
 			/* draw unwrapped text */
 			text_draw(st, tmp->line, st->left, ar->winx / st->cwidth, 1, x, y, tmp->format);
-			y -= st->lheight;
+			y -= st->lheight + TXT_LINE_SPACING;
 		}
-
+		
 		wrap_skip = 0;
 	}
 	
@@ -1858,7 +1742,6 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 
 	/* draw other stuff */
 	draw_brackets(st, ar);
-	draw_markers(st, ar);
 	glTranslatef(GLA_PIXEL_OFS, GLA_PIXEL_OFS, 0.0f); /* XXX scroll requires exact pixel space */
 	draw_textscroll(st, &scroll, &back);
 	draw_documentation(st, ar);
@@ -1873,7 +1756,7 @@ void text_update_character_width(SpaceText *st)
 {
 	text_font_begin(st);
 	st->cwidth = BLF_fixed_width(mono);
-	st->cwidth = MAX2(st->cwidth, 1);
+	st->cwidth = MAX2(st->cwidth, (char)1);
 	text_font_end(st);
 }
 
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 4f973e7..ea61644 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -57,6 +57,7 @@ void text_update_cursor_moved(struct bContext *C);
 #define TXT_OFFSET 15
 #define TXT_SCROLL_WIDTH 20
 #define TXT_SCROLL_SPACE 2
+#define TXT_LINE_SPACING 4 /* space between lines */
 
 #define TEXTXLOC		(st->cwidth * st->linenrs_tot)
 
@@ -68,9 +69,6 @@ void text_update_cursor_moved(struct bContext *C);
 #define TOOL_SUGG_LIST	0x01
 #define TOOL_DOCUMENT	0x02
 
-#define TMARK_GRP_CUSTOM	0x00010000	/* Lower 2 bytes used for Python groups */
-#define TMARK_GRP_FINDALL	0x00020000
-
 typedef struct FlattenString {
 	char fixedbuf[256];
 	int fixedaccum[256];
@@ -129,10 +127,6 @@ void TEXT_OT_indent(struct wmOperatorType *ot);
 void TEXT_OT_line_break(struct wmOperatorType *ot);
 void TEXT_OT_insert(struct wmOperatorType *ot);
 
-void TEXT_OT_markers_clear(struct wmOperatorType *ot);
-void TEXT_OT_next_marker(struct wmOperatorType *ot);
-void TEXT_OT_previous_marker(struct wmOperatorType *ot);
-
 void TEXT_OT_select_line(struct wmOperatorType *ot);
 void TEXT_OT_select_all(struct wmOperatorType *ot);
 void TEXT_OT_select_word(struct wmOperatorType *ot);
@@ -157,7 +151,6 @@ void TEXT_OT_find(struct wmOperatorType *ot);
 void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
 void TEXT_OT_replace(struct wmOperatorType *ot);
 void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
-void TEXT_OT_mark_all(struct wmOperatorType *ot);
 
 void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
 
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index b2fb16f..5b7f927 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -44,6 +44,8 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "PIL_time.h"
 
 #include "BKE_context.h"
@@ -93,7 +95,7 @@ static int text_edit_poll(bContext *C)
 		return 0;
 
 	if (text->id.lib) {
-		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return 0;
 	}
 
@@ -109,7 +111,7 @@ static int text_space_edit_poll(bContext *C)
 		return 0;
 
 	if (text->id.lib) {
-		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return 0;
 	}
 
@@ -129,7 +131,7 @@ static int text_region_edit_poll(bContext *C)
 		return 0;
 
 	if (text->id.lib) {
-		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
+		// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
 		return 0;
 	}
 
@@ -463,7 +465,8 @@ static void txt_write_file(Text *text, ReportList *reports)
 	
 	fp = BLI_fopen(filepath, "w");
 	if (fp == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to save \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error writing file");
+		BKE_reportf(reports, RPT_ERROR, "Unable to save '%s': %s",
+		            filepath, errno ? strerror(errno) : TIP_("unknown error writing file"));
 		return;
 	}
 
@@ -482,7 +485,8 @@ static void txt_write_file(Text *text, ReportList *reports)
 	}
 	else {
 		text->mtime = 0;
-		BKE_reportf(reports, RPT_WARNING, "Unable to stat \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error starrng file");
+		BKE_reportf(reports, RPT_WARNING, "Unable to stat '%s': %s",
+		            filepath, errno ? strerror(errno) : TIP_("unknown error stating file"));
 	}
 	
 	if (text->flags & TXT_ISDIRTY)
@@ -611,6 +615,8 @@ static int text_run_script(bContext *C, ReportList *reports)
 		}
 
 		BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now...");
+
+		return OPERATOR_FINISHED;
 	}
 #else
 	(void)C;
@@ -970,21 +976,17 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Text *text = CTX_data_edit_text(C);
 
-	if (txt_has_sel(text)) {
-		text_drawcache_tag_update(CTX_wm_space_text(C), 0);
-
-		txt_order_cursors(text);
-		txt_unindent(text);
+	text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
-		text_update_edited(text);
+	txt_order_cursors(text);
+	txt_unindent(text);
 
-		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+	text_update_edited(text);
 
-		return OPERATOR_FINISHED;
-	}
+	text_update_cursor_moved(C);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
-	return OPERATOR_CANCELLED;
+	return OPERATOR_FINISHED;
 }
 
 void TEXT_OT_unindent(wmOperatorType *ot)
@@ -1135,7 +1137,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 	
 	tmp = text->lines.first;
 	
-	//first convert to all space, this make it a lot easier to convert to tabs because there is no mixtures of ' ' && '\t'
+	/* first convert to all space, this make it a lot easier to convert to tabs
+	 * because there is no mixtures of ' ' && '\t' */
 	while (tmp) {
 		text_check_line = tmp->line;
 		number = flatten_string(st, &fs, text_check_line) + 1;
@@ -1376,104 +1379,6 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
 	RNA_def_enum(ot->srna, "direction", direction_items, 1, "Direction", "");
 }
 
-/******************* previous marker operator *********************/
-
-static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Text *text = CTX_data_edit_text(C);
-	TextMarker *mrk;
-	int lineno;
-
-	lineno = txt_get_span(text->lines.first, text->curl);
-	mrk = text->markers.last;
-	while (mrk && (mrk->lineno > lineno || (mrk->lineno == lineno && mrk->end > text->curc)))
-		mrk = mrk->prev;
-	if (!mrk) mrk = text->markers.last;
-	if (mrk) {
-		txt_move_to(text, mrk->lineno, mrk->start, 0);
-		txt_move_to(text, mrk->lineno, mrk->end, 1);
-	}
-
-	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-	return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_previous_marker(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Previous Marker";
-	ot->idname = "TEXT_OT_previous_marker";
-	ot->description = "Move to previous marker";
-	
-	/* api callbacks */
-	ot->exec = text_previous_marker_exec;
-	ot->poll = text_edit_poll;
-}
-
-/******************* next marker operator *********************/
-
-static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Text *text = CTX_data_edit_text(C);
-	TextMarker *mrk;
-	int lineno;
-
-	lineno = txt_get_span(text->lines.first, text->curl);
-	mrk = text->markers.first;
-	while (mrk && (mrk->lineno < lineno || (mrk->lineno == lineno && mrk->start <= text->curc)))
-		mrk = mrk->next;
-	if (!mrk) mrk = text->markers.first;
-	if (mrk) {
-		txt_move_to(text, mrk->lineno, mrk->start, 0);
-		txt_move_to(text, mrk->lineno, mrk->end, 1);
-	}
-
-	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-	return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_next_marker(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Next Marker";
-	ot->idname = "TEXT_OT_next_marker";
-	ot->description = "Move to next marker";
-	
-	/* api callbacks */
-	ot->exec = text_next_marker_exec;
-	ot->poll = text_edit_poll;
-}
-
-/******************* clear all markers operator *********************/
-
-static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Text *text = CTX_data_edit_text(C);
-
-	txt_clear_markers(text, 0, 0);
-
-	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-	return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_markers_clear(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Clear All Markers";
-	ot->idname = "TEXT_OT_markers_clear";
-	ot->description = "Clear all markers";
-	
-	/* api callbacks */
-	ot->exec = text_clear_all_markers_exec;
-	ot->poll = text_edit_poll;
-}
-
 /************************ move operator ************************/
 
 static EnumPropertyItem move_type_items[] = {
@@ -1503,7 +1408,7 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int
 	end = max;
 	chop = loop = 1;
 
-	for (i = 0, j = 0; loop; j += BLI_str_utf8_size(linein->line + j)) {
+	for (i = 0, j = 0; loop; j += BLI_str_utf8_size_safe(linein->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
 		ch = linein->line[j];
@@ -1664,16 +1569,15 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
 	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
-	int oldl, oldc, i, j, max, start, end, endj, chop, loop;
+	int oldc, i, j, max, start, end, endj, chop, loop;
 	char ch;
 
 	text_update_character_width(st);
 
-	if (sel) linep = &text->sell, charp = &text->selc;
-	else linep = &text->curl, charp = &text->curc;
+	if (sel) { linep = &text->sell; charp = &text->selc; }
+	else     { linep = &text->curl; charp = &text->curc; }
 
 	oldc = *charp;
-	oldl = txt_get_span(text->lines.first, *linep);
 
 	max = wrap_width(st, ar);
 
@@ -1682,7 +1586,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
 	chop = loop = 1;
 	*charp = 0;
 
-	for (i = 0, j = 0; loop; j += BLI_str_utf8_size((*linep)->line + j)) {
+	for (i = 0, j = 0; loop; j += BLI_str_utf8_size_safe((*linep)->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
 		ch = (*linep)->line[j];
@@ -1724,7 +1628,6 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, oldl, *charp);
 }
 
 static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
@@ -1732,16 +1635,15 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
 	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
-	int oldl, oldc, i, j, max, start, end, endj, chop, loop;
+	int oldc, i, j, max, start, end, endj, chop, loop;
 	char ch;
 
 	text_update_character_width(st);
 
-	if (sel) linep = &text->sell, charp = &text->selc;
-	else linep = &text->curl, charp = &text->curc;
+	if (sel) { linep = &text->sell; charp = &text->selc; }
+	else     { linep = &text->curl; charp = &text->curc; }
 
 	oldc = *charp;
-	oldl = txt_get_span(text->lines.first, *linep);
 
 	max = wrap_width(st, ar);
 
@@ -1750,7 +1652,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
 	chop = loop = 1;
 	*charp = 0;
 
-	for (i = 0, j = 0; loop; j += BLI_str_utf8_size((*linep)->line + j)) {
+	for (i = 0, j = 0; loop; j += BLI_str_utf8_size_safe((*linep)->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
 		ch = (*linep)->line[j];
@@ -1790,7 +1692,6 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, oldl, *charp);
 }
 
 static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
@@ -1798,22 +1699,17 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
 	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
-	int oldl, oldc, offl, offc, col, newl;
+	int offl, offc, col;
 
 	text_update_character_width(st);
 
-	if (sel) linep = &text->sell, charp = &text->selc;
-	else linep = &text->curl, charp = &text->curc;
-
-	/* store previous position */
-	oldc = *charp;
-	newl = oldl = txt_get_span(text->lines.first, *linep);
+	if (sel) { linep = &text->sell; charp = &text->selc; }
+	else     { linep = &text->curl; charp = &text->curc; }
 
 	wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
 	col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
 	if (offl) {
 		*charp = text_get_cursor_rel(st, ar, *linep, offl - 1, col);
-		newl = BLI_findindex(&text->lines, linep);
 	}
 	else {
 		if ((*linep)->prev) {
@@ -1822,13 +1718,11 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
 			*linep = (*linep)->prev;
 			visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
 			*charp = text_get_cursor_rel(st, ar, *linep, visible_lines - 1, col);
-			newl--;
 		}
 		else *charp = 0;
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, newl, *charp);
 }
 
 static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
@@ -1836,35 +1730,28 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
 	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
-	int oldl, oldc, offl, offc, col, newl, visible_lines;
+	int offl, offc, col, visible_lines;
 
 	text_update_character_width(st);
 
-	if (sel) linep = &text->sell, charp = &text->selc;
-	else linep = &text->curl, charp = &text->curc;
-
-	/* store previous position */
-	oldc = *charp;
-	newl = oldl = txt_get_span(text->lines.first, *linep);
+	if (sel) { linep = &text->sell; charp = &text->selc; }
+	else     { linep = &text->curl; charp = &text->curc; }
 
 	wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
 	col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
 	visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
 	if (offl < visible_lines - 1) {
 		*charp = text_get_cursor_rel(st, ar, *linep, offl + 1, col);
-		newl = BLI_findindex(&text->lines, linep);
 	}
 	else {
 		if ((*linep)->next) {
 			*linep = (*linep)->next;
 			*charp = text_get_cursor_rel(st, ar, *linep, 0, col);
-			newl++;
 		}
 		else *charp = (*linep)->len;
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, newl, *charp);
 }
 
 /* Moves the cursor vertically by the specified number of lines.
@@ -1876,12 +1763,10 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
 static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, int sel)
 {
 	TextLine **linep;
-	int oldl, oldc, *charp;
+	int *charp;
 	
-	if (sel) linep = &text->sell, charp = &text->selc;
-	else linep = &text->curl, charp = &text->curc;
-	oldl = txt_get_span(text->lines.first, *linep);
-	oldc = *charp;
+	if (sel) { linep = &text->sell; charp = &text->selc; }
+	else     { linep = &text->curl; charp = &text->curc; }
 
 	if (st && ar && st->wordwrap) {
 		int rell, relc;
@@ -1904,7 +1789,6 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, int s
 	if (*charp > (*linep)->len) *charp = (*linep)->len;
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, *linep), *charp);
 }
 
 static int text_move_cursor(bContext *C, int type, int select)
@@ -1948,7 +1832,7 @@ static int text_move_cursor(bContext *C, int type, int select)
 			txt_move_left(text, select);
 			break;
 
-		case NEXT_CHAR:	
+		case NEXT_CHAR:
 			txt_move_right(text, select);
 			break;
 
@@ -2222,10 +2106,10 @@ static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
 
 	if (!tsc->scrollbar) {
 		txtdelta[0] = -tsc->delta[0] / st->cwidth;
-		txtdelta[1] = tsc->delta[1] / st->lheight;
+		txtdelta[1] = tsc->delta[1] / (st->lheight + TXT_LINE_SPACING);
 
 		tsc->delta[0] %= st->cwidth;
-		tsc->delta[1] %= st->lheight;
+		tsc->delta[1] %= (st->lheight + TXT_LINE_SPACING);
 	}
 	else {
 		txtdelta[1] = -tsc->delta[1] * st->pix_per_line;
@@ -2462,7 +2346,7 @@ static int flatten_len(SpaceText *st, const char *str)
 {
 	int i, total = 0;
 
-	for (i = 0; str[i]; i += BLI_str_utf8_size(str + i)) {
+	for (i = 0; str[i]; i += BLI_str_utf8_size_safe(str + i)) {
 		if (str[i] == '\t') {
 			total += st->tabnumber - total % st->tabnumber;
 		}
@@ -2475,7 +2359,7 @@ static int flatten_len(SpaceText *st, const char *str)
 static int flatten_index_to_offset(SpaceText *st, const char *str, int index)
 {
 	int i, j;
-	for (i = 0, j = 0; i < index; j += BLI_str_utf8_size(str + j))
+	for (i = 0, j = 0; i < index; j += BLI_str_utf8_size_safe(str + j))
 		if (str[j] == '\t')
 			i += st->tabnumber - i % st->tabnumber;
 		else
@@ -2519,7 +2403,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 		int j = 0, curs = 0, endj = 0;   /* mem */
 		int chop = 1;                    /* flags */
 		
-		for (; loop; j += BLI_str_utf8_size(linep->line + j)) {
+		for (; loop; j += BLI_str_utf8_size_safe(linep->line + j)) {
 			int chars;
 			
 			/* Mimic replacement of tabs */
@@ -2611,7 +2495,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 
 	if (linep && charp != -1) {
 		if (sel) { text->sell = linep; text->selc = charp; }
-		else { text->curl = linep; text->curc = charp; }
+		else     { text->curl = linep; text->curc = charp; }
 	}
 }
 
@@ -2619,7 +2503,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
 {
 	Text *text = st->text;
 	text_update_character_width(st);
-	y = (ar->winy - 2 - y) / st->lheight;
+	y = (ar->winy - 2 - y) / (st->lheight + TXT_LINE_SPACING);
 
 	if (st->showlinenrs) x -= TXT_OFFSET + TEXTXLOC;
 	else x -= TXT_OFFSET;
@@ -2636,7 +2520,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
 		int w;
 		
 		if (sel) { linep = &text->sell; charp = &text->selc; }
-		else { linep = &text->curl; charp = &text->curc; }
+		else     { linep = &text->curl; charp = &text->curc; }
 		
 		y -= txt_get_span(text->lines.first, *linep) - st->top;
 		
@@ -2669,7 +2553,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
 
 		text_update_cursor_moved(C);
 		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
-	} 
+	}
 	else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > ar->winx)) {
 		if (event->mval[0] > ar->winx) st->left++;
 		else if (event->mval[0] < 0 && st->left > 0) st->left--;
@@ -2679,7 +2563,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
 		text_update_cursor_moved(C);
 		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 		// XXX PIL_sleep_ms(10);
-	} 
+	}
 	else {
 		text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
 
@@ -2688,7 +2572,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
 
 		ssel->old[0] = event->mval[0];
 		ssel->old[1] = event->mval[1];
-	} 
+	}
 }
 
 static void text_cursor_set_exit(bContext *C, wmOperator *op)
@@ -2696,7 +2580,6 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op)
 	SpaceText *st = CTX_wm_space_text(C);
 	Text *text = st->text;
 	SetSelection *ssel = op->customdata;
-	int linep2, charp2;
 	char *buffer;
 
 	if (txt_has_sel(text)) {
@@ -2705,12 +2588,6 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op)
 		MEM_freeN(buffer);
 	}
 
-	linep2 = txt_get_span(st->text->lines.first, st->text->sell);
-	charp2 = st->text->selc;
-		
-	if (ssel->sell != linep2 || ssel->selc != charp2)
-		txt_undo_add_toop(st->text, UNDO_STO, ssel->sell, ssel->selc, linep2, charp2);
-
 	text_update_cursor_moved(C);
 	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
@@ -2786,19 +2663,12 @@ void TEXT_OT_selection_set(wmOperatorType *ot)
 static int text_cursor_set_exec(bContext *C, wmOperator *op)
 {
 	SpaceText *st = CTX_wm_space_text(C);
-	Text *text = st->text;
 	ARegion *ar = CTX_wm_region(C);
 	int x = RNA_int_get(op->ptr, "x");
 	int y = RNA_int_get(op->ptr, "y");
-	int oldl, oldc;
-
-	oldl = txt_get_span(text->lines.first, text->curl);
-	oldc = text->curc;
 
 	text_cursor_set_to_pos(st, ar, x, y, 0);
 
-	txt_undo_add_toop(text, UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, text->curl), text->curc);
-
 	text_update_cursor_moved(C);
 	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
@@ -2945,7 +2815,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			size_t len;
 			
 			if (event->utf8_buf[0]) {
-				len = BLI_str_utf8_size(event->utf8_buf);
+				len = BLI_str_utf8_size_safe(event->utf8_buf);
 				memcpy(str, event->utf8_buf, len);
 			}
 			else {
@@ -2990,14 +2860,13 @@ void TEXT_OT_insert(wmOperatorType *ot)
 /* mode */
 #define TEXT_FIND       0
 #define TEXT_REPLACE    1
-#define TEXT_MARK_ALL   2
 
 static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
 {
 	Main *bmain = CTX_data_main(C);
 	SpaceText *st = CTX_wm_space_text(C);
-	Text *start = NULL, *text = st->text;
-	int flags, first = 1;
+	Text *text = st->text;
+	int flags;
 	int found = 0;
 	char *tmp;
 
@@ -3006,79 +2875,48 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
 
 	flags = st->flags;
 	if (flags & ST_FIND_ALL)
-		flags ^= ST_FIND_WRAP;
-
-	do {
-		int proceed = 0;
+		flags &= ~ST_FIND_WRAP;
 
-		if (first) {
-			if (text->markers.first)
-				WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+	/* Replace current */
+	if (mode != TEXT_FIND && txt_has_sel(text)) {
+		tmp = txt_sel_to_buf(text);
 
-			txt_clear_markers(text, TMARK_GRP_FINDALL, 0);
-		}
+		if (flags & ST_MATCH_CASE) found = strcmp(st->findstr, tmp) == 0;
+		else found = BLI_strcasecmp(st->findstr, tmp) == 0;
 
-		first = 0;
-		
-		/* Replace current */
-		if (mode != TEXT_FIND && txt_has_sel(text)) {
-			tmp = txt_sel_to_buf(text);
-
-			if (flags & ST_MATCH_CASE) proceed = strcmp(st->findstr, tmp) == 0;
-			else proceed = BLI_strcasecmp(st->findstr, tmp) == 0;
-
-			if (proceed) {
-				if (mode == TEXT_REPLACE) {
-					txt_insert_buf(text, st->replacestr);
-					if (text->curl && text->curl->format) {
-						MEM_freeN(text->curl->format);
-						text->curl->format = NULL;
-					}
-					text_update_cursor_moved(C);
-					WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-					text_drawcache_tag_update(CTX_wm_space_text(C), 1);
-				}
-				else if (mode == TEXT_MARK_ALL) {
-					unsigned char color[4];
-					UI_GetThemeColor4ubv(TH_SHADE2, color);
-
-					if (txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
-						if (tmp) MEM_freeN(tmp), tmp = NULL;
-						break;
-					}
-
-					txt_add_marker(text, text->curl, text->curc, text->selc, color, TMARK_GRP_FINDALL, TMARK_EDITALL);
-					text_update_cursor_moved(C);
-					WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+		if (found) {
+			if (mode == TEXT_REPLACE) {
+				txt_insert_buf(text, st->replacestr);
+				if (text->curl && text->curl->format) {
+					MEM_freeN(text->curl->format);
+					text->curl->format = NULL;
 				}
+				text_update_cursor_moved(C);
+				WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+				text_drawcache_tag_update(CTX_wm_space_text(C), 1);
 			}
-			MEM_freeN(tmp);
-			tmp = NULL;
 		}
+		MEM_freeN(tmp);
+		tmp = NULL;
+	}
 
-		/* Find next */
-		if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
-			text_update_cursor_moved(C);
-			WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
-		}
-		else if (flags & ST_FIND_ALL) {
-			if (text == start) break;
-			if (!start) start = text;
-			if (text->id.next)
-				text = st->text = text->id.next;
-			else
-				text = st->text = bmain->text.first;
-			txt_move_toline(text, 0, 0);
-			text_update_cursor_moved(C);
-			WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
-			first = 1;
-		}
-		else {
-			if (!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
-			break;
-		}
-		found = 1;
-	} while (mode == TEXT_MARK_ALL);
+	/* Find next */
+	if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
+		text_update_cursor_moved(C);
+		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+	}
+	else if (flags & ST_FIND_ALL) {
+		if (text->id.next)
+			text = st->text = text->id.next;
+		else
+			text = st->text = bmain->text.first;
+		txt_move_toline(text, 0, 0);
+		text_update_cursor_moved(C);
+		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+	}
+	else {
+		if (!found) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
+	}
 
 	return OPERATOR_FINISHED;
 }
@@ -3119,25 +2957,6 @@ void TEXT_OT_replace(wmOperatorType *ot)
 	ot->poll = text_space_edit_poll;
 }
 
-/******************* mark all operator *********************/
-
-static int text_mark_all_exec(bContext *C, wmOperator *op)
-{
-	return text_find_and_replace(C, op, TEXT_MARK_ALL);
-}
-
-void TEXT_OT_mark_all(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Mark All";
-	ot->idname = "TEXT_OT_mark_all";
-	ot->description = "Mark all specified text";
-	
-	/* api callbacks */
-	ot->exec = text_mark_all_exec;
-	ot->poll = text_space_edit_poll;
-}
-
 /******************* find set selected *********************/
 
 static int text_find_set_selected_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 966afe2..4c9b4b9 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -359,177 +359,3 @@ static short UNUSED_FUNCTION(do_texttools) (SpaceText * st, char ascii, unsigned
 
 	return swallow;
 }
-
-static short UNUSED_FUNCTION(do_textmarkers) (SpaceText * st, char ascii, unsigned short evnt, short val)
-{
-	Text *text;
-	TextMarker *marker, *mrk, *nxt;
-	int c, s, draw = 0, swallow = 0;
-	int qual = 0; // XXX
-
-	text = st->text;
-	if (!text || text->id.lib || text->curl != text->sell) return 0;
-
-	marker = txt_find_marker(text, text->sell, text->selc, 0, 0);
-	if (marker && (marker->start > text->curc || marker->end < text->curc))
-		marker = NULL;
-
-	if (!marker) {
-		/* Find the next temporary marker */
-		if (evnt == TABKEY) {
-			int lineno = txt_get_span(text->lines.first, text->curl);
-			mrk = text->markers.first;
-			while (mrk) {
-				if (!marker && (mrk->flags & TMARK_TEMP)) marker = mrk;
-				if ((mrk->flags & TMARK_TEMP) && (mrk->lineno > lineno || (mrk->lineno == lineno && mrk->end > text->curc))) {
-					marker = mrk;
-					break;
-				}
-				mrk = mrk->next;
-			}
-			if (marker) {
-				txt_move_to(text, marker->lineno, marker->start, 0);
-				txt_move_to(text, marker->lineno, marker->end, 1);
-				// XXX text_update_cursor_moved(C);
-				// XXX WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
-				evnt = ascii = val = 0;
-				draw = 1;
-				swallow = 1;
-			}
-		}
-		else if (evnt == ESCKEY) {
-			if (txt_clear_markers(text, 0, TMARK_TEMP)) swallow = 1;
-			else if (txt_clear_markers(text, 0, 0)) swallow = 1;
-			else return 0;
-			evnt = ascii = val = 0;
-			draw = 1;
-		}
-		if (!swallow) return 0;
-	}
-
-	if (ascii) {
-		if (marker->flags & TMARK_EDITALL) {
-			c = text->curc - marker->start;
-			s = text->selc - marker->start;
-			if (s < 0 || s > marker->end - marker->start) return 0;
-
-			mrk = txt_next_marker(text, marker);
-			while (mrk) {
-				nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
-				txt_move_to(text, mrk->lineno, mrk->start + c, 0);
-				if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
-				if (st->overwrite) {
-					if (txt_replace_char(text, ascii))
-						text_update_line_edited(st->text->curl);
-				}
-				else {
-					if (txt_add_char(text, ascii)) {
-						text_update_line_edited(st->text->curl);
-					}
-				}
-
-				if (mrk == marker || mrk == nxt) break;
-				mrk = nxt;
-			}
-			swallow = 1;
-			draw = 1;
-		}
-	}
-	else if (val) {
-		switch (evnt) {
-			case BACKSPACEKEY:
-				if (marker->flags & TMARK_EDITALL) {
-					c = text->curc - marker->start;
-					s = text->selc - marker->start;
-					if (s < 0 || s > marker->end - marker->start) return 0;
-					
-					mrk = txt_next_marker(text, marker);
-					while (mrk) {
-						nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
-						txt_move_to(text, mrk->lineno, mrk->start + c, 0);
-						if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
-						txt_backspace_char(text);
-						text_update_line_edited(st->text->curl);
-						if (mrk == marker || mrk == nxt) break;
-						mrk = nxt;
-					}
-					swallow = 1;
-					draw = 1;
-				}
-				break;
-			case DELKEY:
-				if (marker->flags & TMARK_EDITALL) {
-					c = text->curc - marker->start;
-					s = text->selc - marker->start;
-					if (s < 0 || s > marker->end - marker->start) return 0;
-					
-					mrk = txt_next_marker(text, marker);
-					while (mrk) {
-						nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
-						txt_move_to(text, mrk->lineno, mrk->start + c, 0);
-						if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
-						txt_delete_char(text);
-						text_update_line_edited(st->text->curl);
-						if (mrk == marker || mrk == nxt) break;
-						mrk = nxt;
-					}
-					swallow = 1;
-					draw = 1;
-				}
-				break;
-			case TABKEY:
-				if (qual & LR_SHIFTKEY) {
-					nxt = marker->prev;
-					if (!nxt) nxt = text->markers.last;
-				}
-				else {
-					nxt = marker->next;
-					if (!nxt) nxt = text->markers.first;
-				}
-				if (marker->flags & TMARK_TEMP) {
-					if (nxt == marker) nxt = NULL;
-					BLI_freelinkN(&text->markers, marker);
-				}
-				mrk = nxt;
-				if (mrk) {
-					txt_move_to(text, mrk->lineno, mrk->start, 0);
-					txt_move_to(text, mrk->lineno, mrk->end, 1);
-					// XXX text_update_cursor_moved(C);
-					// XXX WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
-				}
-				swallow = 1;
-				draw = 1;
-				break;
-
-			/* Events that should clear markers */
-			case UKEY: if (!(qual & LR_ALTKEY)) break;
-			case ZKEY: if (evnt == ZKEY && !(qual & LR_CTRLKEY)) break;
-			case RETKEY:
-			case ESCKEY:
-				if (marker->flags & (TMARK_EDITALL | TMARK_TEMP))
-					txt_clear_markers(text, marker->group, 0);
-				else
-					BLI_freelinkN(&text->markers, marker);
-				swallow = 1;
-				draw = 1;
-				break;
-			case RIGHTMOUSE: /* Marker context menu? */
-			case LEFTMOUSE:
-				break;
-			case FKEY: /* Allow find */
-				if (qual & LR_SHIFTKEY) swallow = 1;
-				break;
-
-			default:
-				if (qual != 0 && qual != LR_SHIFTKEY)
-					swallow = 1;  /* Swallow all other shortcut events */
-		}
-	}
-	
-	if (draw) {
-		// XXX redraw_alltext();
-	}
-	
-	return swallow;
-}
-
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 1bba237..35dd88c 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -51,7 +51,9 @@ set(SRC
 	view3d_edit.c
 	view3d_fly.c
 	view3d_header.c
+	view3d_iterators.c
 	view3d_ops.c
+	view3d_project.c
 	view3d_select.c
 	view3d_snap.c
 	view3d_toolbar.c
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 135e9b8..0649edc 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -84,7 +84,7 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar)
 void draw_motion_path_instance(Scene *scene, 
                                Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath)
 {
-	//RegionView3D *rv3d= ar->regiondata;
+	//RegionView3D *rv3d = ar->regiondata;
 	bMotionPathVert *mpv, *mpv_start;
 	int i, stepsize = avs->path_step;
 	int sfra, efra, sind, len;
@@ -148,11 +148,11 @@ void draw_motion_path_instance(Scene *scene,
 		if ((sfra + i) < CFRA) {
 			/* black - before cfra */
 			if (sel) {
-				// intensity= 0.5f;
+				// intensity = 0.5f;
 				intensity = SET_INTENSITY(sfra, i, CFRA, 0.25f, 0.75f);
 			}
 			else {
-				//intensity= 0.8f;
+				//intensity = 0.8f;
 				intensity = SET_INTENSITY(sfra, i, CFRA, 0.68f, 0.92f);
 			}
 			UI_ThemeColorBlend(TH_WIRE, TH_BACK, intensity);
@@ -178,7 +178,7 @@ void draw_motion_path_instance(Scene *scene,
 				intensity = 0.99f;
 			}
 			UI_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10);
-		}	
+		}
 		
 		/* draw a vertex with this color */
 		glVertex3fv(mpv->co);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 31df133..beafee3 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -100,7 +100,7 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
 	}
 	
 	/* only try to set custom color if enabled for armature */
-	if (arm->flag & ARM_COL_CUSTOM) {	
+	if (arm->flag & ARM_COL_CUSTOM) {
 		/* currently, a bone can only use a custom color set if it's group (if it has one),
 		 * has been set to use one
 		 */
@@ -647,7 +647,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 		/* this routine doesn't call get_matrix_editbone() that calculates it */
 		ebone->length = len_v3v3(ebone->head, ebone->tail);
 
-		/*length= ebone->length;*/ /*UNUSED*/
+		/*length = ebone->length;*/ /*UNUSED*/
 		tail = ebone->rad_tail;
 		dist = ebone->dist;
 		if (ebone->parent && (ebone->flag & BONE_CONNECTED))
@@ -658,7 +658,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 		tailvec = ebone->tail;
 	}
 	else {
-		/*length= pchan->bone->length;*/ /*UNUSED*/
+		/*length = pchan->bone->length;*/ /*UNUSED*/
 		tail = pchan->bone->rad_tail;
 		dist = pchan->bone->dist;
 		if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED))
@@ -767,7 +767,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 		/* this routine doesn't call get_matrix_editbone() that calculates it */
 		ebone->length = len_v3v3(ebone->head, ebone->tail);
 		
-		/*length= ebone->length;*/ /*UNUSED*/
+		/*length = ebone->length;*/ /*UNUSED*/
 		tail = ebone->rad_tail;
 		if (ebone->parent && (boneflag & BONE_CONNECTED))
 			head = ebone->parent->rad_tail;
@@ -777,7 +777,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 		tailvec = ebone->tail;
 	}
 	else {
-		/*length= pchan->bone->length;*/ /*UNUSED*/
+		/*length = pchan->bone->length;*/ /*UNUSED*/
 		tail = pchan->bone->rad_tail;
 		if ((pchan->parent) && (boneflag & BONE_CONNECTED))
 			head = pchan->parent->bone->rad_tail;
@@ -969,7 +969,7 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
 		glTranslatef(0.0f, 0.0f, head);
 		gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
 	}
-	else {		
+	else {
 		/* 1 sphere in center */
 		glTranslatef(0.0f, 0.0f, (head + length - tail) / 2.0f);
 		gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
@@ -1040,7 +1040,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 		glEnd();
 		
 		/* tip */
-		if (G.f & G_PICKSEL) {	
+		if (G.f & G_PICKSEL) {
 			/* no bitmap in selection mode, crashes 3d cards... */
 			glLoadName(id | BONESEL_TIP);
 			glBegin(GL_POINTS);
@@ -1189,7 +1189,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
 		glDisable(GL_COLOR_MATERIAL);
 		glDisable(GL_LIGHTING);
 	}
-	else {	
+	else {
 		/* wire */
 		if (armflag & ARM_POSEMODE) {
 			if (constflag) {
@@ -1205,9 +1205,9 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
 				/* restore colors */
 				set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
 			}
-		}		
+		}
 		
-		draw_b_bone_boxes(OB_WIRE, pchan, xwidth, length, zwidth);		
+		draw_b_bone_boxes(OB_WIRE, pchan, xwidth, length, zwidth);
 	}
 }
 
@@ -1333,7 +1333,7 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag
 		else if (armflag & ARM_POSEMODE) {
 			if (constflag) {
 				/* draw constraint colors */
-				if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {	
+				if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {
 					glEnable(GL_BLEND);
 					
 					draw_bone_solid_octahedral();
@@ -1344,10 +1344,10 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag
 				/* restore colors */
 				set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
 			}
-		}		
+		}
 		draw_bone_octahedral();
 	}
-	else {	
+	else {
 		/* solid */
 		if (armflag & ARM_POSEMODE)
 			set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
@@ -1741,7 +1741,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 					
 					if (use_custom && pchan->custom_tx) {
 						glMultMatrixf(pchan->custom_tx->pose_mat);
-					} 
+					}
 					else {
 						glMultMatrixf(pchan->pose_mat);
 					}
@@ -1803,7 +1803,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 		 */
 		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) {
 			/* object tag, for bordersel optim */
-			glLoadName(index & 0xFFFF);	
+			glLoadName(index & 0xFFFF);
 			index = -1;
 		}
 	}
@@ -1830,7 +1830,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 							
 							if (pchan->custom_tx) {
 								glMultMatrixf(pchan->custom_tx->pose_mat);
-							} 
+							}
 							else {
 								glMultMatrixf(pchan->pose_mat);
 							}
@@ -1869,7 +1869,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 		/* stick or wire bones have not been drawn yet so don't clear object selection in this case */
 		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && draw_wire) {
 			/* object tag, for bordersel optim */
-			glLoadName(index & 0xFFFF);	
+			glLoadName(index & 0xFFFF);
 			index = -1;
 		}
 	}
@@ -1938,7 +1938,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 									glLoadName(index & 0xFFFF);
 									pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
 								}
-							}	
+							}
 						}
 					}
 					
@@ -1992,7 +1992,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 		/* restore things */
 		if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt > OB_WIRE) && (arm->flag & ARM_POSEMODE))
 			bglPolygonOffset(rv3d->dist, 0.0);
-	}	
+	}
 	
 	/* restore */
 	glDisable(GL_CULL_FACE);
@@ -2045,7 +2045,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 						if (arm->flag & ARM_DRAWNAMES) {
 							mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
 							view3d_cached_text_draw_add(vec, pchan->name, 10, 0, col);
-						}	
+						}
 						
 						/*	Draw additional axes on the bone tail  */
 						if ((arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE)) {
@@ -2075,7 +2075,7 @@ static void get_matrix_editbone(EditBone *eBone, float bmat[][4])
 	float mat[3][3];
 	
 	/* Compose the parent transforms (i.e. their translations) */
-	sub_v3_v3v3(delta, eBone->tail, eBone->head);	
+	sub_v3_v3v3(delta, eBone->tail, eBone->head);
 	
 	eBone->length = (float)sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]);
 	
@@ -2258,7 +2258,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
 							mid_v3_v3v3(vec, eBone->head, eBone->tail);
 							glRasterPos3fv(vec);
 							view3d_cached_text_draw_add(vec, eBone->name, 10, 0, col);
-						}					
+						}
 						/*	Draw additional axes */
 						if (arm->flag & ARM_DRAWAXES) {
 							glPushMatrix();
@@ -2643,7 +2643,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 						}
 						draw_pose_paths(scene, v3d, ar, ob);
 					}
-				}	
+				}
 			}
 			draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline);
 			arm->flag &= ~ARM_POSEMODE; 
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index e4c21a9..0ecde35 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -51,6 +51,7 @@
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_effect.h"
+#include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_material.h"
 #include "BKE_paint.h"
@@ -382,7 +383,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
 		glEnable(GL_CULL_FACE);
 		glCullFace(GL_BACK);
 	}
-	else {		
+	else {
 		glDisable(GL_CULL_FACE);
 	}
 	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
@@ -406,7 +407,7 @@ static void draw_textured_end(void)
 	 *  - zr
 	 */
 	glPushMatrix();
-	glLoadIdentity();	
+	glLoadIdentity();
 	GPU_default_lights();
 	glPopMatrix();
 }
@@ -533,8 +534,7 @@ static void update_tface_color_layer(DerivedMesh *dm)
 			}
 			else {
 				float col[3];
-				Material *ma = give_current_material(Gtexdraw.ob, mface[i].mat_nr + 1);
-				
+
 				if (ma) {
 					if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
 					else copy_v3_v3(col, &ma->r);
@@ -637,7 +637,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
 	int a, totpoly = me->totpoly;
 
 	/* fake values to pass to GPU_render_text() */
-	MCol tmp_mcol[4]  = {{0}};
+	MCol  tmp_mcol[4]  = {{0}};
 	MCol *tmp_mcol_pt  = mloopcol ? tmp_mcol : NULL;
 	MTFace tmp_tf      = {{{0}}};
 
@@ -704,7 +704,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
 
 			/* COLOR */
 			if (mloopcol) {
-				unsigned int totloop_clamp = MIN2(4, mp->totloop);
+				unsigned int totloop_clamp = min_ii(4, mp->totloop);
 				unsigned int j;
 				lcol = &mloopcol[mp->loopstart];
 
@@ -729,7 +729,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
 			BKE_bproperty_set_valstr(prop, string);
 			characters = strlen(string);
 			
-			if (!BKE_image_get_ibuf(mtpoly->tpage, NULL))
+			if (!BKE_image_has_ibuf(mtpoly->tpage, NULL))
 				characters = 0;
 
 			if (!mf_smooth) {
@@ -966,7 +966,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
 		Mesh *me = ob->data;
 		TexMatCallback data = {scene, ob, me, dm};
 		int (*set_face_cb)(void *, int);
-		int glsl;
+		int glsl, picking = (G.f & G_PICKSEL);
 		
 		/* face hiding callback depending on mode */
 		if (ob == scene->obedit)
@@ -977,11 +977,11 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
 			set_face_cb = NULL;
 
 		/* test if we can use glsl */
-		glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support();
+		glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support() && !picking;
 
 		GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
 
-		if (glsl) {
+		if (glsl || picking) {
 			/* draw glsl */
 			dm->drawMappedFacesMat(dm,
 			                       tex_mat_set_material_cb,
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1b008c2..5ac7327 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -27,10 +27,6 @@
  *  \ingroup spview3d
  */
 
-
-#include <string.h>
-#include <math.h>
-
 #include "MEM_guardedalloc.h"
 
 #include "DNA_camera_types.h"
@@ -40,21 +36,14 @@
 #include "DNA_lattice_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_smoke_types.h"
-#include "DNA_speaker_types.h"
 #include "DNA_world_types.h"
-#include "DNA_armature_types.h"
 #include "DNA_object_types.h"
 
-#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_edgehash.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
 
 #include "BKE_anim.h"  /* for the where_on_path function */
 #include "BKE_armature.h"
@@ -79,13 +68,10 @@
 #include "BKE_pointcache.h"
 #include "BKE_scene.h"
 #include "BKE_unit.h"
-#include "BKE_movieclip.h"
 #include "BKE_tracking.h"
 
 #include "BKE_tessmesh.h"
 
-#include "smoke_API.h"
-
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
@@ -100,16 +86,13 @@
 #include "ED_screen.h"
 #include "ED_sculpt.h"
 #include "ED_types.h"
-#include "ED_curve.h" /* for curve_editnurbs */
-#include "ED_armature.h"
 
 #include "UI_resources.h"
 
 #include "WM_api.h"
-#include "wm_subwindow.h"
 #include "BLF_api.h"
 
-#include "view3d_intern.h"  /* own include */
+#include "view3d_intern.h"  /* bad level include */
 
 typedef enum eWireDrawMode {
 	OBDRAW_WIRE_OFF = 0,
@@ -117,28 +100,6 @@ typedef enum eWireDrawMode {
 	OBDRAW_WIRE_ON_DEPTH = 2
 } eWireDrawMode;
 
-/* user data structures for derived mesh callbacks */
-typedef struct foreachScreenVert_userData {
-	void (*func)(void *userData, BMVert *eve, int x, int y, int index);
-	void *userData;
-	ViewContext vc;
-	eV3DClipTest clipVerts;
-} foreachScreenVert_userData;
-
-typedef struct foreachScreenEdge_userData {
-	void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index);
-	void *userData;
-	ViewContext vc;
-	rcti win_rect; /* copy of: vc.ar->winx/winy, use for faster tests, minx/y will always be 0 */
-	eV3DClipTest clipVerts;
-} foreachScreenEdge_userData;
-
-typedef struct foreachScreenFace_userData {
-	void (*func)(void *userData, BMFace *efa, int x, int y, int index);
-	void *userData;
-	ViewContext vc;
-} foreachScreenFace_userData;
-
 typedef struct drawDMVerts_userData {
 	BMEditMesh *em; /* BMESH BRANCH ONLY */
 
@@ -171,7 +132,8 @@ typedef struct drawDMFacesSel_userData {
 	BMEditMesh *em;  /* BMESH BRANCH ONLY */
 
 	BMFace *efa_act;
-	int *orig_index;
+	int *orig_index_mf_to_mpoly;
+	int *orig_index_mp_to_orig;
 } drawDMFacesSel_userData;
 
 typedef struct drawDMNormal_userData {
@@ -267,17 +229,21 @@ static int check_alpha_pass(Base *base)
 
 	if (G.f & G_PICKSEL)
 		return 0;
-	
+
+	if (base->object->mode & OB_MODE_ALL_PAINT)
+		return 0;
+
 	return (base->object->dtx & OB_DRAWTRANSP);
 }
 
 /***/
-static unsigned int colortab[24] =
-{0x0,       0xFF88FF, 0xFFBBFF,
- 0x403000,  0xFFFF88, 0xFFFFBB,
- 0x104040,  0x66CCCC, 0x77CCCC,
- 0x104010,  0x55BB55, 0x66FF66,
- 0xFFFFFF};
+static unsigned int colortab[24] = {
+	0x0,      0xFF88FF, 0xFFBBFF,
+	0x403000, 0xFFFF88, 0xFFFFBB,
+	0x104040, 0x66CCCC, 0x77CCCC,
+	0x104010, 0x55BB55, 0x66FF66,
+	0xFFFFFF
+};
 
 
 static float cube[8][3] = {
@@ -567,7 +533,7 @@ void drawaxes(float size, char drawtype)
 static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4])
 {
 	Image *ima = (Image *)ob->data;
-	ImBuf *ibuf = ima ? BKE_image_get_ibuf(ima, NULL) : NULL;
+	ImBuf *ibuf = ima ? BKE_image_acquire_ibuf(ima, NULL, NULL) : NULL;
 
 	float scale, ofs_x, ofs_y, sca_x, sca_y;
 	int ima_x, ima_y;
@@ -617,7 +583,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
 	glTranslatef(0.0f,  0.0f,  0.0f);
 
 	/* Calculate Image scale */
-	scale = (ob->empty_drawsize / (float)MAX2(ima_x * sca_x, ima_y * sca_y));
+	scale = (ob->empty_drawsize / max_ff((float)ima_x * sca_x, (float)ima_y * sca_y));
 
 	/* Set the object scale */
 	glScalef(scale * sca_x, scale * sca_y, 1.0f);
@@ -652,6 +618,8 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
 	/* Reset GL settings */
 	glMatrixMode(GL_MODELVIEW);
 	glPopMatrix();
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, float tmat[][4])
@@ -784,10 +752,10 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 			mul_m4_v3(mat, vos->vec);
 
 		if (ED_view3d_project_short_ex(ar,
-		                           (vos->flag & V3D_CACHE_TEXT_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
-		                           (vos->flag & V3D_CACHE_TEXT_LOCALCLIP) != 0,
-		                           vos->vec, vos->sco,
-		                           V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
+		                               (vos->flag & V3D_CACHE_TEXT_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
+		                               (vos->flag & V3D_CACHE_TEXT_LOCALCLIP) != 0,
+		                               vos->vec, vos->sco,
+		                               V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
 		{
 			tot++;
 		}
@@ -858,7 +826,9 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 		if (depth_write) {
 			if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 		}
-		else glDepthMask(1);
+		else {
+			glDepthMask(1);
+		}
 		
 		glMatrixMode(GL_PROJECTION);
 		glPopMatrix();
@@ -900,7 +870,7 @@ static void drawcube(void)
 	glEnd();
 }
 
-/* draws a cube on given the scaling of the cube, assuming that 
+/* draws a cube on given the scaling of the cube, assuming that
  * all required matrices have been set (used for drawing empties)
  */
 static void drawcube_size(float size)
@@ -1284,8 +1254,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 			glVertex3fv(tvec);
 			glEnd();
 		}
-		else circ(0.0, 0.0, fabsf(z));
-		
+		else {
+			circ(0.0, 0.0, fabsf(z));
+		}
+
 		/* draw the circle/square representing spotbl */
 		if (la->type == LA_SPOT) {
 			float spotblcirc = fabs(z) * (1 - pow(la->spotblend, 2));
@@ -1429,7 +1401,7 @@ static void draw_limit_line(float sta, float end, unsigned int col)
 	glVertex3f(0.0, 0.0, -end);
 	glEnd();
 	glPointSize(1.0);
-}		
+}
 
 
 /* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */
@@ -1870,29 +1842,6 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
 	bglEnd();
 }
 
-void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPoint *bp, int x, int y), void *userData)
-{
-	Object *obedit = vc->obedit;
-	Lattice *lt = obedit->data;
-	BPoint *bp = lt->editlatt->latt->def;
-	DispList *dl = BKE_displist_find(&obedit->disp, DL_VERTS);
-	float *co = dl ? dl->verts : NULL;
-	int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
-
-	ED_view3d_clipping_local(vc->rv3d, obedit->obmat); /* for local clipping lookups */
-
-	for (i = 0; i < N; i++, bp++, co += 3) {
-		if (bp->hide == 0) {
-			int screen_co[2];
-			if (ED_view3d_project_int_object(vc->ar, dl ? co : bp->vec, screen_co,
-			                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-			{
-				func(userData, bp, screen_co[0], screen_co[1]);
-			}
-		}
-	}
-}
-
 static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol)
 {
 	int index = ((w * lt->pntsv + v) * lt->pntsu) + u;
@@ -1979,53 +1928,6 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
 
 /* ***************** ******************** */
 
-/* Note! - foreach funcs should be called while drawing or directly after
- * if not, ED_view3d_init_mats_rv3d() can be used for selection tools
- * but would not give correct results with dupli's for eg. which don't
- * use the object matrix in the usual way */
-static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const float co[3],
-                                            const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
-{
-	foreachScreenVert_userData *data = userData;
-	BMVert *eve = EDBM_vert_at_index(data->vc.em, index);
-
-	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
-		const eV3DProjTest flag = (data->clipVerts == V3D_CLIP_TEST_OFF) ?
-		            V3D_PROJ_TEST_NOP :
-		            V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN;
-		int screen_co[2];
-
-		if (ED_view3d_project_int_object(data->vc.ar, co, screen_co, flag) != V3D_PROJ_RET_OK) {
-			return;
-		}
-
-		data->func(data->userData, eve, screen_co[0], screen_co[1], index);
-	}
-}
-
-void mesh_foreachScreenVert(
-        ViewContext *vc,
-        void (*func)(void *userData, BMVert *eve, int x, int y, int index),
-        void *userData, eV3DClipTest clipVerts)
-{
-	foreachScreenVert_userData data;
-	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
-	
-	data.vc = *vc;
-	data.func = func;
-	data.userData = userData;
-	data.clipVerts = clipVerts;
-
-	if (clipVerts != V3D_CLIP_TEST_OFF)
-		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
-
-	EDBM_index_arrays_init(vc->em, 1, 0, 0);
-	dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
-	EDBM_index_arrays_free(vc->em);
-
-	dm->release(dm);
-}
-
 /*  draw callback */
 static void drawSelectedVertices__mapFunc(void *userData, int index, const float co[3],
                                           const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
@@ -2054,286 +1956,9 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
 	glEnd();
 }
 
-static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3])
-{
-	foreachScreenEdge_userData *data = userData;
-	BMEdge *eed = EDBM_edge_at_index(data->vc.em, index);
-
-	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
-		int screen_co_a[2];
-		int screen_co_b[2];
-
-		const eV3DProjTest flag = (data->clipVerts == V3D_CLIP_TEST_RV3D_CLIPPING) ?
-		            V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN :
-		            V3D_PROJ_TEST_NOP;
-
-		if (ED_view3d_project_int_object(data->vc.ar, v0co, screen_co_a, flag) != V3D_PROJ_RET_OK) {
-			return;
-		}
-		if (ED_view3d_project_int_object(data->vc.ar, v1co, screen_co_b, flag) != V3D_PROJ_RET_OK) {
-			return;
-		}
-
-		if (data->clipVerts == V3D_CLIP_TEST_RV3D_CLIPPING) {
-			/* pass */
-		}
-		else {
-			if (data->clipVerts == V3D_CLIP_TEST_REGION) {
-				if (!BLI_rcti_isect_segment(&data->win_rect, screen_co_a, screen_co_b)) {
-					return;
-				}
-			}
-		}
-
-		data->func(data->userData, eed,
-		           screen_co_a[0], screen_co_a[1],
-		           screen_co_b[0], screen_co_b[1], index);
-	}
-}
-
-void mesh_foreachScreenEdge(
-        ViewContext *vc,
-        void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index),
-        void *userData, eV3DClipTest clipVerts)
-{
-	foreachScreenEdge_userData data;
-	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
-
-	data.vc = *vc;
-
-	data.win_rect.xmin = 0;
-	data.win_rect.ymin = 0;
-	data.win_rect.xmax = vc->ar->winx;
-	data.win_rect.ymax = vc->ar->winy;
-
-	data.func = func;
-	data.userData = userData;
-	data.clipVerts = clipVerts;
-
-	if (clipVerts != V3D_CLIP_TEST_OFF)
-		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
-
-	EDBM_index_arrays_init(vc->em, 0, 1, 0);
-	dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
-	EDBM_index_arrays_free(vc->em);
-
-	dm->release(dm);
-}
-
-static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
-{
-	foreachScreenFace_userData *data = userData;
-	BMFace *efa = EDBM_face_at_index(data->vc.em, index);
-
-	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
-		int screen_co[2];
-		if (ED_view3d_project_int_object(data->vc.ar, cent, screen_co,
-		                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-		{
-			data->func(data->userData, efa, screen_co[0], screen_co[1], index);
-		}
-	}
-}
-
-void mesh_foreachScreenFace(
-        ViewContext *vc,
-        void (*func)(void *userData, BMFace *efa, int x, int y, int index),
-        void *userData)
-{
-	foreachScreenFace_userData data;
-	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
-
-	data.vc = *vc;
-	data.func = func;
-	data.userData = userData;
-
-	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-
-	EDBM_index_arrays_init(vc->em, 0, 0, 1);
-	dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data);
-	EDBM_index_arrays_free(vc->em);
-
-	dm->release(dm);
-}
-
-void nurbs_foreachScreenVert(
-        ViewContext *vc,
-        void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y),
-        void *userData)
-{
-	Curve *cu = vc->obedit->data;
-	Nurb *nu;
-	int i;
-	ListBase *nurbs = BKE_curve_editNurbs_get(cu);
-
-	ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
-
-	for (nu = nurbs->first; nu; nu = nu->next) {
-		if (nu->type == CU_BEZIER) {
-			for (i = 0; i < nu->pntsu; i++) {
-				BezTriple *bezt = &nu->bezt[i];
-
-				if (bezt->hide == 0) {
-					int screen_co[2];
-					
-					if (cu->drawflag & CU_HIDE_HANDLES) {
-						if (ED_view3d_project_int_object(vc->ar, bezt->vec[1], screen_co,
-						                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-						{
-							func(userData, nu, NULL, bezt, 1, screen_co[0], screen_co[1]);
-						}
-					}
-					else {
-						if (ED_view3d_project_int_object(vc->ar, bezt->vec[0], screen_co,
-						                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-						{
-							func(userData, nu, NULL, bezt, 0, screen_co[0], screen_co[1]);
-						}
-						if (ED_view3d_project_int_object(vc->ar, bezt->vec[1], screen_co,
-						                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-						{
-							func(userData, nu, NULL, bezt, 1, screen_co[0], screen_co[1]);
-						}
-						if (ED_view3d_project_int_object(vc->ar, bezt->vec[2], screen_co,
-						                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-						{
-							func(userData, nu, NULL, bezt, 2, screen_co[0], screen_co[1]);
-						}
-					}
-				}
-			}
-		}
-		else {
-			for (i = 0; i < nu->pntsu * nu->pntsv; i++) {
-				BPoint *bp = &nu->bp[i];
-
-				if (bp->hide == 0) {
-					int screen_co[2];
-					if (ED_view3d_project_int_object(vc->ar, bp->vec, screen_co,
-					                                 V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
-					{
-						func(userData, nu, bp, NULL, -1, screen_co[0], screen_co[1]);
-					}
-				}
-			}
-		}
-	}
-}
-
-/* ED_view3d_init_mats_rv3d must be called first */
-void mball_foreachScreenElem(
-        struct ViewContext *vc,
-        void (*func)(void *userData, struct MetaElem *ml, int x, int y),
-        void *userData)
-{
-	MetaBall *mb = (MetaBall *)vc->obedit->data;
-	MetaElem *ml;
-
-	for (ml = mb->editelems->first; ml; ml = ml->next) {
-		int screen_co[2];
-		if (ED_view3d_project_int_object(vc->ar, &ml->x, screen_co,
-		                                 V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-		{
-			func(userData, ml, screen_co[0], screen_co[1]);
-		}
-	}
-}
-
-/* ED_view3d_init_mats_rv3d must be called first */
-void armature_foreachScreenBone(
-        struct ViewContext *vc,
-        void (*func)(void *userData, struct EditBone *ebone, int x0, int y0, int x1, int y1),
-        void *userData)
-{
-	bArmature *arm = vc->obedit->data;
-	EditBone *ebone;
-
-	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
-		if (EBONE_VISIBLE(arm, ebone)) {
-			int screen_co_a[2], screen_co_b[2];
-			int points_proj_tot = 0;
-
-			/* project head location to screenspace */
-			if (ED_view3d_project_int_object(vc->ar, ebone->head, screen_co_a,
-			                                 V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-			{
-				points_proj_tot++;
-			}
-			else {
-				screen_co_a[0] = IS_CLIPPED;  /* weak */
-				/* screen_co_a[1]: intentionally dont set this so we get errors on misuse */
-			}
-
-			/* project tail location to screenspace */
-			if (ED_view3d_project_int_object(vc->ar, ebone->tail, screen_co_b,
-			                                 V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-			{
-				points_proj_tot++;
-			}
-			else {
-				screen_co_b[0] = IS_CLIPPED;  /* weak */
-				/* screen_co_b[1]: intentionally dont set this so we get errors on misuse */
-			}
-
-			if (points_proj_tot) {  /* at least one point's projection worked */
-				func(userData, ebone,
-				     screen_co_a[0], screen_co_a[1],
-				     screen_co_b[0], screen_co_b[1]);
-			}
-		}
-	}
-}
-
-/* ED_view3d_init_mats_rv3d must be called first */
-/* almost _exact_ copy of #armature_foreachScreenBone */
-void pose_foreachScreenBone(
-        struct ViewContext *vc,
-        void (*func)(void *userData, struct bPoseChannel *pchan, int x0, int y0, int x1, int y1),
-        void *userData)
-{
-	bArmature *arm = vc->obact->data;
-	bPose *pose = vc->obact->pose;
-	bPoseChannel *pchan;
-
-	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-		if (PBONE_VISIBLE(arm, pchan->bone)) {
-			int screen_co_a[2], screen_co_b[2];
-			int points_proj_tot = 0;
-
-			/* project head location to screenspace */
-			if (ED_view3d_project_int_object(vc->ar, pchan->pose_head, screen_co_a,
-			                                 V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-			{
-				points_proj_tot++;
-			}
-			else {
-				screen_co_a[0] = IS_CLIPPED;  /* weak */
-				/* screen_co_a[1]: intentionally dont set this so we get errors on misuse */
-			}
-
-			/* project tail location to screenspace */
-			if (ED_view3d_project_int_object(vc->ar, pchan->pose_tail, screen_co_b,
-			                                 V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
-			{
-				points_proj_tot++;
-			}
-			else {
-				screen_co_b[0] = IS_CLIPPED;  /* weak */
-				/* screen_co_b[1]: intentionally dont set this so we get errors on misuse */
-			}
-
-			if (points_proj_tot) {  /* at least one point's projection worked */
-				func(userData, pchan,
-				     screen_co_a[0], screen_co_a[1],
-				     screen_co_b[0], screen_co_b[1]);
-			}
-		}
-	}
-}
-
 /* ************** DRAW MESH ****************** */
 
-/* First section is all the "simple" draw routines, 
+/* First section is all the "simple" draw routines,
  * ones that just pass some sort of primitive to GL,
  * with perhaps various options to control lighting,
  * color, etc.
@@ -2568,7 +2193,7 @@ static DMDrawOption draw_dm_edges_sel__setDrawOptions(void *userData, int index)
 		return DM_DRAW_OPTION_SKIP;
 	}
 }
-static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, 
+static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol,
                               unsigned char *selCol, unsigned char *actCol, BMEdge *eed_act)
 {
 	drawDMEdgesSel_userData data;
@@ -2590,7 +2215,7 @@ static DMDrawOption draw_dm_edges__setDrawOptions(void *userData, int index)
 		return DM_DRAW_OPTION_NORMAL;
 }
 
-static void draw_dm_edges(BMEditMesh *em, DerivedMesh *dm) 
+static void draw_dm_edges(BMEditMesh *em, DerivedMesh *dm)
 {
 	dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, em);
 }
@@ -2692,11 +2317,11 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int
 
 	unsigned char *col, *next_col;
 
-	if (!data->orig_index)
+	if (!data->orig_index_mf_to_mpoly)
 		return 0;
 
-	efa = EDBM_face_at_index(data->em, data->orig_index[index]);
-	next_efa = EDBM_face_at_index(data->em, data->orig_index[next_index]);
+	efa = EDBM_face_at_index(data->em, DM_origindex_mface_mpoly(data->orig_index_mf_to_mpoly, data->orig_index_mp_to_orig, index));
+	next_efa = EDBM_face_at_index(data->em, DM_origindex_mface_mpoly(data->orig_index_mf_to_mpoly, data->orig_index_mp_to_orig, next_index));
 
 	if (efa == next_efa)
 		return 1;
@@ -2714,7 +2339,7 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int
 }
 
 /* also draws the active face */
-static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, 
+static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol,
                               unsigned char *selCol, unsigned char *actCol, BMFace *efa_act)
 {
 	drawDMFacesSel_userData data;
@@ -2724,7 +2349,12 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
 	data.cols[1] = selCol;
 	data.cols[2] = actCol;
 	data.efa_act = efa_act;
-	data.orig_index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+	/* double lookup */
+	data.orig_index_mf_to_mpoly = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+	data.orig_index_mp_to_orig  = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
+	if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == FALSE) {
+		data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL;
+	}
 
 	dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions, &data, 0);
 }
@@ -2811,9 +2441,9 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
 
 /* EditMesh drawing routines*/
 
-static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, 
+static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
                                 BMEditMesh *em, DerivedMesh *cageDM, BMVert *eve_act,
-								RegionView3D *rv3d)
+                                RegionView3D *rv3d)
 {
 	ToolSettings *ts = scene->toolsettings;
 	int sel;
@@ -2933,7 +2563,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
 			glEnable(GL_DEPTH_TEST);
 		}
 	}
-}	
+}
 
 static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
 {
@@ -2952,7 +2582,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
 	BMIter iter;
 	int i;
 
-	/* make the precision of the pronted value proportionate to the gridsize */
+	/* make the precision of the display value proportionate to the gridsize */
 
 	if (grid < 0.01f) conv_float = "%.6g";
 	else if (grid < 0.1f) conv_float = "%.5g";
@@ -3198,7 +2828,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
 		if (ese->type == BM_FACE) {
 			efa_act = (BMFace *)ese->data;
 		}
-		else 
+		else
 #endif
 		if (ese->htype == BM_EDGE) {
 			eed_act = (BMEdge *)ese->ele;
@@ -3367,13 +2997,12 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
 
 static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
 {
-	
 	if ((v3d->transp == FALSE) &&  /* not when we draw the transparent pass */
 	    (ob->mode & OB_MODE_ALL_PAINT) == FALSE) /* not when painting (its distracting) - campbell */
 	{
 		glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
 		glDepthMask(0);
-		
+
 		/* if transparent, we cannot draw the edges for solid select... edges have no material info.
 		 * drawFacesSolid() doesn't draw the transparent faces */
 		if (ob->dtx & OB_DRAWTRANSP) {
@@ -3976,9 +3605,12 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
 	return 0;
 }
 
-/* returns 1 when nothing was drawn */
-static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
-                        const short dt, const short dflag, const unsigned char ob_wire_col[4])
+/**
+ * Only called by #drawDispList
+ * \return 1 when nothing was drawn
+ */
+static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+                                   const short dt, const short dflag, const unsigned char ob_wire_col[4])
 {
 	Object *ob = base->object;
 	ListBase *lb = NULL;
@@ -3986,20 +3618,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 	Curve *cu;
 	const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE);
 	const short solid = (dt > OB_WIRE);
-	int retval = 0;
-
-	/* backface culling */
-	if (v3d->flag2 & V3D_BACKFACE_CULLING) {
-		/* not all displists use same in/out normal direction convention */
-		glEnable(GL_CULL_FACE);
-		glCullFace((ob->type == OB_MBALL) ? GL_BACK : GL_FRONT);
-	}
 
 	if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
-		if (v3d->flag2 & V3D_BACKFACE_CULLING)
-			glDisable(GL_CULL_FACE);
-
-		return 0;
+		return FALSE;
 	}
 
 	switch (ob->type) {
@@ -4011,7 +3632,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 
 			if (solid) {
 				dl = lb->first;
-				if (dl == NULL) return 1;
+				if (dl == NULL) {
+					return TRUE;
+				}
 
 				if (dl->nors == NULL) BKE_displist_normals_add(lb);
 				index3_nors_incr = 0;
@@ -4045,9 +3668,11 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 			}
 			else {
 				if (!render_only || (render_only && BKE_displist_has_faces(lb))) {
+					int retval;
 					draw_index_wire = 0;
 					retval = drawDispListwire(lb);
 					draw_index_wire = 1;
+					return retval;
 				}
 			}
 			break;
@@ -4057,7 +3682,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 
 			if (solid) {
 				dl = lb->first;
-				if (dl == NULL) return 1;
+				if (dl == NULL) {
+					return TRUE;
+				}
 
 				if (dl->nors == NULL) BKE_displist_normals_add(lb);
 
@@ -4073,7 +3700,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 				}
 			}
 			else {
-				retval = drawDispListwire(lb);
+				return drawDispListwire(lb);
 			}
 			break;
 		case OB_MBALL:
@@ -4081,7 +3708,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 			if (BKE_mball_is_basis(ob)) {
 				lb = &ob->disp;
 				if (lb->first == NULL) BKE_displist_make_mball(scene, ob);
-				if (lb->first == NULL) return 1;
+				if (lb->first == NULL) {
+					return TRUE;
+				}
 
 				if (solid) {
 
@@ -4098,14 +3727,31 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 				}
 				else {
 					/* MetaBalls use DL_INDEX4 type of DispList */
-					retval = drawDispListwire(lb);
+					return drawDispListwire(lb);
 				}
 			}
 			break;
 	}
-	
-	if (v3d->flag2 & V3D_BACKFACE_CULLING)
+
+	return FALSE;
+}
+static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+                        const short dt, const short dflag, const unsigned char ob_wire_col[4])
+{
+	int retval;
+
+	/* backface culling */
+	if (v3d->flag2 & V3D_BACKFACE_CULLING) {
+		/* not all displists use same in/out normal direction convention */
+		glEnable(GL_CULL_FACE);
+		glCullFace((base->object->type == OB_MBALL) ? GL_BACK : GL_FRONT);
+	}
+
+	retval = drawDispList_nobackface(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
+
+	if (v3d->flag2 & V3D_BACKFACE_CULLING) {
 		glDisable(GL_CULL_FACE);
+	}
 
 	return retval;
 }
@@ -4810,7 +4456,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 
 		if (cdata2)
 			MEM_freeN(cdata2);
-		/* cd2= */ /* UNUSED */ cdata2 = NULL;
+		/* cd2 = */ /* UNUSED */ cdata2 = NULL;
 
 		glLineWidth(1.0f);
 
@@ -5866,7 +5512,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
 	glEnd();
 }
 
-/* draws a circle on x-z plane given the scaling of the circle, assuming that 
+/* draws a circle on x-z plane given the scaling of the circle, assuming that
  * all required matrices have been set (used for drawing empties)
  */
 static void drawcircle_size(float size)
@@ -5876,7 +5522,7 @@ static void drawcircle_size(float size)
 
 	glBegin(GL_LINE_LOOP);
 
-	/* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */
+	/* coordinates are: cos(degrees * 11.25) = x, sin(degrees*11.25) = y, 0.0f = z */
 	for (degrees = 0; degrees < CIRCLE_RESOL; degrees++) {
 		x = cosval[degrees];
 		y = sinval[degrees];
@@ -6923,7 +6569,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
 	/* code for new particle system */
 	if ((warning_recursive == 0) &&
 	    (ob->particlesystem.first) &&
-	    (dflag & DRAW_PICKING) == 0 &&
 	    (ob != scene->obedit)
 	    )
 	{
@@ -7011,72 +6656,76 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
 		}
 
 		/* only draw domains */
-		if (smd->domain && smd->domain->fluid) {
-			if (CFRA < smd->domain->point_cache[0]->startframe) {
-				/* don't show smoke before simulation starts, this could be made an option in the future */
-			}
-			else if (!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
-// #if 0
-				smd->domain->tex = NULL;
-				GPU_create_smoke(smd, 0);
-				draw_volume(ar, smd->domain->tex,
-				            smd->domain->p0, smd->domain->p1,
-				            smd->domain->res, smd->domain->dx,
-				            smd->domain->tex_shadow);
-				GPU_free_smoke(smd);
-// #endif
-#if 0
-				int x, y, z;
-				float *density = smoke_get_density(smd->domain->fluid);
+		if (smd->domain) {
+			SmokeDomainSettings *sds = smd->domain;
+			float p0[3], p1[3], viewnormal[3];
+			BoundBox bb;
 
-				glLoadMatrixf(rv3d->viewmat);
-				// glMultMatrixf(ob->obmat);
+			glLoadMatrixf(rv3d->viewmat);
+			glMultMatrixf(ob->obmat);
 
-				if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
-				glDepthMask(GL_FALSE);
-				glEnable(GL_BLEND);
-				
+			/* draw adaptive domain bounds */
+			if (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) {
+				/* draw domain max bounds */
+				VECSUBFAC(p0, sds->p0, sds->cell_size, sds->adapt_res);
+				VECADDFAC(p1, sds->p1, sds->cell_size, sds->adapt_res);
+				BKE_boundbox_init_from_minmax(&bb, p0, p1);
+				draw_box(bb.vec);
 
-				// glPointSize(3.0);
-				bglBegin(GL_POINTS);
+				/* draw base resolution bounds */
+#if 0
+				BKE_boundbox_init_from_minmax(&bb, sds->p0, sds->p1);
+				draw_box(bb.vec);
+#endif
+			}
 
-				for (x = 0; x < smd->domain->res[0]; x++) {
-					for (y = 0; y < smd->domain->res[1]; y++) {
-						for (z = 0; z < smd->domain->res[2]; z++) {
-							float tmp[3];
-							int index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z);
-
-							if (density[index] > FLT_EPSILON) {
-								float color[3];
-								copy_v3_v3(tmp, smd->domain->p0);
-								tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5;
-								tmp[1] += smd->domain->dx * y + smd->domain->dx * 0.5;
-								tmp[2] += smd->domain->dx * z + smd->domain->dx * 0.5;
-								color[0] = color[1] = color[2] = density[index];
-								glColor3fv(color);
-								bglVertex3fv(tmp);
-							}
-						}
-					}
+			/* don't show smoke before simulation starts, this could be made an option in the future */
+			if (smd->domain->fluid && CFRA >= smd->domain->point_cache[0]->startframe) {
+
+				// get view vector
+				copy_v3_v3(viewnormal, rv3d->viewinv[2]);
+				mul_mat3_m4_v3(ob->imat, viewnormal);
+				normalize_v3(viewnormal);
+
+				/* set dynamic boundaries to draw the volume */
+				p0[0] = sds->p0[0] + sds->cell_size[0] * sds->res_min[0] + sds->obj_shift_f[0];
+				p0[1] = sds->p0[1] + sds->cell_size[1] * sds->res_min[1] + sds->obj_shift_f[1];
+				p0[2] = sds->p0[2] + sds->cell_size[2] * sds->res_min[2] + sds->obj_shift_f[2];
+				p1[0] = sds->p0[0] + sds->cell_size[0] * sds->res_max[0] + sds->obj_shift_f[0];
+				p1[1] = sds->p0[1] + sds->cell_size[1] * sds->res_max[1] + sds->obj_shift_f[1];
+				p1[2] = sds->p0[2] + sds->cell_size[2] * sds->res_max[2] + sds->obj_shift_f[2];
+
+				/* scale cube to global space to equalize volume slicing on all axises
+				 *  (its scaled back before drawing) */
+				mul_v3_v3(p0, ob->size);
+				mul_v3_v3(p1, ob->size);
+
+				if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+					smd->domain->tex = NULL;
+					GPU_create_smoke(smd, 0);
+					draw_smoke_volume(sds, ob, sds->tex,
+					                  p0, p1,
+					                  sds->res, sds->dx, sds->scale * sds->maxres,
+					                  viewnormal, sds->tex_shadow, sds->tex_flame);
+					GPU_free_smoke(smd);
+				}
+				else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+					sds->tex = NULL;
+					GPU_create_smoke(smd, 1);
+					draw_smoke_volume(sds, ob, sds->tex,
+					                  p0, p1,
+					                  sds->res_wt, sds->dx, sds->scale * sds->maxres,
+					                  viewnormal, sds->tex_shadow, sds->tex_flame);
+					GPU_free_smoke(smd);
 				}
 
-				bglEnd();
-				glPointSize(1.0);
-
-				glMultMatrixf(ob->obmat);
-				glDisable(GL_BLEND);
-				glDepthMask(GL_TRUE);
-				if (col) cpack(col);
+				/* smoke debug render */
+#ifdef SMOKE_DEBUG_VELOCITY
+				draw_smoke_velocity(smd->domain, ob);
+#endif
+#ifdef SMOKE_DEBUG_HEAT
+				draw_smoke_heat(smd->domain, ob);
 #endif
-			}
-			else if (smd->domain->wt && (smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
-				smd->domain->tex = NULL;
-				GPU_create_smoke(smd, 1);
-				draw_volume(ar, smd->domain->tex,
-				            smd->domain->p0, smd->domain->p1,
-				            smd->domain->res_wt, smd->domain->dx_wt,
-				            smd->domain->tex_shadow);
-				GPU_free_smoke(smd);
 			}
 		}
 	}
@@ -7338,7 +6987,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
 	dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs);
 	bglEnd();
 	glPointSize(1.0);
-}		
+}
 
 static DMDrawOption bbs_mesh_wire__setDrawOptions(void *userData, int index)
 {
@@ -7358,7 +7007,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
 {
 	void *ptrs[2] = {(void *)(intptr_t) offset, em};
 	dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, ptrs);
-}		
+}
 
 static DMDrawOption bbs_mesh_solid__setSolidDrawOptions(void *userData, int index)
 {
@@ -7537,7 +7186,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 /*               assumes all matrices/etc set OK */
 
 /* helper function for drawing object instances - meshes */
-static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, 
+static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d,
                                       Object *ob, const short dt, int outline)
 {
 	Mesh *me = ob->data;
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 2c2d403..ebb4896 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -36,6 +36,7 @@
 
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_smoke_types.h"
 #include "DNA_view3d_types.h"
 
 #include "BLI_utildefines.h"
@@ -132,7 +133,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
 	int i;
 	float t;
 	int numpoints = 0;
-	
+
 	for (i = 0; i < 12; i++) {
 		t = -(a * edges[i][0][0] + b * edges[i][0][1] + c * edges[i][0][2] + d) /
 		     (a * edges[i][1][0] + b * edges[i][1][1] + c * edges[i][1][2]);
@@ -156,12 +157,12 @@ static int convex(const float p0[3], const float up[3], const float a[3], const
 	return dot_v3v3(up, tmp) >= 0;
 }
 
-void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int res[3], float dx, GPUTexture *tex_shadow)
+void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
+                       GPUTexture *tex, float min[3], float max[3],
+                       int res[3], float dx, float UNUSED(base_scale), float viewnormal[3],
+                       GPUTexture *tex_shadow, GPUTexture *tex_flame)
 {
-	RegionView3D *rv3d = ar->regiondata;
-
-	float viewnormal[3];
-	int i, j, n, good_index;
+	int i, j, k, n, good_index;
 	float d /*, d0 */ /* UNUSED */, dd, ds;
 	float *points = NULL;
 	int numpoints = 0;
@@ -193,25 +194,76 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 		{{-1.0f, 1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}}
 	};
 
+	unsigned char *spec_data;
+	float *spec_pixels;
+	GPUTexture *tex_spec;
+
 	/* Fragment program to calculate the view3d of smoke */
-	/* using 2 textures, density and shadow */
-	const char *text = "!!ARBfp1.0\n"
-	                   "PARAM dx = program.local[0];\n"
-	                   "PARAM darkness = program.local[1];\n"
-	                   "PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n"
-	                   "TEMP temp, shadow, value;\n"
-	                   "TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
-	                   "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
-	                   "MUL value, temp, darkness;\n"
-	                   "MUL value, value, dx;\n"
-	                   "MUL value, value, f;\n"
-	                   "EX2 temp, -value.r;\n"
-	                   "SUB temp.a, 1.0, temp.r;\n"
-	                   "MUL temp.r, temp.r, shadow.r;\n"
-	                   "MUL temp.g, temp.g, shadow.r;\n"
-	                   "MUL temp.b, temp.b, shadow.r;\n"
-	                   "MOV result.color, temp;\n"
-	                   "END\n";
+	/* using 4 textures, density, shadow, flame and flame spectrum */
+	const char *shader_basic =
+	        "!!ARBfp1.0\n"
+	        "PARAM dx = program.local[0];\n"
+	        "PARAM darkness = program.local[1];\n"
+	        "PARAM render = program.local[2];\n"
+	        "PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n"
+	        "TEMP temp, shadow, flame, spec, value;\n"
+	        "TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
+	        "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
+	        "TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
+	        "TEX spec, flame.r, texture[3], 1D;\n"
+	        /* calculate shading factor from density */
+	        "MUL value.r, temp.a, darkness.a;\n"
+	        "MUL value.r, value.r, dx.r;\n"
+	        "MUL value.r, value.r, f.r;\n"
+	        "EX2 temp, -value.r;\n"
+	        /* alpha */
+	        "SUB temp.a, 1.0, temp.r;\n"
+	        /* shade colors */
+	        "MUL temp.r, temp.r, shadow.r;\n"
+	        "MUL temp.g, temp.g, shadow.r;\n"
+	        "MUL temp.b, temp.b, shadow.r;\n"
+	        "MUL temp.r, temp.r, darkness.r;\n"
+	        "MUL temp.g, temp.g, darkness.g;\n"
+	        "MUL temp.b, temp.b, darkness.b;\n"
+	        /* for now this just replace smoke shading if rendering fire */
+	        "CMP result.color, render.r, temp, spec;\n"
+	        "END\n";
+
+	/* color shader */
+	const char *shader_color =
+	        "!!ARBfp1.0\n"
+	        "PARAM dx = program.local[0];\n"
+	        "PARAM darkness = program.local[1];\n"
+	        "PARAM render = program.local[2];\n"
+	        "PARAM f = {1.442695041, 1.442695041, 1.442695041, 1.442695041};\n"
+	        "TEMP temp, shadow, flame, spec, value;\n"
+	        "TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
+	        "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
+	        "TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
+	        "TEX spec, flame.r, texture[3], 1D;\n"
+	        /* unpremultiply volume texture */
+	        "RCP value.r, temp.a;\n"
+	        "MUL temp.r, temp.r, value.r;\n"
+	        "MUL temp.g, temp.g, value.r;\n"
+	        "MUL temp.b, temp.b, value.r;\n"
+	        /* calculate shading factor from density */
+	        "MUL value.r, temp.a, darkness.a;\n"
+	        "MUL value.r, value.r, dx.r;\n"
+	        "MUL value.r, value.r, f.r;\n"
+	        "EX2 value.r, -value.r;\n"
+	        /* alpha */
+	        "SUB temp.a, 1.0, value.r;\n"
+	        /* shade colors */
+	        "MUL temp.r, temp.r, shadow.r;\n"
+	        "MUL temp.g, temp.g, shadow.r;\n"
+	        "MUL temp.b, temp.b, shadow.r;\n"
+	        "MUL temp.r, temp.r, value.r;\n"
+	        "MUL temp.g, temp.g, value.r;\n"
+	        "MUL temp.b, temp.b, value.r;\n"
+	        /* for now this just replace smoke shading if rendering fire */
+	        "CMP result.color, render.r, temp, spec;\n"
+	        "END\n";
+
 	GLuint prog;
 
 	
@@ -223,6 +275,33 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 	}
 
 	tstart();
+	/* generate flame spectrum texture */
+	#define SPEC_WIDTH 256
+	#define FIRE_THRESH 7
+	#define MAX_FIRE_ALPHA 0.06f
+	#define FULL_ON_FIRE 100
+	spec_data = malloc(SPEC_WIDTH * 4 * sizeof(unsigned char));
+	flame_get_spectrum(spec_data, SPEC_WIDTH, 1500, 3000);
+	spec_pixels = malloc(SPEC_WIDTH * 4 * 16 * 16 * sizeof(float));
+	for (i = 0; i < 16; i++) {
+		for (j = 0; j < 16; j++) {
+			for (k = 0; k < SPEC_WIDTH; k++) {
+				int index = (j * SPEC_WIDTH * 16 + i * SPEC_WIDTH + k) * 4;
+				if (k >= FIRE_THRESH) {
+					spec_pixels[index] = ((float)spec_data[k * 4]) / 255.0f;
+					spec_pixels[index + 1] = ((float)spec_data[k * 4 + 1]) / 255.0f;
+					spec_pixels[index + 2] = ((float)spec_data[k * 4 + 2]) / 255.0f;
+					spec_pixels[index + 3] = MAX_FIRE_ALPHA * (
+					        (k > FULL_ON_FIRE) ? 1.0f : (k - FIRE_THRESH) / ((float)FULL_ON_FIRE - FIRE_THRESH));
+				}
+				else {
+					spec_pixels[index] = spec_pixels[index + 1] = spec_pixels[index + 2] = spec_pixels[index + 3] = 0.0f;
+				}
+			}
+		}
+	}
+
+	tex_spec = GPU_texture_create_1D(SPEC_WIDTH, spec_pixels, NULL);
 
 	sub_v3_v3v3(size, max, min);
 
@@ -296,32 +375,17 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 	glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend);
 	glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
 
-	glLoadMatrixf(rv3d->viewmat);
-	// glMultMatrixf(ob->obmat);	
-
 	glDepthMask(GL_FALSE);
 	glDisable(GL_DEPTH_TEST);
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-#if 0
-	printf("Viewinv:\n");
-	printf("%f, %f, %f\n", rv3d->viewinv[0][0], rv3d->viewinv[0][1], rv3d->viewinv[0][2]);
-	printf("%f, %f, %f\n", rv3d->viewinv[1][0], rv3d->viewinv[1][1], rv3d->viewinv[1][2]);
-	printf("%f, %f, %f\n", rv3d->viewinv[2][0], rv3d->viewinv[2][1], rv3d->viewinv[2][2]);
-#endif
-
-	/* get view vector */
-	copy_v3_v3(viewnormal, rv3d->viewinv[2]);
-	normalize_v3(viewnormal);
 
 	/* find cube vertex that is closest to the viewer */
 	for (i = 0; i < 8; i++) {
 		float x, y, z;
 
-		x = cv[i][0] - viewnormal[0]*size[0]*0.5f;
-		y = cv[i][1] - viewnormal[1]*size[1]*0.5f;
-		z = cv[i][2] - viewnormal[2]*size[2]*0.5f;
+		x = cv[i][0] - viewnormal[0] * size[0] * 0.5f;
+		y = cv[i][1] - viewnormal[1] * size[1] * 0.5f;
+		z = cv[i][2] - viewnormal[2] * size[2] * 0.5f;
 
 		if ((x >= min[0]) && (x <= max[0]) &&
 		    (y >= min[1]) && (y <= max[1]) &&
@@ -344,12 +408,19 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 		glGenProgramsARB(1, &prog);
 
 		glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);
-		glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(text), text);
+		/* set shader */
+		if (sds->active_fields & SM_ACTIVE_COLORS)
+			glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(shader_color), shader_color);
+		else
+			glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(shader_basic), shader_basic);
 
 		/* cell spacing */
 		glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, dx, dx, dx, 1.0);
 		/* custom parameter for smoke style (higher = thicker) */
-		glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0);
+		if (sds->active_fields & SM_ACTIVE_COLORS)
+			glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 1.0, 1.0, 1.0, 10.0);
+		else
+			glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, sds->active_color[0], sds->active_color[1], sds->active_color[2], 10.0);
 	}
 	else
 		printf("Your gfx card does not support 3D View smoke drawing.\n");
@@ -360,6 +431,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 	else
 		printf("No volume shadow\n");
 
+	if (tex_flame) {
+		GPU_texture_bind(tex_flame, 2);
+		GPU_texture_bind(tex_spec, 3);
+	}
+
 	if (!GPU_non_power_of_two_support()) {
 		cor[0] = (float)res[0] / (float)power_of_2_max_i(res[0]);
 		cor[1] = (float)res[1] / (float)power_of_2_max_i(res[1]);
@@ -373,7 +449,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 
 	/* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */
 	ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]);
-	dd = ds / 96.f;
+	dd = MAX3(sds->global_size[0], sds->global_size[1], sds->global_size[2]) / 128.f;
 	n = 0;
 	good_index = i;
 
@@ -416,14 +492,29 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 				}
 			}
 
-			// printf("numpoints: %d\n", numpoints);
+			/* render fire slice */
+			glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+			glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0);
+			glBegin(GL_POLYGON);
+			glColor3f(1.0, 1.0, 1.0);
+			for (i = 0; i < numpoints; i++) {
+				glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
+				             (points[i * 3 + 1] - min[1]) * cor[1] / size[1],
+				             (points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
+				glVertex3f(points[i * 3 + 0] / ob->size[0], points[i * 3 + 1] / ob->size[1], points[i * 3 + 2] / ob->size[2]);
+			}
+			glEnd();
+
+			/* render smoke slice */
+			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+			glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, -1.0, 0.0, 0.0, 0.0);
 			glBegin(GL_POLYGON);
 			glColor3f(1.0, 1.0, 1.0);
 			for (i = 0; i < numpoints; i++) {
 				glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
 				             (points[i * 3 + 1] - min[1]) * cor[1] / size[1],
 				             (points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
-				glVertex3f(points[i * 3 + 0], points[i * 3 + 1], points[i * 3 + 2]);
+				glVertex3f(points[i * 3 + 0] / ob->size[0], points[i * 3 + 1] / ob->size[1], points[i * 3 + 2] / ob->size[2]);
 			}
 			glEnd();
 		}
@@ -436,6 +527,14 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 	if (tex_shadow)
 		GPU_texture_unbind(tex_shadow);
 	GPU_texture_unbind(tex);
+	if (tex_flame) {
+		GPU_texture_unbind(tex_flame);
+		GPU_texture_unbind(tex_spec);
+	}
+	GPU_texture_free(tex_spec);
+
+	free(spec_data);
+	free(spec_pixels);
 
 	if (GLEW_ARB_fragment_program) {
 		glDisable(GL_FRAGMENT_PROGRAM_ARB);
@@ -451,6 +550,109 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
 
 	if (gl_depth) {
 		glEnable(GL_DEPTH_TEST);
-		glDepthMask(GL_TRUE);	
+		glDepthMask(GL_TRUE);
 	}
 }
+
+#ifdef SMOKE_DEBUG_VELOCITY
+void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob)
+{
+	float x, y, z;
+	float x0, y0, z0;
+	int *base_res = domain->base_res;
+	int *res = domain->res;
+	int *res_min = domain->res_min;
+	int *res_max = domain->res_max;
+	float *vel_x = smoke_get_velocity_x(domain->fluid);
+	float *vel_y = smoke_get_velocity_y(domain->fluid);
+	float *vel_z = smoke_get_velocity_z(domain->fluid);
+
+	float min[3];
+	float *cell_size = domain->cell_size;
+	float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f;
+	float vf = domain->scale / 16.f * 2.f; /* velocity factor */
+
+	glLineWidth(1.0f);
+
+	/* set first position so that it doesn't jump when domain moves */
+	x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
+	y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
+	z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
+	if (x0 < res_min[0]) x0 += step_size;
+	if (y0 < res_min[1]) y0 += step_size;
+	if (z0 < res_min[2]) z0 += step_size;
+	add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
+
+	for (x = floor(x0); x < res_max[0]; x += step_size)
+		for (y = floor(y0); y < res_max[1]; y += step_size)
+			for (z = floor(z0); z < res_max[2]; z += step_size) {
+				int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
+
+				float pos[3] = {min[0] + ((float)x + 0.5f) * cell_size[0], min[1] + ((float)y + 0.5f) * cell_size[1], min[2] + ((float)z + 0.5f) * cell_size[2]};
+				float vel = sqrtf(vel_x[index] * vel_x[index] + vel_y[index] * vel_y[index] + vel_z[index] * vel_z[index]);
+
+				/* draw heat as scaled "arrows" */
+				if (vel >= 0.01f) {
+					float col_g = 1.0f - vel;
+					CLAMP(col_g, 0.0f, 1.0f);
+					glColor3f(1.0f, col_g, 0.0f);
+					glPointSize(10.0f * vel);
+
+					glBegin(GL_LINES);
+					glVertex3f(pos[0], pos[1], pos[2]);
+					glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
+					glEnd();
+					glBegin(GL_POINTS);
+					glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
+					glEnd();
+				}
+			}
+}
+#endif
+
+#ifdef SMOKE_DEBUG_HEAT
+void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob)
+{
+	float x, y, z;
+	float x0, y0, z0;
+	int *base_res = domain->base_res;
+	int *res = domain->res;
+	int *res_min = domain->res_min;
+	int *res_max = domain->res_max;
+	float *heat = smoke_get_heat(domain->fluid);
+
+	float min[3];
+	float *cell_size = domain->cell_size;
+	float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f;
+	float vf = domain->scale / 16.f * 2.f; /* velocity factor */
+
+	/* set first position so that it doesn't jump when domain moves */
+	x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
+	y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
+	z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
+	if (x0 < res_min[0]) x0 += step_size;
+	if (y0 < res_min[1]) y0 += step_size;
+	if (z0 < res_min[2]) z0 += step_size;
+	add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
+
+	for (x = floor(x0); x < res_max[0]; x += step_size)
+		for (y = floor(y0); y < res_max[1]; y += step_size)
+			for (z = floor(z0); z < res_max[2]; z += step_size) {
+				int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
+
+				float pos[3] = {min[0] + ((float)x + 0.5f) * cell_size[0], min[1] + ((float)y + 0.5f) * cell_size[1], min[2] + ((float)z + 0.5f) * cell_size[2]};
+
+				/* draw heat as different sized points */
+				if (heat[index] >= 0.01f) {
+					float col_gb = 1.0f - heat[index];
+					CLAMP(col_gb, 0.0f, 1.0f);
+					glColor3f(1.0f, col_gb, col_gb);
+					glPointSize(24.0f * heat[index]);
+
+					glBegin(GL_POINTS);
+					glVertex3f(pos[0], pos[1], pos[2]);
+					glEnd();
+				}
+			}
+}
+#endif
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 236cbb8..1c31cd2 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -185,7 +185,7 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
 								ar_unlock_user = ar;
 								break;
 							}
-						} 
+						}
 					}
 				}
 
@@ -702,6 +702,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 		case NC_GEOM:
 			switch (wmn->data) {
 				case ND_DATA:
+				case ND_VERTEX_GROUP:
 				case ND_SELECT:
 					ED_region_tag_redraw(ar);
 					break;
@@ -719,10 +720,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 		case NC_BRUSH:
 			if (wmn->action == NA_EDITED)
 				ED_region_tag_redraw_overlay(ar);
-			break;			
+			break;
 		case NC_MATERIAL:
 			switch (wmn->data) {
 				case ND_SHADING_DRAW:
+				case ND_SHADING_LINKS:
 					ED_region_tag_redraw(ar);
 					break;
 			}
@@ -748,12 +750,12 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 					break;
 			}
 			break;
-		case NC_IMAGE:	
+		case NC_IMAGE:
 			/* this could be more fine grained checks if we had
 			 * more context than just the region */
 			ED_region_tag_redraw(ar);
 			break;
-		case NC_TEXTURE:	
+		case NC_TEXTURE:
 			/* same as above */
 			ED_region_tag_redraw(ar);
 			break;
@@ -882,7 +884,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 				case ND_KEYFRAME:
 					if (wmn->action == NA_EDITED)
 						ED_region_tag_redraw(ar);
-					break;	
+					break;
 			}
 			break;
 		case NC_SCENE:
@@ -920,6 +922,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 		case NC_GEOM:
 			switch (wmn->data) {
 				case ND_DATA:
+				case ND_VERTEX_GROUP:
 				case ND_SELECT:
 					ED_region_tag_redraw(ar);
 					break;
@@ -945,7 +948,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_GPENCIL:
-			if (wmn->data == ND_DATA)
+			if (wmn->data == ND_DATA || wmn->action == NA_EDITED)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -1119,16 +1122,21 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 		return 1;
 	}
 	else if (CTX_data_equals(member, "active_base")) {
-		if (scene->basact && (scene->basact->lay & lay))
-			if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
+		if (scene->basact && (scene->basact->lay & lay)) {
+			Object *ob = scene->basact->object;
+			/* if hidden but in edit mode, we still display, can happen with animation */
+			if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
 				CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact);
+		}
 		
 		return 1;
 	}
 	else if (CTX_data_equals(member, "active_object")) {
-		if (scene->basact && (scene->basact->lay & lay))
-			if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
+		if (scene->basact && (scene->basact->lay & lay)) {
+			Object *ob = scene->basact->object;
+			if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
 				CTX_data_id_pointer_set(result, &scene->basact->object->id);
+		}
 		
 		return 1;
 	}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 1f7bae0..bf14d91 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -158,7 +158,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 	TransformProperties *tfp;
 	float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES];
 	int tot, totedgedata, totcurvedata, totlattdata, totskinradius, totcurvebweight;
-	int meshdata = FALSE, i;
+	int meshdata = FALSE;
 	char defstr[320];
 	PointerRNA data_ptr;
 
@@ -439,7 +439,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 			uiDefButR(block, NUM, 0, "Radius", 0, yi -= buth + but_margin, 200, buth,
 			          &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
 			uiDefButR(block, NUM, 0, "Tilt", 0, yi -= buth + but_margin, 200, buth,
-			          &data_ptr, "tilt", 0, -M_PI * 2.0f, M_PI * 2.0f, 1, 3, NULL);
+			          &data_ptr, "tilt", 0, -M_PI * 2.0, M_PI * 2.0, 1, 3, NULL);
 		}
 		else if (totcurvedata > 1) {
 			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
@@ -450,8 +450,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 			          &(tfp->ve_median[C_RADIUS]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
 			but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"),
 			                0, yi -= buth + but_margin, 200, buth,
-			                &(tfp->ve_median[C_TILT]), -M_PI * 2.0f, M_PI * 2.0f, 1, 3,
-			                TIP_("Tilt (inclination) of curve control points"));
+			                &(tfp->ve_median[C_TILT]), -M_PI * 2.0, M_PI * 2.0, 1, 3,
+			                TIP_("Tilt of curve control points"));
 			uiButSetUnitType(but, PROP_UNIT_ROTATION);
 		}
 		/* Lattice... */
@@ -470,6 +470,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 
 	}
 	else { /* apply */
+		int i;
+
 		memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
 
 		if (v3d->flag & V3D_GLOBAL_STATS) {
@@ -485,10 +487,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 			Mesh *me = ob->data;
 			BMEditMesh *em = me->edit_btmesh;
 			BMesh *bm = em->bm;
-			BMVert *eve;
 			BMIter iter;
 
 			if (len_v3(&median[LOC_X]) > 0.000001f) {
+				BMVert *eve;
 
 				BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 					if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
@@ -1221,7 +1223,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
 	if (ob == NULL)
 		return;
 
-	lim = 10000.0f * MAX2(1.0f, v3d->grid);
+	lim = 10000.0f * max_ff(1.0f, v3d->grid);
 
 	block = uiLayoutGetBlock(pa->layout);
 	uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c5246b1..51261f4 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -95,6 +95,16 @@
 
 #include "view3d_intern.h"  /* own include */
 
+/* handy utility for drawing shapes in the viewport for arbitrary code.
+ * could add lines and points too */
+// #define DEBUG_DRAW
+#ifdef DEBUG_DRAW
+static void bl_debug_draw(void);
+/* add these locally when using these functions for testing */
+extern void bl_debug_draw_quad_clear(void);
+extern void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3]);
+extern void bl_debug_draw_edge_add(const float v0[3], const float v1[3]);
+#endif
 
 static void star_stuff_init_func(void)
 {
@@ -441,10 +451,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 }
 #undef GRID_MIN_PX
 
-float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
+/** could move this elsewhere, but tied into #ED_view3d_grid_scale */
+float ED_scene_grid_scale(Scene *scene, const char **grid_unit)
 {
-	float grid_scale = v3d->grid;
-
 	/* apply units */
 	if (scene->unit.system) {
 		void *usys;
@@ -456,11 +465,16 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
 			int i = bUnit_GetBaseUnit(usys);
 			if (grid_unit)
 				*grid_unit = bUnit_GetNameDisplay(usys, i);
-			grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
+			return (float)bUnit_GetScaler(usys, i) / scene->unit.scale_length;
 		}
 	}
 
-	return grid_scale;
+	return 1.0f;
+}
+
+float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
+{
+	return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
 }
 
 static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
@@ -523,7 +537,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 		GPU_print_error("sdsd");
 	}
 	
-	/* draw the Z axis line */	
+	/* draw the Z axis line */
 	/* check for the 'show Z axis' preference */
 	if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
 		int axis;
@@ -545,12 +559,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 			}
 		}
 	}
-
-
-
-
-	if (v3d->zbuf && scene->obedit) glDepthMask(1);
 	
+	if (v3d->zbuf && scene->obedit) glDepthMask(1);
 }
 
 static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
@@ -600,8 +610,8 @@ static void draw_view_axis(RegionView3D *rv3d)
 	mul_qt_v3(rv3d->viewquat, vec);
 	dx = vec[0] * k;
 	dy = vec[1] * k;
-
-	glColor4ub(220, 0, 0, bright);
+	
+	UI_ThemeColorShadeAlpha(TH_AXIS_X, 0, bright);
 	glBegin(GL_LINES);
 	glVertex2f(start, start + ydisp);
 	glVertex2f(start + dx, start + dy + ydisp);
@@ -620,8 +630,8 @@ static void draw_view_axis(RegionView3D *rv3d)
 	mul_qt_v3(rv3d->viewquat, vec);
 	dx = vec[0] * k;
 	dy = vec[1] * k;
-
-	glColor4ub(0, 220, 0, bright);
+	
+	UI_ThemeColorShadeAlpha(TH_AXIS_Y, 0, bright);
 	glBegin(GL_LINES);
 	glVertex2f(start, start + ydisp);
 	glVertex2f(start + dx, start + dy + ydisp);
@@ -640,7 +650,7 @@ static void draw_view_axis(RegionView3D *rv3d)
 	dx = vec[0] * k;
 	dy = vec[1] * k;
 
-	glColor4ub(30, 30, 220, bright);
+	UI_ThemeColorShadeAlpha(TH_AXIS_Z, 0, bright);
 	glBegin(GL_LINES);
 	glVertex2f(start, start + ydisp);
 	glVertex2f(start + dx, start + dy + ydisp);
@@ -1060,7 +1070,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
 
 static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 {
-	float fac, a;
+	float hmargin, vmargin;
 	float x1, x2, y1, y2;
 	float x1i, x2i, y1i, y2i;
 	float x3, y3, x4, y4;
@@ -1115,7 +1125,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 	}
 
 	/* edge */
-	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	
+	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
 	setlinestyle(0);
 
@@ -1214,20 +1224,15 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 		}
 
 		if (ca->flag & CAM_SHOWTITLESAFE) {
-			fac = 0.1;
-
-			a = fac * (x2 - x1);
-			x1 += a;
-			x2 -= a;
-
-			a = fac * (y2 - y1);
-			y1 += a;
-			y2 -= a;
-
 			UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
 
-			uiSetRoundBox(UI_CNR_ALL);
-			uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
+			hmargin = 0.1f  * (x2 - x1);
+			vmargin = 0.05f * (y2 - y1);
+			uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
+
+			hmargin = 0.035f * (x2 - x1);
+			vmargin = 0.035f * (y2 - y1);
+			uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
 		}
 		if (ca && (ca->flag & CAM_SHOWSENSOR)) {
 			/* determine sensor fit, and get sensor x/y, for auto fit we
@@ -1421,15 +1426,15 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
 	
 	ibuf = IMB_allocImBuf((xmaxc - xminc + 1), (ymaxc - yminc + 1), 32, IB_rect);
 
-	view3d_validate_backbuf(vc); 
-	
+	view3d_validate_backbuf(vc);
+
 	glReadPixels(vc->ar->winrct.xmin + xminc,
 	             vc->ar->winrct.ymin + yminc,
 	             (xmaxc - xminc + 1),
 	             (ymaxc - yminc + 1),
 	             GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 
-	glReadBuffer(GL_BACK);	
+	glReadBuffer(GL_BACK);
 
 	if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
 
@@ -1462,7 +1467,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
 
 /* smart function to sample a rect spiralling outside, nice for backbuf selection */
 unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int size,
-                                        unsigned int min, unsigned int max, int *dist, short strict,
+                                        unsigned int min, unsigned int max, float *r_dist, short strict,
                                         void *handle, unsigned int (*indextest)(void *handle, unsigned int index))
 {
 	struct ImBuf *buf;
@@ -1471,7 +1476,7 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
 	int a, b, rc, nr, amount, dirvec[4][2];
 	int distance = 0;
 	unsigned int index = 0;
-	short indexok = 0;	
+	short indexok = 0;
 
 	amount = (size - 1) / 2;
 
@@ -1500,13 +1505,13 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
 					if (strict) {
 						indexok =  indextest(handle, *tbuf - min + 1);
 						if (indexok) {
-							*dist = (short) sqrt( (float)distance);
+							*r_dist = sqrtf((float)distance);
 							index = *tbuf - min + 1;
 							goto exit; 
 						}
 					}
 					else {
-						*dist = (short) sqrt( (float)distance);  /* XXX, this distance is wrong - */
+						*r_dist = sqrtf((float)distance);  /* XXX, this distance is wrong - */
 						index = *tbuf - min + 1;  /* messy yah, but indices start at 1 */
 						goto exit;
 					}
@@ -1570,7 +1575,8 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
 					ibuf = NULL; /* frame is out of range, dont show */
 				}
 				else {
-					ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser);
+					ibuf = BKE_image_acquire_ibuf(ima, &bgpic->iuser, NULL);
+					freeibuf = ibuf;
 				}
 
 				image_aspect[0] = ima->aspx;
@@ -1640,7 +1646,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
 				/* apply offset last - camera offset is different to offset in blender units */
 				/* so this has some sane way of working - this matches camera's shift _exactly_ */
 				{
-					const float max_dim = maxf(x2 - x1, y2 - y1);
+					const float max_dim = max_ff(x2 - x1, y2 - y1);
 					const float xof_scale = bgpic->xof * max_dim;
 					const float yof_scale = bgpic->yof * max_dim;
 
@@ -1689,7 +1695,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
 				/* calc window coord */
 				initgrabz(rv3d, 0.0, 0.0, 0.0);
 				ED_view3d_win_to_delta(ar, mval_f, tvec);
-				fac = maxf(fabsf(tvec[0]), maxf(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */
+				fac = max_ff(fabsf(tvec[0]), max_ff(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */
 				fac = 1.0f / fac;
 
 				asp = (float)ibuf->y / (float)ibuf->x;
@@ -1717,7 +1723,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
 
 			/* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
 			if (zoomx < 1.0f || zoomy < 1.0f) {
-				float tzoom = minf(zoomx, zoomy);
+				float tzoom = min_ff(zoomx, zoomy);
 				int mip = 0;
 
 				if ((ibuf->userflags & IB_MIPMAP_INVALID) != 0) {
@@ -1929,10 +1935,17 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
 	for (; dob; dob_prev = dob, dob = dob_next, dob_next = dob_next ? dupli_step(dob_next->next) : NULL) {
 		tbase.object = dob->ob;
 
-		/* extra service: draw the duplicator in drawtype of parent */
-		/* MIN2 for the drawtype to allow bounding box objects in groups for lods */
-		dt = tbase.object->dt;   tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
-		dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx;
+		/* extra service: draw the duplicator in drawtype of parent, minimum taken
+		 * to allow e.g. boundbox box objects in groups for LOD */
+		dt = tbase.object->dt;
+		tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
+
+		/* inherit draw extra, but not if a boundbox under the assumption that this
+		 * is intended to speed up drawing, and drawing extra (especially wire) can
+		 * slow it down too much */
+		dtx = tbase.object->dtx;
+		if (tbase.object->dt != OB_BOUNDBOX)
+			tbase.object->dtx = base->object->dtx;
 
 		/* negative scale flag has to propagate */
 		transflag = tbase.object->transflag;
@@ -2024,7 +2037,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
 
 void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
 {
-	int x, y, w, h;	
+	int x, y, w, h;
 	rcti r;
 	/* clamp rect by area */
 
@@ -2122,7 +2135,7 @@ float view3d_depth_near(ViewDepths *d)
 	int i = (int)d->w * (int)d->h; /* cast to avoid short overflow */
 
 	/* far is both the starting 'far' value
-	 * and the closest value found. */	
+	 * and the closest value found. */
 	while (i--) {
 		depth = *depths++;
 		if ((depth < far) && (depth > near)) {
@@ -2138,7 +2151,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 	short zbuf = v3d->zbuf;
 	RegionView3D *rv3d = ar->regiondata;
 
-	setwinmatrixview3d(ar, v3d, NULL);  /* 0= no pick rect */
+	setwinmatrixview3d(ar, v3d, NULL);
 	setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls BKE_object_where_is_calc for camera... */
 
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
@@ -2173,7 +2186,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *))
 	U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
 	U.obcenter_dia = 0;
 	
-	setwinmatrixview3d(ar, v3d, NULL);  /* 0= no pick rect */
+	setwinmatrixview3d(ar, v3d, NULL);
 	setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls BKE_object_where_is_calc for camera... */
 	
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
@@ -2371,6 +2384,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 		mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat);
 		invert_m4_m4(rv3d.persinv, rv3d.viewinv);
 
+		/* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */
 		ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE, FALSE);
 		GPU_lamp_shadow_buffer_unbind(shadow->lamp);
 		
@@ -2460,7 +2474,7 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view
 	if (winmat)
 		copy_m4_m4(rv3d->winmat, winmat);
 	else
-		setwinmatrixview3d(ar, v3d, NULL);  /* NULL= no pickrect */
+		setwinmatrixview3d(ar, v3d, NULL);
 
 	/* setup view matrix */
 	if (viewmat)
@@ -2478,7 +2492,7 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view
 		/* note:  '1.0f / len_v3(v1)'  replaced  'len_v3(rv3d->viewmat[0])'
 		 * because of float point precision problems at large values [#23908] */
 		float v1[3], v2[3];
-		float len1, len2;
+		float len_px, len_sc;
 
 		v1[0] = rv3d->persmat[0][0];
 		v1[1] = rv3d->persmat[1][0];
@@ -2488,10 +2502,10 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view
 		v2[1] = rv3d->persmat[1][1];
 		v2[2] = rv3d->persmat[2][1];
 
-		len1 = 1.0f / len_v3(v1);
-		len2 = 1.0f / len_v3(v2);
+		len_px = 2.0f / sqrtf(min_ff(len_squared_v3(v1), len_squared_v3(v2)));
+		len_sc = (float)MAX2(ar->winx, ar->winy);
 
-		rv3d->pixsize = (2.0f * MAX2(len1, len2)) / (float)MAX2(ar->winx, ar->winy);
+		rv3d->pixsize = len_px / len_sc;
 	}
 }
 
@@ -2508,6 +2522,16 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
 	glLoadMatrixf(rv3d->viewmat);
 }
 
+void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
+{
+	/* shadow buffers, before we setup matrices */
+	if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
+		gpu_update_lamps_shadows(scene, v3d);
+}
+
+/* ED_view3d_draw_offscreen_init should be called before this to initialize
+ * stuff like shadow buffers
+ */
 void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
                               int winx, int winy, float viewmat[][4], float winmat[][4],
                               int do_bgpic, int colormanage_background)
@@ -2541,10 +2565,6 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 	/* free images which can have changed on frame-change
 	 * warning! can be slow so only free animated images - campbell */
 	GPU_free_images_anim();
-	
-	/* shadow buffers, before we setup matrices */
-	if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
-		gpu_update_lamps_shadows(scene, v3d);
 
 	/* set background color, fallback on the view background color
 	 * (if active clip is set but frame is failed to load fallback to horizon color as background) */
@@ -2687,6 +2707,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
 	if (ofs == NULL)
 		return NULL;
 
+	ED_view3d_draw_offscreen_init(scene, v3d);
+
 	GPU_offscreen_bind(ofs);
 
 	/* render 3d view */
@@ -2815,7 +2837,7 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
 	if (fps + 0.5f < (float)(FPS)) {
 		UI_ThemeColor(TH_REDALERT);
 		BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps);
-	} 
+	}
 	else {
 		UI_ThemeColor(TH_TEXT_HI);
 		BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps + 0.5f));
@@ -2853,14 +2875,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
 
 		engine = RE_engine_create(type);
 
-		engine->tile_x = ceil(ar->winx / (float)scene->r.xparts);
-		engine->tile_y = ceil(ar->winy / (float)scene->r.yparts);
-
-		/* clamp small tile sizes to prevent inefficient threading utilization
-		 * the same happens for final renders as well
-		 */
-		engine->tile_x = MAX2(engine->tile_x, 64);
-		engine->tile_y = MAX2(engine->tile_x, 64);
+		engine->tile_x = scene->r.tilex;
+		engine->tile_y = scene->r.tiley;
 
 		type->view_update(engine, C);
 
@@ -2878,12 +2894,20 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
 		rctf viewborder;
 		rcti cliprct;
 
-		ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+		if (rv3d->persp == RV3D_CAMOB) {
+			ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
 
-		cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
-		cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
-		cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);
-		cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
+			cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
+			cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
+			cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);
+			cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
+		}
+		else {
+			cliprct.xmin = v3d->render_border.xmin * ar->winx;
+			cliprct.xmax = v3d->render_border.xmax * ar->winx;
+			cliprct.ymin = v3d->render_border.ymin * ar->winy;
+			cliprct.ymax = v3d->render_border.ymax * ar->winy;
+		}
 
 		cliprct.xmin += ar->winrct.xmin;
 		cliprct.xmax += ar->winrct.xmin;
@@ -2983,10 +3007,11 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 		v3d->zbuf = FALSE;
 
 	/* enables anti-aliasing for 3D view drawing */
-#if 0
-	if (!(U.gameflags & USER_DISABLE_AA))
+	if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
+		// if (!(U.gameflags & USER_DISABLE_AA))
 		glEnable(GL_MULTISAMPLE_ARB);
-#endif
+	}
+
 
 	/* needs to be done always, gridview is adjusted in drawgrid() now */
 	rv3d->gridview = v3d->grid;
@@ -3099,12 +3124,13 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 
 	BIF_draw_manipulator(C);
 
-#if 0
 	/* Disable back anti-aliasing */
-	if (!(U.gameflags & USER_DISABLE_AA))
+	if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
+		// if (!(U.gameflags & USER_DISABLE_AA))
 		glDisable(GL_MULTISAMPLE_ARB);
-#endif
+	}
 
+	
 	if (v3d->zbuf) {
 		v3d->zbuf = FALSE;
 		glDisable(GL_DEPTH_TEST);
@@ -3127,50 +3153,64 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
 	View3D *v3d = CTX_wm_view3d(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
-	Object *ob;
-
-	if (rv3d->persp == RV3D_CAMOB)
+	if (rv3d->persp == RV3D_CAMOB) {
 		drawviewborder(scene, ar, v3d);
+	}
+	else if (v3d->flag2 & V3D_RENDER_BORDER) {
+		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+		setlinestyle(3);
+		cpack(0x4040FF);
+
+		glRectf(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
+		        v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
+
+		setlinestyle(0);
+		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+	}
 
 	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+		Object *ob;
+
 		/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
 		//	if (v3d->flag2 & V3D_DISPGP)
 		draw_gpencil_view3d(scene, v3d, ar, 0);
 
 		drawcursor(scene, ar, v3d);
+
+		if (U.uiflag & USER_SHOW_ROTVIEWICON)
+			draw_view_axis(rv3d);
+		else
+			draw_view_icon(rv3d);
+
+		ob = OBACT;
+		if (U.uiflag & USER_DRAWVIEWINFO)
+			draw_selected_name(scene, ob);
 	}
-	
-	if (U.uiflag & USER_SHOW_ROTVIEWICON)
-		draw_view_axis(rv3d);
-	else
-		draw_view_icon(rv3d);
-	
-	ob = OBACT;
-	if (U.uiflag & USER_DRAWVIEWINFO)
-		draw_selected_name(scene, ob);
 
 	if (rv3d->render_engine) {
 		view3d_main_area_draw_engine_info(rv3d, ar);
 		return;
 	}
 
-	if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_playing(wm)) {
-		draw_viewport_fps(scene, ar);
-	}
-	else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
-		draw_viewport_name(ar, v3d);
-	}
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+		if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_playing(wm)) {
+			draw_viewport_fps(scene, ar);
+		}
+		else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
+			draw_viewport_name(ar, v3d);
+		}
 
-	if (grid_unit) { /* draw below the viewport name */
-		char numstr[32] = "";
+		if (grid_unit) { /* draw below the viewport name */
+			char numstr[32] = "";
 
-		UI_ThemeColor(TH_TEXT_HI);
-		if (v3d->grid != 1.0f) {
-			BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
-		}
+			UI_ThemeColor(TH_TEXT_HI);
+			if (v3d->grid != 1.0f) {
+				BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
+			}
 
-		BLF_draw_default_ascii(22,  ar->winy - (USER_SHOW_VIEWPORTNAME ? 40 : 20), 0.0f,
-		                       numstr[0] ? numstr : grid_unit, sizeof(numstr));
+			BLF_draw_default_ascii(22,  ar->winy - (USER_SHOW_VIEWPORTNAME ? 40 : 20), 0.0f,
+			                       numstr[0] ? numstr : grid_unit, sizeof(numstr));
+		}
 	}
 }
 
@@ -3180,11 +3220,19 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
 	View3D *v3d = CTX_wm_view3d(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	const char *grid_unit = NULL;
-	int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
+	int draw_border = FALSE;
+
+	if (rv3d->persp == RV3D_CAMOB)
+		draw_border = scene->r.mode & R_BORDER;
+	else
+		draw_border = v3d->flag2 & V3D_RENDER_BORDER;
 
 	/* draw viewport using opengl */
 	if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
 		view3d_main_area_draw_objects(C, ar, &grid_unit);
+#ifdef DEBUG_DRAW
+		bl_debug_draw();
+#endif
 		ED_region_pixelspace(ar);
 	}
 
@@ -3197,3 +3245,76 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
 	v3d->flag |= V3D_INVALID_BACKBUF;
 }
 
+#ifdef DEBUG_DRAW
+/* debug drawing */
+#define _DEBUG_DRAW_QUAD_TOT 1024
+#define _DEBUG_DRAW_EDGE_TOT 1024
+static float _bl_debug_draw_quads[_DEBUG_DRAW_QUAD_TOT][4][3];
+static int   _bl_debug_draw_quads_tot = 0;
+static float _bl_debug_draw_edges[_DEBUG_DRAW_QUAD_TOT][2][3];
+static int   _bl_debug_draw_edges_tot = 0;
+
+void bl_debug_draw_quad_clear(void)
+{
+	_bl_debug_draw_quads_tot = 0;
+	_bl_debug_draw_edges_tot = 0;
+}
+void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3])
+{
+	if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_QUAD_TOT) {
+		printf("%s: max quad count hit %d!", __func__, _bl_debug_draw_quads_tot);
+	}
+	else {
+		float *pt = &_bl_debug_draw_quads[_bl_debug_draw_quads_tot][0][0];
+		copy_v3_v3(pt, v0); pt += 3;
+		copy_v3_v3(pt, v1); pt += 3;
+		copy_v3_v3(pt, v2); pt += 3;
+		copy_v3_v3(pt, v3); pt += 3;
+		_bl_debug_draw_quads_tot++;
+	}
+}
+void bl_debug_draw_edge_add(const float v0[3], const float v1[3])
+{
+	if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_EDGE_TOT) {
+		printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_edges_tot);
+	}
+	else {
+		float *pt = &_bl_debug_draw_edges[_bl_debug_draw_edges_tot][0][0];
+		copy_v3_v3(pt, v0); pt += 3;
+		copy_v3_v3(pt, v1); pt += 3;
+		_bl_debug_draw_edges_tot++;
+	}
+}
+static void bl_debug_draw(void)
+{
+	if (_bl_debug_draw_quads_tot) {
+		int i;
+		cpack(0x00FF0000);
+		glBegin(GL_LINE_LOOP);
+		for (i = 0; i < _bl_debug_draw_quads_tot; i ++) {
+			glVertex3fv(_bl_debug_draw_quads[i][0]);
+			glVertex3fv(_bl_debug_draw_quads[i][1]);
+			glVertex3fv(_bl_debug_draw_quads[i][2]);
+			glVertex3fv(_bl_debug_draw_quads[i][3]);
+		}
+		glEnd();
+	}
+	if (_bl_debug_draw_edges_tot) {
+		int i;
+		cpack(0x00FFFF00);
+		glBegin(GL_LINES);
+		for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
+			glVertex3fv(_bl_debug_draw_edges[i][0]);
+			glVertex3fv(_bl_debug_draw_edges[i][1]);
+		}
+		glEnd();
+		glPointSize(4.0);
+		glBegin(GL_POINTS);
+		for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
+			glVertex3fv(_bl_debug_draw_edges[i][0]);
+			glVertex3fv(_bl_debug_draw_edges[i][1]);
+		}
+		glEnd();
+	}
+}
+#endif
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 4e8981f..d45013c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -96,6 +96,7 @@ int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
 void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
 {
 	if (ED_view3d_camera_lock_check(v3d, rv3d)) {
+		rv3d->dist = ED_view3d_offset_distance(v3d->camera->obmat, rv3d->ofs);
 		ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
 	}
 }
@@ -894,6 +895,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 			/* changed since 2.4x, use the camera view */
 			if (vod->v3d->camera) {
+				rv3d->dist = ED_view3d_offset_distance(vod->v3d->camera->obmat, rv3d->ofs);
 				ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
 			}
 
@@ -921,7 +923,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		
 		return OPERATOR_FINISHED;
 	}
-	else {		
+	else {
 		/* add temp handler */
 		WM_event_add_modal_handler(C, op);
 
@@ -929,18 +931,6 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 }
 
-static int view3d_camera_active_poll(bContext *C)
-{
-	if (ED_operator_view3d_active(C)) {
-		RegionView3D *rv3d = CTX_wm_region_view3d(C);
-		if (rv3d && rv3d->persp == RV3D_CAMOB) {
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
 /* test for unlocked camera view in quad view */
 static int view3d_camera_user_poll(bContext *C)
 {
@@ -1002,8 +992,10 @@ void ndof_to_quat(struct wmNDOFMotionData *ndof, float q[4])
  * -- zooming
  * -- panning in rotationally-locked views
  */
-static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
+	ViewOpsData *vod = op->customdata;
+	
 	if (event->type != NDOF_MOTION)
 		return OPERATOR_CANCELLED;
 	else {
@@ -1084,6 +1076,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 					rot[1] = rot[2] = 0.0;
 					rot[3] = sin(angle);
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+					
 				}
 				else {
 					float rot[4];
@@ -1098,6 +1091,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 
 					if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
 						axis[1] = -axis[1];
+					
 
 					/* transform rotation axis from view to world coordinates */
 					mul_qt_v3(view_inv, axis);
@@ -1110,7 +1104,22 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 
 					/* apply rotation */
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
+					
+				}
+				
+				/* rotate around custom center */
+				if (vod && vod->use_dyn_ofs) {
+					float q1[4];
+					
+					/* compute the post multiplication quat, to rotate the offset correctly */
+					conjugate_qt_qt(q1, vod->oldquat);
+					mul_qt_qtqt(q1, q1, rv3d->viewquat);
+					
+					conjugate_qt(q1); /* conj == inv for unit quat */
+					copy_v3_v3(rv3d->ofs, vod->ofs);
+					sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+					mul_qt_v3(q1, rv3d->ofs);
+					add_v3_v3(rv3d->ofs, vod->dyn_ofs);
 				}
 			}
 		}
@@ -1277,6 +1286,9 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			float axis[3];
 #endif
 
+			/* inverse view */
+			invert_qt_qt(view_inv, rv3d->viewquat);
+			
 			if (U.ndof_flag & NDOF_PANX_INVERT_AXIS)
 				pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
 			else
@@ -1295,12 +1307,11 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			mul_v3_fl(pan_vec, speed * dt);
 
 			/* transform motion from view to world coordinates */
-			invert_qt_qt(view_inv, rv3d->viewquat);
 			mul_qt_v3(view_inv, pan_vec);
 
 			/* move center of view opposite of hand motion (this is camera mode, not object mode) */
 			sub_v3_v3(rv3d->ofs, pan_vec);
-
+			
 			if (U.ndof_flag & NDOF_TURNTABLE) {
 				/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
 				float angle, rot[4];
@@ -1360,13 +1371,29 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 				/* apply rotation */
 				mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
+				
+			}
+			
+			/* rotate around custom center */
+			if (vod && vod->use_dyn_ofs) {
+				float q1[4];
+				
+				/* compute the post multiplication quat, to rotate the offset correctly */
+				conjugate_qt_qt(q1, vod->oldquat);
+				mul_qt_qtqt(q1, q1, rv3d->viewquat);
+				
+				conjugate_qt(q1); /* conj == inv for unit quat */
+				copy_v3_v3(rv3d->ofs, vod->ofs);
+				sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+				mul_qt_v3(q1, rv3d->ofs);
+				add_v3_v3(rv3d->ofs, vod->dyn_ofs);
 			}
+
 		}
 		ED_view3d_camera_lock_sync(v3d, rv3d);
 
 		ED_region_tag_redraw(CTX_wm_region(C));
-		viewops_data_free(C, op);	
+		viewops_data_free(C, op);
 		return OPERATOR_FINISHED;
 	}
 }
@@ -1513,7 +1540,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		viewmove_apply(vod, event->prevx, event->prevy);
 		ED_view3d_depth_tag_update(vod->rv3d);
 		
-		viewops_data_free(C, op);		
+		viewops_data_free(C, op);
 		
 		return OPERATOR_FINISHED;
 	}
@@ -1626,7 +1653,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
 }
 
 
-static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, const short zoom_invert)
+static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const short viewzoom, const short zoom_invert)
 {
 	float zfac = 1.0;
 	short use_cam_zoom;
@@ -1636,7 +1663,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
 	if (use_cam_zoom) {
 		float delta;
 		delta = (x - vod->origx + y - vod->origy) / 10.0f;
-		vod->rv3d->camzoom = vod->camzoom0 + (zoom_invert ? delta : -delta);
+		vod->rv3d->camzoom = vod->camzoom0 + (zoom_invert ? -delta : delta);
 
 		CLAMP(vod->rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
 	}
@@ -1647,10 +1674,10 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
 		float fac;
 
 		if (U.uiflag & USER_ZOOM_HORIZ) {
-			fac = (float)(x - vod->origx);
+			fac = (float)(vod->origx - x);
 		}
 		else {
-			fac = (float)(y - vod->origy);
+			fac = (float)(vod->origy - y);
 		}
 
 		if (zoom_invert) {
@@ -1691,11 +1718,11 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
 		if (use_cam_zoom) {
 			/* zfac is ignored in this case, see below */
 #if 0
-			zfac = vod->camzoom0 * (2.0f * ((len2 / len1) - 1.0f) + 1.0f) / vod->rv3d->camzoom;
+			zfac = vod->camzoom0 * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->camzoom;
 #endif
 		}
 		else {
-			zfac = vod->dist0 * (2.0f * ((len2 / len1) - 1.0f) + 1.0f) / vod->rv3d->dist;
+			zfac = vod->dist0 * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->dist;
 		}
 	}
 
@@ -1888,12 +1915,12 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 			if (U.uiflag & USER_ZOOM_HORIZ) {
 				vod->origx = vod->oldx = event->x;
-				viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE);
+				viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, (U.uiflag & USER_ZOOM_INVERT) == 0);
 			}
 			else {
 				/* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
 				vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
-				viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE);
+				viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, (U.uiflag & USER_ZOOM_INVERT) == 0);
 			}
 			ED_view3d_depth_tag_update(vod->rv3d);
 			
@@ -1971,7 +1998,7 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
 		if (zoom_invert)
 			SWAP(float, len1, len2);
 
-		zfac =  1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist);
+		zfac =  1.0f + ((len1 - len2) * 0.01f * vod->rv3d->dist);
 	}
 
 	if (zfac != 1.0f)
@@ -2051,7 +2078,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
 		normalize_v3(mousevec);
 	}
 
-	/* v3d= sa->spacedata.first; */ /* UNUSED */
+	/* v3d = sa->spacedata.first; */ /* UNUSED */
 	rv3d = ar->regiondata;
 
 	/* overwrite the mouse vector with the view direction (zoom into the center) */
@@ -2107,13 +2134,13 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 			if (U.uiflag & USER_ZOOM_HORIZ) {
 				vod->origx = vod->oldx = event->x;
-				viewdolly_apply(vod, event->prevx, event->prevy, FALSE);
+				viewdolly_apply(vod, event->prevx, event->prevy, (U.uiflag & USER_ZOOM_INVERT) == 0);
 			}
 			else {
 
 				/* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
 				vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
-				viewdolly_apply(vod, event->prevx, event->prevy, FALSE);
+				viewdolly_apply(vod, event->prevx, event->prevy, (U.uiflag & USER_ZOOM_INVERT) == 0);
 			}
 			ED_view3d_depth_tag_update(vod->rv3d);
 
@@ -2178,21 +2205,112 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
 	RNA_def_int(ot->srna, "my", 0, 0, INT_MAX, "Zoom Position Y", "", 0, INT_MAX);
 }
 
+static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
+                                          const float min[3], const float max[3],
+                                          int ok_dist)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	float afm[3];
+	float size;
+
+	/* SMOOTHVIEW */
+	float new_ofs[3];
+	float new_dist;
+
+	sub_v3_v3v3(afm, max, min);
+	size = MAX3(afm[0], afm[1], afm[2]);
+
+	if (ok_dist) {
+		/* fix up zoom distance if needed */
+
+		if (rv3d->is_persp) {
+			float lens, sensor_size;
+			/* offset the view based on the lens */
+			if (rv3d->persp == RV3D_CAMOB && ED_view3d_camera_lock_check(v3d, rv3d)) {
+				CameraParams params;
+				BKE_camera_params_init(&params);
+				BKE_camera_params_from_object(&params, v3d->camera);
+
+				lens = params.lens;
+				sensor_size = BKE_camera_sensor_size(params.sensor_fit, params.sensor_x, params.sensor_y);
+			}
+			else {
+				lens = v3d->lens;
+				sensor_size = DEFAULT_SENSOR_WIDTH;
+			}
+			size = ED_view3d_radius_to_persp_dist(focallength_to_fov(lens, sensor_size), size / 2.0f) * VIEW3D_MARGIN;
+
+			/* do not zoom closer than the near clipping plane */
+			size = max_ff(size, v3d->near * 1.5f);
+		}
+		else { /* ortho */
+			if (size < 0.0001f) {
+				/* bounding box was a single point so do not zoom */
+				ok_dist = 0;
+			}
+			else {
+				/* adjust zoom so it looks nicer */
+				size = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
+			}
+		}
+	}
+
+	mid_v3_v3v3(new_ofs, min, max);
+	negate_v3(new_ofs);
 
+	new_dist = size;
+
+	/* correction for window aspect ratio */
+	if (ar->winy > 2 && ar->winx > 2) {
+		size = (float)ar->winx / (float)ar->winy;
+		if (size < 1.0f) size = 1.0f / size;
+		new_dist *= size;
+	}
+
+	if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
+		rv3d->persp = RV3D_PERSP;
+		view3d_smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+	}
+	else {
+		view3d_smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+	}
+
+	/* smooth view does viewlock RV3D_BOXVIEW copy */
+}
+
+/* same as view3d_from_minmax but for all regions (except cameras) */
+static void view3d_from_minmax_multi(bContext *C, View3D *v3d,
+                                     const float min[3], const float max[3],
+                                     const int ok_dist)
+{
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3d = ar->regiondata;
+			/* when using all regions, don't jump out of camera view,
+			 * but _do_ allow locked cameras to be moved */
+			if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
+				view3d_from_minmax(C, v3d, ar, min, max, ok_dist);
+			}
+		}
+	}
+}
 
 static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
 {
 	ARegion *ar = CTX_wm_region(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	Scene *scene = CTX_data_scene(C);
 	Base *base;
 	float *curs;
-	const short skip_camera = ED_view3d_camera_lock_check(v3d, rv3d);
-
+	const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+	const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+	                           /* any one of the regions may be locked */
+	                           (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
 	int center = RNA_boolean_get(op->ptr, "center");
 
-	float size, min[3], max[3], afm[3];
+	float min[3], max[3];
 	int ok = 1, onedone = FALSE;
 
 	if (center) {
@@ -2229,37 +2347,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 		return OPERATOR_FINISHED;
 	}
 
-	sub_v3_v3v3(afm, max, min);
-	size = 0.7f * MAX3(afm[0], afm[1], afm[2]);
-	if (size == 0.0f) ok = 0;
-
-	if (ok) {
-		float new_dist;
-		float new_ofs[3];
-
-		new_dist = size;
-		new_ofs[0] = -(min[0] + max[0]) / 2.0f;
-		new_ofs[1] = -(min[1] + max[1]) / 2.0f;
-		new_ofs[2] = -(min[2] + max[2]) / 2.0f;
-
-		/* correction for window aspect ratio */
-		if (ar->winy > 2 && ar->winx > 2) {
-			size = (float)ar->winx / (float)ar->winy;
-			if (size < 1.0f) size = 1.0f / size;
-			new_dist *= size;
-		}
-
-		if ((rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(v3d, rv3d)) {
-			rv3d->persp = RV3D_PERSP;
-			view3d_smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
-		}
-		else {
-			view3d_smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
-		}
+	if (ok == 0) {
+		return OPERATOR_FINISHED;
 	}
-// XXX	BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
 
-	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+	if (use_all_regions) {
+		view3d_from_minmax_multi(C, v3d, min, max, TRUE);
+	}
+	else {
+		view3d_from_minmax(C, v3d, ar, min, max, TRUE);
+	}
 
 	return OPERATOR_FINISHED;
 }
@@ -2267,6 +2364,8 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 
 void VIEW3D_OT_view_all(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name = "View All";
 	ot->description = "View all objects in scene";
@@ -2279,25 +2378,25 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
 	/* flags */
 	ot->flag = 0;
 
+	prop = RNA_def_boolean(ot->srna, "use_all_regions", 0, "All Regions", "View selected for all regions");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 	RNA_def_boolean(ot->srna, "center", 0, "Center", "");
 }
 
 /* like a localview without local!, was centerview() in 2.4x */
-static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
+static int viewselected_exec(bContext *C, wmOperator *op)
 {
 	ARegion *ar = CTX_wm_region(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	Scene *scene = CTX_data_scene(C);
 	Object *ob = OBACT;
 	Object *obedit = CTX_data_edit_object(C);
-	float size, min[3], max[3], afm[3];
+	float min[3], max[3];
 	int ok = 0, ok_dist = 1;
-	const short skip_camera = ED_view3d_camera_lock_check(v3d, rv3d);
-
-	/* SMOOTHVIEW */
-	float new_ofs[3];
-	float new_dist;
+	const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+	const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+	                           /* any one of the regions may be locked */
+	                           (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
 
 	INIT_MINMAX(min, max);
 
@@ -2368,54 +2467,17 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 		}
 	}
 
-	if (ok == 0) return OPERATOR_FINISHED;
-
-	sub_v3_v3v3(afm, max, min);
-	size = MAX3(afm[0], afm[1], afm[2]);
-
-	if (ok_dist) {
-		/* fix up zoom distance if needed */
-
-		if (rv3d->is_persp) {
-			if (size <= v3d->near * 1.5f) {
-				/* do not zoom closer than the near clipping plane */
-				size = v3d->near * 1.5f;
-			}
-		}
-		else { /* ortho */
-			if (size < 0.0001f) {
-				/* bounding box was a single point so do not zoom */
-				ok_dist = 0;
-			}
-			else {
-				/* adjust zoom so it looks nicer */
-				size *= 0.7f;
-			}
-		}
-	}
-
-	add_v3_v3v3(new_ofs, min, max);
-	mul_v3_fl(new_ofs, -0.5f);
-
-	new_dist = size;
-
-	/* correction for window aspect ratio */
-	if (ar->winy > 2 && ar->winx > 2) {
-		size = (float)ar->winx / (float)ar->winy;
-		if (size < 1.0f) size = 1.0f / size;
-		new_dist *= size;
+	if (ok == 0) {
+		return OPERATOR_FINISHED;
 	}
 
-	if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
-		rv3d->persp = RV3D_PERSP;
-		view3d_smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+	if (use_all_regions) {
+		view3d_from_minmax_multi(C, v3d, min, max, ok_dist);
 	}
 	else {
-		view3d_smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+		view3d_from_minmax(C, v3d, ar, min, max, ok_dist);
 	}
 
-	/* smooth view does viewlock RV3D_BOXVIEW copy */
-	
 // XXX	BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
 
 	return OPERATOR_FINISHED;
@@ -2423,6 +2485,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 
 void VIEW3D_OT_view_selected(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
 
 	/* identifiers */
 	ot->name = "View Selected";
@@ -2435,6 +2498,10 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
 
 	/* flags */
 	ot->flag = 0;
+
+	/* rna later */
+	prop = RNA_def_boolean(ot->srna, "use_all_regions", 0, "All Regions", "View selected for all regions");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 static int view_lock_clear_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2577,7 +2644,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
 	xfac = (float)ar->winx / (float)(size[0] + 4);
 	yfac = (float)ar->winy / (float)(size[1] + 4);
 
-	rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(minf(xfac, yfac));
+	rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(min_ff(xfac, yfac));
 	CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
 
 	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
@@ -2607,42 +2674,71 @@ static int render_border_exec(bContext *C, wmOperator *op)
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar = CTX_wm_region(C);
 	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
+
 	Scene *scene = CTX_data_scene(C);
 
 	rcti rect;
-	rctf vb;
+	rctf vb, border;
+
+	int camera_only = RNA_boolean_get(op->ptr, "camera_only");
+
+	if (camera_only && rv3d->persp != RV3D_CAMOB)
+		return OPERATOR_PASS_THROUGH;
 
 	/* get border select values using rna */
 	WM_operator_properties_border_to_rcti(op, &rect);
 
 	/* calculate range */
-	ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
 
-	scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb);
-	scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_rctf_size_y(&vb);
-	scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_rctf_size_x(&vb);
-	scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_rctf_size_y(&vb);
+	if (rv3d->persp == RV3D_CAMOB) {
+		ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
+	}
+	else {
+		vb.xmin = 0;
+		vb.ymin = 0;
+		vb.xmax = ar->winx;
+		vb.ymax = ar->winy;
+	}
+
+	border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb);
+	border.ymin = ((float)rect.ymin - vb.ymin) / BLI_rctf_size_y(&vb);
+	border.xmax = ((float)rect.xmax - vb.xmin) / BLI_rctf_size_x(&vb);
+	border.ymax = ((float)rect.ymax - vb.ymin) / BLI_rctf_size_y(&vb);
 
 	/* actually set border */
-	CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
-	CLAMP(scene->r.border.ymin, 0.0f, 1.0f);
-	CLAMP(scene->r.border.xmax, 0.0f, 1.0f);
-	CLAMP(scene->r.border.ymax, 0.0f, 1.0f);
+	CLAMP(border.xmin, 0.0f, 1.0f);
+	CLAMP(border.ymin, 0.0f, 1.0f);
+	CLAMP(border.xmax, 0.0f, 1.0f);
+	CLAMP(border.ymax, 0.0f, 1.0f);
+
+	if (rv3d->persp == RV3D_CAMOB) {
+		scene->r.border = border;
+
+		WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+	}
+	else {
+		v3d->render_border = border;
+
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+	}
 
 	/* drawing a border surrounding the entire camera view switches off border rendering
 	 * or the border covers no pixels */
-	if ((scene->r.border.xmin <= 0.0f && scene->r.border.xmax >= 1.0f &&
-	     scene->r.border.ymin <= 0.0f && scene->r.border.ymax >= 1.0f) ||
-	    (scene->r.border.xmin == scene->r.border.xmax ||
-	     scene->r.border.ymin == scene->r.border.ymax))
+	if ((border.xmin <= 0.0f && border.xmax >= 1.0f &&
+	     border.ymin <= 0.0f && border.ymax >= 1.0f) ||
+	    (border.xmin == border.xmax || border.ymin == border.ymax))
 	{
-		scene->r.mode &= ~R_BORDER;
+		if (rv3d->persp == RV3D_CAMOB)
+			scene->r.mode &= ~R_BORDER;
+		else
+			v3d->flag2 &= ~V3D_RENDER_BORDER;
 	}
 	else {
-		scene->r.mode |= R_BORDER;
+		if (rv3d->persp == RV3D_CAMOB)
+			scene->r.mode |= R_BORDER;
+		else
+			v3d->flag2 |= V3D_RENDER_BORDER;
 	}
-	
-	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
 	return OPERATOR_FINISHED;
 
@@ -2652,7 +2748,7 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Set Render Border";
-	ot->description = "Set the boundaries of the border render and enables border render";
+	ot->description = "Set the boundaries of the border render and enable border render";
 	ot->idname = "VIEW3D_OT_render_border";
 
 	/* api callbacks */
@@ -2661,7 +2757,7 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
 	ot->modal = WM_border_select_modal;
 	ot->cancel = WM_border_select_cancel;
 
-	ot->poll = view3d_camera_active_poll;
+	ot->poll = ED_operator_view3d_active;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2669,7 +2765,56 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
 	/* rna */
 	WM_operator_properties_border(ot);
 
+	RNA_def_boolean(ot->srna, "camera_only", 0, "Camera Only", "Set render border for camera view and final render only");
 }
+
+/* ********************* Clear render border operator ****************** */
+
+static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
+
+	Scene *scene = CTX_data_scene(C);
+	rctf *border = NULL;
+
+	if (rv3d->persp == RV3D_CAMOB) {
+		scene->r.mode &= ~R_BORDER;
+		border = &scene->r.border;
+
+		WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+	}
+	else {
+		v3d->flag2 &= ~V3D_RENDER_BORDER;
+		border = &v3d->render_border;
+
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+	}
+
+	border->xmin = 0.0f;
+	border->ymin = 0.0f;
+	border->xmax = 1.0f;
+	border->ymax = 1.0f;
+
+	return OPERATOR_FINISHED;
+
+}
+
+void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Clear Render Border";
+	ot->description = "Clear the boundaries of the border render and disable border render";
+	ot->idname = "VIEW3D_OT_clear_render_border";
+
+	/* api callbacks */
+	ot->exec = clear_render_border_exec;
+	ot->poll = ED_operator_view3d_active;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
 /* ********************* Border Zoom operator ****************** */
 
 static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
@@ -2728,7 +2873,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 
 		/* no depths to use, we cant do anything! */
 		if (depth_close == FLT_MAX) {
-			BKE_report(op->reports, RPT_ERROR, "Depth Too Large");
+			BKE_report(op->reports, RPT_ERROR, "Depth too large");
 			return OPERATOR_CANCELLED;
 		}
 		/* convert border to 3d coordinates */
@@ -2787,7 +2932,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 		/* work out the ratios, so that everything selected fits when we zoom */
 		xscale = (BLI_rcti_size_x(&rect) / vb[0]);
 		yscale = (BLI_rcti_size_y(&rect) / vb[1]);
-		new_dist *= maxf(xscale, yscale);
+		new_dist *= max_ff(xscale, yscale);
 
 		/* zoom in as required, or as far as we can go */
 		dist_range_min = 0.001f * v3d->grid;
@@ -3832,6 +3977,18 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m
 	return (*depth == FLT_MAX) ? 0 : 1;
 }
 
+float ED_view3d_offset_distance(float mat[4][4], float ofs[3]) {
+	float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+	float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f};
+
+	mul_m4_v4(mat, pos);
+	add_v3_v3(pos, ofs);
+	mul_m4_v4(mat, dir);
+	normalize_v3(dir);
+
+	return dot_v3v3(pos, dir);
+}
+
 /**
  * Set the view transformation from a 4x4 matrix.
  *
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index c743b88..cddfae5 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -27,7 +27,7 @@
 /* defines VIEW3D_OT_fly modal operator */
 
 //#define NDOF_FLY_DEBUG
-//#define NDOF_FLY_DRAW_TOOMUCH // is this needed for ndof? - commented so redraw doesnt thrash - campbell
+//#define NDOF_FLY_DRAW_TOOMUCH  /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */
 #include "DNA_anim_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
@@ -284,6 +284,11 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
 	puts("\n-- fly begin --");
 #endif
 
+	/* sanity check: for rare but possible case (if lib-linking the camera fails) */
+	if ((fly->rv3d->persp == RV3D_CAMOB) && (fly->v3d->camera == NULL)) {
+		fly->rv3d->persp = RV3D_PERSP;
+	}
+
 	if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) {
 		BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
 		return FALSE;
@@ -364,8 +369,6 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
 		}
 
 		/* store the original camera loc and rot */
-		/* TODO. axis angle etc */
-
 		fly->obtfm = BKE_object_tfm_backup(ob_back);
 
 		BKE_object_where_is_calc(fly->scene, fly->v3d->camera);
@@ -421,7 +424,6 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 	ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel);
 
 	rv3d->dist = fly->dist_backup;
-
 	if (fly->state == FLY_CANCEL) {
 		/* Revert to original view? */
 		if (fly->persp_backup == RV3D_CAMOB) { /* a camera view */
@@ -436,12 +438,16 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 		else {
 			/* Non Camera we need to reset the view back to the original location bacause the user canceled*/
 			copy_qt_qt(rv3d->viewquat, fly->rot_backup);
-			copy_v3_v3(rv3d->ofs, fly->ofs_backup);
 			rv3d->persp = fly->persp_backup;
 		}
+		/* always, is set to zero otherwise */
+		copy_v3_v3(rv3d->ofs, fly->ofs_backup);
 	}
 	else if (fly->persp_backup == RV3D_CAMOB) { /* camera */
 		DAG_id_tag_update(fly->root_parent ? &fly->root_parent->id : &v3d->camera->id, OB_RECALC_OB);
+		
+		/* always, is set to zero otherwise */
+		copy_v3_v3(rv3d->ofs, fly->ofs_backup);
 	}
 	else { /* not camera */
 
@@ -548,7 +554,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 				time_wheel = (float)(time_currwheel - fly->time_lastwheel);
 				fly->time_lastwheel = time_currwheel;
 				/* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast) */
-				time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+				time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
 
 				if (fly->speed < 0.0f) {
 					fly->speed = 0.0f;
@@ -566,7 +572,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 				time_currwheel = PIL_check_seconds_timer();
 				time_wheel = (float)(time_currwheel - fly->time_lastwheel);
 				fly->time_lastwheel = time_currwheel;
-				time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+				time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
 
 				if (fly->speed > 0.0f) {
 					fly->speed = 0;
@@ -790,8 +796,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
 	ymargin = ar->winy / 20.0f;
 
 	// UNUSED
-	// cent_orig[0]= ar->winrct.xmin + ar->winx/2;
-	// cent_orig[1]= ar->winrct.ymin + ar->winy/2;
+	// cent_orig[0] = ar->winrct.xmin + ar->winx / 2;
+	// cent_orig[1] = ar->winrct.ymin + ar->winy / 2;
 
 	{
 
@@ -842,7 +848,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
 #endif
 			time_current = PIL_check_seconds_timer();
 			time_redraw = (float)(time_current - fly->time_lastdraw);
-			time_redraw_clamped = minf(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
+			time_redraw_clamped = min_ff(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
 			fly->time_lastdraw = time_current;
 
 			/* Scale the time to use shift to scale the speed down- just like
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index b2ae63d..79bf003 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -167,7 +167,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
 		}
 		else {
 			v3d->lay |= (1 << 20) - 1;
-		}		
+		}
 	}
 	else {
 		int bit;
@@ -310,21 +310,14 @@ static char *view3d_modeselect_pup(Scene *scene)
 	return (string);
 }
 
-
 static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
 {
 	wmWindow *win = CTX_wm_window(C);
-	ToolSettings *ts = CTX_data_tool_settings(C);
 	ScrArea *sa = CTX_wm_area(C);
 	View3D *v3d = sa->spacedata.first;
-	Object *obedit = CTX_data_edit_object(C);
-	BMEditMesh *em = NULL;
-	int ctrl = win->eventstate->ctrl, shift = win->eventstate->shift;
+	const int ctrl = win->eventstate->ctrl, shift = win->eventstate->shift;
 	PointerRNA props_ptr;
-	
-	if (obedit && obedit->type == OB_MESH) {
-		em = BMEdit_FromObject(obedit);
-	}
+
 	/* watch it: if sa->win does not exist, check that when calling direct drawing routines */
 
 	switch (event) {
@@ -336,42 +329,17 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
 			break;
 
 		case B_SEL_VERT:
-			if (em) {
-				if (shift == 0 || em->selectmode == 0)
-					em->selectmode = SCE_SELECT_VERTEX;
-				ts->selectmode = em->selectmode;
-				EDBM_selectmode_set(em);
-				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+			if (EDBM_selectmode_toggle(C, SCE_SELECT_VERTEX, -1, shift, ctrl)) {
 				ED_undo_push(C, "Selectmode Set: Vertex");
 			}
 			break;
 		case B_SEL_EDGE:
-			if (em) {
-				if (shift == 0 || em->selectmode == 0) {
-					if ((em->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX) {
-						if (ctrl) EDBM_selectmode_convert(em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
-					}
-					em->selectmode = SCE_SELECT_EDGE;
-				}
-				ts->selectmode = em->selectmode;
-				EDBM_selectmode_set(em);
-				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+			if (EDBM_selectmode_toggle(C, SCE_SELECT_EDGE, -1, shift, ctrl)) {
 				ED_undo_push(C, "Selectmode Set: Edge");
 			}
 			break;
 		case B_SEL_FACE:
-			if (em) {
-				if (shift == 0 || em->selectmode == 0) {
-					if (((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) ||
-					    ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE))
-					{
-						if (ctrl) EDBM_selectmode_convert(em, (ts->selectmode ^ SCE_SELECT_FACE), SCE_SELECT_FACE);
-					}
-					em->selectmode = SCE_SELECT_FACE;
-				}
-				ts->selectmode = em->selectmode;
-				EDBM_selectmode_set(em);
-				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+			if (EDBM_selectmode_toggle(C, SCE_SELECT_FACE, -1, shift, ctrl)) {
 				ED_undo_push(C, "Selectmode Set: Face");
 			}
 			break;
@@ -430,9 +398,15 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
 
 		row = uiLayoutRow(layout, TRUE);
 		block = uiLayoutGetBlock(row);
-		uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select - Shift-Click for multiple modes");
-		uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select - Shift-Click for multiple modes");
-		uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select - Shift-Click for multiple modes");
+		uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL,
+		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+		                 "Vertex select - Shift-Click for multiple modes");
+		uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL,
+		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+		                 "Edge select - Shift-Click for multiple modes, Ctrl-Click expands selection");
+		uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
+		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+		                 "Face select - Shift-Click for multiple modes, Ctrl-Click expands selection");
 	}
 }
 
@@ -452,7 +426,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
 	const float dpi_fac = UI_DPI_FAC;
 	int is_paint = 0;
 	
-	RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);	
+	RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
 	RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
 	RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
 
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 5bfabf4..5beeda9 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -40,6 +40,7 @@ struct ARegionType;
 struct BoundBox;
 struct DerivedMesh;
 struct Object;
+struct SmokeDomainSettings;
 struct ViewContext;
 struct bAnimVizSettings;
 struct bContext;
@@ -50,8 +51,6 @@ struct wmNDOFMotionData;
 struct wmOperatorType;
 struct wmWindowManager;
 
-#define BL_NEAR_CLIP 0.001
-
 /* drawing flags: */
 enum {
 	DRAW_PICKING     = (1 << 0),
@@ -97,6 +96,7 @@ void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
 void VIEW3D_OT_manipulator(struct wmOperatorType *ot);
 void VIEW3D_OT_enable_manipulator(struct wmOperatorType *ot);
 void VIEW3D_OT_render_border(struct wmOperatorType *ot);
+void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
 void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
 
 void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
@@ -177,7 +177,7 @@ int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[][4], struct BoundB
 void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
                         float *ofs, float *quat, float *dist, float *lens);
 
-void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect);  /* rect: for picking */
+void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect);
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
 
 void fly_modal_keymap(struct wmKeyConfig *keyconf);
@@ -212,7 +212,20 @@ ARegion *view3d_has_tools_region(ScrArea *sa);
 extern const char *view3d_context_dir[]; /* doc access */
 
 /* draw_volume.c */
-void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float min[3], float max[3], int res[3], float dx, struct GPUTexture *tex_shadow);
+void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob,
+                       struct GPUTexture *tex, float min[3], float max[3],
+                       int res[3], float dx, float base_scale, float viewnormal[3],
+                       struct GPUTexture *tex_shadow, struct GPUTexture *tex_flame);
+
+//#define SMOKE_DEBUG_VELOCITY
+//#define SMOKE_DEBUG_HEAT
+
+#ifdef SMOKE_DEBUG_VELOCITY
+void draw_smoke_velocity(struct SmokeDomainSettings *domain, struct Object *ob);
+#endif
+#ifdef SMOKE_DEBUG_HEAT
+void draw_smoke_heat(struct SmokeDomainSettings *domain, struct Object *ob);
+#endif
 
 /* workaround for trivial but noticeable camera bug caused by imprecision
  * between view border calculation in 2D/3D space, workaround for bug [#28037].
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
new file mode 100644
index 0000000..3760772
--- /dev/null
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -0,0 +1,416 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation, full recode and added functions
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/space_view3d/view3d_iterators.c
+ *  \ingroup spview3d
+ */
+
+#include "DNA_curve_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+#include "BLI_rect.h"
+
+#include "BKE_armature.h"
+#include "BKE_curve.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_displist.h"
+
+#include "bmesh.h"
+
+#include "ED_mesh.h"
+#include "ED_screen.h"
+#include "ED_armature.h"
+#include "ED_object.h"
+#include "ED_view3d.h"
+
+
+typedef struct foreachScreenVert_userData {
+	void (*func)(void *userData, BMVert *eve, const float screen_co_b[2], int index);
+	void *userData;
+	ViewContext vc;
+	eV3DProjTest clip_flag;
+} foreachScreenVert_userData;
+
+/* user data structures for derived mesh callbacks */
+typedef struct foreachScreenEdge_userData {
+	void (*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index);
+	void *userData;
+	ViewContext vc;
+	rctf win_rect; /* copy of: vc.ar->winx/winy, use for faster tests, minx/y will always be 0 */
+	eV3DProjTest clip_flag;
+} foreachScreenEdge_userData;
+
+typedef struct foreachScreenFace_userData {
+	void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index);
+	void *userData;
+	ViewContext vc;
+	eV3DProjTest clip_flag;
+} foreachScreenFace_userData;
+
+
+/* Note! - foreach funcs should be called while drawing or directly after
+ * if not, ED_view3d_init_mats_rv3d() can be used for selection tools
+ * but would not give correct results with dupli's for eg. which don't
+ * use the object matrix in the usual way */
+
+/* ------------------------------------------------------------------------ */
+
+static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const float co[3],
+                                            const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
+{
+	foreachScreenVert_userData *data = userData;
+	BMVert *eve = EDBM_vert_at_index(data->vc.em, index);
+
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+		float screen_co[2];
+
+		if (ED_view3d_project_float_object(data->vc.ar, co, screen_co, data->clip_flag) != V3D_PROJ_RET_OK) {
+			return;
+		}
+
+		data->func(data->userData, eve, screen_co, index);
+	}
+}
+
+void mesh_foreachScreenVert(
+        ViewContext *vc,
+        void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index),
+        void *userData, eV3DProjTest clip_flag)
+{
+	foreachScreenVert_userData data;
+	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+
+	data.vc = *vc;
+	data.func = func;
+	data.userData = userData;
+	data.clip_flag = clip_flag;
+
+	if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
+		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
+	}
+
+	EDBM_index_arrays_init(vc->em, 1, 0, 0);
+	dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
+	EDBM_index_arrays_free(vc->em);
+
+	dm->release(dm);
+}
+
+/* ------------------------------------------------------------------------ */
+
+static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3])
+{
+	foreachScreenEdge_userData *data = userData;
+	BMEdge *eed = EDBM_edge_at_index(data->vc.em, index);
+
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+		float screen_co_a[2];
+		float screen_co_b[2];
+		eV3DProjTest clip_flag_nowin = data->clip_flag &= ~V3D_PROJ_TEST_CLIP_WIN;
+
+		if (ED_view3d_project_float_object(data->vc.ar, v0co, screen_co_a, clip_flag_nowin) != V3D_PROJ_RET_OK) {
+			return;
+		}
+		if (ED_view3d_project_float_object(data->vc.ar, v1co, screen_co_b, clip_flag_nowin) != V3D_PROJ_RET_OK) {
+			return;
+		}
+
+		if (data->clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
+			if (!BLI_rctf_isect_segment(&data->win_rect, screen_co_a, screen_co_b)) {
+				return;
+			}
+		}
+
+		data->func(data->userData, eed, screen_co_a, screen_co_b, index);
+	}
+}
+
+void mesh_foreachScreenEdge(
+        ViewContext *vc,
+        void (*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index),
+        void *userData, eV3DProjTest clip_flag)
+{
+	foreachScreenEdge_userData data;
+	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+
+	data.vc = *vc;
+
+	data.win_rect.xmin = 0;
+	data.win_rect.ymin = 0;
+	data.win_rect.xmax = vc->ar->winx;
+	data.win_rect.ymax = vc->ar->winy;
+
+	data.func = func;
+	data.userData = userData;
+	data.clip_flag = clip_flag;
+
+	if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
+		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
+	}
+
+	EDBM_index_arrays_init(vc->em, 0, 1, 0);
+	dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
+	EDBM_index_arrays_free(vc->em);
+
+	dm->release(dm);
+}
+
+/* ------------------------------------------------------------------------ */
+
+static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
+{
+	foreachScreenFace_userData *data = userData;
+	BMFace *efa = EDBM_face_at_index(data->vc.em, index);
+
+	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		float screen_co[2];
+		if (ED_view3d_project_float_object(data->vc.ar, cent, screen_co, data->clip_flag) == V3D_PROJ_RET_OK) {
+			data->func(data->userData, efa, screen_co, index);
+		}
+	}
+}
+
+void mesh_foreachScreenFace(
+        ViewContext *vc,
+        void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	foreachScreenFace_userData data;
+	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+
+	data.vc = *vc;
+	data.func = func;
+	data.userData = userData;
+	data.clip_flag = clip_flag;
+
+	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
+
+	EDBM_index_arrays_init(vc->em, 0, 0, 1);
+	dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data);
+	EDBM_index_arrays_free(vc->em);
+
+	dm->release(dm);
+}
+
+/* ------------------------------------------------------------------------ */
+
+void nurbs_foreachScreenVert(
+        ViewContext *vc,
+        void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	Curve *cu = vc->obedit->data;
+	Nurb *nu;
+	int i;
+	ListBase *nurbs = BKE_curve_editNurbs_get(cu);
+
+	if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
+		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+	}
+
+	for (nu = nurbs->first; nu; nu = nu->next) {
+		if (nu->type == CU_BEZIER) {
+			for (i = 0; i < nu->pntsu; i++) {
+				BezTriple *bezt = &nu->bezt[i];
+
+				if (bezt->hide == 0) {
+					float screen_co[2];
+
+					if (cu->drawflag & CU_HIDE_HANDLES) {
+						if (ED_view3d_project_float_object(vc->ar, bezt->vec[1], screen_co,
+						                                   V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
+						{
+							func(userData, nu, NULL, bezt, 1, screen_co);
+						}
+					}
+					else {
+						if (ED_view3d_project_float_object(vc->ar, bezt->vec[0], screen_co,
+						                                   V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
+						{
+							func(userData, nu, NULL, bezt, 0, screen_co);
+						}
+						if (ED_view3d_project_float_object(vc->ar, bezt->vec[1], screen_co,
+						                                   V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
+						{
+							func(userData, nu, NULL, bezt, 1, screen_co);
+						}
+						if (ED_view3d_project_float_object(vc->ar, bezt->vec[2], screen_co,
+						                                   V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
+						{
+							func(userData, nu, NULL, bezt, 2, screen_co);
+						}
+					}
+				}
+			}
+		}
+		else {
+			for (i = 0; i < nu->pntsu * nu->pntsv; i++) {
+				BPoint *bp = &nu->bp[i];
+
+				if (bp->hide == 0) {
+					float screen_co[2];
+					if (ED_view3d_project_float_object(vc->ar, bp->vec, screen_co,
+					                                   V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
+					{
+						func(userData, nu, bp, NULL, -1, screen_co);
+					}
+				}
+			}
+		}
+	}
+}
+
+/* ------------------------------------------------------------------------ */
+
+/* ED_view3d_init_mats_rv3d must be called first */
+void mball_foreachScreenElem(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct MetaElem *ml, const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	MetaBall *mb = (MetaBall *)vc->obedit->data;
+	MetaElem *ml;
+
+	for (ml = mb->editelems->first; ml; ml = ml->next) {
+		float screen_co[2];
+		if (ED_view3d_project_float_object(vc->ar, &ml->x, screen_co, clip_flag) == V3D_PROJ_RET_OK) {
+			func(userData, ml, screen_co);
+		}
+	}
+}
+
+/* ------------------------------------------------------------------------ */
+
+void lattice_foreachScreenVert(
+        ViewContext *vc,
+        void (*func)(void *userData, BPoint *bp, const float screen_co[2]),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	Object *obedit = vc->obedit;
+	Lattice *lt = obedit->data;
+	BPoint *bp = lt->editlatt->latt->def;
+	DispList *dl = BKE_displist_find(&obedit->disp, DL_VERTS);
+	float *co = dl ? dl->verts : NULL;
+	int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+
+	if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
+		ED_view3d_clipping_local(vc->rv3d, obedit->obmat); /* for local clipping lookups */
+	}
+
+	for (i = 0; i < N; i++, bp++, co += 3) {
+		if (bp->hide == 0) {
+			float screen_co[2];
+			if (ED_view3d_project_float_object(vc->ar, dl ? co : bp->vec, screen_co, clip_flag) == V3D_PROJ_RET_OK) {
+				func(userData, bp, screen_co);
+			}
+		}
+	}
+}
+
+/* ------------------------------------------------------------------------ */
+
+/* ED_view3d_init_mats_rv3d must be called first */
+void armature_foreachScreenBone(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	bArmature *arm = vc->obedit->data;
+	EditBone *ebone;
+
+	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+		if (EBONE_VISIBLE(arm, ebone)) {
+			float screen_co_a[2], screen_co_b[2];
+			int points_proj_tot = 0;
+
+			/* project head location to screenspace */
+			if (ED_view3d_project_float_object(vc->ar, ebone->head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
+				points_proj_tot++;
+			}
+			else {
+				screen_co_a[0] = IS_CLIPPED;  /* weak */
+				/* screen_co_a[1]: intentionally dont set this so we get errors on misuse */
+			}
+
+			/* project tail location to screenspace */
+			if (ED_view3d_project_float_object(vc->ar, ebone->tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
+				points_proj_tot++;
+			}
+			else {
+				screen_co_b[0] = IS_CLIPPED;  /* weak */
+				/* screen_co_b[1]: intentionally dont set this so we get errors on misuse */
+			}
+
+			if (points_proj_tot) {  /* at least one point's projection worked */
+				func(userData, ebone, screen_co_a, screen_co_b);
+			}
+		}
+	}
+}
+
+/* ------------------------------------------------------------------------ */
+
+/* ED_view3d_init_mats_rv3d must be called first */
+/* almost _exact_ copy of #armature_foreachScreenBone */
+void pose_foreachScreenBone(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2]),
+        void *userData, const eV3DProjTest clip_flag)
+{
+	bArmature *arm = vc->obact->data;
+	bPose *pose = vc->obact->pose;
+	bPoseChannel *pchan;
+
+	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
+		if (PBONE_VISIBLE(arm, pchan->bone)) {
+			float screen_co_a[2], screen_co_b[2];
+			int points_proj_tot = 0;
+
+			/* project head location to screenspace */
+			if (ED_view3d_project_float_object(vc->ar, pchan->pose_head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
+				points_proj_tot++;
+			}
+			else {
+				screen_co_a[0] = IS_CLIPPED;  /* weak */
+				/* screen_co_a[1]: intentionally dont set this so we get errors on misuse */
+			}
+
+			/* project tail location to screenspace */
+			if (ED_view3d_project_float_object(vc->ar, pchan->pose_tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
+				points_proj_tot++;
+			}
+			else {
+				screen_co_b[0] = IS_CLIPPED;  /* weak */
+				/* screen_co_b[1]: intentionally dont set this so we get errors on misuse */
+			}
+
+			if (points_proj_tot) {  /* at least one point's projection worked */
+				func(userData, pchan, screen_co_a, screen_co_b);
+			}
+		}
+	}
+}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 14c02c2..6105b5e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -83,6 +83,7 @@ void view3d_operatortypes(void)
 	WM_operatortype_append(VIEW3D_OT_select_circle);
 	WM_operatortype_append(VIEW3D_OT_smoothview);
 	WM_operatortype_append(VIEW3D_OT_render_border);
+	WM_operatortype_append(VIEW3D_OT_clear_render_border);
 	WM_operatortype_append(VIEW3D_OT_zoom_border);
 	WM_operatortype_append(VIEW3D_OT_manipulator);
 	WM_operatortype_append(VIEW3D_OT_enable_manipulator);
@@ -136,8 +137,10 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
-	WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
-	WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "use_all_regions", TRUE);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "use_all_regions", FALSE);
 
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_to_active", PADPERIOD, KM_PRESS, KM_SHIFT, 0);
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_clear", PADPERIOD, KM_PRESS, KM_ALT, 0);
@@ -169,6 +172,9 @@ void view3d_keymap(wmKeyConfig *keyconf)
 
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "use_all_regions", TRUE);
+	RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "center", TRUE);
 
@@ -268,8 +274,8 @@ void view3d_keymap(wmKeyConfig *keyconf)
 
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
-	RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
-	RNA_string_set(kmi->ptr, "value_2", "SOLID");
+	RNA_string_set(kmi->ptr, "value_1", "SOLID");
+	RNA_string_set(kmi->ptr, "value_2", "TEXTURED");
 
 	/* selection*/
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
@@ -340,7 +346,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	
 	WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
-	WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
+
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_boolean_set(kmi->ptr, "camera_only", TRUE);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "camera_only", FALSE);
+
+	WM_keymap_add_item(keymap, "VIEW3D_OT_clear_render_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	
 	WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT | KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
new file mode 100644
index 0000000..34b983f
--- /dev/null
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -0,0 +1,513 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/space_view3d/view3d_project.c
+ *  \ingroup spview3d
+ */
+
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_view3d_types.h"
+
+#include "BLO_sys_types.h"  /* int64_t */
+
+#include "BIF_gl.h"  /* bglMats */
+#include "BIF_glutil.h"  /* bglMats */
+
+#include "BLI_math_vector.h"
+
+#include "ED_view3d.h"  /* own include */
+
+#define BL_NEAR_CLIP 0.001
+
+/* Non Clipping Projection Functions
+ * ********************************* */
+
+/**
+ * \note use #ED_view3d_ob_project_mat_get to get the projection matrix
+ */
+void ED_view3d_project_float_v2_m4(const ARegion *ar, const float co[3], float r_co[2], float mat[4][4])
+{
+	float vec4[4];
+	
+	copy_v3_v3(vec4, co);
+	vec4[3] = 1.0;
+	/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
+	
+	mul_m4_v4(mat, vec4);
+	
+	if (vec4[3] > FLT_EPSILON) {
+		r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
+		r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+	}
+	else {
+		zero_v2(r_co);
+	}
+}
+
+/**
+ * \note use #ED_view3d_ob_project_mat_get to get projecting mat
+ */
+void ED_view3d_project_float_v3_m4(ARegion *ar, const float vec[3], float r_co[3], float mat[4][4])
+{
+	float vec4[4];
+	
+	copy_v3_v3(vec4, vec);
+	vec4[3] = 1.0;
+	/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
+	
+	mul_m4_v4(mat, vec4);
+	
+	if (vec4[3] > FLT_EPSILON) {
+		r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
+		r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+		r_co[2] = vec4[2] / vec4[3];
+	}
+	else {
+		zero_v3(r_co);
+	}
+}
+
+
+/* Clipping Projection Functions
+ * ***************************** */
+
+eV3DProjStatus ED_view3d_project_base(struct ARegion *ar, struct Base *base)
+{
+	eV3DProjStatus ret = ED_view3d_project_short_global(ar, base->object->obmat[3], &base->sx, V3D_PROJ_TEST_CLIP_DEFAULT);
+
+	if (ret != V3D_PROJ_RET_OK) {
+		base->sx = IS_CLIPPED;
+		base->sy = 0;
+	}
+
+	return ret;
+}
+
+/* perspmat is typically...
+ * - 'rv3d->perspmat',   is_local == FALSE
+ * - 'rv3d->perspmatob', is_local == TRUE
+ */
+static eV3DProjStatus ed_view3d_project__internal(ARegion *ar,
+                                                  float perspmat[4][4], const int is_local,  /* normally hidden */
+                                                  const float co[3], float r_co[2], const eV3DProjTest flag)
+{
+	float fx, fy, vec4[4];
+
+	/* check for bad flags */
+	BLI_assert((flag & V3D_PROJ_TEST_ALL) == flag);
+
+	if (flag & V3D_PROJ_TEST_CLIP_BB) {
+		RegionView3D *rv3d = ar->regiondata;
+		if (rv3d->rflag & RV3D_CLIPPING) {
+			if (ED_view3d_clipping_test(rv3d, co, is_local)) {
+				return V3D_PROJ_RET_CLIP_BB;
+			}
+		}
+	}
+
+	copy_v3_v3(vec4, co);
+	vec4[3] = 1.0;
+	mul_m4_v4(perspmat, vec4);
+
+	if (vec4[3] > (float)BL_NEAR_CLIP) {
+		fx = ((float)ar->winx / 2.0f) * (1.0f + vec4[0] / vec4[3]);
+		if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fx > 0 && fx < ar->winx)) {
+			fy = ((float)ar->winy / 2.0f) * (1.0f + vec4[1] / vec4[3]);
+			if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fy > 0.0f && fy < (float)ar->winy)) {
+				r_co[0] = (short)floor(fx);
+				r_co[1] = (short)floor(fy);
+			}
+			else {
+				return V3D_PROJ_RET_CLIP_WIN;
+			}
+		}
+		else {
+			return V3D_PROJ_RET_CLIP_WIN;
+		}
+	}
+	else {
+		return V3D_PROJ_RET_CLIP_NEAR;
+	}
+
+	return V3D_PROJ_RET_OK;
+}
+
+eV3DProjStatus ED_view3d_project_short_ex(ARegion *ar, float perspmat[4][4], const int is_local,
+                                          const float co[3], short r_co[2], const eV3DProjTest flag)
+{
+	float tvec[2];
+	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+	if (ret == V3D_PROJ_RET_OK) {
+		if ((tvec[0] > -32700.0f && tvec[0] < 32700.0f) &&
+		    (tvec[1] > -32700.0f && tvec[1] < 32700.0f))
+		{
+			r_co[0] = (short)floor(tvec[0]);
+			r_co[1] = (short)floor(tvec[1]);
+		}
+		else {
+			ret = V3D_PROJ_RET_OVERFLOW;
+		}
+	}
+	return ret;
+}
+
+eV3DProjStatus ED_view3d_project_int_ex(ARegion *ar, float perspmat[4][4], const int is_local,
+                                        const float co[3], int r_co[2], const eV3DProjTest flag)
+{
+	float tvec[2];
+	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+	if (ret == V3D_PROJ_RET_OK) {
+		if ((tvec[0] > -2140000000.0f && tvec[0] < 2140000000.0f) &&
+		    (tvec[1] > -2140000000.0f && tvec[1] < 2140000000.0f))
+		{
+			r_co[0] = (int)floor(tvec[0]);
+			r_co[1] = (int)floor(tvec[1]);
+		}
+		else {
+			ret = V3D_PROJ_RET_OVERFLOW;
+		}
+	}
+	return ret;
+}
+
+eV3DProjStatus ED_view3d_project_float_ex(ARegion *ar, float perspmat[4][4], const int is_local,
+                                        const float co[3], float r_co[2], const eV3DProjTest flag)
+{
+	float tvec[2];
+	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+	if (ret == V3D_PROJ_RET_OK) {
+		if (finite(tvec[0]) &&
+		    finite(tvec[1]))
+		{
+			copy_v2_v2(r_co, tvec);
+		}
+		else {
+			ret = V3D_PROJ_RET_OVERFLOW;
+		}
+	}
+	return ret;
+}
+
+/* --- short --- */
+eV3DProjStatus ED_view3d_project_short_global(ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_short_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+}
+/* object space, use ED_view3d_init_mats_rv3d before calling */
+eV3DProjStatus ED_view3d_project_short_object(ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_short_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+}
+
+/* --- int --- */
+eV3DProjStatus ED_view3d_project_int_global(ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_int_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+}
+/* object space, use ED_view3d_init_mats_rv3d before calling */
+eV3DProjStatus ED_view3d_project_int_object(ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_int_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+}
+
+/* --- float --- */
+eV3DProjStatus ED_view3d_project_float_global(ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_float_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+}
+/* object space, use ED_view3d_init_mats_rv3d before calling */
+eV3DProjStatus ED_view3d_project_float_object(ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
+{
+	RegionView3D *rv3d = ar->regiondata;
+	return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+}
+
+
+
+/* More Generic Window/Ray/Vector projection functions
+ * *************************************************** */
+
+/* odd function, need to document better */
+int initgrabz(RegionView3D *rv3d, float x, float y, float z)
+{
+	int flip = FALSE;
+	if (rv3d == NULL) return flip;
+	rv3d->zfac = rv3d->persmat[0][3] * x + rv3d->persmat[1][3] * y + rv3d->persmat[2][3] * z + rv3d->persmat[3][3];
+	if (rv3d->zfac < 0.0f)
+		flip = TRUE;
+	/* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that
+	 * (accounting for near zero values)
+	 */
+	if (rv3d->zfac < 1.e-6f && rv3d->zfac > -1.e-6f) rv3d->zfac = 1.0f;
+
+	/* Negative zfac means x, y, z was behind the camera (in perspective).
+	 * This gives flipped directions, so revert back to ok default case.
+	 */
+	/* NOTE: I've changed this to flip zfac to be positive again for now so that GPencil draws ok
+	 * Aligorith, 2009Aug31 */
+	//if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f;
+	if (rv3d->zfac < 0.0f) rv3d->zfac = -rv3d->zfac;
+
+	return flip;
+}
+
+/**
+ * Calculate a 3d viewpoint and direction vector from 2d window coordinates.
+ * This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
+ * ray_start is clipped by the view near limit so points in front of it are always in view.
+ * In orthographic view the resulting ray_normal will match the view vector.
+ * \param ar The region (used for the window width and height).
+ * \param v3d The 3d viewport (used for near clipping value).
+ * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
+ * \param ray_start The world-space starting point of the segment.
+ * \param ray_normal The normalized world-space direction of towards mval.
+ */
+void ED_view3d_win_to_ray(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3])
+{
+	float ray_end[3];
+	
+	ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
+	sub_v3_v3v3(ray_normal, ray_end, ray_start);
+	normalize_v3(ray_normal);
+}
+
+/**
+ * Calculate a normalized 3d direction vector from the viewpoint towards a global location.
+ * In orthographic view the resulting vector will match the view vector.
+ * \param rv3d The region (used for the window width and height).
+ * \param coord The world-space location.
+ * \param vec The resulting normalized vector.
+ */
+void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float vec[3])
+{
+	if (rv3d->is_persp) {
+		float p1[4], p2[4];
+
+		copy_v3_v3(p1, coord);
+		p1[3] = 1.0f;
+		copy_v3_v3(p2, p1);
+		p2[3] = 1.0f;
+		mul_m4_v4(rv3d->viewmat, p2);
+
+		mul_v3_fl(p2, 2.0f);
+
+		mul_m4_v4(rv3d->viewinv, p2);
+
+		sub_v3_v3v3(vec, p1, p2);
+	}
+	else {
+		copy_v3_v3(vec, rv3d->viewinv[2]);
+	}
+	normalize_v3(vec);
+}
+
+/**
+ * Calculate a 3d location from 2d window coordinates.
+ * \param ar The region (used for the window width and height).
+ * \param depth_pt The reference location used to calculate the Z depth.
+ * \param mval The area relative location (such as event->mval converted to floats).
+ * \param out The resulting world-space location.
+ */
+void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[2], float out[3])
+{
+	RegionView3D *rv3d = ar->regiondata;
+	
+	float line_sta[3];
+	float line_end[3];
+
+	if (rv3d->is_persp) {
+		float mousevec[3];
+		copy_v3_v3(line_sta, rv3d->viewinv[3]);
+		ED_view3d_win_to_vector(ar, mval, mousevec);
+		add_v3_v3v3(line_end, line_sta, mousevec);
+
+		if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
+			/* highly unlikely to ever happen, mouse vec paralelle with view plane */
+			zero_v3(out);
+		}
+	}
+	else {
+		const float dx = (2.0f * mval[0] / (float)ar->winx) - 1.0f;
+		const float dy = (2.0f * mval[1] / (float)ar->winy) - 1.0f;
+		line_sta[0] = (rv3d->persinv[0][0] * dx) + (rv3d->persinv[1][0] * dy) + rv3d->viewinv[3][0];
+		line_sta[1] = (rv3d->persinv[0][1] * dx) + (rv3d->persinv[1][1] * dy) + rv3d->viewinv[3][1];
+		line_sta[2] = (rv3d->persinv[0][2] * dx) + (rv3d->persinv[1][2] * dy) + rv3d->viewinv[3][2];
+
+		add_v3_v3v3(line_end, line_sta, rv3d->viewinv[2]);
+		closest_to_line_v3(out, depth_pt, line_sta, line_end);
+	}
+}
+
+/**
+ * Calculate a 3d difference vector from 2d window offset.
+ * note that initgrabz() must be called first to determine
+ * the depth used to calculate the delta.
+ * \param ar The region (used for the window width and height).
+ * \param mval The area relative 2d difference (such as event->mval[0] - other_x).
+ * \param out The resulting world-space delta.
+ */
+void ED_view3d_win_to_delta(ARegion *ar, const float mval[2], float out[3])
+{
+	RegionView3D *rv3d = ar->regiondata;
+	float dx, dy;
+	
+	dx = 2.0f * mval[0] * rv3d->zfac / ar->winx;
+	dy = 2.0f * mval[1] * rv3d->zfac / ar->winy;
+	
+	out[0] = (rv3d->persinv[0][0] * dx + rv3d->persinv[1][0] * dy);
+	out[1] = (rv3d->persinv[0][1] * dx + rv3d->persinv[1][1] * dy);
+	out[2] = (rv3d->persinv[0][2] * dx + rv3d->persinv[1][2] * dy);
+}
+
+/**
+ * Calculate a 3d direction vector from 2d window coordinates.
+ * This direction vector starts and the view in the direction of the 2d window coordinates.
+ * In orthographic view all window coordinates yield the same vector.
+ *
+ * \note doesn't rely on initgrabz
+ * for perspective view, get the vector direction to
+ * the mouse cursor as a normalized vector.
+ *
+ * \param ar The region (used for the window width and height).
+ * \param mval The area relative 2d location (such as event->mval converted to floats).
+ * \param out The resulting normalized world-space direction vector.
+ */
+void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
+{
+	RegionView3D *rv3d = ar->regiondata;
+
+	if (rv3d->is_persp) {
+		out[0] = 2.0f * (mval[0] / ar->winx) - 1.0f;
+		out[1] = 2.0f * (mval[1] / ar->winy) - 1.0f;
+		out[2] = -0.5f;
+		mul_project_m4_v3(rv3d->persinv, out);
+		sub_v3_v3(out, rv3d->viewinv[3]);
+	}
+	else {
+		copy_v3_v3(out, rv3d->viewinv[2]);
+	}
+	normalize_v3(out);
+}
+
+void ED_view3d_win_to_segment(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+{
+	RegionView3D *rv3d = ar->regiondata;
+
+	if (rv3d->is_persp) {
+		float vec[3];
+		ED_view3d_win_to_vector(ar, mval, vec);
+
+		copy_v3_v3(ray_start, rv3d->viewinv[3]);
+		madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near);
+		madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far);
+	}
+	else {
+		float vec[4];
+		vec[0] = 2.0f * mval[0] / ar->winx - 1;
+		vec[1] = 2.0f * mval[1] / ar->winy - 1;
+		vec[2] = 0.0f;
+		vec[3] = 1.0f;
+
+		mul_m4_v4(rv3d->persinv, vec);
+
+		madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2],  1000.0f);
+		madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f);
+	}
+}
+
+/**
+ * Calculate a 3d segment from 2d window coordinates.
+ * This ray_start is located at the viewpoint, ray_end is a far point.
+ * ray_start and ray_end are clipped by the view near and far limits
+ * so points along this line are always in view.
+ * In orthographic view all resulting segments will be parallel.
+ * \param ar The region (used for the window width and height).
+ * \param v3d The 3d viewport (used for near and far clipping range).
+ * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
+ * \param ray_start The world-space starting point of the segment.
+ * \param ray_end The world-space end point of the segment.
+ * \return success, FALSE if the segment is totally clipped.
+ */
+int ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+{
+	RegionView3D *rv3d = ar->regiondata;
+	ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
+
+	/* clipping */
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		/* if the ray is totally clipped,
+		 * restore the original values but return FALSE
+		 * caller can choose what to do */
+		float tray_start[3] = {UNPACK3(ray_start)};
+		float tray_end[3]   = {UNPACK3(ray_end)};
+		int a;
+		for (a = 0; a < 4; a++) {
+			if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == FALSE) {
+				return FALSE;
+			}
+		}
+
+		/* copy in clipped values */
+		copy_v3_v3(ray_start, tray_start);
+		copy_v3_v3(ray_end, tray_end);
+	}
+
+	return TRUE;
+}
+
+
+/* Utility functions for projection
+ * ******************************** */
+
+void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4])
+{
+	float vmat[4][4];
+
+	mult_m4_m4m4(vmat, rv3d->viewmat, ob->obmat);
+	mult_m4_m4m4(pmat, rv3d->winmat, vmat);
+}
+
+/**
+ * Uses window coordinates (x,y) and depth component z to find a point in
+ * modelspace */
+void ED_view3d_unproject(bglMats *mats, float out[3], const float x, const float y, const float z)
+{
+	double ux, uy, uz;
+
+	gluUnProject(x, y, z, mats->modelview, mats->projection,
+	             (GLint *)mats->viewport, &ux, &uy, &uz);
+
+	out[0] = ux;
+	out[1] = uy;
+	out[2] = uz;
+}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 5f0bb18..cffa53b 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -165,7 +165,7 @@ void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob
 	mats->viewport[0] = ar->winrct.xmin;
 	mats->viewport[1] = ar->winrct.ymin;
 	mats->viewport[2] = ar->winx;
-	mats->viewport[3] = ar->winy;	
+	mats->viewport[3] = ar->winy;
 }
 
 /* ********************** view3d_select: selection manipulations ********************* */
@@ -221,7 +221,7 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select)
 }
 
 
-/* object mode, EM_ prefix is confusing here, rename? */
+/* object mode, edbm_ prefix is confusing here, rename? */
 static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
 {
 	MVert *mv = me->mvert;
@@ -237,8 +237,8 @@ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
 		}
 	}
 }
-/* object mode, EM_ prefix is confusing here, rename? */
 
+/* object mode, edbm_ prefix is confusing here, rename? */
 static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select)
 {
 	MPoly *mpoly = me->mpoly;
@@ -258,6 +258,8 @@ static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select)
 typedef struct LassoSelectUserData {
 	ViewContext *vc;
 	const rcti *rect;
+	const rctf *rect_fl;
+	rctf       _rect_fl;
 	const int (*mcords)[2];
 	int moves;
 	int select;
@@ -273,7 +275,11 @@ static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
                                              const int moves, const int select)
 {
 	r_data->vc = vc;
+
 	r_data->rect = rect;
+	r_data->rect_fl = &r_data->_rect_fl;
+	BLI_rctf_rcti_copy(&r_data->_rect_fl, rect);
+
 	r_data->mcords = mcords;
 	r_data->moves = moves;
 	r_data->select = select;
@@ -314,29 +320,29 @@ static int view3d_selectable_data(bContext *C)
 
 
 /* helper also for borderselect */
-static int edge_fully_inside_rect(const rcti *rect, int x1, int y1, int x2, int y2)
+static int edge_fully_inside_rect(const rctf *rect, const float v1[2], const float v2[2])
 {
-	return BLI_rcti_isect_pt(rect, x1, y1) && BLI_rcti_isect_pt(rect, x2, y2);
+	return BLI_rctf_isect_pt_v(rect, v1) && BLI_rctf_isect_pt_v(rect, v2);
 }
 
-static int edge_inside_rect(const rcti *rect, int x1, int y1, int x2, int y2)
+static int edge_inside_rect(const rctf *rect, const float v1[2], const float v2[2])
 {
 	int d1, d2, d3, d4;
 	
 	/* check points in rect */
-	if (edge_fully_inside_rect(rect, x1, y1, x2, y2)) return 1;
+	if (edge_fully_inside_rect(rect, v1, v2)) return 1;
 	
 	/* check points completely out rect */
-	if (x1 < rect->xmin && x2 < rect->xmin) return 0;
-	if (x1 > rect->xmax && x2 > rect->xmax) return 0;
-	if (y1 < rect->ymin && y2 < rect->ymin) return 0;
-	if (y1 > rect->ymax && y2 > rect->ymax) return 0;
+	if (v1[0] < rect->xmin && v2[0] < rect->xmin) return 0;
+	if (v1[0] > rect->xmax && v2[0] > rect->xmax) return 0;
+	if (v1[1] < rect->ymin && v2[1] < rect->ymin) return 0;
+	if (v1[1] > rect->ymax && v2[1] > rect->ymax) return 0;
 	
 	/* simple check lines intersecting. */
-	d1 = (y1 - y2) * (x1 - rect->xmin) + (x2 - x1) * (y1 - rect->ymin);
-	d2 = (y1 - y2) * (x1 - rect->xmin) + (x2 - x1) * (y1 - rect->ymax);
-	d3 = (y1 - y2) * (x1 - rect->xmax) + (x2 - x1) * (y1 - rect->ymax);
-	d4 = (y1 - y2) * (x1 - rect->xmax) + (x2 - x1) * (y1 - rect->ymin);
+	d1 = (v1[1] - v2[1]) * (v1[0] - rect->xmin) + (v2[0] - v1[0]) * (v1[1] - rect->ymin);
+	d2 = (v1[1] - v2[1]) * (v1[0] - rect->xmin) + (v2[0] - v1[0]) * (v1[1] - rect->ymax);
+	d3 = (v1[1] - v2[1]) * (v1[0] - rect->xmax) + (v2[0] - v1[0]) * (v1[1] - rect->ymax);
+	d4 = (v1[1] - v2[1]) * (v1[0] - rect->xmax) + (v2[0] - v1[0]) * (v1[1] - rect->ymin);
 	
 	if (d1 < 0 && d2 < 0 && d3 < 0 && d4 < 0) return 0;
 	if (d1 > 0 && d2 > 0 && d3 > 0 && d4 > 0) return 0;
@@ -344,7 +350,7 @@ static int edge_inside_rect(const rcti *rect, int x1, int y1, int x2, int y2)
 	return 1;
 }
 
-static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, int x0, int y0, int x1, int y1)
+static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
 {
 	LassoSelectUserData *data = userData;
 	bArmature *arm = data->vc->obact->data;
@@ -353,6 +359,11 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
 		int is_point_done = FALSE;
 		int points_proj_tot = 0;
 
+		const int x0 = screen_co_a[0];
+		const int y0 = screen_co_a[1];
+		const int x1 = screen_co_b[0];
+		const int y1 = screen_co_b[1];
+
 		/* project head location to screenspace */
 		if (x0 != IS_CLIPPED) {
 			points_proj_tot++;
@@ -387,6 +398,7 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
 }
 static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, short select)
 {
+	ViewContext vc_tmp;
 	LassoSelectUserData data;
 	rcti rect;
 	
@@ -394,13 +406,16 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[]
 		return;
 	}
 
+	vc_tmp = *vc;
+	vc_tmp.obact = ob;
+
+	BLI_lasso_boundbox(&rect, mcords, moves);
+
 	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d);
 
-	BLI_lasso_boundbox(&rect, mcords, moves);
-
-	pose_foreachScreenBone(vc, do_lasso_select_pose__doSelectBone, &data);
+	pose_foreachScreenBone(&vc_tmp, do_lasso_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	if (data.is_change) {
 		bArmature *arm = ob->data;
@@ -445,23 +460,28 @@ static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], cons
 	}
 }
 
-static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
+static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
 {
 	LassoSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y) &&
-	    BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
+	    BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED))
 	{
 		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 {
 	LassoSelectUserData *data = userData;
 
 	if (EDBM_backbuf_check(bm_solidoffs + index)) {
+		const int x0 = screen_co_a[0];
+		const int y0 = screen_co_a[1];
+		const int x1 = screen_co_b[0];
+		const int y1 = screen_co_b[1];
+
 		if (data->pass == 0) {
-			if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)  &&
+			if (edge_fully_inside_rect(data->rect_fl, screen_co_a, screen_co_b)  &&
 			    BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, IS_CLIPPED) &&
 			    BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, IS_CLIPPED))
 			{
@@ -476,12 +496,12 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int
 		}
 	}
 }
-static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
+static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
 {
 	LassoSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y) &&
-	    BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
+	    BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED))
 	{
 		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
@@ -494,11 +514,11 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
 	rcti rect;
 	int bbsel;
 	
-	BLI_lasso_boundbox(&rect, mcords, moves);
-	
 	/* set editmesh */
 	vc->em = BMEdit_FromObject(vc->obedit);
 
+	BLI_lasso_boundbox(&rect, mcords, moves);
+
 	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	if (extend == 0 && select)
@@ -515,17 +535,17 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
 			edbm_backbuf_check_and_select_verts(vc->em, select);
 		}
 		else {
-			mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+			mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 	if (ts->selectmode & SCE_SELECT_EDGE) {
 		/* Does both bbsel and non-bbsel versions (need screen cos for both) */
 		data.pass = 0;
-		mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
+		mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_NOP);
 
 		if (data.is_done == 0) {
 			data.pass = 1;
-			mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
+			mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_NOP);
 		}
 	}
 	
@@ -534,7 +554,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
 			edbm_backbuf_check_and_select_faces(vc->em, select);
 		}
 		else {
-			mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data);
+			mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 	
@@ -542,13 +562,13 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
 	EDBM_selectmode_flush(vc->em);
 }
 
-static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
 {
 	LassoSelectUserData *data = userData;
 	Object *obedit = data->vc->obedit;
 	Curve *cu = (Curve *)obedit->data;
 
-	if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
+	if (BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED)) {
 		if (bp) {
 			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 			if (bp == cu->lastsel && !(bp->f1 & SELECT)) cu->lastsel = NULL;
@@ -578,38 +598,45 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
 static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
 {
 	LassoSelectUserData data;
+	rcti rect;
+
+	BLI_lasso_boundbox(&rect, mcords, moves);
 
-	view3d_userdata_lassoselect_init(&data, vc, NULL, mcords, moves, select);
+	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	if (extend == 0 && select)
 		CU_deselect_all(vc->obedit);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	nurbs_foreachScreenVert(vc, do_lasso_select_curve__doSelect, &data);
+	nurbs_foreachScreenVert(vc, do_lasso_select_curve__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
-static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x, int y)
+static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, const float screen_co[2])
 {
 	LassoSelectUserData *data = userData;
 
-	if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
+	    BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED)) {
 		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
 static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
 {
 	LassoSelectUserData data;
+	rcti rect;
 
-	view3d_userdata_lassoselect_init(&data, vc, NULL, mcords, moves, select);
+	BLI_lasso_boundbox(&rect, mcords, moves);
+
+	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	if (extend == 0 && select)
 		ED_setflagsLatt(vc->obedit, 0);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data);
+	lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
-static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBone *ebone, int x0, int y0, int x1, int y1)
+static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 {
 	LassoSelectUserData *data = userData;
 	bArmature *arm = data->vc->obedit->data;
@@ -618,6 +645,11 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
 		int is_point_done = FALSE;
 		int points_proj_tot = 0;
 
+		const int x0 = screen_co_a[0];
+		const int y0 = screen_co_a[1];
+		const int x1 = screen_co_b[0];
+		const int y1 = screen_co_b[1];
+
 		/* project head location to screenspace */
 		if (x0 != IS_CLIPPED) {
 			points_proj_tot++;
@@ -660,16 +692,16 @@ static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], sho
 	LassoSelectUserData data;
 	rcti rect;
 
+	BLI_lasso_boundbox(&rect, mcords, moves);
+
 	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-	BLI_lasso_boundbox(&rect, mcords, moves);
-
 	if (extend == 0 && select)
 		ED_armature_deselect_all_visible(vc->obedit);
 
-	armature_foreachScreenBone(vc, do_lasso_select_armature__doSelectBone, &data);
+	armature_foreachScreenBone(vc, do_lasso_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	if (data.is_change) {
 		bArmature *arm = vc->obedit->data;
@@ -679,12 +711,12 @@ static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], sho
 	}
 }
 
-static void do_lasso_select_mball__doSelectElem(void *userData, struct MetaElem *ml, int x, int y)
+static void do_lasso_select_mball__doSelectElem(void *userData, struct MetaElem *ml, const float screen_co[2])
 {
 	LassoSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y) &&
-	    BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, INT_MAX)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
+	    BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], INT_MAX)) {
 		if (data->select) ml->flag |=  SELECT;
 		else              ml->flag &= ~SELECT;
 		data->is_change = TRUE;
@@ -700,13 +732,13 @@ static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short m
 	if (extend == 0 && select)
 		 BKE_mball_deselect_all(mb);
 
+	BLI_lasso_boundbox(&rect, mcords, moves);
+
 	view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-	BLI_lasso_boundbox(&rect, mcords, moves);
-
-	mball_foreachScreenElem(vc, do_lasso_select_mball__doSelectElem, &data);
+	mball_foreachScreenElem(vc, do_lasso_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
 static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
@@ -856,9 +888,10 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc,
 			do_lasso_select_paintface(vc, mcords, moves, extend, select);
 		else if (paint_vertsel_test(ob))
 			do_lasso_select_paintvert(vc, mcords, moves, extend, select);
-		else if (ob && ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))
-			;
-		else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT)
+		else if (ob && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) {
+			/* pass */
+		}
+		else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT))
 			PE_lasso_select(C, mcords, moves, extend, select);
 		else {
 			do_lasso_select_objects(vc, mcords, moves, extend, select);
@@ -911,7 +944,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
 		select = !RNA_boolean_get(op->ptr, "deselect");
 		view3d_lasso_select(C, &vc, mcords, mcords_tot, extend, select);
 		
-		MEM_freeN(mcords);
+		MEM_freeN((void *)mcords);
 
 		return OPERATOR_FINISHED;
 	}
@@ -1031,11 +1064,11 @@ static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *
 static int object_select_menu_exec(bContext *C, wmOperator *op)
 {
 	int name_index = RNA_enum_get(op->ptr, "name");
-	short extend = RNA_boolean_get(op->ptr, "extend");
+	short toggle = RNA_boolean_get(op->ptr, "toggle");
 	short changed = 0;
 	const char *name = object_mouse_select_menu_data[name_index].idname;
 
-	if (!extend) {
+	if (!toggle) {
 		CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
 		{
 			if (base->flag & SELECT) {
@@ -1092,7 +1125,7 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
 	RNA_def_property_flag(prop, PROP_HIDDEN);
 	ot->prop = prop;
 
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
+	RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "Toggle selection instead of deselecting everything first");
 }
 
 static void deselectall_except(Scene *scene, Base *b)   /* deselect all except b */
@@ -1108,7 +1141,7 @@ static void deselectall_except(Scene *scene, Base *b)   /* deselect all except b
 	}
 }
 
-static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short extend)
+static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
 {
 	short baseCount = 0;
 	short ok;
@@ -1174,7 +1207,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
 			PointerRNA ptr;
 
 			WM_operator_properties_create(&ptr, "VIEW3D_OT_select_menu");
-			RNA_boolean_set(&ptr, "extend", extend);
+			RNA_boolean_set(&ptr, "toggle", toggle);
 			WM_operator_name_call(C, "VIEW3D_OT_select_menu", WM_OP_INVOKE_DEFAULT, &ptr);
 			WM_operator_properties_free(&ptr);
 		}
@@ -1387,9 +1420,12 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
 	View3D *v3d = CTX_wm_view3d(C);
 	Scene *scene = CTX_data_scene(C);
 	Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
-	int temp, a, dist = 100;
+	int  a;
+	float dist = 100.0f;
 	int retval = 0;
 	short hits;
+	const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
+
 	
 	/* setup view context for argument to callbacks */
 	view3d_set_viewcontext(C, &vc);
@@ -1404,19 +1440,22 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
 		
 		/* note; shift+alt goes to group-flush-selecting */
 		if (enumerate) {
-			basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, extend);
+			basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, toggle);
 		}
 		else {
 			base = startbase;
 			while (base) {
 				if (BASE_SELECTABLE(v3d, base)) {
-					ED_view3d_project_base(ar, base);
-					temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
-					if (base == BASACT) temp += 10;
-					if (temp < dist) {
-						
-						dist = temp;
-						basact = base;
+					float screen_co[2];
+					if (ED_view3d_project_float_global(ar, base->object->obmat[3], screen_co,
+					                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
+					{
+						float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
+						if (base == BASACT) dist_temp += 10.0f;
+						if (dist_temp < dist) {
+							dist = dist_temp;
+							basact = base;
+						}
 					}
 				}
 				base = base->next;
@@ -1441,7 +1480,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
 
 			/* note; shift+alt goes to group-flush-selecting */
 			if (has_bones == 0 && enumerate) {
-				basact = object_mouse_select_menu(C, &vc, buffer, hits, mval, extend);
+				basact = object_mouse_select_menu(C, &vc, buffer, hits, mval, toggle);
 			}
 			else {
 				basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, has_bones);
@@ -1583,6 +1622,8 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
 typedef struct BoxSelectUserData {
 	ViewContext *vc;
 	const rcti *rect;
+	const rctf *rect_fl;
+	rctf       _rect_fl;
 	int select;
 
 	/* runtime */
@@ -1595,7 +1636,11 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
                                            ViewContext *vc, const rcti *rect, const int select)
 {
 	r_data->vc = vc;
+
 	r_data->rect = rect;
+	r_data->rect_fl = &r_data->_rect_fl;
+	BLI_rctf_rcti_copy(&r_data->_rect_fl, rect);
+
 	r_data->select = select;
 
 	/* runtime */
@@ -1604,23 +1649,20 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
 	r_data->is_change = FALSE;
 }
 
-int edge_inside_circle(int centx, int centy, int radius, int x1, int y1, int x2, int y2)
+int edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
 {
 	int radius_squared = radius * radius;
 
 	/* check points in circle itself */
-	if ((x1 - centx) * (x1 - centx) + (y1 - centy) * (y1 - centy) <= radius_squared) {
+	if (len_squared_v2v2(cent, screen_co_a) <= radius_squared) {
 		return TRUE;
 	}
-	else if ((x2 - centx) * (x2 - centx) + (y2 - centy) * (y2 - centy) <= radius_squared) {
+	if (len_squared_v2v2(cent, screen_co_b) <= radius_squared) {
 		return TRUE;
 	}
 	else {
-		const float cent[2] = {centx, centy};
-		const float v1[2] = {x1, y1};
-		const float v2[2] = {x2, y2};
 		/* pointdistline */
-		if (dist_squared_to_line_segment_v2(cent, v1, v2) < (float)radius_squared) {
+		if (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < (float)radius_squared) {
 			return TRUE;
 		}
 	}
@@ -1628,13 +1670,13 @@ int edge_inside_circle(int centx, int centy, int radius, int x1, int y1, int x2,
 	return FALSE;
 }
 
-static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
 {
 	BoxSelectUserData *data = userData;
 	Object *obedit = data->vc->obedit;
 	Curve *cu = (Curve *)obedit->data;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
 		if (bp) {
 			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 			if (bp == cu->lastsel && !(bp->f1 & SELECT)) cu->lastsel = NULL;
@@ -1670,16 +1712,16 @@ static int do_nurbs_box_select(ViewContext *vc, rcti *rect, int select, int exte
 		CU_deselect_all(vc->obedit);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	nurbs_foreachScreenVert(vc, do_nurbs_box_select__doSelect, &data);
+	nurbs_foreachScreenVert(vc, do_nurbs_box_select__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	return OPERATOR_FINISHED;
 }
 
-static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, int y)
+static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, const float screen_co[2])
 {
 	BoxSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
 		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
@@ -1693,42 +1735,42 @@ static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int ex
 		ED_setflagsLatt(vc->obedit, 0);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data);
+	lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 	
 	return OPERATOR_FINISHED;
 }
 
-static void do_mesh_box_select__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
+static void do_mesh_box_select__doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
 {
 	BoxSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
 		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
 {
 	BoxSelectUserData *data = userData;
 
 	if (EDBM_backbuf_check(bm_solidoffs + index)) {
 		if (data->pass == 0) {
-			if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)) {
+			if (edge_fully_inside_rect(data->rect_fl, screen_co_a, screen_co_b)) {
 				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 				data->is_done = TRUE;
 			}
 		}
 		else {
-			if (edge_inside_rect(data->rect, x0, y0, x1, y1)) {
+			if (edge_inside_rect(data->rect_fl, screen_co_a, screen_co_b)) {
 				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 			}
 		}
 	}
 }
-static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
+static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
 {
 	BoxSelectUserData *data = userData;
 
-	if (BLI_rcti_isect_pt(data->rect, x, y)) {
+	if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
 		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
 }
@@ -1754,18 +1796,18 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
 			edbm_backbuf_check_and_select_verts(vc->em, select);
 		}
 		else {
-			mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+			mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 	if (ts->selectmode & SCE_SELECT_EDGE) {
 		/* Does both bbsel and non-bbsel versions (need screen cos for both) */
 
 		data.pass = 0;
-		mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
+		mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_NOP);
 
 		if (data.is_done == 0) {
 			data.pass = 1;
-			mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
+			mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_NOP);
 		}
 	}
 	
@@ -1774,7 +1816,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
 			edbm_backbuf_check_and_select_faces(vc->em, select);
 		}
 		else {
-			mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data);
+			mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 	
@@ -1973,12 +2015,10 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
 			}
 			
 			if (bone_selected) {
-				Object *ob = base->object;
-				
-				if (ob && (ob->type == OB_ARMATURE)) {
-					bArmature *arm = ob->data;
+				if (base->object && (base->object->type == OB_ARMATURE)) {
+					bArmature *arm = base->object->data;
 					
-					WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+					WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, base->object);
 					
 					if (arm && (arm->flag & ARM_HAS_VIZ_DEPS)) {
 						/* mask modifier ('armature' mode), etc. */
@@ -2216,7 +2256,8 @@ void VIEW3D_OT_select(wmOperatorType *ot)
 typedef struct CircleSelectUserData {
 	ViewContext *vc;
 	short select;
-	int mval[2];
+	int   mval[2];
+	float mval_fl[2];
 	float radius;
 	float radius_squared;
 
@@ -2230,6 +2271,9 @@ static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
 	r_data->vc = vc;
 	r_data->select = select;
 	copy_v2_v2_int(r_data->mval, mval);
+	r_data->mval_fl[0] = mval[0];
+	r_data->mval_fl[1] = mval[1];
+
 	r_data->radius = rad;
 	r_data->radius_squared = rad * rad;
 
@@ -2237,31 +2281,27 @@ static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
 	r_data->is_change = FALSE;
 }
 
-static void mesh_circle_doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
+static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
 
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
+static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
 
-	if (edge_inside_circle(data->mval[0], data->mval[1], (int)data->radius, x0, y0, x1, y1)) {
+	if (edge_inside_circle(data->mval_fl, (int)data->radius, screen_co_a, screen_co_b)) {
 		BM_edge_select_set(data->vc->em->bm, eed, data->select);
 	}
 }
-static void mesh_circle_doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
+static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
 
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
 }
@@ -2284,7 +2324,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
 			edbm_backbuf_check_and_select_verts(vc->em, select == LEFTMOUSE);
 		}
 		else {
-			mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+			mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 
@@ -2293,7 +2333,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
 			edbm_backbuf_check_and_select_edges(vc->em, select == LEFTMOUSE);
 		}
 		else {
-			mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_CLIP_TEST_OFF);
+			mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_NOP);
 		}
 	}
 	
@@ -2302,7 +2342,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
 			edbm_backbuf_check_and_select_faces(vc->em, select == LEFTMOUSE);
 		}
 		else {
-			mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data);
+			mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 		}
 	}
 
@@ -2319,7 +2359,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const int m
 	if (me) {
 		bm_vertoffs = me->totpoly + 1; /* max index array */
 
-		/* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
+		/* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
 		edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE);
 		EDBM_backbuf_free();
 		paintface_flush_flags(ob);
@@ -2336,7 +2376,7 @@ static void paint_vertsel_circle_select(ViewContext *vc, int select, const int m
 	if (me) {
 		bm_vertoffs = me->totvert + 1; /* max index array */
 
-		/* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
+		/* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
 		edbm_backbuf_check_and_select_verts_obmode(me, select == LEFTMOUSE);
 		EDBM_backbuf_free();
 
@@ -2345,16 +2385,13 @@ static void paint_vertsel_circle_select(ViewContext *vc, int select, const int m
 }
 
 
-static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
 {
 	CircleSelectUserData *data = userData;
 	Object *obedit = data->vc->obedit;
 	Curve *cu = (Curve *)obedit->data;
 
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
-
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		if (bp) {
 			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 
@@ -2388,17 +2425,15 @@ static void nurbscurve_circle_select(ViewContext *vc, int select, const int mval
 	view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data);
+	nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
 
-static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int y)
+static void latticecurve_circle_doSelect(void *userData, BPoint *bp, const float screen_co[2])
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
 
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
@@ -2409,18 +2444,16 @@ static void lattice_circle_select(ViewContext *vc, int select, const int mval[2]
 	view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-	lattice_foreachScreenVert(vc, latticecurve_circle_doSelect, &data);
+	lattice_foreachScreenVert(vc, latticecurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
 
 /* NOTE: pose-bone case is copied from editbone case... */
-static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int x, int y)
+static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, const float screen_co[2])
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
 
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		if (data->select)
 			pchan->bone->flag |= BONE_SELECTED;
 		else
@@ -2429,7 +2462,7 @@ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int
 	}
 	return 0;
 }
-static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, int x0, int y0, int x1, int y1)
+static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
 {
 	CircleSelectUserData *data = userData;
 	bArmature *arm = data->vc->obact->data;
@@ -2439,17 +2472,17 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
 		int points_proj_tot = 0;
 
 		/* project head location to screenspace */
-		if (x0 != IS_CLIPPED) {
+		if (screen_co_a[0] != IS_CLIPPED) {
 			points_proj_tot++;
-			if (pchan_circle_doSelectJoint(data, pchan, x0, y0)) {
+			if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
 				is_point_done = TRUE;
 			}
 		}
 
 		/* project tail location to screenspace */
-		if (x1 != IS_CLIPPED) {
+		if (screen_co_b[0] != IS_CLIPPED) {
 			points_proj_tot++;
-			if (pchan_circle_doSelectJoint(data, pchan, x1, y1)) {
+			if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
 				is_point_done = TRUE;
 			}
 		}
@@ -2462,7 +2495,7 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
 		 * It works nicer to only do this if the head or tail are not in the circle,
 		 * otherwise there is no way to circle select joints alone */
 		if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
-		    edge_inside_circle(data->mval[0], data->mval[1], data->radius, x0, y0, x1, y1))
+		    edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
 		{
 			if (data->select) pchan->bone->flag |= BONE_SELECTED;
 			else              pchan->bone->flag &= ~BONE_SELECTED;
@@ -2480,7 +2513,7 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f
 
 	ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */
 	
-	pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data);
+	pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	if (data.is_change) {
 		bArmature *arm = vc->obact->data;
@@ -2494,13 +2527,11 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f
 	}
 }
 
-static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int x, int y, short head)
+static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, const float screen_co[2], short head)
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
-	
-	if (len_squared_v2(delta) <= data->radius_squared) {
+
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		if (head) {
 			if (data->select)
 				ebone->flag |= BONE_ROOTSEL;
@@ -2517,7 +2548,7 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int
 	}
 	return 0;
 }
-static void do_circle_select_armature__doSelectBone(void *userData, struct EditBone *ebone, int x0, int y0, int x1, int y1)
+static void do_circle_select_armature__doSelectBone(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
 {
 	CircleSelectUserData *data = userData;
 	bArmature *arm = data->vc->obedit->data;
@@ -2527,17 +2558,17 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
 		int points_proj_tot = 0;
 
 		/* project head location to screenspace */
-		if (x0 != IS_CLIPPED) {
+		if (screen_co_a[0] != IS_CLIPPED) {
 			points_proj_tot++;
-			if (armature_circle_doSelectJoint(data, ebone, x0, y0, TRUE)) {
+			if (armature_circle_doSelectJoint(data, ebone, screen_co_a, TRUE)) {
 				is_point_done = TRUE;
 			}
 		}
 
 		/* project tail location to screenspace */
-		if (x1 != IS_CLIPPED) {
+		if (screen_co_b[0] != IS_CLIPPED) {
 			points_proj_tot++;
-			if (armature_circle_doSelectJoint(data, ebone, x1, y1, FALSE)) {
+			if (armature_circle_doSelectJoint(data, ebone, screen_co_b, FALSE)) {
 				is_point_done = TRUE;
 			}
 		}
@@ -2550,7 +2581,7 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
 		 * It works nicer to only do this if the head or tail are not in the circle,
 		 * otherwise there is no way to circle select joints alone */
 		if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
-		    edge_inside_circle(data->mval[0], data->mval[1], data->radius, x0, y0, x1, y1))
+		    edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
 		{
 			if (data->select) ebone->flag |=  (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 			else              ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
@@ -2569,7 +2600,7 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-	armature_foreachScreenBone(vc, do_circle_select_armature__doSelectBone, &data);
+	armature_foreachScreenBone(vc, do_circle_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 
 	if (data.is_change) {
 		ED_armature_sync_selection(arm->edbo);
@@ -2578,13 +2609,11 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
 	}
 }
 
-static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem *ml, int x, int y)
+static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem *ml, const float screen_co[2])
 {
 	CircleSelectUserData *data = userData;
-	const float delta[2] = {(float)(x - data->mval[0]),
-	                        (float)(y - data->mval[1])};
 
-	if (len_squared_v2(delta) <= data->radius_squared) {
+	if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
 		if (data->select) ml->flag |=  SELECT;
 		else              ml->flag &= ~SELECT;
 		data->is_change = TRUE;
@@ -2598,7 +2627,7 @@ static void mball_circle_select(ViewContext *vc, int select, const int mval[2],
 
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-	mball_foreachScreenElem(vc, do_circle_select_mball__doSelectElem, &data);
+	mball_foreachScreenElem(vc, do_circle_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 }
 
 /** Callbacks for circle selection in Editmode */
@@ -2633,11 +2662,12 @@ static int object_circle_select(ViewContext *vc, int select, const int mval[2],
 	const float radius_squared = rad * rad;
 	const float mval_fl[2] = {mval[0], mval[1]};
 	int is_change = FALSE;
+	int select_flag = select ? SELECT : 0;
 
 	Base *base;
 	select = select ? BA_SELECT : BA_DESELECT;
 	for (base = FIRSTBASE; base; base = base->next) {
-		if (((base->flag & SELECT) == 0) && BASE_SELECTABLE(vc->v3d, base)) {
+		if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag & SELECT) != select_flag)) {
 			float screen_co[2];
 			if (ED_view3d_project_float_global(vc->ar, base->object->obmat[3], screen_co,
 			                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index e55e97e..7f1bbb2 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -82,10 +82,9 @@ extern float originmat[3][3];   /* XXX object.c */
 
 typedef struct TransVert {
 	float *loc;
-	float oldloc[3], maploc[3], fac;
+	float oldloc[3], maploc[3];
 	float *val, oldval;
 	int flag;
-	float *nor;
 } TransVert;
 
               /* SELECT == (1 << 0) */
@@ -193,6 +192,20 @@ static void special_transvert_update(Object *obedit)
 	}
 }
 
+/* currently only used for bmesh index values */
+enum {
+	TM_INDEX_ON      =  1,  /* tag to make trans verts */
+	TM_INDEX_OFF     =  0,  /* don't make verts */
+	TM_INDEX_SKIP    = -1   /* dont make verts (when the index values point to trans-verts) */
+};
+
+/* copied from editobject.c, needs to be replaced with new transform code still */
+/* mode flags: */
+enum {
+	TM_ALL_JOINTS      = 1, /* all joints (for bones only) */
+	TM_SKIP_HANDLES    = 2  /* skip handles when control point is selected (for curves only) */
+};
+
 static void set_mapped_co(void *vuserdata, int index, const float co[3],
                           const float UNUSED(no[3]), const short UNUSED(no_s[3]))
 {
@@ -201,16 +214,25 @@ static void set_mapped_co(void *vuserdata, int index, const float co[3],
 	TransVert *tv = userdata[1];
 	BMVert *eve = EDBM_vert_at_index(em, index);
 	
-	if (BM_elem_index_get(eve) != -1 && !(tv[BM_elem_index_get(eve)].flag & TX_VERT_USE_MAPLOC)) {
-		copy_v3_v3(tv[BM_elem_index_get(eve)].maploc, co);
-		tv[BM_elem_index_get(eve)].flag |= TX_VERT_USE_MAPLOC;
+	if (BM_elem_index_get(eve) != TM_INDEX_SKIP) {
+		tv = &tv[BM_elem_index_get(eve)];
+
+		/* be clever, get the closest vertex to the original,
+		 * behaves most logically when the mirror modifier is used for eg [#33051]*/
+		if ((tv->flag & TX_VERT_USE_MAPLOC) == 0) {
+			/* first time */
+			copy_v3_v3(tv->maploc, co);
+			tv->flag |= TX_VERT_USE_MAPLOC;
+		}
+		else {
+			/* find best location to use */
+			if (len_squared_v3v3(eve->co, co) < len_squared_v3v3(eve->co, tv->maploc)) {
+				copy_v3_v3(tv->maploc, co);
+			}
+		}
 	}
 }
 
-/* copied from editobject.c, needs to be replaced with new transform code still */
-/* mode flags: */
-#define TM_ALL_JOINTS       1 /* all joints (for bones only) */
-#define TM_SKIP_HANDLES     2 /* skip handles when control point is selected (for curves only) */
 static void make_trans_verts(Object *obedit, float min[3], float max[3], int mode)
 {
 	Nurb *nu;
@@ -233,7 +255,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 		BMesh *bm = em->bm;
 		BMIter iter;
 		void *userdata[2] = {em, NULL};
-		/*int proptrans= 0; */ /*UNUSED*/
+		/*int proptrans = 0; */ /*UNUSED*/
 		
 		/* abuses vertex index all over, set, just set dirty here,
 		 * perhaps this could use its own array instead? - campbell */
@@ -243,35 +265,37 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 		if (em->selectmode & SCE_SELECT_VERTEX) {
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 				if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
-					BM_elem_index_set(eve, 1); /* set_dirty! */
+					BM_elem_index_set(eve, TM_INDEX_ON); /* set_dirty! */
 					tottrans++;
 				}
-				else BM_elem_index_set(eve, 0);  /* set_dirty! */
+				else {
+					BM_elem_index_set(eve, TM_INDEX_OFF);  /* set_dirty! */
+				}
 			}
 		}
 		else if (em->selectmode & SCE_SELECT_EDGE) {
 			BMEdge *eed;
 
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
-				BM_elem_index_set(eve, 0);     /* set_dirty! */
+				BM_elem_index_set(eve, TM_INDEX_OFF);  /* set_dirty! */
 			}
 
 			BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
 				if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
-					BM_elem_index_set(eed->v1, 1); /* set_dirty! */
-					BM_elem_index_set(eed->v2, 1); /* set_dirty! */
+					BM_elem_index_set(eed->v1, TM_INDEX_ON);  /* set_dirty! */
+					BM_elem_index_set(eed->v2, TM_INDEX_ON);  /* set_dirty! */
 				}
 			}
 
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
-				if (BM_elem_index_get(eve)) tottrans++;
+				if (BM_elem_index_get(eve) == TM_INDEX_ON) tottrans++;
 			}
 		}
 		else {
 			BMFace *efa;
 
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
-				BM_elem_index_set(eve, 0); /* set_dirty! */
+				BM_elem_index_set(eve, TM_INDEX_OFF);  /* set_dirty! */
 			}
 
 			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
@@ -280,13 +304,13 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 					BMLoop *l;
 					
 					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
-						BM_elem_index_set(l->v, 1); /* set_dirty! */
+						BM_elem_index_set(l->v, TM_INDEX_ON); /* set_dirty! */
 					}
 				}
 			}
 
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
-				if (BM_elem_index_get(eve)) tottrans++;
+				if (BM_elem_index_get(eve) == TM_INDEX_ON) tottrans++;
 			}
 		}
 		/* for any of the 3 loops above which all dirty the indices */
@@ -299,17 +323,15 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 			a = 0;
 			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 				if (BM_elem_index_get(eve)) {
-					BM_elem_index_set(eve, a); /* set_dirty! */
+					BM_elem_index_set(eve, a);  /* set_dirty! */
 					copy_v3_v3(tv->oldloc, eve->co);
 					tv->loc = eve->co;
-					if (eve->no[0] != 0.0f || eve->no[1] != 0.0f || eve->no[2] != 0.0f)
-						tv->nor = eve->no;  /* note this is a hackish signal (ton) */
-					tv->flag = BM_elem_index_get(eve) & SELECT;
+					tv->flag = (BM_elem_index_get(eve) == TM_INDEX_ON) ? SELECT : 0;
 					tv++;
 					a++;
 				}
 				else {
-					BM_elem_index_set(eve, -1); /* set_dirty! */
+					BM_elem_index_set(eve, TM_INDEX_SKIP);  /* set_dirty! */
 				}
 			}
 			/* set dirty already, above */
@@ -345,17 +367,15 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 					if (rootok) {
 						copy_v3_v3(tv->oldloc, ebo->head);
 						tv->loc = ebo->head;
-						tv->nor = NULL;
-						tv->flag = 1;
+						tv->flag = SELECT;
 						tv++;
 						tottrans++;
-					}	
+					}
 					
 					if ((mode & TM_ALL_JOINTS) && (tipsel)) {
 						copy_v3_v3(tv->oldloc, ebo->tail);
 						tv->loc = ebo->tail;
-						tv->nor = NULL;
-						tv->flag = 1;
+						tv->flag = SELECT;
 						tv++;
 						tottrans++;
 					}
@@ -363,8 +383,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 				else if (tipsel) {
 					copy_v3_v3(tv->oldloc, ebo->tail);
 					tv->loc = ebo->tail;
-					tv->nor = NULL;
-					tv->flag = 1;
+					tv->flag = SELECT;
 					tv++;
 					tottrans++;
 				}
@@ -456,7 +475,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
 				copy_v3_v3(tv->oldloc, tv->loc);
 				tv->val = &(ml->rad);
 				tv->oldval = ml->rad;
-				tv->flag = 1;
+				tv->flag = SELECT;
 				tv++;
 				tottrans++;
 			}
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index b40e880..bfeb560 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -173,16 +173,16 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
 	search[0] = 0;
 	
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU);
 	
 	/* fake button, it holds space for search items */
-	uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+	uiDefBut(block, LABEL, 0, "", 10, 15, uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
 	
 	but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
 	uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
 	
 	uiBoundsBlock(block, 6);
-	uiBlockSetDirection(block, UI_DOWN);	
+	uiBlockSetDirection(block, UI_DOWN);
 	uiEndBlock(C, block);
 	
 	event = *(win->eventstate);  /* XXX huh huh? make api call */
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index e4a6d7e..ef15c1e 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -125,7 +125,7 @@ struct SmoothView3DStore {
 /* will start timer if appropriate */
 /* the arguments are the desired situation */
 void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera,
-						float *ofs, float *quat, float *dist, float *lens)
+                        float *ofs, float *quat, float *dist, float *lens)
 {
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *win = CTX_wm_window(C);
@@ -140,7 +140,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera
 	copy_qt_qt(sms.new_quat, rv3d->viewquat);
 	sms.new_dist = rv3d->dist;
 	sms.new_lens = v3d->lens;
-	sms.to_camera = 0;
+	sms.to_camera = FALSE;
 
 	/* note on camera locking, this is a little confusing but works ok.
 	 * we may be changing the view 'as if' there is no active camera, but in fact
@@ -161,23 +161,24 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera
 	if (lens) sms.new_lens = *lens;
 
 	if (camera) {
+		sms.new_dist = ED_view3d_offset_distance(camera->obmat, ofs);
 		ED_view3d_from_object(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens);
-		sms.to_camera = 1; /* restore view3d values in end */
+		sms.to_camera = TRUE; /* restore view3d values in end */
 	}
 	
 	if (C && U.smooth_viewtx) {
-		int changed = 0; /* zero means no difference */
+		int changed = FALSE; /* zero means no difference */
 		
 		if (oldcamera != camera)
-			changed = 1;
+			changed = TRUE;
 		else if (sms.new_dist != rv3d->dist)
-			changed = 1;
+			changed = TRUE;
 		else if (sms.new_lens != v3d->lens)
-			changed = 1;
+			changed = TRUE;
 		else if (!equals_v3v3(sms.new_ofs, rv3d->ofs))
-			changed = 1;
+			changed = TRUE;
 		else if (!equals_v4v4(sms.new_quat, rv3d->viewquat))
-			changed = 1;
+			changed = TRUE;
 		
 		/* The new view is different from the old one
 		 * so animate the view */
@@ -185,7 +186,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera
 
 			/* original values */
 			if (oldcamera) {
-				sms.orig_dist = rv3d->dist;  /* below function does weird stuff with it... */
+				sms.orig_dist = ED_view3d_offset_distance(oldcamera->obmat, rv3d->ofs);
 				ED_view3d_from_object(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens);
 			}
 			else {
@@ -241,11 +242,13 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera
 	
 	/* if we get here nothing happens */
 	if (ok == FALSE) {
-		if (sms.to_camera == 0) {
+		if (sms.to_camera == FALSE) {
 			copy_v3_v3(rv3d->ofs, sms.new_ofs);
 			copy_qt_qt(rv3d->viewquat, sms.new_quat);
 			rv3d->dist = sms.new_dist;
 			v3d->lens = sms.new_lens;
+
+			ED_view3d_camera_lock_sync(v3d, rv3d);
 		}
 
 		if (rv3d->viewlock & RV3D_BOXVIEW)
@@ -320,8 +323,14 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 	
 	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
-	
+
+	/* note: this doesn't work right because the v3d->lens is now used in ortho mode r51636,
+	 * when switching camera in quad-view the other ortho views would zoom & reset. */
+#if 0
 	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+#else
+	ED_region_tag_redraw(CTX_wm_region(C));
+#endif
 	
 	return OPERATOR_FINISHED;
 }
@@ -569,328 +578,27 @@ void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], bglMats *mats, co
 	}
 }
 
-/**
- * Calculate a 3d segment from 2d window coordinates.
- * This ray_start is located at the viewpoint, ray_end is a far point.
- * ray_start and ray_end are clipped by the view near and far limits
- * so points along this line are always in view.
- * In orthographic view all resulting segments will be parallel.
- * \param ar The region (used for the window width and height).
- * \param v3d The 3d viewport (used for near and far clipping range).
- * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
- * \param ray_start The world-space starting point of the segment.
- * \param ray_end The world-space end point of the segment.
- */
-void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
-{
-	RegionView3D *rv3d = ar->regiondata;
-	
-	if (rv3d->is_persp) {
-		float vec[3];
-		ED_view3d_win_to_vector(ar, mval, vec);
-
-		copy_v3_v3(ray_start, rv3d->viewinv[3]);
-		madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near);
-		madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far);
-	}
-	else {
-		float vec[4];
-		vec[0] = 2.0f * mval[0] / ar->winx - 1;
-		vec[1] = 2.0f * mval[1] / ar->winy - 1;
-		vec[2] = 0.0f;
-		vec[3] = 1.0f;
-		
-		mul_m4_v4(rv3d->persinv, vec);
-		
-		madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2],  1000.0f);
-		madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f);
-	}
-
-	/* clipping */
-	if (rv3d->rflag & RV3D_CLIPPING) {
-		int a;
-		for (a = 0; a < 4; a++) {
-			clip_line_plane(ray_start, ray_end, rv3d->clip[a]);
-		}
-	}
-}
-
-/**
- * Calculate a 3d viewpoint and direction vector from 2d window coordinates.
- * This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
- * ray_start is clipped by the view near limit so points in front of it are always in view.
- * In orthographic view the resulting ray_normal will match the view vector.
- * \param ar The region (used for the window width and height).
- * \param v3d The 3d viewport (used for near clipping value).
- * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
- * \param ray_start The world-space starting point of the segment.
- * \param ray_normal The normalized world-space direction of towards mval.
- */
-void ED_view3d_win_to_ray(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3])
-{
-	float ray_end[3];
-	
-	ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
-	sub_v3_v3v3(ray_normal, ray_end, ray_start);
-	normalize_v3(ray_normal);
-}
-
-/**
- * Calculate a normalized 3d direction vector from the viewpoint towards a global location.
- * In orthographic view the resulting vector will match the view vector.
- * \param rv3d The region (used for the window width and height).
- * \param coord The world-space location.
- * \param vec The resulting normalized vector.
- */
-void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float vec[3])
-{
-	if (rv3d->is_persp) {
-		float p1[4], p2[4];
-
-		copy_v3_v3(p1, coord);
-		p1[3] = 1.0f;
-		copy_v3_v3(p2, p1);
-		p2[3] = 1.0f;
-		mul_m4_v4(rv3d->viewmat, p2);
-
-		mul_v3_fl(p2, 2.0f);
-
-		mul_m4_v4(rv3d->viewinv, p2);
-
-		sub_v3_v3v3(vec, p1, p2);
-	}
-	else {
-		copy_v3_v3(vec, rv3d->viewinv[2]);
-	}
-	normalize_v3(vec);
-}
-
-int initgrabz(RegionView3D *rv3d, float x, float y, float z)
-{
-	int flip = FALSE;
-	if (rv3d == NULL) return flip;
-	rv3d->zfac = rv3d->persmat[0][3] * x + rv3d->persmat[1][3] * y + rv3d->persmat[2][3] * z + rv3d->persmat[3][3];
-	if (rv3d->zfac < 0.0f)
-		flip = TRUE;
-	/* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that 
-	 * (accounting for near zero values)
-	 */
-	if (rv3d->zfac < 1.e-6f && rv3d->zfac > -1.e-6f) rv3d->zfac = 1.0f;
-	
-	/* Negative zfac means x, y, z was behind the camera (in perspective).
-	 * This gives flipped directions, so revert back to ok default case.
-	 */
-	/* NOTE: I've changed this to flip zfac to be positive again for now so that GPencil draws ok
-	 * Aligorith, 2009Aug31 */
-	//if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f;
-	if (rv3d->zfac < 0.0f) rv3d->zfac = -rv3d->zfac;
-	
-	return flip;
-}
-
-/**
- * Calculate a 3d location from 2d window coordinates.
- * \param ar The region (used for the window width and height).
- * \param depth_pt The reference location used to calculate the Z depth.
- * \param mval The area relative location (such as event->mval converted to floats).
- * \param out The resulting world-space location.
- */
-void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[2], float out[3])
-{
-	RegionView3D *rv3d = ar->regiondata;
-	
-	float line_sta[3];
-	float line_end[3];
-
-	if (rv3d->is_persp) {
-		float mousevec[3];
-		copy_v3_v3(line_sta, rv3d->viewinv[3]);
-		ED_view3d_win_to_vector(ar, mval, mousevec);
-		add_v3_v3v3(line_end, line_sta, mousevec);
-
-		if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
-			/* highly unlikely to ever happen, mouse vec paralelle with view plane */
-			zero_v3(out);
-		}
-	}
-	else {
-		const float dx = (2.0f * mval[0] / (float)ar->winx) - 1.0f;
-		const float dy = (2.0f * mval[1] / (float)ar->winy) - 1.0f;
-		line_sta[0] = (rv3d->persinv[0][0] * dx) + (rv3d->persinv[1][0] * dy) + rv3d->viewinv[3][0];
-		line_sta[1] = (rv3d->persinv[0][1] * dx) + (rv3d->persinv[1][1] * dy) + rv3d->viewinv[3][1];
-		line_sta[2] = (rv3d->persinv[0][2] * dx) + (rv3d->persinv[1][2] * dy) + rv3d->viewinv[3][2];
-
-		add_v3_v3v3(line_end, line_sta, rv3d->viewinv[2]);
-		closest_to_line_v3(out, depth_pt, line_sta, line_end);
-	}
-}
-
-/**
- * Calculate a 3d difference vector from 2d window offset.
- * note that initgrabz() must be called first to determine
- * the depth used to calculate the delta.
- * \param ar The region (used for the window width and height).
- * \param mval The area relative 2d difference (such as event->mval[0] - other_x).
- * \param out The resulting world-space delta.
- */
-void ED_view3d_win_to_delta(ARegion *ar, const float mval[2], float out[3])
-{
-	RegionView3D *rv3d = ar->regiondata;
-	float dx, dy;
-	
-	dx = 2.0f * mval[0] * rv3d->zfac / ar->winx;
-	dy = 2.0f * mval[1] * rv3d->zfac / ar->winy;
-	
-	out[0] = (rv3d->persinv[0][0] * dx + rv3d->persinv[1][0] * dy);
-	out[1] = (rv3d->persinv[0][1] * dx + rv3d->persinv[1][1] * dy);
-	out[2] = (rv3d->persinv[0][2] * dx + rv3d->persinv[1][2] * dy);
-}
-
-/**
- * Calculate a 3d direction vector from 2d window coordinates.
- * This direction vector starts and the view in the direction of the 2d window coordinates.
- * In orthographic view all window coordinates yield the same vector.
- *
- * \note doesn't rely on initgrabz
- * for perspective view, get the vector direction to
- * the mouse cursor as a normalized vector.
- *
- * \param ar The region (used for the window width and height).
- * \param mval The area relative 2d location (such as event->mval converted to floats).
- * \param out The resulting normalized world-space direction vector.
- */
-void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
-{
-	RegionView3D *rv3d = ar->regiondata;
-
-	if (rv3d->is_persp) {
-		out[0] = 2.0f * (mval[0] / ar->winx) - 1.0f;
-		out[1] = 2.0f * (mval[1] / ar->winy) - 1.0f;
-		out[2] = -0.5f;
-		mul_project_m4_v3(rv3d->persinv, out);
-		sub_v3_v3(out, rv3d->viewinv[3]);
-	}
-	else {
-		copy_v3_v3(out, rv3d->viewinv[2]);
-	}
-	normalize_v3(out);
-}
-
-float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
-{
-	ViewDepths *vd = vc->rv3d->depths;
-		
-	x -= vc->ar->winrct.xmin;
-	y -= vc->ar->winrct.ymin;
-
-	if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
-		return vd->depths[y * vd->w + x];
-	else
-		return 1;
-}
-
-void ED_view3d_depth_tag_update(RegionView3D *rv3d)
-{
-	if (rv3d->depths)
-		rv3d->depths->damaged = 1;
-}
-
-void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4])
-{
-	float vmat[4][4];
-	
-	mult_m4_m4m4(vmat, rv3d->viewmat, ob->obmat);
-	mult_m4_m4m4(pmat, rv3d->winmat, vmat);
-}
-
-/* Uses window coordinates (x,y) and depth component z to find a point in
- * modelspace */
-void ED_view3d_unproject(bglMats *mats, float out[3], const float x, const float y, const float z)
-{
-	double ux, uy, uz;
-
-	gluUnProject(x, y, z, mats->modelview, mats->projection,
-	             (GLint *)mats->viewport, &ux, &uy, &uz);
-
-	out[0] = ux;
-	out[1] = uy;
-	out[2] = uz;
-}
-
-/* use #ED_view3d_ob_project_mat_get to get projecting mat */
-void ED_view3d_project_float_v2_m4(const ARegion *ar, const float co[3], float r_co[2], float mat[4][4])
-{
-	float vec4[4];
-	
-	copy_v3_v3(vec4, co);
-	vec4[3] = 1.0;
-	/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
-	
-	mul_m4_v4(mat, vec4);
-	
-	if (vec4[3] > FLT_EPSILON) {
-		r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
-		r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
-	}
-	else {
-		zero_v2(r_co);
-	}
-}
-
-/* use #ED_view3d_ob_project_mat_get to get projecting mat */
-void ED_view3d_project_float_v3_m4(ARegion *ar, const float vec[3], float r_co[3], float mat[4][4])
-{
-	float vec4[4];
-	
-	copy_v3_v3(vec4, vec);
-	vec4[3] = 1.0;
-	/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
-	
-	mul_m4_v4(mat, vec4);
-	
-	if (vec4[3] > FLT_EPSILON) {
-		r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
-		r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
-		r_co[2] = vec4[2] / vec4[3];
-	}
-	else {
-		zero_v3(r_co);
-	}
-}
-
-eV3DProjStatus ED_view3d_project_base(struct ARegion *ar, struct Base *base)
-{
-	eV3DProjStatus ret = ED_view3d_project_short_global(ar, base->object->obmat[3], &base->sx,
-	                                                    V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN);
-
-	if (ret != V3D_PROJ_RET_OK) {
-		base->sx = IS_CLIPPED;
-		base->sy = 0;
-	}
-
-	return ret;
-}
 
 int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
 {
 	/* return 1: draw */
-	
+
 	float mat[4][4];
 	float vec[4], min, max;
 	int a, flag = -1, fl;
-	
+
 	if (bb == NULL) return 1;
 	if (bb->flag & OB_BB_DISABLED) return 1;
-	
+
 	mult_m4_m4m4(mat, rv3d->persmat, obmat);
-	
+
 	for (a = 0; a < 8; a++) {
 		copy_v3_v3(vec, bb->vec[a]);
 		vec[3] = 1.0;
 		mul_m4_v4(mat, vec);
 		max = vec[3];
 		min = -vec[3];
-		
+
 		fl = 0;
 		if (vec[0] < min) fl += 1;
 		if (vec[0] > max) fl += 2;
@@ -898,153 +606,31 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
 		if (vec[1] > max) fl += 8;
 		if (vec[2] < min) fl += 16;
 		if (vec[2] > max) fl += 32;
-		
+
 		flag &= fl;
 		if (flag == 0) return 1;
 	}
-	
-	return 0;
-}
 
-/* perspmat is typically...
- * - 'rv3d->perspmat',   is_local == FALSE
- * - 'rv3d->perspmatob', is_local == TRUE
- */
-static eV3DProjStatus ed_view3d_project__internal(ARegion *ar,
-                                                  float perspmat[4][4], const int is_local,  /* normally hidden */
-                                                  const float co[3], float r_co[2], eV3DProjTest flag)
-{
-	float fx, fy, vec4[4];
-
-	if (flag & V3D_PROJ_TEST_CLIP_BB) {
-		RegionView3D *rv3d = ar->regiondata;
-		if (rv3d->rflag & RV3D_CLIPPING) {
-			if (ED_view3d_clipping_test(rv3d, co, is_local)) {
-				return V3D_PROJ_RET_CLIP_BB;
-			}
-		}
-	}
-
-	copy_v3_v3(vec4, co);
-	vec4[3] = 1.0;
-	mul_m4_v4(perspmat, vec4);
-
-	if (vec4[3] > (float)BL_NEAR_CLIP) {
-		fx = ((float)ar->winx / 2.0f) * (1.0f + vec4[0] / vec4[3]);
-		if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fx > 0 && fx < ar->winx)) {
-			fy = ((float)ar->winy / 2.0f) * (1.0f + vec4[1] / vec4[3]);
-			if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fy > 0.0f && fy < (float)ar->winy)) {
-				r_co[0] = (short)floor(fx);
-				r_co[1] = (short)floor(fy);
-			}
-			else {
-				return V3D_PROJ_RET_CLIP_WIN;
-			}
-		}
-		else {
-			return V3D_PROJ_RET_CLIP_WIN;
-		}
-	}
-	else {
-		return V3D_PROJ_RET_CLIP_NEAR;
-	}
-
-	return V3D_PROJ_RET_OK;
-}
-
-eV3DProjStatus ED_view3d_project_short_ex(ARegion *ar, float perspmat[4][4], const int is_local,
-                                          const float co[3], short r_co[2], eV3DProjTest flag)
-{
-	float tvec[2];
-	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
-	if (ret == V3D_PROJ_RET_OK) {
-		if ((tvec[0] > -32700.0 && tvec[0] < 32700.0f) &&
-		    (tvec[1] > -32700.0 && tvec[1] < 32700.0f))
-		{
-			r_co[0] = (short)floor(tvec[0]);
-			r_co[1] = (short)floor(tvec[1]);
-		}
-		else {
-			ret = V3D_PROJ_RET_OVERFLOW;
-		}
-	}
-	return ret;
-}
-
-eV3DProjStatus ED_view3d_project_int_ex(ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], int r_co[2], eV3DProjTest flag)
-{
-	float tvec[2];
-	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
-	if (ret == V3D_PROJ_RET_OK) {
-		if ((tvec[0] > -2140000000.0 && tvec[0] < 2140000000.0f) &&
-		    (tvec[1] > -2140000000.0 && tvec[1] < 2140000000.0f))
-		{
-			r_co[0] = (int)floor(tvec[0]);
-			r_co[1] = (int)floor(tvec[1]);
-		}
-		else {
-			ret = V3D_PROJ_RET_OVERFLOW;
-		}
-	}
-	return ret;
-}
-
-eV3DProjStatus ED_view3d_project_float_ex(ARegion *ar, float perspmat[4][4], const int is_local,
-                                        const float co[3], float r_co[2], eV3DProjTest flag)
-{
-	float tvec[2];
-	eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
-	if (ret == V3D_PROJ_RET_OK) {
-		if (finite(tvec[0]) &&
-		    finite(tvec[1]))
-		{
-			copy_v2_v2(r_co, tvec);
-		}
-		else {
-			ret = V3D_PROJ_RET_OVERFLOW;
-		}
-	}
-	return ret;
+	return 0;
 }
 
-/* --- short --- */
-eV3DProjStatus ED_view3d_project_short_global(ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag)
-{
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_short_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
-}
-/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_short_object(ARegion *ar, const float co[3], short r_co[2], eV3DProjTest flag)
+float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
 {
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_short_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
-}
+	ViewDepths *vd = vc->rv3d->depths;
+		
+	x -= vc->ar->winrct.xmin;
+	y -= vc->ar->winrct.ymin;
 
-/* --- int --- */
-eV3DProjStatus ED_view3d_project_int_global(ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag)
-{
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_int_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
-}
-/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_int_object(ARegion *ar, const float co[3], int r_co[2], eV3DProjTest flag)
-{
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_int_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+	if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
+		return vd->depths[y * vd->w + x];
+	else
+		return 1;
 }
 
-/* --- float --- */
-eV3DProjStatus ED_view3d_project_float_global(ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag)
-{
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_float_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
-}
-/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_float_object(ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag)
+void ED_view3d_depth_tag_update(RegionView3D *rv3d)
 {
-	RegionView3D *rv3d = ar->regiondata;
-	return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+	if (rv3d->depths)
+		rv3d->depths->damaged = 1;
 }
 
 /* copies logic of get_view3d_viewplane(), keep in sync */
@@ -1078,7 +664,10 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy,
 	return params.is_ortho;
 }
 
-void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)       /* rect: for picking */
+/*!
+ * \param rect for picking, NULL not to use.
+ */
+void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)
 {
 	RegionView3D *rv3d = ar->regiondata;
 	rctf viewplane;
@@ -1111,7 +700,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)       /* rect: for
 		
 		if (orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
 		else wmFrustum(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend);
-		
+
 	}
 	else {
 		if (orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend);
@@ -1207,7 +796,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
 {
 	if (rv3d->persp == RV3D_CAMOB) {      /* obs/camera */
 		if (v3d->camera) {
-			BKE_object_where_is_calc(scene, v3d->camera);	
+			BKE_object_where_is_calc(scene, v3d->camera);
 			obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
 		}
 		else {
@@ -1312,8 +901,8 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
 					glLoadName(code);
 					draw_object(scene, ar, v3d, base, DRAW_PICKING | DRAW_CONSTCOLOR);
 					
-					/* we draw group-duplicators for selection too */
-					if ((base->object->transflag & OB_DUPLI) && base->object->dup_group) {
+					/* we draw duplicators for selection too */
+					if ((base->object->transflag & OB_DUPLI)) {
 						ListBase *lb;
 						DupliObject *dob;
 						Base tbase;
@@ -1340,7 +929,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
 						free_object_duplilist(lb);
 					}
 					code++;
-				}				
+				}
 			}
 		}
 		v3d->xray = FALSE;  /* restore */
@@ -1445,7 +1034,8 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
 {
 	View3D *v3d = sa->spacedata.first;
 	Base *base;
-	float size = 0.0, min[3], max[3], box[3];
+	float min[3], max[3], box[3];
+	float size = 0.0f, size_persp = 0.0f, size_ortho = 0.0f;
 	unsigned int locallay;
 	int ok = FALSE;
 
@@ -1458,7 +1048,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
 	locallay = free_localbit(bmain);
 
 	if (locallay == 0) {
-		BKE_reportf(reports, RPT_ERROR, "No more than 8 localviews");
+		BKE_report(reports, RPT_ERROR, "No more than 8 local views");
 		ok = FALSE;
 	}
 	else {
@@ -1485,7 +1075,13 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
 		box[1] = (max[1] - min[1]);
 		box[2] = (max[2] - min[2]);
 		size = MAX3(box[0], box[1], box[2]);
-		if (size <= 0.01f) size = 0.01f;
+
+		/* do not zoom closer than the near clipping plane */
+		size = max_ff(size, v3d->near * 1.5f);
+
+		/* perspective size (we always switch out of camera view so no need to use its lens size) */
+		size_persp = ED_view3d_radius_to_persp_dist(focallength_to_fov(v3d->lens, DEFAULT_SENSOR_WIDTH), size / 2.0f) * VIEW3D_MARGIN;
+		size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
 	}
 	
 	if (ok == TRUE) {
@@ -1502,14 +1098,20 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
 				rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
 				memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
 				
-				rv3d->ofs[0] = -(min[0] + max[0]) / 2.0f;
-				rv3d->ofs[1] = -(min[1] + max[1]) / 2.0f;
-				rv3d->ofs[2] = -(min[2] + max[2]) / 2.0f;
+				mid_v3_v3v3(v3d->cursor, min, max);
+				negate_v3_v3(rv3d->ofs, v3d->cursor);
+
+				if (rv3d->persp == RV3D_CAMOB) {
+					rv3d->persp = RV3D_PERSP;
+				}
 
-				rv3d->dist = size;
 				/* perspective should be a bit farther away to look nice */
-				if (rv3d->persp == RV3D_ORTHO)
-					rv3d->dist *= 0.7f;
+				if (rv3d->persp != RV3D_ORTHO) {
+					rv3d->dist = size_persp;
+				}
+				else {
+					rv3d->dist = size_ortho;
+				}
 
 				/* correction for window aspect ratio */
 				if (ar->winy > 2 && ar->winx > 2) {
@@ -1517,12 +1119,6 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
 					if (asp < 1.0f) asp = 1.0f / asp;
 					rv3d->dist *= asp;
 				}
-				
-				if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP;
-				
-				v3d->cursor[0] = -rv3d->ofs[0];
-				v3d->cursor[1] = -rv3d->ofs[1];
-				v3d->cursor[2] = -rv3d->ofs[2];
 			}
 		}
 		
@@ -1613,7 +1209,7 @@ static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
 		DAG_on_visible_update(bmain, FALSE);
 
 		return TRUE;
-	} 
+	}
 	else {
 		return FALSE;
 	}
@@ -1686,12 +1282,12 @@ static void RestoreState(bContext *C, wmWindow *win)
 		GPU_paint_set_mipmap(0);
 
 	//XXX curarea->win_swap = 0;
-	//XXX curarea->head_swap=0;
+	//XXX curarea->head_swap = 0;
 	//XXX allqueue(REDRAWVIEW3D, 1);
 	//XXX allqueue(REDRAWBUTSALL, 0);
 	//XXX reset_slowparents();
 	//XXX waitcursor(0);
-	//XXX G.qual= 0;
+	//XXX G.qual = 0;
 	
 	if (win) /* check because closing win can set to NULL */
 		win->queue = queue_back;
@@ -1816,7 +1412,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
 	WM_redraw_windows(C);
 
 	rv3d = CTX_wm_region_view3d(C);
-	/* sa= CTX_wm_area(C); */ /* UNUSED */
+	/* sa = CTX_wm_area(C); */ /* UNUSED */
 	ar = CTX_wm_region(C);
 
 	view3d_operator_needs_opengl(C);
@@ -1928,7 +1524,7 @@ static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView
 	}
 }
 
-float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
+float ED_view3d_pixel_size(RegionView3D *rv3d, const float co[3])
 {
 	return (rv3d->persmat[3][3] + (
 	            rv3d->persmat[0][3] * co[0] +
@@ -1937,6 +1533,16 @@ float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
 	        ) * rv3d->pixsize;
 }
 
+float ED_view3d_radius_to_persp_dist(const float angle, const float radius)
+{
+	return (radius / 2.0f) * fabsf(1.0f / cosf((((float)M_PI) - angle) / 2.0f));
+}
+
+float ED_view3d_radius_to_ortho_dist(const float lens, const float radius)
+{
+	return radius / (DEFAULT_SENSOR_WIDTH / lens);
+}
+
 /* view matrix properties utilities */
 
 /* unused */
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 05a4f6f..ec114bc 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -25,6 +25,7 @@ set(INC
 	../../blenlib
 	../../blenloader
 	../../bmesh
+	../../ikplugin
 	../../makesdna
 	../../makesrna
 	../../windowmanager
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index dbf6179..9cf36a2 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('*.c')
 incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../render/extern/include'
-incs += ' ../../gpu ../../makesrna ../../blenloader ../../bmesh'
+incs += ' ../../gpu ../../makesrna ../../blenloader ../../bmesh ../../ikplugin'
 
 defs = []
 
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 5e31de9..6145fec 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -90,15 +90,12 @@
 #include "BLI_linklist.h"
 #include "BLI_smallhash.h"
 #include "BLI_array.h"
-#include "PIL_time.h"
 
 #include "UI_interface_icons.h"
 #include "UI_resources.h"
 
 #include "transform.h"
 
-#include <stdio.h> // XXX: duplicated???
-
 static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
 static int doEdgeSlide(TransInfo *t, float perc);
 
@@ -280,7 +277,7 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
 			//vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base));
 			/* same as below */
 			UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1);
-		} 
+		}
 		else
 #endif
 		{
@@ -472,11 +469,11 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
 		
 	}
 	else if (t->spacetype == SPACE_ACTION) {
-		//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
+		//SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
 		WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
 	}
 	else if (t->spacetype == SPACE_IPO) {
-		//SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
+		//SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
 		WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
 	}
 	else if (t->spacetype == SPACE_NLA) {
@@ -529,6 +526,10 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
 		/* if autokeying is enabled, send notifiers that keyframes were added */
 		if (IS_AUTOKEY_ON(t->scene))
 			WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+
+		/* redraw UV editor */
+		if (t->mode == TFM_EDGE_SLIDE && (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
+			WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
 		
 		/* XXX temp, first hack to get auto-render in compositor work (ton) */
 		WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C));
@@ -1026,7 +1027,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				if (t->flag & T_PROP_EDIT) {
 					t->prop_size *= 1.1f;
 					if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO)
-						t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far);
+						t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
 					calculatePropRatio(t);
 				}
 				t->redraw |= TREDRAW_HARD;
@@ -1196,7 +1197,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				if (event->alt && t->flag & T_PROP_EDIT) {
 					t->prop_size *= 1.1f;
 					if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO)
-						t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far);
+						t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
 					calculatePropRatio(t);
 				}
 				t->redraw = 1;
@@ -1224,6 +1225,14 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				else view_editmove(event->type);
 				t->redraw = 1;
 				break;
+			case LEFTALTKEY:
+			case RIGHTALTKEY:
+				if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
+					t->flag |= T_ALT_TRANSFORM;
+					t->redraw |= TREDRAW_HARD;
+				}
+
+				break;
 			default:
 				handled = 0;
 				break;
@@ -1257,6 +1266,14 @@ int transformEvent(TransInfo *t, wmEvent *event)
 ////			if (t->options & CTX_TWEAK)
 //				t->state = TRANS_CONFIRM;
 //			break;
+			case LEFTALTKEY:
+			case RIGHTALTKEY:
+				if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
+					t->flag &= ~T_ALT_TRANSFORM;
+					t->redraw |= TREDRAW_HARD;
+				}
+
+				break;
 			default:
 				handled = 0;
 				break;
@@ -1270,13 +1287,14 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			}
 		}
 	}
+	else
+		handled = 0;
 
 	// Per transform event, if present
 	if (t->handleEvent)
 		t->redraw |= t->handleEvent(t, event);
 
 	if (handled || t->redraw) {
-		t->last_update = PIL_check_seconds_timer();
 		return 0;
 	}
 	else {
@@ -1491,8 +1509,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 				float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1];
 				float angle = atan2f(dy, dx);
 				float dist = sqrtf(dx * dx + dy * dy);
-				float delta_angle = minf(15.0f / dist, (float)M_PI / 4.0f);
-				float spacing_angle = minf(5.0f / dist, (float)M_PI / 12.0f);
+				float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f);
+				float spacing_angle = min_ff(5.0f / dist, (float)M_PI / 12.0f);
 				UI_ThemeColor(TH_WIRE);
 
 				setlinestyle(3);
@@ -1565,52 +1583,31 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
 }
 
 /* just draw a little warning message in the top-right corner of the viewport to warn that autokeying is enabled */
-static void drawAutoKeyWarning(TransInfo *t, ARegion *ar)
+static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
 {
-	int show_warning;
-	
-	/* colored border around the viewport */
-	UI_ThemeColor(TH_VERTEX_SELECT);
+	const char printable[] = "Auto Keying On";
+	float      printable_size[2];
+	int xco, yco;
+
+	BLF_width_and_height_default(printable, &printable_size[0], &printable_size[1]);
 	
-	glBegin(GL_LINE_LOOP);
-		glVertex2f(1,          1);
-		glVertex2f(1,          ar->winy-1);
-		glVertex2f(ar->winx-1, ar->winy-1);
-		glVertex2f(ar->winx-1, 1);
-	glEnd();
+	xco = ar->winx - (int)printable_size[0] - 10;
+	yco = ar->winy - (int)printable_size[1] - 10;
 	
-	/* Entire warning should "blink" to catch periphery attention without being overly distracting 
-	 * much like how a traditional recording sign in the corner of a camcorder works
-	 *
-	 * - Blink frequency here is 0.5 secs (i.e. a compromise between epilepsy-inducing flicker + too slow to notice).
-	 *   We multiply by two to speed up the odd/even time-in-seconds = on/off toggle.
-	 * - Always start with warning shown so that animators are more likely to notice when starting to transform
+	/* warning text (to clarify meaning of overlays)
+	 * - original color was red to match the icon, but that clashes badly with a less nasty border
 	 */
-
-	show_warning = ((int)((t->last_update - floor(t->last_update)) * 2.0) & 1);
+	UI_ThemeColorShade(TH_TEXT_HI, -50);
+	BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
 	
-	if ((show_warning) || (t->state == TRANS_STARTING)) {
-		const char printable[] = "Auto Keying On";
-		int xco, yco;
-		
-		xco = ar->winx - BLF_width_default(printable)  - 10;
-		yco = ar->winy - BLF_height_default(printable) - 10;
-		
-		/* warning text (to clarify meaning of overlays)
-		 * - original color was red to match the icon, but that clashes badly with a less nasty border
-		 */
-		UI_ThemeColor(TH_VERTEX_SELECT);
-		BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
-		
-		/* autokey recording icon... */
-		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-		glEnable(GL_BLEND);
-		
-		xco -= (ICON_DEFAULT_WIDTH + 2);
-		UI_icon_draw(xco, yco, ICON_REC);
-		
-		glDisable(GL_BLEND);
-	}
+	/* autokey recording icon... */
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_BLEND);
+	
+	xco -= (ICON_DEFAULT_WIDTH + 2);
+	UI_icon_draw(xco, yco, ICON_REC);
+	
+	glDisable(GL_BLEND);
 }
 
 static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg)
@@ -1626,8 +1623,10 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo
 	 */
 	if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) {
 		if (ar == t->ar) {
-			if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
-				drawAutoKeyWarning(t, ar);
+			if (t->flag & (T_OBJECT | T_POSE)) {
+				if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
+					drawAutoKeyWarning(t, ar);
+				}
 			}
 		}
 	}
@@ -2428,6 +2427,8 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
 		bConstraintTypeInfo *cti = get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT);
 		bConstraintOb cob = {NULL};
 		bConstraint *con;
+		float size_sign[3], size_abs[3];
+		int i;
 		
 		/* Make a temporary bConstraintOb for using these limit constraints
 		 *  - they only care that cob->matrix is correctly set ;-)
@@ -2441,8 +2442,14 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
 			/* Reset val if SINGLESIZE but using a constraint */
 			if (td->flag & TD_SINGLESIZE)
 				return;
+
+			/* separate out sign to apply back later */
+			for (i = 0; i < 3; i++) {
+				size_sign[i] = signf(td->ext->size[i]);
+				size_abs[i] = fabsf(td->ext->size[i]);
+			}
 			
-			size_to_mat4(cob.matrix, td->ext->size);
+			size_to_mat4(cob.matrix, size_abs);
 		}
 		
 		/* Evaluate valid constraints */
@@ -2490,7 +2497,9 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
 			if (td->flag & TD_SINGLESIZE)
 				return;
 
+			/* extrace scale from matrix and apply back sign */
 			mat4_to_size(td->ext->size, cob.matrix);
+			mul_v3_v3(td->ext->size, size_sign);
 		}
 	}
 }
@@ -2861,11 +2870,21 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
 	(void)spos;
 }
 
-#define SIGN(a)     (a<-FLT_EPSILON ? 1 : a>FLT_EPSILON ? 2 : 3)
-#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0])) == 0 || (SIGN(a[1]) & SIGN(b[1])) == 0 || (SIGN(a[2]) & SIGN(b[2])) == 0)
+/* FLT_EPSILON is too small [#29633], 0.0000001f starts to flip */
+#define TX_FLIP_EPS 0.00001f
+BLI_INLINE int tx_sign(const float a)
+{
+	return (a < -TX_FLIP_EPS ? 1 : a > TX_FLIP_EPS ? 2 : 3);
+}
+BLI_INLINE int tx_vec_sign_flip(const float a[3], const float b[3])
+{
+	return ((tx_sign(a[0]) & tx_sign(b[0])) == 0 ||
+	        (tx_sign(a[1]) & tx_sign(b[1])) == 0 ||
+	        (tx_sign(a[2]) & tx_sign(b[2])) == 0);
+}
 
 /* smat is reference matrix, only scaled */
-static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
+static void TransMat3ToSize(float mat[][3], float smat[][3], float size[3])
 {
 	float vec[3];
 	
@@ -2877,9 +2896,9 @@ static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
 	size[2] = normalize_v3(vec);
 	
 	/* first tried with dotproduct... but the sign flip is crucial */
-	if (VECSIGNFLIP(mat[0], smat[0]) ) size[0] = -size[0];
-	if (VECSIGNFLIP(mat[1], smat[1]) ) size[1] = -size[1];
-	if (VECSIGNFLIP(mat[2], smat[2]) ) size[2] = -size[2];
+	if (tx_vec_sign_flip(mat[0], smat[0]) ) size[0] = -size[0];
+	if (tx_vec_sign_flip(mat[1], smat[1]) ) size[1] = -size[1];
+	if (tx_vec_sign_flip(mat[2], smat[2]) ) size[2] = -size[2];
 }
 
 
@@ -3408,7 +3427,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
 				/* this function works on end result */
 				protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
 			}
-			else { 
+			else {
 				float eulmat[3][3];
 				
 				mul_m3_m3m3(totmat, mat, td->ext->r_mtx);
@@ -3956,10 +3975,8 @@ void initShrinkFatten(TransInfo *t)
 }
 
 
-
 int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 {
-	float vec[3];
 	float distance;
 	int i;
 	char str[64];
@@ -3987,17 +4004,20 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 	t->values[0] = -distance;
 
 	for (i = 0; i < t->total; i++, td++) {
+		float tdistance;  /* temp dist */
 		if (td->flag & TD_NOACTION)
 			break;
 
 		if (td->flag & TD_SKIP)
 			continue;
 
-		copy_v3_v3(vec, td->axismtx[2]);
-		mul_v3_fl(vec, distance);
-		mul_v3_fl(vec, td->factor);
+		/* get the final offset */
+		tdistance = distance * td->factor;
+		if (td->ext && (t->flag & T_ALT_TRANSFORM)) {
+			tdistance *= td->ext->isize[0];  /* shell factor */
+		}
 
-		add_v3_v3v3(td->loc, td->iloc, vec);
+		madd_v3_v3v3fl(td->loc, td->iloc, td->axismtx[2], tdistance);
 	}
 
 	recalcData(t);
@@ -4814,8 +4834,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
 				cross_v3_v3v3(a, f2, l->f->no);
 				mul_v3_fl(a, -1.0f);
 
-				add_v3_v3(a, f3);
-				mul_v3_fl(a, 0.5f);
+				mid_v3_v3v3(a, a, f3);
 			}
 			
 			copy_v3_v3(vec, a);
@@ -4836,7 +4855,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
 		}
 		
 		l = l->radial_next;
-	} while (l != firstl); 
+	} while (l != firstl);
 
 	if (i)
 		mul_v3_fl(a, 1.0f / (float)i);
@@ -4857,14 +4876,9 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo
 		float dist = 0;
 		float min_dist = FLT_MAX;
 
-		float up_p[3];
-		float dw_p[3];
-
 		for (i = 0; i < sld->totsv; i++, sv++) {
 			/* Set length */
-			add_v3_v3v3(up_p, sv->origvert.co, sv->upvec);
-			add_v3_v3v3(dw_p, sv->origvert.co, sv->downvec);
-			sv->edge_len = len_v3v3(dw_p, up_p);
+			sv->edge_len = len_v3v3(sv->upvec, sv->downvec);
 
 			mul_v3_m4v3(v_proj, t->obedit->obmat, sv->v->co);
 			if (ED_view3d_project_float_global(t->ar, v_proj, v_proj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
@@ -4885,10 +4899,9 @@ static int createSlideVerts(TransInfo *t)
 {
 	BMEditMesh *em = BMEdit_FromObject(t->obedit);
 	BMesh *bm = em->bm;
-	BMIter iter, iter2;
+	BMIter iter;
 	BMEdge *e, *e1;
 	BMVert *v, *v2, *first;
-	BMLoop *l, *l1, *l2;
 	TransDataSlideVert *sv_array;
 	BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
 	SmallHash table;
@@ -4928,6 +4941,7 @@ static int createSlideVerts(TransInfo *t)
 	/*ensure valid selection*/
 	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
 		if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			BMIter iter2;
 			numsel = 0;
 			BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
 				if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
@@ -4980,6 +4994,8 @@ static int createSlideVerts(TransInfo *t)
 
 	j = 0;
 	while (1) {
+		BMLoop *l, *l1, *l2;
+
 		v = NULL;
 		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
 			if (BM_elem_flag_test(v, BM_ELEM_TAG))
@@ -5113,7 +5129,7 @@ static int createSlideVerts(TransInfo *t)
 		if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
 			BMIter iter2;
 			BMEdge *e2;
-			float vec1[3], mval[2] = {t->mval[0], t->mval[1]}, d;
+			float vec1[3], d;
 
 			/* search cross edges for visible edge to the mouse cursor,
 			 * then use the shared vertex to calculate screen vector*/
@@ -5536,7 +5552,7 @@ void drawNonPropEdge(const struct bContext *C, TransInfo *t)
 			float v1[3], v2[3];
 			float interp_v;
 			TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
-			const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5;
+			const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
 			const float guide_size = ctrl_size - 0.5f;
 			const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
 			const int alpha_shade = -30;
@@ -5603,7 +5619,6 @@ static int doEdgeSlide(TransInfo *t, float perc)
 {
 	SlideData *sld = t->customData;
 	TransDataSlideVert *svlist = sld->sv, *sv;
-	float vec[3];
 	int i;
 
 	sld->perc = perc;
@@ -5611,6 +5626,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
 
 	if (sld->is_proportional == TRUE) {
 		for (i = 0; i < sld->totsv; i++, sv++) {
+			float vec[3];
 			if (perc > 0.0f) {
 				copy_v3_v3(vec, sv->upvec);
 				mul_v3_fl(vec, perc);
@@ -5628,20 +5644,29 @@ static int doEdgeSlide(TransInfo *t, float perc)
 		 * Implementation note, non proportional mode ignores the starting positions and uses only the
 		 * up/down verts, this could be changed/improved so the distance is still met but the verts are moved along
 		 * their original path (which may not be straight), however how it works now is OK and matches 2.4x - Campbell
+		 *
+		 * \note len_v3v3(curr_sv->upvec, curr_sv->downvec)
+		 * is the same as the distance between the original vert locations, same goes for the lines below.
 		 */
 		TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
-		const float curr_length_perc = len_v3v3(curr_sv->up->co, curr_sv->down->co) *
-		                               (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
+		const float curr_length_perc = curr_sv->edge_len * (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
+
+		float down_co[3];
+		float up_co[3];
 
 		for (i = 0; i < sld->totsv; i++, sv++) {
-			const float sv_length = len_v3v3(sv->up->co, sv->down->co);
-			const float fac = minf(sv_length, curr_length_perc) / sv_length;
+			if (sv->edge_len > FLT_EPSILON) {
+				const float fac = min_ff(sv->edge_len, curr_length_perc) / sv->edge_len;
 
-			if (sld->flipped_vtx) {
-				interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac);
-			}
-			else {
-				interp_v3_v3v3(sv->v->co, sv->up->co, sv->down->co, fac);
+				add_v3_v3v3(up_co, sv->origvert.co, sv->upvec);
+				add_v3_v3v3(down_co, sv->origvert.co, sv->downvec);
+
+				if (sld->flipped_vtx) {
+					interp_v3_v3v3(sv->v->co, down_co, up_co, fac);
+				}
+				else {
+					interp_v3_v3v3(sv->v->co, up_co, down_co, fac);
+				}
 			}
 		}
 	}
@@ -6131,7 +6156,7 @@ static short getAnimEdit_DrawTime(TransInfo *t)
 		SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
 		
 		drawtime = (sipo->flag & SIPO_DRAWTIME) ? 1 : 0;
-	}	
+	}
 	else {
 		drawtime = 0;
 	}
@@ -6612,5 +6637,5 @@ int TimeScale(TransInfo *t, const int UNUSED(mval[2]))
 void BIF_TransformSetUndo(const char *UNUSED(str))
 {
 	// TRANSFORM_FIX_ME
-	//Trans.undostr= str;
+	//Trans.undostr = str;
 }
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 40f5342..bc959a7 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -197,6 +197,7 @@ typedef struct TransDataSlideVert {
 
 	float edge_len;
 
+	/* add origvert.co to get the original locations */
 	float upvec[3], downvec[3];
 
 	int loop_nr;
@@ -323,8 +324,6 @@ typedef struct TransInfo {
 	float		axis[3];
 	float		axis_orig[3];	/* TransCon can change 'axis', store the original value here */
 	
-	double      last_update;  /* Time of last update (in seconds) */
-
 	void		*view;
 	struct bContext *context; /* Only valid (non null) during an operator called function. */
 	struct ScrArea	*sa;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 0aa46a3..947bdf5 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -150,8 +150,8 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
 
 	if (hasNumInput(&t->num)) {
 		applyNumInput(&t->num, vec);
-		removeAspectRatio(t, vec);
 		constraintNumInput(t, vec);
+		removeAspectRatio(t, vec);
 	}
 
 	/* autovalues is operator param, use that directly but not if snapping is forced */
@@ -782,7 +782,7 @@ void startConstraint(TransInfo *t)
 {
 	t->con.mode |= CON_APPLY;
 	*t->con.text = ' ';
-	t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max);
+	t->num.idx_max = min_ii(getConstraintSpaceDimension(t) - 1, t->idx_max);
 }
 
 void stopConstraint(TransInfo *t)
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 2e9d1ee..51efa2b 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -76,6 +76,7 @@
 #include "BKE_gpencil.h"
 #include "BKE_key.h"
 #include "BKE_main.h"
+#include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_movieclip.h"
 #include "BKE_nla.h"
@@ -90,6 +91,7 @@
 #include "BKE_tracking.h"
 #include "BKE_mask.h"
 
+#include "BIK_api.h"
 
 #include "ED_anim_api.h"
 #include "ED_armature.h"
@@ -124,62 +126,46 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list);
 
 /* ************************** Functions *************************** */
 
-static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp)
+static int trans_data_compare_dist(const void *A, const void *B)
 {
-	TransData *ihead = head;
-	TransData *itail = tail;
-	*temp = *head;
+	const TransData *td_A = (const TransData*)A;
+	const TransData *td_B = (const TransData*)B;
 
-	while (head < tail) {
-		if (t->flag & T_PROP_CONNECTED) {
-			while ((tail->dist >= temp->dist) && (head < tail))
-				tail--;
-		}
-		else {
-			while ((tail->rdist >= temp->rdist) && (head < tail))
-				tail--;
-		}
-
-		if (head != tail) {
-			*head = *tail;
-			head++;
-		}
-
-		if (t->flag & T_PROP_CONNECTED) {
-			while ((head->dist <= temp->dist) && (head < tail))
-				head++;
-		}
-		else {
-			while ((head->rdist <= temp->rdist) && (head < tail))
-				head++;
-		}
+	if (td_A->dist < td_B->dist)
+		return -1;
+	else if (td_A->dist > td_B->dist)
+		return 1;
+	
+	return 0;
+}
 
-		if (head != tail) {
-			*tail = *head;
-			tail--;
-		}
-	}
+static int trans_data_compare_rdist(const void *A, const void *B)
+{
+	const TransData *td_A = (const TransData*)A;
+	const TransData *td_B = (const TransData*)B;
 
-	*head = *temp;
-	if (ihead < head) {
-		qsort_trans_data(t, ihead, head - 1, temp);
-	}
-	if (itail > head) {
-		qsort_trans_data(t, head + 1, itail, temp);
-	}
+	if (td_A->rdist < td_B->rdist)
+		return -1;
+	else if (td_A->rdist > td_B->rdist)
+		return 1;
+	
+	return 0;
 }
 
 void sort_trans_data_dist(TransInfo *t)
 {
-	TransData temp;
 	TransData *start = t->data;
-	int i = 1;
+	int i;
 
-	while (i < t->total && start->flag & TD_SELECTED) {
+	for (i = 0; i < t->total && start->flag & TD_SELECTED; i++)
 		start++;
-		i++;
+	
+	if (i < t->total) {
+		if (t->flag & T_PROP_CONNECTED)
+			qsort(start, t->total - i, sizeof(TransData), trans_data_compare_dist);
+		else
+			qsort(start, t->total - i, sizeof(TransData), trans_data_compare_rdist);
 	}
-	qsort_trans_data(t, start, t->data + t->total - 1, &temp);
 }
 
 static void sort_trans_data(TransInfo *t)
@@ -332,13 +318,9 @@ static void createTransEdge(TransInfo *t)
 	invert_m3_m3(smtx, mtx);
 
 	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
-		if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) { 
-			float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
-			float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
-			
+		if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) {
 			/* need to set center for center calculations */
-			add_v3_v3v3(td->center, eed->v1->co, eed->v2->co);
-			mul_v3_fl(td->center, 0.5f);
+			mid_v3_v3v3(td->center, eed->v1->co, eed->v2->co);
 
 			td->loc = NULL;
 			if (BM_elem_flag_test(eed, BM_ELEM_SELECT))
@@ -346,16 +328,18 @@ static void createTransEdge(TransInfo *t)
 			else
 				td->flag = 0;
 
-
 			copy_m3_m3(td->smtx, smtx);
 			copy_m3_m3(td->mtx, mtx);
 
 			td->ext = NULL;
 			if (t->mode == TFM_BWEIGHT) {
+				float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
 				td->val = bweight;
 				td->ival = bweight ? *bweight : 1.0f;
 			}
 			else {
+				float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
+				BLI_assert(t->mode == TFM_CREASE);
 				td->val = crease;
 				td->ival = crease ? *crease : 0.0f;
 			}
@@ -419,7 +403,7 @@ static short apply_targetless_ik(Object *ob)
 				float rmat[4][4] /*, tmat[4][4], imat[4][4]*/;
 
 				/* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK  */
-				/* we put in channel the entire result of rmat= (channel * constraint * IK) */
+				/* we put in channel the entire result of rmat = (channel * constraint * IK) */
 				/* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat  */
 				/* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */
 
@@ -790,6 +774,9 @@ static void pose_grab_with_ik_clear(Object *ob)
 			if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
 				data = con->data;
 				if (data->flag & CONSTRAINT_IK_TEMP) {
+					/* iTaSC needs clear for removed constraints */
+					BIK_clear_data(ob->pose);
+
 					BLI_remlink(&pchan->constraints, con);
 					MEM_freeN(con->data);
 					MEM_freeN(con);
@@ -850,13 +837,13 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
 	con = add_pose_constraint(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
 	pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET);    /* for draw, but also for detecting while pose solving */
 	data = con->data;
-	if (targetless) { 
+	if (targetless) {
 		/* if exists, use values from last targetless (but disabled) IK-constraint as base */
 		*data = *targetless;
 	}
 	else
 		data->flag = CONSTRAINT_IK_TIP;
-	data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO;
+	data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
 	copy_v3_v3(data->grabtarget, pchan->pose_tail);
 	data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
 	
@@ -950,6 +937,10 @@ static short pose_grab_with_ik(Object *ob)
 		}
 	}
 
+	/* iTaSC needs clear for new IK constraints */
+	if (tot_ik)
+		BIK_clear_data(ob->pose);
+
 	return (tot_ik) ? 1 : 0;
 }
 
@@ -973,7 +964,7 @@ static void createTransPose(TransInfo *t, Object *ob)
 	if (arm->flag & ARM_RESTPOS) {
 		if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE) == 0) {
 			// XXX use transform operator reports
-			// BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled");
+			// BKE_report(op->reports, RPT_ERROR, "Cannot select linked when sync selection is enabled");
 			return;
 		}
 	}
@@ -1830,7 +1821,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f
 			d2 = d + len_v3(vec);
 			
 			if (dists[BM_elem_index_get(v3)] != FLT_MAX)
-				dists[BM_elem_index_get(v3)] = minf(d2, dists[BM_elem_index_get(v3)]);
+				dists[BM_elem_index_get(v3)] = min_ff(d2, dists[BM_elem_index_get(v3)]);
 			else
 				dists[BM_elem_index_get(v3)] = d2;
 			
@@ -1934,6 +1925,10 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx
 		tx->size = vs->radius;
 		td->val = vs->radius;
 	}
+	else if (t->mode == TFM_SHRINKFATTEN) {
+		td->ext = tx;
+		tx->isize[0] = BM_vert_calc_shell_factor(eve);
+	}
 }
 
 static void createTransEditVerts(TransInfo *t)
@@ -2046,7 +2041,11 @@ static void createTransEditVerts(TransInfo *t)
 	else t->total = countsel;
 
 	tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)");
-	if (t->mode == TFM_SKIN_RESIZE) {
+	if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) {
+		/* warning, this is overkill, we only need 2 extra floats,
+		 * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill
+		 * since we may not use the 'alt' transform mode to maintain shell thickness,
+		 * but with generic transform code its hard to lazy init vars */
 		tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension),
 		                          "TransObData ext");
 	}
@@ -2359,6 +2358,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
 	SpaceImage *sima = CTX_wm_space_image(C);
 	Image *ima = CTX_data_edit_image(C);
 	Scene *scene = t->scene;
+	ToolSettings *ts = CTX_data_tool_settings(C);
 	TransData *td = NULL;
 	TransData2D *td2d = NULL;
 	MTexPoly *tf;
@@ -2367,12 +2367,26 @@ static void createTransUVs(bContext *C, TransInfo *t)
 	BMFace *efa;
 	BMLoop *l;
 	BMIter iter, liter;
-	int count = 0, countsel = 0;
+	UvElementMap *elementmap;
+	char *island_enabled;
+	int count = 0, countsel = 0, count_rejected = 0;
 	int propmode = t->flag & T_PROP_EDIT;
+	int propconnected = t->flag & T_PROP_CONNECTED;
 
 	if (!ED_space_image_show_uvedit(sima, t->obedit)) return;
 
 	/* count */
+	if (propconnected) {
+		/* create element map with island information */
+		if (ts->uv_flag & UV_SYNC_SELECTION) {
+			elementmap = EDBM_uv_element_map_create (em, FALSE, TRUE);
+		}
+		else {
+			elementmap = EDBM_uv_element_map_create (em, TRUE, TRUE);
+		}
+		island_enabled = MEM_callocN(sizeof(*island_enabled) * elementmap->totalIslands, "TransIslandData(UV Editing)");
+	}
+
 	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 
@@ -2380,14 +2394,22 @@ static void createTransUVs(bContext *C, TransInfo *t)
 			BM_elem_flag_disable(efa, BM_ELEM_TAG);
 			continue;
 		}
-		
+
 		BM_elem_flag_enable(efa, BM_ELEM_TAG);
 		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
-			if (uvedit_uv_select_test(em, scene, l)) 
+			if (uvedit_uv_select_test(em, scene, l)) {
 				countsel++;
 
-			if (propmode)
+				if (propconnected) {
+					UvElement *element = ED_uv_element_get(elementmap, efa, l);
+					island_enabled[element->island] = TRUE;
+				}
+
+			}
+
+			if (propmode) {
 				count++;
+			}
 		}
 	}
 
@@ -2413,12 +2435,26 @@ static void createTransUVs(bContext *C, TransInfo *t)
 		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 			if (!propmode && !uvedit_uv_select_test(em, scene, l))
 				continue;
+
+			if (propconnected) {
+				UvElement *element = ED_uv_element_get(elementmap, efa, l);
+				if (!island_enabled[element->island]) {
+					count_rejected++;
+					continue;
+				}
+			}
 			
 			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 			UVsToTransData(sima, td++, td2d++, luv->uv, uvedit_uv_select_test(em, scene, l));
 		}
 	}
 
+	if (propconnected) {
+		t->total -= count_rejected;
+		EDBM_uv_element_map_free(elementmap);
+		MEM_freeN(island_enabled);
+	}
+
 	if (sima->flag & SI_LIVE_UNWRAP)
 		ED_uvedit_live_unwrap_begin(t->scene, t->obedit);
 }
@@ -2458,7 +2494,7 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
 	max[0] = aspx; max[1] = aspy;
 
 	for (a = 0, td = t->data; a < t->total; a++, td++) {
-		DO_MINMAX2(td->loc, min, max);
+		minmax_v2v2_v2(min, max, td->loc);
 	}
 
 	if (resize) {
@@ -2510,8 +2546,8 @@ void clipUVData(TransInfo *t)
 		if ((td->flag & TD_SKIP) || (!td->loc))
 			continue;
 
-		td->loc[0] = minf(maxf(0.0f, td->loc[0]), aspx);
-		td->loc[1] = minf(maxf(0.0f, td->loc[1]), aspy);
+		td->loc[0] = min_ff(max_ff(0.0f, td->loc[0]), aspx);
+		td->loc[1] = min_ff(max_ff(0.0f, td->loc[1]), aspy);
 	}
 }
 
@@ -3416,14 +3452,14 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, AnimData *adt, B
 	if (td->flag & TD_MOVEHANDLE1) {
 		td2d->h1 = bezt->vec[0];
 		copy_v2_v2(td2d->ih1, td2d->h1);
-	} 
-	else 	
+	}
+	else
 		td2d->h1 = NULL;
 
 	if (td->flag & TD_MOVEHANDLE2) {
 		td2d->h2 = bezt->vec[2];
 		copy_v2_v2(td2d->ih2, td2d->h2);
-	} 
+	}
 	else 
 		td2d->h2 = NULL;
 
@@ -3527,7 +3563,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
 						if (sel1) count++;
 						if (sel3) count++;
 					}
-				} 
+				}
 				else if (sipo->around == V3D_LOCAL) {
 					/* for local-pivot we only need to count the number of selected handles only, so that centerpoints don't
 					 * don't get moved wrong
@@ -3622,18 +3658,18 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
 					if (sel1) {
 						hdata = initTransDataCurveHandles(td, bezt);
 						bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx);
-					} 
+					}
 					else {
-						/* h1= 0; */ /* UNUSED */
+						/* h1 = 0; */ /* UNUSED */
 					}
 					
 					if (sel3) {
 						if (hdata == NULL)
 							hdata = initTransDataCurveHandles(td, bezt);
 						bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx);
-					} 
+					}
 					else {
-						/* h2= 0; */ /* UNUSED */
+						/* h2 = 0; */ /* UNUSED */
 					}
 				}
 				
@@ -4255,15 +4291,14 @@ static void freeSeqData(TransInfo *t)
 						}
 					}
 
-#if 1               /* (mango hack! - for Ian) this is truely bad - should _never_ be in a release :| */
-					if (CTX_wm_window(t->context)->eventstate->alt) {
+					if (t->flag & T_ALT_TRANSFORM) {
 						int minframe = MAXFRAME;
 						td = t->data;
 						seq_prev = NULL;
 						for (a = 0; a < t->total; a++, td++) {
 							seq = ((TransDataSeq *)td->extra)->seq;
 							if ((seq != seq_prev)) {
-								minframe = mini(minframe, seq->startdisp);
+								minframe = min_ii(minframe, seq->startdisp);
 							}
 						}
 
@@ -4293,9 +4328,6 @@ static void freeSeqData(TransInfo *t)
 					else {
 						BKE_sequence_base_shuffle_time(seqbasep, t->scene);
 					}
-#else
-					BKE_sequence_base_shuffle_time(seqbasep, t->scene);
-#endif
 
 					if (has_effect) {
 						/* update effects strips based on strips just moved in time */
@@ -4469,6 +4501,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list)
 				if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) return 1;
 				if (con->type == CONSTRAINT_TYPE_CLAMPTO) return 1;
 				if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) return 1;
+				if (con->type == CONSTRAINT_TYPE_FOLLOWTRACK) return 1;
 				
 				/* constraints that require this only under special conditions */
 				if (con->type == CONSTRAINT_TYPE_ROTLIKE) {
@@ -4545,7 +4578,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
 		
 		td->ext->irotAngle = ob->rotAngle;
 		copy_v3_v3(td->ext->irotAxis, ob->rotAxis);
-		// td->ext->drotAngle= ob->drotAngle;			// XXX, not implemented
+		// td->ext->drotAngle = ob->drotAngle;			// XXX, not implemented
 		// copy_v3_v3(td->ext->drotAxis, ob->drotAxis);	// XXX, not implemented
 	}
 	else {
@@ -4603,7 +4636,7 @@ static void set_trans_object_base_flags(TransInfo *t)
 
 	/*
 	 * if Base selected and has parent selected:
-	 * base->flag= BA_WAS_SEL
+	 * base->flag = BA_WAS_SEL
 	 */
 	Base *base;
 
@@ -5012,9 +5045,10 @@ static void special_aftertrans_update__mask(bContext *C, TransInfo *t)
 	if (t->scene->nodetree) {
 		/* tracks can be used for stabilization nodes,
 		 * flush update for such nodes */
-		//if (nodeUpdateID(t->scene->nodetree, &mask->id)) {
+		//if (nodeUpdateID(t->scene->nodetree, &mask->id))
+		{
 			WM_event_add_notifier(C, NC_MASK | ND_DATA, &mask->id);
-		//}
+		}
 	}
 
 	/* TODO - dont key all masks... */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index a9d9ec7..615bb78 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -705,7 +705,7 @@ static void recalcData_view3d(TransInfo *t)
 					BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
 					nu = nu->next;
 				}
-			} 
+			}
 			else {
 				/* Normal updating */
 				while (nu) {
@@ -1002,9 +1002,9 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 	
 	/* moving: is shown in drawobject() (transform color) */
 //  TRANSFORM_FIX_ME
-//	if (obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
-//	else if (G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
-//	else G.moving= G_TRANSFORM_OBJ;
+//	if (obedit || (t->flag & T_POSE) ) G.moving = G_TRANSFORM_EDIT;
+//	else if (G.f & G_PARTICLEEDIT) G.moving = G_TRANSFORM_PARTICLE;
+//	else G.moving = G_TRANSFORM_OBJ;
 	
 	t->scene = sce;
 	t->sa = sa;
@@ -1252,7 +1252,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		
 		/* TRANSFORM_FIX_ME rna restrictions */
 		if (t->prop_size <= 0.00001f) {
-			printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size);
+			printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size);
 			t->prop_size = 1.0f;
 		}
 		
@@ -1568,9 +1568,8 @@ void calculateCenterBound(TransInfo *t)
 			copy_v3_v3(min, t->data[i].center);
 		}
 	}
-	add_v3_v3v3(t->center, min, max);
-	mul_v3_fl(t->center, 0.5);
-	
+	mid_v3_v3v3(t->center, min, max);
+
 	calculateCenter2D(t);
 }
 
@@ -1712,8 +1711,9 @@ void calculatePropRatio(TransInfo *t)
 				/*
 				 * The elements are sorted according to their dist member in the array,
 				 * that means we can stop when it finds one element outside of the propsize.
+				 * do not set 'td->flag |= TD_NOACTION', the prop circle is being changed.
 				 */
-				td->flag |= TD_NOACTION;
+				
 				td->factor = 0.0f;
 				restoreElement(td);
 			}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 74a2292..a3f45ac 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -441,7 +441,7 @@ int calc_manipulator_stats(const bContext *C)
 		}
 		else if (obedit->type == OB_MBALL) {
 			MetaBall *mb = (MetaBall *)obedit->data;
-			MetaElem *ml /* , *ml_sel=NULL */ /* UNUSED */;
+			MetaElem *ml /* , *ml_sel = NULL */ /* UNUSED */;
 
 			ml = mb->editelems->first;
 			while (ml) {
@@ -498,7 +498,7 @@ int calc_manipulator_stats(const bContext *C)
 		}
 	}
 	else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
-		;
+		/* pass */
 	}
 	else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
 		PTCacheEdit *edit = PE_get_current(scene, ob);
@@ -744,7 +744,7 @@ static char axisBlendAngle(float angle)
 	return (char)(255.0f * (angle - 5) / 15.0f);
 }
 
-/* three colors can be set;
+/* three colors can be set:
  * gray for ghosting
  * moving: in transform theme color
  * else the red/green/blue
@@ -776,15 +776,13 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
 				}
 				break;
 			case 'X':
-				col[0] = 220;
+				UI_GetThemeColor3ubv(TH_AXIS_X, col);
 				break;
 			case 'Y':
-				col[1] = 220;
+				UI_GetThemeColor3ubv(TH_AXIS_Y, col);
 				break;
 			case 'Z':
-				col[0] = 30;
-				col[1] = 30;
-				col[2] = 220;
+				UI_GetThemeColor3ubv(TH_AXIS_Z, col);
 				break;
 			default:
 				BLI_assert(!"invalid axis arg");
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index fc0c174..916cf54 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -284,7 +284,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op)
 	RNA_string_get(op->ptr, "name", name);
 
 	if (use && !CTX_wm_view3d(C)) {
-		BKE_report(op->reports, RPT_ERROR, "Create Orientation \"use\" parameter only valid in a 3dView context");
+		BKE_report(op->reports, RPT_ERROR, "Create Orientation's 'use' parameter only valid in a 3DView context");
 		return OPERATOR_CANCELLED;
 	}
 
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 0e25739..70e4d4c 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -142,7 +142,7 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports)
 		strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
 	}
 
-	return addMatrixSpace(C, mat, name, overwrite);	
+	return addMatrixSpace(C, mat, name, overwrite);
 }
 
 TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite)
@@ -631,7 +631,6 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 					/* if there's an edge available, use that for the tangent */
 					if (em->bm->totedgesel >= 1) {
 						BMEdge *eed = NULL;
-						BMIter iter;
 						
 						BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
 							if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
@@ -746,14 +745,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 			MetaBall *mb = obedit->data;
 			
 			if (mb->lastelem) {
-				float mat[4][4];
+				float qmat[3][3];
 
 				/* Rotation of MetaElem is stored in quat */
-				quat_to_mat4(mat, mb->lastelem->quat);
+				quat_to_mat3(qmat, mb->lastelem->quat);
 
-				copy_v3_v3(normal, mat[2]);
+				copy_v3_v3(normal, qmat[2]);
 
-				negate_v3_v3(plane, mat[1]);
+				negate_v3_v3(plane, qmat[1]);
 				
 				result = ORIENTATION_FACE;
 			}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 94b8abb..2d95e2e 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -78,8 +78,6 @@
 
 #include "transform.h"
 
-#define USE_BVH_FACE_SNAP
-
 #define TRANSFORM_DIST_MAX_PX 1000
 
 /********************* PROTOTYPES ***********************/
@@ -410,9 +408,15 @@ static void initSnappingMode(TransInfo *t)
 		
 		t->tsnap.mode = ts->snap_node_mode;
 	}
+	else if (t->spacetype == SPACE_IMAGE) {
+		/* force project off when not supported */
+		t->tsnap.project = 0;
+		
+		t->tsnap.mode = ts->snap_uv_mode;
+	}
 	else {
 		/* force project off when not supported */
-		if (t->spacetype == SPACE_IMAGE || ts->snap_mode != SCE_SNAP_MODE_FACE)
+		if (ts->snap_mode != SCE_SNAP_MODE_FACE)
 			t->tsnap.project = 0;
 		
 		t->tsnap.mode = ts->snap_mode;
@@ -723,14 +727,14 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
 {
 	float angle, start[3], end[3], center[3];
 	
-	copy_v3_v3(center, t->center);	
+	copy_v3_v3(center, t->center);
 	if (t->flag & (T_EDIT | T_POSE)) {
 		Object *ob = t->obedit ? t->obedit : t->poseobj;
 		mul_m4_v3(ob->obmat, center);
 	}
 
 	sub_v3_v3v3(start, p1, center);
-	sub_v3_v3v3(end, p2, center);	
+	sub_v3_v3v3(end, p2, center);
 		
 	// Angle around a constraint axis (error prone, will need debug)
 	if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
@@ -779,7 +783,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
 {
 	float d1[3], d2[3], center[3], len_d1;
 	
-	copy_v3_v3(center, t->center);	
+	copy_v3_v3(center, t->center);
 	if (t->flag & (T_EDIT | T_POSE)) {
 		Object *ob = t->obedit ? t->obedit : t->poseobj;
 		mul_m4_v3(ob->obmat, center);
@@ -846,7 +850,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 					p2 = NULL;
 					p1->flag = 1;
 		
-					/* if peeling objects, take the first and last from each object */			
+					/* if peeling objects, take the first and last from each object */
 					if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) {
 						DepthPeel *peel;
 						for (peel = p1->next; peel; peel = peel->next) {
@@ -982,7 +986,7 @@ static void TargetSnapCenter(TransInfo *t)
 {
 	/* Only need to calculate once */
 	if ((t->tsnap.status & TARGET_INIT) == 0) {
-		copy_v3_v3(t->tsnap.snapTarget, t->center);	
+		copy_v3_v3(t->tsnap.snapTarget, t->center);
 		
 		if (t->flag & (T_EDIT | T_POSE)) {
 			Object *ob = t->obedit ? t->obedit : t->poseobj;
@@ -991,7 +995,7 @@ static void TargetSnapCenter(TransInfo *t)
 		
 		TargetSnapOffset(t, NULL);
 		
-		t->tsnap.status |= TARGET_INIT;		
+		t->tsnap.status |= TARGET_INIT;
 	}
 }
 
@@ -1027,7 +1031,7 @@ static void TargetSnapActive(TransInfo *t)
 			t->tsnap.target = SCE_SNAP_TARGET_MEDIAN;
 			t->tsnap.targetSnap = TargetSnapMedian;
 			TargetSnapMedian(t);
-		}		
+		}
 	}
 }
 
@@ -1055,7 +1059,7 @@ static void TargetSnapMedian(TransInfo *t)
 		
 		TargetSnapOffset(t, NULL);
 		
-		t->tsnap.status |= TARGET_INIT;		
+		t->tsnap.status |= TARGET_INIT;
 	}
 }
 
@@ -1136,58 +1140,6 @@ static void TargetSnapClosest(TransInfo *t)
 		t->tsnap.status |= TARGET_INIT;
 	}
 }
-/*================================================================*/
-#ifndef USE_BVH_FACE_SNAP
-static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth)
-{
-	float lambda;
-	int result;
-	int retval = 0;
-	
-	result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, v1co, v2co, v3co, &lambda, NULL, 0.001);
-	
-	if (result) {
-		float location[3], normal[3];
-		float intersect[3];
-		float new_depth;
-		int screen_loc[2];
-		int new_dist;
-		
-		copy_v3_v3(intersect, ray_normal_local);
-		mul_v3_fl(intersect, lambda);
-		add_v3_v3(intersect, ray_start_local);
-		
-		copy_v3_v3(location, intersect);
-		
-		if (v4co)
-			normal_quad_v3(normal, v1co, v2co, v3co, v4co);
-		else
-			normal_tri_v3(normal, v1co, v2co, v3co);
-
-		mul_m4_v3(obmat, location);
-		
-		new_depth = len_v3v3(location, ray_start);					
-		
-		ED_view3d_project_int(ar, location, screen_loc);
-		new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
-		
-		if (new_dist <= *dist && new_depth < *depth) {
-			*depth = new_depth;
-			retval = 1;
-			
-			copy_v3_v3(loc, location);
-			copy_v3_v3(no, normal);
-			
-			mul_m3_v3(timat, no);
-			normalize_v3(no);
-
-			*dist = new_dist;
-		} 
-	}
-	
-	return retval;
-}
-#endif
 
 static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3],
                     const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
@@ -1234,7 +1186,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
 			
 			mul_m4_v3(obmat, location);
 			
-			new_depth = len_v3v3(location, ray_start);					
+			new_depth = len_v3v3(location, ray_start);
 			
 			if (ED_view3d_project_int_global(ar, location, screen_loc, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
 				new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
@@ -1259,17 +1211,17 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
 				mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
 				
 				if (r_no) {
-					normal_short_to_float_v3(n1, v1no);						
+					normal_short_to_float_v3(n1, v1no);
 					normal_short_to_float_v3(n2, v2no);
 					interp_v3_v3v3(r_no, n2, n1, mul);
 					mul_m3_v3(timat, r_no);
 					normalize_v3(r_no);
-				}			
+				}
 
 				copy_v3_v3(r_loc, location);
 				
 				*r_dist = new_dist;
-			} 
+			}
 		}
 	}
 	
@@ -1318,7 +1270,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4],
 			}
 
 			*r_dist = new_dist;
-		} 
+		}
 	}
 	
 	return retval;
@@ -1425,8 +1377,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 			
 			switch (snap_mode) {
 				case SCE_SNAP_MODE_FACE:
-				{ 
-#ifdef USE_BVH_FACE_SNAP                // Added for durian
+				{
 					BVHTreeRayHit hit;
 					BVHTreeFromMesh treeData;
 
@@ -1456,80 +1407,6 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 						}
 					}
 					break;
-
-#else
-					MVert *verts = dm->getVertArray(dm);
-					MFace *faces = dm->getTessFaceArray(dm);
-					int *index_array = NULL;
-					int index = 0;
-					int i;
-					
-					if (em != NULL) {
-						index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
-						EDBM_index_arrays_init(em, 0, 0, 1);
-					}
-					
-					for (i = 0; i < totface; i++) {
-						BMFace *efa = NULL;
-						MFace *f = faces + i;
-						
-						test = 1; /* reset for every face */
-					
-						if (em != NULL) {
-							if (index_array) {
-								index = index_array[i];
-							}
-							else {
-								index = i;
-							}
-							
-							if (index == ORIGINDEX_NONE) {
-								test = 0;
-							}
-							else {
-								efa = EDBM_face_at_index(em, index);
-								
-								if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
-									test = 0;
-								}
-								else if (efa) {
-									BMIter iter;
-									BMLoop *l;
-									
-									l = BM_iter_new(&iter, em->bm, BM_LOOPS_OF_FACE, efa);
-									for (; l; l = BM_iter_step(&iter)) {
-										if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) {
-											test = 0;
-											break;
-										}
-									}
-								}
-							}
-						}
-						
-						
-						if (test) {
-							int result;
-							float *v4co = NULL;
-							
-							if (f->v4) {
-								v4co = verts[f->v4].co;
-							}
-							
-							result = snapFace(ar, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, v4co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
-							retval |= result;
-
-							if (f->v4 && result == 0) {
-								retval |= snapFace(ar, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, verts[f->v2].co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
-							}
-						}
-					}
-					
-					if (em != NULL) {
-						EDBM_index_arrays_free(em);
-					}
-#endif
-					break;
 				}
 				case SCE_SNAP_MODE_VERTEX:
 				{
@@ -1858,7 +1735,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 
 					mul_m4_v3(obmat, location);
 					
-					new_depth = len_v3v3(location, ray_start);					
+					new_depth = len_v3v3(location, ray_start);
 					
 					mul_m3_v3(timat, normal);
 					normalize_v3(normal);
@@ -1893,7 +1770,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 						normalize_v3(normal);
 	
 						addDepthPeel(depth_peels, new_depth, location, normal, ob);
-					} 
+					}
 				}
 			}
 		}
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index b0edc70..e953aa2 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -409,7 +409,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
 		MEM_freeN(quats);
 	}
 
-	if (!*deformmats) {
+	if (*deformmats == NULL) {
 		int a, numVerts;
 		Mesh *me = (Mesh *)ob->data;
 
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 9a3b047..c8c26ed 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -104,7 +104,7 @@ static UndoElem *curundo = NULL;
 static void undo_restore(UndoElem *undo, void *editdata, void *obdata)
 {
 	if (undo) {
-		undo->to_editmode(undo->undodata, editdata, obdata);	
+		undo->to_editmode(undo->undodata, editdata, obdata);
 	}
 }
 
@@ -233,7 +233,7 @@ static void undo_clean_stack(bContext *C)
 	if (curundo == NULL) curundo = undobase.last;
 }
 
-/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
+/* 1 = an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
 void undo_editmode_step(bContext *C, int step)
 {
 	Object *obedit = CTX_data_edit_object(C);
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index b73f5fa..0ec16ea 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -130,6 +130,9 @@ short hasNumInput(NumInput *n)
 	return 0;
 }
 
+/**
+ * \warning \a vec must be set beforehand otherwise we risk uninitialized vars.
+ */
 void applyNumInput(NumInput *n, float *vec)
 {
 	short i, j;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 5eafc3e..1753a56 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -505,7 +505,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 			MEM_freeN(item);
 			
 			uiPupMenuEnd(C, pup);
-		}		
+		}
 		
 	}
 	return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index fa39a52..1c32c01 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -94,14 +94,19 @@ static int uvedit_center(Scene *scene, BMEditMesh *em, Image *ima, float center[
 	return tot;
 }
 
-static void uvedit_translate(Scene *scene, BMEditMesh *em, Image *UNUSED(ima), float delta[2])
+static void uvedit_translate(Scene *scene, BMEditMesh *em, Image *ima, float delta[2])
 {
 	BMFace *f;
 	BMLoop *l;
 	BMIter iter, liter;
 	MLoopUV *luv;
+	MTexPoly *tf;
 	
 	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		tf = CustomData_bmesh_get(&em->bm->pdata, f->head.data, CD_MTEXPOLY);
+		if (!uvedit_face_visible_test(scene, ima, f, tf))
+			continue;
+
 		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 			if (uvedit_uv_select_test(em, scene, l)) {
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index d679491..9c2c300 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -453,8 +453,6 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 	int drawfaces, interpedges;
 	Image *ima = sima->image;
 
-	StitchPreviewer *stitch_preview = uv_get_stitch_previewer();
-
 	activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE, FALSE); /* will be set to NULL if hidden */
 	activef = BM_active_face_get(bm, FALSE, FALSE);
 	ts = scene->toolsettings;
@@ -536,7 +534,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
 			tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
 
-			if (uvedit_face_visible_test(scene, ima, efa, tf)) {		
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {
 				BM_elem_flag_enable(efa, BM_ELEM_TAG);
 			}
 			else {
@@ -820,52 +818,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 					bglVertex2fv(luv->uv);
 			}
 		}
-		bglEnd();	
-	}
-
-	/* finally draw stitch preview */
-	if (stitch_preview) {
-		int i, index = 0;
-		glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
-		glEnableClientState(GL_VERTEX_ARRAY);
-
-		glEnable(GL_BLEND);
-
-		UI_ThemeColor4(TH_STITCH_PREVIEW_ACTIVE);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->static_tris);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_static_tris * 3);
-
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_polys);
-		for (i = 0; i < stitch_preview->num_polys; i++) {
-			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-			UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
-			glDrawArrays(GL_POLYGON, index, stitch_preview->uvs_per_polygon[i]);
-			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-			UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
-			glDrawArrays(GL_POLYGON, index, stitch_preview->uvs_per_polygon[i]);
-
-			index += stitch_preview->uvs_per_polygon[i];
-		}
-		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-#if 0
-		UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris * 3);
-#endif
-		glDisable(GL_BLEND);
-
-		/* draw vert preview */
-		glPointSize(pointsize * 2.0f);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE);
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable);
-		glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable);
-
-		UI_ThemeColor4(TH_STITCH_PREVIEW_UNSTITCHABLE);
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_unstitchable);
-		glDrawArrays(GL_POINTS, 0, stitch_preview->num_unstitchable);
-
-		glPopClientAttrib();
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+		bglEnd();
 	}
 
 	glPointSize(1.0);
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index f0ff79a..b42875f 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -72,33 +72,8 @@ void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditM
 
 /* utility tool functions */
 
-struct UvElement *ED_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l);
 void uvedit_live_unwrap_update(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit);
 
-/* smart stitch */
-
-/* object that stores display data for previewing before accepting stitching */
-typedef struct StitchPreviewer {
-	/* here we'll store the preview triangle indices of the mesh */
-	float *preview_polys;
-	/* uvs per polygon. */
-	unsigned int *uvs_per_polygon;
-	/*number of preview polygons */
-	unsigned int num_polys;
-	/* preview data. These will be either the previewed vertices or edges depending on stitch mode settings */
-	float *preview_stitchable;
-	float *preview_unstitchable;
-	/* here we'll store the number of elements to be drawn */
-	unsigned int num_stitchable;
-	unsigned int num_unstitchable;
-	unsigned int preview_uvs;
-	/* ...and here we'll store the triangles*/
-	float *static_tris;
-	unsigned int num_static_tris;
-} StitchPreviewer;
-
-StitchPreviewer *uv_get_stitch_previewer(void);
-
 /* operators */
 
 void UV_OT_average_islands_scale(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 6e655fa..a384c77 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -170,7 +170,6 @@ void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *i
 void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *ima, Image *previma)
 {
 	BMEditMesh *em;
-	BMFace *efa;
 	BMIter iter;
 	MTexPoly *tf;
 	int update = 0;
@@ -198,6 +197,8 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
 			ED_object_assign_active_image(bmain, obedit, efa->mat_nr + 1, ima);
 	}
 	else {
+		BMFace *efa;
+
 		/* old shading system, assign image to selected faces */
 #ifdef USE_SWITCH_ASPECT
 		float prev_aspect[2], fprev_aspect;
@@ -214,6 +215,8 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
 		if (!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
 			BM_data_layer_add(em->bm, &em->bm->pdata, CD_MTEXPOLY);
 			BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV);
+			/* make UVs all nice 0-1 */
+			ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer_index(&em->bm->pdata, CD_MTEXPOLY));
 			update = 1;
 		}
 
@@ -221,7 +224,9 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
 		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 
-			if (uvedit_face_visible_test(scene, previma, efa, tf)) {
+			if (uvedit_face_visible_test(scene, previma, efa, tf) &&
+			    (selected == TRUE || uvedit_face_select_test(scene, em, efa)))
+			{
 				if (ima) {
 					tf->tpage = ima;
 					
@@ -613,7 +618,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], f
 		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 			if (uvedit_uv_select_test(em, scene, l)) {
 				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-				DO_MINMAX2(luv->uv, r_min, r_max);
+				minmax_v2v2_v2(r_min, r_max, luv->uv);
 				sel = 1;
 			}
 		}
@@ -771,13 +776,15 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
 	BM_ITER_ELEM (l, &iter, efa, BM_LOOPS_OF_FACE) {
 		luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 		
-		if (i == id1)
+		if (i == id1) {
 			uv1 = luv->uv;
-		else if (i == id)
-			;  /* uv2 = luv->uv; */ /* UNUSED */
-		else if (i == id2)
+		}
+		else if (i == id) {
+			/* uv2 = luv->uv; */ /* UNUSED */
+		}
+		else if (i == id2) {
 			uv3 = luv->uv;
-
+		}
 		i++;
 	}
 
@@ -892,19 +899,6 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
 	return found;
 }
 
-UvElement *ED_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l)
-{
-	UvElement *element;
-
-	element = map->vert[BM_elem_index_get(l->v)];
-
-	for (; element; element = element->next)
-		if (element->face == efa)
-			return element;
-
-	return NULL;
-}
-
 /*********************** loop select ***********************/
 
 static void select_edgeloop_uv_vertex_loop_flag(UvMapVert *first)
@@ -1310,9 +1304,7 @@ static void weld_align_uv(bContext *C, int tool)
 	Object *obedit;
 	Image *ima;
 	BMEditMesh *em;
-	BMIter iter, liter;
 	MTexPoly *tf;
-	MLoopUV *luv;
 	float cent[2], min[2], max[2];
 	
 	scene = CTX_data_scene(C);
@@ -1324,6 +1316,7 @@ static void weld_align_uv(bContext *C, int tool)
 	INIT_MINMAX2(min, max);
 
 	if (tool == 'a') {
+		BMIter iter, liter;
 		BMFace *efa;
 		BMLoop *l;
 
@@ -1335,8 +1328,8 @@ static void weld_align_uv(bContext *C, int tool)
 
 			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 				if (uvedit_uv_select_test(em, scene, l)) {
-					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-					DO_MINMAX2(luv->uv, min, max);
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					minmax_v2v2_v2(min, max, luv->uv);
 				}
 			}
 		}
@@ -1347,6 +1340,7 @@ static void weld_align_uv(bContext *C, int tool)
 	uvedit_center(scene, ima, obedit, cent, 0);
 
 	if (tool == 'x' || tool == 'w') {
+		BMIter iter, liter;
 		BMFace *efa;
 		BMLoop *l;
 
@@ -1357,7 +1351,7 @@ static void weld_align_uv(bContext *C, int tool)
 
 			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 				if (uvedit_uv_select_test(em, scene, l)) {
-					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 					luv->uv[0] = cent[0];
 				}
 
@@ -1366,6 +1360,7 @@ static void weld_align_uv(bContext *C, int tool)
 	}
 
 	if (tool == 'y' || tool == 'w') {
+		BMIter iter, liter;
 		BMFace *efa;
 		BMLoop *l;
 
@@ -1376,7 +1371,7 @@ static void weld_align_uv(bContext *C, int tool)
 
 			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 				if (uvedit_uv_select_test(em, scene, l)) {
-					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 					luv->uv[1] = cent[1];
 				}
 
@@ -1560,7 +1555,170 @@ static void UV_OT_align(wmOperatorType *ot)
 	/* properties */
 	RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on");
 }
+/* ******************** weld near operator **************** */
+
+typedef struct UVvert {
+	MLoopUV *uv_loop;
+	int weld;
+} UVvert;
+
+static int remove_doubles_exec(bContext *C, wmOperator *op)
+{
+	const float threshold = RNA_float_get(op->ptr, "threshold");
+	const int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
+
+	SpaceImage *sima;
+	Scene *scene;
+	Object *obedit;
+	Image *ima;
+	BMEditMesh *em;
+	MTexPoly *tf;
+	int uv_a_index;
+	int uv_b_index;
+	float *uv_a;
+	float *uv_b;
+
+	BMIter iter, liter;
+	BMFace *efa;
+	BMLoop *l;
+
+	sima = CTX_wm_space_image(C);
+	scene = CTX_data_scene(C);
+	obedit = CTX_data_edit_object(C);
+	em = BMEdit_FromObject(obedit);
+	ima = CTX_data_edit_image(C);
 
+	if (use_unselected == FALSE) {
+		UVvert *vert_arr = NULL;
+		BLI_array_declare(vert_arr);
+		MLoopUV **loop_arr = NULL;
+		BLI_array_declare(loop_arr);
+
+		/* TODO, use qsort as with MESH_OT_remove_doubles, this isn't optimal */
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+			if (!uvedit_face_visible_test(scene, ima, efa, tf))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				if (uvedit_uv_select_test(em, scene, l)) {
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					UVvert vert;
+					vert.uv_loop = luv;
+					vert.weld = FALSE;
+					BLI_array_append(vert_arr, vert);
+				}
+
+			}
+		}
+
+		for (uv_a_index = 0; uv_a_index < BLI_array_count(vert_arr); uv_a_index++) {
+			if (vert_arr[uv_a_index].weld == FALSE) {
+				float uv_min[2];
+				float uv_max[2];
+
+				BLI_array_empty(loop_arr);
+				BLI_array_append(loop_arr, vert_arr[uv_a_index].uv_loop);
+
+				uv_a = vert_arr[uv_a_index].uv_loop->uv;
+
+				copy_v2_v2(uv_max, uv_a);
+				copy_v2_v2(uv_min, uv_a);
+
+				vert_arr[uv_a_index].weld = TRUE;
+				for (uv_b_index = uv_a_index + 1; uv_b_index < BLI_array_count(vert_arr); uv_b_index++) {
+					uv_b = vert_arr[uv_b_index].uv_loop->uv;
+					if ((vert_arr[uv_b_index].weld == FALSE) &&
+					    (len_manhattan_v2v2(uv_a, uv_b) < threshold))
+					{
+						minmax_v2v2_v2(uv_max, uv_min, uv_b);
+						BLI_array_append(loop_arr, vert_arr[uv_b_index].uv_loop);
+						vert_arr[uv_b_index].weld = TRUE;
+					}
+				}
+				if (BLI_array_count(loop_arr)) {
+					float uv_mid[2];
+					mid_v2_v2v2(uv_mid, uv_min, uv_max);
+					for (uv_b_index = 0; uv_b_index < BLI_array_count(loop_arr); uv_b_index++) {
+						copy_v2_v2(loop_arr[uv_b_index]->uv, uv_mid);
+					}
+				}
+			}
+		}
+
+		BLI_array_free(vert_arr);
+		BLI_array_free(loop_arr);
+	}
+	else {
+		/* selected -> unselected
+		 *
+		 * No need to use 'UVvert' here */
+		MLoopUV **loop_arr = NULL;
+		BLI_array_declare(loop_arr);
+		MLoopUV **loop_arr_unselected = NULL;
+		BLI_array_declare(loop_arr_unselected);
+
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+			if (!uvedit_face_visible_test(scene, ima, efa, tf))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				if (uvedit_uv_select_test(em, scene, l)) {
+					BLI_array_append(loop_arr, luv);
+				}
+				else {
+					BLI_array_append(loop_arr_unselected, luv);
+				}
+			}
+		}
+
+		for (uv_a_index = 0; uv_a_index < BLI_array_count(loop_arr); uv_a_index++) {
+			float dist_best = FLT_MAX, dist;
+			float *uv_best = NULL;
+
+			uv_a = loop_arr[uv_a_index]->uv;
+			for (uv_b_index = 0; uv_b_index < BLI_array_count(loop_arr_unselected); uv_b_index++) {
+				uv_b = loop_arr_unselected[uv_b_index]->uv;
+				dist = len_manhattan_v2v2(uv_a, uv_b);
+				if ((dist < threshold) && (dist < dist_best)) {
+					uv_best = uv_b;
+					dist_best = dist;
+				}
+			}
+			if (uv_best) {
+				copy_v2_v2(uv_a, uv_best);
+			}
+		}
+
+		BLI_array_free(loop_arr);
+		BLI_array_free(loop_arr_unselected);
+	}
+
+	uvedit_live_unwrap_update(sima, scene, obedit);
+	DAG_id_tag_update(obedit->data, 0);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+
+	return OPERATOR_FINISHED;
+}
+
+static void UV_OT_remove_doubles(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Remove Doubles UV";
+	ot->description = "Selected UV vertices that are within a radius of each other are welded together";
+	ot->idname = "UV_OT_remove_doubles";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* api callbacks */
+	ot->exec = remove_doubles_exec;
+	ot->poll = ED_operator_uvedit;
+
+	RNA_def_float(ot->srna, "threshold", 0.02f, 0.0f, 10.0f,
+	              "Merge Distance", "Maximum distance between welded vertices", 0.0f, 1.0f);
+	RNA_def_boolean(ot->srna, "use_unselected", 0, "Unselected", "Merge selected to other unselected vertices");
+}
 /* ******************** weld operator **************** */
 
 static int weld_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1949,7 +2107,7 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop)
 				}
 
 				flush = 1;
-			}			
+			}
 		}
 	}
 	else {
@@ -2131,7 +2289,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
 	NearestHit hit, *hit_p = NULL;
 
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
-		BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled");
+		BKE_report(op->reports, RPT_ERROR, "Cannot select linked when sync selection is enabled");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2238,7 +2396,7 @@ static int select_split_exec(bContext *C, wmOperator *op)
 	short change = FALSE;
 
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
-		BKE_report(op->reports, RPT_ERROR, "Can't split selection when sync selection is enabled");
+		BKE_report(op->reports, RPT_ERROR, "Cannot split selection when sync selection is enabled");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2279,6 +2437,7 @@ static int select_split_exec(bContext *C, wmOperator *op)
 	}
 
 	if (change) {
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -2316,7 +2475,7 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
 	MLoopUV *luv;
 
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
-		BKE_report(op->reports, RPT_ERROR, "Can't unlink selection when sync selection is enabled");
+		BKE_report(op->reports, RPT_ERROR, "Cannot unlink selection when sync selection is enabled");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -2487,13 +2646,16 @@ static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, s
 							break;
 						
 						if (efa_index != vlist_iter->f) {
+							BMLoop *l_other;
 							efa_vlist = EDBM_face_at_index(em, vlist_iter->f);
 							/* tf_vlist = CustomData_bmesh_get(&em->bm->pdata, efa_vlist->head.data, CD_MTEXPOLY); */ /* UNUSED */
 							
+							l_other = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex);
+
 							if (select)
-								uvedit_uv_select_enable(em, scene, BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex), FALSE);
+								uvedit_uv_select_enable(em, scene, l_other, FALSE);
 							else
-								uvedit_uv_select_disable(em, scene, BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex));
+								uvedit_uv_select_disable(em, scene, l_other);
 						}
 						vlist_iter = vlist_iter->next;
 					}
@@ -2507,10 +2669,12 @@ static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, s
 	else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
 		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 			if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
-				if (select)
+				if (select) {
 					uvedit_face_select_enable(scene, em, efa, FALSE);
-				else
+				}
+				else {
 					uvedit_face_select_disable(scene, em, efa);
+				}
 			}
 		}
 	}
@@ -2532,7 +2696,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
 	MLoopUV *luv;
 	rcti rect;
 	rctf rectf;
-	int change, pinned, select, faces, extend;
+	int change, pinned, select, extend;
+	const int use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ?
+	                            (ts->selectmode == SCE_SELECT_FACE) :
+	                            (ts->uv_selectmode == UV_SELECT_FACE);
 
 	/* get rectangle from operator */
 	WM_operator_properties_border_to_rcti(op, &rect);
@@ -2547,14 +2714,9 @@ static int border_select_exec(bContext *C, wmOperator *op)
 
 	if (!extend)
 		select_all_perform(scene, ima, em, SEL_DESELECT);
-	
-	if (ts->uv_flag & UV_SYNC_SELECTION)
-		faces = (ts->selectmode == SCE_SELECT_FACE);
-	else
-		faces = (ts->uv_selectmode == UV_SELECT_FACE);
 
 	/* do actual selection */
-	if (faces && !pinned) {
+	if (use_face_center && !pinned) {
 		/* handle face selection mode */
 		float cent[2];
 
@@ -2575,8 +2737,9 @@ static int border_select_exec(bContext *C, wmOperator *op)
 		}
 
 		/* (de)selects all tagged faces and deals with sticky modes */
-		if (change)
+		if (change) {
 			uv_faces_do_sticky(sima, scene, obedit, select);
+		}
 	}
 	else {
 		/* other selection modes */
@@ -2645,19 +2808,19 @@ static void UV_OT_select_border(wmOperatorType *ot)
 
 /* ******************** circle select operator **************** */
 
-static int select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
-                                    float *offset, float *ell, BMLoop *l, MLoopUV *luv)
+static int uv_inside_circle(const float uv[2], const float offset[2], const float ellipse[2])
 {
 	/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
-	float x, y, r2, *uv;
-
-	uv = luv->uv;
-
-	x = (uv[0] - offset[0]) * ell[0];
-	y = (uv[1] - offset[1]) * ell[1];
+	float x, y;
+	x = (uv[0] - offset[0]) * ellipse[0];
+	y = (uv[1] - offset[1]) * ellipse[1];
+	return ((x * x + y * y) < 1.0f);
+}
 
-	r2 = x * x + y * y;
-	if (r2 < 1.0f) {
+static int select_uv_inside_ellipse(BMEditMesh *em, Scene *scene, const int select,
+                                    const float offset[2], const float ellipse[2], BMLoop *l, MLoopUV *luv)
+{
+	if (uv_inside_circle(luv->uv, offset, ellipse)) {
 		if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
 		else        uvedit_uv_select_disable(em, scene, l);
 		return TRUE;
@@ -2683,6 +2846,9 @@ static int circle_select_exec(bContext *C, wmOperator *op)
 	float zoomx, zoomy, offset[2], ellipse[2];
 	int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
 	int change = FALSE;
+	const int use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ?
+	                            (ts->selectmode == SCE_SELECT_FACE) :
+	                            (ts->uv_selectmode == UV_SELECT_FACE);
 
 	/* get operator properties */
 	select = (gesture_mode == GESTURE_MODAL_SELECT);
@@ -2701,10 +2867,32 @@ static int circle_select_exec(bContext *C, wmOperator *op)
 	UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
 	
 	/* do selection */
-	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
-		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
-			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-			change |= select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
+	if (use_face_center) {
+		change = FALSE;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_elem_flag_disable(efa, BM_ELEM_TAG);
+			/* assume not touched */
+			if ((select) != (uvedit_face_select_test(scene, em, efa))) {
+				float cent[2];
+				uv_poly_center(em, efa, cent);
+				if (uv_inside_circle(cent, offset, ellipse)) {
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
+					change = TRUE;
+				}
+			}
+		}
+
+		/* (de)selects all tagged faces and deals with sticky modes */
+		if (change) {
+			uv_faces_do_sticky(sima, scene, obedit, select);
+		}
+	}
+	else {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				change |= select_uv_inside_ellipse(em, scene, select, offset, ellipse, l, luv);
+			}
 		}
 	}
 
@@ -2746,12 +2934,16 @@ static void UV_OT_circle_select(wmOperatorType *ot)
 
 static int do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short moves, short select)
 {
+	SpaceImage *sima = CTX_wm_space_image(C);
 	Image *ima = CTX_data_edit_image(C);
 	ARegion *ar = CTX_wm_region(C);
 	Object *obedit = CTX_data_edit_object(C);
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *ts = scene->toolsettings;
 	BMEditMesh *em = BMEdit_FromObject(obedit);
+	const int use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ?
+	                            (ts->selectmode == SCE_SELECT_FACE) :
+	                            (ts->uv_selectmode == UV_SELECT_FACE);
 
 	BMIter iter, liter;
 
@@ -2763,9 +2955,10 @@ static int do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mov
 
 	BLI_lasso_boundbox(&rect, mcords, moves);
 
-	if (ts->uv_selectmode == UV_SELECT_FACE) { /* Face Center Sel */
+	if (use_face_center) { /* Face Center Sel */
 		change = FALSE;
 		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_elem_flag_disable(efa, BM_ELEM_TAG);
 			/* assume not touched */
 			if ((select) != (uvedit_face_select_test(scene, em, efa))) {
 				float cent[2];
@@ -2774,11 +2967,16 @@ static int do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mov
 				if (BLI_rcti_isect_pt_v(&rect, screen_uv) &&
 				    BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
 				{
-					uvedit_face_select_enable(scene, em, efa, FALSE);
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
 					change = TRUE;
 				}
 			}
 		}
+
+		/* (de)selects all tagged faces and deals with sticky modes */
+		if (change) {
+			uv_faces_do_sticky(sima, scene, obedit, select);
+		}
 	}
 	else { /* Vert Sel */
 		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -2827,7 +3025,7 @@ static int uv_lasso_select_exec(bContext *C, wmOperator *op)
 		select = !RNA_boolean_get(op->ptr, "deselect");
 		change = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select);
 
-		MEM_freeN(mcords);
+		MEM_freeN((void *)mcords);
 
 		return change ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 	}
@@ -3235,7 +3433,7 @@ static int hide_exec(bContext *C, wmOperator *op)
 	MTexPoly *tf;
 	int swap = RNA_boolean_get(op->ptr, "unselected");
 	Image *ima = sima ? sima->image : NULL;
-	int facemode = (ts->uv_selectmode == UV_SELECT_FACE);
+	const int use_face_center = (ts->uv_selectmode == UV_SELECT_FACE);
 
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
 		EDBM_mesh_hide(em, swap);
@@ -3265,7 +3463,7 @@ static int hide_exec(bContext *C, wmOperator *op)
 		if (hide) {
 			/* note, a special case for edges could be used,
 			 * for now edges act like verts and get flushed */
-			if (facemode) {
+			if (use_face_center) {
 				if (em->selectmode == SCE_SELECT_FACE) {
 					/* check that every UV is selected */
 					if (bm_face_is_all_uv_sel(em->bm, efa, TRUE) == !swap) {
@@ -3283,8 +3481,6 @@ static int hide_exec(bContext *C, wmOperator *op)
 						}
 					}
 					if (!swap) uvedit_face_select_disable(scene, em, efa);
-
-
 				}
 			}
 			else if (em->selectmode == SCE_SELECT_FACE) {
@@ -3347,8 +3543,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	BMLoop *l;
 	BMIter iter, liter;
 	MLoopUV *luv;
-	int facemode = (ts->uv_selectmode == UV_SELECT_FACE);
-	int stickymode = sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
+	const int use_face_center = (ts->uv_selectmode == UV_SELECT_FACE);
+	const int stickymode = sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
 
 	/* note on tagging, selecting faces needs to be delayed so it doesn't select the verts and
 	 * confuse our checks on selected verts. */
@@ -3360,7 +3556,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 
 		return OPERATOR_FINISHED;
 	}
-	if (facemode) {
+	if (use_face_center) {
 		if (em->selectmode == SCE_SELECT_FACE) {
 			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 				BM_elem_flag_disable(efa, BM_ELEM_TAG);
@@ -3779,6 +3975,7 @@ void ED_operatortypes_uvedit(void)
 	WM_operatortype_append(UV_OT_seams_from_islands);
 	WM_operatortype_append(UV_OT_mark_seam);
 	WM_operatortype_append(UV_OT_weld);
+	WM_operatortype_append(UV_OT_remove_doubles);
 	WM_operatortype_append(UV_OT_pin);
 
 	WM_operatortype_append(UV_OT_average_islands_scale);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index f017394..8703234 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -450,7 +450,7 @@ static void p_chart_uv_bbox(PChart *chart, float minv[2], float maxv[2])
 	INIT_MINMAX2(minv, maxv);
 
 	for (v = chart->verts; v; v = v->nextlink) {
-		DO_MINMAX2(v->uv, minv, maxv);
+		minmax_v2v2_v2(minv, maxv, v->uv);
 	}
 }
 
@@ -1566,7 +1566,7 @@ static void p_vert_harmonic_insert(PVert *v)
 
 		e = v->edge;
 		do {
-			npoints++;	
+			npoints++;
 			e = p_wheel_edge_next(e);
 		} while (e && (e != v->edge));
 
@@ -3306,7 +3306,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
 
 		trusted_radius /= 2 * nedges;
 
-		random_angle = rng_getFloat(rng) * 2.0f * (float)M_PI;
+		random_angle = BLI_rng_get_float(rng) * 2.0f * (float)M_PI;
 		dir[0] = trusted_radius * cosf(random_angle);
 		dir[1] = trusted_radius * sinf(random_angle);
 
@@ -3891,9 +3891,9 @@ static void p_smooth(PChart *chart)
 
 		INIT_MINMAX2(fmin, fmax);
 
-		DO_MINMAX2(e1->vert->uv, fmin, fmax);
-		DO_MINMAX2(e2->vert->uv, fmin, fmax);
-		DO_MINMAX2(e3->vert->uv, fmin, fmax);
+		minmax_v2v2_v2(fmin, fmax, e1->vert->uv);
+		minmax_v2v2_v2(fmin, fmax, e2->vert->uv);
+		minmax_v2v2_v2(fmin, fmax, e3->vert->uv);
 
 		bx1 = (int)((fmin[0] - minv[0]) * invmedian);
 		by1 = (int)((fmin[1] - minv[1]) * invmedian);
@@ -3988,7 +3988,7 @@ static void p_smooth(PChart *chart)
 					diff[1] = p[1] - oldp[1];
 
 					length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
-					d = MAX2(d, length);
+					d = max_ff(d, length);
 					moved += length;
 				}
 			}
@@ -4285,7 +4285,7 @@ void param_stretch_begin(ParamHandle *handle)
 	param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED);
 	phandle->state = PHANDLE_STATE_STRETCH;
 
-	phandle->rng = rng_new(31415926);
+	phandle->rng = BLI_rng_new(31415926);
 	phandle->blend = 0.0f;
 
 	for (i = 0; i < phandle->ncharts; i++) {
@@ -4332,7 +4332,7 @@ void param_stretch_end(ParamHandle *handle)
 	param_assert(phandle->state == PHANDLE_STATE_STRETCH);
 	phandle->state = PHANDLE_STATE_CONSTRUCTED;
 
-	rng_free(phandle->rng);
+	BLI_rng_free(phandle->rng);
 	phandle->rng = NULL;
 }
 
@@ -4400,7 +4400,7 @@ void param_pack(ParamHandle *handle, float margin)
 		
 		if (margin > 0.0f)
 			area += sqrt(box->w * box->h);
-	}	
+	}
 	
 	if (margin > 0.0f) {
 		/* multiply the margin by the area to give predictable results not dependent on UV scale,
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 4e0e794..4ca6426 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -46,6 +46,8 @@
 #include "BLI_math_vector.h"
 #include "BLI_string.h"
 
+#include "BIF_gl.h"
+
 #include "BKE_context.h"
 #include "BKE_customdata.h"
 #include "BKE_depsgraph.h"
@@ -55,6 +57,7 @@
 #include "ED_mesh.h"
 #include "ED_uvedit.h"
 #include "ED_screen.h"
+#include "ED_space_api.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -63,11 +66,32 @@
 #include "WM_types.h"
 
 #include "UI_view2d.h"
+#include "UI_resources.h"
 
 #include "uvedit_intern.h"
 
 /* ********************** smart stitch operator *********************** */
 
+/* object that stores display data for previewing before accepting stitching */
+typedef struct StitchPreviewer {
+	/* here we'll store the preview triangle indices of the mesh */
+	float *preview_polys;
+	/* uvs per polygon. */
+	unsigned int *uvs_per_polygon;
+	/*number of preview polygons */
+	unsigned int num_polys;
+	/* preview data. These will be either the previewed vertices or edges depending on stitch mode settings */
+	float *preview_stitchable;
+	float *preview_unstitchable;
+	/* here we'll store the number of elements to be drawn */
+	unsigned int num_stitchable;
+	unsigned int num_unstitchable;
+	unsigned int preview_uvs;
+	/* ...and here we'll store the triangles*/
+	float *static_tris;
+	unsigned int num_static_tris;
+} StitchPreviewer;
+
 
 struct IslandStitchData;
 
@@ -143,6 +167,8 @@ typedef struct StitchState {
 	int static_island;
 	/* store number of primitives per face so that we can allocate the active island buffer later */
 	unsigned int *tris_per_island;
+
+	void *draw_handle;
 } StitchState;
 
 typedef struct PreviewPosition {
@@ -216,7 +242,7 @@ static void stitch_preview_delete(void)
 
 
 /* "getter method" */
-StitchPreviewer *uv_get_stitch_previewer(void)
+static StitchPreviewer *uv_get_stitch_previewer(void)
 {
 	return _stitch_preview;
 }
@@ -406,8 +432,8 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
 	edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1];
 
 	rotation = (edgesin > 0.0f) ?
-	            +acosf(maxf(-1.0f, minf(1.0f, edgecos))) :
-	            -acosf(maxf(-1.0f, minf(1.0f, edgecos)));
+	            +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) :
+	            -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
 
 	island_stitch_data[element1->island].num_rot_elements++;
 	island_stitch_data[element1->island].rotation += rotation;
@@ -981,6 +1007,55 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no
 	normalize_v2(normal);
 }
 
+static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *UNUSED(arg))
+{
+	int i, index = 0;
+	float pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
+	StitchPreviewer *stitch_preview = uv_get_stitch_previewer();
+
+	glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
+	glEnableClientState(GL_VERTEX_ARRAY);
+
+	glEnable(GL_BLEND);
+
+	UI_ThemeColor4(TH_STITCH_PREVIEW_ACTIVE);
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+	glVertexPointer(2, GL_FLOAT, 0, stitch_preview->static_tris);
+	glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_static_tris * 3);
+
+	glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_polys);
+	for (i = 0; i < stitch_preview->num_polys; i++) {
+		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+		UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
+		glDrawArrays(GL_POLYGON, index, stitch_preview->uvs_per_polygon[i]);
+		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+		UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
+		glDrawArrays(GL_POLYGON, index, stitch_preview->uvs_per_polygon[i]);
+
+		index += stitch_preview->uvs_per_polygon[i];
+	}
+	glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
+#if 0
+	UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
+	glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris * 3);
+#endif
+	glDisable(GL_BLEND);
+
+	/* draw vert preview */
+	glPointSize(pointsize * 2.0f);
+	UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE);
+	glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable);
+	glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable);
+
+	UI_ThemeColor4(TH_STITCH_PREVIEW_UNSTITCHABLE);
+	glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_unstitchable);
+	glDrawArrays(GL_POINTS, 0, stitch_preview->num_unstitchable);
+
+	glPopClientAttrib();
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+}
+
 static int stitch_init(bContext *C, wmOperator *op)
 {
 	/* for fast edge lookup... */
@@ -997,17 +1072,23 @@ static int stitch_init(bContext *C, wmOperator *op)
 	BMEditMesh *em;
 	GHashIterator *ghi;
 	UvEdge *all_edges;
-	StitchState *state = MEM_mallocN(sizeof(StitchState), "stitch state");
+	StitchState *state;
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *ts = scene->toolsettings;
+	ARegion *ar = CTX_wm_region(C);
 
 	Object *obedit = CTX_data_edit_object(C);
 
-	op->customdata = state;
+	if (!ar)
+		return 0;
+
+	state = MEM_mallocN(sizeof(StitchState), "stitch state");
 
 	if (!state)
 		return 0;
 
+	op->customdata = state;
+
 	/* initialize state */
 	state->use_limit = RNA_boolean_get(op->ptr, "use_limit");
 	state->limit_dist = RNA_float_get(op->ptr, "limit");
@@ -1016,6 +1097,7 @@ static int stitch_init(bContext *C, wmOperator *op)
 	state->static_island = RNA_int_get(op->ptr, "static_island");
 	state->midpoints = RNA_boolean_get(op->ptr, "midpoint_snap");
 	state->clear_seams = RNA_boolean_get(op->ptr, "clear_seams");
+	state->draw_handle = ED_region_draw_cb_activate(ar->type, stitch_draw, NULL, REGION_DRAW_POST_VIEW);
 	/* in uv synch selection, all uv's are visible */
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
 		state->element_map = EDBM_uv_element_map_create(state->em, 0, 1);
@@ -1282,6 +1364,8 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
 	if (sa)
 		ED_area_headerprint(sa, NULL);
 
+	ED_region_draw_cb_exit(CTX_wm_region(C)->type, stitch_state->draw_handle);
+
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
@@ -1366,18 +1450,22 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 			}
 		case PADENTER:
 		case RETKEY:
-			if (stitch_process_data(stitch_state, scene, 1)) {
-				stitch_exit(C, op, 1);
-				return OPERATOR_FINISHED;
+			if (event->val == KM_PRESS) {
+				if (stitch_process_data(stitch_state, scene, 1)) {
+					stitch_exit(C, op, 1);
+					return OPERATOR_FINISHED;
+				}
+				else {
+					return stitch_cancel(C, op);
+				}
 			}
 			else {
-				return stitch_cancel(C, op);
+				return OPERATOR_PASS_THROUGH;
 			}
-
 		/* Increase limit */
 		case PADPLUSKEY:
 		case WHEELUPMOUSE:
-			if (event->alt) {
+			if (event->val == KM_PRESS && event->alt) {
 				stitch_state->limit_dist += 0.01f;
 				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
@@ -1390,7 +1478,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 		/* Decrease limit */
 		case PADMINUS:
 		case WHEELDOWNMOUSE:
-			if (event->alt) {
+			if (event->val == KM_PRESS && event->alt) {
 				stitch_state->limit_dist -= 0.01f;
 				stitch_state->limit_dist = MAX2(0.01f, stitch_state->limit_dist);
 				if (!stitch_process_data(stitch_state, scene, 0)) {
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 7c06fbd..1f3f219 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -60,6 +60,7 @@
 #include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_tessmesh.h"
 
 #include "BLI_math.h"
@@ -177,7 +178,33 @@ static int uvedit_have_selection(Scene *scene, BMEditMesh *em, short implicit)
 	return 0;
 }
 
-static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, 
+static void ED_uvedit_get_aspect(Scene *scene, Object *ob, BMEditMesh *em, float *aspx, float *aspy)
+{
+	int sloppy = TRUE;
+	int selected = FALSE;
+	BMFace *efa;
+	Image *ima;
+
+	efa = BM_active_face_get(em->bm, sloppy, selected);
+
+	if (efa) {
+		if (BKE_scene_use_new_shading_nodes(scene)) {
+			ED_object_get_active_image(ob, efa->mat_nr + 1, &ima, NULL, NULL);
+		}
+		else {
+			MTexPoly *tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+			ima = tf->tpage;
+		}
+
+		ED_image_get_uv_aspect(ima, NULL, aspx, aspy);
+	}
+	else {
+		*aspx = 1.0f;
+		*aspy = 1.0f;
+	}
+}
+
+static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh *em, 
                                            short implicit, short fill, short sel,
                                            short correct_aspect)
 {
@@ -187,27 +214,16 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
 	BMLoop *l;
 	BMEdge *eed;
 	BMIter iter, liter;
-	MTexPoly *tf;
 	
 	handle = param_construct_begin();
 
 	if (correct_aspect) {
-		int sloppy = TRUE;
-		int selected = FALSE;
-
-		efa = BM_active_face_get(em->bm, sloppy, selected);
+		float aspx, aspy;
 
-		if (efa) {
-			float aspx, aspy;
-			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
 
-			ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
-		
-			if (aspx != aspy)
-				param_aspect_ratio(handle, aspx, aspy);
-			else
-				param_aspect_ratio(handle, 1.0, 1.0);
-		}
+		if (aspx != aspy)
+			param_aspect_ratio(handle, aspx, aspy);
 	}
 	
 	/* we need the vert indices */
@@ -216,14 +232,14 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
 	BLI_srand(0);
 	
 	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
-		ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first;
+		ScanFillVert *sf_vert = NULL, *sf_vert_last, *sf_vert_first;
 		ScanFillFace *sf_tri;
 		ParamKey key, vkeys[4];
 		ParamBool pin[4], select[4];
 		BMLoop *ls[3];
 		float *co[4];
 		float *uv[4];
-		int i, lsel;
+		int lsel;
 
 		if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
 			continue;
@@ -245,6 +261,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
 		// tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);  // UNUSED
 
 		if (efa->len == 3 || efa->len == 4) {
+			int i;
 			/* for quads let parametrize split, it can make better decisions
 			 * about which split is best for unwrapping than scanfill */
 			i = 0;
@@ -289,8 +306,9 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
 
 			BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
 
-			BLI_scanfill_calc_ex(&sf_ctx, TRUE, efa->no);
+			BLI_scanfill_calc_ex(&sf_ctx, 0, efa->no);
 			for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+				int i;
 				ls[0] = sf_tri->v1->tmp.p;
 				ls[1] = sf_tri->v2->tmp.p;
 				ls[2] = sf_tri->v3->tmp.p;
@@ -353,13 +371,12 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para
 
 /* unwrap handle initialization for subsurf aware-unwrapper. The many modifications required to make the original function(see above)
  * work justified the existence of a new function. */
-static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *em, short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, short fill, short sel, short correct_aspect)
 {
 	ParamHandle *handle;
 	/* index pointers */
 	MFace *face;
 	MEdge *edge;
-	BMFace *editFace;
 	int i;
 
 	/* modifier initialization data, will  control what type of subdivision will happen*/
@@ -367,7 +384,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
 	/* Used to hold subsurfed Mesh */
 	DerivedMesh *derivedMesh, *initialDerived;
 	/* holds original indices for subsurfed mesh */
-	int *origVertIndices, *origFaceIndices, *origEdgeIndices;
+	int *origVertIndices, *origEdgeIndices, *origFaceIndices, *origPolyIndices;
 	/* Holds vertices of subsurfed mesh */
 	MVert *subsurfedVerts;
 	MEdge *subsurfedEdges;
@@ -383,30 +400,19 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
 	handle = param_construct_begin();
 
 	if (correct_aspect) {
-		int sloppy = TRUE;
-		int selected = FALSE;
-
-		editFace = BM_active_face_get(em->bm, sloppy, selected);
-
-		if (editFace) {
-			MTexPoly *tf;
-			float aspx, aspy;
-			tf = CustomData_bmesh_get(&em->bm->pdata, editFace->head.data, CD_MTEXPOLY);
+		float aspx, aspy;
 
-			ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
+		ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
 
-			if (aspx != aspy)
-				param_aspect_ratio(handle, aspx, aspy);
-			else
-				param_aspect_ratio(handle, 1.0, 1.0);
-		}
+		if (aspx != aspy)
+			param_aspect_ratio(handle, aspx, aspy);
 	}
 
 	/* number of subdivisions to perform */
 	smd.levels = scene->toolsettings->uv_subsurf_level;
 	smd.subdivType = ME_CC_SUBSURF;
 		
-	initialDerived = CDDM_from_BMEditMesh(em, NULL, 0, 0);
+	initialDerived = CDDM_from_editbmesh(em, FALSE, FALSE);
 	derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd,
 	                                                NULL, SUBSURF_IN_EDIT_MODE);
 
@@ -420,6 +426,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
 	origVertIndices = derivedMesh->getVertDataArray(derivedMesh, CD_ORIGINDEX);
 	origEdgeIndices = derivedMesh->getEdgeDataArray(derivedMesh, CD_ORIGINDEX);
 	origFaceIndices = derivedMesh->getTessFaceDataArray(derivedMesh, CD_ORIGINDEX);
+	origPolyIndices = derivedMesh->getPolyDataArray(derivedMesh, CD_ORIGINDEX);
 
 	numOfEdges = derivedMesh->getNumEdges(derivedMesh);
 	numOfFaces = derivedMesh->getNumTessFaces(derivedMesh);
@@ -431,7 +438,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
 
 	/* map subsurfed faces to original editFaces */
 	for (i = 0; i < numOfFaces; i++)
-		faceMap[i] = EDBM_face_at_index(em, origFaceIndices[i]);
+		faceMap[i] = EDBM_face_at_index(em, DM_origindex_mface_mpoly(origFaceIndices, origPolyIndices, i));
 
 	edgeMap = MEM_mallocN(numOfEdges * sizeof(BMEdge *), "unwrap_edit_edge_map");
 
@@ -538,7 +545,7 @@ static int minimize_stretch_init(bContext *C, wmOperator *op)
 	ms->blend = RNA_float_get(op->ptr, "blend");
 	ms->iterations = RNA_int_get(op->ptr, "iterations");
 	ms->i = 0;
-	ms->handle = construct_param_handle(scene, em, implicit, fill_holes, 1, 1);
+	ms->handle = construct_param_handle(scene, obedit, em, implicit, fill_holes, 1, 1);
 	ms->lasttime = PIL_check_seconds_timer();
 
 	param_stretch_begin(ms->handle);
@@ -727,14 +734,12 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
-	if (RNA_struct_property_is_set(op->ptr, "margin")) {
+	if (RNA_struct_property_is_set(op->ptr, "margin"))
 		scene->toolsettings->uvcalc_margin = RNA_float_get(op->ptr, "margin");
-	}
-	else {
+	else
 		RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
-	}
 
-	handle = construct_param_handle(scene, em, implicit, 0, 1, 1);
+	handle = construct_param_handle(scene, obedit, em, implicit, 0, 1, 1);
 	param_pack(handle, scene->toolsettings->uvcalc_margin);
 	param_flush(handle);
 	param_delete(handle);
@@ -759,7 +764,7 @@ void UV_OT_pack_islands(wmOperatorType *ot)
 	ot->poll = ED_operator_uvedit;
 
 	/* properties */
-	RNA_def_float_factor(ot->srna, "margin", 0.0f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
+	RNA_def_float_factor(ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
 }
 
 /* ******************** Average Islands Scale operator **************** */
@@ -776,7 +781,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_CANCELLED;
 	}
 
-	handle = construct_param_handle(scene, em, implicit, 0, 1, 1);
+	handle = construct_param_handle(scene, obedit, em, implicit, 0, 1, 1);
 	param_average(handle);
 	param_flush(handle);
 	param_delete(handle);
@@ -817,9 +822,9 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
 	}
 
 	if (use_subsurf)
-		liveHandle = construct_param_handle_subsurfed(scene, em, fillholes, 0, 1);
+		liveHandle = construct_param_handle_subsurfed(scene, obedit, em, fillholes, 0, 1);
 	else
-		liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
+		liveHandle = construct_param_handle(scene, obedit, em, 0, fillholes, 0, 1);
 
 	param_lscm_begin(liveHandle, PARAM_TRUE, abf);
 }
@@ -1007,22 +1012,15 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
 		              "Radius of the sphere or cylinder", 0.0001f, 100.0f);
 }
 
-static void correct_uv_aspect(BMEditMesh *em)
+static void correct_uv_aspect(Scene *scene, Object *ob, BMEditMesh *em)
 {
-	int sloppy = TRUE;
-	int selected = FALSE;
-	BMFace *efa = BM_active_face_get(em->bm, sloppy, selected);
 	BMLoop *l;
 	BMIter iter, liter;
 	MLoopUV *luv;
-	float scale, aspx = 1.0f, aspy = 1.0f;
+	BMFace *efa;
+	float scale, aspx, aspy;
 	
-	if (efa) {
-		MTexPoly *tf;
-
-		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
-		ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
-	}
+	ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
 	
 	if (aspx == aspy)
 		return;
@@ -1067,7 +1065,7 @@ static void uv_map_clip_correct_properties(wmOperatorType *ot)
 	                "Scale UV coordinates to bounds after unwrapping");
 }
 
-static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
+static void uv_map_clip_correct(Scene *scene, Object *ob, BMEditMesh *em, wmOperator *op)
 {
 	BMFace *efa;
 	BMLoop *l;
@@ -1080,7 +1078,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
 
 	/* correct for image aspect ratio */
 	if (correct_aspect)
-		correct_uv_aspect(em);
+		correct_uv_aspect(scene, ob, em);
 
 	if (scale_to_bounds) {
 		INIT_MINMAX2(min, max);
@@ -1091,7 +1089,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
 
 			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-				DO_MINMAX2(luv->uv, min, max);
+				minmax_v2v2_v2(min, max, luv->uv);
 			}
 		}
 		
@@ -1144,9 +1142,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
 	const short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
 
 	if (use_subsurf)
-		handle = construct_param_handle_subsurfed(scene, em, fill_holes, sel, correct_aspect);
+		handle = construct_param_handle_subsurfed(scene, obedit, em, fill_holes, sel, correct_aspect);
 	else
-		handle = construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
+		handle = construct_param_handle(scene, obedit, em, 0, fill_holes, sel, correct_aspect);
 
 	param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
 	param_lscm_solve(handle);
@@ -1170,7 +1168,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 	int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
 	int use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data");
 	int subsurf_level = RNA_int_get(op->ptr, "uv_subsurf_level");
-	float obsize[3], unitsize[3] = {1.0f, 1.0f, 1.0f};
+	float obsize[3];
 	short implicit = 0;
 
 	if (!uvedit_have_selection(scene, em, implicit)) {
@@ -1183,8 +1181,9 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 	}
 
 	mat4_to_size(obsize, obedit->obmat);
-	if (!compare_v3v3(obsize, unitsize, 1e-4f))
-		BKE_report(op->reports, RPT_INFO, "Object scale is not 1.0. Unwrap will operate on a non-scaled version of the mesh.");
+	if (!(fabsf(obsize[0] - obsize[1]) < 1e-4f && fabsf(obsize[1] - obsize[2]) < 1e-4f))
+		BKE_report(op->reports, RPT_INFO,
+		           "Object has non-uniform scale, unwrap will operate on a non-scaled version of the mesh");
 
 	/* remember last method for live unwrap */
 	if (RNA_struct_property_is_set(op->ptr, "method"))
@@ -1192,6 +1191,12 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 	else
 		RNA_enum_set(op->ptr, "method", scene->toolsettings->unwrapper);
 
+	/* remember packing marging */
+	if (RNA_struct_property_is_set(op->ptr, "margin"))
+		scene->toolsettings->uvcalc_margin = RNA_float_get(op->ptr, "margin");
+	else
+		RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
+
 	scene->toolsettings->uv_subsurf_level = subsurf_level;
 
 	if (fill_holes) scene->toolsettings->uvcalc_flag |=  UVCALC_FILLHOLES;
@@ -1239,8 +1244,9 @@ void UV_OT_unwrap(wmOperatorType *ot)
 	                "Map UVs taking image aspect ratio into account");
 	RNA_def_boolean(ot->srna, "use_subsurf_data", 0, "Use Subsurf Data",
 	                "Map UVs taking vertex position after subsurf into account");
-	RNA_def_int(ot->srna, "uv_subsurf_level", 1, 1, 6, "SubSurf Target",
+	RNA_def_int(ot->srna, "uv_subsurf_level", 1, 1, 6, "Subsurf Target",
 	            "Number of times to subdivide before calculating UVs", 1, 6);
+	RNA_def_float_factor(ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
 }
 
 /**************** Project From View operator **************/
@@ -1313,7 +1319,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	uv_map_clip_correct(em, op);
+	uv_map_clip_correct(scene, obedit, em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1408,7 +1414,7 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf))
 	BMIter liter;
 	MLoopUV *luv;
 	float **uvs = NULL;
-	BLI_array_fixedstack_declare(uvs, BM_NGON_STACK_SIZE, efa->len, __func__);
+	BLI_array_fixedstack_declare(uvs, BM_DEFAULT_NGON_STACK_SIZE, efa->len, __func__);
 	float dx;
 	int i, mi;
 
@@ -1428,8 +1434,8 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf))
 		if (i != mi) {
 			dx = uvs[mi][0] - uvs[i][0];
 			if (dx > 0.5f) uvs[i][0] += 1.0f;
-		} 
-	} 
+		}
+	}
 
 	BLI_array_fixedstack_free(uvs);
 }
@@ -1467,7 +1473,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
 		uv_map_mirror(em, efa, tf);
 	}
 
-	uv_map_clip_correct(em, op);
+	uv_map_clip_correct(scene, obedit, em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1542,7 +1548,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
 		uv_map_mirror(em, efa, tf);
 	}
 
-	uv_map_clip_correct(em, op);
+	uv_map_clip_correct(scene, obedit, em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1622,7 +1628,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	uv_map_clip_correct(em, op);
+	uv_map_clip_correct(scene, obedit, em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 1729ac0..36fbd81 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -123,37 +123,36 @@ void GPU_global_buffer_pool_free(void);
 GPUBuffer *GPU_buffer_alloc(int size);
 void GPU_buffer_free(GPUBuffer *buffer);
 
-GPUDrawObject *GPU_drawobject_new(struct DerivedMesh *dm );
-void GPU_drawobject_free(struct DerivedMesh *dm );
+GPUDrawObject *GPU_drawobject_new(struct DerivedMesh *dm);
+void GPU_drawobject_free(struct DerivedMesh *dm);
 
 /* called before drawing */
-void GPU_vertex_setup(struct DerivedMesh *dm );
-void GPU_normal_setup(struct DerivedMesh *dm );
-void GPU_uv_setup(struct DerivedMesh *dm );
-void GPU_color_setup(struct DerivedMesh *dm );
-void GPU_edge_setup(struct DerivedMesh *dm );	/* does not mix with other data */
-void GPU_uvedge_setup(struct DerivedMesh *dm );
-int GPU_attrib_element_size( GPUAttrib data[], int numdata );
-void GPU_interleaved_attrib_setup( GPUBuffer *buffer, GPUAttrib data[], int numdata );
+void GPU_vertex_setup(struct DerivedMesh *dm);
+void GPU_normal_setup(struct DerivedMesh *dm);
+void GPU_uv_setup(struct DerivedMesh *dm);
+/* colType is the cddata MCol type to use! */
+void GPU_color_setup(struct DerivedMesh *dm, int colType);
+void GPU_edge_setup(struct DerivedMesh *dm); /* does not mix with other data */
+void GPU_uvedge_setup(struct DerivedMesh *dm);
+int GPU_attrib_element_size(GPUAttrib data[], int numdata);
+void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata);
 
 /* can't lock more than one buffer at once */
-void *GPU_buffer_lock( GPUBuffer *buffer );	
-void *GPU_buffer_lock_stream( GPUBuffer *buffer );
-void GPU_buffer_unlock( GPUBuffer *buffer );
+void *GPU_buffer_lock(GPUBuffer *buffer);
+void *GPU_buffer_lock_stream(GPUBuffer *buffer);
+void GPU_buffer_unlock(GPUBuffer *buffer);
 
-/* upload three unsigned chars, representing RGB colors, for each vertex. Resets dm->drawObject->colType to -1 */
-void GPU_color3_upload(struct DerivedMesh *dm, unsigned char *data );
 /* switch color rendering on=1/off=0 */
-void GPU_color_switch( int mode );
+void GPU_color_switch(int mode);
 
 /* used for drawing edges */
-void GPU_buffer_draw_elements( GPUBuffer *elements, unsigned int mode, int start, int count );
+void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start, int count);
 
 /* called after drawing */
 void GPU_buffer_unbind(void);
 
 /* used to check whether to use the old (without buffers) code */
-int GPU_buffer_legacy(struct DerivedMesh *dm );
+int GPU_buffer_legacy(struct DerivedMesh *dm);
 
 /* Buffers for non-DerivedMesh drawing */
 typedef struct GPU_Buffers GPU_Buffers;
@@ -162,18 +161,22 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
                                     struct MFace *mface, struct MVert *mvert,
                                     int *face_indices, int totface);
 
-void GPU_update_mesh_buffers(GPU_Buffers *buffers, struct MVert *mvert,
-                             int *vert_indices, int totvert, const float *vmask);
+void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
+                             int *vert_indices, int totvert, const float *vmask,
+                             int (*face_vert_indices)[4], int show_diffuse_color);
 
 GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
                                     unsigned int **grid_hidden, int gridsize);
 
 void GPU_update_grid_buffers(GPU_Buffers *buffers, struct CCGElem **grids,
                              const struct DMFlagMat *grid_flag_mats,
-                             int *grid_indices, int totgrid, const struct CCGKey *key);
+                             int *grid_indices, int totgrid, const struct CCGKey *key,
+                             int show_diffuse_color);
 
 void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial);
 
+int GPU_buffers_diffuse_changed(GPU_Buffers *buffers, int show_diffuse_color);
+
 void GPU_free_buffers(GPU_Buffers *buffers);
 
 #endif
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 285acb6..b26c255 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -75,6 +75,8 @@ void GPU_end_object_materials(void);
 int GPU_enable_material(int nr, void *attribs);
 void GPU_disable_material(void);
 
+void GPU_material_diffuse_get(int nr, float diff[4]);
+
 void GPU_set_material_alpha_blend(int alphablend);
 int GPU_get_material_alpha_blend(void);
 
@@ -122,7 +124,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
 void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
 void GPU_update_images_framechange(void);
 int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, int ncd);
+int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, int isdata);
 void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth, int mipmap, int use_hight_bit_depth, struct Image *ima);
 void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x, int y, int mipmap, struct Image *ima, struct ImBuf *ibuf);
 int GPU_upload_dxt_texture(struct ImBuf *ibuf);
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 198d002..7eaa408 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -107,11 +107,11 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
 
 GPUTexture *GPU_texture_create_1D(int w, float *pixels, char err_out[256]);
 GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels, char err_out[256]);
-GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels);
+GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels);
 GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]);
 GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256]);
 GPUTexture *GPU_texture_from_blender(struct Image *ima,
-	struct ImageUser *iuser, int ncd, double time, int mipmap);
+	struct ImageUser *iuser, int isdata, double time, int mipmap);
 void GPU_texture_free(GPUTexture *tex);
 
 void GPU_texture_ref(GPUTexture *tex);
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index baa557c..c46230d 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -107,10 +107,9 @@ typedef struct GPUNodeStack {
 GPUNodeLink *GPU_attribute(int type, const char *name);
 GPUNodeLink *GPU_uniform(float *num);
 GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
-GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, int ncd);
+GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, int isdata);
 GPUNodeLink *GPU_texture(int size, float *pixels);
 GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, int dynamictype, void *data);
-GPUNodeLink *GPU_socket(GPUNodeStack *sock);
 GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
 
 int GPU_link(GPUMaterial *mat, const char *name, ...);
diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript
index f7ed9ef..9b8a86e 100644
--- a/source/blender/gpu/SConscript
+++ b/source/blender/gpu/SConscript
@@ -27,7 +27,6 @@ sources.extend((
 	os.path.join(env['DATA_SOURCES'], "gpu_shader_vertex.glsl.c"),
 	os.path.join(env['DATA_SOURCES'], "gpu_shader_sep_gaussian_blur_frag.glsl.c"),
 	os.path.join(env['DATA_SOURCES'], "gpu_shader_sep_gaussian_blur_vert.glsl.c"),
-	os.path.join(env['DATA_SOURCES'], "gpu_shader_material.glsl.c"),
 	os.path.join(env['DATA_SOURCES'], "gpu_shader_vsm_store_frag.glsl.c"),
 	os.path.join(env['DATA_SOURCES'], "gpu_shader_vsm_store_vert.glsl.c"),
 	))
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 2011622..6e475ac 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -54,6 +54,7 @@
 #include "DNA_userdef_types.h"
 
 #include "GPU_buffers.h"
+#include "GPU_draw.h"
 
 typedef enum {
 	GPU_BUFFER_VERTEX_STATE = 1,
@@ -707,34 +708,6 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
 	}
 }
 
-
-static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index, int *mat_orig_to_new, void *user)
-{
-	int i, totface;
-	char *varray = (char *)varray_;
-	char *mcol = (char *)user;
-	MFace *f = dm->getTessFaceArray(dm);
-
-	totface = dm->getNumTessFaces(dm);
-	for (i = 0; i < totface; i++, f++) {
-		int start = index[mat_orig_to_new[f->mat_nr]];
-
-		/* v1 v2 v3 */
-		copy_v3_v3_char(&varray[start], &mcol[i * 12]);
-		copy_v3_v3_char(&varray[start + 3], &mcol[i * 12 + 3]);
-		copy_v3_v3_char(&varray[start + 6], &mcol[i * 12 + 6]);
-		index[mat_orig_to_new[f->mat_nr]] += 9;
-
-		if (f->v4) {
-			/* v3 v4 v1 */
-			copy_v3_v3_char(&varray[start + 9], &mcol[i * 12 + 6]);
-			copy_v3_v3_char(&varray[start + 12], &mcol[i * 12 + 9]);
-			copy_v3_v3_char(&varray[start + 15], &mcol[i * 12]);
-			index[mat_orig_to_new[f->mat_nr]] += 9;
-		}
-	}
-}
-
 static void copy_mcol_uc3(unsigned char *v, unsigned char *col)
 {
 	v[0] = col[3];
@@ -819,28 +792,6 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
 	}
 }
 
-/* get the DerivedMesh's MCols; choose (in decreasing order of
- * preference) from CD_ID_MCOL, CD_PREVIEW_MCOL, or CD_MCOL */
-static MCol *gpu_buffer_color_type(DerivedMesh *dm)
-{
-	MCol *c;
-	int type;
-
-	type = CD_ID_MCOL;
-	c = DM_get_tessface_data_layer(dm, type);
-	if (!c) {
-		type = CD_PREVIEW_MCOL;
-		c = DM_get_tessface_data_layer(dm, type);
-		if (!c) {
-			type = CD_MCOL;
-			c = DM_get_tessface_data_layer(dm, type);
-		}
-	}
-
-	dm->drawObject->colType = type;
-	return c;
-}
-
 typedef enum {
 	GPU_BUFFER_VERTEX = 0,
 	GPU_BUFFER_NORMAL,
@@ -923,7 +874,7 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type)
 
 	/* special handling for MCol and UV buffers */
 	if (type == GPU_BUFFER_COLOR) {
-		if (!(user_data = gpu_buffer_color_type(dm)))
+		if (!(user_data = DM_get_tessface_data_layer(dm, dm->drawObject->colType)))
 			return NULL;
 	}
 	else if (type == GPU_BUFFER_UV) {
@@ -943,7 +894,7 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type)
 static GPUBuffer *gpu_buffer_setup_common(DerivedMesh *dm, GPUBufferType type)
 {
 	GPUBuffer **buf;
-	
+
 	if (!dm->drawObject)
 		dm->drawObject = GPU_drawobject_new(dm);
 
@@ -1005,8 +956,28 @@ void GPU_uv_setup(DerivedMesh *dm)
 	GLStates |= GPU_BUFFER_TEXCOORD_STATE;
 }
 
-void GPU_color_setup(DerivedMesh *dm)
+void GPU_color_setup(DerivedMesh *dm, int colType)
 {
+	if (!dm->drawObject) {
+		/* XXX Not really nice, but we need a valid gpu draw object to set the colType...
+		 *     Else we would have to add a new param to gpu_buffer_setup_common. */
+		dm->drawObject = GPU_drawobject_new(dm);
+		dm->dirty &= ~DM_DIRTY_MCOL_UPDATE_DRAW;
+		dm->drawObject->colType = colType;
+	}
+	/* In paint mode, dm may stay the same during stroke, however we still want to update colors!
+	 * Also check in case we changed color type (i.e. which MCol cdlayer we use). */
+	else if ((dm->dirty & DM_DIRTY_MCOL_UPDATE_DRAW) || (colType != dm->drawObject->colType)) {
+		GPUBuffer **buf = gpu_drawobject_buffer_from_type(dm->drawObject, GPU_BUFFER_COLOR);
+		/* XXX Freeing this buffer is a bit stupid, as geometry has not changed, size should remain the same.
+		 *     Not sure though it would be worth defining a sort of gpu_buffer_update func - nor whether
+		 *     it is even possible ! */
+		GPU_buffer_free(*buf);
+		*buf = NULL;
+		dm->dirty &= ~DM_DIRTY_MCOL_UPDATE_DRAW;
+		dm->drawObject->colType = colType;
+	}
+
 	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR))
 		return;
 
@@ -1167,20 +1138,6 @@ void GPU_buffer_unbind(void)
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
 }
 
-/* confusion: code in cdderivedmesh calls both GPU_color_setup and
- * GPU_color3_upload; both of these set the `colors' buffer, so seems
- * like it will just needlessly overwrite? --nicholas */
-void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
-{
-	if (dm->drawObject == 0)
-		dm->drawObject = GPU_drawobject_new(dm);
-	GPU_buffer_free(dm->drawObject->colors);
-
-	dm->drawObject->colors = gpu_buffer_setup(dm, dm->drawObject, 3,
-	                                          sizeof(char) * 3 * dm->drawObject->tot_triangle_point,
-	                                          GL_ARRAY_BUFFER_ARB, data, GPU_buffer_copy_color3);
-}
-
 void GPU_color_switch(int mode)
 {
 	if (mode) {
@@ -1270,11 +1227,11 @@ void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start,
  * drawing and doesn't interact at all with the buffer code above */
 
 /* Return false if VBO is either unavailable or disabled by the user,
-   true otherwise */
+ * true otherwise */
 static int gpu_vbo_enabled(void)
 {
 	return (GLEW_ARB_vertex_buffer_object &&
-			!(U.gameflags & USER_DISABLE_VBO));
+	        !(U.gameflags & USER_DISABLE_VBO));
 }
 
 /* Convenience struct for building the VBO. */
@@ -1316,6 +1273,9 @@ struct GPU_Buffers {
 	/* The PBVH ensures that either all faces in the node are
 	   smooth-shaded or all faces are flat-shaded */
 	int smooth;
+
+	int show_diffuse_color;
+	float diffuse_color[4];
 };
 typedef enum {
 	VBO_ENABLED,
@@ -1339,24 +1299,24 @@ static void gpu_colors_disable(VBO_State vbo_state)
 
 static float gpu_color_from_mask(float mask)
 {
-	return (1.0f - mask) * 0.5f + 0.25f;
+	return 1.0f - mask * 0.75f;
 }
 
-static void gpu_color_from_mask_copy(float mask, unsigned char out[3])
+static void gpu_color_from_mask_copy(float mask, const float diffuse_color[4], unsigned char out[3])
 {
-	unsigned char color;
-	
-	color = gpu_color_from_mask(mask) * 255.0f;
+	float mask_color;
+
+	mask_color = gpu_color_from_mask(mask) * 255.0f;
 
-	out[0] = color;
-	out[1] = color;
-	out[2] = color;
+	out[0] = diffuse_color[0] * mask_color;
+	out[1] = diffuse_color[1] * mask_color;
+	out[2] = diffuse_color[2] * mask_color;
 }
 
-static void gpu_color_from_mask_set(float mask)
+static void gpu_color_from_mask_set(float mask, float diffuse_color[4])
 {
 	float color = gpu_color_from_mask(mask);
-	glColor3f(color, color, color);
+	glColor3f(diffuse_color[0] * color, diffuse_color[1] * color, diffuse_color[2] * color);
 }
 
 static float gpu_color_from_mask_quad(const CCGKey *key,
@@ -1372,37 +1332,50 @@ static float gpu_color_from_mask_quad(const CCGKey *key,
 static void gpu_color_from_mask_quad_copy(const CCGKey *key,
                                           CCGElem *a, CCGElem *b,
                                           CCGElem *c, CCGElem *d,
+                                          const float *diffuse_color,
                                           unsigned char out[3])
 {
-	unsigned char color =
+	float mask_color =
 	    gpu_color_from_mask((*CCG_elem_mask(key, a) +
 	                         *CCG_elem_mask(key, b) +
 	                         *CCG_elem_mask(key, c) +
 	                         *CCG_elem_mask(key, d)) * 0.25f) * 255.0f;
 
-	out[0] = color;
-	out[1] = color;
-	out[2] = color;
+	out[0] = diffuse_color[0] * mask_color;
+	out[1] = diffuse_color[1] * mask_color;
+	out[2] = diffuse_color[2] * mask_color;
 }
 
 static void gpu_color_from_mask_quad_set(const CCGKey *key,
                                          CCGElem *a, CCGElem *b,
-                                         CCGElem *c, CCGElem *d)
+                                         CCGElem *c, CCGElem *d,
+                                         float diffuse_color[4])
 {
 	float color = gpu_color_from_mask_quad(key, a, b, c, d);
-	glColor3f(color, color, color);
+	glColor3f(diffuse_color[0] * color, diffuse_color[1] * color, diffuse_color[2] * color);
 }
 
 void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
-                             int *vert_indices, int totvert, const float *vmask)
+                             int *vert_indices, int totvert, const float *vmask,
+                             int (*face_vert_indices)[4], int show_diffuse_color)
 {
 	VertexBufferFormat *vert_data;
 	int i, j, k;
 
 	buffers->vmask = vmask;
+	buffers->show_diffuse_color = show_diffuse_color;
 
 	if (buffers->vert_buf) {
 		int totelem = (buffers->smooth ? totvert : (buffers->tot_tri * 3));
+		float diffuse_color[4] = {0.8f, 0.8f, 0.8f, 1.0f};
+
+		if (buffers->show_diffuse_color) {
+			MFace *f = buffers->mface + buffers->face_indices[0];
+
+			GPU_material_diffuse_get(f->mat_nr + 1, diffuse_color);
+		}
+
+		copy_v4_v4(buffers->diffuse_color, diffuse_color);
 
 		/* Build VBO */
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
@@ -1423,11 +1396,27 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 
 					copy_v3_v3(out->co, v->co);
 					memcpy(out->no, v->no, sizeof(short) * 3);
-					if (vmask) {
-						gpu_color_from_mask_copy(vmask[vert_indices[i]],
-												 out->color);
-					}
 				}
+
+#define UPDATE_VERTEX(face, vertex, index, diffuse_color) \
+				{ \
+					VertexBufferFormat *out = vert_data + face_vert_indices[face][index]; \
+					if (vmask) \
+						gpu_color_from_mask_copy(vmask[vertex], diffuse_color, out->color); \
+					else \
+						rgb_float_to_uchar(out->color, diffuse_color); \
+				} (void)0
+
+				for (i = 0; i < buffers->totface; i++) {
+					MFace *f = buffers->mface + buffers->face_indices[i];
+
+					UPDATE_VERTEX(i, f->v1, 0, diffuse_color);
+					UPDATE_VERTEX(i, f->v2, 1, diffuse_color);
+					UPDATE_VERTEX(i, f->v3, 2, diffuse_color);
+					if (f->v4)
+						UPDATE_VERTEX(i, f->v4, 3, diffuse_color);
+				}
+#undef UPDATE_VERTEX
 			}
 			else {
 				for (i = 0; i < buffers->totface; ++i) {
@@ -1439,6 +1428,9 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 
 					float fmask;
 
+					if (paint_is_face_hidden(f, mvert))
+						continue;
+
 					/* Face normal and mask */
 					if (f->v4) {
 						normal_quad_v3(fno,
@@ -1450,7 +1442,7 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 							fmask = (vmask[fv[0]] +
 									 vmask[fv[1]] +
 									 vmask[fv[2]] +
-									 vmask[fv[3]]) * 0.25;
+									 vmask[fv[3]]) * 0.25f;
 						}
 					}
 					else {
@@ -1473,8 +1465,11 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 
 							copy_v3_v3(out->co, v->co);
 							memcpy(out->no, no, sizeof(short) * 3);
+
 							if (vmask)
-								gpu_color_from_mask_copy(fmask, out->color);
+								gpu_color_from_mask_copy(fmask, diffuse_color, out->color);
+							else
+								rgb_float_to_uchar(out->color, diffuse_color);
 
 							vert_data++;
 						}
@@ -1508,6 +1503,8 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
 	buffers->index_type = GL_UNSIGNED_SHORT;
 	buffers->smooth = mface[face_indices[0]].flag & ME_SMOOTH;
 
+	buffers->show_diffuse_color = FALSE;
+
 	/* Count the number of visible triangles */
 	for (i = 0, tottri = 0; i < totface; ++i) {
 		const MFace *f = &mface[face_indices[i]];
@@ -1562,7 +1559,7 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
 	}
 
-	if (buffers->index_buf || !buffers->smooth)
+	if (gpu_vbo_enabled() && (buffers->index_buf || !buffers->smooth))
 		glGenBuffersARB(1, &buffers->vert_buf);
 
 	buffers->tot_tri = tottri;
@@ -1576,16 +1573,27 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
 
 void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids,
                              const DMFlagMat *grid_flag_mats, int *grid_indices,
-                             int totgrid, const CCGKey *key)
+                             int totgrid, const CCGKey *key, int show_diffuse_color)
 {
 	VertexBufferFormat *vert_data;
 	int i, j, k, x, y;
 
+	buffers->show_diffuse_color = show_diffuse_color;
+
 	/* Build VBO */
 	if (buffers->vert_buf) {
 		int totvert = key->grid_area * totgrid;
 		int smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH;
 		const int has_mask = key->has_mask;
+		float diffuse_color[4] = {0.8f, 0.8f, 0.8f, 1.0f};
+
+		if (buffers->show_diffuse_color) {
+			const DMFlagMat *flags = &grid_flag_mats[grid_indices[0]];
+
+			GPU_material_diffuse_get(flags->mat_nr + 1, diffuse_color);
+		}
+
+		copy_v4_v4(buffers->diffuse_color, diffuse_color);
 
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
 		glBufferDataARB(GL_ARRAY_BUFFER_ARB,
@@ -1603,12 +1611,11 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids,
 						
 						copy_v3_v3(vd->co, CCG_elem_co(key, elem));
 						if (smooth) {
-							normal_float_to_short_v3(vd->no,
-							                         CCG_elem_no(key, elem));
+							normal_float_to_short_v3(vd->no, CCG_elem_no(key, elem));
 
 							if (has_mask) {
 								gpu_color_from_mask_copy(*CCG_elem_mask(key, elem),
-								                         vd->color);
+								                         diffuse_color, vd->color);
 							}
 						}
 						vd++;
@@ -1644,6 +1651,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids,
 								                              elems[1],
 								                              elems[2],
 								                              elems[3],
+								                              diffuse_color,
 								                              vd->color);
 							}
 						}
@@ -1763,7 +1771,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
 
 	/* VBO is disabled; delete the previous buffer (if it exists) and
 	 * return an invalid handle */
-	if (gpu_vbo_enabled()) {
+	if (!gpu_vbo_enabled()) {
 		if (buffer)
 			glDeleteBuffersARB(1, &buffer);
 		return 0;
@@ -1812,6 +1820,8 @@ GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
 	buffers->grid_hidden = grid_hidden;
 	buffers->totgrid = totgrid;
 
+	buffers->show_diffuse_color = FALSE;
+
 	/* Count the number of quads */
 	totquad = gpu_count_grid_quads(grid_hidden, grid_indices, totgrid, gridsize);
 
@@ -1856,6 +1866,11 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
 	const MVert *mvert = buffers->mvert;
 	int i, j;
 	const int has_mask = (buffers->vmask != NULL);
+	const MFace *face = &buffers->mface[buffers->face_indices[0]];
+	float diffuse_color[4] = {0.8f, 0.8f, 0.8f, 1.0f};
+
+	if (buffers->show_diffuse_color)
+		GPU_material_diffuse_get(face->mat_nr + 1, diffuse_color);
 
 	if (has_mask) {
 		gpu_colors_enable(VBO_DISABLED);
@@ -1874,7 +1889,7 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
 		if (buffers->smooth) {
 			for (j = 0; j < S; j++) {
 				if (has_mask) {
-					gpu_color_from_mask_set(buffers->vmask[fv[j]]);
+					gpu_color_from_mask_set(buffers->vmask[fv[j]], diffuse_color);
 				}
 				glNormal3sv(mvert[fv[j]].no);
 				glVertex3fv(mvert[fv[j]].co);
@@ -1900,10 +1915,10 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
 				         buffers->vmask[fv[1]] +
 				         buffers->vmask[fv[2]]);
 				if (f->v4)
-					fmask = (fmask + buffers->vmask[fv[3]]) * 0.25;
+					fmask = (fmask + buffers->vmask[fv[3]]) * 0.25f;
 				else
 					fmask /= 3.0f;
-				gpu_color_from_mask_set(fmask);
+				gpu_color_from_mask_set(fmask, diffuse_color);
 			}
 			
 			for (j = 0; j < S; j++)
@@ -1923,6 +1938,11 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 	const CCGKey *key = &buffers->gridkey;
 	int i, j, x, y, gridsize = buffers->gridkey.grid_size;
 	const int has_mask = key->has_mask;
+	const DMFlagMat *flags = &buffers->grid_flag_mats[buffers->grid_indices[0]];
+	float diffuse_color[4] = {0.8f, 0.8f, 0.8f, 1.0f};
+
+	if (buffers->show_diffuse_color)
+		GPU_material_diffuse_get(flags->mat_nr + 1, diffuse_color);
 
 	if (has_mask) {
 		gpu_colors_enable(VBO_DISABLED);
@@ -1954,7 +1974,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 					if (buffers->smooth) {
 						for (j = 0; j < 4; j++) {
 							if (has_mask) {
-								gpu_color_from_mask_set(*CCG_elem_mask(key, e[j]));
+								gpu_color_from_mask_set(*CCG_elem_mask(key, e[j]), diffuse_color);
 							}
 							glNormal3fv(CCG_elem_no(key, e[j]));
 							glVertex3fv(CCG_elem_co(key, e[j]));
@@ -1970,7 +1990,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 						glNormal3fv(fno);
 
 						if (has_mask) {
-							gpu_color_from_mask_quad_set(key, e[0], e[1], e[2], e[3]);
+							gpu_color_from_mask_quad_set(key, e[0], e[1], e[2], e[3], diffuse_color);
 						}
 
 						for (j = 0; j < 4; j++)
@@ -1989,12 +2009,12 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 					CCGElem *b = CCG_grid_elem(key, grid, x, y + 1);
 
 					if (has_mask) {
-						gpu_color_from_mask_set(*CCG_elem_mask(key, a));
+						gpu_color_from_mask_set(*CCG_elem_mask(key, a), diffuse_color);
 					}
 					glNormal3fv(CCG_elem_no(key, a));
 					glVertex3fv(CCG_elem_co(key, a));
 					if (has_mask) {
-						gpu_color_from_mask_set(*CCG_elem_mask(key, b));
+						gpu_color_from_mask_set(*CCG_elem_mask(key, b), diffuse_color);
 					}
 					glNormal3fv(CCG_elem_no(key, b));
 					glVertex3fv(CCG_elem_co(key, b));
@@ -2022,7 +2042,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 						glNormal3fv(fno);
 
 						if (has_mask) {
-							gpu_color_from_mask_quad_set(key, a, b, c, d);
+							gpu_color_from_mask_quad_set(key, a, b, c, d, diffuse_color);
 						}
 					}
 
@@ -2041,8 +2061,6 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
 
 void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 {
-	const int has_mask = (buffers->vmask || buffers->gridkey.has_mask);
-
 	if (buffers->totface) {
 		const MFace *f = &buffers->mface[buffers->face_indices[0]];
 		if (!setMaterial(f->mat_nr + 1, NULL))
@@ -2059,13 +2077,7 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 	if (buffers->vert_buf) {
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glEnableClientState(GL_NORMAL_ARRAY);
-		if (has_mask) {
-			gpu_colors_enable(VBO_ENABLED);
-		}
-		else {
-			gpu_colors_enable(VBO_DISABLED);
-			glColor4ub(0xff, 0xff, 0xff, 0xff);
-		}
+		gpu_colors_enable(VBO_ENABLED);
 
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
 
@@ -2080,10 +2092,8 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 				                offset + offsetof(VertexBufferFormat, co));
 				glNormalPointer(GL_SHORT, sizeof(VertexBufferFormat),
 				                offset + offsetof(VertexBufferFormat, no));
-				if (has_mask) {
-					glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VertexBufferFormat),
-					               offset + offsetof(VertexBufferFormat, color));
-				}
+				glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VertexBufferFormat),
+				               offset + offsetof(VertexBufferFormat, color));
 				
 				glDrawElements(GL_QUADS, buffers->tot_quad * 4, buffers->index_type, 0);
 
@@ -2097,10 +2107,8 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 			                (void *)offsetof(VertexBufferFormat, co));
 			glNormalPointer(GL_SHORT, sizeof(VertexBufferFormat),
 			                (void *)offsetof(VertexBufferFormat, no));
-			if (has_mask) {
-				glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VertexBufferFormat),
-				               (void *)offsetof(VertexBufferFormat, color));
-			}
+			glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VertexBufferFormat),
+			               (void *)offsetof(VertexBufferFormat, color));
 
 			if (buffers->index_buf)
 				glDrawElements(GL_TRIANGLES, totelem, buffers->index_type, 0);
@@ -2114,12 +2122,7 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 
 		glDisableClientState(GL_VERTEX_ARRAY);
 		glDisableClientState(GL_NORMAL_ARRAY);
-		if (has_mask) {
-			gpu_colors_disable(VBO_ENABLED);
-		}
-		else {
-			gpu_colors_disable(VBO_DISABLED);
-		}
+		gpu_colors_disable(VBO_ENABLED);
 	}
 	/* fallbacks if we are out of memory or VBO is disabled */
 	else if (buffers->totface) {
@@ -2130,6 +2133,32 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
 	}
 }
 
+int GPU_buffers_diffuse_changed(GPU_Buffers *buffers, int show_diffuse_color)
+{
+	float diffuse_color[4];
+
+	if (buffers->show_diffuse_color != show_diffuse_color)
+		return TRUE;
+
+	if (buffers->show_diffuse_color == FALSE)
+		return FALSE;
+
+	if (buffers->mface) {
+		MFace *f = buffers->mface + buffers->face_indices[0];
+
+		GPU_material_diffuse_get(f->mat_nr + 1, diffuse_color);
+	}
+	else {
+		const DMFlagMat *flags = &buffers->grid_flag_mats[buffers->grid_indices[0]];
+
+		GPU_material_diffuse_get(flags->mat_nr + 1, diffuse_color);
+	}
+
+	return diffuse_color[0] != buffers->diffuse_color[0] ||
+	       diffuse_color[1] != buffers->diffuse_color[1] ||
+	       diffuse_color[2] != buffers->diffuse_color[2];
+}
+
 void GPU_free_buffers(GPU_Buffers *buffers)
 {
 	if (buffers) {
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 25990e8..4432627 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -761,7 +761,7 @@ void GPU_pass_bind(GPUPass *pass, double time, int mipmap)
 	/* now bind the textures */
 	for (input=inputs->first; input; input=input->next) {
 		if (input->ima)
-			input->tex = GPU_texture_from_blender(input->ima, input->iuser, input->imagencd, time, mipmap);
+			input->tex = GPU_texture_from_blender(input->ima, input->iuser, input->image_isdata, time, mipmap);
 
 		if (input->tex && input->bindtex) {
 			GPU_texture_bind(input->tex, input->texid);
@@ -917,7 +917,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 
 		input->ima = link->ptr1;
 		input->iuser = link->ptr2;
-		input->imagencd = link->imagencd;
+		input->image_isdata = link->image_isdata;
 		input->textarget = GL_TEXTURE_2D;
 		input->textype = GPU_TEX2D;
 		MEM_freeN(link);
@@ -1046,17 +1046,20 @@ static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *a
 					}
 				}
 
-				if (a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
-					input->attribid = attribs->totlayer++;
-					input->attribfirst = 1;
+				if (a < GPU_MAX_ATTRIB) {
+					if (a == attribs->totlayer) {
+						input->attribid = attribs->totlayer++;
+						input->attribfirst = 1;
 
-					attribs->layer[a].type = input->attribtype;
-					attribs->layer[a].attribid = input->attribid;
-					BLI_strncpy(attribs->layer[a].name, input->attribname,
-						sizeof(attribs->layer[a].name));
+						attribs->layer[a].type = input->attribtype;
+						attribs->layer[a].attribid = input->attribid;
+						BLI_strncpy(attribs->layer[a].name, input->attribname,
+						            sizeof(attribs->layer[a].name));
+					}
+					else {
+						input->attribid = attribs->layer[a].attribid;
+					}
 				}
-				else
-					input->attribid = attribs->layer[a].attribid;
 			}
 		}
 	}
@@ -1110,14 +1113,14 @@ GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data)
 	return link;
 }
 
-GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, int ncd)
+GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, int isdata)
 {
 	GPUNodeLink *link = GPU_node_link_create(0);
 
 	link->image= 1;
 	link->ptr1= ima;
 	link->ptr2= iuser;
-	link->imagencd= ncd;
+	link->image_isdata= isdata;
 
 	return link;
 }
@@ -1145,15 +1148,6 @@ GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, int dynamictype, void *data)
 	return link;
 }
 
-GPUNodeLink *GPU_socket(GPUNodeStack *sock)
-{
-	GPUNodeLink *link = GPU_node_link_create(0);
-
-	link->socket= sock;
-
-	return link;
-}
-
 GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
 {
 	GPUNodeLink *link = GPU_node_link_create(0);
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 3010937..f61f349 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -91,7 +91,7 @@ struct GPUNodeLink {
 	const char *attribname;
 
 	int image;
-	int imagencd;
+	int image_isdata;
 
 	int texture;
 	int texturesize;
@@ -99,7 +99,7 @@ struct GPUNodeLink {
 	void *ptr1, *ptr2;
 
 	int dynamic;
-	int dynamictype;	
+	int dynamictype;
 
 	int type;
 	int users;
@@ -138,7 +138,7 @@ typedef struct GPUInput {
 
 	struct Image *ima;		/* image */
 	struct ImageUser *iuser;/* image user */
-	int imagencd;			/* image does not contain color data */
+	int image_isdata;		/* image does not contain color data */
 	float *dynamicvec;		/* vector data in case it is dynamic */
 	int dynamictype;		/* origin of the dynamic uniform (GPUDynamicType) */
 	void *dynamicdata;		/* data source of the dynamic uniform */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 956c76a..d466e59 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -318,7 +318,7 @@ static void gpu_make_repbind(Image *ima)
 {
 	ImBuf *ibuf;
 	
-	ibuf = BKE_image_get_ibuf(ima, NULL);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	if (ibuf==NULL)
 		return;
 
@@ -333,6 +333,8 @@ static void gpu_make_repbind(Image *ima)
 
 	if (ima->totbind>1)
 		ima->repbind= MEM_callocN(sizeof(int)*ima->totbind, "repbind");
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 static void gpu_clear_tpage(void)
@@ -422,7 +424,7 @@ static void gpu_verify_reflection(Image *ima)
 	}
 }
 
-int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, int ncd)
+int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, int is_data)
 {
 	ImBuf *ibuf = NULL;
 	unsigned int *bind = NULL;
@@ -479,7 +481,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 		return 0;
 
 	/* check if we have a valid image buffer */
-	ibuf= BKE_image_get_ibuf(ima, iuser);
+	ibuf= BKE_image_acquire_ibuf(ima, iuser, NULL);
 
 	if (ibuf==NULL)
 		return 0;
@@ -492,7 +494,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 		}
 
 		/* TODO unneeded when float images are correctly treated as linear always */
-		if (!ncd)
+		if (!is_data)
 			do_color_management = TRUE;
 
 		if (ibuf->rect==NULL)
@@ -574,6 +576,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 	if (*bind != 0) {
 		/* enable opengl drawing with textures */
 		glBindTexture(GL_TEXTURE_2D, *bind);
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 		return *bind;
 	}
 
@@ -611,12 +614,21 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 			rect= tilerect;
 		}
 	}
+
 #ifdef WITH_DDS
 	if (ibuf->ftype & DDS)
 		GPU_create_gl_tex_compressed(bind, rect, rectw, recth, mipmap, ima, ibuf);
 	else
 #endif
 		GPU_create_gl_tex(bind, rect, frect, rectw, recth, mipmap, use_high_bit_depth, ima);
+	
+	/* mark as non-color data texture */
+	if (*bind) {
+		if (is_data)
+			ima->tpageflag |= IMA_GLBIND_IS_DATA;	
+		else
+			ima->tpageflag &= ~IMA_GLBIND_IS_DATA;	
+	}
 
 	/* clean up */
 	if (tilerect)
@@ -626,6 +638,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 	if (srgb_frect)
 		MEM_freeN(srgb_frect);
 
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	return *bind;
 }
 
@@ -713,8 +727,8 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
 	GLint format = 0;
 	int blocksize, height, width, i, size, offset = 0;
 
-	height = ibuf->x;
-	width = ibuf->y;
+	width = ibuf->x;
+	height = ibuf->y;
 
 	if (GLEW_EXT_texture_compression_s3tc) {
 		if (ibuf->dds_data.fourcc == FOURCC_DXT1)
@@ -730,12 +744,17 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
 		return FALSE;
 	}
 
+	if (!is_power_of_2_i(width) || !is_power_of_2_i(height)) {
+		printf("Unable to load non-power-of-two DXT image resolution, falling back to uncompressed\n");
+		return FALSE;
+	}
+
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 
-	blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
+	blocksize = (ibuf->dds_data.fourcc == FOURCC_DXT1) ? 8 : 16;
 	for (i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) {
 		if (width == 0)
 			width = 1;
@@ -882,7 +901,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
 {
 	ImBuf *ibuf;
 	
-	ibuf = BKE_image_get_ibuf(ima, NULL);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
 	
 	if (ima->repbind || (GPU_get_mipmap() && !GTS.gpu_mipmap) || !ima->bindcode || !ibuf ||
 	    (!is_power_of_2_i(ibuf->x) || !is_power_of_2_i(ibuf->y)) ||
@@ -903,7 +922,8 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
 		/* if color correction is needed, we must update the part that needs updating. */
 		if (ibuf->rect_float) {
 			float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf");
-			IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h);
+			int is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA);
+			IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data);
 
 			glBindTexture(GL_TEXTURE_2D, ima->bindcode);
 			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
@@ -920,6 +940,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
 				ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
 			}
 
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 			return;
 		}
 		
@@ -929,12 +950,8 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
 		glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
 		glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
 
-		if (ibuf->rect_float)
-			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
-				GL_FLOAT, ibuf->rect_float);
-		else
-			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
-				GL_UNSIGNED_BYTE, ibuf->rect);
+		glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
+			GL_UNSIGNED_BYTE, ibuf->rect);
 
 		glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
 		glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
@@ -948,6 +965,8 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
 			ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
 		}
 	}
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 void GPU_update_images_framechange(void)
@@ -1019,21 +1038,53 @@ void GPU_free_smoke(SmokeModifierData *smd)
 		if (smd->domain->tex_shadow)
 			GPU_texture_free(smd->domain->tex_shadow);
 		smd->domain->tex_shadow = NULL;
+
+		if (smd->domain->tex_flame)
+			GPU_texture_free(smd->domain->tex_flame);
+		smd->domain->tex_flame = NULL;
 	}
 }
 
 void GPU_create_smoke(SmokeModifierData *smd, int highres)
 {
 #ifdef WITH_SMOKE
-	if (smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && !highres)
-		smd->domain->tex = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smoke_get_density(smd->domain->fluid));
-	else if (smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && highres)
-		smd->domain->tex = GPU_texture_create_3D(smd->domain->res_wt[0], smd->domain->res_wt[1], smd->domain->res_wt[2], smoke_turbulence_get_density(smd->domain->wt));
+	if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+		SmokeDomainSettings *sds = smd->domain;
+		if (!sds->tex && !highres) {
+			/* rgba texture for color + density */
+			if (smoke_has_colors(sds->fluid)) {
+				float *data = MEM_callocN(sizeof(float)*sds->total_cells*4, "smokeColorTexture");
+				smoke_get_rgba(sds->fluid, data, 0);
+				sds->tex = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 4, data);
+				MEM_freeN(data);
+			}
+			/* density only */
+			else {
+				sds->tex = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, smoke_get_density(sds->fluid));
+			}
+			sds->tex_flame = (smoke_has_fuel(sds->fluid)) ? GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, smoke_get_flame(sds->fluid)) : NULL;
+		}
+		else if (!sds->tex && highres) {
+			/* rgba texture for color + density */
+			if (smoke_turbulence_has_colors(sds->wt)) {
+				float *data = MEM_callocN(sizeof(float)*smoke_turbulence_get_cells(sds->wt)*4, "smokeColorTexture");
+				smoke_turbulence_get_rgba(sds->wt, data, 0);
+				sds->tex = GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 4, data);
+				MEM_freeN(data);
+			}
+			/* density only */
+			else {
+				sds->tex = GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 1, smoke_turbulence_get_density(sds->wt));
+			}
+			sds->tex_flame = (smoke_turbulence_has_fuel(sds->wt)) ? GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 1, smoke_turbulence_get_flame(sds->wt)) : NULL;
+		}
 
-	smd->domain->tex_shadow = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smd->domain->shadow);
+		sds->tex_shadow = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, sds->shadow);
+	}
 #else // WITH_SMOKE
 	(void)highres;
 	smd->domain->tex= NULL;
+	smd->domain->tex_flame= NULL;
 	smd->domain->tex_shadow= NULL;
 #endif // WITH_SMOKE
 }
@@ -1098,7 +1149,7 @@ void GPU_free_image(Image *ima)
 		ima->repbind= NULL;
 	}
 
-	ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+	ima->tpageflag &= ~(IMA_MIPMAP_COMPLETE|IMA_GLBIND_IS_DATA);
 }
 
 void GPU_free_images(void)
@@ -1184,7 +1235,7 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
 		if (gamma) {
 			linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
 			linearrgb_to_srgb_v3_v3(smat->spec, smat->spec);
-		}	
+		}
 	}
 }
 
@@ -1437,6 +1488,21 @@ void GPU_disable_material(void)
 	GPU_set_material_alpha_blend(GPU_BLEND_SOLID);
 }
 
+void GPU_material_diffuse_get(int nr, float diff[4])
+{
+	/* prevent index to use un-initialized array items */
+	if (nr >= GMS.totmat)
+		nr = 0;
+
+	/* no GPU_begin_object_materials, use default material */
+	if (!GMS.matbuf) {
+		mul_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit);
+	}
+	else {
+		copy_v4_v4(diff, GMS.matbuf[nr].diff);
+	}
+}
+
 void GPU_end_object_materials(void)
 {
 	GPU_disable_material();
@@ -1595,7 +1661,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 		glLightfv(GL_LIGHT0+count, GL_SPECULAR, energy);
 		glEnable(GL_LIGHT0+count);
 		
-		glPopMatrix();					
+		glPopMatrix();
 		
 		count++;
 		if (count==8)
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index c5f427f..7a0ac29 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -253,6 +253,9 @@ static void GPU_print_framebuffer_error(GLenum status, char err_out[256])
 	switch (status) {
 		case GL_FRAMEBUFFER_COMPLETE_EXT:
 			break;
+		case GL_INVALID_OPERATION:
+			err= "Invalid operation";
+			break;
 		case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
 			err= "Incomplete attachment";
 			break;
@@ -442,7 +445,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
 }
 
 
-GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
+GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels)
 {
 	GPUTexture *tex;
 	GLenum type, format, internalformat;
@@ -480,9 +483,15 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
 
 	GPU_print_error("3D glBindTexture");
 
-	type = GL_FLOAT; // GL_UNSIGNED_BYTE
-	format = GL_RED;
-	internalformat = GL_INTENSITY;
+	type = GL_FLOAT;
+	if (channels == 4) {
+		format = GL_RGBA;
+		internalformat = GL_RGBA;
+	}
+	else {
+		format = GL_RED;
+		internalformat = GL_INTENSITY;
+	}
 
 	//if (fpixels)
 	//	pixels = GPU_texture_convert_pixels(w*h*depth, fpixels);
@@ -522,7 +531,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
 	return tex;
 }
 
-GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int ncd, double time, int mipmap)
+GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int isdata, double time, int mipmap)
 {
 	GPUTexture *tex;
 	GLint w, h, border, lastbindcode, bindcode;
@@ -530,7 +539,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int ncd, doub
 	glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
 
 	GPU_update_image_time(ima, time);
-	bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap, ncd);
+	bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap, isdata);
 
 	if (ima->gputexture) {
 		ima->gputexture->bindcode = bindcode;
@@ -748,6 +757,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
 {
 	GLenum status;
 	GLenum attachment;
+	GLenum error;
 
 	if (tex->depth)
 		attachment = GL_DEPTH_ATTACHMENT_EXT;
@@ -760,6 +770,14 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
 	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, 
 		tex->target, tex->bindcode, 0);
 
+	error = glGetError();
+
+	if (error == GL_INVALID_OPERATION) {
+		GPU_framebuffer_restore();
+		GPU_print_framebuffer_error(error, err_out);
+		return 0;
+	}
+
 	if (tex->depth) {
 		glDrawBuffer(GL_NONE);
 		glReadBuffer(GL_NONE);
@@ -1289,7 +1307,7 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
 	return retval;
 }
 
-void GPU_shader_free_builtin_shaders()
+void GPU_shader_free_builtin_shaders(void)
 {
 	if (GG.shaders.vsm_store) {
 		MEM_freeN(GG.shaders.vsm_store);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index e035f1c..9c48f74 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -780,7 +780,9 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 		}
 	}
 
-	if (mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
+	if (mat->scene->gm.flag & GAME_GLSL_NO_SHADERS) {
+		/* pass */
+	}
 	else if (!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
 	         (GPU_link_changed(shi->spec) || ma->spec != 0.0f))
 	{
@@ -1127,7 +1129,7 @@ static void do_material_tex(GPUShadeInput *shi)
 							newnor = tnor;
 						}
 						
-						norfac = minf(fabsf(mtex->norfac), 1.0f);
+						norfac = min_ff(fabsf(mtex->norfac), 1.0f);
 						
 						if (norfac == 1.0f && !GPU_link_changed(stencil)) {
 							shi->vn = newnor;
@@ -1163,13 +1165,14 @@ static void do_material_tex(GPUShadeInput *shi)
 
 						// resolve texture resolution
 						if ( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) {
-							ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser);
+							ImBuf *ibuf= BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
 							ima_x= 512.0f; ima_y= 512.f;		// prevent calling textureSize, glsl 1.3 only
 							if (ibuf) {
 								ima_x= ibuf->x;
 								ima_y= ibuf->y;
 								aspect = ((float) ima_y) / ima_x;
 							}
+							BKE_image_release_ibuf(tex->ima, ibuf, NULL);
 						}
 
 						// The negate on norfac is done because the
@@ -1494,6 +1497,16 @@ static GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma)
 	return shr.combined;
 }
 
+static GPUNodeLink *gpu_material_diffuse_bsdf(GPUMaterial *mat, Material *ma)
+{
+	static float roughness = 0.0f;
+	GPUNodeLink *outlink;
+
+	GPU_link(mat, "node_bsdf_diffuse", GPU_uniform(&ma->r), GPU_uniform(&roughness), GPU_builtin(GPU_VIEW_NORMAL), &outlink);
+
+	return outlink;
+}
+
 GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
 {
 	GPUMaterial *mat;
@@ -1513,8 +1526,15 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
 		ntreeGPUMaterialNodes(ma->nodetree, mat);
 	}
 	else {
-		/* create material */
-		outlink = GPU_blender_material(mat, ma);
+		if(BKE_scene_use_new_shading_nodes(scene)) {
+			/* create simple diffuse material instead of nodes */
+			outlink = gpu_material_diffuse_bsdf(mat, ma);
+		}
+		else {
+			/* create blender material */
+			outlink = GPU_blender_material(mat, ma);
+		}
+
 		GPU_material_output_link(mat, outlink);
 	}
 
@@ -1587,8 +1607,8 @@ void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float a
 
 void GPU_lamp_update_spot(GPULamp *lamp, float spotsize, float spotblend)
 {
-	lamp->spotsi= cos(M_PI*spotsize/360.0);
-	lamp->spotbl= (1.0f - lamp->spotsi)*spotblend;
+	lamp->spotsi= cosf((float)M_PI * spotsize / 360.0f);
+	lamp->spotbl= (1.0f - lamp->spotsi) * spotblend;
 }
 
 static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *la, GPULamp *lamp)
@@ -1879,7 +1899,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 		GPUBuiltin gputype;
 		GPUDynamicType dynamictype;
 		GPUDataType datatype;
-	} builtins[] = { 
+	} builtins[] = {
 		{ GPU_VIEW_MATRIX, GPU_DYNAMIC_OBJECT_VIEWMAT, GPU_DATA_16F },
 		{ GPU_INVERSE_VIEW_MATRIX, GPU_DYNAMIC_OBJECT_VIEWIMAT, GPU_DATA_16F },
 		{ GPU_OBJECT_MATRIX, GPU_DYNAMIC_OBJECT_MAT, GPU_DATA_16F },
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 81c3cab..9a238e9 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -4,6 +4,21 @@ float exp_blender(float f)
 	return pow(2.71828182846, f);
 }
 
+float compatible_pow(float x, float y)
+{
+	/* glsl pow doesn't accept negative x */
+	if(x < 0.0) {
+		if(mod(-y, 2.0) == 0.0)
+			return pow(-x, y);
+		else
+			return -pow(-x, y);
+	}
+	else if(x == 0.0)
+		return 0.0;
+
+	return pow(x, y);
+}
+
 void rgb_to_hsv(vec4 rgb, out vec4 outcol)
 {
 	float cmax, cmin, h, s, v, cdelta;
@@ -212,10 +227,17 @@ void math_atan(float val, out float outval)
 
 void math_pow(float val1, float val2, out float outval)
 {
-	if (val1 >= 0.0)
-		outval = pow(val1, val2);
-	else
-		outval = 0.0;
+	if (val1 >= 0.0) {
+		outval = compatible_pow(val1, val2);
+	}
+	else {
+		float val2_mod_1 = mod(abs(val2), 1.0);
+
+	 	if (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)
+			outval = compatible_pow(val1, floor(val2 + 0.5));
+		else
+			outval = 0.0;
+	}
 }
 
 void math_log(float val1, float val2, out float outval)
@@ -1894,7 +1916,7 @@ void test_shadowbuf_vsm(vec3 rco, sampler2D shadowmap, mat4 shadowpersmat, float
 		}
 		else {
 			result = 1.0;
-		}			
+		}
 	}
 }
 
@@ -1992,7 +2014,7 @@ void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result)
 	result = vec4(L*color.rgb, 1.0);
 }
 
-void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 result)
+void node_bsdf_glossy(vec4 color, float roughness, vec3 N, out vec4 result)
 {
 	/* ambient light */
 	vec3 L = vec3(0.2);
@@ -2013,12 +2035,12 @@ void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 resu
 	result = vec4(L*color.rgb, 1.0);
 }
 
-void node_bsdf_anisotropic(vec4 color, float roughnessU, float roughnessV, vec3 N, vec3 I, out vec4 result)
+void node_bsdf_anisotropic(vec4 color, float roughness, float anisotropy, float rotation, vec3 N, vec3 T, out vec4 result)
 {
 	node_bsdf_diffuse(color, 0.0, N, result);
 }
 
-void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, vec3 I, out vec4 result)
+void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, out vec4 result)
 {
 	node_bsdf_diffuse(color, 0.0, N, result);
 }
@@ -2195,7 +2217,8 @@ void node_light_path(
 	out float is_glossy_ray,
 	out float is_singular_ray,
 	out float is_reflection_ray,
-	out float is_transmission_ray)
+	out float is_transmission_ray,
+	out float ray_length)
 {
 	is_camera_ray = 1.0;
 	is_shadow_ray = 0.0;
@@ -2204,6 +2227,7 @@ void node_light_path(
 	is_singular_ray = 0.0;
 	is_reflection_ray = 0.0;
 	is_transmission_ray = 0.0;
+	ray_length = 1.0;
 }
 
 void node_light_falloff(float strength, float tsmooth, out float quadratic, out float linear, out float constant)
@@ -2221,6 +2245,10 @@ void node_object_info(out vec3 location, out float object_index, out float mater
 	random = 0.0;
 }
 
+void node_bump(float strength, float height, vec3 N, out vec3 result)
+{
+	result = N;
+}
 
 /* output */
 
diff --git a/source/blender/gpu/shaders/gpu_shader_vertex.glsl b/source/blender/gpu/shaders/gpu_shader_vertex.glsl
index a86431b..574455e 100644
--- a/source/blender/gpu/shaders/gpu_shader_vertex.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_vertex.glsl
@@ -10,3 +10,11 @@ void main()
 	varnormal = normalize(gl_NormalMatrix * gl_Normal);
 	gl_Position = gl_ProjectionMatrix * co;
 
+	// Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA graphic cards.
+	// gl_ClipVertex works only on NVIDIA graphic cards so we have to check with 
+	// __GLSL_CG_DATA_TYPES if a NVIDIA graphic card is used (Cg support).
+	// gl_ClipVerte is supported up to GLSL 1.20.
+	#ifdef __GLSL_CG_DATA_TYPES 
+		gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; 
+	#endif 
+
diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h
index 4fc273b..95b1daf 100644
--- a/source/blender/ikplugin/BIK_api.h
+++ b/source/blender/ikplugin/BIK_api.h
@@ -58,7 +58,7 @@ struct BIK_ParamValue {
 		float f[8];
 		int   i[8];
 		char  s[32];
-	} value;		
+	} value;
 };
 typedef struct BIK_ParamValue BIK_ParamValue;
 
diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index 903267c..0a0e0e6 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -56,9 +56,11 @@ endif()
 if(WITH_IK_ITASC)
 	add_definitions(-DWITH_IK_ITASC)
 	list(APPEND INC
-		../../../extern/Eigen3
 		../../../intern/itasc
 	)
+	list(APPEND INC_SYS
+		../../../extern/Eigen3
+	)
 	list(APPEND SRC
 		intern/itasc_plugin.cpp
 		intern/itasc_plugin.h
diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c
index 08d2789..507d54d 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.c
+++ b/source/blender/ikplugin/intern/ikplugin_api.c
@@ -79,12 +79,14 @@ static IKPlugin ikplugin_tab[] = {
 		itasc_update_param,
 		itasc_test_constraint,
 	},
-	#endif
+#endif
+
+	{ NULL }
 };
 
 static IKPlugin *get_plugin(bPose *pose)
 {
-	if (!pose || pose->iksolver < 0 || pose->iksolver >= (sizeof(ikplugin_tab) / sizeof(IKPlugin)))
+	if (!pose || pose->iksolver < 0 || pose->iksolver > (sizeof(ikplugin_tab) / sizeof(IKPlugin) - 2))
 		return NULL;
 
 	return &ikplugin_tab[pose->iksolver];
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index af15333..ca81f4c 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -379,6 +379,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 
 		copy_v3_v3(goalpos, goal[3]);
 		copy_m3_m4(goalrot, goal);
+		normalize_m3(goalrot);
 
 		/* same for pole vector target */
 		if (data->poletar) {
@@ -433,7 +434,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 
 		iktarget = iktree[target->tip];
 
-		if (data->weight != 0.0f) {
+		if ((data->flag & CONSTRAINT_IK_POS) && data->weight != 0.0f) {
 			if (poleconstrain)
 				IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos,
 				                                 polepos, data->poleangle, (poleangledata == data));
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index c929c97..903080d 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1253,7 +1253,7 @@ static IK_Scene *convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
 			ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]);
 			const float ikstretch = pchan->ikstretch * pchan->ikstretch;
 			/* why invert twice here? */
-			weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - 0.001f));
+			weight[1] = (1.0 - min_ff(1.0 - ikstretch, 1.0f - 0.001f));
 			weights.push_back(weight[1]);
 		}
 		if (!ret)
@@ -1636,7 +1636,7 @@ static void execute_scene(Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, fl
 	// compute constraint error
 	for (i = ikscene->targets.size(); i > 0; --i) {
 		IK_Target *iktarget = ikscene->targets[i - 1];
-		if (!(iktarget->blenderConstraint->flag & CONSTRAINT_OFF)) {
+		if (!(iktarget->blenderConstraint->flag & CONSTRAINT_OFF) && iktarget->constraint) {
 			unsigned int nvalues;
 			const iTaSC::ConstraintValues *values;
 			values = iktarget->constraint->getControlParameters(&nvalues);
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 344ae60..29ed8c9 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -81,25 +81,6 @@ set(SRC
 	intern/IMB_indexer.h
 	intern/IMB_metadata.h
 	intern/imbuf.h
-	intern/cineon/cin_debug_stuff.h
-	intern/cineon/cineonfile.h
-	intern/cineon/cineonlib.h
-	intern/cineon/dpxfile.h
-	intern/cineon/dpxlib.h
-	intern/cineon/logImageCore.h
-	intern/cineon/logImageLib.h
-	intern/cineon/logmemfile.h
-	intern/dds/BlockDXT.h
-	intern/dds/Color.h
-	intern/dds/ColorBlock.h
-	intern/dds/Common.h
-	intern/dds/DirectDrawSurface.h
-	intern/dds/Image.h
-	intern/dds/PixelFormat.h
-	intern/dds/Stream.h
-	intern/dds/dds_api.h
-	intern/openexr/openexr_api.h
-	intern/openexr/openexr_multi.h
 	
 	# orphan include
 	../../../intern/ffmpeg/ffmpeg_compat.h
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index e260424..0653956 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -130,7 +130,8 @@ void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, i
 void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_buffer, const unsigned char *buffer_byte,
                                        int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings,
                                        const struct ColorManagedDisplaySettings *display_settings,
-                                       int xmin, int ymin, int xmax, int ymax);
+                                       int xmin, int ymin, int xmax, int ymax,
+                                       int update_orig_byte_buffer);
 
 /* ** Pixel processor functions ** */
 struct ColormanageProcessor *IMB_colormanagement_display_processor_new(const struct ColorManagedViewSettings *view_settings,
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 28dbe11..d0ac71a 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -103,7 +103,7 @@ struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags,
  *
  * \attention Defined in readimage.c
  */
-struct ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
+struct ImBuf *IMB_testiffname(const char *filepath, int flags);
 
 /**
  *
@@ -371,7 +371,7 @@ void IMB_interlace(struct ImBuf *ibuf);
 void IMB_rect_from_float(struct ImBuf *ibuf);
 /* Create char buffer for part of the image, color corrected if necessary,
  * Changed part will be stored in buffer. This is expected to be used for texture painting updates */
-void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h);
+void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data);
 void IMB_float_from_rect(struct ImBuf *ibuf);
 void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
 /* note, check that the conversion exists, only some are supported */
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 76c247b..28e62d4 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -93,7 +93,7 @@ typedef struct ImBuf {
 	/* tiled pixel storage */
 	int tilex, tiley;
 	int xtiles, ytiles;
-	unsigned int **tiles;	
+	unsigned int **tiles;
 
 	/* zbuffer */
 	int	*zbuf;				/* z buffer data, original zbuffer */
@@ -200,6 +200,10 @@ typedef struct ImBuf {
 #ifdef WITH_CINEON
 #define CINEON			(1 << 21)
 #define DPX				(1 << 20)
+#define CINEON_LOG		(1 << 8)
+#define CINEON_16BIT	(1 << 7)
+#define CINEON_12BIT	(1 << 6)
+#define CINEON_10BIT	(1 << 5)
 #endif
 
 #ifdef WITH_DDS
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h
index 56a0312..68ad480 100644
--- a/source/blender/imbuf/intern/IMB_filetype.h
+++ b/source/blender/imbuf/intern/IMB_filetype.h
@@ -97,13 +97,13 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, size_t size, int flags, cha
 short imb_cocoaSaveImage(struct ImBuf *ibuf, const char *name, int flags);
 
 /* cineon */
-int imb_savecineon(struct ImBuf *buf, const char *name, int flags);
-struct ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]);
+int imb_save_cineon(struct ImBuf *buf, const char *name, int flags);
+struct ImBuf *imb_load_cineon(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]);
 int imb_is_cineon(unsigned char *buf);
 
 /* dpx */
 int imb_save_dpx(struct ImBuf *buf, const char *name, int flags);
-struct ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]);
+struct ImBuf *imb_load_dpx(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]);
 int imb_is_dpx(unsigned char *buf);
 
 /* hdr */
diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h
index 1881692..9c95531 100644
--- a/source/blender/imbuf/intern/IMB_indexer.h
+++ b/source/blender/imbuf/intern/IMB_indexer.h
@@ -72,7 +72,7 @@ typedef struct anim_index_builder {
 	char name[FILE_MAX];
 	char temp_name[FILE_MAX];
 
-	void * private_data;
+	void *private_data;
 
 	void (*delete_priv_data)(struct anim_index_builder * idx);
 	void (*proc_frame)(struct anim_index_builder * idx,
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 6904827..1b3a6d4 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -357,7 +357,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
 		ibuf->planes = planes;
 		ibuf->ftype = TGA;
 		ibuf->channels = 4;  /* float option, is set to other values when buffers get assigned */
-		ibuf->ppm[0] = ibuf->ppm[1] = IMB_DPI_DEFAULT / 0.0254; /* IMB_DPI_DEFAULT -> pixels-per-meter */
+		ibuf->ppm[0] = ibuf->ppm[1] = IMB_DPI_DEFAULT / 0.0254f; /* IMB_DPI_DEFAULT -> pixels-per-meter */
 
 		if (flags & IB_rect) {
 			if (imb_addrectImBuf(ibuf) == FALSE) {
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 4aeba9a..8dfdbd4 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -821,6 +821,14 @@ static int ffmpeg_decode_video_frame(struct anim *anim)
 	}
 	
 	if (rval == AVERROR_EOF) {
+		/* this sets size and data fields to zero,
+		   which is necessary to decode the remaining data
+		   in the decoder engine after EOF. It also prevents a memory
+		   leak, since av_read_frame spills out a full size packet even
+		   on EOF... (and: it's save to call on NULL packets) */
+
+		av_free_packet(&anim->next_packet);
+
 		anim->next_packet.size = 0;
 		anim->next_packet.data = 0;
 
@@ -1233,7 +1241,7 @@ static ImBuf *anim_getnew(struct anim *anim)
 
 
 	if (anim->curtype != 0) return (NULL);
-	anim->curtype = imb_get_anim_type(anim->name);	
+	anim->curtype = imb_get_anim_type(anim->name);
 
 	switch (anim->curtype) {
 		case ANIM_SEQUENCE:
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index df12f0b..3273366 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -184,7 +184,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
 					rect += 4; bmp += 3;
 				}
 				/* for 24-bit images, rows are padded to multiples of 4 */
-				bmp += x % 4;	
+				bmp += x % 4;
 			}
 		}
 		else if (depth == 32) {
diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt
index fdf4f54..b94cfd2 100644
--- a/source/blender/imbuf/intern/cineon/CMakeLists.txt
+++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt
@@ -39,12 +39,24 @@ set(INC_SYS
 )
 
 set(SRC
+	cin_debug_stuff.h
+	cineonfile.h
+	cineonlib.h
+	dpxfile.h
+	dpxlib.h
+	logImageCore.h
+	logImageLib.h
+	logmemfile.h
+
 	cineon_dpx.c
 	cineonlib.c
 	dpxlib.c
 	logImageCore.c
-	logImageLib.c
 	logmemfile.c
 )
 
+if(WITH_IMAGE_CINEON)
+	add_definitions(-DWITH_CINEON)
+endif()
+
 blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/intern/cineon/SConscript b/source/blender/imbuf/intern/cineon/SConscript
index e1afb5e..a073346 100644
--- a/source/blender/imbuf/intern/cineon/SConscript
+++ b/source/blender/imbuf/intern/cineon/SConscript
@@ -15,4 +15,7 @@ incs = ['.',
 
 defs = []
 
+if env['WITH_BF_CINEON']:
+    defs.append('WITH_CINEON')
+
 env.BlenderLib ('bf_imbuf_cineon', source_files, incs, defs, libtype=['core','player'], priority = [220,175])
diff --git a/source/blender/imbuf/intern/cineon/cin_debug_stuff.h b/source/blender/imbuf/intern/cineon/cin_debug_stuff.h
index a97499f..e69de29 100644
--- a/source/blender/imbuf/intern/cineon/cin_debug_stuff.h
+++ b/source/blender/imbuf/intern/cineon/cin_debug_stuff.h
@@ -1,4 +0,0 @@
-/** \file blender/imbuf/intern/cineon/cin_debug_stuff.h
- *  \ingroup imbcineon
- */
-#define d_printf printf
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 7705af1..c8bc3f8 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -4,11 +4,11 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
@@ -20,25 +20,24 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Julien Enche.
  *
  * ***** END GPL LICENSE BLOCK *****
  * cineon.c
- * contributors: joeedh
+ * contributors: joeedh, Julien Enche
  * I hearby donate this code and all rights to the Blender Foundation.
+ * $Id$
  */
 
 /** \file blender/imbuf/intern/cineon/cineon_dpx.c
  *  \ingroup imbcineon
  */
 
- 
-#include <stdio.h>
-#include <string.h> /*for memcpy*/
 
-#include "logImageLib.h"
-#include "cineonlib.h"
-#include "dpxlib.h"
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "logImageCore.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -51,167 +50,152 @@
 
 #include "MEM_guardedalloc.h"
 
-#if 0
-static void cineon_conversion_parameters(LogImageByteConversionParameters *params)
-{
-//	params->blackPoint = scene?scene->r.cineonblack:95;
-//	params->whitePoint = scene?scene->r.cineonwhite:685;
-//	params->gamma = scene?scene->r.cineongamma:1.7f;
-//	params->doLogarithm = scene?scene->r.subimtype & R_CINEON_LOG:0;
-	
-	params->blackPoint = 95;
-	params->whitePoint = 685;
-	params->gamma = 1.0f;
-	params->doLogarithm = 0;
-}
-#endif
-
-static ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags, char colorspace[IM_MAX_SPACE])
+static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, size_t size, int use_cineon, int flags,
+                                         char colorspace[IM_MAX_SPACE])
 {
 	ImBuf *ibuf;
 	LogImageFile *image;
-	int x, y;
-	unsigned short *row, *upix;
 	int width, height, depth;
-	float *frow;
 
 	colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT);
 
-	logImageSetVerbose((G.debug & G_DEBUG) ? 1:0);
-	
-	image = logImageOpenFromMem(mem, size, use_cineon);
-	
-	if (!image) {
-		printf("no image!\n");
-		return NULL;
+	logImageSetVerbose((G.f & G_DEBUG) ? 1 : 0);
+
+	image = logImageOpenFromMemory(mem, size);
+
+	if (image == 0) {
+		printf("DPX/Cineon: error opening image.\n");
+		return 0;
 	}
-	
+
 	logImageGetSize(image, &width, &height, &depth);
-	
-	if (depth != 3) { /*need to do grayscale loading eventually.*/
+
+	if (width == 0 || height == 0) {
 		logImageClose(image);
-		return NULL;
+		return 0;
 	}
-	
-	if (width == 0 && height == 0) {
+
+	ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags);
+	if (ibuf == 0) {
 		logImageClose(image);
-		return NULL;
+		return 0;
 	}
-	
-	ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags);
 
-	row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c");
-	frow = ibuf->rect_float+width*height*4;
-	
-	for (y = 0; y < height; y++) {
-		logImageGetRowBytes(image, row, y); /* checks image->params.doLogarithm and convert */
-		upix = row;
-		frow -= width*4;
-		
-		for (x=0; x<width; x++) {
-			*(frow++) = ((float)*(upix++)) / 65535.0f;
-			*(frow++) = ((float)*(upix++)) / 65535.0f;
-			*(frow++) = ((float)*(upix++)) / 65535.0f;
-			*(frow++) = 1.0f;
-		}
-		frow -= width*4;
+	if (logImageGetDataRGBA(image, ibuf->rect_float, 1) != 0) {
+		/* Conversion not possible (probably because the format is unsupported) */
+		logImageClose(image);
+		MEM_freeN(ibuf);
+		return 0;
 	}
 
-	MEM_freeN(row);
 	logImageClose(image);
-	
-	if (flags & IB_rect) {
+	ibuf->ftype = use_cineon ? CINEON : DPX;
+	IMB_flipy(ibuf);
+
+	if (flags & IB_rect)
 		IMB_rect_from_float(ibuf);
-	}
+
 	return ibuf;
 }
 
 static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon, int flags)
 {
-	LogImageByteConversionParameters conversion;
-	const int width= ibuf->x;
-	const int height= ibuf->y;
-	const int depth= 3;
-	LogImageFile* logImage;
-	unsigned short* line, *pixel;
-	int i, j;
-	float *fline;
+	LogImageFile *logImage;
 	float *fbuf;
-	int is_alloc= 0;
+	float *fbuf_ptr;
+	unsigned char *rect_ptr;
+	int x, y, depth, bitspersample, rvalue;
+
+	if (flags & IB_mem) {
+		printf("DPX/Cineon: saving in memory is not supported.\n");
+		return 0;
+	}
 	
-	(void)flags; /* unused */
+	logImageSetVerbose((G.f & G_DEBUG) ? 1 : 0);
 
-	// cineon_conversion_parameters(&conversion);
-	logImageGetByteConversionDefaults(&conversion);
+	depth = (ibuf->planes + 7) >> 3;
+	if (depth > 4 || depth < 3) {
+		printf("DPX/Cineon: unsupported depth: %d for file: '%s'\n", depth, filename);
+		return 0;
+	}
 
-	/*
-	 * Get the drawable for the current image...
-	 */
+	if (ibuf->ftype & CINEON_10BIT)
+		bitspersample = 10;
+	else if (ibuf->ftype & CINEON_12BIT)
+		bitspersample = 12;
+	else if (ibuf->ftype & CINEON_16BIT)
+		bitspersample = 16;
+	else
+		bitspersample = 8;
 
-	fbuf= IMB_float_profile_ensure(ibuf, conversion.doLogarithm ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE, &is_alloc);
+	logImage = logImageCreate(filename, use_cineon, ibuf->x, ibuf->y, bitspersample, (depth == 4),
+	                          (ibuf->ftype & CINEON_LOG), -1, -1, -1, "Blender");
 
-	if (fbuf == NULL) { /* in the unlikely event that converting to a float buffer fails */
+	if (logImage == 0) {
+		printf("DPX/Cineon: error creating file.\n");
 		return 0;
 	}
-	
-	logImageSetVerbose((G.debug & G_DEBUG) ? 1:0);
-	logImage = logImageCreate(filename, use_cineon, width, height, depth);
 
-	if (!logImage) return 0;
-	
-	if (logImageSetByteConversion(logImage, &conversion)==0) {
-		printf("error setting args\n");
-	}
+	if (ibuf->rect_float != 0 && bitspersample != 8) {
+		/* don't use the float buffer to save 8 bpp picture to prevent color banding
+		   (there's no dithering algorithm behing the logImageSetDataRGBA function) */
 
-	line = MEM_mallocN(sizeof(unsigned short)*depth*width, "line");
-	
-	/*note that image is flipped when sent to logImageSetRowBytes (see last passed parameter).*/
-	for (j = 0; j < height; ++j) {
-		fline = &fbuf[width*j*4];
-		for (i=0; i<width; i++) {
-			float *fpix, fpix2[3];
-			/*we have to convert to cinepaint's 16-bit-per-channel here*/
-			pixel = &line[i*depth];
-			fpix = &fline[i*4];
-			memcpy(fpix2, fpix, sizeof(float)*3);
-			
-			if (fpix2[0]>=1.0f) fpix2[0] = 1.0f; else if (fpix2[0]<0.0f) fpix2[0]= 0.0f;
-			if (fpix2[1]>=1.0f) fpix2[1] = 1.0f; else if (fpix2[1]<0.0f) fpix2[1]= 0.0f;
-			if (fpix2[2]>=1.0f) fpix2[2] = 1.0f; else if (fpix2[2]<0.0f) fpix2[2]= 0.0f;
-			
-			pixel[0] = (unsigned short)(fpix2[0] * 65535.0f); /*float-float math is faster*/
-			pixel[1] = (unsigned short)(fpix2[1] * 65535.0f);
-			pixel[2] = (unsigned short)(fpix2[2] * 65535.0f);
+		fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon");
+
+		for (y = 0; y < ibuf->y; y++) {
+			float *dst_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x);
+			float *src_ptr = ibuf->rect_float + 4 * (y * ibuf->x);
+
+			memcpy(dst_ptr, src_ptr, 4 * ibuf->x * sizeof(float));
 		}
-		logImageSetRowBytes(logImage, (const unsigned short*)line, height-1-j);
-	}
-	logImageClose(logImage);
 
-	MEM_freeN(line);
-	
-	if (is_alloc) {
+		rvalue = (logImageSetDataRGBA(logImage, fbuf, 1) == 0);
+
 		MEM_freeN(fbuf);
 	}
-	
-	return 1;
+	else {
+		if (ibuf->rect == 0)
+			IMB_rect_from_float(ibuf);
+
+		fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon");
+		if (fbuf == 0) {
+			printf("DPX/Cineon: error allocating memory.\n");
+			logImageClose(logImage);
+			return 0;
+		}
+		for (y = 0; y < ibuf->y; y++) {
+			for (x = 0; x < ibuf->x; x++) {
+				fbuf_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x + x);
+				rect_ptr = (unsigned char *)ibuf->rect + 4 * (y * ibuf->x + x);
+				fbuf_ptr[0] = (float)rect_ptr[0] / 255.0f;
+				fbuf_ptr[1] = (float)rect_ptr[1] / 255.0f;
+				fbuf_ptr[2] = (float)rect_ptr[2] / 255.0f;
+				fbuf_ptr[3] = (depth == 4) ? ((float)rect_ptr[3] / 255.0f) : 1.0f;
+			}
+		}
+		rvalue = (logImageSetDataRGBA(logImage, fbuf, 0) == 0);
+		MEM_freeN(fbuf);
+	}
+
+	logImageClose(logImage);
+	return rvalue;
 }
 
-int imb_savecineon(struct ImBuf *buf, const char *myfile, int flags)
+int imb_save_cineon(struct ImBuf *buf, const char *myfile, int flags)
 {
 	return imb_save_dpx_cineon(buf, myfile, 1, flags);
 }
 
- 
 int imb_is_cineon(unsigned char *buf)
 {
-	return cineonIsMemFileCineon(buf);
+	return logImageIsCineon(buf);
 }
 
-ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_cineon(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
 {
 	if (imb_is_cineon(mem))
-		return imb_load_dpx_cineon(mem, 1, size, flags, colorspace);
-	return NULL;
+		return imb_load_dpx_cineon(mem, size, 1, flags, colorspace);
+	return 0;
 }
 
 int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags)
@@ -221,12 +205,12 @@ int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags)
 
 int imb_is_dpx(unsigned char *buf)
 {
-	return dpxIsMemFileCineon(buf);
+	return logImageIsDpx(buf);
 }
 
-ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_dpx(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
 {
 	if (imb_is_dpx(mem))
-		return imb_load_dpx_cineon(mem, 0, size, flags, colorspace);
-	return NULL;
+		return imb_load_dpx_cineon(mem, size, 0, flags, colorspace);
+	return 0;
 }
diff --git a/source/blender/imbuf/intern/cineon/cineonfile.h b/source/blender/imbuf/intern/cineon/cineonfile.h
index e681153..e69de29 100644
--- a/source/blender/imbuf/intern/cineon/cineonfile.h
+++ b/source/blender/imbuf/intern/cineon/cineonfile.h
@@ -1,134 +0,0 @@
-/*
- *	 Cineon image file format library definitions.
- *	 Cineon file format structures.
- *
- *	 This header file contains private details.
- *	 User code should generally use cineonlib.h only.
- *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
- *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
- *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
- *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __CINEONFILE_H__
-#define __CINEONFILE_H__
-
-/** \file blender/imbuf/intern/cineon/cineonfile.h
- *  \ingroup imbcineon
- */
-
-#include "logImageCore.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-		U32		magic_num;				/* magic number */
-		U32		image_offset;			/* offset to image data in bytes */
-		U32		gen_hdr_size;			/* generic header length in bytes */
-		U32		ind_hdr_size;			/* industry header length in bytes */
-		U32		user_data_size;		/* user-defined data length in bytes */
-		U32		file_size;				/* file size in bytes */
-		ASCII vers[8];					/* which header format version is being used (v4.5) */
-		ASCII file_name[100];		/* image file name */
-		ASCII create_date[12];	/* file creation date */
-		ASCII create_time[12];	/* file creation time */
-		ASCII Reserved[36];			/* reserved field TBD (need to pad) */
-} CineonFileInformation;
-
-typedef struct {
-		U8		 designator1;
-		U8		 designator2;
-		U8		 bits_per_pixel;
-		U8		 filler;
-		U32		 pixels_per_line;
-		U32		 lines_per_image;
-		U32		 ref_low_data;		 /* reference low data code value */
-		R32		 ref_low_quantity; /* reference low quantity represented */
-		U32		 ref_high_data;		 /* reference high data code value */
-		R32		 ref_high_quantity;/* reference high quantity represented */
-} CineonChannelInformation;
-
-typedef struct {
-		U8		 orientation;					 /* image orientation */
-		U8		 channels_per_image;
-		U16		 filler;
-		CineonChannelInformation channel[8];
-		R32		 white_point_x;
-		R32		 white_point_y;
-		R32		 red_primary_x;
-		R32		 red_primary_y;
-		R32		 green_primary_x;
-		R32		 green_primary_y;
-		R32		 blue_primary_x;
-		R32		 blue_primary_y;
-		ASCII	 label[200];
-		ASCII	 reserved[28];
-} CineonImageInformation;
-
-typedef struct {
-		U8		interleave;
-		U8		packing;
-		U8		signage;
-		U8		sense;
-		U32		line_padding;
-		U32		channel_padding;
-		ASCII reserved[20];
-} CineonFormatInformation;
-
-typedef struct {
-		S32		x_offset;
-		S32		y_offset;
-		ASCII file_name[100];
-		ASCII create_date[12];	/* file creation date */
-		ASCII create_time[12];	/* file creation time */
-		ASCII input_device[64];
-		ASCII model_number[32];
-		ASCII serial_number[32];
-		R32		x_input_samples_per_mm;
-		R32		y_input_samples_per_mm;
-		R32		input_device_gamma;
-		ASCII reserved[40];
-} CineonOriginationInformation;
-
-typedef struct {
-	CineonFileInformation fileInfo;
-	CineonImageInformation imageInfo;
-	CineonFormatInformation formatInfo;
-	CineonOriginationInformation originInfo;
-} CineonGenericHeader;
-
-typedef struct {
-	U8 filmCode;
-	U8 filmType;
-	U8 perfOffset;
-	U8 filler;
-	U32 keycodePrefix;
-	U32 keycodeCount;
-	ASCII format[32];
-	U32 framePosition; /* in sequence */
-	R32 frameRate; /* frames per second */
-	ASCII attribute[32];
-	ASCII slate[200];
-	ASCII reserved[740];
-} CineonMPISpecificInformation;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CINEONFILE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index a900130..3049a5b 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -1,21 +1,23 @@
 /*
- *	 Cineon image file format library routines.
+ * Cineon image file format library routines.
  *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
+ * Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
@@ -23,800 +25,355 @@
  *  \ingroup imbcineon
  */
 
+
 #include "cineonlib.h"
-#include "cineonfile.h"
+#include "logmemfile.h"
 
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
-#include <time.h>				 /* strftime() */
+#include <time.h>
 #include <sys/types.h>
-#ifdef WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>	 /* htonl() */
-#endif
-#include <string.h>			 /* memset */
+#include <string.h>
 
-#include "BLI_utildefines.h"
 #include "BLI_fileops.h"
+#include "BLI_math_base.h"
+#include "BLI_utildefines.h"
 
-#include "cin_debug_stuff.h"
-#include "logmemfile.h"
-
-static void
-fillCineonFileInfo(CineonFile* cineon, CineonFileInformation* fileInfo, const char* filename) {
-
-	time_t fileClock;
-	struct tm* fileTime;
-
-	fileInfo->magic_num = htonl(CINEON_FILE_MAGIC);
-	fileInfo->image_offset = htonl(cineon->imageOffset);
-	fileInfo->gen_hdr_size = htonl(
-		sizeof(CineonFileInformation) +
-		sizeof(CineonImageInformation) +
-		sizeof(CineonFormatInformation) +
-		sizeof(CineonOriginationInformation));
-	fileInfo->ind_hdr_size = 0;
-	fileInfo->user_data_size = 0;
-	fileInfo->file_size = htonl(cineon->imageOffset + cineon->height * cineon->lineBufferLength);
-	strcpy(fileInfo->vers, "V4.5");
-	strncpy(fileInfo->file_name, filename, 99);
-	fileInfo->file_name[99] = 0;
-
-	fileClock = time(0);
-	fileTime = localtime(&fileClock);
-	strftime(fileInfo->create_date, 12, "%Y:%m:%d", fileTime);
-	/* Question: is %Z in strftime guaranteed to return 3 chars? */
-	strftime(fileInfo->create_time, 12, "%H:%M:%S%Z", fileTime);
-	fileInfo->create_time[11] = 0;
-}
-
-static void
-dumpCineonFileInfo(CineonFileInformation* fileInfo) {
-	d_printf("\n--File Information--\n");
-	d_printf("Magic: %8.8lX\n", (uintptr_t)ntohl(fileInfo->magic_num));
-	d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->image_offset));
-	d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size));
-	d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size));
-	d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size));
-	d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size));
-	d_printf("Version \"%s\"\n", fileInfo->vers);
-	d_printf("File name \"%s\"\n", fileInfo->file_name);
-	d_printf("Creation date \"%s\"\n", fileInfo->create_date);
-	d_printf("Creation time \"%s\"\n", fileInfo->create_time);
-}
-
-static void
-fillCineonChannelInfo(CineonFile* cineon, CineonChannelInformation* chan, int des) {
-
-	chan->designator1 = 0;
-	chan->designator2 = des;
-	chan->bits_per_pixel = 10;
-	chan->pixels_per_line = htonl(cineon->width);
-	chan->lines_per_image = htonl(cineon->height);
-	chan->ref_low_data = htonl(0);
-	chan->ref_low_quantity = htonf(0.0);
-	chan->ref_high_data = htonl(1023);
-	chan->ref_high_quantity = htonf(2.046);
-}
-
-static void
-dumpCineonChannelInfo(CineonChannelInformation* chan) {
-	d_printf("	Metric selector: %d", chan->designator1);
-	switch (chan->designator1) {
-		case 0: d_printf(" (Universal)\n"); break;
-		default: d_printf(" (Vendor specific)\n"); break;
-	}
-	d_printf("	Metric: %d,", chan->designator2);
-	switch (chan->designator2) {
-		case 0: d_printf(" B&W (printing density?)\n"); break;
-		case 1: d_printf(" Red printing density\n"); break;
-		case 2: d_printf(" Green printing density\n"); break;
-		case 3: d_printf(" Blue printing density\n"); break;
-		case 4: d_printf(" Red CCIR XA/11\n"); break;
-		case 5: d_printf(" Green CCIR XA/11\n"); break;
-		case 6: d_printf(" Blue CCIR XA/11\n"); break;
-		default: d_printf(" (unknown)\n"); break;
-	}
-	d_printf("	Bits per pixel %d\n", chan->bits_per_pixel);
-	d_printf("	Pixels per line %ld\n", (intptr_t)ntohl(chan->pixels_per_line));
-	d_printf("	Lines per image %ld\n", (intptr_t)ntohl(chan->lines_per_image));
-	d_printf("	Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data));
-	d_printf("	Ref low quantity %f\n", ntohf(chan->ref_low_quantity));
-	d_printf("	Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data));
-	d_printf("	Ref high quantity %f\n", ntohf(chan->ref_high_quantity));
-}
-
-static void
-fillCineonImageInfo(CineonFile* cineon, CineonImageInformation* imageInfo) {
-
-	imageInfo->orientation = 0;
-	imageInfo->channels_per_image = cineon->depth;
-
-	if (cineon->depth == 1) {
-		fillCineonChannelInfo(cineon, &imageInfo->channel[0], 0);
-
-	}
-	else if (cineon->depth == 3) {
-		fillCineonChannelInfo(cineon, &imageInfo->channel[0], 1);
-		fillCineonChannelInfo(cineon, &imageInfo->channel[1], 2);
-		fillCineonChannelInfo(cineon, &imageInfo->channel[2], 3);
-	}
-
-	imageInfo->white_point_x = htonf(undefined());
-	imageInfo->white_point_y = htonf(undefined());
-	imageInfo->red_primary_x = htonf(undefined());
-	imageInfo->red_primary_y = htonf(undefined());
-	imageInfo->green_primary_x = htonf(undefined());
-	imageInfo->green_primary_y = htonf(undefined());
-	imageInfo->blue_primary_x = htonf(undefined());
-	imageInfo->blue_primary_y = htonf(undefined());
-
-	strcpy(imageInfo->label, "David's Cineon writer.");
-
-}
-
-static void
-dumpCineonImageInfo(CineonImageInformation* imageInfo) {
-
-	int i;
-	d_printf("\n--Image Information--\n");
-	d_printf("Image orientation %d,", imageInfo->orientation);
-	switch (imageInfo->orientation) {
-		case 0: d_printf(" LRTB\n"); break;
-		case 1: d_printf(" LRBT\n"); break;
-		case 2: d_printf(" RLTB\n"); break;
-		case 3: d_printf(" RLBT\n"); break;
-		case 4: d_printf(" TBLR\n"); break;
-		case 5: d_printf(" TBRL\n"); break;
-		case 6: d_printf(" BTLR\n"); break;
-		case 7: d_printf(" BTRL\n"); break;
-		default: d_printf(" (unknown)\n"); break;
-	}
-	d_printf("Channels %d\n", imageInfo->channels_per_image);
-	for (i = 0; i < imageInfo->channels_per_image; ++i) {
-		d_printf("	--Channel %d--\n", i);
-		dumpCineonChannelInfo(&imageInfo->channel[i]);
-	}
-
-	d_printf("White point x %f\n", ntohf(imageInfo->white_point_x));
-	d_printf("White point y %f\n", ntohf(imageInfo->white_point_y));
-	d_printf("Red primary x %f\n", ntohf(imageInfo->red_primary_x));
-	d_printf("Red primary y %f\n", ntohf(imageInfo->red_primary_y));
-	d_printf("Green primary x %f\n", ntohf(imageInfo->green_primary_x));
-	d_printf("Green primary y %f\n", ntohf(imageInfo->green_primary_y));
-	d_printf("Blue primary x %f\n", ntohf(imageInfo->blue_primary_x));
-	d_printf("Blue primary y %f\n", ntohf(imageInfo->blue_primary_y));
-	d_printf("Label \"%s\"\n", imageInfo->label);
-}
-
-static void
-fillCineonFormatInfo(CineonFile* cineon, CineonFormatInformation* formatInfo) {
-
-	(void)cineon; /* unused */
-	
-	formatInfo->interleave = 0;
-	formatInfo->packing = 5;
-	formatInfo->signage = 0;
-	formatInfo->sense = 0;
-	formatInfo->line_padding = htonl(0);
-	formatInfo->channel_padding = htonl(0);
-}
-
-static void
-dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
-	d_printf("\n--Format Information--\n");
-	d_printf("Interleave %d,", formatInfo->interleave);
-	switch (formatInfo->interleave) {
-		case 0: d_printf(" pixel interleave\n"); break;
-		case 1: d_printf(" line interleave\n"); break;
-		case 2: d_printf(" channel interleave\n"); break;
-		default: d_printf(" (unknown)\n"); break;
-	}
-	d_printf("Packing %d,", formatInfo->packing);
-	if (formatInfo->packing & 0x80) { 
-		d_printf(" multi pixel,");
-	}
-	else {
-		d_printf(" single pixel,");
-	}
-	switch (formatInfo->packing & 0x7F) {
-		case 0: d_printf(" tight\n"); break;
-		case 1: d_printf(" byte packed left\n"); break;
-		case 2: d_printf(" byte packed right\n"); break;
-		case 3: d_printf(" word packed left\n"); break;
-		case 4: d_printf(" word packed right\n"); break;
-		case 5: d_printf(" long packed left\n"); break;
-		case 6: d_printf(" long packed right\n"); break;
-		default: d_printf(" (unknown)\n"); break;
-	}
-	d_printf("Sign %d,", formatInfo->signage);
-	if (formatInfo->signage) { 
-		d_printf(" signed\n");
-	}
-	else {
-		d_printf(" unsigned\n");
-	}
-	d_printf("Sense %d,", formatInfo->signage);
-	if (formatInfo->signage) { 
-		d_printf(" negative\n");
-	}
-	else {
-		d_printf(" positive\n");
-	}
-	d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding));
-	d_printf("End of channel padding %ld\n", (intptr_t)ntohl(formatInfo->channel_padding));
-}
-
-static void
-fillCineonOriginationInfo(CineonFile* cineon,
-	CineonOriginationInformation* originInfo, CineonFileInformation* fileInfo) {
-	
-	(void)cineon; /* unused */
-
-	originInfo->x_offset = htonl(0);
-	originInfo->y_offset = htonl(0);
-	strcpy(originInfo->file_name, fileInfo->file_name);
-	strcpy(originInfo->create_date, fileInfo->create_date);
-	strcpy(originInfo->create_time, fileInfo->create_time);
-	strncpy(originInfo->input_device, "David's Cineon writer", 64);
-	strncpy(originInfo->model_number, "Software", 32);
-	strncpy(originInfo->serial_number, "001", 32);
-	originInfo->x_input_samples_per_mm = htonf(undefined());
-	originInfo->y_input_samples_per_mm =	htonf(undefined());
-	/* this should probably be undefined, too */
-	originInfo->input_device_gamma = htonf(1.0);
-}
-
-static void
-dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) {
-	d_printf("\n--Origination Information--\n");
-	d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset));
-	d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset));
-	d_printf("File name \"%s\"\n", originInfo->file_name);
-	d_printf("Creation date \"%s\"\n", originInfo->create_date);
-	d_printf("Creation time \"%s\"\n", originInfo->create_time);
-	d_printf("Input device \"%s\"\n", originInfo->input_device);
-	d_printf("Model number \"%s\"\n", originInfo->model_number);
-	d_printf("Serial number \"%s\"\n", originInfo->serial_number);
-	d_printf("Samples per mm in x %f\n", ntohf(originInfo->x_input_samples_per_mm));
-	d_printf("Samples per mm in y %f\n", ntohf(originInfo->y_input_samples_per_mm));
-	d_printf("Input device gamma %f\n", ntohf(originInfo->input_device_gamma));
-}
-
-static int
-initCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header, const char* imagename) {
-
-	fillCineonFileInfo(cineon, &header->fileInfo, imagename);
-	fillCineonImageInfo(cineon, &header->imageInfo);
-	fillCineonFormatInfo(cineon, &header->formatInfo);
-	fillCineonOriginationInfo(cineon, &header->originInfo, &header->fileInfo);
+#include "logImageLib.h"
 
-	return 0;
-}
+#include "MEM_guardedalloc.h"
 
-static void
-UNUSED_FUNCTION(dumpCineonGenericHeader)(CineonGenericHeader* header) {
-	dumpCineonFileInfo(&header->fileInfo);
-	dumpCineonImageInfo(&header->imageInfo);
-	dumpCineonFormatInfo(&header->formatInfo);
-	dumpCineonOriginationInfo(&header->originInfo);
-}
+/*
+ * For debug purpose
+ */
 
 static int verbose = 0;
-void
-cineonSetVerbose(int verbosity) {
-	verbose = verbosity;
-}
-
-static void
-verboseMe(CineonFile* cineon) {
-
-	d_printf("size %d x %d x %d\n", cineon->width, cineon->height, cineon->depth);
-	d_printf("ImageStart %d, lineBufferLength %d, implied length %d\n",
-		cineon->imageOffset, cineon->lineBufferLength * 4,
-		cineon->imageOffset + cineon->lineBufferLength * 4 * cineon->height);
-}
-
-int
-cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int y) {
-
-	int longsRead;
-	int pixelIndex;
-	int longIndex;
-	int numPixels = cineon->width * cineon->depth;
-
-
-	/* only seek if not reading consecutive lines */
-	if (y != cineon->fileYPos) {
-		int lineOffset = cineon->imageOffset + y * cineon->lineBufferLength * 4;
-		if (verbose) d_printf("Seek in getRowBytes\n");
-		if (logimage_fseek(cineon, lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, lineOffset);
-			return 1;
-		}
-		cineon->fileYPos = y;
-	}
-
-	longsRead = logimage_fread(cineon->lineBuffer, 4, cineon->lineBufferLength, cineon);
-	if (longsRead != cineon->lineBufferLength) {
-		if (verbose) {
-			d_printf("Couldn't read line %d length %d\n", y, cineon->lineBufferLength * 4);
-			perror("cineonGetRowBytes");
-		}
-
-		return 1;
-	}
 
-	/* remember where we left the car, honey */
-	++cineon->fileYPos;
-
-	/* convert longwords to pixels */
-	pixelIndex = 0;
-	for (longIndex = 0; longIndex < cineon->lineBufferLength; ++longIndex) {
-		unsigned int t = ntohl(cineon->lineBuffer[longIndex]);
-		t = t >> 2;
-		cineon->pixelBuffer[pixelIndex+2] = (unsigned short) t & 0x3ff;
-		t = t >> 10;
-		cineon->pixelBuffer[pixelIndex+1] = (unsigned short) t & 0x3ff;
-		t = t >> 10;
-		cineon->pixelBuffer[pixelIndex] = (unsigned short) t & 0x3ff;
-		pixelIndex += 3;
-	}
-
-	/* extract required pixels */
-	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if (cineon->params.doLogarithm)
-			row[pixelIndex] = cineon->lut10_16[cineon->pixelBuffer[pixelIndex]];
-		else
-			row[pixelIndex] = cineon->pixelBuffer[pixelIndex] << 6;
-	}
-
-	return 0;
+void cineonSetVerbose(int verbosity) {
+	verbose = verbosity;
 }
 
-int
-cineonSetRowBytes(CineonFile* cineon, const unsigned short* row, int y) {
-
-	int pixelIndex;
-	int numPixels = cineon->width * cineon->depth;
-	int longIndex;
-	int longsWritten;
-
-	/* put new pixels into pixelBuffer */
-	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if (cineon->params.doLogarithm)
-			cineon->pixelBuffer[pixelIndex] = cineon->lut16_16[row[pixelIndex]];
-		else
-			cineon->pixelBuffer[pixelIndex] = row[pixelIndex] >> 6;
-	}
-
-	/* pack into longwords */
-	pixelIndex = 0;
-	for (longIndex = 0; longIndex < cineon->lineBufferLength; ++longIndex) {
-		unsigned int t =
-				(cineon->pixelBuffer[pixelIndex] << 22) |
-				(cineon->pixelBuffer[pixelIndex+1] << 12) |
-				(cineon->pixelBuffer[pixelIndex+2] << 2);
-		cineon->lineBuffer[longIndex] = htonl(t);
-		pixelIndex += 3;
-	}
-
-	/* only seek if not reading consecutive lines */
-	if (y != cineon->fileYPos) {
-		int lineOffset = cineon->imageOffset + y * cineon->lineBufferLength * 4;
-		if (verbose) d_printf("Seek in setRowBytes\n");
-		if (logimage_fseek(cineon, lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, lineOffset);
-			return 1;
-		}
-		cineon->fileYPos = y;
-	}
-
-	longsWritten = fwrite(cineon->lineBuffer, 4, cineon->lineBufferLength, cineon->file);
-	if (longsWritten != cineon->lineBufferLength) {
-		if (verbose) d_printf("Couldn't write line %d length %d\n", y, cineon->lineBufferLength * 4);
-		return 1;
-	}
-
-	++cineon->fileYPos;
+static void fillCineonMainHeader(LogImageFile *cineon, CineonMainHeader *header,
+                                 const char *filename, const char *creator)
+{
+	time_t fileClock;
+	struct tm *fileTime;
+	int i;
 
-	return 0;
+	memset(header, 0, sizeof(CineonMainHeader));
+
+	/* --- File header --- */
+	header->fileHeader.magic_num = swap_uint(CINEON_FILE_MAGIC, cineon->isMSB);
+	header->fileHeader.offset = swap_uint(cineon->element[0].dataOffset, cineon->isMSB);
+	header->fileHeader.gen_hdr_size = swap_uint(sizeof(CineonFileHeader) + sizeof(CineonImageHeader) +
+	                                            sizeof(CineonOriginationHeader), cineon->isMSB);
+	header->fileHeader.ind_hdr_size = 0;
+	header->fileHeader.user_data_size = 0;
+	header->fileHeader.file_size = swap_uint(cineon->element[0].dataOffset + cineon->height * getRowLength(cineon->width, cineon->element[0]), cineon->isMSB);
+	strcpy(header->fileHeader.version, "v4.5");
+	strncpy(header->fileHeader.file_name, filename, 99);
+	header->fileHeader.file_name[99] = 0;
+	fileClock = time(0);
+	fileTime = localtime(&fileClock);
+	strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime);
+	strftime(header->fileHeader.creation_time, 12, "%H:%M:%S%Z", fileTime);
+	header->fileHeader.creation_time[11] = 0;
+
+	/* --- Image header --- */
+	header->imageHeader.orientation = 0;
+	header->imageHeader.elements_per_image = cineon->depth;
+
+	for (i = 0; i < 3; i++) {
+		header->imageHeader.element[i].descriptor1 = 0;
+		header->imageHeader.element[i].descriptor2 = i;
+		header->imageHeader.element[i].bits_per_sample = cineon->element[0].bitsPerSample;
+		header->imageHeader.element[i].pixels_per_line = swap_uint(cineon->width, cineon->isMSB);
+		header->imageHeader.element[i].lines_per_image = swap_uint(cineon->height, cineon->isMSB);
+		header->imageHeader.element[i].ref_low_data = swap_uint(cineon->element[0].refLowData, cineon->isMSB);
+		header->imageHeader.element[i].ref_low_quantity = swap_float(cineon->element[0].refLowQuantity, cineon->isMSB);
+		header->imageHeader.element[i].ref_high_data = swap_uint(cineon->element[0].refHighData, cineon->isMSB);
+		header->imageHeader.element[i].ref_high_quantity = swap_float(cineon->element[0].refHighQuantity, cineon->isMSB);
+	}
+
+	header->imageHeader.white_point_x = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.white_point_y = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.red_primary_x = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.red_primary_y = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.green_primary_x = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.green_primary_y = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.blue_primary_x = swap_float(0.0f, cineon->isMSB);
+	header->imageHeader.blue_primary_y = swap_float(0.0f, cineon->isMSB);
+	strncpy(header->imageHeader.label, creator, 199);
+	header->imageHeader.label[199] = 0;
+	header->imageHeader.interleave = 0;
+	header->imageHeader.data_sign = 0;
+	header->imageHeader.sense = 0;
+	header->imageHeader.line_padding = swap_uint(0, cineon->isMSB);
+	header->imageHeader.element_padding = swap_uint(0, cineon->isMSB);
+
+	switch (cineon->element[0].packing) {
+		case 0:
+			header->imageHeader.packing = 0;
+			break;
+
+		case 1:
+			header->imageHeader.packing = 5;
+			break;
+
+		case 2:
+			header->imageHeader.packing = 6;
+			break;
+	}
+
+	/* --- Origination header --- */
+	/* we leave it blank */
+
+	/* --- Film header --- */
+	/* we leave it blank */
 }
 
-int
-cineonGetRow(CineonFile* cineon, unsigned short* row, int y) {
-
-	int longsRead;
-	int pixelIndex;
-	int longIndex;
-/*	int numPixels = cineon->width * cineon->depth;
-*/
-	/* only seek if not reading consecutive lines */
-	if (y != cineon->fileYPos) {
-		int lineOffset = cineon->imageOffset + y * cineon->lineBufferLength * 4;
-		if (verbose) d_printf("Seek in getRow\n");
-		if (logimage_fseek(cineon, lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, lineOffset);
-			return 1;
-		}
-		cineon->fileYPos = y;
-	}
-
-	longsRead = logimage_fread(cineon->lineBuffer, 4, cineon->lineBufferLength, cineon);
-	if (longsRead != cineon->lineBufferLength) {
-		if (verbose) d_printf("Couldn't read line %d length %d\n", y, cineon->lineBufferLength * 4);
-		return 1;
-	}
+LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize)
+{
+	CineonMainHeader header;
+	LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
+	char *filename = (char *)byteStuff;
+	int i;
+	unsigned int dataOffset;
 
-	/* remember where we left the car, honey */
-	++cineon->fileYPos;
-
-	/* convert longwords to pixels */
-	pixelIndex = 0;
-	for (longIndex = 0; longIndex < cineon->lineBufferLength; ++longIndex) {
-		unsigned int t = ntohl(cineon->lineBuffer[longIndex]);
-		t = t >> 2;
-		row[pixelIndex+2] = (unsigned short) t & 0x3ff;
-		t = t >> 10;
-		row[pixelIndex+1] = (unsigned short) t & 0x3ff;
-		t = t >> 10;
-		row[pixelIndex] = (unsigned short) t & 0x3ff;
-		pixelIndex += 3;
+	if (cineon == 0) {
+		if (verbose) printf("Cineon: Failed to malloc cineon file structure.\n");
+		return 0;
 	}
 
-	return 0;
-}
+	/* zero the header */
+	memset(&header, 0, sizeof(CineonMainHeader));
 
-int
-cineonSetRow(CineonFile* cineon, const unsigned short* row, int y) {
-
-	int pixelIndex;
-/*	int numPixels = cineon->width * cineon->depth;
-*/	int longIndex;
-	int longsWritten;
-
-	/* pack into longwords */
-	pixelIndex = 0;
-	for (longIndex = 0; longIndex < cineon->lineBufferLength; ++longIndex) {
-		unsigned int t =
-				(row[pixelIndex] << 22) |
-				(row[pixelIndex+1] << 12) |
-				(row[pixelIndex+2] << 2);
-		cineon->lineBuffer[longIndex] = htonl(t);
-		pixelIndex += 3;
-	}
+	/* for close routine */
+	cineon->file = 0;
 
-	/* only seek if not reading consecutive lines */
-	if (y != cineon->fileYPos) {
-		int lineOffset = cineon->imageOffset + y * cineon->lineBufferLength * 4;
-		if (verbose) d_printf("Seek in setRowBytes\n");
-		if (logimage_fseek(cineon, lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, lineOffset);
-			return 1;
+	if (fromMemory == 0) {
+		/* byteStuff is then the filename */
+		cineon->file = BLI_fopen(filename, "rb");
+		if (cineon->file == 0) {
+			if (verbose) printf("Cineon: Failed to open file \"%s\".\n", filename);
+			logImageClose(cineon);
+			return 0;
 		}
-		cineon->fileYPos = y;
+		/* not used in this case */
+		cineon->memBuffer = 0;
+		cineon->memCursor = 0;
+		cineon->memBufferSize = 0;
 	}
-
-	longsWritten = fwrite(cineon->lineBuffer, 4, cineon->lineBufferLength, cineon->file);
-	if (longsWritten != cineon->lineBufferLength) {
-		if (verbose) d_printf("Couldn't write line %d length %d\n", y, cineon->lineBufferLength * 4);
-		return 1;
+	else {
+		cineon->memBuffer = (unsigned char *)byteStuff;
+		cineon->memCursor = (unsigned char *)byteStuff;
+		cineon->memBufferSize = bufferSize;
 	}
 
-	++cineon->fileYPos;
-
-	return 0;
-}
-
-CineonFile* 
-cineonOpen(const char* filename) {
-
-	CineonGenericHeader header;
-
-	CineonFile* cineon = (CineonFile* )malloc(sizeof(CineonFile));
-	if (cineon == 0) {
-		if (verbose) d_printf("Failed to malloc cineon file structure.\n");
+	if (logimage_fread(&header, sizeof(header), 1, cineon) == 0) {
+		if (verbose) printf("Cineon: Not enough data for header in \"%s\".\n", byteStuff);
+		logImageClose(cineon);
 		return 0;
 	}
 
-	/* for close routine */
-	cineon->file = 0;
-	cineon->lineBuffer = 0;
-	cineon->pixelBuffer = 0;
-	cineon->membuffer = 0;
-	cineon->memcursor = 0;
-	cineon->membuffersize = 0;
-	
-	cineon->file = BLI_fopen(filename, "rb");
-	if (cineon->file == 0) {
-		if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
-		cineonClose(cineon);
-		return 0;
+	/* endianness determination */
+	if (header.fileHeader.magic_num == swap_uint(CINEON_FILE_MAGIC, 1)) {
+		cineon->isMSB = 1;
+		if (verbose) printf("Cineon: File is MSB.\n");
 	}
-	cineon->reading = 1;
-
-	if (logimage_fread(&header, sizeof(CineonGenericHeader), 1, cineon) == 0) {
-		if (verbose) d_printf("Not enough data for header in \"%s\".\n", filename);
-		cineonClose(cineon);
-		return 0;
+	else if (header.fileHeader.magic_num == CINEON_FILE_MAGIC) {
+		cineon->isMSB = 0;
+		if (verbose) printf("Cineon: File is LSB.\n");
 	}
-
-	/* let's assume cineon files are always network order */
-	if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) {
-		if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n",
-			(uintptr_t)ntohl(header.fileInfo.magic_num), filename);
-		cineonClose(cineon);
+	else {
+		if (verbose) printf("Cineon: Bad magic number %lu in \"%s\".\n",
+			                (unsigned long)header.fileHeader.magic_num, byteStuff);
+		logImageClose(cineon);
 		return 0;
 	}
 
-	if (header.formatInfo.packing != 5) {
-		if (verbose) d_printf("Can't understand packing %d\n", header.formatInfo.packing);
-		cineonClose(cineon);
-		return 0;
-	}
+	cineon->width = swap_uint(header.imageHeader.element[0].pixels_per_line, cineon->isMSB);
+	cineon->height = swap_uint(header.imageHeader.element[0].lines_per_image, cineon->isMSB);
+	cineon->depth = header.imageHeader.elements_per_image;
+	cineon->srcFormat = format_Cineon;
 
-	cineon->width = ntohl(header.imageInfo.channel[0].pixels_per_line);
-	cineon->height = ntohl(header.imageInfo.channel[0].lines_per_image);
-	cineon->depth = header.imageInfo.channels_per_image;
-	/* cineon->bitsPerPixel = 10; */
-	cineon->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
-	cineon->imageOffset = ntohl(header.fileInfo.image_offset);
-
-	cineon->lineBufferLength = pixelsToLongs(cineon->width * cineon->depth);
-	cineon->lineBuffer = malloc(cineon->lineBufferLength * 4);
-	if (cineon->lineBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc line buffer of size %d\n", cineon->lineBufferLength * 4);
-		cineonClose(cineon);
+	if (header.imageHeader.interleave == 0)
+		cineon->numElements = 1;
+	else if (header.imageHeader.interleave == 2)
+		cineon->numElements = header.imageHeader.elements_per_image;
+	else {
+		if (verbose) printf("Cineon: Data interleave not supported: %d\n", header.imageHeader.interleave);
 		return 0;
 	}
 
-	cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short));
-	if (cineon->pixelBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n",
-				(cineon->width * cineon->depth) * (int)sizeof(unsigned short));
-		cineonClose(cineon);
-		return 0;
+	if (cineon->depth == 1) {
+		/* Grayscale image */
+		cineon->element[0].descriptor = descriptor_Luminance;
+		cineon->element[0].transfer = transfer_Linear;
+		cineon->element[0].depth = 1;
 	}
-	cineon->pixelBufferUsed = 0;
-
-	if (logimage_fseek(cineon, cineon->imageOffset, SEEK_SET) != 0) {
-		if (verbose) d_printf("Couldn't seek to image data at %d\n", cineon->imageOffset);
-		cineonClose(cineon);
-		return 0;
+	else if (cineon->depth == 3) {
+		/* RGB image */
+		if (cineon->numElements == 1) {
+			cineon->element[0].descriptor = descriptor_RGB;
+			cineon->element[0].transfer = transfer_PrintingDensity;
+			cineon->element[0].depth = 3;
+		}
+		else if (cineon->numElements == 3) {
+			cineon->element[0].descriptor = descriptor_Red;
+			cineon->element[0].transfer = transfer_PrintingDensity;
+			cineon->element[0].depth = 1;
+			cineon->element[1].descriptor = descriptor_Green;
+			cineon->element[1].transfer = transfer_PrintingDensity;
+			cineon->element[1].depth = 1;
+			cineon->element[2].descriptor = descriptor_Blue;
+			cineon->element[2].transfer = transfer_PrintingDensity;
+			cineon->element[2].depth = 1;
+		}
 	}
-	cineon->fileYPos = 0;
-
-	logImageGetByteConversionDefaults(&cineon->params);
-	setupLut(cineon);
-
-	cineon->getRow = &cineonGetRowBytes;
-	cineon->setRow = 0;
-	cineon->close = &cineonClose;
-
-	if (verbose) {
-		verboseMe(cineon);
+	else {
+		if (verbose) printf("Cineon: Cineon image depth unsupported: %d\n", cineon->depth);
+		return 0;
 	}
 
-	return cineon;
-}
+	dataOffset = swap_uint(header.fileHeader.offset, cineon->isMSB);
 
-int cineonIsMemFileCineon(unsigned char *mem)
-{
-	unsigned int num;
-	memcpy(&num, mem, sizeof(unsigned int));
-	
-	if (num != ntohl(CINEON_FILE_MAGIC)) {
-		return 0;
-	}
-	else return 1;
-}
+	for (i = 0; i < cineon->numElements; i++) {
+		cineon->element[i].bitsPerSample = header.imageHeader.element[i].bits_per_sample;
+		cineon->element[i].maxValue = powf(2, cineon->element[i].bitsPerSample) - 1.0f;
+		cineon->element[i].refLowData = swap_uint(header.imageHeader.element[i].ref_low_data, cineon->isMSB);
+		cineon->element[i].refLowQuantity = swap_float(header.imageHeader.element[i].ref_low_quantity, cineon->isMSB);
+		cineon->element[i].refHighData = swap_uint(header.imageHeader.element[i].ref_high_data, cineon->isMSB);
+		cineon->element[i].refHighQuantity = swap_float(header.imageHeader.element[i].ref_high_quantity, cineon->isMSB);
 
-CineonFile* 
-cineonOpenFromMem(unsigned char *mem, unsigned int size) {
+		switch (header.imageHeader.packing) {
+			case 0:
+				cineon->element[i].packing = 0;
+				break;
 
-	CineonGenericHeader header;
-	
-	CineonFile* cineon = (CineonFile* )malloc(sizeof(CineonFile));
-	if (cineon == 0) {
-		if (verbose) d_printf("Failed to malloc cineon file structure.\n");
-		return 0;
-	}
+			case 5:
+				cineon->element[i].packing = 1;
+				break;
 
-	/* for close routine */
-	cineon->file = 0;
-	cineon->lineBuffer = 0;
-	cineon->pixelBuffer = 0;
-	cineon->membuffer = mem;
-	cineon->membuffersize = size;
-	cineon->memcursor = mem;
-	
-	cineon->file = 0;
-	cineon->reading = 1;
-	verbose = 0;
-	if (size < sizeof(CineonGenericHeader)) {
-		if (verbose) d_printf("Not enough data for header!\n");
-		cineonClose(cineon);
-		return 0;
-	}
+			case 6:
+				cineon->element[i].packing = 2;
+				break;
 
-	logimage_fread(&header, sizeof(CineonGenericHeader), 1, cineon);
+			default:
+				/* Not supported */
+				if (verbose) printf("Cineon: packing unsupported: %d\n", header.imageHeader.packing);
+				return 0;
+		}
 
-	/* let's assume cineon files are always network order */
-	if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) {
-		if (verbose) d_printf("Bad magic number %8.8lX in\n", (uintptr_t)ntohl(header.fileInfo.magic_num));
+		if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refLowData))
+			cineon->element[i].refLowData = 0;
 
-		cineonClose(cineon);
-		return 0;
-	}
+		if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refHighData))
+			cineon->element[i].refHighData = (unsigned int)cineon->element[i].maxValue;
 
-	if (header.formatInfo.packing != 5) {
-		if (verbose) d_printf("Can't understand packing %d\n", header.formatInfo.packing);
-		cineonClose(cineon);
-		return 0;
-	}
+		if (cineon->element[i].refLowQuantity == CINEON_UNDEFINED_R32 || isnan(cineon->element[i].refLowQuantity))
+			cineon->element[i].refLowQuantity = 0.0f;
 
-	cineon->width = ntohl(header.imageInfo.channel[0].pixels_per_line);
-	cineon->height = ntohl(header.imageInfo.channel[0].lines_per_image);
-	cineon->depth = header.imageInfo.channels_per_image;
-	/* cineon->bitsPerPixel = 10; */
-	cineon->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
-	cineon->imageOffset = ntohl(header.fileInfo.image_offset);
-
-	cineon->lineBufferLength = pixelsToLongs(cineon->width * cineon->depth);
-	cineon->lineBuffer = malloc(cineon->lineBufferLength * 4);
-	if (cineon->lineBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc line buffer of size %d\n", cineon->lineBufferLength * 4);
-		cineonClose(cineon);
-		return 0;
-	}
+		if (cineon->element[i].refHighQuantity == CINEON_UNDEFINED_R32 || isnan(cineon->element[i].refHighQuantity)) {
+			if (cineon->element[i].transfer == transfer_PrintingDensity)
+				cineon->element[i].refHighQuantity = 2.048f;
+			else
+				cineon->element[i].refHighQuantity = cineon->element[i].maxValue;
+		}
 
-	cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short));
-	if (cineon->pixelBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n",
-				(cineon->width * cineon->depth) * (int)sizeof(unsigned short));
-		cineonClose(cineon);
-		return 0;
-	}
-	cineon->pixelBufferUsed = 0;
-	
-	if (logimage_fseek(cineon, cineon->imageOffset, SEEK_SET) != 0) {
-		if (verbose) d_printf("Couldn't seek to image data at %d\n", cineon->imageOffset);
-		cineonClose(cineon);
-		return 0;
+		cineon->element[i].dataOffset = dataOffset;
+		dataOffset += cineon->height * getRowLength(cineon->width, cineon->element[i]);
 	}
-	
-	cineon->fileYPos = 0;
-
-	logImageGetByteConversionDefaults(&cineon->params);
-	setupLut(cineon);
 
-	cineon->getRow = &cineonGetRowBytes;
-	cineon->setRow = 0;
-	cineon->close = &cineonClose;
+	cineon->referenceBlack = 95.0f / 1023.0f * cineon->element[0].maxValue;
+	cineon->referenceWhite = 685.0f / 1023.0f * cineon->element[0].maxValue;
+	cineon->gamma = 1.7f;
 
 	if (verbose) {
-		verboseMe(cineon);
-	}
+		printf("size %d x %d x %d elements\n", cineon->width, cineon->height, cineon->numElements);
+		for (i = 0; i < cineon->numElements; i++) {
+			printf(" Element %d:\n", i);
+			printf("  Bits per sample: %d\n", cineon->element[i].bitsPerSample);
+			printf("  Depth: %d\n", cineon->element[i].depth);
+			printf("  Transfer characteristics: %d\n", cineon->element[i].transfer);
+			printf("  Packing: %d\n", cineon->element[i].packing);
+			printf("  Descriptor: %d\n", cineon->element[i].descriptor);
+			printf("  Data offset: %u\n", cineon->element[i].dataOffset);
+			printf("  Reference low data: %u\n", cineon->element[i].refLowData);
+			printf("  Reference low quantity: %f\n", cineon->element[i].refLowQuantity);
+			printf("  Reference high data: %u\n", cineon->element[i].refHighData);
+			printf("  Reference high quantity: %f\n", cineon->element[i].refHighQuantity);
+			printf("\n");
+		}
 
+		printf("Gamma: %f\n", cineon->gamma);
+		printf("Reference black: %f\n", cineon->referenceBlack);
+		printf("Reference white: %f\n", cineon->referenceWhite);
+		printf("----------------------------\n");
+	}
 	return cineon;
 }
 
+LogImageFile *cineonCreate(const char *filename, int width, int height, int bitsPerSample, const char *creator)
+{
+	CineonMainHeader header;
+	const char *shortFilename = 0;
+	/* unsigned char pad[6044]; */
 
-int
-cineonGetSize(const CineonFile* cineon, int* width, int* height, int* depth) {
-	*width = cineon->width;
-	*height = cineon->height;
-	*depth = cineon->depth;
-	return 0;
-}
-
-CineonFile*
-cineonCreate(const char* filename, int width, int height, int depth) {
-
-	/* Note: always write files in network order */
-	/* By the spec, it shouldn't matter, but ... */
-
-	CineonGenericHeader header;
-	const char* shortFilename = 0;
-
-	CineonFile* cineon = (CineonFile*)malloc(sizeof(CineonFile));
+	LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
 	if (cineon == 0) {
-		if (verbose) d_printf("Failed to malloc cineon file structure.\n");
+		if (verbose) printf("cineon: Failed to malloc cineon file structure.\n");
 		return 0;
 	}
 
-	memset(&header, 0, sizeof(header));
-
-	/* for close routine */
-	cineon->file = 0;
-	cineon->lineBuffer = 0;
-	cineon->pixelBuffer = 0;
-
-	cineon->file = BLI_fopen(filename, "wb");
-	if (cineon->file == 0) {
-		if (verbose) d_printf("Couldn't open file %s\n", filename);
-		cineonClose(cineon);
+	/* Only 10 bits Cineon are supported */
+	if (bitsPerSample != 10) {
+		if (verbose) printf("cineon: Only 10 bits Cineon are supported.\n");
+		logImageClose(cineon);
 		return 0;
 	}
-	cineon->reading = 0;
 
 	cineon->width = width;
 	cineon->height = height;
-	cineon->depth = depth;
-	cineon->bitsPerPixel = 10;
-	cineon->imageOffset = sizeof(CineonGenericHeader);
-
-	cineon->lineBufferLength = pixelsToLongs(cineon->width * cineon->depth);
-	cineon->lineBuffer = malloc(cineon->lineBufferLength * 4);
-	if (cineon->lineBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc line buffer of size %d\n", cineon->lineBufferLength * 4);
-		cineonClose(cineon);
-		return 0;
-	}
+	cineon->element[0].bitsPerSample = 10;
+	cineon->element[0].dataOffset = sizeof(CineonMainHeader);
+	cineon->element[0].maxValue = 1023;
+	cineon->isMSB = 1;
+	cineon->numElements = 1;
+	cineon->element[0].packing = 1;
+	cineon->depth = 3;
+	cineon->element[0].depth = 3;
+	cineon->element[0].descriptor = descriptor_RGB;
+	cineon->element[0].transfer = transfer_PrintingDensity;
+	cineon->element[0].refHighQuantity = 2.048f;
+	cineon->element[0].refLowQuantity = 0;
+	cineon->element[0].refLowData = 0;
+	cineon->element[0].refHighData = cineon->element[0].maxValue;
+	cineon->referenceWhite = 685.0f;
+	cineon->referenceBlack = 95.0f;
+	cineon->gamma = 1.7f;
 
-	cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short));
-	if (cineon->pixelBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n",
-				(cineon->width * cineon->depth) * (int)sizeof(unsigned short));
-		cineonClose(cineon);
-		return 0;
-	}
-	cineon->pixelBufferUsed = 0;
-
-	/* find trailing part of filename */
 	shortFilename = strrchr(filename, '/');
-	if (shortFilename == 0) {
+	if (shortFilename == 0)
 		shortFilename = filename;
-	}
-	else {
-		++shortFilename;
-	}
+	else
+		shortFilename++;
 
-	if (initCineonGenericHeader(cineon, &header, shortFilename) != 0) {
-		cineonClose(cineon);
+	cineon->file = BLI_fopen(filename, "wb");
+	if (cineon->file == 0) {
+		if (verbose) printf("cineon: Couldn't open file %s\n", filename);
+		logImageClose(cineon);
 		return 0;
 	}
 
+	fillCineonMainHeader(cineon, &header, shortFilename, creator);
+
 	if (fwrite(&header, sizeof(header), 1, cineon->file) == 0) {
-		if (verbose) d_printf("Couldn't write image header\n");
-		cineonClose(cineon);
+		if (verbose) printf("cineon: Couldn't write image header\n");
+		logImageClose(cineon);
 		return 0;
 	}
-	cineon->fileYPos = 0;
-
-	logImageGetByteConversionDefaults(&cineon->params);
-	setupLut(cineon);
-
-	cineon->getRow = 0;
-	cineon->setRow = &cineonSetRowBytes;
-	cineon->close = &cineonClose;
 
 	return cineon;
 }
-
-void
-cineonClose(CineonFile* cineon) {
-
-	if (cineon == 0) {
-		return;
-	}
-
-	if (cineon->file) {
-		fclose(cineon->file);
-		cineon->file = 0;
-	}
-
-	if (cineon->lineBuffer) {
-		free(cineon->lineBuffer);
-		cineon->lineBuffer = 0;
-	}
-
-	if (cineon->pixelBuffer) {
-		free(cineon->pixelBuffer);
-		cineon->pixelBuffer = 0;
-	}
-
-	free(cineon);
-}
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h
index ef992c5..9333743 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.h
+++ b/source/blender/imbuf/intern/cineon/cineonlib.h
@@ -1,68 +1,142 @@
 /*
- *	 Cineon image file format library definitions.
- *	 Also handles DPX files (almost)
+ * Cineon image file format library definitions.
+ * Also handles DPX files (almost)
  *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
+ * Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
-#ifndef __CINEONLIB_H__
-#define __CINEONLIB_H__
-
 /** \file blender/imbuf/intern/cineon/cineonlib.h
  *  \ingroup imbcineon
  */
 
-#include "logImageCore.h"
+
+#ifndef __CINEON_LIB_H__
+#define __CINEON_LIB_H__
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/*
- * Cineon image structure. You don't care what this is.
- */
+#include "logImageCore.h"
 
-typedef struct _Log_Image_File_t_ CineonFile;
+#define CINEON_FILE_MAGIC       0x802A5FD7
+#define CINEON_UNDEFINED_U8     0xFF
+#define CINEON_UNDEFINED_U16    0xFFFF
+#define CINEON_UNDEFINED_U32    0xFFFFFFFF
+#define CINEON_UNDEFINED_R32    0x7F800000
+#define CINEON_UNDEFINED_CHAR   0
 
-/* int functions return 0 for OK */
+typedef struct {
+	unsigned int    magic_num;
+	unsigned int    offset;
+	unsigned int    gen_hdr_size;
+	unsigned int    ind_hdr_size;
+	unsigned int    user_data_size;
+	unsigned int    file_size;
+	char            version[8];
+	char            file_name[100];
+	char            creation_date[12];
+	char            creation_time[12];
+	char            reserved[36];
+} CineonFileHeader;
 
-void cineonSetVerbose(int);
+typedef struct {
+	unsigned char   descriptor1;
+	unsigned char   descriptor2;
+	unsigned char   bits_per_sample;
+	unsigned char   filler;
+	unsigned int    pixels_per_line;
+	unsigned int    lines_per_image;
+	unsigned int    ref_low_data;
+	float           ref_low_quantity;
+	unsigned int    ref_high_data;
+	float           ref_high_quantity;
+} CineonElementHeader;
 
-CineonFile* cineonOpenFromMem(unsigned char *mem, unsigned int size);
+typedef struct {
+	unsigned char       orientation;
+	unsigned char       elements_per_image;
+	unsigned short      filler;
+	CineonElementHeader element[8];
+	float               white_point_x;
+	float               white_point_y;
+	float               red_primary_x;
+	float               red_primary_y;
+	float               green_primary_x;
+	float               green_primary_y;
+	float               blue_primary_x;
+	float               blue_primary_y;
+	char                label[200];
+	char                reserved[28];
+	unsigned char       interleave;
+	unsigned char       packing;
+	unsigned char       data_sign;
+	unsigned char       sense;
+	unsigned int        line_padding;
+	unsigned int        element_padding;
+	char                reserved2[20];
+} CineonImageHeader;
 
-CineonFile* cineonOpen(const char* filename);
-int cineonGetSize(const CineonFile* cineon, int* xsize, int* ysize, int* channels);
-CineonFile* cineonCreate(const char* filename, int xsize, int ysize, int channels);
-int cineonIsMemFileCineon(unsigned char *mem);
+typedef struct {
+	int     x_offset;
+	int     y_offset;
+	char    file_name[100];
+	char    creation_date[12];
+	char    creation_time[12];
+	char    input_device[64];
+	char    model_number[32];
+	char    input_serial_number[32];
+	float   x_input_samples_per_mm;
+	float   y_input_samples_per_mm;
+	float   input_device_gamma;
+	char    reserved[40];
+} CineonOriginationHeader;
 
-/* get/set scanline of converted bytes */
-int cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int y);
-int cineonSetRowBytes(CineonFile* cineon, const unsigned short* row, int y);
+typedef struct {
+	unsigned char   film_code;
+	unsigned char   film_type;
+	unsigned char   edge_code_perforation_offset;
+	unsigned char   filler;
+	unsigned int    prefix;
+	unsigned int    count;
+	char            format[32];
+	unsigned int    frame_position;
+	float           frame_rate;
+	char            attribute[32];
+	char            slate[200];
+	char            reserved[740];
+} CineonFilmHeader;
 
-/* get/set scanline of unconverted shorts */
-int cineonGetRow(CineonFile* cineon, unsigned short* row, int y);
-int cineonSetRow(CineonFile* cineon, const unsigned short* row, int y);
+typedef struct {
+	CineonFileHeader        fileHeader;
+	CineonImageHeader       imageHeader;
+	CineonOriginationHeader originationHeader;
+	CineonFilmHeader        filmHeader;
+} CineonMainHeader;
 
-/* closes file and deletes data */
-void cineonClose(CineonFile* cineon);
+void cineonSetVerbose(int);
+LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
+LogImageFile *cineonCreate(const char *filename, int width, int height, int bitsPerSample, const char *creator);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* __CINEONLIB_H__ */
+#endif  /* __CINEON_LIB_H__ */
diff --git a/source/blender/imbuf/intern/cineon/dpxfile.h b/source/blender/imbuf/intern/cineon/dpxfile.h
index e1d9526..e69de29 100644
--- a/source/blender/imbuf/intern/cineon/dpxfile.h
+++ b/source/blender/imbuf/intern/cineon/dpxfile.h
@@ -1,128 +0,0 @@
-/*
- *	 Cineon image file format library definitions.
- *	 Dpx file format structures.
- *
- *	 This header file contains private details.
- *	 User code should generally use cineonlib.h only.
- *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
- *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
- *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
- *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __DPXFILE_H__
-#define __DPXFILE_H__
-
-/** \file blender/imbuf/intern/cineon/dpxfile.h
- *  \ingroup imbcineon
- */
-
-#include "logImageCore.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-		U32		magic_num;				/* magic number */
-		U32		offset;						/* offset to image data in bytes */
-		ASCII vers[8];					/* which header format version is being used (v1.0) */
-		U32		file_size;				/* file size in bytes */
-		U32		ditto_key;				/* I bet some people use this */
-		U32		gen_hdr_size;			/* generic header length in bytes */
-		U32		ind_hdr_size;			/* industry header length in bytes */
-		U32		user_data_size;		/* user-defined data length in bytes */
-		ASCII file_name[100];		/* image file name */
-		ASCII create_date[24];	/* file creation date, yyyy:mm:dd:hh:mm:ss:LTZ */
-		ASCII creator[100];
-		ASCII project[200];
-		ASCII copyright[200];
-		U32		key;							/* encryption key, FFFFFFF = unencrypted */
-		ASCII Reserved[104];		/* reserved field TBD (need to pad) */
-} DpxFileInformation;
-
-typedef struct {
-		U32		 signage;
-		U32		 ref_low_data;		 /* reference low data code value */
-		R32		 ref_low_quantity; /* reference low quantity represented */
-		U32		 ref_high_data;		 /* reference high data code value */
-		R32		 ref_high_quantity;/* reference high quantity represented */
-		U8		 designator1;
-		U8		 transfer_characteristics;
-		U8		 colorimetry;
-		U8		 bits_per_pixel;
-		U16		 packing;
-		U16		 encoding;
-		U32		 data_offset;
-		U32		 line_padding;
-		U32		 channel_padding;
-		ASCII	 description[32];
-} DpxChannelInformation;
-
-typedef struct {
-		U16		 orientation;
-		U16		 channels_per_image;
-		U32		 pixels_per_line;
-		U32		 lines_per_image;
-		DpxChannelInformation channel[8];
-		ASCII	 reserved[52];
-} DpxImageInformation;
-
-typedef struct {
-		U32		x_offset;
-		U32		y_offset;
-		R32		x_centre;
-		R32		y_centre;
-		U32		x_original_size;
-		U32		y_original_size;
-		ASCII file_name[100];
-		ASCII creation_time[24];
-		ASCII input_device[32];
-		ASCII input_serial_number[32];
-		U16		border_validity[4];
-		U32		pixel_aspect_ratio[2]; /* h:v */
-		ASCII reserved[28];
-} DpxOriginationInformation;
-
-typedef struct {
-		ASCII film_manufacturer_id[2];
-		ASCII film_type[2];
-		ASCII edge_code_perforation_offset[2];
-		ASCII edge_code_prefix[6];
-		ASCII edge_code_count[4];
-		ASCII film_format[32];
-		U32		frame_position;
-		U32		sequence_length;
-		U32		held_count;
-		R32		frame_rate;
-		R32		shutter_angle;
-		ASCII frame_identification[32];
-		ASCII slate_info[100];
-		ASCII reserved[56];
-} DpxMPIInformation;
-
-typedef struct {
-	DpxFileInformation fileInfo;
-	DpxImageInformation imageInfo;
-	DpxOriginationInformation originInfo;
-	DpxMPIInformation filmHeader;
-} DpxMainHeader;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __DPXFILE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index c113822..4c9b5e6 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -1,21 +1,23 @@
 /*
- *	 Dpx image file format library routines.
+ * Dpx image file format library routines.
  *
- *	 Copyright 1999 - 2002 David Hodson <hodsond at acm.org>
+ * Copyright 1999 - 2002 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
@@ -23,689 +25,445 @@
  *  \ingroup imbcineon
  */
 
-#include "dpxfile.h"
+
 #include "dpxlib.h"
+#include "logmemfile.h"
 
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
-#include <time.h>				 /* strftime() */
+#include <time.h>
 #include <sys/types.h>
-#ifdef WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>	 /* htonl() */
-#endif
-#include <string.h>			 /* memset */
-#include "cin_debug_stuff.h"
-#include "logmemfile.h"
-#include "BLI_fileops.h"
-
-static void
-fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) {
-
-	(void)dpx; /* unused */
-	
-	chan->signage = 0;
-	chan->ref_low_data = htonl(0);
-	chan->ref_low_quantity = htonf(0.0);
-	chan->ref_high_data = htonl(1023);
-	chan->ref_high_quantity = htonf(2.046);
-	chan->designator1 = des;
-	chan->transfer_characteristics = 0;
-	chan->colorimetry = 0;
-	chan->bits_per_pixel = 10;
-	chan->packing = htons(1);
-	chan->encoding = 0;
-	chan->data_offset = 0;
-	chan->line_padding = htonl(0);
-	chan->channel_padding = htonl(0);
-	chan->description[0] = 0;
-}
-
-static void
-dumpDpxChannelInfo(DpxChannelInformation* chan) {
-	d_printf("	Signage %ld", (intptr_t)ntohl(chan->signage));
-	d_printf("	Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data));
-	d_printf("	Ref low quantity %f\n", ntohf(chan->ref_low_quantity));
-	d_printf("	Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data));
-	d_printf("	Ref high quantity %f\n", ntohf(chan->ref_high_quantity));
-	d_printf("	Designator1: %d,", chan->designator1);
-	d_printf("	Bits per pixel %d\n", chan->bits_per_pixel);
-	d_printf("	Packing: %d,", ntohs(chan->packing));
-	d_printf("	Data Offset: %ld,", (intptr_t)ntohl(chan->data_offset));
-}
-
-static void
-fillDpxFileInfo(
-	DpxFile* dpx, DpxFileInformation* fileInfo, const char* filename) {
-
-	time_t fileClock;
-	struct tm* fileTime;
-
-	/* Note: always write files in network order */
-	/* By the spec, it shouldn't matter, but ... */
-
-	fileInfo->magic_num = htonl(DPX_FILE_MAGIC);
-	fileInfo->offset = htonl(dpx->imageOffset);
-	strcpy(fileInfo->vers, "v1.0");
-	fileInfo->file_size = htonl(dpx->imageOffset +
-		pixelsToLongs(dpx->height * dpx->width * dpx->depth) * 4);
-	fileInfo->ditto_key = 0;
-	fileInfo->gen_hdr_size = htonl(
-		sizeof(DpxFileInformation) +
-		sizeof(DpxImageInformation) +
-		sizeof(DpxOriginationInformation));
-	fileInfo->ind_hdr_size = htonl(sizeof(DpxMPIInformation));
-	fileInfo->user_data_size = 0;
-	strncpy(fileInfo->file_name, filename, 99);
-	fileInfo->file_name[99] = 0;
+#include <string.h>
 
-	fileClock = time(0);
-	fileTime = localtime(&fileClock);
-	strftime(fileInfo->create_date, 24, "%Y:%m:%d:%H:%M:%S%Z", fileTime);
-	/* Question: is %Z in strftime guaranteed to return 3 chars? */
-	fileInfo->create_date[23] = 0;
-
-	strcpy(fileInfo->creator, "David's DPX writer");
-	fileInfo->project[0] = 0;
-	fileInfo->copyright[0] = 0;
-	fileInfo->key = 0xFFFFFFFF; /* same in any byte order */
-}
+#include "BLI_fileops.h"
+#include "BLI_math_base.h"
+#include "BLI_utildefines.h"
 
-static void
-dumpDpxFileInfo(DpxFileInformation* fileInfo) {
-	d_printf("\n--File Information--\n");
-	d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num));
-	d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->offset));
-	d_printf("Version \"%s\"\n", fileInfo->vers);
-	d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size));
-	d_printf("Ditto key %ld\n", (intptr_t)ntohl(fileInfo->ditto_key));
-	d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size));
-	d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size));
-	d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size));
-	d_printf("File name \"%s\"\n", fileInfo->file_name);
-	d_printf("Creation date \"%s\"\n", fileInfo->create_date);
-	d_printf("Creator \"%s\"\n", fileInfo->creator);
-	d_printf("Project \"%s\"\n", fileInfo->project);
-	d_printf("Copyright \"%s\"\n", fileInfo->copyright);
-	d_printf("Key %ld\n", (intptr_t)ntohl(fileInfo->key));
-}
+#include "MEM_guardedalloc.h"
 
-static void
-fillDpxImageInfo(
-	DpxFile* dpx, DpxImageInformation* imageInfo) {
-	imageInfo->orientation = 0;
-	imageInfo->channels_per_image = htons(1);
-	imageInfo->pixels_per_line = htonl(dpx->width);
-	imageInfo->lines_per_image = htonl(dpx->height);
+/*
+ * For debug purpose
+ */
 
-	if (dpx->depth == 1) {
-		fillDpxChannelInfo(dpx, &imageInfo->channel[0], 0);
+static int verbose = 0;
 
-	}
-	else if (dpx->depth == 3) {
-		fillDpxChannelInfo(dpx, &imageInfo->channel[0], 50);
-	}
+void dpxSetVerbose(int verbosity) {
+	verbose = verbosity;
 }
 
-static void
-dumpDpxImageInfo(DpxImageInformation* imageInfo) {
 
-	int n;
-	int i;
-	d_printf("\n--Image Information--\n");
-	d_printf("Image orientation %d,", ntohs(imageInfo->orientation));
-	n = ntohs(imageInfo->channels_per_image);
-	d_printf("Channels %d\n", n);
-	d_printf("Pixels per line %ld\n", (intptr_t)ntohl(imageInfo->pixels_per_line));
-	d_printf("Lines per image %ld\n", (intptr_t)ntohl(imageInfo->lines_per_image));
-	for (i = 0; i < n; ++i) {
-		d_printf("	--Channel %d--\n", i);
-		dumpDpxChannelInfo(&imageInfo->channel[i]);
-	}
-}
+/*
+ * Headers
+ */
 
-static void
-fillDpxOriginationInfo(
-	DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo)
+static void fillDpxMainHeader(LogImageFile *dpx, DpxMainHeader *header, const char *filename, const char *creator)
 {
-	/* unused */
-	(void)dpx;
-	(void)originInfo;
-	(void)fileInfo;
-}
-
-static void
-dumpDpxOriginationInfo(DpxOriginationInformation* originInfo) {
-	d_printf("\n--Origination Information--\n");
-	d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset));
-	d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset));
-	d_printf("X centre %f\n", ntohf(originInfo->x_centre));
-	d_printf("Y centre %f\n", ntohf(originInfo->y_centre));
-	d_printf("Original X %ld\n", (intptr_t)ntohl(originInfo->x_original_size));
-	d_printf("Original Y %ld\n", (intptr_t)ntohl(originInfo->y_original_size));
-	d_printf("File name \"%s\"\n", originInfo->file_name);
-	d_printf("Creation time \"%s\"\n", originInfo->creation_time);
-	d_printf("Input device \"%s\"\n", originInfo->input_device);
-	d_printf("Serial number \"%s\"\n", originInfo->input_serial_number);
-}
+	time_t fileClock;
+	struct tm *fileTime;
 
-static void
-initDpxMainHeader(DpxFile* dpx, DpxMainHeader* header, const char* shortFilename) {
 	memset(header, 0, sizeof(DpxMainHeader));
-	fillDpxFileInfo(dpx, &header->fileInfo, shortFilename);
-	fillDpxImageInfo(dpx, &header->imageInfo);
-	fillDpxOriginationInfo(dpx, &header->originInfo, &header->fileInfo);
-#if 0
-	fillDpxMPIInfo(dpx, &header->filmHeader);
-#endif
-}
-
-static void
-dumpDpxMainHeader(DpxMainHeader* header) {
-	dumpDpxFileInfo(&header->fileInfo);
-	dumpDpxImageInfo(&header->imageInfo);
-	dumpDpxOriginationInfo(&header->originInfo);
-#if 0
-	dumpDpxMPIInformation(&header->filmHeader);
-#endif
-}
-
-static int verbose = 0;
-void
-dpxSetVerbose(int verbosity) {
-	verbose = verbosity;
-}
-
-static void
-verboseMe(DpxFile* dpx) {
-
-	d_printf("size %d x %d x %d\n", dpx->width, dpx->height, dpx->depth);
-	d_printf("ImageStart %d, lineBufferLength %d, implied length %d\n",
-		dpx->imageOffset, dpx->lineBufferLength * 4,
-		dpx->imageOffset + pixelsToLongs(dpx->width * dpx->depth * dpx->height) * 4);
-}
-
-int
-dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) {
-
-	/* Note: this code is bizarre because DPX files can wrap */
-	/* packed longwords across line boundaries!!!! */
-
-	size_t readLongs;
-	unsigned int longIndex;
-	int numPixels = dpx->width * dpx->depth;
-	int pixelIndex;
-
-	/* only seek if not reading consecutive lines */
-	/* this is not quite right yet, need to account for leftovers */
-	if (y != dpx->fileYPos) {
-		int lineOffset = pixelsToLongs(y * dpx->width * dpx->depth) * 4;
-		if (verbose) d_printf("Seek in getRowBytes\n");
-		if (logimage_fseek(dpx, dpx->imageOffset + lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, dpx->imageOffset + lineOffset);
-			return 1;
-		}
-		dpx->fileYPos = y;
-	}
-
-	/* read enough longwords */
-	readLongs = pixelsToLongs(numPixels - dpx->pixelBufferUsed);
-	if (logimage_fread(dpx->lineBuffer, 4, readLongs, dpx) != readLongs) {
-		if (verbose) d_printf("Couldn't read line %d length %d\n", y, (int)readLongs * 4);
-		return 1;
-	}
-	++dpx->fileYPos;
-
-	/* convert longwords to pixels */
-	pixelIndex = dpx->pixelBufferUsed;
-
-	/* this is just strange */
-	if (dpx->depth == 1) {
-		for (longIndex = 0; longIndex < readLongs; ++longIndex) {
-			unsigned int t = ntohl(dpx->lineBuffer[longIndex]);
-			dpx->pixelBuffer[pixelIndex] = t & 0x3ff;
-			t = t >> 10;
-			dpx->pixelBuffer[pixelIndex+1] = t & 0x3ff;
-			t = t >> 10;
-			dpx->pixelBuffer[pixelIndex+2] = t & 0x3ff;
-			pixelIndex += 3;
-		}
-	}
-	else /* if (dpx->depth == 3) */ {
-		for (longIndex = 0; longIndex < readLongs; ++longIndex) {
-			unsigned int t = ntohl(dpx->lineBuffer[longIndex]);
-			t = t >> 2;
-			dpx->pixelBuffer[pixelIndex+2] = t & 0x3ff;
-			t = t >> 10;
-			dpx->pixelBuffer[pixelIndex+1] = t & 0x3ff;
-			t = t >> 10;
-			dpx->pixelBuffer[pixelIndex] = t & 0x3ff;
-			pixelIndex += 3;
-		}
-	}
-	dpx->pixelBufferUsed = pixelIndex;
-
-	/* extract required pixels */
-	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if (dpx->params.doLogarithm)
-			row[pixelIndex] = dpx->lut10_16[dpx->pixelBuffer[pixelIndex]];
-		else
-			row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6;
-	}
-
-	/* save remaining pixels */
-	while (pixelIndex < dpx->pixelBufferUsed) {
-		dpx->pixelBuffer[pixelIndex - numPixels] = dpx->pixelBuffer[pixelIndex];
-		++pixelIndex;
-	}
-	dpx->pixelBufferUsed -= numPixels;
 
-	/* done! */
-	return 0;
-}
-
-int
-dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) {
-
-	/* Note: this code is bizarre because DPX files can wrap */
-	/* packed longwords across line boundaries!!!! */
-
-	size_t writeLongs;
-	int longIndex;
-	int numPixels = dpx->width * dpx->depth;
-	int pixelIndex;
-	int pixelIndex2;
-
-	/* only seek if not reading consecutive lines */
-	/* this is not quite right yet */
-	if (y != dpx->fileYPos) {
-		int lineOffset = pixelsToLongs(y * dpx->width * dpx->depth) * 4;
-		if (verbose) d_printf("Seek in getRowBytes\n");
-		if (logimage_fseek(dpx, dpx->imageOffset + lineOffset, SEEK_SET) != 0) {
-			if (verbose) d_printf("Couldn't seek to line %d at %d\n", y, dpx->imageOffset + lineOffset);
-			return 1;
-		}
-		dpx->fileYPos = y;
-	}
-
-	/* put new pixels into pixelBuffer */
-	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if (dpx->params.doLogarithm)
-			dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut16_16[row[pixelIndex]];
-		else
-			dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6;
-	}
-	dpx->pixelBufferUsed += numPixels;
-
-	/* pack into longwords */
-	writeLongs = dpx->pixelBufferUsed / 3;
-	/* process whole line at image end */
-	if (dpx->fileYPos == (dpx->height - 1)) {
-		writeLongs = pixelsToLongs(dpx->pixelBufferUsed);
-	}
-	pixelIndex = 0;
-	if (dpx->depth == 1) {
-		for (longIndex = 0; longIndex < writeLongs; ++longIndex) {
-			unsigned int t = dpx->pixelBuffer[pixelIndex] |
-					(dpx->pixelBuffer[pixelIndex+1] << 10) |
-					(dpx->pixelBuffer[pixelIndex+2] << 20);
-			dpx->lineBuffer[longIndex] = htonl(t);
-			pixelIndex += 3;
-		}
-	}
-	else {
-		for (longIndex = 0; longIndex < writeLongs; ++longIndex) {
-			unsigned int t = dpx->pixelBuffer[pixelIndex+2] << 2 |
-					(dpx->pixelBuffer[pixelIndex+1] << 12) |
-					(dpx->pixelBuffer[pixelIndex] << 22);
-			dpx->lineBuffer[longIndex] = htonl(t);
-			pixelIndex += 3;
-		}
-	}
-
-	/* write them */
-	if (fwrite(dpx->lineBuffer, 4, writeLongs, dpx->file) != writeLongs) {
-		if (verbose) d_printf("Couldn't write line %d length %d\n", y, (int)writeLongs * 4);
-		return 1;
-	}
-	++dpx->fileYPos;
-
-	/* save remaining pixels */
-	pixelIndex2 = 0;
-	while (pixelIndex < dpx->pixelBufferUsed) {
-		dpx->pixelBuffer[pixelIndex2] = dpx->pixelBuffer[pixelIndex];
-		++pixelIndex;
-		++pixelIndex2;
-	}
-	dpx->pixelBufferUsed = pixelIndex2;
-
-	return 0;
+	/* --- File header --- */
+	header->fileHeader.magic_num = swap_uint(DPX_FILE_MAGIC, dpx->isMSB);
+	header->fileHeader.offset = swap_uint(dpx->element[0].dataOffset, dpx->isMSB);
+	strcpy(header->fileHeader.version, "v2.0");
+	header->fileHeader.file_size = swap_uint(dpx->element[0].dataOffset + dpx->height * getRowLength(dpx->width, dpx->element[0]), dpx->isMSB);
+	header->fileHeader.ditto_key = 0;
+	header->fileHeader.gen_hdr_size = swap_uint(sizeof(DpxFileHeader) + sizeof(DpxImageHeader) + sizeof(DpxOrientationHeader), dpx->isMSB);
+	header->fileHeader.ind_hdr_size = swap_uint(sizeof(DpxFilmHeader) + sizeof(DpxTelevisionHeader), dpx->isMSB);
+	header->fileHeader.user_data_size = DPX_UNDEFINED_U32;
+	strncpy(header->fileHeader.file_name, filename, 99);
+	header->fileHeader.file_name[99] = 0;
+	fileClock = time(0);
+	fileTime = localtime(&fileClock);
+	strftime(header->fileHeader.creation_date, 24, "%Y:%m:%d:%H:%M:%S%Z", fileTime);
+	header->fileHeader.creation_date[23] = 0;
+	strncpy(header->fileHeader.creator, creator, 99);
+	header->fileHeader.creator[99] = 0;
+	header->fileHeader.project[0] = 0;
+	header->fileHeader.copyright[0] = 0;
+	header->fileHeader.key = 0xFFFFFFFF;
+
+	/* --- Image header --- */
+	header->imageHeader.orientation = 0;
+	header->imageHeader.elements_per_image = swap_ushort(1, dpx->isMSB);
+	header->imageHeader.pixels_per_line = swap_uint(dpx->width, dpx->isMSB);
+	header->imageHeader.lines_per_element = swap_uint(dpx->height, dpx->isMSB);
+
+	/* Fills element */
+	header->imageHeader.element[0].data_sign = 0;
+	header->imageHeader.element[0].ref_low_data = swap_uint(dpx->element[0].refLowData, dpx->isMSB);
+	header->imageHeader.element[0].ref_low_quantity = swap_float(dpx->element[0].refLowQuantity, dpx->isMSB);
+	header->imageHeader.element[0].ref_high_data = swap_uint(dpx->element[0].refHighData, dpx->isMSB);
+	header->imageHeader.element[0].ref_high_quantity = swap_float(dpx->element[0].refHighQuantity, dpx->isMSB);
+	header->imageHeader.element[0].descriptor = dpx->element[0].descriptor;
+	header->imageHeader.element[0].transfer = dpx->element[0].transfer;
+	header->imageHeader.element[0].colorimetric = 0;
+	header->imageHeader.element[0].bits_per_sample = dpx->element[0].bitsPerSample;
+	header->imageHeader.element[0].packing = swap_ushort(dpx->element[0].packing, dpx->isMSB);
+	header->imageHeader.element[0].encoding = 0;
+	header->imageHeader.element[0].data_offset = swap_uint(dpx->element[0].dataOffset, dpx->isMSB);
+	header->imageHeader.element[0].line_padding = 0;
+	header->imageHeader.element[0].element_padding = 0;
+	header->imageHeader.element[0].description[0] = 0;
+
+	/* --- Orientation header --- */
+	/* we leave it blank */
+
+	/* --- Television header --- */
+	header->televisionHeader.time_code = DPX_UNDEFINED_U32;
+	header->televisionHeader.user_bits = DPX_UNDEFINED_U32;
+	header->televisionHeader.interlace = DPX_UNDEFINED_U8;
+	header->televisionHeader.field_number = DPX_UNDEFINED_U8;
+	header->televisionHeader.video_signal = DPX_UNDEFINED_U8;
+	header->televisionHeader.padding = DPX_UNDEFINED_U8;
+	header->televisionHeader.horizontal_sample_rate = DPX_UNDEFINED_R32;
+	header->televisionHeader.vertical_sample_rate = DPX_UNDEFINED_R32;
+	header->televisionHeader.frame_rate = DPX_UNDEFINED_R32;
+	header->televisionHeader.time_offset = DPX_UNDEFINED_R32;
+	header->televisionHeader.gamma = swap_float(dpx->gamma, dpx->isMSB);
+	header->televisionHeader.black_level = swap_float(dpx->referenceBlack, dpx->isMSB);
+	header->televisionHeader.black_gain = DPX_UNDEFINED_R32;
+	header->televisionHeader.breakpoint = DPX_UNDEFINED_R32;
+	header->televisionHeader.white_level = swap_float(dpx->referenceWhite, dpx->isMSB);
+	header->televisionHeader.integration_times = DPX_UNDEFINED_R32;
 }
 
-#define LFMEMFILE	0
-#define LFREALFILE	1
-
-static DpxFile* 
-intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
-
+LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize)
+{
 	DpxMainHeader header;
-	const char *filename = bytestuff;
-	DpxFile* dpx = (DpxFile*)malloc(sizeof(DpxFile));
-	
+	LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
+	char *filename = (char *)byteStuff;
+	int i;
+
 	if (dpx == 0) {
-		if (verbose) d_printf("Failed to malloc dpx file structure.\n");
+		if (verbose) printf("DPX: Failed to malloc dpx file structure.\n");
 		return 0;
 	}
 
+	/* zero the header */
+	memset(&header, 0, sizeof(DpxMainHeader));
+
 	/* for close routine */
 	dpx->file = 0;
-	dpx->lineBuffer = 0;
-	dpx->pixelBuffer = 0;
 
-	if (mode == LFREALFILE) {
-		filename = bytestuff;
+	if (fromMemory == 0) {
+		/* byteStuff is then the filename */
 		dpx->file = BLI_fopen(filename, "rb");
-		if (dpx->file == 0) {	
-			if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
-			dpxClose(dpx);
+		if (dpx->file == 0) {
+			if (verbose) printf("DPX: Failed to open file \"%s\".\n", filename);
+			logImageClose(dpx);
 			return 0;
 		}
-		dpx->membuffer = 0;
-		dpx->memcursor = 0;
-		dpx->membuffersize = 0;
+		/* not used in this case */
+		dpx->memBuffer = 0;
+		dpx->memCursor = 0;
+		dpx->memBufferSize = 0;
 	}
-	else if (mode == LFMEMFILE) {
-		dpx->membuffer = (unsigned char *)bytestuff;
-		dpx->memcursor = (unsigned char *)bytestuff;
-		dpx->membuffersize = bufsize;
+	else {
+		dpx->memBuffer = (unsigned char *)byteStuff;
+		dpx->memCursor = (unsigned char *)byteStuff;
+		dpx->memBufferSize = bufferSize;
 	}
-	
-	dpx->reading = 1;
 
 	if (logimage_fread(&header, sizeof(header), 1, dpx) == 0) {
-		if (verbose) d_printf("Not enough data for header in \"%s\".\n", filename);
-		dpxClose(dpx);
+		if (verbose) printf("DPX: Not enough data for header in \"%s\".\n", byteStuff);
+		logImageClose(dpx);
 		return 0;
 	}
 
-	/* let's assume dpx files are always network order */
-	if (header.fileInfo.magic_num != ntohl(DPX_FILE_MAGIC)) {
-		if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n",
-			(uintptr_t)ntohl(header.fileInfo.magic_num), filename);
-		dpxClose(dpx);
-		return 0;
+	/* endianness determination */
+	if (header.fileHeader.magic_num == swap_uint(DPX_FILE_MAGIC, 1)) {
+		dpx->isMSB = 1;
+		if (verbose) printf("DPX: File is MSB.\n");
 	}
-
-	if (ntohs(header.imageInfo.channel[0].packing) != 1) {
-		if (verbose) d_printf("Unknown packing %d\n", header.imageInfo.channel[0].packing);
-		dpxClose(dpx);
+	else if (header.fileHeader.magic_num == DPX_FILE_MAGIC) {
+		dpx->isMSB = 0;
+		if (verbose) printf("DPX: File is LSB.\n");
+	}
+	else {
+		if (verbose) printf("DPX: Bad magic number %lu in \"%s\".\n",
+		                    (uintptr_t)header.fileHeader.magic_num, byteStuff);
+		logImageClose(dpx);
 		return 0;
 	}
 
+	dpx->srcFormat = format_DPX;
+	dpx->numElements = swap_ushort(header.imageHeader.elements_per_image, dpx->isMSB);
+	dpx->width = swap_uint(header.imageHeader.pixels_per_line, dpx->isMSB);
+	dpx->height = swap_uint(header.imageHeader.lines_per_element, dpx->isMSB);
+	dpx->depth = 0;
+
+	for (i = 0; i < dpx->numElements; i++) {
+		dpx->element[i].descriptor = header.imageHeader.element[i].descriptor;
+
+		switch (dpx->element[i].descriptor) {
+			case descriptor_Red:
+			case descriptor_Green:
+			case descriptor_Blue:
+			case descriptor_Alpha:
+			case descriptor_Luminance:
+			case descriptor_Chrominance:
+				dpx->depth++;
+				dpx->element[i].depth = 1;
+				break;
+
+			case descriptor_CbYCrY:
+				dpx->depth += 2;
+				dpx->element[i].depth = 2;
+				break;
+
+			case descriptor_RGB:
+			case descriptor_CbYCr:
+			case descriptor_CbYACrYA:
+				dpx->depth += 3;
+				dpx->element[i].depth = 3;
+				break;
+
+			case descriptor_RGBA:
+			case descriptor_ABGR:
+			case descriptor_CbYCrA:
+				dpx->depth += 4;
+				dpx->element[i].depth = 4;
+				break;
+
+			case descriptor_Depth:
+			case descriptor_Composite:
+				/* unsupported */
+				break;
+		}
 
-	dpx->width = ntohl(header.imageInfo.pixels_per_line);
-	dpx->height = ntohl(header.imageInfo.lines_per_image);
-	dpx->depth = ntohs(header.imageInfo.channels_per_image);
-	/* Another DPX vs Cineon wierdness */
-	if (dpx->depth == 1) {
-		switch (header.imageInfo.channel[0].designator1) {
-		case 50: dpx->depth = 3; break;
-		case 51: dpx->depth = 4; break;
-		case 52: dpx->depth = 4; break;
-		default: break;
+		if (dpx->depth == 0 || dpx->depth > 4) {
+			if (verbose) printf("DPX: Unsupported image depth: %d\n", dpx->depth);
+			logImageClose(dpx);
+			return 0;
 		}
-	}
-	/* dpx->bitsPerPixel = 10; */
-	dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
-	if (dpx->bitsPerPixel != 10) {
-		if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel);
-		dpxClose(dpx);
-		return 0;
-	}
 
-	dpx->imageOffset = ntohl(header.fileInfo.offset);
-	dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
-	dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
-	if (dpx->lineBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc line buffer of size %d\n", dpx->lineBufferLength * 4);
-		dpxClose(dpx);
-		return 0;
-	}
+		dpx->element[i].bitsPerSample = header.imageHeader.element[i].bits_per_sample;
+		dpx->element[i].maxValue = powf(2, dpx->element[i].bitsPerSample) - 1.0f;
+		dpx->element[i].packing = swap_ushort(header.imageHeader.element[i].packing, dpx->isMSB);
 
-	/* could have 2 pixels left over */
-	dpx->pixelBuffer = malloc((dpx->lineBufferLength * 3 + 2) * sizeof(unsigned short));
-	if (dpx->pixelBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n",
-				(dpx->width * dpx->depth + 2 + 2) * (int)sizeof(unsigned short));
-		dpxClose(dpx);
-		return 0;
-	}
-	dpx->pixelBufferUsed = 0;
+		/* Sometimes, the offset is not set correctly in the header */
+		dpx->element[i].dataOffset = swap_uint(header.imageHeader.element[i].data_offset, dpx->isMSB);
+		if (dpx->element[i].dataOffset == 0 && dpx->numElements == 1)
+			dpx->element[i].dataOffset = swap_uint(header.fileHeader.offset, dpx->isMSB);
 
-	if (logimage_fseek(dpx, dpx->imageOffset, SEEK_SET) != 0) {
-		if (verbose) d_printf("Couldn't seek to image data start at %d\n", dpx->imageOffset);
-		dpxClose(dpx);
-		return 0;
-	}
-	dpx->fileYPos = 0;
-
-	logImageGetByteConversionDefaults(&dpx->params);
-	/* The SMPTE define this code:
-	 *  0 - User-defined
-	 *  1 - Printing density
-	 *  2 - Linear
-	 *  3 - Logarithmic
-	 *  4 - Unspecified video
-	 *  5 - SMPTE 240M
-	 *  6 - CCIR 709-1
-	 *  7 - CCIR 601-2 system B or G
-	 *  8 - CCIR 601-2 system M
-	 *  9 - NTSC composite video
-	 *  10 - PAL composite video
-	 *  11 - Z linear
-	 *  12 - homogeneous
-	 *
-	 * Note that transfer_characteristics is U8, don't need
-	 * check the byte order.
-	 */
-	
-	switch (header.imageInfo.channel[0].transfer_characteristics) {
-		case 1:
-		case 2: /* linear */
-			dpx->params.doLogarithm= 0;
-			break;
-		
-		case 3:
-			dpx->params.doLogarithm= 1;
-			break;
-		
-		/* TODO - Unsupported, but for now just load them,
-		 * colors may look wrong, but can solve color conversion later
-		 */
-		case 4: 
-		case 5:
-		case 6:
-		case 7:
-		case 8:
-		case 9:
-		case 10:
-		case 11:
-		case 12:
-			if (verbose) d_printf("Un-supported Transfer Characteristics: %d using linear color conversion\n", header.imageInfo.channel[0].transfer_characteristics);
-			dpx->params.doLogarithm= 0;
-			break;
-		default:
-			if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
-			dpxClose(dpx);
+		if (dpx->element[i].dataOffset == 0) {
+			if (verbose) printf("DPX: Image header is corrupted.\n");
+			logImageClose(dpx);
 			return 0;
-			break;
-	}
-	setupLut(dpx);
-
-	dpx->getRow = &dpxGetRowBytes;
-	dpx->setRow = 0;
-	dpx->close = &dpxClose;
+		}
 
-	if (verbose) {
-		verboseMe(dpx);
+		dpx->element[i].transfer = header.imageHeader.element[i].transfer;
+
+		/* if undefined, assign default */
+		dpx->element[i].refLowData = swap_uint(header.imageHeader.element[i].ref_low_data, dpx->isMSB);
+		dpx->element[i].refLowQuantity = swap_float(header.imageHeader.element[i].ref_low_quantity, dpx->isMSB);
+		dpx->element[i].refHighData = swap_uint(header.imageHeader.element[i].ref_high_data, dpx->isMSB);
+		dpx->element[i].refHighQuantity = swap_float(header.imageHeader.element[i].ref_high_quantity, dpx->isMSB);
+
+		switch (dpx->element[i].descriptor) {
+			case descriptor_Red:
+			case descriptor_Green:
+			case descriptor_Blue:
+			case descriptor_Alpha:
+			case descriptor_RGB:
+			case descriptor_RGBA:
+			case descriptor_ABGR:
+				if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+					dpx->element[i].refLowData = 0;
+
+				if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+					dpx->element[i].refHighData = (unsigned int)dpx->element[i].maxValue;
+
+				if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
+					dpx->element[i].refLowQuantity = 0.0f;
+
+				if (dpx->element[i].refHighQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refHighQuantity)) {
+					if (dpx->element[i].transfer == transfer_PrintingDensity || dpx->element[i].transfer == transfer_Logarithmic)
+						dpx->element[i].refHighQuantity = 2.048f;
+					else
+						dpx->element[i].refHighQuantity = dpx->element[i].maxValue;
+				}
+
+				break;
+
+			case descriptor_Luminance:
+			case descriptor_Chrominance:
+			case descriptor_CbYCrY:
+			case descriptor_CbYCr:
+			case descriptor_CbYACrYA:
+			case descriptor_CbYCrA:
+				if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+					dpx->element[i].refLowData = 16.0f / 255.0f * dpx->element[i].maxValue;
+
+				if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+					dpx->element[i].refHighData = 235.0f / 255.0f * dpx->element[i].maxValue;
+
+				if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
+					dpx->element[i].refLowQuantity = 0.0f;
+
+				if (dpx->element[i].refHighQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refHighQuantity))
+					dpx->element[i].refHighQuantity = 0.7f;
+
+				break;
+
+			default:
+				break;
+		}
 	}
 
-	return dpx;
-}
-
-DpxFile* 
-dpxOpen(const char *filename) {
-	return intern_dpxOpen(LFREALFILE, filename, 0);
-}
+	dpx->referenceBlack = swap_float(header.televisionHeader.black_level, dpx->isMSB);
+	dpx->referenceWhite = swap_float(header.televisionHeader.white_level, dpx->isMSB);
+	dpx->gamma = swap_float(header.televisionHeader.gamma, dpx->isMSB);
 
-DpxFile* 
-dpxOpenFromMem(unsigned char *buffer, unsigned int size) {
-	return intern_dpxOpen(LFMEMFILE, (const char *) buffer, size);
-}
+	if ((dpx->referenceBlack == DPX_UNDEFINED_R32 || isnan(dpx->referenceBlack)) ||
+	    (dpx->referenceWhite == DPX_UNDEFINED_R32 || dpx->referenceWhite <= dpx->referenceBlack || isnan(dpx->referenceWhite)) ||
+	    (dpx->gamma == DPX_UNDEFINED_R32 || dpx->gamma <= 0 || isnan(dpx->gamma)))
+	{
 
-int 
-dpxIsMemFileCineon(void *buffer) {
-	int magicnum = 0;
-	magicnum = *((int*)buffer);
-	if (magicnum == ntohl(DPX_FILE_MAGIC)) return 1;
-	else return 0;
-}
+		dpx->referenceBlack = 95.0f / 1023.0f * dpx->element[0].maxValue;
+		dpx->referenceWhite = 685.0f / 1023.0f * dpx->element[0].maxValue;
+		dpx->gamma = 1.7f;
+	}
 
-DpxFile*
-dpxCreate(const char* filename, int width, int height, int depth) {
+	if (verbose) {
+		printf("size %d x %d x %d elements\n", dpx->width, dpx->height, dpx->numElements);
+		for (i = 0; i < dpx->numElements; i++) {
+			printf(" Element %d:\n", i);
+			printf("  Bits per sample: %d\n", dpx->element[i].bitsPerSample);
+			printf("  Depth: %d\n", dpx->element[i].depth);
+			printf("  Transfer characteristics: %d\n", dpx->element[i].transfer);
+			printf("  Packing: %d\n", dpx->element[i].packing);
+			printf("  Descriptor: %d\n", dpx->element[i].descriptor);
+			printf("  Data offset: %u\n", dpx->element[i].dataOffset);
+			printf("  Reference low data: %u\n", dpx->element[i].refLowData);
+			printf("  Reference low quantity: %f\n", dpx->element[i].refLowQuantity);
+			printf("  Reference high data: %u\n", dpx->element[i].refHighData);
+			printf("  Reference high quantity: %f\n", dpx->element[i].refHighQuantity);
+			printf("\n");
+		}
 
-	/* Note: always write files in network order */
-	/* By the spec, it shouldn't matter, but ... */
+		printf("Gamma: %f\n", dpx->gamma);
+		printf("Reference black: %f\n", dpx->referenceBlack);
+		printf("Reference white: %f\n", dpx->referenceWhite);
+		printf("----------------------------\n");
+	}
+	return dpx;
+}
 
+LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPerSample, int hasAlpha,
+                        int isLogarithmic, int referenceWhite, int referenceBlack, float gamma,
+                        const char *creator)
+{
 	DpxMainHeader header;
-	const char* shortFilename = 0;
+	const char *shortFilename = 0;
+	unsigned char pad[6044];
 
-	DpxFile* dpx = (DpxFile*)malloc(sizeof(DpxFile));
+	LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
 	if (dpx == 0) {
-		if (verbose) d_printf("Failed to malloc dpx file structure.\n");
-		return 0;
-	}
-
-	memset(&header, 0, sizeof(header));
-
-	/* for close routine */
-	dpx->file = 0;
-	dpx->lineBuffer = 0;
-	dpx->pixelBuffer = 0;
-
-	dpx->file = BLI_fopen(filename, "wb");
-	if (dpx->file == 0) {
-		if (verbose) d_printf("Couldn't open file %s\n", filename);
-		dpxClose(dpx);
+		if (verbose) printf("DPX: Failed to malloc dpx file structure.\n");
 		return 0;
 	}
-	dpx->reading = 0;
 
 	dpx->width = width;
 	dpx->height = height;
-	dpx->depth = depth;
-	dpx->bitsPerPixel = 10;
-	dpx->imageOffset = sizeof(DpxMainHeader);
-
-	dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
-	dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
-	if (dpx->lineBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc line buffer of size %d\n", dpx->lineBufferLength * 4);
-		dpxClose(dpx);
-		return 0;
-	}
+	dpx->element[0].bitsPerSample = bitsPerSample;
+	dpx->element[0].dataOffset = 8092;
+	dpx->element[0].maxValue = powf(2, dpx->element[0].bitsPerSample) - 1.0f;
+	dpx->isMSB = 1;
+	dpx->numElements = 1;
 
-	dpx->pixelBuffer = malloc((dpx->lineBufferLength * 3 + 2) * sizeof(unsigned short));
-	if (dpx->pixelBuffer == 0) {
-		if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n",
-				(dpx->width * dpx->depth + 2 + 2) * (int)sizeof(unsigned short));
-		dpxClose(dpx);
-		return 0;
+	switch (bitsPerSample) {
+		case 8:
+		case 16:
+			dpx->element[0].packing = 0;
+			break;
+
+		case 10:
+		case 12:
+			/* Packed Type A padding is the most common 10/12 bits format */
+			dpx->element[0].packing = 1;
+			break;
+
+		default:
+			if (verbose) printf("DPX: bitsPerSample not supported: %d\n", bitsPerSample);
+			logImageClose(dpx);
+			return 0;
 	}
-	dpx->pixelBufferUsed = 0;
 
-	/* find trailing part of filename */
-	shortFilename = strrchr(filename, '/');
-	if (shortFilename == 0) {
-		shortFilename = filename;
+	if (hasAlpha == 0) {
+		dpx->depth = 3;
+		dpx->element[0].depth = 3;
+		dpx->element[0].descriptor = descriptor_RGB;
 	}
 	else {
-		++shortFilename;
+		dpx->depth = 4;
+		dpx->element[0].depth = 4;
+		dpx->element[0].descriptor = descriptor_RGBA;
 	}
-	initDpxMainHeader(dpx, &header, shortFilename);
-	logImageGetByteConversionDefaults(&dpx->params);
-	/* Need set the file type before write the header!
-	 *  2 - Linear
-	 *  3 - Logarithmic
-	 *
-	 * Note that transfer characteristics is U8, don't need
-	 * check the byte order.
-	 */
-	if (dpx->params.doLogarithm == 0)
-		header.imageInfo.channel[0].transfer_characteristics= 2;
-	else
-		header.imageInfo.channel[0].transfer_characteristics= 3;
 
-	if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
-		if (verbose) d_printf("Couldn't write image header\n");
-		dpxClose(dpx);
-		return 0;
+	if (isLogarithmic == 0) {
+		dpx->element[0].transfer = transfer_Linear;
+		dpx->element[0].refHighQuantity = dpx->element[0].maxValue;
 	}
-	dpx->fileYPos = 0;
-	setupLut(dpx);
+	else {
+		dpx->element[0].transfer = transfer_PrintingDensity;
+		dpx->element[0].refHighQuantity = 2.048f;
 
-	dpx->getRow = 0;
-	dpx->setRow = &dpxSetRowBytes;
-	dpx->close = &dpxClose;
+	}
 
-	return dpx;
-}
+	dpx->element[0].refLowQuantity = 0;
+	dpx->element[0].refLowData = 0;
+	dpx->element[0].refHighData = dpx->element[0].maxValue;
 
-void
-dpxClose(DpxFile* dpx) {
+	if (referenceWhite > 0)
+		dpx->referenceWhite = referenceWhite;
+	else
+		dpx->referenceWhite = 685.0f / 1023.0f * dpx->element[0].maxValue;
 
-	if (dpx == 0) {
-		return;
-	}
+	if (referenceBlack > 0)
+		dpx->referenceBlack = referenceBlack;
+	else
+		dpx->referenceBlack = 95.0f / 1023.0f * dpx->element[0].maxValue;
 
-	if (dpx->file) {
-		fclose(dpx->file);
-		dpx->file = 0;
-	}
+	if (gamma > 0.0f)
+		dpx->gamma = gamma;
+	else
+		dpx->gamma = 1.7f;
 
-	if (dpx->lineBuffer) {
-		free(dpx->lineBuffer);
-		dpx->lineBuffer = 0;
-	}
 
-	if (dpx->pixelBuffer) {
-		free(dpx->pixelBuffer);
-		dpx->pixelBuffer = 0;
-	}
+	shortFilename = strrchr(filename, '/');
+	if (shortFilename == 0)
+		shortFilename = filename;
+	else
+		shortFilename++;
 
-	free(dpx);
-}
+	dpx->file = BLI_fopen(filename, "wb");
 
-void
-dpxDump(const char* filename) {
+	if (dpx->file == 0) {
+		if (verbose) printf("DPX: Couldn't open file %s\n", filename);
+		logImageClose(dpx);
+		return 0;
+	}
 
-	DpxMainHeader header;
-	FILE* file;
+	fillDpxMainHeader(dpx, &header, shortFilename, creator);
 
-	file = BLI_fopen(filename, "rb");
-	if (file == 0) {
-		d_printf("Failed to open file \"%s\".\n", filename);
-		return;
+	if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
+		if (verbose) printf("DPX: Couldn't write image header\n");
+		logImageClose(dpx);
+		return 0;
 	}
 
-	if (fread(&header, sizeof(header), 1, file) == 0) {
-		d_printf("Not enough data for header in \"%s\".\n", filename);
-		fclose(file);
-		return;
+	/* Header should be rounded to next 8k block
+	 * 6044 = 8092 - sizeof(DpxMainHeader) */
+	memset(&pad, 0, 6044);
+	if (fwrite(&pad, 6044, 1, dpx->file) == 0) {
+		if (verbose) printf("DPX: Couldn't write image header\n");
+		logImageClose(dpx);
+		return 0;
 	}
 
-	fclose(file);
-	dumpDpxMainHeader(&header);
+	return dpx;
 }
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.h b/source/blender/imbuf/intern/cineon/dpxlib.h
index eb3937f..e910aaa 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.h
+++ b/source/blender/imbuf/intern/cineon/dpxlib.h
@@ -1,60 +1,160 @@
 /*
- *	 DPX image file format library definitions.
+ * DPX image file format library definitions.
  *
- *	 Copyright 1999 - 2002 David Hodson <hodsond at acm.org>
+ * Copyright 1999 - 2002 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
-#ifndef __DPXLIB_H__
-#define __DPXLIB_H__
-
 /** \file blender/imbuf/intern/cineon/dpxlib.h
  *  \ingroup imbcineon
  */
 
+
+#ifndef __DPX_LIB_H__
+#define __DPX_LIB_H__
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 #include "logImageCore.h"
 
-typedef struct _Log_Image_File_t_ DpxFile;
+#define DPX_FILE_MAGIC      0x53445058
+#define DPX_UNDEFINED_U8    0xFF
+#define DPX_UNDEFINED_U16   0xFFFF
+#define DPX_UNDEFINED_U32   0xFFFFFFFF
+#define DPX_UNDEFINED_R32   0xFFFFFFFF
+#define DPX_UNDEFINED_CHAR  0
 
-/* int functions return 0 for OK */
+typedef struct {
+	unsigned int    magic_num;
+	unsigned int    offset;
+	char            version[8];
+	unsigned int    file_size;
+	unsigned int    ditto_key;
+	unsigned int    gen_hdr_size;
+	unsigned int    ind_hdr_size;
+	unsigned int    user_data_size;
+	char            file_name[100];
+	char            creation_date[24];
+	char            creator[100];
+	char            project[200];
+	char            copyright[200];
+	unsigned int    key;
+	char            reserved[104];
+} DpxFileHeader;
 
-void dpxSetVerbose(int);
+typedef struct {
+	unsigned int    data_sign;
+	unsigned int    ref_low_data;
+	float           ref_low_quantity;
+	unsigned int    ref_high_data;
+	float           ref_high_quantity;
+	unsigned char   descriptor;
+	unsigned char   transfer;
+	unsigned char   colorimetric;
+	unsigned char   bits_per_sample;
+	unsigned short  packing;
+	unsigned short  encoding;
+	unsigned int    data_offset;
+	unsigned int    line_padding;
+	unsigned int    element_padding;
+	char            description[32];
+} DpxElementHeader;
 
-DpxFile* dpxOpen(const char* filename);
-DpxFile* dpxCreate(const char* filename, int xsize, int ysize, int channels);
-DpxFile* dpxOpenFromMem(unsigned char *buffer, unsigned int size);
-int dpxIsMemFileCineon(void *buffer);
+typedef struct {
+	unsigned short      orientation;
+	unsigned short      elements_per_image;
+	unsigned int        pixels_per_line;
+	unsigned int        lines_per_element;
+	DpxElementHeader    element[8];
+	char                reserved[52];
+} DpxImageHeader;
 
-/* get/set scanline of converted bytes */
-int dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y);
-int dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y);
+typedef struct {
+	unsigned int    x_offset;
+	unsigned int    y_offset;
+	float           x_center;
+	float           y_center;
+	unsigned int    x_original_size;
+	unsigned int    y_original_size;
+	char            file_name[100];
+	char            creation_time[24];
+	char            input_device[32];
+	char            input_serial_number[32];
+	unsigned short  border_validity[4];
+	unsigned int    pixel_aspect_ratio[2];
+	char            reserved[28];
+} DpxOrientationHeader;
 
-/* closes file and deletes data */
-void dpxClose(DpxFile* dpx);
+typedef struct {
+	char            film_manufacturer_id[2];
+	char            film_type[2];
+	char            edge_code_perforation_offset[2];
+	char            edge_code_prefix[6];
+	char            edge_code_count[4];
+	char            film_format[32];
+	unsigned int    frame_position;
+	unsigned int    sequence_length;
+	unsigned int    held_count;
+	float           frame_rate;
+	float           shutter_angle;
+	char            frame_identification[32];
+	char            slate_info[100];
+	char            reserved[56];
+} DpxFilmHeader;
 
-/* dumps file to stdout */
-void dpxDump(const char* filename);
+typedef struct {
+	unsigned int    time_code;
+	unsigned int    user_bits;
+	unsigned char   interlace;
+	unsigned char   field_number;
+	unsigned char   video_signal;
+	unsigned char   padding;
+	float           horizontal_sample_rate;
+	float           vertical_sample_rate;
+	float           frame_rate;
+	float           time_offset;
+	float           gamma;
+	float           black_level;
+	float           black_gain;
+	float           breakpoint;
+	float           white_level;
+	float           integration_times;
+	unsigned char   reserved[76];
+} DpxTelevisionHeader;
+
+
+typedef struct {
+	DpxFileHeader           fileHeader;
+	DpxImageHeader          imageHeader;
+	DpxOrientationHeader    orientationHeader;
+	DpxFilmHeader           filmHeader;
+	DpxTelevisionHeader     televisionHeader;
+} DpxMainHeader;
+
+void dpxSetVerbose(int verbosity);
+LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
+LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPerSample, int hasAlpha, int isLogarithmic, int referenceWhite, int referenceBlack, float gamma, const char *creator);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* __DPXLIB_H__ */
+#endif
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index f772cc7..3911e5c 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -1,21 +1,23 @@
 /*
- *	 Cineon image file format library routines.
+ * Cineon image file format library routines.
  *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
+ * Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
@@ -23,223 +25,1407 @@
  *  \ingroup imbcineon
  */
 
+
+#include "logmemfile.h"
 #include "logImageCore.h"
+#include "dpxlib.h"
+#include "cineonlib.h"
 
-#include <time.h>				 /* strftime() */
+#include <stdlib.h>
+#include <string.h>
 #include <math.h>
-/* Makes rint consistent in Windows and Linux: */
-#define rint(x) floor(x+0.5)
 
-#ifdef WIN32
-#include <winsock.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/param.h>
-#endif
+#include "BLI_fileops.h"
+#include "BLI_utildefines.h"
+
+#include "MEM_guardedalloc.h"
+
+/*
+ * Declaration of static functions
+ */
+
+static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement, float *data);
+static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement, float *data);
+static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement, float *data);
+static int logImageSetData16(LogImageFile *logImage, LogImageElement logElement, float *data);
+static int logImageElementGetData(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData1(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData8(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData10(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData10Packed(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData12(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData12Packed(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int logImageElementGetData16(LogImageFile *dpx, LogImageElement logElement, float *data);
+static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int dstIsLinearRGB);
+static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int srcIsLinearRGB);
+
+
+/*
+ * For debug purpose
+ */
+
+static int verbose = 0;
+
+void logImageSetVerbose(int verbosity)
+{
+	verbose = verbosity;
+	cineonSetVerbose(verbosity);
+	dpxSetVerbose(verbosity);
+}
+
+
+/*
+ * IO stuff
+ */
+
+int logImageIsDpx(const void *buffer)
+{
+	unsigned int magicNum = *(unsigned int *)buffer;
+	return (magicNum == DPX_FILE_MAGIC || magicNum == swap_uint(DPX_FILE_MAGIC, 1));
+}
 
-#if defined(__hpux)
-/* These are macros in hpux */
-#ifdef htonl
-#undef htonl
-#undef htons
-#undef ntohl
-#undef ntohs
-#endif
-unsigned int htonl(h) unsigned int h; { return(h); }
-unsigned short htons(h) unsigned short h; { return(h); }
-unsigned int ntohl(n) unsigned int n; { return(n); }
-unsigned short ntohs(n) unsigned short n; { return(n); }
-#endif
-	
-	
-/* obscure LogImage conversion */
-/* from 10 bit int to 0.0 - 1.0 */
-/* magic numbers left intact */
-static double
-convertTo(int inp, int white, float gamma) {
-	/*	return pow(pow(10.0, ((inp - white) * 0.002 / 0.6)), gamma); */
-	return pow(10.0, (inp - white) * gamma * 0.002 / 0.6);
+int logImageIsCineon(const void *buffer)
+{
+	unsigned int magicNum = *(unsigned int *)buffer;
+	return (magicNum == CINEON_FILE_MAGIC || magicNum == swap_uint(CINEON_FILE_MAGIC, 1));
 }
 
-static double
-convertFrom(double inp, int white, float gamma) {
-	return white + log10(inp) / (gamma * 0.002 / 0.6);
+LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
+{
+	unsigned int magicNum;
+	FILE *f = BLI_fopen(filename, "rb");
+
+	(void)cineon;
+
+	if (f == 0)
+		return 0;
+
+	if (fread(&magicNum, sizeof(unsigned int), 1, f) != 1) {
+		fclose(f);
+		return 0;
+	}
+
+	fclose(f);
+
+	if (logImageIsDpx(&magicNum))
+		return dpxOpen((const unsigned char *)filename, 0, 0);
+	else if (logImageIsCineon(&magicNum))
+		return cineonOpen((const unsigned char *)filename, 0, 0);
+
+	return 0;
 }
 
-/* set up the 10 bit to 8 bit and 8 bit to 10 bit tables */
-void
-setupLut(LogImageFile *logImage) {
+LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int size)
+{
+	if (logImageIsDpx(buffer))
+		return dpxOpen(buffer, 1, size);
+	else if (logImageIsCineon(buffer))
+		return cineonOpen(buffer, 1, size);
 
-	int i;
-	double f_black;
-	double scale;
+	return 0;
+}
+
+LogImageFile *logImageCreate(const char *filename, int cineon, int width, int height, int bitsPerSample,
+                             int isLogarithmic, int hasAlpha, int referenceWhite, int referenceBlack,
+                             float gamma, const char *creator)
+{
+	/* referenceWhite, referenceBlack and gamma values are only supported for DPX file */
+	if (cineon)
+		return cineonCreate(filename, width, height, bitsPerSample, creator);
+	else
+		return dpxCreate(filename, width, height, bitsPerSample, isLogarithmic, hasAlpha,
+		                 referenceWhite, referenceBlack, gamma, creator);
 
-	f_black = convertTo(logImage->params.blackPoint, logImage->params.whitePoint, logImage->params.gamma);
-	scale = 255.0 / (1.0 - f_black);
+	return 0;
+}
 
-	for (i = 0; i <= logImage->params.blackPoint; ++i) {
-		logImage->lut10[i] = 0;
+void logImageClose(LogImageFile *logImage)
+{
+	if (logImage != 0) {
+		if (logImage->file) {
+			fclose(logImage->file);
+			logImage->file = 0;
+		}
+		MEM_freeN(logImage);
 	}
-	for (; i < logImage->params.whitePoint; ++i) {
-		double f_i;
-		f_i = convertTo(i, logImage->params.whitePoint, logImage->params.gamma);
-		logImage->lut10[i] = (int)rint(scale * (f_i - f_black));
+}
+
+void logImageGetSize(LogImageFile *logImage, int *width, int *height, int *depth)
+{
+	*width = logImage->width;
+	*height = logImage->height;
+	*depth = logImage->depth;
+}
+
+
+/*
+ * Helper
+ */
+
+unsigned int getRowLength(int width, LogImageElement logElement)
+{
+	/* return the row length in bytes according to width and packing method */
+	switch (logElement.bitsPerSample) {
+		case 1:
+			return ((width * logElement.depth - 1) / 32 + 1) * 4;
+
+		case 8:
+			return ((width * logElement.depth - 1) / 4 + 1) * 4;
+
+		case 10:
+			if (logElement.packing == 0)
+				return ((width * logElement.depth * 10 - 1) / 32 + 1) * 4;
+			else if (logElement.packing == 1 || logElement.packing == 2)
+				return ((width * logElement.depth - 1) / 3 + 1) * 4;
+
+		case 12:
+			if (logElement.packing == 0)
+				return ((width * logElement.depth * 12 - 1) / 32 + 1) * 4;
+			else if (logElement.packing == 1 || logElement.packing == 2)
+				return width * logElement.depth * 2;
+
+		case 16:
+			return width * logElement.depth * 2;
+
+		default:
+			return 0;
 	}
-	for (; i < 1024; ++i) {
-		logImage->lut10[i] = 255;
+}
+
+
+/*
+ * Data writing
+ */
+
+int logImageSetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB)
+{
+	float *elementData;
+	int returnValue;
+
+	elementData = (float *)MEM_mallocN(logImage->width * logImage->height * logImage->depth * sizeof(float), __func__);
+	if (elementData == 0)
+		return 1;
+
+	if (convertRGBAToLogElement(data, elementData, logImage, logImage->element[0], dataIsLinearRGB) != 0) {
+		MEM_freeN(elementData);
+		return 1;
 	}
 
-	for (i = 0; i < 256; ++i) {
-		double f_i = f_black + (i / 255.0) * (1.0 - f_black);
-		logImage->lut8[i] = convertFrom(f_i, logImage->params.whitePoint, logImage->params.gamma);
-	}
-}
-
-/* set up the 10 bit to 16 bit and 16 bit to 10 bit tables */
-void
-setupLut16(LogImageFile *logImage) {
+	switch (logImage->element[0].bitsPerSample) {
+		case 8:
+			returnValue = logImageSetData8(logImage, logImage->element[0], elementData);
+			break;
+
+		case 10:
+			returnValue = logImageSetData10(logImage, logImage->element[0], elementData);
+			break;
 
-	int i;
-	double f_black;
-	double scale;
+		case 12:
+			returnValue = logImageSetData12(logImage, logImage->element[0], elementData);
+			break;
 
-	f_black = convertTo(logImage->params.blackPoint, logImage->params.whitePoint, logImage->params.gamma);
-	scale = 65535.0 / (1.0 - f_black);
-
-	for (i = 0; i <= logImage->params.blackPoint; ++i) {
-		logImage->lut10_16[i] = 0;
-	}
-	for (; i < logImage->params.whitePoint; ++i) {
-		double f_i;
-		f_i = convertTo(i, logImage->params.whitePoint, logImage->params.gamma);
-		logImage->lut10_16[i] = (int)rint(scale * (f_i - f_black));
-	}
-	for (; i < 1024; ++i) {
-		logImage->lut10_16[i] = 65535;
-	}
-
-	for (i = 0; i < 65536; ++i) {
-		double f_i = f_black + (i / 65535.0) * (1.0 - f_black);
-		logImage->lut16_16[i] = convertFrom(f_i, logImage->params.whitePoint, logImage->params.gamma);
-	}
-}
-
-/* how many longwords to hold this many pixels? */
-int
-pixelsToLongs(int numPixels) {
-	return (numPixels + 2) / 3;
-}
-
-/* byte reversed float */
+		case 16:
+			returnValue = logImageSetData16(logImage, logImage->element[0], elementData);
+			break;
 
-typedef union {
-	U32 i;
-	R32 f;
-} Hack;
+		default:
+			returnValue = 1;
+			break;
+	}
 
-R32
-htonf(R32 f) {
-	Hack hack;
-	hack.f = f;
-	hack.i = htonl(hack.i);
-	return hack.f;
+	MEM_freeN(elementData);
+	return returnValue;
 }
 
-R32
-ntohf(R32 f) {
-	Hack hack;
-	hack.f = f;
-	hack.i = ntohl(hack.i);
-	return hack.f;
+static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned char *row;
+	int x, y;
+
+	row = (unsigned char *)MEM_mallocN(rowLength, __func__);
+	if (row == 0) {
+		if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
+		return 1;
+	}
+	memset(row, 0, rowLength);
+
+	for (y = 0; y < logImage->height; y++) {
+		for (x = 0; x < logImage->width * logImage->depth; x++)
+			row[x] = (unsigned char)float_uint(data[y * logImage->width * logImage->depth + x], 255);
+
+		if (logimage_fwrite(row, rowLength, 1, logImage) == 0) {
+			if (verbose) printf("DPX/Cineon: Error while writing file.\n");
+			MEM_freeN(row);
+			return 1;
+		}
+	}
+	MEM_freeN(row);
+	return 0;
 }
 
-#define UNDEF_FLOAT 0x7F800000
+static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned int pixel, index;
+	unsigned int *row;
+	int x, y, offset;
 
-R32
-undefined(void) {
-	Hack hack;
-	hack.i = UNDEF_FLOAT;
-	return hack.f;
+	row = (unsigned int *)MEM_mallocN(rowLength, __func__);
+	if (row == 0) {
+		if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
+		return 1;
+	}
+
+	for (y = 0; y < logImage->height; y++) {
+		offset = 22;
+		index = 0;
+		pixel = 0;
+
+		for (x = 0; x < logImage->width * logImage->depth; x++) {
+			pixel |= (unsigned int)float_uint(data[y * logImage->width * logImage->depth + x], 1023) << offset;
+			offset -= 10;
+			if (offset < 0) {
+				row[index] = swap_uint(pixel, logImage->isMSB);
+				index++;
+				pixel = 0;
+				offset = 22;
+			}
+		}
+		if (pixel != 0)
+			row[index] = swap_uint(pixel, logImage->isMSB);
+
+		if (logimage_fwrite(row, rowLength, 1, logImage) == 0) {
+			if (verbose) printf("DPX/Cineon: Error while writing file.\n"); {
+				MEM_freeN(row);
+				return 1;
+			}
+		}
+	}
+	MEM_freeN(row);
+	return 0;
 }
 
-/* reverse an endian-swapped U16 */
-U16
-reverseU16(U16 value) {
+static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned short *row;
+	int x, y;
 
-	union {
-		U16 whole;
-		char part[2];
-	} buff;
-	char temp;
-	buff.whole = value;
-	temp = buff.part[0];
-	buff.part[0] = buff.part[1];
-	buff.part[1] = temp;
-	return buff.whole;
+	row = (unsigned short *)MEM_mallocN(rowLength, __func__);
+	if (row == 0) {
+		if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
+		return 1;
+	}
+
+	for (y = 0; y < logImage->height; y++) {
+		for (x = 0; x < logImage->width * logImage->depth; x++)
+			row[x] = swap_ushort(((unsigned short)float_uint(data[y * logImage->width * logImage->depth + x], 4095)) << 4, logImage->isMSB);
+
+		if (logimage_fwrite(row, rowLength, 1, logImage) == 0) {
+			if (verbose) printf("DPX/Cineon: Error while writing file.\n");
+			MEM_freeN(row);
+			return 1;
+		}
+	}
+	MEM_freeN(row);
+	return 0;
 }
 
-/* reverse an endian-swapped U32 */
-U32
-reverseU32(U32 value) {
+static int logImageSetData16(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned short *row;
+	int x, y;
 
-	union {
-		U32 whole;
-		char part[4];
-	} buff;
-	char temp;
-	buff.whole = value;
-	temp = buff.part[0];
-	buff.part[0] = buff.part[3];
-	buff.part[3] = temp;
-	temp = buff.part[1];
-	buff.part[1] = buff.part[2];
-	buff.part[2] = temp;
-	return buff.whole;
+	row = (unsigned short *)MEM_mallocN(rowLength, __func__);
+	if (row == 0) {
+		if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
+		return 1;
+	}
+
+	for (y = 0; y < logImage->height; y++) {
+		for (x = 0; x < logImage->width * logImage->depth; x++)
+			row[x] = swap_ushort((unsigned short)float_uint(data[y * logImage->width * logImage->depth + x], 65535), logImage->isMSB);
+
+		if (logimage_fwrite(row, rowLength, 1, logImage) == 0) {
+			if (verbose) printf("DPX/Cineon: Error while writing file.\n");
+			MEM_freeN(row);
+			return 1;
+		}
+	}
+	MEM_freeN(row);
+	return 0;
 }
 
-/* reverse an endian-swapped R32 */
-R32
-reverseR32(R32 value) {
 
-	union {
-		R32 whole;
-		char part[4];
-	} buff;
-	char temp;
-	buff.whole = value;
-	temp = buff.part[0];
-	buff.part[0] = buff.part[3];
-	buff.part[3] = temp;
-	temp = buff.part[1];
-	buff.part[1] = buff.part[2];
-	buff.part[2] = temp;
-	return buff.whole;
+/*
+ * Data reading
+ */
+
+int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB)
+{
+	/* Fills data with 32 bits float RGBA values */
+	int i, j, returnValue, sortedElementData[8], hasAlpha;
+	float *elementData[8];
+	float *elementData_ptr[8];
+	float *mergedData;
+	unsigned int sampleIndex;
+	LogImageElement mergedElement;
+
+	/* Determine the depth of the picture and if there's a separate alpha element.
+	   If the element is supported, load it into an unsigned ints array. */
+	memset(&elementData, 0, 8 * sizeof(float *));
+	hasAlpha = 0;
+
+	for (i = 0; i < logImage->numElements; i++) {
+		/* descriptor_Depth and descriptor_Composite are not supported */
+		if (logImage->element[i].descriptor != descriptor_Depth && logImage->element[i].descriptor != descriptor_Composite) {
+			/* Allocate memory */
+			elementData[i] = (float *)MEM_mallocN(logImage->width * logImage->height * logImage->element[i].depth * sizeof(float), __func__);
+			if (elementData[i] == 0) {
+				if (verbose) printf("DPX/Cineon: Cannot allocate memory for elementData[%d]\n.", i);
+				for (j = 0; j < i; j++)
+					if (elementData[j] != 0)
+						MEM_freeN(elementData[j]);
+				return 1;
+			}
+			elementData_ptr[i] = elementData[i];
+
+			/* Load data */
+			if (logImageElementGetData(logImage, logImage->element[i], elementData[i]) != 0) {
+				if (verbose) printf("DPX/Cineon: Cannot read elementData[%d]\n.", i);
+				for (j = 0; j < i; j++)
+					if (elementData[j] != 0)
+						MEM_freeN(elementData[j]);
+				return 1;
+			}
+		}
+
+		if (logImage->element[i].descriptor == descriptor_Alpha)
+			hasAlpha = 1;
+	}
+
+	/* only one element, easy case, no need to do anything  */
+	if (logImage->numElements == 1) {
+		returnValue = convertLogElementToRGBA(elementData[0], data, logImage, logImage->element[0], dataIsLinearRGB);
+		MEM_freeN(elementData[0]);
+	}
+	else {
+		/* The goal here is to merge every elements into only one
+		 * to recreate a classic 16 bits RGB, RGBA or YCbCr element.
+		 * Unsupported elements are skipped (depth, composite) */
+
+		memcpy(&mergedElement, &logImage->element[0], sizeof(LogImageElement));
+		mergedElement.descriptor = -1;
+		mergedElement.depth = logImage->depth;
+		memset(&sortedElementData, -1, 8 * sizeof(int));
+
+		/* Try to know how to assemble the elements */
+		for (i = 0; i < logImage->numElements; i++) {
+			switch (logImage->element[i].descriptor) {
+				case descriptor_Red:
+				case descriptor_RGB:
+					if (hasAlpha == 0)
+						mergedElement.descriptor = descriptor_RGB;
+					else
+						mergedElement.descriptor = descriptor_RGBA;
+
+					sortedElementData[0] = i;
+					break;
+
+				case descriptor_Green:
+					if (hasAlpha == 0)
+						mergedElement.descriptor = descriptor_RGB;
+					else
+						mergedElement.descriptor = descriptor_RGBA;
+
+					sortedElementData[1] = i;
+					break;
+
+				case descriptor_Blue:
+					if (hasAlpha == 0)
+						mergedElement.descriptor = descriptor_RGB;
+					else
+						mergedElement.descriptor = descriptor_RGBA;
+
+					sortedElementData[2] = i;
+					break;
+
+				case descriptor_Alpha:
+					/* Alpha component is always the last one */
+					sortedElementData[mergedElement.depth - 1] = i;
+					break;
+
+				case descriptor_Luminance:
+					if (mergedElement.descriptor == -1)
+						if (hasAlpha == 0)
+							mergedElement.descriptor = descriptor_Luminance;
+						else
+							mergedElement.descriptor = descriptor_YA;
+					else if (mergedElement.descriptor == descriptor_Chrominance) {
+						if (mergedElement.depth == 2)
+							mergedElement.descriptor = descriptor_CbYCrY;
+						else if (mergedElement.depth == 3)
+							if (hasAlpha == 0)
+								mergedElement.descriptor = descriptor_CbYCr;
+							else
+								mergedElement.descriptor = descriptor_CbYACrYA;
+						else if (mergedElement.depth == 4)
+							mergedElement.descriptor = descriptor_CbYCrA;
+					}
+
+					/* Y component always in 1 except if it's alone or with alpha */
+					if (mergedElement.depth == 1 || (mergedElement.depth == 2 && hasAlpha == 1))
+						sortedElementData[0] = i;
+					else
+						sortedElementData[1] = i;
+					break;
+
+				case descriptor_Chrominance:
+					if (mergedElement.descriptor == -1)
+						mergedElement.descriptor = descriptor_Chrominance;
+					else if (mergedElement.descriptor == descriptor_Luminance) {
+						if (mergedElement.depth == 2)
+							mergedElement.descriptor = descriptor_CbYCrY;
+						else if (mergedElement.depth == 3)
+							if (hasAlpha == 0)
+								mergedElement.descriptor = descriptor_CbYCr;
+							else
+								mergedElement.descriptor = descriptor_CbYACrYA;
+						else if (mergedElement.depth == 4)
+							mergedElement.descriptor = descriptor_CbYCrA;
+					}
+
+					/* Cb and Cr always in 0 or 2 */
+					if (sortedElementData[0] == -1)
+						sortedElementData[0] = i;
+					else
+						sortedElementData[2] = i;
+					break;
+
+				case descriptor_CbYCr:
+					if (hasAlpha == 0)
+						mergedElement.descriptor = descriptor_CbYCr;
+					else
+						mergedElement.descriptor = descriptor_CbYCrA;
+
+					sortedElementData[0] = i;
+					break;
+
+				case descriptor_RGBA:
+				case descriptor_ABGR:
+				case descriptor_CbYACrYA:
+				case descriptor_CbYCrY:
+				case descriptor_CbYCrA:
+					/* I don't think these ones can be seen in a planar image */
+					mergedElement.descriptor = logImage->element[i].descriptor;
+					sortedElementData[0] = i;
+					break;
+
+				case descriptor_Depth:
+				case descriptor_Composite:
+					/* Not supported */
+					break;
+			}
+		}
+
+		mergedData = (float *)MEM_mallocN(logImage->width * logImage->height * mergedElement.depth * sizeof(float), __func__);
+		if (mergedData == 0) {
+			if (verbose) printf("DPX/Cineon: Cannot allocate mergedData.\n");
+			for (i = 0; i < logImage->numElements; i++)
+				if (elementData[i] != 0)
+					MEM_freeN(elementData[i]);
+			return 1;
+		}
+
+		sampleIndex = 0;
+		while (sampleIndex < logImage->width * logImage->height * mergedElement.depth) {
+			for (i = 0; i < logImage->numElements; i++)
+				for (j = 0; j < logImage->element[sortedElementData[i]].depth; j++)
+					mergedData[sampleIndex++] = *(elementData_ptr[sortedElementData[i]]++);
+		}
+
+		/* Done with elements data, clean-up */
+		for (i = 0; i < logImage->numElements; i++)
+			if (elementData[i] != 0)
+				MEM_freeN(elementData[i]);
+
+		returnValue = convertLogElementToRGBA(mergedData, data, logImage, mergedElement, dataIsLinearRGB);
+		MEM_freeN(mergedData);
+	}
+	return returnValue;
 }
 
-#if 0
-/* bytes per line for images packed 3 10 bit pixels to 32 bits, 32 bit aligned */
-int
-bytesPerLine_10_4(int numPixels) {
-	return ((numPixels + 2) / 3) * 4;
+static int logImageElementGetData(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	switch (logElement.bitsPerSample) {
+		case 1:
+			return logImageElementGetData1(logImage, logElement, data);
+
+		case 8:
+			return logImageElementGetData8(logImage, logElement, data);
+
+		case 10:
+			if (logElement.packing == 0)
+				return logImageElementGetData10Packed(logImage, logElement, data);
+			else if (logElement.packing == 1 || logElement.packing == 2)
+				return logImageElementGetData10(logImage, logElement, data);
+
+		case 12:
+			if (logElement.packing == 0)
+				return logImageElementGetData12Packed(logImage, logElement, data);
+			else if (logElement.packing == 1 || logElement.packing == 2)
+				return logImageElementGetData12(logImage, logElement, data);
+
+		case 16:
+			return logImageElementGetData16(logImage, logElement, data);
+
+		default:
+			/* format not supported */
+			return 1;
+	}
 }
 
-void
-seekLine_noPadding(LogImageFile* logImage, int lineNumber) {
-	int fileOffset = bytesPerLine_10_4(lineNumber * logImage->width * logImage->depth);
-	int filePos = logImage->imageOffset + fileOffset;
-	if (fseek(logImage->file, filePos, SEEK_SET) != 0) {
-		/* complain? */
-	}
-}
-
-void
-seekLine_padding(LogImageFile* logImage, int lineNumber) {
-	int fileOffset = lineNumber * bytesPerLine_10_4(logImage->width * logImage->depth);
-	int filePos = logImage->imageOffset + fileOffset;
-	if (fseek(logImage->file, filePos, SEEK_SET) != 0) {
-		/* complain? */
-	}
-}
-#endif
+static int logImageElementGetData1(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int pixel;
+	int x, y, offset;
+
+	/* seek at the right place */
+	if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
+		if (verbose) printf("DPX/Cineon: Couldn't seek at %d\n", logElement.dataOffset);
+		return 1;
+	}
+
+	/* read 1 bit data padded to 32 bits */
+	for (y = 0; y < logImage->height; y++) {
+		for (x = 0; x < logImage->width * logElement.depth; x += 32) {
+			if (logimage_read_uint(&pixel, logImage) != 0) {
+				if (verbose) printf("DPX/Cineon: EOF reached\n");
+				return 1;
+			}
+			pixel = swap_uint(pixel, logImage->isMSB);
+			for (offset = 0; offset < 32 && x + offset < logImage->width; offset++)
+				data[y * logImage->width * logElement.depth + x + offset] = (float)((pixel >> offset) & 0x01);
+		}
+	}
+	return 0;
+}
+
+static int logImageElementGetData8(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned char pixel;
+	int x, y;
+
+	/* extract required pixels */
+	for (y = 0; y < logImage->height; y++) {
+		/* 8 bits are 32-bits padded so we need to seek at each row */
+		if (logimage_fseek(logImage, logElement.dataOffset + y * rowLength, SEEK_SET) != 0) {
+			if (verbose) printf("DPX/Cineon: Couldn't seek at %d\n", logElement.dataOffset + y * rowLength);
+			return 1;
+		}
+
+		for (x = 0; x < logImage->width * logElement.depth; x++) {
+			if (logimage_read_uchar(&pixel, logImage) != 0) {
+				if (verbose) printf("DPX/Cineon: EOF reached\n");
+				return 1;
+			}
+			data[y * logImage->width * logElement.depth + x] = (float)pixel / 255.0f;
+		}
+	}
+	return 0;
+}
+
+static int logImageElementGetData10(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int pixel;
+	int x, y, offset;
+
+	/* seek to data */
+	if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
+		if (verbose) printf("DPX/Cineon: Couldn't seek at %d\n", logElement.dataOffset);
+		return 1;
+	}
+
+	if (logImage->depth == 1 && logImage->srcFormat == format_DPX) {
+		for (y = 0; y < logImage->height; y++) {
+			offset = 32;
+			for (x = 0; x < logImage->width * logElement.depth; x++) {
+				/* we need to read the next long */
+				if (offset >= 30) {
+					if (logElement.packing == 1)
+						offset = 2;
+					else if (logElement.packing == 2)
+						offset = 0;
+
+					if (logimage_read_uint(&pixel, logImage) != 0) {
+						if (verbose) printf("DPX/Cineon: EOF reached\n");
+						return 1;
+					}
+					pixel = swap_uint(pixel, logImage->isMSB);
+				}
+				data[y * logImage->width * logElement.depth + x] = (float)((pixel >> offset) & 0x3ff) / 1023.0f;
+				offset += 10;
+			}
+		}
+	}
+	else {
+		for (y = 0; y < logImage->height; y++) {
+			offset = -1;
+			for (x = 0; x < logImage->width * logElement.depth; x++) {
+				/* we need to read the next long */
+				if (offset < 0) {
+					if (logElement.packing == 1)
+						offset = 22;
+					else if (logElement.packing == 2)
+						offset = 20;
+
+					if (logimage_read_uint(&pixel, logImage) != 0) {
+						if (verbose) printf("DPX/Cineon: EOF reached\n");
+						return 1;
+					}
+					pixel = swap_uint(pixel, logImage->isMSB);
+				}
+				data[y * logImage->width * logElement.depth + x] = (float)((pixel >> offset) & 0x3ff) / 1023.0f;
+				offset -= 10;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int logImageElementGetData10Packed(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned int pixel, oldPixel;
+	int offset, offset2, x, y;
+
+	/* converting bytes to pixels */
+	for (y = 0; y < logImage->height; y++) {
+		/* seek to data */
+		if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
+			if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", y * rowLength + logElement.dataOffset);
+			return 1;
+		}
+
+		oldPixel = 0;
+		offset = 0;
+		offset2 = 0;
+
+		for (x = 0; x < logImage->width * logElement.depth; x++) {
+			if (offset2 != 0) {
+				offset = 10 - offset2;
+				offset2 = 0;
+				oldPixel = 0;
+			}
+			else if (offset == 32) {
+				offset = 0;
+			}
+			else if (offset + 10 > 32) {
+				/* next pixel is on two different longs */
+				oldPixel = (pixel >> offset);
+				offset2 = 32 - offset;
+				offset = 0;
+			}
+
+			if (offset == 0) {
+				/* we need to read the next long */
+				if (logimage_read_uint(&pixel, logImage) != 0) {
+					if (verbose) printf("DPX/Cineon: EOF reached\n");
+					return 1;
+				}
+				pixel = swap_uint(pixel, logImage->isMSB);
+			}
+			data[y * logImage->width * logElement.depth + x] = (float)((((pixel << offset2) >> offset) & 0x3ff) | oldPixel) / 1023.0f;
+			offset += 10;
+		}
+	}
+	return 0;
+}
+
+static int logImageElementGetData12(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int sampleIndex;
+	unsigned int numSamples = logImage->width * logImage->height * logElement.depth;
+	unsigned short pixel;
+
+	/* seek to data */
+	if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
+		if (verbose) printf("DPX/Cineon: Couldn't seek at %d\n", logElement.dataOffset);
+		return 1;
+	}
+
+	/* convert bytes to pixels */
+	sampleIndex = 0;
+
+	for (sampleIndex = 0; sampleIndex < numSamples; sampleIndex++) {
+		if (logimage_read_ushort(&pixel, logImage) != 0) {
+			if (verbose) printf("DPX/Cineon: EOF reached\n");
+			return 1;
+		}
+		pixel = swap_ushort(pixel, logImage->isMSB);
+
+		if (logElement.packing == 1) /* padded to the right */
+			data[sampleIndex] = (float)(pixel >> 4) / 4095.0f;
+		else if (logElement.packing == 2) /* padded to the left */
+			data[sampleIndex] = (float)pixel / 4095.0f;
+	}
+	return 0;
+}
+
+static int logImageElementGetData12Packed(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int rowLength = getRowLength(logImage->width, logElement);
+	unsigned int pixel, oldPixel;
+	int offset, offset2, x, y;
+
+	/* converting bytes to pixels */
+	for (y = 0; y < logImage->height; y++) {
+		/* seek to data */
+		if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
+			if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", y * rowLength + logElement.dataOffset);
+			return 1;
+		}
+
+		oldPixel = 0;
+		offset = 0;
+		offset2 = 0;
+
+		for (x = 0; x < logImage->width * logElement.depth; x++) {
+			if (offset2 != 0) {
+				offset = 12 - offset2;
+				offset2 = 0;
+				oldPixel = 0;
+			}
+			else if (offset == 32) {
+				offset = 0;
+			}
+			else if (offset + 12 > 32) {
+				/* next pixel is on two different longs */
+				oldPixel = (pixel >> offset);
+				offset2 = 32 - offset;
+				offset = 0;
+			}
+
+			if (offset == 0) {
+				/* we need to read the next long */
+				if (logimage_read_uint(&pixel, logImage) != 0) {
+					if (verbose) printf("DPX/Cineon: EOF reached\n");
+					return 1;
+				}
+				pixel = swap_uint(pixel, logImage->isMSB);
+			}
+			data[y * logImage->width * logElement.depth + x] = (float)((((pixel << offset2) >> offset) & 0xfff) | oldPixel) / 4095.0f;
+			offset += 12;
+		}
+	}
+	return 0;
+}
+
+static int logImageElementGetData16(LogImageFile *logImage, LogImageElement logElement, float *data)
+{
+	unsigned int numSamples = logImage->width * logImage->height * logElement.depth;
+	unsigned int sampleIndex;
+	unsigned short pixel;
+
+	/* seek to data */
+	if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
+		if (verbose) printf("DPX/Cineon: Couldn't seek at %d\n", logElement.dataOffset);
+		return 1;
+	}
+
+	for (sampleIndex = 0; sampleIndex < numSamples; sampleIndex++) {
+		if (logimage_read_ushort(&pixel, logImage) != 0) {
+			if (verbose) printf("DPX/Cineon: EOF reached\n");
+			return 1;
+		}
+		pixel = swap_ushort(pixel, logImage->isMSB);
+		data[sampleIndex] = (float)pixel / 65535.0f;
+	}
+
+	return 0;
+}
+
+
+/*
+ * Color conversion
+ */
+
+static int getYUVtoRGBMatrix(float *matrix, LogImageElement logElement)
+{
+	float scaleY, scaleCbCr;
+	float refHighData = (float)logElement.refHighData / logElement.maxValue;
+	float refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	scaleY = 1.0f / (refHighData - refLowData);
+	scaleCbCr = scaleY * ((940.0f - 64.0f) / (960.0f - 64.0f));
+
+	switch (logElement.transfer) {
+		case 2: /* linear */
+			matrix[0] =  1.0f * scaleY;
+			matrix[1] =  1.0f * scaleCbCr;
+			matrix[2] =  1.0f * scaleCbCr;
+			matrix[3] =  1.0f * scaleY;
+			matrix[4] =  1.0f * scaleCbCr;
+			matrix[5] =  1.0f * scaleCbCr;
+			matrix[6] =  1.0f * scaleY;
+			matrix[7] =  1.0f * scaleCbCr;
+			matrix[8] =  1.0f * scaleCbCr;
+			return 0;
+
+		case 5: /* SMPTE 240M */
+			matrix[0] =  1.0000f * scaleY;
+			matrix[1] =  0.0000f * scaleCbCr;
+			matrix[2] =  1.5756f * scaleCbCr;
+			matrix[3] =  1.0000f * scaleY;
+			matrix[4] = -0.2253f * scaleCbCr;
+			matrix[5] = -0.5000f * scaleCbCr;
+			matrix[6] =  1.0000f * scaleY;
+			matrix[7] =  1.8270f * scaleCbCr;
+			matrix[8] =  0.0000f * scaleCbCr;
+			return 0;
+
+		case 6: /* CCIR 709-1 */
+			matrix[0] =  1.000000f * scaleY;
+			matrix[1] =  0.000000f * scaleCbCr;
+			matrix[2] =  1.574800f * scaleCbCr;
+			matrix[3] =  1.000000f * scaleY;
+			matrix[4] = -0.187324f * scaleCbCr;
+			matrix[5] = -0.468124f * scaleCbCr;
+			matrix[6] =  1.000000f * scaleY;
+			matrix[7] =  1.855600f * scaleCbCr;
+			matrix[8] =  0.000000f * scaleCbCr;
+			return 0;
+
+		case 7: /* CCIR 601 */
+		case 8: /* I'm not sure 7 and 8 should share the same matrix */
+			matrix[0] =  1.000000f * scaleY;
+			matrix[1] =  0.000000f * scaleCbCr;
+			matrix[2] =  1.402000f * scaleCbCr;
+			matrix[3] =  1.000000f * scaleY;
+			matrix[4] = -0.344136f * scaleCbCr;
+			matrix[5] = -0.714136f * scaleCbCr;
+			matrix[6] =  1.000000f * scaleY;
+			matrix[7] =  1.772000f * scaleCbCr;
+			matrix[8] =  0.000000f * scaleCbCr;
+			return 0;
+
+		default:
+			return 1;
+	}
+}
+
+static void getLinToLogLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
+{
+	float gain, negativeFilmGamma, offset, step;
+	unsigned int i;
+
+	negativeFilmGamma = 0.6;
+	step = logElement.refHighQuantity / logElement.maxValue;
+	gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
+	offset = gain - logElement.maxValue;
+
+	for (i = 0; i < (int)(logElement.maxValue + 1); i++)
+		lut[i] = (logImage->referenceWhite + log10f(powf((i + offset) / gain, 1.7f / logImage->gamma)) / (step / negativeFilmGamma)) / logElement.maxValue;
+}
+
+static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
+{
+	float breakPoint, gain, kneeGain, kneeOffset, negativeFilmGamma, offset, step, softClip;
+	/* float filmGamma; unused */
+	unsigned int i;
+
+	/* Building the Log -> Lin LUT */
+	step = logElement.refHighQuantity / logElement.maxValue;
+	negativeFilmGamma = 0.6;
+
+	/* these are default values */
+	/* filmGamma = 2.2f;  unused */
+	softClip = 0;
+
+	breakPoint = logImage->referenceWhite - softClip;
+	gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
+	offset = gain - logElement.maxValue;
+	kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset;
+	kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100);
+
+	for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+		if (i < logImage->referenceBlack)
+			lut[i] = 0.0f;
+		else if (i > breakPoint)
+			lut[i] = (powf(i - breakPoint, softClip / 100) * kneeGain + kneeOffset) / logElement.maxValue;
+		else
+			lut[i] = (powf(10, ((float)i - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset) / logElement.maxValue;
+	}
+}
+
+static void getLinToSrgbLut(float *lut, LogImageElement logElement)
+{
+	unsigned int i;
+	float col;
+
+	for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+		col = (float)i / logElement.maxValue;
+		if (col < 0.0031308f)
+			lut[i] = (col < 0.0f) ? 0.0f : col * 12.92f;
+		else
+			lut[i] = 1.055f * powf(col, 1.0f / 2.4f) - 0.055f;
+	}
+}
+
+static void getSrgbToLinLut(float *lut, LogImageElement logElement)
+{
+	unsigned int i;
+	float col;
+
+	for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+		col = (float)i / logElement.maxValue;
+		if (col < 0.04045f)
+			lut[i] = (col < 0.0f) ? 0.0f : col * (1.0f / 12.92f);
+		else
+			lut[i] = powf((col + 0.055f) * (1.0f / 1.055f), 2.4f);
+	}
+}
+
+static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage,
+                           LogImageElement logElement, int elementIsSource)
+{
+	unsigned int i;
+	float lut[65536];
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	switch (logElement.transfer) {
+		case transfer_UserDefined:
+		case transfer_Linear:
+		case transfer_Logarithmic:
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				*(dst_ptr++) = *(src_ptr++);
+				*(dst_ptr++) = *(src_ptr++);
+				*(dst_ptr++) = *(src_ptr++);
+				src_ptr++;
+			}
+			return 0;
+
+		case transfer_PrintingDensity:
+			if (elementIsSource == 1)
+				getLogToLinLut((float *)&lut, logImage, logElement);
+			else
+				getLinToLogLut((float *)&lut, logImage, logElement);
+
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				src_ptr++;
+			}
+			return 0;
+
+		default:
+			return 1;
+	}
+}
+
+static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage,
+                           LogImageElement logElement, int elementIsSource)
+{
+	unsigned int i;
+	float lut[65536];
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	switch (logElement.transfer) {
+		case transfer_UserDefined:
+		case transfer_Linear:
+		case transfer_Logarithmic:
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				*(dst_ptr++) = *(src_ptr++);
+				*(dst_ptr++) = *(src_ptr++);
+				*(dst_ptr++) = *(src_ptr++);
+				*(dst_ptr++) = 1.0f;
+			}
+			return 0;
+
+		case transfer_PrintingDensity:
+			if (elementIsSource == 1)
+				getLogToLinLut((float *)&lut, logImage, logElement);
+			else
+				getLinToLogLut((float *)&lut, logImage, logElement);
+
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = 1.0f;
+			}
+			return 0;
+
+		default:
+			return 1;
+	}
+}
+
+static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage,
+                            LogImageElement logElement, int elementIsSource)
+{
+	unsigned int i;
+	float lut[65536];
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	switch (logElement.transfer) {
+		case transfer_UserDefined:
+		case transfer_Linear:
+		case transfer_Logarithmic:
+			memcpy(dst, src, 4 * logImage->width * logImage->height * sizeof(float));
+			return 0;
+
+		case transfer_PrintingDensity:
+			if (elementIsSource == 1)
+				getLogToLinLut((float *)&lut, logImage, logElement);
+			else
+				getLinToLogLut((float *)&lut, logImage, logElement);
+
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+				*(dst_ptr++) = *(src_ptr++);
+			}
+			return 0;
+
+		default:
+			return 1;
+	}
+}
+
+static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
+                            LogImageElement logElement, int elementIsSource)
+{
+	unsigned int i;
+	float lut[65536];
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	switch (logElement.transfer) {
+		case transfer_UserDefined:
+		case transfer_Linear:
+		case transfer_Logarithmic:
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				src_ptr += 4;
+				*(dst_ptr++) = *(src_ptr--);
+				*(dst_ptr++) = *(src_ptr--);
+				*(dst_ptr++) = *(src_ptr--);
+				*(dst_ptr++) = *(src_ptr--);
+				src_ptr += 4;
+			}
+			return 0;
+
+		case transfer_PrintingDensity:
+			if (elementIsSource == 1)
+				getLogToLinLut((float *)&lut, logImage, logElement);
+			else
+				getLinToLogLut((float *)&lut, logImage, logElement);
+
+			for (i = 0; i < logImage->width * logImage->height; i++) {
+				src_ptr += 4;
+				*(dst_ptr++) = lut[float_uint(*(src_ptr--), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr--), logElement.maxValue)];
+				*(dst_ptr++) = lut[float_uint(*(src_ptr--), logElement.maxValue)];
+				*(dst_ptr++) = *(src_ptr--);
+				src_ptr += 4;
+			}
+			return 0;
+
+		default:
+			return 1;
+	}
+}
+
+static int convertCbYCr_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], refLowData, y, cb, cr;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height; i++) {
+		cb = *(src_ptr++) - 0.5f;
+		y = *(src_ptr++) - refLowData;
+		cr = *(src_ptr++) - 0.5f;
+
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = 1.0f;
+	}
+	return 0;
+}
+
+static int convertCbYCrA_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], refLowData, y, cb, cr, a;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height; i++) {
+		cb = *(src_ptr++) - 0.5f;
+		y = *(src_ptr++) - refLowData;
+		cr = *(src_ptr++) - 0.5f;
+		a = *(src_ptr++);
+
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = a;
+	}
+	return 0;
+}
+
+static int convertCbYCrY_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], refLowData, y1, y2, cb, cr;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height / 2; i++) {
+		cb = *(src_ptr++) - 0.5f;
+		y1 = *(src_ptr++) - refLowData;
+		cr = *(src_ptr++) - 0.5f;
+		y2 = *(src_ptr++) - refLowData;
+
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = 1.0f;
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = 1.0f;
+	}
+	return 0;
+}
+
+static int convertCbYACrYA_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], refLowData, y1, y2, cb, cr, a1, a2;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height / 2; i++) {
+		cb = *(src_ptr++) - 0.5f;
+		y1 = *(src_ptr++) - refLowData;
+		a1 = *(src_ptr++);
+		cr = *(src_ptr++) - 0.5f;
+		y2 = *(src_ptr++) - refLowData;
+		a2 = *(src_ptr++);
+
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y1 * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = a1;
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[0] + cb * conversionMatrix[1] + cr * conversionMatrix[2], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[3] + cb * conversionMatrix[4] + cr * conversionMatrix[5], 0.0f, 1.0f);
+		*(dst_ptr++) = clamp_float(y2 * conversionMatrix[6] + cb * conversionMatrix[7] + cr * conversionMatrix[8], 0.0f, 1.0f);
+		*(dst_ptr++) = a2;
+	}
+	return 0;
+}
+
+static int convertLuminance_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], value, refLowData;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height; i++) {
+		value = clamp_float((*(src_ptr++) - refLowData) * conversionMatrix[0], 0.0f, 1.0f);
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = 1.0f;
+	}
+	return 0;
+}
+
+static int convertYA_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement)
+{
+	unsigned int i;
+	float conversionMatrix[9], value, refLowData;
+	float *src_ptr = src;
+	float *dst_ptr = dst;
+
+	if (getYUVtoRGBMatrix((float *)&conversionMatrix, logElement) != 0)
+		return 1;
+
+	refLowData = (float)logElement.refLowData / logElement.maxValue;
+
+	for (i = 0; i < logImage->width * logImage->height; i++) {
+		value = clamp_float((*(src_ptr++) - refLowData) * conversionMatrix[0], 0.0f, 1.0f);
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = value;
+		*(dst_ptr++) = *(src_ptr++);
+	}
+	return 0;
+}
+
+static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImage,
+                                   LogImageElement logElement, int dstIsLinearRGB)
+{
+	int rvalue;
+	unsigned int i;
+	float *src_ptr;
+	float *dst_ptr;
+	float lut[65536];
+
+	/* Convert data in src to linear RGBA in dst */
+	switch (logElement.descriptor) {
+		case descriptor_RGB:
+			rvalue = convertRGB_RGBA(src, dst, logImage, logElement, 1);
+			break;
+
+		case descriptor_RGBA:
+			rvalue = convertRGBA_RGBA(src, dst, logImage, logElement, 1);
+			break;
+
+		case descriptor_ABGR:
+			rvalue = convertABGR_RGBA(src, dst, logImage, logElement, 1);
+			break;
+
+		case descriptor_Luminance:
+			rvalue = convertLuminance_RGBA(src, dst, logImage, logElement);
+			break;
+
+		case descriptor_CbYCr:
+			rvalue = convertCbYCr_RGBA(src, dst, logImage, logElement);
+			break;
+
+		case descriptor_CbYCrY:
+			rvalue = convertCbYCrY_RGBA(src, dst, logImage, logElement);
+			break;
+
+		case descriptor_CbYACrYA:
+			rvalue = convertCbYACrYA_RGBA(src, dst, logImage, logElement);
+			break;
+
+		case descriptor_CbYCrA:
+			rvalue = convertCbYCrA_RGBA(src, dst, logImage, logElement);
+			break;
+
+		case descriptor_YA: /* this descriptor is for internal use only */
+			rvalue = convertYA_RGBA(src, dst, logImage, logElement);
+			break;
+
+		default:
+			return 1;
+	}
+
+	if (rvalue == 1)
+		return 1;
+	else if (dstIsLinearRGB) {
+		/* convert data from sRGB to Linear RGB via lut */
+		getSrgbToLinLut((float *)&lut, logElement);
+		src_ptr = dst; // no error here
+		dst_ptr = dst;
+		for (i = 0; i < logImage->width * logImage->height; i++) {
+			*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			dst_ptr++; src_ptr++;
+		}
+	}
+	return 0;
+}
+
+static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImage,
+                                   LogImageElement logElement, int srcIsLinearRGB)
+{
+	unsigned int i;
+	int rvalue;
+	float *srgbSrc;
+	float *srgbSrc_ptr;
+	float *src_ptr = src;
+	float lut[65536];
+
+	if (srcIsLinearRGB != 0) {
+		/* we need to convert src to sRGB */
+		srgbSrc = (float *)MEM_mallocN(4 * logImage->width * logImage->height * sizeof(float), __func__);
+		if (srgbSrc == 0)
+			return 1;
+
+		memcpy(srgbSrc, src, 4 * logImage->width * logImage->height * sizeof(float));
+		srgbSrc_ptr = srgbSrc;
+
+		/* convert data from Linear RGB to sRGB via lut */
+		getLinToSrgbLut((float *)&lut, logElement);
+		for (i = 0; i < logImage->width * logImage->height; i++) {
+			*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
+			srgbSrc_ptr++; src_ptr++;
+		}
+	}
+	else
+		srgbSrc = src;
+
+	/* Convert linear RGBA data in src to format described by logElement in dst */
+	switch (logElement.descriptor) {
+		case descriptor_RGB:
+			rvalue = convertRGBA_RGB(srgbSrc, dst, logImage, logElement, 0);
+			break;
+
+		case descriptor_RGBA:
+			rvalue = convertRGBA_RGBA(srgbSrc, dst, logImage, logElement, 0);
+			break;
+
+		/* these ones are not supported for the moment */
+		case descriptor_ABGR:
+		case descriptor_Luminance:
+		case descriptor_CbYCr:
+		case descriptor_CbYCrY:
+		case descriptor_CbYACrYA:
+		case descriptor_CbYCrA:
+		case descriptor_YA: /* this descriptor is for internal use only */
+		default:
+			rvalue = 1;
+	}
+
+	if (srcIsLinearRGB != 0) {
+		MEM_freeN(srgbSrc);
+	}
+
+	return rvalue;
+}
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h
index 7d88c10..7c75f8b 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.h
+++ b/source/blender/imbuf/intern/cineon/logImageCore.h
@@ -1,123 +1,283 @@
 /*
- *	 Cineon image file format library definitions.
- *	 Cineon and DPX common structures.
+ * Cineon image file format library definitions.
+ * Cineon and DPX common structures.
  *
- *	 This header file contains private details.
- *	 User code should generally use cineonlib.h and dpxlib.h only.
- *	 Hmm. I thought the two formats would have more in common!
+ * This header file contains private details.
+ * User code should generally use cineonlib.h and dpxlib.h only.
+ * Hmm. I thought the two formats would have more in common!
  *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
+ * Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
-#ifndef __LOGIMAGECORE_H__
-#define __LOGIMAGECORE_H__
-
 /** \file blender/imbuf/intern/cineon/logImageCore.h
  *  \ingroup imbcineon
  */
 
+#ifndef __LOG_IMAGE_CORE_H__
+#define __LOG_IMAGE_CORE_H__
+
 #include <stdio.h>
-#include "logImageLib.h"
+
+#include "BLO_sys_types.h"
+#include "BLI_utildefines.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "BLO_sys_types.h" // for intptr_t support
+/*
+ * Image structure
+ */
 
-#ifdef _MSC_VER
-#undef ntohl
-#undef htonl
-#endif
+/* There are some differences between DPX and Cineon so we need to know from what type of file the datas come from */
+enum format {
+	format_DPX,
+	format_Cineon
+};
 
-typedef int (GetRowFn)(LogImageFile* logImage, unsigned short* row, int lineNum);
-typedef int (SetRowFn)(LogImageFile* logImage, const unsigned short* row, int lineNum);
-typedef void (CloseFn)(LogImageFile* logImage);
+typedef struct LogImageElement
+{
+	int             depth;
+	int             bitsPerSample;
+	int             dataOffset;
+	int             packing;
+	int             transfer;
+	int             descriptor;
+	unsigned int    refLowData;
+	unsigned int    refHighData;
+	float           refLowQuantity;
+	float           refHighQuantity;
+	float           maxValue; /* = 2^bitsPerSample - 1 (used internally, doesn't come from the file header) */
+} LogImageElement;
 
-struct _Log_Image_File_t_
+typedef struct LogImageFile
 {
 	/* specified in header */
 	int width;
 	int height;
+	int numElements;
 	int depth;
-	int bitsPerPixel;
-	int imageOffset;
+	LogImageElement element[8];
 
-	/* file buffer, measured in longwords (4 byte) */
-	int lineBufferLength;
-	unsigned int* lineBuffer;
-
-	/* pixel buffer, holds 10 bit pixel values */
-	unsigned short* pixelBuffer;
-	int pixelBufferUsed;
+	/* used for log <-> lin conversion */
+	float referenceBlack;
+	float referenceWhite;
+	float gamma;
 
 	/* io stuff */
-	FILE* file;
-	int reading;
-	int fileYPos;
+	FILE *file;
+	unsigned char *memBuffer;
+	uintptr_t memBufferSize;
+	unsigned char *memCursor;
 
-	/* byte conversion stuff */
-	LogImageByteConversionParameters params;
-#if 0
-	float gamma;
-	int blackPoint;
-	int whitePoint;
-#endif
-	unsigned char lut10[1024];
-	unsigned short lut8[256];
-
-	unsigned short lut10_16[1024];
-	unsigned short lut16_16[65536];
-
-	/* pixel access functions */
-	GetRowFn* getRow;
-	SetRowFn* setRow;
-	CloseFn* close;
-	
-	unsigned char *membuffer;
-	uintptr_t membuffersize;
-	unsigned char *memcursor;
+	/* is the file LSB or MSB ? */
+	int isMSB;
+
+	/* DPX or Cineon ? */
+	int srcFormat;
+} LogImageFile;
+
+
+/* The SMPTE defines this code:
+ *  0 - User-defined
+ *  1 - Printing density
+ *  2 - Linear
+ *  3 - Logarithmic
+ *  4 - Unspecified video
+ *  5 - SMPTE 240M
+ *  6 - CCIR 709-1
+ *  7 - CCIR 601-2 system B or G
+ *  8 - CCIR 601-2 system M
+ *  9 - NTSC composite video
+ *  10 - PAL composite video
+ *  11 - Z linear
+ *  12 - homogeneous
+ *
+ * Note that transfer_characteristics is U8, don't need
+ * check the byte order.
+ */
+
+enum transfer {
+	transfer_UserDefined,
+	transfer_PrintingDensity,
+	transfer_Linear,
+	transfer_Logarithmic,
+	transfer_Unspecified,
+	transfer_Smpte240M,
+	transfer_Ccir7091,
+	transfer_Ccir6012BG,
+	transfer_Ccir6012M,
+	transfer_NTSC,
+	transfer_PAL,
+	transfer_ZLinear,
+	transfer_Homogeneous
+};
+
+/* The SMPTE defines this code:
+ * 0 - User-defined
+ * 1 - Red
+ * 2 - Green
+ * 3 - Blue
+ * 4 - Alpha
+ * 6 - Luminance
+ * 7 - Chrominance
+ * 8 - Depth
+ * 9 - Composite video
+ * 50 - RGB
+ * 51 - RGBA
+ * 52 - ABGR
+ * 100 - CbYCrY
+ * 101 - CbYACrYA
+ * 102 - CbYCr
+ * 103 - CbYCrA
+ * 150 - User-defined 2-component element
+ * 151 - User-defined 3-component element
+ * 152 - User-defined 4-component element
+ * 153 - User-defined 5-component element
+ * 154 - User-defined 6-component element
+ * 155 - User-defined 7-component element
+ * 156 - User-defined 8-component element
+ */
+
+enum descriptor {
+	descriptor_UserDefined,
+	descriptor_Red,
+	descriptor_Green,
+	descriptor_Blue,
+	descriptor_Alpha,
+	descriptor_Luminance        = 6, /* don't ask me why there's no 5 */
+	descriptor_Chrominance,
+	descriptor_Depth,
+	descriptor_Composite,
+	descriptor_RGB              = 50,
+	descriptor_RGBA,
+	descriptor_ABGR,
+	descriptor_CbYCrY           = 100,
+	descriptor_CbYACrYA,
+	descriptor_CbYCr,
+	descriptor_CbYCrA,
+	descriptor_UserDefined2Elt  = 150,
+	descriptor_UserDefined3Elt,
+	descriptor_UserDefined4Elt,
+	descriptor_UserDefined5Elt,
+	descriptor_UserDefined6Elt,
+	descriptor_UserDefined7Elt,
+	descriptor_UserDefined8Elt,
+	/* following descriptors are for internal use only */
+	descriptor_YA
 };
 
-void setupLut(LogImageFile*);
-void setupLut16(LogImageFile*);
+/* int functions return 0 for OK */
 
-int pixelsToLongs(int numPixels);
+void logImageSetVerbose(int verbosity);
+int logImageIsDpx(const void *buffer);
+int logImageIsCineon(const void *buffer);
+LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int size);
+LogImageFile *logImageOpenFromFile(const char *filename, int cineon);
+void logImageGetSize(LogImageFile *logImage, int *width, int *height, int *depth);
+LogImageFile *logImageCreate(const char *filename, int cineon, int width, int height, int bitsPerSample,
+                             int isLogarithmic, int hasAlpha, int referenceWhite, int referenceBlack,
+                             float gamma, const char *creator);
+void logImageClose(LogImageFile *logImage);
 
-/* typedefs used in original docs */
-/* note size assumptions! */
+/* Data handling */
+unsigned int getRowLength(int width, LogImageElement logElement);
+int logImageSetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB);
+int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB);
 
-typedef unsigned int U32;
-typedef unsigned short U16;
-typedef unsigned char U8;
-typedef signed int S32;
-typedef float R32;
-typedef char ASCII;
+/*
+ * Inline routines
+ */
+
+/* Endianness swapping */
+
+BLI_INLINE unsigned short swap_ushort(unsigned short x, int swap)
+{
+	if (swap != 0)
+		return (x >> 8) | (x << 8);
+	else
+		return x;
+}
+
+BLI_INLINE unsigned int swap_uint(unsigned int x, int swap)
+{
+	if (swap != 0)
+		return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24);
+	else
+		return x;
+}
+
+BLI_INLINE float swap_float(float x, int swap)
+{
+	if (swap != 0) {
+		union {
+			float f;
+			unsigned char b[4];
+		} dat1, dat2;
+
+		dat1.f = x;
+		dat2.b[0] = dat1.b[3];
+		dat2.b[1] = dat1.b[2];
+		dat2.b[2] = dat1.b[1];
+		dat2.b[3] = dat1.b[0];
+		return dat2.f;
+	}
+	else
+		return x;
+}
+
+/* Other */
+
+BLI_INLINE unsigned int clamp_uint(unsigned int x, unsigned int low, unsigned int high)
+{
+	if (x > high)
+		return high;
+	else if (x < low)
+		return low;
+	else
+		return x;
+}
+
+BLI_INLINE float clamp_float(float x, float low, float high)
+{
+	if (x > high)
+		return high;
+	else if (x < low)
+		return low;
+	else
+		return x;
+}
+
+BLI_INLINE unsigned int float_uint(float value, unsigned int max)
+{
+	if (value < 0.0f)
+		return 0;
+	else if (value > (1.0f - 0.5f / (float)max))
+		return max;
+	else
+		return (unsigned int)(((float)max * value) + 0.5f);
+}
 
-R32 htonf(R32 f);
-R32 ntohf(R32 f);
-R32 undefined(void);
-U16 reverseU16(U16 value);
-U32 reverseU32(U32 value);
-R32 reverseR32(R32 value);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* __LOGIMAGECORE_H__ */
+#endif  /* __LOG_IMAGE_CORE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c
deleted file mode 100644
index ccc6045..0000000
--- a/source/blender/imbuf/intern/cineon/logImageLib.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *	 Cineon and DPX image file format library routines.
- *
- *	 Copyright 1999 - 2002 David Hodson <hodsond at acm.org>
- *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
- *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
- *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/** \file blender/imbuf/intern/cineon/logImageLib.c
- *  \ingroup imbcineon
- */
-
-#include "cineonlib.h"
-#include "dpxlib.h"
-
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-#include <time.h>				 /* strftime() */
-#include <sys/types.h>
-#ifdef WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>	 /* htonl() */
-#endif
-#include <string.h>			 /* memset */
-#include "BLI_fileops.h"
-
-#define MIN_GAMMA 0.01
-#define MAX_GAMMA 99.9
-#define DEFAULT_GAMMA 1.0
-#define DEFAULT_BLACK_POINT 95
-#define DEFAULT_WHITE_POINT 685
-
-void
-logImageSetVerbose(int verbosity)
-{
-	cineonSetVerbose(verbosity);
-	dpxSetVerbose(verbosity);
-}
-
-LogImageFile*
-logImageOpen(const char* filename, int cineon)
-{
-	if (cineon) {
-		return cineonOpen(filename);
-	}
-	else {
-		return dpxOpen(filename);
-	}
-	return 0;
-}
-
-LogImageFile*
-logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon)
-{
-	if (cineon) {
-		return cineonOpenFromMem(buffer, size);
-	}
-	else {
-		return dpxOpenFromMem(buffer, size);
-	}
-	return 0;
-}
-
-LogImageFile*
-logImageCreate(const char* filename, int cineon, int width, int height, int depth)
-{
-	if (cineon) {
-		return cineonCreate(filename, width, height, depth);
-	}
-	else {
-		return dpxCreate(filename, width, height, depth);
-	}
-	return 0;
-}
-
-int
-logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* depth)
-{
-	*width = logImage->width;
-	*height = logImage->height;
-	*depth = logImage->depth;
-	return 0;
-}
-
-int
-logImageGetByteConversionDefaults(LogImageByteConversionParameters* params)
-{
-	params->gamma = DEFAULT_GAMMA;
-	params->blackPoint = DEFAULT_BLACK_POINT;
-	params->whitePoint = DEFAULT_WHITE_POINT;
-	params->doLogarithm = 0;
-	return 0;
-}
-
-int
-logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params)
-{
-	params->gamma = logImage->params.gamma;
-	params->blackPoint = logImage->params.blackPoint;
-	params->whitePoint = logImage->params.whitePoint;
-	params->doLogarithm = 0;
-	return 0;
-}
-
-int
-logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params)
-{
-	if ((params->gamma >= MIN_GAMMA) &&
-	    (params->gamma <= MAX_GAMMA) &&
-	    (params->blackPoint >= 0) &&
-	    (params->blackPoint < params->whitePoint) &&
-	    (params->whitePoint <= 1023))
-	{
-		logImage->params.gamma = params->gamma;
-		logImage->params.blackPoint = params->blackPoint;
-		logImage->params.whitePoint = params->whitePoint;
-		logImage->params.doLogarithm = params->doLogarithm;
-		setupLut16(logImage);
-		return 0;
-	}
-	return 1;
-}
-
-int
-logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y)
-{
-	return logImage->getRow(logImage, row, y);
-}
-
-int
-logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y)
-{
-	return logImage->setRow(logImage, row, y);
-}
-
-void
-logImageClose(LogImageFile* logImage)
-{
-	logImage->close(logImage);
-}
-
-void
-logImageDump(const char* filename)
-{
-
-	U32 magic;
-
-	FILE* foo = BLI_fopen(filename, "rb");
-	if (foo == 0) {
-		return;
-	}
-
-	if (fread(&magic, sizeof(magic), 1, foo) == 0) {
-		fclose(foo);
-		return;
-	}
-
-	fclose(foo);
-
-	if (magic == ntohl(CINEON_FILE_MAGIC)) {
-#if 0
-		cineonDump(filename);
-#endif
-	}
-	else if (magic == ntohl(DPX_FILE_MAGIC)) {
-		dpxDump(filename);
-	}
-}
diff --git a/source/blender/imbuf/intern/cineon/logImageLib.h b/source/blender/imbuf/intern/cineon/logImageLib.h
index 1c24358..e69de29 100644
--- a/source/blender/imbuf/intern/cineon/logImageLib.h
+++ b/source/blender/imbuf/intern/cineon/logImageLib.h
@@ -1,87 +0,0 @@
-/*
- *	 Common library definitions for Cineon and DPX image files.
- *
- *	 Copyright 1999,2000,2001 David Hodson <hodsond at acm.org>
- *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
- *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
- *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __LOGIMAGELIB_H__
-#define __LOGIMAGELIB_H__
-
-/** \file blender/imbuf/intern/cineon/logImageLib.h
- *  \ingroup imbcineon
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Image structure. You don't care what this is.
- */
-
-typedef struct _Log_Image_File_t_ LogImageFile;
-
-/*
- * Magic numbers for normal and byte-swapped Cineon and Dpx files
- */
-
-#define CINEON_FILE_MAGIC 0x802A5FD7
-#define DPX_FILE_MAGIC 0x53445058
-
-/*
- * Image 8 bit <-> 10 bit conversion parameters.
- */
-
-typedef struct {
-	float gamma;
-	int blackPoint;
-	int whitePoint;
-	int doLogarithm;
-} LogImageByteConversionParameters;
-
-/* int functions return 0 for OK */
-
-void logImageSetVerbose(int);
-
-LogImageFile* logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon);
-LogImageFile* logImageOpen(const char* filename, int cineon);
-int logImageGetSize(const LogImageFile* logImage, int* xsize, int* ysize, int* channels);
-LogImageFile* logImageCreate(const char* filename, int cineon, int xsize, int ysize, int channels);
-
-/* byte conversion routines for mapping logImage (usually) 10 bit values to 8 bit */
-/* see Kodak docs for details... */
-
-int logImageGetByteConversionDefaults(LogImageByteConversionParameters* params);
-int logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params);
-int logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params);
-
-/* get/set scanline of converted bytes */
-int logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y);
-int logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y);
-
-/* closes file and deletes data */
-void logImageClose(LogImageFile* logImage);
-
-/* read file and dump header info */
-void logImageDump(const char* filename);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LOGIMAGELIB_H__ */
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index a993858..3914f6d 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -1,21 +1,23 @@
 /*
- *	 Cineon image file format library routines.
+ * Cineon image file format library routines.
  *
- *	 Copyright 2006 Joseph Eagar (joeedh at gmail.com)
+ * Copyright 2006 Joseph Eagar (joeedh at gmail.com)
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
 
@@ -23,64 +25,102 @@
  *  \ingroup imbcineon
  */
 
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "logImageCore.h"
+#include "logmemfile.h"
 
-#include "logmemfile.h" /* own include */
-
-int logimage_fseek(void* logfile, intptr_t offsett, int origin)
-{	
-	struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile;
-	intptr_t offset = offsett;
-	
-	if (file->file) fseek(file->file, offset, origin);
-	else { /*we're seeking in memory*/
-		if (origin==SEEK_SET) {
-			if (offset > file->membuffersize) return 1;
-			file->memcursor = file->membuffer + offset;
+int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin)
+{
+	if (logFile->file)
+		fseek(logFile->file, offset, origin);
+	else { /* we're seeking in memory */
+		if (origin == SEEK_SET) {
+			if (offset > logFile->memBufferSize)
+				return 1;
+			logFile->memCursor = logFile->memBuffer + offset;
 		}
-		else if (origin==SEEK_END) {
-			if (offset > file->membuffersize) return 1;
-			file->memcursor = (file->membuffer + file->membuffersize) - offset;
+		else if (origin == SEEK_END) {
+			if (offset > logFile->memBufferSize)
+				return 1;
+			logFile->memCursor = (logFile->memBuffer + logFile->memBufferSize) - offset;
 		}
-		else if (origin==SEEK_CUR) {
-			uintptr_t pos = (uintptr_t)file->membuffer - (uintptr_t)file->memcursor;
-			if (pos + offset > file->membuffersize) return 1;
-			if (pos < 0) return 1;
-			file->memcursor += offset;
+		else if (origin == SEEK_CUR) {
+			uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+			if (pos + offset > logFile->memBufferSize || pos < 0)
+				return 1;
+
+			logFile->memCursor += offset;
 		}
 	}
 	return 0;
 }
 
-int logimage_fwrite(void *buffer, unsigned int size, unsigned int count, void *logfile)
+int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
 {
-	struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile;
-	if (file->file) return fwrite(buffer, size, count, file->file);
-	else { /*we're writing to memory*/
-		/*do nothing as this isn't supported yet*/
+	if (logFile->file)
+		return fwrite(buffer, size, count, logFile->file);
+	else { /* we're writing to memory */
+		/* do nothing as this isn't supported yet */
 		return count;
 	}
 }
 
-int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *logfile)
+int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
 {
-	struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile;
-	if (file->file) return fread(buffer, size, count, file->file);
-	else { /*we're reading from memory*/
-		int i;
-		/* we convert ot uchar just on the off chance some platform can't handle
-		 * pointer arithmetic with type (void*). */
-		unsigned char *buf = (unsigned char *) buffer; 
-		
-		for (i=0; i<count; i++) {
-			memcpy(buf, file->memcursor, size);
-			file->memcursor += size;
-			buf += size;
+	if (logFile->file) {
+		return fread(buffer, size, count, logFile->file);
+	}
+	else { /* we're reading from memory */
+		unsigned char *buf = (unsigned char *)buffer;
+		uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+		size_t total_size = size * count;
+		if (pos + total_size > logFile->memBufferSize) {
+			/* how many elements can we read without overflow ? */
+			count = (logFile->memBufferSize - pos) / size;
+			/* recompute the size */
+			total_size = size * count;
 		}
+
+		if (total_size != 0)
+			memcpy(buf, logFile->memCursor, total_size);
+
 		return count;
 	}
 }
+
+int logimage_read_uchar(unsigned char *x, LogImageFile *logFile)
+{
+	uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+	if (pos + sizeof(unsigned char) > logFile->memBufferSize)
+		return 1;
+
+	*x = *(unsigned char *)logFile->memCursor;
+	logFile->memCursor += sizeof(unsigned char);
+	return 0;
+}
+
+int logimage_read_ushort(unsigned short *x, LogImageFile *logFile)
+{
+	uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+	if (pos + sizeof(unsigned short) > logFile->memBufferSize)
+		return 1;
+
+	*x = *(unsigned short *)logFile->memCursor;
+	logFile->memCursor += sizeof(unsigned short);
+	return 0;
+}
+
+int logimage_read_uint(unsigned int *x, LogImageFile *logFile)
+{
+	uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+	if (pos + sizeof(unsigned int) > logFile->memBufferSize)
+		return 1;
+
+	*x = *(unsigned int *)logFile->memCursor;
+	logFile->memCursor += sizeof(unsigned int);
+	return 0;
+}
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h
index df3589a..068a53e 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.h
+++ b/source/blender/imbuf/intern/cineon/logmemfile.h
@@ -1,33 +1,43 @@
 /*
- *	 Cineon image file format library routines.
+ * Cineon image file format library routines.
  *
- *	 Copyright 2006 Joseph Eagar (joeedh at gmail.com)
+ * Copyright 2006 Joseph Eagar (joeedh at gmail.com)
  *
- *	 This program is free software; you can redistribute it and/or modify it
- *	 under the terms of the GNU General Public License as published by the Free
- *	 Software Foundation; either version 2 of the License, or (at your option)
- *	 any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
- *	 This program is distributed in the hope that it will be useful, but
- *	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- *	 or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU General Public License
- *	 for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- *	 You should have received a copy of the GNU General Public License
- *	 along with this program; if not, write to the Free Software
- *	 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Julien Enche.
  *
  */
- 
-#ifndef __LOGMEMFILE_H__
-#define __LOGMEMFILE_H__
 
 /** \file blender/imbuf/intern/cineon/logmemfile.h
  *  \ingroup imbcineon
  */
 
-int logimage_fseek(void* logfile, intptr_t offsett, int origin);
-int logimage_fwrite(void *buffer, unsigned int size, unsigned int count, void *logfile);
-int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *logfile);
 
-#endif /* __LOGMEMFILE_H__ */
+#ifndef __LOGMEMFILE_H__
+#define __LOGMEMFILE_H__
+
+#include "logImageCore.h"
+
+#include <stdlib.h>
+
+int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin);
+int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
+int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
+int logimage_read_uchar(unsigned char *x, LogImageFile *logFile);
+int logimage_read_ushort(unsigned short *x, LogImageFile *logFile);
+int logimage_read_uint(unsigned int *x, LogImageFile *logFile);
+
+#endif  /* __LOGMEMFILE_H__ */
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 37510c1..1c68a46 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -99,6 +99,7 @@ static pthread_mutex_t processor_lock = BLI_MUTEX_INITIALIZER;
 typedef struct ColormanageProcessor {
 	OCIO_ConstProcessorRcPtr *processor;
 	CurveMapping *curve_mapping;
+	int is_data_result;
 } ColormanageProcessor;
 
 /*********************** Color managed cache *************************/
@@ -163,7 +164,7 @@ typedef struct ColormanageProcessor {
  *       but they holds indexes of all transformations and color spaces, not
  *       their names.
  *
- *       This helps avoid extra colorsmace / display / view lookup without
+ *       This helps avoid extra colorspace / display / view lookup without
  *       requiring to pass all variables which affects on display buffer
  *       to color management cache system and keeps calls small and nice.
  */
@@ -889,7 +890,7 @@ void colormanage_imbuf_make_linear(ImBuf *ibuf, const char *from_colorspace)
 {
 	ColorSpace *colorspace = colormanage_colorspace_get_named(from_colorspace);
 
-	if (colorspace->is_data) {
+	if (colorspace && colorspace->is_data) {
 		ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
 		return;
 	}
@@ -1082,7 +1083,7 @@ void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name)
 {
 	ColorSpace *colorspace = colormanage_colorspace_get_named(name);
 
-	if (colorspace->is_data)
+	if (colorspace && colorspace->is_data)
 		ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
 	else
 		ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
@@ -1094,7 +1095,7 @@ void IMB_colormanagement_assign_float_colorspace(ImBuf *ibuf, const char *name)
 
 	ibuf->float_colorspace = colorspace;
 
-	if (colorspace->is_data)
+	if (colorspace && colorspace->is_data)
 		ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
 	else
 		ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
@@ -1106,7 +1107,7 @@ void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name)
 
 	ibuf->rect_colorspace = colorspace;
 
-	if (colorspace->is_data)
+	if (colorspace && colorspace->is_data)
 		ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
 	else
 		ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
@@ -1207,6 +1208,7 @@ static void *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle)
 
 	int predivide = handle->predivide;
 	int is_data = handle->is_data;
+	int is_data_display = handle->cm_processor->is_data_result;
 
 	linear_buffer = MEM_callocN(buffer_size * sizeof(float), "color conversion linear buffer");
 
@@ -1223,12 +1225,12 @@ static void *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle)
 		/* first convert byte buffer to float, keep in image space */
 		for (i = 0, fp = linear_buffer, cp = byte_buffer;
 		     i < channels * width * height;
-			 i++, fp++, cp++)
+		     i++, fp++, cp++)
 		{
 			*fp = (float)(*cp) / 255.0f;
 		}
 
-		if (!is_data) {
+		if (!is_data && !is_data_display) {
 			/* convert float buffer to scene linear space */
 			IMB_colormanagement_transform(linear_buffer, width, height, channels,
 			                              from_colorspace, to_colorspace, predivide);
@@ -1822,7 +1824,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
 			if (global_tot_display)
 				ibuf->display_buffer_flags = MEM_callocN(sizeof(unsigned int) * global_tot_display, "imbuf display_buffer_flags");
 		}
-		 else if (ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) {
+		else if (ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) {
 			/* all display buffers were marked as invalid from other areas,
 			 * now propagate this flag to internal color management routines
 			 */
@@ -2347,7 +2349,6 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
 			}
 			else if (byte_buffer) {
 				rgba_uchar_to_float(pixel, byte_buffer + linear_index);
-
 				IMB_colormanagement_colorspace_to_scene_linear_v3(pixel, rect_colorspace);
 			}
 
@@ -2382,9 +2383,9 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
 void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer,
                                        int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings,
                                        const ColorManagedDisplaySettings *display_settings,
-                                       int xmin, int ymin, int xmax, int ymax)
+                                       int xmin, int ymin, int xmax, int ymax, int update_orig_byte_buffer)
 {
-	if (ibuf->rect && ibuf->rect_float) {
+	if ((ibuf->rect && ibuf->rect_float) || update_orig_byte_buffer) {
 		/* update byte buffer created by legacy color management */
 
 		unsigned char *rect = (unsigned char *) ibuf->rect;
@@ -2449,28 +2450,30 @@ ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManag
                                                                 const ColorManagedDisplaySettings *display_settings)
 {
 	ColormanageProcessor *cm_processor;
+	ColorManagedViewSettings default_view_settings;
+	const ColorManagedViewSettings *applied_view_settings;
+	ColorSpace *display_space;
 
 	cm_processor = MEM_callocN(sizeof(ColormanageProcessor), "colormanagement processor");
 
-	{
-		ColorManagedViewSettings default_view_settings;
-		const ColorManagedViewSettings *applied_view_settings;
+	if (view_settings) {
+		applied_view_settings = view_settings;
+	}
+	else {
+		init_default_view_settings(display_settings,  &default_view_settings);
+		applied_view_settings = &default_view_settings;
+	}
 
-		if (view_settings) {
-			applied_view_settings = view_settings;
-		}
-		else {
-			init_default_view_settings(display_settings,  &default_view_settings);
-			applied_view_settings = &default_view_settings;
-		}
+	display_space =  display_transform_get_colorspace(applied_view_settings, display_settings);
+	if (display_space)
+		cm_processor->is_data_result = display_space->is_data;
 
-		cm_processor->processor = create_display_buffer_processor(applied_view_settings->view_transform, display_settings->display_device,
-		                                                          applied_view_settings->exposure, applied_view_settings->gamma);
+	cm_processor->processor = create_display_buffer_processor(applied_view_settings->view_transform, display_settings->display_device,
+	                                                          applied_view_settings->exposure, applied_view_settings->gamma);
 
-		if (applied_view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
-			cm_processor->curve_mapping = curvemapping_copy(applied_view_settings->curve_mapping);
-			curvemapping_premultiply(cm_processor->curve_mapping, FALSE);
-		}
+	if (applied_view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
+		cm_processor->curve_mapping = curvemapping_copy(applied_view_settings->curve_mapping);
+		curvemapping_premultiply(cm_processor->curve_mapping, FALSE);
 	}
 
 	return cm_processor;
@@ -2479,9 +2482,13 @@ ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManag
 ColormanageProcessor *IMB_colormanagement_colorspace_processor_new(const char *from_colorspace, const char *to_colorspace)
 {
 	ColormanageProcessor *cm_processor;
+	ColorSpace *color_space;
 
 	cm_processor = MEM_callocN(sizeof(ColormanageProcessor), "colormanagement processor");
 
+	color_space = colormanage_colorspace_get_named(to_colorspace);
+	cm_processor->is_data_result = color_space->is_data;
+
 	cm_processor->processor = create_colorspace_transform_processor(from_colorspace, to_colorspace);
 
 	return cm_processor;
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index f5e9e53..db2ca59 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -232,7 +232,7 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const
 			uint idx = (row[j] >> (2 * i)) & 3;
 			block->color(i, j) = color_array[idx];
 		}
-	}	
+	}
 }
 
 void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
@@ -592,7 +592,7 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const
 			uint idx = (row[j] >> (2 * i)) & 3;
 			block->color(i, j) = color_array[idx];
 		}
-	}	
+	}
 }
 
 void BlockCTX1::setIndices(int * idx)
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h
index 9b90b74..7e5a1e5 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.h
+++ b/source/blender/imbuf/intern/dds/BlockDXT.h
@@ -147,7 +147,7 @@ struct BlockDXT3
 struct AlphaBlockDXT5
 {
 	// uint64 unions do not compile on all platforms
-	/*
+#if 0
 	union {
 		struct {
 			uint64 alpha0 : 8;	// 8
@@ -171,26 +171,26 @@ struct AlphaBlockDXT5
 		};
 		uint64 u;
 	};
-	*/
+#endif
 	uint64 u;
-	uint8 alpha0() const { return u & 0xffLL; };
-	uint8 alpha1() const { return (u >> 8) & 0xffLL; };
-	uint8 bits0() const { return (u >> 16) & 0x7LL; };
-	uint8 bits1() const { return (u >> 19) & 0x7LL; };
-	uint8 bits2() const { return (u >> 22) & 0x7LL; };
-	uint8 bits3() const { return (u >> 25) & 0x7LL; };
-	uint8 bits4() const { return (u >> 28) & 0x7LL; };
-	uint8 bits5() const { return (u >> 31) & 0x7LL; };
-	uint8 bits6() const { return (u >> 34) & 0x7LL; };
-	uint8 bits7() const { return (u >> 37) & 0x7LL; };
-	uint8 bits8() const { return (u >> 40) & 0x7LL; };
-	uint8 bits9() const { return (u >> 43) & 0x7LL; };
-	uint8 bitsA() const { return (u >> 46) & 0x7LL; };
-	uint8 bitsB() const { return (u >> 49) & 0x7LL; };
-	uint8 bitsC() const { return (u >> 52) & 0x7LL; };
-	uint8 bitsD() const { return (u >> 55) & 0x7LL; };
-	uint8 bitsE() const { return (u >> 58) & 0x7LL; };
-	uint8 bitsF() const { return (u >> 61) & 0x7LL; };
+	uint8 alpha0() const { return u & 0xffLL; }
+	uint8 alpha1() const { return (u >> 8) & 0xffLL; }
+	uint8 bits0() const { return (u >> 16) & 0x7LL; }
+	uint8 bits1() const { return (u >> 19) & 0x7LL; }
+	uint8 bits2() const { return (u >> 22) & 0x7LL; }
+	uint8 bits3() const { return (u >> 25) & 0x7LL; }
+	uint8 bits4() const { return (u >> 28) & 0x7LL; }
+	uint8 bits5() const { return (u >> 31) & 0x7LL; }
+	uint8 bits6() const { return (u >> 34) & 0x7LL; }
+	uint8 bits7() const { return (u >> 37) & 0x7LL; }
+	uint8 bits8() const { return (u >> 40) & 0x7LL; }
+	uint8 bits9() const { return (u >> 43) & 0x7LL; }
+	uint8 bitsA() const { return (u >> 46) & 0x7LL; }
+	uint8 bitsB() const { return (u >> 49) & 0x7LL; }
+	uint8 bitsC() const { return (u >> 52) & 0x7LL; }
+	uint8 bitsD() const { return (u >> 55) & 0x7LL; }
+	uint8 bitsE() const { return (u >> 58) & 0x7LL; }
+	uint8 bitsF() const { return (u >> 61) & 0x7LL; }
 	
 	void evaluatePalette(uint8 alpha[8]) const;
 	void evaluatePalette8(uint8 alpha[8]) const;
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index e514b7a..5760372 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -39,9 +39,21 @@ set(INC_SYS
 )
 
 set(SRC
+	BlockDXT.h
+	Color.h
+	ColorBlock.h
+	Common.h
+	DirectDrawSurface.h
+	FlipDXT.h
+	Image.h
+	PixelFormat.h
+	Stream.h
+	dds_api.h
+
 	BlockDXT.cpp
 	ColorBlock.cpp
 	DirectDrawSurface.cpp
+	FlipDXT.cpp
 	Image.cpp
 	Stream.cpp
 	dds_api.cpp
@@ -51,4 +63,4 @@ if(WITH_IMAGE_DDS)
 	add_definitions(-DWITH_DDS)
 endif()
 
-blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}" "${INC_SYS}")                 
+blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index 0b9f5c1..dbd87bf 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -393,7 +393,7 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end)
 	int mini, maxi;
 	mini = maxi = 0;
 	
-	float min, max;	
+	float min, max;
 	min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
 
 	for (uint i = 1; i < 16; i++)
diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h
index 4e3e3e0..ab929b8 100644
--- a/source/blender/imbuf/intern/dds/Common.h
+++ b/source/blender/imbuf/intern/dds/Common.h
@@ -42,9 +42,9 @@ template<typename T>
 inline void
 swap(T & a, T & b)
 {
-  T tmp = a;
-  a = b;
-  b = tmp;
+	T tmp = a;
+	a = b;
+	b = tmp;
 }
 
 typedef unsigned char      uint8;
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index d9d0cb8..ccf72f9 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -280,19 +280,19 @@ static const uint DDPF_SRGB = 0x40000000U;
 		DXGI_FORMAT_B8G8R8A8_UNORM = 87,
 		DXGI_FORMAT_B8G8R8X8_UNORM = 88,
 
-        DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
-        DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
-        DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
-        DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
-        DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
-
-        DXGI_FORMAT_BC6H_TYPELESS = 94,
-        DXGI_FORMAT_BC6H_UF16 = 95,
-        DXGI_FORMAT_BC6H_SF16 = 96,
-
-        DXGI_FORMAT_BC7_TYPELESS = 97,
-        DXGI_FORMAT_BC7_UNORM = 98,
-        DXGI_FORMAT_BC7_UNORM_SRGB = 99,
+		DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
+		DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
+		DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
+		DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
+		DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
+
+		DXGI_FORMAT_BC6H_TYPELESS = 94,
+		DXGI_FORMAT_BC6H_UF16 = 95,
+		DXGI_FORMAT_BC6H_SF16 = 96,
+
+		DXGI_FORMAT_BC7_TYPELESS = 97,
+		DXGI_FORMAT_BC7_UNORM = 98,
+		DXGI_FORMAT_BC7_UNORM_SRGB = 99,
 	};
 
 	enum D3D10_RESOURCE_DIMENSION
@@ -496,60 +496,60 @@ void mem_read(Stream & mem, DDSHeader & header)
 
 namespace
 {
-    struct FormatDescriptor
-    {
-        uint format;
-        uint bitcount;
-        uint rmask;
-        uint gmask;
-        uint bmask;
-        uint amask;
-    };
-
-    static const FormatDescriptor s_d3dFormats[] =
-    {
-        { D3DFMT_R8G8B8,		24, 0xFF0000,   0xFF00,	    0xFF,       0 },
-        { D3DFMT_A8R8G8B8,		32, 0xFF0000,   0xFF00,     0xFF,       0xFF000000 },  // DXGI_FORMAT_B8G8R8A8_UNORM
-        { D3DFMT_X8R8G8B8,		32, 0xFF0000,   0xFF00,     0xFF,       0 },           // DXGI_FORMAT_B8G8R8X8_UNORM
-        { D3DFMT_R5G6B5,		16,	0xF800,     0x7E0,      0x1F,       0 },           // DXGI_FORMAT_B5G6R5_UNORM
-        { D3DFMT_X1R5G5B5,		16, 0x7C00,     0x3E0,      0x1F,       0 },
-        { D3DFMT_A1R5G5B5,		16, 0x7C00,     0x3E0,      0x1F,       0x8000 },      // DXGI_FORMAT_B5G5R5A1_UNORM
-        { D3DFMT_A4R4G4B4,		16, 0xF00,      0xF0,       0xF,        0xF000 },
-        { D3DFMT_R3G3B2,		8,  0xE0,       0x1C,       0x3,	    0 },
-        { D3DFMT_A8,			8,  0,          0,          0,		    8 },           // DXGI_FORMAT_A8_UNORM
-        { D3DFMT_A8R3G3B2,		16, 0xE0,       0x1C,       0x3,        0xFF00 },
-        { D3DFMT_X4R4G4B4,		16, 0xF00,      0xF0,       0xF,        0 },
-        { D3DFMT_A2B10G10R10,	32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },  // DXGI_FORMAT_R10G10B10A2
-        { D3DFMT_A8B8G8R8,		32, 0xFF,       0xFF00,     0xFF0000,   0xFF000000 },  // DXGI_FORMAT_R8G8B8A8_UNORM
-        { D3DFMT_X8B8G8R8,		32, 0xFF,       0xFF00,     0xFF0000,   0 },
-        { D3DFMT_G16R16,		32, 0xFFFF,     0xFFFF0000, 0,          0 },           // DXGI_FORMAT_R16G16_UNORM
-        { D3DFMT_A2R10G10B10,	32, 0x3FF00000, 0xFFC00,    0x3FF,      0xC0000000 },
-        { D3DFMT_A2B10G10R10,	32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },
-
-        { D3DFMT_L8,			8,  8,          0,          0,          0 },           // DXGI_FORMAT_R8_UNORM 
-        { D3DFMT_L16,			16, 16,         0,          0,          0 },           // DXGI_FORMAT_R16_UNORM
-    };
-
-    static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
+struct FormatDescriptor
+{
+	uint format;
+	uint bitcount;
+	uint rmask;
+	uint gmask;
+	uint bmask;
+	uint amask;
+};
+
+static const FormatDescriptor s_d3dFormats[] =
+{
+	{ D3DFMT_R8G8B8,        24, 0xFF0000,   0xFF00,     0xFF,       0 },
+	{ D3DFMT_A8R8G8B8,      32, 0xFF0000,   0xFF00,     0xFF,       0xFF000000 },  /* DXGI_FORMAT_B8G8R8A8_UNORM */
+	{ D3DFMT_X8R8G8B8,      32, 0xFF0000,   0xFF00,     0xFF,       0 },           /* DXGI_FORMAT_B8G8R8X8_UNORM */
+	{ D3DFMT_R5G6B5,        16, 0xF800,     0x7E0,      0x1F,       0 },           /* DXGI_FORMAT_B5G6R5_UNORM */
+	{ D3DFMT_X1R5G5B5,      16, 0x7C00,     0x3E0,      0x1F,       0 },
+	{ D3DFMT_A1R5G5B5,      16, 0x7C00,     0x3E0,      0x1F,       0x8000 },      /* DXGI_FORMAT_B5G5R5A1_UNORM */
+	{ D3DFMT_A4R4G4B4,      16, 0xF00,      0xF0,       0xF,        0xF000 },
+	{ D3DFMT_R3G3B2,        8,  0xE0,       0x1C,       0x3,        0 },
+	{ D3DFMT_A8,            8,  0,          0,          0,          8 },           /* DXGI_FORMAT_A8_UNORM */
+	{ D3DFMT_A8R3G3B2,      16, 0xE0,       0x1C,       0x3,        0xFF00 },
+	{ D3DFMT_X4R4G4B4,      16, 0xF00,      0xF0,       0xF,        0 },
+	{ D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },  /* DXGI_FORMAT_R10G10B10A2 */
+	{ D3DFMT_A8B8G8R8,      32, 0xFF,       0xFF00,     0xFF0000,   0xFF000000 },  /* DXGI_FORMAT_R8G8B8A8_UNORM */
+	{ D3DFMT_X8B8G8R8,      32, 0xFF,       0xFF00,     0xFF0000,   0 },
+	{ D3DFMT_G16R16,        32, 0xFFFF,     0xFFFF0000, 0,          0 },           /* DXGI_FORMAT_R16G16_UNORM */
+	{ D3DFMT_A2R10G10B10,   32, 0x3FF00000, 0xFFC00,    0x3FF,      0xC0000000 },
+	{ D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },
+
+	{ D3DFMT_L8,            8,  8,          0,          0,          0 },           /* DXGI_FORMAT_R8_UNORM */
+	{ D3DFMT_L16,           16, 16,         0,          0,          0 },           /* DXGI_FORMAT_R16_UNORM */
+};
+
+static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
 
 } // namespace
 
 static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
 {
-    for (int i = 0; i < s_d3dFormatCount; i++)
-        {
-            if (s_d3dFormats[i].bitcount == bitcount &&
-                s_d3dFormats[i].rmask == rmask &&
-                s_d3dFormats[i].gmask == gmask &&
-                s_d3dFormats[i].bmask == bmask &&
-                s_d3dFormats[i].amask == amask)
-            {
-                return s_d3dFormats[i].format;
-            }
-        }
+	for (int i = 0; i < s_d3dFormatCount; i++)
+	{
+		if (s_d3dFormats[i].bitcount == bitcount &&
+		    s_d3dFormats[i].rmask == rmask &&
+		    s_d3dFormats[i].gmask == gmask &&
+		    s_d3dFormats[i].bmask == bmask &&
+		    s_d3dFormats[i].amask == amask)
+		{
+			return s_d3dFormats[i].format;
+		}
+	}
 
-        return 0;
-    }
+	return 0;
+}
 
 
 
@@ -566,7 +566,7 @@ DDSHeader::DDSHeader()
 	for (uint i = 0; i < 11; i++) this->reserved[i] = 0;
 
 	// Store version information on the reserved header attributes.
-    this->reserved[9] = FOURCC_NVTT;
+	this->reserved[9] = FOURCC_NVTT;
 	this->reserved[10] = (2 << 16) | (1 << 8) | (0);	// major.minor.revision
 
 	this->pf.size = 32;
@@ -613,7 +613,7 @@ void DDSHeader::setMipmapCount(uint count)
 	if (count == 0 || count == 1)
 	{
 		this->flags &= ~DDSD_MIPMAPCOUNT;
-        this->mipmapcount = 1;
+		this->mipmapcount = 1;
 
 		if (this->caps.caps2 == 0) {
 			this->caps.caps1 = DDSCAPS_TEXTURE;
@@ -715,14 +715,14 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
 
 	if (rmask != 0 || gmask != 0 || bmask != 0)
 	{
-        if (gmask == 0 && bmask == 0)
-        {
-            this->pf.flags = DDPF_LUMINANCE;
-        }
-        else
-        {
-		    this->pf.flags = DDPF_RGB;
-        }
+		if (gmask == 0 && bmask == 0)
+		{
+			this->pf.flags = DDPF_LUMINANCE;
+		}
+		else
+		{
+			this->pf.flags = DDPF_RGB;
+		}
 
 		if (amask != 0) {
 			this->pf.flags |= DDPF_ALPHAPIXELS;
@@ -737,17 +737,17 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
 	{
 		// Compute bit count from the masks.
 		uint total = rmask | gmask | bmask | amask;
-		while(total != 0) {
+		while (total != 0) {
 			bitcount++;
 			total >>= 1;
 		}
 	}
 
-    // D3DX functions do not like this:
+	// D3DX functions do not like this:
 	this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask);
-    /*if (this->pf.fourcc) {
-        this->pf.flags |= DDPF_FOURCC;
-    }*/
+	/*if (this->pf.fourcc) {
+		this->pf.flags |= DDPF_FOURCC;
+	}*/
 
 	if (!(bitcount > 0 && bitcount <= 32)) {
 		printf("DDS: bad bit count, pixel format not set\n");
@@ -775,8 +775,8 @@ void DDSHeader::setNormalFlag(bool b)
 
 void DDSHeader::setSrgbFlag(bool b)
 {
-    if (b) this->pf.flags |= DDPF_SRGB;
-    else this->pf.flags &= ~DDPF_SRGB;
+	if (b) this->pf.flags |= DDPF_SRGB;
+	else this->pf.flags &= ~DDPF_SRGB;
 }
 
 void DDSHeader::setHasAlphaFlag(bool b)
@@ -787,8 +787,8 @@ void DDSHeader::setHasAlphaFlag(bool b)
 
 void DDSHeader::setUserVersion(int version)
 {
-    this->reserved[7] = FOURCC_UVER;
-    this->reserved[8] = version;
+	this->reserved[7] = FOURCC_UVER;
+	this->reserved[8] = version;
 }
 
 /*
@@ -836,45 +836,45 @@ bool DDSHeader::hasDX10Header() const
 
 uint DDSHeader::signature() const
 {
-    return this->reserved[9];
+	return this->reserved[9];
 }
 
 uint DDSHeader::toolVersion() const
 {
-    return this->reserved[10];
+	return this->reserved[10];
 }
 
 uint DDSHeader::userVersion() const
 {
-    if (this->reserved[7] == FOURCC_UVER) {
-        return this->reserved[8];
-    }
-    return 0;
+	if (this->reserved[7] == FOURCC_UVER) {
+		return this->reserved[8];
+	}
+	return 0;
 }
 
 bool DDSHeader::isNormalMap() const
 {
-    return (pf.flags & DDPF_NORMAL) != 0;
+	return (pf.flags & DDPF_NORMAL) != 0;
 }
 
 bool DDSHeader::isSrgb() const
 {
-    return (pf.flags & DDPF_SRGB) != 0;
+	return (pf.flags & DDPF_SRGB) != 0;
 }
 
 bool DDSHeader::hasAlpha() const
 {
-    return (pf.flags & DDPF_ALPHAPIXELS) != 0;
+	return (pf.flags & DDPF_ALPHAPIXELS) != 0;
 }
 
 uint DDSHeader::d3d9Format() const
 {
-    if (pf.flags & DDPF_FOURCC) {
-        return pf.fourcc;
-    }
-    else {
-        return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
-    }
+	if (pf.flags & DDPF_FOURCC) {
+		return pf.fourcc;
+	}
+	else {
+		return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
+	}
 }
 
 DirectDrawSurface::DirectDrawSurface(unsigned char *mem, uint size) : stream(mem, size), header()
@@ -949,9 +949,9 @@ bool DirectDrawSurface::isSupported() const
 				return false;
 			}
 		}
-        else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE))
-        {
-            // All RGB and luminance formats are supported now.
+		else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE))
+		{
+			// All RGB and luminance formats are supported now.
 		}
 		else
 		{
@@ -1001,7 +1001,7 @@ bool DirectDrawSurface::hasAlpha() const
 			}
 			else
 			{
-                // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
+				// @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
 				return true;
 			}
 		}
@@ -1089,7 +1089,7 @@ void DirectDrawSurface::setHasAlphaFlag(bool b)
 
 void DirectDrawSurface::setUserVersion(int version)
 {
-    header.setUserVersion(version);
+	header.setUserVersion(version);
 }
 
 void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
@@ -1268,15 +1268,15 @@ void DirectDrawSurface::readBlock(ColorBlock * rgba)
 		block.decodeBlock(rgba);
 	}
 	else if (fourcc == FOURCC_DXT2 ||
-	    header.pf.fourcc == FOURCC_DXT3)
+	         header.pf.fourcc == FOURCC_DXT3)
 	{
 		BlockDXT3 block;
 		mem_read(stream, block);
 		block.decodeBlock(rgba);
 	}
 	else if (fourcc == FOURCC_DXT4 ||
-	    header.pf.fourcc == FOURCC_DXT5 ||
-	    header.pf.fourcc == FOURCC_RXGB)
+	         header.pf.fourcc == FOURCC_DXT5 ||
+	         header.pf.fourcc == FOURCC_RXGB)
 	{
 		BlockDXT5 block;
 		mem_read(stream, block);
@@ -1393,8 +1393,8 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
 	}
 	else if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE))
 	{
-        uint pitch = computePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
-	
+		uint pitch = computePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
+
 		return pitch * h * d;
 	}
 	else {
@@ -1461,7 +1461,7 @@ void DirectDrawSurface::printInfo() const
 	printf("Pixel Format:\n");
 	printf("\tFlags: 0x%.8X\n", header.pf.flags);
 	if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n");
-    if (header.pf.flags & DDPF_LUMINANCE) printf("\t\tDDPF_LUMINANCE\n");
+	if (header.pf.flags & DDPF_LUMINANCE) printf("\t\tDDPF_LUMINANCE\n");
 	if (header.pf.flags & DDPF_FOURCC) printf("\t\tDDPF_FOURCC\n");
 	if (header.pf.flags & DDPF_ALPHAPIXELS) printf("\t\tDDPF_ALPHAPIXELS\n");
 	if (header.pf.flags & DDPF_ALPHA) printf("\t\tDDPF_ALPHA\n");
@@ -1472,24 +1472,24 @@ void DirectDrawSurface::printInfo() const
 	if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
 	if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
 	
-    if (header.pf.fourcc != 0) { 
-        // Display fourcc code even when DDPF_FOURCC flag not set.
-        printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
-			((header.pf.fourcc >> 0) & 0xFF),
-			((header.pf.fourcc >> 8) & 0xFF),
-			((header.pf.fourcc >> 16) & 0xFF),
-            ((header.pf.fourcc >> 24) & 0xFF), 
-            header.pf.fourcc);
-    }
-
-    if ((header.pf.flags & DDPF_FOURCC) && (header.pf.bitcount != 0))
+	if (header.pf.fourcc != 0) {
+		// Display fourcc code even when DDPF_FOURCC flag not set.
+		printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
+		       ((header.pf.fourcc >> 0) & 0xFF),
+		       ((header.pf.fourcc >> 8) & 0xFF),
+		       ((header.pf.fourcc >> 16) & 0xFF),
+		       ((header.pf.fourcc >> 24) & 0xFF),
+		       header.pf.fourcc);
+	}
+
+	if ((header.pf.flags & DDPF_FOURCC) && (header.pf.bitcount != 0))
 	{
-        printf("\tSwizzle: '%c%c%c%c' (0x%.8X)\n", 
-			(header.pf.bitcount >> 0) & 0xFF,
-			(header.pf.bitcount >> 8) & 0xFF,
-			(header.pf.bitcount >> 16) & 0xFF,
-            (header.pf.bitcount >> 24) & 0xFF,
-            header.pf.bitcount);
+		printf("\tSwizzle: '%c%c%c%c' (0x%.8X)\n",
+		       (header.pf.bitcount >> 0) & 0xFF,
+		       (header.pf.bitcount >> 8) & 0xFF,
+		       (header.pf.bitcount >> 16) & 0xFF,
+		       (header.pf.bitcount >> 24) & 0xFF,
+		       header.pf.bitcount);
 	}
 	else
 	{
@@ -1535,7 +1535,7 @@ void DirectDrawSurface::printInfo() const
 		printf("\tArray size: %u\n", header.header10.arraySize);
 	}
 
-    if (header.reserved[9] == FOURCC_NVTT)
+	if (header.reserved[9] == FOURCC_NVTT)
 	{
 		int major = (header.reserved[10] >> 16) & 0xFF;
 		int minor = (header.reserved[10] >> 8) & 0xFF;
@@ -1545,9 +1545,9 @@ void DirectDrawSurface::printInfo() const
 		printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
 	}
 
-    if (header.reserved[7] == FOURCC_UVER)
-    {
-        printf("User Version: %u\n", header.reserved[8]);
-    }
+	if (header.reserved[7] == FOURCC_UVER)
+	{
+		printf("User Version: %u\n", header.reserved[8]);
+	}
 }
 
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
index ccac1c0..72a524d 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
@@ -169,7 +169,7 @@ public:
 
 	void setNormalFlag(bool b);
 	void setHasAlphaFlag(bool b);
-        void setUserVersion(int version);
+	void setUserVersion(int version);
 	
 	void mipmap(Image * img, uint f, uint m);
 	void* readData(uint &size);
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
new file mode 100644
index 0000000..05821b2
--- /dev/null
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This file comes from the chromium project, adapted to Blender to add DDS
+// flipping to OpenGL convention for Blender
+
+#include "IMB_imbuf_types.h"
+
+#include <string.h>
+
+#include <Common.h>
+#include <Stream.h>
+#include <ColorBlock.h>
+#include <BlockDXT.h>
+#include <FlipDXT.h>
+
+// A function that flips a DXTC block.
+typedef void (*FlipBlockFunction)(uint8_t *block);
+
+// Flips a full DXT1 block in the y direction.
+static void FlipDXT1BlockFull(uint8_t *block)
+{
+	// A DXT1 block layout is:
+	// [0-1] color0.
+	// [2-3] color1.
+	// [4-7] color bitmap, 2 bits per pixel.
+	// So each of the 4-7 bytes represents one line, flipping a block is just
+	// flipping those bytes.
+	uint8_t tmp = block[4];
+	block[4] = block[7];
+	block[7] = tmp;
+	tmp = block[5];
+	block[5] = block[6];
+	block[6] = tmp;
+}
+
+// Flips the first 2 lines of a DXT1 block in the y direction.
+static void FlipDXT1BlockHalf(uint8_t *block)
+{
+	// See layout above.
+	uint8_t tmp = block[4];
+	block[4] = block[5];
+	block[5] = tmp;
+}
+
+// Flips a full DXT3 block in the y direction.
+static void FlipDXT3BlockFull(uint8_t *block)
+{
+	// A DXT3 block layout is:
+	// [0-7]	alpha bitmap, 4 bits per pixel.
+	// [8-15] a DXT1 block.
+
+	// We can flip the alpha bits at the byte level (2 bytes per line).
+	uint8_t tmp = block[0];
+
+	block[0] = block[6];
+	block[6] = tmp;
+	tmp = block[1];
+	block[1] = block[7];
+	block[7] = tmp;
+	tmp = block[2];
+	block[2] = block[4];
+	block[4] = tmp;
+	tmp = block[3];
+	block[3] = block[5];
+	block[5] = tmp;
+
+	// And flip the DXT1 block using the above function.
+	FlipDXT1BlockFull(block + 8);
+}
+
+// Flips the first 2 lines of a DXT3 block in the y direction.
+static void FlipDXT3BlockHalf(uint8_t *block)
+{
+	// See layout above.
+	uint8_t tmp = block[0];
+
+	block[0] = block[2];
+	block[2] = tmp;
+	tmp = block[1];
+	block[1] = block[3];
+	block[3] = tmp;
+	FlipDXT1BlockHalf(block + 8);
+}
+
+// Flips a full DXT5 block in the y direction.
+static void FlipDXT5BlockFull(uint8_t *block)
+{
+	// A DXT5 block layout is:
+	// [0]		alpha0.
+	// [1]		alpha1.
+	// [2-7]	alpha bitmap, 3 bits per pixel.
+	// [8-15] a DXT1 block.
+
+	// The alpha bitmap doesn't easily map lines to bytes, so we have to
+	// interpret it correctly.	Extracted from
+	// http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt :
+	//
+	//	 The 6 "bits" bytes of the block are decoded into one 48-bit integer:
+	//
+	//		 bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * (bits_3 +
+	//									 256 * (bits_4 + 256 * bits_5))))
+	//
+	//	 bits is a 48-bit unsigned integer, from which a three-bit control code
+	//	 is extracted for a texel at location (x,y) in the block using:
+	//
+	//			 code(x,y) = bits[3*(4*y+x)+1..3*(4*y+x)+0]
+	//
+	//	 where bit 47 is the most significant and bit 0 is the least
+	//	 significant bit.
+	unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
+	unsigned int line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
+	// swap lines 0 and 1 in line_0_1.
+	unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) |
+	                        ((line_0_1 & 0xfff000) >> 12);
+	// swap lines 2 and 3 in line_2_3.
+	unsigned int line_3_2 = ((line_2_3 & 0x000fff) << 12) |
+	                        ((line_2_3 & 0xfff000) >> 12);
+
+	block[2] = line_3_2 & 0xff;
+	block[3] = (line_3_2 & 0xff00) >> 8;
+	block[4] = (line_3_2 & 0xff0000) >> 8;
+	block[5] = line_1_0 & 0xff;
+	block[6] = (line_1_0 & 0xff00) >> 8;
+	block[7] = (line_1_0 & 0xff0000) >> 8;
+
+	// And flip the DXT1 block using the above function.
+	FlipDXT1BlockFull(block + 8);
+}
+
+// Flips the first 2 lines of a DXT5 block in the y direction.
+static void FlipDXT5BlockHalf(uint8_t *block)
+{
+	// See layout above.
+	unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
+	unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) |
+	                        ((line_0_1 & 0xfff000) >> 12);
+	block[2] = line_1_0 & 0xff;
+	block[3] = (line_1_0 & 0xff00) >> 8;
+	block[4] = (line_1_0 & 0xff0000) >> 8;
+	FlipDXT1BlockHalf(block + 8);
+}
+
+// Flips a DXTC image, by flipping and swapping DXTC blocks as appropriate.
+int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data)
+{
+	// must have valid dimensions
+	if (width == 0 || height == 0)
+		return 0;
+	// height must be a power-of-two
+	if ((height & (height - 1)) != 0)
+		return 0;
+
+	FlipBlockFunction full_block_function;
+	FlipBlockFunction half_block_function;
+	unsigned int block_bytes = 0;
+
+	switch (fourcc) {
+		case FOURCC_DXT1:
+			full_block_function = FlipDXT1BlockFull;
+			half_block_function = FlipDXT1BlockHalf;
+			block_bytes = 8;
+			break;
+		case FOURCC_DXT3:
+			full_block_function = FlipDXT3BlockFull;
+			half_block_function = FlipDXT3BlockHalf;
+			block_bytes = 16;
+			break;
+		case FOURCC_DXT5:
+			full_block_function = FlipDXT5BlockFull;
+			half_block_function = FlipDXT5BlockHalf;
+			block_bytes = 16;
+			break;
+		default:
+			return 0;
+	}
+
+	unsigned int mip_width = width;
+	unsigned int mip_height = height;
+
+	for (unsigned int i = 0; i < levels; ++i) {
+		unsigned int blocks_per_row = (mip_width + 3) / 4;
+		unsigned int blocks_per_col = (mip_height + 3) / 4;
+		unsigned int blocks = blocks_per_row * blocks_per_col;
+
+		if (mip_height == 1) {
+			// no flip to do, and we're done.
+			break;
+		}
+		else if (mip_height == 2) {
+			// flip the first 2 lines in each block.
+			for (unsigned int i = 0; i < blocks_per_row; ++i) {
+				half_block_function(data + i * block_bytes);
+			}
+		}
+		else {
+			// flip each block.
+			for (unsigned int i = 0; i < blocks; ++i)
+				full_block_function(data + i * block_bytes);
+
+			// swap each block line in the first half of the image with the
+			// corresponding one in the second half.
+			// note that this is a no-op if mip_height is 4.
+			unsigned int row_bytes = block_bytes * blocks_per_row;
+			uint8_t *temp_line = new uint8_t[row_bytes];
+
+			for (unsigned int y = 0; y < blocks_per_col / 2; ++y) {
+				uint8_t *line1 = data + y * row_bytes;
+				uint8_t *line2 = data + (blocks_per_col - y - 1) * row_bytes;
+
+				memcpy(temp_line, line1, row_bytes);
+				memcpy(line1, line2, row_bytes);
+				memcpy(line2, temp_line, row_bytes);
+			}
+
+			delete temp_line;
+		}
+
+		// mip levels are contiguous.
+		data += block_bytes * blocks;
+		mip_width = max(1U, mip_width >> 1);
+		mip_height = max(1U, mip_height >> 1);
+	}
+
+	return 1;
+}
+
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h
new file mode 100644
index 0000000..8d0ae81
--- /dev/null
+++ b/source/blender/imbuf/intern/dds/FlipDXT.h
@@ -0,0 +1,32 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __FLIPDXT_H__
+#define __FLIPDXT_H__
+
+#include "MEM_sys_types.h"
+
+/* flip compressed DXT image vertically to fit OpenGL convention */
+int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data);
+
+#endif
+
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index ce36fb0..2bb1864 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -101,37 +101,37 @@
 			}
 		}
 
-        inline float quantizeCeil(float f, int inbits, int outbits)
-        {
-            //uint i = f * (float(1 << inbits) - 1);
-            //i = convert(i, inbits, outbits);
-            //float result = float(i) / (float(1 << outbits) - 1);
-            //nvCheck(result >= f);
-            float result;
-            int offset = 0;
-            do {
-                uint i = offset + uint(f * (float(1 << inbits) - 1));
-                i = convert(i, inbits, outbits);
-                result = float(i) / (float(1 << outbits) - 1);
-                offset++;
-            } while (result < f);
-
-            return result;
-        }
-
-        /*
-        inline float quantizeRound(float f, int bits)
-        {
-            float scale = float(1 << bits);
-            return fround(f * scale) / scale;
-        }
-
-        inline float quantizeFloor(float f, int bits)
-        {
-            float scale = float(1 << bits);
-            return floor(f * scale) / scale;
-        }
-        */
+		inline float quantizeCeil(float f, int inbits, int outbits)
+		{
+			//uint i = f * (float(1 << inbits) - 1);
+			//i = convert(i, inbits, outbits);
+			//float result = float(i) / (float(1 << outbits) - 1);
+			//nvCheck(result >= f);
+			float result;
+			int offset = 0;
+			do {
+				uint i = offset + uint(f * (float(1 << inbits) - 1));
+				i = convert(i, inbits, outbits);
+				result = float(i) / (float(1 << outbits) - 1);
+				offset++;
+			} while (result < f);
+
+			return result;
+		}
+
+#if 0
+		inline float quantizeRound(float f, int bits)
+		{
+			float scale = float(1 << bits);
+			return fround(f * scale) / scale;
+		}
+
+		inline float quantizeFloor(float f, int bits)
+		{
+			float scale = float(1 << bits);
+			return floor(f * scale) / scale;
+		}
+#endif
 
 	} // PixelFormat namespace
 
diff --git a/source/blender/imbuf/intern/dds/SConscript b/source/blender/imbuf/intern/dds/SConscript
index 4245f50..475d211 100644
--- a/source/blender/imbuf/intern/dds/SConscript
+++ b/source/blender/imbuf/intern/dds/SConscript
@@ -1,18 +1,19 @@
 #!/usr/bin/python
 Import ('env')
 
-source_files = ['dds_api.cpp', 'DirectDrawSurface.cpp', 'Stream.cpp', 'BlockDXT.cpp', 'ColorBlock.cpp', 'Image.cpp']
+source_files = ['dds_api.cpp', 'DirectDrawSurface.cpp', 'Stream.cpp', 'BlockDXT.cpp', 'ColorBlock.cpp', 'Image.cpp', 'FlipDXT.cpp']
 
-incs = ['.',
-    '../../',
-    '../..',
+incs = [
+    '.',
     '..',
+    '../..',
     '../../../makesdna',
     '../../../blenkernel',
     '../../../blenlib',
     'intern/include',
     '#/intern/guardedalloc',
-    '#/intern/utfconv']
+    '#/intern/utfconv'
+    ]
 
 
 defs = ['WITH_DDS']
diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h
index 7fed4ca..a1ac49b 100644
--- a/source/blender/imbuf/intern/dds/Stream.h
+++ b/source/blender/imbuf/intern/dds/Stream.h
@@ -35,7 +35,7 @@ struct Stream
 	unsigned char *mem; // location in memory
 	unsigned int size;  // size
 	unsigned int pos;   // current position
-	Stream(unsigned char *m, unsigned int s) : mem(m), size(s), pos(0) {};
+	Stream(unsigned char *m, unsigned int s) : mem(m), size(s), pos(0) {}
 	unsigned int seek(unsigned int p);
 };
 
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index 7aacbf2..5459cff 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -29,6 +29,7 @@
 #include <dds_api.h>
 #include <Stream.h>
 #include <DirectDrawSurface.h>
+#include <FlipDXT.h>
 #include <stdio.h> // printf
 #include <fstream>
 
@@ -162,13 +163,18 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags, char colo
 			rect[i] = col;
 		}
 
-		if (ibuf->dds_data.fourcc != FOURCC_DDS)
+		if (ibuf->dds_data.fourcc != FOURCC_DDS) {
 			ibuf->dds_data.data = (unsigned char*)dds.readData(ibuf->dds_data.size);
+
+			/* flip compressed texture */
+			FlipDXTCImage(dds.width(), dds.height(), dds.mipmapCount(), dds.fourCC(), ibuf->dds_data.data);
+		}
 		else {
 			ibuf->dds_data.data = NULL;
 			ibuf->dds_data.size = 0;
 		}
 
+		/* flip uncompressed texture */
 		IMB_flipy(ibuf);
 	}
 
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index aa236af..f049c40 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -62,7 +62,7 @@ void IMB_de_interlace(ImBuf *ibuf)
 		tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
 		tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
 		
-		ibuf->x *= 2;	
+		ibuf->x *= 2;
 		IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
 		IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y);
 	
@@ -196,7 +196,7 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from,
 {
 	float tmp[4];
 	int x, y;
-	DitherContext *di;
+	DitherContext *di = NULL;
 
 	/* we need valid profiles */
 	BLI_assert(profile_to != IB_PROFILE_NONE);
@@ -561,7 +561,7 @@ void IMB_rect_from_float(ImBuf *ibuf)
 }
 
 /* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */
-void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h)
+void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data)
 {
 	float *rect_float;
 	uchar *rect_byte;
@@ -580,14 +580,27 @@ void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w
 	rect_float = ibuf->rect_float + (x + y * ibuf->x) * ibuf->channels;
 	rect_byte = (uchar *)ibuf->rect + (x + y * ibuf->x) * 4;
 
-	IMB_buffer_float_from_float(buffer, rect_float,
-	                            ibuf->channels, IB_PROFILE_SRGB, profile_from, predivide,
-	                            w, h, w, ibuf->x);
+	if (is_data) {
+		/* exception for non-color data, just copy float */
+		IMB_buffer_float_from_float(buffer, rect_float,
+		                            ibuf->channels, IB_PROFILE_LINEAR_RGB, IB_PROFILE_LINEAR_RGB, 0,
+		                            w, h, w, ibuf->x);
 
-	/* XXX: need to convert to image buffer's rect space */
-	IMB_buffer_byte_from_float(rect_byte, buffer,
-	                           4, ibuf->dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, 0,
-	                           w, h, ibuf->x, w);
+		/* and do color space conversion to byte */
+		IMB_buffer_byte_from_float(rect_byte, rect_float,
+		                           4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
+		                           w, h, ibuf->x, w);
+	}
+	else {
+		IMB_buffer_float_from_float(buffer, rect_float,
+		                            ibuf->channels, IB_PROFILE_SRGB, profile_from, predivide,
+		                            w, h, w, ibuf->x);
+
+		/* XXX: need to convert to image buffer's rect space */
+		IMB_buffer_byte_from_float(rect_byte, buffer,
+		                           4, ibuf->dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, 0,
+		                           w, h, ibuf->x, w);
+	}
 
 	/* ensure user flag is reset */
 	ibuf->userflags &= ~IB_RECT_INVALID;
@@ -710,7 +723,7 @@ void IMB_buffer_float_clamp(float *buf, int width, int height)
 {
 	int i, total = width * height * 4;
 	for (i = 0; i < total; i++) {
-		buf[i] = minf(1.0, buf[i]);
+		buf[i] = min_ff(1.0, buf[i]);
 	}
 }
 
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index ed4db50..5c2dc0c 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -74,8 +74,8 @@ ImFileType IMB_FILE_TYPES[] = {
 	{NULL, NULL, imb_is_a_targa, imb_ftype_default, imb_loadtarga, imb_savetarga, NULL, 0, TGA, COLOR_ROLE_DEFAULT_BYTE},
 	{NULL, NULL, imb_is_a_iris, imb_ftype_iris, imb_loadiris, imb_saveiris, NULL, 0, IMAGIC, COLOR_ROLE_DEFAULT_BYTE},
 #ifdef WITH_CINEON
-	{NULL, NULL, imb_is_dpx, imb_ftype_default, imb_loaddpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX, COLOR_ROLE_DEFAULT_FLOAT},
-	{NULL, NULL, imb_is_cineon, imb_ftype_default, imb_loadcineon, imb_savecineon, NULL, IM_FTYPE_FLOAT, CINEON, COLOR_ROLE_DEFAULT_FLOAT},
+	{NULL, NULL, imb_is_dpx, imb_ftype_default, imb_load_dpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX, COLOR_ROLE_DEFAULT_FLOAT},
+	{NULL, NULL, imb_is_cineon, imb_ftype_default, imb_load_cineon, imb_save_cineon, NULL, IM_FTYPE_FLOAT, CINEON, COLOR_ROLE_DEFAULT_FLOAT},
 #endif
 #ifdef WITH_TIFF
 	{imb_inittiff, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF, COLOR_ROLE_DEFAULT_BYTE},
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 863b842..a185c4e 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -43,6 +43,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_threads.h"
 #include "BLI_listbase.h"
+#include "BLI_math.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -95,132 +96,15 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **
 		*outF = ibuf->rect_float + offset;
 }
 
-/**************************************************************************
- *                            INTERPOLATIONS
- *
- * Reference and docs:
- * http://wiki.blender.org/index.php/User:Damiles#Interpolations_Algorithms
- ***************************************************************************/
-
-/* BICUBIC Interpolation functions
- *  More info: http://wiki.blender.org/index.php/User:Damiles#Bicubic_pixel_interpolation
- * function assumes out to be zero'ed, only does RGBA */
-
-static float P(float k)
-{
-	float p1, p2, p3, p4;
-	p1 = MAX2(k + 2.0f, 0);
-	p2 = MAX2(k + 1.0f, 0);
-	p3 = MAX2(k, 0);
-	p4 = MAX2(k - 1.0f, 0);
-	return (float)(1.0f / 6.0f) * (p1 * p1 * p1 - 4.0f * p2 * p2 * p2 + 6.0f * p3 * p3 * p3 - 4.0f * p4 * p4 * p4);
-}
-
-
-#if 0
-/* older, slower function, works the same as above */
-static float P(float k)
-{
-	return (float)(1.0f / 6.0f) * (pow(MAX2(k + 2.0f, 0), 3.0f) - 4.0f * pow(MAX2(k + 1.0f, 0), 3.0f) + 6.0f * pow(MAX2(k, 0), 3.0f) - 4.0f * pow(MAX2(k - 1.0f, 0), 3.0f));
-}
-#endif
+/* BICUBIC Interpolation */
 
 void bicubic_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
-	int i, j, n, m, x1, y1;
-	unsigned char *dataI;
-	float a, b, w, wx, wy[4], outR, outG, outB, outA, *dataF;
-
-	/* sample area entirely outside image? */
-	if (ceil(u) < 0 || floor(u) > in->x - 1 || ceil(v) < 0 || floor(v) > in->y - 1) {
-		return;
-	}
-
-	/* ImBuf in must have a valid rect or rect_float, assume this is already checked */
-
-	i = (int)floor(u);
-	j = (int)floor(v);
-	a = u - i;
-	b = v - j;
-
-	outR = outG = outB = outA = 0.0f;
-	
-/* Optimized and not so easy to read */
-	
-	/* avoid calling multiple times */
-	wy[0] = P(b - (-1));
-	wy[1] = P(b -  0);
-	wy[2] = P(b -  1);
-	wy[3] = P(b -  2);
-
-	for (n = -1; n <= 2; n++) {
-		x1 = i + n;
-		CLAMP(x1, 0, in->x - 1);
-		wx = P(n - a);
-		for (m = -1; m <= 2; m++) {
-			y1 = j + m;
-			CLAMP(y1, 0, in->y - 1);
-			/* normally we could do this */
-			/* w = P(n-a) * P(b-m); */
-			/* except that would call P() 16 times per pixel therefor pow() 64 times, better precalc these */
-			w = wx * wy[m + 1];
-
-			if (outF) {
-				dataF = in->rect_float + in->x * y1 * 4 + 4 * x1;
-				outR += dataF[0] * w;
-				outG += dataF[1] * w;
-				outB += dataF[2] * w;
-				outA += dataF[3] * w;
-			}
-			if (outI) {
-				dataI = (unsigned char *)in->rect + in->x * y1 * 4 + 4 * x1;
-				outR += dataI[0] * w;
-				outG += dataI[1] * w;
-				outB += dataI[2] * w;
-				outA += dataI[3] * w;
-			}
-		}
-	}
-
-/* Done with optimized part */
-	
-#if 0 
-	/* older, slower function, works the same as above */
-	for (n = -1; n <= 2; n++) {
-		for (m = -1; m <= 2; m++) {
-			x1 = i + n;
-			y1 = j + m;
-			if (x1 > 0 && x1 < in->x && y1 > 0 && y1 < in->y) {
-				if (do_float) {
-					dataF = in->rect_float + in->x * y1 * 4 + 4 * x1;
-					outR += dataF[0] * P(n - a) * P(b - m);
-					outG += dataF[1] * P(n - a) * P(b - m);
-					outB += dataF[2] * P(n - a) * P(b - m);
-					outA += dataF[3] * P(n - a) * P(b - m);
-				}
-				if (do_rect) {
-					dataI = (unsigned char *)in->rect + in->x * y1 * 4 + 4 * x1;
-					outR += dataI[0] * P(n - a) * P(b - m);
-					outG += dataI[1] * P(n - a) * P(b - m);
-					outB += dataI[2] * P(n - a) * P(b - m);
-					outA += dataI[3] * P(n - a) * P(b - m);
-				}
-			}
-		}
-	}
-#endif
-	
-	if (outI) {
-		outI[0] = (int)outR;
-		outI[1] = (int)outG;
-		outI[2] = (int)outB;
-		outI[3] = (int)outA;
-	}
 	if (outF) {
-		outF[0] = outR;
-		outF[1] = outG;
-		outF[2] = outB;
-		outF[3] = outA;
+		BLI_bicubic_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
+	}
+	else {
+		BLI_bicubic_interpolation_char((unsigned char*) in->rect, outI, in->x, in->y, 4, u, v);
 	}
 }
 
@@ -239,77 +123,14 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in
 	bicubic_interpolation_color(in, outI, outF, u, v);
 }
 
-/* function assumes out to be zero'ed, only does RGBA */
 /* BILINEAR INTERPOLATION */
 void bilinear_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
-	float *row1, *row2, *row3, *row4, a, b;
-	unsigned char *row1I, *row2I, *row3I, *row4I;
-	float a_b, ma_b, a_mb, ma_mb;
-	float empty[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-	unsigned char emptyI[4] = {0, 0, 0, 0};
-	int y1, y2, x1, x2;
-	
-	
-	/* ImBuf in must have a valid rect or rect_float, assume this is already checked */
-
-	x1 = (int)floor(u);
-	x2 = (int)ceil(u);
-	y1 = (int)floor(v);
-	y2 = (int)ceil(v);
-
-	/* sample area entirely outside image? */
-	if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) {
-		return;
-	}
-
 	if (outF) {
-		/* sample including outside of edges of image */
-		if (x1 < 0 || y1 < 0) row1 = empty;
-		else row1 = in->rect_float + in->x * y1 * 4 + 4 * x1;
-		
-		if (x1 < 0 || y2 > in->y - 1) row2 = empty;
-		else row2 = in->rect_float + in->x * y2 * 4 + 4 * x1;
-		
-		if (x2 > in->x - 1 || y1 < 0) row3 = empty;
-		else row3 = in->rect_float + in->x * y1 * 4 + 4 * x2;
-		
-		if (x2 > in->x - 1 || y2 > in->y - 1) row4 = empty;
-		else row4 = in->rect_float + in->x * y2 * 4 + 4 * x2;
-
-		a = u - floorf(u);
-		b = v - floorf(v);
-		a_b = a * b; ma_b = (1.0f - a) * b; a_mb = a * (1.0f - b); ma_mb = (1.0f - a) * (1.0f - b);
-
-		outF[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
-		outF[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
-		outF[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
-		outF[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
+		BLI_bilinear_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
 	}
-	if (outI) {
-		/* sample including outside of edges of image */
-		if (x1 < 0 || y1 < 0) row1I = emptyI;
-		else row1I = (unsigned char *)in->rect + in->x * y1 * 4 + 4 * x1;
-		
-		if (x1 < 0 || y2 > in->y - 1) row2I = emptyI;
-		else row2I = (unsigned char *)in->rect + in->x * y2 * 4 + 4 * x1;
-		
-		if (x2 > in->x - 1 || y1 < 0) row3I = emptyI;
-		else row3I = (unsigned char *)in->rect + in->x * y1 * 4 + 4 * x2;
-		
-		if (x2 > in->x - 1 || y2 > in->y - 1) row4I = emptyI;
-		else row4I = (unsigned char *)in->rect + in->x * y2 * 4 + 4 * x2;
-		
-		a = u - floorf(u);
-		b = v - floorf(v);
-		a_b = a * b; ma_b = (1.0f - a) * b; a_mb = a * (1.0f - b); ma_mb = (1.0f - a) * (1.0f - b);
-		
-		/* need to add 0.5 to avoid rounding down (causes darken with the smear brush)
-		 * tested with white images and this should not wrap back to zero */
-		outI[0] = (ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]) + 0.5f;
-		outI[1] = (ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]) + 0.5f;
-		outI[2] = (ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]) + 0.5f;
-		outI[3] = (ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]) + 0.5f;
+	else {
+		BLI_bilinear_interpolation_char((unsigned char*) in->rect, outI, in->x, in->y, 4, u, v);
 	}
 }
 
@@ -444,7 +265,7 @@ void neareast_interpolation_color(struct ImBuf *in, unsigned char outI[4], float
 			outF[2] = dataF[2];
 			outF[3] = dataF[3];
 		}
-	}	
+	}
 }
 
 void neareast_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, int yout)
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 593e080..277f50b 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -870,9 +870,9 @@ static void index_rebuild_ffmpeg_proc_decoded_frame(
 		context->start_pts_set = TRUE;
 	}
 
-	context->frameno = floor((pts - context->start_pts) 
-				 * context->pts_time_base 
-				 * context->frame_rate + 0.5f);
+	context->frameno = floor((pts - context->start_pts) *
+	                         context->pts_time_base  *
+	                         context->frame_rate + 0.5);
 
 	/* decoding starts *always* on I-Frames,
 	 * so: P-Frames won't work, even if all the
@@ -912,6 +912,8 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
 	AVPacket next_packet;
 	uint64_t stream_size;
 
+	memset(&next_packet, 0, sizeof(AVPacket));
+
 	in_frame = avcodec_alloc_frame();
 
 	stream_size = avio_size(context->iFormatCtx->pb);
@@ -959,12 +961,13 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
 	 * according to ffmpeg docs using 0-size packets.
 	 *
 	 * At least, if we haven't already stopped... */
+
+	/* this creates the 0-size packet and prevents a memory leak. */
+	av_free_packet(&next_packet);
+
 	if (!*stop) {
 		int frame_finished;
 
-		next_packet.size = 0;
-		next_packet.data = 0;
-
 		do {
 			frame_finished = 0;
 
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 549a28a..dec5f6f 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -408,7 +408,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags, char colo
 		}
 		
 		MEM_freeN(starttab);
-		MEM_freeN(lengthtab);	
+		MEM_freeN(lengthtab);
 
 	}
 	else {
@@ -613,7 +613,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
 				optr += 4;
 			}
 		}
-	}	
+	}
 }
 
 static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 0152346..3a2bf99 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -41,7 +41,7 @@
 
 #include "openjpeg.h"
 
-#define JP2_FILEHEADER_SIZE 14
+// #define JP2_FILEHEADER_SIZE 14  /* UNUSED */
 
 static char JP2_HEAD[] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
 static char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00};
@@ -387,8 +387,8 @@ BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT(const float _val)
 /*
  * 2048x1080 (2K) at 24 fps or 48 fps, or 4096x2160 (4K) at 24 fps; 3x12 bits per pixel, XYZ color space
  *
- * - In 2K, for Scope (2.39:1) presentation 2048x858 pixels of the imager is used
- * - In 2K, for Flat (1.85:1) presentation 1998x1080 pixels of the imager is used
+ * - In 2K, for Scope (2.39:1) presentation 2048x858  pixels of the image is used
+ * - In 2K, for Flat  (1.85:1) presentation 1998x1080 pixels of the image is used
  */
 
 /* ****************************** COPIED FROM image_to_j2k.c */
@@ -436,7 +436,7 @@ static void cinema_parameters(opj_cparameters_t *parameters)
 	parameters->image_offset_y0 = 0;
 
 	/*Codeblock size = 32 * 32*/
-	parameters->cblockw_init = 32;	
+	parameters->cblockw_init = 32;
 	parameters->cblockh_init = 32;
 	parameters->csty |= 0x01;
 
@@ -602,7 +602,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 		prec = 12;
 		numcomps = 3;
 	}
-	else { 
+	else {
 		/* Get settings from the imbuf */
 		color_space = (ibuf->ftype & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB;
 		
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 61275a8..758617b 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -235,19 +235,19 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t
  */
 #define INPUT_BYTE(cinfo, V, action)  \
 	MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
-		  bytes_in_buffer--; \
-		  V = GETJOCTET(*next_input_byte++); )
+	         bytes_in_buffer--; \
+	         V = GETJOCTET(*next_input_byte++); )
 
 /* As above, but read two bytes interpreted as an unsigned 16-bit integer.
  * V should be declared unsigned int or perhaps INT32.
  */
 #define INPUT_2BYTES(cinfo, V, action)  \
 	MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
-		  bytes_in_buffer--; \
-		  V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
-		  MAKE_BYTE_AVAIL(cinfo, action); \
-		  bytes_in_buffer--; \
-		  V += GETJOCTET(*next_input_byte++); )
+	      bytes_in_buffer--; \
+	      V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
+	      MAKE_BYTE_AVAIL(cinfo, action); \
+	      bytes_in_buffer--; \
+	      V += GETJOCTET(*next_input_byte++); )
 
 
 static boolean
@@ -348,25 +348,12 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
 							g = *buffer++;
 							b = *buffer++;
 							k = *buffer++;
-							
-							k = 255 - k;
-							r -= k;
-							if (r & 0xffffff00) {
-								if (r < 0) r = 0;
-								else r = 255;
-							}
-							g -= k;
-							if (g & 0xffffff00) {
-								if (g < 0) g = 0;
-								else g = 255;
-							}
-							b -= k;
-							if (b & 0xffffff00) {
-								if (b < 0) b = 0;
-								else b = 255;
-							}
-							
-							rect[3] = 255 - k;
+
+							r = (r * k) / 255;
+							g = (g * k) / 255;
+							b = (b * k) / 255;
+
+							rect[3] = 255;
 							rect[2] = b;
 							rect[1] = g;
 							rect[0] = r;
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index a5afc1a..d5cb8e8 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -39,6 +39,9 @@ set(INC_SYS
 )
 
 set(SRC
+	openexr_api.h
+	openexr_multi.h
+
 	openexr_api.cpp
 )
 
@@ -49,4 +52,4 @@ if(WITH_IMAGE_OPENEXR)
 	add_definitions(-DWITH_OPENEXR)
 endif()
 
-blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}")                 
+blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 066d07a..da7b31c 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -72,21 +72,6 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 
 #include <iostream>
 
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include <half.h>
-#include <Iex/Iex.h>
-#include <IlmImf/ImfVersion.h>
-#include <IlmImf/ImfArray.h>
-#include <IlmImf/ImfIO.h>
-#include <IlmImf/ImfChannelList.h>
-#include <IlmImf/ImfPixelType.h>
-#include <IlmImf/ImfInputFile.h>
-#include <IlmImf/ImfOutputFile.h>
-#include <IlmImf/ImfCompression.h>
-#include <IlmImf/ImfCompressionAttribute.h>
-#include <IlmImf/ImfStringAttribute.h>
-#include <Imath/ImathBox.h>
-#else
 #include <half.h>
 #include <Iex.h>
 #include <ImfVersion.h>
@@ -100,7 +85,6 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 #include <ImfCompression.h>
 #include <ImfCompressionAttribute.h>
 #include <ImfStringAttribute.h>
-#endif
 
 using namespace Imf;
 using namespace Imath;
@@ -238,19 +222,19 @@ public:
 			Iex::throwErrnoExc();
 	}
 
-    virtual void write(const char c[], int n)
+	virtual void write(const char c[], int n)
 	{
 		errno = 0;
 		ofs.write(c, n);
 		check_error();
 	}
 
-    virtual Int64 tellp()
+	virtual Int64 tellp()
 	{
 		return std::streamoff(ofs.tellp());
 	}
 
-    virtual void seekp(Int64 pos)
+	virtual void seekp(Int64 pos)
 	{
 		ofs.seekp(pos);
 		check_error();
@@ -881,7 +865,7 @@ void IMB_exr_close(void *handle)
 /* get a substring from the end of the name, separated by '.' */
 static int imb_exr_split_token(const char *str, const char *end, const char **token)
 {
-	int maxlen = end - str;
+	ptrdiff_t maxlen = end - str;
 	int len = 0;
 	while (len < maxlen && *(end - len - 1) != '.') {
 		len++;
@@ -1183,7 +1167,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char
 					frameBuffer.insert(exr_rgba_channelname(file, "B"),
 					                   Slice(Imf::FLOAT,  (char *) (first + 2), xstride, ystride));
 
-					/* 1.0 is fill value, this still neesd to be assigned even when (is_alpha == 0) */
+					/* 1.0 is fill value, this still needs to be assigned even when (is_alpha == 0) */
 					frameBuffer.insert(exr_rgba_channelname(file, "A"),
 					                   Slice(Imf::FLOAT,  (char *) (first + 3), xstride, ystride, 1, 1, 1.0f));
 
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index 7807197..376d240 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -35,10 +35,10 @@
 
 /* experiment with more advanced exr api */
 
-/* Note: as for now openexr only supports 32 chars in channel names.
- * This api also supports max 8 channels per pass now. easy to fix! */
-#define EXR_LAY_MAXNAME     51
-#define EXR_PASS_MAXNAME    11
+/* XXX layer+pass name max 64? */
+/* This api also supports max 8 channels per pass now. easy to fix! */
+#define EXR_LAY_MAXNAME     64
+#define EXR_PASS_MAXNAME    64
 #define EXR_TOT_MAXNAME     64
 #define EXR_PASS_MAXCHAN    8
 
diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
index 7262656..21fa878 100644
--- a/source/blender/imbuf/intern/openexr/openexr_stub.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
@@ -33,25 +33,25 @@
 #include "openexr_multi.h"
 
 
-void *	IMB_exr_get_handle			(void) {return NULL;}
-void	IMB_exr_add_channel			(void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {  (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
+void   *IMB_exr_get_handle          (void) {return NULL;}
+void    IMB_exr_add_channel         (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {  (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
 
-int		IMB_exr_begin_read			(void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
-int		IMB_exr_begin_write			(void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;}
-void	IMB_exrtile_begin_write		(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
+int     IMB_exr_begin_read          (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
+int     IMB_exr_begin_write         (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;}
+void    IMB_exrtile_begin_write     (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
 
-void	IMB_exr_set_channel			(void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
+void    IMB_exr_set_channel         (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
 
-void	IMB_exr_read_channels		(void *handle) { (void)handle; }
-void	IMB_exr_write_channels		(void *handle) { (void)handle; }
-void	IMB_exrtile_write_channels	(void *handle, int partx, int party, int level) { (void)handle; (void)partx; (void)party; (void)level; }
-void	IMB_exrtile_clear_channels	(void *handle) { (void)handle; }
+void    IMB_exr_read_channels       (void *handle) { (void)handle; }
+void    IMB_exr_write_channels      (void *handle) { (void)handle; }
+void    IMB_exrtile_write_channels  (void *handle, int partx, int party, int level) { (void)handle; (void)partx; (void)party; (void)level; }
+void    IMB_exrtile_clear_channels  (void *handle) { (void)handle; }
 
-void    IMB_exr_multilayer_convert	(void *handle, void *base,  
-									 void * (*addlayer)(void *base, const char *str),
-									 void (*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id))
-									{
-										(void)handle; (void)base; (void)addlayer; (void)addpass;
-									}
+void    IMB_exr_multilayer_convert  (void *handle, void *base,
+                                     void * (*addlayer)(void *base, const char *str),
+                                     void (*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id))
+{
+	(void)handle; (void)base; (void)addlayer; (void)addpass;
+}
 
-void	IMB_exr_close				(void *handle) { (void)handle; }
+void    IMB_exr_close               (void *handle) { (void)handle; }
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 6310d8e..dcfebb9 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -558,7 +558,8 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I
 		MEM_freeN(pixels);
 	if (pixels16)
 		MEM_freeN(pixels16);
-	MEM_freeN(row_pointers);
+	if (row_pointers)
+		MEM_freeN(row_pointers);
 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
 
 	return(ibuf);
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index 53b00f4..03ed1bb 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -65,7 +65,6 @@
 #define BLU 2
 #define EXP 3
 #define COLXS 128
-#define STR_MAX 540
 typedef unsigned char RGBE[4];
 typedef float fCOLOR[3];
 
@@ -154,7 +153,7 @@ static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe)
 	if (d <= 1e-32f)
 		rgbe[RED] = rgbe[GRN] = rgbe[BLU] = rgbe[EXP] = 0;
 	else {
-		d = frexp(d, &e) * 256.f / d;
+		d = (float)frexp(d, &e) * 256.0f / d;
 		rgbe[RED] = (unsigned char)(fcol[RED] * d);
 		rgbe[GRN] = (unsigned char)(fcol[GRN] * d);
 		rgbe[BLU] = (unsigned char)(fcol[BLU] * d);
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index a1fa05d..be20c80 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -100,7 +100,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co
 		}
 	}
 
-	fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
+	if ((flags & IB_test) == 0)
+		fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
 
 	return NULL;
 }
@@ -170,11 +171,12 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_S
 	return ibuf;
 }
 
-ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *IMB_testiffname(const char *filepath, int flags)
 {
 	ImBuf *ibuf;
 	int file;
 	char filepath_tx[IB_FILENAME_SIZE];
+	char colorspace[IM_MAX_SPACE] = "\0";
 
 	imb_cache_filename(filepath_tx, filepath, flags);
 
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index a11f16d..d2b0645 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -447,7 +447,7 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
 
 				drectf += destskip * 4;
 				srectf += srcskip * 4;
-			}		
+			}
 		}
 	}
 }
@@ -482,13 +482,13 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
 			*rrectf++ = col[2];
 			*rrectf++ = col[3];
 		}
-	}	
+	}
 }
 
 
 void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
-					   const float col[4], struct ColorManagedDisplay *display,
-					   int x1, int y1, int x2, int y2)
+                       const float col[4], struct ColorManagedDisplay *display,
+                       int x1, int y1, int x2, int y2)
 {
 	int i, j;
 	float a; /* alpha */
@@ -587,7 +587,7 @@ void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, i
 {
 	if (!ibuf) return;
 	buf_rectfill_area((unsigned char *) ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, display,
-					  x1, y1, x2, y2);
+	                  x1, y1, x2, y2);
 }
 
 
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 527f334..1e701b8 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -331,13 +331,13 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
 		for (y = ibuf2->y; y > 0; y--) {
 			p2f = p1f + (ibuf1->x << 2);
 			for (x = ibuf2->x; x > 0; x--) {
-					destf[0] = 0.25f * (p1f[0] + p2f[0] + p1f[4] + p2f[4]);
-					destf[1] = 0.25f * (p1f[1] + p2f[1] + p1f[5] + p2f[5]);
-					destf[2] = 0.25f * (p1f[2] + p2f[2] + p1f[6] + p2f[6]);
-					destf[3] = 0.25f * (p1f[3] + p2f[3] + p1f[7] + p2f[7]);
-					p1f += 8; 
-					p2f += 8; 
-					destf += 4;
+				destf[0] = 0.25f * (p1f[0] + p2f[0] + p1f[4] + p2f[4]);
+				destf[1] = 0.25f * (p1f[1] + p2f[1] + p1f[5] + p2f[5]);
+				destf[2] = 0.25f * (p1f[2] + p2f[2] + p1f[6] + p2f[6]);
+				destf[3] = 0.25f * (p1f[3] + p2f[3] + p1f[7] + p2f[7]);
+				p1f += 8;
+				p2f += 8;
+				destf += 4;
 			}
 			p1f = p2f;
 			if (ibuf1->x & 1) p1f += 4;
@@ -1467,10 +1467,10 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int
 		return ibuf;
 	}
 
-	if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
-	if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
-	if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
-	if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
+	if (newx && (newx < ibuf->x)) scaledownx(ibuf, newx);
+	if (newy && (newy < ibuf->y)) scaledowny(ibuf, newy);
+	if (newx && (newx > ibuf->x)) scaleupx(ibuf, newx);
+	if (newy && (newy > ibuf->y)) scaleupy(ibuf, newy);
 	
 	return(ibuf);
 }
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 253680e..eaad77f 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -55,9 +55,9 @@
 /***/
 
 typedef struct TARGA {
-	unsigned char numid;	
+	unsigned char numid;
 	unsigned char maptyp;
-	unsigned char imgtyp;	
+	unsigned char imgtyp;
 	short maporig;
 	short mapsize;
 	unsigned char mapbits;
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index ff7218d..94bb85b 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -175,7 +175,7 @@ static void to_hex_char(char *hexbytes, const unsigned char *bytes, int len)
 
 static int uri_from_filename(const char *path, char *uri)
 {
-	char orig_uri[URI_MAX];	
+	char orig_uri[URI_MAX];
 	const char *dirstart = path;
 	
 #ifdef WIN32
@@ -265,7 +265,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
 	char thumb[40];
 	short tsize = 128;
 	short ex, ey;
-	float scaledx, scaledy;	
+	float scaledx, scaledy;
 	struct stat info;
 
 	switch (size) {
@@ -334,7 +334,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
 					}
 					else {
 						IMB_freeImBuf(img);
-						img = IMB_anim_previewframe(anim);						
+						img = IMB_anim_previewframe(anim);
 					}
 					IMB_free_anim(anim);
 				}
@@ -401,7 +401,7 @@ ImBuf *IMB_thumb_read(const char *path, ThumbSize size)
 	if (!uri_from_filename(path, uri)) {
 		return NULL;
 	}
-	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {		
+	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
 		img = IMB_loadiffname(thumb, IB_rect | IB_metadata, NULL);
 	}
 
@@ -436,9 +436,9 @@ ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source)
 	struct stat st;
 	ImBuf *img = NULL;
 	
-	if (stat(path, &st)) {
+	if (BLI_stat(path, &st)) {
 		return NULL;
-	}	
+	}
 	if (!uri_from_filename(path, uri)) {
 		return NULL;
 	}
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index cfc49d8..73ced40 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -166,7 +166,7 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
 		margin_t = height - margin_b;
 	}
 
-	{	
+	{
 		int x, y;
 		int stride_x = (margin_r - margin_l) - 2;
 		
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 8dd791c..42fb0c7 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -228,16 +228,27 @@ static int isqtime(const char *name)
 
 #ifdef WITH_FFMPEG
 
+#ifdef _MSC_VER
+#define va_copy(dst, src) ((dst) = (src))
+#endif
+
 /* BLI_vsnprintf in ffmpeg_log_callback() causes invalid warning */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+#ifdef __GNUC__
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+#endif
 
 static char ffmpeg_last_error[1024];
 
 static void ffmpeg_log_callback(void *ptr, int level, const char *format, va_list arg)
 {
 	if (ELEM(level, AV_LOG_FATAL, AV_LOG_ERROR)) {
-		size_t n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg);
+		size_t n;
+		va_list arg2;
+
+		va_copy(arg2, arg);
+
+		n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg2);
 
 		/* strip trailing \n */
 		ffmpeg_last_error[n - 1] = '\0';
@@ -249,7 +260,9 @@ static void ffmpeg_log_callback(void *ptr, int level, const char *format, va_lis
 	}
 }
 
-#pragma GCC diagnostic pop
+#ifdef __GNUC__
+#  pragma GCC diagnostic pop
+#endif
 
 void IMB_ffmpeg_init(void)
 {
@@ -416,7 +429,7 @@ int IMB_isanim(const char *filename)
 				type = imb_get_anim_type(filename);
 			}
 			else {
-				return(FALSE);			
+				return(FALSE);
 			}
 		}
 		else { /* no quicktime */
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index d75c601..f227af7 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -372,7 +372,7 @@ typedef enum ePose_Flags {
 
 /* bPose->iksolver and bPose->ikparam->iksolver */
 typedef enum ePose_IKSolverType {
-	IKSOLVER_LEGACY = 0,
+	IKSOLVER_STANDARD = 0,
 	IKSOLVER_ITASC = 1
 } ePose_IKSolverType;
 
@@ -563,6 +563,7 @@ typedef enum eDopeSheet_FilterFlag {
 	/* general filtering 3 */
 	ADS_FILTER_INCL_HIDDEN      = (1 << 26),  /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
 	ADS_FILTER_BY_FCU_NAME      = (1 << 27),  /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */
+	ADS_FILTER_ONLY_ERRORS		= (1 << 28),  /* show only F-Curves which are disabled/have errors - for debugging drivers */
 	
 	/* combination filters (some only used at runtime) */
 	ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK)
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 4a5ad69..b445d59 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -46,21 +46,21 @@ typedef struct bAddObjectActuator {
 	struct Object *ob;
 } bAddObjectActuator;
 
-typedef struct bActionActuator {								
-	struct bAction *act;	/* Pointer to action */				
-	short	type, flag;		/* Playback type */  // not in use
-	float	sta, end;		/* Start & End frames */			
-	char	name[64];		/* For property-driven playback, MAX_NAME */	
-	char	frameProp[64];	/* Set this property to the actions current frame, MAX_NAME */
-	short	blendin;		/* Number of frames of blending */
-	short	priority;		/* Execution priority */
-	short	layer;			/* Animation layer */
-	short	end_reset;	/* Ending the actuator (negative pulse) wont reset the the action to its starting frame */
-	short	strideaxis;		/* Displacement axis */
-	short	pad;
-	float	stridelength;	/* Displacement incurred by cycle */ // not in use
-	float	layer_weight;	/* How much of the previous layer to use for blending. (<0 = disable, 0 = add mode) */
-} bActionActuator;												
+typedef struct bActionActuator {
+	struct bAction *act;    /* Pointer to action */
+	short   type, flag;     /* Playback type */  // not in use
+	float   sta, end;       /* Start & End frames */
+	char    name[64];       /* For property-driven playback, MAX_NAME */
+	char    frameProp[64];  /* Set this property to the actions current frame, MAX_NAME */
+	short   blendin;        /* Number of frames of blending */
+	short   priority;       /* Execution priority */
+	short   layer;          /* Animation layer */
+	short   end_reset;      /* Ending the actuator (negative pulse) wont reset the the action to its starting frame */
+	short   strideaxis;     /* Displacement axis */
+	short   pad;
+	float   stridelength;   /* Displacement incurred by cycle */ // not in use
+	float   layer_weight;   /* How much of the previous layer to use for blending. (<0 = disable, 0 = add mode) */
+} bActionActuator;
 
 typedef struct Sound3D {
 	float min_gain;
@@ -261,7 +261,7 @@ typedef struct bActuator {
 	/**
 	 * For ipo's and props: to find out which object the actuator
 	 * belongs to */
-	struct Object *ob;		
+	struct Object *ob;
 	
 } bActuator;
 
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 7cf0d58..1ac6e6d 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -246,13 +246,13 @@ typedef enum eFMod_Noise_Modifications {
 
 /* stepped modifier data */
 typedef struct FMod_Stepped {
-	float step_size;				/* Number of frames each interpolated value should be held */
-	float offset;					/* Reference frame number that stepping starts from */
-	
-	float start_frame;				/* start frame of the frame range that modifier works in */				
-	float end_frame;				/* end frame of the frame range that modifier works in */
-	
-	int flag;						/* various settings */	
+	float step_size;                /* Number of frames each interpolated value should be held */
+	float offset;                   /* Reference frame number that stepping starts from */
+
+	float start_frame;              /* start frame of the frame range that modifier works in */
+	float end_frame;                /* end frame of the frame range that modifier works in */
+
+	int flag;                       /* various settings */
 } FMod_Stepped;
 
 /* stepped modifier range flags */
@@ -325,14 +325,14 @@ typedef enum eDriverTarget_TransformChannels {
  */
 typedef struct DriverVar {
 	struct DriverVar *next, *prev;
-	
-	char name[64];				/* name of the variable to use in py-expression (must be valid python identifier) */
-	
-	DriverTarget targets[8];	/* MAX_DRIVER_TARGETS, target slots */	
-	short num_targets;			/* number of targets actually used by this variable */
-	
-	short type;					/* type of driver target (eDriverTarget_Types) */	
-	float curval;				/* result of previous evaluation */
+
+	char name[64];              /* name of the variable to use in py-expression (must be valid python identifier) */
+
+	DriverTarget targets[8];    /* MAX_DRIVER_TARGETS, target slots */
+	short num_targets;          /* number of targets actually used by this variable */
+
+	short type;                 /* type of driver target (eDriverTarget_Types) */
+	float curval;               /* result of previous evaluation */
 } DriverVar;
 
 /* Driver Variable Types */
@@ -556,36 +556,36 @@ typedef struct AnimMapper {
  */
 typedef struct NlaStrip {
 	struct NlaStrip *next, *prev;
-	
-	ListBase strips;			/* 'Child' strips (used for 'meta' strips) */
-	bAction *act;				/* Action that is referenced by this strip (strip is 'user' of the action) */
-	AnimMapper *remap;			/* Remapping info this strip (for tweaking correspondence of action with context) */
-	
-	ListBase fcurves;			/* F-Curves for controlling this strip's influence and timing */	// TODO: move out?
-	ListBase modifiers;			/* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */
-	
-	char name[64];				/* User-Visible Identifier for Strip */
-	
-	float influence;			/* Influence of strip */
-	float strip_time;			/* Current 'time' within action being used (automatically evaluated, but can be overridden) */
-	
-	float start, end;			/* extents of the strip */
-	float actstart, actend;		/* range of the action to use */
-	
-	float repeat;				/* The number of times to repeat the action range (only when no F-Curves) */
-	float scale;				/* The amount the action range is scaled by (only when no F-Curves) */
-	
-	float blendin, blendout;	/* strip blending length (only used when there are no F-Curves) */	
-	short blendmode;			/* strip blending mode (layer-based mixing) */
-	
-	short extendmode;			/* strip extrapolation mode (time-based mixing) */
+
+	ListBase strips;            /* 'Child' strips (used for 'meta' strips) */
+	bAction *act;               /* Action that is referenced by this strip (strip is 'user' of the action) */
+	AnimMapper *remap;          /* Remapping info this strip (for tweaking correspondence of action with context) */
+
+	ListBase fcurves;           /* F-Curves for controlling this strip's influence and timing */    // TODO: move out?
+	ListBase modifiers;         /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */
+
+	char name[64];              /* User-Visible Identifier for Strip */
+
+	float influence;            /* Influence of strip */
+	float strip_time;           /* Current 'time' within action being used (automatically evaluated, but can be overridden) */
+
+	float start, end;           /* extents of the strip */
+	float actstart, actend;     /* range of the action to use */
+
+	float repeat;               /* The number of times to repeat the action range (only when no F-Curves) */
+	float scale;                /* The amount the action range is scaled by (only when no F-Curves) */
+
+	float blendin, blendout;    /* strip blending length (only used when there are no F-Curves) */
+	short blendmode;            /* strip blending mode (layer-based mixing) */
+
+	short extendmode;           /* strip extrapolation mode (time-based mixing) */
 	short pad1;
-	
-	short type;					/* type of NLA strip */
-	
-	void *speaker_handle;		/* handle for speaker objects */
-	
-	int flag;					/* settings */
+
+	short type;                 /* type of NLA strip */
+
+	void *speaker_handle;       /* handle for speaker objects */
+
+	int flag;                   /* settings */
 	int pad2;
 } NlaStrip;
 
@@ -600,48 +600,48 @@ typedef enum eNlaStrip_Blend_Mode {
 /* NLA Strip Extrpolation Mode */
 typedef enum eNlaStrip_Extrapolate_Mode {
 		/* extend before first frame if no previous strips in track, and always hold+extend last frame */
-	NLASTRIP_EXTEND_HOLD	= 0,		
+	NLASTRIP_EXTEND_HOLD = 0,
 		/* only hold+extend last frame */
-	NLASTRIP_EXTEND_HOLD_FORWARD,	
+	NLASTRIP_EXTEND_HOLD_FORWARD = 1,
 		/* don't contribute at all */
-	NLASTRIP_EXTEND_NOTHING
+	NLASTRIP_EXTEND_NOTHING = 2
 } eNlaStrip_Extrapolate_Mode;
 
 /* NLA Strip Settings */
 typedef enum eNlaStrip_Flag {
 	/* UI selection flags */
 		/* NLA strip is the active one in the track (also indicates if strip is being tweaked) */
-	NLASTRIP_FLAG_ACTIVE		= (1<<0),	
+	NLASTRIP_FLAG_ACTIVE        = (1<<0),
 		/* NLA strip is selected for editing */
-	NLASTRIP_FLAG_SELECT		= (1<<1),
-//	NLASTRIP_FLAG_SELECT_L		= (1<<2),	// left handle selected
-//	NLASTRIP_FLAG_SELECT_R		= (1<<3),	// right handle selected
+	NLASTRIP_FLAG_SELECT        = (1<<1),
+//  NLASTRIP_FLAG_SELECT_L      = (1<<2),   // left handle selected
+//  NLASTRIP_FLAG_SELECT_R      = (1<<3),   // right handle selected
 		/* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */
-	NLASTRIP_FLAG_TWEAKUSER		= (1<<4),
-	
+	NLASTRIP_FLAG_TWEAKUSER     = (1<<4),
+
 	/* controls driven by local F-Curves */
 		/* strip influence is controlled by local F-Curve */
-	NLASTRIP_FLAG_USR_INFLUENCE	= (1<<5),
-	NLASTRIP_FLAG_USR_TIME		= (1<<6),
+	NLASTRIP_FLAG_USR_INFLUENCE = (1<<5),
+	NLASTRIP_FLAG_USR_TIME      = (1<<6),
 	NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7),
-	
+
 		/* NLA strip length is synced to the length of the referenced action */
-	NLASTRIP_FLAG_SYNC_LENGTH	= (1<<9),
-	
+	NLASTRIP_FLAG_SYNC_LENGTH   = (1<<9),
+
 	/* playback flags (may be overridden by F-Curves) */
 		/* NLA strip blendin/out values are set automatically based on overlaps */
-	NLASTRIP_FLAG_AUTO_BLENDS	= (1<<10),
+	NLASTRIP_FLAG_AUTO_BLENDS   = (1<<10),
 		/* NLA strip is played back in reverse order */
-	NLASTRIP_FLAG_REVERSE		= (1<<11),
+	NLASTRIP_FLAG_REVERSE       = (1<<11),
 		/* NLA strip is muted (i.e. doesn't contribute in any way) */
-	NLASTRIP_FLAG_MUTED			= (1<<12),
+	NLASTRIP_FLAG_MUTED         = (1<<12),
 		/* NLA Strip is played back in 'ping-pong' style */
-	NLASTRIP_FLAG_MIRROR		= (1<<13),
-	
+	NLASTRIP_FLAG_MIRROR        = (1<<13),
+
 	/* temporary editing flags */
 		/* NLA-Strip is really just a temporary meta used to facilitate easier transform code */
-	NLASTRIP_FLAG_TEMP_META		= (1<<30),
-	NLASTRIP_FLAG_EDIT_TOUCHED	= (1<<31)
+	NLASTRIP_FLAG_TEMP_META     = (1<<30),
+	NLASTRIP_FLAG_EDIT_TOUCHED  = (1<<31)
 } eNlaStrip_Flag;
 
 /* NLA Strip Type */
@@ -651,7 +651,7 @@ typedef enum eNlaStrip_Type {
 		/* 'transition' - blends between the adjacent strips */
 	NLASTRIP_TYPE_TRANSITION,
 		/* 'meta' - a strip which acts as a container for a few others */
-	NLASTRIP_TYPE_META,	
+	NLASTRIP_TYPE_META,
 	
 		/* 'emit sound' - a strip which is used for timing when speaker emits sounds */
 	NLASTRIP_TYPE_SOUND
@@ -827,71 +827,71 @@ typedef struct AnimOverride {
  * This datablock should be placed immediately after the ID block where it is used, so that
  * the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details.
  */
-typedef struct AnimData {	
+typedef struct AnimData {
 		/* active action - acts as the 'tweaking track' for the NLA */
-	bAction 	*action;	
-		/* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action 
-		 * took over to be edited in the Animation Editors) 
+	bAction     *action;
+		/* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action
+		 * took over to be edited in the Animation Editors)
 		 */
-	bAction 	*tmpact;
-		/* remapping-info for active action - should only be used if needed 
-		 * (for 'foreign' actions that aren't working correctly) 
+	bAction     *tmpact;
+		/* remapping-info for active action - should only be used if needed
+		 * (for 'foreign' actions that aren't working correctly)
 		 */
-	AnimMapper	*remap;			
-	
+	AnimMapper  *remap;
+
 		/* nla-tracks */
-	ListBase 	nla_tracks;
+	ListBase    nla_tracks;
 		/* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */
-	NlaStrip	*actstrip;
-	
-	/* 'drivers' for this ID-block's settings - FCurves, but are completely 
-	 * separate from those for animation data 
+	NlaStrip    *actstrip;
+
+	/* 'drivers' for this ID-block's settings - FCurves, but are completely
+	 * separate from those for animation data
 	 */
-	ListBase	drivers;	/* standard user-created Drivers/Expressions (used as part of a rig) */
-	ListBase 	overrides;	/* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */
-	
+	ListBase    drivers;    /* standard user-created Drivers/Expressions (used as part of a rig) */
+	ListBase    overrides;  /* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */
+
 		/* settings for animation evaluation */
-	int flag;				/* user-defined settings */
-	int recalc;				/* depsgraph recalculation flags */	
-	
+	int flag;               /* user-defined settings */
+	int recalc;             /* depsgraph recalculation flags */
+
 		/* settings for active action evaluation (based on NLA strip settings) */
-	short act_blendmode;	/* accumulation mode for active action */
-	short act_extendmode;	/* extrapolation mode for active action */
-	float act_influence;	/* influence for active action */
+	short act_blendmode;    /* accumulation mode for active action */
+	short act_extendmode;   /* extrapolation mode for active action */
+	float act_influence;    /* influence for active action */
 } AnimData;
 
 /* Animation Data settings (mostly for NLA) */
 typedef enum eAnimData_Flag {
 		/* only evaluate a single track in the NLA */
-	ADT_NLA_SOLO_TRACK		= (1<<0),
+	ADT_NLA_SOLO_TRACK      = (1<<0),
 		/* don't use NLA */
-	ADT_NLA_EVAL_OFF		= (1<<1),
+	ADT_NLA_EVAL_OFF        = (1<<1),
 		/* NLA is being 'tweaked' (i.e. in EditMode) */
-	ADT_NLA_EDIT_ON			= (1<<2),
+	ADT_NLA_EDIT_ON         = (1<<2),
 		/* active Action for 'tweaking' does not have mapping applied for editing */
-	ADT_NLA_EDIT_NOMAP		= (1<<3),
+	ADT_NLA_EDIT_NOMAP      = (1<<3),
 		/* NLA-Strip F-Curves are expanded in UI */
-	ADT_NLA_SKEYS_COLLAPSED	= (1<<4),
-	
+	ADT_NLA_SKEYS_COLLAPSED = (1<<4),
+
 		/* drivers expanded in UI */
-	ADT_DRIVERS_COLLAPSED	= (1<<10),
+	ADT_DRIVERS_COLLAPSED   = (1<<10),
 		/* don't execute drivers */
-	ADT_DRIVERS_DISABLED	= (1<<11),
-	
+	ADT_DRIVERS_DISABLED    = (1<<11),
+
 		/* AnimData block is selected in UI */
-	ADT_UI_SELECTED			= (1<<14),
+	ADT_UI_SELECTED         = (1<<14),
 		/* AnimData block is active in UI */
-	ADT_UI_ACTIVE			= (1<<15),
-	
+	ADT_UI_ACTIVE           = (1<<15),
+
 		/* F-Curves from this AnimData block are not visible in the Graph Editor */
-	ADT_CURVES_NOT_VISIBLE	= (1<<16)
+	ADT_CURVES_NOT_VISIBLE  = (1<<16)
 } eAnimData_Flag;
 
 /* Animation Data recalculation settings (to be set by depsgraph) */
 typedef enum eAnimData_Recalc {
-	ADT_RECALC_DRIVERS		= (1<<0),
-	ADT_RECALC_ANIM			= (1<<1),
-	ADT_RECALC_ALL			= (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM)
+	ADT_RECALC_DRIVERS      = (1 << 0),
+	ADT_RECALC_ANIM         = (1 << 1),
+	ADT_RECALC_ALL          = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM)
 } eAnimData_Recalc;
 
 /* Base Struct for Anim ------------------------------------- */
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 0a20a60..fd68a6d 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -45,91 +45,91 @@ struct AnimData;
  */
 
 typedef struct Bone {
-	struct Bone		*next, *prev;	/*	Next/prev elements within this list	*/
-	IDProperty 		*prop;			/* User-Defined Properties on this Bone */
-	struct Bone		*parent;		/*	Parent (ik parent if appropriate flag is set		*/
-	ListBase		childbase;		/*	Children	*/
-	char			name[64];		/*  Name of the bone - must be unique within the armature, MAXBONENAME */
-
-	float			roll;   /*  roll is input for editmode, length calculated */
-	float			head[3];		
-	float			tail[3];		/*	head/tail and roll in Bone Space	*/
-	float			bone_mat[3][3]; /*  rotation derived from head/tail/roll */
-	
-	int				flag;
-	
-	float			arm_head[3];		
-	float			arm_tail[3];	/*	head/tail in Armature Space (rest pos) */
-	float			arm_mat[4][4];  /*  matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
-	float           arm_roll;        /* roll in Armature Space (rest pos) */
-	
-	float			dist, weight;			/*  dist, weight: for non-deformgroup deforms */
-	float			xwidth, length, zwidth;	/*  width: for block bones. keep in this order, transform! */
-	float			ease1, ease2;			/*  length of bezier handles */
-	float			rad_head, rad_tail;	/* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head*/
-	
-	float			size[3];		/*  patch for upward compat, UNUSED! */
-	int				layer;			/* layers that bone appears on */
-	short			segments;		/*  for B-bones */
-	short 			pad[1];
+	struct Bone *next, *prev;    /*  Next/prev elements within this list */
+	IDProperty  *prop;           /* User-Defined Properties on this Bone */
+	struct Bone *parent;         /*  Parent (ik parent if appropriate flag is set */
+	ListBase     childbase;      /*  Children    */
+	char         name[64];       /*  Name of the bone - must be unique within the armature, MAXBONENAME */
+
+	float        roll;           /*  roll is input for editmode, length calculated */
+	float        head[3];
+	float        tail[3];        /*  head/tail and roll in Bone Space    */
+	float        bone_mat[3][3]; /*  rotation derived from head/tail/roll */
+
+	int          flag;
+
+	float        arm_head[3];
+	float        arm_tail[3];    /*  head/tail in Armature Space (rest pos) */
+	float        arm_mat[4][4];  /*  matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
+	float        arm_roll;       /* roll in Armature Space (rest pos) */
+
+	float        dist, weight;           /*  dist, weight: for non-deformgroup deforms */
+	float        xwidth, length, zwidth; /*  width: for block bones. keep in this order, transform! */
+	float        ease1, ease2;           /*  length of bezier handles */
+	float        rad_head, rad_tail;     /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head */
+
+	float        size[3];        /*  patch for upward compat, UNUSED! */
+	int          layer;          /* layers that bone appears on */
+	short        segments;       /*  for B-bones */
+	short        pad[1];
 } Bone;
 
 typedef struct bArmature {
-	ID			id;
+	ID          id;
 	struct AnimData *adt;
-	
-	ListBase	bonebase;
-	ListBase	chainbase;
-	ListBase	*edbo;					/* editbone listbase, we use pointer so we can check state */
-	
+
+	ListBase    bonebase;
+	ListBase    chainbase;
+	ListBase   *edbo;                   /* editbone listbase, we use pointer so we can check state */
+
 	/* active bones should work like active object where possible
 	 * - active and selection are unrelated
-	 * - active & hidden is not allowed 
+	 * - active & hidden is not allowed
 	 * - from the user perspective active == last selected
 	 * - active should be ignored when not visible (hidden layer) */
 
-	Bone		*act_bone;				/* active bone (when not in editmode) */
-	void		*act_edbone;			/* active editbone (in editmode) */
-
-	void		*sketch;				/* sketch struct for etch-a-ton */
-	
-	int			flag;
-	int			drawtype;
-	int			gevertdeformer;			/* how vertex deformation is handled in the ge */
-	int			pad;
-	short		deformflag; 
-	short		pathflag;
-	
-	unsigned int layer_used;		/* for UI, to show which layers are there */
-	unsigned int layer, layer_protected;		/* for buttons to work, both variables in this order together */
-	
+	Bone       *act_bone;               /* active bone (when not in editmode) */
+	void       *act_edbone;             /* active editbone (in editmode) */
+
+	void       *sketch;                 /* sketch struct for etch-a-ton */
+
+	int         flag;
+	int         drawtype;
+	int         gevertdeformer;         /* how vertex deformation is handled in the ge */
+	int         pad;
+	short       deformflag;
+	short       pathflag;
+
+	unsigned int layer_used;             /* for UI, to show which layers are there */
+	unsigned int layer, layer_protected; /* for buttons to work, both variables in this order together */
+
 // XXX deprecated... old animaton system (armature only viz) ---
-	short		ghostep, ghostsize;		/* number of frames to ghosts to show, and step between them  */
-	short		ghosttype, pathsize;		/* ghost drawing options and number of frames between points of path */
-	int			ghostsf, ghostef;		/* start and end frames of ghost-drawing range */
-	int 		pathsf, pathef;			/* start and end frames of path-calculation range for all bones */
-	int			pathbc, pathac;			/* number of frames before/after current frame of path-calculation for all bones  */
+	short       ghostep, ghostsize;     /* number of frames to ghosts to show, and step between them  */
+	short       ghosttype, pathsize;        /* ghost drawing options and number of frames between points of path */
+	int         ghostsf, ghostef;       /* start and end frames of ghost-drawing range */
+	int         pathsf, pathef;         /* start and end frames of path-calculation range for all bones */
+	int         pathbc, pathac;         /* number of frames before/after current frame of path-calculation for all bones  */
 // XXX end of deprecated code ----------------------------------
 } bArmature;
 
 /* armature->flag */
 /* don't use bit 7, was saved in files to disable stuff */
 typedef enum eArmature_Flag {
-	ARM_RESTPOS			= (1<<0),
-	ARM_DRAWXRAY		= (1<<1),	/* XRAY is here only for backwards converting */
-	ARM_DRAWAXES		= (1<<2),
-	ARM_DRAWNAMES		= (1<<3), 
-	ARM_POSEMODE		= (1<<4), 
-	ARM_EDITMODE		= (1<<5), 
-	ARM_DELAYDEFORM 	= (1<<6), 
-	ARM_DONT_USE    	= (1<<7),
-	ARM_MIRROR_EDIT		= (1<<8),
-	ARM_AUTO_IK			= (1<<9),
-	ARM_NO_CUSTOM		= (1<<10), 	/* made option negative, for backwards compat */
-	ARM_COL_CUSTOM		= (1<<11),	/* draw custom colors  */
-	ARM_GHOST_ONLYSEL 	= (1<<12),	/* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX deprecated */
-	ARM_DS_EXPAND 		= (1<<13),	/* dopesheet channel is expanded */
-	ARM_HAS_VIZ_DEPS	= (1<<14),	/* other objects are used for visualizing various states (hack for efficient updates) */
+	ARM_RESTPOS         = (1<<0),
+	ARM_DRAWXRAY        = (1<<1),   /* XRAY is here only for backwards converting */
+	ARM_DRAWAXES        = (1<<2),
+	ARM_DRAWNAMES       = (1<<3),
+	ARM_POSEMODE        = (1<<4),
+	ARM_EDITMODE        = (1<<5),
+	ARM_DELAYDEFORM     = (1<<6),
+	ARM_DONT_USE        = (1<<7),
+	ARM_MIRROR_EDIT     = (1<<8),
+	ARM_AUTO_IK         = (1<<9),
+	ARM_NO_CUSTOM       = (1<<10),  /* made option negative, for backwards compat */
+	ARM_COL_CUSTOM      = (1<<11),  /* draw custom colors  */
+	ARM_GHOST_ONLYSEL   = (1<<12),  /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX deprecated */
+	ARM_DS_EXPAND       = (1<<13),  /* dopesheet channel is expanded */
+	ARM_HAS_VIZ_DEPS    = (1<<14),  /* other objects are used for visualizing various states (hack for efficient updates) */
 } eArmature_Flag;
 
 /* armature->drawtype */
@@ -176,29 +176,29 @@ typedef enum eArmature_GhostType {
 
 /* bone->flag */
 typedef enum eBone_Flag {
-	BONE_SELECTED 				= (1<<0),
-	BONE_ROOTSEL				= (1<<1),
-	BONE_TIPSEL					= (1<<2),
-	BONE_TRANSFORM  			= (1<<3),	/* Used instead of BONE_SELECTED during transform */
-	BONE_CONNECTED 				= (1<<4),	/* when bone has a parent, connect head of bone to parent's tail*/
-	/* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */	
-	BONE_HIDDEN_P				= (1<<6), 	/* hidden Bones when drawing PoseChannels */	
-	BONE_DONE					= (1<<7),	/* For detecting cyclic dependencies */
-	BONE_DRAW_ACTIVE			= (1<<8), 	/* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
-	BONE_HINGE					= (1<<9),	/* No parent rotation or scale */
-	BONE_HIDDEN_A				= (1<<10), 	/* hidden Bones when drawing Armature Editmode */
-	BONE_MULT_VG_ENV 			= (1<<11), 	/* multiplies vgroup with envelope */
-	BONE_NO_DEFORM				= (1<<12),	/* bone doesn't deform geometry */
-	BONE_UNKEYED				= (1<<13), 	/* set to prevent destruction of its unkeyframed pose (after transform) */		
-	BONE_HINGE_CHILD_TRANSFORM 	= (1<<14), 	/* set to prevent hinge child bones from influencing the transform center */
-	BONE_NO_SCALE				= (1<<15), 	/* No parent scale */
-	BONE_HIDDEN_PG				= (1<<16),	/* hidden bone when drawing PoseChannels (for ghost drawing) */
-	BONE_DRAWWIRE				= (1<<17),	/* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
-	BONE_NO_CYCLICOFFSET		= (1<<18),	/* when no parent, bone will not get cyclic offset */
-	BONE_EDITMODE_LOCKED		= (1<<19),	/* bone transforms are locked in EditMode */
-	BONE_TRANSFORM_CHILD		= (1<<20),	/* Indicates that a parent is also being transformed */
-	BONE_UNSELECTABLE			= (1<<21),	/* bone cannot be selected */
-	BONE_NO_LOCAL_LOCATION		= (1<<22)	/* bone location is in armature space */
+	BONE_SELECTED               = (1 << 0),
+	BONE_ROOTSEL                = (1 << 1),
+	BONE_TIPSEL                 = (1 << 2),
+	BONE_TRANSFORM              = (1 << 3),   /* Used instead of BONE_SELECTED during transform */
+	BONE_CONNECTED              = (1 << 4),   /* when bone has a parent, connect head of bone to parent's tail*/
+	/* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */
+	BONE_HIDDEN_P               = (1 << 6),   /* hidden Bones when drawing PoseChannels */
+	BONE_DONE                   = (1 << 7),   /* For detecting cyclic dependencies */
+	BONE_DRAW_ACTIVE            = (1 << 8),   /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
+	BONE_HINGE                  = (1 << 9),   /* No parent rotation or scale */
+	BONE_HIDDEN_A               = (1 << 10),  /* hidden Bones when drawing Armature Editmode */
+	BONE_MULT_VG_ENV            = (1 << 11),  /* multiplies vgroup with envelope */
+	BONE_NO_DEFORM              = (1 << 12),  /* bone doesn't deform geometry */
+	BONE_UNKEYED                = (1 << 13),  /* set to prevent destruction of its unkeyframed pose (after transform) */
+	BONE_HINGE_CHILD_TRANSFORM  = (1 << 14),  /* set to prevent hinge child bones from influencing the transform center */
+	BONE_NO_SCALE               = (1 << 15),  /* No parent scale */
+	BONE_HIDDEN_PG              = (1 << 16),  /* hidden bone when drawing PoseChannels (for ghost drawing) */
+	BONE_DRAWWIRE               = (1 << 17),  /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
+	BONE_NO_CYCLICOFFSET        = (1 << 18),  /* when no parent, bone will not get cyclic offset */
+	BONE_EDITMODE_LOCKED        = (1 << 19),  /* bone transforms are locked in EditMode */
+	BONE_TRANSFORM_CHILD        = (1 << 20),  /* Indicates that a parent is also being transformed */
+	BONE_UNSELECTABLE           = (1 << 21),  /* bone cannot be selected */
+	BONE_NO_LOCAL_LOCATION      = (1 << 22)   /* bone location is in armature space */
 } eBone_Flag;
 
 #define MAXBONENAME 64
diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h
index ce5fc4b..f1930ff 100644
--- a/source/blender/makesdna/DNA_boid_types.h
+++ b/source/blender/makesdna/DNA_boid_types.h
@@ -36,18 +36,18 @@
 
 typedef enum BoidRuleType {
 	eBoidRuleType_None = 0,
-	eBoidRuleType_Goal = 1,			/* go to goal assigned object or loudest assigned signal source */
-	eBoidRuleType_Avoid = 2,		/* get away from assigned object or loudest assigned signal source */
-	eBoidRuleType_AvoidCollision = 3,	/* manoeuver to avoid collisions with other boids and deflector object in near future */
-	eBoidRuleType_Separate = 4,		/* keep from going through other boids */
-	eBoidRuleType_Flock = 5,		/* move to center of neighbors and match their velocity */
-	eBoidRuleType_FollowLeader = 6,		/* follow a boid or assigned object */
-	eBoidRuleType_AverageSpeed = 7,		/* maintain speed, flight level or wander*/
-	eBoidRuleType_Fight = 8,		/* go to closest enemy and attack when in range */
-	//eBoidRuleType_Protect = 9,		/* go to enemy closest to target and attack when in range */
-	//eBoidRuleType_Hide = 10,		/* find a deflector move to it's other side from closest enemy */
-	//eBoidRuleType_FollowPath = 11,	/* move along a assigned curve or closest curve in a group */
-	//eBoidRuleType_FollowWall = 12,	/* move next to a deflector object's in direction of it's tangent */
+	eBoidRuleType_Goal = 1,             /* go to goal assigned object or loudest assigned signal source */
+	eBoidRuleType_Avoid = 2,            /* get away from assigned object or loudest assigned signal source */
+	eBoidRuleType_AvoidCollision = 3,   /* manoeuver to avoid collisions with other boids and deflector object in near future */
+	eBoidRuleType_Separate = 4,         /* keep from going through other boids */
+	eBoidRuleType_Flock = 5,            /* move to center of neighbors and match their velocity */
+	eBoidRuleType_FollowLeader = 6,     /* follow a boid or assigned object */
+	eBoidRuleType_AverageSpeed = 7,     /* maintain speed, flight level or wander*/
+	eBoidRuleType_Fight = 8,            /* go to closest enemy and attack when in range */
+	//eBoidRuleType_Protect = 9,        /* go to enemy closest to target and attack when in range */
+	//eBoidRuleType_Hide = 10,          /* find a deflector move to it's other side from closest enemy */
+	//eBoidRuleType_FollowPath = 11,    /* move along a assigned curve or closest curve in a group */
+	//eBoidRuleType_FollowWall = 12,    /* move next to a deflector object's in direction of it's tangent */
 	NUM_BOID_RULE_TYPES
 } BoidRuleType;
 
@@ -67,7 +67,7 @@ typedef struct BoidRuleGoalAvoid {
 	BoidRule rule;
 	struct Object *ob;
 	int options;
-	float fear_factor;	
+	float fear_factor;
 
 	/* signals */
 	int signal_id, channels;
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 4928a88..df1cba6 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -45,7 +45,7 @@
  */
 
 typedef struct ClothSimSettings {
-	struct	LinkNode *cache; /* UNUSED atm */	
+	struct	LinkNode *cache; /* UNUSED atm */
 	float 	mingoal; 	/* see SB */
 	float	Cdis;		/* Mechanical damping of springs.		*/
 	float	Cvi;		/* Viscous/fluid damping.			*/
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 8b1e7e1..f1b7a7c 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -170,7 +170,7 @@ typedef struct bSplineIKConstraint {
 	short 		numpoints;	/* number of points to bound in points array */
 	short		chainlen;	/* number of bones ('n') that are in the chain */
 	
-		/* settings */	
+		/* settings */
 	short flag;				/* general settings for constraint */
 	short xzScaleMode;		/* method used for determining the x & z scaling of the bones */
 } bSplineIKConstraint;
@@ -340,7 +340,7 @@ typedef struct bTransformConstraint {
 	float		from_max[3];	/* 	to map on to to_min/max range. 			*/
 	
 	float		to_min[3];		/* range of motion on owner caused by target  */
-	float		to_max[3];	
+	float		to_max[3];
 } bTransformConstraint;
 
 /* Pivot Constraint */
@@ -486,7 +486,7 @@ typedef enum eBConstraint_Flags {
 	CONSTRAINT_EXPAND =		(1<<0), 
 		/* pre-check for illegal object name or bone name */
 	CONSTRAINT_DISABLE = 	(1<<2), 
-		/* to indicate which Ipo should be shown, maybe for 3d access later too */	
+		/* to indicate which Ipo should be shown, maybe for 3d access later too */
 	CONSTRAINT_ACTIVE = 	(1<<4), 
 		/* to indicate that the owner's space should only be changed into ownspace, but not out of it */
 	CONSTRAINT_SPACEONCE = 	(1<<6),
@@ -664,7 +664,7 @@ typedef enum eSplineIK_Flags {
 	/* bones in the chain should not scale to fit the curve */
 	CONSTRAINT_SPLINEIK_SCALE_LIMITED	= (1<<2),
 	/* evenly distribute the bones along the path regardless of length */
-	CONSTRAINT_SPLINEIK_EVENSPLITS		= (1<<3),	
+	CONSTRAINT_SPLINEIK_EVENSPLITS		= (1<<3),
 	/* don't adjust the x and z scaling of the bones by the curve radius */
 	CONSTRAINT_SPLINEIK_NO_CURVERAD	= (1<<4)
 } eSplineIK_Flags;
@@ -751,7 +751,7 @@ typedef enum eChildOf_Flags {
 	/* Restrictions for Pivot Constraint axis to consider for enabling constraint */
 typedef enum ePivotConstraint_Axis {
 	/* do not consider this activity-clamping */
-	PIVOTCON_AXIS_NONE = -1,	
+	PIVOTCON_AXIS_NONE = -1,
 	
 	/* consider -ve x-axis rotations */
 	PIVOTCON_AXIS_X_NEG = 0,
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 9fbe045..deb9902 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -201,8 +201,8 @@ typedef struct Curve {
 	float twist_smooth, smallcaps_scale;
 
 	int pathlen;
-	short pad, totcol;
-	short flag, bevresol;
+	short bevresol, totcol;
+	int flag;
 	float width, ext1, ext2;
 	
 	/* default */
@@ -234,11 +234,11 @@ typedef struct Curve {
 	
 	float ctime;			/* current evaltime - for use by Objects parented to curves */
 	int totbox, actbox;
-	struct TextBox *tb;	
+	struct TextBox *tb;
 	
-	int selstart, selend;	
+	int selstart, selend;
 	
-	struct CharInfo *strinfo;	
+	struct CharInfo *strinfo;
 	struct CharInfo curinfo;
 
 	float bevfac1, bevfac2;
@@ -269,6 +269,7 @@ typedef struct Curve {
 #define CU_PATH_RADIUS	4096 /* make use of the path radius if this is enabled (default for new curves) */
 #define CU_DEFORM_FILL	8192 /* fill 2d curve after deformation */
 #define CU_FILL_CAPS	16384 /* fill bevel caps */
+#define CU_MAP_TAPER	32768 /* map taper object to bevelled area */
 
 /* twist mode */
 #define CU_TWIST_Z_UP			0
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 9d40af9..6f7bb5a 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -80,7 +80,7 @@ typedef struct CustomData {
 #define CD_MCOL			6
 #define CD_ORIGINDEX	7
 #define CD_NORMAL		8
-#define CD_POLYINDEX	9
+//#define CD_POLYINDEX	9
 #define CD_PROP_FLT		10
 #define CD_PROP_INT		11
 #define CD_PROP_STR		12
@@ -124,7 +124,7 @@ typedef struct CustomData {
 #define CD_MASK_MCOL		(1 << CD_MCOL)
 #define CD_MASK_ORIGINDEX	(1 << CD_ORIGINDEX)
 #define CD_MASK_NORMAL		(1 << CD_NORMAL)
-#define CD_MASK_POLYINDEX	(1 << CD_POLYINDEX)
+// #define CD_MASK_POLYINDEX	(1 << CD_POLYINDEX)
 #define CD_MASK_PROP_FLT	(1 << CD_PROP_FLT)
 #define CD_MASK_PROP_INT	(1 << CD_PROP_INT)
 #define CD_MASK_PROP_STR	(1 << CD_PROP_STR)
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 20f7bb4..2d1549f 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -35,8 +35,8 @@
 
 struct SDNA;
 
-extern unsigned char DNAstr[];  /* DNA.c */
-extern int DNAlen;
+extern const unsigned char DNAstr[];  /* DNA.c */
+extern const int DNAlen;
 
 typedef enum eSDNA_Type {
 	SDNA_TYPE_CHAR     = 0,
@@ -56,7 +56,7 @@ typedef enum eSDNA_Type {
 /* define so switch statements don't complain */
 #define SDNA_TYPE_VOID 9
 
-struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
+struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap);
 void DNA_sdna_free(struct SDNA *sdna);
 
 int DNA_struct_find_nr(struct SDNA *sdna, const char *str);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 71b344d..b64fc08 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -39,8 +39,9 @@
  *	   This assumes that the bottom-left corner is (0,0)
  */
 typedef struct bGPDspoint {
-	float x, y, z;			/* co-ordinates of point (usually 2d, but can be 3d as well) */				
+	float x, y, z;			/* co-ordinates of point (usually 2d, but can be 3d as well) */
 	float pressure;			/* pressure of input device (from 0 to 1) at this point */
+	float time;				/* seconds since start of stroke */
 } bGPDspoint;
 
 /* Grease-Pencil Annotations - 'Stroke'
@@ -49,12 +50,14 @@ typedef struct bGPDspoint {
  */
 typedef struct bGPDstroke {
 	struct bGPDstroke *next, *prev;
-	
 	bGPDspoint *points;		/* array of data-points for stroke */
+	void *pad;				/* keep 4 pointers at the beginning, padding for 'inittime' is tricky 64/32bit */
 	int totpoints;			/* number of data-points in array */
 	
-	short thickness;		/* thickness of stroke (currently not used) */	
+	short thickness;		/* thickness of stroke (currently not used) */
 	short flag;				/* various settings about this stroke */
+
+	double inittime;		/* Init time of stroke */
 } bGPDstroke;
 
 /* bGPDstroke->flag */
@@ -94,7 +97,7 @@ typedef struct bGPDlayer {
 	ListBase frames;		/* list of annotations to display for frames (bGPDframe list) */
 	bGPDframe *actframe;	/* active frame (should be the frame that is currently being displayed) */
 	
-	int flag;				/* settings for layer */		
+	int flag;				/* settings for layer */
 	short thickness;		/* current thickness to apply to strokes */
 	short gstep;			/* max number of frames between active and ghost to show (0=only those on either side) */
 	
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 38058db..fe35503 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -137,6 +137,7 @@ typedef struct Image {
 #define IMA_CLAMP_U			16 
 #define IMA_CLAMP_V			32
 #define IMA_TPAGE_REFRESH	64
+#define IMA_GLBIND_IS_DATA	128 /* opengl image texture bound as non-color data */
 
 /* ima->type and ima->source moved to BKE_image.h, for API */
 
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index a73fc90..3e641fb 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -93,7 +93,7 @@ typedef struct Ipo {
 	rctf cur;					/* Rect defining extents of keyframes? */
 	
 	short blocktype, showkey;	/* blocktype: self-explanatory; showkey: either 0 or 1 (show vertical yellow lines for editing) */
-	short muteipo, pad;			/* muteipo: either 0 or 1 (whether ipo block is muted) */	
+	short muteipo, pad;			/* muteipo: either 0 or 1 (whether ipo block is muted) */
 } Ipo;
 
 /* ----------- adrcodes (for matching ipo-curves to data) ------------- */
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 4884db1..f36e650 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -109,7 +109,7 @@ typedef struct Lamp {
 	struct PreviewImage *preview;
 
 	/* nodes */
-	struct bNodeTree *nodetree;	
+	struct bNodeTree *nodetree;
 } Lamp;
 
 /* **************** LAMP ********************* */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 374cc8e..9a8d3bf 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -86,7 +86,7 @@ typedef struct Material {
 	ID id;
 	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */ 
 	
-	short material_type, flag;	
+	short material_type, flag;
 	/* note, keep this below synced with render_types.h */
 	float r, g, b;
 	float specr, specg, specb;
@@ -156,7 +156,7 @@ typedef struct Material {
 	float rampfac_col, rampfac_spec;
 
 	struct MTex *mtex[18];		/* MAX_MTEX */
-	struct bNodeTree *nodetree;	
+	struct bNodeTree *nodetree;
 	struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
 	struct Group *group;	/* light group */
 	struct PreviewImage *preview;
@@ -292,6 +292,7 @@ typedef struct Material {
 #define MA_CUBIC			1
 #define MA_OBCOLOR			2
 #define MA_APPROX_OCCLUSION	4
+#define MA_GROUP_LOCAL      8
 
 /* diff_shader */
 #define MA_DIFF_LAMBERT		0
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 7040bc7..0c193e9 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -72,7 +72,7 @@ typedef struct MVert {
  * at the moment alpha is abused for vertex painting
  * and not used for transparency, note that red and blue are swapped */
 typedef struct MCol {
-	char a, r, g, b;	
+	char a, r, g, b;
 } MCol;
 
 /* new face structure, replaces MFace, which is now
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index 2912650..5b37ff5 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -93,7 +93,7 @@ typedef struct MetaBall {
 
 	/* used in editmode */
 	/*ListBase edit_elems;*/
-	MetaElem *lastelem;	
+	MetaElem *lastelem;
 } MetaBall;
 
 /* **************** METABALL ********************* */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 99df51e..3875a0d 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -75,6 +75,8 @@ typedef enum ModifierType {
 	eModifierType_DynamicPaint      = 40,
 	eModifierType_Remesh            = 41,
 	eModifierType_Skin              = 42,
+	eModifierType_LaplacianSmooth   = 43,
+	eModifierType_Triangulate		= 44,
 	NUM_MODIFIER_TYPES
 } ModifierType;
 
@@ -348,7 +350,7 @@ typedef struct UVProjectModifierData {
 	int flags;
 	int num_projectors;
 	float aspectx, aspecty;
-	float scalex, scaley;												
+	float scalex, scaley;
 	char uvlayer_name[64];	/* MAX_CUSTOMDATA_LAYER_NAME */
 	int uvlayer_tmp, pad;
 } UVProjectModifierData;
@@ -361,10 +363,30 @@ typedef struct UVProjectModifierData {
 typedef struct DecimateModifierData {
 	ModifierData modifier;
 
-	float percent;
-	int faceCount;
+	float percent;  /* (mode == MOD_DECIM_MODE_COLLAPSE) */
+	short   iter;   /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
+	short   pad;
+	float   angle;  /* (mode == MOD_DECIM_MODE_DISSOLVE) */
+
+	char defgrp_name[64];	/* MAX_VGROUP_NAME */
+	short flag, mode;
+
+	/* runtime only */
+	int face_count, pad2;
 } DecimateModifierData;
 
+enum {
+	MOD_DECIM_FLAG_INVERT_VGROUP       = (1 << 0),
+	MOD_DECIM_FLAG_TRIANGULATE         = (1 << 1),  /* for collapse only. dont convert tri pairs back to quads */
+	MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS  = (1 << 2)   /* for dissolve only. collapse all verts between 2 faces */
+};
+
+enum {
+	MOD_DECIM_MODE_COLLAPSE,
+	MOD_DECIM_MODE_UNSUBDIV,
+	MOD_DECIM_MODE_DISSOLVE   /* called planar in the UI */
+};
+
 /* Smooth modifier flags */
 #define MOD_SMOOTH_X (1<<1)
 #define MOD_SMOOTH_Y (1<<2)
@@ -644,7 +666,8 @@ typedef struct ShrinkwrapModifierData {
 	float keepDist;			/* distance offset to keep from mesh/projection point */
 	short shrinkType;		/* shrink type projection */
 	short shrinkOpts;		/* shrink options */
-	char projAxis;			/* axis to project over */
+	float projLimit;		/* limit the projection ray cast */
+	char  projAxis;			/* axis to project over */
 
 	/*
 	 * if using projection over vertex normal this controls the
@@ -653,7 +676,7 @@ typedef struct ShrinkwrapModifierData {
 	 */
 	char subsurfLevels;
 
-	char pad[6];
+	char pad[2];
 
 } ShrinkwrapModifierData;
 
@@ -683,7 +706,7 @@ typedef struct SimpleDeformModifierData {
 	struct Object *origin;	/* object to control the origin of modifier space coordinates */
 	char vgroup_name[64];	/* optional vertexgroup name, MAX_VGROUP_NAME */
 	float factor;			/* factors to control simple deforms */
-	float limit[2];			/* lower and upper limit */		
+	float limit[2];			/* lower and upper limit */
 
 	char mode;				/* deform function */
 	char axis;				/* lock axis (for taper and strech) */
@@ -1092,4 +1115,29 @@ enum {
 	MOD_SKIN_SMOOTH_SHADING = 1
 };
 
+/* Triangulate modifier */
+
+typedef struct TriangulateModifierData {
+	ModifierData modifier;
+	int flag;
+	int pad;
+} TriangulateModifierData;
+
+enum {
+	MOD_TRIANGULATE_BEAUTY = (1 << 0),
+};
+
+/* Smooth modifier flags */
+#define MOD_LAPLACIANSMOOTH_X (1<<1)
+#define MOD_LAPLACIANSMOOTH_Y (1<<2)
+#define MOD_LAPLACIANSMOOTH_Z (1<<3)
+#define MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME (1 << 4)
+
+typedef struct LaplacianSmoothModifierData {
+	ModifierData modifier;
+	float lambda, lambda_border, pad1;
+	char defgrp_name[64]; /* MAX_VGROUP_NAME */
+	short flag, repeat;
+} LaplacianSmoothModifierData;
+
 #endif
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index cda5177..499f1c5 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -118,38 +118,50 @@ typedef struct MovieClipScopes {
 } MovieClipScopes;
 
 /* MovieClipProxy->build_size_flag */
-#define MCLIP_PROXY_SIZE_25     (1 << 0)
-#define MCLIP_PROXY_SIZE_50     (1 << 1)
-#define MCLIP_PROXY_SIZE_75     (1 << 2)
-#define MCLIP_PROXY_SIZE_100    (1 << 3)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_25     (1 << 4)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_50     (1 << 5)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_75     (1 << 6)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_100    (1 << 7)
+enum {
+	MCLIP_PROXY_SIZE_25              = (1 << 0),
+	MCLIP_PROXY_SIZE_50              = (1 << 1),
+	MCLIP_PROXY_SIZE_75              = (1 << 2),
+	MCLIP_PROXY_SIZE_100             = (1 << 3),
+	MCLIP_PROXY_UNDISTORTED_SIZE_25  = (1 << 4),
+	MCLIP_PROXY_UNDISTORTED_SIZE_50  = (1 << 5),
+	MCLIP_PROXY_UNDISTORTED_SIZE_75  = (1 << 6),
+	MCLIP_PROXY_UNDISTORTED_SIZE_100 = (1 << 7)
+};
 
 /* MovieClip->source */
-#define MCLIP_SRC_SEQUENCE  1
-#define MCLIP_SRC_MOVIE     2
+enum {
+	MCLIP_SRC_SEQUENCE = 1,
+	MCLIP_SRC_MOVIE    = 2
+};
 
 /* MovieClip->selection types */
-#define MCLIP_SEL_NONE      0
-#define MCLIP_SEL_TRACK     1
+enum {
+	MCLIP_SEL_NONE  = 0,
+	MCLIP_SEL_TRACK = 1
+};
 
 /* MovieClip->flag */
-#define MCLIP_USE_PROXY                 (1 << 0)
-#define MCLIP_USE_PROXY_CUSTOM_DIR      (1 << 1)
-/*#define MCLIP_CUSTOM_START_FRAME		(1<<2)*/ /* UNUSED */
+enum {
+	MCLIP_USE_PROXY               = (1 << 0),
+	MCLIP_USE_PROXY_CUSTOM_DIR    = (1 << 1),
+	/* MCLIP_CUSTOM_START_FRAME    = (1<<2), */ /* UNUSED */
 
-#define MCLIP_TIMECODE_FLAGS            (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
+	MCLIP_TIMECODE_FLAGS          =  (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
+};
 
 /* MovieClip->render_size */
-#define MCLIP_PROXY_RENDER_SIZE_FULL    0
-#define MCLIP_PROXY_RENDER_SIZE_25      1
-#define MCLIP_PROXY_RENDER_SIZE_50      2
-#define MCLIP_PROXY_RENDER_SIZE_75      3
-#define MCLIP_PROXY_RENDER_SIZE_100     4
+enum {
+	MCLIP_PROXY_RENDER_SIZE_FULL = 0,
+	MCLIP_PROXY_RENDER_SIZE_25   = 1,
+	MCLIP_PROXY_RENDER_SIZE_50   = 2,
+	MCLIP_PROXY_RENDER_SIZE_75   = 3,
+	MCLIP_PROXY_RENDER_SIZE_100  = 4
+};
 
 /* MovieClip->render_flag */
-#define MCLIP_PROXY_RENDER_UNDISTORT    1
+enum {
+	MCLIP_PROXY_RENDER_UNDISTORT = 1
+};
 
 #endif
diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h
index 43b52ed..5837f89 100644
--- a/source/blender/makesdna/DNA_nla_types.h
+++ b/source/blender/makesdna/DNA_nla_types.h
@@ -50,7 +50,7 @@ typedef struct bActionModifier {
 	
 	/* path deform modifier */
 	short no_rot_axis;
-	struct Object *ob;	
+	struct Object *ob;
 } bActionModifier;
 
 /* NLA-Modifier Types */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 3f1f493..a05ff66 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -118,7 +118,8 @@ typedef struct bNodeSocket {
 #define SOCK_BOOLEAN		4
 #define SOCK_MESH			5
 #define SOCK_INT			6
-#define NUM_SOCKET_TYPES	7	/* must be last! */
+#define SOCK_STRING			7
+#define NUM_SOCKET_TYPES	8	/* must be last! */
 
 /* socket side (input/output) */
 #define SOCK_IN		1
@@ -167,6 +168,7 @@ typedef struct bNode {
 	struct ID *id;			/* optional link to libdata */
 	void *storage;			/* custom data, must be struct, for storage in file */
 	struct bNode *original;	/* the original node in the tree (for localized tree) */
+	ListBase internal_links; /* list of cached internal links (input to output), for muted nodes and operators */
 	
 	float locx, locy;		/* root offset for drawing (parent space) */
 	float width, height;	/* node custom width and height */
@@ -240,6 +242,7 @@ typedef struct bNodeLink {
 /* link->flag */
 #define NODE_LINKFLAG_HILITE	1		/* link has been successfully validated */
 #define NODE_LINK_VALID			2
+#define NODE_LINK_TEST			4		/* free test flag, undefined */
 
 /* tree->edit_quality/tree->render_quality */
 #define NTREE_QUALITY_HIGH    0
@@ -291,7 +294,8 @@ typedef struct bNodeTree {
 	void (*progress)(void *, float progress);
 	void (*stats_draw)(void *, char *str);
 	int (*test_break)(void *);
-	void *tbh, *prh, *sdh;
+	void (*update_draw)(void *);
+	void *tbh, *prh, *sdh, *udh;
 	
 } bNodeTree;
 
@@ -351,6 +355,11 @@ typedef struct bNodeSocketValueRGBA {
 	float value[4];
 } bNodeSocketValueRGBA;
 
+typedef struct bNodeSocketValueString {
+	int subtype;
+	int pad;
+	char value[1024];	/* 1024 = FILEMAX */
+} bNodeSocketValueString;
 
 /* data structs, for node->storage */
 enum {
@@ -702,6 +711,37 @@ typedef struct NodeTrackPosData {
 	char track_name[64];
 } NodeTrackPosData;
 
+typedef struct NodeShaderScript {
+	int mode;
+	int flag;
+
+	char filepath[1024]; /* 1024 = FILE_MAX */
+
+	char bytecode_hash[64];
+	char *bytecode;
+
+	IDProperty *prop;
+} NodeShaderScript;
+
+typedef struct NodeShaderTangent {
+	int direction_type;
+	int axis;
+	char uv_map[64];
+} NodeShaderTangent;
+
+typedef struct NodeShaderNormalMap {
+	int space;
+	char uv_map[64];
+} NodeShaderNormalMap;
+
+/* script node mode */
+#define NODE_SCRIPT_INTERNAL		0
+#define NODE_SCRIPT_EXTERNAL		1
+
+/* script node flag */
+#define NODE_SCRIPT_AUTO_UPDATE		1
+
+
 /* frame node flags */
 #define NODE_FRAME_SHRINK		1	/* keep the bounding box minimal */
 #define NODE_FRAME_RESIZEABLE	2	/* test flag, if frame can be resized by user */
@@ -778,6 +818,20 @@ typedef struct NodeTrackPosData {
 #define SHD_PROJ_FLAT				0
 #define SHD_PROJ_BOX				1
 
+/* tangent */
+#define SHD_TANGENT_RADIAL			0
+#define SHD_TANGENT_UVMAP			1
+
+/* tangent */
+#define SHD_TANGENT_AXIS_X			0
+#define SHD_TANGENT_AXIS_Y			1
+#define SHD_TANGENT_AXIS_Z			2
+
+/* normal map space */
+#define SHD_NORMAL_MAP_TANGENT		0
+#define SHD_NORMAL_MAP_OBJECT		1
+#define SHD_NORMAL_MAP_WORLD		2
+
 /* blur node */
 #define CMP_NODE_BLUR_ASPECT_NONE		0
 #define CMP_NODE_BLUR_ASPECT_Y			1
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 1dd2aa6..5cc56d8 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -54,6 +54,7 @@ typedef enum PFieldType {
 	PFIELD_BOID       = 10,	/* Defines predator / goal for boids									*/
 	PFIELD_TURBULENCE = 11,	/* Force defined by BLI_gTurbulence										*/
 	PFIELD_DRAG       = 12,	/* Linear & quadratic drag												*/
+	PFIELD_SMOKEFLOW  = 13,	/* Force based on smoke simulation air flow								*/
 	NUM_PFIELD_TYPES
 } PFieldType;
 	
@@ -110,14 +111,17 @@ typedef struct PartDeflect {
 	struct RNG *rng;	/* random noise generator for e.g. wind */
 	float f_noise;		/* noise of force						*/
 	int seed;			/* noise random seed					*/
+
+	struct Object *f_source; /* force source object */
 } PartDeflect;
 
 typedef struct EffectorWeights {
 	struct Group *group;		/* only use effectors from this group of objects */
 	
-	float weight[13];			/* effector type specific weights */
+	float weight[14];			/* effector type specific weights */
 	float global_gravity;
 	short flag, rt[3];
+	int pad;
 } EffectorWeights;
 
 /* EffectorWeights->flag */
@@ -276,7 +280,7 @@ typedef struct SoftBody {
 	float nodemass;		/* softbody mass of *vertex* */
 	char  namedVG_Mass[64]; /* MAX_VGROUP_NAME */
 	                        /* along with it introduce mass painting
-	                         * starting to fix old bug .. nastyness that VG are indexes
+	                         * starting to fix old bug .. nastiness that VG are indexes
 	                         * rather find them by name tag to find it -> jow20090613 */
 	float grav;			/* softbody amount of gravitaion to apply */
 	float mediafrict;	/* friction to env */
@@ -291,7 +295,7 @@ typedef struct SoftBody {
 	float defgoal;		/* default goal for vertices without vgroup */
 	short vertgroup;	/* index starting at 1 */
 	char  namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */
-	                            /* starting to fix old bug .. nastyness that VG are indexes
+	                            /* starting to fix old bug .. nastiness that VG are indexes
 	                             * rather find them by name tag to find it -> jow20090613 */
   
 	short fuzzyness;      /* */
@@ -301,7 +305,7 @@ typedef struct SoftBody {
 	float infrict;		/* softbody inner springs friction */
 	char  namedVG_Spring_K[64]; /* MAX_VGROUP_NAME */
 	                            /* along with it introduce Spring_K painting
-	                             * starting to fix old bug .. nastyness that VG are indexes
+	                             * starting to fix old bug .. nastiness that VG are indexes
 	                             * rather find them by name tag to find it -> jow20090613 */
 	
 	/* baking */
@@ -365,6 +369,7 @@ typedef struct SoftBody {
 #define PFIELD_DO_LOCATION		(1<<14)
 #define PFIELD_DO_ROTATION		(1<<15)
 #define PFIELD_GUIDE_PATH_WEIGHT (1<<16)	/* apply curve weights */
+#define PFIELD_SMOKE_DENSITY    (1<<17)		/* multiply smoke force by density */
 
 /* pd->falloff */
 #define PFIELD_FALL_SPHERE		0
@@ -395,7 +400,7 @@ typedef struct SoftBody {
 //#define PTCACHE_BAKE_EDIT			16
 //#define PTCACHE_BAKE_EDIT_ACTIVE	32
 #define PTCACHE_DISK_CACHE			64
-#define PTCACHE_QUICK_CACHE			128
+//#define PTCACHE_QUICK_CACHE		128  /* removed since 2.64 - [#30974], could be added back in a more useful way */
 #define PTCACHE_FRAMES_SKIPPED		256
 #define PTCACHE_EXTERNAL			512
 #define PTCACHE_READ_INFO			1024
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 3a8620f..89328c3 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -209,7 +209,9 @@ typedef struct Object {
 	float step_height;
 	float jump_speed;
 	float fall_speed;
-	char pad1[4];
+
+	/** Collision mask settings */
+	unsigned short col_group, col_mask;
 
 	short rotmode;		/* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
 
@@ -295,22 +297,19 @@ typedef struct ObHook {
 typedef struct DupliObject {
 	struct DupliObject *next, *prev;
 	struct Object *ob;
-	unsigned int origlay;
-	int index;
+	unsigned int origlay, pad;
 	float mat[4][4], omat[4][4];
 	float orco[3], uv[2];
 
 	short type; /* from Object.transflag */
 	char no_draw, animated;
 
-	/* Lowest-level particle index.
-	 * Note: This is needed for particle info in shaders.
-	 * Otherwise dupli groups in particle systems would override the
-	 * index value from higher dupli levels. Would be nice to have full generic access
-	 * to all dupli levels somehow, but for now this should cover most use-cases.
-	 */
-	int particle_index;
-	int pad;
+	/* persistent identifier for a dupli object, for inter-frame matching of
+	 * objects with motion blur, or inter-update matching for syncing */
+	int persistent_id[8]; /* MAX_DUPLI_RECUR */
+
+	/* particle this dupli was generated from */
+	struct ParticleSystem *particle_system;
 } DupliObject;
 
 /* **************** OBJECT ********************* */
@@ -378,6 +377,7 @@ typedef struct DupliObject {
 #define OB_DUPLIPARTS		2048
 #define OB_RENDER_DUPLI		4096
 #define OB_NO_CONSTRAINTS	8192 /* runtime constraints disable */
+#define OB_NO_PSYS_UPDATE	16384 /* hack to work around particle issue */
 
 /* (short) ipoflag */
 /* XXX: many old flags for features removed due to incompatibility
@@ -478,6 +478,9 @@ typedef struct DupliObject {
 /* controller state */
 #define OB_MAX_STATES		30
 
+/* collision masks */
+#define OB_MAX_COL_MASKS	8
+
 /* ob->gameflag */
 #define OB_DYNAMIC		1
 #define OB_CHILD		2
diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h
index f01e89d..ef0a0f6 100644
--- a/source/blender/makesdna/DNA_packedFile_types.h
+++ b/source/blender/makesdna/DNA_packedFile_types.h
@@ -35,9 +35,9 @@
 #define __DNA_PACKEDFILE_TYPES_H__
 
 typedef struct PackedFile {
-	int size;
-	int seek;
-	void * data;
+	int   size;
+	int   seek;
+	void *data;
 } PackedFile;
 
 enum PF_FileStatus
@@ -45,7 +45,7 @@ enum PF_FileStatus
 	PF_EQUAL = 0,
 	PF_DIFFERS = 1,
 	PF_NOFILE = 2,
-			
+
 	PF_WRITE_ORIGINAL = 3,
 	PF_WRITE_LOCAL = 4,
 	PF_USE_LOCAL = 5,
@@ -53,7 +53,7 @@ enum PF_FileStatus
 	PF_KEEP = 7,
 	PF_REMOVE = 8,
 	PF_NOOP = 9,
-			
+
 	PF_ASK = 10
 };
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 374b3ba..1599b71 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -318,10 +318,11 @@ typedef struct ImageFormatData {
 /* return values from BKE_imtype_valid_depths, note this is depts per channel */
 #define R_IMF_CHAN_DEPTH_1  (1<<0) /* 1bits  (unused) */
 #define R_IMF_CHAN_DEPTH_8  (1<<1) /* 8bits  (default) */
-#define R_IMF_CHAN_DEPTH_12 (1<<2) /* 12bits (uncommon, jp2 supports) */
-#define R_IMF_CHAN_DEPTH_16 (1<<3) /* 16bits (tiff, halff float exr) */
-#define R_IMF_CHAN_DEPTH_24 (1<<4) /* 24bits (unused) */
-#define R_IMF_CHAN_DEPTH_32 (1<<5) /* 32bits (full float exr) */
+#define R_IMF_CHAN_DEPTH_10 (1<<2) /* 10bits (uncommon, Cineon/DPX support) */
+#define R_IMF_CHAN_DEPTH_12 (1<<3) /* 12bits (uncommon, jp2/DPX support) */
+#define R_IMF_CHAN_DEPTH_16 (1<<4) /* 16bits (tiff, halff float exr) */
+#define R_IMF_CHAN_DEPTH_24 (1<<5) /* 24bits (unused) */
+#define R_IMF_CHAN_DEPTH_32 (1<<6) /* 32bits (full float exr) */
 
 /* ImageFormatData.planes */
 #define R_IMF_PLANES_RGB   24
@@ -395,11 +396,16 @@ typedef struct RenderData {
 	/**
 	 * The number of part to use in the x direction
 	 */
-	short xparts;
+	short xparts DNA_DEPRECATED;
 	/**
 	 * The number of part to use in the y direction
 	 */
-	short yparts;
+	short yparts DNA_DEPRECATED;
+
+	/**
+	 * render tile dimensions
+	 */
+	short tilex, tiley;
 
 	short planes  DNA_DEPRECATED, imtype  DNA_DEPRECATED, subimtype  DNA_DEPRECATED, quality  DNA_DEPRECATED; /*deprecated!*/
 	
@@ -447,6 +453,8 @@ typedef struct RenderData {
 
 	short frs_sec, edgeint;
 
+	int pad;
+
 	
 	/* safety, border and display rect */
 	rctf safety, border;
@@ -475,7 +483,7 @@ typedef struct RenderData {
 	int color_mgt_flag;
 	
 	/** post-production settings. deprecated, but here for upwards compat (initialized to 1) */
-	float postgamma, posthue, postsat;	 
+	float postgamma, posthue, postsat;
 	
 	 /* Dither noise intensity */
 	float dither_intensity;
@@ -1001,7 +1009,7 @@ typedef struct ToolSettings {
 
 	/* Transform */
 	char snap_mode, snap_node_mode;
-	char pad3;
+	char snap_uv_mode;
 	short snap_flag, snap_target;
 	short proportional, prop_mode;
 	char proportional_objects; /* proportional edit, object mode */
@@ -1086,7 +1094,7 @@ typedef struct Scene {
 	
 	short use_nodes;
 	
-	struct bNodeTree *nodetree;	
+	struct bNodeTree *nodetree;
 	
 	struct Editing *ed;								/* sequence editor data is allocated here */
 	
@@ -1179,15 +1187,17 @@ typedef struct Scene {
 		/* Use the same flag for autothreads */
 #define R_FIXED_THREADS		0x80000 
 
-#define R_SPEED			0x100000
-#define R_SSS			0x200000
-#define R_NO_OVERWRITE	0x400000 /* skip existing files */
-#define R_TOUCH			0x800000 /* touch files before rendering */
-#define R_SIMPLIFY		0x1000000
+#define R_SPEED				0x100000
+#define R_SSS				0x200000
+#define R_NO_OVERWRITE		0x400000  /* skip existing files */
+#define R_TOUCH				0x800000  /* touch files before rendering */
+#define R_SIMPLIFY			0x1000000
+#define R_EDGE_FRS			0x2000000 /* R_EDGE reserved for Freestyle */
+#define R_PERSISTENT_DATA	0x4000000 /* keep data around for re-render */
 
 /* seq_flag */
 #define R_SEQ_GL_PREV 1
-#define R_SEQ_GL_REND 2
+// #define R_SEQ_GL_REND 2  // UNUSED, opengl render has its own operator now.
 
 /* displaymode */
 
@@ -1301,6 +1311,7 @@ typedef struct Scene {
 /* sequencer seq_prev_type seq_rend_type */
 
 
+
 /* **************** SCENE ********************* */
 
 /* for general use */
@@ -1318,46 +1329,46 @@ typedef struct Scene {
 #define TESTBASE(v3d, base)  (                                                \
 	((base)->flag & SELECT) &&                                                \
 	((base)->lay & v3d->lay) &&                                               \
-	(((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+	(((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define TESTBASELIB(v3d, base)  (                                             \
 	((base)->flag & SELECT) &&                                                \
 	((base)->lay & v3d->lay) &&                                               \
-	((base)->object->id.lib==NULL) &&                                         \
-	(((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+	((base)->object->id.lib == NULL) &&                                       \
+	(((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define TESTBASELIB_BGMODE(v3d, scene, base)  (                               \
 	((base)->flag & SELECT) &&                                                \
 	((base)->lay & (v3d ? v3d->lay : scene->lay)) &&                          \
-	((base)->object->id.lib==NULL) &&                                         \
-	(((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+	((base)->object->id.lib == NULL) &&                                       \
+	(((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define BASE_EDITABLE_BGMODE(v3d, scene, base)  (                             \
 	((base)->lay & (v3d ? v3d->lay : scene->lay)) &&                          \
-	((base)->object->id.lib==NULL) &&                                         \
-	(((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+	((base)->object->id.lib == NULL) &&                                       \
+	(((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define BASE_SELECTABLE(v3d, base)  (                                         \
 	(base->lay & v3d->lay) &&                                                 \
-	(base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0  )
+	(base->object->restrictflag & (OB_RESTRICT_SELECT | OB_RESTRICT_VIEW)) == 0)
 #define BASE_VISIBLE(v3d, base)  (                                            \
 	(base->lay & v3d->lay) &&                                                 \
-	(base->object->restrictflag & OB_RESTRICT_VIEW)==0  )
+	(base->object->restrictflag & OB_RESTRICT_VIEW) == 0)
 
 #define FIRSTBASE		scene->base.first
 #define LASTBASE		scene->base.last
 #define BASACT			(scene->basact)
-#define OBACT			(BASACT? BASACT->object: NULL)
+#define OBACT			(BASACT ? BASACT->object: NULL)
 
 #define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL)
 #define V3D_CAMERA_SCENE(scene, v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : (scene)->camera)
 
-#define	CFRA			(scene->r.cfra)
-#define SUBFRA			(scene->r.subframe)
-#define	SFRA			(scene->r.sfra)
-#define	EFRA			(scene->r.efra)
-#define PRVRANGEON		(scene->r.flag & SCER_PRV_RANGE)
-#define PSFRA			((PRVRANGEON)? (scene->r.psfra): (scene->r.sfra))
-#define PEFRA			((PRVRANGEON)? (scene->r.pefra): (scene->r.efra))
-#define FRA2TIME(a)           ((((double) scene->r.frs_sec_base) * (double)(a)) / (double)scene->r.frs_sec)
-#define TIME2FRA(a)           ((((double) scene->r.frs_sec) * (double)(a)) / (double)scene->r.frs_sec_base)
-#define FPS                     (((double) scene->r.frs_sec) / (double)scene->r.frs_sec_base)
+#define CFRA            (scene->r.cfra)
+#define SUBFRA          (scene->r.subframe)
+#define SFRA            (scene->r.sfra)
+#define EFRA            (scene->r.efra)
+#define PRVRANGEON      (scene->r.flag & SCER_PRV_RANGE)
+#define PSFRA           ((PRVRANGEON) ? (scene->r.psfra) : (scene->r.sfra))
+#define PEFRA           ((PRVRANGEON) ? (scene->r.pefra) : (scene->r.efra))
+#define FRA2TIME(a)     ((((double) scene->r.frs_sec_base) * (double)(a)) / (double)scene->r.frs_sec)
+#define TIME2FRA(a)     ((((double) scene->r.frs_sec) * (double)(a)) / (double)scene->r.frs_sec_base)
+#define FPS              (((double) scene->r.frs_sec) / (double)scene->r.frs_sec_base)
 
 /* base->flag is in DNA_object_types.h */
 
@@ -1435,9 +1446,9 @@ typedef struct Scene {
 
 /* Paint.flags */
 typedef enum {
-	PAINT_SHOW_BRUSH = (1<<0),
-	PAINT_FAST_NAVIGATE = (1<<1),
-	PAINT_SHOW_BRUSH_ON_SURFACE = (1<<2),
+	PAINT_SHOW_BRUSH = (1 << 0),
+	PAINT_FAST_NAVIGATE = (1 << 1),
+	PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2),
 } PaintFlags;
 
 /* Sculpt.flags */
@@ -1452,6 +1463,7 @@ typedef enum SculptFlags {
 	SCULPT_SYMMETRY_FEATHER = (1<<6),
 	SCULPT_USE_OPENMP = (1<<7),
 	SCULPT_ONLY_DEFORM = (1<<8),
+	SCULPT_SHOW_DIFFUSE = (1<<9),
 } SculptFlags;
 
 /* ImagePaintSettings.flag */
@@ -1588,4 +1600,4 @@ typedef enum SculptFlags {
 }
 #endif
 
-#endif
+#endif  /* __DNA_SCENE_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 4d259fa..f106c8f 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -100,6 +100,9 @@ typedef struct Strip {
 	StripCrop *crop;
 	StripTransform *transform;
 	StripColorBalance *color_balance DNA_DEPRECATED;
+
+	/* color management */
+	ColorManagedColorspaceSettings colorspace_settings;
 } Strip;
 
 /**
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index cceb733..76ba3fc 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -39,6 +39,7 @@
 
 #define MOD_SMOKE_HIGH_SMOOTH (1<<5) /* smoothens high res emission*/
 #define MOD_SMOKE_FILE_LOAD (1<<6) /* flag for file load */
+#define MOD_SMOKE_ADAPTIVE_DOMAIN (1<<7)
 
 /* noise */
 #define MOD_SMOKE_NOISEWAVE (1<<0)
@@ -61,6 +62,12 @@
 #define SM_COLL_RIGID		1
 #define SM_COLL_ANIMATED	2
 
+/* smoke data fileds (active_fields) */
+#define SM_ACTIVE_HEAT		(1<<0)
+#define SM_ACTIVE_FIRE		(1<<1)
+#define SM_ACTIVE_COLORS	(1<<2)
+#define SM_ACTIVE_COLOR_SET	(1<<3)
+
 typedef struct SmokeDomainSettings {
 	struct SmokeModifierData *smd; /* for fast RNA access */
 	struct FLUID_3D *fluid;
@@ -71,17 +78,37 @@ typedef struct SmokeDomainSettings {
 	struct GPUTexture *tex;
 	struct GPUTexture *tex_wt;
 	struct GPUTexture *tex_shadow;
+	struct GPUTexture *tex_flame;
 	float *shadow;
-	float p0[3]; /* start point of BB */
-	float p1[3]; /* end point of BB */
-	float dx; /* edge length of one cell */
-	float omega; /* smoke color - from 0 to 1 */
-	float temp; /* fluid temperature */
-	float tempAmb; /* ambient temperature */
+
+	/* simulation data */
+	float p0[3]; /* start point of BB in local space (includes sub-cell shift for adaptive domain)*/
+	float p1[3]; /* end point of BB in local space */
+	float dp0[3]; /* difference from object center to grid start point */
+	float cell_size[3]; /* size of simulation cell in local space */
+	float global_size[3]; /* global size of domain axises */
+	float prev_loc[3];
+	int shift[3]; /* current domain shift in simulation cells */
+	float shift_f[3]; /* exact domain shift */
+	float obj_shift_f[3]; /* how much object has shifted since previous smoke frame (used to "lock" domain while drawing) */
+	float imat[4][4]; /* domain object imat */
+	float obmat[4][4]; /* domain obmat */
+
+	int base_res[3]; /* initial "non-adapted" resolution */
+	int res_min[3]; /* cell min */
+	int res_max[3]; /* cell max */
+	int res[3]; /* data resolution (res_max-res_min) */
+	int total_cells;
+	float dx; /* 1.0f / res */
+	float scale; /* largest domain size */
+
+	/* user settings */
+	int adapt_margin;
+	int adapt_res;
+	float adapt_threshold;
+
 	float alpha;
 	float beta;
-	float scale; /* largest domain size */
-	int res[3]; /* domain resolution */
 	int amplify; /* wavelet amplification */
 	int maxres; /* longest axis on the BB gets this resolution assigned */
 	int flags; /* show up-res or low res, etc */
@@ -92,7 +119,6 @@ typedef struct SmokeDomainSettings {
 	float strength;
 	int res_wt[3];
 	float dx_wt;
-	int v3dnum;
 	int cache_comp;
 	int cache_high_comp;
 
@@ -103,31 +129,67 @@ typedef struct SmokeDomainSettings {
 	int border_collisions;	/* How domain border collisions are handled */
 	float time_scale;
 	float vorticity;
-	int pad2;
+	int active_fields;
+	float active_color[3]; /* monitor color situation of simulation */
+	int pad;
+
+	/* flame parameters */
+	float burning_rate, flame_smoke, flame_vorticity;
+	float flame_ignition, flame_max_temp;
+	float flame_smoke_color[3];
 } SmokeDomainSettings;
 
 
 /* inflow / outflow */
 
 /* type */
-#define MOD_SMOKE_FLOW_TYPE_OUTFLOW (1<<1)
+#define MOD_SMOKE_FLOW_TYPE_SMOKE 0
+#define MOD_SMOKE_FLOW_TYPE_FIRE 1
+#define MOD_SMOKE_FLOW_TYPE_OUTFLOW 2
+#define MOD_SMOKE_FLOW_TYPE_SMOKEFIRE 3
+
+/* flow source */
+#define MOD_SMOKE_FLOW_SOURCE_PARTICLES 0
+#define MOD_SMOKE_FLOW_SOURCE_MESH 1
+
+/* flow texture type */
+#define MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO 0
+#define MOD_SMOKE_FLOW_TEXTURE_MAP_UV 1
 
 /* flags */
 #define MOD_SMOKE_FLOW_ABSOLUTE (1<<1) /*old style emission*/
 #define MOD_SMOKE_FLOW_INITVELOCITY (1<<2) /* passes particles speed to the smoke */
+#define MOD_SMOKE_FLOW_TEXTUREEMIT (1<<3) /* use texture to control emission speed */
 
 typedef struct SmokeFlowSettings {
 	struct SmokeModifierData *smd; /* for fast RNA access */
+	struct DerivedMesh *dm;
 	struct ParticleSystem *psys;
+	struct Tex *noise_texture;
+
+	/* initial velocity */
+	float *verts_old; /* previous vertex positions in domain space */
+	int numverts;
+	float vel_multi; // Multiplier for inherited velocity
+	float vel_normal;
+	float vel_random;
+	/* emission */
 	float density;
+	float color[3];
+	float fuel_amount;
 	float temp; /* delta temperature (temp - ambient temp) */
-	float velocity[2]; /* UNUSED, velocity taken from particles */
-	float vel_multi; // Multiplier for particle velocity
-	float vgrp_heat_scale[2]; /* min and max scaling for vgroup_heat */
-	short vgroup_flow; /* where inflow/outflow happens - red=1=action */
+	float volume_density; /* density emitted within mesh volume */
+	float surface_distance; /* maximum emission distance from mesh surface */
+	/* texture control */
+	float texture_size;
+	float texture_offset;
+	int pad;
+	char uvlayer_name[64];	/* MAX_CUSTOMDATA_LAYER_NAME */
 	short vgroup_density;
-	short vgroup_heat;
-	short type; /* inflow =0 or outflow = 1 */
+
+	short type; /* smoke, flames, both, outflow */
+	short source;
+	short texture_type;
 	int flags; /* absolute emission etc*/
 } SmokeFlowSettings;
 
@@ -139,20 +201,11 @@ typedef struct SmokeFlowSettings {
 /* collision objects (filled with smoke) */
 typedef struct SmokeCollSettings {
 	struct SmokeModifierData *smd; /* for fast RNA access */
-	struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
-	float *points;
-	float *points_old;
-	float *vel; // UNUSED
-	int *tridivs;
-	float mat[4][4];
-	float mat_old[4][4];
-	int numpoints;
-	int numverts; // check if mesh changed
-	int numtris;
-	float dx; /* global domain cell length taken from (scale / resolution) */
+	struct DerivedMesh *dm;
+	float *verts_old;
+	int numverts;
 	short type; // static = 0, rigid = 1, dynamic = 2
 	short pad;
-	int pad2;
 } SmokeCollSettings;
 
 #endif
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 4b8fc9c..be64647 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -618,7 +618,7 @@ enum FileSortTypeE {
 #define FILE_MAXFILE        256
 #define FILE_MAX            1024
 
-#define FILE_MAX_LIBEXTRA   (FILE_MAX + 32)
+#define FILE_MAX_LIBEXTRA   (FILE_MAX + MAX_ID_NAME)
 
 /* filesel types */
 #define FILE_UNIX           8
@@ -792,10 +792,10 @@ typedef struct SpaceText {
 	float blockscale DNA_DEPRECATED;
 	short blockhandler[8]  DNA_DEPRECATED;
 
-	struct Text *text;	
+	struct Text *text;
 
 	int top, viewlines;
-	short flags, menunr;	
+	short flags, menunr;
 
 	short lheight;      /* user preference */
 	char cwidth, linenrs_tot;       /* runtime computed, character width and the number of chars to use when showing line numbers */
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index cf26dae..6ce8839 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -44,15 +44,6 @@ typedef struct TextLine {
 	int len, blen; /* blen unused */
 } TextLine;
 
-typedef struct TextMarker {
-	struct TextMarker *next, *prev;
-
-	int lineno, start, end, pad1; /* line number and start/end character indices */
-	
-	int group, flags; /* see BKE_text.h for flag defines */
-	unsigned char color[4], pad[4]; /* draw color of the marker */
-} TextMarker;
-
 typedef struct Text {
 	ID id;
 	
@@ -63,7 +54,6 @@ typedef struct Text {
 	ListBase lines;
 	TextLine *curl, *sell;
 	int curc, selc;
-	ListBase markers;
 	
 	char *undo_buf;
 	int undo_pos, undo_len;
@@ -78,7 +68,6 @@ typedef struct Text {
 
 /* text flags */
 #define TXT_ISDIRTY             0x0001
-#define TXT_DEPRECATED          0x0004 /* deprecated ISTMP flag */
 #define TXT_ISMEM               0x0004
 #define TXT_ISEXT               0x0008
 #define TXT_ISSCRIPT            0x0010 /* used by space handler scriptlinks */
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 9fdd921..dd63e6a 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -161,7 +161,7 @@ typedef struct PointDensity {
 	float speed_scale, falloff_speed_scale, pdpad2;
 	struct ColorBand *coba;	/* for time -> color */
 	
-	struct CurveMapping *falloff_curve; /* falloff density curve */	
+	struct CurveMapping *falloff_curve; /* falloff density curve */
 } PointDensity;
 
 typedef struct VoxelData {
@@ -171,9 +171,12 @@ typedef struct VoxelData {
 	short flag;
 	short extend;
 	short smoked_type;
+	short data_type;
+	short pad;
+	int _pad;
 	
 	struct Object *object; /* for rendering smoke sims */
-	float int_multiplier;	
+	float int_multiplier;
 	int still_frame;
 	char source_path[1024];  /* 1024 = FILE_MAX */
 
@@ -470,6 +473,7 @@ typedef struct ColorMapping {
 #define MTEX_BUMP_TEXTURESPACE	2048
 /* #define MTEX_BUMP_FLIPPED 	4096 */ /* UNUSED */
 #define MTEX_BICUBIC_BUMP		8192
+#define MTEX_MAPTO_BOUNDS		16384
 
 /* blendtype */
 #define MTEX_BLEND		0
@@ -577,6 +581,11 @@ typedef struct ColorMapping {
 #define TEX_VD_SMOKEDENSITY		0
 #define TEX_VD_SMOKEHEAT		1
 #define TEX_VD_SMOKEVEL			2
+#define TEX_VD_SMOKEFLAME		3
+
+/* data_type */
+#define TEX_VD_INTENSITY		0
+#define TEX_VD_RGBA_PREMUL		1
 
 /******************** Ocean *****************************/
 /* output */
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index c6cefce..1281930 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -163,10 +163,13 @@ typedef struct MovieTrackingSettings {
 
 	/* ** reconstruction settings ** */
 	int keyframe1 DNA_DEPRECATED,
-		keyframe2 DNA_DEPRECATED;   /* two keyframes for reconstrution initialization
+		keyframe2 DNA_DEPRECATED;   /* two keyframes for reconstruction initialization
 		                             * were moved to per-tracking object settings
 		                             */
 
+	float reconstruction_success_threshold;
+	int reconstruction_flag;
+
 	/* which camera intrinsics to refine. uses on the REFINE_* flags */
 	short refine_camera_intrinsics, pad2;
 
@@ -224,7 +227,8 @@ typedef struct MovieTrackingObject {
 	ListBase tracks;        /* list of tracks use to tracking this object */
 	MovieTrackingReconstruction reconstruction; /* reconstruction data for this object */
 
-	int keyframe1, keyframe2;   /* two keyframes for reconstrution initialization */
+	/* reconstruction options */
+	int keyframe1, keyframe2;   /* two keyframes for reconstruction initialization */
 } MovieTrackingObject;
 
 typedef struct MovieTrackingStats {
@@ -280,92 +284,129 @@ enum {
 };
 
 /* MovieTrackingMarker->flag */
-#define MARKER_DISABLED (1 << 0)
-#define MARKER_TRACKED  (1 << 1)
-#define MARKER_GRAPH_SEL_X (1 << 2)
-#define MARKER_GRAPH_SEL_Y (1 << 3)
-#define MARKER_GRAPH_SEL    (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)
+enum {
+	MARKER_DISABLED    = (1 << 0),
+	MARKER_TRACKED     = (1 << 1),
+	MARKER_GRAPH_SEL_X = (1 << 2),
+	MARKER_GRAPH_SEL_Y = (1 << 3),
+	MARKER_GRAPH_SEL   = (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)
+};
 
 /* MovieTrackingTrack->flag */
-#define TRACK_HAS_BUNDLE    (1 << 1)
-#define TRACK_DISABLE_RED   (1 << 2)
-#define TRACK_DISABLE_GREEN (1 << 3)
-#define TRACK_DISABLE_BLUE  (1 << 4)
-#define TRACK_HIDDEN        (1 << 5)
-#define TRACK_LOCKED        (1 << 6)
-#define TRACK_CUSTOMCOLOR   (1 << 7)
-#define TRACK_USE_2D_STAB   (1 << 8)
-#define TRACK_PREVIEW_GRAYSCALE (1 << 9)
-#define TRACK_DOPE_SEL      (1 << 10)
-#define TRACK_PREVIEW_ALPHA (1 << 11)
+enum {
+	TRACK_HAS_BUNDLE        = (1 << 1),
+	TRACK_DISABLE_RED       = (1 << 2),
+	TRACK_DISABLE_GREEN     = (1 << 3),
+	TRACK_DISABLE_BLUE      = (1 << 4),
+	TRACK_HIDDEN            = (1 << 5),
+	TRACK_LOCKED            = (1 << 6),
+	TRACK_CUSTOMCOLOR       = (1 << 7),
+	TRACK_USE_2D_STAB       = (1 << 8),
+	TRACK_PREVIEW_GRAYSCALE = (1 << 9),
+	TRACK_DOPE_SEL          = (1 << 10),
+	TRACK_PREVIEW_ALPHA     = (1 << 11)
+};
 
 /* MovieTrackingTrack->motion_model */
-#define TRACK_MOTION_MODEL_TRANSLATION                 0
-#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION        1
-#define TRACK_MOTION_MODEL_TRANSLATION_SCALE           2
-#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE  3
-#define TRACK_MOTION_MODEL_AFFINE                      4
-#define TRACK_MOTION_MODEL_HOMOGRAPHY                  5
+enum {
+	TRACK_MOTION_MODEL_TRANSLATION                 = 0,
+	TRACK_MOTION_MODEL_TRANSLATION_ROTATION        = 1,
+	TRACK_MOTION_MODEL_TRANSLATION_SCALE           = 2,
+	TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE  = 3,
+	TRACK_MOTION_MODEL_AFFINE                      = 4,
+	TRACK_MOTION_MODEL_HOMOGRAPHY                  = 5
+};
 
 /* MovieTrackingTrack->algorithm_flag */
-#define TRACK_ALGORITHM_FLAG_USE_BRUTE			(1 << 0)
-#define TRACK_ALGORITHM_FLAG_USE_NORMALIZATION	(1 << 2)
-#define TRACK_ALGORITHM_FLAG_USE_MASK			(1 << 3)
+enum {
+	TRACK_ALGORITHM_FLAG_USE_BRUTE			= (1 << 0),
+	TRACK_ALGORITHM_FLAG_USE_NORMALIZATION	= (1 << 2),
+	TRACK_ALGORITHM_FLAG_USE_MASK			= (1 << 3)
+};
 
 /* MovieTrackingTrack->adjframes */
-#define TRACK_MATCH_KEYFRAME        0
-#define TRACK_MATCH_PREVFRAME       1
+enum {
+	TRACK_MATCH_KEYFRAME  = 0,
+	TRACK_MATCH_PREVFRAME = 1
+};
 
 /* MovieTrackingSettings->flag */
-#define TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED (1 << 0)
+enum {
+	TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED = (1 << 0)
+};
 
 /* MovieTrackingSettings->motion_flag */
-#define TRACKING_MOTION_TRIPOD      (1 << 0)
+enum {
+	TRACKING_MOTION_TRIPOD = (1 << 0),
 
-#define TRACKING_MOTION_MODAL       (TRACKING_MOTION_TRIPOD)
+	TRACKING_MOTION_MODAL  = (TRACKING_MOTION_TRIPOD)
+};
 
 /* MovieTrackingSettings->speed */
-#define TRACKING_SPEED_FASTEST      0
-#define TRACKING_SPEED_REALTIME     1
-#define TRACKING_SPEED_HALF         2
-#define TRACKING_SPEED_QUARTER      4
-#define TRACKING_SPEED_DOUBLE       5
+enum {
+	TRACKING_SPEED_FASTEST  = 0,
+	TRACKING_SPEED_REALTIME = 1,
+	TRACKING_SPEED_HALF     = 2,
+	TRACKING_SPEED_QUARTER  = 4,
+	TRACKING_SPEED_DOUBLE   = 5
+};
+
+/* MovieTrackingObject->reconstruction_flag */
+enum {
+	TRACKING_USE_FALLBACK_RECONSTRUCTION = (1 << 0)
+};
 
 /* MovieTrackingSettings->refine_camera_intrinsics */
-#define REFINE_FOCAL_LENGTH         (1 << 0)
-#define REFINE_PRINCIPAL_POINT      (1 << 1)
-#define REFINE_RADIAL_DISTORTION_K1 (1 << 2)
-#define REFINE_RADIAL_DISTORTION_K2 (1 << 4)
+enum {
+	REFINE_FOCAL_LENGTH         = (1 << 0),
+	REFINE_PRINCIPAL_POINT      = (1 << 1),
+	REFINE_RADIAL_DISTORTION_K1 = (1 << 2),
+	REFINE_RADIAL_DISTORTION_K2 = (1 << 4)
+};
 
 /* MovieTrackingStrabilization->flag */
-#define TRACKING_2D_STABILIZATION   (1 << 0)
-#define TRACKING_AUTOSCALE          (1 << 1)
-#define TRACKING_STABILIZE_ROTATION (1 << 2)
+enum {
+	TRACKING_2D_STABILIZATION   = (1 << 0),
+	TRACKING_AUTOSCALE          = (1 << 1),
+	TRACKING_STABILIZE_ROTATION = (1 << 2)
+};
 
 /* MovieTrackingStrabilization->filter */
-#define TRACKING_FILTER_NEAREAST    0
-#define TRACKING_FILTER_BILINEAR    1
-#define TRACKING_FILTER_BICUBIC     2
+enum {
+	TRACKING_FILTER_NEAREAST = 0,
+	TRACKING_FILTER_BILINEAR = 1,
+	TRACKING_FILTER_BICUBIC  = 2
+};
 
 /* MovieTrackingReconstruction->flag */
-#define TRACKING_RECONSTRUCTED  (1 << 0)
+enum {
+	TRACKING_RECONSTRUCTED = (1 << 0)
+};
 
 /* MovieTrackingObject->flag */
-#define TRACKING_OBJECT_CAMERA      (1 << 0)
+enum {
+	TRACKING_OBJECT_CAMERA = (1 << 0)
+};
 
-#define TRACKING_CLEAN_SELECT           0
-#define TRACKING_CLEAN_DELETE_TRACK     1
-#define TRACKING_CLEAN_DELETE_SEGMENT   2
+enum {
+	TRACKING_CLEAN_SELECT         = 0,
+	TRACKING_CLEAN_DELETE_TRACK   = 1,
+	TRACKING_CLEAN_DELETE_SEGMENT = 2
+};
 
 /* MovieTrackingDopesheet->sort_method */
-#define TRACKING_DOPE_SORT_NAME          0
-#define TRACKING_DOPE_SORT_LONGEST       1
-#define TRACKING_DOPE_SORT_TOTAL         2
-#define TRACKING_DOPE_SORT_AVERAGE_ERROR 3
+enum {
+	TRACKING_DOPE_SORT_NAME          = 0,
+	TRACKING_DOPE_SORT_LONGEST       = 1,
+	TRACKING_DOPE_SORT_TOTAL         = 2,
+	TRACKING_DOPE_SORT_AVERAGE_ERROR = 3
+};
 
 /* MovieTrackingDopesheet->flag */
-#define TRACKING_DOPE_SORT_INVERSE    (1 << 0)
-#define TRACKING_DOPE_SELECTED_ONLY   (1 << 1)
-#define TRACKING_DOPE_SHOW_HIDDEN     (1 << 2)
+enum {
+	TRACKING_DOPE_SORT_INVERSE  = (1 << 0),
+	TRACKING_DOPE_SELECTED_ONLY = (1 << 1),
+	TRACKING_DOPE_SHOW_HIDDEN   = (1 << 2)
+};
 
 #endif
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index c10850d..2e2f65d 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -162,7 +162,8 @@ typedef struct ThemeUI {
 	char iconfile[256];	// FILE_MAXFILE length
 	float icon_alpha;
 
-	float pad;
+	/* Axis Colors */
+	char xaxis[4], yaxis[4], zaxis[4];
 } ThemeUI;
 
 /* try to put them all in one, if needed a special struct can be created as well
@@ -184,7 +185,7 @@ typedef struct ThemeSpace {
 	/* button/tool regions */
 	char button[4];
 	char button_title[4];
-	char button_text[4];	
+	char button_text[4];
 	char button_text_hi[4];
 	
 	/* listview regions */
@@ -195,8 +196,8 @@ typedef struct ThemeSpace {
 	
 	/* float panel */
 	char panel[4];
-	char panel_title[4];	
-	char panel_text[4];	
+	char panel_title[4];
+	char panel_text[4];
 	char panel_text_hi[4];
 	
 	char shade1[4];
@@ -302,7 +303,7 @@ typedef struct bTheme {
 	ThemeUI tui;
 	
 	/* Individual Spacetypes */
-	ThemeSpace tbuts;	
+	ThemeSpace tbuts;
 	ThemeSpace tv3d;
 	ThemeSpace tfile;
 	ThemeSpace tipo;
@@ -316,7 +317,7 @@ typedef struct bTheme {
 	ThemeSpace ttime;
 	ThemeSpace tnode;
 	ThemeSpace tlogic;
-	ThemeSpace tuserpref;	
+	ThemeSpace tuserpref;
 	ThemeSpace tconsole;
 	ThemeSpace tclip;
 	
@@ -417,9 +418,11 @@ typedef struct UserDef {
 
 	float ndof_sensitivity;	/* overall sensitivity of 3D mouse */
 	float ndof_orbit_sensitivity;
-	float pad4;
 	int ndof_flag;			/* flags for 3D mouse */
 
+	short ogl_multisamples;	/* amount of samples for OpenGL FSA, if zero no FSA */
+	short pad4;
+	
 	float glalphaclip;
 	
 	short autokey_mode;		/* autokeying mode */
@@ -532,7 +535,8 @@ typedef enum eUserpref_UI_Flag {
 	USER_SPLASH_DISABLE		= (1 << 27),
 	USER_HIDE_RECENT		= (1 << 28),
 	USER_SHOW_THUMBNAILS	= (1 << 29),
-	USER_QUIT_PROMPT		= (1 << 30)
+	USER_QUIT_PROMPT		= (1 << 30),
+	USER_HIDE_SYSTEM_BOOKMARKS = (1 << 31)
 } eUserpref_UI_Flag;
 
 /* Auto-Keying mode */
@@ -596,7 +600,7 @@ typedef enum eOpenGL_RenderingOptions {
 	                                     /* backwards compatibilty in do_versions! */
 	USER_DISABLE_MIPMAP		= (1 << 2),
 	USER_DISABLE_VBO		= (1 << 3),
-	USER_DISABLE_AA			= (1 << 4),
+	/* USER_DISABLE_AA			= (1 << 4), */ /* DEPRECATED */
 } eOpenGL_RenderingOptions;
 
 /* wm draw method */
@@ -701,6 +705,17 @@ typedef enum eCompute_Device_Type {
 	USER_COMPUTE_DEVICE_CUDA	= 2,
 } eCompute_Device_Type;
 
+	
+typedef enum eMultiSample_Type {
+	USER_MULTISAMPLE_NONE	= 0,
+	USER_MULTISAMPLE_2	= 2,
+	USER_MULTISAMPLE_4	= 4,
+	USER_MULTISAMPLE_8	= 8,
+	USER_MULTISAMPLE_16	= 16,
+} eMultiSample_Type;
+	
+	
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index a3f4b36..0844968 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -128,7 +128,7 @@ typedef struct View2D {
 #define V2D_SCROLL_HORIZONTAL  		(V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)
 	/* scale markings - vertical */
 #define V2D_SCROLL_SCALE_VERTICAL	(1<<5)
-	/* scale markings - horizontal */	
+	/* scale markings - horizontal */
 #define V2D_SCROLL_SCALE_HORIZONTAL	(1<<6)
 	/* induce hiding of scrollbars - set by region drawing in response to size of region */
 #define V2D_SCROLL_VERTICAL_HIDE	(1<<7)		
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 9da1038..c83b0bc 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -169,6 +169,7 @@ typedef struct View3D {
 	short view   DNA_DEPRECATED;
 	
 	struct Object *camera, *ob_centre;
+	rctf render_border;
 
 	struct ListBase bgpicbase;
 	struct BGpic *bgpic  DNA_DEPRECATED; /* deprecated, use bgpicbase, only kept for do_versions(...) */
@@ -267,6 +268,7 @@ typedef struct View3D {
 #define V3D_SHOW_CAMERAPATH		256
 #define V3D_SHOW_BUNDLENAME		512
 #define V3D_BACKFACE_CULLING	1024
+#define V3D_RENDER_BORDER	2048
 
 /* View3D->around */
 #define V3D_CENTER		 0
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 780ca0b..2294abc 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -334,7 +334,7 @@ typedef struct wmOperator {
 #define OPERATOR_FLAGS_ALL		((1<<5)-1)
 
 /* sanity checks for debug mode only */
-#define OPERATOR_RETVAL_CHECK(ret) BLI_assert(ret != 0 && (ret & OPERATOR_FLAGS_ALL) == ret)
+#define OPERATOR_RETVAL_CHECK(ret) (void)ret, BLI_assert(ret != 0 && (ret & OPERATOR_FLAGS_ALL) == ret)
 
 /* wmOperator flag */
 #define OP_GRAB_POINTER			1
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index b3c1040..8a14564 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -61,14 +61,14 @@ typedef struct World {
 	float ambr, ambg, ambb;
 	float pad2;
 
-	unsigned int fastcol;	
+	unsigned int fastcol;
 	
 	/**
 	 * Exposure= mult factor. unused now, but maybe back later. Kept in to be upward compat.
 	 * New is exp/range control. linfac & logfac are constants... don't belong in
 	 * file, but allocating 8 bytes for temp mem isn't useful either.
 	 */
-	float exposure, exp, range;	
+	float exposure, exp, range;
 	float linfac, logfac;
 
 	/**
@@ -129,7 +129,7 @@ typedef struct World {
 	struct PreviewImage *preview;
 
 	/* nodes */
-	struct bNodeTree *nodetree;	
+	struct bNodeTree *nodetree;
 
 } World;
 
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index f5cf7e3..10c3b0b 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -62,7 +62,7 @@ typedef long long __int64;
  * - if you want a struct not to be in DNA file: add two hash marks above it (#<enter>#<enter>)
  *
  * Structure DNA data is added to each blender file and to each executable, this to detect
- * in .blend files new veriables in structs, changed array sizes, etc. It's also used for
+ * in .blend files new variables in structs, changed array sizes, etc. It's also used for
  * converting endian and pointer size (32-64 bits)
  * As an extra, Python uses a call to detect run-time the contents of a blender struct.
  *
@@ -506,7 +506,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 	}
 }
 
-SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap)
+SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap)
 {
 	SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna");
 	
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 079f276..fa0b313 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -87,14 +87,14 @@ static const char *includefiles[] = {
 	"DNA_mesh_types.h",
 	"DNA_meshdata_types.h",
 	"DNA_modifier_types.h",
-	"DNA_lattice_types.h",	
+	"DNA_lattice_types.h",
 	"DNA_object_types.h",
 	"DNA_object_force.h",
 	"DNA_object_fluidsim.h",
 	"DNA_world_types.h",
 	"DNA_scene_types.h",
 	"DNA_view3d_types.h",
-	"DNA_view2d_types.h",	
+	"DNA_view2d_types.h",
 	"DNA_space_types.h",
 	"DNA_userdef_types.h",
 	"DNA_screen_types.h",
@@ -1001,7 +1001,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 	/* FOR DEBUG */
 	if (debugSDNA > 1) {
 		int a, b;
-/*          short *elem; */
+		/* short *elem; */
 		short num_types;
 
 		printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs);
@@ -1094,7 +1094,9 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 			int a;
 			
 			fp = fopen("padding.c", "w");
-			if (fp == NULL) ;
+			if (fp == NULL) {
+				/* pass */
+			}
 			else {
 
 				/* add all include files defined in the global array */
@@ -1172,7 +1174,7 @@ int main(int argc, char **argv)
 				strcpy(baseDirectory, BASE_HEADER);
 			}
 
-			fprintf(file, "unsigned char DNAstr[]= {\n");
+			fprintf(file, "const unsigned char DNAstr[] = {\n");
 			if (make_structDNA(baseDirectory, file)) {
 				/* error */
 				fclose(file);
@@ -1181,7 +1183,7 @@ int main(int argc, char **argv)
 			}
 			else {
 				fprintf(file, "};\n");
-				fprintf(file, "int DNAlen = sizeof(DNAstr);\n");
+				fprintf(file, "const int DNAlen = sizeof(DNAstr);\n");
 	
 				fclose(file);
 			}
@@ -1193,7 +1195,7 @@ int main(int argc, char **argv)
 }
 
 /* handy but fails on struct bounds which makesdna doesnt care about
- * unless structs are nested */
+ * with quite the same strictness as GCC does */
 #if 0
 /* include files for automatic dependencies */
 
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 8e387dd..0e5f9c5 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -148,6 +148,7 @@ extern StructRNA RNA_CompositorNodeLevels;
 extern StructRNA RNA_CompositorNodeLumaMatte;
 extern StructRNA RNA_CompositorNodeMapUV;
 extern StructRNA RNA_CompositorNodeMapValue;
+extern StructRNA RNA_CompositorNodeMapRange;
 extern StructRNA RNA_CompositorNodeMath;
 extern StructRNA RNA_CompositorNodeMask;
 extern StructRNA RNA_CompositorNodeMixRGB;
@@ -286,6 +287,7 @@ extern StructRNA RNA_KinematicConstraint;
 extern StructRNA RNA_Lamp;
 extern StructRNA RNA_LampSkySettings;
 extern StructRNA RNA_LampTextureSlot;
+extern StructRNA RNA_LaplacianSmoothModifier;
 extern StructRNA RNA_Lattice;
 extern StructRNA RNA_LatticeModifier;
 extern StructRNA RNA_LatticePoint;
@@ -456,6 +458,7 @@ extern StructRNA RNA_ShaderNodeMath;
 extern StructRNA RNA_ShaderNodeMixRGB;
 extern StructRNA RNA_ShaderNodeNormal;
 extern StructRNA RNA_ShaderNodeOutput;
+extern StructRNA RNA_ShaderNodeScript;
 extern StructRNA RNA_ShaderNodeRGB;
 extern StructRNA RNA_ShaderNodeRGBCurve;
 extern StructRNA RNA_ShaderNodeRGBToBW;
@@ -523,7 +526,6 @@ extern StructRNA RNA_TextBox;
 extern StructRNA RNA_TextCharacterFormat;
 extern StructRNA RNA_TextCurve;
 extern StructRNA RNA_TextLine;
-extern StructRNA RNA_TextMarker;
 extern StructRNA RNA_Texture;
 extern StructRNA RNA_TextureNode;
 extern StructRNA RNA_TextureNodeBricks;
@@ -860,6 +862,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path,
 
 char *RNA_path_from_ID_to_struct(PointerRNA *ptr);
 char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop);
+char *RNA_path_from_ID_python(struct ID *id);
 
 /* Quick name based property access
  *
@@ -960,7 +963,9 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
 	}
 
 /* check if the idproperty exists, for operators */
+int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost);
 int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop);
+int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost);
 int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier);
 int RNA_property_is_idprop(PropertyRNA *prop);
 
@@ -1029,6 +1034,13 @@ short RNA_type_to_ID_code(StructRNA *type);
 StructRNA *ID_code_to_RNA_type(short idcode);
 
 
+#define RNA_POINTER_INVALIDATE(ptr) {                                         \
+	/* this is checked for validity */                                        \
+	(ptr)->type =                                                             \
+	/* should not be needed but prevent bad pointer access, just in case */   \
+	(ptr)->id.data = NULL;                                                    \
+} (void)0
+
 /* macro which inserts the function name */
 #if defined __GNUC__ || defined __sun
 #  define RNA_warning(format, args ...) _RNA_warning("%s: " format "\n", __func__, ##args)
@@ -1042,6 +1054,11 @@ __attribute__ ((format(printf, 1, 2)))
 #endif
 ;
 
+/* Equals test (skips pointers and collections) */
+
+int RNA_property_equals(struct PointerRNA *a, struct PointerRNA *b, struct PropertyRNA *prop);
+int RNA_struct_equals(struct PointerRNA *a, struct PointerRNA *b);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 511999d..87504dc 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -113,6 +113,7 @@ typedef enum PropertySubType {
 	PROP_BYTESTRING = 4, /* a string which should be represented as bytes
 	                      * in python, still NULL terminated though. */
 	PROP_TRANSLATE = 5, /* a string which should be translated */
+	PROP_PASSWORD = 6,	/* a string which should not be displayed in UI */
 
 	/* numbers */
 	PROP_UNSIGNED = 13,
@@ -312,6 +313,7 @@ typedef enum FunctionFlag {
 	FUNC_USE_CONTEXT = 4,
 	FUNC_USE_REPORTS = 8,
 	FUNC_USE_SELF_ID = 2048,
+	FUNC_ALLOW_WRITE = 4096,
 
 	/* registering */
 	FUNC_REGISTER = 16,
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 14c9968..6fa53f4 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -61,7 +61,6 @@
 /* Replace if different */
 #define TMP_EXT ".tmp"
 
-
 /* copied from BLI_file_older */
 #include <sys/stat.h>
 static int file_older(const char *file1, const char *file2)
@@ -76,6 +75,24 @@ static int file_older(const char *file1, const char *file2)
 }
 static const char *makesrna_path = NULL;
 
+/* forward declarations */
+static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc,
+                                                     const char *name_override, int close_prototype);
+
+/* helpers */
+#define WRITE_COMMA \
+	{ \
+		if (!first) \
+			fprintf(f, ", "); \
+		first = 0; \
+	} (void)0
+
+#define WRITE_PARAM(param) \
+	{ \
+		WRITE_COMMA; \
+		fprintf(f, param); \
+	}
+
 static int replace_if_different(char *tmpfile, const char *dep_files[])
 {
 	/* return 0;  *//* use for testing had edited rna */
@@ -212,6 +229,8 @@ static const char *rna_safe_id(const char *id)
 		return "default_value";
 	else if (strcmp(id, "operator") == 0)
 		return "operator_value";
+	else if (strcmp(id, "new") == 0)
+		return "create";
 
 	return id;
 }
@@ -322,13 +341,26 @@ static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
 	fprintf(f, "	ID *id= ptr->id.data;\n");
 }
 
+static void rna_construct_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
+{
+	snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
+}
+
+static void rna_construct_wrapper_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
+{
+	if (type == NULL || type[0] == '\0')
+		snprintf(buffer, size, "%s_%s", structname, propname);
+	else
+		snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
+}
+
 static char *rna_alloc_function_name(const char *structname, const char *propname, const char *type)
 {
 	AllocDefRNA *alloc;
 	char buffer[2048];
 	char *result;
 
-	snprintf(buffer, sizeof(buffer), "%s_%s_%s", structname, propname, type);
+	rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type);
 	result = MEM_callocN(sizeof(char) * strlen(buffer) + 1, "rna_alloc_function_name");
 	strcpy(result, buffer);
 
@@ -627,17 +659,17 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 						                                        "get_length");
 						fprintf(f, "	int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
 						fprintf(f, "	int len= %s(ptr, arraylen);\n\n", lenfunc);
-						fprintf(f, "	for (i=0; i<len; i++) {\n");
+						fprintf(f, "	for (i=0; i < len; i++) {\n");
 						MEM_freeN(lenfunc);
 					}
 					else {
 						fprintf(f, "	int i;\n\n");
-						fprintf(f, "	for (i=0; i<%u; i++) {\n", prop->totarraylength);
+						fprintf(f, "	for (i=0; i < %u; i++) {\n", prop->totarraylength);
 					}
 
 					if (dp->dnaarraylength == 1) {
 						if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
-							fprintf(f, "		values[i] = %s((data->%s & (%d<<i)) != 0);\n",
+							fprintf(f, "		values[i] = %s((data->%s & (%d << i)) != 0);\n",
 							        (dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
 						}
 						else {
@@ -653,7 +685,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 							fprintf(f, ") != 0);\n");
 						}
 						else if (rna_color_quantize(prop, dp)) {
-							fprintf(f, "		values[i] = (%s)(data->%s[i]*(1.0f/255.0f));\n",
+							fprintf(f, "		values[i] = (%s)(data->%s[i]*(1.0f / 255.0f));\n",
 							        rna_type_type(prop), dp->dnaname);
 						}
 						else if (dp->dnatype) {
@@ -878,20 +910,20 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 						fprintf(f, "	int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
 						fprintf(f, "	int len= %s(ptr, arraylen);\n\n", lenfunc);
 						rna_clamp_value_range(f, prop);
-						fprintf(f, "	for (i=0; i<len; i++) {\n");
+						fprintf(f, "	for (i=0; i < len; i++) {\n");
 						MEM_freeN(lenfunc);
 					}
 					else {
 						fprintf(f, "	int i;\n\n");
 						rna_clamp_value_range(f, prop);
-						fprintf(f, "	for (i=0; i<%u; i++) {\n", prop->totarraylength);
+						fprintf(f, "	for (i=0; i < %u; i++) {\n", prop->totarraylength);
 					}
 
 					if (dp->dnaarraylength == 1) {
 						if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
 							fprintf(f, "		if (%svalues[i]) data->%s |= (%d<<i);\n",
 							        (dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
-							fprintf(f, "		else data->%s &= ~(%d<<i);\n", dp->dnaname, dp->booleanbit);
+							fprintf(f, "		else data->%s &= ~(%d << i);\n", dp->dnaname, dp->booleanbit);
 						}
 						else {
 							fprintf(f, "		(&data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
@@ -1015,9 +1047,9 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
 		else {
 			rna_print_data_get(f, dp);
 			if (dp->dnalengthname)
-				fprintf(f, "	return (data->%s == NULL)? 0: data->%s;\n", dp->dnaname, dp->dnalengthname);
+				fprintf(f, "	return (data->%s == NULL) ? 0 : data->%s;\n", dp->dnaname, dp->dnalengthname);
 			else
-				fprintf(f, "	return (data->%s == NULL)? 0: %d;\n", dp->dnaname, dp->dnalengthfixed);
+				fprintf(f, "	return (data->%s == NULL) ? 0 : %d;\n", dp->dnaname, dp->dnalengthfixed);
 		}
 		fprintf(f, "}\n\n");
 	}
@@ -1102,8 +1134,8 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 			return NULL;
 
 		/* only supported in case of standard next functions */
-		if (strcmp(nextfunc, "rna_iterator_array_next") == 0) ;
-		else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) ;
+		if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {}
+		else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {}
 		else return NULL;
 	}
 
@@ -1191,6 +1223,89 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 	return func;
 }
 
+static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                                 const char *manualfunc, const char *item_type)
+{
+	char *func;
+	StructRNA *item_srna, *item_name_base;
+	PropertyRNA *item_name_prop;
+	const int namebuflen = 1024;
+
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+		return NULL;
+
+	if (!manualfunc) {
+		if (!dp->dnastructname || !dp->dnaname)
+			return NULL;
+
+		/* only supported for collection items with name properties */
+		item_srna = rna_find_struct(item_type);
+		if (item_srna && item_srna->nameproperty) {
+			item_name_prop = item_srna->nameproperty;
+			item_name_base = item_srna;
+			while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop)
+				item_name_base = item_name_base->base;
+		}
+		else
+			return NULL;
+	}
+
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
+
+	fprintf(f, "int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
+	fprintf(f, "{\n");
+
+	if (manualfunc) {
+		fprintf(f, "	return %s(ptr, key, r_ptr);\n", manualfunc);
+		fprintf(f, "}\n\n");
+		return func;
+	}
+
+	/* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
+	 * DNA types in functions, leading to conflicting function signatures.
+	 */
+	fprintf(f, "	extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+	fprintf(f, "	extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+
+	fprintf(f, "	int found= 0;\n");
+	fprintf(f, "	CollectionPropertyIterator iter;\n");
+	fprintf(f, "	char namebuf[%d];\n", namebuflen);
+	fprintf(f, "	char *name;\n\n");
+
+	fprintf(f, "	%s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+	fprintf(f, "	while (iter.valid) {\n");
+	fprintf(f, "		int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+	fprintf(f, "		if (namelen < %d) {\n", namebuflen);
+	fprintf(f, "			%s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+	fprintf(f, "			if (strcmp(namebuf, key) == 0) {\n");
+	fprintf(f, "				found = 1;\n");
+	fprintf(f, "				*r_ptr = iter.ptr;\n");
+	fprintf(f, "				break;\n");
+	fprintf(f, "			}\n");
+	fprintf(f, "		}\n");
+	fprintf(f, "		else {\n");
+	fprintf(f, "			name = MEM_mallocN(namelen+1, \"name string\");\n");
+	fprintf(f, "			%s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+	fprintf(f, "			if (strcmp(name, key) == 0) {\n");
+	fprintf(f, "				MEM_freeN(name);\n\n");
+	fprintf(f, "				found = 1;\n");
+	fprintf(f, "				*r_ptr = iter.ptr;\n");
+	fprintf(f, "				break;\n");
+	fprintf(f, "			}\n");
+	fprintf(f, "			else\n");
+	fprintf(f, "				MEM_freeN(name);\n");
+	fprintf(f, "		}\n");
+	fprintf(f, "		%s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+	fprintf(f, "	}\n");
+	fprintf(f, "	%s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+	fprintf(f, "	return found;\n");
+	fprintf(f, "}\n\n");
+
+	return func;
+}
+
 static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
                                         const char *manualfunc)
 {
@@ -1371,10 +1486,14 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
 		{
 			CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
 			const char *nextfunc = (const char *)cprop->next;
+			const char *item_type = (const char *)cprop->item_type;
 
-			if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) ;
-			else if (dp->dnalengthname || dp->dnalengthfixed)
+			if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
+				/* pass */
+			}
+			else if (dp->dnalengthname || dp->dnalengthfixed) {
 				cprop->length = (void *)rna_def_property_length_func(f, srna, prop, dp, (const char *)cprop->length);
+			}
 
 			/* test if we can allow raw array access, if it is using our standard
 			 * array get/next function, we can be sure it is an actual array */
@@ -1391,6 +1510,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
 			cprop->end = (void *)rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end);
 			cprop->lookupint = (void *)rna_def_property_lookup_int_func(f, srna, prop, dp,
 			                                                            (const char *)cprop->lookupint, nextfunc);
+			cprop->lookupstring = (void *)rna_def_property_lookup_string_func(f, srna, prop, dp,
+			                                                                  (const char *)cprop->lookupstring, item_type);
 
 			if (!(prop->flag & PROP_IDPROPERTY)) {
 				if (!cprop->begin) {
@@ -1437,15 +1558,15 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 		{
 			if (!prop->arraydimension) {
 				fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); */
+				fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
 			}
 			else if (prop->arraydimension && prop->totarraylength) {
 				fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength); */
+				fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->totarraylength);
 			}
 			else {
 				fprintf(f, "void %sget(PointerRNA *ptr, int values[]);\n", func);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, const int values[]);\n", func); */
+				fprintf(f, "void %sset(PointerRNA *ptr, const int values[]);\n", func);
 			}
 			break;
 		}
@@ -1453,15 +1574,15 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 		{
 			if (!prop->arraydimension) {
 				fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func); */
+				fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
 			}
 			else if (prop->arraydimension && prop->totarraylength) {
 				fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength); */
+				fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->totarraylength);
 			}
 			else {
 				fprintf(f, "void %sget(PointerRNA *ptr, float values[]);\n", func);
-				/*fprintf(f, "void %sset(PointerRNA *ptr, const float values[]);\n", func); */
+				fprintf(f, "void %sset(PointerRNA *ptr, const float values[]);", func);
 			}
 			break;
 		}
@@ -1482,7 +1603,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 			}
 
 			fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
-			/*fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); */
+			fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
 
 			break;
 		}
@@ -1496,7 +1617,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 			
 			fprintf(f, "void %sget(PointerRNA *ptr, char *value);\n", func);
 			fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
-			/*fprintf(f, "void %sset(PointerRNA *ptr, const char *value);\n", func); */
+			fprintf(f, "void %sset(PointerRNA *ptr, const char *value);\n", func);
 
 			break;
 		}
@@ -1508,19 +1629,38 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 		}
 		case PROP_COLLECTION:
 		{
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
 			fprintf(f, "void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func);
 			fprintf(f, "void %snext(CollectionPropertyIterator *iter);\n", func);
 			fprintf(f, "void %send(CollectionPropertyIterator *iter);\n", func);
-			/*fprintf(f, "int %slength(PointerRNA *ptr);\n", func); */
-			/*fprintf(f, "void %slookup_int(PointerRNA *ptr, int key, StructRNA **type);\n", func); */
-			/*fprintf(f, "void %slookup_string(PointerRNA *ptr, const char *key, StructRNA **type);\n", func); */
+			if (cprop->length)
+				fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
+			if (cprop->lookupint)
+				fprintf(f, "int %slookup_int(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n", func);
+			if (cprop->lookupstring)
+				fprintf(f, "int %slookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n", func);
 			break;
 		}
 	}
 
+	if (prop->getlength) {
+		char funcname[2048];
+		rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, prop->identifier, "get_length");
+		fprintf(f, "int %s(PointerRNA *ptr, int *arraylen);\n", funcname);
+	}
+
 	fprintf(f, "\n");
 }
 
+static void rna_def_function_funcs_header(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
+{
+	FunctionRNA *func = dfunc->func;
+	char funcname[2048];
+
+	rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+	rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 1);
+}
+
 static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
 {
 	PropertyRNA *prop;
@@ -1540,26 +1680,50 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 	switch (prop->type) {
 		case PROP_BOOLEAN:
 		{
-			if (!prop->arraydimension)
-				fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier));
-			else if (prop->totarraylength)
-				fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+			if (!prop->arraydimension) {
+				fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier));
+			}
+			else if (prop->totarraylength) {
+				fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
+			}
+			else if (prop->getlength) {
+				fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier));
+			}
 			break;
 		}
 		case PROP_INT:
 		{
-			if (!prop->arraydimension)
-				fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier));
-			else if (prop->totarraylength)
-				fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+			if (!prop->arraydimension) {
+				fprintf(f, "\tinline int %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier));
+			}
+			else if (prop->totarraylength) {
+				fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
+			}
+			else if (prop->getlength) {
+				fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier));
+			}
 			break;
 		}
 		case PROP_FLOAT:
 		{
-			if (!prop->arraydimension)
-				fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier));
-			else if (prop->totarraylength)
-				fprintf(f, "\tinline Array<float, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+			if (!prop->arraydimension) {
+				fprintf(f, "\tinline float %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(float value);", rna_safe_id(prop->identifier));
+			}
+			else if (prop->totarraylength) {
+				fprintf(f, "\tinline Array<float, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(float values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
+			}
+			else if (prop->getlength) {
+				fprintf(f, "\tinline DynamicArray<float> %s(void);\n", rna_safe_id(prop->identifier));
+				fprintf(f, "\tinline void %s(float values[]);", rna_safe_id(prop->identifier));
+			}
 			break;
 		}
 		case PROP_ENUM:
@@ -1578,12 +1742,14 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 				fprintf(f, "\t};\n");
 			}
 
-			fprintf(f, "\tinline %s_enum %s(void);", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
+			fprintf(f, "\tinline %s_enum %s(void);\n", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
+			fprintf(f, "\tinline void %s(%s_enum value);", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_STRING:
 		{
 			fprintf(f, "\tinline std::string %s(void);", rna_safe_id(prop->identifier));
+			fprintf(f, "\tinline void %s(const std::string& value);", rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_POINTER:
@@ -1599,13 +1765,19 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 		case PROP_COLLECTION:
 		{
 			CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
+			const char *collection_funcs = "DefaultCollectionFunctions";
+
+			if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) && cprop->property.srna)
+				collection_funcs  = (char*)cprop->property.srna;
 
 			if (cprop->item_type)
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char *)cprop->item_type, srna->identifier,
-				        rna_safe_id(prop->identifier));
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, (const char *)cprop->item_type, srna->identifier,
+				        rna_safe_id(prop->identifier), (cprop->length ? "TRUE" : "FALSE"),
+				        (cprop->lookupint ? "TRUE" : "FALSE"), (cprop->lookupstring ? "TRUE" : "FALSE"));
 			else
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
-				        rna_safe_id(prop->identifier));
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, "UnknownType", srna->identifier,
+				        rna_safe_id(prop->identifier), (cprop->length ? "TRUE" : "FALSE"),
+				        (cprop->lookupint ? "TRUE" : "FALSE"), (cprop->lookupstring ? "TRUE" : "FALSE"));
 			break;
 		}
 	}
@@ -1613,6 +1785,96 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 	fprintf(f, "\n");
 }
 
+static const char *rna_parameter_type_cpp_name(PropertyRNA *prop)
+{
+	if (prop->type == PROP_POINTER) {
+		/* for cpp api we need to use RNA structures names for pointers */
+		PointerPropertyRNA *pprop = (PointerPropertyRNA *) prop;
+
+		return (const char *) pprop->type;
+	}
+	else {
+		return rna_parameter_type_name(prop);
+	}
+}
+
+static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc,
+                                                  const char *namespace, int close_prototype)
+{
+	PropertyDefRNA *dp;
+	FunctionRNA *func = dfunc->func;
+
+	int first = 1;
+	const char *retval_type = "void";
+
+	if (func->c_ret) {
+		dp = rna_find_parameter_def(func->c_ret);
+		retval_type = rna_parameter_type_cpp_name(dp->prop);
+	}
+
+	if (namespace && namespace[0])
+		fprintf(f, "\tinline %s %s::%s(", retval_type, namespace, rna_safe_id(func->identifier));
+	else
+		fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier));
+
+	if (func->flag & FUNC_USE_MAIN)
+		WRITE_PARAM("void *main");
+
+	if (func->flag & FUNC_USE_CONTEXT)
+		WRITE_PARAM("Context C");
+
+	for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
+		int type, flag, pout;
+		const char *ptrstr;
+
+		if (dp->prop == func->c_ret)
+			continue;
+
+		type = dp->prop->type;
+		flag = dp->prop->flag;
+		pout = (flag & PROP_OUTPUT);
+
+		if (type == PROP_POINTER)
+			ptrstr = "";
+		else if ((type == PROP_POINTER) && (flag & PROP_RNAPTR) && !(flag & PROP_THICK_WRAP))
+			ptrstr = "*";
+		else if (type == PROP_POINTER || dp->prop->arraydimension)
+			ptrstr = "*";
+		else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
+			ptrstr = "";
+		else
+			ptrstr = pout ? "*" : "";
+
+		WRITE_COMMA;
+
+		if (flag & PROP_DYNAMIC)
+			fprintf(f, "int %s%s_len, ", (flag & PROP_OUTPUT) ? "*" : "", dp->prop->identifier);
+
+		if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension)
+			fprintf(f, "%s %s[%u]", rna_parameter_type_cpp_name(dp->prop),
+			        rna_safe_id(dp->prop->identifier), dp->prop->totarraylength);
+		else
+			fprintf(f, "%s %s%s", rna_parameter_type_cpp_name(dp->prop),
+			        ptrstr, rna_safe_id(dp->prop->identifier));
+	}
+
+	fprintf(f, ")");
+	if (close_prototype)
+		fprintf(f, ";\n");
+}
+
+static void rna_def_struct_function_header_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
+{
+	FunctionRNA *func = dfunc->func;
+
+	if (!dfunc->call)
+		return;
+
+	fprintf(f, "\n\t/* %s */\n", func->description);
+
+	rna_def_struct_function_prototype_cpp(f, srna, dfunc, NULL, 1);
+}
+
 static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
 {
 	PropertyRNA *prop;
@@ -1630,6 +1892,9 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 			else if (prop->totarraylength)
 				fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
 				        rna_safe_id(prop->identifier));
+			else if (prop->getlength)
+				fprintf(f, "\tBOOLEAN_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_INT:
@@ -1639,6 +1904,9 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 			else if (prop->totarraylength)
 				fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
 				        rna_safe_id(prop->identifier));
+			else if (prop->getlength)
+				fprintf(f, "\tINT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_FLOAT:
@@ -1648,6 +1916,9 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 			else if (prop->totarraylength)
 				fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
 				        rna_safe_id(prop->identifier));
+			else if (prop->getlength)
+				fprintf(f, "\tFLOAT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_ENUM:
@@ -1680,10 +1951,13 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 			CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
 
 			if (cprop->type)
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char *)cprop->type, srna->identifier,
-				        prop->identifier);
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", (const char *)cprop->type, srna->identifier,
+				        prop->identifier, (cprop->length ? "TRUE" : "FALSE"),
+				        (cprop->lookupint ? "TRUE" : "FALSE"), (cprop->lookupstring ? "TRUE" : "FALSE"));
 			else
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", "UnknownType", srna->identifier,
+				        prop->identifier, (cprop->length ? "TRUE" : "FALSE"),
+				        (cprop->lookupint ? "TRUE" : "FALSE"), (cprop->lookupstring ? "TRUE" : "FALSE"));
 #endif
 			break;
 		}
@@ -1692,6 +1966,181 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 	fprintf(f, "\n");
 }
 
+static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
+{
+	PropertyDefRNA *dp;
+	StructDefRNA *dsrna;
+	FunctionRNA *func = dfunc->func;
+	char funcname[2048];
+
+	int first = 1;
+
+	rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+
+	fprintf(f, "%s(", funcname);
+
+	dsrna = rna_find_struct_def(srna);
+
+	if (func->flag & FUNC_USE_SELF_ID)
+		WRITE_PARAM("(::ID *) ptr.id.data");
+
+	if ((func->flag & FUNC_NO_SELF) == 0) {
+		WRITE_COMMA;
+		if (dsrna->dnaname) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname);
+		else fprintf(f, "(::%s *) this->ptr.data", srna->identifier);
+	}
+
+	if (func->flag & FUNC_USE_MAIN)
+		WRITE_PARAM("(::Main *) main");
+
+	if (func->flag & FUNC_USE_CONTEXT)
+		WRITE_PARAM("(::bContext *) C.ptr.data");
+
+	if (func->flag & FUNC_USE_REPORTS)
+		WRITE_PARAM("NULL");
+
+	dp = dfunc->cont.properties.first;
+	for (; dp; dp = dp->next) {
+		if (dp->prop == func->c_ret)
+			continue;
+
+		WRITE_COMMA;
+
+		if (dp->prop->flag & PROP_DYNAMIC)
+			fprintf(f, "%s_len, ", dp->prop->identifier);
+
+		if (dp->prop->type == PROP_POINTER)
+			if ((dp->prop->flag & PROP_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP))
+				fprintf(f, "(::%s *) &%s.ptr", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier));
+			else
+				fprintf(f, "(::%s *) %s.ptr.data", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier));
+		else
+			fprintf(f, "%s", rna_safe_id(dp->prop->identifier));
+	}
+
+	fprintf(f, ");\n");
+}
+
+static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
+{
+	PropertyDefRNA *dp;
+	PointerPropertyRNA *pprop;
+
+	FunctionRNA *func = dfunc->func;
+
+	if (!dfunc->call)
+		return;
+
+	rna_def_struct_function_prototype_cpp(f, srna, dfunc, srna->identifier, 0);
+
+	fprintf(f, " {\n");
+
+	if (func->c_ret) {
+		dp = rna_find_parameter_def(func->c_ret);
+
+		if (dp->prop->type == PROP_POINTER) {
+			pprop = (PointerPropertyRNA *) dp->prop;
+
+			fprintf(f, "\t\tPointerRNA result;\n");
+
+			if ((dp->prop->flag & PROP_RNAPTR) == 0) {
+				StructRNA *ret_srna = rna_find_struct((const char *) pprop->type);
+				fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop));
+				rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+				if (ret_srna->flag & STRUCT_ID)
+					fprintf(f, "\t\tRNA_id_pointer_create((::ID *) retdata, &result);\n");
+				else
+					fprintf(f, "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n", (const char *) pprop->type);
+			}
+			else {
+				fprintf(f, "\t\tresult = ");
+				rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+			}
+
+			fprintf(f, "\t\treturn %s(result);\n", (const char *) pprop->type);
+		}
+		else {
+			fprintf(f, "\t\treturn ");
+			rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+		}
+	}
+	else {
+		fprintf(f, "\t\t");
+		rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+	}
+
+	fprintf(f, "\t}\n\n");
+}
+
+static void rna_def_property_wrapper_funcs(FILE *f, StructDefRNA *dsrna, PropertyDefRNA *dp)
+{
+	if (dp->prop->getlength) {
+		char funcname[2048];
+		rna_construct_wrapper_function_name(funcname, sizeof(funcname), dsrna->srna->identifier, dp->prop->identifier, "get_length");
+		fprintf(f, "int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
+		fprintf(f, "{\n");
+		fprintf(f, "\treturn %s(ptr, arraylen);\n", rna_function_string(dp->prop->getlength));
+		fprintf(f, "}\n\n");
+	}
+}
+
+static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
+{
+	StructRNA *srna = dsrna->srna;
+	FunctionRNA *func = dfunc->func;
+	PropertyDefRNA *dparm;
+
+	int first;
+	char funcname[2048];
+
+	if (!dfunc->call)
+		return;
+
+	rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+
+	rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 0);
+
+	fprintf(f, "\n{\n");
+
+	if (func->c_ret)
+		fprintf(f, "\treturn %s(", dfunc->call);
+	else
+		fprintf(f, "\t%s(", dfunc->call);
+
+	first = 1;
+
+	if (func->flag & FUNC_USE_SELF_ID)
+		WRITE_PARAM("_selfid");
+
+	if ((func->flag & FUNC_NO_SELF) == 0)
+		WRITE_PARAM("_self");
+
+	if (func->flag & FUNC_USE_MAIN)
+		WRITE_PARAM("bmain");
+
+	if (func->flag & FUNC_USE_CONTEXT)
+		WRITE_PARAM("C");
+
+	if (func->flag & FUNC_USE_REPORTS)
+		WRITE_PARAM("reports");
+
+	dparm = dfunc->cont.properties.first;
+	for (; dparm; dparm = dparm->next) {
+		if (dparm->prop == func->c_ret)
+			continue;
+
+		WRITE_COMMA;
+
+		if (dparm->prop->flag & PROP_DYNAMIC)
+			fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
+		else
+			fprintf(f, "%s", rna_safe_id(dparm->prop->identifier));
+	}
+
+	fprintf(f, ");\n");
+	fprintf(f, "}\n\n");
+}
+
 static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
 {
 	StructRNA *srna;
@@ -1741,6 +2190,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
 		/* fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, pass a pointer to it */
 		else if (type == PROP_POINTER || dparm->prop->arraydimension)
 			ptrstr = "*";
+		else if ((type == PROP_POINTER) && (flag & PROP_RNAPTR) && !(flag & PROP_THICK_WRAP))
+			ptrstr = "*";
 		/* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack,
 		 * but type name for string props is already char*, so leave empty */
 		else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
@@ -1792,6 +2243,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
 				ptrstr = "**";
 				valstr = "*";
 			}
+			else if ((type == PROP_POINTER) && !(flag & PROP_THICK_WRAP)) {
+				ptrstr = "**";
+				valstr = "*";
+			}
 			else if (type == PROP_POINTER || dparm->prop->arraydimension) {
 				ptrstr = "*";
 				valstr = "";
@@ -1991,6 +2446,7 @@ static const char *rna_property_subtypename(PropertySubType type)
 		case PROP_COORDS: return "PROP_COORDS";
 		case PROP_LAYER: return "PROP_LAYER";
 		case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
+		case PROP_PASSWORD: return "PROP_PASSWORD";
 		default: {
 			/* in case we don't have a type preset that includes the subtype */
 			if (RNA_SUBTYPE_UNIT(type)) {
@@ -2107,7 +2563,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
 		fprintf(f, "\n");
 }
 
-static void rna_generate_static_parameter_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FunctionDefRNA *dfunc, FILE *f)
+static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, const char *name_override, int close_prototype)
 {
 	FunctionRNA *func;
 	PropertyDefRNA *dparm;
@@ -2138,7 +2594,10 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *UNUSED(brna), S
 		fprintf(f, "void ");
 
 	/* function name */
-	fprintf(f, "%s(", dfunc->call);
+	if (name_override == NULL || name_override[0] == '\0')
+		fprintf(f, "%s(", dfunc->call);
+	else
+		fprintf(f, "%s(", name_override);
 
 	first = 1;
 
@@ -2147,7 +2606,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *UNUSED(brna), S
 		fprintf(f, "struct ID *_selfid");
 		first = 0;
 	}
-	
+
 	if ((func->flag & FUNC_NO_SELF) == 0) {
 		if (!first) fprintf(f, ", ");
 		if (dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
@@ -2200,17 +2659,19 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *UNUSED(brna), S
 
 		if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
 			fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
-			        dparm->prop->identifier, dparm->prop->totarraylength);
+			        rna_safe_id(dparm->prop->identifier), dparm->prop->totarraylength);
 		else
 			fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
-			        ptrstr, dparm->prop->identifier);
+			        ptrstr, rna_safe_id(dparm->prop->identifier));
 
 	}
 
-	fprintf(f, ");\n");
+	fprintf(f, ")");
+	if (close_prototype)
+		fprintf(f, ";\n");
 }
 
-static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f)
+static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
 {
 	FunctionRNA *func;
 	FunctionDefRNA *dfunc;
@@ -2225,7 +2686,50 @@ static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA
 				first = 0;
 			}
 
-			rna_generate_static_parameter_prototypes(brna, srna, dfunc, f);
+			rna_generate_static_parameter_prototypes(f, srna, dfunc, NULL, 1);
+		}
+	}
+
+	fprintf(f, "\n");
+}
+
+static void rna_generate_struct_prototypes(FILE *f)
+{
+	StructDefRNA *ds;
+	PropertyDefRNA *dp;
+	FunctionDefRNA *dfunc;
+	const char *structures[2048];
+	int all_structures = 0;
+
+	/* structures definitions */
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
+			if (dfunc->call) {
+				for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
+					if (dp->prop->type == PROP_POINTER) {
+						int a, found = 0;
+						const char *struct_name = rna_parameter_type_name(dp->prop);
+
+						for (a = 0; a < all_structures; a++) {
+							if (strcmp(struct_name, structures[a]) == 0) {
+								found = 1;
+								break;
+							}
+						}
+
+						if (found == 0) {
+							fprintf(f, "struct %s;\n", struct_name);
+
+							if (all_structures >= sizeof(structures) / sizeof(structures[0])) {
+								printf("Array size to store all structures names is too small\n");
+								exit(1);
+							}
+
+							structures[all_structures++] = struct_name;
+						}
+					}
+				}
+			}
 		}
 	}
 
@@ -2753,6 +3257,8 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
 	fprintf(f, "#include <string.h>\n\n");
 	fprintf(f, "#include <stddef.h>\n\n");
 
+	fprintf(f, "#include \"MEM_guardedalloc.h\"\n\n");
+
 	fprintf(f, "#include \"DNA_ID.h\"\n");
 	fprintf(f, "#include \"DNA_scene_types.h\"\n");
 
@@ -2791,8 +3297,13 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
 
 	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
 		if (!filename || ds->filename == filename) {
-			for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+			for (dp = ds->cont.properties.first; dp; dp = dp->next)
+				rna_def_property_wrapper_funcs(f, ds, dp);
+
+			for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
+				rna_def_function_wrapper_funcs(f, ds, dfunc);
 				rna_def_function_funcs(f, ds, dfunc);
+			}
 
 			rna_generate_static_function_prototypes(brna, ds->srna, f);
 		}
@@ -2816,6 +3327,7 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
 	StructDefRNA *ds;
 	PropertyDefRNA *dp;
 	StructRNA *srna;
+	FunctionDefRNA *dfunc;
 
 	fprintf(f, "\n#ifndef __RNA_BLENDER_H__\n");
 	fprintf(f, "#define __RNA_BLENDER_H__\n\n");
@@ -2853,6 +3365,9 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
 
 		for (dp = ds->cont.properties.first; dp; dp = dp->next)
 			rna_def_property_funcs_header(f, ds->srna, dp);
+
+		for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+			rna_def_function_funcs_header(f, ds->srna, dfunc);
 	}
 
 	fprintf(f, "#ifdef __cplusplus\n}\n#endif\n\n");
@@ -2868,43 +3383,141 @@ static const char *cpp_classes = ""
 "namespace BL {\n"
 "\n"
 "#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
-"	inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr)? true: false; }\n"
+"	inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr)? true: false; } \\\n"
+"	inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
 "\n"
 "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
 "	inline Array<int,size> sname::identifier(void) \\\n"
-"		{ Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n"
+"		{ Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+"	inline void sname::identifier(int values[size]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
+"\n"
+"#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+"	inline DynamicArray<int> sname::identifier(void) { \\\n"
+"		int arraylen[3]; \\\n"
+"		int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+"		DynamicArray<int> ar(len); \\\n"
+"		sname##_##identifier##_get(&ptr, ar.data); \\\n"
+"		return ar; } \\\n"
+"	inline void sname::identifier(int values[]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
 "\n"
 "#define INT_PROPERTY(sname, identifier) \\\n"
-"	inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n"
+"	inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+"	inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
 "\n"
 "#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
 "	inline Array<int,size> sname::identifier(void) \\\n"
-"		{ Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n"
+"		{ Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+"	inline void sname::identifier(int values[size]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
+"\n"
+"#define INT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+"	inline DynamicArray<int> sname::identifier(void) { \\\n"
+"		int arraylen[3]; \\\n"
+"		int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+"		DynamicArray<int> ar(len); \\\n"
+"		sname##_##identifier##_get(&ptr, ar.data); \\\n"
+"		return ar; } \\\n"
+"	inline void sname::identifier(int values[]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
 "\n"
 "#define FLOAT_PROPERTY(sname, identifier) \\\n"
-"	inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n"
+"	inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+"	inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
 "\n"
 "#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
 "	inline Array<float,size> sname::identifier(void) \\\n"
-"		{ Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n"
+"		{ Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+"	inline void sname::identifier(float values[size]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
+"\n"
+"#define FLOAT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+"	inline DynamicArray<float> sname::identifier(void) { \\\n"
+"		int arraylen[3]; \\\n"
+"		int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+"		DynamicArray<float> ar(len); \\\n"
+"		sname##_##identifier##_get(&ptr, ar.data); \\\n"
+"		return ar; } \\\n"
+"	inline void sname::identifier(float values[]) \\\n"
+"		{ sname##_##identifier##_set(&ptr, values); } \\\n"
 "\n"
 "#define ENUM_PROPERTY(type, sname, identifier) \\\n"
-"	inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); }\n"
+"	inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); } \\\n"
+"	inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, value); }\n"
 "\n"
 "#define STRING_PROPERTY(sname, identifier) \\\n"
 "	inline std::string sname::identifier(void) { \\\n"
 "		int len= sname##_##identifier##_length(&ptr); \\\n"
 "		std::string str; str.resize(len); \\\n"
 "		sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
+"	inline void sname::identifier(const std::string& value) { \\\n"
+"		sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
 "\n"
 "#define POINTER_PROPERTY(type, sname, identifier) \\\n"
 "	inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
 "\n"
-"#define COLLECTION_PROPERTY(type, sname, identifier) \\\n"
+"#define COLLECTION_PROPERTY_LENGTH_FALSE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+"	{ \\\n"
+"		CollectionPropertyIterator iter; \\\n"
+"		int length = 0; \\\n"
+"		sname##_##identifier##_begin(&iter, ptr); \\\n"
+"		while (iter.valid) { \\\n"
+"			sname##_##identifier##_next(&iter); \\\n"
+"			++length; \\\n"
+"		} \\\n"
+"		sname##_##identifier##_end(&iter); \\\n"
+"		return length; \\\n"
+"	} \n"
+"#define COLLECTION_PROPERTY_LENGTH_TRUE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+"	{ return sname##_##identifier##_length(ptr); } \n"
+"\n"
+"#define COLLECTION_PROPERTY_LOOKUP_INT_FALSE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
+"	{ \\\n"
+"		CollectionPropertyIterator iter; \\\n"
+"		int i = 0, found = 0; \\\n"
+"		sname##_##identifier##_begin(&iter, ptr); \\\n"
+"		while (iter.valid) { \\\n"
+"			if (i == key) { \\\n"
+"				*r_ptr = iter.ptr; \\\n"
+"				found = 1; \\\n"
+"				break; \\\n"
+"			} \\\n"
+"			sname##_##identifier##_next(&iter); \\\n"
+"			++i; \\\n"
+"		} \\\n"
+"		sname##_##identifier##_end(&iter); \\\n"
+"		if (!found) \\\n"
+"			memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+"		return found; \\\n"
+"	} \n"
+"#define COLLECTION_PROPERTY_LOOKUP_INT_TRUE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
+"	{ return sname##_##identifier##_lookup_int(ptr, key, r_ptr); } \n"
+"\n"
+"#define COLLECTION_PROPERTY_LOOKUP_STRING_FALSE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
+"	{ \\\n"
+"		memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+"		return 0; \\\n"
+"	} \n"
+"#define COLLECTION_PROPERTY_LOOKUP_STRING_TRUE(sname, identifier) \\\n"
+"	inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
+"	{ return sname##_##identifier##_lookup_string(ptr, key, r_ptr); } \n"
+"\n"
+"#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, has_lookup_int, has_lookup_string) \\\n"
 "	typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
 "		sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
+"	COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
+"	COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
+"	COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
 "	Collection<sname, type, sname##_##identifier##_begin, \\\n"
-"		sname##_##identifier##_next, sname##_##identifier##_end> identifier;\n"
+"		sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
+"		sname##_##identifier##_length_wrap, \\\n"
+"		sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
 "\n"
 "class Pointer {\n"
 "public:\n"
@@ -2923,7 +3536,7 @@ static const char *cpp_classes = ""
 "public:\n"
 "	T data[Tsize];\n"
 "\n"
-"   Array() {}\n"
+"	Array() {}\n"
 "	Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n"
 "	const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); "
 "return *this; }\n"
@@ -2931,9 +3544,36 @@ static const char *cpp_classes = ""
 "	operator T*() { return data; }\n"
 "};\n"
 "\n"
+"template<typename T>\n"
+"class DynamicArray {\n"
+"public:\n"
+"	T *data;\n"
+"	int length;\n"
+"\n"
+"	DynamicArray() : data(NULL), length(0) {}\n"
+"	DynamicArray(int new_length) : data(NULL), length(new_length) { data = (float*)malloc(sizeof(T) * new_length); }\n"
+"	DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n"
+"	const DynamicArray<T>& operator=(const DynamicArray<T>& other) { copy_from(other); return *this; }\n"
+"\n"
+"	~DynamicArray() { if (data) free(data); }\n"
+"\n"
+"	operator T*() { return data; }\n"
+"\n"
+"protected:\n"
+"	void copy_from(const DynamicArray<T>& other) {\n"
+"		if (data) free(data);\n"
+"		data = (float*)malloc(sizeof(T) * other.length);\n"
+"		memcpy(data, other.data, sizeof(T) * other.length);\n"
+"		length = other.length;\n"
+"	}\n"
+"};\n"
+"\n"
 "typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n"
 "typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n"
 "typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n"
+"typedef int (*TLengthFunc)(PointerRNA *ptr);\n"
+"typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n"
+"typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n"
 "\n"
 "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
 "class CollectionIterator {\n"
@@ -2964,26 +3604,97 @@ static const char *cpp_classes = ""
 "	bool init;\n"
 "};\n"
 "\n"
-"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
-"class Collection {\n"
+"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
+"         TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n"
+"         typename Tcollection_funcs>\n"
+"class Collection : public Tcollection_funcs {\n"
 "public:\n"
-"	Collection(const PointerRNA &p) : ptr(p) {}\n"
+"	Collection(const PointerRNA &p) : Tcollection_funcs(p), ptr(p)  {}\n"
 "\n"
 "	void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
 "	{ iter.begin(ptr); }\n"
 "	CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
 "	{ return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
+""
+"	int length()\n"
+"	{ return Tlength(&ptr); }\n"
+"	T operator[](int key)\n"
+"	{ PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
+"	T operator[](const std::string &key)\n"
+"	{ PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
 "\n"
 "private:\n"
 "	PointerRNA ptr;\n"
 "};\n"
+"\n"
+"class DefaultCollectionFunctions {\n"
+"public:\n"
+"	DefaultCollectionFunctions(const PointerRNA &p) {}\n"
+"};\n"
+"\n"
 "\n";
 
+static int rna_is_collection_prop(PropertyRNA *prop)
+{
+	if (!(prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)))
+		if (prop->type == PROP_COLLECTION)
+			return 1;
+
+	return 0;
+}
+
+static int rna_is_collection_functions_struct(const char **collection_structs, const char *struct_name)
+{
+	int a = 0, found = 0;
+
+	while (collection_structs[a]) {
+		if (!strcmp(collection_structs[a], struct_name)) {
+			found = 1;
+			break;
+		}
+		a++;
+	}
+
+	return found;
+}
+
+static void rna_generate_header_class_cpp(StructDefRNA *ds, FILE *f)
+{
+	StructRNA *srna = ds->srna;
+	PropertyDefRNA *dp;
+	FunctionDefRNA *dfunc;
+
+	fprintf(f, "/**************** %s ****************/\n\n", srna->name);
+
+	fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer");
+	fprintf(f, "public:\n");
+	fprintf(f, "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
+	        (srna->base) ? srna->base->identifier : "Pointer");
+	for (dp = ds->cont.properties.first; dp; dp = dp->next)
+		if (rna_is_collection_prop(dp->prop))
+			fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
+	fprintf(f, "\n\t\t{}\n\n");
+
+	for (dp = ds->cont.properties.first; dp; dp = dp->next)
+		rna_def_property_funcs_header_cpp(f, ds->srna, dp);
+
+	fprintf(f, "\n");
+	for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+		rna_def_struct_function_header_cpp(f, srna, dfunc);
+
+	fprintf(f, "};\n\n");
+}
+
 static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
 {
 	StructDefRNA *ds;
 	PropertyDefRNA *dp;
 	StructRNA *srna;
+	FunctionDefRNA *dfunc;
+	const char *first_collection_func_struct = NULL;
+	const char *collection_func_structs[256] = {NULL};
+	int all_collection_func_structs = 0;
+	int max_collection_func_structs = sizeof(collection_func_structs) / sizeof(collection_func_structs[0]) - 1;
 
 	fprintf(f, "\n#ifndef __RNA_BLENDER_CPP_H__\n");
 	fprintf(f, "#define __RNA_BLENDER_CPP_H__\n\n");
@@ -3000,38 +3711,86 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
 
 	fprintf(f, "/**************** Declarations ****************/\n\n");
 
-	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
 		fprintf(f, "class %s;\n", ds->srna->identifier);
+	}
 	fprintf(f, "\n");
 
+	/* first get list of all structures used as collection functions, so they'll be declared first */
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		for (dp = ds->cont.properties.first; dp; dp = dp->next) {
+			if (rna_is_collection_prop(dp->prop)) {
+				PropertyRNA *prop = dp->prop;
+
+				if (prop->srna) {
+					/* store name of structure which first uses custom functions for collections */
+					if (first_collection_func_struct == NULL)
+						first_collection_func_struct = ds->srna->identifier;
+
+					if (!rna_is_collection_functions_struct(collection_func_structs, (char*)prop->srna)) {
+						if (all_collection_func_structs >= max_collection_func_structs) {
+							printf("Array size to store all collection structures names is too small\n");
+							exit(1);
+						}
+
+						collection_func_structs[all_collection_func_structs++] = (char*)prop->srna;
+					}
+				}
+			}
+		}
+	}
+
+	/* declare all structures in such order:
+	 * - first N structures which doesn't use custom functions for collections
+	 * - all structures used for custom functions in collections
+	 * - all the rest structures
+	 * such an order prevents usage of non-declared classes
+	 */
 	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
 		srna = ds->srna;
 
-		fprintf(f, "/**************** %s ****************/\n\n", srna->name);
+		if (!strcmp(srna->identifier, first_collection_func_struct)) {
+			StructDefRNA *ds2;
+			StructRNA *srna2;
 
-		fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer");
-		fprintf(f, "public:\n");
-		fprintf(f, "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
-		        (srna->base) ? srna->base->identifier : "Pointer");
-		for (dp = ds->cont.properties.first; dp; dp = dp->next)
-			if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)))
-				if (dp->prop->type == PROP_COLLECTION)
-					fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
-		fprintf(f, "\n\t\t{}\n\n");
+			for (ds2 = DefRNA.structs.first; ds2; ds2 = ds2->cont.next) {
+				srna2 = ds2->srna;
 
-		for (dp = ds->cont.properties.first; dp; dp = dp->next)
-			rna_def_property_funcs_header_cpp(f, ds->srna, dp);
-		fprintf(f, "};\n\n");
+				if (rna_is_collection_functions_struct(collection_func_structs, srna2->identifier)) {
+					rna_generate_header_class_cpp(ds2, f);
+				}
+			}
+		}
+
+		if (!rna_is_collection_functions_struct(collection_func_structs, srna->identifier))
+			rna_generate_header_class_cpp(ds, f);
 	}
 
+	fprintf(f, "} /* namespace BL */\n");
 
+	fprintf(f, "\n");
 	fprintf(f, "/**************** Implementation ****************/\n");
+	fprintf(f, "\n");
+
+	fprintf(f, "/* Structure prototypes */\n\n");
+	fprintf(f, "extern \"C\" {\n");
+	rna_generate_struct_prototypes(f);
+	fprintf(f, "}\n\n");
+
+	fprintf(f, "namespace BL {\n");
 
 	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		srna = ds->srna;
+
 		for (dp = ds->cont.properties.first; dp; dp = dp->next)
 			rna_def_property_funcs_impl_cpp(f, ds->srna, dp);
 
 		fprintf(f, "\n");
+
+		for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+			rna_def_struct_function_impl_cpp(f, srna, dfunc);
+
+		fprintf(f, "\n");
 	}
 
 	fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
@@ -3068,34 +3827,8 @@ static int rna_preprocess(const char *outfile)
 
 	rna_auto_types();
 
-
-	/* create RNA_blender_cpp.h */
-	strcpy(deffile, outfile);
-	strcat(deffile, "RNA_blender_cpp.h" TMP_EXT);
-
 	status = (DefRNA.error != 0);
 
-	if (status) {
-		make_bad_file(deffile, __LINE__);
-	}
-	else {
-		file = fopen(deffile, "w");
-
-		if (!file) {
-			fprintf(stderr, "Unable to open file: %s\n", deffile);
-			status = 1;
-		}
-		else {
-			rna_generate_header_cpp(brna, file);
-			fclose(file);
-			status = (DefRNA.error != 0);
-		}
-	}
-
-	replace_if_different(deffile, NULL);
-
-	rna_sort(brna);
-
 	/* create rna_gen_*.c files */
 	for (i = 0; PROCESS_ITEMS[i].filename; i++) {
 		strcpy(deffile, outfile);
@@ -3128,6 +3861,31 @@ static int rna_preprocess(const char *outfile)
 		replace_if_different(deffile, deps);
 	}
 
+	/* create RNA_blender_cpp.h */
+	strcpy(deffile, outfile);
+	strcat(deffile, "RNA_blender_cpp.h" TMP_EXT);
+
+	if (status) {
+		make_bad_file(deffile, __LINE__);
+	}
+	else {
+		file = fopen(deffile, "w");
+
+		if (!file) {
+			fprintf(stderr, "Unable to open file: %s\n", deffile);
+			status = 1;
+		}
+		else {
+			rna_generate_header_cpp(brna, file);
+			fclose(file);
+			status = (DefRNA.error != 0);
+		}
+	}
+
+	replace_if_different(deffile, NULL);
+
+	rna_sort(brna);
+
 	/* create RNA_blender.h */
 	strcpy(deffile, outfile);
 	strcat(deffile, "RNA_blender.h" TMP_EXT);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 3ff6338..11ce734 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -243,8 +243,8 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports,
 	 * owns the string pointer which it could potentially free while blender
 	 * is running. */
 	if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
-		BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is "
-		            STRINGIFY(MAX_IDPROP_NAME), identifier);
+		BKE_reportf(reports, RPT_ERROR, "Registering id property class: '%s' is too long, maximum length is %d",
+		            identifier, MAX_IDPROP_NAME);
 		return NULL;
 	}
 
@@ -287,7 +287,7 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
 		switch (GS(id->name)) {
 			case ID_OB:
 				if (flag & ~(OB_RECALC_ALL)) {
-					BKE_report(reports, RPT_ERROR, "'refresh' incompatible with Object ID type");
+					BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with Object ID type");
 					return;
 				}
 				break;
@@ -295,7 +295,7 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
 #if 0
 			case ID_PA:
 				if (flag & ~(OB_RECALC_ALL | PSYS_RECALC)) {
-					BKE_report(reports, RPT_ERROR, "'refresh' incompatible with ParticleSettings ID type");
+					BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with ParticleSettings ID type");
 					return;
 				}
 				break;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index c88944b..488dbff 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -46,6 +46,7 @@
 
 #include "BKE_animsys.h"
 #include "BKE_context.h"
+#include "BKE_idcode.h"
 #include "BKE_idprop.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
@@ -996,7 +997,7 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin
 			IDProperty *item;
 
 			item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
-			*hardmin = item ? (float)IDP_Double(item) : FLT_MIN;
+			*hardmin = item ? (float)IDP_Double(item) : -FLT_MAX;
 
 			item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
 			*hardmax = item ? (float)IDP_Double(item) : FLT_MAX;
@@ -1224,10 +1225,10 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
 				if (prop->translation_context)
 					nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
 				else
-					nitem[i].name = BLF_gettext(nitem[i].name);
+					nitem[i].name = BLF_pgettext(NULL, nitem[i].name);
 			}
 			if (nitem[i].description)
-				nitem[i].description = BLF_gettext(nitem[i].description);
+				nitem[i].description = BLF_pgettext(NULL, nitem[i].description);
 		}
 
 		*item = nitem;
@@ -2551,7 +2552,10 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
 		pprop = (PointerPropertyRNA *)prop;
 
 		/* for groups, data is idprop itself */
-		return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
+		if (pprop->typef)
+			return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop);
+		else
+			return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
 	}
 	else if (pprop->get) {
 		return pprop->get(ptr);
@@ -3169,7 +3173,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 						itemtype = RNA_property_type(iprop);
 					}
 					else {
-						BKE_reportf(reports, RPT_ERROR, "Property named %s not found", propname);
+						BKE_reportf(reports, RPT_ERROR, "Property named '%s' not found", propname);
 						err = 1;
 						break;
 					}
@@ -3606,7 +3610,7 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
 	/* copy string, taking into account escaped ] */
 	if (bracket) {
 		for (p = *path, i = 0, j = 0; i < len; i++, p++) {
-			if (*p == '\\' && *(p + 1) == quote) ;
+			if (*p == '\\' && *(p + 1) == quote) {}
 			else buf[j++] = *p;
 		}
 
@@ -3647,7 +3651,8 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
 int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *index)
 {
 	PropertyRNA *prop;
-	PointerRNA curptr, nextptr;
+	PointerRNA curptr;
+	PointerRNA nextptr;  /* keep uninitialized, helps expose bugs in collection accessor functions */
 	char fixedbuf[256], *token;
 	int type, intkey;
 
@@ -3713,7 +3718,12 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 
 						/* check for "" to see if it is a string */
 						if (rna_token_strip_quotes(token)) {
-							RNA_property_collection_lookup_string(&curptr, prop, token + 1, &nextptr);
+							if (RNA_property_collection_lookup_string(&curptr, prop, token + 1, &nextptr)) {
+								/* pass */
+							}
+							else {
+								nextptr.data = NULL;
+							}
 						}
 						else {
 							/* otherwise do int lookup */
@@ -3721,7 +3731,12 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 							if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
 								return 0; /* we can be sure the fixedbuf was used in this case */
 							}
-							RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
+							if (RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr)) {
+								/* pass */
+							}
+							else {
+								nextptr.data = NULL;
+							}
 						}
 
 						if (token != fixedbuf) {
@@ -3730,13 +3745,14 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 					}
 					else {
 						PointerRNA c_ptr;
-
-						/* ensure we quit on invalid values */
-						nextptr.data = NULL;
 	
 						if (RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
 							nextptr = c_ptr;
 						}
+						else {
+							/* ensure we quit on invalid values */
+							nextptr.data = NULL;
+						}
 					}
 					
 					if (nextptr.data) {
@@ -3999,12 +4015,15 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee
 	BLI_assert(haystack->type == IDP_GROUP);
 
 	link.up = parent_link;
+	/* always set both name and index,
+	 * else a stale value might get used */
 	link.name = NULL;
 	link.index = -1;
 
 	for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) {
 		if (needle == iter) {  /* found! */
 			link.name = iter->name;
+			link.index = -1;
 			path = rna_idp_path_create(&link);
 			break;
 		}
@@ -4014,6 +4033,7 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee
 				PointerRNA child_ptr = RNA_pointer_get(ptr, iter->name);
 				if (child_ptr.type) {
 					link.name = iter->name;
+					link.index = -1;
 					if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) {
 						break;
 					}
@@ -4131,16 +4151,32 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
 		path = BLI_sprintfN(is_rna ? "%s.%s" : "%s[\"%s\"]", ptrpath, propname);
 		MEM_freeN(ptrpath);
 	}
-	else {
+	else if (RNA_struct_is_ID(ptr->type)) {
 		if (is_rna)
 			path = BLI_strdup(propname);
 		else
 			path = BLI_sprintfN("[\"%s\"]", propname);
 	}
+	else {
+		path = NULL;
+	}
 
 	return path;
 }
 
+/**
+ * Get the ID as a python representation, eg:
+ *   bpy.data.foo["bar"]
+ */
+char *RNA_path_from_ID_python(ID *id)
+{
+	char id_esc[(sizeof(id->name) - 2) * 2];
+
+	BLI_strescape(id_esc, id->name + 2, sizeof(id_esc));
+
+	return BLI_sprintfN("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
+}
+
 /* Quick name based property access */
 
 int RNA_boolean_get(PointerRNA *ptr, const char *name)
@@ -4512,6 +4548,17 @@ int RNA_collection_length(PointerRNA *ptr, const char *name)
 	}
 }
 
+int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost)
+{
+	if (prop->flag & PROP_IDPROPERTY) {
+		IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
+		return ((idprop != NULL) && (use_ghost == FALSE || !(idprop->flag & IDP_FLAG_GHOST)));
+	}
+	else {
+		return 1;
+	}
+}
+
 int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
 {
 	if (prop->flag & PROP_IDPROPERTY) {
@@ -4523,6 +4570,20 @@ int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
 	}
 }
 
+int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost)
+{
+	PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
+
+	if (prop) {
+		return RNA_property_is_set_ex(ptr, prop, use_ghost);
+	}
+	else {
+		/* python raises an error */
+		/* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
+		return 0;
+	}
+}
+
 int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
 {
 	PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
@@ -5219,7 +5280,7 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
 			lenbuf[idx] = format[ofs];
 
 	if (ofs < flen && format[ofs + 1] == ']') {
-		/* XXX put better error reporting for ofs>=flen or idx over lenbuf capacity */
+		/* XXX put better error reporting for (ofs >= flen) or idx over lenbuf capacity */
 		lenbuf[idx] = '\0';
 		return atoi(lenbuf);
 	}
@@ -5677,7 +5738,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 
 	/* get the length of the array to work with */
 	len = RNA_property_array_length(ptr, prop);
-	fromlen = RNA_property_array_length(ptr, prop);
+	fromlen = RNA_property_array_length(fromptr, prop);
 
 	if (len != fromlen)
 		return 0;
@@ -5791,3 +5852,146 @@ void _RNA_warning(const char *format, ...)
 	}
 #endif
 }
+
+int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
+{
+	/* get the length of the array to work with */
+	int len = RNA_property_array_length(a, prop);
+	int fromlen = RNA_property_array_length(b, prop);
+
+	if (len != fromlen)
+		return 0;
+
+	/* get and set the default values as appropriate for the various types */
+	switch (RNA_property_type(prop)) {
+		case PROP_BOOLEAN: {
+			if (len) {
+				int fixed_a[16], fixed_b[16];
+				int *array_a, *array_b;
+				int equals;
+
+				array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
+				array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
+
+				RNA_property_boolean_get_array(a, prop, array_a);
+				RNA_property_boolean_get_array(b, prop, array_b);
+
+				equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
+
+				if (array_a != fixed_a) MEM_freeN(array_a);
+				if (array_b != fixed_b) MEM_freeN(array_b);
+
+				return equals;
+			}
+			else {
+				int value = RNA_property_boolean_get(a, prop);
+				return value == RNA_property_boolean_get(b, prop);
+			}
+		}
+
+		case PROP_INT: {
+			if (len) {
+				int fixed_a[16], fixed_b[16];
+				int *array_a, *array_b;
+				int equals;
+
+				array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
+				array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
+
+				RNA_property_int_get_array(a, prop, array_a);
+				RNA_property_int_get_array(b, prop, array_b);
+
+				equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
+
+				if (array_a != fixed_a) MEM_freeN(array_a);
+				if (array_b != fixed_b) MEM_freeN(array_b);
+
+				return equals;
+			}
+			else {
+				int value = RNA_property_int_get(a, prop);
+				return value == RNA_property_int_get(b, prop);
+			}
+		}
+
+		case PROP_FLOAT: {
+			if (len) {
+				float fixed_a[16], fixed_b[16];
+				float *array_a, *array_b;
+				int equals;
+
+				array_a = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_a;
+				array_b = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_b;
+
+				RNA_property_float_get_array(a, prop, array_a);
+				RNA_property_float_get_array(b, prop, array_b);
+
+				equals = memcmp(array_a, array_b, sizeof(float) * len) == 0;
+
+				if (array_a != fixed_a) MEM_freeN(array_a);
+				if (array_b != fixed_b) MEM_freeN(array_b);
+
+				return equals;
+			}
+			else {
+				float value = RNA_property_float_get(a, prop);
+				return value == RNA_property_float_get(b, prop);
+			}
+		}
+
+		case PROP_ENUM: {
+			int value = RNA_property_enum_get(a, prop);
+			return value == RNA_property_enum_get(b, prop);
+		}
+
+		case PROP_STRING: {
+			char fixed_a[128], fixed_b[128];
+			int len_a, len_b;
+			char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a);
+			char *value_b = RNA_property_string_get_alloc(b, prop, fixed_b, sizeof(fixed_b), &len_b);
+			int equals = strcmp(value_a, value_b) == 0;
+
+			if (value_a != fixed_a) MEM_freeN(value_a);
+			if (value_b != fixed_b) MEM_freeN(value_b);
+
+			return equals;
+		}
+
+		default:
+			break;
+	}
+
+	return 1;
+}
+
+int RNA_struct_equals(PointerRNA *a, PointerRNA *b)
+{
+	CollectionPropertyIterator iter;
+//	CollectionPropertyRNA *citerprop;  /* UNUSED */
+	PropertyRNA *iterprop;
+	int equals = 1;
+
+	if (a == NULL && b == NULL)
+		return 1;
+	else if (a == NULL || b == NULL)
+		return 0;
+	else if (a->type != b->type)
+		return 0;
+
+	iterprop = RNA_struct_iterator_property(a->type);
+//	citerprop = (CollectionPropertyRNA *)rna_ensure_property(iterprop);  /* UNUSED */
+
+	RNA_property_collection_begin(a, iterprop, &iter);
+	for (; iter.valid; RNA_property_collection_next(&iter)) {
+		PropertyRNA *prop = iter.ptr.data;
+
+		if (!RNA_property_equals(a, b, prop)) {
+			equals = 0;
+			break;
+		}
+	}
+	RNA_property_collection_end(&iter);
+
+	return equals;
+}
+
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 00a257a..1f9503f 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
@@ -45,9 +46,13 @@
 
 #ifdef RNA_RUNTIME
 
-#include "ED_keyframing.h"
+#include "BLI_math_base.h"
+
 #include "BKE_fcurve.h"
 
+#include "ED_keyframing.h"
+
+
 static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
 {
 	ListBaseIterator *internal = iter->internal;
@@ -68,29 +73,30 @@ static bActionGroup *rna_Action_groups_new(bAction *act, const char name[])
 	return action_groups_add_new(act, name);
 }
 
-static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionGroup *agrp)
+static void rna_Action_groups_remove(bAction *act, ReportList *reports, PointerRNA *agrp_ptr)
 {
+	bActionGroup *agrp = agrp_ptr->data;
 	FCurve *fcu, *fcn;
 	
 	/* try to remove the F-Curve from the action */
-	if (!BLI_remlink_safe(&act->groups, agrp)) {
-		BKE_reportf(reports, RPT_ERROR, "ActionGroup '%s' not found in action '%s'", agrp->name, act->id.name + 2);
+	if (BLI_remlink_safe(&act->groups, agrp) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Action group '%s' not found in action '%s'", agrp->name, act->id.name + 2);
 		return;
 	}
 
 	/* move every one one of the group's F-Curves out into the Action again */
 	for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) {
 		fcn = fcu->next;
-		
+
 		/* remove from group */
 		action_groups_remove_channel(act, fcu);
-		
+
 		/* tack onto the end */
 		BLI_addtail(&act->curves, fcu);
 	}
-	
-	/* XXX, invalidates PyObject */
+
 	MEM_freeN(agrp);
+	RNA_POINTER_INVALIDATE(agrp_ptr);
 }
 
 static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path,
@@ -112,17 +118,19 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const ch
 	return verify_fcurve(act, group, NULL, data_path, index, 1);
 }
 
-static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu)
+static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr)
 {
+	FCurve *fcu = fcu_ptr->data;
 	if (fcu->grp) {
 		if (BLI_findindex(&act->groups, fcu->grp) == -1) {
-			BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'",
+			BKE_reportf(reports, RPT_ERROR, "F-Curve's action group '%s' not found in action '%s'",
 			            fcu->grp->name, act->id.name + 2);
 			return;
 		}
 		
 		action_groups_remove_channel(act, fcu);
 		free_fcurve(fcu);
+		RNA_POINTER_INVALIDATE(fcu_ptr);
 	}
 	else {
 		if (BLI_findindex(&act->curves, fcu) == -1) {
@@ -132,6 +140,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *
 		
 		BLI_remlink(&act->curves, fcu);
 		free_fcurve(fcu);
+		RNA_POINTER_INVALIDATE(fcu_ptr);
 	}
 }
 
@@ -145,15 +154,16 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
 	return marker;
 }
 
-static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker)
+static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr)
 {
-	if (!BLI_remlink_safe(&act->markers, marker)) {
-		BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in Action '%s'", marker->name, act->id.name + 2);
+	TimeMarker *marker = marker_ptr->data;
+	if (BLI_remlink_safe(&act->markers, marker) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2);
 		return;
 	}
 
-	/* XXX, invalidates PyObject */
 	MEM_freeN(marker);
+	RNA_POINTER_INVALIDATE(marker_ptr);
 }
 
 static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr)
@@ -185,8 +195,7 @@ static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min,
 	bAction *act = (bAction *)ptr->data;
 
 	*min = 0;
-	*max = BLI_countlist(&act->markers) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&act->markers) - 1);
 }
 
 
@@ -256,15 +265,14 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 
 	srna = RNA_def_struct(brna, "DopeSheet", NULL);
 	RNA_def_struct_sdna(srna, "bDopeSheet");
-	RNA_def_struct_ui_text(srna, "DopeSheet", "Settings for filtering the channels shown in Animation Editors");
+	RNA_def_struct_ui_text(srna, "DopeSheet", "Settings for filtering the channels shown in animation editors");
 	
 	/* Source of DopeSheet data */
 	/* XXX: make this obsolete? */
 	prop = RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ID");
 	RNA_def_property_ui_text(prop, "Source",
-	                         "ID-Block representing source data, currently ID_SCE (for Dopesheet), "
-	                         "and ID_SC (for Grease Pencil)");
+	                         "ID-Block representing source data, usually ID_SCE (i.e. Scene)");
 	
 	/* Show datablock filters */
 	prop = RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
@@ -283,22 +291,29 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 	
 	prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_INCL_HIDDEN);
-	RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
+	RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that are not visible");
 	RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
+	/* Debug Filtering Settings */
+	prop = RNA_def_property(srna, "show_only_errors", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLY_ERRORS);
+	RNA_def_property_ui_text(prop, "Show Errors", "Only include F-Curves and drivers that are disabled or have errors");
+	RNA_def_property_ui_icon(prop, ICON_HELP, 0); /* XXX: this doesn't quite fit */
+	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+	
 	/* Object Group Filtering Settings */
 	prop = RNA_def_property(srna, "show_only_group_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);
 	RNA_def_property_ui_text(prop, "Only Objects in Group",
-	                         "Only include channels from Objects in the specified Group");
+	                         "Only include channels from objects in the specified group");
 	RNA_def_property_ui_icon(prop, ICON_GROUP, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "filter_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Filtering Group", "Group that included Object should be a member of");
+	RNA_def_property_ui_text(prop, "Filtering Group", "Group that included object should be a member of");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	/* FCurve Display Name Search Settings */
@@ -318,21 +333,21 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
 	RNA_def_property_ui_text(prop, "Include Missing NLA",
-	                         "Include Animation Data blocks with no NLA data (NLA Editor only)");
+	                         "Include animation data blocks with no NLA data (NLA editor only)");
 	RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	/* Summary Settings (DopeSheet editors only) */
 	prop = RNA_def_property(srna, "show_summary", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY);
-	RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line (DopeSheet Editors only)");
+	RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line (DopeSheet editors only)");
 	RNA_def_property_ui_icon(prop, ICON_BORDERMOVE, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
 	RNA_def_property_ui_text(prop, "Collapse Summary",
-	                         "Collapse summary when shown, so all other channels get hidden (DopeSheet Editors Only)");
+	                         "Collapse summary when shown, so all other channels get hidden (DopeSheet editors only)");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	
@@ -340,97 +355,97 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOOBJ);
 	RNA_def_property_ui_text(prop, "Display Transforms",
-	                         "Include visualization of Object-level Animation data (mostly Transforms)");
+	                         "Include visualization of object-level animation data (mostly transforms)");
 	RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0); /* XXX? */
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_shapekeys", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSHAPEKEYS);
-	RNA_def_property_ui_text(prop, "Display Shapekeys", "Include visualization of ShapeKey related Animation data");
+	RNA_def_property_ui_text(prop, "Display Shapekeys", "Include visualization of shape key related animation data");
 	RNA_def_property_ui_icon(prop, ICON_SHAPEKEY_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_meshes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMESH);
-	RNA_def_property_ui_text(prop, "Display Meshes", "Include visualization of Mesh related Animation data");
+	RNA_def_property_ui_text(prop, "Display Meshes", "Include visualization of mesh related animation data");
 	RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_lattices", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAT);
-	RNA_def_property_ui_text(prop, "Display Lattices", "Include visualization of Lattice related Animation data");
+	RNA_def_property_ui_text(prop, "Display Lattices", "Include visualization of lattice related animation data");
 	RNA_def_property_ui_icon(prop, ICON_LATTICE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCAM);
-	RNA_def_property_ui_text(prop, "Display Camera", "Include visualization of Camera related Animation data");
+	RNA_def_property_ui_text(prop, "Display Camera", "Include visualization of camera related animation data");
 	RNA_def_property_ui_icon(prop, ICON_CAMERA_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_materials", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMAT);
-	RNA_def_property_ui_text(prop, "Display Material", "Include visualization of Material related Animation data");
+	RNA_def_property_ui_text(prop, "Display Material", "Include visualization of material related animation data");
 	RNA_def_property_ui_icon(prop, ICON_MATERIAL_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_lamps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAM);
-	RNA_def_property_ui_text(prop, "Display Lamp", "Include visualization of Lamp related Animation data");
+	RNA_def_property_ui_text(prop, "Display Lamp", "Include visualization of lamp related animation data");
 	RNA_def_property_ui_icon(prop, ICON_LAMP_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
-	RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of Texture related Animation data");
+	RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of texture related animation data");
 	RNA_def_property_ui_icon(prop, ICON_TEXTURE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_curves", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCUR);
-	RNA_def_property_ui_text(prop, "Display Curve", "Include visualization of Curve related Animation data");
+	RNA_def_property_ui_text(prop, "Display Curve", "Include visualization of curve related animation data");
 	RNA_def_property_ui_icon(prop, ICON_CURVE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_worlds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOWOR);
-	RNA_def_property_ui_text(prop, "Display World", "Include visualization of World related Animation data");
+	RNA_def_property_ui_text(prop, "Display World", "Include visualization of world related animation data");
 	RNA_def_property_ui_icon(prop, ICON_WORLD_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_scenes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSCE);
-	RNA_def_property_ui_text(prop, "Display Scene", "Include visualization of Scene related Animation data");
+	RNA_def_property_ui_text(prop, "Display Scene", "Include visualization of scene related animation data");
 	RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOPART);
-	RNA_def_property_ui_text(prop, "Display Particle", "Include visualization of Particle related Animation data");
+	RNA_def_property_ui_text(prop, "Display Particle", "Include visualization of particle related animation data");
 	RNA_def_property_ui_icon(prop, ICON_PARTICLE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_metaballs", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMBA);
-	RNA_def_property_ui_text(prop, "Display Metaball", "Include visualization of Metaball related Animation data");
+	RNA_def_property_ui_text(prop, "Display Metaball", "Include visualization of metaball related animation data");
 	RNA_def_property_ui_icon(prop, ICON_META_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOARM);
-	RNA_def_property_ui_text(prop, "Display Armature", "Include visualization of Armature related Animation data");
+	RNA_def_property_ui_text(prop, "Display Armature", "Include visualization of armature related animation data");
 	RNA_def_property_ui_icon(prop, ICON_ARMATURE_DATA, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NONTREE);
-	RNA_def_property_ui_text(prop, "Display Node", "Include visualization of Node related Animation data");
+	RNA_def_property_ui_text(prop, "Display Node", "Include visualization of node related animation data");
 	RNA_def_property_ui_icon(prop, ICON_NODETREE, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 
 	prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSPK);
-	RNA_def_property_ui_text(prop, "Display Speaker", "Include visualization of Speaker related Animation data");
+	RNA_def_property_ui_text(prop, "Display Speaker", "Include visualization of speaker related animation data");
 	RNA_def_property_ui_icon(prop, ICON_SPEAKER, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 }
@@ -467,17 +482,17 @@ static void rna_def_action_group(BlenderRNA *brna)
 	
 	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_SELECTED);
-	RNA_def_property_ui_text(prop, "Select", "Action Group is selected");
+	RNA_def_property_ui_text(prop, "Select", "Action group is selected");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
 	
 	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_PROTECTED);
-	RNA_def_property_ui_text(prop, "Lock", "Action Group is locked");
+	RNA_def_property_ui_text(prop, "Lock", "Action group is locked");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_EXPANDED);
-	RNA_def_property_ui_text(prop, "Expanded", "Action Group is expanded");
+	RNA_def_property_ui_text(prop, "Expanded", "Action group is expanded");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
 	/* color set */
@@ -510,7 +525,8 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove action group");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
@@ -541,7 +557,8 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove action group");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
@@ -569,14 +586,15 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a timeline marker");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 	
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "TimelineMarker");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get",
 	                               "rna_Action_active_pose_marker_set", NULL, NULL);
-	RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this Action");
+	RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this action");
 	
 	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_marker");
@@ -599,7 +617,7 @@ static void rna_def_action(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "curves", NULL);
 	RNA_def_property_struct_type(prop, "FCurve");
-	RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the Action");
+	RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the action");
 	rna_def_action_fcurves(brna, prop);
 	
 	prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
@@ -611,7 +629,7 @@ static void rna_def_action(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
 	RNA_def_property_struct_type(prop, "TimelineMarker");
-	RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses");
+	RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this action, for labeling poses");
 	rna_def_action_pose_markers(brna, prop);
 	
 	/* properties */
@@ -626,8 +644,8 @@ static void rna_def_action(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "idroot");
 	RNA_def_property_enum_items(prop, id_type_items);
 	RNA_def_property_ui_text(prop, "ID Root Type",
-	                         "Type of ID-block that action can be used on - "
-	                         "DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING");
+	                         "Type of ID block that action can be used on - "
+	                         "DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING");
 	
 	/* API calls */
 	RNA_api_action(srna);
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b1fdfcc..b653289 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -973,13 +973,13 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
 	RNA_def_property_range(prop, 0.0, 2.0);
 	RNA_def_property_ui_text(prop, "Volume", "Initial volume of the sound");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Pitch", "Pitch of the sound");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
 	/* floats - 3D Parameters */
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index d50cb66..7229ddd 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -54,6 +54,8 @@ EnumPropertyItem keyingset_path_grouping_items[] = {
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_math_base.h"
+
 #include "BKE_animsys.h"
 #include "BKE_fcurve.h"
 #include "BKE_nla.h"
@@ -296,6 +298,43 @@ static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value)
 
 /* ****************************** */
 
+static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value)
+{
+	KeyingSet *ks = (KeyingSet *)ptr->data;
+	
+	/* update names of corresponding groups if name changes */
+	if (strcmp(ks->name, value)) {
+		KS_Path *ksp;
+		
+		for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
+			if ((ksp->groupmode == KSP_GROUP_KSNAME) && (ksp->id)) {
+				AnimData *adt = BKE_animdata_from_id(ksp->id);
+				
+				/* TODO: NLA strips? */
+				if (adt && adt->action) {
+					bActionGroup *agrp;
+					
+					/* lazy check - should really find the F-Curve for the affected path and check its group 
+					 * but this way should be faster and work well for most cases, as long as there are no
+					 * conflicts
+					 */
+					for (agrp = adt->action->groups.first; agrp; agrp = agrp->next) {
+						if (strcmp(ks->name, agrp->name) == 0) {
+							/* there should only be one of these in the action, so can stop... */
+							BLI_strncpy(agrp->name, value, sizeof(agrp->name));
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+	
+	/* finally, update name to new value */
+	BLI_strncpy(ks->name, value, sizeof(ks->name));
+}
+
+
 static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
 {
 	KeyingSet *ks = (KeyingSet *)ptr->data;
@@ -334,8 +373,7 @@ static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, i
 	KeyingSet *ks = (KeyingSet *)ptr->data;
 
 	*min = 0;
-	*max = BLI_countlist(&ks->paths) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&ks->paths) - 1);
 }
 
 static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr)
@@ -369,27 +407,30 @@ static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *report
 		keyingset->active_path = BLI_countlist(&keyingset->paths);
 	}
 	else {
-		BKE_report(reports, RPT_ERROR, "Keying Set Path could not be added");
+		BKE_report(reports, RPT_ERROR, "Keying set path could not be added");
 	}
 	
 	/* return added path */
 	return ksp;
 }
 
-static void rna_KeyingSet_paths_remove(KeyingSet *keyingset, ReportList *reports, KS_Path *ksp)
+static void rna_KeyingSet_paths_remove(KeyingSet *keyingset, ReportList *reports, PointerRNA *ksp_ptr)
 {
+	KS_Path *ksp = ksp_ptr->data;
+
 	/* if data is valid, call the API function for this */
-	if (keyingset && ksp) {
-		/* remove the active path from the KeyingSet */
-		BKE_keyingset_free_path(keyingset, ksp);
-			
-		/* the active path number will most likely have changed */
-		/* TODO: we should get more fancy and actually check if it was removed, but this will do for now */
-		keyingset->active_path = 0;
-	}
-	else {
-		BKE_report(reports, RPT_ERROR, "Keying Set Path could not be removed");
+	if ((keyingset && ksp) == FALSE) {
+		BKE_report(reports, RPT_ERROR, "Keying set path could not be removed");
+		return;
 	}
+
+	/* remove the active path from the KeyingSet */
+	BKE_keyingset_free_path(keyingset, ksp);
+	RNA_POINTER_INVALIDATE(ksp_ptr);
+
+	/* the active path number will most likely have changed */
+	/* TODO: we should get more fancy and actually check if it was removed, but this will do for now */
+	keyingset->active_path = 0;
 }
 
 static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
@@ -408,7 +449,7 @@ static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
 		keyingset->active_path = 0;
 	}
 	else {
-		BKE_report(reports, RPT_ERROR, "Keying Set Paths could not be removed");
+		BKE_report(reports, RPT_ERROR, "Keying set paths could not be removed");
 	}
 }
 
@@ -422,9 +463,17 @@ static NlaTrack *rna_NlaTrack_new(AnimData *adt, bContext *C, NlaTrack *track)
 	return new_track;
 }
 
-static void rna_NlaTrack_remove(AnimData *adt, bContext *C, NlaTrack *track)
+static void rna_NlaTrack_remove(AnimData *adt, bContext *C, ReportList *reports, PointerRNA *track_ptr)
 {
+	NlaTrack *track = track_ptr->data;
+
+	if (BLI_findindex(&adt->nla_tracks, track) == -1) {
+		BKE_reportf(reports, RPT_ERROR, "NlaTrack '%s' cannot be removed", track->name);
+		return;
+	}
+
 	free_nlatrack(&adt->nla_tracks, track);
+	RNA_POINTER_INVALIDATE(track_ptr);
 
 	WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
 }
@@ -448,7 +497,7 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
 {
 	/* verify that we've got a driver to duplicate */
 	if (ELEM(NULL, src_driver, src_driver->driver)) {
-		BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
+		BKE_report(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
 		return NULL;
 	}
 	else {
@@ -678,7 +727,8 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* path to remove */
 	parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 
 	/* Remove All Paths */
@@ -709,19 +759,20 @@ static void rna_def_keyingset(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "KeyingSet", NULL);
 	RNA_def_struct_ui_text(srna, "Keying Set", "Settings that should be keyframed together");
 	
-	/* Id/Label. */
+	/* Id/Label */
 	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "idname");
 	RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP);
 	RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
-	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
+/*	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL); */ /* NOTE: disabled, as ID name shouldn't be editable */
 	
 	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_KeyingSet_name_set");
 	RNA_def_property_ui_text(prop, "UI Name", "");
 	RNA_def_struct_ui_icon(srna, ICON_KEYINGSET);
 	RNA_def_struct_name_property(srna, prop);
-/*	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_RENAME, NULL);*/
+	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
 	
 	prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
 	RNA_def_property_string_sdna(prop, NULL, "description");
@@ -783,10 +834,11 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_return(func, parm);
 	
 	func = RNA_def_function(srna, "remove", "rna_NlaTrack_remove");
-	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Remove a NLA Track");
 	parm = RNA_def_pointer(func, "track", "NlaTrack", "", "NLA Track to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "NlaTrack");
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
index 39128b4..492659f 100644
--- a/source/blender/makesrna/intern/rna_animation_api.c
+++ b/source/blender/makesrna/intern/rna_animation_api.c
@@ -56,11 +56,11 @@ static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList
 	if (success != 0) {
 		switch (success) {
 			case MODIFYKEY_INVALID_CONTEXT:
-				BKE_report(reports, RPT_ERROR, "Invalid context for Keying Set");
+				BKE_report(reports, RPT_ERROR, "Invalid context for keying set");
 				break;
 				
 			case MODIFYKEY_MISSING_TYPEINFO:
-				BKE_report(reports, RPT_ERROR, "Incomplete built-in Keying Set. Appears to be missing type info");
+				BKE_report(reports, RPT_ERROR, "Incomplete built-in keying set, appears to be missing type info");
 				break;
 		}
 	}
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index ceadaa0..4c566d7 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -29,6 +29,7 @@
 
 #include "BLI_math.h"
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -103,25 +104,27 @@ static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value)
 static EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
 {
 	if (arm->edbo == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant add an editbone", arm->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in edit mode, cannot add an editbone", arm->id.name + 2);
 		return NULL;
 	}
 	return ED_armature_edit_bone_add(arm, name);
 }
 
-static void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone *ebone)
+static void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, PointerRNA *ebone_ptr)
 {
+	EditBone *ebone = ebone_ptr->data;
 	if (arm->edbo == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone", arm->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in edit mode, cannot remove an editbone", arm->id.name + 2);
 		return;
 	}
 
 	if (BLI_findindex(arm->edbo, ebone) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Armature '%s' doesn't contain bone '%s'", arm->id.name + 2, ebone->name);
+		BKE_reportf(reports, RPT_ERROR, "Armature '%s' does not contain bone '%s'", arm->id.name + 2, ebone->name);
 		return;
 	}
 
 	ED_armature_edit_bone_remove(arm, ebone);
+	RNA_POINTER_INVALIDATE(ebone_ptr);
 }
 
 static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
@@ -564,7 +567,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
 	if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
 	else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	RNA_def_property_float_sdna(prop, NULL, "rad_head");
-	/* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+	/* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
 	/*RNA_def_property_range(prop, 0, 1000); */
 	RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
@@ -573,7 +576,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
 	if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
 	else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	RNA_def_property_float_sdna(prop, NULL, "rad_tail");
-	/* XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); */
+	/* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
 	/*RNA_def_property_range(prop, 0, 1000); */
 	RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
@@ -865,7 +868,8 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
 	/* target to remove*/
 	parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 2a6ea29..3da718a 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -80,6 +80,8 @@ EnumPropertyItem boidruleset_type_items[] = {
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_math_base.h"
+
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_particle.h"
@@ -157,8 +159,7 @@ static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min
 {
 	BoidState *state = (BoidState *)ptr->data;
 	*min = 0;
-	*max = BLI_countlist(&state->rules) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&state->rules) - 1);
 }
 
 static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
@@ -224,8 +225,7 @@ static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int
 {
 	BoidSettings *boids = (BoidSettings *)ptr->data;
 	*min = 0;
-	*max = BLI_countlist(&boids->states) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&boids->states) - 1);
 }
 
 static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
@@ -436,7 +436,7 @@ static void rna_def_boidrule(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "On Land", "Use rule when boid is on land");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 	
-	/*prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */
+	/*prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */
 	/*RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); */
 	/*RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); */
 
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index e96ed4f..7bdebd6 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -146,8 +146,8 @@ static int rna_SculptCapabilities_has_overlay_get(PointerRNA *ptr)
 {
 	Brush *br = (Brush *)ptr->data;
 	return ELEM(br->mtex.brush_map_mode,
-				MTEX_MAP_MODE_VIEW,
-				MTEX_MAP_MODE_TILED);
+	            MTEX_MAP_MODE_VIEW,
+	            MTEX_MAP_MODE_TILED);
 }
 
 static int rna_SculptCapabilities_has_persistence_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index ad926d6..b72bba0 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -258,7 +258,7 @@ void RNA_def_camera(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWTITLESAFE);
-	RNA_def_property_ui_text(prop, "Show Title Safe", "Show indicators for the title safe zone in Camera view");
+	RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe zones in Camera view");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
 
 	prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 5f1ce4f..b9e86e1 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -419,41 +419,41 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shear");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Shear Stiffness", "Shear spring stiffness");
 #endif
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_shear");
 	RNA_def_property_range(prop, 0.0f, upperLimitf);
 	RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value");
 #endif
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "eff_force_scale");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Effector Force Scale", "");
 #endif
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Effector Wind Scale", "");
 #endif
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING);
 	RNA_def_property_ui_text(prop, "Tearing", "");
 #endif
 	/* unused still */
 #if 0
-	prop= RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxspringlen");
 	RNA_def_property_range(prop, 1.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 7fb4a1d..5752fd3 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -45,6 +45,7 @@
 #include "DNA_material_types.h"
 #include "DNA_movieclip_types.h"
 #include "DNA_node_types.h"
+#include "DNA_sequence_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -53,6 +54,7 @@
 #include "BKE_image.h"
 #include "BKE_movieclip.h"
 #include "BKE_node.h"
+#include "BKE_sequencer.h"
 #include "BKE_texture.h"
 
 #include "ED_node.h"
@@ -314,7 +316,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
 	}
 }
 
-void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
+static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
 {
 	do_colorband(coba, position, color);
 }
@@ -329,12 +331,27 @@ static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *repo
 	return element;
 }
 
-static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, CBData *element)
+static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, PointerRNA *element_ptr)
 {
+	CBData *element = element_ptr->data;
 	int index = (int)(element - coba->data);
-	if (colorband_element_remove(coba, index) == 0)
+	if (colorband_element_remove(coba, index) == FALSE) {
 		BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
+		return;
+	}
+
+	RNA_POINTER_INVALIDATE(element_ptr);
+}
+
+void rna_CurveMap_remove_point(CurveMap *cuma, ReportList *reports, PointerRNA *point_ptr)
+{
+	CurveMapPoint *point = point_ptr->data;
+	if (curvemap_remove_point(cuma, point) == FALSE) {
+		BKE_report(reports, RPT_ERROR, "Unable to remove curve point");
+		return;
+	}
 
+	RNA_POINTER_INVALIDATE(point_ptr);
 }
 
 static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -474,14 +491,55 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain)
 	if (GS(id->name) == ID_IM) {
 		Image *ima = (Image *) id;
 
-		BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+		DAG_id_tag_update(&ima->id, 0);
+
+		BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
+
 		WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+		WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
 	}
 	else if (GS(id->name) == ID_MC) {
 		MovieClip *clip = (MovieClip *) id;
 
 		BKE_movieclip_reload(clip);
+
+		/* all sequencers for now, we don't know which scenes are using this clip as a strip */
+		BKE_sequencer_cache_cleanup();
+		BKE_sequencer_preprocessed_cache_cleanup();
+
 		WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
+		WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id);
+	}
+	else if (GS(id->name) == ID_SCE) {
+		Scene *scene = (Scene *) id;
+
+		if (scene->ed) {
+			ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *) ptr->data;
+			Sequence *seq;
+			int seq_found = FALSE;
+
+			if (&scene->sequencer_colorspace_settings != colorspace_settings) {
+				SEQ_BEGIN(scene->ed, seq);
+				{
+					if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
+						seq_found = TRUE;
+						break;
+					}
+				}
+				SEQ_END;
+			}
+
+			if (seq_found) {
+				BKE_sequence_invalidate_cache(scene, seq);
+				BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
+			}
+			else {
+				BKE_sequencer_cache_cleanup();
+				BKE_sequencer_preprocessed_cache_cleanup();
+			}
+
+			WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+		}
 	}
 }
 
@@ -553,10 +611,12 @@ static void rna_def_curvemap_points_api(BlenderRNA *brna, PropertyRNA *cprop)
 	parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "New point");
 	RNA_def_function_return(func, parm);
 
-	func = RNA_def_function(srna, "remove", "curvemap_remove_point");
+	func = RNA_def_function(srna, "remove", "rna_CurveMap_remove_point");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Delete point from CurveMap");
 	parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "PointElement to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_curvemap(BlenderRNA *brna)
@@ -705,7 +765,8 @@ static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Delete element from ColorRamp");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_color_ramp(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index f2454a2..30a9bfd 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -614,7 +614,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
-	RNA_def_property_range(prop, 1, 10000);
+	RNA_def_property_range(prop, 0, 10000);
 	RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
 	RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
 
@@ -703,11 +703,6 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
 	RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
 
-	prop = RNA_def_property(srna, "use_target", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO);
-	RNA_def_property_ui_text(prop, "Target", "Disable for targetless IK");
-	RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
 	prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
 	RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
@@ -2422,7 +2417,7 @@ void RNA_def_constraint(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "rot_error");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Rot error",
-	                         "Amount of residual error in radiant for constraints that work on orientation");
+	                         "Amount of residual error in radians for constraints that work on orientation");
 
 	/* pointers */
 	rna_def_constrainttarget(brna);
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index aef1f76..c59e376 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -240,7 +240,7 @@ void RNA_def_controller(BlenderRNA *brna)
 	/* State */
 	
 	/* array of OB_MAX_STATES */
-	/*prop= RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER); */
+	/*prop = RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER); */
 	/*RNA_def_property_array(prop, OB_MAX_STATES); */
 	/*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	/*RNA_def_property_ui_text(prop, "", "Set Controller state index (1 to 30)"); */
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index d7e59f3..21aed20 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -62,9 +63,9 @@ EnumPropertyItem keyframe_handle_type_items[] = {
 };
 
 EnumPropertyItem beztriple_interpolation_mode_items[] = {
-	{BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
-	{BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""},
-	{BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
+	{BEZT_IPO_CONST, "CONSTANT", 0, "Constant", "No interpolation, value of A gets held until B is encountered"},
+	{BEZT_IPO_LIN, "LINEAR", 0, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"},
+	{BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", "Smooth interpolation between A and B, with some control over curve shape"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -241,16 +242,14 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max,
 {
 	Curve *cu = (Curve *)ptr->id.data;
 	*min = 0;
-	*max = cu->totcol - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, cu->totcol - 1);
 }
 
 static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
 	Curve *cu = (Curve *)ptr->id.data;
 	*min = 0;
-	*max = cu->totbox - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, cu->totbox - 1);
 }
 
 
@@ -511,7 +510,7 @@ static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
 static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, int number)
 {
 	if (nu->type == CU_BEZIER) {
-		BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added");
+		BKE_report(reports, RPT_ERROR, "Bezier spline cannot have points added");
 	}
 	else if (number == 0) {
 		/* do nothing */
@@ -573,20 +572,18 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
 	return nu;
 }
 
-static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
+static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, PointerRNA *nu_ptr)
 {
-	int found = 0;
+	Nurb *nu = nu_ptr->data;
 	ListBase *nurbs = BKE_curve_nurbs_get(cu);
 
-	found = BLI_remlink_safe(nurbs, nu);
-
-	if (!found) {
-		BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name + 2);
+	if (BLI_remlink_safe(nurbs, nu) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Curve '%s' does not contain spline given", cu->id.name + 2);
 		return;
 	}
 
 	BKE_nurb_free(nu);
-	/* invalidate pointer!, no can do */
+	RNA_POINTER_INVALIDATE(nu_ptr);
 
 	DAG_id_tag_update(&cu->id, OB_RECALC_DATA);
 	WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
@@ -1109,7 +1106,7 @@ static void rna_def_charinfo(BlenderRNA *brna)
 	
 	/* probably there is no reason to expose this */
 #if 0
-	prop= RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_WRAP);
 	RNA_def_property_ui_text(prop, "Wrap", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */
@@ -1167,11 +1164,12 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
 
 #if 0
-	func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+	func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
 	RNA_def_function_ui_description(func, "Remove a spline from a curve");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 #endif
 }
 
@@ -1198,7 +1196,8 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a spline from a curve");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 #endif
 }
 
@@ -1227,7 +1226,8 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a spline from a curve");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
 	RNA_def_function_ui_description(func, "Remove all spline from a curve");
@@ -1422,6 +1422,11 @@ static void rna_def_curve(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
+	prop = RNA_def_property(srna, "use_map_taper", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_MAP_TAPER);
+	RNA_def_property_ui_text(prop, "Map Taper", "Map effect of taper object on actually beveled curve");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
 	/* texture space */
 	prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 45092d0..bb1ecea 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -42,10 +42,23 @@
 #include "BLI_listbase.h"
 #include "BLI_ghash.h"
 
+#include "BLF_translation.h"
+
 #include "RNA_define.h"
 
 #include "rna_internal.h"
 
+
+#ifdef DEBUG
+#  define ASSERT_SOFT_HARD_LIMITS \
+	if (softmin < hardmin || softmax > hardmax) { \
+		fprintf(stderr, "Error with soft/hard limits: %s.%s\n", CONTAINER_RNA_ID(cont), identifier); \
+		BLI_assert(!"invalid soft/hard limits"); \
+	} (void)0
+#else
+#  define  ASSERT_SOFT_HARD_LIMITS (void)0
+#endif
+
 /* Global used during defining */
 
 BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
@@ -887,7 +900,7 @@ void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
 
 PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
 {
-	/*StructRNA *srna= DefRNA.laststruct;*/ /* invalid for python defined props */
+	/*StructRNA *srna = DefRNA.laststruct;*/ /* invalid for python defined props */
 	ContainerRNA *cont = cont_;
 	ContainerDefRNA *dcont;
 	PropertyDefRNA *dprop = NULL;
@@ -968,8 +981,10 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
 			sprop->defaultvalue = "";
 			break;
 		}
-		case PROP_ENUM:
 		case PROP_POINTER:
+			prop->flag |= PROP_THICK_WRAP;  /* needed for default behavior when PROP_RNAPTR is set */
+			break;
+		case PROP_ENUM:
 		case PROP_COLLECTION:
 			break;
 		default:
@@ -2248,12 +2263,15 @@ PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *iden
 	return prop;
 }
 
-PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin,
-                         int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value,
+                         int hardmin, int hardmax, const char *ui_name, const char *ui_description,
+                         int softmin, int softmax)
 {
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
 	RNA_def_property_int_default(prop, default_value);
 	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
@@ -2270,6 +2288,8 @@ PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifi
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_INT, PROP_XYZ); /* XXX */
 	if (len != 0) RNA_def_property_array(prop, len);
 	if (default_value) RNA_def_property_int_array_default(prop, default_value);
@@ -2287,6 +2307,8 @@ PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifie
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
 	if (len != 0) RNA_def_property_array(prop, len);
 	if (default_value) RNA_def_property_int_array_default(prop, default_value);
@@ -2426,6 +2448,8 @@ PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, f
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_default(prop, default_value);
 	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
@@ -2442,6 +2466,8 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identi
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_XYZ);
 	if (len != 0) RNA_def_property_array(prop, len);
 	if (default_value) RNA_def_property_float_array_default(prop, default_value);
@@ -2472,6 +2498,8 @@ PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identif
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_COLOR);
 	if (len != 0) RNA_def_property_array(prop, len);
 	if (default_value) RNA_def_property_float_array_default(prop, default_value);
@@ -2489,10 +2517,9 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identi
 {
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
-	int length[2];
+	const int length[2] = {rows, columns};
 
-	length[0] = rows;
-	length[1] = columns;
+	ASSERT_SOFT_HARD_LIMITS;
 
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_multi_array(prop, 2, length);
@@ -2510,7 +2537,9 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *iden
 {
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
-	
+
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len != 0) ? PROP_EULER : PROP_ANGLE);
 	if (len != 0) {
 		RNA_def_property_array(prop, len);
@@ -2534,6 +2563,8 @@ PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identif
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
 	if (len != 0) RNA_def_property_array(prop, len);
 	if (default_value) RNA_def_property_float_array_default(prop, default_value);
@@ -2551,6 +2582,8 @@ PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *id
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE);
 	RNA_def_property_float_default(prop, default_value);
 	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
@@ -2567,6 +2600,8 @@ PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identi
 	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
+	ASSERT_SOFT_HARD_LIMITS;
+
 	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_default(prop, default_value);
 	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
@@ -2777,14 +2812,26 @@ int rna_parameter_size(PropertyRNA *parm)
 			{
 #ifdef RNA_RUNTIME
 				if (parm->flag & PROP_RNAPTR)
-					return sizeof(PointerRNA);
+					if (parm->flag & PROP_THICK_WRAP) {
+						return sizeof(PointerRNA);
+					}
+					else {
+						return sizeof(PointerRNA *);
+					}
 				else
 					return sizeof(void *);
 #else
-				if (parm->flag & PROP_RNAPTR)
-					return sizeof(PointerRNA);
-				else
+				if (parm->flag & PROP_RNAPTR) {
+					if (parm->flag & PROP_THICK_WRAP) {
+						return sizeof(PointerRNA);
+					}
+					else {
+						return sizeof(PointerRNA *);
+					}
+				}
+				else {
 					return sizeof(void *);
+				}
 #endif
 			}
 			case PROP_COLLECTION:
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index d899b58..4250acf 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -409,14 +409,16 @@ static DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
 	return driver_add_new_variable(driver);
 }
 
-static void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, DriverVar *dvar)
+static void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, PointerRNA *dvar_ptr)
 {
+	DriverVar *dvar = dvar_ptr->data;
 	if (BLI_findindex(&driver->variables, dvar) == -1) {
 		BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver");
 		return;
 	}
 
 	driver_free_variable(driver, dvar);
+	RNA_POINTER_INVALIDATE(dvar_ptr);
 }
 
 
@@ -438,13 +440,16 @@ static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
 	return add_fmodifier(&fcu->modifiers, type);
 }
 
-static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModifier *fcm)
+static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, PointerRNA *fcm_ptr)
 {
+	FModifier *fcm = fcm_ptr->data;
 	if (BLI_findindex(&fcu->modifiers, fcm) == -1) {
 		BKE_reportf(reports, RPT_ERROR, "F-Curve modifier '%s' not found in F-Curve", fcm->name);
 		return;
 	}
+
 	remove_fmodifier(&fcu->modifiers, fcm);
+	RNA_POINTER_INVALIDATE(fcm_ptr);
 }
 
 static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value))
@@ -610,8 +615,9 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
 	}
 }
 
-static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast)
+static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, int do_fast)
 {
+	BezTriple *bezt = bezt_ptr->data;
 	int index = (int)(bezt - fcu->bezt);
 	if (index < 0 || index >= fcu->totvert) {
 		BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve");
@@ -619,6 +625,7 @@ static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTri
 	}
 
 	delete_fcurve_key(fcu, index, !do_fast);
+	RNA_POINTER_INVALIDATE(bezt_ptr);
 }
 
 static void rna_fcurve_range(FCurve *fcu, float range[2])
@@ -1263,7 +1270,8 @@ static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* target to remove */
 	parm = RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_channeldriver(BlenderRNA *brna)
@@ -1458,7 +1466,8 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a modifier from this F-Curve");
 	/* modifier to remove */
 	parm = RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 /* fcurve.keyframe_points */
@@ -1503,7 +1512,8 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove keyframe from an F-Curve");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Keyframe to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 	/* optional */
 	RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
 }
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index daa6611..84ff53e 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -699,7 +699,7 @@ void RNA_def_fluidsim(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation");
 	RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type");
 
-	/*prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
+	/*prop = RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
 	/*RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by fluid simulation settings"); */
 
 	/* types */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index b0fcfb9..b3c1f4d 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -162,14 +163,16 @@ static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame)
 	return stroke;
 }
 
-static void rna_GPencil_stroke_remove(bGPDframe *frame, ReportList *reports, bGPDstroke *stroke)
+static void rna_GPencil_stroke_remove(bGPDframe *frame, ReportList *reports, PointerRNA *stroke_ptr)
 {
+	bGPDstroke *stroke = stroke_ptr->data;
 	if (BLI_findindex(&frame->strokes, stroke) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
+		BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
 		return;
 	}
-	
+
 	BLI_freelinkN(&frame->strokes, stroke);
+	RNA_POINTER_INVALIDATE(stroke_ptr);
 
 	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }
@@ -179,7 +182,7 @@ static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, i
 	bGPDframe *frame;
 
 	if (BKE_gpencil_layer_find_frame(layer, frame_number)) {
-		BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number");
+		BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number);
 		return NULL;
 	}
 
@@ -190,14 +193,16 @@ static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, i
 	return frame;
 }
 
-static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, bGPDframe *frame)
+static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, PointerRNA *frame_ptr)
 {
+	bGPDframe *frame = frame_ptr->data;
 	if (BLI_findindex(&layer->frames, frame) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Frame not found in grease pencil layer");
+		BKE_report(reports, RPT_ERROR, "Frame not found in grease pencil layer");
 		return;
 	}
-	
+
 	gpencil_layer_delframe(layer, frame);
+	RNA_POINTER_INVALIDATE(frame_ptr);
 
 	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }
@@ -226,14 +231,16 @@ static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, int seta
 	return gl;
 }
 
-static void rna_GPencil_layer_remove(bGPdata *gpd, ReportList *reports, bGPDlayer *layer)
+static void rna_GPencil_layer_remove(bGPdata *gpd, ReportList *reports, PointerRNA *layer_ptr)
 {
+	bGPDlayer *layer = layer_ptr->data;
 	if (BLI_findindex(&gpd->layers, layer) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Layer not found in grease pencil data");
+		BKE_report(reports, RPT_ERROR, "Layer not found in grease pencil data");
 		return;
 	}
-	
+
 	gpencil_layer_delete(gpd, layer);
+	RNA_POINTER_INVALIDATE(layer_ptr);
 
 	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 }
@@ -327,7 +334,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
 	RNA_def_property_collection_sdna(prop, NULL, "points", "totpoints");
 	RNA_def_property_struct_type(prop, "GPencilStrokePoint");
 	RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
-	rna_def_gpencil_stroke_points_api(brna, prop);	
+	rna_def_gpencil_stroke_points_api(brna, prop);
 
 	prop = RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
@@ -357,7 +364,8 @@ static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a grease pencil frame");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The stroke to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_gpencil_frame(BlenderRNA *brna)
@@ -376,7 +384,7 @@ static void rna_def_gpencil_frame(BlenderRNA *brna)
 	RNA_def_property_collection_sdna(prop, NULL, "strokes", NULL);
 	RNA_def_property_struct_type(prop, "GPencilStroke");
 	RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
-	rna_def_gpencil_strokes_api(brna, prop);	
+	rna_def_gpencil_strokes_api(brna, prop);
 
 	/* Frame Number */
 	prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
@@ -421,7 +429,8 @@ static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a grease pencil frame");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "frame", "GPencilFrame", "Frame", "The frame to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "copy", "rna_GPencil_frame_copy");
 	RNA_def_function_ui_description(func, "Copy a grease pencil frame");
@@ -558,7 +567,7 @@ static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
 
 	func = RNA_def_function(srna, "new", "rna_GPencil_layer_new");
 	RNA_def_function_ui_description(func, "Add a new grease pencil layer");
-	parm = 	RNA_def_string(func, "name", "GPencilLayer", MAX_NAME, "Name", "Name of the layer");
+	parm = RNA_def_string(func, "name", "GPencilLayer", MAX_NAME, "Name", "Name of the layer");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "set_active", 0, "Set Active", "Set the newly created layer to the active layer");
 	parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The newly created layer");
@@ -568,7 +577,8 @@ static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a grease pencil layer");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 586b71a..4baf46f 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -54,7 +54,7 @@ static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter)
 static void rna_Group_objects_link(Group *group, bContext *C, ReportList *reports, Object *object)
 {
 	if (!add_to_group(group, object, CTX_data_scene(C), NULL)) {
-		BKE_reportf(reports, RPT_ERROR, "Object \"%s\" already in group \"%s\"", object->id.name + 2, group->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' already in group '%s'", object->id.name + 2, group->id.name + 2);
 		return;
 	}
 
@@ -64,7 +64,7 @@ static void rna_Group_objects_link(Group *group, bContext *C, ReportList *report
 static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *reports, Object *object)
 {
 	if (!rem_from_group(group, object, CTX_data_scene(C), NULL)) {
-		BKE_reportf(reports, RPT_ERROR, "Object \"%s\" not in group \"%s\"", object->id.name + 2, group->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' not in group '%s'", object->id.name + 2, group->id.name + 2);
 		return;
 	}
 
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index a77e93f..9fedbee 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -113,7 +113,7 @@ static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 			BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 	}
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 }
 
 static void rna_Image_free_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -150,7 +150,7 @@ static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *
 static char *rna_ImageUser_path(PointerRNA *ptr)
 {
 	if (ptr->id.data) {
-		/* ImageUser *iuser= ptr->data; */
+		/* ImageUser *iuser = ptr->data; */
 		
 		switch (GS(((ID *)ptr->id.data)->name)) {
 			case ID_TE:
@@ -187,8 +187,12 @@ static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA
 static int rna_Image_file_format_get(PointerRNA *ptr)
 {
 	Image *image = (Image *)ptr->data;
-	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
-	return BKE_ftype_to_imtype(ibuf ? ibuf->ftype : 0);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
+	int imtype = BKE_ftype_to_imtype(ibuf ? ibuf->ftype : 0);
+
+	BKE_image_release_ibuf(image, ibuf, NULL);
+
+	return imtype;
 }
 
 static void rna_Image_file_format_set(PointerRNA *ptr, int value)
@@ -199,12 +203,13 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value)
 		int ftype = BKE_imtype_to_ftype(value);
 
 #if 0
-		ibuf = BKE_image_get_ibuf(image, NULL);
+		ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 		if (ibuf)
 			ibuf->ftype = ftype;
 #endif
 
 		/* to be safe change all buffer file types */
+		/* TODO: this is never threadsafe */
 		for (ibuf = image->ibufs.first; ibuf; ibuf = ibuf->next) {
 			ibuf->ftype = ftype;
 		}
@@ -237,7 +242,7 @@ static void rna_Image_size_get(PointerRNA *ptr, int *values)
 		values[1] = 0;
 	}
 
-	BKE_image_release_ibuf(im, lock);
+	BKE_image_release_ibuf(im, ibuf, lock);
 }
 
 static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
@@ -256,7 +261,7 @@ static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
 		values[1] = 0;
 	}
 
-	BKE_image_release_ibuf(im, lock);
+	BKE_image_release_ibuf(im, ibuf, lock);
 }
 
 static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
@@ -271,7 +276,7 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
 		ibuf->ppm[1] = values[1];
 	}
 
-	BKE_image_release_ibuf(im, lock);
+	BKE_image_release_ibuf(im, ibuf, lock);
 }
 
 static int rna_Image_depth_get(PointerRNA *ptr)
@@ -290,7 +295,7 @@ static int rna_Image_depth_get(PointerRNA *ptr)
 	else
 		planes = ibuf->planes;
 
-	BKE_image_release_ibuf(im, lock);
+	BKE_image_release_ibuf(im, ibuf, lock);
 
 	return planes;
 }
@@ -317,7 +322,7 @@ static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY
 	else
 		length[0] = 0;
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 
 	return length[0];
 }
@@ -343,7 +348,7 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
 		}
 	}
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 }
 
 static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
@@ -366,10 +371,10 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
 				((unsigned char *)ibuf->rect)[i] = FTOCHAR(values[i]);
 		}
 
-		ibuf->userflags |= IB_BITMAPDIRTY;
+		ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;
 	}
 
-	BKE_image_release_ibuf(ima, lock);
+	BKE_image_release_ibuf(ima, ibuf, lock);
 }
 
 #else
@@ -388,23 +393,27 @@ static void rna_def_imageuser(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
 	RNA_def_property_ui_text(prop, "Auto Refresh", "Always refresh image on frame changes");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	/* animation */
 	prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
 	RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "frames");
 	RNA_def_property_range(prop, 0, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "offset");
 	RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "sfra");
@@ -412,12 +421,14 @@ static void rna_def_imageuser(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Start Frame",
 	                         "Global starting frame of the movie/sequence, assuming first picture has a #1");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	prop = RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "fie_ima");
 	RNA_def_property_range(prop, 1, 200);
 	RNA_def_property_ui_text(prop, "Fields per Frame", "Number of fields per rendered frame (2 fields is 1 image)");
 	RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "layer");
@@ -499,7 +510,8 @@ static void rna_def_image(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS);
 	RNA_def_property_ui_text(prop, "Fields", "Use fields of the image");
 	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_fields_update");
-
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	
 	prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL);
 	RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
@@ -528,23 +540,27 @@ static void rna_def_image(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, image_generated_type_items);
 	RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
 	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
-
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	
 	prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gen_x");
 	RNA_def_property_range(prop, 1, 16384);
 	RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
 	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
-
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	
 	prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gen_y");
 	RNA_def_property_range(prop, 1, 16384);
 	RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
 	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
-
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	
 	prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
 	RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer");
 	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
 	/* realtime properties */
 	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 7766dff..686e6c8 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -80,7 +80,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
 		ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
 
 		if (ibuf == NULL) {
-			BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image");
+			BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
 		}
 		else {
 			ImBuf *write_ibuf;
@@ -92,23 +92,23 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
 			write_ibuf->dither = scene->r.dither_intensity;
 
 			if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
-				BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
+				BKE_reportf(reports, RPT_ERROR, "Could not write image '%s'", path);
 			}
 
 			if (write_ibuf != ibuf)
 				IMB_freeImBuf(write_ibuf);
 		}
 
-		BKE_image_release_ibuf(image, lock);
+		BKE_image_release_ibuf(image, ibuf, lock);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
+		BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
 	}
 }
 
 static void rna_Image_save(Image *image, ReportList *reports)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 	if (ibuf) {
 		char filename[FILE_MAX];
 		BLI_strncpy(filename, image->name, sizeof(filename));
@@ -116,7 +116,7 @@ static void rna_Image_save(Image *image, ReportList *reports)
 
 		if (image->packedfile) {
 			if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
-				BKE_reportf(reports, RPT_ERROR, "Image \"%s\" could saved packed file to \"%s\"", image->id.name + 2, image->name);
+				BKE_reportf(reports, RPT_ERROR, "Image '%s' could not save packed file to '%s'", image->id.name + 2, image->name);
 			}
 		}
 		else if (IMB_saveiff(ibuf, filename, ibuf->flags)) {
@@ -130,20 +130,22 @@ static void rna_Image_save(Image *image, ReportList *reports)
 			ibuf->userflags &= ~IB_BITMAPDIRTY;
 		}
 		else {
-			BKE_reportf(reports, RPT_ERROR, "Image \"%s\" could not be saved to \"%s\"", image->id.name + 2, image->name);
+			BKE_reportf(reports, RPT_ERROR, "Image '%s' could not be saved to '%s'", image->id.name + 2, image->name);
 		}
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
 	}
+
+	BKE_image_release_ibuf(image, ibuf, NULL);
 }
 
 static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 
 	if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
-		BKE_reportf(reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG");
+		BKE_report(reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
 	}
 	else {
 		if (as_png) {
@@ -153,6 +155,8 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
 			image->packedfile = newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id));
 		}
 	}
+
+	BKE_image_release_ibuf(image, ibuf, NULL);
 }
 
 static void rna_Image_unpack(Image *image, ReportList *reports, int method)
@@ -177,20 +181,25 @@ static void rna_Image_reload(Image *image)
 
 static void rna_Image_update(Image *image, ReportList *reports)
 {
-	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
+	ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 
 	if (ibuf == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
 		return;
 	}
 
-	IMB_rect_from_float(ibuf);
+	if (ibuf->rect)
+		IMB_rect_from_float(ibuf);
+
+	ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+
+	BKE_image_release_ibuf(image, ibuf, NULL);
 }
 
 static void rna_Image_scale(Image *image, ReportList *reports, int width, int height)
 {
 	if (!BKE_image_scale(image, width, height)) {
-		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
 	}
 }
 
@@ -203,10 +212,11 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
 	if (*bind)
 		return error;
 
-	ibuf = BKE_image_get_ibuf(image, NULL);
+	ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 
 	if (ibuf == NULL || ibuf->rect == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
+		BKE_image_release_ibuf(image, ibuf, NULL);
 		return (int)GL_INVALID_OPERATION;
 	}
 
@@ -235,6 +245,8 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
 		image->bindcode = 0;
 	}
 
+	BKE_image_release_ibuf(image, ibuf, NULL);
+
 	return error;
 }
 
@@ -297,9 +309,9 @@ void RNA_api_image(StructRNA *srna)
 	func = RNA_def_function(srna, "scale", "rna_Image_scale");
 	RNA_def_function_ui_description(func, "Scale the image in pixels");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm = RNA_def_int(func, "width", 0, 1, 10000, "", "Width", 1, 10000);
+	parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_int(func, "height", 0, 1, 10000, "", "Height", 1, 10000);
+	parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index ffc78ef..6520f22 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -407,19 +407,8 @@ int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct Poi
 
 
 /* Internal functions that cycles uses so we need to declare (tsk tsk) */
-struct Mesh *rna_Object_to_mesh(struct Object *ob, struct ReportList *reports, struct Scene *sce, int apply_modifiers, int settings);
-void rna_Main_meshes_remove(struct Main *bmain, struct ReportList *reports, struct Mesh *mesh);
-void rna_Object_create_duplilist(struct Object *ob, struct ReportList *reports, struct Scene *sce, int settings);
-void rna_Object_free_duplilist(struct Object *ob);
 void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values);
 void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
-int  rna_Object_is_modified(struct Object *ob, struct Scene *scene, int settings);
-int  rna_Object_is_deform_modified(struct Object *ob, struct Scene *scene, int settings);
-void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4]);
-void rna_Scene_frame_set(struct Scene *scene, int frame, float subframe);
-
-void engine_tag_redraw(struct RenderEngine *engine);
-void engine_tag_update(struct RenderEngine *engine);
 
 #endif /* __RNA_INTERNAL_H__ */
 
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 9d63e0e..af39500 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -421,7 +421,7 @@ static void rna_def_lamp(BlenderRNA *brna)
 	
 	/* textures */
 	rna_def_mtex_common(brna, srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
-	                    "rna_Lamp_active_texture_set", NULL, "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update");
+	                    "rna_Lamp_active_texture_set", NULL, "LampTextureSlot", "LampTextureSlots", "rna_Lamp_draw_update");
 }
 
 static void rna_def_lamp_falloff(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 74b3c43..04b8d2f 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -51,7 +51,7 @@ static int rna_Main_is_dirty_get(PointerRNA *ptr)
 	/* XXX, not totally nice to do it this way, should store in main ? */
 	Main *bmain = (Main *)ptr->data;
 	wmWindowManager *wm;
-	for (wm = bmain->wm.first; wm; wm = wm->id.next) {
+	if ((wm = bmain->wm.first)) {
 		return !wm->file_saved;
 	}
 
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index cd9b396..cf9415a 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -97,45 +97,51 @@
 
 #include "ED_screen.h"
 
+#include "BLF_translation.h"
+
 static Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
 {
 	ID *id = BKE_camera_add(name);
 	id_us_min(id);
 	return (Camera *)id;
 }
-static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
+static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA *camera_ptr)
 {
-	if (ID_REAL_USERS(camera) <= 0)
+	Camera *camera = camera_ptr->data;
+	if (ID_REAL_USERS(camera) <= 0) {
 		BKE_libblock_free(&bmain->camera, camera);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(camera_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Camera '%s' must have zero users to be removed, found %d",
 		            camera->id.name + 2, ID_REAL_USERS(camera));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
 {
 	return BKE_scene_add(name);
 }
-static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
+static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr)
 {
 	/* don't call BKE_libblock_free(...) directly */
-	Scene *newscene;
+	Scene *scene = scene_ptr->data;
+	Scene *scene_new;
+
+	if ((scene_new = scene->id.prev) ||
+	    (scene_new = scene->id.next))
+	{
+		bScreen *sc = CTX_wm_screen(C);
+		if (sc->scene == scene) {
+			ED_screen_set_scene(C, sc, scene_new);
+		}
 
-	if (scene->id.prev)
-		newscene = scene->id.prev;
-	else if (scene->id.next)
-		newscene = scene->id.next;
+		BKE_scene_unlink(bmain, scene, scene_new);
+		RNA_POINTER_INVALIDATE(scene_ptr);
+	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed", scene->id.name + 2);
-		return;
+		BKE_reportf(reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
 	}
-
-	if (CTX_wm_screen(C)->scene == scene)
-		ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
-
-	BKE_scene_unlink(bmain, scene, newscene);
 }
 
 static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
@@ -149,7 +155,7 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
 				type = OB_MESH;
 				break;
 			case ID_CU:
-				type = BKE_curve_type_get((struct Curve *)data);
+				type = BKE_curve_type_get((Curve *)data);
 				break;
 			case ID_MB:
 				type = OB_MBALL;
@@ -175,7 +181,7 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
 				if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
 					idname = "UNKNOWN";
 
-				BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object", idname);
+				BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
 				return NULL;
 			}
 		}
@@ -192,14 +198,16 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
 	return ob;
 }
 
-static void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
+static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA *object_ptr)
 {
+	Object *object = object_ptr->data;
 	if (ID_REAL_USERS(object) <= 0) {
 		BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
 		BKE_libblock_free(&bmain->object, object);
+		RNA_POINTER_INVALIDATE(object_ptr);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d",
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' must have zero users to be removed, found %d",
 		            object->id.name + 2, ID_REAL_USERS(object));
 	}
 }
@@ -210,15 +218,17 @@ static Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(id);
 	return (Material *)id;
 }
-static void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
+static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerRNA *material_ptr)
 {
-	if (ID_REAL_USERS(material) <= 0)
+	Material *material = material_ptr->data;
+	if (ID_REAL_USERS(material) <= 0) {
 		BKE_libblock_free(&bmain->mat, material);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(material_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Material '%s' must have zero users to be removed, found %d",
 		            material->id.name + 2, ID_REAL_USERS(material));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
@@ -228,15 +238,17 @@ static bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, i
 	id_us_min(&tree->id);
 	return tree;
 }
-static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
+static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRNA *tree_ptr)
 {
-	if (ID_REAL_USERS(tree) <= 0)
+	bNodeTree *tree = tree_ptr->data;
+	if (ID_REAL_USERS(tree) <= 0) {
 		BKE_libblock_free(&bmain->nodetree, tree);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(tree_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Node tree '%s' must have zero users to be removed, found %d",
 		            tree->id.name + 2, ID_REAL_USERS(tree));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
@@ -245,15 +257,17 @@ static Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&me->id);
 	return me;
 }
-void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
+static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr)
 {
-	if (ID_REAL_USERS(mesh) <= 0)
+	Mesh *mesh = mesh_ptr->data;
+	if (ID_REAL_USERS(mesh) <= 0) {
 		BKE_libblock_free(&bmain->mesh, mesh);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(mesh_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Mesh '%s' must have zero users to be removed, found %d",
 		            mesh->id.name + 2, ID_REAL_USERS(mesh));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
@@ -263,15 +277,17 @@ static Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
 	id_us_min(&lamp->id);
 	return lamp;
 }
-static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
+static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *lamp_ptr)
 {
-	if (ID_REAL_USERS(lamp) <= 0)
+	Lamp *lamp = lamp_ptr->data;
+	if (ID_REAL_USERS(lamp) <= 0) {
 		BKE_libblock_free(&bmain->lamp, lamp);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(lamp_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Lamp '%s' must have zero users to be removed, found %d",
 		            lamp->id.name + 2, ID_REAL_USERS(lamp));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
@@ -288,21 +304,24 @@ static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, con
 	errno = 0;
 	ima = BKE_image_load(filepath);
 
-	if (!ima)
-		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
-		            errno ? strerror(errno) : "Unsupported image format");
+	if (!ima) {
+		BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
+		            errno ? strerror(errno) : TIP_("unsupported image format"));
+	}
 
 	return ima;
 }
-static void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
+static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA *image_ptr)
 {
-	if (ID_REAL_USERS(image) <= 0)
+	Image *image = image_ptr->data;
+	if (ID_REAL_USERS(image) <= 0) {
 		BKE_libblock_free(&bmain->image, image);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(image_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Image '%s' must have zero users to be removed, found %d",
 		            image->id.name + 2, ID_REAL_USERS(image));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
@@ -311,13 +330,17 @@ static Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&lt->id);
 	return lt;
 }
-static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
+static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRNA *lt_ptr)
 {
-	if (ID_REAL_USERS(lt) <= 0)
+	Lattice *lt = lt_ptr->data;
+	if (ID_REAL_USERS(lt) <= 0) {
 		BKE_libblock_free(&bmain->latt, lt);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(lt_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Lattice '%s' must have zero users to be removed, found %d",
 		            lt->id.name + 2, ID_REAL_USERS(lt));
+	}
 }
 
 static Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
@@ -326,13 +349,17 @@ static Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int typ
 	id_us_min(&cu->id);
 	return cu;
 }
-static void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
+static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA *cu_ptr)
 {
-	if (ID_REAL_USERS(cu) <= 0)
+	Curve *cu = cu_ptr->data;
+	if (ID_REAL_USERS(cu) <= 0) {
 		BKE_libblock_free(&bmain->curve, cu);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(cu_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Curve '%s' must have zero users to be removed, found %d",
 		            cu->id.name + 2, ID_REAL_USERS(cu));
+	}
 }
 
 static MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
@@ -341,13 +368,17 @@ static MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&mb->id);
 	return mb;
 }
-static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
+static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerRNA *mb_ptr)
 {
-	if (ID_REAL_USERS(mb) <= 0)
+	MetaBall *mb = mb_ptr->data;
+	if (ID_REAL_USERS(mb) <= 0) {
 		BKE_libblock_free(&bmain->mball, mb);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(mb_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Metaball '%s' must have zero users to be removed, found %d",
 		            mb->id.name + 2, ID_REAL_USERS(mb));
+	}
 }
 
 static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
@@ -358,21 +389,23 @@ static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *
 	font = BKE_vfont_load(bmain, filepath);
 
 	if (!font)
-		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
-		            errno ? strerror(errno) : "Unsupported font format");
+		BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
+		            errno ? strerror(errno) : TIP_("unsupported font format"));
 
 	return font;
 
 }
-static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
+static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, PointerRNA *vfont_ptr)
 {
-	if (ID_REAL_USERS(vfont) <= 0)
+	VFont *vfont = vfont_ptr->data;
+	if (ID_REAL_USERS(vfont) <= 0) {
 		BKE_libblock_free(&bmain->vfont, vfont);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(vfont_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Font '%s' must have zero users to be removed, found %d",
 		            vfont->id.name + 2, ID_REAL_USERS(vfont));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
@@ -382,13 +415,17 @@ static Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int typ
 	id_us_min(&tex->id);
 	return tex;
 }
-static void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
+static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRNA *tex_ptr)
 {
-	if (ID_REAL_USERS(tex) <= 0)
+	Tex *tex = tex_ptr->data;
+	if (ID_REAL_USERS(tex) <= 0) {
 		BKE_libblock_free(&bmain->tex, tex);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(tex_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Texture '%s' must have zero users to be removed, found %d",
 		            tex->id.name + 2, ID_REAL_USERS(tex));
+	}
 }
 
 static Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
@@ -397,13 +434,17 @@ static Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&brush->id);
 	return brush;
 }
-static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
+static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr)
 {
-	if (ID_REAL_USERS(brush) <= 0)
+	Brush *brush = brush_ptr->data;
+	if (ID_REAL_USERS(brush) <= 0) {
 		BKE_libblock_free(&bmain->brush, brush);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(brush_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Brush '%s' must have zero users to be removed, found %d",
 		            brush->id.name + 2, ID_REAL_USERS(brush));
+	}
 }
 
 static World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
@@ -412,24 +453,29 @@ static World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&world->id);
 	return world;
 }
-static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
+static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA *world_ptr)
 {
-	if (ID_REAL_USERS(world) <= 0)
+	Group *world = world_ptr->data;
+	if (ID_REAL_USERS(world) <= 0) {
 		BKE_libblock_free(&bmain->world, world);
-	else
-		BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(world_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "World '%s' must have zero users to be removed, found %d",
 		            world->id.name + 2, ID_REAL_USERS(world));
+	}
 }
 
 static Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
 {
 	return add_group(name);
 }
-static void rna_Main_groups_remove(Main *bmain, Group *group)
+static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr)
 {
+	Group *group = group_ptr->data;
 	BKE_group_unlink(group);
 	BKE_libblock_free(&bmain->group, group);
-	/* XXX python now has invalid pointer? */
+	RNA_POINTER_INVALIDATE(group_ptr);
 }
 
 static Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
@@ -438,26 +484,29 @@ static Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&speaker->id);
 	return speaker;
 }
-static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker)
+static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRNA *speaker_ptr)
 {
-	if (ID_REAL_USERS(speaker) <= 0)
+	Speaker *speaker = speaker_ptr->data;
+	if (ID_REAL_USERS(speaker) <= 0) {
 		BKE_libblock_free(&bmain->speaker, speaker);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(speaker_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Speaker '%s' must have zero users to be removed, found %d",
 		            speaker->id.name + 2, ID_REAL_USERS(speaker));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
 {
 	return BKE_text_add(name);
 }
-static void rna_Main_texts_remove(Main *bmain, Text *text)
+static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr)
 {
+	Text *text = text_ptr->data;
 	BKE_text_unlink(bmain, text);
 	BKE_libblock_free(&bmain->text, text);
-	/* XXX python now has invalid pointer? */
+	RNA_POINTER_INVALIDATE(text_ptr);
 }
 
 static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath)
@@ -468,8 +517,8 @@ static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *f
 	txt = BKE_text_load(filepath, bmain->name);
 
 	if (!txt)
-		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
-		            errno ? strerror(errno) : "Unable to load text");
+		BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
+		            errno ? strerror(errno) : TIP_("unable to load text"));
 
 	return txt;
 }
@@ -480,15 +529,17 @@ static bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
 	id_us_min(&arm->id);
 	return arm;
 }
-static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
+static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerRNA *arm_ptr)
 {
-	if (ID_REAL_USERS(arm) <= 0)
+	bArmature *arm = arm_ptr->data;
+	if (ID_REAL_USERS(arm) <= 0) {
 		BKE_libblock_free(&bmain->armature, arm);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(arm_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Armature '%s' must have zero users to be removed, found %d",
 		            arm->id.name + 2, ID_REAL_USERS(arm));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
@@ -498,15 +549,17 @@ static bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
 	act->id.flag &= ~LIB_FAKEUSER;
 	return act;
 }
-static void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
+static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA *act_ptr)
 {
-	if (ID_REAL_USERS(act) <= 0)
+	bAction *act = act_ptr->data;
+	if (ID_REAL_USERS(act) <= 0) {
 		BKE_libblock_free(&bmain->action, act);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(act_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Action '%s' must have zero users to be removed, found %d",
 		            act->id.name + 2, ID_REAL_USERS(act));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
@@ -515,15 +568,17 @@ static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
 	id_us_min(&part->id);
 	return part;
 }
-static void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
+static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerRNA *part_ptr)
 {
-	if (ID_REAL_USERS(part) <= 0)
+	ParticleSettings *part = part_ptr->data;
+	if (ID_REAL_USERS(part) <= 0) {
 		BKE_libblock_free(&bmain->particle, part);
-	else
-		BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
+		RNA_POINTER_INVALIDATE(part_ptr);
+	}
+	else {
+		BKE_reportf(reports, RPT_ERROR, "Particle settings '%s' must have zero users to be removed, found %d",
 		            part->id.name + 2, ID_REAL_USERS(part));
-
-	/* XXX python now has invalid pointer? */
+	}
 }
 
 static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
@@ -534,17 +589,18 @@ static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *repor
 	clip = BKE_movieclip_file_add(filepath);
 
 	if (!clip)
-		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
-		            errno ? strerror(errno) : "Unable to load movie clip");
+		BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
+		            errno ? strerror(errno) : TIP_("unable to load movie clip"));
 
 	return clip;
 }
 
-static void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
+static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr)
 {
+	MovieClip *clip = clip_ptr->data;
 	BKE_movieclip_unlink(bmain, clip);
 	BKE_libblock_free(&bmain->movieclip, clip);
-	/* XXX python now has invalid pointer? */
+	RNA_POINTER_INVALIDATE(clip_ptr);
 }
 
 static Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
@@ -556,24 +612,25 @@ static Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
 	return mask;
 }
 
-static void rna_Main_masks_remove(Main *bmain, Mask *mask)
+static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr)
 {
+	Mask *mask = mask_ptr->data;
 	BKE_mask_free(bmain, mask);
 	BKE_libblock_free(&bmain->mask, mask);
-	/* XXX python now has invalid pointer? */
+	RNA_POINTER_INVALIDATE(mask_ptr);
 }
 
-static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, bGPdata *gpd)
+static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, PointerRNA *gpd_ptr)
 {
+	bGPdata *gpd = gpd_ptr->data;
 	if (ID_REAL_USERS(gpd) <= 0) {
 		BKE_gpencil_free(gpd);
 		BKE_libblock_free(&bmain->gpencil, gpd);
+		RNA_POINTER_INVALIDATE(gpd_ptr);
 	}
 	else
-		BKE_reportf(reports, RPT_ERROR, "Grease Pencil \"%s\" must have zero users to be removed, found %d",
+		BKE_reportf(reports, RPT_ERROR, "Grease pencil '%s' must have zero users to be removed, found %d",
 		            gpd->id.name + 2, ID_REAL_USERS(gpd));
-
-	/* XXX python now has invalid pointer? */
 }
 
 /* tag functions, all the same */
@@ -679,7 +736,8 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
 	parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -714,7 +772,8 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
 	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -753,7 +812,8 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -788,7 +848,8 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
 	parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -831,7 +892,8 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
 	parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -865,7 +927,8 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
 	parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -901,7 +964,8 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile");
 	parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -990,9 +1054,9 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Add a new image to the main database");
 	parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 0, INT_MAX);
+	parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 0, INT_MAX);
+	parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
 	RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
@@ -1013,7 +1077,8 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
 	parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1048,7 +1113,8 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
 	parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1084,7 +1150,8 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
 	parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1118,7 +1185,8 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
 	parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1153,7 +1221,8 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
 	parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1189,7 +1258,8 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
 	parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1223,7 +1293,8 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
 	parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1258,7 +1329,8 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
 	parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1292,7 +1364,8 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "remove", "rna_Main_groups_remove");
 	RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
 	parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1327,7 +1400,8 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
 	parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1361,7 +1435,8 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "remove", "rna_Main_texts_remove");
 	RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
 	parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* load func */
 	func = RNA_def_function(srna, "load", "rna_Main_texts_load");
@@ -1429,7 +1504,8 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
 	parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1463,7 +1539,8 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
 	parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1497,7 +1574,8 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
 	parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
 	parm = RNA_def_boolean(func, "value", 0, "Value", "");
@@ -1536,7 +1614,8 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a grease pencil instance from the current blendfile");
 	parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1561,7 +1640,8 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
 	RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
 	parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* load func */
 	func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
@@ -1592,7 +1672,7 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
 	/* new func */
 	func = RNA_def_function(srna, "new", "rna_Main_mask_new");
 	RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
-	parm = RNA_def_string_file_path(func, "name", "", MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
+	RNA_def_string_file_path(func, "name", "", MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
 	/* return type */
 	parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask datablock");
 	RNA_def_function_return(func, parm);
@@ -1601,7 +1681,8 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "remove", "rna_Main_masks_remove");
 	RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
 	parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 97d9cc9..3f23a37 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -158,8 +158,7 @@ static void rna_Mask_layer_active_index_range(PointerRNA *ptr, int *min, int *ma
 	Mask *mask = (Mask *)ptr->id.data;
 
 	*min = 0;
-	*max = mask->masklay_tot - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, mask->masklay_tot - 1);
 
 	*softmin = *min;
 	*softmax = *max;
@@ -315,14 +314,16 @@ static MaskLayer *rna_Mask_layers_new(Mask *mask, const char *name)
 	return masklay;
 }
 
-static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, MaskLayer *masklay)
+static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
 {
+	MaskLayer *masklay = masklay_ptr->data;
 	if (BLI_findindex(&mask->masklayers, masklay) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "MaskLayer '%s' not found in mask '%s'", masklay->name, mask->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Mask layer '%s' not found in mask '%s'", masklay->name, mask->id.name + 2);
 		return;
 	}
 
 	BKE_mask_layer_remove(mask, masklay);
+	RNA_POINTER_INVALIDATE(masklay_ptr);
 
 	WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
 }
@@ -705,7 +706,9 @@ static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove layer from this mask");
-	RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
+	parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* clear all layers */
 	func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 96529de..1221b84 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -81,12 +81,14 @@ EnumPropertyItem ramp_blend_items[] = {
 #include "MEM_guardedalloc.h"
 
 #include "DNA_node_types.h"
+#include "DNA_object_types.h"
 
 #include "BKE_depsgraph.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_texture.h"
 #include "BKE_node.h"
+#include "BKE_paint.h"
 
 #include "ED_node.h"
 
@@ -105,7 +107,18 @@ static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *p
 	}
 }
 
-static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	Material *ma = ptr->id.data;
+	
+	if (ma->nodetree)
+		ntreeClearPreview(ma->nodetree);
+		
+	rna_Material_update(bmain, scene, ptr);
+}
+
+
+static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
 	Material *ma = ptr->id.data;
 
@@ -319,7 +332,7 @@ MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *re
 {
 	MTex *mtex = add_mtex_id(self_id, -1);
 	if (mtex == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "maximum number of textures added %d", MAX_MTEX);
+		BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
 		return NULL;
 	}
 
@@ -334,7 +347,7 @@ MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList
 	MTex *mtex;
 
 	if (index < 0 || index >= MAX_MTEX) {
-		BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+		BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
 		return NULL;
 	}
 
@@ -354,12 +367,12 @@ void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *r
 	give_active_mtex(self_id, &mtex_ar, &act);
 
 	if (mtex_ar == NULL) {
-		BKE_report(reports, RPT_ERROR, "mtex not found for this type");
+		BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
 		return;
 	}
 	
 	if (index < 0 || index >= MAX_MTEX) {
-		BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+		BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
 		return;
 	}
 
@@ -468,6 +481,12 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 	                         "from their parent");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
+	prop = RNA_def_property(srna, "use_map_to_bounds", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_MAPTO_BOUNDS);
+	RNA_def_property_ui_text(prop, "Map to Bounds",
+	                         "Map coordinates in object bounds");
+	RNA_def_property_update(prop, 0, "rna_Material_update");
+
 	prop = RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG);
 	RNA_def_property_ui_text(prop, "From Original",
@@ -1749,7 +1768,7 @@ void RNA_def_material(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "pr_type");
 	RNA_def_property_enum_items(prop, preview_type_items);
 	RNA_def_property_ui_text(prop, "Preview render type", "Type of preview render");
-	RNA_def_property_update(prop, 0, "rna_Material_update");
+	RNA_def_property_update(prop, 0, "rna_Material_update_previews");
 	
 	prop = RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "amb");
@@ -1817,7 +1836,12 @@ void RNA_def_material(BlenderRNA *brna)
 	                         "Material uses the light group exclusively - these lamps are excluded "
 	                         "from other scene lighting");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
-	
+
+	prop = RNA_def_property(srna, "use_light_group_local", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_GROUP_LOCAL);
+	RNA_def_property_ui_text(prop, "Light Group Local", "When linked in, material uses local light group with the same name");
+	RNA_def_property_update(prop, 0, "rna_Material_update");
+
 	prop = RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRACEBLE);
 	RNA_def_property_ui_text(prop, "Traceable",
@@ -2097,13 +2121,13 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
 		RNA_def_property_editable_func(prop, activeeditable);
 	RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
-	RNA_def_property_update(prop, 0, update);
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
 
 	prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "texact");
 	RNA_def_property_range(prop, 0, MAX_MTEX - 1);
 	RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
-	RNA_def_property_update(prop, 0, update);
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 59cf202..287995e 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1010,8 +1010,7 @@ static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *ma
 {
 	Mesh *me = rna_mesh(ptr);
 	*min = 0;
-	*max = me->totcol - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, me->totcol - 1);
 }
 
 static int rna_MeshVertex_index_get(PointerRNA *ptr)
@@ -1275,12 +1274,12 @@ static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bCo
 	int index;
 
 	if (me->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessface colors's in editmode");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessface colors in edit mode");
 		return PointerRNA_NULL;
 	}
 
 	if (me->mpoly) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessface colors's when MPoly's exist");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessface colors when MPoly's exist");
 		return PointerRNA_NULL;
 	}
 
@@ -1368,12 +1367,12 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bCont
 	int index;
 
 	if (me->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessface uv's in editmode");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessface uv's in edit mode");
 		return PointerRNA_NULL;
 	}
 
 	if (me->mpoly) {
-		BKE_report(reports, RPT_ERROR, "Can't add tessface uv's when MPoly's exist");
+		BKE_report(reports, RPT_ERROR, "Cannot add tessface uv's when MPoly's exist");
 		return PointerRNA_NULL;
 	}
 
@@ -2394,7 +2393,8 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a vertex color layer");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 #endif
 
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
@@ -2571,7 +2571,8 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a vertex color layer");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 #endif
 
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
@@ -2808,7 +2809,7 @@ static void rna_def_mesh(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
 	RNA_def_property_collection_funcs(prop, "rna_Mesh_skin_vertices_begin", NULL, NULL, NULL,
-									  "rna_Mesh_skin_vertices_length", NULL, NULL, NULL);
+	                                  "rna_Mesh_skin_vertices_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MeshSkinVertexLayer");
 	RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices");
 	rna_def_skin_vertices(brna, prop);
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index b63390c..1e75569 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -78,7 +78,7 @@ void RNA_api_mesh(StructRNA *srna)
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
 	func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
-	parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
+	RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	/* return value */
 	parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index c8b52b4..08eefc0 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
@@ -126,19 +127,17 @@ static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
 	return ml;
 }
 
-static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, MetaElem *ml)
+static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, PointerRNA *ml_ptr)
 {
-	int found = 0;
+	MetaElem *ml = ml_ptr->data;
 
-	found = BLI_remlink_safe(&mb->elems, ml);
-
-	if (!found) {
-		BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" does not contain spline given", mb->id.name + 2);
+	if (BLI_remlink_safe(&mb->elems, ml) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Metaball '%s' does not contain spline given", mb->id.name + 2);
 		return;
 	}
 
 	MEM_freeN(ml);
-	/* invalidate pointer!, no can do */
+	RNA_POINTER_INVALIDATE(ml_ptr);
 
 	/* cheating way for importers to avoid slow updates */
 	if (mb->id.us > 0) {
@@ -254,7 +253,8 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove an element from the metaball");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
 	RNA_def_function_ui_description(func, "Remove all elements from the metaball");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 1b26c04..a2b0945 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -78,12 +78,14 @@ EnumPropertyItem modifier_type_items[] = {
 	{eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
 	{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
 	{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
+	{eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
 	{0, "", 0, N_("Deform"), ""},
 	{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
 	{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
 	{eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
 	{eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
 	{eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
+	{eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Laplacian Smooth", ""},
 	{eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
 	{eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
 	{eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
@@ -210,6 +212,10 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
 			return &RNA_RemeshModifier;
 		case eModifierType_Skin:
 			return &RNA_SkinModifier;
+		case eModifierType_LaplacianSmooth:
+			return &RNA_LaplacianSmoothModifier;
+		case eModifierType_Triangulate:
+			return &RNA_TriangulateModifier;
 		default:
 			return &RNA_Modifier;
 	}
@@ -257,9 +263,6 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
 	Object *ob = (Object *)ptr->id.data;
-	ParticleSystemModifierData *psmd = NULL;
-	ParticleSystem *psys = NULL;
-	ParticleSettings *part = NULL;
 
 	/* nothing changed */
 	if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
@@ -273,28 +276,6 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 			ob->dt = OB_WIRE;
 			break;
 		case MOD_SMOKE_TYPE_FLOW:
-			for (psys = ob->particlesystem.first; psys; psys = psys->next)
-				if (psys->part->type == PART_EMITTER)
-					break;
-			if (ob->type == OB_MESH && !psys) {
-				/* add particle system */
-				psmd = (ParticleSystemModifierData *)object_add_particle_system(scene, ob, NULL);
-				if (psmd) {
-					psys = psmd->psys;
-					part = psys->part;
-					part->lifetime = 1.0f;
-					part->sta = 1.0f;
-					part->end = 250.0f;
-					part->ren_as = PART_DRAW_NOT;
-					part->flag |= PART_UNBORN;
-					part->draw_as = PART_DRAW_DOT;
-					BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name));
-					psys->recalc |= (PSYS_RECALC_RESET | PSYS_RECALC_PHYS);
-					DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
-				}
-			}
-			if (smd->flow)
-				smd->flow->psys = psys;
 		case MOD_SMOKE_TYPE_COLL:
 		case 0:
 		default:
@@ -384,6 +365,12 @@ static void rna_SmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
+static void rna_LaplacianSmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
+{
+	LaplacianSmoothModifierData *lmd = (LaplacianSmoothModifierData *)ptr->data;
+	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
+}
+
 static void rna_WaveModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
 	WaveModifierData *lmd = (WaveModifierData *)ptr->data;
@@ -402,6 +389,12 @@ static void rna_SolidifyModifier_vgroup_set(PointerRNA *ptr, const char *value)
 	rna_object_vgroup_name_set(ptr, value, smd->defgrp_name, sizeof(smd->defgrp_name));
 }
 
+static void rna_DecimateModifier_vgroup_set(PointerRNA *ptr, const char *value)
+{
+	DecimateModifierData *dmd = (DecimateModifierData *)ptr->data;
+	rna_object_vgroup_name_set(ptr, value, dmd->defgrp_name, sizeof(dmd->defgrp_name));
+}
+
 static void rna_WeightVGModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
 	ModifierData *md = (ModifierData *)ptr->data;
@@ -491,8 +484,7 @@ static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max
 	MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
 
 	*min = 0;
-	*max = mmd->totlvl; /* intentionally _not_ -1 */
-	*max = MAX2(0, *max);
+	*max = max_ii(0, mmd->totlvl);  /* intentionally _not_ -1 */
 }
 
 static int rna_MultiresModifier_external_get(PointerRNA *ptr)
@@ -1129,6 +1121,13 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
 
 static void rna_def_modifier_decimate(BlenderRNA *brna)
 {
+	static EnumPropertyItem modifier_decim_mode_items[] = {
+		{MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
+		{MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
+		{MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	StructRNA *srna;
 	PropertyRNA *prop;
 
@@ -1137,15 +1136,65 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "DecimateModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
 
+	prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "mode");
+	RNA_def_property_enum_items(prop, modifier_decim_mode_items);
+	RNA_def_property_ui_text(prop, "Mode", "");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	/* (mode == MOD_DECIM_MODE_COLLAPSE) */
 	prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "percent");
 	RNA_def_property_range(prop, 0, 1);
-	RNA_def_property_ui_range(prop, 0, 1, 1, 2);
-	RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to");
+	RNA_def_property_ui_range(prop, 0, 1, 1, 4);
+	RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	/* (mode == MOD_DECIM_MODE_UNSUBDIV) */
+	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "iter");
+	RNA_def_property_range(prop, 0, SHRT_MAX);
+	RNA_def_property_ui_range(prop, 0, 100, 1, 0);
+	RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	/* (mode == MOD_DECIM_MODE_DISSOLVE) */
+	prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
+	RNA_def_property_float_sdna(prop, NULL, "angle");
+	RNA_def_property_range(prop, 0, DEG2RAD(180));
+	RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
+	RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	/* (mode == MOD_DECIM_MODE_COLLAPSE) */
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_vgroup_set");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
+	RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
+	RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	/* end collapse-only option */
 
+	/* (mode == MOD_DECIM_MODE_DISSOLVE) */
+	prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
+	RNA_def_property_ui_text(prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	/* end dissolve-only option */
+
+
+
+	/* all modes use this */
 	prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "faceCount");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
 }
@@ -1742,6 +1791,64 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
+static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
+	RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
+	RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
+
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
+	RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
+	RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
+	RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
+	RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "lambda");
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.0000001, 1000.0, 0.0000001, 8);
+	RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "lambda_border");
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.0000001, 1000.0, 0.0000001, 8);
+	RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "repeat");
+	RNA_def_property_ui_range(prop, 0, 200, 1, 0);
+	RNA_def_property_ui_text(prop, "Repeat", "");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+	RNA_def_property_ui_text(prop, "Vertex Group",
+	                         "Name of Vertex Group which determines influence of modifier per point");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_vgroup_set");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
 static void rna_def_modifier_cast(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -2100,6 +2207,7 @@ static void rna_def_modifier_smoke(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_smoke_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
 }
 
@@ -2296,6 +2404,13 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+	prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "projLimit");
+	RNA_def_property_range(prop, 0.0, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0, 100, 1, 2);
+	RNA_def_property_ui_text(prop, "Project Limit", "Limit the distance used for projection (zero disables)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
 	prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
 	RNA_def_property_ui_text(prop, "X", "");
@@ -3250,6 +3365,22 @@ static void rna_def_modifier_skin(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
+static void rna_def_modifier_triangulate(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "TriangulateModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Triangulate Modifier", "Triangulate Mesh");
+	RNA_def_struct_sdna(srna, "TriangulateModifierData");
+	RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
+
+	prop = RNA_def_property(srna, "use_beauty", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_TRIANGULATE_BEAUTY);
+	RNA_def_property_ui_text(prop, "Beauty Subdivide", "Subdivide across shortest diagonal");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
 void RNA_def_modifier(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -3356,6 +3487,8 @@ void RNA_def_modifier(BlenderRNA *brna)
 	rna_def_modifier_ocean(brna);
 	rna_def_modifier_remesh(brna);
 	rna_def_modifier_skin(brna);
+	rna_def_modifier_laplaciansmooth(brna);
+	rna_def_modifier_triangulate(brna);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 4ff1365..574f06e 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -302,7 +303,7 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo
 	NlaStrip *strip = add_nlastrip(action);
 	
 	if (strip == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to create new strip");
+		BKE_report(reports, RPT_ERROR, "Unable to create new strip");
 		return NULL;
 	}
 	
@@ -310,8 +311,8 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo
 	strip->start = start;
 	
 	if (BKE_nlastrips_add_strip(&track->strips, strip) == 0) {
-		BKE_reportf(reports, RPT_ERROR,
-		            "Unable to add strip. Track doesn't have any space to accommodate this new strip");
+		BKE_report(reports, RPT_ERROR,
+		           "Unable to add strip (the track does not have any space to accommodate this new strip)");
 		free_nlastrip(NULL, strip);
 		return NULL;
 	}
@@ -345,16 +346,18 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo
 	return strip;
 }
 
-static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, NlaStrip *strip)
+static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, PointerRNA *strip_ptr)
 {
+	NlaStrip *strip = strip_ptr->data;
 	if (BLI_findindex(&track->strips, strip) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "NLA's Strip '%s' not found in track '%s'", strip->name, track->name);
+		BKE_reportf(reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name);
 		return;
 	}
-	else {
-		free_nlastrip(&track->strips, strip);
-		WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
-	}
+
+	free_nlastrip(&track->strips, strip);
+	RNA_POINTER_INVALIDATE(strip_ptr);
+
+	WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
 }
 
 /* Set the 'solo' setting for the given NLA-track, making sure that it is the only one
@@ -639,7 +642,8 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a NLA Strip");
 	parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "NLA Strip to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_nlatrack(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d650c8d..1da9a45 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -35,12 +35,16 @@
 #include "rna_internal_types.h"
 
 #include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
 
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_text_types.h"
 #include "DNA_texture_types.h"
 
 #include "BKE_animsys.h"
@@ -48,9 +52,9 @@
 #include "BKE_node.h"
 #include "BKE_image.h"
 #include "BKE_texture.h"
+#include "BKE_idprop.h"
 
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
+#include "IMB_imbuf.h"
 
 #include "WM_types.h"
 
@@ -71,12 +75,12 @@ EnumPropertyItem node_quality_items[] = {
 };
 
 EnumPropertyItem node_chunksize_items[] = {
-    {NTREE_CHUNCKSIZE_32,   "32",     0,    "32x32",     "Chunksize of 32x32"},
-    {NTREE_CHUNCKSIZE_64,   "64",     0,    "64x64",     "Chunksize of 64x64"},
-    {NTREE_CHUNCKSIZE_128,   "128",     0,    "128x128",     "Chunksize of 128x128"},
-    {NTREE_CHUNCKSIZE_256,   "256",     0,    "256x256",     "Chunksize of 256x256"},
-    {NTREE_CHUNCKSIZE_512,   "512",     0,    "512x512",     "Chunksize of 512x512"},
-    {NTREE_CHUNCKSIZE_1024,   "1024",     0,    "1024x1024",     "Chunksize of 1024x1024"},
+	{NTREE_CHUNCKSIZE_32,   "32",     0,    "32x32",     "Chunksize of 32x32"},
+	{NTREE_CHUNCKSIZE_64,   "64",     0,    "64x64",     "Chunksize of 64x64"},
+	{NTREE_CHUNCKSIZE_128,  "128",    0,    "128x128",   "Chunksize of 128x128"},
+	{NTREE_CHUNCKSIZE_256,  "256",    0,    "256x256",   "Chunksize of 256x256"},
+	{NTREE_CHUNCKSIZE_512,  "512",    0,    "512x512",   "Chunksize of 512x512"},
+	{NTREE_CHUNCKSIZE_1024, "1024",   0,    "1024x1024", "Chunksize of 1024x1024"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -88,6 +92,7 @@ EnumPropertyItem node_socket_type_items[] = {
 	{SOCK_BOOLEAN, "BOOLEAN",   0,    "Boolean",   ""},
 	{SOCK_MESH,    "MESH",      0,    "Mesh",      ""},
 	{SOCK_INT,     "INT",       0,    "Int",       ""},
+	{SOCK_STRING,  "STRING",    0,    "String",    ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -188,6 +193,10 @@ EnumPropertyItem prop_wave_items[] = {
     SUBTYPE(FLOAT, Float, TIME, Time) \
     SUBTYPE(FLOAT, Float, DISTANCE, Distance)
 
+#define NODE_DEFINE_SUBTYPES_STRING \
+    SUBTYPE(STRING, String, NONE, None) \
+    SUBTYPE(STRING, String, FILEPATH, Filepath)
+
 #define NODE_DEFINE_SUBTYPES_VECTOR \
     SUBTYPE(VECTOR, Vector, NONE, None) \
     SUBTYPE(VECTOR, Vector, TRANSLATION, Translation) \
@@ -200,14 +209,18 @@ EnumPropertyItem prop_wave_items[] = {
 #define NODE_DEFINE_SUBTYPES \
     NODE_DEFINE_SUBTYPES_INT \
     NODE_DEFINE_SUBTYPES_FLOAT \
-    NODE_DEFINE_SUBTYPES_VECTOR
+    NODE_DEFINE_SUBTYPES_STRING \
+    NODE_DEFINE_SUBTYPES_VECTOR \
 
 #ifdef RNA_RUNTIME
 
 #include "BLI_linklist.h"
 
+#include "BKE_global.h"
+
 #include "ED_node.h"
 
+#include "RE_engine.h"
 #include "RE_pipeline.h"
 
 #include "DNA_scene_types.h"
@@ -226,10 +239,6 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
 		
 		case NODE_GROUP:
 			return &RNA_NodeGroup;
-		case NODE_FORLOOP:
-			return &RNA_NodeForLoop;
-		case NODE_WHILELOOP:
-			return &RNA_NodeWhileLoop;
 		case NODE_FRAME:
 			return &RNA_NodeFrame;
 		case NODE_REROUTE:
@@ -290,6 +299,9 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
 			case SOCK_VECTOR:
 				NODE_DEFINE_SUBTYPES_VECTOR
 				break;
+			case SOCK_STRING:
+				NODE_DEFINE_SUBTYPES_STRING
+				break;
 			case SOCK_RGBA:
 				return &RNA_NodeSocketRGBA;
 			case SOCK_SHADER:
@@ -689,7 +701,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
 	bNodeTemplate ntemp;
 
 	if (type == NODE_GROUP && group == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "node type \'GROUP\' missing group argument");
+		BKE_report(reports, RPT_ERROR, "Node type 'GROUP' missing group argument");
 		return NULL;
 	}
 	
@@ -700,7 +712,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
 	node = nodeAddNode(ntree, &ntemp);
 	
 	if (node == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to create node");
+		BKE_report(reports, RPT_ERROR, "Unable to create node");
 	}
 	else {
 		ntreeUpdateTree(ntree); /* update group node socket links*/
@@ -753,20 +765,20 @@ static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, Repor
 	return node;
 }
 
-static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNode *node)
+static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, PointerRNA *node_ptr)
 {
+	bNode *node = node_ptr->data;
 	if (BLI_findindex(&ntree->nodes, node) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in nodetree", node->name);
+		BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
+		return;
 	}
-	else {
-		if (node->id)
-			id_us_min(node->id);
 
-		nodeFreeNode(ntree, node);
-		ntreeUpdateTree(ntree); /* update group node socket links*/
+	id_us_min(node->id);
+	nodeFreeNode(ntree, node);
+	RNA_POINTER_INVALIDATE(node_ptr);
 
-		WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
-	}
+	ntreeUpdateTree(ntree); /* update group node socket links */
+	WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
 }
 
 static void rna_NodeTree_node_clear(bNodeTree *ntree)
@@ -800,7 +812,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
 	nodeFindNode(ntree, tosock, &tonode, NULL, &to_in_out);
 	
 	if (&from_in_out == &to_in_out) {
-		BKE_reportf(reports, RPT_ERROR, "Same input/output direction of sockets");
+		BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
 		return NULL;
 	}
 
@@ -824,17 +836,19 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
 	return ret;
 }
 
-static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, bNodeLink *link)
+static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, PointerRNA *link_ptr)
 {
+	bNodeLink *link = link_ptr->data;
 	if (BLI_findindex(&ntree->links, link) == -1) {
-		BKE_reportf(reports, RPT_ERROR, "Unable to locate link in nodetree");
+		BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
+		return;
 	}
-	else {
-		nodeRemLink(ntree, link);
-		ntreeUpdateTree(ntree);
 
-		WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
-	}
+	nodeRemLink(ntree, link);
+	RNA_POINTER_INVALIDATE(link_ptr);
+
+	ntreeUpdateTree(ntree);
+	WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
 }
 
 static void rna_NodeTree_link_clear(bNodeTree *ntree)
@@ -882,9 +896,9 @@ static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *repo
 	int index, in_out;
 	
 	if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
-		BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
+		BKE_report(reports, RPT_ERROR, "Unable to locate socket in node tree");
 	else if (in_out != SOCK_IN)
-		BKE_reportf(reports, RPT_ERROR, "Socket is not an input");
+		BKE_report(reports, RPT_ERROR, "Socket is not an input");
 	else {
 		/* XXX should check if tree is a group here! no good way to do this currently. */
 		gsock = node_group_add_socket(ntree, sock->name, sock->type, SOCK_IN);
@@ -906,9 +920,9 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep
 	int index, in_out;
 	
 	if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
-		BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
+		BKE_report(reports, RPT_ERROR, "Unable to locate socket in node tree");
 	else if (in_out != SOCK_OUT)
-		BKE_reportf(reports, RPT_ERROR, "Socket is not an output");
+		BKE_report(reports, RPT_ERROR, "Socket is not an output");
 	else {
 		/* XXX should check if tree is a group here! no good way to do this currently. */
 		gsock = node_group_add_socket(ntree, sock->name, sock->type, SOCK_OUT);
@@ -997,6 +1011,145 @@ static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *va
 	}
 }
 
+static bNodeSocket *rna_ShaderNodeScript_find_socket(bNode *node, const char *name, int is_output)
+{
+	bNodeSocket *sock;
+
+	if (is_output) {
+		for (sock = node->outputs.first; sock; sock = sock->next) {
+			if (strcmp(sock->name, name) == 0) {
+				return sock;
+			}
+		}
+	}
+	else {
+		for (sock = node->inputs.first; sock; sock = sock->next) {
+			if (strcmp(sock->name, name) == 0) {
+				return sock;
+			}
+		}
+	}
+
+	return NULL;
+}
+
+static void rna_ShaderNodeScript_remove_socket(ID *id, bNode *node, bNodeSocket *sock)
+{
+	bNodeTree *ntree = (bNodeTree *)id;
+	
+	nodeRemoveSocket(ntree, node, sock);
+	
+	ED_node_generic_update(G.main, ntree, node);
+}
+
+static bNodeSocket *rna_ShaderNodeScript_add_socket(ID *id, bNode *node, const char *name, int type, int is_output)
+{
+	bNodeTree *ntree = (bNodeTree *)id;
+	bNodeSocket *sock;
+	
+	/* replace existing socket with the same name, to keep it unique */
+	sock = rna_ShaderNodeScript_find_socket(node, name, is_output);
+	if (sock)
+		nodeRemoveSocket(ntree, node, sock);
+	sock = nodeAddSocket(ntree, node, (is_output ? SOCK_OUT : SOCK_IN), name, type);
+	
+	ED_node_generic_update(G.main, ntree, node);
+	
+	return sock;
+}
+
+static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
+{
+	bNode *node = (bNode *)ptr->data;
+	NodeShaderScript *nss = node->storage;
+
+	if (nss->mode != value) {
+		nss->mode = value;
+		nss->filepath[0] = '\0';
+		nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
+
+		/* replace text datablock by filepath */
+		if (node->id) {
+			Text *text = (Text*)node->id;
+
+			if (value == NODE_SCRIPT_EXTERNAL && text->name) {
+				BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
+				BLI_path_rel(nss->filepath, G.main->name);
+			}
+
+			id_us_min(node->id);
+			node->id = NULL;
+		}
+
+		/* remove any bytecode */
+		if (nss->bytecode) {
+			MEM_freeN(nss->bytecode);
+			nss->bytecode = NULL;
+		}
+
+		nss->bytecode_hash[0] = '\0';
+	}
+}
+
+static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
+{
+	bNode *node = (bNode *)ptr->data;
+	NodeShaderScript *nss = node->storage;
+
+	strcpy(value, (nss->bytecode)? nss->bytecode: "");
+}
+
+static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
+{
+	bNode *node = (bNode *)ptr->data;
+	NodeShaderScript *nss = node->storage;
+
+	return (nss->bytecode) ? strlen(nss->bytecode) : 0;
+}
+
+static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
+{
+	bNode *node = (bNode *)ptr->data;
+	NodeShaderScript *nss = node->storage;
+
+	if (nss->bytecode)
+		MEM_freeN(nss->bytecode);
+
+	if (value && value[0])
+		nss->bytecode = BLI_strdup(value);
+	else
+		nss->bytecode = NULL;
+}
+
+static IDProperty *rna_ShaderNodeScript_idprops(PointerRNA *ptr, int create)
+{
+	bNode *node = (bNode *)ptr->data;
+	NodeShaderScript *nss = node->storage;
+
+	if (create && !nss->prop) {
+		IDPropertyTemplate val = {0};
+		nss->prop = IDP_New(IDP_GROUP, &val, "RNA_ShaderNodeScript ID properties");
+	}
+
+	return nss->prop;
+}
+
+static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+	bNode *node = (bNode *)ptr->data;
+	RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
+
+	if (engine_type && engine_type->update_script_node) {
+		/* auto update node */
+		RenderEngine *engine = RE_engine_create(engine_type);
+		engine_type->update_script_node(engine, ntree, node);
+		RE_engine_free(engine);
+	}
+
+	node_update(bmain, scene, ntree, node);
+}
+
 #else
 
 static EnumPropertyItem prop_image_layer_items[] = {
@@ -1037,12 +1190,17 @@ static EnumPropertyItem node_glossy_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem node_script_mode_items[] = {
+	{NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"},
+	{NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
+	{0, NULL, 0, NULL, NULL}
+};
+
 #define MaxNodes 50000
 
 enum
 {
 	Category_GroupNode,
-	Category_LoopNode,
 	Category_LayoutNode,
 	Category_ShaderNode,
 	Category_CompositorNode,
@@ -1063,7 +1221,7 @@ typedef struct NodeInfo {
 static NodeInfo nodes[MaxNodes];
 
 static void reg_node(int ID, int category, const char *enum_name, const char *struct_name,
-		const char *base_name, const char *ui_name, const char *ui_desc)
+                     const char *base_name, const char *ui_name, const char *ui_desc)
 {
 	NodeInfo *ni = nodes + ID;
 	
@@ -1086,8 +1244,6 @@ static void init(void)
 	#include "rna_nodetree_types.h"
 	
 	reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "SpecialNode", "Group", "");
-	reg_node(NODE_FORLOOP, Category_LoopNode, "FORLOOP", "NodeForLoop", "SpecialNode", "ForLoop", "");
-	reg_node(NODE_WHILELOOP, Category_LoopNode, "WHILELOOP", "NodeWhileLoop", "SpecialNode", "WhileLoop", "");
 	reg_node(NODE_FRAME, Category_LayoutNode, "FRAME", "NodeFrame", "SpecialNode", "Frame", "");
 	reg_node(NODE_REROUTE, Category_LayoutNode, "REROUTE", "NodeReroute", "SpecialNode", "Reroute", "");
 }
@@ -1145,6 +1301,14 @@ static void alloc_node_type_items(EnumPropertyItem *items, int category)
 	
 	item++;
 	
+	item->value = NODE_FRAME;
+	item->identifier = "FRAME";
+	item->icon = 0;
+	item->name = "Frame";
+	item->description = "";
+	
+	item++;
+	
 	/* NOTE!, increase 'count' when adding items here */
 	
 	memset(item, 0, sizeof(EnumPropertyItem));
@@ -1166,36 +1330,6 @@ static void def_group(StructRNA *srna)
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
 }
 
-static void def_forloop(StructRNA *srna)
-{
-	PropertyRNA *prop;
-	
-	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "id");
-	RNA_def_property_struct_type(prop, "NodeTree");
-	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Node Tree", "");
-	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-}
-
-static void def_whileloop(StructRNA *srna)
-{
-	PropertyRNA *prop;
-	
-	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "id");
-	RNA_def_property_struct_type(prop, "NodeTree");
-	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Node Tree", "");
-	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-
-	prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "custom1");
-	RNA_def_property_range(prop, 0.0f, SHRT_MAX);
-	RNA_def_property_ui_text(prop, "Max. Iterations", "Limit for number of iterations");
-	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-}
-
 static void def_frame(StructRNA *srna)
 {
 	PropertyRNA *prop; 
@@ -1462,7 +1596,8 @@ static void def_sh_tex_sky(StructRNA *srna)
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Turbidity", "");
+	RNA_def_property_range(prop, 1.0f, 30.0f);
+	RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
@@ -1741,6 +1876,138 @@ static void def_glossy(StructRNA *srna)
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_sh_normal_map(StructRNA *srna)
+{
+	static EnumPropertyItem prop_space_items[] = {
+		{SHD_NORMAL_MAP_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
+		{SHD_NORMAL_MAP_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
+		{SHD_NORMAL_MAP_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	PropertyRNA *prop;
+
+	RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
+
+	prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_space_items);
+	RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+	RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+	RNA_def_struct_sdna_from(srna, "bNode", NULL);
+}
+
+static void def_sh_tangent(StructRNA *srna)
+{
+	static EnumPropertyItem prop_direction_type_items[] = {
+		{SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
+		{SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	static EnumPropertyItem prop_axis_items[] = {
+		{SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
+		{SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
+		{SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	PropertyRNA *prop;
+
+	RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
+
+	prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_direction_type_items);
+	RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_axis_items);
+	RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+	RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+	RNA_def_struct_sdna_from(srna, "bNode", NULL);
+}
+
+static void def_sh_script(StructRNA *srna)
+{
+	FunctionRNA *func;
+	PropertyRNA *prop, *parm;
+
+	prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "id");
+	RNA_def_property_struct_type(prop, "Text");
+	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+	RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
+	
+	RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
+	RNA_def_struct_idprops_func(srna, "rna_ShaderNodeScript_idprops");
+	
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	RNA_def_property_ui_text(prop, "File Path", "Shader script path");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
+
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeScript_mode_set", NULL);
+	RNA_def_property_enum_items(prop, node_script_mode_items);
+	RNA_def_property_ui_text(prop, "Script Source", "");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_SCRIPT_AUTO_UPDATE);
+	RNA_def_property_ui_text(prop, "Auto Update",
+	                         "Automatically update the shader when the .osl file changes (external scripts only)");
+	
+	prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ShaderNodeScript_bytecode_get", "rna_ShaderNodeScript_bytecode_length",
+	                              "rna_ShaderNodeScript_bytecode_set");
+	RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+	/* needs to be reset to avoid bad pointer type in API functions below */
+	RNA_def_struct_sdna_from(srna, "bNode", NULL);
+	
+	/* API functions */
+	
+	func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
+	RNA_def_function_ui_description(func, "Find a socket by name");
+	parm = RNA_def_string(func, "name", "", 0, "Socket name", "");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	/*parm =*/ RNA_def_boolean(func, "is_output", FALSE, "Output", "Whether the socket is an output");
+	parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
+	RNA_def_function_return(func, parm);
+	
+	func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
+	RNA_def_function_ui_description(func, "Add a socket socket");
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+	parm = RNA_def_string(func, "name", "", 0, "Name", "");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	/*parm =*/ RNA_def_boolean(func, "is_output", FALSE, "Output", "Whether the socket is an output");
+	parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
+	RNA_def_function_return(func, parm);
+	
+	func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
+	RNA_def_function_ui_description(func, "Remove a socket socket");
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+	parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+}
+
 /* -- Compositor Nodes ------------------------------------------------------ */
 
 static void def_cmp_alpha_over(StructRNA *srna)
@@ -1932,6 +2199,16 @@ static void def_cmp_map_value(StructRNA *srna)
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_cmp_map_range(StructRNA *srna)
+{
+	PropertyRNA *prop;
+	
+	prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+	RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 static void def_cmp_vector_blur(StructRNA *srna)
 {
 	PropertyRNA *prop;
@@ -3994,8 +4271,6 @@ static void rna_def_special_node(BlenderRNA *brna)
 
 	static EnumPropertyItem specific_node_type_items[] = {
 		{NODE_GROUP, "GROUP", ICON_NODE, "Group", ""},
-		{NODE_FORLOOP, "FORLOOP", ICON_NODE, "For Loop", ""},
-		{NODE_WHILELOOP, "WHILELOOP", ICON_NODE, "While Loop", ""},
 		{NODE_FRAME, "FRAME", ICON_NODE, "Frame", ""},
 		{NODE_REROUTE, "REROUTE", ICON_NODE, "Reroute", ""},
 		{0, NULL, 0, NULL, NULL}
@@ -4039,7 +4314,8 @@ static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "remove a node link from the node tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
 	RNA_def_function_ui_description(func, "remove all node links from the node tree");
@@ -4083,7 +4359,8 @@ static void rna_def_composite_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a node from this node tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
@@ -4116,7 +4393,8 @@ static void rna_def_shader_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a node from this node tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
@@ -4149,7 +4427,8 @@ static void rna_def_texture_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a node from this node tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
@@ -4291,6 +4570,20 @@ static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype,
 			RNA_def_property_ui_text(prop, "Default Value", "");
 			RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
 			break;
+		case SOCK_STRING:
+			RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
+
+			prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
+			RNA_def_property_enum_sdna(prop, NULL, "subtype");
+			RNA_def_property_enum_items(prop, subtype_items);
+			RNA_def_property_ui_text(prop, "Subtype", "Subtype defining the socket value details");
+			RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+			
+			prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_FILEPATH);
+			RNA_def_property_string_sdna(prop, NULL, "value");
+			RNA_def_property_ui_text(prop, "Default Value", "");
+			RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+			break;
 	}
 	
 	/* XXX need to reset the from-type here, so subtype subclasses cast correctly! (RNA bug) */
@@ -4358,18 +4651,22 @@ static void rna_def_node(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "");
+	RNA_def_property_update(prop, NC_NODE | NA_SELECTED, NULL);
 
 	prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_OPTIONS);
 	RNA_def_property_ui_text(prop, "Show Options", "");
+	RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
 
 	prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_PREVIEW);
 	RNA_def_property_ui_text(prop, "Show Preview", "");
+	RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
 
 	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_HIDDEN);
 	RNA_def_property_ui_text(prop, "Hide", "");
+	RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
 
 	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_MUTED);
@@ -4618,8 +4915,6 @@ void RNA_def_nodetree(BlenderRNA *brna)
 	#include "rna_nodetree_types.h"
 	
 	define_specific_node(brna, NODE_GROUP, def_group);
-	define_specific_node(brna, NODE_FORLOOP, def_forloop);
-	define_specific_node(brna, NODE_WHILELOOP, def_whileloop);
 	define_specific_node(brna, NODE_FRAME, def_frame);
 	define_specific_node(brna, NODE_REROUTE, 0);
 	
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index db1e1e1..14cdbc6 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -65,11 +65,14 @@ DefNode( ShaderNode,     SH_NODE_LAYER_WEIGHT,       0,                      "LA
 DefNode( ShaderNode,     SH_NODE_MIX_SHADER,         0,                      "MIX_SHADER",         MixShader,        "Mix Shader",        ""       )
 DefNode( ShaderNode,     SH_NODE_ADD_SHADER,         0,                      "ADD_SHADER",         AddShader,        "Add Shader",        ""       )
 DefNode( ShaderNode,     SH_NODE_ATTRIBUTE,          def_sh_attribute,       "ATTRIBUTE",          Attribute,        "Attribute",         ""       )
+DefNode( ShaderNode,     SH_NODE_AMBIENT_OCCLUSION,  0,                      "AMBIENT_OCCLUSION",  AmbientOcclusion, "Ambient Occlusion", ""       )
 DefNode( ShaderNode,     SH_NODE_BACKGROUND,         0,                      "BACKGROUND",         Background,       "Background",        ""       )
 DefNode( ShaderNode,     SH_NODE_HOLDOUT,            0,                      "HOLDOUT",            Holdout,          "Holdout",           ""       )
+DefNode( ShaderNode,     SH_NODE_BSDF_ANISOTROPIC,   0,                      "BSDF_ANISOTROPIC",   BsdfAnisotropic,  "Anisotropic Bsdf",  ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_DIFFUSE,       0,                      "BSDF_DIFFUSE",       BsdfDiffuse,      "Diffuse Bsdf",      ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_GLOSSY,        def_glossy,             "BSDF_GLOSSY",        BsdfGlossy,       "Glossy Bsdf",       ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_GLASS,         def_glossy,             "BSDF_GLASS",         BsdfGlass,        "Glass Bsdf",        ""       )
+DefNode( ShaderNode,     SH_NODE_BSDF_REFRACTION,    def_glossy,             "BSDF_REFRACTION",    BsdfRefraction,   "Refraction Bsdf",   ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_TRANSLUCENT,   0,                      "BSDF_TRANSLUCENT",   BsdfTranslucent,  "Translucent Bsdf",  ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_TRANSPARENT,   0,                      "BSDF_TRANSPARENT",   BsdfTransparent,  "Transparent Bsdf",  ""       )
 DefNode( ShaderNode,     SH_NODE_BSDF_VELVET,        0,                      "BSDF_VELVET",        BsdfVelvet,       "Velvet Bsdf",       ""       )
@@ -81,6 +84,10 @@ DefNode( ShaderNode,     SH_NODE_LIGHT_PATH,         0,                      "LI
 DefNode( ShaderNode,     SH_NODE_LIGHT_FALLOFF,      0,                      "LIGHT_FALLOFF",      LightFalloff,     "Light Falloff",     ""       )
 DefNode( ShaderNode,     SH_NODE_OBJECT_INFO,        0,                      "OBJECT_INFO",        ObjectInfo,       "Object Info",       ""       )
 DefNode( ShaderNode,     SH_NODE_PARTICLE_INFO,      0,                      "PARTICLE_INFO",      ParticleInfo,     "Particle Info",     ""       )
+DefNode( ShaderNode,     SH_NODE_BUMP,               0,                      "BUMP",               Bump,             "Bump",              ""       )
+DefNode( ShaderNode,     SH_NODE_NORMAL_MAP,         def_sh_normal_map,      "NORMAL_MAP",         NormalMap,        "Normal Map",        ""       )
+DefNode( ShaderNode,     SH_NODE_TANGENT,            def_sh_tangent,         "TANGENT",            Tangent,          "Tangent",           ""       )
+DefNode( ShaderNode,     SH_NODE_SCRIPT,             def_sh_script,          "SCRIPT",             Script,           "Script",            ""       )
 DefNode( ShaderNode,     SH_NODE_TEX_IMAGE,          def_sh_tex_image,       "TEX_IMAGE",          TexImage,         "Image Texture",     ""       )
 DefNode( ShaderNode,     SH_NODE_TEX_ENVIRONMENT,    def_sh_tex_environment, "TEX_ENVIRONMENT",    TexEnvironment,   "Environment Texture",""      )
 DefNode( ShaderNode,     SH_NODE_TEX_SKY,            def_sh_tex_sky,         "TEX_SKY",            TexSky,           "Sky Texture",       ""       )
@@ -91,7 +98,7 @@ DefNode( ShaderNode,     SH_NODE_TEX_WAVE,           def_sh_tex_wave,        "TE
 DefNode( ShaderNode,     SH_NODE_TEX_MUSGRAVE,       def_sh_tex_musgrave,    "TEX_MUSGRAVE",       TexMusgrave,      "Musgrave Texture",  ""       )
 DefNode( ShaderNode,     SH_NODE_TEX_VORONOI,        def_sh_tex_voronoi,     "TEX_VORONOI",        TexVoronoi,       "Voronoi Texture",   ""       )
 DefNode( ShaderNode,     SH_NODE_TEX_CHECKER,        def_sh_tex_checker,     "TEX_CHECKER",        TexChecker,       "Checker Texture",   ""       )
-DefNode( ShaderNode,     SH_NODE_TEX_BRICK,        	 def_sh_tex_brick,     	 "TEX_BRICK",          TexBrick,         "Brick Texture",     ""       )
+DefNode( ShaderNode,     SH_NODE_TEX_BRICK,          def_sh_tex_brick,       "TEX_BRICK",          TexBrick,         "Brick Texture",     ""       )
 DefNode( ShaderNode,     SH_NODE_TEX_COORD,          def_sh_tex_coord,       "TEX_COORD",          TexCoord,         "Texture Coordinate",""       )
 
 DefNode( CompositorNode, CMP_NODE_VIEWER,         def_cmp_viewer,         "VIEWER",         Viewer,           "Viewer",            ""              )
@@ -107,6 +114,7 @@ DefNode( CompositorNode, CMP_NODE_ALPHAOVER,      def_cmp_alpha_over,     "ALPHA
 DefNode( CompositorNode, CMP_NODE_BLUR,           def_cmp_blur,           "BLUR",           Blur,             "Blur",              ""              )
 DefNode( CompositorNode, CMP_NODE_FILTER,         def_cmp_filter,         "FILTER",         Filter,           "Filter",            ""              )
 DefNode( CompositorNode, CMP_NODE_MAP_VALUE,      def_cmp_map_value,      "MAP_VALUE",      MapValue,         "Map Value",         ""              )
+DefNode( CompositorNode, CMP_NODE_MAP_RANGE,      def_cmp_map_range,      "MAP_RANGE",      MapRange,         "Map Range",         ""              )
 DefNode( CompositorNode, CMP_NODE_TIME,           def_time,               "TIME",           Time,             "Time",              ""              )
 DefNode( CompositorNode, CMP_NODE_VECBLUR,        def_cmp_vector_blur,    "VECBLUR",        VecBlur,          "Vector Blur",       ""              )
 DefNode( CompositorNode, CMP_NODE_SEPRGBA,        0,                      "SEPRGBA",        SepRGBA,          "Separate RGBA",     ""              )
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 0b8afef..1d08ea9 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -94,6 +94,15 @@ static EnumPropertyItem parent_type_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem dupli_items[] = {
+	{0, "NONE", 0, "None", ""},
+	{OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
+	{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
+	{OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
+	{OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
+	{0, NULL, 0, NULL, NULL}
+};
+
 static EnumPropertyItem collision_bounds_items[] = {
 	{OB_BOUND_BOX, "BOX", 0, "Box", ""},
 	{OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
@@ -506,7 +515,7 @@ static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
 		ob->dup_group = grp;
 	else
 		BKE_report(NULL, RPT_ERROR,
-		           "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
+		           "Cannot set dupli-group as object belongs in group being instanced, thus causing a cycle");
 }
 
 static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
@@ -547,8 +556,7 @@ static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min
 	Object *ob = (Object *)ptr->id.data;
 
 	*min = 0;
-	*max = BLI_countlist(&ob->defbase) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&ob->defbase) - 1);
 }
 
 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
@@ -658,7 +666,7 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in
 {
 	Object *ob = (Object *)ptr->id.data;
 	*min = 0;
-	*max = MAX2(ob->totcol - 1, 0);
+	*max = max_ii(ob->totcol - 1, 0);
 }
 
 /* returns active base material */
@@ -684,8 +692,7 @@ static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *
 {
 	Object *ob = (Object *)ptr->id.data;
 	*min = 0;
-	*max = BLI_countlist(&ob->particlesystem) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&ob->particlesystem) - 1);
 }
 
 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
@@ -851,11 +858,11 @@ static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
 	
 	if (value) {
 		ob->matbits[index] = 1;
-		/* ob->colbits |= (1<<index); */ /* DEPRECATED */
+		/* ob->colbits |= (1 << index); */ /* DEPRECATED */
 	}
 	else {
 		ob->matbits[index] = 0;
-		/* ob->colbits &= ~(1<<index); */ /* DEPRECATED */
+		/* ob->colbits &= ~(1 << index); */ /* DEPRECATED */
 	}
 }
 
@@ -1036,8 +1043,8 @@ static unsigned int rna_Object_layer_validate__internal(const int *values, unsig
 		return 0;
 
 	for (i = 0; i < 20; i++) {
-		if (values[i]) lay |= (1 << i);
-		else lay &= ~(1 << i);
+		if (values[i]) lay |=  (1 << i);
+		else           lay &= ~(1 << i);
 	}
 
 	return lay;
@@ -1072,8 +1079,9 @@ static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
 	int all_states = (ob->scaflag & OB_ALLSTATE ? 1 : 0);
 
 	memset(values, 0, sizeof(int) * OB_MAX_STATES);
-	for (i = 0; i < OB_MAX_STATES; i++)
+	for (i = 0; i < OB_MAX_STATES; i++) {
 		values[i] = (ob->state & (1 << i)) | all_states;
+	}
 }
 
 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
@@ -1111,6 +1119,65 @@ static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
 	}
 }
 
+static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values)
+{
+	Object *ob = (Object*)ptr->data;
+	int i;
+
+	for (i = 0; i < OB_MAX_COL_MASKS; i++) {
+		values[i] = (ob->col_group & (1 << i));
+	}
+}
+
+static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values)
+{
+	Object *ob = (Object*)ptr->data;
+	int i, tot = 0;
+
+	/* ensure we always have some group selected */
+	for (i = 0; i < OB_MAX_COL_MASKS; i++)
+		if (values[i])
+			tot++;
+
+	if (tot == 0)
+		return;
+
+	for (i = 0; i < OB_MAX_COL_MASKS; i++) {
+		if (values[i]) ob->col_group |=  (1 << i);
+		else           ob->col_group &= ~(1 << i);
+	}
+}
+
+static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values)
+{
+	Object *ob = (Object*)ptr->data;
+	int i;
+
+	for (i = 0; i < OB_MAX_COL_MASKS; i++) {
+		values[i] = (ob->col_mask & (1 << i));
+	}
+}
+
+static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values)
+{
+	Object *ob = (Object*)ptr->data;
+	int i, tot = 0;
+
+	/* ensure we always have some mask selected */
+	for (i = 0; i < OB_MAX_COL_MASKS; i++)
+		if (values[i])
+			tot++;
+
+	if (tot == 0)
+		return;
+
+	for (i = 0; i < OB_MAX_COL_MASKS; i++) {
+		if (values[i]) ob->col_mask |=  (1 << i);
+		else           ob->col_mask &= ~(1 << i);
+	}
+}
+
+
 static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
 	Object *ob = (Object *)ptr->id.data;
@@ -1199,14 +1266,17 @@ static bConstraint *rna_Object_constraints_new(Object *object, int type)
 	return add_ob_constraint(object, NULL, type);
 }
 
-static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
+static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
 {
+	bConstraint *con = con_ptr->data;
 	if (BLI_findindex(&object->constraints, con) == -1) {
 		BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'", con->name, object->id.name + 2);
 		return;
 	}
 
 	remove_constraint(&object->constraints, con);
+	RNA_POINTER_INVALIDATE(con_ptr);
+
 	ED_object_constraint_update(object);
 	ED_object_constraint_set_active(object, NULL);
 	WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
@@ -1228,9 +1298,15 @@ static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, Report
 	return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
 }
 
-static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md)
+static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr)
 {
-	ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md);
+	ModifierData *md = md_ptr->data;
+	if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) == FALSE) {
+		/* error is already set */
+		return;
+	}
+
+	RNA_POINTER_INVALIDATE(md_ptr);
 
 	WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
 }
@@ -1264,9 +1340,16 @@ static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
 	return defgroup;
 }
 
-static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup)
+static void rna_Object_vgroup_remove(Object *ob, ReportList *reports, PointerRNA *defgroup_ptr)
 {
+	bDeformGroup *defgroup = defgroup_ptr->data;
+	if (BLI_findindex(&ob->defbase, defgroup) == -1) {
+		BKE_reportf(reports, RPT_ERROR, "DeformGroup '%s' not in object '%s'", defgroup->name, ob->id.name + 2);
+		return;
+	}
+
 	ED_vgroup_delete(ob, defgroup);
+	RNA_POINTER_INVALIDATE(defgroup_ptr);
 
 	WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
 }
@@ -1284,7 +1367,7 @@ static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *re
 	Object *ob = (Object *)id;
 
 	if (ED_vgroup_object_is_edit_mode(ob)) {
-		BKE_reportf(reports, RPT_ERROR, "VertexGroup.add(): Can't be called while object is in edit mode");
+		BKE_report(reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
 		return;
 	}
 
@@ -1299,7 +1382,7 @@ static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *
 	Object *ob = (Object *)id;
 
 	if (ED_vgroup_object_is_edit_mode(ob)) {
-		BKE_reportf(reports, RPT_ERROR, "VertexGroup.remove(): Can't be called while object is in edit mode");
+		BKE_report(reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
 		return;
 	}
 
@@ -1314,7 +1397,7 @@ static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *report
 	float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
 
 	if (weight < 0) {
-		BKE_reportf(reports, RPT_ERROR, "Vertex not in group");
+		BKE_report(reports, RPT_ERROR, "Vertex not in group");
 	}
 	return weight;
 }
@@ -1345,6 +1428,12 @@ int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
 	return ((Object *)value.id.data)->type == OB_CAMERA;
 }
 
+int rna_DupliObject_index_get(PointerRNA *ptr)
+{
+	DupliObject *dob = (DupliObject *)ptr->data;
+	return dob->persistent_id[0];
+}
+
 #else
 
 static int rna_matrix_dimsize_4x4[] = {4, 4};
@@ -1563,21 +1652,34 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
 	
+	/* Character physics */
 	prop = RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "step_height");
-	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_range(prop, 0.01, 1.0);
 	RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over");
 
 	prop = RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "jump_speed");
 	RNA_def_property_range(prop, 0.0, 1000.0);
-	RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping (with the Motion actuator)");
+	RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping");
 
 	prop = RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fall_speed");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall");
 
+	/* Collision Masks */
+	prop = RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1);
+	RNA_def_property_array(prop, OB_MAX_COL_MASKS);
+	RNA_def_property_ui_text(prop, "Collision Group", "The collision group of the object");
+	RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_group_get", "rna_GameObjectSettings_col_group_set");
+
+	prop = RNA_def_property(srna, "collision_mask", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	RNA_def_property_boolean_sdna(prop, NULL, "col_mask", 1);
+	RNA_def_property_array(prop, OB_MAX_COL_MASKS);
+	RNA_def_property_ui_text(prop, "Collision Mask", "The groups this object can collide with");
+	RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_mask_get", "rna_GameObjectSettings_col_mask_set");
 
 	/* lock position */
 	prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
@@ -1745,7 +1847,8 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* constraint to remove */
 	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
 	RNA_def_function_ui_description(func, "Remove all constraint from this object");
@@ -1796,7 +1899,8 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
 	/* modifier to remove */
 	parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* clear all modifiers */
 	func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
@@ -1874,9 +1978,11 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_return(func, parm);
 
 	func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Delete vertex group from object");
 	parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
 	RNA_def_function_ui_description(func, "Delete all vertex groups from object");
@@ -1922,15 +2028,7 @@ static void rna_def_object(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem dupli_items[] = {
-		{0, "NONE", 0, "None", ""},
-		{OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
-		{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
-		{OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
-		{OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
-		{0, NULL, 0, NULL, NULL}
-	};
-		
+	
 	/* XXX: this RNA enum define is currently duplicated for objects,
 	 *      since there is some text here which is not applicable */
 	static EnumPropertyItem prop_rotmode_items[] = {
@@ -2077,7 +2175,7 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set",
 	                           "rna_Object_active_material_index_range");
 	RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
-	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
 	
 	/* transform */
 	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
@@ -2564,25 +2662,31 @@ static void rna_def_dupli_object(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Hide", "Don't show dupli object in viewport or render");
 
 	prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "index");
+	RNA_def_property_int_funcs(prop, "rna_DupliObject_index_get", NULL, NULL);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Index", "Index in the lowest-level dupli list");
-	
-	prop = RNA_def_property(srna, "particle_index", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "particle_index");
+
+	prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Persistent ID", "Persistent identifier for inter-frame matching of objects with motion blur");
+
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Particle Index", "Index in the lowest-level particle dupli list");
+	RNA_def_property_ui_text(prop, "Particle System", "Particle system that this dupli object was instanced from");
 
 	prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
-	RNA_def_property_float_sdna(prop, NULL, "orco");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Generated Coordinates", "Generated coordinates in parent object space");
 
 	prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "uv");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
+
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, dupli_items);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object");
 }
 
 static void rna_def_object_base(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 879a775..87fc3be 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -74,7 +74,7 @@
 
 /* copied from Mesh_getFromObject and adapted to RNA interface */
 /* settings: 0 - preview, 1 - render */
-Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
+static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
 {
 	Mesh *tmpmesh;
 	Curve *tmpcu = NULL, *copycu;
@@ -158,7 +158,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 			/* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */
 			if (tmpobj->type != OB_MESH) {
 				BKE_libblock_free_us(&(G.main->object), tmpobj);
-				BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?");
+				BKE_report(reports, RPT_ERROR, "Cannot convert curve to mesh (does the curve have any segments?)");
 				return NULL;
 			}
 
@@ -321,7 +321,7 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e
 			}
 		}
 
-		if (level == 0 && enable) {
+		if (enable) {
 			/* this is to make sure we get render level duplis in groups:
 			 * the derivedmesh must be created before init_render_mesh,
 			 * since object_duplilist does dupliparticles before that */
@@ -340,7 +340,7 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e
 		dupli_render_particle_set(scene, go->ob, level + 1, enable);
 }
 /* When no longer needed, duplilist should be freed with Object.free_duplilist */
-void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings)
+static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings)
 {
 	int for_render = settings == eModifierMode_Render;
 
@@ -351,7 +351,7 @@ void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, in
 
 	/* free duplilist if a user forgets to */
 	if (ob->duplilist) {
-		BKE_reportf(reports, RPT_WARNING, "Object.dupli_list has not been freed");
+		BKE_report(reports, RPT_WARNING, "Object.dupli_list has not been freed");
 
 		free_object_duplilist(ob->duplilist);
 		ob->duplilist = NULL;
@@ -364,7 +364,7 @@ void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, in
 	/* ob->duplilist should now be freed with Object.free_duplilist */
 }
 
-void rna_Object_free_duplilist(Object *ob)
+static void rna_Object_free_duplilist(Object *ob)
 {
 	if (ob->duplilist) {
 		free_object_duplilist(ob->duplilist);
@@ -387,7 +387,7 @@ static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *
 		return keyptr;
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Object \"%s\"does not support shapes", ob->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
 		return PointerRNA_NULL;
 	}
 }
@@ -402,14 +402,14 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
                                            float weight, int assignmode)
 {
 	if (ob->type != OB_MESH) {
-		BKE_report(reports, RPT_ERROR, "Object should be of MESH type");
+		BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
 		return;
 	}
 
 	Mesh *me = (Mesh *)ob->data;
 	int group_index = BLI_findlink(&ob->defbase, group);
 	if (group_index == -1) {
-		BKE_report(reports, RPT_ERROR, "No deform groups assigned to mesh");
+		BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
 		return;
 	}
 
@@ -441,7 +441,7 @@ static void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start
 	BVHTreeFromMesh treeData = {NULL};
 	
 	if (ob->derivedFinal == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for ray casting", ob->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for ray casting", ob->id.name + 2);
 		return;
 	}
 
@@ -449,7 +449,7 @@ static void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start
 	bvhtree_from_mesh_faces(&treeData, ob->derivedFinal, 0.0f, 4, 6);
 
 	if (treeData.tree == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for ray casting", ob->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for ray casting", ob->id.name + 2);
 		return;
 	}
 	else {
@@ -483,7 +483,7 @@ static void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, fl
 	BVHTreeFromMesh treeData = {NULL};
 	
 	if (ob->derivedFinal == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for finding nearest point",
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for finding nearest point",
 		            ob->id.name + 2);
 		return;
 	}
@@ -492,7 +492,7 @@ static void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, fl
 	bvhtree_from_mesh_faces(&treeData, ob->derivedFinal, 0.0f, 4, 6);
 
 	if (treeData.tree == NULL) {
-		BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for finding nearest point",
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for finding nearest point",
 		            ob->id.name + 2);
 		return;
 	}
@@ -522,12 +522,12 @@ static void rna_ObjectBase_layers_from_view(Base *base, View3D *v3d)
 	base->lay = base->object->lay = v3d->lay;
 }
 
-int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
+static int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
 {
 	return BKE_object_is_modified(scene, ob) & settings;
 }
 
-int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
+static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
 {
 	return BKE_object_is_deform_modified(scene, ob) & settings;
 }
@@ -613,7 +613,7 @@ void RNA_api_object(StructRNA *srna)
 	                                "objects real matrix and layers");
 	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
-	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Generate texture coordinates for rendering");
+	RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Generate texture coordinates for rendering");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
 	func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 39f85eb..6d7187d 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -51,6 +51,9 @@ static EnumPropertyItem effector_shape_items[] = {
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_math_base.h"
+
+
 /* type specific return values only used from functions */
 static EnumPropertyItem curve_shape_items[] = {
 	{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
@@ -239,8 +242,7 @@ static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min,
 
 	for (pid = pidlist.first; pid; pid = pid->next) {
 		if (pid->cache == cache) {
-			*max = BLI_countlist(pid->ptcaches) - 1;
-			*max = MAX2(0, *max);
+			*max = max_ii(0, BLI_countlist(pid->ptcaches) - 1);
 			break;
 		}
 	}
@@ -820,10 +822,13 @@ static void rna_def_pointcache(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "File Path", "Cache file path");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 
+	/* removed, see PTCACHE_QUICK_CACHE */
+#if 0
 	prop = RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
 	RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+#endif
 
 	prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "info");
@@ -1056,6 +1061,13 @@ static void rna_def_effector_weight(BlenderRNA *brna)
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Drag", "Drag effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+	prop = RNA_def_property(srna, "smokeflow", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "weight[13]");
+	RNA_def_property_range(prop, -200.0f, 200.0f);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+	RNA_def_property_ui_text(prop, "Smoke Flow", "Smoke Flow effector weight");
+	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 }
 
 static void rna_def_field(BlenderRNA *brna)
@@ -1082,6 +1094,7 @@ static void rna_def_field(BlenderRNA *brna)
 		{PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
 		{PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"},
 		{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
+		{PFIELD_SMOKEFLOW, "SMOKE_FLOW", ICON_FORCE_SMOKEFLOW, "Smoke Flow", "Create a force based on smoke simulation air flow"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
@@ -1334,6 +1347,11 @@ static void rna_def_field(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_MULTIPLE_SPRINGS);
 	RNA_def_property_ui_text(prop, "Multiple Springs", "Every point is effected by multiple springs");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+	prop = RNA_def_property(srna, "use_smoke_density", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY);
+	RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density");
+	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
 	/* Pointer */
 	
@@ -1342,6 +1360,12 @@ static void rna_def_field(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+	prop = RNA_def_property(srna, "source_object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "f_source");
+	RNA_def_property_ui_text(prop, "Domain Object", "Select domain object of the smoke simulation");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
 	/********** Curve Guide Field Settings **********/
 	
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 363d2dc..6825d3d 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -530,8 +530,7 @@ static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *pt
 {
 	ParticleSystem *psys = (ParticleSystem *)ptr->data;
 	*min = 0;
-	*max = BLI_countlist(&psys->targets) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&psys->targets) - 1);
 }
 
 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
@@ -670,8 +669,7 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min
 {
 	ParticleSettings *part = (ParticleSettings *)ptr->id.data;
 	*min = 0;
-	*max = BLI_countlist(&part->dupliweights) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&part->dupliweights) - 1);
 }
 
 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
@@ -823,12 +821,12 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i
 		psys->vgroup[index] = 0;
 	}
 	else {
-		int vgroup_num = defgroup_name_index(ob, value);
+		int defgrp_index = defgroup_name_index(ob, value);
 
-		if (vgroup_num == -1)
+		if (defgrp_index == -1)
 			return;
 
-		psys->vgroup[index] = vgroup_num + 1;
+		psys->vgroup[index] = defgrp_index + 1;
 	}
 }
 
@@ -2135,7 +2133,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_float_default(prop, 0.2);
 	RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
 	                         "The relative distance a particle can move before requiring more subframes "
-	                         "(target current number); 0.1-0.3 is the recommended range");
+	                         "(target Courant number); 0.1-0.3 is the recommended range");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index df278e7..5c90fb8 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -381,13 +381,7 @@ static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, in
 	bPose *pose = (ob) ? ob->pose : NULL;
 	
 	*min = 0;
-	
-	if (pose) {
-		*max = BLI_countlist(&pose->agroups) - 1;
-		*max = MAX2(0, *max);
-	}
-	else
-		*max = 0;
+	*max = pose ? max_ii(0, BLI_countlist(&pose->agroups) - 1) : 0;
 }
 
 static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
@@ -419,8 +413,7 @@ static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, in
 	bPose *pose = (bPose *)ptr->data;
 
 	*min = 0;
-	*max = BLI_countlist(&pose->agroups) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&pose->agroups) - 1);
 }
 
 #if 0
@@ -497,24 +490,28 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ
 	return add_pose_constraint(NULL, pchan, NULL, type);
 }
 
-static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, bConstraint *con)
+static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr)
 {
+	bConstraint *con = con_ptr->data;
+	const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+	Object *ob = (Object *)id;
+
 	if (BLI_findindex(&pchan->constraints, con) == -1) {
 		BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
 		return;
 	}
-	else {
-		Object *ob = (Object *)id;
-		const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
 
-		remove_constraint(&pchan->constraints, con);
-		ED_object_constraint_update(ob);
-		constraints_set_active(&pchan->constraints, NULL);
-		WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id);
+	remove_constraint(&pchan->constraints, con);
+	RNA_POINTER_INVALIDATE(con_ptr);
 
-		if (is_ik) {
-			BIK_clear_data(ob->pose);
-		}
+	ED_object_constraint_update(ob);
+
+	constraints_set_active(&pchan->constraints, NULL);  /* XXX, is this really needed? - Campbell */
+
+	WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id);
+
+	if (is_ik) {
+		BIK_clear_data(ob->pose);
 	}
 }
 
@@ -678,7 +675,7 @@ static void rna_def_bone_group(BlenderRNA *brna)
 }
 
 static EnumPropertyItem prop_iksolver_items[] = {
-	{IKSOLVER_LEGACY, "LEGACY", 0, "Legacy", "Original IK solver"},
+	{IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
 	{IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -727,7 +724,8 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
 	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); /* ID needed for refresh */
 	/* constraint to remove */
 	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 static void rna_def_pose_channel(BlenderRNA *brna)
@@ -1128,7 +1126,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "numiter");
-	RNA_def_property_range(prop, 1.f, 1000.f);
+	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "Iterations",
 	                         "Maximum number of iterations for convergence in case of reiteration");
 	RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
@@ -1223,8 +1221,7 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "iksolver");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, prop_iksolver_items);
-	RNA_def_property_ui_text(prop, "IK Solver",
-	                         "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
+	RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
 }
 
 /* pose.bone_groups */
@@ -1287,8 +1284,7 @@ static void rna_def_pose(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "iksolver");
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
 	RNA_def_property_enum_items(prop, prop_iksolver_items);
-	RNA_def_property_ui_text(prop, "IK Solver",
-	                         "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC");
+	RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
 	RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
 
 	prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 039d50e..46b22cd 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -50,12 +50,12 @@
 
 /* RenderEngine Callbacks */
 
-void engine_tag_redraw(RenderEngine *engine)
+static void engine_tag_redraw(RenderEngine *engine)
 {
 	engine->flag |= RE_ENGINE_DO_DRAW;
 }
 
-void engine_tag_update(RenderEngine *engine)
+static void engine_tag_update(RenderEngine *engine)
 {
 	engine->flag |= RE_ENGINE_DO_UPDATE;
 }
@@ -129,6 +129,24 @@ static void engine_view_draw(RenderEngine *engine, const struct bContext *contex
 	RNA_parameter_list_free(&list);
 }
 
+static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
+{
+	extern FunctionRNA rna_RenderEngine_update_script_node_func;
+	PointerRNA ptr, nodeptr;
+	ParameterList list;
+	FunctionRNA *func;
+
+	RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+	RNA_pointer_create((ID*)ntree, &RNA_Node, node, &nodeptr);
+	func = &rna_RenderEngine_update_script_node_func;
+
+	RNA_parameter_list_create(&list, &ptr, func);
+	RNA_parameter_set_lookup(&list, "node", &nodeptr);
+	engine->type->ext.call(NULL, &ptr, func, &list);
+
+	RNA_parameter_list_free(&list);
+}
+
 /* RenderEngine registration */
 
 static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
@@ -149,7 +167,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
 	RenderEngineType *et, dummyet = {NULL};
 	RenderEngine dummyengine = {NULL};
 	PointerRNA dummyptr;
-	int have_function[4];
+	int have_function[5];
 
 	/* setup dummy engine & engine type to store static properties in */
 	dummyengine.type = &dummyet;
@@ -160,7 +178,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
 		return NULL;
 
 	if (strlen(identifier) >= sizeof(dummyet.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d",
+		BKE_reportf(reports, RPT_ERROR, "Registering render engine class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummyet.idname));
 		return NULL;
 	}
@@ -188,6 +206,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
 	et->render = (have_function[1]) ? engine_render : NULL;
 	et->view_update = (have_function[2]) ? engine_view_update : NULL;
 	et->view_draw = (have_function[3]) ? engine_view_draw : NULL;
+	et->update_script_node = (have_function[4]) ? engine_update_script_node : NULL;
 
 	BLI_addtail(&R_engines, et);
 
@@ -300,6 +319,13 @@ static void rna_def_render_engine(BlenderRNA *brna)
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
 	RNA_def_pointer(func, "context", "Context", "", "");
 
+	/* shader script callbacks */
+	func = RNA_def_function(srna, "update_script_node", NULL);
+	RNA_def_function_ui_description(func, "Compile shader script node");
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+	prop = RNA_def_pointer(func, "node", "Node", "", "");
+	RNA_def_property_flag(prop, PROP_RNAPTR);
+
 	/* tag for redraw */
 	RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
 	RNA_def_function_ui_description(func, "Request redraw for viewport rendering");
@@ -328,7 +354,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
 	func = RNA_def_function(srna, "end_result", "RE_engine_end_result");
 	prop = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop = RNA_def_boolean(func, "cancel", 0, "Cancel", "Don't merge back results");
+	RNA_def_boolean(func, "cancel", 0, "Cancel", "Don't merge back results");
 
 	func = RNA_def_function(srna, "test_break", "RE_engine_test_break");
 	prop = RNA_def_boolean(func, "do_break", 0, "Break", "");
@@ -344,6 +370,11 @@ static void rna_def_render_engine(BlenderRNA *brna)
 	prop = RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 
+	func = RNA_def_function(srna, "update_memory_stats", "RE_engine_update_memory_stats");
+	RNA_def_float(func, "memory_used", 0, 0.0f, FLT_MAX, "", "Current memory usage in megabytes", 0.0f, FLT_MAX);
+	RNA_def_float(func, "memory_peak", 0, 0.0f, FLT_MAX, "", "Peak memory usage in megabytes", 0.0f, FLT_MAX);
+	RNA_def_property_flag(prop, PROP_REQUIRED);
+
 	func = RNA_def_function(srna, "report", "RE_engine_report");
 	prop = RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index db309ed..7355e46 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -829,7 +829,7 @@ static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, Point
 	int totitem, free = 0;
 	
 	rna_idproperty_check(&prop, ptr);
-	/* eprop= (EnumPropertyRNA *)prop; */
+	/* eprop = (EnumPropertyRNA *)prop; */
 	
 	RNA_property_enum_items(NULL, ptr, prop, &item, &totitem, &free);
 	rna_iterator_array_begin(iter, (void *)item, sizeof(EnumPropertyItem), totitem, free, rna_enum_check_separator);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index a3616e0..6f3a483 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -145,6 +145,11 @@ EnumPropertyItem snap_node_element_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem snap_uv_element_items[] = {
+	{SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
+	{SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
+	{0, NULL, 0, NULL, NULL}
+};
 
 /* workaround for duplicate enums,
  * have each enum line as a defne then conditionally set it or not
@@ -276,6 +281,7 @@ EnumPropertyItem image_color_mode_items[] = {
 EnumPropertyItem image_color_depth_items[] = {
 	/* 1 (monochrome) not used */
 	{R_IMF_CHAN_DEPTH_8,   "8", 0, "8",  "8 bit color channels"},
+	{R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
 	{R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
 	{R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
 	/* 24 not used */
@@ -357,7 +363,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
 	Base *base;
 
 	if (BKE_scene_base_find(scene, ob)) {
-		BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is already in scene \"%s\"", ob->id.name + 2, scene->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2);
 		return NULL;
 	}
 
@@ -389,7 +395,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
 		return;
 	}
 	if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
-		BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in 'Object Mode' to unlink", ob->id.name + 2);
+		BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2);
 		return;
 	}
 	if (scene->basact == base) {
@@ -714,6 +720,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 			                   R_IMF_CHAN_DEPTH_24,
 			                   R_IMF_CHAN_DEPTH_16,
 			                   R_IMF_CHAN_DEPTH_12,
+			                   R_IMF_CHAN_DEPTH_10,
 			                   R_IMF_CHAN_DEPTH_8,
 			                   R_IMF_CHAN_DEPTH_1,
 			                   0};
@@ -811,9 +818,10 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 		const int is_float = ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
 
 		EnumPropertyItem *item_8bit =  &image_color_depth_items[0];
-		EnumPropertyItem *item_12bit = &image_color_depth_items[1];
-		EnumPropertyItem *item_16bit = &image_color_depth_items[2];
-		EnumPropertyItem *item_32bit = &image_color_depth_items[3];
+		EnumPropertyItem *item_10bit = &image_color_depth_items[1];
+		EnumPropertyItem *item_12bit = &image_color_depth_items[2];
+		EnumPropertyItem *item_16bit = &image_color_depth_items[3];
+		EnumPropertyItem *item_32bit = &image_color_depth_items[4];
 
 		int totitem = 0;
 		EnumPropertyItem *item = NULL;
@@ -823,6 +831,10 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 			RNA_enum_item_add(&item, &totitem, item_8bit);
 		}
 
+		if (depth_ok & R_IMF_CHAN_DEPTH_10) {
+			RNA_enum_item_add(&item, &totitem, item_10bit);
+		}
+
 		if (depth_ok & R_IMF_CHAN_DEPTH_12) {
 			RNA_enum_item_add(&item, &totitem, item_12bit);
 		}
@@ -995,8 +1007,7 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi
 	RenderData *rd = (RenderData *)ptr->data;
 
 	*min = 0;
-	*max = BLI_countlist(&rd->layers) - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, BLI_countlist(&rd->layers) - 1);
 }
 
 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
@@ -1026,17 +1037,20 @@ static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), con
 }
 
 static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
-                                   SceneRenderLayer *srl)
+                                   PointerRNA *srl_ptr)
 {
+	SceneRenderLayer *srl = srl_ptr->data;
 	Scene *scene = (Scene *)id;
 
 	if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
-		BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'",
+		BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'",
 		            srl->name, scene->id.name + 2);
+		return;
 	}
-	else {
-		WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
-	}
+
+	RNA_POINTER_INVALIDATE(srl_ptr);
+
+	WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
 }
 
 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
@@ -1114,6 +1128,12 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
 	}
 }
 
+static char *rna_SceneRenderLayer_path(PointerRNA *ptr)
+{
+	SceneRenderLayer *srl = (SceneRenderLayer*)ptr->data;
+	return BLI_sprintfN("render.layers[\"%s\"]", srl->name);
+}
+
 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
 {
 	return (BLI_countlist(&R_engines) > 1);
@@ -1209,9 +1229,12 @@ static void object_simplify_update(Object *ob)
 	ModifierData *md;
 	ParticleSystem *psys;
 
-	for (md = ob->modifiers.first; md; md = md->next)
-		if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem))
-			ob->recalc |= OB_RECALC_DATA | PSYS_RECALC_CHILD;
+	for (md = ob->modifiers.first; md; md = md->next) {
+		if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
+			ob->recalc |= PSYS_RECALC_CHILD;
+			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+		}
+	}
 
 	for (psys = ob->particlesystem.first; psys; psys = psys->next)
 		psys->recalc |= PSYS_RECALC_CHILD;
@@ -1242,6 +1265,12 @@ static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr
 		rna_Scene_use_simplify_update(bmain, scene, ptr);
 }
 
+static void rna_Scene_use_persistent_data_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
+{
+	if (!(scene->r.mode & R_PERSISTENT_DATA))
+		RE_FreePersistentData();
+}
+
 static int rna_Scene_use_audio_get(PointerRNA *ptr)
 {
 	Scene *scene = (Scene *)ptr->data;
@@ -1323,15 +1352,16 @@ static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
 	return marker;
 }
 
-static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *marker)
+static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
 {
-	if (!BLI_remlink_safe(&scene->markers, marker)) {
-		BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
+	TimeMarker *marker = marker_ptr->data;
+	if (BLI_remlink_safe(&scene->markers, marker) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
 		return;
 	}
 
-	/* XXX, invalidates PyObject */
 	MEM_freeN(marker);
+	RNA_POINTER_INVALIDATE(marker_ptr);
 
 	WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
 	WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
@@ -1357,7 +1387,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons
 		return ks;
 	}
 	else {
-		BKE_report(reports, RPT_ERROR, "Keying Set could not be added");
+		BKE_report(reports, RPT_ERROR, "Keying set could not be added");
 		return NULL;
 	}
 }
@@ -1404,6 +1434,12 @@ static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
 		DAG_id_tag_update(&camera->id, 0);
 }
 
+static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+	BKE_sequencer_cache_cleanup();
+	BKE_sequencer_preprocessed_cache_cleanup();
+}
+
 #else
 
 static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -1611,6 +1647,13 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 	RNA_def_property_enum_items(prop, snap_node_element_items);
 	RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
 	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+	
+	/* image editor uses own set of snap modes */
+	prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "snap_uv_mode");
+	RNA_def_property_enum_items(prop, snap_uv_element_items);
+	RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
+	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
 	prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "snap_target");
@@ -2750,6 +2793,7 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "SceneRenderLayer", NULL);
 	RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
 	RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
+	RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path");
 
 	rna_def_render_layer_common(srna, 1);
 }
@@ -2796,7 +2840,8 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a render layer");
 	RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
 	parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 /* use for render output and image save operator,
@@ -2888,7 +2933,6 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 
 #endif
 
-
 #ifdef WITH_OPENJPEG
 	/* Jpeg 2000 */
 	prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
@@ -2910,7 +2954,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 	/* Cineon and DPX */
 
 	prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_CINEON_LOG);
+	RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_IMF_CINEON_FLAG_LOG);
 	RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
@@ -3106,7 +3150,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Volume", "Audio volume");
-	RNA_def_property_translation_context(prop, "Audio");
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 #endif
 
@@ -3375,16 +3419,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 	
-	prop = RNA_def_property(srna, "parts_x", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "xparts");
-	RNA_def_property_range(prop, 1, 512);
-	RNA_def_property_ui_text(prop, "Parts X", "Number of horizontal tiles to use while rendering");
+	prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "tilex");
+	RNA_def_property_range(prop, 8, 10000);
+	RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 	
-	prop = RNA_def_property(srna, "parts_y", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "yparts");
-	RNA_def_property_range(prop, 1, 512);
-	RNA_def_property_ui_text(prop, "Parts Y", "Number of vertical tiles to use while rendering");
+	prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "tiley");
+	RNA_def_property_range(prop, 8, 10000);
+	RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 	
 	prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
@@ -3600,14 +3644,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
 	RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	
 	prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mblur_samples");
 	RNA_def_property_range(prop, 1, 32);
 	RNA_def_property_ui_text(prop, "Motion Samples", "Number of scene samples to take with motion blur");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	
 	prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blurfac");
@@ -3615,7 +3659,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_ui_range(prop, 0.01, 2.0f, 1, 0);
 	RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	
 	/* border */
 	prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
@@ -3929,16 +3973,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "use_sequencer_gl_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_PREV);
 	RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
+	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
 
+#if 0  /* see R_SEQ_GL_REND comment */
 	prop = RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_REND);
 	RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
-
+#endif
 
 	prop = RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "seq_prev_type");
 	RNA_def_property_enum_items(prop, viewport_shade_items);
 	RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
+	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
 
 	prop = RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "seq_rend_type");
@@ -4015,6 +4062,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", R_SIMPLE_NO_TRIANGULATE);
 	RNA_def_property_ui_text(prop, "Skip Quad to Triangles", "Disable non-planar quads being triangulated");
 
+	/* persistent data */
+	prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);
+	RNA_def_property_ui_text(prop, "Persistent Data", "Keep render data around for faster re-renders");
+	RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update");
+
 	/* Scene API */
 	RNA_api_scene_render(srna);
 }
@@ -4106,7 +4159,8 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove a timeline marker");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_TimeLine_clear");
 	RNA_def_function_ui_description(func, "Remove all timeline markers");
@@ -4518,7 +4572,7 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "audio.volume");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Volume", "Audio volume");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
 
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index cdf7ac5..012767b 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -53,7 +53,7 @@
 
 
 
-void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
+static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
 {
 	scene->r.cfra = frame;
 	scene->r.subframe = subframe;
@@ -62,12 +62,16 @@ void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
 	BKE_scene_update_for_newframe(G.main, scene, (1 << 20) - 1);
 	BKE_scene_camera_switch_update(scene);
 
-	/* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
-	 * BKE_scene_update_for_newframe which will loose any un-keyed changes [#24690] */
-	/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
-	
-	/* instead just redraw the views */
-	WM_main_add_notifier(NC_WINDOW, NULL);
+	/* don't do notifier when we're rendering, avoid some viewport crashes
+	 * redrawing while the data is being modified for render */
+	if (!G.is_rendering) {
+		/* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
+		 * BKE_scene_update_for_newframe which will loose any un-keyed changes [#24690] */
+		/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
+		
+		/* instead just redraw the views */
+		WM_main_add_notifier(NC_WINDOW, NULL);
+	}
 }
 
 static void rna_Scene_update_tagged(Scene *scene)
@@ -89,29 +93,29 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
 #include "../../collada/collada.h"
 
 static void rna_Scene_collada_export(
-    Scene *scene,
-    const char *filepath,
-    int apply_modifiers,
-	int export_mesh_type,
-
-	int selected,
-    int include_children,
-    int include_armatures,
-    int deform_bones_only,
-
-	int active_uv_only,
-	int include_uv_textures,
-	int include_material_textures,
-	int use_texture_copies,
-
-    int use_object_instantiation,
-    int sort_by_name,
-    int second_life)
+        Scene *scene,
+        const char *filepath,
+        int apply_modifiers,
+        int export_mesh_type,
+
+        int selected,
+        int include_children,
+        int include_armatures,
+        int deform_bones_only,
+
+        int active_uv_only,
+        int include_uv_textures,
+        int include_material_textures,
+        int use_texture_copies,
+
+        int use_object_instantiation,
+        int sort_by_name,
+        int second_life)
 {
-	collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,  
+	collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
 	               include_children, include_armatures, deform_bones_only,
-				   active_uv_only, include_uv_textures, include_material_textures,
-				   use_texture_copies, use_object_instantiation, sort_by_name, second_life);
+	               active_uv_only, include_uv_textures, include_material_textures,
+	               use_texture_copies, use_object_instantiation, sort_by_name, second_life);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 58d6765..84e76fa 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -60,6 +60,8 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = {
 #include "BKE_particle.h"
 #include "BKE_depsgraph.h"
 
+#include "BLI_pbvh.h"
+
 #include "ED_particle.h"
 
 static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = {
@@ -206,6 +208,21 @@ static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNU
 	}
 }
 
+static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+	Object *ob = (scene->basact) ? scene->basact->object : NULL;
+
+	if (ob) {
+		Sculpt *sd = scene->toolsettings->sculpt;
+		ob->sculpt->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
+
+		if (ob->sculpt->pbvh)
+			pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color);
+
+		WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+	}
+}
+
 #else
 
 static void rna_def_paint(BlenderRNA *brna)
@@ -297,6 +314,12 @@ static void rna_def_sculpt(BlenderRNA  *brna)
 	                         "Use only deformation modifiers (temporary disable all "
 	                         "constructive modifiers except multi-resolution)");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
+
+	prop = RNA_def_property(srna, "show_diffuse_color", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SHOW_DIFFUSE);
+	RNA_def_property_ui_text(prop, "Show Diffuse Color",
+	                         "Show diffuse color of object and overlay sculpt mask on top of it");
+	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
 }
 
 
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index d8ca1ae..18a9b96 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -966,18 +966,20 @@ static SequenceModifierData *rna_Sequence_modifier_new(Sequence *seq, bContext *
 	}
 }
 
-static void rna_Sequence_modifier_remove(Sequence *seq, bContext *C, ReportList *reports, SequenceModifierData *smd)
+static void rna_Sequence_modifier_remove(Sequence *seq, bContext *C, ReportList *reports, PointerRNA *smd_ptr)
 {
+	SequenceModifierData *smd = smd_ptr->data;
 	Scene *scene = CTX_data_scene(C);
 
-	if (BKE_sequence_modifier_remove(seq, smd)) {
-		BKE_sequence_invalidate_cache_for_modifier(scene, seq);
-
-		WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
-	}
-	else {
+	if (BKE_sequence_modifier_remove(seq, smd) == FALSE) {
 		BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack");
+		return;
 	}
+
+	RNA_POINTER_INVALIDATE(smd_ptr);
+	BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+
+	WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
 }
 
 static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C)
@@ -1267,7 +1269,8 @@ static void rna_def_sequence_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove an existing modifier from the sequence");
 	/* modifier to remove */
 	parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Modifier to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* clear all modifiers */
 	func = RNA_def_function(srna, "clear", "rna_Sequence_modifier_clear");
@@ -1685,6 +1688,16 @@ static void rna_def_effect_inputs(StructRNA *srna, int count)
 #endif
 }
 
+static void rna_def_color_management(StructRNA *srna)
+{
+	PropertyRNA *prop;
+
+	prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "strip->colorspace_settings");
+	RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings");
+	RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
+}
+
 static void rna_def_image(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -1711,6 +1724,7 @@ static void rna_def_image(BlenderRNA *brna)
 	rna_def_filter_video(srna);
 	rna_def_proxy(srna);
 	rna_def_input(srna);
+	rna_def_color_management(srna);
 }
 
 static void rna_def_meta(BlenderRNA *brna)
@@ -1796,6 +1810,7 @@ static void rna_def_movie(BlenderRNA *brna)
 	rna_def_filter_video(srna);
 	rna_def_proxy(srna);
 	rna_def_input(srna);
+	rna_def_color_management(srna);
 }
 
 static void rna_def_movieclip(BlenderRNA *brna)
@@ -1860,7 +1875,7 @@ static void rna_def_sound(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "volume");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 
@@ -1868,7 +1883,7 @@ static void rna_def_sound(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "pitch");
 	RNA_def_property_range(prop, 0.1f, 10.0f);
 	RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index f63ef6c..7602ec9 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -89,6 +89,8 @@ static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int start
 	if (file) {
 		strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
 		BLI_split_dirfile(file, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
+
+		BKE_sequence_init_colorspace(seq);
 	}
 	else {
 		strip->stripdata = NULL;
@@ -234,9 +236,10 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor
 }
 #else /* WITH_AUDASPACE */
 static Sequence *rna_Sequences_new_sound(ID *UNUSED(id), Editing *UNUSED(ed), Main *UNUSED(bmain), ReportList *reports,
-                                         const char *UNUSED(name), const char *UNUSED(file), int UNUSED(channel), int UNUSED(start_frame))
+                                         const char *UNUSED(name), const char *UNUSED(file), int UNUSED(channel),
+                                         int UNUSED(start_frame))
 {
-	BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support.");
+	BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
 	return NULL;
 }
 #endif /* WITH_AUDASPACE */
@@ -249,39 +252,37 @@ static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *repor
 	Scene *scene = (Scene *)id;
 	Sequence *seq;
 	struct SeqEffectHandle sh;
+	int num_inputs = BKE_sequence_effect_get_num_inputs(type);
 
-	switch (BKE_sequence_effect_get_num_inputs(type)) {
+	switch (num_inputs) {
 		case 0:
 			if (end_frame <= start_frame) {
-				BKE_report(reports, RPT_ERROR,
-				           "Sequences.new_effect: End frame not set");
+				BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
 				return NULL;
 			}
 			break;
 		case 1:
 			if (seq1 == NULL) {
-				BKE_report(reports, RPT_ERROR,
-				           "Sequences.new_effect: Effect takes 1 input sequence");
+				BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
 				return NULL;
 			}
 			break;
 		case 2:
 			if (seq1 == NULL || seq2 == NULL) {
-				BKE_report(reports, RPT_ERROR,
-				           "Sequences.new_effect: Effect takes 2 input sequences");
+				BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
 				return NULL;
 			}
 			break;
 		case 3:
 			if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
-				BKE_report(reports, RPT_ERROR,
-				           "Sequences.new_effect: Effect takes 3 input sequences");
+				BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
 				return NULL;
 			}
 			break;
 		default:
-			BKE_report(reports, RPT_ERROR,
-			           "Sequences.new_effect: BKE_sequence_effect_get_num_inputs() > 3 (should never happen)");
+			BKE_reportf(reports, RPT_ERROR,
+			            "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
+			            num_inputs);
 			return NULL;
 	}
 
@@ -309,12 +310,18 @@ static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *repor
 	return seq;
 }
 
-static void rna_Sequences_remove(ID *id, Editing *ed, Sequence *seq)
+static void rna_Sequences_remove(ID *id, Editing *ed, ReportList *reports, PointerRNA *seq_ptr)
 {
+	Sequence *seq = seq_ptr->data;
 	Scene *scene = (Scene *)id;
 
-	BLI_remlink(&ed->seqbase, seq);
+	if (BLI_remlink_safe(&ed->seqbase, seq) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
+		return;
+	}
+
 	BKE_sequence_free(scene, seq);
+	RNA_POINTER_INVALIDATE(seq_ptr);
 
 	WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
 }
@@ -342,7 +349,7 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports,
 	StripElem *new_seq, *se;
 
 	if (seq->len == 1) {
-		BKE_report(reports, RPT_ERROR, "SequenceElements.pop: can not pop the last element");
+		BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
 		return;
 	}
 
@@ -456,7 +463,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new_clip", "rna_Sequences_new_clip");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a new movie clip sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
@@ -472,8 +479,8 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 
 	func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
-	RNA_def_function_ui_description(func, "Add a new movie clip sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	RNA_def_function_ui_description(func, "Add a new mask sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
@@ -490,7 +497,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a new scene sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
@@ -507,7 +514,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new_image", "rna_Sequences_new_image");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a new image sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -524,7 +531,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a new movie sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -540,8 +547,8 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 
 	func = RNA_def_function(srna, "new_sound", "rna_Sequences_new_sound");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN);
-	RNA_def_function_ui_description(func, "Add a new movie clip sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	RNA_def_function_ui_description(func, "Add a new sound sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -558,7 +565,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new_effect", "rna_Sequences_new_effect");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a new effect sequence");
-	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type",
 	                    "type for the new sequence");
@@ -569,21 +576,22 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
 	parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "",
 	                   "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_int(func, "end_frame", 0, -MAXFRAME, MAXFRAME, "",
-	                   "The end frame for the new sequence", -MAXFRAME, MAXFRAME);
-	parm = RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
-	parm = RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
-	parm = RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
+	RNA_def_int(func, "end_frame", 0, -MAXFRAME, MAXFRAME, "",
+	            "The end frame for the new sequence", -MAXFRAME, MAXFRAME);
+	RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
+	RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
+	RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
 	/* return type */
 	parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
 	RNA_def_function_return(func, parm);
 
 
 	func = RNA_def_function(srna, "remove", "rna_Sequences_remove");
-	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+	RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove a Sequence");
 	parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index e881824..bdcda79 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -65,14 +65,20 @@ static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *p
 	DAG_scene_sort(bmain, scene);
 }
 
+static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+	if (settings->smd && settings->smd->domain)
+		settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
+	DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+}
+
 static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
 
 	smokeModifier_reset(settings->smd);
-
-	if (settings->smd && settings->smd->domain)
-		settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
+	rna_Smoke_resetCache(bmain, scene, ptr);
 
 	rna_Smoke_update(bmain, scene, ptr);
 }
@@ -142,6 +148,30 @@ static void rna_SmokeModifier_density_get(PointerRNA *ptr, float *values)
 	memcpy(values, density, size * sizeof(float));
 }
 
+static void rna_SmokeFlow_density_vgroup_get(PointerRNA *ptr, char *value)
+{
+	SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+	rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
+}
+
+static int rna_SmokeFlow_density_vgroup_length(PointerRNA *ptr)
+{
+	SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+	return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
+}
+
+static void rna_SmokeFlow_density_vgroup_set(PointerRNA *ptr, const char *value)
+{
+	SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+	rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
+}
+
+static void rna_SmokeFlow_uvlayer_set(PointerRNA *ptr, const char *value)
+{
+	SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+	rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
+}
+
 #else
 
 static void rna_def_smoke_domain_settings(BlenderRNA *brna)
@@ -217,7 +247,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
 	RNA_def_property_ui_text(prop, "Density",
 	                         "How much density affects smoke motion (higher value results in faster rising smoke)");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "beta");
@@ -225,7 +255,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
 	RNA_def_property_ui_text(prop, "Heat",
 	                         "How much heat affects smoke motion (higher value results in faster rising smoke)");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
@@ -253,24 +283,24 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "diss_speed");
 	RNA_def_property_range(prop, 1.0, 10000.0);
 	RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE);
 	RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG);
 	RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -297,21 +327,21 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "smooth_emitter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGH_SMOOTH);
 	RNA_def_property_ui_text(prop, "Smooth Emitter", "Smooth emitted smoke to avoid blockiness");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "time_scale");
 	RNA_def_property_range(prop, 0.2, 1.5);
 	RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5);
 	RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vorticity");
 	RNA_def_property_range(prop, 0.01, 4.0);
 	RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5);
 	RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
-	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
 	prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_array(prop, 32);
@@ -321,25 +351,81 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Density", "Smoke density");
 
-	prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "dx");
+	prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "dx", "Cell Size");
+	RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
 
-	prop = RNA_def_property(srna, "start_point", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "start_point", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
 	RNA_def_property_float_sdna(prop, NULL, "p0");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "p0", "Start point");
 
-	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "scale");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "scale", "Domain scale factor");
-
-	prop = RNA_def_property(srna, "domain_resolution", PROP_INT, PROP_XYZ);
+	prop = RNA_def_property(srna, "domain_resolution", PROP_INT, PROP_XYZ); /* can change each frame when using adaptive domain */
 	RNA_def_property_int_sdna(prop, NULL, "res");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
+
+	prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.01, 4.0);
+	RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 8.0);
+	RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 2.0);
+	RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.5, 5.0);
+	RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 1.0, 10.0);
+	RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN);
+	RNA_def_property_ui_text(prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "adapt_res");
+	RNA_def_property_range(prop, 0, 512);
+	RNA_def_property_ui_range(prop, 0, 512, 2, 0);
+	RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
+	RNA_def_property_range(prop, 2, 24);
+	RNA_def_property_ui_range(prop, 2, 24, 2, 0);
+	RNA_def_property_ui_text(prop, "Margin", "Margin added around fluid to minimize boundary interference");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+	prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.01, 0.5);
+	RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Threshold",
+	                         "Maximum amount of fluid cell can contain before it is considered empty");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 }
 
 static void rna_def_smoke_flow_settings(BlenderRNA *brna)
@@ -347,6 +433,26 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
+	static EnumPropertyItem smoke_flow_types[] = {
+		{MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"},
+		{MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
+		{MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
+		{MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	static EnumPropertyItem smoke_flow_sources[] = {
+		{MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"},
+		{MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	static EnumPropertyItem smoke_flow_texture_types[] = {
+		{MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, "AUTO", 0, "Generated", "Generated coordinates centered to flow object"},
+		{MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL);
 	RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings");
 	RNA_def_struct_sdna(srna, "SmokeFlowSettings");
@@ -354,11 +460,23 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "density");
-	RNA_def_property_range(prop, 0.001, 1);
-	RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4);
+	RNA_def_property_range(prop, 0.0, 1);
+	RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
 	RNA_def_property_ui_text(prop, "Density", "");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
+	prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "color");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 10);
+	RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
+	RNA_def_property_ui_text(prop, "Flame Rate", "");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
 	prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "temp");
 	RNA_def_property_range(prop, -10, 10);
@@ -373,9 +491,16 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
 	RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependancy");
 
-	prop = RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW);
-	RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation");
+	prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "type");
+	RNA_def_property_enum_items(prop, smoke_flow_types);
+	RNA_def_property_ui_text(prop, "Flow Type", "Change how flow affects the simulation");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "source");
+	RNA_def_property_enum_items(prop, smoke_flow_sources);
+	RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
 	prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
@@ -385,14 +510,82 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY);
-	RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle");
+	RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke has some initial velocity when it is emitted");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 
 	prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vel_multi");
 	RNA_def_property_range(prop, -2.0, 2.0);
 	RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
-	RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke");
+	RNA_def_property_ui_text(prop, "Source", "Multiplier of source velocity passed to smoke");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "vel_normal");
+	RNA_def_property_range(prop, -2.0, 2.0);
+	RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "vel_random");
+	RNA_def_property_range(prop, 0.0, 2.0);
+	RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.5, 10.0);
+	RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_SmokeFlow_density_vgroup_get",
+	                              "rna_SmokeFlow_density_vgroup_length",
+	                              "rna_SmokeFlow_density_vgroup_set");
+	RNA_def_property_ui_text(prop, "Vertex Group",
+	                         "Name of vertex group which determines surface emission rate");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_TEXTUREEMIT);
+	RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "texture_type");
+	RNA_def_property_enum_items(prop, smoke_flow_texture_types);
+	RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+	RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmokeFlow_uvlayer_set");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.01, 10.0);
+	RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+	prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 200.0);
+	RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
+	RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
 }
 
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index bfd0f73..2b2e8d9 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -336,6 +336,15 @@ static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
 	copy_v3_v3(cursor, values);
 }
 
+static float rna_View3D_GridScaleUnit_get(PointerRNA *ptr)
+{
+	View3D *v3d = (View3D *)(ptr->data);
+	bScreen *sc = (bScreen *)ptr->id.data;
+	Scene *scene = (Scene *)sc->scene;
+
+	return ED_view3d_grid_scale(scene, v3d, NULL);
+}
+
 static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
 {
 	View3D *v3d = (View3D *)(ptr->data);
@@ -589,7 +598,7 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUS
 	alpha = ibuf && (ibuf->channels == 4);
 	zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1));
 
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 
 	if (alpha && zbuf)
 		return draw_channels_items;
@@ -669,7 +678,7 @@ static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene
 		scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
 		WM_main_add_notifier(NC_IMAGE, sima->image);
 	}
-	ED_space_image_release_buffer(sima, lock);
+	ED_space_image_release_buffer(sima, ibuf, lock);
 }
 
 /* Space Text Editor */
@@ -949,15 +958,17 @@ static BGpic *rna_BackgroundImage_new(View3D *v3d)
 	return bgpic;
 }
 
-static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, BGpic *bgpic)
+static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, PointerRNA *bgpic_ptr)
 {
+	BGpic *bgpic = bgpic_ptr->data;
 	if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) {
-		BKE_report(reports, RPT_ERROR, "BackgroundImage can't be removed");
-	}
-	else {
-		ED_view3D_background_image_remove(v3d, bgpic);
-		WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
+		BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
 	}
+
+	ED_view3D_background_image_remove(v3d, bgpic);
+	RNA_POINTER_INVALIDATE(bgpic_ptr);
+
+	WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
 }
 
 static void rna_BackgroundImage_clear(View3D *v3d)
@@ -1442,7 +1453,8 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Remove background image");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "clear", "rna_BackgroundImage_clear");
 	RNA_def_function_ui_description(func, "Remove all background images");
@@ -1494,7 +1506,39 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Camera",
 	                         "Active camera used in this view (when unlocked from the scene's active camera)");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-	
+
+	/* render border */
+	prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Render Border",
+	                         "Use a user-defined border region within the frame size for rendered viewport");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "render_border.xmin");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value to for the render border");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "render_border_min_y", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "render_border.ymin");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "render_border_max_x", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "render_border.xmax");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "render_border_max_y", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "render_border.ymax");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
 	prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
@@ -1533,7 +1577,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	
 	prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lens");
-	RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view");
+	RNA_def_property_ui_text(prop, "Lens", "Viewport lens angle (mm)");
 	RNA_def_property_range(prop, 1.0f, 250.0f);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 	
@@ -1571,7 +1615,12 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	RNA_def_property_range(prop, 1, 1024);
 	RNA_def_property_int_default(prop, 10);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-	
+
+	prop = RNA_def_property(srna, "grid_scale_unit", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_float_funcs(prop, "rna_View3D_GridScaleUnit_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Grid Scale Unit", "Grid cell size scaled by scene unit system settings");
+
 	prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
 	RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
@@ -2780,6 +2829,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
 	RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
+	prop = RNA_def_property(srna, "use_filter_backup", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE_BACKUP);
+	RNA_def_property_ui_text(prop, "Filter BlenderBackup files", "Show .blend1, .blend2, etc. files");
+	RNA_def_property_ui_icon(prop, ICON_FILE_BACKUP, 0);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
 	prop = RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE);
 	RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");
@@ -2921,10 +2976,9 @@ static void rna_def_space_node(BlenderRNA *brna)
 		{SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
 		                  "Draw image with RGB colors and alpha transparency"},
 		{SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
-		                        /* XXX, we could use better icons here  */
-		{SNODE_SHOW_R, "RED",   ICON_COLOR, "Red", ""},
-		{SNODE_SHOW_G, "GREEN", ICON_COLOR, "Green", ""},
-		{SNODE_SHOW_B, "BLUE",  ICON_COLOR, "Blue", ""},
+		{SNODE_SHOW_R, "RED",   ICON_COLOR_RED, "Red", ""},
+		{SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
+		{SNODE_SHOW_B, "BLUE",  ICON_COLOR_BLUE, "Blue", ""},
 		{0, NULL, 0, NULL, NULL}
 	};
 
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index a160aaf..1395821 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -152,7 +152,7 @@ static void rna_def_speaker(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "volume");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */
 	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
@@ -160,7 +160,7 @@ static void rna_def_speaker(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "pitch");
 	RNA_def_property_range(prop, 0.1f, 10.0f);
 	RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
-	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+	RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
 	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */
 	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index e46373b..b1637ef 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -129,49 +129,6 @@ static void rna_def_text_line(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL);
 }
 
-static void rna_def_text_marker(BlenderRNA *brna)
-{
-	StructRNA *srna;
-	PropertyRNA *prop;
-	
-	srna = RNA_def_struct(brna, "TextMarker", NULL);
-	RNA_def_struct_ui_text(srna, "Text Marker", "Marker highlighting a portion of text in a Text datablock");
-
-	prop = RNA_def_property(srna, "line", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_sdna(prop, NULL, "lineno");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Line", "Line in which the marker is located");
-	
-	prop = RNA_def_property(srna, "character_index_start", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_sdna(prop, NULL, "start");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Start", "Start position of the marker in the line");
-
-	prop = RNA_def_property(srna, "character_index_end", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_sdna(prop, NULL, "end");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "End", "Start position of the marker in the line");
-	
-	prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_range(prop, 0, (int)0xFFFF);
-	RNA_def_property_ui_text(prop, "Group", "");
-	
-	prop = RNA_def_property(srna, "is_temporary", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flags", TMARK_TEMP);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Temporary", "Marker is temporary");
-
-	prop = RNA_def_property(srna, "use_edit_all", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flags", TMARK_EDITALL);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Edit All", "Edit all markers of the same group as one");
-	
-	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
-	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Color", "Color to display the marker with");
-}
-
 static void rna_def_text(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -241,17 +198,12 @@ static void rna_def_text(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Selection End Character",
 	                         "Index of character after end of selection in the selection end line");
 	
-	prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_struct_type(prop, "TextMarker");
-	RNA_def_property_ui_text(prop, "Markers", "Text markers highlighting part of the text");
-
 	RNA_api_text(srna);
 }
 
 void RNA_def_text(BlenderRNA *brna)
 {
 	rna_def_text_line(brna);
-	rna_def_text_marker(brna);
 	rna_def_text(brna);
 }
 
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 202c53c..bdf9fa4 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -46,6 +46,9 @@
 
 #include "BKE_node.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 EnumPropertyItem texture_filter_items[] = {
 	{TXF_BOX, "BOX", 0, "Box", ""},
 	{TXF_EWA, "EWA", 0, "EWA", ""},
@@ -110,9 +113,6 @@ EnumPropertyItem blend_type_items[] = {
 
 #include "ED_node.h"
 
-#include "WM_api.h"
-#include "WM_types.h"
-
 static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
 {
 	Tex *tex = (Tex *)ptr->data;
@@ -233,6 +233,7 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
 			break;
 		case ID_LA:
 			WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id);
+			WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
 			break;
 		case ID_BR:
 			WM_main_add_notifier(NC_BRUSH, id);
@@ -263,19 +264,24 @@ char *rna_TextureSlot_path(PointerRNA *ptr)
 	 * may be used multiple times in the same stack
 	 */
 	if (ptr->id.data) {
-		PointerRNA id_ptr;
-		PropertyRNA *prop;
-		
-		/* find the 'textures' property of the ID-struct */
-		RNA_id_pointer_create(ptr->id.data, &id_ptr);
-		prop = RNA_struct_find_property(&id_ptr, "texture_slots");
-		
-		/* get an iterator for this property, and try to find the relevant index */
-		if (prop) {
-			int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
-			
-			if (index >= 0)
-				return BLI_sprintfN("texture_slots[%d]", index);
+		if (GS(((ID *)ptr->id.data)->name) == ID_BR) {
+			return BLI_strdup("texture_slot");
+		}
+		else {
+			PointerRNA id_ptr;
+			PropertyRNA *prop;
+
+			/* find the 'textures' property of the ID-struct */
+			RNA_id_pointer_create(ptr->id.data, &id_ptr);
+			prop = RNA_struct_find_property(&id_ptr, "texture_slots");
+
+			/* get an iterator for this property, and try to find the relevant index */
+			if (prop) {
+				int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
+
+				if (index >= 0)
+					return BLI_sprintfN("texture_slots[%d]", index);
+			}
 		}
 	}
 	
@@ -602,7 +608,7 @@ static void rna_def_mtex(BlenderRNA *brna)
 	RNA_def_property_struct_type(prop, "Texture");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture", "Texture datablock used by this texture slot");
-	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
 
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
@@ -1800,7 +1806,8 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
 	};
 
 	static EnumPropertyItem smoked_type_items[] = {
-		{TEX_VD_SMOKEDENSITY, "SMOKEDENSITY", 0, "Density", "Use smoke density as texture data"},
+		{TEX_VD_SMOKEDENSITY, "SMOKEDENSITY", 0, "Smoke", "Use smoke density and color as texture data"},
+		{TEX_VD_SMOKEFLAME, "SMOKEFLAME", 0, "Flame", "Use flame temperature as texture data"},
 		{TEX_VD_SMOKEHEAT, "SMOKEHEAT", 0, "Heat", "Use smoke heat as texture data. Values from -2.0 to 2.0 are used"},
 		{TEX_VD_SMOKEVEL, "SMOKEVEL", 0, "Velocity", "Use smoke velocity as texture data"},
 		{0, NULL, 0, NULL, NULL}
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index a288051..5be9d3a 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -120,10 +120,10 @@ void RNA_api_environment_map(StructRNA *srna)
 
 	RNA_def_pointer(func, "scene", "Scene", "", "Overrides the scene from which image parameters are taken");
 
-	RNA_def_float_array(func, "layout", 12, default_layout, 0.0f, 0.0f, "File layout",
+	RNA_def_float_array(func, "layout", 12, default_layout, 0.0f, 1000.0f, "File layout",
 	                    "Flat array describing the X,Y position of each cube face in the "
 	                    "output image, where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] "
-	                    "(use -1 to skip a face)", 0.0f, 0.0f);
+	                    "(use -1 to skip a face)", 0.0f, 1000.0f);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 4b744b1..4aefaf9 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -35,6 +35,7 @@
 #include "BKE_movieclip.h"
 #include "BKE_tracking.h"
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -119,8 +120,7 @@ static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, in
 	MovieClip *clip = (MovieClip *)ptr->id.data;
 
 	*min = 0;
-	*max = clip->tracking.tot_object - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, clip->tracking.tot_object - 1);
 }
 
 static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
@@ -262,8 +262,7 @@ static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min
 	MovieClip *clip = (MovieClip *)ptr->id.data;
 
 	*min = 0;
-	*max = clip->tracking.stabilization.tot_track - 1;
-	*max = MAX2(0, *max);
+	*max = max_ii(0, clip->tracking.stabilization.tot_track - 1);
 }
 
 static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
@@ -447,9 +446,15 @@ static MovieTrackingObject *rna_trackingObject_new(MovieTracking *tracking, cons
 	return object;
 }
 
-static void rna_trackingObject_remove(MovieTracking *tracking, MovieTrackingObject *object)
+static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *reports, PointerRNA *object_ptr)
 {
-	BKE_tracking_object_delete(tracking, object);
+	MovieTrackingObject *object = object_ptr->data;
+	if (BKE_tracking_object_delete(tracking, object) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "MovieTracking '%s' cannot be removed", object->name);
+		return;
+	}
+
+	RNA_POINTER_INVALIDATE(object_ptr);
 
 	WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
 }
@@ -567,6 +572,22 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	                         "Limit speed of tracking to make visual feedback easier "
 	                         "(this does not affect the tracking quality)");
 
+	/* reconstruction success_threshold */
+	prop = RNA_def_property(srna, "reconstruction_success_threshold", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_float_default(prop, 0.001f);
+	RNA_def_property_range(prop, 0, FLT_MAX);
+	RNA_def_property_ui_text(prop, "Success Threshold",
+	                         "Threshold value of reconstruction error which is still considered successful");
+
+	/* use fallback reconstruction */
+	prop = RNA_def_property(srna, "use_fallback_reconstruction", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_boolean_sdna(prop, NULL, "reconstruction_flag", TRACKING_USE_FALLBACK_RECONSTRUCTION);
+	RNA_def_property_ui_text(prop, "Use Fallback",
+	                         "Use fallback reconstruction algorithm in cases main reconstruction algorithm failed "
+	                         "(could give better solution with bad tracks)");
+
 	/* intrinsics refinement during bundle adjustment */
 	prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
@@ -616,7 +637,8 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
-	RNA_def_property_ui_text(prop, "Tripod Motion", "Use special solver to track a stable camera position, such as a tripod");
+	RNA_def_property_ui_text(prop, "Tripod Motion",
+	                         "Use special solver to track a stable camera position, such as a tripod");
 
 	/* default_limit_frames */
 	prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
@@ -656,7 +678,9 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	/* default_use_brute */
 	prop = RNA_def_property(srna, "use_default_mask", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
-	RNA_def_property_ui_text(prop, "Use Mask", "Use a grease pencil datablock as a mask to use only specified areas of pattern when tracking");
+	RNA_def_property_ui_text(prop, "Use Mask",
+	                         "Use a grease pencil datablock as a mask to use only specified areas of pattern "
+	                         "when tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
 	/* default_use_normalization */
@@ -897,8 +921,8 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
 	parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
 	                   "Frame number to find marker for", MINFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_boolean(func, "exact", TRUE, "Exact",
-	                       "Get marker at exact frame number rather than get estimated marker");
+	RNA_def_boolean(func, "exact", TRUE, "Exact",
+	                "Get marker at exact frame number rather than get estimated marker");
 	parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
 	RNA_def_function_return(func, parm);
 
@@ -993,7 +1017,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
 	/* use_brute */
 	prop = RNA_def_property(srna, "use_mask", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
-	RNA_def_property_ui_text(prop, "Use Mask", "Use a grease pencil datablock as a mask to use only specified areas of pattern when tracking");
+	RNA_def_property_ui_text(prop, "Use Mask",
+	                         "Use a grease pencil datablock as a mask to use only specified areas of pattern "
+	                         "when tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
 	/* use_normalization */
@@ -1416,8 +1442,11 @@ static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_return(func, parm);
 
 	func = RNA_def_function(srna, "remove", "rna_trackingObject_remove");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove tracking object from this movie clip");
-	RNA_def_pointer(func, "object", "MovieTrackingObject", "", "Motion tracking object to be removed");
+	parm = RNA_def_pointer(func, "object", "MovieTrackingObject", "", "Motion tracking object to be removed");
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	/* active object */
 	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
@@ -1437,7 +1466,8 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna)
 		{TRACKING_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
 		{TRACKING_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"},
 		{TRACKING_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
-		{TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error", "Sort channels by average reprojection error of tracks after solve"},
+		{TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error",
+		                                   "Sort channels by average reprojection error of tracks after solve"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 70d94bf..a0a9f61 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -85,7 +85,7 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re
 	
 	/* region type not found? abort */
 	if (art == NULL) {
-		BKE_report(reports, RPT_ERROR, "Region not found in spacetype");
+		BKE_report(reports, RPT_ERROR, "Region not found in space type");
 		return NULL;
 	}
 
@@ -192,7 +192,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 		return NULL;
 		
 	if (strlen(identifier) >= sizeof(dummypt.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "registering panel class: '%s' is too long, maximum length is %d",
+		BKE_reportf(reports, RPT_ERROR, "Registering panel class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummypt.idname));
 		return NULL;
 	}
@@ -309,7 +309,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
 		return NULL;
 
 	if (strlen(identifier) >= sizeof(dummyht.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "registering header class: '%s' is too long, maximum length is %d",
+		BKE_reportf(reports, RPT_ERROR, "Registering header class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummyht.idname));
 		return NULL;
 	}
@@ -438,7 +438,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
 		return NULL;
 	
 	if (strlen(identifier) >= sizeof(dummymt.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "registering menu class: '%s' is too long, maximum length is %d",
+		BKE_reportf(reports, RPT_ERROR, "Registering menu class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummymt.idname));
 		return NULL;
 	}
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 006e1ad..548539e 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -236,41 +236,41 @@ void RNA_api_ui_layout(StructRNA *srna)
 	/* useful in C but not in python */
 #if 0
 
-	func= RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
+	func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
 	api_ui_item_op_common(func);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_string(func, "value", "", 0, "", "Enum property value");
+	parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
+	func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
 	api_ui_item_op_common(func);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
+	parm = RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
 	RNA_def_property_flag(parm, PROP_REQUIRED); */
 
-	func= RNA_def_function(srna, "operator_int", "uiItemIntO");
+	func = RNA_def_function(srna, "operator_int", "uiItemIntO");
 	api_ui_item_op_common(func);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
+	parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
 	                  "Value of the property to call the operator with", INT_MIN, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED); */
 
-	func= RNA_def_function(srna, "operator_float", "uiItemFloatO");
+	func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
 	api_ui_item_op_common(func);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
+	parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
 	                    "Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED); */
 
-	func= RNA_def_function(srna, "operator_string", "uiItemStringO");
+	func = RNA_def_function(srna, "operator_string", "uiItemStringO");
 	api_ui_item_op_common(func);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
+	parm = RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 #endif
 
@@ -390,7 +390,7 @@ void RNA_api_ui_layout(StructRNA *srna)
 	parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	
-	func = RNA_def_function(srna, "template_color_wheel", "uiTemplateColorWheel");
+	func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
 	RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
 	api_ui_item_rna_common(func);
 	RNA_def_boolean(func, "value_slider", 0, "", "Display the value slider to the right of the color wheel");
@@ -439,7 +439,8 @@ void RNA_api_ui_layout(StructRNA *srna)
 	RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
 
 	func = RNA_def_function(srna, "template_list", "uiTemplateList");
-	RNA_def_function_ui_description(func, "Item. A list widget to display data. e.g. vertexgroups");
+	RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups "
+	                                      "(WARNING: only one per panel allowed!).");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e1cf7a1..7be34c3 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -24,9 +24,9 @@
  *  \ingroup RNA
  */
 
-
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
@@ -311,9 +311,16 @@ static bAddon *rna_userdef_addon_new(void)
 	return bext;
 }
 
-static void rna_userdef_addon_remove(bAddon *bext)
+static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *bext_ptr)
 {
+	bAddon *bext = bext_ptr->data;
+	if (BLI_findindex(&U.addons, bext) == -1) {
+		BKE_report(reports, RPT_ERROR, "Addon is no longer valid");
+		return;
+	}
+
 	BLI_freelinkN(&U.addons, bext);
+	RNA_POINTER_INVALIDATE(bext_ptr);
 }
 
 static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
@@ -388,7 +395,7 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P
 		int a;
 
 		if (devices) {
-			for (a = 0; devices[a].name; a++) {
+			for (a = 0; devices[a].identifier[0]; a++) {
 				tmp.value = devices[a].value;
 				tmp.identifier = devices[a].identifier;
 				tmp.name = devices[a].name;
@@ -410,6 +417,15 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P
 }
 #endif
 
+#ifdef WITH_INTERNATIONAL
+static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+                                                        PropertyRNA *UNUSED(prop), int *free)
+{
+	*free = 0; /* These items are handled by BLF code! */
+	return BLF_RNA_lang_enum_properties();
+}
+#endif
+
 #else
 
 static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
@@ -481,7 +497,7 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
 	
 	/* (not used yet) */
 #if 0
-	prop= RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.5, 2.0);
 	RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas");
 #endif
@@ -754,6 +770,25 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	
+	/* axis */
+	prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "xaxis");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "X Axis", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	
+	prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "yaxis");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Y Axis", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	
+	prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "zaxis");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Z Axis", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
 static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
@@ -2510,7 +2545,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Sub Level Menu Open Delay",
 	                         "Time delay in 1/10 seconds before automatically opening sub level menus");
 
-	prop = RNA_def_property(srna, "quit_dialog", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_quit_dialog", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_QUIT_PROMPT);
 	RNA_def_property_ui_text(prop, "Prompt Quit",
 	                         "Asks for confirmation when quitting through the window close button");
@@ -2745,11 +2780,11 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
 	RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available",
 	                         "Automatic keyframe insertion in available F-Curves");
-							 
+
 	prop = RNA_def_property(srna, "use_auto_keying_warning", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_NOWARNING);
 	RNA_def_property_ui_text(prop, "Show Auto Keying Warning",
-	                         "Show warning indicators when transforming Object and Bones if Auto Keying is enabled");
+	                         "Show warning indicators when transforming objects and bones if auto keying is enabled");
 	
 	/* keyframing settings */
 	prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
@@ -2783,7 +2818,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NONEGFRAMES);
 	RNA_def_property_ui_text(prop, "Allow Negative Frames",
 	                         "Current frame number can be manually set to a negative value");
-							 
+
 	/* fcurve opacity */
 	prop = RNA_def_property(srna, "fcurve_unselected_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "fcu_inactive_alpha");
@@ -2983,11 +3018,21 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 	
+	static EnumPropertyItem multi_sample_levels[] = {
+		{USER_MULTISAMPLE_NONE, "NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"},
+		{USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample (requires restart)"},
+		{USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample (requires restart)"},
+		{USER_MULTISAMPLE_8, "8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample (requires restart)"},
+		{USER_MULTISAMPLE_16, "16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample (requires restart)"},
+		{0, NULL, 0, NULL, NULL}
+	};
+	
+#if 0
 	/* hardcoded here, could become dynamic somehow */
 	/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
 	/* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
 	/* Note: As this list is in alphabetical order, and not defined order,
-	 *       here is the highest define currently in use: 33 (Hebrew). */
+	 *       here is the highest define currently in use: 35 (Esperanto). */
 	static EnumPropertyItem language_items[] = {
 		{ 0, "", 0, N_("Nearly Done"), ""},
 		{ 0, "DEFAULT", 0, "Default (Default)", ""},
@@ -3005,31 +3050,39 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
 		{18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
 		{ 0, "", 0, N_("In Progress"), ""},
-		{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
-		{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
+/*		{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},*/ /* XXX Not active nor enough translated. */
+/*		{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},*/ /* XXX Not active nor enough translated. */
 		{16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
 		{11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
 		{ 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
-		{ 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
+		{35, "ESPERANTO", 0, "Esperanto (Esperanto)", "eo"},
+		{34, "ESTONIAN", 0, "Estonian (Eestlane)", "et_EE"},
+/*		{ 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},*/ /* XXX Not active nor enough translated. */
 		{ 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
-		{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
+/*		{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},*/ /* XXX Not active nor enough translated. */
 		/* using the utf8 flipped form of Hebrew (עִבְרִית)) */
 		{33, "HEBREW", 0, "Hebrew (תירִבְעִ)", "he_IL"},
 		{31, "HUNGARIAN", 0, "Hungarian (Magyar)", "hu_HU"},
 		{27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
 		{29, "KYRGYZ", 0, "Kyrgyz (Кыргыз тили)", "ky_KG"},
-/*		{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, */ /* XXX No po's yet. */
-		{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
+/*		{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, */ /* XXX Not active nor enough translated. */
+/*		{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/ /* XXX Not active nor enough translated. */
 		/* using the utf8 flipped form of Persian (فارسی) */
 		{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"},
-		{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
-/*		{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, */ /* XXX No po's yet. */
+/*		{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},*/ /* XXX Not active nor enough translated. */
+/*		{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, */ /* XXX Not active nor enough translated. */
 		{17, "SERBIAN", 0, "Serbian (Српски)", "sr_RS"},
 		{28, "SERBIAN_LATIN", 0, "Serbian Latin (Srpski latinica)", "sr_RS at latin"},
 		{ 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
 		{30, "TURKISH", 0, "Turkish (Türkçe)", "tr_TR"},
 		{ 0, NULL, 0, NULL, NULL}
 	};
+#else
+	static EnumPropertyItem language_items[] = {
+		{ 0, "DEFAULT", 0, "Default (Default)", ""},
+		{ 0, NULL, 0, NULL, NULL}
+	};
+#endif
 
 #ifdef WITH_CYCLES
 	static EnumPropertyItem compute_device_items[] = {
@@ -3072,6 +3125,9 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, language_items);
+#ifdef WITH_INTERNATIONAL
+	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_lang_enum_properties_itemf");
+#endif
 	RNA_def_property_ui_text(prop, "Language", "Language used for translation");
 	RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
 
@@ -3115,6 +3171,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, color_picker_types);
 	RNA_def_property_enum_sdna(prop, NULL, "color_picker_type");
 	RNA_def_property_ui_text(prop, "Color Picker Type", "Different styles of displaying the color picker widget");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
 	prop = RNA_def_property(srna, "use_preview_images", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS);
@@ -3179,10 +3236,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 	/* this isn't essential but nice to check if VBO draws any differently */
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
+#if 0
 	prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
 	RNA_def_property_ui_text(prop, "Anti-aliasing",
 	                         "Use anti-aliasing for the 3D view (may impact redraw performance)");
+#endif
 
 	prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
@@ -3264,6 +3323,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
 	RNA_def_property_update(prop, 0, "rna_userdef_text_update");
 	
+	/* Full scene anti-aliasing */
+	prop = RNA_def_property(srna, "multi_sample", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
+	RNA_def_property_enum_items(prop, multi_sample_levels);
+	RNA_def_property_ui_text(prop, "MultiSample", "Enable OpenGL multi-sampling, only for systems that support it, requires restart");
+
 #ifdef WITH_CYCLES
 	prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -3393,10 +3458,10 @@ static void rna_def_userdef_input(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE);
 	RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation");
 	/* TODO: update description when fly-mode visuals are in place  ("projected position in fly mode")*/
-
+	
 	/* 3D view */
 	prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
 	RNA_def_property_enum_items(prop, ndof_view_rotation_items);
 	RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport");
 
@@ -3509,6 +3574,10 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT);
 	RNA_def_property_ui_text(prop, "Hide Recent Locations", "Hide recent locations in the file selector");
 
+	prop = RNA_def_property(srna, "hide_system_bookmarks", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS);
+	RNA_def_property_ui_text(prop, "Hide System Bookmarks", "Hide system bookmarks in the file selector");
+
 	prop = RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_THUMBNAILS);
 	RNA_def_property_ui_text(prop, "Show Thumbnails", "Open in thumbnail view for images and movies");
@@ -3624,10 +3693,11 @@ static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cpro
 	RNA_def_function_return(func, parm);
 
 	func = RNA_def_function(srna, "remove", "rna_userdef_addon_remove");
-	RNA_def_function_flag(func, FUNC_NO_SELF);
+	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove addon");
 	parm = RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove");
-	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 void RNA_def_userdef(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index d8753f4..f83410e 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -122,6 +122,7 @@ EnumPropertyItem event_timer_type_items[] = {
 };
 
 EnumPropertyItem event_ndof_type_items[] = {
+	{NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
 	/* buttons on all 3dconnexion devices */
 	{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
 	{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
@@ -554,7 +555,7 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
 	if (value.data == NULL)
 		return;
 
-	/* exception: can't set screens inside of area/region handers */
+	/* exception: can't set screens inside of area/region handlers */
 	win->newscreen = value.data;
 }
 
@@ -562,8 +563,8 @@ static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
 {
 	wmWindow *win = (wmWindow *)ptr->data;
 
-	/* exception: can't set screens inside of area/region handers, and must
-	 * use context so notifier gets to the right window */
+	/* exception: can't set screens inside of area/region handlers,
+	 * and must use context so notifier gets to the right window */
 	if (win->newscreen) {
 		WM_event_add_notifier(C, NC_SCREEN | ND_SCREENBROWSE, win->newscreen);
 		win->newscreen = NULL;
@@ -622,13 +623,34 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
 				kmi->val = KM_NOTHING;
 				break;
 			case KMI_TYPE_NDOF:
-				kmi->type = NDOF_BUTTON_MENU;
-				kmi->val = KM_PRESS;
+				kmi->type = NDOF_MOTION;
+				kmi->val = KM_NOTHING;
 				break;
 		}
 	}
 }
 
+/* assumes value to be an enum from event_type_items */
+/* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
+static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
+{
+	wmKeyMapItem *kmi = ptr->data;
+	
+	/* XXX, this should really be managed in an _itemf function,
+	 * giving a list of valid enums, then silently changing them when they are set is not
+	 * a good precedent, don't do this unless you have a good reason! */
+	if (value == ESCKEY) {
+		/* pass */
+	}
+	else if (value >= AKEY) {
+		kmi->keymodifier = value;
+	}
+	else {
+		kmi->keymodifier = 0;
+	}
+}
+
+
 static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
                                                    int *UNUSED(free))
 {
@@ -1062,7 +1084,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 				}
 				else {
 					BKE_reportf(reports, RPT_ERROR,
-					            "registering operator class: '%s', invalid bl_idname '%s', at position %d",
+					            "Registering operator class: '%s', invalid bl_idname '%s', at position %d",
 					            identifier, _operator_idname, i);
 					return NULL;
 				}
@@ -1071,7 +1093,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 			}
 
 			if (i > ((int)sizeof(dummyop.idname)) - 3) {
-				BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', "
+				BKE_reportf(reports, RPT_ERROR, "Registering operator class: '%s', invalid bl_idname '%s', "
 				            "is too long, maximum length is %d", identifier, _operator_idname,
 				            (int)sizeof(dummyop.idname) - 3);
 				return NULL;
@@ -1079,7 +1101,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 
 			if (dot != 1) {
 				BKE_reportf(reports, RPT_ERROR,
-				            "registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
+				            "Registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
 				            identifier, _operator_idname);
 				return NULL;
 			}
@@ -1180,7 +1202,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 	}
 
 	if (strlen(identifier) >= sizeof(dummyop.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d",
+		BKE_reportf(reports, RPT_ERROR, "Registering operator class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummyop.idname));
 		return NULL;
 	}
@@ -1230,24 +1252,30 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
 {
 	wmOperator *data = (wmOperator *)(ptr->data);
 	char *str = (char *)data->type->idname;
-	if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);    /* utf8 already ensured */
-	else assert(!"setting the bl_idname on a non-builtin operator");
+	if (!str[0])
+		BLI_strncpy(str, value, OP_MAX_TYPENAME);    /* utf8 already ensured */
+	else
+		assert(!"setting the bl_idname on a non-builtin operator");
 }
 
 static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
 {
 	wmOperator *data = (wmOperator *)(ptr->data);
 	char *str = (char *)data->type->name;
-	if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);    /* utf8 already ensured */
-	else assert(!"setting the bl_label on a non-builtin operator");
+	if (!str[0])
+		BLI_strncpy(str, value, OP_MAX_TYPENAME);    /* utf8 already ensured */
+	else
+		assert(!"setting the bl_label on a non-builtin operator");
 }
 
 static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
 {
 	wmOperator *data = (wmOperator *)(ptr->data);
 	char *str = (char *)data->type->description;
-	if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);    /* utf8 already ensured */
-	else assert(!"setting the bl_description on a non-builtin operator");
+	if (!str[0])
+		BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);    /* utf8 already ensured */
+	else
+		assert(!"setting the bl_description on a non-builtin operator");
 }
 
 static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -1404,7 +1432,7 @@ static void rna_def_operator_type_macro(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
 	RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
 
-/*	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
+/*	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
 /*	RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 /*	RNA_def_property_string_sdna(prop, NULL, "idname"); */
 /*	RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
@@ -1865,6 +1893,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
 	RNA_def_property_enum_items(prop, event_type_items);
+	RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL);
 	RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index d697916..b7895cc 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -153,6 +153,18 @@ static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports
 	return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
 }
 
+static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA *kmi_ptr)
+{
+	wmKeyMapItem *kmi = kmi_ptr->data;
+
+	if (WM_keymap_remove_item(km, kmi) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "KeyMapItem '%s' cannot be removed from '%s'", kmi->idname, km->idname);
+		return;
+	}
+
+	RNA_POINTER_INVALIDATE(kmi_ptr);
+}
+
 static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal)
 {
 	if (modal == 0) {
@@ -178,6 +190,18 @@ static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char
 		return ot->modalkeymap;
 }
 
+static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
+{
+	wmKeyConfig *keyconf = keyconf_ptr->data;
+
+	if (WM_keyconfig_remove(wm, keyconf) == FALSE) {
+		BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
+		return;
+	}
+
+	RNA_POINTER_INVALIDATE(keyconf_ptr);
+}
+
 #else
 
 #define WM_GEN_INVOKE_EVENT (1 << 0)
@@ -292,7 +316,7 @@ void RNA_api_operator(StructRNA *srna)
 	/* exec */
 	func = RNA_def_function(srna, "execute", NULL);
 	RNA_def_function_ui_description(func, "Execute the operator");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 
@@ -303,7 +327,7 @@ void RNA_api_operator(StructRNA *srna)
 	/* check */
 	func = RNA_def_function(srna, "check", NULL);
 	RNA_def_function_ui_description(func, "Check the operator settings, return True to signal a change to redraw");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 
@@ -313,7 +337,7 @@ void RNA_api_operator(StructRNA *srna)
 	/* invoke */
 	func = RNA_def_function(srna, "invoke", NULL);
 	RNA_def_function_ui_description(func, "Invoke the operator");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 	parm = RNA_def_pointer(func, "event", "Event", "", "");
@@ -325,7 +349,7 @@ void RNA_api_operator(StructRNA *srna)
 
 	func = RNA_def_function(srna, "modal", NULL); /* same as invoke */
 	RNA_def_function_ui_description(func, "Modal operator function");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 	parm = RNA_def_pointer(func, "event", "Event", "", "");
@@ -345,7 +369,7 @@ void RNA_api_operator(StructRNA *srna)
 	/* cancel */
 	func = RNA_def_function(srna, "cancel", NULL);
 	RNA_def_function_ui_description(func, "Called when the operator is canceled");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 
@@ -464,9 +488,11 @@ void RNA_api_keymapitems(StructRNA *srna)
 	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
 	RNA_def_function_return(func, parm);
 	
-	func = RNA_def_function(srna, "remove", "WM_keymap_remove_item");
+	func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 
 	func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
 	parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
@@ -516,10 +542,11 @@ void RNA_api_keyconfigs(StructRNA *srna)
 	parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
 	RNA_def_function_return(func, parm);
 
-	func = RNA_def_function(srna, "remove", "WM_keyconfig_remove"); /* remove_keyconfig */
+	func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
+	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+	RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
 #endif
-
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
index e3359fb..8b4b10c 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 """
 This script is used to help cleaning RNA api.
@@ -130,11 +130,11 @@ def get_props_from_txt(input_filename):
             line = line[1:]
 
         # class
-        [bclass, tail] = [x.strip() for x in line.split('.', 1)]
+        bclass, tail = [x.strip() for x in line.split('.', 1)]
 
         # comment
         if '*' in bclass:
-            [comment, bclass] = [x.strip() for x in bclass.split('*', 1)]
+            comment, bclass = [x.strip() for x in bclass.split('*', 1)]
         else:
             comment= ''
 
@@ -144,18 +144,18 @@ def get_props_from_txt(input_filename):
             continue
 
         # from
-        [bfrom, tail] = [x.strip() for x in tail.split('->', 1)]
+        bfrom, tail = [x.strip() for x in tail.split('->', 1)]
 
         # to
-        [bto, tail] = [x.strip() for x in tail.split(':', 1)]
+        bto, tail = [x.strip() for x in tail.split(':', 1)]
 
         # type, description
         try:
-            [btype, description] = tail.split(None, 1)
+            btype, description = tail.split(None, 1)
             # make life easy and strip quotes
             description = description.replace("'", "").replace('"', "").replace("\\", "").strip()
         except ValueError:
-            [btype, description] = [tail,'NO DESCRIPTION']
+            btype, description = [tail,'NO DESCRIPTION']
 
         # keyword-check
         kwcheck = check_prefix(bto, btype)
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
index 7585110..17ea5f9 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 import sys
 
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 83e7ea8..cf3bb05 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -38,6 +38,7 @@ set(INC
 	../render/extern/include
 	../../../intern/elbeem/extern
 	../../../intern/guardedalloc
+	../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -64,6 +65,7 @@ set(SRC
 	intern/MOD_fluidsim_util.c
 	intern/MOD_hook.c
 	intern/MOD_lattice.c
+	intern/MOD_laplaciansmooth.c
 	intern/MOD_mask.c
 	intern/MOD_meshdeform.c
 	intern/MOD_mirror.c
@@ -92,6 +94,7 @@ set(SRC
 	intern/MOD_weightvgedit.c
 	intern/MOD_weightvgmix.c
 	intern/MOD_weightvgproximity.c
+	intern/MOD_triangulate.c
 
 	MOD_modifiertypes.h
 	intern/MOD_boolean_util.h
@@ -117,13 +120,6 @@ if(WITH_MOD_REMESH)
 	)
 endif()
 
-if(WITH_MOD_DECIMATE)
-	add_definitions(-DWITH_MOD_DECIMATE)
-	list(APPEND INC
-		../../../intern/decimation/extern
-	)
-endif()
-
 if(WITH_MOD_FLUID)
 	add_definitions(-DWITH_MOD_FLUID)
 endif()
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index 51e574e..290ba19 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -75,6 +75,8 @@ extern ModifierTypeInfo modifierType_WeightVGProximity;
 extern ModifierTypeInfo modifierType_DynamicPaint;
 extern ModifierTypeInfo modifierType_Remesh;
 extern ModifierTypeInfo modifierType_Skin;
+extern ModifierTypeInfo modifierType_LaplacianSmooth;
+extern ModifierTypeInfo modifierType_Triangulate;
 
 /* MOD_util.c */
 void modifier_type_init(ModifierTypeInfo *types[]);
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 2b506cc..62fd9ba 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -4,7 +4,7 @@ Import ('env')
 sources = env.Glob('intern/*.c')
 
 incs = '. ./intern'
-incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include'
+incs += ' #/intern/guardedalloc #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include #/intern/opennl/extern'
 incs += ' ../render/extern/include ../blenloader ../bmesh'
 incs += ' ../include ../blenlib ../blenfont ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
 incs += ' ../gpu'
@@ -20,9 +20,6 @@ if env['WITH_BF_REMESH']:
     incs += ' #/intern/dualcon'
     defs.append('WITH_MOD_REMESH')
 
-if env ['WITH_BF_DECIMATE']:
-    defs.append('WITH_MOD_DECIMATE')
-
 if env['WITH_BF_FLUID']:
     defs.append('WITH_MOD_FLUID')
 
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index e6d86de..7ab3a5d 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -58,7 +58,7 @@ static void initData(ModifierData *md)
 {
 	ArmatureModifierData *amd = (ArmatureModifierData *) md;
 	
-	amd->deformflag = ARM_DEF_ENVELOPE | ARM_DEF_VGROUP;
+	amd->deformflag = ARM_DEF_VGROUP;
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -135,13 +135,13 @@ static void deformVerts(ModifierData *md, Object *ob,
 }
 
 static void deformVertsEM(
-        ModifierData *md, Object *ob, struct BMEditMesh *editData,
+        ModifierData *md, Object *ob, struct BMEditMesh *em,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	ArmatureModifierData *amd = (ArmatureModifierData *) md;
 	DerivedMesh *dm = derivedData;
 
-	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+	if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 
 	modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
 
@@ -158,14 +158,14 @@ static void deformVertsEM(
 }
 
 static void deformMatricesEM(
-        ModifierData *md, Object *ob, struct BMEditMesh *editData,
+        ModifierData *md, Object *ob, struct BMEditMesh *em,
         DerivedMesh *derivedData, float (*vertexCos)[3],
         float (*defMats)[3][3], int numVerts)
 {
 	ArmatureModifierData *amd = (ArmatureModifierData *) md;
 	DerivedMesh *dm = derivedData;
 
-	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+	if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 
 	armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
 	                      amd->deformflag, NULL, amd->defgrp_name);
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 26682e3..3ca2c36 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -53,7 +53,8 @@
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
-#include "BKE_tessmesh.h"
+
+#include "bmesh.h"
 
 #include "depsgraph_private.h"
 
@@ -177,14 +178,14 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
 	             amd->merge_dist, dupe_op, "geom");
 
 	BMO_op_exec(bm, &find_op);
-			
+
 	i = 0;
-	BMO_ITER (ele, &oiter, bm, dupe_op, "geom", BM_ALL) {
+	BMO_ITER (ele, &oiter, dupe_op->slots_in, "geom", BM_ALL) {
 		BM_elem_index_set(ele, i); /* set_dirty */
 		i++;
 	}
 
-	BMO_ITER (ele, &oiter, bm, dupe_op, "newout", BM_ALL) {
+	BMO_ITER (ele, &oiter, dupe_op->slots_out, "geom.out", BM_ALL) {
 		BM_elem_index_set(ele, i); /* set_dirty */
 		i++;
 	}
@@ -196,7 +197,7 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
 	index_map = MEM_callocN(sizeof(int) * (*index_map_length), "index_map");
 
 	/*element type argument doesn't do anything here*/
-	BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+	BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
 		v2 = BMO_iter_map_value_p(&oiter);
 
 		index_map[BM_elem_index_get(v)] = BM_elem_index_get(v2) + 1;
@@ -217,9 +218,10 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
 static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
                                   const ArrayModifierData *amd,
                                   BMOperator *dupe_op,
-                                  const char *dupe_slot_name,
+                                  BMOpSlot dupe_op_slot_args[BMO_OP_MAX_SLOTS], const char *dupe_slot_name,
                                   BMOperator *weld_op)
 {
+	const int is_input = (dupe_op->slots_in == dupe_op_slot_args);
 	BMVert *v, *v2, *v3;
 	BMIter iter;
 
@@ -233,14 +235,27 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
 		
 		BMOIter oiter;
 		BMOperator find_op;
+		BMOpSlot *slot_targetmap;
 
 		BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
-		             "find_doubles verts=%Hv dist=%f keep_verts=%s",
+		             is_input ?  /* ugh */
+		             "find_doubles verts=%Hv dist=%f keep_verts=%s" :
+		             "find_doubles verts=%Hv dist=%f keep_verts=%S",
 		             BM_ELEM_TAG, amd->merge_dist,
 		             dupe_op, dupe_slot_name);
 
 		/* append the dupe's geom to the findop input verts */
-		BMO_slot_buffer_append(&find_op, "verts", dupe_op, dupe_slot_name);
+		if (is_input) {
+			BMO_slot_buffer_append(&find_op, slots_in, "verts",
+			                       dupe_op,  slots_in, dupe_slot_name);
+		}
+		else if (dupe_op->slots_out == dupe_op_slot_args) {
+			BMO_slot_buffer_append(&find_op, slots_in,  "verts",
+			                       dupe_op,  slots_out, dupe_slot_name);
+		}
+		else {
+			BLI_assert(0);
+		}
 
 		/* transform and tag verts */
 		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@@ -252,15 +267,17 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
 
 		BMO_op_exec(bm, &find_op);
 
+		slot_targetmap = BMO_slot_get(weld_op->slots_in, "targetmap");
+
 		/* add new merge targets to weld operator */
-		BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+		BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
 			v2 = BMO_iter_map_value_p(&oiter);
 			/* check in case the target vertex (v2) is already marked
 			 * for merging */
-			while ((v3 = BMO_slot_map_ptr_get(bm, weld_op, "targetmap", v2))) {
+			while ((v3 = BMO_slot_map_elem_get(slot_targetmap, v2))) {
 				v2 = v3;
 			}
-			BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+			BMO_slot_map_elem_insert(weld_op, slot_targetmap, v, v2);
 		}
 
 		BMO_op_finish(bm, &find_op);
@@ -285,6 +302,7 @@ static void merge_first_last(BMesh *bm,
 	BMOperator find_op;
 	BMOIter oiter;
 	BMVert *v, *v2;
+	BMOpSlot *slot_targetmap;
 
 	BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
 	             "find_doubles verts=%s dist=%f keep_verts=%s",
@@ -292,14 +310,16 @@ static void merge_first_last(BMesh *bm,
 	             dupe_first, "geom");
 
 	/* append the last dupe's geom to the findop input verts */
-	BMO_slot_buffer_append(&find_op, "verts", dupe_last, "newout");
+	BMO_slot_buffer_append(&find_op,  slots_in,  "verts",
+	                       dupe_last, slots_out, "geom.out");
 
 	BMO_op_exec(bm, &find_op);
 
 	/* add new merge targets to weld operator */
-	BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+	slot_targetmap = BMO_slot_get(weld_op->slots_in, "targetmap");
+	BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
 		v2 = BMO_iter_map_value_p(&oiter);
-		BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+		BMO_slot_map_elem_insert(weld_op, slot_targetmap, v, v2);
 	}
 
 	BMO_op_finish(bm, &find_op);
@@ -310,10 +330,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
                                           int UNUSED(initFlags))
 {
 	DerivedMesh *result;
-	BMEditMesh *em = DM_to_editbmesh(dm, NULL, FALSE);
+	BMesh *bm = DM_to_bmesh(dm);
 	BMOperator first_dupe_op, dupe_op, old_dupe_op, weld_op;
 	BMVert **first_geom = NULL;
-	int i, j, indexLen;
+	int i, j;
+	int index_len = -1;  /* initialize to an invalid value */
 	/* offset matrix */
 	float offset[4][4];
 	float final_offset[4][4];
@@ -323,6 +344,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 	int *indexMap = NULL;
 	DerivedMesh *start_cap = NULL, *end_cap = NULL;
 	MVert *src_mvert;
+	BMOpSlot *slot_targetmap = NULL;  /* for weldop */
 
 	/* need to avoid infinite recursion here */
 	if (amd->start_cap && amd->start_cap != ob)
@@ -406,32 +428,36 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 	 * cleaner way to do this. One possibility: a "mirror" BMOp would
 	 * certainly help by compressing it all into one top-level BMOp that
 	 * executes a lot of second-level BMOps. */
-	BMO_push(em->bm, NULL);
-	bmesh_edit_begin(em->bm, 0);
+	BM_mesh_elem_toolflags_ensure(bm);
+	BMO_push(bm, NULL);
+	bmesh_edit_begin(bm, 0);
 
-	if (amd->flags & MOD_ARR_MERGE)
-		BMO_op_init(em->bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+	if (amd->flags & MOD_ARR_MERGE) {
+		BMO_op_init(bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
 		            "weld_verts");
 
-	BMO_op_initf(em->bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+		slot_targetmap = BMO_slot_get(weld_op.slots_in, "targetmap");
+	}
+
+	BMO_op_initf(bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
 	             "duplicate geom=%avef");
 	first_dupe_op = dupe_op;
 
 	for (j = 0; j < count - 1; j++) {
 		BMVert *v, *v2, *v3;
 		BMOpSlot *geom_slot;
-		BMOpSlot *newout_slot;
+		BMOpSlot *geom_out_slot;
 		BMOIter oiter;
 
 		if (j != 0) {
-			BMO_op_initf(em->bm, &dupe_op,
+			BMO_op_initf(bm, &dupe_op,
 			             (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
-			             "duplicate geom=%s", &old_dupe_op, "newout");
+			             "duplicate geom=%S", &old_dupe_op, "geom.out");
 		}
-		BMO_op_exec(em->bm, &dupe_op);
+		BMO_op_exec(bm, &dupe_op);
 
-		geom_slot = BMO_slot_get(&dupe_op, "geom");
-		newout_slot = BMO_slot_get(&dupe_op, "newout");
+		geom_slot   = BMO_slot_get(dupe_op.slots_in,  "geom");
+		geom_out_slot = BMO_slot_get(dupe_op.slots_out, "geom.out");
 
 		if ((amd->flags & MOD_ARR_MERGEFINAL) && j == 0) {
 			int first_geom_bytes = sizeof(BMVert *) * geom_slot->len;
@@ -443,33 +469,36 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 		}
 
 		/* apply transformation matrix */
-		BMO_ITER (v, &oiter, em->bm, &dupe_op, "newout", BM_VERT) {
+		BMO_ITER (v, &oiter, dupe_op.slots_out, "geom.out", BM_VERT) {
 			mul_m4_v3(offset, v->co);
 		}
 
 		if (amd->flags & MOD_ARR_MERGE) {
 			/*calculate merge mapping*/
 			if (j == 0) {
-				indexMap = find_doubles_index_map(em->bm, &dupe_op,
-				                                  amd, &indexLen);
+				indexMap = find_doubles_index_map(bm, &dupe_op,
+				                                  amd, &index_len);
 			}
 
 			#define _E(s, i) ((BMVert **)(s)->data.buf)[i]
 
-			for (i = 0; i < indexLen; i++) {
+			/* ensure this is set */
+			BLI_assert(index_len != -1);
+
+			for (i = 0; i < index_len; i++) {
 				if (!indexMap[i]) continue;
 
-				/* merge v (from 'newout') into v2 (from old 'geom') */
-				v = _E(newout_slot, i - geom_slot->len);
+				/* merge v (from 'geom.out') into v2 (from old 'geom') */
+				v = _E(geom_out_slot, i - geom_slot->len);
 				v2 = _E(geom_slot, indexMap[i] - 1);
 
 				/* check in case the target vertex (v2) is already marked
 				 * for merging */
-				while ((v3 = BMO_slot_map_ptr_get(em->bm, &weld_op, "targetmap", v2))) {
+				while ((v3 = BMO_slot_map_elem_get(slot_targetmap, v2))) {
 					v2 = v3;
 				}
 
-				BMO_slot_map_ptr_insert(em->bm, &weld_op, "targetmap", v, v2);
+				BMO_slot_map_elem_insert(&weld_op, slot_targetmap, v, v2);
 			}
 
 			#undef _E
@@ -481,7 +510,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 			first_dupe_op = dupe_op;
 		
 		if (j >= 2)
-			BMO_op_finish(em->bm, &old_dupe_op);
+			BMO_op_finish(bm, &old_dupe_op);
 		old_dupe_op = dupe_op;
 	}
 
@@ -494,45 +523,45 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 		 * loop) the offset between first and last is different from
 		 * dupe X to dupe X+1. */
 
-		merge_first_last(em->bm, amd, &first_dupe_op, &dupe_op, &weld_op);
+		merge_first_last(bm, amd, &first_dupe_op, &dupe_op, &weld_op);
 	}
 
 	/* start capping */
 	if (start_cap || end_cap) {
-		BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT, BM_ELEM_TAG, FALSE);
+		BM_mesh_elem_hflag_enable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
 
 		if (start_cap) {
 			float startoffset[4][4];
 			invert_m4_m4(startoffset, offset);
-			bm_merge_dm_transform(em->bm, start_cap, startoffset, amd,
-			                      &first_dupe_op, "geom", &weld_op);
+			bm_merge_dm_transform(bm, start_cap, startoffset, amd,
+			                      &first_dupe_op, first_dupe_op.slots_in, "geom", &weld_op);
 		}
 
 		if (end_cap) {
 			float endoffset[4][4];
 			mult_m4_m4m4(endoffset, offset, final_offset);
-			bm_merge_dm_transform(em->bm, end_cap, endoffset, amd,
-			                      &dupe_op, count == 1 ? "geom" : "newout", &weld_op);
+			bm_merge_dm_transform(bm, end_cap, endoffset, amd,
+			                      &dupe_op, (count == 1) ? dupe_op.slots_in : dupe_op.slots_out,
+			                      (count == 1) ? "geom" : "geom.out", &weld_op);
 		}
 	}
 	/* done capping */
 
 	/* free remaining dupe operators */
-	BMO_op_finish(em->bm, &first_dupe_op);
+	BMO_op_finish(bm, &first_dupe_op);
 	if (count > 2)
-		BMO_op_finish(em->bm, &dupe_op);
+		BMO_op_finish(bm, &dupe_op);
 
 	/* run merge operator */
 	if (amd->flags & MOD_ARR_MERGE) {
-		BMO_op_exec(em->bm, &weld_op);
-		BMO_op_finish(em->bm, &weld_op);
+		BMO_op_exec(bm, &weld_op);
+		BMO_op_finish(bm, &weld_op);
 	}
 
 	/* Bump the stack level back down to match the adjustment up above */
-	BMO_pop(em->bm);
+	BMO_pop(bm);
 
-	BLI_assert(em->looptris == NULL);
-	result = CDDM_from_BMEditMesh(em, NULL, FALSE, FALSE);
+	result = CDDM_from_bmesh(bm, FALSE);
 
 	if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
 		/* Update normals in case offset object has rotation. */
@@ -543,8 +572,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 		CDDM_calc_normals(result);
 	}
 
-	BMEdit_Free(em);
-	MEM_freeN(em);
+	BM_mesh_free(bm);
+
 	if (indexMap)
 		MEM_freeN(indexMap);
 	if (first_geom)
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 638e91e..59befe4 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -38,11 +38,11 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_modifier.h"
-#include "BKE_tessmesh.h"
 #include "BKE_mesh.h"
-
 #include "BKE_bmesh.h" /* only for defines */
 
+#include "bmesh.h"
+
 #include "DNA_object_types.h"
 
 #include "MEM_guardedalloc.h"
@@ -88,22 +88,19 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	return dataMask;
 }
 
-#ifdef USE_BM_BEVEL_OP_AS_MOD
+// #define USE_BM_BEVEL_OP_AS_MOD
 
-#define EDGE_MARK   1
+#ifdef USE_BM_BEVEL_OP_AS_MOD
 
 /* BMESH_TODO
  *
- * this bevel calls the operator which is missing many of the options
- * which the bevel modifier in trunk has.
+ * this bevel calls the new bevel code (added since 2.64)
+ * which is missing many of the options which the bevel modifier from 2.4x has.
  * - no vertex bevel
  * - no weight bevel
  *
  * These will need to be added to the bmesh operator.
- *       - campbell
- *
- * note: this code is very close to MOD_edgesplit.c.
- * note: if 0'd code from trunk included below.
+ * - campbell
  */
 static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
                                   DerivedMesh *dm,
@@ -111,27 +108,23 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
 {
 	DerivedMesh *result;
 	BMesh *bm;
-	BMEditMesh *em;
 	BMIter iter;
 	BMEdge *e;
 	BevelModifierData *bmd = (BevelModifierData *) md;
-	float threshold = cos((bmd->bevel_angle + 0.00001) * M_PI / 180.0);
-
-	em = DM_to_editbmesh(dm, NULL, FALSE);
-	bm = em->bm;
+	const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
+	const int segments = 16;  /* XXX */
 
-	BM_mesh_normals_update(bm, FALSE);
-	BMO_push(bm, NULL);
+	bm = DM_to_bmesh(dm);
 
 	if (bmd->lim_flags & BME_BEVEL_ANGLE) {
 		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
 			/* check for 1 edge having 2 face users */
-			BMLoop *l1, *l2;
-			if ((l1 = e->l) &&
-			    (l2 = e->l->radial_next) != l1)
-			{
-				if (dot_v3v3(l1->f->no, l2->f->no) < threshold) {
-					BMO_elem_flag_enable(bm, e, EDGE_MARK);
+			BMLoop *l_a, *l_b;
+			if (BM_edge_loop_pair(e, &l_a, &l_b)) {
+				if (dot_v3v3(l_a->f->no, l_b->f->no) < threshold) {
+					BM_elem_flag_enable(e, BM_ELEM_TAG);
+					BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+					BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
 				}
 			}
 		}
@@ -139,19 +132,22 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
 	else {
 		/* crummy, is there a way just to operator on all? - campbell */
 		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
-			BMO_elem_flag_enable(bm, e, EDGE_MARK);
+			if (BM_edge_is_manifold(e)) {
+				BM_elem_flag_enable(e, BM_ELEM_TAG);
+				BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+				BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
+			}
 		}
 	}
 
-	BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
-	             "bevel geom=%fe percent=%f use_even=%b use_dist=%b",
-	             EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN) != 0, (bmd->flags & BME_BEVEL_DIST) != 0);
-	BMO_pop(bm);
+	BM_mesh_bevel(bm, bmd->value, segments);
+
+	result = CDDM_from_bmesh(bm, TRUE);
 
-	BLI_assert(em->looptris == NULL);
-	result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
-	BMEdit_Free(em);
-	MEM_freeN(em);
+	BLI_assert(bm->toolflagpool == NULL);  /* make sure we never alloc'd this */
+	BM_mesh_free(bm);
+
+	CDDM_calc_normals(result);
 
 	return result;
 }
@@ -164,7 +160,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
                                   ModifierApplyFlag UNUSED(flag))
 {
 	DerivedMesh *result;
-	BMEditMesh *em;
+	BMesh *bm;
 
 	/*bDeformGroup *def;*/
 	int /*i,*/ options, defgrp_index = -1;
@@ -175,18 +171,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 #if 0
 	if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
 		defgrp_index = defgroup_name_index(ob, bmd->defgrp_name);
-		if (defgrp_index < 0) {
+		if (defgrp_index == -1) {
 			options &= ~BME_BEVEL_VWEIGHT;
 		}
 	}
 #endif
 
-	em = DM_to_editbmesh(derivedData, NULL, FALSE);
-	BME_bevel(em, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL, FALSE);
-	BLI_assert(em->looptris == NULL);
-	result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
-	BMEdit_Free(em);
-	MEM_freeN(em);
+	bm = DM_to_bmesh(derivedData);
+	BME_bevel(bm, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL);
+	result = CDDM_from_bmesh(bm, TRUE);
+	BM_mesh_free(bm);
 
 	/* until we allow for dirty normal flag, always calc,
 	 * note: calculating on the CDDM is faster then the BMesh equivalent */
@@ -206,29 +200,29 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
 
 
 ModifierTypeInfo modifierType_Bevel = {
-	/* name */ "Bevel",
-	/* structName */ "BevelModifierData",
-	/* structSize */ sizeof(BevelModifierData),
-	/* type */ eModifierTypeType_Constructive,
-	/* flags */ eModifierTypeFlag_AcceptsMesh |
-	eModifierTypeFlag_SupportsEditmode |
-	eModifierTypeFlag_EnableInEditmode,
-
-	/* copyData */ copyData,
-	/* deformVerts */ NULL,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ NULL,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ applyModifier,
-	/* applyModifierEM */ applyModifierEM,
-	/* initData */ initData,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ NULL,
-	/* isDisabled */ NULL,
-	/* updateDepgraph */ NULL,
-	/* dependsOnTime */ NULL,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Bevel",
+	/* structName */        "BevelModifierData",
+	/* structSize */        sizeof(BevelModifierData),
+	/* type */              eModifierTypeType_Constructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_SupportsEditmode |
+	                        eModifierTypeFlag_EnableInEditmode,
+
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   applyModifierEM,
+	/* initData */          initData,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          NULL,
+	/* isDisabled */        NULL,
+	/* updateDepgraph */    NULL,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ NULL,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 5c78a8e..0a48003 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -167,7 +167,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		if (result)
 			return result;
 		else
-			modifier_setError(md, "%s", TIP_("Can't execute boolean operation."));
+			modifier_setError(md, "Cannot execute boolean operation");
 	}
 	
 	return derivedData;
@@ -192,28 +192,28 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(
 
 
 ModifierTypeInfo modifierType_Boolean = {
-	/* name */ "Boolean",
-	/* structName */ "BooleanModifierData",
-	/* structSize */ sizeof(BooleanModifierData),
-	/* type */ eModifierTypeType_Nonconstructive,
-	/* flags */ eModifierTypeFlag_AcceptsMesh |
-	eModifierTypeFlag_UsesPointCache,
-
-	/* copyData */ copyData,
-	/* deformVerts */ NULL,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ NULL,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ applyModifier,
-	/* applyModifierEM */ NULL,
-	/* initData */ NULL,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ NULL,
-	/* isDisabled */ isDisabled,
-	/* updateDepgraph */ updateDepgraph,
-	/* dependsOnTime */ NULL,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Boolean",
+	/* structName */        "BooleanModifierData",
+	/* structSize */        sizeof(BooleanModifierData),
+	/* type */              eModifierTypeType_Nonconstructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_UsesPointCache,
+
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   NULL,
+	/* initData */          NULL,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          NULL,
+	/* isDisabled */        isDisabled,
+	/* updateDepgraph */    updateDepgraph,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ foreachObjectLink,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index bded11d..2ff9353 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -361,9 +361,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 
 	/* create a new DerivedMesh */
 	result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0);
-	CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX),
+	CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_ORIGINDEX),
 	                 CD_DEFAULT, face_it->num_elements);
-	CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX),
+	CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_ORIGINDEX),
 	                 CD_DEFAULT, face_it->num_elements);
 
 	/* step through the vertex iterators: */
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 121b0ee..2105a6e 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -293,27 +293,27 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 
 
 ModifierTypeInfo modifierType_Build = {
-	/* name */ "Build",
-	/* structName */ "BuildModifierData",
-	/* structSize */ sizeof(BuildModifierData),
-	/* type */ eModifierTypeType_Nonconstructive,
-	/* flags */ eModifierTypeFlag_AcceptsMesh |
-	eModifierTypeFlag_AcceptsCVs,
-	/* copyData */ copyData,
-	/* deformVerts */ NULL,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ NULL,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ applyModifier,
-	/* applyModifierEM */ NULL,
-	/* initData */ initData,
-	/* requiredDataMask */ NULL,
-	/* freeData */ NULL,
-	/* isDisabled */ NULL,
-	/* updateDepgraph */ NULL,
-	/* dependsOnTime */ dependsOnTime,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Build",
+	/* structName */        "BuildModifierData",
+	/* structSize */        sizeof(BuildModifierData),
+	/* type */              eModifierTypeType_Nonconstructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_AcceptsCVs,
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   NULL,
+	/* initData */          initData,
+	/* requiredDataMask */  NULL,
+	/* freeData */          NULL,
+	/* isDisabled */        NULL,
+	/* updateDepgraph */    NULL,
+	/* dependsOnTime */     dependsOnTime,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ NULL,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 8eb47f4..54f3efc 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -180,7 +180,7 @@ static void freeData(ModifierData *md)
 			MEM_freeN(clmd->sim_parms);
 		}
 		if (clmd->coll_parms)
-			MEM_freeN(clmd->coll_parms);	
+			MEM_freeN(clmd->coll_parms);
 		
 		BKE_ptcache_free_list(&clmd->ptcaches);
 		clmd->point_cache = NULL;
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 0ce4d74..3ef6b9b 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -125,12 +125,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 }
 
 static void deformVertsEM(
-        ModifierData *md, Object *ob, struct BMEditMesh *editData,
+        ModifierData *md, Object *ob, struct BMEditMesh *em,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 
-	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+	if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0);
 
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index cb6681b..28cdfa8 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -32,10 +32,10 @@
  *  \ingroup modifiers
  */
 
-
-#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
 
 #include "BLI_math.h"
+#include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 #include "BLF_translation.h"
@@ -44,12 +44,16 @@
 
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
+#include "BKE_deform.h"
 #include "BKE_particle.h"
 #include "BKE_cdderivedmesh.h"
 
+#include "bmesh.h"
+
+// #define USE_TIMEIT
 
-#ifdef WITH_MOD_DECIMATE
-#include "LOD_decimation.h"
+#ifdef USE_TIMEIT
+#  include "PIL_time.h"
 #endif
 
 #include "MOD_util.h"
@@ -59,6 +63,7 @@ static void initData(ModifierData *md)
 	DecimateModifierData *dmd = (DecimateModifierData *) md;
 
 	dmd->percent = 1.0;
+	dmd->angle   = DEG2RADF(15.0f);
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -67,146 +72,139 @@ static void copyData(ModifierData *md, ModifierData *target)
 	DecimateModifierData *tdmd = (DecimateModifierData *) target;
 
 	tdmd->percent = dmd->percent;
+	tdmd->iter = dmd->iter;
+	tdmd->angle = dmd->angle;
+	BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, sizeof(tdmd->defgrp_name));
+	tdmd->flag = dmd->flag;
+	tdmd->mode = dmd->mode;
 }
 
-#ifdef WITH_MOD_DECIMATE
-static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+{
+	DecimateModifierData *dmd = (DecimateModifierData *) md;
+	CustomDataMask dataMask = 0;
+
+	/* ask for vertexgroups if we need them */
+	if (dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+
+	return dataMask;
+}
+
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                                   DerivedMesh *derivedData,
                                   ModifierApplyFlag UNUSED(flag))
 {
 	DecimateModifierData *dmd = (DecimateModifierData *) md;
 	DerivedMesh *dm = derivedData, *result = NULL;
-	MVert *mvert;
-	MFace *mface;
-	LOD_Decimation_Info lod;
-	int totvert, totface;
-	int a, numTris;
-
-	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
-
-	mvert = dm->getVertArray(dm);
-	mface = dm->getTessFaceArray(dm);
-	totvert = dm->getNumVerts(dm);
-	totface = dm->getNumTessFaces(dm);
-
-	numTris = 0;
-	for (a = 0; a < totface; a++) {
-		MFace *mf = &mface[a];
-		numTris++;
-		if (mf->v4) numTris++;
-	}
+	BMesh *bm;
 
-	if (numTris < 3) {
-		modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces (triangles)."));
-		dm = CDDM_copy(dm);
-		return dm;
-	}
+	float *vweights = NULL;
 
-	lod.vertex_buffer = MEM_mallocN(3 * sizeof(float) * totvert, "vertices");
-	lod.vertex_normal_buffer = MEM_mallocN(3 * sizeof(float) * totvert, "normals");
-	lod.triangle_index_buffer = MEM_mallocN(3 * sizeof(int) * numTris, "trias");
-	lod.vertex_num = totvert;
-	lod.face_num = numTris;
+#ifdef USE_TIMEIT
+	TIMEIT_START(decim);
+#endif
 
-	for (a = 0; a < totvert; a++) {
-		MVert *mv = &mvert[a];
-		float *vbCo = &lod.vertex_buffer[a * 3];
-		float *vbNo = &lod.vertex_normal_buffer[a * 3];
+	/* set up front so we dont show invalid info in the UI */
+	dmd->face_count = dm->getNumPolys(dm);
 
-		copy_v3_v3(vbCo, mv->co);
-		normal_short_to_float_v3(vbNo, mv->no);
+	switch (dmd->mode) {
+		case MOD_DECIM_MODE_COLLAPSE:
+			if (dmd->percent == 1.0f) {
+				return dm;
+			}
+			break;
+		case MOD_DECIM_MODE_UNSUBDIV:
+			if (dmd->iter == 0) {
+				return dm;
+			}
+			break;
+		case MOD_DECIM_MODE_DISSOLVE:
+			if (dmd->angle == 0.0f) {
+				return dm;
+			}
+			break;
 	}
 
-	numTris = 0;
-	for (a = 0; a < totface; a++) {
-		MFace *mf = &mface[a];
-		int *tri = &lod.triangle_index_buffer[3 * numTris++];
-		tri[0] = mf->v1;
-		tri[1] = mf->v2;
-		tri[2] = mf->v3;
-
-		if (mf->v4) {
-			tri = &lod.triangle_index_buffer[3 * numTris++];
-			tri[0] = mf->v1;
-			tri[1] = mf->v3;
-			tri[2] = mf->v4;
-		}
+	if (dmd->face_count <= 3) {
+		modifier_setError(md, "Modifier requires more than 3 input faces");
+		return dm;
 	}
 
-	dmd->faceCount = 0;
-	if (LOD_LoadMesh(&lod) ) {
-		if (LOD_PreprocessMesh(&lod) ) {
-			/* we assume the decim_faces tells how much to reduce */
+	if (dmd->mode == MOD_DECIM_MODE_COLLAPSE) {
+		if (dmd->defgrp_name[0]) {
+			MDeformVert *dvert;
+			int defgrp_index;
 
-			while (lod.face_num > numTris * dmd->percent) {
-				if (LOD_CollapseEdge(&lod) == 0) break;
-			}
+			modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
 
-			if (lod.vertex_num > 2) {
-				result = CDDM_new(lod.vertex_num, 0, lod.face_num, 0, 0);
-				dmd->faceCount = lod.face_num;
-			}
-			else
-				result = CDDM_new(lod.vertex_num, 0, 0, 0, 0);
-
-			mvert = CDDM_get_verts(result);
-			for (a = 0; a < lod.vertex_num; a++) {
-				MVert *mv = &mvert[a];
-				float *vbCo = &lod.vertex_buffer[a * 3];
-				
-				copy_v3_v3(mv->co, vbCo);
-			}
+			if (dvert) {
+				const unsigned int vert_tot = dm->getNumVerts(dm);
+				unsigned int i;
+
+				vweights = MEM_mallocN(vert_tot * sizeof(float), __func__);
 
-			if (lod.vertex_num > 2) {
-				mface = CDDM_get_tessfaces(result);
-				for (a = 0; a < lod.face_num; a++) {
-					MFace *mf = &mface[a];
-					int *tri = &lod.triangle_index_buffer[a * 3];
-					mf->v1 = tri[0];
-					mf->v2 = tri[1];
-					mf->v3 = tri[2];
-					test_index_face(mf, NULL, 0, 3);
+				if (dmd->flag & MOD_DECIM_FLAG_INVERT_VGROUP) {
+					for (i = 0; i < vert_tot; i++) {
+						const float f = 1.0f - defvert_find_weight(&dvert[i], defgrp_index);
+						vweights[i] = f > BM_MESH_DECIM_WEIGHT_EPS ? (1.0f / f) : BM_MESH_DECIM_WEIGHT_MAX;
+					}
+				}
+				else {
+					for (i = 0; i < vert_tot; i++) {
+						const float f = defvert_find_weight(&dvert[i], defgrp_index);
+						vweights[i] = f > BM_MESH_DECIM_WEIGHT_EPS ? (1.0f / f) : BM_MESH_DECIM_WEIGHT_MAX;
+					}
 				}
 			}
+		}
+	}
+
+	bm = DM_to_bmesh(dm);
 
-			CDDM_calc_edges_tessface(result);
+	switch (dmd->mode) {
+		case MOD_DECIM_MODE_COLLAPSE:
+		{
+			const int do_triangulate = (dmd->flag & MOD_DECIM_FLAG_TRIANGULATE) != 0;
+			BM_mesh_decimate_collapse(bm, dmd->percent, vweights, do_triangulate);
+			break;
+		}
+		case MOD_DECIM_MODE_UNSUBDIV:
+		{
+			BM_mesh_decimate_unsubdivide(bm, dmd->iter);
+			break;
+		}
+		case MOD_DECIM_MODE_DISSOLVE:
+		{
+			const int do_dissolve_boundaries = (dmd->flag & MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS) != 0;
+			BM_mesh_decimate_dissolve(bm, dmd->angle, do_dissolve_boundaries);
+			break;
 		}
-		else
-			modifier_setError(md, "%s", TIP_("Out of memory."));
+	}
 
-		LOD_FreeDecimationData(&lod);
+	if (vweights) {
+		MEM_freeN(vweights);
 	}
-	else
-		modifier_setError(md, "%s", TIP_("Non-manifold mesh as input."));
 
-	MEM_freeN(lod.vertex_buffer);
-	MEM_freeN(lod.vertex_normal_buffer);
-	MEM_freeN(lod.triangle_index_buffer);
+	/* update for display only */
+	dmd->face_count = bm->totface;
+	result = CDDM_from_bmesh(bm, FALSE);
+	BLI_assert(bm->toolflagpool == NULL);  /* make sure we never alloc'd this */
+	BM_mesh_free(bm);
 
-	if (result) {
-		CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
+#ifdef USE_TIMEIT
+	TIMEIT_END(decim);
+#endif
 
-		return result;
-	}
-	else {
-		return dm;
-	}
-}
-#else // WITH_MOD_DECIMATE
-static DerivedMesh *applyModifier(ModifierData *UNUSED(md), Object *UNUSED(ob),
-                                  DerivedMesh *derivedData,
-                                  ModifierApplyFlag UNUSED(flag))
-{
-	return derivedData;
+	return result;
 }
-#endif // WITH_MOD_DECIMATE
 
 ModifierTypeInfo modifierType_Decimate = {
 	/* name */              "Decimate",
 	/* structName */        "DecimateModifierData",
 	/* structSize */        sizeof(DecimateModifierData),
 	/* type */              eModifierTypeType_Nonconstructive,
-	/* flags */             eModifierTypeFlag_AcceptsMesh,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_AcceptsCVs,
 	/* copyData */          copyData,
 	/* deformVerts */       NULL,
 	/* deformMatrices */    NULL,
@@ -215,7 +213,7 @@ ModifierTypeInfo modifierType_Decimate = {
 	/* applyModifier */     applyModifier,
 	/* applyModifierEM */   NULL,
 	/* initData */          initData,
-	/* requiredDataMask */  NULL,
+	/* requiredDataMask */  requiredDataMask,
 	/* freeData */          NULL,
 	/* isDisabled */        NULL,
 	/* updateDepgraph */    NULL,
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 7d7bfad..80866a7 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -170,10 +170,10 @@ ModifierTypeInfo modifierType_DynamicPaint = {
 	/* structSize */        sizeof(DynamicPaintModifierData),
 	/* type */              eModifierTypeType_Constructive,
 	/* flags */             eModifierTypeFlag_AcceptsMesh |
-/*	                       eModifierTypeFlag_SupportsMapping |*/
-	                       eModifierTypeFlag_UsesPointCache |
-	                       eModifierTypeFlag_Single |
-	                       eModifierTypeFlag_UsesPreview,
+/*	                        eModifierTypeFlag_SupportsMapping |*/
+	                        eModifierTypeFlag_UsesPointCache |
+	                        eModifierTypeFlag_Single |
+	                        eModifierTypeFlag_UsesPreview,
 
 	/* copyData */          copyData,
 	/* deformVerts */       NULL,
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index b1c3459..ec81c5c 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -43,9 +43,10 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_modifier.h"
-#include "BKE_tessmesh.h"
 #include "BKE_mesh.h"
 
+#include "bmesh.h"
+
 #include "DNA_object_types.h"
 
 /* EdgeSplit */
@@ -61,16 +62,12 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
 {
 	DerivedMesh *result;
 	BMesh *bm;
-	BMEditMesh *em;
 	BMIter iter;
 	BMEdge *e;
 	float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f);
 
-	em = DM_to_editbmesh(dm, NULL, FALSE);
-	bm = em->bm;
-
-	BM_mesh_normals_update(bm, FALSE);
-	BMO_push(bm, NULL);
+	bm = DM_to_bmesh(dm);
+	BM_mesh_elem_toolflags_ensure(bm);
 	
 	if (emd->flags & MOD_EDGESPLIT_FROMANGLE) {
 		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
@@ -105,15 +102,11 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
 	
 	BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
 	             "split_edges edges=%fe", EDGE_MARK);
-	
-	BMO_pop(bm);
 
 	/* BM_mesh_validate(bm); */ /* for troubleshooting */
 
-	BLI_assert(em->looptris == NULL);
-	result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
-	BMEdit_Free(em);
-	MEM_freeN(em);
+	result = CDDM_from_bmesh(bm, TRUE);
+	BM_mesh_free(bm);
 	
 	return result;
 }
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index b959335..1298d28 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -205,12 +205,13 @@ static MFace *get_dface(DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFa
 	return df;
 }
 
-#define SET_VERTS(a, b, c, d)  {        \
-        v[0] = mf->v##a; uv[0] = a - 1; \
-        v[1] = mf->v##b; uv[1] = b - 1; \
-        v[2] = mf->v##c; uv[2] = c - 1; \
-        v[3] = mf->v##d; uv[3] = d - 1; \
-    } (void)0
+#define SET_VERTS(a, b, c, d)           \
+	{                                   \
+		v[0] = mf->v##a; uv[0] = a - 1; \
+		v[1] = mf->v##b; uv[1] = b - 1; \
+		v[2] = mf->v##c; uv[2] = c - 1; \
+		v[3] = mf->v##d; uv[3] = d - 1; \
+	} (void)0
 
 #define GET_ES(v1, v2) edgecut_get(eh, v1, v2)
 #define INT_UV(uvf, c0, c1) interp_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1], 0.5f)
@@ -669,8 +670,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 
 		mv = CDDM_get_vert(splitdm, ed_v1);
 
-		add_v3_v3(dupve->co, mv->co);
-		mul_v3_fl(dupve->co, 0.5f);
+		mid_v3_v3v3(dupve->co, dupve->co, mv->co);
 	}
 	BLI_edgehashIterator_free(ehi);
 
@@ -813,7 +813,7 @@ static DerivedMesh *explodeMesh(ExplodeModifierData *emd,
 	sim.psys = psmd->psys;
 	sim.psmd = psmd;
 
-	/* timestep= psys_get_timestep(&sim); */
+	/* timestep = psys_get_timestep(&sim); */
 
 	cfra = BKE_scene_frame_get(scene);
 
@@ -861,7 +861,7 @@ static DerivedMesh *explodeMesh(ExplodeModifierData *emd,
 	/* the final duplicated vertices */
 	explode = CDDM_from_template(dm, totdup, 0, totface - delface, 0, 0);
 	mtface = CustomData_get_layer_named(&explode->faceData, CD_MTFACE, emd->uvname);
-	/*dupvert= CDDM_get_verts(explode);*/
+	/*dupvert = CDDM_get_verts(explode);*/
 
 	/* getting back to object space */
 	invert_m4_m4(imat, ob->obmat);
@@ -1039,26 +1039,26 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 
 ModifierTypeInfo modifierType_Explode = {
-	/* name */ "Explode",
-	/* structName */ "ExplodeModifierData",
-	/* structSize */ sizeof(ExplodeModifierData),
-	/* type */ eModifierTypeType_Constructive,
-	/* flags */ eModifierTypeFlag_AcceptsMesh,
-	/* copyData */ copyData,
-	/* deformVerts */ NULL,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ NULL,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ applyModifier,
-	/* applyModifierEM */ NULL,
-	/* initData */ initData,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ freeData,
-	/* isDisabled */ NULL,
-	/* updateDepgraph */ NULL,
-	/* dependsOnTime */ dependsOnTime,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Explode",
+	/* structName */        "ExplodeModifierData",
+	/* structSize */        sizeof(ExplodeModifierData),
+	/* type */              eModifierTypeType_Constructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh,
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   NULL,
+	/* initData */          initData,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          freeData,
+	/* isDisabled */        NULL,
+	/* updateDepgraph */    NULL,
+	/* dependsOnTime */     dependsOnTime,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ NULL,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 9acac6d..13d409d 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -426,7 +426,11 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm,
                                         FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
 {
 	int displaymode = 0;
-	int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */
+	
+	int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */ 
+	/*  why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. (See physics_fluid.c for that. - DG */
+	/* If we start with frame 0, we need to remap all animation channels, too, because they will all be 1 frame late if using frame-1! - DG */
+
 	char targetFile[FILE_MAX];
 	FluidsimSettings *fss = fluidmd->fss;
 	DerivedMesh *dm = NULL;
@@ -529,7 +533,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
 	fss = fluidmd->fss;
 
 	/* timescale not supported yet
-	 * clmd->sim_parms->timescale= timescale; */
+	 * clmd->sim_parms->timescale = timescale; */
 
 	/* support reversing of baked fluid frames here */
 	if ((fss->flag & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0)) {
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
new file mode 100644
index 0000000..2662260
--- /dev/null
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -0,0 +1,703 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 by the Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Alexander Pinzon
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/modifiers/intern/MOD_laplaciansmooth.c
+ *  \ingroup modifiers
+ */
+
+
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+#include "BLI_string.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_deform.h"
+#include "BKE_displist.h"
+#include "BKE_mesh.h"
+#include "BKE_modifier.h"
+#include "BKE_object.h"
+#include "BKE_particle.h"
+#include "BKE_tessmesh.h"
+
+#include "MOD_modifiertypes.h"
+#include "MOD_util.h"
+
+#include "ONL_opennl.h"
+
+#define MOD_LAPLACIANSMOOTH_MAX_EDGE_PERCENTAGE 1.8f
+#define MOD_LAPLACIANSMOOTH_MIN_EDGE_PERCENTAGE 0.02f
+
+struct BLaplacianSystem {
+	float *eweights;        /* Length weights per Edge */
+	float (*fweights)[3];   /* Cotangent weights per face */
+	float *ring_areas;      /* Total area per ring*/
+	float *vlengths;        /* Total sum of lengths(edges) per vertice*/
+	float *vweights;        /* Total sum of weights per vertice*/
+	int numEdges;           /* Number of edges*/
+	int numFaces;           /* Number of faces*/
+	int numVerts;           /* Number of verts*/
+	short *numNeFa;         /* Number of neighboors faces around vertice*/
+	short *numNeEd;         /* Number of neighboors Edges around vertice*/
+	short *zerola;          /* Is zero area or length*/
+
+	/* Pointers to data*/
+	float (*vertexCos)[3];
+	MFace *mfaces;
+	MEdge *medges;
+	NLContext *context;
+
+	/*Data*/
+	float min_area;
+	float vert_centroid[3];
+};
+typedef struct BLaplacianSystem LaplacianSystem;
+
+static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md);
+static int is_disabled(ModifierData *md, int UNUSED(useRenderParams));
+static float compute_volume(float (*vertexCos)[3], MFace *mfaces, int numFaces);
+static float cotan_weight(float *v1, float *v2, float *v3);
+static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts);
+static void copy_data(ModifierData *md, ModifierData *target);
+static void delete_laplacian_system(LaplacianSystem *sys);
+static void delete_void_pointer(void *data);
+static void fill_laplacian_matrix(LaplacianSystem *sys);
+static void init_data(ModifierData *md);
+static void init_laplacian_matrix(LaplacianSystem *sys);
+static void memset_laplacian_system(LaplacianSystem *sys, int val);
+static void volume_preservation(LaplacianSystem *sys, float vini, float vend, short flag);
+static void validate_solution(LaplacianSystem *sys, short flag);
+
+static void delete_void_pointer(void *data)
+{
+	if (data) {
+		MEM_freeN(data);
+		data = NULL;
+	}
+}
+
+static void delete_laplacian_system(LaplacianSystem *sys)
+{
+	delete_void_pointer(sys->eweights);
+	delete_void_pointer(sys->fweights);
+	delete_void_pointer(sys->numNeEd);
+	delete_void_pointer(sys->numNeFa);
+	delete_void_pointer(sys->ring_areas);
+	delete_void_pointer(sys->vlengths);
+	delete_void_pointer(sys->vweights);
+	delete_void_pointer(sys->zerola);
+	if (sys->context) {
+		nlDeleteContext(sys->context);
+	}
+	sys->vertexCos = NULL;
+	sys->mfaces = NULL;
+	sys->medges = NULL;
+	MEM_freeN(sys);
+}
+
+static void memset_laplacian_system(LaplacianSystem *sys, int val)
+{
+	memset(sys->eweights,     val, sizeof(float) * sys->numEdges);
+	memset(sys->fweights,     val, sizeof(float) * sys->numFaces * 3);
+	memset(sys->numNeEd,      val, sizeof(short) * sys->numVerts);
+	memset(sys->numNeFa,      val, sizeof(short) * sys->numVerts);
+	memset(sys->ring_areas,   val, sizeof(float) * sys->numVerts);
+	memset(sys->vlengths,     val, sizeof(float) * sys->numVerts);
+	memset(sys->vweights,     val, sizeof(float) * sys->numVerts);
+	memset(sys->zerola,       val, sizeof(short) * sys->numVerts);
+}
+
+static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts)
+{
+	LaplacianSystem *sys;
+	sys = MEM_callocN(sizeof(LaplacianSystem), "ModLaplSmoothSystem");
+	sys->numEdges = a_numEdges;
+	sys->numFaces = a_numFaces;
+	sys->numVerts = a_numVerts;
+
+	sys->eweights =  MEM_callocN(sizeof(float) * sys->numEdges, "ModLaplSmoothEWeight");
+	if (!sys->eweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->fweights =  MEM_callocN(sizeof(float) * 3 * sys->numFaces, "ModLaplSmoothFWeight");
+	if (!sys->fweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->numNeEd =  MEM_callocN(sizeof(short) * sys->numVerts, "ModLaplSmoothNumNeEd");
+	if (!sys->numNeEd) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->numNeFa =  MEM_callocN(sizeof(short) * sys->numVerts, "ModLaplSmoothNumNeFa");
+	if (!sys->numNeFa) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->ring_areas =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothRingAreas");
+	if (!sys->ring_areas) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->vlengths =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothVlengths");
+	if (!sys->vlengths) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->vweights =  MEM_callocN(sizeof(float) * sys->numVerts, "ModLaplSmoothVweights");
+	if (!sys->vweights) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	sys->zerola =  MEM_callocN(sizeof(short) * sys->numVerts, "ModLaplSmoothZeloa");
+	if (!sys->zerola) {
+		delete_laplacian_system(sys);
+		return NULL;
+	}
+
+	return sys;
+}
+
+static void init_data(ModifierData *md)
+{
+	LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+	smd->lambda = 0.00001f;
+	smd->lambda_border = 0.00005f;
+	smd->repeat = 1;
+	smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME;
+	smd->defgrp_name[0] = '\0';
+}
+
+static void copy_data(ModifierData *md, ModifierData *target)
+{
+	LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+	LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target;
+
+	tsmd->lambda = smd->lambda;
+	tsmd->lambda_border = smd->lambda_border;
+	tsmd->repeat = smd->repeat;
+	tsmd->flag = smd->flag;
+	BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name));
+}
+
+static int is_disabled(ModifierData *md, int UNUSED(useRenderParams))
+{
+	LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+	short flag;
+
+	flag = smd->flag & (MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z);
+
+	/* disable if modifier is off for X, Y and Z or if factor is 0 */
+	if (flag == 0) return 1;
+
+	return 0;
+}
+
+static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
+{
+	LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md;
+	CustomDataMask dataMask = 0;
+
+	/* ask for vertexgroups if we need them */
+	if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+
+	return dataMask;
+}
+
+static float cotan_weight(float *v1, float *v2, float *v3)
+{
+	float a[3], b[3], c[3], clen;
+
+	sub_v3_v3v3(a, v2, v1);
+	sub_v3_v3v3(b, v3, v1);
+	cross_v3_v3v3(c, a, b);
+
+	clen = len_v3(c);
+
+	if (clen == 0.0f)
+		return 0.0f;
+
+	return dot_v3v3(a, b) / clen;
+}
+
+static float compute_volume(float (*vertexCos)[3], MFace *mfaces, int numFaces)
+{
+	float vol = 0.0f;
+	float x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4;
+	int i;
+	float *vf[4];
+	for (i = 0; i < numFaces; i++) {
+		vf[0] = vertexCos[mfaces[i].v1];
+		vf[1] = vertexCos[mfaces[i].v2];
+		vf[2] = vertexCos[mfaces[i].v3];
+
+		x1 = vf[0][0];
+		y1 = vf[0][1];
+		z1 = vf[0][2];
+
+		x2 = vf[1][0];
+		y2 = vf[1][1];
+		z2 = vf[1][2];
+
+		x3 = vf[2][0];
+		y3 = vf[2][1];
+		z3 = vf[2][2];
+
+
+		vol +=  (1.0f / 6.0f) * (x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3 - x3 * y2 * z1);
+		if ((&mfaces[i])->v4) {
+			vf[3] = vertexCos[mfaces[i].v4];
+			x4 = vf[3][0];
+			y4 = vf[3][1];
+			z4 = vf[3][2];
+			vol += (1.0f / 6.0f) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
+		}
+	}
+	return fabsf(vol);
+}
+
+static void volume_preservation(LaplacianSystem *sys, float vini, float vend, short flag)
+{
+	float beta;
+	int i;
+
+	if (vend != 0.0f) {
+		beta  = pow(vini / vend, 1.0f / 3.0f);
+		for (i = 0; i < sys->numVerts; i++) {
+			if (flag & MOD_LAPLACIANSMOOTH_X) {
+				sys->vertexCos[i][0] = (sys->vertexCos[i][0] - sys->vert_centroid[0]) * beta + sys->vert_centroid[0];
+			}
+			if (flag & MOD_LAPLACIANSMOOTH_Y) {
+				sys->vertexCos[i][1] = (sys->vertexCos[i][1] - sys->vert_centroid[1]) * beta + sys->vert_centroid[1];
+			}
+			if (flag & MOD_LAPLACIANSMOOTH_Z) {
+				sys->vertexCos[i][2] = (sys->vertexCos[i][2] - sys->vert_centroid[2]) * beta + sys->vert_centroid[2];
+			}
+
+		}
+	}
+}
+
+static void init_laplacian_matrix(LaplacianSystem *sys)
+{
+	float *v1, *v2, *v3, *v4;
+	float w1, w2, w3, w4;
+	float areaf;
+	int i, j;
+	unsigned int idv1, idv2, idv3, idv4, idv[4];
+	int has_4_vert;
+	for (i = 0; i < sys->numEdges; i++) {
+		idv1 = sys->medges[i].v1;
+		idv2 = sys->medges[i].v2;
+
+		v1 = sys->vertexCos[idv1];
+		v2 = sys->vertexCos[idv2];
+
+		sys->numNeEd[idv1] = sys->numNeEd[idv1] + 1;
+		sys->numNeEd[idv2] = sys->numNeEd[idv2] + 1;
+		w1 = len_v3v3(v1, v2);
+		if (w1 < sys->min_area) {
+			sys->zerola[idv1] = 1;
+			sys->zerola[idv2] = 1;
+		}
+		else {
+			w1 = 1.0f / w1;
+		}
+
+		sys->eweights[i] = w1;
+	}
+	for (i = 0; i < sys->numFaces; i++) {
+		has_4_vert = ((&sys->mfaces[i])->v4) ? 1 : 0;
+
+		idv1 = sys->mfaces[i].v1;
+		idv2 = sys->mfaces[i].v2;
+		idv3 = sys->mfaces[i].v3;
+		idv4 = has_4_vert ? sys->mfaces[i].v4 : 0;
+
+		sys->numNeFa[idv1] += 1;
+		sys->numNeFa[idv2] += 1;
+		sys->numNeFa[idv3] += 1;
+		if (has_4_vert) sys->numNeFa[idv4] += 1;
+
+		v1 = sys->vertexCos[idv1];
+		v2 = sys->vertexCos[idv2];
+		v3 = sys->vertexCos[idv3];
+		v4 = has_4_vert ? sys->vertexCos[idv4] : 0;
+
+		if (has_4_vert) {
+			areaf = area_quad_v3(v1, v2, v3, sys->vertexCos[sys->mfaces[i].v4]);
+		}
+		else {
+			areaf = area_tri_v3(v1, v2, v3);
+		}
+		if (fabsf(areaf) < sys->min_area) {
+			sys->zerola[idv1] = 1;
+			sys->zerola[idv2] = 1;
+			sys->zerola[idv3] = 1;
+			if (has_4_vert) sys->zerola[idv4] = 1;
+		}
+
+		sys->ring_areas[idv1] += areaf;
+		sys->ring_areas[idv2] += areaf;
+		sys->ring_areas[idv3] += areaf;
+		if (has_4_vert) sys->ring_areas[idv4] += areaf;
+
+		if (has_4_vert) {
+
+			idv[0] = idv1;
+			idv[1] = idv2;
+			idv[2] = idv3;
+			idv[3] = idv4;
+
+			for (j = 0; j < 4; j++) {
+				idv1 = idv[j];
+				idv2 = idv[(j + 1) % 4];
+				idv3 = idv[(j + 2) % 4];
+				idv4 = idv[(j + 3) % 4];
+
+				v1 = sys->vertexCos[idv1];
+				v2 = sys->vertexCos[idv2];
+				v3 = sys->vertexCos[idv3];
+				v4 = sys->vertexCos[idv4];
+
+				w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2);
+				w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3);
+				w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1);
+
+				sys->vweights[idv1] += (w2 + w3 + w4) / 4.0f;
+			}
+		}
+		else {
+			w1 = cotan_weight(v1, v2, v3);
+			w2 = cotan_weight(v2, v3, v1);
+			w3 = cotan_weight(v3, v1, v2);
+
+			sys->fweights[i][0] = sys->fweights[i][0] + w1;
+			sys->fweights[i][1] = sys->fweights[i][1] + w2;
+			sys->fweights[i][2] = sys->fweights[i][2] + w3;
+
+			sys->vweights[idv1] = sys->vweights[idv1] + w2 + w3;
+			sys->vweights[idv2] = sys->vweights[idv2] + w1 + w3;
+			sys->vweights[idv3] = sys->vweights[idv3] + w1 + w2;
+		}
+	}
+	for (i = 0; i < sys->numEdges; i++) {
+		idv1 = sys->medges[i].v1;
+		idv2 = sys->medges[i].v2;
+		/* if is boundary, apply scale-dependent umbrella operator only with neighboors in boundary */
+		if (sys->numNeEd[idv1] != sys->numNeFa[idv1] && sys->numNeEd[idv2] != sys->numNeFa[idv2]) {
+			sys->vlengths[idv1] += sys->eweights[i];
+			sys->vlengths[idv2] += sys->eweights[i];
+		}
+	}
+
+}
+
+static void fill_laplacian_matrix(LaplacianSystem *sys)
+{
+	float *v1, *v2, *v3, *v4;
+	float w2, w3, w4;
+	int i, j;
+	int has_4_vert;
+	unsigned int idv1, idv2, idv3, idv4, idv[4];
+
+	for (i = 0; i < sys->numFaces; i++) {
+		idv1 = sys->mfaces[i].v1;
+		idv2 = sys->mfaces[i].v2;
+		idv3 = sys->mfaces[i].v3;
+		has_4_vert = ((&sys->mfaces[i])->v4) ? 1 : 0;
+
+		if (has_4_vert) {
+			idv[0] = sys->mfaces[i].v1;
+			idv[1] = sys->mfaces[i].v2;
+			idv[2] = sys->mfaces[i].v3;
+			idv[3] = sys->mfaces[i].v4;
+			for (j = 0; j < 4; j++) {
+				idv1 = idv[j];
+				idv2 = idv[(j + 1) % 4];
+				idv3 = idv[(j + 2) % 4];
+				idv4 = idv[(j + 3) % 4];
+
+				v1 = sys->vertexCos[idv1];
+				v2 = sys->vertexCos[idv2];
+				v3 = sys->vertexCos[idv3];
+				v4 = sys->vertexCos[idv4];
+
+				w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2);
+				w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3);
+				w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1);
+
+				w2 = w2 / 4.0f;
+				w3 = w3 / 4.0f;
+				w4 = w4 / 4.0f;
+
+				if (sys->numNeEd[idv1] == sys->numNeFa[idv1] && sys->zerola[idv1] == 0) {
+					nlMatrixAdd(idv1, idv2, w2 * sys->vweights[idv1]);
+					nlMatrixAdd(idv1, idv3, w3 * sys->vweights[idv1]);
+					nlMatrixAdd(idv1, idv4, w4 * sys->vweights[idv1]);
+				}
+			}
+		}
+		else {
+			/* Is ring if number of faces == number of edges around vertice*/
+			if (sys->numNeEd[idv1] == sys->numNeFa[idv1] && sys->zerola[idv1] == 0) {
+				nlMatrixAdd(idv1, idv2, sys->fweights[i][2] * sys->vweights[idv1]);
+				nlMatrixAdd(idv1, idv3, sys->fweights[i][1] * sys->vweights[idv1]);
+			}
+			if (sys->numNeEd[idv2] == sys->numNeFa[idv2] && sys->zerola[idv2] == 0) {
+				nlMatrixAdd(idv2, idv1, sys->fweights[i][2] * sys->vweights[idv2]);
+				nlMatrixAdd(idv2, idv3, sys->fweights[i][0] * sys->vweights[idv2]);
+			}
+			if (sys->numNeEd[idv3] == sys->numNeFa[idv3] && sys->zerola[idv3] == 0) {
+				nlMatrixAdd(idv3, idv1, sys->fweights[i][1] * sys->vweights[idv3]);
+				nlMatrixAdd(idv3, idv2, sys->fweights[i][0] * sys->vweights[idv3]);
+			}
+		}
+	}
+
+	for (i = 0; i < sys->numEdges; i++) {
+		idv1 = sys->medges[i].v1;
+		idv2 = sys->medges[i].v2;
+		/* Is boundary */
+		if (sys->numNeEd[idv1] != sys->numNeFa[idv1] &&
+		    sys->numNeEd[idv2] != sys->numNeFa[idv2] &&
+		    sys->zerola[idv1] == 0 &&
+		    sys->zerola[idv2] == 0)
+		{
+			nlMatrixAdd(idv1, idv2, sys->eweights[i] * sys->vlengths[idv1]);
+			nlMatrixAdd(idv2, idv1, sys->eweights[i] * sys->vlengths[idv2]);
+		}
+	}
+}
+
+static void validate_solution(LaplacianSystem *sys, short flag)
+{
+	int i, idv1, idv2;
+	float leni, lene;
+	float vini, vend;
+	float *vi1, *vi2, ve1[3], ve2[3];
+	if (flag & MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME) {
+		vini = compute_volume(sys->vertexCos, sys->mfaces, sys->numFaces);
+	}
+	for (i = 0; i < sys->numEdges; i++) {
+		idv1 = sys->medges[i].v1;
+		idv2 = sys->medges[i].v2;
+		vi1 = sys->vertexCos[idv1];
+		vi2 = sys->vertexCos[idv2];
+		ve1[0] = nlGetVariable(0, idv1);
+		ve1[1] = nlGetVariable(1, idv1);
+		ve1[2] = nlGetVariable(2, idv1);
+		ve2[0] = nlGetVariable(0, idv2);
+		ve2[1] = nlGetVariable(1, idv2);
+		ve2[2] = nlGetVariable(2, idv2);
+		leni = len_v3v3(vi1, vi2);
+		lene = len_v3v3(ve1, ve2);
+		if (lene > leni * MOD_LAPLACIANSMOOTH_MAX_EDGE_PERCENTAGE || lene < leni * MOD_LAPLACIANSMOOTH_MIN_EDGE_PERCENTAGE) {
+			sys->zerola[idv1] = 1;
+			sys->zerola[idv2] = 1;
+		}
+	}
+	for (i = 0; i < sys->numVerts; i++) {
+		if (sys->zerola[i] == 0) {
+			if (flag & MOD_LAPLACIANSMOOTH_X) {
+				sys->vertexCos[i][0] = nlGetVariable(0, i);
+			}
+			if (flag & MOD_LAPLACIANSMOOTH_Y) {
+				sys->vertexCos[i][1] = nlGetVariable(1, i);
+			}
+			if (flag & MOD_LAPLACIANSMOOTH_Z) {
+				sys->vertexCos[i][2] = nlGetVariable(2, i);
+			}
+		}
+	}
+	if (flag & MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME) {
+		vend = compute_volume(sys->vertexCos, sys->mfaces, sys->numFaces);
+		volume_preservation(sys, vini, vend, flag);
+	}
+}
+
+static void laplaciansmoothModifier_do(
+        LaplacianSmoothModifierData *smd, Object *ob, DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts)
+{
+	LaplacianSystem *sys;
+	MDeformVert *dvert = NULL;
+	MDeformVert *dv = NULL;
+	float w, wpaint;
+	int i, iter;
+	int defgrp_index;
+
+	DM_ensure_tessface(dm);
+
+	sys = init_laplacian_system(dm->getNumEdges(dm), dm->getNumTessFaces(dm), numVerts);
+	if (!sys) {
+		return;
+	}
+
+	sys->mfaces = dm->getTessFaceArray(dm);
+	sys->medges = dm->getEdgeArray(dm);
+	sys->vertexCos = vertexCos;
+	sys->min_area = 0.00001f;
+	modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
+
+	sys->vert_centroid[0] = 0.0f;
+	sys->vert_centroid[1] = 0.0f;
+	sys->vert_centroid[2] = 0.0f;
+	for (iter = 0; iter < smd->repeat; iter++) {
+		memset_laplacian_system(sys, 0);
+		nlNewContext();
+		sys->context = nlGetCurrent();
+		nlSolverParameteri(NL_NB_VARIABLES, numVerts);
+		nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
+		nlSolverParameteri(NL_NB_ROWS, numVerts);
+		nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 3);
+
+		init_laplacian_matrix(sys);
+
+		nlBegin(NL_SYSTEM);
+		for (i = 0; i < numVerts; i++) {
+			nlSetVariable(0, i, vertexCos[i][0]);
+			nlSetVariable(1, i, vertexCos[i][1]);
+			nlSetVariable(2, i, vertexCos[i][2]);
+			if (iter == 0) {
+				add_v3_v3(sys->vert_centroid, vertexCos[i]);
+			}
+		}
+		if (iter == 0 && numVerts > 0) {
+			mul_v3_fl(sys->vert_centroid, 1.0f / (float)numVerts);
+		}
+
+		nlBegin(NL_MATRIX);
+		dv = dvert;
+		for (i = 0; i < numVerts; i++) {
+			nlRightHandSideAdd(0, i, vertexCos[i][0]);
+			nlRightHandSideAdd(1, i, vertexCos[i][1]);
+			nlRightHandSideAdd(2, i, vertexCos[i][2]);
+			if (dv) {
+				wpaint = defvert_find_weight(dv, defgrp_index);
+				dv++;
+			}
+			else {
+				wpaint = 1.0f;
+			}
+
+			if (sys->zerola[i] == 0) {
+				w = sys->vweights[i] * sys->ring_areas[i];
+				sys->vweights[i] = (w == 0.0f) ? 0.0f : -smd->lambda * wpaint / (4.0f * w);
+				w = sys->vlengths[i];
+				sys->vlengths[i] = (w == 0.0f) ? 0.0f : -smd->lambda_border * wpaint * 2.0f / w;
+
+				if (sys->numNeEd[i] == sys->numNeFa[i]) {
+					nlMatrixAdd(i, i,  1.0f + smd->lambda * wpaint / (4.0f * sys->ring_areas[i]));
+				}
+				else {
+					nlMatrixAdd(i, i,  1.0f + smd->lambda_border * wpaint * 2.0f);
+				}
+			}
+			else {
+				nlMatrixAdd(i, i, 1.0f);
+			}
+		}
+
+		fill_laplacian_matrix(sys);
+
+		nlEnd(NL_MATRIX);
+		nlEnd(NL_SYSTEM);
+
+		if (nlSolveAdvanced(NULL, NL_TRUE)) {
+			validate_solution(sys, smd->flag);
+		}
+		nlDeleteContext(sys->context);
+		sys->context = NULL;
+	}
+	delete_laplacian_system(sys);
+
+}
+
+static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
+                        float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
+{
+	DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
+
+	laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
+	                           vertexCos, numVerts);
+
+	if (dm != derivedData)
+		dm->release(dm);
+}
+
+static void deformVertsEM(
+        ModifierData *md, Object *ob, struct BMEditMesh *editData,
+        DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+{
+	DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
+
+	laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
+	                           vertexCos, numVerts);
+
+	if (dm != derivedData)
+		dm->release(dm);
+}
+
+
+ModifierTypeInfo modifierType_LaplacianSmooth = {
+	/* name */              "Laplacian Smooth",
+	/* structName */        "LaplacianSmoothModifierData",
+	/* structSize */        sizeof(LaplacianSmoothModifierData),
+	/* type */              eModifierTypeType_OnlyDeform,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_SupportsEditmode,
+
+	/* copy_data */         copy_data,
+	/* deformVerts */       deformVerts,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     deformVertsEM,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     NULL,
+	/* applyModifierEM */   NULL,
+	/* initData */          init_data,
+	/* requiredDataMask */  required_data_mask,
+	/* freeData */          NULL,
+	/* isDisabled */        is_disabled,
+	/* updateDepgraph */    NULL,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */	NULL,
+	/* foreachObjectLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
+};
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index d64ccf7..a5c52c6 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -122,12 +122,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 }
 
 static void deformVertsEM(
-        ModifierData *md, Object *ob, struct BMEditMesh *editData,
+        ModifierData *md, Object *ob, struct BMEditMesh *em,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 
-	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+	if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0);
 
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index ab7263a..23ce8cd 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -179,7 +179,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		}
 		
 		/* verthash gives mapping from original vertex indices to the new indices (including selected matches only)
-		 * 	key=oldindex, value=newindex 
+		 * key = oldindex, value = newindex
 		 */
 		vertHash = BLI_ghash_int_new("mask vert gh");
 		
@@ -226,11 +226,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		int defgrp_index = defgroup_name_index(ob, mmd->vgroup);
 		
 		/* get dverts */
-		if (defgrp_index >= 0)
+		if (defgrp_index != -1)
 			dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
 			
 		/* if no vgroup (i.e. dverts) found, return the initial mesh */
-		if ((defgrp_index < 0) || (dvert == NULL))
+		if ((defgrp_index == -1) || (dvert == NULL))
 			return dm;
 			
 		/* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index f0bdf1b..f4d9b72 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -218,7 +218,7 @@ static void meshdeformModifier_do(
 	}
 	
 	if (!cagedm) {
-		modifier_setError(md, "%s", TIP_("Can't get mesh from cage object."));
+		modifier_setError(md, "Cannot get mesh from cage object");
 		return;
 	}
 
@@ -246,17 +246,17 @@ static void meshdeformModifier_do(
 	totcagevert = cagedm->getNumVerts(cagedm);
 
 	if (mmd->totvert != totvert) {
-		modifier_setError(md, TIP_("Verts changed from %d to %d."), mmd->totvert, totvert);
+		modifier_setError(md, "Verts changed from %d to %d", mmd->totvert, totvert);
 		cagedm->release(cagedm);
 		return;
 	}
 	else if (mmd->totcagevert != totcagevert) {
-		modifier_setError(md, TIP_("Cage verts changed from %d to %d."), mmd->totcagevert, totcagevert);
+		modifier_setError(md, "Cage verts changed from %d to %d", mmd->totcagevert, totcagevert);
 		cagedm->release(cagedm);
 		return;
 	}
 	else if (mmd->bindcagecos == NULL) {
-		modifier_setError(md, "%s", TIP_("Bind data missing."));
+		modifier_setError(md, "Bind data missing");
 		cagedm->release(cagedm);
 		return;
 	}
@@ -431,28 +431,28 @@ void modifier_mdef_compact_influences(ModifierData *md)
 }
 
 ModifierTypeInfo modifierType_MeshDeform = {
-	/* name */ "MeshDeform",
-	/* structName */ "MeshDeformModifierData",
-	/* structSize */ sizeof(MeshDeformModifierData),
-	/* type */ eModifierTypeType_OnlyDeform,
-	/* flags */ eModifierTypeFlag_AcceptsCVs |
-	eModifierTypeFlag_SupportsEditmode,
-
-	/* copyData */ copyData,
-	/* deformVerts */ deformVerts,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ deformVertsEM,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ NULL,
-	/* applyModifierEM */ NULL,
-	/* initData */ initData,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ freeData,
-	/* isDisabled */ isDisabled,
-	/* updateDepgraph */ updateDepgraph,
-	/* dependsOnTime */ NULL,
-	/* dependsOnNormals */ NULL,
+	/* name */              "MeshDeform",
+	/* structName */        "MeshDeformModifierData",
+	/* structSize */        sizeof(MeshDeformModifierData),
+	/* type */              eModifierTypeType_OnlyDeform,
+	/* flags */             eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_SupportsEditmode,
+
+	/* copyData */          copyData,
+	/* deformVerts */       deformVerts,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     deformVertsEM,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     NULL,
+	/* applyModifierEM */   NULL,
+	/* initData */          initData,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          freeData,
+	/* isDisabled */        isDisabled,
+	/* updateDepgraph */    updateDepgraph,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ foreachObjectLink,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index febc419..83c678d 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -43,7 +43,8 @@
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_deform.h"
-#include "BKE_tessmesh.h"
+
+#include "bmesh.h"
 
 #include "MEM_guardedalloc.h"
 #include "depsgraph_private.h"
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 3bf8b9f..564fa69 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -33,17 +33,17 @@
 #include "DNA_modifier_types.h"
 #include "DNA_scene_types.h"
 
-#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_ocean.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_math_inline.h"
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
 
+#include "BKE_cdderivedmesh.h"
+#include "BKE_global.h"
+#include "BKE_modifier.h"
+#include "BKE_ocean.h"
+
 #include "MOD_util.h"
 
 #ifdef WITH_OCEANSIM
@@ -241,13 +241,13 @@ static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, floa
 	copy_v3_v3(max, mvert->co);
 
 	for (v = 1; v < totvert; v++, mvert++) {
-		min[0] = minf(min[0], mvert->co[0]);
-		min[1] = minf(min[1], mvert->co[1]);
-		min[2] = minf(min[2], mvert->co[2]);
+		min[0] = min_ff(min[0], mvert->co[0]);
+		min[1] = min_ff(min[1], mvert->co[1]);
+		min[2] = min_ff(min[2], mvert->co[2]);
 
-		max[0] = maxf(max[0], mvert->co[0]);
-		max[1] = maxf(max[1], mvert->co[1]);
-		max[2] = maxf(max[2], mvert->co[2]);
+		max[0] = max_ff(max[0], mvert->co[0]);
+		max[1] = max_ff(max[1], mvert->co[1]);
+		max[2] = max_ff(max[2], mvert->co[2]);
 	}
 
 	sub_v3_v3v3(delta, max, min);
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index e64e80e..4984682 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -81,6 +81,44 @@ static int dependsOnTime(ModifierData *UNUSED(md))
 {
 	return 0;
 }
+
+static int isDisabled(ModifierData *md, int useRenderParams)
+{
+	ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
+	ParticleSystem *psys;
+	ModifierData *ob_md;
+	
+	if (!pimd->ob)
+		return TRUE;
+	
+	psys = BLI_findlink(&pimd->ob->particlesystem, pimd->psys - 1);
+	if (psys == NULL)
+		return TRUE;
+	
+	/* If the psys modifier is disabled we cannot use its data.
+	 * First look up the psys modifier from the object, then check if it is enabled.
+	 */
+	for (ob_md = pimd->ob->modifiers.first; ob_md; ob_md = ob_md->next) {
+		if (ob_md->type == eModifierType_ParticleSystem) {
+			ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)ob_md;
+			if (psmd->psys == psys) {
+				int required_mode;
+				
+				if (useRenderParams) required_mode = eModifierMode_Render;
+				else required_mode = eModifierMode_Realtime;
+				
+				if (!modifier_isEnabled(md->scene, ob_md, required_mode))
+					return TRUE;
+				
+				break;
+			}
+		}
+	}
+	
+	return FALSE;
+}
+
+
 static void updateDepgraph(ModifierData *md, DagForest *forest,
                            struct Scene *UNUSED(scene),
                            Object *UNUSED(ob),
@@ -363,32 +401,31 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
 	return applyModifier(md, ob, derivedData, MOD_APPLY_USECACHE);
 }
 
-
 ModifierTypeInfo modifierType_ParticleInstance = {
-	/* name */ "ParticleInstance",
-	/* structName */ "ParticleInstanceModifierData",
-	/* structSize */ sizeof(ParticleInstanceModifierData),
-	/* type */ eModifierTypeType_Constructive,
-	/* flags */ eModifierTypeFlag_AcceptsMesh |
-	eModifierTypeFlag_SupportsMapping |
-	eModifierTypeFlag_SupportsEditmode |
-	eModifierTypeFlag_EnableInEditmode,
-
-	/* copyData */ copyData,
-	/* deformVerts */ NULL,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ NULL,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ applyModifier,
-	/* applyModifierEM */ applyModifierEM,
-	/* initData */ initData,
-	/* requiredDataMask */ NULL,
-	/* freeData */ NULL,
-	/* isDisabled */ NULL,
-	/* updateDepgraph */ updateDepgraph,
-	/* dependsOnTime */ dependsOnTime,
-	/* dependsOnNormals */ NULL,
+	/* name */              "ParticleInstance",
+	/* structName */        "ParticleInstanceModifierData",
+	/* structSize */        sizeof(ParticleInstanceModifierData),
+	/* type */              eModifierTypeType_Constructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_SupportsMapping |
+	                        eModifierTypeFlag_SupportsEditmode |
+	                        eModifierTypeFlag_EnableInEditmode,
+
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   applyModifierEM,
+	/* initData */          initData,
+	/* requiredDataMask */  NULL,
+	/* freeData */          NULL,
+	/* isDisabled */        isDisabled,
+	/* updateDepgraph */    updateDepgraph,
+	/* dependsOnTime */     dependsOnTime,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ foreachObjectLink,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index 254c02b..cd2ef59 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -44,6 +44,7 @@
 #include "BKE_material.h"
 #include "BKE_modifier.h"
 #include "BKE_particle.h"
+#include "BKE_scene.h"
 
 #include "MOD_util.h"
 
@@ -130,6 +131,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 	ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
 	ParticleSystem *psys = NULL;
 	int needsFree = 0;
+	/* float cfra = BKE_scene_frame_get(md->scene); */  /* UNUSED */
 
 	if (ob->particlesystem.first)
 		psys = psmd->psys;
@@ -188,9 +190,11 @@ static void deformVerts(ModifierData *md, Object *ob,
 		psmd->totdmface = psmd->dm->getNumTessFaces(psmd->dm);
 	}
 
-	psmd->flag &= ~eParticleSystemFlag_psys_updated;
-	particle_system_update(md->scene, ob, psys);
-	psmd->flag |= eParticleSystemFlag_psys_updated;
+	if (!(ob->transflag & OB_NO_PSYS_UPDATE)) {
+		psmd->flag &= ~eParticleSystemFlag_psys_updated;
+		particle_system_update(md->scene, ob, psys);
+		psmd->flag |= eParticleSystemFlag_psys_updated;
+	}
 }
 
 /* disabled particles in editmode for now, until support for proper derivedmesh
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index 2b55471..746cad1 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -223,7 +223,7 @@ ModifierTypeInfo modifierType_Remesh = {
 	/* structSize */        sizeof(RemeshModifierData),
 	/* type */              eModifierTypeType_Nonconstructive,
 	/* flags */             eModifierTypeFlag_AcceptsMesh |
-							eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_AcceptsCVs |
 	                        eModifierTypeFlag_SupportsEditmode,
 	/* copyData */          copyData,
 	/* deformVerts */       NULL,
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index a94b483..93b5e36 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -215,7 +215,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 			if (totlen != 0.0f) {
 				float zero[3] = {0.0f, 0.0f, 0.0f};
-				float cp[3];				
+				float cp[3];
 				screw_ofs = closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
 			}
 			else {
@@ -363,7 +363,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		 */
 
 		vert_connect = MEM_mallocN(sizeof(ScrewVertConnect) * totvert, "ScrewVertConnect");
-		//vert_connect= (ScrewVertConnect *) &medge_new[totvert]; /* skip the first slice of verts */
+		//vert_connect = (ScrewVertConnect *) &medge_new[totvert];  /* skip the first slice of verts */
 		vc = vert_connect;
 
 		/* Copy Vert Locations */
@@ -475,7 +475,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 							/*printf("\t\tVERT: %i\n", lt_iter.v);*/
 							if (lt_iter.v_poin->flag) {
 								/*printf("\t\t\tBreaking Found end\n");*/
-								//endpoints[0]= endpoints[1]= -1;
+								//endpoints[0] = endpoints[1] = -1;
 								ed_loop_closed = 1; /* circle */
 								break;
 							}
@@ -490,7 +490,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 							screwvert_iter_step(&lt_iter);
 							if (!lt_iter.v_poin) {
 								/*printf("\t\t\tFound End Also Num %i\n", j);*/
-								/*endpoints[j]= lt_iter.v_other;*/ /* other is still valid */
+								/*endpoints[j] = lt_iter.v_other;*/ /* other is still valid */
 								break;
 							}
 						}
@@ -732,7 +732,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			copy_v3_v3(mv_new->co, mv_new_base->co);
 			
 			/* only need to set these if using non cleared memory */
-			/*mv_new->mat_nr= mv_new->flag= 0;*/
+			/*mv_new->mat_nr = mv_new->flag = 0;*/
 				
 			if (ltmd->ob_axis) {
 				sub_v3_v3(mv_new->co, mtx_tx[3]);
@@ -831,7 +831,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		}
 		
 		/* close the loop*/
-		if (close) { 
+		if (close) {
 			if (do_flip) {
 				ml_new[3].v = i1;
 				ml_new[2].v = i2;
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 8ef8636..7fe8dc6 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -122,6 +122,7 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
 	}
 }
 
+
 ModifierTypeInfo modifierType_ShapeKey = {
 	/* name */              "ShapeKey",
 	/* structName */        "ShapeKeyModifierData",
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 45cd33e..d3a0361 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -163,30 +163,30 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 
 
 ModifierTypeInfo modifierType_Shrinkwrap = {
-	/* name */ "Shrinkwrap",
-	/* structName */ "ShrinkwrapModifierData",
-	/* structSize */ sizeof(ShrinkwrapModifierData),
-	/* type */ eModifierTypeType_OnlyDeform,
-	/* flags */ eModifierTypeFlag_AcceptsMesh |
-	eModifierTypeFlag_AcceptsCVs |
-	eModifierTypeFlag_SupportsEditmode |
-	eModifierTypeFlag_EnableInEditmode,
-
-	/* copyData */ copyData,
-	/* deformVerts */ deformVerts,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ deformVertsEM,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ NULL,
-	/* applyModifierEM */ NULL,
-	/* initData */ initData,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ NULL,
-	/* isDisabled */ isDisabled,
-	/* updateDepgraph */ updateDepgraph,
-	/* dependsOnTime */ NULL,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Shrinkwrap",
+	/* structName */        "ShrinkwrapModifierData",
+	/* structSize */        sizeof(ShrinkwrapModifierData),
+	/* type */              eModifierTypeType_OnlyDeform,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_SupportsEditmode |
+	                        eModifierTypeFlag_EnableInEditmode,
+
+	/* copyData */          copyData,
+	/* deformVerts */       deformVerts,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     deformVertsEM,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     NULL,
+	/* applyModifierEM */   NULL,
+	/* initData */          initData,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          NULL,
+	/* isDisabled */        isDisabled,
+	/* updateDepgraph */    updateDepgraph,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ foreachObjectLink,
-	/* foreachIDLink */ NULL,
-	/* foreachTexLink */ NULL,
+	/* foreachIDLink */     NULL,
+	/* foreachTexLink */    NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 44ebc76..5267c0d 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -161,7 +161,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 	if (smd->limit[0] < 0.0f) smd->limit[0] = 0.0f;
 	if (smd->limit[0] > 1.0f) smd->limit[0] = 1.0f;
 
-	smd->limit[0] = minf(smd->limit[0], smd->limit[1]);  /* Upper limit >= than lower limit */
+	smd->limit[0] = min_ff(smd->limit[0], smd->limit[1]);  /* Upper limit >= than lower limit */
 
 	/* Calculate matrixs do convert between coordinate spaces */
 	if (smd->origin) {
@@ -191,8 +191,8 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 
 			if (transf) space_transform_apply(transf, tmp);
 
-			lower = minf(lower, tmp[limit_axis]);
-			upper = maxf(upper, tmp[limit_axis]);
+			lower = min_ff(lower, tmp[limit_axis]);
+			upper = max_ff(upper, tmp[limit_axis]);
 		}
 
 
@@ -200,7 +200,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 		smd_limit[1] = lower + (upper - lower) * smd->limit[1];
 		smd_limit[0] = lower + (upper - lower) * smd->limit[0];
 
-		smd_factor   = smd->factor / maxf(FLT_EPSILON, smd_limit[1] - smd_limit[0]);
+		smd_factor   = smd->factor / max_ff(FLT_EPSILON, smd_limit[1] - smd_limit[0]);
 	}
 
 	modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup);
@@ -353,9 +353,9 @@ ModifierTypeInfo modifierType_SimpleDeform = {
 	/* type */              eModifierTypeType_OnlyDeform,
 
 	/* flags */             eModifierTypeFlag_AcceptsMesh |
-							eModifierTypeFlag_AcceptsCVs |
-							eModifierTypeFlag_SupportsEditmode |
-							eModifierTypeFlag_EnableInEditmode,
+	                        eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_SupportsEditmode |
+	                        eModifierTypeFlag_EnableInEditmode,
 
 	/* copyData */          copyData,
 	/* deformVerts */       deformVerts,
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 222f131..a73d52a 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -77,7 +77,8 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
-#include "BKE_tessmesh.h"
+
+#include "bmesh.h"
 
 #include "MOD_util.h"
 
@@ -143,6 +144,7 @@ static int is_quad_symmetric(BMVert *quad[4],
                              const SkinModifierData *smd)
 {
 	const float threshold = 0.0001f;
+	const float threshold_squared = threshold * threshold;
 	int axis;
 
 	for (axis = 0; axis < 3; axis++) {
@@ -152,16 +154,16 @@ static int is_quad_symmetric(BMVert *quad[4],
 			copy_v3_v3(a, quad[0]->co);
 			a[axis] = -a[axis];
 
-			if (len_v3v3(a, quad[1]->co) < threshold) {
+			if (len_squared_v3v3(a, quad[1]->co) < threshold_squared) {
 				copy_v3_v3(a, quad[2]->co);
 				a[axis] = -a[axis];
-				if (len_v3v3(a, quad[3]->co) < threshold)
+				if (len_squared_v3v3(a, quad[3]->co) < threshold_squared)
 					return 1;
 			}
-			else if (len_v3v3(a, quad[3]->co) < threshold) {
+			else if (len_squared_v3v3(a, quad[3]->co) < threshold_squared) {
 				copy_v3_v3(a, quad[2]->co);
 				a[axis] = -a[axis];
-				if (len_v3v3(a, quad[1]->co) < threshold)
+				if (len_squared_v3v3(a, quad[1]->co) < threshold_squared)
 					return 1;
 			}
 		}
@@ -178,13 +180,13 @@ static int quad_crosses_symmetry_plane(BMVert *quad[4],
 
 	for (axis = 0; axis < 3; axis++) {
 		if (smd->symmetry_axes & (1 << axis)) {
-			int i, left = 0, right = 0;
+			int i, left = FALSE, right = FALSE;
 
 			for (i = 0; i < 4; i++) {
-				if (quad[i]->co[axis] < 0)
-					left = 1;
-				else if (quad[i]->co[axis] > 0)
-					right = 1;
+				if (quad[i]->co[axis] < 0.0f)
+					left = TRUE;
+				else if (quad[i]->co[axis] > 0.0f)
+					right = TRUE;
 
 				if (left && right)
 					return TRUE;
@@ -247,14 +249,14 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
 	}
 
 	/* Apply face attributes to hull output */
-	BMO_ITER (f, &oiter, bm, &op, "geomout", BM_FACE) {
+	BMO_ITER (f, &oiter, op.slots_out, "geom.out", BM_FACE) {
 		if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
 			BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
 		f->mat_nr = so->mat_nr;
 	}
 
 	/* Mark interior frames */
-	BMO_ITER (v, &oiter, bm, &op, "interior_geom", BM_VERT) {
+	BMO_ITER (v, &oiter, op.slots_out, "geom_interior.out", BM_VERT) {
 		for (i = 0; i < totframe; i++) {
 			Frame *frame = frames[i];
 			
@@ -307,7 +309,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
 
 	/* Check if removing triangles above will create wire triangles,
 	 * mark them too */
-	BMO_ITER (e, &oiter, bm, &op, "geomout", BM_EDGE) {
+	BMO_ITER (e, &oiter, op.slots_out, "geom.out", BM_EDGE) {
 		int is_wire = TRUE;
 		BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
 			if (!BM_elem_flag_test(f, BM_ELEM_TAG)) {
@@ -355,7 +357,7 @@ static void merge_frame_corners(Frame **frames, int totframe)
 				BLI_assert(frames[i] != frames[k]);
 
 				side_b = frame_len(frames[k]);
-				thresh = minf(side_a, side_b) / 2.0f;
+				thresh = min_ff(side_a, side_b) / 2.0f;
 
 				/* Compare with each corner of all other frames... */
 				for (l = 0; l < 4; l++) {
@@ -535,6 +537,7 @@ static int connection_node_mat(float mat[3][3], int v, const MeshElemMap *emap,
 	/* Get axis and angle to rotate frame by */
 	angle = angle_normalized_v3v3(ine[0], oute[0]) / 2.0f;
 	cross_v3_v3v3(axis, ine[0], oute[0]);
+	normalize_v3(axis);
 
 	/* Build frame matrix (don't care about X axis here) */
 	copy_v3_v3(mat[0], ine[0]);
@@ -642,8 +645,8 @@ typedef struct {
 } EdgeStackElem;
 
 static void build_emats_stack(BLI_Stack *stack, int *visited_e, EMat *emat,
-							  const MeshElemMap *emap, const MEdge *medge,
-							  const MVertSkin *vs, const MVert *mvert)
+                              const MeshElemMap *emap, const MEdge *medge,
+                              const MVertSkin *vs, const MVert *mvert)
 {
 	EdgeStackElem stack_elem;
 	float axis[3], angle;
@@ -671,7 +674,7 @@ static void build_emats_stack(BLI_Stack *stack, int *visited_e, EMat *emat,
 	/* If parent is a branch node, start a new edge chain */
 	if (parent_is_branch) {
 		calc_edge_mat(emat[e].mat, mvert[parent_v].co,
-					  mvert[v].co);
+		              mvert[v].co);
 	}
 	else {
 		/* Build edge matrix guided by parent matrix */
@@ -695,11 +698,11 @@ static void build_emats_stack(BLI_Stack *stack, int *visited_e, EMat *emat,
 }
 
 static EMat *build_edge_mats(const MVertSkin *vs,
-							 const MVert *mvert,
-							 int totvert,
+                             const MVert *mvert,
+                             int totvert,
                              const MEdge *medge,
-							 const MeshElemMap *emap,
-							 int totedge)
+                             const MeshElemMap *emap,
+                             int totedge)
 {
 	BLI_Stack *stack;
 	EMat *emat;
@@ -938,18 +941,18 @@ static void add_poly(SkinOutput *so,
 	BLI_assert(v3 != v4);
 	BLI_assert(v1 && v2 && v3);
 
-	edges[0] = BM_edge_create(so->bm, v1, v2, NULL, TRUE);
-	edges[1] = BM_edge_create(so->bm, v2, v3, NULL, TRUE);
+	edges[0] = BM_edge_create(so->bm, v1, v2, NULL, BM_CREATE_NO_DOUBLE);
+	edges[1] = BM_edge_create(so->bm, v2, v3, NULL, BM_CREATE_NO_DOUBLE);
 	if (v4) {
-		edges[2] = BM_edge_create(so->bm, v3, v4, NULL, TRUE);
-		edges[3] = BM_edge_create(so->bm, v4, v1, NULL, TRUE);
+		edges[2] = BM_edge_create(so->bm, v3, v4, NULL, BM_CREATE_NO_DOUBLE);
+		edges[3] = BM_edge_create(so->bm, v4, v1, NULL, BM_CREATE_NO_DOUBLE);
 	}
 	else {
-		edges[2] = BM_edge_create(so->bm, v3, v1, NULL, TRUE);
+		edges[2] = BM_edge_create(so->bm, v3, v1, NULL, BM_CREATE_NO_DOUBLE);
 		edges[3] = NULL;
 	}
 
-	f = BM_face_create(so->bm, verts, edges, v4 ? 4 : 3, TRUE);
+	f = BM_face_create(so->bm, verts, edges, v4 ? 4 : 3, BM_CREATE_NO_DOUBLE);
 	if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
 		BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
 	f->mat_nr = so->mat_nr;
@@ -957,12 +960,12 @@ static void add_poly(SkinOutput *so,
 
 static void connect_frames(SkinOutput *so,
                            BMVert *frame1[4],
-                           BMVert *frame2[4])
+BMVert *frame2[4])
 {
 	BMVert *q[4][4] = {{frame2[0], frame2[1], frame1[1], frame1[0]},
-					   {frame2[1], frame2[2], frame1[2], frame1[1]},
-					   {frame2[2], frame2[3], frame1[3], frame1[2]},
-					   {frame2[3], frame2[0], frame1[0], frame1[3]}};
+	                   {frame2[1], frame2[2], frame1[2], frame1[1]},
+	                   {frame2[2], frame2[3], frame1[3], frame1[2]},
+	                   {frame2[3], frame2[0], frame1[0], frame1[3]}};
 	float p[3], no[3];
 	int i, swap;
 
@@ -993,7 +996,7 @@ static void output_frames(BMesh *bm,
 		f = &sn->frames[i];
 		for (j = 0; j < 4; j++) {
 			if (!f->merge[j].frame) {
-				BMVert *v = f->verts[j] = BM_vert_create(bm, f->co[j], NULL);
+				BMVert *v = f->verts[j] = BM_vert_create(bm, f->co[j], NULL, 0);
 
 				if (input_dvert) {
 					MDeformVert *dv;
@@ -1077,17 +1080,20 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
 		BMOperator op;
 		BMIter iter;
 		int i;
+		BMOpSlot *slot_targetmap;
 
 		shortest_edge = BM_face_find_shortest_loop(f)->e;
 		BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "weld_verts");
 
+		slot_targetmap = BMO_slot_get(op.slots_in, "targetmap");
+
 		/* Note: could probably calculate merges in one go to be
 		 * faster */
 
 		v_safe = shortest_edge->v1;
 		v_merge = shortest_edge->v2;
 		mid_v3_v3v3(v_safe->co, v_safe->co, v_merge->co);
-		BMO_slot_map_ptr_insert(bm, &op, "targetmap", v_merge, v_safe);
+		BMO_slot_map_elem_insert(&op, slot_targetmap, v_merge, v_safe);
 		BMO_op_exec(bm, &op);
 		BMO_op_finish(bm, &op);
 
@@ -1213,6 +1219,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
 	BMOIter oiter;
 	BMOperator op;
 	int i, best_order[4];
+	BMOpSlot *slot_targetmap;
 
 	BLI_assert(split_face->len >= 3);
 
@@ -1226,7 +1233,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
 	/* Update split face (should only be one new face created
 	 * during extrusion) */
 	split_face = NULL;
-	BMO_ITER (f, &oiter, bm, &op, "faceout", BM_FACE) {
+	BMO_ITER (f, &oiter, op.slots_out, "faces.out", BM_FACE) {
 		BLI_assert(!split_face);
 		split_face = f;
 	}
@@ -1244,7 +1251,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
 		BM_elem_flag_enable(longest_edge, BM_ELEM_TAG);
 
 		BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
-		             "subdivide_edges edges=%he numcuts=%i quadcornertype=%i",
+		             "subdivide_edges edges=%he cuts=%i quad_corner_type=%i",
 		             BM_ELEM_TAG, 1, SUBD_STRAIGHT_CUT);
 	}
 	else if (split_face->len > 4) {
@@ -1278,9 +1285,9 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
 	BM_face_kill(bm, split_face);
 	BMO_op_init(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
 	            "weld_verts");
+	slot_targetmap = BMO_slot_get(op.slots_in, "targetmap");
 	for (i = 0; i < 4; i++) {
-		BMO_slot_map_ptr_insert(bm, &op, "targetmap",
-		                        verts[i], frame->verts[best_order[i]]);
+		BMO_slot_map_elem_insert(&op, slot_targetmap, verts[i], frame->verts[best_order[i]]);
 	}
 	BMO_op_exec(bm, &op);
 	BMO_op_finish(bm, &op);
@@ -1302,7 +1309,7 @@ static void skin_hole_detach_partially_attached_frame(BMesh *bm, Frame *frame)
 	/* Detach everything */
 	for (i = 0; i < totattached; i++) {
 		BMVert **av = &frame->verts[attached[i]];
-		(*av) = BM_vert_create(bm, (*av)->co, *av);
+		(*av) = BM_vert_create(bm, (*av)->co, *av, 0);
 	}
 }
 
@@ -1352,24 +1359,6 @@ static void add_quad_from_tris(SkinOutput *so, BMEdge *e, BMFace *adj[2])
 	add_poly(so, quad[0], quad[1], quad[2], quad[3]);
 }
 
-/* Returns the number of faces that are adjacent to both f1 and f2 */
-static int BM_face_share_face_count(BMFace *f1, BMFace *f2)
-{
-	BMIter iter1, iter2;
-	BMEdge *e;
-	BMFace *f;
-	int count = 0;
-
-	BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
-		BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
-			if (f != f1 && f != f2 && BM_face_share_edge_count(f, f2))
-				count++;
-		}
-	}
-
-	return count;
-}
-
 static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
 {
 	BMIter iter;
@@ -1422,7 +1411,7 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
 		}
 	}
 
-	while (!BLI_heap_empty(heap)) {
+	while (!BLI_heap_is_empty(heap)) {
 		BMFace *adj[2];
 
 		e = BLI_heap_popmin(heap);
@@ -1432,7 +1421,7 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
 			 * share a border with another face, output as a quad */
 			if (!BM_elem_flag_test(adj[0], BM_ELEM_TAG) &&
 			    !BM_elem_flag_test(adj[1], BM_ELEM_TAG) &&
-			    !BM_face_share_face_count(adj[0], adj[1]))
+			    !BM_face_share_face_check(adj[0], adj[1]))
 			{
 				add_quad_from_tris(so, e, adj);
 				BM_elem_flag_enable(adj[0], BM_ELEM_TAG);
@@ -1544,23 +1533,23 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes,
 		if (sn->flag & CAP_START) {
 			if (sn->flag & ROOT) {
 				add_poly(so,
-						 sn->frames[0].verts[0],
-						 sn->frames[0].verts[1],
-						 sn->frames[0].verts[2],
-						 sn->frames[0].verts[3]);
+				         sn->frames[0].verts[0],
+				         sn->frames[0].verts[1],
+				         sn->frames[0].verts[2],
+				         sn->frames[0].verts[3]);
 			}
 			else {
 				add_poly(so,
-						 sn->frames[0].verts[3],
-						 sn->frames[0].verts[2],
-						 sn->frames[0].verts[1],
-						 sn->frames[0].verts[0]);
+				         sn->frames[0].verts[3],
+				         sn->frames[0].verts[2],
+				         sn->frames[0].verts[1],
+				         sn->frames[0].verts[0]);
 			}
 		}
 		if (sn->flag & CAP_END) {
 			add_poly(so,
 			         sn->frames[1].verts[0],
-			         sn->frames[1].verts[1],
+			        sn->frames[1].verts[1],
 			         sn->frames[1].verts[2],
 			         sn->frames[1].verts[3]);
 		}
@@ -1770,7 +1759,6 @@ static void skin_set_orig_indices(DerivedMesh *dm)
 static DerivedMesh *base_skin(DerivedMesh *origdm,
                               SkinModifierData *smd)
 {
-	BMEditMesh fake_em;
 	DerivedMesh *result;
 	MVertSkin *nodes;
 	BMesh *bm;
@@ -1807,8 +1795,7 @@ static DerivedMesh *base_skin(DerivedMesh *origdm,
 	if (!bm)
 		return NULL;
 	
-	fake_em.bm = bm;
-	result = CDDM_from_BMEditMesh(&fake_em, NULL, FALSE, FALSE);
+	result = CDDM_from_bmesh(bm, FALSE);
 	BM_mesh_free(bm);
 
 	CDDM_calc_edges(result);
@@ -1861,7 +1848,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 
 static DerivedMesh *applyModifierEM(ModifierData *md,
                                     Object *UNUSED(ob),
-                                    BMEditMesh *UNUSED(em),
+                                    struct BMEditMesh *UNUSED(em),
                                     DerivedMesh *dm)
 {
 	DerivedMesh *result;
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index b9b3b89..4b2ce47 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -81,19 +81,31 @@ static void freeData(ModifierData *md)
 	smokeModifier_free(smd);
 }
 
-static void deformVerts(ModifierData *md, Object *ob,
-                        DerivedMesh *derivedData,
-                        float (*vertexCos)[3],
-                        int UNUSED(numVerts),
-                        ModifierApplyFlag UNUSED(flag))
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 {
-	SmokeModifierData *smd = (SmokeModifierData *) md;
-	DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos);
+	SmokeModifierData *smd  = (SmokeModifierData *)md;
+	CustomDataMask dataMask = 0;
+
+	if (smd && (smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
+		if (smd->flow->source == MOD_SMOKE_FLOW_SOURCE_MESH) {
+			/* vertex groups */
+			if (smd->flow->vgroup_density)
+				dataMask |= CD_MASK_MDEFORMVERT;
+			/* uv layer */
+			if (smd->flow->texture_type == MOD_SMOKE_FLOW_TEXTURE_MAP_UV)
+				dataMask |= CD_MASK_MTFACE;
+		}
+	}
+	return dataMask;
+}
 
-	smokeModifier_do(smd, md->scene, ob, dm);
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob, 
+                                  DerivedMesh *dm,
+                                  ModifierApplyFlag UNUSED(flag))
+{
+	SmokeModifierData *smd = (SmokeModifierData *) md;
 
-	if (dm != derivedData)
-		dm->release(dm);
+	return smokeModifier_do(smd, md->scene, ob, dm);
 }
 
 static int dependsOnTime(ModifierData *UNUSED(md))
@@ -102,11 +114,11 @@ static int dependsOnTime(ModifierData *UNUSED(md))
 }
 
 static void updateDepgraph(ModifierData *md, DagForest *forest,
-                           struct Scene *scene,
-                           Object *UNUSED(ob),
+                           struct Scene *scene, struct Object *ob,
                            DagNode *obNode)
 {
 	SmokeModifierData *smd = (SmokeModifierData *) md;
+	Base *base;
 
 	if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
 		if (smd->domain->fluid_group || smd->domain->coll_group) {
@@ -139,8 +151,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 				}
 		}
 		else {
-			Base *base = scene->base.first;
-
+			base = scene->base.first;
 			for (; base; base = base->next) {
 				SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(base->object, eModifierType_Smoke);
 
@@ -150,6 +161,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 				}
 			}
 		}
+		/* add relation to all "smoke flow" force fields */
+		base = scene->base.first;
+		for (; base; base = base->next) {
+			if (base->object->pd && base->object->pd->forcefield == PFIELD_SMOKEFLOW && base->object->pd->f_source == ob) {
+				DagNode *node2 = dag_get_node(forest, base->object);
+				dag_add_relation(forest, obNode, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Source Object");
+			}
+		}
 	}
 }
 
@@ -167,26 +186,30 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 			walk(userData, ob, (ID **)&smd->domain->effector_weights->group);
 		}
 	}
+
+	if (smd->type == MOD_SMOKE_TYPE_FLOW && smd->flow) {
+		walk(userData, ob, (ID **)&smd->flow->noise_texture);
+	}
 }
 
 ModifierTypeInfo modifierType_Smoke = {
 	/* name */              "Smoke",
 	/* structName */        "SmokeModifierData",
 	/* structSize */        sizeof(SmokeModifierData),
-	/* type */              eModifierTypeType_OnlyDeform,
+	/* type */              eModifierTypeType_Constructive,
 	/* flags */             eModifierTypeFlag_AcceptsMesh |
 	                        eModifierTypeFlag_UsesPointCache |
 	                        eModifierTypeFlag_Single,
 
 	/* copyData */          copyData,
-	/* deformVerts */       deformVerts,
+	/* deformVerts */       NULL,
 	/* deformMatrices */    NULL,
 	/* deformVertsEM */     NULL,
 	/* deformMatricesEM */  NULL,
-	/* applyModifier */     NULL,
+	/* applyModifier */     applyModifier,
 	/* applyModifierEM */   NULL,
 	/* initData */          initData,
-	/* requiredDataMask */  NULL,
+	/* requiredDataMask */  requiredDataMask,
 	/* freeData */          freeData,
 	/* isDisabled */        NULL,
 	/* updateDepgraph */    updateDepgraph,
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 545e213..1d35d8f 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -250,7 +250,7 @@ ModifierTypeInfo modifierType_Smooth = {
 	/* structSize */        sizeof(SmoothModifierData),
 	/* type */              eModifierTypeType_OnlyDeform,
 	/* flags */             eModifierTypeFlag_AcceptsMesh |
-							eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_AcceptsCVs |
 	                        eModifierTypeFlag_SupportsEditmode,
 
 	/* copyData */          copyData,
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 1df7d53..75e54d7 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -207,9 +207,10 @@ BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f)
 	r[2] += (float)a[2] * f;
 }
 
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
-		DerivedMesh *dm,
-		ModifierApplyFlag UNUSED(flag))
+static DerivedMesh *applyModifier(
+        ModifierData *md, Object *ob,
+        DerivedMesh *dm,
+        ModifierApplyFlag UNUSED(flag))
 {
 	int i;
 	DerivedMesh *result;
@@ -223,7 +224,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	const int numEdges = dm->getNumEdges(dm);
 	const int numFaces = dm->getNumPolys(dm);
 	int numLoops = 0, newLoops = 0, newFaces = 0, newEdges = 0;
-	int j;
 
 	/* only use material offsets if we have 2 or more materials  */
 	const short mat_nr_max = ob->totcol > 1 ? ob->totcol - 1 : 0;
@@ -292,9 +292,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		}
 
 		for (i = 0, mp = orig_mpoly; i < numFaces; i++, mp++) {
-			MLoop *ml = orig_mloop + mp->loopstart;
 			unsigned int ml_v1;
 			unsigned int ml_v2;
+			int j;
+
+			ml = orig_mloop + mp->loopstart;
 
 			for (j = 0, ml_v1 = ml->v, ml_v2 = ml[mp->totloop - 1].v;
 			     j < mp->totloop;
@@ -376,6 +378,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	for (i = 0; i < dm->numPolyData; i++, mp++) {
 		MLoop *ml2;
 		int e;
+		int j;
 
 		ml2 = mloop + mp->loopstart + dm->numLoopData;
 		for (j = 0; j < mp->totloop; j++) {
@@ -591,6 +594,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 		int *origindex_edge;
 		int *orig_ed;
+		int j;
 
 		/* add faces & edges */
 		origindex_edge = result->getEdgeDataArray(result, CD_ORIGINDEX);
@@ -715,13 +719,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		for (i = 0; i < newEdges; i++, ed++) {
 			float nor_cpy[3];
 			short *nor_short;
-			int j;
+			int k;
 
 			/* note, only the first vertex (lower half of the index) is calculated */
 			normalize_v3_v3(nor_cpy, edge_vert_nos[ed->v1]);
 
-			for (j = 0; j < 2; j++) { /* loop over both verts of the edge */
-				nor_short = mvert[*(&ed->v1 + j)].no;
+			for (k = 0; k < 2; k++) { /* loop over both verts of the edge */
+				nor_short = mvert[*(&ed->v1 + k)].no;
 				normal_short_to_float_v3(nor, nor_short);
 				add_v3_v3(nor, nor_cpy);
 				normalize_v3(nor);
@@ -746,6 +750,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		CDDM_calc_normals(result);
 	}
 
+	if (numFaces == 0 && numEdges != 0) {
+		modifier_setError(md, "Faces needed for useful output");
+	}
+
 	return result;
 }
 
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
new file mode 100644
index 0000000..645fd5e
--- /dev/null
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -0,0 +1,144 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Antony Riakiotakis
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/modifiers/intern/MOD_triangulate.c
+ *  \ingroup modifiers
+ */
+
+#include "DNA_object_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_modifier.h"
+#include "BKE_tessmesh.h"
+
+/* triangulation modifier, directly calls the bmesh operator */
+
+static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
+{
+	DerivedMesh *result;
+	BMesh *bm;
+	int total_edges, i;
+	MEdge *me;
+
+	bm = DM_to_bmesh(dm);
+
+	BM_mesh_elem_toolflags_ensure(bm);
+	BMO_push(bm, NULL);
+
+	BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+	             "triangulate faces=%af use_beauty=%b",
+	             (flag & MOD_TRIANGULATE_BEAUTY));
+	BMO_pop(bm);
+
+	result = CDDM_from_bmesh(bm, FALSE);
+	BM_mesh_free(bm);
+
+	total_edges = result->getNumEdges(result);
+	me = CDDM_get_edges(result);
+
+	/* force drawing of all edges (seems to be omitted in CDDM_from_bmesh) */
+	for (i = 0; i < total_edges; i++, me++)
+		me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
+
+	CDDM_calc_normals(result);
+
+	return result;
+}
+
+
+static void initData(ModifierData *md)
+{
+	TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+
+	/* Enable in editmode by default */
+	md->mode |= eModifierMode_Editmode;
+	tmd->flag = MOD_TRIANGULATE_BEAUTY;
+}
+
+
+static void copyData(ModifierData *md, ModifierData *target)
+{
+	TriangulateModifierData *smd = (TriangulateModifierData *) md;
+	TriangulateModifierData *tsmd = (TriangulateModifierData *) target;
+
+	*tsmd = *smd;
+}
+
+static DerivedMesh *applyModifierEM(ModifierData *md,
+                                    Object *UNUSED(ob),
+                                    struct BMEditMesh *UNUSED(em),
+                                    DerivedMesh *dm)
+{
+	TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+	DerivedMesh *result;
+	if (!(result = triangulate_dm(dm, tmd->flag))) {
+		return dm;
+	}
+
+	return result;
+}
+
+static DerivedMesh *applyModifier(ModifierData *md,
+                                  Object *UNUSED(ob),
+                                  DerivedMesh *dm,
+                                  ModifierApplyFlag UNUSED(flag))
+{
+	TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+	DerivedMesh *result;
+	if (!(result = triangulate_dm(dm, tmd->flag))) {
+		return dm;
+	}
+
+	return result;
+}
+
+ModifierTypeInfo modifierType_Triangulate = {
+	/* name */              "Triangulate",
+	/* structName */        "TriangulateModifierData",
+	/* structSize */        sizeof(TriangulateModifierData),
+	/* type */              eModifierTypeType_Constructive,
+	/* flags */             eModifierTypeFlag_AcceptsMesh |
+	                        eModifierTypeFlag_SupportsEditmode |
+	                        eModifierTypeFlag_SupportsMapping |
+	                        eModifierTypeFlag_EnableInEditmode |
+	                        eModifierTypeFlag_AcceptsCVs,
+
+	/* copyData */          copyData,
+	/* deformVerts */       NULL,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     NULL,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     applyModifier,
+	/* applyModifierEM */   applyModifierEM,
+	/* initData */          initData,
+	/* requiredDataMask */  NULL, //requiredDataMask,
+	/* freeData */          NULL,
+	/* isDisabled */        NULL,
+	/* updateDepgraph */    NULL,
+	/* dependsOnTime */     NULL,
+	/* dependsOnNormals */	NULL,
+	/* foreachObjectLink */ NULL,
+	/* foreachIDLink */     NULL,
+};
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 1dbbe14..a27d5e5 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -199,7 +199,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*
 		return dm;
 
 	if (ob->type == OB_MESH) {
-		if (em) dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
+		if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 		else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob);
 
 		if (vertexCos) {
@@ -222,7 +222,7 @@ void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformV
 	*defgrp_index = defgroup_name_index(ob, name);
 	*dvert = NULL;
 
-	if (*defgrp_index >= 0) {
+	if (*defgrp_index != -1) {
 		if (ob->type == OB_LATTICE)
 			*dvert = BKE_lattice_deform_verts_get(ob);
 		else if (dm)
@@ -277,5 +277,7 @@ void modifier_type_init(ModifierTypeInfo *types[])
 	INIT_TYPE(DynamicPaint);
 	INIT_TYPE(Remesh);
 	INIT_TYPE(Skin);
+	INIT_TYPE(LaplacianSmooth);
+	INIT_TYPE(Triangulate);
 #undef INIT_TYPE
 }
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index eadf7af..6f05c9a 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -42,10 +42,14 @@ struct TexResult;
 
 void modifier_init_texture(struct Scene *scene, struct Tex *texture);
 void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
-void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts);
+void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm,
+                        float (*co)[3], float (*texco)[3], int numVerts);
 void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
-struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
-struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
-void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index);
+struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
+                             float (*vertexCos)[3]);
+struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
+                           float (*vertexCos)[3], int orco);
+void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm,
+                         const char *name, struct MDeformVert **dvert, int *defgrp_index);
 
 #endif /* __MOD_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 95f6ef6..c2a6223 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -238,7 +238,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 		     (fac = (wmd->falloff_radius - fac) / wmd->falloff_radius)))
 		{
 			/* skip if no vert group found */
-			if (dvert && defgrp_index >= 0) {
+			if (dvert && defgrp_index != -1) {
 				dv = &dvert[i];
 
 				if (dv) {
@@ -337,7 +337,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 	}
 }
 
-static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData,
+static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *em,
                           DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
@@ -345,7 +345,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
 
 	if (use_dm) {
 		if (!derivedData)
-			dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+			dm = CDDM_from_editbmesh(em, FALSE, FALSE);
 	}
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0);
@@ -357,27 +357,27 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
 
 
 ModifierTypeInfo modifierType_Warp = {
-	/* name */ "Warp",
-	/* structName */ "WarpModifierData",
-	/* structSize */ sizeof(WarpModifierData),
-	/* type */ eModifierTypeType_OnlyDeform,
-	/* flags */ eModifierTypeFlag_AcceptsCVs |
-	eModifierTypeFlag_SupportsEditmode,
-	/* copyData */ copyData,
-	/* deformVerts */ deformVerts,
-	/* deformMatrices */ NULL,
-	/* deformVertsEM */ deformVertsEM,
-	/* deformMatricesEM */ NULL,
-	/* applyModifier */ 0,
-	/* applyModifierEM */ 0,
-	/* initData */ initData,
-	/* requiredDataMask */ requiredDataMask,
-	/* freeData */ freeData,
-	/* isDisabled */ isDisabled,
-	/* updateDepgraph */ updateDepgraph,
-	/* dependsOnTime */ dependsOnTime,
-	/* dependsOnNormals */ NULL,
+	/* name */              "Warp",
+	/* structName */        "WarpModifierData",
+	/* structSize */        sizeof(WarpModifierData),
+	/* type */              eModifierTypeType_OnlyDeform,
+	/* flags */             eModifierTypeFlag_AcceptsCVs |
+	                        eModifierTypeFlag_SupportsEditmode,
+	/* copyData */          copyData,
+	/* deformVerts */       deformVerts,
+	/* deformMatrices */    NULL,
+	/* deformVertsEM */     deformVertsEM,
+	/* deformMatricesEM */  NULL,
+	/* applyModifier */     0,
+	/* applyModifierEM */   0,
+	/* initData */          initData,
+	/* requiredDataMask */  requiredDataMask,
+	/* freeData */          freeData,
+	/* isDisabled */        isDisabled,
+	/* updateDepgraph */    updateDepgraph,
+	/* dependsOnTime */     dependsOnTime,
+	/* dependsOnNormals */  NULL,
 	/* foreachObjectLink */ foreachObjectLink,
-	/* foreachIDLink */ foreachIDLink,
-	/* foreachTexLink */ foreachTexLink,
+	/* foreachIDLink */     foreachIDLink,
+	/* foreachTexLink */    foreachTexLink,
 };
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 440d2c1..b713f56 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -186,7 +186,7 @@ static void waveModifier_do(WaveModifierData *md,
 	const float falloff = wmd->falloff;
 	float falloff_fac = 1.0f; /* when falloff == 0.0f this stays at 1.0f */
 
-	if (wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH)
+	if ((wmd->flag & MOD_WAVE_NORM) && (ob->type == OB_MESH))
 		mvert = dm->getVertArray(dm);
 
 	if (wmd->objectcenter) {
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index ce6295e..779ac6b 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -185,7 +185,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	float *org_w; /* Array original weights. */
 	float *new_w; /* Array new weights. */
 	int numVerts;
-	int defgrp_idx;
+	int defgrp_index;
 	int i;
 	/* Flags. */
 	int do_add  = (wmd->edit_flags & MOD_WVG_EDIT_ADD2VG) != 0;
@@ -205,8 +205,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		return dm;
 
 	/* Get vgroup idx from its name. */
-	defgrp_idx = defgroup_name_index(ob, wmd->defgrp_name);
-	if (defgrp_idx < 0)
+	defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
+	if (defgrp_index == -1)
 		return dm;
 
 	dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
@@ -228,7 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	new_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, new_w");
 	dw = MEM_mallocN(sizeof(MDeformWeight *) * numVerts, "WeightVGEdit Modifier, dw");
 	for (i = 0; i < numVerts; i++) {
-		dw[i] = defvert_find_index(&dvert[i], defgrp_idx);
+		dw[i] = defvert_find_index(&dvert[i], defgrp_index);
 		if (dw[i]) {
 			org_w[i] = new_w[i] = dw[i]->weight;
 		}
@@ -249,7 +249,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	                 wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
 
 	/* Update/add/remove from vgroup. */
-	weightvg_update_vg(dvert, defgrp_idx, dw, numVerts, NULL, org_w, do_add, wmd->add_threshold,
+	weightvg_update_vg(dvert, defgrp_index, dw, numVerts, NULL, org_w, do_add, wmd->add_threshold,
 	                   do_rem, wmd->rem_threshold);
 
 	/* If weight preview enabled... */
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 2961082..5883b17 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -225,7 +225,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	MDeformVert *dvert = NULL;
 	MDeformWeight **dw1, **tdw1, **dw2, **tdw2;
 	int numVerts;
-	int defgrp_idx, defgrp_idx2 = -1;
+	int defgrp_index, defgrp_index_other = -1;
 	float *org_w;
 	float *new_w;
 	int *tidx, *indices = NULL;
@@ -246,13 +246,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		return dm;
 
 	/* Get vgroup idx from its name. */
-	defgrp_idx = defgroup_name_index(ob, wmd->defgrp_name_a);
-	if (defgrp_idx < 0)
+	defgrp_index = defgroup_name_index(ob, wmd->defgrp_name_a);
+	if (defgrp_index == -1)
 		return dm;
 	/* Get seconf vgroup idx from its name, if given. */
 	if (wmd->defgrp_name_b[0] != (char)0) {
-		defgrp_idx2 = defgroup_name_index(ob, wmd->defgrp_name_b);
-		if (defgrp_idx2 < 0)
+		defgrp_index_other = defgroup_name_index(ob, wmd->defgrp_name_b);
+		if (defgrp_index_other == -1)
 			return dm;
 	}
 
@@ -277,10 +277,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		case MOD_WVG_SET_A:
 			/* All vertices in first vgroup. */
 			for (i = 0; i < numVerts; i++) {
-				MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx);
+				MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_index);
 				if (dw) {
 					tdw1[numIdx] = dw;
-					tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2);
+					tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_index_other);
 					tidx[numIdx++] = i;
 				}
 			}
@@ -288,9 +288,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		case MOD_WVG_SET_B:
 			/* All vertices in second vgroup. */
 			for (i = 0; i < numVerts; i++) {
-				MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2);
+				MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_index_other);
 				if (dw) {
-					tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx);
+					tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_index);
 					tdw2[numIdx] = dw;
 					tidx[numIdx++] = i;
 				}
@@ -299,8 +299,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		case MOD_WVG_SET_OR:
 			/* All vertices in one vgroup or the other. */
 			for (i = 0; i < numVerts; i++) {
-				MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
-				MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
+				MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_index);
+				MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_index_other);
 				if (adw || bdw) {
 					tdw1[numIdx] = adw;
 					tdw2[numIdx] = bdw;
@@ -311,8 +311,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		case MOD_WVG_SET_AND:
 			/* All vertices in both vgroups. */
 			for (i = 0; i < numVerts; i++) {
-				MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
-				MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
+				MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_index);
+				MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_index_other);
 				if (adw && bdw) {
 					tdw1[numIdx] = adw;
 					tdw2[numIdx] = bdw;
@@ -324,8 +324,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		default:
 			/* Use all vertices. */
 			for (i = 0; i < numVerts; i++) {
-				tdw1[i] = defvert_find_index(&dvert[i], defgrp_idx);
-				tdw2[i] = defvert_find_index(&dvert[i], defgrp_idx2);
+				tdw1[i] = defvert_find_index(&dvert[i], defgrp_index);
+				tdw2[i] = defvert_find_index(&dvert[i], defgrp_index_other);
 			}
 			numIdx = -1;
 			break;
@@ -377,7 +377,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	/* Update (add to) vgroup.
 	 * XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup.
 	 */
-	weightvg_update_vg(dvert, defgrp_idx, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f);
+	weightvg_update_vg(dvert, defgrp_index, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f);
 
 	/* If weight preview enabled... */
 #if 0 /* XXX Currently done in mod stack :/ */
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 25a2a61..e936e57 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -347,7 +347,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	int numVerts;
 	float (*v_cos)[3] = NULL; /* The vertices coordinates. */
 	Object *obr = NULL; /* Our target object. */
-	int defgrp_idx;
+	int defgrp_index;
 	float *tw = NULL;
 	float *org_w = NULL;
 	float *new_w = NULL;
@@ -378,8 +378,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		return dm;
 
 	/* Get vgroup idx from its name. */
-	defgrp_idx = defgroup_name_index(ob, wmd->defgrp_name);
-	if (defgrp_idx < 0)
+	defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
+	if (defgrp_index == -1)
 		return dm;
 
 	dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
@@ -394,7 +394,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	tw = MEM_mallocN(sizeof(float) * numVerts, "WeightVGProximity Modifier, tw");
 	tdw = MEM_mallocN(sizeof(MDeformWeight *) * numVerts, "WeightVGProximity Modifier, tdw");
 	for (i = 0; i < numVerts; i++) {
-		MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx);
+		MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_index);
 		if (_dw) {
 			tidx[numIdx] = i;
 			tw[numIdx] = _dw->weight;
@@ -460,7 +460,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 				else if (obr->type == OB_MESH) {
 					Mesh *me = (Mesh *)obr->data;
 					if (me->edit_btmesh)
-						target_dm = CDDM_from_BMEditMesh(me->edit_btmesh, me, FALSE, FALSE);
+						target_dm = CDDM_from_editbmesh(me->edit_btmesh, FALSE, FALSE);
 					else
 						target_dm = CDDM_from_mesh(me, obr);
 				}
@@ -480,9 +480,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 				for (i = 0; i < numIdx; i++) {
 					new_w[i] = dists_v ? dists_v[i] : FLT_MAX;
 					if (dists_e)
-						new_w[i] = minf(dists_e[i], new_w[i]);
+						new_w[i] = min_ff(dists_e[i], new_w[i]);
 					if (dists_f)
-						new_w[i] = minf(dists_f[i], new_w[i]);
+						new_w[i] = min_ff(dists_f[i], new_w[i]);
 				}
 				if (free_target_dm) target_dm->release(target_dm);
 				if (dists_v) MEM_freeN(dists_v);
@@ -509,7 +509,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	                 wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
 
 	/* Update vgroup. Note we never add nor remove vertices from vgroup here. */
-	weightvg_update_vg(dvert, defgrp_idx, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f);
+	weightvg_update_vg(dvert, defgrp_index, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f);
 
 	/* If weight preview enabled... */
 #if 0 /* XXX Currently done in mod stack :/ */
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 08e0e7b..141a368 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -23,8 +23,12 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
 	.
+	composite
+	intern
+	shader
+	texture
 	../blenfont
 	../blenkernel
 	../blenlib
@@ -39,10 +43,6 @@ set(INC
 
 set(INC_SYS
 	${GLEW_INCLUDE_PATH}
-	intern
-	composite
-	shader
-	texture
 )
 
 set(SRC
@@ -84,6 +84,7 @@ set(SRC
 	composite/nodes/node_composite_lummaMatte.c
 	composite/nodes/node_composite_mapUV.c
 	composite/nodes/node_composite_mapValue.c
+	composite/nodes/node_composite_mapRange.c
 	composite/nodes/node_composite_math.c
 	composite/nodes/node_composite_mask.c
 	composite/nodes/node_composite_mixrgb.c
@@ -119,9 +120,9 @@ set(SRC
 	composite/nodes/node_composite_ellipsemask.c
 	composite/nodes/node_composite_switch.c
 	composite/nodes/node_composite_colorcorrection.c
-	
+	composite/nodes/node_composite_pixelate.c
+
 	composite/node_composite_tree.c
-	composite/node_composite_util.c
 
 	shader/nodes/node_shader_camera.c
 	shader/nodes/node_shader_common.c
@@ -144,34 +145,40 @@ set(SRC
 	shader/nodes/node_shader_valToRgb.c
 	shader/nodes/node_shader_value.c
 	shader/nodes/node_shader_vectMath.c
+	shader/nodes/node_shader_add_shader.c
+	shader/nodes/node_shader_ambient_occlusion.c
 	shader/nodes/node_shader_attribute.c
 	shader/nodes/node_shader_background.c
-	# shader/nodes/node_shader_bsdf_anisotropic.c  # XXX, why not included?
+	shader/nodes/node_shader_bsdf_anisotropic.c
 	shader/nodes/node_shader_bsdf_diffuse.c
-	shader/nodes/node_shader_bsdf_glossy.c
 	shader/nodes/node_shader_bsdf_glass.c
+	shader/nodes/node_shader_bsdf_glossy.c
+	shader/nodes/node_shader_bsdf_refraction.c
 	shader/nodes/node_shader_bsdf_translucent.c
 	shader/nodes/node_shader_bsdf_transparent.c
 	shader/nodes/node_shader_bsdf_velvet.c
+	shader/nodes/node_shader_bump.c
 	shader/nodes/node_shader_emission.c
 	shader/nodes/node_shader_fresnel.c
-	shader/nodes/node_shader_layer_weight.c
 	shader/nodes/node_shader_geometry.c
 	shader/nodes/node_shader_holdout.c
-	shader/nodes/node_shader_volume_transparent.c
-	shader/nodes/node_shader_volume_isotropic.c
-	shader/nodes/node_shader_light_path.c
+	shader/nodes/node_shader_layer_weight.c
 	shader/nodes/node_shader_light_falloff.c
-	shader/nodes/node_shader_object_info.c
-	shader/nodes/node_shader_particle_info.c
+	shader/nodes/node_shader_light_path.c
 	shader/nodes/node_shader_mix_shader.c
-	shader/nodes/node_shader_add_shader.c
+	shader/nodes/node_shader_normal_map.c
+	shader/nodes/node_shader_object_info.c
 	shader/nodes/node_shader_output_lamp.c
 	shader/nodes/node_shader_output_material.c
 	shader/nodes/node_shader_output_world.c
-	shader/nodes/node_shader_tex_gradient.c
+	shader/nodes/node_shader_particle_info.c
+	shader/nodes/node_shader_script.c
+	shader/nodes/node_shader_tangent.c
+	shader/nodes/node_shader_tex_brick.c
+	shader/nodes/node_shader_tex_checker.c
 	shader/nodes/node_shader_tex_coord.c
 	shader/nodes/node_shader_tex_environment.c
+	shader/nodes/node_shader_tex_gradient.c
 	shader/nodes/node_shader_tex_image.c
 	shader/nodes/node_shader_tex_magic.c
 	shader/nodes/node_shader_tex_musgrave.c
@@ -179,8 +186,8 @@ set(SRC
 	shader/nodes/node_shader_tex_sky.c
 	shader/nodes/node_shader_tex_voronoi.c
 	shader/nodes/node_shader_tex_wave.c
-	shader/nodes/node_shader_tex_checker.c
-	shader/nodes/node_shader_tex_brick.c
+	shader/nodes/node_shader_volume_isotropic.c
+	shader/nodes/node_shader_volume_transparent.c
 	shader/node_shader_tree.c
 	shader/node_shader_util.c
 
@@ -215,7 +222,6 @@ set(SRC
 	intern/node_common.c
 	intern/node_socket.c
 
-	composite/node_composite_util.h
 	shader/node_shader_util.h
 	texture/node_texture_util.h
 
@@ -228,6 +234,13 @@ set(SRC
 	intern/node_common.h
 )
 
+if(WITH_COMPOSITOR_LEGACY)
+	list(APPEND SRC
+		composite/node_composite_util.h
+		composite/node_composite_util.c
+	)
+endif()
+
 if(WITH_PYTHON)
 	list(APPEND INC
 		../python
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index bcef230..6d60ac0 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -40,8 +40,6 @@ extern bNodeTreeType ntreeType_Composite;
 /* ****************** types array for all composite nodes ****************** */
 
 void register_node_type_cmp_group(struct bNodeTreeType *ttype);
-void register_node_type_cmp_forloop(struct bNodeTreeType *ttype);
-void register_node_type_cmp_whileloop(struct bNodeTreeType *ttype);
 
 void register_node_type_cmp_rlayers(struct bNodeTreeType *ttype);
 void register_node_type_cmp_image(struct bNodeTreeType *ttype);
@@ -72,6 +70,7 @@ void register_node_type_cmp_huecorrect(struct bNodeTreeType *ttype);
 void register_node_type_cmp_normal(struct bNodeTreeType *ttype);
 void register_node_type_cmp_curve_vec(struct bNodeTreeType *ttype);
 void register_node_type_cmp_map_value(struct bNodeTreeType *ttype);
+void register_node_type_cmp_map_range(struct bNodeTreeType *ttype);
 void register_node_type_cmp_normalize(struct bNodeTreeType *ttype);
 
 void register_node_type_cmp_filter(struct bNodeTreeType *ttype);
@@ -96,7 +95,7 @@ void register_node_type_cmp_combhsva(struct bNodeTreeType *ttype);
 void register_node_type_cmp_sepyuva(struct bNodeTreeType *ttype);
 void register_node_type_cmp_combyuva(struct bNodeTreeType *ttype);
 void register_node_type_cmp_sepycca(struct bNodeTreeType *ttype);
-void register_node_type_cmp_combycca(struct bNodeTreeType *ttype); 
+void register_node_type_cmp_combycca(struct bNodeTreeType *ttype);
 void register_node_type_cmp_premulkey(struct bNodeTreeType *ttype);
 
 void register_node_type_cmp_diff_matte(struct bNodeTreeType *ttype);
@@ -105,7 +104,7 @@ void register_node_type_cmp_chroma_matte(struct bNodeTreeType *ttype);
 void register_node_type_cmp_color_matte(struct bNodeTreeType *ttype);
 void register_node_type_cmp_channel_matte(struct bNodeTreeType *ttype);
 void register_node_type_cmp_color_spill(struct bNodeTreeType *ttype);
-void register_node_type_cmp_luma_matte(struct bNodeTreeType *ttype); 
+void register_node_type_cmp_luma_matte(struct bNodeTreeType *ttype);
 void register_node_type_cmp_doubleedgemask(struct bNodeTreeType *ttype);
 void register_node_type_cmp_keyingscreen(struct bNodeTreeType *ttype);
 void register_node_type_cmp_keying(struct bNodeTreeType *ttype);
@@ -133,7 +132,7 @@ void register_node_type_cmp_ellipsemask(struct bNodeTreeType *ttype);
 void register_node_type_cmp_bokehimage(struct bNodeTreeType *ttype);
 void register_node_type_cmp_bokehblur(struct bNodeTreeType *ttype);
 void register_node_type_cmp_switch(struct bNodeTreeType *ttype);
-
+void register_node_type_cmp_pixelate(struct bNodeTreeType *ttype);
 void register_node_type_cmp_trackpos(struct bNodeTreeType *ttype);
 
 #endif
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 49428c0..7413577 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -41,8 +41,6 @@ extern struct bNodeTreeType ntreeType_Shader;
 /* ****************** types array for all shaders ****************** */
 
 void register_node_type_sh_group(struct bNodeTreeType *ttype);
-void register_node_type_sh_forloop(struct bNodeTreeType *ttype);
-void register_node_type_sh_whileloop(struct bNodeTreeType *ttype);
 
 void register_node_type_sh_output(struct bNodeTreeType *ttype);
 void register_node_type_sh_material(struct bNodeTreeType *ttype);
@@ -80,14 +78,20 @@ void register_node_type_sh_fresnel(struct bNodeTreeType *ttype);
 void register_node_type_sh_layer_weight(struct bNodeTreeType *ttype);
 void register_node_type_sh_tex_coord(struct bNodeTreeType *ttype);
 void register_node_type_sh_particle_info(struct bNodeTreeType *ttype);
+void register_node_type_sh_script(struct bNodeTreeType *ttype);
+void register_node_type_sh_normal_map(struct bNodeTreeType *ttype);
+void register_node_type_sh_tangent(struct bNodeTreeType *ttype);
 
+void register_node_type_sh_ambient_occlusion(struct bNodeTreeType *ttype);
 void register_node_type_sh_background(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_diffuse(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_glossy(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_glass(struct bNodeTreeType *ttype);
+void register_node_type_sh_bsdf_refraction(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_translucent(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_transparent(struct bNodeTreeType *ttype);
 void register_node_type_sh_bsdf_velvet(struct bNodeTreeType *ttype);
+void register_node_type_sh_bsdf_anisotropic(struct bNodeTreeType *ttype);
 void register_node_type_sh_emission(struct bNodeTreeType *ttype);
 void register_node_type_sh_holdout(struct bNodeTreeType *ttype);
 void register_node_type_sh_volume_transparent(struct bNodeTreeType *ttype);
@@ -109,6 +113,7 @@ void register_node_type_sh_tex_wave(struct bNodeTreeType *ttype);
 void register_node_type_sh_tex_musgrave(struct bNodeTreeType *ttype);
 void register_node_type_sh_tex_noise(struct bNodeTreeType *ttype);
 void register_node_type_sh_tex_checker(struct bNodeTreeType *ttype);
+void register_node_type_sh_bump(struct bNodeTreeType *ttype);
 
 #endif
 
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
index f41be2b..b14f7c4 100644
--- a/source/blender/nodes/NOD_socket.h
+++ b/source/blender/nodes/NOD_socket.h
@@ -60,6 +60,7 @@ void node_socket_set_default_value_vector(void *default_value, PropertySubType s
 void node_socket_set_default_value_rgba(void *default_value, float r, float g, float b, float a);
 void node_socket_set_default_value_shader(void *default_value);
 void node_socket_set_default_value_mesh(void *default_value);
+void node_socket_set_default_value_string(void *default_value, PropertySubType subtype, const char *value);
 
 struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
 struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h
index 7722580..a1be996 100644
--- a/source/blender/nodes/NOD_texture.h
+++ b/source/blender/nodes/NOD_texture.h
@@ -40,8 +40,6 @@ extern bNodeTreeType ntreeType_Texture;
 /* ****************** types array for all texture nodes ****************** */
 
 void register_node_type_tex_group(struct bNodeTreeType *ttype);
-void register_node_type_tex_forloop(struct bNodeTreeType *ttype);
-void register_node_type_tex_whileloop(struct bNodeTreeType *ttype);
 
 void register_node_type_tex_math(struct bNodeTreeType *ttype);
 void register_node_type_tex_mix_rgb(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 0d86ada..0346273 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -273,7 +273,7 @@ bNodeTreeType ntreeType_Composite = {
 	/* update */			update,
 	/* update_node */		update_node,
 	/* validate_link */		NULL,
-	/* internal_connect */	node_internal_connect_default
+	/* update_internal_links */	node_update_internal_links_default
 };
 
 
@@ -301,7 +301,7 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_
 	
 	for (node= exec->nodetree->nodes.first; node; node= node->next) {
 		/* initialize needed for groups */
-		node->exec= 0;	
+		node->exec= 0;
 		
 		for (sock= node->outputs.first; sock; sock= sock->next) {
 			bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
@@ -719,6 +719,16 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
 
 /* *********************************************** */
 
+static void set_output_visible(bNode *node, int passflag, int index, int pass)
+{
+	bNodeSocket *sock = BLI_findlink(&node->outputs, index);
+	/* clear the SOCK_HIDDEN flag as well, in case a socket was hidden before */
+	if (passflag & pass)
+		sock->flag &= ~(SOCK_HIDDEN | SOCK_UNAVAIL);
+	else
+		sock->flag |= SOCK_UNAVAIL;
+}
+
 /* clumsy checking... should do dynamic outputs once */
 static void force_hidden_passes(bNode *node, int passflag)
 {
@@ -727,68 +737,35 @@ static void force_hidden_passes(bNode *node, int passflag)
 	for (sock= node->outputs.first; sock; sock= sock->next)
 		sock->flag &= ~SOCK_UNAVAIL;
 	
-	if (!(passflag & SCE_PASS_COMBINED)) {
-		sock= BLI_findlink(&node->outputs, RRES_OUT_IMAGE);
-		sock->flag |= SOCK_UNAVAIL;
-		sock= BLI_findlink(&node->outputs, RRES_OUT_ALPHA);
-		sock->flag |= SOCK_UNAVAIL;
-	}
-	
-	sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
-	if (!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL);
-	if (!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_VEC);
-	if (!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_UV);
-	if (!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA);
-	if (!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF);
-	if (!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_SPEC);
-	if (!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_SHADOW);
-	if (!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_AO);
-	if (!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_REFLECT);
-	if (!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
-	if (!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT);
-	if (!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
-	if (!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA);
-	if (!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
-	if (!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT);
-	if (!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
-	if (!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
-
-	sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_DIRECT);
-	if (!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_INDIRECT);
-	if (!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_COLOR);
-	if (!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL;
-
-	sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_DIRECT);
-	if (!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_INDIRECT);
-	if (!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_COLOR);
-	if (!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL;
-
-	sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_DIRECT);
-	if (!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_INDIRECT);
-	if (!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-	sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
-	if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
+	set_output_visible(node, passflag, RRES_OUT_IMAGE,            SCE_PASS_COMBINED);
+	set_output_visible(node, passflag, RRES_OUT_ALPHA,            SCE_PASS_COMBINED);
+	
+	set_output_visible(node, passflag, RRES_OUT_Z,                SCE_PASS_Z);
+	set_output_visible(node, passflag, RRES_OUT_NORMAL,           SCE_PASS_NORMAL);
+	set_output_visible(node, passflag, RRES_OUT_VEC,              SCE_PASS_VECTOR);
+	set_output_visible(node, passflag, RRES_OUT_UV,               SCE_PASS_UV);
+	set_output_visible(node, passflag, RRES_OUT_RGBA,             SCE_PASS_RGBA);
+	set_output_visible(node, passflag, RRES_OUT_DIFF,             SCE_PASS_DIFFUSE);
+	set_output_visible(node, passflag, RRES_OUT_SPEC,             SCE_PASS_SPEC);
+	set_output_visible(node, passflag, RRES_OUT_SHADOW,           SCE_PASS_SHADOW);
+	set_output_visible(node, passflag, RRES_OUT_AO,               SCE_PASS_AO);
+	set_output_visible(node, passflag, RRES_OUT_REFLECT,          SCE_PASS_REFLECT);
+	set_output_visible(node, passflag, RRES_OUT_REFRACT,          SCE_PASS_REFRACT);
+	set_output_visible(node, passflag, RRES_OUT_INDIRECT,         SCE_PASS_INDIRECT);
+	set_output_visible(node, passflag, RRES_OUT_INDEXOB,          SCE_PASS_INDEXOB);
+	set_output_visible(node, passflag, RRES_OUT_INDEXMA,          SCE_PASS_INDEXMA);
+	set_output_visible(node, passflag, RRES_OUT_MIST,             SCE_PASS_MIST);
+	set_output_visible(node, passflag, RRES_OUT_EMIT,             SCE_PASS_EMIT);
+	set_output_visible(node, passflag, RRES_OUT_ENV,              SCE_PASS_ENVIRONMENT);
+	set_output_visible(node, passflag, RRES_OUT_DIFF_DIRECT,      SCE_PASS_DIFFUSE_DIRECT);
+	set_output_visible(node, passflag, RRES_OUT_DIFF_INDIRECT,    SCE_PASS_DIFFUSE_INDIRECT);
+	set_output_visible(node, passflag, RRES_OUT_DIFF_COLOR,       SCE_PASS_DIFFUSE_COLOR);
+	set_output_visible(node, passflag, RRES_OUT_GLOSSY_DIRECT,    SCE_PASS_GLOSSY_DIRECT);
+	set_output_visible(node, passflag, RRES_OUT_GLOSSY_INDIRECT,  SCE_PASS_GLOSSY_INDIRECT);
+	set_output_visible(node, passflag, RRES_OUT_GLOSSY_COLOR,     SCE_PASS_GLOSSY_COLOR);
+	set_output_visible(node, passflag, RRES_OUT_TRANSM_DIRECT,    SCE_PASS_TRANSM_DIRECT);
+	set_output_visible(node, passflag, RRES_OUT_TRANSM_INDIRECT,  SCE_PASS_TRANSM_INDIRECT);
+	set_output_visible(node, passflag, RRES_OUT_TRANSM_COLOR,     SCE_PASS_TRANSM_COLOR);
 }
 
 /* based on rules, force sockets hidden always */
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index ad2d26d..57eb990 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -72,7 +72,7 @@ CompBuf *dupalloc_compbuf(CompBuf *cbuf)
 	
 		dupbuf->xof= cbuf->xof;
 		dupbuf->yof= cbuf->yof;
-	}	
+	}
 	return dupbuf;
 }
 
@@ -94,7 +94,7 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf)
 				break;
 		lastbuf->next= dupbuf;
 		dupbuf->prev= lastbuf;
-	}	
+	}
 	return dupbuf;
 }
 
@@ -213,53 +213,53 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
 	}
 	else if (outtype==CB_VEC2) {
 		if (intype==CB_VAL) {
-			out[0]= in[0];
-			out[1]= in[0];
+			out[0] = in[0];
+			out[1] = in[0];
 		}
 		else if (intype==CB_VEC3) {
-			out[0]= in[0];
-			out[1]= in[1];
+			out[0] = in[0];
+			out[1] = in[1];
 		}
 		else if (intype==CB_RGBA) {
-			out[0]= in[0];
-			out[1]= in[1];
+			out[0] = in[0];
+			out[1] = in[1];
 		}
 	}
 	else if (outtype==CB_VEC3) {
 		if (intype==CB_VAL) {
-			out[0]= in[0];
-			out[1]= in[0];
-			out[2]= in[0];
+			out[0] = in[0];
+			out[1] = in[0];
+			out[2] = in[0];
 		}
 		else if (intype==CB_VEC2) {
-			out[0]= in[0];
-			out[1]= in[1];
-			out[2]= 0.0f;
+			out[0] = in[0];
+			out[1] = in[1];
+			out[2] = 0.0f;
 		}
 		else if (intype==CB_RGBA) {
-			out[0]= in[0];
-			out[1]= in[1];
-			out[2]= in[2];
+			out[0] = in[0];
+			out[1] = in[1];
+			out[2] = in[2];
 		}
 	}
 	else if (outtype==CB_RGBA) {
 		if (intype==CB_VAL) {
-			out[0]= in[0];
-			out[1]= in[0];
-			out[2]= in[0];
-			out[3]= 1.0f;
+			out[0] = in[0];
+			out[1] = in[0];
+			out[2] = in[0];
+			out[3] = 1.0f;
 		}
 		else if (intype==CB_VEC2) {
-			out[0]= in[0];
-			out[1]= in[1];
-			out[2]= 0.0f;
-			out[3]= 1.0f;
+			out[0] = in[0];
+			out[1] = in[1];
+			out[2] = 0.0f;
+			out[3] = 1.0f;
 		}
 		else if (intype==CB_VEC3) {
-			out[0]= in[0];
-			out[1]= in[1];
-			out[2]= in[2];
-			out[3]= 1.0f;
+			out[0] = in[0];
+			out[1] = in[1];
+			out[2] = in[2];
+			out[3] = 1.0f;
 		}
 	}
 }
@@ -307,69 +307,69 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
 		else if (type==CB_VEC2) {
 			if (inbuf->type==CB_VAL) {
 				for (; x>0; x--, outrf+= 2, inrf+= 1) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[0];
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[0];
 				}
 			}
 			else if (inbuf->type==CB_VEC3) {
 				for (; x>0; x--, outrf+= 2, inrf+= 3) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
 				}
 			}
 			else if (inbuf->type==CB_RGBA) {
 				for (; x>0; x--, outrf+= 2, inrf+= 4) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
 				}
 			}
 		}
 		else if (type==CB_VEC3) {
 			if (inbuf->type==CB_VAL) {
 				for (; x>0; x--, outrf+= 3, inrf+= 1) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[0];
-					outrf[2]= inrf[0];
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[0];
+					outrf[2] = inrf[0];
 				}
 			}
 			else if (inbuf->type==CB_VEC2) {
 				for (; x>0; x--, outrf+= 3, inrf+= 2) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
-					outrf[2]= 0.0f;
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
+					outrf[2] = 0.0f;
 				}
 			}
 			else if (inbuf->type==CB_RGBA) {
 				for (; x>0; x--, outrf+= 3, inrf+= 4) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
-					outrf[2]= inrf[2];
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
+					outrf[2] = inrf[2];
 				}
 			}
 		}
 		else if (type==CB_RGBA) {
 			if (inbuf->type==CB_VAL) {
 				for (; x>0; x--, outrf+= 4, inrf+= 1) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[0];
-					outrf[2]= inrf[0];
-					outrf[3]= 1.0f;
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[0];
+					outrf[2] = inrf[0];
+					outrf[3] = 1.0f;
 				}
 			}
 			else if (inbuf->type==CB_VEC2) {
 				for (; x>0; x--, outrf+= 4, inrf+= 2) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
-					outrf[2]= 0.0f;
-					outrf[3]= 1.0f;
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
+					outrf[2] = 0.0f;
+					outrf[3] = 1.0f;
 				}
 			}
 			else if (inbuf->type==CB_VEC3) {
 				for (; x>0; x--, outrf+= 4, inrf+= 3) {
-					outrf[0]= inrf[0];
-					outrf[1]= inrf[1];
-					outrf[2]= inrf[2];
-					outrf[3]= 1.0f;
+					outrf[0] = inrf[0];
+					outrf[1] = inrf[1];
+					outrf[2] = inrf[2];
+					outrf[3] = 1.0f;
 				}
 			}
 		}
@@ -387,7 +387,7 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y,
 			return use;
 		}
 		else {
-			static float col[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+			static float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 			
 			/* map coords */
 			x-= cbuf->xof;
@@ -707,18 +707,18 @@ void do_copy_rgba(bNode *UNUSED(node), float *out, float *in)
 void do_copy_rgb(bNode *UNUSED(node), float *out, float *in)
 {
 	copy_v3_v3(out, in);
-	out[3]= 1.0f;
+	out[3] = 1.0f;
 }
 
 void do_copy_value(bNode *UNUSED(node), float *out, float *in)
 {
-	out[0]= in[0];
+	out[0] = in[0];
 }
 
 void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac)
 {
 	copy_v3_v3(out, in);
-	out[3]= *fac;
+	out[3] = *fac;
 }
 
 /* only accepts RGBA buffers */
@@ -732,16 +732,16 @@ void gamma_correct_compbuf(CompBuf *img, int inversed)
 	drect= img->rect;
 	if (inversed) {
 		for (x=img->x*img->y; x>0; x--, drect+=4) {
-			if (drect[0]>0.0f) drect[0]= sqrt(drect[0]); else drect[0]= 0.0f;
-			if (drect[1]>0.0f) drect[1]= sqrt(drect[1]); else drect[1]= 0.0f;
-			if (drect[2]>0.0f) drect[2]= sqrt(drect[2]); else drect[2]= 0.0f;
+			if (drect[0]>0.0f) drect[0] = sqrt(drect[0]); else drect[0] = 0.0f;
+			if (drect[1]>0.0f) drect[1] = sqrt(drect[1]); else drect[1] = 0.0f;
+			if (drect[2]>0.0f) drect[2] = sqrt(drect[2]); else drect[2] = 0.0f;
 		}
 	}
 	else {
 		for (x=img->x*img->y; x>0; x--, drect+=4) {
-			if (drect[0]>0.0f) drect[0]*= drect[0]; else drect[0]= 0.0f;
-			if (drect[1]>0.0f) drect[1]*= drect[1]; else drect[1]= 0.0f;
-			if (drect[2]>0.0f) drect[2]*= drect[2]; else drect[2]= 0.0f;
+			if (drect[0]>0.0f) drect[0]*= drect[0]; else drect[0] = 0.0f;
+			if (drect[1]>0.0f) drect[1]*= drect[1]; else drect[1] = 0.0f;
+			if (drect[2]>0.0f) drect[2]*= drect[2]; else drect[2] = 0.0f;
 		}
 	}
 }
@@ -757,9 +757,9 @@ void premul_compbuf(CompBuf *img, int inversed)
 	if (inversed) {
 		for (x=img->x*img->y; x>0; x--, drect+=4) {
 			if (fabsf(drect[3]) < 1e-5f) {
-				drect[0]= 0.0f;
-				drect[1]= 0.0f;
-				drect[2]= 0.0f;
+				drect[0] = 0.0f;
+				drect[1] = 0.0f;
+				drect[2] = 0.0f;
 			}
 			else {
 				drect[0] /= drect[3];
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 86eb0aa..72c2204 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -32,13 +32,13 @@
 #include "node_composite_util.h"
 
 /* **************** ALPHAOVER ******************** */
-static bNodeSocketTemplate cmp_node_alphaover_in[]= {
+static bNodeSocketTemplate cmp_node_alphaover_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_alphaover_out[]= {
+static bNodeSocketTemplate cmp_node_alphaover_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_alphaover_out[]= {
 static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
 {
 	
-	/* Zero alpha values should still permit an add of RGB data */	
+	/* Zero alpha values should still permit an add of RGB data */
 	if (over[3]<0.0f) {
 		copy_v4_v4(out, src);
 	}
@@ -58,11 +58,11 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
 	else {
 		float mul= 1.0f - fac[0]*over[3];
 
-		out[0]= (mul*src[0]) + fac[0]*over[0];
-		out[1]= (mul*src[1]) + fac[0]*over[1];
-		out[2]= (mul*src[2]) + fac[0]*over[2];
-		out[3]= (mul*src[3]) + fac[0]*over[3];
-	}	
+		out[0] = (mul*src[0]) + fac[0]*over[0];
+		out[1] = (mul*src[1]) + fac[0]*over[1];
+		out[2] = (mul*src[2]) + fac[0]*over[2];
+		out[3] = (mul*src[3]) + fac[0]*over[3];
+	}
 }
 
 /* result will be still premul, but the over part is premulled */
@@ -79,10 +79,10 @@ static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float
 		float premul= fac[0]*over[3];
 		float mul= 1.0f - premul;
 
-		out[0]= (mul*src[0]) + premul*over[0];
-		out[1]= (mul*src[1]) + premul*over[1];
-		out[2]= (mul*src[2]) + premul*over[2];
-		out[3]= (mul*src[3]) + fac[0]*over[3];
+		out[0] = (mul*src[0]) + premul*over[0];
+		out[1] = (mul*src[1]) + premul*over[1];
+		out[2] = (mul*src[2]) + premul*over[2];
+		out[3] = (mul*src[3]) + fac[0]*over[3];
 	}
 }
 
@@ -102,10 +102,10 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over,
 		float premul= fac[0]*addfac;
 		float mul= 1.0f - fac[0]*over[3];
 		
-		out[0]= (mul*src[0]) + premul*over[0];
-		out[1]= (mul*src[1]) + premul*over[1];
-		out[2]= (mul*src[2]) + premul*over[2];
-		out[3]= (mul*src[3]) + fac[0]*over[3];
+		out[0] = (mul*src[0]) + premul*over[0];
+		out[1] = (mul*src[1]) + premul*over[1];
+		out[2] = (mul*src[2]) + premul*over[2];
+		out[3] = (mul*src[3]) + fac[0]*over[3];
 	}
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index e05ef1e..7674ace 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -33,14 +33,14 @@
 
 /* **************** BILATERALBLUR ******************** */
 static bNodeSocketTemplate cmp_node_bilateralblur_in[] = {
-	{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, 
-	{ SOCK_RGBA, 1, N_("Determinator"), 1.0f, 1.0f, 1.0f, 1.0f}, 
-	{ -1, 0, "" } 
+	{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
+	{ SOCK_RGBA, 1, N_("Determinator"), 1.0f, 1.0f, 1.0f, 1.0f},
+	{ -1, 0, "" }
 };
 
 static bNodeSocketTemplate cmp_node_bilateralblur_out[] = {
-	{ SOCK_RGBA, 0, N_("Image")}, 
-	{ -1, 0, "" } 
+	{ SOCK_RGBA, 0, N_("Image")},
+	{ -1, 0, "" }
 };
 
 #ifdef WITH_COMPOSITOR_LEGACY
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index b9b2406..eb7f776 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -726,7 +726,9 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 
 static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
-	node->storage = MEM_callocN(sizeof(NodeBlurData), "node blur data");
+	NodeBlurData *data = MEM_callocN(sizeof(NodeBlurData), "node blur data");
+	data->filtertype = R_FILTER_GAUSS;
+	node->storage = data;
 }
 
 void register_node_type_cmp_blur(bNodeTreeType *ttype)
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
index c569767..8324b77 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -37,7 +37,7 @@
 
 /* **************** Bokeh image Tools  ******************** */
   
-static bNodeSocketTemplate cmp_node_bokehimage_out[]= {
+static bNodeSocketTemplate cmp_node_bokehimage_out[] = {
 	{	SOCK_RGBA, 0, N_("Image"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
index 1ba522c..d3c6b2c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
@@ -1,6 +1,4 @@
 /*
- * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -35,15 +33,15 @@
 #include "../node_composite_util.h"
 
 /* **************** SCALAR MATH ******************** */ 
-static bNodeSocketTemplate cmp_node_boxmask_in[]= {
+static bNodeSocketTemplate cmp_node_boxmask_in[] = {
 	{	SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
-	{	-1, 0, "" } 
+	{   -1, 0, "" }
 };
 
-static bNodeSocketTemplate cmp_node_boxmask_out[]= {
+static bNodeSocketTemplate cmp_node_boxmask_out[] = {
 	{	SOCK_FLOAT, 0, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
-	{	-1, 0, "" } 
+	{   -1, 0, "" }
 };
 
 static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index 2b8a394..ecf572f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -36,13 +36,13 @@
 
 /* **************** Brigh and contrsast  ******************** */
 
-static bNodeSocketTemplate cmp_node_brightcontrast_in[]= {
+static bNodeSocketTemplate cmp_node_brightcontrast_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Bright"),		0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Contrast"),		0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_brightcontrast_out[]= {
+static bNodeSocketTemplate cmp_node_brightcontrast_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -72,7 +72,7 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl
 		b = a * (brightness + delta);
 	}
 	
-	for (c=0; c<3; c++) {        
+	for (c=0; c<3; c++) {
 		i = in[c];
 		v = a*i + b;
 		out[c] = v;
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 06b77de..40dbbbb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -34,12 +34,12 @@
 
 
 /* ******************* Channel Matte Node ********************************* */
-static bNodeSocketTemplate cmp_node_channel_matte_in[]={
+static bNodeSocketTemplate cmp_node_channel_matte_in[] ={
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_channel_matte_out[]={
+static bNodeSocketTemplate cmp_node_channel_matte_out[] ={
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
@@ -71,7 +71,7 @@ static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *
 static void do_channel_matte(bNode *node, float *out, float *in)
 {
 	NodeChroma *c=(NodeChroma *)node->storage;
-	float alpha=0.0;	
+	float alpha=0.0;
 
 	switch (c->algorithm) {
 	case 0: { /* Alpha=key_channel-limit channel */
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 55ee1b0..f343f80 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -33,13 +33,13 @@
 #include "node_composite_util.h"
 
 /* ******************* Chroma Key ********************************************************** */
-static bNodeSocketTemplate cmp_node_chroma_in[]={
+static bNodeSocketTemplate cmp_node_chroma_in[] = {
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_chroma_out[]={
+static bNodeSocketTemplate cmp_node_chroma_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 37fb298..07a6647 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -33,13 +33,13 @@
 #include "node_composite_util.h"
 
 /* ******************* Color Key ********************************************************** */
-static bNodeSocketTemplate cmp_node_color_in[]={
+static bNodeSocketTemplate cmp_node_color_in[] = {
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_color_out[]={
+static bNodeSocketTemplate cmp_node_color_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index c4120ab..44a5ac9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -29,26 +29,25 @@
  *  \ingroup cmpnodes
  */
 
-
-
 #include "node_composite_util.h"
 
-#define AVG(a, b) ((a + b) / 2)
-
 /* ******************* Color Spill Supression ********************************* */
-static bNodeSocketTemplate cmp_node_color_spill_in[]={
+static bNodeSocketTemplate cmp_node_color_spill_in[] = {
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{SOCK_FLOAT, 1, N_("Fac"),	1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_color_spill_out[]={
+static bNodeSocketTemplate cmp_node_color_spill_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{-1, 0, ""}
 };
 
 #ifdef WITH_COMPOSITOR_LEGACY
 
+#define AVG(a, b) ((a + b) / 2)
+
+
 static void do_simple_spillmap_red(bNode *node, float* out, float *in)
 {
 	NodeColorspill *ncs;
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index a9f930f..df49e53 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -35,13 +35,13 @@
 
 
 /* ******************* Color Balance ********************************* */
-static bNodeSocketTemplate cmp_node_colorbalance_in[]={
+static bNodeSocketTemplate cmp_node_colorbalance_in[] = {
 	{SOCK_FLOAT, 1, N_("Fac"),	1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_colorbalance_out[]={
+static bNodeSocketTemplate cmp_node_colorbalance_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{-1, 0, ""}
 };
@@ -49,14 +49,14 @@ static bNodeSocketTemplate cmp_node_colorbalance_out[]={
 #ifdef WITH_COMPOSITOR_LEGACY
 
 /* this function implements ASC-CDL according to the spec at http://www.asctech.org/
- Slope
-       S = in * slope
- Offset
-       O = S + offset 
-         = (in * slope) + offset
- Power
-     out = Clamp(O) ^ power
-         = Clamp((in * slope) + offset) ^ power
+ * Slope
+ *       S = in * slope
+ * Offset
+ *       O = S + offset
+ *         = (in * slope) + offset
+ * Power
+ *     out = Clamp(O) ^ power
+ *         = Clamp((in * slope) + offset) ^ power
  */
 DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slope)
 {
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
index ce43b2f..526f847 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
@@ -36,13 +36,13 @@
 
 
 /* ******************* Color Balance ********************************* */
-static bNodeSocketTemplate cmp_node_colorcorrection_in[]={
+static bNodeSocketTemplate cmp_node_colorcorrection_in[] = {
 	{	SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Mask"),	1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1,0,""}
 };
 
-static bNodeSocketTemplate cmp_node_colorcorrection_out[]={
+static bNodeSocketTemplate cmp_node_colorcorrection_out[] = {
 	{	SOCK_RGBA,0,N_("Image")},
 	{	-1,0,""}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
index 2596248..10b81cd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -231,153 +231,3 @@ void register_node_type_cmp_group(bNodeTreeType *ttype)
 
 	nodeRegisterType(ttype, &ntype);
 }
-
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-/* Move the results from the previous iteration back to the input sockets. */
-static void loop_iteration_reset(bNodeTree *ngroup, bNodeStack *gstack)
-{
-	bNodeSocket *gin, *gout;
-	bNodeStack *nsin, *nsout;
-	
-	gin = ngroup->inputs.first;
-	gout = ngroup->outputs.first;
-	
-	while (gin && gout) {
-		/* skip static (non-looping) sockets */
-		while (gin && !(gin->flag & SOCK_DYNAMIC))
-			gin=gin->next;
-		while (gout && !(gout->flag & SOCK_DYNAMIC))
-			gout=gout->next;
-		
-		if (gin && gout) {
-			nsin = node_get_socket_stack(gstack, gin);
-			nsout = node_get_socket_stack(gstack, gout);
-			
-			move_stack(nsin, nsout);
-			
-			gin=gin->next;
-			gout=gout->next;
-		}
-	}
-}
-
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec *)nodedata;
-	int totiterations= (int)in[0]->vec[0];
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	/* "Iteration" socket */
-	sock = exec->nodetree->inputs.first;
-	ns = node_get_socket_stack(exec->stack, sock);
-	
-	group_copy_inputs(node, in, exec->stack);
-	for (iteration=0; iteration < totiterations; ++iteration) {
-		/* first input contains current iteration counter */
-		ns->vec[0] = (float)iteration;
-		
-		if (iteration > 0)
-			loop_iteration_reset(exec->nodetree, exec->stack);
-		ntreeExecNodes(exec, data, thread);
-		group_free_internal(exec);
-	}
-	group_move_outputs(node, out, exec->stack);
-}
-
-void register_node_type_cmp_forloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_forloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_forloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec *)nodedata;
-	int condition= (in[0]->vec[0] > 0.0f);
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	/* "Condition" socket */
-	sock = exec->nodetree->outputs.first;
-	ns = node_get_socket_stack(exec->stack, sock);
-	
-	iteration = 0;
-	group_copy_inputs(node, in, exec->stack);
-	while (condition && iteration < node->custom1) {
-		if (iteration > 0)
-			loop_iteration_reset(exec->nodetree, exec->stack);
-		ntreeExecNodes(exec, data, thread);
-		group_free_internal(exec);
-		
-//		PRINT_BUFFERS(exec);
-		
-		condition = (ns->vec[0] > 0.0f);
-		++iteration;
-	}
-	group_move_outputs(node, out, exec->stack);
-}
-
-void register_node_type_cmp_whileloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_whileloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_whileloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index dadc863..cb932b6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -32,7 +32,7 @@
 #include "node_composite_util.h"
 
 /* **************** COMPOSITE ******************** */
-static bNodeSocketTemplate cmp_node_composite_in[]= {
+static bNodeSocketTemplate cmp_node_composite_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Alpha"),		1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_FLOAT, 1, N_("Z"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
@@ -110,7 +110,7 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
 #endif
 
 	/* Do not allow muting for this node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 9b1483d..ad51fae 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -34,11 +34,11 @@
 
 /* **************** Crop  ******************** */
 
-static bNodeSocketTemplate cmp_node_crop_in[]= {
+static bNodeSocketTemplate cmp_node_crop_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_crop_out[]= {
+static bNodeSocketTemplate cmp_node_crop_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -82,7 +82,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
 		outputrect.ymin=MIN2(ntxy->y1, ntxy->y2);
 
 		if (node->custom1) {
-			/* this option crops the image size too  */	
+			/* this option crops the image size too  */
 			stackbuf= get_cropped_compbuf(&outputrect, cbuf->rect, cbuf->x, cbuf->y, cbuf->type);
 		}
 		else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 1948709..a1999ec 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -36,7 +36,7 @@
 /* **************** CURVE Time  ******************** */
 
 /* custom1 = sfra, custom2 = efra */
-static bNodeSocketTemplate cmp_node_time_out[]= {
+static bNodeSocketTemplate cmp_node_time_out[] = {
 	{	SOCK_FLOAT, 0, N_("Fac")},
 	{	-1, 0, ""	}
 };
@@ -55,7 +55,7 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
 	curvemapping_initialize(node->storage);
 	fac = curvemapping_evaluateF(node->storage, 0, fac);
 
-	out[0]->vec[0]= CLAMPIS(fac, 0.0f, 1.0f);
+	out[0]->vec[0] = CLAMPIS(fac, 0.0f, 1.0f);
 }
 
 #endif  /* WITH_COMPOSITOR_LEGACY */
@@ -86,12 +86,12 @@ void register_node_type_cmp_curve_time(bNodeTreeType *ttype)
 
 
 /* **************** CURVE VEC  ******************** */
-static bNodeSocketTemplate cmp_node_curve_vec_in[]= {
+static bNodeSocketTemplate cmp_node_curve_vec_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_curve_vec_out[]= {
+static bNodeSocketTemplate cmp_node_curve_vec_out[] = {
 	{	SOCK_VECTOR, 0, N_("Vector")},
 	{	-1, 0, ""	}
 };
@@ -132,7 +132,7 @@ void register_node_type_cmp_curve_vec(bNodeTreeType *ttype)
 
 
 /* **************** CURVE RGB  ******************** */
-static bNodeSocketTemplate cmp_node_curve_rgb_in[]= {
+static bNodeSocketTemplate cmp_node_curve_rgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),	1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),	1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Black Level"),	0.0f, 0.0f, 0.0f, 1.0f},
@@ -140,7 +140,7 @@ static bNodeSocketTemplate cmp_node_curve_rgb_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_curve_rgb_out[]= {
+static bNodeSocketTemplate cmp_node_curve_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -151,7 +151,7 @@ static void do_curves(bNode *node, float *out, float *in)
 {
 	curvemapping_initialize(node->storage);
 	curvemapping_evaluate_premulRGBF(node->storage, out, in);
-	out[3]= in[3];
+	out[3] = in[3];
 }
 
 static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
@@ -166,11 +166,11 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
 	else {
 		float col[4], mfac= 1.0f-*fac;
 		curvemapping_evaluate_premulRGBF(node->storage, col, in);
-		out[0]= mfac*in[0] + *fac*col[0];
-		out[1]= mfac*in[1] + *fac*col[1];
-		out[2]= mfac*in[2] + *fac*col[2];
+		out[0] = mfac*in[0] + *fac*col[0];
+		out[1] = mfac*in[1] + *fac*col[1];
+		out[2] = mfac*in[2] + *fac*col[2];
 	}
-	out[3]= in[3];
+	out[3] = in[3];
 }
 
 static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 1a98522..27ce0f7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -34,12 +34,12 @@
 #include <limits.h>
 
 /* ************ qdn: Defocus node ****************** */
-static bNodeSocketTemplate cmp_node_defocus_in[]= {
+static bNodeSocketTemplate cmp_node_defocus_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Z"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_defocus_out[]= {
+static bNodeSocketTemplate cmp_node_defocus_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -338,7 +338,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 		// fast blur...
 		// bug #6656 part 1, probably when previous node_composite.c was split into separate files, it was not properly updated
 		// to include recent cvs commits (well, at least not defocus node), so this part was missing...
-		wt = minf(nqd->maxblur, aperture * 128.0f);
+		wt = min_ff(nqd->maxblur, aperture * 128.0f);
 		IIR_gauss_single(crad, wt);
 		IIR_gauss_single(wts, wt);
 		
@@ -589,8 +589,8 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 					// n-agonal
 					int ov, nv;
 					float mind, maxd, lwt;
-					ys = maxi((int)floor(bkh_b[2] * ct_crad + y), 0);
-					ye = mini((int)ceil(bkh_b[3] * ct_crad + y), new->y - 1);
+					ys = max_ii((int)floor(bkh_b[2] * ct_crad + y), 0);
+					ye = min_ii((int)ceil(bkh_b[3] * ct_crad + y), new->y - 1);
 					for (sy=ys; sy<=ye; sy++) {
 						float fxs = 1e10f, fxe = -1e10f;
 						float yf = (sy - y)/ct_crad;
@@ -861,7 +861,7 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
 	if (node->exec & NODE_BREAK) {
 		free_compbuf(new);
 		new= NULL;
-	}	
+	}
 	out[0]->data = new;
 	if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
index 21b703d..9d47e4b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c
+++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
@@ -32,12 +32,12 @@
 #include "node_composite_util.h"
 
 /* **************** FILTER  ******************** */
-static bNodeSocketTemplate cmp_node_despeckle_in[]= {
+static bNodeSocketTemplate cmp_node_despeckle_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_despeckle_out[]= {
+static bNodeSocketTemplate cmp_node_despeckle_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index ed43bae..014b72d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -33,13 +33,13 @@
 #include "node_composite_util.h"
 
 /* ******************* channel Difference Matte ********************************* */
-static bNodeSocketTemplate cmp_node_diff_matte_in[]={
+static bNodeSocketTemplate cmp_node_diff_matte_in[] = {
 	{SOCK_RGBA, 1, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{SOCK_RGBA, 1, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_diff_matte_out[]={
+static bNodeSocketTemplate cmp_node_diff_matte_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
@@ -76,7 +76,7 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
 		}
 
 		/*only change if more transparent than either image */
-		maxInputAlpha=maxf(inColor1[3], inColor2[3]);
+		maxInputAlpha=max_ff(inColor1[3], inColor2[3]);
 		if (alpha < maxInputAlpha) {
 			/*clamp*/
 			if (alpha < 0.0f) alpha = 0.0f;
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index f53c64b..9787c9f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -54,28 +54,28 @@ static void morpho_dilate(CompBuf *cbuf)
 	for (y = 0; y < cbuf->y; y++) {
 		for (x = 0; x < cbuf->x - 1; x++) {
 			p = rectf + cbuf->x * y + x;
-			*p = maxf(*p, *(p + 1));
+			*p = max_ff(*p, *(p + 1));
 		}
 	}
 
 	for (y = 0; y < cbuf->y; y++) {
 		for (x = cbuf->x - 1; x >= 1; x--) {
 			p = rectf + cbuf->x * y + x;
-			*p = maxf(*p, *(p - 1));
+			*p = max_ff(*p, *(p - 1));
 		}
 	}
 
 	for (x = 0; x < cbuf->x; x++) {
 		for (y = 0; y < cbuf->y - 1; y++) {
 			p = rectf + cbuf->x * y + x;
-			*p = maxf(*p, *(p + cbuf->x));
+			*p = max_ff(*p, *(p + cbuf->x));
 		}
 	}
 
 	for (x = 0; x < cbuf->x; x++) {
 		for (y = cbuf->y - 1; y >= 1; y--) {
 			p = rectf + cbuf->x * y + x;
-			*p = maxf(*p, *(p - cbuf->x));
+			*p = max_ff(*p, *(p - cbuf->x));
 		}
 	}
 }
@@ -88,28 +88,28 @@ static void morpho_erode(CompBuf *cbuf)
 	for (y = 0; y < cbuf->y; y++) {
 		for (x = 0; x < cbuf->x - 1; x++) {
 			p = rectf + cbuf->x * y + x;
-			*p = minf(*p, *(p + 1));
+			*p = min_ff(*p, *(p + 1));
 		}
 	}
 
 	for (y = 0; y < cbuf->y; y++) {
 		for (x = cbuf->x - 1; x >= 1; x--) {
 			p = rectf + cbuf->x * y + x;
-			*p = minf(*p, *(p - 1));
+			*p = min_ff(*p, *(p - 1));
 		}
 	}
 
 	for (x = 0; x < cbuf->x; x++) {
 		for (y = 0; y < cbuf->y - 1; y++) {
 			p = rectf + cbuf->x * y + x;
-			*p = minf(*p, *(p + cbuf->x));
+			*p = min_ff(*p, *(p + cbuf->x));
 		}
 	}
 
 	for (x = 0; x < cbuf->x; x++) {
 		for (y = cbuf->y - 1; y >= 1; y--) {
 			p = rectf + cbuf->x * y + x;
-			*p = minf(*p, *(p - cbuf->x));
+			*p = min_ff(*p, *(p - cbuf->x));
 		}
 	}
 	
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index 51ccc2a..c07ad0a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -35,14 +35,14 @@
 
 /* **************** Displace  ******************** */
 
-static bNodeSocketTemplate cmp_node_displace_in[]= {
+static bNodeSocketTemplate cmp_node_displace_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_VECTOR, 1, N_("Vector"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION},
 	{	SOCK_FLOAT, 1, N_("X Scale"),				0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
 	{	SOCK_FLOAT, 1, N_("Y Scale"),				0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_displace_out[]= {
+static bNodeSocketTemplate cmp_node_displace_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -113,8 +113,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
 			dxt = p_dx - d_dx;
 			dyt = p_dy - d_dy;
 
-			dxt = signf(dxt)*maxf(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x;
-			dyt = signf(dyt)*maxf(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y;
+			dxt = signf(dxt)*max_ff(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x;
+			dyt = signf(dyt)*max_ff(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y;
 			
 			ibuf_sample(ibuf, u, v, dxt, dyt, col);
 			qd_setPixel(stackbuf, x, y, col);
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 7a101ff..7e60586 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -33,13 +33,13 @@
 #include "node_composite_util.h"
 
 /* ******************* channel Distance Matte ********************************* */
-static bNodeSocketTemplate cmp_node_distance_matte_in[]={
+static bNodeSocketTemplate cmp_node_distance_matte_in[] = {
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_distance_matte_out[]={
+static bNodeSocketTemplate cmp_node_distance_matte_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
@@ -159,9 +159,9 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
 	workbuf=dupalloc_compbuf(inbuf);
 
 	/*use the input color*/
-	c->key[0]= in[1]->vec[0];
-	c->key[1]= in[1]->vec[1];
-	c->key[2]= in[1]->vec[2];
+	c->key[0] = in[1]->vec[0];
+	c->key[1] = in[1]->vec[1];
+	c->key[2] = in[1]->vec[2];
 
 	/* work in RGB color space */
 	if (c->channel == 1) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 63a54ef..3c1e3ee 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -32,12 +32,12 @@
 /* **************** Double Edge Mask ******************** */
 
 
-static bNodeSocketTemplate cmp_node_doubleedgemask_in[]= {
+static bNodeSocketTemplate cmp_node_doubleedgemask_in[] = {
 	{ SOCK_FLOAT, 1, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE},	// inner mask socket definition
 	{ SOCK_FLOAT, 1, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE},	// outer mask socket definition
 	{ -1, 0, ""	}																	// input socket array terminator
 };
-static bNodeSocketTemplate cmp_node_doubleedgemask_out[]= {
+static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = {
 	{ SOCK_FLOAT, 0, "Mask"},		// output socket definition
 	{ -1, 0, "" }					// output socket array terminator
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
index a97322a..761b0b1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
@@ -1,6 +1,4 @@
 /*
- * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -35,15 +33,15 @@
 #include "../node_composite_util.h"
 
 /* **************** SCALAR MATH ******************** */ 
-static bNodeSocketTemplate cmp_node_ellipsemask_in[]= {
+static bNodeSocketTemplate cmp_node_ellipsemask_in[] = {
 	{	SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
-	{	-1, 0, "" } 
+	{   -1, 0, "" }
 };
 
-static bNodeSocketTemplate cmp_node_ellipsemask_out[]= {
+static bNodeSocketTemplate cmp_node_ellipsemask_out[] = {
 	{	SOCK_FLOAT, 0, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
-	{	-1, 0, "" } 
+	{   -1, 0, "" }
 };
 
 static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 0b12c03..a27116a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -33,12 +33,12 @@
 #include "node_composite_util.h"
 
 /* **************** FILTER  ******************** */
-static bNodeSocketTemplate cmp_node_filter_in[]= {
+static bNodeSocketTemplate cmp_node_filter_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_filter_out[]= {
+static bNodeSocketTemplate cmp_node_filter_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -73,10 +73,10 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
 				for (c=0; c<3; c++) {
 					f1= filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8];
 					f2= filter[0]*row1[0] + filter[3]*row1[4] + filter[6]*row1[8] + filter[1]*row2[0] + filter[4]*row2[4] + filter[7]*row2[8] + filter[2]*row3[0] + filter[5]*row3[4] + filter[8]*row3[8];
-					fp[0]= mfac*row2[4] + fac*sqrt(f1*f1 + f2*f2);
+					fp[0] = mfac*row2[4] + fac*sqrt(f1*f1 + f2*f2);
 					fp++; row1++; row2++; row3++;
 				}
-				fp[0]= row2[4];
+				fp[0] = row2[4];
 				/* no alpha... will clear it completely */
 				fp++; row1++; row2++; row3++;
 			}
@@ -87,7 +87,7 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
 			for (x=2; x<rowlen; x++) {
 				f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2];
 				f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2];
-				fp[0]= mfac*row2[1] + fac*sqrt(f1*f1 + f2*f2);
+				fp[0] = mfac*row2[1] + fac*sqrt(f1*f1 + f2*f2);
 				fp++; row1++; row2++; row3++;
 			}
 		}
@@ -116,28 +116,28 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 		fp= out->rect + pixlen*(y)*rowlen;
 		
 		if (pixlen==1) {
-			fp[0]= row2[0];
+			fp[0] = row2[0];
 			fp+= 1;
 			
 			for (x=2; x<rowlen; x++) {
-				fp[0]= mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]);
+				fp[0] = mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]);
 				fp++; row1++; row2++; row3++;
 			}
-			fp[0]= row2[1];
+			fp[0] = row2[1];
 		}
 		else if (pixlen==2) {
-			fp[0]= row2[0];
-			fp[1]= row2[1];
+			fp[0] = row2[0];
+			fp[1] = row2[1];
 			fp+= 2;
 			
 			for (x=2; x<rowlen; x++) {
 				for (c=0; c<2; c++) {
-					fp[0]= mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]);
+					fp[0] = mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]);
 					fp++; row1++; row2++; row3++;
 				}
 			}
-			fp[0]= row2[2];
-			fp[1]= row2[3];
+			fp[0] = row2[2];
+			fp[1] = row2[3];
 		}
 		else if (pixlen==3) {
 			copy_v3_v3(fp, row2);
@@ -145,7 +145,7 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 			
 			for (x=2; x<rowlen; x++) {
 				for (c=0; c<3; c++) {
-					fp[0]= mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]);
+					fp[0] = mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]);
 					fp++; row1++; row2++; row3++;
 				}
 			}
@@ -157,7 +157,7 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 			
 			for (x=2; x<rowlen; x++) {
 				for (c=0; c<4; c++) {
-					fp[0]= mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]);
+					fp[0] = mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]);
 					fp++; row1++; row2++; row3++;
 				}
 			}
@@ -169,13 +169,13 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 
 static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	static float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f};
-	float sharp[9]= {-1, -1, -1, -1, 9, -1, -1, -1, -1};
-	float laplace[9]= {-1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f, 1.0f, -1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f};
-	float sobel[9]= {1, 2, 1, 0, 0, 0, -1, -2, -1};
-	float prewitt[9]= {1, 1, 1, 0, 0, 0, -1, -1, -1};
-	float kirsch[9]= {5, 5, 5, -3, -3, -3, -2, -2, -2};
-	float shadow[9]= {1, 2, 1, 0, 1, 0, -1, -2, -1};
+	static float soft[9] = {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f};
+	float sharp[9] = {-1, -1, -1, -1, 9, -1, -1, -1, -1};
+	float laplace[9] = {-1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f, 1.0f, -1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f};
+	float sobel[9] = {1, 2, 1, 0, 0, 0, -1, -2, -1};
+	float prewitt[9] = {1, 1, 1, 0, 0, 0, -1, -1, -1};
+	float kirsch[9] = {5, 5, 5, -3, -3, -3, -2, -2, -2};
+	float shadow[9] = {1, 2, 1, 0, 1, 0, -1, -2, -1};
 	
 	if (out[0]->hasoutput==0) return;
 	
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index 147e759..4aa98d1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -33,12 +33,12 @@
 #include "node_composite_util.h"
 
 /* **************** Flip  ******************** */
-static bNodeSocketTemplate cmp_node_flip_in[]= {
+static bNodeSocketTemplate cmp_node_flip_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),		    1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_flip_out[]= {
+static bNodeSocketTemplate cmp_node_flip_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -75,7 +75,7 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack
 				outfp += (src_width-1)*src_pix;
 				for (x=0; x<src_width; x++) {
 					for (i=0; i<src_pix; i++) {
-						outfp[i]= srcfp[i];
+						outfp[i] = srcfp[i];
 					}
 					outfp -= src_pix;
 					srcfp += src_pix;
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index 8715547..b8c9989 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -35,12 +35,12 @@
 
 /* **************** Gamma Tools  ******************** */
   
-static bNodeSocketTemplate cmp_node_gamma_in[]= {
+static bNodeSocketTemplate cmp_node_gamma_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Gamma"),			1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_gamma_out[]= {
+static bNodeSocketTemplate cmp_node_gamma_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 7d6c0cb..950d8a5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -32,11 +32,11 @@
 
 #include "node_composite_util.h"
 
-static bNodeSocketTemplate cmp_node_glare_in[]= {
+static bNodeSocketTemplate cmp_node_glare_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_glare_out[]= {
+static bNodeSocketTemplate cmp_node_glare_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index c8784ce..d52e3d0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -34,12 +34,12 @@
 
 
 /* **************** Hue Saturation ******************** */
-static bNodeSocketTemplate cmp_node_hue_sat_in[]= {
+static bNodeSocketTemplate cmp_node_hue_sat_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_hue_sat_out[]= {
+static bNodeSocketTemplate cmp_node_hue_sat_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -60,10 +60,10 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
 		hsv[2]*= nhs->val;
 		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
 		
-		out[0]= mfac*in[0] + *fac*col[0];
-		out[1]= mfac*in[1] + *fac*col[1];
-		out[2]= mfac*in[2] + *fac*col[2];
-		out[3]= in[3];
+		out[0] = mfac*in[0] + *fac*col[0];
+		out[1] = mfac*in[1] + *fac*col[1];
+		out[2] = mfac*in[2] + *fac*col[2];
+		out[3] = in[3];
 	}
 	else {
 		copy_v4_v4(out, in);
@@ -89,7 +89,7 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
 
 		out[0]->data= stackbuf;
 
-		/* get rid of intermediary cbuf if it's extra */		
+		/* get rid of intermediary cbuf if it's extra */
 		if (stackbuf!=cbuf)
 			free_compbuf(cbuf);
 	}
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index 42077cd..f751dbe 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -32,13 +32,13 @@
 
 #include "node_composite_util.h"
 
-static bNodeSocketTemplate cmp_node_huecorrect_in[]= {
+static bNodeSocketTemplate cmp_node_huecorrect_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),	1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),	1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_huecorrect_out[]= {
+static bNodeSocketTemplate cmp_node_huecorrect_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -71,7 +71,7 @@ static void do_huecorrect(bNode *node, float *out, float *in)
 	/* convert back to rgb */
 	hsv_to_rgb(hsv[0], hsv[1], hsv[2], out, out+1, out+2);
 	
-	out[3]= in[3];
+	out[3] = in[3];
 }
 
 static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
@@ -101,10 +101,10 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
 	/* convert back to rgb */
 	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
 	
-	out[0]= mfac*in[0] + *fac*rgb[0];
-	out[1]= mfac*in[1] + *fac*rgb[1];
-	out[2]= mfac*in[2] + *fac*rgb[2];
-	out[3]= in[3];
+	out[0] = mfac*in[0] + *fac*rgb[0];
+	out[1] = mfac*in[1] + *fac*rgb[1];
+	out[2] = mfac*in[2] + *fac*rgb[2];
+	out[3] = in[3];
 }
 
 static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 31a3a76..ef0c502 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -35,11 +35,11 @@
 
 /* **************** ID Mask  ******************** */
 
-static bNodeSocketTemplate cmp_node_idmask_in[]= {
+static bNodeSocketTemplate cmp_node_idmask_in[] = {
 	{	SOCK_FLOAT, 1, N_("ID value"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_idmask_out[]= {
+static bNodeSocketTemplate cmp_node_idmask_out[] = {
 	{	SOCK_FLOAT, 0, N_("Alpha")},
 	{	-1, 0, ""	}
 };
@@ -56,14 +56,14 @@ static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
 	rect= cbuf->rect;
 	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
 		if (rect[x]==idnr)
-			abuf[x]= 255;
+			abuf[x] = 255;
 	
 	antialias_tagbuf(cbuf->x, cbuf->y, abuf);
 	
 	rect= stackbuf->rect;
 	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
 		if (abuf[x]>1)
-			rect[x]= (1.0f/255.0f)*(float)abuf[x];
+			rect[x] = (1.0f/255.0f)*(float)abuf[x];
 	
 	MEM_freeN(abuf);
 }
@@ -78,7 +78,7 @@ static void do_idmask_fsa(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
 	rs= stackbuf->rect;
 	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
 		if (rect[x]==idnr)
-			rs[x]= 1.0f;
+			rs[x] = 1.0f;
 	
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 9f38745..88d78df 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -34,7 +34,7 @@
 
 /* **************** IMAGE (and RenderResult, multilayer image) ******************** */
 
-static bNodeSocketTemplate cmp_node_rlayers_out[]= {
+static bNodeSocketTemplate cmp_node_rlayers_out[] = {
 	{	SOCK_RGBA, 0, N_("Image"),					0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Alpha"),					1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Z"),						1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
@@ -173,9 +173,10 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
 	Image *ima= (Image *)node->id;
 	if (ima) {
 		ImageUser *iuser= node->storage;
+		ImBuf *ibuf;
 		
 		/* make sure ima->type is correct */
-		BKE_image_get_ibuf(ima, iuser);
+		ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
 		
 		if (ima->rr) {
 			RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
@@ -191,6 +192,8 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
 		}
 		else
 			cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
+		
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 	else
 		cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
@@ -312,7 +315,7 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
 }
 
 /* note: this function is used for multilayer too, to ensure uniform 
- * handling with BKE_image_get_ibuf() */
+ * handling with BKE_image_acquire_ibuf() */
 static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *iuser)
 {
 	ImBuf *ibuf;
@@ -322,7 +325,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 	float *rect;
 	int alloc= FALSE;
 
-	ibuf= BKE_image_get_ibuf(ima, iuser);
+	ibuf= BKE_image_acquire_ibuf(ima, iuser, NULL);
 	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
 		return NULL;
 	}
@@ -374,12 +377,15 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 		}
 	}
 #endif
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	return stackbuf;
 }
 
 static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
 {
-	ImBuf *ibuf= BKE_image_get_ibuf((Image *)node->id, node->storage);
+	ImBuf *ibuf= BKE_image_acquire_ibuf((Image *)node->id, node->storage, NULL);
 	CompBuf *zbuf= NULL;
 	
 	if (ibuf && ibuf->zbuf_float) {
@@ -391,6 +397,9 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
 			zbuf->rect= ibuf->zbuf_float;
 		}
 	}
+
+	BKE_image_release_ibuf((Image *)node->id, ibuf, NULL);
+
 	return zbuf;
 }
 
@@ -418,13 +427,14 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
 		RenderData *rd= data;
 		Image *ima= (Image *)node->id;
 		ImageUser *iuser= (ImageUser *)node->storage;
+		ImBuf *ibuf = NULL;
 		
 		/* first set the right frame number in iuser */
 		BKE_image_user_frame_calc(iuser, rd->cfra, 0);
 		
 		/* force a load, we assume iuser index will be set OK anyway */
 		if (ima->type==IMA_TYPE_MULTILAYER)
-			BKE_image_get_ibuf(ima, iuser);
+			ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
 		
 		if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
 			RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
@@ -505,7 +515,9 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
 				generate_preview(data, node, stackbuf);
 			}
 		}
-	}	
+
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+	}
 }
 
 #endif  /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index b0e656b..2db6e42 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -32,15 +32,15 @@
 #include "node_composite_util.h"
 
 /* **************** INVERT ******************** */
-static bNodeSocketTemplate cmp_node_invert_in[]= { 
-	{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, 
-	{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate cmp_node_invert_in[] = {
+	{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+	{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate cmp_node_invert_out[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate cmp_node_invert_out[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
 #ifdef WITH_COMPOSITOR_LEGACY
diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
index e16b7e5..96e9058 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
@@ -96,21 +96,24 @@ static void compute_gradient_screen(RenderData *rd, NodeKeyingScreenData *keying
 		int j;
 
 		zero_v3(site->color);
-		for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
-			if (pattern_ibuf->rect_float) {
-				add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
-			}
-			else {
-				unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
 
-				site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
-				site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
-				site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+		if (pattern_ibuf) {
+			for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
+				if (pattern_ibuf->rect_float) {
+					add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
+				}
+				else {
+					unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
+
+					site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
+					site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
+					site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+				}
 			}
-		}
 
-		mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
-		IMB_freeImBuf(pattern_ibuf);
+			mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
+			IMB_freeImBuf(pattern_ibuf);
+		}
 
 		site->co[0] = marker->pos[0] * screenbuf->x;
 		site->co[1] = marker->pos[1] * screenbuf->y;
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
index a4983cc..c3f64f0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
@@ -32,13 +32,13 @@
 
 #include "node_composite_util.h"
 
-static bNodeSocketTemplate cmp_node_lensdist_in[]= {
+static bNodeSocketTemplate cmp_node_lensdist_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Distort"), 	0.f, 0.f, 0.f, 0.f, -0.999f, 1.f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Dispersion"), 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_lensdist_out[]= {
+static bNodeSocketTemplate cmp_node_lensdist_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -74,7 +74,7 @@ static void lensDistort(CompBuf *dst, CompBuf *src, float kr, float kg, float kb
 				qd_getPixelLerpChan(tsrc, (u*dst->x - kr) - 0.5f, v*dst->y - 0.5f, 2, colp[x]+2);
 				
 				/* set alpha */
-				colp[x][3]= 1.0f;
+				colp[x][3] = 1.0f;
 			}
 		}
 		free_compbuf(tsrc);
@@ -159,7 +159,7 @@ static void lensDistort(CompBuf *dst, CompBuf *src, float kr, float kg, float kb
 				if (db) colp[x][2] = 2.f*tc[2] / (float)db;
 	
 				/* set alpha */
-				colp[x][3]= 1.0f;
+				colp[x][3] = 1.0f;
 			}
 		}
 	}
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 601516c..57d94d6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -34,12 +34,12 @@
 
 
 /* **************** LEVELS ******************** */
-static bNodeSocketTemplate cmp_node_view_levels_in[]= {
+static bNodeSocketTemplate cmp_node_view_levels_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_view_levels_out[]={
+static bNodeSocketTemplate cmp_node_view_levels_out[] = {
 	{SOCK_FLOAT, 0, N_("Mean")},
 	{SOCK_FLOAT, 0, N_("Std Dev")},
 	{-1, 0, ""}
@@ -101,7 +101,7 @@ static void fill_bins(bNode *node, CompBuf* in, int* bins)
 				bins[ivalue]+=1;
 			} /*end if alpha */
 		}
-	}	
+	}
 }
 
 static float brightness_mean(bNode *node, CompBuf* in)
@@ -275,8 +275,8 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
 	if (in[0]->hasinput==0)  return;
 	if (in[0]->data==NULL) return;
 
-	histogram=alloc_compbuf(256, 256, CB_RGBA, 1);	
-	cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);	
+	histogram=alloc_compbuf(256, 256, CB_RGBA, 1);
+	cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
 		
 	/*initalize bins*/
 	for (x=0; x<256; x++) {
@@ -300,9 +300,9 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
 #endif
 
 	if (out[0]->hasoutput)
-			out[0]->vec[0]= mean;
+			out[0]->vec[0] = mean;
 	if (out[1]->hasoutput)
-			out[1]->vec[0]= std_dev;
+			out[1]->vec[0] = std_dev;
 
 	generate_preview(data, node, histogram);
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index 61cd449..ed23293 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -34,12 +34,12 @@
 
 
 /* ******************* Luma Matte Node ********************************* */
-static bNodeSocketTemplate cmp_node_luma_matte_in[]={
+static bNodeSocketTemplate cmp_node_luma_matte_in[] = {
 	{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
 	{-1, 0, ""}
 };
 
-static bNodeSocketTemplate cmp_node_luma_matte_out[]={
+static bNodeSocketTemplate cmp_node_luma_matte_out[] = {
 	{SOCK_RGBA, 0, N_("Image")},
 	{SOCK_FLOAT, 0, N_("Matte")},
 	{-1, 0, ""}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
new file mode 100644
index 0000000..f96e133
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
@@ -0,0 +1,58 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_mapRange.c
+ *  \ingroup cmpnodes
+ */
+
+
+#include "node_composite_util.h"
+
+/* **************** MAP VALUE ******************** */
+static bNodeSocketTemplate cmp_node_map_range_in[] = {
+	{	SOCK_FLOAT, 1, N_("Value"),		1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+	{	SOCK_FLOAT, 1, N_("From Min"),	0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{	SOCK_FLOAT, 1, N_("From Max"),	1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{	SOCK_FLOAT, 1, N_("To Min"),	0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{	SOCK_FLOAT, 1, N_("To Max"),	1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{	-1, 0, ""	}
+};
+static bNodeSocketTemplate cmp_node_map_range_out[] = {
+	{	SOCK_FLOAT, 0, N_("Value")},
+	{	-1, 0, ""	}
+};
+
+void register_node_type_cmp_map_range(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+	node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out);
+	node_type_size(&ntype, 120, 60, 150);
+
+	nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index 04d2eaf..40092a8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -34,12 +34,12 @@
 
 /* **************** Map UV  ******************** */
 
-static bNodeSocketTemplate cmp_node_mapuv_in[]= {
+static bNodeSocketTemplate cmp_node_mapuv_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_VECTOR, 1, N_("UV"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_mapuv_out[]= {
+static bNodeSocketTemplate cmp_node_mapuv_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -135,7 +135,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
 		}
 	}
 
-	IMB_freeImBuf(ibuf);	
+	IMB_freeImBuf(ibuf);
 }
 
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index be69c11..677d5bd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -33,11 +33,11 @@
 #include "node_composite_util.h"
 
 /* **************** MAP VALUE ******************** */
-static bNodeSocketTemplate cmp_node_map_value_in[]= {
+static bNodeSocketTemplate cmp_node_map_value_in[] = {
 	{	SOCK_FLOAT, 1, N_("Value"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_map_value_out[]= {
+static bNodeSocketTemplate cmp_node_map_value_out[] = {
 	{	SOCK_FLOAT, 0, N_("Value")},
 	{	-1, 0, ""	}
 };
@@ -48,13 +48,13 @@ static void do_map_value(bNode *node, float *out, float *src)
 {
 	TexMapping *texmap= node->storage;
 	
-	out[0]= (src[0] + texmap->loc[0])*texmap->size[0];
+	out[0] = (src[0] + texmap->loc[0])*texmap->size[0];
 	if (texmap->flag & TEXMAP_CLIP_MIN)
 		if (out[0]<texmap->min[0])
-			out[0]= texmap->min[0];
+			out[0] = texmap->min[0];
 	if (texmap->flag & TEXMAP_CLIP_MAX)
 		if (out[0]>texmap->max[0])
-			out[0]= texmap->max[0];
+			out[0] = texmap->max[0];
 }
 
 static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 1bddfe0..5bc67ad 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -33,15 +33,15 @@
 #include "node_composite_util.h"
 
 /* **************** SCALAR MATH ******************** */ 
-static bNodeSocketTemplate cmp_node_math_in[]= { 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate cmp_node_math_in[] = {
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate cmp_node_math_out[]= { 
-	{ SOCK_FLOAT, 0, N_("Value")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate cmp_node_math_out[] = {
+	{ SOCK_FLOAT, 0, N_("Value")},
+	{ -1, 0, "" }
 };
 
 #ifdef WITH_COMPOSITOR_LEGACY
@@ -50,63 +50,64 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 {
 	switch (node->custom1) {
 	case 0: /* Add */
-		out[0]= in[0] + in2[0]; 
+		out[0] = in[0] + in2[0];
 		break; 
 	case 1: /* Subtract */
-		out[0]= in[0] - in2[0];
+		out[0] = in[0] - in2[0];
 		break; 
 	case 2: /* Multiply */
-		out[0]= in[0] * in2[0]; 
+		out[0] = in[0] * in2[0];
 		break; 
 	case 3: /* Divide */
 		{
 			if (in2[0]==0)	/* We don't want to divide by zero. */
-				out[0]= 0.0;
+				out[0] = 0.0;
 			else
-				out[0]= in[0] / in2[0];
+				out[0] = in[0] / in2[0];
 			}
 		break;
 	case 4: /* Sine */
-		out[0]= sin(in[0]);
+		out[0] = sin(in[0]);
 		break;
 	case 5: /* Cosine */
-		out[0]= cos(in[0]);
+		out[0] = cos(in[0]);
 		break;
 	case 6: /* Tangent */
-		out[0]= tan(in[0]);
+		out[0] = tan(in[0]);
 		break;
 	case 7: /* Arc-Sine */
 		{
 			/* Can't do the impossible... */
 			if (in[0] <= 1 && in[0] >= -1 )
-				out[0]= asin(in[0]);
+				out[0] = asin(in[0]);
 			else
-				out[0]= 0.0;
+				out[0] = 0.0;
 		}
 		break;
 	case 8: /* Arc-Cosine */
 		{
 			/* Can't do the impossible... */
 			if ( in[0] <= 1 && in[0] >= -1 )
-				out[0]= acos(in[0]);
+				out[0] = acos(in[0]);
 			else
-				out[0]= 0.0;
+				out[0] = 0.0;
 		}
 		break;
 	case 9: /* Arc-Tangent */
-		out[0]= atan(in[0]);
+		out[0] = atan(in[0]);
 		break;
 	case 10: /* Power */
 		{
 			/* Only raise negative numbers by full integers */
 			if ( in[0] >= 0 ) {
-				out[0]= pow(in[0], in2[0]);
+				out[0] = pow(in[0], in2[0]);
 			}
 			else {
-				float y_mod_1 = fmod(in2[0], 1);
+				float y_mod_1 = fabsf(fmodf(in2[0], 1.0f));
+				
 				/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
 				if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
-					out[0]= powf(in[0], floorf(in2[0] + 0.5f));
+					out[0] = powf(in[0], floorf(in2[0] + 0.5f));
 				}
 				else {
 					out[0] = 0.0f;
@@ -118,50 +119,50 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		{
 			/* Don't want any imaginary numbers... */
 			if ( in[0] > 0  && in2[0] > 0 )
-				out[0]= log(in[0]) / log(in2[0]);
+				out[0] = log(in[0]) / log(in2[0]);
 			else
-				out[0]= 0.0;
+				out[0] = 0.0;
 		}
 		break;
 	case 12: /* Minimum */
 		{
 			if ( in[0] < in2[0] )
-				out[0]= in[0];
+				out[0] = in[0];
 			else
-				out[0]= in2[0];
+				out[0] = in2[0];
 		}
 		break;
 	case 13: /* Maximum */
 		{
 			if ( in[0] > in2[0] )
-				out[0]= in[0];
+				out[0] = in[0];
 			else
-				out[0]= in2[0];
+				out[0] = in2[0];
 		}
 		break;
 	case 14: /* Round */
 		{
 			/* round by the second value */
 			if ( in2[0] != 0.0f )
-				out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0];
+				out[0] = floorf(in[0] / in2[0] + 0.5f) * in2[0];
 			else
-				out[0]= floorf(in[0] + 0.5f);
+				out[0] = floorf(in[0] + 0.5f);
 		}
 		break;
 	case 15: /* Less Than */
 		{
 			if ( in[0] < in2[0] )
-				out[0]= 1.0f;
+				out[0] = 1.0f;
 			else
-				out[0]= 0.0f;
+				out[0] = 0.0f;
 		}
 		break;
 	case 16: /* Greater Than */
 		{
 			if ( in[0] > in2[0] )
-				out[0]= 1.0f;
+				out[0] = 1.0f;
 			else
-				out[0]= 0.0f;
+				out[0] = 0.0f;
 		}
 		break;
 	}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index e2c9a5a..5d3ee48 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -32,13 +32,13 @@
 #include "node_composite_util.h"
 
 /* **************** MIX RGB ******************** */
-static bNodeSocketTemplate cmp_node_mix_rgb_in[]= {
+static bNodeSocketTemplate cmp_node_mix_rgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_mix_rgb_out[]= {
+static bNodeSocketTemplate cmp_node_mix_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -55,7 +55,7 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f
 	else
 		ramp_blend(node->custom1, col, fac[0], in2);
 	copy_v3_v3(out, col);
-	out[3]= in1[3];
+	out[3] = in1[3];
 }
 
 static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index 6f1e86e..d104e8f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -34,13 +34,13 @@
 
 
 /* **************** NORMAL  ******************** */
-static bNodeSocketTemplate cmp_node_normal_in[]= {
+static bNodeSocketTemplate cmp_node_normal_in[] = {
 	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_normal_out[]= {
-	{	SOCK_VECTOR, 0, N_("Normal")},
+static bNodeSocketTemplate cmp_node_normal_out[] = {
+	{	SOCK_VECTOR, 0, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
 	{	SOCK_FLOAT, 0, N_("Dot")},
 	{	-1, 0, ""	}
 };
@@ -53,7 +53,7 @@ static void do_normal(bNode *node, float *out, float *in)
 	float *nor= ((bNodeSocketValueVector*)sock->default_value)->value;
 	
 	/* render normals point inside... the widget points outside */
-	out[0]= -dot_v3v3(nor, in);
+	out[0] = -dot_v3v3(nor, in);
 }
 
 /* generates normal, does dot product */
@@ -68,7 +68,7 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
 	if (in[0]->data==NULL) {
 		copy_v3_v3(out[0]->vec, nor);
 		/* render normals point inside... the widget points outside */
-		out[1]->vec[0]= -dot_v3v3(out[0]->vec, in[0]->vec);
+		out[1]->vec[0] = -dot_v3v3(out[0]->vec, in[0]->vec);
 	}
 	else if (out[1]->hasoutput) {
 		/* make output size of input image */
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 1d2312d..19b543d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -34,11 +34,11 @@
 
 
 /* **************** NORMALIZE single channel, useful for Z buffer ******************** */
-static bNodeSocketTemplate cmp_node_normalize_in[]= {
+static bNodeSocketTemplate cmp_node_normalize_in[] = {
 	{   SOCK_FLOAT, 1, N_("Value"),         1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{   -1, 0, ""   }
 };
-static bNodeSocketTemplate cmp_node_normalize_out[]= {
+static bNodeSocketTemplate cmp_node_normalize_out[] = {
 	{   SOCK_FLOAT, 0, N_("Value")},
 	{   -1, 0, ""   }
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 656e2a7..214617c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -242,7 +242,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack
 			ImageFormatData *format = (sockdata->use_node_format ? &nimf->format : &sockdata->format);
 			char path[FILE_MAX];
 			char filename[FILE_MAX];
-			CompBuf *cbuf;
+			CompBuf *cbuf = NULL;
 			ImBuf *ibuf;
 			
 			switch (format->planes) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
new file mode 100644
index 0000000..5eac486
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
@@ -0,0 +1,57 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jeroen Bakker
+ *                 Monique Dewanchand
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_pixelate.c
+ *  \ingroup cmpnodes
+ */
+
+
+#include "node_composite_util.h"
+
+
+/* **************** Pixelate ******************** */
+
+static bNodeSocketTemplate cmp_node_pixelate_in[] = {
+	{   SOCK_RGBA, 1, N_("Color"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+	{   -1, 0, ""   }
+};
+static bNodeSocketTemplate cmp_node_pixelate_out[] = {
+	{   SOCK_RGBA, 0, N_("Color")},
+	{   -1, 0, ""   }
+};
+
+void register_node_type_cmp_pixelate(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+	node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out);
+	node_type_size(&ntype, 130, 100, 130);
+
+	nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index d791983..7f7b769 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -35,11 +35,11 @@
 
 /* **************** Premul and Key Alpha Convert ******************** */
 
-static bNodeSocketTemplate cmp_node_premulkey_in[]= {
+static bNodeSocketTemplate cmp_node_premulkey_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_premulkey_out[]= {
+static bNodeSocketTemplate cmp_node_premulkey_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index 65c1dcd..54fba65 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -34,7 +34,7 @@
 
 
 /* **************** RGB ******************** */
-static bNodeSocketTemplate cmp_node_rgb_out[]= {
+static bNodeSocketTemplate cmp_node_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("RGBA"),			0.5f, 0.5f, 0.5f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 8968fd5..9a76764 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -34,12 +34,12 @@
 
 /* **************** Rotate  ******************** */
 
-static bNodeSocketTemplate cmp_node_rotate_in[]= {
+static bNodeSocketTemplate cmp_node_rotate_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Degr"),			0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_rotate_out[]= {
+static bNodeSocketTemplate cmp_node_rotate_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index ebc18cd..f1a7549 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -34,11 +34,11 @@
 
 
 /* **************** SEPARATE HSVA ******************** */
-static bNodeSocketTemplate cmp_node_sephsva_in[]= {
+static bNodeSocketTemplate cmp_node_sephsva_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_sephsva_out[]= {
+static bNodeSocketTemplate cmp_node_sephsva_out[] = {
 	{	SOCK_FLOAT, 0, N_("H")},
 	{	SOCK_FLOAT, 0, N_("S")},
 	{	SOCK_FLOAT, 0, N_("V")},
@@ -54,10 +54,10 @@ static void do_sephsva(bNode *UNUSED(node), float *out, float *in)
 	
 	rgb_to_hsv(in[0], in[1], in[2], &h, &s, &v);
 	
-	out[0]= h;
-	out[1]= s;
-	out[2]= v;
-	out[3]= in[3];
+	out[0] = h;
+	out[1] = s;
+	out[2] = v;
+	out[3] = in[3];
 }
 
 static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
@@ -97,7 +97,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
 		/*not used anymore */
 		if (cbuf2!=cbuf)
 			free_compbuf(cbuf2);
-		free_compbuf(cbuf);	
+		free_compbuf(cbuf);
 	}
 }
 
@@ -126,7 +126,7 @@ static bNodeSocketTemplate cmp_node_combhsva_in[] = {
 	{	SOCK_FLOAT, 1, N_("A"),			1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_combhsva_out[]= {
+static bNodeSocketTemplate cmp_node_combhsva_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 0c989ed..83b2c73 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -33,11 +33,11 @@
 #include "node_composite_util.h"
 
 /* **************** SEPARATE RGBA ******************** */
-static bNodeSocketTemplate cmp_node_seprgba_in[]= {
+static bNodeSocketTemplate cmp_node_seprgba_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_seprgba_out[]= {
+static bNodeSocketTemplate cmp_node_seprgba_out[] = {
 	{	SOCK_FLOAT, 0, N_("R")},
 	{	SOCK_FLOAT, 0, N_("G")},
 	{	SOCK_FLOAT, 0, N_("B")},
@@ -98,14 +98,14 @@ void register_node_type_cmp_seprgba(bNodeTreeType *ttype)
 
 
 /* **************** COMBINE RGBA ******************** */
-static bNodeSocketTemplate cmp_node_combrgba_in[]= {
+static bNodeSocketTemplate cmp_node_combrgba_in[] = {
 	{	SOCK_FLOAT, 1, N_("R"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("G"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("B"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("A"),			1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_combrgba_out[]= {
+static bNodeSocketTemplate cmp_node_combrgba_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -150,7 +150,7 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt
 								  do_combrgba, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
 		
 		out[0]->data= stackbuf;
-	}	
+	}
 }
 
 #endif  /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index ccae7cf..982d674 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -34,11 +34,11 @@
 
 
 /* **************** SEPARATE YCCA ******************** */
-static bNodeSocketTemplate cmp_node_sepycca_in[]= {
+static bNodeSocketTemplate cmp_node_sepycca_in[] = {
 	{  SOCK_RGBA, 1, N_("Image"),        1.0f, 1.0f, 1.0f, 1.0f},
 	{  -1, 0, ""   }
 };
-static bNodeSocketTemplate cmp_node_sepycca_out[]= {
+static bNodeSocketTemplate cmp_node_sepycca_out[] = {
 	{  SOCK_FLOAT, 0, N_("Y")},
 	{  SOCK_FLOAT, 0, N_("Cb")},
 	{  SOCK_FLOAT, 0, N_("Cr")},
@@ -55,10 +55,10 @@ static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in)
 	rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT601);
 	
 	/*divided by 255 to normalize for viewing in */
-	out[0]=  y/255.0f;
-	out[1]= cb/255.0f;
-	out[2]= cr/255.0f;
-	out[3]= in[3];
+	out[0] =  y/255.0f;
+	out[1] = cb/255.0f;
+	out[2] = cr/255.0f;
+	out[3] = in[3];
 }
 
 static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in)
@@ -68,10 +68,10 @@ static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in)
 	rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709);
 	
 	/*divided by 255 to normalize for viewing in */
-	out[0]=  y/255.0f;
-	out[1]= cb/255.0f;
-	out[2]= cr/255.0f;
-	out[3]= in[3];
+	out[0] =  y/255.0f;
+	out[1] = cb/255.0f;
+	out[2] = cr/255.0f;
+	out[3] = in[3];
 }
 
 static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in)
@@ -81,10 +81,10 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in)
 	rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255);
 	
 	/*divided by 255 to normalize for viewing in */
-	out[0]=  y/255.0f;
-	out[1]= cb/255.0f;
-	out[2]= cr/255.0f;
-	out[3]= in[3];
+	out[0] =  y/255.0f;
+	out[1] = cb/255.0f;
+	out[2] = cr/255.0f;
+	out[3] = in[3];
 }
 
 static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
@@ -167,14 +167,14 @@ void register_node_type_cmp_sepycca(bNodeTreeType *ttype)
 
 
 /* **************** COMBINE YCCA ******************** */
-static bNodeSocketTemplate cmp_node_combycca_in[]= {
+static bNodeSocketTemplate cmp_node_combycca_in[] = {
 	{	SOCK_FLOAT, 1, N_("Y"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Cb"),			0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Cr"),			0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("A"),			1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_combycca_out[]= {
+static bNodeSocketTemplate cmp_node_combycca_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
@@ -296,7 +296,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
 		}
 
 		out[0]->data= stackbuf;
-	}	
+	}
 }
 
 #endif  /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 9b8c805..0a95759 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -34,11 +34,11 @@
 
 
 /* **************** SEPARATE YUVA ******************** */
-static bNodeSocketTemplate cmp_node_sepyuva_in[]= {
+static bNodeSocketTemplate cmp_node_sepyuva_in[] = {
 	{  SOCK_RGBA, 1, N_("Image"),        1.0f, 1.0f, 1.0f, 1.0f},
 	{  -1, 0, ""   }
 };
-static bNodeSocketTemplate cmp_node_sepyuva_out[]= {
+static bNodeSocketTemplate cmp_node_sepyuva_out[] = {
 	{  SOCK_FLOAT, 0, N_("Y")},
 	{  SOCK_FLOAT, 0, N_("U")},
 	{  SOCK_FLOAT, 0, N_("V")},
@@ -54,10 +54,10 @@ static void do_sepyuva(bNode *UNUSED(node), float *out, float *in)
 	
 	rgb_to_yuv(in[0], in[1], in[2], &y, &u, &v);
 	
-	out[0]= y;
-	out[1]= u;
-	out[2]= v;
-	out[3]= in[3];
+	out[0] = y;
+	out[1] = u;
+	out[2] = v;
+	out[3] = in[3];
 }
 
 static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
@@ -121,14 +121,14 @@ void register_node_type_cmp_sepyuva(bNodeTreeType *ttype)
 
 
 /* **************** COMBINE YUVA ******************** */
-static bNodeSocketTemplate cmp_node_combyuva_in[]= {
+static bNodeSocketTemplate cmp_node_combyuva_in[] = {
 	{	SOCK_FLOAT, 1, N_("Y"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("U"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("V"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("A"),			1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_combyuva_out[]= {
+static bNodeSocketTemplate cmp_node_combyuva_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index 503815b..59c1048 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -33,12 +33,12 @@
 #include "node_composite_util.h"
 
 /* **************** SET ALPHA ******************** */
-static bNodeSocketTemplate cmp_node_setalpha_in[]= {
+static bNodeSocketTemplate cmp_node_setalpha_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Alpha"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_setalpha_out[]= {
+static bNodeSocketTemplate cmp_node_setalpha_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index f6811f5..41fb0e8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -33,7 +33,7 @@
 #include "node_composite_util.h"
 
 /* **************** SPLIT VIEWER ******************** */
-static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
+static bNodeSocketTemplate cmp_node_splitviewer_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Image"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
@@ -77,7 +77,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 		ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
 		if (ibuf==NULL) {
 			printf("node_composit_exec_viewer error\n");
-			BKE_image_release_ibuf(ima, lock);
+			BKE_image_release_ibuf(ima, ibuf, lock);
 			return;
 		}
 		
@@ -128,7 +128,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 		
 		composit3_pixel_processor(node, cbuf, buf1, in[0]->vec, buf2, in[1]->vec, mask, NULL, do_copy_split_rgba, CB_RGBA, CB_RGBA, CB_VAL);
 		
-		BKE_image_release_ibuf(ima, lock);
+		BKE_image_release_ibuf(ima, ibuf, lock);
 		
 		generate_preview(data, node, cbuf);
 		free_compbuf(cbuf);
@@ -167,7 +167,7 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype)
 #endif
 
 	/* Do not allow muting for this node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index fdf0b38..1787e07 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -35,12 +35,12 @@
 
 /* **************** Translate  ******************** */
 
-static bNodeSocketTemplate cmp_node_stabilize2d_in[]= {
+static bNodeSocketTemplate cmp_node_stabilize2d_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_stabilize2d_out[]= {
+static bNodeSocketTemplate cmp_node_stabilize2d_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
index 258fac1..7f9127c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -34,13 +34,13 @@
 #include "../node_composite_util.h"
 
 /* **************** MIX RGB ******************** */
-static bNodeSocketTemplate cmp_node_switch_in[]= {
+static bNodeSocketTemplate cmp_node_switch_in[] = {
 	{	SOCK_RGBA, 1, N_("Off"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("On"),			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_switch_out[]= {
+static bNodeSocketTemplate cmp_node_switch_out[] = {
 	{	SOCK_RGBA, 0, N_("Image"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 3fedccd..b6518c4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -33,12 +33,12 @@
 #include "node_composite_util.h"
 
 /* **************** TEXTURE ******************** */
-static bNodeSocketTemplate cmp_node_texture_in[]= {
+static bNodeSocketTemplate cmp_node_texture_in[] = {
 	{	SOCK_VECTOR, 1, N_("Offset"),		0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION},
 	{	SOCK_VECTOR, 1, N_("Scale"),		1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_texture_out[]= {
+static bNodeSocketTemplate cmp_node_texture_out[] = {
 	{	SOCK_FLOAT, 0, N_("Value")},
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
@@ -51,28 +51,28 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
 {
 	bNode *node= cbuf->node;
 	TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
-	float vec[3], *size, nor[3]={0.0f, 0.0f, 0.0f}, col[4];
+	float vec[3], *size, nor[3] = {0.0f, 0.0f, 0.0f}, col[4];
 	int retval, type= cbuf->procedural_type;
 	
 	size= cbuf->procedural_size;
 	
-	vec[0]= size[0]*(xco + cbuf->procedural_offset[0]);
-	vec[1]= size[1]*(yco + cbuf->procedural_offset[1]);
-	vec[2]= size[2]*cbuf->procedural_offset[2];
+	vec[0] = size[0]*(xco + cbuf->procedural_offset[0]);
+	vec[1] = size[1]*(yco + cbuf->procedural_offset[1]);
+	vec[2] = size[2]*cbuf->procedural_offset[2];
 	
 	retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres);
 	
 	if (type==CB_VAL) {
 		if (texres.talpha)
-			col[0]= texres.ta;
+			col[0] = texres.ta;
 		else
-			col[0]= texres.tin;
+			col[0] = texres.tin;
 	}
 	else if (type==CB_RGBA) {
 		if (texres.talpha)
-			col[3]= texres.ta;
+			col[3] = texres.ta;
 		else
-			col[3]= texres.tin;
+			col[3] = texres.tin;
 		
 		if ((retval & TEX_RGB)) {
 			copy_v3_v3(col, &texres.tr);
@@ -81,7 +81,7 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
 			copy_v3_fl(col, col[3]);
 		}
 	}
-	else { 
+	else {
 		copy_v3_v3(col, nor);
 	}
 	
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 5e4efe2..00b1a55 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -32,11 +32,11 @@
 
 #include "node_composite_util.h"
 
-static bNodeSocketTemplate cmp_node_tonemap_in[]= {
+static bNodeSocketTemplate cmp_node_tonemap_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_tonemap_out[]= {
+static bNodeSocketTemplate cmp_node_tonemap_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index 649902f..1c2963a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -35,13 +35,13 @@
 
 /* **************** Translate  ******************** */
 
-static bNodeSocketTemplate cmp_node_translate_in[]= {
+static bNodeSocketTemplate cmp_node_translate_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("X"),	0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Y"),	0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_translate_out[]= {
+static bNodeSocketTemplate cmp_node_translate_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 87a776c..5c11199 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -34,11 +34,11 @@
 
 
 /* **************** VALTORGB ******************** */
-static bNodeSocketTemplate cmp_node_valtorgb_in[]= {
+static bNodeSocketTemplate cmp_node_valtorgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_valtorgb_out[]= {
+static bNodeSocketTemplate cmp_node_valtorgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	SOCK_FLOAT, 0, N_("Alpha")},
 	{	-1, 0, ""	}
@@ -106,11 +106,11 @@ void register_node_type_cmp_valtorgb(bNodeTreeType *ttype)
 
 
 /* **************** RGBTOBW ******************** */
-static bNodeSocketTemplate cmp_node_rgbtobw_in[]= {
+static bNodeSocketTemplate cmp_node_rgbtobw_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_rgbtobw_out[]= {
+static bNodeSocketTemplate cmp_node_rgbtobw_out[] = {
 	{	SOCK_FLOAT, 0, N_("Val"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 63ab4fc..2c65fe6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -33,7 +33,7 @@
 #include "node_composite_util.h"
 
 /* **************** VALUE ******************** */
-static bNodeSocketTemplate cmp_node_value_out[]= {
+static bNodeSocketTemplate cmp_node_value_out[] = {
 	/* XXX value nodes use the output sockets for buttons, so we need explicit limits here! */
 	{	SOCK_FLOAT, 0, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
 	{	-1, 0, ""	}
@@ -56,7 +56,7 @@ static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack
 	bNodeSocket *sock= node->outputs.first;
 	float val= ((bNodeSocketValueFloat*)sock->default_value)->value;
 	
-	out[0]->vec[0]= val;
+	out[0]->vec[0] = val;
 }
 
 #endif  /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 6321b1d..1c27cc2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -62,7 +62,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 		ibuf = BKE_image_acquire_ibuf(ima, node->storage, &lock);
 		if (ibuf == NULL) {
 			printf("node_composit_exec_viewer error\n");
-			BKE_image_release_ibuf(ima, lock);
+			BKE_image_release_ibuf(ima, ibuf, lock);
 			return;
 		}
 		
@@ -112,7 +112,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 			free_compbuf(zbuf);
 		}
 
-		BKE_image_release_ibuf(ima, lock);
+		BKE_image_release_ibuf(ima, ibuf, lock);
 
 		generate_preview(data, node, cbuf);
 		free_compbuf(cbuf);
@@ -149,7 +149,7 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
 	node_type_exec(&ntype, node_composit_exec_viewer);
 #endif
 
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index 3decbe8..8e639aa 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -35,14 +35,14 @@
 
 /* **************** Z COMBINE ******************** */
 	/* lazy coder note: node->custom2 is abused to send signal */
-static bNodeSocketTemplate cmp_node_zcombine_in[]= {
+static bNodeSocketTemplate cmp_node_zcombine_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),		1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Z"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
 	{	SOCK_RGBA, 1, N_("Image"),		1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Z"),			1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate cmp_node_zcombine_out[]= {
+static bNodeSocketTemplate cmp_node_zcombine_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	SOCK_FLOAT, 0, N_("Z")},
 	{	-1, 0, ""	}
@@ -60,10 +60,10 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
 			// use alpha in combine operation
 			alpha= src1[3];
 			malpha= 1.0f - alpha;
-			out[0]= malpha*src2[0] + alpha*src1[0];
-			out[1]= malpha*src2[1] + alpha*src1[1];
-			out[2]= malpha*src2[2] + alpha*src1[2];
-			out[3]= malpha*src2[3] + alpha*src1[3];
+			out[0] = malpha*src2[0] + alpha*src1[0];
+			out[1] = malpha*src2[1] + alpha*src1[1];
+			out[2] = malpha*src2[2] + alpha*src1[2];
+			out[3] = malpha*src2[3] + alpha*src1[3];
 		}
 		else {
 			// do combination based solely on z value
@@ -75,10 +75,10 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
 			// use alpha in combine operation
 			alpha= src2[3];
 			malpha= 1.0f - alpha;
-			out[0]= malpha*src1[0] + alpha*src2[0];
-			out[1]= malpha*src1[1] + alpha*src2[1];
-			out[2]= malpha*src1[2] + alpha*src2[2];
-			out[3]= malpha*src1[3] + alpha*src2[3];
+			out[0] = malpha*src1[0] + alpha*src2[0];
+			out[1] = malpha*src1[1] + alpha*src2[1];
+			out[2] = malpha*src1[2] + alpha*src2[2];
+			out[3] = malpha*src1[3] + alpha*src2[3];
 		}
 		else {
 			// do combination based solely on z value
@@ -111,20 +111,20 @@ static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, f
 			malpha= 1.0f - alpha;
 		
 		
-			out[0]= malpha*col1[0] + alpha*col2[0];
-			out[1]= malpha*col1[1] + alpha*col2[1];
-			out[2]= malpha*col1[2] + alpha*col2[2];
-			out[3]= malpha*col1[3] + alpha*col2[3];
+			out[0] = malpha*col1[0] + alpha*col2[0];
+			out[1] = malpha*col1[1] + alpha*col2[1];
+			out[2] = malpha*col1[2] + alpha*col2[2];
+			out[3] = malpha*col1[3] + alpha*col2[3];
 		}
 		else {
 			alpha= col1[3];
 			malpha= 1.0f - alpha;
 		
 		
-			out[0]= malpha*col2[0] + alpha*col1[0];
-			out[1]= malpha*col2[1] + alpha*col1[1];
-			out[2]= malpha*col2[2] + alpha*col1[2];
-			out[3]= malpha*col2[3] + alpha*col1[3];
+			out[0] = malpha*col2[0] + alpha*col1[0];
+			out[1] = malpha*col2[1] + alpha*col1[1];
+			out[2] = malpha*col2[2] + alpha*col1[2];
+			out[3] = malpha*col2[3] + alpha*col1[3];
 		}
 	}
 	else {
@@ -132,10 +132,10 @@ static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, f
 		alpha = *acol;
 		malpha= 1.0f - alpha;
 		
-		out[0]= malpha*col1[0] + alpha*col2[0];
-		out[1]= malpha*col1[1] + alpha*col2[1];
-		out[2]= malpha*col1[2] + alpha*col2[2];
-		out[3]= malpha*col1[3] + alpha*col2[3];
+		out[0] = malpha*col1[0] + alpha*col2[0];
+		out[1] = malpha*col1[1] + alpha*col2[1];
+		out[2] = malpha*col1[2] + alpha*col2[2];
+		out[3] = malpha*col1[3] + alpha*col2[3];
 	}
 }
 
@@ -202,8 +202,8 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
 		aabuf= MEM_mallocN(cbuf->x*cbuf->y, "aa buf");
 		fp= mbuf->rect;
 		for (x= cbuf->x*cbuf->y-1; x>=0; x--)
-			if (fp[x]==0.0f) aabuf[x]= 0;
-			else aabuf[x]= 255;
+			if (fp[x]==0.0f) aabuf[x] = 0;
+			else aabuf[x] = 255;
 		
 		antialias_tagbuf(cbuf->x, cbuf->y, aabuf);
 		
@@ -211,7 +211,7 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
 		fp= mbuf->rect;
 		for (x= cbuf->x*cbuf->y-1; x>=0; x--)
 			if (aabuf[x]>1)
-				fp[x]= (1.0f/255.0f)*(float)aabuf[x];
+				fp[x] = (1.0f/255.0f)*(float)aabuf[x];
 		
 		composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[2]->data, in[2]->vec, mbuf, NULL, 
 								  do_zcombine_add, CB_RGBA, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 301dea2..86ef8a1 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -92,7 +92,7 @@ bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb
 	sock->new_sock = NULL;
 	
 	/* group sockets are dynamically added */
-	sock->flag |= SOCK_DYNAMIC;
+	sock->flag |= SOCK_DYNAMIC|SOCK_COLLAPSED;
 	
 	sock->own_index = gsock->own_index;
 	sock->groupsock = gsock;
@@ -115,7 +115,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type
 	BLI_strncpy(gsock->name, name, sizeof(gsock->name));
 	gsock->type = type;
 	/* group sockets are dynamically added */
-	gsock->flag |= SOCK_DYNAMIC;
+	gsock->flag |= SOCK_DYNAMIC|SOCK_COLLAPSED;
 
 	gsock->next = gsock->prev = NULL;
 	gsock->new_sock = NULL;
@@ -354,168 +354,6 @@ static void UNUSED_FUNCTION(node_group_link)(bNodeTree *ntree, bNodeSocket *sock
 	node_group_expose_socket(ntree, sock, in_out);
 }
 
-/**** For Loop ****/
-
-/* Essentially a group node with slightly different behavior.
- * The internal tree is executed several times, with each output being re-used
- * as an input in the next iteration. For this purpose, input and output socket
- * lists are kept identical!
- */
-
-bNodeTemplate node_forloop_template(bNode *node)
-{
-	bNodeTemplate ntemp;
-	ntemp.type = NODE_FORLOOP;
-	ntemp.ngroup = (bNodeTree*)node->id;
-	return ntemp;
-}
-
-void node_forloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
-{
-	bNodeSocket *sock;
-	
-	node->id = (ID*)ntemp->ngroup;
-	
-	sock = nodeAddSocket(ntree, node, SOCK_IN, "Iterations", SOCK_FLOAT);
-	node_socket_set_default_value_float(sock->default_value, PROP_UNSIGNED, 1, 0, 10000);
-	
-	/* NB: group socket input/output roles are inverted internally!
-	 * Group "inputs" work as outputs in links and vice versa.
-	 */
-	if (ntemp->ngroup) {
-		bNodeSocket *gsock;
-		for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
-			node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
-		for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
-			node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
-	}
-}
-
-void node_forloop_init_tree(bNodeTree *ntree)
-{
-	bNodeSocket *sock;
-	sock = node_group_add_socket(ntree, "Iteration", SOCK_FLOAT, SOCK_IN);
-	sock->flag |= SOCK_INTERNAL;
-}
-
-static void loop_sync(bNodeTree *ntree, int sync_in_out)
-{
-	bNodeSocket *sock, *sync, *nsync, *mirror;
-	ListBase *sync_lb;
-	
-	if (sync_in_out==SOCK_IN) {
-		sock = ntree->outputs.first;
-		
-		sync = ntree->inputs.first;
-		sync_lb = &ntree->inputs;
-	}
-	else {
-		sock = ntree->inputs.first;
-		
-		sync = ntree->outputs.first;
-		sync_lb = &ntree->outputs;
-	}
-	
-	/* NB: the sock->storage pointer is used here directly to store the own_index int
-	 * out the mirrored socket counterpart!
-	 */
-	
-	while (sock) {
-		/* skip static and internal sockets on the sync side (preserves socket order!) */
-		while (sync && ((sync->flag & SOCK_INTERNAL) || !(sync->flag & SOCK_DYNAMIC)))
-			sync = sync->next;
-		
-		if (sync && !(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) {
-			if (sock->storage==NULL) {
-				/* if mirror index is 0, the sockets is newly added and a new mirror must be created. */
-				mirror = node_group_expose_socket(ntree, sock, sync_in_out);
-				/* store the mirror index */
-				sock->storage = SET_INT_IN_POINTER(mirror->own_index);
-				mirror->storage = SET_INT_IN_POINTER(sock->own_index);
-				/* move mirror to the right place */
-				BLI_remlink(sync_lb, mirror);
-				if (sync)
-					BLI_insertlinkbefore(sync_lb, sync, mirror);
-				else
-					BLI_addtail(sync_lb, mirror);
-			}
-			else {
-				/* look up the mirror socket */
-				for (mirror=sync; mirror; mirror=mirror->next)
-					if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage))
-						break;
-				/* make sure the name is the same (only for identification by user, no deeper meaning) */
-				BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name));
-				/* fix the socket order if necessary */
-				if (mirror != sync) {
-					BLI_remlink(sync_lb, mirror);
-					BLI_insertlinkbefore(sync_lb, sync, mirror);
-				}
-				else
-					sync = sync->next;
-			}
-		}
-		
-		sock = sock->next;
-	}
-	
-	/* remaining sockets in sync_lb are leftovers from deleted sockets, remove them */
-	while (sync) {
-		nsync = sync->next;
-		if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC))
-			node_group_remove_socket(ntree, sync, sync_in_out);
-		sync = nsync;
-	}
-}
-
-void node_loop_update_tree(bNodeTree *ngroup)
-{
-	/* make sure inputs & outputs are identical */
-	if (ngroup->update & NTREE_UPDATE_GROUP_IN)
-		loop_sync(ngroup, SOCK_OUT);
-	if (ngroup->update & NTREE_UPDATE_GROUP_OUT)
-		loop_sync(ngroup, SOCK_IN);
-}
-
-void node_whileloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
-{
-	bNodeSocket *sock;
-	
-	node->id = (ID*)ntemp->ngroup;
-	
-	sock = nodeAddSocket(ntree, node, SOCK_IN, "Condition", SOCK_FLOAT);
-	node_socket_set_default_value_float(sock->default_value, PROP_NONE, 1, 0, 1);
-	
-	/* max iterations */
-	node->custom1 = 10000;
-	
-	/* NB: group socket input/output roles are inverted internally!
-	 * Group "inputs" work as outputs in links and vice versa.
-	 */
-	if (ntemp->ngroup) {
-		bNodeSocket *gsock;
-		for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
-			node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
-		for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
-			node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
-	}
-}
-
-void node_whileloop_init_tree(bNodeTree *ntree)
-{
-	bNodeSocket *sock;
-	sock = node_group_add_socket(ntree, "Condition", SOCK_FLOAT, SOCK_OUT);
-	sock->flag |= SOCK_INTERNAL;
-}
-
-bNodeTemplate node_whileloop_template(bNode *node)
-{
-	bNodeTemplate ntemp;
-	ntemp.type = NODE_WHILELOOP;
-	ntemp.ngroup = (bNodeTree*)node->id;
-	return ntemp;
-}
-
 /**** FRAME ****/
 
 static void node_frame_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
@@ -547,16 +385,13 @@ void register_node_type_frame(bNodeTreeType *ttype)
 /* **************** REROUTE ******************** */
 
 /* simple, only a single input and output here */
-static ListBase node_reroute_internal_connect(bNodeTree *ntree, bNode *node)
+static void node_reroute_update_internal_links(bNodeTree *ntree, bNode *node)
 {
 	bNodeLink *link;
-	ListBase ret;
-
-	ret.first = ret.last = NULL;
 
 	/* Security check! */
 	if (!ntree)
-		return ret;
+		return;
 
 	link = MEM_callocN(sizeof(bNodeLink), "internal node link");
 	link->fromnode = node;
@@ -565,9 +400,7 @@ static ListBase node_reroute_internal_connect(bNodeTree *ntree, bNode *node)
 	link->tosock = node->outputs.first;
 	/* internal link is always valid */
 	link->flag |= NODE_LINK_VALID;
-	BLI_addtail(&ret, link);
-
-	return ret;
+	BLI_addtail(&node->internal_links, link);
 }
 
 static void node_reroute_init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
@@ -586,7 +419,7 @@ void register_node_type_reroute(bNodeTreeType *ttype)
 	
 	node_type_base(ttype, ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT, 0);
 	node_type_init(ntype, node_reroute_init);
-	node_type_internal_connect(ntype, node_reroute_internal_connect);
+	node_type_internal_links(ntype, node_reroute_update_internal_links);
 	
 	ntype->needs_free = 1;
 	nodeRegisterType(ttype, ntype);
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index 00f7246..9e04a9e 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -38,18 +38,8 @@
 struct bNodeTree;
 
 void node_group_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-void node_forloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-void node_whileloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-
-void node_forloop_init_tree(struct bNodeTree *ntree);
-void node_whileloop_init_tree(struct bNodeTree *ntree);
-
 const char *node_group_label(struct bNode *node);
-
 struct bNodeTemplate node_group_template(struct bNode *node);
-struct bNodeTemplate node_forloop_template(struct bNode *node);
-struct bNodeTemplate node_whileloop_template(struct bNode *node);
-
 int node_group_valid(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 void node_group_verify(struct bNodeTree *ntree, struct bNode *node, struct ID *id);
 
@@ -57,8 +47,6 @@ struct bNodeTree *node_group_edit_get(struct bNode *node);
 struct bNodeTree *node_group_edit_set(struct bNode *node, int edit);
 void node_group_edit_clear(bNode *node);
 
-void node_loop_update_tree(struct bNodeTree *ngroup);
-
 void ntree_update_reroute_nodes(struct bNodeTree *ntree);
 
 #endif
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index d01ef2e..3cc7ebf 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -69,7 +69,7 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack
 	}
 }
 
-void node_init_input_index(bNodeSocket *sock, int *index)
+static void node_init_input_index(bNodeSocket *sock, int *index)
 {
 	if (sock->link && sock->link->fromsock) {
 		sock->stack_index = sock->link->fromsock->stack_index;
@@ -79,16 +79,31 @@ void node_init_input_index(bNodeSocket *sock, int *index)
 	}
 }
 
-void node_init_output_index(bNodeSocket *sock, int *index)
+static void node_init_output_index(bNodeSocket *sock, int *index, ListBase *internal_links)
 {
-	sock->stack_index = (*index)++;
+	if (internal_links) {
+		bNodeLink *link;
+		/* copy the stack index from internally connected input to skip the node */
+		for (link = internal_links->first; link; link = link->next) {
+			if (link->tosock == sock) {
+				sock->stack_index = link->fromsock->stack_index;
+				break;
+			}
+		}
+		/* if not internally connected, assign a new stack index anyway to avoid bad stack access */
+		if (!link)
+			sock->stack_index = (*index)++;
+	}
+	else {
+		sock->stack_index = (*index)++;
+	}
 }
 
 /* basic preparation of socket stacks */
 static struct bNodeStack *setup_stack(bNodeStack *stack, bNodeSocket *sock)
 {
 	bNodeStack *ns = node_get_socket_stack(stack, sock);
-	float null_value[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+	float null_value[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	
 	/* don't mess with remote socket stacks, these are initialized by other nodes! */
 	if (sock->link)
@@ -133,7 +148,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 	bNodeExec *nodeexec;
 	bNodeSocket *sock, *gsock;
 	bNodeStack *ns;
-	int index= 0;
+	int index;
 	bNode **nodelist;
 	int totnodes, n;
 	
@@ -148,10 +163,11 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 	/* backpointer to node tree */
 	exec->nodetree = ntree;
 	
+	/* set stack indices */
+	index = 0;
 	/* group inputs essentially work as outputs */
 	for (gsock=ntree->inputs.first; gsock; gsock = gsock->next)
-		node_init_output_index(gsock, &index);
-	/* set stack indexes */
+		node_init_output_index(gsock, &index, NULL);
 	for (n=0; n < totnodes; ++n) {
 		node = nodelist[n];
 		
@@ -160,8 +176,15 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 		/* init node socket stack indexes */
 		for (sock=node->inputs.first; sock; sock=sock->next)
 			node_init_input_index(sock, &index);
-		for (sock=node->outputs.first; sock; sock=sock->next)
-			node_init_output_index(sock, &index);
+		
+		if (node->flag & NODE_MUTED || node->type == NODE_REROUTE) {
+			for (sock=node->outputs.first; sock; sock=sock->next)
+				node_init_output_index(sock, &index, &node->internal_links);
+		}
+		else {
+			for (sock=node->outputs.first; sock; sock=sock->next)
+				node_init_output_index(sock, &index, NULL);
+		}
 	}
 	/* group outputs essentially work as inputs */
 	for (gsock=ntree->outputs.first; gsock; gsock = gsock->next)
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
index 1003206..e985795 100644
--- a/source/blender/nodes/intern/node_exec.h
+++ b/source/blender/nodes/intern/node_exec.h
@@ -73,8 +73,6 @@ typedef struct bNodeThreadStack {
 
 struct bNodeStack *node_get_socket_stack(struct bNodeStack *stack, struct bNodeSocket *sock);
 void node_get_stack(struct bNode *node, struct bNodeStack *stack, struct bNodeStack **in, struct bNodeStack **out);
-void node_init_input_index(struct bNodeSocket *sock, int *index);
-void node_init_output_index(struct bNodeSocket *sock, int *index);
 
 struct bNodeTreeExec *ntree_exec_begin(struct bNodeTree *ntree);
 void ntree_exec_end(struct bNodeTreeExec *exec);
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index 8b393dd..69256fa 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -41,6 +41,7 @@
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
+#include "BLI_string.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_node.h"
@@ -157,6 +158,20 @@ static bNodeSocketType node_socket_type_mesh = {
 	/* buttonfunc */		NULL,
 };
 
+/****************** STRING ******************/
+
+static bNodeSocketType node_socket_type_string = {
+	/* type */				SOCK_STRING,
+	/* ui_name */			"String",
+	/* ui_description */	"String",
+	/* ui_icon */			0,
+	/* ui_color */			{255, 255, 255, 255},
+	
+	/* value_structname */	"bNodeSocketValueString",
+	/* value_structsize */	sizeof(bNodeSocketValueString),
+	
+	/* buttonfunc */		NULL,
+};
 
 void node_socket_type_init(bNodeSocketType *types[])
 {
@@ -169,6 +184,7 @@ void node_socket_type_init(bNodeSocketType *types[])
 	INIT_TYPE(boolean);
 	INIT_TYPE(shader);
 	INIT_TYPE(mesh);
+	INIT_TYPE(string);
 	
 	#undef INIT_TYPE
 }
@@ -218,6 +234,9 @@ void node_socket_init_default_value(int type, void *default_value)
 	case SOCK_MESH:
 		node_socket_set_default_value_mesh(default_value);
 		break;
+	case SOCK_STRING:
+		node_socket_set_default_value_string(default_value, PROP_NONE, (char *)"");
+		break;
 	}
 }
 
@@ -265,6 +284,13 @@ void node_socket_set_default_value_rgba(void *default_value, float r, float g, f
 	val->value[3] = a;
 }
 
+void node_socket_set_default_value_string(void *default_value, PropertySubType subtype, const char *value)
+{
+	bNodeSocketValueString *val = default_value;
+	val->subtype = subtype;
+	BLI_strncpy(val->value, value, 1024);//FILE_MAX
+}
+
 void node_socket_set_default_value_shader(void *UNUSED(default_value))
 {
 }
@@ -282,12 +308,14 @@ void node_socket_copy_default_value(int type, void *to_default_value, void *from
 	bNodeSocketValueBoolean *frombool= (bNodeSocketValueBoolean*)from_default_value;
 	bNodeSocketValueVector *fromvector= (bNodeSocketValueVector*)from_default_value;
 	bNodeSocketValueRGBA *fromrgba= (bNodeSocketValueRGBA*)from_default_value;
+	bNodeSocketValueString *fromstring= (bNodeSocketValueString*)from_default_value;
 
 	bNodeSocketValueFloat *tofloat= (bNodeSocketValueFloat*)to_default_value;
 	bNodeSocketValueInt *toint= (bNodeSocketValueInt*)to_default_value;
 	bNodeSocketValueBoolean *tobool= (bNodeSocketValueBoolean*)to_default_value;
 	bNodeSocketValueVector *tovector= (bNodeSocketValueVector*)to_default_value;
 	bNodeSocketValueRGBA *torgba= (bNodeSocketValueRGBA*)to_default_value;
+	bNodeSocketValueString *tostring= (bNodeSocketValueString*)to_default_value;
 
 	switch (type) {
 	case SOCK_FLOAT:
@@ -305,6 +333,9 @@ void node_socket_copy_default_value(int type, void *to_default_value, void *from
 	case SOCK_RGBA:
 		*torgba = *fromrgba;
 		break;
+	case SOCK_STRING:
+		*tostring = *fromstring;
+		break;
 	}
 }
 
@@ -442,6 +473,35 @@ void node_socket_convert_default_value(int to_type, void *to_default_value, int
 	}
 }
 
+static void node_socket_set_minmax_subtype(bNodeSocket *sock, struct bNodeSocketTemplate *stemp)
+{
+	switch (sock->type) {
+		case SOCK_FLOAT:
+		{
+			bNodeSocketValueFloat *dval= sock->default_value;
+			dval->min = stemp->min;
+			dval->max = stemp->max;
+			dval->subtype = stemp->subtype;
+			break;
+		}
+		case SOCK_INT:
+		{
+			bNodeSocketValueInt *dval= sock->default_value;
+			dval->min = stemp->min;
+			dval->max = stemp->max;
+			dval->subtype = stemp->subtype;
+			break;
+		}
+		case SOCK_VECTOR:
+		{
+			bNodeSocketValueVector *dval= sock->default_value;
+			dval->min = stemp->min;
+			dval->max = stemp->max;
+			dval->subtype = stemp->subtype;
+			break;
+		}
+	}
+}
 
 struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp)
 {
@@ -470,6 +530,9 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct
 	case SOCK_MESH:
 		node_socket_set_default_value_mesh(sock->default_value);
 		break;
+	case SOCK_STRING:
+		node_socket_set_default_value_string(sock->default_value, stemp->subtype, (char *)"");
+		break;
 	}
 	
 	return sock;
@@ -478,6 +541,7 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct
 struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp)
 {
 	bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_OUT, stemp->name, stemp->type);
+	node_socket_set_minmax_subtype(sock, stemp);
 	return sock;
 }
 
@@ -490,40 +554,15 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
 			break;
 	}
 	if (sock) {
-		sock->type= stemp->type;		/* in future, read this from tydefs! */
-		if (stemp->limit==0) sock->limit= 0xFFF;
-		else sock->limit= stemp->limit;
+		sock->type = stemp->type;  /* in future, read this from tydefs! */
+		if (stemp->limit == 0) sock->limit= 0xFFF;
+		else sock->limit = stemp->limit;
 		sock->flag |= stemp->flag;
 		
 		/* Copy the property range and subtype parameters in case the template changed.
 		 * NOT copying the actual value here, only button behavior changes!
 		 */
-		switch (sock->type) {
-		case SOCK_FLOAT:
-			{
-				bNodeSocketValueFloat *dval= sock->default_value;
-				dval->min = stemp->min;
-				dval->max = stemp->max;
-				dval->subtype = stemp->subtype;
-			}
-			break;
-		case SOCK_INT:
-			{
-				bNodeSocketValueInt *dval= sock->default_value;
-				dval->min = stemp->min;
-				dval->max = stemp->max;
-				dval->subtype = stemp->subtype;
-			}
-			break;
-		case SOCK_VECTOR:
-			{
-				bNodeSocketValueVector *dval= sock->default_value;
-				dval->min = stemp->min;
-				dval->max = stemp->max;
-				dval->subtype = stemp->subtype;
-			}
-			break;
-		}
+		node_socket_set_minmax_subtype(sock, stemp);
 		
 		BLI_remlink(socklist, sock);
 		
@@ -600,7 +639,9 @@ void node_verify_socket_templates(bNodeTree *ntree, bNode *node)
 	 * This also prevents group node sockets from being removed, without the need to explicitly
 	 * check the node type here.
 	 */
-	if (ntype && ((ntype->inputs && ntype->inputs[0].type>=0) || (ntype->outputs && ntype->outputs[0].type>=0))) {
+	if (ntype && ((ntype->inputs && ntype->inputs[0].type >= 0) ||
+	              (ntype->outputs && ntype->outputs[0].type >= 0)))
+	{
 		verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs);
 		verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs);
 	}
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 27258c4..09e6ddd 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -65,12 +65,12 @@ void node_free_standard_storage(bNode *node)
 
 void node_copy_curves(bNode *orig_node, bNode *new_node)
 {
-	new_node->storage= curvemapping_copy(orig_node->storage);
+	new_node->storage = curvemapping_copy(orig_node->storage);
 }
 
 void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
 {
-	new_node->storage= MEM_dupallocN(orig_node->storage);
+	new_node->storage = MEM_dupallocN(orig_node->storage);
 }
 
 void *node_initexec_curves(bNode *node)
@@ -109,18 +109,15 @@ const char *node_filter_label(bNode *node)
 	return IFACE_(name);
 }
 
-ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
+void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
 {
-	ListBase ret;
 	bNodeSocket *fromsock_first=NULL, *tosock_first=NULL;	/* used for fallback link if no other reconnections are found */
 	int datatype;
 	int num_links_in = 0, num_links_out = 0, num_reconnect = 0;
 
-	ret.first = ret.last = NULL;
-
 	/* Security check! */
 	if (!ntree)
-		return ret;
+		return;
 
 	for (datatype=0; datatype < NUM_SOCKET_TYPES; ++datatype) {
 		bNodeSocket *fromsock, *tosock;
@@ -170,7 +167,7 @@ ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
 				ilink->tosock = tosock;
 				/* internal link is always valid */
 				ilink->flag |= NODE_LINK_VALID;
-				BLI_addtail(&ret, ilink);
+				BLI_addtail(&node->internal_links, ilink);
 				
 				++num_reconnect;
 			}
@@ -188,8 +185,6 @@ ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
 		ilink->tosock = tosock_first;
 		/* internal link is always valid */
 		ilink->flag |= NODE_LINK_VALID;
-		BLI_addtail(&ret, ilink);
+		BLI_addtail(&node->internal_links, ilink);
 	}
-	
-	return ret;
 }
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 95104df..3134baa 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -62,7 +62,7 @@ const char *node_math_label(struct bNode *node);
 const char *node_vect_math_label(struct bNode *node);
 const char *node_filter_label(struct bNode *node);
 
-ListBase node_internal_connect_default(struct bNodeTree *ntree, struct bNode *node);
+void node_update_internal_links_default(struct bNodeTree *ntree, struct bNode *node);
 
 #endif
 
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index ad907c3..b7dc83d 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -87,10 +87,11 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f
 		func(calldata, NODE_CLASS_SHADER, N_("Shader"));
 		func(calldata, NODE_CLASS_TEXTURE, N_("Texture"));
 	}
-
+	
 	func(calldata, NODE_CLASS_OP_COLOR, N_("Color"));
 	func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector"));
 	func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
+	func(calldata, NODE_CLASS_SCRIPT, N_("Script"));
 	func(calldata, NODE_CLASS_GROUP, N_("Group"));
 	func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
 }
@@ -153,7 +154,7 @@ bNodeTreeType ntreeType_Shader = {
 	/* update */			update,
 	/* update_node */		NULL,
 	/* validate_link */		NULL,
-	/* internal_connect */	node_internal_connect_default
+	/* update_internal_links */	node_update_internal_links_default
 };
 
 /* GPU material from shader nodes */
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 56704b9..6130fe7 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -50,9 +50,9 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
 	}
 	else if (type_in==SOCK_VECTOR) {
 		if (ns->sockettype==SOCK_FLOAT) {
-			in[0]= from[0];
-			in[1]= from[0];
-			in[2]= from[0];
+			in[0] = from[0];
+			in[1] = from[0];
+			in[2] = from[0];
 		}
 		else {
 			copy_v3_v3(in, from);
@@ -63,14 +63,14 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
 			copy_v4_v4(in, from);
 		}
 		else if (ns->sockettype==SOCK_FLOAT) {
-			in[0]= from[0];
-			in[1]= from[0];
-			in[2]= from[0];
-			in[3]= 1.0f;
+			in[0] = from[0];
+			in[1] = from[0];
+			in[2] = from[0];
+			in[3] = 1.0f;
 		}
 		else {
 			copy_v3_v3(in, from);
-			in[3]= 1.0f;
+			in[3] = 1.0f;
 		}
 	}
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c
index ee8513a..ec868b2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c
+++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c
@@ -29,13 +29,13 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_add_shader_in[]= {
+static bNodeSocketTemplate sh_node_add_shader_in[] = {
 	{	SOCK_SHADER, 1, N_("Shader")},
 	{	SOCK_SHADER, 1, N_("Shader")},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_add_shader_out[]= {
+static bNodeSocketTemplate sh_node_add_shader_out[] = {
 	{	SOCK_SHADER, 0, N_("Shader")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
new file mode 100644
index 0000000..7dfefc9
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
@@ -0,0 +1,63 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = {
+	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+
+static bNodeSocketTemplate sh_node_ambient_occlusion_out[] = {
+	{	SOCK_SHADER, 0, N_("AO")},
+	{	-1, 0, ""	}
+};
+
+static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+	return GPU_stack_link(mat, "node_ambient_occlusion", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+}
+
+/* node type definition */
+void register_node_type_sh_ambient_occlusion(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_SHADER, 0);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_socket_templates(&ntype, sh_node_ambient_occlusion_in, sh_node_ambient_occlusion_out);
+	node_type_size(&ntype, 150, 60, 200);
+	node_type_init(&ntype, NULL);
+	node_type_storage(&ntype, "", NULL, NULL);
+	node_type_exec(&ntype, NULL);
+	node_type_gpu(&ntype, node_shader_gpu_ambient_occlusion);
+
+	nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c
index 9c65323..9b2ed2f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.c
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_attribute_out[]= {
+static bNodeSocketTemplate sh_node_attribute_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	SOCK_VECTOR, 0, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c
index 7d13c35..d82c513 100644
--- a/source/blender/nodes/shader/nodes/node_shader_background.c
+++ b/source/blender/nodes/shader/nodes/node_shader_background.c
@@ -29,13 +29,13 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_background_in[]= {
+static bNodeSocketTemplate sh_node_background_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Strength"),	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_background_out[]= {
+static bNodeSocketTemplate sh_node_background_out[] = {
 	{	SOCK_SHADER, 0, N_("Background")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
index 2735553..9c23a29 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.c
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -31,14 +31,14 @@
 
 /* **************** Brigh and contrsast  ******************** */
 
-static bNodeSocketTemplate sh_node_brightcontrast_in[]= {
+static bNodeSocketTemplate sh_node_brightcontrast_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Bright"),		0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Contrast"),		0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_brightcontrast_out[]= {
+static bNodeSocketTemplate sh_node_brightcontrast_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
index 9157728..71780e9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
@@ -29,21 +29,27 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, N_("Roughness U"),	0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, N_("Roughness V"),	0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_FLOAT, 1, N_("Roughness"),	    0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_FLOAT, 1, N_("Anisotropy"),	0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f},
+	{	SOCK_FLOAT, 1, N_("Rotation"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),		0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
+	{	SOCK_VECTOR, 1, N_("Tangent"),		0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
+	if (!in[3].link)
+		in[3].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out);
 }
 
 /* node type definition */
@@ -51,7 +57,7 @@ void register_node_type_sh_bsdf_anisotropic(bNodeTreeType *ttype)
 {
 	static bNodeType ntype;
 
-	node_type_base(ttype, &ntype, SH_NODE_BSDF_ANISOTROPIC, "Glossy Anisotropic BSDF", NODE_CLASS_SHADER, 0);
+	node_type_base(ttype, &ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER, 0);
 	node_type_compatibility(&ntype, NODE_NEW_SHADING);
 	node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out);
 	node_type_size(&ntype, 150, 60, 200);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
index d2e2db3..ad9f197 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
@@ -29,20 +29,24 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_diffuse_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Roughness"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_diffuse_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_diffuse_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+	if (!in[2].link)
+		in[2].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_diffuse", in, out);
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
index 8ff0ad5..9e18809 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
@@ -29,21 +29,25 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_glass_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_glass_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Roughness"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("IOR"),		1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_glass_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_glass_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	return GPU_stack_link(mat, "node_bsdf_glass", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
+	if (!in[3].link)
+		in[3].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_glass", in, out);
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
index d28b345..5e32930 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
@@ -29,21 +29,24 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_glossy_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = {
 	{	SOCK_RGBA,  1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Roughness"),	0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_glossy_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_glossy_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	/* todo: is incoming vector normalized? */
-	return GPU_stack_link(mat, "node_bsdf_glossy", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
+	if (!in[2].link)
+		in[2].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_glossy", in, out);
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
new file mode 100644
index 0000000..99e66e3
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
@@ -0,0 +1,68 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = {
+	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+	{	SOCK_FLOAT, 1, N_("Roughness"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_FLOAT, 1, N_("IOR"),		1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
+	{	-1, 0, ""	}
+};
+
+static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = {
+	{	SOCK_SHADER, 0, N_("BSDF")},
+	{	-1, 0, ""	}
+};
+
+static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+	if (!in[3].link)
+		in[3].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_refraction", in, out);
+}
+
+/* node type definition */
+void register_node_type_sh_bsdf_refraction(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER, NODE_OPTIONS);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_socket_templates(&ntype, sh_node_bsdf_refraction_in, sh_node_bsdf_refraction_out);
+	node_type_size(&ntype, 150, 60, 200);
+	node_type_init(&ntype, NULL);
+	node_type_storage(&ntype, "", NULL, NULL);
+	node_type_exec(&ntype, NULL);
+	node_type_gpu(&ntype, node_shader_gpu_bsdf_refraction);
+
+	nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
index a3ba3ac..3c70848 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
@@ -29,19 +29,23 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_translucent_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_translucent_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_translucent_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	return GPU_stack_link(mat, "node_bsdf_translucent", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+	if (!in[1].link)
+		in[1].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_translucent", in, out);
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
index 8c945ab..7fb452a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
@@ -29,12 +29,12 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_transparent_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_transparent_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_transparent_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
index 04a1c1b..a4d25d4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
@@ -29,20 +29,24 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_bsdf_velvet_in[]= {
+static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Sigma"),		1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_bsdf_velvet_out[]= {
+static bNodeSocketTemplate sh_node_bsdf_velvet_out[] = {
 	{	SOCK_SHADER, 0, N_("BSDF")},
 	{	-1, 0, ""	}
 };
 
 static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
 {
-	return GPU_stack_link(mat, "node_bsdf_velvet", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+	if (!in[2].link)
+		in[2].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+	return GPU_stack_link(mat, "node_bsdf_velvet", in, out);
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c
new file mode 100644
index 0000000..b0605f9
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_bump.c
@@ -0,0 +1,68 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/shader/nodes/node_shader_bump.c
+ *  \ingroup shdnodes
+ */
+
+
+
+#include "node_shader_util.h"
+
+
+/* **************** BUMP ******************** */ 
+static bNodeSocketTemplate sh_node_bump_in[] = {
+	{ SOCK_FLOAT, 1, "Strength",	0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
+	{ SOCK_FLOAT, 1, "Height",		1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
+	{ -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_bump_out[] = {
+	{	SOCK_VECTOR, 0, "Normal"},
+	{ -1, 0, "" }
+};
+
+static int gpu_shader_bump(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+	return GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+}
+
+/* node type definition */
+void register_node_type_sh_bump(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_socket_templates(&ntype, sh_node_bump_in, sh_node_bump_out);
+	node_type_size(&ntype, 150, 60, 200);
+	node_type_storage(&ntype, "BumpNode", node_free_standard_storage, node_copy_standard_storage);
+	node_type_exec(&ntype, NULL);
+	node_type_gpu(&ntype, gpu_shader_bump);
+
+	nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 17cec81..fd36a94 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -33,7 +33,7 @@
 #include "node_shader_util.h"
 
 /* **************** CAMERA INFO  ******************** */
-static bNodeSocketTemplate sh_node_camera_out[]= {
+static bNodeSocketTemplate sh_node_camera_out[] = {
 	{	SOCK_VECTOR, 0, N_("View Vector")},
 	{	SOCK_FLOAT, 0, N_("View Z Depth")},
 	{	SOCK_FLOAT, 0, N_("View Distance")},
@@ -47,8 +47,8 @@ static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;  /* Data we need for shading. */
 		
 		copy_v3_v3(out[0]->vec, shi->co);		/* get view vector */
-		out[1]->vec[0]= fabs(shi->co[2]);		/* get view z-depth */
-		out[2]->vec[0]= normalize_v3(out[0]->vec);	/* get view distance */
+		out[1]->vec[0] = fabs(shi->co[2]);		/* get view z-depth */
+		out[2]->vec[0] = normalize_v3(out[0]->vec);	/* get view distance */
 	}
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index df36948..688d77d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -204,128 +204,3 @@ void register_node_type_sh_group(bNodeTreeType *ttype)
 	
 	nodeRegisterType(ttype, &ntype);
 }
-
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-	bNodeThreadStack *nts;
-	int iterations= (int)in[0]->vec[0];
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	nts = ntreeGetThreadStack(exec, thread);
-	
-	/* "Iteration" socket */
-	sock = exec->nodetree->inputs.first;
-	ns = node_get_socket_stack(nts->stack, sock);
-	
-//	group_copy_inputs(node, in, nts->stack);
-	for (iteration=0; iteration < iterations; ++iteration) {
-		/* first input contains current iteration counter */
-		ns->vec[0] = (float)iteration;
-		ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
-		
-//		if (iteration > 0)
-//			loop_init_iteration(exec->nodetree, nts->stack);
-//		ntreeExecThreadNodes(exec, nts, data, thread);
-	}
-//	loop_copy_outputs(node, in, out, exec->stack);
-	
-	ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_sh_forloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_forloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_forloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-	bNodeThreadStack *nts;
-	int condition= (in[0]->vec[0] > 0.0f);
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	nts = ntreeGetThreadStack(exec, thread);
-	
-	/* "Condition" socket */
-	sock = exec->nodetree->outputs.first;
-	ns = node_get_socket_stack(nts->stack, sock);
-	
-	iteration = 0;
-//	group_copy_inputs(node, in, nts->stack);
-	while (condition && iteration < node->custom1) {
-//		if (iteration > 0)
-//			loop_init_iteration(exec->nodetree, nts->stack);
-//		ntreeExecThreadNodes(exec, nts, data, thread);
-		
-		condition = (ns->vec[0] > 0.0f);
-		++iteration;
-	}
-//	loop_copy_outputs(node, in, out, exec->stack);
-	
-	ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_sh_whileloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_whileloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_whileloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index 83cb1d3..9fa654c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -34,13 +34,13 @@
 
 
 /* **************** CURVE VEC  ******************** */
-static bNodeSocketTemplate sh_node_curve_vec_in[]= {
+static bNodeSocketTemplate sh_node_curve_vec_in[] = {
 	{	SOCK_FLOAT, 0, N_("Fac"),	1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_VECTOR, 1, N_("Vector"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_curve_vec_out[]= {
+static bNodeSocketTemplate sh_node_curve_vec_out[] = {
 	{	SOCK_VECTOR, 0, N_("Vector")},
 	{	-1, 0, ""	}
 };
@@ -88,13 +88,13 @@ void register_node_type_sh_curve_vec(bNodeTreeType *ttype)
 
 
 /* **************** CURVE RGB  ******************** */
-static bNodeSocketTemplate sh_node_curve_rgb_in[]= {
+static bNodeSocketTemplate sh_node_curve_rgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),	1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Color"),	0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_curve_rgb_out[]= {
+static bNodeSocketTemplate sh_node_curve_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c
index 4854d88..0c4cb7e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_emission.c
+++ b/source/blender/nodes/shader/nodes/node_shader_emission.c
@@ -29,13 +29,13 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_emission_in[]= {
+static bNodeSocketTemplate sh_node_emission_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Strength"),	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_emission_out[]= {
+static bNodeSocketTemplate sh_node_emission_out[] = {
 	{	SOCK_SHADER, 0, N_("Emission")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
index 610a214..80913e6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c
+++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
@@ -28,12 +28,12 @@
 #include "../node_shader_util.h"
 
 /* **************** Fresnel ******************** */
-static bNodeSocketTemplate sh_node_fresnel_in[]= {
+static bNodeSocketTemplate sh_node_fresnel_in[] = {
 	{	SOCK_FLOAT, 1, N_("IOR"),	1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_fresnel_out[]= {
+static bNodeSocketTemplate sh_node_fresnel_out[] = {
 	{	SOCK_FLOAT, 0, N_("Fac"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
index 526868f..c49554c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.c
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -30,13 +30,13 @@
 
 /* **************** Gamma Tools  ******************** */
   
-static bNodeSocketTemplate sh_node_gamma_in[]= {
+static bNodeSocketTemplate sh_node_gamma_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),			1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Gamma"),			1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_gamma_out[]= {
+static bNodeSocketTemplate sh_node_gamma_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index f23158a..eb3d462 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -37,7 +37,7 @@
 /* **************** GEOMETRY  ******************** */
 
 /* output socket type definition */
-static bNodeSocketTemplate sh_node_geom_out[]= {
+static bNodeSocketTemplate sh_node_geom_out[] = {
 	{	SOCK_VECTOR, 0, N_("Global")},
 	{	SOCK_VECTOR, 0, N_("Local")},
 	{	SOCK_VECTOR, 0, N_("View")},
@@ -92,12 +92,12 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
 			}
 
 			copy_v3_v3(out[GEOM_OUT_VCOL]->vec, scol->col);
-			out[GEOM_OUT_VCOL]->vec[3]= scol->col[3];
-			out[GEOM_OUT_VCOL_ALPHA]->vec[0]= scol->col[3];
+			out[GEOM_OUT_VCOL]->vec[3] = scol->col[3];
+			out[GEOM_OUT_VCOL_ALPHA]->vec[0] = scol->col[3];
 		}
 		else {
 			memcpy(out[GEOM_OUT_VCOL]->vec, defaultvcol, sizeof(defaultvcol));
-			out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f;
+			out[GEOM_OUT_VCOL_ALPHA]->vec[0] = 1.0f;
 		}
 		
 		if (shi->osatex) {
@@ -116,7 +116,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
 		}
 		
 		/* front/back, normal flipping was stored */
-		out[GEOM_OUT_FRONTBACK]->vec[0]= (shi->flippednor)? 0.0f: 1.0f;
+		out[GEOM_OUT_FRONTBACK]->vec[0] = (shi->flippednor)? 0.0f: 1.0f;
 	}
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c
index 2ebd932..acef885 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geometry.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_geometry_out[]= {
+static bNodeSocketTemplate sh_node_geometry_out[] = {
 	{	SOCK_VECTOR, 0, N_("Position"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_VECTOR, 0, N_("Normal"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_VECTOR, 0, N_("Tangent"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c
index dbd4ed8..18ad499 100644
--- a/source/blender/nodes/shader/nodes/node_shader_holdout.c
+++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c
@@ -29,11 +29,11 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_holdout_in[]= {
+static bNodeSocketTemplate sh_node_holdout_in[] = {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_holdout_out[]= {
+static bNodeSocketTemplate sh_node_holdout_out[] = {
 	{	SOCK_SHADER, 0, N_("Holdout")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index b07650e..b635ad1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -34,7 +34,7 @@
 
 
 /* **************** Hue Saturation ******************** */
-static bNodeSocketTemplate sh_node_hue_sat_in[]= {
+static bNodeSocketTemplate sh_node_hue_sat_in[] = {
 	{	SOCK_FLOAT, 1, N_("Hue"),			0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Saturation"),		1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
 	{	SOCK_FLOAT, 1, N_("Value"),			1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_hue_sat_in[]= {
 	{	SOCK_RGBA, 1, N_("Color"),			0.8f, 0.8f, 0.8f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_hue_sat_out[]= {
+static bNodeSocketTemplate sh_node_hue_sat_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
@@ -60,9 +60,9 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *s
 		hsv[2]*= *val;
 		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
 		
-		out[0]= mfac*in[0] + *fac*col[0];
-		out[1]= mfac*in[1] + *fac*col[1];
-		out[2]= mfac*in[2] + *fac*col[2];
+		out[0] = mfac*in[0] + *fac*col[0];
+		out[1] = mfac*in[1] + *fac*col[1];
+		out[2] = mfac*in[2] + *fac*col[2];
 	}
 	else {
 		copy_v4_v4(out, in);
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c
index ef592a7..2ea858f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.c
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.c
@@ -35,15 +35,15 @@
 
 
 /* **************** INVERT ******************** */ 
-static bNodeSocketTemplate sh_node_invert_in[]= { 
-	{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, 
-	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_invert_in[] = {
+	{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate sh_node_invert_out[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_invert_out[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
 static void node_shader_exec_invert(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, 
diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
index 6eacea1..3058483 100644
--- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
+++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
@@ -29,12 +29,12 @@
 
 /* **************** Layer Weight ******************** */
 
-static bNodeSocketTemplate sh_node_layer_weight_in[]= {
+static bNodeSocketTemplate sh_node_layer_weight_in[] = {
 	{	SOCK_FLOAT, 1, N_("Blend"),		0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_layer_weight_out[]= {
+static bNodeSocketTemplate sh_node_layer_weight_out[] = {
 	{	SOCK_FLOAT, 0, N_("Fresnel"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Facing"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
index aab5fa8..2dec244 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
+++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
@@ -29,7 +29,7 @@
 
 /* **************** INPUT ********************* */
 
-static bNodeSocketTemplate sh_node_light_falloff_in[]= {
+static bNodeSocketTemplate sh_node_light_falloff_in[] = {
 	{	SOCK_FLOAT, 0, N_("Strength"),			100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
 	{	SOCK_FLOAT, 0, N_("Smooth"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
 	{	-1, 0, ""	}
@@ -37,7 +37,7 @@ static bNodeSocketTemplate sh_node_light_falloff_in[]= {
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_light_falloff_out[]= {
+static bNodeSocketTemplate sh_node_light_falloff_out[] = {
 	{	SOCK_FLOAT, 0, N_("Quadratic"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Linear"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Constant"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c
index 264b139..b4a3d4e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_path.c
+++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_light_path_out[]= {
+static bNodeSocketTemplate sh_node_light_path_out[] = {
 	{	SOCK_FLOAT, 0, N_("Is Camera Ray"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Is Shadow Ray"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Is Diffuse Ray"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index 4508f66..cedd3a4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -33,12 +33,12 @@
 #include "node_shader_util.h"
 
 /* **************** MAPPING  ******************** */
-static bNodeSocketTemplate sh_node_mapping_in[]= {
+static bNodeSocketTemplate sh_node_mapping_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_mapping_out[]= {
+static bNodeSocketTemplate sh_node_mapping_out[] = {
 	{	SOCK_VECTOR, 0, N_("Vector")},
 	{	-1, 0, ""	}
 };
@@ -55,14 +55,14 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
 	mul_m4_v3(texmap->mat, vec);
 	
 	if (texmap->flag & TEXMAP_CLIP_MIN) {
-		if (vec[0]<texmap->min[0]) vec[0]= texmap->min[0];
-		if (vec[1]<texmap->min[1]) vec[1]= texmap->min[1];
-		if (vec[2]<texmap->min[2]) vec[2]= texmap->min[2];
+		if (vec[0]<texmap->min[0]) vec[0] = texmap->min[0];
+		if (vec[1]<texmap->min[1]) vec[1] = texmap->min[1];
+		if (vec[2]<texmap->min[2]) vec[2] = texmap->min[2];
 	}
 	if (texmap->flag & TEXMAP_CLIP_MAX) {
-		if (vec[0]>texmap->max[0]) vec[0]= texmap->max[0];
-		if (vec[1]>texmap->max[1]) vec[1]= texmap->max[1];
-		if (vec[2]>texmap->max[2]) vec[2]= texmap->max[2];
+		if (vec[0]>texmap->max[0]) vec[0] = texmap->max[0];
+		if (vec[1]>texmap->max[1]) vec[1] = texmap->max[1];
+		if (vec[2]>texmap->max[2]) vec[2] = texmap->max[2];
 	}
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index 57865e0..2902bf1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -34,7 +34,7 @@
 
 /* **************** MATERIAL ******************** */
 
-static bNodeSocketTemplate sh_node_material_in[]= {
+static bNodeSocketTemplate sh_node_material_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_material_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_material_out[]= {
+static bNodeSocketTemplate sh_node_material_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	SOCK_FLOAT, 0, N_("Alpha")},
 	{	SOCK_VECTOR, 0, N_("Normal")},
@@ -51,7 +51,7 @@ static bNodeSocketTemplate sh_node_material_out[]= {
 
 /* **************** EXTENDED MATERIAL ******************** */
 
-static bNodeSocketTemplate sh_node_material_ext_in[]= {
+static bNodeSocketTemplate sh_node_material_ext_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
@@ -66,7 +66,7 @@ static bNodeSocketTemplate sh_node_material_ext_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_material_ext_out[]= {
+static bNodeSocketTemplate sh_node_material_ext_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	SOCK_FLOAT, 0, N_("Alpha")},
 	{	SOCK_VECTOR, 0, N_("Normal")},
@@ -84,8 +84,8 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 		ShaderCallData *shcd= data;
 		float col[4];
 		bNodeSocket *sock;
-		char hasinput[NUM_MAT_IN]= {'\0'};
-		int i;
+		char hasinput[NUM_MAT_IN] = {'\0'};
+		int i, mode;
 		
 		/* note: cannot use the in[]->hasinput flags directly, as these are not necessarily
 		 * the constant input stack values (e.g. in case material node is inside a group).
@@ -139,13 +139,21 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 			if (hasinput[MAT_IN_ALPHA])
 				nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]);
 			if (hasinput[MAT_IN_TRANSLUCENCY])
-				nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);			
+				nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);
 		}
 		
+		/* make alpha output give results even if transparency is only enabled on
+		 * the material linked in this not and not on the parent material */
+		mode = shi->mode;
+		if(shi->mat->mode & MA_TRANSP)
+			shi->mode |= MA_TRANSP;
+
 		shi->nodes= 1; /* temp hack to prevent trashadow recursion */
 		node_shader_lamp_loop(shi, &shrnode);	/* clears shrnode */
 		shi->nodes= 0;
 		
+		shi->mode = mode;
+
 		/* write to outputs */
 		if (node->custom1 & SH_NODE_MAT_DIFF) {
 			copy_v3_v3(col, shrnode.combined);
@@ -157,20 +165,20 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 			copy_v3_v3(col, shrnode.spec);
 		}
 		else
-			col[0]= col[1]= col[2]= 0.0f;
+			col[0] = col[1] = col[2] = 0.0f;
 		
-		col[3]= shrnode.alpha;
+		col[3] = shrnode.alpha;
 		
 		if (shi->do_preview)
 			nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
 		
 		copy_v3_v3(out[MAT_OUT_COLOR]->vec, col);
-		out[MAT_OUT_ALPHA]->vec[0]= shrnode.alpha;
+		out[MAT_OUT_ALPHA]->vec[0] = shrnode.alpha;
 		
 		if (node->custom1 & SH_NODE_MAT_NEG) {
-			shi->vn[0]= -shi->vn[0];
-			shi->vn[1]= -shi->vn[1];
-			shi->vn[2]= -shi->vn[2];
+			shi->vn[0] = -shi->vn[0];
+			shi->vn[1] = -shi->vn[1];
+			shi->vn[2] = -shi->vn[2];
 		}
 		
 		copy_v3_v3(out[MAT_OUT_NORMAL]->vec, shi->vn);
@@ -222,7 +230,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
 		GPUShadeInput shi;
 		GPUShadeResult shr;
 		bNodeSocket *sock;
-		char hasinput[NUM_MAT_IN]= {'\0'};
+		char hasinput[NUM_MAT_IN] = {'\0'};
 		int i;
 		
 		/* note: cannot use the in[]->hasinput flags directly, as these are not necessarily
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index c112ae1..0b71a3f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -34,61 +34,61 @@
 
 
 /* **************** SCALAR MATH ******************** */ 
-static bNodeSocketTemplate sh_node_math_in[]= { 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_math_in[] = {
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate sh_node_math_out[]= { 
-	{ SOCK_FLOAT, 0, N_("Value")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_math_out[] = {
+	{ SOCK_FLOAT, 0, N_("Value")},
+	{ -1, 0, "" }
 };
 
 static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, 
 bNodeStack **out) 
 {
-	switch (node->custom1) { 
+	switch (node->custom1) {
 	
 	case 0: /* Add */
-		out[0]->vec[0]= in[0]->vec[0] + in[1]->vec[0]; 
+		out[0]->vec[0] = in[0]->vec[0] + in[1]->vec[0];
 		break; 
 	case 1: /* Subtract */
-		out[0]->vec[0]= in[0]->vec[0] - in[1]->vec[0];
+		out[0]->vec[0] = in[0]->vec[0] - in[1]->vec[0];
 		break; 
 	case 2: /* Multiply */
-		out[0]->vec[0]= in[0]->vec[0] * in[1]->vec[0]; 
+		out[0]->vec[0] = in[0]->vec[0] * in[1]->vec[0];
 		break; 
 	case 3: /* Divide */
 		{
 			if (in[1]->vec[0]==0)	/* We don't want to divide by zero. */
-				out[0]->vec[0]= 0.0;
+				out[0]->vec[0] = 0.0;
 			else
-				out[0]->vec[0]= in[0]->vec[0] / in[1]->vec[0];
+				out[0]->vec[0] = in[0]->vec[0] / in[1]->vec[0];
 			}
 		break;
 	case 4: /* Sine */
 		{
 			if (in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */
-				out[0]->vec[0]= sin(in[0]->vec[0]);
+				out[0]->vec[0] = sin(in[0]->vec[0]);
 			else
-				out[0]->vec[0]= sin(in[1]->vec[0]);
+				out[0]->vec[0] = sin(in[1]->vec[0]);
 		}
 		break;
 	case 5: /* Cosine */
 		{
-			if (in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */	
-				out[0]->vec[0]= cos(in[0]->vec[0]);
+			if (in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */
+				out[0]->vec[0] = cos(in[0]->vec[0]);
 			else
-				out[0]->vec[0]= cos(in[1]->vec[0]);
+				out[0]->vec[0] = cos(in[1]->vec[0]);
 		}
 		break;
 	case 6: /* Tangent */
 		{
-			if (in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */	
-				out[0]->vec[0]= tan(in[0]->vec[0]);
+			if (in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */
+				out[0]->vec[0] = tan(in[0]->vec[0]);
 			else
-				out[0]->vec[0]= tan(in[1]->vec[0]);
+				out[0]->vec[0] = tan(in[1]->vec[0]);
 		}
 		break;
 	case 7: /* Arc-Sine */
@@ -96,16 +96,16 @@ bNodeStack **out)
 			if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
 				/* Can't do the impossible... */
 				if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
-					out[0]->vec[0]= asin(in[0]->vec[0]);
+					out[0]->vec[0] = asin(in[0]->vec[0]);
 				else
-					out[0]->vec[0]= 0.0;
+					out[0]->vec[0] = 0.0;
 			}
 			else {
 				/* Can't do the impossible... */
 				if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
-					out[0]->vec[0]= asin(in[1]->vec[0]);
+					out[0]->vec[0] = asin(in[1]->vec[0]);
 				else
-					out[0]->vec[0]= 0.0;
+					out[0]->vec[0] = 0.0;
 			}
 		}
 		break;
@@ -114,86 +114,97 @@ bNodeStack **out)
 			if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
 				/* Can't do the impossible... */
 				if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
-					out[0]->vec[0]= acos(in[0]->vec[0]);
+					out[0]->vec[0] = acos(in[0]->vec[0]);
 				else
-					out[0]->vec[0]= 0.0;
+					out[0]->vec[0] = 0.0;
 			}
 			else {
 				/* Can't do the impossible... */
 				if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
-					out[0]->vec[0]= acos(in[1]->vec[0]);
+					out[0]->vec[0] = acos(in[1]->vec[0]);
 				else
-					out[0]->vec[0]= 0.0;
+					out[0]->vec[0] = 0.0;
 			}
 		}
 		break;
 	case 9: /* Arc-Tangent */
 		{
 			if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
-				out[0]->vec[0]= atan(in[0]->vec[0]);
+				out[0]->vec[0] = atan(in[0]->vec[0]);
 			else
-				out[0]->vec[0]= atan(in[1]->vec[0]);
+				out[0]->vec[0] = atan(in[1]->vec[0]);
 		}
 		break;
 	case 10: /* Power */
 		{
-			/* Don't want any imaginary numbers... */
-			if ( in[0]->vec[0] >= 0 )
-				out[0]->vec[0]= pow(in[0]->vec[0], in[1]->vec[0]);
-			else
-				out[0]->vec[0]= 0.0;
+			/* Only raise negative numbers by full integers */
+			if ( in[0]->vec[0] >= 0 ) {
+				out[0]->vec[0] = pow(in[0]->vec[0], in[1]->vec[0]);
+			}
+			else {
+				float y_mod_1 = fabsf(fmodf(in[1]->vec[0], 1.0f));
+				
+				/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
+				if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
+					out[0]->vec[0] = powf(in[0]->vec[0], floorf(in[1]->vec[0] + 0.5f));
+				}
+				else {
+					out[0]->vec[0] = 0.0f;
+				}
+			}
+
 		}
 		break;
 	case 11: /* Logarithm */
 		{
 			/* Don't want any imaginary numbers... */
 			if ( in[0]->vec[0] > 0  && in[1]->vec[0] > 0 )
-				out[0]->vec[0]= log(in[0]->vec[0]) / log(in[1]->vec[0]);
+				out[0]->vec[0] = log(in[0]->vec[0]) / log(in[1]->vec[0]);
 			else
-				out[0]->vec[0]= 0.0;
+				out[0]->vec[0] = 0.0;
 		}
 		break;
 	case 12: /* Minimum */
 		{
 			if ( in[0]->vec[0] < in[1]->vec[0] )
-				out[0]->vec[0]= in[0]->vec[0];
+				out[0]->vec[0] = in[0]->vec[0];
 			else
-				out[0]->vec[0]= in[1]->vec[0];
+				out[0]->vec[0] = in[1]->vec[0];
 		}
 		break;
 	case 13: /* Maximum */
 		{
 			if ( in[0]->vec[0] > in[1]->vec[0] )
-				out[0]->vec[0]= in[0]->vec[0];
+				out[0]->vec[0] = in[0]->vec[0];
 			else
-				out[0]->vec[0]= in[1]->vec[0];
+				out[0]->vec[0] = in[1]->vec[0];
 		}
 		break;
 	case 14: /* Round */
 		{
 			if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
-				out[0]->vec[0]= (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f);
+				out[0]->vec[0] = (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f);
 			else
-				out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
+				out[0]->vec[0] = (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
 		}
 		break;
 	case 15: /* Less Than */
 		{
 			if ( in[0]->vec[0] < in[1]->vec[0] )
-				out[0]->vec[0]= 1.0f;
+				out[0]->vec[0] = 1.0f;
 			else
-				out[0]->vec[0]= 0.0f;
+				out[0]->vec[0] = 0.0f;
 		}
 		break;
 	case 16: /* Greater Than */
 		{
 			if ( in[0]->vec[0] > in[1]->vec[0] )
-				out[0]->vec[0]= 1.0f;
+				out[0]->vec[0] = 1.0f;
 			else
-				out[0]->vec[0]= 0.0f;
+				out[0]->vec[0] = 0.0f;
 		}
 		break;
-	} 
+	}
 }
 
 static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
@@ -214,8 +225,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
 		case 13:
 		case 15:
 		case 16:
-			GPU_stack_link(mat, names[node->custom1], NULL, out,
-				GPU_socket(&in[0]), GPU_socket(&in[1]));
+			GPU_stack_link(mat, names[node->custom1], in, out);
 			break;
 		case 4:
 		case 5:
@@ -224,10 +234,20 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
 		case 8:
 		case 9:
 		case 14:
-			if (in[0].hasinput || !in[1].hasinput)
-				GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
-			else
-				GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+			if (in[0].hasinput || !in[1].hasinput) {
+				/* use only first item and terminator */
+				GPUNodeStack tmp_in[2];
+				memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack));
+				memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+				GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+			}
+			else {
+				/* use only second item and terminator */
+				GPUNodeStack tmp_in[2];
+				memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack));
+				memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+				GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+			}
 			break;
 		default:
 			return 0;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 53c1387..18dcc8f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -33,13 +33,13 @@
 #include "node_shader_util.h"
 
 /* **************** MIX RGB ******************** */
-static bNodeSocketTemplate sh_node_mix_rgb_in[]= {
+static bNodeSocketTemplate sh_node_mix_rgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	SOCK_RGBA, 1, N_("Color1"),			0.5f, 0.5f, 0.5f, 1.0f},
 	{	SOCK_RGBA, 1, N_("Color2"),			0.5f, 0.5f, 0.5f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_mix_rgb_out[]= {
+static bNodeSocketTemplate sh_node_mix_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
index 80ee1a8..039e63a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
@@ -29,14 +29,14 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_mix_shader_in[]= {
+static bNodeSocketTemplate sh_node_mix_shader_in[] = {
 	{	SOCK_FLOAT,  1, N_("Fac"),		0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_SHADER, 1, N_("Shader")},
 	{	SOCK_SHADER, 1, N_("Shader")},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_mix_shader_out[]= {
+static bNodeSocketTemplate sh_node_mix_shader_out[] = {
 	{	SOCK_SHADER, 0, N_("Shader")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index bb0a854..0ad58d6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -33,13 +33,13 @@
 #include "node_shader_util.h"
 
 /* **************** NORMAL  ******************** */
-static bNodeSocketTemplate sh_node_normal_in[]= {
-	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
+static bNodeSocketTemplate sh_node_normal_in[] = {
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_normal_out[]= {
-	{	SOCK_VECTOR, 0, N_("Normal")},
+static bNodeSocketTemplate sh_node_normal_out[] = {
+	{	SOCK_VECTOR, 0, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
 	{	SOCK_FLOAT, 0, N_("Dot")},
 	{	-1, 0, ""	}
 };
@@ -68,7 +68,7 @@ static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack
 	
 	copy_v3_v3(out[0]->vec, ((bNodeSocketValueVector*)sock->default_value)->value);
 	/* render normals point inside... the widget points outside */
-	out[1]->vec[0]= -dot_v3v3(out[0]->vec, vec);
+	out[1]->vec[0] = -dot_v3v3(out[0]->vec, vec);
 }
 
 static int gpu_shader_normal(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
new file mode 100644
index 0000000..6a4eb9d
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -0,0 +1,70 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_normal_map_in[] = {
+	{   SOCK_FLOAT, 1, N_("Strength"),	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
+	{	SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+
+static bNodeSocketTemplate sh_node_normal_map_out[] = {
+	{	SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+
+static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+	NodeShaderNormalMap *attr = MEM_callocN(sizeof(NodeShaderNormalMap), "NodeShaderNormalMap");
+	node->storage = attr;
+}
+
+static int gpu_shader_normal_map(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+	return GPU_stack_link(mat, "node_normal_map", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+}
+
+/* node type definition */
+void register_node_type_sh_normal_map(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_socket_templates(&ntype, sh_node_normal_map_in, sh_node_normal_map_out);
+	node_type_size(&ntype, 250, 60, 250);
+	node_type_init(&ntype, node_shader_init_normal_map);
+	node_type_storage(&ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage);
+	node_type_exec(&ntype, NULL);
+	node_type_gpu(&ntype, gpu_shader_normal_map);
+
+	nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c
index 1cafa01..ef28300 100644
--- a/source/blender/nodes/shader/nodes/node_shader_object_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_object_info_out[]= {
+static bNodeSocketTemplate sh_node_object_info_out[] = {
 	{	SOCK_VECTOR, 0, N_("Location"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT,  0, N_("Object Index"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT,  0, N_("Material Index"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index 4434054..6f7f900 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -33,7 +33,7 @@
 #include "node_shader_util.h"
 
 /* **************** OUTPUT ******************** */
-static bNodeSocketTemplate sh_node_output_in[]= {
+static bNodeSocketTemplate sh_node_output_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Alpha"),		1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
@@ -62,7 +62,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
 			
 			//	copy_v3_v3(shr->nor, in[3]->vec);
 		}
-	}	
+	}
 }
 
 static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
@@ -92,7 +92,7 @@ void register_node_type_sh_output(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, gpu_shader_output);
 
 	/* Do not allow muting output node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
index eb72083..ce406a8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_output_lamp_in[]= {
+static bNodeSocketTemplate sh_node_output_lamp_in[] = {
 	{	SOCK_SHADER, 1, N_("Surface"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
@@ -49,7 +49,7 @@ void register_node_type_sh_output_lamp(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, NULL);
 
 	/* Do not allow muting output node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c
index e81744c..f185e13 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_output_material_in[]= {
+static bNodeSocketTemplate sh_node_output_material_in[] = {
 	{	SOCK_SHADER, 1, N_("Surface")},
 	{	SOCK_SHADER, 1, N_("Volume")},
 	{	SOCK_FLOAT, 1, N_("Displacement"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
@@ -62,7 +62,7 @@ void register_node_type_sh_output_material(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, node_shader_gpu_output_material);
 
 	/* Do not allow muting output node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c
index 3a931c2..953197a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_world.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_output_world_in[]= {
+static bNodeSocketTemplate sh_node_output_world_in[] = {
 	{	SOCK_SHADER, 1, N_("Surface"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_SHADER, 1, N_("Volume"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
@@ -50,7 +50,7 @@ void register_node_type_sh_output_world(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, NULL);
 
 	/* Do not allow muting output node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
index ddfcb94..c7e31d1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
@@ -28,18 +28,18 @@
 #include "../node_shader_util.h"
 
 static bNodeSocketTemplate outputs[] = {
-    { SOCK_FLOAT,  0, "Index" },
-    { SOCK_FLOAT,  0, "Age" },
-    { SOCK_FLOAT,  0, "Lifetime" },
-    { SOCK_VECTOR,  0, "Location" },
-    #if 0	/* quaternion sockets not yet supported */
-    { SOCK_QUATERNION,  0, "Rotation" },
-    #endif
-    { SOCK_FLOAT,  0, "Size" },
-    { SOCK_VECTOR,  0, "Velocity" },
-    { SOCK_VECTOR,  0, "Angular Velocity" },
-    { -1, 0, "" }
-};
+	{ SOCK_FLOAT,  0, "Index" },
+	{ SOCK_FLOAT,  0, "Age" },
+	{ SOCK_FLOAT,  0, "Lifetime" },
+	{ SOCK_VECTOR,  0, "Location" },
+#if 0	/* quaternion sockets not yet supported */
+	{ SOCK_QUATERNION,  0, "Rotation" },
+#endif
+	{ SOCK_FLOAT,  0, "Size" },
+	{ SOCK_VECTOR,  0, "Velocity" },
+	{ SOCK_VECTOR,  0, "Angular Velocity" },
+	{ -1, 0, "" }
+	};
 
 /* node type definition */
 void register_node_type_sh_particle_info(bNodeTreeType *ttype)
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c
index 5a19c61..f37ff1d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c
@@ -33,7 +33,7 @@
 #include "node_shader_util.h"
 
 /* **************** RGB ******************** */
-static bNodeSocketTemplate sh_node_rgb_out[]= {
+static bNodeSocketTemplate sh_node_rgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_script.c b/source/blender/nodes/shader/nodes/node_shader_script.c
new file mode 100644
index 0000000..b556365
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_script.c
@@ -0,0 +1,86 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/shader/nodes/node_shader_script.c
+ *  \ingroup shdnodes
+ */
+
+#include "BKE_idprop.h"
+
+#include "node_shader_util.h"
+
+/* **************** Script ******************** */
+
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+	NodeShaderScript *nss = MEM_callocN(sizeof(NodeShaderScript), "shader script node");
+	node->storage = nss;
+}
+
+static void node_free_script(bNode *node)
+{
+	NodeShaderScript *nss = node->storage;
+
+	if (nss) {
+		if (nss->bytecode) {
+			MEM_freeN(nss->bytecode);
+		}
+
+		if (nss->prop) {
+			IDP_FreeProperty(nss->prop);
+			MEM_freeN(nss->prop);
+		}
+
+		MEM_freeN(nss);
+	}
+}
+
+static void node_copy_script(bNode *orig_node, bNode *new_node)
+{
+	NodeShaderScript *orig_nss = orig_node->storage;
+	NodeShaderScript *new_nss = MEM_dupallocN(orig_nss);
+
+	if (orig_nss->bytecode)
+		new_nss->bytecode = MEM_dupallocN(orig_nss->bytecode);
+
+	if (orig_nss->prop)
+		new_nss->prop = IDP_CopyProperty(orig_nss->prop);
+
+	new_node->storage = new_nss;
+}
+
+void register_node_type_sh_script(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT, NODE_OPTIONS);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_init(&ntype, init);
+	node_type_storage(&ntype, "NodeShaderScript", node_free_script, node_copy_script);
+
+	nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
index 55f37b6..70fba16 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
@@ -33,11 +33,11 @@
 #include "node_shader_util.h"
 
 /* **************** SEPARATE RGBA ******************** */
-static bNodeSocketTemplate sh_node_seprgb_in[]= {
+static bNodeSocketTemplate sh_node_seprgb_in[] = {
 	{	SOCK_RGBA, 1, N_("Image"),			0.8f, 0.8f, 0.8f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_seprgb_out[]= {
+static bNodeSocketTemplate sh_node_seprgb_out[] = {
 	{	SOCK_FLOAT, 0, N_("R")},
 	{	SOCK_FLOAT, 0, N_("G")},
 	{	SOCK_FLOAT, 0, N_("B")},
@@ -73,13 +73,13 @@ void register_node_type_sh_seprgb(bNodeTreeType *ttype)
 
 
 /* **************** COMBINE RGB ******************** */
-static bNodeSocketTemplate sh_node_combrgb_in[]= {
+static bNodeSocketTemplate sh_node_combrgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("R"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
 	{	SOCK_FLOAT, 1, N_("G"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
 	{	SOCK_FLOAT, 1, N_("B"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_combrgb_out[]= {
+static bNodeSocketTemplate sh_node_combrgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Image")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
index adab396..8073f4b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_squeeze.c
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
@@ -33,20 +33,19 @@
 #include "node_shader_util.h"
 
 /* **************** VALUE SQUEEZE ******************** */ 
-static bNodeSocketTemplate sh_node_squeeze_in[]= { 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, N_("Center"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_squeeze_in[] = {
+	{ SOCK_FLOAT, 1, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+	{ SOCK_FLOAT, 1, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+	{ SOCK_FLOAT, 1, N_("Center"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate sh_node_squeeze_out[]= { 
-	{ SOCK_FLOAT, 0, N_("Value")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_squeeze_out[] = {
+	{ SOCK_FLOAT, 0, N_("Value")},
+	{ -1, 0, "" }
 };
 
-static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, 
-bNodeStack **out) 
+static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
 {
 	float vec[3];
 	
@@ -54,7 +53,7 @@ bNodeStack **out)
 	nodestack_get_vec(vec+1, SOCK_FLOAT, in[1]);
 	nodestack_get_vec(vec+2, SOCK_FLOAT, in[2]);
 
-	out[0]->vec[0] = 1.0f / (1.0f + pow(M_E, -((vec[0] - vec[2]) * vec[1])));
+	out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1])));
 }
 
 static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.c b/source/blender/nodes/shader/nodes/node_shader_tangent.c
new file mode 100644
index 0000000..6c0d6d7
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_tangent.c
@@ -0,0 +1,60 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_tangent_out[] = {
+	{	SOCK_VECTOR, 0, N_("Tangent"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	-1, 0, ""	}
+};
+
+static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+	NodeShaderTangent *attr = MEM_callocN(sizeof(NodeShaderTangent), "NodeShaderTangent");
+	attr->axis = SHD_TANGENT_AXIS_Z;
+	node->storage = attr;
+}
+
+/* node type definition */
+void register_node_type_sh_tangent(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;
+
+	node_type_base(ttype, &ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, NODE_OPTIONS);
+	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+	node_type_socket_templates(&ntype, NULL, sh_node_tangent_out);
+	node_type_size(&ntype, 150, 60, 200);
+	node_type_init(&ntype, node_shader_init_tangent);
+	node_type_storage(&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage);
+	node_type_exec(&ntype, NULL);
+	node_type_gpu(&ntype, NULL);
+
+	nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
index 11f7fb9..66bf026 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_brick_in[]= {
+static bNodeSocketTemplate sh_node_tex_brick_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{ 	SOCK_RGBA, 1, 	N_("Color1"), 		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{ 	SOCK_RGBA, 1, 	N_("Color2"), 		0.2f, 0.2f, 0.2f, 1.0f, 0.0f, 1.0f},
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_tex_brick_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_brick_out[]= {
+static bNodeSocketTemplate sh_node_tex_brick_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
index 0c1e7dc..8a2ae2d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -29,7 +29,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_checker_in[]= {
+static bNodeSocketTemplate sh_node_tex_checker_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{ 	SOCK_RGBA, 1, 	N_("Color1"), 		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{ 	SOCK_RGBA, 1, 	N_("Color2"), 		0.2f, 0.2f, 0.2f, 1.0f, 0.0f, 1.0f},
@@ -37,7 +37,7 @@ static bNodeSocketTemplate sh_node_tex_checker_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_checker_out[]= {
+static bNodeSocketTemplate sh_node_tex_checker_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
index 62b1cab..dd71787 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
@@ -31,7 +31,7 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_coord_out[]= {
+static bNodeSocketTemplate sh_node_tex_coord_out[] = {
 	{	SOCK_VECTOR, 0, N_("Generated"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_VECTOR, 0, N_("Normal"),			0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_VECTOR, 0, N_("UV"),				0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index ace0f0c..d2d0870 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -27,14 +27,16 @@
 
 #include "../node_shader_util.h"
 
+#include "IMB_colormanagement.h"
+
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_environment_in[]= {
+static bNodeSocketTemplate sh_node_tex_environment_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_environment_out[]= {
+static bNodeSocketTemplate sh_node_tex_environment_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
@@ -59,7 +61,8 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
 	Image *ima= (Image*)node->id;
 	ImageUser *iuser= NULL;
 	NodeTexImage *tex = node->storage;
-	int ncd = tex->color_space == SHD_COLORSPACE_NONE;
+	int isdata = tex->color_space == SHD_COLORSPACE_NONE;
+	int ret;
 
 	if (!ima)
 		return GPU_stack_link(mat, "node_tex_environment_empty", in, out);
@@ -69,10 +72,19 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
 
-	if (out[0].link && GPU_material_do_color_management(mat))
-		GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+	ret = GPU_stack_link(mat, "node_tex_environment", in, out, GPU_image(ima, iuser, isdata));
+
+	if (ret) {
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
+		if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 &&
+		    GPU_material_do_color_management(mat))
+		{
+			GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+		}
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+	}
 
-	return GPU_stack_link(mat, "node_tex_environment", in, out, GPU_image(ima, iuser, ncd));
+	return ret;
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
index a7f8691..0802ecd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -29,12 +29,12 @@
 
 /* **************** BLEND ******************** */
 
-static bNodeSocketTemplate sh_node_tex_gradient_in[]= {
+static bNodeSocketTemplate sh_node_tex_gradient_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_gradient_out[]= {
+static bNodeSocketTemplate sh_node_tex_gradient_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index d6c7572..49b3843 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -27,14 +27,16 @@
 
 #include "../node_shader_util.h"
 
+#include "IMB_colormanagement.h"
+
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_image_in[]= {
+static bNodeSocketTemplate sh_node_tex_image_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_image_out[]= {
+static bNodeSocketTemplate sh_node_tex_image_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Alpha"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
@@ -59,7 +61,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
 	Image *ima= (Image*)node->id;
 	ImageUser *iuser= NULL;
 	NodeTexImage *tex = node->storage;
-	int ncd = tex->color_space == SHD_COLORSPACE_NONE;
+	int isdata = tex->color_space == SHD_COLORSPACE_NONE;
+	int ret;
 
 	if (!ima)
 		return GPU_stack_link(mat, "node_tex_image_empty", in, out);
@@ -69,10 +72,19 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
 
-	if (out[0].link && GPU_material_do_color_management(mat))
-		GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+	ret = GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, isdata));
+
+	if (ret) {
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
+		if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 &&
+		    GPU_material_do_color_management(mat))
+		{
+			GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+		}
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+	}
 
-	return GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, ncd));
+	return ret;
 }
 
 /* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
index b9f1b5c..86feabb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -29,14 +29,14 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_magic_in[]= {
+static bNodeSocketTemplate sh_node_tex_magic_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	SOCK_FLOAT, 1, N_("Scale"),			5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	SOCK_FLOAT, 1, N_("Distortion"),	1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_magic_out[]= {
+static bNodeSocketTemplate sh_node_tex_magic_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
index 60b4f65..cd4b574 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -29,7 +29,7 @@
 
 /* **************** MUSGRAVE ******************** */
 
-static bNodeSocketTemplate sh_node_tex_musgrave_in[]= {
+static bNodeSocketTemplate sh_node_tex_musgrave_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	SOCK_FLOAT, 1, N_("Scale"),			5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	SOCK_FLOAT, 1, N_("Detail"),		2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f},
@@ -40,7 +40,7 @@ static bNodeSocketTemplate sh_node_tex_musgrave_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_musgrave_out[]= {
+static bNodeSocketTemplate sh_node_tex_musgrave_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
index bd04930..18788f9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -29,7 +29,7 @@
 
 /* **************** NOISE ******************** */
 
-static bNodeSocketTemplate sh_node_tex_noise_in[]= {
+static bNodeSocketTemplate sh_node_tex_noise_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),    0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	SOCK_FLOAT, 1, N_("Scale"),      5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	SOCK_FLOAT, 1, N_("Detail"),     2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f},
@@ -37,7 +37,7 @@ static bNodeSocketTemplate sh_node_tex_noise_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_noise_out[]= {
+static bNodeSocketTemplate sh_node_tex_noise_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
index 977d689..7a1b853 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -29,12 +29,12 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_tex_sky_in[]= {
+static bNodeSocketTemplate sh_node_tex_sky_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_sky_out[]= {
+static bNodeSocketTemplate sh_node_tex_sky_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
index 22baa38..d4cc246 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -29,13 +29,13 @@
 
 /* **************** VORONOI ******************** */
 
-static bNodeSocketTemplate sh_node_tex_voronoi_in[]= {
+static bNodeSocketTemplate sh_node_tex_voronoi_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	SOCK_FLOAT, 1, N_("Scale"),			5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_voronoi_out[]= {
+static bNodeSocketTemplate sh_node_tex_voronoi_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
index 8a09952..8b23de0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -29,7 +29,7 @@
 
 /* **************** WAVE ******************** */
 
-static bNodeSocketTemplate sh_node_tex_wave_in[]= {
+static bNodeSocketTemplate sh_node_tex_wave_in[] = {
 	{	SOCK_VECTOR, 1, N_("Vector"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
 	{	SOCK_FLOAT, 1, N_("Scale"),			5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
 	{	SOCK_FLOAT, 1, N_("Distortion"),	0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
@@ -38,7 +38,7 @@ static bNodeSocketTemplate sh_node_tex_wave_in[]= {
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_tex_wave_out[]= {
+static bNodeSocketTemplate sh_node_tex_wave_out[] = {
 	{	SOCK_RGBA, 0, N_("Color"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 0, N_("Fac"),		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 73c3b84..b77c7d0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -32,14 +32,16 @@
 
 #include "DNA_texture_types.h"
 
+#include "IMB_colormanagement.h"
+
 #include "node_shader_util.h"
 
 /* **************** TEXTURE ******************** */
-static bNodeSocketTemplate sh_node_texture_in[]= {
+static bNodeSocketTemplate sh_node_texture_in[] = {
 	{	SOCK_VECTOR, 1, "Vector",	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},	/* no limit */
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_texture_out[]= {
+static bNodeSocketTemplate sh_node_texture_out[] = {
 	{	SOCK_FLOAT, 0, N_("Value")},
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	SOCK_VECTOR, 0, N_("Normal")},
@@ -52,7 +54,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;
 		TexResult texres;
 		bNodeSocket *sock_vector= node->inputs.first;
-		float vec[3], nor[3]={0.0f, 0.0f, 0.0f};
+		float vec[3], nor[3] = {0.0f, 0.0f, 0.0f};
 		int retval;
 		short which_output = node->custom1;
 		
@@ -76,8 +78,8 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 				float *fp= in[0]->data;
 				float dxt[3], dyt[3];
 				
-				dxt[0]= fp[0]; dxt[1]= dxt[2]= 0.0f;
-				dyt[0]= fp[1]; dyt[1]= dyt[2]= 0.0f;
+				dxt[0] = fp[0]; dxt[1] = dxt[2] = 0.0f;
+				dyt[0] = fp[1]; dyt[1] = dyt[2] = 0.0f;
 				retval= multitex_nodes((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres, thread, which_output, NULL, NULL);
 			}
 			else
@@ -96,9 +98,9 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 		
 		/* intensity and color need some handling */
 		if (texres.talpha)
-			out[0]->vec[0]= texres.ta;
+			out[0]->vec[0] = texres.ta;
 		else
-			out[0]->vec[0]= texres.tin;
+			out[0]->vec[0] = texres.tin;
 		
 		if ((retval & TEX_RGB) == 0) {
 			copy_v3_fl(out[1]->vec, out[0]->vec[0]);
@@ -122,8 +124,20 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G
 	Tex *tex = (Tex*)node->id;
 
 	if (tex && tex->type == TEX_IMAGE && tex->ima) {
-		GPUNodeLink *texlink = GPU_image(tex->ima, NULL, FALSE);
-		return GPU_stack_link(mat, "texture_image", in, out, texlink);
+		GPUNodeLink *texlink = GPU_image(tex->ima, &tex->iuser, FALSE);
+		int ret = GPU_stack_link(mat, "texture_image", in, out, texlink);
+
+		if (ret) {
+			ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
+			if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) ==0 &&
+			    GPU_material_do_color_management(mat))
+			{
+				GPU_link(mat, "srgb_to_linearrgb", out[1].link, &out[1].link);
+			}
+			BKE_image_release_ibuf(tex->ima, ibuf, NULL);
+		}
+
+		return ret;
 	}
 	else
 		return 0;
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index d309420..182487d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -33,11 +33,11 @@
 #include "node_shader_util.h"
 
 /* **************** VALTORGB ******************** */
-static bNodeSocketTemplate sh_node_valtorgb_in[]= {
+static bNodeSocketTemplate sh_node_valtorgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_valtorgb_out[]= {
+static bNodeSocketTemplate sh_node_valtorgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	SOCK_FLOAT, 0, N_("Alpha")},
 	{	-1, 0, ""	}
@@ -53,7 +53,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
 		nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
 
 		do_colorband(node->storage, fac, out[0]->vec);
-		out[1]->vec[0]= out[0]->vec[3];
+		out[1]->vec[0] = out[0]->vec[3];
 	}
 }
 
@@ -89,11 +89,11 @@ void register_node_type_sh_valtorgb(bNodeTreeType *ttype)
 
 
 /* **************** RGBTOBW ******************** */
-static bNodeSocketTemplate sh_node_rgbtobw_in[]= {
+static bNodeSocketTemplate sh_node_rgbtobw_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),			0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate sh_node_rgbtobw_out[]= {
+static bNodeSocketTemplate sh_node_rgbtobw_out[] = {
 	{	SOCK_FLOAT, 0, N_("Val"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c
index 8a6c3c8..a3d1e5a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.c
+++ b/source/blender/nodes/shader/nodes/node_shader_value.c
@@ -33,7 +33,7 @@
 #include "node_shader_util.h"
 
 /* **************** VALUE ******************** */
-static bNodeSocketTemplate sh_node_value_out[]= {
+static bNodeSocketTemplate sh_node_value_out[] = {
 	/* XXX value nodes use the output sockets for buttons, so we need explicit limits here! */
 	{	SOCK_FLOAT, 0, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
 	{	-1, 0, ""	}
@@ -54,7 +54,7 @@ static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack *
 	bNodeSocket *sock= node->outputs.first;
 	float val= ((bNodeSocketValueFloat*)sock->default_value)->value;
 	
-	out[0]->vec[0]= val;
+	out[0]->vec[0] = val;
 }
 
 static int gpu_shader_value(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 007366c..3e00421 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -35,16 +35,16 @@
 
 
 /* **************** VECTOR MATH ******************** */ 
-static bNodeSocketTemplate sh_node_vect_math_in[]= { 
-        { SOCK_VECTOR, 1, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
-        { SOCK_VECTOR, 1, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
-	{ -1, 0, "" } 
+static bNodeSocketTemplate sh_node_vect_math_in[] = {
+	{ SOCK_VECTOR, 1, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ SOCK_VECTOR, 1, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate sh_node_vect_math_out[]= {
-	{ SOCK_VECTOR, 0, N_("Vector")}, 
+static bNodeSocketTemplate sh_node_vect_math_out[] = {
+	{ SOCK_VECTOR, 0, N_("Vector")},
 	{ SOCK_FLOAT, 0, N_("Value")},
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
 static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) 
@@ -55,46 +55,46 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
 	nodestack_get_vec(vec2, SOCK_VECTOR, in[1]);
 	
 	if (node->custom1 == 0) {	/* Add */
-		out[0]->vec[0]= vec1[0] + vec2[0];
-		out[0]->vec[1]= vec1[1] + vec2[1];
-		out[0]->vec[2]= vec1[2] + vec2[2];
+		out[0]->vec[0] = vec1[0] + vec2[0];
+		out[0]->vec[1] = vec1[1] + vec2[1];
+		out[0]->vec[2] = vec1[2] + vec2[2];
 		
-		out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
+		out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
 	}
 	else if (node->custom1 == 1) {	/* Subtract */
-		out[0]->vec[0]= vec1[0] - vec2[0];
-		out[0]->vec[1]= vec1[1] - vec2[1];
-		out[0]->vec[2]= vec1[2] - vec2[2];
+		out[0]->vec[0] = vec1[0] - vec2[0];
+		out[0]->vec[1] = vec1[1] - vec2[1];
+		out[0]->vec[2] = vec1[2] - vec2[2];
 		
-		out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
+		out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3;
 	}
 	else if (node->custom1 == 2) {	/* Average */
-		out[0]->vec[0]= vec1[0] + vec2[0];
-		out[0]->vec[1]= vec1[1] + vec2[1];
-		out[0]->vec[2]= vec1[2] + vec2[2];
+		out[0]->vec[0] = vec1[0] + vec2[0];
+		out[0]->vec[1] = vec1[1] + vec2[1];
+		out[0]->vec[2] = vec1[2] + vec2[2];
 		
 		out[1]->vec[0] = normalize_v3(out[0]->vec );
 	}
 	else if (node->custom1 == 3) {	/* Dot product */
-		out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
+		out[1]->vec[0] = (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
 	}
 	else if (node->custom1 == 4) {	/* Cross product */
-		out[0]->vec[0]= (vec1[1] * vec2[2]) - (vec1[2] * vec2[1]);
-		out[0]->vec[1]= (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
-		out[0]->vec[2]= (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
+		out[0]->vec[0] = (vec1[1] * vec2[2]) - (vec1[2] * vec2[1]);
+		out[0]->vec[1] = (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
+		out[0]->vec[2] = (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
 		
 		out[1]->vec[0] = normalize_v3(out[0]->vec );
 	}
 	else if (node->custom1 == 5) {	/* Normalize */
 		if (in[0]->hasinput || !in[1]->hasinput) {	/* This one only takes one input, so we've got to choose. */
-			out[0]->vec[0]= vec1[0];
-			out[0]->vec[1]= vec1[1];
-			out[0]->vec[2]= vec1[2];
+			out[0]->vec[0] = vec1[0];
+			out[0]->vec[1] = vec1[1];
+			out[0]->vec[2] = vec1[2];
 		}
 		else {
-			out[0]->vec[0]= vec2[0];
-			out[0]->vec[1]= vec2[1];
-			out[0]->vec[2]= vec2[2];
+			out[0]->vec[0] = vec2[0];
+			out[0]->vec[1] = vec2[1];
+			out[0]->vec[2] = vec2[2];
 		}
 		
 		out[1]->vec[0] = normalize_v3(out[0]->vec );
@@ -114,14 +114,23 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
 		case 2:
 		case 3:
 		case 4:
-			GPU_stack_link(mat, names[node->custom1], NULL, out,
-				GPU_socket(&in[0]), GPU_socket(&in[1]));
+			GPU_stack_link(mat, names[node->custom1], in, out);
 			break;
 		case 5:
-			if (in[0].hasinput || !in[1].hasinput)
-				GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
-			else
-				GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+			if (in[0].hasinput || !in[1].hasinput) {
+				/* use only first item and terminator */
+				GPUNodeStack tmp_in[2];
+				memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack));
+				memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+				GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+			}
+			else {
+				/* use only second item and terminator */
+				GPUNodeStack tmp_in[2];
+				memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack));
+				memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+				GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+			}
 			break;
 		default:
 			return 0;
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c
index 366f50a..5451eb3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c
@@ -29,13 +29,13 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_volume_isotropic_in[]= {
+static bNodeSocketTemplate sh_node_volume_isotropic_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Density"),	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_volume_isotropic_out[]= {
+static bNodeSocketTemplate sh_node_volume_isotropic_out[] = {
 	{	SOCK_SHADER, 0, N_("Volume")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c
index 9d48f61..ad7d7fc 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c
@@ -29,13 +29,13 @@
 
 /* **************** OUTPUT ******************** */
 
-static bNodeSocketTemplate sh_node_volume_transparent_in[]= {
+static bNodeSocketTemplate sh_node_volume_transparent_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),		0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_FLOAT, 1, N_("Density"),	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate sh_node_volume_transparent_out[]= {
+static bNodeSocketTemplate sh_node_volume_transparent_out[] = {
 	{	SOCK_SHADER, 0, N_("Volume")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 9656d93..ba94531 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -134,7 +134,7 @@ bNodeTreeType ntreeType_Texture = {
 	/* update */			update,
 	/* update_node */		NULL,
 	/* validate_link */		NULL,
-	/* internal_connect */	node_internal_connect_default
+	/* update_internal_links */	node_update_internal_links_default
 };
 
 int ntreeTexTagAnimated(bNodeTree *ntree)
@@ -240,19 +240,19 @@ void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data)
 }
 
 int ntreeTexExecTree(
-	bNodeTree *nodes,
-	TexResult *texres,
-	float *co,
-	float *dxt, float *dyt,
-	int osatex,
-	short thread, 
-	Tex *UNUSED(tex), 
-	short which_output, 
-	int cfra,
-	int preview,
-	ShadeInput *shi,
-	MTex *mtex
-) {
+        bNodeTree *nodes,
+        TexResult *texres,
+        float co[3],
+        float dxt[3], float dyt[3],
+        int osatex,
+        const short thread,
+        Tex *UNUSED(tex),
+        short which_output,
+        int cfra,
+        int preview,
+        ShadeInput *shi,
+        MTex *mtex)
+{
 	TexCallData data;
 	float *nor = texres->nor;
 	int retval = TEX_INT;
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index 5e58b74..06473d8 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -29,7 +29,7 @@
  *  \ingroup nodes
  */
 
- 
+
 /*
  * HOW TEXTURE NODES WORK
  *
@@ -112,13 +112,13 @@ void params_from_cdata(TexParams *out, TexCallData *in)
 	out->mtex = in->mtex;
 }
 
-void tex_do_preview(bNode *node, float *co, float *col)
+void tex_do_preview(bNode *node, const float coord[2], const float col[4])
 {
-	bNodePreview *preview= node->preview;
+	bNodePreview *preview = node->preview;
 
 	if (preview) {
-		int xs= ((co[0] + 1.0f)*0.5f)*preview->xsize;
-		int ys= ((co[1] + 1.0f)*0.5f)*preview->ysize;
+		int xs = ((coord[0] + 1.0f) * 0.5f) * preview->xsize;
+		int ys = ((coord[1] + 1.0f) * 0.5f) * preview->ysize;
 
 		nodeAddToPreview(node, col, xs, ys, 0); /* 0 = no color management */
 	}
@@ -132,19 +132,19 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC
 		dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
 	else
 		dg = out->data;
-	
-	dg->cdata= cdata;
+
+	dg->cdata = cdata;
 	dg->fn = texfn;
 	dg->node = node;
-	memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack*));
+	memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack *));
 	dg->type = out->sockettype;
 }
 
 void ntreeTexCheckCyclics(struct bNodeTree *ntree)
 {
 	bNode *node;
-	for (node= ntree->nodes.first; node; node= node->next) {
-		
+	for (node = ntree->nodes.first; node; node = node->next) {
+
 		if (node->type == TEX_NODE_TEXTURE && node->id) {
 			/* custom2 stops the node from rendering */
 			if (node->custom1) {
diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h
index e938e6f..16dbc2f 100644
--- a/source/blender/nodes/texture/node_texture_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -79,8 +79,10 @@
 
 typedef struct TexCallData {
 	TexResult *target;
+	/* all float[3] */
 	float *co;
 	float *dxt, *dyt;
+
 	int osatex;
 	char do_preview;
 	short thread;
@@ -94,7 +96,7 @@ typedef struct TexCallData {
 typedef struct TexParams {
 	float *co;
 	float *dxt, *dyt;
-	float *previewco;
+	const float *previewco;
 	int cfra;
 	int osatex;
 
@@ -119,7 +121,7 @@ void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
 float tex_input_value(bNodeStack *in, TexParams *params, short thread);
 
 void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data);
-void tex_do_preview(bNode *node, float *coord, float *col);
+void tex_do_preview(bNode *node, const float coord[2], const float col[4]);
 
 void params_from_cdata(TexParams *out, TexCallData *in);
 
diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c
index 9e55770..4c2d276 100644
--- a/source/blender/nodes/texture/nodes/node_texture_at.c
+++ b/source/blender/nodes/texture/nodes/node_texture_at.c
@@ -33,12 +33,12 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA,   1, N_("Texture"),     0.0f, 0.0f, 0.0f, 1.0f },
 	{ SOCK_VECTOR, 1, N_("Coordinates"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA,   0, N_("Texture") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index f625996..b4f81f0 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -35,7 +35,7 @@
 
 #include <math.h>
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA,  1, N_("Bricks 1"),    0.596f, 0.282f, 0.0f,  1.0f },
 	{ SOCK_RGBA,  1, N_("Bricks 2"),    0.632f, 0.504f, 0.05f, 1.0f },
 	{ SOCK_RGBA,  1, N_("Mortar"),      0.0f,   0.0f,   0.0f,  1.0f },
@@ -45,7 +45,7 @@ static bNodeSocketTemplate inputs[]= {
 	{ SOCK_FLOAT, 1, N_("Row Height"),  0.25f,  0.0f,   0.0f,  0.0f,  0.001f, 99.0f, PROP_UNSIGNED },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color")},
 	{ -1, 0, ""	}
 };
@@ -66,7 +66,7 @@ static float noise(int n) /* fast integer noise */
 
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	float *co = p->co;
+	const float *co = p->co;
 	
 	float x = co[0];
 	float y = co[1];
diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index cd9c317..1f653d1 100644
--- a/source/blender/nodes/texture/nodes/node_texture_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -34,13 +34,13 @@
 #include "NOD_texture.h"
 #include <math.h>
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA, 1, N_("Color1"), 1.0f, 0.0f, 0.0f, 1.0f },
 	{ SOCK_RGBA, 1, N_("Color2"), 1.0f, 1.0f, 1.0f, 1.0f },
 	{ SOCK_FLOAT, 1, N_("Size"),   0.5f, 0.0f, 0.0f, 0.0f,  0.0f, 100.0f, PROP_UNSIGNED },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
@@ -62,7 +62,7 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
 	}
 	else {
 		tex_input_rgba(out, in[1], p, thread);
-	} 
+	}
 }
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index 1eaf9b2..41bfd0a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -148,128 +148,3 @@ void register_node_type_tex_group(bNodeTreeType *ttype)
 	
 	nodeRegisterType(ttype, &ntype);
 }
-
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-	bNodeThreadStack *nts;
-	int iterations= (int)in[0]->vec[0];
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	nts = ntreeGetThreadStack(exec, thread);
-	
-	/* "Iteration" socket */
-	sock = exec->nodetree->inputs.first;
-	ns = node_get_socket_stack(nts->stack, sock);
-	
-//	group_copy_inputs(node, in, nts->stack);
-	for (iteration=0; iteration < iterations; ++iteration) {
-		/* first input contains current iteration counter */
-		ns->vec[0] = (float)iteration;
-		ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
-		
-//		if (iteration > 0)
-//			loop_init_iteration(exec->nodetree, nts->stack);
-//		ntreeExecThreadNodes(exec, nts, data, thread);
-	}
-//	loop_copy_outputs(node, in, out, exec->stack);
-	
-	ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_tex_forloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_forloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_forloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-	bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-	bNodeThreadStack *nts;
-	int condition= (in[0]->vec[0] > 0.0f);
-	bNodeSocket *sock;
-	bNodeStack *ns;
-	int iteration;
-	
-	/* XXX same behavior as trunk: all nodes inside group are executed.
-	 * it's stupid, but just makes it work. compo redesign will do this better.
-	 */
-	{
-		bNode *inode;
-		for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-			inode->need_exec = 1;
-	}
-	
-	nts = ntreeGetThreadStack(exec, thread);
-	
-	/* "Condition" socket */
-	sock = exec->nodetree->outputs.first;
-	ns = node_get_socket_stack(nts->stack, sock);
-	
-	iteration = 0;
-//	group_copy_inputs(node, in, nts->stack);
-	while (condition && iteration < node->custom1) {
-//		if (iteration > 0)
-//			loop_init_iteration(exec->nodetree, nts->stack);
-//		ntreeExecThreadNodes(exec, nts, data, thread);
-		
-		condition = (ns->vec[0] > 0.0f);
-		++iteration;
-	}
-//	loop_copy_outputs(node, in, out, exec->stack);
-	
-	ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_tex_whileloop(bNodeTreeType *ttype)
-{
-	static bNodeType ntype;
-
-	node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, NULL);
-	node_type_size(&ntype, 120, 60, 200);
-	node_type_label(&ntype, node_group_label);
-	node_type_init(&ntype, node_whileloop_init);
-	node_type_valid(&ntype, node_group_valid);
-	node_type_template(&ntype, node_whileloop_template);
-	node_type_update(&ntype, NULL, node_group_verify);
-	node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-	node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-	node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-	
-	nodeRegisterType(ttype, &ntype);
-}
-#endif
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 7752119..25da4f1 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -33,14 +33,14 @@
 #include "node_texture_util.h"      
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_FLOAT, 1, N_("Red"),   0.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Blue"),  0.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_UNSIGNED },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c
index 2add5c8..971520e 100644
--- a/source/blender/nodes/texture/nodes/node_texture_coord.c
+++ b/source/blender/nodes/texture/nodes/node_texture_coord.c
@@ -33,7 +33,7 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate outputs[]= { 
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_VECTOR, 0, N_("Coordinates") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index 6ccb5e1..5980f93 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -36,7 +36,7 @@
 /* **************** CURVE Time  ******************** */
 
 /* custom1 = sfra, custom2 = efra */
-static bNodeSocketTemplate time_outputs[]= {
+static bNodeSocketTemplate time_outputs[] = {
 	{ SOCK_FLOAT, 0, N_("Value") },
 	{ -1, 0, "" }
 };
@@ -83,12 +83,12 @@ void register_node_type_tex_curve_time(bNodeTreeType *ttype)
 }
 
 /* **************** CURVE RGB  ******************** */
-static bNodeSocketTemplate rgb_inputs[]= {
+static bNodeSocketTemplate rgb_inputs[] = {
 	{	SOCK_RGBA, 1, N_("Color"),	0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate rgb_outputs[]= {
+static bNodeSocketTemplate rgb_outputs[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index eae34e2..a2875c3 100644
--- a/source/blender/nodes/texture/nodes/node_texture_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -34,11 +34,11 @@
 #include "NOD_texture.h"
 #include <math.h>
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_FLOAT, 0, N_("Red") },
 	{ SOCK_FLOAT, 0, N_("Green") },
 	{ SOCK_FLOAT, 0, N_("Blue") },
diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c
index 29f08a0..8c3b155 100644
--- a/source/blender/nodes/texture/nodes/node_texture_distance.c
+++ b/source/blender/nodes/texture/nodes/node_texture_distance.c
@@ -35,13 +35,13 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_VECTOR, 1, N_("Coordinate 1"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
 	{ SOCK_VECTOR, 1, N_("Coordinate 2"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_FLOAT, 0, N_("Value") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 6863eab..b5e9969 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -34,7 +34,7 @@
 #include "NOD_texture.h"
 
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_FLOAT, 1, N_("Hue"),        0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE },
 	{ SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_FACTOR },
 	{ SOCK_FLOAT, 1, N_("Value"),      1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_FACTOR },
@@ -42,7 +42,7 @@ static bNodeSocketTemplate inputs[]= {
 	{ SOCK_RGBA,  1, N_("Color"),      0.8f, 0.8f, 0.8f, 1.0f },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
@@ -56,14 +56,14 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat
 		hsv[0]+= (hue - 0.5f);
 		if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
 		hsv[1]*= sat;
-		if (hsv[1]>1.0f) hsv[1]= 1.0f; else if (hsv[1]<0.0f) hsv[1]= 0.0f;
+		if (hsv[1]>1.0f) hsv[1] = 1.0f; else if (hsv[1]<0.0f) hsv[1] = 0.0f;
 		hsv[2]*= val;
-		if (hsv[2]>1.0f) hsv[2]= 1.0f; else if (hsv[2]<0.0f) hsv[2]= 0.0f;
+		if (hsv[2]>1.0f) hsv[2] = 1.0f; else if (hsv[2]<0.0f) hsv[2] = 0.0f;
 		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
 		
-		out[0]= mfac*in[0] + fac*col[0];
-		out[1]= mfac*in[1] + fac*col[1];
-		out[2]= mfac*in[2] + fac*col[2];
+		out[0] = mfac*in[0] + fac*col[0];
+		out[1] = mfac*in[1] + fac*col[1];
+		out[2] = mfac*in[2] + fac*col[2];
 	}
 	else {
 		copy_v4_v4(out, in);
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 7ce91c3..2ef1669 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -33,7 +33,7 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Image")},
 	{ -1, 0, "" }
 };
@@ -46,7 +46,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
 	ImageUser *iuser= (ImageUser *)node->storage;
 	
 	if ( ima ) {
-		ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
 		if ( ibuf ) {
 			float xsize, ysize;
 			float xoff, yoff;
@@ -77,6 +77,8 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
 			
 			result = ibuf->rect_float + py*ibuf->x*4 + px*4;
 			copy_v4_v4(out, result);
+
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 	}
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c
index 0339c3f..9c2963d 100644
--- a/source/blender/nodes/texture/nodes/node_texture_invert.c
+++ b/source/blender/nodes/texture/nodes/node_texture_invert.c
@@ -34,14 +34,14 @@
 #include "NOD_texture.h"
 
 /* **************** INVERT ******************** */ 
-static bNodeSocketTemplate inputs[]= { 
-	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate inputs[] = {
+	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 36e9cac..95d70cc 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -35,15 +35,15 @@
 
 
 /* **************** SCALAR MATH ******************** */ 
-static bNodeSocketTemplate inputs[]= { 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate inputs[] = {
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
+	{ SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_FLOAT, 0, N_("Value")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_FLOAT, 0, N_("Value")},
+	{ -1, 0, "" }
 };
 
 static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
@@ -112,7 +112,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		{
 			/* Only raise negative numbers by full integers */
 			if ( in0 >= 0 ) {
-				out[0]= pow(in0, in1);
+				out[0] = pow(in0, in1);
 			}
 			else {
 				float y_mod_1 = fmod(in1, 1);
@@ -178,7 +178,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		fprintf(stderr,
 			"%s:%d: unhandeld value in switch statement: %d\n",
 			__FILE__, __LINE__, node->custom1);
-	} 
+	}
 }
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index bf6cb7a..fe04854 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -34,13 +34,13 @@
 #include "NOD_texture.h"
 
 /* **************** MIX RGB ******************** */
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
 	{ SOCK_RGBA,  1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f },
 	{ SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index fdd3b97..2f5efe8 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -34,7 +34,7 @@
 #include "NOD_texture.h"
 
 /* **************** COMPOSITE ******************** */
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA,   1, N_("Color"),  0.0f, 0.0f, 0.0f, 1.0f},
 	{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION},
 	{ -1, 0, ""	}
@@ -170,7 +170,7 @@ void register_node_type_tex_output(bNodeTreeType *ttype)
 	node_type_exec(&ntype, exec);
 	
 	/* Do not allow muting output. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 	
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index 102f6e1..8876d98 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -40,12 +40,12 @@
  */
 
 
-static bNodeSocketTemplate outputs_both[]= {
+static bNodeSocketTemplate outputs_both[] = {
 	{ SOCK_RGBA, 0, N_("Color"),  1.0f, 0.0f, 0.0f, 1.0f },
 	{ SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION },
 	{ -1, 0, "" }
 };
-static bNodeSocketTemplate outputs_color_only[]= {
+static bNodeSocketTemplate outputs_color_only[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
@@ -57,7 +57,7 @@ static bNodeSocketTemplate outputs_color_only[]= {
 	{ SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f }
 
 /* Calls multitex and copies the result to the outputs. Called by xxx_exec, which handles inputs. */
-static void do_proc(float *result, TexParams *p, float *col1, float *col2, char is_normal, Tex *tex, short thread)
+static void do_proc(float *result, TexParams *p, const float col1[4], const float col2[4], char is_normal, Tex *tex, const short thread)
 {
 	TexResult texres;
 	int textype;
@@ -69,7 +69,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
 		texres.nor = NULL;
 	
 	textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex,
-		&texres, thread, 0, p->shi, p->mtex);
+	                         &texres, thread, 0, p->shi, p->mtex);
 	
 	if (is_normal)
 		return;
@@ -83,7 +83,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
 	}
 }
 
-typedef void (*MapFn) (Tex *tex, bNodeStack **in, TexParams *p, short thread);
+typedef void (*MapFn) (Tex *tex, bNodeStack **in, TexParams *p, const short thread);
 
 static void texfn(
 	float *result, 
@@ -138,7 +138,7 @@ static int count_outputs(bNode *node)
 
 
 /* --- VORONOI -- */
-static bNodeSocketTemplate voronoi_inputs[]= {
+static bNodeSocketTemplate voronoi_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("W1"), 1.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
 	{ SOCK_FLOAT, 1, N_("W2"), 0.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
@@ -163,7 +163,7 @@ static void voronoi_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short th
 ProcDef(voronoi)
 
 /* --- BLEND -- */
-static bNodeSocketTemplate blend_inputs[]= {
+static bNodeSocketTemplate blend_inputs[] = {
 	COMMON_INPUTS,
 	{ -1, 0, "" }
 };
@@ -171,7 +171,7 @@ ProcNoInputs(blend)
 ProcDef(blend)
 
 /* -- MAGIC -- */
-static bNodeSocketTemplate magic_inputs[]= {
+static bNodeSocketTemplate magic_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f,   0.0f, 200.0f, PROP_UNSIGNED },
 	{ -1, 0, "" }
@@ -183,7 +183,7 @@ static void magic_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thre
 ProcDef(magic)
 
 /* --- MARBLE --- */
-static bNodeSocketTemplate marble_inputs[]= {
+static bNodeSocketTemplate marble_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Size"),       0.25f, 0.0f, 0.0f, 0.0f,   0.0001f, 2.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Turbulence"), 5.0f,  0.0f, 0.0f, 0.0f,   0.0f, 200.0f, PROP_UNSIGNED },
@@ -197,7 +197,7 @@ static void marble_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr
 ProcDef(marble)
 
 /* --- CLOUDS --- */
-static bNodeSocketTemplate clouds_inputs[]= {
+static bNodeSocketTemplate clouds_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Size"),       0.25f, 0.0f, 0.0f, 0.0f,   0.0001f, 2.0f, PROP_UNSIGNED },
 	{ -1, 0, "" }
@@ -209,7 +209,7 @@ static void clouds_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr
 ProcDef(clouds)
 
 /* --- DISTORTED NOISE --- */
-static bNodeSocketTemplate distnoise_inputs[]= {
+static bNodeSocketTemplate distnoise_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Size"),       0.25f, 0.0f, 0.0f, 0.0f,   0.0001f,  2.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Distortion"), 1.00f, 0.0f, 0.0f, 0.0f,   0.0000f, 10.0f, PROP_UNSIGNED },
@@ -223,7 +223,7 @@ static void distnoise_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short
 ProcDef(distnoise)
 
 /* --- WOOD --- */
-static bNodeSocketTemplate wood_inputs[]= {
+static bNodeSocketTemplate wood_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Size"),       0.25f, 0.0f, 0.0f, 0.0f,   0.0001f, 2.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Turbulence"), 5.0f,  0.0f, 0.0f, 0.0f,   0.0f, 200.0f, PROP_UNSIGNED },
@@ -237,7 +237,7 @@ static void wood_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short threa
 ProcDef(wood)
 
 /* --- MUSGRAVE --- */
-static bNodeSocketTemplate musgrave_inputs[]= {
+static bNodeSocketTemplate musgrave_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("H"),          1.0f, 0.0f, 0.0f, 0.0f,   0.0001f, 2.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Lacunarity"), 2.0f, 0.0f, 0.0f, 0.0f,   0.0f,    6.0f, PROP_UNSIGNED },
@@ -258,7 +258,7 @@ static void musgrave_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short t
 ProcDef(musgrave)
 
 /* --- NOISE --- */
-static bNodeSocketTemplate noise_inputs[]= {
+static bNodeSocketTemplate noise_inputs[] = {
 	COMMON_INPUTS,
 	{ -1, 0, "" }
 };
@@ -266,7 +266,7 @@ ProcNoInputs(noise)
 ProcDef(noise)
 
 /* --- STUCCI --- */
-static bNodeSocketTemplate stucci_inputs[]= {
+static bNodeSocketTemplate stucci_inputs[] = {
 	COMMON_INPUTS,
 	{ SOCK_FLOAT, 1, N_("Size"),       0.25f, 0.0f, 0.0f, 0.0f,   0.0001f, 2.0f, PROP_UNSIGNED },
 	{ SOCK_FLOAT, 1, N_("Turbulence"), 5.0f,  0.0f, 0.0f, 0.0f,   0.0f, 200.0f, PROP_UNSIGNED },
diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c
index a7832c8..1b1d570 100644
--- a/source/blender/nodes/texture/nodes/node_texture_rotate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c
@@ -35,19 +35,19 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= { 
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
 	{ SOCK_FLOAT, 1, N_("Turns"),   0.0f, 0.0f, 0.0f, 0.0f,  -1.0f, 1.0f, PROP_NONE },
 	{ SOCK_VECTOR, 1, N_("Axis"),   0.0f, 0.0f, 1.0f, 0.0f,  -1.0f, 1.0f, PROP_DIRECTION },
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
-static void rotate(float new_co[3], float a, float ax[3], float co[3])
+static void rotate(float new_co[3], float a, float ax[3], const float co[3])
 {
 	float para[3];
 	float perp[3];
diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c
index 130a21b..5656272 100644
--- a/source/blender/nodes/texture/nodes/node_texture_scale.c
+++ b/source/blender/nodes/texture/nodes/node_texture_scale.c
@@ -33,15 +33,15 @@
 #include <math.h>
 #include "node_texture_util.h"
 
-static bNodeSocketTemplate inputs[]= { 
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA,   1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f },
 	{ SOCK_VECTOR, 1, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f,  -10.0f, 10.0f, PROP_XYZ },
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 4832f19..cc7367a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -35,13 +35,13 @@
 
 #include "RE_shader_ext.h"
 
-static bNodeSocketTemplate inputs[]= {
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA, 1, N_("Color1"), 1.0f, 1.0f, 1.0f, 1.0f },
 	{ SOCK_RGBA, 1, N_("Color2"), 0.0f, 0.0f, 0.0f, 1.0f },
 	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= {
+static bNodeSocketTemplate outputs[] = {
 	{ SOCK_RGBA, 0, N_("Color") },
 	{ -1, 0, "" }
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c
index 85f857c..a95cb00 100644
--- a/source/blender/nodes/texture/nodes/node_texture_translate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_translate.c
@@ -34,15 +34,15 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= { 
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
 	{ SOCK_VECTOR, 1, N_("Offset"),   0.0f, 0.0f, 0.0f, 0.0f,  -10000.0f, 10000.0f, PROP_TRANSLATION },
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_RGBA, 0, N_("Color")}, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_RGBA, 0, N_("Color")},
+	{ -1, 0, "" }
 };
 
 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
index 2d107b8..bbfc1fa 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
@@ -33,23 +33,23 @@
 #include "node_texture_util.h"
 #include "NOD_texture.h"
 
-static bNodeSocketTemplate inputs[]= { 
+static bNodeSocketTemplate inputs[] = {
 	{ SOCK_FLOAT, 1, N_("Val"),   0.0f,   0.0f, 0.0f, 1.0f,  0.0f,   1.0f, PROP_NONE },
 	{ SOCK_FLOAT, 1, N_("Nabla"), 0.025f, 0.0f, 0.0f, 0.0f,  0.001f, 0.1f, PROP_UNSIGNED },
-	{ -1, 0, "" } 
+	{ -1, 0, "" }
 };
 
-static bNodeSocketTemplate outputs[]= { 
-	{ SOCK_VECTOR, 0, N_("Normal") }, 
-	{ -1, 0, "" } 
+static bNodeSocketTemplate outputs[] = {
+	{ SOCK_VECTOR, 0, N_("Normal") },
+	{ -1, 0, "" }
 };
 
 static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
 {
 	float new_co[3];
-	float *co = p->co;
+	const float *co = p->co;
 
-	float nabla = tex_input_value(in[1], p, thread);	
+	float nabla = tex_input_value(in[1], p, thread);
 	float val;
 	float nor[3];
 	
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index 5156135..7863545 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -34,11 +34,11 @@
 #include "NOD_texture.h"
 
 /* **************** VALTORGB ******************** */
-static bNodeSocketTemplate valtorgb_in[]= {
+static bNodeSocketTemplate valtorgb_in[] = {
 	{	SOCK_FLOAT, 1, N_("Fac"),			0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate valtorgb_out[]= {
+static bNodeSocketTemplate valtorgb_out[] = {
 	{	SOCK_RGBA, 0, N_("Color")},
 	{	-1, 0, ""	}
 };
@@ -77,11 +77,11 @@ void register_node_type_tex_valtorgb(bNodeTreeType *ttype)
 }
 
 /* **************** RGBTOBW ******************** */
-static bNodeSocketTemplate rgbtobw_in[]= {
+static bNodeSocketTemplate rgbtobw_in[] = {
 	{	SOCK_RGBA, 1, N_("Color"),			0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
-static bNodeSocketTemplate rgbtobw_out[]= {
+static bNodeSocketTemplate rgbtobw_out[] = {
 	{	SOCK_FLOAT, 0, N_("Val"),			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index bc31bef..5cb8d8c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -66,7 +66,7 @@ void register_node_type_tex_viewer(bNodeTreeType *ttype)
 	node_type_exec(&ntype, exec);
 	
 	/* Do not allow muting viewer node. */
-	node_type_internal_connect(&ntype, NULL);
+	node_type_internal_links(&ntype, NULL);
 	
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/opencl/CMakeLists.txt b/source/blender/opencl/CMakeLists.txt
index 20dcf33..b3c76db 100644
--- a/source/blender/opencl/CMakeLists.txt
+++ b/source/blender/opencl/CMakeLists.txt
@@ -1,4 +1,3 @@
-# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 83a40ec..9bd45d2 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -80,6 +80,7 @@ int		BPY_button_exec(struct bContext *C, const char *expr, double *value, const
 int		BPY_string_exec(struct bContext *C, const char *expr);
 
 void	BPY_DECREF(void *pyob_ptr);	/* Py_DECREF() */
+void	BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr);
 int		BPY_context_member_get(struct bContext *C, const char *member, struct bContextDataResult *result);
 void	BPY_context_set(struct bContext *C);
 void	BPY_context_update(struct bContext *C);
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index 032a914..ccabe57 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -34,6 +34,7 @@ set(INC_SYS
 set(SRC
 	bmesh_py_api.c
 	bmesh_py_ops.c
+	bmesh_py_ops_call.c
 	bmesh_py_types.c
 	bmesh_py_types_customdata.c
 	bmesh_py_types_meshdata.c
@@ -42,6 +43,7 @@ set(SRC
 
 	bmesh_py_api.h
 	bmesh_py_ops.h
+	bmesh_py_ops_call.h
 	bmesh_py_types.h
 	bmesh_py_types_customdata.h
 	bmesh_py_types_meshdata.h
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index e02efc7..18f5d89 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -51,7 +51,6 @@
 
 #include "bmesh_py_api.h" /* own include */
 
-
 PyDoc_STRVAR(bpy_bm_new_doc,
 ".. method:: new()\n"
 "\n"
@@ -73,6 +72,8 @@ PyDoc_STRVAR(bpy_bm_from_edit_mesh_doc,
 "\n"
 "   Return a BMesh from this mesh, currently the mesh must already be in editmode.\n"
 "\n"
+"   :arg mesh: The editmode mesh.\n"
+"   :type mesh: :class:`bpy.types.Mesh`\n"
 "   :return: the BMesh associated with this mesh.\n"
 "   :rtype: :class:`bmesh.types.BMesh`\n"
 );
@@ -96,22 +97,62 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
 	return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_IS_WRAPPED);
 }
 
+PyDoc_STRVAR(bpy_bm_update_edit_mesh_doc,
+".. method:: update_edit_mesh(mesh, tessface=True)\n"
+"\n"
+"   Update the mesh after changes to the BMesh in editmode, \n"
+"   optionally recalculating n-gon tessellation.\n"
+"\n"
+"   :arg mesh: The editmode mesh.\n"
+"   :type mesh: :class:`bpy.types.Mesh`\n"
+"   :arg tessface: Option to recalculate n-gon tessellation.\n"
+"   :type tessface: boolean\n"
+);
+static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args)
+{
+	PyObject *py_me;
+	Mesh *me;
+	int do_tessface = TRUE;
+
+	if (!PyArg_ParseTuple(args, "O|i:update_edit_mesh", &py_me, &do_tessface)) {
+		return NULL;
+	}
+
+	me = PyC_RNA_AsPointer(py_me, "Mesh");
+
+	if (me == NULL) {
+		return NULL;
+	}
+
+	if (me->edit_btmesh == NULL) {
+		PyErr_SetString(PyExc_ValueError,
+		                "The mesh must be in editmode");
+		return NULL;
+	}
+
+	{
+		/* XXX, not great - infact this function could just not use the context at all
+		 * postpone that change until after release: BMESH_TODO - campbell */
+		extern struct bContext *BPy_GetContext(void);
+		extern void EDBM_update_generic(struct bContext *C, BMEditMesh *em, const short do_tessface);
+
+		struct bContext *C = BPy_GetContext();
+		EDBM_update_generic(C, me->edit_btmesh, do_tessface);
+	}
+
+	Py_RETURN_NONE;
+}
+
 static struct PyMethodDef BPy_BM_methods[] = {
 	{"new",            (PyCFunction)bpy_bm_new,            METH_NOARGS,  bpy_bm_new_doc},
 	{"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O,       bpy_bm_from_edit_mesh_doc},
+	{"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS, bpy_bm_update_edit_mesh_doc},
 	{NULL, NULL, 0, NULL}
 };
 
 PyDoc_STRVAR(BPy_BM_doc,
 "This module provides access to blenders bmesh data structures.\n"
 "\n"
-"\n"
-"Submodules:\n"
-"\n"
-"* :mod:`bmesh.utils`\n"
-"* :mod:`bmesh.types`\n"
-"\n"
-"\n"
 ".. include:: include__bmesh.rst\n"
 );
 static struct PyModuleDef BPy_BM_module_def = {
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index fb5b942..0a2091a 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -38,39 +38,19 @@
 
 #include "../generic/py_capi_utils.h"
 
-#include "../mathutils/mathutils.h"
-
 #include "bmesh.h"
 
+#include "bmesh_py_ops_call.h"
 #include "bmesh_py_ops.h"  /* own include */
 
 #include "bmesh_py_types.h"
 
-#include "bmesh_py_utils.h" /* own include */
-
-static int bpy_bm_op_as_py_error(BMesh *bm)
-{
-	if (BMO_error_occurred(bm)) {
-		const char *errmsg;
-		if (BMO_error_get(bm, &errmsg, NULL)) {
-			PyErr_Format(PyExc_RuntimeError,
-			             "bmesh operator: %.200s",
-			             errmsg);
-			return -1;
-		}
-	}
-	return 0;
-}
+#include "bmesh_py_utils.h"
 
 /* bmesh operator 'bmesh.ops.*' callable types
  * ******************************************* */
 PyTypeObject bmesh_op_Type;
 
-typedef struct {
-	PyObject_HEAD /* required python macro   */
-	const char *opname;
-} BPy_BMeshOpFunc;
-
 static PyObject *bpy_bmesh_op_CreatePyObject(const char *opname)
 {
 	BPy_BMeshOpFunc *self = PyObject_New(BPy_BMeshOpFunc, &bmesh_op_Type);
@@ -88,243 +68,6 @@ static PyObject *bpy_bmesh_op_repr(BPy_BMeshOpFunc *self)
 }
 
 
-static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
-{
-	BPy_BMesh *py_bm;
-	BMesh *bm;
-
-	BMOperator bmop;
-
-	if ((PyTuple_GET_SIZE(args) == 1) &&
-	    (py_bm = (BPy_BMesh *)PyTuple_GET_ITEM(args, 0)) &&
-	    (BPy_BMesh_Check(py_bm))
-		)
-	{
-		BPY_BM_CHECK_OBJ(py_bm);
-		bm = py_bm->bm;
-	}
-	else {
-		PyErr_SetString(PyExc_TypeError,
-		                "calling a bmesh operator expects a single BMesh (non keyword) "
-		                "as the first argument");
-		return NULL;
-	}
-
-	/* TODO - error check this!, though we do the error check on attribute access */
-	/* TODO - make flags optional */
-	BMO_op_init(bm, &bmop, BMO_FLAG_DEFAULTS, self->opname);
-
-	if (kw && PyDict_Size(kw) > 0) {
-		/* setup properties, see bpy_rna.c: pyrna_py_to_prop()
-		 * which shares this logic for parsing properties */
-
-		PyObject *key, *value;
-		Py_ssize_t pos = 0;
-		while (PyDict_Next(kw, &pos, &key, &value)) {
-			const char *slot_name = _PyUnicode_AsString(key);
-			BMOpSlot *slot = BMO_slot_get(&bmop, slot_name);
-
-			if (slot == NULL) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s: keyword \"%.200s\" is invalid for this operator",
-				             self->opname, slot_name);
-				return NULL;
-			}
-
-			/* now assign the value */
-			switch (slot->slot_type) {
-				case BMO_OP_SLOT_BOOL:
-				{
-					int param;
-
-					param = PyLong_AsLong(value);
-
-					if (param < 0) {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected True/False or 0/1, not %.200s",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-					else {
-						slot->data.i = param;
-					}
-
-					break;
-				}
-				case BMO_OP_SLOT_INT:
-				{
-					int overflow;
-					long param = PyLong_AsLongAndOverflow(value, &overflow);
-					if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
-						PyErr_Format(PyExc_ValueError,
-						             "%.200s: keyword \"%.200s\" value not in 'int' range "
-						             "(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-					else if (param == -1 && PyErr_Occurred()) {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected an int, not %.200s",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-					else {
-						slot->data.i = (int)param;
-					}
-					break;
-				}
-				case BMO_OP_SLOT_FLT:
-				{
-					float param = PyFloat_AsDouble(value);
-					if (param == -1 && PyErr_Occurred()) {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected a float, not %.200s",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-					else {
-						slot->data.f = param;
-					}
-					break;
-				}
-				case BMO_OP_SLOT_MAT:
-				{
-					/* XXX - BMesh operator design is crappy here, operator slot should define matrix size,
-					 * not the caller! */
-					unsigned short size;
-					if (!MatrixObject_Check(value)) {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected a Matrix, not %.200s",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-					else if (BaseMath_ReadCallback((MatrixObject *)value) == -1) {
-						return NULL;
-					}
-					else if (((size = ((MatrixObject *)value)->num_col) != ((MatrixObject *)value)->num_row) ||
-					         (ELEM(size, 3, 4) == FALSE))
-					{
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected a 3x3 or 4x4 matrix Matrix",
-						             self->opname, slot_name);
-						return NULL;
-					}
-
-					BMO_slot_mat_set(&bmop, slot_name, ((MatrixObject *)value)->matrix, size);
-					break;
-				}
-				case BMO_OP_SLOT_VEC:
-				{
-					/* passing slot name here is a bit non-descriptive */
-					if (mathutils_array_parse(slot->data.vec, 3, 3, value, slot_name) == -1) {
-						return NULL;
-					}
-					break;
-				}
-				case BMO_OP_SLOT_ELEMENT_BUF:
-				{
-					/* there are many ways we could interpret arguments, for now...
-					 * - verts/edges/faces from the mesh direct,
-					 *   this way the operator takes every item.
-					 * - `TODO` a plain python sequence (list) of elements.
-					 * - `TODO`  an iterator. eg.
-					 *   face.verts
-					 * - `TODO`  (type, flag) pair, eg.
-					 *   ('VERT', {'TAG'})
-					 */
-
-#define BPY_BM_GENERIC_MESH_TEST(type_string)  \
-	if (((BPy_BMGeneric *)value)->bm != bm) {                                             \
-	    PyErr_Format(PyExc_NotImplementedError,                                           \
-	                 "%.200s: keyword \"%.200s\" " type_string " are from another bmesh", \
-	                 self->opname, slot_name, slot->slot_type);                           \
-	    return NULL;                                                                      \
-	} (void)0
-
-					if (BPy_BMVertSeq_Check(value)) {
-						BPY_BM_GENERIC_MESH_TEST("verts");
-						BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_VERT);
-					}
-					else if (BPy_BMEdgeSeq_Check(value)) {
-						BPY_BM_GENERIC_MESH_TEST("edges");
-						BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_EDGE);
-					}
-					else if (BPy_BMFaceSeq_Check(value)) {
-						BPY_BM_GENERIC_MESH_TEST("faces");
-						BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_FACE);
-					}
-					else if (BPy_BMElemSeq_Check(value)) {
-						BMIter iter;
-						BMHeader *ele;
-						int tot;
-						unsigned int i;
-
-						BPY_BM_GENERIC_MESH_TEST("elements");
-
-						/* this will loop over all elements which is a shame but
-						 * we need to know this before alloc */
-						/* calls bpy_bmelemseq_length() */
-						tot = Py_TYPE(value)->tp_as_sequence->sq_length((PyObject *)self);
-
-						BMO_slot_buffer_alloc(&bmop, slot_name, tot);
-
-						i = 0;
-						BM_ITER_BPY_BM_SEQ (ele, &iter, ((BPy_BMElemSeq *)value)) {
-							((void **)slot->data.buf)[i] = (void *)ele;
-							i++;
-						}
-					}
-					/* keep this last */
-					else if (PySequence_Check(value)) {
-						BMElem **elem_array = NULL;
-						Py_ssize_t elem_array_len;
-
-						elem_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
-						                                       &elem_array_len, BM_VERT | BM_EDGE | BM_FACE,
-						                                       TRUE, TRUE, slot_name);
-
-						/* error is set above */
-						if (elem_array == NULL) {
-							return NULL;
-						}
-
-						BMO_slot_buffer_alloc(&bmop, slot_name, elem_array_len);
-						memcpy(slot->data.buf, elem_array, sizeof(void *) * elem_array_len);
-						PyMem_FREE(elem_array);
-					}
-					else {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s: keyword \"%.200s\" expected "
-						             "a bmesh sequence, list, (htype, flag) pair, not %.200s",
-						             self->opname, slot_name, Py_TYPE(value)->tp_name);
-						return NULL;
-					}
-
-#undef BPY_BM_GENERIC_MESH_TEST
-
-					break;
-				}
-				default:
-					/* TODO --- many others */
-					PyErr_Format(PyExc_NotImplementedError,
-					             "%.200s: keyword \"%.200s\" type %d not working yet!",
-					             self->opname, slot_name, slot->slot_type);
-					return NULL;
-					break;
-			}
-		}
-	}
-
-	BMO_op_exec(bm, &bmop);
-	BMO_op_finish(bm, &bmop);
-
-	if (bpy_bm_op_as_py_error(bm) == -1) {
-		return NULL;
-	}
-
-	Py_RETURN_NONE;
-}
-
 
 PyTypeObject bmesh_op_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
@@ -348,7 +91,7 @@ PyTypeObject bmesh_op_Type = {
 	/* More standard operations (here for binary compatibility) */
 
 	NULL,                       /* hashfunc tp_hash; */
-	(ternaryfunc)pyrna_op_call, /* ternaryfunc tp_call; */
+	(ternaryfunc)BPy_BMO_call,  /* ternaryfunc tp_call; */
 	NULL,                       /* reprfunc tp_str; */
 
 	/* will only use these if this is a subtype of a py class */
@@ -409,41 +152,41 @@ PyTypeObject bmesh_op_Type = {
 /* bmesh fake module 'bmesh.ops'
  * ***************************** */
 
-static PyObject *bpy_bmesh_fmod_getattro(PyObject *UNUSED(self), PyObject *pyname)
+static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject *pyname)
 {
-	const unsigned int tot = bmesh_total_ops;
+	const unsigned int tot = bmo_opdefines_total;
 	unsigned int i;
-	const char *name = _PyUnicode_AsString(pyname);
+	const char *opname = _PyUnicode_AsString(pyname);
 
 	for (i = 0; i < tot; i++) {
-		if (strcmp(opdefines[i]->name, name) == 0) {
-			return bpy_bmesh_op_CreatePyObject(opdefines[i]->name);
+		if (strcmp(bmo_opdefines[i]->opname, opname) == 0) {
+			return bpy_bmesh_op_CreatePyObject(opname);
 		}
 	}
 
 	PyErr_Format(PyExc_AttributeError,
 	             "BMeshOpsModule: operator \"%.200s\" doesn't exist",
-	             name);
+	             opname);
 	return NULL;
 }
 
-static PyObject *bpy_bmesh_fmod_dir(PyObject *UNUSED(self))
+static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self))
 {
-	const unsigned int tot = bmesh_total_ops;
+	const unsigned int tot = bmo_opdefines_total;
 	unsigned int i;
 	PyObject *ret;
 
-	ret = PyList_New(bmesh_total_ops);
+	ret = PyList_New(bmo_opdefines_total);
 
 	for (i = 0; i < tot; i++) {
-		PyList_SET_ITEM(ret, i, PyUnicode_FromString(opdefines[i]->name));
+		PyList_SET_ITEM(ret, i, PyUnicode_FromString(bmo_opdefines[i]->opname));
 	}
 
 	return ret;
 }
 
-static struct PyMethodDef bpy_bmesh_fmod_methods[] = {
-	{"__dir__", (PyCFunction)bpy_bmesh_fmod_dir, METH_NOARGS, NULL},
+static struct PyMethodDef bpy_bmesh_ops_fakemod_methods[] = {
+	{"__dir__", (PyCFunction)bpy_bmesh_ops_fakemod_dir, METH_NOARGS, NULL},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -473,7 +216,7 @@ static PyTypeObject bmesh_ops_fakemod_Type = {
 	NULL,                       /* reprfunc tp_str; */
 
 	/* will only use these if this is a subtype of a py class */
-	bpy_bmesh_fmod_getattro,    /* getattrofunc tp_getattro; */
+	bpy_bmesh_ops_fakemod_getattro,    /* getattrofunc tp_getattro; */
 	NULL,                       /* setattrofunc tp_setattro; */
 
 	/* Functions to access object as input/output buffer */
@@ -502,7 +245,7 @@ static PyTypeObject bmesh_ops_fakemod_Type = {
 	NULL,                       /* iternextfunc tp_iternext; */
 
 	/*** Attribute descriptor and subclassing stuff ***/
-	bpy_bmesh_fmod_methods,  /* struct PyMethodDef *tp_methods; */
+	bpy_bmesh_ops_fakemod_methods,  /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL,                       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
new file mode 100644
index 0000000..ded3536
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -0,0 +1,783 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_ops_call.c
+ *  \ingroup pybmesh
+ *
+ * This file provides __call__ aka BPy_BMO_call for
+ * the bmesh operatorand has been given its own file
+ * because argument conversion is involved.
+ */
+
+#include <Python.h>
+
+#include "BLI_utildefines.h"
+
+#include "../mathutils/mathutils.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_ops.h"
+#include "bmesh_py_ops_call.h"  /* own include */
+
+#include "bmesh_py_types.h"
+#include "bmesh_py_utils.h"
+
+static int bpy_bm_op_as_py_error(BMesh *bm)
+{
+	if (BMO_error_occurred(bm)) {
+		const char *errmsg;
+		if (BMO_error_get(bm, &errmsg, NULL)) {
+			PyErr_Format(PyExc_RuntimeError,
+			             "bmesh operator: %.200s",
+			             errmsg);
+			return -1;
+		}
+	}
+	return 0;
+}
+
+/**
+ * \brief Utility function to check BMVert/BMEdge/BMFace's
+ *
+ * \param value
+ * \param bm Check the \a value against this.
+ * \param htype Test \a value matches this type.
+ * \param descr Description text.
+ */
+static int bpy_slot_from_py_elem_check(BPy_BMElem *value, BMesh *bm, const char htype,
+                                       /* for error messages */
+                                       const char *opname, const char *slot_name, const char *descr)
+{
+	if (!BPy_BMElem_Check(value) ||
+	    !(value->ele->head.htype & htype))
+	{
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s, expected a %.200s not *.200s",
+		             opname, slot_name, descr,
+		             BPy_BMElem_StringFromHType(htype),
+		             Py_TYPE(value)->tp_name);
+		return -1;
+	}
+	else if (value->bm == NULL) {
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s invalidated element",
+		             opname, slot_name, descr);
+		return -1;
+	}
+	else if (value->bm != bm) {  /* we may want to make this check optional by setting 'bm' to NULL */
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s invalidated element",
+		             opname, slot_name, descr);
+		return -1;
+	}
+	return 0;
+}
+
+/**
+ * \brief Utility function to check BMVertSeq/BMEdgeSeq/BMFaceSeq's
+ *
+ * \param value Caller must check its a BMeshSeq
+ * \param bm Check the \a value against this.
+ * \param htype_py The type(s) of \a value.
+ * \param htype_bmo The type(s) supported by the target slot.
+ * \param descr Description text.
+ */
+static int bpy_slot_from_py_elemseq_check(BPy_BMGeneric *value, BMesh *bm,
+                                          const char htype_py, const char htype_bmo,
+                                          /* for error messages */
+                                          const char *opname, const char *slot_name, const char *descr)
+{
+	if (value->bm == NULL) {
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s, invalidated sequence",
+		             opname, slot_name, descr);
+		return -1;
+	}
+	else if (value->bm != bm) {  /* we may want to make this check optional by setting 'bm' to NULL */
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s, invalidated sequence",
+		             opname, slot_name, descr);
+		return -1;
+	}
+	else if ((htype_py & htype_bmo) == 0) {
+		char str_bmo[32];
+		char str_py[32];
+		PyErr_Format(PyExc_TypeError,
+		             "%.200s: keyword \"%.200s\" %.200s, expected "
+		             "a sequence of %.200s not %.200s",
+		             opname, slot_name, descr,
+		             BPy_BMElem_StringFromHType_ex(htype_bmo, str_bmo),
+		             BPy_BMElem_StringFromHType_ex(htype_py,  str_py));
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Use for giving py args to an operator.
+ */
+static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObject *value,
+                            /* the are just for exception messages */
+                            const char *opname, const char *slot_name)
+{
+	switch (slot->slot_type) {
+		case BMO_OP_SLOT_BOOL:
+		{
+			int param;
+
+			param = PyLong_AsLong(value);
+
+			if (param < 0) {
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" expected True/False or 0/1, not %.200s",
+				             opname, slot_name, Py_TYPE(value)->tp_name);
+				return -1;
+			}
+			else {
+				BMO_SLOT_AS_BOOL(slot) = param;
+			}
+
+			break;
+		}
+		case BMO_OP_SLOT_INT:
+		{
+			int overflow;
+			long param = PyLong_AsLongAndOverflow(value, &overflow);
+			if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
+				PyErr_Format(PyExc_ValueError,
+				             "%.200s: keyword \"%.200s\" value not in 'int' range "
+				             "(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")",
+				             opname, slot_name, Py_TYPE(value)->tp_name);
+				return -1;
+			}
+			else if (param == -1 && PyErr_Occurred()) {
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" expected an int, not %.200s",
+				             opname, slot_name, Py_TYPE(value)->tp_name);
+				return -1;
+			}
+			else {
+				BMO_SLOT_AS_INT(slot) = (int)param;
+			}
+			break;
+		}
+		case BMO_OP_SLOT_FLT:
+		{
+			float param = PyFloat_AsDouble(value);
+			if (param == -1 && PyErr_Occurred()) {
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" expected a float, not %.200s",
+				             opname, slot_name, Py_TYPE(value)->tp_name);
+				return -1;
+			}
+			else {
+				BMO_SLOT_AS_FLOAT(slot) = param;
+			}
+			break;
+		}
+		case BMO_OP_SLOT_MAT:
+		{
+			/* XXX - BMesh operator design is crappy here, operator slot should define matrix size,
+			 * not the caller! */
+			unsigned short size;
+			if (!MatrixObject_Check(value)) {
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" expected a Matrix, not %.200s",
+				             opname, slot_name, Py_TYPE(value)->tp_name);
+				return -1;
+			}
+			else if (BaseMath_ReadCallback((MatrixObject *)value) == -1) {
+				return -1;
+			}
+			else if (((size = ((MatrixObject *)value)->num_col) != ((MatrixObject *)value)->num_row) ||
+			         (ELEM(size, 3, 4) == FALSE))
+			{
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" expected a 3x3 or 4x4 matrix Matrix",
+				             opname, slot_name);
+				return -1;
+			}
+
+			BMO_slot_mat_set(bmop, bmop->slots_in, slot_name, ((MatrixObject *)value)->matrix, size);
+			break;
+		}
+		case BMO_OP_SLOT_VEC:
+		{
+			/* passing slot name here is a bit non-descriptive */
+			if (mathutils_array_parse(BMO_SLOT_AS_VECTOR(slot), 3, 3, value, slot_name) == -1) {
+				return -1;
+			}
+			break;
+		}
+		case BMO_OP_SLOT_ELEMENT_BUF:
+		{
+			if (slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) {
+				if (bpy_slot_from_py_elem_check((BPy_BMElem *)value, bm, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+				                                opname, slot_name, "single element") == -1)
+				{
+					return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+				}
+
+				BMO_slot_buffer_from_single(bmop, slot, &((BPy_BMElem *)value)->ele->head);
+			}
+			else {
+				/* there are many ways we could interpret arguments, for now...
+				 * - verts/edges/faces from the mesh direct,
+				 *   this way the operator takes every item.
+				 * - `TODO` a plain python sequence (list) of elements.
+				 * - `TODO`  an iterator. eg.
+				 *   face.verts
+				 * - `TODO`  (type, flag) pair, eg.
+				 *   ('VERT', {'TAG'})
+				 */
+
+				if (BPy_BMVertSeq_Check(value)) {
+					if (bpy_slot_from_py_elemseq_check((BPy_BMGeneric *)value, bm,
+					                                   BM_VERT, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+					                                   opname, slot_name, "element buffer") == -1)
+					{
+						return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+					}
+
+					BMO_slot_buffer_from_all(bm, bmop, bmop->slots_in, slot_name, BM_VERT);
+				}
+				else if (BPy_BMEdgeSeq_Check(value)) {
+					if (bpy_slot_from_py_elemseq_check((BPy_BMGeneric *)value, bm,
+					                                   BM_EDGE, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+					                                   opname, slot_name, "element buffer") == -1)
+					{
+						return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+					}
+
+					BMO_slot_buffer_from_all(bm, bmop, bmop->slots_in, slot_name, BM_EDGE);
+				}
+				else if (BPy_BMFaceSeq_Check(value)) {
+					if (bpy_slot_from_py_elemseq_check((BPy_BMGeneric *)value, bm,
+					                                   BM_FACE, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+					                                   opname, slot_name, "element buffer") == -1)
+					{
+						return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+					}
+					BMO_slot_buffer_from_all(bm, bmop, bmop->slots_in, slot_name, BM_FACE);
+				}
+
+				else if (BPy_BMElemSeq_Check(value)) {
+					BMIter iter;
+					BMHeader *ele;
+					int tot;
+					unsigned int i;
+
+					if (bpy_slot_from_py_elemseq_check((BPy_BMGeneric *)value, bm,
+					                                   bm_iter_itype_htype_map[((BPy_BMElemSeq *)value)->itype],
+					                                   (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+					                                   opname, slot_name, "element buffer") == -1)
+					{
+						return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+					}
+
+					/* this will loop over all elements which is a shame but
+					 * we need to know this before alloc */
+					/* calls bpy_bmelemseq_length() */
+					tot = Py_TYPE(value)->tp_as_sequence->sq_length(value);
+
+					BMO_slot_buffer_alloc(bmop, bmop->slots_in, slot_name, tot);
+
+					i = 0;
+					BM_ITER_BPY_BM_SEQ (ele, &iter, ((BPy_BMElemSeq *)value)) {
+						slot->data.buf[i] = ele;
+						i++;
+					}
+				}
+				/* keep this last */
+				else if (PySequence_Check(value)) {
+					BMElem **elem_array = NULL;
+					Py_ssize_t elem_array_len;
+
+					elem_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
+					                                       &elem_array_len, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
+					                                       TRUE, TRUE, slot_name);
+
+					/* error is set above */
+					if (elem_array == NULL) {
+						return -1;
+					}
+
+					BMO_slot_buffer_alloc(bmop, bmop->slots_in, slot_name, elem_array_len);
+					memcpy(slot->data.buf, elem_array, sizeof(void *) * elem_array_len);
+					PyMem_FREE(elem_array);
+				}
+				else {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s: keyword \"%.200s\" expected "
+					             "a bmesh sequence, list, (htype, flag) pair, not %.200s",
+					             opname, slot_name, Py_TYPE(value)->tp_name);
+					return -1;
+				}
+			}
+			break;
+		}
+		case BMO_OP_SLOT_MAPPING:
+		{
+			/* first check types */
+			if (slot->slot_subtype.map != BMO_OP_SLOT_SUBTYPE_MAP_EMPTY) {
+				if (!PyDict_Check(value)) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s: keyword \"%.200s\" expected "
+					             "a dict, not %.200s",
+					             opname, slot_name, Py_TYPE(value)->tp_name);
+					return -1;
+				}
+			}
+			else {
+				if (!PySet_Check(value)) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s: keyword \"%.200s\" expected "
+					             "a set, not %.200s",
+					             opname, slot_name, Py_TYPE(value)->tp_name);
+					return -1;
+				}
+			}
+
+			switch (slot->slot_subtype.map) {
+				case BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
+				{
+					if (PyDict_Size(value) > 0) {
+						PyObject *arg_key, *arg_value;
+						Py_ssize_t arg_pos = 0;
+						while (PyDict_Next(value, &arg_pos, &arg_key, &arg_value)) {
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid key in dict") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_value, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid value in dict") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							BMO_slot_map_elem_insert(bmop, slot,
+							                         ((BPy_BMElem *)arg_key)->ele, ((BPy_BMElem *)arg_value)->ele);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_FLT:
+				{
+					if (PyDict_Size(value) > 0) {
+						PyObject *arg_key, *arg_value;
+						Py_ssize_t arg_pos = 0;
+						while (PyDict_Next(value, &arg_pos, &arg_key, &arg_value)) {
+							float value_f;
+
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid key in dict") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							value_f = PyFloat_AsDouble(arg_value);
+
+							if (value_f == -1.0f && PyErr_Occurred()) {
+								PyErr_Format(PyExc_TypeError,
+								             "%.200s: keyword \"%.200s\" expected "
+								             "a dict with float values, not %.200s",
+								             opname, slot_name, Py_TYPE(arg_value)->tp_name);
+								return -1;
+							}
+
+							BMO_slot_map_float_insert(bmop, slot,
+							                          ((BPy_BMElem *)arg_key)->ele, value_f);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_INT:
+				{
+					if (PyDict_Size(value) > 0) {
+						PyObject *arg_key, *arg_value;
+						Py_ssize_t arg_pos = 0;
+						while (PyDict_Next(value, &arg_pos, &arg_key, &arg_value)) {
+							int value_i;
+
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid key in dict") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							value_i = PyLong_AsLong(arg_value);
+
+							if (value_i == -1 && PyErr_Occurred()) {
+								PyErr_Format(PyExc_TypeError,
+								             "%.200s: keyword \"%.200s\" expected "
+								             "a dict with int values, not %.200s",
+								             opname, slot_name, Py_TYPE(arg_value)->tp_name);
+								return -1;
+							}
+
+							BMO_slot_map_int_insert(bmop, slot,
+							                        ((BPy_BMElem *)arg_key)->ele, value_i);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_BOOL:
+				{
+					if (PyDict_Size(value) > 0) {
+						PyObject *arg_key, *arg_value;
+						Py_ssize_t arg_pos = 0;
+						while (PyDict_Next(value, &arg_pos, &arg_key, &arg_value)) {
+							int value_i;
+
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid key in dict") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							value_i = PyLong_AsLong(arg_value);
+
+							if (value_i == -1 && PyErr_Occurred()) {
+								PyErr_Format(PyExc_TypeError,
+								             "%.200s: keyword \"%.200s\" expected "
+								             "a dict with bool values, not %.200s",
+								             opname, slot_name, Py_TYPE(arg_value)->tp_name);
+								return -1;
+							}
+
+							BMO_slot_map_bool_insert(bmop, slot,
+							                         ((BPy_BMElem *)arg_key)->ele, value_i != 0);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_EMPTY:
+				{
+					if (PySet_Size(value) > 0) {
+						PyObject *arg_key;
+						Py_ssize_t arg_pos = 0;
+						Py_ssize_t arg_hash = 0;
+						while (_PySet_NextEntry(value, &arg_pos, &arg_key, &arg_hash)) {
+
+							if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key, bm, BM_ALL_NOLOOP,
+							                                opname, slot_name, "invalid key in set") == -1)
+							{
+								return -1;  /* error is set in bpy_slot_from_py_elem_check() */
+							}
+
+							BMO_slot_map_empty_insert(bmop, slot,
+							                         ((BPy_BMElem *)arg_key)->ele);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
+				{
+					/* can't convert from these */
+					PyErr_Format(PyExc_NotImplementedError,
+					             "This arguments mapping subtype %d is not supported", slot->slot_subtype);
+					return -1;
+				}
+			}
+		}
+		default:
+			/* TODO --- many others */
+			PyErr_Format(PyExc_NotImplementedError,
+			             "%.200s: keyword \"%.200s\" type %d not working yet!",
+			             opname, slot_name, slot->slot_type);
+			return -1;
+	}
+
+	/* all is well */
+	return 0;
+}
+
+/**
+ * Use for getting return values from an operator thats already executed.
+ *
+ * \note Don't throw any exceptions and should always return a valid (PyObject *).
+ */
+static PyObject* bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
+{
+	PyObject *item = NULL;
+
+	/* keep switch in same order as above */
+	switch (slot->slot_type) {
+		case BMO_OP_SLOT_BOOL:
+			item = PyBool_FromLong((BMO_SLOT_AS_BOOL(slot)));
+			break;
+		case BMO_OP_SLOT_INT:
+			item = PyLong_FromLong(BMO_SLOT_AS_INT(slot));
+			break;
+		case BMO_OP_SLOT_FLT:
+			item = PyFloat_FromDouble((double)BMO_SLOT_AS_FLOAT(slot));
+			break;
+		case BMO_OP_SLOT_MAT:
+			item = Matrix_CreatePyObject((float *)BMO_SLOT_AS_MATRIX(slot), 4, 4, Py_NEW, NULL);
+			break;
+		case BMO_OP_SLOT_VEC:
+			item = Vector_CreatePyObject(BMO_SLOT_AS_VECTOR(slot), slot->len, Py_NEW, NULL);
+			break;
+		case BMO_OP_SLOT_PTR:
+			BLI_assert(0);  /* currently we don't have any pointer return values in use */
+			item = (Py_INCREF(Py_None), Py_None);
+			break;
+		case BMO_OP_SLOT_ELEMENT_BUF:
+		{
+			if (slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) {
+				BMHeader *ele = BMO_slot_buffer_get_single(slot);
+				item = ele ? BPy_BMElem_CreatePyObject(bm, ele) : (Py_INCREF(Py_None), Py_None);
+			}
+			else {
+				const int size = slot->len;
+				void **buffer = BMO_SLOT_AS_BUFFER(slot);
+				int j;
+
+				item = PyList_New(size);
+				for (j = 0; j < size; j++) {
+					BMHeader *ele = buffer[j];
+					PyList_SET_ITEM(item, j, BPy_BMElem_CreatePyObject(bm, ele));
+				}
+			}
+			break;
+		}
+		case BMO_OP_SLOT_MAPPING:
+		{
+			GHash *slot_hash = BMO_SLOT_AS_GHASH(slot);
+			GHashIterator hash_iter;
+
+			switch (slot->slot_subtype.map) {
+				case BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
+				{
+					item = PyDict_New();
+					if (slot_hash) {
+						GHASH_ITER (hash_iter, slot_hash) {
+							BMHeader       *ele_key = BLI_ghashIterator_getKey(&hash_iter);
+							BMOElemMapping *ele_val = BLI_ghashIterator_getValue(&hash_iter);
+
+							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
+							PyObject *py_val =  BPy_BMElem_CreatePyObject(bm, *(void **)BMO_OP_SLOT_MAPPING_DATA(ele_val));
+
+							PyDict_SetItem(item, py_key, py_val);
+							Py_DECREF(py_key);
+							Py_DECREF(py_val);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_FLT:
+				{
+					item = PyDict_New();
+					if (slot_hash) {
+						GHASH_ITER (hash_iter, slot_hash) {
+							BMHeader       *ele_key = BLI_ghashIterator_getKey(&hash_iter);
+							BMOElemMapping *ele_val = BLI_ghashIterator_getValue(&hash_iter);
+
+							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
+							PyObject *py_val =  PyFloat_FromDouble(*(float *)BMO_OP_SLOT_MAPPING_DATA(ele_val));
+
+							PyDict_SetItem(item, py_key, py_val);
+							Py_DECREF(py_key);
+							Py_DECREF(py_val);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_INT:
+				{
+					item = PyDict_New();
+					if (slot_hash) {
+						GHASH_ITER (hash_iter, slot_hash) {
+							BMHeader       *ele_key = BLI_ghashIterator_getKey(&hash_iter);
+							BMOElemMapping *ele_val = BLI_ghashIterator_getValue(&hash_iter);
+
+							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
+							PyObject *py_val =  PyLong_FromLong(*(int *)BMO_OP_SLOT_MAPPING_DATA(ele_val));
+
+							PyDict_SetItem(item, py_key, py_val);
+							Py_DECREF(py_key);
+							Py_DECREF(py_val);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_BOOL:
+				{
+					item = PyDict_New();
+					if (slot_hash) {
+						GHASH_ITER (hash_iter, slot_hash) {
+							BMHeader       *ele_key = BLI_ghashIterator_getKey(&hash_iter);
+							BMOElemMapping *ele_val = BLI_ghashIterator_getValue(&hash_iter);
+
+							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
+							PyObject *py_val =  PyBool_FromLong(*(int *)BMO_OP_SLOT_MAPPING_DATA(ele_val));
+
+							PyDict_SetItem(item, py_key, py_val);
+							Py_DECREF(py_key);
+							Py_DECREF(py_val);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_EMPTY:
+				{
+					item = PySet_New(NULL);
+					if (slot_hash) {
+						GHASH_ITER (hash_iter, slot_hash) {
+							BMHeader       *ele_key = BLI_ghashIterator_getKey(&hash_iter);
+
+							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
+
+							PySet_Add(item, py_key);
+
+							Py_DECREF(py_key);
+						}
+					}
+					break;
+				}
+				case BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
+					/* can't convert from these */
+					item = (Py_INCREF(Py_None), Py_None);
+					break;
+			}
+			break;
+		}
+	}
+	BLI_assert(item != NULL);
+
+	return item;
+}
+
+/**
+ * This is the __call__ for bmesh.ops.xxx()
+ */
+PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
+{
+	PyObject *ret;
+	BPy_BMesh *py_bm;
+	BMesh *bm;
+
+	BMOperator bmop;
+
+	if ((PyTuple_GET_SIZE(args) == 1) &&
+	    (py_bm = (BPy_BMesh *)PyTuple_GET_ITEM(args, 0)) &&
+	    (BPy_BMesh_Check(py_bm))
+		)
+	{
+		BPY_BM_CHECK_OBJ(py_bm);
+		bm = py_bm->bm;
+	}
+	else {
+		PyErr_SetString(PyExc_TypeError,
+		                "calling a bmesh operator expects a single BMesh (non keyword) "
+		                "as the first argument");
+		return NULL;
+	}
+
+	/* TODO - error check this!, though we do the error check on attribute access */
+	/* TODO - make flags optional */
+	BMO_op_init(bm, &bmop, BMO_FLAG_DEFAULTS, self->opname);
+
+	if (kw && PyDict_Size(kw) > 0) {
+		/* setup properties, see bpy_rna.c: pyrna_py_to_prop()
+		 * which shares this logic for parsing properties */
+
+		PyObject *key, *value;
+		Py_ssize_t pos = 0;
+		while (PyDict_Next(kw, &pos, &key, &value)) {
+			const char *slot_name = _PyUnicode_AsString(key);
+			BMOpSlot *slot;
+
+			if (!BMO_slot_exists(bmop.slots_in, slot_name)) {
+				PyErr_Format(PyExc_TypeError,
+				             "%.200s: keyword \"%.200s\" is invalid for this operator",
+				             self->opname, slot_name);
+				BMO_op_finish(bm, &bmop);
+				return NULL;
+			}
+
+			 slot = BMO_slot_get(bmop.slots_in, slot_name);
+
+			/* now assign the value */
+			if (bpy_slot_from_py(bm, &bmop, slot, value,
+			                     self->opname, slot_name) == -1)
+			{
+				BMO_op_finish(bm, &bmop);
+				return NULL;
+			}
+		}
+	}
+
+	BMO_op_exec(bm, &bmop);
+
+	/* from here until the end of the function, no returns, just set 'ret' */
+	if (UNLIKELY(bpy_bm_op_as_py_error(bm) == -1)) {
+		ret = NULL;  /* exception raised above */
+	}
+	else if (bmop.slots_out[0].slot_name == NULL) {
+		ret = (Py_INCREF(Py_None), Py_None);
+	}
+	else {
+		/* build return value */
+		int i;
+		ret = PyDict_New();
+
+		for (i = 0; bmop.slots_out[i].slot_name; i++) {
+			// BMOpDefine *op_def = opdefines[bmop.type];
+			// BMOSlotType *slot_type = op_def->slot_types_out[i];
+			BMOpSlot *slot = &bmop.slots_out[i];
+			PyObject *item;
+
+			/* this function doesn't throw exceptions */
+			item = bpy_slot_to_py(bm, slot);
+			if (item == NULL) {
+				item = (Py_INCREF(Py_None), Py_None);
+			}
+
+#if 1
+			/* temp code, strip off '.out' while we keep this convention */
+			{
+				char slot_name_strip[MAX_SLOTNAME];
+				char *ch = strchr(slot->slot_name, '.');  /* can't fail! */
+				int tot = ch - slot->slot_name;
+				BLI_assert(ch != NULL);
+				memcpy(slot_name_strip, slot->slot_name, tot);
+				slot_name_strip[tot] = '\0';
+				PyDict_SetItemString(ret, slot_name_strip, item);
+			}
+#else
+			PyDict_SetItemString(ret, slot->slot_name, item);
+#endif
+			Py_DECREF(item);
+		}
+	}
+
+	BMO_op_finish(bm, &bmop);
+	return ret;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.h b/source/blender/python/bmesh/bmesh_py_ops_call.h
new file mode 100644
index 0000000..d350aec
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.h
@@ -0,0 +1,41 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_ops_call.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_OPS_CALL_H__
+#define __BMESH_PY_OPS_CALL_H__
+
+typedef struct {
+	PyObject_HEAD /* required python macro   */
+	const char *opname;
+} BPy_BMeshOpFunc;
+
+
+PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw);
+
+#endif /* __BMESH_PY_OPS_CALL_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index fd5fa63..5db9962 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -541,12 +541,30 @@ static PyObject *bpy_bmloop_link_loop_prev_get(BPy_BMLoop *self)
 	return BPy_BMLoop_CreatePyObject(self->bm, self->l->prev);
 }
 
+PyDoc_STRVAR(bpy_bmloop_link_loop_radial_next_doc,
+"The next loop around the edge (read-only).\n\n:type: :class:`BMLoop`"
+);
+static PyObject *bpy_bmloop_link_loop_radial_next_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMLoop_CreatePyObject(self->bm, self->l->radial_next);
+}
+
+PyDoc_STRVAR(bpy_bmloop_link_loop_radial_prev_doc,
+"The previous loop around the edge (read-only).\n\n:type: :class:`BMLoop`"
+);
+static PyObject *bpy_bmloop_link_loop_radial_prev_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMLoop_CreatePyObject(self->bm, self->l->radial_prev);
+}
+
 /* ElemSeq
  * ^^^^^^^ */
 
 /* note: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly */
 PyDoc_STRVAR(bpy_bmelemseq_layers_doc,
-"blah blah (read-only).\n\n:type: :class:`BMLayerAccess`"
+"custom-data layers (read-only).\n\n:type: :class:`BMLayerAccess`"
 );
 static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
 {
@@ -555,6 +573,46 @@ static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
 	return BPy_BMLayerAccess_CreatePyObject(self->bm, GET_INT_FROM_POINTER(htype));
 }
 
+/* FaceSeq
+ * ^^^^^^^ */
+
+PyDoc_STRVAR(bpy_bmfaceseq_active_doc,
+"active face.\n\n:type: :class:`BMFace` or None"
+);
+static PyObject *bpy_bmfaceseq_active_get(BPy_BMElemSeq *self, void *UNUSED(closure))
+{
+	BMesh *bm = self->bm;
+	BPY_BM_CHECK_OBJ(self);
+
+	if (bm->act_face) {
+		return BPy_BMElem_CreatePyObject(bm, (BMHeader *)bm->act_face);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+static int bpy_bmfaceseq_active_set(BPy_BMElem *self, PyObject *value, void *UNUSED(closure))
+{
+	BMesh *bm = self->bm;
+	if (value == Py_None) {
+		bm->act_face = NULL;
+		return 0;
+	}
+	else if (BPy_BMFace_Check(value)) {
+		BPY_BM_CHECK_SOURCE_INT(value, bm, "faces.active = f");
+
+		bm->act_face = ((BPy_BMFace *)value)->f;
+		return 0;
+	}
+	else {
+		PyErr_Format(PyExc_TypeError,
+		             "faces.active = f: expected BMFace or None, not %.200s",
+		             Py_TYPE(value)->tp_name);
+		return -1;
+	}
+}
+
 static PyGetSetDef bpy_bmesh_getseters[] = {
 	{(char *)"verts", (getter)bpy_bmvertseq_get, (setter)NULL, (char *)bpy_bmvertseq_doc, NULL},
 	{(char *)"edges", (getter)bpy_bmedgeseq_get, (setter)NULL, (char *)bpy_bmedgeseq_doc, NULL},
@@ -645,7 +703,7 @@ static PyGetSetDef bpy_bmface_getseters[] = {
 
 static PyGetSetDef bpy_bmloop_getseters[] = {
 	/* generic */
-	// flags are available but not used for loops.
+	/* flags are available but not used for loops. */
 	// {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
 	// {(char *)"hide",   (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc,   (void *)BM_ELEM_HIDDEN},
 	{(char *)"tag",    (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc,    (void *)BM_ELEM_TAG},
@@ -659,6 +717,8 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
 	{(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmloops_link_loops_doc, (void *)BM_LOOPS_OF_LOOP},
 	{(char *)"link_loop_next", (getter)bpy_bmloop_link_loop_next_get, (setter)NULL, (char *)bpy_bmloop_link_loop_next_doc, NULL},
 	{(char *)"link_loop_prev", (getter)bpy_bmloop_link_loop_prev_get, (setter)NULL, (char *)bpy_bmloop_link_loop_prev_doc, NULL},
+	{(char *)"link_loop_radial_next", (getter)bpy_bmloop_link_loop_radial_next_get, (setter)NULL, (char *)bpy_bmloop_link_loop_radial_next_doc, NULL},
+	{(char *)"link_loop_radial_prev", (getter)bpy_bmloop_link_loop_radial_prev_get, (setter)NULL, (char *)bpy_bmloop_link_loop_radial_prev_doc, NULL},
 
 	/* readonly checks */
 	{(char *)"is_valid",   (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
@@ -668,7 +728,7 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
 
 static PyGetSetDef bpy_bmvertseq_getseters[] = {
 	{(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_VERT},
-		{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+	{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
 };
 static PyGetSetDef bpy_bmedgeseq_getseters[] = {
 	{(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_EDGE},
@@ -676,6 +736,8 @@ static PyGetSetDef bpy_bmedgeseq_getseters[] = {
 };
 static PyGetSetDef bpy_bmfaceseq_getseters[] = {
 	{(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_FACE},
+	/* face only */
+	{(char *)"active",    (getter)bpy_bmfaceseq_active_get, (setter)bpy_bmfaceseq_active_set, (char *)bpy_bmfaceseq_active_doc, NULL},
 	{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
 };
 static PyGetSetDef bpy_bmloopseq_getseters[] = {
@@ -801,34 +863,92 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
 	Py_RETURN_NONE;
 }
 
-/* note: rna_Object_to_mesh() also has apply_modifiers arg that works the same way */
 PyDoc_STRVAR(bpy_bmesh_from_object_doc,
-".. method:: from_object(mesh, apply_modifiers=True)\n"
+".. method:: from_object(object, scene, deform=True, render=False, cage=False)\n"
 "\n"
-"   Initialize this bmesh from existing object datablock.\n"
+"   Initialize this bmesh from existing object datablock (currently only meshes are supported).\n"
 "\n"
 "   :arg object: The object data to load.\n"
 "   :type object: :class:`Object`\n"
-"   :arg apply_modifiers: Use the final display mesh rather then the deformed cage.\n"
-"   :type apply_modifiers: boolean\n"
+"   :arg deform: Apply deformation modifiers.\n"
+"   :type deform: boolean\n"
+"   :arg render: Use render settings.\n"
+"   :type render: boolean\n"
+"   :arg cage: Get the mesh as a deformed cage.\n"
+"   :type cage: boolean\n"
 );
 static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
 {
 	PyObject *py_object;
+	PyObject *py_scene;
 	Object *ob;
+	struct Scene *scene;
 	BMesh *bm;
-	int apply_modifiers = TRUE;
+	int use_deform = TRUE;
+	int use_render = FALSE;
+	int use_cage   = FALSE;
 	DerivedMesh *dm;
+	const int mask = CD_MASK_BMESH;
 
 	BPY_BM_CHECK_OBJ(self);
 
-	if (!PyArg_ParseTuple(args, "O|i:from_object", &py_object, &apply_modifiers) ||
-	    !(ob = PyC_RNA_AsPointer(py_object, "Object")))
+	if (!PyArg_ParseTuple(args, "OO|iii:from_object", &py_object, &py_scene, &use_render, &use_cage) ||
+	    !(ob    = PyC_RNA_AsPointer(py_object, "Object")) ||
+	    !(scene = PyC_RNA_AsPointer(py_scene,  "Scene")))
 	{
 		return NULL;
 	}
 
-	dm = apply_modifiers ? ob->derivedFinal : ob->derivedDeform;
+	if (ob->type != OB_MESH) {
+		PyErr_SetString(PyExc_ValueError,
+		                "from_object(...): currently only mesh objects are supported");
+		return NULL;
+	}
+
+	/* Write the display mesh into the dummy mesh */
+	if (use_deform) {
+		if (use_render) {
+			if (use_cage) {
+				PyErr_SetString(PyExc_ValueError,
+				                "from_object(...): cage arg is unsupported when (render=True)");
+				return NULL;
+			}
+			else {
+				dm = mesh_create_derived_render(scene, ob, mask);
+			}
+		}
+		else {
+			if (use_cage) {
+				dm = mesh_get_derived_deform(scene, ob, mask);  /* ob->derivedDeform */
+			}
+			else {
+				dm = mesh_get_derived_final(scene, ob, mask);  /* ob->derivedFinal */
+			}
+		}
+	}
+	else {
+		/* !use_deform */
+		if (use_render) {
+			if (use_cage) {
+				PyErr_SetString(PyExc_ValueError,
+				                "from_object(...): cage arg is unsupported when (render=True)");
+				return NULL;
+			}
+			else {
+				dm = mesh_create_derived_no_deform_render(scene, ob, NULL, mask);
+			}
+		}
+		else {
+			if (use_cage) {
+				PyErr_SetString(PyExc_ValueError,
+				                "from_object(...): cage arg is unsupported when (deform=False, render=False)");
+				return NULL;
+			}
+			else {
+				dm = mesh_create_derived_no_deform(scene, ob, NULL, mask);
+			}
+		}
+	}
 
 	if (dm == NULL) {
 		PyErr_Format(PyExc_ValueError,
@@ -840,6 +960,8 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
 
 	DM_to_bmesh_ex(dm, bm);
 
+	dm->release(dm);
+
 	Py_RETURN_NONE;
 }
 
@@ -1172,13 +1294,7 @@ static PyObject *bpy_bmvert_copy_from_face_interp(BPy_BMVert *self, PyObject *ar
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(py_face);
-
-		if (py_face->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "BMVert.copy_from_face_interp(face): face is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(py_face, bm, "copy_from_face_interp()");
 
 		BM_vert_interp_from_face(bm, self->v, py_face->f);
 
@@ -1312,13 +1428,7 @@ static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value)
 		return NULL;
 	}
 
-	BPY_BM_CHECK_OBJ(value);
-
-	if (self->bm != value->bm) {
-		PyErr_SetString(PyExc_ValueError,
-		                "BMEdge.other_vert(vert): vert is from another mesh");
-		return NULL;
-	}
+	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "BMEdge.other_vert(vert)");
 
 	other = BM_edge_other_vert(self->e, value->v);
 
@@ -1372,13 +1482,7 @@ static PyObject *bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *ar
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(py_face);
-
-		if (py_face->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "BMFace.copy_from_face_interp(face): face is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(py_face, bm, "BMFace.copy_from_face_interp(face)");
 
 		BM_face_interp_from_face(bm, self->f, py_face->f);
 
@@ -1544,13 +1648,7 @@ static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *ar
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(py_face);
-
-		if (py_face->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "BMLoop.copy_from_face_interp(face): face is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(py_face, bm, "BMLoop.copy_from_face_interp(face)");
 
 		BM_loop_interp_from_face(bm, self->l, py_face->f, do_vertex, do_multires);
 
@@ -1648,7 +1746,7 @@ static PyObject *bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args)
 			return NULL;
 		}
 
-		v = BM_vert_create(bm, co, NULL);
+		v = BM_vert_create(bm, co, NULL, 0);
 
 		if (v == NULL) {
 			PyErr_SetString(PyExc_ValueError,
@@ -1717,7 +1815,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
 			goto cleanup;
 		}
 
-		e = BM_edge_create(bm, vert_array[0], vert_array[1], NULL, FALSE);
+		e = BM_edge_create(bm, vert_array[0], vert_array[1], NULL, 0);
 
 		if (e == NULL) {
 			PyErr_SetString(PyExc_ValueError,
@@ -1790,7 +1888,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
 		}
 
 		/* check if the face exists */
-		if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
+		if (BM_face_exists(vert_array, vert_seq_len, NULL)) {
 			PyErr_SetString(PyExc_ValueError,
 			                "faces.new(verts): face already exists");
 			goto cleanup;
@@ -1803,10 +1901,10 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
 
 		/* ensure edges */
 		for (i = vert_seq_len - 1, i_next = 0; i_next < vert_seq_len; (i = i_next++)) {
-			edge_array[i] = BM_edge_create(bm, vert_array[i], vert_array[i_next], NULL, TRUE);
+			edge_array[i] = BM_edge_create(bm, vert_array[i], vert_array[i_next], NULL, BM_CREATE_NO_DOUBLE);
 		}
 
-		f_new = BM_face_create(bm, vert_array, edge_array, vert_seq_len, FALSE);
+		f_new = BM_face_create(bm, vert_array, edge_array, vert_seq_len, 0);
 
 		if (UNLIKELY(f_new == NULL)) {
 			PyErr_SetString(PyExc_ValueError,
@@ -1846,13 +1944,7 @@ static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(value);
-
-		if (value->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "verts.remove(vert): vert is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(value, bm, "verts.remove(vert)");
 
 		BM_vert_kill(bm, value->v);
 		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
@@ -1876,13 +1968,7 @@ static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(value);
-
-		if (value->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "edges.remove(edge): edge is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(value, bm, "edges.remove(edges)");
 
 		BM_edge_kill(bm, value->e);
 		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
@@ -1906,13 +1992,7 @@ static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
 	else {
 		BMesh *bm = self->bm;
 
-		BPY_BM_CHECK_OBJ(value);
-
-		if (value->bm != bm) {
-			PyErr_SetString(PyExc_ValueError,
-			                "faces.remove(face): face is from another mesh");
-			return NULL;
-		}
+		BPY_BM_CHECK_SOURCE_OBJ(value, bm, "faces.remove(face)");
 
 		BM_face_kill(bm, value->f);
 		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
@@ -2012,7 +2092,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
 			return NULL;
 		}
 
-		if (BM_face_exists(bm, vert_array, vert_seq_len, &f)) {
+		if (BM_face_exists(vert_array, vert_seq_len, &f)) {
 			ret = BPy_BMFace_CreatePyObject(bm, f);
 		}
 		else {
@@ -2972,7 +3052,8 @@ void BPy_BM_init_types(void)
 	BPy_BMLoopSeq_Type.tp_methods = bpy_bmloopseq_methods;
 	BPy_BMIter_Type.tp_methods    = NULL;
 
-
+	/*BPy_BMElem_Check() uses bpy_bm_elem_hash() to check types.
+	 * if this changes update the macro */
 	BPy_BMesh_Type.tp_hash     = bpy_bm_hash;
 	BPy_BMVert_Type.tp_hash    = bpy_bm_elem_hash;
 	BPy_BMEdge_Type.tp_hash    = bpy_bm_elem_hash;
@@ -3306,6 +3387,7 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
 		case BM_LOOP:
 			return BPy_BMLoop_CreatePyObject(bm, (BMLoop *)ele);
 		default:
+			BLI_assert(0);
 			PyErr_SetString(PyExc_SystemError, "internal error");
 			return NULL;
 	}
@@ -3339,6 +3421,21 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
 	}
 }
 
+int bpy_bm_generic_valid_check_source(BPy_BMGeneric *self, BMesh *bm_source, const char *error_prefix)
+{
+	int ret = bpy_bm_generic_valid_check(self);
+	if (LIKELY(ret == 0)) {
+		if (UNLIKELY(self->bm != bm_source)) {
+			/* could give more info here */
+			PyErr_Format(PyExc_ValueError,
+			             "%.200s: BMesh data of type %.200s is from another mesh",
+			             error_prefix, Py_TYPE(self)->tp_name);
+			ret = -1;
+		}
+	}
+	return ret;
+}
+
 void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
 {
 	self->bm = NULL;
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index 947e66b..d15918a 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -55,6 +55,8 @@ extern PyTypeObject BPy_BMIter_Type;
 #define BPy_BMFaceSeq_Check(v)  (Py_TYPE(v) == &BPy_BMFaceSeq_Type)
 #define BPy_BMLoopSeq_Check(v)  (Py_TYPE(v) == &BPy_BMLoopSeq_Type)
 #define BPy_BMIter_Check(v)     (Py_TYPE(v) == &BPy_BMIter_Type)
+/* trick since we know they share a hash function */
+#define BPy_BMElem_Check(v)     (Py_TYPE(v)->tp_hash == BPy_BMVert_Type.tp_hash)
 
 /* cast from _any_ bmesh type - they all have BMesh first */
 typedef struct BPy_BMGeneric {
@@ -116,7 +118,7 @@ typedef struct BPy_BMElemSeq {
 
 	/* if this is a sequence on an existing element,
 	 * loops of faces for eg.
-	 * If this veriable is set, it will be used */
+	 * If this variable is set, it will be used */
 
 	/* we hold a reference to this.
 	 * check in case the owner becomes invalid on access */
@@ -156,9 +158,6 @@ PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
 
 PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks type and creates v/e/f/l */
 
-int  bpy_bm_generic_valid_check(BPy_BMGeneric *self);
-void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
-
 void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
                                 const char htype,
                                 const char do_unique_check, const char do_bm_check,
@@ -169,9 +168,20 @@ int       BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
 char     *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
 char     *BPy_BMElem_StringFromHType(const char htype);
 
-
-#define BPY_BM_CHECK_OBJ(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
-#define BPY_BM_CHECK_INT(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return -1; }   (void)0
+void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
+int  bpy_bm_generic_valid_check(BPy_BMGeneric *self);
+int  bpy_bm_generic_valid_check_source(BPy_BMGeneric *self, BMesh *bm_source, const char *error_prefix);
+
+#define BPY_BM_CHECK_OBJ(obj) \
+	if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
+#define BPY_BM_CHECK_INT(obj) \
+	if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return -1; }   (void)0
+
+/* macros like BPY_BM_CHECK_OBJ/BPY_BM_CHECK_INT that ensure we're from the right BMesh */
+#define BPY_BM_CHECK_SOURCE_OBJ(obj, bm, errmsg) \
+	if (UNLIKELY(bpy_bm_generic_valid_check_source((BPy_BMGeneric *)obj, bm, errmsg) == -1)) { return NULL; } (void)0
+#define BPY_BM_CHECK_SOURCE_INT(obj, bm, errmsg) \
+	if (UNLIKELY(bpy_bm_generic_valid_check_source((BPy_BMGeneric *)obj, bm, errmsg) == -1)) { return -1; }   (void)0
 
 #define BPY_BM_IS_VALID(obj) (LIKELY((obj)->bm != NULL))
 
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 0391839..fd31f3c 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -262,16 +262,10 @@ static PyObject *bpy_bmlayeritem_copy_from(BPy_BMLayerItem *self, BPy_BMLayerIte
 	}
 
 	BPY_BM_CHECK_OBJ(self);
-	BPY_BM_CHECK_OBJ(value);
-
-	if (self->bm != value->bm) {
-		PyErr_SetString(PyExc_ValueError,
-		                "layer.copy_from(): layer is from another mesh");
-		return NULL;
-	}
+	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "layer.copy_from()");
 
-	else if ((self->htype != value->htype) ||
-	         (self->type  != value->type))
+	if ((self->htype != value->htype) ||
+	    (self->type  != value->type))
 	{
 		PyErr_SetString(PyExc_ValueError,
 		                "layer.copy_from(other): layer type mismatch");
@@ -981,7 +975,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
 		}
 		case CD_PROP_INT:
 		{
-			ret = PyLong_FromSsize_t((Py_ssize_t)(*(int *)value));
+			ret = PyLong_FromLong(*(int *)value);
 			break;
 		}
 		case CD_PROP_STR:
@@ -1060,7 +1054,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
 		}
 		case CD_PROP_INT:
 		{
-			int tmp_val = PyLong_AsSsize_t(py_value);
+			int tmp_val = PyLong_AsLong(py_value);
 			if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
 				PyErr_Format(PyExc_TypeError, "expected an int, not a %.200s", Py_TYPE(py_value)->tp_name);
 				ret = -1;
@@ -1079,7 +1073,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
 				ret = -1;
 			}
 			else {
-				BLI_strncpy(mstring->s, tmp_val, MIN2(PyBytes_Size(py_value), sizeof(mstring->s)));
+				BLI_strncpy(mstring->s, tmp_val, min_ii(PyBytes_Size(py_value), sizeof(mstring->s)));
 			}
 			break;
 		}
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 8316d33..b087057 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -527,7 +527,7 @@ static PyObject *bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
 
 	ret = PyList_New(self->data->totweight);
 	for (i = 0; i < self->data->totweight; i++, dw++) {
-		PyList_SET_ITEM(ret, i, PyLong_FromSsize_t(dw->def_nr));
+		PyList_SET_ITEM(ret, i, PyLong_FromLong(dw->def_nr));
 	}
 
 	return ret;
@@ -576,7 +576,7 @@ static PyObject *bpy_bmdeformvert_items(BPy_BMDeformVert *self)
 	for (i = 0; i < self->data->totweight; i++, dw++) {
 		item = PyTuple_New(2);
 
-		PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(dw->def_nr));
+		PyTuple_SET_ITEM(item, 0, PyLong_FromLong(dw->def_nr));
 		PyTuple_SET_ITEM(item, 1, PyFloat_FromDouble(dw->weight));
 
 		PyList_SET_ITEM(ret, i, item);
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index 8509559..dfcfbeb 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -114,13 +114,7 @@ static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
 		return NULL;
 	}
 
-	BPY_BM_CHECK_OBJ(value);
-
-	if (self->bm != value->bm) {
-		PyErr_SetString(PyExc_ValueError,
-		                "Element is not from this mesh");
-		return NULL;
-	}
+	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.add()");
 
 	BM_select_history_store(self->bm, value->ele);
 
@@ -145,11 +139,9 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val
 		return NULL;
 	}
 
-	BPY_BM_CHECK_OBJ(value);
+	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.remove()");
 
-	if ((self->bm != value->bm) ||
-	    (BM_select_history_remove(self->bm, value->ele) == FALSE))
-	{
+	if (BM_select_history_remove(self->bm, value->ele) == FALSE) {
 		PyErr_SetString(PyExc_ValueError,
 		                "Element not found in selection history");
 		return NULL;
@@ -387,7 +379,7 @@ void BPy_BM_init_types_select(void)
 	BPy_BMEditSelSeq_Type.tp_name  = "BMEditSelSeq";
 	BPy_BMEditSelIter_Type.tp_name = "BMEditSelIter";
 
-	BPy_BMEditSelSeq_Type.tp_doc   = NULL; // todo
+	BPy_BMEditSelSeq_Type.tp_doc   = NULL; /* todo */
 	BPy_BMEditSelIter_Type.tp_doc  = NULL;
 
 	BPy_BMEditSelSeq_Type.tp_repr  = (reprfunc)NULL;
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index b70df53..f85c334 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -557,16 +557,10 @@ static PyObject *bpy_bm_utils_face_vert_separate(PyObject *UNUSED(self), PyObjec
 		return NULL;
 	}
 
-	BPY_BM_CHECK_OBJ(py_face);
-	BPY_BM_CHECK_OBJ(py_vert);
-
 	bm = py_face->bm;
 
-	if (bm != py_vert->bm) {
-		PyErr_SetString(PyExc_ValueError,
-		                "mesh elements are from different meshes");
-		return NULL;
-	}
+	BPY_BM_CHECK_OBJ(py_face);
+	BPY_BM_CHECK_SOURCE_OBJ(py_vert, bm, "face_vert_separate()");
 
 	l = BM_face_vert_share_loop(py_face->f, py_vert->v);
 
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 45b767c..22b9c1a 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -520,7 +520,7 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -556,7 +556,7 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -613,15 +613,15 @@ static PyObject *Buffer_repr(Buffer *self)
 }
 
 
-BGL_Wrap(2, Accum,          void,     (GLenum, GLfloat))
-BGL_Wrap(1, ActiveTexture,  void,     (GLenum))
-BGL_Wrap(2, AlphaFunc,      void,     (GLenum, GLclampf))
+BGL_Wrap(2, Accum,          void,       (GLenum, GLfloat))
+BGL_Wrap(1, ActiveTexture,  void,       (GLenum))
+BGL_Wrap(2, AlphaFunc,      void,       (GLenum, GLclampf))
 BGL_Wrap(3, AreTexturesResident,  GLboolean,  (GLsizei, GLuintP, GLbooleanP))
 BGL_Wrap(2, AttachShader,   void,       (GLuint, GLuint))
-BGL_Wrap(1, Begin,          void,     (GLenum))
-BGL_Wrap(2, BindTexture,    void,   (GLenum, GLuint))
-BGL_Wrap(7, Bitmap,         void,     (GLsizei, GLsizei, GLfloat,
-                                       GLfloat, GLfloat, GLfloat, GLubyteP))
+BGL_Wrap(1, Begin,          void,       (GLenum))
+BGL_Wrap(2, BindTexture,    void,       (GLenum, GLuint))
+BGL_Wrap(7, Bitmap,         void,       (GLsizei, GLsizei, GLfloat,
+                                         GLfloat, GLfloat, GLfloat, GLubyteP))
 BGL_Wrap(2, BlendFunc,        void,     (GLenum, GLenum))
 BGL_Wrap(1, CallList,         void,     (GLuint))
 BGL_Wrap(3, CallLists,        void,     (GLsizei, GLenum, GLvoidP))
@@ -675,7 +675,7 @@ BGL_Wrap(1, CullFace,         void,     (GLenum))
 BGL_Wrap(2, DeleteLists,      void,     (GLuint, GLsizei))
 BGL_Wrap(1, DeleteProgram,    void,     (GLuint))
 BGL_Wrap(1, DeleteShader,     void,     (GLuint))
-BGL_Wrap(2, DeleteTextures,   void,   (GLsizei, GLuintP))
+BGL_Wrap(2, DeleteTextures,   void,     (GLsizei, GLuintP))
 BGL_Wrap(1, DepthFunc,        void,     (GLenum))
 BGL_Wrap(1, DepthMask,        void,     (GLboolean))
 BGL_Wrap(2, DepthRange,       void,     (GLclampd, GLclampd))
@@ -773,7 +773,7 @@ BGL_Wrap(3, Lighti,         void,     (GLenum, GLenum, GLint))
 BGL_Wrap(3, Lightiv,        void,     (GLenum, GLenum, GLintP))
 BGL_Wrap(2, LineStipple,    void,     (GLint, GLushort))
 BGL_Wrap(1, LineWidth,      void,     (GLfloat))
-BGL_Wrap(1, LinkProgram,   void,      (GLuint))
+BGL_Wrap(1, LinkProgram,    void,     (GLuint))
 BGL_Wrap(1, ListBase,       void,     (GLuint))
 BGL_Wrap(1, LoadIdentity,   void,     (void))
 BGL_Wrap(1, LoadMatrixd,    void,     (GLdoubleP))
@@ -1907,9 +1907,9 @@ PyObject *BPyInit_bgl(void)
 	return submodule;
 }
 
-static PyObject *Method_ShaderSource (PyObject *UNUSED(self), PyObject *args)
+static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
 {
-	int shader;
+	unsigned int shader;
 	char *source;
 
 	if (!PyArg_ParseTuple(args, "Is", &shader, &source))
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index b9ef4b0..8d146be 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -56,8 +56,22 @@ static ListBase bpy_import_main_list;
 
 static PyMethodDef bpy_import_meth;
 static PyMethodDef bpy_reload_meth;
+static PyObject   *imp_reload_orig = NULL;
 
 /* 'builtins' is most likely PyEval_GetBuiltins() */
+
+/**
+ * \note to the discerning developer, yes - this is nasty
+ * monkey-patching our own import into Python's builtin 'imp' module.
+ *
+ * However Python's alternative is to use import hooks,
+ * which are implemented in a way that we can't use our own importer as a
+ * fall-back (instead we must try and fail - raise an exception evert time).
+ * Since importing from blenders text-blocks is not the common case
+ * I prefer to use Pythons import by default and fall-back to
+ * Blenders - which we can only do by intercepting import calls I'm afraid.
+ * - Campbell
+ */
 void bpy_import_init(PyObject *builtins)
 {
 	PyObject *item;
@@ -69,7 +83,13 @@ void bpy_import_init(PyObject *builtins)
 	 * XXX, use import hooks */
 	mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
 	if (mod) {
-		PyDict_SetItemString(PyModule_GetDict(mod), "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+		PyObject *mod_dict = PyModule_GetDict(mod);
+
+		/* blender owns the function */
+		imp_reload_orig = PyDict_GetItemString(mod_dict, "reload");
+		Py_INCREF(imp_reload_orig);
+
+		PyDict_SetItemString(mod_dict, "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
 		Py_DECREF(mod);
 	}
 	else {
@@ -309,7 +329,12 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
 	int found = 0;
 
 	/* try reimporting from file */
-	newmodule = PyImport_ReloadModule(module);
+
+	/* in Py3.3 this just calls imp.reload() which we overwrite, causing recursive calls */
+	//newmodule = PyImport_ReloadModule(module);
+
+	newmodule = PyObject_CallFunctionObjArgs(imp_reload_orig, module, NULL);
+
 	if (newmodule)
 		return newmodule;
 
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 06b6192..53112d4 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -43,43 +43,39 @@
 #include "py_capi_utils.h"
 #endif
 
-extern PyTypeObject BPy_IDArray_Type;
-extern PyTypeObject BPy_IDGroup_Iter_Type;
-extern PyTypeObject BPy_IDGroup_Type;
-
 /*********************** ID Property Main Wrapper Stuff ***************/
 
 /* ----------------------------------------------------------------------------
  * static conversion functions to avoid duplicate code, no type checking.
  */
 
-static PyObject *idprop_py_from_idp_string(IDProperty *prop)
+static PyObject *idprop_py_from_idp_string(const IDProperty *prop)
 {
 	if (prop->subtype == IDP_STRING_SUB_BYTE) {
-		return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len);
+		return PyBytes_FromStringAndSize(IDP_String(prop), prop->len);
 	}
 	else {
 #ifdef USE_STRING_COERCE
 		return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
 #else
-		return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
+		return PyUnicode_FromStringAndSize(IDP_String(prop), prop->len - 1);
 #endif
 	}
 }
 
-static PyObject *idprop_py_from_idp_int(IDProperty *prop)
+static PyObject *idprop_py_from_idp_int(const IDProperty *prop)
 {
-	return PyLong_FromLong((long)prop->data.val);
+	return PyLong_FromLong((long)IDP_Int(prop));
 }
 
-static PyObject *idprop_py_from_idp_float(IDProperty *prop)
+static PyObject *idprop_py_from_idp_float(const IDProperty *prop)
 {
-	return PyFloat_FromDouble((double)(*(float *)(&prop->data.val)));
+	return PyFloat_FromDouble((double)IDP_Float(prop));
 }
 
-static PyObject *idprop_py_from_idp_double(IDProperty *prop)
+static PyObject *idprop_py_from_idp_double(const IDProperty *prop)
 {
-	return PyFloat_FromDouble((*(double *)(&prop->data.val)));
+	return PyFloat_FromDouble(IDP_Double(prop));
 }
 
 static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent)
@@ -193,7 +189,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 				PyErr_SetString(PyExc_TypeError, "expected an int type");
 				return -1;
 			}
-			prop->data.val = ivalue;
+			IDP_Int(prop) = ivalue;
 			break;
 		}
 		case IDP_FLOAT:
@@ -203,7 +199,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			*(float *)&self->prop->data.val = fvalue;
+			IDP_Float(self->prop) = fvalue;
 			break;
 		}
 		case IDP_DOUBLE:
@@ -213,7 +209,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			*(double *)&self->prop->data.val = dvalue;
+			IDP_Double(self->prop) = dvalue;
 			break;
 		}
 		default:
@@ -253,7 +249,7 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS
 #if 0
 static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
 {
-	return PyLong_FromSsize_t(self->prop->type);
+	return PyLong_FromLong(self->prop->type);
 }
 #endif
 
@@ -300,40 +296,34 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
 }
 
 /* returns NULL on success, error string on failure */
-static int idp_sequence_type(PyObject *seq)
+static int idp_sequence_type(PyObject *seq_fast)
 {
 	PyObject *item;
 	int type = IDP_INT;
 
-	Py_ssize_t i, len = PySequence_Size(seq);
+	Py_ssize_t i, len = PySequence_Fast_GET_SIZE(seq_fast);
 	for (i = 0; i < len; i++) {
-		item = PySequence_GetItem(seq, i);
+		item = PySequence_Fast_GET_ITEM(seq_fast, i);
 		if (PyFloat_Check(item)) {
 			if (type == IDP_IDPARRAY) { /* mixed dict/int */
-				Py_DECREF(item);
 				return -1;
 			}
 			type = IDP_DOUBLE;
 		}
 		else if (PyLong_Check(item)) {
 			if (type == IDP_IDPARRAY) { /* mixed dict/int */
-				Py_DECREF(item);
 				return -1;
 			}
 		}
 		else if (PyMapping_Check(item)) {
 			if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
-				Py_DECREF(item);
 				return -1;
 			}
 			type = IDP_IDPARRAY;
 		}
 		else {
-			Py_XDECREF(item);
 			return -1;
 		}
-
-		Py_DECREF(item);
 	}
 
 	return type;
@@ -361,7 +351,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 		prop = IDP_New(IDP_DOUBLE, &val, name);
 	}
 	else if (PyLong_Check(ob)) {
-		val.i = (int) PyLong_AsSsize_t(ob);
+		val.i = (int)PyLong_AsLong(ob);
 		prop = IDP_New(IDP_INT, &val, name);
 	}
 	else if (PyUnicode_Check(ob)) {
@@ -386,48 +376,61 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 		//prop->subtype = IDP_STRING_SUB_BYTE;
 	}
 	else if (PySequence_Check(ob)) {
+		PyObject *ob_seq_fast = PySequence_Fast(ob, "py -> idprop");
 		PyObject *item;
 		int i;
 
-		if ((val.array.type = idp_sequence_type(ob)) == -1)
+		if (ob_seq_fast == NULL) {
+			PyErr_Print();
+			PyErr_Clear();
+			return "error converting the sequence";
+		}
+
+		if ((val.array.type = idp_sequence_type(ob_seq_fast)) == -1) {
+			Py_DECREF(ob_seq_fast);
 			return "only floats, ints and dicts are allowed in ID property arrays";
+		}
 
 		/* validate sequence and derive type.
 		 * we assume IDP_INT unless we hit a float
 		 * number; then we assume it's */
 
-		val.array.len = PySequence_Size(ob);
+		val.array.len = PySequence_Fast_GET_SIZE(ob_seq_fast);
 
 		switch (val.array.type) {
 			case IDP_DOUBLE:
 				prop = IDP_New(IDP_ARRAY, &val, name);
 				for (i = 0; i < val.array.len; i++) {
-					item = PySequence_GetItem(ob, i);
+					item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
 					((double *)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
-					Py_DECREF(item);
 				}
 				break;
 			case IDP_INT:
 				prop = IDP_New(IDP_ARRAY, &val, name);
 				for (i = 0; i < val.array.len; i++) {
-					item = PySequence_GetItem(ob, i);
-					((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
-					Py_DECREF(item);
+					item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
+					((int *)IDP_Array(prop))[i] = (int)PyLong_AsLong(item);
 				}
 				break;
 			case IDP_IDPARRAY:
 				prop = IDP_NewIDPArray(name);
 				for (i = 0; i < val.array.len; i++) {
 					const char *error;
-					item = PySequence_GetItem(ob, i);
+					item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
 					error = BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
-					Py_DECREF(item);
 
-					if (error)
+					if (error) {
+						Py_DECREF(ob_seq_fast);
 						return error;
+					}
 				}
 				break;
+			default:
+				Py_DECREF(ob_seq_fast);
+				return "internal error with idp array.type";
 		}
+
+		Py_DECREF(ob_seq_fast);
 	}
 	else if (PyMapping_Check(ob)) {
 		PyObject *keys, *vals, *key, *pval;
@@ -471,7 +474,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 
 	if (group->type == IDP_IDPARRAY) {
 		IDP_AppendArray(group, prop);
-		// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
+		// IDP_FreeProperty(item);  /* IDP_AppendArray does a shallow copy (memcpy), only free memory */
 		MEM_freeN(prop);
 	}
 	else {
@@ -802,17 +805,28 @@ static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
 	PyObject *pkey, *pval;
 	Py_ssize_t i = 0;
 
-	if (!PyDict_Check(value)) {
+	if (BPy_IDGroup_Check(value)) {
+		BPy_IDProperty *other = (BPy_IDProperty *)value;
+		if (UNLIKELY(self->prop == other->prop)) {
+			Py_RETURN_NONE;
+		}
+
+		/* XXX, possible one is inside the other */
+		IDP_MergeGroup(self->prop, other->prop, TRUE);
+	}
+	else if (PyDict_Check(value)) {
+		while (PyDict_Next(value, &i, &pkey, &pval)) {
+			BPy_IDGroup_Map_SetItem(self, pkey, pval);
+			if (PyErr_Occurred()) return NULL;
+		}
+	}
+	else {
 		PyErr_Format(PyExc_TypeError,
-		             "expected a dict not a %.200s",
+		             "expected a dict or an IDPropertyGroup type, not a %.200s",
 		             Py_TYPE(value)->tp_name);
 		return NULL;
 	}
 
-	while (PyDict_Next(value, &i, &pkey, &pval)) {
-		BPy_IDGroup_Map_SetItem(self, pkey, pval);
-		if (PyErr_Occurred()) return NULL;
-	}
 
 	Py_RETURN_NONE;
 }
@@ -1058,7 +1072,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
 			((double *)IDP_Array(self->prop))[index] = d;
 			break;
 		case IDP_INT:
-			i = PyLong_AsSsize_t(value);
+			i = PyLong_AsLong(value);
 			if (i == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected an int type");
 				return -1;
@@ -1173,7 +1187,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -1208,7 +1222,7 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -1416,15 +1430,15 @@ void IDProp_Init_Types(void)
 /* --- */
 
 static struct PyModuleDef IDProp_types_module_def = {
-    PyModuleDef_HEAD_INIT,
-    "idprop.types",  /* m_name */
-    NULL,  /* m_doc */
-    0,  /* m_size */
-    NULL,  /* m_methods */
-    NULL,  /* m_reload */
-    NULL,  /* m_traverse */
-    NULL,  /* m_clear */
-    NULL,  /* m_free */
+	PyModuleDef_HEAD_INIT,
+	"idprop.types",  /* m_name */
+	NULL,  /* m_doc */
+	0,  /* m_size */
+	NULL,  /* m_methods */
+	NULL,  /* m_reload */
+	NULL,  /* m_traverse */
+	NULL,  /* m_clear */
+	NULL,  /* m_free */
 };
 
 static PyObject *BPyInit_idprop_types(void)
@@ -1483,3 +1497,40 @@ PyObject *BPyInit_idprop(void)
 
 	return mod;
 }
+
+
+#ifdef DEBUG
+/* -------------------------------------------------------------------- */
+/* debug only function */
+
+void IDP_spit(IDProperty *prop)
+{
+	if (prop) {
+		PyGILState_STATE gilstate;
+		int use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
+		PyObject *ret_dict;
+		PyObject *ret_str;
+
+		if (use_gil) {
+			gilstate = PyGILState_Ensure();
+		}
+
+		/* to_dict() */
+		ret_dict = BPy_IDGroup_MapDataToPy(prop);
+		ret_str = PyObject_Repr(ret_dict);
+		Py_DECREF(ret_dict);
+
+		printf("IDProperty: %s\n", _PyUnicode_AsString(ret_str));
+
+		Py_DECREF(ret_str);
+
+		if (use_gil) {
+			PyGILState_Release(gilstate);
+		}
+	}
+	else {
+		printf("IDProperty: <NIL>\n");
+	}
+}
+
+#endif
diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h
index 99e291f..cb82676 100644
--- a/source/blender/python/generic/idprop_py_api.h
+++ b/source/blender/python/generic/idprop_py_api.h
@@ -32,6 +32,17 @@ struct ID;
 struct IDProperty;
 struct BPy_IDGroup_Iter;
 
+extern PyTypeObject BPy_IDArray_Type;
+extern PyTypeObject BPy_IDGroup_Iter_Type;
+extern PyTypeObject BPy_IDGroup_Type;
+
+#define BPy_IDArray_Check(v)			(PyObject_TypeCheck(v, &BPy_IDArray_Type))
+#define BPy_IDArray_CheckExact(v)		(Py_TYPE(v) == &BPy_IDArray_Type)
+#define BPy_IDGroup_Iter_Check(v)		(PyObject_TypeCheck(v, &BPy_IDGroup_Iter_Type))
+#define BPy_IDGroup_Iter_CheckExact(v)	(Py_TYPE(v) == &BPy_IDGroup_Iter_Type)
+#define BPy_IDGroup_Check(v)			(PyObject_TypeCheck(v, &BPy_IDGroup_Type))
+#define BPy_IDGroup_CheckExact(v)		(Py_TYPE(v) == &BPy_IDGroup_Type)
+
 typedef struct BPy_IDProperty {
 	PyObject_VAR_HEAD
 	struct ID *id;           /* can be NULL */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 9492c83..f62fdaf 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
 		/* could use is_double for 'long int' but no use now */
 		int *array_int = array;
 		for (i = 0; i < length; i++) {
-			array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
+			array_int[i] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i));
 		}
 	}
 	else if (type == &PyBool_Type) {
 		int *array_bool = array;
 		for (i = 0; i < length; i++) {
-			array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
+			array_bool[i] = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
 		}
 	}
 	else {
@@ -504,7 +504,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
 	 * but current Python lib (release 3.1.1) doesn't handle these correctly */
 	if (strchr(py_path_bundle, ':'))
 		printf("Warning : Blender application is located in a path containing : or / chars\
-			   \nThis may make python import function fail\n");
+		       \nThis may make python import function fail\n");
 #endif
 
 
@@ -542,7 +542,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 	if (fp) {
 		PyGILState_STATE gilstate = PyGILState_Ensure();
 
-		va_list vargs;	
+		va_list vargs;
 
 		int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
 		int i;
@@ -567,7 +567,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 			ret = PyObject_CallFunction(calcsize, (char *)"s", format);
 
 			if (ret) {
-				sizes[i] = PyLong_AsSsize_t(ret);
+				sizes[i] = PyLong_AsLong(ret);
 				Py_DECREF(ret);
 				ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
 			}
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 604166e..61c4902 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -30,12 +30,12 @@ set(INC
 	../../blenlib
 	../../blenloader
 	../../editors/include
+	../../gpu
 	../../makesdna
 	../../makesrna
 	../../windowmanager
-	../../gpu
-	../../../../intern/guardedalloc
 	../../../../intern/cycles/blender
+	../../../../intern/guardedalloc
 )
 
 set(INC_SYS
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 3bf44e4..3ed662f 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -32,6 +32,9 @@
 
 #include <Python.h>
 
+#include "RNA_types.h"
+#include "RNA_access.h"
+
 #include "bpy.h" 
 #include "bpy_util.h" 
 #include "bpy_rna.h"
@@ -49,8 +52,6 @@
 #include "BKE_global.h" /* XXX, G.main only */
 #include "BKE_blender.h"
 
-#include "RNA_access.h"
-
 #include "MEM_guardedalloc.h"
 
 /* external util modules */
@@ -278,7 +279,7 @@ void BPy_init_modules(void)
 	bpy_import_test("bpy_types");
 	PyModule_AddObject(mod, "data", BPY_rna_module()); /* imports bpy_types by running this */
 	bpy_import_test("bpy_types");
-	PyModule_AddObject(mod, "props", BPY_rna_props());	
+	PyModule_AddObject(mod, "props", BPY_rna_props());
 	/* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
 	PyModule_AddObject(mod, "ops", BPY_operator_module());
 	PyModule_AddObject(mod, "app", BPY_app_struct());
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index ccce0d8..b1eeff8 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -195,12 +195,12 @@ PyDoc_STRVAR(bpy_app_debug_value_doc,
 );
 static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
 {
-	return PyLong_FromSsize_t(G.debug_value);
+	return PyLong_FromLong(G.debug_value);
 }
 
 static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
 {
-	int param = PyLong_AsSsize_t(value);
+	int param = PyLong_AsLong(value);
 
 	if (param == -1 && PyErr_Occurred()) {
 		PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
@@ -242,6 +242,7 @@ static PyGetSetDef bpy_app_getsets[] = {
 	{(char *)"debug_ffmpeg", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_FFMPEG},
 	{(char *)"debug_python", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_PYTHON},
 	{(char *)"debug_events", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_EVENTS},
+	{(char *)"debug_handlers", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_HANDLERS},
 	{(char *)"debug_wm",     bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_WM},
 
 	{(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL},
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 4d7f208..90a0444 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -284,7 +284,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
 	if (PyList_GET_SIZE(cb_list) > 0) {
 		PyGILState_STATE gilstate = PyGILState_Ensure();
 
-		PyObject *args = PyTuple_New(1); // save python creating each call
+		PyObject *args = PyTuple_New(1);  /* save python creating each call */
 		PyObject *func;
 		PyObject *ret;
 		Py_ssize_t pos;
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index de23b3b..9a79616 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -280,7 +280,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
 	}
 
 
-#if 0 // slow, with this can avoid all Py_CompileString above.
+#if 0  /* slow, with this can avoid all Py_CompileString above. */
 	/* execute expression to get a value */
 	retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
 #else
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index b628f42..cdecf64 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -69,7 +69,7 @@
 
 #include "BPY_extern.h"
 
-#include "../generic/bpy_internal_import.h" // our own imports
+#include "../generic/bpy_internal_import.h"  /* our own imports */
 #include "../generic/py_capi_utils.h"
 
 /* inittab initialization functions */
@@ -180,10 +180,10 @@ void BPY_text_free_code(Text *text)
 
 void BPY_modules_update(bContext *C)
 {
-#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
+#if 0  /* slow, this runs all the time poll, draw etc 100's of time a sec. */
 	PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
 	PyModule_AddObject(mod, "data", BPY_rna_module());
-	PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating
+	PyModule_AddObject(mod, "types", BPY_rna_types());  /* atm this does not need updating */
 #endif
 
 	/* refreshes the main struct */
@@ -268,7 +268,24 @@ void BPY_python_start(int argc, const char **argv)
 
 	Py_Initialize();
 
-	// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
+	/* THIS IS BAD: see http://bugs.python.org/issue16129 */
+#if 1
+	/* until python provides a reliable way to set the env var */
+	PyRun_SimpleString("import sys, io\n"
+	                   "sys.__backup_stdio__ = sys.__stdout__, sys.__stderr__\n"  /* else we loose the FD's [#32720] */
+	                   "sys.__stdout__ = sys.stdout = io.TextIOWrapper(io.open(sys.stdout.fileno(), 'wb', -1), "
+	                   "encoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n"
+	                   "sys.__stderr__ = sys.stderr = io.TextIOWrapper(io.open(sys.stderr.fileno(), 'wb', -1), "
+	                   "encoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n");
+	if (PyErr_Occurred()) {
+		PyErr_Print();
+		PyErr_Clear();
+	}
+#endif
+	/* end the baddness */
+
+
+	// PySys_SetArgv(argc, argv);  /* broken in py3, not a huge deal */
 	/* sigh, why do python guys not have a (char **) version anymore? */
 	{
 		int i;
@@ -510,6 +527,18 @@ void BPY_DECREF(void *pyob_ptr)
 	PyGILState_Release(gilstate);
 }
 
+void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr)
+{
+	PyGILState_STATE gilstate = PyGILState_Ensure();
+	const int do_invalidate = (Py_REFCNT((PyObject *)pyob_ptr) > 1);
+	Py_DECREF((PyObject *)pyob_ptr);
+	if (do_invalidate) {
+		pyrna_invalidate(pyob_ptr);
+	}
+	PyGILState_Release(gilstate);
+}
+
+
 /* return -1 on error, else 0 */
 int BPY_button_exec(bContext *C, const char *expr, double *value, const short verbose)
 {
@@ -589,7 +618,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
 		}
 	}
 
-	PyC_MainModule_Backup(&main_mod);
+	PyC_MainModule_Restore(main_mod);
 	
 	bpy_context_clear(C, &gilstate);
 	
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 7c8291d..70ea57b 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -38,6 +38,8 @@ PyObject *bpy_intern_str_bl_rna;
 PyObject *bpy_intern_str_order;
 PyObject *bpy_intern_str_attr;
 PyObject *bpy_intern_str___slots__;
+PyObject *bpy_intern_str___name__;
+PyObject *bpy_intern_str___doc__;
 
 void bpy_intern_string_init(void)
 {
@@ -47,6 +49,8 @@ void bpy_intern_string_init(void)
 	bpy_intern_str_order = PyUnicode_FromString("order");
 	bpy_intern_str_attr = PyUnicode_FromString("attr");
 	bpy_intern_str___slots__ = PyUnicode_FromString("__slots__");
+	bpy_intern_str___name__ = PyUnicode_FromString("__name__");
+	bpy_intern_str___doc__ = PyUnicode_FromString("__doc__");
 }
 
 void bpy_intern_string_exit(void)
@@ -57,4 +61,6 @@ void bpy_intern_string_exit(void)
 	Py_DECREF(bpy_intern_str_order);
 	Py_DECREF(bpy_intern_str_attr);
 	Py_DECREF(bpy_intern_str___slots__);
+	Py_DECREF(bpy_intern_str___name__);
+	Py_DECREF(bpy_intern_str___doc__);
 }
diff --git a/source/blender/python/intern/bpy_intern_string.h b/source/blender/python/intern/bpy_intern_string.h
index dc7af73..0b7ca2c 100644
--- a/source/blender/python/intern/bpy_intern_string.h
+++ b/source/blender/python/intern/bpy_intern_string.h
@@ -33,3 +33,5 @@ extern PyObject *bpy_intern_str_bl_rna;
 extern PyObject *bpy_intern_str_order;
 extern PyObject *bpy_intern_str_attr;
 extern PyObject *bpy_intern_str___slots__;
+extern PyObject *bpy_intern_str___name__;
+extern PyObject *bpy_intern_str___doc__;
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index bb11601..bd03373 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -75,9 +75,10 @@ static EnumPropertyItem property_flag_enum_items[] = {
 static EnumPropertyItem property_subtype_string_items[] = {
 	{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
 	{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
-	{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
+	{PROP_FILENAME, "FILE_NAME", 0, "Filename", ""},
 	{PROP_BYTESTRING, "BYTE_STRING", 0, "Byte String", ""},
 	{PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+	{PROP_PASSWORD, "PASSWORD", 0, "Password", 0},
 
 	{PROP_NONE, "NONE", 0, "None", ""},
 	{0, NULL, 0, NULL, NULL}};
@@ -260,7 +261,7 @@ static int bpy_prop_callback_check(PyObject *py_func, int argcount)
 static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_cb)
 {
 	/* assume this is already checked for type and arg length */
-	if (update_cb) {
+	if (update_cb && update_cb != Py_None) {
 		PyObject **py_data = MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, __func__);
 		RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb);
 		py_data[BPY_DATA_CB_SLOT_UPDATE] = update_cb;
@@ -309,35 +310,38 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
 /* terse macros for error checks shared between all funcs cant use function
  * calls because of static strings passed to pyrna_set_to_enum_bitfield */
 #define BPY_PROPDEF_CHECK(_func, _property_flag_items)                        \
-	if (id_len >= MAX_IDPROP_NAME) {                                          \
+	if (UNLIKELY(id_len >= MAX_IDPROP_NAME)) {                                \
 		PyErr_Format(PyExc_TypeError,                                         \
 		             #_func"(): '%.200s' too long, max length is %d",         \
 		             id, MAX_IDPROP_NAME - 1);                                \
 		return NULL;                                                          \
 	}                                                                         \
-	if (RNA_def_property_free_identifier(srna, id) == -1) {                   \
+	if (UNLIKELY(RNA_def_property_free_identifier(srna, id) == -1)) {         \
 		PyErr_Format(PyExc_TypeError,                                         \
 		             #_func"(): '%s' is defined as a non-dynamic type",       \
 		             id);                                                     \
 		return NULL;                                                          \
 	}                                                                         \
-	if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items,            \
+	if (UNLIKELY(pyopts && pyrna_set_to_enum_bitfield(_property_flag_items,   \
 	                                         pyopts,                          \
 	                                         &opts,                           \
-	                                         #_func"(options={ ...}):"))      \
+	                                         #_func"(options={ ...}):")))     \
 	{                                                                         \
 		return NULL;                                                          \
 	} (void)0
 
 #define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype)      \
 	BPY_PROPDEF_CHECK(_func, _property_flag_items);                           \
-	if (pysubtype && RNA_enum_value_from_id(_subtype,                         \
+	if (UNLIKELY(pysubtype && RNA_enum_value_from_id(_subtype,                \
 	                                        pysubtype,                        \
-	                                        &subtype) == 0)                   \
+	                                        &subtype) == 0))                  \
 	{                                                                         \
+		const char *enum_str = BPy_enum_as_string(_subtype);                  \
 		PyErr_Format(PyExc_TypeError,                                         \
-		             #_func"(subtype='%s'): invalid subtype",                 \
-		             pysubtype);                                              \
+		             #_func"(subtype='%s'): "                                 \
+		             "subtype not found in (%s)",                             \
+		             pysubtype, enum_str);                                    \
+		MEM_freeN((void *)enum_str);                                          \
 		return NULL;                                                          \
 	} (void)0
 
@@ -921,7 +925,7 @@ BPY_PROPDEF_NAME_DOC
 BPY_PROPDEF_DESC_DOC
 "   :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE'].\n"
 "   :type options: set\n"
-"   :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n"
+"   :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'NONE'].\n"
 "   :type subtype: string\n"
 BPY_PROPDEF_UPDATE_DOC
 );
@@ -1511,7 +1515,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
 		args = PyTuple_New(0);
 		ret = BPy_RemoveProperty(self, args, kw);
 		Py_DECREF(args);
-		return ret;	
+		return ret;
 	}
 	else if (PyTuple_GET_SIZE(args) > 1) {
 		PyErr_SetString(PyExc_ValueError, "all args must be keywords");
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 00c1f5c..a0df898 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -119,13 +119,10 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
 	return -1;
 }
 
-#if defined(USE_PYRNA_INVALIDATE_GC) || defined(USE_PYRNA_INVALIDATE_WEAKREF)
-static void pyrna_invalidate(BPy_DummyPointerRNA *self)
+void pyrna_invalidate(BPy_DummyPointerRNA *self)
 {
-	self->ptr.type = NULL; /* this is checked for validity */
-	self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just in case */
+	RNA_POINTER_INVALIDATE(&self->ptr);
 }
-#endif
 
 #ifdef USE_PYRNA_INVALIDATE_GC
 #define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
@@ -337,7 +334,7 @@ static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
 	}
 	return FALSE;
 }
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 
 #ifdef USE_PEDANTIC_WRITE
@@ -350,7 +347,7 @@ void pyrna_write_set(int val)
 {
 	rna_disallow_writes = !val;
 }
-#else // USE_PEDANTIC_WRITE
+#else  /* USE_PEDANTIC_WRITE */
 int pyrna_write_check(void)
 {
 	return TRUE;
@@ -359,7 +356,7 @@ void pyrna_write_set(int UNUSED(val))
 {
 	/* nothing */
 }
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
 static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
@@ -426,7 +423,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError,
@@ -490,7 +487,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError,
@@ -547,7 +544,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError,
@@ -588,7 +585,7 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_
 	return order_fallback;
 }
 
-#endif // USE_MATHUTILS
+#endif  /* USE_MATHUTILS */
 
 /* note that PROP_NONE is included as a vector subtype. this is because its handy to
  * have x/y access to fcurve keyframes and other fixed size float arrays of length 2-4. */
@@ -672,7 +669,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 						PropertyRNA *prop_eul_order = NULL;
 						short order = pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
 
-						ret = Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
+						ret = Euler_CreatePyObject(NULL, order, Py_NEW, NULL);  /* TODO, get order from RNA */
 						RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
 					}
 					else {
@@ -698,7 +695,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 			case PROP_COLOR_GAMMA:
 				if (len == 3) { /* color */
 					if (is_thick) {
-						ret = Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
+						ret = Color_CreatePyObject(NULL, Py_NEW, NULL);
 						RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
 					}
 					else {
@@ -722,10 +719,10 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 			ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
 		}
 	}
-#else // USE_MATHUTILS
+#else  /* USE_MATHUTILS */
 	(void)ptr;
 	(void)prop;
-#endif // USE_MATHUTILS
+#endif  /* USE_MATHUTILS */
 
 	return ret;
 }
@@ -834,7 +831,7 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
 	const char *name;
 
 	if (!PYRNA_STRUCT_IS_VALID(self)) {
-		return PyUnicode_FromFormat("<bpy_struct, %.200s dead>",
+		return PyUnicode_FromFormat("<bpy_struct, %.200s invalid>",
 		                            Py_TYPE(self)->tp_name);
 	}
 
@@ -1302,7 +1299,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 				       val, RNA_struct_identifier(ptr->type),
 				       ptr_name, RNA_property_identifier(prop));
 
-#if 0           // gives python decoding errors while generating docs :(
+#if 0           /* gives python decoding errors while generating docs :( */
 				char error_str[256];
 				BLI_snprintf(error_str, sizeof(error_str),
 				             "RNA Warning: Current value \"%d\" "
@@ -1347,7 +1344,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
 			ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
 			break;
 		case PROP_INT:
-			ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
+			ret = PyLong_FromLong(RNA_property_int_get(ptr, prop));
 			break;
 		case PROP_FLOAT:
 			ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
@@ -1371,14 +1368,14 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
 			else {
 				ret = PyUnicode_FromStringAndSize(buf, buf_len);
 			}
-#else // USE_STRING_COERCE
+#else  /* USE_STRING_COERCE */
 			if (subtype == PROP_BYTESTRING) {
 				ret = PyBytes_FromStringAndSize(buf, buf_len);
 			}
 			else {
 				ret = PyUnicode_FromStringAndSize(buf, buf_len);
 			}
-#endif // USE_STRING_COERCE
+#endif  /* USE_STRING_COERCE */
 			if (buf_fixed != buf) {
 				MEM_freeN((void *)buf);
 			}
@@ -1635,12 +1632,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 						if (subtype == PROP_TRANSLATE) {
 							param = IFACE_(param);
 						}
-#endif // WITH_INTERNATIONAL
+#endif  /* WITH_INTERNATIONAL */
 
 					}
-#else // USE_STRING_COERCE
+#else  /* USE_STRING_COERCE */
 					param = _PyUnicode_AsString(value);
-#endif // USE_STRING_COERCE
+#endif  /* USE_STRING_COERCE */
 
 					if (param == NULL) {
 						if (PyUnicode_Check(value)) {
@@ -1668,7 +1665,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 					}
 #ifdef USE_STRING_COERCE
 					Py_XDECREF(value_coerce);
-#endif // USE_STRING_COERCE
+#endif  /* USE_STRING_COERCE */
 				}
 				break;
 			}
@@ -1778,10 +1775,21 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 					if (data) {
 
 						if (flag & PROP_RNAPTR) {
-							if (value == Py_None)
-								memset(data, 0, sizeof(PointerRNA));
-							else
-								*((PointerRNA *)data) = param->ptr;
+							if (flag & PROP_THICK_WRAP) {
+								if (value == Py_None)
+									memset(data, 0, sizeof(PointerRNA));
+								else
+									*((PointerRNA *)data) = param->ptr;
+							}
+							else {
+								/* for function calls, we sometimes want to pass the 'ptr' directly,
+								 * watch out that it remains valid!, possibly we could support this later if needed */
+								BLI_assert(value_new == NULL);
+								if (value == Py_None)
+									*((void **)data) = NULL;
+								else
+									*((PointerRNA **)data) = &param->ptr;
+							}
 						}
 						else if (value == Py_None) {
 							*((void **)data) = NULL;
@@ -1995,7 +2003,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 	return ret;
 }
 
-//---------------sequence-------------------------------------------
+/* ---------------sequence------------------------------------------- */
 static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
 {
 	PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
@@ -2363,7 +2371,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 
 				RNA_property_int_get_array(ptr, prop, values);
 				for (count = start; count < stop; count++)
-					PyTuple_SET_ITEM(tuple, count - start, PyLong_FromSsize_t(values[count]));
+					PyTuple_SET_ITEM(tuple, count - start, PyLong_FromLong(values[count]));
 
 				if (values != values_stack) {
 					PyMem_FREE(values);
@@ -2604,7 +2612,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
 			int len = pyrna_prop_array_length(self);
 			Py_ssize_t start, stop, slicelength;
 
-			if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0)
+			if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0)
 				return NULL;
 
 			if (slicelength <= 0) {
@@ -2772,7 +2780,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
 		int len = RNA_property_array_length(&self->ptr, self->prop);
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0) {
+		if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0) {
 			ret = -1;
 		}
 		else if (slicelength <= 0) {
@@ -2982,7 +2990,7 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, key)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (group == NULL) {
 		PyErr_SetString(PyExc_TypeError, "bpy_struct[key] = val: id properties not supported for this type");
@@ -3441,7 +3449,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
 	return ret;
 }
 
-//---------------getattr--------------------------------------------
+/* ---------------getattr-------------------------------------------- */
 static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
 {
 	const char *name = _PyUnicode_AsString(pyname);
@@ -3455,7 +3463,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
 		PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string");
 		ret = NULL;
 	}
-	else if (name[0] == '_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
+	else if (name[0] == '_') {  /* rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups */
 		/* annoying exception, maybe we need to have different types for this... */
 		if ((strcmp(name, "__getitem__") == 0 || strcmp(name, "__setitem__") == 0) && !RNA_struct_idprops_check(self->ptr.type)) {
 			PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type");
@@ -3565,7 +3573,7 @@ static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname)
 }
 #endif
 
-//--------------- setattr-------------------------------------------
+/* --------------- setattr------------------------------------------- */
 static int pyrna_is_deferred_prop(const PyObject *value)
 {
 	return PyTuple_CheckExact(value) &&
@@ -3678,7 +3686,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (name == NULL) {
 		PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string");
@@ -3829,7 +3837,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
 #endif
 }
 
-//--------------- setattr-------------------------------------------
+/* --------------- setattr------------------------------------------- */
 static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
 {
 	const char *name = _PyUnicode_AsString(pyname);
@@ -3840,7 +3848,7 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
 	if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
 		return -1;
 	}
-#endif // USE_PEDANTIC_WRITE
+#endif  /* USE_PEDANTIC_WRITE */
 
 	if (name == NULL) {
 		PyErr_SetString(PyExc_AttributeError, "bpy_prop: __setattr__ must be a string");
@@ -3868,6 +3876,12 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
 {
 	PointerRNA r_ptr;
 
+#ifdef USE_PEDANTIC_WRITE
+	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+		return NULL;
+	}
+#endif  /* USE_PEDANTIC_WRITE */
+
 	RNA_property_collection_add(&self->ptr, self->prop, &r_ptr);
 	if (!r_ptr.data) {
 		PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
@@ -3882,6 +3896,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
 {
 	int key = PyLong_AsLong(value);
 
+#ifdef USE_PEDANTIC_WRITE
+	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+		return NULL;
+	}
+#endif  /* USE_PEDANTIC_WRITE */
+
 	if (key == -1 && PyErr_Occurred()) {
 		PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
 		return NULL;
@@ -3897,6 +3917,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
 
 static PyObject *pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
 {
+#ifdef USE_PEDANTIC_WRITE
+	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+		return NULL;
+	}
+#endif  /* USE_PEDANTIC_WRITE */
+
 	RNA_property_collection_clear(&self->ptr, self->prop);
 
 	Py_RETURN_NONE;
@@ -3906,6 +3932,12 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
 {
 	int key = 0, pos = 0;
 
+#ifdef USE_PEDANTIC_WRITE
+	if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+		return NULL;
+	}
+#endif  /* USE_PEDANTIC_WRITE */
+
 	if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
 		PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
 		return NULL;
@@ -4045,7 +4077,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
 			}
 			else {
 				/* a bit strange but better then returning an empty list */
-				PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(i));
+				PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
 			}
 			PyTuple_SET_ITEM(item, 1, pyrna_struct_CreatePyObject(&itemptr));
 
@@ -4224,7 +4256,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
 	}
 	RNA_PROP_END;
 
-	return PyLong_FromSsize_t(index);
+	return PyLong_FromLong(index);
 }
 
 static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
@@ -4275,7 +4307,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
 		foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed);
 		*size = RNA_raw_type_sizeof(*raw_type);
 
-#if 0   // works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks
+#if 0   /* works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks */
 		if ((*attr_tot) < 1)
 			*attr_tot = 1;
 
@@ -4431,13 +4463,13 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
 
 				switch (raw_type) {
 					case PROP_RAW_CHAR:
-						item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+						item = PyLong_FromLong((long) ((char *)array)[i]);
 						break;
 					case PROP_RAW_SHORT:
-						item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+						item = PyLong_FromLong((long) ((short *)array)[i]);
 						break;
 					case PROP_RAW_INT:
-						item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+						item = PyLong_FromLong((long) ((int *)array)[i]);
 						break;
 					case PROP_RAW_FLOAT:
 						item = PyFloat_FromDouble((double) ((float *)array)[i]);
@@ -4617,7 +4649,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
 static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
 	{"add", (PyCFunction)pyrna_prop_collection_idprop_add, METH_NOARGS, NULL},
 	{"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
-    {"clear", (PyCFunction)pyrna_prop_collection_idprop_clear, METH_NOARGS, NULL},
+	{"clear", (PyCFunction)pyrna_prop_collection_idprop_clear, METH_NOARGS, NULL},
 	{"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
 	{NULL, NULL, 0, NULL}
 };
@@ -4724,7 +4756,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
 			case PROP_INT:
 				ret = PyTuple_New(len);
 				for (a = 0; a < len; a++)
-					PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int *)data)[a]));
+					PyTuple_SET_ITEM(ret, a, PyLong_FromLong(((int *)data)[a]));
 				break;
 			case PROP_FLOAT:
 				switch (RNA_property_subtype(prop)) {
@@ -4765,7 +4797,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
 				ret = PyBool_FromLong(*(int *)data);
 				break;
 			case PROP_INT:
-				ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
+				ret = PyLong_FromLong(*(int *)data);
 				break;
 			case PROP_FLOAT:
 				ret = PyFloat_FromDouble(*(float *)data);
@@ -5564,7 +5596,7 @@ PyTypeObject pyrna_prop_collection_Type = {
 	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
 	NULL,                       /* tp_compare */ /* DEPRECATED in python 3.0! */
-	NULL, /* subclassed */		/* tp_repr */
+	NULL, /* subclassed */      /* tp_repr */
 
 	/* Method suites for standard classes */
 
@@ -5598,7 +5630,7 @@ PyTypeObject pyrna_prop_collection_Type = {
 
 	/***  Assigned meaning in release 2.1 ***/
 	/*** rich comparisons ***/
-	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
+	NULL, /* subclassed */      /* richcmpfunc tp_richcompare; */
 
 	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
@@ -5683,7 +5715,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = {
 
 	/***  Assigned meaning in release 2.1 ***/
 	/*** rich comparisons ***/
-	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
+	NULL, /* subclassed */      /* richcmpfunc tp_richcompare; */
 
 	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
@@ -5830,7 +5862,7 @@ PyTypeObject pyrna_prop_collection_iter_Type = {
 	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
 	NULL,                       /* tp_compare */ /* DEPRECATED in python 3.0! */
-	NULL, /* subclassed */		/* tp_repr */
+	NULL, /* subclassed */      /* tp_repr */
 
 	/* Method suites for standard classes */
 
@@ -5868,7 +5900,7 @@ PyTypeObject pyrna_prop_collection_iter_Type = {
 
 	/***  Assigned meaning in release 2.1 ***/
 	/*** rich comparisons ***/
-	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
+	NULL, /* subclassed */      /* richcmpfunc tp_richcompare; */
 
 	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
@@ -6044,8 +6076,8 @@ static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
 			fprintf(stderr, "%s: failed to find 'bpy_types' module\n", __func__);
 			return NULL;
 		}
-		bpy_types_dict = PyModule_GetDict(bpy_types); // borrow
-		Py_DECREF(bpy_types); // fairly safe to assume the dict is kept
+		bpy_types_dict = PyModule_GetDict(bpy_types);  /* borrow */
+		Py_DECREF(bpy_types);  /* fairly safe to assume the dict is kept */
 	}
 
 	newclass = PyDict_GetItemString(bpy_types_dict, idname);
@@ -6134,7 +6166,7 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
 			/* srna owns one, and the other is owned by the caller */
 			pyrna_subtype_set_rna(newclass, srna);
 
-			// XXX, adding this back segfaults blender on load.
+			/* XXX, adding this back segfaults blender on load. */
 			// Py_DECREF(newclass); /* let srna own */
 		}
 		else {
@@ -6291,7 +6323,7 @@ int pyrna_id_FromPyObject(PyObject *obj, ID **id)
 
 void BPY_rna_init(void)
 {
-#ifdef USE_MATHUTILS // register mathutils callbacks, ok to run more then once.
+#ifdef USE_MATHUTILS  /* register mathutils callbacks, ok to run more then once. */
 	mathutils_rna_array_cb_index = Mathutils_RegisterCallback(&mathutils_rna_array_cb);
 	mathutils_rna_matrix_cb_index = Mathutils_RegisterCallback(&mathutils_rna_matrix_cb);
 #endif
@@ -6375,7 +6407,7 @@ PyObject *BPY_rna_doc(void)
 
 /* pyrna_basetype_* - BPy_BaseTypeRNA is just a BPy_PropertyRNA struct with a different type
  * the self->ptr and self->prop are always set to the "structs" collection */
-//---------------getattr--------------------------------------------
+/* ---------------getattr-------------------------------------------- */
 static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname)
 {
 	PointerRNA newptr;
@@ -6750,7 +6782,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
 	PyObject *base_class = RNA_struct_py_type_get(srna);
 	PyObject *item;
 	int i, flag, arg_count, func_arg_count;
-	const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__
+	const char *py_class_name = ((PyTypeObject *)py_class)->tp_name;  /* __name__ */
 
 	if (srna_base) {
 		if (bpy_class_validate_recursive(dummyptr, srna_base, py_data, have_function) != 0)
@@ -6851,8 +6883,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
 			/* Sneaky workaround to use the class name as the bl_idname */
 
 #define     BPY_REPLACEMENT_STRING(rna_attr, py_attr)                         \
-	if (strcmp(identifier, rna_attr) == 0) {                                  \
-		item = PyObject_GetAttrString(py_class, py_attr);                     \
+	(strcmp(identifier, rna_attr) == 0) {                                     \
+		item = PyObject_GetAttr(py_class, py_attr);                           \
 		if (item && item != Py_None) {                                        \
 			if (pyrna_py_to_prop(dummyptr, prop, NULL,                        \
 			                     item, "validating class:") != 0)             \
@@ -6862,11 +6894,10 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
 			}                                                                 \
 		}                                                                     \
 		Py_XDECREF(item);                                                     \
-	} (void)0
-
+	}  /* intendionally allow else here */
 
-			BPY_REPLACEMENT_STRING("bl_idname", "__name__");
-			BPY_REPLACEMENT_STRING("bl_description", "__doc__");
+			if      BPY_REPLACEMENT_STRING("bl_idname",      bpy_intern_str___name__)
+			else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)
 
 #undef      BPY_REPLACEMENT_STRING
 
@@ -6880,10 +6911,11 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
 			PyErr_Clear();
 		}
 		else {
-			Py_DECREF(item); /* no need to keep a ref, the class owns it */
-
-			if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0)
+			if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) {
+				Py_DECREF(item);
 				return -1;
+			}
+			Py_DECREF(item);
 		}
 	}
 
@@ -6919,11 +6951,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 
 #ifdef USE_PEDANTIC_WRITE
 	const int is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator);
-	const char *func_id = RNA_function_identifier(func);
+	// const char *func_id = RNA_function_identifier(func);  /* UNUSED */
 	/* testing, for correctness, not operator and not draw function */
-	const short is_readonly = ((strncmp("draw", func_id, 4) == 0) || /* draw or draw_header */
-	                           /*strstr("render", func_id) ||*/
-	                           !is_operator);
+	const short is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE);
 #endif
 
 	py_class = RNA_struct_py_type_get(ptr->type);
@@ -7211,10 +7241,10 @@ static void bpy_class_free(void *pyob_ptr)
 
 	gilstate = PyGILState_Ensure();
 
-	// breaks re-registering classes
+	/* breaks re-registering classes */
 	// PyDict_Clear(((PyTypeObject *)self)->tp_dict);
-	//
-	// remove the rna attribute instead.
+
+	/* remove the rna attribute instead. */
 	PyDict_DelItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
 	if (PyErr_Occurred())
 		PyErr_Clear();
@@ -7279,7 +7309,7 @@ void pyrna_free_types(void)
 		void *py_ptr = RNA_struct_py_type_get(srna);
 
 		if (py_ptr) {
-#if 0   // XXX - should be able to do this but makes python crash on exit
+#if 0   /* XXX - should be able to do this but makes python crash on exit */
 			bpy_class_free(py_ptr);
 #endif
 			RNA_struct_py_type_set(srna, NULL);
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 1fb4b11..880ef4c 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -207,6 +207,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
 int pyrna_write_check(void);
 void pyrna_write_set(int val);
 
+void pyrna_invalidate(BPy_DummyPointerRNA *self);
 int pyrna_struct_validity_check(BPy_StructRNA *pysrna);
 int pyrna_prop_validity_check(BPy_PropertyRNA *self);
 
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 70815d9..62c0ced 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -30,6 +30,8 @@
 
 #include "RNA_types.h"
 
+#include "BLI_utildefines.h"
+
 #include "bpy_rna.h"
 #include "BKE_global.h"
 #include "MEM_guardedalloc.h"
@@ -505,7 +507,7 @@ static void py_to_float(PyObject *py, char *data)
 
 static void py_to_int(PyObject *py, char *data)
 {
-	*(int *)data = (int)PyLong_AsSsize_t(py);
+	*(int *)data = (int)PyLong_AsLong(py);
 }
 
 static void py_to_bool(PyObject *py, char *data)
@@ -607,7 +609,7 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 			item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
 			break;
 		case PROP_INT:
-			item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+			item = PyLong_FromLong(RNA_property_int_get_index(ptr, prop, index));
 			break;
 		default:
 			PyErr_SetString(PyExc_TypeError, "not an array type");
@@ -664,7 +666,8 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
 	len = RNA_property_multi_array_length(ptr, prop, arraydim);
 	if (index >= len || index < 0) {
 		/* this shouldn't happen because higher level funcs must check for invalid index */
-		if (G.debug & G_DEBUG_PYTHON) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
+		if (G.debug & G_DEBUG_PYTHON)
+			printf("%s: invalid index %d for array with length=%d\n", __func__, index, len);
 
 		PyErr_SetString(PyExc_IndexError, "out of range");
 		return NULL;
@@ -763,7 +766,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
 		case PROP_BOOLEAN:
 		case PROP_INT:
 		{
-			int value_i = PyLong_AsSsize_t(value);
+			int value_i = PyLong_AsLong(value);
 			if (value_i == -1 && PyErr_Occurred()) {
 				PyErr_Clear();
 				return 0;
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index f7aa6e0..48bf65a 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -39,70 +39,80 @@ static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce)
 	return PyBytes_AS_STRING((*coerce = PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename)));
 }
 
-/* copied from pythonrun.c, 3.2.0 */
+/* copied from pythonrun.c, 3.3.0 */
 static int
 parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
                    int *lineno, int *offset, const char **text)
 {
 	long hold;
 	PyObject *v;
+	_Py_IDENTIFIER(msg);
+	_Py_IDENTIFIER(filename);
+	_Py_IDENTIFIER(lineno);
+	_Py_IDENTIFIER(offset);
+	_Py_IDENTIFIER(text);
 
-	/* old style errors */
-	if (PyTuple_Check(err))
-		return PyArg_ParseTuple(err, "O(ziiz)", message, filename,
-		                        lineno, offset, text);
+	*message = NULL;
 
 	/* new style errors.  `err' is an instance */
-
-	if (!(v = PyObject_GetAttrString(err, "msg")))
+	*message = _PyObject_GetAttrId(err, &PyId_msg);
+	if (!*message)
 		goto finally;
-	*message = v;
 
-	if (!(v = PyObject_GetAttrString(err, "filename")))
+	v = _PyObject_GetAttrId(err, &PyId_filename);
+	if (!v)
 		goto finally;
-	if (v == Py_None)
+	if (v == Py_None) {
+		Py_DECREF(v);
 		*filename = NULL;
-	else if (!(*filename = _PyUnicode_AsString(v)))
-		goto finally;
+	}
+	else {
+		*filename = _PyUnicode_AsString(v);
+		Py_DECREF(v);
+		if (!*filename)
+			goto finally;
+	}
 
-	Py_DECREF(v);
-	if (!(v = PyObject_GetAttrString(err, "lineno")))
+	v = _PyObject_GetAttrId(err, &PyId_lineno);
+	if (!v)
 		goto finally;
 	hold = PyLong_AsLong(v);
 	Py_DECREF(v);
-	v = NULL;
 	if (hold < 0 && PyErr_Occurred())
 		goto finally;
 	*lineno = (int)hold;
 
-	if (!(v = PyObject_GetAttrString(err, "offset")))
+	v = _PyObject_GetAttrId(err, &PyId_offset);
+	if (!v)
 		goto finally;
 	if (v == Py_None) {
 		*offset = -1;
 		Py_DECREF(v);
-		v = NULL;
-	}
-	else {
+	} else {
 		hold = PyLong_AsLong(v);
 		Py_DECREF(v);
-		v = NULL;
 		if (hold < 0 && PyErr_Occurred())
 			goto finally;
 		*offset = (int)hold;
 	}
 
-	if (!(v = PyObject_GetAttrString(err, "text")))
+	v = _PyObject_GetAttrId(err, &PyId_text);
+	if (!v)
 		goto finally;
-	if (v == Py_None)
+	if (v == Py_None) {
+		Py_DECREF(v);
 		*text = NULL;
-	else if (!PyUnicode_Check(v) ||
-	         !(*text = _PyUnicode_AsString(v)))
-		goto finally;
-	Py_DECREF(v);
+	}
+	else {
+		*text = _PyUnicode_AsString(v);
+		Py_DECREF(v);
+		if (!*text)
+			goto finally;
+	}
 	return 1;
 
 finally:
-	Py_XDECREF(v);
+	Py_XDECREF(*message);
 	return 0;
 }
 /* end copied function! */
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 53d0e10..b7994ee 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -35,6 +35,8 @@
 #include "BKE_report.h"
 #include "BKE_context.h"
 
+#include "BLF_translation.h"
+
 #include "../generic/py_capi_utils.h"
 
 static bContext *__py_context = NULL;
@@ -79,7 +81,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
 short BPy_errors_to_report(ReportList *reports)
 {
 	PyObject *pystring;
-	PyObject *pystring_format = NULL; // workaround, see below
+	PyObject *pystring_format = NULL;  /* workaround, see below */
 	char *cstring;
 
 	const char *filename;
@@ -98,7 +100,7 @@ short BPy_errors_to_report(ReportList *reports)
 	pystring = PyC_ExceptionBuffer();
 	
 	if (pystring == NULL) {
-		BKE_report(reports, RPT_ERROR, "unknown py-exception, couldn't convert");
+		BKE_report(reports, RPT_ERROR, "Unknown py-exception, could not convert");
 		return 0;
 	}
 	
@@ -108,17 +110,18 @@ short BPy_errors_to_report(ReportList *reports)
 	
 	cstring = _PyUnicode_AsString(pystring);
 
-#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf
-	BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
+#if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */
+	BKE_reportf(reports, RPT_ERROR, "%s\nlocation: %s:%d\n", cstring, filename, lineno);
 #else
-	pystring_format = PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
+	pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation: %s:%d\n"), cstring, filename, lineno);
 	cstring = _PyUnicode_AsString(pystring_format);
 	BKE_report(reports, RPT_ERROR, cstring);
 #endif
-	
-	fprintf(stderr, "%s\nlocation:%s:%d\n", cstring, filename, lineno); // not exactly needed. just for testing
-	
+
+	/* not exactly needed. just for testing */
+	fprintf(stderr, TIP_("%s\nlocation: %s:%d\n"), cstring, filename, lineno);
+
 	Py_DECREF(pystring);
-	Py_DECREF(pystring_format); // workaround
+	Py_DECREF(pystring_format);  /* workaround */
 	return 1;
 }
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 63660b0..b5f679b 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -24,16 +24,13 @@
  *  \ingroup pythonintern
  */
 
-
 #ifndef __BPY_UTIL_H__
 #define __BPY_UTIL_H__
 
-#if PY_VERSION_HEX <  0x03020000
-#error "Python 3.2 or greater is required, you'll need to update your python."
+#if PY_VERSION_HEX <  0x03030000
+#  error "Python 3.3 or greater is required, you'll need to update your python."
 #endif
 
-#include "RNA_types.h" /* for EnumPropertyItem only */
-
 struct EnumPropertyItem;
 struct ReportList;
 
@@ -51,4 +48,5 @@ void BPy_SetContext(struct bContext *C);
 
 extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
 extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
-#endif
+
+#endif  /* __BPY_UTIL_H__ */
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index c08165f..2025982 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -35,7 +35,10 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 PyDoc_STRVAR(M_Mathutils_doc,
 "This module provides access to matrices, eulers, quaternions and vectors."
@@ -276,12 +279,12 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
 }
 
 
-//----------------------------------MATRIX FUNCTIONS--------------------
+/* ----------------------------------MATRIX FUNCTIONS-------------------- */
 
 
 /* Utility functions */
 
-// LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon
+/* LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon */
 #define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31))
 
 int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
@@ -302,7 +305,7 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
 
 /*---------------------- EXPP_VectorsAreEqual -------------------------
  * Builds on EXPP_FloatsAreEqual to test vectors */
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
+int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps)
 {
 	int x;
 	for (x = 0; x < size; x++) {
@@ -312,6 +315,7 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
 	return 1;
 }
 
+#ifndef MATH_STANDALONE
 /* dynstr as python string utility funcions, frees 'ds'! */
 PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
 {
@@ -324,6 +328,7 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
 	PyMem_Free(ds_buf);
 	return ret;
 }
+#endif
 
 /* silly function, we dont use arg. just check its compatible with __deepcopy__ */
 int mathutils_deepcopy_args_check(PyObject *args)
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index d4673d1..7b03b14 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -74,7 +74,7 @@ void BaseMathObject_dealloc(BaseMathObject * self);
 PyMODINIT_FUNC PyInit_mathutils(void);
 
 int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
+int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps);
 
 #define Py_NEW  1
 #define Py_WRAP 2
@@ -120,8 +120,11 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
 
 int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject *mat);
 
+#ifndef MATH_STANDALONE
 /* dynstr as python string utility funcions */
 PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
+#endif
+
 int mathutils_deepcopy_args_check(PyObject *args);
 
 #endif /* __MATHUTILS_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 8b5e39f..4a29e72 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -31,12 +31,15 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 #define COLOR_SIZE 3
 
-//----------------------------------mathutils.Color() -------------------
-//makes a new color for you to play with
+/* ----------------------------------mathutils.Color() ------------------- */
+/* makes a new color for you to play with */
 static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	float col[3] = {0.0f, 0.0f, 0.0f};
@@ -64,7 +67,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 	return Color_CreatePyObject(col, Py_NEW, type);
 }
 
-//-----------------------------METHODS----------------------------
+/* -----------------------------METHODS---------------------------- */
 
 /* note: BaseMath_ReadCallback must be called beforehand */
 static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits)
@@ -113,8 +116,8 @@ static PyObject *Color_deepcopy(ColorObject *self, PyObject *args)
 	return Color_copy(self);
 }
 
-//----------------------------print object (internal)--------------
-//print the object to screen
+/* ----------------------------print object (internal)-------------- */
+/* print the object to screen */
 
 static PyObject *Color_repr(ColorObject *self)
 {
@@ -131,6 +134,7 @@ static PyObject *Color_repr(ColorObject *self)
 	return ret;
 }
 
+#ifndef MATH_STANDALONE
 static PyObject *Color_str(ColorObject *self)
 {
 	DynStr *ds;
@@ -145,9 +149,10 @@ static PyObject *Color_str(ColorObject *self)
 
 	return mathutils_dynstr_to_py(ds); /* frees ds */
 }
+#endif
 
-//------------------------tp_richcmpr
-//returns -1 exception, 0 false, 1 true
+/* ------------------------tp_richcmpr */
+/* returns -1 exception, 0 false, 1 true */
 static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
 {
 	PyObject *res;
@@ -184,15 +189,15 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
 	return Py_INCREF(res), res;
 }
 
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
+/* ---------------------SEQUENCE PROTOCOLS------------------------ */
+/* ----------------------------len(object)------------------------ */
+/* sequence length */
 static int Color_len(ColorObject *UNUSED(self))
 {
 	return COLOR_SIZE;
 }
-//----------------------------object[]---------------------------
-//sequence accessor (get)
+/* ----------------------------object[]--------------------------- */
+/* sequence accessor (get) */
 static PyObject *Color_item(ColorObject *self, int i)
 {
 	if (i < 0) i = COLOR_SIZE - i;
@@ -210,13 +215,13 @@ static PyObject *Color_item(ColorObject *self, int i)
 	return PyFloat_FromDouble(self->col[i]);
 
 }
-//----------------------------object[]-------------------------
-//sequence accessor (set)
+/* ----------------------------object[]------------------------- */
+/* sequence accessor (set) */
 static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 {
 	float f = PyFloat_AsDouble(value);
 
-	if (f == -1 && PyErr_Occurred()) { // parsed item not a number
+	if (f == -1 && PyErr_Occurred()) {  /* parsed item not a number */
 		PyErr_SetString(PyExc_TypeError,
 		                "color[item] = x: "
 		                "argument not a number");
@@ -238,8 +243,8 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 
 	return 0;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (get) */
 static PyObject *Color_slice(ColorObject *self, int begin, int end)
 {
 	PyObject *tuple;
@@ -260,8 +265,8 @@ static PyObject *Color_slice(ColorObject *self, int begin, int end)
 
 	return tuple;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (set) */
 static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
 {
 	int i, size;
@@ -306,7 +311,7 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -342,7 +347,7 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -361,7 +366,7 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
 	}
 }
 
-//-----------------PROTCOL DECLARATIONS--------------------------
+/* -----------------PROTCOL DECLARATIONS-------------------------- */
 static PySequenceMethods Color_SeqMethods = {
 	(lenfunc) Color_len,                    /* sq_length */
 	(binaryfunc) NULL,                      /* sq_concat */
@@ -792,7 +797,7 @@ static PyGetSetDef Color_getseters[] = {
 };
 
 
-//-----------------------METHOD DEFINITIONS ----------------------
+/* -----------------------METHOD DEFINITIONS ---------------------- */
 static struct PyMethodDef Color_methods[] = {
 	{"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
 	{"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
@@ -800,65 +805,69 @@ static struct PyMethodDef Color_methods[] = {
 	{NULL, NULL, 0, NULL}
 };
 
-//------------------PY_OBECT DEFINITION--------------------------
+/* ------------------PY_OBECT DEFINITION-------------------------- */
 PyDoc_STRVAR(color_doc,
 "This object gives access to Colors in Blender."
 );
 PyTypeObject color_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"Color",                        //tp_name
-	sizeof(ColorObject),            //tp_basicsize
-	0,                              //tp_itemsize
-	(destructor)BaseMathObject_dealloc,     //tp_dealloc
-	NULL,                           //tp_print
-	NULL,                           //tp_getattr
-	NULL,                           //tp_setattr
-	NULL,                           //tp_compare
-	(reprfunc) Color_repr,          //tp_repr
-	&Color_NumMethods,              //tp_as_number
-	&Color_SeqMethods,              //tp_as_sequence
-	&Color_AsMapping,               //tp_as_mapping
-	NULL,                           //tp_hash
-	NULL,                           //tp_call
-	(reprfunc) Color_str,           //tp_str
-	NULL,                           //tp_getattro
-	NULL,                           //tp_setattro
-	NULL,                           //tp_as_buffer
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags
-	color_doc, //tp_doc
-	(traverseproc)BaseMathObject_traverse,  //tp_traverse
-	(inquiry)BaseMathObject_clear,  //tp_clear
-	(richcmpfunc)Color_richcmpr,    //tp_richcompare
-	0,                              //tp_weaklistoffset
-	NULL,                           //tp_iter
-	NULL,                           //tp_iternext
-	Color_methods,                  //tp_methods
-	NULL,                           //tp_members
-	Color_getseters,                //tp_getset
-	NULL,                           //tp_base
-	NULL,                           //tp_dict
-	NULL,                           //tp_descr_get
-	NULL,                           //tp_descr_set
-	0,                              //tp_dictoffset
-	NULL,                           //tp_init
-	NULL,                           //tp_alloc
-	Color_new,                      //tp_new
-	NULL,                           //tp_free
-	NULL,                           //tp_is_gc
-	NULL,                           //tp_bases
-	NULL,                           //tp_mro
-	NULL,                           //tp_cache
-	NULL,                           //tp_subclasses
-	NULL,                           //tp_weaklist
-	NULL                            //tp_del
+	"Color",                        /* tp_name */
+	sizeof(ColorObject),            /* tp_basicsize */
+	0,                              /* tp_itemsize */
+	(destructor)BaseMathObject_dealloc,  /* tp_dealloc */
+	NULL,                           /* tp_print */
+	NULL,                           /* tp_getattr */
+	NULL,                           /* tp_setattr */
+	NULL,                           /* tp_compare */
+	(reprfunc) Color_repr,          /* tp_repr */
+	&Color_NumMethods,              /* tp_as_number */
+	&Color_SeqMethods,              /* tp_as_sequence */
+	&Color_AsMapping,               /* tp_as_mapping */
+	NULL,                           /* tp_hash */
+	NULL,                           /* tp_call */
+#ifndef MATH_STANDALONE
+	(reprfunc) Color_str,           /* tp_str */
+#else
+	NULL,                           /* tp_str */
+#endif
+	NULL,                           /* tp_getattro */
+	NULL,                           /* tp_setattro */
+	NULL,                           /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+	color_doc, /* tp_doc */
+	(traverseproc)BaseMathObject_traverse,  /* tp_traverse */
+	(inquiry)BaseMathObject_clear,  /* tp_clear */
+	(richcmpfunc)Color_richcmpr,    /* tp_richcompare */
+	0,                              /* tp_weaklistoffset */
+	NULL,                           /* tp_iter */
+	NULL,                           /* tp_iternext */
+	Color_methods,                  /* tp_methods */
+	NULL,                           /* tp_members */
+	Color_getseters,                /* tp_getset */
+	NULL,                           /* tp_base */
+	NULL,                           /* tp_dict */
+	NULL,                           /* tp_descr_get */
+	NULL,                           /* tp_descr_set */
+	0,                              /* tp_dictoffset */
+	NULL,                           /* tp_init */
+	NULL,                           /* tp_alloc */
+	Color_new,                      /* tp_new */
+	NULL,                           /* tp_free */
+	NULL,                           /* tp_is_gc */
+	NULL,                           /* tp_bases */
+	NULL,                           /* tp_mro */
+	NULL,                           /* tp_cache */
+	NULL,                           /* tp_subclasses */
+	NULL,                           /* tp_weaklist */
+	NULL                            /* tp_del */
 };
-//------------------------Color_CreatePyObject (internal)-------------
-//creates a new color object
+/* ------------------------Color_CreatePyObject (internal)------------- */
+/* creates a new color object */
 /* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
  *  (i.e. it was allocated elsewhere by MEM_mallocN())
  *   pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
  *  (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
+PyObject *Color_CreatePyObject(float col[3], int type, PyTypeObject *base_type)
 {
 	ColorObject *self;
 
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index eff09c2..1c75766 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -46,8 +46,8 @@ typedef struct {
  * be stored in py_data) or be a wrapper for data allocated through
  * blender (stored in blend_data). This is an either/or struct not both*/
 
-//prototypes
-PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type);
+/* prototypes */
+PyObject *Color_CreatePyObject(float col[3], int type, PyTypeObject *base_type);
 PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
                                   unsigned char cb_type, unsigned char cb_subtype);
 
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 468ef37..1be8a5e 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -35,12 +35,15 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 #define EULER_SIZE 3
 
-//----------------------------------mathutils.Euler() -------------------
-//makes a new euler for you to play with
+/* ----------------------------------mathutils.Euler() ------------------- */
+/* makes a new euler for you to play with */
 static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	PyObject *seq = NULL;
@@ -122,8 +125,8 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits)
 	return ret;
 }
 
-//-----------------------------METHODS----------------------------
-//return a quaternion representation of the euler
+/* -----------------------------METHODS----------------------------
+ * return a quaternion representation of the euler */
 
 PyDoc_STRVAR(Euler_to_quaternion_doc,
 ".. method:: to_quaternion()\n"
@@ -145,7 +148,7 @@ static PyObject *Euler_to_quaternion(EulerObject *self)
 	return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
 }
 
-//return a matrix representation of the euler
+/* return a matrix representation of the euler */
 PyDoc_STRVAR(Euler_to_matrix_doc,
 ".. method:: to_matrix()\n"
 "\n"
@@ -277,8 +280,8 @@ static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
 	Py_RETURN_NONE;
 }
 
-//----------------------------Euler.rotate()-----------------------
-// return a copy of the euler
+/* ----------------------------Euler.rotate()-----------------------
+ * return a copy of the euler */
 
 PyDoc_STRVAR(Euler_copy_doc,
 ".. function:: copy()\n"
@@ -305,8 +308,8 @@ static PyObject *Euler_deepcopy(EulerObject *self, PyObject *args)
 	return Euler_copy(self);
 }
 
-//----------------------------print object (internal)--------------
-//print the object to screen
+/* ----------------------------print object (internal)--------------
+ * print the object to screen */
 
 static PyObject *Euler_repr(EulerObject *self)
 {
@@ -323,6 +326,7 @@ static PyObject *Euler_repr(EulerObject *self)
 	return ret;
 }
 
+#ifndef MATH_STANDALONE
 static PyObject *Euler_str(EulerObject *self)
 {
 	DynStr *ds;
@@ -337,6 +341,7 @@ static PyObject *Euler_str(EulerObject *self)
 
 	return mathutils_dynstr_to_py(ds); /* frees ds */
 }
+#endif
 
 static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
 {
@@ -374,15 +379,15 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
 	return Py_INCREF(res), res;
 }
 
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
+/* ---------------------SEQUENCE PROTOCOLS------------------------ */
+/* ----------------------------len(object)------------------------ */
+/* sequence length */
 static int Euler_len(EulerObject *UNUSED(self))
 {
 	return EULER_SIZE;
 }
-//----------------------------object[]---------------------------
-//sequence accessor (get)
+/* ----------------------------object[]--------------------------- */
+/* sequence accessor (get) */
 static PyObject *Euler_item(EulerObject *self, int i)
 {
 	if (i < 0) i = EULER_SIZE - i;
@@ -400,13 +405,13 @@ static PyObject *Euler_item(EulerObject *self, int i)
 	return PyFloat_FromDouble(self->eul[i]);
 
 }
-//----------------------------object[]-------------------------
-//sequence accessor (set)
+/* ----------------------------object[]------------------------- */
+/* sequence accessor (set) */
 static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
 {
 	float f = PyFloat_AsDouble(value);
 
-	if (f == -1 && PyErr_Occurred()) { // parsed item not a number
+	if (f == -1 && PyErr_Occurred()) {  /* parsed item not a number */
 		PyErr_SetString(PyExc_TypeError,
 		                "euler[attribute] = x: "
 		                "argument not a number");
@@ -429,8 +434,8 @@ static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
 
 	return 0;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (get) */
 static PyObject *Euler_slice(EulerObject *self, int begin, int end)
 {
 	PyObject *tuple;
@@ -451,8 +456,8 @@ static PyObject *Euler_slice(EulerObject *self, int begin, int end)
 
 	return tuple;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (set) */
 static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
 {
 	int i, size;
@@ -497,7 +502,7 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -534,7 +539,7 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -553,7 +558,7 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
 	}
 }
 
-//-----------------PROTCOL DECLARATIONS--------------------------
+/* -----------------PROTCOL DECLARATIONS-------------------------- */
 static PySequenceMethods Euler_SeqMethods = {
 	(lenfunc) Euler_len,                    /* sq_length */
 	(binaryfunc) NULL,                      /* sq_concat */
@@ -629,7 +634,7 @@ static PyGetSetDef Euler_getseters[] = {
 };
 
 
-//-----------------------METHOD DEFINITIONS ----------------------
+/* -----------------------METHOD DEFINITIONS ---------------------- */
 static struct PyMethodDef Euler_methods[] = {
 	{"zero", (PyCFunction) Euler_zero, METH_NOARGS, Euler_zero_doc},
 	{"to_matrix", (PyCFunction) Euler_to_matrix, METH_NOARGS, Euler_to_matrix_doc},
@@ -643,60 +648,64 @@ static struct PyMethodDef Euler_methods[] = {
 	{NULL, NULL, 0, NULL}
 };
 
-//------------------PY_OBECT DEFINITION--------------------------
+/* ------------------PY_OBECT DEFINITION-------------------------- */
 PyDoc_STRVAR(euler_doc,
 "This object gives access to Eulers in Blender."
 );
 PyTypeObject euler_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"Euler",                        //tp_name
-	sizeof(EulerObject),            //tp_basicsize
-	0,                              //tp_itemsize
-	(destructor)BaseMathObject_dealloc,     //tp_dealloc
-	NULL,                           //tp_print
-	NULL,                           //tp_getattr
-	NULL,                           //tp_setattr
-	NULL,                           //tp_compare
-	(reprfunc) Euler_repr,          //tp_repr
-	NULL,                           //tp_as_number
-	&Euler_SeqMethods,              //tp_as_sequence
-	&Euler_AsMapping,               //tp_as_mapping
-	NULL,                           //tp_hash
-	NULL,                           //tp_call
-	(reprfunc) Euler_str,           //tp_str
-	NULL,                           //tp_getattro
-	NULL,                           //tp_setattro
-	NULL,                           //tp_as_buffer
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags
-	euler_doc, //tp_doc
-	(traverseproc)BaseMathObject_traverse,  //tp_traverse
-	(inquiry)BaseMathObject_clear,  //tp_clear
-	(richcmpfunc)Euler_richcmpr,    //tp_richcompare
-	0,                              //tp_weaklistoffset
-	NULL,                           //tp_iter
-	NULL,                           //tp_iternext
-	Euler_methods,                  //tp_methods
-	NULL,                           //tp_members
-	Euler_getseters,                //tp_getset
-	NULL,                           //tp_base
-	NULL,                           //tp_dict
-	NULL,                           //tp_descr_get
-	NULL,                           //tp_descr_set
-	0,                              //tp_dictoffset
-	NULL,                           //tp_init
-	NULL,                           //tp_alloc
-	Euler_new,                      //tp_new
-	NULL,                           //tp_free
-	NULL,                           //tp_is_gc
-	NULL,                           //tp_bases
-	NULL,                           //tp_mro
-	NULL,                           //tp_cache
-	NULL,                           //tp_subclasses
-	NULL,                           //tp_weaklist
-	NULL                            //tp_del
+	"Euler",                        /* tp_name */
+	sizeof(EulerObject),            /* tp_basicsize */
+	0,                              /* tp_itemsize */
+	(destructor)BaseMathObject_dealloc,     /* tp_dealloc */
+	NULL,                           /* tp_print */
+	NULL,                           /* tp_getattr */
+	NULL,                           /* tp_setattr */
+	NULL,                           /* tp_compare */
+	(reprfunc) Euler_repr,          /* tp_repr */
+	NULL,                           /* tp_as_number */
+	&Euler_SeqMethods,              /* tp_as_sequence */
+	&Euler_AsMapping,               /* tp_as_mapping */
+	NULL,                           /* tp_hash */
+	NULL,                           /* tp_call */
+#ifndef MATH_STANDALONE
+	(reprfunc) Euler_str,           /* tp_str */
+#else
+	NULL,                           /* tp_str */
+#endif
+	NULL,                           /* tp_getattro */
+	NULL,                           /* tp_setattro */
+	NULL,                           /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+	euler_doc, /* tp_doc */
+	(traverseproc)BaseMathObject_traverse,  /* tp_traverse */
+	(inquiry)BaseMathObject_clear,  /* tp_clear */
+	(richcmpfunc)Euler_richcmpr,    /* tp_richcompare */
+	0,                              /* tp_weaklistoffset */
+	NULL,                           /* tp_iter */
+	NULL,                           /* tp_iternext */
+	Euler_methods,                  /* tp_methods */
+	NULL,                           /* tp_members */
+	Euler_getseters,                /* tp_getset */
+	NULL,                           /* tp_base */
+	NULL,                           /* tp_dict */
+	NULL,                           /* tp_descr_get */
+	NULL,                           /* tp_descr_set */
+	0,                              /* tp_dictoffset */
+	NULL,                           /* tp_init */
+	NULL,                           /* tp_alloc */
+	Euler_new,                      /* tp_new */
+	NULL,                           /* tp_free */
+	NULL,                           /* tp_is_gc */
+	NULL,                           /* tp_bases */
+	NULL,                           /* tp_mro */
+	NULL,                           /* tp_cache */
+	NULL,                           /* tp_subclasses */
+	NULL,                           /* tp_weaklist */
+	NULL                            /* tp_del */
 };
-//------------------------Euler_CreatePyObject (internal)-------------
-//creates a new euler object
+/* ------------------------Euler_CreatePyObject (internal)------------- */
+/* creates a new euler object */
 /* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
  * (i.e. it was allocated elsewhere by MEM_mallocN())
  * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index e04d45e..69e4c08 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -47,7 +47,7 @@ typedef struct {
  * be stored in py_data) or be a wrapper for data allocated through
  * blender (stored in blend_data). This is an either/or struct not both */
 
-//prototypes
+/* prototypes */
 PyObject *Euler_CreatePyObject(float *eul, const short order, int type, PyTypeObject *base_type);
 PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order,
                                   unsigned char cb_type, unsigned char cb_subtype);
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 9a0a1b3..05306f2 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -35,7 +35,10 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 typedef enum eMatrixAccess_t {
 	MAT_ACCESS_ROW,
@@ -182,7 +185,7 @@ static int mathutils_matrix_col_get(BaseMathObject *bmo, int col)
 		return -1;
 
 	/* for 'translation' size will always be '3' even on 4x4 vec */
-	num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+	num_row = min_ii(self->num_row, ((VectorObject *)bmo)->size);
 
 	for (row = 0; row < num_row; row++) {
 		bmo->data[row] = MATRIX_ITEM(self, row, col);
@@ -203,7 +206,7 @@ static int mathutils_matrix_col_set(BaseMathObject *bmo, int col)
 		return -1;
 
 	/* for 'translation' size will always be '3' even on 4x4 vec */
-	num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+	num_row = min_ii(self->num_row, ((VectorObject *)bmo)->size);
 
 	for (row = 0; row < num_row; row++) {
 		MATRIX_ITEM(self, row, col) = bmo->data[row];
@@ -329,9 +332,9 @@ Mathutils_Callback mathutils_matrix_translation_cb = {
 
 /* matrix column callbacks, this is so you can do matrix.translation = Vector()  */
 
-//----------------------------------mathutils.Matrix() -----------------
-//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-//create a new matrix type
+/* ----------------------------------mathutils.Matrix() ----------------- */
+/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */
+/* create a new matrix type */
 static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	if (kwds && PyDict_Size(kwds)) {
@@ -384,13 +387,19 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self)
 {
 	PyObject *ret = Matrix_copy(self);
-	PyObject *ret_dummy = matrix_func(ret);
-	if (ret_dummy) {
-		Py_DECREF(ret_dummy);
-		return (PyObject *)ret;
+	if (ret) {
+		PyObject *ret_dummy = matrix_func(ret);
+		if (ret_dummy) {
+			Py_DECREF(ret_dummy);
+			return (PyObject *)ret;
+		}
+		else { /* error */
+			Py_DECREF(ret);
+			return NULL;
+		}
 	}
-	else { /* error */
-		Py_DECREF(ret);
+	else {
+		/* copy may fail if the read callback errors out */
 		return NULL;
 	}
 }
@@ -410,7 +419,7 @@ static void matrix_3x3_as_4x4(float mat[16])
 
 /*-----------------------CLASS-METHODS----------------------------*/
 
-//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
+/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */
 PyDoc_STRVAR(C_Matrix_Identity_doc,
 ".. classmethod:: Identity(size)\n"
 "\n"
@@ -518,7 +527,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
 		const float angle_cos = cosf(angle);
 		const float angle_sin = sinf(angle);
 
-		//2D rotation matrix
+		/* 2D rotation matrix */
 		mat[0] =  angle_cos;
 		mat[1] =  angle_sin;
 		mat[2] = -angle_sin;
@@ -532,7 +541,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
 	if (matSize == 4) {
 		matrix_3x3_as_4x4(mat);
 	}
-	//pass to matrix creation
+	/* pass to matrix creation */
 	return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
 }
 
@@ -556,8 +565,8 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
 
 	return Matrix_CreatePyObject(&mat[0][0], 4, 4, Py_NEW, (PyTypeObject *)cls);
 }
-//----------------------------------mathutils.Matrix.Scale() -------------
-//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
+/* ----------------------------------mathutils.Matrix.Scale() ------------- */
+/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */
 PyDoc_STRVAR(C_Matrix_Scale_doc,
 ".. classmethod:: Scale(factor, size, axis)\n"
 "\n"
@@ -601,7 +610,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
 			return NULL;
 		}
 	}
-	if (vec == NULL) {  //scaling along axis
+	if (vec == NULL) {  /* scaling along axis */
 		if (matSize == 2) {
 			mat[0] = factor;
 			mat[3] = factor;
@@ -645,11 +654,11 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
 	if (matSize == 4) {
 		matrix_3x3_as_4x4(mat);
 	}
-	//pass to matrix creation
+	/* pass to matrix creation */
 	return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
 }
-//----------------------------------mathutils.Matrix.OrthoProjection() ---
-//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
+/* ----------------------------------mathutils.Matrix.OrthoProjection() --- */
+/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */
 PyDoc_STRVAR(C_Matrix_OrthoProjection_doc,
 ".. classmethod:: OrthoProjection(axis, size)\n"
 "\n"
@@ -685,7 +694,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
 		return NULL;
 	}
 
-	if (PyUnicode_Check(axis)) {    //ortho projection onto cardinal plane
+	if (PyUnicode_Check(axis)) {  /* ortho projection onto cardinal plane */
 		Py_ssize_t plane_len;
 		const char *plane = _PyUnicode_AsStringAndSize(axis, &plane_len);
 		if (matSize == 2) {
@@ -726,7 +735,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
 		}
 	}
 	else {
-		//arbitrary plane
+		/* arbitrary plane */
 
 		int vec_size = (matSize == 2 ? 2 : 3);
 		float tvec[4];
@@ -737,7 +746,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
 			return NULL;
 		}
 
-		//normalize arbitrary axis
+		/* normalize arbitrary axis */
 		for (x = 0; x < vec_size; x++) {
 			norm += tvec[x] * tvec[x];
 		}
@@ -766,7 +775,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
 	if (matSize == 4) {
 		matrix_3x3_as_4x4(mat);
 	}
-	//pass to matrix creation
+	/* pass to matrix creation */
 	return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
 }
 
@@ -869,7 +878,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
 	if (matSize == 4) {
 		matrix_3x3_as_4x4(mat);
 	}
-	//pass to matrix creation
+	/* pass to matrix creation */
 	return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
 }
 
@@ -1196,17 +1205,27 @@ static PyObject *Matrix_invert(MatrixObject *self)
 
 	if (det != 0) {
 		/* calculate the classical adjoint */
-		if (self->num_col == 2) {
-			mat[0] =  MATRIX_ITEM(self, 1, 1);
-			mat[1] = -MATRIX_ITEM(self, 0, 1);
-			mat[2] = -MATRIX_ITEM(self, 1, 0);
-			mat[3] =  MATRIX_ITEM(self, 0, 0);
-		}
-		else if (self->num_col == 3) {
-			adjoint_m3_m3((float (*)[3])mat, (float (*)[3])self->matrix);
-		}
-		else if (self->num_col == 4) {
-			adjoint_m4_m4((float (*)[4])mat, (float (*)[4])self->matrix);
+		switch (self->num_col) {
+			case 2:
+			{
+				adjoint_m2_m2((float (*)[2])mat, (float (*)[2])self->matrix);
+				break;
+			}
+			case 3:
+			{
+				adjoint_m3_m3((float (*)[3])mat, (float (*)[3])self->matrix);
+				break;
+			}
+			case 4:
+			{
+				adjoint_m4_m4((float (*)[4])mat, (float (*)[4])self->matrix);
+				break;
+			}
+			default:
+				PyErr_Format(PyExc_TypeError,
+				             "Matrix invert(ed): size (%d) unsupported",
+				             (int)self->num_col);
+				return NULL;
 		}
 		/* divide by determinate */
 		for (x = 0; x < (self->num_col * self->num_row); x++) {
@@ -1236,7 +1255,7 @@ PyDoc_STRVAR(Matrix_inverted_doc,
 "\n"
 "   Return an inverted copy of the matrix.\n"
 "\n"
-"   :return: the  inverted matrix.\n"
+"   :return: the inverted matrix.\n"
 "   :rtype: :class:`Matrix`\n"
 "\n"
 "   .. note:: When the matrix cant be inverted a :exc:`ValueError` exception is raised.\n"
@@ -1246,6 +1265,77 @@ static PyObject *Matrix_inverted(MatrixObject *self)
 	return matrix__apply_to_copy((PyNoArgsFunction)Matrix_invert, self);
 }
 
+/*---------------------------matrix.adjugate() ---------------------*/
+PyDoc_STRVAR(Matrix_adjugate_doc,
+".. method:: adjugate()\n"
+"\n"
+"   Set the matrix to its adjugate.\n"
+"\n"
+"   .. note:: When the matrix cant be adjugated a :exc:`ValueError` exception is raised.\n"
+"\n"
+"   .. seealso:: <http://en.wikipedia.org/wiki/Adjugate_matrix>\n"
+);
+static PyObject *Matrix_adjugate(MatrixObject *self)
+{
+	if (BaseMath_ReadCallback(self) == -1)
+		return NULL;
+
+	if (self->num_col != self->num_row) {
+		PyErr_SetString(PyExc_TypeError,
+		                "Matrix.adjugate(d): "
+		                "only square matrices are supported");
+		return NULL;
+	}
+
+	/* calculate the classical adjoint */
+	switch (self->num_col) {
+		case 2:
+		{
+			float mat[2][2];
+			adjoint_m2_m2(mat, (float (*)[2])self->matrix);
+			copy_v4_v4((float *)self->matrix, (float *)mat);
+			break;
+		}
+		case 3:
+		{
+			float mat[3][3];
+			adjoint_m3_m3(mat, (float (*)[3])self->matrix);
+			copy_m3_m3((float (*)[3])self->matrix, mat);
+			break;
+		}
+		case 4:
+		{
+			float mat[4][4];
+			adjoint_m4_m4(mat, (float (*)[4])self->matrix);
+			copy_m4_m4((float (*)[4])self->matrix, mat);
+			break;
+		}
+		default:
+			PyErr_Format(PyExc_TypeError,
+			             "Matrix adjugate(d): size (%d) unsupported",
+			             (int)self->num_col);
+			return NULL;
+	}
+
+	(void)BaseMath_WriteCallback(self);
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(Matrix_adjugated_doc,
+".. method:: adjugated()\n"
+"\n"
+"   Return an adjugated copy of the matrix.\n"
+"\n"
+"   :return: the adjugated matrix.\n"
+"   :rtype: :class:`Matrix`\n"
+"\n"
+"   .. note:: When the matrix cant be adjugated a :exc:`ValueError` exception is raised.\n"
+);
+static PyObject *Matrix_adjugated(MatrixObject *self)
+{
+	return matrix__apply_to_copy((PyNoArgsFunction)Matrix_adjugate, self);
+}
+
 PyDoc_STRVAR(Matrix_rotate_doc,
 ".. method:: rotate(other)\n"
 "\n"
@@ -1560,6 +1650,7 @@ static PyObject *Matrix_repr(MatrixObject *self)
 	return NULL;
 }
 
+#ifndef MATH_STANDALONE
 static PyObject *Matrix_str(MatrixObject *self)
 {
 	DynStr *ds;
@@ -1579,7 +1670,7 @@ static PyObject *Matrix_str(MatrixObject *self)
 		maxsize[col] = 0;
 		for (row = 0; row < self->num_row; row++) {
 			int size = BLI_snprintf(dummy_buf, sizeof(dummy_buf), "%.4f", MATRIX_ITEM(self, row, col));
-			maxsize[col] = MAX2(maxsize[col], size);
+			maxsize[col] = max_ii(maxsize[col], size);
 		}
 	}
 
@@ -1595,6 +1686,7 @@ static PyObject *Matrix_str(MatrixObject *self)
 
 	return mathutils_dynstr_to_py(ds); /* frees ds */
 }
+#endif
 
 static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
 {
@@ -1921,7 +2013,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
 			for (row = 0; row < mat1->num_row; row++) {
 				double dot = 0.0f;
 				for (item = 0; item < mat1->num_col; item++) {
-					dot += MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col);
+					dot += (double)(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col));
 				}
 				mat[(col * mat1->num_row) + row] = (float)dot;
 			}
@@ -2000,7 +2092,7 @@ static PyObject *Matrix_subscript(MatrixObject *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -2036,7 +2128,7 @@ static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *va
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -2281,6 +2373,8 @@ static struct PyMethodDef Matrix_methods[] = {
 	{"transposed", (PyCFunction) Matrix_transposed, METH_NOARGS, Matrix_transposed_doc},
 	{"invert", (PyCFunction) Matrix_invert, METH_NOARGS, Matrix_invert_doc},
 	{"inverted", (PyCFunction) Matrix_inverted, METH_NOARGS, Matrix_inverted_doc},
+	{"adjugate", (PyCFunction) Matrix_adjugate, METH_NOARGS, Matrix_adjugate_doc},
+	{"adjugated", (PyCFunction) Matrix_adjugated, METH_NOARGS, Matrix_adjugated_doc},
 	{"to_3x3", (PyCFunction) Matrix_to_3x3, METH_NOARGS, Matrix_to_3x3_doc},
 	/* TODO. {"resize_3x3", (PyCFunction) Matrix_resize3x3, METH_NOARGS, Matrix_resize3x3_doc}, */
 	{"to_4x4", (PyCFunction) Matrix_to_4x4, METH_NOARGS, Matrix_to_4x4_doc},
@@ -2329,14 +2423,18 @@ PyTypeObject matrix_Type = {
 	&Matrix_AsMapping,                  /*tp_as_mapping*/
 	NULL,                               /*tp_hash*/
 	NULL,                               /*tp_call*/
+#ifndef MATH_STANDALONE
 	(reprfunc) Matrix_str,              /*tp_str*/
+#else
+	NULL,                               /*tp_str*/
+#endif
 	NULL,                               /*tp_getattro*/
 	NULL,                               /*tp_setattro*/
 	NULL,                               /*tp_as_buffer*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
 	matrix_doc,                         /*tp_doc*/
-	(traverseproc)BaseMathObject_traverse,  //tp_traverse
-	(inquiry)BaseMathObject_clear,  //tp_clear
+	(traverseproc)BaseMathObject_traverse,  /* tp_traverse */
+	(inquiry)BaseMathObject_clear,      /*tp_clear*/
 	(richcmpfunc)Matrix_richcmpr,       /*tp_richcompare*/
 	0,                                  /*tp_weaklistoffset*/
 	NULL,                               /*tp_iter*/
@@ -2537,7 +2635,7 @@ static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -2635,8 +2733,8 @@ PyTypeObject matrix_access_Type = {
 	NULL,                               /*tp_as_buffer*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
 	NULL,                               /*tp_doc*/
-	(traverseproc)MatrixAccess_traverse,    //tp_traverse
-	(inquiry)MatrixAccess_clear,    //tp_clear
+	(traverseproc)MatrixAccess_traverse,/*tp_traverse*/
+	(inquiry)MatrixAccess_clear,        /*tp_clear*/
 	NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/
 	0,                                  /*tp_weaklistoffset*/
 	(getiterfunc)MatrixAccess_iter, /* getiterfunc tp_iter; */
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 2debff6..c28631e 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -35,7 +35,10 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 #define QUAT_SIZE 4
 
@@ -44,7 +47,7 @@ static void      quat__axis_angle_sanitize(float axis[3], float *angle);
 static PyObject *Quaternion_copy(QuaternionObject *self);
 static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args);
 
-//-----------------------------METHODS------------------------------
+/* -----------------------------METHODS------------------------------ */
 
 /* note: BaseMath_ReadCallback must be called beforehand */
 static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
@@ -124,7 +127,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
 
 	return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
 }
-//----------------------------Quaternion.toMatrix()------------------
+
 PyDoc_STRVAR(Quaternion_to_matrix_doc,
 ".. method:: to_matrix()\n"
 "\n"
@@ -144,7 +147,6 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
 	return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL);
 }
 
-//----------------------------Quaternion.toMatrix()------------------
 PyDoc_STRVAR(Quaternion_to_axis_angle_doc,
 ".. method:: to_axis_angle()\n"
 "\n"
@@ -176,8 +178,6 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
 	return ret;
 }
 
-
-//----------------------------Quaternion.cross(other)------------------
 PyDoc_STRVAR(Quaternion_cross_doc,
 ".. method:: cross(other)\n"
 "\n"
@@ -205,7 +205,6 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
 	return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
 }
 
-//----------------------------Quaternion.dot(other)------------------
 PyDoc_STRVAR(Quaternion_dot_doc,
 ".. method:: dot(other)\n"
 "\n"
@@ -335,8 +334,8 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
 	Py_RETURN_NONE;
 }
 
-//----------------------------Quaternion.normalize()----------------
-//normalize the axis of rotation of [theta, vector]
+/* ----------------------------Quaternion.normalize()---------------- */
+/* normalize the axis of rotation of [theta, vector] */
 PyDoc_STRVAR(Quaternion_normalize_doc,
 ".. function:: normalize()\n"
 "\n"
@@ -365,7 +364,6 @@ static PyObject *Quaternion_normalized(QuaternionObject *self)
 	return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self);
 }
 
-//----------------------------Quaternion.invert()------------------
 PyDoc_STRVAR(Quaternion_invert_doc,
 ".. function:: invert()\n"
 "\n"
@@ -394,7 +392,6 @@ static PyObject *Quaternion_inverted(QuaternionObject *self)
 	return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self);
 }
 
-//----------------------------Quaternion.identity()-----------------
 PyDoc_STRVAR(Quaternion_identity_doc,
 ".. function:: identity()\n"
 "\n"
@@ -413,7 +410,7 @@ static PyObject *Quaternion_identity(QuaternionObject *self)
 	(void)BaseMath_WriteCallback(self);
 	Py_RETURN_NONE;
 }
-//----------------------------Quaternion.negate()-------------------
+
 PyDoc_STRVAR(Quaternion_negate_doc,
 ".. function:: negate()\n"
 "\n"
@@ -432,7 +429,7 @@ static PyObject *Quaternion_negate(QuaternionObject *self)
 	(void)BaseMath_WriteCallback(self);
 	Py_RETURN_NONE;
 }
-//----------------------------Quaternion.conjugate()----------------
+
 PyDoc_STRVAR(Quaternion_conjugate_doc,
 ".. function:: conjugate()\n"
 "\n"
@@ -461,7 +458,6 @@ static PyObject *Quaternion_conjugated(QuaternionObject *self)
 	return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self);
 }
 
-//----------------------------Quaternion.copy()----------------
 PyDoc_STRVAR(Quaternion_copy_doc,
 ".. function:: copy()\n"
 "\n"
@@ -487,8 +483,7 @@ static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args)
 	return Quaternion_copy(self);
 }
 
-//----------------------------print object (internal)--------------
-//print the object to screen
+/* print the object to screen */
 static PyObject *Quaternion_repr(QuaternionObject *self)
 {
 	PyObject *ret, *tuple;
@@ -504,6 +499,7 @@ static PyObject *Quaternion_repr(QuaternionObject *self)
 	return ret;
 }
 
+#ifndef MATH_STANDALONE
 static PyObject *Quaternion_str(QuaternionObject *self)
 {
 	DynStr *ds;
@@ -518,6 +514,7 @@ static PyObject *Quaternion_str(QuaternionObject *self)
 
 	return mathutils_dynstr_to_py(ds); /* frees ds */
 }
+#endif
 
 static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
 {
@@ -555,15 +552,15 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
 	return Py_INCREF(res), res;
 }
 
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
+/* ---------------------SEQUENCE PROTOCOLS------------------------ */
+/* ----------------------------len(object)------------------------ */
+/* sequence length */
 static int Quaternion_len(QuaternionObject *UNUSED(self))
 {
 	return QUAT_SIZE;
 }
-//----------------------------object[]---------------------------
-//sequence accessor (get)
+/* ----------------------------object[]--------------------------- */
+/* sequence accessor (get) */
 static PyObject *Quaternion_item(QuaternionObject *self, int i)
 {
 	if (i < 0) i = QUAT_SIZE - i;
@@ -581,8 +578,8 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i)
 	return PyFloat_FromDouble(self->quat[i]);
 
 }
-//----------------------------object[]-------------------------
-//sequence accessor (set)
+/* ----------------------------object[]------------------------- */
+/* sequence accessor (set) */
 static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
 {
 	float scalar = (float)PyFloat_AsDouble(ob);
@@ -608,8 +605,8 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
 
 	return 0;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (get) */
 static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
 {
 	PyObject *tuple;
@@ -630,8 +627,8 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
 
 	return tuple;
 }
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
+/* ----------------------------object[z:y]------------------------ */
+/* sequence slice (set) */
 static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyObject *seq)
 {
 	int i, size;
@@ -678,7 +675,7 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -715,7 +712,7 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -734,9 +731,9 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb
 	}
 }
 
-//------------------------NUMERIC PROTOCOLS----------------------
-//------------------------obj + obj------------------------------
-//addition
+/* ------------------------NUMERIC PROTOCOLS---------------------- */
+/* ------------------------obj + obj------------------------------ */
+/* addition */
 static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
 {
 	float quat[QUAT_SIZE];
@@ -758,8 +755,8 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
 	add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
 	return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
 }
-//------------------------obj - obj------------------------------
-//subtraction
+/* ------------------------obj - obj------------------------------ */
+/* subtraction */
 static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
 {
 	int x;
@@ -875,7 +872,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self)
 }
 
 
-//-----------------PROTOCOL DECLARATIONS--------------------------
+/* -----------------PROTOCOL DECLARATIONS-------------------------- */
 static PySequenceMethods Quaternion_SeqMethods = {
 	(lenfunc) Quaternion_len,               /* sq_length */
 	(binaryfunc) NULL,                      /* sq_concat */
@@ -1060,7 +1057,7 @@ static int Quaternion_axis_vector_set(QuaternionObject *self, PyObject *value, v
 	return 0;
 }
 
-//----------------------------------mathutils.Quaternion() --------------
+/* ----------------------------------mathutils.Quaternion() -------------- */
 static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	PyObject *seq = NULL;
@@ -1140,7 +1137,7 @@ static void quat__axis_angle_sanitize(float axis[3], float *angle)
 	}
 }
 
-//-----------------------METHOD DEFINITIONS ----------------------
+/* -----------------------METHOD DEFINITIONS ---------------------- */
 static struct PyMethodDef Quaternion_methods[] = {
 	/* in place only */
 	{"identity", (PyCFunction) Quaternion_identity, METH_NOARGS, Quaternion_identity_doc},
@@ -1190,60 +1187,64 @@ static PyGetSetDef Quaternion_getseters[] = {
 	{NULL, NULL, NULL, NULL, NULL}  /* Sentinel */
 };
 
-//------------------PY_OBECT DEFINITION--------------------------
+/* ------------------PY_OBECT DEFINITION-------------------------- */
 PyDoc_STRVAR(quaternion_doc,
 "This object gives access to Quaternions in Blender."
 );
 PyTypeObject quaternion_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"Quaternion",             //tp_name
-	sizeof(QuaternionObject),           //tp_basicsize
-	0,                                  //tp_itemsize
-	(destructor)BaseMathObject_dealloc, //tp_dealloc
-	NULL,                               //tp_print
-	NULL,                               //tp_getattr
-	NULL,                               //tp_setattr
-	NULL,                               //tp_compare
-	(reprfunc) Quaternion_repr,         //tp_repr
-	&Quaternion_NumMethods,             //tp_as_number
-	&Quaternion_SeqMethods,             //tp_as_sequence
-	&Quaternion_AsMapping,              //tp_as_mapping
-	NULL,                               //tp_hash
-	NULL,                               //tp_call
-	(reprfunc) Quaternion_str,          //tp_str
-	NULL,                               //tp_getattro
-	NULL,                               //tp_setattro
-	NULL,                               //tp_as_buffer
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags
-	quaternion_doc, //tp_doc
-	(traverseproc)BaseMathObject_traverse,  //tp_traverse
-	(inquiry)BaseMathObject_clear,  //tp_clear
-	(richcmpfunc)Quaternion_richcmpr,   //tp_richcompare
-	0,                                  //tp_weaklistoffset
-	NULL,                               //tp_iter
-	NULL,                               //tp_iternext
-	Quaternion_methods,                 //tp_methods
-	NULL,                               //tp_members
-	Quaternion_getseters,               //tp_getset
-	NULL,                               //tp_base
-	NULL,                               //tp_dict
-	NULL,                               //tp_descr_get
-	NULL,                               //tp_descr_set
-	0,                                  //tp_dictoffset
-	NULL,                               //tp_init
-	NULL,                               //tp_alloc
-	Quaternion_new,                     //tp_new
-	NULL,                               //tp_free
-	NULL,                               //tp_is_gc
-	NULL,                               //tp_bases
-	NULL,                               //tp_mro
-	NULL,                               //tp_cache
-	NULL,                               //tp_subclasses
-	NULL,                               //tp_weaklist
-	NULL,                               //tp_del
+	"Quaternion",                       /* tp_name */
+	sizeof(QuaternionObject),           /* tp_basicsize */
+	0,                                  /* tp_itemsize */
+	(destructor)BaseMathObject_dealloc, /* tp_dealloc */
+	NULL,                               /* tp_print */
+	NULL,                               /* tp_getattr */
+	NULL,                               /* tp_setattr */
+	NULL,                               /* tp_compare */
+	(reprfunc) Quaternion_repr,         /* tp_repr */
+	&Quaternion_NumMethods,             /* tp_as_number */
+	&Quaternion_SeqMethods,             /* tp_as_sequence */
+	&Quaternion_AsMapping,              /* tp_as_mapping */
+	NULL,                               /* tp_hash */
+	NULL,                               /* tp_call */
+#ifndef MATH_STANDALONE
+	(reprfunc) Quaternion_str,          /* tp_str */
+#else
+	NULL,                               /* tp_str */
+#endif
+	NULL,                               /* tp_getattro */
+	NULL,                               /* tp_setattro */
+	NULL,                               /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+	quaternion_doc, /* tp_doc */
+	(traverseproc)BaseMathObject_traverse,  /* tp_traverse */
+	(inquiry)BaseMathObject_clear,  /* tp_clear */
+	(richcmpfunc)Quaternion_richcmpr,   /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
+	NULL,                               /* tp_iter */
+	NULL,                               /* tp_iternext */
+	Quaternion_methods,                 /* tp_methods */
+	NULL,                               /* tp_members */
+	Quaternion_getseters,               /* tp_getset */
+	NULL,                               /* tp_base */
+	NULL,                               /* tp_dict */
+	NULL,                               /* tp_descr_get */
+	NULL,                               /* tp_descr_set */
+	0,                                  /* tp_dictoffset */
+	NULL,                               /* tp_init */
+	NULL,                               /* tp_alloc */
+	Quaternion_new,                     /* tp_new */
+	NULL,                               /* tp_free */
+	NULL,                               /* tp_is_gc */
+	NULL,                               /* tp_bases */
+	NULL,                               /* tp_mro */
+	NULL,                               /* tp_cache */
+	NULL,                               /* tp_subclasses */
+	NULL,                               /* tp_weaklist */
+	NULL,                               /* tp_del */
 };
-//------------------------Quaternion_CreatePyObject (internal)-------------
-//creates a new quaternion object
+/* ------------------------Quaternion_CreatePyObject (internal)------------- */
+/* creates a new quaternion object */
 /*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
  * (i.e. it was allocated elsewhere by MEM_mallocN())
  *  pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
@@ -1266,7 +1267,7 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
 		}
 		else if (type == Py_NEW) {
 			self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float));
-			if (!quat) { //new empty
+			if (!quat) {  /* new empty */
 				unit_qt(self->quat);
 			}
 			else {
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index 4ffe848..b887150 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -44,7 +44,7 @@ typedef struct {
  * be stored in py_data) or be a wrapper for data allocated through
  * blender (stored in blend_data). This is an either/or struct not both */
 
-//prototypes
+/* prototypes */
 PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type);
 PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
                                        unsigned char cb_type, unsigned char cb_subtype);
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index d461486..f8159f6 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -35,7 +35,10 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_dynstr.h"
+
+#ifndef MATH_STANDALONE
+#  include "BLI_dynstr.h"
+#endif
 
 #define MAX_DIMENSIONS 4
 
@@ -1100,12 +1103,12 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
 	if (BaseMath_ReadCallback(self) == -1)
 		return NULL;
 
-	//get dot products
+	/* get dot products */
 	for (x = 0; x < size; x++) {
 		dot += (double)(self->vec[x] * tvec[x]);
 		dot2 += (double)(tvec[x] * tvec[x]);
 	}
-	//projection
+	/* projection */
 	dot /= dot2;
 	for (x = 0; x < size; x++) {
 		vec[x] = (float)dot * tvec[x];
@@ -1231,6 +1234,7 @@ static PyObject *Vector_repr(VectorObject *self)
 	return ret;
 }
 
+#ifndef MATH_STANDALONE
 static PyObject *Vector_str(VectorObject *self)
 {
 	int i;
@@ -1252,7 +1256,7 @@ static PyObject *Vector_str(VectorObject *self)
 
 	return mathutils_dynstr_to_py(ds); /* frees ds */
 }
-
+#endif
 
 /* Sequence Protocol */
 /* sequence length len(vector) */
@@ -1976,7 +1980,7 @@ static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
 			return NULL;
 
 		if (slicelength <= 0) {
@@ -2012,7 +2016,7 @@ static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *va
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
+		if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
 			return -1;
 
 		if (step == 1)
@@ -2709,11 +2713,11 @@ static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *
 	memcpy(vec_cpy, vec->vec, vec_size * sizeof(float));
 
 	r_vec[3] = 1.0f;
-	//muliplication
+	/* muliplication */
 	for (col = 0; col < mat->num_col; col++) {
 		double dot = 0.0;
 		for (row = 0; row < mat->num_row; row++) {
-			dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
+			dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[row]);
 		}
 		r_vec[z++] = (float)dot;
 	}
@@ -2733,7 +2737,7 @@ static PyObject *Vector_negate(VectorObject *self)
 
 	negate_vn(self->vec, self->size);
 
-	(void)BaseMath_WriteCallback(self); // already checked for error
+	(void)BaseMath_WriteCallback(self);  /* already checked for error */
 	Py_RETURN_NONE;
 }
 
@@ -2784,7 +2788,7 @@ static struct PyMethodDef Vector_methods[] = {
 /* Note
  * Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
  * but this means for eg that
- * (vec * mat) and (mat * vec) both get sent to Vector_mul and it neesd to sort out the order
+ * (vec * mat) and (mat * vec) both get sent to Vector_mul and it needs to sort out the order
  */
 
 PyDoc_STRVAR(vector_doc,
@@ -2816,7 +2820,11 @@ PyTypeObject vector_Type = {
 
 	NULL,                       /* hashfunc tp_hash; */
 	NULL,                       /* ternaryfunc tp_call; */
+#ifndef MATH_STANDALONE
 	(reprfunc)Vector_str,       /* reprfunc tp_str; */
+#else
+	NULL,                       /* reprfunc tp_str; */
+#endif
 	NULL,                       /* getattrofunc tp_getattro; */
 	NULL,                       /* setattrofunc tp_setattro; */
 
@@ -2829,10 +2837,10 @@ PyTypeObject vector_Type = {
 	/*** Assigned meaning in release 2.0 ***/
 
 	/* call function for all accessible objects */
-	(traverseproc)BaseMathObject_traverse,  //tp_traverse
+	(traverseproc)BaseMathObject_traverse,  /* tp_traverse */
 
 	/* delete references to contained objects */
-	(inquiry)BaseMathObject_clear,  //tp_clear
+	(inquiry)BaseMathObject_clear,  /* tp_clear */
 
 	/***  Assigned meaning in release 2.1 ***/
 	/*** rich comparisons ***/
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 818f30e..1db0538 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -51,7 +51,7 @@ PyDoc_STRVAR(M_Geometry_doc,
 "The Blender geometry module"
 );
 
-//---------------------------------INTERSECTION FUNCTIONS--------------------
+/* ---------------------------------INTERSECTION FUNCTIONS-------------------- */
 
 PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc,
 ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n"
@@ -251,10 +251,6 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
 	}
 }
 
-
-
-
-//----------------------------geometry.normal() -------------------
 PyDoc_STRVAR(M_Geometry_normal_doc,
 ".. function:: normal(v1, v2, v3, v4=None)\n"
 "\n"
@@ -338,7 +334,7 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
 	return Vector_CreatePyObject(n, 3, Py_NEW, NULL);
 }
 
-//--------------------------------- AREA FUNCTIONS--------------------
+/* --------------------------------- AREA FUNCTIONS-------------------- */
 
 PyDoc_STRVAR(M_Geometry_area_tri_doc,
 ".. function:: area_tri(v1, v2, v3)\n"
@@ -977,12 +973,14 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
 
 		float n1n2[3], n2n3[3], n3n1[3];
 		float potentialVertex[3];
-		char *planes_used = MEM_callocN(sizeof(char) * len, __func__);
+		char *planes_used = PyMem_Malloc(sizeof(char) * len);
 
 		/* python */
 		PyObject *py_verts = PyList_New(0);
 		PyObject *py_plene_index = PyList_New(0);
 
+		memset(planes_used, 0, sizeof(char) * len);
+
 		for (i = 0; i < len; i++) {
 			const float *N1 = planes[i];
 			for (j = i + 1; j < len; j++) {
@@ -1035,7 +1033,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
 				Py_DECREF(item);
 			}
 		}
-		MEM_freeN(planes_used);
+		PyMem_Free(planes_used);
 
 		{
 			PyObject *ret = PyTuple_New(2);
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index da32e36..4977663 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -43,6 +43,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_noise.h"
 #include "BLI_utildefines.h"
 
 #include "MEM_guardedalloc.h"
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index bb87fe2..e0858cd 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -143,7 +143,7 @@ QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue)
 int quicktime_rnatmpvalue_from_videocodectype(int codecType)
 {
 	int i;
-	for (i=0;i<qtVideoCodecCount;i++) {
+	for (i = 0; i < qtVideoCodecCount; i++) {
 		if (qtVideoCodecList[i].codecType == codecType)
 			return qtVideoCodecList[i].rnatmpvalue;
 	}
@@ -154,12 +154,12 @@ int quicktime_rnatmpvalue_from_videocodectype(int codecType)
 int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
 {
 	int i;
-	for (i=0;i<qtVideoCodecCount;i++) {
+	for (i = 0; i < qtVideoCodecCount; i++) {
 		if (qtVideoCodecList[i].rnatmpvalue == rnatmpvalue)
 			return qtVideoCodecList[i].codecType;
 	}
 	
-	return 0;	
+	return 0;
 }
 
 /* Audio codec */
@@ -188,7 +188,7 @@ QuicktimeCodecTypeDesc* quicktime_get_audiocodecType_desc(int indexValue)
 int quicktime_rnatmpvalue_from_audiocodectype(int codecType)
 {
 	int i;
-	for (i=0;i<qtAudioCodecCount;i++) {
+	for (i = 0; i < qtAudioCodecCount; i++) {
 		if (qtAudioCodecList[i].codecType == codecType)
 			return qtAudioCodecList[i].rnatmpvalue;
 	}
@@ -199,12 +199,12 @@ int quicktime_rnatmpvalue_from_audiocodectype(int codecType)
 int quicktime_audiocodecType_from_rnatmpvalue(int rnatmpvalue)
 {
 	int i;
-	for (i=0;i<qtAudioCodecCount;i++) {
+	for (i = 0; i < qtAudioCodecCount; i++) {
 		if (qtAudioCodecList[i].rnatmpvalue == rnatmpvalue)
 			return qtAudioCodecList[i].codecType;
 	}
 	
-	return 0;	
+	return 0;
 }
 
 
@@ -212,7 +212,7 @@ static NSString *stringWithCodecType(int codecType)
 {
 	char str[5];
 	
-	*((int*)str) = EndianU32_NtoB(codecType);
+	*((int *)str) = EndianU32_NtoB(codecType);
 	str[4] = 0;
 	
 	return [NSString stringWithCString:str encoding:NSASCIIStringEncoding];
@@ -235,7 +235,7 @@ void makeqtstring (RenderData *rd, char *string)
 
 void filepath_qt(char *string, RenderData *rd)
 {
-	if (string==NULL) return;
+	if (string == NULL) return;
 	
 	strcpy(string, rd->pic);
 	BLI_path_abs(string, G.main->name);
@@ -313,8 +313,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	NSError *error;
 	char name[1024];
-	int success= 1;
-	OSStatus err=noErr;
+	int success = 1;
+	OSStatus err = noErr;
 
 	if(qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
 	
@@ -323,7 +323,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 	/* Check first if the QuickTime 7.2.1 initToWritableFile: method is available */
 	if ([[[[QTMovie alloc] init] autorelease] respondsToSelector:@selector(initToWritableFile:error:)] != YES) {
 		BKE_report(reports, RPT_ERROR, "\nUnable to create quicktime movie, need Quicktime rev 7.2.1 or later");
-		success= 0;
+		success = 0;
 	}
 	else {
 		makeqtstring(rd, name);
@@ -543,7 +543,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 
 		if(qtexport->movie == nil) {
 			BKE_report(reports, RPT_ERROR, "Unable to create quicktime movie.");
-			success= 0;
+			success = 0;
 			if (qtexport->filename) [qtexport->filename release];
 			qtexport->filename = nil;
 			if (qtexport->audioFileName) [qtexport->audioFileName release];
@@ -561,19 +561,21 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 			
 			/* specifying the codec attributes : try to retrieve them from render data first*/
 			if (rd->qtcodecsettings.codecType) {
-				qtexport->frameAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
-											 stringWithCodecType(rd->qtcodecsettings.codecType),
-											 QTAddImageCodecType,
-											 [NSNumber numberWithLong:((rd->qtcodecsettings.codecSpatialQuality)*codecLosslessQuality)/100],
-											 QTAddImageCodecQuality,
-											 nil];
+				qtexport->frameAttributes = [
+				        NSDictionary dictionaryWithObjectsAndKeys:
+				        stringWithCodecType(rd->qtcodecsettings.codecType),
+				        QTAddImageCodecType,
+				        [NSNumber numberWithLong:((rd->qtcodecsettings.codecSpatialQuality)*codecLosslessQuality)/100],
+				        QTAddImageCodecQuality,
+				        nil];
 			}
 			else {
-				qtexport->frameAttributes = [NSDictionary dictionaryWithObjectsAndKeys:@"jpeg",
-											 QTAddImageCodecType,
-											 [NSNumber numberWithLong:codecHighQuality],
-											 QTAddImageCodecQuality,
-											 nil];
+				qtexport->frameAttributes = [
+				        NSDictionary dictionaryWithObjectsAndKeys:@"jpeg",
+				        QTAddImageCodecType,
+				        [NSNumber numberWithLong:codecHighQuality],
+				        QTAddImageCodecQuality,
+				        nil];
 			}
 			[qtexport->frameAttributes retain];
 			
@@ -624,8 +626,8 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
 		return 0;
 	}
 	
-	from_Ptr = (unsigned char*)pixels;
-	to_Ptr = (unsigned char*)[blBitmapFormatImage bitmapData];
+	from_Ptr = (unsigned char *)pixels;
+	to_Ptr = (unsigned char *)[blBitmapFormatImage bitmapData];
 	for (y = 0; y < recty; y++) {
 		to_i = (recty-y-1)*rectx;
 		from_i = y*rectx;
@@ -647,7 +649,7 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
 	if (qtexport->audioFile) {
 		UInt32 audioPacketsConverted;
 		/* Append audio */
-		while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {	
+		while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {
 
 			qtexport->audioBufferList.mNumberBuffers = 1;
 			qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame;
@@ -683,7 +685,7 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
 
 		}
 	}
-	[pool drain];	
+	[pool drain];
 
 	return 1;
 }
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 75b9056..2e910e3 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -71,7 +71,7 @@ void quicktime_init(void)
 
 void quicktime_exit(void)
 {
-	if(G.have_quicktime) {
+	if (G.have_quicktime) {
 		free_qtcomponentdata();
 	}
 }
@@ -82,27 +82,30 @@ int anim_is_quicktime (const char *name)
 	NSAutoreleasePool *pool;
 	
 	// don't let quicktime movie import handle these
-	if( BLI_testextensie(name, ".swf") ||
-		BLI_testextensie(name, ".txt") ||
-		BLI_testextensie(name, ".mpg") ||
-		BLI_testextensie(name, ".avi") ||	// wouldn't be appropriate ;)
-		BLI_testextensie(name, ".mov") ||	// disabled, suboptimal decoding speed   
-		BLI_testextensie(name, ".mp4") ||	// disabled, suboptimal decoding speed
-		BLI_testextensie(name, ".m4v") ||	// disabled, suboptimal decoding speed
-		BLI_testextensie(name, ".tga") ||
-		BLI_testextensie(name, ".png") ||
-		BLI_testextensie(name, ".bmp") ||
-		BLI_testextensie(name, ".jpg") ||
-		BLI_testextensie(name, ".wav") ||
-		BLI_testextensie(name, ".zip") ||
-		BLI_testextensie(name, ".mp3")) return 0;
+	if (BLI_testextensie(name, ".swf") ||
+	    BLI_testextensie(name, ".txt") ||
+	    BLI_testextensie(name, ".mpg") ||
+	    BLI_testextensie(name, ".avi") ||	// wouldn't be appropriate ;)
+	    BLI_testextensie(name, ".mov") ||	// disabled, suboptimal decoding speed
+	    BLI_testextensie(name, ".mp4") ||	// disabled, suboptimal decoding speed
+	    BLI_testextensie(name, ".m4v") ||	// disabled, suboptimal decoding speed
+	    BLI_testextensie(name, ".tga") ||
+	    BLI_testextensie(name, ".png") ||
+	    BLI_testextensie(name, ".bmp") ||
+	    BLI_testextensie(name, ".jpg") ||
+	    BLI_testextensie(name, ".wav") ||
+	    BLI_testextensie(name, ".zip") ||
+	    BLI_testextensie(name, ".mp3"))
+	{
+		return 0;
+	}
 
-	if(QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
+	if (QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
 
 	pool = [[NSAutoreleasePool alloc] init];
 	
-	if([QTMovie canInitWithFile:[NSString stringWithCString:name 
-								 encoding:[NSString defaultCStringEncoding]]])
+	if ([QTMovie canInitWithFile:[NSString stringWithCString:name
+	                              encoding:[NSString defaultCStringEncoding]]])
 	{
 		[pool drain];
 		return true;
@@ -147,7 +150,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
 	uchar *toIBuf = NULL;
 	int x, y, to_i, from_i;
 	NSSize bitmapSize;
-	NSBitmapImageRep *blBitmapFormatImageRGB,*blBitmapFormatImageRGBA,*bitmapImage=nil;
+	NSBitmapImageRep *blBitmapFormatImageRGB,*blBitmapFormatImageRGBA, *bitmapImage = nil;
 	NSEnumerator *enumerator;
 	NSImageRep *representation;
 	
@@ -162,18 +165,18 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
 	/*Get the bitmap of the image*/
 	enumerator = [[sourceImage representations] objectEnumerator];
 	while ((representation = [enumerator nextObject])) {
-        if ([representation isKindOfClass:[NSBitmapImageRep class]]) {
-            bitmapImage = (NSBitmapImageRep *)representation;
+		if ([representation isKindOfClass:[NSBitmapImageRep class]]) {
+			bitmapImage = (NSBitmapImageRep *)representation;
 			break;
-        }
-    }
+		}
+	}
 	if (bitmapImage == nil) return NULL;
 
 	if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0)
 		&& ![bitmapImage isPlanar]) {
 		/* Try a fast copy if the image is a meshed RGBA 32bit bitmap*/
-		toIBuf = (uchar*)ibuf->rect;
-		rasterRGB = (uchar*)[bitmapImage bitmapData];
+		toIBuf = (uchar *)ibuf->rect;
+		rasterRGB = (uchar *)[bitmapImage bitmapData];
 		for (y = 0; y < height; y++) {
 			to_i = (height-y-1)*width;
 			from_i = y*width;
@@ -207,7 +210,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
 		[bitmapImage draw];
 		[NSGraphicsContext restoreGraphicsState];
 		
-		rasterRGB = (uchar*)[blBitmapFormatImageRGB bitmapData];
+		rasterRGB = (uchar *)[blBitmapFormatImageRGB bitmapData];
 		if (rasterRGB == NULL) {
 			[blBitmapFormatImageRGB release];
 			return NULL;
@@ -228,7 +231,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
 		[bitmapImage draw];
 		[NSGraphicsContext restoreGraphicsState];
 		
-		rasterRGBA = (uchar*)[blBitmapFormatImageRGBA bitmapData];
+		rasterRGBA = (uchar *)[blBitmapFormatImageRGBA bitmapData];
 		if (rasterRGBA == NULL) {
 			[blBitmapFormatImageRGB release];
 			[blBitmapFormatImageRGBA release];
@@ -236,7 +239,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
 		}
 
 		/*Copy the image to ibuf, flipping it vertically*/
-		toIBuf = (uchar*)ibuf->rect;
+		toIBuf = (uchar *)ibuf->rect;
 		for (y = 0; y < height; y++) {
 			for (x = 0; x < width; x++) {
 				to_i = (height-y-1)*width + x;
@@ -312,7 +315,7 @@ int startquicktime (struct anim *anim)
 
 	pool = [[NSAutoreleasePool alloc] init];
 	
-	[QTMovie enterQTKitOnThread];		
+	[QTMovie enterQTKitOnThread];
 
 	attributes = [NSDictionary dictionaryWithObjectsAndKeys:
 	        [NSString stringWithCString:anim->name
@@ -382,7 +385,7 @@ int startquicktime (struct anim *anim)
 	anim->curposition = 0;
 
 	[pool drain];
-												 
+
 	return 0;
 }
 
@@ -486,7 +489,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 		[bitmapImage draw];
 		[NSGraphicsContext restoreGraphicsState];
 		
-		rasterRGB = (uchar*)[blBitmapFormatImageRGB bitmapData];
+		rasterRGB = (uchar *)[blBitmapFormatImageRGB bitmapData];
 		if (rasterRGB == NULL) {
 			[bitmapImage release];
 			[blBitmapFormatImageRGB release];
@@ -509,7 +512,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 		[bitmapImage draw];
 		[NSGraphicsContext restoreGraphicsState];
 		
-		rasterRGBA = (uchar*)[blBitmapFormatImageRGBA bitmapData];
+		rasterRGBA = (uchar *)[blBitmapFormatImageRGBA bitmapData];
 		if (rasterRGBA == NULL) {
 			[bitmapImage release];
 			[blBitmapFormatImageRGB release];
@@ -519,7 +522,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 		}
 		
 		/*Copy the image to ibuf, flipping it vertically*/
-		toIBuf = (uchar*)ibuf->rect;
+		toIBuf = (uchar *)ibuf->rect;
 		for (x = 0; x < bitmapSize.width; x++) {
 			for (y = 0; y < bitmapSize.height; y++) {
 				to_i = (bitmapSize.height-y-1)*bitmapSize.width + x;
@@ -543,7 +546,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 	if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
 	
 	/* return successfully */
-	return (ibuf);	
+	return (ibuf);
 }
 
 
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 659fd99..1c4ab5a 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -105,8 +105,8 @@ typedef struct QuicktimeExport {
 	PixMapHandle thePixMap;
 	ImageDescription    **anImageDescription;
 
-	ImBuf       *ibuf;  //imagedata for Quicktime's Gworld
-	ImBuf       *ibuf2; //copy of renderdata, to be Y-flipped
+	ImBuf       *ibuf;   /* imagedata for Quicktime's Gworld */
+	ImBuf       *ibuf2;  /* copy of renderdata, to be Y-flipped */
 
 } QuicktimeExport;
 
@@ -178,7 +178,7 @@ int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
 			return qtVideoCodecList[i].codecType;
 	}
 	
-	return 0;	
+	return 0;
 }
 
 
@@ -218,7 +218,7 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
 	/* retreive codecdata from quicktime in a atomcontainer */
 	myErr = SCGetSettingsAsAtomContainer(qtdata->theComponent,  &myContainer);
 	if (myErr != noErr) {
-		BKE_reportf(reports, RPT_ERROR, "Quicktime: SCGetSettingsAsAtomContainer failed\n");
+		BKE_report(reports, RPT_ERROR, "Quicktime: SCGetSettingsAsAtomContainer failed");
 		goto bail;
 	}
 
@@ -238,7 +238,7 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
 		GetCodecInfo(&ci, qtdata->gSpatialSettings.codecType, 0);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed\n"); 
+		BKE_report(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed"); 
 	}
 
 	QTUnlockContainer(myContainer);
@@ -268,7 +268,7 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
 	if (qcd->cdParms && qcd->cdSize) {
 		myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
 		if (myErr != noErr) {
-			BKE_reportf(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed\n");
+			BKE_report(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed");
 			goto bail;
 		}
 
@@ -278,9 +278,9 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
 		SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
 
 
-		//Fill the render QuicktimeCodecSettigns struct
+		/* Fill the render QuicktimeCodecSettigns struct */
 		rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
-		//Do not override scene frame rate (qtdata->gTemporalSettings.framerate)
+		/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
 		rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
 		
 		rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
@@ -291,11 +291,11 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
 		rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
 		rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
 		rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
-		//Frame duration is already known (qtdata->aDataRateSetting.frameDuration)
+		/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
 		
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed\n"); 
+		BKE_report(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed");
 	}
 bail:
 	if (myHandle != NULL)
@@ -414,7 +414,7 @@ static void QT_StartAddVideoSamplesToMedia(const Rect *trackFrame, int rectx, in
 	gTemporalSettings = qtdata->gTemporalSettings;
 	if (qtdata->gSpatialSettings.codecType == kH264CodecType) {
 		if (gTemporalSettings.temporalQuality != codecMinQuality) {
-			BKE_reportf(reports, RPT_WARNING, "Only minimum quality compression supported for QuickTime H.264.\n");
+			BKE_report(reports, RPT_WARNING, "Only minimum quality compression supported for Quicktime H.264");
 			gTemporalSettings.temporalQuality = codecMinQuality;
 		}
 	}
@@ -443,18 +443,18 @@ static void QT_DoAddVideoSamplesToMedia(int frame, int *pixels, int rectx, int r
 	Ptr myPtr;
 
 
-	//copy and flip renderdata
+	/* copy and flip renderdata */
 	memcpy(qtexport->ibuf2->rect, pixels, 4 * rectx * recty);
 	IMB_flipy(qtexport->ibuf2);
 
-	//get pointers to parse bitmapdata
+	/* get pointers to parse bitmapdata */
 	myPtr = GetPixBaseAddr(qtexport->thePixMap);
 	imageRect = (**qtexport->thePixMap).bounds;
 
 	from = (unsigned char *) qtexport->ibuf2->rect;
 	to = (unsigned char *) myPtr;
 
-	//parse RGBA bitmap into Quicktime's ARGB GWorld
+	/* parse RGBA bitmap into Quicktime's ARGB GWorld */
 	boxsize = rectx * recty;
 	for (index = 0; index < boxsize; index++) {
 		to[0] = from[3];
@@ -564,7 +564,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 	/* hack: create an empty file to make FSPathMakeRef() happy */
 	myFile = open(theFullPath, O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRUSR | S_IWUSR);
 	if (myFile < 0) {
-		BKE_reportf(reports, RPT_ERROR, "error while creating movie file!\n");
+		BKE_report(reports, RPT_ERROR, "Error while creating movie file!");
 		/* do something? */
 	}
 	close(myFile);
@@ -599,7 +599,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 #endif
 	}
 	else {
-		//printf("Created QuickTime movie: %s\n", name);
+		/* printf("Created QuickTime movie: %s\n", name); */
 
 		QT_CreateMyVideoTrack(rectx, recty, reports);
 	}
@@ -636,7 +636,7 @@ void end_qt(void)
 
 		DisposeMovie(qtexport->theMovie);
 
-		//printf("Finished QuickTime movie.\n");
+		/* printf("Finished QuickTime movie.\n"); */
 	}
 
 #ifdef __APPLE__
@@ -684,15 +684,15 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
 	err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType,   &qtdata->gTemporalSettings);
 	CheckError(err, "SCSetInfo error", reports);
 
-	if (qtdata->gTemporalSettings.frameRate == 1571553) {           // 23.98 fps
+	if (qtdata->gTemporalSettings.frameRate == 1571553) {       /* 23.98 fps */
 		qtdata->kVideoTimeScale = 24000;
 		qtdata->duration = 1001;
 	}
-	else if (qtdata->gTemporalSettings.frameRate == 1964113) {  // 29.97 fps
+	else if (qtdata->gTemporalSettings.frameRate == 1964113) {  /* 29.97 fps */
 		qtdata->kVideoTimeScale = 30000;
 		qtdata->duration = 1001;
 	}
-	else if (qtdata->gTemporalSettings.frameRate == 3928227) {  // 59.94 fps
+	else if (qtdata->gTemporalSettings.frameRate == 3928227) {  /* 59.94 fps */
 		qtdata->kVideoTimeScale = 60000;
 		qtdata->duration = 1001;
 	}
@@ -714,7 +714,7 @@ void quicktime_verify_image_type(RenderData *rd, ImageFormatData *imf)
 			rd->qtcodecsettings.codecSpatialQuality = (codecHighQuality * 100) / codecLosslessQuality;
 			rd->qtcodecsettings.codecTemporalQuality = (codecHighQuality * 100) / codecLosslessQuality;
 			rd->qtcodecsettings.keyFrameRate = 25;
-			rd->qtcodecsettings.bitRate = 5000000; //5 Mbps
+			rd->qtcodecsettings.bitRate = 5000000;  /* 5 Mbps */
 		}
 	}
 }
@@ -804,7 +804,7 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 		qtdata->aDataRateSetting.minSpatialQuality = (rd->qtcodecsettings.minSpatialQuality * codecLosslessQuality) / 100;
 		qtdata->aDataRateSetting.minTemporalQuality = (rd->qtcodecsettings.minTemporalQuality * codecLosslessQuality) / 100;
 		
-		qtdata->aDataRateSetting.frameDuration = rd->frs_sec;		
+		qtdata->aDataRateSetting.frameDuration = rd->frs_sec;
 		
 		err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType,   &qtdata->gTemporalSettings);
 		CheckError(err, "SCSetInfo1 error", op->reports);
@@ -826,9 +826,9 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 	SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
 	
 	
-	//Fill the render QuicktimeCodecSettings struct
+	/* Fill the render QuicktimeCodecSettings struct */
 	rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
-	//Do not override scene frame rate (qtdata->gTemporalSettings.framerate)
+	/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
 	rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
 	
 	rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
@@ -839,26 +839,26 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 	rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
 	rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
 	rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
-	//Frame duration is already known (qtdata->aDataRateSetting.frameDuration)
+	/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
 	
 	QT_SaveCodecSettingsToScene(rd, op->reports);
 
 	/* framerate jugglin' */
-	if (qtdata->gTemporalSettings.frameRate == 1571553) {           // 23.98 fps
+	if (qtdata->gTemporalSettings.frameRate == 1571553) {           /* 23.98 fps */
 		qtdata->kVideoTimeScale = 24000;
 		qtdata->duration = 1001;
 
 		rd->frs_sec = 24;
 		rd->frs_sec_base = 1.001;
 	}
-	else if (qtdata->gTemporalSettings.frameRate == 1964113) {  // 29.97 fps
+	else if (qtdata->gTemporalSettings.frameRate == 1964113) {  /* 29.97 fps */
 		qtdata->kVideoTimeScale = 30000;
 		qtdata->duration = 1001;
 
 		rd->frs_sec = 30;
 		rd->frs_sec_base = 1.001;
 	}
-	else if (qtdata->gTemporalSettings.frameRate == 3928227) {  // 59.94 fps
+	else if (qtdata->gTemporalSettings.frameRate == 3928227) {  /* 59.94 fps */
 		qtdata->kVideoTimeScale = 60000;
 		qtdata->duration = 1001;
 
@@ -891,8 +891,8 @@ static int ED_operator_setqtcodec(bContext *C)
 }
 
 #if defined(__APPLE__) && defined(GHOST_COCOA)
-//Need to set up a Cocoa NSAutoReleasePool to avoid memory leak
-//And it must be done in an objC file, so use a GHOST_SystemCocoa.mm function for that
+/* Need to set up a Cocoa NSAutoReleasePool to avoid memory leak
+ * And it must be done in an objC file, so use a GHOST_SystemCocoa.mm function for that */
 extern int cocoa_request_qtcodec_settings(bContext *C, wmOperator *op);
 
 int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index cef4cb8..a3469dd 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -87,8 +87,8 @@ void makeqtstring(struct RenderData *rd, char *string);		//for playanim.c
 
 
 
-#if (defined(USE_QTKIT) && defined(MAC_OS_X_VERSION_10_6) && __LP64__)
-//Include the quicktime codec types constants that are missing in QTKitDefines.h in 10.6 / 64bit
+#if (defined(USE_QTKIT) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && __LP64__)
+//Include the quicktime codec types constants that are missing in QTKitDefines.h
 enum {
 	kRawCodecType						= 'raw ',
 	kCinepakCodecType 					= 'cvid',
diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h
index fb068fc..8fd016a 100644
--- a/source/blender/quicktime/quicktime_import.h
+++ b/source/blender/quicktime/quicktime_import.h
@@ -43,35 +43,33 @@
 #include "../imbuf/IMB_imbuf_types.h"
 
 #ifndef USE_QTKIT
-#ifndef __MOVIES__
-#ifdef _WIN32
-#include <Movies.h>
-#elif defined(__APPLE__)
-#define __CARBONSOUND__
-#import <Carbon/Carbon.h>
-#include <QuickTime/Movies.h>
-#endif
-#endif  /* __MOVIES__ */
+#  ifndef __MOVIES__
+#    ifdef _WIN32
+#      include <Movies.h>
+#    elif defined(__APPLE__)
+#      define __CARBONSOUND__
+#      import <Carbon/Carbon.h>
+#      include <QuickTime/Movies.h>
+#    endif
+#  endif  /* __MOVIES__ */
 #endif  /* USE_QTKIT */
 
 #ifdef _WIN32
-#ifndef __FIXMATH__
-#include <FixMath.h>
-#endif /* __FIXMATH__ */
+#  ifndef __FIXMATH__
+#    include <FixMath.h>
+#  endif /* __FIXMATH__ */
 #endif /* _WIN32 _ */
 
-
 char *get_valid_qtname(const char *name);
 
-
-// quicktime movie import functions
+/* quicktime movie import functions */
 
 int		anim_is_quicktime (const char *name);
 int		startquicktime (struct anim *anim);
 void	free_anim_quicktime (struct anim *anim);
 ImBuf  *qtime_fetchibuf (struct anim *anim, int position);
 
-// quicktime image import functions
+/* quicktime image import functions */
 
 int		imb_is_a_quicktime (char *name);
 ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags);
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 2376aec..d2ffc3a 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -35,6 +35,8 @@
 #include "DNA_listBase.h"
 #include "RNA_types.h"
 
+struct bNode;
+struct bNodeTree;
 struct Object;
 struct Render;
 struct RenderEngine;
@@ -58,6 +60,7 @@ struct Scene;
 #define RE_ENGINE_PREVIEW		2
 #define RE_ENGINE_DO_DRAW		4
 #define RE_ENGINE_DO_UPDATE		8
+#define RE_ENGINE_RENDERING		16
 
 extern ListBase R_engines;
 
@@ -75,6 +78,8 @@ typedef struct RenderEngineType {
 	void (*view_update)(struct RenderEngine *engine, const struct bContext *context);
 	void (*view_draw)(struct RenderEngine *engine, const struct bContext *context);
 
+	void (*update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node);
+
 	/* RNA integration */
 	ExtensionRNA ext;
 } RenderEngineType;
@@ -94,6 +99,8 @@ typedef struct RenderEngine {
 	char *text;
 
 	int resolution_x, resolution_y;
+
+	struct ReportList *reports;
 } RenderEngine;
 
 RenderEngine *RE_engine_create(RenderEngineType *type);
@@ -109,6 +116,7 @@ void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, int
 int RE_engine_test_break(RenderEngine *engine);
 void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
 void RE_engine_update_progress(RenderEngine *engine, float progress);
+void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak);
 void RE_engine_report(RenderEngine *engine, int type, const char *msg);
 
 int RE_engine_render(struct Render *re, int do_all);
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index c7a8bfe..ecdd177 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -83,7 +83,7 @@ typedef struct RenderLayer {
 	/* copy of RenderData */
 	char name[RE_MAXNAME];
 	unsigned int lay, lay_zmask, lay_exclude;
-	int layflag, passflag, pass_xor;		
+	int layflag, passflag, pass_xor;
 	
 	struct Material *mat_override;
 	struct Group *light_override;
@@ -148,6 +148,7 @@ typedef struct RenderStats {
 	double starttime, lastframetime;
 	const char *infostr, *statstr;
 	char scene_name[MAX_ID_NAME - 2];
+	float mem_used, mem_peak;
 } RenderStats;
 
 /* *********************** API ******************** */
@@ -169,6 +170,8 @@ void RE_FreeRender (struct Render *re);
 void RE_FreeAllRender (void);
 /* only call on file load */
 void RE_FreeAllRenderResults(void);
+/* for external render engines that can keep persistent data */
+void RE_FreePersistentData(void);
 
 /* get results and statistics */
 void RE_FreeRenderResult(struct RenderResult *rr);
@@ -235,7 +238,7 @@ void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce
 
 /* ancient stars function... go away! */
 void RE_make_stars(struct Render *re, struct Scene *scenev3d, void (*initfunc)(void),
-                   void (*vertexfunc)(float*),  void (*termfunc)(void));
+                   void (*vertexfunc)(float *),  void (*termfunc)(void));
 
 /* display and event callbacks */
 void RE_display_init_cb	(struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr));
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 57fb80f..10045a8 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -191,12 +191,12 @@ struct MTex;
 struct ImBuf;
 
 /* this one uses nodes */
-int	multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
+int	multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres);
 /* nodes disabled */
-int multitex_ext_safe(struct Tex *tex, float *texvec, struct TexResult *texres);
+int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres);
 /* only for internal node usage */
-int multitex_nodes(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres,
-	short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex);
+int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres,
+                   const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex);
 
 /* shaded view and bake */
 struct Render;
diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h
index 2413888..d0f346f 100644
--- a/source/blender/render/intern/include/envmap.h
+++ b/source/blender/render/intern/include/envmap.h
@@ -46,7 +46,7 @@ struct Render;
 struct TexResult;
 
 void make_envmaps(struct Render *re);
-int envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
+int envmaptex(struct Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres);
 
 #endif /* __ENVMAP_H__ */
 
diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h
index 43ab955..73dc29c 100644
--- a/source/blender/render/intern/include/initrender.h
+++ b/source/blender/render/intern/include/initrender.h
@@ -40,8 +40,9 @@ struct Object;
 void free_sample_tables(Render *re);
 void make_sample_tables(Render *re);
 
-void initparts(Render *re, int do_crop);
-void freeparts(Render *re);
+void RE_parts_clamp(Render *re);
+void RE_parts_init(Render *re, int do_crop);
+void RE_parts_free(Render *re);
 
 
 #endif /* __INITRENDER_H__ */
diff --git a/source/blender/render/intern/include/pointdensity.h b/source/blender/render/intern/include/pointdensity.h
index cc8fabd..e0c293e 100644
--- a/source/blender/render/intern/include/pointdensity.h
+++ b/source/blender/render/intern/include/pointdensity.h
@@ -43,7 +43,7 @@ struct TexResult;
 void cache_pointdensity(struct Render *re, struct Tex *tex);
 void make_pointdensities(struct Render *re);
 void free_pointdensities(struct Render *re);
-int pointdensitytex(struct Tex *tex, float *texvec, struct TexResult *texres);
+int pointdensitytex(struct Tex *tex, const float texvec[3], struct TexResult *texres);
 
 #endif /* __POINTDENSITY_H__ */
 
diff --git a/source/blender/render/intern/include/rayobject.h b/source/blender/render/intern/include/rayobject.h
index 7752baa..07fc7d7 100644
--- a/source/blender/render/intern/include/rayobject.h
+++ b/source/blender/render/intern/include/rayobject.h
@@ -104,7 +104,7 @@ RayObject *RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstance
 void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max);
 
 /* initializes an hint for optimizing raycast where it is know that a ray will pass by the given BB often the origin point */
-void RE_rayobject_hint_bb(RayObject *r, struct RayHint *hint, float *min, float *max);
+void RE_rayobject_hint_bb(RayObject *r, struct RayHint *hint, float min[3], float max[3]);
 
 /* initializes an hint for optimizing raycast where it is know that a ray will be contained inside the given cone*/
 /* void RE_rayobject_hint_cone(RayObject *r, struct RayHint *hint, float *); */
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 85dbd93..6ed8d6a 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -59,6 +59,7 @@ struct RenderBuckets;
 struct ObjectInstanceRen;
 struct RayObject;
 struct RayFace;
+struct RenderEngine;
 struct ReportList;
 struct Main;
 
@@ -120,12 +121,15 @@ struct Render
 	/* state settings */
 	short flag, osa, ok, result_ok;
 	
+	/* due to performance issues, getting initialized from color management settings once on Render initialization */
+	short scene_color_manage;
+	
 	/* result of rendering */
 	RenderResult *result;
 	/* if render with single-layer option, other rendered layers are stored here */
 	RenderResult *pushedresult;
 	/* a list of RenderResults, for fullsample */
-	ListBase fullresult;	
+	ListBase fullresult;
 	/* read/write mutex, all internal code that writes to re->result must use a
 	 * write lock, all external code must use a read lock. internal code is assumed
 	 * to not conflict with writes, so no lock used for that */
@@ -142,8 +146,6 @@ struct Render
 	/* final picture width and height (within disprect) */
 	int rectx, recty;
 	
-	/* real maximum amount of xparts/yparts after correction for minimum */
-	int xparts, yparts;
 	/* real maximum size of parts after correction for minimum 
 	 * partx*xparts can be larger than rectx, in that case last part is smaller */
 	int partx, party;
@@ -182,6 +184,9 @@ struct Render
 	
 	ListBase parts;
 	
+	/* render engine */
+	struct RenderEngine *engine;
+	
 	/* octree tables and variables for raytrace */
 	struct RayObject *raytree;
 	struct RayFace *rayfaces;
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 0fbbf52..3071225 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -62,7 +62,7 @@ typedef struct PixStrMain {
 /* ------------------------------------------------------------------------- */
 
 
-void	calc_view_vector(float *view, float x, float y);
+void	calc_view_vector(float view[3], float x, float y);
 float   mistfactor(float zcor, const float co[3]); /* dist and height, return alpha */
 
 void	renderspothalo(struct ShadeInput *shi, float col[4], float alpha);
@@ -95,5 +95,4 @@ extern void init_ao_sphere(struct World *wrld);
 extern void init_render_qmcsampler(Render *re);
 extern void free_render_qmcsampler(Render *re);
 
-#endif /* RENDER_EXT_H */
-
+#endif  /* __RENDERCORE_H__ */
diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h
index d116dfe..5213f14 100644
--- a/source/blender/render/intern/include/renderdatabase.h
+++ b/source/blender/render/intern/include/renderdatabase.h
@@ -88,7 +88,7 @@ void free_renderdata_vertnodes(struct VertTableNode *vertnodes);
 void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes);
 
 void project_renderdata(struct Render *re, void (*projectfunc)(const float *, float mat[][4], float *),  int do_pano, float xoffs, int do_buckets);
-int clip_render_object(float boundbox[][3], float *bounds, float mat[][4]);
+int clip_render_object(float boundbox[][3], float bounds[4], float mat[][4]);
 
 /* functions are not exported... so wrong names */
 
diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h
index 5cde8e5..7c168ba 100644
--- a/source/blender/render/intern/include/shadbuf.h
+++ b/source/blender/render/intern/include/shadbuf.h
@@ -79,19 +79,19 @@ float ISB_getshadow(ShadeInput *shi, ShadBuf *shb);
 
 /* buffer samples, allocated in camera buffer and pointed to in lampbuffer nodes */
 typedef struct ISBSample {
-	float zco[3];			/* coordinate in lampview projection */
-	short *shadfac;			/* initialized zero = full lighted */
-	int obi;				/* object for face lookup */
-	int facenr;				/* index in faces list */	
+	float zco[3];           /* coordinate in lampview projection */
+	short *shadfac;         /* initialized zero = full lighted */
+	int obi;                /* object for face lookup */
+	int facenr;             /* index in faces list */
 } ISBSample;
 
 /* transparent version of buffer sample */
 typedef struct ISBSampleA {
-	float zco[3];				/* coordinate in lampview projection */
-	short *shadfac;				/* NULL = full lighted */
-	int obi;					/* object for face lookup */
-	int facenr;					/* index in faces list */	
-	struct ISBSampleA *next;	/* in end, we want the first items to align with ISBSample */
+	float zco[3];               /* coordinate in lampview projection */
+	short *shadfac;             /* NULL = full lighted */
+	int obi;                    /* object for face lookup */
+	int facenr;                 /* index in faces list */
+	struct ISBSampleA *next;    /* in end, we want the first items to align with ISBSample */
 } ISBSampleA;
 
 /* used for transparent storage only */
diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h
index a8519d8..4f6e005 100644
--- a/source/blender/render/intern/include/shading.h
+++ b/source/blender/render/intern/include/shading.h
@@ -60,7 +60,7 @@ void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
 void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3);
 void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip);
 void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from);
-void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float *dxyview, float *co, float *dxco, float *dyco);
+void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float dxyview[2], float co[3], float dxco[3], float dyco[3]);
 void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z);
 void shade_input_set_uv(struct ShadeInput *shi);
 void shade_input_set_normals(struct ShadeInput *shi);
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index 74e4210..60fa8aa 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -43,8 +43,7 @@ typedef struct SunSky {
 
 	float perez_Y[5], perez_x[5], perez_y[5];
 
-	/* suggested by glome in 
-	 * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
+	/* suggested by glome in patch [#8063] */
 	float horizon_brightness;
 	float spread;
 	float sun_brightness;
@@ -69,7 +68,7 @@ typedef struct SunSky {
 	float atm_BetaRM[3];
 } SunSky;
 
-void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, 
+void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float horizon_brightness,
                 float spread, float sun_brightness, float sun_size, float back_scatter,
                 float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
 
diff --git a/source/blender/render/intern/include/texture_ocean.h b/source/blender/render/intern/include/texture_ocean.h
index 7d4110a..121142a 100644
--- a/source/blender/render/intern/include/texture_ocean.h
+++ b/source/blender/render/intern/include/texture_ocean.h
@@ -23,4 +23,9 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-int ocean_texture(struct Tex *tex, float *texvec, struct TexResult *texres);
+#ifndef __TEXTURE_OCEAN_H__
+#define __TEXTURE_OCEAN_H__
+
+int ocean_texture(struct Tex *tex, const float texvec[2], struct TexResult *texres);
+
+#endif  /* __TEXTURE_OCEAN_H__ */
diff --git a/source/blender/render/intern/include/volume_precache.h b/source/blender/render/intern/include/volume_precache.h
index 8e402bc..9aa280d 100644
--- a/source/blender/render/intern/include/volume_precache.h
+++ b/source/blender/render/intern/include/volume_precache.h
@@ -30,8 +30,8 @@
  */
 
 
-void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *bbmax);
-int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co);
+void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float bbmin[3], float bbmax[3]);
+int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, const float co[3]);
 
 void volume_precache(Render *re);
 void free_volume_precache(Render *re);
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index 103c04a..47d3a89 100644
--- a/source/blender/render/intern/raytrace/bvh.h
+++ b/source/blender/render/intern/raytrace/bvh.h
@@ -91,7 +91,7 @@ static inline int rayobject_bb_intersect_test(const Isect *isec, const float *_b
 	if (t1x > t2y  || t2x < t1y  || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
 	if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0;
 	if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
-	RE_RC_COUNT(isec->raycounter->bb.hit);	
+	RE_RC_COUNT(isec->raycounter->bb.hit);
 
 	return 1;
 }
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index 6f14c61..c3babf9 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -467,7 +467,7 @@ float RE_rayobject_cost(RayObject *r)
 
 /* Bounding Boxes */
 
-void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
+void RE_rayobject_merge_bb(RayObject *r, float min[3], float max[3])
 {
 	if (RE_rayobject_isRayFace(r)) {
 		RayFace *face = (RayFace *) RE_rayobject_align(r);
diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
index 2d642a0..198577f 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -79,7 +79,7 @@ typedef struct BVHObject {
 RayObject *RE_rayobject_blibvh_create(int size)
 {
 	BVHObject *obj = (BVHObject *)MEM_callocN(sizeof(BVHObject), "BVHObject");
-	assert(RE_rayobject_isAligned(obj)); /* RayObject API assumes real data to be 4-byte aligned */	
+	assert(RE_rayobject_isAligned(obj));  /* RayObject API assumes real data to be 4-byte aligned */
 	
 	obj->rayobj.api = &bvh_api;
 	obj->bvh = BLI_bvhtree_new(size, 0.0, 4, 6);
@@ -137,7 +137,7 @@ static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob)
 	DO_MIN(min_max,     obj->bb[0]);
 	DO_MAX(min_max + 3, obj->bb[1]);
 	
-	BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);	
+	BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);
 	*(obj->next_leaf++) = ob;
 }
 
diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp
index c3e761a..f797f7a 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -59,7 +59,7 @@ static RayObjectAPI instance_api =
 	RE_rayobject_instance_free,
 	RE_rayobject_instance_bb,
 	RE_rayobject_instance_cost,
-	RE_rayobject_instance_hint_bb	
+	RE_rayobject_instance_hint_bb
 };
 
 typedef struct InstanceRayObject {
diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h
index 3f768e5..aa8ab8c 100644
--- a/source/blender/render/intern/raytrace/rayobject_internal.h
+++ b/source/blender/render/intern/raytrace/rayobject_internal.h
@@ -50,7 +50,7 @@ typedef int  (*RE_rayobjectcontrol_test_break_callback)(void *data);
 
 typedef struct RayObjectControl {
 	void *data;
-	RE_rayobjectcontrol_test_break_callback test_break;	
+	RE_rayobjectcontrol_test_break_callback test_break;
 } RayObjectControl;
 
 /* Returns true if for some reason a heavy processing function should stop
@@ -92,7 +92,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *c);
  *               eg.: on render code)
  *
  *  0 means it's reserved and has it own meaning inside each ray acceleration structure
- *  (this way each structure can use the allign offset to determine if a node represents a
+ *  (this way each structure can use the align offset to determine if a node represents a
  *   RayObject primitive, which can be used to save memory)
  */
 
@@ -124,9 +124,9 @@ typedef int  (*RE_rayobject_raycast_callback)(RayObject *, struct Isect *);
 typedef void (*RE_rayobject_add_callback)(RayObject *raytree, RayObject *rayobject);
 typedef void (*RE_rayobject_done_callback)(RayObject *);
 typedef void (*RE_rayobject_free_callback)(RayObject *);
-typedef void (*RE_rayobject_merge_bb_callback)(RayObject *, float *min, float *max);
+typedef void (*RE_rayobject_merge_bb_callback)(RayObject *, float min[3], float max[3]);
 typedef float (*RE_rayobject_cost_callback)(RayObject *);
-typedef void (*RE_rayobject_hint_bb_callback)(RayObject *, struct RayHint *, float *, float *);
+typedef void (*RE_rayobject_hint_bb_callback)(RayObject *, struct RayHint *, float min[3], float max[3]);
 
 typedef struct RayObjectAPI {
 	RE_rayobject_raycast_callback	raycast;
@@ -154,5 +154,4 @@ int RE_rayobject_intersect(RayObject *r, struct Isect *i);
 }
 #endif
 
-#endif
-
+#endif  /* __RAYOBJECT_INTERNAL_H__ */
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index 5ae716a..afb8fe6 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -382,8 +382,12 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
 	
 	while (TRUE) {
 		
-		if (x < 0 || y < 0 || x >= oc->ocres || y >= oc->ocres) ;
-		else ocface[oc->ocres * x + y] = 1;
+		if (x < 0 || y < 0 || x >= oc->ocres || y >= oc->ocres) {
+			/* pass*/
+		}
+		else {
+			ocface[oc->ocres * x + y] = 1;
+		}
 		
 		labdao = labda;
 		if (labdax == labday) {
@@ -1022,7 +1026,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 
 			labdao = ddalabda;
 			
-			/* traversing ocree nodes need careful detection of smallest values, with proper
+			/* traversing octree nodes need careful detection of smallest values, with proper
 			 * exceptions for equal labdas */
 			eqval = (labdax == labday);
 			if (labday == labdaz) eqval += 2;
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index 16d7029..33ce3bd 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -68,7 +68,7 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
 
 	//Build and optimize the tree
 	//TODO do this in 1 pass (half memory usage during building)
-	VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);	
+	VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
 
 	if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
 		BLI_memarena_free(arena1);
diff --git a/source/blender/render/intern/raytrace/rayobject_raycounter.cpp b/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
index 7d86b6c..5335bf5 100644
--- a/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
@@ -43,10 +43,10 @@ void RE_RC_INFO(RayCounter *info)
 	printf("\n");
 	printf("BB tests: %llu\n", info->bb.test );
 	printf("BB hits: %llu\n", info->bb.hit );
-	printf("\n");	
+	printf("\n");
 	printf("SIMD BB tests: %llu\n", info->simd_bb.test );
 	printf("SIMD BB hits: %llu\n", info->simd_bb.hit );
-	printf("\n");	
+	printf("\n");
 	printf("Primitives tests: %llu\n", info->faces.test );
 	printf("Primitives hits: %llu\n", info->faces.hit );
 	printf("------------------------------------\n");
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index 3926e8b..4195b10 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -77,7 +77,7 @@ RTBuilder *rtbuild_create(int size)
 	for (int i = 0; i < 3; i++) {
 		builder->sorted_begin[i] = (RTBuilder::Object **)MEM_mallocN(sizeof(RTBuilder::Object *) * size, "RTBuilder.sorted_objects");
 		builder->sorted_end[i]   = builder->sorted_begin[i];
-	} 
+	}
 	
 
 	return builder;
@@ -193,7 +193,7 @@ static void rtbuild_calc_bb(RTBuilder *b)
 	}
 }
 
-void rtbuild_merge_bb(RTBuilder *b, float *min, float *max)
+void rtbuild_merge_bb(RTBuilder *b, float min[3], float max[3])
 {
 	rtbuild_calc_bb(b);
 	DO_MIN(b->bb, min);
@@ -224,7 +224,7 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
 	Mleafs_per_child = s / nchilds;
 	mleafs_per_child = Mleafs_per_child / nchilds;
 	
-	//split min leafs per child	
+	//split min leafs per child
 	b->child_offset[0] = 0;
 	for (i = 1; i <= nchilds; i++)
 		b->child_offset[i] = mleafs_per_child;
@@ -295,7 +295,7 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
 				return rtbuild_mean_split(b, nchilds, axis);
 		
 		return nchilds;
-	}	
+	}
 }
 
 int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
@@ -324,7 +324,7 @@ struct SweepCost {
 /* Object Surface Area Heuristic splitter */
 int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 {
-	int size = rtbuild_size(b);		
+	int size = rtbuild_size(b);
 	assert(nchilds == 2);
 	assert(size > 1);
 	int baxis = -1, boffset = 0;
@@ -348,12 +348,12 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 					sweep[i].cost = obj[i]->cost;
 				}
 				else {
-					sweep[i].bb[0] = MIN2(obj[i]->bb[0], sweep[i + 1].bb[0]);
-					sweep[i].bb[1] = MIN2(obj[i]->bb[1], sweep[i + 1].bb[1]);
-					sweep[i].bb[2] = MIN2(obj[i]->bb[2], sweep[i + 1].bb[2]);
-					sweep[i].bb[3] = MAX2(obj[i]->bb[3], sweep[i + 1].bb[3]);
-					sweep[i].bb[4] = MAX2(obj[i]->bb[4], sweep[i + 1].bb[4]);
-					sweep[i].bb[5] = MAX2(obj[i]->bb[5], sweep[i + 1].bb[5]);
+					sweep[i].bb[0] = min_ff(obj[i]->bb[0], sweep[i + 1].bb[0]);
+					sweep[i].bb[1] = min_ff(obj[i]->bb[1], sweep[i + 1].bb[1]);
+					sweep[i].bb[2] = min_ff(obj[i]->bb[2], sweep[i + 1].bb[2]);
+					sweep[i].bb[3] = max_ff(obj[i]->bb[3], sweep[i + 1].bb[3]);
+					sweep[i].bb[4] = max_ff(obj[i]->bb[4], sweep[i + 1].bb[4]);
+					sweep[i].bb[5] = max_ff(obj[i]->bb[5], sweep[i + 1].bb[5]);
 					sweep[i].cost  = obj[i]->cost + sweep[i + 1].cost;
 				}
 //				right_cost += obj[i]->cost;
@@ -375,8 +375,8 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 				
 				// not using log seems to have no impact on raytracing perf, but
 				// makes tree construction quicker, left out for now to test (brecht)
-				// left_side = bb_area(sweep_left.bb, sweep_left.bb+3)*(sweep_left.cost+logf((float)i));
-				// right_side= bb_area(sweep[i].bb, sweep[i].bb+3)*(sweep[i].cost+logf((float)size-i));
+				// left_side  = bb_area(sweep_left.bb, sweep_left.bb + 3) * (sweep_left.cost + logf((float)i));
+				// right_side = bb_area(sweep[i].bb,   sweep[i].bb   + 3) * (sweep[i].cost   + logf((float)size - i));
 				left_side = bb_area(sweep_left.bb, sweep_left.bb + 3) * (sweep_left.cost);
 				right_side = bb_area(sweep[i].bb, sweep[i].bb + 3) * (sweep[i].cost);
 				hcost = left_side + right_side;
@@ -429,13 +429,13 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 	for (int i = 0; i < 3; i++)
 		std::stable_partition(b->sorted_begin[i], b->sorted_end[i], selected_node);
 
-	return nchilds;		
+	return nchilds;
 }
 
 /*
  * Helper code
  * PARTITION code / used on mean-split
- * basicly this a std::nth_element (like on C++ STL algorithm)
+ * basically this a std::nth_element (like on C++ STL algorithm)
  */
 #if 0
 static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis)
@@ -457,26 +457,26 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis)
 /*
  * Bounding Box utils
  */
-float bb_volume(float *min, float *max)
+float bb_volume(const float min[3], const float max[3])
 {
 	return (max[0] - min[0]) * (max[1] - min[1]) * (max[2] - min[2]);
 }
 
-float bb_area(float *min, float *max)
+float bb_area(const float min[3], const float max[3])
 {
 	float sub[3], a;
 	sub[0] = max[0] - min[0];
 	sub[1] = max[1] - min[1];
 	sub[2] = max[2] - min[2];
 
-	a = (sub[0] * sub[1] + sub[0] * sub[2] + sub[1] * sub[2]) * 2;
+	a = (sub[0] * sub[1] + sub[0] * sub[2] + sub[1] * sub[2]) * 2.0f;
 	/* used to have an assert() here on negative results
 	 * however, in this case its likely some overflow or ffast math error.
 	 * so just return 0.0f instead. */
 	return a < 0.0f ? 0.0f : a;
 }
 
-int bb_largest_axis(float *min, float *max)
+int bb_largest_axis(const float min[3], const float max[3])
 {
 	float sub[3];
 	
@@ -494,10 +494,12 @@ int bb_largest_axis(float *min, float *max)
 			return 1;
 		else
 			return 2;
-	}	
+	}
 }
 
-int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *inner_max)
+/* only returns 0 if merging inner and outerbox would create a box larger than outer box */
+int bb_fits_inside(const float outer_min[3], const float outer_max[3],
+                   const float inner_min[3], const float inner_max[3])
 {
 	int i;
 	for (i = 0; i < 3; i++)
@@ -506,5 +508,5 @@ int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *
 	for (i = 0; i < 3; i++)
 		if (outer_max[i] < inner_max[i]) return 0;
 
-	return 1;	
+	return 1;
 }
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.h b/source/blender/render/intern/raytrace/rayobject_rtbuild.h
index 22e3d00..9e296da 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.h
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.h
@@ -86,7 +86,7 @@ RTBuilder *rtbuild_create(int size);
 void rtbuild_free(RTBuilder *b);
 void rtbuild_add(RTBuilder *b, RayObject *o);
 void rtbuild_done(RTBuilder *b, RayObjectControl *c);
-void rtbuild_merge_bb(RTBuilder *b, float *min, float *max);
+void rtbuild_merge_bb(RTBuilder *b, float min[3], float max[3]);
 int rtbuild_size(RTBuilder *b);
 
 RayObject *rtbuild_get_primitive(RTBuilder *b, int offset);
@@ -109,13 +109,14 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds);
 
 
 /* bb utils */
-float bb_area(float *min, float *max);
-float bb_volume(float *min, float *max);
-int bb_largest_axis(float *min, float *max);
-int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *inner_max); /* only returns 0 if merging inner and outerbox would create a box larger than outer box */
+float bb_area(const float min[3], const float max[3]);
+float bb_volume(const float min[3], const float max[3]);
+int bb_largest_axis(const float min[3], const float max[3]);
+int bb_fits_inside(const float  outer_min[3], const float  outer_max[3],
+                   const float  inner_min[3], const float  inner_max[3]);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif
+#endif  /* __RAYOBJECT_RTBUILD_H__ */
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 85c9d0d..d03bdb7 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -112,7 +112,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
 						   
 		//Finds the optimal packing of this tree using a given cost model
 		//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
-		OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);			
+		OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);
 		VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
 		obj->root = Reorganize_VBVH<OVBVHNode>(arena1).transform(root);
 		
@@ -125,7 +125,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
 	obj->builder = NULL;
 
 	obj->node_arena = arena1;
-	obj->cost = 1.0;	
+	obj->cost = 1.0;
 }
 
 template<int StackSize>
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index a9ed71a..9d9711e 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -75,7 +75,7 @@ void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float, Nod
 			float pcost = bb_area(parent->bb, parent->bb + 3);
 			cost = std::min(cost, std::make_pair(pcost, parent) );
 			for (Node *child = parent->child; child; child = child->sibling)
-				q.push(child);			
+				q.push(child);
 		}
 	}
 }
@@ -140,7 +140,7 @@ void remove_useless(Node *node, Node **new_node)
 				(*prev)->sibling = next;
 				prev = &((*prev)->sibling);
 			}
-		}			
+		}
 	}
 	if (node->child) {
 		if (RE_rayobject_isAligned(node->child) && node->child->sibling == 0)
@@ -181,7 +181,7 @@ void pushup(Node *parent)
 			*prev = child;
 			prev = &(*prev)->sibling;
 			child = *prev;
-		}		
+		}
 	}
 	
 	for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
@@ -205,13 +205,13 @@ void pushup_simd(Node *parent)
 			n += (cn - 1);
 			append_sibling(child, child->child);
 			child = child->sibling;
-			*prev = child;	
+			*prev = child;
 		}
 		else {
 			*prev = child;
 			prev = &(*prev)->sibling;
 			child = *prev;
-		}		
+		}
 	}
 		
 	for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
@@ -320,7 +320,7 @@ struct OVBVHNode {
 	
 	/*
 	 * Reorganize the node based on calculated cut costs
-	 */	 
+	 */
 	int best_cutsize;
 	void set_cut(int cutsize, OVBVHNode ***cut)
 	{
@@ -357,7 +357,7 @@ struct OVBVHNode {
 			//Optimize new childs
 			for (OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
 				child->optimize();
-		}		
+		}
 	}
 };
 
@@ -431,7 +431,7 @@ struct VBVH_optimalPackSIMD {
 						current_size -= bt[j][current_size];
 					}
 				}
-			}			
+			}
 		}
 	};
 	
@@ -493,6 +493,6 @@ struct VBVH_optimalPackSIMD {
 			if ((G.debug & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize);
 			node->optimize();
 		}
-		return node;		
-	}	
+		return node;
+	}
 };
diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h
index 2f4a337..6ec75eb 100644
--- a/source/blender/render/intern/raytrace/svbvh.h
+++ b/source/blender/render/intern/raytrace/svbvh.h
@@ -93,10 +93,10 @@ static int svbvh_bb_intersect_test(const Isect *isec, const float *_bb)
 	RE_RC_COUNT(isec->raycounter->bb.test);
 
 	if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
-	if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
+	if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0;
 	if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
 
-	RE_RC_COUNT(isec->raycounter->bb.hit);	
+	RE_RC_COUNT(isec->raycounter->bb.hit);
 
 	return 1;
 }
@@ -165,16 +165,16 @@ inline void bvh_node_merge_bb<SVBVHNode>(SVBVHNode *node, float min[3], float ma
 		for (i = 0; i + 4 <= node->nchilds; i += 4) {
 			float *res = node->child_bb + 6 * i;
 			for (int j = 0; j < 3; j++) {
-				min[j] = minf(res[4 * j + 0],
-				         minf(res[4 * j + 1],
-				         minf(res[4 * j + 2],
-				         minf(res[4 * j + 3], min[j]))));
+				min[j] = min_ff(res[4 * j + 0],
+				         min_ff(res[4 * j + 1],
+				         min_ff(res[4 * j + 2],
+				         min_ff(res[4 * j + 3], min[j]))));
 			}
 			for (int j = 0; j < 3; j++) {
-				max[j] = maxf(res[4 * (j + 3) + 0],
-				         maxf(res[4 * (j + 3) + 1],
-				         maxf(res[4 * (j + 3) + 2],
-				         maxf(res[4 * (j + 3) + 3], max[j]))));
+				max[j] = max_ff(res[4 * (j + 3) + 0],
+				         max_ff(res[4 * (j + 3) + 1],
+				         max_ff(res[4 * (j + 3) + 2],
+				         max_ff(res[4 * (j + 3) + 3], max[j]))));
 			}
 		}
 
@@ -230,7 +230,7 @@ struct Reorganize_SVBVH {
 		return node;
 	}
 	
-	void copy_bb(float *bb, const float *old_bb)
+	void copy_bb(float bb[6], const float old_bb[6])
 	{
 		std::copy(old_bb, old_bb + 6, bb);
 	}
@@ -281,7 +281,7 @@ struct Reorganize_SVBVH {
 		
 		useless_bb += alloc_childs - nchilds;
 		while (alloc_childs > nchilds) {
-			const static float def_bb[6] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN, FLT_MIN };
+			const static float def_bb[6] = {FLT_MAX,  FLT_MAX,  FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX};
 			alloc_childs--;
 			node->child[alloc_childs] = NULL;
 			copy_bb(node->child_bb + alloc_childs * 6, def_bb);
@@ -307,7 +307,7 @@ struct Reorganize_SVBVH {
 		prepare_for_simd(node);
 		
 		return node;
-	}	
+	}
 };
 
 #endif  /* __SSE__ */
diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h
index ec671f9..9755bf8 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -233,6 +233,6 @@ struct Reorganize_VBVH {
 		*child_ptr = 0;
 		
 		return node;
-	}	
+	}
 };
 #endif
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 46ab3ae..3860863 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -124,6 +124,11 @@
 /* or for checking vertex normal flips */
 #define FLT_EPSILON10 1.19209290e-06F
 
+/* could enable at some point but for now there are far too many conversions */
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
+
 /* ------------------------------------------------------------------------- */
 
 /* Stuff for stars. This sits here because it uses gl-things. Part of
@@ -156,7 +161,7 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float h
  */
 
 void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
-				   void (*vertexfunc)(float*),  void (*termfunc)(void))
+                   void (*vertexfunc)(float*),  void (*termfunc)(void))
 {
 	extern unsigned char hash[512];
 	ObjectRen *obr= NULL;
@@ -227,7 +232,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 	hlfrand = 2.0 * dblrand;
 	
 	if (initfunc) {
-		initfunc();	
+		initfunc();
 	}
 
 	if (re) /* add render object for stars */
@@ -364,7 +369,7 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startv
 
 			if (v==0) {
 				vlr->v1 = RE_vertren_copy(obr, vlr->v1);
-			} 
+			}
 		}
 	}
 }
@@ -446,7 +451,7 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
 }
 
 /* gets tangent from tface or orco */
-static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemArena *arena, VlakRen *vlr, int do_nmap_tangent, int do_tangent)
+static void calc_tangent_vector(ObjectRen *obr, VlakRen *vlr, int do_tangent)
 {
 	MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
 	VertRen *v1=vlr->v1, *v2=vlr->v2, *v3=vlr->v3, *v4=vlr->v4;
@@ -481,12 +486,6 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 		add_v3_v3(tav, tang);
 	}
 	
-	if (do_nmap_tangent) {
-		sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
-		sum_or_add_vertex_tangent(arena, &vtangents[v2->index], tang, uv2);
-		sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
-	}
-
 	if (v4) {
 		tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, vlr->n, tang);
 		
@@ -498,12 +497,6 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 			tav= RE_vertren_get_tangent(obr, v4, 1);
 			add_v3_v3(tav, tang);
 		}
-
-		if (do_nmap_tangent) {
-			sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
-			sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
-			sum_or_add_vertex_tangent(arena, &vtangents[v4->index], tang, uv4);
-		}
 	}
 }
 
@@ -568,8 +561,14 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
 	//assert(vert_index>=0 && vert_index<4);
 	SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
 	VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num);
-	const float *n= (&vlr->v1)[vert_index]->n;
-	copy_v3_v3(fNorm, n);
+
+	if (vlr->flag & ME_SMOOTH) {
+		const float *n = (&vlr->v1)[vert_index]->n;
+		copy_v3_v3(fNorm, n);
+	}
+	else {
+		negate_v3_v3(fNorm, vlr->n);
+	}
 }
 static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
 {
@@ -585,17 +584,8 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent
 
 static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangent, int do_nmap_tangent)
 {
-	MemArena *arena= NULL;
-	VertexTangent **vtangents= NULL;
 	int a;
 
-	if (do_nmap_tangent) {
-		arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
-		BLI_memarena_use_calloc(arena);
-
-		vtangents= MEM_callocN(sizeof(VertexTangent*)*obr->totvert, "VertexTangent");
-	}
-
 		/* clear all vertex normals */
 	for (a=0; a<obr->totvert; a++) {
 		VertRen *ver= RE_findOrAddVert(obr, a);
@@ -613,10 +603,10 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 			accumulate_vertex_normals(vlr->v1->n, vlr->v2->n, vlr->v3->n, n4,
 				vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co, c4);
 		}
-		if (do_nmap_tangent || do_tangent) {
+		if (do_tangent) {
 			/* tangents still need to be calculated for flat faces too */
 			/* weighting removed, they are not vertexnormals */
-			calc_tangent_vector(obr, vtangents, arena, vlr, do_nmap_tangent, do_tangent);
+			calc_tangent_vector(obr, vlr, do_tangent);
 		}
 	}
 
@@ -630,32 +620,6 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 			if (is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n);
 			if (vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n);
 		}
-
-		if (do_nmap_tangent) {
-			VertRen *v1=vlr->v1, *v2=vlr->v2, *v3=vlr->v3, *v4=vlr->v4;
-			MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
-
-			if (tface) {
-				int k=0;
-				float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1);
-
-				vtang= find_vertex_tangent(vtangents[v1->index], tface->uv[0]);
-				copy_v3_v3(ftang, vtang);
-				normalize_v3(ftang);
-				vtang= find_vertex_tangent(vtangents[v2->index], tface->uv[1]);
-				copy_v3_v3(ftang+4, vtang);
-				normalize_v3(ftang+4);
-				vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]);
-				copy_v3_v3(ftang+8, vtang);
-				normalize_v3(ftang+8);
-				if (v4) {
-					vtang= find_vertex_tangent(vtangents[v4->index], tface->uv[3]);
-					copy_v3_v3(ftang+12, vtang);
-					normalize_v3(ftang+12);
-				}
-				for (k=0; k<4; k++) ftang[4*k+3]=1;
-			}
-		}
 	}
 	
 	/* normalize vertex normals */
@@ -675,6 +639,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 		}
 	}
 
+	/* normal mapping tangent with mikktspace */
 	if (do_nmap_tangent != FALSE) {
 		SRenderMeshToTangent mesh2tangent;
 		SMikkTSpaceContext sContext;
@@ -696,11 +661,6 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 
 		genTangSpaceDefault(&sContext);
 	}
-
-	if (arena)
-		BLI_memarena_free(arena);
-	if (vtangents)
-		MEM_freeN(vtangents);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -882,7 +842,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
 			else 
 				normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 		}
-	}		
+	}
 }
 
 /* ------------------------------------------------------------------------- */
@@ -1570,9 +1530,12 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	int i, a, k, max_k=0, totpart, do_simplify = FALSE, do_surfacecache = FALSE, use_duplimat = FALSE;
 	int totchild=0;
 	int seed, path_nbr=0, orco1=0, num;
-	int totface, *origindex = 0;
+	int totface;
 	char **uv_name=0;
 
+	const int *index_mf_to_mpoly = NULL;
+	const int *index_mp_to_orig = NULL;
+
 /* 1. check that everything is ok & updated */
 	if (psys==NULL)
 		return 0;
@@ -1613,7 +1576,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 
 	psys->flag |= PSYS_DRAWING;
 
-	rng= rng_new(psys->seed);
+	rng= BLI_rng_new(psys->seed);
 
 	totpart=psys->totpart;
 
@@ -1742,9 +1705,13 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 					do_surfacecache = TRUE;
 
 			totface= psmd->dm->getNumTessFaces(psmd->dm);
-			origindex= psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
+			index_mf_to_mpoly = psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
+			index_mp_to_orig = psmd->dm->getPolyDataArray(psmd->dm, CD_ORIGINDEX);
+			if (index_mf_to_mpoly == NULL) {
+				index_mp_to_orig = NULL;
+			}
 			for (a=0; a<totface; a++)
-				strandbuf->totbound= MAX2(strandbuf->totbound, (origindex)? origindex[a]: a);
+				strandbuf->totbound = max_ii(strandbuf->totbound, (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a): a);
 
 			strandbuf->totbound++;
 			strandbuf->bound= MEM_callocN(sizeof(StrandBound)*strandbuf->totbound, "StrandBound");
@@ -1763,7 +1730,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 
 /* 3. start creating renderable things */
 	for (a=0, pa=pars; a<totpart+totchild; a++, pa++, seed++) {
-		random = rng_getFloat(rng);
+		random = BLI_rng_get_float(rng);
 		/* setup per particle individual stuff */
 		if (a<totpart) {
 			if (pa->flag & PARS_UNEXIST) continue;
@@ -1855,7 +1822,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			do_simplify = psys_render_simplify_params(psys, cpa, simplify);
 
 			if (strandbuf) {
-				int orignum= (origindex)? origindex[cpa->num]: cpa->num;
+				int orignum = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, cpa->num) : cpa->num;
 
 				if (orignum > sbound - strandbuf->bound) {
 					sbound= strandbuf->bound + orignum;
@@ -1939,7 +1906,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 					copy_v3_v3(state.vel, (cache+k)->vel);
 				}
 				else
-					continue;	
+					continue;
 
 				if (k > 0)
 					curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
@@ -2099,7 +2066,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	if (states)
 		MEM_freeN(states);
 	
-	rng_free(rng);
+	BLI_rng_free(rng);
 
 	psys->flag &= ~PSYS_DRAWING;
 
@@ -2367,7 +2334,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
 	/* Recalculate the face normal  - if flipped before, flip now */
 	if (vlr->v4) {
 		normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
-	}	
+	}
 	else {
 		normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 	}
@@ -2536,7 +2503,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 		copy_v3_v3(v1->co, data); data += 3;
 		if (orco) {
 			v1->orco= orco; orco+= 3; orcoret++;
-		}	
+		}
 		mul_m4_v3(mat, v1->co);
 		
 		for (v = 1; v < sizev; v++) {
@@ -2544,7 +2511,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 			copy_v3_v3(ver->co, data); data += 3;
 			if (orco) {
 				ver->orco= orco; orco+= 3; orcoret++;
-			}	
+			}
 			mul_m4_v3(mat, ver->co);
 		}
 		/* if V-cyclic, add extra vertices at end of the row */
@@ -2554,8 +2521,8 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 			if (orco) {
 				ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0);
 			}
-		}	
-	}	
+		}
+	}
 	
 	/* Done before next loop to get corner vert */
 	if (dl->flag & DL_CYCL_U) nsizev++;
@@ -2608,7 +2575,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 			
 			p1++; p2++; p3++; p4++;
 		}
-	}	
+	}
 	/* fix normals for U resp. V cyclic faces */
 	sizeu--; sizev--;  /* dec size for face array */
 	if (dl->flag & DL_CYCL_V) {
@@ -2929,8 +2896,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 						vlr->v2= RE_findOrAddVert(obr, startvert+index[1]);
 						vlr->v3= RE_findOrAddVert(obr, startvert+index[2]);
 						vlr->v4= NULL;
-
-						if (area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON) {
+						if (area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON10) {
 							normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 							add_v3_v3(n, tmp);
 						}
@@ -3274,11 +3240,11 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 			/* normalmaps, test if tangents needed, separated from shading */
 			if (ma->mode_l & MA_TANGENT_V) {
 				need_tangent= 1;
-				if (me->mtface==NULL)
+				if (me->mtpoly==NULL)
 					need_orco= 1;
 			}
 			if (ma->mode_l & MA_NORMAP_TANG) {
-				if (me->mtface==NULL) {
+				if (me->mtpoly==NULL) {
 					need_orco= 1;
 					need_tangent= 1;
 				}
@@ -3289,7 +3255,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 
 	if (re->flag & R_NEED_TANGENT) {
 		/* exception for tangent space baking */
-		if (me->mtface==NULL) {
+		if (me->mtpoly==NULL) {
 			need_orco= 1;
 			need_tangent= 1;
 		}
@@ -3616,22 +3582,22 @@ static void area_lamp_vectors(LampRen *lar)
 	/* corner vectors */
 	lar->area[0][0]= lar->co[0] - xsize*lar->mat[0][0] - ysize*lar->mat[1][0];
 	lar->area[0][1]= lar->co[1] - xsize*lar->mat[0][1] - ysize*lar->mat[1][1];
-	lar->area[0][2]= lar->co[2] - xsize*lar->mat[0][2] - ysize*lar->mat[1][2];	
+	lar->area[0][2]= lar->co[2] - xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
 
 	/* corner vectors */
 	lar->area[1][0]= lar->co[0] - xsize*lar->mat[0][0] + ysize*lar->mat[1][0];
 	lar->area[1][1]= lar->co[1] - xsize*lar->mat[0][1] + ysize*lar->mat[1][1];
-	lar->area[1][2]= lar->co[2] - xsize*lar->mat[0][2] + ysize*lar->mat[1][2];	
+	lar->area[1][2]= lar->co[2] - xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
 
 	/* corner vectors */
 	lar->area[2][0]= lar->co[0] + xsize*lar->mat[0][0] + ysize*lar->mat[1][0];
 	lar->area[2][1]= lar->co[1] + xsize*lar->mat[0][1] + ysize*lar->mat[1][1];
-	lar->area[2][2]= lar->co[2] + xsize*lar->mat[0][2] + ysize*lar->mat[1][2];	
+	lar->area[2][2]= lar->co[2] + xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
 
 	/* corner vectors */
 	lar->area[3][0]= lar->co[0] + xsize*lar->mat[0][0] - ysize*lar->mat[1][0];
 	lar->area[3][1]= lar->co[1] + xsize*lar->mat[0][1] - ysize*lar->mat[1][1];
-	lar->area[3][2]= lar->co[2] + xsize*lar->mat[0][2] - ysize*lar->mat[1][2];	
+	lar->area[3][2]= lar->co[2] + xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
 	/* only for correction button size, matrix size works on energy */
 	lar->areasize= lar->dist*lar->dist/(4.0f*xsize*ysize);
 }
@@ -4332,7 +4298,7 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
 				
 				/* compute average bounding box of strandpoint itself (width) */
 				if (obr->strandbuf->flag & R_STRAND_B_UNITS)
-					obr->strandbuf->maxwidth= MAX2(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
+					obr->strandbuf->maxwidth = max_ff(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
 				else
 					obr->strandbuf->maxwidth= 0.0f;
 				
@@ -4537,7 +4503,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 	ParticleSystem *psys;
 	int show_emitter, allow_render= 1, index, psysindex, i;
 
-	index= (dob)? dob->index: 0;
+	index= (dob)? dob->persistent_id[0]: 0;
 
 	/* the emitter has to be processed first (render levels of modifiers) */
 	/* so here we only check if the emitter should be rendered */
@@ -4712,10 +4678,12 @@ void RE_Database_Free(Render *re)
 static int allow_render_object(Render *re, Object *ob, int nolamps, int onlyselected, Object *actob)
 {
 	/* override not showing object when duplis are used with particles */
-	if (ob->transflag & OB_DUPLIPARTS)
-		; /* let particle system(s) handle showing vs. not showing */
-	else if ((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES))
+	if (ob->transflag & OB_DUPLIPARTS) {
+		/* pass */  /* let particle system(s) handle showing vs. not showing */
+	}
+	else if ((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES)) {
 		return 0;
+	}
 	
 	/* don't add non-basic meta objects, ends up having renderobjects with no geometry */
 	if (ob->type == OB_MBALL && ob!=BKE_mball_basis_find(re->scene, ob))
@@ -4933,7 +4901,8 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 						 * a dupligroup that has already been created before */
 						if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
 							mult_m4_m4m4(mat, re->viewmat, dob->mat);
-							obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat, obd->lay);
+														/* ob = particle system, use that layer */
+							obi= RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], 0, mat, ob->lay); 
 
 							/* fill in instance variables for texturing */
 							set_dupli_tex_mat(re, obi, dob);
@@ -4960,7 +4929,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 							if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
 								if (obi == NULL)
 									mult_m4_m4m4(mat, re->viewmat, dob->mat);
-								obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat, obd->lay);
+								obi= RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], psysindex++, mat, obd->lay);
 
 								set_dupli_tex_mat(re, obi, dob);
 								if (dob->type != OB_DUPLIGROUP) {
@@ -5334,7 +5303,7 @@ static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen
 			calculate_speedvector(vec, 1, winsq, winroot, mesh->co[a], ho, winspeed[a]);
 		}
 
-		return (float*)winspeed;
+		return (float *)winspeed;
 	}
 
 	return NULL;
@@ -5592,7 +5561,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
 		re->i.infostr= "Calculating next frame vectors";
 		
 		database_fromscene_vectors(re, sce, lay, +1);
-	}	
+	}
 	/* copy away vertex info */
 	copy_dbase_object_vectors(re, &newtable);
 	
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 03eb21d..c3126e5 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -76,7 +76,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 	BLI_lock_thread(LOCK_IMAGE);
 	if (env->cube[1] == NULL) {
 
-		BKE_free_envmapdata(env);	
+		BKE_free_envmapdata(env);
 	
 		dx = ibuf->y;
 		dx /= 2;
@@ -120,7 +120,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 				IMB_float_from_rect(env->cube[1]);
 			}
 		}
-	}	
+	}
 	BLI_unlock_thread(LOCK_IMAGE);
 }
 
@@ -148,12 +148,14 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
 	envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR);
 	envre->r.layers.first = envre->r.layers.last = NULL;
 	envre->r.filtertype = 0;
-	envre->r.xparts = envre->r.yparts = 2;
+	envre->r.tilex = envre->r.xsch / 2;
+	envre->r.tiley = envre->r.ysch / 2;
 	envre->r.size = 100;
 	envre->r.yasp = envre->r.xasp = 1;
 	
 	RE_InitState(envre, NULL, &envre->r, NULL, cuberes, cuberes, NULL);
 	envre->scene = re->scene;    /* unsure about this... */
+	envre->scene_color_manage = re->scene_color_manage;
 	envre->lay = re->lay;
 
 	/* view stuff in env render */
@@ -215,7 +217,7 @@ static void envmap_transmatrix(float mat[][4], int part)
 	eul[0] = eul[1] = eul[2] = 0.0;
 	
 	if (part == 0) {          /* neg z */
-		;
+		/* pass */
 	}
 	else if (part == 1) { /* pos z */
 		eul[0] = M_PI;
@@ -575,7 +577,7 @@ void make_envmaps(Render *re)
 		re->display_init(re->dih, re->result);
 		re->display_clear(re->dch, re->result);
 		// re->flag |= R_REDRAW_PRV;
-	}	
+	}
 	/* restore */
 	re->r.mode |= trace;
 
@@ -642,31 +644,31 @@ static int envcube_isect(EnvMap *env, const float vec[3], float answ[2])
 
 /* ------------------------------------------------------------------------- */
 
-static void set_dxtdyt(float *dxts, float *dyts, float *dxt, float *dyt, int face)
+static void set_dxtdyt(float r_dxt[3], float r_dyt[3], const float dxt[3], const float dyt[3], int face)
 {
 	if (face == 2 || face == 4) {
-		dxts[0] = dxt[0];
-		dyts[0] = dyt[0];
-		dxts[1] = dxt[2];
-		dyts[1] = dyt[2];
+		r_dxt[0] = dxt[0];
+		r_dyt[0] = dyt[0];
+		r_dxt[1] = dxt[2];
+		r_dyt[1] = dyt[2];
 	}
 	else if (face == 3 || face == 5) {
-		dxts[0] = dxt[1];
-		dxts[1] = dxt[2];
-		dyts[0] = dyt[1];
-		dyts[1] = dyt[2];
+		r_dxt[0] = dxt[1];
+		r_dxt[1] = dxt[2];
+		r_dyt[0] = dyt[1];
+		r_dyt[1] = dyt[2];
 	}
 	else {
-		dxts[0] = dxt[0];
-		dyts[0] = dyt[0];
-		dxts[1] = dxt[1];
-		dyts[1] = dyt[1];
+		r_dxt[0] = dxt[0];
+		r_dyt[0] = dyt[0];
+		r_dxt[1] = dxt[1];
+		r_dyt[1] = dyt[1];
 	}
 }
 
 /* ------------------------------------------------------------------------- */
 
-int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
+int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres)
 {
 	extern Render R;                /* only in this call */
 	/* texvec should be the already reflected normal */
@@ -685,11 +687,12 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 		env->ima = tex->ima;
 		if (env->ima && env->ima->ok) {
 			if (env->cube[1] == NULL) {
-				ImBuf *ibuf_ima = BKE_image_get_ibuf(env->ima, NULL);
+				ImBuf *ibuf_ima = BKE_image_acquire_ibuf(env->ima, NULL, NULL);
 				if (ibuf_ima)
 					envmap_split_ima(env, ibuf_ima);
 				else
 					env->ok = 0;
+				BKE_image_release_ibuf(env->ima, ibuf_ima, NULL);
 			}
 		}
 	}
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 636b320..6fdf11b 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -64,7 +64,7 @@
 static RenderEngineType internal_render_type = {
 	NULL, NULL,
 	"BLENDER_RENDER", N_("Blender Render"), RE_INTERNAL,
-	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL,
 	{NULL, NULL, NULL}
 };
 
@@ -73,7 +73,7 @@ static RenderEngineType internal_render_type = {
 static RenderEngineType internal_game_type = {
 	NULL, NULL,
 	"BLENDER_GAME", N_("Blender Game"), RE_INTERNAL | RE_GAME,
-	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL,
 	{NULL, NULL, NULL}
 };
 
@@ -138,7 +138,7 @@ void RE_engine_free(RenderEngine *engine)
 {
 #ifdef WITH_PYTHON
 	if (engine->py_instance) {
-		BPY_DECREF(engine->py_instance);
+		BPY_DECREF_RNA_INVALIDATE(engine->py_instance);
 	}
 #endif
 
@@ -290,9 +290,24 @@ void RE_engine_update_progress(RenderEngine *engine, float progress)
 	}
 }
 
+void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak)
+{
+	Render *re = engine->re;
+
+	if (re) {
+		re->i.mem_used = mem_used;
+		re->i.mem_peak = mem_peak;
+	}
+}
+
 void RE_engine_report(RenderEngine *engine, int type, const char *msg)
 {
-	BKE_report(engine->re->reports, type, msg);
+	Render *re = engine->re;
+
+	if (re)
+		BKE_report(engine->re->reports, type, msg);
+	else if (engine->reports)
+		BKE_report(engine->reports, type, msg);
 }
 
 /* Render */
@@ -301,6 +316,7 @@ int RE_engine_render(Render *re, int do_all)
 {
 	RenderEngineType *type = RE_engines_find(re->r.engine);
 	RenderEngine *engine;
+	int persistent_data = re->r.mode & R_PERSISTENT_DATA;
 
 	/* verify if we can render */
 	if (!type->render)
@@ -334,7 +350,18 @@ int RE_engine_render(Render *re, int do_all)
 	re->i.totface = re->i.totvert = re->i.totstrand = re->i.totlamp = re->i.tothalo = 0;
 
 	/* render */
-	engine = RE_engine_create(type);
+	engine = re->engine;
+
+	if (!engine) {
+		engine = RE_engine_create(type);
+
+		if (persistent_data)
+			re->engine = engine;
+	}
+
+	engine->flag |= RE_ENGINE_RENDERING;
+
+	/* TODO: actually link to a parent which shouldn't happen */
 	engine->re = re;
 
 	if (re->flag & R_ANIMATION)
@@ -349,7 +376,7 @@ int RE_engine_render(Render *re, int do_all)
 	if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_PREVIEWBUTS)) == 0)
 		BKE_scene_update_for_newframe(re->main, re->scene, re->lay);
 
-	initparts(re, FALSE);
+	RE_parts_init(re, FALSE);
 	engine->tile_x = re->partx;
 	engine->tile_y = re->party;
 
@@ -362,19 +389,25 @@ int RE_engine_render(Render *re, int do_all)
 	if (type->render)
 		type->render(engine, re->scene);
 
+	engine->tile_x = 0;
+	engine->tile_y = 0;
+	engine->flag &= ~RE_ENGINE_RENDERING;
+
+	render_result_free_list(&engine->fullresult, engine->fullresult.first);
+
+	/* re->engine becomes zero if user changed active render engine during render */
+	if (!persistent_data || !re->engine) {
+		RE_engine_free(engine);
+		re->engine = NULL;
+	}
+
 	if (re->result->do_exr_tile) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 		render_result_exr_file_end(re);
 		BLI_rw_mutex_unlock(&re->resultmutex);
 	}
 
-	engine->tile_x = 0;
-	engine->tile_y = 0;
-	freeparts(re);
-
-	render_result_free_list(&engine->fullresult, engine->fullresult.first);
-
-	RE_engine_free(engine);
+	RE_parts_free(re);
 
 	if (BKE_reports_contain(re->reports, RPT_ERROR))
 		G.is_break = TRUE;
diff --git a/source/blender/render/intern/source/gammaCorrectionTables.c b/source/blender/render/intern/source/gammaCorrectionTables.c
index 1c2613e..8efdf47 100644
--- a/source/blender/render/intern/source/gammaCorrectionTables.c
+++ b/source/blender/render/intern/source/gammaCorrectionTables.c
@@ -107,13 +107,13 @@ void makeGammaTables(float gamma)
 	color_step        = 1.0 / RE_GAMMA_TABLE_SIZE;
 	inv_color_step    = (float) RE_GAMMA_TABLE_SIZE; 
 
-	/* We could squeeze out the two range tables to gain some memory.        */	
+	/* We could squeeze out the two range tables to gain some memory.        */
 	for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
-		color_domain_table[i]   = i * color_step;
+		color_domain_table[i]    = i * color_step;
 		gamma_range_table[i]     = pow(color_domain_table[i],
-										valid_gamma);
+		                               valid_gamma);
 		inv_gamma_range_table[i] = pow(color_domain_table[i],
-										valid_inv_gamma);
+		                               valid_inv_gamma);
 	}
 
 	/* The end of the table should match 1.0 carefully. In order to avoid    */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 154292a..cd06839 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -102,7 +102,7 @@ static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
 		col[1] = ((float)rect[1])*(1.0f/255.0f);
 		col[2] = ((float)rect[2])*(1.0f/255.0f);
 		col[3] = ((float)rect[3])*(1.0f/255.0f);
-	}	
+	}
 }
 
 int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres)
@@ -124,13 +124,16 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		/* hack for icon render */
 		if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
 			return retval;
-		
-		ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
+
+		ibuf= BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 
 		ima->flag|= IMA_USED_FOR_RENDER;
 	}
-	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
+		if (ima)
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		return retval;
+	}
 	
 	/* setup mapping */
 	if (tex->imaflag & TEX_IMAROT) {
@@ -155,11 +158,17 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 				/* pass */
 			}
 			else {
+				if (ima)
+					BKE_image_release_ibuf(ima, ibuf, NULL);
 				return retval;
 			}
 		}
 		if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
-			if ((xs+ys) & 1) return retval;
+			if ((xs+ys) & 1) {
+				if (ima)
+					BKE_image_release_ibuf(ima, ibuf, NULL);
+				return retval;
+			}
 		}
 		/* scale around center, (0.5, 0.5) */
 		if (tex->checkerdist<1.0f) {
@@ -173,11 +182,15 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 
 	if (tex->extend == TEX_CLIPCUBE) {
 		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
 			return retval;
 		}
 	}
 	else if ( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
 		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
 			return retval;
 		}
 	}
@@ -209,7 +222,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 	if (tex->imaflag & TEX_USEALPHA) {
 		if ((tex->imaflag & TEX_CALCALPHA) == 0) {
 			texres->talpha = TRUE;
-		} 
+		}
 	}
 
 	/* interpolate */
@@ -287,6 +300,9 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		texres->tb*= fx;
 	}
 	
+	if (ima)
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+	
 	BRICONTRGB;
 	
 	return retval;
@@ -693,7 +709,7 @@ static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extf
 		}
 	}
 	else {
-		char* rect = (char*)(ibuf->rect + x + y*ibuf->x);
+		char *rect = (char *)(ibuf->rect + x + y*ibuf->x);
 		col[0] = rect[0]*(1.f/255.f);
 		col[1] = rect[1]*(1.f/255.f);
 		col[2] = rect[2]*(1.f/255.f);
@@ -764,39 +780,39 @@ static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata
 /* table of (exp(ar) - exp(a)) / (1 - exp(a)) for r in range [0, 1] and a = -2
  * used instead of actual gaussian, otherwise at high texture magnifications circular artifacts are visible */
 #define EWA_MAXIDX 255
-static float EWA_WTS[EWA_MAXIDX + 1] =
-{ 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
- 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
- 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
- 0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
- 0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
- 0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
- 0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
- 0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
- 0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
- 0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
- 0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
- 0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
- 0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
- 0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
- 0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
- 0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
- 0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
- 0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
- 0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
- 0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
- 0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
- 0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
- 0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
- 0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
- 0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
- 0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
- 0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
- 0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
- 0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
- 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
- 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
- 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
+static float EWA_WTS[EWA_MAXIDX + 1] = {
+	1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
+	0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
+	0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
+	0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
+	0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
+	0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
+	0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
+	0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
+	0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
+	0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
+	0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
+	0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
+	0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
+	0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
+	0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
+	0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
+	0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
+	0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
+	0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
+	0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
+	0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
+	0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
+	0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
+	0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
+	0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
+	0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
+	0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
+	0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
+	0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
+	0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
+	0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
+	0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
 };
 
 /* test if a float value is 'nan'
@@ -989,7 +1005,7 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
 
 		alphaclip  = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
 		alphaclip *= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
-		alphaclip  = maxf(alphaclip, 0.0f);
+		alphaclip  = max_ff(alphaclip, 0.0f);
 
 		if (alphaclip!=1.0f) {
 			/* premul it all */
@@ -1011,7 +1027,7 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
 				if (ibuf->userflags & IB_MIPMAP_INVALID) {
 					IMB_remakemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
 					ibuf->userflags &= ~IB_MIPMAP_INVALID;
-				}				
+				}
 				BLI_unlock_thread(LOCK_IMAGE);
 			}
 			if (ibuf->mipmap[0] == NULL) {
@@ -1056,10 +1072,14 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 
 	if (ima) {	/* hack for icon render */
 		if ((ima->ibufs.first == NULL) && (R.r.scemode & R_NO_IMAGE_LOAD)) return retval;
-		ibuf = BKE_image_get_ibuf(ima, &tex->iuser); 
+		ibuf = BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 	}
 
-	if ((ibuf == NULL) || ((ibuf->rect == NULL) && (ibuf->rect_float == NULL))) return retval;
+	if ((ibuf == NULL) || ((ibuf->rect == NULL) && (ibuf->rect_float == NULL))) {
+		if (ima)
+			BKE_image_release_ibuf(ima, ibuf, NULL);
+		return retval;
+	}
 
 	if (ima) {
 		ima->flag |= IMA_USED_FOR_RENDER;
@@ -1172,8 +1192,16 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 				}
 			}
 			else {
-				if ((tex->flag & TEX_CHECKER_ODD) == 0 && ((xs + ys) & 1) == 0) return retval;
-				if ((tex->flag & TEX_CHECKER_EVEN) == 0 && (xs + ys) & 1) return retval;
+				if ((tex->flag & TEX_CHECKER_ODD) == 0 && ((xs + ys) & 1) == 0) {
+					if (ima)
+						BKE_image_release_ibuf(ima, ibuf, NULL);
+					return retval;
+				}
+				if ((tex->flag & TEX_CHECKER_EVEN) == 0 && (xs + ys) & 1) {
+					if (ima)
+						BKE_image_release_ibuf(ima, ibuf, NULL);
+					return retval;
+				}
 				fx -= xs;
 				fy -= ys;
 			}
@@ -1189,10 +1217,18 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 	}
 
 	if (tex->extend == TEX_CLIPCUBE) {
-		if ((fx + minx) < 0.f || (fy + miny) < 0.f || (fx - minx) > 1.f || (fy - miny) > 1.f || texvec[2] < -1.f || texvec[2] > 1.f) return retval;
+		if ((fx + minx) < 0.f || (fy + miny) < 0.f || (fx - minx) > 1.f || (fy - miny) > 1.f || texvec[2] < -1.f || texvec[2] > 1.f) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
+			return retval;
+		}
 	}
 	else if (tex->extend == TEX_CLIP || tex->extend == TEX_CHECKER) {
-		if ((fx + minx) < 0.f || (fy + miny) < 0.f || (fx - minx) > 1.f || (fy - miny) > 1.f) return retval;
+		if ((fx + minx) < 0.f || (fy + miny) < 0.f || (fx - minx) > 1.f || (fy - miny) > 1.f) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
+			return retval;
+		}
 	}
 	else {
 		if (tex->extend == TEX_EXTEND) {
@@ -1247,8 +1283,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 			float fProbes;
 			a *= ff;
 			b *= ff;
-			a = maxf(a, 1.0f);
-			b = maxf(b, 1.0f);
+			a = max_ff(a, 1.0f);
+			b = max_ff(b, 1.0f);
 			fProbes = 2.f*(a / b) - 1.f;
 			AFD.iProbes = (int)floorf(fProbes + 0.5f);
 			AFD.iProbes = MIN2(AFD.iProbes, tex->afmax);
@@ -1264,7 +1300,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 			if (ecc > (float)tex->afmax) b = a / (float)tex->afmax;
 			b *= ff;
 		}
-		maxd = maxf(b, 1e-8f);
+		maxd = max_ff(b, 1e-8f);
 		levf = ((float)M_LOG2E) * logf(maxd);
 
 		curmap = 0;
@@ -1349,8 +1385,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 			imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
 			a *= ff;
 			b *= ff;
-			a = maxf(a, 1.0f);
-			b = maxf(b, 1.0f);
+			a = max_ff(a, 1.0f);
+			b = max_ff(b, 1.0f);
 			fProbes = 2.f*(a / b) - 1.f;
 			/* no limit to number of Probes here */
 			AFD.iProbes = (int)floorf(fProbes + 0.5f);
@@ -1413,6 +1449,9 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 		texres->tb *= fx;
 	}
 
+	if (ima)
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	BRICONTRGB;
 	
 	return retval;
@@ -1449,12 +1488,15 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 		if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
 			return retval;
 		
-		ibuf= BKE_image_get_ibuf(ima, &tex->iuser); 
+		ibuf= BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 
 		ima->flag|= IMA_USED_FOR_RENDER;
 	}
-	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
+		if (ima)
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		return retval;
+	}
 	
 	/* mipmap test */
 	image_mipmap_test(tex, ibuf);
@@ -1565,11 +1607,15 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 						/* pass */
 					}
 					else {
+						if (ima)
+							BKE_image_release_ibuf(ima, ibuf, NULL);
 						return retval;
 					}
 				}
 				if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
 					if ((xs + ys) & 1) {
+						if (ima)
+							BKE_image_release_ibuf(ima, ibuf, NULL);
 						return retval;
 					}
 				}
@@ -1605,11 +1651,15 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 
 	if (tex->extend == TEX_CLIPCUBE) {
 		if (fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f || texvec[2]<-1.0f || texvec[2]>1.0f) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
 			return retval;
 		}
 	}
 	else if (tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
 		if (fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f) {
+			if (ima)
+				BKE_image_release_ibuf(ima, ibuf, NULL);
 			return retval;
 		}
 	}
@@ -1645,7 +1695,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 		
 		dx = minx;
 		dy = miny;
-		maxd = maxf(dx, dy);
+		maxd = max_ff(dx, dy);
 		if (maxd > 0.5f) maxd = 0.5f;
 
 		pixsize = 1.0f / (float) MIN2(ibuf->x, ibuf->y);
@@ -1804,6 +1854,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 		mul_v3_fl(&texres->tr, 1.0f / texres->ta);
 	}
 
+	if (ima)
+		BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	BRICONTRGB;
 	
 	return retval;
@@ -1812,7 +1865,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 void image_sample(Image *ima, float fx, float fy, float dx, float dy, float result[4])
 {
 	TexResult texres;
-	ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+	ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, NULL);
 	
 	if (UNLIKELY(ibuf == NULL)) {
 		zero_v4(result);
@@ -1830,6 +1883,8 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float resu
 		ibuf->rect-= (ibuf->x*ibuf->y);
 
 	ima->flag|= IMA_USED_FOR_RENDER;
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
 void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float result[4])
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 88c64b4..3ea74ab 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -525,7 +525,7 @@ void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, flo
 /* ~~~~~~~~~~~~~~~~ part (tile) calculus ~~~~~~~~~~~~~~~~~~~~~~ */
 
 
-void freeparts(Render *re)
+void RE_parts_free(Render *re)
 {
 	RenderPart *part = re->parts.first;
 	
@@ -537,12 +537,19 @@ void freeparts(Render *re)
 	BLI_freelistN(&re->parts);
 }
 
-void initparts(Render *re, int do_crop)
+void RE_parts_clamp(Render *re)
+{
+	/* part size */
+	re->partx = min_ii(re->r.tilex, re->rectx);
+	re->party = min_ii(re->r.tiley, re->recty);
+}
+
+void RE_parts_init(Render *re, int do_crop)
 {
 	int nr, xd, yd, partx, party, xparts, yparts;
 	int xminb, xmaxb, yminb, ymaxb;
 	
-	freeparts(re);
+	RE_parts_free(re);
 	
 	/* this is render info for caller, is not reset when parts are freed! */
 	re->i.totpart = 0;
@@ -555,31 +562,13 @@ void initparts(Render *re, int do_crop)
 	xmaxb = re->disprect.xmax;
 	ymaxb = re->disprect.ymax;
 	
-	xparts = re->r.xparts;
-	yparts = re->r.yparts;
-	
-	/* mininum part size, but for exr tile saving it was checked already */
-	if (!(re->r.scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE))) {
-		if (re->r.mode & R_PANORAMA) {
-			if (ceil(re->rectx / (float)xparts) < 8)
-				xparts = 1 + re->rectx / 8;
-		}
-		else
-		if (ceil(re->rectx / (float)xparts) < 64)
-			xparts = 1 + re->rectx / 64;
-		
-		if (ceil(re->recty / (float)yparts) < 64)
-			yparts = 1 + re->recty / 64;
-	}
-	
-	/* part size */
-	partx = ceil(re->rectx / (float)xparts);
-	party = ceil(re->recty / (float)yparts);
-	
-	re->xparts = xparts;
-	re->yparts = yparts;
-	re->partx = partx;
-	re->party = party;
+	RE_parts_clamp(re);
+
+	partx = re->partx;
+	party = re->party;
+	/* part count */
+	xparts = (re->rectx + partx - 1) / partx;
+	yparts = (re->recty + party - 1) / party;
 	
 	/* calculate rotation factor of 1 pixel */
 	if (re->r.mode & R_PANORAMA)
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 895c5d6..a730882 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -184,7 +184,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
 	if (shi->flippednor)
 		shade_input_flip_normals(shi);
 
-	madd_v3_v3fl(shi->co, shi->vn, 0.0001f); /* ugly.. */
+	madd_v3_v3fl(shi->co, shi->facenor, -0.0001f); /* ugly.. */
 
 	/* not a pretty solution, but fixes common cases */
 	if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
@@ -1130,7 +1130,7 @@ static void normalizef(float *n)
 		n[0] *= d; 
 		n[1] *= d; 
 		n[2] *= d;
-	} 
+	}
 }
 
 /* TODO: exact duplicate of ff_quad_form_factor() in math_geom.c
@@ -1547,7 +1547,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
 
 	for (i = 0; i < 4; i++) {
 		sub_v3_v3v3(d, samples[i]->co, co);
-		//dist2= dot_v3v3(d, d);
+		//dist2 = dot_v3v3(d, d);
 
 		wz[i] = 1.0f; //(samples[i]->dist2/(1e-4f + dist2));
 		wn[i] = pow(dot_v3v3(samples[i]->n, n), 32.0f);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 1859de0..6b5b971 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -63,6 +63,7 @@
 #include "BLI_string.h"
 #include "BLI_path_util.h"
 #include "BLI_fileops.h"
+#include "BLI_threads.h"
 #include "BLI_rand.h"
 #include "BLI_callbacks.h"
 
@@ -244,6 +245,7 @@ Render *RE_GetRender(const char *name)
 	return re;
 }
 
+
 /* if you want to know exactly what has been done */
 RenderResult *RE_AcquireResultRead(Render *re)
 {
@@ -387,6 +389,9 @@ void RE_InitRenderCB(Render *re)
 /* only call this while you know it will remove the link too */
 void RE_FreeRender(Render *re)
 {
+	if (re->engine)
+		RE_engine_free(re->engine);
+
 	BLI_rw_mutex_end(&re->resultmutex);
 	
 	free_renderdata_tables(re);
@@ -421,6 +426,22 @@ void RE_FreeAllRenderResults(void)
 	}
 }
 
+void RE_FreePersistentData(void)
+{
+	Render *re;
+
+	/* render engines can be kept around for quick re-render, this clears all */
+	for (re = RenderGlobal.renderlist.first; re; re = re->next) {
+		if (re->engine) {
+			/* if engine is currently rendering, just tag it to be freed when render is finished */
+			if (!(re->engine->flag & RE_ENGINE_RENDERING))
+				RE_engine_free(re->engine);
+
+			re->engine = NULL;
+		}
+	}
+}
+
 /* ********* initialize state ******** */
 
 
@@ -499,7 +520,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
 	}
 		
 	/* always call, checks for gamma, gamma tables and jitter too */
-	make_sample_tables(re);	
+	make_sample_tables(re);
 	
 	/* if preview render, we try to keep old result */
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -672,11 +693,12 @@ static void *do_part_thread(void *pa_v)
 
 /* calculus for how much 1 pixel rendered should rotate the 3d geometry */
 /* is not that simple, needs to be corrected for errors of larger viewplane sizes */
-/* called in initrender.c, initparts() and convertblender.c, for speedvectors */
+/* called in initrender.c, RE_parts_init() and convertblender.c, for speedvectors */
 float panorama_pixel_rot(Render *re)
 {
 	float psize, phi, xfac;
 	float borderfac = (float)BLI_rcti_size_x(&re->disprect) / (float)re->winx;
+	int xparts = (re->rectx + re->partx - 1) / re->partx;
 	
 	/* size of 1 pixel mapped to viewplane coords */
 	psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
@@ -684,7 +706,7 @@ float panorama_pixel_rot(Render *re)
 	phi = atan(psize / re->clipsta);
 	
 	/* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
-	xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)re->xparts;
+	xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)xparts;
 	xfac = atan(0.5f * xfac / re->clipsta);
 	/* and how much the same viewplane angle is wrapped */
 	psize = 0.5f * phi * ((float)re->partx);
@@ -814,7 +836,7 @@ static void threaded_tile_processor(Render *re)
 	
 	/* warning; no return here without closing exr file */
 	
-	initparts(re, TRUE);
+	RE_parts_init(re, TRUE);
 
 	if (re->result->do_exr_tile)
 		render_result_exr_file_begin(re);
@@ -906,7 +928,7 @@ static void threaded_tile_processor(Render *re)
 	g_break = 0;
 	
 	BLI_end_threads(&threads);
-	freeparts(re);
+	RE_parts_free(re);
 	re->viewplane = viewplane; /* restore viewplane, modified by pano render */
 }
 
@@ -925,6 +947,7 @@ static void do_render_3d(Render *re)
 		return;
 
 	/* internal */
+	RE_parts_clamp(re);
 	
 //	re->cfra= cfra;	/* <- unused! */
 	re->scene->r.subframe = re->mblur_offs + re->field_offs;
@@ -984,7 +1007,7 @@ static void addblur_rect_key(RenderResult *rr, float *rectf, float *rectf1, floa
 					rf[1] = mfac * rf[1] + blurfac * rf1[1];
 					rf[2] = mfac * rf[2] + blurfac * rf1[2];
 					rf[3] = mfac * rf[3] + blurfac * rf1[3];
-				}				
+				}
 			}
 		}
 		rectf += stride;
@@ -1076,7 +1099,7 @@ static void do_render_blur_3d(Render *re)
 	
 	/* weak... the display callback wants an active renderlayer pointer... */
 	re->result->renlay = render_get_active_layer(re, re->result);
-	re->display_draw(re->ddh, re->result, NULL);	
+	re->display_draw(re->ddh, re->result, NULL);
 }
 
 
@@ -1519,6 +1542,7 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
 	
 	re->main = bmain;
 	re->scene = sce;
+	re->scene_color_manage = BKE_scene_check_color_management_enabled(sce);
 	
 	/* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */
 	
@@ -1566,7 +1590,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
 		ntreeFreeCache(ntree);
 		
 		do_render_fields_blur_3d(re);
-	} 
+	}
 	else {
 		/* ensure new result gets added, like for regular renders */
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -1871,7 +1895,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 		if (scene->r.border.xmax <= scene->r.border.xmin ||
 		    scene->r.border.ymax <= scene->r.border.ymin)
 		{
-			BKE_report(reports, RPT_ERROR, "No border area selected.");
+			BKE_report(reports, RPT_ERROR, "No border area selected");
 			return 0;
 		}
 	}
@@ -1882,13 +1906,13 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 		render_result_exr_file_path(scene, "", 0, str);
 		
 		if (BLI_file_is_writable(str) == 0) {
-			BKE_report(reports, RPT_ERROR, "Can not save render buffers, check the temp default path");
+			BKE_report(reports, RPT_ERROR, "Cannot save render buffers, check the temp default path");
 			return 0;
 		}
 		
 		/* no fullsample and edge */
 		if ((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_EDGE)) {
-			BKE_report(reports, RPT_ERROR, "Full Sample doesn't support Edge Enhance");
+			BKE_report(reports, RPT_ERROR, "Full sample does not support edge enhance");
 			return 0;
 		}
 		
@@ -1899,18 +1923,18 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 	if (scene->r.scemode & R_DOCOMP) {
 		if (scene->use_nodes) {
 			if (!scene->nodetree) {
-				BKE_report(reports, RPT_ERROR, "No Nodetree in Scene");
+				BKE_report(reports, RPT_ERROR, "No node tree in scene");
 				return 0;
 			}
 			
 			if (!check_composite_output(scene)) {
-				BKE_report(reports, RPT_ERROR, "No Render Output Node in Scene");
+				BKE_report(reports, RPT_ERROR, "No render output node in scene");
 				return 0;
 			}
 			
 			if (scene->r.scemode & R_FULL_SAMPLE) {
 				if (composite_needs_render(scene, 0) == 0) {
-					BKE_report(reports, RPT_ERROR, "Full Sample AA not supported without 3d rendering");
+					BKE_report(reports, RPT_ERROR, "Full sample AA not supported without 3D rendering");
 					return 0;
 				}
 			}
@@ -1929,7 +1953,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 	/* forbidden combinations */
 	if (scene->r.mode & R_PANORAMA) {
 		if (scene->r.mode & R_ORTHO) {
-			BKE_report(reports, RPT_ERROR, "No Ortho render possible for Panorama");
+			BKE_report(reports, RPT_ERROR, "No ortho render possible for panorama");
 			return 0;
 		}
 	}
@@ -1945,7 +1969,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 		if (!(srl->layflag & SCE_LAY_DISABLE))
 			break;
 	if (srl == NULL) {
-		BKE_report(reports, RPT_ERROR, "All RenderLayers are disabled");
+		BKE_report(reports, RPT_ERROR, "All render layers are disabled");
 		return 0;
 	}
 
@@ -2014,6 +2038,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
 	
 	re->main = bmain;
 	re->scene = scene;
+	re->scene_color_manage = BKE_scene_check_color_management_enabled(scene);
 	re->camera_override = camera_override;
 	re->lay = lay;
 	
@@ -2138,7 +2163,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 		IMB_freeImBuf(ibuf);
 
 		printf("Append frame %d", scene->r.cfra);
-	} 
+	}
 	else {
 		if (name_override)
 			BLI_strncpy(name, name_override, sizeof(name));
@@ -2352,6 +2377,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
 
 	re->main = bmain;
 	re->scene = sce;
+	re->scene_color_manage = BKE_scene_check_color_management_enabled(sce);
 	re->lay = sce->lay;
 
 	camera = RE_GetCamera(re);
@@ -2396,6 +2422,7 @@ int RE_ReadRenderResult(Scene *scene, Scene *scenode)
 		re = RE_NewRender(scene->id.name);
 	RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect);
 	re->scene = scene;
+	re->scene_color_manage = BKE_scene_check_color_management_enabled(scene);
 	
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 	success = render_result_exr_file_read(re, 0);
@@ -2456,25 +2483,25 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
 					IMB_freeImBuf(ibuf_clip);
 				}
 				else {
-					BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to allocate clip buffer '%s'\n", filename);
+					BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to allocate clip buffer '%s'", filename);
 				}
 			}
 			else {
-				BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: incorrect dimensions for partial copy '%s'\n", filename);
+				BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: incorrect dimensions for partial copy '%s'", filename);
 			}
 		}
 
 		IMB_freeImBuf(ibuf);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
+		BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'", filename);
 	}
 }
 
 void RE_result_load_from_file(RenderResult *result, ReportList *reports, const char *filename)
 {
 	if (!render_result_exr_file_read_path(result, NULL, filename)) {
-		BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
+		BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'", filename);
 		return;
 	}
 }
@@ -2502,8 +2529,8 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
 
 	if (env->type == ENV_CUBE) {
 		for (i = 0; i < 12; i += 2) {
-			maxX = MAX2(maxX, layout[i] + 1);
-			maxY = MAX2(maxY, layout[i + 1] + 1);
+			maxX = max_ii(maxX, (int)layout[i] + 1);
+			maxY = max_ii(maxY, (int)layout[i + 1] + 1);
 		}
 
 		ibuf = IMB_allocImBuf(maxX * dx, maxY * dx, 24, IB_rectfloat);
@@ -2535,7 +2562,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
 		return TRUE;
 	}
 	else {
-		BKE_report(reports, RPT_ERROR, "Error writing environment map.");
+		BKE_report(reports, RPT_ERROR, "Error writing environment map");
 		return FALSE;
 	}
 }
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 8e6078b..3420648 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -162,7 +162,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 					copy_v3_v3(lvrot, lv);
 					mul_m3_v3(lar->imat, lvrot);
 					
-					x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
+					x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
 					/* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
 					
 					inpr= 1.0/(sqrt(1.0f+x*x));
@@ -614,7 +614,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
 		copy_v3_v3(collector, &R.wrld.horr);
 
 		collector[3] = 0.0f;
-	} 
+	}
 	else {
 		/* 2. */
 
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index a93dde7..a540cdb 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -36,6 +36,7 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
+#include "BLI_noise.h"
 #include "BLI_kdopbvh.h"
 #include "BLI_utildefines.h"
 
@@ -170,7 +171,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 				pd->point_data[i*3 + 0] = state.vel[0];
 				pd->point_data[i*3 + 1] = state.vel[1];
 				pd->point_data[i*3 + 2] = state.vel[2];
-			} 
+			}
 			if (data_used & POINT_DATA_LIFE) {
 				float pa_time;
 				
@@ -405,7 +406,7 @@ static void init_pointdensityrangedata(PointDensity *pd, PointDensityRangeData *
 }
 
 
-int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
+int pointdensitytex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int retval = TEX_INT;
 	PointDensity *pd = tex->pd;
@@ -418,7 +419,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
 	
 	texres->tin = 0.0f;
 	
-	if ((!pd) || (!pd->point_tree))		
+	if ((!pd) || (!pd->point_tree))
 		return 0;
 		
 	init_pointdensityrangedata(pd, &pdr, &density, vec, &age, 
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index aa35d73..127e0bc 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -239,7 +239,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
 		if (faces == 0)
 			return NULL;
 
-		//Create Ray cast accelaration structure		
+		//Create Ray cast accelaration structure
 		raytree = RE_rayobject_create( re,  re->r.raytrace_structure, faces );
 		if (  (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
 			vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives");
@@ -549,7 +549,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
 		
 		/* raytrace likes to separate the spec color */
 		sub_v3_v3v3(shr->diff, shr->combined, shr->spec);
-	}	
+	}
 
 }
 
@@ -564,12 +564,12 @@ static int refraction(float refract[3], const float n[3], const float view[3], f
 	if (dot>0.0f) {
 		index = 1.0f/index;
 		fac= 1.0f - (1.0f - dot*dot)*index*index;
-		if (fac<= 0.0f) return 0;
+		if (fac <= 0.0f) return 0;
 		fac= -dot*index + sqrtf(fac);
 	}
 	else {
 		fac= 1.0f - (1.0f - dot*dot)*index*index;
-		if (fac<= 0.0f) return 0;
+		if (fac <= 0.0f) return 0;
 		fac= -dot*index - sqrtf(fac);
 	}
 
@@ -632,7 +632,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
 	   
 	if (shi->mat->tx_limit <= 0.0f) {
 		d= 1.0f;
-	} 
+	}
 	else {
 		float p;
 
@@ -733,7 +733,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 		if (depth>0) {
 			float fr, fg, fb, f, f1;
 
-			if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) { 
+			if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
 				float nf, f, refract[3], tracol[4];
 				
 				tracol[0]= shi.r;
@@ -938,7 +938,7 @@ void init_jitter_plane(LampRen *lar)
 				DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
 			}
 		}
-	}	
+	}
 	/* create the dithered tables (could just check lamp type!) */
 	jitter_plane_offset(lar->jitter, lar->jitter+2*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.0f);
 	jitter_plane_offset(lar->jitter, lar->jitter+4*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.5f);
@@ -1151,7 +1151,7 @@ static void QMC_sampleHemiCosine(float vec[3], QMCSampler *qsa, int thread, int
 	
 	QMC_getSample(s, qsa, thread, num);
 	
-	phi = s[0]*2.f*M_PI;	
+	phi = s[0]*2.f*M_PI;
 	sqr = s[1]*sqrt(2-s[1]*s[1]);
 
 	vec[0] = cos(phi)*sqr;
@@ -1295,7 +1295,7 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
 		max_samples = 1;
 	
 
-	while (samples < max_samples) {		
+	while (samples < max_samples) {
 		if (refraction(v_refract, shi->vn, shi->view, shi->ang)) {
 			traflag |= RAY_INSIDE;
 		}
@@ -1515,7 +1515,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
 		if (!(shi->combinedflag & SCE_PASS_REFRACT))
 			sub_v3_v3v3(diff, diff, shr->refr);
 		
-		shr->alpha = minf(1.0f, tracol[3]);
+		shr->alpha = min_ff(1.0f, tracol[3]);
 	}
 	
 	if (do_mir) {
@@ -1822,7 +1822,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
 		}
 		
 		return sphere;
-	} 
+	}
 	else {
 		float *sphere;
 		float *vec1;
@@ -1847,7 +1847,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
 			for (a=0; a<tot; a++, vec+=3, vec1+=3) {
 				vec1[0]= cost*cosfi*vec[0] - sinfi*vec[1] + sint*cosfi*vec[2];
 				vec1[1]= cost*sinfi*vec[0] + cosfi*vec[1] + sint*sinfi*vec[2];
-				vec1[2]= -sint*vec[0] + cost*vec[2];			
+				vec1[2]= -sint*vec[0] + cost*vec[2];
 			}
 		}
 		return sphere;
@@ -1981,7 +1981,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 		samples++;
 		
 		if (qsa && qsa->type == SAMP_TYPE_HALTON) {
-			/* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */		
+			/* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */
 			if (adapt_thresh > 0.0f && (samples > max_samples/2) ) {
 				
 				if (adaptive_sample_contrast_val(samples, prev, fac, adapt_thresh)) {
@@ -2532,7 +2532,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
 
 #if 0
 /* only when face points away from lamp, in direction of lamp, trace ray and find first exit point */
-static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co)
+static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float co[3])
 {
 	Isect isec;
 	float lampco[3];
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 0bac26e..f828158 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -786,7 +786,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
 	}
 	else {
 		/* TODO, get the error from openexr's exception */
-		BKE_report(reports, RPT_ERROR, "Error Writing Render Result, see console");
+		BKE_report(reports, RPT_ERROR, "Error writing render result (see console)");
 		success = FALSE;
 	}
 	IMB_exr_close(exrhandle);
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 0511b03..e6daa5f 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -35,6 +35,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_noise.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
@@ -184,7 +185,7 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres)
 
 
 
-static int blend(Tex *tex, float *texvec, TexResult *texres)
+static int blend(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	float x, y, t;
 
@@ -236,7 +237,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
 
 /* newnoise: all noisebased types now have different noisebases to choose from */
 
-static int clouds(Tex *tex, float *texvec, TexResult *texres)
+static int clouds(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 	
@@ -302,7 +303,7 @@ static float tex_tri(float a)
 /* computes basic wood intensity value at x,y,z */
 static float wood_int(Tex *tex, float x, float y, float z)
 {
-	float wi=0;						
+	float wi = 0;
 	short wf = tex->noisebasis2;	/* wave form:	TEX_SIN=0,  TEX_SAW=1,  TEX_TRI=2						 */
 	short wt = tex->stype;			/* wood type:	TEX_BAND=0, TEX_RING=1, TEX_BANDNOISE=2, TEX_RINGNOISE=3 */
 
@@ -331,7 +332,7 @@ static float wood_int(Tex *tex, float x, float y, float z)
 	return wi;
 }
 
-static int wood(Tex *tex, float *texvec, TexResult *texres)
+static int wood(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv=TEX_INT;
 
@@ -373,7 +374,7 @@ static float marble_int(Tex *tex, float x, float y, float z)
 		mi = waveform[wf](mi);
 		if (mt==TEX_SHARP) {
 			mi = sqrt(mi);
-		} 
+		}
 		else if (mt==TEX_SHARPER) {
 			mi = sqrt(sqrt(mi));
 		}
@@ -382,7 +383,7 @@ static float marble_int(Tex *tex, float x, float y, float z)
 	return mi;
 }
 
-static int marble(Tex *tex, float *texvec, TexResult *texres)
+static int marble(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv=TEX_INT;
 
@@ -406,7 +407,7 @@ static int marble(Tex *tex, float *texvec, TexResult *texres)
 
 /* ------------------------------------------------------------------------- */
 
-static int magic(Tex *tex, float *texvec, TexResult *texres)
+static int magic(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	float x, y, z, turb=1.0;
 	int n;
@@ -482,7 +483,7 @@ static int magic(Tex *tex, float *texvec, TexResult *texres)
 /* ------------------------------------------------------------------------- */
 
 /* newnoise: stucci also modified to use different noisebasis */
-static int stucci(Tex *tex, float *texvec, TexResult *texres)
+static int stucci(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	float nor[3], b2, ofs;
 	int retval= TEX_INT;
@@ -493,7 +494,7 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
 
 	if (tex->stype) ofs*=(b2*b2);
 	nor[0] = BLI_gNoise(tex->noisesize, texvec[0]+ofs, texvec[1], texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
-	nor[1] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1]+ofs, texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);	
+	nor[1] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1]+ofs, texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
 	nor[2] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1], texvec[2]+ofs, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
 
 	texres->tin= nor[2];
@@ -524,7 +525,7 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
 /* ------------------------------------------------------------------------- */
 /* newnoise: musgrave terrain noise types */
 
-static float mg_mFractalOrfBmTex(Tex *tex, float *texvec, TexResult *texres)
+static float mg_mFractalOrfBmTex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 	float (*mgravefunc)(float, float, float, float, float, float, int);
@@ -554,7 +555,7 @@ static float mg_mFractalOrfBmTex(Tex *tex, float *texvec, TexResult *texres)
 
 }
 
-static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec, TexResult *texres)
+static float mg_ridgedOrHybridMFTex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 	float (*mgravefunc)(float, float, float, float, float, float, float, float, int);
@@ -585,7 +586,7 @@ static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec, TexResult *texres)
 }
 
 
-static float mg_HTerrainTex(Tex *tex, float *texvec, TexResult *texres)
+static float mg_HTerrainTex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 
@@ -610,7 +611,7 @@ static float mg_HTerrainTex(Tex *tex, float *texvec, TexResult *texres)
 }
 
 
-static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres)
+static float mg_distNoiseTex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 
@@ -639,7 +640,7 @@ static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres)
 /* ------------------------------------------------------------------------- */
 /* newnoise: Voronoi texture type, probably the slowest, especially with minkovsky, bumpmapping, could be done another way */
 
-static float voronoiTex(Tex *tex, float *texvec, TexResult *texres)
+static float voronoiTex(Tex *tex, const float texvec[3], TexResult *texres)
 {
 	int rv = TEX_INT;
 	float da[4], pa[12];	/* distance and point coordinate arrays of 4 nearest neighbors */
@@ -768,7 +769,7 @@ static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1
 	else {
 		*adr1 = (y + 1.0f) / 2.0f;
 		*adr2 = (z + 1.0f) / 2.0f;
-		ret= 2;		
+		ret= 2;
 	}
 	return ret;
 }
@@ -823,8 +824,8 @@ static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y,
 			*adr1 = (y + 1.0f) / 2.0f;
 			*adr2 = (z + 1.0f) / 2.0f;
 			ret= 2;
-		}		
-	} 
+		}
+	}
 	else {
 		return cubemap_glob(n, x, y, z, adr1, adr2);
 	}
@@ -861,14 +862,14 @@ static int cubemap_ob(Object *ob, const float n[3], float x, float y, float z, f
 	else {
 		*adr1 = (y + 1.0f) / 2.0f;
 		*adr2 = (z + 1.0f) / 2.0f;
-		ret= 2;		
+		ret= 2;
 	}
 	return ret;
 }
 
 /* ------------------------------------------------------------------------- */
 
-static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], float *dxt, float *dyt)
+static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float n[3], float dxt[3], float dyt[3])
 {
 	Tex *tex;
 	Object *ob= NULL;
@@ -884,15 +885,15 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 	if (R.osa==0) {
 		
 		if (wrap==MTEX_FLAT) {
-			fx = (t[0] + 1.0f) / 2.0f;
-			fy = (t[1] + 1.0f) / 2.0f;
+			fx = (texvec[0] + 1.0f) / 2.0f;
+			fy = (texvec[1] + 1.0f) / 2.0f;
 		}
-		else if (wrap == MTEX_TUBE)   map_to_tube( &fx, &fy, t[0], t[1], t[2]);
-		else if (wrap == MTEX_SPHERE) map_to_sphere(&fx, &fy, t[0], t[1], t[2]);
+		else if (wrap == MTEX_TUBE)   map_to_tube( &fx, &fy, texvec[0], texvec[1], texvec[2]);
+		else if (wrap == MTEX_SPHERE) map_to_sphere(&fx, &fy, texvec[0], texvec[1], texvec[2]);
 		else {
-			if      (texco == TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
-			else if (texco == TEXCO_GLOB)   cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
-			else                            cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy);
+			if      (texco == TEXCO_OBJECT) cubemap_ob(ob, n, texvec[0], texvec[1], texvec[2], &fx, &fy);
+			else if (texco == TEXCO_GLOB)   cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy);
+			else                            cubemap(mtex, vlr, n, texvec[0], texvec[1], texvec[2], &fx, &fy);
 		}
 		
 		/* repeat */
@@ -932,14 +933,14 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 			fy= tex->cropymin+ fy*fac1;
 		}
 
-		t[0]= fx;
-		t[1]= fy;
+		texvec[0]= fx;
+		texvec[1]= fy;
 	}
 	else {
 		
 		if (wrap==MTEX_FLAT) {
-			fx= (t[0] + 1.0f) / 2.0f;
-			fy= (t[1] + 1.0f) / 2.0f;
+			fx= (texvec[0] + 1.0f) / 2.0f;
+			fy= (texvec[1] + 1.0f) / 2.0f;
 			dxt[0]/= 2.0f;
 			dxt[1]/= 2.0f;
 			dxt[2]/= 2.0f;
@@ -950,13 +951,13 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 		else if (ELEM(wrap, MTEX_TUBE, MTEX_SPHERE)) {
 			/* exception: the seam behind (y<0.0) */
 			ok= 1;
-			if (t[1]<=0.0f) {
-				fx= t[0]+dxt[0];
-				fy= t[0]+dyt[0];
-				if (fx>=0.0f && fy>=0.0f && t[0]>=0.0f) {
+			if (texvec[1]<=0.0f) {
+				fx= texvec[0]+dxt[0];
+				fy= texvec[0]+dyt[0];
+				if (fx>=0.0f && fy>=0.0f && texvec[0]>=0.0f) {
 					/* pass */
 				}
-				else if (fx<=0.0f && fy<=0.0f && t[0]<=0.0f) {
+				else if (fx<=0.0f && fy<=0.0f && texvec[0]<=0.0f) {
 					/* pass */
 				}
 				else {
@@ -966,20 +967,20 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 
 			if (ok) {
 				if (wrap==MTEX_TUBE) {
-					map_to_tube(area, area+1, t[0], t[1], t[2]);
-					map_to_tube(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]);
-					map_to_tube(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]);
+					map_to_tube(area, area+1, texvec[0], texvec[1], texvec[2]);
+					map_to_tube(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]);
+					map_to_tube(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]);
 				}
-				else { 
-					map_to_sphere(area, area+1, t[0], t[1], t[2]);
-					map_to_sphere(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]);
-					map_to_sphere(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]);
+				else {
+					map_to_sphere(area, area+1, texvec[0], texvec[1], texvec[2]);
+					map_to_sphere(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]);
+					map_to_sphere(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]);
 				}
 				areaflag= 1;
 			}
 			else {
-				if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]);
-				else map_to_sphere(&fx, &fy, t[0], t[1], t[2]);
+				if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, texvec[0], texvec[1], texvec[2]);
+				else map_to_sphere(&fx, &fy, texvec[0], texvec[1], texvec[2]);
 				dxt[0]/= 2.0f;
 				dxt[1]/= 2.0f;
 				dyt[0]/= 2.0f;
@@ -988,9 +989,9 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 		}
 		else {
 
-			if (texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
-			else if (texco==TEXCO_GLOB) proj = cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
-			else proj = cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy);
+			if (texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, texvec[0], texvec[1], texvec[2], &fx, &fy);
+			else if (texco==TEXCO_GLOB) proj = cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy);
+			else proj = cubemap(mtex, vlr, n, texvec[0], texvec[1], texvec[2], &fx, &fy);
 
 			if (proj==1) {
 				SWAP(float, dxt[1], dxt[2]);
@@ -1090,111 +1091,111 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3],
 			dyt[1]*= fac1;
 		}
 		
-		t[0]= fx;
-		t[1]= fy;
+		texvec[0]= fx;
+		texvec[1]= fy;
 
 	}
 }
 
 /* ************************************** */
 
-static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
+static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output)
 {
 	float tmpvec[3];
-	int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */
+	int retval = 0; /* return value, int:0, col:1, nor:2, everything:3 */
 
 	texres->talpha = FALSE;  /* is set when image texture returns alpha (considered premul) */
 	
 	if (tex->use_nodes && tex->nodetree) {
 		retval = ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, osatex, thread,
-			tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL);
+		                          tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL);
 	}
-	else
-	switch (tex->type) {
-	
-	case 0:
-		texres->tin= 0.0f;
-		return 0;
-	case TEX_CLOUDS:
-		retval= clouds(tex, texvec, texres);
-		break;
-	case TEX_WOOD:
-		retval= wood(tex, texvec, texres); 
-		break;
-	case TEX_MARBLE:
-		retval= marble(tex, texvec, texres); 
-		break;
-	case TEX_MAGIC:
-		retval= magic(tex, texvec, texres); 
-		break;
-	case TEX_BLEND:
-		retval= blend(tex, texvec, texres);
-		break;
-	case TEX_STUCCI:
-		retval= stucci(tex, texvec, texres); 
-		break;
-	case TEX_NOISE:
-		retval= texnoise(tex, texres); 
-		break;
-	case TEX_IMAGE:
-		if (osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
-		else retval= imagewrap(tex, tex->ima, NULL, texvec, texres); 
-		BKE_image_tag_time(tex->ima); /* tag image as having being used */
-		break;
-	case TEX_ENVMAP:
-		retval= envmaptex(tex, texvec, dxt, dyt, osatex, texres);
-		break;
-	case TEX_MUSGRAVE:
-		/* newnoise: musgrave types */
-		
-		/* ton: added this, for Blender convention reason. 
-		 * artificer: added the use of tmpvec to avoid scaling texvec
-		 */
-		copy_v3_v3(tmpvec, texvec);
-		mul_v3_fl(tmpvec, 1.0f/tex->noisesize);
-		
-		switch (tex->stype) {
-		case TEX_MFRACTAL:
-		case TEX_FBM:
-			retval= mg_mFractalOrfBmTex(tex, tmpvec, texres);
-			break;
-		case TEX_RIDGEDMF:
-		case TEX_HYBRIDMF:
-			retval= mg_ridgedOrHybridMFTex(tex, tmpvec, texres);
-			break;
-		case TEX_HTERRAIN:
-			retval= mg_HTerrainTex(tex, tmpvec, texres);
-			break;
+	else {
+		switch (tex->type) {
+			case 0:
+				texres->tin= 0.0f;
+				return 0;
+			case TEX_CLOUDS:
+				retval = clouds(tex, texvec, texres);
+				break;
+			case TEX_WOOD:
+				retval = wood(tex, texvec, texres);
+				break;
+			case TEX_MARBLE:
+				retval = marble(tex, texvec, texres);
+				break;
+			case TEX_MAGIC:
+				retval = magic(tex, texvec, texres);
+				break;
+			case TEX_BLEND:
+				retval = blend(tex, texvec, texres);
+				break;
+			case TEX_STUCCI:
+				retval = stucci(tex, texvec, texres);
+				break;
+			case TEX_NOISE:
+				retval = texnoise(tex, texres);
+				break;
+			case TEX_IMAGE:
+				if (osatex) retval = imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
+				else        retval = imagewrap(tex, tex->ima, NULL, texvec, texres);
+				BKE_image_tag_time(tex->ima); /* tag image as having being used */
+				break;
+			case TEX_ENVMAP:
+				retval = envmaptex(tex, texvec, dxt, dyt, osatex, texres);
+				break;
+			case TEX_MUSGRAVE:
+				/* newnoise: musgrave types */
+
+				/* ton: added this, for Blender convention reason.
+				 * artificer: added the use of tmpvec to avoid scaling texvec
+				 */
+				copy_v3_v3(tmpvec, texvec);
+				mul_v3_fl(tmpvec, 1.0f / tex->noisesize);
+
+				switch (tex->stype) {
+					case TEX_MFRACTAL:
+					case TEX_FBM:
+						retval = mg_mFractalOrfBmTex(tex, tmpvec, texres);
+						break;
+					case TEX_RIDGEDMF:
+					case TEX_HYBRIDMF:
+						retval = mg_ridgedOrHybridMFTex(tex, tmpvec, texres);
+						break;
+					case TEX_HTERRAIN:
+						retval = mg_HTerrainTex(tex, tmpvec, texres);
+						break;
+				}
+				break;
+				/* newnoise: voronoi type */
+			case TEX_VORONOI:
+				/* ton: added this, for Blender convention reason.
+				 * artificer: added the use of tmpvec to avoid scaling texvec
+				 */
+				copy_v3_v3(tmpvec, texvec);
+				mul_v3_fl(tmpvec, 1.0f / tex->noisesize);
+
+				retval = voronoiTex(tex, tmpvec, texres);
+				break;
+			case TEX_DISTNOISE:
+				/* ton: added this, for Blender convention reason.
+				 * artificer: added the use of tmpvec to avoid scaling texvec
+				 */
+				copy_v3_v3(tmpvec, texvec);
+				mul_v3_fl(tmpvec, 1.0f / tex->noisesize);
+
+				retval = mg_distNoiseTex(tex, tmpvec, texres);
+				break;
+			case TEX_POINTDENSITY:
+				retval = pointdensitytex(tex, texvec, texres);
+				break;
+			case TEX_VOXELDATA:
+				retval = voxeldatatex(tex, texvec, texres);
+				break;
+			case TEX_OCEAN:
+				retval = ocean_texture(tex, texvec, texres);
+				break;
 		}
-		break;
-	/* newnoise: voronoi type */
-	case TEX_VORONOI:
-		/* ton: added this, for Blender convention reason.
-		 * artificer: added the use of tmpvec to avoid scaling texvec
-		 */
-		copy_v3_v3(tmpvec, texvec);
-		mul_v3_fl(tmpvec, 1.0f/tex->noisesize);
-		
-		retval= voronoiTex(tex, tmpvec, texres);
-		break;
-	case TEX_DISTNOISE:
-		/* ton: added this, for Blender convention reason.
-		 * artificer: added the use of tmpvec to avoid scaling texvec
-		 */
-		copy_v3_v3(tmpvec, texvec);
-		mul_v3_fl(tmpvec, 1.0f/tex->noisesize);
-		
-		retval= mg_distNoiseTex(tex, tmpvec, texres);
-		break;
-	case TEX_POINTDENSITY:
-		retval= pointdensitytex(tex, texvec, texres);
-		break;
-	case TEX_VOXELDATA:
-		retval= voxeldatatex(tex, texvec, texres);  
-		break;
-	case TEX_OCEAN:
-		retval= ocean_texture(tex, texvec, texres);  
-		break;
 	}
 
 	if (tex->flag & TEX_COLORBAND) {
@@ -1212,7 +1213,8 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 }
 
 /* this is called from the shader and texture nodes */
-int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output, ShadeInput *shi, MTex *mtex)
+int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
+                   const short thread, short which_output, ShadeInput *shi, MTex *mtex)
 {
 	if (tex==NULL) {
 		memset(texres, 0, sizeof(TexResult));
@@ -1228,14 +1230,16 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 		if (mtex) {
 			/* we have mtex, use it for 2d mapping images only */
 			do_2d_mapping(mtex, texvec, shi->vlr, shi->facenor, dxt, dyt);
-			rgbnor= multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
+			rgbnor = multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
 
 			if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
-				ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+				ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
 				
 				/* don't linearize float buffers, assumed to be linear */
-				if (ibuf && !(ibuf->rect_float))
+				if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
 					IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
+
+				BKE_image_release_ibuf(tex->ima, ibuf, NULL);
 			}
 		}
 		else {
@@ -1260,16 +1264,27 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 			
 			do_2d_mapping(&localmtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
 			rgbnor= multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output);
+
+			{
+				ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
+
+				/* don't linearize float buffers, assumed to be linear */
+				if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
+					IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
+
+				BKE_image_release_ibuf(tex->ima, ibuf, NULL);
+			}
 		}
 
 		return rgbnor;
 	}
-	else
+	else {
 		return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
+	}
 }
 
 /* this is called for surface shading */
-static int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float *dyt, TexResult *texres)
+static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres)
 {
 	Tex *tex = mtex->tex;
 
@@ -1286,13 +1301,13 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt,
 
 /* Warning, if the texres's values are not declared zero, check the return value to be sure
  * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
-int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
+int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres)
 {
 	return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL);
 }
 
 /* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */
-int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres)
+int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres)
 {
 	int use_nodes= tex->use_nodes, retval;
 	
@@ -1517,7 +1532,8 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 	return in;
 }
 
-static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, float* dx, float* dy, float* texvec, float* dxt, float* dyt)
+static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex,
+                          const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3])
 {
 	/* new: first swap coords, then map, then trans/scale */
 	if (tex->type == TEX_IMAGE) {
@@ -1549,10 +1565,10 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa
 		texvec[0] = mtex->size[0]*(texvec[0] - 0.5f) + mtex->ofs[0] + 0.5f;
 		texvec[1] = mtex->size[1]*(texvec[1] - 0.5f) + mtex->ofs[1] + 0.5f;
 		if (shi->osatex) {
-			dxt[0] = mtex->size[0]*dxt[0];
-			dxt[1] = mtex->size[1]*dxt[1];
-			dyt[0] = mtex->size[0]*dyt[0];
-			dyt[1] = mtex->size[1]*dyt[1];
+			dxt[0] = mtex->size[0] * dxt[0];
+			dxt[1] = mtex->size[1] * dxt[1];
+			dyt[0] = mtex->size[0] * dyt[0];
+			dyt[1] = mtex->size[1] * dyt[1];
 		}
 		
 		/* problem: repeat-mirror is not a 'repeat' but 'extend' in imagetexture.c */
@@ -1682,7 +1698,8 @@ static void compatible_bump_uv_derivs(CompatibleBump *compat_bump, ShadeInput *s
 	}
 }
 
-static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt)
+static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres,
+                                   float Tnor, const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3])
 {
 	TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL};  /* temp TexResult */
 	float tco[3], texv[3], cd, ud, vd, du, dv, idu, idv;
@@ -1710,11 +1727,12 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
 	if (!shi->osatex && (tex->type == TEX_IMAGE) && tex->ima) {
 		/* in case we have no proper derivatives, fall back to
 		 * computing du/dv it based on image size */
-		ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
 		if (ibuf) {
 			du = 1.f/(float)ibuf->x;
 			dv = 1.f/(float)ibuf->y;
 		}
+		BKE_image_release_ibuf(tex->ima, ibuf, NULL);
 	}
 	else if (shi->osatex) {
 		/* we have derivatives, can compute proper du/dv */
@@ -1740,7 +1758,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
 	if (mtex->texco == TEXCO_UV) {
 		/* for the uv case, use the same value for both du/dv,
 		 * since individually scaling the normal derivatives makes them useless... */
-		du = minf(du, dv);
+		du = min_ff(du, dv);
 		idu = (du < 1e-5f) ? bf : (bf/du);
 
 		/* +u val */
@@ -1838,7 +1856,9 @@ static void ntap_bump_init(NTapBump *ntap_bump)
 	memset(ntap_bump, 0, sizeof(*ntap_bump));
 }
 
-static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt)
+static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres,
+                             float Tnor, const float co[3], const float dx[3], const float dy[3],
+                             float texvec[3], float dxt[3], float dyt[3])
 {
 	TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL};	/* temp TexResult */
 
@@ -1885,12 +1905,13 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 
 	/* resolve image dimensions */
 	if (found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
-		ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+		ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
 		if (ibuf) {
 			dimx = ibuf->x;
 			dimy = ibuf->y;
 			aspect = ((float) dimy) / dimx;
 		}
+		BKE_image_release_ibuf(tex->ima, ibuf, NULL);
 	}
 	
 	if (found_deriv_map) {
@@ -2264,11 +2285,11 @@ void do_material_tex(ShadeInput *shi, Render *re)
 			if (texres.nor && !((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP))) {
 				if (use_compat_bump) {
 					rgbnor = compatible_bump_compute(&compat_bump, shi, mtex, tex,
-						&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
+					                                 &texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
 				}
 				else if (use_ntap_bump) {
 					rgbnor = ntap_bump_compute(&ntap_bump, shi, mtex, tex,
-						&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
+					                           &texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
 				}
 				else {
 					texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
@@ -2381,11 +2402,13 @@ void do_material_tex(ShadeInput *shi, Render *re)
 				/* inverse gamma correction */
 				if (tex->type==TEX_IMAGE) {
 					Image *ima = tex->ima;
-					ImBuf *ibuf = BKE_image_get_ibuf(ima, &tex->iuser);
+					ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 					
 					/* don't linearize float buffers, assumed to be linear */
-					if (ibuf && !(ibuf->rect_float))
+					if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
 						IMB_colormanagement_colorspace_to_scene_linear_v3(tcol, ibuf->rect_colorspace);
+
+					BKE_image_release_ibuf(ima, ibuf, NULL);
 				}
 				
 				if (mtex->mapto & MAP_COL) {
@@ -2657,9 +2680,16 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
 					copy_v3_v3(co, xyz);
 					if (mtex->texflag & MTEX_OB_DUPLI_ORIG) {
 						if (shi->obi && shi->obi->duplitexmat)
-							mul_m4_v3(shi->obi->duplitexmat, co);					
-					} 
+							mul_m4_v3(shi->obi->duplitexmat, co);
+					}
 					mul_m4_v3(ob->imat_ren, co);
+
+					if (mtex->texflag & MTEX_MAPTO_BOUNDS && ob->bb) {
+						/* use bb vec[0] as min and bb vec[6] as max */
+						co[0] = (co[0] - ob->bb->vec[0][0]) / (ob->bb->vec[6][0]-ob->bb->vec[0][0]) * 2.0f - 1.0f;
+						co[1] = (co[1] - ob->bb->vec[0][1]) / (ob->bb->vec[6][1]-ob->bb->vec[0][1]) * 2.0f - 1.0f;
+						co[2] = (co[2] - ob->bb->vec[0][2]) / (ob->bb->vec[6][2]-ob->bb->vec[0][2]) * 2.0f - 1.0f;
+					}
 				}
 			}
 			/* not really orco, but 'local' */
@@ -2672,6 +2702,13 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
 					Object *ob= shi->obi->ob;
 					copy_v3_v3(co, xyz);
 					mul_m4_v3(ob->imat_ren, co);
+
+					if (mtex->texflag & MTEX_MAPTO_BOUNDS && ob->bb) {
+						/* use bb vec[0] as min and bb vec[6] as max */
+						co[0] = (co[0] - ob->bb->vec[0][0]) / (ob->bb->vec[6][0]-ob->bb->vec[0][0]) * 2.0f - 1.0f;
+						co[1] = (co[1] - ob->bb->vec[0][1]) / (ob->bb->vec[6][1]-ob->bb->vec[0][1]) * 2.0f - 1.0f;
+						co[2] = (co[2] - ob->bb->vec[0][2]) / (ob->bb->vec[6][2]-ob->bb->vec[0][2]) * 2.0f - 1.0f;
+					}
 				}
 			}
 			else if (mtex->texco==TEXCO_GLOB) {
@@ -2738,6 +2775,12 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
 				if ((rgbnor & TEX_RGB) == 0) {
 					copy_v3_v3(tcol, &mtex->r);
 				}
+				else if (mtex->mapto & MAP_DENSITY) {
+					copy_v3_v3(tcol, &texres.tr);
+					if (texres.talpha) {
+						texres.tin = stencilTin;
+					}
+				}
 				else {
 					copy_v3_v3(tcol, &texres.tr);
 					if (texres.talpha) {
@@ -2893,11 +2936,13 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 		/* inverse gamma correction */
 		if (mtex->tex->type==TEX_IMAGE) {
 			Image *ima = mtex->tex->ima;
-			ImBuf *ibuf = BKE_image_get_ibuf(ima, &mtex->tex->iuser);
+			ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &mtex->tex->iuser, NULL);
 			
 			/* don't linearize float buffers, assumed to be linear */
-			if (ibuf && !(ibuf->rect_float))
+			if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
 				IMB_colormanagement_colorspace_to_scene_linear_v3(&texres.tr, ibuf->rect_colorspace);
+
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 
 		fact= texres.tin*mtex->colfac;
@@ -3051,7 +3096,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				break;
 			}
 			
-			/* placement */			
+			/* placement */
 			if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
 			else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 			
@@ -3112,11 +3157,13 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				/* inverse gamma correction */
 				if (tex->type==TEX_IMAGE) {
 					Image *ima = tex->ima;
-					ImBuf *ibuf = BKE_image_get_ibuf(ima, &tex->iuser);
+					ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 					
 					/* don't linearize float buffers, assumed to be linear */
-					if (ibuf && !(ibuf->rect_float))
+					if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
 						IMB_colormanagement_colorspace_to_scene_linear_v3(tcol, ibuf->rect_colorspace);
+
+					BKE_image_release_ibuf(ima, ibuf, NULL);
 				}
 
 				if (mtex->mapto & WOMAP_HORIZ) {
@@ -3214,7 +3261,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 				}
 				co= tempvec; 
 				
-				dx= dxt; dy= dyt;	
+				dx= dxt; dy= dyt;
 				if (shi->osatex) {
 					copy_v3_v3(dxt, shi->dxlv);
 					copy_v3_v3(dyt, shi->dylv);
@@ -3326,11 +3373,13 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 				/* inverse gamma correction */
 				if (tex->type==TEX_IMAGE) {
 					Image *ima = tex->ima;
-					ImBuf *ibuf = BKE_image_get_ibuf(ima, &tex->iuser);
+					ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &tex->iuser, NULL);
 					
 					/* don't linearize float buffers, assumed to be linear */
-					if (ibuf && !(ibuf->rect_float))
+					if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
 						IMB_colormanagement_colorspace_to_scene_linear_v3(&texres.tr, ibuf->rect_colorspace);
+
+					BKE_image_release_ibuf(ima, ibuf, NULL);
 				}
 
 				/* lamp colors were premultiplied with this */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 285cd02..3431c3f 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -59,6 +59,7 @@
 #include "BKE_main.h"
 #include "BKE_node.h"
 #include "BKE_texture.h"
+#include "BKE_scene.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -93,7 +94,7 @@ extern struct Render R;
 
 /* x and y are current pixels in rect to be rendered */
 /* do not normalize! */
-void calc_view_vector(float *view, float x, float y)
+void calc_view_vector(float view[3], float x, float y)
 {
 
 	view[2]= -ABS(R.clipsta);
@@ -184,7 +185,8 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
 	
 	fullsample= (totsample > 1);
 	amount= 0;
-	accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
+	accol[0] = accol[1] = accol[2] = accol[3]= 0.0f;
+	col[0] = col[1] = col[2] = col[3]= 0.0f;
 	flarec= har->flarec;
 	
 	while (ps) {
@@ -293,11 +295,11 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
 			}
 			else {
 				
-				minx= MAX2(minx, testrect.xmin);
-				maxx= MIN2(maxx, testrect.xmax);
+				minx = max_ii(minx, testrect.xmin);
+				maxx = min_ii(maxx, testrect.xmax);
 			
-				miny= MAX2(har->miny, testrect.ymin);
-				maxy= MIN2(har->maxy, testrect.ymax);
+				miny = max_ii(har->miny, testrect.ymin);
+				maxy = min_ii(har->maxy, testrect.ymax);
 			
 				for (y=miny; y<maxy; y++) {
 					int rectofs= (y-disprect.ymin)*pa->rectx + (minx - disprect.xmin);
@@ -670,7 +672,7 @@ int get_sample_layers(RenderPart *pa, RenderLayer *rl, RenderLayer **rlpp)
 			RenderResult *rr= BLI_findlink(&pa->fullresult, sample);
 		
 			rlpp[sample]= BLI_findlink(&rr->layers, nr);
-		}		
+		}
 		return R.osa;
 	}
 	else {
@@ -713,7 +715,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
 						addAlphaUnderFloat(pass, col);
 					}
 				}
-			}			
+			}
 		}
 		
 		if (y&1)
@@ -771,8 +773,8 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
 						if (*zrect >= 9.9e10f || rgbrect[3]==0.0f) {
 							continue;
 						}
-												
-						if ((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {	
+
+						if ((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
 							float tmp_rgb[3];
 							
 							/* skip if worldspace lamp vector is below horizon */
@@ -927,7 +929,7 @@ static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int ma
 	PixStrMain *psm;
 	PixStr *ps, *last= NULL;
 	
-	if (*rd) {	
+	if (*rd) {
 		ps= (PixStr *)(*rd);
 		
 		while (ps) {
@@ -1581,7 +1583,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
 
 	copy_v3_v3(shi->facenor, nor);
 	shade_input_set_viewco(shi, x, y, sx, sy, z);
-	*area = minf(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea);
+	*area = min_ff(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea);
 
 	shade_input_set_uv(shi);
 	shade_input_set_normals(shi);
@@ -2011,7 +2013,7 @@ void add_halo_flare(Render *re)
 		re->display_draw(re->ddh, rr, NULL);
 	}
 	
-	R.r.mode= mode;	
+	R.r.mode= mode;
 }
 
 /* ************************* bake ************************ */
@@ -2223,7 +2225,8 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 			float rgb[3];
 
 			copy_v3_v3(rgb, shr.combined);
-			IMB_colormanagement_scene_linear_to_colorspace_v3(rgb, bs->rect_colorspace);
+			if (R.scene_color_manage)
+				IMB_colormanagement_scene_linear_to_colorspace_v3(rgb, bs->rect_colorspace);
 			rgb_float_to_uchar(col, rgb);
 		}
 		else {
@@ -2373,10 +2376,28 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 		v2= vlr->v2->co;
 		v3= vlr->v3->co;
 	}
-	
-	/* renderco */
+
 	l= 1.0f-u-v;
+
+	/* shrink barycentric coordinates inwards slightly to avoid some issues
+	 * where baking selected to active might just miss the other face at the
+	 * near the edge of a face */
+	if (bs->actob) {
+		const float eps = 1.0f - 1e-4f;
+		float invsum;
+
+		u = (u - 0.5f)*eps + 0.5f;
+		v = (v - 0.5f)*eps + 0.5f;
+		l = (l - 0.5f)*eps + 0.5f;
+
+		invsum = 1.0f/(u + v + l);
+
+		u *= invsum;
+		v *= invsum;
+		l *= invsum;
+	}
 	
+	/* renderco */
 	shi->co[0]= l*v3[0]+u*v1[0]+v*v2[0];
 	shi->co[1]= l*v3[1]+u*v1[1]+v*v2[1];
 	shi->co[2]= l*v3[2]+u*v1[2]+v*v2[2];
@@ -2472,7 +2493,7 @@ static int get_next_bake_face(BakeShade *bs)
 		return 0;
 	}
 	
-	BLI_lock_thread(LOCK_CUSTOM1);	
+	BLI_lock_thread(LOCK_CUSTOM1);
 
 	for (; obi; obi=obi->next, v=0) {
 		obr= obi->obr;
@@ -2485,21 +2506,26 @@ static int get_next_bake_face(BakeShade *bs)
 
 				if (tface && tface->tpage) {
 					Image *ima= tface->tpage;
-					ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+					ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, NULL);
 					const float vec_alpha[4]= {0.0f, 0.0f, 0.0f, 0.0f};
 					const float vec_solid[4]= {0.0f, 0.0f, 0.0f, 1.0f};
 					
 					if (ibuf==NULL)
 						continue;
 					
-					if (ibuf->rect==NULL && ibuf->rect_float==NULL)
+					if (ibuf->rect==NULL && ibuf->rect_float==NULL) {
+						BKE_image_release_ibuf(ima, ibuf, NULL);
 						continue;
+					}
 					
-					if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
+					if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4)) {
+						BKE_image_release_ibuf(ima, ibuf, NULL);
 						continue;
+					}
 					
 					if (ima->flag & IMA_USED_FOR_RENDER) {
 						ima->id.flag &= ~LIB_DOIT;
+						BKE_image_release_ibuf(ima, ibuf, NULL);
 						continue;
 					}
 					
@@ -2513,11 +2539,13 @@ static int get_next_bake_face(BakeShade *bs)
 						/* clear image */
 						if (R.r.bake_flag & R_BAKE_CLEAR)
 							IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
-					
+
 						/* might be read by UI to set active image for display */
 						R.bakebuf= ima;
-					}				
-					
+					}
+
+					ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+
 					bs->obi= obi;
 					bs->vlr= vlr;
 					
@@ -2525,6 +2553,9 @@ static int get_next_bake_face(BakeShade *bs)
 					v++;
 					
 					BLI_unlock_thread(LOCK_CUSTOM1);
+
+					BKE_image_release_ibuf(ima, ibuf, NULL);
+
 					return 1;
 				}
 			}
@@ -2548,12 +2579,14 @@ static void shade_tface(BakeShade *bs)
 	
 	/* check valid zspan */
 	if (ima!=bs->ima) {
+		BKE_image_release_ibuf(bs->ima, bs->ibuf, NULL);
+
 		bs->ima= ima;
-		bs->ibuf= BKE_image_get_ibuf(ima, NULL);
+		bs->ibuf= BKE_image_acquire_ibuf(ima, NULL, NULL);
 		/* note, these calls only free/fill contents of zspan struct, not zspan itself */
 		zbuf_free_span(bs->zspan);
 		zbuf_alloc_span(bs->zspan, bs->ibuf->x, bs->ibuf->y, R.clipcrop);
-	}				
+	}
 	
 	bs->rectx= bs->ibuf->x;
 	bs->recty= bs->ibuf->y;
@@ -2615,7 +2648,9 @@ static void *do_bake_thread(void *bs_v)
 			*bs->do_update= TRUE;
 	}
 	bs->ready= 1;
-	
+
+	BKE_image_release_ibuf(bs->ima, bs->ibuf, NULL);
+
 	return NULL;
 }
 
@@ -2651,6 +2686,8 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	Image *ima;
 	int a, vdone = FALSE, use_mask = FALSE, result = BAKE_RESULT_OK;
 	
+	re->scene_color_manage = BKE_scene_check_color_management_enabled(re->scene);
+	
 	/* initialize render global */
 	R= *re;
 	R.bakebuf= NULL;
@@ -2664,12 +2701,13 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	
 	/* baker uses this flag to detect if image was initialized */
 	for (ima= G.main->image.first; ima; ima= ima->id.next) {
-		ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+		ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, NULL);
 		ima->id.flag |= LIB_DOIT;
 		ima->flag&= ~IMA_USED_FOR_RENDER;
 		if (ibuf) {
 			ibuf->userdata = NULL; /* use for masking if needed */
 		}
+		BKE_image_release_ibuf(ima, ibuf, NULL);
 	}
 	
 	BLI_init_threads(&threads, do_bake_thread, re->r.threads);
@@ -2722,7 +2760,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	/* filter and refresh images */
 	for (ima= G.main->image.first; ima; ima= ima->id.next) {
 		if ((ima->id.flag & LIB_DOIT)==0) {
-			ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+			ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, NULL);
 
 			if (ima->flag & IMA_USED_FOR_RENDER)
 				result= BAKE_RESULT_FEEDBACK_LOOP;
@@ -2733,7 +2771,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 			RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, re->r.bake_filter);
 
 			ibuf->userflags |= IB_BITMAPDIRTY;
-			if (ibuf->rect_float) IMB_rect_from_float(ibuf);
+			BKE_image_release_ibuf(ima, ibuf, NULL);
 		}
 	}
 	
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 172af3a..44daaf5 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -244,7 +244,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
 		memset(obr->vertnodes+obr->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
 		
 		obr->vertnodeslen+=TABLEINITSIZE; 
-		if (temp) MEM_freeN(temp);	
+		if (temp) MEM_freeN(temp);
 	}
 	
 	v= obr->vertnodes[a].vert;
@@ -487,7 +487,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
 		memset(obr->vlaknodes+obr->vlaknodeslen, 0, TABLEINITSIZE*sizeof(VlakTableNode));
 
 		obr->vlaknodeslen+=TABLEINITSIZE;  /*Does this really need to be power of 2?*/
-		if (temp) MEM_freeN(temp);	
+		if (temp) MEM_freeN(temp);
 	}
 
 	v= obr->vlaknodes[a].vlak;
@@ -658,7 +658,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
 		memset(obr->strandnodes+obr->strandnodeslen, 0, TABLEINITSIZE*sizeof(StrandTableNode));
 
 		obr->strandnodeslen+=TABLEINITSIZE;  /*Does this really need to be power of 2?*/
-		if (temp) MEM_freeN(temp);	
+		if (temp) MEM_freeN(temp);
 	}
 
 	v= obr->strandnodes[a].strand;
@@ -892,7 +892,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
 		if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
 		memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE*sizeof(void*));
 		obr->blohalen+=TABLEINITSIZE;  /*Does this really need to be power of 2?*/
-		if (temp) MEM_freeN(temp);	
+		if (temp) MEM_freeN(temp);
 	}
 	
 	h= obr->bloha[a];
@@ -1179,29 +1179,36 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 /* -------------------------- operations on entire database ----------------------- */
 
 /* ugly function for halos in panorama */
-static int panotestclip(Render *re, int do_pano, float *v)
+static int panotestclip(Render *re, int do_pano, float v[4])
 {
-	/* to be used for halos en infos */
-	float abs4;
-	short c=0;
+	/* part size (ensure we run RE_parts_clamp first) */
+	BLI_assert(re->partx == min_ii(re->r.tilex, re->rectx));
+	BLI_assert(re->party == min_ii(re->r.tiley, re->recty));
 
 	if (do_pano == FALSE) {
 		return testclip(v);
 	}
+	else {
+		/* to be used for halos en infos */
+		float abs4;
+		short c = 0;
+
+		int xparts = (re->rectx + re->partx - 1) / re->partx;
 
-	abs4= fabs(v[3]);
+		abs4= fabsf(v[3]);
 
-	if (v[2]< -abs4) c=16;		/* this used to be " if (v[2]<0) ", see clippz() */
-	else if (v[2]> abs4) c+= 32;
+		if (v[2]< -abs4) c=16;		/* this used to be " if (v[2]<0) ", see clippz() */
+		else if (v[2]> abs4) c+= 32;
 
-	if ( v[1]>abs4) c+=4;
-	else if ( v[1]< -abs4) c+=8;
+		if ( v[1]>abs4) c+=4;
+		else if ( v[1]< -abs4) c+=8;
 
-	abs4*= re->xparts;
-	if ( v[0]>abs4) c+=2;
-	else if ( v[0]< -abs4) c+=1;
+		abs4*= xparts;
+		if ( v[0]>abs4) c+=2;
+		else if ( v[0]< -abs4) c+=1;
 
-	return c;
+		return c;
+	}
 }
 
 /**
@@ -1356,40 +1363,42 @@ void RE_makeRenderInstances(Render *re)
 	re->instancetable= newlist;
 }
 
-int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4])
+int clip_render_object(float boundbox[][3], float bounds[4], float winmat[][4])
 {
 	float mat[4][4], vec[4];
-	int a, fl, flag= -1;
+	int a, fl, flag = -1;
 
 	copy_m4_m4(mat, winmat);
 
-	for (a=0; a<8; a++) {
+	for (a=0; a < 8; a++) {
 		vec[0]= (a & 1)? boundbox[0][0]: boundbox[1][0];
 		vec[1]= (a & 2)? boundbox[0][1]: boundbox[1][1];
 		vec[2]= (a & 4)? boundbox[0][2]: boundbox[1][2];
 		vec[3]= 1.0;
 		mul_m4_v4(mat, vec);
 
-		fl= 0;
+		fl = 0;
 		if (bounds) {
-			if (vec[0] < bounds[0]*vec[3]) fl |= 1;
-			else if (vec[0] > bounds[1]*vec[3]) fl |= 2;
+			if      (vec[0] < bounds[0] * vec[3]) fl |= 1;
+			else if (vec[0] > bounds[1] * vec[3]) fl |= 2;
 			
-			if (vec[1] > bounds[3]*vec[3]) fl |= 4;
-			else if (vec[1]< bounds[2]*vec[3]) fl |= 8;
+			if      (vec[1] > bounds[3] * vec[3]) fl |= 4;
+			else if (vec[1] < bounds[2] * vec[3]) fl |= 8;
 		}
 		else {
-			if (vec[0] < -vec[3]) fl |= 1;
-			else if (vec[0] > vec[3]) fl |= 2;
+			if      (vec[0] < -vec[3]) fl |= 1;
+			else if (vec[0] >  vec[3]) fl |= 2;
 			
-			if (vec[1] > vec[3]) fl |= 4;
+			if      (vec[1] >  vec[3]) fl |= 4;
 			else if (vec[1] < -vec[3]) fl |= 8;
 		}
-		if (vec[2] < -vec[3]) fl |= 16;
-		else if (vec[2] > vec[3]) fl |= 32;
+		if      (vec[2] < -vec[3]) fl |= 16;
+		else if (vec[2] >  vec[3]) fl |= 32;
 
 		flag &= fl;
-		if (flag==0) return 0;
+		if (flag == 0) {
+			return 0;
+		}
 	}
 
 	return flag;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index bed3fb5..a7f6b40 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -89,7 +89,7 @@ extern struct Render R;
 
 static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *r1)
 {
-	int len4, *rz;	
+	int len4, *rz;
 	int x2, y2;
 	
 	x2= x1+tile;
@@ -159,9 +159,9 @@ static void make_jitter_weight_tab(Render *re, ShadBuf *shb, short filtertype)
 	
 	for (jit= shb->jit, a=0; a<tot; a++, jit+=2) {
 		if (filtertype==LA_SHADBUF_TENT)
-			shb->weight[a]= 0.71f - sqrt(jit[0]*jit[0] + jit[1]*jit[1]);
+			shb->weight[a] = 0.71f - sqrtf(jit[0] * jit[0] + jit[1] * jit[1]);
 		else if (filtertype==LA_SHADBUF_GAUSS)
-			shb->weight[a]= RE_filter_value(R_FILTER_GAUSS, 1.8f*sqrt(jit[0]*jit[0] + jit[1]*jit[1]));
+			shb->weight[a] = RE_filter_value(R_FILTER_GAUSS, 1.8f * sqrtf(jit[0] * jit[0] + jit[1] * jit[1]));
 		else
 			shb->weight[a]= 1.0f;
 		
@@ -217,15 +217,15 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 			if (ds->z == newds->z) {
 				/* still in same z position, simply check
 				 * visibility difference against epsilon */
-				if (!(fabs(newds->v - ds->v) <= epsilon)) {
+				if (!(fabsf(newds->v - ds->v) <= epsilon)) {
 					break;
 				}
 			}
 			else {
 				/* compute slopes */
-				div= (double)0x7FFFFFFF/((double)ds->z - (double)newds->z);
-				min= ((ds->v - epsilon) - newds->v)*div;
-				max= ((ds->v + epsilon) - newds->v)*div;
+				div= (double)0x7FFFFFFF / ((double)ds->z - (double)newds->z);
+				min= (double)((ds->v - epsilon) - newds->v) * div;
+				max= (double)((ds->v + epsilon) - newds->v) * div;
 
 				/* adapt existing slopes */
 				if (first) {
@@ -264,8 +264,8 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 		}
 		else {
 			/* compute visibility at center between slopes at z */
-			slope= (slopemin+slopemax)*0.5f;
-			v= newds->v + slope*((z - newds->z)/(double)0x7FFFFFFF);
+			slope = (slopemin + slopemax) * 0.5;
+			v = (double)newds->v + slope * ((double)(z - newds->z) / (double)0x7FFFFFFF);
 		}
 
 		newds++;
@@ -528,21 +528,21 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 	
 	for (y=0; y<size; y+=16) {
 		if (y< size/2) miny= y+15-size/2;
-		else miny= y-size/2;	
+		else miny= y-size/2;
 		
 		for (x=0; x<size; x+=16) {
 			
 			/* is tile within spotbundle? */
 			a= size/2;
 			if (x< a) minx= x+15-a;
-			else minx= x-a;	
+			else minx= x-a;
 			
 			dist= sqrt( (float)(minx*minx+miny*miny) );
 			
 			if (square==0 && dist>(float)(a+12)) {	/* 12, tested with a onlyshadow lamp */
 				a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */
 				rz1= (&verg)+1;
-			} 
+			}
 			else {
 				copy_to_ztile(rectz, size, x, y, 16, rcline);
 				rz1= (int *)rcline;
@@ -637,7 +637,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 
 	maxtotvert= 0;
 	for (obr=re->objecttable.first; obr; obr=obr->next)
-		maxtotvert= MAX2(obr->totvert, maxtotvert);
+		maxtotvert = max_ii(obr->totvert, maxtotvert);
 
 	clipflag= MEM_callocN(sizeof(char)*maxtotvert, "autoclipflag");
 
@@ -669,8 +669,8 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 				clipflag[vlr->v2->index]= 1;
 				clipflag[vlr->v3->index]= 1;
 				if (vlr->v4) clipflag[vlr->v4->index]= 1;
-			}				
-		}		
+			}
+		}
 		
 		/* calculate min and max */
 		for (a=0; a< obr->totvert;a++) {
@@ -778,7 +778,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
 	 * transforming from observer view to lamp view, including lamp window matrix */
 	
 	angle= saacos(lar->spotsi);
-	temp= 0.5f*shb->size*cos(angle)/sin(angle);
+	temp = 0.5f * shb->size * cosf(angle) / sinf(angle);
 	shb->pixsize= (shb->d)/temp;
 	wsize= shb->pixsize*(shb->size/2.0f);
 	
@@ -856,10 +856,10 @@ void threaded_makeshadowbufs(Render *re)
 			if (lar->shb)
 				totthread++;
 		
-		totthread= MIN2(totthread, re->r.threads);
+		totthread = min_ii(totthread, re->r.threads);
 	}
 	else
-		totthread= 1; /* preview render */
+		totthread = 1; /* preview render */
 
 	if (totthread <= 1) {
 		for (lar=re->lampren.first; lar; lar= lar->next) {
@@ -1394,7 +1394,7 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
 			}
 		}
 		
-		labda = minf(labdax, labday);
+		labda = min_ff(labdax, labday);
 		if (labda==labdao || labda>=1.0f) break;
 		
 		zf= zf1 + labda*(zf2-zf1);
@@ -1663,9 +1663,9 @@ static void bspface_init_strand(BSPFace *face)
 	
 	face->len= face->rc[0]*face->rc[0]+ face->rc[1]*face->rc[1];
 	
-	if (face->len!=0.0f) {
-		face->radline_end= face->radline/sqrt(face->len);
-		face->len= 1.0f/face->len;
+	if (face->len != 0.0f) {
+		face->radline_end = face->radline / sqrtf(face->len);
+		face->len = 1.0f / face->len;
 	}
 }
 
@@ -1867,7 +1867,7 @@ static void isb_bsp_recalc_box(ISBBranch *root)
 		init_box(&root->box);
 		for (a=root->totsamp-1; a>=0; a--)
 			bound_boxf(&root->box, root->samples[a]->zco);
-	}	
+	}
 }
 
 /* callback function for zbuf clip */
@@ -2040,7 +2040,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
 					if (vlr->v4)
 						c4= testclip(hoco[3]); 
 					
-					/* ***** NO WIRE YET */			
+					/* ***** NO WIRE YET */
 					if (ma->material_type == MA_TYPE_WIRE) {
 						if (vlr->v4)
 							zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
@@ -2187,7 +2187,7 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena,
 			}
 			if (bsp_err) break;
 		}
-	}	
+	}
 	
 	MEM_freeN(xcos);
 	MEM_freeN(ycos);
@@ -2394,7 +2394,7 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
 			}
 			if (bsp_err) break;
 		}
-	}	
+	}
 	
 	MEM_freeN(xcos);
 	MEM_freeN(ycos);
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 36e9f4c..db93a21 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -236,7 +236,7 @@ void vlr_set_uv_indices(VlakRen *vlr, int *i1, int *i2, int *i3)
 	/*		1---2		1---2 	0 = orig face, 1 = new face */
 	
 	/* Update vert nums to point to correct verts of original face */
-	if (vlr->flag & R_DIVIDE_24) {  
+	if (vlr->flag & R_DIVIDE_24) {
 		if (vlr->flag & R_FACE_SPLIT) {
 			(*i1)++; (*i2)++; (*i3)++;
 		}
@@ -777,7 +777,7 @@ void shade_input_set_uv(ShadeInput *shi)
 			CLAMP(shi->u, -2.0f, 1.0f);
 			CLAMP(shi->v, -2.0f, 1.0f);
 		}
-	}	
+	}
 }
 
 void shade_input_set_normals(ShadeInput *shi)
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 873657e..597196f 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -57,6 +57,11 @@
 
 #include "shading.h" /* own include */
 
+/* could enable at some point but for now there are far too many conversions */
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
+
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 /* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
 /* only to be used here in this file, it's for speed */
@@ -114,7 +119,7 @@ static void fogcolor(const float colf[3], float *rco, float *view)
 		addAlphaOverFloat(colf, hor);
 		
 		sub_v3_v3(vec, dview);
-	}	
+	}
 }
 #endif
 
@@ -168,7 +173,7 @@ float mistfactor(float zcor, float const co[3])
 		}
 	}
 
-	return (1.0f-fac)* (1.0f-R.wrld.misi);	
+	return (1.0f-fac)* (1.0f-R.wrld.misi);
 }
 
 static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
@@ -228,7 +233,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 		}
 	}
 	
-	/* scale z to make sure volume is normalized */	
+	/* scale z to make sure volume is normalized */
 	nray[2] *= (double)lar->sh_zfac;
 	/* nray does not need normalization */
 	
@@ -314,8 +319,8 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 		
 		/* calculate t0: is the maximum visible z (when halo is intersected by face) */ 
 		if (do_clip) {
-			if (use_yco == FALSE) t0 = (maxz - npos[2]) / nray[2];
-			else t0 = (maxy - npos[1]) / nray[1];
+			if (use_yco == FALSE) t0 = ((double)maxz - npos[2]) / nray[2];
+			else                  t0 = ((double)maxy - npos[1]) / nray[1];
 
 			if (t0 < t1) return;
 			if (t0 < t2) t2= t0;
@@ -468,9 +473,10 @@ static float area_lamp_energy(float (*area)[3], const float co[3], const float v
 
 	/* cross product */
 #define CROSS(dest, a, b) \
-	{ dest[0]= a[1] * b[2] - a[2] * b[1]; \
-	  dest[1]= a[2] * b[0] - a[0] * b[2]; \
-	  dest[2]= a[0] * b[1] - a[1] * b[0]; \
+	{ \
+		dest[0]= a[1] * b[2] - a[2] * b[1]; \
+		dest[1]= a[2] * b[0] - a[0] * b[2]; \
+		dest[2]= a[0] * b[1] - a[1] * b[0]; \
 	} (void)0
 
 	CROSS(cross[0], vec[0], vec[1]);
@@ -547,7 +553,7 @@ static float spec(float inp, int hard)
 	
 	b1= inp*inp;
 	/* avoid FPE */
-	if (b1<0.01f) b1= 0.01f;	
+	if (b1<0.01f) b1= 0.01f;
 	
 	if ((hard & 1)==0)  inp= 1.0f;
 	if (hard & 2)  inp*= b1;
@@ -560,7 +566,7 @@ static float spec(float inp, int hard)
 	b1*= b1;
 
 	/* avoid FPE */
-	if (b1<0.001f) b1= 0.0f;	
+	if (b1<0.001f) b1= 0.0f;
 
 	if (hard & 32) inp*= b1;
 	b1*= b1;
@@ -568,7 +574,7 @@ static float spec(float inp, int hard)
 	b1*= b1;
 	if (hard & 128) inp*=b1;
 
-	if (b1<0.001f) b1= 0.0f;	
+	if (b1<0.001f) b1= 0.0f;
 
 	if (hard & 256) {
 		b1*= b1;
@@ -826,7 +832,7 @@ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float d
 		nv = 0.0f;
 
 	if (darkness <= 1.0f)
-		i = nl * pow(maxf(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
+		i = nl * pow(max_ff(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
 	else
 		i = nl * pow( (1.001f - nv), (darkness  - 1.0f) ); /*Nvidia model*/
 
@@ -1232,7 +1238,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
 							copy_v3_v3(lvrot, lv);
 							mul_m3_v3(lar->imat, lvrot);
 							
-							x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
+							x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
 							/* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
 							
 							inpr= 1.0f/(sqrt(1.0f+x*x));
@@ -1316,7 +1322,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 	if (lar->mode & LA_TEXTURE)	do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
 	if (lar->mode & LA_SHAD_TEX)	do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX);
 
-		/* tangent case; calculate fake face normal, aligned with lampvector */	
+		/* tangent case; calculate fake face normal, aligned with lampvector */
 		/* note, vnor==vn is used as tangent trigger for buffer shadow */
 	if (vlr->flag & R_TANGENT) {
 		float cross[3], nstrand[3], blend;
@@ -1362,7 +1368,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 	/* inp = dotproduct, is = shader result, i = lamp energy (with shadow), i_noshad = i without shadow */
 	inp= dot_v3v3(vn, lv);
 
-	/* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */
+	/* phong threshold to prevent backfacing faces having artifacts on ray shadow (terminator problem) */
 	/* this complex construction screams for a nicer implementation! (ton) */
 	if (R.r.mode & R_SHADOW) {
 		if (ma->mode & MA_SHADOW) {
@@ -1636,7 +1642,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 		}
 	}
 	
-	/* quite disputable this...  also note it doesn't mirror-raytrace */	
+	/* quite disputable this...  also note it doesn't mirror-raytrace */
 	if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
 		float f;
 		
@@ -1844,7 +1850,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 			}
 		}
 		
-		if (shi->combinedflag & SCE_PASS_SHADOW)	
+		if (shi->combinedflag & SCE_PASS_SHADOW)
 			copy_v3_v3(shr->combined, shr->shad); 	/* note, no ';' ! */
 		else
 			copy_v3_v3(shr->combined, shr->diff);
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 9b7a521..6d0e15e 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -307,7 +307,7 @@ ScatterSettings *scatter_settings_new(float refl, float radius, float ior, float
 	ss->Fdr= -1.440f/ior*ior + 0.710f/ior + 0.668f + 0.0636f*ior;
 	ss->A= (1.0f + ss->Fdr)/(1.0f - ss->Fdr);
 	ss->ld= radius;
-	ss->ro= minf(refl, 0.999f);
+	ss->ro= min_ff(refl, 0.999f);
 	ss->color= ss->ro*reflfac + (1.0f-reflfac);
 
 	ss->alpha_= compute_reduced_albedo(ss);
@@ -381,7 +381,7 @@ static void add_radiance(ScatterTree *tree, float *frontrad, float *backrad, flo
 	}
 }
 
-static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int self, ScatterResult *result)
+static void traverse_octree(ScatterTree *tree, ScatterNode *node, const float co[3], int self, ScatterResult *result)
 {
 	float sub[3], dist;
 	int i, index = 0;
@@ -432,7 +432,7 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
 	}
 }
 
-static void compute_radiance(ScatterTree *tree, float *co, float *rad)
+static void compute_radiance(ScatterTree *tree, const float co[3], float *rad)
 {
 	ScatterResult result;
 	float rdsum[3], backrad[3], backrdsum[3];
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index dc3225b..2fe8ada 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -449,6 +449,7 @@ typedef struct StrandPart {
 	int sample;
 	int shadow;
 	float (*jit)[2];
+	int samples;
 
 	StrandSegment *segment;
 	float t[3], s[3];
@@ -545,7 +546,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
 		bufferz= 0x7FFFFFFF;
 		if (spart->rectmask) maskz= 0x7FFFFFFF;
 		
-		if (*rd) {	
+		if (*rd) {
 			for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
 				if (mask & ps->mask) {
 					bufferz= ps->z;
@@ -669,12 +670,8 @@ static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], St
 		float dt= p2->t - p1->t;
 		int a;
 
-		if (re->osa) {
-			for (a=0; a<re->osa; a++)
-				do_scanconvert_strand(re, spart, zspan, t, dt, p1->zco2, p1->zco1, p2->zco1, p2->zco2, a);
-		}
-		else
-			do_scanconvert_strand(re, spart, zspan, t, dt, p1->zco2, p1->zco1, p2->zco1, p2->zco2, 0);
+		for (a=0; a<spart->samples; a++)
+			do_scanconvert_strand(re, spart, zspan, t, dt, p1->zco2, p1->zco1, p2->zco1, p2->zco2, a);
 	}
 	else {
 		float hoco1[4], hoco2[4];
@@ -786,7 +783,7 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
 }
 
 /* render call to fill in strands */
-int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBase *apsmbase, unsigned int lay, int UNUSED(negzmask), float winmat[][4], int winx, int winy, int UNUSED(sample), float (*jit)[2], float clipcrop, int shadow, StrandShadeCache *cache)
+int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBase *apsmbase, unsigned int lay, int UNUSED(negzmask), float winmat[][4], int winx, int winy, int samples, float (*jit)[2], float clipcrop, int shadow, StrandShadeCache *cache)
 {
 	ObjectRen *obr;
 	ObjectInstanceRen *obi;
@@ -820,6 +817,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 	spart.cache= cache;
 	spart.shadow= shadow;
 	spart.jit= jit;
+	spart.samples= samples;
 
 	zbuf_alloc_span(&zspan, pa->rectx, pa->recty, clipcrop);
 
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index 94e94b9..e812b99 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -118,8 +118,8 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi)
 
 /**
  * PerezFunction:
- * compute perez function value based on input paramters
- * */
+ * compute perez function value based on input parameters
+ */
 static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz)
 {
 	float den, num;
@@ -146,7 +146,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta,
  * sun_size, controls sun's size
  * back_scatter, controls back scatter light
  * */
-void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, 
+void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float horizon_brightness,
                 float spread, float sun_brightness, float sun_size, float back_scatter,
                 float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
 {
@@ -217,8 +217,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
 	sunsky->perez_y[3] = -0.04405f * T - 1.65369f;
 	sunsky->perez_y[4] = -0.01092f * T + 0.05291f;
 	
-	/* suggested by glome in 
-	 * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
+	/* suggested by glome in patch [#8063] */
 	sunsky->perez_Y[0] *= sunsky->horizon_brightness;
 	sunsky->perez_x[0] *= sunsky->horizon_brightness;
 	sunsky->perez_y[0] *= sunsky->horizon_brightness;
@@ -330,8 +329,8 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
 
 	int i;
 	float fLambda[3]; 
-	fLambda[0] = 0.65f;	
-	fLambda[1] = 0.57f;	
+	fLambda[0] = 0.65f;
+	fLambda[1] = 0.57f;
 	fLambda[2] = 0.475f;
 
 	fAlpha = 1.3f;
diff --git a/source/blender/render/intern/source/texture_ocean.c b/source/blender/render/intern/source/texture_ocean.c
index b2bc635..a754747 100644
--- a/source/blender/render/intern/source/texture_ocean.c
+++ b/source/blender/render/intern/source/texture_ocean.c
@@ -55,7 +55,7 @@ extern struct Render R;
 
 
 /* ***** actual texture sampling ***** */
-int ocean_texture(Tex *tex, float *texvec, TexResult *texres)
+int ocean_texture(Tex *tex, const float texvec[2], TexResult *texres)
 {
 	OceanTex *ot = tex->ot;
 	ModifierData *md;
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index 8a92695..8757be7 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -92,7 +92,7 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
 }
 
 /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */
-static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co)
+static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), const float co[3])
 {
 	Isect isect= {{0}};
 	float dir[3] = {0.0f, 0.0f, 1.0f};
@@ -118,7 +118,7 @@ static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), flo
 }
 
 /* find the bounding box of an objectinstance in global space */
-void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *bbmax)
+void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float bbmin[3], float bbmax[3])
 {
 	ObjectRen *obr = obi->obr;
 	VolumePrecache *vp = obi->volume_precache;
@@ -270,7 +270,7 @@ BLI_INLINE int ms_I(int x, int y, int z, int *n) /* has a pad of 1 voxel surroun
 BLI_INLINE int v_I_pad(int x, int y, int z, int *n) /* has a pad of 1 voxel surrounding the core for boundary simulation */
 {
 	/* same ordering to light cache, with padding */
-	return z*(n[1]+2)*(n[0]+2) + y*(n[0]+2) + x;  	
+	return z*(n[1]+2)*(n[0]+2) + y*(n[0]+2) + x;
 }
 
 BLI_INLINE int lc_to_ms_I(int x, int y, int z, int *n)
@@ -389,7 +389,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
 					const int j = ms_I(x, y, z, n);			//ms index
 					
 					time= PIL_check_seconds_timer();
-					c++;										
+					c++;
 					if (vp->data_r[i] > 0.0f)
 						sr[j] += vp->data_r[i];
 					if (vp->data_g[i] > 0.0f)
@@ -826,7 +826,7 @@ void free_volume_precache(Render *re)
 	BLI_freelistN(&re->volumes);
 }
 
-int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co)
+int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, const float co[3])
 {
 	RayObject *tree;
 	int inside=0;
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 220fcd3..fe4cff7 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -76,7 +76,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
 	if (lar->shb) {
 		float dxco[3] = {0.f, 0.f, 0.f}, dyco[3] = {0.f, 0.f, 0.f};
 		
-		visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0);		
+		visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0);
 	}
 	else if (lar->mode & LA_SHAD_RAY) {
 		/* trace shadow manually, no good lamp api atm */
@@ -205,7 +205,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f
 	else {
 		shadeSkyView(col_r, co, shi->view, NULL, shi->thread);
 		shadeSunView(col_r, shi->view);
-	} 
+	}
 }
 
 
@@ -221,7 +221,7 @@ static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float scat
 	/* find sample point in global space bounding box 0.0-1.0 */
 	global_bounds_obi(re, shi->obi, bbmin, bbmax);
 	sub_v3_v3v3(dim, bbmax, bbmin);
-	mul_v3_m4v3(world_co, re->viewinv, co);	
+	mul_v3_m4v3(world_co, re->viewinv, co);
 
 	/* sample_co in 0.0-1.0 */
 	sample_co[0] = (world_co[0] - bbmin[0]) / dim[0];
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index d731716..77d6644 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -157,10 +157,10 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
 
 	/* find the first valid ibuf and use it to initialize the resolution of the data set */
 	/* need to do this in advance so we know how much memory to allocate */
-	ibuf = BKE_image_get_ibuf(ima, &iuser);
+	ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
 	while (!ibuf && (iuser.framenr < iuser.frames)) {
 		iuser.framenr++;
-		ibuf = BKE_image_get_ibuf(ima, &iuser);
+		ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
 	}
 	if (!ibuf) return;
 	if (!ibuf->rect_float) IMB_float_from_rect(ibuf);
@@ -175,7 +175,8 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
 		/* get a new ibuf for each frame */
 		if (z > 0) {
 			iuser.framenr++;
-			ibuf = BKE_image_get_ibuf(ima, &iuser);
+			BKE_image_release_ibuf(ima, ibuf, NULL);
+			ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
 			if (!ibuf) break;
 			if (!ibuf->rect_float) IMB_float_from_rect(ibuf);
 		}
@@ -191,7 +192,9 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
 		
 		BKE_image_free_anim_ibufs(ima, iuser.framenr);
 	}
-	
+
+	BKE_image_release_ibuf(ima, ibuf, NULL);
+
 	vd->ok = 1;
 	return;
 }
@@ -227,69 +230,102 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
 	/* draw code for smoke */
 	if ((md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke))) {
 		SmokeModifierData *smd = (SmokeModifierData *)md;
-
+		SmokeDomainSettings *sds = smd->domain;
 		
-		if (smd->domain && smd->domain->fluid) {
-			if (cfra < smd->domain->point_cache[0]->startframe)
+		if (sds && sds->fluid) {
+			if (cfra < sds->point_cache[0]->startframe)
 				;  /* don't show smoke before simulation starts, this could be made an option in the future */
 			else if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
 				size_t totRes;
 				size_t i;
 				float *heat;
 
-				copy_v3_v3_int(vd->resol, smd->domain->res);
-				totRes = vd_resol_size(vd);
+				if (!smoke_has_heat(sds->fluid)) return;
 
-				/* scaling heat values from -2.0-2.0 to 0.0-1.0 */
+				copy_v3_v3_int(vd->resol, sds->res);
+				totRes = vd_resol_size(vd);
 				vd->dataset = MEM_mapallocN(sizeof(float) * (totRes), "smoke data");
+				/* get heat data */
+				heat = smoke_get_heat(sds->fluid);
 
-
-				heat = smoke_get_heat(smd->domain->fluid);
-
+				/* scale heat values from -2.0-2.0 to 0.0-1.0 */
 				for (i = 0; i < totRes; i++) {
 					vd->dataset[i] = (heat[i] + 2.0f) / 4.0f;
 				}
-
-				/* vd->dataset = smoke_get_heat(smd->domain->fluid); */
 			}
 			else if (vd->smoked_type == TEX_VD_SMOKEVEL) {
 				size_t totRes;
 				size_t i;
 				float *xvel, *yvel, *zvel;
 
-				copy_v3_v3_int(vd->resol, smd->domain->res);
+				copy_v3_v3_int(vd->resol, sds->res);
 				totRes = vd_resol_size(vd);
-
-				/* scaling heat values from -2.0-2.0 to 0.0-1.0 */
 				vd->dataset = MEM_mapallocN(sizeof(float) * (totRes), "smoke data");
+				/* get velocity data */
+				xvel = smoke_get_velocity_x(sds->fluid);
+				yvel = smoke_get_velocity_y(sds->fluid);
+				zvel = smoke_get_velocity_z(sds->fluid);
 
-				xvel = smoke_get_velocity_x(smd->domain->fluid);
-				yvel = smoke_get_velocity_y(smd->domain->fluid);
-				zvel = smoke_get_velocity_z(smd->domain->fluid);
-
+				/* map velocities between 0 and 0.3f */
 				for (i = 0; i < totRes; i++) {
-					vd->dataset[i] = sqrt(xvel[i] * xvel[i] + yvel[i] * yvel[i] + zvel[i] * zvel[i]) * 3.0f;
+					vd->dataset[i] = sqrtf(xvel[i] * xvel[i] + yvel[i] * yvel[i] + zvel[i] * zvel[i]) * 3.0f;
 				}
 
 			}
-			else {
+			else if (vd->smoked_type == TEX_VD_SMOKEFLAME) {
 				size_t totRes;
-				float *density;
+				float *flame;
 
-				if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
-					smoke_turbulence_get_res(smd->domain->wt, vd->resol);
-					density = smoke_turbulence_get_density(smd->domain->wt);
+				if (sds->flags & MOD_SMOKE_HIGHRES) {
+					if (!smoke_turbulence_has_fuel(sds->wt)) return;
+					smoke_turbulence_get_res(sds->wt, vd->resol);
+					flame = smoke_turbulence_get_flame(sds->wt);
 				}
 				else {
-					copy_v3_v3_int(vd->resol, smd->domain->res);
-					density = smoke_get_density(smd->domain->fluid);
+					if (!smoke_has_fuel(sds->fluid)) return;
+					copy_v3_v3_int(vd->resol, sds->res);
+					flame = smoke_get_flame(sds->fluid);
 				}
 
-				/* TODO: is_vd_res_ok(rvd) doesnt check this resolution */
+				/* always store copy, as smoke internal data can change */
 				totRes = vd_resol_size(vd);
+				vd->dataset = MEM_mapallocN(sizeof(float)*(totRes), "smoke data");
+				memcpy(vd->dataset, flame, sizeof(float)*totRes);
+			}
+			else {
+				size_t totCells;
+				int depth = 4;
+				vd->data_type = TEX_VD_RGBA_PREMUL;
+
+				/* data resolution */
+				if (sds->flags & MOD_SMOKE_HIGHRES) {
+					smoke_turbulence_get_res(sds->wt, vd->resol);
+				}
+				else {
+					copy_v3_v3_int(vd->resol, sds->res);
+				}
+
+				/* TODO: is_vd_res_ok(rvd) doesnt check this resolution */
+				totCells = vd_resol_size(vd) * depth;
 				/* always store copy, as smoke internal data can change */
-				vd->dataset = MEM_mapallocN(sizeof(float) * (totRes), "smoke data");
-				memcpy(vd->dataset, density, sizeof(float) * totRes);
+				vd->dataset = MEM_mapallocN(sizeof(float) * totCells, "smoke data");
+
+				if (sds->flags & MOD_SMOKE_HIGHRES) {
+					if (smoke_turbulence_has_colors(sds->wt)) {
+						smoke_turbulence_get_rgba(sds->wt, vd->dataset, 1);
+					}
+					else {
+						smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, vd->dataset, 1);
+					}
+				}
+				else {
+					if (smoke_has_colors(sds->fluid)) {
+						smoke_get_rgba(sds->fluid, vd->dataset, 1);
+					}
+					else {
+						smoke_get_rgba_from_density(sds->fluid, sds->active_color, vd->dataset, 1);
+					}
+				}
 			}  /* end of fluid condition */
 		}
 	}
@@ -320,6 +356,8 @@ void cache_voxeldata(Tex *tex, int scene_frame)
 		MEM_freeN(vd->dataset);
 		vd->dataset = NULL;
 	}
+	/* reset data_type */
+	vd->data_type = TEX_VD_INTENSITY;
 
 	if (vd->flag & TEX_VD_STILL)
 		curframe = vd->still_frame;
@@ -379,9 +417,11 @@ void make_voxeldata(struct Render *re)
 
 int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres)
 {	 
-	int retval = TEX_INT;
-	VoxelData *vd = tex->vd;	
-	float co[3], offset[3] = {0.5, 0.5, 0.5};
+	VoxelData *vd = tex->vd;
+	float co[3], offset[3] = {0.5, 0.5, 0.5}, a;
+	int retval = (vd->data_type == TEX_VD_RGBA_PREMUL) ? TEX_RGB : TEX_INT;
+	int depth = (vd->data_type == TEX_VD_RGBA_PREMUL) ? 4 : 1;
+	int ch;
 
 	if (vd->dataset == NULL) {
 		texres->tin = 0.0f;
@@ -420,31 +460,63 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre
 			break;
 		}
 	}
-	
-	switch (vd->interp_type) {
-		case TEX_VD_NEARESTNEIGHBOR:
-			texres->tin = BLI_voxel_sample_nearest(vd->dataset, vd->resol, co);
-			break;  
-		case TEX_VD_LINEAR:
-			texres->tin = BLI_voxel_sample_trilinear(vd->dataset, vd->resol, co);
-			break;					
-		case TEX_VD_QUADRATIC:
-			texres->tin = BLI_voxel_sample_triquadratic(vd->dataset, vd->resol, co);
-			break;
-		case TEX_VD_TRICUBIC_CATROM:
-		case TEX_VD_TRICUBIC_BSPLINE:
-			texres->tin = BLI_voxel_sample_tricubic(vd->dataset, vd->resol, co, (vd->interp_type == TEX_VD_TRICUBIC_BSPLINE));
-			break;
+
+	for (ch = 0; ch < depth; ch++) {
+		float *dataset = vd->dataset + ch*vd->resol[0]*vd->resol[1]*vd->resol[2];
+		float *result = &texres->tin;
+
+		if (vd->data_type == TEX_VD_RGBA_PREMUL) {
+			switch (ch) {
+				case 0:
+					result = &texres->tr;
+					break;
+				case 1:
+					result = &texres->tg;
+					break;
+				case 2:
+					result = &texres->tb;
+					break;
+			}
+		}
+
+		switch (vd->interp_type) {
+			case TEX_VD_NEARESTNEIGHBOR:
+				*result = BLI_voxel_sample_nearest(dataset, vd->resol, co);
+				break;  
+			case TEX_VD_LINEAR:
+				*result = BLI_voxel_sample_trilinear(dataset, vd->resol, co);
+				break;
+			case TEX_VD_QUADRATIC:
+				*result = BLI_voxel_sample_triquadratic(dataset, vd->resol, co);
+				break;
+			case TEX_VD_TRICUBIC_CATROM:
+			case TEX_VD_TRICUBIC_BSPLINE:
+				*result = BLI_voxel_sample_tricubic(dataset, vd->resol, co, (vd->interp_type == TEX_VD_TRICUBIC_BSPLINE));
+				break;
+		}
 	}
-	
+
+	a = texres->tin;
 	texres->tin *= vd->int_multiplier;
 	BRICONT;
 	
-	texres->tr = texres->tin;
-	texres->tg = texres->tin;
-	texres->tb = texres->tin;
+	if (vd->data_type == TEX_VD_RGBA_PREMUL) {
+		/* unmultiply */
+		if (a>0.001f) {
+			texres->tr /= a;
+			texres->tg /= a;
+			texres->tb /= a;
+		}
+		texres->talpha = 1;
+	}
+	else {
+		texres->tr = texres->tin;
+		texres->tg = texres->tin;
+		texres->tb = texres->tin;
+	}
+
 	texres->ta = texres->tin;
 	BRICONTRGB;
 	
-	return retval;	
+	return retval;
 }
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index ba62baa..c52fb84 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -76,6 +76,11 @@
 /* own includes */
 #include "zbuf.h"
 
+/* could enable at some point but for now there are far too many conversions */
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
+
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 /* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
 /* only to be used here in this file, it's for speed */
@@ -150,7 +155,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
 	}
 	else {
 		dx0 = 0.0f;
-		xs0 = minf(minv[0], maxv[0]);
+		xs0 = min_ff(minv[0], maxv[0]);
 	}
 	
 	/* empty span */
@@ -409,7 +414,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr,
 							if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
 							if (apn->next==NULL) apn->next= addpsA(zspan);
 							apn= apn->next;
-						}				
+						}
 					}
 				}
 				zverg+= zxd;
@@ -501,7 +506,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
 							if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
 							if (apn->next==0) apn->next= addpsA(zspan);
 							apn= apn->next;
-						}				
+						}
 					}
 				}
 			}
@@ -572,7 +577,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
 							if (apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
 							if (apn->next==0) apn->next= addpsA(zspan);
 							apn= apn->next;
-						}	
+						}
 					}
 				}
 			}
@@ -1029,7 +1034,7 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
 
 /**
  * Fill the z buffer, but invert z order, and add the face index to
- * the corresponing face buffer.
+ * the corresponding face buffer.
  *
  * This is one of the z buffer fill functions called in zbufclip() and
  * zbufwireclip(). 
@@ -1624,7 +1629,7 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
 	else {
 		dw= clipcrop*(v2[3]-v1[3]);
 		v13= clipcrop*v1[3];
-	}	
+	}
 	/* according the original article by Liang&Barsky, for clipping of
 	 * homogeneous coordinates with viewplane, the value of "0" is used instead of "-w" .
 	 * This differs from the other clipping cases (like left or top) and I considered
@@ -1682,7 +1687,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
 			adr[1]= v1[1]+l1*(v2[1]-v1[1]);
 			adr[2]= v1[2]+l1*(v2[2]-v1[2]);
 			adr[3]= v1[3]+l1*(v2[3]-v1[3]);
-		} 
+		}
 		else trias[*b1]= v1;
 		
 		(*b1)++;
@@ -2022,7 +2027,7 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
 					EXTEND_PIXEL(row1 + 2);
 					EXTEND_PIXEL(row2 + 2);
 					EXTEND_PIXEL(row3 + 2);
-				}					
+				}
 				if (tot) {
 					len++;
 					curz[0]= (int)(z/(float)tot);
@@ -2047,7 +2052,7 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
 			if (rectp[len]==0) {
 				rectz[len] = -0x7FFFFFFF;
 				rectp[len]= -1;	/* env code */
-			}	
+			}
 		}
 	}
 }
@@ -2732,7 +2737,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 			x= sn2-sn1;
 			
 			while (x>=0) {
-				if ( zverg < *rz) {
+				if (zverg < (double)*rz) {
 					*rz= zverg;
 					*rp= *col;
 				}
@@ -3233,7 +3238,7 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
 			
 			*rza= 0x7FFFFFFF;
 			if (rectmask) *rma= 0x7FFFFFFF;
-			if (*rd) {	
+			if (*rd) {
 				/* when there's a sky pixstruct, fill in sky-Z, otherwise solid Z */
 				for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
 					if (sample & ps->mask) {
@@ -3517,7 +3522,7 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob)
 	RenderPass *rpass;
 	
 	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
-		if (rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) {
+		if (rpass->passtype == SCE_PASS_INDEXOB) {
 			float *fp= rpass->rect + offset;
 			*fp= (float)ob->index;
 			break;
@@ -3525,6 +3530,19 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob)
 	}
 }
 
+static void add_transp_material_index(RenderLayer *rl, int offset, Material *mat)
+{
+	RenderPass *rpass;
+	
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+		if (rpass->passtype == SCE_PASS_INDEXMA) {
+			float *fp= rpass->rect + offset;
+			*fp= (float)mat->index;
+			break;
+		}
+	}
+}
+
 /* ONLY OSA! merge all shaderesult samples to one */
 /* target should have been cleared */
 static void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
@@ -3876,7 +3894,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
 				
 				addAlphaUnderFloat(samp_shr->combined, shr->combined);
 				
-				samp_shr->z = minf(samp_shr->z, shr->z);
+				samp_shr->z = min_ff(samp_shr->z, shr->z);
 
 				if (addpassflag & SCE_PASS_VECTOR) {
 					copy_v4_v4(samp_shr->winspeed, shr->winspeed);
@@ -4129,10 +4147,12 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 					}
 				}
 				if (addpassflag & SCE_PASS_INDEXMA) {
-					ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
-					if (obr->ob) {
+					ObjectRen *obr = R.objectinstance[zrow[totface-1].obi].obr;
+					VlakRen *vr = obr->vlaknodes->vlak;
+					Material *mat = vr->mat;
+					if (mat) {
 						for (a= 0; a<totfullsample; a++)
-							add_transp_obindex(rlpp[a], od, obr->ob);
+							add_transp_material_index(rlpp[a], od, mat);
 					}
 				}
 
@@ -4243,7 +4263,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 		MEM_freeN(APixbufstrand);
 	if (sscache)
 		strand_shade_cache_free(sscache);
-	freepsA(&apsmbase);	
+	freepsA(&apsmbase);
 
 	if (R.r.mode & R_SHADOW)
 		ISB_free(pa);
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index e678212..65a8945 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -29,6 +29,7 @@ set(INC
 	../blenkernel
 	../blenlib
 	../blenloader
+	../compositor
 	../editors/include
 	../editors/io
 	../gpu
@@ -36,7 +37,6 @@ set(INC
 	../makesdna
 	../makesrna
 	../nodes
-	../compositor
 	../render/extern/include
 	../../gameengine/BlenderRoutines
 	../../../intern/elbeem/extern
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index e7b7f67..8d885bf 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -106,7 +106,7 @@ int			WM_homefile_read_exec(struct bContext *C, struct wmOperator *op);
 int			WM_homefile_read(struct bContext *C, struct ReportList *reports, short from_memory);
 int			WM_homefile_write_exec(struct bContext *C, struct wmOperator *op);
 void		WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
-int			WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy);
+int			WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports);
 void		WM_autosave_init(struct wmWindowManager *wm);
 
 			/* mouse cursors */
@@ -171,6 +171,7 @@ void		WM_event_timer_sleep(struct wmWindowManager *wm, struct wmWindow *win, str
 
 		/* operator api, default callbacks */
 			/* invoke callback, uses enum property named "type" */
+int			WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int			WM_menu_invoke			(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int			WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 			/* invoke callback, confirm menu + exec */
@@ -181,6 +182,7 @@ int         WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imt
 			/* poll callback, context checks */
 int			WM_operator_winactive	(struct bContext *C);
 			/* invoke callback, exec + redo popup */
+int			WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int			WM_operator_props_popup	(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int 		WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height);
 int			WM_operator_redo_popup	(struct bContext *C, struct wmOperator *op);
@@ -214,6 +216,7 @@ int			WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short c
 
 void		WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
 void		WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context); /* make props context sensitive or not */
+int         WM_operator_properties_default(struct PointerRNA *ptr, const int do_update);
 void        WM_operator_properties_reset(struct wmOperator *op);
 void		WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
 void		WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
@@ -319,9 +322,9 @@ enum {
 	WM_JOB_SUSPEND      = (1 << 3)
 };
 
-/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change (keep 0 for 'any') */
 enum {
-	WM_JOB_TYPE_ANY = -1,
+	WM_JOB_TYPE_ANY = 0,
 	WM_JOB_TYPE_COMPOSITE,
 	WM_JOB_TYPE_RENDER,
 	WM_JOB_TYPE_RENDER_PREVIEW,  /* UI preview */
@@ -357,7 +360,9 @@ void        WM_jobs_callbacks(struct wmJob *,
 void		WM_jobs_start(struct wmWindowManager *wm, struct wmJob *);
 void		WM_jobs_stop(struct wmWindowManager *wm, void *owner, void *startjob);
 void		WM_jobs_kill(struct wmWindowManager *wm, void *owner, void (*)(void *, short int *, short int *, float *));
-void		WM_jobs_stop_all(struct wmWindowManager *wm);
+void		WM_jobs_kill_all(struct wmWindowManager *wm);
+void		WM_jobs_kill_all_except(struct wmWindowManager *wm, void *owner);
+void		WM_jobs_kill_type(struct wmWindowManager *wm, int job_type);
 
 int			WM_jobs_has_running(struct wmWindowManager *wm);
 
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 5c88bab..4336915 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -43,7 +43,7 @@ struct EnumPropertyItem;
 
 wmKeyConfig *WM_keyconfig_new	(struct wmWindowManager *wm, const char *idname);
 wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, const char *idname);
-void 		WM_keyconfig_remove	(struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
+int         WM_keyconfig_remove	(struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
 void 		WM_keyconfig_free	(struct wmKeyConfig *keyconf);
 
 void		WM_keyconfig_set_active(struct wmWindowManager *wm, const char *idname);
@@ -63,8 +63,8 @@ wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, in
 wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
                                  int val, int modifier, int keymodifier);
 
-void		WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
-char		 *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
+int			WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
+char		*WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
 
 wmKeyMap	*WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
 wmKeyMap	*WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index ad828ce..347f46c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -300,6 +300,7 @@ typedef struct wmNotifier {
 	/* NC_MATERIAL Material */
 #define	ND_SHADING			(30<<16)
 #define	ND_SHADING_DRAW		(31<<16)
+#define	ND_SHADING_LINKS	(32<<16)
 
 	/* NC_LAMP Lamp */
 #define	ND_LIGHTING			(40<<16)
@@ -326,6 +327,7 @@ typedef struct wmNotifier {
 	/* Mesh, Curve, MetaBall, Armature, .. */
 #define ND_SELECT			(90<<16)
 #define ND_DATA				(91<<16)
+#define ND_VERTEX_GROUP		(92<<16)
 
 	/* NC_NODE Nodes */
 
@@ -424,7 +426,7 @@ typedef struct wmEvent {
 	char ascii;			/* from ghost, fallback if utf8 isn't set */
 	char pad;
 
-	/* previous state */
+	/* previous state, used for double click and the 'click' */
 	short prevtype;
 	short prevval;
 	int prevx, prevy;
@@ -435,7 +437,8 @@ typedef struct wmEvent {
 	short shift, ctrl, alt, oskey;	/* oskey is apple or windowskey, value denotes order of pressed */
 	short keymodifier;				/* rawkey modifier */
 	
-	short pad1;
+	/* set in case a KM_PRESS went by unhandled */
+	short check_click;
 	
 	/* keymap item, set by handler (weak?) */
 	const char *keymap_idname;
@@ -539,7 +542,11 @@ typedef struct wmOperatorType {
 
 	/* verify if the operator can be executed in the current context, note
 	 * that the operator might still fail to execute even if this return true */
-	int (*poll)(struct bContext *);
+	int (*poll)(struct bContext *)
+#ifdef __GNUC__
+	__attribute__((warn_unused_result))
+#endif
+	;
 
 	/* optional panel for redo and repeat, autogenerated if not set */
 	void (*ui)(struct bContext *, struct wmOperator *);
@@ -550,8 +557,8 @@ typedef struct wmOperatorType {
 	/* previous settings - for initializing on re-use */
 	struct IDProperty *last_properties;
 
-	/* rna property to use for generic invoke functions.
-	 * menus, enum search... etc */
+	/* Default rna property to use for generic invoke functions.
+	 * menus, enum search... etc. Example: Enum 'type' for a Delete menu */
 	PropertyRNA *prop;
 
 	/* struct wmOperatorTypeMacro */
@@ -563,7 +570,11 @@ typedef struct wmOperatorType {
 	/* only used for operators defined with python
 	 * use to store pointers to python functions */
 	void *pyop_data;
-	int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot);
+	int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot)
+#ifdef __GNUC__
+	__attribute__((warn_unused_result))
+#endif
+	;
 
 	/* RNA integration */
 	ExtensionRNA ext;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index a34d294..8fe3877 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -78,7 +78,7 @@ void WM_operator_free(wmOperator *op)
 	if (op->py_instance) {
 		/* do this first in case there are any __del__ functions or
 		 * similar that use properties */
-		BPY_DECREF(op->py_instance);
+		BPY_DECREF_RNA_INVALIDATE(op->py_instance);
 	}
 #endif
 
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 7853b40..ebde640 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -61,7 +61,7 @@ static GHOST_TStandardCursor convert_cursor(int curs)
 		case CURSOR_FACESEL:    return GHOST_kStandardCursorRightArrow;
 		case CURSOR_WAIT:       return GHOST_kStandardCursorWait;
 		case CURSOR_EDIT:       return GHOST_kStandardCursorCrosshair;
-		case CURSOR_HELP:		
+		case CURSOR_HELP:
 #ifdef __APPLE__
 			return GHOST_kStandardCursorLeftRight;
 #else
@@ -317,7 +317,7 @@ void WM_cursor_time(wmWindow *win, int nr)
 /* Because defining a cursor mixes declarations and executable code
  * each cursor needs it's own scoping block or it would be split up
  * over several hundred lines of code.  To enforce/document this better
- * I define 2 pretty braindead macros so it's obvious what the extra "[]"
+ * I define 2 pretty brain-dead macros so it's obvious what the extra "[]"
  * are for */
 
 #define BEGIN_CURSOR_BLOCK {
@@ -560,7 +560,7 @@ BEGIN_CURSOR_BLOCK
 	BlenderCursor[BC_CROSSCURSOR] = &CrossCursor;
 END_CURSOR_BLOCK
 
-	/********************** EditCross Cursor ***********************/	
+	/********************** EditCross Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 	static char editcross_sbm[] = {
 		0x0e,  0x00,  0x11,  0x00,  0x1d,  0x00,  0x19,  0x03,
@@ -775,7 +775,7 @@ BEGIN_CURSOR_BLOCK
 END_CURSOR_BLOCK
 	
 
-	/********************** TextEdit Cursor ***********************/	
+	/********************** TextEdit Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 	static char textedit_sbm[] = {
 		0xe0,  0x03,  0x10,  0x04,  0x60,  0x03,  0x40,  0x01,
@@ -808,7 +808,7 @@ BEGIN_CURSOR_BLOCK
 END_CURSOR_BLOCK
 
 
-	/********************** Paintbrush Cursor ***********************/	
+	/********************** Paintbrush Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 	static char paintbrush_sbm[] = {
 
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index bbb2a54..0581000 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -141,7 +141,7 @@ void wm_dropbox_free(void)
 		BLI_freelistN(&dm->dropboxes);
 	}
 	
-	BLI_freelistN(&dropboxes);		
+	BLI_freelistN(&dropboxes);
 }
 
 /* *********************************** */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 66bb321..a92ed65 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -84,7 +84,7 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
 		bScreen *screen = win->screen;
 		wmPaintCursor *pc;
 
-		if (screen->subwinactive == ar->swinid) {
+		if (ar->swinid && screen->subwinactive == ar->swinid) {
 			for (pc = wm->paintcursors.first; pc; pc = pc->next) {
 				if (pc->poll == NULL || pc->poll(C)) {
 					ARegion *ar_other = CTX_wm_region(C);
@@ -631,7 +631,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
 	if (paintcursor && wm->paintcursors.first) {
 		for (sa = screen->areabase.first; sa; sa = sa->next) {
 			for (ar = sa->regionbase.first; ar; ar = ar->next) {
-				if (ar->swinid == screen->subwinactive) {
+				if (ar->swinid && ar->swinid == screen->subwinactive) {
 					CTX_wm_area_set(C, sa);
 					CTX_wm_region_set(C, ar);
 
@@ -711,12 +711,14 @@ static int wm_automatic_draw_method(wmWindow *win)
 		if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
 			return USER_DRAW_OVERLAP;
 		/* also Intel drivers are slow */
+#if 0	/* 2.64 BCon3 period, let's try if intel now works... */
 		else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY))
 			return USER_DRAW_OVERLAP;
 		else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY))
 			return USER_DRAW_OVERLAP_FLIP;
 		else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY))
 			return USER_DRAW_OVERLAP_FLIP;
+#endif
 		/* Windows software driver darkens color on each redraw */
 		else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
 			return USER_DRAW_OVERLAP_FLIP;
@@ -751,6 +753,15 @@ void wm_draw_update(bContext *C)
 	GPU_free_unused_buffers();
 	
 	for (win = wm->windows.first; win; win = win->next) {
+		int state = GHOST_GetWindowState(win->ghostwin);;
+
+		if (state == GHOST_kWindowStateMinimized) {
+			/* do not update minimized windows, it gives issues on intel drivers (see [#33223])
+			 * anyway, it seems logical to skip update for invisile windows
+			 */
+			continue;
+		}
+
 		if (win->drawmethod != U.wmdrawmethod) {
 			wm_draw_window_clear(win);
 			win->drawmethod = U.wmdrawmethod;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ef9e25e..c0e3b19 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -135,6 +135,7 @@ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, vo
 /* XXX: in future, which notifiers to send to other windows? */
 void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference)
 {
+	ARegion *ar;
 	wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier");
 	
 	note->wm = CTX_wm_manager(C);
@@ -142,8 +143,9 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
 	
 	note->window = CTX_wm_window(C);
 	
-	if (CTX_wm_region(C))
-		note->swinid = CTX_wm_region(C)->swinid;
+	ar = CTX_wm_region(C);
+	if (ar)
+		note->swinid = ar->swinid;
 	
 	note->category = type & NOTE_CATEGORY;
 	note->data = type & NOTE_DATA;
@@ -339,6 +341,11 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
 	int is_wheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
 	int retval;
 	
+	/* UI code doesn't handle return values - it just always returns break. 
+	 * to make the DBL_CLICK conversion work, we just don't send this to UI */
+	if (event->val == KM_DBL_CLICK)
+		return WM_HANDLER_CONTINUE;
+	
 	/* UI is quite aggressive with swallowing events, like scrollwheel */
 	/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
 	if (do_wheel_ui == FALSE) {
@@ -447,10 +454,10 @@ void WM_event_print(wmEvent *event)
 		RNA_enum_identifier(event_type_items, event->type, &type_id);
 		RNA_enum_identifier(event_value_items, event->val, &val_id);
 
-		printf("wmEvent - type:%d/%s, val:%d/%s, "
-		       "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, "
-		       "mouse:(%d,%d), ascii:'%c', utf8:'%.*s', "
-		       "keymap_idname:%s, pointer:%p\n",
+		printf("wmEvent  type:%d / %s, val:%d / %s, \n"
+		       "         shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, \n"
+		       "         mouse:(%d,%d), ascii:'%c', utf8:'%.*s', "
+		       "         keymap_idname:%s, pointer:%p\n",
 		       event->type, type_id, event->val, val_id,
 		       event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier,
 		       event->x, event->y, event->ascii,
@@ -848,7 +855,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
 			WM_operator_last_properties_init(op);
 		}
 
-		if ((G.debug & G_DEBUG_EVENTS) && event && event->type != MOUSEMOVE) {
+		if ((G.debug & G_DEBUG_HANDLERS) && event && event->type != MOUSEMOVE) {
 			printf("%s: handle evt %d win %d op %s\n",
 			       __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
 		}
@@ -887,8 +894,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
 			wm_operator_reports(C, op, retval, (reports != NULL));
 		}
 
-		if (retval & OPERATOR_HANDLED)
-			;  /* do nothing, wm_operator_exec() has been called somewhere */
+		if (retval & OPERATOR_HANDLED) {
+			/* do nothing, wm_operator_exec() has been called somewhere */
+		}
 		else if (retval & OPERATOR_FINISHED) {
 			if (!is_nested_call) { /* not called by py script */
 				WM_operator_last_properties_store(op);
@@ -1273,49 +1281,6 @@ int WM_userdef_event_map(int kmitype)
 	return kmitype;
 }
 
-static void wm_eventemulation(wmEvent *event)
-{
-	static int mmb_emulated = 0; /* this should be in a data structure somwhere */
-	
-	/* middlemouse emulation */
-	if (U.flag & USER_TWOBUTTONMOUSE) {
-		if (event->type == LEFTMOUSE && (event->alt || mmb_emulated == KM_PRESS)) {
-			event->type = MIDDLEMOUSE;
-			event->alt = 0;
-			mmb_emulated = event->val;
-		}
-	}
-
-#ifdef __APPLE__
-	/* rightmouse emulation */
-	if (U.flag & USER_TWOBUTTONMOUSE) {
-		if (event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS)) {
-			event->type = RIGHTMOUSE;
-			event->oskey = 0;
-			mmb_emulated = event->val;
-		}
-	}
-#endif
-
-	/* numpad emulation */
-	if (U.flag & USER_NONUMPAD) {
-		switch (event->type) {
-			case ZEROKEY: event->type = PAD0; break;
-			case ONEKEY: event->type = PAD1; break;
-			case TWOKEY: event->type = PAD2; break;
-			case THREEKEY: event->type = PAD3; break;
-			case FOURKEY: event->type = PAD4; break;
-			case FIVEKEY: event->type = PAD5; break;
-			case SIXKEY: event->type = PAD6; break;
-			case SEVENKEY: event->type = PAD7; break;
-			case EIGHTKEY: event->type = PAD8; break;
-			case NINEKEY: event->type = PAD9; break;
-			case MINUSKEY: event->type = PADMINUS; break;
-			case EQUALKEY: event->type = PADPLUSKEY; break;
-			case BACKSLASHKEY: event->type = PADSLASHKEY; break;
-		}
-	}
-}
 
 static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 {
@@ -1325,7 +1290,12 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 
 	/* the matching rules */
 	if (kmitype == KM_TEXTINPUT)
-		if (ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
+		if (winevent->val == KM_PRESS) {  /* prevent double clicks */
+			/* NOT using ISTEXTINPUT anymore because (at least on Windows) some key codes above 255
+			 * could have printable ascii keys - BUG [#30479] */
+			if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1; 
+		}
+
 	if (kmitype != KM_ANY)
 		if (winevent->type != kmitype) return 0;
 	
@@ -1345,11 +1315,6 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 	if (kmi->keymodifier)
 		if (winevent->keymodifier != kmi->keymodifier) return 0;
 		
-	/* key modifiers always check when event has it */
-	/* otherwise regular keypresses with keymodifier still work */
-	if (winevent->keymodifier)
-		if (ISTEXTINPUT(winevent->type)) 
-			if (winevent->keymodifier != kmi->keymodifier) return 0;
 	
 	return 1;
 }
@@ -1369,13 +1334,30 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
 		for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
 			if (wm_eventmatch(event, kmi)) {
 					
+				event->prevtype = event->type;
+				event->prevval = event->val;
 				event->type = EVT_MODAL_MAP;
 				event->val = kmi->propvalue;
+				
+				break;
 			}
 		}
 	}
 }
 
+/* bad hacking event system... better restore event type for checking of KM_CLICK for example */
+/* XXX modal maps could use different method (ton) */
+static void wm_event_modalmap_end(wmEvent *event)
+{
+	if (event->type == EVT_MODAL_MAP) {
+		event->type = event->prevtype;
+		event->prevtype = 0;
+		event->val = event->prevval;
+		event->prevval = 0;
+	}
+
+}
+
 /* Warning: this function removes a modal handler, when finished */
 static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler,
                                     wmEvent *event, PointerRNA *properties)
@@ -1402,7 +1384,8 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 
 			retval = ot->modal(C, op, event);
 			OPERATOR_RETVAL_CHECK(retval);
-
+			wm_event_modalmap_end(event);
+			
 			/* when this is _not_ the case the modal modifier may have loaded
 			 * a new blend file (demo mode does this), so we have to assume
 			 * the event, operator etc have all been freed. - campbell */
@@ -1547,72 +1530,55 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
 			/* needed for uiPupMenuReports */
 
 			if (event->val == EVT_FILESELECT_EXEC) {
-#if 0               // use REDALERT now
+				int retval;
 
-				/* a bit weak, might become arg for WM_event_fileselect? */
-				/* XXX also extension code in image-save doesnt work for this yet */
-				if (RNA_struct_find_property(handler->op->ptr, "check_existing") &&
-				    RNA_boolean_get(handler->op->ptr, "check_existing"))
-				{
-					char *path = RNA_string_get_alloc(handler->op->ptr, "filepath", NULL, 0);
-					/* this gives ownership to pupmenu */
-					uiPupMenuSaveOver(C, handler->op, (path) ? path : "");
-					if (path)
-						MEM_freeN(path);
-				}
-				else
-#endif
-				{
-					int retval;
-						
-					if (handler->op->type->flag & OPTYPE_UNDO)
-						wm->op_undo_depth++;
-						
-					retval = handler->op->type->exec(C, handler->op);
+				if (handler->op->type->flag & OPTYPE_UNDO)
+					wm->op_undo_depth++;
 
-					/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
-					if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
-						wm->op_undo_depth--;
+				retval = handler->op->type->exec(C, handler->op);
 
-					if (retval & OPERATOR_FINISHED)
-						if (G.debug & G_DEBUG_WM)
-							wm_operator_print(C, handler->op);
+				/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
+				if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+					wm->op_undo_depth--;
 
-					/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
-					if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0)
-						if (handler->op->type->flag & OPTYPE_UNDO)
-							ED_undo_push_op(C, handler->op);
+				if (retval & OPERATOR_FINISHED)
+					if (G.debug & G_DEBUG_WM)
+						wm_operator_print(C, handler->op);
 
-					if (handler->op->reports->list.first) {
+				/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
+				if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0)
+					if (handler->op->type->flag & OPTYPE_UNDO)
+						ED_undo_push_op(C, handler->op);
 
-						/* FIXME, temp setting window, this is really bad!
-						 * only have because lib linking errors need to be seen by users :(
-						 * it can be removed without breaking anything but then no linking errors - campbell */
-						wmWindow *win_prev = CTX_wm_window(C);
-						ScrArea *area_prev = CTX_wm_area(C);
-						ARegion *ar_prev = CTX_wm_region(C);
+				if (handler->op->reports->list.first) {
 
-						if (win_prev == NULL)
-							CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+					/* FIXME, temp setting window, this is really bad!
+					 * only have because lib linking errors need to be seen by users :(
+					 * it can be removed without breaking anything but then no linking errors - campbell */
+					wmWindow *win_prev = CTX_wm_window(C);
+					ScrArea *area_prev = CTX_wm_area(C);
+					ARegion *ar_prev = CTX_wm_region(C);
 
-						handler->op->reports->printlevel = RPT_WARNING;
-						uiPupMenuReports(C, handler->op->reports);
+					if (win_prev == NULL)
+						CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
 
-						/* XXX - copied from 'wm_operator_finished()' */
-						/* add reports to the global list, otherwise they are not seen */
-						BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
+					handler->op->reports->printlevel = RPT_WARNING;
+					uiPupMenuReports(C, handler->op->reports);
 
-						CTX_wm_window_set(C, win_prev);
-						CTX_wm_area_set(C, area_prev);
-						CTX_wm_region_set(C, ar_prev);
-					}
+					/* XXX - copied from 'wm_operator_finished()' */
+					/* add reports to the global list, otherwise they are not seen */
+					BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
 
-					if (retval & OPERATOR_FINISHED) {
-						WM_operator_last_properties_store(handler->op);
-					}
+					CTX_wm_window_set(C, win_prev);
+					CTX_wm_area_set(C, area_prev);
+					CTX_wm_region_set(C, ar_prev);
+				}
 
-					WM_operator_free(handler->op);
+				if (retval & OPERATOR_FINISHED) {
+					WM_operator_last_properties_store(handler->op);
 				}
+
+				WM_operator_free(handler->op);
 			}
 			else {
 				if (handler->op->type->cancel) {
@@ -1671,10 +1637,13 @@ static int wm_action_not_handled(int action)
 	return action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
 }
 
-static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
+static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers)
 {
 #ifndef NDEBUG
-	const int do_debug_handler = (G.debug & G_DEBUG_EVENTS);
+	const int do_debug_handler = (G.debug & G_DEBUG_HANDLERS)
+	        /* comment this out to flood the console! (if you really want to test) */
+	        && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)
+	        ;
 #endif
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmEventHandler *handler, *nexthandler;
@@ -1685,13 +1654,6 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 		return action;
 	}
 
-#ifndef NDEBUG
-	if (do_debug_handler) {
-		printf("%s: handling event\n", __func__);
-		WM_event_print(event);
-	}
-#endif
-
 	/* modal handlers can get removed in this loop, we keep the loop this way
 	 *
 	 * note: check 'handlers->first' because in rare cases the handlers can be cleared
@@ -1747,11 +1709,10 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 							action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
 							if (action & WM_HANDLER_BREAK) {
 								/* not always_pass here, it denotes removed handler */
-#ifndef NDEBUG
-								if (do_debug_handler) {
-									printf("%s:       handled! '%s'...", __func__, kmi->idname);
-								}
-#endif
+								
+								if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS))
+									printf("%s:       handled! '%s'\n", __func__, kmi->idname);
+
 								break;
 							}
 							else {
@@ -1843,49 +1804,66 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 		}
 	}
 
-	/* test for CLICK event */
-	if (wm_action_not_handled(action) && event->val == KM_RELEASE) {
-		wmWindow *win = CTX_wm_window(C);
+	if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL))
+		wm_cursor_arrow_move(CTX_wm_window(C), event);
+
+	return action;
+}
 
-		if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) {
-			/* test for double click first,
-			 * note1: this can be problematic because single click operators can get the
-			 *   double click event but then with old mouse coords which is highly confusing,
-			 *   so check for mouse moves too.
-			 * note2: the first click event will be handled but still used to create a
-			 *   double click event if clicking again quickly.
-			 *   If no double click events are found it will fallback to a single click.
-			 *   So a double click event can result in 2 successive single click calls
-			 *   if its not handled by the keymap - campbell */
-			if ((ABS(event->x - win->eventstate->prevclickx)) <= 2 &&
-			    (ABS(event->y - win->eventstate->prevclicky)) <= 2 &&
-			    ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time))
-			{
-				event->val = KM_DBL_CLICK;
-				/* removed this because in cases where we're this is used as a single click
-				 * event, this will give old coords,
-				 * since the distance is checked above, using new coords should be ok. */
-				//   event->x = win->eventstate->prevclickx;
-				//   event->y = win->eventstate->prevclicky;
-				action |= wm_handlers_do(C, event, handlers);
-			}
+/* this calls handlers twice - to solve (double-)click events */
+static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
+{
+	int action = wm_handlers_do_intern(C, event, handlers);
+		
+	/* fileread case */
+	if (CTX_wm_window(C) == NULL)
+		return action;
+
+	if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) && !ISTIMER(event->type)) {
 
-			if (wm_action_not_handled(action)) {
-				event->val = KM_CLICK;
-				action |= wm_handlers_do(C, event, handlers);
+		/* test for CLICK events */
+		if (wm_action_not_handled(action)) {
+			wmWindow *win = CTX_wm_window(C);
+			
+			/* eventstate stores if previous event was a KM_PRESS, in case that 
+			 * wasn't handled, the KM_RELEASE will become a KM_CLICK */
+			
+			if (win && event->val == KM_PRESS) {
+				win->eventstate->check_click = TRUE;
 			}
+			
+			if (win && win->eventstate->prevtype == event->type) {
+				
+				if (event->val == KM_RELEASE && win->eventstate->prevval == KM_PRESS && win->eventstate->check_click == TRUE) {
+					event->val = KM_CLICK;
+					
+					if (G.debug & (G_DEBUG_HANDLERS)) {
+						printf("%s: handling CLICK\n", __func__);
+					}
 
+					action |= wm_handlers_do_intern(C, event, handlers);
 
-			/* revert value if not handled */
-			if (wm_action_not_handled(action)) {
-				event->val = KM_RELEASE;
+					event->val = KM_RELEASE;
+				}
+				else if (event->val == KM_DBL_CLICK) {
+					event->val = KM_PRESS;
+					action |= wm_handlers_do_intern(C, event, handlers);
+					
+					/* revert value if not handled */
+					if (wm_action_not_handled(action)) {
+						event->val = KM_DBL_CLICK;
+					}
+				}
 			}
 		}
+		else {
+			wmWindow *win = CTX_wm_window(C);
+
+			if (win)
+				win->eventstate->check_click = 0;
+		}
 	}
 	
-	if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL))
-		wm_cursor_arrow_move(CTX_wm_window(C), event);
-
 	return action;
 }
 
@@ -2063,12 +2041,13 @@ void wm_event_do_handlers(bContext *C)
 		while ( (event = win->queue.first) ) {
 			int action = WM_HANDLER_CONTINUE;
 
-			if ((G.debug & G_DEBUG_EVENTS) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
-				printf("%s: pass on evt %d val %d\n", __func__, event->type, event->val);
+#ifdef DEBUG
+			if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
+				printf("\n%s: Handling event\n", __func__);
+				WM_event_print(event);
 			}
-
-			wm_eventemulation(event);
-
+#endif
+			
 			CTX_wm_window_set(C, win);
 			
 			/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
@@ -2179,40 +2158,6 @@ void wm_event_do_handlers(bContext *C)
 				}
 			}
 			
-			/* store last event for this window */
-			/* mousemove and timer events don't overwrite last type */
-			if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) && !ISTIMER(event->type)) {
-				if (wm_action_not_handled(action)) {
-					if (win->eventstate->prevtype == event->type) {
-						/* set click time on first click (press -> release) */
-						if (win->eventstate->prevval == KM_PRESS && event->val == KM_RELEASE) {
-							win->eventstate->prevclicktime = PIL_check_seconds_timer();
-							win->eventstate->prevclickx = event->x;
-							win->eventstate->prevclicky = event->y;
-						}
-					}
-					else {
-						/* reset click time if event type not the same */
-						win->eventstate->prevclicktime = 0;
-					}
-
-					win->eventstate->prevval = event->val;
-					win->eventstate->prevtype = event->type;
-				}
-				else if (event->val == KM_CLICK) { /* keep click for double click later */
-					win->eventstate->prevtype = event->type;
-					win->eventstate->prevval = event->val;
-					win->eventstate->prevclicktime = PIL_check_seconds_timer();
-					win->eventstate->prevclickx = event->x;
-					win->eventstate->prevclicky = event->y;
-				}
-				else { /* reset if not */
-					win->eventstate->prevtype = -1;
-					win->eventstate->prevval = 0;
-					win->eventstate->prevclicktime = 0;
-				}
-			}
-
 			/* unlink and free here, blender-quit then frees all */
 			BLI_remlink(&win->queue, event);
 			wm_event_free(event);
@@ -2604,6 +2549,75 @@ static int convert_key(GHOST_TKey key)
 	}
 }
 
+static void wm_eventemulation(wmEvent *event)
+{
+	/* Store last mmb event value to make emulation work when modifier keys are released first. */
+	static int mmb_emulated = 0; /* this should be in a data structure somwhere */
+	
+	/* middlemouse emulation */
+	if (U.flag & USER_TWOBUTTONMOUSE) {
+		if (event->type == LEFTMOUSE) {
+			
+			if (event->val == KM_PRESS && event->alt) {
+				event->type = MIDDLEMOUSE;
+				event->alt = 0;
+				mmb_emulated = 1;
+			}
+			else if (event->val == KM_RELEASE) {
+				/* only send middle-mouse release if emulated */
+				if (mmb_emulated) {
+					event->type = MIDDLEMOUSE;
+					event->alt = 0;
+				}
+				mmb_emulated = 0;
+			}
+		}
+		
+	}
+	
+#ifdef __APPLE__
+	
+	/* rightmouse emulation */
+	if (U.flag & USER_TWOBUTTONMOUSE) {
+		if (event->type == LEFTMOUSE) {
+			
+			if (event->val == KM_PRESS && event->oskey) {
+				event->type = RIGHTMOUSE;
+				event->oskey = 0;
+				mmb_emulated = 1;
+			}
+			else if (event->val == KM_RELEASE) {
+				if (mmb_emulated) {
+					event->oskey = RIGHTMOUSE;
+					event->alt = 0;
+				}
+				mmb_emulated = 0;
+			}
+		}
+		
+	}
+#endif
+	
+	/* numpad emulation */
+	if (U.flag & USER_NONUMPAD) {
+		switch (event->type) {
+			case ZEROKEY: event->type = PAD0; break;
+			case ONEKEY: event->type = PAD1; break;
+			case TWOKEY: event->type = PAD2; break;
+			case THREEKEY: event->type = PAD3; break;
+			case FOURKEY: event->type = PAD4; break;
+			case FIVEKEY: event->type = PAD5; break;
+			case SIXKEY: event->type = PAD6; break;
+			case SEVENKEY: event->type = PAD7; break;
+			case EIGHTKEY: event->type = PAD8; break;
+			case NINEKEY: event->type = PAD9; break;
+			case MINUSKEY: event->type = PADMINUS; break;
+			case EQUALKEY: event->type = PADPLUSKEY; break;
+			case BACKSLASHKEY: event->type = PADSLASHKEY; break;
+		}
+	}
+}
+
 /* adds customdata to event */
 static void update_tablet_data(wmWindow *win, wmEvent *event)
 {
@@ -2621,7 +2635,7 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
 		event->custom = EVT_DATA_TABLET;
 		event->customdata = wmtab;
 		event->customdatafree = 1;
-	} 
+	}
 }
 
 /* adds customdata to event */
@@ -2719,49 +2733,45 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 	event = *evt;
 	
 	switch (type) {
-		/* mouse move */
+		/* mouse move, also to inactive window (X11 does this) */
 		case GHOST_kEventCursorMove:
 		{
-			if (win->active) {
-				GHOST_TEventCursorData *cd = customdata;
-				wmEvent *lastevent = win->queue.last;
-				int cx, cy;
-				
-				GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
-				evt->x = cx;
-				evt->y = (win->sizey - 1) - cy;
-				
-				event.x = evt->x;
-				event.y = evt->y;
+			GHOST_TEventCursorData *cd = customdata;
+			wmEvent *lastevent = win->queue.last;
+			int cx, cy;
+			
+			GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
+			evt->x = cx;
+			evt->y = (win->sizey - 1) - cy;
+			
+			event.x = evt->x;
+			event.y = evt->y;
 
-				event.type = MOUSEMOVE;
+			event.type = MOUSEMOVE;
 
-				/* some painting operators want accurate mouse events, they can
-				 * handle in between mouse move moves, others can happily ignore
-				 * them for better performance */
-				if (lastevent && lastevent->type == MOUSEMOVE)
-					lastevent->type = INBETWEEN_MOUSEMOVE;
+			/* some painting operators want accurate mouse events, they can
+			 * handle in between mouse move moves, others can happily ignore
+			 * them for better performance */
+			if (lastevent && lastevent->type == MOUSEMOVE)
+				lastevent->type = INBETWEEN_MOUSEMOVE;
 
-				update_tablet_data(win, &event);
-				wm_event_add(win, &event);
-
-				//printf("sending MOUSEMOVE %d %d\n", event.x, event.y);
+			update_tablet_data(win, &event);
+			wm_event_add(win, &event);
+			
+			/* also add to other window if event is there, this makes overdraws disappear nicely */
+			/* it remaps mousecoord to other window in event */
+			owin = wm_event_cursor_other_windows(wm, win, &event);
+			if (owin) {
+				wmEvent oevent = *(owin->eventstate);
 				
-				/* also add to other window if event is there, this makes overdraws disappear nicely */
-				/* it remaps mousecoord to other window in event */
-				owin = wm_event_cursor_other_windows(wm, win, &event);
-				if (owin) {
-					wmEvent oevent = *(owin->eventstate);
-					
-					oevent.x = owin->eventstate->x = event.x;
-					oevent.y = owin->eventstate->y = event.y;
-					oevent.type = MOUSEMOVE;
-					
-					update_tablet_data(owin, &oevent);
-					wm_event_add(owin, &oevent);
-				}
+				oevent.x = owin->eventstate->x = event.x;
+				oevent.y = owin->eventstate->y = event.y;
+				oevent.type = MOUSEMOVE;
 				
+				update_tablet_data(owin, &oevent);
+				wm_event_add(owin, &oevent);
 			}
+				
 			break;
 		}
 		case GHOST_kEventTrackpad:
@@ -2786,7 +2796,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 				event.x = evt->x = cx;
 				event.y = evt->y = (win->sizey - 1) - cy;
 			}
-
+			
+			event.val = 0;
+			
 			/* Use prevx/prevy so we can calculate the delta later */
 			event.prevx = event.x - pd->deltaX;
 			event.prevy = event.y - (-pd->deltaY);
@@ -2800,7 +2812,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 		case GHOST_kEventButtonUp:
 		{
 			GHOST_TEventButtonData *bd = customdata;
-
+			
+			/* get value and type from ghost */
 			event.val = (type == GHOST_kEventButtonDown) ? KM_PRESS : KM_RELEASE;
 			
 			if (bd->button == GHOST_kButtonMaskLeft)
@@ -2814,6 +2827,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			else
 				event.type = MIDDLEMOUSE;
 			
+			wm_eventemulation(&event);
+			
+			/* copy previous state to prev event state (two old!) */
+			evt->prevval = evt->val;
+			evt->prevtype = evt->type;
+
+			/* copy to event state */
+			evt->val = event.val;
+			evt->type = event.type;
+
 			if (win->active == 0) {
 				int cx, cy;
 				
@@ -2824,6 +2847,23 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 				event.y = evt->y = cy;
 			}
 			
+			/* double click test */
+			if (event.type == evt->prevtype && event.val == KM_PRESS) {
+				if ((ABS(event.x - evt->prevclickx)) <= 2 &&
+				    (ABS(event.y - evt->prevclicky)) <= 2 &&
+				    ((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
+				{
+					if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) )
+						printf("%s Send double click\n", __func__);
+					event.val = KM_DBL_CLICK;
+				}
+			}
+			if (event.val == KM_PRESS) {
+				evt->prevclicktime = PIL_check_seconds_timer();
+				evt->prevclickx = event.x;
+				evt->prevclicky = event.y;
+			}
+			
 			/* add to other window if event is there (not to both!) */
 			owin = wm_event_cursor_other_windows(wm, win, &event);
 			if (owin) {
@@ -2854,6 +2894,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			memcpy(event.utf8_buf, kd->utf8_buf, sizeof(event.utf8_buf)); /* might be not null terminated*/
 			event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : KM_RELEASE;
 			
+			wm_eventemulation(&event);
+			
+			/* copy previous state to prev event state (two old!) */
+			evt->prevval = evt->val;
+			evt->prevtype = evt->type;
+
+			/* copy to event state */
+			evt->val = event.val;
+			evt->type = event.type;
+			
 			/* exclude arrow keys, esc, etc from text input */
 			if (type == GHOST_kEventKeyUp) {
 				event.ascii = '\0';
@@ -2879,28 +2929,28 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 				}
 			}
 
-			/* modifiers */
+			/* modifiers assign to eventstate, so next event gets the modifer (makes modifier key events work) */
 			/* assigning both first and second is strange - campbell */
 			switch (event.type) {
 				case LEFTSHIFTKEY: case RIGHTSHIFTKEY:
-					event.shift = evt->shift = (event.val == KM_PRESS) ?
-					                           ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
-					                           FALSE;
+					evt->shift = (event.val == KM_PRESS) ?
+					            ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+					            FALSE;
 					break;
 				case LEFTCTRLKEY: case RIGHTCTRLKEY:
-					event.ctrl = evt->ctrl = (event.val == KM_PRESS) ?
-					                         ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
-					                         FALSE;
+					evt->ctrl = (event.val == KM_PRESS) ?
+					            ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+					            FALSE;
 					break;
 				case LEFTALTKEY: case RIGHTALTKEY:
-					event.alt = evt->alt = (event.val == KM_PRESS) ?
-					                       ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
-					                       FALSE;
+					evt->alt = (event.val == KM_PRESS) ?
+					            ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+					            FALSE;
 					break;
 				case OSKEY:
-					event.oskey = evt->oskey = (event.val == KM_PRESS) ?
-					                           ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
-					                           FALSE;
+					evt->oskey = (event.val == KM_PRESS) ?
+					            ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+					            FALSE;
 					break;
 				default:
 					if (event.val == KM_PRESS && event.keymodifier == 0)
@@ -2910,21 +2960,44 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 					break;
 			}
 
-			/* this case happens on some systems that on holding a key pressed,
-			 * generate press events without release, we still want to keep the
-			 * modifier in win->eventstate, but for the press event of the same
-			 * key we don't want the key modifier */
+			/* double click test */
+			/* if previous event was same type, and previous was release, and now it presses... */
+			if (event.type == evt->prevtype && evt->prevval == KM_RELEASE && event.val == KM_PRESS) {
+				if ((ABS(event.x - evt->prevclickx)) <= 2 &&
+				    (ABS(event.y - evt->prevclicky)) <= 2 &&
+				    ((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
+				{
+					if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) )
+						printf("%s Send double click\n", __func__);
+					evt->val = event.val = KM_DBL_CLICK;
+				}
+			}
+			
+			/* this case happens on holding a key pressed, it should not generate
+			 * press events events with the same key as modifier */
 			if (event.keymodifier == event.type)
 				event.keymodifier = 0;
+						
 			/* this case happened with an external numpad, it's not really clear
 			 * why, but it's also impossible to map a key modifier to an unknwon
 			 * key, so it shouldn't harm */
 			if (event.keymodifier == UNKNOWNKEY)
 				event.keymodifier = 0;
 			
-			/* if test_break set, it catches this. XXX Keep global for now? */
-			if (event.type == ESCKEY)
+			/* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */
+			if ((event.type == ESCKEY && event.val == KM_PRESS) &&
+			    /* check other modifiers because ms-windows uses these to bring up the task manager */
+			    (event.shift == 0 && event.ctrl == 0 && event.alt == 0))
+			{
 				G.is_break = TRUE;
+			}
+			
+			/* double click test - only for press */
+			if (event.val == KM_PRESS) {
+				evt->prevclicktime = PIL_check_seconds_timer();
+				evt->prevclickx = event.x;
+				evt->prevclicky = event.y;
+			}
 			
 			wm_event_add(win, &event);
 			
@@ -2950,6 +3023,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			event.type = TIMER;
 			event.custom = EVT_DATA_TIMER;
 			event.customdata = customdata;
+			event.val = 0;
+			event.keymodifier = 0;
 			wm_event_add(win, &event);
 
 			break;
@@ -2958,10 +3033,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 		case GHOST_kEventNDOFMotion:
 		{
 			event.type = NDOF_MOTION;
+			event.val = 0;
 			attach_ndof_data(&event, customdata);
 			wm_event_add(win, &event);
 
-			//printf("sending NDOF_MOTION, prev = %d %d\n", event.x, event.y);
+			if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) )
+				printf("%s sending NDOF_MOTION, prev = %d %d\n", __func__, event.x, event.y);
 
 			break;
 		}
@@ -3003,7 +3080,4 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 
 	}
 
-	/* Handy when debugging checking events */
-	/* WM_event_print(&event); */
-
 }
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index c6bd912..0e4af46 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -144,7 +144,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
 	/* code copied from wm_init_exit.c */
 	for (wm = wmlist->first; wm; wm = wm->id.next) {
 		
-		WM_jobs_stop_all(wm);
+		WM_jobs_kill_all(wm);
 		
 		for (win = wm->windows.first; win; win = win->next) {
 		
@@ -450,9 +450,8 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
 				if (sce->r.engine[0] &&
 				    BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
 				{
-					BKE_reportf(reports, RPT_WARNING,
-					            "Engine not available: '%s' for scene: %s, "
-					            "an addon may need to be installed or enabled",
+					BKE_reportf(reports, RPT_ERROR, "Engine '%s' not available for scene '%s' "
+					            "(an addon may need to be installed or enabled)",
 					            sce->r.engine, sce->id.name + 2);
 				}
 			}
@@ -465,17 +464,17 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
 	else if (retval == BKE_READ_EXOTIC_OK_OTHER)
 		BKE_write_undo(C, "Import file");
 	else if (retval == BKE_READ_EXOTIC_FAIL_OPEN) {
-		BKE_reportf(reports, RPT_ERROR, IFACE_("Can't read file: \"%s\", %s."), filepath,
-		            errno ? strerror(errno) : IFACE_("Unable to open the file"));
+		BKE_reportf(reports, RPT_ERROR, "Cannot read file '%s': %s", filepath,
+		            errno ? strerror(errno) : TIP_("unable to open the file"));
 	}
 	else if (retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
-		BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath);
+		BKE_reportf(reports, RPT_ERROR, "File format is not supported in file '%s'", filepath);
 	}
 	else if (retval == BKE_READ_EXOTIC_FAIL_PATH) {
-		BKE_reportf(reports, RPT_ERROR, IFACE_("File path invalid: \"%s\"."), filepath);
+		BKE_reportf(reports, RPT_ERROR, "File path '%s' invalid", filepath);
 	}
 	else {
-		BKE_reportf(reports, RPT_ERROR, IFACE_("Unknown error loading: \"%s\"."), filepath);
+		BKE_reportf(reports, RPT_ERROR, "Unknown error loading '%s'", filepath);
 		BLI_assert(!"invalid 'retval'");
 	}
 
@@ -716,7 +715,7 @@ static ImBuf *blend_file_thumb(Scene *scene, bScreen *screen, int **thumb_pt)
 		                                      IB_rect, FALSE, FALSE, err_out);
 	}
 
-	if (ibuf) {		
+	if (ibuf) {
 		float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
 
 		/* dirty oversampling */
@@ -763,7 +762,7 @@ int write_crash_blend(void)
 	}
 }
 
-int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports, int copy)
+int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports)
 {
 	Library *li;
 	int len;
@@ -791,7 +790,7 @@ int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *re
 	/* send the OnSave event */
 	for (li = G.main->library.first; li; li = li->id.next) {
 		if (BLI_path_cmp(li->filepath, filepath) == 0) {
-			BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.240s'", filepath);
+			BKE_reportf(reports, RPT_ERROR, "Cannot overwrite used library '%.240s'", filepath);
 			return -1;
 		}
 	}
@@ -819,7 +818,7 @@ int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *re
 	fileflags |= G_FILE_HISTORY; /* write file history */
 
 	if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
-		if (!copy) {
+		if (!(fileflags & G_FILE_SAVE_COPY)) {
 			G.relbase_valid = 1;
 			BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));  /* is guaranteed current file */
 	
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index b3ffb80..a80386e 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -255,7 +255,7 @@ static void draw_filled_lasso(wmGesture *gt)
 	if (sf_vert_first) {
 		const float zvec[3] = {0.0f, 0.0f, 1.0f};
 		BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
-		BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
+		BLI_scanfill_calc_ex(&sf_ctx, BLI_SCANFILL_CALC_REMOVE_DOUBLES, zvec);
 	
 		glEnable(GL_BLEND);
 		glColor4f(1.0, 1.0, 1.0, 0.05);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 9bb3b2a..c9f0bbf 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -47,6 +47,10 @@
 #include "DNA_userdef_types.h"
 #include "DNA_windowmanager_types.h"
 
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
+
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_screen.h"
@@ -66,10 +70,6 @@
 #include "BKE_material.h" /* clear_matcopybuf */
 #include "BKE_tracking.h" /* free tracking clipboard */
 
-#include "BLI_listbase.h"
-#include "BLI_string.h"
-#include "BLI_utildefines.h"
-
 #include "RE_engine.h"
 #include "RE_pipeline.h"        /* RE_ free stuff */
 
@@ -302,7 +302,7 @@ int WM_init_game(bContext *C)
 	else {
 		ReportTimerInfo *rti;
 
-		BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found. Game auto start is not possible.");
+		BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found, game auto start is not possible");
 
 		/* After adding the report to the global list, reset the report timer. */
 		WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
@@ -372,7 +372,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 	if (C && wm) {
 		wmWindow *win;
 
-		WM_jobs_stop_all(wm);
+		WM_jobs_kill_all(wm);
 
 		for (win = wm->windows.first; win; win = win->next) {
 			
@@ -423,6 +423,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 
 #ifdef WITH_INTERNATIONAL
 	BLF_free_unifont();
+	BLF_lang_free();
 #endif
 	
 	ANIM_keyingset_infos_exit();
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 4a41036..3c3e2c0 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -131,31 +131,34 @@ struct wmJob {
 };
 
 /* finds:
- * 1st priority: job with same owner and name
- * 2nd priority: job with same owner
+ * if type, compare for it, otherwise any matching job 
  */
-static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
+static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
 {
-	wmJob *wm_job, *found = NULL;
+	wmJob *wm_job;
 	
 	for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
 		if (wm_job->owner == owner) {
-			found = wm_job;
-			if (name && strcmp(wm_job->name, name) == 0)
+			
+			if (job_type) {
+				if ( wm_job->job_type == job_type)
+					return wm_job;
+			}
+			else
 				return wm_job;
 		}
 	
-	return found;
+	return NULL;
 }
 
 /* ******************* public API ***************** */
 
 /* returns current or adds new job, but doesnt run it */
-/* every owner only gets a single job, adding a new one will stop running stop and 
+/* every owner only gets a single job, adding a new one will stop running job and 
  * when stopped it starts the new one */
 wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
 {
-	wmJob *wm_job = wm_job_find(wm, owner, name);
+	wmJob *wm_job = wm_job_find(wm, owner, job_type);
 	
 	if (wm_job == NULL) {
 		wm_job = MEM_callocN(sizeof(wmJob), "new job");
@@ -167,7 +170,11 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
 		wm_job->job_type = job_type;
 		BLI_strncpy(wm_job->name, name, sizeof(wm_job->name));
 	}
+	/* else: a running job, be careful */
 	
+	/* prevent creating a job with an invalid type */
+	BLI_assert(wm_job->job_type != WM_JOB_TYPE_ANY);
+
 	return wm_job;
 }
 
@@ -192,7 +199,7 @@ int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
 
 float WM_jobs_progress(wmWindowManager *wm, void *owner)
 {
-	wmJob *wm_job = wm_job_find(wm, owner, NULL);
+	wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
 	
 	if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
 		return wm_job->progress;
@@ -202,7 +209,7 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
 
 char *WM_jobs_name(wmWindowManager *wm, void *owner)
 {
-	wmJob *wm_job = wm_job_find(wm, owner, NULL);
+	wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
 	
 	if (wm_job)
 		return wm_job->name;
@@ -360,7 +367,7 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
 	}
 }
 
-/* stop job, free data completely */
+/* stop job, end thread, free data completely */
 static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
 {
 	if (wm_job->running) {
@@ -385,7 +392,8 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
 	
 }
 
-void WM_jobs_stop_all(wmWindowManager *wm)
+/* wait until every job ended */
+void WM_jobs_kill_all(wmWindowManager *wm)
 {
 	wmJob *wm_job;
 	
@@ -394,6 +402,32 @@ void WM_jobs_stop_all(wmWindowManager *wm)
 	
 }
 
+/* wait until every job ended, except for one owner (used in undo to keep screen job alive) */
+void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
+{
+	wmJob *wm_job, *next_job;
+	
+	for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
+		next_job = wm_job->next;
+
+		if (wm_job->owner != owner)
+			wm_jobs_kill_job(wm, wm_job);
+	}
+}
+
+
+void WM_jobs_kill_type(struct wmWindowManager *wm, int job_type)
+{
+	wmJob *wm_job, *next_job;
+	
+	for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
+		next_job = wm_job->next;
+
+		if (wm_job->job_type == job_type)
+			wm_jobs_kill_job(wm, wm_job);
+	}
+}
+
 /* signal job(s) from this owner or callback to stop, timer is required to get handled */
 void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
 {
@@ -466,7 +500,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
 					if (wm_job->flag & WM_JOB_PROGRESS)
 						WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
 					wm_job->do_update = FALSE;
-				}	
+				}
 				
 				if (wm_job->ready) {
 					if (wm_job->endjob)
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index bcddc98..3739462 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -101,11 +101,8 @@ static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
 	if (strcmp(a->idname, b->idname) != 0)
 		return 0;
 	
-	if (!((a->ptr == NULL && b->ptr == NULL) ||
-	      (a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data))))
-	{
+	if (!RNA_struct_equals(a->ptr, b->ptr))
 		return 0;
-	}
 	
 	if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
 		return 0;
@@ -190,9 +187,9 @@ wmKeyConfig *WM_keyconfig_new_user(wmWindowManager *wm, const char *idname)
 	return keyconf;
 }
 
-void WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
+int WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
 {
-	if (keyconf) {
+	if (BLI_findindex(&wm->keyconfigs, keyconf) != -1) {
 		if (strncmp(U.keyconfigstr, keyconf->idname, sizeof(U.keyconfigstr)) == 0) {
 			BLI_strncpy(U.keyconfigstr, wm->defaultconf->idname, sizeof(U.keyconfigstr));
 			WM_keyconfig_update_tag(NULL, NULL);
@@ -200,6 +197,11 @@ void WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
 
 		BLI_remlink(&wm->keyconfigs, keyconf);
 		WM_keyconfig_free(keyconf);
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
 	}
 }
 
@@ -381,7 +383,7 @@ wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type,
 	return kmi;
 }
 
-void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
+int WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
 {
 	if (BLI_findindex(&keymap->items, kmi) != -1) {
 		if (kmi->ptr) {
@@ -390,7 +392,11 @@ void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
 		}
 		BLI_freelinkN(&keymap->items, kmi);
 
-		WM_keyconfig_update_tag(keymap, kmi);
+		WM_keyconfig_update_tag(keymap, NULL);
+		return TRUE;
+	}
+	else {
+		return FALSE;
 	}
 }
 
@@ -536,7 +542,7 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
 
 	/* copy new keymap from an existing one */
 	if (usermap && !(usermap->flag & KEYMAP_DIFF)) {
-		/* for compatibiltiy with old user preferences with non-diff
+		/* for compatibility with old user preferences with non-diff
 		 * keymaps we override the original entirely */
 		wmKeyMapItem *kmi, *orig_kmi;
 
@@ -816,7 +822,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
 
 static wmKeyMapItem *wm_keymap_item_find_handlers(
         const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext),
-        IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
+        IDProperty *properties, int is_strict, int hotkey, wmKeyMap **keymap_r)
 {
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmEventHandler *handler;
@@ -834,9 +840,22 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
 					if (hotkey)
 						if (!ISHOTKEY(kmi->type))
 							continue;
-					
-					if (compare_props) {
-						if (kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
+
+					if (properties) {
+
+						/* example of debugging keymaps */
+#if 0
+						if (kmi->ptr) {
+							if (strcmp("MESH_OT_rip_move", opname) == 0) {
+								printf("OPERATOR\n");
+								IDP_spit(properties);
+								printf("KEYMAP\n");
+								IDP_spit(kmi->ptr->data);
+							}
+						}
+#endif
+
+						if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) {
 							if (keymap_r) *keymap_r = keymap;
 							return kmi;
 						}
@@ -857,7 +876,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
 
 static wmKeyMapItem *wm_keymap_item_find_props(
         const bContext *C, const char *opname, int opcontext,
-        IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
+        IDProperty *properties, int is_strict, int hotkey, wmKeyMap **keymap_r)
 {
 	wmWindow *win = CTX_wm_window(C);
 	ScrArea *sa = CTX_wm_area(C);
@@ -866,10 +885,10 @@ static wmKeyMapItem *wm_keymap_item_find_props(
 
 	/* look into multiple handler lists to find the item */
 	if (win)
-		found = wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+		found = wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 
 	if (sa && found == NULL)
-		found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+		found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 
 	if (found == NULL) {
 		if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
@@ -878,7 +897,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(
 					ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
 				
 				if (ar)
-					found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+					found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 			}
 		}
 		else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
@@ -886,18 +905,18 @@ static wmKeyMapItem *wm_keymap_item_find_props(
 				ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
 
 			if (ar)
-				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 		}
 		else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
 			if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
 				ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
 
 			if (ar)
-				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 		}
 		else {
 			if (ar)
-				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r);
 		}
 	}
 
@@ -906,12 +925,28 @@ static wmKeyMapItem *wm_keymap_item_find_props(
 
 static wmKeyMapItem *wm_keymap_item_find(
         const bContext *C, const char *opname, int opcontext,
-        IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r)
+        IDProperty *properties, const short hotkey, const short UNUSED(sloppy), wmKeyMap **keymap_r)
 {
 	wmKeyMapItem *found = wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, keymap_r);
 
-	if (!found && sloppy)
-		found = wm_keymap_item_find_props(C, opname, opcontext, NULL, 0, hotkey, keymap_r);
+	if (!found && properties) {
+		wmOperatorType *ot = WM_operatortype_find(opname, TRUE);
+		if (ot) {
+			/* make a copy of the properties and set any unset props
+			 * to their default values, so the ID property compare function succeeds */
+			PointerRNA opptr;
+			IDProperty *properties_default = IDP_CopyProperty(properties);
+
+			RNA_pointer_create(NULL, ot->srna, properties_default, &opptr);
+
+			if (WM_operator_properties_default(&opptr, TRUE)) {
+				found = wm_keymap_item_find_props(C, opname, opcontext, properties_default, 0, hotkey, keymap_r);
+			}
+
+			IDP_FreeProperty(properties_default);
+			MEM_freeN(properties_default);
+		}
+	}
 
 	return found;
 }
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index ec25e8d..8a0701b 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -72,6 +72,7 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h" /* BKE_ST_MAXNAME */
+#include "BKE_utildefines.h"
 
 #include "BKE_idcode.h"
 
@@ -86,6 +87,7 @@
 #include "ED_screen.h"
 #include "ED_util.h"
 #include "ED_object.h"
+#include "ED_view3d.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -619,6 +621,42 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context)
 	RNA_STRUCT_END;
 }
 
+
+/** set all props to their default,
+ * \param do_update Only update un-initialized props.
+ *
+ * \note, theres nothing specific to operators here.
+ * this could be made a general function.
+ */
+int WM_operator_properties_default(PointerRNA *ptr, const int do_update)
+{
+	int is_change = FALSE;
+	RNA_STRUCT_BEGIN(ptr, prop)
+	{
+		switch (RNA_property_type(prop)) {
+			case PROP_POINTER:
+			{
+				StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
+				if (ptype != &RNA_Struct) {
+					PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
+					is_change |= WM_operator_properties_default(&opptr, do_update);
+				}
+				break;
+			}
+			default:
+				if ((do_update == FALSE) || (RNA_property_is_set(ptr, prop) == FALSE)) {
+					if (RNA_property_reset(ptr, prop, -1)) {
+						is_change = 1;
+					}
+				}
+				break;
+		}
+	}
+	RNA_STRUCT_END;
+
+	return is_change;
+}
+
 /* remove all props without PROP_SKIP_SAVE */
 void WM_operator_properties_reset(wmOperator *op)
 {
@@ -652,6 +690,35 @@ void WM_operator_properties_free(PointerRNA *ptr)
 
 /* ************ default op callbacks, exported *********** */
 
+int WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *UNUSED(event))
+{
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+
+	const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL);
+
+	/* always run, so the values are initialized,
+	 * otherwise we may get differ behavior when (dia != 1.0) */
+	RNA_STRUCT_BEGIN(op->ptr, prop)
+	{
+		if (RNA_property_type(prop) == PROP_FLOAT) {
+			PropertySubType pstype = RNA_property_subtype(prop);
+			if (pstype == PROP_DISTANCE) {
+				/* we don't support arrays yet */
+				BLI_assert(RNA_property_array_check(prop) == FALSE);
+				/* initialize */
+				if (!RNA_property_is_set_ex(op->ptr, prop, FALSE)) {
+					const float value = RNA_property_float_get_default(op->ptr, prop) * dia;
+					RNA_property_float_set(op->ptr, prop, value);
+				}
+			}
+		}
+	}
+	RNA_STRUCT_END;
+
+	return op->type->exec(C, op);
+}
+
 /* invoke callback, uses enum property named "type" */
 int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
@@ -674,6 +741,8 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	else {
 		pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 		layout = uiPupMenuLayout(pup);
+		/* set this so the default execution context is the same as submenus */
+		uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
 		uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
 		uiPupMenuEnd(C, pup);
 	}
@@ -745,7 +814,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
 	wmOperator *op = (wmOperator *)arg_op;
 
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
 
 #if 0 /* ok, this isn't so easy... */
 	uiDefBut(block, LABEL, 0, RNA_struct_ui_name(op->type->srna), 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
@@ -754,7 +823,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
 	uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL);
 
 	/* fake button, it holds space for search items */
-	uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9 * UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+	uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
 
 	uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
 	uiEndBlock(C, block);
@@ -807,7 +876,7 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
 		return WM_operator_call_notest(C, op); /* call exec direct */
-	} 
+	}
 	else {
 		WM_event_add_fileselect(C, op);
 		return OPERATOR_RUNNING_MODAL;
@@ -857,12 +926,16 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
 		RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
 
 	if (action == FILE_SAVE) {
+		/* note, this is only used to check if we should highlight the filename area red when the
+		 * filepath is an existing file. */
 		prop = RNA_def_boolean(ot->srna, "check_existing", 1, "Check Existing", "Check and warn on overwriting existing files");
 		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	}
 	
 	prop = RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_backup", (filter & BLENDERFILE_BACKUP), "Filter .blend files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
@@ -982,6 +1055,23 @@ wmOperator *WM_operator_last_redo(const bContext *C)
 	return op;
 }
 
+static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event))
+{
+	wmOperator *op = arg_op;
+
+	if (op == WM_operator_last_redo(C)) {
+		/* operator was already executed once? undo & repeat */
+		ED_undo_operator_repeat(C, op);
+	}
+	else {
+		/* operator not executed yet, call it */
+		ED_undo_push_op(C, op);
+		wm_operator_register(C, op);
+
+		WM_operator_repeat(C, op);
+	}
+}
+
 static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 {
 	wmOperator *op = arg_op;
@@ -989,21 +1079,21 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 	uiLayout *layout;
 	uiStyle *style = UI_GetStyle();
 	int width = 300;
-	
 
 	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	uiBlockClearFlag(block, UI_BLOCK_LOOP);
-	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
+	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
 
 	/* if register is not enabled, the operator gets freed on OPERATOR_FINISHED
 	 * ui_apply_but_funcs_after calls ED_undo_operator_repeate_cb and crashes */
 	assert(op->type->flag & OPTYPE_REGISTER);
 
-	uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, arg_op);
+	uiBlockSetHandleFunc(block, wm_block_redo_cb, arg_op);
 	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style);
 
-	if (!WM_operator_check_ui_enabled(C, op->type->name))
-		uiLayoutSetEnabled(layout, FALSE);
+	if (op == WM_operator_last_redo(C))
+		if (!WM_operator_check_ui_enabled(C, op->type->name))
+			uiLayoutSetEnabled(layout, FALSE);
 
 	if (op->type->flag & OPTYPE_MACRO) {
 		for (op = op->macro.first; op; op = op->next) {
@@ -1015,7 +1105,6 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 		uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE);
 	}
 	
-
 	uiPopupBoundsBlock(block, 4, 0, 0);
 	uiEndBlock(C, block);
 
@@ -1071,7 +1160,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
 
 	/* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogs have many items
 	 * where quitting by accident is very annoying */
-	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_RET_1);
+	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
 
 	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
 	
@@ -1112,7 +1201,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
 
 	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	uiBlockClearFlag(block, UI_BLOCK_LOOP);
-	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
+	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
 
 	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
 
@@ -1143,6 +1232,8 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
 
 	if (op && retval > 0)
 		WM_operator_call(C, op);
+	
+	MEM_freeN(data);
 }
 
 int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
@@ -1156,24 +1247,45 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
 	return OPERATOR_RUNNING_MODAL;
 }
 
-/* operator menu needs undo, for redo callback */
-int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+/**
+ * For use by #WM_operator_props_popup_call, #WM_operator_props_popup only.
+ *
+ * \note operator menu needs undo flag enabled , for redo callback */
+static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_call)
 {
-	
 	if ((op->type->flag & OPTYPE_REGISTER) == 0) {
 		BKE_reportf(op->reports, RPT_ERROR,
-		            "Operator '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
+		            "Operator '%s' does not have register enabled, incorrect invoke function", op->type->idname);
 		return OPERATOR_CANCELLED;
 	}
-	
-	ED_undo_push_op(C, op);
-	wm_operator_register(C, op);
+
+	/* if we don't have global undo, we can't do undo push for automatic redo,
+	 * so we require manual OK clicking in this popup */
+	if (!(U.uiflag & USER_GLOBALUNDO))
+		return WM_operator_props_dialog_popup(C, op, 300, UI_UNIT_Y);
 
 	uiPupBlock(C, wm_block_create_redo, op);
 
+	if (do_call)
+		wm_block_redo_cb(C, op, 0);
+
 	return OPERATOR_RUNNING_MODAL;
 }
 
+/* Same as WM_operator_props_popup but call the operator first,
+ * This way - the button values correspond to the result of the operator.
+ * Without this, first access to a button will make the result jump,
+ * see [#32452] */
+int WM_operator_props_popup_call(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+	return wm_operator_props_popup_ex(C, op, TRUE);
+}
+
+int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+	return wm_operator_props_popup_ex(C, op, FALSE);
+}
+
 int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
 {
 	wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
@@ -1193,11 +1305,12 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op)
 {
 	/* CTX_wm_reports(C) because operator is on stack, not active in event system */
 	if ((op->type->flag & OPTYPE_REGISTER) == 0) {
-		BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
+		BKE_reportf(CTX_wm_reports(C), RPT_ERROR,
+		            "Operator redo '%s' does not have register enabled, incorrect invoke function", op->type->idname);
 		return OPERATOR_CANCELLED;
 	}
 	if (op->type->poll && op->type->poll(C) == 0) {
-		BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context.", op->type->idname);
+		BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context", op->type->idname);
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1214,7 +1327,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op)
 	ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C));
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
 
-	return OPERATOR_FINISHED;	
+	return OPERATOR_FINISHED;
 }
 
 static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
@@ -1233,9 +1346,34 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
 	ot->exec = wm_debug_menu_exec;
 	ot->poll = WM_operator_winactive;
 	
-	RNA_def_int(ot->srna, "debug_value", 0, -10000, 10000, "Debug Value", "", INT_MIN, INT_MAX);
+	RNA_def_int(ot->srna, "debug_value", 0, SHRT_MIN, SHRT_MAX, "Debug Value", "", -10000, 10000);
 }
 
+/* ***************** Operator defaults ************************* */
+static int wm_operator_defaults_exec(bContext *C, wmOperator *op)
+{
+	PointerRNA ptr = CTX_data_pointer_get_type(C, "active_operator", &RNA_Operator);
+
+	if (!ptr.data) {
+		BKE_report(op->reports, RPT_ERROR, "No operator in context");
+		return OPERATOR_CANCELLED;
+	}
+
+	WM_operator_properties_reset((wmOperator *)ptr.data);
+	return OPERATOR_FINISHED;
+}
+
+/* used by operator preset menu. pre-2.65 this was a 'Reset' button */
+static void WM_OT_operator_defaults(wmOperatorType *ot)
+{
+	ot->name = "Restore Defaults";
+	ot->idname = "WM_OT_operator_defaults";
+	ot->description = "Set the active operator to its default values";
+
+	ot->exec = wm_operator_defaults_exec;
+
+	ot->flag = OPTYPE_INTERNAL;
+}
 
 /* ***************** Splash Screen ************************* */
 
@@ -1291,6 +1429,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	int i;
 	MenuType *mt = WM_menutype_find("USERPREF_MT_splash", TRUE);
 	char url[96];
+	char file [FILE_MAX];
 
 #ifndef WITH_HEADLESS
 	extern char datatoc_splash_png[];
@@ -1316,10 +1455,14 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi);
 	ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_buf) + 5;
 	rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_buf) + 5;
-#endif //WITH_BUILDINFO
+#endif  /* WITH_BUILDINFO */
 
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
+
+	/* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized
+	 * with the OS when the splash shows, window clipping in this case gives
+	 * ugly results and clipping the splash isn't useful anyway, just disable it [#32938] */
+	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP);
 	
 	but = uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
 	uiButSetFunc(but, wm_block_splash_close, block, NULL);
@@ -1328,7 +1471,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 #ifdef WITH_BUILDINFO	
 	uiDefBut(block, LABEL, 0, version_buf, 494 - ver_width, 282 - 24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
 	uiDefBut(block, LABEL, 0, revision_buf, 494 - rev_width, 282 - 36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
-#endif //WITH_BUILDINFO
+#endif  /* WITH_BUILDINFO */
 	
 	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
 	
@@ -1352,7 +1495,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	uiItemL(col, "Links", ICON_NONE);
 	uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
 	uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
-	uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-264");
+	uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-265");
 	uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual");
 	uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
 	uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
@@ -1374,7 +1517,11 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 
 	uiItemL(col, IFACE_("Recent"), ICON_NONE);
 	for (recent = G.recent_files.first, i = 0; (i < 5) && (recent); recent = recent->next, i++) {
-		uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+		BLI_split_file_part(recent->filepath, file, sizeof(file));
+		if (BLO_has_bfile_extension(file))
+			uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+		else
+			uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath);
 	}
 
 	uiItemS(col);
@@ -1406,49 +1553,6 @@ static void WM_OT_splash(wmOperatorType *ot)
 
 
 /* ***************** Search menu ************************* */
-static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
-{
-	wmOperatorType *ot = arg2;
-	
-	if (ot)
-		WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
-}
-
-static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
-{
-	GHashIterator *iter = WM_operatortype_iter();
-
-	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-		wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
-
-		if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0)
-			continue;
-
-		if (BLI_strcasestr(ot->name, str)) {
-			if (WM_operator_poll((bContext *)C, ot)) {
-				char name[256];
-				int len = strlen(ot->name);
-				
-				/* display name for menu, can hold hotkey */
-				BLI_strncpy(name, ot->name, sizeof(name));
-				
-				/* check for hotkey */
-				if (len < sizeof(name) - 6) {
-					if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
-					                                 &name[len + 1], sizeof(name) - len - 1))
-					{
-						name[len] = '|';
-					}
-				}
-				
-				if (0 == uiSearchItemAdd(items, name, ot, 0))
-					break;
-			}
-		}
-	}
-	BLI_ghashIterator_free(iter);
-}
-
 static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
 {
 	static char search[256] = "";
@@ -1458,13 +1562,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_
 	uiBut *but;
 	
 	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
 	
 	but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
-	uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
+	uiOperatorSearch_But(but);
 	
 	/* fake button, it holds space for search items */
-	uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9 * UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+	uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
 	
 	uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
 	uiEndBlock(C, block);
@@ -1500,12 +1604,12 @@ static int wm_search_menu_poll(bContext *C)
 	else {
 		ScrArea *sa = CTX_wm_area(C);
 		if (sa) {
-			if (sa->spacetype == SPACE_CONSOLE) return 0;  // XXX - so we can use the shortcut in the console
-			if (sa->spacetype == SPACE_TEXT) return 0;  // XXX - so we can use the spacebar in the text editor
+			if (sa->spacetype == SPACE_CONSOLE) return 0;  /* XXX - so we can use the shortcut in the console */
+			if (sa->spacetype == SPACE_TEXT) return 0;     /* XXX - so we can use the spacebar in the text editor */
 		}
 		else {
 			Object *editob = CTX_data_edit_object(C);
-			if (editob && editob->type == OB_FONT) return 0;  // XXX - so we can use the spacebar for entering text
+			if (editob && editob->type == OB_FONT) return 0;  /* XXX - so we can use the spacebar for entering text */
 		}
 	}
 	return 1;
@@ -1714,7 +1818,7 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 {
 	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
 		return WM_operator_call_notest(C, op);
-	} 
+	}
 	else {
 		/* XXX TODO solve where to get last linked library from */
 		if (G.lib[0] != '\0') {
@@ -2025,7 +2129,6 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 {
 	char path[FILE_MAX];
 	int fileflags;
-	int copy = 0;
 
 	save_set_compress(op);
 	
@@ -2035,29 +2138,27 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 		BLI_strncpy(path, G.main->name, FILE_MAX);
 		untitled(path);
 	}
-
-	if (RNA_struct_property_is_set(op->ptr, "copy"))
-		copy = RNA_boolean_get(op->ptr, "copy");
 	
 	fileflags = G.fileflags;
 
 	/* set compression flag */
-	if (RNA_boolean_get(op->ptr, "compress")) fileflags |=  G_FILE_COMPRESS;
-	else fileflags &= ~G_FILE_COMPRESS;
-	if (RNA_boolean_get(op->ptr, "relative_remap")) fileflags |=  G_FILE_RELATIVE_REMAP;
-	else fileflags &= ~G_FILE_RELATIVE_REMAP;
+	BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"),
+	                 G_FILE_COMPRESS);
+	BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
+	                 G_FILE_RELATIVE_REMAP);
+	BKE_BIT_TEST_SET(fileflags,
+	                 (RNA_struct_property_is_set(op->ptr, "copy") &&
+	                  RNA_boolean_get(op->ptr, "copy")),
+	                 G_FILE_SAVE_COPY);
+
 #ifdef USE_BMESH_SAVE_AS_COMPAT
-	/* property only exists for 'Save As' */
-	if (RNA_struct_find_property(op->ptr, "use_mesh_compat")) {
-		if (RNA_boolean_get(op->ptr, "use_mesh_compat")) fileflags |=  G_FILE_MESH_COMPAT;
-		else fileflags &= ~G_FILE_MESH_COMPAT;
-	}
-	else {
-		fileflags &= ~G_FILE_MESH_COMPAT;
-	}
+	BKE_BIT_TEST_SET(fileflags,
+	                 (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
+	                  RNA_boolean_get(op->ptr, "use_mesh_compat")),
+	                 G_FILE_MESH_COMPAT);
 #endif
 
-	if (WM_file_write(C, path, fileflags, op->reports, copy) != 0)
+	if (WM_file_write(C, path, fileflags, op->reports) != 0)
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_notifier(C, NC_WM | ND_FILESAVE, NULL);
@@ -2110,7 +2211,6 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
 static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	char name[FILE_MAX];
-	int check_existing = 1;
 	int ret;
 	
 	/* cancel if no active window */
@@ -2130,13 +2230,9 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 	untitled(name);
 	
 	RNA_string_set(op->ptr, "filepath", name);
-	
-	if (RNA_struct_find_property(op->ptr, "check_existing"))
-		if (RNA_boolean_get(op->ptr, "check_existing") == 0)
-			check_existing = 0;
-	
+
 	if (G.save_over) {
-		if (check_existing && BLI_exists(name)) {
+		if (BLI_exists(name)) {
 			uiPupMenuSaveOver(C, op, name);
 			ret = OPERATOR_RUNNING_MODAL;
 		}
@@ -2183,7 +2279,7 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op)
 {
 	WM_operator_free(op);
 	
-	WM_exit(C);	
+	WM_exit(C);
 	
 	return OPERATOR_FINISHED;
 }
@@ -2281,10 +2377,10 @@ static int border_apply_rect(wmOperator *op)
 
 	
 	/* operator arguments and storage. */
-	RNA_int_set(op->ptr, "xmin", MIN2(rect->xmin, rect->xmax));
-	RNA_int_set(op->ptr, "ymin", MIN2(rect->ymin, rect->ymax));
-	RNA_int_set(op->ptr, "xmax", MAX2(rect->xmin, rect->xmax));
-	RNA_int_set(op->ptr, "ymax", MAX2(rect->ymin, rect->ymax));
+	RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax));
+	RNA_int_set(op->ptr, "ymin", min_ii(rect->ymin, rect->ymax));
+	RNA_int_set(op->ptr, "xmax", max_ii(rect->xmin, rect->xmax));
+	RNA_int_set(op->ptr, "ymax", max_ii(rect->ymin, rect->ymax));
 
 	return 1;
 }
@@ -3129,7 +3225,7 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
 
 	/* check flags */
 	if ((flags & RC_PROP_REQUIRE_BOOL) && (flags & RC_PROP_REQUIRE_FLOAT)) {
-		BKE_reportf(op->reports, RPT_ERROR, "Property can't be both boolean and float");
+		BKE_report(op->reports, RPT_ERROR, "Property cannot be both boolean and float");
 		return 0;
 	}
 
@@ -3152,7 +3248,7 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
 		if (flags & RC_PROP_ALLOW_MISSING)
 			return 1;
 		else {
-			BKE_reportf(op->reports, RPT_ERROR, "Couldn't resolve path %s", name);
+			BKE_reportf(op->reports, RPT_ERROR, "Could not resolve path '%s'", name);
 			return 0;
 		}
 	}
@@ -3165,8 +3261,7 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
 		    ((flags & RC_PROP_REQUIRE_FLOAT) && prop_type != PROP_FLOAT))
 		{
 			MEM_freeN(str);
-			BKE_reportf(op->reports, RPT_ERROR,
-			            "Property from path %s is not a float", name);
+			BKE_reportf(op->reports, RPT_ERROR, "Property from path '%s' is not a float", name);
 			return 0;
 		}
 	}
@@ -3174,8 +3269,7 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
 	/* check property's array length */
 	if (*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
 		MEM_freeN(str);
-		BKE_reportf(op->reports, RPT_ERROR,
-		            "Property from path %s has length %d instead of %d",
+		BKE_reportf(op->reports, RPT_ERROR, "Property from path '%s' has length %d instead of %d",
 		            name, len, req_length);
 		return 0;
 	}
@@ -3243,8 +3337,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
 	else if (rc->image_id_ptr.data) {
 		/* extra check, pointer must be to an ID */
 		if (!RNA_struct_is_ID(rc->image_id_ptr.type)) {
-			BKE_report(op->reports, RPT_ERROR,
-			           "Pointer from path image_id is not an ID");
+			BKE_report(op->reports, RPT_ERROR, "Pointer from path image_id is not an ID");
 			return 0;
 		}
 	}
@@ -3485,7 +3578,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
 		if (type == 0) {
 			if (ar)
 				ED_region_do_draw(C, ar);
-		} 
+		}
 		else if (type == 1) {
 			wmWindow *win = CTX_wm_window(C);
 			
@@ -3706,6 +3799,7 @@ void wm_operatortype_init(void)
 	WM_operatortype_append(WM_OT_memory_statistics);
 	WM_operatortype_append(WM_OT_dependency_relations);
 	WM_operatortype_append(WM_OT_debug_menu);
+	WM_operatortype_append(WM_OT_operator_defaults);
 	WM_operatortype_append(WM_OT_splash);
 	WM_operatortype_append(WM_OT_search_menu);
 	WM_operatortype_append(WM_OT_call_menu);
@@ -3858,7 +3952,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_border");
-	WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border"); // XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel
+	WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border"); /* XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel */
 }
 
 /* zoom to border modal operators */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 35cc154..8b38719 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -61,6 +61,7 @@
 
 #include "BKE_blender.h"
 #include "BKE_global.h"
+#include "BKE_image.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
@@ -74,21 +75,25 @@
 
 #include "WM_api.h"  /* only for WM_main_playanim */
 
+struct PlayState;
+static void playanim_window_zoom(const struct PlayState *ps, const float zoom_offset);
+
 typedef struct PlayState {
 
 	/* playback state */
 	short direction;
-	short next;
+	short next_frame;
 	short once;
 	short turbo;
 	short pingpong;
 	short noskip;
 	short sstep;
-	short pause;
 	short wait2;
 	short stopped;
 	short go;
 
+	int fstep;
+
 	/* current picture */
 	struct PlayAnimPict *picture;
 
@@ -130,6 +135,7 @@ typedef enum eWS_Qual {
 	WS_QUAL_ALT     = (WS_QUAL_LALT | WS_QUAL_RALT),
 	WS_QUAL_LCTRL   = (1 << 4),
 	WS_QUAL_RCTRL   = (1 << 5),
+	WS_QUAL_CTRL    = (WS_QUAL_LCTRL | WS_QUAL_RCTRL),
 	WS_QUAL_LMOUSE  = (1 << 16),
 	WS_QUAL_MMOUSE  = (1 << 17),
 	WS_QUAL_RMOUSE  = (1 << 18),
@@ -177,27 +183,12 @@ static void playanim_event_qual_update(void)
 
 	/* Alt */
 	GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftAlt, &val);
-	if (val) g_WS.qual |=  WS_QUAL_LCTRL;
-	else     g_WS.qual &= ~WS_QUAL_LCTRL;
+	if (val) g_WS.qual |=  WS_QUAL_LALT;
+	else     g_WS.qual &= ~WS_QUAL_LALT;
 
 	GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightAlt, &val);
-	if (val) g_WS.qual |=  WS_QUAL_RCTRL;
-	else     g_WS.qual &= ~WS_QUAL_RCTRL;
-
-	/* LMB */
-	GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskLeft, &val);
-	if (val) g_WS.qual |=  WS_QUAL_LMOUSE;
-	else     g_WS.qual &= ~WS_QUAL_LMOUSE;
-
-	/* MMB */
-	GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskMiddle, &val);
-	if (val) g_WS.qual |=  WS_QUAL_MMOUSE;
-	else     g_WS.qual &= ~WS_QUAL_MMOUSE;
-
-	/* RMB */
-	GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskRight, &val);
-	if (val) g_WS.qual |=  WS_QUAL_RMOUSE;
-	else     g_WS.qual &= ~WS_QUAL_RMOUSE;
+	if (val) g_WS.qual |=  WS_QUAL_RALT;
+	else     g_WS.qual &= ~WS_QUAL_RALT;
 }
 
 typedef struct PlayAnimPict {
@@ -213,10 +204,24 @@ typedef struct PlayAnimPict {
 
 static struct ListBase picsbase = {NULL, NULL};
 static int fromdisk = FALSE;
-static int fstep = 1;
 static float zoomx = 1.0, zoomy = 1.0;
 static double ptottime = 0.0, swaptime = 0.04;
 
+static PlayAnimPict *playanim_step(PlayAnimPict *playanim, int step)
+{
+	if (step > 0) {
+		while (step-- && playanim) {
+			playanim = playanim->next;
+		}
+	}
+	else if (step < 0) {
+		while (step++ && playanim) {
+			playanim = playanim->prev;
+		}
+	}
+	return playanim;
+}
+
 static int pupdate_time(void)
 {
 	static double ltime;
@@ -229,11 +234,11 @@ static int pupdate_time(void)
 	return (ptottime < 0);
 }
 
-static void playanim_toscreen(PlayAnimPict *picture, struct ImBuf *ibuf, int fontid)
+static void playanim_toscreen(PlayAnimPict *picture, struct ImBuf *ibuf, int fontid, int fstep)
 {
 
 	if (ibuf == NULL) {
-		printf("no ibuf !\n");
+		printf("%s: no ibuf for picture '%s'\n", __func__, picture ? picture->name : "<NIL>");
 		return;
 	}
 	if (ibuf->rect == NULL && ibuf->rect_float) {
@@ -287,7 +292,7 @@ static void build_pict_list(char *first, int totframes, int fstep, int fontid)
 			int pic;
 			ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
 			if (ibuf) {
-				playanim_toscreen(NULL, ibuf, fontid);
+				playanim_toscreen(NULL, ibuf, fontid, fstep);
 				IMB_freeImBuf(ibuf);
 			}
 
@@ -390,7 +395,7 @@ static void build_pict_list(char *first, int totframes, int fstep, int fontid)
 					ibuf = IMB_loadiffname(picture->name, picture->IB_flags, NULL);
 				}
 				if (ibuf) {
-					playanim_toscreen(picture, ibuf, fontid);
+					playanim_toscreen(picture, ibuf, fontid, fstep);
 					IMB_freeImBuf(ibuf);
 				}
 				pupdate_time();
@@ -431,6 +436,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 		ps->stopped = FALSE;
 	}
 
+	if (ps->wait2) {
+		pupdate_time();
+		ptottime = 0;
+	}
+
 	switch (type) {
 		case GHOST_kEventKeyDown:
 		case GHOST_kEventKeyUp:
@@ -445,35 +455,44 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 				case GHOST_kKeyP:
 					if (val) ps->pingpong = !ps->pingpong;
 					break;
+				case GHOST_kKey1:
 				case GHOST_kKeyNumpad1:
-					if (val) swaptime = fstep / 60.0;
+					if (val) swaptime = ps->fstep / 60.0;
 					break;
+				case GHOST_kKey2:
 				case GHOST_kKeyNumpad2:
-					if (val) swaptime = fstep / 50.0;
+					if (val) swaptime = ps->fstep / 50.0;
 					break;
+				case GHOST_kKey3:
 				case GHOST_kKeyNumpad3:
-					if (val) swaptime = fstep / 30.0;
+					if (val) swaptime = ps->fstep / 30.0;
 					break;
+				case GHOST_kKey4:
 				case GHOST_kKeyNumpad4:
 					if (g_WS.qual & WS_QUAL_SHIFT)
-						swaptime = fstep / 24.0;
+						swaptime = ps->fstep / 24.0;
 					else
-						swaptime = fstep / 25.0;
+						swaptime = ps->fstep / 25.0;
 					break;
+				case GHOST_kKey5:
 				case GHOST_kKeyNumpad5:
-					if (val) swaptime = fstep / 20.0;
+					if (val) swaptime = ps->fstep / 20.0;
 					break;
+				case GHOST_kKey6:
 				case GHOST_kKeyNumpad6:
-					if (val) swaptime = fstep / 15.0;
+					if (val) swaptime = ps->fstep / 15.0;
 					break;
+				case GHOST_kKey7:
 				case GHOST_kKeyNumpad7:
-					if (val) swaptime = fstep / 12.0;
+					if (val) swaptime = ps->fstep / 12.0;
 					break;
+				case GHOST_kKey8:
 				case GHOST_kKeyNumpad8:
-					if (val) swaptime = fstep / 10.0;
+					if (val) swaptime = ps->fstep / 10.0;
 					break;
+				case GHOST_kKey9:
 				case GHOST_kKeyNumpad9:
-					if (val) swaptime = fstep / 6.0;
+					if (val) swaptime = ps->fstep / 6.0;
 					break;
 				case GHOST_kKeyLeftArrow:
 					if (val) {
@@ -481,10 +500,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 						ps->wait2 = FALSE;
 						if (g_WS.qual & WS_QUAL_SHIFT) {
 							ps->picture = picsbase.first;
-							ps->next = 0;
+							ps->next_frame = 0;
 						}
 						else {
-							ps->next = -1;
+							ps->next_frame = -1;
 						}
 					}
 					break;
@@ -492,10 +511,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 					if (val) {
 						ps->wait2 = FALSE;
 						if (g_WS.qual & WS_QUAL_SHIFT) {
-							ps->next = ps->direction = -1;
+							ps->next_frame = ps->direction = -1;
 						}
 						else {
-							ps->next = -10;
+							ps->next_frame = -10;
 							ps->sstep = TRUE;
 						}
 					}
@@ -506,10 +525,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 						ps->wait2 = FALSE;
 						if (g_WS.qual & WS_QUAL_SHIFT) {
 							ps->picture = picsbase.last;
-							ps->next = 0;
+							ps->next_frame = 0;
 						}
 						else {
-							ps->next = 1;
+							ps->next_frame = 1;
 						}
 					}
 					break;
@@ -517,10 +536,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 					if (val) {
 						ps->wait2 = FALSE;
 						if (g_WS.qual & WS_QUAL_SHIFT) {
-							ps->next = ps->direction = 1;
+							ps->next_frame = ps->direction = 1;
 						}
 						else {
-							ps->next = 10;
+							ps->next_frame = 10;
 							ps->sstep = TRUE;
 						}
 					}
@@ -531,35 +550,15 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 					if (val) {
 						if (g_WS.qual & WS_QUAL_SHIFT) {
 							if (ps->curframe_ibuf)
-								printf(" Name: %s | Speed: %.2f frames/s\n", ps->curframe_ibuf->name, fstep / swaptime);
+								printf(" Name: %s | Speed: %.2f frames/s\n",
+								       ps->curframe_ibuf->name, ps->fstep / swaptime);
 						}
 						else {
-							swaptime = fstep / 5.0;
-						}
-					}
-					break;
-				case GHOST_kKeyEqual:
-					if (val) {
-						if (g_WS.qual & WS_QUAL_SHIFT) {
-							ps->pause++;
-							printf("pause:%d\n", ps->pause);
-						}
-						else {
-							swaptime /= 1.1;
-						}
-					}
-					break;
-				case GHOST_kKeyMinus:
-					if (val) {
-						if (g_WS.qual & WS_QUAL_SHIFT) {
-							ps->pause--;
-							printf("pause:%d\n", ps->pause);
-						}
-						else {
-							swaptime *= 1.1;
+							swaptime = ps->fstep / 5.0;
 						}
 					}
 					break;
+				case GHOST_kKey0:
 				case GHOST_kKeyNumpad0:
 					if (val) {
 						if (ps->once) {
@@ -578,6 +577,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 						ps->wait2 = ps->sstep = FALSE;
 					}
 					break;
+				case GHOST_kKeyPeriod:
 				case GHOST_kKeyNumpadPeriod:
 					if (val) {
 						if (ps->sstep) ps->wait2 = FALSE;
@@ -587,29 +587,28 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 						}
 					}
 					break;
+				case GHOST_kKeyEqual:
 				case GHOST_kKeyNumpadPlus:
+				{
 					if (val == 0) break;
-					zoomx += 2.0;
-					zoomy += 2.0;
-					/* no break??? - is this intentional? - campbell XXX25 */
+					if (g_WS.qual & WS_QUAL_CTRL) {
+						playanim_window_zoom(ps, 1.0f);
+					}
+					else {
+						swaptime /= 1.1;
+					}
+					break;
+				}
+				case GHOST_kKeyMinus:
 				case GHOST_kKeyNumpadMinus:
 				{
-					int sizex, sizey;
-					/* int ofsx, ofsy; */ /* UNUSED */
-
 					if (val == 0) break;
-					if (zoomx > 1.0) zoomx -= 1.0;
-					if (zoomy > 1.0) zoomy -= 1.0;
-					// playanim_window_get_position(&ofsx, &ofsy);
-					playanim_window_get_size(&sizex, &sizey);
-					/* ofsx += sizex / 2; */ /* UNUSED */
-					/* ofsy += sizey / 2; */ /* UNUSED */
-					sizex = zoomx * ps->ibufx;
-					sizey = zoomy * ps->ibufy;
-					/* ofsx -= sizex / 2; */ /* UNUSED */
-					/* ofsy -= sizey / 2; */ /* UNUSED */
-					// window_set_position(g_WS.ghost_window,sizex,sizey);
-					GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey);
+					if (g_WS.qual & WS_QUAL_CTRL) {
+						playanim_window_zoom(ps, -1.0f);
+					}
+					else {
+						swaptime *= 1.1;
+					}
 					break;
 				}
 				case GHOST_kKeyEsc:
@@ -620,6 +619,44 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 			}
 			break;
 		}
+		case GHOST_kEventButtonDown:
+		case GHOST_kEventButtonUp:
+		{
+			GHOST_TEventButtonData *bd = GHOST_GetEventData(evt);
+			int cx, cy, sizex, sizey, inside_window;
+			
+			GHOST_GetCursorPosition(g_WS.ghost_system, &cx, &cy);
+			GHOST_ScreenToClient(g_WS.ghost_window, cx, cy, &cx, &cy);
+			playanim_window_get_size(&sizex, &sizey);
+
+			inside_window = (cx >= 0 && cx < sizex && cy >= 0 && cy <= sizey);
+			
+			if (bd->button == GHOST_kButtonMaskLeft) {
+				if (type == GHOST_kEventButtonDown) {
+					if (inside_window)
+						g_WS.qual |= WS_QUAL_LMOUSE;
+				}
+				else
+					g_WS.qual &= ~WS_QUAL_LMOUSE;
+			}
+			else if (bd->button == GHOST_kButtonMaskMiddle) {
+				if (type == GHOST_kEventButtonDown) {
+					if (inside_window)
+						g_WS.qual |= WS_QUAL_MMOUSE;
+				}
+				else
+					g_WS.qual &= ~WS_QUAL_MMOUSE;
+			}
+			else if (bd->button == GHOST_kButtonMaskRight) {
+				if (type == GHOST_kEventButtonDown) {
+					if (inside_window)
+						g_WS.qual |= WS_QUAL_RMOUSE;
+				}
+				else
+					g_WS.qual &= ~WS_QUAL_RMOUSE;
+			}
+			break;
+		}
 		case GHOST_kEventCursorMove:
 		{
 			if (g_WS.qual & WS_QUAL_LMOUSE) {
@@ -647,10 +684,15 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 				}
 				ps->sstep = TRUE;
 				ps->wait2 = FALSE;
-				ps->next = 0;
+				ps->next_frame = 0;
 			}
 			break;
 		}
+		case GHOST_kEventWindowActivate:
+		case GHOST_kEventWindowDeactivate: {
+			g_WS.qual &= ~WS_QUAL_MOUSE;
+			break;
+		}
 		case GHOST_kEventWindowSize:
 		case GHOST_kEventWindowMove:
 		{
@@ -664,10 +706,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 
 			zoomx = (float) sizex / ps->ibufx;
 			zoomy = (float) sizey / ps->ibufy;
-			zoomx = floor(zoomx + 0.5);
-			zoomy = floor(zoomy + 0.5);
-			if (zoomx < 1.0) zoomx = 1.0;
-			if (zoomy < 1.0) zoomy = 1.0;
+			zoomx = floor(zoomx + 0.5f);
+			zoomy = floor(zoomy + 0.5f);
+			if (zoomx < 1.0f) zoomx = 1.0f;
+			if (zoomy < 1.0f) zoomy = 1.0f;
 
 			sizex = zoomx * ps->ibufx;
 			sizey = zoomy * ps->ibufy;
@@ -675,7 +717,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
 			glPixelZoom(zoomx, zoomy);
 			glEnable(GL_DITHER);
 			ptottime = 0.0;
-			playanim_toscreen(ps->picture, ps->curframe_ibuf, ps->fontid);
+			playanim_toscreen(ps->picture, ps->curframe_ibuf, ps->fontid, ps->fstep);
 
 			break;
 		}
@@ -715,6 +757,25 @@ static void playanim_window_open(const char *title, int posx, int posy, int size
 	                                       FALSE /* no stereo */, FALSE);
 }
 
+static void playanim_window_zoom(const PlayState *ps, const float zoom_offset)
+{
+	int sizex, sizey;
+	/* int ofsx, ofsy; */ /* UNUSED */
+
+	if (zoomx + zoom_offset > 0.0f) zoomx += zoom_offset;
+	if (zoomy + zoom_offset > 0.0f) zoomy += zoom_offset;
+
+	// playanim_window_get_position(&ofsx, &ofsy);
+	playanim_window_get_size(&sizex, &sizey);
+	/* ofsx += sizex / 2; */ /* UNUSED */
+	/* ofsy += sizey / 2; */ /* UNUSED */
+	sizex = zoomx * ps->ibufx;
+	sizey = zoomy * ps->ibufy;
+	/* ofsx -= sizex / 2; */ /* UNUSED */
+	/* ofsy -= sizey / 2; */ /* UNUSED */
+	// window_set_position(g_WS.ghost_window,sizex,sizey);
+	GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey);
+}
 
 void WM_main_playanim(int argc, const char **argv)
 {
@@ -735,18 +796,19 @@ void WM_main_playanim(int argc, const char **argv)
 	/* ps.doubleb   = TRUE;*/ /* UNUSED */
 	ps.go        = TRUE;
 	ps.direction = TRUE;
-	ps.next      = TRUE;
+	ps.next_frame = 1;
 	ps.once      = FALSE;
 	ps.turbo     = FALSE;
 	ps.pingpong  = FALSE;
 	ps.noskip    = FALSE;
 	ps.sstep     = FALSE;
-	ps.pause     = FALSE;
 	ps.wait2     = FALSE;
 	ps.stopped   = FALSE;
 	ps.picture   = NULL;
 	/* resetmap = FALSE */
 
+	ps.fstep     = 1;
+
 	ps.fontid = -1;
 
 	while (argc > 1) {
@@ -794,8 +856,8 @@ void WM_main_playanim(int argc, const char **argv)
 					argv++;
 					break;
 				case 'j':
-					fstep = MIN2(MAXFRAME, MAX2(1, atoi(argv[2])));
-					swaptime *= fstep;
+					ps.fstep = MIN2(MAXFRAME, MAX2(1, atoi(argv[2])));
+					swaptime *= ps.fstep;
 					argc--;
 					argv++;
 					break;
@@ -894,11 +956,11 @@ void WM_main_playanim(int argc, const char **argv)
 		efra = MAXFRAME;
 	}
 
-	build_pict_list(filepath, (efra - sfra) + 1, fstep, ps.fontid);
+	build_pict_list(filepath, (efra - sfra) + 1, ps.fstep, ps.fontid);
 
 	for (i = 2; i < argc; i++) {
 		BLI_strncpy(filepath, argv[i], sizeof(filepath));
-		build_pict_list(filepath, (efra - sfra) + 1, fstep, ps.fontid);
+		build_pict_list(filepath, (efra - sfra) + 1, ps.fstep, ps.fontid);
 	}
 
 	IMB_freeImBuf(ibuf);
@@ -936,6 +998,7 @@ void WM_main_playanim(int argc, const char **argv)
 		if (ptottime > 0.0) ptottime = 0.0;
 
 		while (ps.picture) {
+			int hasevent;
 #ifndef USE_IMB_CACHE
 			if (ibuf != NULL && ibuf->ftype == 0) IMB_freeImBuf(ibuf);
 #endif
@@ -970,7 +1033,7 @@ void WM_main_playanim(int argc, const char **argv)
 
 				while (pupdate_time()) PIL_sleep_ms(1);
 				ptottime -= swaptime;
-				playanim_toscreen(ps.picture, ibuf, ps.fontid);
+				playanim_toscreen(ps.picture, ibuf, ps.fontid, ps.fstep);
 			} /* else deleten */
 			else {
 				printf("error: can't play this image type\n");
@@ -986,22 +1049,25 @@ void WM_main_playanim(int argc, const char **argv)
 				}
 			}
 
-			ps.next = ps.direction;
+			ps.next_frame = ps.direction;
 
 
-			{
-				int hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0);
+			while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0) || ps.wait2 != 0)) {
 				if (hasevent) {
 					GHOST_DispatchEvents(g_WS.ghost_system);
 				}
-			}
-
-			/* XXX25 - we should not have to do this, but it makes scrubbing functional! */
-			if (g_WS.qual & WS_QUAL_LMOUSE) {
-				ps.next = 0;
-			}
-			else {
-				ps.sstep = 0;
+				if (ps.wait2) {
+					if (hasevent) {
+						if (ibuf) {
+							while (pupdate_time()) PIL_sleep_ms(1);
+							ptottime -= swaptime;
+							playanim_toscreen(ps.picture, ibuf, ps.fontid, ps.fstep);
+						}
+					}
+				}
+				if (!ps.go) {
+					break;
+				}
 			}
 
 			ps.wait2 = ps.sstep;
@@ -1012,15 +1078,10 @@ void WM_main_playanim(int argc, const char **argv)
 
 			pupdate_time();
 
-			if (ps.picture && ps.next) {
+			if (ps.picture && ps.next_frame) {
 				/* always at least set one step */
 				while (ps.picture) {
-					if (ps.next < 0) {
-						ps.picture = ps.picture->prev;
-					}
-					else {
-						ps.picture = ps.picture->next;
-					}
+					ps.picture = playanim_step(ps.picture, ps.next_frame);
 
 					if (ps.once && ps.picture != NULL) {
 						if (ps.picture->next == NULL) {
@@ -1035,12 +1096,7 @@ void WM_main_playanim(int argc, const char **argv)
 					ptottime -= swaptime;
 				}
 				if (ps.picture == NULL && ps.sstep) {
-					if (ps.next < 0) {
-						ps.picture = picsbase.last;
-					}
-					else if (ps.next > 0) {
-						ps.picture = picsbase.first;
-					}
+					ps.picture = playanim_step(ps.picture, ps.next_frame);
 				}
 			}
 			if (ps.go == FALSE) {
@@ -1079,6 +1135,7 @@ void WM_main_playanim(int argc, const char **argv)
 	/* we still miss freeing a lot!,
 	 * but many areas could skip initialization too for anim play */
 	IMB_exit();
+	BKE_images_exit();
 	BLF_exit();
 #endif
 	GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 4078a88..8533494 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -163,10 +163,6 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct)
 	win->curswin = swin = MEM_callocN(sizeof(wmSubWindow), "swinopen");
 	BLI_addtail(&win->subwindows, swin);
 	
-	if (G.debug & G_DEBUG_EVENTS) {
-		printf("%s: swin %d added\n", __func__, freewinid);
-	}
-
 	swin->swinid = freewinid;
 	swin->winrct = *winrct;
 
@@ -192,7 +188,7 @@ void wm_subwindow_close(wmWindow *win, int swinid)
 		wm_subwindow_free(swin);
 		BLI_remlink(&win->subwindows, swin);
 		MEM_freeN(swin);
-	} 
+	}
 	else {
 		printf("%s: Internal error, bad winid: %d\n", __func__, swinid);
 	}
@@ -398,7 +394,7 @@ int WM_framebuffer_to_index(unsigned int col)
 			return col & 0xFFFFFF;
 		default: // 18 bits...
 			return ((col & 0xFC0000) >> 6) + ((col & 0xFC00) >> 4) + ((col & 0xFC) >> 2);
-	}		
+	}
 }
 
 
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 4482730..09f7e16 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -164,7 +164,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
 
 		if (CTX_wm_window(C) == win)
 			CTX_wm_window_set(C, NULL);
-	}	
+	}
 
 	/* always set drawable and active to NULL,
 	 * prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
@@ -333,8 +333,14 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
 static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
 {
 	GHOST_WindowHandle ghostwin;
+	static int multisamples = -1;
 	int scr_w, scr_h, posy;
 	
+	/* force setting multisamples only once, it requires restart - and you cannot 
+	 * mix it, either all windows have it, or none (tested in OSX opengl) */
+	if (multisamples == -1)
+		multisamples = U.ogl_multisamples;
+	
 	wm_get_screensize(&scr_w, &scr_h);
 	posy = (scr_h - win->posy - win->sizey);
 	
@@ -345,7 +351,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
 	                              (GHOST_TWindowState)win->windowstate,
 	                              GHOST_kDrawingContextTypeOpenGL,
 	                              0 /* no stereo */,
-	                              0 /* no AA */);
+	                              multisamples /* AA */);
 	
 	if (ghostwin) {
 		/* needed so we can detect the graphics card below */
@@ -373,7 +379,6 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
 		
 		/* standard state vars for window */
 		glEnable(GL_SCISSOR_TEST);
-		
 		GPU_state_init();
 	}
 }
@@ -414,6 +419,10 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
 				win->posy = wm_init_state.start_y;
 				win->sizex = wm_init_state.size_x;
 				win->sizey = wm_init_state.size_y;
+
+				/* we can't properly resize a maximized window */
+				win->windowstate = GHOST_kWindowStateNormal;
+
 				wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
 			}
 
@@ -648,7 +657,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 		else if (!GHOST_ValidWindow(g_system, ghostwin)) {
 			/* XXX - should be checked, why are we getting an event here, and */
 			/* what is it? */
-			puts("<!> event has invalid window");			
+			puts("<!> event has invalid window");
 			return 1;
 		}
 		else {
@@ -745,6 +754,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 				state = GHOST_GetWindowState(win->ghostwin);
 				win->windowstate = state;
 
+				/* stop screencast if resize */
+				if (type == GHOST_kEventWindowSize) {
+					WM_jobs_stop(CTX_wm_manager(C), win->screen, NULL);
+				}
+				
 				/* win32: gives undefined window size when minimized */
 				if (state != GHOST_kWindowStateMinimized) {
 					GHOST_RectangleHandle client_rect;
@@ -941,6 +955,8 @@ static int wm_window_timer(const bContext *C)
 					wmEvent event = *(win->eventstate);
 					
 					event.type = wt->event_type;
+					event.val = 0;
+					event.keymodifier = 0;
 					event.custom = EVT_DATA_TIMER;
 					event.customdata = wt;
 					wm_event_add(win, &event);
@@ -1001,7 +1017,7 @@ void wm_ghost_init(bContext *C)
 		
 		g_system = GHOST_CreateSystem();
 		GHOST_AddEventConsumer(g_system, consumer);
-	}	
+	}
 }
 
 void wm_ghost_exit(void)
@@ -1076,7 +1092,7 @@ char *WM_clipboard_text_get(int selection)
 		return NULL;
 	
 	/* always convert from \r\n to \n */
-	newbuf = MEM_callocN(strlen(buf) + 1, "WM_clipboard_text_get");
+	newbuf = MEM_callocN(strlen(buf) + 1, __func__);
 
 	for (p = buf, p2 = newbuf; *p; p++) {
 		if (*p != '\r')
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index a33d37a..2d0dd2e 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -32,10 +32,10 @@
 #define __WM_EVENT_SYSTEM_H__
 
 /* return value of handler-operator call */
-#define WM_HANDLER_CONTINUE	0
-#define WM_HANDLER_BREAK	1
-#define WM_HANDLER_HANDLED	2
-#define WM_HANDLER_MODAL	4 /* MODAL|BREAK means unhandled */
+#define WM_HANDLER_CONTINUE  0
+#define WM_HANDLER_BREAK     1
+#define WM_HANDLER_HANDLED   2
+#define WM_HANDLER_MODAL     4 /* MODAL|BREAK means unhandled */
 
 struct ScrArea;
 struct ARegion;
@@ -44,40 +44,40 @@ struct ARegion;
 
 typedef struct wmEventHandler {
 	struct wmEventHandler *next, *prev;
-	
-	int type, flag;				/* type default=0, rest is custom */
-	
+
+	int type, flag;                     /* type default=0, rest is custom */
+
 	/* keymap handler */
-	wmKeyMap *keymap;			/* pointer to builtin/custom keymaps */
-	rcti *bblocal, *bbwin;		/* optional local and windowspace bb */
-	
+	wmKeyMap *keymap;                   /* pointer to builtin/custom keymaps */
+	rcti *bblocal, *bbwin;              /* optional local and windowspace bb */
+
 	/* modal operator handler */
-	wmOperator *op;						/* for derived/modal handlers */
-	struct ScrArea *op_area;			/* for derived/modal handlers */
-	struct ARegion *op_region;			/* for derived/modal handlers */
+	wmOperator *op;                     /* for derived/modal handlers */
+	struct ScrArea *op_area;            /* for derived/modal handlers */
+	struct ARegion *op_region;          /* for derived/modal handlers */
 
 	/* ui handler */
-	wmUIHandlerFunc ui_handle;  		/* callback receiving events */
-	wmUIHandlerRemoveFunc ui_remove;	/* callback when handler is removed */
-	void *ui_userdata;					/* user data pointer */
-	struct ScrArea *ui_area;			/* for derived/modal handlers */
-	struct ARegion *ui_region;			/* for derived/modal handlers */
-	struct ARegion *ui_menu;			/* for derived/modal handlers */
-	
+	wmUIHandlerFunc ui_handle;          /* callback receiving events */
+	wmUIHandlerRemoveFunc ui_remove;    /* callback when handler is removed */
+	void *ui_userdata;                  /* user data pointer */
+	struct ScrArea *ui_area;            /* for derived/modal handlers */
+	struct ARegion *ui_region;          /* for derived/modal handlers */
+	struct ARegion *ui_menu;            /* for derived/modal handlers */
+
 	/* fileselect handler re-uses modal operator data */
-	struct bScreen *filescreen;			/* screen it started in, to validate exec */
-	
+	struct bScreen *filescreen;         /* screen it started in, to validate exec */
+
 	/* drop box handler */
 	ListBase *dropboxes;
-	
+
 } wmEventHandler;
 
 
 /* handler flag */
 		/* after this handler all others are ignored */
-#define WM_HANDLER_BLOCKING		1
+#define WM_HANDLER_BLOCKING     1
 		/* handler tagged to be freed in wm_handlers_do() */
-#define WM_HANDLER_DO_FREE		2
+#define WM_HANDLER_DO_FREE      2
 
 
 
@@ -89,23 +89,23 @@ enum {
 
 
 /* wm_event_system.c */
-void		wm_event_free_all		(wmWindow *win);
-void		wm_event_free			(wmEvent *event);
-void		wm_event_free_handler	(wmEventHandler *handler);
+void        wm_event_free_all       (wmWindow *win);
+void        wm_event_free           (wmEvent *event);
+void        wm_event_free_handler   (wmEventHandler *handler);
 
-			/* goes over entire hierarchy:  events -> window -> screen -> area -> region */
-void		wm_event_do_handlers	(bContext *C);
+            /* goes over entire hierarchy:  events -> window -> screen -> area -> region */
+void        wm_event_do_handlers    (bContext *C);
 
-void		wm_event_add_ghostevent	(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata);
+void        wm_event_add_ghostevent (wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata);
 
-void		wm_event_do_notifiers	(bContext *C);
+void        wm_event_do_notifiers   (bContext *C);
 
 /* wm_keymap.c */
 
 /* wm_dropbox.c */
-void		wm_dropbox_free(void);
-void		wm_drags_check_ops(bContext *C, wmEvent *event);
-void		wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
+void        wm_dropbox_free(void);
+void        wm_drags_check_ops(bContext *C, wmEvent *event);
+void        wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
 
 #endif /* __WM_EVENT_SYSTEM_H__ */
 
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 95a8a7d..4d3d6ef 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -285,7 +285,8 @@ enum {
 
 /* for event checks */
 	/* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
-#define ISTEXTINPUT(event)  (event >= ' ' && event <= 255)
+	/* UNUSED - see wm_eventmatch - BUG [#30479] */
+// #define ISTEXTINPUT(event)  (event >= ' ' && event <= 255)
 
 	/* test whether the event is a key on the keyboard */
 #define ISKEYBOARD(event)  (event >= ' ' && event <= 320)
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 04d4be0..85bb07d 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -60,7 +60,7 @@ elseif(APPLE)
 	add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c)
 	# setup Info.plist
 	execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
-	set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
+	set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
 	set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
 	set_target_properties(blenderplayer PROPERTIES
 		MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO}
@@ -148,6 +148,7 @@ endif()
 		extern_recastnavigation
 		bf_intern_raskter
 		bf_intern_opencolorio
+		bf_intern_opennl
 	)
 
 	if(WITH_MOD_CLOTH_ELTOPO)
@@ -169,10 +170,6 @@ endif()
 
 	list(APPEND BLENDER_SORTED_LIBS extern_colamd)
 
-	if(WITH_MOD_DECIMATE)
-		list(APPEND BLENDER_SORTED_LIBS bf_intern_decimate)
-	endif()
-
 	if(WITH_MOD_BOOLEAN)
 		list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
 		list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
@@ -194,6 +191,10 @@ endif()
 		list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
 	endif()
 
+	if(WITH_INTERNATIONAL)
+		list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
+	endif()
+
 	foreach(SORTLIB ${BLENDER_SORTED_LIBS})
 		set(REMLIB ${SORTLIB})
 		foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index c6383b4..5e38dad 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -60,7 +60,6 @@ struct Image;
 struct ImageUser;
 struct KeyingSet;
 struct KeyingSetInfo;
-struct LOD_Decimation_Info;
 struct MCol;
 struct MTex;
 struct Main;
@@ -76,6 +75,7 @@ struct Nurb;
 struct Object;
 struct PBVHNode;
 struct PyObject;
+struct Quadric;
 struct Render;
 struct RenderEngine;
 struct RenderEngineType;
@@ -134,6 +134,13 @@ int BLI_smallhash_count(struct SmallHash *hash) { return 0; }
 void *BLI_smallhash_iternext(struct SmallHashIter *iter, uintptr_t *key) { return NULL; }
 void *BLI_smallhash_iternew(struct SmallHash *hash, struct SmallHashIter *iter, uintptr_t *key) { return NULL; }
 
+void  BLI_quadric_from_v3_dist(struct Quadric *q, const float v[3], const float offset) {}
+void  BLI_quadric_add_qu_qu(struct Quadric *a, const struct Quadric *b) {}
+void  BLI_quadric_add_qu_ququ(struct Quadric *r, const struct Quadric *a, const struct Quadric *b) {}
+void  BLI_quadric_mul(struct Quadric *a, const float scalar) {}
+float BLI_quadric_evaluate(const struct Quadric *q, const float v[3]) {return 0.0f;}
+int   BLI_quadric_optimize(const struct Quadric *q, float v[3]) {return 0;}
+
 float *RE_RenderLayerGetPass(struct RenderLayer *rl, int passtype) {return (float *) NULL;}
 float RE_filter_value(int type, float x) {return 0.0f;}
 struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name) {return (struct RenderLayer *)NULL;}
@@ -191,7 +198,7 @@ struct MenuType *WM_menutype_find(const char *idname, int quiet) {return (struct
 void WM_operator_stack_clear(struct bContext *C) {}
 
 void WM_autosave_init(struct bContext *C) {}
-void WM_jobs_stop_all(struct wmWindowManager *wm) {}
+void WM_jobs_kill_all_except(struct wmWindowManager *wm) {}
 
 char *WM_clipboard_text_get(int selection) {return (char*)0;}
 void WM_clipboard_text_set(char *buf, int selection) {}
@@ -297,6 +304,7 @@ struct BGpic *ED_view3D_background_image_new(struct View3D *v3d) {return (struct
 void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic) {}
 void ED_view3D_background_image_clear(struct View3D *v3d) {}
 void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[][4], float winmat[][4]) {}
+float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit) {return 0.0f;}
 void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist) {}
 int text_file_modified(struct Text *text) {return 0;}
 void ED_node_shader_default(struct Material *ma) {}
@@ -414,7 +422,7 @@ void uiTemplateEditModeSelection(struct uiLayout *layout, struct bContext *C) {}
 void uiTemplateTextureImage(struct uiLayout *layout, struct bContext *C, struct Tex *tex) {}
 void uiTemplateImage(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *userptr, int compact) {}
 void uiTemplateDopeSheetFilter(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr) {}
-void uiTemplateColorWheel(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider) {}
+void uiTemplateColorPicker(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider) {}
 void uiTemplateHistogram(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
 void uiTemplateReportsBanner(struct uiLayout *layout, struct bContext *C, struct wmOperator *op) {}
 void uiTemplateWaveform(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
@@ -452,6 +460,9 @@ void RE_engine_report(struct RenderEngine *engine, int type, const char *msg) {}
 ListBase R_engines = {NULL, NULL};
 void RE_engine_free(struct RenderEngine *engine) {}
 struct RenderEngineType *RE_engines_find(const char *idname) { return NULL; }
+void RE_engine_update_memory_stats(struct RenderEngine *engine, float mem_used, float mem_peak) {};
+struct RenderEngine *RE_engine_create(struct RenderEngineType *type) { return NULL; };
+void RE_FreePersistentData(void) {}
 
 /* python */
 struct wmOperatorType *WM_operatortype_find(const char *idname, int quiet) {return (struct wmOperatorType *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 1880957..b66c000 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -469,30 +469,19 @@ elseif(WIN32)
 		DESTINATION ${TARGETDIR}
 	)
 
-	if(WITH_INTERNATIONAL AND (NOT WITH_MINGW64))
-		install(
-			FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
-			DESTINATION ${TARGETDIR}
-		)
-
-		if(NOT CMAKE_CL_64)
-			install(
-				FILES ${LIBDIR}/iconv/lib/iconv.dll
-				DESTINATION ${TARGETDIR}
-			)
-		endif()
-	endif()
-
 	if(WITH_PYTHON)
 		set_lib_path(PYLIB "python")
+
+		STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
+
 		install(
-			FILES ${PYLIB}/lib/python32.dll
+			FILES ${PYLIB}/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
 			DESTINATION ${TARGETDIR}
 			CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
 		)
 
 		install(
-			FILES ${PYLIB}/lib/python32_d.dll
+			FILES ${PYLIB}/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
 			DESTINATION ${TARGETDIR}
 			CONFIGURATIONS Debug
 		)
@@ -516,10 +505,10 @@ elseif(WIN32)
 				"
 				if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
 					execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
-						\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
+						\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_d.tar.gz\")
 				else()
 					execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
-						\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
+						\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}.tar.gz\")
 				endif()
 				"
 			)
@@ -527,10 +516,12 @@ elseif(WIN32)
 			# doesnt work, todo
 			# install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
 		endif()
+
+		unset(_PYTHON_VERSION_NO_DOTS)
 	endif()
 
 	if(CMAKE_CL_64)
-		# gettext and png are statically linked on win64
+		# png is statically linked on win64
 		install(
 			FILES ${LIBDIR}/zlib/lib/zlib.dll
 			DESTINATION ${TARGETDIR}
@@ -632,18 +623,7 @@ elseif(WIN32)
 	install( # x86 builds can run on x64 Windows, so this is required at all times
 		FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
 		DESTINATION ${TARGETDIR}
-	)	
-
-	if(WITH_OPENIMAGEIO)
-		if(NOT MINGW)
-			set(OIIOBIN ${LIBDIR}/openimageio)
-			install(
-				FILES
-					${OIIOBIN}/bin/OpenImageIO.dll
-				DESTINATION ${TARGETDIR}
-			)
-		endif()
-	endif()
+	)
 
 	if(WITH_OPENCOLORIO)
 		set(OCIOBIN ${LIBDIR}/opencolorio/bin)
@@ -681,7 +661,7 @@ elseif(APPLE)
 		)
 	endmacro()
 
-	set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
+	set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blender.app)
 
 	# setup Info.plist
 	execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -737,18 +717,10 @@ elseif(APPLE)
 
 	endif()
 	
-	#OSL shader_headers needed
-	if(WITH_CYCLES_OSL)
-		install(
-			FILES ${LIBDIR}/osl/shaders/oslutil.h ${LIBDIR}/osl/shaders/stdosl.h
-			DESTINATION ${TARGETDIR}/blender.app/Contents/shaders/
-		)
-	endif()
-	
 	# install blenderplayer bundle - copy of blender.app above. re-using macros et al
 	# note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
 	if(WITH_GAMEENGINE AND WITH_PLAYER)
-		set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
+		set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
 		set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist)
 		set(PLAYER_TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION})
 
@@ -898,7 +870,6 @@ endif()
 		bf_imbuf_dds
 		bf_collada
 		bf_intern_bsp
-		bf_intern_decimate
 		bf_intern_elbeem
 		bf_intern_memutil
 		bf_intern_guardedalloc
@@ -996,6 +967,10 @@ endif()
 		list_insert_after(BLENDER_SORTED_LIBS "cycles_kernel" "cycles_kernel_osl")
 	endif()
 
+	if(WITH_INTERNATIONAL)
+		list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
+	endif()
+
 	foreach(SORTLIB ${BLENDER_SORTED_LIBS})
 		set(REMLIB ${SORTLIB})
 		foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
diff --git a/source/creator/blender.map b/source/creator/blender.map
new file mode 100644
index 0000000..928d0c2
--- /dev/null
+++ b/source/creator/blender.map
@@ -0,0 +1,16 @@
+
+/* on Linux we exclude LLVM symbols, they conflict with Mesa llvmpipe
+ * we also keep boost's symbols local, since some python modules could
+ * be using boost as well (mainly that's for lux render)
+ */
+
+{
+global:
+	*;
+	*_boost*;
+local:
+	*llvm*;
+	*LLVM*;
+	*boost*;
+};
+
diff --git a/source/creator/creator.c b/source/creator/creator.c
index ab9541c..0f1207a 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1077,7 +1077,9 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 		"\n\t\t-p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>"
 		"\n\t\t-m\t\tRead from disk (Don't buffer)"
 		"\n\t\t-f <fps> <fps-base>\t\tSpecify FPS to start with"
-		"\n\t\t-j <frame>\tSet frame step to <frame>";
+		"\n\t\t-j <frame>\tSet frame step to <frame>"
+		"\n\t\t-s <frame>\tPlay from <frame>"
+		"\n\t\t-e <frame>\tPlay until <frame>";
 
 	static char game_doc[] = "Game Engine specific options"
 		"\n\t-g fixedtime\t\tRun on 50 hertz without dropping frames"
@@ -1128,6 +1130,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 #endif
 	BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_PYTHON);
 	BLI_argsAdd(ba, 1, NULL, "--debug-events", "\n\tEnable debug messages for the event system", debug_mode_generic, (void *)G_DEBUG_EVENTS);
+	BLI_argsAdd(ba, 1, NULL, "--debug-handlers", "\n\tEnable debug messages for event handling", debug_mode_generic, (void *)G_DEBUG_HANDLERS);
 	BLI_argsAdd(ba, 1, NULL, "--debug-wm",     "\n\tEnable debug messages for the window manager", debug_mode_generic, (void *)G_DEBUG_WM);
 	BLI_argsAdd(ba, 1, NULL, "--debug-all",    "\n\tEnable all debug messages (excludes libmv)", debug_mode_generic, (void *)G_DEBUG_ALL);
 
@@ -1269,6 +1272,7 @@ int main(int argc, const char **argv)
 	initglobals();  /* blender.c */
 
 	IMB_init();
+	BKE_images_init();
 
 #ifdef WITH_FFMPEG
 	IMB_ffmpeg_init();
diff --git a/source/creator/osx_locals.map b/source/creator/osx_locals.map
new file mode 100644
index 0000000..c3dd8b6
--- /dev/null
+++ b/source/creator/osx_locals.map
@@ -0,0 +1,3 @@
+## The symbols will be treated as if they were marked as __private_extern__
+## (aka visibility=hidden) and will not be global in the output file
+*boost*
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 5cfa97e..6807f53 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -35,9 +35,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// don't show stl-warnings
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+   /* don't show stl-warnings */
+#  pragma warning (disable:4786)
 #endif
 
 #include "GL/glew.h"
@@ -69,37 +69,33 @@
 #include "Value.h"
 
 
-
-#ifdef __cplusplus
 extern "C" {
-#endif
-	/***/
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_windowmanager_types.h"
-#include "BKE_global.h"
-#include "BKE_report.h"
-
-#include "MEM_guardedalloc.h"
-
-/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */
-extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
-
-#include "BKE_main.h"
-#include "BLI_blenlib.h"
-#include "BLO_readfile.h"
-#include "DNA_scene_types.h"
-#include "BKE_ipo.h"
-	/***/
-
-#include "BKE_context.h"
-#include "../../blender/windowmanager/WM_types.h"
-#include "../../blender/windowmanager/wm_window.h"
-#include "../../blender/windowmanager/wm_event_system.h"
-#ifdef __cplusplus
+	#include "DNA_view3d_types.h"
+	#include "DNA_screen_types.h"
+	#include "DNA_userdef_types.h"
+	#include "DNA_scene_types.h"
+	#include "DNA_windowmanager_types.h"
+
+	#include "BKE_global.h"
+	#include "BKE_report.h"
+	#include "BKE_ipo.h"
+	#include "BKE_main.h"
+	#include "BKE_context.h"
+
+	/* avoid c++ conflict with 'new' */
+	#define new _new
+	#include "BKE_screen.h"
+	#undef new
+
+	#include "MEM_guardedalloc.h"
+
+	#include "BLI_blenlib.h"
+	#include "BLO_readfile.h"
+
+	#include "../../blender/windowmanager/WM_types.h"
+	#include "../../blender/windowmanager/wm_window.h"
+	#include "../../blender/windowmanager/wm_event_system.h"
 }
-#endif
 
 #ifdef WITH_AUDASPACE
 #  include "AUD_C-API.h"
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index fa0994d..9a47d22 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -23,7 +23,6 @@ set(INC
 	../../blender/makesdna
 	../../blender/makesrna
 	../../blender/windowmanager
-	../../../extern/bullet2/src
 	../../../intern/container
 	../../../intern/guardedalloc
 	../../../intern/moto/include
@@ -31,8 +30,10 @@ set(INC
 )
 
 set(INC_SYS
+	../../../extern/bullet2/src
 	${PTHREADS_INCLUDE_DIRS}
 	${GLEW_INCLUDE_PATH}
+	${BOOST_INCLUDE_DIR}
 )
 
 set(SRC
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index 0b41cce..346d201 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -46,7 +46,7 @@ m_frame_rect(rect)
 	m_area_left = ar->winrct.xmin;
 	m_area_top = ar->winrct.ymax;
 
-	glGetIntegerv(GL_VIEWPORT, (GLint*)m_viewport);
+	glGetIntegerv(GL_VIEWPORT, (GLint *)m_viewport);
 }
 
 KX_BlenderCanvas::~KX_BlenderCanvas()
@@ -119,14 +119,14 @@ int KX_BlenderCanvas::GetHeight(
 
 int KX_BlenderCanvas::GetMouseX(int x)
 {
-	float left = GetWindowArea().GetLeft();
-	return float(x - (left - m_area_left));
+	int left = GetWindowArea().GetLeft();
+	return x - (left - m_area_left);
 }
 
 int KX_BlenderCanvas::GetMouseY(int y)
 {
-	float top = GetWindowArea().GetTop();
-	return float(y - (m_area_top - top));
+	int top = GetWindowArea().GetTop();
+	return y - (m_area_top - top);
 }
 
 float KX_BlenderCanvas::GetMouseNormalizedX(int x)
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index bbec7e0..244394a 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -192,8 +192,8 @@ private:
 	struct wmWindow* m_win;
 	RAS_Rect	m_frame_rect;
 	RAS_Rect 	m_area_rect;
-	short		m_area_left;
-	short		m_area_top;
+	int			m_area_left;
+	int			m_area_top;
 
 
 #ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 7c4c759..00836fa 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -95,35 +95,29 @@ static void DisableForText()
 {
 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
 
-	if (glIsEnabled(GL_BLEND)) glDisable(GL_BLEND);
-	if (glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST);
+	glDisable(GL_BLEND);
+	glDisable(GL_ALPHA_TEST);
 
-	if (glIsEnabled(GL_LIGHTING)) {
-		glDisable(GL_LIGHTING);
-		glDisable(GL_COLOR_MATERIAL);
-	}
+	glDisable(GL_LIGHTING);
+	glDisable(GL_COLOR_MATERIAL);
 
 	if (GLEW_ARB_multitexture) {
 		for (int i=0; i<MAXTEX; i++) {
 			glActiveTextureARB(GL_TEXTURE0_ARB+i);
 
 			if (GLEW_ARB_texture_cube_map)
-				if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
-					glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-			if (glIsEnabled(GL_TEXTURE_2D))
-				glDisable(GL_TEXTURE_2D);
+			glDisable(GL_TEXTURE_2D);
 		}
 
 		glActiveTextureARB(GL_TEXTURE0_ARB);
 	}
 	else {
 		if (GLEW_ARB_texture_cube_map)
-			if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
-				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+			glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-		if (glIsEnabled(GL_TEXTURE_2D))
-			glDisable(GL_TEXTURE_2D);
+		glDisable(GL_TEXTURE_2D);
 	}
 }
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
index bb476ed..2a96d4c 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
@@ -32,8 +32,8 @@
 #ifndef __KX_BLENDERINPUTDEVICE_H__
 #define __KX_BLENDERINPUTDEVICE_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning(disable : 4786)  // shut off 255 char limit debug template warning
+#ifdef _MSC_VER
+#  pragma warning(disable:4786)  // shut off 255 char limit debug template warning
 #endif
 
 #include <map>
@@ -48,8 +48,9 @@
 #endif
 
 /**
- Base Class for Blender specific inputdevices. Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode.
-*/
+ * Base Class for Blender specific inputdevices.
+ * Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode.
+ */
 class BL_BlenderInputDevice : public SCA_IInputDevice
 {
 public:
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
index 54c6009..19ba46e 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
@@ -30,9 +30,9 @@
  */
 
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// annoying warnings about truncated STL debug info
-#pragma warning (disable :4786)
+#ifdef _MSC_VER
+   /* annoying warnings about truncated STL debug info */
+#  pragma warning (disable:4786)
 #endif 
 
 #include "KX_BlenderKeyboardDevice.h"
@@ -105,7 +105,7 @@ bool	KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short v
 	{
 		int previousTable = 1-m_currentTable;
 
-		if (val == KM_PRESS)
+		if (val == KM_PRESS || val == KM_DBL_CLICK)
 		{
 			if (kxevent == KX_KetsjiEngine::GetExitKey() && val != 0 && !m_hookesc)
 				result = true;
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
index 5cd2038..8d90eac 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
@@ -29,10 +29,9 @@
  *  \ingroup blroutines
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// annoying warnings about truncated STL debug info
-#pragma warning (disable :4786)
+#ifdef _MSC_VER
+   /* annoying warnings about truncated STL debug info */
+#  pragma warning (disable:4786)
 #endif 
 
 #include "KX_BlenderMouseDevice.h"
@@ -122,7 +121,7 @@ bool	KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode,short val)
 	// only process it, if it's a key
 	if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSEBUTTONS)
 	{
-		if (val == KM_PRESS)
+		if (val == KM_PRESS || val == KM_DBL_CLICK)
 		{
 			m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //???
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index 85b76d7..e32239b 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -58,7 +58,7 @@ unsigned int KX_BlenderRenderTools::m_numgllights;
 
 KX_BlenderRenderTools::KX_BlenderRenderTools()
 {
-	glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights);
+	glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights);
 	if (m_numgllights < 8)
 		m_numgllights = 8;
 }
@@ -164,11 +164,11 @@ bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* resu
 	left = (dir.cross(resultnormal)).safe_normalized();
 	// for the up vector, we take the 'resultnormal' returned by the physics
 	
-	double maat[16]={
-			left[0],        left[1],        left[2], 0,
-				dir[0],         dir[1],         dir[2], 0,
-		resultnormal[0],resultnormal[1],resultnormal[2], 0,
-				0,              0,              0, 1};
+	double maat[16] = {left[0],         left[1],         left[2],         0,
+	                   dir[0],          dir[1],          dir[2],          0,
+	                   resultnormal[0], resultnormal[1], resultnormal[2], 0,
+	                   0,               0,               0,               1};
+
 	glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
 	//glMultMatrixd(oglmatrix);
 	glMultMatrixd(maat);
@@ -227,16 +227,17 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
 		left *= size[0];
 		dir  *= size[1];
 		up   *= size[2];
-		double maat[16]={
-			left[0], left[1],left[2], 0,
-				dir[0], dir[1],dir[2],0,
-				up[0],up[1],up[2],0,
-				0,0,0,1};
-			glTranslated(objpos[0],objpos[1],objpos[2]);
-			glMultMatrixd(maat);
-			
-	} else
-	{
+
+		double maat[16] = {left[0], left[1], left[2], 0,
+		                   dir[0],  dir[1],  dir[2],  0,
+		                   up[0],   up[1],   up[2],   0,
+		                   0,       0,       0,       1};
+
+		glTranslated(objpos[0],objpos[1],objpos[2]);
+		glMultMatrixd(maat);
+
+	}
+	else {
 		if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
 		{
 			// shadow must be cast to the ground, physics system needed here!
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
index 17c9f6b..7195524 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
@@ -32,9 +32,9 @@
 #ifndef __KX_BLENDERRENDERTOOLS_H__
 #define __KX_BLENDERRENDERTOOLS_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// don't show stl-warnings
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+   /* don't show stl-warnings */
+#  pragma warning (disable:4786)
 #endif
 
 #include "RAS_IRenderTools.h"
@@ -72,26 +72,26 @@ public:
 	void				ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
 
 	void				RenderText3D(int fontid,
-									 const char* text,
-									 int size,
-									 int dpi,
-									 float* color,
-									 double* mat,
-									 float aspect);
+	                                 const char* text,
+	                                 int size,
+	                                 int dpi,
+	                                 float* color,
+	                                 double* mat,
+	                                 float aspect);
 
 	void		RenderText2D(RAS_TEXT_RENDER_MODE mode,
-									 const char* text,
-									 int xco,
-									 int yco,
-									 int width,
-									 int height);
+	                         const char* text,
+	                         int xco,
+	                         int yco,
+	                         int width,
+	                         int height);
 	void				RenderText(int mode,
-								   class RAS_IPolyMaterial* polymat,
-								   float v1[3],
-								   float v2[3],
-								   float v3[3],
-								   float v4[3],
-								   int glattrib);
+	                               class RAS_IPolyMaterial* polymat,
+	                               float v1[3],
+	                               float v2[3],
+	                               float v3[3],
+	                               float v4[3],
+	                               int glattrib);
 
 	void				applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
 	int					applyLights(int objectlayer, const MT_Transform& viewmat);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp
index d7d8c51..0582e79 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp
@@ -32,9 +32,9 @@
 
 #include "KX_ISystem.h"
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable :4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #ifdef WIN32
 #include <windows.h>
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index 998396a..04dbe27 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -34,6 +34,7 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
 
 incs += ' ' + env['BF_BULLET_INC']
 incs += ' ' + env['BF_OPENGL_INC']
+incs += ' ' + env['BF_BOOST_INC']
 
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index fcf0958..0bd0914 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -140,8 +140,7 @@ void BL_ActionActuator::SetLocalTime(float curtime)
 	// Handle wrap around
 	if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
 	{
-		switch(m_playtype)
-		{
+		switch (m_playtype) {
 		case ACT_ACTION_PLAY:
 			// Clamp
 			m_localtime = m_endframe;
@@ -196,8 +195,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
 		return false;
 
 	// Convert our playtype to one that BL_Action likes
-	switch(m_playtype)
-	{
+	switch (m_playtype) {
 		case ACT_ACTION_LOOP_END:
 		case ACT_ACTION_LOOP_STOP:
 			playtype = BL_Action::ACT_MODE_LOOP;
@@ -312,8 +310,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
 			return false;
 		}
 
-		switch(m_playtype)
-		{
+		switch (m_playtype) {
 			case ACT_ACTION_LOOP_STOP:
 				obj->StopAction(m_layer); // Stop the action after getting the frame
 
@@ -492,9 +489,9 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		
 		// for some reason loc.setValue(pchan->loc) fails
 		if (pchan) {
-			pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
-			pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
-			pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
+			pchan->loc[0] = loc[0]; pchan->loc[1] = loc[1]; pchan->loc[2] = loc[2];
+			pchan->size[0] = size[0]; pchan->size[1] = size[1]; pchan->size[2] = size[2];
+			pchan->quat[0] = quat[3]; pchan->quat[1] = quat[0]; pchan->quat[2] = quat[1]; pchan->quat[3] = quat[2]; /* notice xyzw -> wxyz is intentional */
 		}
 	}
 	
@@ -557,13 +554,13 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
 
 PyObject *BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
 }
 
 int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	
 	if (!PyUnicode_Check(value))
 	{
@@ -595,7 +592,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
 	return NULL;
 
 #if 0 // XXX To be removed in a later version (first removed in 2.64)
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	PyObject *ret= PyList_New(0);
 	PyObject *item;
 	
@@ -622,13 +619,13 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
 
 PyObject *BL_ActionActuator::pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	return PyBool_FromLong(self->m_flag & ACT_FLAG_CONTINUE);
 }
 
 int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	
 	if (PyObject_IsTrue(value))
 		self->m_flag |= ACT_FLAG_CONTINUE;
@@ -640,13 +637,13 @@ int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUT
 
 PyObject *BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	return PyFloat_FromDouble(((KX_GameObject*)self->m_gameobj)->GetActionFrame(self->m_layer));
 }
 
 int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
 	
 	((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value));
 	
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h
index a5af2bc..ba02c5a 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.h
+++ b/source/gameengine/Converter/BL_ArmatureActuator.h
@@ -49,13 +49,13 @@ class	BL_ArmatureActuator : public SCA_IActuator
 	Py_Header
 public:
 	BL_ArmatureActuator(SCA_IObject* gameobj,
-						int type,
-						const char *posechannel,
-						const char *constraintname,
-						KX_GameObject* targetobj,
-						KX_GameObject* subtargetobj,
-						float weight,
-						float influence);
+	                    int type,
+	                    const char *posechannel,
+	                    const char *constraintname,
+	                    KX_GameObject* targetobj,
+	                    KX_GameObject* subtargetobj,
+	                    float weight,
+	                    float influence);
 
 	virtual ~BL_ArmatureActuator();
 
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp
index e588d1d..11e90e1 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.cpp
+++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp
@@ -95,7 +95,7 @@ BL_ArmatureChannel::~BL_ArmatureChannel()
 // PYTHON
 
 PyMethodDef BL_ArmatureChannel::Methods[] = {
-  {NULL,NULL} //Sentinel
+	{NULL,NULL} //Sentinel
 };
 
 // order of definition of attributes, must match Attributes[] array
@@ -149,7 +149,7 @@ PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = {
 
 PyObject *BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+	BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
 	bPoseChannel* channel = self->m_posechannel;
 	int attr_order = attrdef-Attributes;
 
@@ -177,7 +177,7 @@ PyObject *BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYAT
 
 int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+	BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
 	bPoseChannel* channel = self->m_posechannel;
 	int attr_order = attrdef-Attributes;
 
@@ -300,7 +300,7 @@ PyObject *BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
 
 int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+	BL_ArmatureChannel* self = static_cast<BL_ArmatureChannel*>(self_v);
 	bPoseChannel* pchan = self->m_posechannel;
 	PyObject *item;
 	float joints[3];
@@ -455,12 +455,12 @@ PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYAT
 	Bone* bone = reinterpret_cast<Bone*>(self);
 	Bone* child;
 	int count = 0;
-	for (child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next)
+	for (child = (Bone *)bone->childbase.first; child; child = child->next)
 		count++;
 
 	PyObject *childrenlist = PyList_New(count);
 
-	for (count = 0, child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next, ++count)
+	for (count = 0, child = (Bone *)bone->childbase.first; child; child = child->next, ++count)
 		PyList_SET_ITEM(childrenlist,count,NewProxyPlus_Ext(NULL,&Type,child,false));
 
 	return childrenlist;
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
index 169205d..379be91 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
@@ -246,7 +246,7 @@ void BL_ArmatureConstraint::SetSubtarget(KX_GameObject* subtarget)
 // PYTHON
 
 PyMethodDef BL_ArmatureConstraint::Methods[] = {
-  {NULL,NULL} //Sentinel
+	{NULL,NULL} //Sentinel
 };
 
 // order of definition of attributes, must match Attributes[] array
@@ -288,7 +288,7 @@ PyAttributeDef BL_ArmatureConstraint::Attributes[] = {
 
 PyObject *BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ArmatureConstraint* self= static_cast<BL_ArmatureConstraint*>(self_v);
+	BL_ArmatureConstraint* self = static_cast<BL_ArmatureConstraint*>(self_v);
 	bConstraint* constraint = self->m_constraint;
 	bKinematicConstraint* ikconstraint = (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) ? (bKinematicConstraint*)constraint->data : NULL;
 	int attr_order = attrdef-Attributes;
@@ -353,7 +353,7 @@ PyObject *BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P
 
 int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ArmatureConstraint* self= static_cast<BL_ArmatureConstraint*>(self_v);
+	BL_ArmatureConstraint* self = static_cast<BL_ArmatureConstraint*>(self_v);
 	bConstraint* constraint = self->m_constraint;
 	bKinematicConstraint* ikconstraint = (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) ? (bKinematicConstraint*)constraint->data : NULL;
 	int attr_order = attrdef-Attributes;
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index da73d7a..1f1c404 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -105,7 +105,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
 	for (; pchan; pchan=pchan->next, outpchan=outpchan->next)
 		BLI_ghash_insert(ghash, pchan, outpchan);
 
-	for (pchan=(bPoseChannel*)out->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) {
+	for (pchan = (bPoseChannel*)out->chanbase.first; pchan; pchan = pchan->next) {
 		pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent);
 		pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child);
 
@@ -186,7 +186,10 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
 			if (schan->rotmode)
 				dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight);
 		}
-		for (dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) {
+		for (dcon= (bConstraint *)dchan->constraints.first, scon= (bConstraint *)schan->constraints.first;
+		     dcon && scon;
+		     dcon = dcon->next, scon = scon->next)
+		{
 			/* no 'add' option for constraint blending */
 			dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight;
 		}
@@ -282,8 +285,8 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
 	KX_GameObject* gamesubtarget;
 
 	// and locate the constraint
-	for (pchan = (bPoseChannel*)m_pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) {
-		for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) {
+	for (pchan = (bPoseChannel *)m_pose->chanbase.first; pchan; pchan = pchan->next) {
+		for (pcon = (bConstraint *)pchan->constraints.first; pcon; pcon = pcon->next) {
 			if (pcon->flag & CONSTRAINT_DISABLE)
 				continue;
 			// which constraint should we support?
@@ -315,7 +318,7 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
 						}
 						if (target->next != NULL) {
 							// secondary target
-							target = (bConstraintTarget*)target->next;
+							target = target->next;
 							if (target->tar && target->tar != m_objArma) {
 								// only track external object
 								blendtarget = target->tar;
@@ -636,7 +639,6 @@ PyTypeObject BL_ArmatureObject::Type = {
 };
 
 PyMethodDef BL_ArmatureObject::Methods[] = {
-
 	KX_PYMETHODTABLE_NOARGS(BL_ArmatureObject, update),
 	{NULL,NULL} //Sentinel
 };
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 6ffdea9..eb695e6 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -30,8 +30,8 @@
  *  \ingroup bgeconv
  */
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include <math.h>
@@ -423,65 +423,55 @@ static void SetDefaultLightMode(Scene* scene)
 
 
 // --
-static void GetRGB(short type,
-	MFace* mface,
-	MCol* mmcol,
-	Material *mat,
-	unsigned int &c0, 
-	unsigned int &c1, 
-	unsigned int &c2, 
-	unsigned int &c3)
+static void GetRGB(
+        const bool use_mcol,
+        MFace *mface,
+        MCol *mmcol,
+        Material *mat,
+        unsigned int &c0,
+        unsigned int &c1,
+        unsigned int &c2,
+        unsigned int &c3)
 {
 	unsigned int color = 0xFFFFFFFFL;
-	switch(type)
-	{
-		case 0:	// vertex colors
-		{
-			if (mmcol) {
-				c0 = KX_Mcol2uint_new(mmcol[0]);
-				c1 = KX_Mcol2uint_new(mmcol[1]);
-				c2 = KX_Mcol2uint_new(mmcol[2]);
-				if (mface->v4)
-					c3 = KX_Mcol2uint_new(mmcol[3]);
-			}
-			else { // backup white
-				c0 = KX_rgbaint2uint_new(color);
-				c1 = KX_rgbaint2uint_new(color);
-				c2 = KX_rgbaint2uint_new(color);
-				if (mface->v4)
-					c3 = KX_rgbaint2uint_new( color );
-			}
-		} break;
-		
-	
-		case 1: // material rgba
-		{
-			if (mat) {
-				union {
-					unsigned char cp[4];
-					unsigned int integer;
-				} col_converter;
-				col_converter.cp[3] = (unsigned char) (mat->r     * 255.0f);
-				col_converter.cp[2] = (unsigned char) (mat->g     * 255.0f);
-				col_converter.cp[1] = (unsigned char) (mat->b     * 255.0f);
-				col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
-				color = col_converter.integer;
-			}
-			c0 = KX_rgbaint2uint_new(color);
-			c1 = KX_rgbaint2uint_new(color);
-			c2 = KX_rgbaint2uint_new(color);
+	if (use_mcol) {
+		// vertex colors
+
+		if (mmcol) {
+			c0 = KX_Mcol2uint_new(mmcol[0]);
+			c1 = KX_Mcol2uint_new(mmcol[1]);
+			c2 = KX_Mcol2uint_new(mmcol[2]);
 			if (mface->v4)
-				c3 = KX_rgbaint2uint_new(color);
-		} break;
-		
-		default: // white
-		{
+				c3 = KX_Mcol2uint_new(mmcol[3]);
+		}
+		else { // backup white
 			c0 = KX_rgbaint2uint_new(color);
 			c1 = KX_rgbaint2uint_new(color);
 			c2 = KX_rgbaint2uint_new(color);
 			if (mface->v4)
-				c3 = KX_rgbaint2uint_new(color);
-		} break;
+				c3 = KX_rgbaint2uint_new( color );
+		}
+	}
+	else {
+		// material rgba
+		if (mat) {
+			union {
+				unsigned char cp[4];
+				unsigned int integer;
+			} col_converter;
+			col_converter.cp[3] = (unsigned char) (mat->r     * 255.0f);
+			col_converter.cp[2] = (unsigned char) (mat->g     * 255.0f);
+			col_converter.cp[1] = (unsigned char) (mat->b     * 255.0f);
+			col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
+			color = col_converter.integer;
+		}
+		// backup white is fallback
+
+		c0 = KX_rgbaint2uint_new(color);
+		c1 = KX_rgbaint2uint_new(color);
+		c2 = KX_rgbaint2uint_new(color);
+		if (mface->v4)
+			c3 = KX_rgbaint2uint_new(color);
 	}
 }
 
@@ -490,6 +480,45 @@ typedef struct MTF_localLayer {
 	const char *name;
 } MTF_localLayer;
 
+static void tface_to_uv_bge(const MFace *mface, const MTFace *tface, MT_Point2 uv[4])
+{
+	uv[0].setValue(tface->uv[0]);
+	uv[1].setValue(tface->uv[1]);
+	uv[2].setValue(tface->uv[2]);
+	if (mface->v4) {
+		uv[3].setValue(tface->uv[3]);
+	}
+}
+
+static void GetUV(
+        MFace *mface,
+        MTFace *tface,
+        MTF_localLayer *layers,
+        const int layer_uv[2],
+        MT_Point2 uv[4],
+        MT_Point2 uv2[4])
+{
+	bool validface	= (tface != NULL);
+
+	uv2[0] = uv2[1] = uv2[2] = uv2[3] = MT_Point2(0.0f, 0.0f);
+
+	/* No material, what to do? let's see what is in the UV and set the material accordingly
+	 * light and visible is always on */
+	if (layer_uv[0] != -1) {
+		tface_to_uv_bge(mface, layers[layer_uv[0]].face, uv);
+		if (layer_uv[1] != -1) {
+			tface_to_uv_bge(mface, layers[layer_uv[1]].face, uv2);
+		}
+	}
+	else if (validface) {
+		tface_to_uv_bge(mface, tface, uv);
+	}
+	else {
+		// nothing at all
+		uv[0] = uv[1] = uv[2] = uv[3] = MT_Point2(0.0f, 0.0f);
+	}
+}
+
 // ------------------------------------
 static bool ConvertMaterial(
 	BL_Material *material,
@@ -497,30 +526,25 @@ static bool ConvertMaterial(
 	MTFace* tface,  
 	const char *tfaceName,
 	MFace* mface, 
-	MCol* mmcol,
+	MCol* mmcol,  /* only for text, use first mcol, weak */
 	MTF_localLayer *layers,
-	bool glslmat)
+	int layer_uv[2],
+	const bool glslmat)
 {
 	material->Initialize();
 	int numchan =	-1, texalpha = 0;
 	bool validmat	= (mat!=0);
 	bool validface	= (tface!=0);
 	
-	short type = 0;
-	if ( validmat )
-		type = 1; // material color 
-	
 	material->IdMode = DEFAULT_BLENDER;
 	material->glslmat = (validmat)? glslmat: false;
 	material->materialindex = mface->mat_nr;
 
+	/* default value for being unset */
+	layer_uv[0] = layer_uv[1] = -1;
+
 	// --------------------------------
 	if (validmat) {
-
-		// use vertex colors by explicitly setting
-		if (mat->mode &MA_VERTEXCOLP || glslmat)
-			type = 0;
-
 		// use lighting?
 		material->ras_mode |= ( mat->mode & MA_SHLESS )?0:USE_LIGHT;
 		material->ras_mode |= ( mat->game.flag & GEMAT_BACKCULL )?0:TWOSIDED;
@@ -627,7 +651,7 @@ static bool ConvertMaterial(
 								if (!material->cubemap[i]->cube[0])
 									BL_Texture::SplitEnvMap(material->cubemap[i]);
 
-								material->texname[i]= material->cubemap[i]->ima->id.name;
+								material->texname[i] = material->cubemap[i]->ima->id.name;
 								material->mapping[i].mapping |= USEENV;
 							}
 						}
@@ -677,7 +701,7 @@ static bool ConvertMaterial(
 					material->mapping[i].projplane[2] = mttmp->projz;
 					/// --------------------------------
 					
-					switch( mttmp->blendtype ) {
+					switch (mttmp->blendtype) {
 					case MTEX_BLEND:
 						material->blend_mode[i] = BLEND_MIX;
 						break;
@@ -701,7 +725,7 @@ static bool ConvertMaterial(
 
 		// above one tex the switches here
 		// are not used
-		switch(valid_index) {
+		switch (valid_index) {
 		case 0:
 			material->IdMode = DEFAULT_BLENDER;
 			break;
@@ -773,33 +797,19 @@ static bool ConvertMaterial(
 		// No material - old default TexFace properties
 		material->ras_mode |= USE_LIGHT;
 	}
-	MT_Point2 uv[4];
-	MT_Point2 uv2[4];
-	const char *uvName = "", *uv2Name = "";
 
-	
-	uv2[0]= uv2[1]= uv2[2]= uv2[3]= MT_Point2(0.0f, 0.0f);
+	const char *uvName = "", *uv2Name = "";
 
 	/* No material, what to do? let's see what is in the UV and set the material accordingly
 	 * light and visible is always on */
 	if ( validface ) {
 		material->tile	= tface->tile;
-			
-		uv[0].setValue(tface->uv[0]);
-		uv[1].setValue(tface->uv[1]);
-		uv[2].setValue(tface->uv[2]);
-
-		if (mface->v4) 
-			uv[3].setValue(tface->uv[3]);
-
 		uvName = tfaceName;
 	} 
 	else {
 		// nothing at all
 		material->alphablend	= GEMAT_SOLID;
 		material->tile		= 0;
-		
-		uv[0]= uv[1]= uv[2]= uv[3]= MT_Point2(0.0f, 0.0f);
 	}
 
 	if (validmat && validface) {
@@ -817,49 +827,30 @@ static bool ConvertMaterial(
 	}
 
 	// get uv sets
-	if (validmat) 
-	{
+	if (validmat) {
 		bool isFirstSet = true;
 
 		// only two sets implemented, but any of the eight 
 		// sets can make up the two layers
-		for (int vind = 0; vind<material->num_enabled; vind++)
-		{
+		for (int vind = 0; vind<material->num_enabled; vind++) {
 			BL_Mapping &map = material->mapping[vind];
 
-			if (map.uvCoName.IsEmpty())
+			if (map.uvCoName.IsEmpty()) {
 				isFirstSet = false;
-			else
-			{
-				for (int lay=0; lay<MAX_MTFACE; lay++)
-				{
+			}
+			else {
+				for (int lay=0; lay<MAX_MTFACE; lay++) {
 					MTF_localLayer& layer = layers[lay];
 					if (layer.face == 0) break;
 
-					if (strcmp(map.uvCoName.ReadPtr(), layer.name)==0)
-					{
-						MT_Point2 uvSet[4];
-
-						uvSet[0].setValue(layer.face->uv[0]);
-						uvSet[1].setValue(layer.face->uv[1]);
-						uvSet[2].setValue(layer.face->uv[2]);
-
-						if (mface->v4) 
-							uvSet[3].setValue(layer.face->uv[3]);
-						else
-							uvSet[3].setValue(0.0f, 0.0f);
-
-						if (isFirstSet)
-						{
-							uv[0] = uvSet[0]; uv[1] = uvSet[1];
-							uv[2] = uvSet[2]; uv[3] = uvSet[3];
+					if (strcmp(map.uvCoName.ReadPtr(), layer.name)==0) {
+						if (isFirstSet) {
+							layer_uv[0] = lay;
 							isFirstSet = false;
 							uvName = layer.name;
 						}
-						else if (strcmp(layer.name, uvName) != 0)
-						{
-							uv2[0] = uvSet[0]; uv2[1] = uvSet[1];
-							uv2[2] = uvSet[2]; uv2[3] = uvSet[3];
+						else if (strcmp(layer.name, uvName) != 0) {
+							layer_uv[1] = lay;
 							map.mapping |= USECUSTOMUV;
 							uv2Name = layer.name;
 						}
@@ -869,21 +860,11 @@ static bool ConvertMaterial(
 		}
 	}
 
-	unsigned int rgb[4];
-	GetRGB(type,mface,mmcol,mat,rgb[0],rgb[1],rgb[2], rgb[3]);
-
-	// swap the material color, so MCol on bitmap font works
-	if (validmat && type==1 && (mat->game.flag & GEMAT_TEXT))
-	{
-		rgb[0] = KX_rgbaint2uint_new(rgb[0]);
-		rgb[1] = KX_rgbaint2uint_new(rgb[1]);
-		rgb[2] = KX_rgbaint2uint_new(rgb[2]);
-		rgb[3] = KX_rgbaint2uint_new(rgb[3]);
+	if (validmat && mmcol) { /* color is only for text */
+		material->m_mcol = *(unsigned int *)mmcol;
 	}
-
-	material->SetConversionRGB(rgb);
-	material->SetConversionUV(uvName, uv);
-	material->SetConversionUV2(uv2Name, uv2);
+	material->SetUVLayerName(uvName);
+	material->SetUVLayerName2(uv2Name);
 
 	if (validmat)
 		material->matname	=(mat->id.name);
@@ -929,6 +910,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 
 	// Extract avaiable layers
 	MTF_localLayer *layers =  new MTF_localLayer[MAX_MTFACE];
+	int layer_uv[2];  /* store uv1, uv2 layers */
 	for (int lay=0; lay<MAX_MTFACE; lay++) {
 		layers[lay].face = 0;
 		layers[lay].name = "";
@@ -1026,34 +1008,43 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			bool twoside = false;
 
 			if (converter->GetMaterials()) {
+				const bool is_bl_mat_new   = (bl_mat == NULL);
+				//const bool is_kx_blmat_new = (kx_blmat == NULL);
+				const bool glslmat = converter->GetGLSLMaterials();
+				const bool use_mcol = ma ? (ma->mode & MA_VERTEXCOLP || glslmat) : true;
 				/* do Blender Multitexture and Blender GLSL materials */
-				unsigned int rgb[4];
-				MT_Point2 uv[4];
+				MT_Point2 uv_1[4];
+				MT_Point2 uv_2[4];
 
 				/* first is the BL_Material */
-				if (!bl_mat)
+				if (!bl_mat) {
 					bl_mat = new BL_Material();
-				ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol,
-					layers, converter->GetGLSLMaterials());
+				}
 
-				/* vertex colors and uv's were stored in bl_mat temporarily */
-				bl_mat->GetConversionRGB(rgb);
-				rgb0 = rgb[0]; rgb1 = rgb[1];
-				rgb2 = rgb[2]; rgb3 = rgb[3];
+				/* only */
+				if (is_bl_mat_new || (bl_mat->material != ma)) {
+					ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol,
+					                layers, layer_uv, glslmat);
+				}
 
-				bl_mat->GetConversionUV(uv);
-				uv0 = uv[0]; uv1 = uv[1];
-				uv2 = uv[2]; uv3 = uv[3];
+				/* vertex colors and uv's from the faces */
+				GetRGB(use_mcol, mface, mcol, ma, rgb0, rgb1, rgb2, rgb3);
+				GetUV(mface, tface, layers, layer_uv, uv_1, uv_2);
 
-				bl_mat->GetConversionUV2(uv);
-				uv20 = uv[0]; uv21 = uv[1];
-				uv22 = uv[2]; uv23 = uv[3];
+				uv0 = uv_1[0]; uv1 = uv_1[1];
+				uv2 = uv_1[2]; uv3 = uv_1[3];
+
+				uv20 = uv_2[0]; uv21 = uv_2[1];
+				uv22 = uv_2[2]; uv23 = uv_2[3];
 				
 				/* then the KX_BlenderMaterial */
 				if (kx_blmat == NULL)
 					kx_blmat = new KX_BlenderMaterial();
 
-				kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL));
+				//if (is_kx_blmat_new || !kx_blmat->IsMaterial(bl_mat)) {
+					kx_blmat->Initialize(scene, bl_mat, (ma ? &ma->game : NULL));
+				//}
+
 				polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat);
 			}
 			else {
@@ -1390,32 +1381,30 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
 	}
 		
 	if (me->totvert) {
-		loc[0]= (min[0]+max[0])/2.0f;
-		loc[1]= (min[1]+max[1])/2.0f;
-		loc[2]= (min[2]+max[2])/2.0f;
+		loc[0] = (min[0] + max[0]) / 2.0f;
+		loc[1] = (min[1] + max[1]) / 2.0f;
+		loc[2] = (min[2] + max[2]) / 2.0f;
 		
-		size[0]= (max[0]-min[0])/2.0f;
-		size[1]= (max[1]-min[1])/2.0f;
-		size[2]= (max[2]-min[2])/2.0f;
+		size[0] = (max[0] - min[0]) / 2.0f;
+		size[1] = (max[1] - min[1]) / 2.0f;
+		size[2] = (max[2] - min[2]) / 2.0f;
 	}
 	else {
-		loc[0]= loc[1]= loc[2]= 0.0f;
-		size[0]= size[1]= size[2]= 0.0f;
+		loc[0] = loc[1] = loc[2] = 0.0f;
+		size[0] = size[1] = size[2] = 0.0f;
 	}
 		
-	bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= loc[0]-size[0];
-	bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= loc[0]+size[0];
+	bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = loc[0]-size[0];
+	bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = loc[0]+size[0];
 		
-	bb->vec[0][1]=bb->vec[1][1]=bb->vec[4][1]=bb->vec[5][1]= loc[1]-size[1];
-	bb->vec[2][1]=bb->vec[3][1]=bb->vec[6][1]=bb->vec[7][1]= loc[1]+size[1];
+	bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = loc[1]-size[1];
+	bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = loc[1]+size[1];
 
-	bb->vec[0][2]=bb->vec[3][2]=bb->vec[4][2]=bb->vec[7][2]= loc[2]-size[2];
-	bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= loc[2]+size[2];
+	bb->vec[0][2] = bb->vec[3][2] = bb->vec[4][2] = bb->vec[7][2] = loc[2]-size[2];
+	bb->vec[1][2] = bb->vec[2][2] = bb->vec[5][2] = bb->vec[6][2] = loc[2]+size[2];
 
 	return sqrt(radius);
 }
-		
-
 
 
 static void my_tex_space_mesh(Mesh *me)
@@ -1438,12 +1427,12 @@ static void my_tex_space_mesh(Mesh *me)
 					minmax_v3v3_v3(min, max, fp);
 				}
 				if (kb->totelem) {
-					loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f;
-					size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f;
+					loc[0] = (min[0]+max[0])/2.0f; loc[1] = (min[1]+max[1])/2.0f; loc[2] = (min[2]+max[2])/2.0f;
+					size[0] = (max[0]-min[0])/2.0f; size[1] = (max[1]-min[1])/2.0f; size[2] = (max[2]-min[2])/2.0f;
 				}
 				else {
-					loc[0]= loc[1]= loc[2]= 0.0;
-					size[0]= size[1]= size[2]= 0.0;
+					loc[0] = loc[1] = loc[2] = 0.0;
+					size[0] = size[1] = size[2] = 0.0;
 				}
 				
 			}
@@ -1451,19 +1440,19 @@ static void my_tex_space_mesh(Mesh *me)
 
 		copy_v3_v3(me->loc, loc);
 		copy_v3_v3(me->size, size);
-		me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
+		me->rot[0] = me->rot[1] = me->rot[2] = 0.0f;
 
 		if (me->size[0] == 0.0f) me->size[0] = 1.0f;
-		else if (me->size[0] > 0.0f && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
-		else if (me->size[0] < 0.0f && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
+		else if (me->size[0] > 0.0f && me->size[0]< 0.00001f) me->size[0] = 0.00001f;
+		else if (me->size[0] < 0.0f && me->size[0]> -0.00001f) me->size[0] = -0.00001f;
 
-		if (me->size[1] == 0.0f) me->size[1]= 1.0f;
-		else if (me->size[1] > 0.0f && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
-		else if (me->size[1] < 0.0f && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
+		if (me->size[1] == 0.0f) me->size[1] = 1.0f;
+		else if (me->size[1] > 0.0f && me->size[1]< 0.00001f) me->size[1] = 0.00001f;
+		else if (me->size[1] < 0.0f && me->size[1]> -0.00001f) me->size[1] = -0.00001f;
 
-		if (me->size[2] == 0.0f) me->size[2]= 1.0f;
-		else if (me->size[2] > 0.0f && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
-		else if (me->size[2] < 0.0f && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
+		if (me->size[2] == 0.0f) me->size[2] = 1.0f;
+		else if (me->size[2] > 0.0f && me->size[2]< 0.00001f) me->size[2] = 0.00001f;
+		else if (me->size[2] < 0.0f && me->size[2]> -0.00001f) me->size[2] = -0.00001f;
 	}
 	
 }
@@ -1480,13 +1469,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
 				float min_r[3], max_r[3];
 				INIT_MINMAX(min_r, max_r);
 				dm->getMinMax(dm, min_r, max_r);
-				size[0]= 0.5f*fabsf(max_r[0] - min_r[0]);
-				size[1]= 0.5f*fabsf(max_r[1] - min_r[1]);
-				size[2]= 0.5f*fabsf(max_r[2] - min_r[2]);
+				size[0] = 0.5f * fabsf(max_r[0] - min_r[0]);
+				size[1] = 0.5f * fabsf(max_r[1] - min_r[1]);
+				size[2] = 0.5f * fabsf(max_r[2] - min_r[2]);
 					
-				center[0]= 0.5f*(max_r[0] + min_r[0]);
-				center[1]= 0.5f*(max_r[1] + min_r[1]);
-				center[2]= 0.5f*(max_r[2] + min_r[2]);
+				center[0] = 0.5f * (max_r[0] + min_r[0]);
+				center[1] = 0.5f * (max_r[1] + min_r[1]);
+				center[2] = 0.5f * (max_r[2] + min_r[2]);
 				return;
 			} else
 			{
@@ -1500,11 +1489,11 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
 			break;
 		case OB_CURVE:
 		case OB_SURF:
-			center[0]= center[1]= center[2]= 0.0;
+			center[0] = center[1] = center[2] = 0.0;
 			size[0]  = size[1]=size[2]=0.0;
 			break;
 		case OB_FONT:
-			center[0]= center[1]= center[2]= 0.0;
+			center[0] = center[1] = center[2] = 0.0;
 			size[0]  = size[1]=size[2]=1.0;
 			break;
 		case OB_MBALL:
@@ -1514,15 +1503,15 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
 	
 	if (bb==NULL) 
 	{
-		center[0]= center[1]= center[2]= 0.0;
-		size[0] = size[1]=size[2]=1.0;
+		center[0] = center[1] = center[2] = 0.0;
+		size[0] = size[1] = size[2] = 1.0;
 	}
 	else 
 	{
 		size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]);
 		size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]);
 		size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]);
-					
+
 		center[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]);
 		center[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]);
 		center[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]);
@@ -1590,12 +1579,20 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
 	//bool bRigidBody = (userigidbody == 0);
 
 	// object has physics representation?
-	if (!(blenderobject->gameflag & OB_COLLISION))
+	if (!(blenderobject->gameflag & OB_COLLISION)) {
+		// Respond to all collisions so that Near sensors work on No Collision
+		// objects.
+		gameobj->SetUserCollisionGroup(0xff);
+		gameobj->SetUserCollisionMask(0xff);
 		return;
+	}
+
+	gameobj->SetUserCollisionGroup(blenderobject->col_group);
+	gameobj->SetUserCollisionMask(blenderobject->col_mask);
 
 	// get Root Parent of blenderobject
 	struct Object* parent= blenderobject->parent;
-	while(parent && parent->parent) {
+	while (parent && parent->parent) {
 		parent= parent->parent;
 	}
 
@@ -1929,8 +1926,7 @@ static KX_GameObject *gameobject_from_blenderobject(
 	KX_GameObject *gameobj = NULL;
 	Scene *blenderscene = kxscene->GetBlenderScene();
 	
-	switch(ob->type)
-	{
+	switch (ob->type) {
 	case OB_LAMP:
 	{
 		KX_LightObject* gamelight = gamelight_from_blamp(ob, static_cast<Lamp*>(ob->data), ob->lay, kxscene, rendertools, converter);
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h
index 6653311..95e3b7c 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.h
+++ b/source/gameengine/Converter/BL_DeformableGameObject.h
@@ -32,9 +32,9 @@
 #ifndef __BL_DEFORMABLEGAMEOBJECT_H__
 #define __BL_DEFORMABLEGAMEOBJECT_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
+#endif
 
 #include "DNA_mesh_types.h"
 #include "KX_GameObject.h"
diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp
index b8002d0..911ff24 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.cpp
+++ b/source/gameengine/Converter/BL_MeshDeformer.cpp
@@ -30,11 +30,10 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+  /* This warning tells us about truncation of __long__ stl-generated names.
+   * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning( disable:4786 )
 #endif
 
 #include "RAS_IPolygonMaterial.h"
@@ -155,27 +154,27 @@ void BL_MeshDeformer::RecalcNormals()
 					v4 = &it.vertex[it.index[i+3]];
 					co4 = m_transverts[v4->getOrigIndex()];
 
-					n1[0]= co1[0]-co3[0];
-					n1[1]= co1[1]-co3[1];
-					n1[2]= co1[2]-co3[2];
+					n1[0] = co1[0] - co3[0];
+					n1[1] = co1[1] - co3[1];
+					n1[2] = co1[2] - co3[2];
 
-					n2[0]= co2[0]-co4[0];
-					n2[1]= co2[1]-co4[1];
-					n2[2]= co2[2]-co4[2];
+					n2[0] = co2[0] - co4[0];
+					n2[1] = co2[1] - co4[1];
+					n2[2] = co2[2] - co4[2];
 				}
 				else {
-					n1[0]= co1[0]-co2[0];
-					n2[0]= co2[0]-co3[0];
-					n1[1]= co1[1]-co2[1];
+					n1[0] = co1[0] - co2[0];
+					n2[0] = co2[0] - co3[0];
+					n1[1] = co1[1] - co2[1];
 
-					n2[1]= co2[1]-co3[1];
-					n1[2]= co1[2]-co2[2];
-					n2[2]= co2[2]-co3[2];
+					n2[1] = co2[1] - co3[1];
+					n1[2] = co1[2] - co2[2];
+					n2[2] = co2[2] - co3[2];
 				}
 
-				fnor[0]= n1[1]*n2[2] - n1[2]*n2[1];
-				fnor[1]= n1[2]*n2[0] - n1[0]*n2[2];
-				fnor[2]= n1[0]*n2[1] - n1[1]*n2[0];
+				fnor[0] = n1[1] * n2[2] - n1[2] * n2[1];
+				fnor[1] = n1[2] * n2[0] - n1[0] * n2[2];
+				fnor[2] = n1[0] * n2[1] - n1[1] * n2[0];
 				normalize_v3(fnor);
 
 				/* add to vertices for smooth normals */
diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h
index 5cea410..6e84cdf 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.h
+++ b/source/gameengine/Converter/BL_MeshDeformer.h
@@ -38,9 +38,9 @@
 #include "MT_Point3.h"
 #include <stdlib.h>
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
+#endif
 
 class BL_DeformableGameObject;
 
@@ -70,7 +70,7 @@ public:
 	virtual	RAS_Deformer*	GetReplica() {return NULL;}
 	virtual void ProcessReplica();
 	struct Mesh* GetMesh() { return m_bmesh; }
-	virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }
+	virtual class RAS_MeshObject* GetRasMesh() { return m_pMeshObject; }
 	virtual float (* GetTransVerts(int *tot))[3]	{	*tot= m_tvtot; return m_transverts; }
 	//	virtual void InitDeform(double time) {}
 
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index eafed84..53755de 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -29,10 +29,9 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include "MEM_guardedalloc.h"
 #include "BL_ModifierDeformer.h"
@@ -42,7 +41,6 @@
 #include "RAS_MeshObject.h"
 #include "PHY_IGraphicController.h"
 
-//#include "BL_ArmatureController.h"
 #include "DNA_armature_types.h"
 #include "DNA_action_types.h"
 #include "DNA_key_types.h"
@@ -65,7 +63,6 @@ extern "C"{
 	#include "BKE_lattice.h"
 	#include "BKE_modifier.h"
 }
- 
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
@@ -113,7 +110,7 @@ bool BL_ModifierDeformer::HasCompatibleDeformer(Object *ob)
 	if ((ob->gameflag & OB_SOFT_BODY) != 0)
 		return false;
 	ModifierData* md;
-	for (md = (ModifierData*)ob->modifiers.first; md; md = (ModifierData*)md->next) {
+	for (md = (ModifierData *)ob->modifiers.first; md; md = md->next) {
 		if (modifier_dependsOnTime(md))
 			continue;
 		if (!(md->mode & eModifierMode_Realtime))
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h
index f04b41d..4efe4ca 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.h
+++ b/source/gameengine/Converter/BL_ModifierDeformer.h
@@ -32,9 +32,9 @@
 #ifndef __BL_MODIFIERDEFORMER_H__
 #define __BL_MODIFIERDEFORMER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
+#endif
 
 #include "BL_ShapeDeformer.h"
 #include "BL_DeformableGameObject.h"
@@ -51,33 +51,34 @@ public:
 
 
 	BL_ModifierDeformer(BL_DeformableGameObject *gameobj,
-						Scene *scene,
-						Object *bmeshobj,
-						RAS_MeshObject *mesh)
-						:
-						BL_ShapeDeformer(gameobj,bmeshobj, mesh),
-						m_lastModifierUpdate(-1),
-						m_scene(scene),
-						m_dm(NULL)
+	                    Scene *scene,
+	                    Object *bmeshobj,
+	                    RAS_MeshObject *mesh)
+	                    :
+	                    BL_ShapeDeformer(gameobj,bmeshobj, mesh),
+	                    m_lastModifierUpdate(-1),
+	                    m_scene(scene),
+	                    m_dm(NULL)
 	{
 		m_recalcNormal = false;
-	};
+	}
 
 	/* this second constructor is needed for making a mesh deformable on the fly. */
 	BL_ModifierDeformer(BL_DeformableGameObject *gameobj,
-						struct Scene *scene,
-						struct Object *bmeshobj_old,
-						struct Object *bmeshobj_new,
-						class RAS_MeshObject *mesh,
-						bool release_object,
-						BL_ArmatureObject* arma = NULL)
-						:
-						BL_ShapeDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, false, arma),
-						m_lastModifierUpdate(-1),
-						m_scene(scene),
-						m_dm(NULL)
+	                    struct Scene *scene,
+	                    struct Object *bmeshobj_old,
+	                    struct Object *bmeshobj_new,
+	                    class RAS_MeshObject *mesh,
+	                    bool release_object,
+	                    BL_ArmatureObject* arma = NULL)
+	                    :
+	                    BL_ShapeDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, false, arma),
+	                    m_lastModifierUpdate(-1),
+	                    m_scene(scene),
+	                    m_dm(NULL)
 	{
-	};
+		/* pass */
+	}
 
 	virtual void ProcessReplica();
 	virtual RAS_Deformer *GetReplica();
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index 8325e80..d8b4f6a 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -528,13 +528,13 @@ PyAttributeDef BL_ShapeActionActuator::Attributes[] = {
 
 PyObject *BL_ShapeActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
+	BL_ShapeActionActuator* self = static_cast<BL_ShapeActionActuator*>(self_v);
 	return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
 }
 
 int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
+	BL_ShapeActionActuator* self = static_cast<BL_ShapeActionActuator*>(self_v);
 	/* exact copy of BL_ActionActuator's function from here down */
 	if (!PyUnicode_Check(value))
 	{
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index f8941e1..f262532 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -29,10 +29,9 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include "MEM_guardedalloc.h"
 #include "BL_ShapeDeformer.h"
@@ -41,7 +40,6 @@
 #include "RAS_IPolygonMaterial.h"
 #include "RAS_MeshObject.h"
 
-//#include "BL_ArmatureController.h"
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_action_types.h"
@@ -60,7 +58,6 @@ extern "C"{
 	#include "BKE_lattice.h"
 	#include "BKE_animsys.h"
 }
- 
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h
index ff5d1e3..60f27c8 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.h
+++ b/source/gameengine/Converter/BL_ShapeDeformer.h
@@ -32,9 +32,9 @@
 #ifndef __BL_SHAPEDEFORMER_H__
 #define __BL_SHAPEDEFORMER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
+#endif
 
 #include "BL_SkinDeformer.h"
 #include "BL_DeformableGameObject.h"
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index c175c1e..e068a91 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -29,10 +29,9 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 // Eigen3 stuff used for BGEDeformVerts
 #include <Eigen/Core>
@@ -72,7 +71,7 @@ static short get_deformflags(struct Object *bmeshobj)
 	short flags = ARM_DEF_VGROUP;
 
 	ModifierData *md;
-	for (md = (ModifierData*)bmeshobj->modifiers.first; md; md = (ModifierData*)md->next)
+	for (md = (ModifierData *)bmeshobj->modifiers.first; md; md = md->next)
 	{
 		if (md->type == eModifierType_Armature)
 		{
@@ -249,7 +248,7 @@ void BL_SkinDeformer::BGEDeformVerts()
 		int i;
 		for (i=0, dg=(bDeformGroup*)m_objMesh->defbase.first;
 			dg;
-			++i, dg=(bDeformGroup*)dg->next)
+			++i, dg = dg->next)
 		{
 			m_dfnrToPC[i] = BKE_pose_channel_find_name(par_arma->pose, dg->name);
 
diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h
index f1e1e51..7495deb 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.h
+++ b/source/gameengine/Converter/BL_SkinDeformer.h
@@ -32,8 +32,8 @@
 #ifndef __BL_SKINDEFORMER_H__
 #define __BL_SKINDEFORMER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
 #endif  /* WIN32 */
 
 #include "CTR_HashedPtr.h"
@@ -56,18 +56,18 @@ public:
 	void SetArmature (class BL_ArmatureObject *armobj);
 
 	BL_SkinDeformer(BL_DeformableGameObject *gameobj,
-					struct Object *bmeshobj, 
-					class RAS_MeshObject *mesh,
-					BL_ArmatureObject* arma = NULL);
+	                struct Object *bmeshobj,
+	                class RAS_MeshObject *mesh,
+	                BL_ArmatureObject* arma = NULL);
 
 	/* this second constructor is needed for making a mesh deformable on the fly. */
 	BL_SkinDeformer(BL_DeformableGameObject *gameobj,
-					struct Object *bmeshobj_old,
-					struct Object *bmeshobj_new,
-					class RAS_MeshObject *mesh,
-					bool release_object,
-					bool recalc_normal,
-					BL_ArmatureObject* arma = NULL);
+	                struct Object *bmeshobj_old,
+	                struct Object *bmeshobj_new,
+	                class RAS_MeshObject *mesh,
+	                bool release_object,
+	                bool recalc_normal,
+	                BL_ArmatureObject* arma = NULL);
 
 	virtual RAS_Deformer *GetReplica();
 	virtual void ProcessReplica();
@@ -120,5 +120,4 @@ protected:
 #endif
 };
 
-#endif
-
+#endif  /* __BL_SKINDEFORMER_H__ */
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index 1826f1a..e9dd97f 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -49,18 +49,17 @@ set(INC
 	../../blender/makesdna
 	../../blender/makesrna
 	../../blender/windowmanager
-	../../../extern/bullet2/src
-	../../../extern/Eigen3
 	../../../intern/container
 	../../../intern/guardedalloc
 	../../../intern/moto/include
 	../../../intern/string
-	../../../extern/recastnavigation/Detour/Include
 )
 
 set(INC_SYS
+	../../../extern/recastnavigation/Detour/Include
+	../../../extern/Eigen3
 	${PTHREADS_INCLUDE_DIRS}
-
+	${BOOST_INCLUDE_DIR}
 )
 
 set(SRC
@@ -110,6 +109,9 @@ set(SRC
 )
 
 if(WITH_BULLET)
+	list(APPEND INC_SYS
+		../../../extern/bullet2/src
+	)
 	add_definitions(-DUSE_BULLET)
 endif()
 
diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
index 7221258..1e1bc73 100644
--- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
+++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
@@ -52,7 +52,7 @@ BL_InterpolatorList::BL_InterpolatorList(bAction *action)
 	if (action==NULL)
 		return;
 	
-	for (FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) {
+	for (FCurve *fcu = (FCurve *)action->curves.first; fcu; fcu = fcu->next) {
 		if (fcu->rna_path) {
 			BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); 
 			//assert(new_ipo);
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 9020720..d1684db 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -29,9 +29,8 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* suppress stl-MSVC debug info warning */
 #endif
 
 #include "KX_Scene.h"
@@ -104,6 +103,7 @@ extern "C"
 #include "KX_MeshProxy.h"
 #include "RAS_MeshObject.h"
 extern "C" {
+	#include "PIL_time.h"
 	#include "BKE_context.h"
 	#include "BLO_readfile.h"
 	#include "BKE_idcode.h"
@@ -819,13 +819,13 @@ void	KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
 						if (icu_rz) icu_rz->ipo = IPO_LIN;
 					}
 					
-					if (icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
-					if (icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
-					if (icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
+					if (icu_rx) eulerAnglesOld[0] = eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
+					if (icu_ry) eulerAnglesOld[1] = eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
+					if (icu_rz) eulerAnglesOld[2] = eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
 					
 					// orn.getValue((float *)tmat); // uses the wrong ordering, cant use this
-					for (int r=0;r<3;r++)
-						for (int c=0;c<3;c++)
+					for (int r = 0; r < 3; r++)
+						for (int c = 0; c < 3; c++)
 							tmat[r][c] = orn[c][r];
 					
 					// mat3_to_eul( eulerAngles,tmat); // better to use Mat3ToCompatibleEul
@@ -945,7 +945,7 @@ static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const c
 	
 	int i=0;
 	LinkNode *n= names;
-	while(n) {
+	while (n) {
 		BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
 		n= (LinkNode *)n->next;
 		i++;
@@ -958,10 +958,12 @@ static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const c
 bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options)
 {
 	Main *main_newlib; /* stored as a dynamic 'main' until we free it */
-	int idcode= BKE_idcode_from_name(group);
+	const int idcode = BKE_idcode_from_name(group);
 	ReportList reports;
 	static char err_local[255];
-	
+
+//	TIMEIT_START(bge_link_blend_file);
+
 	/* only scene and mesh supported right now */
 	if (idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
 		snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
@@ -1060,7 +1062,9 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 			}
 		}
 	}
-	
+
+//	TIMEIT_END(bge_link_blend_file);
+
 	return true;
 }
 
@@ -1171,7 +1175,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 					else {
 						/* free the mesh, we could be referecing a linked one! */
 						int mesh_index= gameobj->GetMeshCount();
-						while(mesh_index--) {
+						while (mesh_index--) {
 							mesh= gameobj->GetMesh(mesh_index);
 							if (IS_TAGGED(mesh->GetMesh())) {
 								gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
@@ -1451,14 +1455,12 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
 				BLI_remlink(&m_maggie->mat, mat_new);
 				BLI_addtail(&maggie->mat, mat_new);
 				
-				mesh->mat[i]= mat_new;
+				mesh->mat[i] = mat_new;
 				
 				/* the same material may be used twice */
-				for (int j=i+1; j<mesh->totcol; j++)
-				{
-					if (mesh->mat[j]==mat_old)
-					{
-						mesh->mat[j]= mat_new;
+				for (int j = i + 1; j < mesh->totcol; j++) {
+					if (mesh->mat[j] == mat_old) {
+						mesh->mat[j] = mat_new;
 						mat_new->id.us++;
 						mat_old->id.us--;
 					}
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index 436bdb5..34a1117 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -165,11 +165,11 @@ public:
 		printf("\t m_materials: %d\n", (int)m_materials.size());
 
 		printf("\nMappings...\n");
-		printf("\t m_map_blender_to_gameobject: %d\n", (int)m_map_blender_to_gameobject.size());
-		printf("\t m_map_mesh_to_gamemesh: %d\n", (int)m_map_mesh_to_gamemesh.size());
-		printf("\t m_map_blender_to_gameactuator: %d\n", (int)m_map_blender_to_gameactuator.size());
-		printf("\t m_map_blender_to_gamecontroller: %d\n", (int)m_map_blender_to_gamecontroller.size());
-		printf("\t m_map_blender_to_gameAdtList: %d\n", (int)m_map_blender_to_gameAdtList.size());
+		printf("\t m_map_blender_to_gameobject: %d\n", m_map_blender_to_gameobject.size());
+		printf("\t m_map_mesh_to_gamemesh: %d\n", m_map_mesh_to_gamemesh.size());
+		printf("\t m_map_blender_to_gameactuator: %d\n", m_map_blender_to_gameactuator.size());
+		printf("\t m_map_blender_to_gamecontroller: %d\n", m_map_blender_to_gamecontroller.size());
+		printf("\t m_map_blender_to_gameAdtList: %d\n", m_map_blender_to_gameAdtList.size());
 
 #ifdef WITH_CXX_GUARDEDALLOC
 		MEM_printmemlist_pydict();
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 287be3b..0639964 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -30,10 +30,9 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786) 
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include <math.h>
 
@@ -105,22 +104,25 @@
 #include "BL_BlenderDataConversion.h"
 
 /** 
- * KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
+ * KX_flt_trunc needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
  */
 
-#define KX_BLENDERTRUNC(x)  (( x < 0.0001f && x > -0.0001f ) ? 0.0f : x)
+BLI_INLINE float KX_flt_trunc(const float x)
+{
+	return ( x < 0.0001f && x > -0.0001f ) ? 0.0f : x;
+}
 
 void BL_ConvertActuators(const char* maggiename,
-						 struct Object* blenderobject,
-						 KX_GameObject* gameobj,
-						 SCA_LogicManager* logicmgr,
-						 KX_Scene* scene,
-						 KX_KetsjiEngine* ketsjiEngine,
-						 int activeLayerBitInfo,
-						 bool isInActiveLayer,
-						 RAS_IRenderTools* rendertools,
-						 KX_BlenderSceneConverter* converter
-						 )
+                         struct Object* blenderobject,
+                         KX_GameObject* gameobj,
+                         SCA_LogicManager* logicmgr,
+                         KX_Scene* scene,
+                         KX_KetsjiEngine* ketsjiEngine,
+                         int activeLayerBitInfo,
+                         bool isInActiveLayer,
+                         RAS_IRenderTools* rendertools,
+                         KX_BlenderSceneConverter* converter
+                         )
 {
 	
 	int uniqueint = 0;
@@ -134,7 +136,7 @@ void BL_ConvertActuators(const char* maggiename,
 	}
 	gameobj->ReserveActuator(actcount);
 	bact = (bActuator*) blenderobject->actuators.first;
-	while(bact)
+	while (bact)
 	{
 		STR_String uniquename = bact->name;
 		STR_String& objectname = gameobj->GetName();
@@ -146,20 +148,23 @@ void BL_ConvertActuators(const char* maggiename,
 			{
 				bObjectActuator* obact = (bObjectActuator*) bact->data;
 				KX_GameObject* obref = NULL;
-				MT_Vector3 forcevec(KX_BLENDERTRUNC(obact->forceloc[0]),
-					KX_BLENDERTRUNC(obact->forceloc[1]),
-					KX_BLENDERTRUNC(obact->forceloc[2]));
-				MT_Vector3 torquevec(obact->forcerot[0],obact->forcerot[1],obact->forcerot[2]);
-				MT_Vector3 dlocvec ( KX_BLENDERTRUNC(obact->dloc[0]),
-					KX_BLENDERTRUNC(obact->dloc[1]),
-					KX_BLENDERTRUNC(obact->dloc[2]));
-				MT_Vector3 drotvec ( KX_BLENDERTRUNC(obact->drot[0]),obact->drot[1],obact->drot[2]);
-				MT_Vector3 linvelvec ( KX_BLENDERTRUNC(obact->linearvelocity[0]),
-					KX_BLENDERTRUNC(obact->linearvelocity[1]),
-					KX_BLENDERTRUNC(obact->linearvelocity[2]));
-				MT_Vector3 angvelvec ( KX_BLENDERTRUNC(obact->angularvelocity[0]),
-					KX_BLENDERTRUNC(obact->angularvelocity[1]),
-					KX_BLENDERTRUNC(obact->angularvelocity[2]));
+				MT_Vector3 forcevec(KX_flt_trunc(obact->forceloc[0]),
+				                    KX_flt_trunc(obact->forceloc[1]),
+				                    KX_flt_trunc(obact->forceloc[2]));
+				MT_Vector3 torquevec(obact->forcerot[0],
+				                     obact->forcerot[1],
+				                     obact->forcerot[2]);
+				MT_Vector3 dlocvec(KX_flt_trunc(obact->dloc[0]),
+				                   KX_flt_trunc(obact->dloc[1]),
+				                   KX_flt_trunc(obact->dloc[2]));
+				MT_Vector3 drotvec(KX_flt_trunc(obact->drot[0]),
+				                   obact->drot[1],obact->drot[2]);
+				MT_Vector3 linvelvec(KX_flt_trunc(obact->linearvelocity[0]),
+				                     KX_flt_trunc(obact->linearvelocity[1]),
+				                     KX_flt_trunc(obact->linearvelocity[2]));
+				MT_Vector3 angvelvec(KX_flt_trunc(obact->angularvelocity[0]),
+				                     KX_flt_trunc(obact->angularvelocity[1]),
+				                     KX_flt_trunc(obact->angularvelocity[2]));
 				short damping = obact->damping;
 
 				/* Blender uses a bit vector internally for the local-flags. In */
@@ -181,17 +186,17 @@ void BL_ConvertActuators(const char* maggiename,
 					obref = converter->FindGameObject(obact->reference);
 				}
 				
-				KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(gameobj,
-					obref,
-					forcevec.getValue(),
-					torquevec.getValue(),
-					dlocvec.getValue(),
-					drotvec.getValue(),
-					linvelvec.getValue(),
-					angvelvec.getValue(),
-					damping,
-					bitLocalFlag
-					);
+				KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(
+				            gameobj,
+				            obref,
+				            forcevec.getValue(),
+				            torquevec.getValue(),
+				            dlocvec.getValue(),
+				            drotvec.getValue(),
+				            linvelvec.getValue(),
+				            angvelvec.getValue(),
+				            damping,
+				            bitLocalFlag);
 				baseact = tmpbaseact;
 				break;
 			}
@@ -210,22 +215,22 @@ void BL_ConvertActuators(const char* maggiename,
 				if (actact->flag & ACT_IPOCHILD) ipo_flags |= BL_Action::ACT_IPOFLAG_CHILD;
 					
 				BL_ActionActuator* tmpbaseact = new BL_ActionActuator(
-					gameobj,
-					propname,
-					propframe,
-					actact->sta,
-					actact->end,
-					actact->act,
-					actact->type, // + 1, because Blender starts to count at zero,
-					actact->blendin,
-					actact->priority,
-					actact->layer,
-					actact->layer_weight,
-					ipo_flags,
-					actact->end_reset,
-					actact->stridelength
-					// Ketsji at 1, because zero is reserved for "NoDef"
-					);
+				            gameobj,
+				            propname,
+				            propframe,
+				            actact->sta,
+				            actact->end,
+				            actact->act,
+				            actact->type, // + 1, because Blender starts to count at zero,
+				            actact->blendin,
+				            actact->priority,
+				            actact->layer,
+				            actact->layer_weight,
+				            ipo_flags,
+				            actact->end_reset,
+				            actact->stridelength
+				            // Ketsji at 1, because zero is reserved for "NoDef"
+				            );
 				baseact= tmpbaseact;
 				break;
 			}
@@ -237,18 +242,17 @@ void BL_ConvertActuators(const char* maggiename,
 					STR_String propframe = (actact->frameProp ? actact->frameProp : "");
 					
 					BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
-						gameobj,
-						propname,
-						propframe,
-						actact->sta,
-						actact->end,
-						actact->act,
-						actact->type, // + 1, because Blender starts to count at zero,
-						actact->blendin,
-						actact->priority,
-						actact->stridelength
-						// Ketsji at 1, because zero is reserved for "NoDef"
-						);
+					            gameobj,
+					            propname,
+					            propframe,
+					            actact->sta,
+					            actact->end,
+					            actact->act,
+					            actact->type, // + 1, because Blender starts to count at zero,
+					            actact->blendin,
+					            actact->priority,
+					            actact->stridelength);
+					// Ketsji at 1, because zero is reserved for "NoDef"
 					baseact= tmpbaseact;
 					break;
 				}
@@ -267,17 +271,17 @@ void BL_ConvertActuators(const char* maggiename,
 				bool ipo_add = (ipoact->flag & ACT_IPOADD);
 				
 				KX_IpoActuator* tmpbaseact = new KX_IpoActuator(
-					gameobj,
-					propname ,
-					frameProp,
-					ipoact->sta,
-					ipoact->end,
-					ipochild,
-					ipoact->type + 1, // + 1, because Blender starts to count at zero,
-					// Ketsji at 1, because zero is reserved for "NoDef"
-					ipo_as_force,
-					ipo_add,
-					local);
+				            gameobj,
+				            propname ,
+				            frameProp,
+				            ipoact->sta,
+				            ipoact->end,
+				            ipochild,
+				            ipoact->type + 1, // + 1, because Blender starts to count at zero,
+				            // Ketsji at 1, because zero is reserved for "NoDef"
+				            ipo_as_force,
+				            ipo_add,
+				            local);
 				baseact = tmpbaseact;
 				break;
 			}
@@ -293,14 +297,14 @@ void BL_ConvertActuators(const char* maggiename,
 					
 					/* visifac, fac and axis are not copied from the struct...   */ 
 					/* that's some internal state...                             */
-					KX_CameraActuator *tmpcamact
-						= new KX_CameraActuator(gameobj,
-						tmpgob,
-						camact->height,
-						camact->min,
-						camact->max,
-						camact->axis,
-						camact->damping);
+					KX_CameraActuator *tmpcamact = new KX_CameraActuator(
+					            gameobj,
+					            tmpgob,
+					            camact->height,
+					            camact->min,
+					            camact->max,
+					            camact->axis,
+					            camact->damping);
 					baseact = tmpcamact;
 				}
 				break;
@@ -333,14 +337,13 @@ void BL_ConvertActuators(const char* maggiename,
 					? (char*) msgAct->body
 					: "");
 				
-				KX_NetworkMessageActuator *tmpmsgact = 
-					new KX_NetworkMessageActuator(
-					gameobj,					// actuator controlling object
-					scene->GetNetworkScene(),	// needed for replication
-					toPropName,
-					subject,
-					bodyType,
-					body);
+				KX_NetworkMessageActuator *tmpmsgact = new KX_NetworkMessageActuator(
+				            gameobj,					// actuator controlling object
+				            scene->GetNetworkScene(),	// needed for replication
+				            toPropName,
+				            subject,
+				            bodyType,
+				            body);
 				baseact = tmpmsgact;
 				break;
 			}
@@ -355,7 +358,7 @@ void BL_ConvertActuators(const char* maggiename,
 				KX_SoundActuator::KX_SOUNDACT_TYPE
 					soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
 				
-				switch(soundact->type) {
+				switch (soundact->type) {
 				case ACT_SND_PLAY_STOP_SOUND:
 					soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP;
 					break;
@@ -384,7 +387,7 @@ void BL_ConvertActuators(const char* maggiename,
 				{
 					bSound* sound = soundact->sound;
 					bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false;
-					AUD_Reference<AUD_IFactory> snd_sound;
+					boost::shared_ptr<AUD_IFactory> snd_sound;
 					KX_3DSoundSettings settings;
 					settings.cone_inner_angle = soundact->sound3D.cone_inner_angle;
 					settings.cone_outer_angle = soundact->sound3D.cone_outer_angle;
@@ -403,21 +406,21 @@ void BL_ConvertActuators(const char* maggiename,
 					}
 					else
 					{
-						snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle);
+						snd_sound = *reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(sound->playback_handle);
 
 						// if sound shall be 3D but isn't mono, we have to make it mono!
 						if (is3d)
 						{
 							try
 							{
-								AUD_Reference<AUD_IReader> reader = snd_sound->createReader();
+								boost::shared_ptr<AUD_IReader> reader = snd_sound->createReader();
 								if (reader->getSpecs().channels != AUD_CHANNELS_MONO)
 								{
 									AUD_DeviceSpecs specs;
 									specs.channels = AUD_CHANNELS_MONO;
 									specs.rate = AUD_RATE_INVALID;
 									specs.format = AUD_FORMAT_INVALID;
-									snd_sound = new AUD_ChannelMapperFactory(snd_sound, specs);
+									snd_sound = boost::shared_ptr<AUD_IFactory>(new AUD_ChannelMapperFactory(snd_sound, specs));
 								}
 							}
 							catch(AUD_Exception&)
@@ -457,11 +460,11 @@ void BL_ConvertActuators(const char* maggiename,
 					destinationObj = converter->FindGameObject(propact->ob);
 				
 				SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator(
-					gameobj,
-					destinationObj,
-					propact->name,
-					propact->value,
-					propact->type+1); // + 1 because Ketsji Logic starts
+				            gameobj,
+				            destinationObj,
+				            propact->name,
+				            propact->value,
+				            propact->type + 1); // + 1 because Ketsji Logic starts
 				// with 0 for KX_ACT_PROP_NODEF
 				baseact = tmppropact;
 				break;
@@ -491,18 +494,16 @@ void BL_ConvertActuators(const char* maggiename,
 							}
 						}
 						
-						KX_SCA_AddObjectActuator* tmpaddact = 
-							new KX_SCA_AddObjectActuator(
-								gameobj, 
-								originalval,
-								editobact->time,
-								scene,
-								editobact->linVelocity,
-								(editobact->localflag & ACT_EDOB_LOCAL_LINV)!=0,
-								editobact->angVelocity,
-								(editobact->localflag & ACT_EDOB_LOCAL_ANGV)!=0
-								);
-								
+						KX_SCA_AddObjectActuator* tmpaddact = new KX_SCA_AddObjectActuator(
+						            gameobj,
+						            originalval,
+						            editobact->time,
+						            scene,
+						            editobact->linVelocity,
+						            (editobact->localflag & ACT_EDOB_LOCAL_LINV) != 0,
+						            editobact->angVelocity,
+						            (editobact->localflag & ACT_EDOB_LOCAL_ANGV) != 0);
+
 								//editobact->ob to gameobj
 								baseact = tmpaddact;
 					}
@@ -519,23 +520,20 @@ void BL_ConvertActuators(const char* maggiename,
 						RAS_MeshObject *tmpmesh = NULL;
 						if (editobact->me)
 							tmpmesh = BL_ConvertMesh(
-								editobact->me,
-								blenderobject,
-								scene,
-								converter
-								);
+							            editobact->me,
+							            blenderobject,
+							            scene,
+							            converter
+							            );
 
-						KX_SCA_ReplaceMeshActuator* tmpreplaceact
-							= new KX_SCA_ReplaceMeshActuator(
-								gameobj,
-								tmpmesh,
-								scene,
-								(editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX)==0,
-								(editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS)!=0
-								
-								);
-							
-							baseact = tmpreplaceact;
+						KX_SCA_ReplaceMeshActuator* tmpreplaceact = new KX_SCA_ReplaceMeshActuator(
+						            gameobj,
+						            tmpmesh,
+						            scene,
+						            (editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX) == 0,
+						            (editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS) != 0);
+
+						baseact = tmpreplaceact;
 					}
 					break;
 				case ACT_EDOB_TRACK_TO:
@@ -544,25 +542,23 @@ void BL_ConvertActuators(const char* maggiename,
 						if (editobact->ob)
 							originalval = converter->FindGameObject(editobact->ob);
 							
-						KX_TrackToActuator* tmptrackact 
-							= new KX_TrackToActuator(gameobj, 
-								originalval,
-								editobact->time,
-								editobact->flag,
-								blenderobject->trackflag,
-								blenderobject->upflag
-								);
-							baseact = tmptrackact;
+						KX_TrackToActuator* tmptrackact = new KX_TrackToActuator(
+						            gameobj,
+						            originalval,
+						            editobact->time,
+						            editobact->flag,
+						            blenderobject->trackflag,
+						            blenderobject->upflag);
+						baseact = tmptrackact;
 						break;
 					}
 				case ACT_EDOB_DYNAMICS:
 					{
-						KX_SCA_DynamicActuator* tmpdynact 
-							= new KX_SCA_DynamicActuator(gameobj, 
-								editobact->dyn_operation,
-								editobact->mass
-								);
-							baseact = tmpdynact;
+						KX_SCA_DynamicActuator* tmpdynact = new KX_SCA_DynamicActuator(
+						            gameobj,
+						            editobact->dyn_operation,
+						            editobact->mass);
+						baseact = tmpdynact;
 					}
 				}
 				break;
@@ -694,17 +690,17 @@ void BL_ConvertActuators(const char* maggiename,
 						; /* error */ 
 					}
 				}
-				KX_ConstraintActuator *tmpconact 
-					= new KX_ConstraintActuator(gameobj,
-						conact->damp,
-						conact->rotdamp,
-						min,
-						max,
-						conact->maxrot,
-						locrot,
-						conact->time,
-						conact->flag,
-						prop);
+				KX_ConstraintActuator *tmpconact = new KX_ConstraintActuator(
+				            gameobj,
+				            conact->damp,
+				            conact->rotdamp,
+				            min,
+				            max,
+				            conact->maxrot,
+				            locrot,
+				            conact->time,
+				            conact->flag,
+				            prop);
 				baseact = tmpconact;
 				break;
 			}
@@ -777,13 +773,14 @@ void BL_ConvertActuators(const char* maggiename,
 				default:
 					; /* flag error */
 				}
-				tmpsceneact = new KX_SceneActuator(gameobj,
-						mode,
-						scene,
-						ketsjiEngine,
-						nextSceneName,
-						cam);
-					baseact = tmpsceneact;
+				tmpsceneact = new KX_SceneActuator(
+				            gameobj,
+				            mode,
+				            scene,
+				            ketsjiEngine,
+				            nextSceneName,
+				            cam);
+				baseact = tmpsceneact;
 				break;
 			}
 		case ACT_GAME:
@@ -832,13 +829,14 @@ void BL_ConvertActuators(const char* maggiename,
 				default:
 					; /* flag error */
 				}
-					tmpgameact = new KX_GameActuator(gameobj,
-						mode,
-						filename,
-						loadinganimationname,
-						scene,
-						ketsjiEngine);
-					baseact = tmpgameact;
+				tmpgameact = new KX_GameActuator(
+				            gameobj,
+				            mode,
+				            filename,
+				            loadinganimationname,
+				            scene,
+				            ketsjiEngine);
+				baseact = tmpgameact;
 
 				break;
 			}
@@ -905,12 +903,13 @@ void BL_ConvertActuators(const char* maggiename,
 				default:
 					; /* error */
 				}
-				tmprandomact = new SCA_RandomActuator(gameobj,
-					seedArg,
-					modeArg, 
-					paraArg1,
-					paraArg2,
-					randAct->propname);
+				tmprandomact = new SCA_RandomActuator(
+				            gameobj,
+				            seedArg,
+				            modeArg,
+				            paraArg1,
+				            paraArg2,
+				            randAct->propname);
 				baseact = tmprandomact;
 			}
 			break;
@@ -947,8 +946,7 @@ void BL_ConvertActuators(const char* maggiename,
 			SCA_2DFilterActuator *tmp = NULL;
 
 			RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode;
-			switch(_2dfilter->type)
-			{
+			switch (_2dfilter->type) {
 				case ACT_2DFILTER_MOTIONBLUR:
 					filtermode = RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR;
 					break;
@@ -999,8 +997,9 @@ void BL_ConvertActuators(const char* maggiename,
 					break;
 			}
 
-			tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
-				_2dfilter->float_arg,_2dfilter->int_arg,ketsjiEngine->GetRasterizer(),scene);
+			tmp = new SCA_2DFilterActuator(gameobj, filtermode,  _2dfilter->flag,
+			                               _2dfilter->float_arg, _2dfilter->int_arg,
+			                               ketsjiEngine->GetRasterizer(), scene);
 
 			if (_2dfilter->text)
 			{
@@ -1026,8 +1025,7 @@ void BL_ConvertActuators(const char* maggiename,
 				bool ghost = true;
 				KX_GameObject *tmpgob = NULL;
 
-				switch(parAct->type)
-				{
+				switch (parAct->type) {
 					case ACT_PARENT_SET:
 						mode = KX_ParentActuator::KX_PARENT_SET;
 						tmpgob = converter->FindGameObject(parAct->ob);
@@ -1055,7 +1053,15 @@ void BL_ConvertActuators(const char* maggiename,
 				bArmatureActuator* armAct = (bArmatureActuator*) bact->data;
 				KX_GameObject *tmpgob = converter->FindGameObject(armAct->target);
 				KX_GameObject *subgob = converter->FindGameObject(armAct->subtarget);
-				BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight, armAct->influence);
+				BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(
+				            gameobj,
+				            armAct->type,
+				            armAct->posechannel,
+				            armAct->constraint,
+				            tmpgob,
+				            subgob,
+				            armAct->weight,
+				            armAct->influence);
 				baseact = tmparmact;
 				break;
 			}
@@ -1073,8 +1079,7 @@ void BL_ConvertActuators(const char* maggiename,
 				KX_GameObject *targetob = converter->FindGameObject(stAct->target);
 
 				int mode = KX_SteeringActuator::KX_STEERING_NODEF;
-				switch(stAct->type)
-				{
+				switch (stAct->type) {
 				case ACT_STEERING_SEEK:
 					mode = KX_SteeringActuator::KX_STEERING_SEEK;
 					break;
diff --git a/source/gameengine/Converter/KX_ConvertActuators.h b/source/gameengine/Converter/KX_ConvertActuators.h
index 596c8ca..385d274 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.h
+++ b/source/gameengine/Converter/KX_ConvertActuators.h
@@ -33,14 +33,14 @@
 #define __KX_CONVERTACTUATORS_H__
 
 void BL_ConvertActuators(const char* maggiename,
-	 struct Object* blenderobject,
-	 class KX_GameObject* gameobj,
-	 class SCA_LogicManager* logicmgr,
-	 class KX_Scene* scene,
-	 class KX_KetsjiEngine* ketsjiEngine,
-	 int activeLayerBitInfo,
-	 bool isInActiveLayer,
-	 class RAS_IRenderTools* rendertools, 
-	 class KX_BlenderSceneConverter* converter);
+                         struct Object* blenderobject,
+                         class KX_GameObject* gameobj,
+                         class SCA_LogicManager* logicmgr,
+                         class KX_Scene* scene,
+                         class KX_KetsjiEngine* ketsjiEngine,
+                         int activeLayerBitInfo,
+                         bool isInActiveLayer,
+                         class RAS_IRenderTools* rendertools,
+                         class KX_BlenderSceneConverter* converter);
 
 #endif  /* __KX_CONVERTACTUATORS_H__ */
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp
index 3a6aa22..769abd0 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -110,8 +110,7 @@ void BL_ConvertControllers(
 	while (bcontr)
 	{
 		SCA_IController* gamecontroller = NULL;
-		switch(bcontr->type)
-		{
+		switch (bcontr->type) {
 			case CONT_LOGIC_AND:
 			{
 				gamecontroller = new SCA_ANDController(gameobj);
diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp
index a63f4c3..7222c67 100644
--- a/source/gameengine/Converter/KX_ConvertProperties.cpp
+++ b/source/gameengine/Converter/KX_ConvertProperties.cpp
@@ -69,13 +69,12 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
 	bProperty* prop = (bProperty*)object->prop.first;
 	CValue* propval;
 	bool show_debug_info;
-	while(prop)
-	{
-	
+
+	while (prop) {
 		propval = NULL;
 		show_debug_info = bool (prop->flag & PROP_DEBUG);
 
-		switch(prop->type) {
+		switch (prop->type) {
 			case GPROP_BOOL:
 			{
 				propval = new CBoolValue((bool)(prop->data != 0));
@@ -184,7 +183,7 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
 	STR_String str = curve->str;
 	CValue* propval = NULL;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case GPROP_BOOL:
 		{
 			int value = atoi(str);
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 3d4f3ae..538f9e2 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -33,17 +33,17 @@
 
 #include <stdio.h>
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include "wm_event_types.h"
 #include "KX_BlenderSceneConverter.h"
 #include "KX_ConvertSensors.h"
 
 /* This little block needed for linking to Blender... */
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#include "BLI_winstuff.h"
+#ifdef _MSC_VER
+#  include "BLI_winstuff.h"
 #endif
 
 #include "DNA_object_types.h"
@@ -118,8 +118,8 @@ void BL_ConvertSensors(struct Object* blenderobject,
 	}
 	gameobj->ReserveSensor(count);
 	sens = (bSensor*)blenderobject->sensors.first;
-	while(sens)
-	{
+
+	while (sens) {
 		SCA_ISensor* gamesensor=NULL;
 		/* All sensors have a pulse toggle, frequency, and invert field.     */
 		/* These are extracted here, and set when the sensor is added to the */
@@ -398,7 +398,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
 					
 					/* Better do an explicit conversion here! (was implicit      */
 					/* before...)                                                */
-					switch(blenderpropsensor->type) {
+					switch (blenderpropsensor->type) {
 					case SENS_PROP_EQUAL:
 						propchecktype = SCA_PropertySensor::KX_PROPSENSOR_EQUAL;
 						break;
@@ -573,8 +573,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
 					int hatf	=0;
 					int prec	=0;
 					
-					switch(bjoy->type)
-					{
+					switch (bjoy->type) {
 					case SENS_JOY_AXIS:
 						axis	= bjoy->axis;
 						axisf	= bjoy->axisf;
@@ -633,9 +632,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
 			uniqueval->Release();
 			
 			/* Conversion succeeded, so we can set the generic props here.   */
-			gamesensor->SetPulseMode(pos_pulsemode, 
-									 neg_pulsemode, 
-									 frequency);
+			gamesensor->SetPulseMode(pos_pulsemode,
+			                         neg_pulsemode,
+			                         frequency);
 			gamesensor->SetInvert(invert);
 			gamesensor->SetLevel(level);
 			gamesensor->SetTap(tap);
diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp
index 12f8825..a81d52f 100644
--- a/source/gameengine/Converter/KX_IpoConvert.cpp
+++ b/source/gameengine/Converter/KX_IpoConvert.cpp
@@ -29,10 +29,9 @@
  *  \ingroup bgeconv
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// don't show stl-warnings
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+   /* don't show stl-warnings */
+#  pragma warning (disable:4786)
 #endif
 
 #include "BKE_material.h" /* give_current_material */
@@ -97,7 +96,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
 
 	const char *rotmode, *drotmode;
 
-	switch(blenderobject->rotmode) {
+	switch (blenderobject->rotmode) {
 	case ROT_MODE_AXISANGLE:
 		rotmode = "rotation_axis_angle";
 		drotmode = "delta_rotation_axis_angle";
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
index e3c12c2..72d0c87 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
@@ -30,8 +30,8 @@
  */
 
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif //WIN32
 
 #include "MT_assert.h"
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.h b/source/gameengine/Converter/KX_SoftBodyDeformer.h
index de533f1..d7bc088 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.h
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.h
@@ -32,9 +32,9 @@
 #ifndef __KX_SOFTBODYDEFORMER_H__
 #define __KX_SOFTBODYDEFORMER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
+#endif
 
 #include "RAS_Deformer.h"
 #include "BL_DeformableGameObject.h"
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index e95ae54..b9c7091 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -11,7 +11,7 @@ incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf'
 incs += ' #intern/moto/include #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork'
 incs += ' #source/blender/blenlib #source/blender/blenkernel #source/blender'
 incs += ' #source/blender/editors/include #source/blender/makesdna #source/gameengine/Rasterizer'
-incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer #source/gameengine/GameLogic'
+incs += ' #source/gameengine/GameLogic'
 incs += ' #source/gameengine/Expressions #source/gameengine/Network #source/gameengine/SceneGraph'
 incs += ' #source/gameengine/Physics/common #source/gameengine/Physics/Bullet'
 incs += ' #source/gameengine/Physics/Dummy'
@@ -24,6 +24,7 @@ incs += ' #extern/recastnavigation/Detour/Include'
 incs += ' #extern/Eigen3'
 
 incs += ' ' + env['BF_BULLET_INC']
+incs += ' ' + env['BF_BOOST_INC']
 
 if env['BF_DEBUG']:
     if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc', 'win64-mingw'):
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index e640923..ee91387 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -104,39 +104,37 @@ this object
 {
 	CValue *ret;
 	
-	switch(dtype)
-	{
-	case VALUE_EMPTY_TYPE:
-	case VALUE_BOOL_TYPE:
+	switch (dtype) {
+		case VALUE_EMPTY_TYPE:
+		case VALUE_BOOL_TYPE:
 		{
-			switch(op)
-			{
-			case VALUE_AND_OPERATOR:
+			switch (op) {
+				case VALUE_AND_OPERATOR:
 				{
 					ret = new CBoolValue (((CBoolValue *) val)->GetBool() && m_bool);
 					break;
 				}
-			case VALUE_OR_OPERATOR:
+				case VALUE_OR_OPERATOR:
 				{
 					ret = new CBoolValue (((CBoolValue *) val)->GetBool() || m_bool);
 					break;
 				}
-			case VALUE_EQL_OPERATOR:
+				case VALUE_EQL_OPERATOR:
 				{
 					ret = new CBoolValue (((CBoolValue *) val)->GetBool() == m_bool);
 					break;
 				}
-			case VALUE_NEQ_OPERATOR:
+				case VALUE_NEQ_OPERATOR:
 				{
 					ret = new CBoolValue (((CBoolValue *) val)->GetBool() != m_bool);
 					break;
 				}
-			case VALUE_NOT_OPERATOR:
+				case VALUE_NOT_OPERATOR:
 				{
 					return new CBoolValue (!m_bool);
 					break;
 				}
-			default:
+				default:
 				{
 					ret =  new CErrorValue(val->GetText() + op2str(op) +
 					                       "[operator not allowed on booleans]");
@@ -145,16 +143,15 @@ this object
 			}
 			break;
 		}
-	case VALUE_STRING_TYPE:
+		case VALUE_STRING_TYPE:
 		{
-			switch(op)
-			{
-			case VALUE_ADD_OPERATOR:
+			switch (op) {
+				case VALUE_ADD_OPERATOR:
 				{
 					ret = new CStringValue(val->GetText() + GetText(),"");
 					break;
 				}
-			default:
+				default:
 				{
 					ret =  new CErrorValue(val->GetText() + op2str(op) + "[Only + allowed on boolean and string]");
 					break;
@@ -162,8 +159,8 @@ this object
 			}
 			break;
 		}
-	default:
-		ret =  new CErrorValue("[type mismatch]" + op2str(op) + GetText());
+		default:
+			ret =  new CErrorValue("[type mismatch]" + op2str(op) + GetText());
 	}
 
 	return ret;
diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp
index c9b59e5..b7d7f52 100644
--- a/source/gameengine/Expressions/FloatValue.cpp
+++ b/source/gameengine/Expressions/FloatValue.cpp
@@ -120,138 +120,134 @@ ret: a new object containing the result of applying operator op to val and
 {
 	CValue *ret;
 	
-	switch(dtype)
-	{
-	case VALUE_INT_TYPE:
+	switch (dtype) {
+		case VALUE_INT_TYPE:
 		{
-			switch (op)
-			{
-			case VALUE_MOD_OPERATOR:
-				ret = new CFloatValue(fmod(((CIntValue *) val)->GetInt(), m_float));
-				break;
-			case VALUE_ADD_OPERATOR:
-				ret = new CFloatValue(((CIntValue *) val)->GetInt() + m_float);
-				break;
-			case VALUE_SUB_OPERATOR:
-				ret = new CFloatValue(((CIntValue *) val)->GetInt() - m_float);
-				break;
-			case VALUE_MUL_OPERATOR:
-				ret = new CFloatValue(((CIntValue *) val)->GetInt() * m_float);
-				break;
-			case VALUE_DIV_OPERATOR:
-				if (m_float == 0)
-					ret = new CErrorValue("Division by zero");
-				else
-					ret = new CFloatValue (((CIntValue *) val)->GetInt() / m_float);
-				break;
-			case VALUE_EQL_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_float);
-				break;
-			case VALUE_NEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_float);
-				break;
-			case VALUE_GRE_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_float);
-				break;
-			case VALUE_LES_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_float);
-				break;
-			case VALUE_GEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_float);
-				break;
-			case VALUE_LEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float);
-				break;
-			default:
-				ret = new CErrorValue("illegal operator. please send a bug report.");
-				break;
+			switch (op) {
+				case VALUE_MOD_OPERATOR:
+					ret = new CFloatValue(fmod(((CIntValue *) val)->GetInt(), m_float));
+					break;
+				case VALUE_ADD_OPERATOR:
+					ret = new CFloatValue(((CIntValue *) val)->GetInt() + m_float);
+					break;
+				case VALUE_SUB_OPERATOR:
+					ret = new CFloatValue(((CIntValue *) val)->GetInt() - m_float);
+					break;
+				case VALUE_MUL_OPERATOR:
+					ret = new CFloatValue(((CIntValue *) val)->GetInt() * m_float);
+					break;
+				case VALUE_DIV_OPERATOR:
+					if (m_float == 0)
+						ret = new CErrorValue("Division by zero");
+					else
+						ret = new CFloatValue (((CIntValue *) val)->GetInt() / m_float);
+					break;
+				case VALUE_EQL_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_float);
+					break;
+				case VALUE_NEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_float);
+					break;
+				case VALUE_GRE_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_float);
+					break;
+				case VALUE_LES_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_float);
+					break;
+				case VALUE_GEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_float);
+					break;
+				case VALUE_LEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float);
+					break;
+				default:
+					ret = new CErrorValue("illegal operator. please send a bug report.");
+					break;
 			}
 			break;
 		}
-	case VALUE_EMPTY_TYPE:
-	case VALUE_FLOAT_TYPE:
+		case VALUE_EMPTY_TYPE:
+		case VALUE_FLOAT_TYPE:
 		{
-			switch (op)
-			{
-			case VALUE_MOD_OPERATOR:
-				ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_float));
-				break;
-			case VALUE_ADD_OPERATOR:
-				ret = new CFloatValue(((CFloatValue *) val)->GetFloat() + m_float);
-				break;
-			case VALUE_SUB_OPERATOR:
-				ret = new CFloatValue(((CFloatValue *) val)->GetFloat() - m_float);
-				break;
-			case VALUE_MUL_OPERATOR:
-				ret = new CFloatValue(((CFloatValue *) val)->GetFloat() * m_float);
-				break;
-			case VALUE_DIV_OPERATOR:
-				if (m_float == 0)
-					ret = new CErrorValue("Division by zero");
-				else
-					ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_float);
-				break;
-			case VALUE_EQL_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_float);
-				break;
-			case VALUE_NEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_float);
-				break;
-			case VALUE_GRE_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_float);
-				break;
-			case VALUE_LES_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_float);
-				break;
-			case VALUE_GEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_float);
-				break;
-			case VALUE_LEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_float);
-				break;
-			case VALUE_NEG_OPERATOR:
-				ret = new CFloatValue (-m_float);
-				break;
-			case VALUE_POS_OPERATOR:
-				ret = new CFloatValue (m_float);
-				break;
-				
-			default:
-				ret = new CErrorValue("illegal operator. please send a bug report.");
-				break;
+			switch (op) {
+				case VALUE_MOD_OPERATOR:
+					ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_float));
+					break;
+				case VALUE_ADD_OPERATOR:
+					ret = new CFloatValue(((CFloatValue *) val)->GetFloat() + m_float);
+					break;
+				case VALUE_SUB_OPERATOR:
+					ret = new CFloatValue(((CFloatValue *) val)->GetFloat() - m_float);
+					break;
+				case VALUE_MUL_OPERATOR:
+					ret = new CFloatValue(((CFloatValue *) val)->GetFloat() * m_float);
+					break;
+				case VALUE_DIV_OPERATOR:
+					if (m_float == 0)
+						ret = new CErrorValue("Division by zero");
+					else
+						ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_float);
+					break;
+				case VALUE_EQL_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_float);
+					break;
+				case VALUE_NEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_float);
+					break;
+				case VALUE_GRE_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_float);
+					break;
+				case VALUE_LES_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_float);
+					break;
+				case VALUE_GEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_float);
+					break;
+				case VALUE_LEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_float);
+					break;
+				case VALUE_NEG_OPERATOR:
+					ret = new CFloatValue (-m_float);
+					break;
+				case VALUE_POS_OPERATOR:
+					ret = new CFloatValue (m_float);
+					break;
+
+				default:
+					ret = new CErrorValue("illegal operator. please send a bug report.");
+					break;
 			}
 			break;
 		}
-	case VALUE_STRING_TYPE:
+		case VALUE_STRING_TYPE:
 		{
-			switch(op)
-			{
-			case VALUE_ADD_OPERATOR:
-				ret = new CStringValue(val->GetText() + GetText(),"");
-				break;
-			case VALUE_EQL_OPERATOR:
-			case VALUE_NEQ_OPERATOR:
-			case VALUE_GRE_OPERATOR:
-			case VALUE_LES_OPERATOR:
-			case VALUE_GEQ_OPERATOR:
-			case VALUE_LEQ_OPERATOR:
-				ret = new CErrorValue("[Cannot compare string with float]" + op2str(op) + GetText());
-				break;
-			default:
-				ret =  new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText());
-				break;
+			switch (op) {
+				case VALUE_ADD_OPERATOR:
+					ret = new CStringValue(val->GetText() + GetText(),"");
+					break;
+				case VALUE_EQL_OPERATOR:
+				case VALUE_NEQ_OPERATOR:
+				case VALUE_GRE_OPERATOR:
+				case VALUE_LES_OPERATOR:
+				case VALUE_GEQ_OPERATOR:
+				case VALUE_LEQ_OPERATOR:
+					ret = new CErrorValue("[Cannot compare string with float]" + op2str(op) + GetText());
+					break;
+				default:
+					ret =  new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText());
+					break;
 			}
 			break;
 		}
-	case VALUE_BOOL_TYPE:
-		ret =  new CErrorValue("[operator not valid on boolean and float]" + op2str(op) + GetText());
-		break;
-	case VALUE_ERROR_TYPE:
-		ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
-		break;
-	default:
-		ret = new CErrorValue("illegal type. contact your dealer (if any)");
-		break;
+		case VALUE_BOOL_TYPE:
+			ret =  new CErrorValue("[operator not valid on boolean and float]" + op2str(op) + GetText());
+			break;
+		case VALUE_ERROR_TYPE:
+			ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
+			break;
+		default:
+			ret = new CErrorValue("illegal type. contact your dealer (if any)");
+			break;
 	}
 	return ret;
 }
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp
index bdf4ee4..0a5af4a 100644
--- a/source/gameengine/Expressions/InputParser.cpp
+++ b/source/gameengine/Expressions/InputParser.cpp
@@ -187,11 +187,10 @@ void CParser::NextSym()
 	//   sets the global variable cellcoord to the kind of operator
 	
 	errmsg = NULL;
-	while(ch == ' ' || ch == 0x9)
+	while (ch == ' ' || ch == 0x9)
 		NextCh();
 
-	switch(ch)
-	{
+	switch (ch) {
 		case '(':
 			sym = lbracksym; NextCh();
 			break;
@@ -359,7 +358,7 @@ STR_String CParser::Symbol2Str(int s)
 {
 	// returns a string representation of of symbol s,
 	// for use in Term when generating an error
-	switch(s) {
+	switch (s) {
 		case errorsym: return "error";
 		case lbracksym: return "(";
 		case rbracksym: return ")";
@@ -394,7 +393,7 @@ int CParser::Priority(int optorkind)
 {
 	// returns the priority of an operator
 	// higher number means higher priority
-	switch(optorkind) {
+	switch (optorkind) {
 		case OPor: return 1;
 		case OPand: return 2;
 		case OPgreater:
@@ -426,102 +425,103 @@ CExpression *CParser::Ex(int i)
 			opkind2 = opkind;
 			NextSym();
 			e2 = Ex(i + 1);
-			switch(opkind2) {
-			case OPmodulus: e1 = new COperator2Expr(VALUE_MOD_OPERATOR,e1, e2); break;
-			case OPplus: e1 = new COperator2Expr(VALUE_ADD_OPERATOR,e1, e2); break;
-			case OPminus: e1 = new COperator2Expr(VALUE_SUB_OPERATOR,e1, e2); break;
-			case OPtimes:	e1 = new COperator2Expr(VALUE_MUL_OPERATOR,e1, e2); break;
-			case OPdivide: e1 = new COperator2Expr(VALUE_DIV_OPERATOR,e1, e2); break;
-			case OPand: e1 = new COperator2Expr(VALUE_AND_OPERATOR,e1, e2); break;
-			case OPor: e1 = new COperator2Expr(VALUE_OR_OPERATOR,e1, e2); break;
-			case OPequal: e1 = new COperator2Expr(VALUE_EQL_OPERATOR,e1, e2); break;
-			case OPunequal: e1 = new COperator2Expr(VALUE_NEQ_OPERATOR,e1, e2); break;
-			case OPgreater: e1 = new COperator2Expr(VALUE_GRE_OPERATOR,e1, e2); break;
-			case OPless: e1 = new COperator2Expr(VALUE_LES_OPERATOR,e1, e2); break;
-			case OPgreaterequal: e1 = new COperator2Expr(VALUE_GEQ_OPERATOR,e1, e2); break;
-			case OPlessequal: e1 = new COperator2Expr(VALUE_LEQ_OPERATOR,e1, e2); break;
-			default: MT_assert(false);	break; // should not happen
+			switch (opkind2) {
+				case OPmodulus: e1 = new COperator2Expr(VALUE_MOD_OPERATOR,e1, e2); break;
+				case OPplus: e1 = new COperator2Expr(VALUE_ADD_OPERATOR,e1, e2); break;
+				case OPminus: e1 = new COperator2Expr(VALUE_SUB_OPERATOR,e1, e2); break;
+				case OPtimes:	e1 = new COperator2Expr(VALUE_MUL_OPERATOR,e1, e2); break;
+				case OPdivide: e1 = new COperator2Expr(VALUE_DIV_OPERATOR,e1, e2); break;
+				case OPand: e1 = new COperator2Expr(VALUE_AND_OPERATOR,e1, e2); break;
+				case OPor: e1 = new COperator2Expr(VALUE_OR_OPERATOR,e1, e2); break;
+				case OPequal: e1 = new COperator2Expr(VALUE_EQL_OPERATOR,e1, e2); break;
+				case OPunequal: e1 = new COperator2Expr(VALUE_NEQ_OPERATOR,e1, e2); break;
+				case OPgreater: e1 = new COperator2Expr(VALUE_GRE_OPERATOR,e1, e2); break;
+				case OPless: e1 = new COperator2Expr(VALUE_LES_OPERATOR,e1, e2); break;
+				case OPgreaterequal: e1 = new COperator2Expr(VALUE_GEQ_OPERATOR,e1, e2); break;
+				case OPlessequal: e1 = new COperator2Expr(VALUE_LEQ_OPERATOR,e1, e2); break;
+				default: MT_assert(false);	break; // should not happen
 			}
 		}
 	} else if (i == NUM_PRIORITY) {
-		if ((sym == opsym) 
-			&& ( (opkind == OPminus) || (opkind == OPnot) || (opkind == OPplus) ) 
-			)
+		if ((sym == opsym)
+		    && ( (opkind == OPminus) || (opkind == OPnot) || (opkind == OPplus) )
+		    )
 		{
 			NextSym();
-			switch(opkind) {
-			/* +1 is also a valid number! */
-			case OPplus: e1 = new COperator1Expr(VALUE_POS_OPERATOR, Ex(NUM_PRIORITY)); break;
-			case OPminus: e1 = new COperator1Expr(VALUE_NEG_OPERATOR, Ex(NUM_PRIORITY)); break;
-			case OPnot: e1 = new COperator1Expr(VALUE_NOT_OPERATOR, Ex(NUM_PRIORITY)); break;
-			default: {
-						// should not happen
-						e1 = Error("operator +, - or ! expected");
-					 }
+			switch (opkind) {
+				/* +1 is also a valid number! */
+				case OPplus: e1 = new COperator1Expr(VALUE_POS_OPERATOR, Ex(NUM_PRIORITY)); break;
+				case OPminus: e1 = new COperator1Expr(VALUE_NEG_OPERATOR, Ex(NUM_PRIORITY)); break;
+				case OPnot: e1 = new COperator1Expr(VALUE_NOT_OPERATOR, Ex(NUM_PRIORITY)); break;
+				default:
+				{
+					// should not happen
+					e1 = Error("operator +, - or ! expected");
+				}
 			}
 		}
 		else {
-			switch(sym) {
-			case constsym: {
-				switch(constkind) {
-				case booltype:
-					e1 = new CConstExpr(new CBoolValue(boolvalue));
-					break;
-				case inttype:
-					{
-						cInt temp;
-						temp = strtoll(const_as_string, NULL, 10); /* atoi is for int only */
-						e1 = new CConstExpr(new CIntValue(temp));
-						break;
-					}
-				case floattype:
-					{
-						double temp;
-						temp = atof(const_as_string);
-						e1 = new CConstExpr(new CFloatValue(temp));
-						break;
+			switch (sym) {
+				case constsym: {
+					switch (constkind) {
+						case booltype:
+							e1 = new CConstExpr(new CBoolValue(boolvalue));
+							break;
+						case inttype:
+						{
+							cInt temp;
+							temp = strtoll(const_as_string, NULL, 10); /* atoi is for int only */
+							e1 = new CConstExpr(new CIntValue(temp));
+							break;
+						}
+						case floattype:
+						{
+							double temp;
+							temp = atof(const_as_string);
+							e1 = new CConstExpr(new CFloatValue(temp));
+							break;
+						}
+						case stringtype:
+							e1 = new CConstExpr(new CStringValue(const_as_string,""));
+							break;
+						default :
+							MT_assert(false);
+							break;
 					}
-				case stringtype:
-					e1 = new CConstExpr(new CStringValue(const_as_string,""));
-					break;
-				default :
-					MT_assert(false);
+					NextSym();
 					break;
 				}
-				NextSym();
-				break;
-						   }
-			case lbracksym:
-				NextSym();
-				e1 = Ex(1);
-				Term(rbracksym);
-				break;
-			case ifsym:
-			{
-				CExpression *e3;
-				NextSym();
-				Term(lbracksym);
-				e1 = Ex(1);
-				Term(commasym);
-				e2 = Ex(1);
-				if (sym == commasym) {
+				case lbracksym:
 					NextSym();
-					e3 = Ex(1);
-				} else {
-					e3 = new CConstExpr(new CEmptyValue());
+					e1 = Ex(1);
+					Term(rbracksym);
+					break;
+				case ifsym:
+				{
+					CExpression *e3;
+					NextSym();
+					Term(lbracksym);
+					e1 = Ex(1);
+					Term(commasym);
+					e2 = Ex(1);
+					if (sym == commasym) {
+						NextSym();
+						e3 = Ex(1);
+					} else {
+						e3 = new CConstExpr(new CEmptyValue());
+					}
+					Term(rbracksym);
+					e1 = new CIfExpr(e1, e2, e3);
+					break;
 				}
-				Term(rbracksym);
-				e1 = new CIfExpr(e1, e2, e3);
-				break;
-			}
-			case idsym:
+				case idsym:
 				{
 					e1 = new CIdentifierExpr(const_as_string,m_identifierContext);
 					NextSym();
 					
 					break;
 				}
-			case errorsym:
+				case errorsym:
 				{
 					MT_assert(!e1);
 					STR_String errtext="[no info]";
@@ -530,7 +530,7 @@ CExpression *CParser::Ex(int i)
 						CValue* errmsgval = errmsg->Calculate();
 						errtext=errmsgval->GetText();
 						errmsgval->Release();
-					
+
 						//e1 = Error(errmsg->Calculate()->GetText());//new CConstExpr(errmsg->Calculate());
 						
 						if ( !(errmsg->Release()) )
@@ -545,11 +545,11 @@ CExpression *CParser::Ex(int i)
 
 					break;
 				}
-			default:
-				NextSym();
-				//return Error("Expression expected");
-				MT_assert(!e1);
-				e1 = Error("Expression expected");
+				default:
+					NextSym();
+					//return Error("Expression expected");
+					MT_assert(!e1);
+					e1 = Error("Expression expected");
 			}
 		}
 	}
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 12d6e25..2cacea9 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -108,165 +108,160 @@ object and val
 	}
 }
 
-
-
-CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
 /*
-pre: the type of val is dtype
-ret: a new object containing the result of applying operator op to val and
-this object
-*/
+ * pre: the type of val is dtype
+ * ret: a new object containing the result of applying operator op to val and
+ * this object
+ */
+CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
 {
 	CValue *ret;
 	
-	switch(dtype) {
-	case VALUE_EMPTY_TYPE:
-	case VALUE_INT_TYPE:
+	switch (dtype) {
+		case VALUE_EMPTY_TYPE:
+		case VALUE_INT_TYPE:
 		{
 			switch (op) {
-			case VALUE_MOD_OPERATOR:
-				ret = new CIntValue (((CIntValue *) val)->GetInt() % m_int);
-				break;
-			case VALUE_ADD_OPERATOR:
-				ret = new CIntValue (((CIntValue *) val)->GetInt() + m_int);
-				break;
-			case VALUE_SUB_OPERATOR:
-				ret = new CIntValue (((CIntValue *) val)->GetInt() - m_int);
-				break;
-			case VALUE_MUL_OPERATOR:
-				ret = new CIntValue (((CIntValue *) val)->GetInt() * m_int);
-				break;
-			case VALUE_DIV_OPERATOR:
-				if (m_int == 0)
-				{
-					if (val->GetNumber() == 0)
-					{
-						ret = new CErrorValue("Not a Number");
-					} else
-					{
-						ret = new CErrorValue("Division by zero");
+				case VALUE_MOD_OPERATOR:
+					ret = new CIntValue (((CIntValue *) val)->GetInt() % m_int);
+					break;
+				case VALUE_ADD_OPERATOR:
+					ret = new CIntValue (((CIntValue *) val)->GetInt() + m_int);
+					break;
+				case VALUE_SUB_OPERATOR:
+					ret = new CIntValue (((CIntValue *) val)->GetInt() - m_int);
+					break;
+				case VALUE_MUL_OPERATOR:
+					ret = new CIntValue (((CIntValue *) val)->GetInt() * m_int);
+					break;
+				case VALUE_DIV_OPERATOR:
+					if (m_int == 0) {
+						if (val->GetNumber() == 0) {
+							ret = new CErrorValue("Not a Number");
+						}
+						else {
+							ret = new CErrorValue("Division by zero");
+						}
 					}
-				}
-				else
-					ret = new CIntValue (((CIntValue *) val)->GetInt() / m_int);
-				break;
-			case VALUE_EQL_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_int);
-				break;
-			case VALUE_NEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_int);
-				break;
-			case VALUE_GRE_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_int);
-				break;
-			case VALUE_LES_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_int);
-				break;
-			case VALUE_GEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_int);
-				break;
-			case VALUE_LEQ_OPERATOR:
-				ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_int);
-				break;
-			case VALUE_NEG_OPERATOR:
-				ret = new CIntValue (-m_int);
-				break;
-			case VALUE_POS_OPERATOR:
-				ret = new CIntValue (m_int);
-				break;
-			default:
-				ret = new CErrorValue("illegal operator. please send a bug report.");
-				break;
+					else
+						ret = new CIntValue (((CIntValue *) val)->GetInt() / m_int);
+					break;
+				case VALUE_EQL_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_int);
+					break;
+				case VALUE_NEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_int);
+					break;
+				case VALUE_GRE_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_int);
+					break;
+				case VALUE_LES_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_int);
+					break;
+				case VALUE_GEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_int);
+					break;
+				case VALUE_LEQ_OPERATOR:
+					ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_int);
+					break;
+				case VALUE_NEG_OPERATOR:
+					ret = new CIntValue (-m_int);
+					break;
+				case VALUE_POS_OPERATOR:
+					ret = new CIntValue (m_int);
+					break;
+				default:
+					ret = new CErrorValue("illegal operator. please send a bug report.");
+					break;
 			}
 			break;
 		}
-	case VALUE_FLOAT_TYPE:
+		case VALUE_FLOAT_TYPE:
 		{
 			switch (op) {
-			case VALUE_MOD_OPERATOR:
-				ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_int));
-				break;
-			case VALUE_ADD_OPERATOR:
-				ret = new CFloatValue (((CFloatValue *) val)->GetFloat() + m_int);
-				break;
-			case VALUE_SUB_OPERATOR:
-				ret = new CFloatValue (((CFloatValue *) val)->GetFloat() - m_int);
-				break;
-			case VALUE_MUL_OPERATOR:
-				ret = new CFloatValue (((CFloatValue *) val)->GetFloat() * m_int);
-				break;
-			case VALUE_DIV_OPERATOR:
-				if (m_int == 0)
-					ret = new CErrorValue("Division by zero");
-				else
-					ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_int);
-				break;
-			case VALUE_EQL_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_int);
-				break;
-			case VALUE_NEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_int);
-				break;
-			case VALUE_GRE_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_int);
-				break;
-			case VALUE_LES_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_int);
-				break;
-			case VALUE_GEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_int);
-				break;
-			case VALUE_LEQ_OPERATOR:
-				ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int);
-				break;
-			default:
-				ret = new CErrorValue("illegal operator. please send a bug report.");
-				break;
+				case VALUE_MOD_OPERATOR:
+					ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_int));
+					break;
+				case VALUE_ADD_OPERATOR:
+					ret = new CFloatValue (((CFloatValue *) val)->GetFloat() + m_int);
+					break;
+				case VALUE_SUB_OPERATOR:
+					ret = new CFloatValue (((CFloatValue *) val)->GetFloat() - m_int);
+					break;
+				case VALUE_MUL_OPERATOR:
+					ret = new CFloatValue (((CFloatValue *) val)->GetFloat() * m_int);
+					break;
+				case VALUE_DIV_OPERATOR:
+					if (m_int == 0)
+						ret = new CErrorValue("Division by zero");
+					else
+						ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_int);
+					break;
+				case VALUE_EQL_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_int);
+					break;
+				case VALUE_NEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_int);
+					break;
+				case VALUE_GRE_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_int);
+					break;
+				case VALUE_LES_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_int);
+					break;
+				case VALUE_GEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_int);
+					break;
+				case VALUE_LEQ_OPERATOR:
+					ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int);
+					break;
+				default:
+					ret = new CErrorValue("illegal operator. please send a bug report.");
+					break;
 			}
 			break;
 		}
-	case VALUE_STRING_TYPE:
+		case VALUE_STRING_TYPE:
 		{
-			switch(op) {
-			case VALUE_ADD_OPERATOR:
-				ret = new CStringValue(val->GetText() + GetText(),"");
-				break;
-			case VALUE_EQL_OPERATOR:
-			case VALUE_NEQ_OPERATOR:
-			case VALUE_GRE_OPERATOR:
-			case VALUE_LES_OPERATOR:
-			case VALUE_GEQ_OPERATOR:
-			case VALUE_LEQ_OPERATOR:
-				ret = new CErrorValue("[Cannot compare string with integer]" + op2str(op) + GetText());
-				break;
-			default:
-				ret =  new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText());
-				break;
+			switch (op) {
+				case VALUE_ADD_OPERATOR:
+					ret = new CStringValue(val->GetText() + GetText(),"");
+					break;
+				case VALUE_EQL_OPERATOR:
+				case VALUE_NEQ_OPERATOR:
+				case VALUE_GRE_OPERATOR:
+				case VALUE_LES_OPERATOR:
+				case VALUE_GEQ_OPERATOR:
+				case VALUE_LEQ_OPERATOR:
+					ret = new CErrorValue("[Cannot compare string with integer]" + op2str(op) + GetText());
+					break;
+				default:
+					ret =  new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText());
+					break;
 			}
 			break;
 		}
-	case VALUE_BOOL_TYPE:
-		ret =  new CErrorValue("[operator not valid on boolean and integer]" + op2str(op) + GetText());
-		break;
-		/*
+		case VALUE_BOOL_TYPE:
+			ret =  new CErrorValue("[operator not valid on boolean and integer]" + op2str(op) + GetText());
+			break;
+#if 0
 		case VALUE_EMPTY_TYPE:
 		{
-		switch(op) {
-		
-		  case VALUE_ADD_OPERATOR:
-		  ret = new CIntValue (m_int);
-		  break;
-		  case VALUE_SUB_OPERATOR:
-		  ret = new CIntValue (-m_int);
-		  break;
-		  default:
-		  {
-		  ret = new CErrorValue(op2str(op) +	GetText());
-		  }
-		  }
-		  break;
-		  }
-		*/
+			switch (op) {
+				case VALUE_ADD_OPERATOR:
+					ret = new CIntValue (m_int);
+					break;
+				case VALUE_SUB_OPERATOR:
+					ret = new CIntValue (-m_int);
+					break;
+				default:
+				{
+					ret = new CErrorValue(op2str(op) +	GetText());
+				}
+			}
+			break;
+		}
+#endif
 	case VALUE_ERROR_TYPE:
 		ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
 		break;
@@ -291,7 +286,7 @@ cInt CIntValue::GetInt()
 
 double CIntValue::GetNumber()
 {
-	return (float) m_int;
+	return (double) m_int;
 }
 
 
@@ -328,9 +323,6 @@ void CIntValue::SetValue(CValue* newval)
 #ifdef WITH_PYTHON
 PyObject *CIntValue::ConvertValueToPython()
 {
-	if ((m_int > INT_MIN) && (m_int < INT_MAX))
-		return PyLong_FromSsize_t(m_int);
-	else
-		return PyLong_FromLongLong(m_int);
+	return PyLong_FromLongLong(m_int);
 }
 #endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 43f84d2..5f97b03 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -365,7 +365,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key)
 		}
 	}
 	else if (PyIndex_Check(key)) {
-		int index = PyLong_AsSsize_t(key);
+		Py_ssize_t index = PyLong_AsSsize_t(key);
 		return listvalue_buffer_item(self, index); /* wont add a ref */
 	}
 	else if (PySlice_Check(key)) {
@@ -468,9 +468,9 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
 
 static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
 {
-	CListValue *self= static_cast<CListValue *>(BGE_PROXY_REF(self_v));
+	CListValue *self = static_cast<CListValue *>(BGE_PROXY_REF(self_v));
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "val in CList, "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -602,10 +602,10 @@ PyObject *CListValue::Pyindex(PyObject *value)
 	int numelem = GetCount();
 	for (int i=0;i<numelem;i++)
 	{
-		CValue* elem = 			GetValue(i);
+		CValue* elem = GetValue(i);
 		if (checkobj==elem || CheckEqual(checkobj,elem))
 		{
-			result = PyLong_FromSsize_t(i);
+			result = PyLong_FromLong(i);
 			break;
 		}
 	}
@@ -628,7 +628,7 @@ PyObject *CListValue::Pycount(PyObject *value)
 
 	if (checkobj==NULL) { /* in this case just return that there are no items in the list */
 		PyErr_Clear();
-		return PyLong_FromSsize_t(0);
+		return PyLong_FromLong(0);
 	}
 
 	int numelem = GetCount();
@@ -642,7 +642,7 @@ PyObject *CListValue::Pycount(PyObject *value)
 	}
 	checkobj->Release();
 
-	return PyLong_FromSsize_t(numfound);
+	return PyLong_FromLong(numfound);
 }
 
 /* Matches python dict.get(key, [default]) */
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 6bb2f03..11b00b7 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -170,7 +170,7 @@ PyObject *PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObject
 	 *
 	 * */
 	base_type= Py_TYPE(base);
-	while(base_type && !BGE_PROXY_CHECK_TYPE(base_type))
+	while (base_type && !BGE_PROXY_CHECK_TYPE(base_type))
 		base_type= base_type->tp_base;
 
 	if (base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) {
@@ -259,7 +259,7 @@ void PyObjectPlus::py_base_dealloc(PyObject *self)				// python wrapper
  * PyObjectPlus Methods 	-- Every class, even the abstract one should have a Methods
 ------------------------------*/
 PyMethodDef PyObjectPlus::Methods[] = {
-  {NULL, NULL}		/* Sentinel */
+	{NULL, NULL}		/* Sentinel */
 };
 
 #define BGE_PY_ATTR_INVALID (&(PyObjectPlus::Attributes[0]))
@@ -311,14 +311,14 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 				{
 					bool *val = reinterpret_cast<bool*>(ptr);
 					ptr += sizeof(bool);
-					PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+					PyList_SET_ITEM(resultlist,i,PyBool_FromLong(*val));
 					break;
 				}
 			case KX_PYATTRIBUTE_TYPE_SHORT:
 				{
 					short int *val = reinterpret_cast<short int*>(ptr);
 					ptr += sizeof(short int);
-					PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+					PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
 					break;
 				}
 			case KX_PYATTRIBUTE_TYPE_ENUM:
@@ -333,7 +333,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 				{
 					int *val = reinterpret_cast<int*>(ptr);
 					ptr += sizeof(int);
-					PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+					PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
 					break;
 				}
 			case KX_PYATTRIBUTE_TYPE_FLOAT:
@@ -381,17 +381,17 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 				}
 				if (attrdef->m_imax)
 					bval = !bval;
-				return PyLong_FromSsize_t(bval);
+				return PyBool_FromLong(bval);
 			}
 		case KX_PYATTRIBUTE_TYPE_BOOL:
 			{
 				bool *val = reinterpret_cast<bool*>(ptr);
-				return PyLong_FromSsize_t(*val);
+				return PyBool_FromLong(*val);
 			}
 		case KX_PYATTRIBUTE_TYPE_SHORT:
 			{
 				short int *val = reinterpret_cast<short int*>(ptr);
-				return PyLong_FromSsize_t(*val);
+				return PyLong_FromLong(*val);
 			}
 		case KX_PYATTRIBUTE_TYPE_ENUM:
 			// enum are like int, just make sure the field size is the same
@@ -403,7 +403,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 		case KX_PYATTRIBUTE_TYPE_INT:
 			{
 				int *val = reinterpret_cast<int*>(ptr);
-				return PyLong_FromSsize_t(*val);
+				return PyLong_FromLong(*val);
 			}
 		case KX_PYATTRIBUTE_TYPE_FLOAT:
 			{
@@ -486,8 +486,8 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 
 static bool py_check_attr_float(float *var, PyObject *value, const PyAttributeDef *attrdef)
 {
-	double val = PyFloat_AsDouble(value);
-	if (val == -1.0 && PyErr_Occurred())
+	float val = PyFloat_AsDouble(value);
+	if (val == -1.0f && PyErr_Occurred())
 	{
 		PyErr_Format(PyExc_TypeError, "expected float value for attribute \"%s\"", attrdef->m_name);
 		return false;
@@ -583,7 +583,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 					ptr += sizeof(bool);
 					if (PyLong_Check(item)) 
 					{
-						*var = (PyLong_AsSsize_t(item) != 0);
+						*var = (PyLong_AsLong(item) != 0);
 					} 
 					else if (PyBool_Check(item))
 					{
@@ -602,7 +602,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 					ptr += sizeof(short int);
 					if (PyLong_Check(item)) 
 					{
-						long val = PyLong_AsSsize_t(item);
+						int val = PyLong_AsLong(item);
 						if (attrdef->m_clamp)
 						{
 							if (val < attrdef->m_imin)
@@ -638,7 +638,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 					ptr += sizeof(int);
 					if (PyLong_Check(item)) 
 					{
-						long val = PyLong_AsSsize_t(item);
+						int val = PyLong_AsLong(item);
 						if (attrdef->m_clamp)
 						{
 							if (val < attrdef->m_imin)
@@ -664,13 +664,13 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				{
 					float *var = reinterpret_cast<float*>(ptr);
 					ptr += sizeof(float);
-					double val = PyFloat_AsDouble(item);
-					if (val == -1.0 && PyErr_Occurred())
+					float val = PyFloat_AsDouble(item);
+					if (val == -1.0f && PyErr_Occurred())
 					{
 						PyErr_Format(PyExc_TypeError, "expected a float for attribute \"%s\"", attrdef->m_name);
 						goto UNDO_AND_ERROR;
 					}
-					else if (attrdef->m_clamp) 
+					else if (attrdef->m_clamp)
 					{
 						if (val < attrdef->m_fmin)
 							val = attrdef->m_fmin;
@@ -786,7 +786,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				bool *var = reinterpret_cast<bool*>(ptr);
 				if (PyLong_Check(value)) 
 				{
-					*var = (PyLong_AsSsize_t(value) != 0);
+					*var = (PyLong_AsLong(value) != 0);
 				} 
 				else if (PyBool_Check(value))
 				{
@@ -804,7 +804,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				bool bval;
 				if (PyLong_Check(value)) 
 				{
-					bval = (PyLong_AsSsize_t(value) != 0);
+					bval = (PyLong_AsLong(value) != 0);
 				} 
 				else if (PyBool_Check(value))
 				{
@@ -847,7 +847,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				short int *var = reinterpret_cast<short int*>(ptr);
 				if (PyLong_Check(value)) 
 				{
-					long val = PyLong_AsSsize_t(value);
+					int val = PyLong_AsLong(value);
 					if (attrdef->m_clamp)
 					{
 						if (val < attrdef->m_imin)
@@ -882,7 +882,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				int *var = reinterpret_cast<int*>(ptr);
 				if (PyLong_Check(value)) 
 				{
-					long val = PyLong_AsSsize_t(value);
+					int val = PyLong_AsLong(value);
 					if (attrdef->m_clamp)
 					{
 						if (val < attrdef->m_imin)
@@ -985,10 +985,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 				for (int i=0; i<3; i++)
 				{
 					item = PySequence_GetItem(value, i); /* new ref */
-					double val = PyFloat_AsDouble(item);
+					float val = PyFloat_AsDouble(item);
 					Py_DECREF(item);
 					item = NULL;
-					if (val == -1.0 && PyErr_Occurred())
+					if (val == -1.0f && PyErr_Occurred())
 					{
 						PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name);
 						goto RESTORE_AND_ERROR;
@@ -1198,8 +1198,7 @@ void PyObjectPlus::ClearDeprecationWarning()
 	WarnLink *wlink_next;
 	WarnLink *wlink = GetDeprecationWarningLinkFirst();
 	
-	while(wlink)
-	{
+	while (wlink) {
 		wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */
 		wlink_next= reinterpret_cast<WarnLink *>(wlink->link);
 		wlink->link= NULL;
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 83b7c8c..37e26e8 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -526,7 +526,7 @@ typedef struct KX_PYATTRIBUTE_DEF {
 
 /*------------------------------
  * PyObjectPlus
-------------------------------*/
+ *------------------------------ */
 typedef PyTypeObject *PyParentObject;  /* Define the PyParent Object */
 
 #else // WITH_PYTHON
diff --git a/source/gameengine/Expressions/StringValue.cpp b/source/gameengine/Expressions/StringValue.cpp
index 2e29a39..166125b 100644
--- a/source/gameengine/Expressions/StringValue.cpp
+++ b/source/gameengine/Expressions/StringValue.cpp
@@ -77,33 +77,34 @@ CValue* CStringValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
 			ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
 		else
 			ret = new CStringValue(val->GetText() + GetText(),"");
-	} else {
-		
+	}
+	else {
 		if (dtype == VALUE_STRING_TYPE || dtype == VALUE_EMPTY_TYPE) {
-			switch(op) {
-			case VALUE_EQL_OPERATOR:
-				ret = new CBoolValue(val->GetText() == GetText());
-				break;
-			case VALUE_NEQ_OPERATOR:
-				ret = new CBoolValue(val->GetText() != GetText());
-				break;
-			case VALUE_GRE_OPERATOR:
-				ret = new CBoolValue(val->GetText() > GetText());
-				break;
-			case VALUE_LES_OPERATOR:
-				ret = new CBoolValue(val->GetText() < GetText());
-				break;
-			case VALUE_GEQ_OPERATOR:
-				ret = new CBoolValue(val->GetText() >= GetText());
-				break;
-			case VALUE_LEQ_OPERATOR:
-				ret = new CBoolValue(val->GetText() <= GetText());
-				break;
-			default:
-				ret =  new CErrorValue(val->GetText() + op2str(op) + "[operator not allowed on strings]");
-				break;
+			switch (op) {
+				case VALUE_EQL_OPERATOR:
+					ret = new CBoolValue(val->GetText() == GetText());
+					break;
+				case VALUE_NEQ_OPERATOR:
+					ret = new CBoolValue(val->GetText() != GetText());
+					break;
+				case VALUE_GRE_OPERATOR:
+					ret = new CBoolValue(val->GetText() > GetText());
+					break;
+				case VALUE_LES_OPERATOR:
+					ret = new CBoolValue(val->GetText() < GetText());
+					break;
+				case VALUE_GEQ_OPERATOR:
+					ret = new CBoolValue(val->GetText() >= GetText());
+					break;
+				case VALUE_LEQ_OPERATOR:
+					ret = new CBoolValue(val->GetText() <= GetText());
+					break;
+				default:
+					ret =  new CErrorValue(val->GetText() + op2str(op) + "[operator not allowed on strings]");
+					break;
 			}
-		} else {
+		}
+		else {
 			ret =  new CErrorValue(val->GetText() + op2str(op) + "[operator not allowed on strings]");
 		}
 	}
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index 92b5e20..c4af325 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -19,9 +19,9 @@
 #ifndef __VALUE_H__
 #define __VALUE_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include <map>		// array functionality for the propertylist
 #include "STR_String.h"	// STR_String class
diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp
index 65f5d7d..612de65 100644
--- a/source/gameengine/Expressions/VectorValue.cpp
+++ b/source/gameengine/Expressions/VectorValue.cpp
@@ -15,8 +15,8 @@
  *
  */
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include "Value.h"
@@ -96,61 +96,60 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
 {
 	CValue *ret = NULL;
 	
-	switch(op)
-	{ 
-	case VALUE_ADD_OPERATOR: 
+	switch (op) {
+		case VALUE_ADD_OPERATOR:
 		{
 			switch (dtype)
 			{
-			case VALUE_EMPTY_TYPE:
-			case VALUE_VECTOR_TYPE: 
+				case VALUE_EMPTY_TYPE:
+				case VALUE_VECTOR_TYPE:
 				{
 					ret = new CVectorValue(
-						val->GetVector3()[KX_X] + GetVector3()[KX_X],
-						val->GetVector3()[KX_Y] + GetVector3()[KX_Y],
-						val->GetVector3()[KX_Z] + GetVector3()[KX_Z],
-						CValue::HEAPVALUE);
+					            val->GetVector3()[KX_X] + GetVector3()[KX_X],
+					            val->GetVector3()[KX_Y] + GetVector3()[KX_Y],
+					            val->GetVector3()[KX_Z] + GetVector3()[KX_Z],
+					            CValue::HEAPVALUE);
 					ret->SetName(GetName());
 					break;
 				}
-			
-			default: 
-				ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
+
+				default:
+					ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
 			}
 			break;
 		}
-	case VALUE_MUL_OPERATOR:
+		case VALUE_MUL_OPERATOR:
 		{
 			switch (dtype)
 			{
 				
-			case VALUE_EMPTY_TYPE:
-			case VALUE_VECTOR_TYPE: 
+				case VALUE_EMPTY_TYPE:
+				case VALUE_VECTOR_TYPE:
 				{
 					//MT_Vector3 supports 'scaling' by another vector, instead of using general transform, Gino?
 					//ret = new CVectorValue(val->GetVector3().Scaled(GetVector3()),GetName());
 					break;
 				}
-			case VALUE_FLOAT_TYPE: 
+				case VALUE_FLOAT_TYPE:
 				{
 					ret = new CVectorValue(
-						val->GetVector3()[KX_X] * GetVector3()[KX_X],
-						val->GetVector3()[KX_Y] * GetVector3()[KX_Y],
-						val->GetVector3()[KX_Z] * GetVector3()[KX_Z],
-						CValue::HEAPVALUE);
+					            val->GetVector3()[KX_X] * GetVector3()[KX_X],
+					            val->GetVector3()[KX_Y] * GetVector3()[KX_Y],
+					            val->GetVector3()[KX_Z] * GetVector3()[KX_Z],
+					            CValue::HEAPVALUE);
 					ret->SetName(GetName());
 					break;
 				}
-			
-			default: 
-				ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
+
+				default:
+					ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
 			}
 			break;
 
 		}
-	
-	default:
-		ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
+
+		default:
+			ret = new CErrorValue(val->GetText() + op2str(op) +	GetText());
 	}
 
 	
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 48fa325..8b343be 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -51,11 +51,11 @@ SCA_Joystick::SCA_Joystick(short int index)
 	m_istrig_button(0),
 	m_istrig_hat(0)
 {
-	for (int i=0; i<JOYAXIS_MAX; i++)
-		m_axis_array[i]= 0;
+	for (int i=0; i < JOYAXIS_MAX; i++)
+		m_axis_array[i] = 0;
 	
-	for (int i=0; i<JOYHAT_MAX; i++)
-		m_hat_array[i]= 0;
+	for (int i=0; i < JOYHAT_MAX; i++)
+		m_hat_array[i] = 0;
 	
 #ifdef WITH_SDL
 	m_private = new PrivateData();
@@ -88,9 +88,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
 	if (m_refCount == 0) 
 	{
 		int i;
-		// The video subsystem is required for joystick input to work. However,
-		// when GHOST is running under SDL, video is initialized elsewhere.
-		// Do this once only.
+		/* The video subsystem is required for joystick input to work. However,
+		 * when GHOST is running under SDL, video is initialized elsewhere.
+		 * Do this once only. */
 #  ifdef WITH_GHOST_SDL
 		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ) {
 #  else
@@ -127,12 +127,12 @@ void SCA_Joystick::ReleaseInstance()
 				m_instance[i]->DestroyJoystickDevice();
 				delete m_instance[i];
 			}
-			m_instance[i]= NULL;
+			m_instance[i] = NULL;
 		}
 
-		// The video subsystem is required for joystick input to work. However,
-		// when GHOST is running under SDL, video is freed elsewhere.
-		// Do this once only.
+		/* The video subsystem is required for joystick input to work. However,
+		 * when GHOST is running under SDL, video is freed elsewhere.
+		 * Do this once only. */
 #  ifdef WITH_GHOST_SDL
 		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
 #  else
@@ -241,10 +241,10 @@ bool SCA_Joystick::CreateJoystickDevice(void)
 #else /* WITH_SDL */
 	if (m_isinit == false) {
 		if (m_joyindex>=m_joynum) {
-			// don't print a message, because this is done anyway
+			/* don't print a message, because this is done anyway */
 			//ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)");
 			
-			// Need this so python args can return empty lists
+			/* Need this so python args can return empty lists */
 			m_axismax = m_buttonmax = m_hatmax = 0;
 			return false;
 		}
@@ -256,17 +256,17 @@ bool SCA_Joystick::CreateJoystickDevice(void)
 		ECHO("Joystick " << m_joyindex << " initialized");
 		
 		/* must run after being initialized */
-		m_axismax =		SDL_JoystickNumAxes(m_private->m_joystick);
-		m_buttonmax =	SDL_JoystickNumButtons(m_private->m_joystick);
-		m_hatmax =		SDL_JoystickNumHats(m_private->m_joystick);
-		
-		if (m_axismax > JOYAXIS_MAX) m_axismax= JOYAXIS_MAX;		/* very unlikely */
-		else if (m_axismax < 0) m_axismax = 0;
+		m_axismax     = SDL_JoystickNumAxes(m_private->m_joystick);
+		m_buttonmax   = SDL_JoystickNumButtons(m_private->m_joystick);
+		m_hatmax      = SDL_JoystickNumHats(m_private->m_joystick);
+
+		if      (m_axismax > JOYAXIS_MAX) m_axismax = JOYAXIS_MAX;  /* very unlikely */
+		else if (m_axismax < 0)           m_axismax = 0;
 		
-		if (m_hatmax > JOYHAT_MAX) m_hatmax= JOYHAT_MAX;			/* very unlikely */
-		else if (m_hatmax<0) m_hatmax= 0;
+		if      (m_hatmax > JOYHAT_MAX) m_hatmax = JOYHAT_MAX;  /* very unlikely */
+		else if (m_hatmax < 0)          m_hatmax = 0;
 		
-		if (m_buttonmax<0) m_buttonmax= 0;
+		if (m_buttonmax < 0) m_buttonmax = 0;
 		
 	}
 	return true;
@@ -307,16 +307,16 @@ int SCA_Joystick::pGetAxis(int axisnum, int udlr)
 int SCA_Joystick::pAxisTest(int axisnum)
 {
 #ifdef WITH_SDL
-	short i1= m_axis_array[(axisnum*2)];
-	short i2= m_axis_array[(axisnum*2)+1];
+	short i1 = m_axis_array[(axisnum * 2)];
+	short i2 = m_axis_array[(axisnum * 2) + 1];
 	
-	/* long winded way to do
-	 *   return maxf(absf(i1), absf(i2))
-	 * avoid abs from math.h */
+	/* long winded way to do:
+	 * return max_ff(absf(i1), absf(i2))
+	 * ...avoid abs from math.h */
 	if (i1 < 0) i1 = -i1;
 	if (i2 < 0) i2 = -i2;
 	if (i1 <i2) return i2;
-	else		return i1;
+	else        return i1;
 #else /* WITH_SDL */
 	return 0;
 #endif /* WITH_SDL */
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index efe76c3..f50137c 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -43,7 +43,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
 	if (sdl_event->jaxis.axis >= JOYAXIS_MAX)
 		return;
 	
-	m_axis_array[sdl_event->jaxis.axis]= sdl_event->jaxis.value;
+	m_axis_array[sdl_event->jaxis.axis] = sdl_event->jaxis.value;
 	m_istrig_axis = 1;
 }
 
@@ -53,7 +53,7 @@ void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event)
 	if (sdl_event->jhat.hat >= JOYHAT_MAX)
 		return;
 
-	m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value;
+	m_hat_array[sdl_event->jhat.hat] = sdl_event->jhat.value;
 	m_istrig_hat = 1;
 }
 
@@ -89,8 +89,7 @@ void SCA_Joystick::HandleEvents(void)
 			SCA_Joystick::m_instance[i]->OnNothing(&sdl_event);
 	}
 	
-	while(SDL_PollEvent(&sdl_event))
-	{
+	while (SDL_PollEvent(&sdl_event)) {
 		/* Note! m_instance[sdl_event.jaxis.which]
 		 * will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */
 		
@@ -100,28 +99,27 @@ void SCA_Joystick::HandleEvents(void)
 		/* Note!, if you manage to press and release a button within 1 logic tick
 		 * it wont work as it should */
 		
-		switch(sdl_event.type)
-		{
-		case SDL_JOYAXISMOTION:
-			SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event);
-			break;
-		case SDL_JOYHATMOTION:
-			SCA_Joystick::m_instance[sdl_event.jhat.which]->OnHatMotion(&sdl_event);
-			break;
-		case SDL_JOYBUTTONUP:
-			SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonUp(&sdl_event);
-			break;
-		case SDL_JOYBUTTONDOWN:
-			SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonDown(&sdl_event);
-			break;
+		switch (sdl_event.type) {
+			case SDL_JOYAXISMOTION:
+				SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event);
+				break;
+			case SDL_JOYHATMOTION:
+				SCA_Joystick::m_instance[sdl_event.jhat.which]->OnHatMotion(&sdl_event);
+				break;
+			case SDL_JOYBUTTONUP:
+				SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonUp(&sdl_event);
+				break;
+			case SDL_JOYBUTTONDOWN:
+				SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonDown(&sdl_event);
+				break;
 #if 0	/* Not used yet */
-		case SDL_JOYBALLMOTION:
-			SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event);
-			break;
+			case SDL_JOYBALLMOTION:
+				SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event);
+				break;
 #endif
-		default:
-			printf("SCA_Joystick::HandleEvents, Unknown SDL event, this should not happen\n");
-			break;
+			default:
+				printf("SCA_Joystick::HandleEvents, Unknown SDL event, this should not happen\n");
+				break;
 		}
 	}
 }
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
index 6b697f4..1a6a82a 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
@@ -32,11 +32,10 @@
  *  \ingroup gamelogic
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+  /* This warning tells us about truncation of __long__ stl-generated names.
+   * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning( disable:4786 )
 #endif
 
 #include "SCA_AlwaysSensor.h"
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
index f2bcd67..af751cf 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
@@ -32,11 +32,10 @@
  *  \ingroup gamelogic
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+  /* This warning tells us about truncation of __long__ stl-generated names.
+   * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning( disable:4786 )
 #endif
 
 #include <stddef.h>
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index 6d76f12..f922e61 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -240,8 +240,8 @@ PyAttributeDef SCA_IController::Attributes[] = {
 
 PyObject *SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_IController* self= static_cast<SCA_IController*>(self_v);
-	return PyLong_FromSsize_t(self->m_statemask);
+	SCA_IController* self = static_cast<SCA_IController*>(self_v);
+	return PyLong_FromLong(self->m_statemask);
 }
 
 PyObject *SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index bc4d22e..1a403f4 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -167,9 +167,9 @@ public:
 		KX_CAPSLOCKKEY, // 123
 		
 		KX_LEFTCTRLKEY,	// 124
-		KX_LEFTALTKEY, 		
-		KX_RIGHTALTKEY, 	
-		KX_RIGHTCTRLKEY, 	
+		KX_LEFTALTKEY,
+		KX_RIGHTALTKEY,
+		KX_RIGHTCTRLKEY,
 		KX_RIGHTSHIFTKEY,
 		KX_LEFTSHIFTKEY,// 129
 		
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index cfbdc1e..34fa1c9 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -202,7 +202,7 @@ PyTypeObject SCA_ILogicBrick::Type = {
 };
 
 PyMethodDef SCA_ILogicBrick::Methods[] = {
-  {NULL,NULL} //Sentinel
+	{NULL,NULL} //Sentinel
 };
 
 PyAttributeDef SCA_ILogicBrick::Attributes[] = {
@@ -233,7 +233,7 @@ int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef)
 /*Attribute functions */
 PyObject *SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ILogicBrick* self= static_cast<SCA_ILogicBrick*>(self_v);
+	SCA_ILogicBrick* self = static_cast<SCA_ILogicBrick*>(self_v);
 	CValue* parent = self->GetParent();
 	
 	if (parent)
@@ -256,7 +256,7 @@ bool SCA_ILogicBrick::PyArgToBool(int boolArg)
 
 PyObject *SCA_ILogicBrick::BoolToPyArg(bool boolarg)
 {
-	return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
+	return PyLong_FromLong(boolarg ? KX_TRUE: KX_FALSE);
 }
 
 #endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 7cf0b18..1cb17af 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -382,22 +382,22 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
 
 PyObject *SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
-	int retval = 0;
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
+	bool retval = false;
 	if (SCA_PythonController::m_sCurrentController)
 		retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
-	return PyLong_FromSsize_t(retval);
+	return PyBool_FromLong(retval);
 }
 
 PyObject *SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
-	return PyLong_FromSsize_t(self->GetState());
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
+	return PyBool_FromLong(self->GetState());
 }
 
 PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 	int status = 0;
 	if (self->GetState()) 
 	{
@@ -414,24 +414,24 @@ PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF
 	{
 		status = 3;
 	}
-	return PyLong_FromSsize_t(status);
+	return PyLong_FromLong(status);
 }
 
 PyObject *SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 	return PyLong_FromLong(self->GetPosTicks());
 }
 
 PyObject *SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 	return PyLong_FromLong(self->GetNegTicks());
 }
 
 int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 	if (self->m_level)
 		self->m_tap = false;
 	return 0;
@@ -439,7 +439,7 @@ int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attr
 
 int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+	SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 	if (self->m_tap)
 		self->m_level = false;
 	return 0;
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 7e9a4bc..c7e31f7 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -113,21 +113,21 @@ bool SCA_JoystickSensor::Evaluate()
 		return false;
 	
 	m_reset = false;
-	switch(m_joymode)
-	{
-	case KX_JOYSENSORMODE_AXIS:
+
+	switch (m_joymode) {
+		case KX_JOYSENSORMODE_AXIS:
 		{
-		/* what is what!
-			m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT
-			m_axisf == 1 == up
-			m_axisf == 2 == left
-			m_axisf == 3 == down
-			
-			numberof== m_axis (1-4), range is half of JOYAXIS_MAX since 
-				it assumes the axis joysticks are axis parirs (0,1), (2,3), etc
-				also note that this starts at 1 where functions its used
-				with expect a zero index.
-			*/
+			/* what is what!
+			 *  m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT
+			 *  m_axisf == 1 == up
+			 *  m_axisf == 2 == left
+			 *  m_axisf == 3 == down
+			 *
+			 *  numberof== m_axis (1-4), range is half of JOYAXIS_MAX since
+			 *      it assumes the axis joysticks are axis parirs (0,1), (2,3), etc
+			 *      also note that this starts at 1 where functions its used
+			 *      with expect a zero index.
+			 */
 			
 			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
 				return false;
@@ -159,7 +159,7 @@ bool SCA_JoystickSensor::Evaluate()
 			}
 			break;
 		}
-	case KX_JOYSENSORMODE_AXIS_SINGLE:
+		case KX_JOYSENSORMODE_AXIS_SINGLE:
 		{
 			/* Like KX_JOYSENSORMODE_AXIS but don't pair up axis */
 			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
@@ -179,12 +179,12 @@ bool SCA_JoystickSensor::Evaluate()
 			}
 			break;
 		}
-		
-	case KX_JOYSENSORMODE_BUTTON:
+
+		case KX_JOYSENSORMODE_BUTTON:
 		{
-		/* what is what!
-			m_button = the actual button in question
-			*/
+			/* what is what!
+			 *  m_button = the actual button in question
+			 */
 			if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */
 				return false;
 			
@@ -200,12 +200,12 @@ bool SCA_JoystickSensor::Evaluate()
 			}
 			break;
 		}
-	case KX_JOYSENSORMODE_HAT:
+		case KX_JOYSENSORMODE_HAT:
 		{
-		/* what is what!
-			numberof = m_hat  -- max 4
-			direction= m_hatf -- max 12
-			*/
+			/* what is what!
+			 *  numberof = m_hat  -- max 4
+			 *  direction= m_hatf -- max 12
+			 */
 			
 			if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */
 				return false;
@@ -222,18 +222,19 @@ bool SCA_JoystickSensor::Evaluate()
 			}
 			break;
 		}
-		/* test for ball anyone ?*/
-	default:
-		printf("Error invalid switch statement\n");
-		break;
+			/* test for ball anyone ?*/
+		default:
+			printf("Error invalid switch statement\n");
+			break;
 	}
 	
-	/* if not all events are enabled, only send a positive pulse when 
+	/* if not all events are enabled, only send a positive pulse when
 	 * the button state changes */
 	if (!m_bAllEvents) {
 		if (m_istrig_prev == m_istrig) {
 			result = false;
-		} else {
+		}
+		else {
 			m_istrig_prev = m_istrig;
 		}
 	}
@@ -318,7 +319,7 @@ PyObject *SCA_JoystickSensor::PyGetButtonActiveList( )
 	if (joy) {
 		for (i=0; i < joy->GetNumberOfButtons(); i++) {
 			if (joy->aButtonPressIsPositive(i)) {
-				value = PyLong_FromSsize_t(i);
+				value = PyLong_FromLong(i);
 				PyList_Append(ls, value);
 				Py_DECREF(value);
 			}
@@ -347,14 +348,14 @@ PyObject *SCA_JoystickSensor::PyGetButtonStatus( PyObject *args )
 
 PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
 	
 	int axis_index= joy->GetNumberOfAxes();
 	PyObject *list= PyList_New(axis_index);
 	
-	while(axis_index--) {
-		PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
+	while (axis_index--) {
+		PyList_SET_ITEM(list, axis_index, PyLong_FromLong(joy->GetAxisPosition(axis_index)));
 	}
 	
 	return list;
@@ -362,7 +363,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT
 
 PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
 	
 	if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) {
@@ -370,19 +371,19 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
 		return NULL;
 	}
 	
-	return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1));
+	return PyLong_FromLong(joy->GetAxisPosition(self->m_axis-1));
 }
 
 PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
 	
 	int hat_index= joy->GetNumberOfHats();
 	PyObject *list= PyList_New(hat_index);
 	
-	while(hat_index--) {
-		PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index)));
+	while (hat_index--) {
+		PyList_SET_ITEM(list, hat_index, PyLong_FromLong(joy->GetHat(hat_index)));
 	}
 	
 	return list;
@@ -390,36 +391,36 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT
 
 PyObject *SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
 	
-	return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1));
+	return PyLong_FromLong(joy->GetHat(self->m_hat-1));
 }
 
 PyObject *SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-	return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
+	return PyLong_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
 }
 
 PyObject *SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-	return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
+	return PyLong_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
 }
 
 PyObject *SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-	return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
+	return PyLong_FromLong( joy ? joy->GetNumberOfHats() : 0 );
 }
 
 PyObject *SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
+	SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
 	SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
 	return PyBool_FromLong( joy ? joy->Connected() : 0 );
 }
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 9a2dd9b..7005ea1 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -225,37 +225,37 @@ bool SCA_KeyboardSensor::Evaluate()
 		 */
 		if (m_qual > 0) {
 			const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual);
-			switch(qualevent.m_status) {
-			case SCA_InputEvent::KX_NO_INPUTSTATUS:
-				qual = false;
-				break;
-			case SCA_InputEvent::KX_JUSTRELEASED:
-				qual_change = true;
-				qual = false;
-				break;
-			case SCA_InputEvent::KX_JUSTACTIVATED:
-				qual_change = true;
-			case SCA_InputEvent::KX_ACTIVE:
-				/* do nothing */
-				break;
+			switch (qualevent.m_status) {
+				case SCA_InputEvent::KX_NO_INPUTSTATUS:
+					qual = false;
+					break;
+				case SCA_InputEvent::KX_JUSTRELEASED:
+					qual_change = true;
+					qual = false;
+					break;
+				case SCA_InputEvent::KX_JUSTACTIVATED:
+					qual_change = true;
+				case SCA_InputEvent::KX_ACTIVE:
+					/* do nothing */
+					break;
 			}
 		}
 		if (m_qual2 > 0 && qual==true) {
 			const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual2);
 			/* copy of above */
-			switch(qualevent.m_status) {
-			case SCA_InputEvent::KX_NO_INPUTSTATUS:
-				qual = false;
-				break;
-			case SCA_InputEvent::KX_JUSTRELEASED:
-				qual_change = true;
-				qual = false;
-				break;
-			case SCA_InputEvent::KX_JUSTACTIVATED:
-				qual_change = true;
-			case SCA_InputEvent::KX_ACTIVE:
-				/* do nothing */
-				break;
+			switch (qualevent.m_status) {
+				case SCA_InputEvent::KX_NO_INPUTSTATUS:
+					qual = false;
+					break;
+				case SCA_InputEvent::KX_JUSTRELEASED:
+					qual_change = true;
+					qual = false;
+					break;
+				case SCA_InputEvent::KX_JUSTACTIVATED:
+					qual_change = true;
+				case SCA_InputEvent::KX_ACTIVE:
+					/* do nothing */
+					break;
 			}
 		}
 		/* done reading qualifiers */
@@ -439,17 +439,18 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
 		return NULL;
 	}
 	
-	int keycode = PyLong_AsSsize_t(value);
+	SCA_IInputDevice::KX_EnumInputs keycode = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
 	
-	if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
-		|| (keycode > SCA_IInputDevice::KX_ENDKEY)) {
+	if ((keycode < SCA_IInputDevice::KX_BEGINKEY) ||
+	    (keycode > SCA_IInputDevice::KX_ENDKEY))
+	{
 		PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!");
 		return NULL;
 	}
 	
 	SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
-	const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode);
-	return PyLong_FromSsize_t(inevent.m_status);
+	const SCA_InputEvent & inevent = inputdev->GetEventValue(keycode);
+	return PyLong_FromLong(inevent.m_status);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -497,7 +498,7 @@ PyAttributeDef SCA_KeyboardSensor::Attributes[] = {
 
 PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_KeyboardSensor* self= static_cast<SCA_KeyboardSensor*>(self_v);
+	SCA_KeyboardSensor* self = static_cast<SCA_KeyboardSensor*>(self_v);
 	
 	SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)self->m_eventmgr)->GetInputDevice();
 
@@ -509,8 +510,8 @@ PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
 		if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
 		{
 			PyObject *keypair = PyList_New(2);
-			PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
-			PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
+			PyList_SET_ITEM(keypair,0,PyLong_FromLong(i));
+			PyList_SET_ITEM(keypair,1,PyLong_FromLong(inevent.m_status));
 			PyList_Append(resultlist,keypair);
 		}
 	}
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index f3d02cc..6909301 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -31,8 +31,8 @@
 #ifndef __SCA_LOGICMANAGER_H__
 #define __SCA_LOGICMANAGER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif 
 
 #include <vector>
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp
index a067b9c..6d05b86 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp
@@ -34,10 +34,10 @@
  */
 
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+   /* This warning tells us about truncation of __long__ stl-generated names.
+    * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning( disable:4786 )
 #endif
 
 #include "BoolValue.h"
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 51e0bc6..a7cf496 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -250,17 +250,18 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
 {
 	if (PyLong_Check(value))
 	{
-		int button = PyLong_AsSsize_t(value);
+		SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
 		
-		if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
-			|| (button > SCA_IInputDevice::KX_RIGHTMOUSE)) {
+		if ((button < SCA_IInputDevice::KX_LEFTMOUSE) ||
+		    (button > SCA_IInputDevice::KX_RIGHTMOUSE))
+		{
 			PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
 			return NULL;
 		}
 		
 		SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
-		const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
-		return PyLong_FromSsize_t(event.m_status);
+		const SCA_InputEvent& event = mousedev->GetEventValue(button);
+		return PyLong_FromLong(event.m_status);
 	}
 	
 	Py_RETURN_NONE;
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index 5dd4cc5..f02ac49 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -126,7 +126,6 @@ bool SCA_PropertySensor::Evaluate()
 
 bool	SCA_PropertySensor::CheckPropertyCondition()
 {
-
 	m_recentresult=false;
 	bool result=false;
 	bool reverse = false;
@@ -153,13 +152,11 @@ bool	SCA_PropertySensor::CheckPropertyCondition()
 				 */
 				if (result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) {
 					float f;
-					
-					if (EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f))
-					{
-						//error
+					if (sscanf(m_checkpropval.ReadPtr(), "%f", &f) == 1) {
+						result = (f == ((CFloatValue *)orgprop)->GetFloat());
 					} 
 					else {
-						result = (f == ((CFloatValue *)orgprop)->GetFloat());
+						/* error */
 					}
 				}
 				/* end patch */
@@ -174,7 +171,7 @@ bool	SCA_PropertySensor::CheckPropertyCondition()
 
 	case KX_PROPSENSOR_EXPRESSION:
 		{
-			/*
+#if 0
 			if (m_rightexpr)
 			{
 				CValue* resultval = m_rightexpr->Calculate();
@@ -189,7 +186,7 @@ bool	SCA_PropertySensor::CheckPropertyCondition()
 					result = resultval->GetNumber() != 0;
 				}
 			}
-			*/
+#endif
 			break;
 		}
 	case KX_PROPSENSOR_INTERVAL:
@@ -197,7 +194,16 @@ bool	SCA_PropertySensor::CheckPropertyCondition()
 			CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
 			if (!orgprop->IsError())
 			{
-				float val = orgprop->GetText().ToFloat(), min = m_checkpropval.ToFloat(), max = m_checkpropmaxval.ToFloat();
+				const float min = m_checkpropval.ToFloat();
+				const float max = m_checkpropmaxval.ToFloat();
+				float val;
+
+				if (dynamic_cast<CStringValue *>(orgprop) == NULL) {
+					val = orgprop->GetNumber();
+				}
+				else {
+					val = orgprop->GetText().ToFloat();
+				}
 
 				result = (min <= val) && (val <= max);
 			}
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 7dbbbb2..c2b1470 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -168,12 +168,16 @@ void SCA_PythonController::SetNamespace(PyObject*	pythondictionary)
 }
 #endif
 
-int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
+bool SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
 {
 	if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) != 
 		m_triggeredSensors.end())
-		return 1;
-	return 0;
+	{
+		return true;
+	}
+	else {
+		return false;
+	}
 }
 
 #ifdef WITH_PYTHON
@@ -376,64 +380,63 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
 	PyObject *excdict=		NULL;
 	PyObject *resultobj=	NULL;
 	
-	switch(m_mode) {
-	case SCA_PYEXEC_SCRIPT:
-	{
-		if (m_bModified)
-			if (Compile()==false) // sets m_bModified to false
+	switch (m_mode) {
+		case SCA_PYEXEC_SCRIPT:
+		{
+			if (m_bModified)
+				if (Compile()==false) // sets m_bModified to false
+					return;
+			if (!m_bytecode)
 				return;
-		if (!m_bytecode)
-			return;
-		
-		/*
-		 * This part here with excdict is a temporary patch
-		 * to avoid python/gameengine crashes when python
-		 * inadvertently holds references to game objects
-		 * in global variables.
-		 * 
-		 * The idea is always make a fresh dictionary, and
-		 * destroy it right after it is used to make sure
-		 * python won't hold any gameobject references.
-		 * 
-		 * Note that the PyDict_Clear _is_ necessary before
-		 * the Py_DECREF() because it is possible for the
-		 * variables inside the dictionary to hold references
-		 * to the dictionary (ie. generate a cycle), so we
-		 * break it by hand, then DECREF (which in this case
-		 * should always ensure excdict is cleared).
-		 */
-
-		excdict= PyDict_Copy(m_pythondictionary);
-
-		resultobj = PyEval_EvalCode((PyObject *)m_bytecode, excdict, excdict);
-
-		/* PyRun_SimpleString(m_scriptText.Ptr()); */
-		break;
-	}
-	case SCA_PYEXEC_MODULE:
-	{
-		if (m_bModified || m_debug)
-			if (Import()==false) // sets m_bModified to false
+
+			/*
+			 * This part here with excdict is a temporary patch
+			 * to avoid python/gameengine crashes when python
+			 * inadvertently holds references to game objects
+			 * in global variables.
+			 *
+			 * The idea is always make a fresh dictionary, and
+			 * destroy it right after it is used to make sure
+			 * python won't hold any gameobject references.
+			 *
+			 * Note that the PyDict_Clear _is_ necessary before
+			 * the Py_DECREF() because it is possible for the
+			 * variables inside the dictionary to hold references
+			 * to the dictionary (ie. generate a cycle), so we
+			 * break it by hand, then DECREF (which in this case
+			 * should always ensure excdict is cleared).
+			 */
+
+			excdict= PyDict_Copy(m_pythondictionary);
+
+			resultobj = PyEval_EvalCode((PyObject *)m_bytecode, excdict, excdict);
+
+			/* PyRun_SimpleString(m_scriptText.Ptr()); */
+			break;
+		}
+		case SCA_PYEXEC_MODULE:
+		{
+			if (m_bModified || m_debug)
+				if (Import()==false) // sets m_bModified to false
+					return;
+			if (!m_function)
 				return;
-		if (!m_function)
-			return;
-		
-		PyObject *args= NULL;
-		
-		if (m_function_argc==1) {
-			args = PyTuple_New(1);
-			PyTuple_SET_ITEM(args, 0, GetProxy());
+
+			PyObject *args= NULL;
+
+			if (m_function_argc==1) {
+				args = PyTuple_New(1);
+				PyTuple_SET_ITEM(args, 0, GetProxy());
+			}
+
+			resultobj = PyObject_CallObject(m_function, args);
+			Py_XDECREF(args);
+			break;
 		}
-		
-		resultobj = PyObject_CallObject(m_function, args);
-		Py_XDECREF(args);
-		break;
-	}
-	
+
 	} /* end switch */
-	
-	
-	
+
+
 	/* Free the return value and print the error */
 	if (resultobj)
 		Py_DECREF(resultobj);
@@ -485,10 +488,10 @@ PyObject *SCA_PythonController::PyDeActivate(PyObject *value)
 
 PyObject *SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	//SCA_PythonController* self= static_cast<SCA_PythonController*>(static_cast<SCA_IController*>(static_cast<SCA_ILogicBrick*>(static_cast<CValue*>(static_cast<PyObjectPlus*>(self_v)))));
+	//SCA_PythonController* self = static_cast<SCA_PythonController*>(static_cast<SCA_IController*>(static_cast<SCA_ILogicBrick*>(static_cast<CValue*>(static_cast<PyObjectPlus*>(self_v)))));
 	// static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
 
-	SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
+	SCA_PythonController* self = static_cast<SCA_PythonController*>(self_v);
 	return PyUnicode_From_STR_String(self->m_scriptText);
 }
 
@@ -496,7 +499,7 @@ PyObject *SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRI
 
 int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
+	SCA_PythonController* self = static_cast<SCA_PythonController*>(self_v);
 	
 	const char *scriptArg = _PyUnicode_AsString(value);
 	
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index f1f10d2..d254931 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -90,7 +90,7 @@ class SCA_PythonController : public SCA_IController
 	void	SetDebug(bool debug) { m_debug = debug; }
 	void	AddTriggeredSensor(class SCA_ISensor* sensor)
 		{ m_triggeredSensors.push_back(sensor); }
-	int		IsTriggered(class SCA_ISensor* sensor);
+	bool	IsTriggered(class SCA_ISensor* sensor);
 	bool	Compile();
 	bool	Import();
 	void	ErrorPrint(const char *error_msg);
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 42cda94..19aae46 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -117,7 +117,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
 	{
 		const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
 		
-		PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+		PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
 	}
 	Py_INCREF(self->m_event_dict);
 	return self->m_event_dict;
@@ -134,7 +134,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PY
 		const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
 		
 		if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
-			PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+			PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
 	}
 	Py_INCREF(self->m_event_dict);
 	return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 0806bda..1617f71 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -100,7 +100,7 @@ PyObject *SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_
 	{
 		const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
 		
-		PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+		PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
 	}
 	Py_INCREF(self->m_event_dict);
 	return self->m_event_dict;
@@ -117,7 +117,7 @@ PyObject *SCA_PythonMouse::pyattr_get_active_events(void *self_v, const KX_PYATT
 		const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
 		
 		if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
-			PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+			PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
 	}
 	Py_INCREF(self->m_event_dict);
 	return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 9a54c76..5568072 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -48,13 +48,13 @@
 /* ------------------------------------------------------------------------- */
 
 SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, 
-									 long seed,
-									 SCA_RandomActuator::KX_RANDOMACT_MODE mode,
-									 float para1,
-									 float para2,
-									 const STR_String &propName)
-	: SCA_IActuator(gameobj, KX_ACT_RANDOM),
-	  m_propname(propName),
+                                       long seed,
+                                       SCA_RandomActuator::KX_RANDOMACT_MODE mode,
+                                       float para1,
+                                       float para2,
+                                       const STR_String &propName)
+    : SCA_IActuator(gameobj, KX_ACT_RANDOM),
+      m_propname(propName),
 	  m_parameter1(para1),
 	  m_parameter2(para2),
 	  m_distribution(mode)
@@ -196,38 +196,35 @@ bool SCA_RandomActuator::Update()
 
 			 */
 			tmpval = new CFloatValue(m_parameter1);
-		} else {
-			/*
-
-			  070301 - nzc 
-			  Now, with seed != 0, we will most assuredly get some
-			  sensible values. The termination condition states two 
-			  things: 
-			  1. s >= 0 is not allowed: to prevent the distro from 
-				 getting a bias towards high values. This is a small
-				 correction, really, and might also be left out.
-			  2. s == 0 is not allowed: to prevent a division by zero
-				 when renormalising the drawn value to the desired
-				 distribution shape. As a side effect, the distro will
-				 never yield the exact mean. 
-			  I am not sure whether this is consistent, since the error 
-			  cause by #2 is of the same magnitude as the one 
-			  prevented by #1. The error introduced into the SD will be 
-			  improved, though. By how much? Hard to say... If you like
-			  the maths, feel free to analyse. Be aware that this is 
-			  one of the really old standard algorithms. I think the 
-			  original came in Fortran, was translated to Pascal, and 
-			  then someone came up with the C code. My guess it that
-			  this will be quite sufficient here.
-
+		}
+		else {
+			/* 070301 - nzc
+			 * Now, with seed != 0, we will most assuredly get some
+			 * sensible values. The termination condition states two
+			 * things:
+			 * 1. s >= 0 is not allowed: to prevent the distro from
+			 *    getting a bias towards high values. This is a small
+			 *    correction, really, and might also be left out.
+			 * 2. s == 0 is not allowed: to prevent a division by zero
+			 *    when renormalising the drawn value to the desired
+			 *    distribution shape. As a side effect, the distro will
+			 *    never yield the exact mean.
+			 * I am not sure whether this is consistent, since the error
+			 * cause by #2 is of the same magnitude as the one
+			 * prevented by #1. The error introduced into the SD will be
+			 * improved, though. By how much? Hard to say... If you like
+			 * the maths, feel free to analyse. Be aware that this is
+			 * one of the really old standard algorithms. I think the
+			 * original came in Fortran, was translated to Pascal, and
+			 * then someone came up with the C code. My guess it that
+			 * this will be quite sufficient here.
 			 */
-			do 
-			{
-				x = 2.0 * m_base->DrawFloat() - 1.0;
-				y = 2.0 * m_base->DrawFloat() - 1.0;
-				s = x*x + y*y;
-			} while ( (s >= 1.0) || (s == 0.0) );
-			t = x * sqrt( (-2.0 * log(s)) / s);
+			do {
+				x = 2.0f * m_base->DrawFloat() - 1.0f;
+				y = 2.0f * m_base->DrawFloat() - 1.0f;
+				s = x * x + y * y;
+			} while ((s >= 1.0f) || (s == 0.0f));
+			t = x * sqrtf((-2.0 * log(s)) / s);
 			tmpval = new CFloatValue(m_parameter1 + m_parameter2 * t);
 		}
 	}
@@ -366,17 +363,17 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
 PyObject *SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
 	SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
-	return PyLong_FromSsize_t(act->m_base->GetSeed());
+	return PyLong_FromLong(act->m_base->GetSeed());
 }
 
 int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
 	SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
-	if (PyLong_Check(value))	{
-		int ival = PyLong_AsSsize_t(value);
-		act->m_base->SetSeed(ival);
+	if (PyLong_Check(value)) {
+		act->m_base->SetSeed(PyLong_AsLong(value));
 		return PY_SET_ATTR_SUCCESS;
-	} else {
+	}
+	else {
 		PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
 		return PY_SET_ATTR_FAIL;
 	}
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 1778475..4e93556 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -167,18 +167,18 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
 
 PyObject *SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
-	return PyLong_FromSsize_t(self->m_basegenerator->GetSeed());
+	SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
+	return PyLong_FromLong(self->m_basegenerator->GetSeed());
 }
 
 int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
+	SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
 	if (!PyLong_Check(value)) {
 		PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
 		return PY_SET_ATTR_FAIL;
 	}
-	self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value));
+	self->m_basegenerator->SetSeed(PyLong_AsLong(value));
 	return PY_SET_ATTR_SUCCESS;
 }
 
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
index e8a6289..5aa6fdc 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
@@ -29,11 +29,10 @@
  *  \ingroup gamelogic
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+   /* This warning tells us about truncation of __long__ stl-generated names.
+    * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning(disable:4786)
 #endif
 
 #include "SCA_TimeEventManager.h"
diff --git a/source/gameengine/GamePlayer/CMakeLists.txt b/source/gameengine/GamePlayer/CMakeLists.txt
index cdf3f82..e1a2666 100644
--- a/source/gameengine/GamePlayer/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/CMakeLists.txt
@@ -26,6 +26,6 @@
 add_subdirectory(common)
 add_subdirectory(ghost)
 
-if(WITH_WEBPLUGIN) 
+if(WITH_WEBPLUGIN)
 	add_subdirectory(xembed)
 endif()
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
index a995dcf..ec5375c 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h
@@ -90,7 +90,7 @@ protected:
 	 * relative to the context */
 	RAS_Rect m_displayarea;
 
-	int *m_viewport;
+	int m_viewport[4];
 
 	/** Storage for the banners to display. */
 	TBannerMap m_banners;
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
index afe7f92..c082bc1 100644
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
+++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
@@ -33,7 +33,7 @@
 #define __GPC_KEYBOARDDEVICE_H__
 
 #ifdef WIN32
-#pragma warning (disable : 4786)
+#pragma warning (disable:4786)
 #endif  /* WIN32 */
 
 #include "SCA_IInputDevice.h"
diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
index 7699a9e..b092fbd 100644
--- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
+++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
@@ -33,7 +33,7 @@
 #define __GPC_MOUSEDEVICE_H__
 
 #ifdef WIN32
-#pragma warning (disable : 4786)
+#pragma warning (disable:4786)
 #endif  /* WIN32 */
 
 #include "SCA_IInputDevice.h"
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
index adf0bcd..c4022d6 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
@@ -38,7 +38,8 @@ void GetRawLoadingAnimation(unsigned char **data, int *dataSize)
 {
 	// create an array that will automatically be deleted when)
 	// we're outta this scope
-	static unsigned char load_blend[]= { 66,  76,  69,  78,  68,  70, 
+	static unsigned char load_blend[] = {
+		 66,  76,  69,  78,  68,  70,
 		 73,  10,   0,   2,  21,   0,   0,   2,  22,   0,   0,   0,   0,   0,   0, 
 		  2,  30,  49,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
 		 65,  25, 242,   2,   0,   2,  29, 253,   0,   0,   0,   4, 160, 249, 227, 
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
index 2471b52..2f58e9a 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
@@ -38,7 +38,8 @@ void GetRawBlenderLogo(unsigned char **data, int *width, int *height)
 {
 	// create an array that will automatically be deleted when)
 	// we're outta this scope
-	static unsigned char logo_blender_raw[]= {  0,   0,   0,   0,   0, 
+	static unsigned char logo_blender_raw[] = {
+		  0,   0,   0,   0,   0,
 		  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
 		  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
 		  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
@@ -1041,7 +1042,8 @@ void GetRawBlender3DLogo(unsigned char **data, int *width, int *height)
 {
 	// create an array that will automatically be deleted when)
 	// we're outta this scope
-	static unsigned char logo_blender3d_raw[]= {255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 
+	static unsigned char logo_blender3d_raw[] = {
+		255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 255,
 		255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 
 		255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 
 		255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255,   0, 255, 255, 255, 
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 4bf81bf..dfc8665 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -173,11 +173,11 @@ bool GPC_RenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, vo
 	left = (dir.cross(resultnormal)).safe_normalized();
 	// for the up vector, we take the 'resultnormal' returned by the physics
 	
-	double maat[16]={
-			left[0],        left[1],        left[2], 0,
-				dir[0],         dir[1],         dir[2], 0,
-		resultnormal[0],resultnormal[1],resultnormal[2], 0,
-				0,              0,              0, 1};
+	double maat[16] = {left[0],         left[1],         left[2],         0,
+	                   dir[0],          dir[1],          dir[2],          0,
+	                   resultnormal[0], resultnormal[1], resultnormal[2], 0,
+	                   0,               0,               0,               1};
+
 	glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
 	//glMultMatrixd(oglmatrix);
 	glMultMatrixd(maat);
@@ -236,16 +236,16 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
 		left *= size[0];
 		dir  *= size[1];
 		up   *= size[2];
-		double maat[16]={
-			left[0], left[1],left[2], 0,
-				dir[0], dir[1],dir[2],0,
-				up[0],up[1],up[2],0,
-				0,0,0,1};
-			glTranslated(objpos[0],objpos[1],objpos[2]);
-			glMultMatrixd(maat);
-			
-	} else
-	{
+
+		double maat[16] = {left[0], left[1], left[2], 0,
+		                   dir[0],  dir[1],  dir[2],  0,
+		                   up[0],   up[1],   up[2],   0,
+		                   0,       0,       0,       1};
+
+		glTranslated(objpos[0],objpos[1],objpos[2]);
+		glMultMatrixd(maat);
+	}
+	else {
 		if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
 		{
 			// shadow must be cast to the ground, physics system needed here!
diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript
index d5e1f08..6a1f47c 100644
--- a/source/gameengine/GamePlayer/common/SConscript
+++ b/source/gameengine/GamePlayer/common/SConscript
@@ -31,7 +31,6 @@ incs = ['.',
         '#source/blender',
         '#source/blender/include',
         '#source/blender/makesdna',
-        '#source/gameengine/BlenderRoutines',
         '#source/gameengine/Rasterizer',
         '#source/gameengine/GameLogic',
         '#source/gameengine/Expressions',
diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp
index fe6f218..8ffbe75 100644
--- a/source/gameengine/GamePlayer/common/bmfont.cpp
+++ b/source/gameengine/GamePlayer/common/bmfont.cpp
@@ -73,9 +73,6 @@ void printfGlyph(bmGlyph * glyph)
 }
 */
 
-#define MAX2(x,y)          ( (x)>(y) ? (x) : (y) )
-#define MAX3(x,y,z)                MAX2( MAX2((x),(y)) , (z) )  
-
 void calcAlpha(ImBuf * ibuf)
 {
 	int i;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 40b52c3..92db1fe 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -555,7 +555,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
 		bool showPhysics = (gm->flag & GAME_SHOW_PHYSICS);
 		SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics);
 
-		bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0);
+		bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixedtime", fixedFr) != 0);
 		bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
 		bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0);
 		bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0);
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
index f2d7ec2..440fd2b 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
@@ -33,7 +33,7 @@
 #define __GPG_CANVAS_H__
 
 #ifdef WIN32
-#pragma warning (disable : 4786)
+#pragma warning (disable:4786)
 #endif  /* WIN32 */
 
 #include "GPC_Canvas.h"
diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
index b31803b..e8d3441 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
@@ -72,7 +72,7 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	m_reverseKeyTranslateTable[GHOST_kKey7                     ] = KX_SEVENKEY                ;
 	m_reverseKeyTranslateTable[GHOST_kKey8                     ] = KX_EIGHTKEY                ;
 	m_reverseKeyTranslateTable[GHOST_kKey9                     ] = KX_NINEKEY                 ;
-	
+
 	// Middle keyboard area keys
 	m_reverseKeyTranslateTable[GHOST_kKeyPause                 ] = KX_PAUSEKEY                ;
 	m_reverseKeyTranslateTable[GHOST_kKeyInsert                ] = KX_INSERTKEY               ;
@@ -81,7 +81,7 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	m_reverseKeyTranslateTable[GHOST_kKeyEnd                   ] = KX_ENDKEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyUpPage                ] = KX_PAGEUPKEY               ;
 	m_reverseKeyTranslateTable[GHOST_kKeyDownPage              ] = KX_PAGEDOWNKEY             ;
-	
+
 	// Arrow keys
 	m_reverseKeyTranslateTable[GHOST_kKeyUpArrow               ] = KX_UPARROWKEY              ;
 	m_reverseKeyTranslateTable[GHOST_kKeyDownArrow             ] = KX_DOWNARROWKEY            ;
@@ -108,19 +108,19 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	m_reverseKeyTranslateTable[GHOST_kKeyF17                   ] = KX_F17KEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyF18                   ] = KX_F18KEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyF19                   ] = KX_F19KEY                  ;
-	
+
 
 	// Numpad keys
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad0	           ] = KX_PAD0	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad1	           ] = KX_PAD1	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad2	           ] = KX_PAD2	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad3	           ] = KX_PAD3	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad4	           ] = KX_PAD4	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad5	           ] = KX_PAD5	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad6	           ] = KX_PAD6	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad7	           ] = KX_PAD7	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad8	           ] = KX_PAD8	                   ;
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpad9	           ] = KX_PAD9	                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad0               ] = KX_PAD0                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad1               ] = KX_PAD1                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad2               ] = KX_PAD2                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad3               ] = KX_PAD3                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad4               ] = KX_PAD4                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad5               ] = KX_PAD5                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad6               ] = KX_PAD6                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad7               ] = KX_PAD7                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad8               ] = KX_PAD8                     ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpad9               ] = KX_PAD9                     ;
 	m_reverseKeyTranslateTable[GHOST_kKeyNumpadAsterisk        ] = KX_PADASTERKEY              ;
 	m_reverseKeyTranslateTable[GHOST_kKeyNumpadPlus            ] = KX_PADPLUSKEY               ;
 	m_reverseKeyTranslateTable[GHOST_kKeyNumpadPeriod          ] = KX_PADPERIOD                ;
@@ -133,7 +133,7 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	m_reverseKeyTranslateTable[GHOST_kKeyEsc                   ] = KX_ESCKEY                   ;
 	m_reverseKeyTranslateTable[GHOST_kKeyTab                   ] = KX_TABKEY                   ;
 	m_reverseKeyTranslateTable[GHOST_kKeySpace                 ] = KX_SPACEKEY                 ;
-	m_reverseKeyTranslateTable[GHOST_kKeyEnter                 ] = KX_RETKEY			       ;
+	m_reverseKeyTranslateTable[GHOST_kKeyEnter                 ] = KX_RETKEY                   ;
 	m_reverseKeyTranslateTable[GHOST_kKeyBackSpace             ] = KX_BACKSPACEKEY             ;
 	m_reverseKeyTranslateTable[GHOST_kKeySemicolon             ] = KX_SEMICOLONKEY             ;
 	m_reverseKeyTranslateTable[GHOST_kKeyPeriod                ] = KX_PERIODKEY                ;
@@ -141,19 +141,19 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	m_reverseKeyTranslateTable[GHOST_kKeyQuote                 ] = KX_QUOTEKEY                 ;
 	m_reverseKeyTranslateTable[GHOST_kKeyAccentGrave           ] = KX_ACCENTGRAVEKEY           ;
 	m_reverseKeyTranslateTable[GHOST_kKeyMinus                 ] = KX_MINUSKEY                 ;
-	m_reverseKeyTranslateTable[GHOST_kKeySlash	               ] = KX_SLASHKEY                 ;
+	m_reverseKeyTranslateTable[GHOST_kKeySlash                 ] = KX_SLASHKEY                 ;
 	m_reverseKeyTranslateTable[GHOST_kKeyBackslash             ] = KX_BACKSLASHKEY             ;
 	m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;
-	m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket	       ] = KX_LEFTBRACKETKEY           ;
-	m_reverseKeyTranslateTable[GHOST_kKeyRightBracket	       ] = KX_RIGHTBRACKETKEY          ;
+	m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket           ] = KX_LEFTBRACKETKEY           ;
+	m_reverseKeyTranslateTable[GHOST_kKeyRightBracket          ] = KX_RIGHTBRACKETKEY          ;
 
 	// Modifier keys.
-	m_reverseKeyTranslateTable[GHOST_kKeyLeftControl	       ] = KX_LEFTCTRLKEY	           ;
-	m_reverseKeyTranslateTable[GHOST_kKeyRightControl 	       ] = KX_RIGHTCTRLKEY 	           ;
+	m_reverseKeyTranslateTable[GHOST_kKeyLeftControl           ] = KX_LEFTCTRLKEY              ;
+	m_reverseKeyTranslateTable[GHOST_kKeyRightControl          ] = KX_RIGHTCTRLKEY             ;
 	m_reverseKeyTranslateTable[GHOST_kKeyLeftAlt               ] = KX_LEFTALTKEY               ;
 	m_reverseKeyTranslateTable[GHOST_kKeyRightAlt              ] = KX_RIGHTALTKEY              ;
 	m_reverseKeyTranslateTable[GHOST_kKeyLeftShift             ] = KX_LEFTSHIFTKEY             ;
-	m_reverseKeyTranslateTable[GHOST_kKeyRightShift	           ] = KX_RIGHTSHIFTKEY            ;
+	m_reverseKeyTranslateTable[GHOST_kKeyRightShift            ] = KX_RIGHTSHIFTKEY            ;
 }
 
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
index 4c6b820..ff8d56d 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
@@ -34,7 +34,7 @@
 #define __GPG_KEYBOARDDEVICE_H__
 
 #ifdef WIN32
-#pragma warning (disable : 4786)
+#pragma warning (disable:4786)
 #endif  /* WIN32 */
 
 #include "GHOST_Types.h"
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 7500a55..a82f9ce 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -60,6 +60,7 @@ extern "C"
 #include "BKE_blender.h"
 #include "BKE_global.h"
 #include "BKE_icons.h"
+#include "BKE_image.h"
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_library.h"
@@ -119,11 +120,11 @@ static void mem_error_cb(const char *errorStr)
 
 #ifdef WIN32
 typedef enum {
-  SCREEN_SAVER_MODE_NONE = 0,
-  SCREEN_SAVER_MODE_PREVIEW,
-  SCREEN_SAVER_MODE_SAVER,
-  SCREEN_SAVER_MODE_CONFIGURATION,
-  SCREEN_SAVER_MODE_PASSWORD,
+	SCREEN_SAVER_MODE_NONE = 0,
+	SCREEN_SAVER_MODE_PREVIEW,
+	SCREEN_SAVER_MODE_SAVER,
+	SCREEN_SAVER_MODE_CONFIGURATION,
+	SCREEN_SAVER_MODE_PASSWORD,
 } ScreenSaverMode;
 
 static ScreenSaverMode scr_saver_mode = SCREEN_SAVER_MODE_NONE;
@@ -172,7 +173,7 @@ static BOOL scr_saver_init(int argc, char **argv)
 
 #endif /* WIN32 */
 
-void usage(const char* program, bool isBlenderPlayer)
+static void usage(const char* program, bool isBlenderPlayer)
 {
 	const char * consoleoption;
 	const char * example_filename = "";
@@ -332,7 +333,7 @@ static BlendFileData *load_game_data(const char *progname, char *filename = NULL
 	return bfd;
 }
 
-bool GPG_NextFrame(GHOST_ISystem* system, GPG_Application *app, int &exitcode, STR_String &exitstring, GlobalSettings *gs)
+static bool GPG_NextFrame(GHOST_ISystem* system, GPG_Application *app, int &exitcode, STR_String &exitstring, GlobalSettings *gs)
 {
 	bool run = true;
 	system->processEvents(false);
@@ -352,7 +353,7 @@ struct GPG_NextFrameState {
 	GlobalSettings *gs;
 } gpg_nextframestate;
 
-int GPG_PyNextFrame(void *state0)
+static int GPG_PyNextFrame(void *state0)
 {
 	GPG_NextFrameState *state = (GPG_NextFrameState *) state0;
 	int exitcode;
@@ -446,11 +447,11 @@ int main(int argc, char** argv)
 	G.main = NULL;
 
 	IMB_init();
+	BKE_images_init();
 
 	// Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c)
 	BLF_init(11, U.dpi);
 	BLF_lang_init();
-	BLF_lang_encoding("");
 	BLF_lang_set("");
 
 	BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
@@ -755,6 +756,7 @@ int main(int argc, char** argv)
 		}
 
 		GPU_set_anisotropic(U.anisotropic_filter);
+		GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
 		
 		// Create the system
 		if (GHOST_ISystem::createSystem() == GHOST_kSuccess)
@@ -1064,9 +1066,11 @@ int main(int argc, char** argv)
 
 #ifdef WITH_INTERNATIONAL
 	BLF_free_unifont();
+	BLF_lang_free();
 #endif
 
 	IMB_exit();
+	BKE_images_exit();
 	free_nodesystem();
 
 	SYS_DeleteSystem(syshandle);
diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript
index 9fb0f05..fb046d0 100644
--- a/source/gameengine/GamePlayer/ghost/SConscript
+++ b/source/gameengine/GamePlayer/ghost/SConscript
@@ -26,7 +26,6 @@ incs = ['.',
         '#source/blender/include',
         '#source/blender/makesdna',
         '#source/blender/makesrna',
-        '#source/gameengine/BlenderRoutines',
         '#source/gameengine/Rasterizer',
         '#source/gameengine/GameLogic',
         '#source/gameengine/Expressions',
diff --git a/source/gameengine/GamePlayer/xembed/UnixShell.c b/source/gameengine/GamePlayer/xembed/UnixShell.c
index e9c6c73..ed6dd65 100644
--- a/source/gameengine/GamePlayer/xembed/UnixShell.c
+++ b/source/gameengine/GamePlayer/xembed/UnixShell.c
@@ -355,12 +355,12 @@ NPP_WriteReady(
 	
 	log_entry("NPP_WriteReady");
 
-	if (instance == NULL)	
+	if (instance == NULL)
 		return NPERR_INVALID_INSTANCE_ERROR;
 
 	This = (BlenderPluginInstance *) instance->pdata;
 
-	if (This == NULL)	
+	if (This == NULL)
 		return NPERR_INVALID_INSTANCE_ERROR;
 
 	/* Check whether buffers already exist: */
@@ -388,12 +388,12 @@ NPP_Write(
 	
 	log_entry("NPP_Write");
 
-	if (instance == NULL)	
+	if (instance == NULL)
 		return NPERR_INVALID_INSTANCE_ERROR;
 	
 	This = (BlenderPluginInstance *) instance->pdata;
 
-	if (This == NULL)	
+	if (This == NULL)
 		return NPERR_INVALID_INSTANCE_ERROR;
 
 	
@@ -517,14 +517,14 @@ execute_blenderplayer(BlenderPluginInstance *instance)
 	
 	}
 	else if (instance->pID < 0) {           // failed to fork
-		printf("Failed to fork!!!\n");					
+		printf("Failed to fork!!!\n");
 	}
 
 	/*XEvent e;
 	int started = 0;
 	while (!started) {
 		XNextEvent(This->display, &e);
-		printf("Event type %d\n", e.type);					
+		printf("Event type %d\n", e.type);
 		if (e.type == MapNotify) {
 			started = 1;
 			XCreateWindowEvent event =  e.xcreatewindow;
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index a21c396..5b7a231 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -352,29 +352,27 @@ void BL_Action::Update(float curtime)
 	}
 
 	// Handle wrap around
-	if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
-	{
-		switch(m_playmode)
-		{
-		case ACT_MODE_PLAY:
-			// Clamp
-			m_localtime = m_endframe;
-			m_done = true;
-			break;
-		case ACT_MODE_LOOP:
-			// Put the time back to the beginning
-			m_localtime = m_startframe;
-			m_starttime = curtime;
-			break;
-		case ACT_MODE_PING_PONG:
-			// Swap the start and end frames
-			float temp = m_startframe;
-			m_startframe = m_endframe;
-			m_endframe = temp;
-
-			m_starttime = curtime;
-
-			break;
+	if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) {
+		switch (m_playmode) {
+			case ACT_MODE_PLAY:
+				// Clamp
+				m_localtime = m_endframe;
+				m_done = true;
+				break;
+			case ACT_MODE_LOOP:
+				// Put the time back to the beginning
+				m_localtime = m_startframe;
+				m_starttime = curtime;
+				break;
+			case ACT_MODE_PING_PONG:
+				// Swap the start and end frames
+				float temp = m_startframe;
+				m_startframe = m_endframe;
+				m_endframe = temp;
+
+				m_starttime = curtime;
+
+				break;
 		}
 	}
 
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp
index 122d692..23bfd7a 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.cpp
+++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp
@@ -6,6 +6,8 @@
 #include "DNA_material_types.h"
 #include "DNA_scene_types.h"
 
+#include "BLI_utildefines.h"
+
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_DerivedMesh.h"
@@ -143,9 +145,9 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 	viewinv.getValue((float*)viewinvmat);
 
 	if (ms.m_bObjectColor)
-		ms.m_RGBAcolor.getValue((float*)obcol);
+		ms.m_RGBAcolor.getValue((float *)obcol);
 	else
-		obcol[0]= obcol[1]= obcol[2]= obcol[3]= 1.0f;
+		obcol[0] = obcol[1] = obcol[2] = obcol[3] = 1.0f;
 
 	float auto_bump_scale = ms.m_pDerivedMesh!=0 ? ms.m_pDerivedMesh->auto_bump_scale : 1.0f;
 	GPU_material_bind_uniforms(gpumat, obmat, viewmat, viewinvmat, obcol, auto_bump_scale);
diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp
index 4c75187..0954aa0 100644
--- a/source/gameengine/Ketsji/BL_Material.cpp
+++ b/source/gameengine/Ketsji/BL_Material.cpp
@@ -36,10 +36,7 @@ BL_Material::BL_Material()
 
 void BL_Material::Initialize()
 {
-	rgb[0] = 0;
-	rgb[1] = 0;
-	rgb[2] = 0;
-	rgb[3] = 0;
+	m_mcol = 0xFFFFFFFFL;
 	IdMode = 0;
 	ras_mode = 0;
 	glslmat = 0;
@@ -66,11 +63,6 @@ void BL_Material::Initialize()
 	share = false;
 
 	int i;
-	for (i=0; i<4; i++)
-	{
-		uv[i] = MT_Point2(0.f,1.f);
-		uv2[i] = MT_Point2(0.f, 1.f);
-	}
 
 	for (i=0; i<MAXTEX; i++) // :(
 	{
@@ -98,56 +90,15 @@ void BL_Material::Initialize()
 	}
 }
 
-void BL_Material::SetConversionRGB(unsigned int *nrgb)
-{
-	rgb[0]=*nrgb++;
-	rgb[1]=*nrgb++;
-	rgb[2]=*nrgb++;
-	rgb[3]=*nrgb;
-}
-
-void BL_Material::GetConversionRGB(unsigned int *nrgb)
-{
-	*nrgb++ = rgb[0];
-	*nrgb++ = rgb[1];
-	*nrgb++ = rgb[2];
-	*nrgb   = rgb[3];
-}
-
-void BL_Material::SetConversionUV(const STR_String& name, MT_Point2 *nuv)
+void BL_Material::SetUVLayerName(const STR_String& name)
 {
 	uvName = name;
-	uv[0] = *nuv++;
-	uv[1] = *nuv++;
-	uv[2] = *nuv++;
-	uv[3] = *nuv;
 }
-
-void BL_Material::GetConversionUV(MT_Point2 *nuv)
-{
-	*nuv++ = uv[0];
-	*nuv++ = uv[1];
-	*nuv++ = uv[2];
-	*nuv   = uv[3];
-}
-void BL_Material::SetConversionUV2(const STR_String& name, MT_Point2 *nuv)
+void BL_Material::SetUVLayerName2(const STR_String& name)
 {
 	uv2Name = name;
-	uv2[0] = *nuv++;
-	uv2[1] = *nuv++;
-	uv2[2] = *nuv++;
-	uv2[3] = *nuv;
 }
 
-void BL_Material::GetConversionUV2(MT_Point2 *nuv)
-{
-	*nuv++ = uv2[0];
-	*nuv++ = uv2[1];
-	*nuv++ = uv2[2];
-	*nuv   = uv2[3];
-}
-
-
 void BL_Material::SetSharedMaterial(bool v)
 {
 	if ((v && num_users == -1) || num_users > 1 )
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index b67bd95..ef180ed 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -87,22 +87,13 @@ public:
 	MTFace				tface; /* copy of the derived meshes tface */
 	Image*				img[MAXTEX];
 	EnvMap*				cubemap[MAXTEX];
-
-	unsigned int rgb[4];
-	MT_Point2 uv[4];
-	MT_Point2 uv2[4];
+	unsigned int		m_mcol; /* for text color (only) */
 
 	STR_String uvName;
 	STR_String uv2Name;
 
-	void SetConversionRGB(unsigned int *rgb);
-	void GetConversionRGB(unsigned int *rgb);
-
-	void SetConversionUV(const STR_String& name, MT_Point2 *uv);
-	void GetConversionUV(MT_Point2 *uv);
-
-	void SetConversionUV2(const STR_String& name, MT_Point2 *uv);
-	void GetConversionUV2(MT_Point2 *uv);
+	void SetUVLayerName(const STR_String &name);
+	void SetUVLayerName2(const STR_String &name);
 
 	void SetSharedMaterial(bool v);
 	bool IsShared();
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index e0ad153..4a74024 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -52,51 +52,70 @@ void BL_Uniform::Apply(class BL_Shader *shader)
 #ifdef SORT_UNIFORMS
 	MT_assert(mType > UNI_NONE && mType < UNI_MAX && mData);
 
-	if (!mDirty) 
+	if (!mDirty)
 		return;
 
-	switch(mType)
-	{
-	case UNI_FLOAT: {
+	switch (mType) {
+		case UNI_FLOAT:
+		{
 			float *f = (float*)mData;
 			glUniform1fARB(mLoc,(GLfloat)*f);
-		}break;
-	case UNI_INT: {
+			break;
+		}
+		case UNI_INT:
+		{
 			int *f = (int*)mData;
 			glUniform1iARB(mLoc, (GLint)*f);
-		}break;
-	case UNI_FLOAT2: {
+			break;
+		}
+		case UNI_FLOAT2:
+		{
 			float *f = (float*)mData;
 			glUniform2fvARB(mLoc,1, (GLfloat*)f);
-		}break;
-	case UNI_FLOAT3: {
+			break;
+		}
+		case UNI_FLOAT3:
+		{
 			float *f = (float*)mData;
 			glUniform3fvARB(mLoc,1,(GLfloat*)f);
-		}break;
-	case UNI_FLOAT4: {
+			break;
+		}
+		case UNI_FLOAT4:
+		{
 			float *f = (float*)mData;
 			glUniform4fvARB(mLoc,1,(GLfloat*)f);
-		}break;
-	case UNI_INT2: {
+			break;
+		}
+		case UNI_INT2:
+		{
 			int *f = (int*)mData;
 			glUniform2ivARB(mLoc,1,(GLint*)f);
-		}break; 
-	case UNI_INT3: {
+			break;
+		}
+		case UNI_INT3:
+		{
 			int *f = (int*)mData;
 			glUniform3ivARB(mLoc,1,(GLint*)f);
-		}break; 
-	case UNI_INT4: {
+			break;
+		}
+		case UNI_INT4:
+		{
 			int *f = (int*)mData;
 			glUniform4ivARB(mLoc,1,(GLint*)f);
-		}break;
-	case UNI_MAT4: {
+			break;
+		}
+		case UNI_MAT4:
+		{
 			float *f = (float*)mData;
 			glUniformMatrix4fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f);
-		}break;
-	case UNI_MAT3: {
+			break;
+		}
+		case UNI_MAT3:
+		{
 			float *f = (float*)mData;
 			glUniformMatrix3fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f);
-		}break;
+			break;
+		}
 	}
 	mDirty = false;
 #endif
@@ -157,7 +176,7 @@ BL_Shader::~BL_Shader()
 void BL_Shader::ClearUniforms()
 {
 	BL_UniformVec::iterator it = mUniforms.begin();
-	while(it != mUniforms.end()) {
+	while (it != mUniforms.end()) {
 		delete (*it);
 		it++;
 	}
@@ -165,7 +184,7 @@ void BL_Shader::ClearUniforms()
 
 	
 	BL_UniformVecDef::iterator itp = mPreDef.begin();
-	while(itp != mPreDef.end()) {
+	while (itp != mPreDef.end()) {
 		delete (*itp);
 		itp++;
 	}
@@ -178,7 +197,7 @@ BL_Uniform  *BL_Shader::FindUniform(const int location)
 {
 #ifdef SORT_UNIFORMS
 	BL_UniformVec::iterator it = mUniforms.begin();
-	while(it != mUniforms.end()) {
+	while (it != mUniforms.end()) {
 		if ((*it)->GetLocation() == location)
 			return (*it);
 		it++;
@@ -552,41 +571,39 @@ void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 }
 
 
-int BL_Shader::GetAttribLocation(const STR_String& name)
+int BL_Shader::GetAttribLocation(const char *name)
 {
-	if ( GLEW_ARB_fragment_shader &&
-		GLEW_ARB_vertex_shader &&
-		GLEW_ARB_shader_objects 
-		)
+	if (GLEW_ARB_fragment_shader &&
+	    GLEW_ARB_vertex_shader &&
+	    GLEW_ARB_shader_objects)
 	{
-		return glGetAttribLocationARB(mShader, name.ReadPtr());
+		return glGetAttribLocationARB(mShader, name);
 	}
 
 	return -1;
 }
 
-void BL_Shader::BindAttribute(const STR_String& attr, int loc)
+void BL_Shader::BindAttribute(const char *attr, int loc)
 {
-	if ( GLEW_ARB_fragment_shader &&
-		GLEW_ARB_vertex_shader &&
-		GLEW_ARB_shader_objects 
-		)
+	if (GLEW_ARB_fragment_shader &&
+	    GLEW_ARB_vertex_shader &&
+	    GLEW_ARB_shader_objects )
 	{
-		glBindAttribLocationARB(mShader, loc, attr.ReadPtr());
+		glBindAttribLocationARB(mShader, loc, attr);
 	}
 }
 
-int BL_Shader::GetUniformLocation(const STR_String& name)
+int BL_Shader::GetUniformLocation(const char *name)
 {
 	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
-		GLEW_ARB_shader_objects 
+		GLEW_ARB_shader_objects
 		)
 	{
 		MT_assert(mShader!=0);
-		int location = glGetUniformLocationARB(mShader, name.ReadPtr());
+		int location = glGetUniformLocationARB(mShader, name);
 		if (location == -1)
-			spit("Invalid uniform value: " << name.ReadPtr() << ".");
+			spit("Invalid uniform value: " << name << ".");
 		return location;
 	}
 
@@ -832,7 +849,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
 {
-	return PyLong_FromSsize_t( ( mShader !=0 &&  mOk ) );
+	return PyBool_FromLong(( mShader !=0 &&  mOk ));
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg, "getVertexProg( )" )
@@ -881,7 +898,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
 		Py_RETURN_NONE;
 	}
 
-	const char *uniform="";
+	const char *uniform;
 	int index=-1;
 	if (PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) 
 	{
@@ -922,7 +939,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
 		Py_RETURN_NONE;
 	}
 
-	const char *uniform="";
+	const char *uniform;
 	float value=0;
 	if (PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value ))
 	{
@@ -946,8 +963,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f, "setUniform2f(name, fx, fy)")
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
-	float array[2]={ 0,0 };
+	const char *uniform;
+	float array[2] = {0, 0};
 	if (PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] ))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -970,8 +987,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
-	float array[3]={0,0,0};
+	const char *uniform;
+	float array[3] = {0, 0, 0};
 	if (PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2]))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -995,8 +1012,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) "
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
-	float array[4]={0,0,0,0};
+	const char *uniform;
+	float array[4] = {0, 0, 0, 0};
 	if (PyArg_ParseTuple(args, "sffff:setUniform4f", &uniform, &array[0],&array[1],&array[2], &array[3]))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -1019,7 +1036,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
+	const char *uniform;
 	int value=0;
 	if (PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value ))
 	{
@@ -1043,8 +1060,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i, "setUniform2i(name, ix, iy)")
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
-	int array[2]={ 0,0 };
+	const char *uniform;
+	int array[2] = {0, 0};
 	if (PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] ))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -1068,8 +1085,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
 		Py_RETURN_NONE;
 	}
 
-	const char *uniform="";
-	int array[3]={0,0,0};
+	const char *uniform;
+	int array[3] = {0, 0, 0};
 	if (PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2]))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -1091,8 +1108,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) "
 	if (mError) {
 		Py_RETURN_NONE;
 	}
-	const char *uniform="";
-	int array[4]={0,0,0, 0};
+	const char *uniform;
+	int array[4] = {0, 0, 0, 0};
 	if (PyArg_ParseTuple(args, "siiii:setUniform4i", &uniform, &array[0],&array[1],&array[2], &array[3] ))
 	{
 		int loc = GetUniformLocation(uniform);
@@ -1134,7 +1151,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv, "setUniformfv( float (list2 or list
 					Py_DECREF(item);
 				}
 
-				switch(list_size)
+				switch (list_size)
 				{
 				case 2:
 					{
@@ -1207,7 +1224,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
 	for (unsigned int i=0; (i<list_size && i<4); i++)
 	{
 		PyObject *item = PySequence_GetItem(listPtr, i);
-		array_data[i] = PyLong_AsSsize_t(item);
+		array_data[i] = PyLong_AsLong(item);
 		Py_DECREF(item);
 	}
 	
@@ -1218,7 +1235,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
 	
 	/* Sanity checks done! */
 	
-	switch(list_size)
+	switch (list_size)
 	{
 	case 2:
 		{
@@ -1277,7 +1294,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
 		0,0,0,1
 	};
 
-	const char *uniform="";
+	const char *uniform;
 	PyObject *matrix=0;
 	int transp=0; // python use column major by default, so no transpose....
 	
@@ -1323,7 +1340,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
 		0,0,1,
 	};
 
-	const char *uniform="";
+	const char *uniform;
 	PyObject *matrix=0;
 	int transp=0; // python use column major by default, so no transpose....
 	if (!PyArg_ParseTuple(args, "sO|i:setUniformMatrix3",&uniform, &matrix,&transp))
@@ -1385,24 +1402,23 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" )
 		Py_RETURN_NONE;
 	}
 
-	const char *uniform="";
+	const char *uniform;
 	int nloc=0;
-	if (PyArg_ParseTuple(args, "si:setUniformDef",&uniform, &nloc))
+	if (PyArg_ParseTuple(args, "si:setUniformDef", &uniform, &nloc))
 	{
 		int loc = GetUniformLocation(uniform);
 		if (loc != -1)
 		{
 			bool defined = false;
 			BL_UniformVecDef::iterator it = mPreDef.begin();
-			while(it != mPreDef.end()) {
+			while (it != mPreDef.end()) {
 				if ((*it)->mLoc == loc) {
 					defined = true;
 					break;
 				}
 				it++;
 			}
-			if (defined)
-			{
+			if (defined) {
 				Py_RETURN_NONE;
 			}
 
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index 8247687..243445d 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -205,9 +205,9 @@ public:
 	void SetUniformfv(int location,int type, float *param, int size,bool transpose=false);
 	void SetUniformiv(int location,int type, int *param, int size,bool transpose=false);
 
-	int GetAttribLocation(const STR_String& name);
-	void BindAttribute(const STR_String& attr, int loc);
-	int GetUniformLocation(const STR_String& name);
+	int GetAttribLocation(const char *name);
+	void BindAttribute(const char *attr, int loc);
+	int GetUniformLocation(const char *name);
 
 	void SetUniform(int uniform, const MT_Tuple2& vec);
 	void SetUniform(int uniform, const MT_Tuple3& vec);
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 7196c1e..66423ed 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -109,7 +109,7 @@ bool BL_Texture::InitFromImage(int unit,  Image *img, bool mipmap)
 		return mOk;
 	}
 
-	ibuf= BKE_image_get_ibuf(img, NULL);
+	ibuf= BKE_image_acquire_ibuf(img, NULL, NULL);
 	if (ibuf==NULL)
 	{
 		img->ok = 0;
@@ -128,6 +128,7 @@ bool BL_Texture::InitFromImage(int unit,  Image *img, bool mipmap)
 	if (mTexture != 0) {
 		glBindTexture(GL_TEXTURE_2D, mTexture );
 		Validate();
+		BKE_image_release_ibuf(img, ibuf, NULL);
 		return mOk;
 	}
 
@@ -140,6 +141,7 @@ bool BL_Texture::InitFromImage(int unit,  Image *img, bool mipmap)
 			mTexture = mapLook->second.gl_texture;
 			glBindTexture(GL_TEXTURE_2D, mTexture);
 			mOk = IsValid();
+			BKE_image_release_ibuf(img, ibuf, NULL);
 			return mOk;
 		}
 	}
@@ -166,6 +168,9 @@ bool BL_Texture::InitFromImage(int unit,  Image *img, bool mipmap)
 	glDisable(GL_TEXTURE_2D);
 	ActivateUnit(0);
 	Validate();
+
+	BKE_image_release_ibuf(img, ibuf, NULL);
+
 	return mOk;
 }
 
@@ -251,7 +256,7 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap)
 		return mOk;
 	}
 
-	ImBuf *ibuf= BKE_image_get_ibuf(cubemap->ima, NULL);
+	ImBuf *ibuf= BKE_image_acquire_ibuf(cubemap->ima, NULL, NULL);
 	if (ibuf==0)
 	{
 		cubemap->ima->ok = 0;
@@ -274,6 +279,7 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap)
 			mTexture = mapLook->second.gl_texture;
 			glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mTexture);
 			mOk = IsValid();
+			BKE_image_release_ibuf(cubemap->ima, ibuf, NULL);
 			return mOk;
 		}
 	}
@@ -307,6 +313,7 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap)
 
 		my_free_envmapdata(cubemap);
 		mOk = false;
+		BKE_image_release_ibuf(cubemap->ima, ibuf, NULL);
 		return mOk;
 	}
 
@@ -341,6 +348,9 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap)
 	ActivateUnit(0);
 
 	mOk = IsValid();
+
+	BKE_image_release_ibuf(cubemap->ima, ibuf, NULL);
+
 	return mOk;
 }
 
@@ -562,7 +572,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 		using_alpha = true;
 	}
 
-	switch( mat->blend_mode[mUnit] ) {
+	switch (mat->blend_mode[mUnit]) {
 		case BLEND_MIX:
 			{
 				// ------------------------------
@@ -646,9 +656,11 @@ int BL_Texture::GetPow2(int n)
 void BL_Texture::SplitEnvMap(EnvMap *map)
 {
 	if (!map || !map->ima || (map->ima && !map->ima->ok)) return;
-	ImBuf *ibuf= BKE_image_get_ibuf(map->ima, NULL);
-	if (ibuf)
+	ImBuf *ibuf= BKE_image_acquire_ibuf(map->ima, NULL, NULL);
+	if (ibuf) {
 		my_envmap_split_ima(map, ibuf);
+		BKE_image_release_ibuf(map->ima, ibuf, NULL);
+	}
 }
 
 unsigned int BL_Texture::mDisableState = 0;
@@ -670,7 +682,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 	}
 	else {
 		for (part=0; part<6; part++) {
-			env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect);
+			env->cube[part] = IMB_allocImBuf(dx, dx, 24, IB_rect);
 		}
 		IMB_rectcpy(env->cube[0], ibuf, 
 			0, 0, 0, 0, dx, dx);
@@ -698,7 +710,7 @@ void my_free_envmapdata(EnvMap *env)
 		ImBuf *ibuf= env->cube[part];
 		if (ibuf) {
 			IMB_freeImBuf(ibuf);
-			env->cube[part]= NULL;
+			env->cube[part] = NULL;
 		}
 	}
 	env->ok= 0;
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 269311b..524a38a 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -57,6 +57,7 @@ set(INC
 set(INC_SYS
 	${PTHREADS_INCLUDE_DIRS}
 	${GLEW_INCLUDE_PATH}
+	${BOOST_INCLUDE_DIR}
 	../../../extern/recastnavigation/Recast/Include
 	../../../extern/recastnavigation/Detour/Include
 )
@@ -74,6 +75,7 @@ set(SRC
 	KX_Camera.cpp
 	KX_CameraActuator.cpp
 	KX_CameraIpoSGController.cpp
+	KX_CharacterWrapper.cpp
 	KX_ConstraintActuator.cpp
 	KX_ConstraintWrapper.cpp
 	KX_ConvertPhysicsObjects.cpp
@@ -99,7 +101,6 @@ set(SRC
 	KX_ObstacleSimulation.cpp
 	KX_OrientationInterpolator.cpp
 	KX_ParentActuator.cpp
-	KX_PhysicsObjectWrapper.cpp
 	KX_PolyProxy.cpp
 	KX_PolygonMaterial.cpp
 	KX_PositionInterpolator.cpp
@@ -149,6 +150,7 @@ set(SRC
 	KX_Camera.h
 	KX_CameraActuator.h
 	KX_CameraIpoSGController.h
+	KX_CharacterWrapper.h
 	KX_ClientObjectInfo.h
 	KX_ConstraintActuator.h
 	KX_ConstraintWrapper.h
@@ -181,7 +183,6 @@ set(SRC
 	KX_OrientationInterpolator.h
 	KX_ParentActuator.h
 	KX_PhysicsEngineEnums.h
-	KX_PhysicsObjectWrapper.h
 	KX_PhysicsPropertiesobsolete.h
 	KX_PolyProxy.h
 	KX_PolygonMaterial.h
@@ -248,9 +249,11 @@ endif()
 
 if(WITH_BULLET)
 	list(APPEND INC
-		../../../extern/bullet2/src
 		../Physics/Bullet
 	)
+	list(APPEND INC
+		../../../extern/bullet2/src
+	)
 	add_definitions(-DUSE_BULLET)
 endif()
 
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 2337e95..20c36c2 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -124,7 +124,7 @@ MTFace* KX_BlenderMaterial::GetMTFace(void) const
 unsigned int* KX_BlenderMaterial::GetMCol(void) const 
 {
 	// fonts on polys
-	return mMaterial->rgb;
+	return &mMaterial->m_mcol;
 }
 
 void KX_BlenderMaterial::GetMaterialRGBAColor(unsigned char *rgba) const
@@ -138,6 +138,11 @@ void KX_BlenderMaterial::GetMaterialRGBAColor(unsigned char *rgba) const
 		RAS_IPolyMaterial::GetMaterialRGBAColor(rgba);
 }
 
+bool KX_BlenderMaterial::IsMaterial(const BL_Material *bl_mat) const
+{
+	return (mMaterial == bl_mat);
+}
+
 Material *KX_BlenderMaterial::GetBlenderMaterial() const
 {
 	return mMaterial->material;
@@ -165,11 +170,11 @@ void KX_BlenderMaterial::InitTextures()
 				continue;
 			}
 			if (!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) )
-				spit("unable to initialize image("<<i<<") in "<< 
-						 mMaterial->matname<< ", image will not be available");
-		} 
-		// If we're using glsl materials, the textures are handled by bf_gpu, so don't load them twice!
-		// However, if we're using a custom shader, then we still need to load the textures ourselves.
+				spit("unable to initialize image("<<i<<") in "<<
+				     mMaterial->matname<< ", image will not be available");
+		}
+		/* If we're using glsl materials, the textures are handled by bf_gpu, so don't load them twice!
+		 * However, if we're using a custom shader, then we still need to load the textures ourselves. */
 		else if (!mMaterial->glslmat || mShader) {
 			if ( mMaterial->img[i] ) {
 				if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
@@ -726,7 +731,7 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras)
 	GLenum plane = GL_EYE_PLANE;
 
 	// figure plane gen
-	float proj[4]= {0.f,0.f,0.f,0.f};
+	float proj[4] = {0.f,0.f,0.f,0.f};
 	GetProjPlane(mMaterial, i, 0, proj);
 	glTexGenfv(GL_S, plane, proj);
 	
@@ -837,26 +842,26 @@ PyTypeObject KX_BlenderMaterial::Type = {
 
 PyObject *KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+	KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
 	return self->PygetShader(NULL, NULL);
 }
 
 PyObject *KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
-	return PyLong_FromSsize_t(self->GetMaterialIndex());
+	KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
+	return PyLong_FromLong(self->GetMaterialIndex());
 }
 
 PyObject *KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+	KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
 	unsigned int* bfunc = self->getBlendFunc();
 	return Py_BuildValue("(ll)", (long int)bfunc[0], (long int)bfunc[1]);
 }
 
 int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+	KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
 	PyObject *obj = self->PysetBlending(value, NULL);
 	if (obj)
 	{
@@ -926,7 +931,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
 {
-	return PyLong_FromSsize_t( GetMaterialIndex() );
+	return PyLong_FromLong(GetMaterialIndex());
 }
 
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" )
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 1653669..7bc9c7c 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -76,6 +76,8 @@ public:
 		TCachingInfo& cachingInfo
 	)const;
 
+	/* mMaterial is private, but need this for conversion */
+	bool IsMaterial(const BL_Material *bl_mat) const;
 	Material* GetBlenderMaterial() const;
 	MTFace* GetMTFace(void) const;
 	unsigned int* GetMCol(void) const;
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 9091240..e56dbfd 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -38,19 +38,19 @@
 #include "KX_Python.h"
 #include "KX_PyMath.h"
 KX_Camera::KX_Camera(void* sgReplicationInfo,
-					 SG_Callbacks callbacks,
-					 const RAS_CameraData& camdata,
-					 bool frustum_culling,
-					 bool delete_node)
-					:
-					KX_GameObject(sgReplicationInfo,callbacks),
-					m_camdata(camdata),
-					m_dirty(true),
-					m_normalized(false),
-					m_frustum_culling(frustum_culling),
-					m_set_projection_matrix(false),
-					m_set_frustum_center(false),
-					m_delete_node(delete_node)
+                     SG_Callbacks callbacks,
+                     const RAS_CameraData& camdata,
+                     bool frustum_culling,
+                     bool delete_node)
+    :
+      KX_GameObject(sgReplicationInfo,callbacks),
+      m_camdata(camdata),
+      m_dirty(true),
+      m_normalized(false),
+      m_frustum_culling(frustum_culling),
+      m_set_projection_matrix(false),
+      m_set_frustum_center(false),
+      m_delete_node(delete_node)
 {
 	// setting a name would be nice...
 	m_name = "cam";
@@ -593,7 +593,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
 		MT_Point3 center;
 		if (PyVecTo(pycenter, center))
 		{
-			return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */
+			return PyLong_FromLong(SphereInsideFrustum(center, radius)); /* new ref */
 		}
 	}
 
@@ -644,7 +644,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
 			return NULL;
 	}
 	
-	return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */
+	return PyLong_FromLong(BoxInsideFrustum(box)); /* new ref */
 }
 
 KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
@@ -666,7 +666,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
 	MT_Point3 point;
 	if (PyVecTo(value, point))
 	{
-		return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */
+		return PyLong_FromLong(PointInsideFrustum(point)); /* new ref */
 	}
 	
 	PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument.");
@@ -714,13 +714,13 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, setOnTop,
 
 PyObject *KX_Camera::pyattr_get_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyBool_FromLong(self->m_camdata.m_perspective);
 }
 
 int KX_Camera::pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	int param = PyObject_IsTrue( value );
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.perspective = bool: KX_Camera, expected True/False or 0/1");
@@ -734,13 +734,13 @@ int KX_Camera::pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *at
 
 PyObject *KX_Camera::pyattr_get_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyFloat_FromDouble(self->m_camdata.m_lens);
 }
 
 int KX_Camera::pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	float param = PyFloat_AsDouble(value);
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.lens = float: KX_Camera, expected a float greater then zero");
@@ -754,13 +754,13 @@ int KX_Camera::pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef,
 
 PyObject *KX_Camera::pyattr_get_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyFloat_FromDouble(self->m_camdata.m_scale);
 }
 
 int KX_Camera::pyattr_set_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	float param = PyFloat_AsDouble(value);
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.ortho_scale = float: KX_Camera, expected a float greater then zero");
@@ -774,13 +774,13 @@ int KX_Camera::pyattr_set_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *at
 
 PyObject *KX_Camera::pyattr_get_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyFloat_FromDouble(self->m_camdata.m_clipstart);
 }
 
 int KX_Camera::pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	float param = PyFloat_AsDouble(value);
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.near = float: KX_Camera, expected a float greater then zero");
@@ -794,13 +794,13 @@ int KX_Camera::pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef,
 
 PyObject *KX_Camera::pyattr_get_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyFloat_FromDouble(self->m_camdata.m_clipend);
 }
 
 int KX_Camera::pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	float param = PyFloat_AsDouble(value);
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.far = float: KX_Camera, expected a float greater then zero");
@@ -815,13 +815,13 @@ int KX_Camera::pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, P
 
 PyObject *KX_Camera::pyattr_get_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyBool_FromLong(self->GetViewport());
 }
 
 int KX_Camera::pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	int param = PyObject_IsTrue( value );
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "camera.useViewport = bool: KX_Camera, expected True or False");
@@ -834,13 +834,13 @@ int KX_Camera::pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *a
 
 PyObject *KX_Camera::pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyObjectFrom(self->GetProjectionMatrix()); 
 }
 
 int KX_Camera::pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	MT_Matrix4x4 mat;
 	if (!PyMatTo(value, mat)) 
 		return PY_SET_ATTR_FAIL;
@@ -851,29 +851,29 @@ int KX_Camera::pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_D
 
 PyObject *KX_Camera::pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyObjectFrom(self->GetModelviewMatrix()); 
 }
 
 PyObject *KX_Camera::pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyObjectFrom(self->GetCameraToWorld());
 }
 
 PyObject *KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Camera* self= static_cast<KX_Camera*>(self_v);
+	KX_Camera* self = static_cast<KX_Camera*>(self_v);
 	return PyObjectFrom(self->GetWorldToCamera()); 
 }
 
 
 PyObject *KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{	return PyLong_FromSsize_t(INSIDE); }
+{	return PyLong_FromLong(INSIDE); }
 PyObject *KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{	return PyLong_FromSsize_t(OUTSIDE); }
+{	return PyLong_FromLong(OUTSIDE); }
 PyObject *KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{	return PyLong_FromSsize_t(INTERSECT); }
+{	return PyLong_FromLong(INTERSECT); }
 
 
 bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, const char *error_prefix)
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index 6c1dc1e..f615fef 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -120,7 +120,7 @@ protected:
 	/**
 	 * whether the camera should delete the node itself (only for shadow camera)
 	 */
-	bool		 m_delete_node;
+	bool         m_delete_node;
 
 	/**
 	 * Extracts the camera clip frames from the projection and world-to-camera matrices.
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index 9ca1ec5..59ca0d8 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -143,9 +143,9 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
 	}
 	if (axis==3) {
 		cox= 0; coy= 1; coz= 2;		/* Y op -Z tr */
-		vec[0]= -vec[0];
-		vec[1]= -vec[1];
-		vec[2]= -vec[2];
+		vec[0] = -vec[0];
+		vec[1] = -vec[1];
+		vec[2] = -vec[2];
 	}
 	if (axis==4) {
 		cox= 1; coy= 0; coz= 2;		/*  */
@@ -154,9 +154,9 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
 		cox= 2; coy= 1; coz= 0;		/* Y up X tr */
 	}
 
-	mat[coz][0]= vec[0];
-	mat[coz][1]= vec[1];
-	mat[coz][2]= vec[2];
+	mat[coz][0] = vec[0];
+	mat[coz][1] = vec[1];
+	mat[coz][2] = vec[2];
 	if (normalize_v3((float *)mat[coz]) == 0.f) {
 		/* this is a very abnormal situation: the camera has reach the object center exactly
 		 * We will choose a completely arbitrary direction */
@@ -281,13 +281,13 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 			assert(0);
 			break;
 	}
-	
+
 	inp = fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
 	fac = (-1.0f + inp) * m_damping;
 
-	from[0]+= fac*fp1[0];
-	from[1]+= fac*fp1[1];
-	from[2]+= fac*fp1[2];
+	from[0] += fac * fp1[0];
+	from[1] += fac * fp1[1];
+	from[2] += fac * fp1[2];
 	
 	/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
 	if (inp < 0.0f) {
@@ -303,9 +303,9 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 
 	/* CONSTRAINT 5: minimum / maximum afstand */
 
-	rc[0]= (lookat[0]-from[0]);
-	rc[1]= (lookat[1]-from[1]);
-	rc[2]= (lookat[2]-from[2]);
+	rc[0] = (lookat[0]-from[0]);
+	rc[1] = (lookat[1]-from[1]);
+	rc[2] = (lookat[2]-from[2]);
 	distsq = rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
 
 	if (distsq > maxdistsq) {
@@ -325,9 +325,9 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 
 
 	/* CONSTRAINT 7: track to schaduw */
-	rc[0]= (lookat[0]-from[0]);
-	rc[1]= (lookat[1]-from[1]);
-	rc[2]= (lookat[2]-from[2]);
+	rc[0] = (lookat[0]-from[0]);
+	rc[1] = (lookat[1]-from[1]);
+	rc[2] = (lookat[2]-from[2]);
 	Kx_VecUpMat3(rc, mat, 3);	/* y up Track -z */
 	
 
@@ -337,9 +337,9 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 	
 	obj->NodeSetLocalPosition(from);
 	
-	actormat[0][0]= mat[0][0]; actormat[0][1]= mat[1][0]; actormat[0][2]= mat[2][0];
-	actormat[1][0]= mat[0][1]; actormat[1][1]= mat[1][1]; actormat[1][2]= mat[2][1];
-	actormat[2][0]= mat[0][2]; actormat[2][1]= mat[1][2]; actormat[2][2]= mat[2][2];
+	actormat[0][0] = mat[0][0]; actormat[0][1] = mat[1][0]; actormat[0][2] = mat[2][0];
+	actormat[1][0] = mat[0][1]; actormat[1][1] = mat[1][1]; actormat[1][2] = mat[2][1];
+	actormat[2][0] = mat[0][2]; actormat[2][1] = mat[1][2]; actormat[2][2] = mat[2][2];
 	obj->NodeSetLocalOrientation(actormat);
 
 	return true;
@@ -388,15 +388,15 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
 	KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_minHeight),
 	KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_maxHeight),
 	KX_PYATTRIBUTE_FLOAT_RW("height",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_height),
-	KX_PYATTRIBUTE_SHORT_RW("axis", 0, 3, true, KX_CameraActuator,m_axis),
-	KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object,	pyattr_set_object),
+	KX_PYATTRIBUTE_SHORT_RW("axis", 0, 5, true, KX_CameraActuator, m_axis),
+	KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object, pyattr_set_object),
 	KX_PYATTRIBUTE_FLOAT_RW("damping",0.f,10.f,KX_CameraActuator,m_damping),
 	{NULL}
 };
 
 PyObject *KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_CameraActuator* self= static_cast<KX_CameraActuator*>(self_v);
+	KX_CameraActuator* self = static_cast<KX_CameraActuator*>(self_v);
 	if (self->m_ob==NULL)
 		Py_RETURN_NONE;
 	else
@@ -405,7 +405,7 @@ PyObject *KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUT
 
 int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_CameraActuator* self= static_cast<KX_CameraActuator*>(self_v);
+	KX_CameraActuator* self = static_cast<KX_CameraActuator*>(self_v);
 	KX_GameObject *gameobj;
 	
 	if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_CameraActuator"))
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
new file mode 100644
index 0000000..ce208f3
--- /dev/null
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
@@ -0,0 +1,94 @@
+/** \file gameengine/Ketsji/KX_CharacterWrapper.cpp
+ *  \ingroup ketsji
+ */
+
+
+#include "KX_CharacterWrapper.h"
+#include "PHY_ICharacter.h"
+
+KX_CharacterWrapper::KX_CharacterWrapper(PHY_ICharacter* character) :
+		PyObjectPlus(),
+		m_character(character)
+{
+}
+
+KX_CharacterWrapper::~KX_CharacterWrapper()
+{
+	if (m_character)
+		delete m_character; // We're responsible for the character object!
+}
+
+#ifdef WITH_PYTHON
+
+PyTypeObject KX_CharacterWrapper::Type = {
+	PyVarObject_HEAD_INIT(NULL, 0)
+	"KX_CharacterWrapper",
+	sizeof(PyObjectPlus_Proxy),
+	0,
+	py_base_dealloc,
+	0,
+	0,
+	0,
+	0,
+	py_base_repr,
+	0,0,0,0,0,0,0,0,0,
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+	0,0,0,0,0,0,0,
+	Methods,
+	0,
+	0,
+	&PyObjectPlus::Type,
+	0,0,0,0,0,0,
+	py_base_new
+};
+
+PyAttributeDef KX_CharacterWrapper::Attributes[] = {
+	KX_PYATTRIBUTE_RO_FUNCTION("onGround", KX_CharacterWrapper, pyattr_get_onground),
+	KX_PYATTRIBUTE_RW_FUNCTION("gravity", KX_CharacterWrapper, pyattr_get_gravity, pyattr_set_gravity),
+	{ NULL }	//Sentinel
+};
+
+PyObject *KX_CharacterWrapper::pyattr_get_onground(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+	KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
+
+	return PyBool_FromLong(self->m_character->OnGround());
+}
+
+PyObject *KX_CharacterWrapper::pyattr_get_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+	KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
+
+	return PyFloat_FromDouble(self->m_character->GetGravity());
+}
+
+int KX_CharacterWrapper::pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+	KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
+	double param = PyFloat_AsDouble(value);
+
+	if (param == -1)
+	{
+		PyErr_SetString(PyExc_ValueError, "KX_CharacterWrapper.gravity: expected a float");
+		return PY_SET_ATTR_FAIL;
+	}
+
+	self->m_character->SetGravity((float)param);
+	return PY_SET_ATTR_SUCCESS;
+}
+
+PyMethodDef KX_CharacterWrapper::Methods[] = {
+	KX_PYMETHODTABLE_NOARGS(KX_CharacterWrapper, jump),
+	{NULL,NULL} //Sentinel
+};
+
+KX_PYMETHODDEF_DOC_NOARGS(KX_CharacterWrapper, jump,
+	"jump()\n"
+	"makes the character jump.\n")
+{
+	m_character->Jump();
+
+	Py_RETURN_NONE;
+}
+
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.h b/source/gameengine/Ketsji/KX_CharacterWrapper.h
new file mode 100644
index 0000000..3b0058a
--- /dev/null
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.h
@@ -0,0 +1,35 @@
+
+/** \file KX_CharacterWrapper.h
+ *  \ingroup ketsji
+ */
+
+#ifndef __KX_CHARACTERWRAPPER_H__
+#define __KX_CHARACTERWRAPPER_H__
+
+#include "Value.h"
+#include "PHY_DynamicTypes.h"
+class PHY_ICharacter;
+
+
+///Python interface to character physics
+class	KX_CharacterWrapper : public PyObjectPlus
+{
+	Py_Header
+
+public:
+	KX_CharacterWrapper(PHY_ICharacter* character);
+	virtual ~KX_CharacterWrapper();
+#ifdef WITH_PYTHON
+	KX_PYMETHOD_DOC_NOARGS(KX_CharacterWrapper, jump);
+
+	static PyObject* pyattr_get_onground(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	
+	static PyObject*	pyattr_get_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static int			pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // WITH_PYTHON
+
+private:
+	PHY_ICharacter*			 m_character;
+};
+
+#endif  /* __KX_CHARACTERWRAPPER_H__ */
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index 5727ed2..e09449c 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -52,7 +52,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
 
 PyObject *KX_ConstraintWrapper::PyGetConstraintId()
 {
-	return PyLong_FromSsize_t(m_constraintId);
+	return PyLong_FromLong(m_constraintId);
 }
 
 
@@ -119,7 +119,7 @@ PyAttributeDef KX_ConstraintWrapper::Attributes[] = {
 
 PyObject *KX_ConstraintWrapper::pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_ConstraintWrapper* self= static_cast<KX_ConstraintWrapper*>(self_v);
+	KX_ConstraintWrapper* self = static_cast<KX_ConstraintWrapper*>(self_v);
 	return self->PyGetConstraintId();
 }
 
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index 7769532..ff3c46c 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include "MT_assert.h"
@@ -54,6 +54,7 @@
 #include "KX_MotionState.h" // bridge between motionstate and scenegraph node
 
 extern "C"{
+	#include "BLI_utildefines.h"
 	#include "BKE_DerivedMesh.h"
 }
 
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 87b0cfc..9f530f8 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -1,25 +1,27 @@
 /*
- * -----------------------------------------------------------------------------
+ * ***** BEGIN GPL LICENSE BLOCK *****
  *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
- * http://www.gnu.org/copyleft/lesser.txt.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * Contributor(s): Dalai Felinto
  *
  * This code is originally inspired on some of the ideas and codes from Paul Bourke.
- * Developed as part of a Research and Development project for SAT - La Société des arts technologiques.
- * -----------------------------------------------------------------------------
+ * Developed as part of a Research and Development project for
+ * SAT - La Société des arts technologiques.
+ *
+ * ***** END GPL LICENSE BLOCK *****
  */
 
 /** \file gameengine/Ketsji/KX_Dome.cpp
@@ -94,7 +96,7 @@ KX_Dome::KX_Dome (
 
 	SetViewPort(viewport);
 
-	switch(m_mode) {
+	switch (m_mode) {
 		case DOME_FISHEYE:
 			if (m_angle <= 180) {
 				cubetop.resize(1);
@@ -1620,7 +1622,7 @@ void KX_Dome::Draw(void)
 		glScissor(0,0,warp.imagesize, warp.imagesize);
 	}
 
-	switch(m_mode) {
+	switch (m_mode) {
 		case DOME_FISHEYE:
 			DrawDomeFisheye();
 			break;
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index 17eec3a..3bc90bf 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -1,26 +1,28 @@
 /*
------------------------------------------------------------------------------
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
-
-Contributor(s): Dalai Felinto
-
-This source uses some of the ideas and code from Paul Bourke.
-Developed as part of a Research and Development project for SAT - La Société des arts technologiques.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Dalai Felinto
+ *
+ * This source uses some of the ideas and code from Paul Bourke.
+ * Developed as part of a Research and Development project for
+ * SAT - La Société des arts technologiques.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file KX_Dome.h
  *  \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp
index 9f6ef89..138124f 100644
--- a/source/gameengine/Ketsji/KX_FontObject.cpp
+++ b/source/gameengine/Ketsji/KX_FontObject.cpp
@@ -254,7 +254,7 @@ PyAttributeDef KX_FontObject::Attributes[] = {
 
 PyObject *KX_FontObject::pyattr_get_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_FontObject* self= static_cast<KX_FontObject*>(self_v);
+	KX_FontObject* self = static_cast<KX_FontObject*>(self_v);
 	STR_String str = STR_String();
 	for (int i=0; i<self->m_text.size(); ++i)
 	{
@@ -267,7 +267,7 @@ PyObject *KX_FontObject::pyattr_get_text(void *self_v, const KX_PYATTRIBUTE_DEF
 
 int KX_FontObject::pyattr_set_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_FontObject* self= static_cast<KX_FontObject*>(self_v);
+	KX_FontObject* self = static_cast<KX_FontObject*>(self_v);
 	if (!PyUnicode_Check(value))
 		return PY_SET_ATTR_FAIL;
 	char* chars = _PyUnicode_AsString(value);
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 3cfb670..c7f6954 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -30,6 +30,11 @@
  *  \ingroup ketsji
  */
 
+#ifdef _MSC_VER
+  /* This warning tells us about truncation of __long__ stl-generated names.
+   * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning( disable:4786 )
+#endif
 
 #if defined(_WIN64) && !defined(FREE_WINDOWS64)
 typedef unsigned __int64 uint_ptr;
@@ -37,13 +42,6 @@ typedef unsigned __int64 uint_ptr;
 typedef unsigned long uint_ptr;
 #endif
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
-#endif
-
-
 #define KX_INERTIA_INFINITE 10000
 #include "RAS_IPolygonMaterial.h"
 #include "KX_BlenderMaterial.h"
@@ -101,6 +99,7 @@ KX_GameObject::KX_GameObject(
       m_bSuspendDynamics(false),
       m_bUseObjectColor(false),
       m_bIsNegativeScaling(false),
+      m_objectColor(1.0, 1.0, 1.0, 1.0),
       m_bVisible(true),
       m_bCulled(true),
       m_bOccluder(false),
@@ -230,11 +229,11 @@ STR_String& KX_GameObject::GetName()
 }
 
 
-
+/* Set the name of the value */
 void KX_GameObject::SetName(const char *name)
 {
 	m_name = name;
-};								// Set the name of the value
+}
 
 KX_IPhysicsController* KX_GameObject::GetPhysicsController()
 {
@@ -243,7 +242,7 @@ KX_IPhysicsController* KX_GameObject::GetPhysicsController()
 
 KX_GameObject* KX_GameObject::GetDupliGroupObject()
 { 
-	return m_pDupliGroupObject;	
+	return m_pDupliGroupObject;
 }
 
 CListValue* KX_GameObject::GetInstanceObjects()
@@ -253,11 +252,11 @@ CListValue* KX_GameObject::GetInstanceObjects()
 
 void KX_GameObject::AddInstanceObjects(KX_GameObject* obj)
 {
-	if(!m_pInstanceObjects)
+	if (!m_pInstanceObjects)
 		m_pInstanceObjects = new CListValue();
 
 	obj->AddRef();
-  	m_pInstanceObjects->Add(obj);
+	m_pInstanceObjects->Add(obj);
 }
 
 void KX_GameObject::RemoveInstanceObject(KX_GameObject* obj)
@@ -269,7 +268,7 @@ void KX_GameObject::RemoveInstanceObject(KX_GameObject* obj)
 
 void KX_GameObject::RemoveDupliGroupObject()
 {
-	if(m_pDupliGroupObject) {
+	if (m_pDupliGroupObject) {
 		m_pDupliGroupObject->Release();
 		m_pDupliGroupObject = NULL;
 	}
@@ -533,6 +532,19 @@ void KX_GameObject::ActivateGraphicController(bool recurse)
 	}
 }
 
+void KX_GameObject::SetUserCollisionGroup(short group)
+{
+	m_userCollisionGroup = group;
+}
+void KX_GameObject::SetUserCollisionMask(short mask)
+{
+	m_userCollisionMask = mask;
+}
+
+bool KX_GameObject::CheckCollision(KX_GameObject* other)
+{
+	return this->m_userCollisionGroup & other->m_userCollisionMask;
+}
 
 CValue* KX_GameObject::GetReplica()
 {
@@ -1429,8 +1441,8 @@ static unsigned char mathutils_kxgameob_vector_cb_index= -1; /* index for our ca
 
 static int mathutils_kxgameob_generic_check(BaseMathObject *bmo)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 	
 	return 0;
@@ -1438,13 +1450,13 @@ static int mathutils_kxgameob_generic_check(BaseMathObject *bmo)
 
 static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 
 #define PHYS_ERR(attr) PyErr_SetString(PyExc_AttributeError, "KX_GameObject." attr ", is missing a physics controller")
 
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_VEC_CB_POS_LOCAL:
 			self->NodeGetLocalPosition().getValue(bmo->data);
 			break;
@@ -1490,11 +1502,11 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
 
 static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 	
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_VEC_CB_POS_LOCAL:
 			self->NodeSetLocalPosition(MT_Point3(bmo->data));
 			self->NodeUpdateGS(0.f);
@@ -1549,7 +1561,7 @@ static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype,
 	if (mathutils_kxgameob_vector_get(bmo, subtype) == -1)
 		return -1;
 	
-	bmo->data[index]= f;
+	bmo->data[index] = f;
 	return mathutils_kxgameob_vector_set(bmo, subtype);
 }
 
@@ -1569,11 +1581,11 @@ static unsigned char mathutils_kxgameob_matrix_cb_index= -1; /* index for our ca
 
 static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_MAT_CB_ORI_LOCAL:
 			self->NodeGetLocalOrientation().getValue3x3(bmo->data);
 			break;
@@ -1588,12 +1600,12 @@ static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype)
 
 static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 	
 	MT_Matrix3x3 mat3x3;
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_MAT_CB_ORI_LOCAL:
 			mat3x3.setValue3x3(bmo->data);
 			self->NodeSetLocalOrientation(mat3x3);
@@ -1681,8 +1693,8 @@ PyMethodDef KX_GameObject::Methods[] = {
 PyAttributeDef KX_GameObject::Attributes[] = {
 	KX_PYATTRIBUTE_RO_FUNCTION("name",		KX_GameObject, pyattr_get_name),
 	KX_PYATTRIBUTE_RO_FUNCTION("parent",	KX_GameObject, pyattr_get_parent),
-	KX_PYATTRIBUTE_RO_FUNCTION("group_children",	KX_GameObject, pyattr_get_group_children),
-	KX_PYATTRIBUTE_RO_FUNCTION("group_parent",		KX_GameObject, pyattr_get_group_parent),
+	KX_PYATTRIBUTE_RO_FUNCTION("groupMembers",	KX_GameObject, pyattr_get_group_members),
+	KX_PYATTRIBUTE_RO_FUNCTION("groupObject",	KX_GameObject, pyattr_get_group_object),
 	KX_PYATTRIBUTE_RO_FUNCTION("scene",		KX_GameObject, pyattr_get_scene),
 	KX_PYATTRIBUTE_RO_FUNCTION("life",		KX_GameObject, pyattr_get_life),
 	KX_PYATTRIBUTE_RW_FUNCTION("mass",		KX_GameObject, pyattr_get_mass,		pyattr_set_mass),
@@ -1776,12 +1788,12 @@ PyObject *KX_GameObject::PyReinstancePhysicsMesh(PyObject *args)
 
 static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(item);
 	CValue* resultattr;
 	PyObject *pyconvert;
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "val = gameOb[key]: KX_GameObject, "BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -1810,12 +1822,12 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 
 static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(key);
 	if (attr_str==NULL)
 		PyErr_Clear();
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "gameOb[key] = value: KX_GameObject, "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -1898,9 +1910,9 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 
 static int Seq_Contains(PyObject *self_v, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "val in gameOb: KX_GameObject, "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -1964,13 +1976,13 @@ PyTypeObject KX_GameObject::Type = {
 
 PyObject *KX_GameObject::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyUnicode_From_STR_String(self->GetName());
 }
 
 PyObject *KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_GameObject* parent = self->GetParent();
 	if (parent) {
 		parent->Release(); /* self->GetParent() AddRef's */
@@ -1979,9 +1991,9 @@ PyObject *KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE
 	Py_RETURN_NONE;
 }
 
-PyObject *KX_GameObject::pyattr_get_group_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+PyObject *KX_GameObject::pyattr_get_group_members(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	CListValue* instances = self->GetInstanceObjects();
 	if (instances) {
 		return instances->GetProxy();
@@ -2000,9 +2012,9 @@ PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF
 	Py_RETURN_NONE;
 }
 
-PyObject *KX_GameObject::pyattr_get_group_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+PyObject *KX_GameObject::pyattr_get_group_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_GameObject* pivot = self->GetDupliGroupObject();
 	if (pivot) {
 		return pivot->GetProxy();
@@ -2012,7 +2024,7 @@ PyObject *KX_GameObject::pyattr_get_group_parent(void *self_v, const KX_PYATTRIB
 
 PyObject *KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 
 	CValue *life = self->GetProperty("::timebomb");
 	if (life)
@@ -2025,14 +2037,14 @@ PyObject *KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF
 
 PyObject *KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0);
 }
 
 int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	MT_Scalar val = PyFloat_AsDouble(value);
 	if (val < 0.0) { /* also accounts for non float */
@@ -2048,14 +2060,14 @@ int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrd
 
 PyObject *KX_GameObject::pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	return PyFloat_FromDouble(spc ? spc->GetLinVelocityMin() : 0.0f);
 }
 
 int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	MT_Scalar val = PyFloat_AsDouble(value);
 	if (val < 0.0) { /* also accounts for non float */
@@ -2071,14 +2083,14 @@ int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF
 
 PyObject *KX_GameObject::pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	return PyFloat_FromDouble(spc ? spc->GetLinVelocityMax() : 0.0f);
 }
 
 int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	KX_IPhysicsController *spc = self->GetPhysicsController();
 	MT_Scalar val = PyFloat_AsDouble(value);
 	if (val < 0.0) { /* also accounts for non float */
@@ -2095,13 +2107,13 @@ int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF
 
 PyObject *KX_GameObject::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyBool_FromLong(self->GetVisible());
 }
 
 int KX_GameObject::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	int param = PyObject_IsTrue( value );
 	if (param == -1) {
 		PyErr_SetString(PyExc_AttributeError, "gameOb.visible = bool: KX_GameObject, expected True or False");
@@ -2118,14 +2130,14 @@ PyObject *KX_GameObject::pyattr_get_worldPosition(void *self_v, const KX_PYATTRI
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetWorldPosition());
 #endif
 }
 
 int KX_GameObject::pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Point3 pos;
 	if (!PyVecTo(value, pos))
 		return PY_SET_ATTR_FAIL;
@@ -2140,14 +2152,14 @@ PyObject *KX_GameObject::pyattr_get_localPosition(void *self_v, const KX_PYATTRI
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetLocalPosition());
 #endif
 }
 
 int KX_GameObject::pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Point3 pos;
 	if (!PyVecTo(value, pos))
 		return PY_SET_ATTR_FAIL;
@@ -2162,7 +2174,7 @@ PyObject *KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIB
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	if (self->GetPhysicsController())
 		return PyObjectFrom(self->GetPhysicsController()->GetLocalInertia());
 	return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f);
@@ -2174,14 +2186,14 @@ PyObject *KX_GameObject::pyattr_get_worldOrientation(void *self_v, const KX_PYAT
 #ifdef USE_MATHUTILS
 	return Matrix_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetWorldOrientation());
 #endif
 }
 
 int KX_GameObject::pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	
 	/* if value is not a sequence PyOrientationTo makes an error */
 	MT_Matrix3x3 rot;
@@ -2199,14 +2211,14 @@ PyObject *KX_GameObject::pyattr_get_localOrientation(void *self_v, const KX_PYAT
 #ifdef USE_MATHUTILS
 	return Matrix_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetLocalOrientation());
 #endif
 }
 
 int KX_GameObject::pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	
 	/* if value is not a sequence PyOrientationTo makes an error */
 	MT_Matrix3x3 rot;
@@ -2223,14 +2235,14 @@ PyObject *KX_GameObject::pyattr_get_worldScaling(void *self_v, const KX_PYATTRIB
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetWorldScaling());
 #endif
 }
 
 int KX_GameObject::pyattr_set_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 scale;
 	if (!PyVecTo(value, scale))
 		return PY_SET_ATTR_FAIL;
@@ -2245,14 +2257,14 @@ PyObject *KX_GameObject::pyattr_get_localScaling(void *self_v, const KX_PYATTRIB
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->NodeGetLocalScaling());
 #endif
 }
 
 int KX_GameObject::pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 scale;
 	if (!PyVecTo(value, scale))
 		return PY_SET_ATTR_FAIL;
@@ -2347,14 +2359,14 @@ PyObject *KX_GameObject::pyattr_get_worldLinearVelocity(void *self_v, const KX_P
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_GLOBAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(GetLinearVelocity(false));
 #endif
 }
 
 int KX_GameObject::pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 velocity;
 	if (!PyVecTo(value, velocity))
 		return PY_SET_ATTR_FAIL;
@@ -2369,14 +2381,14 @@ PyObject *KX_GameObject::pyattr_get_localLinearVelocity(void *self_v, const KX_P
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(GetLinearVelocity(true));
 #endif
 }
 
 int KX_GameObject::pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 velocity;
 	if (!PyVecTo(value, velocity))
 		return PY_SET_ATTR_FAIL;
@@ -2391,14 +2403,14 @@ PyObject *KX_GameObject::pyattr_get_worldAngularVelocity(void *self_v, const KX_
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_GLOBAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(GetAngularVelocity(false));
 #endif
 }
 
 int KX_GameObject::pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 velocity;
 	if (!PyVecTo(value, velocity))
 		return PY_SET_ATTR_FAIL;
@@ -2413,14 +2425,14 @@ PyObject *KX_GameObject::pyattr_get_localAngularVelocity(void *self_v, const KX_
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_LOCAL);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(GetAngularVelocity(true));
 #endif
 }
 
 int KX_GameObject::pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector3 velocity;
 	if (!PyVecTo(value, velocity))
 		return PY_SET_ATTR_FAIL;
@@ -2433,7 +2445,7 @@ int KX_GameObject::pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTR
 
 PyObject *KX_GameObject::pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	SG_Node* sg_parent;
 	if (self->GetSGNode() && (sg_parent = self->GetSGNode()->GetSGParent()) != NULL && sg_parent->IsSlowParent()) {
 		return PyFloat_FromDouble(static_cast<KX_SlowParentRelation *>(sg_parent->GetParentRelation())->GetTimeOffset());
@@ -2444,7 +2456,7 @@ PyObject *KX_GameObject::pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUT
 
 int KX_GameObject::pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	if (self->GetSGNode()) {
 		MT_Scalar val = PyFloat_AsDouble(value);
 		SG_Node *sg_parent= self->GetSGNode()->GetSGParent();
@@ -2460,16 +2472,16 @@ int KX_GameObject::pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF
 
 PyObject *KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	int state = 0;
 	state |= self->GetState();
-	return PyLong_FromSsize_t(state);
+	return PyLong_FromLong(state);
 }
 
 int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
-	int state_i = PyLong_AsSsize_t(value);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
+	int state_i = PyLong_AsLong(value);
 	unsigned int state = 0;
 	
 	if (state_i == -1 && PyErr_Occurred()) {
@@ -2488,7 +2500,7 @@ int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attr
 
 PyObject *KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	PyObject *meshes= PyList_New(self->m_meshes.size());
 	int i;
 	
@@ -2506,14 +2518,14 @@ PyObject *KX_GameObject::pyattr_get_obcolor(void *self_v, const KX_PYATTRIBUTE_D
 #ifdef USE_MATHUTILS
 	return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 4, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_OBJECT_COLOR);
 #else
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return PyObjectFrom(self->GetObjectColor());
 #endif
 }
 
 int KX_GameObject::pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	MT_Vector4 obcolor;
 	if (!PyVecTo(value, obcolor))
 		return PY_SET_ATTR_FAIL;
@@ -2541,19 +2553,19 @@ PyObject *KX_GameObject::pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE
 
 PyObject *KX_GameObject::pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return self->GetChildren()->NewProxy(true);
 }
 
 PyObject *KX_GameObject::pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	return self->GetChildrenRecursive()->NewProxy(true);
 }
 
 PyObject *KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+	KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
 	
 	if (self->m_attr_dict==NULL)
 		self->m_attr_dict= PyDict_New();
@@ -2885,7 +2897,7 @@ PyObject *KX_GameObject::PyGetPhysicsId()
 	{
 		physid= (uint_ptr)ctrl->GetUserData();
 	}
-	return PyLong_FromSsize_t((long)physid);
+	return PyLong_FromLong((long)physid);
 }
 
 PyObject *KX_GameObject::PyGetPropertyNames()
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 52fc3da..e71af67 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -33,9 +33,9 @@
 #ifndef __KX_GAMEOBJECT_H__
 #define __KX_GAMEOBJECT_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo
-#pragma warning (disable : 4355) 
+#ifdef _MSC_VER
+   /* get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo */
+#  pragma warning (disable:4355)
 #endif 
 
 #include <stddef.h>
@@ -98,6 +98,10 @@ protected:
 	bool								m_bIsNegativeScaling;
 	MT_Vector4							m_objectColor;
 
+	// Bit fields for user control over physics collisions
+	short								m_userCollisionGroup;
+	short								m_userCollisionMask;
+
 	// visible = user setting
 	// culled = while rendering, depending on camera
 	bool       							m_bVisible; 
@@ -116,11 +120,11 @@ protected:
 
 	KX_ObstacleSimulation*				m_pObstacleSimulation;
 
-	CListValue*						m_pInstanceObjects;
+	CListValue*							m_pInstanceObjects;
 	KX_GameObject*						m_pDupliGroupObject;
 
 	// The action manager is used to play/stop/update actions
-	BL_ActionManager*				m_actionManager;
+	BL_ActionManager*					m_actionManager;
 
 	BL_ActionManager* GetActionManager();
 	
@@ -221,11 +225,11 @@ public:
 	GetInstanceObjects(
 	);
 
-		void	
+		void
 	SetDupliGroupObject(KX_GameObject*
 	);
 
-		void				
+		void
 	AddInstanceObjects(KX_GameObject*
 	);
 		
@@ -494,6 +498,13 @@ public:
 	 */
 	void ActivateGraphicController(bool recurse);
 
+	void SetUserCollisionGroup(short filter);
+	void SetUserCollisionMask(short mask);
+	/**
+	* Extra broadphase check for user controllable collisions
+	*/
+	bool CheckCollision(KX_GameObject *other);
+
 	/**
 	 * \section Coordinate system manipulation functions
 	 */
@@ -978,8 +989,8 @@ public:
 	static PyObject*	pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject*	pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 
-	static PyObject*	pyattr_get_group_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-	static PyObject*	pyattr_get_group_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static PyObject*	pyattr_get_group_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static PyObject*	pyattr_get_group_members(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject*	pyattr_get_scene(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 
 	static PyObject*	pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_IPOTransform.h b/source/gameengine/Ketsji/KX_IPOTransform.h
index 43019f3..a68292b 100644
--- a/source/gameengine/Ketsji/KX_IPOTransform.h
+++ b/source/gameengine/Ketsji/KX_IPOTransform.h
@@ -48,8 +48,8 @@ public:
 
 	MT_Transform         GetTransform() const {
 		return MT_Transform(m_position + m_deltaPosition,
-							MT_Matrix3x3(m_eulerAngles + m_deltaEulerAngles,
-										 m_scaling + m_deltaScaling));
+		                    MT_Matrix3x3(m_eulerAngles + m_deltaEulerAngles,
+		                                 m_scaling + m_deltaScaling));
 	}
 
 	MT_Point3&	         GetPosition()          { return m_position; 	}
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index 950e3c8..c5e1119 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -37,10 +37,10 @@ typedef unsigned __int64 uint_ptr;
 typedef unsigned long uint_ptr;
 #endif
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+   /* This warning tells us about truncation of __long__ stl-generated names.
+    * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning(disable:4786)
 #endif
 
 #include "KX_IPO_SGController.h"
@@ -52,7 +52,7 @@ typedef unsigned long uint_ptr;
 
 // All objects should start on frame 1! Will we ever need an object to 
 // start on another frame, the 1.0 should change.
-KX_IpoSGController::KX_IpoSGController() 
+KX_IpoSGController::KX_IpoSGController()
 : m_ipo_as_force(false),
   m_ipo_add(false),
   m_ipo_local(false),
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 5ea7a2e..1597d7f 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -455,13 +455,13 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
 
 PyObject *KX_IpoActuator::pyattr_get_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+	KX_IpoActuator* self = static_cast<KX_IpoActuator*>(self_v);
 	return PyFloat_FromDouble(self->m_startframe);
 }
 
 int KX_IpoActuator::pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+	KX_IpoActuator* self = static_cast<KX_IpoActuator*>(self_v);
 	float param = PyFloat_AsDouble(value);
 
 	if (PyErr_Occurred()) {
@@ -476,13 +476,13 @@ int KX_IpoActuator::pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DE
 
 PyObject *KX_IpoActuator::pyattr_get_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+	KX_IpoActuator* self = static_cast<KX_IpoActuator*>(self_v);
 	return PyFloat_FromDouble(self->m_endframe);
 }
 
 int KX_IpoActuator::pyattr_set_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+	KX_IpoActuator* self = static_cast<KX_IpoActuator*>(self_v);
 	float param = PyFloat_AsDouble(value);
 
 	if (PyErr_Occurred()) {
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index e446e53..a12e12c 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -30,10 +30,9 @@
  *  \ingroup ketsji
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include <iostream>
 #include <stdio.h>
@@ -46,7 +45,6 @@
 #include "BoolValue.h"
 #include "FloatValue.h"
 
-#define KX_NUM_ITERATIONS 4
 #include "RAS_BucketManager.h"
 #include "RAS_Rect.h"
 #include "RAS_IRasterizer.h"
@@ -336,8 +334,7 @@ void KX_KetsjiEngine::RenderDome()
 			
 			// Draw the scene once for each camera with an enabled viewport
 			list<KX_Camera*>::iterator it = cameras->begin();
-			while(it != cameras->end())
-			{
+			while (it != cameras->end()) {
 				if ((*it)->GetViewport())
 				{
 					if (scene->IsClearingZBuffer())
@@ -537,29 +534,27 @@ bool KX_KetsjiEngine::NextFrame()
 {
 	double timestep = 1.0/m_ticrate;
 	double framestep = timestep;
-//	static hidden::Clock sClock;
+	//	static hidden::Clock sClock;
 
-m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(),true);
+	m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(),true);
 
-//float dt = sClock.getTimeMicroseconds() * 0.000001f;
-//sClock.reset();
-
-if (m_bFixedTime)
-	m_clockTime += timestep;
-else
-{
+	//float dt = sClock.getTimeMicroseconds() * 0.000001f;
+	//sClock.reset();
 
-//	m_clockTime += dt;
-	m_clockTime = m_kxsystem->GetTimeInSeconds();
-}
+	if (m_bFixedTime) {
+		m_clockTime += timestep;
+	}
+	else {
+		// m_clockTime += dt;
+		m_clockTime = m_kxsystem->GetTimeInSeconds();
+	}
 	
 	double deltatime = m_clockTime - m_frameTime;
 	if (deltatime<0.f)
 	{
-		printf("problem with clock\n");
-		deltatime = 0.f;
-		m_clockTime = 0.f;
-		m_frameTime = 0.f;
+		// We got here too quickly, which means there is nothing todo, just return and don't render.
+		// Not sure if this is the best fix, but it seems to stop the jumping framerate issue (#33088)
+		return false;
 	}
 
 
@@ -891,8 +886,7 @@ void KX_KetsjiEngine::Render()
 		
 		// Draw the scene once for each camera with an enabled viewport
 		list<KX_Camera*>::iterator it = cameras->begin();
-		while(it != cameras->end())
-		{
+		while (it != cameras->end()) {
 			if ((*it)->GetViewport())
 			{
 				if (scene->IsClearingZBuffer())
@@ -941,8 +935,7 @@ void KX_KetsjiEngine::Render()
 	
 			// Draw the scene once for each camera with an enabled viewport
 			list<KX_Camera*>::iterator it = cameras->begin();
-			while(it != cameras->end())
-			{
+			while (it != cameras->end()) {
 				if ((*it)->GetViewport())
 				{
 					if (scene->IsClearingZBuffer())
@@ -1329,8 +1322,7 @@ void KX_KetsjiEngine::RenderFonts(KX_Scene* scene)
 	list<class KX_FontObject*>* fonts = scene->GetFonts();
 	
 	list<KX_FontObject*>::iterator it = fonts->begin();
-	while(it != fonts->end())
-	{
+	while (it != fonts->end()) {
 		(*it)->DrawText();
 		++it;
 	}
@@ -1442,8 +1434,17 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene)
 void KX_KetsjiEngine::RenderDebugProperties()
 {
 	STR_String debugtxt;
-	int xcoord = 10;	// mmmm, these constants were taken from blender source
-	int ycoord = 14;	// to 'mimic' behavior
+	int title_xmargin = -7;
+	int title_y_top_margin = 4;
+	int title_y_bottom_margin = 2;
+
+	int const_xindent = 4;
+	int const_ysize = 14;
+
+	int xcoord = 12;	// mmmm, these constants were taken from blender source
+	int ycoord = 17;	// to 'mimic' behavior
+	
+	int profile_indent = 64;
 
 	float tottime = m_logger->GetAverage();
 	if (tottime < 1e-6f) {
@@ -1454,19 +1455,44 @@ void KX_KetsjiEngine::RenderDebugProperties()
 	RAS_Rect viewport;
 	m_canvas->SetViewPort(0, 0, int(m_canvas->GetWidth()), int(m_canvas->GetHeight()));
 	
+	if (m_show_framerate || m_show_profile)	{
+		/* Title for profiling("Profile") */
+		debugtxt.Format("Profile");
+		m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+									debugtxt.Ptr(),
+									xcoord + const_xindent + title_xmargin, // Adds the constant x indent (0 for now) to the title x margin
+									ycoord,
+									m_canvas->GetWidth() /* RdV, TODO ?? */,
+									m_canvas->GetHeight() /* RdV, TODO ?? */);
+
+		// Increase the indent by default increase
+		ycoord += const_ysize;
+		// Add the title indent afterwards
+		ycoord += title_y_bottom_margin;
+	}
+
 	/* Framerate display */
 	if (m_show_framerate) {
-		debugtxt.Format("swap : %.3f (%.3f frames per second)", tottime, 1.0/tottime);
+		debugtxt.Format("Frametime :");
 		m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, 
 									debugtxt.Ptr(),
-									xcoord,
+									xcoord + const_xindent,
 									ycoord, 
-									m_canvas->GetWidth() /* RdV, TODO ?? */, 
+									m_canvas->GetWidth() /* RdV, TODO ?? */,
 									m_canvas->GetHeight() /* RdV, TODO ?? */);
-		ycoord += 14;
+		
+		debugtxt.Format("%5.1fms (%5.1f fps)", tottime * 1000.f, 1.0/tottime);
+		m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, 
+									debugtxt.Ptr(),
+									xcoord + const_xindent + profile_indent,
+									ycoord,
+									m_canvas->GetWidth() /* RdV, TODO ?? */,
+									m_canvas->GetHeight() /* RdV, TODO ?? */);
+		// Increase the indent by default increase
+		ycoord += const_ysize;
 	}
 
-	/* Profile and framerate display */
+	/* Profile display */
 	if (m_show_profile)
 	{
 		for (int j = tc_first; j < tc_numCategories; j++)
@@ -1474,23 +1500,43 @@ void KX_KetsjiEngine::RenderDebugProperties()
 			debugtxt.Format(m_profileLabels[j]);
 			m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
 			                            debugtxt.Ptr(),
-			                            xcoord,ycoord,
+			                            xcoord + const_xindent,
+										ycoord,
 			                            m_canvas->GetWidth(),
 			                            m_canvas->GetHeight());
+
 			double time = m_logger->GetAverage((KX_TimeCategory)j);
-			debugtxt.Format("%.3fms (%2.2f %%)", time*1000.f, time/tottime * 100.f);
+
+			debugtxt.Format("%5.2fms (%2d%%)", time*1000.f, (int)(time/tottime * 100.f));
 			m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
 			                            debugtxt.Ptr(),
-			                            xcoord + 60, ycoord,
+			                            xcoord + const_xindent + profile_indent, ycoord,
 			                            m_canvas->GetWidth(),
 			                            m_canvas->GetHeight());
-			ycoord += 14;
+			ycoord += const_ysize;
 		}
 	}
+	// Add the ymargin for titles below the other section of debug info
+	ycoord += title_y_top_margin;
 
 	/* Property display*/
 	if (m_show_debug_properties && m_propertiesPresent)
 	{
+
+		/* Title for debugging("Debug properties") */
+		debugtxt.Format("Debug Properties");
+		m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, 
+									debugtxt.Ptr(),
+									xcoord + const_xindent + title_xmargin, // Adds the constant x indent (0 for now) to the title x margin
+									ycoord, 
+									m_canvas->GetWidth() /* RdV, TODO ?? */, 
+									m_canvas->GetHeight() /* RdV, TODO ?? */);
+
+		// Increase the indent by default increase
+		ycoord += const_ysize;
+		// Add the title indent afterwards
+		ycoord += title_y_bottom_margin;
+
 		KX_SceneList::iterator sceneit;
 		for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++)
 		{
@@ -1525,11 +1571,11 @@ void KX_KetsjiEngine::RenderDebugProperties()
 					}
 					m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, 
 													debugtxt.Ptr(),
-													xcoord,
+													xcoord + const_xindent,
 													ycoord,
 													m_canvas->GetWidth(),
 													m_canvas->GetHeight());
-					ycoord += 14;
+					ycoord += const_ysize;
 				}
 				else
 				{
@@ -1537,14 +1583,14 @@ void KX_KetsjiEngine::RenderDebugProperties()
 					if (propval)
 					{
 						STR_String text = propval->GetText();
-						debugtxt = objname + "." + propname + " = " + text;
+						debugtxt = objname + ": '" + propname + "' = " + text;
 						m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, 
 													debugtxt.Ptr(),
-													xcoord,
+													xcoord + const_xindent,
 													ycoord,
 													m_canvas->GetWidth(),
 													m_canvas->GetHeight());
-						ycoord += 14;
+						ycoord += const_ysize;
 					}
 				}
 			}
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index 8b80daa..cf58d18 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include <stdio.h>
@@ -50,9 +50,9 @@
 #include "GPU_material.h"
  
 KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
-							   class RAS_IRenderTools* rendertools,
-							   const RAS_LightObject&	lightobj,
-							   bool glsl)
+                               class RAS_IRenderTools* rendertools,
+                               const RAS_LightObject&	lightobj,
+                               bool glsl)
 	: KX_GameObject(sgReplicationInfo,callbacks),
 	  m_rendertools(rendertools)
 {
@@ -126,14 +126,14 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 		vec[0] = worldmatrix(0,2);
 		vec[1] = worldmatrix(1,2);
 		vec[2] = worldmatrix(2,2);
-		//vec[0]= base->object->obmat[2][0];
-		//vec[1]= base->object->obmat[2][1];
-		//vec[2]= base->object->obmat[2][2];
-		vec[3]= 0.0;
+		//vec[0] = base->object->obmat[2][0];
+		//vec[1] = base->object->obmat[2][1];
+		//vec[2] = base->object->obmat[2][2];
+		vec[3] = 0.0;
 		glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); 
 	}
 	else {
-		//vec[3]= 1.0;
+		//vec[3] = 1.0;
 		glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); 
 		glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0);
 		glLightf((GLenum)(GL_LIGHT0+slot), GL_LINEAR_ATTENUATION, m_lightobj.m_att1/m_lightobj.m_distance);
@@ -145,9 +145,9 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 			vec[0] = -worldmatrix(0,2);
 			vec[1] = -worldmatrix(1,2);
 			vec[2] = -worldmatrix(2,2);
-			//vec[0]= -base->object->obmat[2][0];
-			//vec[1]= -base->object->obmat[2][1];
-			//vec[2]= -base->object->obmat[2][2];
+			//vec[0] = -base->object->obmat[2][0];
+			//vec[1] = -base->object->obmat[2][1];
+			//vec[2] = -base->object->obmat[2][2];
 			glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPOT_DIRECTION, vec);
 			glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, m_lightobj.m_spotsize / 2.0f);
 			glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0f * m_lightobj.m_spotblend);
@@ -161,10 +161,10 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 		vec[0] = vec[1] = vec[2] = vec[3] = 0.0;
 	}
 	else {
-		vec[0]= m_lightobj.m_energy*m_lightobj.m_red;
-		vec[1]= m_lightobj.m_energy*m_lightobj.m_green;
-		vec[2]= m_lightobj.m_energy*m_lightobj.m_blue;
-		vec[3]= 1.0;
+		vec[0] = m_lightobj.m_energy*m_lightobj.m_red;
+		vec[1] = m_lightobj.m_energy*m_lightobj.m_green;
+		vec[2] = m_lightobj.m_energy*m_lightobj.m_blue;
+		vec[3] = 1.0;
 	}
 
 	glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec);
@@ -173,10 +173,10 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 		vec[0] = vec[1] = vec[2] = vec[3] = 0.0;
 	}
 	else if (m_lightobj.m_nodiffuse) {
-		vec[0]= m_lightobj.m_energy*m_lightobj.m_red;
-		vec[1]= m_lightobj.m_energy*m_lightobj.m_green;
-		vec[2]= m_lightobj.m_energy*m_lightobj.m_blue;
-		vec[3]= 1.0;
+		vec[0] = m_lightobj.m_energy*m_lightobj.m_red;
+		vec[1] = m_lightobj.m_energy*m_lightobj.m_green;
+		vec[2] = m_lightobj.m_energy*m_lightobj.m_blue;
+		vec[3] = 1.0;
 	}
 
 	glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPECULAR, vec);
@@ -372,11 +372,11 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
 	const char* type = attrdef->m_name;
 
 	if (!strcmp(type, "SPOT")) {
-		retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
+		retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SPOT);
 	} else if (!strcmp(type, "SUN")) {
-		retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
+		retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SUN);
 	} else if (!strcmp(type, "NORMAL")) {
-		retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
+		retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_NORMAL);
 	}
 	else {
 		/* should never happen */
@@ -390,19 +390,19 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
 PyObject *KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
 	KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-	return PyLong_FromSsize_t(self->m_lightobj.m_type);
+	return PyLong_FromLong(self->m_lightobj.m_type);
 }
 
 int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
 	KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-	int val = PyLong_AsSsize_t(value);
+	const int val = PyLong_AsLong(value);
 	if ((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
 		PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
 		return PY_SET_ATTR_FAIL;
 	}
 	
-	switch(val) {
+	switch (val) {
 		case 0:
 			self->m_lightobj.m_type = self->m_lightobj.LIGHT_SPOT;
 			break;
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 8451dc3..d83e98d 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -70,13 +70,15 @@ PyTypeObject KX_MeshProxy::Type = {
 };
 
 PyMethodDef KX_MeshProxy::Methods[] = {
-{"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS},
-{"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS},
-{"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS},
-{"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS},
-{"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS},
-//{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS},
-  {NULL,NULL} //Sentinel
+	{"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS},
+	{"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS},
+	{"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS},
+	{"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS},
+	{"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS},
+	{"transform", (PyCFunction)KX_MeshProxy::sPyTransform,METH_VARARGS},
+	{"transformUV", (PyCFunction)KX_MeshProxy::sPyTransformUV,METH_VARARGS},
+	//{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS},
+	{NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_MeshProxy::Attributes[] = {
@@ -170,7 +172,7 @@ PyObject *KX_MeshProxy::PyGetVertexArrayLength(PyObject *args, PyObject *kwds)
 			length = m_meshobj->NumVertices(mat);
 	}
 	
-	return PyLong_FromSsize_t(length);
+	return PyLong_FromLong(length);
 }
 
 
@@ -218,9 +220,163 @@ PyObject *KX_MeshProxy::PyGetPolygon(PyObject *args, PyObject *kwds)
 	return polyob;
 }
 
+PyObject *KX_MeshProxy::PyTransform(PyObject *args, PyObject *kwds)
+{
+	int matindex;
+	PyObject *pymat;
+	bool ok = false;
+
+	MT_Matrix4x4 transform;
+
+	if (!PyArg_ParseTuple(args,"iO:transform", &matindex, &pymat) ||
+	    !PyMatTo(pymat, transform))
+	{
+		return NULL;
+	}
+
+	MT_Matrix4x4 ntransform = transform.inverse().transposed();
+	ntransform[0][3] = ntransform[1][3] = ntransform[2][3] = 0.0f;
+
+	/* transform mesh verts */
+	unsigned int mit_index = 0;
+	for (list<RAS_MeshMaterial>::iterator mit = m_meshobj->GetFirstMaterial();
+	     (mit != m_meshobj->GetLastMaterial());
+	     ++mit, ++mit_index)
+	{
+		if (matindex == -1) {
+			/* always transform */
+		}
+		else if (matindex == mit_index) {
+			/* we found the right index! */
+		}
+		else {
+			continue;
+		}
+
+		RAS_MeshSlot *slot = mit->m_baseslot;
+		RAS_MeshSlot::iterator it;
+		ok = true;
+
+		for (slot->begin(it); !slot->end(it); slot->next(it)) {
+			size_t i;
+			for (i = it.startvertex; i < it.endvertex; i++) {
+				RAS_TexVert *vert = &it.vertex[i];
+				vert->Transform(transform, ntransform);
+			}
+		}
+
+		/* if we set a material index, quit when done */
+		if (matindex == mit_index) {
+			break;
+		}
+	}
+
+	if (ok == false) {
+		PyErr_Format(PyExc_ValueError,
+		             "mesh.transform(...): invalid material index %d", matindex);
+		return NULL;
+	}
+
+	m_meshobj->SetMeshModified(true);
+
+	Py_RETURN_NONE;
+}
+
+PyObject *KX_MeshProxy::PyTransformUV(PyObject *args, PyObject *kwds)
+{
+	int matindex;
+	PyObject *pymat;
+	int uvindex = -1;
+	int uvindex_from = -1;
+	bool ok = false;
+
+	MT_Matrix4x4 transform;
+
+	if (!PyArg_ParseTuple(args,"iO|iii:transformUV", &matindex, &pymat, &uvindex, &uvindex_from) ||
+	    !PyMatTo(pymat, transform))
+	{
+		return NULL;
+	}
+
+	if (uvindex < -1 || uvindex > 1) {
+		PyErr_Format(PyExc_ValueError,
+		             "mesh.transformUV(...): invalid uv_index %d", uvindex);
+		return NULL;
+	}
+	if (uvindex_from < -1 || uvindex_from > 1 || uvindex == -1) {
+		PyErr_Format(PyExc_ValueError,
+		             "mesh.transformUV(...): invalid uv_index_from %d", uvindex);
+		return NULL;
+	}
+	if (uvindex_from == uvindex) {
+		uvindex_from = -1;
+	}
+
+	/* transform mesh verts */
+	unsigned int mit_index = 0;
+	for (list<RAS_MeshMaterial>::iterator mit = m_meshobj->GetFirstMaterial();
+	     (mit != m_meshobj->GetLastMaterial());
+	     ++mit, ++mit_index)
+	{
+		if (matindex == -1) {
+			/* always transform */
+		}
+		else if (matindex == mit_index) {
+			/* we found the right index! */
+		}
+		else {
+			continue;
+		}
+
+		RAS_MeshSlot *slot = mit->m_baseslot;
+		RAS_MeshSlot::iterator it;
+		ok = true;
+
+		for (slot->begin(it); !slot->end(it); slot->next(it)) {
+			size_t i;
+
+			for (i = it.startvertex; i < it.endvertex; i++) {
+				RAS_TexVert *vert = &it.vertex[i];
+				if (uvindex_from != -1) {
+					if (uvindex_from == 0) vert->SetUV2(vert->getUV1());
+					else                   vert->SetUV1(vert->getUV2());
+				}
+
+				switch (uvindex) {
+					case 0:
+						vert->TransformUV1(transform);
+						break;
+					case 1:
+						vert->TransformUV2(transform);
+						break;
+					case -1:
+						vert->TransformUV1(transform);
+						vert->TransformUV2(transform);
+						break;
+				}
+			}
+		}
+
+		/* if we set a material index, quit when done */
+		if (matindex == mit_index) {
+			break;
+		}
+	}
+
+	if (ok == false) {
+		PyErr_Format(PyExc_ValueError,
+		             "mesh.transformUV(...): invalid material index %d", matindex);
+		return NULL;
+	}
+
+	m_meshobj->SetMeshModified(true);
+
+	Py_RETURN_NONE;
+}
+
 PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MeshProxy* self= static_cast<KX_MeshProxy*>(self_v);
+	KX_MeshProxy* self = static_cast<KX_MeshProxy*>(self_v);
 	
 	int tot= self->m_meshobj->NumMaterials();
 	int i;
@@ -239,7 +395,7 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
 			KX_BlenderMaterial *mat = static_cast<KX_BlenderMaterial*>(polymat); 	 
 			PyList_SET_ITEM(materials, i, mat->GetProxy());
 		}
-		else { 	
+		else {
 			KX_PolygonMaterial *mat = static_cast<KX_PolygonMaterial*>(polymat);
 			PyList_SET_ITEM(materials, i, mat->GetProxy());
 		}
@@ -250,13 +406,13 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
 PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
 {
 	KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
-	return PyLong_FromSsize_t(self->m_meshobj->NumMaterials());
+	return PyLong_FromLong(self->m_meshobj->NumMaterials());
 }
 
 PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
 {
 	KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
-	return PyLong_FromSsize_t(self->m_meshobj->NumPolygons());
+	return PyLong_FromLong(self->m_meshobj->NumPolygons());
 }
 
 /* a close copy of ConvertPythonToGameObject but for meshes */
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h
index 98e73aa..5366634 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.h
+++ b/source/gameengine/Ketsji/KX_MeshProxy.h
@@ -71,8 +71,10 @@ public:
 	KX_PYMETHOD(KX_MeshProxy,GetVertexArrayLength);
 	KX_PYMETHOD(KX_MeshProxy,GetVertex);
 	KX_PYMETHOD(KX_MeshProxy,GetPolygon);
+	KX_PYMETHOD(KX_MeshProxy,Transform);
+	KX_PYMETHOD(KX_MeshProxy,TransformUV);
 	
-	static PyObject*	pyattr_get_materials(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static PyObject *pyattr_get_materials(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject *pyattr_get_numMaterials(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
 	static PyObject *pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
 };
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index 3251cc4..9368bc6 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -30,11 +30,10 @@
  *  \ingroup ketsji
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// This warning tells us about truncation of __long__ stl-generated names.
-// It can occasionally cause DevStudio to have internal compiler warnings.
-#pragma warning( disable : 4786 )     
+#ifdef _MSC_VER
+  /* This warning tells us about truncation of __long__ stl-generated names.
+   * It can occasionally cause DevStudio to have internal compiler warnings. */
+#  pragma warning(disable:4786)
 #endif
 
 #include "MT_Point3.h"
@@ -60,14 +59,14 @@
 /* ------------------------------------------------------------------------- */
 
 KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr, 
-										 int startx,
-										 int starty,
-										 short int mousemode,
-										 int focusmode,
-										 bool bTouchPulse,
-										 KX_Scene* kxscene,
-										 KX_KetsjiEngine *kxengine,
-										 SCA_IObject* gameobj)
+                                         int startx,
+                                         int starty,
+                                         short int mousemode,
+                                         int focusmode,
+                                         bool bTouchPulse,
+                                         KX_Scene* kxscene,
+                                         KX_KetsjiEngine *kxengine,
+                                         SCA_IObject* gameobj)
 	: SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj),
 	  m_focusmode(focusmode),
 	  m_bTouchPulse(bTouchPulse),
@@ -142,7 +141,7 @@ bool KX_MouseFocusSensor::RayHit(KX_ClientObjectInfo* client_info, KX_RayCast* r
 	KX_GameObject* hitKXObj = client_info->m_gameobject;
 	
 	/* Is this me? In the ray test, there are a lot of extra checks
-	 * for aliasing artefacts from self-hits. That doesn't happen
+	 * for aliasing artifacts from self-hits. That doesn't happen
 	 * here, so a simple test suffices. Or does the camera also get
 	 * self-hits? (No, and the raysensor shouldn't do it either, since
 	 * self-hits are excluded by setting the correct ignore-object.)
@@ -309,8 +308,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus()
 	list<class KX_Camera*>* cameras = m_kxscene->GetCameras();
 	list<KX_Camera*>::iterator it = cameras->begin();
 	
-	while(it != cameras->end())
-	{
+	while (it != cameras->end()) {
 		if (((*it) != cam) && (*it)->GetViewport())
 			if (ParentObjectHasFocusCamera(*it))
 				return true;
@@ -394,19 +392,19 @@ PyAttributeDef KX_MouseFocusSensor::Attributes[] = {
 /* Attributes */
 PyObject *KX_MouseFocusSensor::pyattr_get_ray_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	return PyObjectFrom(self->RaySource());
 }
 
 PyObject *KX_MouseFocusSensor::pyattr_get_ray_target(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	return PyObjectFrom(self->RayTarget());
 }
 
 PyObject *KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	MT_Vector3 dir = self->RayTarget() - self->RaySource();
 	if (MT_fuzzyZero(dir))	dir.setValue(0,0,0);
 	else					dir.normalize();
@@ -415,7 +413,7 @@ PyObject *KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_P
 
 PyObject *KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	
 	if (self->m_hitObject)
 		return self->m_hitObject->GetProxy();
@@ -425,19 +423,19 @@ PyObject *KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYAT
 
 PyObject *KX_MouseFocusSensor::pyattr_get_hit_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	return PyObjectFrom(self->HitPosition());
 }
 
 PyObject *KX_MouseFocusSensor::pyattr_get_hit_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	return PyObjectFrom(self->HitNormal());
 }
 
 PyObject *KX_MouseFocusSensor::pyattr_get_hit_uv(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
+	KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
 	return PyObjectFrom(self->HitUV());
 }
 
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
index a8376dc..1f78098 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
@@ -151,27 +151,27 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
 	/**
 	 * (in game world coordinates) the place where the object was hit.
 	 */
-	MT_Point3		 m_hitPosition;
+	MT_Point3        m_hitPosition;
 
 	/**
 	 * (in game world coordinates) the position to which to shoot the ray.
 	 */
-	MT_Point3		 m_prevTargetPoint;
+	MT_Point3        m_prevTargetPoint;
 
 	/**
 	 * (in game world coordinates) the position from which to shoot the ray.
 	 */
-	MT_Point3		 m_prevSourcePoint;
-	
+	MT_Point3        m_prevSourcePoint;
+
 	/**
 	 * (in game world coordinates) the face normal of the vertex where
 	 * the object was hit.  */
-	MT_Vector3		 m_hitNormal;
+	MT_Vector3       m_hitNormal;
 
 	/**
 	 * UV texture coordinate of the hit point if any, (0,0) otherwise
 	 */
-	MT_Vector2		 m_hitUV;
+	MT_Vector2       m_hitUV;
 
 	/**
 	 * The KX scene that holds the camera. The camera position
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index a05292f..33656e9 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -249,7 +249,7 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
 		}
 
 		//create tris
-		polys = (unsigned short*)MEM_callocN(sizeof(unsigned short)*3*2*npolys, "BuildVertIndArrays polys");
+		polys = (unsigned short *)MEM_callocN(sizeof(unsigned short)*3*2*npolys, "BuildVertIndArrays polys");
 		memset(polys, 0xff, sizeof(unsigned short)*3*2*npolys);
 		unsigned short *poly = polys;
 		RAS_Polygon* raspoly;
@@ -258,10 +258,10 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
 			raspoly = meshobj->GetPolygon(p);
 			for (int v=0; v<raspoly->VertexCount()-2; v++)
 			{
-				poly[0]= raspoly->GetVertex(0)->getOrigIndex();
+				poly[0] = raspoly->GetVertex(0)->getOrigIndex();
 				for (size_t i=1; i<3; i++)
 				{
-					poly[i]= raspoly->GetVertex(v+i)->getOrigIndex();
+					poly[i] = raspoly->GetVertex(v+i)->getOrigIndex();
 				}
 				poly += 6;
 			}
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index f35090f..931039b 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -114,7 +114,14 @@ bool KX_ObjectActuator::Update()
 						(m_bitLocalFlag.AngularVelocity) != 0
 					);
 			m_active_combined_velocity = false;
-		} 
+		}
+
+		// Explicitly stop the movement if we're using a character (apply movement is a little different for characters)
+		if (parent->GetPhysicsController() && parent->GetPhysicsController()->IsCharacter()) {
+			MT_Vector3 vec(0.0, 0.0, 0.0);
+			parent->ApplyMovement(vec, true);
+		}
+
 		m_linear_damping_active = false;
 		m_angular_damping_active = false;
 		m_error_accumulator.setValue(0.0,0.0,0.0);
@@ -389,8 +396,8 @@ static unsigned char mathutils_kxobactu_vector_cb_index = -1; /* index for our c
 
 static int mathutils_obactu_generic_check(BaseMathObject *bmo)
 {
-	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_ObjectActuator* self = static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 
 	return 0;
@@ -398,11 +405,11 @@ static int mathutils_obactu_generic_check(BaseMathObject *bmo)
 
 static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype)
 {
-	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_ObjectActuator* self = static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_VEC_CB_LINV:
 			self->m_linear_velocity.getValue(bmo->data);
 			break;
@@ -416,11 +423,11 @@ static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype)
 
 static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype)
 {
-	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
-	if (self==NULL)
+	KX_ObjectActuator* self = static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
+	if (self == NULL)
 		return -1;
 
-	switch(subtype) {
+	switch (subtype) {
 		case MATHUTILS_VEC_CB_LINV:
 			self->m_linear_velocity.setValue(bmo->data);
 			break;
@@ -442,13 +449,13 @@ static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, i
 
 static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, int index)
 {
-	float f= bmo->data[index];
+	float f = bmo->data[index];
 
 	/* lazy, avoid repeteing the case statement */
 	if (mathutils_obactu_vector_get(bmo, subtype) == -1)
 		return -1;
 
-	bmo->data[index]= f;
+	bmo->data[index] = f;
 	return mathutils_obactu_vector_set(bmo, subtype);
 }
 
@@ -467,7 +474,7 @@ PyObject *KX_ObjectActuator::pyattr_get_linV(void *self_v, const KX_PYATTRIBUTE_
 
 int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>(self_v);
+	KX_ObjectActuator* self = static_cast<KX_ObjectActuator*>(self_v);
 	if (!PyVecTo(value, self->m_linear_velocity))
 		return PY_SET_ATTR_FAIL;
 
@@ -483,7 +490,7 @@ PyObject *KX_ObjectActuator::pyattr_get_angV(void *self_v, const KX_PYATTRIBUTE_
 
 int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>(self_v);
+	KX_ObjectActuator* self = static_cast<KX_ObjectActuator*>(self_v);
 	if (!PyVecTo(value, self->m_angular_velocity))
 		return PY_SET_ATTR_FAIL;
 
@@ -522,7 +529,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE
 	{
 		self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
 		self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-		self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+		self->m_bitLocalFlag.Torque = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
 		if (!PyErr_Occurred())
 		{
@@ -558,7 +565,7 @@ int	KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE
 	{
 		self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
 		self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-		self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+		self->m_bitLocalFlag.DLoc = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
 		if (!PyErr_Occurred())
 		{
@@ -594,7 +601,7 @@ int	KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE
 	{
 		self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
 		self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-		self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+		self->m_bitLocalFlag.DRot = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
 		if (!PyErr_Occurred())
 		{
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
index 99d9fc7..8798f42 100644
--- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
+++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
@@ -1,6 +1,4 @@
 /*
- * Simulation for obstacle avoidance behavior
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -22,6 +20,12 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file gameengine/Ketsji/KX_ObstacleSimulation.cpp
+ *  \ingroup ketsji
+ *
+ * Simulation for obstacle avoidance behavior
+ */
+
 #include "KX_ObstacleSimulation.h"
 #include "KX_NavMeshObject.h"
 #include "KX_PythonInit.h"
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
deleted file mode 100644
index f18c35c..0000000
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
- *  \ingroup ketsji
- */
-
-
-#include "PyObjectPlus.h"
-
-#include "KX_PhysicsObjectWrapper.h"
-#include "PHY_IPhysicsEnvironment.h"
-#include "PHY_IPhysicsController.h"
-
-KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper(
-						PHY_IPhysicsController* ctrl,
-						PHY_IPhysicsEnvironment* physenv) :
-					PyObjectPlus(),
-					m_ctrl(ctrl),
-					m_physenv(physenv)
-{
-}
-
-KX_PhysicsObjectWrapper::~KX_PhysicsObjectWrapper()
-{
-}
-
-#ifdef WITH_PYTHON
-
-PyObject *KX_PhysicsObjectWrapper::PySetPosition(PyObject *args)
-{
-	float x,y,z;
-	if (PyArg_ParseTuple(args,"fff:setPosition",&x,&y,&z))
-	{
-		m_ctrl->setPosition(x,y,z);
-	}
-	else {
-		return NULL;
-	}
-	Py_RETURN_NONE;
-}
-
-
-PyObject *KX_PhysicsObjectWrapper::PySetLinearVelocity(PyObject *args)
-{
-	float x,y,z;
-	int local;
-	if (PyArg_ParseTuple(args,"fffi:setLinearVelocity",&x,&y,&z,&local))
-	{
-		m_ctrl->SetLinearVelocity(x,y,z,local != 0);
-	}
-	else {
-		return NULL;
-	}
-	Py_RETURN_NONE;
-}
-
-PyObject *KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject *args)
-{
-	float x,y,z;
-	int local;
-	if (PyArg_ParseTuple(args,"fffi:setAngularVelocity",&x,&y,&z,&local))
-	{
-		m_ctrl->SetAngularVelocity(x,y,z,local != 0);
-	}
-	else {
-		return NULL;
-	}
-	Py_RETURN_NONE;
-}
-
-PyObject*	KX_PhysicsObjectWrapper::PySetActive(PyObject *args)
-{
-	int active;
-	if (PyArg_ParseTuple(args,"i:setActive",&active))
-	{
-		m_ctrl->SetActive(active!=0);
-	}
-	else {
-		return NULL;
-	}
-	Py_RETURN_NONE;
-}
-
-
-PyAttributeDef KX_PhysicsObjectWrapper::Attributes[] = {
-	{ NULL }	//Sentinel
-};
-
-//python specific stuff
-PyTypeObject KX_PhysicsObjectWrapper::Type = {
-	PyVarObject_HEAD_INIT(NULL, 0)
-	"KX_PhysicsObjectWrapper",
-	sizeof(PyObjectPlus_Proxy),
-	0,
-	py_base_dealloc,
-	0,
-	0,
-	0,
-	0,
-	py_base_repr,
-	0,0,0,0,0,0,0,0,0,
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-	0,0,0,0,0,0,0,
-	Methods,
-	0,
-	0,
-	&PyObjectPlus::Type,
-	0,0,0,0,0,0,
-	py_base_new
-};
-
-PyMethodDef KX_PhysicsObjectWrapper::Methods[] = {
-	{"setPosition",(PyCFunction) KX_PhysicsObjectWrapper::sPySetPosition, METH_VARARGS},
-	{"setLinearVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetLinearVelocity, METH_VARARGS},
-	{"setAngularVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetAngularVelocity, METH_VARARGS},
-	{"setActive",(PyCFunction) KX_PhysicsObjectWrapper::sPySetActive, METH_VARARGS},
-	{NULL,NULL} //Sentinel
-};
-
-#endif
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
deleted file mode 100644
index 171416c..0000000
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file KX_PhysicsObjectWrapper.h
- *  \ingroup ketsji
- */
-
-#ifndef __KX_PHYSICSOBJECTWRAPPER_H__
-#define __KX_PHYSICSOBJECTWRAPPER_H__
-
-#include "Value.h"
-#include "PHY_DynamicTypes.h"
-
-class	KX_PhysicsObjectWrapper : public PyObjectPlus
-{
-	Py_Header
-public:
-	KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
-	virtual ~KX_PhysicsObjectWrapper();
-	
-#ifdef WITH_PYTHON
-
-	KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition);
-	KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetLinearVelocity);
-	KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetAngularVelocity);
-	KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetActive);
-
-#endif  /* WITH_PYTHON */
-
-private:
-	class PHY_IPhysicsController*	m_ctrl;
-	PHY_IPhysicsEnvironment* m_physenv;
-};
-
-#endif  /* __KX_PHYSICSOBJECTWRAPPER_H__ */
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 13b6bda..840ffdd 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -114,69 +114,69 @@ CValue*		KX_PolyProxy::GetReplica() { return NULL;}
 
 PyObject *KX_PolyProxy::pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PygetMaterialName();
 }
 
 PyObject *KX_PolyProxy::pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PygetTextureName();
 }
 
 PyObject *KX_PolyProxy::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PygetMaterial();
 }
 
 PyObject *KX_PolyProxy::pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PygetMaterialIndex();
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-	return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+	return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-	return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+	return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-	return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+	return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
 	if (3 < self->m_polygon->VertexCount())
 	{
-		return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+		return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
 	}
-	return PyLong_FromSsize_t(0);
+	return PyLong_FromLong(0);
 }
 
 PyObject *KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PyisVisible();
 }
 
 PyObject *KX_PolyProxy::pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+	KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 	return self->PyisCollider();
 }
 
@@ -192,25 +192,25 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
 			// found it
 			break;
 	}
-	return PyLong_FromSsize_t(matid);
+	return PyLong_FromLong(matid);
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex,
 "getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n")
 {
-	return PyLong_FromSsize_t(m_polygon->VertexCount());
+	return PyLong_FromLong(m_polygon->VertexCount());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible,
 "isVisible() : returns whether the polygon is visible or not\n")
 {
-	return PyLong_FromSsize_t(m_polygon->IsVisible());
+	return PyLong_FromLong(m_polygon->IsVisible());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
 "isCollider() : returns whether the polygon is receives collision or not\n")
 {
-	return PyLong_FromSsize_t(m_polygon->IsCollider());
+	return PyLong_FromLong(m_polygon->IsCollider());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
@@ -243,9 +243,9 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
 	}
 	if (index < m_polygon->VertexCount())
 	{
-		return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, index));
+		return PyLong_FromLong(m_polygon->GetVertexOffsetAbs(m_mesh, index));
 	}
-	return PyLong_FromSsize_t(0);
+	return PyLong_FromLong(0);
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh,
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 3b58a8a..f157d9e 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -109,7 +109,7 @@ void KX_PolygonMaterial::Initialize(
 		m_mcol = *mcol;
 	}
 	else {
-		memset(&m_mcol, 0, sizeof(m_mcol));
+		m_mcol = 0;
 	}
 
 	m_material = ma;
@@ -146,7 +146,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
 		PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject *) this->m_proxy);
 		if (ret)
 		{
-			bool value = PyLong_AsSsize_t(ret);
+			bool value = PyLong_AsLong(ret);
 			Py_DECREF(ret);
 			dopass = value;
 		}
@@ -266,8 +266,6 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = {
 	
 	KX_PYATTRIBUTE_RO_FUNCTION("tface",	KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */
 	KX_PYATTRIBUTE_RO_FUNCTION("gl_texture", KX_PolygonMaterial, pyattr_get_gl_texture), /* could be called 'bindcode' */
-	
-	/* triangle used to be an attribute, removed for 2.49, nobody should be using it */
 	{ NULL }	//Sentinel
 };
 
@@ -357,43 +355,43 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)")
 
 PyObject *KX_PolygonMaterial::pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	return PyUnicode_From_STR_String(self->m_texturename);
 }
 
 PyObject *KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	return PyUnicode_From_STR_String(self->m_materialname);
 }
 
 /* this does not seem useful */
 PyObject *KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	return PyCapsule_New(&self->m_tface, KX_POLYGONMATERIAL_CAPSULE_ID, NULL);
 }
 
 PyObject *KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	int bindcode= 0;
 	if (self->m_tface.tpage)
 		bindcode= self->m_tface.tpage->bindcode;
 	
-	return PyLong_FromSsize_t(bindcode);
+	return PyLong_FromLong(bindcode);
 }
 
 
 PyObject *KX_PolygonMaterial::pyattr_get_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	return PyObjectFrom(self->m_diffuse);
 }
 
 int KX_PolygonMaterial::pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	MT_Vector3 vec;
 	
 	if (!PyVecTo(value, vec))
@@ -405,13 +403,13 @@ int KX_PolygonMaterial::pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DE
 
 PyObject *KX_PolygonMaterial::pyattr_get_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	return PyObjectFrom(self->m_specular);
 }
 
 int KX_PolygonMaterial::pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
+	KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
 	MT_Vector3 vec;
 	
 	if (!PyVecTo(value, vec))
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index 89bfb4f..2ce8f48 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -60,7 +60,7 @@ class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
 private:
 	/** Blender texture face structure. */
 	mutable MTFace       m_tface;
-	mutable unsigned int m_mcol;
+	mutable unsigned int m_mcol; /* for text color (only) */
 	Material*            m_material;
 
 #ifdef WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 5f3a487..9bb09d5 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -33,12 +33,14 @@
 #include "PHY_IPhysicsEnvironment.h"
 #include "KX_ConstraintWrapper.h"
 #include "KX_VehicleWrapper.h"
-#include "KX_PhysicsObjectWrapper.h"
+#include "KX_CharacterWrapper.h"
 #include "PHY_IPhysicsController.h"
 #include "PHY_IVehicle.h"
 #include "PHY_DynamicTypes.h"
 #include "MT_Matrix3x3.h"
 
+#include "KX_GameObject.h" // ConvertPythonToGameObject()
+
 #include "PyObjectPlus.h" 
 
 #ifdef USE_BULLET
@@ -48,7 +50,7 @@
 #ifdef WITH_PYTHON
 
 // macro copied from KX_PythonInit.cpp
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
 
 // nasty glob variable to connect scripting language
 // if there is a better way (without global), please do so!
@@ -81,6 +83,7 @@ static char gPySetSolverType__doc__[] = "setSolverType(int solverType) Very expe
 
 static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)";
 static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)";
+static char gPyGetCharacter__doc__[] = "getCharacter(KX_GameObject obj)";
 static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)";
 static char gPyGetAppliedImpulse__doc__[] = "getAppliedImpulse(int constraintId)";
 
@@ -402,6 +405,33 @@ static PyObject *gPyGetVehicleConstraint(PyObject *self,
 	Py_RETURN_NONE;
 }
 
+static PyObject* gPyGetCharacter(PyObject* self,
+                                 PyObject* args,
+                                 PyObject* kwds)
+{
+	PyObject* pyob;
+	KX_GameObject *ob;
+
+	if (!PyArg_ParseTuple(args,"O", &pyob))
+		return NULL;
+
+	if (!ConvertPythonToGameObject(pyob, &ob, false, "bge.constraints.getCharacter(value)"))
+		return NULL;
+
+	if (PHY_GetActiveEnvironment())
+	{
+			
+		PHY_ICharacter* character= PHY_GetActiveEnvironment()->getCharacterController(ob);
+		if (character)
+		{
+			KX_CharacterWrapper* pyWrapper = new KX_CharacterWrapper(character);
+			return pyWrapper->NewProxy(true);
+		}
+
+	}
+
+	Py_RETURN_NONE;
+}
 
 static PyObject *gPyCreateConstraint(PyObject *self,
                                      PyObject *args,
@@ -631,6 +661,9 @@ static struct PyMethodDef physicsconstraints_methods[] = {
 	{"getVehicleConstraint",(PyCFunction) gPyGetVehicleConstraint,
 	 METH_VARARGS, (const char *)gPyGetVehicleConstraint__doc__},
 
+	{"getCharacter",(PyCFunction) gPyGetCharacter,
+	 METH_VARARGS, (const char *)gPyGetCharacter__doc__},
+
 	{"removeConstraint",(PyCFunction) gPyRemoveConstraint,
 	 METH_VARARGS, (const char *)gPyRemoveConstraint__doc__},
 	{"getAppliedImpulse",(PyCFunction) gPyGetAppliedImpulse,
@@ -695,7 +728,7 @@ PyObject *initPythonConstraintBinding()
 	KX_MACRO_addTypesToDict(d, DBG_PROFILETIMINGS, btIDebugDraw::DBG_ProfileTimings);
 	KX_MACRO_addTypesToDict(d, DBG_ENABLESATCOMPARISION, btIDebugDraw::DBG_EnableSatComparison);
 	KX_MACRO_addTypesToDict(d, DBG_DISABLEBULLETLCP, btIDebugDraw::DBG_DisableBulletLCP);
-	KX_MACRO_addTypesToDict(d, DBG_ENABLECDD, btIDebugDraw::DBG_EnableCCD);
+	KX_MACRO_addTypesToDict(d, DBG_ENABLECCD, btIDebugDraw::DBG_EnableCCD);
 	KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTS, btIDebugDraw::DBG_DrawConstraints);
 	KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTLIMITS, btIDebugDraw::DBG_DrawConstraintLimits);
 	KX_MACRO_addTypesToDict(d, DBG_FASTWIREFRAME, btIDebugDraw::DBG_FastWireframe);
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index bc324c3..804e8de 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -31,9 +31,9 @@
  */
 
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #ifdef WITH_PYTHON
 
@@ -86,11 +86,11 @@ bool PyQuatTo(PyObject *pyval, MT_Quaternion &qrot)
 		return false;
 
 	/* annoying!, Blender/Mathutils have the W axis first! */
-	MT_Scalar w= qrot[0]; /* from python, this is actually the W */
-	qrot[0]= qrot[1];
-	qrot[1]= qrot[2];
-	qrot[2]= qrot[3];
-	qrot[3]= w;
+	MT_Scalar w = qrot[0]; /* from python, this is actually the W */
+	qrot[0] = qrot[1];
+	qrot[1] = qrot[2];
+	qrot[2] = qrot[3];
+	qrot[3] = w;
 
 	return true;
 }
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 43fca40..996be97 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -30,54 +30,48 @@
  *  \ingroup ketsji
  */
 
-
 #include "GL/glew.h"
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
-
-#ifdef WITH_PYTHON
-
-#ifdef _POSIX_C_SOURCE
-#undef _POSIX_C_SOURCE
-#endif
-
-#ifdef _XOPEN_SOURCE
-#undef _XOPEN_SOURCE
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
-#if defined(__sun) || defined(sun) 
-#if defined(_XPG4) 
-#undef _XPG4 
-#endif 
-#endif 
-
-#include <Python.h>
+#ifdef WITH_PYTHON
+#  ifdef   _POSIX_C_SOURCE
+#    undef _POSIX_C_SOURCE
+#  endif
+#  ifdef   _XOPEN_SOURCE
+#    undef _XOPEN_SOURCE
+#  endif
+#  if defined(__sun) || defined(sun)
+#    if defined(_XPG4)
+#      undef _XPG4
+#    endif
+#  endif
+#  include <Python.h>
 
 extern "C" {
-	#include "bpy_internal_import.h"  /* from the blender python api, but we want to import text too! */
-	#include "py_capi_utils.h"
-	#include "mathutils.h" // 'mathutils' module copied here so the blenderlayer can use.
-	#include "bgl.h"
-	#include "blf_py_api.h"
+	#  include "bpy_internal_import.h"  /* from the blender python api, but we want to import text too! */
+	#  include "py_capi_utils.h"
+	#  include "mathutils.h" // 'mathutils' module copied here so the blenderlayer can use.
+	#  include "bgl.h"
+	#  include "blf_py_api.h"
 
-	#include "marshal.h" /* python header for loading/saving dicts */
+	#  include "marshal.h" /* python header for loading/saving dicts */
 }
-
 #include "AUD_PyInit.h"
 
-#endif
+#endif  /* WITH_PYTHON */
 
 #include "KX_PythonInit.h"
 
 // directory header for py function getBlendFileList
 #ifndef WIN32
-  #include <dirent.h>
-  #include <stdlib.h>
+#  include <dirent.h>
+#  include <stdlib.h>
 #else
-  #include <io.h>
-  #include "BLI_winstuff.h"
+#  include <io.h>
+#  include "BLI_winstuff.h"
 #endif
 
 //python physics binding
@@ -186,8 +180,8 @@ void	KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,cons
 		gp_Rasterizer->DrawDebugLine(from,to,color);
 }
 
-void	KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
-									 const MT_Vector3& normal, int nsector)
+void KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
+                                  const MT_Vector3& normal, int nsector)
 {
 	if (gp_Rasterizer)
 		gp_Rasterizer->DrawDebugCircle(center, radius, color, normal, nsector);
@@ -199,10 +193,10 @@ static PyObject *gp_OrigPythonSysPath= NULL;
 static PyObject *gp_OrigPythonSysModules= NULL;
 
 /* Macro for building the keyboard translation */
-//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
-#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
+//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromLong(SCA_IInputDevice::KX_##name))
+#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name)); Py_DECREF(item)
 /* For the defines for types from logic bricks, we do stuff explicitly... */
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
 
 
 // temporarily python stuff, will be put in another place later !
@@ -435,7 +429,7 @@ static PyObject *gPySetExitKey(PyObject *, PyObject *args)
 
 static PyObject *gPyGetExitKey(PyObject *)
 {
-	return PyLong_FromSsize_t(KX_KetsjiEngine::GetExitKey());
+	return PyLong_FromLong(KX_KetsjiEngine::GetExitKey());
 }
 
 static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
@@ -450,7 +444,7 @@ static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
 
 static PyObject *gPyGetMaxLogicFrame(PyObject *)
 {
-	return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame());
+	return PyLong_FromLong(KX_KetsjiEngine::GetMaxLogicFrame());
 }
 
 static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
@@ -465,7 +459,7 @@ static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
 
 static PyObject *gPyGetMaxPhysicsFrame(PyObject *)
 {
-	return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame());
+	return PyLong_FromLong(KX_KetsjiEngine::GetMaxPhysicsFrame());
 }
 
 static PyObject *gPySetPhysicsTicRate(PyObject *, PyObject *args)
@@ -868,14 +862,14 @@ static struct PyMethodDef game_methods[] = {
 
 static PyObject *gPyGetWindowHeight(PyObject *, PyObject *args)
 {
-	return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0));
+	return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
 }
 
 
 
 static PyObject *gPyGetWindowWidth(PyObject *, PyObject *args)
 {
-	return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0));
+	return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
 }
 
 
@@ -1209,7 +1203,7 @@ static PyObject *gPyGetGLSLMaterialSetting(PyObject *,
 	}
 
 	enabled = ((gs->glslflag & flag) != 0);
-	return PyLong_FromSsize_t(enabled);
+	return PyLong_FromLong(enabled);
 }
 
 #define KX_TEXFACE_MATERIAL				0
@@ -1252,7 +1246,7 @@ static PyObject *gPyGetMaterialType(PyObject *)
 	else
 		flag = KX_TEXFACE_MATERIAL;
 	
-	return PyLong_FromSsize_t(flag);
+	return PyLong_FromLong(flag);
 }
 
 static PyObject *gPySetAnisotropicFiltering(PyObject *, PyObject *args)
@@ -1317,48 +1311,47 @@ static PyObject *gPySetWindowSize(PyObject *, PyObject *args)
 }
 
 static struct PyMethodDef rasterizer_methods[] = {
-  {"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
-   METH_VARARGS, "getWindowWidth doc"},
-   {"getWindowHeight",(PyCFunction) gPyGetWindowHeight,
-   METH_VARARGS, "getWindowHeight doc"},
-  {"makeScreenshot",(PyCFunction)gPyMakeScreenshot,
-	METH_VARARGS, "make Screenshot doc"},
-   {"enableVisibility",(PyCFunction) gPyEnableVisibility,
-   METH_VARARGS, "enableVisibility doc"},
+	{"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
+	 METH_VARARGS, "getWindowWidth doc"},
+	{"getWindowHeight",(PyCFunction) gPyGetWindowHeight,
+	 METH_VARARGS, "getWindowHeight doc"},
+	{"makeScreenshot",(PyCFunction)gPyMakeScreenshot,
+	 METH_VARARGS, "make Screenshot doc"},
+	{"enableVisibility",(PyCFunction) gPyEnableVisibility,
+	 METH_VARARGS, "enableVisibility doc"},
 	{"showMouse",(PyCFunction) gPyShowMouse,
-   METH_VARARGS, "showMouse(bool visible)"},
-   {"setMousePosition",(PyCFunction) gPySetMousePosition,
-   METH_VARARGS, "setMousePosition(int x,int y)"},
-  {"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"},
+	 METH_VARARGS, "showMouse(bool visible)"},
+	{"setMousePosition",(PyCFunction) gPySetMousePosition,
+	 METH_VARARGS, "setMousePosition(int x,int y)"},
+	{"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"},
 	{"setAmbientColor",(PyCFunction)gPySetAmbientColor,METH_O,"set Ambient Color (rgb)"},
- {"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"},
- {"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"},
-  {"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start(rgb)"},
-  {"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End(rgb)"},
-  {"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"},
-  {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"},
-
-  
-  {"setEyeSeparation", (PyCFunction) gPySetEyeSeparation, METH_VARARGS, "set the eye separation for stereo mode"},
-  {"getEyeSeparation", (PyCFunction) gPyGetEyeSeparation, METH_NOARGS, "get the eye separation for stereo mode"},
-  {"setFocalLength", (PyCFunction) gPySetFocalLength, METH_VARARGS, "set the focal length for stereo mode"},
-  {"getFocalLength", (PyCFunction) gPyGetFocalLength, METH_VARARGS, "get the focal length for stereo mode"},
-  {"setMaterialMode",(PyCFunction) gPySetMaterialType,
-   METH_VARARGS, "set the material mode to use for OpenGL rendering"},
-  {"getMaterialMode",(PyCFunction) gPyGetMaterialType,
-   METH_NOARGS, "get the material mode being used for OpenGL rendering"},
-  {"setGLSLMaterialSetting",(PyCFunction) gPySetGLSLMaterialSetting,
-   METH_VARARGS, "set the state of a GLSL material setting"},
-  {"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting,
-   METH_VARARGS, "get the state of a GLSL material setting"},
-  {"setAnisotropicFiltering", (PyCFunction) gPySetAnisotropicFiltering,
-  METH_VARARGS, "set the anisotropic filtering level (must be one of 1, 2, 4, 8, 16)"},
-  {"getAnisotropicFiltering", (PyCFunction) gPyGetAnisotropicFiltering,
-  METH_VARARGS, "get the anisotropic filtering level"},
-  {"drawLine", (PyCFunction) gPyDrawLine,
-   METH_VARARGS, "draw a line on the screen"},
-  {"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
-  { NULL, (PyCFunction) NULL, 0, NULL }
+	{"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"},
+	{"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"},
+	{"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start(rgb)"},
+	{"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End(rgb)"},
+	{"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"},
+	{"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"},
+
+	{"setEyeSeparation", (PyCFunction) gPySetEyeSeparation, METH_VARARGS, "set the eye separation for stereo mode"},
+	{"getEyeSeparation", (PyCFunction) gPyGetEyeSeparation, METH_NOARGS, "get the eye separation for stereo mode"},
+	{"setFocalLength", (PyCFunction) gPySetFocalLength, METH_VARARGS, "set the focal length for stereo mode"},
+	{"getFocalLength", (PyCFunction) gPyGetFocalLength, METH_VARARGS, "get the focal length for stereo mode"},
+	{"setMaterialMode",(PyCFunction) gPySetMaterialType,
+	 METH_VARARGS, "set the material mode to use for OpenGL rendering"},
+	{"getMaterialMode",(PyCFunction) gPyGetMaterialType,
+	 METH_NOARGS, "get the material mode being used for OpenGL rendering"},
+	{"setGLSLMaterialSetting",(PyCFunction) gPySetGLSLMaterialSetting,
+	 METH_VARARGS, "set the state of a GLSL material setting"},
+	{"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting,
+	 METH_VARARGS, "get the state of a GLSL material setting"},
+	{"setAnisotropicFiltering", (PyCFunction) gPySetAnisotropicFiltering,
+	 METH_VARARGS, "set the anisotropic filtering level (must be one of 1, 2, 4, 8, 16)"},
+	{"getAnisotropicFiltering", (PyCFunction) gPyGetAnisotropicFiltering,
+	 METH_VARARGS, "get the anisotropic filtering level"},
+	{"drawLine", (PyCFunction) gPyDrawLine,
+	 METH_VARARGS, "draw a line on the screen"},
+	{"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
+	{ NULL, (PyCFunction) NULL, 0, NULL }
 };
 
 // Initialization function for the module (*must* be called initGameLogic)
@@ -1695,6 +1688,7 @@ PyObject *initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
 	KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_DISABLE, ACT_ARM_DISABLE);
 	KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETTARGET, ACT_ARM_SETTARGET);
 	KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETWEIGHT, ACT_ARM_SETWEIGHT);
+	KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETINFLUENCE, ACT_ARM_SETINFLUENCE);
 
 	/* BL_Armature Channel rotation_mode */
 	KX_MACRO_addTypesToDict(d, ROT_MODE_QUAT, ROT_MODE_QUAT);
@@ -1802,7 +1796,7 @@ static void initPySysObjects(Main *maggie)
 	
 	Library *lib= (Library *)maggie->library.first;
 	
-	while(lib) {
+	while (lib) {
 		/* lib->name wont work in some cases (on win32),
 		 * even when expanding with gp_GamePythonPath, using lib->filename is less trouble */
 		initPySysObjects__append(sys_path, lib->filepath);
@@ -1850,7 +1844,7 @@ void removeImportMain(struct Main *maggie)
 }
 
 // Copied from bpy_interface.c
-static struct _inittab bge_internal_modules[]= {
+static struct _inittab bge_internal_modules[] = {
 	{(char *)"mathutils", PyInit_mathutils},
 	{(char *)"bgl", BPyInit_bgl},
 	{(char *)"blf", BPyInit_blf},
@@ -2246,9 +2240,9 @@ PyObject *initGameKeys()
 	KX_MACRO_addTypesToDict(d, CAPSLOCKKEY, SCA_IInputDevice::KX_CAPSLOCKKEY);
 		
 	KX_MACRO_addTypesToDict(d, LEFTCTRLKEY, SCA_IInputDevice::KX_LEFTCTRLKEY);
-	KX_MACRO_addTypesToDict(d, LEFTALTKEY, SCA_IInputDevice::KX_LEFTALTKEY); 		
-	KX_MACRO_addTypesToDict(d, RIGHTALTKEY, SCA_IInputDevice::KX_RIGHTALTKEY); 	
-	KX_MACRO_addTypesToDict(d, RIGHTCTRLKEY, SCA_IInputDevice::KX_RIGHTCTRLKEY); 	
+	KX_MACRO_addTypesToDict(d, LEFTALTKEY, SCA_IInputDevice::KX_LEFTALTKEY);
+	KX_MACRO_addTypesToDict(d, RIGHTALTKEY, SCA_IInputDevice::KX_RIGHTALTKEY);
+	KX_MACRO_addTypesToDict(d, RIGHTCTRLKEY, SCA_IInputDevice::KX_RIGHTCTRLKEY);
 	KX_MACRO_addTypesToDict(d, RIGHTSHIFTKEY, SCA_IInputDevice::KX_RIGHTSHIFTKEY);
 	KX_MACRO_addTypesToDict(d, LEFTSHIFTKEY, SCA_IInputDevice::KX_LEFTSHIFTKEY);
 		
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index d0e3d26..9717306 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -40,8 +40,10 @@
 #include "BL_ArmatureConstraint.h"
 #include "BL_ArmatureObject.h"
 #include "BL_ArmatureChannel.h"
+#include "KX_ArmatureSensor.h"
 #include "KX_BlenderMaterial.h"
 #include "KX_CameraActuator.h"
+#include "KX_CharacterWrapper.h"
 #include "KX_ConstraintActuator.h"
 #include "KX_ConstraintWrapper.h"
 #include "KX_GameActuator.h"
@@ -53,7 +55,6 @@
 #include "KX_NetworkMessageSensor.h"
 #include "KX_ObjectActuator.h"
 #include "KX_ParentActuator.h"
-#include "KX_PhysicsObjectWrapper.h"
 #include "KX_PolyProxy.h"
 #include "KX_PolygonMaterial.h"
 #include "KX_PythonSeq.h"
@@ -184,11 +185,14 @@ void initPyTypes(void)
 		PyType_Ready_Attr(dict, BL_ArmatureConstraint, init_getset);
 		PyType_Ready_AttrPtr(dict, BL_ArmatureBone, init_getset);
 		PyType_Ready_AttrPtr(dict, BL_ArmatureChannel, init_getset);
+		// PyType_Ready_Attr(dict, CPropValue, init_getset);  // doesn't use Py_Header
 		PyType_Ready_Attr(dict, CListValue, init_getset);
 		PyType_Ready_Attr(dict, CValue, init_getset);
+		PyType_Ready_Attr(dict, KX_ArmatureSensor, init_getset);
 		PyType_Ready_Attr(dict, KX_BlenderMaterial, init_getset);
 		PyType_Ready_Attr(dict, KX_Camera, init_getset);
 		PyType_Ready_Attr(dict, KX_CameraActuator, init_getset);
+		PyType_Ready_Attr(dict, KX_CharacterWrapper, init_getset);
 		PyType_Ready_Attr(dict, KX_ConstraintActuator, init_getset);
 		PyType_Ready_Attr(dict, KX_ConstraintWrapper, init_getset);
 		PyType_Ready_Attr(dict, KX_GameActuator, init_getset);
@@ -203,7 +207,6 @@ void initPyTypes(void)
 		PyType_Ready_Attr(dict, KX_NetworkMessageSensor, init_getset);
 		PyType_Ready_Attr(dict, KX_ObjectActuator, init_getset);
 		PyType_Ready_Attr(dict, KX_ParentActuator, init_getset);
-		PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper, init_getset);
 		PyType_Ready_Attr(dict, KX_PolyProxy, init_getset);
 		PyType_Ready_Attr(dict, KX_PolygonMaterial, init_getset);
 		PyType_Ready_Attr(dict, KX_RadarSensor, init_getset);
@@ -226,6 +229,7 @@ void initPyTypes(void)
 		PyType_Ready_Attr(dict, PyObjectPlus, init_getset);
 		PyType_Ready_Attr(dict, SCA_2DFilterActuator, init_getset);
 		PyType_Ready_Attr(dict, SCA_ANDController, init_getset);
+		// PyType_Ready_Attr(dict, SCA_Actuator, init_getset);  // doesn't use Py_Header
 		PyType_Ready_Attr(dict, SCA_ActuatorSensor, init_getset);
 		PyType_Ready_Attr(dict, SCA_AlwaysSensor, init_getset);
 		PyType_Ready_Attr(dict, SCA_DelaySensor, init_getset);
diff --git a/source/gameengine/Ketsji/KX_PythonMain.cpp b/source/gameengine/Ketsji/KX_PythonMain.cpp
index d926dff..740bb10 100644
--- a/source/gameengine/Ketsji/KX_PythonMain.cpp
+++ b/source/gameengine/Ketsji/KX_PythonMain.cpp
@@ -1,6 +1,4 @@
-/* 
- * $Id: KX_PythonMain.cpp 37750 2011-06-27 09:27:56Z sjoerd $
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -17,15 +15,11 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
+ * Contributor(s): Benoit Bolsee
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+
 /** \file gameengine/Ketsji/KX_PythonMain.cpp
  *  \ingroup ketsji
  */
diff --git a/source/gameengine/Ketsji/KX_PythonMain.h b/source/gameengine/Ketsji/KX_PythonMain.h
index 1460ea2..e638fa9 100644
--- a/source/gameengine/Ketsji/KX_PythonMain.h
+++ b/source/gameengine/Ketsji/KX_PythonMain.h
@@ -1,6 +1,4 @@
-/* 
- * $Id: KX_PythonMain.h 37750 2011-06-27 09:27:56Z sjoerd $
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -31,11 +29,12 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_PYTHON_MAIN
-#define __KX_PYTHON_MAIN
+#ifndef __KX_PYTHON_MAIN__
+#define __KX_PYTHON_MAIN__
 
 #include "BKE_main.h"
 #include "DNA_scene_types.h"
 extern "C" char *KX_GetPythonMain(struct Scene* scene);
 extern "C" char *KX_GetPythonCode(struct Main *main, char *python_main);
-#endif
+
+#endif  /* __KX_PYTHON_MAIN__ */
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 5ab3de1..f0e1164 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -72,35 +72,35 @@ static void KX_PythonSeq_dealloc(KX_PythonSeq * self)
 static Py_ssize_t KX_PythonSeq_len( PyObject *self )
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
-	 
+
 	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, "len(seq): "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
 	
-	switch(((KX_PythonSeq *)self)->type) {
-	case KX_PYGENSEQ_CONT_TYPE_SENSORS:
-		return ((SCA_IController *)self_plus)->GetLinkedSensors().size();
-	case KX_PYGENSEQ_CONT_TYPE_ACTUATORS:
-		return ((SCA_IController *)self_plus)->GetLinkedActuators().size();
-	case KX_PYGENSEQ_OB_TYPE_SENSORS:
-		return ((KX_GameObject *)self_plus)->GetSensors().size();
-	case KX_PYGENSEQ_OB_TYPE_CONTROLLERS:
-		return ((KX_GameObject *)self_plus)->GetControllers().size();
-	case KX_PYGENSEQ_OB_TYPE_ACTUATORS:
-		return ((KX_GameObject *)self_plus)->GetActuators().size();
-	case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS:
-		return ((BL_ArmatureObject *)self_plus)->GetConstraintNumber();
-	case KX_PYGENSEQ_OB_TYPE_CHANNELS:
-		return ((BL_ArmatureObject *)self_plus)->GetChannelNumber();
-	default:
-		/* Should never happen */
-		PyErr_SetString(PyExc_SystemError, "invalid type, internal error");
-		return -1;
+	switch (((KX_PythonSeq *)self)->type) {
+		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
+			return ((SCA_IController *)self_plus)->GetLinkedSensors().size();
+		case KX_PYGENSEQ_CONT_TYPE_ACTUATORS:
+			return ((SCA_IController *)self_plus)->GetLinkedActuators().size();
+		case KX_PYGENSEQ_OB_TYPE_SENSORS:
+			return ((KX_GameObject *)self_plus)->GetSensors().size();
+		case KX_PYGENSEQ_OB_TYPE_CONTROLLERS:
+			return ((KX_GameObject *)self_plus)->GetControllers().size();
+		case KX_PYGENSEQ_OB_TYPE_ACTUATORS:
+			return ((KX_GameObject *)self_plus)->GetActuators().size();
+		case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS:
+			return ((BL_ArmatureObject *)self_plus)->GetConstraintNumber();
+		case KX_PYGENSEQ_OB_TYPE_CHANNELS:
+			return ((BL_ArmatureObject *)self_plus)->GetChannelNumber();
+		default:
+			/* Should never happen */
+			PyErr_SetString(PyExc_SystemError, "invalid type, internal error");
+			return -1;
 	}
 }
 
-static PyObject *KX_PythonSeq_getIndex(PyObject *self, int index)
+static PyObject *KX_PythonSeq_getIndex(PyObject *self, Py_ssize_t index)
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	 
@@ -109,7 +109,7 @@ static PyObject *KX_PythonSeq_getIndex(PyObject *self, int index)
 		return NULL;
 	}
 	
-	switch(((KX_PythonSeq *)self)->type) {
+	switch (((KX_PythonSeq *)self)->type) {
 		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
 		{
 			vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors();
@@ -193,7 +193,7 @@ static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, const cha
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	
-	switch(((KX_PythonSeq *)self)->type) {
+	switch (((KX_PythonSeq *)self)->type) {
 		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
 		{
 			vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors();
@@ -273,8 +273,8 @@ static PyObject * KX_PythonSeq_subscript(PyObject *self, PyObject *key)
 		return NULL;
 	}
 	
-	if (PyLong_Check(key)) {
-		return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
+	if (PyIndex_Check(key)) {
+		return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t(key));
 	}
 	else if ( PyUnicode_Check(key) ) {
 		const char *name = _PyUnicode_AsString(key);
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index fb949ff..04d67fc 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -219,7 +219,7 @@ PyAttributeDef KX_RadarSensor::Attributes[] = {
 
 PyObject *KX_RadarSensor::pyattr_get_angle(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_RadarSensor* self= static_cast<KX_RadarSensor*>(self_v);
+	KX_RadarSensor* self = static_cast<KX_RadarSensor*>(self_v);
 
 	// The original angle from the gui was converted, so we recalculate the value here to maintain
 	// consistency between Python and the gui
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index 459600f..2a6b7d1 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -76,9 +76,9 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_
 	
 	PHY_IPhysicsController* hit_controller;
 
-	while((hit_controller = physics_environment->rayTest(callback,
-			frompoint.x(),frompoint.y(),frompoint.z(),
-			topoint.x(),topoint.y(),topoint.z())) != NULL) 
+	while ((hit_controller = physics_environment->rayTest(callback,
+	                                                      frompoint.x(),frompoint.y(),frompoint.z(),
+	                                                      topoint.x(),topoint.y(),topoint.z())) != NULL)
 	{
 		KX_ClientObjectInfo* info = static_cast<KX_ClientObjectInfo*>(hit_controller->getNewClientInfo());
 		
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index d850168..56dccc1 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -190,8 +190,8 @@ PyTypeObject KX_SCA_AddObjectActuator::Type = {
 };
 
 PyMethodDef KX_SCA_AddObjectActuator::Methods[] = {
-  {"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS,"instantAddObject() : immediately add object without delay\n"},
-  {NULL,NULL} //Sentinel
+	{"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS, NULL},
+	{NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_SCA_AddObjectActuator::Attributes[] = {
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index 7dac93a..976f3c5 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -50,7 +50,7 @@ class KX_SCA_AddObjectActuator : public SCA_IActuator
 	/// Time field: lifetime of the new object
 	int	m_timeProp;
 
-	/// Original object reference (object to replicate)  	
+	/// Original object reference (object to replicate)
 	SCA_IObject*	m_OriginalObject;
 
 	/// Object will be added to the following scene
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
index e6209d2..81c9dc9 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
@@ -113,7 +113,7 @@ PyTypeObject KX_SCA_EndObjectActuator::Type = {
 };
 
 PyMethodDef KX_SCA_EndObjectActuator::Methods[] = {
-  {NULL,NULL} //Sentinel
+	{NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = {
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index f6ab9af..72be5f5 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -31,9 +31,9 @@
  */
 
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable : 4786)
-#endif //WIN32
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
+#endif
 
 #include "KX_Scene.h"
 #include "KX_PythonInit.h"
@@ -55,7 +55,7 @@
 #include "SCA_BasicEventManager.h"
 #include "KX_Camera.h"
 #include "SCA_JoystickManager.h"
-
+#include "KX_PyMath.h"
 #include "RAS_MeshObject.h"
 
 #include "RAS_IRasterizer.h"
@@ -1027,7 +1027,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
 
 	// if the object is the dupligroup proxy, you have to cleanup all m_pDupliGroupObject's in all
 	// instances refering to this group
-	if(newobj->GetInstanceObjects()) {
+	if (newobj->GetInstanceObjects()) {
 		for (int i = 0; i < newobj->GetInstanceObjects()->GetCount(); i++) {
 			KX_GameObject* instance = (KX_GameObject*)newobj->GetInstanceObjects()->GetValue(i);
 			instance->RemoveDupliGroupObject();
@@ -1254,9 +1254,9 @@ KX_FontObject* KX_Scene::FindFont(KX_FontObject* font)
 {
 	list<KX_FontObject*>::iterator it = m_fonts.begin();
 
-	while ( (it != m_fonts.end()) 
-			&& ((*it) != font) ) {
-	  ++it;
+	while ((it != m_fonts.end()) && ((*it) != font))
+	{
+		++it;
 	}
 
 	return ((it == m_fonts.end()) ? NULL : (*it));
@@ -1268,9 +1268,7 @@ KX_Camera* KX_Scene::FindCamera(KX_Camera* cam)
 {
 	list<KX_Camera*>::iterator it = m_cameras.begin();
 
-	while ( (it != m_cameras.end())
-	        && ((*it) != cam) )
-	{
+	while ((it != m_cameras.end()) && ((*it) != cam)) {
 		it++;
 	}
 
@@ -1282,9 +1280,7 @@ KX_Camera* KX_Scene::FindCamera(STR_String& name)
 {
 	list<KX_Camera*>::iterator it = m_cameras.begin();
 
-	while ( (it != m_cameras.end())
-	        && ((*it)->GetName() != name) )
-	{
+	while ((it != m_cameras.end()) && ((*it)->GetName() != name)) {
 		it++;
 	}
 
@@ -1509,8 +1505,8 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int
 		cam->GetProjectionMatrix().getValue(pmat);
 
 		dbvt_culling = m_physicsEnvironment->cullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res,
-														KX_GetActiveEngine()->GetCanvas()->GetViewPort(),
-														mvmat, pmat);
+		                                                 KX_GetActiveEngine()->GetCanvas()->GetViewPort(),
+		                                                 mvmat, pmat);
 	}
 	if (!dbvt_culling) {
 		// the physics engine couldn't help us, do it the hard way
@@ -1639,8 +1635,8 @@ RAS_MaterialBucket* KX_Scene::FindBucket(class RAS_IPolyMaterial* polymat, bool
 
 
 void KX_Scene::RenderBuckets(const MT_Transform & cameratransform,
-							 class RAS_IRasterizer* rasty,
-							 class RAS_IRenderTools* rendertools)
+                             class RAS_IRasterizer* rasty,
+                             class RAS_IRenderTools* rendertools)
 {
 	m_bucketmanager->Renderbuckets(cameratransform,rasty,rendertools);
 	KX_BlenderMaterial::EndFrame();
@@ -1710,6 +1706,17 @@ void	KX_Scene::SetGravity(const MT_Vector3& gravity)
 	GetPhysicsEnvironment()->setGravity(gravity[0],gravity[1],gravity[2]);
 }
 
+MT_Vector3 KX_Scene::GetGravity()
+{
+	PHY__Vector3 gravity;
+	MT_Vector3 vec;
+
+	GetPhysicsEnvironment()->getGravity(gravity);
+	vec = gravity.m_vec;
+
+	return vec;
+}
+
 void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter)
 {
 	m_sceneConverter = sceneConverter;
@@ -2047,11 +2054,11 @@ PyMethodDef KX_Scene::Methods[] = {
 };
 static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 {
-	KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(item);
 	PyObject *pyconvert;
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "val = scene[key]: KX_Scene, "BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -2073,12 +2080,12 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 
 static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 {
-	KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(key);
 	if (attr_str==NULL)
 		PyErr_Clear();
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "scene[key] = value: KX_Scene, "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -2120,9 +2127,9 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 
 static int Seq_Contains(PyObject *self_v, PyObject *value)
 {
-	KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
 	
-	if (self==NULL) {
+	if (self == NULL) {
 		PyErr_SetString(PyExc_SystemError, "val in scene: KX_Scene, "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -2134,45 +2141,45 @@ static int Seq_Contains(PyObject *self_v, PyObject *value)
 }
 
 PyMappingMethods KX_Scene::Mapping = {
-	(lenfunc)NULL					, 			/*inquiry mp_length */
-	(binaryfunc)Map_GetItem,		/*binaryfunc mp_subscript */
-	(objobjargproc)Map_SetItem,	/*objobjargproc mp_ass_subscript */
+	(lenfunc)NULL,                  /* inquiry mp_length */
+	(binaryfunc)Map_GetItem,        /* binaryfunc mp_subscript */
+	(objobjargproc)Map_SetItem,     /* objobjargproc mp_ass_subscript */
 };
 
 PySequenceMethods KX_Scene::Sequence = {
-	NULL,		/* Cant set the len otherwise it can evaluate as false */
-	NULL,		/* sq_concat */
-	NULL,		/* sq_repeat */
-	NULL,		/* sq_item */
-	NULL,		/* sq_slice */
-	NULL,		/* sq_ass_item */
-	NULL,		/* sq_ass_slice */
-	(objobjproc)Seq_Contains,	/* sq_contains */
-	(binaryfunc) NULL, /* sq_inplace_concat */
-	(ssizeargfunc) NULL, /* sq_inplace_repeat */
+	NULL,                       /* Cant set the len otherwise it can evaluate as false */
+	NULL,                       /* sq_concat */
+	NULL,                       /* sq_repeat */
+	NULL,                       /* sq_item */
+	NULL,                       /* sq_slice */
+	NULL,                       /* sq_ass_item */
+	NULL,                       /* sq_ass_slice */
+	(objobjproc)Seq_Contains,   /* sq_contains */
+	(binaryfunc) NULL,          /* sq_inplace_concat */
+	(ssizeargfunc) NULL,        /* sq_inplace_repeat */
 };
 
 PyObject *KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	return PyUnicode_From_STR_String(self->GetName());
 }
 
 PyObject *KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	return self->GetObjectList()->GetProxy();
 }
 
 PyObject *KX_Scene::pyattr_get_objects_inactive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	return self->GetInactiveList()->GetProxy();
 }
 
 PyObject *KX_Scene::pyattr_get_lights(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	return self->GetLightList()->GetProxy();
 }
 
@@ -2183,7 +2190,7 @@ PyObject *KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *a
 	 * however this is the same with "scene.objects + []", when you make a copy by adding lists.
 	 */
 	
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	CListValue* clist = new CListValue();
 	
 	/* return self->GetCameras()->GetProxy(); */
@@ -2199,7 +2206,7 @@ PyObject *KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *a
 
 PyObject *KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	KX_Camera* cam= self->GetActiveCamera();
 	if (cam)
 		return self->GetActiveCamera()->GetProxy();
@@ -2210,7 +2217,7 @@ PyObject *KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_
 
 int KX_Scene::pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_Scene* self= static_cast<KX_Scene*>(self_v);
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 	KX_Camera *camOb;
 	
 	if (!ConvertPythonToCamera(value, &camOb, false, "scene.active_camera = value: KX_Scene"))
@@ -2274,6 +2281,25 @@ int KX_Scene::pyattr_set_drawing_callback_post(void *self_v, const KX_PYATTRIBUT
 	return PY_SET_ATTR_SUCCESS;
 }
 
+PyObject *KX_Scene::pyattr_get_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
+
+	return PyObjectFrom(self->GetGravity());
+}
+
+int KX_Scene::pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+	KX_Scene* self = static_cast<KX_Scene*>(self_v);
+
+	MT_Vector3 vec;
+	if (!PyVecTo(value, vec))
+		return PY_SET_ATTR_FAIL;
+
+	self->SetGravity(vec);
+	return PY_SET_ATTR_SUCCESS;
+}
+
 PyAttributeDef KX_Scene::Attributes[] = {
 	KX_PYATTRIBUTE_RO_FUNCTION("name",				KX_Scene, pyattr_get_name),
 	KX_PYATTRIBUTE_RO_FUNCTION("objects",			KX_Scene, pyattr_get_objects),
@@ -2284,6 +2310,7 @@ PyAttributeDef KX_Scene::Attributes[] = {
 	KX_PYATTRIBUTE_RW_FUNCTION("active_camera",		KX_Scene, pyattr_get_active_camera, pyattr_set_active_camera),
 	KX_PYATTRIBUTE_RW_FUNCTION("pre_draw",			KX_Scene, pyattr_get_drawing_callback_pre, pyattr_set_drawing_callback_pre),
 	KX_PYATTRIBUTE_RW_FUNCTION("post_draw",			KX_Scene, pyattr_get_drawing_callback_post, pyattr_set_drawing_callback_post),
+	KX_PYATTRIBUTE_RW_FUNCTION("gravity",			KX_Scene, pyattr_get_gravity, pyattr_set_gravity),
 	KX_PYATTRIBUTE_BOOL_RO("suspended",				KX_Scene, m_suspend),
 	KX_PYATTRIBUTE_BOOL_RO("activity_culling",		KX_Scene, m_activity_culling),
 	KX_PYATTRIBUTE_FLOAT_RW("activity_culling_radius", 0.5f, FLT_MAX, KX_Scene, m_activity_box_radius),
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index c2e468e..2947394 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -573,6 +573,7 @@ public:
 	void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*	physEnv);
 
 	void	SetGravity(const MT_Vector3& gravity);
+	MT_Vector3 GetGravity();
 
 	short GetAnimationFPS();
 	
@@ -616,6 +617,8 @@ public:
 	static int			pyattr_set_drawing_callback_pre(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 	static PyObject*	pyattr_get_drawing_callback_post(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static int			pyattr_set_drawing_callback_post(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+	static PyObject*	pyattr_get_gravity(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static int			pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
 	virtual PyObject *py_repr(void) { return PyUnicode_From_STR_String(GetName()); }
 	
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index c0191db..2a4f2b3 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -53,7 +53,7 @@
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
-								   AUD_Reference<AUD_IFactory> sound,
+								   boost::shared_ptr<AUD_IFactory> sound,
 								   float volume,
 								   float pitch,
 								   bool is3d,
@@ -74,20 +74,20 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
 
 KX_SoundActuator::~KX_SoundActuator()
 {
-	if (!m_handle.isNull())
+	if (m_handle.get())
 		m_handle->stop();
 }
 
 void KX_SoundActuator::play()
 {
-	if (!m_handle.isNull())
+	if (m_handle.get())
 		m_handle->stop();
 
-	if (m_sound.isNull())
+	if (!m_sound.get())
 		return;
 
 	// this is the sound that will be played and not deleted afterwards
-	AUD_Reference<AUD_IFactory> sound = m_sound;
+	boost::shared_ptr<AUD_IFactory> sound = m_sound;
 
 	bool loop = false;
 
@@ -95,7 +95,7 @@ void KX_SoundActuator::play()
 	{
 	case KX_SOUNDACT_LOOPBIDIRECTIONAL:
 	case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
-		sound =  new AUD_PingPongFactory(sound);
+		sound = boost::shared_ptr<AUD_IFactory>(new AUD_PingPongFactory(sound));
 		// fall through
 	case KX_SOUNDACT_LOOPEND:
 	case KX_SOUNDACT_LOOPSTOP:
@@ -117,9 +117,9 @@ void KX_SoundActuator::play()
 		return;
 	}
 
-	AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle);
+	boost::shared_ptr<AUD_I3DHandle> handle3d = boost::dynamic_pointer_cast<AUD_I3DHandle>(m_handle);
 
-	if (m_is3d && !handle3d.isNull())
+	if (m_is3d && handle3d.get())
 	{
 		handle3d->setRelative(true);
 		handle3d->setVolumeMaximum(m_3d.max_gain);
@@ -149,7 +149,7 @@ CValue* KX_SoundActuator::GetReplica()
 void KX_SoundActuator::ProcessReplica()
 {
 	SCA_IActuator::ProcessReplica();
-	m_handle = AUD_Reference<AUD_IHandle>();
+	m_handle = boost::shared_ptr<AUD_IHandle>();
 }
 
 bool KX_SoundActuator::Update(double curtime, bool frame)
@@ -164,11 +164,11 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 	
 	RemoveAllEvents();
 
-	if (m_sound.isNull())
+	if (!m_sound.get())
 		return false;
 
 	// actual audio device playing state
-	bool isplaying = m_handle.isNull() ? false : (m_handle->getStatus() == AUD_STATUS_PLAYING);
+	bool isplaying = m_handle.get() ? (m_handle->getStatus() == AUD_STATUS_PLAYING) : false;
 
 	if (bNegativeEvent)
 	{
@@ -182,9 +182,9 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 			case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
 				{
 					// stop immediately
-					if (!m_handle.isNull())
+					if (m_handle.get())
 						m_handle->stop();
-					m_handle = AUD_Reference<AUD_IHandle>();
+					m_handle = boost::shared_ptr<AUD_IHandle>();
 					break;
 				}
 			case KX_SOUNDACT_PLAYEND:
@@ -196,7 +196,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 			case KX_SOUNDACT_LOOPBIDIRECTIONAL:
 				{
 					// stop the looping so that the sound stops when it finished
-					if (!m_handle.isNull())
+					if (m_handle.get())
 						m_handle->setLoopCount(0);
 					break;
 				}
@@ -223,13 +223,13 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 			play();
 	}
 	// verify that the sound is still playing
-	isplaying = m_handle.isNull() ? false : (m_handle->getStatus() == AUD_STATUS_PLAYING);
+	isplaying = m_handle.get() ? (m_handle->getStatus() == AUD_STATUS_PLAYING) : false;
 
 	if (isplaying)
 	{
-		AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle);
+		boost::shared_ptr<AUD_I3DHandle> handle3d = boost::dynamic_pointer_cast<AUD_I3DHandle>(m_handle);
 
-		if (m_is3d && !handle3d.isNull())
+		if (m_is3d && handle3d.get())
 		{
 			KX_Camera* cam = KX_GetActiveScene()->GetActiveCamera();
 			if (cam)
@@ -325,15 +325,14 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, startSound,
 "startSound()\n"
 "\tStarts the sound.\n")
 {
-	switch(m_handle.isNull() ? AUD_STATUS_INVALID : m_handle->getStatus())
-	{
-	case AUD_STATUS_PLAYING:
-		break;
-	case AUD_STATUS_PAUSED:
-		m_handle->resume();
-		break;
-	default:
-		play();
+	switch (m_handle.get() ? m_handle->getStatus() : AUD_STATUS_INVALID) {
+		case AUD_STATUS_PLAYING:
+			break;
+		case AUD_STATUS_PAUSED:
+			m_handle->resume();
+			break;
+		default:
+			play();
 	}
 	Py_RETURN_NONE;
 }
@@ -342,7 +341,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound,
 "pauseSound()\n"
 "\tPauses the sound.\n")
 {
-	if (!m_handle.isNull())
+	if (m_handle.get())
 		m_handle->pause();
 	Py_RETURN_NONE;
 }
@@ -351,9 +350,9 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
 "stopSound()\n"
 "\tStops the sound.\n")
 {
-	if (!m_handle.isNull())
+	if (m_handle.get())
 		m_handle->stop();
-	m_handle = AUD_Reference<AUD_IHandle>();
+	m_handle = boost::shared_ptr<AUD_IHandle>();
 	Py_RETURN_NONE;
 }
 
@@ -401,7 +400,7 @@ PyObject *KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_P
 	KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
 	float position = 0.0;
 
-	if (!actuator->m_handle.isNull())
+	if (actuator->m_handle.get())
 		position = actuator->m_handle->getPosition();
 
 	PyObject *result = PyFloat_FromDouble(position);
@@ -432,7 +431,7 @@ PyObject *KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI
 PyObject *KX_SoundActuator::pyattr_get_sound(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
 	KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
-	if (!actuator->m_sound.isNull())
+	if (actuator->m_sound.get())
 		return (PyObject *)AUD_getPythonFactory(&actuator->m_sound);
 	else
 		Py_RETURN_NONE;
@@ -447,49 +446,49 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI
 	if (!PyArg_Parse(value, "f", &prop_value))
 		return PY_SET_ATTR_FAIL;
 
-	AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(actuator->m_handle);
+	boost::shared_ptr<AUD_I3DHandle> handle3d = boost::dynamic_pointer_cast<AUD_I3DHandle>(actuator->m_handle);
 	// if sound is working and 3D, set the new setting
 	if (!actuator->m_is3d)
 		return PY_SET_ATTR_FAIL;
 
 	if (!strcmp(prop, "volume_maximum")) {
 		actuator->m_3d.max_gain = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setVolumeMaximum(prop_value);
 
 	} else if (!strcmp(prop, "volume_minimum")) {
 		actuator->m_3d.min_gain = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setVolumeMinimum(prop_value);
 
 	} else if (!strcmp(prop, "distance_reference")) {
 		actuator->m_3d.reference_distance = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setDistanceReference(prop_value);
 
 	} else if (!strcmp(prop, "distance_maximum")) {
 		actuator->m_3d.max_distance = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setDistanceMaximum(prop_value);
 
 	} else if (!strcmp(prop, "attenuation")) {
 		actuator->m_3d.rolloff_factor = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setAttenuation(prop_value);
 
 	} else if (!!strcmp(prop, "cone_angle_inner")) {
 		actuator->m_3d.cone_inner_angle = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setConeAngleInner(prop_value);
 
 	} else if (!strcmp(prop, "cone_angle_outer")) {
 		actuator->m_3d.cone_outer_angle = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setConeAngleOuter(prop_value);
 
 	} else if (!strcmp(prop, "cone_volume_outer")) {
 		actuator->m_3d.cone_outer_gain = prop_value;
-		if (!handle3d.isNull())
+		if (handle3d.get())
 			handle3d->setConeVolumeOuter(prop_value);
 
 	} else {
@@ -507,7 +506,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI
 	if (!PyArg_Parse(value, "f", &position))
 		return PY_SET_ATTR_FAIL;
 
-	if (!actuator->m_handle.isNull())
+	if (actuator->m_handle.get())
 		actuator->m_handle->seek(position);
 	return PY_SET_ATTR_SUCCESS;
 }
@@ -520,7 +519,7 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE
 		return PY_SET_ATTR_FAIL;
 
 	actuator->m_volume = gain;
-	if (!actuator->m_handle.isNull())
+	if (actuator->m_handle.get())
 		actuator->m_handle->setVolume(gain);
 
 	return PY_SET_ATTR_SUCCESS;
@@ -534,7 +533,7 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D
 		return PY_SET_ATTR_FAIL;
 
 	actuator->m_pitch = pitch;
-	if (!actuator->m_handle.isNull())
+	if (actuator->m_handle.get())
 		actuator->m_handle->setPitch(pitch);
 
 	return PY_SET_ATTR_SUCCESS;
@@ -547,7 +546,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D
 	if (!PyArg_Parse(value, "O", &sound))
 		return PY_SET_ATTR_FAIL;
 
-	AUD_Reference<AUD_IFactory>* snd = reinterpret_cast<AUD_Reference<AUD_IFactory>*>(AUD_getPythonSound((void *)sound));
+	boost::shared_ptr<AUD_IFactory>* snd = reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(AUD_getPythonSound((void *)sound));
 	if (snd)
 	{
 		actuator->m_sound = *snd;
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h
index 1ce44e9..68eff56 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.h
+++ b/source/gameengine/Ketsji/KX_SoundActuator.h
@@ -36,9 +36,9 @@
 
 #ifdef WITH_AUDASPACE
 #  include "AUD_C-API.h"
-#  include "AUD_Reference.h"
 #  include "AUD_IFactory.h"
 #  include "AUD_IHandle.h"
+#  include <boost/shared_ptr.hpp>
 #endif
 
 #include "BKE_sound.h"
@@ -58,12 +58,12 @@ class KX_SoundActuator : public SCA_IActuator
 {
 	Py_Header
 	bool					m_isplaying;
-	AUD_Reference<AUD_IFactory>				m_sound;
+	boost::shared_ptr<AUD_IFactory>				m_sound;
 	float					m_volume;
 	float					m_pitch;
 	bool					m_is3d;
 	KX_3DSoundSettings		m_3d;
-	AUD_Reference<AUD_IHandle>				m_handle;
+	boost::shared_ptr<AUD_IHandle>				m_handle;
 
 	void play();
 
@@ -84,7 +84,7 @@ public:
 	KX_SOUNDACT_TYPE		m_type;
 
 	KX_SoundActuator(SCA_IObject* gameobj,
-					 AUD_Reference<AUD_IFactory> sound,
+					 boost::shared_ptr<AUD_IFactory> sound,
 					 float volume,
 					 float pitch,
 					 bool is3d,
diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
index d167d0a..e097454 100644
--- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
@@ -32,8 +32,8 @@
 #ifndef __KX_TIMECATEGORYLOGGER_H__
 #define __KX_TIMECATEGORYLOGGER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* suppress stl-MSVC debug info warning */
 #endif
 
 #include <map>
diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h
index bafc27b..59d7bdc 100644
--- a/source/gameengine/Ketsji/KX_TimeLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeLogger.h
@@ -32,14 +32,14 @@
 #ifndef __KX_TIMELOGGER_H__
 #define __KX_TIMELOGGER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* suppress stl-MSVC debug info warning */
 #endif
 
 #include <deque>
 
 #ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+#  include "MEM_guardedalloc.h"
 #endif
 
 /**
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 885ac70..36e0bf6 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -333,7 +333,7 @@ PyAttributeDef KX_TouchSensor::Attributes[] = {
 
 PyObject *KX_TouchSensor::pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_TouchSensor* self= static_cast<KX_TouchSensor*>(self_v);
+	KX_TouchSensor* self = static_cast<KX_TouchSensor*>(self_v);
 	
 	if (self->m_hitObject)
 		return self->m_hitObject->GetProxy();
@@ -343,7 +343,7 @@ PyObject *KX_TouchSensor::pyattr_get_object_hit(void *self_v, const KX_PYATTRIBU
 
 PyObject *KX_TouchSensor::pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_TouchSensor* self= static_cast<KX_TouchSensor*>(self_v);
+	KX_TouchSensor* self = static_cast<KX_TouchSensor*>(self_v);
 	return self->m_colliders->GetProxy();
 }
 
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index b5d6f11..9cc91a3 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -126,13 +126,13 @@ PyObject *KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject *args)
 
 PyObject *KX_VehicleWrapper::PyGetNumWheels(PyObject *args)
 {
-	return PyLong_FromSsize_t(m_vehicle->GetNumWheels());
+	return PyLong_FromLong(m_vehicle->GetNumWheels());
 }
 
 
 PyObject *KX_VehicleWrapper::PyGetConstraintId(PyObject *args)
 {
-	return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId());
+	return PyLong_FromLong(m_vehicle->GetUserConstraintId());
 }
 
 
@@ -263,7 +263,7 @@ PyObject *KX_VehicleWrapper::PySetSteeringValue(PyObject *args)
 
 PyObject *KX_VehicleWrapper::PyGetConstraintType(PyObject *args)
 {
-	return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType());
+	return PyLong_FromLong(m_vehicle->GetUserConstraintType());
 }
 
 
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 461563d..2354359 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -61,19 +61,19 @@ PyTypeObject KX_VertexProxy::Type = {
 };
 
 PyMethodDef KX_VertexProxy::Methods[] = {
-{"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
-{"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
-{"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV,METH_NOARGS},
-{"setUV", (PyCFunction)KX_VertexProxy::sPySetUV,METH_O},
-
-{"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
-{"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
-
-{"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
-{"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
-{"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
-{"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
-  {NULL,NULL} //Sentinel
+	{"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
+	{"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
+	{"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV1, METH_NOARGS},
+	{"setUV", (PyCFunction)KX_VertexProxy::sPySetUV1, METH_O},
+
+	{"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
+	{"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
+
+	{"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
+	{"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
+	{"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
+	{"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
+	{NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_VertexProxy::Attributes[] = {
@@ -103,85 +103,85 @@ PyAttributeDef KX_VertexProxy::Attributes[] = {
 
 PyObject *KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getUV1()[0]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getUV1()[1]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getUV2()[0]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyFloat_FromDouble(self->m_vertex->getUV2()[1]);
 }
 
 PyObject *KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ()));
 }
 
 PyObject *KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
 }
 
 PyObject *KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	const unsigned char *colp = self->m_vertex->getRGBA();
 	MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
 	color /= 255.0;
@@ -190,13 +190,13 @@ PyObject *KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DE
 
 PyObject *KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal()));
 }
 
 int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -211,7 +211,7 @@ int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -226,7 +226,7 @@ int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -241,13 +241,13 @@ int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
 		MT_Point2 uv = self->m_vertex->getUV1();
 		uv[0] = val;
-		self->m_vertex->SetUV(uv);
+		self->m_vertex->SetUV1(uv);
 		self->m_mesh->SetMeshModified(true);
 		return PY_SET_ATTR_SUCCESS;
 	}
@@ -256,13 +256,13 @@ int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
 		MT_Point2 uv = self->m_vertex->getUV1();
 		uv[1] = val;
-		self->m_vertex->SetUV(uv);
+		self->m_vertex->SetUV1(uv);
 		self->m_mesh->SetMeshModified(true);
 		return PY_SET_ATTR_SUCCESS;
 	}
@@ -271,7 +271,7 @@ int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -286,7 +286,7 @@ int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF
 
 int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -301,7 +301,7 @@ int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF
 
 int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -318,7 +318,7 @@ int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -335,7 +335,7 @@ int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -352,7 +352,7 @@ int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PyFloat_Check(value))
 	{
 		float val = PyFloat_AsDouble(value);
@@ -369,7 +369,7 @@ int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *
 
 int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PySequence_Check(value))
 	{
 		MT_Point3 vec;
@@ -385,13 +385,12 @@ int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF
 
 int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PySequence_Check(value))
 	{
 		MT_Point2 vec;
-		if (PyVecTo(value, vec))
-		{
-			self->m_vertex->SetUV(vec);
+		if (PyVecTo(value, vec)) {
+			self->m_vertex->SetUV1(vec);
 			self->m_mesh->SetMeshModified(true);
 			return PY_SET_ATTR_SUCCESS;
 		}
@@ -401,7 +400,7 @@ int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF
 
 int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PySequence_Check(value))
 	{
 		MT_Vector4 vec;
@@ -417,7 +416,7 @@ int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_D
 
 int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
-	KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+	KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
 	if (PySequence_Check(value))
 	{
 		MT_Vector3 vec;
@@ -495,13 +494,13 @@ PyObject *KX_VertexProxy::PySetNormal(PyObject *value)
 PyObject *KX_VertexProxy::PyGetRGBA()
 {
 	int *rgba = (int *) m_vertex->getRGBA();
-	return PyLong_FromSsize_t(*rgba);
+	return PyLong_FromLong(*rgba);
 }
 
 PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
 {
 	if (PyLong_Check(value)) {
-		int rgba = PyLong_AsSsize_t(value);
+		int rgba = PyLong_AsLong(value);
 		m_vertex->SetRGBA(rgba);
 		m_mesh->SetMeshModified(true);
 		Py_RETURN_NONE;
@@ -521,18 +520,18 @@ PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
 }
 
 
-PyObject *KX_VertexProxy::PyGetUV()
+PyObject *KX_VertexProxy::PyGetUV1()
 {
 	return PyObjectFrom(MT_Vector2(m_vertex->getUV1()));
 }
 
-PyObject *KX_VertexProxy::PySetUV(PyObject *value)
+PyObject *KX_VertexProxy::PySetUV1(PyObject *value)
 {
 	MT_Point2 vec;
 	if (!PyVecTo(value, vec))
 		return NULL;
 
-	m_vertex->SetUV(vec);
+	m_vertex->SetUV1(vec);
 	m_mesh->SetMeshModified(true);
 	Py_RETURN_NONE;
 }
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index 6e193d3..4247d13 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -92,8 +92,8 @@ public:
 
 	KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ);
 	KX_PYMETHOD_O(KX_VertexProxy,SetXYZ);
-	KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV);
-	KX_PYMETHOD_O(KX_VertexProxy,SetUV);
+	KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV1);
+	KX_PYMETHOD_O(KX_VertexProxy,SetUV1);
 	
 	KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV2);
 	KX_PYMETHOD_VARARGS(KX_VertexProxy,SetUV2);
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 5fdf250..88689a5 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -24,6 +24,7 @@ incs += ' #extern/recastnavigation/Recast/Include #extern/recastnavigation/Detou
 
 incs += ' ' + env['BF_BULLET_INC']
 incs += ' ' + env['BF_OPENGL_INC']
+incs += ' ' + env['BF_BOOST_INC']
 
 if  env['WITH_BF_SDL']:
     incs += ' ' + env['BF_SDL_INC']
diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h
index 48edbdf..6da478e 100644
--- a/source/gameengine/Network/NG_NetworkDeviceInterface.h
+++ b/source/gameengine/Network/NG_NetworkDeviceInterface.h
@@ -43,8 +43,8 @@ private:
 	// candidates for shared/common implementation class
 	bool m_online;
 public:
-	NG_NetworkDeviceInterface() {};
-	virtual ~NG_NetworkDeviceInterface() {};
+	NG_NetworkDeviceInterface() {}
+	virtual ~NG_NetworkDeviceInterface() {}
 
 	virtual void NextFrame()=0;
 
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index cdae3cc..43b1bfe 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -37,7 +37,6 @@ set(INC
 	../../../blender/blenkernel
 	../../../blender/blenlib
 	../../../blender/makesdna
-	../../../../extern/bullet2/src
 	../../../../intern/container
 	../../../../intern/guardedalloc
 	../../../../intern/moto/include
@@ -45,6 +44,7 @@ set(INC
 )
 
 set(INC_SYS
+	../../../../extern/bullet2/src
 	${GLEW_INCLUDE_PATH}
 	${PYTHON_INCLUDE_DIRS}
 )
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 240bda8..6c6ce94 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -46,9 +46,11 @@ subject to the following restrictions:
 #include "DNA_meshdata_types.h"
 
 extern "C"{
-#include "BKE_cdderivedmesh.h"
+	#include "BLI_utildefines.h"
+	#include "BKE_cdderivedmesh.h"
 }
 
+
 class BP_Proxy;
 
 ///todo: fill all the empty CcdPhysicsController methods, hook them up to the btRigidBody class
@@ -215,8 +217,7 @@ bool CcdPhysicsController::CreateSoftbody()
 	btSoftBody* psb  = 0;
 	btSoftBodyWorldInfo& worldInfo = m_cci.m_physicsEnv->getDynamicsWorld()->getWorldInfo();
 
-	if (m_cci.m_collisionShape->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE)
-	{
+	if (m_cci.m_collisionShape->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE) {
 		btConvexHullShape* convexHull = (btConvexHullShape* )m_cci.m_collisionShape;
 		{
 			int nvertices = convexHull->getNumPoints();
@@ -224,26 +225,25 @@ bool CcdPhysicsController::CreateSoftbody()
 
 			HullDesc		hdsc(QF_TRIANGLES,nvertices,vertices);
 			HullResult		hres;
-			HullLibrary		hlib;/*??*/ 
+			HullLibrary		hlib;  /*??*/
 			hdsc.mMaxVertices=nvertices;
 			hlib.CreateConvexHull(hdsc,hres);
 			
-			psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices,
-				&hres.m_OutputVertices[0],0);
-			for (int i=0;i<(int)hres.mNumFaces;++i)
-			{
-				const int idx[]={	hres.m_Indices[i*3+0],
-					hres.m_Indices[i*3+1],
-					hres.m_Indices[i*3+2]};
-				if (idx[0]<idx[1]) psb->appendLink(	idx[0],idx[1]);
-				if (idx[1]<idx[2]) psb->appendLink(	idx[1],idx[2]);
-				if (idx[2]<idx[0]) psb->appendLink(	idx[2],idx[0]);
-				psb->appendFace(idx[0],idx[1],idx[2]);
+			psb = new btSoftBody(&worldInfo, (int)hres.mNumOutputVertices,
+			                     &hres.m_OutputVertices[0], 0);
+			for (int i = 0; i < (int)hres.mNumFaces; ++i) {
+				const unsigned int idx[3] = {hres.m_Indices[i * 3 + 0],
+				                             hres.m_Indices[i * 3 + 1],
+				                             hres.m_Indices[i * 3 + 2]};
+				if (idx[0] < idx[1]) psb->appendLink(idx[0], idx[1]);
+				if (idx[1] < idx[2]) psb->appendLink(idx[1], idx[2]);
+				if (idx[2] < idx[0]) psb->appendLink(idx[2], idx[0]);
+				psb->appendFace(idx[0], idx[1], idx[2]);
 			}
 			hlib.ReleaseResult(hres);
 		}
-	} else
-	{
+	}
+	else {
 		int numtris = 0;
 		if (m_cci.m_collisionShape->getShapeType() ==SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE)
 		{
@@ -1502,9 +1502,15 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 	MFace *mface = dm->getTessFaceArray(dm);
 	numpolys = dm->getNumTessFaces(dm);
 	numverts = dm->getNumVerts(dm);
-	int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
 
+	/* double lookup */
+	const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	const int *index_mp_to_orig  = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
+	}
+
 	m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
 
 	/* Convert blender geometry into bullet mesh, need these vars for mapping */
@@ -1517,15 +1523,16 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 		for (int p2=0; p2<numpolys; p2++)
 		{
 			MFace* mf = &mface[p2];
-			RAS_Polygon* poly = meshobj->GetPolygon((index)? index[p2]: p2);
+			const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+			RAS_Polygon* poly = meshobj->GetPolygon(origi);
 
 			// only add polygons that have the collision flag set
 			if (poly->IsCollider())
 			{
-				if (vert_tag_array[mf->v1]==false) {vert_tag_array[mf->v1]= true;tot_bt_verts++;}
-				if (vert_tag_array[mf->v2]==false) {vert_tag_array[mf->v2]= true;tot_bt_verts++;}
-				if (vert_tag_array[mf->v3]==false) {vert_tag_array[mf->v3]= true;tot_bt_verts++;}
-				if (mf->v4 && vert_tag_array[mf->v4]==false) {vert_tag_array[mf->v4]= true;tot_bt_verts++;}
+				if (vert_tag_array[mf->v1] == false) {vert_tag_array[mf->v1] = true; tot_bt_verts++;}
+				if (vert_tag_array[mf->v2] == false) {vert_tag_array[mf->v2] = true; tot_bt_verts++;}
+				if (vert_tag_array[mf->v3] == false) {vert_tag_array[mf->v3] = true; tot_bt_verts++;}
+				if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;}
 			}
 		}
 
@@ -1536,7 +1543,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 		for (int p2=0; p2<numpolys; p2++)
 		{
 			MFace* mf = &mface[p2];
-			RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+			const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+			RAS_Polygon* poly= meshobj->GetPolygon(origi);
 
 			// only add polygons that have the collisionflag set
 			if (poly->IsCollider())
@@ -1544,7 +1552,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				if (vert_tag_array[mf->v1]==true)
 				{
 					const float* vtx = mvert[mf->v1].co;
-					vert_tag_array[mf->v1]= false;
+					vert_tag_array[mf->v1] = false;
 					*bt++ = vtx[0];
 					*bt++ = vtx[1];
 					*bt++ = vtx[2];
@@ -1552,7 +1560,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				if (vert_tag_array[mf->v2]==true)
 				{
 					const float* vtx = mvert[mf->v2].co;
-					vert_tag_array[mf->v2]= false;
+					vert_tag_array[mf->v2] = false;
 					*bt++ = vtx[0];
 					*bt++ = vtx[1];
 					*bt++ = vtx[2];
@@ -1560,7 +1568,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				if (vert_tag_array[mf->v3]==true)
 				{
 					const float* vtx = mvert[mf->v3].co;
-					vert_tag_array[mf->v3]= false;
+					vert_tag_array[mf->v3] = false;
 					*bt++ = vtx[0];
 					*bt++ = vtx[1];
 					*bt++ = vtx[2];
@@ -1568,7 +1576,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				if (mf->v4 && vert_tag_array[mf->v4]==true)
 				{
 					const float* vtx = mvert[mf->v4].co;
-					vert_tag_array[mf->v4]= false;
+					vert_tag_array[mf->v4] = false;
 					*bt++ = vtx[0];
 					*bt++ = vtx[1];
 					*bt++ = vtx[2];
@@ -1584,19 +1592,20 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 		for (int p2=0; p2<numpolys; p2++)
 		{
 			MFace* mf = &mface[p2];
-			RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+			const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+			RAS_Polygon* poly= meshobj->GetPolygon(origi);
 
 			// only add polygons that have the collision flag set
 			if (poly->IsCollider())
 			{
 				if (vert_tag_array[mf->v1]==false)
-					{vert_tag_array[mf->v1]= true;vert_remap_array[mf->v1]= tot_bt_verts;tot_bt_verts++;}
+					{vert_tag_array[mf->v1] = true;vert_remap_array[mf->v1] = tot_bt_verts;tot_bt_verts++;}
 				if (vert_tag_array[mf->v2]==false)
-					{vert_tag_array[mf->v2]= true;vert_remap_array[mf->v2]= tot_bt_verts;tot_bt_verts++;}
+					{vert_tag_array[mf->v2] = true;vert_remap_array[mf->v2] = tot_bt_verts;tot_bt_verts++;}
 				if (vert_tag_array[mf->v3]==false)
-					{vert_tag_array[mf->v3]= true;vert_remap_array[mf->v3]= tot_bt_verts;tot_bt_verts++;}
+					{vert_tag_array[mf->v3] = true;vert_remap_array[mf->v3] = tot_bt_verts;tot_bt_verts++;}
 				if (mf->v4 && vert_tag_array[mf->v4]==false)
-					{vert_tag_array[mf->v4]= true;vert_remap_array[mf->v4]= tot_bt_verts;tot_bt_verts++;}
+					{vert_tag_array[mf->v4] = true;vert_remap_array[mf->v4] = tot_bt_verts;tot_bt_verts++;}
 				tot_bt_tris += (mf->v4 ? 2:1); /* a quad or a tri */
 			}
 		}
@@ -1621,7 +1630,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 		{
 			MFace* mf = &mface[p2];
 			MTFace* tf = (tface) ? &tface[p2] : NULL;
-			RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+			const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+			RAS_Polygon* poly= meshobj->GetPolygon(origi);
 
 			// only add polygons that have the collisionflag set
 			if (poly->IsCollider())
@@ -1631,9 +1641,9 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				MVert *v3= &mvert[mf->v3];
 
 				// the face indices
-				tri_pt[0]= vert_remap_array[mf->v1];
-				tri_pt[1]= vert_remap_array[mf->v2];
-				tri_pt[2]= vert_remap_array[mf->v3];
+				tri_pt[0] = vert_remap_array[mf->v1];
+				tri_pt[1] = vert_remap_array[mf->v2];
+				tri_pt[2] = vert_remap_array[mf->v3];
 				tri_pt= tri_pt+3;
 				if (tf)
 				{
@@ -1647,24 +1657,24 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				}
 
 				// m_polygonIndexArray
-				*poly_index_pt= (index)? index[p2]: p2;
+				*poly_index_pt = origi;
 				poly_index_pt++;
 
 				// the vertex location
 				if (vert_tag_array[mf->v1]==true) { /* *** v1 *** */
-					vert_tag_array[mf->v1]= false;
+					vert_tag_array[mf->v1] = false;
 					*bt++ = v1->co[0];
 					*bt++ = v1->co[1];
 					*bt++ = v1->co[2];
 				}
 				if (vert_tag_array[mf->v2]==true) { /* *** v2 *** */
-					vert_tag_array[mf->v2]= false;
+					vert_tag_array[mf->v2] = false;
 					*bt++ = v2->co[0];
 					*bt++ = v2->co[1];
 					*bt++ = v2->co[2];
 				}
 				if (vert_tag_array[mf->v3]==true) { /* *** v3 *** */
-					vert_tag_array[mf->v3]= false;
+					vert_tag_array[mf->v3] = false;
 					*bt++ = v3->co[0];
 					*bt++ = v3->co[1];
 					*bt++ = v3->co[2];
@@ -1674,9 +1684,9 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				{
 					MVert *v4= &mvert[mf->v4];
 
-					tri_pt[0]= vert_remap_array[mf->v1];
-					tri_pt[1]= vert_remap_array[mf->v3];
-					tri_pt[2]= vert_remap_array[mf->v4];
+					tri_pt[0] = vert_remap_array[mf->v1];
+					tri_pt[1] = vert_remap_array[mf->v3];
+					tri_pt[2] = vert_remap_array[mf->v4];
 					tri_pt= tri_pt+3;
 					if (tf)
 					{
@@ -1690,12 +1700,12 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 					}
 
 					// m_polygonIndexArray
-					*poly_index_pt= (index)? index[p2]: p2;
+					*poly_index_pt = origi;
 					poly_index_pt++;
 
 					// the vertex location
-					if (vert_tag_array[mf->v4]==true) { /* *** v4 *** */
-						vert_tag_array[mf->v4]= false;
+					if (vert_tag_array[mf->v4] == true) { /* *** v4 *** */
+						vert_tag_array[mf->v4] = false;
 						*bt++ = v4->co[0];
 						*bt++ = v4->co[1];
 						*bt++ = v4->co[2];
@@ -1802,7 +1812,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 		MFace *mface = dm->getTessFaceArray(dm);
 		numpolys = dm->getNumTessFaces(dm);
 		numverts = dm->getNumVerts(dm);
-		int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+
+		/* double lookup */
+		const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+		const int *index_mp_to_orig  = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
+		if (index_mf_to_mpoly == NULL) {
+			index_mp_to_orig = NULL;
+		}
 
 		MFace *mf;
 		MVert *mv;
@@ -1834,8 +1850,8 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 
 						if (vert_tag_array[v_orig]==false)
 						{
-							vert_tag_array[v_orig]= true;
-							vert_remap_array[v_orig]= tot_bt_verts;
+							vert_tag_array[v_orig] = true;
+							vert_remap_array[v_orig] = tot_bt_verts;
 							tot_bt_verts++;
 						}
 					}
@@ -1858,7 +1874,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 			{
 				if (tf->mode & TF_DYNAMIC)
 				{
-					int origi = (index)? index[i]: i;
+					int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i;
 
 					if (mf->v4) {
 						fv_pt= quad_verts;
@@ -1882,7 +1898,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 							*bt++ = mv->co[1];
 							*bt++ = mv->co[2];
 
-							vert_tag_array[v_orig]= false;
+							vert_tag_array[v_orig] = false;
 						}
 						*tri_pt++ = vert_remap_array[v_orig];
 						uv_pt->uv[0] = tf->uv[*fv_pt][0];
@@ -1917,7 +1933,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 			}
 
 			for (mf= mface, i=0; i < numpolys; mf++, i++) {
-				int origi = (index)? index[i]: i;
+				int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i;
 
 				if (mf->v4) {
 					fv_pt= quad_verts;
@@ -1943,7 +1959,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 
 		/* transverts are only used for deformed RAS_Meshes, the RAS_TexVert data
 		 * is too hard to get at, see below for details */
-		float (*transverts)[3]= NULL;
+		float (*transverts)[3] = NULL;
 		int transverts_tot= 0; /* with deformed meshes - should always be greater then the max orginal index, or we get crashes */
 
 		if (deformer) {
@@ -1973,8 +1989,8 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 					v_orig= poly->GetVertex(i)->getOrigIndex();
 					if (vert_tag_array[v_orig]==false)
 					{
-						vert_tag_array[v_orig]= true;
-						vert_remap_array[v_orig]= tot_bt_verts;
+						vert_tag_array[v_orig] = true;
+						vert_remap_array[v_orig] = tot_bt_verts;
 						tot_bt_verts++;
 					}
 				}
@@ -2027,14 +2043,14 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 							*bt++ = xyz[2];
 						}
 
-						vert_tag_array[v_orig]= false;
+						vert_tag_array[v_orig] = false;
 					}
 
 					*tri_pt++ = vert_remap_array[v_orig];
 				}
 			}
 
-			m_polygonIndexArray[p]= p; /* dumb counting */
+			m_polygonIndexArray[p] = p; /* dumb counting */
 		}
 	}
 	
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 82a60e7..486411d 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -37,6 +37,7 @@ subject to the following restrictions:
 
 
 #include "PHY_IMotionState.h"
+#include "PHY_ICharacter.h"
 #include "KX_GameObject.h"
 #include "RAS_MeshObject.h"
 #include "RAS_Polygon.h"
@@ -266,6 +267,36 @@ public:
 };
 #endif //NEW_BULLET_VEHICLE_SUPPORT
 
+class CharacterWrapper : public PHY_ICharacter
+{
+private:
+	btKinematicCharacterController* m_controller;
+
+public:
+	CharacterWrapper(btKinematicCharacterController* cont)
+		: m_controller(cont)
+	{}
+
+	virtual void Jump()
+	{
+		m_controller->jump();
+	}
+
+	virtual bool OnGround()
+	{
+		return m_controller->onGround();
+	}
+
+	virtual float GetGravity()
+	{
+		return m_controller->getGravity();
+	}
+	virtual void SetGravity(float gravity)
+	{
+		m_controller->setGravity(gravity);
+	}
+};
+
 class CcdOverlapFilterCallBack : public btOverlapFilterCallback
 {
 private:
@@ -1078,7 +1109,7 @@ static bool GetHitTriangle(btCollisionShape* shape, CcdShapeConstructionInfo* sh
 	const btVector3& meshScaling = shape->getLocalScaling();
 	for (int j=2;j>=0;j--)
 	{
-		int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
+		int graphicsindex = (indicestype == PHY_SHORT) ? ((unsigned short *)gfxbase)[j] : gfxbase[j];
 
 		btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
 
@@ -1517,8 +1548,8 @@ struct OcclusionBuffer
 						return(true);
 				}
 			}
-		} else if (width == 1) 
-		{
+		}
+		else if (width == 1)  {
 			// Degenerated in at least 2 vertical lines
 			// The algorithm below doesn't work when face has a single pixel width
 			// We cannot use general formulas because the plane is degenerated. 
@@ -1529,16 +1560,16 @@ struct OcclusionBuffer
 			if (y[0] > y[1]) { ytmp=y[1];y[1]=y[0];y[0]=ytmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; }
 			if (y[0] > y[2]) { ytmp=y[2];y[2]=y[0];y[0]=ytmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; }
 			if (y[1] > y[2]) { ytmp=y[2];y[2]=y[1];y[1]=ytmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; }
-			int	dy[]={	y[0]-y[1],
-						y[1]-y[2],
-						y[2]-y[0]};
+			int	dy[] = {y[0] - y[1],
+			            y[1] - y[2],
+			            y[2] - y[0]};
 			btScalar dzy[3];
-			dzy[0] = (dy[0]) ? (z[0]-z[1])/dy[0] : btScalar(0.f);
-			dzy[1] = (dy[1]) ? (z[1]-z[2])/dy[1] : btScalar(0.f);
-			dzy[2] = (dy[2]) ? (z[2]-z[0])/dy[2] : btScalar(0.f);
-			btScalar v[3] = {	dzy[0]*(miy-y[0])+z[0],
-								dzy[1]*(miy-y[1])+z[1],
-								dzy[2]*(miy-y[2])+z[2] };
+			dzy[0] = (dy[0]) ? (z[0] - z[1]) / dy[0] : btScalar(0.f);
+			dzy[1] = (dy[1]) ? (z[1] - z[2]) / dy[1] : btScalar(0.f);
+			dzy[2] = (dy[2]) ? (z[2] - z[0]) / dy[2] : btScalar(0.f);
+			btScalar v[3] = {dzy[0] * (miy - y[0]) + z[0],
+			                 dzy[1] * (miy - y[1]) + z[1],
+			                 dzy[2] * (miy - y[2]) + z[2]};
 			dy[0] = y[1]-y[0];
 			dy[1] = y[0]-y[1];
 			dy[2] = y[2]-y[0];
@@ -1566,16 +1597,16 @@ struct OcclusionBuffer
 			if (x[0] > x[1]) { xtmp=x[1];x[1]=x[0];x[0]=xtmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; }
 			if (x[0] > x[2]) { xtmp=x[2];x[2]=x[0];x[0]=xtmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; }
 			if (x[1] > x[2]) { xtmp=x[2];x[2]=x[1];x[1]=xtmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; }
-			int	dx[]={	x[0]-x[1],
-						x[1]-x[2],
-						x[2]-x[0]};
+			int dx[] = {x[0] - x[1],
+			            x[1] - x[2],
+			            x[2] - x[0]};
 			btScalar dzx[3];
 			dzx[0] = (dx[0]) ? (z[0]-z[1])/dx[0] : btScalar(0.f);
 			dzx[1] = (dx[1]) ? (z[1]-z[2])/dx[1] : btScalar(0.f);
 			dzx[2] = (dx[2]) ? (z[2]-z[0])/dx[2] : btScalar(0.f);
-			btScalar v[3] = { dzx[0]*(mix-x[0])+z[0],
-							  dzx[1]*(mix-x[1])+z[1],
-							  dzx[2]*(mix-x[2])+z[2] };
+			btScalar v[3] = {dzx[0] * (mix - x[0]) + z[0],
+			                 dzx[1] * (mix - x[1]) + z[1],
+			                 dzx[2] * (mix - x[2]) + z[2]};
 			dx[0] = x[1]-x[0];
 			dx[1] = x[0]-x[1];
 			dx[2] = x[2]-x[0];
@@ -1592,24 +1623,24 @@ struct OcclusionBuffer
 				v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2];
 				dx[0]--; dx[1]++, dx[2]--;
 			}
-		} else
-		{
+		}
+		else {
 			// general case
-			const int		dx[]={	y[0]-y[1],
-									y[1]-y[2],
-									y[2]-y[0]};
-			const int		dy[]={	x[1]-x[0]-dx[0]*width,
-									x[2]-x[1]-dx[1]*width,
-									x[0]-x[2]-dx[2]*width};
-			const int		a=x[2]*y[0]+x[0]*y[1]-x[2]*y[1]-x[0]*y[2]+x[1]*y[2]-x[1]*y[0];
-			const btScalar	ia=1/(btScalar)a;
-			const btScalar	dzx=ia*(y[2]*(z[1]-z[0])+y[1]*(z[0]-z[2])+y[0]*(z[2]-z[1]));
-			const btScalar	dzy=ia*(x[2]*(z[0]-z[1])+x[0]*(z[1]-z[2])+x[1]*(z[2]-z[0]))-(dzx*width);
-			int				c[]={	miy*x[1]+mix*y[0]-x[1]*y[0]-mix*y[1]+x[0]*y[1]-miy*x[0],
-									miy*x[2]+mix*y[1]-x[2]*y[1]-mix*y[2]+x[1]*y[2]-miy*x[1],
-									miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]};
-			btScalar		v=ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2]));
-			btScalar*		scan=&m_buffer[miy*m_sizes[0]];
+			const int       dx[] = {y[0] - y[1],
+			                        y[1] - y[2],
+			                        y[2] - y[0]};
+			const int       dy[] = {x[1] - x[0] - dx[0] * width,
+			                        x[2] - x[1] - dx[1] * width,
+			                        x[0] - x[2] - dx[2] * width};
+			const int       a = x[2] * y[0] + x[0] * y[1] - x[2] * y[1] - x[0] * y[2] + x[1] * y[2] - x[1] * y[0];
+			const btScalar  ia = 1 / (btScalar)a;
+			const btScalar  dzx = ia*(y[2]*(z[1]-z[0])+y[1]*(z[0]-z[2])+y[0]*(z[2]-z[1]));
+			const btScalar  dzy = ia*(x[2]*(z[0]-z[1])+x[0]*(z[1]-z[2])+x[1]*(z[2]-z[0]))-(dzx*width);
+			int             c[] = {miy*x[1]+mix*y[0]-x[1]*y[0]-mix*y[1]+x[0]*y[1]-miy*x[0],
+			                        miy*x[2]+mix*y[1]-x[2]*y[1]-mix*y[2]+x[1]*y[2]-miy*x[1],
+			                        miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]};
+			btScalar        v = ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2]));
+			btScalar       *scan = &m_buffer[miy*m_sizes[0]];
 			for (int iy=miy;iy<mxy;++iy)
 			{
 				for (int ix=mix;ix<mxx;++ix)
@@ -1696,18 +1727,18 @@ struct OcclusionBuffer
 			// the box is clipped, it's probably a large box, don't waste our time to check
 			if ((x[i][2]+x[i][3])<=0) return(true);
 		}
-		static const int	d[]={	1,0,3,2,
-									4,5,6,7,
-									4,7,3,0,
-									6,5,1,2,
-									7,6,2,3,
-									5,4,0,1};
+		static const int d[] = {1,0,3,2,
+		                        4,5,6,7,
+		                        4,7,3,0,
+		                        6,5,1,2,
+		                        7,6,2,3,
+		                        5,4,0,1};
 		for (unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));)
 		{
-			const btVector4	p[]={	x[d[i++]],
-									x[d[i++]],
-									x[d[i++]],
-									x[d[i++]]};
+			const btVector4 p[] = {x[d[i++]],
+			                       x[d[i++]],
+			                       x[d[i++]],
+			                       x[d[i++]]};
 			if (clipDraw<4,QueryOCL>(p,1.f,0.f)) 
 				return(true);
 		}
@@ -1966,8 +1997,8 @@ void	CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
 					btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint;
 					int transMotorIndex = param-6;
 					btTranslationalLimitMotor* transMotor = genCons->getTranslationalLimitMotor();
-					transMotor->m_targetVelocity[transMotorIndex]= value0;
-					transMotor->m_maxMotorForce[transMotorIndex]=value1;
+					transMotor->m_targetVelocity[transMotorIndex] = value0;
+					transMotor->m_maxMotorForce[transMotorIndex] = value1;
 					transMotor->m_enableMotor[transMotorIndex] = (value1>0.f);
 					break;
 				}
@@ -2208,10 +2239,29 @@ bool CcdOverlapFilterCallBack::needBroadphaseCollision(btBroadphaseProxy* proxy0
 {
 	btCollisionObject *colObj0, *colObj1;
 	CcdPhysicsController *sensorCtrl, *objCtrl;
+
+	KX_GameObject *kxObj0 = KX_GameObject::GetClientObject(
+			(KX_ClientObjectInfo*)
+			((CcdPhysicsController*)
+					(((btCollisionObject*)proxy0->m_clientObject)->getUserPointer()))
+			->getNewClientInfo());
+	KX_GameObject *kxObj1 = KX_GameObject::GetClientObject(
+			(KX_ClientObjectInfo*)
+			((CcdPhysicsController*)
+					(((btCollisionObject*)proxy1->m_clientObject)->getUserPointer()))
+			->getNewClientInfo());
+
+	// First check the filters. Note that this is called during scene
+	// conversion, so we can't assume the KX_GameObject instances exist. This
+	// may make some objects erroneously collide on the first frame, but the
+	// alternative is to have them erroneously miss.
 	bool collides;
-	// first check the filters
 	collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
 	collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
+	if (kxObj0 && kxObj1) {
+		collides = collides && kxObj0->CheckCollision(kxObj1);
+		collides = collides && kxObj1->CheckCollision(kxObj0);
+	}
 	if (!collides)
 		return false;
 
@@ -2266,6 +2316,15 @@ PHY_IVehicle*	CcdPhysicsEnvironment::getVehicleConstraint(int constraintId)
 #endif //NEW_BULLET_VEHICLE_SUPPORT
 
 
+PHY_ICharacter* CcdPhysicsEnvironment::getCharacterController(KX_GameObject *ob)
+{
+	CcdPhysicsController* controller = (CcdPhysicsController*)ob->GetPhysicsController()->GetUserData();
+	if (controller->GetCharacterController())
+		return new CharacterWrapper(controller->GetCharacterController());
+
+	return NULL;
+}
+
 int currentController = 0;
 int numController = 0;
 
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index 350ecd2..18ce055 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -184,6 +184,8 @@ protected:
 			return 0;
 		}
 #endif  /* NEW_BULLET_VEHICLE_SUPPORT */
+		// Character physics wrapper
+		virtual PHY_ICharacter*	getCharacterController(class KX_GameObject* ob);
 
 		btTypedConstraint*	getConstraintById(int constraintId);
 
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
index d1a8143..d1fabba 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
@@ -85,8 +85,9 @@ void DummyPhysicsEnvironment::setGravity(float x,float y,float z)
 {
 }
 
-
-
+void DummyPhysicsEnvironment::getGravity(PHY__Vector3& grav)
+{
+}
 
 
 
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index 70de9c2..5ce34bd 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -56,6 +56,7 @@ public:
 	virtual	float		getFixedTimeStep();
 
 	virtual	void		setGravity(float x,float y,float z);
+	virtual	void		getGravity(PHY__Vector3& grav);
 
 	virtual int			createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
 			float pivotX,float pivotY,float pivotZ,
@@ -72,6 +73,12 @@ public:
 		return 0;
 	}
 
+		// Character physics wrapper
+	virtual PHY_ICharacter*	getCharacterController(class KX_GameObject* ob)
+	{
+		return 0;
+	}
+
 	virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
 	virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; }
 
diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt
index ceb7a8b..400e475 100644
--- a/source/gameengine/Physics/common/CMakeLists.txt
+++ b/source/gameengine/Physics/common/CMakeLists.txt
@@ -41,6 +41,7 @@ set(SRC
 	PHY_IVehicle.cpp
 
 	PHY_DynamicTypes.h
+	PHY_ICharacter.h
 	PHY_IController.h
 	PHY_IGraphicController.h
 	PHY_IMotionState.h
diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h
new file mode 100644
index 0000000..e2fc5e4
--- /dev/null
+++ b/source/gameengine/Physics/common/PHY_ICharacter.h
@@ -0,0 +1,30 @@
+
+/** \file PHY_ICharacter.h
+ *  \ingroup phys
+ */
+
+#ifndef __PHY_ICHARACTER_H__
+#define __PHY_ICHARACTER_H__
+
+//PHY_ICharacter provides a generic interface for "character" controllers
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+class PHY_ICharacter
+{
+public:	
+
+	virtual void Jump()= 0;
+	virtual bool OnGround()= 0;
+
+	virtual float GetGravity()= 0;
+	virtual void SetGravity(float gravity)= 0;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+	MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_ICharacter")
+#endif
+};
+
+#endif //__PHY_ICHARACTER_H__
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 66ca037..bfbe570 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -40,6 +40,7 @@
 #endif
 
 class PHY_IVehicle;
+class PHY_ICharacter;
 class RAS_MeshObject;
 class PHY_IPhysicsController;
 
@@ -142,6 +143,7 @@ class PHY_IPhysicsEnvironment
 		virtual void		setUseEpa(bool epa) {}
 
 		virtual	void		setGravity(float x,float y,float z)=0;
+		virtual	void		getGravity(PHY__Vector3& grav) = 0;
 
 		virtual int			createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
 			float pivotX,float pivotY,float pivotZ,
@@ -156,6 +158,9 @@ class PHY_IPhysicsEnvironment
 		//complex constraint for vehicles
 		virtual PHY_IVehicle*	getVehicleConstraint(int constraintId) =0;
 
+		// Character physics wrapper
+		virtual PHY_ICharacter*	getCharacterController(class KX_GameObject* ob) =0;
+
 		virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)=0;
 
 		//culling based on physical broad phase
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index 0ae8908..cf869e7 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -153,8 +153,7 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource)
 
 unsigned int RAS_2DFilterManager::CreateShaderProgram(int filtermode)
 {
-	switch(filtermode)
-	{
+	switch (filtermode) {
 		case RAS_2DFILTER_BLUR:
 			return CreateShaderProgram(BlurFragmentShader);
 		case RAS_2DFILTER_SHARPEN:
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index 457fd0a..f24e339 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -29,13 +29,11 @@
  *  \ingroup bgerast
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// don't show these anoying STL warnings
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+   /* don't show these anoying STL warnings */
+#  pragma warning (disable:4786)
 #endif
 
-#include "CTR_Map.h"
 #include "RAS_MaterialBucket.h"
 #include "STR_HashedString.h"
 #include "RAS_MeshObject.h"
@@ -130,7 +128,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList
 		RAS_MaterialBucket* bucket = *bit;
 		RAS_MeshSlot* ms;
 		// remove the mesh slot form the list, it culls them automatically for next frame
-		while((ms = bucket->GetNextActiveMeshSlot())) {
+		while ((ms = bucket->GetNextActiveMeshSlot())) {
 			slots[i++].set(ms, bucket, pnorm);
 		}
 	}
@@ -157,7 +155,7 @@ void RAS_BucketManager::RenderAlphaBuckets(
 	for (sit=slots.begin(); sit!=slots.end(); ++sit) {
 		rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
 
-		while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
+		while (sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
 			sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms));
 
 		// make this mesh slot culled automatically for next frame
@@ -180,8 +178,7 @@ void RAS_BucketManager::RenderSolidBuckets(
 		RAS_MaterialBucket* bucket = *bit;
 		RAS_MeshSlot* ms;
 		// remove the mesh slot form the list, it culls them automatically for next frame
-		while((ms = bucket->GetNextActiveMeshSlot()))
-		{
+		while ((ms = bucket->GetNextActiveMeshSlot())) {
 			rendertools->SetClientObject(rasty, ms->m_clientObj);
 			while (bucket->ActivateMaterial(cameratrans, rasty, rendertools))
 				bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *ms);
@@ -220,7 +217,7 @@ void RAS_BucketManager::RenderSolidBuckets(
 	for (sit=slots.begin(); sit!=slots.end(); ++sit) {
 		rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
 
-		while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
+		while (sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
 			sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms));
 	}
 #endif
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h
index c85a9f6..78125a7 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -34,7 +34,6 @@
 
 #include "MT_Transform.h"
 #include "RAS_MaterialBucket.h"
-#include "CTR_Map.h"
 
 #include <vector>
 
diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h
index 6042a7d..058f230 100644
--- a/source/gameengine/Rasterizer/RAS_Deformer.h
+++ b/source/gameengine/Rasterizer/RAS_Deformer.h
@@ -32,9 +32,9 @@
 #ifndef __RAS_DEFORMER_H__
 #define __RAS_DEFORMER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif  /* WIN32 */
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)  /* get rid of stupid stl-visual compiler debug warning */
+#endif
 
 #include <stdlib.h>
 #include "CTR_Map.h"
diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h
index 53195d7..60b9f05 100644
--- a/source/gameengine/Rasterizer/RAS_ICanvas.h
+++ b/source/gameengine/Rasterizer/RAS_ICanvas.h
@@ -59,7 +59,7 @@ public:
 	virtual 
 	~RAS_ICanvas(
 	) {
-	};
+	}
 
 	virtual 
 		void 
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index 4af1753..ddadd97 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -254,12 +254,18 @@ bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const
 {
 	bool dolights = false;
 
-	if (m_flag & RAS_BLENDERMAT)
-		dolights = (m_flag &RAS_MULTILIGHT)!=0;
-	else if (rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID);
-	else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW);
-	else
+	if (m_flag & RAS_BLENDERMAT) {
+		dolights = (m_flag & RAS_MULTILIGHT) != 0;
+	}
+	else if (rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID) {
+		/* pass */
+	}
+	else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW) {
+		/* pass */
+	}
+	else {
 		dolights = m_light;
+	}
 	
 	return dolights;
 }
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index f212b1e..e694802 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -32,8 +32,8 @@
 #ifndef __RAS_IRASTERIZER_H__
 #define __RAS_IRASTERIZER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include "STR_HashedString.h"
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index c890f0c..9fb4711 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -32,8 +32,8 @@
 
 #include "RAS_MaterialBucket.h"
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #ifdef WIN32
@@ -73,7 +73,7 @@ RAS_MeshSlot::~RAS_MeshSlot()
 #ifdef USE_SPLIT
 	Split(true);
 
-	while(m_joinedSlots.size())
+	while (m_joinedSlots.size())
 		m_joinedSlots.front()->Split(true);
 #endif
 
@@ -393,7 +393,7 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance)
 	target->m_joinedSlots.push_back(this);
 
 	MT_Matrix4x4 ntransform = m_joinInvTransform.transposed();
-	ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f;
+	ntransform[0][3] = ntransform[1][3] = ntransform[2][3] = 0.0f;
 
 	for (begin(mit); !end(mit); next(mit))
 		for (i=mit.startvertex; i<mit.endvertex; i++)
@@ -471,7 +471,7 @@ bool RAS_MeshSlot::Split(bool force)
 		}
 
 		MT_Matrix4x4 ntransform = m_joinInvTransform.inverse().transposed();
-		ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f;
+		ntransform[0][3] = ntransform[1][3] = ntransform[2][3] = 0.0f;
 
 		for (begin(mit); !end(mit); next(mit))
 			for (i=mit.startvertex; i<mit.endvertex; i++)
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 16ecffb..4c72f12 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -189,6 +189,8 @@ class RAS_MeshMaterial
 public:
 	RAS_MeshSlot *m_baseslot;
 	class RAS_MaterialBucket *m_bucket;
+
+	/* the KX_GameObject is used as a key here */
 	CTR_Map<CTR_HashedPtr,RAS_MeshSlot*> m_slots;
 
 
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
index c50aa28..2ccb945 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
@@ -584,7 +584,7 @@ void RAS_MeshObject::CheckWeightCache(Object* obj)
 	if (!m_mesh->key)
 		return;
 
-	for (kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++)
+	for (kbindex = 0, kb = (KeyBlock *)m_mesh->key->block.first; kb; kb = kb->next, kbindex++)
 	{
 		// first check the cases where the weight must be cleared
 		if (kb->vgroup[0] == 0 ||
@@ -608,7 +608,7 @@ void RAS_MeshObject::CheckWeightCache(Object* obj)
 			weights= (float*)MEM_mallocN(totvert*sizeof(float), "weights");
 		
 			for (i=0; i < totvert; i++, dv++) {
-				weights[i]= defvert_find_weight(dv, defindex);
+				weights[i] = defvert_find_weight(dv, defindex);
 			}
 
 			kb->weights = weights;
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h
index 99ed59f..281eae8 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.h
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.h
@@ -32,9 +32,9 @@
 #ifndef __RAS_MESHOBJECT_H__
 #define __RAS_MESHOBJECT_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-// disable the STL warnings ("debug information length > 255")
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+   /* disable the STL warnings ("debug information length > 255") */
+#  pragma warning (disable:4786)
 #endif
 
 #include <vector>
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
index 6319be6..eaefd5c 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
@@ -32,7 +32,7 @@
 #ifndef __RAS_EROSION2DFILTER_H__
 #define __RAS_EROSION2DFILTER_H__
 
-const char * ErosionFragmentShader=STRINGIFY(
+const char * ErosionFragmentShader = STRINGIFY(
             uniform sampler2D bgl_RenderedTexture;
         uniform vec2 bgl_TextureCoordinateOffset[9];
 
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 1f411a0..d74aa13 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -124,7 +124,7 @@ void RAS_ListRasterizer::RemoveListSlot(RAS_ListSlot* list)
 {
 	if (list->m_flag & LIST_DERIVEDMESH) {
 		RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.begin();
-		while(it != mDerivedMeshLists.end()) {
+		while (it != mDerivedMeshLists.end()) {
 			RAS_ListSlots *slots = it->second;
 			if (slots->size() > list->m_matnr && slots->at(list->m_matnr) == list) {
 				(*slots)[list->m_matnr] = NULL;
@@ -145,7 +145,7 @@ void RAS_ListRasterizer::RemoveListSlot(RAS_ListSlot* list)
 		}
 	} else {
 		RAS_ArrayLists::iterator it = mArrayLists.begin();
-		while(it != mArrayLists.end()) {
+		while (it != mArrayLists.end()) {
 			if (it->second == list) {
 				mArrayLists.erase(it);
 				break;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index a0da1c7..22a700c 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -52,7 +52,10 @@
 #include "DNA_material_types.h"
 #include "DNA_scene_types.h"
 
-#include "BKE_DerivedMesh.h"
+extern "C"{
+	#include "BLI_utildefines.h"
+	#include "BKE_DerivedMesh.h"
+}
 
 #ifndef M_PI
 #define M_PI		3.14159265358979323846
@@ -239,10 +242,10 @@ void RAS_OpenGLRasterizer::DisplayFog()
 		glFogf(GL_FOG_DENSITY, 0.1f);
 		glFogf(GL_FOG_START, m_fogstart);
 		glFogf(GL_FOG_END, m_fogstart + m_fogdist);
-		params[0]= m_fogr;
-		params[1]= m_fogg;
-		params[2]= m_fogb;
-		params[3]= 0.0;
+		params[0] = m_fogr;
+		params[1] = m_fogg;
+		params[2] = m_fogb;
+		params[3] = 0.0;
 		glFogfv(GL_FOG_COLOR, params); 
 		glEnable(GL_FOG);
 	} 
@@ -447,8 +450,7 @@ void RAS_OpenGLRasterizer::SetRenderArea()
 	switch (m_stereomode)
 	{
 		case RAS_STEREO_ABOVEBELOW:
-			switch(m_curreye)
-			{
+			switch (m_curreye) {
 				case RAS_STEREO_LEFTEYE:
 					// upper half of window
 					area.SetLeft(0);
@@ -716,53 +718,53 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv)
 				glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2());
 				continue;
 			}
-			switch(m_texco[unit]) {
-			case RAS_TEXCO_ORCO:
-			case RAS_TEXCO_GLOB:
-				glMultiTexCoord3fvARB(GL_TEXTURE0_ARB+unit, tv.getXYZ());
-				break;
-			case RAS_TEXCO_UV1:
-				glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV1());
-				break;
-			case RAS_TEXCO_NORM:
-				glMultiTexCoord3fvARB(GL_TEXTURE0_ARB+unit, tv.getNormal());
-				break;
-			case RAS_TEXTANGENT:
-				glMultiTexCoord4fvARB(GL_TEXTURE0_ARB+unit, tv.getTangent());
-				break;
-			case RAS_TEXCO_UV2:
-				glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2());
-				break;
-			default:
-				break;
+			switch (m_texco[unit]) {
+				case RAS_TEXCO_ORCO:
+				case RAS_TEXCO_GLOB:
+					glMultiTexCoord3fvARB(GL_TEXTURE0_ARB+unit, tv.getXYZ());
+					break;
+				case RAS_TEXCO_UV1:
+					glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV1());
+					break;
+				case RAS_TEXCO_NORM:
+					glMultiTexCoord3fvARB(GL_TEXTURE0_ARB+unit, tv.getNormal());
+					break;
+				case RAS_TEXTANGENT:
+					glMultiTexCoord4fvARB(GL_TEXTURE0_ARB+unit, tv.getTangent());
+					break;
+				case RAS_TEXCO_UV2:
+					glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2());
+					break;
+				default:
+					break;
 			}
 		}
 	}
 
 	if (GLEW_ARB_vertex_program) {
 		for (unit=0; unit<m_attrib_num; unit++) {
-			switch(m_attrib[unit]) {
-			case RAS_TEXCO_ORCO:
-			case RAS_TEXCO_GLOB:
-				glVertexAttrib3fvARB(unit, tv.getXYZ());
-				break;
-			case RAS_TEXCO_UV1:
-				glVertexAttrib2fvARB(unit, tv.getUV1());
-				break;
-			case RAS_TEXCO_NORM:
-				glVertexAttrib3fvARB(unit, tv.getNormal());
-				break;
-			case RAS_TEXTANGENT:
-				glVertexAttrib4fvARB(unit, tv.getTangent());
-				break;
-			case RAS_TEXCO_UV2:
-				glVertexAttrib2fvARB(unit, tv.getUV2());
-				break;
-			case RAS_TEXCO_VCOL:
-				glVertexAttrib4ubvARB(unit, tv.getRGBA());
-				break;
-			default:
-				break;
+			switch (m_attrib[unit]) {
+				case RAS_TEXCO_ORCO:
+				case RAS_TEXCO_GLOB:
+					glVertexAttrib3fvARB(unit, tv.getXYZ());
+					break;
+				case RAS_TEXCO_UV1:
+					glVertexAttrib2fvARB(unit, tv.getUV1());
+					break;
+				case RAS_TEXCO_NORM:
+					glVertexAttrib3fvARB(unit, tv.getNormal());
+					break;
+				case RAS_TEXTANGENT:
+					glVertexAttrib4fvARB(unit, tv.getTangent());
+					break;
+				case RAS_TEXCO_UV2:
+					glVertexAttrib2fvARB(unit, tv.getUV2());
+					break;
+				case RAS_TEXCO_VCOL:
+					glVertexAttrib4ubvARB(unit, tv.getRGBA());
+					break;
+				default:
+					break;
 			}
 		}
 	}
@@ -1007,8 +1009,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
 
 			near_div_focallength = frustnear / m_focallength;
 			offset = 0.5f * m_eyeseparation * near_div_focallength;
-			switch(m_curreye)
-			{
+			switch (m_curreye) {
 				case RAS_STEREO_LEFTEYE:
 						left += offset;
 						right += offset;
@@ -1078,8 +1079,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
 		// vector between eyes
 		eyeline = viewDir.cross(viewupVec);
 
-		switch(m_curreye)
-		{
+		switch (m_curreye) {
 			case RAS_STEREO_LEFTEYE:
 				{
 				// translate to left by half the eye distance
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index e6d1637..88bb0be 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -32,8 +32,8 @@
 #ifndef __RAS_OPENGLRASTERIZER_H__
 #define __RAS_OPENGLRASTERIZER_H__
 
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include "MT_CmMatrix4x4.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
index a36229c..076acb0 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
@@ -246,8 +246,7 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv)
 				glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert), tv->getUV2());
 				continue;
 			}
-			switch(m_texco[unit])
-			{
+			switch (m_texco[unit]) {
 			case RAS_TEXCO_ORCO:
 			case RAS_TEXCO_GLOB:
 				glTexCoordPointer(3, GL_FLOAT, sizeof(RAS_TexVert),tv->getXYZ());
@@ -274,7 +273,7 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv)
 
 	if (GLEW_ARB_vertex_program) {
 		for (unit=0; unit<m_attrib_num; unit++) {
-			switch(m_attrib[unit]) {
+			switch (m_attrib[unit]) {
 			case RAS_TEXCO_ORCO:
 			case RAS_TEXCO_GLOB:
 				glVertexAttribPointerARB(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getXYZ());
@@ -330,8 +329,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 		for (unit=0; unit<texco_num; unit++) {
 			glClientActiveTextureARB(GL_TEXTURE0_ARB+unit);
 
-			switch(texco[unit])
-			{
+			switch (texco[unit]) {
 			case RAS_TEXCO_ORCO:
 			case RAS_TEXCO_GLOB:
 			case RAS_TEXCO_UV1:
@@ -358,7 +356,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 
 	if (GLEW_ARB_vertex_program) {
 		for (unit=0; unit<attrib_num; unit++) {
-			switch(attrib[unit]) {
+			switch (attrib[unit]) {
 			case RAS_TEXCO_ORCO:
 			case RAS_TEXCO_GLOB:
 			case RAS_TEXCO_UV1:
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index 5f3af73..63b28a9 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -8,7 +8,7 @@ defs = [ 'GLEW_STATIC' ]
 incs = '. #intern/string #intern/moto/include #source/gameengine/Rasterizer #source/gameengine/BlenderRoutines '
 incs += ' #intern/container #source/blender/gpu #extern/glew/include ' + env['BF_OPENGL_INC']
 incs += ' #source/blender/gameengine/Ketsji #source/gameengine/SceneGraph #source/blender/makesdna #source/blender/blenkernel'
-incs += ' #intern/guardedalloc #source/blender/blenlib #source/gameengine/BlenderRoutines'
+incs += ' #intern/guardedalloc #source/blender/blenlib'
 
 if env['WITH_BF_CXX_GUARDEDALLOC']:
     defs.append('WITH_CXX_GUARDEDALLOC')
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp
index a6912c0..74544a8 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.cpp
+++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp
@@ -29,9 +29,8 @@
  *  \ingroup bgerast
  */
 
-
-#if defined(WIN32) && !defined(FREE_WINDOWS)
-#pragma warning (disable:4786)
+#ifdef _MSC_VER
+#  pragma warning (disable:4786)
 #endif
 
 #include "RAS_Polygon.h"
@@ -41,7 +40,7 @@ RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, i
 {
 	m_bucket = bucket;
 	m_darray = darray;
-	m_offset[0]= m_offset[1]= m_offset[2]= m_offset[3]= 0;
+	m_offset[0] = m_offset[1] = m_offset[2] = m_offset[3] = 0;
 	m_numvert = numvert;
 
 //	m_edgecode = 255;
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index f74aa24..945644f 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -63,10 +63,10 @@ const MT_Point3& RAS_TexVert::xyz()
 void RAS_TexVert::SetRGBA(const MT_Vector4& rgba)
 {
 	unsigned char *colp = (unsigned char*) &m_rgba;
-	colp[0] = (unsigned char) (rgba[0]*255.0f);
-	colp[1] = (unsigned char) (rgba[1]*255.0f);
-	colp[2] = (unsigned char) (rgba[2]*255.0f);
-	colp[3] = (unsigned char) (rgba[3]*255.0f);
+	colp[0] = (unsigned char) (rgba[0] * 255.0);
+	colp[1] = (unsigned char) (rgba[1] * 255.0);
+	colp[2] = (unsigned char) (rgba[2] * 255.0);
+	colp[3] = (unsigned char) (rgba[3] * 255.0);
 }
 
 
@@ -75,21 +75,32 @@ void RAS_TexVert::SetXYZ(const MT_Point3& xyz)
 	xyz.getValue(m_localxyz);
 }
 
-void RAS_TexVert::SetXYZ(const float *xyz)
+void RAS_TexVert::SetXYZ(const float xyz[3])
 {
-	m_localxyz[0]= xyz[0]; m_localxyz[1]= xyz[1]; m_localxyz[2]= xyz[2];
+	m_localxyz[0] = xyz[0]; m_localxyz[1] = xyz[1]; m_localxyz[2] = xyz[2];
 }
 
-void RAS_TexVert::SetUV(const MT_Point2& uv)
+void RAS_TexVert::SetUV1(const MT_Point2& uv)
 {
 	uv.getValue(m_uv1);
 }
 
+void RAS_TexVert::SetUV1(const float uv[3])
+{
+	m_uv1[0] = uv[0];
+	m_uv1[1] = uv[1];
+}
+
 void RAS_TexVert::SetUV2(const MT_Point2& uv)
 {
 	uv.getValue(m_uv2);
 }
 
+void RAS_TexVert::SetUV2(const float uv[3])
+{
+	m_uv2[0] = uv[0];
+	m_uv2[1] = uv[1];
+}
 
 void RAS_TexVert::SetRGBA(const unsigned int rgba)
 { 
@@ -151,3 +162,12 @@ void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat)
 	SetTangent((nmat*MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue());
 }
 
+void RAS_TexVert::TransformUV1(const MT_Matrix4x4& mat)
+{
+	SetUV1((mat * MT_Vector4(m_uv1[0], m_uv1[1], 0.0, 1.0)).getValue());
+}
+
+void RAS_TexVert::TransformUV2(const MT_Matrix4x4& mat)
+{
+	SetUV2((mat * MT_Vector4(m_uv2[0], m_uv2[1], 0.0, 1.0)).getValue());
+}
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h
index 889769d..98ea4dd 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.h
+++ b/source/gameengine/Rasterizer/RAS_TexVert.h
@@ -122,9 +122,11 @@ public:
 	}
 
 	void				SetXYZ(const MT_Point3& xyz);
-	void				SetXYZ(const float *xyz);
-	void				SetUV(const MT_Point2& uv);
+	void				SetXYZ(const float xyz[3]);
+	void				SetUV1(const MT_Point2& uv);
 	void				SetUV2(const MT_Point2& uv);
+	void				SetUV1(const float uv[2]);
+	void				SetUV2(const float uv[2]);
 
 	void				SetRGBA(const unsigned int rgba);
 	void				SetNormal(const MT_Vector3& normal);
@@ -137,6 +139,8 @@ public:
 
 	void				Transform(const class MT_Matrix4x4& mat,
 	                              const class MT_Matrix4x4& nmat);
+	void				TransformUV1(const MT_Matrix4x4& mat);
+	void				TransformUV2(const MT_Matrix4x4& mat);
 
 	// compare two vertices, to test if they can be shared, used for
 	// splitting up based on uv's, colors, etc
diff --git a/source/gameengine/Rasterizer/RAS_texmatrix.cpp b/source/gameengine/Rasterizer/RAS_texmatrix.cpp
index 4399265..d335a38 100644
--- a/source/gameengine/Rasterizer/RAS_texmatrix.cpp
+++ b/source/gameengine/Rasterizer/RAS_texmatrix.cpp
@@ -93,10 +93,10 @@ int main()
 	MT_Point2 puv0={0,0};
 	MT_Point3 pxyz0 (0,0,128);
 
-	MT_Scalar puv1[2]={1,0};
+	MT_Scalar puv1[2] = {1,0};
 	MT_Point3 pxyz1(128,0,128);
 
-	MT_Scalar puv2[2]={1,1};
+	MT_Scalar puv2[2] = {1,1};
 	MT_Point3 pxyz2(128,0,0);
 
 	RAS_TexVert p0(pxyz0,puv0);
diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h
index 885eb8e..72a0406 100644
--- a/source/gameengine/SceneGraph/SG_IObject.h
+++ b/source/gameengine/SceneGraph/SG_IObject.h
@@ -127,8 +127,8 @@ struct	SG_Callbacks
 		m_schedulefunc(NULL),
 		m_reschedulefunc(NULL)
 	{
-	};
-		
+	}
+
 	SG_Callbacks(
 		SG_ReplicationNewCallback repfunc,
 		SG_DestructionNewCallback destructfunc,
@@ -142,7 +142,7 @@ struct	SG_Callbacks
 		m_schedulefunc(schedulefunc),
 		m_reschedulefunc(reschedulefunc)
 	{
-	};
+	}
 
 	SG_ReplicationNewCallback	m_replicafunc;
 	SG_DestructionNewCallback	m_destructionfunc;
@@ -152,8 +152,8 @@ struct	SG_Callbacks
 };
 
 /**
-base object that can be part of the scenegraph.
-*/
+ * base object that can be part of the scenegraph.
+ */
 class SG_IObject : public SG_QList
 {
 private :
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index 8c0d2b8..f30c80d 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -103,7 +103,7 @@ SetParentRelation(
 
 /**
  * Update Spatial Data.
- * Calculates WorldTransform., (either doing itsself or using the linked SGControllers)
+ * Calculates WorldTransform., (either doing its self or using the linked SGControllers)
  */
 
 
diff --git a/source/gameengine/VideoTexture/BlendType.h b/source/gameengine/VideoTexture/BlendType.h
index e19aadc..28eebe0 100644
--- a/source/gameengine/VideoTexture/BlendType.h
+++ b/source/gameengine/VideoTexture/BlendType.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file BlendType.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __BLENDTYPE_H__
 #define __BLENDTYPE_H__
 
diff --git a/source/gameengine/VideoTexture/Common.h b/source/gameengine/VideoTexture/Common.h
index e6e0ffa..90f7e66 100644
--- a/source/gameengine/VideoTexture/Common.h
+++ b/source/gameengine/VideoTexture/Common.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file VideoTexture/Common.h
  *  \ingroup bgevideotex
  */
- 
+
 #if defined WIN32
 #define WINDOWS_LEAN_AND_MEAN
 #endif
diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp
index 8609cd7..8b8918d 100644
--- a/source/gameengine/VideoTexture/Exception.cpp
+++ b/source/gameengine/VideoTexture/Exception.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/Exception.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/Exception.h b/source/gameengine/VideoTexture/Exception.h
index bc08742..e0c1fdd 100644
--- a/source/gameengine/VideoTexture/Exception.h
+++ b/source/gameengine/VideoTexture/Exception.h
@@ -1,30 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
-
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file Exception.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __EXCEPTION_H__
 #define __EXCEPTION_H__
 
diff --git a/source/gameengine/VideoTexture/FilterBase.cpp b/source/gameengine/VideoTexture/FilterBase.cpp
index 6ec5e23..a232bcc 100644
--- a/source/gameengine/VideoTexture/FilterBase.cpp
+++ b/source/gameengine/VideoTexture/FilterBase.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/FilterBase.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/FilterBase.h b/source/gameengine/VideoTexture/FilterBase.h
index 422cf86..f8fe2c7 100644
--- a/source/gameengine/VideoTexture/FilterBase.h
+++ b/source/gameengine/VideoTexture/FilterBase.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file FilterBase.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __FILTERBASE_H__
 #define __FILTERBASE_H__
 
@@ -95,6 +99,10 @@ protected:
 	virtual unsigned int filter (unsigned int * src, short x, short y,
 		short * size, unsigned int pixSize, unsigned int val = 0)
 	{ return val; }
+	/// filter pixel, source float buffer
+	virtual unsigned int filter (float * src, short x, short y,
+		short * size, unsigned int pixSize, unsigned int val = 0)
+	{ return val; }
 
 	/// get source pixel size
 	virtual unsigned int getPixelSize (void) { return 1; }
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
index 8559e8f..662ecab 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/FilterBlueScreen.cpp
  *  \ingroup bgevideotex
@@ -83,18 +87,21 @@ static PyObject *getColor (PyFilter *self, void *closure)
 static int setColor (PyFilter *self, PyObject *value, void *closure)
 {
 	// check validity of parameter
-	if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 3
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
+	if (value == NULL ||
+	    !(PyTuple_Check(value) || PyList_Check(value)) ||
+	    PySequence_Fast_GET_SIZE(value) != 3 ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)) ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
 	{
 		PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
 		return -1;
 	}
 	// set color
-	getFilter(self)->setColor((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
-		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
-		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))));
+	getFilter(self)->setColor(
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
 	// success
 	return 0;
 }
@@ -110,16 +117,19 @@ static PyObject *getLimits (PyFilter *self, void *closure)
 static int setLimits (PyFilter *self, PyObject *value, void *closure)
 {
 	// check validity of parameter
-	if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+	if (value == NULL ||
+	    !(PyTuple_Check(value) || PyList_Check(value)) ||
+	    PySequence_Fast_GET_SIZE(value) != 2 ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
 	{
 		PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
 		return -1;
 	}
 	// set limits
-	getFilter(self)->setLimits((unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
-		(unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))));
+	getFilter(self)->setLimits(
+	        (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+	        (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))));
 	// success
 	return 0;
 }
@@ -159,14 +169,14 @@ PyTypeObject FilterBlueScreenType =
 	0,                         /*tp_as_buffer*/
 	Py_TPFLAGS_DEFAULT,        /*tp_flags*/
 	"Filter for Blue Screen objects",       /* tp_doc */
-	0,		               /* tp_traverse */
-	0,		               /* tp_clear */
-	0,		               /* tp_richcompare */
-	0,		               /* tp_weaklistoffset */
-	0,		               /* tp_iter */
-	0,		               /* tp_iternext */
-	NULL,                /* tp_methods */
-	0,                   /* tp_members */
+	0,                         /* tp_traverse */
+	0,                         /* tp_clear */
+	0,                         /* tp_richcompare */
+	0,                         /* tp_weaklistoffset */
+	0,                         /* tp_iter */
+	0,                         /* tp_iternext */
+	NULL,                      /* tp_methods */
+	0,                         /* tp_members */
 	filterBSGetSets,           /* tp_getset */
 	0,                         /* tp_base */
 	0,                         /* tp_dict */
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.h b/source/gameengine/VideoTexture/FilterBlueScreen.h
index 28ab16d..5a90590 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.h
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file FilterBlueScreen.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __FILTERBLUESCREEN_H__
 #define __FILTERBLUESCREEN_H__
 
diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp
index 35a6414..e4101b5 100644
--- a/source/gameengine/VideoTexture/FilterColor.cpp
+++ b/source/gameengine/VideoTexture/FilterColor.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/FilterColor.cpp
  *  \ingroup bgevideotex
@@ -147,7 +151,7 @@ static int setMatrix (PyFilter *self, PyObject *value, void *closure)
 			valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
 			// if it is valid, save it in matrix
 			if (valid)
-				mat[r][c] = short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+				mat[r][c] = short(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
 		}
 	}
 	// if parameter is not valid, report error
@@ -280,7 +284,7 @@ static int setLevels (PyFilter *self, PyObject *value, void *closure)
 			valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
 			// if it is valid, save it in matrix
 			if (valid)
-				lev[r][c] = (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+				lev[r][c] = (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
 		}
 	}
 	// if parameter is not valid, report error
diff --git a/source/gameengine/VideoTexture/FilterColor.h b/source/gameengine/VideoTexture/FilterColor.h
index cd61900..350f727 100644
--- a/source/gameengine/VideoTexture/FilterColor.h
+++ b/source/gameengine/VideoTexture/FilterColor.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file FilterColor.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __FILTERCOLOR_H__
 #define __FILTERCOLOR_H__
 
diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp
index 03c500a..ba963d9 100644
--- a/source/gameengine/VideoTexture/FilterNormal.cpp
+++ b/source/gameengine/VideoTexture/FilterNormal.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/FilterNormal.cpp
  *  \ingroup bgevideotex
@@ -81,7 +85,7 @@ static int setColor (PyFilter *self, PyObject *value, void *closure)
 		return -1;
 	}
 	// set color index
-	getFilter(self)->setColor((unsigned short)(PyLong_AsSsize_t(value)));
+	getFilter(self)->setColor((unsigned short)(PyLong_AsLong(value)));
 	// success
 	return 0;
 }
diff --git a/source/gameengine/VideoTexture/FilterNormal.h b/source/gameengine/VideoTexture/FilterNormal.h
index 19664e8..b21afb3 100644
--- a/source/gameengine/VideoTexture/FilterNormal.h
+++ b/source/gameengine/VideoTexture/FilterNormal.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file FilterNormal.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __FILTERNORMAL_H__
 #define __FILTERNORMAL_H__
 
diff --git a/source/gameengine/VideoTexture/FilterSource.cpp b/source/gameengine/VideoTexture/FilterSource.cpp
index e5fe471..1fac87f 100644
--- a/source/gameengine/VideoTexture/FilterSource.cpp
+++ b/source/gameengine/VideoTexture/FilterSource.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/FilterSource.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/FilterSource.h b/source/gameengine/VideoTexture/FilterSource.h
index a4900e8..f1d2615 100644
--- a/source/gameengine/VideoTexture/FilterSource.h
+++ b/source/gameengine/VideoTexture/FilterSource.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file FilterSource.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __FILTERSOURCE_H__
 #define __FILTERSOURCE_H__
 
@@ -31,7 +35,6 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 #include "FilterBase.h"
 
-
 /// class for RGB24 conversion
 class FilterRGB24 : public FilterBase
 {
@@ -97,6 +100,65 @@ protected:
 	{ VT_RGBA(val,src[2],src[1],src[0],0xFF); return val; }
 };
 
+/// class for Z_buffer conversion
+class FilterZZZA : public FilterBase
+{
+public:
+	/// constructor
+	FilterZZZA (void) {}
+	/// destructor
+	virtual ~FilterZZZA (void) {}
+
+	/// get source pixel size
+	virtual unsigned int getPixelSize (void) { return 1; }
+
+protected:
+	/// filter pixel, source float buffer
+	virtual unsigned int filter (float * src, short x, short y,
+		short * size, unsigned int pixSize, unsigned int val)
+	{
+		// calculate gray value
+        // convert float to unsigned char
+		unsigned int depth = int(src[0] * 255);
+		// return depth scale value
+		VT_R(val) = depth;
+		VT_G(val) = depth;
+		VT_B(val) = depth;
+		VT_A(val) = 0xFF;
+
+		return val;
+	}
+};
+
+
+/// class for Z_buffer conversion
+class FilterDEPTH : public FilterBase
+{
+public:
+	/// constructor
+	FilterDEPTH (void) {}
+	/// destructor
+	virtual ~FilterDEPTH (void) {}
+
+	/// get source pixel size
+	virtual unsigned int getPixelSize (void) { return 1; }
+
+protected:
+	/// filter pixel, source float buffer
+	virtual unsigned int filter (float * src, short x, short y,
+	                             short * size, unsigned int pixSize, unsigned int val)
+	{
+		/* Copy the float value straight away
+		 * The user can retrieve the original float value by using
+		 * 'F' mode in BGL buffer */
+		memcpy(&val, src, sizeof (unsigned int));
+		return val;
+	}
+};
+
+
+
+
 /// class for YV12 conversion
 class FilterYV12 : public FilterBase
 {
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 2de4979..3b6dec2 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/ImageBase.cpp
  *  \ingroup bgevideotex
@@ -49,6 +53,8 @@ extern "C" {
 // constructor
 ImageBase::ImageBase (bool staticSrc) : m_image(NULL), m_imgSize(0),
 m_avail(false), m_scale(false), m_scaleChange(false), m_flip(false),
+m_zbuff(false),
+m_depth(false),
 m_staticSources(staticSrc), m_pyfilter(NULL)
 {
 	m_size[0] = m_size[1] = 0;
@@ -402,6 +408,18 @@ PyObject *Image_getImage (PyImage *self, char * mode)
 			{
 				buffer = BGL_MakeBuffer( GL_BYTE, 1, &dimensions, image);
 			}
+			else if (!strcasecmp(mode, "F"))
+			{
+				// this mode returns the image as an array of float.
+				// This makes sense ONLY for the depth buffer:
+				//   source = VideoTexture.ImageViewport()
+				//   source.depth = True
+				//   depth = VideoTexture.imageToArray(source, 'F')
+
+				// adapt dimension from byte to float
+				dimensions /= sizeof(float);
+				buffer = BGL_MakeBuffer( GL_FLOAT, 1, &dimensions, image);
+			}
 			else 
 			{
 				int i, c, ncolor, pixels;
@@ -532,6 +550,52 @@ int Image_setFlip (PyImage *self, PyObject *value, void *closure)
 	return 0;
 }
 
+// get zbuff
+PyObject * Image_getZbuff (PyImage * self, void * closure)
+{
+	if (self->m_image != NULL && self->m_image->getZbuff()) Py_RETURN_TRUE;
+	else Py_RETURN_FALSE;
+}
+
+// set zbuff
+int Image_setZbuff (PyImage * self, PyObject * value, void * closure)
+{
+	// check parameter, report failure
+	if (value == NULL || !PyBool_Check(value))
+	{
+		PyErr_SetString(PyExc_TypeError, "The value must be a bool");
+		return -1;
+	}
+	// set scale
+	if (self->m_image != NULL) self->m_image->setZbuff(value == Py_True);
+	// success
+	return 0;
+}
+
+// get depth
+PyObject * Image_getDepth (PyImage * self, void * closure)
+{
+	if (self->m_image != NULL && self->m_image->getDepth()) Py_RETURN_TRUE;
+	else Py_RETURN_FALSE;
+}
+
+// set depth
+int Image_setDepth (PyImage * self, PyObject * value, void * closure)
+{
+	// check parameter, report failure
+	if (value == NULL || !PyBool_Check(value))
+	{
+		PyErr_SetString(PyExc_TypeError, "The value must be a bool");
+		return -1;
+	}
+	// set scale
+	if (self->m_image != NULL) self->m_image->setDepth(value == Py_True);
+	// success
+	return 0;
+}
+
+
+
 
 // get filter source object
 PyObject *Image_getSource (PyImage *self, PyObject *args)
diff --git a/source/gameengine/VideoTexture/ImageBase.h b/source/gameengine/VideoTexture/ImageBase.h
index bb3f0c1..3bb9c8c 100644
--- a/source/gameengine/VideoTexture/ImageBase.h
+++ b/source/gameengine/VideoTexture/ImageBase.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file ImageBase.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __IMAGEBASE_H__
 #define __IMAGEBASE_H__
 
@@ -78,6 +82,14 @@ public:
 	bool getFlip (void) { return m_flip; }
 	/// set vertical flip
 	void setFlip (bool flip) { m_flip = flip; }
+	/// get Z buffer
+	bool getZbuff (void) { return m_zbuff; }
+	/// set Z buffer
+	void setZbuff (bool zbuff) { m_zbuff = zbuff; }
+	/// get depth
+	bool getDepth (void) { return m_depth; }
+	/// set depth
+	void setDepth (bool depth) { m_depth = depth; }
 
 	/// get source object
 	PyImage * getSource (const char * id);
@@ -111,6 +123,10 @@ protected:
 	bool m_scaleChange;
 	/// flip image vertically
 	bool m_flip;
+	/// use the Z buffer as a texture
+	bool m_zbuff;
+	/// extract the Z buffer with unisgned int precision
+	bool m_depth;
 
 	/// source image list
 	ImageSourceList m_sources;
@@ -347,7 +363,15 @@ int Image_setFlip (PyImage *self, PyObject *value, void *closure);
 PyObject *Image_getSource (PyImage *self, PyObject *args);
 // set filter source object
 PyObject *Image_setSource (PyImage *self, PyObject *args);
-
+// get Z buffer
+PyObject * Image_getZbuff (PyImage * self, void * closure);
+// set Z buffer
+int Image_setZbuff (PyImage * self, PyObject * value, void * closure);
+// get depth
+PyObject * Image_getDepth (PyImage * self, void * closure);
+// set depth
+int Image_setDepth (PyImage * self, PyObject * value, void * closure);
+ 
 // get pixel filter object
 PyObject *Image_getFilter (PyImage *self, void *closure);
 // set pixel filter object
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index eec0bcc..1593a08 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/ImageBuff.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/ImageBuff.h b/source/gameengine/VideoTexture/ImageBuff.h
index b2bdbc1..1929950 100644
--- a/source/gameengine/VideoTexture/ImageBuff.h
+++ b/source/gameengine/VideoTexture/ImageBuff.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file ImageBuff.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __IMAGEBUFF_H__
 #define __IMAGEBUFF_H__
 
diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp
index f09454a..27c4fed 100644
--- a/source/gameengine/VideoTexture/ImageMix.cpp
+++ b/source/gameengine/VideoTexture/ImageMix.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/ImageMix.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/ImageMix.h b/source/gameengine/VideoTexture/ImageMix.h
index 2746635..712efde 100644
--- a/source/gameengine/VideoTexture/ImageMix.h
+++ b/source/gameengine/VideoTexture/ImageMix.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file ImageMix.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __IMAGEMIX_H__
 #define __IMAGEMIX_H__
 
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 2135d0a..f778f84 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/ImageRender.cpp
  *  \ingroup bgevideotex
@@ -356,10 +360,11 @@ static int setBackground (PyImage *self, PyObject *value, void *closure)
 		return -1;
 	}
 	// set background color
-	getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
-		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
-		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
-		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
+	getImageRender(self)->setBackground(
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
+	        (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
 	// success
 	return 0;
 }
@@ -375,7 +380,7 @@ static PyMethodDef imageRenderMethods[] =
 static PyGetSetDef imageRenderGetSets[] =
 { 
 	{(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
-    // attribute from ImageViewport
+	// attribute from ImageViewport
 	{(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of render area", NULL},
 	{(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
 	{(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to render", NULL},
@@ -385,6 +390,8 @@ static PyGetSetDef imageRenderGetSets[] =
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
 	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)",	NULL},
 	{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+	{(char*)"zbuff", (getter)Image_getZbuff, (setter)Image_setZbuff, (char*)"use depth buffer as texture", NULL},
+	{(char*)"depth", (getter)Image_getDepth, (setter)Image_setDepth, (char*)"get depth information from z-buffer using unsigned int precision", NULL},
 	{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
 };
@@ -547,6 +554,8 @@ static PyGetSetDef imageMirrorGetSets[] =
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
 	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)",	NULL},
 	{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+	{(char*)"zbuff", (getter)Image_getZbuff, (setter)Image_setZbuff, (char*)"use depth buffer as texture", NULL},
+	{(char*)"depth", (getter)Image_getDepth, (setter)Image_setDepth, (char*)"get depth information from z-buffer using unsigned int precision", NULL},
 	{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
 };
diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h
index df6337e..27882a9 100644
--- a/source/gameengine/VideoTexture/ImageRender.h
+++ b/source/gameengine/VideoTexture/ImageRender.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file ImageRender.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __IMAGERENDER_H__
 #define __IMAGERENDER_H__
 
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index 9b503ef..5fc388b 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/ImageViewport.cpp
  *  \ingroup bgevideotex
@@ -50,6 +54,8 @@ ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false)
 	
 	//glGetIntegerv(GL_VIEWPORT, m_viewport);
 	// create buffer for viewport image
+	// Warning: this buffer is also used to get the depth buffer as an array of
+	//          float (1 float = 4 bytes per pixel)
 	m_viewportImage = new BYTE [4 * getViewportSize()[0] * getViewportSize()[1]];
 	// set attributes
 	setWhole(false);
@@ -57,7 +63,9 @@ ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false)
 
 // destructor
 ImageViewport::~ImageViewport (void)
-{ delete [] m_viewportImage; }
+{
+	delete [] m_viewportImage;
+}
 
 
 // use whole viewport to capture image
@@ -81,7 +89,7 @@ void ImageViewport::setWhole (bool whole)
 	setPosition();
 }
 
-void ImageViewport::setCaptureSize (short * size)
+void ImageViewport::setCaptureSize (short size[2])
 {
 	m_whole = false;
 	if (size == NULL) 
@@ -101,7 +109,7 @@ void ImageViewport::setCaptureSize (short * size)
 }
 
 // set position of capture rectangle
-void ImageViewport::setPosition (GLint * pos)
+void ImageViewport::setPosition (GLint pos[2])
 {
 	// if new position is not provided, use existing position
 	if (pos == NULL) pos = m_position;
@@ -123,15 +131,14 @@ void ImageViewport::calcImage (unsigned int texId, double ts)
 		// reset image
 		init(m_capSize[0], m_capSize[1]);
 	// if texture wasn't initialized
-	if (!m_texInit)
-	{
+	if (!m_texInit) {
 		// initialize it
 		loadTexture(texId, m_image, m_size);
 		m_texInit = true;
 	}
 	// if texture can be directly created
 	if (texId != 0 && m_pyfilter == NULL && m_capSize[0] == calcSize(m_capSize[0])
-	        && m_capSize[1] == calcSize(m_capSize[1]) && !m_flip)
+	    && m_capSize[1] == calcSize(m_capSize[1]) && !m_flip && !m_zbuff && !m_depth)
 	{
 		// just copy current viewport to texture
 		glBindTexture(GL_TEXTURE_2D, texId);
@@ -140,24 +147,47 @@ void ImageViewport::calcImage (unsigned int texId, double ts)
 		m_avail = false;
 	}
 	// otherwise copy viewport to buffer, if image is not available
-	else if (!m_avail)
-	{
-		// get frame buffer data
-		if (m_alpha)
-		{
-			glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA,
-			             GL_UNSIGNED_BYTE, m_viewportImage);
+	else if (!m_avail) {
+		if (m_zbuff) {
+			// Use read pixels with the depth buffer
+			// *** misusing m_viewportImage here, but since it has the correct size
+			//     (4 bytes per pixel = size of float) and we just need it to apply
+			//     the filter, it's ok
+			glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1],
+			        GL_DEPTH_COMPONENT, GL_FLOAT, m_viewportImage);
 			// filter loaded data
-			FilterRGBA32 filt;
-			filterImage(filt, m_viewportImage, m_capSize);
+			FilterZZZA filt;
+			filterImage(filt, (float *)m_viewportImage, m_capSize);
 		}
-		else
-		{
-			glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
-			             GL_UNSIGNED_BYTE, m_viewportImage);
-			// filter loaded data
-			FilterRGB24 filt;
-			filterImage(filt, m_viewportImage, m_capSize);
+		else {
+
+			if (m_depth) {
+				// Use read pixels with the depth buffer
+				// See warning above about m_viewportImage.
+				glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1],
+				        GL_DEPTH_COMPONENT, GL_FLOAT, m_viewportImage);
+				// filter loaded data
+				FilterDEPTH filt;
+				filterImage(filt, (float *)m_viewportImage, m_capSize);
+			}
+			else {
+
+				// get frame buffer data
+				if (m_alpha) {
+					glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA,
+					        GL_UNSIGNED_BYTE, m_viewportImage);
+					// filter loaded data
+					FilterRGBA32 filt;
+					filterImage(filt, m_viewportImage, m_capSize);
+				}
+				else {
+					glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
+					        GL_UNSIGNED_BYTE, m_viewportImage);
+					// filter loaded data
+					FilterRGB24 filt;
+					filterImage(filt, m_viewportImage, m_capSize);
+				}
+			}
 		}
 	}
 }
@@ -228,25 +258,30 @@ int ImageViewport_setAlpha (PyImage *self, PyObject *value, void *closure)
 // get position
 static PyObject *ImageViewport_getPosition (PyImage *self, void *closure)
 {
-	return Py_BuildValue("(ii)", getImageViewport(self)->getPosition()[0],
-		getImageViewport(self)->getPosition()[1]);
+	GLint *pos = getImageViewport(self)->getPosition();
+	PyObject *ret = PyTuple_New(2);
+	PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(pos[0]));
+	PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(pos[1]));
+	return ret;
 }
 
 // set position
 static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *closure)
 {
 	// check validity of parameter
-	if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+	if (value == NULL ||
+	    !(PyTuple_Check(value) || PyList_Check(value)) ||
+	    PySequence_Fast_GET_SIZE(value) != 2 ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
 	{
 		PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
 		return -1;
 	}
 	// set position
-	GLint pos [] = {
-		GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
-			GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+	GLint pos[2] = {
+	    GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+	    GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
 	};
 	getImageViewport(self)->setPosition(pos);
 	// success
@@ -256,25 +291,30 @@ static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *clos
 // get capture size
 PyObject *ImageViewport_getCaptureSize (PyImage *self, void *closure)
 {
-	return Py_BuildValue("(ii)", getImageViewport(self)->getCaptureSize()[0],
-		getImageViewport(self)->getCaptureSize()[1]);
+	short *size = getImageViewport(self)->getCaptureSize();
+	PyObject *ret = PyTuple_New(2);
+	PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(size[0]));
+	PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(size[1]));
+	return ret;
 }
 
 // set capture size
 int ImageViewport_setCaptureSize (PyImage *self, PyObject *value, void *closure)
 {
 	// check validity of parameter
-	if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
-		|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+	if (value == NULL ||
+	    !(PyTuple_Check(value) || PyList_Check(value)) ||
+	    PySequence_Fast_GET_SIZE(value) != 2 ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+	    !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
 	{
 		PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
 		return -1;
 	}
 	// set capture size
-	short size [] = {
-		short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
-			short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+	short size[2] = {
+	    short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+	    short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
 	};
 	try
 	{
@@ -310,6 +350,8 @@ static PyGetSetDef imageViewportGetSets[] =
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
 	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)", NULL},
 	{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+	{(char*)"zbuff", (getter)Image_getZbuff, (setter)Image_setZbuff, (char*)"use depth buffer as texture", NULL},
+	{(char*)"depth", (getter)Image_getDepth, (setter)Image_setDepth, (char*)"get depth information from z-buffer as array of float", NULL},
 	{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
 };
diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h
index 198655c..5afd465 100644
--- a/source/gameengine/VideoTexture/ImageViewport.h
+++ b/source/gameengine/VideoTexture/ImageViewport.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file ImageViewport.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __IMAGEVIEWPORT_H__
 #define __IMAGEVIEWPORT_H__
 
@@ -56,12 +60,12 @@ public:
 	/// get capture size in viewport
 	short * getCaptureSize (void) { return m_capSize; }
 	/// set capture size in viewport
-	void setCaptureSize (short * size = NULL);
+	void setCaptureSize (short size[2] = NULL);
 
 	/// get position in viewport
 	GLint * getPosition (void) { return m_position; }
 	/// set position in viewport
-	void setPosition (GLint * pos = NULL);
+	void setPosition (GLint pos[2] = NULL);
 
 protected:
 	/// frame buffer rectangle
diff --git a/source/gameengine/VideoTexture/PyTypeList.cpp b/source/gameengine/VideoTexture/PyTypeList.cpp
index 9fe9854..96ac1cc 100644
--- a/source/gameengine/VideoTexture/PyTypeList.cpp
+++ b/source/gameengine/VideoTexture/PyTypeList.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/PyTypeList.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/PyTypeList.h b/source/gameengine/VideoTexture/PyTypeList.h
index 4872b3c..b36f11e 100644
--- a/source/gameengine/VideoTexture/PyTypeList.h
+++ b/source/gameengine/VideoTexture/PyTypeList.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of blendTex library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of blendTex library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file PyTypeList.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __PYTYPELIST_H__
 #define __PYTYPELIST_H__
 
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index f58d17f..98d36d1 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/Texture.cpp
  *  \ingroup bgevideotex
diff --git a/source/gameengine/VideoTexture/Texture.h b/source/gameengine/VideoTexture/Texture.h
index cc26572..157eea5 100644
--- a/source/gameengine/VideoTexture/Texture.h
+++ b/source/gameengine/VideoTexture/Texture.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file VideoTexture/Texture.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __TEXTURE_H__
 #define __TEXTURE_H__
 
diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp
index 1eb2e83..576e358 100644
--- a/source/gameengine/VideoTexture/VideoBase.cpp
+++ b/source/gameengine/VideoTexture/VideoBase.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/VideoBase.cpp
  *  \ingroup bgevideotex
@@ -180,7 +184,7 @@ int Video_setRepeat(PyImage *self, PyObject *value, void *closure)
 		return -1;
 	}
 	// set repeat
-	getVideo(self)->setRepeat(int(PyLong_AsSsize_t(value)));
+	getVideo(self)->setRepeat(int(PyLong_AsLong(value)));
 	// success
 	return 0;
 }
diff --git a/source/gameengine/VideoTexture/VideoBase.h b/source/gameengine/VideoTexture/VideoBase.h
index 4cf913d..9880165 100644
--- a/source/gameengine/VideoTexture/VideoBase.h
+++ b/source/gameengine/VideoTexture/VideoBase.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file VideoBase.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __VIDEOBASE_H__
 #define __VIDEOBASE_H__
 
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index cf65362..8976a21 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/VideoFFmpeg.cpp
  *  \ingroup bgevideotex
@@ -485,13 +489,13 @@ void VideoFFmpeg::stopCache()
 			av_free(frame->frame);
 			delete frame;
 		}
-		while((packet = (CachePacket *)m_packetCacheBase.first) != NULL)
+		while ((packet = (CachePacket *)m_packetCacheBase.first) != NULL)
 		{
 			BLI_remlink(&m_packetCacheBase, packet);
 			av_free_packet(&packet->packet);
 			delete packet;
 		}
-		while((packet = (CachePacket *)m_packetCacheFree.first) != NULL)
+		while ((packet = (CachePacket *)m_packetCacheFree.first) != NULL)
 		{
 			BLI_remlink(&m_packetCacheFree, packet);
 			delete packet;
@@ -921,7 +925,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
 			&& m_preseek 
 			&& position - (m_curPosition + 1) < m_preseek) 
 		{
-			while(av_read_frame(m_formatCtx, &packet)>=0) 
+			while (av_read_frame(m_formatCtx, &packet)>=0)
 			{
 				if (packet.stream_index == m_videoStream) 
 				{
@@ -996,7 +1000,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
 
 	// find the correct frame, in case of streaming and no cache, it means just
 	// return the next frame. This is not quite correct, may need more work
-	while(av_read_frame(m_formatCtx, &packet)>=0) 
+	while (av_read_frame(m_formatCtx, &packet) >= 0)
 	{
 		if (packet.stream_index == m_videoStream) 
 		{
@@ -1138,7 +1142,7 @@ static int VideoFFmpeg_setPreseek(PyImage *self, PyObject *value, void *closure)
 		return -1;
 	}
 	// set preseek
-	getFFmpeg(self)->setPreseek(PyLong_AsSsize_t(value));
+	getFFmpeg(self)->setPreseek(PyLong_AsLong(value));
 	// success
 	return 0;
 }
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h
index d5b5758..92043bb 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.h
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.h
@@ -1,29 +1,33 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2007 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2007 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file VideoFFmpeg.h
  *  \ingroup bgevideotex
  */
- 
+
 #ifndef __VIDEOFFMPEG_H__
 #define __VIDEOFFMPEG_H__
 
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index dd9d83c..7241502 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -1,24 +1,28 @@
 /*
------------------------------------------------------------------------------
-This source file is part of VideoTexture library
-
-Copyright (c) 2006 The Zdeno Ash Miklas
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place - Suite 330, Boston, MA 02111-1307, USA, or go to
-http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------
-*/
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (c) 2006 The Zdeno Ash Miklas
+ *
+ * This source file is part of VideoTexture library
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
 /** \file gameengine/VideoTexture/blendVideoTex.cpp
  *  \ingroup bgevideotex
diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt
index 2bad586..dd84882 100644
--- a/source/tests/CMakeLists.txt
+++ b/source/tests/CMakeLists.txt
@@ -27,11 +27,11 @@ set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests)
 set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests)
 
 # ugh, any better way to do this on testing only?
-execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_OUT_DIR}) 
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_OUT_DIR})
 
-#~ if(NOT IS_DIRECTORY ${TEST_SRC_DIR})
-#~ 	message(FATAL_ERROR "CMake test directory not found!")
-#~ endif()
+#~	if(NOT IS_DIRECTORY ${TEST_SRC_DIR})
+#~		message(FATAL_ERROR "CMake test directory not found!")
+#~	endif()
 
 # all calls to blender use this
 if(APPLE)
diff --git a/source/tests/bl_rst_completeness.py b/source/tests/bl_rst_completeness.py
new file mode 100644
index 0000000..e9e2779
--- /dev/null
+++ b/source/tests/bl_rst_completeness.py
@@ -0,0 +1,159 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# run this script in the game engine.
+# or on the command line with...
+#  ./blender.bin --background -noaudio --python source/tests/bl_rst_completeness.py
+
+# Paste this into the bge and run on an always actuator.
+'''
+filepath = "/dsk/data/src/blender/blender/source/tests/bl_rst_completeness.py"
+exec(compile(open(filepath).read(), filepath, 'exec'))
+'''
+
+import os
+
+THIS_DIR = os.path.dirname(__file__)
+RST_DIR = os.path.normpath(os.path.join(THIS_DIR, "..", "..", "doc", "python_api", "rst"))
+
+import sys
+sys.path.append(THIS_DIR)
+
+import rst_to_doctree_mini
+
+try:
+    import bge
+except:
+    bge = None
+
+# (file, module)
+modules = (
+    ("bge.constraints.rst", "bge.constraints", False),
+    ("bge.events.rst", "bge.events", False),
+    ("bge.logic.rst", "bge.logic", False),
+    ("bge.render.rst", "bge.render", False),
+    ("bge.texture.rst", "bge.texture", False),
+    ("bge.types.rst", "bge.types", False),
+
+    ("bgl.rst", "bgl", True),
+    ("gpu.rst", "gpu", False),
+)
+
+def is_directive_pydata(filepath, directive):
+    if directive.type in {"function", "method", "class", "attribute", "data"}:
+        return True
+    elif directive.type in {"module", "note", "warning", "code-block", "hlist", "seealso"}:
+        return False
+    elif directive.type in {"literalinclude"}:  # TODO
+        return False
+    else:
+        print(directive_to_str(filepath, directive), end=" ")
+        print("unknown directive type %r" % directive.type)
+        return False
+
+
+def directive_to_str(filepath, directive):
+    return "%s:%d:%d:" % (filepath, directive.line + 1, directive.indent)
+
+
+def directive_members_dict(filepath, directive_members):
+    return {directive.value_strip: directive for directive in directive_members
+            if is_directive_pydata(filepath, directive)}
+
+
+def module_validate(filepath, mod, mod_name, doctree, partial_ok):
+    # RST member missing from MODULE ???
+    for directive in doctree:
+        # print(directive.type)
+        if is_directive_pydata(filepath, directive):
+            attr = directive.value_strip
+            has_attr = hasattr(mod, attr)
+            ok = False
+            if not has_attr:
+                # so we can have glNormal docs cover glNormal3f
+                if partial_ok:
+                    for s in dir(mod):
+                        if s.startswith(attr):
+                            ok = True
+                            break
+
+                if not ok:
+                    print(directive_to_str(filepath, directive), end=" ")
+                    print("rst contains non existing member %r" % attr)
+
+            # if its a class, scan down the class...
+            # print(directive.type)
+            if has_attr:
+                if directive.type == "class":
+                    cls = getattr(mod, attr)
+                    # print("directive:      ", directive)
+                    for directive_child in directive.members:
+                        # print("directive_child: ", directive_child)
+                        if is_directive_pydata(filepath, directive_child):
+                            attr_child = directive_child.value_strip
+                            if attr_child not in cls.__dict__:
+                                attr_id = "%s.%s" % (attr, attr_child)
+                                print(directive_to_str(filepath, directive_child), end=" ")
+                                print("rst contains non existing class member %r" % attr_id)
+
+
+    # MODULE member missing from RST ???
+    doctree_dict = directive_members_dict(filepath, doctree)
+    for attr in dir(mod):
+        if attr.startswith("_"):
+            continue
+
+        directive = doctree_dict.get(attr)
+        if directive is None:
+            print("module contains undocumented member %r from %r" % ("%s.%s" % (mod_name, attr), filepath))
+        else:
+            if directive.type == "class":
+                directive_dict = directive_members_dict(filepath, directive.members)
+                cls = getattr(mod, attr)
+                for attr_child in cls.__dict__.keys():
+                    if attr_child.startswith("_"):
+                        continue
+                    if attr_child not in directive_dict:
+                        attr_id = "%s.%s.%s" % (mod_name, attr, attr_child), filepath
+                        print("module contains undocumented member %r from %r" % attr_id)
+
+
+def main():
+    
+    if bge is None:
+        print("Skipping BGE modules!")
+
+    for filename, modname, partial_ok in modules:
+        if bge is None and modname.startswith("bge"):
+            continue
+
+        filepath = os.path.join(RST_DIR, filename)
+        if not os.path.exists(filepath):
+            raise Exception("%r not found" % filepath)
+
+        doctree = rst_to_doctree_mini.parse_rst_py(filepath)
+        __import__(modname)
+        mod = sys.modules[modname]
+        
+        module_validate(filepath, mod, modname, doctree, partial_ok)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py
index f792b83..5bb2553 100644
--- a/source/tests/bl_run_operators.py
+++ b/source/tests/bl_run_operators.py
@@ -35,13 +35,16 @@ op_blacklist = (
     "*.open_*",
     "*.link_append",
     "render.render",
+    "render.play_rendered_anim",
     "*.*_export",
     "*.*_import",
     "wm.blenderplayer_start",
     "wm.url_open",
     "wm.doc_view",
     "wm.path_open",
-    "help.operator_cheat_sheet",
+    "wm.theme_install",
+    "wm.context_*",
+    "wm.operator_cheat_sheet",
     "wm.keyconfig_test",     # just annoying - but harmless
     "wm.memory_statistics",  # another annoying one
     "console.*",             # just annoying - but harmless
diff --git a/source/tests/bl_test.py b/source/tests/bl_test.py
index cfe9135..0cb322a 100644
--- a/source/tests/bl_test.py
+++ b/source/tests/bl_test.py
@@ -145,7 +145,7 @@ def main():
 
     if write_blend is not None:
         print("  Writing Blend: %s" % write_blend)
-        bpy.ops.wm.save_mainfile(filepath=write_blend, check_existing=False)
+        bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=write_blend)
 
     print("  Result: '%s'" % str(result))
     if not result:
diff --git a/source/tests/rna_array.py b/source/tests/rna_array.py
index 06b4735..a2241df 100644
--- a/source/tests/rna_array.py
+++ b/source/tests/rna_array.py
@@ -98,14 +98,14 @@ class TestArray(unittest.TestCase):
         for arr, rand_func in zip((test.farr, test.iarr, test.barr), (rand_float, rand_int, rand_bool)):
             for i in range(len(arr)):
                 val= rand_func()
-                arr[i]= val
+                arr[i] = val
                 
                 self.assertEqual(arr[i], val)
 
         # float prop should accept also int
         for i in range(len(test.farr)):
             val= rand_int()
-            test.farr[i]= val
+            test.farr[i] = val
             self.assertEqual(test.farr[i], float(val))
 
         # 
@@ -115,7 +115,7 @@ class TestArray(unittest.TestCase):
             arr[4] = 1.0
 
         def assign_bad_type(arr):
-            arr[1]= "123"
+            arr[1] = "123"
             
         for arr in [test.farr, test.iarr, test.barr]:
             self.assertRaises(IndexError, assign_bad_index, arr)
@@ -183,7 +183,7 @@ class TestMArray(unittest.TestCase):
             rval= make_random_2d_array((4, 5), func)
 
             for i in range(3):
-                getattr(test, arr)[i]= rval
+                getattr(test, arr)[i] = rval
                 self.assertEqual(prop_to_list(getattr(test, arr)[i]), rval)
 
         # arr[i][j] = x
@@ -194,13 +194,13 @@ class TestMArray(unittest.TestCase):
 
             for i in range(3):
                 for j in range(4):
-                    arr[i][j]= rval
+                    arr[i][j] = rval
                     self.assertEqual(prop_to_list(arr[i][j]), rval)
 
 
     def test_assign_item_fail(self):
         def assign_wrong_size(arr, i, rval):
-            getattr(test, arr)[i]= rval
+            getattr(test, arr)[i] = rval
 
         # assign wrong size at level 2
         for arr, func in zip(("fmarr", "imarr", "bmarr"), (rand_float, rand_int, rand_bool)):
diff --git a/source/tests/rst_to_doctree_mini.py b/source/tests/rst_to_doctree_mini.py
new file mode 100644
index 0000000..1810372
--- /dev/null
+++ b/source/tests/rst_to_doctree_mini.py
@@ -0,0 +1,91 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# Module with function to extract a doctree from an reStructuredText file.
+# Named 'Mini' because we only parse the minimum data needed to check
+# Python classes, methods and attributes match up to those in existing modules.
+# (To test for documentation completeness)
+
+# note: literalinclude's are not followed.
+# could be nice to add but not really needed either right now.
+
+import collections
+
+Directive = collections.namedtuple('Directive',
+                                   ("type",
+                                    "value",
+                                    "value_strip",
+                                    "line",
+                                    "indent",
+                                    "members"))
+
+
+def parse_rst_py(filepath):
+    import re
+
+    # Get the prefix assuming the line is lstrip()'d
+    # ..foo:: bar
+    # -->
+    # ("foo", "bar")
+    re_prefix = re.compile(r"^\.\.\s([a-zA-Z09\-]+)::\s*(.*)\s*$")
+    
+    tree = collections.defaultdict(list)
+    indent_map = {}
+    indent_prev = 0
+    f = open(filepath, encoding="utf-8")
+    indent_lists = []
+    for i, line in enumerate(f):
+        line_strip = line.lstrip()
+        # ^\.\.\s[a-zA-Z09\-]+::.*$
+        #if line.startswith(".. "):
+        march = re_prefix.match(line_strip)
+
+        if march:
+            directive, value = march.group(1, 2)
+            indent = len(line) - len(line_strip)
+            value_strip = value.replace("(", " ").split()
+            value_strip = value_strip[0] if value_strip else ""
+
+            item = Directive(type=directive,
+                             value=value,
+                             value_strip=value_strip,
+                             line=i,
+                             indent=indent,
+                             members=[])
+
+            tree[indent].append(item)
+            if indent_prev < indent:
+                indent_map[indent] = indent_prev
+            if indent > 0:
+                tree[indent_map[indent]][-1].members.append(item)
+            indent_prev = indent
+    f.close()
+
+    return tree[0]
+
+
+if __name__ == "__main__":
+    # not intended use, but may as well print rst files passed as a test.
+    import sys
+    for arg in sys.argv:
+        if arg.lower().endswith((".txt", ".rst")):
+            items = parse_rst_py(arg)
+            for i in items:
+                print(i)
diff --git a/source/tools/MakeCursor.py b/source/tools/MakeCursor.py
index fbe4400..3bf3127 100755
--- a/source/tools/MakeCursor.py
+++ b/source/tools/MakeCursor.py
@@ -246,14 +246,14 @@ class App:
             mask.append(m)
             bitmap.append(b)
 
-        print "\n\nstatic char bitmap[]={" %vars(),
+        print "\n\nstatic char bitmap[] = {" %vars(),
         for i in range(numbytes):
             b1=bitmap[i]
             if not(i%8): print "\n\t",
             print "0x%(b1)02x, "%vars(),
         print "\n};"
 
-        print "\nstatic char mask[]={" %vars(),
+        print "\nstatic char mask[] = {" %vars(),
         for i in range(numbytes):
             b1=mask[i]
             if not(i%8): print "\n\t",
diff --git a/source/tools/check_style_c.py b/source/tools/check_style_c.py
index 9cb02d5..3c8903b 100755
--- a/source/tools/check_style_c.py
+++ b/source/tools/check_style_c.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -25,9 +25,27 @@
 """
 This script runs outside of blender and scans source
 
-python3.2 source/tools/check_source_c.py source/
+python3 source/tools/check_source_c.py source/
 """
 
+import os
+
+from check_style_c_config import IGNORE, IGNORE_DIR, SOURCE_DIR
+IGNORE = tuple([os.path.join(SOURCE_DIR, ig) for ig in IGNORE])
+IGNORE_DIR = tuple([os.path.join(SOURCE_DIR, ig) for ig in IGNORE_DIR])
+
+
+def is_ignore(f):
+    for ig in IGNORE:
+        if f == ig:
+            return True
+    for ig in IGNORE_DIR:
+        if f.startswith(ig):
+            return True
+    return False
+
+print("Scanning:", SOURCE_DIR)
+
 # TODO
 #
 # Add checks for:
@@ -48,6 +66,8 @@ from pygments.token import Token
 import argparse
 
 PRINT_QTC_TASKFORMAT = False
+if "USE_QTC_TASK" in os.environ:
+    PRINT_QTC_TASKFORMAT = True
 
 TAB_SIZE = 4
 LIN_SIZE = 120
@@ -173,6 +193,12 @@ def warning(message, index_kw_start, index_kw_end):
     else:
         print("%s:%d: warning: %s" % (filepath, tokens[index_kw_start].line, message))
 
+def warning_lineonly(message, line):
+    if PRINT_QTC_TASKFORMAT:
+        print("%s\t%d\t%s\t%s" % (filepath, line, "comment", message))
+    else:
+        print("%s:%d: warning: %s" % (filepath, line, message))
+
     # print(tk_range_to_str(index_kw_start, index_kw_end))
 
 
@@ -188,7 +214,7 @@ def blender_check_kw_if(index_kw_start, index_kw, index_kw_end):
     # check for: ){
     index_next = tk_advance_ws_newline(index_kw_end, 1)
     if tokens[index_next].type == Token.Punctuation and tokens[index_next].text == "{":
-        if not tk_item_is_ws(tokens[index_kw + 1]):
+        if not tk_item_is_ws(tokens[index_next - 1]):
             warning("no white space between trailing bracket '%s (){'" % tokens[index_kw].text, index_kw_start, index_kw_end)
 
         # check for: if ()
@@ -238,6 +264,13 @@ def blender_check_kw_else(index_kw):
         if tokens[index_kw].line < tokens[i_next].line:
             warning("else body brace on a new line 'else\\n{'", index_kw, i_next)
 
+    # this check only tests for:
+    # else
+    # if
+    # ... which is never OK
+    if tokens[i_next].type == Token.Keyword and tokens[i_next].text == "if":
+        if tokens[index_kw].line < tokens[i_next].line:
+            warning("else if is split by a new line 'else\\nif'", index_kw, i_next)
 
 def blender_check_comma(index_kw):
     i_next = tk_advance_ws_newline(index_kw, 1)
@@ -256,7 +289,7 @@ def _is_ws_pad(index_start, index_end):
             tokens[index_end + 1].text.isspace())
 
 
-def blender_check_operator(index_start, index_end, op_text):
+def blender_check_operator(index_start, index_end, op_text, is_cpp):
     if op_text == "->":
         # allow compiler to handle
         return
@@ -275,7 +308,8 @@ def blender_check_operator(index_start, index_end, op_text):
 
         elif op_text in {"/", "%", "^", "|", "=", "<", ">"}:
             if not _is_ws_pad(index_start, index_end):
-                warning("no space around operator '%s'" % op_text, index_start, index_end)
+                if not (is_cpp and ("<" in op_text or ">" in op_text)):
+                    warning("no space around operator '%s'" % op_text, index_start, index_end)
         elif op_text == "&":
             pass  # TODO, check if this is a pointer reference or not
         elif op_text == "*":
@@ -291,7 +325,8 @@ def blender_check_operator(index_start, index_end, op_text):
                        ">*", "<*", "-*", "+*", "=*", "/*", "%*", "^*", "!*", "|*",
                        }:
             if not _is_ws_pad(index_start, index_end):
-                warning("no space around operator '%s'" % op_text, index_start, index_end)
+                if not (is_cpp and ("<" in op_text or ">" in op_text)):
+                    warning("no space around operator '%s'" % op_text, index_start, index_end)
 
         elif op_text in {"++", "--"}:
             pass  # TODO, figure out the side we are adding to!
@@ -310,6 +345,8 @@ def blender_check_operator(index_start, index_end, op_text):
             pass  # C++, ignore for now
         elif op_text == ":!*":
             pass  # ignore for now
+        elif op_text == "*>":
+            pass  # ignore for now, C++ <Class *>
         else:
             warning("unhandled operator A '%s'" % op_text, index_start, index_end)
     else:
@@ -363,18 +400,75 @@ def blender_check_linelength(index_start, index_end, length):
                 warning("line length %d > %d" % (len(l), LIN_SIZE), index_start, index_end)
 
 
+def quick_check_indentation(code):
+    """
+    Quick check for multiple tab indents.
+    """
+    t_prev = -1
+    m_comment_prev = False
+    ls_prev = ""
+    
+    for i, l in enumerate(code.split("\n")):
+        skip = False
+        
+        # skip blank lines
+        ls = l.strip()
+
+        # comment or pre-processor
+        if ls:
+            # #ifdef ... or ... // comment
+            if (ls[0] == "#" or ls[0:2] == "//"):
+                skip = True
+            # label:
+            elif (':' in ls and l[0] != '\t'):
+                skip = True
+            # /* comment */
+            #~ elif ls.startswith("/*") and ls.endswith("*/"):
+            #~     skip = True
+            # /* some comment...
+            elif ls.startswith("/*"):
+                skip = True
+            # line ending a comment: */
+            elif ls == "*/":
+                skip = True
+            # * middle of multi line comment block
+            elif ls.startswith("* "):
+                skip = True
+            # exclude muli-line defines
+            elif ls.endswith("\\") or ls.endswith("(void)0") or ls_prev.endswith("\\"):
+                skip = True
+
+        ls_prev = ls
+
+        if skip:
+            continue
+
+        if ls:
+            ls = l.lstrip("\t")
+            tabs = l[:len(l) - len(ls)]
+            t = len(tabs)
+            if (t > t_prev + 1) and (t_prev != -1):
+                warning_lineonly("indentation mis-match (indent of %d) '%s'" % (t - t_prev, tabs), i + 1)
+            t_prev = t
+
+
 def scan_source(fp, args):
     # print("scanning: %r" % fp)
 
     global filepath
 
+    is_cpp = fp.endswith((".cpp", ".cxx"))
+
     filepath = fp
     filepath_base = os.path.basename(filepath)
 
     #print(highlight(code, CLexer(), RawTokenFormatter()).decode('utf-8'))
     code = open(filepath, 'r', encoding="utf-8").read()
+    
+    quick_check_indentation(code)
+    # return
 
-    tokens[:] = []
+    del tokens[:]
     line = 1
 
     for ttype, text in lex(code, CLexer()):
@@ -400,7 +494,7 @@ def scan_source(fp, args):
             # we check these in pairs, only want first
             if tokens[i - 1].type != Token.Operator:
                 op, index_kw_end = extract_operator(i)
-                blender_check_operator(i, index_kw_end, op)
+                blender_check_operator(i, index_kw_end, op, is_cpp)
         elif tok.type in Token.Comment:
             doxyfn = None
             if "\\file" in tok.text:
@@ -451,17 +545,14 @@ def scan_source_recursive(dirpath, args):
 
     def is_source(filename):
         ext = splitext(filename)[1]
-        return (ext in {".c", ".inl", ".cpp", ".cxx", ".hpp", ".hxx", ".h"})
+        return (ext in {".c", ".inl", ".cpp", ".cxx", ".hpp", ".hxx", ".h", ".osl"})
 
     for filepath in sorted(source_list(dirpath, is_source)):
-        if "datafiles" in filepath:
-            continue
-        if     (filepath.endswith(".glsl.c") or
-                filepath.endswith("DirectDrawSurface.cpp") or
-                filepath.endswith("fnmatch.c") or
-                filepath.endswith("smoke.c") or
-                filepath.endswith("md5.c")):
+        if is_ignore(filepath):
             continue
+        # for quick tests
+        #~ if not filepath.endswith("creator.c"):
+        #~     continue
 
         scan_source(filepath, args)
 
diff --git a/source/tools/check_style_c_config.py b/source/tools/check_style_c_config.py
new file mode 100644
index 0000000..a2e307b
--- /dev/null
+++ b/source/tools/check_style_c_config.py
@@ -0,0 +1,46 @@
+import os
+
+IGNORE = (
+
+    # particles
+    "source/blender/blenkernel/intern/boids.c",
+    "source/blender/blenkernel/intern/cloth.c",
+    "source/blender/blenkernel/intern/collision.c",
+    "source/blender/blenkernel/intern/effect.c",
+    "source/blender/blenkernel/intern/implicit.c",
+    "source/blender/blenkernel/intern/particle.c",
+    "source/blender/blenkernel/intern/particle_system.c",
+    "source/blender/blenkernel/intern/pointcache.c",
+    "source/blender/blenkernel/intern/sca.c",
+    "source/blender/blenkernel/intern/softbody.c",
+    "source/blender/blenkernel/intern/smoke.c",
+
+    "source/blender/blenlib/intern/fnmatch.c",
+    "source/blender/blenlib/intern/md5.c",
+    "source/blender/blenlib/intern/voxel.c",
+
+    "source/blender/blenloader/intern/readfile.c",
+    "source/blender/blenloader/intern/versioning_250.c",
+    "source/blender/blenloader/intern/versioning_legacy.c",
+    "source/blender/blenloader/intern/writefile.c",
+
+    "source/blender/editors/space_logic/logic_buttons.c",
+    "source/blender/editors/space_logic/logic_window.c",
+    
+    "source/blender/imbuf/intern/dds/DirectDrawSurface.cpp",
+
+    "source/blender/opencl/intern/clew.c",
+    "source/blender/opencl/intern/clew.h",
+    )
+
+IGNORE_DIR = (
+    "source/blender/collada",
+    "source/blender/render",
+    "source/blender/editors/physics",
+    "source/blender/editors/space_logic",
+    "source/blender/gpu",
+    "source/blender/nodes",
+    )
+
+
+SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))))
diff --git a/source/tools/spell_check_source.py b/source/tools/spell_check_source.py
index 44ea4ff..0bfc7b3 100644
--- a/source/tools/spell_check_source.py
+++ b/source/tools/spell_check_source.py
@@ -27,6 +27,11 @@ Script for checking source code spelling.
 Currently only python source is checked.
 """
 
+import os
+PRINT_QTC_TASKFORMAT = False
+if "USE_QTC_TASK" in os.environ:
+    PRINT_QTC_TASKFORMAT = True
+
 ONLY_ONCE = True
 USE_COLOR = True
 _only_once_ids = set()
@@ -56,6 +61,7 @@ def words_from_text(text):
     text = text.replace("+", " ")
     text = text.replace("%", " ")
     text = text.replace(",", " ")
+    text = text.replace("|", " ")
     words = text.split()
 
     # filter words
@@ -177,7 +183,6 @@ def extract_c_comments(filepath):
     # http://doc.qt.nokia.com/qtcreator-2.4/creator-task-lists.html#task-list-file-format
     # file\tline\ttype\tdescription
     # ... > foobar.tasks
-    PRINT_QTC_TASKFORMAT = True
 
     # reverse these to find blocks we won't parse
     PRINT_NON_ALIGNED = False
@@ -290,14 +295,23 @@ def spell_check_comments(filepath):
                     else:
                         _only_once_ids.add(w_lower)
 
-                print("%s:%d: %s%s%s, suggest (%s)" %
-                      (comment.file,
-                       comment.line,
-                       COLOR_WORD,
-                       w,
-                       COLOR_ENDC,
-                       " ".join(dict_spelling.suggest(w)),
-                       ))
+                if PRINT_QTC_TASKFORMAT:
+                    print("%s\t%d\t%s\t%s, suggest (%s)" %
+                          (comment.file,
+                           comment.line,
+                           "comment",
+                           w,
+                           " ".join(dict_spelling.suggest(w)),
+                           ))
+                else:
+                    print("%s:%d: %s%s%s, suggest (%s)" %
+                          (comment.file,
+                           comment.line,
+                           COLOR_WORD,
+                           w,
+                           COLOR_ENDC,
+                           " ".join(dict_spelling.suggest(w)),
+                           ))
 
 
 def spell_check_comments_recursive(dirpath):
@@ -317,7 +331,7 @@ def spell_check_comments_recursive(dirpath):
 
     def is_source(filename):
         ext = splitext(filename)[1]
-        return (ext in {".c", ".inl", ".cpp", ".cxx", ".hpp", ".hxx", ".h"})
+        return (ext in {".c", ".inl", ".cpp", ".cxx", ".hpp", ".hxx", ".h", ".osl", ".py"})
 
     for filepath in source_list(dirpath, is_source):
         spell_check_comments(filepath)
diff --git a/source/tools/spell_check_source_config.py b/source/tools/spell_check_source_config.py
index a5bf66d..6621600 100644
--- a/source/tools/spell_check_source_config.py
+++ b/source/tools/spell_check_source_config.py
@@ -33,6 +33,7 @@ dict_custom = {
     "subdirectory",
     "decrement",
     "boolean",
+    "decrementing",
 
     # python types
     "str",
@@ -59,6 +60,7 @@ dict_custom = {
     "tooltip",
 
     # general computer terms
+    "endian",
     "contructor",
     "unicode",
     "jitter",
@@ -66,7 +68,6 @@ dict_custom = {
     "searchable",
     "metadata",
     "hashable",
-    "normals",
     "stdin",
     "opengl",
     "boids",
@@ -79,6 +80,8 @@ dict_custom = {
     "xml",
 
     # spesific computer terms/brands
+    "posix",
+    "unix",
     "amiga",
     "netscape",
     "mozilla",
@@ -86,9 +89,14 @@ dict_custom = {
     "kde",
 
     # general computer graphics terms
+    "colinear",
+    "coplanar",
+    "bezier",
     "radiosity",
+    "reflectance",
     "specular",
     "nurbs",
+    "ngon", "ngons",
     "bicubic",
     "compositing",
     "deinterlace",
@@ -97,6 +105,7 @@ dict_custom = {
     "centroid",
     "emissive",
     "quaternions",
+    "normals",
 
     # blender terms
     "bpy",
diff --git a/source/tools/tag_release.py b/source/tools/tag_release.py
index fab4d32..ea943e4 100644
--- a/source/tools/tag_release.py
+++ b/source/tools/tag_release.py
@@ -1,11 +1,11 @@
-#!/usr/bin/env python3.2
+#!/usr/bin/env python3
 
-REV_BLENDER = 51016
-REV_EXTENSIONS = 3805
-REV_LOCALE = 1097
+REV_BLENDER = 52841
+REV_EXTENSIONS = 4033
+REV_LOCALE = 1276
 
-TAG_BLENDER = "blender-2.64-release"
-TAG_EXTENSIONS = TAG_LOCALE = "2_64_release"
+TAG_BLENDER = "blender-2.65-release"
+TAG_EXTENSIONS = TAG_LOCALE = "2_65_release"
 
 print("\n# Run these commands from the blender source dir:")
 

-- 
blender packaging



More information about the pkg-multimedia-commits mailing list